From d18f0e20afd806a07e33ab2c99b5015bbc3122f3 Mon Sep 17 00:00:00 2001 From: Eirikr Hinngart <151315375+Oichkatzelesfrettschen@users.noreply.github.com> Date: Sat, 31 May 2025 09:54:31 -0700 Subject: [PATCH] re-organization --- common/dist/zlib/ChangeLog | 855 - common/dist/zlib/FAQ | 339 - common/dist/zlib/INDEX | 51 - common/dist/zlib/Makefile | 154 - common/dist/zlib/Makefile.in | 154 - common/dist/zlib/README | 125 - common/dist/zlib/algorithm.txt | 209 - common/dist/zlib/amiga/Makefile.pup | 66 - common/dist/zlib/amiga/Makefile.sas | 65 - common/dist/zlib/as400/bndsrc | 132 - common/dist/zlib/as400/compile.clp | 123 - common/dist/zlib/as400/readme.txt | 111 - common/dist/zlib/as400/zlib.inc | 331 - common/dist/zlib/configure | 459 - common/dist/zlib/contrib/README.contrib | 71 - common/dist/zlib/contrib/ada/buffer_demo.adb | 106 - common/dist/zlib/contrib/ada/mtest.adb | 156 - common/dist/zlib/contrib/ada/read.adb | 156 - common/dist/zlib/contrib/ada/readme.txt | 65 - common/dist/zlib/contrib/ada/test.adb | 463 - common/dist/zlib/contrib/ada/zlib-streams.adb | 225 - common/dist/zlib/contrib/ada/zlib-streams.ads | 114 - common/dist/zlib/contrib/ada/zlib-thin.adb | 141 - common/dist/zlib/contrib/ada/zlib-thin.ads | 450 - common/dist/zlib/contrib/ada/zlib.adb | 701 - common/dist/zlib/contrib/ada/zlib.ads | 328 - common/dist/zlib/contrib/ada/zlib.gpr | 20 - common/dist/zlib/contrib/asm586/README.586 | 43 - common/dist/zlib/contrib/asm586/match.S | 364 - common/dist/zlib/contrib/asm686/README.686 | 34 - common/dist/zlib/contrib/asm686/match.S | 329 - common/dist/zlib/contrib/blast/Makefile | 8 - common/dist/zlib/contrib/blast/README | 4 - common/dist/zlib/contrib/blast/test.pk | Bin 8 -> 0 bytes common/dist/zlib/contrib/blast/test.txt | 1 - common/dist/zlib/contrib/delphi/ZLib.pas | 557 - common/dist/zlib/contrib/delphi/ZLibConst.pas | 11 - common/dist/zlib/contrib/delphi/readme.txt | 76 - common/dist/zlib/contrib/delphi/zlibd32.mak | 93 - .../dist/zlib/contrib/dotzlib/DotZLib.build | 33 - common/dist/zlib/contrib/dotzlib/DotZLib.chm | Bin 72728 -> 0 bytes common/dist/zlib/contrib/dotzlib/DotZLib.sln | 21 - .../contrib/dotzlib/DotZLib/AssemblyInfo.cs | 58 - .../contrib/dotzlib/DotZLib/ChecksumImpl.cs | 202 - .../contrib/dotzlib/DotZLib/CircularBuffer.cs | 83 - .../zlib/contrib/dotzlib/DotZLib/CodecBase.cs | 198 - .../zlib/contrib/dotzlib/DotZLib/Deflater.cs | 106 - .../zlib/contrib/dotzlib/DotZLib/DotZLib.cs | 288 - .../contrib/dotzlib/DotZLib/DotZLib.csproj | 141 - .../contrib/dotzlib/DotZLib/GZipStream.cs | 301 - .../zlib/contrib/dotzlib/DotZLib/Inflater.cs | 105 - .../zlib/contrib/dotzlib/DotZLib/UnitTests.cs | 274 - .../dist/zlib/contrib/dotzlib/LICENSE_1_0.txt | 23 - common/dist/zlib/contrib/dotzlib/readme.txt | 58 - common/dist/zlib/contrib/infback9/README | 1 - common/dist/zlib/contrib/inflate86/inffast.S | 1368 - common/dist/zlib/contrib/iostream/test.cpp | 23 - .../dist/zlib/contrib/iostream/zfstream.cpp | 292 - .../zlib/contrib/iostream2/zstream_test.cpp | 28 - common/dist/zlib/contrib/iostream3/README | 35 - common/dist/zlib/contrib/iostream3/TODO | 17 - common/dist/zlib/contrib/iostream3/test.cc | 50 - .../dist/zlib/contrib/iostream3/zfstream.cc | 479 - common/dist/zlib/contrib/masm686/match.asm | 413 - common/dist/zlib/contrib/masmx64/bld_ml64.bat | 2 - common/dist/zlib/contrib/masmx64/gvmat64.asm | 513 - .../dist/zlib/contrib/masmx64/inffasx64.asm | 392 - common/dist/zlib/contrib/masmx64/readme.txt | 28 - common/dist/zlib/contrib/masmx86/bld_ml32.bat | 2 - common/dist/zlib/contrib/masmx86/gvmat32.asm | 972 - common/dist/zlib/contrib/masmx86/inffas32.asm | 1083 - common/dist/zlib/contrib/masmx86/mkasm.bat | 3 - common/dist/zlib/contrib/masmx86/readme.txt | 21 - .../dist/zlib/contrib/minizip/ChangeLogUnzip | 67 - common/dist/zlib/contrib/minizip/Makefile | 25 - common/dist/zlib/contrib/pascal/example.pas | 599 - common/dist/zlib/contrib/pascal/readme.txt | 76 - common/dist/zlib/contrib/pascal/zlibd32.mak | 93 - common/dist/zlib/contrib/pascal/zlibpas.pas | 236 - common/dist/zlib/contrib/puff/Makefile | 8 - common/dist/zlib/contrib/puff/README | 63 - common/dist/zlib/contrib/puff/zeros.raw | Bin 1213 -> 0 bytes .../dist/zlib/contrib/testzlib/testzlib.txt | 10 - common/dist/zlib/contrib/untgz/Makefile | 14 - common/dist/zlib/contrib/untgz/Makefile.msc | 17 - common/dist/zlib/contrib/vstudio/readme.txt | 73 - .../zlib/contrib/vstudio/vc7/miniunz.vcproj | 126 - .../zlib/contrib/vstudio/vc7/minizip.vcproj | 126 - .../zlib/contrib/vstudio/vc7/testzlib.vcproj | 126 - common/dist/zlib/contrib/vstudio/vc7/zlib.rc | 32 - .../zlib/contrib/vstudio/vc7/zlibstat.vcproj | 246 - .../dist/zlib/contrib/vstudio/vc7/zlibvc.def | 92 - .../dist/zlib/contrib/vstudio/vc7/zlibvc.sln | 78 - .../zlib/contrib/vstudio/vc7/zlibvc.vcproj | 445 - .../zlib/contrib/vstudio/vc8/miniunz.vcproj | 566 - .../zlib/contrib/vstudio/vc8/minizip.vcproj | 563 - .../zlib/contrib/vstudio/vc8/testzlib.vcproj | 948 - .../contrib/vstudio/vc8/testzlibdll.vcproj | 567 - common/dist/zlib/contrib/vstudio/vc8/zlib.rc | 32 - .../zlib/contrib/vstudio/vc8/zlibstat.vcproj | 870 - .../dist/zlib/contrib/vstudio/vc8/zlibvc.def | 92 - .../dist/zlib/contrib/vstudio/vc8/zlibvc.sln | 144 - .../zlib/contrib/vstudio/vc8/zlibvc.vcproj | 1219 - common/dist/zlib/examples/README.examples | 42 - common/dist/zlib/examples/zlib_how.html | 523 - common/dist/zlib/make_vms.com | 461 - common/dist/zlib/msdos/Makefile.bor | 109 - common/dist/zlib/msdos/Makefile.dj2 | 104 - common/dist/zlib/msdos/Makefile.emx | 69 - common/dist/zlib/msdos/Makefile.msc | 106 - common/dist/zlib/msdos/Makefile.tc | 94 - common/dist/zlib/old/Makefile.riscos | 151 - common/dist/zlib/old/README | 3 - common/dist/zlib/old/descrip.mms | 48 - common/dist/zlib/old/os2/Makefile.os2 | 136 - common/dist/zlib/old/os2/zlib.def | 51 - common/dist/zlib/old/visual-basic.txt | 160 - common/dist/zlib/old/zlib.html | 971 - common/dist/zlib/projects/README.projects | 41 - common/dist/zlib/projects/visualc6/README.txt | 73 - .../dist/zlib/projects/visualc6/example.dsp | 278 - .../dist/zlib/projects/visualc6/minigzip.dsp | 278 - common/dist/zlib/projects/visualc6/zlib.dsp | 609 - common/dist/zlib/projects/visualc6/zlib.dsw | 59 - common/dist/zlib/qnx/package.qpg | 141 - common/dist/zlib/win32/DLL_FAQ.txt | 397 - common/dist/zlib/win32/Makefile.bor | 107 - common/dist/zlib/win32/Makefile.emx | 69 - common/dist/zlib/win32/Makefile.gcc | 141 - common/dist/zlib/win32/Makefile.msc | 126 - common/dist/zlib/win32/VisualC.txt | 3 - common/dist/zlib/win32/zlib.def | 60 - common/dist/zlib/win32/zlib1.rc | 39 - common/include/ppath/Makefile | 9 - common/include/ppath/ppath.h | 91 - common/include/ppath/ppath_impl.h | 23 - common/include/prop/Makefile | 9 - common/include/prop/plistref.h | 48 - common/include/prop/prop_array.h | 163 - common/include/prop/prop_bool.h | 48 - common/include/prop/prop_data.h | 54 - common/include/prop/prop_dictionary.h | 181 - common/include/prop/prop_ingest.h | 90 - common/include/prop/prop_number.h | 59 - common/include/prop/prop_object.h | 72 - common/include/prop/prop_string.h | 60 - common/include/prop/proplib.h | 50 - common/lib/libc/Makefile.inc | 51 - .../lib/libc/arch/aarch64/atomic/Makefile.inc | 25 - .../libc/arch/aarch64/atomic/atomic_add_16.S | 46 - .../libc/arch/aarch64/atomic/atomic_add_32.S | 46 - .../libc/arch/aarch64/atomic/atomic_add_64.S | 50 - .../libc/arch/aarch64/atomic/atomic_add_8.S | 46 - .../libc/arch/aarch64/atomic/atomic_and_16.S | 46 - .../libc/arch/aarch64/atomic/atomic_and_32.S | 46 - .../libc/arch/aarch64/atomic/atomic_and_64.S | 46 - .../libc/arch/aarch64/atomic/atomic_and_8.S | 46 - .../libc/arch/aarch64/atomic/atomic_cas_16.S | 48 - .../libc/arch/aarch64/atomic/atomic_cas_32.S | 52 - .../libc/arch/aarch64/atomic/atomic_cas_64.S | 55 - .../libc/arch/aarch64/atomic/atomic_cas_8.S | 48 - .../libc/arch/aarch64/atomic/atomic_dec_32.S | 59 - .../libc/arch/aarch64/atomic/atomic_dec_64.S | 63 - .../libc/arch/aarch64/atomic/atomic_inc_32.S | 59 - .../libc/arch/aarch64/atomic/atomic_inc_64.S | 63 - .../libc/arch/aarch64/atomic/atomic_nand_16.S | 64 - .../libc/arch/aarch64/atomic/atomic_nand_32.S | 64 - .../libc/arch/aarch64/atomic/atomic_nand_64.S | 64 - .../libc/arch/aarch64/atomic/atomic_nand_8.S | 64 - .../libc/arch/aarch64/atomic/atomic_op_asm.h | 135 - .../libc/arch/aarch64/atomic/atomic_or_16.S | 46 - .../libc/arch/aarch64/atomic/atomic_or_32.S | 46 - .../libc/arch/aarch64/atomic/atomic_or_64.S | 46 - .../libc/arch/aarch64/atomic/atomic_or_8.S | 46 - .../libc/arch/aarch64/atomic/atomic_sub_16.S | 50 - .../libc/arch/aarch64/atomic/atomic_sub_32.S | 46 - .../libc/arch/aarch64/atomic/atomic_sub_64.S | 50 - .../libc/arch/aarch64/atomic/atomic_sub_8.S | 46 - .../libc/arch/aarch64/atomic/atomic_swap_16.S | 53 - .../libc/arch/aarch64/atomic/atomic_swap_32.S | 51 - .../libc/arch/aarch64/atomic/atomic_swap_64.S | 53 - .../libc/arch/aarch64/atomic/atomic_swap_8.S | 53 - .../libc/arch/aarch64/atomic/atomic_xor_16.S | 46 - .../libc/arch/aarch64/atomic/atomic_xor_32.S | 46 - .../libc/arch/aarch64/atomic/atomic_xor_64.S | 44 - .../libc/arch/aarch64/atomic/atomic_xor_8.S | 46 - .../lib/libc/arch/aarch64/atomic/membar_ops.S | 55 - .../lib/libc/arch/aarch64/gen/byte_swap_2.S | 47 - .../lib/libc/arch/aarch64/gen/byte_swap_4.S | 47 - .../lib/libc/arch/aarch64/gen/byte_swap_8.S | 47 - common/lib/libc/arch/aarch64/gen/clzdi2.S | 10 - common/lib/libc/arch/aarch64/gen/ctzdi2.S | 11 - common/lib/libc/arch/aarch64/gen/ffsdi2.S | 14 - common/lib/libc/arch/aarch64/string/memcmp.S | 187 - common/lib/libc/arch/aarch64/string/memcpy.S | 126 - common/lib/libc/arch/aarch64/string/memset.S | 200 - common/lib/libc/arch/aarch64/string/strcat.S | 57 - common/lib/libc/arch/aarch64/string/strlen.S | 113 - common/lib/libc/arch/aarch64/string/strnlen.S | 5 - .../lib/libc/arch/alpha/atomic/Makefile.inc | 15 - .../lib/libc/arch/alpha/atomic/atomic_add.S | 88 - .../lib/libc/arch/alpha/atomic/atomic_and.S | 84 - .../lib/libc/arch/alpha/atomic/atomic_cas.S | 78 - .../lib/libc/arch/alpha/atomic/atomic_dec.S | 88 - .../lib/libc/arch/alpha/atomic/atomic_inc.S | 88 - .../libc/arch/alpha/atomic/atomic_op_asm.h | 47 - common/lib/libc/arch/alpha/atomic/atomic_or.S | 84 - .../lib/libc/arch/alpha/atomic/atomic_swap.S | 60 - .../lib/libc/arch/alpha/atomic/membar_ops.S | 91 - common/lib/libc/arch/alpha/gen/byte_swap_2.S | 49 - common/lib/libc/arch/alpha/gen/byte_swap_4.S | 55 - common/lib/libc/arch/alpha/gmon/_mcount.S | 128 - common/lib/libc/arch/alpha/string/bcopy.S | 288 - common/lib/libc/arch/alpha/string/bzero.S | 110 - common/lib/libc/arch/alpha/string/ffs.S | 94 - common/lib/libc/arch/alpha/string/memcpy.S | 4 - common/lib/libc/arch/alpha/string/memmove.S | 4 - common/lib/libc/arch/arm/atomic/Makefile.inc | 89 - .../lib/libc/arch/arm/atomic/atomic_add_16.S | 102 - .../lib/libc/arch/arm/atomic/atomic_add_32.S | 110 - .../lib/libc/arch/arm/atomic/atomic_add_64.S | 62 - .../lib/libc/arch/arm/atomic/atomic_add_8.S | 102 - .../lib/libc/arch/arm/atomic/atomic_and_16.S | 77 - .../lib/libc/arch/arm/atomic/atomic_and_32.S | 81 - .../lib/libc/arch/arm/atomic/atomic_and_64.S | 62 - .../lib/libc/arch/arm/atomic/atomic_and_8.S | 77 - .../lib/libc/arch/arm/atomic/atomic_cas_16.S | 64 - .../lib/libc/arch/arm/atomic/atomic_cas_32.S | 76 - .../lib/libc/arch/arm/atomic/atomic_cas_64.S | 75 - .../lib/libc/arch/arm/atomic/atomic_cas_8.S | 65 - .../lib/libc/arch/arm/atomic/atomic_cas_up.S | 100 - .../lib/libc/arch/arm/atomic/atomic_dec_32.S | 80 - .../lib/libc/arch/arm/atomic/atomic_dec_64.S | 55 - .../lib/libc/arch/arm/atomic/atomic_inc_32.S | 78 - .../lib/libc/arch/arm/atomic/atomic_inc_64.S | 55 - .../lib/libc/arch/arm/atomic/atomic_nand_16.S | 78 - .../lib/libc/arch/arm/atomic/atomic_nand_32.S | 82 - .../lib/libc/arch/arm/atomic/atomic_nand_64.S | 64 - .../lib/libc/arch/arm/atomic/atomic_nand_8.S | 78 - .../lib/libc/arch/arm/atomic/atomic_op_asm.h | 77 - .../lib/libc/arch/arm/atomic/atomic_or_16.S | 76 - .../lib/libc/arch/arm/atomic/atomic_or_32.S | 80 - .../lib/libc/arch/arm/atomic/atomic_or_64.S | 62 - common/lib/libc/arch/arm/atomic/atomic_or_8.S | 77 - .../libc/arch/arm/atomic/atomic_simplelock.c | 72 - .../lib/libc/arch/arm/atomic/atomic_sub_64.S | 63 - common/lib/libc/arch/arm/atomic/atomic_swap.S | 139 - .../lib/libc/arch/arm/atomic/atomic_swap_16.S | 65 - .../lib/libc/arch/arm/atomic/atomic_swap_64.S | 63 - .../lib/libc/arch/arm/atomic/atomic_xor_16.S | 77 - .../lib/libc/arch/arm/atomic/atomic_xor_32.S | 80 - .../lib/libc/arch/arm/atomic/atomic_xor_64.S | 62 - .../lib/libc/arch/arm/atomic/atomic_xor_8.S | 77 - common/lib/libc/arch/arm/atomic/membar_ops.S | 68 - .../arm/atomic/sync_bool_compare_and_swap_1.S | 62 - .../arm/atomic/sync_bool_compare_and_swap_2.S | 61 - .../arm/atomic/sync_bool_compare_and_swap_4.S | 61 - .../arm/atomic/sync_bool_compare_and_swap_8.S | 73 - .../arch/arm/atomic/sync_fetch_and_add_8.S | 60 - .../arch/arm/atomic/sync_fetch_and_and_8.S | 60 - .../arch/arm/atomic/sync_fetch_and_nand_8.S | 60 - .../arch/arm/atomic/sync_fetch_and_or_8.S | 60 - .../arch/arm/atomic/sync_fetch_and_sub_8.S | 60 - .../arch/arm/atomic/sync_fetch_and_xor_8.S | 60 - common/lib/libc/arch/arm/features.c | 74 - common/lib/libc/arch/arm/features.mk | 9 - common/lib/libc/arch/arm/gen/__aeabi_idiv0.c | 67 - common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c | 67 - common/lib/libc/arch/arm/gen/byte_swap_2.S | 61 - common/lib/libc/arch/arm/gen/byte_swap_4.S | 65 - common/lib/libc/arch/arm/gen/neon_mask.S | 59 - common/lib/libc/arch/arm/quad/__aeabi_lcmp.c | 55 - .../lib/libc/arch/arm/quad/__aeabi_ldivmod.S | 255 - common/lib/libc/arch/arm/quad/__aeabi_ulcmp.c | 55 - .../lib/libc/arch/arm/quad/__aeabi_uldivmod.S | 124 - common/lib/libc/arch/arm/string/ffs.S | 94 - common/lib/libc/arch/arm/string/memcmp.S | 185 - common/lib/libc/arch/arm/string/memcpy.S | 15 - common/lib/libc/arch/arm/string/memcpy_arm.S | 333 - common/lib/libc/arch/arm/string/memcpy_neon.S | 277 - .../lib/libc/arch/arm/string/memcpy_xscale.S | 1894 - common/lib/libc/arch/arm/string/memmove.S | 592 - common/lib/libc/arch/arm/string/memset.S | 259 - common/lib/libc/arch/arm/string/memset_arm.S | 173 - .../lib/libc/arch/arm/string/memset_naive.S | 86 - common/lib/libc/arch/arm/string/memset_neon.S | 186 - common/lib/libc/arch/arm/string/strcat.S | 7 - common/lib/libc/arch/arm/string/strcat_arm.S | 71 - .../lib/libc/arch/arm/string/strcat_naive.S | 62 - common/lib/libc/arch/arm/string/strchr.S | 11 - common/lib/libc/arch/arm/string/strchr_arm.S | 172 - .../lib/libc/arch/arm/string/strchr_naive.S | 57 - common/lib/libc/arch/arm/string/strcmp.S | 53 - common/lib/libc/arch/arm/string/strcpy.S | 11 - common/lib/libc/arch/arm/string/strcpy_arm.S | 527 - .../lib/libc/arch/arm/string/strcpy_naive.S | 93 - .../lib/libc/arch/arm/string/strcpy_thumb.S | 102 - common/lib/libc/arch/arm/string/strlcat.S | 14 - common/lib/libc/arch/arm/string/strlcat_arm.S | 73 - .../lib/libc/arch/arm/string/strlcat_naive.S | 79 - common/lib/libc/arch/arm/string/strlcpy.S | 13 - common/lib/libc/arch/arm/string/strlen.S | 9 - common/lib/libc/arch/arm/string/strlen_arm.S | 186 - .../lib/libc/arch/arm/string/strlen_naive.S | 74 - common/lib/libc/arch/arm/string/strlen_neon.S | 86 - common/lib/libc/arch/arm/string/strncmp.S | 77 - common/lib/libc/arch/arm/string/strncpy.S | 13 - common/lib/libc/arch/arm/string/strnlen.S | 11 - common/lib/libc/arch/arm/string/strrchr.S | 11 - common/lib/libc/arch/arm/string/strrchr_arm.S | 161 - .../lib/libc/arch/arm/string/strrchr_naive.S | 56 - common/lib/libc/arch/hppa/atomic/Makefile.inc | 40 - .../lib/libc/arch/hppa/atomic/atomic_cas_up.S | 70 - common/lib/libc/arch/hppa/atomic/membar_ops.S | 67 - common/lib/libc/arch/i386/atomic/Makefile.inc | 19 - common/lib/libc/arch/i386/atomic/atomic.S | 405 - common/lib/libc/arch/i386/gen/byte_swap_2.S | 59 - common/lib/libc/arch/i386/gen/byte_swap_4.S | 59 - common/lib/libc/arch/i386/string/ffs.S | 21 - common/lib/libc/arch/i386/string/memchr.S | 110 - common/lib/libc/arch/i386/string/memcmp.S | 48 - common/lib/libc/arch/i386/string/memcpy.S | 143 - common/lib/libc/arch/i386/string/memmove.S | 4 - common/lib/libc/arch/i386/string/memset.S | 111 - .../lib/libc/arch/i386/string/small/memcmp.S | 51 - .../lib/libc/arch/i386/string/small/memcpy.S | 76 - .../lib/libc/arch/i386/string/small/memmove.S | 4 - .../lib/libc/arch/i386/string/small/memset.S | 46 - .../lib/libc/arch/i386/string/small/strchr.S | 52 - .../lib/libc/arch/i386/string/small/strcmp.S | 51 - .../lib/libc/arch/i386/string/small/strcpy.S | 49 - .../lib/libc/arch/i386/string/small/strlen.S | 42 - common/lib/libc/arch/i386/string/strcat.S | 128 - common/lib/libc/arch/i386/string/strchr.S | 104 - common/lib/libc/arch/i386/string/strcmp.S | 78 - common/lib/libc/arch/i386/string/strcpy.S | 87 - common/lib/libc/arch/i386/string/strlen.S | 142 - common/lib/libc/arch/i386/string/strrchr.S | 97 - common/lib/libc/arch/ia64/atomic/Makefile.inc | 21 - common/lib/libc/arch/ia64/atomic/atomic.S | 270 - common/lib/libc/arch/m68k/atomic/Makefile.inc | 58 - common/lib/libc/arch/m68k/atomic/atomic_add.S | 128 - common/lib/libc/arch/m68k/atomic/atomic_and.S | 128 - common/lib/libc/arch/m68k/atomic/atomic_cas.S | 126 - .../libc/arch/m68k/atomic/atomic_cas_68000.S | 78 - common/lib/libc/arch/m68k/atomic/atomic_dec.S | 65 - common/lib/libc/arch/m68k/atomic/atomic_inc.S | 65 - .../lib/libc/arch/m68k/atomic/atomic_nand.S | 123 - .../lib/libc/arch/m68k/atomic/atomic_op_asm.h | 57 - common/lib/libc/arch/m68k/atomic/atomic_or.S | 129 - common/lib/libc/arch/m68k/atomic/atomic_sub.S | 128 - .../lib/libc/arch/m68k/atomic/atomic_swap.S | 81 - common/lib/libc/arch/m68k/atomic/atomic_xor.S | 135 - common/lib/libc/arch/m68k/gen/bswap16.S | 54 - common/lib/libc/arch/m68k/gen/bswap32.S | 55 - common/lib/libc/arch/m68k/gen/bswap64.S | 64 - common/lib/libc/arch/m68k/gen/divsi3.S | 70 - common/lib/libc/arch/m68k/gen/modsi3.S | 76 - common/lib/libc/arch/m68k/gen/mulsi3.S | 69 - common/lib/libc/arch/m68k/gen/udivsi3.S | 129 - common/lib/libc/arch/m68k/gen/umodsi3.S | 67 - common/lib/libc/arch/m68k/net/htonl.S | 51 - common/lib/libc/arch/m68k/net/htons.S | 52 - common/lib/libc/arch/m68k/net/ntohl.S | 51 - common/lib/libc/arch/m68k/net/ntohs.S | 52 - common/lib/libc/arch/m68k/string/bcmp.S | 196 - common/lib/libc/arch/m68k/string/bcopy.S | 281 - common/lib/libc/arch/m68k/string/bzero.S | 154 - common/lib/libc/arch/m68k/string/ffs.S | 95 - common/lib/libc/arch/m68k/string/memcmp.S | 117 - common/lib/libc/arch/m68k/string/memcpy.S | 4 - common/lib/libc/arch/m68k/string/memmove.S | 4 - common/lib/libc/arch/m68k/string/memset.S | 174 - common/lib/libc/arch/m68k/string/strcat.S | 61 - common/lib/libc/arch/m68k/string/strchr.S | 64 - common/lib/libc/arch/m68k/string/strcmp.S | 85 - common/lib/libc/arch/m68k/string/strcpy.S | 57 - common/lib/libc/arch/m68k/string/strlen.S | 55 - common/lib/libc/arch/m68k/string/strncmp.S | 100 - common/lib/libc/arch/m68k/string/strncpy.S | 80 - common/lib/libc/arch/m68k/string/strrchr.S | 61 - common/lib/libc/arch/mips/atomic/Makefile.inc | 59 - common/lib/libc/arch/mips/atomic/atomic_add.S | 127 - common/lib/libc/arch/mips/atomic/atomic_and.S | 113 - common/lib/libc/arch/mips/atomic/atomic_cas.S | 98 - .../lib/libc/arch/mips/atomic/atomic_cas_up.S | 50 - common/lib/libc/arch/mips/atomic/atomic_dec.S | 128 - common/lib/libc/arch/mips/atomic/atomic_inc.S | 129 - .../lib/libc/arch/mips/atomic/atomic_op_asm.h | 53 - common/lib/libc/arch/mips/atomic/atomic_or.S | 110 - .../lib/libc/arch/mips/atomic/atomic_swap.S | 87 - common/lib/libc/arch/mips/atomic/membar_ops.S | 80 - common/lib/libc/arch/mips/gen/byte_swap_2.S | 83 - common/lib/libc/arch/mips/gen/byte_swap_4.S | 87 - common/lib/libc/arch/mips/gen/byte_swap_8.S | 118 - common/lib/libc/arch/mips/string/bcopy.S | 298 - common/lib/libc/arch/mips/string/ffs.S | 110 - common/lib/libc/arch/mips/string/memcpy.S | 5 - common/lib/libc/arch/mips/string/memmove.S | 5 - common/lib/libc/arch/mips/string/strchr.S | 60 - common/lib/libc/arch/mips/string/strcmp.S | 63 - common/lib/libc/arch/mips/string/strlen.S | 50 - common/lib/libc/arch/mips/string/strrchr.S | 58 - common/lib/libc/arch/or1k/atomic/Makefile.inc | 28 - .../lib/libc/arch/or1k/atomic/atomic_add_32.S | 97 - .../lib/libc/arch/or1k/atomic/atomic_and_32.S | 67 - .../lib/libc/arch/or1k/atomic/atomic_cas_32.S | 61 - .../lib/libc/arch/or1k/atomic/atomic_dec_32.S | 68 - .../lib/libc/arch/or1k/atomic/atomic_inc_32.S | 65 - .../libc/arch/or1k/atomic/atomic_nand_32.S | 68 - .../lib/libc/arch/or1k/atomic/atomic_op_asm.h | 57 - .../lib/libc/arch/or1k/atomic/atomic_or_32.S | 66 - .../libc/arch/or1k/atomic/atomic_swap_32.S | 59 - .../lib/libc/arch/or1k/atomic/atomic_xor_32.S | 66 - common/lib/libc/arch/or1k/atomic/membar_ops.S | 57 - .../atomic/sync_bool_compare_and_swap_4.S | 45 - common/lib/libc/arch/or1k/gen/mulsi3.S | 74 - common/lib/libc/arch/or1k/string/bcopy.S | 4 - common/lib/libc/arch/or1k/string/bzero.S | 4 - common/lib/libc/arch/or1k/string/clz.S | 68 - common/lib/libc/arch/or1k/string/ctz.S | 69 - common/lib/libc/arch/or1k/string/ffs.S | 64 - common/lib/libc/arch/or1k/string/memcmp.S | 213 - common/lib/libc/arch/or1k/string/memcpy.c | 135 - common/lib/libc/arch/or1k/string/memmove.S | 218 - common/lib/libc/arch/or1k/string/memset.S | 135 - common/lib/libc/arch/or1k/string/strlen.S | 123 - .../lib/libc/arch/powerpc/atomic/Makefile.inc | 15 - .../lib/libc/arch/powerpc/atomic/atomic_add.S | 73 - .../lib/libc/arch/powerpc/atomic/atomic_and.S | 61 - .../lib/libc/arch/powerpc/atomic/atomic_cas.S | 95 - .../lib/libc/arch/powerpc/atomic/atomic_dec.S | 72 - .../lib/libc/arch/powerpc/atomic/atomic_inc.S | 73 - .../libc/arch/powerpc/atomic/atomic_op_asm.h | 97 - .../lib/libc/arch/powerpc/atomic/atomic_or.S | 61 - .../libc/arch/powerpc/atomic/atomic_swap.S | 70 - .../lib/libc/arch/powerpc/atomic/membar_ops.S | 56 - common/lib/libc/arch/powerpc/string/bcopy.S | 4 - common/lib/libc/arch/powerpc/string/ffs.S | 45 - common/lib/libc/arch/powerpc/string/memcmp.S | 270 - common/lib/libc/arch/powerpc/string/memcpy.S | 149 - common/lib/libc/arch/powerpc/string/memmove.S | 182 - common/lib/libc/arch/powerpc/string/strlen.S | 118 - .../libc/arch/powerpc64/atomic/Makefile.inc | 5 - common/lib/libc/arch/powerpc64/string/ffs.S | 3 - .../lib/libc/arch/powerpc64/string/strlen.S | 5 - .../lib/libc/arch/riscv/atomic/Makefile.inc | 30 - .../libc/arch/riscv/atomic/atomic_add_32.S | 93 - .../libc/arch/riscv/atomic/atomic_add_64.S | 77 - .../libc/arch/riscv/atomic/atomic_and_32.S | 62 - .../libc/arch/riscv/atomic/atomic_and_64.S | 54 - .../libc/arch/riscv/atomic/atomic_cas_32.S | 71 - .../libc/arch/riscv/atomic/atomic_cas_64.S | 70 - .../libc/arch/riscv/atomic/atomic_nand_32.S | 71 - .../libc/arch/riscv/atomic/atomic_nand_64.S | 63 - .../libc/arch/riscv/atomic/atomic_op_asm.h | 54 - .../lib/libc/arch/riscv/atomic/atomic_or_32.S | 63 - .../lib/libc/arch/riscv/atomic/atomic_or_64.S | 55 - .../libc/arch/riscv/atomic/atomic_sub_32.S | 95 - .../libc/arch/riscv/atomic/atomic_sub_64.S | 79 - .../libc/arch/riscv/atomic/atomic_swap_32.S | 59 - .../libc/arch/riscv/atomic/atomic_swap_64.S | 55 - .../libc/arch/riscv/atomic/atomic_xor_32.S | 63 - .../libc/arch/riscv/atomic/atomic_xor_64.S | 55 - .../lib/libc/arch/riscv/atomic/membar_ops.S | 63 - common/lib/libc/arch/riscv/string/ffs.c | 12 - common/lib/libc/arch/sh3/atomic/Makefile.inc | 31 - common/lib/libc/arch/sh3/string/ffs.S | 97 - common/lib/libc/arch/sh3/string/memcpy.S | 271 - common/lib/libc/arch/sh3/string/memmove.S | 4 - common/lib/libc/arch/sh3/string/memset.S | 298 - .../lib/libc/arch/sparc/atomic/Makefile.inc | 55 - .../lib/libc/arch/sparc/atomic/atomic_cas.S | 159 - .../libc/arch/sparc/atomic/atomic_cas_up.S | 69 - .../libc/arch/sparc/atomic/atomic_op_asm.h | 65 - .../lib/libc/arch/sparc/atomic/membar_ops.S | 55 - common/lib/libc/arch/sparc/gen/mul.S | 156 - common/lib/libc/arch/sparc/gen/saveregs.S | 61 - common/lib/libc/arch/sparc/gen/umul.S | 189 - common/lib/libc/arch/sparc/net/htonl.S | 52 - common/lib/libc/arch/sparc/net/htons.S | 51 - common/lib/libc/arch/sparc/net/ntohl.S | 49 - common/lib/libc/arch/sparc/net/ntohs.S | 52 - common/lib/libc/arch/sparc/string/bzero.S | 179 - common/lib/libc/arch/sparc/string/ffs.S | 114 - common/lib/libc/arch/sparc/string/memset.S | 4 - common/lib/libc/arch/sparc/string/strlen.S | 55 - .../lib/libc/arch/sparc64/atomic/Makefile.inc | 15 - .../lib/libc/arch/sparc64/atomic/atomic_add.S | 76 - .../lib/libc/arch/sparc64/atomic/atomic_and.S | 72 - .../lib/libc/arch/sparc64/atomic/atomic_cas.S | 66 - .../lib/libc/arch/sparc64/atomic/atomic_dec.S | 76 - .../lib/libc/arch/sparc64/atomic/atomic_inc.S | 76 - .../libc/arch/sparc64/atomic/atomic_op_asm.h | 65 - .../lib/libc/arch/sparc64/atomic/atomic_or.S | 72 - .../libc/arch/sparc64/atomic/atomic_swap.S | 63 - .../lib/libc/arch/sparc64/atomic/membar_ops.S | 54 - common/lib/libc/arch/sparc64/gen/mul.S | 64 - common/lib/libc/arch/sparc64/gen/saveregs.S | 62 - common/lib/libc/arch/sparc64/gen/umul.S | 62 - common/lib/libc/arch/sparc64/net/htonl.S | 52 - common/lib/libc/arch/sparc64/net/htons.S | 52 - common/lib/libc/arch/sparc64/net/ntohl.S | 49 - common/lib/libc/arch/sparc64/net/ntohs.S | 54 - common/lib/libc/arch/sparc64/string/ffs.S | 135 - common/lib/libc/arch/sparc64/string/memcpy.S | 1627 - common/lib/libc/arch/sparc64/string/memset.S | 218 - common/lib/libc/arch/sparc64/string/strlen.S | 165 - .../lib/libc/arch/sparc64/string/strmacros.h | 119 - common/lib/libc/arch/vax/atomic/Makefile.inc | 31 - common/lib/libc/arch/vax/gen/bswap16.S | 47 - common/lib/libc/arch/vax/gen/bswap32.S | 48 - common/lib/libc/arch/vax/gen/bswap64.S | 18 - common/lib/libc/arch/vax/gen/udiv.S | 92 - common/lib/libc/arch/vax/gen/urem.S | 92 - common/lib/libc/arch/vax/string/memcpy.S | 90 - common/lib/libc/arch/vax/string/memmove.S | 90 - common/lib/libc/arch/vax/string/memset.S | 52 - .../lib/libc/arch/x86_64/atomic/Makefile.inc | 14 - common/lib/libc/arch/x86_64/atomic/atomic.S | 435 - common/lib/libc/arch/x86_64/gen/byte_swap_2.S | 26 - common/lib/libc/arch/x86_64/gen/byte_swap_4.S | 25 - common/lib/libc/arch/x86_64/gen/byte_swap_8.S | 18 - common/lib/libc/arch/x86_64/string/bcmp.S | 24 - common/lib/libc/arch/x86_64/string/bcopy.S | 170 - common/lib/libc/arch/x86_64/string/ffs.S | 21 - common/lib/libc/arch/x86_64/string/memchr.S | 109 - common/lib/libc/arch/x86_64/string/memcmp.S | 40 - common/lib/libc/arch/x86_64/string/memcpy.S | 4 - common/lib/libc/arch/x86_64/string/memmove.S | 4 - common/lib/libc/arch/x86_64/string/memset.S | 96 - common/lib/libc/arch/x86_64/string/strcat.S | 165 - common/lib/libc/arch/x86_64/string/strchr.S | 159 - common/lib/libc/arch/x86_64/string/strcmp.S | 73 - common/lib/libc/arch/x86_64/string/strcpy.S | 112 - common/lib/libc/arch/x86_64/string/strlen.S | 182 - common/lib/libc/arch/x86_64/string/strrchr.S | 125 - common/lib/libc/atomic/atomic_add_16_cas.c | 65 - common/lib/libc/atomic/atomic_add_32_cas.c | 78 - common/lib/libc/atomic/atomic_add_32_nv_cas.c | 65 - common/lib/libc/atomic/atomic_add_64_cas.c | 74 - common/lib/libc/atomic/atomic_add_64_nv_cas.c | 65 - common/lib/libc/atomic/atomic_add_8_cas.c | 65 - common/lib/libc/atomic/atomic_and_16_cas.c | 51 - common/lib/libc/atomic/atomic_and_16_nv_cas.c | 53 - common/lib/libc/atomic/atomic_and_32_cas.c | 73 - common/lib/libc/atomic/atomic_and_32_nv_cas.c | 60 - common/lib/libc/atomic/atomic_and_64_cas.c | 70 - common/lib/libc/atomic/atomic_and_64_nv_cas.c | 61 - common/lib/libc/atomic/atomic_and_8_cas.c | 51 - common/lib/libc/atomic/atomic_and_8_nv_cas.c | 53 - .../atomic_c11_compare_exchange_cas_16.c | 55 - .../atomic_c11_compare_exchange_cas_32.c | 55 - .../atomic_c11_compare_exchange_cas_8.c | 55 - common/lib/libc/atomic/atomic_cas_16_cas.c | 47 - common/lib/libc/atomic/atomic_cas_32_cas.c | 45 - common/lib/libc/atomic/atomic_cas_64_cas.c | 49 - common/lib/libc/atomic/atomic_cas_8_cas.c | 47 - common/lib/libc/atomic/atomic_cas_by_cas32.c | 91 - common/lib/libc/atomic/atomic_dec_32_add.c | 55 - common/lib/libc/atomic/atomic_dec_32_cas.c | 62 - common/lib/libc/atomic/atomic_dec_32_nv_add.c | 55 - common/lib/libc/atomic/atomic_dec_32_nv_cas.c | 64 - common/lib/libc/atomic/atomic_dec_64_add.c | 56 - common/lib/libc/atomic/atomic_dec_64_cas.c | 62 - common/lib/libc/atomic/atomic_dec_64_nv_add.c | 56 - common/lib/libc/atomic/atomic_dec_64_nv_cas.c | 64 - common/lib/libc/atomic/atomic_inc_32_add.c | 55 - common/lib/libc/atomic/atomic_inc_32_cas.c | 62 - common/lib/libc/atomic/atomic_inc_32_nv_add.c | 55 - common/lib/libc/atomic/atomic_inc_32_nv_cas.c | 64 - common/lib/libc/atomic/atomic_inc_64_add.c | 56 - common/lib/libc/atomic/atomic_inc_64_cas.c | 62 - common/lib/libc/atomic/atomic_inc_64_nv_add.c | 56 - common/lib/libc/atomic/atomic_inc_64_nv_cas.c | 64 - common/lib/libc/atomic/atomic_init_cas.c | 44 - common/lib/libc/atomic/atomic_init_testset.c | 366 - common/lib/libc/atomic/atomic_load.c | 54 - common/lib/libc/atomic/atomic_nand_16_cas.c | 63 - common/lib/libc/atomic/atomic_nand_32_cas.c | 61 - common/lib/libc/atomic/atomic_nand_64_cas.c | 65 - common/lib/libc/atomic/atomic_nand_8_cas.c | 63 - common/lib/libc/atomic/atomic_op_namespace.h | 139 - common/lib/libc/atomic/atomic_or_16_cas.c | 65 - common/lib/libc/atomic/atomic_or_32_cas.c | 73 - common/lib/libc/atomic/atomic_or_32_nv_cas.c | 60 - common/lib/libc/atomic/atomic_or_64_cas.c | 70 - common/lib/libc/atomic/atomic_or_64_nv_cas.c | 61 - common/lib/libc/atomic/atomic_or_8_cas.c | 65 - common/lib/libc/atomic/atomic_store.c | 53 - common/lib/libc/atomic/atomic_sub_16_cas.c | 65 - common/lib/libc/atomic/atomic_sub_32_cas.c | 63 - common/lib/libc/atomic/atomic_sub_64_cas.c | 67 - common/lib/libc/atomic/atomic_sub_8_cas.c | 65 - common/lib/libc/atomic/atomic_swap_16_cas.c | 52 - common/lib/libc/atomic/atomic_swap_32_cas.c | 63 - common/lib/libc/atomic/atomic_swap_64_cas.c | 64 - common/lib/libc/atomic/atomic_swap_8_cas.c | 52 - common/lib/libc/atomic/atomic_xor_16_cas.c | 65 - common/lib/libc/atomic/atomic_xor_32_cas.c | 63 - common/lib/libc/atomic/atomic_xor_64_cas.c | 67 - common/lib/libc/atomic/atomic_xor_8_cas.c | 65 - common/lib/libc/atomic/membar_ops_nop.c | 57 - common/lib/libc/cdb/cdbr.c | 313 - common/lib/libc/gen/bswap16.c | 23 - common/lib/libc/gen/bswap32.c | 25 - common/lib/libc/gen/bswap64.c | 44 - common/lib/libc/gen/ptree.c | 1230 - common/lib/libc/gen/radixtree.c | 1466 - common/lib/libc/gen/rb.c | 1337 - common/lib/libc/gen/rpst.c | 716 - common/lib/libc/gmon/mcount.c | 274 - common/lib/libc/hash/murmurhash/murmurhash.c | 109 - common/lib/libc/hash/rmd160/rmd160.c | 394 - common/lib/libc/hash/sha1/sha1.c | 289 - common/lib/libc/hash/sha2/sha2.c | 970 - common/lib/libc/inet/inet_addr.c | 224 - common/lib/libc/md/md4c.c | 324 - common/lib/libc/md/md5c.c | 357 - common/lib/libc/net/htonl.c | 26 - common/lib/libc/net/htons.c | 26 - common/lib/libc/net/ntohl.c | 26 - common/lib/libc/net/ntohs.c | 26 - common/lib/libc/quad/adddi3.c | 62 - common/lib/libc/quad/anddi3.c | 60 - common/lib/libc/quad/ashldi3.c | 68 - common/lib/libc/quad/ashrdi3.c | 82 - common/lib/libc/quad/cmpdi2.c | 61 - common/lib/libc/quad/divdi3.c | 69 - common/lib/libc/quad/iordi3.c | 60 - common/lib/libc/quad/lshldi3.c | 70 - common/lib/libc/quad/lshrdi3.c | 69 - common/lib/libc/quad/moddi3.c | 69 - common/lib/libc/quad/muldi3.c | 250 - common/lib/libc/quad/negdi2.c | 59 - common/lib/libc/quad/notdi2.c | 60 - common/lib/libc/quad/qdivrem.c | 284 - common/lib/libc/quad/quad.h | 150 - common/lib/libc/quad/subdi3.c | 61 - common/lib/libc/quad/ucmpdi2.c | 60 - common/lib/libc/quad/udivdi3.c | 55 - common/lib/libc/quad/umoddi3.c | 57 - common/lib/libc/quad/xordi3.c | 60 - common/lib/libc/stdlib/_strtoi.h | 144 - common/lib/libc/stdlib/_strtol.h | 203 - common/lib/libc/stdlib/_strtoul.h | 163 - common/lib/libc/stdlib/heapsort.c | 229 - common/lib/libc/stdlib/mi_vector_hash.c | 182 - common/lib/libc/stdlib/random.c | 530 - common/lib/libc/stdlib/strtoi.c | 69 - common/lib/libc/stdlib/strtoimax.c | 68 - common/lib/libc/stdlib/strtoll.c | 67 - common/lib/libc/stdlib/strtou.c | 69 - common/lib/libc/stdlib/strtoul.c | 53 - common/lib/libc/stdlib/strtoull.c | 66 - common/lib/libc/stdlib/strtoumax.c | 67 - common/lib/libc/string/bcmp.c | 70 - common/lib/libc/string/bcopy.c | 209 - common/lib/libc/string/bzero.c | 4 - common/lib/libc/string/bzero2.c | 36 - common/lib/libc/string/consttime_memequal.c | 37 - common/lib/libc/string/explicit_memset.c | 30 - common/lib/libc/string/ffs.c | 61 - common/lib/libc/string/memchr.c | 66 - common/lib/libc/string/memcmp.c | 74 - common/lib/libc/string/memcpy.c | 8 - common/lib/libc/string/memmove.c | 10 - common/lib/libc/string/memset.c | 187 - common/lib/libc/string/memset2.c | 276 - common/lib/libc/string/popcount32.c | 82 - common/lib/libc/string/popcount64.c | 92 - common/lib/libc/string/strcasecmp.c | 68 - common/lib/libc/string/strcat.c | 65 - common/lib/libc/string/strchr.c | 65 - common/lib/libc/string/strcmp.c | 67 - common/lib/libc/string/strcpy.c | 60 - common/lib/libc/string/strcspn.c | 74 - common/lib/libc/string/strlcat.c | 101 - common/lib/libc/string/strlcpy.c | 81 - common/lib/libc/string/strlen.c | 58 - common/lib/libc/string/strncasecmp.c | 74 - common/lib/libc/string/strncat.c | 80 - common/lib/libc/string/strncmp.c | 65 - common/lib/libc/string/strncpy.c | 80 - common/lib/libc/string/strnlen.c | 57 - common/lib/libc/string/strpbrk.c | 79 - common/lib/libc/string/strrchr.c | 66 - common/lib/libc/string/strsep.c | 97 - common/lib/libc/string/strspn.c | 155 - common/lib/libc/string/strstr.c | 75 - common/lib/libc/sys/cpuset.c | 153 - common/lib/libprop/Makefile.inc | 11 - common/lib/libprop/prop_array.3 | 308 - common/lib/libprop/prop_array.c | 911 - common/lib/libprop/prop_array_util.3 | 228 - common/lib/libprop/prop_array_util.c | 251 - common/lib/libprop/prop_bool.3 | 82 - common/lib/libprop/prop_bool.c | 222 - common/lib/libprop/prop_copyin_ioctl.9 | 194 - common/lib/libprop/prop_data.3 | 148 - common/lib/libprop/prop_data.c | 627 - common/lib/libprop/prop_dictionary.3 | 353 - common/lib/libprop/prop_dictionary.c | 1426 - common/lib/libprop/prop_dictionary_util.3 | 200 - common/lib/libprop/prop_dictionary_util.c | 232 - common/lib/libprop/prop_ingest.3 | 181 - common/lib/libprop/prop_ingest.c | 159 - common/lib/libprop/prop_kern.c | 601 - common/lib/libprop/prop_number.3 | 210 - common/lib/libprop/prop_number.c | 597 - common/lib/libprop/prop_object.3 | 141 - common/lib/libprop/prop_object.c | 1240 - common/lib/libprop/prop_object_impl.h | 489 - common/lib/libprop/prop_rb.c | 1275 - common/lib/libprop/prop_rb_impl.h | 196 - common/lib/libprop/prop_send_ioctl.3 | 151 - common/lib/libprop/prop_send_syscall.3 | 128 - common/lib/libprop/prop_stack.c | 118 - common/lib/libprop/prop_stack.h | 64 - common/lib/libprop/prop_string.3 | 193 - common/lib/libprop/prop_string.c | 471 - common/lib/libprop/proplib.3 | 139 - common/lib/libutil/Makefile.inc | 8 - common/lib/libutil/getfstypename.c | 131 - common/lib/libutil/proc_compare.c | 146 - common/lib/libutil/snprintb.c | 282 - etc/Makefile | 811 - etc/Makefile.params | 129 - etc/boot.cfg.default | 8 - etc/crontab | 1 - etc/csh.cshrc | 2 - etc/csh.login | 3 - etc/csh.logout | 2 - etc/defaults/Makefile | 28 - etc/defaults/minix.rc.conf | 15 - etc/defaults/rc.conf | 382 - etc/devmand/Makefile | 4 - etc/devmand/scripts/Makefile | 6 - etc/devmand/scripts/block | 42 - etc/devmand/scripts/singlechar | 13 - etc/devmand/usb_hub.cfg | 8 - etc/devmand/usb_storage.cfg | 10 - etc/fonts/cp1251.fnt | Bin 4096 -> 0 bytes etc/fonts/cp437.fnt | Bin 9728 -> 0 bytes etc/fonts/cp850.fnt | Bin 9728 -> 0 bytes etc/fonts/cp865.fnt | Bin 9728 -> 0 bytes etc/fonts/cp866.fnt | Bin 9728 -> 0 bytes etc/fonts/iso1.fnt | Bin 9728 -> 0 bytes etc/fonts/koi8-r.fnt | Bin 9728 -> 0 bytes etc/fonts/koi8-u.fnt | Bin 4096 -> 0 bytes etc/fonts/polish.fnt | Bin 4096 -> 0 bytes etc/gettytab | 153 - etc/group | 35 - etc/hostname.file | 1 - etc/hosts | 18 - etc/inet.conf | 1 - etc/inetd.conf | 85 - etc/man.conf | 74 - etc/master.passwd | 24 - etc/mk.conf | 5 - etc/motd | 9 - etc/mtree/Makefile | 128 - etc/mtree/Minix.bitcode | 9 - etc/mtree/Minix.libcxx | 12 - etc/mtree/Minix.libstdcxx | 40 - etc/mtree/mkcompat.awk | 17 - etc/mtree/mkcompattree.awk | 32 - etc/mtree/special | 443 - etc/named.conf | 77 - etc/namedb/127 | 11 - etc/namedb/Makefile | 7 - etc/namedb/bind.keys | 47 - etc/namedb/localhost | 12 - etc/namedb/loopback.v6 | 11 - etc/namedb/root.cache | 91 - etc/newfstab.sh | 22 - etc/nsswitch.conf | 29 - etc/passwd.conf | 8 - etc/profile | 16 - etc/protocols | 331 - etc/rc | 467 - etc/rc.capes/BB-BONE-WTHR-01 | 21 - etc/rc.cd | 31 - etc/rc.conf | 21 - etc/rc.d/DAEMON | 10 - etc/rc.d/DISKS | 11 - etc/rc.d/LOGIN | 13 - etc/rc.d/Makefile | 79 - etc/rc.d/NETWORKING | 9 - etc/rc.d/SERVERS | 10 - etc/rc.d/bootconf.sh | 87 - etc/rc.d/dhclient | 22 - etc/rc.d/dhcpcd | 36 - etc/rc.d/dhcpd | 28 - etc/rc.d/dhcrelay | 18 - etc/rc.d/downinterfaces | 37 - etc/rc.d/fsck | 5 - etc/rc.d/ftpd | 19 - etc/rc.d/inetd | 20 - etc/rc.d/ipfilter | 104 - etc/rc.d/ipsec | 90 - etc/rc.d/local | 32 - etc/rc.d/minixrc | 17 - etc/rc.d/mountcritlocal | 5 - etc/rc.d/mountcritremote | 7 - etc/rc.d/named | 146 - etc/rc.d/network | 546 - etc/rc.d/npf | 62 - etc/rc.d/pwcheck | 27 - etc/rc.d/root | 4 - etc/rc.d/rtadvd | 60 - etc/rc.d/staticroute | 52 - etc/rc.d/sysctl | 25 - etc/rc.d/sysdb | 93 - etc/rc.d/syslogd | 64 - etc/rc.d/ttys | 8 - etc/rc.d/wscons | 186 - etc/rc.minix | 238 - etc/rc.shutdown | 65 - etc/rc.subr | 1358 - etc/root/Makefile | 19 - etc/root/dot.cshrc | 38 - etc/root/dot.klogin | 2 - etc/root/dot.login | 7 - etc/root/dot.profile | 24 - etc/root/dot.shrc | 11 - etc/rs.lwip | 63 - etc/rs.single | 6 - etc/services | 23433 --- etc/shells | 9 - etc/shrc | 19 - etc/skel/Makefile | 10 - etc/skel/dot.cshrc | 57 - etc/skel/dot.login | 21 - etc/skel/dot.logout | 10 - etc/skel/dot.profile | 41 - etc/skel/dot.shrc | 10 - etc/syslog.conf | 20 - etc/system.conf | 529 - etc/termcap | 130 - etc/termcap.big | 16471 -- etc/ttys | 44 - etc/usr/Makefile | 152 - etc/usr/daily | 76 - etc/usr/rc | 467 - etc/utmp | 0 etc/xorg.conf | 16 - external/Makefile | 6 - external/mit/Makefile | 12 - external/mit/ctwm/Makefile | 35 - external/mit/ctwm/bin/Makefile | 5 - external/mit/ctwm/bin/ctwm/Makefile | 60 - external/mit/expat/Makefile | 5 - external/mit/expat/Makefile.inc | 14 - external/mit/expat/bin/Makefile | 5 - external/mit/expat/bin/Makefile.inc | 10 - external/mit/expat/bin/xmlwf/Makefile | 12 - external/mit/expat/dist/CMake.README | 42 - external/mit/expat/dist/CMakeLists.txt | 111 - external/mit/expat/dist/COPYING | 22 - external/mit/expat/dist/Changes | 205 - external/mit/expat/dist/ConfigureChecks.cmake | 44 - external/mit/expat/dist/MANIFEST | 141 - external/mit/expat/dist/Makefile.in | 201 - external/mit/expat/dist/README | 139 - external/mit/expat/dist/aclocal.m4 | 8460 - external/mit/expat/dist/amiga/Makefile | 336 - external/mit/expat/dist/amiga/README.txt | 98 - external/mit/expat/dist/amiga/expat.xml | 264 - external/mit/expat/dist/amiga/expat_68k.c | 939 - external/mit/expat/dist/amiga/expat_68k.h | 94 - .../dist/amiga/expat_68k_handler_stubs.c | 185 - external/mit/expat/dist/amiga/expat_base.h | 40 - external/mit/expat/dist/amiga/expat_lib.c | 247 - external/mit/expat/dist/amiga/expat_vectors.c | 505 - .../expat/dist/amiga/include/inline4/expat.h | 94 - .../dist/amiga/include/interfaces/expat.h | 98 - .../dist/amiga/include/libraries/expat.h | 566 - .../expat/dist/amiga/include/proto/expat.h | 52 - external/mit/expat/dist/amiga/launch.c | 57 - external/mit/expat/dist/bcb5/README.txt | 87 - external/mit/expat/dist/bcb5/all_projects.bpg | 49 - external/mit/expat/dist/bcb5/elements.bpf | 4 - external/mit/expat/dist/bcb5/elements.bpr | 149 - external/mit/expat/dist/bcb5/elements.mak | 186 - external/mit/expat/dist/bcb5/expat.bpf | 6 - external/mit/expat/dist/bcb5/expat.bpr | 140 - external/mit/expat/dist/bcb5/expat.mak | 187 - external/mit/expat/dist/bcb5/expat_static.bpf | 5 - external/mit/expat/dist/bcb5/expat_static.bpr | 143 - external/mit/expat/dist/bcb5/expat_static.mak | 189 - external/mit/expat/dist/bcb5/expatw.bpf | 6 - external/mit/expat/dist/bcb5/expatw.bpr | 146 - external/mit/expat/dist/bcb5/expatw.mak | 187 - .../mit/expat/dist/bcb5/expatw_static.bpf | 5 - .../mit/expat/dist/bcb5/expatw_static.bpr | 152 - .../mit/expat/dist/bcb5/expatw_static.mak | 190 - external/mit/expat/dist/bcb5/libexpat_mtd.def | 141 - .../mit/expat/dist/bcb5/libexpatw_mtd.def | 140 - external/mit/expat/dist/bcb5/makefile.mak | 37 - external/mit/expat/dist/bcb5/outline.bpf | 4 - external/mit/expat/dist/bcb5/outline.bpr | 132 - external/mit/expat/dist/bcb5/outline.mak | 186 - external/mit/expat/dist/bcb5/setup.bat | 9 - external/mit/expat/dist/bcb5/xmlwf.bpf | 7 - external/mit/expat/dist/bcb5/xmlwf.bpr | 136 - external/mit/expat/dist/bcb5/xmlwf.mak | 187 - external/mit/expat/dist/configure | 18632 -- external/mit/expat/dist/configure.in | 155 - external/mit/expat/dist/conftools/PrintPath | 116 - .../dist/conftools/ac_c_bigendian_cross.m4 | 81 - .../mit/expat/dist/conftools/config.guess | 1517 - external/mit/expat/dist/conftools/config.sub | 1760 - external/mit/expat/dist/conftools/expat.m4 | 43 - .../mit/expat/dist/conftools/get-version.sh | 46 - external/mit/expat/dist/conftools/install-sh | 520 - external/mit/expat/dist/conftools/ltmain.sh | 9642 - .../mit/expat/dist/conftools/mkinstalldirs | 40 - external/mit/expat/dist/doc/expat.png | Bin 1027 -> 0 bytes external/mit/expat/dist/doc/reference.html | 2390 - external/mit/expat/dist/doc/style.css | 101 - external/mit/expat/dist/doc/valid-xhtml10.png | Bin 2368 -> 0 bytes external/mit/expat/dist/doc/xmlwf.1 | 251 - external/mit/expat/dist/doc/xmlwf.sgml | 468 - external/mit/expat/dist/examples/elements.c | 65 - external/mit/expat/dist/examples/elements.dsp | 103 - external/mit/expat/dist/examples/outline.c | 106 - external/mit/expat/dist/examples/outline.dsp | 103 - external/mit/expat/dist/expat.dsw | 110 - external/mit/expat/dist/expat.pc.in | 11 - external/mit/expat/dist/expat_config.h.cmake | 91 - external/mit/expat/dist/expat_config.h.in | 102 - external/mit/expat/dist/lib/Makefile.MPW | 206 - external/mit/expat/dist/lib/amigaconfig.h | 32 - external/mit/expat/dist/lib/ascii.h | 92 - external/mit/expat/dist/lib/asciitab.h | 36 - external/mit/expat/dist/lib/expat.dsp | 185 - external/mit/expat/dist/lib/expat.h | 1047 - external/mit/expat/dist/lib/expat_external.h | 115 - external/mit/expat/dist/lib/expat_static.dsp | 162 - external/mit/expat/dist/lib/expatw.dsp | 185 - external/mit/expat/dist/lib/expatw_static.dsp | 162 - external/mit/expat/dist/lib/iasciitab.h | 37 - external/mit/expat/dist/lib/internal.h | 73 - external/mit/expat/dist/lib/latin1tab.h | 36 - external/mit/expat/dist/lib/libexpat.def | 73 - external/mit/expat/dist/lib/libexpatw.def | 73 - external/mit/expat/dist/lib/macconfig.h | 53 - external/mit/expat/dist/lib/nametab.h | 150 - external/mit/expat/dist/lib/utf8tab.h | 37 - external/mit/expat/dist/lib/winconfig.h | 30 - external/mit/expat/dist/lib/xmlparse.c | 6403 - external/mit/expat/dist/lib/xmlrole.c | 1336 - external/mit/expat/dist/lib/xmlrole.h | 114 - external/mit/expat/dist/lib/xmltok.c | 1651 - external/mit/expat/dist/lib/xmltok.h | 316 - external/mit/expat/dist/lib/xmltok_impl.c | 1783 - external/mit/expat/dist/lib/xmltok_impl.h | 46 - external/mit/expat/dist/lib/xmltok_ns.c | 115 - external/mit/expat/dist/m4/libtool.m4 | 7851 - external/mit/expat/dist/m4/ltoptions.m4 | 369 - external/mit/expat/dist/m4/ltsugar.m4 | 123 - external/mit/expat/dist/m4/ltversion.m4 | 23 - external/mit/expat/dist/m4/lt~obsolete.m4 | 98 - external/mit/expat/dist/tests/README.txt | 13 - .../mit/expat/dist/tests/benchmark/README.txt | 16 - .../expat/dist/tests/benchmark/benchmark.c | 114 - .../expat/dist/tests/benchmark/benchmark.dsp | 88 - .../expat/dist/tests/benchmark/benchmark.dsw | 44 - external/mit/expat/dist/tests/chardata.c | 131 - external/mit/expat/dist/tests/chardata.h | 40 - external/mit/expat/dist/tests/minicheck.c | 182 - external/mit/expat/dist/tests/minicheck.h | 90 - external/mit/expat/dist/tests/runtests.c | 1515 - external/mit/expat/dist/tests/runtestspp.cpp | 6 - external/mit/expat/dist/tests/xmltest.sh | 142 - external/mit/expat/dist/vms/README.vms | 23 - external/mit/expat/dist/vms/descrip.mms | 70 - external/mit/expat/dist/vms/expat_config.h | 52 - external/mit/expat/dist/win32/MANIFEST.txt | 27 - external/mit/expat/dist/win32/README.txt | 80 - external/mit/expat/dist/win32/expat.iss | 69 - external/mit/expat/dist/xmlwf/codepage.c | 68 - external/mit/expat/dist/xmlwf/codepage.h | 6 - external/mit/expat/dist/xmlwf/ct.c | 147 - external/mit/expat/dist/xmlwf/filemap.h | 17 - external/mit/expat/dist/xmlwf/readfilemap.c | 100 - external/mit/expat/dist/xmlwf/unixfilemap.c | 65 - external/mit/expat/dist/xmlwf/win32filemap.c | 96 - external/mit/expat/dist/xmlwf/xmlfile.c | 244 - external/mit/expat/dist/xmlwf/xmlfile.h | 20 - external/mit/expat/dist/xmlwf/xmlmime.c | 163 - external/mit/expat/dist/xmlwf/xmlmime.h | 19 - external/mit/expat/dist/xmlwf/xmltchar.h | 36 - external/mit/expat/dist/xmlwf/xmlurl.h | 13 - external/mit/expat/dist/xmlwf/xmlwf.c | 861 - external/mit/expat/dist/xmlwf/xmlwf.dsp | 139 - external/mit/expat/dist/xmlwf/xmlwin32url.cxx | 395 - external/mit/expat/lib/Makefile | 5 - external/mit/expat/lib/Makefile.inc | 3 - external/mit/expat/lib/libexpat/Makefile | 24 - .../mit/expat/lib/libexpat/expat_config.h | 103 - external/mit/expat/lib/libexpat/shlib_version | 5 - external/mit/lua/Makefile | 5 - external/mit/lua/dist/Makefile | 114 - external/mit/lua/dist/README | 6 - external/mit/lua/dist/doc/contents.html | 618 - external/mit/lua/dist/doc/index.css | 21 - external/mit/lua/dist/doc/logo.gif | Bin 4232 -> 0 bytes external/mit/lua/dist/doc/lua.1 | 113 - external/mit/lua/dist/doc/lua.css | 133 - external/mit/lua/dist/doc/luac.1 | 120 - external/mit/lua/dist/doc/manual.css | 21 - external/mit/lua/dist/doc/manual.html | 10807 -- .../mit/lua/dist/doc/osi-certified-72x60.png | Bin 3774 -> 0 bytes external/mit/lua/dist/doc/readme.html | 365 - external/mit/lua/dist/src/Makefile | 197 - external/mit/lua/dist/src/lapi.c | 1283 - external/mit/lua/dist/src/lapi.h | 26 - external/mit/lua/dist/src/lauxlib.c | 988 - external/mit/lua/dist/src/lauxlib.h | 275 - external/mit/lua/dist/src/lbaselib.c | 532 - external/mit/lua/dist/src/lbitlib.c | 230 - external/mit/lua/dist/src/lcode.c | 993 - external/mit/lua/dist/src/lcode.h | 93 - external/mit/lua/dist/src/lcorolib.c | 172 - external/mit/lua/dist/src/lctype.c | 59 - external/mit/lua/dist/src/lctype.h | 99 - external/mit/lua/dist/src/ldblib.c | 464 - external/mit/lua/dist/src/ldebug.c | 679 - external/mit/lua/dist/src/ldebug.h | 41 - external/mit/lua/dist/src/ldo.c | 721 - external/mit/lua/dist/src/ldo.h | 48 - external/mit/lua/dist/src/ldump.c | 221 - external/mit/lua/dist/src/lfunc.c | 155 - external/mit/lua/dist/src/lfunc.h | 63 - external/mit/lua/dist/src/lgc.c | 1179 - external/mit/lua/dist/src/lgc.h | 138 - external/mit/lua/dist/src/linit.c | 78 - external/mit/lua/dist/src/liolib.c | 754 - external/mit/lua/dist/src/llex.c | 634 - external/mit/lua/dist/src/llex.h | 92 - external/mit/lua/dist/src/llimits.h | 323 - external/mit/lua/dist/src/lmathlib.c | 409 - external/mit/lua/dist/src/lmem.c | 104 - external/mit/lua/dist/src/lmem.h | 73 - external/mit/lua/dist/src/loadlib.c | 789 - external/mit/lua/dist/src/lobject.c | 510 - external/mit/lua/dist/src/lobject.h | 567 - external/mit/lua/dist/src/lopcodes.c | 132 - external/mit/lua/dist/src/lopcodes.h | 299 - external/mit/lua/dist/src/loslib.c | 372 - external/mit/lua/dist/src/lparser.c | 1657 - external/mit/lua/dist/src/lparser.h | 126 - external/mit/lua/dist/src/lprefix.h | 49 - external/mit/lua/dist/src/lstate.c | 344 - external/mit/lua/dist/src/lstate.h | 227 - external/mit/lua/dist/src/lstring.c | 230 - external/mit/lua/dist/src/lstring.h | 49 - external/mit/lua/dist/src/lstrlib.c | 1541 - external/mit/lua/dist/src/ltable.c | 669 - external/mit/lua/dist/src/ltable.h | 53 - external/mit/lua/dist/src/ltablib.c | 363 - external/mit/lua/dist/src/ltm.c | 153 - external/mit/lua/dist/src/ltm.h | 79 - external/mit/lua/dist/src/lua.c | 615 - external/mit/lua/dist/src/lua.h | 522 - external/mit/lua/dist/src/lua.hpp | 9 - external/mit/lua/dist/src/luac.c | 451 - external/mit/lua/dist/src/luaconf.h | 818 - external/mit/lua/dist/src/lualib.h | 60 - external/mit/lua/dist/src/lundump.c | 283 - external/mit/lua/dist/src/lundump.h | 35 - external/mit/lua/dist/src/lutf8lib.c | 260 - external/mit/lua/dist/src/lvm.c | 1371 - external/mit/lua/dist/src/lvm.h | 74 - external/mit/lua/dist/src/lzio.c | 82 - external/mit/lua/dist/src/lzio.h | 67 - external/mit/lua/lib/Makefile | 5 - external/mit/lua/lib/liblua/Makefile | 24 - external/mit/lua/lib/liblua/shlib_version | 3 - external/mit/lua/usr.bin/Makefile | 5 - external/mit/lua/usr.bin/lua/Makefile | 23 - external/mit/lua/usr.bin/luac/Makefile | 18 - external/mit/xorg/Makefile.inc | 1 - external/mit/xorg/server/Makefile | 17 - external/mit/xorg/server/Makefile.inc | 3 - external/mit/xorg/server/drivers/Makefile | 284 - .../xorg/server/drivers/Makefile.xf86-driver | 51 - .../drivers/xf86-input-elographics/Makefile | 14 - .../drivers/xf86-input-keyboard/Makefile | 34 - .../server/drivers/xf86-input-mouse/Makefile | 26 - .../drivers/xf86-input-synaptics/Makefile | 14 - .../drivers/xf86-input-vmmouse/Makefile | 15 - .../server/drivers/xf86-input-ws/Makefile | 17 - .../server/drivers/xf86-video-ag10e/Makefile | 9 - .../server/drivers/xf86-video-apm/Makefile | 9 - .../server/drivers/xf86-video-ark/Makefile | 14 - .../server/drivers/xf86-video-ast/Makefile | 13 - .../server/drivers/xf86-video-ati/Makefile | 11 - .../server/drivers/xf86-video-chips/Makefile | 22 - .../server/drivers/xf86-video-cirrus/Makefile | 11 - .../drivers/xf86-video-cirrus_alpine/Makefile | 13 - .../drivers/xf86-video-cirrus_laguna/Makefile | 12 - .../server/drivers/xf86-video-crime/Makefile | 12 - .../server/drivers/xf86-video-geode/Makefile | 50 - .../server/drivers/xf86-video-glint/Makefile | 28 - .../server/drivers/xf86-video-i128/Makefile | 10 - .../server/drivers/xf86-video-i740/Makefile | 12 - .../server/drivers/xf86-video-igs/Makefile | 11 - .../server/drivers/xf86-video-imstt/Makefile | 9 - .../drivers/xf86-video-intel-old/Makefile | 46 - .../drivers/xf86-video-intel-old/Makefile.inc | 5 - .../xf86-video-intel-old/ch7017/Makefile | 16 - .../xf86-video-intel-old/ch7xxx/Makefile | 16 - .../xf86-video-intel-old/ivch/Makefile | 16 - .../xf86-video-intel-old/sil164/Makefile | 16 - .../xf86-video-intel-old/tfp410/Makefile | 16 - .../server/drivers/xf86-video-intel/Makefile | 208 - .../drivers/xf86-video-intel/ch7017/Makefile | 17 - .../drivers/xf86-video-intel/ch7xxx/Makefile | 17 - .../drivers/xf86-video-intel/ivch/Makefile | 17 - .../drivers/xf86-video-intel/sil164/Makefile | 17 - .../drivers/xf86-video-intel/tfp410/Makefile | 17 - .../server/drivers/xf86-video-mach64/Makefile | 32 - .../server/drivers/xf86-video-mga/Makefile | 37 - .../drivers/xf86-video-neomagic/Makefile | 15 - .../drivers/xf86-video-newport/Makefile | 13 - .../server/drivers/xf86-video-nsc/Makefile | 17 - .../server/drivers/xf86-video-nv/Makefile | 30 - .../server/drivers/xf86-video-nvxbox/Makefile | 14 - .../drivers/xf86-video-openchrome/Makefile | 49 - .../server/drivers/xf86-video-pnozz/Makefile | 12 - .../server/drivers/xf86-video-r128/Makefile | 27 - .../drivers/xf86-video-radeon-kms/Makefile | 56 - .../server/drivers/xf86-video-radeon/Makefile | 62 - .../drivers/xf86-video-rendition/Makefile | 12 - .../server/drivers/xf86-video-s3/Makefile | 27 - .../drivers/xf86-video-s3virge/Makefile | 14 - .../server/drivers/xf86-video-savage/Makefile | 34 - .../drivers/xf86-video-siliconmotion/Makefile | 18 - .../server/drivers/xf86-video-sis/Makefile | 26 - .../drivers/xf86-video-suncg14/Makefile | 12 - .../server/drivers/xf86-video-suncg6/Makefile | 13 - .../server/drivers/xf86-video-sunffb/Makefile | 25 - .../server/drivers/xf86-video-sunleo/Makefile | 13 - .../server/drivers/xf86-video-suntcx/Makefile | 13 - .../server/drivers/xf86-video-tdfx/Makefile | 26 - .../server/drivers/xf86-video-tga/Makefile | 14 - .../drivers/xf86-video-trident/Makefile | 20 - .../server/drivers/xf86-video-tseng/Makefile | 14 - .../server/drivers/xf86-video-vesa/Makefile | 9 - .../server/drivers/xf86-video-vmware/Makefile | 23 - .../server/drivers/xf86-video-wsfb/Makefile | 11 - .../server/drivers/xf86-video-xgi/Makefile | 34 - external/mit/xorg/server/xorg-server/Makefile | 31 - .../xorg/server/xorg-server/Makefile.Xserver | 85 - .../xorg/server/xorg-server/Makefile.common | 93 - .../mit/xorg/server/xorg-server/Makefile.inc | 3 - .../server/xorg-server/Makefile.serverlib | 25 - .../server/xorg-server/Makefile.servermod | 23 - .../xorg/server/xorg-server/XTrap/Makefile | 10 - .../server/xorg-server/XTrap/Makefile.xtrap | 17 - .../mit/xorg/server/xorg-server/Xext/Makefile | 16 - .../server/xorg-server/Xext/Makefile.Xext | 33 - .../xorg-server/Xext/Makefile.Xextbuiltin | 9 - .../xorg-server/Xext/Makefile.Xextmodule | 6 - .../xorg-server/Xext/Xextbuiltin/Makefile | 11 - .../xorg-server/Xext/Xextmodule/Makefile | 13 - .../mit/xorg/server/xorg-server/Xi/Makefile | 42 - .../mit/xorg/server/xorg-server/afb/Makefile | 11 - .../xorg/server/xorg-server/afb/Makefile.afb | 38 - .../mit/xorg/server/xorg-server/cfb/Makefile | 12 - .../xorg/server/xorg-server/cfb/Makefile.cfb | 119 - .../xorg/server/xorg-server/cfb32/Makefile | 11 - .../server/xorg-server/composite/Makefile | 31 - .../xorg/server/xorg-server/config/Makefile | 20 - .../server/xorg-server/damageext/Makefile | 24 - .../mit/xorg/server/xorg-server/dbe/Makefile | 12 - .../xorg/server/xorg-server/dbe/Makefile.dbe | 14 - .../mit/xorg/server/xorg-server/dix/Makefile | 50 - .../server/xorg-server/dix/Makefile.common | 7 - .../server/xorg-server/dix/xpstubs/Makefile | 15 - .../mit/xorg/server/xorg-server/doc/Makefile | 13 - .../mit/xorg/server/xorg-server/exa/Makefile | 10 - .../xorg/server/xorg-server/exa/Makefile.exa | 33 - .../mit/xorg/server/xorg-server/fb/Makefile | 10 - .../xorg/server/xorg-server/fb/Makefile.fb | 27 - .../mit/xorg/server/xorg-server/glx/Makefile | 10 - .../xorg/server/xorg-server/glx/Makefile.glx | 72 - .../mit/xorg/server/xorg-server/hw/Makefile | 64 - .../xorg/server/xorg-server/hw/Makefile.inc | 3 - .../xorg/server/xorg-server/hw/vfb/Makefile | 142 - .../server/xorg-server/hw/xfree86/Makefile | 16 - .../xorg-server/hw/xfree86/Makefile.inc | 3 - .../xorg-server/hw/xfree86/Xorg/Makefile | 139 - .../xorg-server/hw/xfree86/common/Makefile | 152 - .../xorg-server/hw/xfree86/ddc/Makefile | 23 - .../hw/xfree86/dixmods/GLcore/Makefile | 13 - .../xorg-server/hw/xfree86/dixmods/Makefile | 39 - .../hw/xfree86/dixmods/Makefile.dixmod | 24 - .../hw/xfree86/dixmods/afb/Makefile | 7 - .../hw/xfree86/dixmods/cfb/Makefile | 14 - .../hw/xfree86/dixmods/cfb32/Makefile | 14 - .../hw/xfree86/dixmods/dbe/Makefile | 18 - .../hw/xfree86/dixmods/extmod/Makefile | 45 - .../hw/xfree86/dixmods/fb/Makefile | 14 - .../hw/xfree86/dixmods/freetype/Makefile | 12 - .../hw/xfree86/dixmods/glx/Makefile | 15 - .../hw/xfree86/dixmods/mfb/Makefile | 15 - .../hw/xfree86/dixmods/record/Makefile | 15 - .../hw/xfree86/dixmods/shadow/Makefile | 13 - .../hw/xfree86/dixmods/type1/Makefile | 12 - .../hw/xfree86/dixmods/wfb/Makefile | 13 - .../hw/xfree86/dixmods/xorgxkb/Makefile | 9 - .../hw/xfree86/dixmods/xtrap/Makefile | 15 - .../xorg-server/hw/xfree86/doc/Makefile | 16 - .../xorg-server/hw/xfree86/dri/Makefile | 46 - .../xorg-server/hw/xfree86/dri2/Makefile | 46 - .../xorg-server/hw/xfree86/dummy/Makefile | 35 - .../xorg-server/hw/xfree86/exa/Makefile | 18 - .../xorg-server/hw/xfree86/i2c/Makefile | 28 - .../xorg-server/hw/xfree86/init/Makefile | 75 - .../xorg-server/hw/xfree86/int10/Makefile | 44 - .../xorg-server/hw/xfree86/loader/Makefile | 57 - .../xorg-server/hw/xfree86/pcidata/Makefile | 38 - .../xorg-server/hw/xfree86/rac/Makefile | 19 - .../xorg-server/hw/xfree86/ramdac/Makefile | 29 - .../xorg-server/hw/xfree86/scanpci/Makefile | 34 - .../xorg-server/hw/xfree86/shadowfb/Makefile | 26 - .../xorg-server/hw/xfree86/utils/Makefile | 18 - .../hw/xfree86/utils/Makefile.utils | 14 - .../xorg-server/hw/xfree86/utils/cvt/Makefile | 26 - .../xorg-server/hw/xfree86/utils/gtf/Makefile | 18 - .../hw/xfree86/utils/ioport/Makefile | 45 - .../hw/xfree86/utils/pcitweak/Makefile | 36 - .../hw/xfree86/utils/scanpci/Makefile | 39 - .../hw/xfree86/utils/xorgconfig/Makefile | 46 - .../xorg-server/hw/xfree86/vbe/Makefile | 30 - .../xorg-server/hw/xfree86/vgahw/Makefile | 30 - .../xorg-server/hw/xfree86/x86emu/Makefile | 26 - .../xorg-server/hw/xfree86/xaa/Makefile | 78 - .../xorg-server/hw/xfree86/xf1bpp/Makefile | 80 - .../xorg-server/hw/xfree86/xf4bpp/Makefile | 71 - .../hw/xfree86/xf86config/Makefile | 31 - .../xorg-server/hw/xfree86/xf86modes/Makefile | 50 - .../xorg-server/hw/xfree86/xf8_16bpp/Makefile | 25 - .../xorg-server/hw/xfree86/xf8_32bpp/Makefile | 45 - .../xorg-server/hw/xfree86/xorgos/Makefile | 186 - .../xorg/server/xorg-server/hw/xnest/Makefile | 120 - .../xorg/server/xorg-server/include/Makefile | 61 - .../mit/xorg/server/xorg-server/mfb/Makefile | 10 - .../xorg/server/xorg-server/mfb/Makefile.mfb | 37 - .../mit/xorg/server/xorg-server/mi/Makefile | 48 - .../xorg/server/xorg-server/miext/Makefile | 5 - .../xorg/server/xorg-server/miext/cw/Makefile | 10 - .../server/xorg-server/miext/cw/Makefile.cw | 15 - .../server/xorg-server/miext/damage/Makefile | 11 - .../xorg-server/miext/damage/Makefile.damage | 15 - .../xorg-server/miext/rootless/Makefile | 10 - .../miext/rootless/Makefile.rootless | 16 - .../server/xorg-server/miext/shadow/Makefile | 10 - .../xorg-server/miext/shadow/Makefile.shadow | 21 - .../server/xorg-server/miext/sync/Makefile | 10 - .../xorg-server/miext/sync/Makefile.sync | 15 - .../mit/xorg/server/xorg-server/os/Makefile | 68 - .../xorg/server/xorg-server/randr/Makefile | 28 - .../xorg/server/xorg-server/record/Makefile | 10 - .../server/xorg-server/record/Makefile.record | 18 - .../xorg/server/xorg-server/render/Makefile | 24 - .../xorg/server/xorg-server/xfixes/Makefile | 27 - .../mit/xorg/server/xorg-server/xkb/Makefile | 54 - .../xorg/server/xorg-server/xkbstubs/Makefile | 30 - external/mit/xorg/tools/fc-cache/Makefile | 121 - .../mit/xorg/tools/fc-cache/Makefile.fc-cache | 7 - external/mit/xorg/tools/makestrs/Makefile | 14 - external/mit/xorg/tools/mkfontscale/Makefile | 93 - external/mit/xorg/xorg-pkg-ver.mk | 47 - external/public-domain/Makefile | 7 - external/public-domain/sqlite/Makefile | 5 - external/public-domain/sqlite/Makefile.inc | 30 - external/public-domain/sqlite/bin/Makefile | 12 - external/public-domain/sqlite/dist/shell.c | 3565 - external/public-domain/sqlite/dist/sqlite3.1 | 190 - external/public-domain/sqlite/dist/sqlite3.c | 145788 --------------- external/public-domain/sqlite/dist/sqlite3.h | 7385 - .../public-domain/sqlite/dist/sqlite3ext.h | 487 - external/public-domain/sqlite/lib/Makefile | 36 - .../public-domain/sqlite/lib/shlib_version | 4 - .../public-domain/sqlite/lib/sqlite3.pc.in | 4 - external/public-domain/tz/Makefile | 5 - external/public-domain/tz/Makefile.inc | 5 - external/public-domain/tz/dist/CONTRIBUTING | 69 - external/public-domain/tz/dist/Makefile | 665 - external/public-domain/tz/dist/NEWS | 3253 - external/public-domain/tz/dist/README | 61 - external/public-domain/tz/dist/Theory | 790 - external/public-domain/tz/dist/africa | 1182 - external/public-domain/tz/dist/antarctica | 337 - external/public-domain/tz/dist/asia | 2878 - external/public-domain/tz/dist/australasia | 1741 - external/public-domain/tz/dist/backward | 123 - external/public-domain/tz/dist/backzone | 672 - external/public-domain/tz/dist/checklinks.awk | 19 - external/public-domain/tz/dist/checktab.awk | 176 - external/public-domain/tz/dist/etcetera | 80 - external/public-domain/tz/dist/europe | 3410 - external/public-domain/tz/dist/factory | 9 - external/public-domain/tz/dist/iso3166.tab | 274 - .../public-domain/tz/dist/leap-seconds.list | 249 - external/public-domain/tz/dist/leapseconds | 60 - .../public-domain/tz/dist/leapseconds.awk | 75 - external/public-domain/tz/dist/northamerica | 3269 - external/public-domain/tz/dist/pacificnew | 27 - external/public-domain/tz/dist/southamerica | 1750 - external/public-domain/tz/dist/systemv | 37 - external/public-domain/tz/dist/yearistype.sh | 38 - external/public-domain/tz/dist/zone.tab | 440 - external/public-domain/tz/dist/zone1970.tab | 372 - .../public-domain/tz/dist/zoneinfo2tdf.pl | 52 - external/public-domain/tz/share/Makefile | 5 - .../public-domain/tz/share/zoneinfo/Makefile | 148 - external/public-domain/xz/Makefile | 5 - external/public-domain/xz/Makefile.inc | 15 - external/public-domain/xz/bin/Makefile | 5 - external/public-domain/xz/bin/Makefile.inc | 1 - .../public-domain/xz/bin/lzmainfo/Makefile | 30 - external/public-domain/xz/bin/xz/Makefile | 53 - external/public-domain/xz/dist/AUTHORS | 27 - external/public-domain/xz/dist/COPYING | 65 - external/public-domain/xz/dist/ChangeLog | 14643 -- external/public-domain/xz/dist/INSTALL | 545 - external/public-domain/xz/dist/NEWS | 486 - external/public-domain/xz/dist/PACKAGERS | 231 - external/public-domain/xz/dist/README | 308 - external/public-domain/xz/dist/THANKS | 112 - external/public-domain/xz/dist/TODO | 111 - external/public-domain/xz/dist/config.h.in | 488 - external/public-domain/xz/dist/configure.ac | 803 - .../xz/dist/doc/examples/00_README.txt | 31 - .../xz/dist/doc/examples/01_compress_easy.c | 297 - .../xz/dist/doc/examples/02_decompress.c | 287 - .../xz/dist/doc/examples/03_compress_custom.c | 193 - .../dist/doc/examples/04_compress_easy_mt.c | 206 - .../xz/dist/doc/examples_old/xz_pipe_comp.c | 127 - .../xz/dist/doc/examples_old/xz_pipe_decomp.c | 123 - external/public-domain/xz/dist/doc/faq.txt | 224 - .../public-domain/xz/dist/doc/history.txt | 150 - .../xz/dist/doc/lzma-file-format.txt | 166 - .../xz/dist/doc/xz-file-format.txt | 1150 - .../public-domain/xz/dist/m4/tuklib_common.m4 | 22 - .../xz/dist/m4/tuklib_cpucores.m4 | 141 - .../xz/dist/m4/tuklib_integer.m4 | 74 - .../public-domain/xz/dist/m4/tuklib_mbstr.m4 | 30 - .../xz/dist/m4/tuklib_physmem.m4 | 212 - .../xz/dist/m4/tuklib_progname.m4 | 25 - .../public-domain/xz/dist/macosx/build.sh | 113 - external/public-domain/xz/dist/po/cs.gmo | Bin 21945 -> 0 bytes external/public-domain/xz/dist/po/cs.po | 989 - external/public-domain/xz/dist/po/de.gmo | Bin 26431 -> 0 bytes external/public-domain/xz/dist/po/de.po | 980 - external/public-domain/xz/dist/po/fr.gmo | Bin 24677 -> 0 bytes external/public-domain/xz/dist/po/fr.po | 974 - external/public-domain/xz/dist/po/it.gmo | Bin 26091 -> 0 bytes external/public-domain/xz/dist/po/it.po | 975 - external/public-domain/xz/dist/po/pl.gmo | Bin 25679 -> 0 bytes external/public-domain/xz/dist/po/pl.po | 964 - external/public-domain/xz/dist/po/vi.gmo | Bin 27593 -> 0 bytes external/public-domain/xz/dist/po/vi.po | 970 - .../xz/dist/src/common/common_w32res.rc | 50 - .../xz/dist/src/common/mythread.h | 521 - .../xz/dist/src/common/sysdefs.h | 202 - .../xz/dist/src/common/tuklib_common.h | 71 - .../xz/dist/src/common/tuklib_config.h | 7 - .../xz/dist/src/common/tuklib_cpucores.c | 91 - .../xz/dist/src/common/tuklib_cpucores.h | 23 - .../xz/dist/src/common/tuklib_exit.c | 57 - .../xz/dist/src/common/tuklib_exit.h | 25 - .../xz/dist/src/common/tuklib_gettext.h | 44 - .../xz/dist/src/common/tuklib_integer.h | 523 - .../xz/dist/src/common/tuklib_mbstr.h | 66 - .../xz/dist/src/common/tuklib_mbstr_fw.c | 31 - .../xz/dist/src/common/tuklib_mbstr_width.c | 64 - .../xz/dist/src/common/tuklib_open_stdxxx.c | 57 - .../xz/dist/src/common/tuklib_open_stdxxx.h | 23 - .../xz/dist/src/common/tuklib_physmem.c | 203 - .../xz/dist/src/common/tuklib_physmem.h | 28 - .../xz/dist/src/common/tuklib_progname.c | 50 - .../xz/dist/src/common/tuklib_progname.h | 32 - .../xz/dist/src/liblzma/api/lzma.h | 313 - .../xz/dist/src/liblzma/api/lzma/base.h | 654 - .../xz/dist/src/liblzma/api/lzma/bcj.h | 90 - .../xz/dist/src/liblzma/api/lzma/block.h | 581 - .../xz/dist/src/liblzma/api/lzma/check.h | 150 - .../xz/dist/src/liblzma/api/lzma/container.h | 619 - .../xz/dist/src/liblzma/api/lzma/delta.h | 77 - .../xz/dist/src/liblzma/api/lzma/filter.h | 425 - .../xz/dist/src/liblzma/api/lzma/hardware.h | 64 - .../xz/dist/src/liblzma/api/lzma/index.h | 682 - .../xz/dist/src/liblzma/api/lzma/index_hash.h | 107 - .../xz/dist/src/liblzma/api/lzma/lzma12.h | 420 - .../dist/src/liblzma/api/lzma/stream_flags.h | 223 - .../xz/dist/src/liblzma/api/lzma/version.h | 121 - .../xz/dist/src/liblzma/api/lzma/vli.h | 166 - .../xz/dist/src/liblzma/check/check.c | 174 - .../xz/dist/src/liblzma/check/check.h | 179 - .../xz/dist/src/liblzma/check/crc32_fast.c | 82 - .../xz/dist/src/liblzma/check/crc32_small.c | 61 - .../xz/dist/src/liblzma/check/crc32_table.c | 19 - .../dist/src/liblzma/check/crc32_table_be.h | 525 - .../dist/src/liblzma/check/crc32_table_le.h | 525 - .../dist/src/liblzma/check/crc32_tablegen.c | 117 - .../xz/dist/src/liblzma/check/crc32_x86.S | 304 - .../xz/dist/src/liblzma/check/crc64_fast.c | 72 - .../xz/dist/src/liblzma/check/crc64_small.c | 53 - .../xz/dist/src/liblzma/check/crc64_table.c | 19 - .../dist/src/liblzma/check/crc64_table_be.h | 521 - .../dist/src/liblzma/check/crc64_table_le.h | 521 - .../dist/src/liblzma/check/crc64_tablegen.c | 88 - .../xz/dist/src/liblzma/check/crc64_x86.S | 287 - .../xz/dist/src/liblzma/check/crc_macros.h | 30 - .../xz/dist/src/liblzma/check/sha256.c | 196 - .../dist/src/liblzma/common/alone_decoder.c | 238 - .../dist/src/liblzma/common/alone_decoder.h | 23 - .../dist/src/liblzma/common/alone_encoder.c | 157 - .../xz/dist/src/liblzma/common/auto_decoder.c | 186 - .../src/liblzma/common/block_buffer_decoder.c | 80 - .../src/liblzma/common/block_buffer_encoder.c | 337 - .../src/liblzma/common/block_buffer_encoder.h | 24 - .../dist/src/liblzma/common/block_decoder.c | 252 - .../dist/src/liblzma/common/block_decoder.h | 22 - .../dist/src/liblzma/common/block_encoder.c | 217 - .../dist/src/liblzma/common/block_encoder.h | 47 - .../src/liblzma/common/block_header_decoder.c | 124 - .../src/liblzma/common/block_header_encoder.c | 132 - .../xz/dist/src/liblzma/common/block_util.c | 90 - .../xz/dist/src/liblzma/common/common.c | 443 - .../xz/dist/src/liblzma/common/common.h | 318 - .../src/liblzma/common/easy_buffer_encoder.c | 27 - .../liblzma/common/easy_decoder_memusage.c | 24 - .../xz/dist/src/liblzma/common/easy_encoder.c | 24 - .../liblzma/common/easy_encoder_memusage.c | 24 - .../xz/dist/src/liblzma/common/easy_preset.c | 27 - .../xz/dist/src/liblzma/common/easy_preset.h | 32 - .../liblzma/common/filter_buffer_decoder.c | 88 - .../liblzma/common/filter_buffer_encoder.c | 55 - .../dist/src/liblzma/common/filter_common.c | 337 - .../dist/src/liblzma/common/filter_common.h | 48 - .../dist/src/liblzma/common/filter_decoder.c | 184 - .../dist/src/liblzma/common/filter_decoder.h | 23 - .../dist/src/liblzma/common/filter_encoder.c | 286 - .../dist/src/liblzma/common/filter_encoder.h | 27 - .../src/liblzma/common/filter_flags_decoder.c | 46 - .../src/liblzma/common/filter_flags_encoder.c | 56 - .../src/liblzma/common/hardware_cputhreads.c | 22 - .../src/liblzma/common/hardware_physmem.c | 25 - .../xz/dist/src/liblzma/common/index.c | 1244 - .../xz/dist/src/liblzma/common/index.h | 73 - .../dist/src/liblzma/common/index_decoder.c | 345 - .../dist/src/liblzma/common/index_encoder.c | 254 - .../dist/src/liblzma/common/index_encoder.h | 23 - .../xz/dist/src/liblzma/common/index_hash.c | 334 - .../xz/dist/src/liblzma/common/memcmplen.h | 175 - .../xz/dist/src/liblzma/common/outqueue.c | 184 - .../xz/dist/src/liblzma/common/outqueue.h | 156 - .../liblzma/common/stream_buffer_decoder.c | 91 - .../liblzma/common/stream_buffer_encoder.c | 141 - .../dist/src/liblzma/common/stream_decoder.c | 462 - .../dist/src/liblzma/common/stream_decoder.h | 22 - .../dist/src/liblzma/common/stream_encoder.c | 332 - .../src/liblzma/common/stream_encoder_mt.c | 1131 - .../src/liblzma/common/stream_flags_common.c | 47 - .../src/liblzma/common/stream_flags_common.h | 33 - .../src/liblzma/common/stream_flags_decoder.c | 82 - .../src/liblzma/common/stream_flags_encoder.c | 86 - .../xz/dist/src/liblzma/common/vli_decoder.c | 86 - .../xz/dist/src/liblzma/common/vli_encoder.c | 69 - .../xz/dist/src/liblzma/common/vli_size.c | 30 - .../xz/dist/src/liblzma/delta/delta_common.c | 70 - .../xz/dist/src/liblzma/delta/delta_common.h | 20 - .../xz/dist/src/liblzma/delta/delta_decoder.c | 76 - .../xz/dist/src/liblzma/delta/delta_decoder.h | 26 - .../xz/dist/src/liblzma/delta/delta_encoder.c | 121 - .../xz/dist/src/liblzma/delta/delta_encoder.h | 24 - .../xz/dist/src/liblzma/delta/delta_private.h | 37 - .../xz/dist/src/liblzma/liblzma.map | 108 - .../xz/dist/src/liblzma/liblzma.pc.in | 19 - .../xz/dist/src/liblzma/liblzma_w32res.rc | 12 - .../xz/dist/src/liblzma/lz/lz_decoder.c | 300 - .../xz/dist/src/liblzma/lz/lz_decoder.h | 235 - .../xz/dist/src/liblzma/lz/lz_encoder.c | 605 - .../xz/dist/src/liblzma/lz/lz_encoder.h | 328 - .../xz/dist/src/liblzma/lz/lz_encoder_hash.h | 108 - .../src/liblzma/lz/lz_encoder_hash_table.h | 68 - .../xz/dist/src/liblzma/lz/lz_encoder_mf.c | 744 - .../xz/dist/src/liblzma/lzma/fastpos.h | 141 - .../xz/dist/src/liblzma/lzma/fastpos_table.c | 519 - .../dist/src/liblzma/lzma/fastpos_tablegen.c | 56 - .../xz/dist/src/liblzma/lzma/lzma2_decoder.c | 304 - .../xz/dist/src/liblzma/lzma/lzma2_decoder.h | 29 - .../xz/dist/src/liblzma/lzma/lzma2_encoder.c | 403 - .../xz/dist/src/liblzma/lzma/lzma2_encoder.h | 43 - .../xz/dist/src/liblzma/lzma/lzma_common.h | 224 - .../xz/dist/src/liblzma/lzma/lzma_decoder.c | 1061 - .../xz/dist/src/liblzma/lzma/lzma_decoder.h | 53 - .../xz/dist/src/liblzma/lzma/lzma_encoder.c | 676 - .../xz/dist/src/liblzma/lzma/lzma_encoder.h | 55 - .../liblzma/lzma/lzma_encoder_optimum_fast.c | 169 - .../lzma/lzma_encoder_optimum_normal.c | 854 - .../src/liblzma/lzma/lzma_encoder_presets.c | 63 - .../src/liblzma/lzma/lzma_encoder_private.h | 148 - .../xz/dist/src/liblzma/rangecoder/price.h | 92 - .../dist/src/liblzma/rangecoder/price_table.c | 22 - .../src/liblzma/rangecoder/price_tablegen.c | 87 - .../src/liblzma/rangecoder/range_common.h | 73 - .../src/liblzma/rangecoder/range_decoder.h | 185 - .../src/liblzma/rangecoder/range_encoder.h | 231 - .../xz/dist/src/liblzma/simple/arm.c | 71 - .../xz/dist/src/liblzma/simple/armthumb.c | 76 - .../xz/dist/src/liblzma/simple/ia64.c | 112 - .../xz/dist/src/liblzma/simple/powerpc.c | 75 - .../xz/dist/src/liblzma/simple/simple_coder.c | 277 - .../xz/dist/src/liblzma/simple/simple_coder.h | 72 - .../dist/src/liblzma/simple/simple_decoder.c | 40 - .../dist/src/liblzma/simple/simple_decoder.h | 22 - .../dist/src/liblzma/simple/simple_encoder.c | 38 - .../dist/src/liblzma/simple/simple_encoder.h | 23 - .../dist/src/liblzma/simple/simple_private.h | 76 - .../xz/dist/src/liblzma/simple/sparc.c | 83 - .../xz/dist/src/liblzma/simple/x86.c | 156 - .../xz/dist/src/liblzma/validate_map.sh | 68 - .../xz/dist/src/lzmainfo/lzmainfo.1 | 60 - .../xz/dist/src/lzmainfo/lzmainfo.c | 219 - .../xz/dist/src/lzmainfo/lzmainfo_w32res.rc | 12 - external/public-domain/xz/dist/src/xz/args.c | 686 - external/public-domain/xz/dist/src/xz/args.h | 44 - external/public-domain/xz/dist/src/xz/coder.c | 919 - external/public-domain/xz/dist/src/xz/coder.h | 76 - .../public-domain/xz/dist/src/xz/file_io.c | 1191 - .../public-domain/xz/dist/src/xz/file_io.h | 150 - .../public-domain/xz/dist/src/xz/hardware.c | 150 - .../public-domain/xz/dist/src/xz/hardware.h | 37 - external/public-domain/xz/dist/src/xz/list.c | 1186 - external/public-domain/xz/dist/src/xz/list.h | 18 - external/public-domain/xz/dist/src/xz/main.c | 307 - external/public-domain/xz/dist/src/xz/main.h | 30 - .../public-domain/xz/dist/src/xz/message.c | 1257 - .../public-domain/xz/dist/src/xz/message.h | 167 - .../public-domain/xz/dist/src/xz/mytime.c | 89 - .../public-domain/xz/dist/src/xz/mytime.h | 47 - .../public-domain/xz/dist/src/xz/options.c | 363 - .../public-domain/xz/dist/src/xz/options.h | 31 - .../public-domain/xz/dist/src/xz/private.h | 59 - .../public-domain/xz/dist/src/xz/signals.c | 209 - .../public-domain/xz/dist/src/xz/signals.h | 43 - .../public-domain/xz/dist/src/xz/suffix.c | 399 - .../public-domain/xz/dist/src/xz/suffix.h | 28 - external/public-domain/xz/dist/src/xz/util.c | 288 - external/public-domain/xz/dist/src/xz/util.h | 123 - external/public-domain/xz/dist/src/xz/xz.1 | 2778 - .../public-domain/xz/dist/src/xz/xz_w32res.rc | 12 - .../xz/dist/src/xzdec/lzmadec_w32res.rc | 12 - .../public-domain/xz/dist/src/xzdec/xzdec.1 | 146 - .../public-domain/xz/dist/src/xzdec/xzdec.c | 323 - .../xz/dist/src/xzdec/xzdec_w32res.rc | 12 - .../public-domain/xz/dist/tests/bcj_test.c | 65 - .../tests/compress_prepared_bcj_sparc.base64 | 28 - .../tests/compress_prepared_bcj_x86.base64 | 31 - .../xz/dist/tests/create_compress_files.c | 158 - .../public-domain/xz/dist/tests/files/README | 240 - .../tests/files/bad-0-backward_size.xz.base64 | 3 - .../files/bad-0-empty-truncated.xz.base64 | 3 - .../tests/files/bad-0-footer_magic.xz.base64 | 3 - .../tests/files/bad-0-header_magic.xz.base64 | 3 - .../files/bad-0-nonempty_index.xz.base64 | 3 - .../dist/tests/files/bad-0cat-alone.xz.base64 | 4 - .../files/bad-0cat-header_magic.xz.base64 | 4 - .../tests/files/bad-0catpad-empty.xz.base64 | 4 - .../dist/tests/files/bad-0pad-empty.xz.base64 | 3 - .../files/bad-1-block_header-1.xz.base64 | 4 - .../files/bad-1-block_header-2.xz.base64 | 4 - .../files/bad-1-block_header-3.xz.base64 | 4 - .../files/bad-1-block_header-4.xz.base64 | 4 - .../files/bad-1-block_header-5.xz.base64 | 4 - .../files/bad-1-block_header-6.xz.base64 | 4 - .../tests/files/bad-1-check-crc32.xz.base64 | 4 - .../tests/files/bad-1-check-crc64.xz.base64 | 4 - .../tests/files/bad-1-check-sha256.xz.base64 | 4 - .../dist/tests/files/bad-1-lzma2-1.xz.base64 | 4 - .../dist/tests/files/bad-1-lzma2-2.xz.base64 | 11 - .../dist/tests/files/bad-1-lzma2-3.xz.base64 | 11 - .../dist/tests/files/bad-1-lzma2-4.xz.base64 | 11 - .../dist/tests/files/bad-1-lzma2-5.xz.base64 | 11 - .../dist/tests/files/bad-1-lzma2-6.xz.base64 | 4 - .../dist/tests/files/bad-1-lzma2-7.xz.base64 | 11 - .../dist/tests/files/bad-1-lzma2-8.xz.base64 | 12 - .../files/bad-1-stream_flags-1.xz.base64 | 4 - .../files/bad-1-stream_flags-2.xz.base64 | 4 - .../files/bad-1-stream_flags-3.xz.base64 | 4 - .../xz/dist/tests/files/bad-1-vli-1.xz.base64 | 4 - .../xz/dist/tests/files/bad-1-vli-2.xz.base64 | 4 - .../bad-2-compressed_data_padding.xz.base64 | 4 - .../dist/tests/files/bad-2-index-1.xz.base64 | 4 - .../dist/tests/files/bad-2-index-2.xz.base64 | 4 - .../dist/tests/files/bad-2-index-3.xz.base64 | 4 - .../dist/tests/files/bad-2-index-4.xz.base64 | 4 - .../dist/tests/files/bad-2-index-5.xz.base64 | 4 - .../dist/tests/files/good-0-empty.xz.base64 | 3 - .../tests/files/good-0cat-empty.xz.base64 | 4 - .../tests/files/good-0catpad-empty.xz.base64 | 4 - .../tests/files/good-0pad-empty.xz.base64 | 3 - .../tests/files/good-1-3delta-lzma2.xz.base64 | 13 - .../files/good-1-block_header-1.xz.base64 | 4 - .../files/good-1-block_header-2.xz.base64 | 4 - .../files/good-1-block_header-3.xz.base64 | 4 - .../tests/files/good-1-check-crc32.xz.base64 | 4 - .../tests/files/good-1-check-crc64.xz.base64 | 4 - .../tests/files/good-1-check-none.xz.base64 | 4 - .../tests/files/good-1-check-sha256.xz.base64 | 4 - .../files/good-1-delta-lzma2.tiff.xz.base64 | 1072 - .../dist/tests/files/good-1-lzma2-1.xz.base64 | 11 - .../dist/tests/files/good-1-lzma2-2.xz.base64 | 11 - .../dist/tests/files/good-1-lzma2-3.xz.base64 | 11 - .../dist/tests/files/good-1-lzma2-4.xz.base64 | 12 - .../dist/tests/files/good-1-lzma2-5.xz.base64 | 4 - .../tests/files/good-1-sparc-lzma2.xz.base64 | 15 - .../tests/files/good-1-x86-lzma2.xz.base64 | 17 - .../dist/tests/files/good-2-lzma2.xz.base64 | 4 - .../files/unsupported-block_header.xz.base64 | 4 - .../tests/files/unsupported-check.xz.base64 | 4 - .../unsupported-filter_flags-1.xz.base64 | 4 - .../unsupported-filter_flags-2.xz.base64 | 4 - .../unsupported-filter_flags-3.xz.base64 | 4 - .../xz/dist/tests/test_bcj_exact_size.c | 112 - .../xz/dist/tests/test_block_header.c | 240 - .../public-domain/xz/dist/tests/test_check.c | 83 - .../xz/dist/tests/test_compress.sh | 142 - .../public-domain/xz/dist/tests/test_files.sh | 57 - .../xz/dist/tests/test_filter_flags.c | 258 - .../public-domain/xz/dist/tests/test_index.c | 659 - .../xz/dist/tests/test_scripts.sh | 76 - .../xz/dist/tests/test_stream_flags.c | 180 - external/public-domain/xz/dist/tests/tests.h | 124 - .../xz/dist/tests/xzgrep_expected_output | 39 - external/public-domain/xz/include/config.h | 518 - external/public-domain/xz/lib/Makefile | 95 - external/public-domain/xz/lib/shlib_version | 4 - external/public-domain/xz/prepare-import.sh | 42 - include/rpc/rpcb_prot.x | 559 - include/tgmath.h | 173 - libexec/Makefile | 20 - libexec/Makefile.inc | 7 - libexec/fingerd/Makefile | 13 - libexec/fingerd/fingerd.8 | 175 - libexec/fingerd/fingerd.c | 233 - libexec/fingerd/pathnames.h | 34 - libexec/ftpd/Makefile | 63 - libexec/ftpd/cmds.c | 969 - libexec/ftpd/conf.c | 954 - libexec/ftpd/extern.h | 380 - libexec/ftpd/ftpcmd.y | 1875 - libexec/ftpd/ftpd.8 | 871 - libexec/ftpd/ftpd.c | 4004 - libexec/ftpd/ftpd.conf.5 | 738 - libexec/ftpd/ftpusers.5 | 179 - libexec/ftpd/logutmp.c | 172 - libexec/ftpd/logwtmp.c | 144 - libexec/ftpd/pathnames.h | 48 - libexec/ftpd/pfilter.c | 24 - libexec/ftpd/pfilter.h | 2 - libexec/ftpd/popen.c | 245 - libexec/ftpd/version.h | 33 - libexec/getty/Makefile | 10 - libexec/getty/extern.h | 52 - libexec/getty/getty.8 | 178 - libexec/getty/gettytab.5 | 423 - libexec/getty/gettytab.h | 173 - libexec/getty/init.c | 147 - libexec/getty/main.c | 711 - libexec/getty/pathnames.h | 37 - libexec/getty/subr.c | 742 - libexec/getty/ttys.5 | 227 - libexec/httpd/Makefile.boot | 26 - libexec/httpd/auth-bozo.c | 272 - libexec/httpd/bozohttpd.c | 2321 - libexec/httpd/cgi-bozo.c | 523 - libexec/httpd/content-bozo.c | 301 - libexec/httpd/daemon-bozo.c | 339 - libexec/httpd/debug/Makefile | 9 - libexec/httpd/dir-index-bozo.c | 212 - libexec/httpd/libbozohttpd/Makefile | 37 - libexec/httpd/libbozohttpd/libbozohttpd.3 | 143 - libexec/httpd/libbozohttpd/shlib_version | 2 - libexec/httpd/lua-bozo.c | 452 - libexec/httpd/lua/Makefile | 39 - libexec/httpd/lua/optparse.lua | 123 - libexec/httpd/lua/shlib_version | 2 - libexec/httpd/main.c | 356 - libexec/httpd/printenv.lua | 85 - libexec/httpd/small/Makefile | 30 - libexec/httpd/ssl-bozo.c | 321 - libexec/httpd/testsuite/Makefile | 32 - libexec/httpd/testsuite/data/bigfile | 127 - .../httpd/testsuite/data/bigfile.partial4000 | 50 - .../httpd/testsuite/data/bigfile.partial8000 | 100 - libexec/httpd/testsuite/data/file | 4 - libexec/httpd/testsuite/data/index.html | 1 - libexec/httpd/testsuite/html_cmp | 27 - libexec/httpd/testsuite/t1.in | 1 - libexec/httpd/testsuite/t1.out | 2 - libexec/httpd/testsuite/t10.in | 1 - libexec/httpd/testsuite/t10.out | 8 - libexec/httpd/testsuite/t2.in | 1 - libexec/httpd/testsuite/t2.out | 9 - libexec/httpd/testsuite/t3.in | 1 - libexec/httpd/testsuite/t3.out | 11 - libexec/httpd/testsuite/t4.in | 2 - libexec/httpd/testsuite/t4.out | 10 - libexec/httpd/testsuite/t5.in | 2 - libexec/httpd/testsuite/t5.out | 10 - libexec/httpd/testsuite/t6.in | 2 - libexec/httpd/testsuite/t6.out | 10 - libexec/httpd/testsuite/t7.in | 4 - libexec/httpd/testsuite/t7.out | 14 - libexec/httpd/testsuite/t8.in | 4 - libexec/httpd/testsuite/t8.out | 12 - libexec/httpd/testsuite/t9.in | 4 - libexec/httpd/testsuite/t9.out | 12 - libexec/httpd/testsuite/test-bigfile | 27 - libexec/httpd/tilde-luzah-bozo.c | 140 - libexec/makewhatis/Makefile | 19 - libexec/makewhatis/makewhatis.8 | 125 - libexec/makewhatis/makewhatis.c | 1174 - libexec/rshd/Makefile | 26 - libexec/rshd/rshd.8 | 235 - libexec/rshd/rshd.c | 809 - 1736 files changed, 543949 deletions(-) delete mode 100644 common/dist/zlib/ChangeLog delete mode 100644 common/dist/zlib/FAQ delete mode 100644 common/dist/zlib/INDEX delete mode 100644 common/dist/zlib/Makefile delete mode 100644 common/dist/zlib/Makefile.in delete mode 100644 common/dist/zlib/README delete mode 100644 common/dist/zlib/algorithm.txt delete mode 100644 common/dist/zlib/amiga/Makefile.pup delete mode 100644 common/dist/zlib/amiga/Makefile.sas delete mode 100644 common/dist/zlib/as400/bndsrc delete mode 100644 common/dist/zlib/as400/compile.clp delete mode 100644 common/dist/zlib/as400/readme.txt delete mode 100644 common/dist/zlib/as400/zlib.inc delete mode 100755 common/dist/zlib/configure delete mode 100644 common/dist/zlib/contrib/README.contrib delete mode 100644 common/dist/zlib/contrib/ada/buffer_demo.adb delete mode 100644 common/dist/zlib/contrib/ada/mtest.adb delete mode 100644 common/dist/zlib/contrib/ada/read.adb delete mode 100644 common/dist/zlib/contrib/ada/readme.txt delete mode 100644 common/dist/zlib/contrib/ada/test.adb delete mode 100644 common/dist/zlib/contrib/ada/zlib-streams.adb delete mode 100644 common/dist/zlib/contrib/ada/zlib-streams.ads delete mode 100644 common/dist/zlib/contrib/ada/zlib-thin.adb delete mode 100644 common/dist/zlib/contrib/ada/zlib-thin.ads delete mode 100644 common/dist/zlib/contrib/ada/zlib.adb delete mode 100644 common/dist/zlib/contrib/ada/zlib.ads delete mode 100644 common/dist/zlib/contrib/ada/zlib.gpr delete mode 100644 common/dist/zlib/contrib/asm586/README.586 delete mode 100644 common/dist/zlib/contrib/asm586/match.S delete mode 100644 common/dist/zlib/contrib/asm686/README.686 delete mode 100644 common/dist/zlib/contrib/asm686/match.S delete mode 100644 common/dist/zlib/contrib/blast/Makefile delete mode 100644 common/dist/zlib/contrib/blast/README delete mode 100644 common/dist/zlib/contrib/blast/test.pk delete mode 100644 common/dist/zlib/contrib/blast/test.txt delete mode 100644 common/dist/zlib/contrib/delphi/ZLib.pas delete mode 100644 common/dist/zlib/contrib/delphi/ZLibConst.pas delete mode 100644 common/dist/zlib/contrib/delphi/readme.txt delete mode 100644 common/dist/zlib/contrib/delphi/zlibd32.mak delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib.build delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib.chm delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib.sln delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/CodecBase.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/Deflater.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/DotZLib.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/GZipStream.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/Inflater.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/DotZLib/UnitTests.cs delete mode 100644 common/dist/zlib/contrib/dotzlib/LICENSE_1_0.txt delete mode 100644 common/dist/zlib/contrib/dotzlib/readme.txt delete mode 100644 common/dist/zlib/contrib/infback9/README delete mode 100644 common/dist/zlib/contrib/inflate86/inffast.S delete mode 100644 common/dist/zlib/contrib/iostream/test.cpp delete mode 100644 common/dist/zlib/contrib/iostream/zfstream.cpp delete mode 100644 common/dist/zlib/contrib/iostream2/zstream_test.cpp delete mode 100644 common/dist/zlib/contrib/iostream3/README delete mode 100644 common/dist/zlib/contrib/iostream3/TODO delete mode 100644 common/dist/zlib/contrib/iostream3/test.cc delete mode 100644 common/dist/zlib/contrib/iostream3/zfstream.cc delete mode 100644 common/dist/zlib/contrib/masm686/match.asm delete mode 100644 common/dist/zlib/contrib/masmx64/bld_ml64.bat delete mode 100644 common/dist/zlib/contrib/masmx64/gvmat64.asm delete mode 100644 common/dist/zlib/contrib/masmx64/inffasx64.asm delete mode 100644 common/dist/zlib/contrib/masmx64/readme.txt delete mode 100644 common/dist/zlib/contrib/masmx86/bld_ml32.bat delete mode 100644 common/dist/zlib/contrib/masmx86/gvmat32.asm delete mode 100644 common/dist/zlib/contrib/masmx86/inffas32.asm delete mode 100755 common/dist/zlib/contrib/masmx86/mkasm.bat delete mode 100644 common/dist/zlib/contrib/masmx86/readme.txt delete mode 100644 common/dist/zlib/contrib/minizip/ChangeLogUnzip delete mode 100644 common/dist/zlib/contrib/minizip/Makefile delete mode 100644 common/dist/zlib/contrib/pascal/example.pas delete mode 100644 common/dist/zlib/contrib/pascal/readme.txt delete mode 100644 common/dist/zlib/contrib/pascal/zlibd32.mak delete mode 100644 common/dist/zlib/contrib/pascal/zlibpas.pas delete mode 100644 common/dist/zlib/contrib/puff/Makefile delete mode 100644 common/dist/zlib/contrib/puff/README delete mode 100644 common/dist/zlib/contrib/puff/zeros.raw delete mode 100644 common/dist/zlib/contrib/testzlib/testzlib.txt delete mode 100644 common/dist/zlib/contrib/untgz/Makefile delete mode 100644 common/dist/zlib/contrib/untgz/Makefile.msc delete mode 100644 common/dist/zlib/contrib/vstudio/readme.txt delete mode 100644 common/dist/zlib/contrib/vstudio/vc7/miniunz.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc7/minizip.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc7/testzlib.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc7/zlib.rc delete mode 100644 common/dist/zlib/contrib/vstudio/vc7/zlibstat.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc7/zlibvc.def delete mode 100644 common/dist/zlib/contrib/vstudio/vc7/zlibvc.sln delete mode 100644 common/dist/zlib/contrib/vstudio/vc7/zlibvc.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/miniunz.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/minizip.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/testzlib.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/testzlibdll.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/zlib.rc delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/zlibstat.vcproj delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/zlibvc.def delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/zlibvc.sln delete mode 100644 common/dist/zlib/contrib/vstudio/vc8/zlibvc.vcproj delete mode 100644 common/dist/zlib/examples/README.examples delete mode 100644 common/dist/zlib/examples/zlib_how.html delete mode 100644 common/dist/zlib/make_vms.com delete mode 100644 common/dist/zlib/msdos/Makefile.bor delete mode 100644 common/dist/zlib/msdos/Makefile.dj2 delete mode 100644 common/dist/zlib/msdos/Makefile.emx delete mode 100644 common/dist/zlib/msdos/Makefile.msc delete mode 100644 common/dist/zlib/msdos/Makefile.tc delete mode 100644 common/dist/zlib/old/Makefile.riscos delete mode 100644 common/dist/zlib/old/README delete mode 100644 common/dist/zlib/old/descrip.mms delete mode 100644 common/dist/zlib/old/os2/Makefile.os2 delete mode 100644 common/dist/zlib/old/os2/zlib.def delete mode 100644 common/dist/zlib/old/visual-basic.txt delete mode 100644 common/dist/zlib/old/zlib.html delete mode 100644 common/dist/zlib/projects/README.projects delete mode 100644 common/dist/zlib/projects/visualc6/README.txt delete mode 100644 common/dist/zlib/projects/visualc6/example.dsp delete mode 100644 common/dist/zlib/projects/visualc6/minigzip.dsp delete mode 100644 common/dist/zlib/projects/visualc6/zlib.dsp delete mode 100644 common/dist/zlib/projects/visualc6/zlib.dsw delete mode 100644 common/dist/zlib/qnx/package.qpg delete mode 100644 common/dist/zlib/win32/DLL_FAQ.txt delete mode 100644 common/dist/zlib/win32/Makefile.bor delete mode 100644 common/dist/zlib/win32/Makefile.emx delete mode 100644 common/dist/zlib/win32/Makefile.gcc delete mode 100644 common/dist/zlib/win32/Makefile.msc delete mode 100644 common/dist/zlib/win32/VisualC.txt delete mode 100644 common/dist/zlib/win32/zlib.def delete mode 100644 common/dist/zlib/win32/zlib1.rc delete mode 100644 common/include/ppath/Makefile delete mode 100644 common/include/ppath/ppath.h delete mode 100644 common/include/ppath/ppath_impl.h delete mode 100644 common/include/prop/Makefile delete mode 100644 common/include/prop/plistref.h delete mode 100644 common/include/prop/prop_array.h delete mode 100644 common/include/prop/prop_bool.h delete mode 100644 common/include/prop/prop_data.h delete mode 100644 common/include/prop/prop_dictionary.h delete mode 100644 common/include/prop/prop_ingest.h delete mode 100644 common/include/prop/prop_number.h delete mode 100644 common/include/prop/prop_object.h delete mode 100644 common/include/prop/prop_string.h delete mode 100644 common/include/prop/proplib.h delete mode 100644 common/lib/libc/Makefile.inc delete mode 100644 common/lib/libc/arch/aarch64/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_add_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_add_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_add_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_add_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_and_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_and_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_and_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_and_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_cas_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_dec_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_dec_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_inc_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_inc_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_or_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_or_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_or_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_or_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_sub_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_sub_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_sub_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_sub_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_xor_16.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_xor_32.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_xor_64.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/atomic_xor_8.S delete mode 100644 common/lib/libc/arch/aarch64/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/aarch64/gen/byte_swap_2.S delete mode 100644 common/lib/libc/arch/aarch64/gen/byte_swap_4.S delete mode 100644 common/lib/libc/arch/aarch64/gen/byte_swap_8.S delete mode 100644 common/lib/libc/arch/aarch64/gen/clzdi2.S delete mode 100644 common/lib/libc/arch/aarch64/gen/ctzdi2.S delete mode 100644 common/lib/libc/arch/aarch64/gen/ffsdi2.S delete mode 100644 common/lib/libc/arch/aarch64/string/memcmp.S delete mode 100644 common/lib/libc/arch/aarch64/string/memcpy.S delete mode 100644 common/lib/libc/arch/aarch64/string/memset.S delete mode 100644 common/lib/libc/arch/aarch64/string/strcat.S delete mode 100644 common/lib/libc/arch/aarch64/string/strlen.S delete mode 100644 common/lib/libc/arch/aarch64/string/strnlen.S delete mode 100644 common/lib/libc/arch/alpha/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/alpha/atomic/atomic_add.S delete mode 100644 common/lib/libc/arch/alpha/atomic/atomic_and.S delete mode 100644 common/lib/libc/arch/alpha/atomic/atomic_cas.S delete mode 100644 common/lib/libc/arch/alpha/atomic/atomic_dec.S delete mode 100644 common/lib/libc/arch/alpha/atomic/atomic_inc.S delete mode 100644 common/lib/libc/arch/alpha/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/alpha/atomic/atomic_or.S delete mode 100644 common/lib/libc/arch/alpha/atomic/atomic_swap.S delete mode 100644 common/lib/libc/arch/alpha/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/alpha/gen/byte_swap_2.S delete mode 100644 common/lib/libc/arch/alpha/gen/byte_swap_4.S delete mode 100644 common/lib/libc/arch/alpha/gmon/_mcount.S delete mode 100644 common/lib/libc/arch/alpha/string/bcopy.S delete mode 100644 common/lib/libc/arch/alpha/string/bzero.S delete mode 100644 common/lib/libc/arch/alpha/string/ffs.S delete mode 100644 common/lib/libc/arch/alpha/string/memcpy.S delete mode 100644 common/lib/libc/arch/alpha/string/memmove.S delete mode 100644 common/lib/libc/arch/arm/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_add_16.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_add_32.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_add_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_add_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_and_16.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_and_32.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_and_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_and_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_cas_16.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_cas_32.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_cas_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_cas_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_cas_up.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_dec_32.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_dec_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_inc_32.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_inc_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_nand_16.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_nand_32.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_nand_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_nand_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_or_16.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_or_32.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_or_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_or_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_simplelock.c delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_sub_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_swap.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_swap_16.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_swap_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_xor_16.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_xor_32.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_xor_64.S delete mode 100644 common/lib/libc/arch/arm/atomic/atomic_xor_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_1.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_2.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_4.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_fetch_and_add_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_fetch_and_and_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_fetch_and_nand_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_fetch_and_or_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_fetch_and_sub_8.S delete mode 100644 common/lib/libc/arch/arm/atomic/sync_fetch_and_xor_8.S delete mode 100644 common/lib/libc/arch/arm/features.c delete mode 100644 common/lib/libc/arch/arm/features.mk delete mode 100644 common/lib/libc/arch/arm/gen/__aeabi_idiv0.c delete mode 100644 common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c delete mode 100644 common/lib/libc/arch/arm/gen/byte_swap_2.S delete mode 100644 common/lib/libc/arch/arm/gen/byte_swap_4.S delete mode 100644 common/lib/libc/arch/arm/gen/neon_mask.S delete mode 100644 common/lib/libc/arch/arm/quad/__aeabi_lcmp.c delete mode 100644 common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S delete mode 100644 common/lib/libc/arch/arm/quad/__aeabi_ulcmp.c delete mode 100644 common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S delete mode 100644 common/lib/libc/arch/arm/string/ffs.S delete mode 100644 common/lib/libc/arch/arm/string/memcmp.S delete mode 100644 common/lib/libc/arch/arm/string/memcpy.S delete mode 100644 common/lib/libc/arch/arm/string/memcpy_arm.S delete mode 100644 common/lib/libc/arch/arm/string/memcpy_neon.S delete mode 100644 common/lib/libc/arch/arm/string/memcpy_xscale.S delete mode 100644 common/lib/libc/arch/arm/string/memmove.S delete mode 100644 common/lib/libc/arch/arm/string/memset.S delete mode 100644 common/lib/libc/arch/arm/string/memset_arm.S delete mode 100644 common/lib/libc/arch/arm/string/memset_naive.S delete mode 100644 common/lib/libc/arch/arm/string/memset_neon.S delete mode 100644 common/lib/libc/arch/arm/string/strcat.S delete mode 100644 common/lib/libc/arch/arm/string/strcat_arm.S delete mode 100644 common/lib/libc/arch/arm/string/strcat_naive.S delete mode 100644 common/lib/libc/arch/arm/string/strchr.S delete mode 100644 common/lib/libc/arch/arm/string/strchr_arm.S delete mode 100644 common/lib/libc/arch/arm/string/strchr_naive.S delete mode 100644 common/lib/libc/arch/arm/string/strcmp.S delete mode 100644 common/lib/libc/arch/arm/string/strcpy.S delete mode 100644 common/lib/libc/arch/arm/string/strcpy_arm.S delete mode 100644 common/lib/libc/arch/arm/string/strcpy_naive.S delete mode 100644 common/lib/libc/arch/arm/string/strcpy_thumb.S delete mode 100644 common/lib/libc/arch/arm/string/strlcat.S delete mode 100644 common/lib/libc/arch/arm/string/strlcat_arm.S delete mode 100644 common/lib/libc/arch/arm/string/strlcat_naive.S delete mode 100644 common/lib/libc/arch/arm/string/strlcpy.S delete mode 100644 common/lib/libc/arch/arm/string/strlen.S delete mode 100644 common/lib/libc/arch/arm/string/strlen_arm.S delete mode 100644 common/lib/libc/arch/arm/string/strlen_naive.S delete mode 100644 common/lib/libc/arch/arm/string/strlen_neon.S delete mode 100644 common/lib/libc/arch/arm/string/strncmp.S delete mode 100644 common/lib/libc/arch/arm/string/strncpy.S delete mode 100644 common/lib/libc/arch/arm/string/strnlen.S delete mode 100644 common/lib/libc/arch/arm/string/strrchr.S delete mode 100644 common/lib/libc/arch/arm/string/strrchr_arm.S delete mode 100644 common/lib/libc/arch/arm/string/strrchr_naive.S delete mode 100644 common/lib/libc/arch/hppa/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/hppa/atomic/atomic_cas_up.S delete mode 100644 common/lib/libc/arch/hppa/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/i386/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/i386/atomic/atomic.S delete mode 100644 common/lib/libc/arch/i386/gen/byte_swap_2.S delete mode 100644 common/lib/libc/arch/i386/gen/byte_swap_4.S delete mode 100644 common/lib/libc/arch/i386/string/ffs.S delete mode 100644 common/lib/libc/arch/i386/string/memchr.S delete mode 100644 common/lib/libc/arch/i386/string/memcmp.S delete mode 100644 common/lib/libc/arch/i386/string/memcpy.S delete mode 100644 common/lib/libc/arch/i386/string/memmove.S delete mode 100644 common/lib/libc/arch/i386/string/memset.S delete mode 100644 common/lib/libc/arch/i386/string/small/memcmp.S delete mode 100644 common/lib/libc/arch/i386/string/small/memcpy.S delete mode 100644 common/lib/libc/arch/i386/string/small/memmove.S delete mode 100644 common/lib/libc/arch/i386/string/small/memset.S delete mode 100644 common/lib/libc/arch/i386/string/small/strchr.S delete mode 100644 common/lib/libc/arch/i386/string/small/strcmp.S delete mode 100644 common/lib/libc/arch/i386/string/small/strcpy.S delete mode 100644 common/lib/libc/arch/i386/string/small/strlen.S delete mode 100644 common/lib/libc/arch/i386/string/strcat.S delete mode 100644 common/lib/libc/arch/i386/string/strchr.S delete mode 100644 common/lib/libc/arch/i386/string/strcmp.S delete mode 100644 common/lib/libc/arch/i386/string/strcpy.S delete mode 100644 common/lib/libc/arch/i386/string/strlen.S delete mode 100644 common/lib/libc/arch/i386/string/strrchr.S delete mode 100644 common/lib/libc/arch/ia64/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/ia64/atomic/atomic.S delete mode 100644 common/lib/libc/arch/m68k/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_add.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_and.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_cas.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_cas_68000.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_dec.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_inc.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_nand.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_or.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_sub.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_swap.S delete mode 100644 common/lib/libc/arch/m68k/atomic/atomic_xor.S delete mode 100644 common/lib/libc/arch/m68k/gen/bswap16.S delete mode 100644 common/lib/libc/arch/m68k/gen/bswap32.S delete mode 100644 common/lib/libc/arch/m68k/gen/bswap64.S delete mode 100644 common/lib/libc/arch/m68k/gen/divsi3.S delete mode 100644 common/lib/libc/arch/m68k/gen/modsi3.S delete mode 100644 common/lib/libc/arch/m68k/gen/mulsi3.S delete mode 100644 common/lib/libc/arch/m68k/gen/udivsi3.S delete mode 100644 common/lib/libc/arch/m68k/gen/umodsi3.S delete mode 100644 common/lib/libc/arch/m68k/net/htonl.S delete mode 100644 common/lib/libc/arch/m68k/net/htons.S delete mode 100644 common/lib/libc/arch/m68k/net/ntohl.S delete mode 100644 common/lib/libc/arch/m68k/net/ntohs.S delete mode 100644 common/lib/libc/arch/m68k/string/bcmp.S delete mode 100644 common/lib/libc/arch/m68k/string/bcopy.S delete mode 100644 common/lib/libc/arch/m68k/string/bzero.S delete mode 100644 common/lib/libc/arch/m68k/string/ffs.S delete mode 100644 common/lib/libc/arch/m68k/string/memcmp.S delete mode 100644 common/lib/libc/arch/m68k/string/memcpy.S delete mode 100644 common/lib/libc/arch/m68k/string/memmove.S delete mode 100644 common/lib/libc/arch/m68k/string/memset.S delete mode 100644 common/lib/libc/arch/m68k/string/strcat.S delete mode 100644 common/lib/libc/arch/m68k/string/strchr.S delete mode 100644 common/lib/libc/arch/m68k/string/strcmp.S delete mode 100644 common/lib/libc/arch/m68k/string/strcpy.S delete mode 100644 common/lib/libc/arch/m68k/string/strlen.S delete mode 100644 common/lib/libc/arch/m68k/string/strncmp.S delete mode 100644 common/lib/libc/arch/m68k/string/strncpy.S delete mode 100644 common/lib/libc/arch/m68k/string/strrchr.S delete mode 100644 common/lib/libc/arch/mips/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_add.S delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_and.S delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_cas.S delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_cas_up.S delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_dec.S delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_inc.S delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_or.S delete mode 100644 common/lib/libc/arch/mips/atomic/atomic_swap.S delete mode 100644 common/lib/libc/arch/mips/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/mips/gen/byte_swap_2.S delete mode 100644 common/lib/libc/arch/mips/gen/byte_swap_4.S delete mode 100644 common/lib/libc/arch/mips/gen/byte_swap_8.S delete mode 100644 common/lib/libc/arch/mips/string/bcopy.S delete mode 100644 common/lib/libc/arch/mips/string/ffs.S delete mode 100644 common/lib/libc/arch/mips/string/memcpy.S delete mode 100644 common/lib/libc/arch/mips/string/memmove.S delete mode 100644 common/lib/libc/arch/mips/string/strchr.S delete mode 100644 common/lib/libc/arch/mips/string/strcmp.S delete mode 100644 common/lib/libc/arch/mips/string/strlen.S delete mode 100644 common/lib/libc/arch/mips/string/strrchr.S delete mode 100644 common/lib/libc/arch/or1k/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_add_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_and_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_cas_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_dec_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_inc_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_nand_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_or_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_swap_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/atomic_xor_32.S delete mode 100644 common/lib/libc/arch/or1k/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/or1k/atomic/sync_bool_compare_and_swap_4.S delete mode 100644 common/lib/libc/arch/or1k/gen/mulsi3.S delete mode 100644 common/lib/libc/arch/or1k/string/bcopy.S delete mode 100644 common/lib/libc/arch/or1k/string/bzero.S delete mode 100644 common/lib/libc/arch/or1k/string/clz.S delete mode 100644 common/lib/libc/arch/or1k/string/ctz.S delete mode 100644 common/lib/libc/arch/or1k/string/ffs.S delete mode 100644 common/lib/libc/arch/or1k/string/memcmp.S delete mode 100644 common/lib/libc/arch/or1k/string/memcpy.c delete mode 100644 common/lib/libc/arch/or1k/string/memmove.S delete mode 100644 common/lib/libc/arch/or1k/string/memset.S delete mode 100644 common/lib/libc/arch/or1k/string/strlen.S delete mode 100644 common/lib/libc/arch/powerpc/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/powerpc/atomic/atomic_add.S delete mode 100644 common/lib/libc/arch/powerpc/atomic/atomic_and.S delete mode 100644 common/lib/libc/arch/powerpc/atomic/atomic_cas.S delete mode 100644 common/lib/libc/arch/powerpc/atomic/atomic_dec.S delete mode 100644 common/lib/libc/arch/powerpc/atomic/atomic_inc.S delete mode 100644 common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/powerpc/atomic/atomic_or.S delete mode 100644 common/lib/libc/arch/powerpc/atomic/atomic_swap.S delete mode 100644 common/lib/libc/arch/powerpc/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/powerpc/string/bcopy.S delete mode 100644 common/lib/libc/arch/powerpc/string/ffs.S delete mode 100644 common/lib/libc/arch/powerpc/string/memcmp.S delete mode 100644 common/lib/libc/arch/powerpc/string/memcpy.S delete mode 100644 common/lib/libc/arch/powerpc/string/memmove.S delete mode 100644 common/lib/libc/arch/powerpc/string/strlen.S delete mode 100644 common/lib/libc/arch/powerpc64/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/powerpc64/string/ffs.S delete mode 100644 common/lib/libc/arch/powerpc64/string/strlen.S delete mode 100644 common/lib/libc/arch/riscv/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_add_32.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_add_64.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_and_32.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_and_64.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_cas_32.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_cas_64.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_nand_32.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_nand_64.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_or_32.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_or_64.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_sub_32.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_sub_64.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_swap_32.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_swap_64.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_xor_32.S delete mode 100644 common/lib/libc/arch/riscv/atomic/atomic_xor_64.S delete mode 100644 common/lib/libc/arch/riscv/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/riscv/string/ffs.c delete mode 100644 common/lib/libc/arch/sh3/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/sh3/string/ffs.S delete mode 100644 common/lib/libc/arch/sh3/string/memcpy.S delete mode 100644 common/lib/libc/arch/sh3/string/memmove.S delete mode 100644 common/lib/libc/arch/sh3/string/memset.S delete mode 100644 common/lib/libc/arch/sparc/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/sparc/atomic/atomic_cas.S delete mode 100644 common/lib/libc/arch/sparc/atomic/atomic_cas_up.S delete mode 100644 common/lib/libc/arch/sparc/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/sparc/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/sparc/gen/mul.S delete mode 100644 common/lib/libc/arch/sparc/gen/saveregs.S delete mode 100644 common/lib/libc/arch/sparc/gen/umul.S delete mode 100644 common/lib/libc/arch/sparc/net/htonl.S delete mode 100644 common/lib/libc/arch/sparc/net/htons.S delete mode 100644 common/lib/libc/arch/sparc/net/ntohl.S delete mode 100644 common/lib/libc/arch/sparc/net/ntohs.S delete mode 100644 common/lib/libc/arch/sparc/string/bzero.S delete mode 100644 common/lib/libc/arch/sparc/string/ffs.S delete mode 100644 common/lib/libc/arch/sparc/string/memset.S delete mode 100644 common/lib/libc/arch/sparc/string/strlen.S delete mode 100644 common/lib/libc/arch/sparc64/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/sparc64/atomic/atomic_add.S delete mode 100644 common/lib/libc/arch/sparc64/atomic/atomic_and.S delete mode 100644 common/lib/libc/arch/sparc64/atomic/atomic_cas.S delete mode 100644 common/lib/libc/arch/sparc64/atomic/atomic_dec.S delete mode 100644 common/lib/libc/arch/sparc64/atomic/atomic_inc.S delete mode 100644 common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h delete mode 100644 common/lib/libc/arch/sparc64/atomic/atomic_or.S delete mode 100644 common/lib/libc/arch/sparc64/atomic/atomic_swap.S delete mode 100644 common/lib/libc/arch/sparc64/atomic/membar_ops.S delete mode 100644 common/lib/libc/arch/sparc64/gen/mul.S delete mode 100644 common/lib/libc/arch/sparc64/gen/saveregs.S delete mode 100644 common/lib/libc/arch/sparc64/gen/umul.S delete mode 100644 common/lib/libc/arch/sparc64/net/htonl.S delete mode 100644 common/lib/libc/arch/sparc64/net/htons.S delete mode 100644 common/lib/libc/arch/sparc64/net/ntohl.S delete mode 100644 common/lib/libc/arch/sparc64/net/ntohs.S delete mode 100644 common/lib/libc/arch/sparc64/string/ffs.S delete mode 100644 common/lib/libc/arch/sparc64/string/memcpy.S delete mode 100644 common/lib/libc/arch/sparc64/string/memset.S delete mode 100644 common/lib/libc/arch/sparc64/string/strlen.S delete mode 100644 common/lib/libc/arch/sparc64/string/strmacros.h delete mode 100644 common/lib/libc/arch/vax/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/vax/gen/bswap16.S delete mode 100644 common/lib/libc/arch/vax/gen/bswap32.S delete mode 100644 common/lib/libc/arch/vax/gen/bswap64.S delete mode 100644 common/lib/libc/arch/vax/gen/udiv.S delete mode 100644 common/lib/libc/arch/vax/gen/urem.S delete mode 100644 common/lib/libc/arch/vax/string/memcpy.S delete mode 100644 common/lib/libc/arch/vax/string/memmove.S delete mode 100644 common/lib/libc/arch/vax/string/memset.S delete mode 100644 common/lib/libc/arch/x86_64/atomic/Makefile.inc delete mode 100644 common/lib/libc/arch/x86_64/atomic/atomic.S delete mode 100644 common/lib/libc/arch/x86_64/gen/byte_swap_2.S delete mode 100644 common/lib/libc/arch/x86_64/gen/byte_swap_4.S delete mode 100644 common/lib/libc/arch/x86_64/gen/byte_swap_8.S delete mode 100644 common/lib/libc/arch/x86_64/string/bcmp.S delete mode 100644 common/lib/libc/arch/x86_64/string/bcopy.S delete mode 100644 common/lib/libc/arch/x86_64/string/ffs.S delete mode 100644 common/lib/libc/arch/x86_64/string/memchr.S delete mode 100644 common/lib/libc/arch/x86_64/string/memcmp.S delete mode 100644 common/lib/libc/arch/x86_64/string/memcpy.S delete mode 100644 common/lib/libc/arch/x86_64/string/memmove.S delete mode 100644 common/lib/libc/arch/x86_64/string/memset.S delete mode 100644 common/lib/libc/arch/x86_64/string/strcat.S delete mode 100644 common/lib/libc/arch/x86_64/string/strchr.S delete mode 100644 common/lib/libc/arch/x86_64/string/strcmp.S delete mode 100644 common/lib/libc/arch/x86_64/string/strcpy.S delete mode 100644 common/lib/libc/arch/x86_64/string/strlen.S delete mode 100644 common/lib/libc/arch/x86_64/string/strrchr.S delete mode 100644 common/lib/libc/atomic/atomic_add_16_cas.c delete mode 100644 common/lib/libc/atomic/atomic_add_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_add_32_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_add_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_add_64_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_add_8_cas.c delete mode 100644 common/lib/libc/atomic/atomic_and_16_cas.c delete mode 100644 common/lib/libc/atomic/atomic_and_16_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_and_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_and_32_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_and_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_and_64_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_and_8_cas.c delete mode 100644 common/lib/libc/atomic/atomic_and_8_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c delete mode 100644 common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c delete mode 100644 common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c delete mode 100644 common/lib/libc/atomic/atomic_cas_16_cas.c delete mode 100644 common/lib/libc/atomic/atomic_cas_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_cas_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_cas_8_cas.c delete mode 100644 common/lib/libc/atomic/atomic_cas_by_cas32.c delete mode 100644 common/lib/libc/atomic/atomic_dec_32_add.c delete mode 100644 common/lib/libc/atomic/atomic_dec_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_dec_32_nv_add.c delete mode 100644 common/lib/libc/atomic/atomic_dec_32_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_dec_64_add.c delete mode 100644 common/lib/libc/atomic/atomic_dec_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_dec_64_nv_add.c delete mode 100644 common/lib/libc/atomic/atomic_dec_64_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_inc_32_add.c delete mode 100644 common/lib/libc/atomic/atomic_inc_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_inc_32_nv_add.c delete mode 100644 common/lib/libc/atomic/atomic_inc_32_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_inc_64_add.c delete mode 100644 common/lib/libc/atomic/atomic_inc_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_inc_64_nv_add.c delete mode 100644 common/lib/libc/atomic/atomic_inc_64_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_init_cas.c delete mode 100644 common/lib/libc/atomic/atomic_init_testset.c delete mode 100644 common/lib/libc/atomic/atomic_load.c delete mode 100644 common/lib/libc/atomic/atomic_nand_16_cas.c delete mode 100644 common/lib/libc/atomic/atomic_nand_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_nand_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_nand_8_cas.c delete mode 100644 common/lib/libc/atomic/atomic_op_namespace.h delete mode 100644 common/lib/libc/atomic/atomic_or_16_cas.c delete mode 100644 common/lib/libc/atomic/atomic_or_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_or_32_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_or_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_or_64_nv_cas.c delete mode 100644 common/lib/libc/atomic/atomic_or_8_cas.c delete mode 100644 common/lib/libc/atomic/atomic_store.c delete mode 100644 common/lib/libc/atomic/atomic_sub_16_cas.c delete mode 100644 common/lib/libc/atomic/atomic_sub_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_sub_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_sub_8_cas.c delete mode 100644 common/lib/libc/atomic/atomic_swap_16_cas.c delete mode 100644 common/lib/libc/atomic/atomic_swap_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_swap_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_swap_8_cas.c delete mode 100644 common/lib/libc/atomic/atomic_xor_16_cas.c delete mode 100644 common/lib/libc/atomic/atomic_xor_32_cas.c delete mode 100644 common/lib/libc/atomic/atomic_xor_64_cas.c delete mode 100644 common/lib/libc/atomic/atomic_xor_8_cas.c delete mode 100644 common/lib/libc/atomic/membar_ops_nop.c delete mode 100644 common/lib/libc/cdb/cdbr.c delete mode 100644 common/lib/libc/gen/bswap16.c delete mode 100644 common/lib/libc/gen/bswap32.c delete mode 100644 common/lib/libc/gen/bswap64.c delete mode 100644 common/lib/libc/gen/ptree.c delete mode 100644 common/lib/libc/gen/radixtree.c delete mode 100644 common/lib/libc/gen/rb.c delete mode 100644 common/lib/libc/gen/rpst.c delete mode 100644 common/lib/libc/gmon/mcount.c delete mode 100644 common/lib/libc/hash/murmurhash/murmurhash.c delete mode 100644 common/lib/libc/hash/rmd160/rmd160.c delete mode 100644 common/lib/libc/hash/sha1/sha1.c delete mode 100644 common/lib/libc/hash/sha2/sha2.c delete mode 100644 common/lib/libc/inet/inet_addr.c delete mode 100644 common/lib/libc/md/md4c.c delete mode 100644 common/lib/libc/md/md5c.c delete mode 100644 common/lib/libc/net/htonl.c delete mode 100644 common/lib/libc/net/htons.c delete mode 100644 common/lib/libc/net/ntohl.c delete mode 100644 common/lib/libc/net/ntohs.c delete mode 100644 common/lib/libc/quad/adddi3.c delete mode 100644 common/lib/libc/quad/anddi3.c delete mode 100644 common/lib/libc/quad/ashldi3.c delete mode 100644 common/lib/libc/quad/ashrdi3.c delete mode 100644 common/lib/libc/quad/cmpdi2.c delete mode 100644 common/lib/libc/quad/divdi3.c delete mode 100644 common/lib/libc/quad/iordi3.c delete mode 100644 common/lib/libc/quad/lshldi3.c delete mode 100644 common/lib/libc/quad/lshrdi3.c delete mode 100644 common/lib/libc/quad/moddi3.c delete mode 100644 common/lib/libc/quad/muldi3.c delete mode 100644 common/lib/libc/quad/negdi2.c delete mode 100644 common/lib/libc/quad/notdi2.c delete mode 100644 common/lib/libc/quad/qdivrem.c delete mode 100644 common/lib/libc/quad/quad.h delete mode 100644 common/lib/libc/quad/subdi3.c delete mode 100644 common/lib/libc/quad/ucmpdi2.c delete mode 100644 common/lib/libc/quad/udivdi3.c delete mode 100644 common/lib/libc/quad/umoddi3.c delete mode 100644 common/lib/libc/quad/xordi3.c delete mode 100644 common/lib/libc/stdlib/_strtoi.h delete mode 100644 common/lib/libc/stdlib/_strtol.h delete mode 100644 common/lib/libc/stdlib/_strtoul.h delete mode 100644 common/lib/libc/stdlib/heapsort.c delete mode 100644 common/lib/libc/stdlib/mi_vector_hash.c delete mode 100644 common/lib/libc/stdlib/random.c delete mode 100644 common/lib/libc/stdlib/strtoi.c delete mode 100644 common/lib/libc/stdlib/strtoimax.c delete mode 100644 common/lib/libc/stdlib/strtoll.c delete mode 100644 common/lib/libc/stdlib/strtou.c delete mode 100644 common/lib/libc/stdlib/strtoul.c delete mode 100644 common/lib/libc/stdlib/strtoull.c delete mode 100644 common/lib/libc/stdlib/strtoumax.c delete mode 100644 common/lib/libc/string/bcmp.c delete mode 100644 common/lib/libc/string/bcopy.c delete mode 100644 common/lib/libc/string/bzero.c delete mode 100644 common/lib/libc/string/bzero2.c delete mode 100644 common/lib/libc/string/consttime_memequal.c delete mode 100644 common/lib/libc/string/explicit_memset.c delete mode 100644 common/lib/libc/string/ffs.c delete mode 100644 common/lib/libc/string/memchr.c delete mode 100644 common/lib/libc/string/memcmp.c delete mode 100644 common/lib/libc/string/memcpy.c delete mode 100644 common/lib/libc/string/memmove.c delete mode 100644 common/lib/libc/string/memset.c delete mode 100644 common/lib/libc/string/memset2.c delete mode 100644 common/lib/libc/string/popcount32.c delete mode 100644 common/lib/libc/string/popcount64.c delete mode 100644 common/lib/libc/string/strcasecmp.c delete mode 100644 common/lib/libc/string/strcat.c delete mode 100644 common/lib/libc/string/strchr.c delete mode 100644 common/lib/libc/string/strcmp.c delete mode 100644 common/lib/libc/string/strcpy.c delete mode 100644 common/lib/libc/string/strcspn.c delete mode 100644 common/lib/libc/string/strlcat.c delete mode 100644 common/lib/libc/string/strlcpy.c delete mode 100644 common/lib/libc/string/strlen.c delete mode 100644 common/lib/libc/string/strncasecmp.c delete mode 100644 common/lib/libc/string/strncat.c delete mode 100644 common/lib/libc/string/strncmp.c delete mode 100644 common/lib/libc/string/strncpy.c delete mode 100644 common/lib/libc/string/strnlen.c delete mode 100644 common/lib/libc/string/strpbrk.c delete mode 100644 common/lib/libc/string/strrchr.c delete mode 100644 common/lib/libc/string/strsep.c delete mode 100644 common/lib/libc/string/strspn.c delete mode 100644 common/lib/libc/string/strstr.c delete mode 100644 common/lib/libc/sys/cpuset.c delete mode 100644 common/lib/libprop/Makefile.inc delete mode 100644 common/lib/libprop/prop_array.3 delete mode 100644 common/lib/libprop/prop_array.c delete mode 100644 common/lib/libprop/prop_array_util.3 delete mode 100644 common/lib/libprop/prop_array_util.c delete mode 100644 common/lib/libprop/prop_bool.3 delete mode 100644 common/lib/libprop/prop_bool.c delete mode 100644 common/lib/libprop/prop_copyin_ioctl.9 delete mode 100644 common/lib/libprop/prop_data.3 delete mode 100644 common/lib/libprop/prop_data.c delete mode 100644 common/lib/libprop/prop_dictionary.3 delete mode 100644 common/lib/libprop/prop_dictionary.c delete mode 100644 common/lib/libprop/prop_dictionary_util.3 delete mode 100644 common/lib/libprop/prop_dictionary_util.c delete mode 100644 common/lib/libprop/prop_ingest.3 delete mode 100644 common/lib/libprop/prop_ingest.c delete mode 100644 common/lib/libprop/prop_kern.c delete mode 100644 common/lib/libprop/prop_number.3 delete mode 100644 common/lib/libprop/prop_number.c delete mode 100644 common/lib/libprop/prop_object.3 delete mode 100644 common/lib/libprop/prop_object.c delete mode 100644 common/lib/libprop/prop_object_impl.h delete mode 100644 common/lib/libprop/prop_rb.c delete mode 100644 common/lib/libprop/prop_rb_impl.h delete mode 100644 common/lib/libprop/prop_send_ioctl.3 delete mode 100644 common/lib/libprop/prop_send_syscall.3 delete mode 100644 common/lib/libprop/prop_stack.c delete mode 100644 common/lib/libprop/prop_stack.h delete mode 100644 common/lib/libprop/prop_string.3 delete mode 100644 common/lib/libprop/prop_string.c delete mode 100644 common/lib/libprop/proplib.3 delete mode 100644 common/lib/libutil/Makefile.inc delete mode 100644 common/lib/libutil/getfstypename.c delete mode 100644 common/lib/libutil/proc_compare.c delete mode 100644 common/lib/libutil/snprintb.c delete mode 100644 etc/Makefile delete mode 100644 etc/Makefile.params delete mode 100644 etc/boot.cfg.default delete mode 100755 etc/crontab delete mode 100644 etc/csh.cshrc delete mode 100644 etc/csh.login delete mode 100644 etc/csh.logout delete mode 100644 etc/defaults/Makefile delete mode 100644 etc/defaults/minix.rc.conf delete mode 100644 etc/defaults/rc.conf delete mode 100644 etc/devmand/Makefile delete mode 100644 etc/devmand/scripts/Makefile delete mode 100755 etc/devmand/scripts/block delete mode 100755 etc/devmand/scripts/singlechar delete mode 100644 etc/devmand/usb_hub.cfg delete mode 100644 etc/devmand/usb_storage.cfg delete mode 100755 etc/fonts/cp1251.fnt delete mode 100644 etc/fonts/cp437.fnt delete mode 100644 etc/fonts/cp850.fnt delete mode 100644 etc/fonts/cp865.fnt delete mode 100644 etc/fonts/cp866.fnt delete mode 100644 etc/fonts/iso1.fnt delete mode 100644 etc/fonts/koi8-r.fnt delete mode 100755 etc/fonts/koi8-u.fnt delete mode 100644 etc/fonts/polish.fnt delete mode 100644 etc/gettytab delete mode 100755 etc/group delete mode 100755 etc/hostname.file delete mode 100644 etc/hosts delete mode 100755 etc/inet.conf delete mode 100644 etc/inetd.conf delete mode 100644 etc/man.conf delete mode 100644 etc/master.passwd delete mode 100644 etc/mk.conf delete mode 100755 etc/motd delete mode 100644 etc/mtree/Makefile delete mode 100644 etc/mtree/Minix.bitcode delete mode 100644 etc/mtree/Minix.libcxx delete mode 100644 etc/mtree/Minix.libstdcxx delete mode 100644 etc/mtree/mkcompat.awk delete mode 100644 etc/mtree/mkcompattree.awk delete mode 100644 etc/mtree/special delete mode 100644 etc/named.conf delete mode 100644 etc/namedb/127 delete mode 100644 etc/namedb/Makefile delete mode 100644 etc/namedb/bind.keys delete mode 100644 etc/namedb/localhost delete mode 100644 etc/namedb/loopback.v6 delete mode 100644 etc/namedb/root.cache delete mode 100644 etc/newfstab.sh delete mode 100644 etc/nsswitch.conf delete mode 100644 etc/passwd.conf delete mode 100755 etc/profile delete mode 100644 etc/protocols delete mode 100644 etc/rc delete mode 100644 etc/rc.capes/BB-BONE-WTHR-01 delete mode 100644 etc/rc.cd delete mode 100644 etc/rc.conf delete mode 100755 etc/rc.d/DAEMON delete mode 100644 etc/rc.d/DISKS delete mode 100755 etc/rc.d/LOGIN delete mode 100755 etc/rc.d/Makefile delete mode 100755 etc/rc.d/NETWORKING delete mode 100755 etc/rc.d/SERVERS delete mode 100755 etc/rc.d/bootconf.sh delete mode 100755 etc/rc.d/dhclient delete mode 100755 etc/rc.d/dhcpcd delete mode 100755 etc/rc.d/dhcpd delete mode 100755 etc/rc.d/dhcrelay delete mode 100644 etc/rc.d/downinterfaces delete mode 100755 etc/rc.d/fsck delete mode 100755 etc/rc.d/ftpd delete mode 100755 etc/rc.d/inetd delete mode 100755 etc/rc.d/ipfilter delete mode 100755 etc/rc.d/ipsec delete mode 100755 etc/rc.d/local delete mode 100755 etc/rc.d/minixrc delete mode 100755 etc/rc.d/mountcritlocal delete mode 100755 etc/rc.d/mountcritremote delete mode 100755 etc/rc.d/named delete mode 100755 etc/rc.d/network delete mode 100644 etc/rc.d/npf delete mode 100755 etc/rc.d/pwcheck delete mode 100755 etc/rc.d/root delete mode 100755 etc/rc.d/rtadvd delete mode 100755 etc/rc.d/staticroute delete mode 100755 etc/rc.d/sysctl delete mode 100755 etc/rc.d/sysdb delete mode 100755 etc/rc.d/syslogd delete mode 100755 etc/rc.d/ttys delete mode 100755 etc/rc.d/wscons delete mode 100755 etc/rc.minix delete mode 100644 etc/rc.shutdown delete mode 100644 etc/rc.subr delete mode 100644 etc/root/Makefile delete mode 100644 etc/root/dot.cshrc delete mode 100644 etc/root/dot.klogin delete mode 100644 etc/root/dot.login delete mode 100644 etc/root/dot.profile delete mode 100644 etc/root/dot.shrc delete mode 100755 etc/rs.lwip delete mode 100644 etc/rs.single delete mode 100644 etc/services delete mode 100644 etc/shells delete mode 100644 etc/shrc delete mode 100644 etc/skel/Makefile delete mode 100644 etc/skel/dot.cshrc delete mode 100644 etc/skel/dot.login delete mode 100644 etc/skel/dot.logout delete mode 100644 etc/skel/dot.profile delete mode 100644 etc/skel/dot.shrc delete mode 100644 etc/syslog.conf delete mode 100644 etc/system.conf delete mode 100755 etc/termcap delete mode 100644 etc/termcap.big delete mode 100755 etc/ttys delete mode 100644 etc/usr/Makefile delete mode 100755 etc/usr/daily delete mode 100644 etc/usr/rc delete mode 100755 etc/utmp delete mode 100644 etc/xorg.conf delete mode 100644 external/Makefile delete mode 100644 external/mit/Makefile delete mode 100644 external/mit/ctwm/Makefile delete mode 100644 external/mit/ctwm/bin/Makefile delete mode 100644 external/mit/ctwm/bin/ctwm/Makefile delete mode 100644 external/mit/expat/Makefile delete mode 100644 external/mit/expat/Makefile.inc delete mode 100644 external/mit/expat/bin/Makefile delete mode 100644 external/mit/expat/bin/Makefile.inc delete mode 100644 external/mit/expat/bin/xmlwf/Makefile delete mode 100755 external/mit/expat/dist/CMake.README delete mode 100755 external/mit/expat/dist/CMakeLists.txt delete mode 100755 external/mit/expat/dist/COPYING delete mode 100755 external/mit/expat/dist/Changes delete mode 100755 external/mit/expat/dist/ConfigureChecks.cmake delete mode 100755 external/mit/expat/dist/MANIFEST delete mode 100755 external/mit/expat/dist/Makefile.in delete mode 100755 external/mit/expat/dist/README delete mode 100644 external/mit/expat/dist/aclocal.m4 delete mode 100755 external/mit/expat/dist/amiga/Makefile delete mode 100755 external/mit/expat/dist/amiga/README.txt delete mode 100755 external/mit/expat/dist/amiga/expat.xml delete mode 100644 external/mit/expat/dist/amiga/expat_68k.c delete mode 100755 external/mit/expat/dist/amiga/expat_68k.h delete mode 100755 external/mit/expat/dist/amiga/expat_68k_handler_stubs.c delete mode 100644 external/mit/expat/dist/amiga/expat_base.h delete mode 100755 external/mit/expat/dist/amiga/expat_lib.c delete mode 100755 external/mit/expat/dist/amiga/expat_vectors.c delete mode 100755 external/mit/expat/dist/amiga/include/inline4/expat.h delete mode 100755 external/mit/expat/dist/amiga/include/interfaces/expat.h delete mode 100755 external/mit/expat/dist/amiga/include/libraries/expat.h delete mode 100755 external/mit/expat/dist/amiga/include/proto/expat.h delete mode 100755 external/mit/expat/dist/amiga/launch.c delete mode 100755 external/mit/expat/dist/bcb5/README.txt delete mode 100755 external/mit/expat/dist/bcb5/all_projects.bpg delete mode 100755 external/mit/expat/dist/bcb5/elements.bpf delete mode 100755 external/mit/expat/dist/bcb5/elements.bpr delete mode 100755 external/mit/expat/dist/bcb5/elements.mak delete mode 100755 external/mit/expat/dist/bcb5/expat.bpf delete mode 100755 external/mit/expat/dist/bcb5/expat.bpr delete mode 100755 external/mit/expat/dist/bcb5/expat.mak delete mode 100755 external/mit/expat/dist/bcb5/expat_static.bpf delete mode 100755 external/mit/expat/dist/bcb5/expat_static.bpr delete mode 100755 external/mit/expat/dist/bcb5/expat_static.mak delete mode 100755 external/mit/expat/dist/bcb5/expatw.bpf delete mode 100755 external/mit/expat/dist/bcb5/expatw.bpr delete mode 100755 external/mit/expat/dist/bcb5/expatw.mak delete mode 100755 external/mit/expat/dist/bcb5/expatw_static.bpf delete mode 100755 external/mit/expat/dist/bcb5/expatw_static.bpr delete mode 100755 external/mit/expat/dist/bcb5/expatw_static.mak delete mode 100755 external/mit/expat/dist/bcb5/libexpat_mtd.def delete mode 100755 external/mit/expat/dist/bcb5/libexpatw_mtd.def delete mode 100755 external/mit/expat/dist/bcb5/makefile.mak delete mode 100755 external/mit/expat/dist/bcb5/outline.bpf delete mode 100755 external/mit/expat/dist/bcb5/outline.bpr delete mode 100755 external/mit/expat/dist/bcb5/outline.mak delete mode 100755 external/mit/expat/dist/bcb5/setup.bat delete mode 100755 external/mit/expat/dist/bcb5/xmlwf.bpf delete mode 100755 external/mit/expat/dist/bcb5/xmlwf.bpr delete mode 100755 external/mit/expat/dist/bcb5/xmlwf.mak delete mode 100755 external/mit/expat/dist/configure delete mode 100755 external/mit/expat/dist/configure.in delete mode 100755 external/mit/expat/dist/conftools/PrintPath delete mode 100755 external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4 delete mode 100755 external/mit/expat/dist/conftools/config.guess delete mode 100755 external/mit/expat/dist/conftools/config.sub delete mode 100755 external/mit/expat/dist/conftools/expat.m4 delete mode 100755 external/mit/expat/dist/conftools/get-version.sh delete mode 100755 external/mit/expat/dist/conftools/install-sh delete mode 100755 external/mit/expat/dist/conftools/ltmain.sh delete mode 100755 external/mit/expat/dist/conftools/mkinstalldirs delete mode 100755 external/mit/expat/dist/doc/expat.png delete mode 100755 external/mit/expat/dist/doc/reference.html delete mode 100755 external/mit/expat/dist/doc/style.css delete mode 100755 external/mit/expat/dist/doc/valid-xhtml10.png delete mode 100755 external/mit/expat/dist/doc/xmlwf.1 delete mode 100755 external/mit/expat/dist/doc/xmlwf.sgml delete mode 100755 external/mit/expat/dist/examples/elements.c delete mode 100755 external/mit/expat/dist/examples/elements.dsp delete mode 100755 external/mit/expat/dist/examples/outline.c delete mode 100755 external/mit/expat/dist/examples/outline.dsp delete mode 100755 external/mit/expat/dist/expat.dsw delete mode 100644 external/mit/expat/dist/expat.pc.in delete mode 100755 external/mit/expat/dist/expat_config.h.cmake delete mode 100755 external/mit/expat/dist/expat_config.h.in delete mode 100755 external/mit/expat/dist/lib/Makefile.MPW delete mode 100755 external/mit/expat/dist/lib/amigaconfig.h delete mode 100755 external/mit/expat/dist/lib/ascii.h delete mode 100755 external/mit/expat/dist/lib/asciitab.h delete mode 100755 external/mit/expat/dist/lib/expat.dsp delete mode 100755 external/mit/expat/dist/lib/expat.h delete mode 100755 external/mit/expat/dist/lib/expat_external.h delete mode 100755 external/mit/expat/dist/lib/expat_static.dsp delete mode 100755 external/mit/expat/dist/lib/expatw.dsp delete mode 100755 external/mit/expat/dist/lib/expatw_static.dsp delete mode 100755 external/mit/expat/dist/lib/iasciitab.h delete mode 100755 external/mit/expat/dist/lib/internal.h delete mode 100755 external/mit/expat/dist/lib/latin1tab.h delete mode 100755 external/mit/expat/dist/lib/libexpat.def delete mode 100755 external/mit/expat/dist/lib/libexpatw.def delete mode 100755 external/mit/expat/dist/lib/macconfig.h delete mode 100755 external/mit/expat/dist/lib/nametab.h delete mode 100755 external/mit/expat/dist/lib/utf8tab.h delete mode 100755 external/mit/expat/dist/lib/winconfig.h delete mode 100755 external/mit/expat/dist/lib/xmlparse.c delete mode 100755 external/mit/expat/dist/lib/xmlrole.c delete mode 100755 external/mit/expat/dist/lib/xmlrole.h delete mode 100755 external/mit/expat/dist/lib/xmltok.c delete mode 100755 external/mit/expat/dist/lib/xmltok.h delete mode 100755 external/mit/expat/dist/lib/xmltok_impl.c delete mode 100755 external/mit/expat/dist/lib/xmltok_impl.h delete mode 100755 external/mit/expat/dist/lib/xmltok_ns.c delete mode 100644 external/mit/expat/dist/m4/libtool.m4 delete mode 100644 external/mit/expat/dist/m4/ltoptions.m4 delete mode 100644 external/mit/expat/dist/m4/ltsugar.m4 delete mode 100644 external/mit/expat/dist/m4/ltversion.m4 delete mode 100644 external/mit/expat/dist/m4/lt~obsolete.m4 delete mode 100755 external/mit/expat/dist/tests/README.txt delete mode 100755 external/mit/expat/dist/tests/benchmark/README.txt delete mode 100755 external/mit/expat/dist/tests/benchmark/benchmark.c delete mode 100755 external/mit/expat/dist/tests/benchmark/benchmark.dsp delete mode 100755 external/mit/expat/dist/tests/benchmark/benchmark.dsw delete mode 100755 external/mit/expat/dist/tests/chardata.c delete mode 100755 external/mit/expat/dist/tests/chardata.h delete mode 100755 external/mit/expat/dist/tests/minicheck.c delete mode 100755 external/mit/expat/dist/tests/minicheck.h delete mode 100755 external/mit/expat/dist/tests/runtests.c delete mode 100755 external/mit/expat/dist/tests/runtestspp.cpp delete mode 100755 external/mit/expat/dist/tests/xmltest.sh delete mode 100755 external/mit/expat/dist/vms/README.vms delete mode 100755 external/mit/expat/dist/vms/descrip.mms delete mode 100755 external/mit/expat/dist/vms/expat_config.h delete mode 100755 external/mit/expat/dist/win32/MANIFEST.txt delete mode 100755 external/mit/expat/dist/win32/README.txt delete mode 100755 external/mit/expat/dist/win32/expat.iss delete mode 100755 external/mit/expat/dist/xmlwf/codepage.c delete mode 100755 external/mit/expat/dist/xmlwf/codepage.h delete mode 100755 external/mit/expat/dist/xmlwf/ct.c delete mode 100755 external/mit/expat/dist/xmlwf/filemap.h delete mode 100755 external/mit/expat/dist/xmlwf/readfilemap.c delete mode 100755 external/mit/expat/dist/xmlwf/unixfilemap.c delete mode 100755 external/mit/expat/dist/xmlwf/win32filemap.c delete mode 100755 external/mit/expat/dist/xmlwf/xmlfile.c delete mode 100755 external/mit/expat/dist/xmlwf/xmlfile.h delete mode 100755 external/mit/expat/dist/xmlwf/xmlmime.c delete mode 100755 external/mit/expat/dist/xmlwf/xmlmime.h delete mode 100755 external/mit/expat/dist/xmlwf/xmltchar.h delete mode 100755 external/mit/expat/dist/xmlwf/xmlurl.h delete mode 100755 external/mit/expat/dist/xmlwf/xmlwf.c delete mode 100755 external/mit/expat/dist/xmlwf/xmlwf.dsp delete mode 100755 external/mit/expat/dist/xmlwf/xmlwin32url.cxx delete mode 100644 external/mit/expat/lib/Makefile delete mode 100644 external/mit/expat/lib/Makefile.inc delete mode 100644 external/mit/expat/lib/libexpat/Makefile delete mode 100644 external/mit/expat/lib/libexpat/expat_config.h delete mode 100644 external/mit/expat/lib/libexpat/shlib_version delete mode 100644 external/mit/lua/Makefile delete mode 100644 external/mit/lua/dist/Makefile delete mode 100644 external/mit/lua/dist/README delete mode 100644 external/mit/lua/dist/doc/contents.html delete mode 100644 external/mit/lua/dist/doc/index.css delete mode 100644 external/mit/lua/dist/doc/logo.gif delete mode 100644 external/mit/lua/dist/doc/lua.1 delete mode 100644 external/mit/lua/dist/doc/lua.css delete mode 100644 external/mit/lua/dist/doc/luac.1 delete mode 100644 external/mit/lua/dist/doc/manual.css delete mode 100644 external/mit/lua/dist/doc/manual.html delete mode 100644 external/mit/lua/dist/doc/osi-certified-72x60.png delete mode 100644 external/mit/lua/dist/doc/readme.html delete mode 100644 external/mit/lua/dist/src/Makefile delete mode 100644 external/mit/lua/dist/src/lapi.c delete mode 100644 external/mit/lua/dist/src/lapi.h delete mode 100644 external/mit/lua/dist/src/lauxlib.c delete mode 100644 external/mit/lua/dist/src/lauxlib.h delete mode 100644 external/mit/lua/dist/src/lbaselib.c delete mode 100644 external/mit/lua/dist/src/lbitlib.c delete mode 100644 external/mit/lua/dist/src/lcode.c delete mode 100644 external/mit/lua/dist/src/lcode.h delete mode 100644 external/mit/lua/dist/src/lcorolib.c delete mode 100644 external/mit/lua/dist/src/lctype.c delete mode 100644 external/mit/lua/dist/src/lctype.h delete mode 100644 external/mit/lua/dist/src/ldblib.c delete mode 100644 external/mit/lua/dist/src/ldebug.c delete mode 100644 external/mit/lua/dist/src/ldebug.h delete mode 100644 external/mit/lua/dist/src/ldo.c delete mode 100644 external/mit/lua/dist/src/ldo.h delete mode 100644 external/mit/lua/dist/src/ldump.c delete mode 100644 external/mit/lua/dist/src/lfunc.c delete mode 100644 external/mit/lua/dist/src/lfunc.h delete mode 100644 external/mit/lua/dist/src/lgc.c delete mode 100644 external/mit/lua/dist/src/lgc.h delete mode 100644 external/mit/lua/dist/src/linit.c delete mode 100644 external/mit/lua/dist/src/liolib.c delete mode 100644 external/mit/lua/dist/src/llex.c delete mode 100644 external/mit/lua/dist/src/llex.h delete mode 100644 external/mit/lua/dist/src/llimits.h delete mode 100644 external/mit/lua/dist/src/lmathlib.c delete mode 100644 external/mit/lua/dist/src/lmem.c delete mode 100644 external/mit/lua/dist/src/lmem.h delete mode 100644 external/mit/lua/dist/src/loadlib.c delete mode 100644 external/mit/lua/dist/src/lobject.c delete mode 100644 external/mit/lua/dist/src/lobject.h delete mode 100644 external/mit/lua/dist/src/lopcodes.c delete mode 100644 external/mit/lua/dist/src/lopcodes.h delete mode 100644 external/mit/lua/dist/src/loslib.c delete mode 100644 external/mit/lua/dist/src/lparser.c delete mode 100644 external/mit/lua/dist/src/lparser.h delete mode 100644 external/mit/lua/dist/src/lprefix.h delete mode 100644 external/mit/lua/dist/src/lstate.c delete mode 100644 external/mit/lua/dist/src/lstate.h delete mode 100644 external/mit/lua/dist/src/lstring.c delete mode 100644 external/mit/lua/dist/src/lstring.h delete mode 100644 external/mit/lua/dist/src/lstrlib.c delete mode 100644 external/mit/lua/dist/src/ltable.c delete mode 100644 external/mit/lua/dist/src/ltable.h delete mode 100644 external/mit/lua/dist/src/ltablib.c delete mode 100644 external/mit/lua/dist/src/ltm.c delete mode 100644 external/mit/lua/dist/src/ltm.h delete mode 100644 external/mit/lua/dist/src/lua.c delete mode 100644 external/mit/lua/dist/src/lua.h delete mode 100644 external/mit/lua/dist/src/lua.hpp delete mode 100644 external/mit/lua/dist/src/luac.c delete mode 100644 external/mit/lua/dist/src/luaconf.h delete mode 100644 external/mit/lua/dist/src/lualib.h delete mode 100644 external/mit/lua/dist/src/lundump.c delete mode 100644 external/mit/lua/dist/src/lundump.h delete mode 100644 external/mit/lua/dist/src/lutf8lib.c delete mode 100644 external/mit/lua/dist/src/lvm.c delete mode 100644 external/mit/lua/dist/src/lvm.h delete mode 100644 external/mit/lua/dist/src/lzio.c delete mode 100644 external/mit/lua/dist/src/lzio.h delete mode 100644 external/mit/lua/lib/Makefile delete mode 100644 external/mit/lua/lib/liblua/Makefile delete mode 100644 external/mit/lua/lib/liblua/shlib_version delete mode 100644 external/mit/lua/usr.bin/Makefile delete mode 100644 external/mit/lua/usr.bin/lua/Makefile delete mode 100644 external/mit/lua/usr.bin/luac/Makefile delete mode 100644 external/mit/xorg/Makefile.inc delete mode 100644 external/mit/xorg/server/Makefile delete mode 100644 external/mit/xorg/server/Makefile.inc delete mode 100644 external/mit/xorg/server/drivers/Makefile delete mode 100644 external/mit/xorg/server/drivers/Makefile.xf86-driver delete mode 100644 external/mit/xorg/server/drivers/xf86-input-elographics/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-input-mouse/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-input-synaptics/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-input-vmmouse/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-input-ws/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-ag10e/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-apm/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-ark/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-ast/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-ati/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-chips/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-cirrus/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-cirrus_alpine/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-cirrus_laguna/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-crime/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-geode/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-glint/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-i128/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-i740/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-igs/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-imstt/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel-old/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel-old/Makefile.inc delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel-old/ch7017/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel-old/ch7xxx/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel-old/ivch/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel-old/sil164/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel-old/tfp410/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel/ch7017/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel/ch7xxx/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel/ivch/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel/sil164/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-intel/tfp410/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-mach64/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-mga/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-neomagic/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-newport/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-nsc/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-nv/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-nvxbox/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-pnozz/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-r128/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-radeon-kms/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-radeon/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-rendition/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-s3/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-s3virge/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-savage/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-siliconmotion/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-sis/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-suncg6/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-sunffb/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-sunleo/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-suntcx/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-tdfx/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-tga/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-trident/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-tseng/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-vesa/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-vmware/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-wsfb/Makefile delete mode 100644 external/mit/xorg/server/drivers/xf86-video-xgi/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/Makefile.Xserver delete mode 100644 external/mit/xorg/server/xorg-server/Makefile.common delete mode 100644 external/mit/xorg/server/xorg-server/Makefile.inc delete mode 100644 external/mit/xorg/server/xorg-server/Makefile.serverlib delete mode 100644 external/mit/xorg/server/xorg-server/Makefile.servermod delete mode 100644 external/mit/xorg/server/xorg-server/XTrap/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/XTrap/Makefile.xtrap delete mode 100644 external/mit/xorg/server/xorg-server/Xext/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/Xext/Makefile.Xext delete mode 100644 external/mit/xorg/server/xorg-server/Xext/Makefile.Xextbuiltin delete mode 100644 external/mit/xorg/server/xorg-server/Xext/Makefile.Xextmodule delete mode 100644 external/mit/xorg/server/xorg-server/Xext/Xextbuiltin/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/Xext/Xextmodule/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/Xi/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/afb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/afb/Makefile.afb delete mode 100644 external/mit/xorg/server/xorg-server/cfb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/cfb/Makefile.cfb delete mode 100644 external/mit/xorg/server/xorg-server/cfb32/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/composite/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/config/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/damageext/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/dbe/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/dbe/Makefile.dbe delete mode 100644 external/mit/xorg/server/xorg-server/dix/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/dix/Makefile.common delete mode 100644 external/mit/xorg/server/xorg-server/dix/xpstubs/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/doc/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/exa/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/exa/Makefile.exa delete mode 100644 external/mit/xorg/server/xorg-server/fb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/fb/Makefile.fb delete mode 100644 external/mit/xorg/server/xorg-server/glx/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/glx/Makefile.glx delete mode 100644 external/mit/xorg/server/xorg-server/hw/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/Makefile.inc delete mode 100644 external/mit/xorg/server/xorg-server/hw/vfb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/Makefile.inc delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/ddc/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/GLcore/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/Makefile.dixmod delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/afb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/cfb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/cfb32/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/dbe/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/extmod/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/fb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/freetype/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/glx/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/mfb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/record/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/shadow/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/type1/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/wfb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/xorgxkb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/xtrap/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/doc/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dri/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dri2/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/dummy/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/exa/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/i2c/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/init/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/int10/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/loader/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/pcidata/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/rac/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/ramdac/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/scanpci/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/shadowfb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/utils/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/utils/Makefile.utils delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/utils/cvt/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/utils/gtf/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/utils/ioport/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/utils/pcitweak/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/utils/scanpci/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/utils/xorgconfig/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/vbe/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/vgahw/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/x86emu/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/xaa/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/xf1bpp/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/xf4bpp/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/xf86config/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/xf86modes/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/xf8_16bpp/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/xf8_32bpp/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xfree86/xorgos/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/hw/xnest/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/include/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/mfb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/mfb/Makefile.mfb delete mode 100644 external/mit/xorg/server/xorg-server/mi/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/miext/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/miext/cw/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/miext/cw/Makefile.cw delete mode 100644 external/mit/xorg/server/xorg-server/miext/damage/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/miext/damage/Makefile.damage delete mode 100644 external/mit/xorg/server/xorg-server/miext/rootless/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/miext/rootless/Makefile.rootless delete mode 100644 external/mit/xorg/server/xorg-server/miext/shadow/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/miext/shadow/Makefile.shadow delete mode 100644 external/mit/xorg/server/xorg-server/miext/sync/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/miext/sync/Makefile.sync delete mode 100644 external/mit/xorg/server/xorg-server/os/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/randr/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/record/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/record/Makefile.record delete mode 100644 external/mit/xorg/server/xorg-server/render/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/xfixes/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/xkb/Makefile delete mode 100644 external/mit/xorg/server/xorg-server/xkbstubs/Makefile delete mode 100644 external/mit/xorg/tools/fc-cache/Makefile delete mode 100644 external/mit/xorg/tools/fc-cache/Makefile.fc-cache delete mode 100644 external/mit/xorg/tools/makestrs/Makefile delete mode 100644 external/mit/xorg/tools/mkfontscale/Makefile delete mode 100644 external/mit/xorg/xorg-pkg-ver.mk delete mode 100644 external/public-domain/Makefile delete mode 100644 external/public-domain/sqlite/Makefile delete mode 100644 external/public-domain/sqlite/Makefile.inc delete mode 100644 external/public-domain/sqlite/bin/Makefile delete mode 100644 external/public-domain/sqlite/dist/shell.c delete mode 100644 external/public-domain/sqlite/dist/sqlite3.1 delete mode 100644 external/public-domain/sqlite/dist/sqlite3.c delete mode 100644 external/public-domain/sqlite/dist/sqlite3.h delete mode 100644 external/public-domain/sqlite/dist/sqlite3ext.h delete mode 100644 external/public-domain/sqlite/lib/Makefile delete mode 100644 external/public-domain/sqlite/lib/shlib_version delete mode 100644 external/public-domain/sqlite/lib/sqlite3.pc.in delete mode 100644 external/public-domain/tz/Makefile delete mode 100644 external/public-domain/tz/Makefile.inc delete mode 100644 external/public-domain/tz/dist/CONTRIBUTING delete mode 100644 external/public-domain/tz/dist/Makefile delete mode 100644 external/public-domain/tz/dist/NEWS delete mode 100644 external/public-domain/tz/dist/README delete mode 100644 external/public-domain/tz/dist/Theory delete mode 100644 external/public-domain/tz/dist/africa delete mode 100644 external/public-domain/tz/dist/antarctica delete mode 100644 external/public-domain/tz/dist/asia delete mode 100644 external/public-domain/tz/dist/australasia delete mode 100644 external/public-domain/tz/dist/backward delete mode 100644 external/public-domain/tz/dist/backzone delete mode 100644 external/public-domain/tz/dist/checklinks.awk delete mode 100644 external/public-domain/tz/dist/checktab.awk delete mode 100644 external/public-domain/tz/dist/etcetera delete mode 100644 external/public-domain/tz/dist/europe delete mode 100644 external/public-domain/tz/dist/factory delete mode 100644 external/public-domain/tz/dist/iso3166.tab delete mode 100644 external/public-domain/tz/dist/leap-seconds.list delete mode 100644 external/public-domain/tz/dist/leapseconds delete mode 100644 external/public-domain/tz/dist/leapseconds.awk delete mode 100644 external/public-domain/tz/dist/northamerica delete mode 100644 external/public-domain/tz/dist/pacificnew delete mode 100644 external/public-domain/tz/dist/southamerica delete mode 100644 external/public-domain/tz/dist/systemv delete mode 100644 external/public-domain/tz/dist/yearistype.sh delete mode 100644 external/public-domain/tz/dist/zone.tab delete mode 100644 external/public-domain/tz/dist/zone1970.tab delete mode 100755 external/public-domain/tz/dist/zoneinfo2tdf.pl delete mode 100644 external/public-domain/tz/share/Makefile delete mode 100644 external/public-domain/tz/share/zoneinfo/Makefile delete mode 100644 external/public-domain/xz/Makefile delete mode 100644 external/public-domain/xz/Makefile.inc delete mode 100644 external/public-domain/xz/bin/Makefile delete mode 100644 external/public-domain/xz/bin/Makefile.inc delete mode 100644 external/public-domain/xz/bin/lzmainfo/Makefile delete mode 100644 external/public-domain/xz/bin/xz/Makefile delete mode 100644 external/public-domain/xz/dist/AUTHORS delete mode 100644 external/public-domain/xz/dist/COPYING delete mode 100644 external/public-domain/xz/dist/ChangeLog delete mode 100644 external/public-domain/xz/dist/INSTALL delete mode 100644 external/public-domain/xz/dist/NEWS delete mode 100644 external/public-domain/xz/dist/PACKAGERS delete mode 100644 external/public-domain/xz/dist/README delete mode 100644 external/public-domain/xz/dist/THANKS delete mode 100644 external/public-domain/xz/dist/TODO delete mode 100644 external/public-domain/xz/dist/config.h.in delete mode 100644 external/public-domain/xz/dist/configure.ac delete mode 100644 external/public-domain/xz/dist/doc/examples/00_README.txt delete mode 100644 external/public-domain/xz/dist/doc/examples/01_compress_easy.c delete mode 100644 external/public-domain/xz/dist/doc/examples/02_decompress.c delete mode 100644 external/public-domain/xz/dist/doc/examples/03_compress_custom.c delete mode 100644 external/public-domain/xz/dist/doc/examples/04_compress_easy_mt.c delete mode 100644 external/public-domain/xz/dist/doc/examples_old/xz_pipe_comp.c delete mode 100644 external/public-domain/xz/dist/doc/examples_old/xz_pipe_decomp.c delete mode 100644 external/public-domain/xz/dist/doc/faq.txt delete mode 100644 external/public-domain/xz/dist/doc/history.txt delete mode 100644 external/public-domain/xz/dist/doc/lzma-file-format.txt delete mode 100644 external/public-domain/xz/dist/doc/xz-file-format.txt delete mode 100644 external/public-domain/xz/dist/m4/tuklib_common.m4 delete mode 100644 external/public-domain/xz/dist/m4/tuklib_cpucores.m4 delete mode 100644 external/public-domain/xz/dist/m4/tuklib_integer.m4 delete mode 100644 external/public-domain/xz/dist/m4/tuklib_mbstr.m4 delete mode 100644 external/public-domain/xz/dist/m4/tuklib_physmem.m4 delete mode 100644 external/public-domain/xz/dist/m4/tuklib_progname.m4 delete mode 100755 external/public-domain/xz/dist/macosx/build.sh delete mode 100644 external/public-domain/xz/dist/po/cs.gmo delete mode 100644 external/public-domain/xz/dist/po/cs.po delete mode 100644 external/public-domain/xz/dist/po/de.gmo delete mode 100644 external/public-domain/xz/dist/po/de.po delete mode 100644 external/public-domain/xz/dist/po/fr.gmo delete mode 100644 external/public-domain/xz/dist/po/fr.po delete mode 100644 external/public-domain/xz/dist/po/it.gmo delete mode 100644 external/public-domain/xz/dist/po/it.po delete mode 100644 external/public-domain/xz/dist/po/pl.gmo delete mode 100644 external/public-domain/xz/dist/po/pl.po delete mode 100644 external/public-domain/xz/dist/po/vi.gmo delete mode 100644 external/public-domain/xz/dist/po/vi.po delete mode 100644 external/public-domain/xz/dist/src/common/common_w32res.rc delete mode 100644 external/public-domain/xz/dist/src/common/mythread.h delete mode 100644 external/public-domain/xz/dist/src/common/sysdefs.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_common.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_config.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_cpucores.c delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_cpucores.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_exit.c delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_exit.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_gettext.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_integer.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_mbstr.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_mbstr_fw.c delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_mbstr_width.c delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_open_stdxxx.c delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_open_stdxxx.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_physmem.c delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_physmem.h delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_progname.c delete mode 100644 external/public-domain/xz/dist/src/common/tuklib_progname.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/base.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/bcj.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/block.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/check.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/container.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/delta.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/filter.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/hardware.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/index.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/index_hash.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/lzma12.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/stream_flags.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/version.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/api/lzma/vli.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/check.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/check.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc32_fast.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc32_small.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc32_table.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc32_table_be.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc32_table_le.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc32_tablegen.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc32_x86.S delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc64_fast.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc64_small.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc64_table.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc64_table_be.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc64_table_le.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc64_tablegen.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc64_x86.S delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/crc_macros.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/check/sha256.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/alone_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/alone_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/alone_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/auto_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_buffer_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_buffer_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_buffer_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_header_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_header_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/block_util.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/common.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/common.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/easy_buffer_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/easy_decoder_memusage.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/easy_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/easy_encoder_memusage.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/easy_preset.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/easy_preset.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_buffer_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_buffer_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_common.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_common.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_flags_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/filter_flags_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/hardware_cputhreads.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/hardware_physmem.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/index.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/index.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/index_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/index_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/index_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/index_hash.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/memcmplen.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/outqueue.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/outqueue.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_buffer_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_buffer_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_encoder_mt.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_flags_common.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_flags_common.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_flags_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/stream_flags_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/vli_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/vli_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/common/vli_size.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/delta/delta_common.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/delta/delta_common.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/delta/delta_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/delta/delta_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/delta/delta_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/delta/delta_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/delta/delta_private.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/liblzma.map delete mode 100644 external/public-domain/xz/dist/src/liblzma/liblzma.pc.in delete mode 100644 external/public-domain/xz/dist/src/liblzma/liblzma_w32res.rc delete mode 100644 external/public-domain/xz/dist/src/liblzma/lz/lz_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lz/lz_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lz/lz_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lz/lz_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_hash.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_hash_table.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_mf.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/fastpos.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/fastpos_table.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/fastpos_tablegen.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma2_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma2_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma2_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma2_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_common.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_optimum_fast.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_optimum_normal.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_presets.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_private.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/rangecoder/price.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/rangecoder/price_table.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/rangecoder/price_tablegen.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/rangecoder/range_common.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/rangecoder/range_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/rangecoder/range_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/arm.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/armthumb.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/ia64.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/powerpc.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/simple_coder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/simple_coder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/simple_decoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/simple_decoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/simple_encoder.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/simple_encoder.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/simple_private.h delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/sparc.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/simple/x86.c delete mode 100644 external/public-domain/xz/dist/src/liblzma/validate_map.sh delete mode 100644 external/public-domain/xz/dist/src/lzmainfo/lzmainfo.1 delete mode 100644 external/public-domain/xz/dist/src/lzmainfo/lzmainfo.c delete mode 100644 external/public-domain/xz/dist/src/lzmainfo/lzmainfo_w32res.rc delete mode 100644 external/public-domain/xz/dist/src/xz/args.c delete mode 100644 external/public-domain/xz/dist/src/xz/args.h delete mode 100644 external/public-domain/xz/dist/src/xz/coder.c delete mode 100644 external/public-domain/xz/dist/src/xz/coder.h delete mode 100644 external/public-domain/xz/dist/src/xz/file_io.c delete mode 100644 external/public-domain/xz/dist/src/xz/file_io.h delete mode 100644 external/public-domain/xz/dist/src/xz/hardware.c delete mode 100644 external/public-domain/xz/dist/src/xz/hardware.h delete mode 100644 external/public-domain/xz/dist/src/xz/list.c delete mode 100644 external/public-domain/xz/dist/src/xz/list.h delete mode 100644 external/public-domain/xz/dist/src/xz/main.c delete mode 100644 external/public-domain/xz/dist/src/xz/main.h delete mode 100644 external/public-domain/xz/dist/src/xz/message.c delete mode 100644 external/public-domain/xz/dist/src/xz/message.h delete mode 100644 external/public-domain/xz/dist/src/xz/mytime.c delete mode 100644 external/public-domain/xz/dist/src/xz/mytime.h delete mode 100644 external/public-domain/xz/dist/src/xz/options.c delete mode 100644 external/public-domain/xz/dist/src/xz/options.h delete mode 100644 external/public-domain/xz/dist/src/xz/private.h delete mode 100644 external/public-domain/xz/dist/src/xz/signals.c delete mode 100644 external/public-domain/xz/dist/src/xz/signals.h delete mode 100644 external/public-domain/xz/dist/src/xz/suffix.c delete mode 100644 external/public-domain/xz/dist/src/xz/suffix.h delete mode 100644 external/public-domain/xz/dist/src/xz/util.c delete mode 100644 external/public-domain/xz/dist/src/xz/util.h delete mode 100644 external/public-domain/xz/dist/src/xz/xz.1 delete mode 100644 external/public-domain/xz/dist/src/xz/xz_w32res.rc delete mode 100644 external/public-domain/xz/dist/src/xzdec/lzmadec_w32res.rc delete mode 100644 external/public-domain/xz/dist/src/xzdec/xzdec.1 delete mode 100644 external/public-domain/xz/dist/src/xzdec/xzdec.c delete mode 100644 external/public-domain/xz/dist/src/xzdec/xzdec_w32res.rc delete mode 100644 external/public-domain/xz/dist/tests/bcj_test.c delete mode 100644 external/public-domain/xz/dist/tests/compress_prepared_bcj_sparc.base64 delete mode 100644 external/public-domain/xz/dist/tests/compress_prepared_bcj_x86.base64 delete mode 100644 external/public-domain/xz/dist/tests/create_compress_files.c delete mode 100644 external/public-domain/xz/dist/tests/files/README delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0-backward_size.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0-empty-truncated.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0-footer_magic.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0-header_magic.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0-nonempty_index.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0cat-alone.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0cat-header_magic.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0catpad-empty.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-0pad-empty.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-block_header-1.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-block_header-2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-block_header-3.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-block_header-4.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-block_header-5.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-block_header-6.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-check-crc32.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-check-crc64.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-check-sha256.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-lzma2-1.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-lzma2-2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-lzma2-3.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-lzma2-4.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-lzma2-5.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-lzma2-6.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-lzma2-7.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-lzma2-8.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-stream_flags-1.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-stream_flags-2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-stream_flags-3.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-vli-1.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-1-vli-2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-2-compressed_data_padding.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-2-index-1.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-2-index-2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-2-index-3.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-2-index-4.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/bad-2-index-5.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-0-empty.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-0cat-empty.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-0catpad-empty.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-0pad-empty.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-3delta-lzma2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-block_header-1.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-block_header-2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-block_header-3.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-check-crc32.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-check-crc64.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-check-none.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-check-sha256.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-delta-lzma2.tiff.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-lzma2-1.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-lzma2-2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-lzma2-3.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-lzma2-4.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-lzma2-5.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-sparc-lzma2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-1-x86-lzma2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/good-2-lzma2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/unsupported-block_header.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/unsupported-check.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/unsupported-filter_flags-1.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/unsupported-filter_flags-2.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/files/unsupported-filter_flags-3.xz.base64 delete mode 100644 external/public-domain/xz/dist/tests/test_bcj_exact_size.c delete mode 100644 external/public-domain/xz/dist/tests/test_block_header.c delete mode 100644 external/public-domain/xz/dist/tests/test_check.c delete mode 100755 external/public-domain/xz/dist/tests/test_compress.sh delete mode 100755 external/public-domain/xz/dist/tests/test_files.sh delete mode 100644 external/public-domain/xz/dist/tests/test_filter_flags.c delete mode 100644 external/public-domain/xz/dist/tests/test_index.c delete mode 100755 external/public-domain/xz/dist/tests/test_scripts.sh delete mode 100644 external/public-domain/xz/dist/tests/test_stream_flags.c delete mode 100644 external/public-domain/xz/dist/tests/tests.h delete mode 100644 external/public-domain/xz/dist/tests/xzgrep_expected_output delete mode 100644 external/public-domain/xz/include/config.h delete mode 100644 external/public-domain/xz/lib/Makefile delete mode 100644 external/public-domain/xz/lib/shlib_version delete mode 100644 external/public-domain/xz/prepare-import.sh delete mode 100644 include/rpc/rpcb_prot.x delete mode 100644 include/tgmath.h delete mode 100644 libexec/Makefile delete mode 100644 libexec/Makefile.inc delete mode 100644 libexec/fingerd/Makefile delete mode 100644 libexec/fingerd/fingerd.8 delete mode 100644 libexec/fingerd/fingerd.c delete mode 100644 libexec/fingerd/pathnames.h delete mode 100644 libexec/ftpd/Makefile delete mode 100644 libexec/ftpd/cmds.c delete mode 100644 libexec/ftpd/conf.c delete mode 100644 libexec/ftpd/extern.h delete mode 100644 libexec/ftpd/ftpcmd.y delete mode 100644 libexec/ftpd/ftpd.8 delete mode 100644 libexec/ftpd/ftpd.c delete mode 100644 libexec/ftpd/ftpd.conf.5 delete mode 100644 libexec/ftpd/ftpusers.5 delete mode 100644 libexec/ftpd/logutmp.c delete mode 100644 libexec/ftpd/logwtmp.c delete mode 100644 libexec/ftpd/pathnames.h delete mode 100644 libexec/ftpd/pfilter.c delete mode 100644 libexec/ftpd/pfilter.h delete mode 100644 libexec/ftpd/popen.c delete mode 100644 libexec/ftpd/version.h delete mode 100644 libexec/getty/Makefile delete mode 100644 libexec/getty/extern.h delete mode 100644 libexec/getty/getty.8 delete mode 100644 libexec/getty/gettytab.5 delete mode 100644 libexec/getty/gettytab.h delete mode 100644 libexec/getty/init.c delete mode 100644 libexec/getty/main.c delete mode 100644 libexec/getty/pathnames.h delete mode 100644 libexec/getty/subr.c delete mode 100644 libexec/getty/ttys.5 delete mode 100644 libexec/httpd/Makefile.boot delete mode 100644 libexec/httpd/auth-bozo.c delete mode 100644 libexec/httpd/bozohttpd.c delete mode 100644 libexec/httpd/cgi-bozo.c delete mode 100644 libexec/httpd/content-bozo.c delete mode 100644 libexec/httpd/daemon-bozo.c delete mode 100644 libexec/httpd/debug/Makefile delete mode 100644 libexec/httpd/dir-index-bozo.c delete mode 100644 libexec/httpd/libbozohttpd/Makefile delete mode 100644 libexec/httpd/libbozohttpd/libbozohttpd.3 delete mode 100644 libexec/httpd/libbozohttpd/shlib_version delete mode 100644 libexec/httpd/lua-bozo.c delete mode 100644 libexec/httpd/lua/Makefile delete mode 100644 libexec/httpd/lua/optparse.lua delete mode 100644 libexec/httpd/lua/shlib_version delete mode 100644 libexec/httpd/main.c delete mode 100644 libexec/httpd/printenv.lua delete mode 100644 libexec/httpd/small/Makefile delete mode 100644 libexec/httpd/ssl-bozo.c delete mode 100644 libexec/httpd/testsuite/Makefile delete mode 100644 libexec/httpd/testsuite/data/bigfile delete mode 100644 libexec/httpd/testsuite/data/bigfile.partial4000 delete mode 100644 libexec/httpd/testsuite/data/bigfile.partial8000 delete mode 100644 libexec/httpd/testsuite/data/file delete mode 100644 libexec/httpd/testsuite/data/index.html delete mode 100755 libexec/httpd/testsuite/html_cmp delete mode 100644 libexec/httpd/testsuite/t1.in delete mode 100644 libexec/httpd/testsuite/t1.out delete mode 100644 libexec/httpd/testsuite/t10.in delete mode 100644 libexec/httpd/testsuite/t10.out delete mode 100644 libexec/httpd/testsuite/t2.in delete mode 100644 libexec/httpd/testsuite/t2.out delete mode 100644 libexec/httpd/testsuite/t3.in delete mode 100644 libexec/httpd/testsuite/t3.out delete mode 100644 libexec/httpd/testsuite/t4.in delete mode 100644 libexec/httpd/testsuite/t4.out delete mode 100644 libexec/httpd/testsuite/t5.in delete mode 100644 libexec/httpd/testsuite/t5.out delete mode 100644 libexec/httpd/testsuite/t6.in delete mode 100644 libexec/httpd/testsuite/t6.out delete mode 100644 libexec/httpd/testsuite/t7.in delete mode 100644 libexec/httpd/testsuite/t7.out delete mode 100644 libexec/httpd/testsuite/t8.in delete mode 100644 libexec/httpd/testsuite/t8.out delete mode 100644 libexec/httpd/testsuite/t9.in delete mode 100644 libexec/httpd/testsuite/t9.out delete mode 100755 libexec/httpd/testsuite/test-bigfile delete mode 100644 libexec/httpd/tilde-luzah-bozo.c delete mode 100644 libexec/makewhatis/Makefile delete mode 100644 libexec/makewhatis/makewhatis.8 delete mode 100644 libexec/makewhatis/makewhatis.c delete mode 100644 libexec/rshd/Makefile delete mode 100644 libexec/rshd/rshd.8 delete mode 100644 libexec/rshd/rshd.c diff --git a/common/dist/zlib/ChangeLog b/common/dist/zlib/ChangeLog deleted file mode 100644 index 2b7cf3a73..000000000 --- a/common/dist/zlib/ChangeLog +++ /dev/null @@ -1,855 +0,0 @@ - - ChangeLog file for zlib - -Changes in 1.2.3 (18 July 2005) -- Apply security vulnerability fixes to contrib/infback9 as well -- Clean up some text files (carriage returns, trailing space) -- Update testzlib, vstudio, masmx64, and masmx86 in contrib [Vollant] - -Changes in 1.2.2.4 (11 July 2005) -- Add inflatePrime() function for starting inflation at bit boundary -- Avoid some Visual C warnings in deflate.c -- Avoid more silly Visual C warnings in inflate.c and inftrees.c for 64-bit - compile -- Fix some spelling errors in comments [Betts] -- Correct inflateInit2() error return documentation in zlib.h -- Added zran.c example of compressed data random access to examples - directory, shows use of inflatePrime() -- Fix cast for assignments to strm->state in inflate.c and infback.c -- Fix zlibCompileFlags() in zutil.c to use 1L for long shifts [Oberhumer] -- Move declarations of gf2 functions to right place in crc32.c [Oberhumer] -- Add cast in trees.c t avoid a warning [Oberhumer] -- Avoid some warnings in fitblk.c, gun.c, gzjoin.c in examples [Oberhumer] -- Update make_vms.com [Zinser] -- Initialize state->write in inflateReset() since copied in inflate_fast() -- Be more strict on incomplete code sets in inflate_table() and increase - ENOUGH and MAXD -- this repairs a possible security vulnerability for - invalid inflate input. Thanks to Tavis Ormandy and Markus Oberhumer for - discovering the vulnerability and providing test cases. -- Add ia64 support to configure for HP-UX [Smith] -- Add error return to gzread() for format or i/o error [Levin] -- Use malloc.h for OS/2 [Necasek] - -Changes in 1.2.2.3 (27 May 2005) -- Replace 1U constants in inflate.c and inftrees.c for 64-bit compile -- Typecast fread() return values in gzio.c [Vollant] -- Remove trailing space in minigzip.c outmode (VC++ can't deal with it) -- Fix crc check bug in gzread() after gzungetc() [Heiner] -- Add the deflateTune() function to adjust internal compression parameters -- Add a fast gzip decompressor, gun.c, to examples (use of inflateBack) -- Remove an incorrect assertion in examples/zpipe.c -- Add C++ wrapper in infback9.h [Donais] -- Fix bug in inflateCopy() when decoding fixed codes -- Note in zlib.h how much deflateSetDictionary() actually uses -- Remove USE_DICT_HEAD in deflate.c (would mess up inflate if used) -- Add _WIN32_WCE to define WIN32 in zconf.in.h [Spencer] -- Don't include stderr.h or errno.h for _WIN32_WCE in zutil.h [Spencer] -- Add gzdirect() function to indicate transparent reads -- Update contrib/minizip [Vollant] -- Fix compilation of deflate.c when both ASMV and FASTEST [Oberhumer] -- Add casts in crc32.c to avoid warnings [Oberhumer] -- Add contrib/masmx64 [Vollant] -- Update contrib/asm586, asm686, masmx86, testzlib, vstudio [Vollant] - -Changes in 1.2.2.2 (30 December 2004) -- Replace structure assignments in deflate.c and inflate.c with zmemcpy to - avoid implicit memcpy calls (portability for no-library compilation) -- Increase sprintf() buffer size in gzdopen() to allow for large numbers -- Add INFLATE_STRICT to check distances against zlib header -- Improve WinCE errno handling and comments [Chang] -- Remove comment about no gzip header processing in FAQ -- Add Z_FIXED strategy option to deflateInit2() to force fixed trees -- Add updated make_vms.com [Coghlan], update README -- Create a new "examples" directory, move gzappend.c there, add zpipe.c, - fitblk.c, gzlog.[ch], gzjoin.c, and zlib_how.html. -- Add FAQ entry and comments in deflate.c on uninitialized memory access -- Add Solaris 9 make options in configure [Gilbert] -- Allow strerror() usage in gzio.c for STDC -- Fix DecompressBuf in contrib/delphi/ZLib.pas [ManChesTer] -- Update contrib/masmx86/inffas32.asm and gvmat32.asm [Vollant] -- Use z_off_t for adler32_combine() and crc32_combine() lengths -- Make adler32() much faster for small len -- Use OS_CODE in deflate() default gzip header - -Changes in 1.2.2.1 (31 October 2004) -- Allow inflateSetDictionary() call for raw inflate -- Fix inflate header crc check bug for file names and comments -- Add deflateSetHeader() and gz_header structure for custom gzip headers -- Add inflateGetheader() to retrieve gzip headers -- Add crc32_combine() and adler32_combine() functions -- Add alloc_func, free_func, in_func, out_func to Z_PREFIX list -- Use zstreamp consistently in zlib.h (inflate_back functions) -- Remove GUNZIP condition from definition of inflate_mode in inflate.h - and in contrib/inflate86/inffast.S [Truta, Anderson] -- Add support for AMD64 in contrib/inflate86/inffas86.c [Anderson] -- Update projects/README.projects and projects/visualc6 [Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Avoid warning under NO_GZCOMPRESS in gzio.c; fix typo [Truta] -- Deprecate Z_ASCII; use Z_TEXT instead [Truta] -- Use a new algorithm for setting strm->data_type in trees.c [Truta] -- Do not define an exit() prototype in zutil.c unless DEBUG defined -- Remove prototype of exit() from zutil.c, example.c, minigzip.c [Truta] -- Add comment in zlib.h for Z_NO_FLUSH parameter to deflate() -- Fix Darwin build version identification [Peterson] - -Changes in 1.2.2 (3 October 2004) -- Update zlib.h comments on gzip in-memory processing -- Set adler to 1 in inflateReset() to support Java test suite [Walles] -- Add contrib/dotzlib [Ravn] -- Update win32/DLL_FAQ.txt [Truta] -- Update contrib/minizip [Vollant] -- Move contrib/visual-basic.txt to old/ [Truta] -- Fix assembler builds in projects/visualc6/ [Truta] - -Changes in 1.2.1.2 (9 September 2004) -- Update INDEX file -- Fix trees.c to update strm->data_type (no one ever noticed!) -- Fix bug in error case in inflate.c, infback.c, and infback9.c [Brown] -- Add "volatile" to crc table flag declaration (for DYNAMIC_CRC_TABLE) -- Add limited multitasking protection to DYNAMIC_CRC_TABLE -- Add NO_vsnprintf for VMS in zutil.h [Mozilla] -- Don't declare strerror() under VMS [Mozilla] -- Add comment to DYNAMIC_CRC_TABLE to use get_crc_table() to initialize -- Update contrib/ada [Anisimkov] -- Update contrib/minizip [Vollant] -- Fix configure to not hardcode directories for Darwin [Peterson] -- Fix gzio.c to not return error on empty files [Brown] -- Fix indentation; update version in contrib/delphi/ZLib.pas and - contrib/pascal/zlibpas.pas [Truta] -- Update mkasm.bat in contrib/masmx86 [Truta] -- Update contrib/untgz [Truta] -- Add projects/README.projects [Truta] -- Add project for MS Visual C++ 6.0 in projects/visualc6 [Cadieux, Truta] -- Update win32/DLL_FAQ.txt [Truta] -- Update list of Z_PREFIX symbols in zconf.h [Randers-Pehrson, Truta] -- Remove an unnecessary assignment to curr in inftrees.c [Truta] -- Add OS/2 to exe builds in configure [Poltorak] -- Remove err dummy parameter in zlib.h [Kientzle] - -Changes in 1.2.1.1 (9 January 2004) -- Update email address in README -- Several FAQ updates -- Fix a big fat bug in inftrees.c that prevented decoding valid - dynamic blocks with only literals and no distance codes -- - Thanks to "Hot Emu" for the bug report and sample file -- Add a note to puff.c on no distance codes case. - -Changes in 1.2.1 (17 November 2003) -- Remove a tab in contrib/gzappend/gzappend.c -- Update some interfaces in contrib for new zlib functions -- Update zlib version number in some contrib entries -- Add Windows CE definition for ptrdiff_t in zutil.h [Mai, Truta] -- Support shared libraries on Hurd and KFreeBSD [Brown] -- Fix error in NO_DIVIDE option of adler32.c - -Changes in 1.2.0.8 (4 November 2003) -- Update version in contrib/delphi/ZLib.pas and contrib/pascal/zlibpas.pas -- Add experimental NO_DIVIDE #define in adler32.c - - Possibly faster on some processors (let me know if it is) -- Correct Z_BLOCK to not return on first inflate call if no wrap -- Fix strm->data_type on inflate() return to correctly indicate EOB -- Add deflatePrime() function for appending in the middle of a byte -- Add contrib/gzappend for an example of appending to a stream -- Update win32/DLL_FAQ.txt [Truta] -- Delete Turbo C comment in README [Truta] -- Improve some indentation in zconf.h [Truta] -- Fix infinite loop on bad input in configure script [Church] -- Fix gzeof() for concatenated gzip files [Johnson] -- Add example to contrib/visual-basic.txt [Michael B.] -- Add -p to mkdir's in Makefile.in [vda] -- Fix configure to properly detect presence or lack of printf functions -- Add AS400 support [Monnerat] -- Add a little Cygwin support [Wilson] - -Changes in 1.2.0.7 (21 September 2003) -- Correct some debug formats in contrib/infback9 -- Cast a type in a debug statement in trees.c -- Change search and replace delimiter in configure from % to # [Beebe] -- Update contrib/untgz to 0.2 with various fixes [Truta] -- Add build support for Amiga [Nikl] -- Remove some directories in old that have been updated to 1.2 -- Add dylib building for Mac OS X in configure and Makefile.in -- Remove old distribution stuff from Makefile -- Update README to point to DLL_FAQ.txt, and add comment on Mac OS X -- Update links in README - -Changes in 1.2.0.6 (13 September 2003) -- Minor FAQ updates -- Update contrib/minizip to 1.00 [Vollant] -- Remove test of gz functions in example.c when GZ_COMPRESS defined [Truta] -- Update POSTINC comment for 68060 [Nikl] -- Add contrib/infback9 with deflate64 decoding (unsupported) -- For MVS define NO_vsnprintf and undefine FAR [van Burik] -- Add pragma for fdopen on MVS [van Burik] - -Changes in 1.2.0.5 (8 September 2003) -- Add OF to inflateBackEnd() declaration in zlib.h -- Remember start when using gzdopen in the middle of a file -- Use internal off_t counters in gz* functions to properly handle seeks -- Perform more rigorous check for distance-too-far in inffast.c -- Add Z_BLOCK flush option to return from inflate at block boundary -- Set strm->data_type on return from inflate - - Indicate bits unused, if at block boundary, and if in last block -- Replace size_t with ptrdiff_t in crc32.c, and check for correct size -- Add condition so old NO_DEFLATE define still works for compatibility -- FAQ update regarding the Windows DLL [Truta] -- INDEX update: add qnx entry, remove aix entry [Truta] -- Install zlib.3 into mandir [Wilson] -- Move contrib/zlib_dll_FAQ.txt to win32/DLL_FAQ.txt; update [Truta] -- Adapt the zlib interface to the new DLL convention guidelines [Truta] -- Introduce ZLIB_WINAPI macro to allow the export of functions using - the WINAPI calling convention, for Visual Basic [Vollant, Truta] -- Update msdos and win32 scripts and makefiles [Truta] -- Export symbols by name, not by ordinal, in win32/zlib.def [Truta] -- Add contrib/ada [Anisimkov] -- Move asm files from contrib/vstudio/vc70_32 to contrib/asm386 [Truta] -- Rename contrib/asm386 to contrib/masmx86 [Truta, Vollant] -- Add contrib/masm686 [Truta] -- Fix offsets in contrib/inflate86 and contrib/masmx86/inffas32.asm - [Truta, Vollant] -- Update contrib/delphi; rename to contrib/pascal; add example [Truta] -- Remove contrib/delphi2; add a new contrib/delphi [Truta] -- Avoid inclusion of the nonstandard in contrib/iostream, - and fix some method prototypes [Truta] -- Fix the ZCR_SEED2 constant to avoid warnings in contrib/minizip - [Truta] -- Avoid the use of backslash (\) in contrib/minizip [Vollant] -- Fix file time handling in contrib/untgz; update makefiles [Truta] -- Update contrib/vstudio/vc70_32 to comply with the new DLL guidelines - [Vollant] -- Remove contrib/vstudio/vc15_16 [Vollant] -- Rename contrib/vstudio/vc70_32 to contrib/vstudio/vc7 [Truta] -- Update README.contrib [Truta] -- Invert the assignment order of match_head and s->prev[...] in - INSERT_STRING [Truta] -- Compare TOO_FAR with 32767 instead of 32768, to avoid 16-bit warnings - [Truta] -- Compare function pointers with 0, not with NULL or Z_NULL [Truta] -- Fix prototype of syncsearch in inflate.c [Truta] -- Introduce ASMINF macro to be enabled when using an ASM implementation - of inflate_fast [Truta] -- Change NO_DEFLATE to NO_GZCOMPRESS [Truta] -- Modify test_gzio in example.c to take a single file name as a - parameter [Truta] -- Exit the example.c program if gzopen fails [Truta] -- Add type casts around strlen in example.c [Truta] -- Remove casting to sizeof in minigzip.c; give a proper type - to the variable compared with SUFFIX_LEN [Truta] -- Update definitions of STDC and STDC99 in zconf.h [Truta] -- Synchronize zconf.h with the new Windows DLL interface [Truta] -- Use SYS16BIT instead of __32BIT__ to distinguish between - 16- and 32-bit platforms [Truta] -- Use far memory allocators in small 16-bit memory models for - Turbo C [Truta] -- Add info about the use of ASMV, ASMINF and ZLIB_WINAPI in - zlibCompileFlags [Truta] -- Cygwin has vsnprintf [Wilson] -- In Windows16, OS_CODE is 0, as in MSDOS [Truta] -- In Cygwin, OS_CODE is 3 (Unix), not 11 (Windows32) [Wilson] - -Changes in 1.2.0.4 (10 August 2003) -- Minor FAQ updates -- Be more strict when checking inflateInit2's windowBits parameter -- Change NO_GUNZIP compile option to NO_GZIP to cover deflate as well -- Add gzip wrapper option to deflateInit2 using windowBits -- Add updated QNX rule in configure and qnx directory [Bonnefoy] -- Make inflate distance-too-far checks more rigorous -- Clean up FAR usage in inflate -- Add casting to sizeof() in gzio.c and minigzip.c - -Changes in 1.2.0.3 (19 July 2003) -- Fix silly error in gzungetc() implementation [Vollant] -- Update contrib/minizip and contrib/vstudio [Vollant] -- Fix printf format in example.c -- Correct cdecl support in zconf.in.h [Anisimkov] -- Minor FAQ updates - -Changes in 1.2.0.2 (13 July 2003) -- Add ZLIB_VERNUM in zlib.h for numerical preprocessor comparisons -- Attempt to avoid warnings in crc32.c for pointer-int conversion -- Add AIX to configure, remove aix directory [Bakker] -- Add some casts to minigzip.c -- Improve checking after insecure sprintf() or vsprintf() calls -- Remove #elif's from crc32.c -- Change leave label to inf_leave in inflate.c and infback.c to avoid - library conflicts -- Remove inflate gzip decoding by default--only enable gzip decoding by - special request for stricter backward compatibility -- Add zlibCompileFlags() function to return compilation information -- More typecasting in deflate.c to avoid warnings -- Remove leading underscore from _Capital #defines [Truta] -- Fix configure to link shared library when testing -- Add some Windows CE target adjustments [Mai] -- Remove #define ZLIB_DLL in zconf.h [Vollant] -- Add zlib.3 [Rodgers] -- Update RFC URL in deflate.c and algorithm.txt [Mai] -- Add zlib_dll_FAQ.txt to contrib [Truta] -- Add UL to some constants [Truta] -- Update minizip and vstudio [Vollant] -- Remove vestigial NEED_DUMMY_RETURN from zconf.in.h -- Expand use of NO_DUMMY_DECL to avoid all dummy structures -- Added iostream3 to contrib [Schwardt] -- Replace rewind() with fseek() for WinCE [Truta] -- Improve setting of zlib format compression level flags - - Report 0 for huffman and rle strategies and for level == 0 or 1 - - Report 2 only for level == 6 -- Only deal with 64K limit when necessary at compile time [Truta] -- Allow TOO_FAR check to be turned off at compile time [Truta] -- Add gzclearerr() function [Souza] -- Add gzungetc() function - -Changes in 1.2.0.1 (17 March 2003) -- Add Z_RLE strategy for run-length encoding [Truta] - - When Z_RLE requested, restrict matches to distance one - - Update zlib.h, minigzip.c, gzopen(), gzdopen() for Z_RLE -- Correct FASTEST compilation to allow level == 0 -- Clean up what gets compiled for FASTEST -- Incorporate changes to zconf.in.h [Vollant] - - Refine detection of Turbo C need for dummy returns - - Refine ZLIB_DLL compilation - - Include additional header file on VMS for off_t typedef -- Try to use _vsnprintf where it supplants vsprintf [Vollant] -- Add some casts in inffast.c -- Enchance comments in zlib.h on what happens if gzprintf() tries to - write more than 4095 bytes before compression -- Remove unused state from inflateBackEnd() -- Remove exit(0) from minigzip.c, example.c -- Get rid of all those darn tabs -- Add "check" target to Makefile.in that does the same thing as "test" -- Add "mostlyclean" and "maintainer-clean" targets to Makefile.in -- Update contrib/inflate86 [Anderson] -- Update contrib/testzlib, contrib/vstudio, contrib/minizip [Vollant] -- Add msdos and win32 directories with makefiles [Truta] -- More additions and improvements to the FAQ - -Changes in 1.2.0 (9 March 2003) -- New and improved inflate code - - About 20% faster - - Does not allocate 32K window unless and until needed - - Automatically detects and decompresses gzip streams - - Raw inflate no longer needs an extra dummy byte at end - - Added inflateBack functions using a callback interface--even faster - than inflate, useful for file utilities (gzip, zip) - - Added inflateCopy() function to record state for random access on - externally generated deflate streams (e.g. in gzip files) - - More readable code (I hope) -- New and improved crc32() - - About 50% faster, thanks to suggestions from Rodney Brown -- Add deflateBound() and compressBound() functions -- Fix memory leak in deflateInit2() -- Permit setting dictionary for raw deflate (for parallel deflate) -- Fix const declaration for gzwrite() -- Check for some malloc() failures in gzio.c -- Fix bug in gzopen() on single-byte file 0x1f -- Fix bug in gzread() on concatenated file with 0x1f at end of buffer - and next buffer doesn't start with 0x8b -- Fix uncompress() to return Z_DATA_ERROR on truncated input -- Free memory at end of example.c -- Remove MAX #define in trees.c (conflicted with some libraries) -- Fix static const's in deflate.c, gzio.c, and zutil.[ch] -- Declare malloc() and free() in gzio.c if STDC not defined -- Use malloc() instead of calloc() in zutil.c if int big enough -- Define STDC for AIX -- Add aix/ with approach for compiling shared library on AIX -- Add HP-UX support for shared libraries in configure -- Add OpenUNIX support for shared libraries in configure -- Use $cc instead of gcc to build shared library -- Make prefix directory if needed when installing -- Correct Macintosh avoidance of typedef Byte in zconf.h -- Correct Turbo C memory allocation when under Linux -- Use libz.a instead of -lz in Makefile (assure use of compiled library) -- Update configure to check for snprintf or vsnprintf functions and their - return value, warn during make if using an insecure function -- Fix configure problem with compile-time knowledge of HAVE_UNISTD_H that - is lost when library is used--resolution is to build new zconf.h -- Documentation improvements (in zlib.h): - - Document raw deflate and inflate - - Update RFCs URL - - Point out that zlib and gzip formats are different - - Note that Z_BUF_ERROR is not fatal - - Document string limit for gzprintf() and possible buffer overflow - - Note requirement on avail_out when flushing - - Note permitted values of flush parameter of inflate() -- Add some FAQs (and even answers) to the FAQ -- Add contrib/inflate86/ for x86 faster inflate -- Add contrib/blast/ for PKWare Data Compression Library decompression -- Add contrib/puff/ simple inflate for deflate format description - -Changes in 1.1.4 (11 March 2002) -- ZFREE was repeated on same allocation on some error conditions. - This creates a security problem described in - http://www.zlib.org/advisory-2002-03-11.txt -- Returned incorrect error (Z_MEM_ERROR) on some invalid data -- Avoid accesses before window for invalid distances with inflate window - less than 32K. -- force windowBits > 8 to avoid a bug in the encoder for a window size - of 256 bytes. (A complete fix will be available in 1.1.5). - -Changes in 1.1.3 (9 July 1998) -- fix "an inflate input buffer bug that shows up on rare but persistent - occasions" (Mark) -- fix gzread and gztell for concatenated .gz files (Didier Le Botlan) -- fix gzseek(..., SEEK_SET) in write mode -- fix crc check after a gzeek (Frank Faubert) -- fix miniunzip when the last entry in a zip file is itself a zip file - (J Lillge) -- add contrib/asm586 and contrib/asm686 (Brian Raiter) - See http://www.muppetlabs.com/~breadbox/software/assembly.html -- add support for Delphi 3 in contrib/delphi (Bob Dellaca) -- add support for C++Builder 3 and Delphi 3 in contrib/delphi2 (Davide Moretti) -- do not exit prematurely in untgz if 0 at start of block (Magnus Holmgren) -- use macro EXTERN instead of extern to support DLL for BeOS (Sander Stoks) -- added a FAQ file - -- Support gzdopen on Mac with Metrowerks (Jason Linhart) -- Do not redefine Byte on Mac (Brad Pettit & Jason Linhart) -- define SEEK_END too if SEEK_SET is not defined (Albert Chin-A-Young) -- avoid some warnings with Borland C (Tom Tanner) -- fix a problem in contrib/minizip/zip.c for 16-bit MSDOS (Gilles Vollant) -- emulate utime() for WIN32 in contrib/untgz (Gilles Vollant) -- allow several arguments to configure (Tim Mooney, Frodo Looijaard) -- use libdir and includedir in Makefile.in (Tim Mooney) -- support shared libraries on OSF1 V4 (Tim Mooney) -- remove so_locations in "make clean" (Tim Mooney) -- fix maketree.c compilation error (Glenn, Mark) -- Python interface to zlib now in Python 1.5 (Jeremy Hylton) -- new Makefile.riscos (Rich Walker) -- initialize static descriptors in trees.c for embedded targets (Nick Smith) -- use "foo-gz" in example.c for RISCOS and VMS (Nick Smith) -- add the OS/2 files in Makefile.in too (Andrew Zabolotny) -- fix fdopen and halloc macros for Microsoft C 6.0 (Tom Lane) -- fix maketree.c to allow clean compilation of inffixed.h (Mark) -- fix parameter check in deflateCopy (Gunther Nikl) -- cleanup trees.c, use compressed_len only in debug mode (Christian Spieler) -- Many portability patches by Christian Spieler: - . zutil.c, zutil.h: added "const" for zmem* - . Make_vms.com: fixed some typos - . Make_vms.com: msdos/Makefile.*: removed zutil.h from some dependency lists - . msdos/Makefile.msc: remove "default rtl link library" info from obj files - . msdos/Makefile.*: use model-dependent name for the built zlib library - . msdos/Makefile.emx, nt/Makefile.emx, nt/Makefile.gcc: - new makefiles, for emx (DOS/OS2), emx&rsxnt and mingw32 (Windows 9x / NT) -- use define instead of typedef for Bytef also for MSC small/medium (Tom Lane) -- replace __far with _far for better portability (Christian Spieler, Tom Lane) -- fix test for errno.h in configure (Tim Newsham) - -Changes in 1.1.2 (19 March 98) -- added contrib/minzip, mini zip and unzip based on zlib (Gilles Vollant) - See http://www.winimage.com/zLibDll/unzip.html -- preinitialize the inflate tables for fixed codes, to make the code - completely thread safe (Mark) -- some simplifications and slight speed-up to the inflate code (Mark) -- fix gzeof on non-compressed files (Allan Schrum) -- add -std1 option in configure for OSF1 to fix gzprintf (Martin Mokrejs) -- use default value of 4K for Z_BUFSIZE for 16-bit MSDOS (Tim Wegner + Glenn) -- added os2/Makefile.def and os2/zlib.def (Andrew Zabolotny) -- add shared lib support for UNIX_SV4.2MP (MATSUURA Takanori) -- do not wrap extern "C" around system includes (Tom Lane) -- mention zlib binding for TCL in README (Andreas Kupries) -- added amiga/Makefile.pup for Amiga powerUP SAS/C PPC (Andreas Kleinert) -- allow "make install prefix=..." even after configure (Glenn Randers-Pehrson) -- allow "configure --prefix $HOME" (Tim Mooney) -- remove warnings in example.c and gzio.c (Glenn Randers-Pehrson) -- move Makefile.sas to amiga/Makefile.sas - -Changes in 1.1.1 (27 Feb 98) -- fix macros _tr_tally_* in deflate.h for debug mode (Glenn Randers-Pehrson) -- remove block truncation heuristic which had very marginal effect for zlib - (smaller lit_bufsize than in gzip 1.2.4) and degraded a little the - compression ratio on some files. This also allows inlining _tr_tally for - matches in deflate_slow. -- added msdos/Makefile.w32 for WIN32 Microsoft Visual C++ (Bob Frazier) - -Changes in 1.1.0 (24 Feb 98) -- do not return STREAM_END prematurely in inflate (John Bowler) -- revert to the zlib 1.0.8 inflate to avoid the gcc 2.8.0 bug (Jeremy Buhler) -- compile with -DFASTEST to get compression code optimized for speed only -- in minigzip, try mmap'ing the input file first (Miguel Albrecht) -- increase size of I/O buffers in minigzip.c and gzio.c (not a big gain - on Sun but significant on HP) - -- add a pointer to experimental unzip library in README (Gilles Vollant) -- initialize variable gcc in configure (Chris Herborth) - -Changes in 1.0.9 (17 Feb 1998) -- added gzputs and gzgets functions -- do not clear eof flag in gzseek (Mark Diekhans) -- fix gzseek for files in transparent mode (Mark Diekhans) -- do not assume that vsprintf returns the number of bytes written (Jens Krinke) -- replace EXPORT with ZEXPORT to avoid conflict with other programs -- added compress2 in zconf.h, zlib.def, zlib.dnt -- new asm code from Gilles Vollant in contrib/asm386 -- simplify the inflate code (Mark): - . Replace ZALLOC's in huft_build() with single ZALLOC in inflate_blocks_new() - . ZALLOC the length list in inflate_trees_fixed() instead of using stack - . ZALLOC the value area for huft_build() instead of using stack - . Simplify Z_FINISH check in inflate() - -- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8 -- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi) -- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with - the declaration of FAR (Gilles VOllant) -- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann) -- read_buf buf parameter of type Bytef* instead of charf* -- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout) -- do not redeclare unlink in minigzip.c for WIN32 (John Bowler) -- fix check for presence of directories in "make install" (Ian Willis) - -Changes in 1.0.8 (27 Jan 1998) -- fixed offsets in contrib/asm386/gvmat32.asm (Gilles Vollant) -- fix gzgetc and gzputc for big endian systems (Markus Oberhumer) -- added compress2() to allow setting the compression level -- include sys/types.h to get off_t on some systems (Marc Lehmann & QingLong) -- use constant arrays for the static trees in trees.c instead of computing - them at run time (thanks to Ken Raeburn for this suggestion). To create - trees.h, compile with GEN_TREES_H and run "make test". -- check return code of example in "make test" and display result -- pass minigzip command line options to file_compress -- simplifying code of inflateSync to avoid gcc 2.8 bug - -- support CC="gcc -Wall" in configure -s (QingLong) -- avoid a flush caused by ftell in gzopen for write mode (Ken Raeburn) -- fix test for shared library support to avoid compiler warnings -- zlib.lib -> zlib.dll in msdos/zlib.rc (Gilles Vollant) -- check for TARGET_OS_MAC in addition to MACOS (Brad Pettit) -- do not use fdopen for Metrowerks on Mac (Brad Pettit)) -- add checks for gzputc and gzputc in example.c -- avoid warnings in gzio.c and deflate.c (Andreas Kleinert) -- use const for the CRC table (Ken Raeburn) -- fixed "make uninstall" for shared libraries -- use Tracev instead of Trace in infblock.c -- in example.c use correct compressed length for test_sync -- suppress +vnocompatwarnings in configure for HPUX (not always supported) - -Changes in 1.0.7 (20 Jan 1998) -- fix gzseek which was broken in write mode -- return error for gzseek to negative absolute position -- fix configure for Linux (Chun-Chung Chen) -- increase stack space for MSC (Tim Wegner) -- get_crc_table and inflateSyncPoint are EXPORTed (Gilles Vollant) -- define EXPORTVA for gzprintf (Gilles Vollant) -- added man page zlib.3 (Rick Rodgers) -- for contrib/untgz, fix makedir() and improve Makefile - -- check gzseek in write mode in example.c -- allocate extra buffer for seeks only if gzseek is actually called -- avoid signed/unsigned comparisons (Tim Wegner, Gilles Vollant) -- add inflateSyncPoint in zconf.h -- fix list of exported functions in nt/zlib.dnt and mdsos/zlib.def - -Changes in 1.0.6 (19 Jan 1998) -- add functions gzprintf, gzputc, gzgetc, gztell, gzeof, gzseek, gzrewind and - gzsetparams (thanks to Roland Giersig and Kevin Ruland for some of this code) -- Fix a deflate bug occurring only with compression level 0 (thanks to - Andy Buckler for finding this one). -- In minigzip, pass transparently also the first byte for .Z files. -- return Z_BUF_ERROR instead of Z_OK if output buffer full in uncompress() -- check Z_FINISH in inflate (thanks to Marc Schluper) -- Implement deflateCopy (thanks to Adam Costello) -- make static libraries by default in configure, add --shared option. -- move MSDOS or Windows specific files to directory msdos -- suppress the notion of partial flush to simplify the interface - (but the symbol Z_PARTIAL_FLUSH is kept for compatibility with 1.0.4) -- suppress history buffer provided by application to simplify the interface - (this feature was not implemented anyway in 1.0.4) -- next_in and avail_in must be initialized before calling inflateInit or - inflateInit2 -- add EXPORT in all exported functions (for Windows DLL) -- added Makefile.nt (thanks to Stephen Williams) -- added the unsupported "contrib" directory: - contrib/asm386/ by Gilles Vollant - 386 asm code replacing longest_match(). - contrib/iostream/ by Kevin Ruland - A C++ I/O streams interface to the zlib gz* functions - contrib/iostream2/ by Tyge Løvset - Another C++ I/O streams interface - contrib/untgz/ by "Pedro A. Aranda Guti\irrez" - A very simple tar.gz file extractor using zlib - contrib/visual-basic.txt by Carlos Rios - How to use compress(), uncompress() and the gz* functions from VB. -- pass params -f (filtered data), -h (huffman only), -1 to -9 (compression - level) in minigzip (thanks to Tom Lane) - -- use const for rommable constants in deflate -- added test for gzseek and gztell in example.c -- add undocumented function inflateSyncPoint() (hack for Paul Mackerras) -- add undocumented function zError to convert error code to string - (for Tim Smithers) -- Allow compilation of gzio with -DNO_DEFLATE to avoid the compression code. -- Use default memcpy for Symantec MSDOS compiler. -- Add EXPORT keyword for check_func (needed for Windows DLL) -- add current directory to LD_LIBRARY_PATH for "make test" -- create also a link for libz.so.1 -- added support for FUJITSU UXP/DS (thanks to Toshiaki Nomura) -- use $(SHAREDLIB) instead of libz.so in Makefile.in (for HPUX) -- added -soname for Linux in configure (Chun-Chung Chen, -- assign numbers to the exported functions in zlib.def (for Windows DLL) -- add advice in zlib.h for best usage of deflateSetDictionary -- work around compiler bug on Atari (cast Z_NULL in call of s->checkfn) -- allow compilation with ANSI keywords only enabled for TurboC in large model -- avoid "versionString"[0] (Borland bug) -- add NEED_DUMMY_RETURN for Borland -- use variable z_verbose for tracing in debug mode (L. Peter Deutsch). -- allow compilation with CC -- defined STDC for OS/2 (David Charlap) -- limit external names to 8 chars for MVS (Thomas Lund) -- in minigzip.c, use static buffers only for 16-bit systems -- fix suffix check for "minigzip -d foo.gz" -- do not return an error for the 2nd of two consecutive gzflush() (Felix Lee) -- use _fdopen instead of fdopen for MSC >= 6.0 (Thomas Fanslau) -- added makelcc.bat for lcc-win32 (Tom St Denis) -- in Makefile.dj2, use copy and del instead of install and rm (Frank Donahoe) -- Avoid expanded Id. Use "rcs -kb" or "cvs admin -kb" to avoid Id expansion. -- check for unistd.h in configure (for off_t) -- remove useless check parameter in inflate_blocks_free -- avoid useless assignment of s->check to itself in inflate_blocks_new -- do not flush twice in gzclose (thanks to Ken Raeburn) -- rename FOPEN as F_OPEN to avoid clash with /usr/include/sys/file.h -- use NO_ERRNO_H instead of enumeration of operating systems with errno.h -- work around buggy fclose on pipes for HP/UX -- support zlib DLL with BORLAND C++ 5.0 (thanks to Glenn Randers-Pehrson) -- fix configure if CC is already equal to gcc - -Changes in 1.0.5 (3 Jan 98) -- Fix inflate to terminate gracefully when fed corrupted or invalid data -- Use const for rommable constants in inflate -- Eliminate memory leaks on error conditions in inflate -- Removed some vestigial code in inflate -- Update web address in README - -Changes in 1.0.4 (24 Jul 96) -- In very rare conditions, deflate(s, Z_FINISH) could fail to produce an EOF - bit, so the decompressor could decompress all the correct data but went - on to attempt decompressing extra garbage data. This affected minigzip too. -- zlibVersion and gzerror return const char* (needed for DLL) -- port to RISCOS (no fdopen, no multiple dots, no unlink, no fileno) -- use z_error only for DEBUG (avoid problem with DLLs) - -Changes in 1.0.3 (2 Jul 96) -- use z_streamp instead of z_stream *, which is now a far pointer in MSDOS - small and medium models; this makes the library incompatible with previous - versions for these models. (No effect in large model or on other systems.) -- return OK instead of BUF_ERROR if previous deflate call returned with - avail_out as zero but there is nothing to do -- added memcmp for non STDC compilers -- define NO_DUMMY_DECL for more Mac compilers (.h files merged incorrectly) -- define __32BIT__ if __386__ or i386 is defined (pb. with Watcom and SCO) -- better check for 16-bit mode MSC (avoids problem with Symantec) - -Changes in 1.0.2 (23 May 96) -- added Windows DLL support -- added a function zlibVersion (for the DLL support) -- fixed declarations using Bytef in infutil.c (pb with MSDOS medium model) -- Bytef is define's instead of typedef'd only for Borland C -- avoid reading uninitialized memory in example.c -- mention in README that the zlib format is now RFC1950 -- updated Makefile.dj2 -- added algorithm.doc - -Changes in 1.0.1 (20 May 96) [1.0 skipped to avoid confusion] -- fix array overlay in deflate.c which sometimes caused bad compressed data -- fix inflate bug with empty stored block -- fix MSDOS medium model which was broken in 0.99 -- fix deflateParams() which could generated bad compressed data. -- Bytef is define'd instead of typedef'ed (work around Borland bug) -- added an INDEX file -- new makefiles for DJGPP (Makefile.dj2), 32-bit Borland (Makefile.b32), - Watcom (Makefile.wat), Amiga SAS/C (Makefile.sas) -- speed up adler32 for modern machines without auto-increment -- added -ansi for IRIX in configure -- static_init_done in trees.c is an int -- define unlink as delete for VMS -- fix configure for QNX -- add configure branch for SCO and HPUX -- avoid many warnings (unused variables, dead assignments, etc...) -- no fdopen for BeOS -- fix the Watcom fix for 32 bit mode (define FAR as empty) -- removed redefinition of Byte for MKWERKS -- work around an MWKERKS bug (incorrect merge of all .h files) - -Changes in 0.99 (27 Jan 96) -- allow preset dictionary shared between compressor and decompressor -- allow compression level 0 (no compression) -- add deflateParams in zlib.h: allow dynamic change of compression level - and compression strategy. -- test large buffers and deflateParams in example.c -- add optional "configure" to build zlib as a shared library -- suppress Makefile.qnx, use configure instead -- fixed deflate for 64-bit systems (detected on Cray) -- fixed inflate_blocks for 64-bit systems (detected on Alpha) -- declare Z_DEFLATED in zlib.h (possible parameter for deflateInit2) -- always return Z_BUF_ERROR when deflate() has nothing to do -- deflateInit and inflateInit are now macros to allow version checking -- prefix all global functions and types with z_ with -DZ_PREFIX -- make falloc completely reentrant (inftrees.c) -- fixed very unlikely race condition in ct_static_init -- free in reverse order of allocation to help memory manager -- use zlib-1.0/* instead of zlib/* inside the tar.gz -- make zlib warning-free with "gcc -O3 -Wall -Wwrite-strings -Wpointer-arith - -Wconversion -Wstrict-prototypes -Wmissing-prototypes" -- allow gzread on concatenated .gz files -- deflateEnd now returns Z_DATA_ERROR if it was premature -- deflate is finally (?) fully deterministic (no matches beyond end of input) -- Document Z_SYNC_FLUSH -- add uninstall in Makefile -- Check for __cpluplus in zlib.h -- Better test in ct_align for partial flush -- avoid harmless warnings for Borland C++ -- initialize hash_head in deflate.c -- avoid warning on fdopen (gzio.c) for HP cc -Aa -- include stdlib.h for STDC compilers -- include errno.h for Cray -- ignore error if ranlib doesn't exist -- call ranlib twice for NeXTSTEP -- use exec_prefix instead of prefix for libz.a -- renamed ct_* as _tr_* to avoid conflict with applications -- clear z->msg in inflateInit2 before any error return -- initialize opaque in example.c, gzio.c, deflate.c and inflate.c -- fixed typo in zconf.h (_GNUC__ => __GNUC__) -- check for WIN32 in zconf.h and zutil.c (avoid farmalloc in 32-bit mode) -- fix typo in Make_vms.com (f$trnlnm -> f$getsyi) -- in fcalloc, normalize pointer if size > 65520 bytes -- don't use special fcalloc for 32 bit Borland C++ -- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc... -- use Z_BINARY instead of BINARY -- document that gzclose after gzdopen will close the file -- allow "a" as mode in gzopen. -- fix error checking in gzread -- allow skipping .gz extra-field on pipes -- added reference to Perl interface in README -- put the crc table in FAR data (I dislike more and more the medium model :) -- added get_crc_table -- added a dimension to all arrays (Borland C can't count). -- workaround Borland C bug in declaration of inflate_codes_new & inflate_fast -- guard against multiple inclusion of *.h (for precompiled header on Mac) -- Watcom C pretends to be Microsoft C small model even in 32 bit mode. -- don't use unsized arrays to avoid silly warnings by Visual C++: - warning C4746: 'inflate_mask' : unsized array treated as '__far' - (what's wrong with far data in far model?). -- define enum out of inflate_blocks_state to allow compilation with C++ - -Changes in 0.95 (16 Aug 95) -- fix MSDOS small and medium model (now easier to adapt to any compiler) -- inlined send_bits -- fix the final (:-) bug for deflate with flush (output was correct but - not completely flushed in rare occasions). -- default window size is same for compression and decompression - (it's now sufficient to set MAX_WBITS in zconf.h). -- voidp -> voidpf and voidnp -> voidp (for consistency with other - typedefs and because voidnp was not near in large model). - -Changes in 0.94 (13 Aug 95) -- support MSDOS medium model -- fix deflate with flush (could sometimes generate bad output) -- fix deflateReset (zlib header was incorrectly suppressed) -- added support for VMS -- allow a compression level in gzopen() -- gzflush now calls fflush -- For deflate with flush, flush even if no more input is provided. -- rename libgz.a as libz.a -- avoid complex expression in infcodes.c triggering Turbo C bug -- work around a problem with gcc on Alpha (in INSERT_STRING) -- don't use inline functions (problem with some gcc versions) -- allow renaming of Byte, uInt, etc... with #define. -- avoid warning about (unused) pointer before start of array in deflate.c -- avoid various warnings in gzio.c, example.c, infblock.c, adler32.c, zutil.c -- avoid reserved word 'new' in trees.c - -Changes in 0.93 (25 June 95) -- temporarily disable inline functions -- make deflate deterministic -- give enough lookahead for PARTIAL_FLUSH -- Set binary mode for stdin/stdout in minigzip.c for OS/2 -- don't even use signed char in inflate (not portable enough) -- fix inflate memory leak for segmented architectures - -Changes in 0.92 (3 May 95) -- don't assume that char is signed (problem on SGI) -- Clear bit buffer when starting a stored block -- no memcpy on Pyramid -- suppressed inftest.c -- optimized fill_window, put longest_match inline for gcc -- optimized inflate on stored blocks. -- untabify all sources to simplify patches - -Changes in 0.91 (2 May 95) -- Default MEM_LEVEL is 8 (not 9 for Unix) as documented in zlib.h -- Document the memory requirements in zconf.h -- added "make install" -- fix sync search logic in inflateSync -- deflate(Z_FULL_FLUSH) now works even if output buffer too short -- after inflateSync, don't scare people with just "lo world" -- added support for DJGPP - -Changes in 0.9 (1 May 95) -- don't assume that zalloc clears the allocated memory (the TurboC bug - was Mark's bug after all :) -- let again gzread copy uncompressed data unchanged (was working in 0.71) -- deflate(Z_FULL_FLUSH), inflateReset and inflateSync are now fully implemented -- added a test of inflateSync in example.c -- moved MAX_WBITS to zconf.h because users might want to change that. -- document explicitly that zalloc(64K) on MSDOS must return a normalized - pointer (zero offset) -- added Makefiles for Microsoft C, Turbo C, Borland C++ -- faster crc32() - -Changes in 0.8 (29 April 95) -- added fast inflate (inffast.c) -- deflate(Z_FINISH) now returns Z_STREAM_END when done. Warning: this - is incompatible with previous versions of zlib which returned Z_OK. -- work around a TurboC compiler bug (bad code for b << 0, see infutil.h) - (actually that was not a compiler bug, see 0.81 above) -- gzread no longer reads one extra byte in certain cases -- In gzio destroy(), don't reference a freed structure -- avoid many warnings for MSDOS -- avoid the ERROR symbol which is used by MS Windows - -Changes in 0.71 (14 April 95) -- Fixed more MSDOS compilation problems :( There is still a bug with - TurboC large model. - -Changes in 0.7 (14 April 95) -- Added full inflate support. -- Simplified the crc32() interface. The pre- and post-conditioning - (one's complement) is now done inside crc32(). WARNING: this is - incompatible with previous versions; see zlib.h for the new usage. - -Changes in 0.61 (12 April 95) -- workaround for a bug in TurboC. example and minigzip now work on MSDOS. - -Changes in 0.6 (11 April 95) -- added minigzip.c -- added gzdopen to reopen a file descriptor as gzFile -- added transparent reading of non-gziped files in gzread. -- fixed bug in gzread (don't read crc as data) -- fixed bug in destroy (gzio.c) (don't return Z_STREAM_END for gzclose). -- don't allocate big arrays in the stack (for MSDOS) -- fix some MSDOS compilation problems - -Changes in 0.5: -- do real compression in deflate.c. Z_PARTIAL_FLUSH is supported but - not yet Z_FULL_FLUSH. -- support decompression but only in a single step (forced Z_FINISH) -- added opaque object for zalloc and zfree. -- added deflateReset and inflateReset -- added a variable zlib_version for consistency checking. -- renamed the 'filter' parameter of deflateInit2 as 'strategy'. - Added Z_FILTERED and Z_HUFFMAN_ONLY constants. - -Changes in 0.4: -- avoid "zip" everywhere, use zlib instead of ziplib. -- suppress Z_BLOCK_FLUSH, interpret Z_PARTIAL_FLUSH as block flush - if compression method == 8. -- added adler32 and crc32 -- renamed deflateOptions as deflateInit2, call one or the other but not both -- added the method parameter for deflateInit2. -- added inflateInit2 -- simplied considerably deflateInit and inflateInit by not supporting - user-provided history buffer. This is supported only in deflateInit2 - and inflateInit2. - -Changes in 0.3: -- prefix all macro names with Z_ -- use Z_FINISH instead of deflateEnd to finish compression. -- added Z_HUFFMAN_ONLY -- added gzerror() diff --git a/common/dist/zlib/FAQ b/common/dist/zlib/FAQ deleted file mode 100644 index 441d910da..000000000 --- a/common/dist/zlib/FAQ +++ /dev/null @@ -1,339 +0,0 @@ - - Frequently Asked Questions about zlib - - -If your question is not there, please check the zlib home page -http://www.zlib.org which may have more recent information. -The lastest zlib FAQ is at http://www.gzip.org/zlib/zlib_faq.html - - - 1. Is zlib Y2K-compliant? - - Yes. zlib doesn't handle dates. - - 2. Where can I get a Windows DLL version? - - The zlib sources can be compiled without change to produce a DLL. - See the file win32/DLL_FAQ.txt in the zlib distribution. - Pointers to the precompiled DLL are found in the zlib web site at - http://www.zlib.org. - - 3. Where can I get a Visual Basic interface to zlib? - - See - * http://www.dogma.net/markn/articles/zlibtool/zlibtool.htm - * contrib/visual-basic.txt in the zlib distribution - * win32/DLL_FAQ.txt in the zlib distribution - - 4. compress() returns Z_BUF_ERROR. - - Make sure that before the call of compress, the length of the compressed - buffer is equal to the total size of the compressed buffer and not - zero. For Visual Basic, check that this parameter is passed by reference - ("as any"), not by value ("as long"). - - 5. deflate() or inflate() returns Z_BUF_ERROR. - - Before making the call, make sure that avail_in and avail_out are not - zero. When setting the parameter flush equal to Z_FINISH, also make sure - that avail_out is big enough to allow processing all pending input. - Note that a Z_BUF_ERROR is not fatal--another call to deflate() or - inflate() can be made with more input or output space. A Z_BUF_ERROR - may in fact be unavoidable depending on how the functions are used, since - it is not possible to tell whether or not there is more output pending - when strm.avail_out returns with zero. - - 6. Where's the zlib documentation (man pages, etc.)? - - It's in zlib.h for the moment, and Francis S. Lin has converted it to a - web page zlib.html. Volunteers to transform this to Unix-style man pages, - please contact us (zlib@gzip.org). Examples of zlib usage are in the files - example.c and minigzip.c. - - 7. Why don't you use GNU autoconf or libtool or ...? - - Because we would like to keep zlib as a very small and simple - package. zlib is rather portable and doesn't need much configuration. - - 8. I found a bug in zlib. - - Most of the time, such problems are due to an incorrect usage of - zlib. Please try to reproduce the problem with a small program and send - the corresponding source to us at zlib@gzip.org . Do not send - multi-megabyte data files without prior agreement. - - 9. Why do I get "undefined reference to gzputc"? - - If "make test" produces something like - - example.o(.text+0x154): undefined reference to `gzputc' - - check that you don't have old files libz.* in /usr/lib, /usr/local/lib or - /usr/X11R6/lib. Remove any old versions, then do "make install". - -10. I need a Delphi interface to zlib. - - See the contrib/delphi directory in the zlib distribution. - -11. Can zlib handle .zip archives? - - Not by itself, no. See the directory contrib/minizip in the zlib - distribution. - -12. Can zlib handle .Z files? - - No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt - the code of uncompress on your own. - -13. How can I make a Unix shared library? - - make clean - ./configure -s - make - -14. How do I install a shared zlib library on Unix? - - After the above, then: - - make install - - However, many flavors of Unix come with a shared zlib already installed. - Before going to the trouble of compiling a shared version of zlib and - trying to install it, you may want to check if it's already there! If you - can #include , it's there. The -lz option will probably link to it. - -15. I have a question about OttoPDF. - - We are not the authors of OttoPDF. The real author is on the OttoPDF web - site: Joel Hainley, jhainley@myndkryme.com. - -16. Can zlib decode Flate data in an Adobe PDF file? - - Yes. See http://www.fastio.com/ (ClibPDF), or http://www.pdflib.com/ . - To modify PDF forms, see http://sourceforge.net/projects/acroformtool/ . - -17. Why am I getting this "register_frame_info not found" error on Solaris? - - After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib - generates an error such as: - - ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so: - symbol __register_frame_info: referenced symbol not found - - The symbol __register_frame_info is not part of zlib, it is generated by - the C compiler (cc or gcc). You must recompile applications using zlib - which have this problem. This problem is specific to Solaris. See - http://www.sunfreeware.com for Solaris versions of zlib and applications - using zlib. - -18. Why does gzip give an error on a file I make with compress/deflate? - - The compress and deflate functions produce data in the zlib format, which - is different and incompatible with the gzip format. The gz* functions in - zlib on the other hand use the gzip format. Both the zlib and gzip - formats use the same compressed data format internally, but have different - headers and trailers around the compressed data. - -19. Ok, so why are there two different formats? - - The gzip format was designed to retain the directory information about - a single file, such as the name and last modification date. The zlib - format on the other hand was designed for in-memory and communication - channel applications, and has a much more compact header and trailer and - uses a faster integrity check than gzip. - -20. Well that's nice, but how do I make a gzip file in memory? - - You can request that deflate write the gzip format instead of the zlib - format using deflateInit2(). You can also request that inflate decode - the gzip format using inflateInit2(). Read zlib.h for more details. - -21. Is zlib thread-safe? - - Yes. However any library routines that zlib uses and any application- - provided memory allocation routines must also be thread-safe. zlib's gz* - functions use stdio library routines, and most of zlib's functions use the - library memory allocation routines by default. zlib's Init functions allow - for the application to provide custom memory allocation routines. - - Of course, you should only operate on any given zlib or gzip stream from a - single thread at a time. - -22. Can I use zlib in my commercial application? - - Yes. Please read the license in zlib.h. - -23. Is zlib under the GNU license? - - No. Please read the license in zlib.h. - -24. The license says that altered source versions must be "plainly marked". So - what exactly do I need to do to meet that requirement? - - You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In - particular, the final version number needs to be changed to "f", and an - identification string should be appended to ZLIB_VERSION. Version numbers - x.x.x.f are reserved for modifications to zlib by others than the zlib - maintainers. For example, if the version of the base zlib you are altering - is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and - ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also - update the version strings in deflate.c and inftrees.c. - - For altered source distributions, you should also note the origin and - nature of the changes in zlib.h, as well as in ChangeLog and README, along - with the dates of the alterations. The origin should include at least your - name (or your company's name), and an email address to contact for help or - issues with the library. - - Note that distributing a compiled zlib library along with zlib.h and - zconf.h is also a source distribution, and so you should change - ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes - in zlib.h as you would for a full source distribution. - -25. Will zlib work on a big-endian or little-endian architecture, and can I - exchange compressed data between them? - - Yes and yes. - -26. Will zlib work on a 64-bit machine? - - It should. It has been tested on 64-bit machines, and has no dependence - on any data types being limited to 32-bits in length. If you have any - difficulties, please provide a complete problem report to zlib@gzip.org - -27. Will zlib decompress data from the PKWare Data Compression Library? - - No. The PKWare DCL uses a completely different compressed data format - than does PKZIP and zlib. However, you can look in zlib's contrib/blast - directory for a possible solution to your problem. - -28. Can I access data randomly in a compressed stream? - - No, not without some preparation. If when compressing you periodically - use Z_FULL_FLUSH, carefully write all the pending data at those points, - and keep an index of those locations, then you can start decompression - at those points. You have to be careful to not use Z_FULL_FLUSH too - often, since it can significantly degrade compression. - -29. Does zlib work on MVS, OS/390, CICS, etc.? - - We don't know for sure. We have heard occasional reports of success on - these systems. If you do use it on one of these, please provide us with - a report, instructions, and patches that we can reference when we get - these questions. Thanks. - -30. Is there some simpler, easier to read version of inflate I can look at - to understand the deflate format? - - First off, you should read RFC 1951. Second, yes. Look in zlib's - contrib/puff directory. - -31. Does zlib infringe on any patents? - - As far as we know, no. In fact, that was originally the whole point behind - zlib. Look here for some more information: - - http://www.gzip.org/#faq11 - -32. Can zlib work with greater than 4 GB of data? - - Yes. inflate() and deflate() will process any amount of data correctly. - Each call of inflate() or deflate() is limited to input and output chunks - of the maximum value that can be stored in the compiler's "unsigned int" - type, but there is no limit to the number of chunks. Note however that the - strm.total_in and strm_total_out counters may be limited to 4 GB. These - counters are provided as a convenience and are not used internally by - inflate() or deflate(). The application can easily set up its own counters - updated after each call of inflate() or deflate() to count beyond 4 GB. - compress() and uncompress() may be limited to 4 GB, since they operate in a - single call. gzseek() and gztell() may be limited to 4 GB depending on how - zlib is compiled. See the zlibCompileFlags() function in zlib.h. - - The word "may" appears several times above since there is a 4 GB limit - only if the compiler's "long" type is 32 bits. If the compiler's "long" - type is 64 bits, then the limit is 16 exabytes. - -33. Does zlib have any security vulnerabilities? - - The only one that we are aware of is potentially in gzprintf(). If zlib - is compiled to use sprintf() or vsprintf(), then there is no protection - against a buffer overflow of a 4K string space, other than the caller of - gzprintf() assuring that the output will not exceed 4K. On the other - hand, if zlib is compiled to use snprintf() or vsnprintf(), which should - normally be the case, then there is no vulnerability. The ./configure - script will display warnings if an insecure variation of sprintf() will - be used by gzprintf(). Also the zlibCompileFlags() function will return - information on what variant of sprintf() is used by gzprintf(). - - If you don't have snprintf() or vsnprintf() and would like one, you can - find a portable implementation here: - - http://www.ijs.si/software/snprintf/ - - Note that you should be using the most recent version of zlib. Versions - 1.1.3 and before were subject to a double-free vulnerability. - -34. Is there a Java version of zlib? - - Probably what you want is to use zlib in Java. zlib is already included - as part of the Java SDK in the java.util.zip package. If you really want - a version of zlib written in the Java language, look on the zlib home - page for links: http://www.zlib.org/ - -35. I get this or that compiler or source-code scanner warning when I crank it - up to maximally-pedantic. Can't you guys write proper code? - - Many years ago, we gave up attempting to avoid warnings on every compiler - in the universe. It just got to be a waste of time, and some compilers - were downright silly. So now, we simply make sure that the code always - works. - -36. Valgrind (or some similar memory access checker) says that deflate is - performing a conditional jump that depends on an uninitialized value. - Isn't that a bug? - - No. That is intentional for performance reasons, and the output of - deflate is not affected. This only started showing up recently since - zlib 1.2.x uses malloc() by default for allocations, whereas earlier - versions used calloc(), which zeros out the allocated memory. - -37. Will zlib read the (insert any ancient or arcane format here) compressed - data format? - - Probably not. Look in the comp.compression FAQ for pointers to various - formats and associated software. - -38. How can I encrypt/decrypt zip files with zlib? - - zlib doesn't support encryption. The original PKZIP encryption is very weak - and can be broken with freely available programs. To get strong encryption, - use GnuPG, http://www.gnupg.org/ , which already includes zlib compression. - For PKZIP compatible "encryption", look at http://www.info-zip.org/ - -39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings? - - "gzip" is the gzip format, and "deflate" is the zlib format. They should - probably have called the second one "zlib" instead to avoid confusion - with the raw deflate compressed data format. While the HTTP 1.1 RFC 2616 - correctly points to the zlib specification in RFC 1950 for the "deflate" - transfer encoding, there have been reports of servers and browsers that - incorrectly produce or expect raw deflate data per the deflate - specficiation in RFC 1951, most notably Microsoft. So even though the - "deflate" transfer encoding using the zlib format would be the more - efficient approach (and in fact exactly what the zlib format was designed - for), using the "gzip" transfer encoding is probably more reliable due to - an unfortunate choice of name on the part of the HTTP 1.1 authors. - - Bottom line: use the gzip format for HTTP 1.1 encoding. - -40. Does zlib support the new "Deflate64" format introduced by PKWare? - - No. PKWare has apparently decided to keep that format proprietary, since - they have not documented it as they have previous compression formats. - In any case, the compression improvements are so modest compared to other - more modern approaches, that it's not worth the effort to implement. - -41. Can you please sign these lengthy legal documents and fax them back to us - so that we can use your software in our product? - - No. Go away. Shoo. diff --git a/common/dist/zlib/INDEX b/common/dist/zlib/INDEX deleted file mode 100644 index 0587e5902..000000000 --- a/common/dist/zlib/INDEX +++ /dev/null @@ -1,51 +0,0 @@ -ChangeLog history of changes -FAQ Frequently Asked Questions about zlib -INDEX this file -Makefile makefile for Unix (generated by configure) -Makefile.in makefile for Unix (template for configure) -README guess what -algorithm.txt description of the (de)compression algorithm -configure configure script for Unix -zconf.in.h template for zconf.h (used by configure) - -amiga/ makefiles for Amiga SAS C -as400/ makefiles for IBM AS/400 -msdos/ makefiles for MSDOS -old/ makefiles for various architectures and zlib documentation - files that have not yet been updated for zlib 1.2.x -projects/ projects for various Integrated Development Environments -qnx/ makefiles for QNX -win32/ makefiles for Windows - - zlib public header files (must be kept): -zconf.h -zlib.h - - private source files used to build the zlib library: -adler32.c -compress.c -crc32.c -crc32.h -deflate.c -deflate.h -gzio.c -infback.c -inffast.c -inffast.h -inffixed.h -inflate.c -inflate.h -inftrees.c -inftrees.h -trees.c -trees.h -uncompr.c -zutil.c -zutil.h - - source files for sample programs: -example.c -minigzip.c - - unsupported contribution by third parties -See contrib/README.contrib diff --git a/common/dist/zlib/Makefile b/common/dist/zlib/Makefile deleted file mode 100644 index 2fd6e45c4..000000000 --- a/common/dist/zlib/Makefile +++ /dev/null @@ -1,154 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2005 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile and test, type: -# ./configure; make test -# The call of configure is optional if you don't have special requirements -# If you wish to build zlib as a shared library, use: ./configure -s - -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - -# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: -# make install -# To install in $HOME instead of /usr/local, use: -# make install prefix=$HOME - -CC=cc - -CFLAGS=-O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DDEBUG -#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ -# -Wstrict-prototypes -Wmissing-prototypes - -LDFLAGS=libz.a -LDSHARED=$(CC) -CPP=$(CC) -E - -LIBS=libz.a -SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.3 -SHAREDLIBM=libz.so.1 - -AR=ar rc -RANLIB=ranlib -TAR=tar -SHELL=/bin/sh -EXE= - -prefix = /usr/local -exec_prefix = ${prefix} -libdir = ${exec_prefix}/lib -includedir = ${prefix}/include -mandir = ${prefix}/share/man -man3dir = ${mandir}/man3 - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -OBJA = -# to use the asm code: make OBJA=match.o - -TEST_OBJS = example.o minigzip.o - -all: example$(EXE) minigzip$(EXE) - -check: test -test: all - @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - echo hello world | ./minigzip | ./minigzip -d || \ - echo ' *** minigzip test FAILED ***' ; \ - if ./example; then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; \ - fi - -libz.a: $(OBJS) $(OBJA) - $(AR) $@ $(OBJS) $(OBJA) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -match.o: match.S - $(CPP) match.S > _match.s - $(CC) -c _match.s - mv _match.o match.o - rm -f _match.s - -$(SHAREDLIBV): $(OBJS) - $(LDSHARED) -o $@ $(OBJS) - rm -f $(SHAREDLIB) $(SHAREDLIBM) - ln -s $@ $(SHAREDLIB) - ln -s $@ $(SHAREDLIBM) - -example$(EXE): example.o $(LIBS) - $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) - -minigzip$(EXE): minigzip.o $(LIBS) - $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) - -install: $(LIBS) - -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi - -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi - -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi - -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi - cp zlib.h zconf.h $(includedir) - chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h - cp $(LIBS) $(libdir) - cd $(libdir); chmod 755 $(LIBS) - -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 - cd $(libdir); if test -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIB) $(SHAREDLIBM); \ - ln -s $(SHAREDLIBV) $(SHAREDLIB); \ - ln -s $(SHAREDLIBV) $(SHAREDLIBM); \ - (ldconfig || true) >/dev/null 2>&1; \ - fi - cp zlib.3 $(man3dir) - chmod 644 $(man3dir)/zlib.3 -# The ranlib in install is needed on NeXTSTEP which checks file times -# ldconfig is for Linux - -uninstall: - cd $(includedir); \ - cd $(libdir); rm -f libz.a; \ - if test -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ - fi - cd $(man3dir); rm -f zlib.3 - -mostlyclean: clean -clean: - rm -f *.o *~ example$(EXE) minigzip$(EXE) \ - libz.* foo.gz so_locations \ - _match.s maketree contrib/infback9/*.o - -maintainer-clean: distclean -distclean: clean - cp -p Makefile.in Makefile - cp -p zconf.in.h zconf.h - rm -f .DS_Store - -tags: - etags *.[ch] - -depend: - makedepend -- $(CFLAGS) -- *.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: crc32.h zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/common/dist/zlib/Makefile.in b/common/dist/zlib/Makefile.in deleted file mode 100644 index 2fd6e45c4..000000000 --- a/common/dist/zlib/Makefile.in +++ /dev/null @@ -1,154 +0,0 @@ -# Makefile for zlib -# Copyright (C) 1995-2005 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile and test, type: -# ./configure; make test -# The call of configure is optional if you don't have special requirements -# If you wish to build zlib as a shared library, use: ./configure -s - -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o - -# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type: -# make install -# To install in $HOME instead of /usr/local, use: -# make install prefix=$HOME - -CC=cc - -CFLAGS=-O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DDEBUG -#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ -# -Wstrict-prototypes -Wmissing-prototypes - -LDFLAGS=libz.a -LDSHARED=$(CC) -CPP=$(CC) -E - -LIBS=libz.a -SHAREDLIB=libz.so -SHAREDLIBV=libz.so.1.2.3 -SHAREDLIBM=libz.so.1 - -AR=ar rc -RANLIB=ranlib -TAR=tar -SHELL=/bin/sh -EXE= - -prefix = /usr/local -exec_prefix = ${prefix} -libdir = ${exec_prefix}/lib -includedir = ${prefix}/include -mandir = ${prefix}/share/man -man3dir = ${mandir}/man3 - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -OBJA = -# to use the asm code: make OBJA=match.o - -TEST_OBJS = example.o minigzip.o - -all: example$(EXE) minigzip$(EXE) - -check: test -test: all - @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - echo hello world | ./minigzip | ./minigzip -d || \ - echo ' *** minigzip test FAILED ***' ; \ - if ./example; then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; \ - fi - -libz.a: $(OBJS) $(OBJA) - $(AR) $@ $(OBJS) $(OBJA) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -match.o: match.S - $(CPP) match.S > _match.s - $(CC) -c _match.s - mv _match.o match.o - rm -f _match.s - -$(SHAREDLIBV): $(OBJS) - $(LDSHARED) -o $@ $(OBJS) - rm -f $(SHAREDLIB) $(SHAREDLIBM) - ln -s $@ $(SHAREDLIB) - ln -s $@ $(SHAREDLIBM) - -example$(EXE): example.o $(LIBS) - $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) - -minigzip$(EXE): minigzip.o $(LIBS) - $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) - -install: $(LIBS) - -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi - -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi - -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi - -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi - cp zlib.h zconf.h $(includedir) - chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h - cp $(LIBS) $(libdir) - cd $(libdir); chmod 755 $(LIBS) - -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1 - cd $(libdir); if test -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIB) $(SHAREDLIBM); \ - ln -s $(SHAREDLIBV) $(SHAREDLIB); \ - ln -s $(SHAREDLIBV) $(SHAREDLIBM); \ - (ldconfig || true) >/dev/null 2>&1; \ - fi - cp zlib.3 $(man3dir) - chmod 644 $(man3dir)/zlib.3 -# The ranlib in install is needed on NeXTSTEP which checks file times -# ldconfig is for Linux - -uninstall: - cd $(includedir); \ - cd $(libdir); rm -f libz.a; \ - if test -f $(SHAREDLIBV); then \ - rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \ - fi - cd $(man3dir); rm -f zlib.3 - -mostlyclean: clean -clean: - rm -f *.o *~ example$(EXE) minigzip$(EXE) \ - libz.* foo.gz so_locations \ - _match.s maketree contrib/infback9/*.o - -maintainer-clean: distclean -distclean: clean - cp -p Makefile.in Makefile - cp -p zconf.in.h zconf.h - rm -f .DS_Store - -tags: - etags *.[ch] - -depend: - makedepend -- $(CFLAGS) -- *.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: crc32.h zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/common/dist/zlib/README b/common/dist/zlib/README deleted file mode 100644 index 758cc5002..000000000 --- a/common/dist/zlib/README +++ /dev/null @@ -1,125 +0,0 @@ -ZLIB DATA COMPRESSION LIBRARY - -zlib 1.2.3 is a general purpose data compression library. All the code is -thread safe. The data format used by the zlib library is described by RFCs -(Request for Comments) 1950 to 1952 in the files -http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) -and rfc1952.txt (gzip format). These documents are also available in other -formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html - -All functions of the compression library are documented in the file zlib.h -(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example -of the library is given in the file example.c which also tests that the library -is working correctly. Another example is given in the file minigzip.c. The -compression library itself is composed of all source files except example.c and -minigzip.c. - -To compile all files and run the test program, follow the instructions given at -the top of Makefile. In short "make test; make install" should work for most -machines. For Unix: "./configure; make test; make install". For MSDOS, use one -of the special makefiles such as Makefile.msc. For VMS, use make_vms.com. - -Questions about zlib should be sent to , or to Gilles Vollant - for the Windows DLL version. The zlib home page is -http://www.zlib.org or http://www.gzip.org/zlib/ Before reporting a problem, -please check this site to verify that you have the latest version of zlib; -otherwise get the latest version and check whether the problem still exists or -not. - -PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html before asking -for help. - -Mark Nelson wrote an article about zlib for the Jan. 1997 -issue of Dr. Dobb's Journal; a copy of the article is available in -http://dogma.net/markn/articles/zlibtool/zlibtool.htm - -The changes made in version 1.2.3 are documented in the file ChangeLog. - -Unsupported third party contributions are provided in directory "contrib". - -A Java implementation of zlib is available in the Java Development Kit -http://java.sun.com/j2se/1.4.2/docs/api/java/util/zip/package-summary.html -See the zlib home page http://www.zlib.org for details. - -A Perl interface to zlib written by Paul Marquess is in the -CPAN (Comprehensive Perl Archive Network) sites -http://www.cpan.org/modules/by-module/Compress/ - -A Python interface to zlib written by A.M. Kuchling is -available in Python 1.5 and later versions, see -http://www.python.org/doc/lib/module-zlib.html - -A zlib binding for TCL written by Andreas Kupries is -availlable at http://www.oche.de/~akupries/soft/trf/trf_zip.html - -An experimental package to read and write files in .zip format, written on top -of zlib by Gilles Vollant , is available in the -contrib/minizip directory of zlib. - - -Notes for some targets: - -- For Windows DLL versions, please see win32/DLL_FAQ.txt - -- For 64-bit Irix, deflate.c must be compiled without any optimization. With - -O, one libpng test fails. The test works in 32 bit mode (with the -n32 - compiler flag). The compiler bug has been reported to SGI. - -- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works - when compiled with cc. - -- On Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1 is - necessary to get gzprintf working correctly. This is done by configure. - -- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with - other compilers. Use "make test" to check your compiler. - -- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers. - -- For PalmOs, see http://palmzlib.sourceforge.net/ - -- When building a shared, i.e. dynamic library on Mac OS X, the library must be - installed before testing (do "make install" before "make test"), since the - library location is specified in the library. - - -Acknowledgments: - - The deflate format used by zlib was defined by Phil Katz. The deflate - and zlib specifications were written by L. Peter Deutsch. Thanks to all the - people who reported problems and suggested various improvements in zlib; - they are too numerous to cite here. - -Copyright notice: - - (C) 1995-2004 Jean-loup Gailly and Mark Adler - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - Jean-loup Gailly Mark Adler - jloup@gzip.org madler@alumni.caltech.edu - -If you use the zlib library in a product, we would appreciate *not* -receiving lengthy legal documents to sign. The sources are provided -for free but without warranty of any kind. The library has been -entirely written by Jean-loup Gailly and Mark Adler; it does not -include third-party code. - -If you redistribute modified sources, we would appreciate that you include -in the file ChangeLog history information documenting your changes. Please -read the FAQ for more information on the distribution of modified source -versions. diff --git a/common/dist/zlib/algorithm.txt b/common/dist/zlib/algorithm.txt deleted file mode 100644 index b022dde31..000000000 --- a/common/dist/zlib/algorithm.txt +++ /dev/null @@ -1,209 +0,0 @@ -1. Compression algorithm (deflate) - -The deflation algorithm used by gzip (also zip and zlib) is a variation of -LZ77 (Lempel-Ziv 1977, see reference below). It finds duplicated strings in -the input data. The second occurrence of a string is replaced by a -pointer to the previous string, in the form of a pair (distance, -length). Distances are limited to 32K bytes, and lengths are limited -to 258 bytes. When a string does not occur anywhere in the previous -32K bytes, it is emitted as a sequence of literal bytes. (In this -description, `string' must be taken as an arbitrary sequence of bytes, -and is not restricted to printable characters.) - -Literals or match lengths are compressed with one Huffman tree, and -match distances are compressed with another tree. The trees are stored -in a compact form at the start of each block. The blocks can have any -size (except that the compressed data for one block must fit in -available memory). A block is terminated when deflate() determines that -it would be useful to start another block with fresh trees. (This is -somewhat similar to the behavior of LZW-based _compress_.) - -Duplicated strings are found using a hash table. All input strings of -length 3 are inserted in the hash table. A hash index is computed for -the next 3 bytes. If the hash chain for this index is not empty, all -strings in the chain are compared with the current input string, and -the longest match is selected. - -The hash chains are searched starting with the most recent strings, to -favor small distances and thus take advantage of the Huffman encoding. -The hash chains are singly linked. There are no deletions from the -hash chains, the algorithm simply discards matches that are too old. - -To avoid a worst-case situation, very long hash chains are arbitrarily -truncated at a certain length, determined by a runtime option (level -parameter of deflateInit). So deflate() does not always find the longest -possible match but generally finds a match which is long enough. - -deflate() also defers the selection of matches with a lazy evaluation -mechanism. After a match of length N has been found, deflate() searches for -a longer match at the next input byte. If a longer match is found, the -previous match is truncated to a length of one (thus producing a single -literal byte) and the process of lazy evaluation begins again. Otherwise, -the original match is kept, and the next match search is attempted only N -steps later. - -The lazy match evaluation is also subject to a runtime parameter. If -the current match is long enough, deflate() reduces the search for a longer -match, thus speeding up the whole process. If compression ratio is more -important than speed, deflate() attempts a complete second search even if -the first match is already long enough. - -The lazy match evaluation is not performed for the fastest compression -modes (level parameter 1 to 3). For these fast modes, new strings -are inserted in the hash table only when no match was found, or -when the match is not too long. This degrades the compression ratio -but saves time since there are both fewer insertions and fewer searches. - - -2. Decompression algorithm (inflate) - -2.1 Introduction - -The key question is how to represent a Huffman code (or any prefix code) so -that you can decode fast. The most important characteristic is that shorter -codes are much more common than longer codes, so pay attention to decoding the -short codes fast, and let the long codes take longer to decode. - -inflate() sets up a first level table that covers some number of bits of -input less than the length of longest code. It gets that many bits from the -stream, and looks it up in the table. The table will tell if the next -code is that many bits or less and how many, and if it is, it will tell -the value, else it will point to the next level table for which inflate() -grabs more bits and tries to decode a longer code. - -How many bits to make the first lookup is a tradeoff between the time it -takes to decode and the time it takes to build the table. If building the -table took no time (and if you had infinite memory), then there would only -be a first level table to cover all the way to the longest code. However, -building the table ends up taking a lot longer for more bits since short -codes are replicated many times in such a table. What inflate() does is -simply to make the number of bits in the first table a variable, and then -to set that variable for the maximum speed. - -For inflate, which has 286 possible codes for the literal/length tree, the size -of the first table is nine bits. Also the distance trees have 30 possible -values, and the size of the first table is six bits. Note that for each of -those cases, the table ended up one bit longer than the ``average'' code -length, i.e. the code length of an approximately flat code which would be a -little more than eight bits for 286 symbols and a little less than five bits -for 30 symbols. - - -2.2 More details on the inflate table lookup - -Ok, you want to know what this cleverly obfuscated inflate tree actually -looks like. You are correct that it's not a Huffman tree. It is simply a -lookup table for the first, let's say, nine bits of a Huffman symbol. The -symbol could be as short as one bit or as long as 15 bits. If a particular -symbol is shorter than nine bits, then that symbol's translation is duplicated -in all those entries that start with that symbol's bits. For example, if the -symbol is four bits, then it's duplicated 32 times in a nine-bit table. If a -symbol is nine bits long, it appears in the table once. - -If the symbol is longer than nine bits, then that entry in the table points -to another similar table for the remaining bits. Again, there are duplicated -entries as needed. The idea is that most of the time the symbol will be short -and there will only be one table look up. (That's whole idea behind data -compression in the first place.) For the less frequent long symbols, there -will be two lookups. If you had a compression method with really long -symbols, you could have as many levels of lookups as is efficient. For -inflate, two is enough. - -So a table entry either points to another table (in which case nine bits in -the above example are gobbled), or it contains the translation for the symbol -and the number of bits to gobble. Then you start again with the next -ungobbled bit. - -You may wonder: why not just have one lookup table for how ever many bits the -longest symbol is? The reason is that if you do that, you end up spending -more time filling in duplicate symbol entries than you do actually decoding. -At least for deflate's output that generates new trees every several 10's of -kbytes. You can imagine that filling in a 2^15 entry table for a 15-bit code -would take too long if you're only decoding several thousand symbols. At the -other extreme, you could make a new table for every bit in the code. In fact, -that's essentially a Huffman tree. But then you spend two much time -traversing the tree while decoding, even for short symbols. - -So the number of bits for the first lookup table is a trade of the time to -fill out the table vs. the time spent looking at the second level and above of -the table. - -Here is an example, scaled down: - -The code being decoded, with 10 symbols, from 1 to 6 bits long: - -A: 0 -B: 10 -C: 1100 -D: 11010 -E: 11011 -F: 11100 -G: 11101 -H: 11110 -I: 111110 -J: 111111 - -Let's make the first table three bits long (eight entries): - -000: A,1 -001: A,1 -010: A,1 -011: A,1 -100: B,2 -101: B,2 -110: -> table X (gobble 3 bits) -111: -> table Y (gobble 3 bits) - -Each entry is what the bits decode as and how many bits that is, i.e. how -many bits to gobble. Or the entry points to another table, with the number of -bits to gobble implicit in the size of the table. - -Table X is two bits long since the longest code starting with 110 is five bits -long: - -00: C,1 -01: C,1 -10: D,2 -11: E,2 - -Table Y is three bits long since the longest code starting with 111 is six -bits long: - -000: F,2 -001: F,2 -010: G,2 -011: G,2 -100: H,2 -101: H,2 -110: I,3 -111: J,3 - -So what we have here are three tables with a total of 20 entries that had to -be constructed. That's compared to 64 entries for a single table. Or -compared to 16 entries for a Huffman tree (six two entry tables and one four -entry table). Assuming that the code ideally represents the probability of -the symbols, it takes on the average 1.25 lookups per symbol. That's compared -to one lookup for the single table, or 1.66 lookups per symbol for the -Huffman tree. - -There, I think that gives you a picture of what's going on. For inflate, the -meaning of a particular symbol is often more than just a letter. It can be a -byte (a "literal"), or it can be either a length or a distance which -indicates a base value and a number of bits to fetch after the code that is -added to the base value. Or it might be the special end-of-block code. The -data structures created in inftrees.c try to encode all that information -compactly in the tables. - - -Jean-loup Gailly Mark Adler -jloup@gzip.org madler@alumni.caltech.edu - - -References: - -[LZ77] Ziv J., Lempel A., ``A Universal Algorithm for Sequential Data -Compression,'' IEEE Transactions on Information Theory, Vol. 23, No. 3, -pp. 337-343. - -``DEFLATE Compressed Data Format Specification'' available in -http://www.ietf.org/rfc/rfc1951.txt diff --git a/common/dist/zlib/amiga/Makefile.pup b/common/dist/zlib/amiga/Makefile.pup deleted file mode 100644 index 3f7e15537..000000000 --- a/common/dist/zlib/amiga/Makefile.pup +++ /dev/null @@ -1,66 +0,0 @@ -# Amiga powerUP (TM) Makefile -# makefile for libpng and SAS C V6.58/7.00 PPC compiler -# Copyright (C) 1998 by Andreas R. Kleinert - -LIBNAME = libzip.a - -CC = scppc -CFLAGS = NOSTKCHK NOSINT OPTIMIZE OPTGO OPTPEEP OPTINLOCAL OPTINL \ - OPTLOOP OPTRDEP=8 OPTDEP=8 OPTCOMP=8 NOVER -AR = ppc-amigaos-ar cr -RANLIB = ppc-amigaos-ranlib -LD = ppc-amigaos-ld -r -LDFLAGS = -o -LDLIBS = LIB:scppc.a LIB:end.o -RM = delete quiet - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -TEST_OBJS = example.o minigzip.o - -all: example minigzip - -check: test -test: all - example - echo hello world | minigzip | minigzip -d - -$(LIBNAME): $(OBJS) - $(AR) $@ $(OBJS) - -$(RANLIB) $@ - -example: example.o $(LIBNAME) - $(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS) - -minigzip: minigzip.o $(LIBNAME) - $(LD) $(LDFLAGS) $@ LIB:c_ppc.o $@.o $(LIBNAME) $(LDLIBS) - -mostlyclean: clean -clean: - $(RM) *.o example minigzip $(LIBNAME) foo.gz - -zip: - zip -ul9 zlib README ChangeLog Makefile Make????.??? Makefile.?? \ - descrip.mms *.[ch] - -tgz: - cd ..; tar cfz zlib/zlib.tgz zlib/README zlib/ChangeLog zlib/Makefile \ - zlib/Make????.??? zlib/Makefile.?? zlib/descrip.mms zlib/*.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: crc32.h zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/common/dist/zlib/amiga/Makefile.sas b/common/dist/zlib/amiga/Makefile.sas deleted file mode 100644 index 296ef48a2..000000000 --- a/common/dist/zlib/amiga/Makefile.sas +++ /dev/null @@ -1,65 +0,0 @@ -# SMakefile for zlib -# Modified from the standard UNIX Makefile Copyright Jean-loup Gailly -# Osma Ahvenlampi -# Amiga, SAS/C 6.56 & Smake - -CC=sc -CFLAGS=OPT -#CFLAGS=OPT CPU=68030 -#CFLAGS=DEBUG=LINE -LDFLAGS=LIB z.lib - -SCOPTIONS=OPTSCHED OPTINLINE OPTALIAS OPTTIME OPTINLOCAL STRMERGE \ - NOICONS PARMS=BOTH NOSTACKCHECK UTILLIB NOVERSION ERRORREXX \ - DEF=POSTINC - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -TEST_OBJS = example.o minigzip.o - -all: SCOPTIONS example minigzip - -check: test -test: all - example - echo hello world | minigzip | minigzip -d - -install: z.lib - copy clone zlib.h zconf.h INCLUDE: - copy clone z.lib LIB: - -z.lib: $(OBJS) - oml z.lib r $(OBJS) - -example: example.o z.lib - $(CC) $(CFLAGS) LINK TO $@ example.o $(LDFLAGS) - -minigzip: minigzip.o z.lib - $(CC) $(CFLAGS) LINK TO $@ minigzip.o $(LDFLAGS) - -mostlyclean: clean -clean: - -delete force quiet example minigzip *.o z.lib foo.gz *.lnk SCOPTIONS - -SCOPTIONS: Makefile.sas - copy to $@ $test.c </dev/null; then - CC="$cc" - SFLAGS=${CFLAGS-"-fPIC -O3"} - CFLAGS="$cflags" - case `(uname -s || echo unknown) 2>/dev/null` in - Linux | linux | GNU | GNU/*) LDSHARED=${LDSHARED-"$cc -shared -Wl,-soname,libz.so.1"};; - CYGWIN* | Cygwin* | cygwin* | OS/2* ) - EXE='.exe';; - QNX*) # This is for QNX6. I suppose that the QNX rule below is for QNX2,QNX4 - # (alain.bonnefoy@icbt.com) - LDSHARED=${LDSHARED-"$cc -shared -Wl,-hlibz.so.1"};; - HP-UX*) - LDSHARED=${LDSHARED-"$cc -shared $SFLAGS"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so';; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl';; - esac;; - Darwin*) shared_ext='.dylib' - SHAREDLIB=libz$shared_ext - SHAREDLIBV=libz.$VER$shared_ext - SHAREDLIBM=libz.$VER1$shared_ext - LDSHARED=${LDSHARED-"$cc -dynamiclib -install_name $libdir/$SHAREDLIBM -compatibility_version $VER1 -current_version $VER"};; - *) LDSHARED=${LDSHARED-"$cc -shared"};; - esac -else - # find system name and corresponding cc options - CC=${CC-cc} - case `(uname -sr || echo unknown) 2>/dev/null` in - HP-UX*) SFLAGS=${CFLAGS-"-O +z"} - CFLAGS=${CFLAGS-"-O"} -# LDSHARED=${LDSHARED-"ld -b +vnocompatwarnings"} - LDSHARED=${LDSHARED-"ld -b"} - case `(uname -m || echo unknown) 2>/dev/null` in - ia64) - shared_ext='.so' - SHAREDLIB='libz.so';; - *) - shared_ext='.sl' - SHAREDLIB='libz.sl';; - esac;; - IRIX*) SFLAGS=${CFLAGS-"-ansi -O2 -rpath ."} - CFLAGS=${CFLAGS-"-ansi -O2"} - LDSHARED=${LDSHARED-"cc -shared"};; - OSF1\ V4*) SFLAGS=${CFLAGS-"-O -std1"} - CFLAGS=${CFLAGS-"-O -std1"} - LDSHARED=${LDSHARED-"cc -shared -Wl,-soname,libz.so -Wl,-msym -Wl,-rpath,$(libdir) -Wl,-set_version,${VER}:1.0"};; - OSF1*) SFLAGS=${CFLAGS-"-O -std1"} - CFLAGS=${CFLAGS-"-O -std1"} - LDSHARED=${LDSHARED-"cc -shared"};; - QNX*) SFLAGS=${CFLAGS-"-4 -O"} - CFLAGS=${CFLAGS-"-4 -O"} - LDSHARED=${LDSHARED-"cc"} - RANLIB=${RANLIB-"true"} - AR="cc -A";; - SCO_SV\ 3.2*) SFLAGS=${CFLAGS-"-O3 -dy -KPIC "} - CFLAGS=${CFLAGS-"-O3"} - LDSHARED=${LDSHARED-"cc -dy -KPIC -G"};; - SunOS\ 5*) SFLAGS=${CFLAGS-"-fast -xcg89 -KPIC -R."} - CFLAGS=${CFLAGS-"-fast -xcg89"} - LDSHARED=${LDSHARED-"cc -G"};; - SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"} - CFLAGS=${CFLAGS-"-O2"} - LDSHARED=${LDSHARED-"ld"};; - SunStudio\ 9*) SFLAGS=${CFLAGS-"-DUSE_MMAP -fast -xcode=pic32 -xtarget=ultra3 -xarch=v9b"} - CFLAGS=${CFLAGS-"-DUSE_MMAP -fast -xtarget=ultra3 -xarch=v9b"} - LDSHARED=${LDSHARED-"cc -xarch=v9b"};; - UNIX_System_V\ 4.2.0) - SFLAGS=${CFLAGS-"-KPIC -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"};; - UNIX_SV\ 4.2MP) - SFLAGS=${CFLAGS-"-Kconform_pic -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"};; - OpenUNIX\ 5) - SFLAGS=${CFLAGS-"-KPIC -O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -G"};; - AIX*) # Courtesy of dbakker@arrayasolutions.com - SFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - CFLAGS=${CFLAGS-"-O -qmaxmem=8192"} - LDSHARED=${LDSHARED-"xlc -G"};; - # send working options for other systems to support@gzip.org - *) SFLAGS=${CFLAGS-"-O"} - CFLAGS=${CFLAGS-"-O"} - LDSHARED=${LDSHARED-"cc -shared"};; - esac -fi - -SHAREDLIB=${SHAREDLIB-"libz$shared_ext"} -SHAREDLIBV=${SHAREDLIBV-"libz$shared_ext.$VER"} -SHAREDLIBM=${SHAREDLIBM-"libz$shared_ext.$VER1"} - -if test $shared -eq 1; then - echo Checking for shared library support... - # we must test in two steps (cc then ld), required at least on SunOS 4.x - if test "`($CC -c $SFLAGS $test.c) 2>&1`" = "" && - test "`($LDSHARED -o $test$shared_ext $test.o) 2>&1`" = ""; then - CFLAGS="$SFLAGS" - LIBS="$SHAREDLIBV" - echo Building shared library $SHAREDLIBV with $CC. - elif test -z "$old_cc" -a -z "$old_cflags"; then - echo No shared library support. - shared=0; - else - echo 'No shared library support; try without defining CC and CFLAGS' - shared=0; - fi -fi -if test $shared -eq 0; then - LDSHARED="$CC" - echo Building static library $LIBS version $VER with $CC. -else - LDFLAGS="-L. ${SHAREDLIBV}" -fi - -cat > $test.c < -int main() { return 0; } -EOF -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - sed < zconf.in.h "/HAVE_UNISTD_H/s%0%1%" > zconf.h - echo "Checking for unistd.h... Yes." -else - cp -p zconf.in.h zconf.h - echo "Checking for unistd.h... No." -fi - -cat > $test.c < -#include -#include "zconf.h" - -int main() -{ -#ifndef STDC - choke me -#endif - - return 0; -} -EOF - -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking whether to use vs[n]printf() or s[n]printf()... using vs[n]printf()" - - cat > $test.c < -#include - -int mytest(char *fmt, ...) -{ - char buf[20]; - va_list ap; - - va_start(ap, fmt); - vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return 0; -} - -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then - echo "Checking for vsnprintf() in stdio.h... Yes." - - cat >$test.c < -#include - -int mytest(char *fmt, ...) -{ - int n; - char buf[20]; - va_list ap; - - va_start(ap, fmt); - n = vsnprintf(buf, sizeof(buf), fmt, ap); - va_end(ap); - return n; -} - -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for return value of vsnprintf()... Yes." - else - CFLAGS="$CFLAGS -DHAS_vsnprintf_void" - echo "Checking for return value of vsnprintf()... No." - echo " WARNING: apparently vsnprintf() does not return a value. zlib" - echo " can build but will be open to possible string-format security" - echo " vulnerabilities." - fi - else - CFLAGS="$CFLAGS -DNO_vsnprintf" - echo "Checking for vsnprintf() in stdio.h... No." - echo " WARNING: vsnprintf() not found, falling back to vsprintf(). zlib" - echo " can build but will be open to possible buffer-overflow security" - echo " vulnerabilities." - - cat >$test.c < -#include - -int mytest(char *fmt, ...) -{ - int n; - char buf[20]; - va_list ap; - - va_start(ap, fmt); - n = vsprintf(buf, fmt, ap); - va_end(ap); - return n; -} - -int main() -{ - return (mytest("Hello%d\n", 1)); -} -EOF - - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for return value of vsprintf()... Yes." - else - CFLAGS="$CFLAGS -DHAS_vsprintf_void" - echo "Checking for return value of vsprintf()... No." - echo " WARNING: apparently vsprintf() does not return a value. zlib" - echo " can build but will be open to possible string-format security" - echo " vulnerabilities." - fi - fi -else - echo "Checking whether to use vs[n]printf() or s[n]printf()... using s[n]printf()" - - cat >$test.c < - -int mytest() -{ - char buf[20]; - - snprintf(buf, sizeof(buf), "%s", "foo"); - return 0; -} - -int main() -{ - return (mytest()); -} -EOF - - if test "`($CC $CFLAGS -o $test $test.c) 2>&1`" = ""; then - echo "Checking for snprintf() in stdio.h... Yes." - - cat >$test.c < - -int mytest() -{ - char buf[20]; - - return snprintf(buf, sizeof(buf), "%s", "foo"); -} - -int main() -{ - return (mytest()); -} -EOF - - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for return value of snprintf()... Yes." - else - CFLAGS="$CFLAGS -DHAS_snprintf_void" - echo "Checking for return value of snprintf()... No." - echo " WARNING: apparently snprintf() does not return a value. zlib" - echo " can build but will be open to possible string-format security" - echo " vulnerabilities." - fi - else - CFLAGS="$CFLAGS -DNO_snprintf" - echo "Checking for snprintf() in stdio.h... No." - echo " WARNING: snprintf() not found, falling back to sprintf(). zlib" - echo " can build but will be open to possible buffer-overflow security" - echo " vulnerabilities." - - cat >$test.c < - -int mytest() -{ - char buf[20]; - - return sprintf(buf, "%s", "foo"); -} - -int main() -{ - return (mytest()); -} -EOF - - if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for return value of sprintf()... Yes." - else - CFLAGS="$CFLAGS -DHAS_sprintf_void" - echo "Checking for return value of sprintf()... No." - echo " WARNING: apparently sprintf() does not return a value. zlib" - echo " can build but will be open to possible string-format security" - echo " vulnerabilities." - fi - fi -fi - -cat >$test.c < -int main() { return 0; } -EOF -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - echo "Checking for errno.h... Yes." -else - echo "Checking for errno.h... No." - CFLAGS="$CFLAGS -DNO_ERRNO_H" -fi - -cat > $test.c < -#include -#include -caddr_t hello() { - return mmap((caddr_t)0, (off_t)0, PROT_READ, MAP_SHARED, 0, (off_t)0); -} -EOF -if test "`($CC -c $CFLAGS $test.c) 2>&1`" = ""; then - CFLAGS="$CFLAGS -DUSE_MMAP" - echo Checking for mmap support... Yes. -else - echo Checking for mmap support... No. -fi - -CPP=${CPP-"$CC -E"} -case $CFLAGS in - *ASMV*) - if test "`nm $test.o | grep _hello`" = ""; then - CPP="$CPP -DNO_UNDERLINE" - echo Checking for underline in external names... No. - else - echo Checking for underline in external names... Yes. - fi;; -esac - -rm -f $test.[co] $test $test$shared_ext - -# udpate Makefile -sed < Makefile.in " -/^CC *=/s#=.*#=$CC# -/^CFLAGS *=/s#=.*#=$CFLAGS# -/^CPP *=/s#=.*#=$CPP# -/^LDSHARED *=/s#=.*#=$LDSHARED# -/^LIBS *=/s#=.*#=$LIBS# -/^SHAREDLIB *=/s#=.*#=$SHAREDLIB# -/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV# -/^SHAREDLIBM *=/s#=.*#=$SHAREDLIBM# -/^AR *=/s#=.*#=$AR# -/^RANLIB *=/s#=.*#=$RANLIB# -/^EXE *=/s#=.*#=$EXE# -/^prefix *=/s#=.*#=$prefix# -/^exec_prefix *=/s#=.*#=$exec_prefix# -/^libdir *=/s#=.*#=$libdir# -/^includedir *=/s#=.*#=$includedir# -/^mandir *=/s#=.*#=$mandir# -/^LDFLAGS *=/s#=.*#=$LDFLAGS# -" > Makefile diff --git a/common/dist/zlib/contrib/README.contrib b/common/dist/zlib/contrib/README.contrib deleted file mode 100644 index 20afc6215..000000000 --- a/common/dist/zlib/contrib/README.contrib +++ /dev/null @@ -1,71 +0,0 @@ -All files under this contrib directory are UNSUPPORTED. There were -provided by users of zlib and were not tested by the authors of zlib. -Use at your own risk. Please contact the authors of the contributions -for help about these, not the zlib authors. Thanks. - - -ada/ by Dmitriy Anisimkov - Support for Ada - See http://zlib-ada.sourceforge.net/ - -asm586/ -asm686/ by Brian Raiter - asm code for Pentium and PPro/PII, using the AT&T (GNU as) syntax - See http://www.muppetlabs.com/~breadbox/software/assembly.html - -blast/ by Mark Adler - Decompressor for output of PKWare Data Compression Library (DCL) - -delphi/ by Cosmin Truta - Support for Delphi and C++ Builder - -dotzlib/ by Henrik Ravn - Support for Microsoft .Net and Visual C++ .Net - -infback9/ by Mark Adler - Unsupported diffs to infback to decode the deflate64 format - -inflate86/ by Chris Anderson - Tuned x86 gcc asm code to replace inflate_fast() - -iostream/ by Kevin Ruland - A C++ I/O streams interface to the zlib gz* functions - -iostream2/ by Tyge Løvset - Another C++ I/O streams interface - -iostream3/ by Ludwig Schwardt - and Kevin Ruland - Yet another C++ I/O streams interface - -masm686/ by Dan Higdon - and Chuck Walbourn - asm code for Pentium Pro/PII, using the MASM syntax - -masmx64/ by Gilles Vollant - x86 64-bit (AMD64 and Intel EM64t) code for x64 assembler to - replace longest_match() and inflate_fast() - -masmx86/ by Gilles Vollant - x86 asm code to replace longest_match() and inflate_fast(), - for Visual C++ and MASM - -minizip/ by Gilles Vollant - Mini zip and unzip based on zlib - See http://www.winimage.com/zLibDll/unzip.html - -pascal/ by Bob Dellaca et al. - Support for Pascal - -puff/ by Mark Adler - Small, low memory usage inflate. Also serves to provide an - unambiguous description of the deflate format. - -testzlib/ by Gilles Vollant - Example of the use of zlib - -untgz/ by Pedro A. Aranda Gutierrez - A very simple tar.gz file extractor using zlib - -vstudio/ by Gilles Vollant - Building a minizip-enhanced zlib with Microsoft Visual Studio diff --git a/common/dist/zlib/contrib/ada/buffer_demo.adb b/common/dist/zlib/contrib/ada/buffer_demo.adb deleted file mode 100644 index 3246d4527..000000000 --- a/common/dist/zlib/contrib/ada/buffer_demo.adb +++ /dev/null @@ -1,106 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2004 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- --- --- Id: buffer_demo.adb,v 1.3 2004/09/06 06:55:35 vagul Exp - --- This demo program provided by Dr Steve Sangwine --- --- Demonstration of a problem with Zlib-Ada (already fixed) when a buffer --- of exactly the correct size is used for decompressed data, and the last --- few bytes passed in to Zlib are checksum bytes. - --- This program compresses a string of text, and then decompresses the --- compressed text into a buffer of the same size as the original text. - -with Ada.Streams; use Ada.Streams; -with Ada.Text_IO; - -with ZLib; use ZLib; - -procedure Buffer_Demo is - EOL : Character renames ASCII.LF; - Text : constant String - := "Four score and seven years ago our fathers brought forth," & EOL & - "upon this continent, a new nation, conceived in liberty," & EOL & - "and dedicated to the proposition that `all men are created equal'."; - - Source : Stream_Element_Array (1 .. Text'Length); - for Source'Address use Text'Address; - -begin - Ada.Text_IO.Put (Text); - Ada.Text_IO.New_Line; - Ada.Text_IO.Put_Line - ("Uncompressed size : " & Positive'Image (Text'Length) & " bytes"); - - declare - Compressed_Data : Stream_Element_Array (1 .. Text'Length); - L : Stream_Element_Offset; - begin - Compress : declare - Compressor : Filter_Type; - I : Stream_Element_Offset; - begin - Deflate_Init (Compressor); - - -- Compress the whole of T at once. - - Translate (Compressor, Source, I, Compressed_Data, L, Finish); - pragma Assert (I = Source'Last); - - Close (Compressor); - - Ada.Text_IO.Put_Line - ("Compressed size : " - & Stream_Element_Offset'Image (L) & " bytes"); - end Compress; - - -- Now we decompress the data, passing short blocks of data to Zlib - -- (because this demonstrates the problem - the last block passed will - -- contain checksum information and there will be no output, only a - -- check inside Zlib that the checksum is correct). - - Decompress : declare - Decompressor : Filter_Type; - - Uncompressed_Data : Stream_Element_Array (1 .. Text'Length); - - Block_Size : constant := 4; - -- This makes sure that the last block contains - -- only Adler checksum data. - - P : Stream_Element_Offset := Compressed_Data'First - 1; - O : Stream_Element_Offset; - begin - Inflate_Init (Decompressor); - - loop - Translate - (Decompressor, - Compressed_Data - (P + 1 .. Stream_Element_Offset'Min (P + Block_Size, L)), - P, - Uncompressed_Data - (Total_Out (Decompressor) + 1 .. Uncompressed_Data'Last), - O, - No_Flush); - - Ada.Text_IO.Put_Line - ("Total in : " & Count'Image (Total_In (Decompressor)) & - ", out : " & Count'Image (Total_Out (Decompressor))); - - exit when P = L; - end loop; - - Ada.Text_IO.New_Line; - Ada.Text_IO.Put_Line - ("Decompressed text matches original text : " - & Boolean'Image (Uncompressed_Data = Source)); - end Decompress; - end; -end Buffer_Demo; diff --git a/common/dist/zlib/contrib/ada/mtest.adb b/common/dist/zlib/contrib/ada/mtest.adb deleted file mode 100644 index e9470c0be..000000000 --- a/common/dist/zlib/contrib/ada/mtest.adb +++ /dev/null @@ -1,156 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- --- Continuous test for ZLib multithreading. If the test would fail --- we should provide thread safe allocation routines for the Z_Stream. --- --- Id: mtest.adb,v 1.4 2004/07/23 07:49:54 vagul Exp - -with ZLib; -with Ada.Streams; -with Ada.Numerics.Discrete_Random; -with Ada.Text_IO; -with Ada.Exceptions; -with Ada.Task_Identification; - -procedure MTest is - use Ada.Streams; - use ZLib; - - Stop : Boolean := False; - - pragma Atomic (Stop); - - subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; - - package Random_Elements is - new Ada.Numerics.Discrete_Random (Visible_Symbols); - - task type Test_Task; - - task body Test_Task is - Buffer : Stream_Element_Array (1 .. 100_000); - Gen : Random_Elements.Generator; - - Buffer_First : Stream_Element_Offset; - Compare_First : Stream_Element_Offset; - - Deflate : Filter_Type; - Inflate : Filter_Type; - - procedure Further (Item : in Stream_Element_Array); - - procedure Read_Buffer - (Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); - - ------------- - -- Further -- - ------------- - - procedure Further (Item : in Stream_Element_Array) is - - procedure Compare (Item : in Stream_Element_Array); - - ------------- - -- Compare -- - ------------- - - procedure Compare (Item : in Stream_Element_Array) is - Next_First : Stream_Element_Offset := Compare_First + Item'Length; - begin - if Buffer (Compare_First .. Next_First - 1) /= Item then - raise Program_Error; - end if; - - Compare_First := Next_First; - end Compare; - - procedure Compare_Write is new ZLib.Write (Write => Compare); - begin - Compare_Write (Inflate, Item, No_Flush); - end Further; - - ----------------- - -- Read_Buffer -- - ----------------- - - procedure Read_Buffer - (Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset) - is - Buff_Diff : Stream_Element_Offset := Buffer'Last - Buffer_First; - Next_First : Stream_Element_Offset; - begin - if Item'Length <= Buff_Diff then - Last := Item'Last; - - Next_First := Buffer_First + Item'Length; - - Item := Buffer (Buffer_First .. Next_First - 1); - - Buffer_First := Next_First; - else - Last := Item'First + Buff_Diff; - Item (Item'First .. Last) := Buffer (Buffer_First .. Buffer'Last); - Buffer_First := Buffer'Last + 1; - end if; - end Read_Buffer; - - procedure Translate is new Generic_Translate - (Data_In => Read_Buffer, - Data_Out => Further); - - begin - Random_Elements.Reset (Gen); - - Buffer := (others => 20); - - Main : loop - for J in Buffer'Range loop - Buffer (J) := Random_Elements.Random (Gen); - - Deflate_Init (Deflate); - Inflate_Init (Inflate); - - Buffer_First := Buffer'First; - Compare_First := Buffer'First; - - Translate (Deflate); - - if Compare_First /= Buffer'Last + 1 then - raise Program_Error; - end if; - - Ada.Text_IO.Put_Line - (Ada.Task_Identification.Image - (Ada.Task_Identification.Current_Task) - & Stream_Element_Offset'Image (J) - & ZLib.Count'Image (Total_Out (Deflate))); - - Close (Deflate); - Close (Inflate); - - exit Main when Stop; - end loop; - end loop Main; - exception - when E : others => - Ada.Text_IO.Put_Line (Ada.Exceptions.Exception_Information (E)); - Stop := True; - end Test_Task; - - Test : array (1 .. 4) of Test_Task; - - pragma Unreferenced (Test); - - Dummy : Character; - -begin - Ada.Text_IO.Get_Immediate (Dummy); - Stop := True; -end MTest; diff --git a/common/dist/zlib/contrib/ada/read.adb b/common/dist/zlib/contrib/ada/read.adb deleted file mode 100644 index 909a62390..000000000 --- a/common/dist/zlib/contrib/ada/read.adb +++ /dev/null @@ -1,156 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- Id: read.adb,v 1.8 2004/05/31 10:53:40 vagul Exp - --- Test/demo program for the generic read interface. - -with Ada.Numerics.Discrete_Random; -with Ada.Streams; -with Ada.Text_IO; - -with ZLib; - -procedure Read is - - use Ada.Streams; - - ------------------------------------ - -- Test configuration parameters -- - ------------------------------------ - - File_Size : Stream_Element_Offset := 100_000; - - Continuous : constant Boolean := False; - -- If this constant is True, the test would be repeated again and again, - -- with increment File_Size for every iteration. - - Header : constant ZLib.Header_Type := ZLib.Default; - -- Do not use Header other than Default in ZLib versions 1.1.4 and older. - - Init_Random : constant := 8; - -- We are using the same random sequence, in case of we catch bug, - -- so we would be able to reproduce it. - - -- End -- - - Pack_Size : Stream_Element_Offset; - Offset : Stream_Element_Offset; - - Filter : ZLib.Filter_Type; - - subtype Visible_Symbols - is Stream_Element range 16#20# .. 16#7E#; - - package Random_Elements is new - Ada.Numerics.Discrete_Random (Visible_Symbols); - - Gen : Random_Elements.Generator; - Period : constant Stream_Element_Offset := 200; - -- Period constant variable for random generator not to be very random. - -- Bigger period, harder random. - - Read_Buffer : Stream_Element_Array (1 .. 2048); - Read_First : Stream_Element_Offset; - Read_Last : Stream_Element_Offset; - - procedure Reset; - - procedure Read - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset); - -- this procedure is for generic instantiation of - -- ZLib.Read - -- reading data from the File_In. - - procedure Read is new ZLib.Read - (Read, - Read_Buffer, - Rest_First => Read_First, - Rest_Last => Read_Last); - - ---------- - -- Read -- - ---------- - - procedure Read - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset) is - begin - Last := Stream_Element_Offset'Min - (Item'Last, - Item'First + File_Size - Offset); - - for J in Item'First .. Last loop - if J < Item'First + Period then - Item (J) := Random_Elements.Random (Gen); - else - Item (J) := Item (J - Period); - end if; - - Offset := Offset + 1; - end loop; - end Read; - - ----------- - -- Reset -- - ----------- - - procedure Reset is - begin - Random_Elements.Reset (Gen, Init_Random); - Pack_Size := 0; - Offset := 1; - Read_First := Read_Buffer'Last + 1; - Read_Last := Read_Buffer'Last; - end Reset; - -begin - Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version); - - loop - for Level in ZLib.Compression_Level'Range loop - - Ada.Text_IO.Put ("Level =" - & ZLib.Compression_Level'Image (Level)); - - -- Deflate using generic instantiation. - - ZLib.Deflate_Init - (Filter, - Level, - Header => Header); - - Reset; - - Ada.Text_IO.Put - (Stream_Element_Offset'Image (File_Size) & " ->"); - - loop - declare - Buffer : Stream_Element_Array (1 .. 1024); - Last : Stream_Element_Offset; - begin - Read (Filter, Buffer, Last); - - Pack_Size := Pack_Size + Last - Buffer'First + 1; - - exit when Last < Buffer'Last; - end; - end loop; - - Ada.Text_IO.Put_Line (Stream_Element_Offset'Image (Pack_Size)); - - ZLib.Close (Filter); - end loop; - - exit when not Continuous; - - File_Size := File_Size + 1; - end loop; -end Read; diff --git a/common/dist/zlib/contrib/ada/readme.txt b/common/dist/zlib/contrib/ada/readme.txt deleted file mode 100644 index ce4d2cadf..000000000 --- a/common/dist/zlib/contrib/ada/readme.txt +++ /dev/null @@ -1,65 +0,0 @@ - ZLib for Ada thick binding (ZLib.Ada) - Release 1.3 - -ZLib.Ada is a thick binding interface to the popular ZLib data -compression library, available at http://www.gzip.org/zlib/. -It provides Ada-style access to the ZLib C library. - - - Here are the main changes since ZLib.Ada 1.2: - -- Attension: ZLib.Read generic routine have a initialization requirement - for Read_Last parameter now. It is a bit incompartible with previous version, - but extends functionality, we could use new parameters Allow_Read_Some and - Flush now. - -- Added Is_Open routines to ZLib and ZLib.Streams packages. - -- Add pragma Assert to check Stream_Element is 8 bit. - -- Fix extraction to buffer with exact known decompressed size. Error reported by - Steve Sangwine. - -- Fix definition of ULong (changed to unsigned_long), fix regression on 64 bits - computers. Patch provided by Pascal Obry. - -- Add Status_Error exception definition. - -- Add pragma Assertion that Ada.Streams.Stream_Element size is 8 bit. - - - How to build ZLib.Ada under GNAT - -You should have the ZLib library already build on your computer, before -building ZLib.Ada. Make the directory of ZLib.Ada sources current and -issue the command: - - gnatmake test -largs -L -lz - -Or use the GNAT project file build for GNAT 3.15 or later: - - gnatmake -Pzlib.gpr -L - - - How to build ZLib.Ada under Aonix ObjectAda for Win32 7.2.2 - -1. Make a project with all *.ads and *.adb files from the distribution. -2. Build the libz.a library from the ZLib C sources. -3. Rename libz.a to z.lib. -4. Add the library z.lib to the project. -5. Add the libc.lib library from the ObjectAda distribution to the project. -6. Build the executable using test.adb as a main procedure. - - - How to use ZLib.Ada - -The source files test.adb and read.adb are small demo programs that show -the main functionality of ZLib.Ada. - -The routines from the package specifications are commented. - - -Homepage: http://zlib-ada.sourceforge.net/ -Author: Dmitriy Anisimkov - -Contributors: Pascal Obry , Steve Sangwine diff --git a/common/dist/zlib/contrib/ada/test.adb b/common/dist/zlib/contrib/ada/test.adb deleted file mode 100644 index d2301bad9..000000000 --- a/common/dist/zlib/contrib/ada/test.adb +++ /dev/null @@ -1,463 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- Id: test.adb,v 1.17 2003/08/12 12:13:30 vagul Exp - --- The program has a few aims. --- 1. Test ZLib.Ada95 thick binding functionality. --- 2. Show the example of use main functionality of the ZLib.Ada95 binding. --- 3. Build this program automatically compile all ZLib.Ada95 packages under --- GNAT Ada95 compiler. - -with ZLib.Streams; -with Ada.Streams.Stream_IO; -with Ada.Numerics.Discrete_Random; - -with Ada.Text_IO; - -with Ada.Calendar; - -procedure Test is - - use Ada.Streams; - use Stream_IO; - - ------------------------------------ - -- Test configuration parameters -- - ------------------------------------ - - File_Size : Count := 100_000; - Continuous : constant Boolean := False; - - Header : constant ZLib.Header_Type := ZLib.Default; - -- ZLib.None; - -- ZLib.Auto; - -- ZLib.GZip; - -- Do not use Header other then Default in ZLib versions 1.1.4 - -- and older. - - Strategy : constant ZLib.Strategy_Type := ZLib.Default_Strategy; - Init_Random : constant := 10; - - -- End -- - - In_File_Name : constant String := "testzlib.in"; - -- Name of the input file - - Z_File_Name : constant String := "testzlib.zlb"; - -- Name of the compressed file. - - Out_File_Name : constant String := "testzlib.out"; - -- Name of the decompressed file. - - File_In : File_Type; - File_Out : File_Type; - File_Back : File_Type; - File_Z : ZLib.Streams.Stream_Type; - - Filter : ZLib.Filter_Type; - - Time_Stamp : Ada.Calendar.Time; - - procedure Generate_File; - -- Generate file of spetsified size with some random data. - -- The random data is repeatable, for the good compression. - - procedure Compare_Streams - (Left, Right : in out Root_Stream_Type'Class); - -- The procedure compearing data in 2 streams. - -- It is for compare data before and after compression/decompression. - - procedure Compare_Files (Left, Right : String); - -- Compare files. Based on the Compare_Streams. - - procedure Copy_Streams - (Source, Target : in out Root_Stream_Type'Class; - Buffer_Size : in Stream_Element_Offset := 1024); - -- Copying data from one stream to another. It is for test stream - -- interface of the library. - - procedure Data_In - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset); - -- this procedure is for generic instantiation of - -- ZLib.Generic_Translate. - -- reading data from the File_In. - - procedure Data_Out (Item : in Stream_Element_Array); - -- this procedure is for generic instantiation of - -- ZLib.Generic_Translate. - -- writing data to the File_Out. - - procedure Stamp; - -- Store the timestamp to the local variable. - - procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count); - -- Print the time statistic with the message. - - procedure Translate is new ZLib.Generic_Translate - (Data_In => Data_In, - Data_Out => Data_Out); - -- This procedure is moving data from File_In to File_Out - -- with compression or decompression, depend on initialization of - -- Filter parameter. - - ------------------- - -- Compare_Files -- - ------------------- - - procedure Compare_Files (Left, Right : String) is - Left_File, Right_File : File_Type; - begin - Open (Left_File, In_File, Left); - Open (Right_File, In_File, Right); - Compare_Streams (Stream (Left_File).all, Stream (Right_File).all); - Close (Left_File); - Close (Right_File); - end Compare_Files; - - --------------------- - -- Compare_Streams -- - --------------------- - - procedure Compare_Streams - (Left, Right : in out Ada.Streams.Root_Stream_Type'Class) - is - Left_Buffer, Right_Buffer : Stream_Element_Array (0 .. 16#FFF#); - Left_Last, Right_Last : Stream_Element_Offset; - begin - loop - Read (Left, Left_Buffer, Left_Last); - Read (Right, Right_Buffer, Right_Last); - - if Left_Last /= Right_Last then - Ada.Text_IO.Put_Line ("Compare error :" - & Stream_Element_Offset'Image (Left_Last) - & " /= " - & Stream_Element_Offset'Image (Right_Last)); - - raise Constraint_Error; - - elsif Left_Buffer (0 .. Left_Last) - /= Right_Buffer (0 .. Right_Last) - then - Ada.Text_IO.Put_Line ("ERROR: IN and OUT files is not equal."); - raise Constraint_Error; - - end if; - - exit when Left_Last < Left_Buffer'Last; - end loop; - end Compare_Streams; - - ------------------ - -- Copy_Streams -- - ------------------ - - procedure Copy_Streams - (Source, Target : in out Ada.Streams.Root_Stream_Type'Class; - Buffer_Size : in Stream_Element_Offset := 1024) - is - Buffer : Stream_Element_Array (1 .. Buffer_Size); - Last : Stream_Element_Offset; - begin - loop - Read (Source, Buffer, Last); - Write (Target, Buffer (1 .. Last)); - - exit when Last < Buffer'Last; - end loop; - end Copy_Streams; - - ------------- - -- Data_In -- - ------------- - - procedure Data_In - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset) is - begin - Read (File_In, Item, Last); - end Data_In; - - -------------- - -- Data_Out -- - -------------- - - procedure Data_Out (Item : in Stream_Element_Array) is - begin - Write (File_Out, Item); - end Data_Out; - - ------------------- - -- Generate_File -- - ------------------- - - procedure Generate_File is - subtype Visible_Symbols is Stream_Element range 16#20# .. 16#7E#; - - package Random_Elements is - new Ada.Numerics.Discrete_Random (Visible_Symbols); - - Gen : Random_Elements.Generator; - Buffer : Stream_Element_Array := (1 .. 77 => 16#20#) & 10; - - Buffer_Count : constant Count := File_Size / Buffer'Length; - -- Number of same buffers in the packet. - - Density : constant Count := 30; -- from 0 to Buffer'Length - 2; - - procedure Fill_Buffer (J, D : in Count); - -- Change the part of the buffer. - - ----------------- - -- Fill_Buffer -- - ----------------- - - procedure Fill_Buffer (J, D : in Count) is - begin - for K in 0 .. D loop - Buffer - (Stream_Element_Offset ((J + K) mod (Buffer'Length - 1) + 1)) - := Random_Elements.Random (Gen); - - end loop; - end Fill_Buffer; - - begin - Random_Elements.Reset (Gen, Init_Random); - - Create (File_In, Out_File, In_File_Name); - - Fill_Buffer (1, Buffer'Length - 2); - - for J in 1 .. Buffer_Count loop - Write (File_In, Buffer); - - Fill_Buffer (J, Density); - end loop; - - -- fill remain size. - - Write - (File_In, - Buffer - (1 .. Stream_Element_Offset - (File_Size - Buffer'Length * Buffer_Count))); - - Flush (File_In); - Close (File_In); - end Generate_File; - - --------------------- - -- Print_Statistic -- - --------------------- - - procedure Print_Statistic (Msg : String; Data_Size : ZLib.Count) is - use Ada.Calendar; - use Ada.Text_IO; - - package Count_IO is new Integer_IO (ZLib.Count); - - Curr_Dur : Duration := Clock - Time_Stamp; - begin - Put (Msg); - - Set_Col (20); - Ada.Text_IO.Put ("size ="); - - Count_IO.Put - (Data_Size, - Width => Stream_IO.Count'Image (File_Size)'Length); - - Put_Line (" duration =" & Duration'Image (Curr_Dur)); - end Print_Statistic; - - ----------- - -- Stamp -- - ----------- - - procedure Stamp is - begin - Time_Stamp := Ada.Calendar.Clock; - end Stamp; - -begin - Ada.Text_IO.Put_Line ("ZLib " & ZLib.Version); - - loop - Generate_File; - - for Level in ZLib.Compression_Level'Range loop - - Ada.Text_IO.Put_Line ("Level =" - & ZLib.Compression_Level'Image (Level)); - - -- Test generic interface. - Open (File_In, In_File, In_File_Name); - Create (File_Out, Out_File, Z_File_Name); - - Stamp; - - -- Deflate using generic instantiation. - - ZLib.Deflate_Init - (Filter => Filter, - Level => Level, - Strategy => Strategy, - Header => Header); - - Translate (Filter); - Print_Statistic ("Generic compress", ZLib.Total_Out (Filter)); - ZLib.Close (Filter); - - Close (File_In); - Close (File_Out); - - Open (File_In, In_File, Z_File_Name); - Create (File_Out, Out_File, Out_File_Name); - - Stamp; - - -- Inflate using generic instantiation. - - ZLib.Inflate_Init (Filter, Header => Header); - - Translate (Filter); - Print_Statistic ("Generic decompress", ZLib.Total_Out (Filter)); - - ZLib.Close (Filter); - - Close (File_In); - Close (File_Out); - - Compare_Files (In_File_Name, Out_File_Name); - - -- Test stream interface. - - -- Compress to the back stream. - - Open (File_In, In_File, In_File_Name); - Create (File_Back, Out_File, Z_File_Name); - - Stamp; - - ZLib.Streams.Create - (Stream => File_Z, - Mode => ZLib.Streams.Out_Stream, - Back => ZLib.Streams.Stream_Access - (Stream (File_Back)), - Back_Compressed => True, - Level => Level, - Strategy => Strategy, - Header => Header); - - Copy_Streams - (Source => Stream (File_In).all, - Target => File_Z); - - -- Flushing internal buffers to the back stream. - - ZLib.Streams.Flush (File_Z, ZLib.Finish); - - Print_Statistic ("Write compress", - ZLib.Streams.Write_Total_Out (File_Z)); - - ZLib.Streams.Close (File_Z); - - Close (File_In); - Close (File_Back); - - -- Compare reading from original file and from - -- decompression stream. - - Open (File_In, In_File, In_File_Name); - Open (File_Back, In_File, Z_File_Name); - - ZLib.Streams.Create - (Stream => File_Z, - Mode => ZLib.Streams.In_Stream, - Back => ZLib.Streams.Stream_Access - (Stream (File_Back)), - Back_Compressed => True, - Header => Header); - - Stamp; - Compare_Streams (Stream (File_In).all, File_Z); - - Print_Statistic ("Read decompress", - ZLib.Streams.Read_Total_Out (File_Z)); - - ZLib.Streams.Close (File_Z); - Close (File_In); - Close (File_Back); - - -- Compress by reading from compression stream. - - Open (File_Back, In_File, In_File_Name); - Create (File_Out, Out_File, Z_File_Name); - - ZLib.Streams.Create - (Stream => File_Z, - Mode => ZLib.Streams.In_Stream, - Back => ZLib.Streams.Stream_Access - (Stream (File_Back)), - Back_Compressed => False, - Level => Level, - Strategy => Strategy, - Header => Header); - - Stamp; - Copy_Streams - (Source => File_Z, - Target => Stream (File_Out).all); - - Print_Statistic ("Read compress", - ZLib.Streams.Read_Total_Out (File_Z)); - - ZLib.Streams.Close (File_Z); - - Close (File_Out); - Close (File_Back); - - -- Decompress to decompression stream. - - Open (File_In, In_File, Z_File_Name); - Create (File_Back, Out_File, Out_File_Name); - - ZLib.Streams.Create - (Stream => File_Z, - Mode => ZLib.Streams.Out_Stream, - Back => ZLib.Streams.Stream_Access - (Stream (File_Back)), - Back_Compressed => False, - Header => Header); - - Stamp; - - Copy_Streams - (Source => Stream (File_In).all, - Target => File_Z); - - Print_Statistic ("Write decompress", - ZLib.Streams.Write_Total_Out (File_Z)); - - ZLib.Streams.Close (File_Z); - Close (File_In); - Close (File_Back); - - Compare_Files (In_File_Name, Out_File_Name); - end loop; - - Ada.Text_IO.Put_Line (Count'Image (File_Size) & " Ok."); - - exit when not Continuous; - - File_Size := File_Size + 1; - end loop; -end Test; diff --git a/common/dist/zlib/contrib/ada/zlib-streams.adb b/common/dist/zlib/contrib/ada/zlib-streams.adb deleted file mode 100644 index 877440339..000000000 --- a/common/dist/zlib/contrib/ada/zlib-streams.adb +++ /dev/null @@ -1,225 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- Id: zlib-streams.adb,v 1.10 2004/05/31 10:53:40 vagul Exp - -with Ada.Unchecked_Deallocation; - -package body ZLib.Streams is - - ----------- - -- Close -- - ----------- - - procedure Close (Stream : in out Stream_Type) is - procedure Free is new Ada.Unchecked_Deallocation - (Stream_Element_Array, Buffer_Access); - begin - if Stream.Mode = Out_Stream or Stream.Mode = Duplex then - -- We should flush the data written by the writer. - - Flush (Stream, Finish); - - Close (Stream.Writer); - end if; - - if Stream.Mode = In_Stream or Stream.Mode = Duplex then - Close (Stream.Reader); - Free (Stream.Buffer); - end if; - end Close; - - ------------ - -- Create -- - ------------ - - procedure Create - (Stream : out Stream_Type; - Mode : in Stream_Mode; - Back : in Stream_Access; - Back_Compressed : in Boolean; - Level : in Compression_Level := Default_Compression; - Strategy : in Strategy_Type := Default_Strategy; - Header : in Header_Type := Default; - Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size; - Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size) - is - - subtype Buffer_Subtype is Stream_Element_Array (1 .. Read_Buffer_Size); - - procedure Init_Filter - (Filter : in out Filter_Type; - Compress : in Boolean); - - ----------------- - -- Init_Filter -- - ----------------- - - procedure Init_Filter - (Filter : in out Filter_Type; - Compress : in Boolean) is - begin - if Compress then - Deflate_Init - (Filter, Level, Strategy, Header => Header); - else - Inflate_Init (Filter, Header => Header); - end if; - end Init_Filter; - - begin - Stream.Back := Back; - Stream.Mode := Mode; - - if Mode = Out_Stream or Mode = Duplex then - Init_Filter (Stream.Writer, Back_Compressed); - Stream.Buffer_Size := Write_Buffer_Size; - else - Stream.Buffer_Size := 0; - end if; - - if Mode = In_Stream or Mode = Duplex then - Init_Filter (Stream.Reader, not Back_Compressed); - - Stream.Buffer := new Buffer_Subtype; - Stream.Rest_First := Stream.Buffer'Last + 1; - Stream.Rest_Last := Stream.Buffer'Last; - end if; - end Create; - - ----------- - -- Flush -- - ----------- - - procedure Flush - (Stream : in out Stream_Type; - Mode : in Flush_Mode := Sync_Flush) - is - Buffer : Stream_Element_Array (1 .. Stream.Buffer_Size); - Last : Stream_Element_Offset; - begin - loop - Flush (Stream.Writer, Buffer, Last, Mode); - - Ada.Streams.Write (Stream.Back.all, Buffer (1 .. Last)); - - exit when Last < Buffer'Last; - end loop; - end Flush; - - ------------- - -- Is_Open -- - ------------- - - function Is_Open (Stream : Stream_Type) return Boolean is - begin - return Is_Open (Stream.Reader) or else Is_Open (Stream.Writer); - end Is_Open; - - ---------- - -- Read -- - ---------- - - procedure Read - (Stream : in out Stream_Type; - Item : out Stream_Element_Array; - Last : out Stream_Element_Offset) - is - - procedure Read - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset); - - ---------- - -- Read -- - ---------- - - procedure Read - (Item : out Stream_Element_Array; - Last : out Stream_Element_Offset) is - begin - Ada.Streams.Read (Stream.Back.all, Item, Last); - end Read; - - procedure Read is new ZLib.Read - (Read => Read, - Buffer => Stream.Buffer.all, - Rest_First => Stream.Rest_First, - Rest_Last => Stream.Rest_Last); - - begin - Read (Stream.Reader, Item, Last); - end Read; - - ------------------- - -- Read_Total_In -- - ------------------- - - function Read_Total_In (Stream : in Stream_Type) return Count is - begin - return Total_In (Stream.Reader); - end Read_Total_In; - - -------------------- - -- Read_Total_Out -- - -------------------- - - function Read_Total_Out (Stream : in Stream_Type) return Count is - begin - return Total_Out (Stream.Reader); - end Read_Total_Out; - - ----------- - -- Write -- - ----------- - - procedure Write - (Stream : in out Stream_Type; - Item : in Stream_Element_Array) - is - - procedure Write (Item : in Stream_Element_Array); - - ----------- - -- Write -- - ----------- - - procedure Write (Item : in Stream_Element_Array) is - begin - Ada.Streams.Write (Stream.Back.all, Item); - end Write; - - procedure Write is new ZLib.Write - (Write => Write, - Buffer_Size => Stream.Buffer_Size); - - begin - Write (Stream.Writer, Item, No_Flush); - end Write; - - -------------------- - -- Write_Total_In -- - -------------------- - - function Write_Total_In (Stream : in Stream_Type) return Count is - begin - return Total_In (Stream.Writer); - end Write_Total_In; - - --------------------- - -- Write_Total_Out -- - --------------------- - - function Write_Total_Out (Stream : in Stream_Type) return Count is - begin - return Total_Out (Stream.Writer); - end Write_Total_Out; - -end ZLib.Streams; diff --git a/common/dist/zlib/contrib/ada/zlib-streams.ads b/common/dist/zlib/contrib/ada/zlib-streams.ads deleted file mode 100644 index b2e700360..000000000 --- a/common/dist/zlib/contrib/ada/zlib-streams.ads +++ /dev/null @@ -1,114 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- Id: zlib-streams.ads,v 1.12 2004/05/31 10:53:40 vagul Exp - -package ZLib.Streams is - - type Stream_Mode is (In_Stream, Out_Stream, Duplex); - - type Stream_Access is access all Ada.Streams.Root_Stream_Type'Class; - - type Stream_Type is - new Ada.Streams.Root_Stream_Type with private; - - procedure Read - (Stream : in out Stream_Type; - Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); - - procedure Write - (Stream : in out Stream_Type; - Item : in Ada.Streams.Stream_Element_Array); - - procedure Flush - (Stream : in out Stream_Type; - Mode : in Flush_Mode := Sync_Flush); - -- Flush the written data to the back stream, - -- all data placed to the compressor is flushing to the Back stream. - -- Should not be used untill necessary, becouse it is decreasing - -- compression. - - function Read_Total_In (Stream : in Stream_Type) return Count; - pragma Inline (Read_Total_In); - -- Return total number of bytes read from back stream so far. - - function Read_Total_Out (Stream : in Stream_Type) return Count; - pragma Inline (Read_Total_Out); - -- Return total number of bytes read so far. - - function Write_Total_In (Stream : in Stream_Type) return Count; - pragma Inline (Write_Total_In); - -- Return total number of bytes written so far. - - function Write_Total_Out (Stream : in Stream_Type) return Count; - pragma Inline (Write_Total_Out); - -- Return total number of bytes written to the back stream. - - procedure Create - (Stream : out Stream_Type; - Mode : in Stream_Mode; - Back : in Stream_Access; - Back_Compressed : in Boolean; - Level : in Compression_Level := Default_Compression; - Strategy : in Strategy_Type := Default_Strategy; - Header : in Header_Type := Default; - Read_Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size; - Write_Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size); - -- Create the Comression/Decompression stream. - -- If mode is In_Stream then Write operation is disabled. - -- If mode is Out_Stream then Read operation is disabled. - - -- If Back_Compressed is true then - -- Data written to the Stream is compressing to the Back stream - -- and data read from the Stream is decompressed data from the Back stream. - - -- If Back_Compressed is false then - -- Data written to the Stream is decompressing to the Back stream - -- and data read from the Stream is compressed data from the Back stream. - - -- !!! When the Need_Header is False ZLib-Ada is using undocumented - -- ZLib 1.1.4 functionality to do not create/wait for ZLib headers. - - function Is_Open (Stream : Stream_Type) return Boolean; - - procedure Close (Stream : in out Stream_Type); - -private - - use Ada.Streams; - - type Buffer_Access is access all Stream_Element_Array; - - type Stream_Type - is new Root_Stream_Type with - record - Mode : Stream_Mode; - - Buffer : Buffer_Access; - Rest_First : Stream_Element_Offset; - Rest_Last : Stream_Element_Offset; - -- Buffer for Read operation. - -- We need to have this buffer in the record - -- becouse not all read data from back stream - -- could be processed during the read operation. - - Buffer_Size : Stream_Element_Offset; - -- Buffer size for write operation. - -- We do not need to have this buffer - -- in the record becouse all data could be - -- processed in the write operation. - - Back : Stream_Access; - Reader : Filter_Type; - Writer : Filter_Type; - end record; - -end ZLib.Streams; diff --git a/common/dist/zlib/contrib/ada/zlib-thin.adb b/common/dist/zlib/contrib/ada/zlib-thin.adb deleted file mode 100644 index 187c099c8..000000000 --- a/common/dist/zlib/contrib/ada/zlib-thin.adb +++ /dev/null @@ -1,141 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp - -package body ZLib.Thin is - - ZLIB_VERSION : constant Chars_Ptr := zlibVersion; - - Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit; - - -------------- - -- Avail_In -- - -------------- - - function Avail_In (Strm : in Z_Stream) return UInt is - begin - return Strm.Avail_In; - end Avail_In; - - --------------- - -- Avail_Out -- - --------------- - - function Avail_Out (Strm : in Z_Stream) return UInt is - begin - return Strm.Avail_Out; - end Avail_Out; - - ------------------ - -- Deflate_Init -- - ------------------ - - function Deflate_Init - (strm : Z_Streamp; - level : Int; - method : Int; - windowBits : Int; - memLevel : Int; - strategy : Int) - return Int is - begin - return deflateInit2 - (strm, - level, - method, - windowBits, - memLevel, - strategy, - ZLIB_VERSION, - Z_Stream_Size); - end Deflate_Init; - - ------------------ - -- Inflate_Init -- - ------------------ - - function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is - begin - return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size); - end Inflate_Init; - - ------------------------ - -- Last_Error_Message -- - ------------------------ - - function Last_Error_Message (Strm : in Z_Stream) return String is - use Interfaces.C.Strings; - begin - if Strm.msg = Null_Ptr then - return ""; - else - return Value (Strm.msg); - end if; - end Last_Error_Message; - - ------------ - -- Set_In -- - ------------ - - procedure Set_In - (Strm : in out Z_Stream; - Buffer : in Voidp; - Size : in UInt) is - begin - Strm.Next_In := Buffer; - Strm.Avail_In := Size; - end Set_In; - - ------------------ - -- Set_Mem_Func -- - ------------------ - - procedure Set_Mem_Func - (Strm : in out Z_Stream; - Opaque : in Voidp; - Alloc : in alloc_func; - Free : in free_func) is - begin - Strm.opaque := Opaque; - Strm.zalloc := Alloc; - Strm.zfree := Free; - end Set_Mem_Func; - - ------------- - -- Set_Out -- - ------------- - - procedure Set_Out - (Strm : in out Z_Stream; - Buffer : in Voidp; - Size : in UInt) is - begin - Strm.Next_Out := Buffer; - Strm.Avail_Out := Size; - end Set_Out; - - -------------- - -- Total_In -- - -------------- - - function Total_In (Strm : in Z_Stream) return ULong is - begin - return Strm.Total_In; - end Total_In; - - --------------- - -- Total_Out -- - --------------- - - function Total_Out (Strm : in Z_Stream) return ULong is - begin - return Strm.Total_Out; - end Total_Out; - -end ZLib.Thin; diff --git a/common/dist/zlib/contrib/ada/zlib-thin.ads b/common/dist/zlib/contrib/ada/zlib-thin.ads deleted file mode 100644 index 8e4ab02ef..000000000 --- a/common/dist/zlib/contrib/ada/zlib-thin.ads +++ /dev/null @@ -1,450 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2003 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- Id: zlib-thin.ads,v 1.11 2004/07/23 06:33:11 vagul Exp - -with Interfaces.C.Strings; - -with System; - -private package ZLib.Thin is - - -- From zconf.h - - MAX_MEM_LEVEL : constant := 9; -- zconf.h:105 - -- zconf.h:105 - MAX_WBITS : constant := 15; -- zconf.h:115 - -- 32K LZ77 window - -- zconf.h:115 - SEEK_SET : constant := 8#0000#; -- zconf.h:244 - -- Seek from beginning of file. - -- zconf.h:244 - SEEK_CUR : constant := 1; -- zconf.h:245 - -- Seek from current position. - -- zconf.h:245 - SEEK_END : constant := 2; -- zconf.h:246 - -- Set file pointer to EOF plus "offset" - -- zconf.h:246 - - type Byte is new Interfaces.C.unsigned_char; -- 8 bits - -- zconf.h:214 - type UInt is new Interfaces.C.unsigned; -- 16 bits or more - -- zconf.h:216 - type Int is new Interfaces.C.int; - - type ULong is new Interfaces.C.unsigned_long; -- 32 bits or more - -- zconf.h:217 - subtype Chars_Ptr is Interfaces.C.Strings.chars_ptr; - - type ULong_Access is access ULong; - type Int_Access is access Int; - - subtype Voidp is System.Address; -- zconf.h:232 - - subtype Byte_Access is Voidp; - - Nul : constant Voidp := System.Null_Address; - -- end from zconf - - Z_NO_FLUSH : constant := 8#0000#; -- zlib.h:125 - -- zlib.h:125 - Z_PARTIAL_FLUSH : constant := 1; -- zlib.h:126 - -- will be removed, use - -- Z_SYNC_FLUSH instead - -- zlib.h:126 - Z_SYNC_FLUSH : constant := 2; -- zlib.h:127 - -- zlib.h:127 - Z_FULL_FLUSH : constant := 3; -- zlib.h:128 - -- zlib.h:128 - Z_FINISH : constant := 4; -- zlib.h:129 - -- zlib.h:129 - Z_OK : constant := 8#0000#; -- zlib.h:132 - -- zlib.h:132 - Z_STREAM_END : constant := 1; -- zlib.h:133 - -- zlib.h:133 - Z_NEED_DICT : constant := 2; -- zlib.h:134 - -- zlib.h:134 - Z_ERRNO : constant := -1; -- zlib.h:135 - -- zlib.h:135 - Z_STREAM_ERROR : constant := -2; -- zlib.h:136 - -- zlib.h:136 - Z_DATA_ERROR : constant := -3; -- zlib.h:137 - -- zlib.h:137 - Z_MEM_ERROR : constant := -4; -- zlib.h:138 - -- zlib.h:138 - Z_BUF_ERROR : constant := -5; -- zlib.h:139 - -- zlib.h:139 - Z_VERSION_ERROR : constant := -6; -- zlib.h:140 - -- zlib.h:140 - Z_NO_COMPRESSION : constant := 8#0000#; -- zlib.h:145 - -- zlib.h:145 - Z_BEST_SPEED : constant := 1; -- zlib.h:146 - -- zlib.h:146 - Z_BEST_COMPRESSION : constant := 9; -- zlib.h:147 - -- zlib.h:147 - Z_DEFAULT_COMPRESSION : constant := -1; -- zlib.h:148 - -- zlib.h:148 - Z_FILTERED : constant := 1; -- zlib.h:151 - -- zlib.h:151 - Z_HUFFMAN_ONLY : constant := 2; -- zlib.h:152 - -- zlib.h:152 - Z_DEFAULT_STRATEGY : constant := 8#0000#; -- zlib.h:153 - -- zlib.h:153 - Z_BINARY : constant := 8#0000#; -- zlib.h:156 - -- zlib.h:156 - Z_ASCII : constant := 1; -- zlib.h:157 - -- zlib.h:157 - Z_UNKNOWN : constant := 2; -- zlib.h:158 - -- zlib.h:158 - Z_DEFLATED : constant := 8; -- zlib.h:161 - -- zlib.h:161 - Z_NULL : constant := 8#0000#; -- zlib.h:164 - -- for initializing zalloc, zfree, opaque - -- zlib.h:164 - type gzFile is new Voidp; -- zlib.h:646 - - type Z_Stream is private; - - type Z_Streamp is access all Z_Stream; -- zlib.h:89 - - type alloc_func is access function - (Opaque : Voidp; - Items : UInt; - Size : UInt) - return Voidp; -- zlib.h:63 - - type free_func is access procedure (opaque : Voidp; address : Voidp); - - function zlibVersion return Chars_Ptr; - - function Deflate (strm : Z_Streamp; flush : Int) return Int; - - function DeflateEnd (strm : Z_Streamp) return Int; - - function Inflate (strm : Z_Streamp; flush : Int) return Int; - - function InflateEnd (strm : Z_Streamp) return Int; - - function deflateSetDictionary - (strm : Z_Streamp; - dictionary : Byte_Access; - dictLength : UInt) - return Int; - - function deflateCopy (dest : Z_Streamp; source : Z_Streamp) return Int; - -- zlib.h:478 - - function deflateReset (strm : Z_Streamp) return Int; -- zlib.h:495 - - function deflateParams - (strm : Z_Streamp; - level : Int; - strategy : Int) - return Int; -- zlib.h:506 - - function inflateSetDictionary - (strm : Z_Streamp; - dictionary : Byte_Access; - dictLength : UInt) - return Int; -- zlib.h:548 - - function inflateSync (strm : Z_Streamp) return Int; -- zlib.h:565 - - function inflateReset (strm : Z_Streamp) return Int; -- zlib.h:580 - - function compress - (dest : Byte_Access; - destLen : ULong_Access; - source : Byte_Access; - sourceLen : ULong) - return Int; -- zlib.h:601 - - function compress2 - (dest : Byte_Access; - destLen : ULong_Access; - source : Byte_Access; - sourceLen : ULong; - level : Int) - return Int; -- zlib.h:615 - - function uncompress - (dest : Byte_Access; - destLen : ULong_Access; - source : Byte_Access; - sourceLen : ULong) - return Int; - - function gzopen (path : Chars_Ptr; mode : Chars_Ptr) return gzFile; - - function gzdopen (fd : Int; mode : Chars_Ptr) return gzFile; - - function gzsetparams - (file : gzFile; - level : Int; - strategy : Int) - return Int; - - function gzread - (file : gzFile; - buf : Voidp; - len : UInt) - return Int; - - function gzwrite - (file : in gzFile; - buf : in Voidp; - len : in UInt) - return Int; - - function gzprintf (file : in gzFile; format : in Chars_Ptr) return Int; - - function gzputs (file : in gzFile; s : in Chars_Ptr) return Int; - - function gzgets - (file : gzFile; - buf : Chars_Ptr; - len : Int) - return Chars_Ptr; - - function gzputc (file : gzFile; char : Int) return Int; - - function gzgetc (file : gzFile) return Int; - - function gzflush (file : gzFile; flush : Int) return Int; - - function gzseek - (file : gzFile; - offset : Int; - whence : Int) - return Int; - - function gzrewind (file : gzFile) return Int; - - function gztell (file : gzFile) return Int; - - function gzeof (file : gzFile) return Int; - - function gzclose (file : gzFile) return Int; - - function gzerror (file : gzFile; errnum : Int_Access) return Chars_Ptr; - - function adler32 - (adler : ULong; - buf : Byte_Access; - len : UInt) - return ULong; - - function crc32 - (crc : ULong; - buf : Byte_Access; - len : UInt) - return ULong; - - function deflateInit - (strm : Z_Streamp; - level : Int; - version : Chars_Ptr; - stream_size : Int) - return Int; - - function deflateInit2 - (strm : Z_Streamp; - level : Int; - method : Int; - windowBits : Int; - memLevel : Int; - strategy : Int; - version : Chars_Ptr; - stream_size : Int) - return Int; - - function Deflate_Init - (strm : Z_Streamp; - level : Int; - method : Int; - windowBits : Int; - memLevel : Int; - strategy : Int) - return Int; - pragma Inline (Deflate_Init); - - function inflateInit - (strm : Z_Streamp; - version : Chars_Ptr; - stream_size : Int) - return Int; - - function inflateInit2 - (strm : in Z_Streamp; - windowBits : in Int; - version : in Chars_Ptr; - stream_size : in Int) - return Int; - - function inflateBackInit - (strm : in Z_Streamp; - windowBits : in Int; - window : in Byte_Access; - version : in Chars_Ptr; - stream_size : in Int) - return Int; - -- Size of window have to be 2**windowBits. - - function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int; - pragma Inline (Inflate_Init); - - function zError (err : Int) return Chars_Ptr; - - function inflateSyncPoint (z : Z_Streamp) return Int; - - function get_crc_table return ULong_Access; - - -- Interface to the available fields of the z_stream structure. - -- The application must update next_in and avail_in when avail_in has - -- dropped to zero. It must update next_out and avail_out when avail_out - -- has dropped to zero. The application must initialize zalloc, zfree and - -- opaque before calling the init function. - - procedure Set_In - (Strm : in out Z_Stream; - Buffer : in Voidp; - Size : in UInt); - pragma Inline (Set_In); - - procedure Set_Out - (Strm : in out Z_Stream; - Buffer : in Voidp; - Size : in UInt); - pragma Inline (Set_Out); - - procedure Set_Mem_Func - (Strm : in out Z_Stream; - Opaque : in Voidp; - Alloc : in alloc_func; - Free : in free_func); - pragma Inline (Set_Mem_Func); - - function Last_Error_Message (Strm : in Z_Stream) return String; - pragma Inline (Last_Error_Message); - - function Avail_Out (Strm : in Z_Stream) return UInt; - pragma Inline (Avail_Out); - - function Avail_In (Strm : in Z_Stream) return UInt; - pragma Inline (Avail_In); - - function Total_In (Strm : in Z_Stream) return ULong; - pragma Inline (Total_In); - - function Total_Out (Strm : in Z_Stream) return ULong; - pragma Inline (Total_Out); - - function inflateCopy - (dest : in Z_Streamp; - Source : in Z_Streamp) - return Int; - - function compressBound (Source_Len : in ULong) return ULong; - - function deflateBound - (Strm : in Z_Streamp; - Source_Len : in ULong) - return ULong; - - function gzungetc (C : in Int; File : in gzFile) return Int; - - function zlibCompileFlags return ULong; - -private - - type Z_Stream is record -- zlib.h:68 - Next_In : Voidp := Nul; -- next input byte - Avail_In : UInt := 0; -- number of bytes available at next_in - Total_In : ULong := 0; -- total nb of input bytes read so far - Next_Out : Voidp := Nul; -- next output byte should be put there - Avail_Out : UInt := 0; -- remaining free space at next_out - Total_Out : ULong := 0; -- total nb of bytes output so far - msg : Chars_Ptr; -- last error message, NULL if no error - state : Voidp; -- not visible by applications - zalloc : alloc_func := null; -- used to allocate the internal state - zfree : free_func := null; -- used to free the internal state - opaque : Voidp; -- private data object passed to - -- zalloc and zfree - data_type : Int; -- best guess about the data type: - -- ascii or binary - adler : ULong; -- adler32 value of the uncompressed - -- data - reserved : ULong; -- reserved for future use - end record; - - pragma Convention (C, Z_Stream); - - pragma Import (C, zlibVersion, "zlibVersion"); - pragma Import (C, Deflate, "deflate"); - pragma Import (C, DeflateEnd, "deflateEnd"); - pragma Import (C, Inflate, "inflate"); - pragma Import (C, InflateEnd, "inflateEnd"); - pragma Import (C, deflateSetDictionary, "deflateSetDictionary"); - pragma Import (C, deflateCopy, "deflateCopy"); - pragma Import (C, deflateReset, "deflateReset"); - pragma Import (C, deflateParams, "deflateParams"); - pragma Import (C, inflateSetDictionary, "inflateSetDictionary"); - pragma Import (C, inflateSync, "inflateSync"); - pragma Import (C, inflateReset, "inflateReset"); - pragma Import (C, compress, "compress"); - pragma Import (C, compress2, "compress2"); - pragma Import (C, uncompress, "uncompress"); - pragma Import (C, gzopen, "gzopen"); - pragma Import (C, gzdopen, "gzdopen"); - pragma Import (C, gzsetparams, "gzsetparams"); - pragma Import (C, gzread, "gzread"); - pragma Import (C, gzwrite, "gzwrite"); - pragma Import (C, gzprintf, "gzprintf"); - pragma Import (C, gzputs, "gzputs"); - pragma Import (C, gzgets, "gzgets"); - pragma Import (C, gzputc, "gzputc"); - pragma Import (C, gzgetc, "gzgetc"); - pragma Import (C, gzflush, "gzflush"); - pragma Import (C, gzseek, "gzseek"); - pragma Import (C, gzrewind, "gzrewind"); - pragma Import (C, gztell, "gztell"); - pragma Import (C, gzeof, "gzeof"); - pragma Import (C, gzclose, "gzclose"); - pragma Import (C, gzerror, "gzerror"); - pragma Import (C, adler32, "adler32"); - pragma Import (C, crc32, "crc32"); - pragma Import (C, deflateInit, "deflateInit_"); - pragma Import (C, inflateInit, "inflateInit_"); - pragma Import (C, deflateInit2, "deflateInit2_"); - pragma Import (C, inflateInit2, "inflateInit2_"); - pragma Import (C, zError, "zError"); - pragma Import (C, inflateSyncPoint, "inflateSyncPoint"); - pragma Import (C, get_crc_table, "get_crc_table"); - - -- since zlib 1.2.0: - - pragma Import (C, inflateCopy, "inflateCopy"); - pragma Import (C, compressBound, "compressBound"); - pragma Import (C, deflateBound, "deflateBound"); - pragma Import (C, gzungetc, "gzungetc"); - pragma Import (C, zlibCompileFlags, "zlibCompileFlags"); - - pragma Import (C, inflateBackInit, "inflateBackInit_"); - - -- I stopped binding the inflateBack routines, becouse realize that - -- it does not support zlib and gzip headers for now, and have no - -- symmetric deflateBack routines. - -- ZLib-Ada is symmetric regarding deflate/inflate data transformation - -- and has a similar generic callback interface for the - -- deflate/inflate transformation based on the regular Deflate/Inflate - -- routines. - - -- pragma Import (C, inflateBack, "inflateBack"); - -- pragma Import (C, inflateBackEnd, "inflateBackEnd"); - -end ZLib.Thin; diff --git a/common/dist/zlib/contrib/ada/zlib.adb b/common/dist/zlib/contrib/ada/zlib.adb deleted file mode 100644 index ee0c91bbe..000000000 --- a/common/dist/zlib/contrib/ada/zlib.adb +++ /dev/null @@ -1,701 +0,0 @@ ----------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2004 Dmitriy Anisimkov -- --- -- --- Open source license information is in the zlib.ads file. -- ----------------------------------------------------------------- - --- Id: zlib.adb,v 1.31 2004/09/06 06:53:19 vagul Exp - -with Ada.Exceptions; -with Ada.Unchecked_Conversion; -with Ada.Unchecked_Deallocation; - -with Interfaces.C.Strings; - -with ZLib.Thin; - -package body ZLib is - - use type Thin.Int; - - type Z_Stream is new Thin.Z_Stream; - - type Return_Code_Enum is - (OK, - STREAM_END, - NEED_DICT, - ERRNO, - STREAM_ERROR, - DATA_ERROR, - MEM_ERROR, - BUF_ERROR, - VERSION_ERROR); - - type Flate_Step_Function is access - function (Strm : in Thin.Z_Streamp; Flush : in Thin.Int) return Thin.Int; - pragma Convention (C, Flate_Step_Function); - - type Flate_End_Function is access - function (Ctrm : in Thin.Z_Streamp) return Thin.Int; - pragma Convention (C, Flate_End_Function); - - type Flate_Type is record - Step : Flate_Step_Function; - Done : Flate_End_Function; - end record; - - subtype Footer_Array is Stream_Element_Array (1 .. 8); - - Simple_GZip_Header : constant Stream_Element_Array (1 .. 10) - := (16#1f#, 16#8b#, -- Magic header - 16#08#, -- Z_DEFLATED - 16#00#, -- Flags - 16#00#, 16#00#, 16#00#, 16#00#, -- Time - 16#00#, -- XFlags - 16#03# -- OS code - ); - -- The simplest gzip header is not for informational, but just for - -- gzip format compatibility. - -- Note that some code below is using assumption - -- Simple_GZip_Header'Last > Footer_Array'Last, so do not make - -- Simple_GZip_Header'Last <= Footer_Array'Last. - - Return_Code : constant array (Thin.Int range <>) of Return_Code_Enum - := (0 => OK, - 1 => STREAM_END, - 2 => NEED_DICT, - -1 => ERRNO, - -2 => STREAM_ERROR, - -3 => DATA_ERROR, - -4 => MEM_ERROR, - -5 => BUF_ERROR, - -6 => VERSION_ERROR); - - Flate : constant array (Boolean) of Flate_Type - := (True => (Step => Thin.Deflate'Access, - Done => Thin.DeflateEnd'Access), - False => (Step => Thin.Inflate'Access, - Done => Thin.InflateEnd'Access)); - - Flush_Finish : constant array (Boolean) of Flush_Mode - := (True => Finish, False => No_Flush); - - procedure Raise_Error (Stream : in Z_Stream); - pragma Inline (Raise_Error); - - procedure Raise_Error (Message : in String); - pragma Inline (Raise_Error); - - procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int); - - procedure Free is new Ada.Unchecked_Deallocation - (Z_Stream, Z_Stream_Access); - - function To_Thin_Access is new Ada.Unchecked_Conversion - (Z_Stream_Access, Thin.Z_Streamp); - - procedure Translate_GZip - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode); - -- Separate translate routine for make gzip header. - - procedure Translate_Auto - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode); - -- translate routine without additional headers. - - ----------------- - -- Check_Error -- - ----------------- - - procedure Check_Error (Stream : in Z_Stream; Code : in Thin.Int) is - use type Thin.Int; - begin - if Code /= Thin.Z_OK then - Raise_Error - (Return_Code_Enum'Image (Return_Code (Code)) - & ": " & Last_Error_Message (Stream)); - end if; - end Check_Error; - - ----------- - -- Close -- - ----------- - - procedure Close - (Filter : in out Filter_Type; - Ignore_Error : in Boolean := False) - is - Code : Thin.Int; - begin - if not Ignore_Error and then not Is_Open (Filter) then - raise Status_Error; - end if; - - Code := Flate (Filter.Compression).Done (To_Thin_Access (Filter.Strm)); - - if Ignore_Error or else Code = Thin.Z_OK then - Free (Filter.Strm); - else - declare - Error_Message : constant String - := Last_Error_Message (Filter.Strm.all); - begin - Free (Filter.Strm); - Ada.Exceptions.Raise_Exception - (ZLib_Error'Identity, - Return_Code_Enum'Image (Return_Code (Code)) - & ": " & Error_Message); - end; - end if; - end Close; - - ----------- - -- CRC32 -- - ----------- - - function CRC32 - (CRC : in Unsigned_32; - Data : in Ada.Streams.Stream_Element_Array) - return Unsigned_32 - is - use Thin; - begin - return Unsigned_32 (crc32 (ULong (CRC), - Data'Address, - Data'Length)); - end CRC32; - - procedure CRC32 - (CRC : in out Unsigned_32; - Data : in Ada.Streams.Stream_Element_Array) is - begin - CRC := CRC32 (CRC, Data); - end CRC32; - - ------------------ - -- Deflate_Init -- - ------------------ - - procedure Deflate_Init - (Filter : in out Filter_Type; - Level : in Compression_Level := Default_Compression; - Strategy : in Strategy_Type := Default_Strategy; - Method : in Compression_Method := Deflated; - Window_Bits : in Window_Bits_Type := Default_Window_Bits; - Memory_Level : in Memory_Level_Type := Default_Memory_Level; - Header : in Header_Type := Default) - is - use type Thin.Int; - Win_Bits : Thin.Int := Thin.Int (Window_Bits); - begin - if Is_Open (Filter) then - raise Status_Error; - end if; - - -- We allow ZLib to make header only in case of default header type. - -- Otherwise we would either do header by ourselfs, or do not do - -- header at all. - - if Header = None or else Header = GZip then - Win_Bits := -Win_Bits; - end if; - - -- For the GZip CRC calculation and make headers. - - if Header = GZip then - Filter.CRC := 0; - Filter.Offset := Simple_GZip_Header'First; - else - Filter.Offset := Simple_GZip_Header'Last + 1; - end if; - - Filter.Strm := new Z_Stream; - Filter.Compression := True; - Filter.Stream_End := False; - Filter.Header := Header; - - if Thin.Deflate_Init - (To_Thin_Access (Filter.Strm), - Level => Thin.Int (Level), - method => Thin.Int (Method), - windowBits => Win_Bits, - memLevel => Thin.Int (Memory_Level), - strategy => Thin.Int (Strategy)) /= Thin.Z_OK - then - Raise_Error (Filter.Strm.all); - end if; - end Deflate_Init; - - ----------- - -- Flush -- - ----------- - - procedure Flush - (Filter : in out Filter_Type; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode) - is - No_Data : Stream_Element_Array := (1 .. 0 => 0); - Last : Stream_Element_Offset; - begin - Translate (Filter, No_Data, Last, Out_Data, Out_Last, Flush); - end Flush; - - ----------------------- - -- Generic_Translate -- - ----------------------- - - procedure Generic_Translate - (Filter : in out ZLib.Filter_Type; - In_Buffer_Size : in Integer := Default_Buffer_Size; - Out_Buffer_Size : in Integer := Default_Buffer_Size) - is - In_Buffer : Stream_Element_Array - (1 .. Stream_Element_Offset (In_Buffer_Size)); - Out_Buffer : Stream_Element_Array - (1 .. Stream_Element_Offset (Out_Buffer_Size)); - Last : Stream_Element_Offset; - In_Last : Stream_Element_Offset; - In_First : Stream_Element_Offset; - Out_Last : Stream_Element_Offset; - begin - Main : loop - Data_In (In_Buffer, Last); - - In_First := In_Buffer'First; - - loop - Translate - (Filter => Filter, - In_Data => In_Buffer (In_First .. Last), - In_Last => In_Last, - Out_Data => Out_Buffer, - Out_Last => Out_Last, - Flush => Flush_Finish (Last < In_Buffer'First)); - - if Out_Buffer'First <= Out_Last then - Data_Out (Out_Buffer (Out_Buffer'First .. Out_Last)); - end if; - - exit Main when Stream_End (Filter); - - -- The end of in buffer. - - exit when In_Last = Last; - - In_First := In_Last + 1; - end loop; - end loop Main; - - end Generic_Translate; - - ------------------ - -- Inflate_Init -- - ------------------ - - procedure Inflate_Init - (Filter : in out Filter_Type; - Window_Bits : in Window_Bits_Type := Default_Window_Bits; - Header : in Header_Type := Default) - is - use type Thin.Int; - Win_Bits : Thin.Int := Thin.Int (Window_Bits); - - procedure Check_Version; - -- Check the latest header types compatibility. - - procedure Check_Version is - begin - if Version <= "1.1.4" then - Raise_Error - ("Inflate header type " & Header_Type'Image (Header) - & " incompatible with ZLib version " & Version); - end if; - end Check_Version; - - begin - if Is_Open (Filter) then - raise Status_Error; - end if; - - case Header is - when None => - Check_Version; - - -- Inflate data without headers determined - -- by negative Win_Bits. - - Win_Bits := -Win_Bits; - when GZip => - Check_Version; - - -- Inflate gzip data defined by flag 16. - - Win_Bits := Win_Bits + 16; - when Auto => - Check_Version; - - -- Inflate with automatic detection - -- of gzip or native header defined by flag 32. - - Win_Bits := Win_Bits + 32; - when Default => null; - end case; - - Filter.Strm := new Z_Stream; - Filter.Compression := False; - Filter.Stream_End := False; - Filter.Header := Header; - - if Thin.Inflate_Init - (To_Thin_Access (Filter.Strm), Win_Bits) /= Thin.Z_OK - then - Raise_Error (Filter.Strm.all); - end if; - end Inflate_Init; - - ------------- - -- Is_Open -- - ------------- - - function Is_Open (Filter : in Filter_Type) return Boolean is - begin - return Filter.Strm /= null; - end Is_Open; - - ----------------- - -- Raise_Error -- - ----------------- - - procedure Raise_Error (Message : in String) is - begin - Ada.Exceptions.Raise_Exception (ZLib_Error'Identity, Message); - end Raise_Error; - - procedure Raise_Error (Stream : in Z_Stream) is - begin - Raise_Error (Last_Error_Message (Stream)); - end Raise_Error; - - ---------- - -- Read -- - ---------- - - procedure Read - (Filter : in out Filter_Type; - Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode := No_Flush) - is - In_Last : Stream_Element_Offset; - Item_First : Ada.Streams.Stream_Element_Offset := Item'First; - V_Flush : Flush_Mode := Flush; - - begin - pragma Assert (Rest_First in Buffer'First .. Buffer'Last + 1); - pragma Assert (Rest_Last in Buffer'First - 1 .. Buffer'Last); - - loop - if Rest_Last = Buffer'First - 1 then - V_Flush := Finish; - - elsif Rest_First > Rest_Last then - Read (Buffer, Rest_Last); - Rest_First := Buffer'First; - - if Rest_Last < Buffer'First then - V_Flush := Finish; - end if; - end if; - - Translate - (Filter => Filter, - In_Data => Buffer (Rest_First .. Rest_Last), - In_Last => In_Last, - Out_Data => Item (Item_First .. Item'Last), - Out_Last => Last, - Flush => V_Flush); - - Rest_First := In_Last + 1; - - exit when Stream_End (Filter) - or else Last = Item'Last - or else (Last >= Item'First and then Allow_Read_Some); - - Item_First := Last + 1; - end loop; - end Read; - - ---------------- - -- Stream_End -- - ---------------- - - function Stream_End (Filter : in Filter_Type) return Boolean is - begin - if Filter.Header = GZip and Filter.Compression then - return Filter.Stream_End - and then Filter.Offset = Footer_Array'Last + 1; - else - return Filter.Stream_End; - end if; - end Stream_End; - - -------------- - -- Total_In -- - -------------- - - function Total_In (Filter : in Filter_Type) return Count is - begin - return Count (Thin.Total_In (To_Thin_Access (Filter.Strm).all)); - end Total_In; - - --------------- - -- Total_Out -- - --------------- - - function Total_Out (Filter : in Filter_Type) return Count is - begin - return Count (Thin.Total_Out (To_Thin_Access (Filter.Strm).all)); - end Total_Out; - - --------------- - -- Translate -- - --------------- - - procedure Translate - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode) is - begin - if Filter.Header = GZip and then Filter.Compression then - Translate_GZip - (Filter => Filter, - In_Data => In_Data, - In_Last => In_Last, - Out_Data => Out_Data, - Out_Last => Out_Last, - Flush => Flush); - else - Translate_Auto - (Filter => Filter, - In_Data => In_Data, - In_Last => In_Last, - Out_Data => Out_Data, - Out_Last => Out_Last, - Flush => Flush); - end if; - end Translate; - - -------------------- - -- Translate_Auto -- - -------------------- - - procedure Translate_Auto - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode) - is - use type Thin.Int; - Code : Thin.Int; - - begin - if not Is_Open (Filter) then - raise Status_Error; - end if; - - if Out_Data'Length = 0 and then In_Data'Length = 0 then - raise Constraint_Error; - end if; - - Set_Out (Filter.Strm.all, Out_Data'Address, Out_Data'Length); - Set_In (Filter.Strm.all, In_Data'Address, In_Data'Length); - - Code := Flate (Filter.Compression).Step - (To_Thin_Access (Filter.Strm), - Thin.Int (Flush)); - - if Code = Thin.Z_STREAM_END then - Filter.Stream_End := True; - else - Check_Error (Filter.Strm.all, Code); - end if; - - In_Last := In_Data'Last - - Stream_Element_Offset (Avail_In (Filter.Strm.all)); - Out_Last := Out_Data'Last - - Stream_Element_Offset (Avail_Out (Filter.Strm.all)); - end Translate_Auto; - - -------------------- - -- Translate_GZip -- - -------------------- - - procedure Translate_GZip - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode) - is - Out_First : Stream_Element_Offset; - - procedure Add_Data (Data : in Stream_Element_Array); - -- Add data to stream from the Filter.Offset till necessary, - -- used for add gzip headr/footer. - - procedure Put_32 - (Item : in out Stream_Element_Array; - Data : in Unsigned_32); - pragma Inline (Put_32); - - -------------- - -- Add_Data -- - -------------- - - procedure Add_Data (Data : in Stream_Element_Array) is - Data_First : Stream_Element_Offset renames Filter.Offset; - Data_Last : Stream_Element_Offset; - Data_Len : Stream_Element_Offset; -- -1 - Out_Len : Stream_Element_Offset; -- -1 - begin - Out_First := Out_Last + 1; - - if Data_First > Data'Last then - return; - end if; - - Data_Len := Data'Last - Data_First; - Out_Len := Out_Data'Last - Out_First; - - if Data_Len <= Out_Len then - Out_Last := Out_First + Data_Len; - Data_Last := Data'Last; - else - Out_Last := Out_Data'Last; - Data_Last := Data_First + Out_Len; - end if; - - Out_Data (Out_First .. Out_Last) := Data (Data_First .. Data_Last); - - Data_First := Data_Last + 1; - Out_First := Out_Last + 1; - end Add_Data; - - ------------ - -- Put_32 -- - ------------ - - procedure Put_32 - (Item : in out Stream_Element_Array; - Data : in Unsigned_32) - is - D : Unsigned_32 := Data; - begin - for J in Item'First .. Item'First + 3 loop - Item (J) := Stream_Element (D and 16#FF#); - D := Shift_Right (D, 8); - end loop; - end Put_32; - - begin - Out_Last := Out_Data'First - 1; - - if not Filter.Stream_End then - Add_Data (Simple_GZip_Header); - - Translate_Auto - (Filter => Filter, - In_Data => In_Data, - In_Last => In_Last, - Out_Data => Out_Data (Out_First .. Out_Data'Last), - Out_Last => Out_Last, - Flush => Flush); - - CRC32 (Filter.CRC, In_Data (In_Data'First .. In_Last)); - end if; - - if Filter.Stream_End and then Out_Last <= Out_Data'Last then - -- This detection method would work only when - -- Simple_GZip_Header'Last > Footer_Array'Last - - if Filter.Offset = Simple_GZip_Header'Last + 1 then - Filter.Offset := Footer_Array'First; - end if; - - declare - Footer : Footer_Array; - begin - Put_32 (Footer, Filter.CRC); - Put_32 (Footer (Footer'First + 4 .. Footer'Last), - Unsigned_32 (Total_In (Filter))); - Add_Data (Footer); - end; - end if; - end Translate_GZip; - - ------------- - -- Version -- - ------------- - - function Version return String is - begin - return Interfaces.C.Strings.Value (Thin.zlibVersion); - end Version; - - ----------- - -- Write -- - ----------- - - procedure Write - (Filter : in out Filter_Type; - Item : in Ada.Streams.Stream_Element_Array; - Flush : in Flush_Mode := No_Flush) - is - Buffer : Stream_Element_Array (1 .. Buffer_Size); - In_Last : Stream_Element_Offset; - Out_Last : Stream_Element_Offset; - In_First : Stream_Element_Offset := Item'First; - begin - if Item'Length = 0 and Flush = No_Flush then - return; - end if; - - loop - Translate - (Filter => Filter, - In_Data => Item (In_First .. Item'Last), - In_Last => In_Last, - Out_Data => Buffer, - Out_Last => Out_Last, - Flush => Flush); - - if Out_Last >= Buffer'First then - Write (Buffer (1 .. Out_Last)); - end if; - - exit when In_Last = Item'Last or Stream_End (Filter); - - In_First := In_Last + 1; - end loop; - end Write; - -end ZLib; diff --git a/common/dist/zlib/contrib/ada/zlib.ads b/common/dist/zlib/contrib/ada/zlib.ads deleted file mode 100644 index e59ad893c..000000000 --- a/common/dist/zlib/contrib/ada/zlib.ads +++ /dev/null @@ -1,328 +0,0 @@ ------------------------------------------------------------------------------- --- ZLib for Ada thick binding. -- --- -- --- Copyright (C) 2002-2004 Dmitriy Anisimkov -- --- -- --- This library is free software; you can redistribute it and/or modify -- --- it under the terms of the GNU General Public License as published by -- --- the Free Software Foundation; either version 2 of the License, or (at -- --- your option) any later version. -- --- -- --- This library is distributed in the hope that it will be useful, but -- --- WITHOUT ANY WARRANTY; without even the implied warranty of -- --- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- --- General Public License for more details. -- --- -- --- You should have received a copy of the GNU General Public License -- --- along with this library; if not, write to the Free Software Foundation, -- --- Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -- --- -- --- As a special exception, if other files instantiate generics from this -- --- unit, or you link this unit with other files to produce an executable, -- --- this unit does not by itself cause the resulting executable to be -- --- covered by the GNU General Public License. This exception does not -- --- however invalidate any other reasons why the executable file might be -- --- covered by the GNU Public License. -- ------------------------------------------------------------------------------- - --- Id: zlib.ads,v 1.26 2004/09/06 06:53:19 vagul Exp - -with Ada.Streams; - -with Interfaces; - -package ZLib is - - ZLib_Error : exception; - Status_Error : exception; - - type Compression_Level is new Integer range -1 .. 9; - - type Flush_Mode is private; - - type Compression_Method is private; - - type Window_Bits_Type is new Integer range 8 .. 15; - - type Memory_Level_Type is new Integer range 1 .. 9; - - type Unsigned_32 is new Interfaces.Unsigned_32; - - type Strategy_Type is private; - - type Header_Type is (None, Auto, Default, GZip); - -- Header type usage have a some limitation for inflate. - -- See comment for Inflate_Init. - - subtype Count is Ada.Streams.Stream_Element_Count; - - Default_Memory_Level : constant Memory_Level_Type := 8; - Default_Window_Bits : constant Window_Bits_Type := 15; - - ---------------------------------- - -- Compression method constants -- - ---------------------------------- - - Deflated : constant Compression_Method; - -- Only one method allowed in this ZLib version - - --------------------------------- - -- Compression level constants -- - --------------------------------- - - No_Compression : constant Compression_Level := 0; - Best_Speed : constant Compression_Level := 1; - Best_Compression : constant Compression_Level := 9; - Default_Compression : constant Compression_Level := -1; - - -------------------------- - -- Flush mode constants -- - -------------------------- - - No_Flush : constant Flush_Mode; - -- Regular way for compression, no flush - - Partial_Flush : constant Flush_Mode; - -- Will be removed, use Z_SYNC_FLUSH instead - - Sync_Flush : constant Flush_Mode; - -- All pending output is flushed to the output buffer and the output - -- is aligned on a byte boundary, so that the decompressor can get all - -- input data available so far. (In particular avail_in is zero after the - -- call if enough output space has been provided before the call.) - -- Flushing may degrade compression for some compression algorithms and so - -- it should be used only when necessary. - - Block_Flush : constant Flush_Mode; - -- Z_BLOCK requests that inflate() stop - -- if and when it get to the next deflate block boundary. When decoding the - -- zlib or gzip format, this will cause inflate() to return immediately - -- after the header and before the first block. When doing a raw inflate, - -- inflate() will go ahead and process the first block, and will return - -- when it gets to the end of that block, or when it runs out of data. - - Full_Flush : constant Flush_Mode; - -- All output is flushed as with SYNC_FLUSH, and the compression state - -- is reset so that decompression can restart from this point if previous - -- compressed data has been damaged or if random access is desired. Using - -- Full_Flush too often can seriously degrade the compression. - - Finish : constant Flush_Mode; - -- Just for tell the compressor that input data is complete. - - ------------------------------------ - -- Compression strategy constants -- - ------------------------------------ - - -- RLE stategy could be used only in version 1.2.0 and later. - - Filtered : constant Strategy_Type; - Huffman_Only : constant Strategy_Type; - RLE : constant Strategy_Type; - Default_Strategy : constant Strategy_Type; - - Default_Buffer_Size : constant := 4096; - - type Filter_Type is tagged limited private; - -- The filter is for compression and for decompression. - -- The usage of the type is depend of its initialization. - - function Version return String; - pragma Inline (Version); - -- Return string representation of the ZLib version. - - procedure Deflate_Init - (Filter : in out Filter_Type; - Level : in Compression_Level := Default_Compression; - Strategy : in Strategy_Type := Default_Strategy; - Method : in Compression_Method := Deflated; - Window_Bits : in Window_Bits_Type := Default_Window_Bits; - Memory_Level : in Memory_Level_Type := Default_Memory_Level; - Header : in Header_Type := Default); - -- Compressor initialization. - -- When Header parameter is Auto or Default, then default zlib header - -- would be provided for compressed data. - -- When Header is GZip, then gzip header would be set instead of - -- default header. - -- When Header is None, no header would be set for compressed data. - - procedure Inflate_Init - (Filter : in out Filter_Type; - Window_Bits : in Window_Bits_Type := Default_Window_Bits; - Header : in Header_Type := Default); - -- Decompressor initialization. - -- Default header type mean that ZLib default header is expecting in the - -- input compressed stream. - -- Header type None mean that no header is expecting in the input stream. - -- GZip header type mean that GZip header is expecting in the - -- input compressed stream. - -- Auto header type mean that header type (GZip or Native) would be - -- detected automatically in the input stream. - -- Note that header types parameter values None, GZip and Auto are - -- supported for inflate routine only in ZLib versions 1.2.0.2 and later. - -- Deflate_Init is supporting all header types. - - function Is_Open (Filter : in Filter_Type) return Boolean; - pragma Inline (Is_Open); - -- Is the filter opened for compression or decompression. - - procedure Close - (Filter : in out Filter_Type; - Ignore_Error : in Boolean := False); - -- Closing the compression or decompressor. - -- If stream is closing before the complete and Ignore_Error is False, - -- The exception would be raised. - - generic - with procedure Data_In - (Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); - with procedure Data_Out - (Item : in Ada.Streams.Stream_Element_Array); - procedure Generic_Translate - (Filter : in out Filter_Type; - In_Buffer_Size : in Integer := Default_Buffer_Size; - Out_Buffer_Size : in Integer := Default_Buffer_Size); - -- Compress/decompress data fetch from Data_In routine and pass the result - -- to the Data_Out routine. User should provide Data_In and Data_Out - -- for compression/decompression data flow. - -- Compression or decompression depend on Filter initialization. - - function Total_In (Filter : in Filter_Type) return Count; - pragma Inline (Total_In); - -- Returns total number of input bytes read so far - - function Total_Out (Filter : in Filter_Type) return Count; - pragma Inline (Total_Out); - -- Returns total number of bytes output so far - - function CRC32 - (CRC : in Unsigned_32; - Data : in Ada.Streams.Stream_Element_Array) - return Unsigned_32; - pragma Inline (CRC32); - -- Compute CRC32, it could be necessary for make gzip format - - procedure CRC32 - (CRC : in out Unsigned_32; - Data : in Ada.Streams.Stream_Element_Array); - pragma Inline (CRC32); - -- Compute CRC32, it could be necessary for make gzip format - - ------------------------------------------------- - -- Below is more complex low level routines. -- - ------------------------------------------------- - - procedure Translate - (Filter : in out Filter_Type; - In_Data : in Ada.Streams.Stream_Element_Array; - In_Last : out Ada.Streams.Stream_Element_Offset; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode); - -- Compress/decompress the In_Data buffer and place the result into - -- Out_Data. In_Last is the index of last element from In_Data accepted by - -- the Filter. Out_Last is the last element of the received data from - -- Filter. To tell the filter that incoming data are complete put the - -- Flush parameter to Finish. - - function Stream_End (Filter : in Filter_Type) return Boolean; - pragma Inline (Stream_End); - -- Return the true when the stream is complete. - - procedure Flush - (Filter : in out Filter_Type; - Out_Data : out Ada.Streams.Stream_Element_Array; - Out_Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode); - pragma Inline (Flush); - -- Flushing the data from the compressor. - - generic - with procedure Write - (Item : in Ada.Streams.Stream_Element_Array); - -- User should provide this routine for accept - -- compressed/decompressed data. - - Buffer_Size : in Ada.Streams.Stream_Element_Offset - := Default_Buffer_Size; - -- Buffer size for Write user routine. - - procedure Write - (Filter : in out Filter_Type; - Item : in Ada.Streams.Stream_Element_Array; - Flush : in Flush_Mode := No_Flush); - -- Compress/Decompress data from Item to the generic parameter procedure - -- Write. Output buffer size could be set in Buffer_Size generic parameter. - - generic - with procedure Read - (Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset); - -- User should provide data for compression/decompression - -- thru this routine. - - Buffer : in out Ada.Streams.Stream_Element_Array; - -- Buffer for keep remaining data from the previous - -- back read. - - Rest_First, Rest_Last : in out Ada.Streams.Stream_Element_Offset; - -- Rest_First have to be initialized to Buffer'Last + 1 - -- Rest_Last have to be initialized to Buffer'Last - -- before usage. - - Allow_Read_Some : in Boolean := False; - -- Is it allowed to return Last < Item'Last before end of data. - - procedure Read - (Filter : in out Filter_Type; - Item : out Ada.Streams.Stream_Element_Array; - Last : out Ada.Streams.Stream_Element_Offset; - Flush : in Flush_Mode := No_Flush); - -- Compress/Decompress data from generic parameter procedure Read to the - -- Item. User should provide Buffer and initialized Rest_First, Rest_Last - -- indicators. If Allow_Read_Some is True, Read routines could return - -- Last < Item'Last only at end of stream. - -private - - use Ada.Streams; - - pragma Assert (Ada.Streams.Stream_Element'Size = 8); - pragma Assert (Ada.Streams.Stream_Element'Modulus = 2**8); - - type Flush_Mode is new Integer range 0 .. 5; - - type Compression_Method is new Integer range 8 .. 8; - - type Strategy_Type is new Integer range 0 .. 3; - - No_Flush : constant Flush_Mode := 0; - Partial_Flush : constant Flush_Mode := 1; - Sync_Flush : constant Flush_Mode := 2; - Full_Flush : constant Flush_Mode := 3; - Finish : constant Flush_Mode := 4; - Block_Flush : constant Flush_Mode := 5; - - Filtered : constant Strategy_Type := 1; - Huffman_Only : constant Strategy_Type := 2; - RLE : constant Strategy_Type := 3; - Default_Strategy : constant Strategy_Type := 0; - - Deflated : constant Compression_Method := 8; - - type Z_Stream; - - type Z_Stream_Access is access all Z_Stream; - - type Filter_Type is tagged limited record - Strm : Z_Stream_Access; - Compression : Boolean; - Stream_End : Boolean; - Header : Header_Type; - CRC : Unsigned_32; - Offset : Stream_Element_Offset; - -- Offset for gzip header/footer output. - end record; - -end ZLib; diff --git a/common/dist/zlib/contrib/ada/zlib.gpr b/common/dist/zlib/contrib/ada/zlib.gpr deleted file mode 100644 index 296b22aa9..000000000 --- a/common/dist/zlib/contrib/ada/zlib.gpr +++ /dev/null @@ -1,20 +0,0 @@ -project Zlib is - - for Languages use ("Ada"); - for Source_Dirs use ("."); - for Object_Dir use "."; - for Main use ("test.adb", "mtest.adb", "read.adb", "buffer_demo"); - - package Compiler is - for Default_Switches ("ada") use ("-gnatwcfilopru", "-gnatVcdfimorst", "-gnatyabcefhiklmnoprst"); - end Compiler; - - package Linker is - for Default_Switches ("ada") use ("-lz"); - end Linker; - - package Builder is - for Default_Switches ("ada") use ("-s", "-gnatQ"); - end Builder; - -end Zlib; diff --git a/common/dist/zlib/contrib/asm586/README.586 b/common/dist/zlib/contrib/asm586/README.586 deleted file mode 100644 index 26812cc0d..000000000 --- a/common/dist/zlib/contrib/asm586/README.586 +++ /dev/null @@ -1,43 +0,0 @@ -This is a patched version of zlib modified to use -Pentium-optimized assembly code in the deflation algorithm. The files -changed/added by this patch are: - -README.586 -match.S - -The effectiveness of these modifications is a bit marginal, as the -program's bottleneck seems to be mostly L1-cache contention, for which -there is no real way to work around without rewriting the basic -algorithm. The speedup on average is around 5-10% (which is generally -less than the amount of variance between subsequent executions). -However, when used at level 9 compression, the cache contention can -drop enough for the assembly version to achieve 10-20% speedup (and -sometimes more, depending on the amount of overall redundancy in the -files). Even here, though, cache contention can still be the limiting -factor, depending on the nature of the program using the zlib library. -This may also mean that better improvements will be seen on a Pentium -with MMX, which suffers much less from L1-cache contention, but I have -not yet verified this. - -Note that this code has been tailored for the Pentium in particular, -and will not perform well on the Pentium Pro (due to the use of a -partial register in the inner loop). - -If you are using an assembler other than GNU as, you will have to -translate match.S to use your assembler's syntax. (Have fun.) - -Brian Raiter -breadbox@muppetlabs.com -April, 1998 - - -Added for zlib 1.1.3: - -The patches come from -http://www.muppetlabs.com/~breadbox/software/assembly.html - -To compile zlib with this asm file, copy match.S to the zlib directory -then do: - -CFLAGS="-O3 -DASMV" ./configure -make OBJA=match.o diff --git a/common/dist/zlib/contrib/asm586/match.S b/common/dist/zlib/contrib/asm586/match.S deleted file mode 100644 index 0368b35fe..000000000 --- a/common/dist/zlib/contrib/asm586/match.S +++ /dev/null @@ -1,364 +0,0 @@ -/* match.s -- Pentium-optimized version of longest_match() - * Written for zlib 1.1.2 - * Copyright (C) 1998 Brian Raiter - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License. - */ - -#ifndef NO_UNDERLINE -#define match_init _match_init -#define longest_match _longest_match -#endif - -#define MAX_MATCH (258) -#define MIN_MATCH (3) -#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) -#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) - -/* stack frame offsets */ - -#define wmask 0 /* local copy of s->wmask */ -#define window 4 /* local copy of s->window */ -#define windowbestlen 8 /* s->window + bestlen */ -#define chainlenscanend 12 /* high word: current chain len */ - /* low word: last bytes sought */ -#define scanstart 16 /* first two bytes of string */ -#define scanalign 20 /* dword-misalignment of string */ -#define nicematch 24 /* a good enough match size */ -#define bestlen 28 /* size of best match so far */ -#define scan 32 /* ptr to string wanting match */ - -#define LocalVarsSize (36) -/* saved ebx 36 */ -/* saved edi 40 */ -/* saved esi 44 */ -/* saved ebp 48 */ -/* return address 52 */ -#define deflatestate 56 /* the function arguments */ -#define curmatch 60 - -/* Offsets for fields in the deflate_state structure. These numbers - * are calculated from the definition of deflate_state, with the - * assumption that the compiler will dword-align the fields. (Thus, - * changing the definition of deflate_state could easily cause this - * program to crash horribly, without so much as a warning at - * compile time. Sigh.) - */ - -/* All the +zlib1222add offsets are due to the addition of fields - * in zlib in the deflate_state structure since the asm code was first written - * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). - * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). - * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - */ - -#define zlib1222add (8) - -#define dsWSize (36+zlib1222add) -#define dsWMask (44+zlib1222add) -#define dsWindow (48+zlib1222add) -#define dsPrev (56+zlib1222add) -#define dsMatchLen (88+zlib1222add) -#define dsPrevMatch (92+zlib1222add) -#define dsStrStart (100+zlib1222add) -#define dsMatchStart (104+zlib1222add) -#define dsLookahead (108+zlib1222add) -#define dsPrevLen (112+zlib1222add) -#define dsMaxChainLen (116+zlib1222add) -#define dsGoodMatch (132+zlib1222add) -#define dsNiceMatch (136+zlib1222add) - - -.file "match.S" - -.globl match_init, longest_match - -.text - -/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ - -longest_match: - -/* Save registers that the compiler may be using, and adjust %esp to */ -/* make room for our stack frame. */ - - pushl %ebp - pushl %edi - pushl %esi - pushl %ebx - subl $LocalVarsSize, %esp - -/* Retrieve the function arguments. %ecx will hold cur_match */ -/* throughout the entire function. %edx will hold the pointer to the */ -/* deflate_state structure during the function's setup (before */ -/* entering the main loop). */ - - movl deflatestate(%esp), %edx - movl curmatch(%esp), %ecx - -/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ - - movl dsNiceMatch(%edx), %eax - movl dsLookahead(%edx), %ebx - cmpl %eax, %ebx - jl LookaheadLess - movl %eax, %ebx -LookaheadLess: movl %ebx, nicematch(%esp) - -/* register Bytef *scan = s->window + s->strstart; */ - - movl dsWindow(%edx), %esi - movl %esi, window(%esp) - movl dsStrStart(%edx), %ebp - lea (%esi,%ebp), %edi - movl %edi, scan(%esp) - -/* Determine how many bytes the scan ptr is off from being */ -/* dword-aligned. */ - - movl %edi, %eax - negl %eax - andl $3, %eax - movl %eax, scanalign(%esp) - -/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ -/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ - - movl dsWSize(%edx), %eax - subl $MIN_LOOKAHEAD, %eax - subl %eax, %ebp - jg LimitPositive - xorl %ebp, %ebp -LimitPositive: - -/* unsigned chain_length = s->max_chain_length; */ -/* if (s->prev_length >= s->good_match) { */ -/* chain_length >>= 2; */ -/* } */ - - movl dsPrevLen(%edx), %eax - movl dsGoodMatch(%edx), %ebx - cmpl %ebx, %eax - movl dsMaxChainLen(%edx), %ebx - jl LastMatchGood - shrl $2, %ebx -LastMatchGood: - -/* chainlen is decremented once beforehand so that the function can */ -/* use the sign flag instead of the zero flag for the exit test. */ -/* It is then shifted into the high word, to make room for the scanend */ -/* scanend value, which it will always accompany. */ - - decl %ebx - shll $16, %ebx - -/* int best_len = s->prev_length; */ - - movl dsPrevLen(%edx), %eax - movl %eax, bestlen(%esp) - -/* Store the sum of s->window + best_len in %esi locally, and in %esi. */ - - addl %eax, %esi - movl %esi, windowbestlen(%esp) - -/* register ush scan_start = *(ushf*)scan; */ -/* register ush scan_end = *(ushf*)(scan+best_len-1); */ - - movw (%edi), %bx - movw %bx, scanstart(%esp) - movw -1(%edi,%eax), %bx - movl %ebx, chainlenscanend(%esp) - -/* Posf *prev = s->prev; */ -/* uInt wmask = s->w_mask; */ - - movl dsPrev(%edx), %edi - movl dsWMask(%edx), %edx - mov %edx, wmask(%esp) - -/* Jump into the main loop. */ - - jmp LoopEntry - -.balign 16 - -/* do { - * match = s->window + cur_match; - * if (*(ushf*)(match+best_len-1) != scan_end || - * *(ushf*)match != scan_start) continue; - * [...] - * } while ((cur_match = prev[cur_match & wmask]) > limit - * && --chain_length != 0); - * - * Here is the inner loop of the function. The function will spend the - * majority of its time in this loop, and majority of that time will - * be spent in the first ten instructions. - * - * Within this loop: - * %ebx = chainlenscanend - i.e., ((chainlen << 16) | scanend) - * %ecx = curmatch - * %edx = curmatch & wmask - * %esi = windowbestlen - i.e., (window + bestlen) - * %edi = prev - * %ebp = limit - * - * Two optimization notes on the choice of instructions: - * - * The first instruction uses a 16-bit address, which costs an extra, - * unpairable cycle. This is cheaper than doing a 32-bit access and - * zeroing the high word, due to the 3-cycle misalignment penalty which - * would occur half the time. This also turns out to be cheaper than - * doing two separate 8-bit accesses, as the memory is so rarely in the - * L1 cache. - * - * The window buffer, however, apparently spends a lot of time in the - * cache, and so it is faster to retrieve the word at the end of the - * match string with two 8-bit loads. The instructions that test the - * word at the beginning of the match string, however, are executed - * much less frequently, and there it was cheaper to use 16-bit - * instructions, which avoided the necessity of saving off and - * subsequently reloading one of the other registers. - */ -LookupLoop: - /* 1 U & V */ - movw (%edi,%edx,2), %cx /* 2 U pipe */ - movl wmask(%esp), %edx /* 2 V pipe */ - cmpl %ebp, %ecx /* 3 U pipe */ - jbe LeaveNow /* 3 V pipe */ - subl $0x00010000, %ebx /* 4 U pipe */ - js LeaveNow /* 4 V pipe */ -LoopEntry: movb -1(%esi,%ecx), %al /* 5 U pipe */ - andl %ecx, %edx /* 5 V pipe */ - cmpb %bl, %al /* 6 U pipe */ - jnz LookupLoop /* 6 V pipe */ - movb (%esi,%ecx), %ah - cmpb %bh, %ah - jnz LookupLoop - movl window(%esp), %eax - movw (%eax,%ecx), %ax - cmpw scanstart(%esp), %ax - jnz LookupLoop - -/* Store the current value of chainlen. */ - - movl %ebx, chainlenscanend(%esp) - -/* Point %edi to the string under scrutiny, and %esi to the string we */ -/* are hoping to match it up with. In actuality, %esi and %edi are */ -/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ -/* initialized to -(MAX_MATCH_8 - scanalign). */ - - movl window(%esp), %esi - movl scan(%esp), %edi - addl %ecx, %esi - movl scanalign(%esp), %eax - movl $(-MAX_MATCH_8), %edx - lea MAX_MATCH_8(%edi,%eax), %edi - lea MAX_MATCH_8(%esi,%eax), %esi - -/* Test the strings for equality, 8 bytes at a time. At the end, - * adjust %edx so that it is offset to the exact byte that mismatched. - * - * We already know at this point that the first three bytes of the - * strings match each other, and they can be safely passed over before - * starting the compare loop. So what this code does is skip over 0-3 - * bytes, as much as necessary in order to dword-align the %edi - * pointer. (%esi will still be misaligned three times out of four.) - * - * It should be confessed that this loop usually does not represent - * much of the total running time. Replacing it with a more - * straightforward "rep cmpsb" would not drastically degrade - * performance. - */ -LoopCmps: - movl (%esi,%edx), %eax - movl (%edi,%edx), %ebx - xorl %ebx, %eax - jnz LeaveLoopCmps - movl 4(%esi,%edx), %eax - movl 4(%edi,%edx), %ebx - xorl %ebx, %eax - jnz LeaveLoopCmps4 - addl $8, %edx - jnz LoopCmps - jmp LenMaximum -LeaveLoopCmps4: addl $4, %edx -LeaveLoopCmps: testl $0x0000FFFF, %eax - jnz LenLower - addl $2, %edx - shrl $16, %eax -LenLower: subb $1, %al - adcl $0, %edx - -/* Calculate the length of the match. If it is longer than MAX_MATCH, */ -/* then automatically accept it as the best possible match and leave. */ - - lea (%edi,%edx), %eax - movl scan(%esp), %edi - subl %edi, %eax - cmpl $MAX_MATCH, %eax - jge LenMaximum - -/* If the length of the match is not longer than the best match we */ -/* have so far, then forget it and return to the lookup loop. */ - - movl deflatestate(%esp), %edx - movl bestlen(%esp), %ebx - cmpl %ebx, %eax - jg LongerMatch - movl chainlenscanend(%esp), %ebx - movl windowbestlen(%esp), %esi - movl dsPrev(%edx), %edi - movl wmask(%esp), %edx - andl %ecx, %edx - jmp LookupLoop - -/* s->match_start = cur_match; */ -/* best_len = len; */ -/* if (len >= nice_match) break; */ -/* scan_end = *(ushf*)(scan+best_len-1); */ - -LongerMatch: movl nicematch(%esp), %ebx - movl %eax, bestlen(%esp) - movl %ecx, dsMatchStart(%edx) - cmpl %ebx, %eax - jge LeaveNow - movl window(%esp), %esi - addl %eax, %esi - movl %esi, windowbestlen(%esp) - movl chainlenscanend(%esp), %ebx - movw -1(%edi,%eax), %bx - movl dsPrev(%edx), %edi - movl %ebx, chainlenscanend(%esp) - movl wmask(%esp), %edx - andl %ecx, %edx - jmp LookupLoop - -/* Accept the current string, with the maximum possible length. */ - -LenMaximum: movl deflatestate(%esp), %edx - movl $MAX_MATCH, bestlen(%esp) - movl %ecx, dsMatchStart(%edx) - -/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ -/* return s->lookahead; */ - -LeaveNow: - movl deflatestate(%esp), %edx - movl bestlen(%esp), %ebx - movl dsLookahead(%edx), %eax - cmpl %eax, %ebx - jg LookaheadRet - movl %ebx, %eax -LookaheadRet: - -/* Restore the stack and return from whence we came. */ - - addl $LocalVarsSize, %esp - popl %ebx - popl %esi - popl %edi - popl %ebp -match_init: ret diff --git a/common/dist/zlib/contrib/asm686/README.686 b/common/dist/zlib/contrib/asm686/README.686 deleted file mode 100644 index a593f23af..000000000 --- a/common/dist/zlib/contrib/asm686/README.686 +++ /dev/null @@ -1,34 +0,0 @@ -This is a patched version of zlib, modified to use -Pentium-Pro-optimized assembly code in the deflation algorithm. The -files changed/added by this patch are: - -README.686 -match.S - -The speedup that this patch provides varies, depending on whether the -compiler used to build the original version of zlib falls afoul of the -PPro's speed traps. My own tests show a speedup of around 10-20% at -the default compression level, and 20-30% using -9, against a version -compiled using gcc 2.7.2.3. Your mileage may vary. - -Note that this code has been tailored for the PPro/PII in particular, -and will not perform particuarly well on a Pentium. - -If you are using an assembler other than GNU as, you will have to -translate match.S to use your assembler's syntax. (Have fun.) - -Brian Raiter -breadbox@muppetlabs.com -April, 1998 - - -Added for zlib 1.1.3: - -The patches come from -http://www.muppetlabs.com/~breadbox/software/assembly.html - -To compile zlib with this asm file, copy match.S to the zlib directory -then do: - -CFLAGS="-O3 -DASMV" ./configure -make OBJA=match.o diff --git a/common/dist/zlib/contrib/asm686/match.S b/common/dist/zlib/contrib/asm686/match.S deleted file mode 100644 index 5c3e9ee36..000000000 --- a/common/dist/zlib/contrib/asm686/match.S +++ /dev/null @@ -1,329 +0,0 @@ -/* match.s -- Pentium-Pro-optimized version of longest_match() - * Written for zlib 1.1.2 - * Copyright (C) 1998 Brian Raiter - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License. - */ - -#ifndef NO_UNDERLINE -#define match_init _match_init -#define longest_match _longest_match -#endif - -#define MAX_MATCH (258) -#define MIN_MATCH (3) -#define MIN_LOOKAHEAD (MAX_MATCH + MIN_MATCH + 1) -#define MAX_MATCH_8 ((MAX_MATCH + 7) & ~7) - -/* stack frame offsets */ - -#define chainlenwmask 0 /* high word: current chain len */ - /* low word: s->wmask */ -#define window 4 /* local copy of s->window */ -#define windowbestlen 8 /* s->window + bestlen */ -#define scanstart 16 /* first two bytes of string */ -#define scanend 12 /* last two bytes of string */ -#define scanalign 20 /* dword-misalignment of string */ -#define nicematch 24 /* a good enough match size */ -#define bestlen 28 /* size of best match so far */ -#define scan 32 /* ptr to string wanting match */ - -#define LocalVarsSize (36) -/* saved ebx 36 */ -/* saved edi 40 */ -/* saved esi 44 */ -/* saved ebp 48 */ -/* return address 52 */ -#define deflatestate 56 /* the function arguments */ -#define curmatch 60 - -/* All the +zlib1222add offsets are due to the addition of fields - * in zlib in the deflate_state structure since the asm code was first written - * (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). - * (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). - * if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - */ - -#define zlib1222add (8) - -#define dsWSize (36+zlib1222add) -#define dsWMask (44+zlib1222add) -#define dsWindow (48+zlib1222add) -#define dsPrev (56+zlib1222add) -#define dsMatchLen (88+zlib1222add) -#define dsPrevMatch (92+zlib1222add) -#define dsStrStart (100+zlib1222add) -#define dsMatchStart (104+zlib1222add) -#define dsLookahead (108+zlib1222add) -#define dsPrevLen (112+zlib1222add) -#define dsMaxChainLen (116+zlib1222add) -#define dsGoodMatch (132+zlib1222add) -#define dsNiceMatch (136+zlib1222add) - - -.file "match.S" - -.globl match_init, longest_match - -.text - -/* uInt longest_match(deflate_state *deflatestate, IPos curmatch) */ - -longest_match: - -/* Save registers that the compiler may be using, and adjust %esp to */ -/* make room for our stack frame. */ - - pushl %ebp - pushl %edi - pushl %esi - pushl %ebx - subl $LocalVarsSize, %esp - -/* Retrieve the function arguments. %ecx will hold cur_match */ -/* throughout the entire function. %edx will hold the pointer to the */ -/* deflate_state structure during the function's setup (before */ -/* entering the main loop). */ - - movl deflatestate(%esp), %edx - movl curmatch(%esp), %ecx - -/* uInt wmask = s->w_mask; */ -/* unsigned chain_length = s->max_chain_length; */ -/* if (s->prev_length >= s->good_match) { */ -/* chain_length >>= 2; */ -/* } */ - - movl dsPrevLen(%edx), %eax - movl dsGoodMatch(%edx), %ebx - cmpl %ebx, %eax - movl dsWMask(%edx), %eax - movl dsMaxChainLen(%edx), %ebx - jl LastMatchGood - shrl $2, %ebx -LastMatchGood: - -/* chainlen is decremented once beforehand so that the function can */ -/* use the sign flag instead of the zero flag for the exit test. */ -/* It is then shifted into the high word, to make room for the wmask */ -/* value, which it will always accompany. */ - - decl %ebx - shll $16, %ebx - orl %eax, %ebx - movl %ebx, chainlenwmask(%esp) - -/* if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; */ - - movl dsNiceMatch(%edx), %eax - movl dsLookahead(%edx), %ebx - cmpl %eax, %ebx - jl LookaheadLess - movl %eax, %ebx -LookaheadLess: movl %ebx, nicematch(%esp) - -/* register Bytef *scan = s->window + s->strstart; */ - - movl dsWindow(%edx), %esi - movl %esi, window(%esp) - movl dsStrStart(%edx), %ebp - lea (%esi,%ebp), %edi - movl %edi, scan(%esp) - -/* Determine how many bytes the scan ptr is off from being */ -/* dword-aligned. */ - - movl %edi, %eax - negl %eax - andl $3, %eax - movl %eax, scanalign(%esp) - -/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ -/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ - - movl dsWSize(%edx), %eax - subl $MIN_LOOKAHEAD, %eax - subl %eax, %ebp - jg LimitPositive - xorl %ebp, %ebp -LimitPositive: - -/* int best_len = s->prev_length; */ - - movl dsPrevLen(%edx), %eax - movl %eax, bestlen(%esp) - -/* Store the sum of s->window + best_len in %esi locally, and in %esi. */ - - addl %eax, %esi - movl %esi, windowbestlen(%esp) - -/* register ush scan_start = *(ushf*)scan; */ -/* register ush scan_end = *(ushf*)(scan+best_len-1); */ -/* Posf *prev = s->prev; */ - - movzwl (%edi), %ebx - movl %ebx, scanstart(%esp) - movzwl -1(%edi,%eax), %ebx - movl %ebx, scanend(%esp) - movl dsPrev(%edx), %edi - -/* Jump into the main loop. */ - - movl chainlenwmask(%esp), %edx - jmp LoopEntry - -.balign 16 - -/* do { - * match = s->window + cur_match; - * if (*(ushf*)(match+best_len-1) != scan_end || - * *(ushf*)match != scan_start) continue; - * [...] - * } while ((cur_match = prev[cur_match & wmask]) > limit - * && --chain_length != 0); - * - * Here is the inner loop of the function. The function will spend the - * majority of its time in this loop, and majority of that time will - * be spent in the first ten instructions. - * - * Within this loop: - * %ebx = scanend - * %ecx = curmatch - * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) - * %esi = windowbestlen - i.e., (window + bestlen) - * %edi = prev - * %ebp = limit - */ -LookupLoop: - andl %edx, %ecx - movzwl (%edi,%ecx,2), %ecx - cmpl %ebp, %ecx - jbe LeaveNow - subl $0x00010000, %edx - js LeaveNow -LoopEntry: movzwl -1(%esi,%ecx), %eax - cmpl %ebx, %eax - jnz LookupLoop - movl window(%esp), %eax - movzwl (%eax,%ecx), %eax - cmpl scanstart(%esp), %eax - jnz LookupLoop - -/* Store the current value of chainlen. */ - - movl %edx, chainlenwmask(%esp) - -/* Point %edi to the string under scrutiny, and %esi to the string we */ -/* are hoping to match it up with. In actuality, %esi and %edi are */ -/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ -/* initialized to -(MAX_MATCH_8 - scanalign). */ - - movl window(%esp), %esi - movl scan(%esp), %edi - addl %ecx, %esi - movl scanalign(%esp), %eax - movl $(-MAX_MATCH_8), %edx - lea MAX_MATCH_8(%edi,%eax), %edi - lea MAX_MATCH_8(%esi,%eax), %esi - -/* Test the strings for equality, 8 bytes at a time. At the end, - * adjust %edx so that it is offset to the exact byte that mismatched. - * - * We already know at this point that the first three bytes of the - * strings match each other, and they can be safely passed over before - * starting the compare loop. So what this code does is skip over 0-3 - * bytes, as much as necessary in order to dword-align the %edi - * pointer. (%esi will still be misaligned three times out of four.) - * - * It should be confessed that this loop usually does not represent - * much of the total running time. Replacing it with a more - * straightforward "rep cmpsb" would not drastically degrade - * performance. - */ -LoopCmps: - movl (%esi,%edx), %eax - xorl (%edi,%edx), %eax - jnz LeaveLoopCmps - movl 4(%esi,%edx), %eax - xorl 4(%edi,%edx), %eax - jnz LeaveLoopCmps4 - addl $8, %edx - jnz LoopCmps - jmp LenMaximum -LeaveLoopCmps4: addl $4, %edx -LeaveLoopCmps: testl $0x0000FFFF, %eax - jnz LenLower - addl $2, %edx - shrl $16, %eax -LenLower: subb $1, %al - adcl $0, %edx - -/* Calculate the length of the match. If it is longer than MAX_MATCH, */ -/* then automatically accept it as the best possible match and leave. */ - - lea (%edi,%edx), %eax - movl scan(%esp), %edi - subl %edi, %eax - cmpl $MAX_MATCH, %eax - jge LenMaximum - -/* If the length of the match is not longer than the best match we */ -/* have so far, then forget it and return to the lookup loop. */ - - movl deflatestate(%esp), %edx - movl bestlen(%esp), %ebx - cmpl %ebx, %eax - jg LongerMatch - movl windowbestlen(%esp), %esi - movl dsPrev(%edx), %edi - movl scanend(%esp), %ebx - movl chainlenwmask(%esp), %edx - jmp LookupLoop - -/* s->match_start = cur_match; */ -/* best_len = len; */ -/* if (len >= nice_match) break; */ -/* scan_end = *(ushf*)(scan+best_len-1); */ - -LongerMatch: movl nicematch(%esp), %ebx - movl %eax, bestlen(%esp) - movl %ecx, dsMatchStart(%edx) - cmpl %ebx, %eax - jge LeaveNow - movl window(%esp), %esi - addl %eax, %esi - movl %esi, windowbestlen(%esp) - movzwl -1(%edi,%eax), %ebx - movl dsPrev(%edx), %edi - movl %ebx, scanend(%esp) - movl chainlenwmask(%esp), %edx - jmp LookupLoop - -/* Accept the current string, with the maximum possible length. */ - -LenMaximum: movl deflatestate(%esp), %edx - movl $MAX_MATCH, bestlen(%esp) - movl %ecx, dsMatchStart(%edx) - -/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ -/* return s->lookahead; */ - -LeaveNow: - movl deflatestate(%esp), %edx - movl bestlen(%esp), %ebx - movl dsLookahead(%edx), %eax - cmpl %eax, %ebx - jg LookaheadRet - movl %ebx, %eax -LookaheadRet: - -/* Restore the stack and return from whence we came. */ - - addl $LocalVarsSize, %esp - popl %ebx - popl %esi - popl %edi - popl %ebp -match_init: ret diff --git a/common/dist/zlib/contrib/blast/Makefile b/common/dist/zlib/contrib/blast/Makefile deleted file mode 100644 index 9be80bafe..000000000 --- a/common/dist/zlib/contrib/blast/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -blast: blast.c blast.h - cc -DTEST -o blast blast.c - -test: blast - blast < test.pk | cmp - test.txt - -clean: - rm -f blast blast.o diff --git a/common/dist/zlib/contrib/blast/README b/common/dist/zlib/contrib/blast/README deleted file mode 100644 index e3a60b3f5..000000000 --- a/common/dist/zlib/contrib/blast/README +++ /dev/null @@ -1,4 +0,0 @@ -Read blast.h for purpose and usage. - -Mark Adler -madler@alumni.caltech.edu diff --git a/common/dist/zlib/contrib/blast/test.pk b/common/dist/zlib/contrib/blast/test.pk deleted file mode 100644 index be10b2bbb251759ffdf6da49fadd1a3f137a54c1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8 PcmZQzX;M+`Z>R?V2c!aC diff --git a/common/dist/zlib/contrib/blast/test.txt b/common/dist/zlib/contrib/blast/test.txt deleted file mode 100644 index bfdf1c5dc..000000000 --- a/common/dist/zlib/contrib/blast/test.txt +++ /dev/null @@ -1 +0,0 @@ -AIAIAIAIAIAIA \ No newline at end of file diff --git a/common/dist/zlib/contrib/delphi/ZLib.pas b/common/dist/zlib/contrib/delphi/ZLib.pas deleted file mode 100644 index 3f2b8b4a5..000000000 --- a/common/dist/zlib/contrib/delphi/ZLib.pas +++ /dev/null @@ -1,557 +0,0 @@ -{*******************************************************} -{ } -{ Borland Delphi Supplemental Components } -{ ZLIB Data Compression Interface Unit } -{ } -{ Copyright (c) 1997,99 Borland Corporation } -{ } -{*******************************************************} - -{ Updated for zlib 1.2.x by Cosmin Truta } - -unit ZLib; - -interface - -uses SysUtils, Classes; - -type - TAlloc = function (AppData: Pointer; Items, Size: Integer): Pointer; cdecl; - TFree = procedure (AppData, Block: Pointer); cdecl; - - // Internal structure. Ignore. - TZStreamRec = packed record - next_in: PChar; // next input byte - avail_in: Integer; // number of bytes available at next_in - total_in: Longint; // total nb of input bytes read so far - - next_out: PChar; // next output byte should be put here - avail_out: Integer; // remaining free space at next_out - total_out: Longint; // total nb of bytes output so far - - msg: PChar; // last error message, NULL if no error - internal: Pointer; // not visible by applications - - zalloc: TAlloc; // used to allocate the internal state - zfree: TFree; // used to free the internal state - AppData: Pointer; // private data object passed to zalloc and zfree - - data_type: Integer; // best guess about the data type: ascii or binary - adler: Longint; // adler32 value of the uncompressed data - reserved: Longint; // reserved for future use - end; - - // Abstract ancestor class - TCustomZlibStream = class(TStream) - private - FStrm: TStream; - FStrmPos: Integer; - FOnProgress: TNotifyEvent; - FZRec: TZStreamRec; - FBuffer: array [Word] of Char; - protected - procedure Progress(Sender: TObject); dynamic; - property OnProgress: TNotifyEvent read FOnProgress write FOnProgress; - constructor Create(Strm: TStream); - end; - -{ TCompressionStream compresses data on the fly as data is written to it, and - stores the compressed data to another stream. - - TCompressionStream is write-only and strictly sequential. Reading from the - stream will raise an exception. Using Seek to move the stream pointer - will raise an exception. - - Output data is cached internally, written to the output stream only when - the internal output buffer is full. All pending output data is flushed - when the stream is destroyed. - - The Position property returns the number of uncompressed bytes of - data that have been written to the stream so far. - - CompressionRate returns the on-the-fly percentage by which the original - data has been compressed: (1 - (CompressedBytes / UncompressedBytes)) * 100 - If raw data size = 100 and compressed data size = 25, the CompressionRate - is 75% - - The OnProgress event is called each time the output buffer is filled and - written to the output stream. This is useful for updating a progress - indicator when you are writing a large chunk of data to the compression - stream in a single call.} - - - TCompressionLevel = (clNone, clFastest, clDefault, clMax); - - TCompressionStream = class(TCustomZlibStream) - private - function GetCompressionRate: Single; - public - constructor Create(CompressionLevel: TCompressionLevel; Dest: TStream); - destructor Destroy; override; - function Read(var Buffer; Count: Longint): Longint; override; - function Write(const Buffer; Count: Longint): Longint; override; - function Seek(Offset: Longint; Origin: Word): Longint; override; - property CompressionRate: Single read GetCompressionRate; - property OnProgress; - end; - -{ TDecompressionStream decompresses data on the fly as data is read from it. - - Compressed data comes from a separate source stream. TDecompressionStream - is read-only and unidirectional; you can seek forward in the stream, but not - backwards. The special case of setting the stream position to zero is - allowed. Seeking forward decompresses data until the requested position in - the uncompressed data has been reached. Seeking backwards, seeking relative - to the end of the stream, requesting the size of the stream, and writing to - the stream will raise an exception. - - The Position property returns the number of bytes of uncompressed data that - have been read from the stream so far. - - The OnProgress event is called each time the internal input buffer of - compressed data is exhausted and the next block is read from the input stream. - This is useful for updating a progress indicator when you are reading a - large chunk of data from the decompression stream in a single call.} - - TDecompressionStream = class(TCustomZlibStream) - public - constructor Create(Source: TStream); - destructor Destroy; override; - function Read(var Buffer; Count: Longint): Longint; override; - function Write(const Buffer; Count: Longint): Longint; override; - function Seek(Offset: Longint; Origin: Word): Longint; override; - property OnProgress; - end; - - - -{ CompressBuf compresses data, buffer to buffer, in one call. - In: InBuf = ptr to compressed data - InBytes = number of bytes in InBuf - Out: OutBuf = ptr to newly allocated buffer containing decompressed data - OutBytes = number of bytes in OutBuf } -procedure CompressBuf(const InBuf: Pointer; InBytes: Integer; - out OutBuf: Pointer; out OutBytes: Integer); - - -{ DecompressBuf decompresses data, buffer to buffer, in one call. - In: InBuf = ptr to compressed data - InBytes = number of bytes in InBuf - OutEstimate = zero, or est. size of the decompressed data - Out: OutBuf = ptr to newly allocated buffer containing decompressed data - OutBytes = number of bytes in OutBuf } -procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer; - OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer); - -{ DecompressToUserBuf decompresses data, buffer to buffer, in one call. - In: InBuf = ptr to compressed data - InBytes = number of bytes in InBuf - Out: OutBuf = ptr to user-allocated buffer to contain decompressed data - BufSize = number of bytes in OutBuf } -procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; - const OutBuf: Pointer; BufSize: Integer); - -const - zlib_version = '1.2.3'; - -type - EZlibError = class(Exception); - ECompressionError = class(EZlibError); - EDecompressionError = class(EZlibError); - -implementation - -uses ZLibConst; - -const - Z_NO_FLUSH = 0; - Z_PARTIAL_FLUSH = 1; - Z_SYNC_FLUSH = 2; - Z_FULL_FLUSH = 3; - Z_FINISH = 4; - - Z_OK = 0; - Z_STREAM_END = 1; - Z_NEED_DICT = 2; - Z_ERRNO = (-1); - Z_STREAM_ERROR = (-2); - Z_DATA_ERROR = (-3); - Z_MEM_ERROR = (-4); - Z_BUF_ERROR = (-5); - Z_VERSION_ERROR = (-6); - - Z_NO_COMPRESSION = 0; - Z_BEST_SPEED = 1; - Z_BEST_COMPRESSION = 9; - Z_DEFAULT_COMPRESSION = (-1); - - Z_FILTERED = 1; - Z_HUFFMAN_ONLY = 2; - Z_RLE = 3; - Z_DEFAULT_STRATEGY = 0; - - Z_BINARY = 0; - Z_ASCII = 1; - Z_UNKNOWN = 2; - - Z_DEFLATED = 8; - - -{$L adler32.obj} -{$L compress.obj} -{$L crc32.obj} -{$L deflate.obj} -{$L infback.obj} -{$L inffast.obj} -{$L inflate.obj} -{$L inftrees.obj} -{$L trees.obj} -{$L uncompr.obj} -{$L zutil.obj} - -procedure adler32; external; -procedure compressBound; external; -procedure crc32; external; -procedure deflateInit2_; external; -procedure deflateParams; external; - -function _malloc(Size: Integer): Pointer; cdecl; -begin - Result := AllocMem(Size); -end; - -procedure _free(Block: Pointer); cdecl; -begin - FreeMem(Block); -end; - -procedure _memset(P: Pointer; B: Byte; count: Integer); cdecl; -begin - FillChar(P^, count, B); -end; - -procedure _memcpy(dest, source: Pointer; count: Integer); cdecl; -begin - Move(source^, dest^, count); -end; - - - -// deflate compresses data -function deflateInit_(var strm: TZStreamRec; level: Integer; version: PChar; - recsize: Integer): Integer; external; -function deflate(var strm: TZStreamRec; flush: Integer): Integer; external; -function deflateEnd(var strm: TZStreamRec): Integer; external; - -// inflate decompresses data -function inflateInit_(var strm: TZStreamRec; version: PChar; - recsize: Integer): Integer; external; -function inflate(var strm: TZStreamRec; flush: Integer): Integer; external; -function inflateEnd(var strm: TZStreamRec): Integer; external; -function inflateReset(var strm: TZStreamRec): Integer; external; - - -function zlibAllocMem(AppData: Pointer; Items, Size: Integer): Pointer; cdecl; -begin -// GetMem(Result, Items*Size); - Result := AllocMem(Items * Size); -end; - -procedure zlibFreeMem(AppData, Block: Pointer); cdecl; -begin - FreeMem(Block); -end; - -{function zlibCheck(code: Integer): Integer; -begin - Result := code; - if code < 0 then - raise EZlibError.Create('error'); //!! -end;} - -function CCheck(code: Integer): Integer; -begin - Result := code; - if code < 0 then - raise ECompressionError.Create('error'); //!! -end; - -function DCheck(code: Integer): Integer; -begin - Result := code; - if code < 0 then - raise EDecompressionError.Create('error'); //!! -end; - -procedure CompressBuf(const InBuf: Pointer; InBytes: Integer; - out OutBuf: Pointer; out OutBytes: Integer); -var - strm: TZStreamRec; - P: Pointer; -begin - FillChar(strm, sizeof(strm), 0); - strm.zalloc := zlibAllocMem; - strm.zfree := zlibFreeMem; - OutBytes := ((InBytes + (InBytes div 10) + 12) + 255) and not 255; - GetMem(OutBuf, OutBytes); - try - strm.next_in := InBuf; - strm.avail_in := InBytes; - strm.next_out := OutBuf; - strm.avail_out := OutBytes; - CCheck(deflateInit_(strm, Z_BEST_COMPRESSION, zlib_version, sizeof(strm))); - try - while CCheck(deflate(strm, Z_FINISH)) <> Z_STREAM_END do - begin - P := OutBuf; - Inc(OutBytes, 256); - ReallocMem(OutBuf, OutBytes); - strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P))); - strm.avail_out := 256; - end; - finally - CCheck(deflateEnd(strm)); - end; - ReallocMem(OutBuf, strm.total_out); - OutBytes := strm.total_out; - except - FreeMem(OutBuf); - raise - end; -end; - - -procedure DecompressBuf(const InBuf: Pointer; InBytes: Integer; - OutEstimate: Integer; out OutBuf: Pointer; out OutBytes: Integer); -var - strm: TZStreamRec; - P: Pointer; - BufInc: Integer; -begin - FillChar(strm, sizeof(strm), 0); - strm.zalloc := zlibAllocMem; - strm.zfree := zlibFreeMem; - BufInc := (InBytes + 255) and not 255; - if OutEstimate = 0 then - OutBytes := BufInc - else - OutBytes := OutEstimate; - GetMem(OutBuf, OutBytes); - try - strm.next_in := InBuf; - strm.avail_in := InBytes; - strm.next_out := OutBuf; - strm.avail_out := OutBytes; - DCheck(inflateInit_(strm, zlib_version, sizeof(strm))); - try - while DCheck(inflate(strm, Z_NO_FLUSH)) <> Z_STREAM_END do - begin - P := OutBuf; - Inc(OutBytes, BufInc); - ReallocMem(OutBuf, OutBytes); - strm.next_out := PChar(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P))); - strm.avail_out := BufInc; - end; - finally - DCheck(inflateEnd(strm)); - end; - ReallocMem(OutBuf, strm.total_out); - OutBytes := strm.total_out; - except - FreeMem(OutBuf); - raise - end; -end; - -procedure DecompressToUserBuf(const InBuf: Pointer; InBytes: Integer; - const OutBuf: Pointer; BufSize: Integer); -var - strm: TZStreamRec; -begin - FillChar(strm, sizeof(strm), 0); - strm.zalloc := zlibAllocMem; - strm.zfree := zlibFreeMem; - strm.next_in := InBuf; - strm.avail_in := InBytes; - strm.next_out := OutBuf; - strm.avail_out := BufSize; - DCheck(inflateInit_(strm, zlib_version, sizeof(strm))); - try - if DCheck(inflate(strm, Z_FINISH)) <> Z_STREAM_END then - raise EZlibError.CreateRes(@sTargetBufferTooSmall); - finally - DCheck(inflateEnd(strm)); - end; -end; - -// TCustomZlibStream - -constructor TCustomZLibStream.Create(Strm: TStream); -begin - inherited Create; - FStrm := Strm; - FStrmPos := Strm.Position; - FZRec.zalloc := zlibAllocMem; - FZRec.zfree := zlibFreeMem; -end; - -procedure TCustomZLibStream.Progress(Sender: TObject); -begin - if Assigned(FOnProgress) then FOnProgress(Sender); -end; - - -// TCompressionStream - -constructor TCompressionStream.Create(CompressionLevel: TCompressionLevel; - Dest: TStream); -const - Levels: array [TCompressionLevel] of ShortInt = - (Z_NO_COMPRESSION, Z_BEST_SPEED, Z_DEFAULT_COMPRESSION, Z_BEST_COMPRESSION); -begin - inherited Create(Dest); - FZRec.next_out := FBuffer; - FZRec.avail_out := sizeof(FBuffer); - CCheck(deflateInit_(FZRec, Levels[CompressionLevel], zlib_version, sizeof(FZRec))); -end; - -destructor TCompressionStream.Destroy; -begin - FZRec.next_in := nil; - FZRec.avail_in := 0; - try - if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; - while (CCheck(deflate(FZRec, Z_FINISH)) <> Z_STREAM_END) - and (FZRec.avail_out = 0) do - begin - FStrm.WriteBuffer(FBuffer, sizeof(FBuffer)); - FZRec.next_out := FBuffer; - FZRec.avail_out := sizeof(FBuffer); - end; - if FZRec.avail_out < sizeof(FBuffer) then - FStrm.WriteBuffer(FBuffer, sizeof(FBuffer) - FZRec.avail_out); - finally - deflateEnd(FZRec); - end; - inherited Destroy; -end; - -function TCompressionStream.Read(var Buffer; Count: Longint): Longint; -begin - raise ECompressionError.CreateRes(@sInvalidStreamOp); -end; - -function TCompressionStream.Write(const Buffer; Count: Longint): Longint; -begin - FZRec.next_in := @Buffer; - FZRec.avail_in := Count; - if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; - while (FZRec.avail_in > 0) do - begin - CCheck(deflate(FZRec, 0)); - if FZRec.avail_out = 0 then - begin - FStrm.WriteBuffer(FBuffer, sizeof(FBuffer)); - FZRec.next_out := FBuffer; - FZRec.avail_out := sizeof(FBuffer); - FStrmPos := FStrm.Position; - Progress(Self); - end; - end; - Result := Count; -end; - -function TCompressionStream.Seek(Offset: Longint; Origin: Word): Longint; -begin - if (Offset = 0) and (Origin = soFromCurrent) then - Result := FZRec.total_in - else - raise ECompressionError.CreateRes(@sInvalidStreamOp); -end; - -function TCompressionStream.GetCompressionRate: Single; -begin - if FZRec.total_in = 0 then - Result := 0 - else - Result := (1.0 - (FZRec.total_out / FZRec.total_in)) * 100.0; -end; - - -// TDecompressionStream - -constructor TDecompressionStream.Create(Source: TStream); -begin - inherited Create(Source); - FZRec.next_in := FBuffer; - FZRec.avail_in := 0; - DCheck(inflateInit_(FZRec, zlib_version, sizeof(FZRec))); -end; - -destructor TDecompressionStream.Destroy; -begin - FStrm.Seek(-FZRec.avail_in, 1); - inflateEnd(FZRec); - inherited Destroy; -end; - -function TDecompressionStream.Read(var Buffer; Count: Longint): Longint; -begin - FZRec.next_out := @Buffer; - FZRec.avail_out := Count; - if FStrm.Position <> FStrmPos then FStrm.Position := FStrmPos; - while (FZRec.avail_out > 0) do - begin - if FZRec.avail_in = 0 then - begin - FZRec.avail_in := FStrm.Read(FBuffer, sizeof(FBuffer)); - if FZRec.avail_in = 0 then - begin - Result := Count - FZRec.avail_out; - Exit; - end; - FZRec.next_in := FBuffer; - FStrmPos := FStrm.Position; - Progress(Self); - end; - CCheck(inflate(FZRec, 0)); - end; - Result := Count; -end; - -function TDecompressionStream.Write(const Buffer; Count: Longint): Longint; -begin - raise EDecompressionError.CreateRes(@sInvalidStreamOp); -end; - -function TDecompressionStream.Seek(Offset: Longint; Origin: Word): Longint; -var - I: Integer; - Buf: array [0..4095] of Char; -begin - if (Offset = 0) and (Origin = soFromBeginning) then - begin - DCheck(inflateReset(FZRec)); - FZRec.next_in := FBuffer; - FZRec.avail_in := 0; - FStrm.Position := 0; - FStrmPos := 0; - end - else if ( (Offset >= 0) and (Origin = soFromCurrent)) or - ( ((Offset - FZRec.total_out) > 0) and (Origin = soFromBeginning)) then - begin - if Origin = soFromBeginning then Dec(Offset, FZRec.total_out); - if Offset > 0 then - begin - for I := 1 to Offset div sizeof(Buf) do - ReadBuffer(Buf, sizeof(Buf)); - ReadBuffer(Buf, Offset mod sizeof(Buf)); - end; - end - else - raise EDecompressionError.CreateRes(@sInvalidStreamOp); - Result := FZRec.total_out; -end; - - -end. diff --git a/common/dist/zlib/contrib/delphi/ZLibConst.pas b/common/dist/zlib/contrib/delphi/ZLibConst.pas deleted file mode 100644 index cdfe13671..000000000 --- a/common/dist/zlib/contrib/delphi/ZLibConst.pas +++ /dev/null @@ -1,11 +0,0 @@ -unit ZLibConst; - -interface - -resourcestring - sTargetBufferTooSmall = 'ZLib error: target buffer may be too small'; - sInvalidStreamOp = 'Invalid stream operation'; - -implementation - -end. diff --git a/common/dist/zlib/contrib/delphi/readme.txt b/common/dist/zlib/contrib/delphi/readme.txt deleted file mode 100644 index 2dc9a8bba..000000000 --- a/common/dist/zlib/contrib/delphi/readme.txt +++ /dev/null @@ -1,76 +0,0 @@ - -Overview -======== - -This directory contains an update to the ZLib interface unit, -distributed by Borland as a Delphi supplemental component. - -The original ZLib unit is Copyright (c) 1997,99 Borland Corp., -and is based on zlib version 1.0.4. There are a series of bugs -and security problems associated with that old zlib version, and -we recommend the users to update their ZLib unit. - - -Summary of modifications -======================== - -- Improved makefile, adapted to zlib version 1.2.1. - -- Some field types from TZStreamRec are changed from Integer to - Longint, for consistency with the zlib.h header, and for 64-bit - readiness. - -- The zlib_version constant is updated. - -- The new Z_RLE strategy has its corresponding symbolic constant. - -- The allocation and deallocation functions and function types - (TAlloc, TFree, zlibAllocMem and zlibFreeMem) are now cdecl, - and _malloc and _free are added as C RTL stubs. As a result, - the original C sources of zlib can be compiled out of the box, - and linked to the ZLib unit. - - -Suggestions for improvements -============================ - -Currently, the ZLib unit provides only a limited wrapper around -the zlib library, and much of the original zlib functionality is -missing. Handling compressed file formats like ZIP/GZIP or PNG -cannot be implemented without having this functionality. -Applications that handle these formats are either using their own, -duplicated code, or not using the ZLib unit at all. - -Here are a few suggestions: - -- Checksum class wrappers around adler32() and crc32(), similar - to the Java classes that implement the java.util.zip.Checksum - interface. - -- The ability to read and write raw deflate streams, without the - zlib stream header and trailer. Raw deflate streams are used - in the ZIP file format. - -- The ability to read and write gzip streams, used in the GZIP - file format, and normally produced by the gzip program. - -- The ability to select a different compression strategy, useful - to PNG and MNG image compression, and to multimedia compression - in general. Besides the compression level - - TCompressionLevel = (clNone, clFastest, clDefault, clMax); - - which, in fact, could have used the 'z' prefix and avoided - TColor-like symbols - - TCompressionLevel = (zcNone, zcFastest, zcDefault, zcMax); - - there could be a compression strategy - - TCompressionStrategy = (zsDefault, zsFiltered, zsHuffmanOnly, zsRle); - -- ZIP and GZIP stream handling via TStreams. - - --- -Cosmin Truta diff --git a/common/dist/zlib/contrib/delphi/zlibd32.mak b/common/dist/zlib/contrib/delphi/zlibd32.mak deleted file mode 100644 index 88fafa0b1..000000000 --- a/common/dist/zlib/contrib/delphi/zlibd32.mak +++ /dev/null @@ -1,93 +0,0 @@ -# Makefile for zlib -# For use with Delphi and C++ Builder under Win32 -# Updated for zlib 1.2.x by Cosmin Truta - -# ------------ Borland C++ ------------ - -# This project uses the Delphi (fastcall/register) calling convention: -LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl - -CC = bcc32 -LD = bcc32 -AR = tlib -# do not use "-pr" in CFLAGS -CFLAGS = -a -d -k- -O2 $(LOC) -LDFLAGS = - - -# variables -ZLIB_LIB = zlib.lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj -OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj -OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzio.obj: gzio.c zutil.h zlib.h zconf.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: example.c zlib.h zconf.h - -minigzip.obj: minigzip.c zlib.h zconf.h - - -# For the sake of the old Borland make, -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - - -# cleanup -clean: - -del *.obj - -del *.exe - -del *.lib - -del *.tds - -del zlib.bak - -del foo.gz - diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib.build b/common/dist/zlib/contrib/dotzlib/DotZLib.build deleted file mode 100644 index ed19cc9dc..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib.build +++ /dev/null @@ -1,33 +0,0 @@ - - - A .Net wrapper library around ZLib1.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib.chm b/common/dist/zlib/contrib/dotzlib/DotZLib.chm deleted file mode 100644 index 0bc7df76e407dcc69094483a6e9507240fe257ab..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 72728 zcmeGEby!tR_Xmt0Lb^-3ySqWUyF;2oNq0+kgMffYgLESxDJ4jYNJ^JTHv%sx-r#-v zJooqc<9Geu_qyC%`^?@mpEY~UXU(jcS?6pdRg}fR004mg^$Bu)%1mlyL4X4QNEaZU zg&sr5>2QFIcf>23$bY-P!QUL1KN5iJZK}ffiW3R5Bgdsi#SjndZHoZ7pFgTx{Kvz zl?C`=WYS*WsmLox3SSrcy2a>U->NFfT;oBWza%PF`f;lwBm?q1PBTK{x+--^IT3kv zWsrnPVqY0p22wFe6GwAd19NMT#CmhT0wib#Qh6aMNjYT|ki;D7XOGYsNY&K^9UN?o z%ncmPoq;mu)=wO6G{*aFfr7n_EzsW4?OK=|9Qg(!4Rmv{u{Zup4&xu0LMrw^AV|WL zwQsr1_s9JrB4XfZ0FoHNo#>AC4@p@ATad(TRwb-|l-$z;f)Is4#Ky?U3TW+k-2@wJ zdNVU4khpqL-+b49mOKH8pXU?Axt4I$k})@=7c{m6+6$Wjjh;9-S<#z0T3Lel_6kK{ z(ESI5s;#ksBT&!A8E9{5V_>Yu@xs_Wvg1a4XW~9`%&`_aeeJ)((#LPDYM4 z_P1bvf^b5Le+4t$qN5&#DE~W}`4*jo5@tpG`?_U;R)#?PTaA4`Y7~qAN1&sbjq%T> zWj@XEAo#1spY)0Yt%3FicWv5~3zH%HFDNCT1JLn@j{f;lA>2&=1^aiq+%n<6i4ckN zzsTKk;{Vw>0`q^7yX^=5y$_%1{V#H?x9w}T45wlIzqjv}X#aBXD6{`Yp_+lE6Y%yC zvAiK_cU|-!MiDY_0MhFjIoaD^52PO=0n>~j#w7n)tM4M;$Bh3eRfG)Hzaa0~Gw=m` zs1Vz~;Qxb71J`(?*#1}9Te}8M!9+6uud=tc4Qv-omi%93Z|xgc;}Ido`oFdJ*2aN( z^3k;aM(sU22kdBss?h)UNBzUU1eD1|h%o%0g>FYzz#EiM{{OqwtqlS?6~amWr9oom zK+B)rBw)xPoR9jy>-LME3J7$1rTMP{_xx4B8EuxqoyY&}(72s(%z?LN30Ou87rAra z|B(4bBfn$pD4YKZzNd|U3Q8pBf8povn)nAnhqK(dWnmj*pwacbW_&kE-I^B!eDF&e= zzkBj6o3~FM*9s%~T{Et&W?*UVerwo}d9M&^{NJ?pzHvh~C_>#H{s#2jz(Kp%;Y`0X z@Dm{?6BD4l@?Q@N9w7}8yj%Eu9}3^ukhlI#J3|f#Lu`Imul>!!L*B{pj=c-S5S`y4 zuW`RxEi}+F4Eb+k>_&rsc--J>v|t0ge>Pdv`Fi@j?J1$rUSY<+!QA(b!HrIlD!<|P z7ylFVO}b9F@p~coG=qg7vHB_q7h1r3{n#+fe>h8z0>mi+=#_ zX%duU7QywmcK=kGfX+b6A00F_2Rs_*9zsc&h52vBsv-z? zxaaqOLHvF7!SbWlux6I~D}CYrCUa}Xurk*BEB#+Y{?RW&zi8fH>HjD2txFF*a=X9M z|4-;!FBN(vbAP4(3;Gueg|?vFU+Mo1c+XN{VO%*LcisJ$K_+2feY3f`rELr zJe2%;+xxr25HSWJ1O5n30L~7!4rT+I2HFJ51=0yZ?STQf6qqY$0th@v6o4OK0=U`# z(?Z#%dGKq@!3>E)vb-&IgQ7?o;=7W_=qr> zNUgi+?Ow4A(Aw1TcD)h#nk|C;w;CzfIGF#4Gu%WAB0HW$-1E`*YP;h!s!S#M_hj8* zgxr3T71aY9N_}U>dv)CrA2rMt#dbI1e!)22Z$Q*%iwK9`QgzQfQJXr6F2AkqJLpce zXn&Px?7JE8?y>*quMx{0VfuHY_qWJf?-jA59i{Lu&|B9PaYYk}@H?aZG7ch=$@^7* zkGeM!B8TPM>3-Mfzt1s|5nQqE@PBor@4d&jfGZ37&XGx4{})FVlcay&k^L5X>&Rjv zaql~_zo5T3vY33K`;P1{(0xZ1Q|25>e&=)k!hBagI?g&=^sZC?Ec}NJqsO^|#qK)d zPuwqDN2jyg_c?c%drU{qJ}t$&v&S{YhF-$JK?G>%WcvN)yH>F=tRbQ|p}HR-xx0dx zdfYJazlq;0_T)|EO-%lZ4aFwAg(%#)nD630PzpBY);E*PkEdixhA8~fCL8)6FjdK) z0gu>1tPrWYF>|jfRT&#=)7y$FjY8z^hQfD{ssqsBI*NK7EwgmHS#{nb8<|3M?iM=V zk!siBwC_R68|M+*fe<3}t4{y0Ma&+4@T0rs)=ee9*dgYvQ7O;eChVsC@BKLDR3}mW zZY6XR_!M92`IrQfOLS5E*Rk&7G})H(ik4)Z7FlAp$%Y z4&gf2#?j;^r0_j6e%mn^_g0`xVT42e~2LWd0%_zvdF;1&76%6hF32tv=dGj!U z1uoUU;;%KbzUf2&LnwxS1*_N_SUZ^5*jq7tSD%+$?|%^S;1CmL=Hy~!q~j7{VWMMV z61lz-V&Jxr-`6Pf_{Lii%x zdZoL)i++*|5t=&fa-*N3>gCP@d3pHNAOm#Lr_Lg7m#Xz(9Ql|at87Hcm8)v z@Si*TA8W$9;J}}&KMed~;12_T82H1$9|ry~@P~mv4E$l>4+DP~_`|>-2L3c!ufYge={Z>GIXM`auggilzhiMD^ZmVvAHsn0 zKJ~2h7aczvcilR8z|YX(O$-PC20*yZxc3480OC5w_?Mgq0BC@$gR!*)(9#wFdHt+1 zD5GMy>-6Th<_bxLL|OI~aW%-zV}ict{&<7q_VSmvJZ^r~@%Q5f_m_%4h5n>}82H1$ z9|ry~@P~mv4E$l>4+DP~_`|>-2L3Schk-u~{J)9;#M@W^64Fidgau511pq))O(ryd z1lkJ<4U}b!vlFh=$D7i8MMuk2Nz7V{XY;j|=6tiZHcmtQJY)|M{NXWUF#tfqtS<@y zkOZWYRRSyJ)PzW-rIW-?Bok@f2oou!{V6E}wf86Bn|cRo9k!a1=<6%bC$jZADJ=&a z7pWfWw>tNp1R$Ovql(VwWf2_s5U3IgsvhL#TSH^So#=o{Uuy^+Qqys*;DvUL}rA?=4`lbR=jsW0?YvR*h$HnNhp= zC!izu;7A+DiZ@kulAlK{n{*^;+WBXnvVm^`j#IMvXU-V}_qao1<69ICjx z#>je?dOT5Wl|%`3vbEPHG~%aFZzYFws0JrvGib&2P+KG9gm@|Na;`dR;@hXdF0GoZ zA-H|QH*e*41=$Iq5bI%HN<7~G#@%@RB7i{JIIaZ}5Wwy4o<;eoy+hDvrhjIDL?wm@1uB1Q#CKL+EnX#od_o5Ll)IMaO z7NBj&@^Kd;)<%OES%^J;dru5(Byz|)wNe231+*1B;m&Izkxf{~q>@M^K5oRE!sTob zc|{J+dp9AWy9VYkT9+9Xs~h za7ux3s^H@U1XPuqE^Qhl@AX5bvU0-YlbYY7u#DLoD@_$+y~NzrtM0>7+1`o^!%<4#Gz6nx%!45)1j#*6H%w}%lL>bkPU;E?AJ8F+BF#1h*)IhVyMi_Ov zsP^M0U`mpo15%jKwLnIhv>I@EEM%1`z#gA-uZa|{w;0Fa<;p*AlslXpj&U`@7sC2t z^zDl(eNUPt;1!(3LTitPAQ;BOW~318lc{z8PH}Qizn}}TOCKI8urso=eH&5)*=8`` zp2~o#l&9$#hnp<9m0A6^0!0mYp=~A0p6kv&f``RmG&`p&3S1xA1q#Z&mWDQ+e8$QU zdYCmRYx5Uo_^3Kpt2*gWb+llW=!(}qid*e*;K%r3yXT@z9M~6J6s4W)yAYFWe5HLK zLzt|wA*)yYu{qhsS{D>18jm#IH$G*d<0Wc!%;ZV=R!Zbb{^7V)aDh~#YlpjpjKM9N=; z>p{p}tsH%-GWJ_W?06|`VM8Q3<;UnLcV=dbQ(dHnG(Sljt7YptrcYv!i*oOTH}{dKWA=+9*g{ZYWJuh2k-7#a>5t$bF)tT%YE zXknN}yshg~aR3ihYrf2JAi1;`U>8O3G~wXHJT%z47}=uULl5)|GbC{@3l!y+B2*~f z5DjcU3lNj0L9LvJs2$yYo&PnlA$`0mw8lE44re*ay-w$)@TQd*clNAR(%5uPdB1zi z$VV@;e2am|gwU=bi3Ahc2-#RQ@Nj4ZR|M%yV{F)u1EjT!9~IyGxH=6o=bI!9tM4V9 zbj_g>xz2R!1`{swDfWX?J_xn2!x`6(1sn7`%cIC}oA8KLKFZ6G`1-{Mb%Gh{twcVN zq6VA;DyiF|ZA@EJ=2F1GleU)erF@D~9hw9hVXb^lDkhymJIUFHVbQAc(AH!-KEV8w zAjx)Vwy>U^Iw=20(<2uf(23nLxb!{&gdH4nxP_*xYF?fdBUT{!B>#)%AdnKLLoAd% zF)T0&Lw=ZSZHt59{(K>Bkvty(DpM`l82!)rC-3lEYU$}o8c0{qipkSGIh)_p6+1p# zvQ=^Jkc`a9Sh>;&={E<<*3Q65XH(xKGsk_s8o{X6xD&4X*)r4CLE#*tde3<2Ftz&J z-bRK2D)TE^O0lz+q_}32BSXH1giVjkV-(CZqm^v#z3`3d>Q)Jlz#WZ2C|%q+1=V7( zOL<5p{(S34Nr@ks)(@gEk0mIzP1K$3)Az#HKgrY=yXS2rUBJ+Y=+H1-R5Fa~QBCT! z;f*{V=ue75&_o`g?M=eV>fF=Ze+=&v4p)Cx6@aLwjlc>kTCyq1q@mr`ZM7q*a8^Ly z7rz}o$wn8ZUHU<+Y8&|JQlkt+Luh{UZ0GGW=pkwJ@fV_I9S-k7!Cuo$&2Vpl9RZKd zRQCZ-s|f59qfG4gNx(e7C8Y721+6zf4~s=w7U|a_o6;>swO!S`4CNDZwO@EKZpwjQ z@Pb_6ThX|78nr(WG{ROYB;F7^oFX=zE~dK9y4#dXex!BgnaRaZU$J?%%%?&@hbFD_ z%Ej3Yq2$%}j60QKxp?1@dHrs(8ZPvf(sVTU+E_+p@nQTY&2sr@D^;-;ho|sPO(8yoxcfqEqX?w-F68l>x{*l95$+F#fzj1+VJ-K+ktL;m{t$ zn*%I&+651%T{a&pFy@uVK)CaMp}j?{^FkcEfLYv<4xTgo(Wqm$#Om052eiCYmD5DZ z&ijs8rrC14S&PxVisY*Kk%D6meU3**RHOwGs&qZsrpG0M*RMk9!HROcM%3-mu)-(XZb)E($w()#z-L!EMb*e%#1Z&iG(gpF+| zPXJUKk3eY3l_H->hMO+$C1jVgFKG1?m&zkX*b&7{SCJIYlb(0r-{B6Oe9N(5)5M=Uak}sB*b)ZU~ghv z(IG(iUu5B<3fH9T^vKy~ats%hi{$1Kr^pY|L96c7P4Ov5#}w|2zlD{iskUo=IVpM& z5&@Ix^_sV=wO8TrX-WhxY#pk%*a8z;q0z?Y<$dMxBn;Zozj{YZV2o7z&>-DtLB`*fMufc%%(P`up2-<26ztjiYl_%skr?=WwAIm-DJTPl3SZ?3yXxi-;#GI?^qq0Vz>4 z17s=BFD^xg9QS3XB!9=mS(}0@iPiJn9F_P{+q@xoiB?Pdx_epH5dJ=0UgN)10zR@>e3E?b9{{ zu=7O-DJXpk$DfkL>3b_qCwqJZ(UJ*8MzM^gggLS^N`54;Yct-#~H$Opm6;`8YGxoQ}nH}tDm6C{>AWzyOt zc*q%{(5GjR-L*c-SM-qC8rWtpJ}eyPLfs2(;`=O)&pfpP?+S}`2*d-mA)Gz(@Ft?R zt2G~BJg^gwVe2)myY~)kl+hL5HM6v*|CE5I0N*l$uUwYfeSNjeS z`)!3Mh4u&uQ#rhcI;Damwu(b;3wdYGeE#~QH2~Q}43<5R`+2?}n;|>zyo?cv{eTw- zriS0vVZYvMCV^{zOFyle9<$auzW9~f7(b#M^>`otrAN#T%&-+lM;i#CcGV|Kq`IIT zf;N?5q-`97b)<>Z5tBoK^NWxKcbHM5957zsdeFKAo1-weVs;pe$jiL8B7qK@+Se1& zXa+-)2$2@;Eb2y4lmv>Y)31$JA!c467rmo)o3P%2aapVL?BrhZdYJdl$-%C~;;j&o&8+sIuC5Hud||g|)0M~D+^e+JPOja>HqYSdkF2!= zgGe!}hQQ_+Gkdd(J=c=$`tfz|1&_XOo>|5>oW#%Vf*atEtQXbgyN&#ESLSPS$QOmq8~BiXU;z6*+xu=JQSQ+JU~{t_=sVL>ii(V-}H6M-2+xf>cp> zIMCfb4tePxIM{PVzTgVEX~XBfSH@ArgQ?rgVuj+KEw;e1sYH^vCBEZf@jht=o(vh0 zn~>wHx`X_i$*#mR0uKVRmx_9rR7y)Dk54veWKQB*0V(P+L<65F)^;aRpkKp|uzBQ# zo}#0DW&>}U>Y9$o;AA+UuF9WZo{;{aJKq%kvUXhy@=*89D=Ub?a*T7eU=t2h+ju^F zT_5)2dY8%7pe$0{d=*6%?4Gze7XqdRlwH+q2?g_SN?906dm++;hlki%IqQRNO@&Q% z!SKZIOzqvXZ3rpRV5U&ucY9@~&?Y0Necd9wZF3id>w>~;lKJf8M9mK061%TP^D8Kb zef?xC;PJJB%t}etmuBPK6ZAmAKR04Yp&^}d-hxC0@DY`!5%Sq1AU0k}@zaS<{_efl zXBtzKcG?TAhz9f?RcZV09+=C0U0L^`zEC%$(&r{GWIUWFL1Kp=f_aO?8DHW53I-`u z4V*tDLS-;4uBl^929^3*t!}ClMZqHi{2n<)AM5OlG$KK6{1ii(a#N**5Ev=Xup_*I zEX8BvB%cD69?VhC-nAo5&*$&7D^H~kO6|04QqmFHP9^o}rY89F+v6*7?T|%yH4v}_ zE7|Rc_i_q_AM$%n)CxcyESmRZrjxoq=Pt^|TMQqH9t&kO(dBN?7O_MO`NhuVg&e2`KMd?Bt{8q+~=86vNUk!`z}G?0+n9sB%)sDV^{OiS*9!yH7{@mmZ){U%dVb_5R?MpzGt|H7&>z1wlHDwoin!&tU!a z1pS$dTb84Jqm{4~VT0ck=J#;p?w26bGjL)w$3pSqz17UwhJQp&f<52e$)-SwkIoJw zl3+6_my0ke)>r#ck&~DB_0+Q~Vzkg@UHqpJX6b<>II!X;$L}{tsz%|S$N!8RZ3f;J|*8y zv-j+r-|k1;Y=AN`lLUfxzTlPCpSoT%X|6@lc?;IY1ayVOOgT^2PUUS?)o#U^i0_9i zTu0o-kv;+dSXi&KzyNDt1QPnyF)2_WG$5e-t!3@@=)yKWI$x^$+nv9bmT8PRmo~bD zTUb3gZZ0YLI@35=QnR}on^ZU%wOiL+*w_`uz&o<4W#t;GZfYG72->_;5iCFmzHkm8 z0sxSiz_J;Anjg)cZyn8SUCk)h%|rk-s~&!~t{r>w^`p5;&Wi+D79=|DR7aDT0%}$$ znXClJbk}rfKOa!P9H=m6P(q(aKK_8{y+`dCnBfFzgtyO?}e)*?u*m%?G=5O*z`2edwRd!QC4AjE(XI{AQK2_nUv53>yY}6 zXY1or!u*R;p2vY6(a9ttr!Wah^~>vqHMv#|;cYFG!>CPR>D$x7>7(4Vy0WcXIZ`{L zMdOi2Gu)UBX-RrtJW^m~;VGc4ww$%#wNmA?CnLF%QyG~(_IfAiAJDb83#6H<)E#XQ zuNPlD*h$;|@vFy<+50j@lULpkJNe-tbg#!CXGM}dThN0wY zd0vvwsyF$cYcB;lFx7re)zbU6b@2G|M z7#N0IF?1Tz^kwo`N`MlDJc%7H?5U1E970xI&R&U>=N~t!|BzT>?G{ zi2LohH00cJBGqih8UXLB-)vMXOm3E3*_x>%MGb6Y*y6F)mhTS!iL>*b#!5PiqhZVI z$~m()Do1J`!oH-CrLC+9)HTDH#iJkwaWSOy-Fjc6o?NPaY;+0=vs?I+Cm=_x2Z|CR1tz2#D!j>Ky_mvG8YTe#^)P^=aWIVm1W+!q?2PpDdy z!?>rDk1u3$O-du}p_t;`9-r~}ifx7sI7ctJyM|jq=E%Y+ZHXdcB zD^_NV)L~*WNzzaAmMIcvsT0)5a$murA&+jb$#ZTbm|7gO7-y_K@f>_1uX}=w2i-cq z3Pgw{kejSq7cPDurWz?n7QAO!Up7fOsNC)kOZ6%f0n7IE+-wRwcoT0G;tFO) z-D^=T48wu}uwoZAI&#b^nC--lEY|;+K+tdXLkEM^s;5z6fD1eq!>Mln*iy&K(k|_n z41HBF3y`~EyqV0J<~){HJ`eWDtFVWNBZG8ao-{tJXhE7?6wKn9IxDDEEZ>{D>*8Jd%etAphHkuB|@oH-*n(2lBVC9(vdED#>(+ zPWLRJ5*Ngw5`y@2p;3Pe_UJ>x(r>Nf7auUlUg8-s^P41)A=Q=dZCpA!A6hLDt+LA| z#*1MGMjyYYqYw){pTOjse_3HF?t+M)T&}IaG?+S%vc0mabYi&Onw27s-2Ub)D4cg! zv2j0;48?)7!zjwIEmYd9mTo6&9S)IGqO9jjw-v)dq*XUur=Nj_*7SNoq8MageL`!0 zvh=ahxC!Zp)kZZU0?{*yOkC1cD$Ycwrn!BkS6oW_jJcl4!AzQ4A*QX05lbN2!U4Fd z=-qF@_K4l1bn6V*o*T-okqm#pPB+? z{(?uujG%lulY0g%vS13?ZExpbCw;v|ZPVT!z-7_e`l*Z%Q}ihmEkjcw)QY*k5@?3z zgSF{yM+-+$;8+kBO9(v^)9~_Wh64SDZUE=kgiD%|+x$8vZb$D!$mAfnCLfV2pPBka zXsh$GcwRb!mARyeN5ckNa}F3e?TU=1Q5kc0lBQyCI8#`ON-V31H9%9|#x_cZEj~tG zAH2g0*bA=kBxYBc2!ebgIWLGFNJd8Rn9iJ;lFOm{NFZp346wiUsI0G;DPY={^i4cI zI@8<-nmOwDp32#z_uHhSC;IU_M3&tvexDsqgxF3h`}BkkEGDu!mx;D(`bC>Q4ahLH z&4+doE0`V5H80hmcXz>?vI+q*w&HWnTiQ#4-y~r|M7$m)BxS&Go6kv90$D00N-P3< zz4?s;&W$~kK64y%dKg*grOr|DLA{}Ltu%&o_i1DoDsfWT4zh+23WO)N;n2cKWIDmi zUbup8~!V0J%e5xsHP@-#daiW)*n9C+tON1&Rc~%Smt}T>mS- z?vjE;;;Zfhe{&Kz#E3o9Md^CLGSqueKlR4g?6Ad0d{W}dC@;3A&ex~wqAx^0=O+j8 zoSH?vieTcMugR+RL8b$fjsF5|>nv% zxEn^)8#(2^009s{*V&13z&H9 z=*@0}=T0=^)#^QZHrcEYR>9P=P#Zqx%0ZpZzE}04u)l#zd(QQw8PWQoedN2vehh{S zbg_5OM_Va2DOu)11^5`q*9J1I%fVlMa)DlWpWt-{B_+(zU#IJ&lz_?0pGne~AOl^; zDN_$LN%cyYbPfu@dz@t77=x}Gh-#|y`G`(vf%8`+8erGxC=cKT}~!RUv|^lX+J+VF^7FRJIUc*hvsNK$Y+Yr z=`FWwRA)%e9qe-$9`q;_)uzR3ww`gPN>&PI!A9s(sb}Xso%|H9RZ!zfm+0VSyccH+ z!K)XJRQMZjRyZO+;} z6#GxzQqxEQ{VY#pc%R3A9DSYV;(2jMiErqwYZM zTvm6f1&%lib=g>dzUEcF&^HkmAB?!3nf&FV%`$Nk#7C}L zgxtM7h-S1Omi*i>+54-v(JIqg>Qs8ss2T9EUAi#=E!HnONh1p%KTxh! z_o^5o|N2P;7Y{YgQ{>@=pD>_0YAqLy^#qgyCnmqA;4CiV%p5n_9-a<=x&XtMTA>0~ zfhmX`Hq#5mOPMxA{%T|-)*AEyAjfSv=}R4)-(V>*;d=l+7kj~rRf*Fj*fi?8@aC<8 zUFq_9HFaZ`*{g>PxSg7!JS{SkGcbNNwW$PWae-szqRcd*L+Xe$g#Wj~c{cr$J$g#||a$w_zoQDn}38gsA#hiNTz=exy zcJRYD#5Uxrr&WOn$J(nI+2boL5fAJx4Ij&cDxxvtKC3Bddzv=&DpI2-jkw64qgORN zc$m=nL3+khHT^M(vnTp7!3L%JRAUn-odw!^%RaNL=Nyy!yX+9nm_kU44x%7X=c$S& zY%7e`HA56^;uSA2O1_HM2n{Z$Lt+Yk?86qO;A!Kw4Y8k8^q(AT^;FV!psmj0DiAl( z7Wo#b>?Qu9`+@MMN!nFQk}1xx7$rwbLOe)A#V5ua@a4mvHR0|tG(2Mm zdQ!tsw~%b}t<$!DA`IpY>xEnx663d%D%!2xEpv}kPOx>VQ57w18LH3fvxvEZ6NJG| z3M+unT*e<;5YKrZ0!<7G>3LqNpoyl6K&`|$8+L+Lz+oL|6-I439VQiuy$)BndftMp z8m#Ee2SvW!;v+kt@%*FSGpJ1eWHiuc2+ixo^V&hGh6*I&vdI+B-&Henmq^IiscUY2 z!$?vj{IJb5QjZb!HA~n%P54RpWYMrRTCGl~H`_VAj7WulF;G)6Ed=rdCG~z zxs?L3y*5#mq+|(wzmfLQn#I2y)XUS-;RT zxKe2?d;DaKx=Hywz1Q>vfB~a#UP7n(G+YA*+Y?)Ca-f%GG~%2P>nF2>aI@Ly4y5nX zsinVFN8qb6(g_#}_@c3TP&_0ywbf0t%zTBtEJU{5Z(O_?;J&pr1jF_~`6*aT4>zFNJ%Y8>&WmbBO%?!Un`jw`rG}8sB%ohe6 zbBev?3Gr@gmI&03t)mlNf*Ok<|8Nj#;T2^KY=TApTsc$5@sZ*4i-7Q_+>Zk1#+_#} z^HERFrc#S8-!*t!&f1uP#RiT8N-f?lvJ9cGFk5nz)u?FE@Ml(i%1=EYb01v`KS;q&H)QEwZ|;4l-{Y0H_h7?d#(eWX zjsKRi<`y2Dlg#PQy7^3|_o1t7p*E?=Cc*RWK4hlY4mfBSW+pkSeG+<6+ROMlawR#| zfx1nhOS)cDvsAV#(V*bHt^l{3O7R)q5tsZ=oKJg_hcAc>Y&$$83e6)w$gn%}a!Scc zSY)pRxs-AlqWJL9tBKmt4?y5gky-d3c(latzaej*u7TfV)Q=MeZSErBpj9E{#yh72 zCz)MW7!*2(oZ%>eGI;!T=~LMi(P1EcP27^WpzwgAywdn3%BR9u3~6ku7(!8#3!gki z9r;{nQENM#2`>FOG<2UZZ5~tUdSq%bZnJQ0i6;%CgsJ=9?aQxf9fusRiFR6T)YthE8G zwZgSCJj;X54UNeY^KY_Fz(6_=11D02I_b09yze(idsxM7tP)l~kZs zwXf6Nx$czClwA;$sIw>kR-U+NS{x@d2cG zS24YETRaWL2`O1T2uK86ngj&X-uSR_YtJ9Ln!F58>5)GT4<<!84SkQ zOLIE)@iKFXyA2Cl@NR?t%ery|_jXN3@?Em-u)P($$QJDl6gE${*O%=BT?IB~KIaE5 zFlB~m4?AiF+nQ+ybw|D;IfRC{q)MuW>1*shsVd~awZ}GrM{4dVD!~E&;_E(rXljg=B46p<*~w<^3q6PlI**kG z5~|0u8B_K{tgLGg8mfqhhSZD|gFpf>S^!^d9@BvHJ8XZDF_<|s|F?CN^m=b+$)FlW1`_;STZOw!}xa_pD!xb)x_=s2EP-**;NscA=+*hj)J4tl`D%=BY*M^|C~~82b3y z;*tt(=)xz`lHPBTzxGS;JX5$u4ZeQRq}7Cr7=48=fFxv0Amp8h)~qLsHmRdTCB8(4 zT`!oJU-KaMhbl2I1X&{}Il(1Laft%=keVULUYQdF*>A<@lkadUW>r5BVjhpl`vh_3 zvvl=Sk}+D4*b}0KcBD|!)?yJ9qvwJ5xf{#_tY3|nhtz$V`)PJphS5=sj`}w2f zg-q_$H!M$|V@0U=9QnX~#v182cI1rvoCQcn?uyit>3%*QQxNERJ6~~XSmmG)P>oLU zcR#1N*ZjNAHu* zPSisFQSFgCFJ*-s8J|CG8*;j^Q?xkc5P8Q z#wys7I!_gb$KlQ&EFP{Jm>7#b*en*ZjD@0*DHPo7VkZGcSuD^(RCz)BnY*X+kxX8y z2G6~CRv11f?DFtq=QiD@PV=~>nZcfz^M@zNsF}H??+Zt!uI%0H!o}YfEJvHjQASDC z1ecURu9tm@Lkn+vVU54Qa+{oA*U7%Glgo4Cyxj7uMlFz)e^d+)=2ZREvIN^f*poc@YE zk@`+Odyz|AMK~5z-=YKg>ZEBZzMP$)Ul**H1IuSF>IZs+TMpDh;PsUKg$+&|q)}4gfnM1^VD1R`q4E?m$aCmgIjnj^gloMM|sF3@;AEIA%tD9v)ob(lX^DxYp zOqxsR&i1W$haqqjen>bm;9P?7Jx+Ou6B)B}FdZALfa&ox7Q(hfHoBYXY zj+|PPsvMaTz+0m(h=8#toTFMn)-N?bq18v2&N$V_cnL0}hJR{lCvSXQV$<*a;3;|4 zR*7B}1=Z<_aK+)Vz4DZoweqy~l&o{OISFxh1-s3XUAI*y2=P+|mMe+nA)W^P&~L^9 z*Iz-S4(SX&85?-AR(dAuOL@MSAuP^zg5+nH!OumM0fzvE%mh#&hF&$%_b*oPLbf}6 zH-JJvtL^O$8(m`^r-5prM|#>oVG4(~`wl3~^|sNMw7ZQQp2|1W7?GiGk}-aJfH21g zYiJ*$vFaM-B1%X(Vts-sbh2-Fn#&hfU_R zr{ByQ_c?68!qdy&CTYJ$kckKyW09N()Ym4%>#-1=UF4RSO{7Y97@@J09u6Vclq?y> z^So{H=d-Fn5>-{1`b;u$MRB7zG$blBxM}iMa6QIE1F&)z?i_ zcRjDpBO5f|(9|>Gd>vF~?ulf_JnA7BMxISc)WO-F1-t7HW#qqA&&Lt>cK#He4RL9N ztMRRxNykAsAFucejDGFF*VY~WG0;gH2~FhI{^649EbyD3Ob%0MAIv@Wi82{EeM=Bs zX0)LCik_kK-LN~ehC_735E|69ktz*q-7YtVbB21nIt(JArHU{&U0n5qw^wk;;+`tQ zlmT&1?4*xWuwd1ZBR-_HXb8@GOyrM{FArx=#j>Nln3M%M&T9HJ8S!Fl)$vJF=B3o$ z+cNcje*g9}$6OF$8f{vU2pT#HC=X()u5?Lf-&6O87vTKQ4e}qB<3j~faDQV{VrBf$ zcK$^)G;7Qb)}j4CFDN3cW_o!)eH2^K^IUhqngUCN%YR<>nZA{JTzDt);|b$%+?7b~ zbeH@+_NMny5(%vPO(1#@48E+ek4u;8TMef&zf5afR2BADK9S!2k{2@?8)wPD^)S8L zS@_-2vy$eA&w1mEU}1)Zf(x2<+6p4@u^Ht__Al$`WtXrKRF~SHhjXo?wZGT_-!uVt z_IGA_IWcPf#MyJ4WB)?+3w((FiziTy@A5MFi>F2V5e7eg;LA|l__m_xn}K^$Z-KSP z{7C7n_$r(NF9s7*X?yIP7FRwsBnJDDbM0mc@0*OV5Zps7H}wms{71W9FS*}Eu3%o1RRY6}yG-xWLgCou9ov8y(EuK1Dl>kax9IoDgSPS3P57F(h{p zD87n_z1n3LS&&e!xK)P{a8dnEDz#qf=&C;eeu!K|l1p!ZIm~Ozs=ATwk=8q5%JNUV zmxFqb1k(mBYpm*e{dc}rG_M#u=5#*VI8tU1QRT7T;wPGSoK(o6-hF5CtZc_pl~sgA_t96w~mxim?(}Z&rHUb^CEPt`{tb zdn|BJLHs$3iejT8Q4p@%OEp*H&r8yw-6z2!Ae-{8pw$rr=^nLT0Tb)2T3PgUY2F49 zo_&2@R)cY73tFwXI}cq(!vA@xxLrXS+hFBYfPxRQv5V@M(0GH-yq>l z`^jf7v{Q7EQWBS7Xz&%(8>IH^#pb+trKVGnk3ryicoXAb>3U>q--w5K=+pXQEi5Ui zE(gUeT1ZMEY7Ojadm4F8ew4B(1h$$j6_ka=r8z!x8ofOnvU$3{Qs_A;Lfcw1i zk>>>x* z4pJ&AjU%Ga&&JBG|5pV6P6liQ01W`}Ne796_W)eZ&BTsIZ8d?Z02%;*QADJ1p29>3 zr!()Pd1hZ4Z&*t7JOoM&DYfz8nZSa@%&`n$OZhUM#_MrAs)IGa2jV(G!@!ZuLlnn8 z*UHp%Z%l?aZhH*9g#ma9kLETh`)m!s7Kx-s*=zBo4Ayx#CR4(<$fsIf)E1E79rV?~ zSIEdz?^>H}4v*5qPMEn6sPmgL78ifnIQ7Mrcl*Rz!34 z>G2@V$2fXT6|faTr)T&}PM?akOXsi3zG_2xFH|HRs=mpr1n6Cg9X8v2!w~P z&q*%jlPvJ<;;IeY?i@Wj;%QJ^Ysh|&(Uay(qSlG8MfHb{U+`SoVLPmt3#TQ-@ywab z=5QC?Kedr8G8XuGYs?D~#uqQadc2IlelSD$?4mqL$Pp;j|511P5*?=z3G1C-8mE=p zyN3AQVR^W%;;f}E&(%sH9V8)qA<(T*$PVKmex7(HtV zdp!obwlS~nLon>uA&9!O9P)k+Bg;bKpy)}%RyNI)+vV;mJ^EDK0n%}KO`sOhQ(3$N z<;jyWA-FI*FD{?$6h9&rO}Zn zSM0AK*6IR)<5T#QmS_pD=3XB1tHEa&N}jPAcYZRl z&E|c;B06bCohg|Zr0>m7K%qoAgS&-p=;8BGsUoRa^hAa-sK*r+@nJ^pV8Q3omd9O# zO&u!nFDzL{5rca9n>RBYpR7J7Frr*XB5z6nIc)3k<0o?LTW`dxZ!WGd7JgA$;Fbgi z7E@#V{`x=dm)dA9VZF+gb#2H($w{6D#Hw^HJFoM-!n9jmq8lZDHM3vc4WeTOlbNw@}bvErYEQ`^wyE z<53`bY+tH`o~-sjq$I!(22e~03-A=U{x+%=fSJKn4sb~Z5MDcmqnp><4nUA)$T+&{ zy-e5@#|nW=1w3!5KS)(Se;=52E@_xjs$TT`5o(Dj6anT2e(UDzxnkF;Uf052heK-L zLQY0l+SjdcfDhDXl$96@HH6WMLBT{EjQ#_Xm(9NX#u47|eYt!6((^JX^sH-wuc1Xs zV*ZLIfibfFe2)z}1O}y27n^MfiB_SzwwMwl@zY1-6c2cpIu78V)ko`*UNb$#OJBgk zWx(NeGzsD+nsnA090UFJJ*|;12vj@AXR(hym5p1I z4*e5bN6vkpjk_bt>?)iGfZujYtg4>vMkZ}1sy(FP-!<%m&};*-u?39>C-ec>UH__v zs-ut<&?LTn+U!z$+%$zZR#@`f8IR0Gy~b)vhetKpR8wUPJ5xlK^h!HW4uwe3SJC_b z0ark%zeE`52!J|0DgA6&aEOX&AC3v6E=Y42wq-lL_t= zlI2Bzv=vuVB<3!8R7<5W+3KezP*z|V169OoV?M_`V<*@T)*v<;>(Vl*iYb=To1>;v zBGMUL$70-Ac6RJcK*X>avn8>c#my&8{rE?bO7s3j6P+yG@Uo7Be|_(l{D_H`(lX>S zv#R)vxydTL{LGx0fK1kgV~y@jZJ0af5;)YE=_A&JVxw0L4V)3LWkq&go@OaL4JB*e zv87TdY zP`mM)IvuhDk!v2Zs#UG8s4f$W-?H6*?J_LNS!nm%|I`o`-nuQY98<_v?YH7`#S-&{SruCSs*BLuC7z!tCtD@%)-r3Bv075=OV-ol{N|`6h2foR>TaW) z(Co(+`Fm;y&lr;?ykg6niqF^XyVdGG%~m_>1-;0AVY4npTRofFPC&Pc<_@zG)3I=| zSlE25w8;DQ7#mB(*2jtq2;CBDj!m}6w-kQ+zTaqj1ng^+&3BnwUSo(p&S%*kW}UBj z@B6w~MaQ)&)fTF(hw!yKF2EkxPkCNTZEFY~5qT9lugXe<_$yep`u3H_-skWQxD63)OaWKU>GNjPM zTjpg>9+{Jt%F_Deaontz#GBT~o~y@CV-8&PSdgXJTH1-2^yPL>H);>2Wce+~!ijQC zx_!b8a+tejyue40U!*)IWEiC(F|N7a09uA4YgmCqYE-AQt9H@SC-EX&IkPi710Y+4 zL6JE8y>(3$!m|MP+OZ>Km{aoZe}u1rD0->}yJl+hy_%E1wjz|tt*3(-mZ0Q^b z#~MSj>Dxpm2vRNY?qnH&#e=NP70N@^w7#%;d8L43v?9uKFsE6JnVZmUR{8Z7IE=-9?qD@)8&P(kW`TXmgmG zP~6-x`*;y|IrG&)cHh5|Bj!8cWfo7H`&{@&V6ihk?CWb_b;XDv#%hv}{yALkBJ)Ww>xm5Wjv-y=J2+C z?`26PMlW+MbMx`drO(>K88X3lK>_{lqg+$5Zu0xG7nuYRdEEJTI%O& z{x7VU0xW`Wp3Ml)ihA0xX`ha(0?s=Y+-+gQ^%7t-wRmlxTWUGe^zSr=0cl{#F747G z=~Q(B!}Nysbo9U=VuvL3GVNc~hZ&*dXS)i903mk`FHRt4DQJXQS53K_)WWG&-v*LT zhZVS)u!_uzY=`t$c;DZ`d(Dvc{xil5^Ie5X`aK$v+M@>&wn;Ze_g>$SXB&;sJ-oq5 zD{xzbEgEXZzkl8PqeC>%7P0H6(-WXTk35sV_6GC{+X(voC~8*iZGnr&h>*&LYTjrW zG(BuuPfC*|>zaWf2~V8>fT-p8mF$rH@*t?|gp3(O6oSa>P^oWgbCoofeBatld^TY* zH;Oc*Cru)kA6e`2vXG~}>1&I1#UTtobLe`@VLB%xIBcLU&BU#n57HaChUKB8kM6+a z(~zs<=QX$IlAePepq-(FDhJNnTARkWNsokXMcMx)F|(Fygxt+z2Nj18A(;c#QkzvQ{@)CmEIxht7$1P-LEacQLw zb`w*gvGg)P6sz8G=b5||UvKbva>mfByCl0p(~@aJU2xNP1@MoVzA{OEeT?r%f@;d& z89l5h-u+=^`p+n}<=2C@z?sfsFEn?}zeLeB2f;d1!v)5^jxBKwctS(xXbDegI^9vi zb%4{8=66mnS_TDutDnYQA1bZC<`_Oqa<-m65p&DR(WwP)r~s#sg6VfnSPq+pkqVf7 zWpG^;kKl1sxpS3aT}Qp4LSjc`*bEHRVeJ^3W zG0Nx}3`#sr2sP9|Aln^r%9lI&igIF%`Z{Bh{U07~5R%BodDu6(vyflu+kVLU1bKqz z0Fbwn?d}`6f+-W&&^hY>4RcD$2u0?|&xU8&=;03WHn6QOyLt}&Qy)O@D zu=VW^*0ienKIm|6N>!;Abtsj@i_I9-(E(t7C29@S;?4Q9RK3J99Xjc;c37Ene2Q&X z$$n~*^^NX`xPw4CG{y|<(4M$lU8n=%JLb%oj*ra0^E<5W4>~;Y5xn5Y#y<5|Hgg7Z z5C|0mu@m+&7s9>PBLuO5UXO0!dfH&Z$#+;V1{IDpQaMg(x-~xsS?$T;h%}0<7FHW(6}6Zr;3N1(>)M z27p%yt90UyOQClAYR%0@e;kxYG;$FMu)KN}zRs{T@X(2BB#Sb`Z!vxaTdQ=#<~pk- zlfB_FL&)wIepTrl*w(^esPDg|$dVvLS4c(C6EGCfdYZ$eK%*&}^`N8n=%pLUSR_OM z0J{Or2nc<`P)Iw^V;k|^nK}aQGnini7u{6YutI7O)o0k?PLJ$e)gE(Fj#V+L024&=>-7Ty$Tvc*M2Bw zc}RxC<^Ve94_2BE1aE-|c!xD1a08Mv?oVzRg#5t)bU|1gl+YWd0ZwDZfw2zYTW{-- zr-}+sg#50dyXwKE6nNi>Ifa+}76JbSvmG9=OJ~#68YE1OIn++$|JO@C)tE6)w3W4k z6%Z;)>N1v21l9}dC*_QiJ`gblI34yxh=C5j!Hxv+U>83}B)yc&Xke5~q8UU0fXx9k z{s?wZDZhCL+V!AIN}%FD7>|O#g%I^Y|3k(D7XSbd2LJ%zI{*Lx00000%9sW;00BS% z06PHtpnznA2OIzZ;Gh5u003YB0002NLy81j3A%&UCgPtZ(Mx&#)MExgt?Hy+5xyiC z!-Tk3n3z7_Noch3H@FzO#4?1#K|1XW!Ec~|?;Qt}mZ)tQGvrZZ`B3v@>5+>qL;#!KsKG0^Wf5 zvMw4aH2~2(>sqkVe}e3rrylCcJ7mb%I>dl=5p{|mk@m5hVbc$-Mlo7{eb(5~RZq`? zSKgeD~gtm6M zooZWntb^OZ{tB1M_5OfY9OL|lEI%VDohQsGZg&l%l;d!Og~%Nw5?l-TZJ7UpG$bf7 zRK4L;sDmP;b>0+&K9}u{rLCb9m&29x914}C)9cmPYUxrqjU?hEdEZiuO;)(gSNn-h zf!UMs(v3OviC|CWjiCRQx$H*rzeJ0E?RTLjsTxv$VBYb~r?vcRN727sWS$AkbqF=4 zlf1@YUNzXG=tW=zN&_Pf`j&6Sq=8C3Yyq~%o{@w34Q21lkYF;$l){3Af2W=H1?*iS zZyoKwkCmUjvvYK$+vFEA8AnzvOUjNwj)BPz#+{zfR&M}&S)-t!58Jpdch%7w7rU5?=KUK&K4KEA;7GUd|Yr)V_$7cT!|0tCDCo??g z%`p`p=s>TIN27kU(^%uhj{ObTgdmi!^(hiWPr>}_ZBgY=2R#5H@nN!qD93_%>N*K4 z79&)J$b8ylje`n!2$N!3U*&=T022ect_5`f%co0FdBj{hy^!kI+>m`| zsjs~y0N~`$Q}aL1D^WkAS@_x^siHZ6GXMaT!2c)ziU=4FM5is;NDyK^e6SdeZ(T-> zf!+{bMh^b6bu(;c&uNmYpM2H3aqXcXZqSJQEE|y?-ek1bkrtG;8KljPGB_Bc$%Kr+ zZbxEAm?db7Vg4IU41os#Bg4awX9gG@8cfcCYSo41KKQcO-}_)|g)@qNm8_tEN!H=X zrx>e)(dQAs!OxarMDf92%s7dis3MDtzL?DqYf96)VZ^i-N#jTLB3*~DSDxj>*tdxg zxG8hC>Qk5sm^oZy(ejDiMexcUWSZyxD`}tqnkmnCQsUR1?@iJeR01Qki&nP2>x}J^ zW`~htr5J>B$f2{8J=Fh5Oq#`bK8k1*>q0`LQKGP1MN!@g3EhlH>)Ka$+-^{HLMJO@ zwpHpsO5P@uyH;T~>nb;XPSk{bsQ^*I{tTMP>t>WcmhkZnyQ+=hyzSLUdqAACLAdq; zL_ebpKj1M`z^_ZmhStrM#4xOmZIn_!kVq1WO%*x&qBdz6k*O-OWM#XZyguPq%meJz z?$RQCQAI45oHm@QcS!XRF~~O3y6jf=bSy~b(2sQZ29O3S@nIc8?TVQIVi+Q~zg3Ef z7_6e#fJe38Kr4nyN(uemNhTI?6scmK@ZX2qiJlBJ;V>ng{C8Fp3s_mCEkiQ8wAk1M zkL1fEJ<$14cZ7QDj^AoS`p_l#DcUak>ES2-$7;wSz5S1zgRlHCXjp<`l$zIk1Pm7C zsG!}45zF7u4pFnmT-`67P6VsU>KbV2>UDkIg0GmjK&xrMrDmck$(L|9`$5&QT4=c| zH%)nEyc0=d?%7`Rjq4YGBzjZwnH~m7+dc5fL@yQW$}?e_dLokIC{6hp`8E~70iDDk zl~8J)UT6)U!%NAKkx>iQKsy(axD9DkU9ad_jTlq|w?S3DqJQzJaTk;Tv=abGK^Xv? zpb7v0U;x^91}Xp-C;%wdGynh)5CQ-I05l_DH2?s8aJ$>}x~1cFycVa`(qa18iM^Y3 zyBzA*-uoYHcXqpN=dHTeRNmWf`)_*hdwspV_iDE^uqNLcYn5;W?>+D{W( zN&$D>9HWp;z4tWtXbb@74f&pK@7wNOyO}Mvwh&#nn(kh^+wFJP zt}R;>*0=8cce=Lz+@z997f~{hfH{x2KQGEsmC2ojA#5dkEJ`4Qm<_#fgykm(12 zJ$-+cOaucv|0N3(1&9&O7xM0Dm4DKq*vS zgC(g(l>8G1jC5l^XV$%ZHVK8;^tvF0Kx7R1%3xd)mD(B5$)W=f9+Nz!QfZxy(P4-r z%6pvb>uFSk%yu*>IaSpvEJ#^j*p;|Ae){|;dHX_}Unc7%k&TiIVUa1w#ishEPDF(9 z$*7`>1lKN=f)OeZ?b69`Q+z{#p3p^dE5K*o{;OL=+1rAih^ z#qx8ibVP_V!K17fFoxqCK5HjR*+sAliKEI=uu!KSuop$oc#uS4D;&Flg?1wd@l?r) zh^mmvA;IZ-m4%?JTvh$2#ga_gb3(P95b<=jlu)w?viGt<9#jjYP{~tGNqBW>TS2*& z1uGB~i?7NR5RtWY`4#t7m!8Q{SoD=YnHmyd&QB17(nlvy(NTmRulQ zf@l8uukj+6rWa?M&WUc1nU$dsp4DQ@?e+SEuPr_!ds#yyXbMAAs6fSwS0@4ZGj)7wyxJ6y zbk9c>g?gx7WIt}}SCc zxJGT_r|^1AO9w>i()(Qh8h%{Ly+JvH%)%r}mL+wLwqvIctPjVptel!ip zK?^Z$tS~N`1-__MT*maWYNG<^4<2gNb+GV%@KEVJB^x*XitN>91-BnHJ&;^CJAvxr zR=6|=iv*L?Ku3B?mbBRrWIH&9x!o}{7rg9{jQCG`AP`Hry- z=6PD9xHYSig}Rbe0C@Z=JSuThue@iGX&i9ciQAZsQs1mapOexOKqd=HvsBfV1(g7@ ziq)6Sskx!lVRt$bkYqH&s!%>H#{Chr6&J%J4(GP2vj54~zJ(+xEAE2r9AnQH{*~UU z{Yw4XxVf;oay=0m;Hp~8&|p;tiF*FVB^ni5udjXp$DeuuFa* zFYx*KlOxeL($pjyex*;UpBr1u{k5)axa}jN%3ZFJ4sHQ7Z8FksrXoGa3 zrS@++fi+jt#AY2!^oiC{=u~PnW(2Gss9Pu?JK!Ws{QyoIVId3^=A8`A7cw*0Vep3u z%+9*d5h7F*i1z~vi*IDl_MIX`D&Vq!hU1*At42HBi)*$iR?%YX{5GZ(;=5AsoDG3k zaV6TZ00CON)HT??oB}Q-($2;JjlMBBKKJ0b36gx7J=NO?&aSoqtNzwcw+1>G>%$^0 zpm!wg z?5TkDV>#`KYMFsiRI(ZN2Lvpwtz*d-BOTfBSl=iF94@oQM{40#&j1*^oPK4~GF*Ab zbU{JG#HSKECt?7Pz~P_3w?t((isxn-TF1p=C0^gKGC1e+EADg7fXP2;69ioY_&_Zu z8#|{4Z3nr7zzJZUz>c4eVy;>+bFB$PHPmk_tQwD7fQlWOl!=?$&;$QYHd0OU0iTcr zMEsl+I*p|q0g9O!Hr##in0;KOOW~;5I`B%A=ghVGI)_4@BCt)+T9cwABTRFX8{7Zd z(t#vrc-M_0flU_pbp)oCekJ?OdEQf>XKxe^k8&}7QL!(m=vz_IXrGPn?v?MJkfh{n z6MGKgitAYIGhSW6)~w_+NQT8uZG=8lx&a=r}XFu6EG8^#k(yr_`rJ8 zJufN%vSV{0Fhsdg=R`M~cUx}g%I#f7wYIJVya}>s`MP_Gbcf+qXwEHE_K4eF2j(t0 zIO+6T6E0VpgzEp53j^{aIxdHlbkuIO0JFu=vvMs?yXzrYmc{RzCc$J=e4e6YcRGzo z9jdOb6XTRqZ!irpud8i3DRB?We9W7=F`LJoH~T(OYLp?e4>N`ONp1LYcC%3lH%4>D zyPZ}M+fK^0=GeQBK-0A2$-~0k=yJLS%+k)sTbCKYWzLrAMD64y3dB4Q9*morR~rA1 z@ri?8G_zaU=lkOOu4miyUC@$Qkgc4mobrNFj&SXI*N|sPh3%+sBCCqb&7IySP18!U zhT(Jfv9OzVA+s0W+q@UMa+?-{W*qMs4e@HKKrdY$JFTv*hgffs)C!mCOcPmqvaMkU z69e`(U@B}i+5YcWx(c<_FegGG1+WJ)XiLM7py$;|ChiUqT6N=lW#X7hAv7n&6JW7~ zk7LsW$J@VPaDEcG&9T>%*FtCSW!$MU2OHAn$NcabfSTCr;b-{r0=ocF#S<)iQa6yR z&`7@dB5?o*PysEv;&j*(+#h{U#AAm;f{;TwfN@%4ucyF9V*#?#Z{h7Eu5V{+3xatjtS_Unn>68f2t~-=bb)c zCY0NTrfZ04tgGZdqk)twibk|)b+1YgR}x8eT~hWDSm((kZV?tg*vA)h7hX}KgvzV?tf3#e*%zipOe&JRte=jSK(}N=)@< zn%=wIZpd!c@oQm+us%#jBUQa_7ZgYo4Y;3)YrgVyOr-R@a$zKSXCpP&Zlg;Ike|(& z{*GbI%^qP>+f)N3{MAvfX`@x0RUvpn0Rg;4^8jz!%iJ2D$kduH>( zJGM3;U!lpaQ$*2P-OD;)qWu8o5wedb*@C-559UQOM8^MAndHqJZ~m7|22lS+tlHC> zd%mDaBdF)i-*HQWopsYc4w9w#0vjpJyJg<>OGF*0HLWqgi~%C!n&_UIn_)kPvTwEq zeG+hJ9X5sCbaA%LunF0KQXC#}Vj?!5M&EYXQ$G+s;6n9Hwmd)Ap=;r6wE>>aO8AokMYhd0Ix+so{B3#@Bz4Uh zr19EYU6XZ&qU5j-Ipen9FeAAiwxR=zhvklR0{Sq)a=77m&7}?MIeS2NO$hlVXau6x z4c%~`{f_{focR%9+q3qH;|IM%ba9SukxnrO;hrJG8d$sXH^hDb#XB({?#qYVe2y21 z>REV)C&kt=m%ubuHGFO|A1O5*LVtTdeDwFAoOX1>yUEcIc?DCZ0ICQk-5DeNQ?Ag zb_)iH@#3?4=79qD6B}f8F@=!uk!5@i`}>7J4EpX`!1fXSpCdkM5qu@ZW}Q6L9n#Bg zFGqq`Tt(`+HJqW43=ZlP<Z|SeQWfm%CP2wX_XBjcLc(*@*}jtVjRf|(^8U1X&>H)P7dgCU+lM@4mrz*Sd6^c-a!B zq-I`btx6Y4)$C%b+k4gycFPsMDW(H!t(Ld0c&%9B_4bc znrEQ}DH`8WU6e|=#!Cog%=jQ{9Rm6ykqcx-jxzQo1LmR&;ZNq+MrXu68USu&nvJvu zi|KtDJLL@6N@wOTP4@aVQRZ(Xj6c1*%8n){5<^VWZP$#p*5tQsL&E6HLm&MiXtc&6 zVrIMKOId3IT3;R{>`@*!E|Oe*N&okdhS1q^y4<$=4Hf_mLA1i(r8l--(zKY)-!Z?x zfx*H_BZh29G%0MkMX8(p(RDE+k-|luB7}j2jO*`OE?US@OsIM$igHpFj8I1~?RAu% zs)eFdG3s=qn3+;MYMb3W>d@czqk!%5Q6-js_@V|vi4KL6cqy!boI_WyF(#!u3mFaP z%68od4pbEe|IUYJwX`;}8yFDw^ldsc*e40qy51a<#SmrH>iNxR2%05zE6z7-8a8BT z(9Lc^I?$JwdHgpde{^oH^H;64f$Rs~BRX%{QUFnUH5Ly+}^Q zje9pZXCD)YxABkf6U8#%u&m)viNLsyDHw?dy&T-OQpJ@cqSJ@n;)X_{92^uPrOu5l zMUfoZL7Gyp`wWRRNeIZwb(&%B{EEo$sj&^Y4pvT5(6j$rn4<*1EwzRS`ldTS{ez@! zw$;xJJc)p*tnFr-{sFlv4)qFK+I{$0!?dslLk8Pq?~Fsg0%g5w)1~5AO+Z?!Sjg*L ztz3>e2o-F8J&v4(E`exZ4J+Iib$u2}Lq+A{_2N)by)gAhQG$^@>b*)MM-&Mdd7~~+ ztwF)vqN)_M?gqP5lUz`WXlw~V(UNtLY+6OTnQ@@c+7)F{(1Bd@l4wUPXrP8+T<+eh zLs_whXr^I}BW|_H?2}gVIg`-mW$yqdqDng+BHDSMWz-O%YsVZv_<2NFlWr|X(056W z6ONTRfL-t42)!$;K6y{n5ZMJ)V9SY;VMMq9<8@?s?}~J|KQVll5ftHZv@;xB|2!;K zbn|4lFwo{N7?P)-j6MHzLMZA$DG#o5zSgWA51E5&Ur*dtp^NZZzKu>bq7Z(qd4}qD#c`)G=*qoe~ z!tlagTp1@*{I1`g;jj43c_H)tWB+B#4f*hoHwkNR>^HpkFJ!rVlNiVKd#C+m>$q}Z z|BHsN{eyn=-tQd!;~AGc`X^ue1GE0|^2>f;)i3bY7~asX<}zL!y`rjMy zCB3iWTr)6O8CyQW0f_MCA+KJ?m!6m3BfVwr$G`i2Uohle8SZaBdD(ZIa1R~>6a0m9 zuECZ;NTT1*J&Lz5=8xQa=VScl_osev<7Rx212E>_oO!yT;AcNe+LZgJKiM$^75I#`y@BcXM zSK04@PwO$fZ~kqTXY<3LCotYlT;ml@p8L<9*8>hZ_g)Y4pVoc;0rUDOaYbg?6dzgW z$tCUtGjuuIpK@q_h%cODn8JK0;U_;O^Lu#{?!k)C^AIz;p27=q;m_E5aPS*%`14Zu zl#@8M-u>p`!+oI0^lN!o=qujw*w;LM+WxJE`TgfJw*C0Wt0R9e;dk6IJ@d`ayo#n< z`_AH+SXYq*;3Y|nfP{@e zg%^YY=?77s!1{&YLx^NTPY+2TkP;|BN(KOCX26OJ0PX>NlJ31~^LzK*HbANbZFO%+*17h5N7>qIFMF%jw%Xa`>ej`J+f!|1i;J6YWJeYe zFJ97)6%#&q5)WX801WU36hMG}ApoHO03i}YnkxY7J$wE4y6gRZ)-2o0mXo{IX1lRh zN;k5bH4_bU4G@_qV z)_5>D9(zh!WdZ_dA8cs5s~05piu4W~vCi(cyv+{rN?LWQiMMrd%-!~9^If*w?FF}t z>=kfE8+F_G;%Ptl=&NdhL6$6S%fqfWVm>2QRd$>&v63&uN7Odp1i`n!Jt5d5t-L<0NUcxLLVD0ZA zd&a8U>S+f?@!3o-c~M1Kz}nijOk!AvA^VGqVVg|{13l%BFIhEJvqhUst6Cbzuu5co9^Y)II@&JZ^>@@)9n5dBCu z!SWFJH4tn}*a(XmZfoS&@US5}lIxLn%r|7D9nIBAL@6gDsGKKIXc4Cn6pWz1e<3JA zO^Xt8#yEwbhy;ZpC<;MQ2*8splJCly8*x@i*vK6s_W4JG5j020Lr&6&mS~JlAt)lm zmVb;+AyFLxGNVMpQBi&xf|?!Oe6t^7L^12MoYIYyEGyqbMwUcP5)zTbMS({v5mB1y zBxI@cWD1Sq6oMiU6osHe1Wgno0H!nHwY(-iO^ud*?sRqR(lJ7}o5sxu+TX(Ic84I3zPNi_Y8279$mx zyq$32PXjWn(Kto8YQfb8orc>Dw~Vx5@jDS0ZzQ&=w#V&b*7dhe%4u!RDHy84+m%c&w*e4Hp$QjH( zzdOG%oAJp$c+)2=;Eq@NGadQc!!O$}yS16>)~n5q;T`UH5WJdjaSyyN0>r2xdXlt( zd8#ZL1<-}v!T-)h%mo40%Nn>IR8IHSFxuL@DJliDmwlLVcosLul-eB!-Ny&`afSw! z`rBgC!ElVr6my;OmZuzMCzbJSO08C4%HG6l_^J(MtMI@-oZqPKTBElwygR$`YhAm| zUugPsFN0ni--7983p=^j@q7B7mBg`^@csL+M42;JL%cm3ANzi_OEWy zr}B%2v<2UKL;~{~eus?0)1$y4hEsd_fB6rF$R3e;GXFNw5e^Hl9fzSFQb>Z+DWUhB zPX>$r>eVxC(J5 z3D?AK9v(Bc)xnY5?DX--7j~tIR*lh$w}|ev`Rfqm!KD|UcM~~~5y6d-U++mo>OVl9 zyKRlev5mL2m&$w)y__5~dRZ{)4c;%IRjwRon8N|+L@V=HyX1j zZ6eOnR-&+K+PZ7!2zr?UhFD8qpv9XMl0}fOI8600IX0&mVQrx?6U0!gCzIAYy@8_B zh=nHEn2#`EKSlcrG;*T{yzobSJtz;f7wlb;~cR9;#6C5>*3z`cnS0)Dj=gS0) zRcg8G)h1;^dlkDdf5NSwS1zn?RWYFQRflB6UXYttqfF%Eu>+zBefBWuMm-O)q}$F6 z!Ij%^SW<^FOq6~dU&#?%O?s1Dtk~a{CwA5c0-R8Ofgu@gsT_?=jksMz#u?%g_%s}H zCpa_hacu4A8s#q0^R0WGHXATm$LO3umpDJ{BV26JVQMAMx6A?9>7Ry}oeJDnqo{UU z#9qghq<#4H@r5MuW=PWlu3YvZjVze=j8o3<@a%L6xzlGBQx09qEE#ytgD)DuUXI>; z^%JD5))zGG&s#wg0*s@x>7=c@by!85nqa3Y=o7=Kn>QONx4;?qLwKb(E7q;Bdkeal zEYc)GE*s^3Tcn#r zoyWQi+dA~Q5USU88vQ)4CbXWe%sWv#D2v`S>K)K<&!Nf^m)nD`9EW;PfE1S^tSaV! z7WAF3+@uLFPN^?w1gOYb0a7yT#AO3>(mEUlbwL-P!g;53)Pt~Sd`If&jF1oWxtuQ3 z&wZI(JAEUa3^n(r}=d zQ;}Kr3kb0?SMb%ex{QmPFPCB>!9XoBGpWwGQr+YaW0a)g2!8n0ANobEDFLQLt?UrZ z3G+|>4xDW>ikMQ*Ciy{Q=Ro_Z-t~sen3Ah^qUQvqsIMwuVzDBejn|z!13L&W2Uq@W z*DQSZvuO+G@dN%TJw#`7_#^HA3`^oLLpu}d-7yFI^K_EYd{LVWobbVmw&c_#3Q>7L zwX!}?YLE-n$n$`#_VS6ef6z_d08n7+&0*B|>_X0RD-P(Pi4}p~s4(}}^;JHMAAXQK zJAP0wUFKz2}i(&`*b z8KtEDnoMho+0f_XHcOn1Ylox#k>aIit7ggT*4^EXKI6TZ`)K#iW}Mh0(k*6$ST!8> zhNWK$YJsp8Z=?tMOYsP91uIn7#d03f50*oDt99U?p2&9XxvQ(5y=vX6UCL!?DqY!P z?A?K22J4~$l|N+t5I z@REJ*SsCuB)ez;c)eLikP=uDaba(P*n3}{o6|sB3gMEAB(Lqow-Hdmbm7hH5&Wm~# z=uCIgo zuX%io{eaD19hT{6!PI-ltYzgUnD~-1Hvh0S46OJDK`0jHzwC&E1 z6#5<{Se?iR&8Ym`66wfP2ux}>y=9JB~IkaSw z?wldheSJ}!9~p_Bg1w7jf@(%pcB37ouj~MD?tfTCvPj3?yN5Yk>+GF}^_1CD)F@5b zJ69Ms#+!SHoykvTg7&wGi`7j8(Ja8P*XR2}5#{;C6IK}wgVsM!hb=gvzv@t#S+oh= zEBO&upVtGHzhw7#qA9@}$KVo*m@cQq6tHZon9b_W1pNGM*OWEO$-TC$%29i~Rc%G| zbM354a^^Ue>A%XzXicJL-MKzeOZ>D8ZRw$8VFPsrN*luA0_KY-3L=lz^vW+}f`?ON zJHE*5o2&M=WijDlk2?T_g`k)4bK%|IU)Ow!sReuYOSTJ8QQA4Iv)Coh!R}a7gfd8E zWg(sin_?jG3x)37Pi4(0K()Cio@y0ZxNld}SMO{!a7Tt>z04=}(e7@nZm}P#>s~GA zGvtj^B+^C}Yx6#!_N^cpnON^buy>ug2)b-=h~HQAqYEnNedM-E?bKY9>&_r^0dL9MK zah!%Twn`(?xDM2+#-Q-{m+TlZk?Ul$|Q$H89RslwCcsYX8hNhni?9n~g9_^(ZMa!++I4a#g- z7;0KjX^Q=1Uma)t46AM5_0EaJQ##qDkg{dZI}rs#_$0yzm>43QkV);5TWRe{Y-wz% zZaHs)%7_JtZ;VzGVPcNr=K0S9^&0Y$F#gNF`*|qrQ(aN?S@a!}?D+htrQc{K8%qn>i;~6pQ5SE}9<4+DK(-Xxh)a$` zp6CsrGeZhT4o2p{S9pMVaQ7jYW&~TSyC-TVT}BD|WUAGIML%&J-MPo%<*{Xec(8d1 zq;mc9guUa(xcOmA$&)RE#D&yYLaNz=We|Vq)5CmY)^WCVJN{N1b>QHItw5Z)gvJ0M(Q?Sc_1*)XWJ zBTVmsoG*Les*?R?+C&?Wm4$H$wQTt0z~oC><6*6X%u*sL_!Af4#bsL%1_pnU95`En zJp_JwVN_^ByV6>uUEm%GzriqAMZgCT=1O<|Gi6s?l$Owy$SUP;EnpZUD5@;p=Hg#F z*~LC%UI6-0RsAaH=>WCIGFTKmU$lZIxnr3Gj@Y@cbp7&1g)}#?)nr-qHpB^T%&M`! zBf;P-ZO51r6||yu1w@@PW0fDqfi`*Di_ckt@xNhopKnn2WlVe{eYICdydI)fkypbTSCUt5jQzGqc^t=s5BDS&vK{IMenXR zRw9%90`1|d$MDxJ()a8hy@sm?O4W-7O<_d&qcOCW0rgCMvY9~1!{I~%^7OqbZ-VzXg!tjh)n7%Kpqkh>;n z{$&w2G3m1#N{3cZJaNp77^!!(_TXmR!{?=6>LF2npn0J<1G+dak(M`y9_o(#M$i~C zS*d(I@~jzLb;SYIs<98yo1?0bIyq;#hSmcsNJ z006h~d$0BaKgGobbEGXc?MUo^1?CWXNvnnPp(89`q1e6)KBGMgA^cLZT*r@zhsm>I$CV z{LHCo^EqCbI!k;hZzd!lKhz1fO8&bMYCmMwF~QhTt{*DR&BgmvsVO-iJ;hY<``EC^ zZNeX?IxHX4;yv(okO(m(YCQ~n%jO2? zIghahl|CQ|dqwqnj7UyQ{@+i`%rk9v4-#h+1)cfAQ{y>d2BV^e$T2XSm&T*FM}81- zv5&!$F0`cP5sinPjafj<&2St}_K=<@S9+l1aonPUU2eSffHC6WctLndtSYRU_ z)ft$Y?aPAcQ66|a@okhtx3ClxuL@XzqXwu^ITdq3hYVO@lo`zjwXI{n-SP>`M1`$^ zx_#Izm&4Q0`Zh4w-~%nA$y<<*Ub$el2Gv>4n55UE`3&aKlm_fRwswPr9;A~sSoqju zFQ>^{BAabDu-d{f$z_5(q~^sV4wP0onhFkm6DUmP<} zyYxAqvE2oNM<9Zr2T|+mhx3>7)%q!ezdHFRs}O2Of8=?KVfd#fNuU=8TN^W=7hZ;S z!SfwDOpUb)h9G{pGS7|wo~7g320LGbIBN0?^aG9C2H^Ag9DEl$qwn6^G>uC2ww{ZS#RF*Ai-nMb}`&<;y`ce@s)zJMa*i=j?b4E`a zHTy~f_?93hYoAav%Ih3bPW?dFNT^~3mV^EJQ4@$TWj;#j#|E-9mYB_pRqzfnV*qFs ztZNM_yP7LJp%o{mI5Fxi_nI1^yjzB)G5%p#NOC+FxSoRs&n-O_Q4L5Q8 z82xPt`Tfc^A<{RJbbV@fAOJ38y%oF?Cvfpmqj&TmP9-W+8>pf;SQ(iXmK*10AkCj* zJJ$$}@6ty-6l8GkBAGUOLzz+HX;6O#RAYLPij-i%ru7&pn3dt1Ol8Bf1;-3+wG3Wa z?A3+AVgoGKF|!UMhUYG0JM{==#CtyI1`rtuv!$vZfR7s4y%HPJwKOLLsaqxR^=J@( z^Lc@)JOCb699i~5$qI>Qib*x&RxNOTj0>RB-Z`qUZ>zBGKBlM?e@~U^H{34q<8%b( z?Jv6_n0%S9U=G}0GKNT4%pg}MHPjmTG1L84@~X!m4c4EwNq>;>XV#Z|)H)WgUK!_{ zmMnLI6bE-8l{Ab*)6ZvAxTL;sF;5BS2pNK&p1jcpB!pTbl`O$gLsIInmS)b)a|x-2 zV&$qA_~$|%<&}QcE4CpU`dmy80r~$lV{gd&f%~8Nz@ULA#TVri&A^`-iTk4n zW&l7<9ey;V!$s9Z^0rh&f7a;#B142LADBWqC*0wOJO6O3)(2hP^5Kp<+;E2-?zqDa zciiFZKhDf#x3m8<1ZR2GeYpkU_XC>F>EHjanD5mG%HJ8!j?Gl-K^gF72u2;vWbamY zZ} zvSKN+At}-2LQs)5o1}GYhzhm2P$(c9B4RBfmMt5Ua&9hSGihQIs(fafP;3|zN>f6o z$ST#;gewTf|4och358Orgi#PRHA4jBdmG71pEb5vD5*+k1u36~C{)dbQWeGtbvB_2 zQf4QbP_Pn2K~&Za5n0$MrB7Hv1a4g-h2I;kC8(hAN}`nCSSce4((edwA5mbKX&cH?!f(lK;EA&Yo+k8mP3DoihyOAV zXZ08((|au^5(LuN(snyRNjp*Nxdgqm$lBH>`O+Y4yPNAv1i`ewwx3RrrvdPG6Qr8s z8*c=8n&4YdCy2DpTfZmBwAI|dCkQm!xS>ywX}`IEO%SR*xbsaAscFm=U4oIC2;IUb zB(;#bh);oPAbCxct5*cEt?#{8g2an_7F0pxv_E{+$lQ-7-D>3S5KV;O$?!a(n{Y&- zKWXrUW914A6|WenS$PG&f)mJ_H&((-7Arzck|-3DL`j&GN}{AB62&D^C?<)LF)5Tp zNl7G%N}^Fr5+!0%D2bDjNfeYsqL?H~#iUUZCMA+6JfWMoM8To?sW0M*-oz7AMCX&< z=M%q#Cnge&4-SP-3CF*GFZ?S%1E%}feG;1x_udf5ga$H_a5VsT2LJ$5<5)vu8WJD| z15Nfs8XEL&*gcS*n}1_>Hn7;xjPCLlaNmX6I!Yv#KgH86r5iqNA0jF{rp!T!yNu zhA^!28{>W)2njew7<6m%&5*+y1q461A*>ds3DKk!H54^cU1@2-a;~QxP*vYubKgnm zpDB`t?^WMG?33Cw;I67;sPA4{^3MC4oRw1<2+w=(*~M|^^WA#G%y|j?#OT?Wz@J%X zjQ{}@6#)PM5e-KHL6l>N!ol7csf_umDyzIntJxRs@83c4QP%~M=Fa>2L8m!DYp(08 zdL!-g30?jYGu3=^a@mLa|G!4n$@y=!=itLRJ_bdJ!`G1Eu3fCzSklV})kw*cA^rv4 z@7@FO1F~LQh`bU3q&*u*A{(^RynsJm__){k1+Vkw%a-tN!f9KZnQ}x;RqXWY_4N9? z#ZSC*MelCWJNc{d?cL|)qEPuN>wNFJpeea2$Gb`meHG!ppD-1@wEGIGx#!;OQg7DZ zzV*mbKUe$DK?Mh0r$HC`x8CfqraYuDJR!qybVUz6hF1JP(E|N{aXkvgcEG&Rtbha# zZLx?&_)%yv`H;bLELevZ!ofbe;f#fASkW6ihJ%QqNmp_Dp|hnYgS!Cit#YtE+&3y3{{EN@_ejU1|?Qk5gGk zO}V?=(;!Og2(rHIfwVi{_MKu~4?JXU-(My5U|_U<d6ZVl~ZWZIklE-Q%gvf@?9))uPe{%_9J0-?-44kA?&@OnYo07 zmehrX=F~8fEPH|91lH#4xpVSRJ1u4u=bv35rz0M>MADyXKN6p6I#P^kZe5qUrsngn zf5KBl097NB0#*BwomC}C&#H(dXVo?11X|jU3au?k5>$;yidNV&%v!Sc)q^Pe%}6R# z%}Fv;ElE05jYy7Ge*G}ivIDa0efdI6?K4VL%}J3~zrCeXO-YKXzV%bL?WQR#pWXFm zg(dUrff<$^-`Bn4JBw92eXUHqSRNjcIma+H_N`Z-H*2;pR_O8z!e{?4bDdE3pIhIW zZu&><=-Ez2s4Vs?dN zhS^?@2Q*G)>LAH7swL{kz!D>CLe@yL4g=MaJU*Z~E$7E?bpU2XQbs_Oozo5=n~@Zj zBm5(6vzB3gEI%U!z-*&6a^9KRVBO__LSr3H@rYQ~$l4C+k2*6xaxmt(T`jB$EjjHn zaEVB>yN6m#p1#guR^pCKupTI_umklGh?bC@b89tUha~Fo!6ZxzdT3%)_CtTIu&q4V{9lbLNgm z_GD?0gBaJS&VeQ~v2iUTcjt%26Y!hUF#Vx8cH1k{lt&gyCL>|h1Y742OxXvnN&!S`pY1sjG zwui;pg=L7sfA6Rp38DR~JW$C|FxbpUw~%#432zva{;mSgcZqEuC#^<&WbDvkC29<1 zU*;!p4$PV39RHfei?ZSm&8obSA7ZGAr}9iTHf$%bJSqcyj}eck;J%Oc3gfQ_?qH`? z6iGzdTsi%kJle#(7tW)KO}eWUmV@RSG5B_I{c=#`yU^RkXYY2^@Jz>rxy-wDZhV4$(D8mNewstJQ22OP2YEa zKg`?TW;`#uh61-uV285emkmafGFC&mJ%W)Oo)E3&vzV~Q8Xo%$SGa^6`TEJ9Sn%q(jj3sHZ^v!m3E4xVOyFCT4b{x%%!PB z#J_7Q#8)CZ;C@cq-AtDzz{^xp(DPh_>kAVkMI`$}UoJW(#3(Z%8xsD*XJbWi0wEPK zB3T*Q!bee13j_?r-8V{8WsRCNglIE7wDXn*K#WSfot#6#t9GTVX zltiHcxi8ZKs9co8V2fGj?LVFe%Zu}o`cB_fHgGz0C&>qNJJ7h2M~}ocmaeg`So!UM zOnvEvZ<7Qk=(SY;rgoXqQ`aCkGcRjx=9?^;#G2WoHgr+cIf}UJu7{iW{(u=&)ylds z+WrRwxUMSapS*i9c7O9VkWNx=;{(^C_%om-G59U-Y_}cg@m>g|`PEod31PlE7b;YH z7-X0QCA(*+u~&euF@FL588#1C7)^~iw0D7c1J zlm0$#Y!odA;GY-OM%3G&l)B-!76(JeuP1*}n;W|8-H_c2yMrW5b@J_!&b&=Bh9h>&~MqsApd5TCOAEBuXLh;T>SX&B5K^3+NF&(5J@rrD8KuFAuBNEAmY3CC- z5J90c0fz1y7{iftJW6OGhv$OWpYC3~_ufFruNjFDPa|`N6wC=G%pF(E{+-Mmcp0B? zk|Ea$q|+q#A|aEQY0Mr1*P|(~*eJbfush^Vq)28 z6e2N_tDh+jwc0aR^H1EUehi^1(tG*ZJR7y=!YZQ2Rh&Bx}vCpoR^&;$c2;SVUiQI#KR?E;P-Yd%8*kyc|9 zy9-ek>@c%%(%OhqU|_AIOFAM@;dt|^*fvmXRb`|BPv5hABI$6d{FSq0C46+IV(aZ9 zW>be9@^Sqi#F^Tl6#3dz;fDG7x?e>>ktYst*B=iG?O1QHNeq03bHLaR`2$0qHH=1i zf6R?!_cD@Q-#@uWSu@Z39PjM~b^Aetl5_<16&mX@4!u3Wx2Z{5GAS#kXFBuLo>p3i zS|lgFXz+N;`_h*%JRPKTHTG*2fHFFru7jF5hxJJeL5M4;BQ? zXqHNR!Fj>t^(J+MCb+Nec{k4*vOBW!H9ehq;tfnmoM9TKUeNmcJ!EsXg(wi~cn-?j z3@j4?cU)zCXUKR$QFV2+)`GaWk^nxt|2-7bA-Rh+IRx}+H4t@|gh*gIVwxi~v*7I% zMfD{DU&y(IJzC^VJ%kGowS<*{^~Qt7%21}Q2;oEvy(_M!w$r;v+|6SRSH~t+G9 z)}S5;#=reIB?I?u!p|0hT&QiC{tjnDT`&SdNpCzOuLhXPlv z>+2)SXl7VukmqJ*XV@Hgs~MS9A^Tta*;Wo^)joRvkezdIwi(A%IVWj`$N|`xuSOl1s2)IB>cJm@dX$&2dZbWSJ^pGW)vya7 z5Ult+pt#}Yqc)7sHQUp}_I#LfCwek3l#!0{^!Y;8;*qi@G!Go7aPXmhuMb{2I(ZR3 z7m^eA;b70(PRRrk)BhQ96~oDZRzE{=Q+Y^VZK|ZqZPTzE^!0k7G?4L=lN;*TF zhIOvy@j@YFcrCfCGtp8b2E=;JZsFL>qr4g5&$7maU@nG!w(KW6%Vl~KWN71BO%XAu z^D*tBC`vr}=CZjMV^#MKCd;LA;e2Fss@L~`?k?a%7R93Q2@+Ox+eAWWf!_+X|8R$eA`PSeI^TPw%|2NyXhi=O|6f$gNk{={V5`Ig74wRn` z9?BAqSQ|-ZIX)I_z7PivZ&_guJUBi)I4nC{nd3NjIZV@hockcRJISh}J_4CrO^+(N zDobs56sp}Acm~+bV6?gemdRov{9vpiI^$Ug=2B8+vfyWBI3@j<18o(hgziPlj9Yq z^YC*(#L3n|c5w$*o=Z(gqoWl!!_v4G@JM0nTF#uH#0jf|N~TUBKr&{Wah?|rZG>E; zsH~ZjtleOCaY7Punc6GW!oo>tvBR4l_EtKwjZ>c>%#30k%lj7{OENY@;KUTq&FWX7 zpwotPw9N=>O0**YAL(dWu#C5M^EG}FHaW4f29C4cWxur#Ivdzs-7Rhe5!dACCyDE- zKuwO75!}cB1Df64f>rzGQg^vsU74ul1JSBqCj768HqzDCzKmS*LkGbx<;pNHwQDGv zYR9{)GpIjO8shQNS5@erHQ`=vHDk}oNm@_;DLfg{7WJi}Y+&yCr-<~XrDQaLk)Z@6 zB$kBH2`UqqAP8$l?BQ7aDzVLVZr}y&3_C zv8I8#{WaV5?M{J@_f<6A|7SjfZ`V`xY#gTIoEjOrQkH0h`*Q^i<9lPZxHIazn+@Tg zt*?CjegDOs>QPVqfB<+rf(ne^_v|X#QOgE6c)r;2`n~IA+Ozr@3ZUOF_h&X@KjYN< zQ`NTAg|fpKV8H2o7?OEDh1{g)Yjtr}ZEhrA3&_2l?y1R}V+$B?WX9em;c-&!I$%k3 z3$ksKS%Mf-+VD+s*Vp`jh1Q6JrUgy*dY)qI^*}U3Vy~A#w#kzFaks?H&5F!QSDYCf zdBad=s7%`esZn@T;#Q`N0vvfM+1b{1r>p~v^J7ji@l>#`77WHld*}Faw`+#~K~2FC z*M@O18i@l_d6c{FQWJPf$DFD8^FR6EGmjka*1YBtwP8@*p9M3|IWQ=r#AQY+Pi0*@ z+vxNNkzvEGymf#fA4w_54tJFnPe^!)3nc?q{PrRchMC=cg7 zFyr#mE*3u{A(<;pwXB-HdtXjSiIwOmOi};x*rcC|1sO~RO}FERMH1584Db25`o}+v znYMT9r~IPa`OJaXJasakPTcZermgj>vdW(81&szKUgqmy^X^0o^{oa`hTUntG(!A5 zh?!)g@Dl`vBy*Zr8aHIrbHIZpW7DmZFFpLfrZlAzY3*TU`(YUJEH`0+FxI`tU!sXIC!4 z$yI^ap!&o6LY1f*|2ORep`013LL94-{jGiJP4&S~u@%eyQMmffxCaMcX!uy|jc=7S zv;$3WvtRPR%BA1PpNRc_@xgs7U8h-lKh-{c)%le!;S3`55*>PS z1Upr?+1cR6!pGW4u6ZBX0Xnm-6^UCy3AgFf0_fl#s@?dOt5Z_m>1^KY@uMk8kPl#1 z_7dCrSt zHtN}7(a=h=z*!UQ>6NMGK1$wA3pEmc724~TKLFR+ZK+W~tlK+zs4Bv@w0QlM25{<^ z0*5>g;%HR84oy4oFAb*Y4(voetsn4x#N2$j(v~!1AcE}vw`=f@gE(cW{tVl{( z@QzOSVvk?bh}PBZ|CSzV#ysc*)fb$@79@$5v&U=z2HB z@TXVA{+HH|kG-qt_I;`%rcv|>%}0iys9V@cq!Hp(j55(6hy}G4_RQ4Z8ww^S=@<-m z=nK_w?L#xK_NgWytjdXDe}3}*RXZ3POcCRWj>*Dei-72nl0Q6`R!j-q>A+=P2K0WV z9UJ-$mDeXhOAD2WEmS&GL_FF>5_8x+Lb!5x!6B#RGlV12#AVxR!8fy|d1?F#XeAwO z*a@#e8j~_#SFD*5(4IgD)~&E=jCPt+Moq9tRh*WWpKkF4(8MfN<2>eV2LqR){WS}V zMemN_V(1Ag5K03Jw8~q|76^J>EwRKeb z%lO$QqgyN6X1gapno8{I#e1N~DAExAf8@F8&bNI zo})Z}?^fFl|S!<-=PJay|Rz?Lz~;WVK}%=2v3rL8M-tYkL*lSi}%K?Zt-A%z+t z(6@2&^X4{6cQf4;tjneMnKSJ?2tG7?q3%s^^FJN+D@GZq_BbEs=7b(!5RG_|%ZViq zJ;<>P9#t%Ex1X2j)^qGunI$1tVMg@IOSMuKV$~dP)}+XcZIcw8pOG+z&hxMS;*kOC zxjp5uOsE!kY1=e1axa-nlP^@b>nYAa^jjhwj7kJO5{)MVucKY`*CoZG;)fSR!j<6X zud#5BQ*P z0*ZZqn(WS-7ddP(<>n5kuz5o3wREcniBm`H-8ebDIh`920=q#lDb(W zc;~j-t_%us=LHm~PZd-aKFj}x64@8n3b~^tTE9teQVDT~;+HimERZy(l#m2|NE9-( zVlZ(@7@aC&M+ui#CGHm>Vk9~g3};J}ta~3g0oij#_7}gI<%}nlGW!ryGdW~6^FLV- zjhHJ5`zP%!5SS>v!z>tNaP-yDhW#P(tf5Sq78L$?-MR8O0?zz0S*b6vlRI)rhp3NXcWhduPm`#1tm7f^rP;6!%CCL6;4n~>JjH0@iz z&M>C=GX3jwK|wEdA;|$XE0I5NazLW z#?iq?7s1DhbaK(u>-G=D(}3GyZ9&|i6z^3gSUga+g`7jPr(hlraRr^oouk-d zmOgqALg!j)$}XMjYe0aQhksm!JjP(K&KB-d`9i=(_z1updJNdO zjfut#pir68(O>}pnRg<1Tppv5{j23?%=5wkc0iw%Xb7fPOaY(?*G}YnRE@0wQ1i}e zRE4#wq$)gxcJ~T&nyOr#3h5i58ePs|J5-*^vzWk6yR>F)_51=WUv+mkLeUDvq~pny ztLQpAbo8x-eVyTW8gl5Fgo9Y|i+Qq5LP4q0*>M zLdjz1*qCf>d)5(SP0Z}8(`lVd$e#4d8jU2FAY<^KvMH@?^LMzw<%HYtlQiaP$HqeM zZjYxeR?a9ctL9AFiJ1!A94`w2`l~k=olq{ATcN=&3M> zZn6qc&!BO?d!crO0CXbk5^Z`e-G0ZjlL}ATUQoKoN|EPP+`^_u1^gwIMzV`jPfxZ? z5JrVGV%Ev%=9?$tB_+{MMk{B1@?%aA^RW9@%4oK@BF->pqijTlb4SrAcDlERcqgiv3_+qLe{CiMx&4lD$KWLw>|7P|fQg{t>5IH|5x#@2g+uwgtgwN-+F)>?CS zsWyp8^6UsUl~1eC_<=ngl8WGNsj-rt3ddzUT?JhCQ_-0dLeM3-qb$`7uCd>uKl6Gf zeB){Rud-7VN?+XjguLrq&A;ODf-VV;;E*I|1Eq+N+}`&Lvw+{E8JGw*jnNzx4;7yz zd`~%B8WA!21f7_+FU=Ebb_R8#Nc#NB>2}Sc-6)^g_lQ%Na=l_QH8>vWrtgSPXbFo6L7G$2j{|k4F z1Idxu!t=wMP(@D#)G8?tnP}NSs_%H9DC9jKfVYj~la-+J2@BFBC{rP4tUUT$DRe`O zvE@7F3VbFh?wr#r^JJX+-kHDqQGMxbZht~0MN9tVX$y!d8zP&+K3po|awqvtq1>;< zl8_`pagQ|;8wrtL8T9|548@!8`|!*xxV?bYCpHDCnLdsi{={;MDd?$K)hnItDW1I0 zB&%;~`WIL}b;i>0$B{Ri02HyHN#4t;7RD3LlClq!crEA$#-U56Qn#0xqI|t5-SA4I z)vn!YshrAYw0LXl?IyOfgfIP}bTk&yu5)y};?xuP8uc+7aiMjwiX@-^y__c5;Nfr* z6u+P|=;Ed)Ep+V5m1ZvHmwuSINlG9`b1ySB*P@f@VaXnHq|Ey^!P4`O|9!N2hGj8y(IR%nEwAt4T^oAKKtF1x4{Jw4Wv+#K_g?l#= zn1n{0_)jWnCXV0a8Y$m_t}JJtJNCTn_o(b_#*tAIE~2}Ergf6@?NkUkq6Ev76U~F@ zb#2#u!N_vZ^vy}RXd6ryDMNLCf}egg=Dc~}RJ~f2O-3RrCJ5S-(>^hCtqSG;+#eZ= zj<5Gm5mga1VoZj8>gf?^tx)Qy=qee?YL`^ivKliR=I^UjyOE7eBqi;Pq}-OHXODE} zjTKWiby2Rh5n5na>pzd0H1H*!qy$}+r=Cm9?~()(F|QNL|9X0Ww7*nN_|r@eXS-fN z+*{$6hVpgR5+2-gSHMA2XzIDYke8wzW0B8AI=mk<7+O%=LKXfMvg#$x>kHPF6A>6q z=+mCAvsBW&-gDx)Gin_oKeMHf*g(~2Jq=qErbaC=Slfc_JaE1ygP+- z_Dtk6(ow4V>Y9pZCl(|r@{G%oxBnJ4v}LiEftF)FqdA938|l7U?g7l^=h|&miTy^L zK7lo<`xLQsg$mll&7|uvqNd2_o@-BwfA-#A(3w>10MclheX`G?|D=*BH_*ul8s?BL zg_C+M^3@oh7x6?>>~rVBOB+WQwMyVj-zaeuL#W06Oxvu2peT z3;r_wi@W+6WVUV0iS(4Razm(*teUivD!9={WESw;DfuZ=XdhivAY1&;zK=@T$o zd--3LU`(ZY@dof`YR6 z7C0mCe)8EYMyC!SB&D~`t&y5wnSOU#x0(sqD}{?MhF?(w`Ky7!jxK7@;c_&*3X< z*Mz4gT+X8^ysxakQ-KWlkAqB?r&6N4g^_;C4cF3)_hGitfXX!gp}#4dZ=2>Od4uDn zUxAX-=#pB(Kwf3fhDr)G-{5EX(m&&HF;dqsR*y(8NOVP`0Y>SUF zG=F2`<3Cnr(&_b^$>~V``6k9A3ZqWjKcVT85GP~&awh>s|~!PaZQS12r>AM90_-jb|kl z5x2^7D#Lz_vaWy(JFeJ`IFqo!-W6w{7xj$^pi7J(E|YO)zzxfmRs*oBONAqodTx`> z5;6azrx0JQKM9k>b^K!_X1f$=>D_OCGfwzHXVCp23U`PZ>!m#*72t-w9oBh|+IheW zkVuaxBO)h-xSTg8JHU8bcE$_#GC2S}>K^gdwyj}1$jSPbJZPDgf;36Mw-E`3MdUBd z#34!9x|Af+P~$Hv+Vr4xLu%P_KmZrGwaIH299QV6%YUHBgIGd~>@hnrGP$>^ds2@x zNR?>d_#B593CH*+l&F~M+`CdB^4036BE#$h(U;FhG&HGhM-i907U63`e^da0CF7y8 zY3M{*A8q9Zyjrz@(Wzq_F2@WT?DbIunWzFtdQcwsOtn66G&yf_R0Q#TZWTC4$Y8s6 z*sGe~+D}yX&if5D8C_nz`PUQ_O?B@wfd3;Aw9ygFPM40+`IP`SGJR_2%=CKNwmJoy z@X5{&%T}$z;J(JLqM8rQf<&PO$q!4)chTl(GXnd+r~Z4mi6@ZoIkASU6o?BSqyqzJ zj(Y^~ZeNj^1-TdtX_aOBuBxHmw{WQCaGY*WJQfbMI2a2!C&n|P`#Ch6S>~j%OL_-G zX9Gy^F65s~`hW{wj8d&*>*dv7$MYsI{e;lizV!p9TR1tNEIj`e#C``1mx9zM{jjb7 z+5-UPK@ifIwJWp@++|6*FwLlDD}+wthPZ;Pg+YBZ(Bs594XB}$^w@C!>bMZm6nG~M zoF*(a09x}L#w%t?=;<>QkCoqeC|M+qS>0QatO?&^Mo%*9_1H~or~SR$zKm>7Cv=&$ z{m@o)=jN@0e-dKN2D%)}z|veztZC@noBzyJlbPABdZvxFmuzi_@YZZ}J47*C%@AHT zFKY)}zhAS_dNeZLe%*5^OFy)ohK6>p`zB=8J}Pys0KXqx@&#)6Go~XA=^tZcSMRKl zax6L=GjWFK9Iux8&5esZNItH4Tey*G4LvboOtnUuMyH9;WWI7;9GgblFedPi&N;X4eTO*CTjj~~0?6RrR1s|W70QpJx`xY`CV5^XRQ8aFl z4ED^`94(w-D>s7get79P1)KWK(Lg~)T)Im0bVG)5ly_)aKN6_o>gfTS7(@NCeAWtJyUlEUuSP{R6KE59Uc^Ex-5hbf?Ym91D z6bl6HGI4Y!uU?3Sd@ove!fXDd_v&B@xYk|Xy;IIz#hE@)NwD#`E=N%tAbZwmhvOTL z8*h!($#pd(H@<-JxP1v*^*Zvo&})-mT-kJ%wQDA79P%g>ibV?noEqWlA66rY%2EvF zDU5K5Tl86ld1`wu)3sR=`eQl!kTuy6UWUW3zAf^evF%|PcTw43>R$S+|1fOO`k5k) z8i2gQ=`nX2ZWCnHc8bRU%h}yOCIFz(kP!^Wpk7-@yS>t!D%%l zSmMG|NQ9N|PJdgPwX)?(aYZ7pT&X}|RBq7Sq@+puY z#6N0(i~Y7_Hd>?wYfpwz_?~$twW}lBAn#B=p1Yk;ZrEe*17nx_8SI^x3}i3%J-k1w z%ei&kEPLX!aCUE8xDKt978%3Za~j39^b3 zxK=dJBZ5B_mvUM}Qh6k4fb3Lj3qYrBETn1H>O3DGG()!Yf6kMy5ggSu$jIMpZ3pcy zSLFLblvJ(i(nJaJMRSNQ)#MRjSR{-+96cZu57@QtEXVYZ%rDhqbaV2&T)`Zhc_bjN zxCV*ky`s|3Hk#7~SCye0w>2M}+RH77Qd$m=_?o9yPTt2<8!TC-)RrKR7<#=8e-IrB zT>Y$2rUXa4LBC7KazdiXt8*TYwC#vAe0BilC#Z`U|w|IV{LG zl5kHcNa91RygA2|fC3~R`wvA@+>0I|WBeTJobTTUja+-fyz~JT%=fE3y?b2a=gye+ z86L+q!H8Po4W7QU;#qt-+uTs3gIcmj8j?_3RLzwZoyHAu0>hnY!|4|)rM%7*ghVA+ z_0_O(op^(n-1mw7NoK~K zgt}S$>$ZIfP*I%q5)}iIfDdf&7fpN{sp_&%>(3TF!^}&#@s5l2`|Y%dO@A$&TQ!I( zK;{_dB6A`F*- zv2tPVGFw*ADuSad)E?DYLSbK3EaGj0F*a#(m3O;tRN8@Th{^LyC1y5k7+ySAY1wIf z+3&F!2bp$e$&ScTG34#(dZ&GtXA46%^V->Sia!MbFuzr4?bi$6dtCM-% zqFOLv#nQ!k+IxV3_Ri2&5>L;4mK!}U!Uzle$^p>kc<#Q@g9k^N*2ANy?J)WNCARBns zXDoR&0lgo)jkl*HMZn zZk%0duFP=m`)@WNkdrX^g6Saim!5q^4S;APweTreZO&38tKg!$l}g z4M%`G(tDcp$Cry{PAP{d#CbC~I1Q0_Y~J+{pP^uRvLC8tp4H9BZczt%+JBHORU~pm z$)Zd+a!8sfe#9q@^*?*}-=ph*C7@$59&t(c(v?FCT`q_M&@~DHD&rRSb1xp=Hb}|P z3%$vNfNy5jgIw7Mt5ur3W~njjBRyKc@CQ#wi&Of$9>7*v%V&bOf6BLjSGl~cZ-IPC z{0i^{cExuA_a`+Y^caIHl;a4EvEg`Li)V8y!EuW1@>wO_^UB^OvcNK}GVqyO8Clk# zZR)*Y*$-45v3D$}28Nrgqe>)Muq8n!)dMPKXCXjd8fCh2EMD%?P zzfba1aE?JnM>tp!7RFA>WkpOAd8ueMMS8@@LqtaWd%6EE*b=c1l8z9UN;IJ0bqX!W zJ9p+p=qOmZ5)Ef9MnnBQO$_08xM{lxl_HE05HE|am*n3dM#D@8bJWu3CVTSenT_St zmxSy1v!nU}2)jd0RP0`zukJ|}@4*W^Jxw`RA-Dhxxvak?BaW7S*50%oPe)q9RWaIrG&wjmon8W)M!C(9X-#Vl;gtC>^-Cqeb2m;XJ`;FQaG3`oq+60Sy zx&K`MQ43p|RQpjA6XaI^3w8T|NNbzzb6uz?(UUS)a>ym~VKe2y3*y@b8anJ%o@stV z*Y-0}Eev$!kYYo})5OlgmDBhjX`{rQqWQWAHqdq{758F9dU= zx-W4YRMY7i=@b-n1m}Px>#cCurQ-(Bxn?cL64o?T`qpU1rAz$0dbbMnMUy3I{*Xrh zw3@0G4kG6aP%Q+`D(94u5as7Q6G#MCt%w`p9BJpg7PPH?YiwE)mgII`d8YGNLUnLb zN9;GJi>G8IW3Mwla4^jC=348{)5_RBT%6M2+C9~ZYWU8{rLZxd5G)NmjjGll5S#wj z&c$Qz#Sh`!9HjT5TD=1y5qvuP*kIix1hTj`93cbOM2&Va+OZwvBG$2;@(iZrN&DnR zvOwBwALFZXT@#snRUwW-MY&fMN@|u*GJuU4p(<@vY&Bagla|VU2RVb9BG78`=&9DL zi~7WCI3cxuuVij{_tPyhDBvk!Am-slxFihsG7*X->$W`2NwSz1l{sUA zRMs>G8b>({=NE+eARx@;P!J=5FQ5bfXbN8@B(}(AVDmtrk@W`-W-pSFLR<$DFMf<< zZ$sSykZwqy2;V40f4b}o-LQLD zk6L&W(lr4N`28v~b%QO0x^Q#BoXDjhAoS{llLO?(K0mqcC|iN>ccqaKmfrx$`?-o& z)I>Y>=-HkU6Ep&U@dqpbPX1|Kr3DeprNL;NhV|*%QQ#!kJi7UrN1?!-xTgE6%dy8v zoQu0mS0G$O6OKJ-u%21*OMDHv{0xd1Rj8J!J;Bfey~ZnrLXcauSk^Mo7ZUXa2&_5u z{sKj-9-o_WnIbUo(A6rvJdsv@aczczH6Aeza}KRuTcFjj%xxAs(o`Dn*ijaW4nm@fRAhR2jD6h~kj^{`@$=g#Tf1oHhg zYZ$0XrtJhm`q#V)qqYK@YiKVaOtu%hiSGkIWtA|!r+b7`bJ}Za<|Vh~@+Ctytwk9p zpVj8a^7BIL5Y8Il{iyF3oFVo_QRx-_$L0rSXT-LDB-_22m4*#Wq?$VoUADu~@y-E? z;Uy=dQ{|K%i}$e8rIWLMY~$|Of+dr5ngc@uOfyaFhwmtvpK3#tFpoF!%Oa*LrT2+?V|Lgzb3phF#n+HwT? zMMC3*i~+;=c-%bc=j40TpVk9%&ll&)o)eBb3|f6N7qjuq$GBSbjM=%l?F4 zfoqexWYa1{M?U51LUS6zK^c`E$iz_zLUc1lre#79z1Q3g$=rDO?u z8U{VMTdj>p@*8F8-orE^%rQRtQz$^OC!ul|B`VVoFK%wQhZKpPEP)~U1_CW0>6rg8 zMeeb*-);JH{0W&gn#%T82a;JB^3Y%_X!pshY4b?we~5pL*M`VBg~&WcmPhcoy2)!6 z%#|ZJqtJ_Y@WE5a3t3ucU#zZ@`y3T*mpHS4zbt;=R1E6{9zJvtF(SOg8NEOSuov=RUaXQD4WP z#PbnV^wo0QZ0KgRLX{Xj9X{%QxQ)kV^<0B7Cac8as$wW3+$*P0>2h7Y$5xue#- zG0(BPHl@uPAdCteD^Qb5lOG24_W*uV|w4u?c{B|lKSlT>HY zQ=l{Htyz!D9=iLwPb=u=I5Rh@1s3MyW;H;`t|mnB+62XY#lwvOJ0Zm0CHY1>_nKa$ zlyrHG5vm^Q>0ElLno{O2X?oh1fJ?g4rfVrpw<9?Z@R&!fz^`wpKbO2$=Pp|1z+H%R z@QrGYD=X-$KIVx7ssv}$o~WwIZos2jj=+0e=A9|(gEjLE3k-N&LaiA2_0rv7uQk73 z!WWpZm!F|@0il)6*q`;Sq0a|d!0WhPolLc*UjExK~k)fpe6a&yN|hOwY@qb%tgD}(dLCFG&)sSery0)1+3Axy*= zPIW>}Am4Q>mchW5Tv+UsDlhL>!@89iO3e=F;ocU170G~euLF+x*e?Z2kAok@xS!a| zEMCR@uC79`R*p@HlR}JcPlioJcV4=7Fd3Pj2_*5FLzTIF^*5PEOu!K;QNFWnCBnYm z_>;-i+{+qZO@tbV0sM^*Hqq|Q_x*KPfWLNRTOBC)*n#h=Fm;gQd>PpHNk`%gpR1~K{>|&P{sUvV zN0aGGZ_5SGUKTz$rs5g6szsf1 zir!+~KxEg0^6D33lLreo2v#S=g>0uy!4sFO&Je7>VEF>HLiF@a%M7xfm0xkFzEs;( z^vPSh=CkNhU|l~hxWEmeHhQ^T#gU`O2Xj9stTW;~ znb`!;es{g9S*(hg?4FmENwyg|Gt66 zt1fF#4PC(}d^*D-z>Ik&ns43oD>wu`*j&o4C`|5+;k(>!2)*rLGj>%A9I5P9-u@4;)P+fOvG)=U#7!!JqbC~hmswo{k_d#h zi0`4NQk}l&9)>t&c`yxxL2_V3kA00qUK^Z~hLDZmR2uM7MGa`}mvZ1x zh9KrXMcW^yL4I(yqOrFa6dA8G5ot1TM9-sQqVXkqhGM1jH5W#i^^8V%w&t#!06`DI z`UgL;4O1%B#7FP!R*dYh7O5uN8>Qev0dlHpN`hhq*nL%+ym-Wp^}61joUZtn&DGe2 z6R|HjknvX@KmSSV$VbEA1?fzYG0&QF8PXM98)O<)?1HTP|DdKExRqyyPqnfp^zp|I zZQE49I_g{~fZ+ld= z0VclLPo(#+KWCGWek)gTNxze7l8j}Y*fx5=yGg7_TEZx(l#z!%SG)nq75}YBrQ}@a`l#{3dy&CC)tdbt9)o{ zM#@)3CQa$|&0|{n51S=A+Znyr>Egen;YsVDvYnpn{iQ}* z0=~^NnW}DH6~0Z08wmOkXX50lq#r^*%uL^yG#knpbj@m*rtgv_;`dv41>UH7FaLzM zEo>aZA{l;>8%>L)+!9}}#UcE$j7rI*b1&Av#ozq9yP@I3TXeeUZ4z3Bo6 zTj$9LjUd!6cT0DI%)@sFP|n*x=LjGN0C5uluyg=5Apmdy0RM0AeP(;+*>CvJqf+Ct z4MDrZekOciOfAE`y_>z;)AQcj+to3rcjYIO`^pD9chRl7)X_=rR;<#wvbPG;MUA5+ zAt6g!SpY*b05l^2W>5hA4Nu!zuWoD5O*Tz5(13(Qap9@HR<@whItlA_FSiK_*S2Ym z86mOK4%-wZ5Tx$fCd!V1wzg_yQiTvsR1rZ1r!q#Prua&URFn9DM}knMN%ornBLDz2 z1_mNT0M}C$#W27WMd!xY$IED&Y4;M6&I9H9#6nBe{F0VwyrPb-@>7N(S8$NVJ316bHlrdX>N^!_+y3%-TvCFxelPd_VN*!T`52q7hf zY;Yk|qvkI$3N4uS3*Gw>ld)2pLL*Sh1tiLE-{I}vXofE#c+8t$SQOth^0HB1#?n>8 z1LOV0UB&NLM3-YS4svpf;Ccd*0j$; zu^#DvQdjk5T?;bnzsMS_!v?aMj}SSLdurdhY&I^zMAGxRZzJjtuV!Zt}>A^ zGV@q^vPN8$iqR}?;RrXxY|?mr-=4{Y@Qtb7AuyNZxfp*ZZhs;0M!2P_e5l9|Q&gKO ze@P-RY(AkZK~Tk1k?agng101n`pVzZg+F8ulI2iS(1T&(8i@IjL2Qv6$8KCIU9u8- zEL=NorY56AO2bq z!BiGZ!pAcsej&hDlT>zOuZlNOqbi|RF$!oGWy9VwQmpf_>a*S}HpPcl`nry4r+U-t^1 zN+H~M2IOIy^qzzljfv>($y8`i&_dy#?F(j89Nb8D7C0cD*YUl6YM+pIDk|eLZ*id0 zzoO`yl)JJ4aYdRNIW7Jb{$b(i+~vZbnz^7;eVgwR8#6R15>u@X(sz$fmsC&&nWLtK zd%gI@Qz;zDq&b=9WT$$z;!P45ifD~Zr0V-e7*Ek5e56)`8_Kx+^RK^?dB9{GeU{_S zaz4>>G%?Z{bV%muTVD&1(lY*knunOFfqgHD?T}&!s&3th+{%3Rs}jXa`sc$UD8os! z3M&=~A)clBH6OauRJy4gXGgUqJCi!q=vl{Nvw-ie@G8Usvw#!Z!6L(JaNG}263NUM zCtx*(&AO2B7>h|s%-b%C&_Y^fu@Cj}mQFjIjo8aazccwKJRa9sBwLKB&Wyswvr_z;x(b-4<(cGUTr<@o-9x3q7$67a8vcYTg=oydHl z>2o%w4Hs09Ld!wL9`eC5ma8YV_00qC2Hd-26)N%5pGO)|Kv z3O-fM@s71u)iew0WU=QSH^|_}ZOf#__SfT)o~+1y?PMZs?$*|zKWZ_1u=Y2mrP`Gc6Jl#=*!c4v-W0&6Y~tZh1}*Y*|#7TN*4Qfx9Rqg z%sA$?*}cPG}c-h3~oSQhB>*u+VYb)j^VHGU)Wpuj^>9NK+ zIerD-RIP%oo>ndK+pQOz_$z8%QWw~o)w+`3=FZB$VK1@zp44OxvG`AA-S=r+vFo!= z>}v$|E!UIg?n{1iFz)@&d&t>jZpxe^kHa~Y&}upd6URE@{RQtE<>={W zSSDKNY2gWky6A_xrw3cj5Lv-XexGfS`*5vK=f_3z#9gVriu^q_AJP?}gIFi08MWAA=OHdaao6qLnzEI-A~?t)O%dlCEzFnop6svD!DT z7Hf9)ZhK>7ZGLFk<1nKk-Ike|LG(Ai&-b^cBRXhd7Sm}8bwVL%=yJOq*5YSlEr~ge z`@FI&b>b`5rFw%gZ(3jJOi*g%n^b+-J&+e&70U%5>QZL30*^rH8NHr}c8Kom64A`Y zSl5}XLGJ(|QtSeR)ChivY<5Jt7`^ge3pXax4%)N1T%E9lsvY~)(T2lUWR^TbOUaE9 zi*1Y(u3wTaW9lwfm}(b1(KEujyrgma@Y2vM8_*aZB7@_!izn?s%dNn7WFr zIj4zPk1UFo?tX*eKp&bx8>m4Uj)?mzp&l~FpzK#GQuM|?rxBxPAU`UfWh67|aH zG!2Dv z{4YmSrnyNNa0Uzk1HgbVUd3&qvW^2iI5=P?=sgil!JCS7r8m3T;tS?&h@4PFfJPiCOt z%y$9B1XbPDE@Hz0=3P5hWe za5P4o7P9yi1somTdxjta+8AC#Iow4o6s66M^5_O<0mqB&8BdK5Cb*n`6%r(T*YXLT zVvOH5U@`cHaKMUY4}e<+&~VrQTI0AhRlcCGf$tU!CNUZXF;cTcUb2>|8w=ze!VFx7E*Kf z7hpiZfIIa?O%?zFcs^$|o@M_0wD{3Ix`AB=LhU6Qt^ggG-AK3e(YZjes{^Cs6RWBG z-~mm0aEn?T1y~j00FZum3&VVM1K9=8=^zaE8UlBJy49!$hoa(;3$y3I>>6f%_5;WP zaArdB?=^vfhn#OHc$V5{D0u!}C-2P*0?f}was|MEqZl1;_8soIq9=?NzT|&qt@s0DpbRtE|s&VD?PHwN?DFYF7R}86_TFec<5i``d1!46D4@hqQDSJCmP$%}IetNF*^_-9KLu7p3D4y_6ExQ}})??<*nKBjU_ z_|{P0{I}hZDl#y%RIj12k*Vn7;Eo_y_@as{>Rs)2t68=4XxgrQ<|;^{ z?O>498*>mDu=iV@z>yHx3T$nTcXSO&1u&KS$&JQ4ZSu6%n12sVE+Z$VPkTSgAjlvUPb@0py({M>{-r_!w)v{`x(iDKw%GEgWL3N2C6-$j{BF{IKWPZB^#wBgjR{@k?M*?jURSwoU2i-K}8N z$nu&p|2@4r1GQr9)xqRSu)*YfYKf^Du#@5DaaC&2`f@DRLdpu-shNa`tew@~^3ZfZ zG1#O|-1O5(^trK1GnAURL1aZO#ID`#X@AU&Cn?CQ*tuXM!xgvQY)yBNN1;Mfz^(Ta z=;NpddV4NadePH{7BgCol{QS;VQjvs%dfE*K2DBy>SlSh-6O_Nu*H9f*`tEBqq`RS z2A{pdwHqN)eecuaSn7ycS+4V8h5ce4dFGKyaYsQsf= zH*m`kl@V`Q!|uzg4e5u;*^iFg%b+Ua;Kaq-Epd2znybAchvin&WSEs^L*H_;0E!C} z&7g|b$&Qg(7V*4;lqmMfsaO8SRX+J^usl&g-fgNuSr7sV9`Um7MioJ&IZ zvCK`$4utQ#@4)}+?@E{-kHT{x|MERLZF~b1wg$Lbrm^7R$bplmCZtoaT9foA|LV~V z+?Moi5L(box9MsCD2r&hpm%K_r9&q>Tn)^obDL}3VkYD~m*8X(7&X#Kexj}>c^o^% z34gz3>h`^ojKsNhxPV6`&1@6?=2dUhSV|v+{gad^tuYQ|S>!CV?1l=Ka)k88dSftB zWOcb-c6qZ?{gPB_|D)NZwd}$MbgW|n<}1)YQnKr%9LakL-_%EYOZbl^(3CRHXxY?M zTN(`sIV-_%LU`r6&CEKGY0x^}D(l~xFfaauURL#p6}Lwe+Q!n^QNKuA;$PlNSm_d8 z!?p80BdZF4`-vy~ZX#3vJ4jTJR{Q#|M-%=q-r>--Ir)GOS74P%?Y-JfSm*yj8j@~P zh4zGKrEgD%D=@udxta|6ZwAzMA4ZA7PO@$ho@w9cwN3b5&+(ogJk$Aq`A$jQRm%2P zdENKrDU^Nkl*+$%N+oB7|11*EzX?Zcl2sx}_f6w<;#Pl`7h=O?Z7Td*32ywR3E4+5 zHIlgu?PS8XlxwZb2rb`l?MMwm`f_CiF}0JMT2?0Nh7Ej;YA61}90{+L;M26VePOY&nkBKR;;dKmG+I05&Z*@S zPf1Ud>8de1)%(s>5;IcqtaHTT(WBJUO?FZBj`voCuat;wMt?@|au*u5HZaB?B&Ad< zEX?@R%d^j!5?d%vXj%z}6Nf83PbEIpGtx=b6Igv}NYaq)ouT6)!I_04OeEovT1BE$ zwSgWjzmX_~ZBS0IJC4}zfrLzIBs^1XYPo3RwdKCVQu2_A-A6C{mHtg9tabanchQDZ z86njl|CBSiq?xLasl`gg;=!x1)@pOH*lQ>5o(YgHKmM8-KAftqelN?`9}-6OQ-qS3 zrPgT=Qj|}cO<|Lxk3ikN&SQs{?PknsC&r9Cb-vCdUe8MsY$+{}HmNr!?AS(6RosE_ zzLq^Y6A8;2gN#Lzk5S`R^Rvvy4>GC$D%WiqL~)X(0ZgnyT2kDP>4 zs{-@OYF?WO%T<-|zqAs1kNRo^Q1#2zbQpF&6-&QI_fEjn&l07ondmABP7_)yhoXio zt^WT<7iRy9DqabwcQUl6888+SZ9XaD=eQUThJ9$<8Es)x59#DKM*Os93y8lyowZEd zmv;Bx%^c)Q{~_EwH&FnG$hOAi+={;nUAcD)SPduuYYWp_od-1hs>jIbR)B!8ci zpH4vAHKV%cpL(o$MdYViO3I>{L_6u)BRk|@5iTV}`{3O@&Y}Ax>@W(1*L#BbJMF^%NQ{>(o7g-akb-Vk<#zjOygIF@xXuQD-KiLLQR+Pr&k z+ij0$HrleMZix2yn=gV#);mPh|L)w;t~Zb(&u9zR=8xn#+9IxuRojWDMH5Xm+M+V) zXNgeSZxI1$GR>0+rUbT*_F6==EfI2Dm-l^<-clCt0xkl{8^7a%HosJ*_7xn@%*^Q-D|d^5C6zmvx;W+|73!)PH1)gm^q*( z5x~ue80~kF{k>dGTx#N&zutzrdHbZ4K*TzyYg^Yst`FUZtq4!}N8d*9i9{ZM zU7dW%EZ$ch&J(O{x&wi4+Iw;7?`DHi& diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib.sln b/common/dist/zlib/contrib/dotzlib/DotZLib.sln deleted file mode 100644 index ac45ca048..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib.sln +++ /dev/null @@ -1,21 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 8.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotZLib", "DotZLib\DotZLib.csproj", "{BB1EE0B1-1808-46CB-B786-949D91117FC5}" - ProjectSection(ProjectDependencies) = postProject - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - Debug = Debug - Release = Release - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.ActiveCfg = Debug|.NET - {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Debug.Build.0 = Debug|.NET - {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.ActiveCfg = Release|.NET - {BB1EE0B1-1808-46CB-B786-949D91117FC5}.Release.Build.0 = Release|.NET - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs deleted file mode 100644 index 6fc0fdcc2..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/AssemblyInfo.cs +++ /dev/null @@ -1,58 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -// -[assembly: AssemblyTitle("DotZLib")] -[assembly: AssemblyDescription(".Net bindings for ZLib compression dll 1.2.x")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Henrik Ravn")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("(c) 2004 by Henrik Ravn")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Revision and Build Numbers -// by using the '*' as shown below: - -[assembly: AssemblyVersion("1.0.*")] - -// -// In order to sign your assembly you must specify a key to use. Refer to the -// Microsoft .NET Framework documentation for more information on assembly signing. -// -// Use the attributes below to control which key is used for signing. -// -// Notes: -// (*) If no key is specified, the assembly is not signed. -// (*) KeyName refers to a key that has been installed in the Crypto Service -// Provider (CSP) on your machine. KeyFile refers to a file which contains -// a key. -// (*) If the KeyFile and the KeyName values are both specified, the -// following processing occurs: -// (1) If the KeyName can be found in the CSP, that key is used. -// (2) If the KeyName does not exist and the KeyFile does exist, the key -// in the KeyFile is installed into the CSP and used. -// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility. -// When specifying the KeyFile, the location of the KeyFile should be -// relative to the project output directory which is -// %Project Directory%\obj\. For example, if your KeyFile is -// located in the project directory, you would specify the AssemblyKeyFile -// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")] -// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework -// documentation for more information on this. -// -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] -[assembly: AssemblyKeyName("")] diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs deleted file mode 100644 index dfe7e90a8..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/ChecksumImpl.cs +++ /dev/null @@ -1,202 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Runtime.InteropServices; -using System.Text; - - -namespace DotZLib -{ - #region ChecksumGeneratorBase - /// - /// Implements the common functionality needed for all s - /// - /// - public abstract class ChecksumGeneratorBase : ChecksumGenerator - { - /// - /// The value of the current checksum - /// - protected uint _current; - - /// - /// Initializes a new instance of the checksum generator base - the current checksum is - /// set to zero - /// - public ChecksumGeneratorBase() - { - _current = 0; - } - - /// - /// Initializes a new instance of the checksum generator basewith a specified value - /// - /// The value to set the current checksum to - public ChecksumGeneratorBase(uint initialValue) - { - _current = initialValue; - } - - /// - /// Resets the current checksum to zero - /// - public void Reset() { _current = 0; } - - /// - /// Gets the current checksum value - /// - public uint Value { get { return _current; } } - - /// - /// Updates the current checksum with part of an array of bytes - /// - /// The data to update the checksum with - /// Where in data to start updating - /// The number of bytes from data to use - /// The sum of offset and count is larger than the length of data - /// data is a null reference - /// Offset or count is negative. - /// All the other Update methods are implmeneted in terms of this one. - /// This is therefore the only method a derived class has to implement - public abstract void Update(byte[] data, int offset, int count); - - /// - /// Updates the current checksum with an array of bytes. - /// - /// The data to update the checksum with - public void Update(byte[] data) - { - Update(data, 0, data.Length); - } - - /// - /// Updates the current checksum with the data from a string - /// - /// The string to update the checksum with - /// The characters in the string are converted by the UTF-8 encoding - public void Update(string data) - { - Update(Encoding.UTF8.GetBytes(data)); - } - - /// - /// Updates the current checksum with the data from a string, using a specific encoding - /// - /// The string to update the checksum with - /// The encoding to use - public void Update(string data, Encoding encoding) - { - Update(encoding.GetBytes(data)); - } - - } - #endregion - - #region CRC32 - /// - /// Implements a CRC32 checksum generator - /// - public sealed class CRC32Checksum : ChecksumGeneratorBase - { - #region DLL imports - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern uint crc32(uint crc, int data, uint length); - - #endregion - - /// - /// Initializes a new instance of the CRC32 checksum generator - /// - public CRC32Checksum() : base() {} - - /// - /// Initializes a new instance of the CRC32 checksum generator with a specified value - /// - /// The value to set the current checksum to - public CRC32Checksum(uint initialValue) : base(initialValue) {} - - /// - /// Updates the current checksum with part of an array of bytes - /// - /// The data to update the checksum with - /// Where in data to start updating - /// The number of bytes from data to use - /// The sum of offset and count is larger than the length of data - /// data is a null reference - /// Offset or count is negative. - public override void Update(byte[] data, int offset, int count) - { - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > data.Length) throw new ArgumentException(); - GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned); - try - { - _current = crc32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count); - } - finally - { - hData.Free(); - } - } - - } - #endregion - - #region Adler - /// - /// Implements a checksum generator that computes the Adler checksum on data - /// - public sealed class AdlerChecksum : ChecksumGeneratorBase - { - #region DLL imports - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern uint adler32(uint adler, int data, uint length); - - #endregion - - /// - /// Initializes a new instance of the Adler checksum generator - /// - public AdlerChecksum() : base() {} - - /// - /// Initializes a new instance of the Adler checksum generator with a specified value - /// - /// The value to set the current checksum to - public AdlerChecksum(uint initialValue) : base(initialValue) {} - - /// - /// Updates the current checksum with part of an array of bytes - /// - /// The data to update the checksum with - /// Where in data to start updating - /// The number of bytes from data to use - /// The sum of offset and count is larger than the length of data - /// data is a null reference - /// Offset or count is negative. - public override void Update(byte[] data, int offset, int count) - { - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > data.Length) throw new ArgumentException(); - GCHandle hData = GCHandle.Alloc(data, GCHandleType.Pinned); - try - { - _current = adler32(_current, hData.AddrOfPinnedObject().ToInt32()+offset, (uint)count); - } - finally - { - hData.Free(); - } - } - - } - #endregion - -} \ No newline at end of file diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs deleted file mode 100644 index 16997e906..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/CircularBuffer.cs +++ /dev/null @@ -1,83 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Diagnostics; - -namespace DotZLib -{ - - /// - /// This class implements a circular buffer - /// - internal class CircularBuffer - { - #region Private data - private int _capacity; - private int _head; - private int _tail; - private int _size; - private byte[] _buffer; - #endregion - - public CircularBuffer(int capacity) - { - Debug.Assert( capacity > 0 ); - _buffer = new byte[capacity]; - _capacity = capacity; - _head = 0; - _tail = 0; - _size = 0; - } - - public int Size { get { return _size; } } - - public int Put(byte[] source, int offset, int count) - { - Debug.Assert( count > 0 ); - int trueCount = Math.Min(count, _capacity - Size); - for (int i = 0; i < trueCount; ++i) - _buffer[(_tail+i) % _capacity] = source[offset+i]; - _tail += trueCount; - _tail %= _capacity; - _size += trueCount; - return trueCount; - } - - public bool Put(byte b) - { - if (Size == _capacity) // no room - return false; - _buffer[_tail++] = b; - _tail %= _capacity; - ++_size; - return true; - } - - public int Get(byte[] destination, int offset, int count) - { - int trueCount = Math.Min(count,Size); - for (int i = 0; i < trueCount; ++i) - destination[offset + i] = _buffer[(_head+i) % _capacity]; - _head += trueCount; - _head %= _capacity; - _size -= trueCount; - return trueCount; - } - - public int Get() - { - if (Size == 0) - return -1; - - int result = (int)_buffer[_head++ % _capacity]; - --_size; - return result; - } - - } -} diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/CodecBase.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/CodecBase.cs deleted file mode 100644 index 954db7db0..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/CodecBase.cs +++ /dev/null @@ -1,198 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Runtime.InteropServices; - -namespace DotZLib -{ - /// - /// Implements the common functionality needed for all s - /// - public abstract class CodecBase : Codec, IDisposable - { - - #region Data members - - /// - /// Instance of the internal zlib buffer structure that is - /// passed to all functions in the zlib dll - /// - internal ZStream _ztream = new ZStream(); - - /// - /// True if the object instance has been disposed, false otherwise - /// - protected bool _isDisposed = false; - - /// - /// The size of the internal buffers - /// - protected const int kBufferSize = 16384; - - private byte[] _outBuffer = new byte[kBufferSize]; - private byte[] _inBuffer = new byte[kBufferSize]; - - private GCHandle _hInput; - private GCHandle _hOutput; - - private uint _checksum = 0; - - #endregion - - /// - /// Initializes a new instance of the CodeBase class. - /// - public CodecBase() - { - try - { - _hInput = GCHandle.Alloc(_inBuffer, GCHandleType.Pinned); - _hOutput = GCHandle.Alloc(_outBuffer, GCHandleType.Pinned); - } - catch (Exception) - { - CleanUp(false); - throw; - } - } - - - #region Codec Members - - /// - /// Occurs when more processed data are available. - /// - public event DataAvailableHandler DataAvailable; - - /// - /// Fires the event - /// - protected void OnDataAvailable() - { - if (_ztream.total_out > 0) - { - if (DataAvailable != null) - DataAvailable( _outBuffer, 0, (int)_ztream.total_out); - resetOutput(); - } - } - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// Adding data may, or may not, raise the DataAvailable event - public void Add(byte[] data) - { - Add(data,0,data.Length); - } - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// The index of the first byte to add from data - /// The number of bytes to add - /// Adding data may, or may not, raise the DataAvailable event - /// This must be implemented by a derived class - public abstract void Add(byte[] data, int offset, int count); - - /// - /// Finishes up any pending data that needs to be processed and handled. - /// - /// This must be implemented by a derived class - public abstract void Finish(); - - /// - /// Gets the checksum of the data that has been added so far - /// - public uint Checksum { get { return _checksum; } } - - #endregion - - #region Destructor & IDisposable stuff - - /// - /// Destroys this instance - /// - ~CodecBase() - { - CleanUp(false); - } - - /// - /// Releases any unmanaged resources and calls the method of the derived class - /// - public void Dispose() - { - CleanUp(true); - } - - /// - /// Performs any codec specific cleanup - /// - /// This must be implemented by a derived class - protected abstract void CleanUp(); - - // performs the release of the handles and calls the dereived CleanUp() - private void CleanUp(bool isDisposing) - { - if (!_isDisposed) - { - CleanUp(); - if (_hInput.IsAllocated) - _hInput.Free(); - if (_hOutput.IsAllocated) - _hOutput.Free(); - - _isDisposed = true; - } - } - - - #endregion - - #region Helper methods - - /// - /// Copies a number of bytes to the internal codec buffer - ready for proccesing - /// - /// The byte array that contains the data to copy - /// The index of the first byte to copy - /// The number of bytes to copy from data - protected void copyInput(byte[] data, int startIndex, int count) - { - Array.Copy(data, startIndex, _inBuffer,0, count); - _ztream.next_in = _hInput.AddrOfPinnedObject(); - _ztream.total_in = 0; - _ztream.avail_in = (uint)count; - - } - - /// - /// Resets the internal output buffers to a known state - ready for processing - /// - protected void resetOutput() - { - _ztream.total_out = 0; - _ztream.avail_out = kBufferSize; - _ztream.next_out = _hOutput.AddrOfPinnedObject(); - } - - /// - /// Updates the running checksum property - /// - /// The new checksum value - protected void setChecksum(uint newSum) - { - _checksum = newSum; - } - #endregion - - } -} diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/Deflater.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/Deflater.cs deleted file mode 100644 index d7b8dccca..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/Deflater.cs +++ /dev/null @@ -1,106 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace DotZLib -{ - - /// - /// Implements a data compressor, using the deflate algorithm in the ZLib dll - /// - public sealed class Deflater : CodecBase - { - #region Dll imports - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)] - private static extern int deflateInit_(ref ZStream sz, int level, string vs, int size); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int deflate(ref ZStream sz, int flush); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int deflateReset(ref ZStream sz); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int deflateEnd(ref ZStream sz); - #endregion - - /// - /// Constructs an new instance of the Deflater - /// - /// The compression level to use for this Deflater - public Deflater(CompressLevel level) : base() - { - int retval = deflateInit_(ref _ztream, (int)level, Info.Version, Marshal.SizeOf(_ztream)); - if (retval != 0) - throw new ZLibException(retval, "Could not initialize deflater"); - - resetOutput(); - } - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// The index of the first byte to add from data - /// The number of bytes to add - /// Adding data may, or may not, raise the DataAvailable event - public override void Add(byte[] data, int offset, int count) - { - if (data == null) throw new ArgumentNullException(); - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > data.Length) throw new ArgumentException(); - - int total = count; - int inputIndex = offset; - int err = 0; - - while (err >= 0 && inputIndex < total) - { - copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize)); - while (err >= 0 && _ztream.avail_in > 0) - { - err = deflate(ref _ztream, (int)FlushTypes.None); - if (err == 0) - while (_ztream.avail_out == 0) - { - OnDataAvailable(); - err = deflate(ref _ztream, (int)FlushTypes.None); - } - inputIndex += (int)_ztream.total_in; - } - } - setChecksum( _ztream.adler ); - } - - - /// - /// Finishes up any pending data that needs to be processed and handled. - /// - public override void Finish() - { - int err; - do - { - err = deflate(ref _ztream, (int)FlushTypes.Finish); - OnDataAvailable(); - } - while (err == 0); - setChecksum( _ztream.adler ); - deflateReset(ref _ztream); - resetOutput(); - } - - /// - /// Closes the internal zlib deflate stream - /// - protected override void CleanUp() { deflateEnd(ref _ztream); } - - } -} diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/DotZLib.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/DotZLib.cs deleted file mode 100644 index 410deb088..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/DotZLib.cs +++ /dev/null @@ -1,288 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.IO; -using System.Runtime.InteropServices; -using System.Text; - - -namespace DotZLib -{ - - #region Internal types - - /// - /// Defines constants for the various flush types used with zlib - /// - internal enum FlushTypes - { - None, Partial, Sync, Full, Finish, Block - } - - #region ZStream structure - // internal mapping of the zlib zstream structure for marshalling - [StructLayoutAttribute(LayoutKind.Sequential, Pack=4, Size=0, CharSet=CharSet.Ansi)] - internal struct ZStream - { - public IntPtr next_in; - public uint avail_in; - public uint total_in; - - public IntPtr next_out; - public uint avail_out; - public uint total_out; - - [MarshalAs(UnmanagedType.LPStr)] - string msg; - uint state; - - uint zalloc; - uint zfree; - uint opaque; - - int data_type; - public uint adler; - uint reserved; - } - - #endregion - - #endregion - - #region Public enums - /// - /// Defines constants for the available compression levels in zlib - /// - public enum CompressLevel : int - { - /// - /// The default compression level with a reasonable compromise between compression and speed - /// - Default = -1, - /// - /// No compression at all. The data are passed straight through. - /// - None = 0, - /// - /// The maximum compression rate available. - /// - Best = 9, - /// - /// The fastest available compression level. - /// - Fastest = 1 - } - #endregion - - #region Exception classes - /// - /// The exception that is thrown when an error occurs on the zlib dll - /// - public class ZLibException : ApplicationException - { - /// - /// Initializes a new instance of the class with a specified - /// error message and error code - /// - /// The zlib error code that caused the exception - /// A message that (hopefully) describes the error - public ZLibException(int errorCode, string msg) : base(String.Format("ZLib error {0} {1}", errorCode, msg)) - { - } - - /// - /// Initializes a new instance of the class with a specified - /// error code - /// - /// The zlib error code that caused the exception - public ZLibException(int errorCode) : base(String.Format("ZLib error {0}", errorCode)) - { - } - } - #endregion - - #region Interfaces - - /// - /// Declares methods and properties that enables a running checksum to be calculated - /// - public interface ChecksumGenerator - { - /// - /// Gets the current value of the checksum - /// - uint Value { get; } - - /// - /// Clears the current checksum to 0 - /// - void Reset(); - - /// - /// Updates the current checksum with an array of bytes - /// - /// The data to update the checksum with - void Update(byte[] data); - - /// - /// Updates the current checksum with part of an array of bytes - /// - /// The data to update the checksum with - /// Where in data to start updating - /// The number of bytes from data to use - /// The sum of offset and count is larger than the length of data - /// data is a null reference - /// Offset or count is negative. - void Update(byte[] data, int offset, int count); - - /// - /// Updates the current checksum with the data from a string - /// - /// The string to update the checksum with - /// The characters in the string are converted by the UTF-8 encoding - void Update(string data); - - /// - /// Updates the current checksum with the data from a string, using a specific encoding - /// - /// The string to update the checksum with - /// The encoding to use - void Update(string data, Encoding encoding); - } - - - /// - /// Represents the method that will be called from a codec when new data - /// are available. - /// - /// The byte array containing the processed data - /// The index of the first processed byte in data - /// The number of processed bytes available - /// On return from this method, the data may be overwritten, so grab it while you can. - /// You cannot assume that startIndex will be zero. - /// - public delegate void DataAvailableHandler(byte[] data, int startIndex, int count); - - /// - /// Declares methods and events for implementing compressors/decompressors - /// - public interface Codec - { - /// - /// Occurs when more processed data are available. - /// - event DataAvailableHandler DataAvailable; - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// Adding data may, or may not, raise the DataAvailable event - void Add(byte[] data); - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// The index of the first byte to add from data - /// The number of bytes to add - /// Adding data may, or may not, raise the DataAvailable event - void Add(byte[] data, int offset, int count); - - /// - /// Finishes up any pending data that needs to be processed and handled. - /// - void Finish(); - - /// - /// Gets the checksum of the data that has been added so far - /// - uint Checksum { get; } - - - } - - #endregion - - #region Classes - /// - /// Encapsulates general information about the ZLib library - /// - public class Info - { - #region DLL imports - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern uint zlibCompileFlags(); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern string zlibVersion(); - #endregion - - #region Private stuff - private uint _flags; - - // helper function that unpacks a bitsize mask - private static int bitSize(uint bits) - { - switch (bits) - { - case 0: return 16; - case 1: return 32; - case 2: return 64; - } - return -1; - } - #endregion - - /// - /// Constructs an instance of the Info class. - /// - public Info() - { - _flags = zlibCompileFlags(); - } - - /// - /// True if the library is compiled with debug info - /// - public bool HasDebugInfo { get { return 0 != (_flags & 0x100); } } - - /// - /// True if the library is compiled with assembly optimizations - /// - public bool UsesAssemblyCode { get { return 0 != (_flags & 0x200); } } - - /// - /// Gets the size of the unsigned int that was compiled into Zlib - /// - public int SizeOfUInt { get { return bitSize(_flags & 3); } } - - /// - /// Gets the size of the unsigned long that was compiled into Zlib - /// - public int SizeOfULong { get { return bitSize((_flags >> 2) & 3); } } - - /// - /// Gets the size of the pointers that were compiled into Zlib - /// - public int SizeOfPointer { get { return bitSize((_flags >> 4) & 3); } } - - /// - /// Gets the size of the z_off_t type that was compiled into Zlib - /// - public int SizeOfOffset { get { return bitSize((_flags >> 6) & 3); } } - - /// - /// Gets the version of ZLib as a string, e.g. "1.2.1" - /// - public static string Version { get { return zlibVersion(); } } - } - - #endregion - -} diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj b/common/dist/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj deleted file mode 100644 index 71eeb8590..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/DotZLib.csproj +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/GZipStream.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/GZipStream.cs deleted file mode 100644 index f861675b5..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/GZipStream.cs +++ /dev/null @@ -1,301 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.IO; -using System.Runtime.InteropServices; - -namespace DotZLib -{ - /// - /// Implements a compressed , in GZip (.gz) format. - /// - public class GZipStream : Stream, IDisposable - { - #region Dll Imports - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)] - private static extern IntPtr gzopen(string name, string mode); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzclose(IntPtr gzFile); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzwrite(IntPtr gzFile, int data, int length); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzread(IntPtr gzFile, int data, int length); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzgetc(IntPtr gzFile); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int gzputc(IntPtr gzFile, int c); - - #endregion - - #region Private data - private IntPtr _gzFile; - private bool _isDisposed = false; - private bool _isWriting; - #endregion - - #region Constructors - /// - /// Creates a new file as a writeable GZipStream - /// - /// The name of the compressed file to create - /// The compression level to use when adding data - /// If an error occurred in the internal zlib function - public GZipStream(string fileName, CompressLevel level) - { - _isWriting = true; - _gzFile = gzopen(fileName, String.Format("wb{0}", (int)level)); - if (_gzFile == IntPtr.Zero) - throw new ZLibException(-1, "Could not open " + fileName); - } - - /// - /// Opens an existing file as a readable GZipStream - /// - /// The name of the file to open - /// If an error occurred in the internal zlib function - public GZipStream(string fileName) - { - _isWriting = false; - _gzFile = gzopen(fileName, "rb"); - if (_gzFile == IntPtr.Zero) - throw new ZLibException(-1, "Could not open " + fileName); - - } - #endregion - - #region Access properties - /// - /// Returns true of this stream can be read from, false otherwise - /// - public override bool CanRead - { - get - { - return !_isWriting; - } - } - - - /// - /// Returns false. - /// - public override bool CanSeek - { - get - { - return false; - } - } - - /// - /// Returns true if this tsream is writeable, false otherwise - /// - public override bool CanWrite - { - get - { - return _isWriting; - } - } - #endregion - - #region Destructor & IDispose stuff - - /// - /// Destroys this instance - /// - ~GZipStream() - { - cleanUp(false); - } - - /// - /// Closes the external file handle - /// - public void Dispose() - { - cleanUp(true); - } - - // Does the actual closing of the file handle. - private void cleanUp(bool isDisposing) - { - if (!_isDisposed) - { - gzclose(_gzFile); - _isDisposed = true; - } - } - #endregion - - #region Basic reading and writing - /// - /// Attempts to read a number of bytes from the stream. - /// - /// The destination data buffer - /// The index of the first destination byte in buffer - /// The number of bytes requested - /// The number of bytes read - /// If buffer is null - /// If count or offset are negative - /// If offset + count is > buffer.Length - /// If this stream is not readable. - /// If this stream has been disposed. - public override int Read(byte[] buffer, int offset, int count) - { - if (!CanRead) throw new NotSupportedException(); - if (buffer == null) throw new ArgumentNullException(); - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > buffer.Length) throw new ArgumentException(); - if (_isDisposed) throw new ObjectDisposedException("GZipStream"); - - GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned); - int result; - try - { - result = gzread(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count); - if (result < 0) - throw new IOException(); - } - finally - { - h.Free(); - } - return result; - } - - /// - /// Attempts to read a single byte from the stream. - /// - /// The byte that was read, or -1 in case of error or End-Of-File - public override int ReadByte() - { - if (!CanRead) throw new NotSupportedException(); - if (_isDisposed) throw new ObjectDisposedException("GZipStream"); - return gzgetc(_gzFile); - } - - /// - /// Writes a number of bytes to the stream - /// - /// - /// - /// - /// If buffer is null - /// If count or offset are negative - /// If offset + count is > buffer.Length - /// If this stream is not writeable. - /// If this stream has been disposed. - public override void Write(byte[] buffer, int offset, int count) - { - if (!CanWrite) throw new NotSupportedException(); - if (buffer == null) throw new ArgumentNullException(); - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > buffer.Length) throw new ArgumentException(); - if (_isDisposed) throw new ObjectDisposedException("GZipStream"); - - GCHandle h = GCHandle.Alloc(buffer, GCHandleType.Pinned); - try - { - int result = gzwrite(_gzFile, h.AddrOfPinnedObject().ToInt32() + offset, count); - if (result < 0) - throw new IOException(); - } - finally - { - h.Free(); - } - } - - /// - /// Writes a single byte to the stream - /// - /// The byte to add to the stream. - /// If this stream is not writeable. - /// If this stream has been disposed. - public override void WriteByte(byte value) - { - if (!CanWrite) throw new NotSupportedException(); - if (_isDisposed) throw new ObjectDisposedException("GZipStream"); - - int result = gzputc(_gzFile, (int)value); - if (result < 0) - throw new IOException(); - } - #endregion - - #region Position & length stuff - /// - /// Not supported. - /// - /// - /// Always thrown - public override void SetLength(long value) - { - throw new NotSupportedException(); - } - - /// - /// Not suppported. - /// - /// - /// - /// - /// Always thrown - public override long Seek(long offset, SeekOrigin origin) - { - throw new NotSupportedException(); - } - - /// - /// Flushes the GZipStream. - /// - /// In this implementation, this method does nothing. This is because excessive - /// flushing may degrade the achievable compression rates. - public override void Flush() - { - // left empty on purpose - } - - /// - /// Gets/sets the current position in the GZipStream. Not suppported. - /// - /// In this implementation this property is not supported - /// Always thrown - public override long Position - { - get - { - throw new NotSupportedException(); - } - set - { - throw new NotSupportedException(); - } - } - - /// - /// Gets the size of the stream. Not suppported. - /// - /// In this implementation this property is not supported - /// Always thrown - public override long Length - { - get - { - throw new NotSupportedException(); - } - } - #endregion - } -} diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/Inflater.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/Inflater.cs deleted file mode 100644 index 4e60cda07..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/Inflater.cs +++ /dev/null @@ -1,105 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; - -namespace DotZLib -{ - - /// - /// Implements a data decompressor, using the inflate algorithm in the ZLib dll - /// - public class Inflater : CodecBase - { - #region Dll imports - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl, CharSet=CharSet.Ansi)] - private static extern int inflateInit_(ref ZStream sz, string vs, int size); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int inflate(ref ZStream sz, int flush); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int inflateReset(ref ZStream sz); - - [DllImport("ZLIB1.dll", CallingConvention=CallingConvention.Cdecl)] - private static extern int inflateEnd(ref ZStream sz); - #endregion - - /// - /// Constructs an new instance of the Inflater - /// - public Inflater() : base() - { - int retval = inflateInit_(ref _ztream, Info.Version, Marshal.SizeOf(_ztream)); - if (retval != 0) - throw new ZLibException(retval, "Could not initialize inflater"); - - resetOutput(); - } - - - /// - /// Adds more data to the codec to be processed. - /// - /// Byte array containing the data to be added to the codec - /// The index of the first byte to add from data - /// The number of bytes to add - /// Adding data may, or may not, raise the DataAvailable event - public override void Add(byte[] data, int offset, int count) - { - if (data == null) throw new ArgumentNullException(); - if (offset < 0 || count < 0) throw new ArgumentOutOfRangeException(); - if ((offset+count) > data.Length) throw new ArgumentException(); - - int total = count; - int inputIndex = offset; - int err = 0; - - while (err >= 0 && inputIndex < total) - { - copyInput(data, inputIndex, Math.Min(total - inputIndex, kBufferSize)); - err = inflate(ref _ztream, (int)FlushTypes.None); - if (err == 0) - while (_ztream.avail_out == 0) - { - OnDataAvailable(); - err = inflate(ref _ztream, (int)FlushTypes.None); - } - - inputIndex += (int)_ztream.total_in; - } - setChecksum( _ztream.adler ); - } - - - /// - /// Finishes up any pending data that needs to be processed and handled. - /// - public override void Finish() - { - int err; - do - { - err = inflate(ref _ztream, (int)FlushTypes.Finish); - OnDataAvailable(); - } - while (err == 0); - setChecksum( _ztream.adler ); - inflateReset(ref _ztream); - resetOutput(); - } - - /// - /// Closes the internal zlib inflate stream - /// - protected override void CleanUp() { inflateEnd(ref _ztream); } - - - } -} diff --git a/common/dist/zlib/contrib/dotzlib/DotZLib/UnitTests.cs b/common/dist/zlib/contrib/dotzlib/DotZLib/UnitTests.cs deleted file mode 100644 index 8dc00db92..000000000 --- a/common/dist/zlib/contrib/dotzlib/DotZLib/UnitTests.cs +++ /dev/null @@ -1,274 +0,0 @@ -// -// © Copyright Henrik Ravn 2004 -// -// Use, modification and distribution are subject to the Boost Software License, Version 1.0. -// (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -// - -using System; -using System.Collections; -using System.IO; - -// uncomment the define below to include unit tests -//#define nunit -#if nunit -using NUnit.Framework; - -// Unit tests for the DotZLib class library -// ---------------------------------------- -// -// Use this with NUnit 2 from http://www.nunit.org -// - -namespace DotZLibTests -{ - using DotZLib; - - // helper methods - internal class Utils - { - public static bool byteArrEqual( byte[] lhs, byte[] rhs ) - { - if (lhs.Length != rhs.Length) - return false; - for (int i = lhs.Length-1; i >= 0; --i) - if (lhs[i] != rhs[i]) - return false; - return true; - } - - } - - - [TestFixture] - public class CircBufferTests - { - #region Circular buffer tests - [Test] - public void SinglePutGet() - { - CircularBuffer buf = new CircularBuffer(10); - Assert.AreEqual( 0, buf.Size ); - Assert.AreEqual( -1, buf.Get() ); - - Assert.IsTrue(buf.Put( 1 )); - Assert.AreEqual( 1, buf.Size ); - Assert.AreEqual( 1, buf.Get() ); - Assert.AreEqual( 0, buf.Size ); - Assert.AreEqual( -1, buf.Get() ); - } - - [Test] - public void BlockPutGet() - { - CircularBuffer buf = new CircularBuffer(10); - byte[] arr = {1,2,3,4,5,6,7,8,9,10}; - Assert.AreEqual( 10, buf.Put(arr,0,10) ); - Assert.AreEqual( 10, buf.Size ); - Assert.IsFalse( buf.Put(11) ); - Assert.AreEqual( 1, buf.Get() ); - Assert.IsTrue( buf.Put(11) ); - - byte[] arr2 = (byte[])arr.Clone(); - Assert.AreEqual( 9, buf.Get(arr2,1,9) ); - Assert.IsTrue( Utils.byteArrEqual(arr,arr2) ); - } - - #endregion - } - - [TestFixture] - public class ChecksumTests - { - #region CRC32 Tests - [Test] - public void CRC32_Null() - { - CRC32Checksum crc32 = new CRC32Checksum(); - Assert.AreEqual( 0, crc32.Value ); - - crc32 = new CRC32Checksum(1); - Assert.AreEqual( 1, crc32.Value ); - - crc32 = new CRC32Checksum(556); - Assert.AreEqual( 556, crc32.Value ); - } - - [Test] - public void CRC32_Data() - { - CRC32Checksum crc32 = new CRC32Checksum(); - byte[] data = { 1,2,3,4,5,6,7 }; - crc32.Update(data); - Assert.AreEqual( 0x70e46888, crc32.Value ); - - crc32 = new CRC32Checksum(); - crc32.Update("penguin"); - Assert.AreEqual( 0x0e5c1a120, crc32.Value ); - - crc32 = new CRC32Checksum(1); - crc32.Update("penguin"); - Assert.AreEqual(0x43b6aa94, crc32.Value); - - } - #endregion - - #region Adler tests - - [Test] - public void Adler_Null() - { - AdlerChecksum adler = new AdlerChecksum(); - Assert.AreEqual(0, adler.Value); - - adler = new AdlerChecksum(1); - Assert.AreEqual( 1, adler.Value ); - - adler = new AdlerChecksum(556); - Assert.AreEqual( 556, adler.Value ); - } - - [Test] - public void Adler_Data() - { - AdlerChecksum adler = new AdlerChecksum(1); - byte[] data = { 1,2,3,4,5,6,7 }; - adler.Update(data); - Assert.AreEqual( 0x5b001d, adler.Value ); - - adler = new AdlerChecksum(); - adler.Update("penguin"); - Assert.AreEqual(0x0bcf02f6, adler.Value ); - - adler = new AdlerChecksum(1); - adler.Update("penguin"); - Assert.AreEqual(0x0bd602f7, adler.Value); - - } - #endregion - } - - [TestFixture] - public class InfoTests - { - #region Info tests - [Test] - public void Info_Version() - { - Info info = new Info(); - Assert.AreEqual("1.2.3", Info.Version); - Assert.AreEqual(32, info.SizeOfUInt); - Assert.AreEqual(32, info.SizeOfULong); - Assert.AreEqual(32, info.SizeOfPointer); - Assert.AreEqual(32, info.SizeOfOffset); - } - #endregion - } - - [TestFixture] - public class DeflateInflateTests - { - #region Deflate tests - [Test] - public void Deflate_Init() - { - using (Deflater def = new Deflater(CompressLevel.Default)) - { - } - } - - private ArrayList compressedData = new ArrayList(); - private uint adler1; - - private ArrayList uncompressedData = new ArrayList(); - private uint adler2; - - public void CDataAvail(byte[] data, int startIndex, int count) - { - for (int i = 0; i < count; ++i) - compressedData.Add(data[i+startIndex]); - } - - [Test] - public void Deflate_Compress() - { - compressedData.Clear(); - - byte[] testData = new byte[35000]; - for (int i = 0; i < testData.Length; ++i) - testData[i] = 5; - - using (Deflater def = new Deflater((CompressLevel)5)) - { - def.DataAvailable += new DataAvailableHandler(CDataAvail); - def.Add(testData); - def.Finish(); - adler1 = def.Checksum; - } - } - #endregion - - #region Inflate tests - [Test] - public void Inflate_Init() - { - using (Inflater inf = new Inflater()) - { - } - } - - private void DDataAvail(byte[] data, int startIndex, int count) - { - for (int i = 0; i < count; ++i) - uncompressedData.Add(data[i+startIndex]); - } - - [Test] - public void Inflate_Expand() - { - uncompressedData.Clear(); - - using (Inflater inf = new Inflater()) - { - inf.DataAvailable += new DataAvailableHandler(DDataAvail); - inf.Add((byte[])compressedData.ToArray(typeof(byte))); - inf.Finish(); - adler2 = inf.Checksum; - } - Assert.AreEqual( adler1, adler2 ); - } - #endregion - } - - [TestFixture] - public class GZipStreamTests - { - #region GZipStream test - [Test] - public void GZipStream_WriteRead() - { - using (GZipStream gzOut = new GZipStream("gzstream.gz", CompressLevel.Best)) - { - BinaryWriter writer = new BinaryWriter(gzOut); - writer.Write("hi there"); - writer.Write(Math.PI); - writer.Write(42); - } - - using (GZipStream gzIn = new GZipStream("gzstream.gz")) - { - BinaryReader reader = new BinaryReader(gzIn); - string s = reader.ReadString(); - Assert.AreEqual("hi there",s); - double d = reader.ReadDouble(); - Assert.AreEqual(Math.PI, d); - int i = reader.ReadInt32(); - Assert.AreEqual(42,i); - } - - } - #endregion - } -} - -#endif \ No newline at end of file diff --git a/common/dist/zlib/contrib/dotzlib/LICENSE_1_0.txt b/common/dist/zlib/contrib/dotzlib/LICENSE_1_0.txt deleted file mode 100644 index 30aac2cf4..000000000 --- a/common/dist/zlib/contrib/dotzlib/LICENSE_1_0.txt +++ /dev/null @@ -1,23 +0,0 @@ -Boost Software License - Version 1.0 - August 17th, 2003 - -Permission is hereby granted, free of charge, to any person or organization -obtaining a copy of the software and accompanying documentation covered by -this license (the "Software") to use, reproduce, display, distribute, -execute, and transmit the Software, and to prepare derivative works of the -Software, and to permit third-parties to whom the Software is furnished to -do so, all subject to the following: - -The copyright notices in the Software and this entire statement, including -the above license grant, this restriction and the following disclaimer, -must be included in all copies of the Software, in whole or in part, and -all derivative works of the Software, unless such copies or derivative -works are solely in the form of machine-executable object code generated by -a source language processor. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT -SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE -FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/common/dist/zlib/contrib/dotzlib/readme.txt b/common/dist/zlib/contrib/dotzlib/readme.txt deleted file mode 100644 index 210f4b001..000000000 --- a/common/dist/zlib/contrib/dotzlib/readme.txt +++ /dev/null @@ -1,58 +0,0 @@ -This directory contains a .Net wrapper class library for the ZLib1.dll - -The wrapper includes support for inflating/deflating memory buffers, -.Net streaming wrappers for the gz streams part of zlib, and wrappers -for the checksum parts of zlib. See DotZLib/UnitTests.cs for examples. - -Directory structure: --------------------- - -LICENSE_1_0.txt - License file. -readme.txt - This file. -DotZLib.chm - Class library documentation -DotZLib.build - NAnt build file -DotZLib.sln - Microsoft Visual Studio 2003 solution file - -DotZLib\*.cs - Source files for the class library - -Unit tests: ------------ -The file DotZLib/UnitTests.cs contains unit tests for use with NUnit 2.1 or higher. -To include unit tests in the build, define nunit before building. - - -Build instructions: -------------------- - -1. Using Visual Studio.Net 2003: - Open DotZLib.sln in VS.Net and build from there. Output file (DotZLib.dll) - will be found ./DotZLib/bin/release or ./DotZLib/bin/debug, depending on - you are building the release or debug version of the library. Check - DotZLib/UnitTests.cs for instructions on how to include unit tests in the - build. - -2. Using NAnt: - Open a command prompt with access to the build environment and run nant - in the same directory as the DotZLib.build file. - You can define 2 properties on the nant command-line to control the build: - debug={true|false} to toggle between release/debug builds (default=true). - nunit={true|false} to include or esclude unit tests (default=true). - Also the target clean will remove binaries. - Output file (DotZLib.dll) will be found in either ./DotZLib/bin/release - or ./DotZLib/bin/debug, depending on whether you are building the release - or debug version of the library. - - Examples: - nant -D:debug=false -D:nunit=false - will build a release mode version of the library without unit tests. - nant - will build a debug version of the library with unit tests - nant clean - will remove all previously built files. - - ---------------------------------- -Copyright (c) Henrik Ravn 2004 - -Use, modification and distribution are subject to the Boost Software License, Version 1.0. -(See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) diff --git a/common/dist/zlib/contrib/infback9/README b/common/dist/zlib/contrib/infback9/README deleted file mode 100644 index e75ed1329..000000000 --- a/common/dist/zlib/contrib/infback9/README +++ /dev/null @@ -1 +0,0 @@ -See infback9.h for what this is and how to use it. diff --git a/common/dist/zlib/contrib/inflate86/inffast.S b/common/dist/zlib/contrib/inflate86/inffast.S deleted file mode 100644 index 2245a2905..000000000 --- a/common/dist/zlib/contrib/inflate86/inffast.S +++ /dev/null @@ -1,1368 +0,0 @@ -/* - * inffast.S is a hand tuned assembler version of: - * - * inffast.c -- fast decoding - * Copyright (C) 1995-2003 Mark Adler - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Copyright (C) 2003 Chris Anderson - * Please use the copyright conditions above. - * - * This version (Jan-23-2003) of inflate_fast was coded and tested under - * GNU/Linux on a pentium 3, using the gcc-3.2 compiler distribution. On that - * machine, I found that gzip style archives decompressed about 20% faster than - * the gcc-3.2 -O3 -fomit-frame-pointer compiled version. Your results will - * depend on how large of a buffer is used for z_stream.next_in & next_out - * (8K-32K worked best for my 256K cpu cache) and how much overhead there is in - * stream processing I/O and crc32/addler32. In my case, this routine used - * 70% of the cpu time and crc32 used 20%. - * - * I am confident that this version will work in the general case, but I have - * not tested a wide variety of datasets or a wide variety of platforms. - * - * Jan-24-2003 -- Added -DUSE_MMX define for slightly faster inflating. - * It should be a runtime flag instead of compile time flag... - * - * Jan-26-2003 -- Added runtime check for MMX support with cpuid instruction. - * With -DUSE_MMX, only MMX code is compiled. With -DNO_MMX, only non-MMX code - * is compiled. Without either option, runtime detection is enabled. Runtime - * detection should work on all modern cpus and the recomended algorithm (flip - * ID bit on eflags and then use the cpuid instruction) is used in many - * multimedia applications. Tested under win2k with gcc-2.95 and gas-2.12 - * distributed with cygwin3. Compiling with gcc-2.95 -c inffast.S -o - * inffast.obj generates a COFF object which can then be linked with MSVC++ - * compiled code. Tested under FreeBSD 4.7 with gcc-2.95. - * - * Jan-28-2003 -- Tested Athlon XP... MMX mode is slower than no MMX (and - * slower than compiler generated code). Adjusted cpuid check to use the MMX - * code only for Pentiums < P4 until I have more data on the P4. Speed - * improvment is only about 15% on the Athlon when compared with code generated - * with MSVC++. Not sure yet, but I think the P4 will also be slower using the - * MMX mode because many of it's x86 ALU instructions execute in .5 cycles and - * have less latency than MMX ops. Added code to buffer the last 11 bytes of - * the input stream since the MMX code grabs bits in chunks of 32, which - * differs from the inffast.c algorithm. I don't think there would have been - * read overruns where a page boundary was crossed (a segfault), but there - * could have been overruns when next_in ends on unaligned memory (unintialized - * memory read). - * - * Mar-13-2003 -- P4 MMX is slightly slower than P4 NO_MMX. I created a C - * version of the non-MMX code so that it doesn't depend on zstrm and zstate - * structure offsets which are hard coded in this file. This was last tested - * with zlib-1.2.0 which is currently in beta testing, newer versions of this - * and inffas86.c can be found at http://www.eetbeetee.com/zlib/ and - * http://www.charm.net/~christop/zlib/ - */ - - -/* - * if you have underscore linking problems (_inflate_fast undefined), try - * using -DGAS_COFF - */ -#if ! defined( GAS_COFF ) && ! defined( GAS_ELF ) - -#if defined( WIN32 ) || defined( __CYGWIN__ ) -#define GAS_COFF /* windows object format */ -#else -#define GAS_ELF -#endif - -#endif /* ! GAS_COFF && ! GAS_ELF */ - - -#if defined( GAS_COFF ) - -/* coff externals have underscores */ -#define inflate_fast _inflate_fast -#define inflate_fast_use_mmx _inflate_fast_use_mmx - -#endif /* GAS_COFF */ - - -.file "inffast.S" - -.globl inflate_fast - -.text -.align 4,0 -.L_invalid_literal_length_code_msg: -.string "invalid literal/length code" - -.align 4,0 -.L_invalid_distance_code_msg: -.string "invalid distance code" - -.align 4,0 -.L_invalid_distance_too_far_msg: -.string "invalid distance too far back" - -#if ! defined( NO_MMX ) -.align 4,0 -.L_mask: /* mask[N] = ( 1 << N ) - 1 */ -.long 0 -.long 1 -.long 3 -.long 7 -.long 15 -.long 31 -.long 63 -.long 127 -.long 255 -.long 511 -.long 1023 -.long 2047 -.long 4095 -.long 8191 -.long 16383 -.long 32767 -.long 65535 -.long 131071 -.long 262143 -.long 524287 -.long 1048575 -.long 2097151 -.long 4194303 -.long 8388607 -.long 16777215 -.long 33554431 -.long 67108863 -.long 134217727 -.long 268435455 -.long 536870911 -.long 1073741823 -.long 2147483647 -.long 4294967295 -#endif /* NO_MMX */ - -.text - -/* - * struct z_stream offsets, in zlib.h - */ -#define next_in_strm 0 /* strm->next_in */ -#define avail_in_strm 4 /* strm->avail_in */ -#define next_out_strm 12 /* strm->next_out */ -#define avail_out_strm 16 /* strm->avail_out */ -#define msg_strm 24 /* strm->msg */ -#define state_strm 28 /* strm->state */ - -/* - * struct inflate_state offsets, in inflate.h - */ -#define mode_state 0 /* state->mode */ -#define wsize_state 32 /* state->wsize */ -#define write_state 40 /* state->write */ -#define window_state 44 /* state->window */ -#define hold_state 48 /* state->hold */ -#define bits_state 52 /* state->bits */ -#define lencode_state 68 /* state->lencode */ -#define distcode_state 72 /* state->distcode */ -#define lenbits_state 76 /* state->lenbits */ -#define distbits_state 80 /* state->distbits */ - -/* - * inflate_fast's activation record - */ -#define local_var_size 64 /* how much local space for vars */ -#define strm_sp 88 /* first arg: z_stream * (local_var_size + 24) */ -#define start_sp 92 /* second arg: unsigned int (local_var_size + 28) */ - -/* - * offsets for local vars on stack - */ -#define out 60 /* unsigned char* */ -#define window 56 /* unsigned char* */ -#define wsize 52 /* unsigned int */ -#define write 48 /* unsigned int */ -#define in 44 /* unsigned char* */ -#define beg 40 /* unsigned char* */ -#define buf 28 /* char[ 12 ] */ -#define len 24 /* unsigned int */ -#define last 20 /* unsigned char* */ -#define end 16 /* unsigned char* */ -#define dcode 12 /* code* */ -#define lcode 8 /* code* */ -#define dmask 4 /* unsigned int */ -#define lmask 0 /* unsigned int */ - -/* - * typedef enum inflate_mode consts, in inflate.h - */ -#define INFLATE_MODE_TYPE 11 /* state->mode flags enum-ed in inflate.h */ -#define INFLATE_MODE_BAD 26 - - -#if ! defined( USE_MMX ) && ! defined( NO_MMX ) - -#define RUN_TIME_MMX - -#define CHECK_MMX 1 -#define DO_USE_MMX 2 -#define DONT_USE_MMX 3 - -.globl inflate_fast_use_mmx - -.data - -.align 4,0 -inflate_fast_use_mmx: /* integer flag for run time control 1=check,2=mmx,3=no */ -.long CHECK_MMX - -#if defined( GAS_ELF ) -/* elf info */ -.type inflate_fast_use_mmx,@object -.size inflate_fast_use_mmx,4 -#endif - -#endif /* RUN_TIME_MMX */ - -#if defined( GAS_COFF ) -/* coff info: scl 2 = extern, type 32 = function */ -.def inflate_fast; .scl 2; .type 32; .endef -#endif - -.text - -.align 32,0x90 -inflate_fast: - pushl %edi - pushl %esi - pushl %ebp - pushl %ebx - pushf /* save eflags (strm_sp, state_sp assumes this is 32 bits) */ - subl $local_var_size, %esp - cld - -#define strm_r %esi -#define state_r %edi - - movl strm_sp(%esp), strm_r - movl state_strm(strm_r), state_r - - /* in = strm->next_in; - * out = strm->next_out; - * last = in + strm->avail_in - 11; - * beg = out - (start - strm->avail_out); - * end = out + (strm->avail_out - 257); - */ - movl avail_in_strm(strm_r), %edx - movl next_in_strm(strm_r), %eax - - addl %eax, %edx /* avail_in += next_in */ - subl $11, %edx /* avail_in -= 11 */ - - movl %eax, in(%esp) - movl %edx, last(%esp) - - movl start_sp(%esp), %ebp - movl avail_out_strm(strm_r), %ecx - movl next_out_strm(strm_r), %ebx - - subl %ecx, %ebp /* start -= avail_out */ - negl %ebp /* start = -start */ - addl %ebx, %ebp /* start += next_out */ - - subl $257, %ecx /* avail_out -= 257 */ - addl %ebx, %ecx /* avail_out += out */ - - movl %ebx, out(%esp) - movl %ebp, beg(%esp) - movl %ecx, end(%esp) - - /* wsize = state->wsize; - * write = state->write; - * window = state->window; - * hold = state->hold; - * bits = state->bits; - * lcode = state->lencode; - * dcode = state->distcode; - * lmask = ( 1 << state->lenbits ) - 1; - * dmask = ( 1 << state->distbits ) - 1; - */ - - movl lencode_state(state_r), %eax - movl distcode_state(state_r), %ecx - - movl %eax, lcode(%esp) - movl %ecx, dcode(%esp) - - movl $1, %eax - movl lenbits_state(state_r), %ecx - shll %cl, %eax - decl %eax - movl %eax, lmask(%esp) - - movl $1, %eax - movl distbits_state(state_r), %ecx - shll %cl, %eax - decl %eax - movl %eax, dmask(%esp) - - movl wsize_state(state_r), %eax - movl write_state(state_r), %ecx - movl window_state(state_r), %edx - - movl %eax, wsize(%esp) - movl %ecx, write(%esp) - movl %edx, window(%esp) - - movl hold_state(state_r), %ebp - movl bits_state(state_r), %ebx - -#undef strm_r -#undef state_r - -#define in_r %esi -#define from_r %esi -#define out_r %edi - - movl in(%esp), in_r - movl last(%esp), %ecx - cmpl in_r, %ecx - ja .L_align_long /* if in < last */ - - addl $11, %ecx /* ecx = &in[ avail_in ] */ - subl in_r, %ecx /* ecx = avail_in */ - movl $12, %eax - subl %ecx, %eax /* eax = 12 - avail_in */ - leal buf(%esp), %edi - rep movsb /* memcpy( buf, in, avail_in ) */ - movl %eax, %ecx - xorl %eax, %eax - rep stosb /* memset( &buf[ avail_in ], 0, 12 - avail_in ) */ - leal buf(%esp), in_r /* in = buf */ - movl in_r, last(%esp) /* last = in, do just one iteration */ - jmp .L_is_aligned - - /* align in_r on long boundary */ -.L_align_long: - testl $3, in_r - jz .L_is_aligned - xorl %eax, %eax - movb (in_r), %al - incl in_r - movl %ebx, %ecx - addl $8, %ebx - shll %cl, %eax - orl %eax, %ebp - jmp .L_align_long - -.L_is_aligned: - movl out(%esp), out_r - -#if defined( NO_MMX ) - jmp .L_do_loop -#endif - -#if defined( USE_MMX ) - jmp .L_init_mmx -#endif - -/*** Runtime MMX check ***/ - -#if defined( RUN_TIME_MMX ) -.L_check_mmx: - cmpl $DO_USE_MMX, inflate_fast_use_mmx - je .L_init_mmx - ja .L_do_loop /* > 2 */ - - pushl %eax - pushl %ebx - pushl %ecx - pushl %edx - pushf - movl (%esp), %eax /* copy eflags to eax */ - xorl $0x200000, (%esp) /* try toggling ID bit of eflags (bit 21) - * to see if cpu supports cpuid... - * ID bit method not supported by NexGen but - * bios may load a cpuid instruction and - * cpuid may be disabled on Cyrix 5-6x86 */ - popf - pushf - popl %edx /* copy new eflags to edx */ - xorl %eax, %edx /* test if ID bit is flipped */ - jz .L_dont_use_mmx /* not flipped if zero */ - xorl %eax, %eax - cpuid - cmpl $0x756e6547, %ebx /* check for GenuineIntel in ebx,ecx,edx */ - jne .L_dont_use_mmx - cmpl $0x6c65746e, %ecx - jne .L_dont_use_mmx - cmpl $0x49656e69, %edx - jne .L_dont_use_mmx - movl $1, %eax - cpuid /* get cpu features */ - shrl $8, %eax - andl $15, %eax - cmpl $6, %eax /* check for Pentium family, is 0xf for P4 */ - jne .L_dont_use_mmx - testl $0x800000, %edx /* test if MMX feature is set (bit 23) */ - jnz .L_use_mmx - jmp .L_dont_use_mmx -.L_use_mmx: - movl $DO_USE_MMX, inflate_fast_use_mmx - jmp .L_check_mmx_pop -.L_dont_use_mmx: - movl $DONT_USE_MMX, inflate_fast_use_mmx -.L_check_mmx_pop: - popl %edx - popl %ecx - popl %ebx - popl %eax - jmp .L_check_mmx -#endif - - -/*** Non-MMX code ***/ - -#if defined ( NO_MMX ) || defined( RUN_TIME_MMX ) - -#define hold_r %ebp -#define bits_r %bl -#define bitslong_r %ebx - -.align 32,0x90 -.L_while_test: - /* while (in < last && out < end) - */ - cmpl out_r, end(%esp) - jbe .L_break_loop /* if (out >= end) */ - - cmpl in_r, last(%esp) - jbe .L_break_loop - -.L_do_loop: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out - * - * do { - * if (bits < 15) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * this = lcode[hold & lmask] - */ - cmpb $15, bits_r - ja .L_get_length_code /* if (15 < bits) */ - - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - -.L_get_length_code: - movl lmask(%esp), %edx /* edx = lmask */ - movl lcode(%esp), %ecx /* ecx = lcode */ - andl hold_r, %edx /* edx &= hold */ - movl (%ecx,%edx,4), %eax /* eax = lcode[hold & lmask] */ - -.L_dolen: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out - * - * dolen: - * bits -= this.bits; - * hold >>= this.bits - */ - movb %ah, %cl /* cl = this.bits */ - subb %ah, bits_r /* bits -= this.bits */ - shrl %cl, hold_r /* hold >>= this.bits */ - - /* check if op is a literal - * if (op == 0) { - * PUP(out) = this.val; - * } - */ - testb %al, %al - jnz .L_test_for_length_base /* if (op != 0) 45.7% */ - - shrl $16, %eax /* output this.val char */ - stosb - jmp .L_while_test - -.L_test_for_length_base: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = len - * - * else if (op & 16) { - * len = this.val - * op &= 15 - * if (op) { - * if (op > bits) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * len += hold & mask[op]; - * bits -= op; - * hold >>= op; - * } - */ -#define len_r %edx - movl %eax, len_r /* len = this */ - shrl $16, len_r /* len = this.val */ - movb %al, %cl - - testb $16, %al - jz .L_test_for_second_level_length /* if ((op & 16) == 0) 8% */ - andb $15, %cl /* op &= 15 */ - jz .L_save_len /* if (!op) */ - cmpb %cl, bits_r - jae .L_add_bits_to_len /* if (op <= bits) */ - - movb %cl, %ch /* stash op in ch, freeing cl */ - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - movb %ch, %cl /* move op back to ecx */ - -.L_add_bits_to_len: - movl $1, %eax - shll %cl, %eax - decl %eax - subb %cl, bits_r - andl hold_r, %eax /* eax &= hold */ - shrl %cl, hold_r - addl %eax, len_r /* len += hold & mask[op] */ - -.L_save_len: - movl len_r, len(%esp) /* save len */ -#undef len_r - -.L_decode_distance: - /* regs: %esi = in, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * - * if (bits < 15) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * this = dcode[hold & dmask]; - * dodist: - * bits -= this.bits; - * hold >>= this.bits; - * op = this.op; - */ - - cmpb $15, bits_r - ja .L_get_distance_code /* if (15 < bits) */ - - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - -.L_get_distance_code: - movl dmask(%esp), %edx /* edx = dmask */ - movl dcode(%esp), %ecx /* ecx = dcode */ - andl hold_r, %edx /* edx &= hold */ - movl (%ecx,%edx,4), %eax /* eax = dcode[hold & dmask] */ - -#define dist_r %edx -.L_dodist: - movl %eax, dist_r /* dist = this */ - shrl $16, dist_r /* dist = this.val */ - movb %ah, %cl - subb %ah, bits_r /* bits -= this.bits */ - shrl %cl, hold_r /* hold >>= this.bits */ - - /* if (op & 16) { - * dist = this.val - * op &= 15 - * if (op > bits) { - * hold |= *((unsigned short *)in)++ << bits; - * bits += 16 - * } - * dist += hold & mask[op]; - * bits -= op; - * hold >>= op; - */ - movb %al, %cl /* cl = this.op */ - - testb $16, %al /* if ((op & 16) == 0) */ - jz .L_test_for_second_level_dist - andb $15, %cl /* op &= 15 */ - jz .L_check_dist_one - cmpb %cl, bits_r - jae .L_add_bits_to_dist /* if (op <= bits) 97.6% */ - - movb %cl, %ch /* stash op in ch, freeing cl */ - xorl %eax, %eax - lodsw /* al = *(ushort *)in++ */ - movb bits_r, %cl /* cl = bits, needs it for shifting */ - addb $16, bits_r /* bits += 16 */ - shll %cl, %eax - orl %eax, hold_r /* hold |= *((ushort *)in)++ << bits */ - movb %ch, %cl /* move op back to ecx */ - -.L_add_bits_to_dist: - movl $1, %eax - shll %cl, %eax - decl %eax /* (1 << op) - 1 */ - subb %cl, bits_r - andl hold_r, %eax /* eax &= hold */ - shrl %cl, hold_r - addl %eax, dist_r /* dist += hold & ((1 << op) - 1) */ - jmp .L_check_window - -.L_check_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes - * - * nbytes = out - beg; - * if (dist <= nbytes) { - * from = out - dist; - * do { - * PUP(out) = PUP(from); - * } while (--len > 0) { - * } - */ - - movl in_r, in(%esp) /* save in so from can use it's reg */ - movl out_r, %eax - subl beg(%esp), %eax /* nbytes = out - beg */ - - cmpl dist_r, %eax - jb .L_clip_window /* if (dist > nbytes) 4.2% */ - - movl len(%esp), %ecx - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - - subl $3, %ecx - movb (from_r), %al - movb %al, (out_r) - movb 1(from_r), %al - movb 2(from_r), %dl - addl $3, from_r - movb %al, 1(out_r) - movb %dl, 2(out_r) - addl $3, out_r - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - jmp .L_while_test - -.align 16,0x90 -.L_check_dist_one: - cmpl $1, dist_r - jne .L_check_window - cmpl out_r, beg(%esp) - je .L_check_window - - decl out_r - movl len(%esp), %ecx - movb (out_r), %al - subl $3, %ecx - - movb %al, 1(out_r) - movb %al, 2(out_r) - movb %al, 3(out_r) - addl $4, out_r - rep stosb - - jmp .L_while_test - -.align 16,0x90 -.L_test_for_second_level_length: - /* else if ((op & 64) == 0) { - * this = lcode[this.val + (hold & mask[op])]; - * } - */ - testb $64, %al - jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */ - - movl $1, %eax - shll %cl, %eax - decl %eax - andl hold_r, %eax /* eax &= hold */ - addl %edx, %eax /* eax += this.val */ - movl lcode(%esp), %edx /* edx = lcode */ - movl (%edx,%eax,4), %eax /* eax = lcode[val + (hold&mask[op])] */ - jmp .L_dolen - -.align 16,0x90 -.L_test_for_second_level_dist: - /* else if ((op & 64) == 0) { - * this = dcode[this.val + (hold & mask[op])]; - * } - */ - testb $64, %al - jnz .L_invalid_distance_code /* if ((op & 64) != 0) */ - - movl $1, %eax - shll %cl, %eax - decl %eax - andl hold_r, %eax /* eax &= hold */ - addl %edx, %eax /* eax += this.val */ - movl dcode(%esp), %edx /* edx = dcode */ - movl (%edx,%eax,4), %eax /* eax = dcode[val + (hold&mask[op])] */ - jmp .L_dodist - -.align 16,0x90 -.L_clip_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes - * - * else { - * if (dist > wsize) { - * invalid distance - * } - * from = window; - * nbytes = dist - nbytes; - * if (write == 0) { - * from += wsize - nbytes; - */ -#define nbytes_r %ecx - movl %eax, nbytes_r - movl wsize(%esp), %eax /* prepare for dist compare */ - negl nbytes_r /* nbytes = -nbytes */ - movl window(%esp), from_r /* from = window */ - - cmpl dist_r, %eax - jb .L_invalid_distance_too_far /* if (dist > wsize) */ - - addl dist_r, nbytes_r /* nbytes = dist - nbytes */ - cmpl $0, write(%esp) - jne .L_wrap_around_window /* if (write != 0) */ - - subl nbytes_r, %eax - addl %eax, from_r /* from += wsize - nbytes */ - - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = len - * - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = out - dist; - * } - * } - */ -#define len_r %eax - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - -.L_wrap_around_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = write, %eax = len - * - * else if (write < nbytes) { - * from += wsize + write - nbytes; - * nbytes -= write; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = window; - * nbytes = write; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while(--nbytes); - * from = out - dist; - * } - * } - * } - */ -#define write_r %eax - movl write(%esp), write_r - cmpl write_r, nbytes_r - jbe .L_contiguous_in_window /* if (write >= nbytes) */ - - addl wsize(%esp), from_r - addl write_r, from_r - subl nbytes_r, from_r /* from += wsize + write - nbytes */ - subl write_r, nbytes_r /* nbytes -= write */ -#undef write_r - - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl window(%esp), from_r /* from = window */ - movl write(%esp), nbytes_r /* nbytes = write */ - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1 - -.L_contiguous_in_window: - /* regs: %esi = from, %ebp = hold, %bl = bits, %edi = out, %edx = dist - * %ecx = nbytes, %eax = write, %eax = len - * - * else { - * from += write - nbytes; - * if (nbytes < len) { - * len -= nbytes; - * do { - * PUP(out) = PUP(from); - * } while (--nbytes); - * from = out - dist; - * } - * } - */ -#define write_r %eax - addl write_r, from_r - subl nbytes_r, from_r /* from += write - nbytes */ -#undef write_r - - movl len(%esp), len_r - cmpl nbytes_r, len_r - jbe .L_do_copy1 /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - -.L_do_copy1: - /* regs: %esi = from, %esi = in, %ebp = hold, %bl = bits, %edi = out - * %eax = len - * - * while (len > 0) { - * PUP(out) = PUP(from); - * len--; - * } - * } - * } while (in < last && out < end); - */ -#undef nbytes_r -#define in_r %esi - movl len_r, %ecx - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - jmp .L_while_test - -#undef len_r -#undef dist_r - -#endif /* NO_MMX || RUN_TIME_MMX */ - - -/*** MMX code ***/ - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -.align 32,0x90 -.L_init_mmx: - emms - -#undef bits_r -#undef bitslong_r -#define bitslong_r %ebp -#define hold_mm %mm0 - movd %ebp, hold_mm - movl %ebx, bitslong_r - -#define used_mm %mm1 -#define dmask2_mm %mm2 -#define lmask2_mm %mm3 -#define lmask_mm %mm4 -#define dmask_mm %mm5 -#define tmp_mm %mm6 - - movd lmask(%esp), lmask_mm - movq lmask_mm, lmask2_mm - movd dmask(%esp), dmask_mm - movq dmask_mm, dmask2_mm - pxor used_mm, used_mm - movl lcode(%esp), %ebx /* ebx = lcode */ - jmp .L_do_loop_mmx - -.align 32,0x90 -.L_while_test_mmx: - /* while (in < last && out < end) - */ - cmpl out_r, end(%esp) - jbe .L_break_loop /* if (out >= end) */ - - cmpl in_r, last(%esp) - jbe .L_break_loop - -.L_do_loop_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - - cmpl $32, bitslong_r - ja .L_get_length_code_mmx /* if (32 < bits) */ - - movd bitslong_r, tmp_mm - movd (in_r), %mm7 - addl $4, in_r - psllq tmp_mm, %mm7 - addl $32, bitslong_r - por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */ - -.L_get_length_code_mmx: - pand hold_mm, lmask_mm - movd lmask_mm, %eax - movq lmask2_mm, lmask_mm - movl (%ebx,%eax,4), %eax /* eax = lcode[hold & lmask] */ - -.L_dolen_mmx: - movzbl %ah, %ecx /* ecx = this.bits */ - movd %ecx, used_mm - subl %ecx, bitslong_r /* bits -= this.bits */ - - testb %al, %al - jnz .L_test_for_length_base_mmx /* if (op != 0) 45.7% */ - - shrl $16, %eax /* output this.val char */ - stosb - jmp .L_while_test_mmx - -.L_test_for_length_base_mmx: -#define len_r %edx - movl %eax, len_r /* len = this */ - shrl $16, len_r /* len = this.val */ - - testb $16, %al - jz .L_test_for_second_level_length_mmx /* if ((op & 16) == 0) 8% */ - andl $15, %eax /* op &= 15 */ - jz .L_decode_distance_mmx /* if (!op) */ - - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd %eax, used_mm - movd hold_mm, %ecx - subl %eax, bitslong_r - andl .L_mask(,%eax,4), %ecx - addl %ecx, len_r /* len += hold & mask[op] */ - -.L_decode_distance_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - - cmpl $32, bitslong_r - ja .L_get_dist_code_mmx /* if (32 < bits) */ - - movd bitslong_r, tmp_mm - movd (in_r), %mm7 - addl $4, in_r - psllq tmp_mm, %mm7 - addl $32, bitslong_r - por %mm7, hold_mm /* hold_mm |= *((uint *)in)++ << bits */ - -.L_get_dist_code_mmx: - movl dcode(%esp), %ebx /* ebx = dcode */ - pand hold_mm, dmask_mm - movd dmask_mm, %eax - movq dmask2_mm, dmask_mm - movl (%ebx,%eax,4), %eax /* eax = dcode[hold & lmask] */ - -.L_dodist_mmx: -#define dist_r %ebx - movzbl %ah, %ecx /* ecx = this.bits */ - movl %eax, dist_r - shrl $16, dist_r /* dist = this.val */ - subl %ecx, bitslong_r /* bits -= this.bits */ - movd %ecx, used_mm - - testb $16, %al /* if ((op & 16) == 0) */ - jz .L_test_for_second_level_dist_mmx - andl $15, %eax /* op &= 15 */ - jz .L_check_dist_one_mmx - -.L_add_bits_to_dist_mmx: - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd %eax, used_mm /* save bit length of current op */ - movd hold_mm, %ecx /* get the next bits on input stream */ - subl %eax, bitslong_r /* bits -= op bits */ - andl .L_mask(,%eax,4), %ecx /* ecx = hold & mask[op] */ - addl %ecx, dist_r /* dist += hold & mask[op] */ - -.L_check_window_mmx: - movl in_r, in(%esp) /* save in so from can use it's reg */ - movl out_r, %eax - subl beg(%esp), %eax /* nbytes = out - beg */ - - cmpl dist_r, %eax - jb .L_clip_window_mmx /* if (dist > nbytes) 4.2% */ - - movl len_r, %ecx - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - - subl $3, %ecx - movb (from_r), %al - movb %al, (out_r) - movb 1(from_r), %al - movb 2(from_r), %dl - addl $3, from_r - movb %al, 1(out_r) - movb %dl, 2(out_r) - addl $3, out_r - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -.align 16,0x90 -.L_check_dist_one_mmx: - cmpl $1, dist_r - jne .L_check_window_mmx - cmpl out_r, beg(%esp) - je .L_check_window_mmx - - decl out_r - movl len_r, %ecx - movb (out_r), %al - subl $3, %ecx - - movb %al, 1(out_r) - movb %al, 2(out_r) - movb %al, 3(out_r) - addl $4, out_r - rep stosb - - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -.align 16,0x90 -.L_test_for_second_level_length_mmx: - testb $64, %al - jnz .L_test_for_end_of_block /* if ((op & 64) != 0) */ - - andl $15, %eax - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ecx - andl .L_mask(,%eax,4), %ecx - addl len_r, %ecx - movl (%ebx,%ecx,4), %eax /* eax = lcode[hold & lmask] */ - jmp .L_dolen_mmx - -.align 16,0x90 -.L_test_for_second_level_dist_mmx: - testb $64, %al - jnz .L_invalid_distance_code /* if ((op & 64) != 0) */ - - andl $15, %eax - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ecx - andl .L_mask(,%eax,4), %ecx - movl dcode(%esp), %eax /* ecx = dcode */ - addl dist_r, %ecx - movl (%eax,%ecx,4), %eax /* eax = lcode[hold & lmask] */ - jmp .L_dodist_mmx - -.align 16,0x90 -.L_clip_window_mmx: -#define nbytes_r %ecx - movl %eax, nbytes_r - movl wsize(%esp), %eax /* prepare for dist compare */ - negl nbytes_r /* nbytes = -nbytes */ - movl window(%esp), from_r /* from = window */ - - cmpl dist_r, %eax - jb .L_invalid_distance_too_far /* if (dist > wsize) */ - - addl dist_r, nbytes_r /* nbytes = dist - nbytes */ - cmpl $0, write(%esp) - jne .L_wrap_around_window_mmx /* if (write != 0) */ - - subl nbytes_r, %eax - addl %eax, from_r /* from += wsize - nbytes */ - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - -.L_wrap_around_window_mmx: -#define write_r %eax - movl write(%esp), write_r - cmpl write_r, nbytes_r - jbe .L_contiguous_in_window_mmx /* if (write >= nbytes) */ - - addl wsize(%esp), from_r - addl write_r, from_r - subl nbytes_r, from_r /* from += wsize + write - nbytes */ - subl write_r, nbytes_r /* nbytes -= write */ -#undef write_r - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl window(%esp), from_r /* from = window */ - movl write(%esp), nbytes_r /* nbytes = write */ - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - jmp .L_do_copy1_mmx - -.L_contiguous_in_window_mmx: -#define write_r %eax - addl write_r, from_r - subl nbytes_r, from_r /* from += write - nbytes */ -#undef write_r - - cmpl nbytes_r, len_r - jbe .L_do_copy1_mmx /* if (nbytes >= len) */ - - subl nbytes_r, len_r /* len -= nbytes */ - rep movsb - movl out_r, from_r - subl dist_r, from_r /* from = out - dist */ - -.L_do_copy1_mmx: -#undef nbytes_r -#define in_r %esi - movl len_r, %ecx - rep movsb - - movl in(%esp), in_r /* move in back to %esi, toss from */ - movl lcode(%esp), %ebx /* move lcode back to %ebx, toss dist */ - jmp .L_while_test_mmx - -#undef hold_r -#undef bitslong_r - -#endif /* USE_MMX || RUN_TIME_MMX */ - - -/*** USE_MMX, NO_MMX, and RUNTIME_MMX from here on ***/ - -.L_invalid_distance_code: - /* else { - * strm->msg = "invalid distance code"; - * state->mode = BAD; - * } - */ - movl $.L_invalid_distance_code_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_test_for_end_of_block: - /* else if (op & 32) { - * state->mode = TYPE; - * break; - * } - */ - testb $32, %al - jz .L_invalid_literal_length_code /* if ((op & 32) == 0) */ - - movl $0, %ecx - movl $INFLATE_MODE_TYPE, %edx - jmp .L_update_stream_state - -.L_invalid_literal_length_code: - /* else { - * strm->msg = "invalid literal/length code"; - * state->mode = BAD; - * } - */ - movl $.L_invalid_literal_length_code_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_invalid_distance_too_far: - /* strm->msg = "invalid distance too far back"; - * state->mode = BAD; - */ - movl in(%esp), in_r /* from_r has in's reg, put in back */ - movl $.L_invalid_distance_too_far_msg, %ecx - movl $INFLATE_MODE_BAD, %edx - jmp .L_update_stream_state - -.L_update_stream_state: - /* set strm->msg = %ecx, strm->state->mode = %edx */ - movl strm_sp(%esp), %eax - testl %ecx, %ecx /* if (msg != NULL) */ - jz .L_skip_msg - movl %ecx, msg_strm(%eax) /* strm->msg = msg */ -.L_skip_msg: - movl state_strm(%eax), %eax /* state = strm->state */ - movl %edx, mode_state(%eax) /* state->mode = edx (BAD | TYPE) */ - jmp .L_break_loop - -.align 32,0x90 -.L_break_loop: - -/* - * Regs: - * - * bits = %ebp when mmx, and in %ebx when non-mmx - * hold = %hold_mm when mmx, and in %ebp when non-mmx - * in = %esi - * out = %edi - */ - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -#if defined( RUN_TIME_MMX ) - - cmpl $DO_USE_MMX, inflate_fast_use_mmx - jne .L_update_next_in - -#endif /* RUN_TIME_MMX */ - - movl %ebp, %ebx - -.L_update_next_in: - -#endif - -#define strm_r %eax -#define state_r %edx - - /* len = bits >> 3; - * in -= len; - * bits -= len << 3; - * hold &= (1U << bits) - 1; - * state->hold = hold; - * state->bits = bits; - * strm->next_in = in; - * strm->next_out = out; - */ - movl strm_sp(%esp), strm_r - movl %ebx, %ecx - movl state_strm(strm_r), state_r - shrl $3, %ecx - subl %ecx, in_r - shll $3, %ecx - subl %ecx, %ebx - movl out_r, next_out_strm(strm_r) - movl %ebx, bits_state(state_r) - movl %ebx, %ecx - - leal buf(%esp), %ebx - cmpl %ebx, last(%esp) - jne .L_buf_not_used /* if buf != last */ - - subl %ebx, in_r /* in -= buf */ - movl next_in_strm(strm_r), %ebx - movl %ebx, last(%esp) /* last = strm->next_in */ - addl %ebx, in_r /* in += strm->next_in */ - movl avail_in_strm(strm_r), %ebx - subl $11, %ebx - addl %ebx, last(%esp) /* last = &strm->next_in[ avail_in - 11 ] */ - -.L_buf_not_used: - movl in_r, next_in_strm(strm_r) - - movl $1, %ebx - shll %cl, %ebx - decl %ebx - -#if defined( USE_MMX ) || defined( RUN_TIME_MMX ) - -#if defined( RUN_TIME_MMX ) - - cmpl $DO_USE_MMX, inflate_fast_use_mmx - jne .L_update_hold - -#endif /* RUN_TIME_MMX */ - - psrlq used_mm, hold_mm /* hold_mm >>= last bit length */ - movd hold_mm, %ebp - - emms - -.L_update_hold: - -#endif /* USE_MMX || RUN_TIME_MMX */ - - andl %ebx, %ebp - movl %ebp, hold_state(state_r) - -#define last_r %ebx - - /* strm->avail_in = in < last ? 11 + (last - in) : 11 - (in - last) */ - movl last(%esp), last_r - cmpl in_r, last_r - jbe .L_last_is_smaller /* if (in >= last) */ - - subl in_r, last_r /* last -= in */ - addl $11, last_r /* last += 11 */ - movl last_r, avail_in_strm(strm_r) - jmp .L_fixup_out -.L_last_is_smaller: - subl last_r, in_r /* in -= last */ - negl in_r /* in = -in */ - addl $11, in_r /* in += 11 */ - movl in_r, avail_in_strm(strm_r) - -#undef last_r -#define end_r %ebx - -.L_fixup_out: - /* strm->avail_out = out < end ? 257 + (end - out) : 257 - (out - end)*/ - movl end(%esp), end_r - cmpl out_r, end_r - jbe .L_end_is_smaller /* if (out >= end) */ - - subl out_r, end_r /* end -= out */ - addl $257, end_r /* end += 257 */ - movl end_r, avail_out_strm(strm_r) - jmp .L_done -.L_end_is_smaller: - subl end_r, out_r /* out -= end */ - negl out_r /* out = -out */ - addl $257, out_r /* out += 257 */ - movl out_r, avail_out_strm(strm_r) - -#undef end_r -#undef strm_r -#undef state_r - -.L_done: - addl $local_var_size, %esp - popf - popl %ebx - popl %ebp - popl %esi - popl %edi - ret - -#if defined( GAS_ELF ) -/* elf info */ -.type inflate_fast,@function -.size inflate_fast,.-inflate_fast -#endif diff --git a/common/dist/zlib/contrib/iostream/test.cpp b/common/dist/zlib/contrib/iostream/test.cpp deleted file mode 100644 index 63699bf11..000000000 --- a/common/dist/zlib/contrib/iostream/test.cpp +++ /dev/null @@ -1,23 +0,0 @@ - -#include "zfstream.h" - -int main() { - - // Construct a stream object with this filebuffer. Anything sent - // to this stream will go to standard out. - gzofstream os(1, ios::out); - - // This text is getting compressed and sent to stdout. - // To prove this, run 'test | zcat'. - os << "Hello, Mommy" << endl; - - os << setcompressionlevel(Z_NO_COMPRESSION); - os << "hello, hello, hi, ho!" << endl; - - setcompressionlevel(os, Z_DEFAULT_COMPRESSION) - << "I'm compressing again" << endl; - - os.close(); - - return 0; -} diff --git a/common/dist/zlib/contrib/iostream/zfstream.cpp b/common/dist/zlib/contrib/iostream/zfstream.cpp deleted file mode 100644 index 5cb7de749..000000000 --- a/common/dist/zlib/contrib/iostream/zfstream.cpp +++ /dev/null @@ -1,292 +0,0 @@ - -#include "zfstream.h" - -gzfilebuf::gzfilebuf() : file(NULL), mode(0), own_file_descriptor(0) {} - -gzfilebuf::~gzfilebuf() { - - sync(); - if (own_file_descriptor) - close(); -} - -gzfilebuf *gzfilebuf::open(const char *name, int io_mode) { - - if (is_open()) - return NULL; - - char char_mode[10]; - char *p = char_mode; - - if (io_mode & ios::in) { - mode = ios::in; - *p++ = 'r'; - } else if (io_mode & ios::app) { - mode = ios::app; - *p++ = 'a'; - } else { - mode = ios::out; - *p++ = 'w'; - } - - if (io_mode & ios::binary) { - mode |= ios::binary; - *p++ = 'b'; - } - - // Hard code the compression level - if (io_mode & (ios::out | ios::app)) { - *p++ = '9'; - } - - // Put the end-of-string indicator - *p = '\0'; - - if ((file = gzopen(name, char_mode)) == NULL) - return NULL; - - own_file_descriptor = 1; - - return this; -} - -gzfilebuf *gzfilebuf::attach(int file_descriptor, int io_mode) { - - if (is_open()) - return NULL; - - char char_mode[10]; - char *p = char_mode; - - if (io_mode & ios::in) { - mode = ios::in; - *p++ = 'r'; - } else if (io_mode & ios::app) { - mode = ios::app; - *p++ = 'a'; - } else { - mode = ios::out; - *p++ = 'w'; - } - - if (io_mode & ios::binary) { - mode |= ios::binary; - *p++ = 'b'; - } - - // Hard code the compression level - if (io_mode & (ios::out | ios::app)) { - *p++ = '9'; - } - - // Put the end-of-string indicator - *p = '\0'; - - if ((file = gzdopen(file_descriptor, char_mode)) == NULL) - return NULL; - - own_file_descriptor = 0; - - return this; -} - -gzfilebuf *gzfilebuf::close() { - - if (is_open()) { - - sync(); - gzclose(file); - file = NULL; - } - - return this; -} - -int gzfilebuf::setcompressionlevel(int comp_level) { - - return gzsetparams(file, comp_level, -2); -} - -int gzfilebuf::setcompressionstrategy(int comp_strategy) { - - return gzsetparams(file, -2, comp_strategy); -} - -streampos gzfilebuf::seekoff(streamoff off, ios::seek_dir dir, int which) { - - return streampos(EOF); -} - -int gzfilebuf::underflow() { - - // If the file hasn't been opened for reading, error. - if (!is_open() || !(mode & ios::in)) - return EOF; - - // if a buffer doesn't exists, allocate one. - if (!base()) { - - if ((allocate()) == EOF) - return EOF; - setp(0, 0); - - } else { - - if (in_avail()) - return (unsigned char)*gptr(); - - if (out_waiting()) { - if (flushbuf() == EOF) - return EOF; - } - } - - // Attempt to fill the buffer. - - int result = fillbuf(); - if (result == EOF) { - // disable get area - setg(0, 0, 0); - return EOF; - } - - return (unsigned char)*gptr(); -} - -int gzfilebuf::overflow(int c) { - - if (!is_open() || !(mode & ios::out)) - return EOF; - - if (!base()) { - if (allocate() == EOF) - return EOF; - setg(0, 0, 0); - } else { - if (in_avail()) { - return EOF; - } - if (out_waiting()) { - if (flushbuf() == EOF) - return EOF; - } - } - - int bl = blen(); - setp(base(), base() + bl); - - if (c != EOF) { - - *pptr() = c; - pbump(1); - } - - return 0; -} - -int gzfilebuf::sync() { - - if (!is_open()) - return EOF; - - if (out_waiting()) - return flushbuf(); - - return 0; -} - -int gzfilebuf::flushbuf() { - - int n; - char *q; - - q = pbase(); - n = pptr() - q; - - if (gzwrite(file, q, n) < n) - return EOF; - - setp(0, 0); - - return 0; -} - -int gzfilebuf::fillbuf() { - - int required; - char *p; - - p = base(); - - required = blen(); - - int t = gzread(file, p, required); - - if (t <= 0) - return EOF; - - setg(base(), base(), base() + t); - - return t; -} - -gzfilestream_common::gzfilestream_common() - : ios(gzfilestream_common::rdbuf()) {} - -gzfilestream_common::~gzfilestream_common() {} - -void gzfilestream_common::attach(int fd, int io_mode) { - - if (!buffer.attach(fd, io_mode)) - clear(ios::failbit | ios::badbit); - else - clear(); -} - -void gzfilestream_common::open(const char *name, int io_mode) { - - if (!buffer.open(name, io_mode)) - clear(ios::failbit | ios::badbit); - else - clear(); -} - -void gzfilestream_common::close() { - - if (!buffer.close()) - clear(ios::failbit | ios::badbit); -} - -gzfilebuf *gzfilestream_common::rdbuf() { return &buffer; } - -gzifstream::gzifstream() : ios(gzfilestream_common::rdbuf()) { - clear(ios::badbit); -} - -gzifstream::gzifstream(const char *name, int io_mode) - : ios(gzfilestream_common::rdbuf()) { - gzfilestream_common::open(name, io_mode); -} - -gzifstream::gzifstream(int fd, int io_mode) - : ios(gzfilestream_common::rdbuf()) { - gzfilestream_common::attach(fd, io_mode); -} - -gzifstream::~gzifstream() {} - -gzofstream::gzofstream() : ios(gzfilestream_common::rdbuf()) { - clear(ios::badbit); -} - -gzofstream::gzofstream(const char *name, int io_mode) - : ios(gzfilestream_common::rdbuf()) { - gzfilestream_common::open(name, io_mode); -} - -gzofstream::gzofstream(int fd, int io_mode) - : ios(gzfilestream_common::rdbuf()) { - gzfilestream_common::attach(fd, io_mode); -} - -gzofstream::~gzofstream() {} diff --git a/common/dist/zlib/contrib/iostream2/zstream_test.cpp b/common/dist/zlib/contrib/iostream2/zstream_test.cpp deleted file mode 100644 index 19c0a8d1a..000000000 --- a/common/dist/zlib/contrib/iostream2/zstream_test.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include "zstream.h" -#include -#include -#include - -void main() { - char h[256] = "Hello"; - char *g = "Goodbye"; - ozstream out("temp.gz"); - out < "This works well" < h < g; - out.close(); - - izstream in("temp.gz"); // read it back - char *x = read_string(in), *y = new char[256], z[256]; - in > y > z; - in.close(); - cout << x << endl << y << endl << z << endl; - - out.open("temp.gz"); // try ascii output; zcat temp.gz to see the results - out << setw(50) << setfill('#') << setprecision(20) << x << endl - << y << endl - << z << endl; - out << z << endl << y << endl << x << endl; - out << 1.1234567890123456789 << endl; - - delete[] x; - delete[] y; -} diff --git a/common/dist/zlib/contrib/iostream3/README b/common/dist/zlib/contrib/iostream3/README deleted file mode 100644 index f7b319ab9..000000000 --- a/common/dist/zlib/contrib/iostream3/README +++ /dev/null @@ -1,35 +0,0 @@ -These classes provide a C++ stream interface to the zlib library. It allows you -to do things like: - - gzofstream outf("blah.gz"); - outf << "These go into the gzip file " << 123 << endl; - -It does this by deriving a specialized stream buffer for gzipped files, which is -the way Stroustrup would have done it. :-> - -The gzifstream and gzofstream classes were originally written by Kevin Ruland -and made available in the zlib contrib/iostream directory. The older version still -compiles under gcc 2.xx, but not under gcc 3.xx, which sparked the development of -this version. - -The new classes are as standard-compliant as possible, closely following the -approach of the standard library's fstream classes. It compiles under gcc versions -3.2 and 3.3, but not under gcc 2.xx. This is mainly due to changes in the standard -library naming scheme. The new version of gzifstream/gzofstream/gzfilebuf differs -from the previous one in the following respects: -- added showmanyc -- added setbuf, with support for unbuffered output via setbuf(0,0) -- a few bug fixes of stream behavior -- gzipped output file opened with default compression level instead of maximum level -- setcompressionlevel()/strategy() members replaced by single setcompression() - -The code is provided "as is", with the permission to use, copy, modify, distribute -and sell it for any purpose without fee. - -Ludwig Schwardt - - -DSP Lab -Electrical & Electronic Engineering Department -University of Stellenbosch -South Africa diff --git a/common/dist/zlib/contrib/iostream3/TODO b/common/dist/zlib/contrib/iostream3/TODO deleted file mode 100644 index 7032f97be..000000000 --- a/common/dist/zlib/contrib/iostream3/TODO +++ /dev/null @@ -1,17 +0,0 @@ -Possible upgrades to gzfilebuf: - -- The ability to do putback (e.g. putbackfail) - -- The ability to seek (zlib supports this, but could be slow/tricky) - -- Simultaneous read/write access (does it make sense?) - -- Support for ios_base::ate open mode - -- Locale support? - -- Check public interface to see which calls give problems - (due to dependence on library internals) - -- Override operator<<(ostream&, gzfilebuf*) to allow direct copying - of stream buffer to stream ( i.e. os << is.rdbuf(); ) diff --git a/common/dist/zlib/contrib/iostream3/test.cc b/common/dist/zlib/contrib/iostream3/test.cc deleted file mode 100644 index 94235334f..000000000 --- a/common/dist/zlib/contrib/iostream3/test.cc +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Test program for gzifstream and gzofstream - * - * by Ludwig Schwardt - * original version by Kevin Ruland - */ - -#include "zfstream.h" -#include // for cout - -int main() { - - gzofstream outf; - gzifstream inf; - char buf[80]; - - outf.open("test1.txt.gz"); - outf << "The quick brown fox sidestepped the lazy canine\n" - << 1.3 << "\nPlan " << 9 << std::endl; - outf.close(); - std::cout << "Wrote the following message to 'test1.txt.gz' (check with zcat or zless):\n" - << "The quick brown fox sidestepped the lazy canine\n" - << 1.3 << "\nPlan " << 9 << std::endl; - - std::cout << "\nReading 'test1.txt.gz' (buffered) produces:\n"; - inf.open("test1.txt.gz"); - while (inf.getline(buf,80,'\n')) { - std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n"; - } - inf.close(); - - outf.rdbuf()->pubsetbuf(0,0); - outf.open("test2.txt.gz"); - outf << setcompression(Z_NO_COMPRESSION) - << "The quick brown fox sidestepped the lazy canine\n" - << 1.3 << "\nPlan " << 9 << std::endl; - outf.close(); - std::cout << "\nWrote the same message to 'test2.txt.gz' in uncompressed form"; - - std::cout << "\nReading 'test2.txt.gz' (unbuffered) produces:\n"; - inf.rdbuf()->pubsetbuf(0,0); - inf.open("test2.txt.gz"); - while (inf.getline(buf,80,'\n')) { - std::cout << buf << "\t(" << inf.rdbuf()->in_avail() << " chars left in buffer)\n"; - } - inf.close(); - - return 0; - -} diff --git a/common/dist/zlib/contrib/iostream3/zfstream.cc b/common/dist/zlib/contrib/iostream3/zfstream.cc deleted file mode 100644 index 94eb93344..000000000 --- a/common/dist/zlib/contrib/iostream3/zfstream.cc +++ /dev/null @@ -1,479 +0,0 @@ -/* - * A C++ I/O streams interface to the zlib gz* functions - * - * by Ludwig Schwardt - * original version by Kevin Ruland - * - * This version is standard-compliant and compatible with gcc 3.x. - */ - -#include "zfstream.h" -#include // for strcpy, strcat, strlen (mode strings) -#include // for BUFSIZ - -// Internal buffer sizes (default and "unbuffered" versions) -#define BIGBUFSIZE BUFSIZ -#define SMALLBUFSIZE 1 - -/*****************************************************************************/ - -// Default constructor -gzfilebuf::gzfilebuf() -: file(NULL), io_mode(std::ios_base::openmode(0)), own_fd(false), - buffer(NULL), buffer_size(BIGBUFSIZE), own_buffer(true) -{ - // No buffers to start with - this->disable_buffer(); -} - -// Destructor -gzfilebuf::~gzfilebuf() -{ - // Sync output buffer and close only if responsible for file - // (i.e. attached streams should be left open at this stage) - this->sync(); - if (own_fd) - this->close(); - // Make sure internal buffer is deallocated - this->disable_buffer(); -} - -// Set compression level and strategy -int -gzfilebuf::setcompression(int comp_level, - int comp_strategy) -{ - return gzsetparams(file, comp_level, comp_strategy); -} - -// Open gzipped file -gzfilebuf* -gzfilebuf::open(const char *name, - std::ios_base::openmode mode) -{ - // Fail if file already open - if (this->is_open()) - return NULL; - // Don't support simultaneous read/write access (yet) - if ((mode & std::ios_base::in) && (mode & std::ios_base::out)) - return NULL; - - // Build mode string for gzopen and check it [27.8.1.3.2] - char char_mode[6] = "\0\0\0\0\0"; - if (!this->open_mode(mode, char_mode)) - return NULL; - - // Attempt to open file - if ((file = gzopen(name, char_mode)) == NULL) - return NULL; - - // On success, allocate internal buffer and set flags - this->enable_buffer(); - io_mode = mode; - own_fd = true; - return this; -} - -// Attach to gzipped file -gzfilebuf* -gzfilebuf::attach(int fd, - std::ios_base::openmode mode) -{ - // Fail if file already open - if (this->is_open()) - return NULL; - // Don't support simultaneous read/write access (yet) - if ((mode & std::ios_base::in) && (mode & std::ios_base::out)) - return NULL; - - // Build mode string for gzdopen and check it [27.8.1.3.2] - char char_mode[6] = "\0\0\0\0\0"; - if (!this->open_mode(mode, char_mode)) - return NULL; - - // Attempt to attach to file - if ((file = gzdopen(fd, char_mode)) == NULL) - return NULL; - - // On success, allocate internal buffer and set flags - this->enable_buffer(); - io_mode = mode; - own_fd = false; - return this; -} - -// Close gzipped file -gzfilebuf* -gzfilebuf::close() -{ - // Fail immediately if no file is open - if (!this->is_open()) - return NULL; - // Assume success - gzfilebuf* retval = this; - // Attempt to sync and close gzipped file - if (this->sync() == -1) - retval = NULL; - if (gzclose(file) < 0) - retval = NULL; - // File is now gone anyway (postcondition [27.8.1.3.8]) - file = NULL; - own_fd = false; - // Destroy internal buffer if it exists - this->disable_buffer(); - return retval; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -// Convert int open mode to mode string -bool -gzfilebuf::open_mode(std::ios_base::openmode mode, - char* c_mode) const -{ - bool testb = mode & std::ios_base::binary; - bool testi = mode & std::ios_base::in; - bool testo = mode & std::ios_base::out; - bool testt = mode & std::ios_base::trunc; - bool testa = mode & std::ios_base::app; - - // Check for valid flag combinations - see [27.8.1.3.2] (Table 92) - // Original zfstream hardcoded the compression level to maximum here... - // Double the time for less than 1% size improvement seems - // excessive though - keeping it at the default level - // To change back, just append "9" to the next three mode strings - if (!testi && testo && !testt && !testa) - strcpy(c_mode, "w"); - if (!testi && testo && !testt && testa) - strcpy(c_mode, "a"); - if (!testi && testo && testt && !testa) - strcpy(c_mode, "w"); - if (testi && !testo && !testt && !testa) - strcpy(c_mode, "r"); - // No read/write mode yet -// if (testi && testo && !testt && !testa) -// strcpy(c_mode, "r+"); -// if (testi && testo && testt && !testa) -// strcpy(c_mode, "w+"); - - // Mode string should be empty for invalid combination of flags - if (strlen(c_mode) == 0) - return false; - if (testb) - strcat(c_mode, "b"); - return true; -} - -// Determine number of characters in internal get buffer -std::streamsize -gzfilebuf::showmanyc() -{ - // Calls to underflow will fail if file not opened for reading - if (!this->is_open() || !(io_mode & std::ios_base::in)) - return -1; - // Make sure get area is in use - if (this->gptr() && (this->gptr() < this->egptr())) - return std::streamsize(this->egptr() - this->gptr()); - else - return 0; -} - -// Fill get area from gzipped file -gzfilebuf::int_type -gzfilebuf::underflow() -{ - // If something is left in the get area by chance, return it - // (this shouldn't normally happen, as underflow is only supposed - // to be called when gptr >= egptr, but it serves as error check) - if (this->gptr() && (this->gptr() < this->egptr())) - return traits_type::to_int_type(*(this->gptr())); - - // If the file hasn't been opened for reading, produce error - if (!this->is_open() || !(io_mode & std::ios_base::in)) - return traits_type::eof(); - - // Attempt to fill internal buffer from gzipped file - // (buffer must be guaranteed to exist...) - int bytes_read = gzread(file, buffer, buffer_size); - // Indicates error or EOF - if (bytes_read <= 0) - { - // Reset get area - this->setg(buffer, buffer, buffer); - return traits_type::eof(); - } - // Make all bytes read from file available as get area - this->setg(buffer, buffer, buffer + bytes_read); - - // Return next character in get area - return traits_type::to_int_type(*(this->gptr())); -} - -// Write put area to gzipped file -gzfilebuf::int_type -gzfilebuf::overflow(int_type c) -{ - // Determine whether put area is in use - if (this->pbase()) - { - // Double-check pointer range - if (this->pptr() > this->epptr() || this->pptr() < this->pbase()) - return traits_type::eof(); - // Add extra character to buffer if not EOF - if (!traits_type::eq_int_type(c, traits_type::eof())) - { - *(this->pptr()) = traits_type::to_char_type(c); - this->pbump(1); - } - // Number of characters to write to file - int bytes_to_write = this->pptr() - this->pbase(); - // Overflow doesn't fail if nothing is to be written - if (bytes_to_write > 0) - { - // If the file hasn't been opened for writing, produce error - if (!this->is_open() || !(io_mode & std::ios_base::out)) - return traits_type::eof(); - // If gzipped file won't accept all bytes written to it, fail - if (gzwrite(file, this->pbase(), bytes_to_write) != bytes_to_write) - return traits_type::eof(); - // Reset next pointer to point to pbase on success - this->pbump(-bytes_to_write); - } - } - // Write extra character to file if not EOF - else if (!traits_type::eq_int_type(c, traits_type::eof())) - { - // If the file hasn't been opened for writing, produce error - if (!this->is_open() || !(io_mode & std::ios_base::out)) - return traits_type::eof(); - // Impromptu char buffer (allows "unbuffered" output) - char_type last_char = traits_type::to_char_type(c); - // If gzipped file won't accept this character, fail - if (gzwrite(file, &last_char, 1) != 1) - return traits_type::eof(); - } - - // If you got here, you have succeeded (even if c was EOF) - // The return value should therefore be non-EOF - if (traits_type::eq_int_type(c, traits_type::eof())) - return traits_type::not_eof(c); - else - return c; -} - -// Assign new buffer -std::streambuf* -gzfilebuf::setbuf(char_type* p, - std::streamsize n) -{ - // First make sure stuff is sync'ed, for safety - if (this->sync() == -1) - return NULL; - // If buffering is turned off on purpose via setbuf(0,0), still allocate one... - // "Unbuffered" only really refers to put [27.8.1.4.10], while get needs at - // least a buffer of size 1 (very inefficient though, therefore make it bigger?) - // This follows from [27.5.2.4.3]/12 (gptr needs to point at something, it seems) - if (!p || !n) - { - // Replace existing buffer (if any) with small internal buffer - this->disable_buffer(); - buffer = NULL; - buffer_size = 0; - own_buffer = true; - this->enable_buffer(); - } - else - { - // Replace existing buffer (if any) with external buffer - this->disable_buffer(); - buffer = p; - buffer_size = n; - own_buffer = false; - this->enable_buffer(); - } - return this; -} - -// Write put area to gzipped file (i.e. ensures that put area is empty) -int -gzfilebuf::sync() -{ - return traits_type::eq_int_type(this->overflow(), traits_type::eof()) ? -1 : 0; -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -// Allocate internal buffer -void -gzfilebuf::enable_buffer() -{ - // If internal buffer required, allocate one - if (own_buffer && !buffer) - { - // Check for buffered vs. "unbuffered" - if (buffer_size > 0) - { - // Allocate internal buffer - buffer = new char_type[buffer_size]; - // Get area starts empty and will be expanded by underflow as need arises - this->setg(buffer, buffer, buffer); - // Setup entire internal buffer as put area. - // The one-past-end pointer actually points to the last element of the buffer, - // so that overflow(c) can safely add the extra character c to the sequence. - // These pointers remain in place for the duration of the buffer - this->setp(buffer, buffer + buffer_size - 1); - } - else - { - // Even in "unbuffered" case, (small?) get buffer is still required - buffer_size = SMALLBUFSIZE; - buffer = new char_type[buffer_size]; - this->setg(buffer, buffer, buffer); - // "Unbuffered" means no put buffer - this->setp(0, 0); - } - } - else - { - // If buffer already allocated, reset buffer pointers just to make sure no - // stale chars are lying around - this->setg(buffer, buffer, buffer); - this->setp(buffer, buffer + buffer_size - 1); - } -} - -// Destroy internal buffer -void -gzfilebuf::disable_buffer() -{ - // If internal buffer exists, deallocate it - if (own_buffer && buffer) - { - // Preserve unbuffered status by zeroing size - if (!this->pbase()) - buffer_size = 0; - delete[] buffer; - buffer = NULL; - this->setg(0, 0, 0); - this->setp(0, 0); - } - else - { - // Reset buffer pointers to initial state if external buffer exists - this->setg(buffer, buffer, buffer); - if (buffer) - this->setp(buffer, buffer + buffer_size - 1); - else - this->setp(0, 0); - } -} - -/*****************************************************************************/ - -// Default constructor initializes stream buffer -gzifstream::gzifstream() -: std::istream(NULL), sb() -{ this->init(&sb); } - -// Initialize stream buffer and open file -gzifstream::gzifstream(const char* name, - std::ios_base::openmode mode) -: std::istream(NULL), sb() -{ - this->init(&sb); - this->open(name, mode); -} - -// Initialize stream buffer and attach to file -gzifstream::gzifstream(int fd, - std::ios_base::openmode mode) -: std::istream(NULL), sb() -{ - this->init(&sb); - this->attach(fd, mode); -} - -// Open file and go into fail() state if unsuccessful -void -gzifstream::open(const char* name, - std::ios_base::openmode mode) -{ - if (!sb.open(name, mode | std::ios_base::in)) - this->setstate(std::ios_base::failbit); - else - this->clear(); -} - -// Attach to file and go into fail() state if unsuccessful -void -gzifstream::attach(int fd, - std::ios_base::openmode mode) -{ - if (!sb.attach(fd, mode | std::ios_base::in)) - this->setstate(std::ios_base::failbit); - else - this->clear(); -} - -// Close file -void -gzifstream::close() -{ - if (!sb.close()) - this->setstate(std::ios_base::failbit); -} - -/*****************************************************************************/ - -// Default constructor initializes stream buffer -gzofstream::gzofstream() -: std::ostream(NULL), sb() -{ this->init(&sb); } - -// Initialize stream buffer and open file -gzofstream::gzofstream(const char* name, - std::ios_base::openmode mode) -: std::ostream(NULL), sb() -{ - this->init(&sb); - this->open(name, mode); -} - -// Initialize stream buffer and attach to file -gzofstream::gzofstream(int fd, - std::ios_base::openmode mode) -: std::ostream(NULL), sb() -{ - this->init(&sb); - this->attach(fd, mode); -} - -// Open file and go into fail() state if unsuccessful -void -gzofstream::open(const char* name, - std::ios_base::openmode mode) -{ - if (!sb.open(name, mode | std::ios_base::out)) - this->setstate(std::ios_base::failbit); - else - this->clear(); -} - -// Attach to file and go into fail() state if unsuccessful -void -gzofstream::attach(int fd, - std::ios_base::openmode mode) -{ - if (!sb.attach(fd, mode | std::ios_base::out)) - this->setstate(std::ios_base::failbit); - else - this->clear(); -} - -// Close file -void -gzofstream::close() -{ - if (!sb.close()) - this->setstate(std::ios_base::failbit); -} diff --git a/common/dist/zlib/contrib/masm686/match.asm b/common/dist/zlib/contrib/masm686/match.asm deleted file mode 100644 index 4b03a71ab..000000000 --- a/common/dist/zlib/contrib/masm686/match.asm +++ /dev/null @@ -1,413 +0,0 @@ - -; match.asm -- Pentium-Pro optimized version of longest_match() -; -; Updated for zlib 1.1.3 and converted to MASM 6.1x -; Copyright (C) 2000 Dan Higdon -; and Chuck Walbourn -; Corrections by Cosmin Truta -; -; This is free software; you can redistribute it and/or modify it -; under the terms of the GNU General Public License. - -; Based on match.S -; Written for zlib 1.1.2 -; Copyright (C) 1998 Brian Raiter -; -; Modified by Gilles Vollant (2005) for add gzhead and gzindex - - .686P - .MODEL FLAT - -;=========================================================================== -; EQUATES -;=========================================================================== - -MAX_MATCH EQU 258 -MIN_MATCH EQU 3 -MIN_LOOKAHEAD EQU (MAX_MATCH + MIN_MATCH + 1) -MAX_MATCH_8 EQU ((MAX_MATCH + 7) AND (NOT 7)) - -;=========================================================================== -; STRUCTURES -;=========================================================================== - -; This STRUCT assumes a 4-byte alignment - -DEFLATE_STATE STRUCT -ds_strm dd ? -ds_status dd ? -ds_pending_buf dd ? -ds_pending_buf_size dd ? -ds_pending_out dd ? -ds_pending dd ? -ds_wrap dd ? -; gzhead and gzindex are added in zlib 1.2.2.2 (see deflate.h) -ds_gzhead dd ? -ds_gzindex dd ? -ds_data_type db ? -ds_method db ? - db ? ; padding - db ? ; padding -ds_last_flush dd ? -ds_w_size dd ? ; used -ds_w_bits dd ? -ds_w_mask dd ? ; used -ds_window dd ? ; used -ds_window_size dd ? -ds_prev dd ? ; used -ds_head dd ? -ds_ins_h dd ? -ds_hash_size dd ? -ds_hash_bits dd ? -ds_hash_mask dd ? -ds_hash_shift dd ? -ds_block_start dd ? -ds_match_length dd ? ; used -ds_prev_match dd ? ; used -ds_match_available dd ? -ds_strstart dd ? ; used -ds_match_start dd ? ; used -ds_lookahead dd ? ; used -ds_prev_length dd ? ; used -ds_max_chain_length dd ? ; used -ds_max_laxy_match dd ? -ds_level dd ? -ds_strategy dd ? -ds_good_match dd ? ; used -ds_nice_match dd ? ; used - -; Don't need anymore of the struct for match -DEFLATE_STATE ENDS - -;=========================================================================== -; CODE -;=========================================================================== -_TEXT SEGMENT - -;--------------------------------------------------------------------------- -; match_init -;--------------------------------------------------------------------------- - ALIGN 4 -PUBLIC _match_init -_match_init PROC - ; no initialization needed - ret -_match_init ENDP - -;--------------------------------------------------------------------------- -; uInt longest_match(deflate_state *deflatestate, IPos curmatch) -;--------------------------------------------------------------------------- - ALIGN 4 - -PUBLIC _longest_match -_longest_match PROC - -; Since this code uses EBP for a scratch register, the stack frame must -; be manually constructed and referenced relative to the ESP register. - -; Stack image -; Variables -chainlenwmask = 0 ; high word: current chain len - ; low word: s->wmask -window = 4 ; local copy of s->window -windowbestlen = 8 ; s->window + bestlen -scanend = 12 ; last two bytes of string -scanstart = 16 ; first two bytes of string -scanalign = 20 ; dword-misalignment of string -nicematch = 24 ; a good enough match size -bestlen = 28 ; size of best match so far -scan = 32 ; ptr to string wanting match -varsize = 36 ; number of bytes (also offset to last saved register) - -; Saved Registers (actually pushed into place) -ebx_save = 36 -edi_save = 40 -esi_save = 44 -ebp_save = 48 - -; Parameters -retaddr = 52 -deflatestate = 56 -curmatch = 60 - -; Save registers that the compiler may be using - push ebp - push edi - push esi - push ebx - -; Allocate local variable space - sub esp,varsize - -; Retrieve the function arguments. ecx will hold cur_match -; throughout the entire function. edx will hold the pointer to the -; deflate_state structure during the function's setup (before -; entering the main loop). - - mov edx, [esp+deflatestate] -ASSUME edx:PTR DEFLATE_STATE - - mov ecx, [esp+curmatch] - -; uInt wmask = s->w_mask; -; unsigned chain_length = s->max_chain_length; -; if (s->prev_length >= s->good_match) { -; chain_length >>= 2; -; } - - mov eax, [edx].ds_prev_length - mov ebx, [edx].ds_good_match - cmp eax, ebx - mov eax, [edx].ds_w_mask - mov ebx, [edx].ds_max_chain_length - jl SHORT LastMatchGood - shr ebx, 2 -LastMatchGood: - -; chainlen is decremented once beforehand so that the function can -; use the sign flag instead of the zero flag for the exit test. -; It is then shifted into the high word, to make room for the wmask -; value, which it will always accompany. - - dec ebx - shl ebx, 16 - or ebx, eax - mov [esp+chainlenwmask], ebx - -; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - mov eax, [edx].ds_nice_match - mov ebx, [edx].ds_lookahead - cmp ebx, eax - jl SHORT LookaheadLess - mov ebx, eax -LookaheadLess: - mov [esp+nicematch], ebx - -;/* register Bytef *scan = s->window + s->strstart; */ - - mov esi, [edx].ds_window - mov [esp+window], esi - mov ebp, [edx].ds_strstart - lea edi, [esi+ebp] - mov [esp+scan],edi - -;/* Determine how many bytes the scan ptr is off from being */ -;/* dword-aligned. */ - - mov eax, edi - neg eax - and eax, 3 - mov [esp+scanalign], eax - -;/* IPos limit = s->strstart > (IPos)MAX_DIST(s) ? */ -;/* s->strstart - (IPos)MAX_DIST(s) : NIL; */ - - mov eax, [edx].ds_w_size - sub eax, MIN_LOOKAHEAD - sub ebp, eax - jg SHORT LimitPositive - xor ebp, ebp -LimitPositive: - -;/* int best_len = s->prev_length; */ - - mov eax, [edx].ds_prev_length - mov [esp+bestlen], eax - -;/* Store the sum of s->window + best_len in %esi locally, and in %esi. */ - - add esi, eax - mov [esp+windowbestlen], esi - -;/* register ush scan_start = *(ushf*)scan; */ -;/* register ush scan_end = *(ushf*)(scan+best_len-1); */ -;/* Posf *prev = s->prev; */ - - movzx ebx, WORD PTR[edi] - mov [esp+scanstart], ebx - movzx ebx, WORD PTR[eax+edi-1] - mov [esp+scanend], ebx - mov edi, [edx].ds_prev - -;/* Jump into the main loop. */ - - mov edx, [esp+chainlenwmask] - jmp SHORT LoopEntry - -;/* do { -; * match = s->window + cur_match; -; * if (*(ushf*)(match+best_len-1) != scan_end || -; * *(ushf*)match != scan_start) continue; -; * [...] -; * } while ((cur_match = prev[cur_match & wmask]) > limit -; * && --chain_length != 0); -; * -; * Here is the inner loop of the function. The function will spend the -; * majority of its time in this loop, and majority of that time will -; * be spent in the first ten instructions. -; * -; * Within this loop: -; * %ebx = scanend -; * %ecx = curmatch -; * %edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) -; * %esi = windowbestlen - i.e., (window + bestlen) -; * %edi = prev -; * %ebp = limit -; */ - - ALIGN 4 -LookupLoop: - and ecx, edx - movzx ecx, WORD PTR[edi+ecx*2] - cmp ecx, ebp - jbe LeaveNow - sub edx, 000010000H - js LeaveNow - -LoopEntry: - movzx eax, WORD PTR[esi+ecx-1] - cmp eax, ebx - jnz SHORT LookupLoop - - mov eax, [esp+window] - movzx eax, WORD PTR[eax+ecx] - cmp eax, [esp+scanstart] - jnz SHORT LookupLoop - -;/* Store the current value of chainlen. */ - - mov [esp+chainlenwmask], edx - -;/* Point %edi to the string under scrutiny, and %esi to the string we */ -;/* are hoping to match it up with. In actuality, %esi and %edi are */ -;/* both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and %edx is */ -;/* initialized to -(MAX_MATCH_8 - scanalign). */ - - mov esi, [esp+window] - mov edi, [esp+scan] - add esi, ecx - mov eax, [esp+scanalign] - mov edx, -MAX_MATCH_8 - lea edi, [edi+eax+MAX_MATCH_8] - lea esi, [esi+eax+MAX_MATCH_8] - -;/* Test the strings for equality, 8 bytes at a time. At the end, -; * adjust %edx so that it is offset to the exact byte that mismatched. -; * -; * We already know at this point that the first three bytes of the -; * strings match each other, and they can be safely passed over before -; * starting the compare loop. So what this code does is skip over 0-3 -; * bytes, as much as necessary in order to dword-align the %edi -; * pointer. (%esi will still be misaligned three times out of four.) -; * -; * It should be confessed that this loop usually does not represent -; * much of the total running time. Replacing it with a more -; * straightforward "rep cmpsb" would not drastically degrade -; * performance. -; */ - -LoopCmps: - mov eax, DWORD PTR[esi+edx] - xor eax, DWORD PTR[edi+edx] - jnz SHORT LeaveLoopCmps - - mov eax, DWORD PTR[esi+edx+4] - xor eax, DWORD PTR[edi+edx+4] - jnz SHORT LeaveLoopCmps4 - - add edx, 8 - jnz SHORT LoopCmps - jmp LenMaximum - ALIGN 4 - -LeaveLoopCmps4: - add edx, 4 - -LeaveLoopCmps: - test eax, 00000FFFFH - jnz SHORT LenLower - - add edx, 2 - shr eax, 16 - -LenLower: - sub al, 1 - adc edx, 0 - -;/* Calculate the length of the match. If it is longer than MAX_MATCH, */ -;/* then automatically accept it as the best possible match and leave. */ - - lea eax, [edi+edx] - mov edi, [esp+scan] - sub eax, edi - cmp eax, MAX_MATCH - jge SHORT LenMaximum - -;/* If the length of the match is not longer than the best match we */ -;/* have so far, then forget it and return to the lookup loop. */ - - mov edx, [esp+deflatestate] - mov ebx, [esp+bestlen] - cmp eax, ebx - jg SHORT LongerMatch - mov esi, [esp+windowbestlen] - mov edi, [edx].ds_prev - mov ebx, [esp+scanend] - mov edx, [esp+chainlenwmask] - jmp LookupLoop - ALIGN 4 - -;/* s->match_start = cur_match; */ -;/* best_len = len; */ -;/* if (len >= nice_match) break; */ -;/* scan_end = *(ushf*)(scan+best_len-1); */ - -LongerMatch: - mov ebx, [esp+nicematch] - mov [esp+bestlen], eax - mov [edx].ds_match_start, ecx - cmp eax, ebx - jge SHORT LeaveNow - mov esi, [esp+window] - add esi, eax - mov [esp+windowbestlen], esi - movzx ebx, WORD PTR[edi+eax-1] - mov edi, [edx].ds_prev - mov [esp+scanend], ebx - mov edx, [esp+chainlenwmask] - jmp LookupLoop - ALIGN 4 - -;/* Accept the current string, with the maximum possible length. */ - -LenMaximum: - mov edx, [esp+deflatestate] - mov DWORD PTR[esp+bestlen], MAX_MATCH - mov [edx].ds_match_start, ecx - -;/* if ((uInt)best_len <= s->lookahead) return (uInt)best_len; */ -;/* return s->lookahead; */ - -LeaveNow: - mov edx, [esp+deflatestate] - mov ebx, [esp+bestlen] - mov eax, [edx].ds_lookahead - cmp ebx, eax - jg SHORT LookaheadRet - mov eax, ebx -LookaheadRet: - -; Restore the stack and return from whence we came. - - add esp, varsize - pop ebx - pop esi - pop edi - pop ebp - ret - -_longest_match ENDP - -_TEXT ENDS -END diff --git a/common/dist/zlib/contrib/masmx64/bld_ml64.bat b/common/dist/zlib/contrib/masmx64/bld_ml64.bat deleted file mode 100644 index 8f9343d0a..000000000 --- a/common/dist/zlib/contrib/masmx64/bld_ml64.bat +++ /dev/null @@ -1,2 +0,0 @@ -ml64.exe /Flinffasx64 /c /Zi inffasx64.asm -ml64.exe /Flgvmat64 /c /Zi gvmat64.asm diff --git a/common/dist/zlib/contrib/masmx64/gvmat64.asm b/common/dist/zlib/contrib/masmx64/gvmat64.asm deleted file mode 100644 index 790d65554..000000000 --- a/common/dist/zlib/contrib/masmx64/gvmat64.asm +++ /dev/null @@ -1,513 +0,0 @@ -;uInt longest_match_x64( -; deflate_state *s, -; IPos cur_match); /* current match */ - -; gvmat64.asm -- Asm portion of the optimized longest_match for 32 bits x86 -; Copyright (C) 1995-2005 Jean-loup Gailly, Brian Raiter and Gilles Vollant. -; -; File written by Gilles Vollant, by converting to assembly the longest_match -; from Jean-loup Gailly in deflate.c of zLib and infoZip zip. -; -; and by taking inspiration on asm686 with masm, optimised assembly code -; from Brian Raiter, written 1998 -; -; http://www.zlib.net -; http://www.winimage.com/zLibDll -; http://www.muppetlabs.com/~breadbox/software/assembly.html -; -; to compile this file for infozip Zip, I use option: -; ml64.exe /Flgvmat64 /c /Zi /DINFOZIP gvmat64.asm -; -; to compile this file for zLib, I use option: -; ml64.exe /Flgvmat64 /c /Zi gvmat64.asm -; Be carrefull to adapt zlib1222add below to your version of zLib -; (if you use a version of zLib before 1.0.4 or after 1.2.2.2, change -; value of zlib1222add later) -; -; This file compile with Microsoft Macro Assembler (x64) for AMD64 -; -; ml64.exe is given with Visual Studio 2005 and Windows 2003 server DDK -; -; (you can get Windows 2003 server DDK with ml64 and cl for AMD64 from -; http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price) -; - - -;uInt longest_match(s, cur_match) -; deflate_state *s; -; IPos cur_match; /* current match */ -.code -longest_match PROC - - -;LocalVarsSize equ 88 - LocalVarsSize equ 72 - -; register used : rax,rbx,rcx,rdx,rsi,rdi,r8,r9,r10,r11,r12 -; free register : r14,r15 -; register can be saved : rsp - - chainlenwmask equ rsp + 8 - LocalVarsSize ; high word: current chain len - ; low word: s->wmask -;window equ rsp + xx - LocalVarsSize ; local copy of s->window ; stored in r10 -;windowbestlen equ rsp + xx - LocalVarsSize ; s->window + bestlen , use r10+r11 -;scanstart equ rsp + xx - LocalVarsSize ; first two bytes of string ; stored in r12w -;scanend equ rsp + xx - LocalVarsSize ; last two bytes of string use ebx -;scanalign equ rsp + xx - LocalVarsSize ; dword-misalignment of string r13 -;bestlen equ rsp + xx - LocalVarsSize ; size of best match so far -> r11d -;scan equ rsp + xx - LocalVarsSize ; ptr to string wanting match -> r9 -IFDEF INFOZIP -ELSE - nicematch equ (rsp + 16 - LocalVarsSize) ; a good enough match size -ENDIF - -save_rdi equ rsp + 24 - LocalVarsSize -save_rsi equ rsp + 32 - LocalVarsSize -save_rbx equ rsp + 40 - LocalVarsSize -save_rbp equ rsp + 48 - LocalVarsSize -save_r12 equ rsp + 56 - LocalVarsSize -save_r13 equ rsp + 64 - LocalVarsSize -;save_r14 equ rsp + 72 - LocalVarsSize -;save_r15 equ rsp + 80 - LocalVarsSize - - - -; all the +4 offsets are due to the addition of pending_buf_size (in zlib -; in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, remove the +4). -; Note : these value are good with a 8 bytes boundary pack structure - - - MAX_MATCH equ 258 - MIN_MATCH equ 3 - MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) - - -;;; Offsets for fields in the deflate_state structure. These numbers -;;; are calculated from the definition of deflate_state, with the -;;; assumption that the compiler will dword-align the fields. (Thus, -;;; changing the definition of deflate_state could easily cause this -;;; program to crash horribly, without so much as a warning at -;;; compile time. Sigh.) - -; all the +zlib1222add offsets are due to the addition of fields -; in zlib in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). -; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). -; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - - -IFDEF INFOZIP - -_DATA SEGMENT -COMM window_size:DWORD -; WMask ; 7fff -COMM window:BYTE:010040H -COMM prev:WORD:08000H -; MatchLen : unused -; PrevMatch : unused -COMM strstart:DWORD -COMM match_start:DWORD -; Lookahead : ignore -COMM prev_length:DWORD ; PrevLen -COMM max_chain_length:DWORD -COMM good_match:DWORD -COMM nice_match:DWORD -prev_ad equ OFFSET prev -window_ad equ OFFSET window -nicematch equ nice_match -_DATA ENDS -WMask equ 07fffh - -ELSE - - IFNDEF zlib1222add - zlib1222add equ 8 - ENDIF -dsWSize equ 56+zlib1222add+(zlib1222add/2) -dsWMask equ 64+zlib1222add+(zlib1222add/2) -dsWindow equ 72+zlib1222add -dsPrev equ 88+zlib1222add -dsMatchLen equ 128+zlib1222add -dsPrevMatch equ 132+zlib1222add -dsStrStart equ 140+zlib1222add -dsMatchStart equ 144+zlib1222add -dsLookahead equ 148+zlib1222add -dsPrevLen equ 152+zlib1222add -dsMaxChainLen equ 156+zlib1222add -dsGoodMatch equ 172+zlib1222add -dsNiceMatch equ 176+zlib1222add - -window_size equ [ rcx + dsWSize] -WMask equ [ rcx + dsWMask] -window_ad equ [ rcx + dsWindow] -prev_ad equ [ rcx + dsPrev] -strstart equ [ rcx + dsStrStart] -match_start equ [ rcx + dsMatchStart] -Lookahead equ [ rcx + dsLookahead] ; 0ffffffffh on infozip -prev_length equ [ rcx + dsPrevLen] -max_chain_length equ [ rcx + dsMaxChainLen] -good_match equ [ rcx + dsGoodMatch] -nice_match equ [ rcx + dsNiceMatch] -ENDIF - -; parameter 1 in r8(deflate state s), param 2 in rdx (cur match) - -; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and -; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp -; -; All registers must be preserved across the call, except for -; rax, rcx, rdx, r8, r9, r10, and r11, which are scratch. - - - -;;; Save registers that the compiler may be using, and adjust esp to -;;; make room for our stack frame. - - -;;; Retrieve the function arguments. r8d will hold cur_match -;;; throughout the entire function. edx will hold the pointer to the -;;; deflate_state structure during the function's setup (before -;;; entering the main loop. - -; parameter 1 in rcx (deflate_state* s), param 2 in edx -> r8 (cur match) - -; this clear high 32 bits of r8, which can be garbage in both r8 and rdx - - mov [save_rdi],rdi - mov [save_rsi],rsi - mov [save_rbx],rbx - mov [save_rbp],rbp -IFDEF INFOZIP - mov r8d,ecx -ELSE - mov r8d,edx -ENDIF - mov [save_r12],r12 - mov [save_r13],r13 -; mov [save_r14],r14 -; mov [save_r15],r15 - - -;;; uInt wmask = s->w_mask; -;;; unsigned chain_length = s->max_chain_length; -;;; if (s->prev_length >= s->good_match) { -;;; chain_length >>= 2; -;;; } - - mov edi, prev_length - mov esi, good_match - mov eax, WMask - mov ebx, max_chain_length - cmp edi, esi - jl LastMatchGood - shr ebx, 2 -LastMatchGood: - -;;; chainlen is decremented once beforehand so that the function can -;;; use the sign flag instead of the zero flag for the exit test. -;;; It is then shifted into the high word, to make room for the wmask -;;; value, which it will always accompany. - - dec ebx - shl ebx, 16 - or ebx, eax - -;;; on zlib only -;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - -IFDEF INFOZIP - mov [chainlenwmask], ebx -; on infozip nice_match = [nice_match] -ELSE - mov eax, nice_match - mov [chainlenwmask], ebx - mov r10d, Lookahead - cmp r10d, eax - cmovnl r10d, eax - mov [nicematch],r10d -ENDIF - -;;; register Bytef *scan = s->window + s->strstart; - mov r10, window_ad - mov ebp, strstart - lea r13, [r10 + rbp] - -;;; Determine how many bytes the scan ptr is off from being -;;; dword-aligned. - - mov r9,r13 - neg r13 - and r13,3 - -;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -;;; s->strstart - (IPos)MAX_DIST(s) : NIL; -IFDEF INFOZIP - mov eax,07efah ; MAX_DIST = (WSIZE-MIN_LOOKAHEAD) (0x8000-(3+8+1)) -ELSE - mov eax, window_size - sub eax, MIN_LOOKAHEAD -ENDIF - xor edi,edi - sub ebp, eax - - mov r11d, prev_length - - cmovng ebp,edi - -;;; int best_len = s->prev_length; - - -;;; Store the sum of s->window + best_len in esi locally, and in esi. - - lea rsi,[r10+r11] - -;;; register ush scan_start = *(ushf*)scan; -;;; register ush scan_end = *(ushf*)(scan+best_len-1); -;;; Posf *prev = s->prev; - - movzx r12d,word ptr [r9] - movzx ebx, word ptr [r9 + r11 - 1] - - mov rdi, prev_ad - -;;; Jump into the main loop. - - mov edx, [chainlenwmask] - - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop1: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry1: - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop2: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry2: - cmp bx,word ptr [rsi + r8 - 1] - jz LookupLoopIsZero - -LookupLoop4: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry4: - - cmp bx,word ptr [rsi + r8 - 1] - jnz LookupLoop1 - jmp LookupLoopIsZero - - -;;; do { -;;; match = s->window + cur_match; -;;; if (*(ushf*)(match+best_len-1) != scan_end || -;;; *(ushf*)match != scan_start) continue; -;;; [...] -;;; } while ((cur_match = prev[cur_match & wmask]) > limit -;;; && --chain_length != 0); -;;; -;;; Here is the inner loop of the function. The function will spend the -;;; majority of its time in this loop, and majority of that time will -;;; be spent in the first ten instructions. -;;; -;;; Within this loop: -;;; ebx = scanend -;;; r8d = curmatch -;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) -;;; esi = windowbestlen - i.e., (window + bestlen) -;;; edi = prev -;;; ebp = limit - -LookupLoop: - and r8d, edx - - movzx r8d, word ptr [rdi + r8*2] - cmp r8d, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow - -LoopEntry: - - cmp bx,word ptr [rsi + r8 - 1] - jnz LookupLoop1 -LookupLoopIsZero: - cmp r12w, word ptr [r10 + r8] - jnz LookupLoop1 - - -;;; Store the current value of chainlen. - mov [chainlenwmask], edx - -;;; Point edi to the string under scrutiny, and esi to the string we -;;; are hoping to match it up with. In actuality, esi and edi are -;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is -;;; initialized to -(MAX_MATCH_8 - scanalign). - - lea rsi,[r8+r10] - mov rdx, 0fffffffffffffef8h; -(MAX_MATCH_8) - lea rsi, [rsi + r13 + 0108h] ;MAX_MATCH_8] - lea rdi, [r9 + r13 + 0108h] ;MAX_MATCH_8] - - prefetcht1 [rsi+rdx] - prefetcht1 [rdi+rdx] - - -;;; Test the strings for equality, 8 bytes at a time. At the end, -;;; adjust rdx so that it is offset to the exact byte that mismatched. -;;; -;;; We already know at this point that the first three bytes of the -;;; strings match each other, and they can be safely passed over before -;;; starting the compare loop. So what this code does is skip over 0-3 -;;; bytes, as much as necessary in order to dword-align the edi -;;; pointer. (rsi will still be misaligned three times out of four.) -;;; -;;; It should be confessed that this loop usually does not represent -;;; much of the total running time. Replacing it with a more -;;; straightforward "rep cmpsb" would not drastically degrade -;;; performance. - - -LoopCmps: - mov rax, [rsi + rdx] - xor rax, [rdi + rdx] - jnz LeaveLoopCmps - - mov rax, [rsi + rdx + 8] - xor rax, [rdi + rdx + 8] - jnz LeaveLoopCmps8 - - - mov rax, [rsi + rdx + 8+8] - xor rax, [rdi + rdx + 8+8] - jnz LeaveLoopCmps16 - - add rdx,8+8+8 - - jmp short LoopCmps -LeaveLoopCmps16: add rdx,8 -LeaveLoopCmps8: add rdx,8 -LeaveLoopCmps: - - test eax, 0000FFFFh - jnz LenLower - - test eax,0ffffffffh - - jnz LenLower32 - - add rdx,4 - shr rax,32 - or ax,ax - jnz LenLower - -LenLower32: - shr eax,16 - add rdx,2 -LenLower: sub al, 1 - adc rdx, 0 -;;; Calculate the length of the match. If it is longer than MAX_MATCH, -;;; then automatically accept it as the best possible match and leave. - - lea rax, [rdi + rdx] - sub rax, r9 - cmp eax, MAX_MATCH - jge LenMaximum - -;;; If the length of the match is not longer than the best match we -;;; have so far, then forget it and return to the lookup loop. -;/////////////////////////////////// - - cmp eax, r11d - jg LongerMatch - - lea rsi,[r10+r11] - - mov rdi, prev_ad - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; s->match_start = cur_match; -;;; best_len = len; -;;; if (len >= nice_match) break; -;;; scan_end = *(ushf*)(scan+best_len-1); - -LongerMatch: - mov r11d, eax - mov match_start, r8d - cmp eax, [nicematch] - jge LeaveNow - - lea rsi,[r10+rax] - - movzx ebx, word ptr [r9 + rax - 1] - mov rdi, prev_ad - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; Accept the current string, with the maximum possible length. - -LenMaximum: - mov r11d,MAX_MATCH - mov match_start, r8d - -;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; -;;; return s->lookahead; - -LeaveNow: -IFDEF INFOZIP - mov eax,r11d -ELSE - mov eax, Lookahead - cmp r11d, eax - cmovng eax, r11d -ENDIF - -;;; Restore the stack and return from whence we came. - - - mov rsi,[save_rsi] - mov rdi,[save_rdi] - mov rbx,[save_rbx] - mov rbp,[save_rbp] - mov r12,[save_r12] - mov r13,[save_r13] -; mov r14,[save_r14] -; mov r15,[save_r15] - - - ret 0 -; please don't remove this string ! -; Your can freely use gvmat64 in any free or commercial app -; but it is far better don't remove the string in the binary! - db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998, converted to amd 64 by Gilles Vollant 2005",0dh,0ah,0 -longest_match ENDP - -match_init PROC - ret 0 -match_init ENDP - - -END diff --git a/common/dist/zlib/contrib/masmx64/inffasx64.asm b/common/dist/zlib/contrib/masmx64/inffasx64.asm deleted file mode 100644 index b5d93a272..000000000 --- a/common/dist/zlib/contrib/masmx64/inffasx64.asm +++ /dev/null @@ -1,392 +0,0 @@ -; inffasx64.asm is a hand tuned assembler version of inffast.c - fast decoding -; version for AMD64 on Windows using Microsoft C compiler -; -; inffasx64.asm is automatically convert from AMD64 portion of inffas86.c -; inffasx64.asm is called by inffas8664.c, which contain more info. - - -; to compile this file, I use option -; ml64.exe /Flinffasx64 /c /Zi inffasx64.asm -; with Microsoft Macro Assembler (x64) for AMD64 -; -; ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK -; -; (you can get Windows 2003 server DDK with ml64 and cl.exe for AMD64 from -; http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price) -; - -.code -inffas8664fnc PROC - -; see http://weblogs.asp.net/oldnewthing/archive/2004/01/14/58579.aspx and -; http://msdn.microsoft.com/library/en-us/kmarch/hh/kmarch/64bitAMD_8e951dd2-ee77-4728-8702-55ce4b5dd24a.xml.asp -; -; All registers must be preserved across the call, except for -; rax, rcx, rdx, r8, r-9, r10, and r11, which are scratch. - - - mov [rsp-8],rsi - mov [rsp-16],rdi - mov [rsp-24],r12 - mov [rsp-32],r13 - mov [rsp-40],r14 - mov [rsp-48],r15 - mov [rsp-56],rbx - - mov rax,rcx - - mov [rax+8], rbp ; /* save regs rbp and rsp */ - mov [rax], rsp - - mov rsp, rax ; /* make rsp point to &ar */ - - mov rsi, [rsp+16] ; /* rsi = in */ - mov rdi, [rsp+32] ; /* rdi = out */ - mov r9, [rsp+24] ; /* r9 = last */ - mov r10, [rsp+48] ; /* r10 = end */ - mov rbp, [rsp+64] ; /* rbp = lcode */ - mov r11, [rsp+72] ; /* r11 = dcode */ - mov rdx, [rsp+80] ; /* rdx = hold */ - mov ebx, [rsp+88] ; /* ebx = bits */ - mov r12d, [rsp+100] ; /* r12d = lmask */ - mov r13d, [rsp+104] ; /* r13d = dmask */ - ; /* r14d = len */ - ; /* r15d = dist */ - - - cld - cmp r10, rdi - je L_one_time ; /* if only one decode left */ - cmp r9, rsi - - jne L_do_loop - - -L_one_time: - mov r8, r12 ; /* r8 = lmask */ - cmp bl, 32 - ja L_get_length_code_one_time - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - jmp L_get_length_code_one_time - -ALIGN 4 -L_while_test: - cmp r10, rdi - jbe L_break_loop - cmp r9, rsi - jbe L_break_loop - -L_do_loop: - mov r8, r12 ; /* r8 = lmask */ - cmp bl, 32 - ja L_get_length_code ; /* if (32 < bits) */ - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - -L_get_length_code: - and r8, rdx ; /* r8 &= hold */ - mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */ - - mov cl, ah ; /* cl = this.bits */ - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - - test al, al - jnz L_test_for_length_base ; /* if (op != 0) 45.7% */ - - mov r8, r12 ; /* r8 = lmask */ - shr eax, 16 ; /* output this.val char */ - stosb - -L_get_length_code_one_time: - and r8, rdx ; /* r8 &= hold */ - mov eax, [rbp+r8*4] ; /* eax = lcode[hold & lmask] */ - -L_dolen: - mov cl, ah ; /* cl = this.bits */ - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - - test al, al - jnz L_test_for_length_base ; /* if (op != 0) 45.7% */ - - shr eax, 16 ; /* output this.val char */ - stosb - jmp L_while_test - -ALIGN 4 -L_test_for_length_base: - mov r14d, eax ; /* len = this */ - shr r14d, 16 ; /* len = this.val */ - mov cl, al - - test al, 16 - jz L_test_for_second_level_length ; /* if ((op & 16) == 0) 8% */ - and cl, 15 ; /* op &= 15 */ - jz L_decode_distance ; /* if (!op) */ - -L_add_bits_to_len: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - shr rdx, cl - add r14d, eax ; /* len += hold & mask[op] */ - -L_decode_distance: - mov r8, r13 ; /* r8 = dmask */ - cmp bl, 32 - ja L_get_distance_code ; /* if (32 < bits) */ - - lodsd ; /* eax = *(uint *)in++ */ - mov cl, bl ; /* cl = bits, needs it for shifting */ - add bl, 32 ; /* bits += 32 */ - shl rax, cl - or rdx, rax ; /* hold |= *((uint *)in)++ << bits */ - -L_get_distance_code: - and r8, rdx ; /* r8 &= hold */ - mov eax, [r11+r8*4] ; /* eax = dcode[hold & dmask] */ - -L_dodist: - mov r15d, eax ; /* dist = this */ - shr r15d, 16 ; /* dist = this.val */ - mov cl, ah - sub bl, ah ; /* bits -= this.bits */ - shr rdx, cl ; /* hold >>= this.bits */ - mov cl, al ; /* cl = this.op */ - - test al, 16 ; /* if ((op & 16) == 0) */ - jz L_test_for_second_level_dist - and cl, 15 ; /* op &= 15 */ - jz L_check_dist_one - -L_add_bits_to_dist: - sub bl, cl - xor eax, eax - inc eax - shl eax, cl - dec eax ; /* (1 << op) - 1 */ - and eax, edx ; /* eax &= hold */ - shr rdx, cl - add r15d, eax ; /* dist += hold & ((1 << op) - 1) */ - -L_check_window: - mov r8, rsi ; /* save in so from can use it's reg */ - mov rax, rdi - sub rax, [rsp+40] ; /* nbytes = out - beg */ - - cmp eax, r15d - jb L_clip_window ; /* if (dist > nbytes) 4.2% */ - - mov ecx, r14d ; /* ecx = len */ - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - - sar ecx, 1 - jnc L_copy_two ; /* if len % 2 == 0 */ - - rep movsw - mov al, [rsi] - mov [rdi], al - inc rdi - - mov rsi, r8 ; /* move in back to %rsi, toss from */ - jmp L_while_test - -L_copy_two: - rep movsw - mov rsi, r8 ; /* move in back to %rsi, toss from */ - jmp L_while_test - -ALIGN 4 -L_check_dist_one: - cmp r15d, 1 ; /* if dist 1, is a memset */ - jne L_check_window - cmp [rsp+40], rdi ; /* if out == beg, outside window */ - je L_check_window - - mov ecx, r14d ; /* ecx = len */ - mov al, [rdi-1] - mov ah, al - - sar ecx, 1 - jnc L_set_two - mov [rdi], al - inc rdi - -L_set_two: - rep stosw - jmp L_while_test - -ALIGN 4 -L_test_for_second_level_length: - test al, 64 - jnz L_test_for_end_of_block ; /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - add eax, r14d ; /* eax += len */ - mov eax, [rbp+rax*4] ; /* eax = lcode[val+(hold&mask[op])]*/ - jmp L_dolen - -ALIGN 4 -L_test_for_second_level_dist: - test al, 64 - jnz L_invalid_distance_code ; /* if ((op & 64) != 0) */ - - xor eax, eax - inc eax - shl eax, cl - dec eax - and eax, edx ; /* eax &= hold */ - add eax, r15d ; /* eax += dist */ - mov eax, [r11+rax*4] ; /* eax = dcode[val+(hold&mask[op])]*/ - jmp L_dodist - -ALIGN 4 -L_clip_window: - mov ecx, eax ; /* ecx = nbytes */ - mov eax, [rsp+92] ; /* eax = wsize, prepare for dist cmp */ - neg ecx ; /* nbytes = -nbytes */ - - cmp eax, r15d - jb L_invalid_distance_too_far ; /* if (dist > wsize) */ - - add ecx, r15d ; /* nbytes = dist - nbytes */ - cmp dword ptr [rsp+96], 0 - jne L_wrap_around_window ; /* if (write != 0) */ - - mov rsi, [rsp+56] ; /* from = window */ - sub eax, ecx ; /* eax -= nbytes */ - add rsi, rax ; /* from += wsize - nbytes */ - - mov eax, r14d ; /* eax = len */ - cmp r14d, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* eax -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = &out[ -dist ] */ - jmp L_do_copy - -ALIGN 4 -L_wrap_around_window: - mov eax, [rsp+96] ; /* eax = write */ - cmp ecx, eax - jbe L_contiguous_in_window ; /* if (write >= nbytes) */ - - mov esi, [rsp+92] ; /* from = wsize */ - add rsi, [rsp+56] ; /* from += window */ - add rsi, rax ; /* from += write */ - sub rsi, rcx ; /* from -= nbytes */ - sub ecx, eax ; /* nbytes -= write */ - - mov eax, r14d ; /* eax = len */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, [rsp+56] ; /* from = window */ - mov ecx, [rsp+96] ; /* nbytes = write */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - jmp L_do_copy - -ALIGN 4 -L_contiguous_in_window: - mov rsi, [rsp+56] ; /* rsi = window */ - add rsi, rax - sub rsi, rcx ; /* from += write - nbytes */ - - mov eax, r14d ; /* eax = len */ - cmp eax, ecx - jbe L_do_copy ; /* if (nbytes >= len) */ - - sub eax, ecx ; /* len -= nbytes */ - rep movsb - mov rsi, rdi - sub rsi, r15 ; /* from = out - dist */ - jmp L_do_copy ; /* if (nbytes >= len) */ - -ALIGN 4 -L_do_copy: - mov ecx, eax ; /* ecx = len */ - rep movsb - - mov rsi, r8 ; /* move in back to %esi, toss from */ - jmp L_while_test - -L_test_for_end_of_block: - test al, 32 - jz L_invalid_literal_length_code - mov dword ptr [rsp+116], 1 - jmp L_break_loop_with_status - -L_invalid_literal_length_code: - mov dword ptr [rsp+116], 2 - jmp L_break_loop_with_status - -L_invalid_distance_code: - mov dword ptr [rsp+116], 3 - jmp L_break_loop_with_status - -L_invalid_distance_too_far: - mov dword ptr [rsp+116], 4 - jmp L_break_loop_with_status - -L_break_loop: - mov dword ptr [rsp+116], 0 - -L_break_loop_with_status: -; /* put in, out, bits, and hold back into ar and pop esp */ - mov [rsp+16], rsi ; /* in */ - mov [rsp+32], rdi ; /* out */ - mov [rsp+88], ebx ; /* bits */ - mov [rsp+80], rdx ; /* hold */ - - mov rax, [rsp] ; /* restore rbp and rsp */ - mov rbp, [rsp+8] - mov rsp, rax - - - - mov rsi,[rsp-8] - mov rdi,[rsp-16] - mov r12,[rsp-24] - mov r13,[rsp-32] - mov r14,[rsp-40] - mov r15,[rsp-48] - mov rbx,[rsp-56] - - ret 0 -; : -; : "m" (ar) -; : "memory", "%rax", "%rbx", "%rcx", "%rdx", "%rsi", "%rdi", -; "%r8", "%r9", "%r10", "%r11", "%r12", "%r13", "%r14", "%r15" -; ); - -inffas8664fnc ENDP -;_TEXT ENDS -END diff --git a/common/dist/zlib/contrib/masmx64/readme.txt b/common/dist/zlib/contrib/masmx64/readme.txt deleted file mode 100644 index ee03115c5..000000000 --- a/common/dist/zlib/contrib/masmx64/readme.txt +++ /dev/null @@ -1,28 +0,0 @@ -Summary -------- -This directory contains ASM implementations of the functions -longest_match() and inflate_fast(), for 64 bits x86 (both AMD64 and Intel EM64t), -for use with Microsoft Macro Assembler (x64) for AMD64 and Microsoft C++ 64 bits. - -gvmat64.asm is written by Gilles Vollant (2005), by using Brian Raiter 686/32 bits - assembly optimized version from Jean-loup Gailly original longest_match function - -inffasx64.asm and inffas8664.c were written by Chris Anderson, by optimizing - original function from Mark Adler - -Use instructions ----------------- -Copy these files into the zlib source directory. - -define ASMV and ASMINF in your project. Include inffas8664.c in your source tree, -and inffasx64.obj and gvmat64.obj as object to link. - - -Build instructions ------------------- -run bld_64.bat with Microsoft Macro Assembler (x64) for AMD64 (ml64.exe) - -ml64.exe is given with Visual Studio 2005, Windows 2003 server DDK - -You can get Windows 2003 server DDK with ml64 and cl for AMD64 from - http://www.microsoft.com/whdc/devtools/ddk/default.mspx for low price) diff --git a/common/dist/zlib/contrib/masmx86/bld_ml32.bat b/common/dist/zlib/contrib/masmx86/bld_ml32.bat deleted file mode 100644 index 99144d07a..000000000 --- a/common/dist/zlib/contrib/masmx86/bld_ml32.bat +++ /dev/null @@ -1,2 +0,0 @@ -ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm -ml /coff /Zi /c /Flinffas32.lst inffas32.asm diff --git a/common/dist/zlib/contrib/masmx86/gvmat32.asm b/common/dist/zlib/contrib/masmx86/gvmat32.asm deleted file mode 100644 index 874bb2d48..000000000 --- a/common/dist/zlib/contrib/masmx86/gvmat32.asm +++ /dev/null @@ -1,972 +0,0 @@ -; gvmat32.asm -- Asm portion of the optimized longest_match for 32 bits x86 -; Copyright (C) 1995-1996 Jean-loup Gailly and Gilles Vollant. -; File written by Gilles Vollant, by modifiying the longest_match -; from Jean-loup Gailly in deflate.c -; -; http://www.zlib.net -; http://www.winimage.com/zLibDll -; http://www.muppetlabs.com/~breadbox/software/assembly.html -; -; For Visual C++ 4.x and higher and ML 6.x and higher -; ml.exe is in directory \MASM611C of Win95 DDK -; ml.exe is also distributed in http://www.masm32.com/masmdl.htm -; and in VC++2003 toolkit at http://msdn.microsoft.com/visualc/vctoolkit2003/ -; -; this file contain two implementation of longest_match -; -; longest_match_7fff : written 1996 by Gilles Vollant optimized for -; first Pentium. Assume s->w_mask == 0x7fff -; longest_match_686 : written by Brian raiter (1998), optimized for Pentium Pro -; -; for using an seembly version of longest_match, you need define ASMV in project -; There is two way in using gvmat32.asm -; -; A) Suggested method -; if you want include both longest_match_7fff and longest_match_686 -; compile the asm file running -; ml /coff /Zi /Flgvmat32.lst /c gvmat32.asm -; and include gvmat32c.c in your project -; if you have an old cpu (386,486 or first Pentium) and s->w_mask==0x7fff, -; longest_match_7fff will be used -; if you have a more modern CPU (Pentium Pro, II and higher) -; longest_match_686 will be used -; on old cpu with s->w_mask!=0x7fff, longest_match_686 will be used, -; but this is not a sitation you'll find often -; -; B) Alternative -; if you are not interresed in old cpu performance and want the smaller -; binaries possible -; -; compile the asm file running -; ml /coff /Zi /c /Flgvmat32.lst /DNOOLDPENTIUMCODE gvmat32.asm -; and do not include gvmat32c.c in your project (ou define also -; NOOLDPENTIUMCODE) -; -; note : as I known, longest_match_686 is very faster than longest_match_7fff -; on pentium Pro/II/III, faster (but less) in P4, but it seem -; longest_match_7fff can be faster (very very litte) on AMD Athlon64/K8 -; -; see below : zlib1222add must be adjuster if you use a zlib version < 1.2.2.2 - -;uInt longest_match_7fff(s, cur_match) -; deflate_state *s; -; IPos cur_match; /* current match */ - - NbStack equ 76 - cur_match equ dword ptr[esp+NbStack-0] - str_s equ dword ptr[esp+NbStack-4] -; 5 dword on top (ret,ebp,esi,edi,ebx) - adrret equ dword ptr[esp+NbStack-8] - pushebp equ dword ptr[esp+NbStack-12] - pushedi equ dword ptr[esp+NbStack-16] - pushesi equ dword ptr[esp+NbStack-20] - pushebx equ dword ptr[esp+NbStack-24] - - chain_length equ dword ptr [esp+NbStack-28] - limit equ dword ptr [esp+NbStack-32] - best_len equ dword ptr [esp+NbStack-36] - window equ dword ptr [esp+NbStack-40] - prev equ dword ptr [esp+NbStack-44] - scan_start equ word ptr [esp+NbStack-48] - wmask equ dword ptr [esp+NbStack-52] - match_start_ptr equ dword ptr [esp+NbStack-56] - nice_match equ dword ptr [esp+NbStack-60] - scan equ dword ptr [esp+NbStack-64] - - windowlen equ dword ptr [esp+NbStack-68] - match_start equ dword ptr [esp+NbStack-72] - strend equ dword ptr [esp+NbStack-76] - NbStackAdd equ (NbStack-24) - - .386p - - name gvmatch - .MODEL FLAT - - - -; all the +zlib1222add offsets are due to the addition of fields -; in zlib in the deflate_state structure since the asm code was first written -; (if you compile with zlib 1.0.4 or older, use "zlib1222add equ (-4)"). -; (if you compile with zlib between 1.0.5 and 1.2.2.1, use "zlib1222add equ 0"). -; if you compile with zlib 1.2.2.2 or later , use "zlib1222add equ 8"). - - zlib1222add equ 8 - -; Note : these value are good with a 8 bytes boundary pack structure - dep_chain_length equ 74h+zlib1222add - dep_window equ 30h+zlib1222add - dep_strstart equ 64h+zlib1222add - dep_prev_length equ 70h+zlib1222add - dep_nice_match equ 88h+zlib1222add - dep_w_size equ 24h+zlib1222add - dep_prev equ 38h+zlib1222add - dep_w_mask equ 2ch+zlib1222add - dep_good_match equ 84h+zlib1222add - dep_match_start equ 68h+zlib1222add - dep_lookahead equ 6ch+zlib1222add - - -_TEXT segment - -IFDEF NOUNDERLINE - IFDEF NOOLDPENTIUMCODE - public longest_match - public match_init - ELSE - public longest_match_7fff - public cpudetect32 - public longest_match_686 - ENDIF -ELSE - IFDEF NOOLDPENTIUMCODE - public _longest_match - public _match_init - ELSE - public _longest_match_7fff - public _cpudetect32 - public _longest_match_686 - ENDIF -ENDIF - - MAX_MATCH equ 258 - MIN_MATCH equ 3 - MIN_LOOKAHEAD equ (MAX_MATCH+MIN_MATCH+1) - - - -IFNDEF NOOLDPENTIUMCODE -IFDEF NOUNDERLINE -longest_match_7fff proc near -ELSE -_longest_match_7fff proc near -ENDIF - - mov edx,[esp+4] - - - - push ebp - push edi - push esi - push ebx - - sub esp,NbStackAdd - -; initialize or check the variables used in match.asm. - mov ebp,edx - -; chain_length = s->max_chain_length -; if (prev_length>=good_match) chain_length >>= 2 - mov edx,[ebp+dep_chain_length] - mov ebx,[ebp+dep_prev_length] - cmp [ebp+dep_good_match],ebx - ja noshr - shr edx,2 -noshr: -; we increment chain_length because in the asm, the --chain_lenght is in the beginning of the loop - inc edx - mov edi,[ebp+dep_nice_match] - mov chain_length,edx - mov eax,[ebp+dep_lookahead] - cmp eax,edi -; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - jae nolookaheadnicematch - mov edi,eax -nolookaheadnicematch: -; best_len = s->prev_length - mov best_len,ebx - -; window = s->window - mov esi,[ebp+dep_window] - mov ecx,[ebp+dep_strstart] - mov window,esi - - mov nice_match,edi -; scan = window + strstart - add esi,ecx - mov scan,esi -; dx = *window - mov dx,word ptr [esi] -; bx = *(window+best_len-1) - mov bx,word ptr [esi+ebx-1] - add esi,MAX_MATCH-1 -; scan_start = *scan - mov scan_start,dx -; strend = scan + MAX_MATCH-1 - mov strend,esi -; bx = scan_end = *(window+best_len-1) - -; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -; s->strstart - (IPos)MAX_DIST(s) : NIL; - - mov esi,[ebp+dep_w_size] - sub esi,MIN_LOOKAHEAD -; here esi = MAX_DIST(s) - sub ecx,esi - ja nodist - xor ecx,ecx -nodist: - mov limit,ecx - -; prev = s->prev - mov edx,[ebp+dep_prev] - mov prev,edx - -; - mov edx,dword ptr [ebp+dep_match_start] - mov bp,scan_start - mov eax,cur_match - mov match_start,edx - - mov edx,window - mov edi,edx - add edi,best_len - mov esi,prev - dec edi -; windowlen = window + best_len -1 - mov windowlen,edi - - jmp beginloop2 - align 4 - -; here, in the loop -; eax = ax = cur_match -; ecx = limit -; bx = scan_end -; bp = scan_start -; edi = windowlen (window + best_len -1) -; esi = prev - - -;// here; chain_length <=16 -normalbeg0add16: - add chain_length,16 - jz exitloop -normalbeg0: - cmp word ptr[edi+eax],bx - je normalbeg2noroll -rcontlabnoroll: -; cur_match = prev[cur_match & wmask] - and eax,7fffh - mov ax,word ptr[esi+eax*2] -; if cur_match > limit, go to exitloop - cmp ecx,eax - jnb exitloop -; if --chain_length != 0, go to exitloop - dec chain_length - jnz normalbeg0 - jmp exitloop - -normalbeg2noroll: -; if (scan_start==*(cur_match+window)) goto normalbeg2 - cmp bp,word ptr[edx+eax] - jne rcontlabnoroll - jmp normalbeg2 - -contloop3: - mov edi,windowlen - -; cur_match = prev[cur_match & wmask] - and eax,7fffh - mov ax,word ptr[esi+eax*2] -; if cur_match > limit, go to exitloop - cmp ecx,eax -jnbexitloopshort1: - jnb exitloop -; if --chain_length != 0, go to exitloop - - -; begin the main loop -beginloop2: - sub chain_length,16+1 -; if chain_length <=16, don't use the unrolled loop - jna normalbeg0add16 - -do16: - cmp word ptr[edi+eax],bx - je normalbeg2dc0 - -maccn MACRO lab - and eax,7fffh - mov ax,word ptr[esi+eax*2] - cmp ecx,eax - jnb exitloop - cmp word ptr[edi+eax],bx - je lab - ENDM - -rcontloop0: - maccn normalbeg2dc1 - -rcontloop1: - maccn normalbeg2dc2 - -rcontloop2: - maccn normalbeg2dc3 - -rcontloop3: - maccn normalbeg2dc4 - -rcontloop4: - maccn normalbeg2dc5 - -rcontloop5: - maccn normalbeg2dc6 - -rcontloop6: - maccn normalbeg2dc7 - -rcontloop7: - maccn normalbeg2dc8 - -rcontloop8: - maccn normalbeg2dc9 - -rcontloop9: - maccn normalbeg2dc10 - -rcontloop10: - maccn short normalbeg2dc11 - -rcontloop11: - maccn short normalbeg2dc12 - -rcontloop12: - maccn short normalbeg2dc13 - -rcontloop13: - maccn short normalbeg2dc14 - -rcontloop14: - maccn short normalbeg2dc15 - -rcontloop15: - and eax,7fffh - mov ax,word ptr[esi+eax*2] - cmp ecx,eax - jnb exitloop - - sub chain_length,16 - ja do16 - jmp normalbeg0add16 - -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -normbeg MACRO rcontlab,valsub -; if we are here, we know that *(match+best_len-1) == scan_end - cmp bp,word ptr[edx+eax] -; if (match != scan_start) goto rcontlab - jne rcontlab -; calculate the good chain_length, and we'll compare scan and match string - add chain_length,16-valsub - jmp iseq - ENDM - - -normalbeg2dc11: - normbeg rcontloop11,11 - -normalbeg2dc12: - normbeg short rcontloop12,12 - -normalbeg2dc13: - normbeg short rcontloop13,13 - -normalbeg2dc14: - normbeg short rcontloop14,14 - -normalbeg2dc15: - normbeg short rcontloop15,15 - -normalbeg2dc10: - normbeg rcontloop10,10 - -normalbeg2dc9: - normbeg rcontloop9,9 - -normalbeg2dc8: - normbeg rcontloop8,8 - -normalbeg2dc7: - normbeg rcontloop7,7 - -normalbeg2dc6: - normbeg rcontloop6,6 - -normalbeg2dc5: - normbeg rcontloop5,5 - -normalbeg2dc4: - normbeg rcontloop4,4 - -normalbeg2dc3: - normbeg rcontloop3,3 - -normalbeg2dc2: - normbeg rcontloop2,2 - -normalbeg2dc1: - normbeg rcontloop1,1 - -normalbeg2dc0: - normbeg rcontloop0,0 - - -; we go in normalbeg2 because *(ushf*)(match+best_len-1) == scan_end - -normalbeg2: - mov edi,window - - cmp bp,word ptr[edi+eax] - jne contloop3 ; if *(ushf*)match != scan_start, continue - -iseq: -; if we are here, we know that *(match+best_len-1) == scan_end -; and (match == scan_start) - - mov edi,edx - mov esi,scan ; esi = scan - add edi,eax ; edi = window + cur_match = match - - mov edx,[esi+3] ; compare manually dword at match+3 - xor edx,[edi+3] ; and scan +3 - - jz begincompare ; if equal, go to long compare - -; we will determine the unmatch byte and calculate len (in esi) - or dl,dl - je eq1rr - mov esi,3 - jmp trfinval -eq1rr: - or dx,dx - je eq1 - - mov esi,4 - jmp trfinval -eq1: - and edx,0ffffffh - jz eq11 - mov esi,5 - jmp trfinval -eq11: - mov esi,6 - jmp trfinval - -begincompare: - ; here we now scan and match begin same - add edi,6 - add esi,6 - mov ecx,(MAX_MATCH-(2+4))/4 ; scan for at most MAX_MATCH bytes - repe cmpsd ; loop until mismatch - - je trfin ; go to trfin if not unmatch -; we determine the unmatch byte - sub esi,4 - mov edx,[edi-4] - xor edx,[esi] - - or dl,dl - jnz trfin - inc esi - - or dx,dx - jnz trfin - inc esi - - and edx,0ffffffh - jnz trfin - inc esi - -trfin: - sub esi,scan ; esi = len -trfinval: -; here we have finised compare, and esi contain len of equal string - cmp esi,best_len ; if len > best_len, go newbestlen - ja short newbestlen -; now we restore edx, ecx and esi, for the big loop - mov esi,prev - mov ecx,limit - mov edx,window - jmp contloop3 - -newbestlen: - mov best_len,esi ; len become best_len - - mov match_start,eax ; save new position as match_start - cmp esi,nice_match ; if best_len >= nice_match, exit - jae exitloop - mov ecx,scan - mov edx,window ; restore edx=window - add ecx,esi - add esi,edx - - dec esi - mov windowlen,esi ; windowlen = window + best_len-1 - mov bx,[ecx-1] ; bx = *(scan+best_len-1) = scan_end - -; now we restore ecx and esi, for the big loop : - mov esi,prev - mov ecx,limit - jmp contloop3 - -exitloop: -; exit : s->match_start=match_start - mov ebx,match_start - mov ebp,str_s - mov ecx,best_len - mov dword ptr [ebp+dep_match_start],ebx - mov eax,dword ptr [ebp+dep_lookahead] - cmp ecx,eax - ja minexlo - mov eax,ecx -minexlo: -; return min(best_len,s->lookahead) - -; restore stack and register ebx,esi,edi,ebp - add esp,NbStackAdd - - pop ebx - pop esi - pop edi - pop ebp - ret -InfoAuthor: -; please don't remove this string ! -; Your are free use gvmat32 in any fre or commercial apps if you don't remove the string in the binary! - db 0dh,0ah,"GVMat32 optimised assembly code written 1996-98 by Gilles Vollant",0dh,0ah - - - -IFDEF NOUNDERLINE -longest_match_7fff endp -ELSE -_longest_match_7fff endp -ENDIF - - -IFDEF NOUNDERLINE -cpudetect32 proc near -ELSE -_cpudetect32 proc near -ENDIF - - push ebx - - pushfd ; push original EFLAGS - pop eax ; get original EFLAGS - mov ecx, eax ; save original EFLAGS - xor eax, 40000h ; flip AC bit in EFLAGS - push eax ; save new EFLAGS value on stack - popfd ; replace current EFLAGS value - pushfd ; get new EFLAGS - pop eax ; store new EFLAGS in EAX - xor eax, ecx ; can’t toggle AC bit, processor=80386 - jz end_cpu_is_386 ; jump if 80386 processor - push ecx - popfd ; restore AC bit in EFLAGS first - - pushfd - pushfd - pop ecx - - mov eax, ecx ; get original EFLAGS - xor eax, 200000h ; flip ID bit in EFLAGS - push eax ; save new EFLAGS value on stack - popfd ; replace current EFLAGS value - pushfd ; get new EFLAGS - pop eax ; store new EFLAGS in EAX - popfd ; restore original EFLAGS - xor eax, ecx ; can’t toggle ID bit, - je is_old_486 ; processor=old - - mov eax,1 - db 0fh,0a2h ;CPUID - -exitcpudetect: - pop ebx - ret - -end_cpu_is_386: - mov eax,0300h - jmp exitcpudetect - -is_old_486: - mov eax,0400h - jmp exitcpudetect - -IFDEF NOUNDERLINE -cpudetect32 endp -ELSE -_cpudetect32 endp -ENDIF -ENDIF - -MAX_MATCH equ 258 -MIN_MATCH equ 3 -MIN_LOOKAHEAD equ (MAX_MATCH + MIN_MATCH + 1) -MAX_MATCH_8_ equ ((MAX_MATCH + 7) AND 0FFF0h) - - -;;; stack frame offsets - -chainlenwmask equ esp + 0 ; high word: current chain len - ; low word: s->wmask -window equ esp + 4 ; local copy of s->window -windowbestlen equ esp + 8 ; s->window + bestlen -scanstart equ esp + 16 ; first two bytes of string -scanend equ esp + 12 ; last two bytes of string -scanalign equ esp + 20 ; dword-misalignment of string -nicematch equ esp + 24 ; a good enough match size -bestlen equ esp + 28 ; size of best match so far -scan equ esp + 32 ; ptr to string wanting match - -LocalVarsSize equ 36 -; saved ebx byte esp + 36 -; saved edi byte esp + 40 -; saved esi byte esp + 44 -; saved ebp byte esp + 48 -; return address byte esp + 52 -deflatestate equ esp + 56 ; the function arguments -curmatch equ esp + 60 - -;;; Offsets for fields in the deflate_state structure. These numbers -;;; are calculated from the definition of deflate_state, with the -;;; assumption that the compiler will dword-align the fields. (Thus, -;;; changing the definition of deflate_state could easily cause this -;;; program to crash horribly, without so much as a warning at -;;; compile time. Sigh.) - -dsWSize equ 36+zlib1222add -dsWMask equ 44+zlib1222add -dsWindow equ 48+zlib1222add -dsPrev equ 56+zlib1222add -dsMatchLen equ 88+zlib1222add -dsPrevMatch equ 92+zlib1222add -dsStrStart equ 100+zlib1222add -dsMatchStart equ 104+zlib1222add -dsLookahead equ 108+zlib1222add -dsPrevLen equ 112+zlib1222add -dsMaxChainLen equ 116+zlib1222add -dsGoodMatch equ 132+zlib1222add -dsNiceMatch equ 136+zlib1222add - - -;;; match.asm -- Pentium-Pro-optimized version of longest_match() -;;; Written for zlib 1.1.2 -;;; Copyright (C) 1998 Brian Raiter -;;; You can look at http://www.muppetlabs.com/~breadbox/software/assembly.html -;;; -;;; This is free software; you can redistribute it and/or modify it -;;; under the terms of the GNU General Public License. - -;GLOBAL _longest_match, _match_init - - -;SECTION .text - -;;; uInt longest_match(deflate_state *deflatestate, IPos curmatch) - -;_longest_match: -IFDEF NOOLDPENTIUMCODE - IFDEF NOUNDERLINE - longest_match proc near - ELSE - _longest_match proc near - ENDIF -ELSE - IFDEF NOUNDERLINE - longest_match_686 proc near - ELSE - _longest_match_686 proc near - ENDIF -ENDIF - -;;; Save registers that the compiler may be using, and adjust esp to -;;; make room for our stack frame. - - push ebp - push edi - push esi - push ebx - sub esp, LocalVarsSize - -;;; Retrieve the function arguments. ecx will hold cur_match -;;; throughout the entire function. edx will hold the pointer to the -;;; deflate_state structure during the function's setup (before -;;; entering the main loop. - - mov edx, [deflatestate] - mov ecx, [curmatch] - -;;; uInt wmask = s->w_mask; -;;; unsigned chain_length = s->max_chain_length; -;;; if (s->prev_length >= s->good_match) { -;;; chain_length >>= 2; -;;; } - - mov eax, [edx + dsPrevLen] - mov ebx, [edx + dsGoodMatch] - cmp eax, ebx - mov eax, [edx + dsWMask] - mov ebx, [edx + dsMaxChainLen] - jl LastMatchGood - shr ebx, 2 -LastMatchGood: - -;;; chainlen is decremented once beforehand so that the function can -;;; use the sign flag instead of the zero flag for the exit test. -;;; It is then shifted into the high word, to make room for the wmask -;;; value, which it will always accompany. - - dec ebx - shl ebx, 16 - or ebx, eax - mov [chainlenwmask], ebx - -;;; if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; - - mov eax, [edx + dsNiceMatch] - mov ebx, [edx + dsLookahead] - cmp ebx, eax - jl LookaheadLess - mov ebx, eax -LookaheadLess: mov [nicematch], ebx - -;;; register Bytef *scan = s->window + s->strstart; - - mov esi, [edx + dsWindow] - mov [window], esi - mov ebp, [edx + dsStrStart] - lea edi, [esi + ebp] - mov [scan], edi - -;;; Determine how many bytes the scan ptr is off from being -;;; dword-aligned. - - mov eax, edi - neg eax - and eax, 3 - mov [scanalign], eax - -;;; IPos limit = s->strstart > (IPos)MAX_DIST(s) ? -;;; s->strstart - (IPos)MAX_DIST(s) : NIL; - - mov eax, [edx + dsWSize] - sub eax, MIN_LOOKAHEAD - sub ebp, eax - jg LimitPositive - xor ebp, ebp -LimitPositive: - -;;; int best_len = s->prev_length; - - mov eax, [edx + dsPrevLen] - mov [bestlen], eax - -;;; Store the sum of s->window + best_len in esi locally, and in esi. - - add esi, eax - mov [windowbestlen], esi - -;;; register ush scan_start = *(ushf*)scan; -;;; register ush scan_end = *(ushf*)(scan+best_len-1); -;;; Posf *prev = s->prev; - - movzx ebx, word ptr [edi] - mov [scanstart], ebx - movzx ebx, word ptr [edi + eax - 1] - mov [scanend], ebx - mov edi, [edx + dsPrev] - -;;; Jump into the main loop. - - mov edx, [chainlenwmask] - jmp short LoopEntry - -align 4 - -;;; do { -;;; match = s->window + cur_match; -;;; if (*(ushf*)(match+best_len-1) != scan_end || -;;; *(ushf*)match != scan_start) continue; -;;; [...] -;;; } while ((cur_match = prev[cur_match & wmask]) > limit -;;; && --chain_length != 0); -;;; -;;; Here is the inner loop of the function. The function will spend the -;;; majority of its time in this loop, and majority of that time will -;;; be spent in the first ten instructions. -;;; -;;; Within this loop: -;;; ebx = scanend -;;; ecx = curmatch -;;; edx = chainlenwmask - i.e., ((chainlen << 16) | wmask) -;;; esi = windowbestlen - i.e., (window + bestlen) -;;; edi = prev -;;; ebp = limit - -LookupLoop: - and ecx, edx - movzx ecx, word ptr [edi + ecx*2] - cmp ecx, ebp - jbe LeaveNow - sub edx, 00010000h - js LeaveNow -LoopEntry: movzx eax, word ptr [esi + ecx - 1] - cmp eax, ebx - jnz LookupLoop - mov eax, [window] - movzx eax, word ptr [eax + ecx] - cmp eax, [scanstart] - jnz LookupLoop - -;;; Store the current value of chainlen. - - mov [chainlenwmask], edx - -;;; Point edi to the string under scrutiny, and esi to the string we -;;; are hoping to match it up with. In actuality, esi and edi are -;;; both pointed (MAX_MATCH_8 - scanalign) bytes ahead, and edx is -;;; initialized to -(MAX_MATCH_8 - scanalign). - - mov esi, [window] - mov edi, [scan] - add esi, ecx - mov eax, [scanalign] - mov edx, 0fffffef8h; -(MAX_MATCH_8) - lea edi, [edi + eax + 0108h] ;MAX_MATCH_8] - lea esi, [esi + eax + 0108h] ;MAX_MATCH_8] - -;;; Test the strings for equality, 8 bytes at a time. At the end, -;;; adjust edx so that it is offset to the exact byte that mismatched. -;;; -;;; We already know at this point that the first three bytes of the -;;; strings match each other, and they can be safely passed over before -;;; starting the compare loop. So what this code does is skip over 0-3 -;;; bytes, as much as necessary in order to dword-align the edi -;;; pointer. (esi will still be misaligned three times out of four.) -;;; -;;; It should be confessed that this loop usually does not represent -;;; much of the total running time. Replacing it with a more -;;; straightforward "rep cmpsb" would not drastically degrade -;;; performance. - -LoopCmps: - mov eax, [esi + edx] - xor eax, [edi + edx] - jnz LeaveLoopCmps - mov eax, [esi + edx + 4] - xor eax, [edi + edx + 4] - jnz LeaveLoopCmps4 - add edx, 8 - jnz LoopCmps - jmp short LenMaximum -LeaveLoopCmps4: add edx, 4 -LeaveLoopCmps: test eax, 0000FFFFh - jnz LenLower - add edx, 2 - shr eax, 16 -LenLower: sub al, 1 - adc edx, 0 - -;;; Calculate the length of the match. If it is longer than MAX_MATCH, -;;; then automatically accept it as the best possible match and leave. - - lea eax, [edi + edx] - mov edi, [scan] - sub eax, edi - cmp eax, MAX_MATCH - jge LenMaximum - -;;; If the length of the match is not longer than the best match we -;;; have so far, then forget it and return to the lookup loop. - - mov edx, [deflatestate] - mov ebx, [bestlen] - cmp eax, ebx - jg LongerMatch - mov esi, [windowbestlen] - mov edi, [edx + dsPrev] - mov ebx, [scanend] - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; s->match_start = cur_match; -;;; best_len = len; -;;; if (len >= nice_match) break; -;;; scan_end = *(ushf*)(scan+best_len-1); - -LongerMatch: mov ebx, [nicematch] - mov [bestlen], eax - mov [edx + dsMatchStart], ecx - cmp eax, ebx - jge LeaveNow - mov esi, [window] - add esi, eax - mov [windowbestlen], esi - movzx ebx, word ptr [edi + eax - 1] - mov edi, [edx + dsPrev] - mov [scanend], ebx - mov edx, [chainlenwmask] - jmp LookupLoop - -;;; Accept the current string, with the maximum possible length. - -LenMaximum: mov edx, [deflatestate] - mov dword ptr [bestlen], MAX_MATCH - mov [edx + dsMatchStart], ecx - -;;; if ((uInt)best_len <= s->lookahead) return (uInt)best_len; -;;; return s->lookahead; - -LeaveNow: - mov edx, [deflatestate] - mov ebx, [bestlen] - mov eax, [edx + dsLookahead] - cmp ebx, eax - jg LookaheadRet - mov eax, ebx -LookaheadRet: - -;;; Restore the stack and return from whence we came. - - add esp, LocalVarsSize - pop ebx - pop esi - pop edi - pop ebp - - ret -; please don't remove this string ! -; Your can freely use gvmat32 in any free or commercial app if you don't remove the string in the binary! - db 0dh,0ah,"asm686 with masm, optimised assembly code from Brian Raiter, written 1998",0dh,0ah - - -IFDEF NOOLDPENTIUMCODE - IFDEF NOUNDERLINE - longest_match endp - ELSE - _longest_match endp - ENDIF - - IFDEF NOUNDERLINE - match_init proc near - ret - match_init endp - ELSE - _match_init proc near - ret - _match_init endp - ENDIF -ELSE - IFDEF NOUNDERLINE - longest_match_686 endp - ELSE - _longest_match_686 endp - ENDIF -ENDIF - -_TEXT ends -end diff --git a/common/dist/zlib/contrib/masmx86/inffas32.asm b/common/dist/zlib/contrib/masmx86/inffas32.asm deleted file mode 100644 index 4a205125e..000000000 --- a/common/dist/zlib/contrib/masmx86/inffas32.asm +++ /dev/null @@ -1,1083 +0,0 @@ -;/* inffas32.asm is a hand tuned assembler version of inffast.c -- fast decoding -; * -; * inffas32.asm is derivated from inffas86.c, with translation of assembly code -; * -; * Copyright (C) 1995-2003 Mark Adler -; * For conditions of distribution and use, see copyright notice in zlib.h -; * -; * Copyright (C) 2003 Chris Anderson -; * Please use the copyright conditions above. -; * -; * Mar-13-2003 -- Most of this is derived from inffast.S which is derived from -; * the gcc -S output of zlib-1.2.0/inffast.c. Zlib-1.2.0 is in beta release at -; * the moment. I have successfully compiled and tested this code with gcc2.96, -; * gcc3.2, icc5.0, msvc6.0. It is very close to the speed of inffast.S -; * compiled with gcc -DNO_MMX, but inffast.S is still faster on the P3 with MMX -; * enabled. I will attempt to merge the MMX code into this version. Newer -; * versions of this and inffast.S can be found at -; * http://www.eetbeetee.com/zlib/ and http://www.charm.net/~christop/zlib/ -; * -; * 2005 : modification by Gilles Vollant -; */ -; For Visual C++ 4.x and higher and ML 6.x and higher -; ml.exe is in directory \MASM611C of Win95 DDK -; ml.exe is also distributed in http://www.masm32.com/masmdl.htm -; and in VC++2003 toolkit at http://msdn.microsoft.com/visualc/vctoolkit2003/ -; -; -; compile with command line option -; ml /coff /Zi /c /Flinffas32.lst inffas32.asm - -; if you define NO_GZIP (see inflate.h), compile with -; ml /coff /Zi /c /Flinffas32.lst /DNO_GUNZIP inffas32.asm - - -; zlib122sup is 0 fort zlib 1.2.2.1 and lower -; zlib122sup is 8 fort zlib 1.2.2.2 and more (with addition of dmax and head -; in inflate_state in inflate.h) -zlib1222sup equ 8 - - -IFDEF GUNZIP - INFLATE_MODE_TYPE equ 11 - INFLATE_MODE_BAD equ 26 -ELSE - IFNDEF NO_GUNZIP - INFLATE_MODE_TYPE equ 11 - INFLATE_MODE_BAD equ 26 - ELSE - INFLATE_MODE_TYPE equ 3 - INFLATE_MODE_BAD equ 17 - ENDIF -ENDIF - - -; 75 "inffast.S" -;FILE "inffast.S" - -;;;GLOBAL _inflate_fast - -;;;SECTION .text - - - - .586p - .mmx - - name inflate_fast_x86 - .MODEL FLAT - -_DATA segment -inflate_fast_use_mmx: - dd 1 - - -_TEXT segment -PUBLIC _inflate_fast - -ALIGN 4 -_inflate_fast: - jmp inflate_fast_entry - - - -ALIGN 4 - db 'Fast decoding Code from Chris Anderson' - db 0 - -ALIGN 4 -invalid_literal_length_code_msg: - db 'invalid literal/length code' - db 0 - -ALIGN 4 -invalid_distance_code_msg: - db 'invalid distance code' - db 0 - -ALIGN 4 -invalid_distance_too_far_msg: - db 'invalid distance too far back' - db 0 - - -ALIGN 4 -inflate_fast_mask: -dd 0 -dd 1 -dd 3 -dd 7 -dd 15 -dd 31 -dd 63 -dd 127 -dd 255 -dd 511 -dd 1023 -dd 2047 -dd 4095 -dd 8191 -dd 16383 -dd 32767 -dd 65535 -dd 131071 -dd 262143 -dd 524287 -dd 1048575 -dd 2097151 -dd 4194303 -dd 8388607 -dd 16777215 -dd 33554431 -dd 67108863 -dd 134217727 -dd 268435455 -dd 536870911 -dd 1073741823 -dd 2147483647 -dd 4294967295 - - -mode_state equ 0 ;/* state->mode */ -wsize_state equ (32+zlib1222sup) ;/* state->wsize */ -write_state equ (36+4+zlib1222sup) ;/* state->write */ -window_state equ (40+4+zlib1222sup) ;/* state->window */ -hold_state equ (44+4+zlib1222sup) ;/* state->hold */ -bits_state equ (48+4+zlib1222sup) ;/* state->bits */ -lencode_state equ (64+4+zlib1222sup) ;/* state->lencode */ -distcode_state equ (68+4+zlib1222sup) ;/* state->distcode */ -lenbits_state equ (72+4+zlib1222sup) ;/* state->lenbits */ -distbits_state equ (76+4+zlib1222sup) ;/* state->distbits */ - - -;;SECTION .text -; 205 "inffast.S" -;GLOBAL inflate_fast_use_mmx - -;SECTION .data - - -; GLOBAL inflate_fast_use_mmx:object -;.size inflate_fast_use_mmx, 4 -; 226 "inffast.S" -;SECTION .text - -ALIGN 4 -inflate_fast_entry: - push edi - push esi - push ebp - push ebx - pushfd - sub esp,64 - cld - - - - - mov esi, [esp+88] - mov edi, [esi+28] - - - - - - - - mov edx, [esi+4] - mov eax, [esi+0] - - add edx,eax - sub edx,11 - - mov [esp+44],eax - mov [esp+20],edx - - mov ebp, [esp+92] - mov ecx, [esi+16] - mov ebx, [esi+12] - - sub ebp,ecx - neg ebp - add ebp,ebx - - sub ecx,257 - add ecx,ebx - - mov [esp+60],ebx - mov [esp+40],ebp - mov [esp+16],ecx -; 285 "inffast.S" - mov eax, [edi+lencode_state] - mov ecx, [edi+distcode_state] - - mov [esp+8],eax - mov [esp+12],ecx - - mov eax,1 - mov ecx, [edi+lenbits_state] - shl eax,cl - dec eax - mov [esp+0],eax - - mov eax,1 - mov ecx, [edi+distbits_state] - shl eax,cl - dec eax - mov [esp+4],eax - - mov eax, [edi+wsize_state] - mov ecx, [edi+write_state] - mov edx, [edi+window_state] - - mov [esp+52],eax - mov [esp+48],ecx - mov [esp+56],edx - - mov ebp, [edi+hold_state] - mov ebx, [edi+bits_state] -; 321 "inffast.S" - mov esi, [esp+44] - mov ecx, [esp+20] - cmp ecx,esi - ja L_align_long - - add ecx,11 - sub ecx,esi - mov eax,12 - sub eax,ecx - lea edi, [esp+28] - rep movsb - mov ecx,eax - xor eax,eax - rep stosb - lea esi, [esp+28] - mov [esp+20],esi - jmp L_is_aligned - - -L_align_long: - test esi,3 - jz L_is_aligned - xor eax,eax - mov al, [esi] - inc esi - mov ecx,ebx - add ebx,8 - shl eax,cl - or ebp,eax - jmp L_align_long - -L_is_aligned: - mov edi, [esp+60] -; 366 "inffast.S" -L_check_mmx: - cmp dword ptr [inflate_fast_use_mmx],2 - je L_init_mmx - ja L_do_loop - - push eax - push ebx - push ecx - push edx - pushfd - mov eax, [esp] - xor dword ptr [esp],0200000h - - - - - popfd - pushfd - pop edx - xor edx,eax - jz L_dont_use_mmx - xor eax,eax - cpuid - cmp ebx,0756e6547h - jne L_dont_use_mmx - cmp ecx,06c65746eh - jne L_dont_use_mmx - cmp edx,049656e69h - jne L_dont_use_mmx - mov eax,1 - cpuid - shr eax,8 - and eax,15 - cmp eax,6 - jne L_dont_use_mmx - test edx,0800000h - jnz L_use_mmx - jmp L_dont_use_mmx -L_use_mmx: - mov dword ptr [inflate_fast_use_mmx],2 - jmp L_check_mmx_pop -L_dont_use_mmx: - mov dword ptr [inflate_fast_use_mmx],3 -L_check_mmx_pop: - pop edx - pop ecx - pop ebx - pop eax - jmp L_check_mmx -; 426 "inffast.S" -ALIGN 4 -L_do_loop: -; 437 "inffast.S" - cmp bl,15 - ja L_get_length_code - - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - -L_get_length_code: - mov edx, [esp+0] - mov ecx, [esp+8] - and edx,ebp - mov eax, [ecx+edx*4] - -L_dolen: - - - - - - - mov cl,ah - sub bl,ah - shr ebp,cl - - - - - - - test al,al - jnz L_test_for_length_base - - shr eax,16 - stosb - -L_while_test: - - - cmp [esp+16],edi - jbe L_break_loop - - cmp [esp+20],esi - ja L_do_loop - jmp L_break_loop - -L_test_for_length_base: -; 502 "inffast.S" - mov edx,eax - shr edx,16 - mov cl,al - - test al,16 - jz L_test_for_second_level_length - and cl,15 - jz L_save_len - cmp bl,cl - jae L_add_bits_to_len - - mov ch,cl - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - mov cl,ch - -L_add_bits_to_len: - mov eax,1 - shl eax,cl - dec eax - sub bl,cl - and eax,ebp - shr ebp,cl - add edx,eax - -L_save_len: - mov [esp+24],edx - - -L_decode_distance: -; 549 "inffast.S" - cmp bl,15 - ja L_get_distance_code - - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - -L_get_distance_code: - mov edx, [esp+4] - mov ecx, [esp+12] - and edx,ebp - mov eax, [ecx+edx*4] - - -L_dodist: - mov edx,eax - shr edx,16 - mov cl,ah - sub bl,ah - shr ebp,cl -; 584 "inffast.S" - mov cl,al - - test al,16 - jz L_test_for_second_level_dist - and cl,15 - jz L_check_dist_one - cmp bl,cl - jae L_add_bits_to_dist - - mov ch,cl - xor eax,eax - lodsw - mov cl,bl - add bl,16 - shl eax,cl - or ebp,eax - mov cl,ch - -L_add_bits_to_dist: - mov eax,1 - shl eax,cl - dec eax - sub bl,cl - and eax,ebp - shr ebp,cl - add edx,eax - jmp L_check_window - -L_check_window: -; 625 "inffast.S" - mov [esp+44],esi - mov eax,edi - sub eax, [esp+40] - - cmp eax,edx - jb L_clip_window - - mov ecx, [esp+24] - mov esi,edi - sub esi,edx - - sub ecx,3 - mov al, [esi] - mov [edi],al - mov al, [esi+1] - mov dl, [esi+2] - add esi,3 - mov [edi+1],al - mov [edi+2],dl - add edi,3 - rep movsb - - mov esi, [esp+44] - jmp L_while_test - -ALIGN 4 -L_check_dist_one: - cmp edx,1 - jne L_check_window - cmp [esp+40],edi - je L_check_window - - dec edi - mov ecx, [esp+24] - mov al, [edi] - sub ecx,3 - - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - add edi,4 - rep stosb - - jmp L_while_test - -ALIGN 4 -L_test_for_second_level_length: - - - - - test al,64 - jnz L_test_for_end_of_block - - mov eax,1 - shl eax,cl - dec eax - and eax,ebp - add eax,edx - mov edx, [esp+8] - mov eax, [edx+eax*4] - jmp L_dolen - -ALIGN 4 -L_test_for_second_level_dist: - - - - - test al,64 - jnz L_invalid_distance_code - - mov eax,1 - shl eax,cl - dec eax - and eax,ebp - add eax,edx - mov edx, [esp+12] - mov eax, [edx+eax*4] - jmp L_dodist - -ALIGN 4 -L_clip_window: -; 721 "inffast.S" - mov ecx,eax - mov eax, [esp+52] - neg ecx - mov esi, [esp+56] - - cmp eax,edx - jb L_invalid_distance_too_far - - add ecx,edx - cmp dword ptr [esp+48],0 - jne L_wrap_around_window - - sub eax,ecx - add esi,eax -; 749 "inffast.S" - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - -L_wrap_around_window: -; 793 "inffast.S" - mov eax, [esp+48] - cmp ecx,eax - jbe L_contiguous_in_window - - add esi, [esp+52] - add esi,eax - sub esi,ecx - sub ecx,eax - - - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi, [esp+56] - mov ecx, [esp+48] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - jmp L_do_copy1 - -L_contiguous_in_window: -; 836 "inffast.S" - add esi,eax - sub esi,ecx - - - mov eax, [esp+24] - cmp eax,ecx - jbe L_do_copy1 - - sub eax,ecx - rep movsb - mov esi,edi - sub esi,edx - -L_do_copy1: -; 862 "inffast.S" - mov ecx,eax - rep movsb - - mov esi, [esp+44] - jmp L_while_test -; 878 "inffast.S" -ALIGN 4 -L_init_mmx: - emms - - - - - - movd mm0,ebp - mov ebp,ebx -; 896 "inffast.S" - movd mm4,[esp+0] - movq mm3,mm4 - movd mm5,[esp+4] - movq mm2,mm5 - pxor mm1,mm1 - mov ebx, [esp+8] - jmp L_do_loop_mmx - -ALIGN 4 -L_do_loop_mmx: - psrlq mm0,mm1 - - cmp ebp,32 - ja L_get_length_code_mmx - - movd mm6,ebp - movd mm7,[esi] - add esi,4 - psllq mm7,mm6 - add ebp,32 - por mm0,mm7 - -L_get_length_code_mmx: - pand mm4,mm0 - movd eax,mm4 - movq mm4,mm3 - mov eax, [ebx+eax*4] - -L_dolen_mmx: - movzx ecx,ah - movd mm1,ecx - sub ebp,ecx - - test al,al - jnz L_test_for_length_base_mmx - - shr eax,16 - stosb - -L_while_test_mmx: - - - cmp [esp+16],edi - jbe L_break_loop - - cmp [esp+20],esi - ja L_do_loop_mmx - jmp L_break_loop - -L_test_for_length_base_mmx: - - mov edx,eax - shr edx,16 - - test al,16 - jz L_test_for_second_level_length_mmx - and eax,15 - jz L_decode_distance_mmx - - psrlq mm0,mm1 - movd mm1,eax - movd ecx,mm0 - sub ebp,eax - and ecx, [inflate_fast_mask+eax*4] - add edx,ecx - -L_decode_distance_mmx: - psrlq mm0,mm1 - - cmp ebp,32 - ja L_get_dist_code_mmx - - movd mm6,ebp - movd mm7,[esi] - add esi,4 - psllq mm7,mm6 - add ebp,32 - por mm0,mm7 - -L_get_dist_code_mmx: - mov ebx, [esp+12] - pand mm5,mm0 - movd eax,mm5 - movq mm5,mm2 - mov eax, [ebx+eax*4] - -L_dodist_mmx: - - movzx ecx,ah - mov ebx,eax - shr ebx,16 - sub ebp,ecx - movd mm1,ecx - - test al,16 - jz L_test_for_second_level_dist_mmx - and eax,15 - jz L_check_dist_one_mmx - -L_add_bits_to_dist_mmx: - psrlq mm0,mm1 - movd mm1,eax - movd ecx,mm0 - sub ebp,eax - and ecx, [inflate_fast_mask+eax*4] - add ebx,ecx - -L_check_window_mmx: - mov [esp+44],esi - mov eax,edi - sub eax, [esp+40] - - cmp eax,ebx - jb L_clip_window_mmx - - mov ecx,edx - mov esi,edi - sub esi,ebx - - sub ecx,3 - mov al, [esi] - mov [edi],al - mov al, [esi+1] - mov dl, [esi+2] - add esi,3 - mov [edi+1],al - mov [edi+2],dl - add edi,3 - rep movsb - - mov esi, [esp+44] - mov ebx, [esp+8] - jmp L_while_test_mmx - -ALIGN 4 -L_check_dist_one_mmx: - cmp ebx,1 - jne L_check_window_mmx - cmp [esp+40],edi - je L_check_window_mmx - - dec edi - mov ecx,edx - mov al, [edi] - sub ecx,3 - - mov [edi+1],al - mov [edi+2],al - mov [edi+3],al - add edi,4 - rep stosb - - mov ebx, [esp+8] - jmp L_while_test_mmx - -ALIGN 4 -L_test_for_second_level_length_mmx: - test al,64 - jnz L_test_for_end_of_block - - and eax,15 - psrlq mm0,mm1 - movd ecx,mm0 - and ecx, [inflate_fast_mask+eax*4] - add ecx,edx - mov eax, [ebx+ecx*4] - jmp L_dolen_mmx - -ALIGN 4 -L_test_for_second_level_dist_mmx: - test al,64 - jnz L_invalid_distance_code - - and eax,15 - psrlq mm0,mm1 - movd ecx,mm0 - and ecx, [inflate_fast_mask+eax*4] - mov eax, [esp+12] - add ecx,ebx - mov eax, [eax+ecx*4] - jmp L_dodist_mmx - -ALIGN 4 -L_clip_window_mmx: - - mov ecx,eax - mov eax, [esp+52] - neg ecx - mov esi, [esp+56] - - cmp eax,ebx - jb L_invalid_distance_too_far - - add ecx,ebx - cmp dword ptr [esp+48],0 - jne L_wrap_around_window_mmx - - sub eax,ecx - add esi,eax - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - -L_wrap_around_window_mmx: - - mov eax, [esp+48] - cmp ecx,eax - jbe L_contiguous_in_window_mmx - - add esi, [esp+52] - add esi,eax - sub esi,ecx - sub ecx,eax - - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi, [esp+56] - mov ecx, [esp+48] - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - jmp L_do_copy1_mmx - -L_contiguous_in_window_mmx: - - add esi,eax - sub esi,ecx - - - cmp edx,ecx - jbe L_do_copy1_mmx - - sub edx,ecx - rep movsb - mov esi,edi - sub esi,ebx - -L_do_copy1_mmx: - - - mov ecx,edx - rep movsb - - mov esi, [esp+44] - mov ebx, [esp+8] - jmp L_while_test_mmx -; 1174 "inffast.S" -L_invalid_distance_code: - - - - - - mov ecx, invalid_distance_code_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_test_for_end_of_block: - - - - - - test al,32 - jz L_invalid_literal_length_code - - mov ecx,0 - mov edx,INFLATE_MODE_TYPE - jmp L_update_stream_state - -L_invalid_literal_length_code: - - - - - - mov ecx, invalid_literal_length_code_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_invalid_distance_too_far: - - - - mov esi, [esp+44] - mov ecx, invalid_distance_too_far_msg - mov edx,INFLATE_MODE_BAD - jmp L_update_stream_state - -L_update_stream_state: - - mov eax, [esp+88] - test ecx,ecx - jz L_skip_msg - mov [eax+24],ecx -L_skip_msg: - mov eax, [eax+28] - mov [eax+mode_state],edx - jmp L_break_loop - -ALIGN 4 -L_break_loop: -; 1243 "inffast.S" - cmp dword ptr [inflate_fast_use_mmx],2 - jne L_update_next_in - - - - mov ebx,ebp - -L_update_next_in: -; 1266 "inffast.S" - mov eax, [esp+88] - mov ecx,ebx - mov edx, [eax+28] - shr ecx,3 - sub esi,ecx - shl ecx,3 - sub ebx,ecx - mov [eax+12],edi - mov [edx+bits_state],ebx - mov ecx,ebx - - lea ebx, [esp+28] - cmp [esp+20],ebx - jne L_buf_not_used - - sub esi,ebx - mov ebx, [eax+0] - mov [esp+20],ebx - add esi,ebx - mov ebx, [eax+4] - sub ebx,11 - add [esp+20],ebx - -L_buf_not_used: - mov [eax+0],esi - - mov ebx,1 - shl ebx,cl - dec ebx - - - - - - cmp dword ptr [inflate_fast_use_mmx],2 - jne L_update_hold - - - - psrlq mm0,mm1 - movd ebp,mm0 - - emms - -L_update_hold: - - - - and ebp,ebx - mov [edx+hold_state],ebp - - - - - mov ebx, [esp+20] - cmp ebx,esi - jbe L_last_is_smaller - - sub ebx,esi - add ebx,11 - mov [eax+4],ebx - jmp L_fixup_out -L_last_is_smaller: - sub esi,ebx - neg esi - add esi,11 - mov [eax+4],esi - - - - -L_fixup_out: - - mov ebx, [esp+16] - cmp ebx,edi - jbe L_end_is_smaller - - sub ebx,edi - add ebx,257 - mov [eax+16],ebx - jmp L_done -L_end_is_smaller: - sub edi,ebx - neg edi - add edi,257 - mov [eax+16],edi - - - - - -L_done: - add esp,64 - popfd - pop ebx - pop ebp - pop esi - pop edi - ret - -_TEXT ends -end diff --git a/common/dist/zlib/contrib/masmx86/mkasm.bat b/common/dist/zlib/contrib/masmx86/mkasm.bat deleted file mode 100755 index 70a51f837..000000000 --- a/common/dist/zlib/contrib/masmx86/mkasm.bat +++ /dev/null @@ -1,3 +0,0 @@ -cl /DASMV /I..\.. /O2 /c gvmat32c.c -ml /coff /Zi /c /Flgvmat32.lst gvmat32.asm -ml /coff /Zi /c /Flinffas32.lst inffas32.asm diff --git a/common/dist/zlib/contrib/masmx86/readme.txt b/common/dist/zlib/contrib/masmx86/readme.txt deleted file mode 100644 index 7b57167b7..000000000 --- a/common/dist/zlib/contrib/masmx86/readme.txt +++ /dev/null @@ -1,21 +0,0 @@ - -Summary -------- -This directory contains ASM implementations of the functions -longest_match() and inflate_fast(). - - -Use instructions ----------------- -Copy these files into the zlib source directory, then run the -appropriate makefile, as suggested below. - - -Build instructions ------------------- -* With Microsoft C and MASM: -nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" OBJA="gvmat32c.obj gvmat32.obj inffas32.obj" - -* With Borland C and TASM: -make -f win32/Makefile.bor LOCAL_ZLIB="-DASMV -DASMINF" OBJA="gvmat32c.obj gvmat32.obj inffas32.obj" OBJPA="+gvmat32c.obj+gvmat32.obj+inffas32.obj" - diff --git a/common/dist/zlib/contrib/minizip/ChangeLogUnzip b/common/dist/zlib/contrib/minizip/ChangeLogUnzip deleted file mode 100644 index 50ca6a9e0..000000000 --- a/common/dist/zlib/contrib/minizip/ChangeLogUnzip +++ /dev/null @@ -1,67 +0,0 @@ -Change in 1.01e (12 feb 05) -- Fix in zipOpen2 for globalcomment (Rolf Kalbermatter) -- Fix possible memory leak in unzip.c (Zoran Stevanovic) - -Change in 1.01b (20 may 04) -- Integrate patch from Debian package (submited by Mark Brown) -- Add tools mztools from Xavier Roche - -Change in 1.01 (8 may 04) -- fix buffer overrun risk in unzip.c (Xavier Roche) -- fix a minor buffer insecurity in minizip.c (Mike Whittaker) - -Change in 1.00: (10 sept 03) -- rename to 1.00 -- cosmetic code change - -Change in 0.22: (19 May 03) -- crypting support (unless you define NOCRYPT) -- append file in existing zipfile - -Change in 0.21: (10 Mar 03) -- bug fixes - -Change in 0.17: (27 Jan 02) -- bug fixes - -Change in 0.16: (19 Jan 02) -- Support of ioapi for virtualize zip file access - -Change in 0.15: (19 Mar 98) -- fix memory leak in minizip.c - -Change in 0.14: (10 Mar 98) -- fix bugs in minizip.c sample for zipping big file -- fix problem in month in date handling -- fix bug in unzlocal_GetCurrentFileInfoInternal in unzip.c for - comment handling - -Change in 0.13: (6 Mar 98) -- fix bugs in zip.c -- add real minizip sample - -Change in 0.12: (4 Mar 98) -- add zip.c and zip.h for creates .zip file -- fix change_file_date in miniunz.c for Unix (Jean-loup Gailly) -- fix miniunz.c for file without specific record for directory - -Change in 0.11: (3 Mar 98) -- fix bug in unzGetCurrentFileInfo for get extra field and comment -- enhance miniunz sample, remove the bad unztst.c sample - -Change in 0.10: (2 Mar 98) -- fix bug in unzReadCurrentFile -- rename unzip* to unz* function and structure -- remove Windows-like hungary notation variable name -- modify some structure in unzip.h -- add somes comment in source -- remove unzipGetcCurrentFile function -- replace ZUNZEXPORT by ZEXPORT -- add unzGetLocalExtrafield for get the local extrafield info -- add a new sample, miniunz.c - -Change in 0.4: (25 Feb 98) -- suppress the type unzipFileInZip. - Only on file in the zipfile can be open at the same time -- fix somes typo in code -- added tm_unz structure in unzip_file_info (date/time in readable format) diff --git a/common/dist/zlib/contrib/minizip/Makefile b/common/dist/zlib/contrib/minizip/Makefile deleted file mode 100644 index 84eaad20d..000000000 --- a/common/dist/zlib/contrib/minizip/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -CC=cc -CFLAGS=-O -I../.. - -UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a -ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a - -.c.o: - $(CC) -c $(CFLAGS) $*.c - -all: miniunz minizip - -miniunz: $(UNZ_OBJS) - $(CC) $(CFLAGS) -o $@ $(UNZ_OBJS) - -minizip: $(ZIP_OBJS) - $(CC) $(CFLAGS) -o $@ $(ZIP_OBJS) - -test: miniunz minizip - ./minizip test readme.txt - ./miniunz -l test.zip - mv readme.txt readme.old - ./miniunz test.zip - -clean: - /bin/rm -f *.o *~ minizip miniunz diff --git a/common/dist/zlib/contrib/pascal/example.pas b/common/dist/zlib/contrib/pascal/example.pas deleted file mode 100644 index 5518b36a7..000000000 --- a/common/dist/zlib/contrib/pascal/example.pas +++ /dev/null @@ -1,599 +0,0 @@ -(* example.c -- usage example of the zlib compression library - * Copyright (C) 1995-2003 Jean-loup Gailly. - * For conditions of distribution and use, see copyright notice in zlib.h - * - * Pascal translation - * Copyright (C) 1998 by Jacques Nomssi Nzali. - * For conditions of distribution and use, see copyright notice in readme.txt - * - * Adaptation to the zlibpas interface - * Copyright (C) 2003 by Cosmin Truta. - * For conditions of distribution and use, see copyright notice in readme.txt - *) - -program example; - -{$DEFINE TEST_COMPRESS} -{DO NOT $DEFINE TEST_GZIO} -{$DEFINE TEST_DEFLATE} -{$DEFINE TEST_INFLATE} -{$DEFINE TEST_FLUSH} -{$DEFINE TEST_SYNC} -{$DEFINE TEST_DICT} - -uses SysUtils, zlibpas; - -const TESTFILE = 'foo.gz'; - -(* "hello world" would be more standard, but the repeated "hello" - * stresses the compression code better, sorry... - *) -const hello: PChar = 'hello, hello!'; - -const dictionary: PChar = 'hello'; - -var dictId: LongInt; (* Adler32 value of the dictionary *) - -procedure CHECK_ERR(err: Integer; msg: String); -begin - if err <> Z_OK then - begin - WriteLn(msg, ' error: ', err); - Halt(1); - end; -end; - -procedure EXIT_ERR(const msg: String); -begin - WriteLn('Error: ', msg); - Halt(1); -end; - -(* =========================================================================== - * Test compress and uncompress - *) -{$IFDEF TEST_COMPRESS} -procedure test_compress(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen: LongInt); -var err: Integer; - len: LongInt; -begin - len := StrLen(hello)+1; - - err := compress(compr, comprLen, hello, len); - CHECK_ERR(err, 'compress'); - - StrCopy(PChar(uncompr), 'garbage'); - - err := uncompress(uncompr, uncomprLen, compr, comprLen); - CHECK_ERR(err, 'uncompress'); - - if StrComp(PChar(uncompr), hello) <> 0 then - EXIT_ERR('bad uncompress') - else - WriteLn('uncompress(): ', PChar(uncompr)); -end; -{$ENDIF} - -(* =========================================================================== - * Test read/write of .gz files - *) -{$IFDEF TEST_GZIO} -procedure test_gzio(const fname: PChar; (* compressed file name *) - uncompr: Pointer; - uncomprLen: LongInt); -var err: Integer; - len: Integer; - zfile: gzFile; - pos: LongInt; -begin - len := StrLen(hello)+1; - - zfile := gzopen(fname, 'wb'); - if zfile = NIL then - begin - WriteLn('gzopen error'); - Halt(1); - end; - gzputc(zfile, 'h'); - if gzputs(zfile, 'ello') <> 4 then - begin - WriteLn('gzputs err: ', gzerror(zfile, err)); - Halt(1); - end; - {$IFDEF GZ_FORMAT_STRING} - if gzprintf(zfile, ', %s!', 'hello') <> 8 then - begin - WriteLn('gzprintf err: ', gzerror(zfile, err)); - Halt(1); - end; - {$ELSE} - if gzputs(zfile, ', hello!') <> 8 then - begin - WriteLn('gzputs err: ', gzerror(zfile, err)); - Halt(1); - end; - {$ENDIF} - gzseek(zfile, 1, SEEK_CUR); (* add one zero byte *) - gzclose(zfile); - - zfile := gzopen(fname, 'rb'); - if zfile = NIL then - begin - WriteLn('gzopen error'); - Halt(1); - end; - - StrCopy(PChar(uncompr), 'garbage'); - - if gzread(zfile, uncompr, uncomprLen) <> len then - begin - WriteLn('gzread err: ', gzerror(zfile, err)); - Halt(1); - end; - if StrComp(PChar(uncompr), hello) <> 0 then - begin - WriteLn('bad gzread: ', PChar(uncompr)); - Halt(1); - end - else - WriteLn('gzread(): ', PChar(uncompr)); - - pos := gzseek(zfile, -8, SEEK_CUR); - if (pos <> 6) or (gztell(zfile) <> pos) then - begin - WriteLn('gzseek error, pos=', pos, ', gztell=', gztell(zfile)); - Halt(1); - end; - - if gzgetc(zfile) <> ' ' then - begin - WriteLn('gzgetc error'); - Halt(1); - end; - - if gzungetc(' ', zfile) <> ' ' then - begin - WriteLn('gzungetc error'); - Halt(1); - end; - - gzgets(zfile, PChar(uncompr), uncomprLen); - uncomprLen := StrLen(PChar(uncompr)); - if uncomprLen <> 7 then (* " hello!" *) - begin - WriteLn('gzgets err after gzseek: ', gzerror(zfile, err)); - Halt(1); - end; - if StrComp(PChar(uncompr), hello + 6) <> 0 then - begin - WriteLn('bad gzgets after gzseek'); - Halt(1); - end - else - WriteLn('gzgets() after gzseek: ', PChar(uncompr)); - - gzclose(zfile); -end; -{$ENDIF} - -(* =========================================================================== - * Test deflate with small buffers - *) -{$IFDEF TEST_DEFLATE} -procedure test_deflate(compr: Pointer; comprLen: LongInt); -var c_stream: z_stream; (* compression stream *) - err: Integer; - len: LongInt; -begin - len := StrLen(hello)+1; - - c_stream.zalloc := NIL; - c_stream.zfree := NIL; - c_stream.opaque := NIL; - - err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, 'deflateInit'); - - c_stream.next_in := hello; - c_stream.next_out := compr; - - while (c_stream.total_in <> len) and - (c_stream.total_out < comprLen) do - begin - c_stream.avail_out := 1; { force small buffers } - c_stream.avail_in := 1; - err := deflate(c_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'deflate'); - end; - - (* Finish the stream, still forcing small buffers: *) - while TRUE do - begin - c_stream.avail_out := 1; - err := deflate(c_stream, Z_FINISH); - if err = Z_STREAM_END then - break; - CHECK_ERR(err, 'deflate'); - end; - - err := deflateEnd(c_stream); - CHECK_ERR(err, 'deflateEnd'); -end; -{$ENDIF} - -(* =========================================================================== - * Test inflate with small buffers - *) -{$IFDEF TEST_INFLATE} -procedure test_inflate(compr: Pointer; comprLen : LongInt; - uncompr: Pointer; uncomprLen : LongInt); -var err: Integer; - d_stream: z_stream; (* decompression stream *) -begin - StrCopy(PChar(uncompr), 'garbage'); - - d_stream.zalloc := NIL; - d_stream.zfree := NIL; - d_stream.opaque := NIL; - - d_stream.next_in := compr; - d_stream.avail_in := 0; - d_stream.next_out := uncompr; - - err := inflateInit(d_stream); - CHECK_ERR(err, 'inflateInit'); - - while (d_stream.total_out < uncomprLen) and - (d_stream.total_in < comprLen) do - begin - d_stream.avail_out := 1; (* force small buffers *) - d_stream.avail_in := 1; - err := inflate(d_stream, Z_NO_FLUSH); - if err = Z_STREAM_END then - break; - CHECK_ERR(err, 'inflate'); - end; - - err := inflateEnd(d_stream); - CHECK_ERR(err, 'inflateEnd'); - - if StrComp(PChar(uncompr), hello) <> 0 then - EXIT_ERR('bad inflate') - else - WriteLn('inflate(): ', PChar(uncompr)); -end; -{$ENDIF} - -(* =========================================================================== - * Test deflate with large buffers and dynamic change of compression level - *) -{$IFDEF TEST_DEFLATE} -procedure test_large_deflate(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen: LongInt); -var c_stream: z_stream; (* compression stream *) - err: Integer; -begin - c_stream.zalloc := NIL; - c_stream.zfree := NIL; - c_stream.opaque := NIL; - - err := deflateInit(c_stream, Z_BEST_SPEED); - CHECK_ERR(err, 'deflateInit'); - - c_stream.next_out := compr; - c_stream.avail_out := Integer(comprLen); - - (* At this point, uncompr is still mostly zeroes, so it should compress - * very well: - *) - c_stream.next_in := uncompr; - c_stream.avail_in := Integer(uncomprLen); - err := deflate(c_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'deflate'); - if c_stream.avail_in <> 0 then - EXIT_ERR('deflate not greedy'); - - (* Feed in already compressed data and switch to no compression: *) - deflateParams(c_stream, Z_NO_COMPRESSION, Z_DEFAULT_STRATEGY); - c_stream.next_in := compr; - c_stream.avail_in := Integer(comprLen div 2); - err := deflate(c_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'deflate'); - - (* Switch back to compressing mode: *) - deflateParams(c_stream, Z_BEST_COMPRESSION, Z_FILTERED); - c_stream.next_in := uncompr; - c_stream.avail_in := Integer(uncomprLen); - err := deflate(c_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'deflate'); - - err := deflate(c_stream, Z_FINISH); - if err <> Z_STREAM_END then - EXIT_ERR('deflate should report Z_STREAM_END'); - - err := deflateEnd(c_stream); - CHECK_ERR(err, 'deflateEnd'); -end; -{$ENDIF} - -(* =========================================================================== - * Test inflate with large buffers - *) -{$IFDEF TEST_INFLATE} -procedure test_large_inflate(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen: LongInt); -var err: Integer; - d_stream: z_stream; (* decompression stream *) -begin - StrCopy(PChar(uncompr), 'garbage'); - - d_stream.zalloc := NIL; - d_stream.zfree := NIL; - d_stream.opaque := NIL; - - d_stream.next_in := compr; - d_stream.avail_in := Integer(comprLen); - - err := inflateInit(d_stream); - CHECK_ERR(err, 'inflateInit'); - - while TRUE do - begin - d_stream.next_out := uncompr; (* discard the output *) - d_stream.avail_out := Integer(uncomprLen); - err := inflate(d_stream, Z_NO_FLUSH); - if err = Z_STREAM_END then - break; - CHECK_ERR(err, 'large inflate'); - end; - - err := inflateEnd(d_stream); - CHECK_ERR(err, 'inflateEnd'); - - if d_stream.total_out <> 2 * uncomprLen + comprLen div 2 then - begin - WriteLn('bad large inflate: ', d_stream.total_out); - Halt(1); - end - else - WriteLn('large_inflate(): OK'); -end; -{$ENDIF} - -(* =========================================================================== - * Test deflate with full flush - *) -{$IFDEF TEST_FLUSH} -procedure test_flush(compr: Pointer; var comprLen : LongInt); -var c_stream: z_stream; (* compression stream *) - err: Integer; - len: Integer; -begin - len := StrLen(hello)+1; - - c_stream.zalloc := NIL; - c_stream.zfree := NIL; - c_stream.opaque := NIL; - - err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION); - CHECK_ERR(err, 'deflateInit'); - - c_stream.next_in := hello; - c_stream.next_out := compr; - c_stream.avail_in := 3; - c_stream.avail_out := Integer(comprLen); - err := deflate(c_stream, Z_FULL_FLUSH); - CHECK_ERR(err, 'deflate'); - - Inc(PByteArray(compr)^[3]); (* force an error in first compressed block *) - c_stream.avail_in := len - 3; - - err := deflate(c_stream, Z_FINISH); - if err <> Z_STREAM_END then - CHECK_ERR(err, 'deflate'); - - err := deflateEnd(c_stream); - CHECK_ERR(err, 'deflateEnd'); - - comprLen := c_stream.total_out; -end; -{$ENDIF} - -(* =========================================================================== - * Test inflateSync() - *) -{$IFDEF TEST_SYNC} -procedure test_sync(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen : LongInt); -var err: Integer; - d_stream: z_stream; (* decompression stream *) -begin - StrCopy(PChar(uncompr), 'garbage'); - - d_stream.zalloc := NIL; - d_stream.zfree := NIL; - d_stream.opaque := NIL; - - d_stream.next_in := compr; - d_stream.avail_in := 2; (* just read the zlib header *) - - err := inflateInit(d_stream); - CHECK_ERR(err, 'inflateInit'); - - d_stream.next_out := uncompr; - d_stream.avail_out := Integer(uncomprLen); - - inflate(d_stream, Z_NO_FLUSH); - CHECK_ERR(err, 'inflate'); - - d_stream.avail_in := Integer(comprLen-2); (* read all compressed data *) - err := inflateSync(d_stream); (* but skip the damaged part *) - CHECK_ERR(err, 'inflateSync'); - - err := inflate(d_stream, Z_FINISH); - if err <> Z_DATA_ERROR then - EXIT_ERR('inflate should report DATA_ERROR'); - (* Because of incorrect adler32 *) - - err := inflateEnd(d_stream); - CHECK_ERR(err, 'inflateEnd'); - - WriteLn('after inflateSync(): hel', PChar(uncompr)); -end; -{$ENDIF} - -(* =========================================================================== - * Test deflate with preset dictionary - *) -{$IFDEF TEST_DICT} -procedure test_dict_deflate(compr: Pointer; comprLen: LongInt); -var c_stream: z_stream; (* compression stream *) - err: Integer; -begin - c_stream.zalloc := NIL; - c_stream.zfree := NIL; - c_stream.opaque := NIL; - - err := deflateInit(c_stream, Z_BEST_COMPRESSION); - CHECK_ERR(err, 'deflateInit'); - - err := deflateSetDictionary(c_stream, dictionary, StrLen(dictionary)); - CHECK_ERR(err, 'deflateSetDictionary'); - - dictId := c_stream.adler; - c_stream.next_out := compr; - c_stream.avail_out := Integer(comprLen); - - c_stream.next_in := hello; - c_stream.avail_in := StrLen(hello)+1; - - err := deflate(c_stream, Z_FINISH); - if err <> Z_STREAM_END then - EXIT_ERR('deflate should report Z_STREAM_END'); - - err := deflateEnd(c_stream); - CHECK_ERR(err, 'deflateEnd'); -end; -{$ENDIF} - -(* =========================================================================== - * Test inflate with a preset dictionary - *) -{$IFDEF TEST_DICT} -procedure test_dict_inflate(compr: Pointer; comprLen: LongInt; - uncompr: Pointer; uncomprLen: LongInt); -var err: Integer; - d_stream: z_stream; (* decompression stream *) -begin - StrCopy(PChar(uncompr), 'garbage'); - - d_stream.zalloc := NIL; - d_stream.zfree := NIL; - d_stream.opaque := NIL; - - d_stream.next_in := compr; - d_stream.avail_in := Integer(comprLen); - - err := inflateInit(d_stream); - CHECK_ERR(err, 'inflateInit'); - - d_stream.next_out := uncompr; - d_stream.avail_out := Integer(uncomprLen); - - while TRUE do - begin - err := inflate(d_stream, Z_NO_FLUSH); - if err = Z_STREAM_END then - break; - if err = Z_NEED_DICT then - begin - if d_stream.adler <> dictId then - EXIT_ERR('unexpected dictionary'); - err := inflateSetDictionary(d_stream, dictionary, StrLen(dictionary)); - end; - CHECK_ERR(err, 'inflate with dict'); - end; - - err := inflateEnd(d_stream); - CHECK_ERR(err, 'inflateEnd'); - - if StrComp(PChar(uncompr), hello) <> 0 then - EXIT_ERR('bad inflate with dict') - else - WriteLn('inflate with dictionary: ', PChar(uncompr)); -end; -{$ENDIF} - -var compr, uncompr: Pointer; - comprLen, uncomprLen: LongInt; - -begin - if zlibVersion^ <> ZLIB_VERSION[1] then - EXIT_ERR('Incompatible zlib version'); - - WriteLn('zlib version: ', zlibVersion); - WriteLn('zlib compile flags: ', Format('0x%x', [zlibCompileFlags])); - - comprLen := 10000 * SizeOf(Integer); (* don't overflow on MSDOS *) - uncomprLen := comprLen; - GetMem(compr, comprLen); - GetMem(uncompr, uncomprLen); - if (compr = NIL) or (uncompr = NIL) then - EXIT_ERR('Out of memory'); - (* compr and uncompr are cleared to avoid reading uninitialized - * data and to ensure that uncompr compresses well. - *) - FillChar(compr^, comprLen, 0); - FillChar(uncompr^, uncomprLen, 0); - - {$IFDEF TEST_COMPRESS} - WriteLn('** Testing compress'); - test_compress(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - - {$IFDEF TEST_GZIO} - WriteLn('** Testing gzio'); - if ParamCount >= 1 then - test_gzio(ParamStr(1), uncompr, uncomprLen) - else - test_gzio(TESTFILE, uncompr, uncomprLen); - {$ENDIF} - - {$IFDEF TEST_DEFLATE} - WriteLn('** Testing deflate with small buffers'); - test_deflate(compr, comprLen); - {$ENDIF} - {$IFDEF TEST_INFLATE} - WriteLn('** Testing inflate with small buffers'); - test_inflate(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - - {$IFDEF TEST_DEFLATE} - WriteLn('** Testing deflate with large buffers'); - test_large_deflate(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - {$IFDEF TEST_INFLATE} - WriteLn('** Testing inflate with large buffers'); - test_large_inflate(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - - {$IFDEF TEST_FLUSH} - WriteLn('** Testing deflate with full flush'); - test_flush(compr, comprLen); - {$ENDIF} - {$IFDEF TEST_SYNC} - WriteLn('** Testing inflateSync'); - test_sync(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - comprLen := uncomprLen; - - {$IFDEF TEST_DICT} - WriteLn('** Testing deflate and inflate with preset dictionary'); - test_dict_deflate(compr, comprLen); - test_dict_inflate(compr, comprLen, uncompr, uncomprLen); - {$ENDIF} - - FreeMem(compr, comprLen); - FreeMem(uncompr, uncomprLen); -end. diff --git a/common/dist/zlib/contrib/pascal/readme.txt b/common/dist/zlib/contrib/pascal/readme.txt deleted file mode 100644 index 60e87c8a3..000000000 --- a/common/dist/zlib/contrib/pascal/readme.txt +++ /dev/null @@ -1,76 +0,0 @@ - -This directory contains a Pascal (Delphi, Kylix) interface to the -zlib data compression library. - - -Directory listing -================= - -zlibd32.mak makefile for Borland C++ -example.pas usage example of zlib -zlibpas.pas the Pascal interface to zlib -readme.txt this file - - -Compatibility notes -=================== - -- Although the name "zlib" would have been more normal for the - zlibpas unit, this name is already taken by Borland's ZLib unit. - This is somehow unfortunate, because that unit is not a genuine - interface to the full-fledged zlib functionality, but a suite of - class wrappers around zlib streams. Other essential features, - such as checksums, are missing. - It would have been more appropriate for that unit to have a name - like "ZStreams", or something similar. - -- The C and zlib-supplied types int, uInt, long, uLong, etc. are - translated directly into Pascal types of similar sizes (Integer, - LongInt, etc.), to avoid namespace pollution. In particular, - there is no conversion of unsigned int into a Pascal unsigned - integer. The Word type is non-portable and has the same size - (16 bits) both in a 16-bit and in a 32-bit environment, unlike - Integer. Even if there is a 32-bit Cardinal type, there is no - real need for unsigned int in zlib under a 32-bit environment. - -- Except for the callbacks, the zlib function interfaces are - assuming the calling convention normally used in Pascal - (__pascal for DOS and Windows16, __fastcall for Windows32). - Since the cdecl keyword is used, the old Turbo Pascal does - not work with this interface. - -- The gz* function interfaces are not translated, to avoid - interfacing problems with the C runtime library. Besides, - gzprintf(gzFile file, const char *format, ...) - cannot be translated into Pascal. - - -Legal issues -============ - -The zlibpas interface is: - Copyright (C) 1995-2003 Jean-loup Gailly and Mark Adler. - Copyright (C) 1998 by Bob Dellaca. - Copyright (C) 2003 by Cosmin Truta. - -The example program is: - Copyright (C) 1995-2003 by Jean-loup Gailly. - Copyright (C) 1998,1999,2000 by Jacques Nomssi Nzali. - Copyright (C) 2003 by Cosmin Truta. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the author be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - diff --git a/common/dist/zlib/contrib/pascal/zlibd32.mak b/common/dist/zlib/contrib/pascal/zlibd32.mak deleted file mode 100644 index 88fafa0b1..000000000 --- a/common/dist/zlib/contrib/pascal/zlibd32.mak +++ /dev/null @@ -1,93 +0,0 @@ -# Makefile for zlib -# For use with Delphi and C++ Builder under Win32 -# Updated for zlib 1.2.x by Cosmin Truta - -# ------------ Borland C++ ------------ - -# This project uses the Delphi (fastcall/register) calling convention: -LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl - -CC = bcc32 -LD = bcc32 -AR = tlib -# do not use "-pr" in CFLAGS -CFLAGS = -a -d -k- -O2 $(LOC) -LDFLAGS = - - -# variables -ZLIB_LIB = zlib.lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj -OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj -OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzio.obj: gzio.c zutil.h zlib.h zconf.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: example.c zlib.h zconf.h - -minigzip.obj: minigzip.c zlib.h zconf.h - - -# For the sake of the old Borland make, -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - - -# cleanup -clean: - -del *.obj - -del *.exe - -del *.lib - -del *.tds - -del zlib.bak - -del foo.gz - diff --git a/common/dist/zlib/contrib/pascal/zlibpas.pas b/common/dist/zlib/contrib/pascal/zlibpas.pas deleted file mode 100644 index 836848c2b..000000000 --- a/common/dist/zlib/contrib/pascal/zlibpas.pas +++ /dev/null @@ -1,236 +0,0 @@ -(* zlibpas -- Pascal interface to the zlib data compression library - * - * Copyright (C) 2003 Cosmin Truta. - * Derived from original sources by Bob Dellaca. - * For conditions of distribution and use, see copyright notice in readme.txt - *) - -unit zlibpas; - -interface - -const - ZLIB_VERSION = '1.2.3'; - -type - alloc_func = function(opaque: Pointer; items, size: Integer): Pointer; - cdecl; - free_func = procedure(opaque, address: Pointer); - cdecl; - - in_func = function(opaque: Pointer; var buf: PByte): Integer; - cdecl; - out_func = function(opaque: Pointer; buf: PByte; size: Integer): Integer; - cdecl; - - z_streamp = ^z_stream; - z_stream = packed record - next_in: PChar; (* next input byte *) - avail_in: Integer; (* number of bytes available at next_in *) - total_in: LongInt; (* total nb of input bytes read so far *) - - next_out: PChar; (* next output byte should be put there *) - avail_out: Integer; (* remaining free space at next_out *) - total_out: LongInt; (* total nb of bytes output so far *) - - msg: PChar; (* last error message, NULL if no error *) - state: Pointer; (* not visible by applications *) - - zalloc: alloc_func; (* used to allocate the internal state *) - zfree: free_func; (* used to free the internal state *) - opaque: Pointer; (* private data object passed to zalloc and zfree *) - - data_type: Integer; (* best guess about the data type: ascii or binary *) - adler: LongInt; (* adler32 value of the uncompressed data *) - reserved: LongInt; (* reserved for future use *) - end; - -(* constants *) -const - Z_NO_FLUSH = 0; - Z_PARTIAL_FLUSH = 1; - Z_SYNC_FLUSH = 2; - Z_FULL_FLUSH = 3; - Z_FINISH = 4; - - Z_OK = 0; - Z_STREAM_END = 1; - Z_NEED_DICT = 2; - Z_ERRNO = -1; - Z_STREAM_ERROR = -2; - Z_DATA_ERROR = -3; - Z_MEM_ERROR = -4; - Z_BUF_ERROR = -5; - Z_VERSION_ERROR = -6; - - Z_NO_COMPRESSION = 0; - Z_BEST_SPEED = 1; - Z_BEST_COMPRESSION = 9; - Z_DEFAULT_COMPRESSION = -1; - - Z_FILTERED = 1; - Z_HUFFMAN_ONLY = 2; - Z_RLE = 3; - Z_DEFAULT_STRATEGY = 0; - - Z_BINARY = 0; - Z_ASCII = 1; - Z_UNKNOWN = 2; - - Z_DEFLATED = 8; - -(* basic functions *) -function zlibVersion: PChar; -function deflateInit(var strm: z_stream; level: Integer): Integer; -function deflate(var strm: z_stream; flush: Integer): Integer; -function deflateEnd(var strm: z_stream): Integer; -function inflateInit(var strm: z_stream): Integer; -function inflate(var strm: z_stream; flush: Integer): Integer; -function inflateEnd(var strm: z_stream): Integer; - -(* advanced functions *) -function deflateInit2(var strm: z_stream; level, method, windowBits, - memLevel, strategy: Integer): Integer; -function deflateSetDictionary(var strm: z_stream; const dictionary: PChar; - dictLength: Integer): Integer; -function deflateCopy(var dest, source: z_stream): Integer; -function deflateReset(var strm: z_stream): Integer; -function deflateParams(var strm: z_stream; level, strategy: Integer): Integer; -function deflateBound(var strm: z_stream; sourceLen: LongInt): LongInt; -function deflatePrime(var strm: z_stream; bits, value: Integer): Integer; -function inflateInit2(var strm: z_stream; windowBits: Integer): Integer; -function inflateSetDictionary(var strm: z_stream; const dictionary: PChar; - dictLength: Integer): Integer; -function inflateSync(var strm: z_stream): Integer; -function inflateCopy(var dest, source: z_stream): Integer; -function inflateReset(var strm: z_stream): Integer; -function inflateBackInit(var strm: z_stream; - windowBits: Integer; window: PChar): Integer; -function inflateBack(var strm: z_stream; in_fn: in_func; in_desc: Pointer; - out_fn: out_func; out_desc: Pointer): Integer; -function inflateBackEnd(var strm: z_stream): Integer; -function zlibCompileFlags: LongInt; - -(* utility functions *) -function compress(dest: PChar; var destLen: LongInt; - const source: PChar; sourceLen: LongInt): Integer; -function compress2(dest: PChar; var destLen: LongInt; - const source: PChar; sourceLen: LongInt; - level: Integer): Integer; -function compressBound(sourceLen: LongInt): LongInt; -function uncompress(dest: PChar; var destLen: LongInt; - const source: PChar; sourceLen: LongInt): Integer; - -(* checksum functions *) -function adler32(adler: LongInt; const buf: PChar; len: Integer): LongInt; -function crc32(crc: LongInt; const buf: PChar; len: Integer): LongInt; - -(* various hacks, don't look :) *) -function deflateInit_(var strm: z_stream; level: Integer; - const version: PChar; stream_size: Integer): Integer; -function inflateInit_(var strm: z_stream; const version: PChar; - stream_size: Integer): Integer; -function deflateInit2_(var strm: z_stream; - level, method, windowBits, memLevel, strategy: Integer; - const version: PChar; stream_size: Integer): Integer; -function inflateInit2_(var strm: z_stream; windowBits: Integer; - const version: PChar; stream_size: Integer): Integer; -function inflateBackInit_(var strm: z_stream; - windowBits: Integer; window: PChar; - const version: PChar; stream_size: Integer): Integer; - - -implementation - -{$L adler32.obj} -{$L compress.obj} -{$L crc32.obj} -{$L deflate.obj} -{$L infback.obj} -{$L inffast.obj} -{$L inflate.obj} -{$L inftrees.obj} -{$L trees.obj} -{$L uncompr.obj} -{$L zutil.obj} - -function adler32; external; -function compress; external; -function compress2; external; -function compressBound; external; -function crc32; external; -function deflate; external; -function deflateBound; external; -function deflateCopy; external; -function deflateEnd; external; -function deflateInit_; external; -function deflateInit2_; external; -function deflateParams; external; -function deflatePrime; external; -function deflateReset; external; -function deflateSetDictionary; external; -function inflate; external; -function inflateBack; external; -function inflateBackEnd; external; -function inflateBackInit_; external; -function inflateCopy; external; -function inflateEnd; external; -function inflateInit_; external; -function inflateInit2_; external; -function inflateReset; external; -function inflateSetDictionary; external; -function inflateSync; external; -function uncompress; external; -function zlibCompileFlags; external; -function zlibVersion; external; - -function deflateInit(var strm: z_stream; level: Integer): Integer; -begin - Result := deflateInit_(strm, level, ZLIB_VERSION, sizeof(z_stream)); -end; - -function deflateInit2(var strm: z_stream; level, method, windowBits, memLevel, - strategy: Integer): Integer; -begin - Result := deflateInit2_(strm, level, method, windowBits, memLevel, strategy, - ZLIB_VERSION, sizeof(z_stream)); -end; - -function inflateInit(var strm: z_stream): Integer; -begin - Result := inflateInit_(strm, ZLIB_VERSION, sizeof(z_stream)); -end; - -function inflateInit2(var strm: z_stream; windowBits: Integer): Integer; -begin - Result := inflateInit2_(strm, windowBits, ZLIB_VERSION, sizeof(z_stream)); -end; - -function inflateBackInit(var strm: z_stream; - windowBits: Integer; window: PChar): Integer; -begin - Result := inflateBackInit_(strm, windowBits, window, - ZLIB_VERSION, sizeof(z_stream)); -end; - -function _malloc(Size: Integer): Pointer; cdecl; -begin - GetMem(Result, Size); -end; - -procedure _free(Block: Pointer); cdecl; -begin - FreeMem(Block); -end; - -procedure _memset(P: Pointer; B: Byte; count: Integer); cdecl; -begin - FillChar(P^, count, B); -end; - -procedure _memcpy(dest, source: Pointer; count: Integer); cdecl; -begin - Move(source^, dest^, count); -end; - -end. diff --git a/common/dist/zlib/contrib/puff/Makefile b/common/dist/zlib/contrib/puff/Makefile deleted file mode 100644 index b6b69404c..000000000 --- a/common/dist/zlib/contrib/puff/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -puff: puff.c puff.h - cc -DTEST -o puff puff.c - -test: puff - puff zeros.raw - -clean: - rm -f puff puff.o diff --git a/common/dist/zlib/contrib/puff/README b/common/dist/zlib/contrib/puff/README deleted file mode 100644 index bbc4cb595..000000000 --- a/common/dist/zlib/contrib/puff/README +++ /dev/null @@ -1,63 +0,0 @@ -Puff -- A Simple Inflate -3 Mar 2003 -Mark Adler -madler@alumni.caltech.edu - -What this is -- - -puff.c provides the routine puff() to decompress the deflate data format. It -does so more slowly than zlib, but the code is about one-fifth the size of the -inflate code in zlib, and written to be very easy to read. - -Why I wrote this -- - -puff.c was written to document the deflate format unambiguously, by virtue of -being working C code. It is meant to supplement RFC 1951, which formally -describes the deflate format. I have received many questions on details of the -deflate format, and I hope that reading this code will answer those questions. -puff.c is heavily commented with details of the deflate format, especially -those little nooks and cranies of the format that might not be obvious from a -specification. - -puff.c may also be useful in applications where code size or memory usage is a -very limited resource, and speed is not as important. - -How to use it -- - -Well, most likely you should just be reading puff.c and using zlib for actual -applications, but if you must ... - -Include puff.h in your code, which provides this prototype: - -int puff(unsigned char *dest, /* pointer to destination pointer */ - unsigned long *destlen, /* amount of output space */ - unsigned char *source, /* pointer to source data pointer */ - unsigned long *sourcelen); /* amount of input available */ - -Then you can call puff() to decompress a deflate stream that is in memory in -its entirety at source, to a sufficiently sized block of memory for the -decompressed data at dest. puff() is the only external symbol in puff.c The -only C library functions that puff.c needs are setjmp() and longjmp(), which -are used to simplify error checking in the code to improve readabilty. puff.c -does no memory allocation, and uses less than 2K bytes off of the stack. - -If destlen is not enough space for the uncompressed data, then inflate will -return an error without writing more than destlen bytes. Note that this means -that in order to decompress the deflate data successfully, you need to know -the size of the uncompressed data ahead of time. - -If needed, puff() can determine the size of the uncompressed data with no -output space. This is done by passing dest equal to (unsigned char *)0. Then -the initial value of *destlen is ignored and *destlen is set to the length of -the uncompressed data. So if the size of the uncompressed data is not known, -then two passes of puff() can be used--first to determine the size, and second -to do the actual inflation after allocating the appropriate memory. Not -pretty, but it works. (This is one of the reasons you should be using zlib.) - -The deflate format is self-terminating. If the deflate stream does not end -in *sourcelen bytes, puff() will return an error without reading at or past -endsource. - -On return, *sourcelen is updated to the amount of input data consumed, and -*destlen is updated to the size of the uncompressed data. See the comments -in puff.c for the possible return codes for puff(). diff --git a/common/dist/zlib/contrib/puff/zeros.raw b/common/dist/zlib/contrib/puff/zeros.raw deleted file mode 100644 index 637b7be6f5bfd577cec5537aaad160cc5fc0a7c7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1213 mcmaERu#o`>4lno_9RH9Zlo7-k1*0J_8UmvsFvvroKmq`7t_J-8 diff --git a/common/dist/zlib/contrib/testzlib/testzlib.txt b/common/dist/zlib/contrib/testzlib/testzlib.txt deleted file mode 100644 index 62258f149..000000000 --- a/common/dist/zlib/contrib/testzlib/testzlib.txt +++ /dev/null @@ -1,10 +0,0 @@ -To build testzLib with Visual Studio 2005: - -copy to a directory file from : -- root of zLib tree -- contrib/testzlib -- contrib/masmx86 -- contrib/masmx64 -- contrib/vstudio/vc7 - -and open testzlib8.sln \ No newline at end of file diff --git a/common/dist/zlib/contrib/untgz/Makefile b/common/dist/zlib/contrib/untgz/Makefile deleted file mode 100644 index b54266fba..000000000 --- a/common/dist/zlib/contrib/untgz/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CC=cc -CFLAGS=-g - -untgz: untgz.o ../../libz.a - $(CC) $(CFLAGS) -o untgz untgz.o -L../.. -lz - -untgz.o: untgz.c ../../zlib.h - $(CC) $(CFLAGS) -c -I../.. untgz.c - -../../libz.a: - cd ../..; ./configure; make - -clean: - rm -f untgz untgz.o *~ diff --git a/common/dist/zlib/contrib/untgz/Makefile.msc b/common/dist/zlib/contrib/untgz/Makefile.msc deleted file mode 100644 index 77b860221..000000000 --- a/common/dist/zlib/contrib/untgz/Makefile.msc +++ /dev/null @@ -1,17 +0,0 @@ -CC=cl -CFLAGS=-MD - -untgz.exe: untgz.obj ..\..\zlib.lib - $(CC) $(CFLAGS) untgz.obj ..\..\zlib.lib - -untgz.obj: untgz.c ..\..\zlib.h - $(CC) $(CFLAGS) -c -I..\.. untgz.c - -..\..\zlib.lib: - cd ..\.. - $(MAKE) -f win32\makefile.msc - cd contrib\untgz - -clean: - -del untgz.obj - -del untgz.exe diff --git a/common/dist/zlib/contrib/vstudio/readme.txt b/common/dist/zlib/contrib/vstudio/readme.txt deleted file mode 100644 index 16159f9cd..000000000 --- a/common/dist/zlib/contrib/vstudio/readme.txt +++ /dev/null @@ -1,73 +0,0 @@ -Building instructions for the DLL versions of Zlib 1.2.3 -======================================================== - -This directory contains projects that build zlib and minizip using -Microsoft Visual C++ 7.0/7.1, and Visual C++ . - -You don't need to build these projects yourself. You can download the -binaries from: - http://www.winimage.com/zLibDll - -More information can be found at this site. - - -Build instructions for Visual Studio 7.x (32 bits) --------------------------------------------------- -- Uncompress current zlib, including all contrib/* files -- Download the crtdll library from - http://www.winimage.com/zLibDll/crtdll.zip - Unzip crtdll.zip to extract crtdll.lib on contrib\vstudio\vc7. -- Open contrib\vstudio\vc7\zlibvc.sln with Microsoft Visual C++ 7.x - (Visual Studio .Net 2002 or 2003). - -Build instructions for Visual Studio 2005 (32 bits or 64 bits) --------------------------------------------------------------- -- Uncompress current zlib, including all contrib/* files -- For 32 bits only: download the crtdll library from - http://www.winimage.com/zLibDll/crtdll.zip - Unzip crtdll.zip to extract crtdll.lib on contrib\vstudio\vc8. -- Open contrib\vstudio\vc8\zlibvc.sln with Microsoft Visual C++ 8.0 - -Build instructions for Visual Studio 2005 64 bits, PSDK compiler ----------------------------------------------------------------- -at the time of writing this text file, Visual Studio 2005 (and - Microsoft Visual C++ 8.0) is on the beta 2 stage. -Using you can get the free 64 bits compiler from Platform SDK, - which is NOT a beta, and compile using the Visual studio 2005 IDE -see http://www.winimage.com/misc/sdk64onvs2005/ for instruction - -- Uncompress current zlib, including all contrib/* files -- start Visual Studio 2005 from a platform SDK command prompt, using - the /useenv switch -- Open contrib\vstudio\vc8\zlibvc.sln with Microsoft Visual C++ 8.0 - - -Important ---------- -- To use zlibwapi.dll in your application, you must define the - macro ZLIB_WINAPI when compiling your application's source files. - - -Additional notes ----------------- -- This DLL, named zlibwapi.dll, is compatible to the old zlib.dll built - by Gilles Vollant from the zlib 1.1.x sources, and distributed at - http://www.winimage.com/zLibDll - It uses the WINAPI calling convention for the exported functions, and - includes the minizip functionality. If your application needs that - particular build of zlib.dll, you can rename zlibwapi.dll to zlib.dll. - -- The new DLL was renamed because there exist several incompatible - versions of zlib.dll on the Internet. - -- There is also an official DLL build of zlib, named zlib1.dll. This one - is exporting the functions using the CDECL convention. See the file - win32\DLL_FAQ.txt found in this zlib distribution. - -- There used to be a ZLIB_DLL macro in zlib 1.1.x, but now this symbol - has a slightly different effect. To avoid compatibility problems, do - not define it here. - - -Gilles Vollant -info@winimage.com diff --git a/common/dist/zlib/contrib/vstudio/vc7/miniunz.vcproj b/common/dist/zlib/contrib/vstudio/vc7/miniunz.vcproj deleted file mode 100644 index ad5117c84..000000000 --- a/common/dist/zlib/contrib/vstudio/vc7/miniunz.vcproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc7/minizip.vcproj b/common/dist/zlib/contrib/vstudio/vc7/minizip.vcproj deleted file mode 100644 index fb5b6320d..000000000 --- a/common/dist/zlib/contrib/vstudio/vc7/minizip.vcproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc7/testzlib.vcproj b/common/dist/zlib/contrib/vstudio/vc7/testzlib.vcproj deleted file mode 100644 index 97bc3e8c8..000000000 --- a/common/dist/zlib/contrib/vstudio/vc7/testzlib.vcproj +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc7/zlib.rc b/common/dist/zlib/contrib/vstudio/vc7/zlib.rc deleted file mode 100644 index 72cb8b4c3..000000000 --- a/common/dist/zlib/contrib/vstudio/vc7/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1,2,3,0 - PRODUCTVERSION 1,2,3,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression library\0" - VALUE "FileVersion", "1.2.3.0\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlib.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/common/dist/zlib/contrib/vstudio/vc7/zlibstat.vcproj b/common/dist/zlib/contrib/vstudio/vc7/zlibstat.vcproj deleted file mode 100644 index 766d7a4d6..000000000 --- a/common/dist/zlib/contrib/vstudio/vc7/zlibstat.vcproj +++ /dev/null @@ -1,246 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc7/zlibvc.def b/common/dist/zlib/contrib/vstudio/vc7/zlibvc.def deleted file mode 100644 index a40e71541..000000000 --- a/common/dist/zlib/contrib/vstudio/vc7/zlibvc.def +++ /dev/null @@ -1,92 +0,0 @@ - -VERSION 1.23 - -HEAPSIZE 1048576,8192 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 diff --git a/common/dist/zlib/contrib/vstudio/vc7/zlibvc.sln b/common/dist/zlib/contrib/vstudio/vc7/zlibvc.sln deleted file mode 100644 index 927b42b7b..000000000 --- a/common/dist/zlib/contrib/vstudio/vc7/zlibvc.sln +++ /dev/null @@ -1,78 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 7.00 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testZlibDll", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654C}" -EndProject -Global - GlobalSection(SolutionConfiguration) = preSolution - ConfigName.0 = Debug - ConfigName.1 = Release - ConfigName.2 = ReleaseAxp - ConfigName.3 = ReleaseWithoutAsm - ConfigName.4 = ReleaseWithoutCrtdll - EndGlobalSection - GlobalSection(ProjectDependencies) = postSolution - EndGlobalSection - GlobalSection(ProjectConfiguration) = postSolution - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug.Build.0 = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release.Build.0 = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseAxp.ActiveCfg = ReleaseAxp|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseAxp.Build.0 = ReleaseAxp|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm.Build.0 = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutCrtdll.ActiveCfg = ReleaseAxp|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutCrtdll.Build.0 = ReleaseAxp|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug.Build.0 = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release.Build.0 = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseAxp.ActiveCfg = ReleaseAxp|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseAxp.Build.0 = ReleaseAxp|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm.Build.0 = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutCrtdll.ActiveCfg = ReleaseWithoutCrtdll|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutCrtdll.Build.0 = ReleaseWithoutCrtdll|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug.Build.0 = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAxp.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseAxp.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutCrtdll.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseAxp.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseAxp.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutCrtdll.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Debug.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Debug.Build.0 = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Release.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.Release.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseAxp.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseAxp.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutAsm.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutAsm.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutCrtdll.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654C}.ReleaseWithoutCrtdll.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - EndGlobalSection - GlobalSection(ExtensibilityAddIns) = postSolution - EndGlobalSection -EndGlobal diff --git a/common/dist/zlib/contrib/vstudio/vc7/zlibvc.vcproj b/common/dist/zlib/contrib/vstudio/vc7/zlibvc.vcproj deleted file mode 100644 index 8533b4947..000000000 --- a/common/dist/zlib/contrib/vstudio/vc7/zlibvc.vcproj +++ /dev/null @@ -1,445 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc8/miniunz.vcproj b/common/dist/zlib/contrib/vstudio/vc8/miniunz.vcproj deleted file mode 100644 index 4af53e8a3..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/miniunz.vcproj +++ /dev/null @@ -1,566 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc8/minizip.vcproj b/common/dist/zlib/contrib/vstudio/vc8/minizip.vcproj deleted file mode 100644 index 85f64c4d2..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/minizip.vcproj +++ /dev/null @@ -1,563 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc8/testzlib.vcproj b/common/dist/zlib/contrib/vstudio/vc8/testzlib.vcproj deleted file mode 100644 index 68c353991..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/testzlib.vcproj +++ /dev/null @@ -1,948 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc8/testzlibdll.vcproj b/common/dist/zlib/contrib/vstudio/vc8/testzlibdll.vcproj deleted file mode 100644 index f38ab5e08..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/testzlibdll.vcproj +++ /dev/null @@ -1,567 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc8/zlib.rc b/common/dist/zlib/contrib/vstudio/vc8/zlib.rc deleted file mode 100644 index 72cb8b4c3..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/zlib.rc +++ /dev/null @@ -1,32 +0,0 @@ -#include - -#define IDR_VERSION1 1 -IDR_VERSION1 VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE - FILEVERSION 1,2,3,0 - PRODUCTVERSION 1,2,3,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK - FILEFLAGS 0 - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - - BEGIN - VALUE "FileDescription", "zlib data compression library\0" - VALUE "FileVersion", "1.2.3.0\0" - VALUE "InternalName", "zlib\0" - VALUE "OriginalFilename", "zlib.dll\0" - VALUE "ProductName", "ZLib.DLL\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - VALUE "LegalCopyright", "(C) 1995-2003 Jean-loup Gailly & Mark Adler\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/common/dist/zlib/contrib/vstudio/vc8/zlibstat.vcproj b/common/dist/zlib/contrib/vstudio/vc8/zlibstat.vcproj deleted file mode 100644 index fb97037ac..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/zlibstat.vcproj +++ /dev/null @@ -1,870 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/contrib/vstudio/vc8/zlibvc.def b/common/dist/zlib/contrib/vstudio/vc8/zlibvc.def deleted file mode 100644 index a40e71541..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/zlibvc.def +++ /dev/null @@ -1,92 +0,0 @@ - -VERSION 1.23 - -HEAPSIZE 1048576,8192 - -EXPORTS - adler32 @1 - compress @2 - crc32 @3 - deflate @4 - deflateCopy @5 - deflateEnd @6 - deflateInit2_ @7 - deflateInit_ @8 - deflateParams @9 - deflateReset @10 - deflateSetDictionary @11 - gzclose @12 - gzdopen @13 - gzerror @14 - gzflush @15 - gzopen @16 - gzread @17 - gzwrite @18 - inflate @19 - inflateEnd @20 - inflateInit2_ @21 - inflateInit_ @22 - inflateReset @23 - inflateSetDictionary @24 - inflateSync @25 - uncompress @26 - zlibVersion @27 - gzprintf @28 - gzputc @29 - gzgetc @30 - gzseek @31 - gzrewind @32 - gztell @33 - gzeof @34 - gzsetparams @35 - zError @36 - inflateSyncPoint @37 - get_crc_table @38 - compress2 @39 - gzputs @40 - gzgets @41 - inflateCopy @42 - inflateBackInit_ @43 - inflateBack @44 - inflateBackEnd @45 - compressBound @46 - deflateBound @47 - gzclearerr @48 - gzungetc @49 - zlibCompileFlags @50 - deflatePrime @51 - - unzOpen @61 - unzClose @62 - unzGetGlobalInfo @63 - unzGetCurrentFileInfo @64 - unzGoToFirstFile @65 - unzGoToNextFile @66 - unzOpenCurrentFile @67 - unzReadCurrentFile @68 - unzOpenCurrentFile3 @69 - unztell @70 - unzeof @71 - unzCloseCurrentFile @72 - unzGetGlobalComment @73 - unzStringFileNameCompare @74 - unzLocateFile @75 - unzGetLocalExtrafield @76 - unzOpen2 @77 - unzOpenCurrentFile2 @78 - unzOpenCurrentFilePassword @79 - - zipOpen @80 - zipOpenNewFileInZip @81 - zipWriteInFileInZip @82 - zipCloseFileInZip @83 - zipClose @84 - zipOpenNewFileInZip2 @86 - zipCloseFileInZipRaw @87 - zipOpen2 @88 - zipOpenNewFileInZip3 @89 - - unzGetFilePos @100 - unzGoToFilePos @101 - - fill_win32_filefunc @110 diff --git a/common/dist/zlib/contrib/vstudio/vc8/zlibvc.sln b/common/dist/zlib/contrib/vstudio/vc8/zlibvc.sln deleted file mode 100644 index a815a5549..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/zlibvc.sln +++ /dev/null @@ -1,144 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 9.00 -# Visual Studio 2005 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibvc", "zlibvc.vcproj", "{8FD826F8-3739-44E6-8CC8-997122E53B8D}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "zlibstat", "zlibstat.vcproj", "{745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testzlib", "testzlib.vcproj", "{AA6666AA-E09F-4135-9C0C-4FE50C3C654B}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TestZlibDll", "testzlibdll.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694366A}" - ProjectSection(ProjectDependencies) = postProject - {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "minizip", "minizip.vcproj", "{48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}" - ProjectSection(ProjectDependencies) = postProject - {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "miniunz", "miniunz.vcproj", "{C52F9E7B-498A-42BE-8DB4-85A15694382A}" - ProjectSection(ProjectDependencies) = postProject - {8FD826F8-3739-44E6-8CC8-997122E53B8D} = {8FD826F8-3739-44E6-8CC8-997122E53B8D} - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Itanium = Debug|Itanium - Debug|Win32 = Debug|Win32 - Debug|x64 = Debug|x64 - Release|Itanium = Release|Itanium - Release|Win32 = Release|Win32 - Release|x64 = Release|x64 - ReleaseWithoutAsm|Itanium = ReleaseWithoutAsm|Itanium - ReleaseWithoutAsm|Win32 = ReleaseWithoutAsm|Win32 - ReleaseWithoutAsm|x64 = ReleaseWithoutAsm|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.ActiveCfg = Debug|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Itanium.Build.0 = Debug|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.ActiveCfg = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|Win32.Build.0 = Debug|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.ActiveCfg = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Debug|x64.Build.0 = Debug|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.ActiveCfg = Release|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Itanium.Build.0 = Release|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.ActiveCfg = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|Win32.Build.0 = Release|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.Release|x64.Build.0 = ReleaseWithoutAsm|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {8FD826F8-3739-44E6-8CC8-997122E53B8D}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.ActiveCfg = Debug|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Itanium.Build.0 = Debug|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.ActiveCfg = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|Win32.Build.0 = Debug|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.ActiveCfg = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Debug|x64.Build.0 = Debug|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.ActiveCfg = Release|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Itanium.Build.0 = Release|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.ActiveCfg = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|Win32.Build.0 = Release|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.ActiveCfg = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.Release|x64.Build.0 = Release|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {745DEC58-EBB3-47A9-A9B8-4C6627C01BF8}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = ReleaseWithoutAsm|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = ReleaseWithoutAsm|Itanium - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.Build.0 = ReleaseWithoutAsm|Win32 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = ReleaseWithoutAsm|x64 - {AA6666AA-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.Build.0 = ReleaseWithoutAsm|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.ActiveCfg = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Itanium.Build.0 = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694366A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.ActiveCfg = Debug|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Itanium.Build.0 = Debug|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.ActiveCfg = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|Win32.Build.0 = Debug|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.ActiveCfg = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Debug|x64.Build.0 = Debug|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.ActiveCfg = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Itanium.Build.0 = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.ActiveCfg = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|Win32.Build.0 = Release|Win32 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.ActiveCfg = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.Release|x64.Build.0 = Release|x64 - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium - {48CDD9DC-E09F-4135-9C0C-4FE50C3C654B}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.ActiveCfg = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Itanium.Build.0 = Debug|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.ActiveCfg = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|Win32.Build.0 = Debug|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.ActiveCfg = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Debug|x64.Build.0 = Debug|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.ActiveCfg = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|Win32.Build.0 = Release|Win32 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.ActiveCfg = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.Release|x64.Build.0 = Release|x64 - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Itanium.Build.0 = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|Win32.ActiveCfg = Release|Itanium - {C52F9E7B-498A-42BE-8DB4-85A15694382A}.ReleaseWithoutAsm|x64.ActiveCfg = Release|Itanium - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/common/dist/zlib/contrib/vstudio/vc8/zlibvc.vcproj b/common/dist/zlib/contrib/vstudio/vc8/zlibvc.vcproj deleted file mode 100644 index e717011df..000000000 --- a/common/dist/zlib/contrib/vstudio/vc8/zlibvc.vcproj +++ /dev/null @@ -1,1219 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/dist/zlib/examples/README.examples b/common/dist/zlib/examples/README.examples deleted file mode 100644 index 5632d7a4c..000000000 --- a/common/dist/zlib/examples/README.examples +++ /dev/null @@ -1,42 +0,0 @@ -This directory contains examples of the use of zlib. - -fitblk.c - compress just enough input to nearly fill a requested output size - - zlib isn't designed to do this, but fitblk does it anyway - -gun.c - uncompress a gzip file - - illustrates the use of inflateBack() for high speed file-to-file - decompression using call-back functions - - is approximately twice as fast as gzip -d - - also provides Unix uncompress functionality, again twice as fast - -gzappend.c - append to a gzip file - - illustrates the use of the Z_BLOCK flush parameter for inflate() - - illustrates the use of deflatePrime() to start at any bit - -gzjoin.c - join gzip files without recalculating the crc or recompressing - - illustrates the use of the Z_BLOCK flush parameter for inflate() - - illustrates the use of crc32_combine() - -gzlog.c -gzlog.h - efficiently maintain a message log file in gzip format - - illustrates use of raw deflate and Z_SYNC_FLUSH - - illustrates use of gzip header extra field - -zlib_how.html - painfully comprehensive description of zpipe.c (see below) - - describes in excruciating detail the use of deflate() and inflate() - -zpipe.c - reads and writes zlib streams from stdin to stdout - - illustrates the proper use of deflate() and inflate() - - deeply commented in zlib_how.html (see above) - -zran.c - index a zlib or gzip stream and randomly access it - - illustrates the use of Z_BLOCK, inflatePrime(), and - inflateSetDictionary() to provide random access diff --git a/common/dist/zlib/examples/zlib_how.html b/common/dist/zlib/examples/zlib_how.html deleted file mode 100644 index 40998dbf0..000000000 --- a/common/dist/zlib/examples/zlib_how.html +++ /dev/null @@ -1,523 +0,0 @@ - - - - -zlib Usage Example - - - -

zlib Usage Example

-We often get questions about how the deflate() and inflate() functions should be used. -Users wonder when they should provide more input, when they should use more output, -what to do with a Z_BUF_ERROR, how to make sure the process terminates properly, and -so on. So for those who have read zlib.h (a few times), and -would like further edification, below is an annotated example in C of simple routines to compress and decompress -from an input file to an output file using deflate() and inflate() respectively. The -annotations are interspersed between lines of the code. So please read between the lines. -We hope this helps explain some of the intricacies of zlib. -

-Without further adieu, here is the program zpipe.c: -


-/* zpipe.c: example of proper use of zlib's inflate() and deflate()
-   Not copyrighted -- provided to the public domain
-   Version 1.2  9 November 2004  Mark Adler */
-
-/* Version history:
-   1.0  30 Oct 2004  First version
-   1.1   8 Nov 2004  Add void casting for unused return values
-                     Use switch statement for inflate() return values
-   1.2   9 Nov 2004  Add assertions to document zlib guarantees
- */
-
-We now include the header files for the required definitions. From -stdio.h we use fopen(), fread(), fwrite(), -feof(), ferror(), and fclose() for file i/o, and -fputs() for error messages. From string.h we use -strcmp() for command line argument processing. -From assert.h we use the assert() macro. -From zlib.h -we use the basic compression functions deflateInit(), -deflate(), and deflateEnd(), and the basic decompression -functions inflateInit(), inflate(), and -inflateEnd(). -

-#include <stdio.h>
-#include <string.h>
-#include <assert.h>
-#include "zlib.h"
-
-CHUNK is simply the buffer size for feeding data to and pulling data -from the zlib routines. Larger buffer sizes would be more efficient, -especially for inflate(). If the memory is available, buffers sizes -on the order of 128K or 256K bytes should be used. -

-#define CHUNK 16384
-
-The def() routine compresses data from an input file to an output file. The output data -will be in the zlib format, which is different from the gzip or zip -formats. The zlib format has a very small header of only two bytes to identify it as -a zlib stream and to provide decoding information, and a four-byte trailer with a fast -check value to verify the integrity of the uncompressed data after decoding. -

-/* Compress from file source to file dest until EOF on source.
-   def() returns Z_OK on success, Z_MEM_ERROR if memory could not be
-   allocated for processing, Z_STREAM_ERROR if an invalid compression
-   level is supplied, Z_VERSION_ERROR if the version of zlib.h and the
-   version of the library linked do not match, or Z_ERRNO if there is
-   an error reading or writing the files. */
-int def(FILE *source, FILE *dest, int level)
-{
-
-Here are the local variables for def(). ret will be used for zlib -return codes. flush will keep track of the current flushing state for deflate(), -which is either no flushing, or flush to completion after the end of the input file is reached. -have is the amount of data returned from deflate(). The strm structure -is used to pass information to and from the zlib routines, and to maintain the -deflate() state. in and out are the input and output buffers for -deflate(). -

-    int ret, flush;
-    unsigned have;
-    z_stream strm;
-    char in[CHUNK];
-    char out[CHUNK];
-
-The first thing we do is to initialize the zlib state for compression using -deflateInit(). This must be done before the first use of deflate(). -The zalloc, zfree, and opaque fields in the strm -structure must be initialized before calling deflateInit(). Here they are -set to the zlib constant Z_NULL to request that zlib use -the default memory allocation routines. An application may also choose to provide -custom memory allocation routines here. deflateInit() will allocate on the -order of 256K bytes for the internal state. -(See zlib Technical Details.) -

-deflateInit() is called with a pointer to the structure to be initialized and -the compression level, which is an integer in the range of -1 to 9. Lower compression -levels result in faster execution, but less compression. Higher levels result in -greater compression, but slower execution. The zlib constant Z_DEFAULT_COMPRESSION, -equal to -1, -provides a good compromise between compression and speed and is equivalent to level 6. -Level 0 actually does no compression at all, and in fact expands the data slightly to produce -the zlib format (it is not a byte-for-byte copy of the input). -More advanced applications of zlib -may use deflateInit2() here instead. Such an application may want to reduce how -much memory will be used, at some price in compression. Or it may need to request a -gzip header and trailer instead of a zlib header and trailer, or raw -encoding with no header or trailer at all. -

-We must check the return value of deflateInit() against the zlib constant -Z_OK to make sure that it was able to -allocate memory for the internal state, and that the provided arguments were valid. -deflateInit() will also check that the version of zlib that the zlib.h -file came from matches the version of zlib actually linked with the program. This -is especially important for environments in which zlib is a shared library. -

-Note that an application can initialize multiple, independent zlib streams, which can -operate in parallel. The state information maintained in the structure allows the zlib -routines to be reentrant. -


-    /* allocate deflate state */
-    strm.zalloc = Z_NULL;
-    strm.zfree = Z_NULL;
-    strm.opaque = Z_NULL;
-    ret = deflateInit(&strm, level);
-    if (ret != Z_OK)
-        return ret;
-
-With the pleasantries out of the way, now we can get down to business. The outer do-loop -reads all of the input file and exits at the bottom of the loop once end-of-file is reached. -This loop contains the only call of deflate(). So we must make sure that all of the -input data has been processed and that all of the output data has been generated and consumed -before we fall out of the loop at the bottom. -

-    /* compress until end of file */
-    do {
-
-We start off by reading data from the input file. The number of bytes read is put directly -into avail_in, and a pointer to those bytes is put into next_in. We also -check to see if end-of-file on the input has been reached. If we are at the end of file, then flush is set to the -zlib constant Z_FINISH, which is later passed to deflate() to -indicate that this is the last chunk of input data to compress. We need to use feof() -to check for end-of-file as opposed to seeing if fewer than CHUNK bytes have been read. The -reason is that if the input file length is an exact multiple of CHUNK, we will miss -the fact that we got to the end-of-file, and not know to tell deflate() to finish -up the compressed stream. If we are not yet at the end of the input, then the zlib -constant Z_NO_FLUSH will be passed to deflate to indicate that we are still -in the middle of the uncompressed data. -

-If there is an error in reading from the input file, the process is aborted with -deflateEnd() being called to free the allocated zlib state before returning -the error. We wouldn't want a memory leak, now would we? deflateEnd() can be called -at any time after the state has been initialized. Once that's done, deflateInit() (or -deflateInit2()) would have to be called to start a new compression process. There is -no point here in checking the deflateEnd() return code. The deallocation can't fail. -


-        strm.avail_in = fread(in, 1, CHUNK, source);
-        if (ferror(source)) {
-            (void)deflateEnd(&strm);
-            return Z_ERRNO;
-        }
-        flush = feof(source) ? Z_FINISH : Z_NO_FLUSH;
-        strm.next_in = in;
-
-The inner do-loop passes our chunk of input data to deflate(), and then -keeps calling deflate() until it is done producing output. Once there is no more -new output, deflate() is guaranteed to have consumed all of the input, i.e., -avail_in will be zero. -

-        /* run deflate() on input until output buffer not full, finish
-           compression if all of source has been read in */
-        do {
-
-Output space is provided to deflate() by setting avail_out to the number -of available output bytes and next_out to a pointer to that space. -

-            strm.avail_out = CHUNK;
-            strm.next_out = out;
-
-Now we call the compression engine itself, deflate(). It takes as many of the -avail_in bytes at next_in as it can process, and writes as many as -avail_out bytes to next_out. Those counters and pointers are then -updated past the input data consumed and the output data written. It is the amount of -output space available that may limit how much input is consumed. -Hence the inner loop to make sure that -all of the input is consumed by providing more output space each time. Since avail_in -and next_in are updated by deflate(), we don't have to mess with those -between deflate() calls until it's all used up. -

-The parameters to deflate() are a pointer to the strm structure containing -the input and output information and the internal compression engine state, and a parameter -indicating whether and how to flush data to the output. Normally deflate will consume -several K bytes of input data before producing any output (except for the header), in order -to accumulate statistics on the data for optimum compression. It will then put out a burst of -compressed data, and proceed to consume more input before the next burst. Eventually, -deflate() -must be told to terminate the stream, complete the compression with provided input data, and -write out the trailer check value. deflate() will continue to compress normally as long -as the flush parameter is Z_NO_FLUSH. Once the Z_FINISH parameter is provided, -deflate() will begin to complete the compressed output stream. However depending on how -much output space is provided, deflate() may have to be called several times until it -has provided the complete compressed stream, even after it has consumed all of the input. The flush -parameter must continue to be Z_FINISH for those subsequent calls. -

-There are other values of the flush parameter that are used in more advanced applications. You can -force deflate() to produce a burst of output that encodes all of the input data provided -so far, even if it wouldn't have otherwise, for example to control data latency on a link with -compressed data. You can also ask that deflate() do that as well as erase any history up to -that point so that what follows can be decompressed independently, for example for random access -applications. Both requests will degrade compression by an amount depending on how often such -requests are made. -

-deflate() has a return value that can indicate errors, yet we do not check it here. Why -not? Well, it turns out that deflate() can do no wrong here. Let's go through -deflate()'s return values and dispense with them one by one. The possible values are -Z_OK, Z_STREAM_END, Z_STREAM_ERROR, or Z_BUF_ERROR. Z_OK -is, well, ok. Z_STREAM_END is also ok and will be returned for the last call of -deflate(). This is already guaranteed by calling deflate() with Z_FINISH -until it has no more output. Z_STREAM_ERROR is only possible if the stream is not -initialized properly, but we did initialize it properly. There is no harm in checking for -Z_STREAM_ERROR here, for example to check for the possibility that some -other part of the application inadvertently clobbered the memory containing the zlib state. -Z_BUF_ERROR will be explained further below, but -suffice it to say that this is simply an indication that deflate() could not consume -more input or produce more output. deflate() can be called again with more output space -or more available input, which it will be in this code. -


-            ret = deflate(&strm, flush);    /* no bad return value */
-            assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
-
-Now we compute how much output deflate() provided on the last call, which is the -difference between how much space was provided before the call, and how much output space -is still available after the call. Then that data, if any, is written to the output file. -We can then reuse the output buffer for the next call of deflate(). Again if there -is a file i/o error, we call deflateEnd() before returning to avoid a memory leak. -

-            have = CHUNK - strm.avail_out;
-            if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
-                (void)deflateEnd(&strm);
-                return Z_ERRNO;
-            }
-
-The inner do-loop is repeated until the last deflate() call fails to fill the -provided output buffer. Then we know that deflate() has done as much as it can with -the provided input, and that all of that input has been consumed. We can then fall out of this -loop and reuse the input buffer. -

-The way we tell that deflate() has no more output is by seeing that it did not fill -the output buffer, leaving avail_out greater than zero. However suppose that -deflate() has no more output, but just so happened to exactly fill the output buffer! -avail_out is zero, and we can't tell that deflate() has done all it can. -As far as we know, deflate() -has more output for us. So we call it again. But now deflate() produces no output -at all, and avail_out remains unchanged as CHUNK. That deflate() call -wasn't able to do anything, either consume input or produce output, and so it returns -Z_BUF_ERROR. (See, I told you I'd cover this later.) However this is not a problem at -all. Now we finally have the desired indication that deflate() is really done, -and so we drop out of the inner loop to provide more input to deflate(). -

-With flush set to Z_FINISH, this final set of deflate() calls will -complete the output stream. Once that is done, subsequent calls of deflate() would return -Z_STREAM_ERROR if the flush parameter is not Z_FINISH, and do no more processing -until the state is reinitialized. -

-Some applications of zlib have two loops that call deflate() -instead of the single inner loop we have here. The first loop would call -without flushing and feed all of the data to deflate(). The second loop would call -deflate() with no more -data and the Z_FINISH parameter to complete the process. As you can see from this -example, that can be avoided by simply keeping track of the current flush state. -


-        } while (strm.avail_out == 0);
-        assert(strm.avail_in == 0);     /* all input will be used */
-
-Now we check to see if we have already processed all of the input file. That information was -saved in the flush variable, so we see if that was set to Z_FINISH. If so, -then we're done and we fall out of the outer loop. We're guaranteed to get Z_STREAM_END -from the last deflate() call, since we ran it until the last chunk of input was -consumed and all of the output was generated. -

-        /* done when last data in file processed */
-    } while (flush != Z_FINISH);
-    assert(ret == Z_STREAM_END);        /* stream will be complete */
-
-The process is complete, but we still need to deallocate the state to avoid a memory leak -(or rather more like a memory hemorrhage if you didn't do this). Then -finally we can return with a happy return value. -

-    /* clean up and return */
-    (void)deflateEnd(&strm);
-    return Z_OK;
-}
-
-Now we do the same thing for decompression in the inf() routine. inf() -decompresses what is hopefully a valid zlib stream from the input file and writes the -uncompressed data to the output file. Much of the discussion above for def() -applies to inf() as well, so the discussion here will focus on the differences between -the two. -

-/* Decompress from file source to file dest until stream ends or EOF.
-   inf() returns Z_OK on success, Z_MEM_ERROR if memory could not be
-   allocated for processing, Z_DATA_ERROR if the deflate data is
-   invalid or incomplete, Z_VERSION_ERROR if the version of zlib.h and
-   the version of the library linked do not match, or Z_ERRNO if there
-   is an error reading or writing the files. */
-int inf(FILE *source, FILE *dest)
-{
-
-The local variables have the same functionality as they do for def(). The -only difference is that there is no flush variable, since inflate() -can tell from the zlib stream itself when the stream is complete. -

-    int ret;
-    unsigned have;
-    z_stream strm;
-    char in[CHUNK];
-    char out[CHUNK];
-
-The initialization of the state is the same, except that there is no compression level, -of course, and two more elements of the structure are initialized. avail_in -and next_in must be initialized before calling inflateInit(). This -is because the application has the option to provide the start of the zlib stream in -order for inflateInit() to have access to information about the compression -method to aid in memory allocation. In the current implementation of zlib -(up through versions 1.2.x), the method-dependent memory allocations are deferred to the first call of -inflate() anyway. However those fields must be initialized since later versions -of zlib that provide more compression methods may take advantage of this interface. -In any case, no decompression is performed by inflateInit(), so the -avail_out and next_out fields do not need to be initialized before calling. -

-Here avail_in is set to zero and next_in is set to Z_NULL to -indicate that no input data is being provided. -


-    /* allocate inflate state */
-    strm.zalloc = Z_NULL;
-    strm.zfree = Z_NULL;
-    strm.opaque = Z_NULL;
-    strm.avail_in = 0;
-    strm.next_in = Z_NULL;
-    ret = inflateInit(&strm);
-    if (ret != Z_OK)
-        return ret;
-
-The outer do-loop decompresses input until inflate() indicates -that it has reached the end of the compressed data and has produced all of the uncompressed -output. This is in contrast to def() which processes all of the input file. -If end-of-file is reached before the compressed data self-terminates, then the compressed -data is incomplete and an error is returned. -

-    /* decompress until deflate stream ends or end of file */
-    do {
-
-We read input data and set the strm structure accordingly. If we've reached the -end of the input file, then we leave the outer loop and report an error, since the -compressed data is incomplete. Note that we may read more data than is eventually consumed -by inflate(), if the input file continues past the zlib stream. -For applications where zlib streams are embedded in other data, this routine would -need to be modified to return the unused data, or at least indicate how much of the input -data was not used, so the application would know where to pick up after the zlib stream. -

-        strm.avail_in = fread(in, 1, CHUNK, source);
-        if (ferror(source)) {
-            (void)inflateEnd(&strm);
-            return Z_ERRNO;
-        }
-        if (strm.avail_in == 0)
-            break;
-        strm.next_in = in;
-
-The inner do-loop has the same function it did in def(), which is to -keep calling inflate() until has generated all of the output it can with the -provided input. -

-        /* run inflate() on input until output buffer not full */
-        do {
-
-Just like in def(), the same output space is provided for each call of inflate(). -

-            strm.avail_out = CHUNK;
-            strm.next_out = out;
-
-Now we run the decompression engine itself. There is no need to adjust the flush parameter, since -the zlib format is self-terminating. The main difference here is that there are -return values that we need to pay attention to. Z_DATA_ERROR -indicates that inflate() detected an error in the zlib compressed data format, -which means that either the data is not a zlib stream to begin with, or that the data was -corrupted somewhere along the way since it was compressed. The other error to be processed is -Z_MEM_ERROR, which can occur since memory allocation is deferred until inflate() -needs it, unlike deflate(), whose memory is allocated at the start by deflateInit(). -

-Advanced applications may use -deflateSetDictionary() to prime deflate() with a set of likely data to improve the -first 32K or so of compression. This is noted in the zlib header, so inflate() -requests that that dictionary be provided before it can start to decompress. Without the dictionary, -correct decompression is not possible. For this routine, we have no idea what the dictionary is, -so the Z_NEED_DICT indication is converted to a Z_DATA_ERROR. -

-inflate() can also return Z_STREAM_ERROR, which should not be possible here, -but could be checked for as noted above for def(). Z_BUF_ERROR does not need to be -checked for here, for the same reasons noted for def(). Z_STREAM_END will be -checked for later. -


-            ret = inflate(&strm, Z_NO_FLUSH);
-            assert(ret != Z_STREAM_ERROR);  /* state not clobbered */
-            switch (ret) {
-            case Z_NEED_DICT:
-                ret = Z_DATA_ERROR;     /* and fall through */
-            case Z_DATA_ERROR:
-            case Z_MEM_ERROR:
-                (void)inflateEnd(&strm);
-                return ret;
-            }
-
-The output of inflate() is handled identically to that of deflate(). -

-            have = CHUNK - strm.avail_out;
-            if (fwrite(out, 1, have, dest) != have || ferror(dest)) {
-                (void)inflateEnd(&strm);
-                return Z_ERRNO;
-            }
-
-The inner do-loop ends when inflate() has no more output as indicated -by not filling the output buffer, just as for deflate(). In this case, we cannot -assert that strm.avail_in will be zero, since the deflate stream may end before the file -does. -

-        } while (strm.avail_out == 0);
-
-The outer do-loop ends when inflate() reports that it has reached the -end of the input zlib stream, has completed the decompression and integrity -check, and has provided all of the output. This is indicated by the inflate() -return value Z_STREAM_END. The inner loop is guaranteed to leave ret -equal to Z_STREAM_END if the last chunk of the input file read contained the end -of the zlib stream. So if the return value is not Z_STREAM_END, the -loop continues to read more input. -

-        /* done when inflate() says it's done */
-    } while (ret != Z_STREAM_END);
-
-At this point, decompression successfully completed, or we broke out of the loop due to no -more data being available from the input file. If the last inflate() return value -is not Z_STREAM_END, then the zlib stream was incomplete and a data error -is returned. Otherwise, we return with a happy return value. Of course, inflateEnd() -is called first to avoid a memory leak. -

-    /* clean up and return */
-    (void)inflateEnd(&strm);
-    return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
-}
-
-That ends the routines that directly use zlib. The following routines make this -a command-line program by running data through the above routines from stdin to -stdout, and handling any errors reported by def() or inf(). -

-zerr() is used to interpret the possible error codes from def() -and inf(), as detailed in their comments above, and print out an error message. -Note that these are only a subset of the possible return values from deflate() -and inflate(). -


-/* report a zlib or i/o error */
-void zerr(int ret)
-{
-    fputs("zpipe: ", stderr);
-    switch (ret) {
-    case Z_ERRNO:
-        if (ferror(stdin))
-            fputs("error reading stdin\n", stderr);
-        if (ferror(stdout))
-            fputs("error writing stdout\n", stderr);
-        break;
-    case Z_STREAM_ERROR:
-        fputs("invalid compression level\n", stderr);
-        break;
-    case Z_DATA_ERROR:
-        fputs("invalid or incomplete deflate data\n", stderr);
-        break;
-    case Z_MEM_ERROR:
-        fputs("out of memory\n", stderr);
-        break;
-    case Z_VERSION_ERROR:
-        fputs("zlib version mismatch!\n", stderr);
-    }
-}
-
-Here is the main() routine used to test def() and inf(). The -zpipe command is simply a compression pipe from stdin to stdout, if -no arguments are given, or it is a decompression pipe if zpipe -d is used. If any other -arguments are provided, no compression or decompression is performed. Instead a usage -message is displayed. Examples are zpipe < foo.txt > foo.txt.z to compress, and -zpipe -d < foo.txt.z > foo.txt to decompress. -

-/* compress or decompress from stdin to stdout */
-int main(int argc, char **argv)
-{
-    int ret;
-
-    /* do compression if no arguments */
-    if (argc == 1) {
-        ret = def(stdin, stdout, Z_DEFAULT_COMPRESSION);
-        if (ret != Z_OK)
-            zerr(ret);
-        return ret;
-    }
-
-    /* do decompression if -d specified */
-    else if (argc == 2 && strcmp(argv[1], "-d") == 0) {
-        ret = inf(stdin, stdout);
-        if (ret != Z_OK)
-            zerr(ret);
-        return ret;
-    }
-
-    /* otherwise, report usage */
-    else {
-        fputs("zpipe usage: zpipe [-d] < source > dest\n", stderr);
-        return 1;
-    }
-}
-
-
-Copyright (c) 2004 by Mark Adler
Last modified 13 November 2004
- - diff --git a/common/dist/zlib/make_vms.com b/common/dist/zlib/make_vms.com deleted file mode 100644 index c2a1fb54b..000000000 --- a/common/dist/zlib/make_vms.com +++ /dev/null @@ -1,461 +0,0 @@ -$! make libz under VMS written by -$! Martin P.J. Zinser -$! -$! -$ on error then goto err_exit -$! -$! -$! Just some general constants... -$! -$ true = 1 -$ false = 0 -$ tmpnam = "temp_" + f$getjpi("","pid") -$ SAY = "WRITE SYS$OUTPUT" -$! -$! Setup variables holding "config" information -$! -$ Make = "" -$ name = "Zlib" -$ version = "?.?.?" -$ v_string = "ZLIB_VERSION" -$ v_file = "zlib.h" -$ ccopt = "" -$ lopts = "" -$ linkonly = false -$ optfile = name + ".opt" -$ its_decc = false -$ its_vaxc = false -$ its_gnuc = false -$ axp = f$getsyi("HW_MODEL").ge.1024 -$ s_case = false -$! Check for MMK/MMS -$! -$ If F$Search ("Sys$System:MMS.EXE") .nes. "" Then Make = "MMS" -$ If F$Type (MMK) .eqs. "STRING" Then Make = "MMK" -$! -$! -$ gosub find_version -$! -$ gosub check_opts -$! -$! Look for the compiler used -$! -$ gosub check_compiler -$ if its_decc -$ then -$ ccopt = "/prefix=all" + ccopt -$ if f$trnlnm("SYS") .eqs. "" -$ then -$ if axp -$ then -$ define sys sys$library: -$ else -$ ccopt = "/decc" + ccopt -$ define sys decc$library_include: -$ endif -$ endif -$ endif -$ if its_vaxc .or. its_gnuc -$ then -$ if f$trnlnm("SYS").eqs."" then define sys sys$library: -$ endif -$! -$! Build the thing plain or with mms -$! -$ write sys$output "Compiling Zlib sources ..." -$ if make.eqs."" -$ then -$ dele example.obj;*,minigzip.obj;* -$ CALL MAKE adler32.OBJ "CC ''CCOPT' adler32" - - adler32.c zlib.h zconf.h -$ CALL MAKE compress.OBJ "CC ''CCOPT' compress" - - compress.c zlib.h zconf.h -$ CALL MAKE crc32.OBJ "CC ''CCOPT' crc32" - - crc32.c zlib.h zconf.h -$ CALL MAKE deflate.OBJ "CC ''CCOPT' deflate" - - deflate.c deflate.h zutil.h zlib.h zconf.h -$ CALL MAKE gzio.OBJ "CC ''CCOPT' gzio" - - gzio.c zutil.h zlib.h zconf.h -$ CALL MAKE infback.OBJ "CC ''CCOPT' infback" - - infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h -$ CALL MAKE inffast.OBJ "CC ''CCOPT' inffast" - - inffast.c zutil.h zlib.h zconf.h inffast.h -$ CALL MAKE inflate.OBJ "CC ''CCOPT' inflate" - - inflate.c zutil.h zlib.h zconf.h infblock.h -$ CALL MAKE inftrees.OBJ "CC ''CCOPT' inftrees" - - inftrees.c zutil.h zlib.h zconf.h inftrees.h -$ CALL MAKE trees.OBJ "CC ''CCOPT' trees" - - trees.c deflate.h zutil.h zlib.h zconf.h -$ CALL MAKE uncompr.OBJ "CC ''CCOPT' uncompr" - - uncompr.c zlib.h zconf.h -$ CALL MAKE zutil.OBJ "CC ''CCOPT' zutil" - - zutil.c zutil.h zlib.h zconf.h -$ write sys$output "Building Zlib ..." -$ CALL MAKE libz.OLB "lib/crea libz.olb *.obj" *.OBJ -$ write sys$output "Building example..." -$ CALL MAKE example.OBJ "CC ''CCOPT' example" - - example.c zlib.h zconf.h -$ call make example.exe "LINK example,libz.olb/lib" example.obj libz.olb -$ if f$search("x11vms:xvmsutils.olb") .nes. "" -$ then -$ write sys$output "Building minigzip..." -$ CALL MAKE minigzip.OBJ "CC ''CCOPT' minigzip" - - minigzip.c zlib.h zconf.h -$ call make minigzip.exe - - "LINK minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib" - - minigzip.obj libz.olb -$ endif -$ else -$ gosub crea_mms -$ SAY "Make ''name' ''version' with ''Make' " -$ 'make' -$ endif -$! -$! Alpha gets a shareable image -$! -$ If axp -$ Then -$ gosub crea_olist -$ write sys$output "Creating libzshr.exe" -$ call anal_obj_axp modules.opt _link.opt -$ if s_case -$ then -$ open/append optf modules.opt -$ write optf "case_sensitive=YES" -$ close optf -$ endif -$ LINK_'lopts'/SHARE=libzshr.exe modules.opt/opt,_link.opt/opt -$ endif -$ write sys$output "Zlib build completed" -$ exit -$CC_ERR: -$ write sys$output "C compiler required to build ''name'" -$ goto err_exit -$ERR_EXIT: -$ set message/facil/ident/sever/text -$ write sys$output "Exiting..." -$ exit 2 -$! -$! -$MAKE: SUBROUTINE !SUBROUTINE TO CHECK DEPENDENCIES -$ V = 'F$Verify(0) -$! P1 = What we are trying to make -$! P2 = Command to make it -$! P3 - P8 What it depends on -$ -$ If F$Search(P1) .Eqs. "" Then Goto Makeit -$ Time = F$CvTime(F$File(P1,"RDT")) -$arg=3 -$Loop: -$ Argument = P'arg -$ If Argument .Eqs. "" Then Goto Exit -$ El=0 -$Loop2: -$ File = F$Element(El," ",Argument) -$ If File .Eqs. " " Then Goto Endl -$ AFile = "" -$Loop3: -$ OFile = AFile -$ AFile = F$Search(File) -$ If AFile .Eqs. "" .Or. AFile .Eqs. OFile Then Goto NextEl -$ If F$CvTime(F$File(AFile,"RDT")) .Ges. Time Then Goto Makeit -$ Goto Loop3 -$NextEL: -$ El = El + 1 -$ Goto Loop2 -$EndL: -$ arg=arg+1 -$ If arg .Le. 8 Then Goto Loop -$ Goto Exit -$ -$Makeit: -$ VV=F$VERIFY(0) -$ write sys$output P2 -$ 'P2 -$ VV='F$Verify(VV) -$Exit: -$ If V Then Set Verify -$ENDSUBROUTINE -$!------------------------------------------------------------------------------ -$! -$! Check command line options and set symbols accordingly -$! -$ CHECK_OPTS: -$ i = 1 -$ OPT_LOOP: -$ if i .lt. 9 -$ then -$ cparm = f$edit(p'i',"upcase") -$ if cparm .eqs. "DEBUG" -$ then -$ ccopt = ccopt + "/noopt/deb" -$ lopts = lopts + "/deb" -$ endif -$ if f$locate("CCOPT=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ ccopt = ccopt + f$extract(start,len,cparm) -$ if f$locate("AS_IS",f$edit(ccopt,"UPCASE")) .lt. f$length(ccopt) - - then s_case = true -$ endif -$ if cparm .eqs. "LINK" then linkonly = true -$ if f$locate("LOPTS=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ lopts = lopts + f$extract(start,len,cparm) -$ endif -$ if f$locate("CC=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ cc_com = f$extract(start,len,cparm) - if (cc_com .nes. "DECC") .and. - - (cc_com .nes. "VAXC") .and. - - (cc_com .nes. "GNUC") -$ then -$ write sys$output "Unsupported compiler choice ''cc_com' ignored" -$ write sys$output "Use DECC, VAXC, or GNUC instead" -$ else -$ if cc_com .eqs. "DECC" then its_decc = true -$ if cc_com .eqs. "VAXC" then its_vaxc = true -$ if cc_com .eqs. "GNUC" then its_gnuc = true -$ endif -$ endif -$ if f$locate("MAKE=",cparm) .lt. f$length(cparm) -$ then -$ start = f$locate("=",cparm) + 1 -$ len = f$length(cparm) - start -$ mmks = f$extract(start,len,cparm) -$ if (mmks .eqs. "MMK") .or. (mmks .eqs. "MMS") -$ then -$ make = mmks -$ else -$ write sys$output "Unsupported make choice ''mmks' ignored" -$ write sys$output "Use MMK or MMS instead" -$ endif -$ endif -$ i = i + 1 -$ goto opt_loop -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Look for the compiler used -$! -$CHECK_COMPILER: -$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) -$ then -$ its_decc = (f$search("SYS$SYSTEM:DECC$COMPILER.EXE") .nes. "") -$ its_vaxc = .not. its_decc .and. (F$Search("SYS$System:VAXC.Exe") .nes. "") -$ its_gnuc = .not. (its_decc .or. its_vaxc) .and. (f$trnlnm("gnu_cc") .nes. "") -$ endif -$! -$! Exit if no compiler available -$! -$ if (.not. (its_decc .or. its_vaxc .or. its_gnuc)) -$ then goto CC_ERR -$ else -$ if its_decc then write sys$output "CC compiler check ... Compaq C" -$ if its_vaxc then write sys$output "CC compiler check ... VAX C" -$ if its_gnuc then write sys$output "CC compiler check ... GNU C" -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! If MMS/MMK are available dump out the descrip.mms if required -$! -$CREA_MMS: -$ write sys$output "Creating descrip.mms..." -$ create descrip.mms -$ open/append out descrip.mms -$ copy sys$input: out -$ deck -# descrip.mms: MMS description file for building zlib on VMS -# written by Martin P.J. Zinser -# - -OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj, infback.obj\ - deflate.obj, trees.obj, zutil.obj, inflate.obj, \ - inftrees.obj, inffast.obj - -$ eod -$ write out "CFLAGS=", ccopt -$ write out "LOPTS=", lopts -$ copy sys$input: out -$ deck - -all : example.exe minigzip.exe libz.olb - @ write sys$output " Example applications available" - -libz.olb : libz.olb($(OBJS)) - @ write sys$output " libz available" - -example.exe : example.obj libz.olb - link $(LOPTS) example,libz.olb/lib - -minigzip.exe : minigzip.obj libz.olb - link $(LOPTS) minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib - -clean : - delete *.obj;*,libz.olb;*,*.opt;*,*.exe;* - - -# Other dependencies. -adler32.obj : adler32.c zutil.h zlib.h zconf.h -compress.obj : compress.c zlib.h zconf.h -crc32.obj : crc32.c zutil.h zlib.h zconf.h -deflate.obj : deflate.c deflate.h zutil.h zlib.h zconf.h -example.obj : example.c zlib.h zconf.h -gzio.obj : gzio.c zutil.h zlib.h zconf.h -inffast.obj : inffast.c zutil.h zlib.h zconf.h inftrees.h inffast.h -inflate.obj : inflate.c zutil.h zlib.h zconf.h -inftrees.obj : inftrees.c zutil.h zlib.h zconf.h inftrees.h -minigzip.obj : minigzip.c zlib.h zconf.h -trees.obj : trees.c deflate.h zutil.h zlib.h zconf.h -uncompr.obj : uncompr.c zlib.h zconf.h -zutil.obj : zutil.c zutil.h zlib.h zconf.h -infback.obj : infback.c zutil.h inftrees.h inflate.h inffast.h inffixed.h -$ eod -$ close out -$ return -$!------------------------------------------------------------------------------ -$! -$! Read list of core library sources from makefile.in and create options -$! needed to build shareable image -$! -$CREA_OLIST: -$ open/read min makefile.in -$ open/write mod modules.opt -$ src_check = "OBJS =" -$MRLOOP: -$ read/end=mrdone min rec -$ if (f$extract(0,6,rec) .nes. src_check) then goto mrloop -$ rec = rec - src_check -$ gosub extra_filnam -$ if (f$element(1,"\",rec) .eqs. "\") then goto mrdone -$MRSLOOP: -$ read/end=mrdone min rec -$ gosub extra_filnam -$ if (f$element(1,"\",rec) .nes. "\") then goto mrsloop -$MRDONE: -$ close min -$ close mod -$ return -$!------------------------------------------------------------------------------ -$! -$! Take record extracted in crea_olist and split it into single filenames -$! -$EXTRA_FILNAM: -$ myrec = f$edit(rec - "\", "trim,compress") -$ i = 0 -$FELOOP: -$ srcfil = f$element(i," ", myrec) -$ if (srcfil .nes. " ") -$ then -$ write mod f$parse(srcfil,,,"NAME"), ".obj" -$ i = i + 1 -$ goto feloop -$ endif -$ return -$!------------------------------------------------------------------------------ -$! -$! Find current Zlib version number -$! -$FIND_VERSION: -$ open/read h_in 'v_file' -$hloop: -$ read/end=hdone h_in rec -$ rec = f$edit(rec,"TRIM") -$ if (f$extract(0,1,rec) .nes. "#") then goto hloop -$ rec = f$edit(rec - "#", "TRIM") -$ if f$element(0," ",rec) .nes. "define" then goto hloop -$ if f$element(1," ",rec) .eqs. v_string -$ then -$ version = 'f$element(2," ",rec)' -$ goto hdone -$ endif -$ goto hloop -$hdone: -$ close h_in -$ return -$!------------------------------------------------------------------------------ -$! -$! Analyze Object files for OpenVMS AXP to extract Procedure and Data -$! information to build a symbol vector for a shareable image -$! All the "brains" of this logic was suggested by Hartmut Becker -$! (Hartmut.Becker@compaq.com). All the bugs were introduced by me -$! (zinser@decus.de), so if you do have problem reports please do not -$! bother Hartmut/HP, but get in touch with me -$! -$ ANAL_OBJ_AXP: Subroutine -$ V = 'F$Verify(0) -$ SAY := "WRITE_ SYS$OUTPUT" -$ -$ IF F$SEARCH("''P1'") .EQS. "" -$ THEN -$ SAY "ANAL_OBJ_AXP-E-NOSUCHFILE: Error, inputfile ''p1' not available" -$ goto exit_aa -$ ENDIF -$ IF "''P2'" .EQS. "" -$ THEN -$ SAY "ANAL_OBJ_AXP: Error, no output file provided" -$ goto exit_aa -$ ENDIF -$ -$ open/read in 'p1 -$ create a.tmp -$ open/append atmp a.tmp -$ loop: -$ read/end=end_loop in line -$ f= f$search(line) -$ if f .eqs. "" -$ then -$ write sys$output "ANAL_OBJ_AXP-w-nosuchfile, ''line'" -$ goto loop -$ endif -$ define/user sys$output nl: -$ define/user sys$error nl: -$ anal/obj/gsd 'f /out=x.tmp -$ open/read xtmp x.tmp -$ XLOOP: -$ read/end=end_xloop xtmp xline -$ xline = f$edit(xline,"compress") -$ write atmp xline -$ goto xloop -$ END_XLOOP: -$ close xtmp -$ goto loop -$ end_loop: -$ close in -$ close atmp -$ if f$search("a.tmp") .eqs. "" - - then $ exit -$ ! all global definitions -$ search a.tmp "symbol:","EGSY$V_DEF 1","EGSY$V_NORM 1"/out=b.tmp -$ ! all procedures -$ search b.tmp "EGSY$V_NORM 1"/wind=(0,1) /out=c.tmp -$ search c.tmp "symbol:"/out=d.tmp -$ define/user sys$output nl: -$ edito/edt/command=sys$input d.tmp -sub/symbol: "/symbol_vector=(/whole -sub/"/=PROCEDURE)/whole -exit -$ ! all data -$ search b.tmp "EGSY$V_DEF 1"/wind=(0,1) /out=e.tmp -$ search e.tmp "symbol:"/out=f.tmp -$ define/user sys$output nl: -$ edito/edt/command=sys$input f.tmp -sub/symbol: "/symbol_vector=(/whole -sub/"/=DATA)/whole -exit -$ sort/nodupl d.tmp,f.tmp 'p2' -$ delete a.tmp;*,b.tmp;*,c.tmp;*,d.tmp;*,e.tmp;*,f.tmp;* -$ if f$search("x.tmp") .nes. "" - - then $ delete x.tmp;* -$! -$ EXIT_AA: -$ if V then set verify -$ endsubroutine -$!------------------------------------------------------------------------------ diff --git a/common/dist/zlib/msdos/Makefile.bor b/common/dist/zlib/msdos/Makefile.bor deleted file mode 100644 index 8f8132d12..000000000 --- a/common/dist/zlib/msdos/Makefile.bor +++ /dev/null @@ -1,109 +0,0 @@ -# Makefile for zlib -# Borland C++ -# Last updated: 15-Mar-2003 - -# To use, do "make -fmakefile.bor" -# To compile in small model, set below: MODEL=s - -# WARNING: the small model is supported but only for small values of -# MAX_WBITS and MAX_MEM_LEVEL. For example: -# -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3 -# If you wish to reduce the memory requirements (default 256K for big -# objects plus a few K), you can add to the LOC macro below: -# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 -# See zconf.h for details about the memory requirements. - -# ------------ Turbo C++, Borland C++ ------------ - -# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) -# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added -# to the declaration of LOC here: -LOC = $(LOCAL_ZLIB) - -# type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. -CPU_TYP = 0 - -# memory model: one of s, m, c, l (small, medium, compact, large) -MODEL=l - -# replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version -CC=bcc -LD=bcc -AR=tlib - -# compiler flags -# replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0 -CFLAGS=-O2 -Z -m$(MODEL) $(LOC) - -LDFLAGS=-m$(MODEL) -f- - - -# variables -ZLIB_LIB = zlib_$(MODEL).lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj -OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj -OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzio.obj: gzio.c zutil.h zlib.h zconf.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: example.c zlib.h zconf.h - -minigzip.obj: minigzip.c zlib.h zconf.h - - -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -clean: - -del *.obj - -del *.lib - -del *.exe - -del zlib_*.bak - -del foo.gz diff --git a/common/dist/zlib/msdos/Makefile.dj2 b/common/dist/zlib/msdos/Makefile.dj2 deleted file mode 100644 index 283d1d961..000000000 --- a/common/dist/zlib/msdos/Makefile.dj2 +++ /dev/null @@ -1,104 +0,0 @@ -# Makefile for zlib. Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96. -# Copyright (C) 1995-1998 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile, or to compile and test, type: -# -# make -fmakefile.dj2; make test -fmakefile.dj2 -# -# To install libz.a, zconf.h and zlib.h in the djgpp directories, type: -# -# make install -fmakefile.dj2 -# -# after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as -# in the sample below if the pattern of the DJGPP distribution is to -# be followed. Remember that, while 'es around <=> are ignored in -# makefiles, they are *not* in batch files or in djgpp.env. -# - - - - - -# [make] -# INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include -# LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib -# BUTT=-m486 -# - - - - - -# Alternately, these variables may be defined below, overriding the values -# in djgpp.env, as -# INCLUDE_PATH=c:\usr\include -# LIBRARY_PATH=c:\usr\lib - -CC=gcc - -#CFLAGS=-MMD -O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-MMD -g -DDEBUG -CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ - -Wstrict-prototypes -Wmissing-prototypes - -# If cp.exe is available, replace "copy /Y" with "cp -fp" . -CP=copy /Y -# If gnu install.exe is available, replace $(CP) with ginstall. -INSTALL=$(CP) -# The default value of RM is "rm -f." If "rm.exe" is found, comment out: -RM=del -LDLIBS=-L. -lz -LD=$(CC) -s -o -LDSHARED=$(CC) - -INCL=zlib.h zconf.h -LIBS=libz.a - -AR=ar rcs - -prefix=/usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -OBJA = -# to use the asm code: make OBJA=match.o - -TEST_OBJS = example.o minigzip.o - -all: example.exe minigzip.exe - -check: test -test: all - ./example - echo hello world | .\minigzip | .\minigzip -d - -%.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -libz.a: $(OBJS) $(OBJA) - $(AR) $@ $(OBJS) $(OBJA) - -%.exe : %.o $(LIBS) - $(LD) $@ $< $(LDLIBS) - -# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env . - -.PHONY : uninstall clean - -install: $(INCL) $(LIBS) - -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH) - -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH) - $(INSTALL) zlib.h $(INCLUDE_PATH) - $(INSTALL) zconf.h $(INCLUDE_PATH) - $(INSTALL) libz.a $(LIBRARY_PATH) - -uninstall: - $(RM) $(INCLUDE_PATH)\zlib.h - $(RM) $(INCLUDE_PATH)\zconf.h - $(RM) $(LIBRARY_PATH)\libz.a - -clean: - $(RM) *.d - $(RM) *.o - $(RM) *.exe - $(RM) libz.a - $(RM) foo.gz - -DEPS := $(wildcard *.d) -ifneq ($(DEPS),) -include $(DEPS) -endif diff --git a/common/dist/zlib/msdos/Makefile.emx b/common/dist/zlib/msdos/Makefile.emx deleted file mode 100644 index ed4c31fbb..000000000 --- a/common/dist/zlib/msdos/Makefile.emx +++ /dev/null @@ -1,69 +0,0 @@ -# Makefile for zlib. Modified for emx 0.9c by Chr. Spieler, 6/17/98. -# Copyright (C) 1995-1998 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile, or to compile and test, type: -# -# make -fmakefile.emx; make test -fmakefile.emx -# - -CC=gcc - -#CFLAGS=-MMD -O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-MMD -g -DDEBUG -CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ - -Wstrict-prototypes -Wmissing-prototypes - -# If cp.exe is available, replace "copy /Y" with "cp -fp" . -CP=copy /Y -# If gnu install.exe is available, replace $(CP) with ginstall. -INSTALL=$(CP) -# The default value of RM is "rm -f." If "rm.exe" is found, comment out: -RM=del -LDLIBS=-L. -lzlib -LD=$(CC) -s -o -LDSHARED=$(CC) - -INCL=zlib.h zconf.h -LIBS=zlib.a - -AR=ar rcs - -prefix=/usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -TEST_OBJS = example.o minigzip.o - -all: example.exe minigzip.exe - -test: all - ./example - echo hello world | .\minigzip | .\minigzip -d - -%.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -zlib.a: $(OBJS) - $(AR) $@ $(OBJS) - -%.exe : %.o $(LIBS) - $(LD) $@ $< $(LDLIBS) - - -.PHONY : clean - -clean: - $(RM) *.d - $(RM) *.o - $(RM) *.exe - $(RM) zlib.a - $(RM) foo.gz - -DEPS := $(wildcard *.d) -ifneq ($(DEPS),) -include $(DEPS) -endif diff --git a/common/dist/zlib/msdos/Makefile.msc b/common/dist/zlib/msdos/Makefile.msc deleted file mode 100644 index b8fc665ef..000000000 --- a/common/dist/zlib/msdos/Makefile.msc +++ /dev/null @@ -1,106 +0,0 @@ -# Makefile for zlib -# Microsoft C 5.1 or later -# Last updated: 19-Mar-2003 - -# To use, do "make makefile.msc" -# To compile in small model, set below: MODEL=S - -# If you wish to reduce the memory requirements (default 256K for big -# objects plus a few K), you can add to the LOC macro below: -# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 -# See zconf.h for details about the memory requirements. - -# ------------- Microsoft C 5.1 and later ------------- - -# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) -# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added -# to the declaration of LOC here: -LOC = $(LOCAL_ZLIB) - -# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. -CPU_TYP = 0 - -# Memory model: one of S, M, C, L (small, medium, compact, large) -MODEL=L - -CC=cl -CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC) -#-Ox generates bad code with MSC 5.1 -LIB_CFLAGS=-Zl $(CFLAGS) - -LD=link -LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode -# "/farcall/packcode" are only useful for `large code' memory models -# but should be a "no-op" for small code models. - - -# variables -ZLIB_LIB = zlib_$(MODEL).lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj -OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(LIB_CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzio.obj: gzio.c zutil.h zlib.h zconf.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: example.c zlib.h zconf.h - $(CC) -c $(CFLAGS) $*.c - -minigzip.obj: minigzip.c zlib.h zconf.h - $(CC) -c $(CFLAGS) $*.c - - -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - if exist $(ZLIB_LIB) del $(ZLIB_LIB) - lib $(ZLIB_LIB) $(OBJ1); - lib $(ZLIB_LIB) $(OBJ2); - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB); - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB); - -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -clean: - -del *.obj - -del *.lib - -del *.exe - -del *.map - -del zlib_*.bak - -del foo.gz diff --git a/common/dist/zlib/msdos/Makefile.tc b/common/dist/zlib/msdos/Makefile.tc deleted file mode 100644 index 480750ade..000000000 --- a/common/dist/zlib/msdos/Makefile.tc +++ /dev/null @@ -1,94 +0,0 @@ -# Makefile for zlib -# Turbo C 2.01, Turbo C++ 1.01 -# Last updated: 15-Mar-2003 - -# To use, do "make -fmakefile.tc" -# To compile in small model, set below: MODEL=s - -# WARNING: the small model is supported but only for small values of -# MAX_WBITS and MAX_MEM_LEVEL. For example: -# -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 -# If you wish to reduce the memory requirements (default 256K for big -# objects plus a few K), you can add to CFLAGS below: -# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 -# See zconf.h for details about the memory requirements. - -# ------------ Turbo C 2.01, Turbo C++ 1.01 ------------ -MODEL=l -CC=tcc -LD=tcc -AR=tlib -# CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3 -CFLAGS=-O2 -G -Z -m$(MODEL) -LDFLAGS=-m$(MODEL) -f- - - -# variables -ZLIB_LIB = zlib_$(MODEL).lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj -OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj -OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $*.c - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzio.obj: gzio.c zutil.h zlib.h zconf.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: example.c zlib.h zconf.h - -minigzip.obj: minigzip.c zlib.h zconf.h - - -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -clean: - -del *.obj - -del *.lib - -del *.exe - -del zlib_*.bak - -del foo.gz diff --git a/common/dist/zlib/old/Makefile.riscos b/common/dist/zlib/old/Makefile.riscos deleted file mode 100644 index 57e29d3fb..000000000 --- a/common/dist/zlib/old/Makefile.riscos +++ /dev/null @@ -1,151 +0,0 @@ -# Project: zlib_1_03 -# Patched for zlib 1.1.2 rw@shadow.org.uk 19980430 -# test works out-of-the-box, installs `somewhere' on demand - -# Toolflags: -CCflags = -c -depend !Depend -IC: -g -throwback -DRISCOS -fah -C++flags = -c -depend !Depend -IC: -throwback -Linkflags = -aif -c++ -o $@ -ObjAsmflags = -throwback -NoCache -depend !Depend -CMHGflags = -LibFileflags = -c -l -o $@ -Squeezeflags = -o $@ - -# change the line below to where _you_ want the library installed. -libdest = lib:zlib - -# Final targets: -@.lib: @.o.adler32 @.o.compress @.o.crc32 @.o.deflate @.o.gzio \ - @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil @.o.trees \ - @.o.uncompr @.o.zutil - LibFile $(LibFileflags) @.o.adler32 @.o.compress @.o.crc32 @.o.deflate \ - @.o.gzio @.o.infblock @.o.infcodes @.o.inffast @.o.inflate @.o.inftrees @.o.infutil \ - @.o.trees @.o.uncompr @.o.zutil -test: @.minigzip @.example @.lib - @copy @.lib @.libc A~C~DF~L~N~P~Q~RS~TV - @echo running tests: hang on. - @/@.minigzip -f -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -f -1 libc - @/@.minigzip -d libc-gz - @/@.minigzip -h -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -h -1 libc - @/@.minigzip -d libc-gz - @/@.minigzip -9 libc - @/@.minigzip -d libc-gz - @/@.minigzip -1 libc - @/@.minigzip -d libc-gz - @diff @.lib @.libc - @echo that should have reported '@.lib and @.libc identical' if you have diff. - @/@.example @.fred @.fred - @echo that will have given lots of hello!'s. - -@.minigzip: @.o.minigzip @.lib C:o.Stubs - Link $(Linkflags) @.o.minigzip @.lib C:o.Stubs -@.example: @.o.example @.lib C:o.Stubs - Link $(Linkflags) @.o.example @.lib C:o.Stubs - -install: @.lib - cdir $(libdest) - cdir $(libdest).h - @copy @.h.zlib $(libdest).h.zlib A~C~DF~L~N~P~Q~RS~TV - @copy @.h.zconf $(libdest).h.zconf A~C~DF~L~N~P~Q~RS~TV - @copy @.lib $(libdest).lib A~C~DF~L~N~P~Q~RS~TV - @echo okay, installed zlib in $(libdest) - -clean:; remove @.minigzip - remove @.example - remove @.libc - -wipe @.o.* F~r~cV - remove @.fred - -# User-editable dependencies: -.c.o: - cc $(ccflags) -o $@ $< - -# Static dependencies: - -# Dynamic dependencies: -o.example: c.example -o.example: h.zlib -o.example: h.zconf -o.minigzip: c.minigzip -o.minigzip: h.zlib -o.minigzip: h.zconf -o.adler32: c.adler32 -o.adler32: h.zlib -o.adler32: h.zconf -o.compress: c.compress -o.compress: h.zlib -o.compress: h.zconf -o.crc32: c.crc32 -o.crc32: h.zlib -o.crc32: h.zconf -o.deflate: c.deflate -o.deflate: h.deflate -o.deflate: h.zutil -o.deflate: h.zlib -o.deflate: h.zconf -o.gzio: c.gzio -o.gzio: h.zutil -o.gzio: h.zlib -o.gzio: h.zconf -o.infblock: c.infblock -o.infblock: h.zutil -o.infblock: h.zlib -o.infblock: h.zconf -o.infblock: h.infblock -o.infblock: h.inftrees -o.infblock: h.infcodes -o.infblock: h.infutil -o.infcodes: c.infcodes -o.infcodes: h.zutil -o.infcodes: h.zlib -o.infcodes: h.zconf -o.infcodes: h.inftrees -o.infcodes: h.infblock -o.infcodes: h.infcodes -o.infcodes: h.infutil -o.infcodes: h.inffast -o.inffast: c.inffast -o.inffast: h.zutil -o.inffast: h.zlib -o.inffast: h.zconf -o.inffast: h.inftrees -o.inffast: h.infblock -o.inffast: h.infcodes -o.inffast: h.infutil -o.inffast: h.inffast -o.inflate: c.inflate -o.inflate: h.zutil -o.inflate: h.zlib -o.inflate: h.zconf -o.inflate: h.infblock -o.inftrees: c.inftrees -o.inftrees: h.zutil -o.inftrees: h.zlib -o.inftrees: h.zconf -o.inftrees: h.inftrees -o.inftrees: h.inffixed -o.infutil: c.infutil -o.infutil: h.zutil -o.infutil: h.zlib -o.infutil: h.zconf -o.infutil: h.infblock -o.infutil: h.inftrees -o.infutil: h.infcodes -o.infutil: h.infutil -o.trees: c.trees -o.trees: h.deflate -o.trees: h.zutil -o.trees: h.zlib -o.trees: h.zconf -o.trees: h.trees -o.uncompr: c.uncompr -o.uncompr: h.zlib -o.uncompr: h.zconf -o.zutil: c.zutil -o.zutil: h.zutil -o.zutil: h.zlib -o.zutil: h.zconf diff --git a/common/dist/zlib/old/README b/common/dist/zlib/old/README deleted file mode 100644 index 800bf0798..000000000 --- a/common/dist/zlib/old/README +++ /dev/null @@ -1,3 +0,0 @@ -This directory contains files that have not been updated for zlib 1.2.x - -(Volunteers are encouraged to help clean this up. Thanks.) diff --git a/common/dist/zlib/old/descrip.mms b/common/dist/zlib/old/descrip.mms deleted file mode 100644 index 7066da5b5..000000000 --- a/common/dist/zlib/old/descrip.mms +++ /dev/null @@ -1,48 +0,0 @@ -# descrip.mms: MMS description file for building zlib on VMS -# written by Martin P.J. Zinser - -cc_defs = -c_deb = - -.ifdef __DECC__ -pref = /prefix=all -.endif - -OBJS = adler32.obj, compress.obj, crc32.obj, gzio.obj, uncompr.obj,\ - deflate.obj, trees.obj, zutil.obj, inflate.obj, infblock.obj,\ - inftrees.obj, infcodes.obj, infutil.obj, inffast.obj - -CFLAGS= $(C_DEB) $(CC_DEFS) $(PREF) - -all : example.exe minigzip.exe - @ write sys$output " Example applications available" -libz.olb : libz.olb($(OBJS)) - @ write sys$output " libz available" - -example.exe : example.obj libz.olb - link example,libz.olb/lib - -minigzip.exe : minigzip.obj libz.olb - link minigzip,libz.olb/lib,x11vms:xvmsutils.olb/lib - -clean : - delete *.obj;*,libz.olb;* - - -# Other dependencies. -adler32.obj : zutil.h zlib.h zconf.h -compress.obj : zlib.h zconf.h -crc32.obj : zutil.h zlib.h zconf.h -deflate.obj : deflate.h zutil.h zlib.h zconf.h -example.obj : zlib.h zconf.h -gzio.obj : zutil.h zlib.h zconf.h -infblock.obj : zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h -infcodes.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h infcodes.h inffast.h -inffast.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h inffast.h -inflate.obj : zutil.h zlib.h zconf.h infblock.h -inftrees.obj : zutil.h zlib.h zconf.h inftrees.h -infutil.obj : zutil.h zlib.h zconf.h inftrees.h infutil.h -minigzip.obj : zlib.h zconf.h -trees.obj : deflate.h zutil.h zlib.h zconf.h -uncompr.obj : zlib.h zconf.h -zutil.obj : zutil.h zlib.h zconf.h diff --git a/common/dist/zlib/old/os2/Makefile.os2 b/common/dist/zlib/old/os2/Makefile.os2 deleted file mode 100644 index a105aaa5b..000000000 --- a/common/dist/zlib/old/os2/Makefile.os2 +++ /dev/null @@ -1,136 +0,0 @@ -# Makefile for zlib under OS/2 using GCC (PGCC) -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile and test, type: -# cp Makefile.os2 .. -# cd .. -# make -f Makefile.os2 test - -# This makefile will build a static library z.lib, a shared library -# z.dll and a import library zdll.lib. You can use either z.lib or -# zdll.lib by specifying either -lz or -lzdll on gcc's command line - -CC=gcc -Zomf -s - -CFLAGS=-O6 -Wall -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-g -DDEBUG -#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ -# -Wstrict-prototypes -Wmissing-prototypes - -#################### BUG WARNING: ##################### -## infcodes.c hits a bug in pgcc-1.0, so you have to use either -## -O# where # <= 4 or one of (-fno-ommit-frame-pointer or -fno-force-mem) -## This bug is reportedly fixed in pgcc >1.0, but this was not tested -CFLAGS+=-fno-force-mem - -LDFLAGS=-s -L. -lzdll -Zcrtdll -LDSHARED=$(CC) -s -Zomf -Zdll -Zcrtdll - -VER=1.1.0 -ZLIB=z.lib -SHAREDLIB=z.dll -SHAREDLIBIMP=zdll.lib -LIBS=$(ZLIB) $(SHAREDLIB) $(SHAREDLIBIMP) - -AR=emxomfar cr -IMPLIB=emximp -RANLIB=echo -TAR=tar -SHELL=bash - -prefix=/usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o - -TEST_OBJS = example.o minigzip.o - -DISTFILES = README INDEX ChangeLog configure Make*[a-z0-9] *.[ch] descrip.mms \ - algorithm.txt zlib.3 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \ - nt/Makefile.nt nt/zlib.dnt contrib/README.contrib contrib/*.txt \ - contrib/asm386/*.asm contrib/asm386/*.c \ - contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/iostream/*.cpp \ - contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \ - contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 - -all: example.exe minigzip.exe - -test: all - @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \ - echo hello world | ./minigzip | ./minigzip -d || \ - echo ' *** minigzip test FAILED ***' ; \ - if ./example; then \ - echo ' *** zlib test OK ***'; \ - else \ - echo ' *** zlib test FAILED ***'; \ - fi - -$(ZLIB): $(OBJS) - $(AR) $@ $(OBJS) - -@ ($(RANLIB) $@ || true) >/dev/null 2>&1 - -$(SHAREDLIB): $(OBJS) os2/z.def - $(LDSHARED) -o $@ $^ - -$(SHAREDLIBIMP): os2/z.def - $(IMPLIB) -o $@ $^ - -example.exe: example.o $(LIBS) - $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) - -minigzip.exe: minigzip.o $(LIBS) - $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) - -clean: - rm -f *.o *~ example minigzip libz.a libz.so* foo.gz - -distclean: clean - -zip: - mv Makefile Makefile~; cp -p Makefile.in Makefile - rm -f test.c ztest*.c - v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ - zip -ul9 zlib$$v $(DISTFILES) - mv Makefile~ Makefile - -dist: - mv Makefile Makefile~; cp -p Makefile.in Makefile - rm -f test.c ztest*.c - d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\ - rm -f $$d.tar.gz; \ - if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \ - files=""; \ - for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \ - cd ..; \ - GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \ - if test ! -d $$d; then rm -f $$d; fi - mv Makefile~ Makefile - -tags: - etags *.[ch] - -depend: - makedepend -- $(CFLAGS) -- *.[ch] - -# DO NOT DELETE THIS LINE -- make depend depends on it. - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h -infblock.o: infblock.h inftrees.h infcodes.h infutil.h zutil.h zlib.h zconf.h -infcodes.o: zutil.h zlib.h zconf.h -infcodes.o: inftrees.h infblock.h infcodes.h infutil.h inffast.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h -inffast.o: infblock.h infcodes.h infutil.h inffast.h -inflate.o: zutil.h zlib.h zconf.h infblock.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -infutil.o: zutil.h zlib.h zconf.h infblock.h inftrees.h infcodes.h infutil.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/common/dist/zlib/old/os2/zlib.def b/common/dist/zlib/old/os2/zlib.def deleted file mode 100644 index 4c753f1a3..000000000 --- a/common/dist/zlib/old/os2/zlib.def +++ /dev/null @@ -1,51 +0,0 @@ -; -; Slightly modified version of ../nt/zlib.dnt :-) -; - -LIBRARY Z -DESCRIPTION "Zlib compression library for OS/2" -CODE PRELOAD MOVEABLE DISCARDABLE -DATA PRELOAD MOVEABLE MULTIPLE - -EXPORTS - adler32 - compress - crc32 - deflate - deflateCopy - deflateEnd - deflateInit2_ - deflateInit_ - deflateParams - deflateReset - deflateSetDictionary - gzclose - gzdopen - gzerror - gzflush - gzopen - gzread - gzwrite - inflate - inflateEnd - inflateInit2_ - inflateInit_ - inflateReset - inflateSetDictionary - inflateSync - uncompress - zlibVersion - gzprintf - gzputc - gzgetc - gzseek - gzrewind - gztell - gzeof - gzsetparams - zError - inflateSyncPoint - get_crc_table - compress2 - gzputs - gzgets diff --git a/common/dist/zlib/old/visual-basic.txt b/common/dist/zlib/old/visual-basic.txt deleted file mode 100644 index 57efe5812..000000000 --- a/common/dist/zlib/old/visual-basic.txt +++ /dev/null @@ -1,160 +0,0 @@ -See below some functions declarations for Visual Basic. - -Frequently Asked Question: - -Q: Each time I use the compress function I get the -5 error (not enough - room in the output buffer). - -A: Make sure that the length of the compressed buffer is passed by - reference ("as any"), not by value ("as long"). Also check that - before the call of compress this length is equal to the total size of - the compressed buffer and not zero. - - -From: "Jon Caruana" -Subject: Re: How to port zlib declares to vb? -Date: Mon, 28 Oct 1996 18:33:03 -0600 - -Got the answer! (I haven't had time to check this but it's what I got, and -looks correct): - -He has the following routines working: - compress - uncompress - gzopen - gzwrite - gzread - gzclose - -Declares follow: (Quoted from Carlos Rios , in Vb4 form) - -#If Win16 Then 'Use Win16 calls. -Declare Function compress Lib "ZLIB.DLL" (ByVal compr As - String, comprLen As Any, ByVal buf As String, ByVal buflen - As Long) As Integer -Declare Function uncompress Lib "ZLIB.DLL" (ByVal uncompr - As String, uncomprLen As Any, ByVal compr As String, ByVal - lcompr As Long) As Integer -Declare Function gzopen Lib "ZLIB.DLL" (ByVal filePath As - String, ByVal mode As String) As Long -Declare Function gzread Lib "ZLIB.DLL" (ByVal file As - Long, ByVal uncompr As String, ByVal uncomprLen As Integer) - As Integer -Declare Function gzwrite Lib "ZLIB.DLL" (ByVal file As - Long, ByVal uncompr As String, ByVal uncomprLen As Integer) - As Integer -Declare Function gzclose Lib "ZLIB.DLL" (ByVal file As - Long) As Integer -#Else -Declare Function compress Lib "ZLIB32.DLL" - (ByVal compr As String, comprLen As Any, ByVal buf As - String, ByVal buflen As Long) As Integer -Declare Function uncompress Lib "ZLIB32.DLL" - (ByVal uncompr As String, uncomprLen As Any, ByVal compr As - String, ByVal lcompr As Long) As Long -Declare Function gzopen Lib "ZLIB32.DLL" - (ByVal file As String, ByVal mode As String) As Long -Declare Function gzread Lib "ZLIB32.DLL" - (ByVal file As Long, ByVal uncompr As String, ByVal - uncomprLen As Long) As Long -Declare Function gzwrite Lib "ZLIB32.DLL" - (ByVal file As Long, ByVal uncompr As String, ByVal - uncomprLen As Long) As Long -Declare Function gzclose Lib "ZLIB32.DLL" - (ByVal file As Long) As Long -#End If - --Jon Caruana -jon-net@usa.net -Microsoft Sitebuilder Network Level 1 Member - HTML Writer's Guild Member - - -Here is another example from Michael that he -says conforms to the VB guidelines, and that solves the problem of not -knowing the uncompressed size by storing it at the end of the file: - -'Calling the functions: -'bracket meaning: [optional] {Range of possible values} -'Call subCompressFile( [, , [level of compression {1..9}]]) -'Call subUncompressFile() - -Option Explicit -Private lngpvtPcnSml As Long 'Stores value for 'lngPercentSmaller' -Private Const SUCCESS As Long = 0 -Private Const strFilExt As String = ".cpr" -Private Declare Function lngfncCpr Lib "zlib.dll" Alias "compress2" (ByRef -dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long, -ByVal level As Integer) As Long -Private Declare Function lngfncUcp Lib "zlib.dll" Alias "uncompress" (ByRef -dest As Any, ByRef destLen As Any, ByRef src As Any, ByVal srcLen As Long) -As Long - -Public Sub subCompressFile(ByVal strargOriFilPth As String, Optional ByVal -strargCprFilPth As String, Optional ByVal intLvl As Integer = 9) - Dim strCprPth As String - Dim lngOriSiz As Long - Dim lngCprSiz As Long - Dim bytaryOri() As Byte - Dim bytaryCpr() As Byte - lngOriSiz = FileLen(strargOriFilPth) - ReDim bytaryOri(lngOriSiz - 1) - Open strargOriFilPth For Binary Access Read As #1 - Get #1, , bytaryOri() - Close #1 - strCprPth = IIf(strargCprFilPth = "", strargOriFilPth, strargCprFilPth) -'Select file path and name - strCprPth = strCprPth & IIf(Right(strCprPth, Len(strFilExt)) = -strFilExt, "", strFilExt) 'Add file extension if not exists - lngCprSiz = (lngOriSiz * 1.01) + 12 'Compression needs temporary a bit -more space then original file size - ReDim bytaryCpr(lngCprSiz - 1) - If lngfncCpr(bytaryCpr(0), lngCprSiz, bytaryOri(0), lngOriSiz, intLvl) = -SUCCESS Then - lngpvtPcnSml = (1# - (lngCprSiz / lngOriSiz)) * 100 - ReDim Preserve bytaryCpr(lngCprSiz - 1) - Open strCprPth For Binary Access Write As #1 - Put #1, , bytaryCpr() - Put #1, , lngOriSiz 'Add the the original size value to the end -(last 4 bytes) - Close #1 - Else - MsgBox "Compression error" - End If - Erase bytaryCpr - Erase bytaryOri -End Sub - -Public Sub subUncompressFile(ByVal strargFilPth As String) - Dim bytaryCpr() As Byte - Dim bytaryOri() As Byte - Dim lngOriSiz As Long - Dim lngCprSiz As Long - Dim strOriPth As String - lngCprSiz = FileLen(strargFilPth) - ReDim bytaryCpr(lngCprSiz - 1) - Open strargFilPth For Binary Access Read As #1 - Get #1, , bytaryCpr() - Close #1 - 'Read the original file size value: - lngOriSiz = bytaryCpr(lngCprSiz - 1) * (2 ^ 24) _ - + bytaryCpr(lngCprSiz - 2) * (2 ^ 16) _ - + bytaryCpr(lngCprSiz - 3) * (2 ^ 8) _ - + bytaryCpr(lngCprSiz - 4) - ReDim Preserve bytaryCpr(lngCprSiz - 5) 'Cut of the original size value - ReDim bytaryOri(lngOriSiz - 1) - If lngfncUcp(bytaryOri(0), lngOriSiz, bytaryCpr(0), lngCprSiz) = SUCCESS -Then - strOriPth = Left(strargFilPth, Len(strargFilPth) - Len(strFilExt)) - Open strOriPth For Binary Access Write As #1 - Put #1, , bytaryOri() - Close #1 - Else - MsgBox "Uncompression error" - End If - Erase bytaryCpr - Erase bytaryOri -End Sub -Public Property Get lngPercentSmaller() As Long - lngPercentSmaller = lngpvtPcnSml -End Property diff --git a/common/dist/zlib/old/zlib.html b/common/dist/zlib/old/zlib.html deleted file mode 100644 index 8c1b190c3..000000000 --- a/common/dist/zlib/old/zlib.html +++ /dev/null @@ -1,971 +0,0 @@ - - - - zlib general purpose compression library version 1.1.4 - - - - - -

zlib 1.1.4 Manual

-
-

Contents

-
    -
  1. Prologue -
  2. Introduction -
  3. Utility functions -
  4. Basic functions -
  5. Advanced functions -
  6. Constants -
  7. struct z_stream_s -
  8. Checksum functions -
  9. Misc -
-
-

Prologue

- 'zlib' general purpose compression library version 1.1.4, March 11th, 2002 -

- Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler -

- This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. -

- Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: -

    -
  1. The origin of this software must not be misrepresented ; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. -
  2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. -
  3. This notice may not be removed or altered from any source distribution. -
- -
-
Jean-loup Gailly -
jloup@gzip.org -
Mark Adler -
madler@alumni.caltech.edu -
- - The data format used by the zlib library is described by RFCs (Request for - Comments) 1950 to 1952 in the files - - ftp://ds.internic.net/rfc/rfc1950.txt - (zlib format), - - rfc1951.txt - (deflate format) and - - rfc1952.txt - (gzip format). -

- This manual is converted from zlib.h by - piaip -

- Visit - http://ftp.cdrom.com/pub/infozip/zlib/ - for the official zlib web page. -

- -


-

Introduction

- The 'zlib' compression library provides in-memory compression and - decompression functions, including integrity checks of the uncompressed - data. This version of the library supports only one compression method - (deflation) but other algorithms will be added later and will have the same - stream interface. -

- - Compression can be done in a single step if the buffers are large - enough (for example if an input file is mmap'ed), or can be done by - repeated calls of the compression function. In the latter case, the - application must provide more input and/or consume the output - (providing more output space) before each call. -

- - The library also supports reading and writing files in gzip (.gz) format - with an interface similar to that of stdio. -

- - The library does not install any signal handler. The decoder checks - the consistency of the compressed data, so the library should never - crash even in case of corrupted input. -

- -


-

Utility functions

- The following utility functions are implemented on top of the -
basic stream-oriented functions. - To simplify the interface, some - default options are assumed (compression level and memory usage, - standard memory allocation functions). The source code of these - utility functions can easily be modified if you need special options. -

Function list

-
    -
  • int compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); -
  • int compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level); -
  • int uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); -
  • typedef voidp gzFile; -
  • gzFile gzopen (const char *path, const char *mode); -
  • gzFile gzdopen (int fd, const char *mode); -
  • int gzsetparams (gzFile file, int level, int strategy); -
  • int gzread (gzFile file, voidp buf, unsigned len); -
  • int gzwrite (gzFile file, const voidp buf, unsigned len); -
  • int VA gzprintf (gzFile file, const char *format, ...); -
  • int gzputs (gzFile file, const char *s); -
  • char * gzgets (gzFile file, char *buf, int len); -
  • int gzputc (gzFile file, int c); -
  • int gzgetc (gzFile file); -
  • int gzflush (gzFile file, int flush); -
  • z_off_t gzseek (gzFile file, z_off_t offset, int whence); -
  • z_off_t gztell (gzFile file); -
  • int gzrewind (gzFile file); -
  • int gzeof (gzFile file); -
  • int gzclose (gzFile file); -
  • const char * gzerror (gzFile file, int *errnum); -
-

Function description

-
-
int compress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); -
- Compresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be at least 0.1% larger than - sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the - compressed buffer.

- This function can be used to compress a whole file at once if the - input file is mmap'ed.

- compress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer.

- -

int compress2 (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level); -
- Compresses the source buffer into the destination buffer. The level - parameter has the same meaning as in deflateInit. sourceLen is the byte - length of the source buffer. Upon entry, destLen is the total size of the - destination buffer, which must be at least 0.1% larger than sourceLen plus - 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. -

- - compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_BUF_ERROR if there was not enough room in the output buffer, - Z_STREAM_ERROR if the level parameter is invalid. -

- -

int uncompress (Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen); -
- Decompresses the source buffer into the destination buffer. sourceLen is - the byte length of the source buffer. Upon entry, destLen is the total - size of the destination buffer, which must be large enough to hold the - entire uncompressed data. (The size of the uncompressed data must have - been saved previously by the compressor and transmitted to the decompressor - by some mechanism outside the scope of this compression library.) - Upon exit, destLen is the actual size of the compressed buffer.

- This function can be used to decompress a whole file at once if the - input file is mmap'ed. -

- - uncompress returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if there was not enough room in the output - buffer, or Z_DATA_ERROR if the input data was corrupted. -

- -

typedef voidp gzFile; -

- -

gzFile gzopen (const char *path, const char *mode); -
- Opens a gzip (.gz) file for reading or writing. The mode parameter - is as in fopen ("rb" or "wb") but can also include a compression level - ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for - Huffman only compression as in "wb1h". (See the description - of deflateInit2 for more information about the strategy parameter.) -

- - gzopen can be used to read a file which is not in gzip format ; in this - case gzread will directly read from the file without decompression. -

- - gzopen returns NULL if the file could not be opened or if there was - insufficient memory to allocate the (de)compression state ; errno - can be checked to distinguish the two cases (if errno is zero, the - zlib error is Z_MEM_ERROR). -

- -

gzFile gzdopen (int fd, const char *mode); -
- gzdopen() associates a gzFile with the file descriptor fd. File - descriptors are obtained from calls like open, dup, creat, pipe or - fileno (in the file has been previously opened with fopen). - The mode parameter is as in gzopen. -

- The next call of gzclose on the returned gzFile will also close the - file descriptor fd, just like fclose(fdopen(fd), mode) closes the file - descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). -

- gzdopen returns NULL if there was insufficient memory to allocate - the (de)compression state. -

- -

int gzsetparams (gzFile file, int level, int strategy); -
- Dynamically update the compression level or strategy. See the description - of deflateInit2 for the meaning of these parameters. -

- gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not - opened for writing. -

- -

int gzread (gzFile file, voidp buf, unsigned len); -
- Reads the given number of uncompressed bytes from the compressed file. - If the input file was not in gzip format, gzread copies the given number - of bytes into the buffer. -

- gzread returns the number of uncompressed bytes actually read (0 for - end of file, -1 for error). -

- -

int gzwrite (gzFile file, const voidp buf, unsigned len); -
- Writes the given number of uncompressed bytes into the compressed file. - gzwrite returns the number of uncompressed bytes actually written - (0 in case of error). -

- -

int VA gzprintf (gzFile file, const char *format, ...); -
- Converts, formats, and writes the args to the compressed file under - control of the format string, as in fprintf. gzprintf returns the number of - uncompressed bytes actually written (0 in case of error). -

- -

int gzputs (gzFile file, const char *s); -
- Writes the given null-terminated string to the compressed file, excluding - the terminating null character. -

- gzputs returns the number of characters written, or -1 in case of error. -

- -

char * gzgets (gzFile file, char *buf, int len); -
- Reads bytes from the compressed file until len-1 characters are read, or - a newline character is read and transferred to buf, or an end-of-file - condition is encountered. The string is then terminated with a null - character. -

- gzgets returns buf, or Z_NULL in case of error. -

- -

int gzputc (gzFile file, int c); -
- Writes c, converted to an unsigned char, into the compressed file. - gzputc returns the value that was written, or -1 in case of error. -

- -

int gzgetc (gzFile file); -
- Reads one byte from the compressed file. gzgetc returns this byte - or -1 in case of end of file or error. -

- -

int gzflush (gzFile file, int flush); -
- Flushes all pending output into the compressed file. The parameter - flush is as in the deflate() function. The return value is the zlib - error number (see function gzerror below). gzflush returns Z_OK if - the flush parameter is Z_FINISH and all output could be flushed. -

- gzflush should be called only when strictly necessary because it can - degrade compression. -

- -

z_off_t gzseek (gzFile file, z_off_t offset, int whence); -
- Sets the starting position for the next gzread or gzwrite on the - given compressed file. The offset represents a number of bytes in the - uncompressed data stream. The whence parameter is defined as in lseek(2); - the value SEEK_END is not supported. -

- If the file is opened for reading, this function is emulated but can be - extremely slow. If the file is opened for writing, only forward seeks are - supported ; gzseek then compresses a sequence of zeroes up to the new - starting position. -

- gzseek returns the resulting offset location as measured in bytes from - the beginning of the uncompressed stream, or -1 in case of error, in - particular if the file is opened for writing and the new starting position - would be before the current position. -

- -

int gzrewind (gzFile file); -
- Rewinds the given file. This function is supported only for reading. -

- gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) -

- -

z_off_t gztell (gzFile file); -
- Returns the starting position for the next gzread or gzwrite on the - given compressed file. This position represents a number of bytes in the - uncompressed data stream. -

- - gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) -

- -

int gzeof (gzFile file); -
- Returns 1 when EOF has previously been detected reading the given - input stream, otherwise zero. -

- -

int gzclose (gzFile file); -
- Flushes all pending output if necessary, closes the compressed file - and deallocates all the (de)compression state. The return value is the zlib - error number (see function gzerror below). -

- -

const char * gzerror (gzFile file, int *errnum); -
- Returns the error message for the last error which occurred on the - given compressed file. errnum is set to zlib error number. If an - error occurred in the file system and not in the compression library, - errnum is set to Z_ERRNO and the application may consult errno - to get the exact error code. -

-

-
-

Basic functions

-

Function list

-
- -

Function description

-
-
const char * zlibVersion (void); -
The application can compare zlibVersion and ZLIB_VERSION for consistency. - If the first character differs, the library code actually used is - not compatible with the zlib.h header file used by the application. - This check is automatically made by deflateInit and inflateInit. -

- -

int deflateInit (z_streamp strm, int level); -
- Initializes the internal stream state for compression. The fields - zalloc, zfree and opaque must be initialized before by the caller. - If zalloc and zfree are set to Z_NULL, deflateInit updates them to - use default allocation functions. -

- - The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: - 1 gives best speed, 9 gives best compression, 0 gives no compression at - all (the input data is simply copied a block at a time). -

- - Z_DEFAULT_COMPRESSION requests a default compromise between speed and - compression (currently equivalent to level 6). -

- - deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if level is not a valid compression level, - Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible - with the version assumed by the caller (ZLIB_VERSION). - msg is set to null if there is no error message. deflateInit does not - perform any compression: this will be done by deflate(). -

- -

int deflate (z_streamp strm, int flush); -
- deflate compresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may introduce some - output latency (reading input without producing any output) except when - forced to flush.

- - The detailed semantics are as follows. deflate performs one or both of the - following actions: - -

    -
  • Compress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in and avail_in are updated and - processing will resume at this point for the next call of deflate(). - -
  • - Provide more output starting at next_out and update next_out and avail_out - accordingly. This action is forced if the parameter flush is non zero. - Forcing flush frequently degrades the compression ratio, so this parameter - should be set only when necessary (in interactive applications). - Some output may be provided even if flush is not set. -

- - Before the call of deflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating avail_in or avail_out accordingly ; avail_out - should never be zero before the call. The application can consume the - compressed output when it wants, for example when the output buffer is full - (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK - and with zero avail_out, it must be called again after making room in the - output buffer because there might be more output pending. -

- - If the parameter flush is set to Z_SYNC_FLUSH, all pending output is - flushed to the output buffer and the output is aligned on a byte boundary, so - that the decompressor can get all input data available so far. (In particular - avail_in is zero after the call if enough output space has been provided - before the call.) Flushing may degrade compression for some compression - algorithms and so it should be used only when necessary. -

- - If flush is set to Z_FULL_FLUSH, all output is flushed as with - Z_SYNC_FLUSH, and the compression state is reset so that decompression can - restart from this point if previous compressed data has been damaged or if - random access is desired. Using Z_FULL_FLUSH too often can seriously degrade - the compression. -

- - If deflate returns with avail_out == 0, this function must be called again - with the same value of the flush parameter and more output space (updated - avail_out), until the flush is complete (deflate returns with non-zero - avail_out). -

- - If the parameter flush is set to Z_FINISH, pending input is processed, - pending output is flushed and deflate returns with Z_STREAM_END if there - was enough output space ; if deflate returns with Z_OK, this function must be - called again with Z_FINISH and more output space (updated avail_out) but no - more input data, until it returns with Z_STREAM_END or an error. After - deflate has returned Z_STREAM_END, the only possible operations on the - stream are deflateReset or deflateEnd. -

- - Z_FINISH can be used immediately after deflateInit if all the compression - is to be done in a single step. In this case, avail_out must be at least - 0.1% larger than avail_in plus 12 bytes. If deflate does not return - Z_STREAM_END, then it must be called again as described above. -

- - deflate() sets strm-> adler to the adler32 checksum of all input read - so far (that is, total_in bytes). -

- - deflate() may update data_type if it can make a good guess about - the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered - binary. This field is only for information purposes and does not affect - the compression algorithm in any manner. -

- - deflate() returns Z_OK if some progress has been made (more input - processed or more output produced), Z_STREAM_END if all input has been - consumed and all output has been produced (only when flush is set to - Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example - if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible - (for example avail_in or avail_out was zero). -

- -

int deflateEnd (z_streamp strm); -
- All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. -

- - deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the - stream state was inconsistent, Z_DATA_ERROR if the stream was freed - prematurely (some input or output was discarded). In the error case, - msg may be set but then points to a static string (which must not be - deallocated). -

- -

int inflateInit (z_streamp strm); -
- Initializes the internal stream state for decompression. The fields - next_in, avail_in, zalloc, zfree and opaque must be initialized before by - the caller. If next_in is not Z_NULL and avail_in is large enough (the exact - value depends on the compression method), inflateInit determines the - compression method from the zlib header and allocates all data structures - accordingly ; otherwise the allocation will be deferred to the first call of - inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to - use default allocation functions. -

- - inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_VERSION_ERROR if the zlib library version is incompatible with the - version assumed by the caller. msg is set to null if there is no error - message. inflateInit does not perform any decompression apart from reading - the zlib header if present: this will be done by inflate(). (So next_in and - avail_in may be modified, but next_out and avail_out are unchanged.) -

- -

int inflate (z_streamp strm, int flush); -
- inflate decompresses as much data as possible, and stops when the input - buffer becomes empty or the output buffer becomes full. It may some - introduce some output latency (reading input without producing any output) - except when forced to flush. -

- - The detailed semantics are as follows. inflate performs one or both of the - following actions: - -

    -
  • Decompress more input starting at next_in and update next_in and avail_in - accordingly. If not all input can be processed (because there is not - enough room in the output buffer), next_in is updated and processing - will resume at this point for the next call of inflate(). - -
  • Provide more output starting at next_out and update next_out and - avail_out accordingly. inflate() provides as much output as possible, - until there is no more input data or no more space in the output buffer - (see below about the flush parameter). -

- - Before the call of inflate(), the application should ensure that at least - one of the actions is possible, by providing more input and/or consuming - more output, and updating the next_* and avail_* values accordingly. - The application can consume the uncompressed output when it wants, for - example when the output buffer is full (avail_out == 0), or after each - call of inflate(). If inflate returns Z_OK and with zero avail_out, it - must be called again after making room in the output buffer because there - might be more output pending. -

- - If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much - output as possible to the output buffer. The flushing behavior of inflate is - not specified for values of the flush parameter other than Z_SYNC_FLUSH - and Z_FINISH, but the current implementation actually flushes as much output - as possible anyway. -

- - inflate() should normally be called until it returns Z_STREAM_END or an - error. However if all decompression is to be performed in a single step - (a single call of inflate), the parameter flush should be set to - Z_FINISH. In this case all pending input is processed and all pending - output is flushed ; avail_out must be large enough to hold all the - uncompressed data. (The size of the uncompressed data may have been saved - by the compressor for this purpose.) The next operation on this stream must - be inflateEnd to deallocate the decompression state. The use of Z_FINISH - is never required, but can be used to inform inflate that a faster routine - may be used for the single inflate() call. -

- - If a preset dictionary is needed at this point (see inflateSetDictionary - below), inflate sets strm-adler to the adler32 checksum of the - dictionary chosen by the compressor and returns Z_NEED_DICT ; otherwise - it sets strm-> adler to the adler32 checksum of all output produced - so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or - an error code as described below. At the end of the stream, inflate() - checks that its computed adler32 checksum is equal to that saved by the - compressor and returns Z_STREAM_END only if the checksum is correct. -

- - inflate() returns Z_OK if some progress has been made (more input processed - or more output produced), Z_STREAM_END if the end of the compressed data has - been reached and all uncompressed output has been produced, Z_NEED_DICT if a - preset dictionary is needed at this point, Z_DATA_ERROR if the input data was - corrupted (input stream not conforming to the zlib format or incorrect - adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent - (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not - enough memory, Z_BUF_ERROR if no progress is possible or if there was not - enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR - case, the application may then call inflateSync to look for a good - compression block. -

- -

int inflateEnd (z_streamp strm); -
- All dynamically allocated data structures for this stream are freed. - This function discards any unprocessed input and does not flush any - pending output. -

- - inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state - was inconsistent. In the error case, msg may be set but then points to a - static string (which must not be deallocated). -

-
-

Advanced functions

- The following functions are needed only in some special applications. -

Function list

-
-

Function description

-
-
int deflateInit2 (z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy); - -
This is another version of deflateInit with more compression options. The - fields next_in, zalloc, zfree and opaque must be initialized before by - the caller.

- - The method parameter is the compression method. It must be Z_DEFLATED in - this version of the library.

- - The windowBits parameter is the base two logarithm of the window size - (the size of the history buffer). It should be in the range 8..15 for this - version of the library. Larger values of this parameter result in better - compression at the expense of memory usage. The default value is 15 if - deflateInit is used instead.

- - The memLevel parameter specifies how much memory should be allocated - for the internal compression state. memLevel=1 uses minimum memory but - is slow and reduces compression ratio ; memLevel=9 uses maximum memory - for optimal speed. The default value is 8. See zconf.h for total memory - usage as a function of windowBits and memLevel.

- - The strategy parameter is used to tune the compression algorithm. Use the - value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a - filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no - string match). Filtered data consists mostly of small values with a - somewhat random distribution. In this case, the compression algorithm is - tuned to compress them better. The effect of Z_FILTERED is to force more - Huffman coding and less string matching ; it is somewhat intermediate - between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects - the compression ratio but not the correctness of the compressed output even - if it is not set appropriately.

- - deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid - method). msg is set to null if there is no error message. deflateInit2 does - not perform any compression: this will be done by deflate().

- -

int deflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength); -
- Initializes the compression dictionary from the given byte sequence - without producing any compressed output. This function must be called - immediately after deflateInit, deflateInit2 or deflateReset, before any - call of deflate. The compressor and decompressor must use exactly the same - dictionary (see inflateSetDictionary).

- - The dictionary should consist of strings (byte sequences) that are likely - to be encountered later in the data to be compressed, with the most commonly - used strings preferably put towards the end of the dictionary. Using a - dictionary is most useful when the data to be compressed is short and can be - predicted with good accuracy ; the data can then be compressed better than - with the default empty dictionary.

- - Depending on the size of the compression data structures selected by - deflateInit or deflateInit2, a part of the dictionary may in effect be - discarded, for example if the dictionary is larger than the window size in - deflate or deflate2. Thus the strings most likely to be useful should be - put at the end of the dictionary, not at the front.

- - Upon return of this function, strm-> adler is set to the Adler32 value - of the dictionary ; the decompressor may later use this value to determine - which dictionary has been used by the compressor. (The Adler32 value - applies to the whole dictionary even if only a subset of the dictionary is - actually used by the compressor.)

- - deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent (for example if deflate has already been called for this stream - or if the compression method is bsort). deflateSetDictionary does not - perform any compression: this will be done by deflate().

- -

int deflateCopy (z_streamp dest, z_streamp source); -
- Sets the destination stream as a complete copy of the source stream.

- - This function can be useful when several compression strategies will be - tried, for example when there are several ways of pre-processing the input - data with a filter. The streams that will be discarded should then be freed - by calling deflateEnd. Note that deflateCopy duplicates the internal - compression state which can be quite large, so this strategy is slow and - can consume lots of memory.

- - deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not - enough memory, Z_STREAM_ERROR if the source stream state was inconsistent - (such as zalloc being NULL). msg is left unchanged in both source and - destination.

- -

int deflateReset (z_streamp strm); -
This function is equivalent to deflateEnd followed by deflateInit, - but does not free and reallocate all the internal compression state. - The stream will keep the same compression level and any other attributes - that may have been set by deflateInit2.

- - deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL).

- -

int deflateParams (z_streamp strm, int level, int strategy); -
- Dynamically update the compression level and compression strategy. The - interpretation of level and strategy is as in deflateInit2. This can be - used to switch between compression and straight copy of the input data, or - to switch to a different kind of input data requiring a different - strategy. If the compression level is changed, the input available so far - is compressed with the old level (and may be flushed); the new level will - take effect only at the next call of deflate().

- - Before the call of deflateParams, the stream state must be set as for - a call of deflate(), since the currently available input may have to - be compressed and flushed. In particular, strm-> avail_out must be - non-zero.

- - deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source - stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR - if strm->avail_out was zero.

- -

int inflateInit2 (z_streamp strm, int windowBits); - -
This is another version of inflateInit with an extra parameter. The - fields next_in, avail_in, zalloc, zfree and opaque must be initialized - before by the caller.

- - The windowBits parameter is the base two logarithm of the maximum window - size (the size of the history buffer). It should be in the range 8..15 for - this version of the library. The default value is 15 if inflateInit is used - instead. If a compressed stream with a larger window size is given as - input, inflate() will return with the error code Z_DATA_ERROR instead of - trying to allocate a larger window.

- - inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough - memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative - memLevel). msg is set to null if there is no error message. inflateInit2 - does not perform any decompression apart from reading the zlib header if - present: this will be done by inflate(). (So next_in and avail_in may be - modified, but next_out and avail_out are unchanged.)

- -

int inflateSetDictionary (z_streamp strm, const Bytef *dictionary, uInt dictLength); -
- Initializes the decompression dictionary from the given uncompressed byte - sequence. This function must be called immediately after a call of inflate - if this call returned Z_NEED_DICT. The dictionary chosen by the compressor - can be determined from the Adler32 value returned by this call of - inflate. The compressor and decompressor must use exactly the same - dictionary (see deflateSetDictionary).

- - inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a - parameter is invalid (such as NULL dictionary) or the stream state is - inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the - expected one (incorrect Adler32 value). inflateSetDictionary does not - perform any decompression: this will be done by subsequent calls of - inflate().

- -

int inflateSync (z_streamp strm); - -
Skips invalid compressed data until a full flush point (see above the - description of deflate with Z_FULL_FLUSH) can be found, or until all - available input is skipped. No output is provided.

- - inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR - if no more input was provided, Z_DATA_ERROR if no flush point has been found, - or Z_STREAM_ERROR if the stream structure was inconsistent. In the success - case, the application may save the current current value of total_in which - indicates where valid compressed data was found. In the error case, the - application may repeatedly call inflateSync, providing more input each time, - until success or end of the input data.

- -

int inflateReset (z_streamp strm); -
- This function is equivalent to inflateEnd followed by inflateInit, - but does not free and reallocate all the internal decompression state. - The stream will keep attributes that may have been set by inflateInit2. -

- - inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source - stream state was inconsistent (such as zalloc or state being NULL). -

-

- -
-

Checksum functions

- These functions are not related to compression but are exported - anyway because they might be useful in applications using the - compression library. -

Function list

-
-

Function description

-
-
uLong adler32 (uLong adler, const Bytef *buf, uInt len); -
- Update a running Adler-32 checksum with the bytes buf[0..len-1] and - return the updated checksum. If buf is NULL, this function returns - the required initial value for the checksum. -

- An Adler-32 checksum is almost as reliable as a CRC32 but can be computed - much faster. Usage example: -

-
-     uLong adler = adler32(0L, Z_NULL, 0);
-
-     while (read_buffer(buffer, length) != EOF) {
-       adler = adler32(adler, buffer, length);
-     }
-     if (adler != original_adler) error();
-   
- -
uLong crc32 (uLong crc, const Bytef *buf, uInt len); -
- Update a running crc with the bytes buf[0..len-1] and return the updated - crc. If buf is NULL, this function returns the required initial value - for the crc. Pre- and post-conditioning (one's complement) is performed - within this function so it shouldn't be done by the application. - Usage example: -
-
-     uLong crc = crc32(0L, Z_NULL, 0);
-
-     while (read_buffer(buffer, length) != EOF) {
-       crc = crc32(crc, buffer, length);
-     }
-     if (crc != original_crc) error();
-   
-
-
-

struct z_stream_s

- -
-
-typedef struct z_stream_s {
-    Bytef    *next_in;  /* next input byte */
-    uInt     avail_in;  /* number of bytes available at next_in */
-    uLong    total_in;  /* total nb of input bytes read so far */
-
-    Bytef    *next_out; /* next output byte should be put there */
-    uInt     avail_out; /* remaining free space at next_out */
-    uLong    total_out; /* total nb of bytes output so far */
-
-    char     *msg;      /* last error message, NULL if no error */
-    struct internal_state FAR *state; /* not visible by applications */
-
-    alloc_func zalloc;  /* used to allocate the internal state */
-    free_func  zfree;   /* used to free the internal state */
-    voidpf     opaque;  /* private data object passed to zalloc and zfree */
-
-    int     data_type;  /* best guess about the data type: ascii or binary */
-    uLong   adler;      /* adler32 value of the uncompressed data */
-    uLong   reserved;   /* reserved for future use */
-} z_stream ;
-
-typedef z_stream FAR * z_streamp;  ÿ
-
-
- The application must update next_in and avail_in when avail_in has - dropped to zero. It must update next_out and avail_out when avail_out - has dropped to zero. The application must initialize zalloc, zfree and - opaque before calling the init function. All other fields are set by the - compression library and must not be updated by the application.

- - The opaque value provided by the application will be passed as the first - parameter for calls of zalloc and zfree. This can be useful for custom - memory management. The compression library attaches no meaning to the - opaque value.

- - zalloc must return Z_NULL if there is not enough memory for the object. - If zlib is used in a multi-threaded application, zalloc and zfree must be - thread safe.

- - On 16-bit systems, the functions zalloc and zfree must be able to allocate - exactly 65536 bytes, but will not be required to allocate more than this - if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, - pointers returned by zalloc for objects of exactly 65536 bytes *must* - have their offset normalized to zero. The default allocation function - provided by this library ensures this (see zutil.c). To reduce memory - requirements and avoid any allocation of 64K objects, at the expense of - compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). -

- - The fields total_in and total_out can be used for statistics or - progress reports. After compression, total_in holds the total size of - the uncompressed data and may be saved for use in the decompressor - (particularly if the decompressor wants to decompress everything in - a single step).

- -


-

Constants

- -
-#define Z_NO_FLUSH      0
-#define Z_PARTIAL_FLUSH 1
-	/* will be removed, use Z_SYNC_FLUSH instead */
-#define Z_SYNC_FLUSH    2
-#define Z_FULL_FLUSH    3
-#define Z_FINISH        4
-/* Allowed flush values ; see deflate() below for details */
-
-#define Z_OK            0
-#define Z_STREAM_END    1
-#define Z_NEED_DICT     2
-#define Z_ERRNO        (-1)
-#define Z_STREAM_ERROR (-2)
-#define Z_DATA_ERROR   (-3)
-#define Z_MEM_ERROR    (-4)
-#define Z_BUF_ERROR    (-5)
-#define Z_VERSION_ERROR (-6)
-/* Return codes for the compression/decompression functions. Negative
- * values are errors, positive values are used for special but normal events.
- */
-
-#define Z_NO_COMPRESSION         0
-#define Z_BEST_SPEED             1
-#define Z_BEST_COMPRESSION       9
-#define Z_DEFAULT_COMPRESSION  (-1)
-/* compression levels */
-
-#define Z_FILTERED            1
-#define Z_HUFFMAN_ONLY        2
-#define Z_DEFAULT_STRATEGY    0
-/* compression strategy ; see deflateInit2() below for details */
-
-#define Z_BINARY   0
-#define Z_ASCII    1
-#define Z_UNKNOWN  2
-/* Possible values of the data_type field */
-
-#define Z_DEFLATED   8
-/* The deflate compression method (the only one supported in this version) */
-
-#define Z_NULL  0  /* for initializing zalloc, zfree, opaque */
-
-#define zlib_version zlibVersion()
-/* for compatibility with versions less than 1.0.2 */
-
-
- -
-

Misc

-
deflateInit and inflateInit are macros to allow checking the zlib version - and the compiler's view of z_stream. -

- Other functions: -

-
const char * zError (int err); -
int inflateSyncPoint (z_streamp z); -
const uLongf * get_crc_table (void); -
-
- - Last update: Wed Oct 13 20:42:34 1999
- piapi@csie.ntu.edu.tw -
- - - diff --git a/common/dist/zlib/projects/README.projects b/common/dist/zlib/projects/README.projects deleted file mode 100644 index 1c029e4a3..000000000 --- a/common/dist/zlib/projects/README.projects +++ /dev/null @@ -1,41 +0,0 @@ -This directory contains project files for building zlib under various -Integrated Development Environments (IDE). - -If you wish to submit a new project to this directory, you should comply -to the following requirements. Otherwise (e.g. if you wish to integrate -a custom piece of code that changes the zlib interface or its behavior), -please consider submitting the project to the contrib directory. - - -Requirements -============ - -- The project must build zlib using the source files from the official - zlib source distribution, exclusively. - -- If the project produces redistributable builds (e.g. shared objects - or DLL files), these builds must be compatible to those produced by - makefiles, if such makefiles exist in the zlib distribution. - In particular, if the project produces a DLL build for the Win32 - platform, this build must comply to the officially-ammended Win32 DLL - Application Binary Interface (ABI), described in win32/DLL_FAQ.txt. - -- The project may provide additional build targets, which depend on - 3rd-party (unofficially-supported) software, present in the contrib - directory. For example, it is possible to provide an "ASM build", - besides the officially-supported build, and have ASM source files - among its dependencies. - -- If there are significant differences between the project files created - by different versions of an IDE (e.g. Visual C++ 6.0 vs. 7.0), the name - of the project directory should contain the version number of the IDE - for which the project is intended (e.g. "visualc6" for Visual C++ 6.0, - or "visualc7" for Visual C++ 7.0 and 7.1). - - -Current projects -================ - -visualc6/ by Simon-Pierre Cadieux - and Cosmin Truta - Project for Microsoft Visual C++ 6.0 diff --git a/common/dist/zlib/projects/visualc6/README.txt b/common/dist/zlib/projects/visualc6/README.txt deleted file mode 100644 index d0296c272..000000000 --- a/common/dist/zlib/projects/visualc6/README.txt +++ /dev/null @@ -1,73 +0,0 @@ -Microsoft Developer Studio Project Files, Format Version 6.00 for zlib. - -Copyright (C) 2000-2004 Simon-Pierre Cadieux. -Copyright (C) 2004 Cosmin Truta. -For conditions of distribution and use, see copyright notice in zlib.h. - - -This project builds the zlib binaries as follows: - -* Win32_DLL_Release\zlib1.dll DLL build -* Win32_DLL_Debug\zlib1d.dll DLL build (debug version) -* Win32_DLL_ASM_Release\zlib1.dll DLL build using ASM code -* Win32_DLL_ASM_Debug\zlib1d.dll DLL build using ASM code (debug version) -* Win32_LIB_Release\zlib.lib static build -* Win32_LIB_Debug\zlibd.lib static build (debug version) -* Win32_LIB_ASM_Release\zlib.lib static build using ASM code -* Win32_LIB_ASM_Debug\zlibd.lib static build using ASM code (debug version) - - -For more information regarding the DLL builds, please see the DLL FAQ -in ..\..\win32\DLL_FAQ.txt. - - -To build and test: - -1) On the main menu, select "File | Open Workspace". - Open "zlib.dsw". - -2) Select "Build | Set Active Configuration". - Choose the configuration you wish to build. - -3) Select "Build | Clean". - -4) Select "Build | Build ... (F7)". Ignore warning messages about - not being able to find certain include files (e.g. alloc.h). - -5) If you built one of the sample programs (example or minigzip), - select "Build | Execute ... (Ctrl+F5)". - - -To use: - -1) Select "Project | Settings (Alt+F7)". - Make note of the configuration names used in your project. - Usually, these names are "Win32 Release" and "Win32 Debug". - -2) In the Workspace window, select the "FileView" tab. - Right-click on the root item "Workspace '...'". - Select "Insert Project into Workspace". - Switch on the checkbox "Dependency of:", and select the name - of your project. Open "zlib.dsp". - -3) Select "Build | Configurations". - For each configuration of your project: - 3.1) Choose the zlib configuration you wish to use. - 3.2) Click on "Add". - 3.3) Set the new zlib configuration name to the name used by - the configuration from the current iteration. - -4) Select "Build | Set Active Configuration". - Choose the configuration you wish to build. - -5) Select "Build | Build ... (F7)". - -6) If you built an executable program, select - "Build | Execute ... (Ctrl+F5)". - - -Note: - -To build the ASM-enabled code, you need Microsoft Assembler -(ML.EXE). You can get it by downloading and installing the -latest Processor Pack for Visual C++ 6.0. diff --git a/common/dist/zlib/projects/visualc6/example.dsp b/common/dist/zlib/projects/visualc6/example.dsp deleted file mode 100644 index e072a37ff..000000000 --- a/common/dist/zlib/projects/visualc6/example.dsp +++ /dev/null @@ -1,278 +0,0 @@ -# Microsoft Developer Studio Project File - Name="example" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=example - Win32 LIB Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "example.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "example.mak" CFG="example - Win32 LIB Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "example - Win32 DLL Release" (based on "Win32 (x86) Console Application") -!MESSAGE "example - Win32 DLL Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "example - Win32 DLL ASM Release" (based on "Win32 (x86) Console Application") -!MESSAGE "example - Win32 DLL ASM Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "example - Win32 LIB Release" (based on "Win32 (x86) Console Application") -!MESSAGE "example - Win32 LIB Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "example - Win32 LIB ASM Release" (based on "Win32 (x86) Console Application") -!MESSAGE "example - Win32 LIB ASM Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "example - Win32 DLL Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "example___Win32_DLL_Release" -# PROP BASE Intermediate_Dir "example___Win32_DLL_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_DLL_Release" -# PROP Intermediate_Dir "Win32_DLL_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "example - Win32 DLL Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "example___Win32_DLL_Debug" -# PROP BASE Intermediate_Dir "example___Win32_DLL_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_DLL_Debug" -# PROP Intermediate_Dir "Win32_DLL_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "example - Win32 DLL ASM Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "example___Win32_DLL_ASM_Release" -# PROP BASE Intermediate_Dir "example___Win32_DLL_ASM_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_DLL_ASM_Release" -# PROP Intermediate_Dir "Win32_DLL_ASM_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "example - Win32 DLL ASM Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "example___Win32_DLL_ASM_Debug" -# PROP BASE Intermediate_Dir "example___Win32_DLL_ASM_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_DLL_ASM_Debug" -# PROP Intermediate_Dir "Win32_DLL_ASM_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "example - Win32 LIB Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "example___Win32_LIB_Release" -# PROP BASE Intermediate_Dir "example___Win32_LIB_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_LIB_Release" -# PROP Intermediate_Dir "Win32_LIB_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "example - Win32 LIB Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "example___Win32_LIB_Debug" -# PROP BASE Intermediate_Dir "example___Win32_LIB_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_LIB_Debug" -# PROP Intermediate_Dir "Win32_LIB_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "example - Win32 LIB ASM Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "example___Win32_LIB_ASM_Release" -# PROP BASE Intermediate_Dir "example___Win32_LIB_ASM_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_LIB_ASM_Release" -# PROP Intermediate_Dir "Win32_LIB_ASM_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "example - Win32 LIB ASM Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "example___Win32_LIB_ASM_Debug" -# PROP BASE Intermediate_Dir "example___Win32_LIB_ASM_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_LIB_ASM_Debug" -# PROP Intermediate_Dir "Win32_LIB_ASM_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "example - Win32 DLL Release" -# Name "example - Win32 DLL Debug" -# Name "example - Win32 DLL ASM Release" -# Name "example - Win32 DLL ASM Debug" -# Name "example - Win32 LIB Release" -# Name "example - Win32 LIB Debug" -# Name "example - Win32 LIB ASM Release" -# Name "example - Win32 LIB ASM Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\example.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\zconf.h -# End Source File -# Begin Source File - -SOURCE=..\..\zlib.h -# End Source File -# End Group -# End Target -# End Project diff --git a/common/dist/zlib/projects/visualc6/minigzip.dsp b/common/dist/zlib/projects/visualc6/minigzip.dsp deleted file mode 100644 index f32024eaf..000000000 --- a/common/dist/zlib/projects/visualc6/minigzip.dsp +++ /dev/null @@ -1,278 +0,0 @@ -# Microsoft Developer Studio Project File - Name="minigzip" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=minigzip - Win32 LIB Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "minigzip.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "minigzip.mak" CFG="minigzip - Win32 LIB Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "minigzip - Win32 DLL Release" (based on "Win32 (x86) Console Application") -!MESSAGE "minigzip - Win32 DLL Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "minigzip - Win32 DLL ASM Release" (based on "Win32 (x86) Console Application") -!MESSAGE "minigzip - Win32 DLL ASM Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "minigzip - Win32 LIB Release" (based on "Win32 (x86) Console Application") -!MESSAGE "minigzip - Win32 LIB Debug" (based on "Win32 (x86) Console Application") -!MESSAGE "minigzip - Win32 LIB ASM Release" (based on "Win32 (x86) Console Application") -!MESSAGE "minigzip - Win32 LIB ASM Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "minigzip - Win32 DLL Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "minigzip___Win32_DLL_Release" -# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_DLL_Release" -# PROP Intermediate_Dir "Win32_DLL_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "minigzip - Win32 DLL Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "minigzip___Win32_DLL_Debug" -# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_DLL_Debug" -# PROP Intermediate_Dir "Win32_DLL_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "minigzip___Win32_DLL_ASM_Release" -# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_ASM_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_DLL_ASM_Release" -# PROP Intermediate_Dir "Win32_DLL_ASM_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "minigzip - Win32 DLL ASM Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "minigzip___Win32_DLL_ASM_Debug" -# PROP BASE Intermediate_Dir "minigzip___Win32_DLL_ASM_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_DLL_ASM_Debug" -# PROP Intermediate_Dir "Win32_DLL_ASM_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "minigzip - Win32 LIB Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "minigzip___Win32_LIB_Release" -# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_LIB_Release" -# PROP Intermediate_Dir "Win32_LIB_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "minigzip - Win32 LIB Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "minigzip___Win32_LIB_Debug" -# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_LIB_Debug" -# PROP Intermediate_Dir "Win32_LIB_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "minigzip___Win32_LIB_ASM_Release" -# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_ASM_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_LIB_ASM_Release" -# PROP Intermediate_Dir "Win32_LIB_ASM_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 -# ADD LINK32 /nologo /subsystem:console /machine:I386 - -!ELSEIF "$(CFG)" == "minigzip - Win32 LIB ASM Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "minigzip___Win32_LIB_ASM_Debug" -# PROP BASE Intermediate_Dir "minigzip___Win32_LIB_ASM_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_LIB_ASM_Debug" -# PROP Intermediate_Dir "Win32_LIB_ASM_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept - -!ENDIF - -# Begin Target - -# Name "minigzip - Win32 DLL Release" -# Name "minigzip - Win32 DLL Debug" -# Name "minigzip - Win32 DLL ASM Release" -# Name "minigzip - Win32 DLL ASM Debug" -# Name "minigzip - Win32 LIB Release" -# Name "minigzip - Win32 LIB Debug" -# Name "minigzip - Win32 LIB ASM Release" -# Name "minigzip - Win32 LIB ASM Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\minigzip.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\zconf.h -# End Source File -# Begin Source File - -SOURCE=..\..\zlib.h -# End Source File -# End Group -# End Target -# End Project diff --git a/common/dist/zlib/projects/visualc6/zlib.dsp b/common/dist/zlib/projects/visualc6/zlib.dsp deleted file mode 100644 index 0fe0604cc..000000000 --- a/common/dist/zlib/projects/visualc6/zlib.dsp +++ /dev/null @@ -1,609 +0,0 @@ -# Microsoft Developer Studio Project File - Name="zlib" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=zlib - Win32 LIB Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "zlib.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "zlib.mak" CFG="zlib - Win32 LIB Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "zlib - Win32 DLL Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "zlib - Win32 DLL Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "zlib - Win32 DLL ASM Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "zlib - Win32 DLL ASM Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "zlib - Win32 LIB Release" (based on "Win32 (x86) Static Library") -!MESSAGE "zlib - Win32 LIB Debug" (based on "Win32 (x86) Static Library") -!MESSAGE "zlib - Win32 LIB ASM Release" (based on "Win32 (x86) Static Library") -!MESSAGE "zlib - Win32 LIB ASM Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" - -!IF "$(CFG)" == "zlib - Win32 DLL Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "zlib___Win32_DLL_Release" -# PROP BASE Intermediate_Dir "zlib___Win32_DLL_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_DLL_Release" -# PROP Intermediate_Dir "Win32_DLL_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -MTL=midl.exe -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /machine:I386 /out:"Win32_DLL_Release\zlib1.dll" - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "zlib___Win32_DLL_Debug" -# PROP BASE Intermediate_Dir "zlib___Win32_DLL_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_DLL_Debug" -# PROP Intermediate_Dir "Win32_DLL_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -MTL=midl.exe -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Win32_DLL_Debug\zlib1d.dll" /pdbtype:sept - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "zlib___Win32_DLL_ASM_Release" -# PROP BASE Intermediate_Dir "zlib___Win32_DLL_ASM_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_DLL_ASM_Release" -# PROP Intermediate_Dir "Win32_DLL_ASM_Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "ASMV" /D "ASMINF" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -MTL=midl.exe -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /machine:I386 /out:"Win32_DLL_ASM_Release\zlib1.dll" - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "zlib___Win32_DLL_ASM_Debug" -# PROP BASE Intermediate_Dir "zlib___Win32_DLL_ASM_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_DLL_ASM_Debug" -# PROP Intermediate_Dir "Win32_DLL_ASM_Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "ASMV" /D "ASMINF" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -MTL=midl.exe -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /debug /machine:I386 /out:"Win32_DLL_ASM_Debug\zlib1d.dll" /pdbtype:sept - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "zlib___Win32_LIB_Release" -# PROP BASE Intermediate_Dir "zlib___Win32_LIB_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_LIB_Release" -# PROP Intermediate_Dir "Win32_LIB_Release" -# PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "zlib___Win32_LIB_Debug" -# PROP BASE Intermediate_Dir "zlib___Win32_LIB_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_LIB_Debug" -# PROP Intermediate_Dir "Win32_LIB_Debug" -# PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Win32_LIB_Debug\zlibd.lib" - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "zlib___Win32_LIB_ASM_Release" -# PROP BASE Intermediate_Dir "zlib___Win32_LIB_ASM_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Win32_LIB_ASM_Release" -# PROP Intermediate_Dir "Win32_LIB_ASM_Release" -# PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "ASMV" /D "ASMINF" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "zlib___Win32_LIB_ASM_Debug" -# PROP BASE Intermediate_Dir "zlib___Win32_LIB_ASM_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Win32_LIB_ASM_Debug" -# PROP Intermediate_Dir "Win32_LIB_ASM_Debug" -# PROP Target_Dir "" -CPP=cl.exe -# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c -# SUBTRACT BASE CPP /YX /Yc /Yu -# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "ASMV" /D "ASMINF" /FD /GZ /c -# SUBTRACT CPP /YX /Yc /Yu -RSC=rc.exe -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"Win32_LIB_ASM_Debug\zlibd.lib" - -!ENDIF - -# Begin Target - -# Name "zlib - Win32 DLL Release" -# Name "zlib - Win32 DLL Debug" -# Name "zlib - Win32 DLL ASM Release" -# Name "zlib - Win32 DLL ASM Debug" -# Name "zlib - Win32 LIB Release" -# Name "zlib - Win32 LIB Debug" -# Name "zlib - Win32 LIB ASM Release" -# Name "zlib - Win32 LIB ASM Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=..\..\adler32.c -# End Source File -# Begin Source File - -SOURCE=..\..\compress.c -# End Source File -# Begin Source File - -SOURCE=..\..\crc32.c -# End Source File -# Begin Source File - -SOURCE=..\..\deflate.c -# End Source File -# Begin Source File - -SOURCE=..\..\gzio.c -# End Source File -# Begin Source File - -SOURCE=..\..\infback.c -# End Source File -# Begin Source File - -SOURCE=..\..\inffast.c -# End Source File -# Begin Source File - -SOURCE=..\..\inflate.c -# End Source File -# Begin Source File - -SOURCE=..\..\inftrees.c -# End Source File -# Begin Source File - -SOURCE=..\..\trees.c -# End Source File -# Begin Source File - -SOURCE=..\..\uncompr.c -# End Source File -# Begin Source File - -SOURCE=..\..\win32\zlib.def - -!IF "$(CFG)" == "zlib - Win32 DLL Release" - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug" - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release" - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug" - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug" - -# PROP Exclude_From_Build 1 - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\zutil.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=..\..\crc32.h -# End Source File -# Begin Source File - -SOURCE=..\..\deflate.h -# End Source File -# Begin Source File - -SOURCE=..\..\inffast.h -# End Source File -# Begin Source File - -SOURCE=..\..\inffixed.h -# End Source File -# Begin Source File - -SOURCE=..\..\inflate.h -# End Source File -# Begin Source File - -SOURCE=..\..\inftrees.h -# End Source File -# Begin Source File - -SOURCE=..\..\trees.h -# End Source File -# Begin Source File - -SOURCE=..\..\zconf.h -# End Source File -# Begin Source File - -SOURCE=..\..\zlib.h -# End Source File -# Begin Source File - -SOURCE=..\..\zutil.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# Begin Source File - -SOURCE=..\..\win32\zlib1.rc -# End Source File -# End Group -# Begin Group "Assembler Files (Unsupported)" - -# PROP Default_Filter "asm;obj;c;cpp;cxx;h;hpp;hxx" -# Begin Source File - -SOURCE=..\..\contrib\masmx86\gvmat32.asm - -!IF "$(CFG)" == "zlib - Win32 DLL Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release" - -# Begin Custom Build - Assembling... -IntDir=.\Win32_DLL_ASM_Release -InputPath=..\..\contrib\masmx86\gvmat32.asm -InputName=gvmat32 - -"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" - -# End Custom Build - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug" - -# Begin Custom Build - Assembling... -IntDir=.\Win32_DLL_ASM_Debug -InputPath=..\..\contrib\masmx86\gvmat32.asm -InputName=gvmat32 - -"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" - -# End Custom Build - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release" - -# Begin Custom Build - Assembling... -IntDir=.\Win32_LIB_ASM_Release -InputPath=..\..\contrib\masmx86\gvmat32.asm -InputName=gvmat32 - -"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" - -# End Custom Build - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug" - -# Begin Custom Build - Assembling... -IntDir=.\Win32_LIB_ASM_Debug -InputPath=..\..\contrib\masmx86\gvmat32.asm -InputName=gvmat32 - -"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" - -# End Custom Build - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\contrib\masmx86\gvmat32c.c - -!IF "$(CFG)" == "zlib - Win32 DLL Release" - -# PROP Exclude_From_Build 1 -# ADD CPP /I "..\.." - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug" - -# PROP Exclude_From_Build 1 -# ADD CPP /I "..\.." - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release" - -# ADD CPP /I "..\.." - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug" - -# ADD CPP /I "..\.." - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release" - -# PROP Exclude_From_Build 1 -# ADD CPP /I "..\.." - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug" - -# PROP Exclude_From_Build 1 -# ADD CPP /I "..\.." - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release" - -# ADD CPP /I "..\.." - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug" - -# ADD CPP /I "..\.." - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=..\..\contrib\masmx86\inffas32.asm - -!IF "$(CFG)" == "zlib - Win32 DLL Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Release" - -# Begin Custom Build - Assembling... -IntDir=.\Win32_DLL_ASM_Release -InputPath=..\..\contrib\masmx86\inffas32.asm -InputName=inffas32 - -"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" - -# End Custom Build - -!ELSEIF "$(CFG)" == "zlib - Win32 DLL ASM Debug" - -# Begin Custom Build - Assembling... -IntDir=.\Win32_DLL_ASM_Debug -InputPath=..\..\contrib\masmx86\inffas32.asm -InputName=inffas32 - -"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" - -# End Custom Build - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Release" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB Debug" - -# PROP Exclude_From_Build 1 - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Release" - -# Begin Custom Build - Assembling... -IntDir=.\Win32_LIB_ASM_Release -InputPath=..\..\contrib\masmx86\inffas32.asm -InputName=inffas32 - -"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ml.exe /nologo /c /coff /Cx /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" - -# End Custom Build - -!ELSEIF "$(CFG)" == "zlib - Win32 LIB ASM Debug" - -# Begin Custom Build - Assembling... -IntDir=.\Win32_LIB_ASM_Debug -InputPath=..\..\contrib\masmx86\inffas32.asm -InputName=inffas32 - -"$(IntDir)\$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)" - ml.exe /nologo /c /coff /Cx /Zi /Fo"$(IntDir)\$(InputName).obj" "$(InputPath)" - -# End Custom Build - -!ENDIF - -# End Source File -# End Group -# Begin Source File - -SOURCE=.\README.txt -# End Source File -# End Target -# End Project diff --git a/common/dist/zlib/projects/visualc6/zlib.dsw b/common/dist/zlib/projects/visualc6/zlib.dsw deleted file mode 100644 index 3a771fce0..000000000 --- a/common/dist/zlib/projects/visualc6/zlib.dsw +++ /dev/null @@ -1,59 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "example"=.\example.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name zlib - End Project Dependency -}}} - -############################################################################### - -Project: "minigzip"=.\minigzip.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name zlib - End Project Dependency -}}} - -############################################################################### - -Project: "zlib"=.\zlib.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/common/dist/zlib/qnx/package.qpg b/common/dist/zlib/qnx/package.qpg deleted file mode 100644 index 8a4a47c72..000000000 --- a/common/dist/zlib/qnx/package.qpg +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Library - - Medium - - 2.0 - - - - zlib - zlib - alain.bonnefoy@icbt.com - Public - public - www.gzip.org/zlib - - - Jean-Loup Gailly,Mark Adler - www.gzip.org/zlib - - zlib@gzip.org - - - A massively spiffy yet delicately unobtrusive compression library. - zlib is designed to be a free, general-purpose, legally unencumbered, lossless data compression library for use on virtually any computer hardware and operating system. - http://www.gzip.org/zlib - - - - - 1.2.3 - Medium - Stable - - - - - - - No License - - - - Software Development/Libraries and Extensions/C Libraries - zlib,compression - qnx6 - qnx6 - None - Developer - - - - - - - - - - - - - - Install - Post - No - Ignore - - No - Optional - - - - - - - - - - - - - InstallOver - zlib - - - - - - - - - - - - - InstallOver - zlib-dev - - - - - - - - - diff --git a/common/dist/zlib/win32/DLL_FAQ.txt b/common/dist/zlib/win32/DLL_FAQ.txt deleted file mode 100644 index fb18e0711..000000000 --- a/common/dist/zlib/win32/DLL_FAQ.txt +++ /dev/null @@ -1,397 +0,0 @@ - - Frequently Asked Questions about ZLIB1.DLL - - -This document describes the design, the rationale, and the usage -of the official DLL build of zlib, named ZLIB1.DLL. If you have -general questions about zlib, you should see the file "FAQ" found -in the zlib distribution, or at the following location: - http://www.gzip.org/zlib/zlib_faq.html - - - 1. What is ZLIB1.DLL, and how can I get it? - - - ZLIB1.DLL is the official build of zlib as a DLL. - (Please remark the character '1' in the name.) - - Pointers to a precompiled ZLIB1.DLL can be found in the zlib - web site at: - http://www.zlib.org/ - - Applications that link to ZLIB1.DLL can rely on the following - specification: - - * The exported symbols are exclusively defined in the source - files "zlib.h" and "zlib.def", found in an official zlib - source distribution. - * The symbols are exported by name, not by ordinal. - * The exported names are undecorated. - * The calling convention of functions is "C" (CDECL). - * The ZLIB1.DLL binary is linked to MSVCRT.DLL. - - The archive in which ZLIB1.DLL is bundled contains compiled - test programs that must run with a valid build of ZLIB1.DLL. - It is recommended to download the prebuilt DLL from the zlib - web site, instead of building it yourself, to avoid potential - incompatibilities that could be introduced by your compiler - and build settings. If you do build the DLL yourself, please - make sure that it complies with all the above requirements, - and it runs with the precompiled test programs, bundled with - the original ZLIB1.DLL distribution. - - If, for any reason, you need to build an incompatible DLL, - please use a different file name. - - - 2. Why did you change the name of the DLL to ZLIB1.DLL? - What happened to the old ZLIB.DLL? - - - The old ZLIB.DLL, built from zlib-1.1.4 or earlier, required - compilation settings that were incompatible to those used by - a static build. The DLL settings were supposed to be enabled - by defining the macro ZLIB_DLL, before including "zlib.h". - Incorrect handling of this macro was silently accepted at - build time, resulting in two major problems: - - * ZLIB_DLL was missing from the old makefile. When building - the DLL, not all people added it to the build options. In - consequence, incompatible incarnations of ZLIB.DLL started - to circulate around the net. - - * When switching from using the static library to using the - DLL, applications had to define the ZLIB_DLL macro and - to recompile all the sources that contained calls to zlib - functions. Failure to do so resulted in creating binaries - that were unable to run with the official ZLIB.DLL build. - - The only possible solution that we could foresee was to make - a binary-incompatible change in the DLL interface, in order to - remove the dependency on the ZLIB_DLL macro, and to release - the new DLL under a different name. - - We chose the name ZLIB1.DLL, where '1' indicates the major - zlib version number. We hope that we will not have to break - the binary compatibility again, at least not as long as the - zlib-1.x series will last. - - There is still a ZLIB_DLL macro, that can trigger a more - efficient build and use of the DLL, but compatibility no - longer dependents on it. - - - 3. Can I build ZLIB.DLL from the new zlib sources, and replace - an old ZLIB.DLL, that was built from zlib-1.1.4 or earlier? - - - In principle, you can do it by assigning calling convention - keywords to the macros ZEXPORT and ZEXPORTVA. In practice, - it depends on what you mean by "an old ZLIB.DLL", because the - old DLL exists in several mutually-incompatible versions. - You have to find out first what kind of calling convention is - being used in your particular ZLIB.DLL build, and to use the - same one in the new build. If you don't know what this is all - about, you might be better off if you would just leave the old - DLL intact. - - - 4. Can I compile my application using the new zlib interface, and - link it to an old ZLIB.DLL, that was built from zlib-1.1.4 or - earlier? - - - The official answer is "no"; the real answer depends again on - what kind of ZLIB.DLL you have. Even if you are lucky, this - course of action is unreliable. - - If you rebuild your application and you intend to use a newer - version of zlib (post- 1.1.4), it is strongly recommended to - link it to the new ZLIB1.DLL. - - - 5. Why are the zlib symbols exported by name, and not by ordinal? - - - Although exporting symbols by ordinal is a little faster, it - is risky. Any single glitch in the maintenance or use of the - DEF file that contains the ordinals can result in incompatible - builds and frustrating crashes. Simply put, the benefits of - exporting symbols by ordinal do not justify the risks. - - Technically, it should be possible to maintain ordinals in - the DEF file, and still export the symbols by name. Ordinals - exist in every DLL, and even if the dynamic linking performed - at the DLL startup is searching for names, ordinals serve as - hints, for a faster name lookup. However, if the DEF file - contains ordinals, the Microsoft linker automatically builds - an implib that will cause the executables linked to it to use - those ordinals, and not the names. It is interesting to - notice that the GNU linker for Win32 does not suffer from this - problem. - - It is possible to avoid the DEF file if the exported symbols - are accompanied by a "__declspec(dllexport)" attribute in the - source files. You can do this in zlib by predefining the - ZLIB_DLL macro. - - - 6. I see that the ZLIB1.DLL functions use the "C" (CDECL) calling - convention. Why not use the STDCALL convention? - STDCALL is the standard convention in Win32, and I need it in - my Visual Basic project! - - (For readability, we use CDECL to refer to the convention - triggered by the "__cdecl" keyword, STDCALL to refer to - the convention triggered by "__stdcall", and FASTCALL to - refer to the convention triggered by "__fastcall".) - - - Most of the native Windows API functions (without varargs) use - indeed the WINAPI convention (which translates to STDCALL in - Win32), but the standard C functions use CDECL. If a user - application is intrinsically tied to the Windows API (e.g. - it calls native Windows API functions such as CreateFile()), - sometimes it makes sense to decorate its own functions with - WINAPI. But if ANSI C or POSIX portability is a goal (e.g. - it calls standard C functions such as fopen()), it is not a - sound decision to request the inclusion of , or to - use non-ANSI constructs, for the sole purpose to make the user - functions STDCALL-able. - - The functionality offered by zlib is not in the category of - "Windows functionality", but is more like "C functionality". - - Technically, STDCALL is not bad; in fact, it is slightly - faster than CDECL, and it works with variable-argument - functions, just like CDECL. It is unfortunate that, in spite - of using STDCALL in the Windows API, it is not the default - convention used by the C compilers that run under Windows. - The roots of the problem reside deep inside the unsafety of - the K&R-style function prototypes, where the argument types - are not specified; but that is another story for another day. - - The remaining fact is that CDECL is the default convention. - Even if an explicit convention is hard-coded into the function - prototypes inside C headers, problems may appear. The - necessity to expose the convention in users' callbacks is one - of these problems. - - The calling convention issues are also important when using - zlib in other programming languages. Some of them, like Ada - (GNAT) and Fortran (GNU G77), have C bindings implemented - initially on Unix, and relying on the C calling convention. - On the other hand, the pre- .NET versions of Microsoft Visual - Basic require STDCALL, while Borland Delphi prefers, although - it does not require, FASTCALL. - - In fairness to all possible uses of zlib outside the C - programming language, we choose the default "C" convention. - Anyone interested in different bindings or conventions is - encouraged to maintain specialized projects. The "contrib/" - directory from the zlib distribution already holds a couple - of foreign bindings, such as Ada, C++, and Delphi. - - - 7. I need a DLL for my Visual Basic project. What can I do? - - - Define the ZLIB_WINAPI macro before including "zlib.h", when - building both the DLL and the user application (except that - you don't need to define anything when using the DLL in Visual - Basic). The ZLIB_WINAPI macro will switch on the WINAPI - (STDCALL) convention. The name of this DLL must be different - than the official ZLIB1.DLL. - - Gilles Vollant has contributed a build named ZLIBWAPI.DLL, - with the ZLIB_WINAPI macro turned on, and with the minizip - functionality built in. For more information, please read - the notes inside "contrib/vstudio/readme.txt", found in the - zlib distribution. - - - 8. I need to use zlib in my Microsoft .NET project. What can I - do? - - - Henrik Ravn has contributed a .NET wrapper around zlib. Look - into contrib/dotzlib/, inside the zlib distribution. - - - 9. If my application uses ZLIB1.DLL, should I link it to - MSVCRT.DLL? Why? - - - It is not required, but it is recommended to link your - application to MSVCRT.DLL, if it uses ZLIB1.DLL. - - The executables (.EXE, .DLL, etc.) that are involved in the - same process and are using the C run-time library (i.e. they - are calling standard C functions), must link to the same - library. There are several libraries in the Win32 system: - CRTDLL.DLL, MSVCRT.DLL, the static C libraries, etc. - Since ZLIB1.DLL is linked to MSVCRT.DLL, the executables that - depend on it should also be linked to MSVCRT.DLL. - - -10. Why are you saying that ZLIB1.DLL and my application should - be linked to the same C run-time (CRT) library? I linked my - application and my DLLs to different C libraries (e.g. my - application to a static library, and my DLLs to MSVCRT.DLL), - and everything works fine. - - - If a user library invokes only pure Win32 API (accessible via - and the related headers), its DLL build will work - in any context. But if this library invokes standard C API, - things get more complicated. - - There is a single Win32 library in a Win32 system. Every - function in this library resides in a single DLL module, that - is safe to call from anywhere. On the other hand, there are - multiple versions of the C library, and each of them has its - own separate internal state. Standalone executables and user - DLLs that call standard C functions must link to a C run-time - (CRT) library, be it static or shared (DLL). Intermixing - occurs when an executable (not necessarily standalone) and a - DLL are linked to different CRTs, and both are running in the - same process. - - Intermixing multiple CRTs is possible, as long as their - internal states are kept intact. The Microsoft Knowledge Base - articles KB94248 "HOWTO: Use the C Run-Time" and KB140584 - "HOWTO: Link with the Correct C Run-Time (CRT) Library" - mention the potential problems raised by intermixing. - - If intermixing works for you, it's because your application - and DLLs are avoiding the corruption of each of the CRTs' - internal states, maybe by careful design, or maybe by fortune. - - Also note that linking ZLIB1.DLL to non-Microsoft CRTs, such - as those provided by Borland, raises similar problems. - - -11. Why are you linking ZLIB1.DLL to MSVCRT.DLL? - - - MSVCRT.DLL exists on every Windows 95 with a new service pack - installed, or with Microsoft Internet Explorer 4 or later, and - on all other Windows 4.x or later (Windows 98, Windows NT 4, - or later). It is freely distributable; if not present in the - system, it can be downloaded from Microsoft or from other - software provider for free. - - The fact that MSVCRT.DLL does not exist on a virgin Windows 95 - is not so problematic. Windows 95 is scarcely found nowadays, - Microsoft ended its support a long time ago, and many recent - applications from various vendors, including Microsoft, do not - even run on it. Furthermore, no serious user should run - Windows 95 without a proper update installed. - - -12. Why are you not linking ZLIB1.DLL to - <> ? - - - We considered and abandoned the following alternatives: - - * Linking ZLIB1.DLL to a static C library (LIBC.LIB, or - LIBCMT.LIB) is not a good option. People are using the DLL - mainly to save disk space. If you are linking your program - to a static C library, you may as well consider linking zlib - in statically, too. - - * Linking ZLIB1.DLL to CRTDLL.DLL looks appealing, because - CRTDLL.DLL is present on every Win32 installation. - Unfortunately, it has a series of problems: it does not - work properly with Microsoft's C++ libraries, it does not - provide support for 64-bit file offsets, (and so on...), - and Microsoft discontinued its support a long time ago. - - * Linking ZLIB1.DLL to MSVCR70.DLL or MSVCR71.DLL, supplied - with the Microsoft .NET platform, and Visual C++ 7.0/7.1, - raises problems related to the status of ZLIB1.DLL as a - system component. According to the Microsoft Knowledge Base - article KB326922 "INFO: Redistribution of the Shared C - Runtime Component in Visual C++ .NET", MSVCR70.DLL and - MSVCR71.DLL are not supposed to function as system DLLs, - because they may clash with MSVCRT.DLL. Instead, the - application's installer is supposed to put these DLLs - (if needed) in the application's private directory. - If ZLIB1.DLL depends on a non-system runtime, it cannot - function as a redistributable system component. - - * Linking ZLIB1.DLL to non-Microsoft runtimes, such as - Borland's, or Cygwin's, raises problems related to the - reliable presence of these runtimes on Win32 systems. - It's easier to let the DLL build of zlib up to the people - who distribute these runtimes, and who may proceed as - explained in the answer to Question 14. - - -13. If ZLIB1.DLL cannot be linked to MSVCR70.DLL or MSVCR71.DLL, - how can I build/use ZLIB1.DLL in Microsoft Visual C++ 7.0 - (Visual Studio .NET) or newer? - - - Due to the problems explained in the Microsoft Knowledge Base - article KB326922 (see the previous answer), the C runtime that - comes with the VC7 environment is no longer considered a - system component. That is, it should not be assumed that this - runtime exists, or may be installed in a system directory. - Since ZLIB1.DLL is supposed to be a system component, it may - not depend on a non-system component. - - In order to link ZLIB1.DLL and your application to MSVCRT.DLL - in VC7, you need the library of Visual C++ 6.0 or older. If - you don't have this library at hand, it's probably best not to - use ZLIB1.DLL. - - We are hoping that, in the future, Microsoft will provide a - way to build applications linked to a proper system runtime, - from the Visual C++ environment. Until then, you have a - couple of alternatives, such as linking zlib in statically. - If your application requires dynamic linking, you may proceed - as explained in the answer to Question 14. - - -14. I need to link my own DLL build to a CRT different than - MSVCRT.DLL. What can I do? - - - Feel free to rebuild the DLL from the zlib sources, and link - it the way you want. You should, however, clearly state that - your build is unofficial. You should give it a different file - name, and/or install it in a private directory that can be - accessed by your application only, and is not visible to the - others (e.g. it's not in the SYSTEM or the SYSTEM32 directory, - and it's not in the PATH). Otherwise, your build may clash - with applications that link to the official build. - - For example, in Cygwin, zlib is linked to the Cygwin runtime - CYGWIN1.DLL, and it is distributed under the name CYGZ.DLL. - - -15. May I include additional pieces of code that I find useful, - link them in ZLIB1.DLL, and export them? - - - No. A legitimate build of ZLIB1.DLL must not include code - that does not originate from the official zlib source code. - But you can make your own private DLL build, under a different - file name, as suggested in the previous answer. - - For example, zlib is a part of the VCL library, distributed - with Borland Delphi and C++ Builder. The DLL build of VCL - is a redistributable file, named VCLxx.DLL. - - -16. May I remove some functionality out of ZLIB1.DLL, by enabling - macros like NO_GZCOMPRESS or NO_GZIP at compile time? - - - No. A legitimate build of ZLIB1.DLL must provide the complete - zlib functionality, as implemented in the official zlib source - code. But you can make your own private DLL build, under a - different file name, as suggested in the previous answer. - - -17. I made my own ZLIB1.DLL build. Can I test it for compliance? - - - We prefer that you download the official DLL from the zlib - web site. If you need something peculiar from this DLL, you - can send your suggestion to the zlib mailing list. - - However, in case you do rebuild the DLL yourself, you can run - it with the test programs found in the DLL distribution. - Running these test programs is not a guarantee of compliance, - but a failure can imply a detected problem. - -** - -This document is written and maintained by -Cosmin Truta diff --git a/common/dist/zlib/win32/Makefile.bor b/common/dist/zlib/win32/Makefile.bor deleted file mode 100644 index b802519ca..000000000 --- a/common/dist/zlib/win32/Makefile.bor +++ /dev/null @@ -1,107 +0,0 @@ -# Makefile for zlib -# Borland C++ for Win32 -# -# Updated for zlib 1.2.x by Cosmin Truta, 11-Mar-2003 -# Last updated: 28-Aug-2003 -# -# Usage: -# make -f win32/Makefile.bor -# make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj - -# ------------ Borland C++ ------------ - -# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) -# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or -# added to the declaration of LOC here: -LOC = $(LOCAL_ZLIB) - -CC = bcc32 -AS = bcc32 -LD = bcc32 -AR = tlib -CFLAGS = -a -d -k- -O2 $(LOC) -ASFLAGS = $(LOC) -LDFLAGS = $(LOC) - - -# variables -ZLIB_LIB = zlib.lib - -OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj -OBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -#OBJA = -OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzio.obj+infback.obj -OBJP2 = +inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj -#OBJPA= - - -# targets -all: $(ZLIB_LIB) example.exe minigzip.exe - -.c.obj: - $(CC) -c $(CFLAGS) $< - -.asm.obj: - $(AS) -c $(ASFLAGS) $< - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzio.obj: gzio.c zutil.h zlib.h zconf.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: example.c zlib.h zconf.h - -minigzip.obj: minigzip.c zlib.h zconf.h - - -# For the sake of the old Borland make, -# the command line is cut to fit in the MS-DOS 128 byte limit: -$(ZLIB_LIB): $(OBJ1) $(OBJ2) $(OBJA) - -del $(ZLIB_LIB) - $(AR) $(ZLIB_LIB) $(OBJP1) - $(AR) $(ZLIB_LIB) $(OBJP2) - $(AR) $(ZLIB_LIB) $(OBJPA) - - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -example.exe: example.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB) - -minigzip.exe: minigzip.obj $(ZLIB_LIB) - $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB) - - -# cleanup -clean: - -del *.obj - -del *.lib - -del *.exe - -del *.tds - -del zlib.bak - -del foo.gz diff --git a/common/dist/zlib/win32/Makefile.emx b/common/dist/zlib/win32/Makefile.emx deleted file mode 100644 index 7b08424ce..000000000 --- a/common/dist/zlib/win32/Makefile.emx +++ /dev/null @@ -1,69 +0,0 @@ -# Makefile for zlib. Modified for emx/rsxnt by Chr. Spieler, 6/16/98. -# Copyright (C) 1995-1998 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile, or to compile and test, type: -# -# make -fmakefile.emx; make test -fmakefile.emx -# - -CC=gcc -Zwin32 - -#CFLAGS=-MMD -O -#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 -#CFLAGS=-MMD -g -DDEBUG -CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ - -Wstrict-prototypes -Wmissing-prototypes - -# If cp.exe is available, replace "copy /Y" with "cp -fp" . -CP=copy /Y -# If gnu install.exe is available, replace $(CP) with ginstall. -INSTALL=$(CP) -# The default value of RM is "rm -f." If "rm.exe" is found, comment out: -RM=del -LDLIBS=-L. -lzlib -LD=$(CC) -s -o -LDSHARED=$(CC) - -INCL=zlib.h zconf.h -LIBS=zlib.a - -AR=ar rcs - -prefix=/usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \ - zutil.o inflate.o infback.o inftrees.o inffast.o - -TEST_OBJS = example.o minigzip.o - -all: example.exe minigzip.exe - -test: all - ./example - echo hello world | .\minigzip | .\minigzip -d - -%.o : %.c - $(CC) $(CFLAGS) -c $< -o $@ - -zlib.a: $(OBJS) - $(AR) $@ $(OBJS) - -%.exe : %.o $(LIBS) - $(LD) $@ $< $(LDLIBS) - - -.PHONY : clean - -clean: - $(RM) *.d - $(RM) *.o - $(RM) *.exe - $(RM) zlib.a - $(RM) foo.gz - -DEPS := $(wildcard *.d) -ifneq ($(DEPS),) -include $(DEPS) -endif diff --git a/common/dist/zlib/win32/Makefile.gcc b/common/dist/zlib/win32/Makefile.gcc deleted file mode 100644 index 62a843015..000000000 --- a/common/dist/zlib/win32/Makefile.gcc +++ /dev/null @@ -1,141 +0,0 @@ -# Makefile for zlib, derived from Makefile.dj2. -# Modified for mingw32 by C. Spieler, 6/16/98. -# Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003. -# Last updated: 1-Aug-2003. -# Tested under Cygwin and MinGW. - -# Copyright (C) 1995-2003 Jean-loup Gailly. -# For conditions of distribution and use, see copyright notice in zlib.h - -# To compile, or to compile and test, type: -# -# make -fmakefile.gcc; make test testdll -fmakefile.gcc -# -# To use the asm code, type: -# cp contrib/asm?86/match.S ./match.S -# make LOC=-DASMV OBJA=match.o -fmakefile.gcc -# -# To install libz.a, zconf.h and zlib.h in the system directories, type: -# -# make install -fmakefile.gcc - -# Note: -# If the platform is *not* MinGW (e.g. it is Cygwin or UWIN), -# the DLL name should be changed from "zlib1.dll". - -STATICLIB = libz.a -SHAREDLIB = zlib1.dll -IMPLIB = libzdll.a - -#LOC = -DASMV -#LOC = -DDEBUG -g - -CC = gcc -CFLAGS = $(LOC) -O3 -Wall - -AS = $(CC) -ASFLAGS = $(LOC) -Wall - -LD = $(CC) -LDFLAGS = $(LOC) -s - -AR = ar -ARFLAGS = rcs - -RC = windres -RCFLAGS = --define GCC_WINDRES - -CP = cp -fp -# If GNU install is available, replace $(CP) with install. -INSTALL = $(CP) -RM = rm -f - -prefix = /usr/local -exec_prefix = $(prefix) - -OBJS = adler32.o compress.o crc32.o deflate.o gzio.o infback.o \ - inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o -OBJA = - -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example minigzip example_d minigzip_d - -test: example minigzip - ./example - echo hello world | ./minigzip | ./minigzip -d - -testdll: example_d minigzip_d - ./example_d - echo hello world | ./minigzip_d | ./minigzip_d -d - -.c.o: - $(CC) $(CFLAGS) -c -o $@ $< - -.S.o: - $(AS) $(ASFLAGS) -c -o $@ $< - -$(STATICLIB): $(OBJS) $(OBJA) - $(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o - dllwrap --driver-name $(CC) --def win32/zlib.def \ - --implib $(IMPLIB) -o $@ $(OBJS) $(OBJA) zlibrc.o - strip $@ - -example: example.o $(STATICLIB) - $(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB) - -minigzip: minigzip.o $(STATICLIB) - $(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB) - -example_d: example.o $(IMPLIB) - $(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB) - -minigzip_d: minigzip.o $(IMPLIB) - $(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB) - -zlibrc.o: win32/zlib1.rc - $(RC) $(RCFLAGS) -o $@ win32/zlib1.rc - - -# INCLUDE_PATH and LIBRARY_PATH must be set. - -.PHONY: install uninstall clean - -install: zlib.h zconf.h $(LIB) - -@if not exist $(INCLUDE_PATH)/nul mkdir $(INCLUDE_PATH) - -@if not exist $(LIBRARY_PATH)/nul mkdir $(LIBRARY_PATH) - -$(INSTALL) zlib.h $(INCLUDE_PATH) - -$(INSTALL) zconf.h $(INCLUDE_PATH) - -$(INSTALL) $(STATICLIB) $(LIBRARY_PATH) - -$(INSTALL) $(IMPLIB) $(LIBRARY_PATH) - -uninstall: - -$(RM) $(INCLUDE_PATH)/zlib.h - -$(RM) $(INCLUDE_PATH)/zconf.h - -$(RM) $(LIBRARY_PATH)/$(STATICLIB) - -$(RM) $(LIBRARY_PATH)/$(IMPLIB) - -clean: - -$(RM) $(STATICLIB) - -$(RM) $(SHAREDLIB) - -$(RM) $(IMPLIB) - -$(RM) *.o - -$(RM) *.exe - -$(RM) foo.gz - -adler32.o: zlib.h zconf.h -compress.o: zlib.h zconf.h -crc32.o: crc32.h zlib.h zconf.h -deflate.o: deflate.h zutil.h zlib.h zconf.h -example.o: zlib.h zconf.h -gzio.o: zutil.h zlib.h zconf.h -inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h -inftrees.o: zutil.h zlib.h zconf.h inftrees.h -minigzip.o: zlib.h zconf.h -trees.o: deflate.h zutil.h zlib.h zconf.h trees.h -uncompr.o: zlib.h zconf.h -zutil.o: zutil.h zlib.h zconf.h diff --git a/common/dist/zlib/win32/Makefile.msc b/common/dist/zlib/win32/Makefile.msc deleted file mode 100644 index 528ecaaf2..000000000 --- a/common/dist/zlib/win32/Makefile.msc +++ /dev/null @@ -1,126 +0,0 @@ -# Makefile for zlib -- Microsoft (Visual) C -# -# Authors: -# Cosmin Truta, 11-Mar-2003 -# Christian Spieler, 19-Mar-2003 -# -# Last updated: -# Cosmin Truta, 27-Aug-2003 -# -# Usage: -# nmake -f win32/Makefile.msc (standard build) -# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build) -# nmake -f win32/Makefile.msc LOC=-DASMV OBJA=match.obj (use ASM code) - - -# optional build flags -LOC = - - -# variables -STATICLIB = zlib.lib -SHAREDLIB = zlib1.dll -IMPLIB = zdll.lib - -CC = cl -AS = ml -LD = link -AR = lib -RC = rc -CFLAGS = -nologo -MD -O2 $(LOC) -ASFLAGS = -coff -LDFLAGS = -nologo -release -ARFLAGS = -nologo -RCFLAGS = /dWIN32 /r - -OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj \ - inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -OBJA = - - -# targets -all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ - example.exe minigzip.exe example_d.exe minigzip_d.exe - -$(STATICLIB): $(OBJS) $(OBJA) - $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA) - -$(IMPLIB): $(SHAREDLIB) - -$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlib1.res - $(LD) $(LDFLAGS) -def:win32/zlib.def -dll -implib:$(IMPLIB) \ - -out:$@ $(OBJS) $(OBJA) zlib1.res - -example.exe: example.obj $(STATICLIB) - $(LD) $(LDFLAGS) example.obj $(STATICLIB) - -minigzip.exe: minigzip.obj $(STATICLIB) - $(LD) $(LDFLAGS) minigzip.obj $(STATICLIB) - -example_d.exe: example.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB) - -minigzip_d.exe: minigzip.obj $(IMPLIB) - $(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB) - -.c.obj: - $(CC) -c $(CFLAGS) $< - -.asm.obj: - $(AS) -c $(ASFLAGS) $< - -adler32.obj: adler32.c zlib.h zconf.h - -compress.obj: compress.c zlib.h zconf.h - -crc32.obj: crc32.c zlib.h zconf.h crc32.h - -deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h - -gzio.obj: gzio.c zutil.h zlib.h zconf.h - -infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h - -inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ - inffast.h inffixed.h - -inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h - -trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h - -uncompr.obj: uncompr.c zlib.h zconf.h - -zutil.obj: zutil.c zutil.h zlib.h zconf.h - -example.obj: example.c zlib.h zconf.h - -minigzip.obj: minigzip.c zlib.h zconf.h - -zlib1.res: win32/zlib1.rc - $(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc - - -# testing -test: example.exe minigzip.exe - example - echo hello world | minigzip | minigzip -d - -testdll: example_d.exe minigzip_d.exe - example_d - echo hello world | minigzip_d | minigzip_d -d - - -# cleanup -clean: - -del $(STATICLIB) - -del $(SHAREDLIB) - -del $(IMPLIB) - -del *.obj - -del *.res - -del *.exp - -del *.exe - -del foo.gz diff --git a/common/dist/zlib/win32/VisualC.txt b/common/dist/zlib/win32/VisualC.txt deleted file mode 100644 index 579a5fc9e..000000000 --- a/common/dist/zlib/win32/VisualC.txt +++ /dev/null @@ -1,3 +0,0 @@ - -To build zlib using the Microsoft Visual C++ environment, -use the appropriate project from the projects/ directory. diff --git a/common/dist/zlib/win32/zlib.def b/common/dist/zlib/win32/zlib.def deleted file mode 100644 index a47cbc10c..000000000 --- a/common/dist/zlib/win32/zlib.def +++ /dev/null @@ -1,60 +0,0 @@ -LIBRARY -; zlib data compression library - -EXPORTS -; basic functions - zlibVersion - deflate - deflateEnd - inflate - inflateEnd -; advanced functions - deflateSetDictionary - deflateCopy - deflateReset - deflateParams - deflateBound - deflatePrime - inflateSetDictionary - inflateSync - inflateCopy - inflateReset - inflateBack - inflateBackEnd - zlibCompileFlags -; utility functions - compress - compress2 - compressBound - uncompress - gzopen - gzdopen - gzsetparams - gzread - gzwrite - gzprintf - gzputs - gzgets - gzputc - gzgetc - gzungetc - gzflush - gzseek - gzrewind - gztell - gzeof - gzclose - gzerror - gzclearerr -; checksum functions - adler32 - crc32 -; various hacks, don't look :) - deflateInit_ - deflateInit2_ - inflateInit_ - inflateInit2_ - inflateBackInit_ - inflateSyncPoint - get_crc_table - zError diff --git a/common/dist/zlib/win32/zlib1.rc b/common/dist/zlib/win32/zlib1.rc deleted file mode 100644 index 99025c974..000000000 --- a/common/dist/zlib/win32/zlib1.rc +++ /dev/null @@ -1,39 +0,0 @@ -#include - -#ifdef GCC_WINDRES -VS_VERSION_INFO VERSIONINFO -#else -VS_VERSION_INFO VERSIONINFO MOVEABLE IMPURE LOADONCALL DISCARDABLE -#endif - FILEVERSION 1,2,2,0 - PRODUCTVERSION 1,2,2,0 - FILEFLAGSMASK VS_FFI_FILEFLAGSMASK -#ifdef _DEBUG - FILEFLAGS 1 -#else - FILEFLAGS 0 -#endif - FILEOS VOS_DOS_WINDOWS32 - FILETYPE VFT_DLL - FILESUBTYPE 0 // not used -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904E4" - //language ID = U.S. English, char set = Windows, Multilingual - BEGIN - VALUE "FileDescription", "zlib data compression library\0" - VALUE "FileVersion", "1.2.3\0" - VALUE "InternalName", "zlib1.dll\0" - VALUE "LegalCopyright", "(C) 1995-2004 Jean-loup Gailly & Mark Adler\0" - VALUE "OriginalFilename", "zlib1.dll\0" - VALUE "ProductName", "zlib\0" - VALUE "ProductVersion", "1.2.3\0" - VALUE "Comments","DLL support by Alessandro Iacopetti & Gilles Vollant\0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0409, 1252 - END -END diff --git a/common/include/ppath/Makefile b/common/include/ppath/Makefile deleted file mode 100644 index f9eb78f2c..000000000 --- a/common/include/ppath/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $Id: Makefile,v 1.1 2011/08/25 16:15:29 dyoung Exp $ -# $NetBSD: Makefile,v 1.1 2011/08/25 16:15:29 dyoung Exp $ - -INCS= ppath.h ppath_impl.h - -INCSDIR= /usr/include/ppath - -.include - diff --git a/common/include/ppath/ppath.h b/common/include/ppath/ppath.h deleted file mode 100644 index 4e8f9978b..000000000 --- a/common/include/ppath/ppath.h +++ /dev/null @@ -1,91 +0,0 @@ -/* $Id: ppath.h,v 1.1 2011/08/25 16:15:29 dyoung Exp $ */ - -/* Copyright (c) 2010 David Young. All rights reserved. */ - -#ifndef _PPATH_H -#define _PPATH_H - -#include - -#define PPATH_MAX_COMPONENTS 16 - -struct _ppath; -struct _ppath_component; -typedef struct _ppath ppath_t; -typedef struct _ppath_component ppath_component_t; - -ppath_component_t *ppath_idx(unsigned int); -ppath_component_t *ppath_key(const char *); - -ppath_component_t *ppath_component_retain(ppath_component_t *); -void ppath_component_release(ppath_component_t *); - -ppath_t *ppath_create(void); -unsigned int ppath_length(const ppath_t *); -int ppath_component_idx(const ppath_component_t *); -const char *ppath_component_key(const ppath_component_t *); -ppath_t *ppath_pop(ppath_t *, ppath_component_t **); -ppath_t *ppath_push(ppath_t *, ppath_component_t *); -ppath_component_t *ppath_component_at(const ppath_t *, unsigned int); -ppath_t *ppath_subpath(const ppath_t *, unsigned int, unsigned int); -ppath_t *ppath_push_idx(ppath_t *, unsigned int); -ppath_t *ppath_push_key(ppath_t *, const char *); -ppath_t *ppath_replace_idx(ppath_t *, unsigned int); -ppath_t *ppath_replace_key(ppath_t *, const char *); - -ppath_t *ppath_copy(const ppath_t *); -ppath_t *ppath_retain(ppath_t *); -void ppath_release(ppath_t *); - -prop_object_t ppath_lookup(prop_object_t, const ppath_t *); - -int ppath_copydel_object(prop_object_t, prop_object_t *, const ppath_t *); -int ppath_copyset_object(prop_object_t, prop_object_t *, const ppath_t *, - prop_object_t); -int ppath_create_object(prop_object_t, const ppath_t *, prop_object_t); -int ppath_set_object(prop_object_t, const ppath_t *, prop_object_t); -int ppath_get_object(prop_object_t, const ppath_t *, prop_object_t *); -int ppath_delete_object(prop_object_t, const ppath_t *); - -int ppath_copydel_bool(prop_object_t, prop_object_t *, const ppath_t *); -int ppath_copyset_bool(prop_object_t, prop_object_t *, const ppath_t *, bool); -int ppath_create_bool(prop_object_t, const ppath_t *, bool); -int ppath_create_int64(prop_object_t, const ppath_t *, int64_t); -int ppath_create_uint64(prop_object_t, const ppath_t *, uint64_t); -int ppath_create_data(prop_object_t, const ppath_t *, const void *, size_t); -int ppath_create_string(prop_object_t, const ppath_t *, const char *); -int ppath_set_bool(prop_object_t, const ppath_t *, bool); -int ppath_get_bool(prop_object_t, const ppath_t *, bool *); -int ppath_delete_bool(prop_object_t, const ppath_t *); - -int ppath_copydel_data(prop_object_t, prop_object_t *, const ppath_t *); -int ppath_copyset_data(prop_object_t, prop_object_t *, const ppath_t *, - const void *, size_t); -int ppath_set_data(prop_object_t, const ppath_t *, const void *, size_t); -int ppath_get_data(prop_object_t, const ppath_t *, const void **, size_t *); -int ppath_dup_data(prop_object_t, const ppath_t *, void **, size_t *); -int ppath_delete_data(prop_object_t, const ppath_t *); - -int ppath_copydel_int64(prop_object_t, prop_object_t *, const ppath_t *); -int ppath_copyset_int64(prop_object_t, prop_object_t *, const ppath_t *, - int64_t); -int ppath_set_int64(prop_object_t, const ppath_t *, int64_t); -int ppath_get_int64(prop_object_t, const ppath_t *, int64_t *); -int ppath_delete_int64(prop_object_t, const ppath_t *); - -int ppath_copydel_string(prop_object_t, prop_object_t *, const ppath_t *); -int ppath_copyset_string(prop_object_t, prop_object_t *, const ppath_t *, - const char *); -int ppath_set_string(prop_object_t, const ppath_t *, const char *); -int ppath_get_string(prop_object_t, const ppath_t *, const char **); -int ppath_dup_string(prop_object_t, const ppath_t *, char **); -int ppath_delete_string(prop_object_t, const ppath_t *); - -int ppath_copydel_uint64(prop_object_t, prop_object_t *, const ppath_t *); -int ppath_copyset_uint64(prop_object_t, prop_object_t *, const ppath_t *, - uint64_t); -int ppath_set_uint64(prop_object_t, const ppath_t *, uint64_t); -int ppath_get_uint64(prop_object_t, const ppath_t *, uint64_t *); -int ppath_delete_uint64(prop_object_t, const ppath_t *); - -#endif /* _PPATH_H */ diff --git a/common/include/ppath/ppath_impl.h b/common/include/ppath/ppath_impl.h deleted file mode 100644 index 8bb3ce4ed..000000000 --- a/common/include/ppath/ppath_impl.h +++ /dev/null @@ -1,23 +0,0 @@ -/* $Id: ppath_impl.h,v 1.1 2011/08/25 16:15:29 dyoung Exp $ */ - -/* Copyright (c) 2010 David Young. All rights reserved. */ - -#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE)) -#include -#include -#define ppath_assert(__x) KASSERT(__x) -#else -#include -#include -#include -#include -#define ppath_assert(__x) assert(__x) -#endif /* defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE)) */ - -void *ppath_alloc(size_t); -void ppath_free(void *, size_t); -void ppath_component_extant_inc(void); -void ppath_component_extant_dec(void); -void ppath_extant_inc(void); -void ppath_extant_dec(void); - diff --git a/common/include/prop/Makefile b/common/include/prop/Makefile deleted file mode 100644 index 0efa775b8..000000000 --- a/common/include/prop/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2007/08/17 11:05:04 pavel Exp $ - -INCS= prop_array.h prop_bool.h prop_data.h prop_dictionary.h \ - prop_ingest.h prop_number.h prop_object.h prop_string.h \ - proplib.h plistref.h - -INCSDIR= /usr/include/prop - -.include diff --git a/common/include/prop/plistref.h b/common/include/prop/plistref.h deleted file mode 100644 index 20755193c..000000000 --- a/common/include/prop/plistref.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: plistref.h,v 1.2 2008/04/28 20:22:51 martin Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PLISTREF_H_ -#define _PROPLIB_PLISTREF_H_ - -/* for size_t */ -#include - -/* - * Property List Reference -- - * Used to pass externalized property lists across protection - * boundaries (ioctls, syscalls, etc.). - */ -struct plistref { - void *pref_plist; /* plist data */ - size_t pref_len; /* total length of plist data */ -}; - -#endif /* _PROPLIB_PLISTREF_H_ */ diff --git a/common/include/prop/prop_array.h b/common/include/prop/prop_array.h deleted file mode 100644 index d01a3e0d2..000000000 --- a/common/include/prop/prop_array.h +++ /dev/null @@ -1,163 +0,0 @@ -/* $NetBSD: prop_array.h,v 1.13 2011/09/30 22:08:18 jym Exp $ */ - -/*- - * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROP_ARRAY_H_ -#define _PROPLIB_PROP_ARRAY_H_ - -#include - -typedef struct _prop_array *prop_array_t; - -__BEGIN_DECLS -prop_array_t prop_array_create(void); -prop_array_t prop_array_create_with_capacity(unsigned int); - -prop_array_t prop_array_copy(prop_array_t); -prop_array_t prop_array_copy_mutable(prop_array_t); - -unsigned int prop_array_capacity(prop_array_t); -unsigned int prop_array_count(prop_array_t); -bool prop_array_ensure_capacity(prop_array_t, unsigned int); - -void prop_array_make_immutable(prop_array_t); -bool prop_array_mutable(prop_array_t); - -prop_object_iterator_t prop_array_iterator(prop_array_t); - -prop_object_t prop_array_get(prop_array_t, unsigned int); -bool prop_array_set(prop_array_t, unsigned int, prop_object_t); -bool prop_array_add(prop_array_t, prop_object_t); -void prop_array_remove(prop_array_t, unsigned int); - -bool prop_array_equals(prop_array_t, prop_array_t); - -char * prop_array_externalize(prop_array_t); -prop_array_t prop_array_internalize(const char *); - -bool prop_array_externalize_to_file(prop_array_t, const char *); -prop_array_t prop_array_internalize_from_file(const char *); - -#if defined(__NetBSD__) -struct plistref; - -#if !defined(_KERNEL) && !defined(_STANDALONE) -bool prop_array_externalize_to_pref(prop_array_t, struct plistref *); -bool prop_array_internalize_from_pref(const struct plistref *, - prop_array_t *); -int prop_array_send_ioctl(prop_array_t, int, unsigned long); -int prop_array_recv_ioctl(int, unsigned long, prop_array_t *); -int prop_array_send_syscall(prop_array_t, struct plistref *); -int prop_array_recv_syscall(const struct plistref *, - prop_array_t *); -#elif defined(_KERNEL) -int prop_array_copyin(const struct plistref *, prop_array_t *); -int prop_array_copyout(struct plistref *, prop_array_t); -int prop_array_copyin_ioctl(const struct plistref *, const u_long, - prop_array_t *); -int prop_array_copyout_ioctl(struct plistref *, const u_long, - prop_array_t); -#endif -#endif /* __NetBSD__ */ - -/* - * Utility routines to make it more convenient to work with values - * stored in dictionaries. - */ -bool prop_array_get_bool(prop_array_t, unsigned int, - bool *); -bool prop_array_set_bool(prop_array_t, unsigned int, - bool); - -bool prop_array_get_int8(prop_array_t, unsigned int, - int8_t *); -bool prop_array_get_uint8(prop_array_t, unsigned int, - uint8_t *); -bool prop_array_set_int8(prop_array_t, unsigned int, - int8_t); -bool prop_array_set_uint8(prop_array_t, unsigned int, - uint8_t); - -bool prop_array_get_int16(prop_array_t, unsigned int, - int16_t *); -bool prop_array_get_uint16(prop_array_t, unsigned int, - uint16_t *); -bool prop_array_set_int16(prop_array_t, unsigned int, - int16_t); -bool prop_array_set_uint16(prop_array_t, unsigned int, - uint16_t); - -bool prop_array_get_int32(prop_array_t, unsigned int, - int32_t *); -bool prop_array_get_uint32(prop_array_t, unsigned int, - uint32_t *); -bool prop_array_set_int32(prop_array_t, unsigned int, - int32_t); -bool prop_array_set_uint32(prop_array_t, unsigned int, - uint32_t); - -bool prop_array_get_int64(prop_array_t, unsigned int, - int64_t *); -bool prop_array_get_uint64(prop_array_t, unsigned int, - uint64_t *); -bool prop_array_set_int64(prop_array_t, unsigned int, - int64_t); -bool prop_array_set_uint64(prop_array_t, unsigned int, - uint64_t); - -bool prop_array_add_int8(prop_array_t, int8_t); -bool prop_array_add_uint8(prop_array_t, uint8_t); - -bool prop_array_add_int16(prop_array_t, int16_t); -bool prop_array_add_uint16(prop_array_t, uint16_t); - -bool prop_array_add_int32(prop_array_t, int32_t); -bool prop_array_add_uint32(prop_array_t, uint32_t); - -bool prop_array_add_int64(prop_array_t, int64_t); -bool prop_array_add_uint64(prop_array_t, uint64_t); - -bool prop_array_get_cstring(prop_array_t, unsigned int, - char **); -bool prop_array_set_cstring(prop_array_t, unsigned int, - const char *); - -bool prop_array_get_cstring_nocopy(prop_array_t, - unsigned int, - const char **); -bool prop_array_set_cstring_nocopy(prop_array_t, - unsigned int, - const char *); - -bool prop_array_add_and_rel(prop_array_t, prop_object_t); - -__END_DECLS - -#endif /* _PROPLIB_PROP_ARRAY_H_ */ diff --git a/common/include/prop/prop_bool.h b/common/include/prop/prop_bool.h deleted file mode 100644 index f727ff491..000000000 --- a/common/include/prop/prop_bool.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: prop_bool.h,v 1.4 2008/04/28 20:22:51 martin Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROP_BOOL_H_ -#define _PROPLIB_PROP_BOOL_H_ - -#include - -typedef struct _prop_bool *prop_bool_t; - -__BEGIN_DECLS -prop_bool_t prop_bool_create(bool); -prop_bool_t prop_bool_copy(prop_bool_t); - -bool prop_bool_true(prop_bool_t); - -bool prop_bool_equals(prop_bool_t, prop_bool_t); -__END_DECLS - -#endif /* _PROPLIB_PROP_BOOL_H_ */ diff --git a/common/include/prop/prop_data.h b/common/include/prop/prop_data.h deleted file mode 100644 index ead37c55f..000000000 --- a/common/include/prop/prop_data.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $NetBSD: prop_data.h,v 1.3 2008/04/28 20:22:51 martin Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROP_DATA_H_ -#define _PROPLIB_PROP_DATA_H_ - -#include - -typedef struct _prop_data *prop_data_t; - -__BEGIN_DECLS -prop_data_t prop_data_create_data(const void *, size_t); -prop_data_t prop_data_create_data_nocopy(const void *, size_t); - -prop_data_t prop_data_copy(prop_data_t); - -size_t prop_data_size(prop_data_t); - -void * prop_data_data(prop_data_t); -const void * prop_data_data_nocopy(prop_data_t); - -bool prop_data_equals(prop_data_t, prop_data_t); -bool prop_data_equals_data(prop_data_t, const void *, size_t); -__END_DECLS - -#endif /* _PROPLIB_PROP_DATA_H_ */ diff --git a/common/include/prop/prop_dictionary.h b/common/include/prop/prop_dictionary.h deleted file mode 100644 index 6cfef9fac..000000000 --- a/common/include/prop/prop_dictionary.h +++ /dev/null @@ -1,181 +0,0 @@ -/* $NetBSD: prop_dictionary.h,v 1.14 2011/09/30 22:08:18 jym Exp $ */ - -/*- - * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROP_DICTIONARY_H_ -#define _PROPLIB_PROP_DICTIONARY_H_ - -#include - -typedef struct _prop_dictionary *prop_dictionary_t; -typedef struct _prop_dictionary_keysym *prop_dictionary_keysym_t; - -__BEGIN_DECLS -prop_dictionary_t prop_dictionary_create(void); -prop_dictionary_t prop_dictionary_create_with_capacity(unsigned int); - -prop_dictionary_t prop_dictionary_copy(prop_dictionary_t); -prop_dictionary_t prop_dictionary_copy_mutable(prop_dictionary_t); - -unsigned int prop_dictionary_count(prop_dictionary_t); -bool prop_dictionary_ensure_capacity(prop_dictionary_t, - unsigned int); - -void prop_dictionary_make_immutable(prop_dictionary_t); -bool prop_dictionary_mutable(prop_dictionary_t); - -prop_object_iterator_t prop_dictionary_iterator(prop_dictionary_t); -prop_array_t prop_dictionary_all_keys(prop_dictionary_t); - -prop_object_t prop_dictionary_get(prop_dictionary_t, const char *); -bool prop_dictionary_set(prop_dictionary_t, const char *, - prop_object_t); -void prop_dictionary_remove(prop_dictionary_t, const char *); - -prop_object_t prop_dictionary_get_keysym(prop_dictionary_t, - prop_dictionary_keysym_t); -bool prop_dictionary_set_keysym(prop_dictionary_t, - prop_dictionary_keysym_t, - prop_object_t); -void prop_dictionary_remove_keysym(prop_dictionary_t, - prop_dictionary_keysym_t); - -bool prop_dictionary_equals(prop_dictionary_t, prop_dictionary_t); - -char * prop_dictionary_externalize(prop_dictionary_t); -prop_dictionary_t prop_dictionary_internalize(const char *); - -bool prop_dictionary_externalize_to_file(prop_dictionary_t, - const char *); -prop_dictionary_t prop_dictionary_internalize_from_file(const char *); - -const char * prop_dictionary_keysym_cstring_nocopy(prop_dictionary_keysym_t); - -bool prop_dictionary_keysym_equals(prop_dictionary_keysym_t, - prop_dictionary_keysym_t); - -#if defined(__NetBSD__) -struct plistref; - -#if !defined(_KERNEL) && !defined(_STANDALONE) -bool prop_dictionary_externalize_to_pref(prop_dictionary_t, struct plistref *); -bool prop_dictionary_internalize_from_pref(const struct plistref *, - prop_dictionary_t *); -int prop_dictionary_send_ioctl(prop_dictionary_t, int, - unsigned long); -int prop_dictionary_recv_ioctl(int, unsigned long, - prop_dictionary_t *); -int prop_dictionary_sendrecv_ioctl(prop_dictionary_t, - int, unsigned long, - prop_dictionary_t *); -int prop_dictionary_send_syscall(prop_dictionary_t, - struct plistref *); -int prop_dictionary_recv_syscall(const struct plistref *, - prop_dictionary_t *); -#elif defined(_KERNEL) -int prop_dictionary_copyin(const struct plistref *, - prop_dictionary_t *); -int prop_dictionary_copyout(struct plistref *, - prop_dictionary_t); -int prop_dictionary_copyin_ioctl(const struct plistref *, - const u_long, - prop_dictionary_t *); -int prop_dictionary_copyout_ioctl(struct plistref *, - const u_long, - prop_dictionary_t); -#endif -#endif /* __NetBSD__ */ - -/* - * Utility routines to make it more convenient to work with values - * stored in dictionaries. - */ -bool prop_dictionary_get_dict(prop_dictionary_t, const char *, - prop_dictionary_t *); -bool prop_dictionary_get_bool(prop_dictionary_t, const char *, - bool *); -bool prop_dictionary_set_bool(prop_dictionary_t, const char *, - bool); - -bool prop_dictionary_get_int8(prop_dictionary_t, const char *, - int8_t *); -bool prop_dictionary_get_uint8(prop_dictionary_t, const char *, - uint8_t *); -bool prop_dictionary_set_int8(prop_dictionary_t, const char *, - int8_t); -bool prop_dictionary_set_uint8(prop_dictionary_t, const char *, - uint8_t); - -bool prop_dictionary_get_int16(prop_dictionary_t, const char *, - int16_t *); -bool prop_dictionary_get_uint16(prop_dictionary_t, const char *, - uint16_t *); -bool prop_dictionary_set_int16(prop_dictionary_t, const char *, - int16_t); -bool prop_dictionary_set_uint16(prop_dictionary_t, const char *, - uint16_t); - -bool prop_dictionary_get_int32(prop_dictionary_t, const char *, - int32_t *); -bool prop_dictionary_get_uint32(prop_dictionary_t, const char *, - uint32_t *); -bool prop_dictionary_set_int32(prop_dictionary_t, const char *, - int32_t); -bool prop_dictionary_set_uint32(prop_dictionary_t, const char *, - uint32_t); - -bool prop_dictionary_get_int64(prop_dictionary_t, const char *, - int64_t *); -bool prop_dictionary_get_uint64(prop_dictionary_t, const char *, - uint64_t *); -bool prop_dictionary_set_int64(prop_dictionary_t, const char *, - int64_t); -bool prop_dictionary_set_uint64(prop_dictionary_t, const char *, - uint64_t); - -bool prop_dictionary_get_cstring(prop_dictionary_t, const char *, - char **); -bool prop_dictionary_set_cstring(prop_dictionary_t, const char *, - const char *); - -bool prop_dictionary_get_cstring_nocopy(prop_dictionary_t, - const char *, - const char **); -bool prop_dictionary_set_cstring_nocopy(prop_dictionary_t, - const char *, - const char *); - -bool prop_dictionary_set_and_rel(prop_dictionary_t, - const char *, - prop_object_t); - -__END_DECLS - -#endif /* _PROPLIB_PROP_DICTIONARY_H_ */ diff --git a/common/include/prop/prop_ingest.h b/common/include/prop/prop_ingest.h deleted file mode 100644 index f82a57de0..000000000 --- a/common/include/prop/prop_ingest.h +++ /dev/null @@ -1,90 +0,0 @@ -/* $NetBSD: prop_ingest.h,v 1.3 2008/04/28 20:22:51 martin Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROP_INGEST_H_ -#define _PROPLIB_PROP_INGEST_H_ - -#include - -typedef enum { - PROP_INGEST_ERROR_NO_ERROR = 0, - PROP_INGEST_ERROR_NO_KEY = 1, - PROP_INGEST_ERROR_WRONG_TYPE = 2, - PROP_INGEST_ERROR_HANDLER_FAILED = 3 -} prop_ingest_error_t; - -typedef enum { - PROP_INGEST_FLAG_OPTIONAL = 0x01 -} prop_ingest_flag_t; - -typedef struct _prop_ingest_context *prop_ingest_context_t; - -typedef bool (*prop_ingest_handler_t)(prop_ingest_context_t, prop_object_t); - -typedef struct { - const char *pite_key; - prop_type_t pite_type; - unsigned int pite_flags; - prop_ingest_handler_t pite_handler; -} prop_ingest_table_entry; - -#define PROP_INGEST(key_, type_, handler_) \ - { .pite_key = key_ , \ - .pite_type = type_ , \ - .pite_flags = 0 , \ - .pite_handler = handler_ } - -#define PROP_INGEST_OPTIONAL(key_, type_, handler_) \ - { .pite_key = key_ , \ - .pite_type = type_ , \ - .pite_flags = PROP_INGEST_FLAG_OPTIONAL , \ - .pite_handler = handler_ } - -#define PROP_INGEST_END \ - { .pite_key = NULL } - -__BEGIN_DECLS -prop_ingest_context_t - prop_ingest_context_alloc(void *); -void prop_ingest_context_free(prop_ingest_context_t); - -prop_ingest_error_t - prop_ingest_context_error(prop_ingest_context_t); -prop_type_t prop_ingest_context_type(prop_ingest_context_t); -const char * prop_ingest_context_key(prop_ingest_context_t); -void * prop_ingest_context_private(prop_ingest_context_t); - -bool prop_dictionary_ingest(prop_dictionary_t, - const prop_ingest_table_entry[], - prop_ingest_context_t); -__END_DECLS - -#endif /* _PROPLIB_PROP_INGEST_H_ */ diff --git a/common/include/prop/prop_number.h b/common/include/prop/prop_number.h deleted file mode 100644 index a6a2a1491..000000000 --- a/common/include/prop/prop_number.h +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: prop_number.h,v 1.6 2008/04/28 20:22:51 martin Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROP_NUMBER_H_ -#define _PROPLIB_PROP_NUMBER_H_ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif -#include - -typedef struct _prop_number *prop_number_t; - -__BEGIN_DECLS -prop_number_t prop_number_create_integer(int64_t); -prop_number_t prop_number_create_unsigned_integer(uint64_t); - -prop_number_t prop_number_copy(prop_number_t); - -int prop_number_size(prop_number_t); -bool prop_number_unsigned(prop_number_t); - -int64_t prop_number_integer_value(prop_number_t); -uint64_t prop_number_unsigned_integer_value(prop_number_t); - -bool prop_number_equals(prop_number_t, prop_number_t); -bool prop_number_equals_integer(prop_number_t, int64_t); -bool prop_number_equals_unsigned_integer(prop_number_t, uint64_t); -__END_DECLS - -#endif /* _PROPLIB_PROP_NUMBER_H_ */ diff --git a/common/include/prop/prop_object.h b/common/include/prop/prop_object.h deleted file mode 100644 index e1203339c..000000000 --- a/common/include/prop/prop_object.h +++ /dev/null @@ -1,72 +0,0 @@ -/* $NetBSD: prop_object.h,v 1.8 2008/12/05 13:11:41 ad Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROP_OBJECT_H_ -#define _PROPLIB_PROP_OBJECT_H_ - -#include - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif /* ! _KERNEL && ! _STANDALONE */ - -typedef void *prop_object_t; - -typedef enum { - PROP_TYPE_UNKNOWN = 0x00000000, -#ifndef _PROPLIB_ZFS_CONFLICT - PROP_TYPE_BOOL = 0x626f6f6c, /* 'bool' */ - PROP_TYPE_NUMBER = 0x6e6d6272, /* 'nmbr' */ - PROP_TYPE_STRING = 0x73746e67, /* 'stng' */ - PROP_TYPE_DATA = 0x64617461, /* 'data' */ - PROP_TYPE_ARRAY = 0x61726179, /* 'aray' */ - PROP_TYPE_DICTIONARY = 0x64696374, /* 'dict' */ - PROP_TYPE_DICT_KEYSYM = 0x646b6579 /* 'dkey' */ -#endif /* !_PROPLIB_ZFS_CONFLICT */ -} prop_type_t; - -__BEGIN_DECLS -void prop_object_retain(prop_object_t); -void prop_object_release(prop_object_t); - -prop_type_t prop_object_type(prop_object_t); - -bool prop_object_equals(prop_object_t, prop_object_t); -bool prop_object_equals_with_error(prop_object_t, prop_object_t, bool *); - -typedef struct _prop_object_iterator *prop_object_iterator_t; - -prop_object_t prop_object_iterator_next(prop_object_iterator_t); -void prop_object_iterator_reset(prop_object_iterator_t); -void prop_object_iterator_release(prop_object_iterator_t); -__END_DECLS - -#endif /* _PROPLIB_PROP_OBJECT_H_ */ diff --git a/common/include/prop/prop_string.h b/common/include/prop/prop_string.h deleted file mode 100644 index eb64e8773..000000000 --- a/common/include/prop/prop_string.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: prop_string.h,v 1.3 2008/04/28 20:22:51 martin Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROP_STRING_H_ -#define _PROPLIB_PROP_STRING_H_ - -#include - -typedef struct _prop_string *prop_string_t; - -__BEGIN_DECLS -prop_string_t prop_string_create(void); -prop_string_t prop_string_create_cstring(const char *); -prop_string_t prop_string_create_cstring_nocopy(const char *); - -prop_string_t prop_string_copy(prop_string_t); -prop_string_t prop_string_copy_mutable(prop_string_t); - -size_t prop_string_size(prop_string_t); -bool prop_string_mutable(prop_string_t); - -char * prop_string_cstring(prop_string_t); -const char * prop_string_cstring_nocopy(prop_string_t); - -bool prop_string_append(prop_string_t, prop_string_t); -bool prop_string_append_cstring(prop_string_t, const char *); - -bool prop_string_equals(prop_string_t, prop_string_t); -bool prop_string_equals_cstring(prop_string_t, const char *); -__END_DECLS - -#endif /* _PROPLIB_PROP_STRING_H_ */ diff --git a/common/include/prop/proplib.h b/common/include/prop/proplib.h deleted file mode 100644 index f136265de..000000000 --- a/common/include/prop/proplib.h +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: proplib.h,v 1.7 2009/09/13 18:45:10 pooka Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROPLIB_PROPLIB_H_ -#define _PROPLIB_PROPLIB_H_ - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#ifdef _KERNEL -void prop_kern_init(void); -#endif - -#endif /* _PROPLIB_PROPLIB_H_ */ diff --git a/common/lib/libc/Makefile.inc b/common/lib/libc/Makefile.inc deleted file mode 100644 index 54652a6d2..000000000 --- a/common/lib/libc/Makefile.inc +++ /dev/null @@ -1,51 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.16 2014/08/10 23:25:49 matt Exp $ - -.include - -COMMON_DIR:=${.PARSEDIR} -.if defined(__MINIX) -COMMON_CODEDIRS=atomic gen inet md net stdlib string -.else -COMMON_CODEDIRS=atomic gen gmon inet md net stdlib string sys -.endif -COMMON_CODEDIRS+=hash/sha1 hash/sha2 hash/rmd160 hash/murmurhash - -.if defined(COMMON_MACHINE_ARCH) && !empty(COMMON_MACHINE_ARCH) && \ - exists(${COMMON_DIR}/arch/${COMMON_MACHINE_ARCH}) -COMMON_ARCHSUBDIR= ${COMMON_MACHINE_ARCH} -.elif defined(COMMON_MACHINE_CPU) && !empty(COMMON_MACHINE_CPU) && \ - exists(${COMMON_DIR}/arch/${COMMON_MACHINE_CPU}) -COMMON_ARCHSUBDIR= ${COMMON_MACHINE_CPU} -.elif defined(LIBKERN_ARCH) && !empty(LIBKERN_ARCH) && \ - exists(${KERNDIR}/arch/${LIBKERN_ARCH}) -COMMON_ARCHSUBDIR= ${LIBKERN_ARCH} -.elif exists(${COMMON_DIR}/arch/${MACHINE_ARCH}) -COMMON_ARCHSUBDIR= ${MACHINE_ARCH} -.elif exists(${COMMON_DIR}/arch/${MACHINE_CPU}) -COMMON_ARCHSUBDIR= ${MACHINE_CPU} -.endif - -COMMON_ARCHDIR=${COMMON_DIR}/arch/${COMMON_ARCHSUBDIR} - -.for i in ${COMMON_CODEDIRS} -.if exists(${COMMON_DIR}/$i) -.PATH.c: ${COMMON_DIR}/$i -.endif -.if exists(${COMMON_ARCHDIR}/${i}/Makefile.inc) -.include "${COMMON_ARCHDIR}/${i}/Makefile.inc" -.endif -.if !empty(CPPFLAGS:M-DLIBKERN_OPTIMISE_SPACE) && \ - exists(${COMMON_ARCHDIR}/$i/small) -.PATH.S: ${COMMON_ARCHDIR}/$i/small -.endif - -.if exists(${COMMON_ARCHDIR}/$i) -.PATH.c: ${COMMON_ARCHDIR}/$i -.PATH.S: ${COMMON_ARCHDIR}/$i -.endif -.endfor - -CPPFLAGS+=-I${COMMON_DIR}/quad -I${COMMON_DIR}/string -.if defined(COMMON_ARCHSUBDIR) -CPPFLAGS+=-I${COMMON_ARCHDIR}/string -.endif diff --git a/common/lib/libc/arch/aarch64/atomic/Makefile.inc b/common/lib/libc/arch/aarch64/atomic/Makefile.inc deleted file mode 100644 index 2fd3e000e..000000000 --- a/common/lib/libc/arch/aarch64/atomic/Makefile.inc +++ /dev/null @@ -1,25 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.1 2014/08/10 05:47:35 matt Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -.for op in add and cas nand or sub swap xor -.for sz in 8 16 32 64 -SRCS.atomic+= atomic_${op}_${sz}.S -.endfor -.endfor -SRCS.atomic+= atomic_dec_32.S atomic_dec_64.S -SRCS.atomic+= atomic_inc_32.S atomic_inc_64.S -SRCS.atomic+= membar_ops.S -#.for op in add and nand or sub xor -#SRCS.atomic+= sync_fetch_and_${op}_8.S -#.endfor -#.for sz in 1 2 4 8 -#SRCS.atomic+= sync_bool_compare_and_swap_${sz}.S -#.endfor - -.endif - -SRCS.atomic+= atomic_init_cas.c - -SRCS+= ${SRCS.atomic} diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_add_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_add_16.S deleted file mode 100644 index a088a2bb0..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_add_16.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_add_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP16(add, add) - -ATOMIC_OP_ALIAS(atomic_add_16,_atomic_add_16) -ATOMIC_OP_ALIAS(atomic_add_short,_atomic_add_16) -STRONG_ALIAS(__sync_fetch_and_add_2,_atomic_add_16) -STRONG_ALIAS(_atomic_add_short,_atomic_add_16) - -ATOMIC_OP16_NV(add, add) - -ATOMIC_OP_ALIAS(atomic_add_16_nv,_atomic_add_16_nv) -ATOMIC_OP_ALIAS(atomic_add_short_nv,_atomic_add_16_nv) -STRONG_ALIAS(__sync_add_and_fetch_2,_atomic_add_16_nv) -STRONG_ALIAS(_atomic_add_short_nv,_atomic_add_16_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_add_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_add_32.S deleted file mode 100644 index c157f6895..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_add_32.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_add_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP32(add, add) - -ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) -STRONG_ALIAS(__sync_fetch_and_add_4,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) - -ATOMIC_OP32_NV(add, add) - -ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_add_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_add_64.S deleted file mode 100644 index d815b8db4..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_add_64.S +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: atomic_add_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP64(add, add) - -ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv) -STRONG_ALIAS(__sync_add_and_fetch_8,_atomic_add_64_nv) - -ATOMIC_OP64_NV(add, add) - -ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_64) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64) -STRONG_ALIAS(_atomic_add_long,_atomic_add_64) -STRONG_ALIAS(__sync_fetch_and_add_8,_atomic_add_64) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_add_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_add_8.S deleted file mode 100644 index 3dc5a2a55..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_add_8.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_add_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP8(add, add) - -ATOMIC_OP_ALIAS(atomic_add_8,_atomic_add_8) -ATOMIC_OP_ALIAS(atomic_add_char,_atomic_add_8) -STRONG_ALIAS(__sync_fetch_and_add_1,_atomic_add_8) -STRONG_ALIAS(_atomic_add_char,_atomic_add_8) - -ATOMIC_OP8_NV(add, add) - -ATOMIC_OP_ALIAS(atomic_add_8_nv,_atomic_add_8_nv) -ATOMIC_OP_ALIAS(atomic_add_char_nv,_atomic_add_8_nv) -STRONG_ALIAS(__sync_add_and_fetch_1,_atomic_add_8_nv) -STRONG_ALIAS(_atomic_add_char_nv,_atomic_add_8_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_and_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_and_16.S deleted file mode 100644 index f7427fe45..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_and_16.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_and_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP16(and, and) - -ATOMIC_OP_ALIAS(atomic_and_16,_atomic_and_16) -ATOMIC_OP_ALIAS(atomic_and_ushort,_atomic_and_16) -STRONG_ALIAS(__sync_fetch_and_and_2,_atomic_and_16) -STRONG_ALIAS(_atomic_and_ushort,_atomic_and_16) - -ATOMIC_OP16_NV(and, and) - -ATOMIC_OP_ALIAS(atomic_and_16_nv,_atomic_and_16_nv) -ATOMIC_OP_ALIAS(atomic_and_ushort_nv,_atomic_and_16_nv) -STRONG_ALIAS(__sync_and_and_fetch_2,_atomic_and_16_nv) -STRONG_ALIAS(_atomic_and_ushort_nv,_atomic_and_16_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_and_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_and_32.S deleted file mode 100644 index 44ea5f04a..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_and_32.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_and_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP32(and, and) - -ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(__sync_fetch_and_and_4,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) - -ATOMIC_OP32_NV(and, and) - -ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(__sync_and_and_fetch_4,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_and_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_and_64.S deleted file mode 100644 index 9e3a86eb0..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_and_64.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_and_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP64(and, and) - -ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64) -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_64) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64) -STRONG_ALIAS(__sync_fetch_and_and_8,_atomic_and_64) - -ATOMIC_OP64_NV(and, and) - -ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64_nv) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_64_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64_nv) -STRONG_ALIAS(__sync_and_and_fetch_8,_atomic_and_64_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_and_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_and_8.S deleted file mode 100644 index bad4e7e02..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_and_8.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_and_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP8(and, and) - -ATOMIC_OP_ALIAS(atomic_and_8,_atomic_and_8) -ATOMIC_OP_ALIAS(atomic_and_uchar,_atomic_and_8) -STRONG_ALIAS(__sync_fetch_and_and_1,_atomic_and_8) -STRONG_ALIAS(_atomic_and_uchar,_atomic_and_8) - -ATOMIC_OP8_NV(and, and) - -ATOMIC_OP_ALIAS(atomic_and_8_nv,_atomic_and_8_nv) -ATOMIC_OP_ALIAS(atomic_and_uchar_nv,_atomic_and_8_nv) -STRONG_ALIAS(__sync_and_and_fetch_1,_atomic_and_8_nv) -STRONG_ALIAS(_atomic_and_uchar_nv,_atomic_and_8_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S deleted file mode 100644 index b2a9440a6..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_cas_16.S +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: atomic_cas_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_cas_16) - mov x4, x0 /* we need r0 for return value */ -1: ldxrh w0, [x4] /* load old value */ - cmp w0, w1 /* compare? */ - b.ne 2f - stxrh w3, w2, [x4] /* store new value */ - cbnz w3, 1b /* succeed? nope, try again. */ - dmb st /* data memory barrier */ -2: ret /* return. */ -END(_atomic_cas_16) - -ATOMIC_OP_ALIAS(atomic_cas_16,_atomic_cas_16) -STRONG_ALIAS(_atomic_cas_short,_atomic_cas_16) -STRONG_ALIAS(_atomic_cas_ushort,_atomic_cas_16) -STRONG_ALIAS(__sync_val_compare_and_swap_2,_atomic_cas_16) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S deleted file mode 100644 index 7190c8164..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_cas_32.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: atomic_cas_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_cas_32) - mov x4, x0 /* we need r0 for return value */ -1: ldxr w0, [x4] /* load old value */ - cmp w0, w1 /* compare? */ - b.ne 2f /* return if different */ - stxr w3, w2, [x4] /* store new value */ - cbnz w3, 1b /* succeed? nope, try again. */ - dmb st -2: ret /* return. */ -END(_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32) -STRONG_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_cas_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_cas_64.S deleted file mode 100644 index 5f94cb8bd..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_cas_64.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_cas_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_cas_64) - mov x4, x0 /* we need r0 for return value */ -1: ldxr x0, [x4] /* load old value */ - cmp x0, x1 /* compare? */ - b.ne 2f /* return if different */ - stxr w3, x2, [x4] /* store new value */ - cbnz w3, 1b /* succeed? nope, try again. */ - dmb st -2: ret /* return. */ -END(_atomic_cas_64) - -ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_64) -STRONG_ALIAS(__sync_val_compare_and_swap_8,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_64_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S deleted file mode 100644 index 7c8f13916..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_cas_8.S +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: atomic_cas_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_cas_8) - mov x4, x0 /* we need r0 for return value */ -1: ldxrb w0, [x4] /* load old value */ - cmp w0, w1 /* compare? */ - b.ne 2f - stxrb w3, w2, [x4] /* store new value */ - cbnz w3, 1b /* succeed? nope, try again. */ - dmb st /* data memory barrier */ -2: ret /* return. */ -END(_atomic_cas_8) - -ATOMIC_OP_ALIAS(atomic_cas_8,_atomic_cas_8) -STRONG_ALIAS(_atomic_cas_char,_atomic_cas_8) -STRONG_ALIAS(_atomic_cas_uchar,_atomic_cas_8) -STRONG_ALIAS(__sync_val_compare_and_swap_1,_atomic_cas_8) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_dec_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_dec_32.S deleted file mode 100644 index 6ae4cfb93..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_dec_32.S +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: atomic_dec_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_dec_32) -1: ldxr w3, [x0] /* load old value (return value) */ - sub w3, w3, #1 /* calculate new value */ - stxr w2, w3, [x0] /* try to store */ - cbnz w2, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_dec_32) - -ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) - -ENTRY_NP(_atomic_dec_32_nv) - mov x4, x0 /* need r0 for return value */ -1: ldxr w0, [x4] /* load old value */ - sub w0, w0, #1 /* calculate new value (return value) */ - stxr w3, w0, [x4] /* try to store */ - cbnz w3, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_dec_32_nv) - -ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_dec_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_dec_64.S deleted file mode 100644 index cde2968b2..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_dec_64.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_dec_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_dec_64) -1: ldxr x2, [x0] /* load old value (return value) */ - sub x2, x2, #1 /* calculate new value */ - stxr w3, x2, [x0] /* try to store */ - cbnz w3, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_dec_64) - -ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64) - -ENTRY_NP(_atomic_dec_64_nv) - mov x4, x0 /* need r0 for return value */ -1: ldxr x0, [x4] /* load old value */ - sub x0, x0, #1 /* calculate new value (return value) */ - stxr w3, x0, [x4] /* try to store */ - cbnz w3, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_dec_64_nv) - -ATOMIC_OP_ALIAS(atomic_dec_64_nv,_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_64_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_64_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_inc_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_inc_32.S deleted file mode 100644 index 303693b84..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_inc_32.S +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: atomic_inc_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_inc_32) -1: ldxr w3, [x0] /* load old value (return value) */ - add w3, w3, #1 /* calculate new value */ - stxr w2, w3, [x0] /* try to store */ - cbnz w2, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_inc_32) - -ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) - -ENTRY_NP(_atomic_inc_32_nv) - mov x4, x0 /* need r0 for return value */ -1: ldxr w0, [x4] /* load old value */ - add w0, w0, #1 /* calculate new value (return value) */ - stxr w3, w0, [x4] /* try to store */ - cbnz w3, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_inc_32_nv) - -ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_inc_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_inc_64.S deleted file mode 100644 index 0d623c52b..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_inc_64.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_inc_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_inc_64) -1: ldxr x2, [x0] /* load old value (return value) */ - add x2, x2, #1 /* calculate new value */ - stxr w3, x2, [x0] /* try to store */ - cbnz w3, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_inc_64) - -ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64) - -ENTRY_NP(_atomic_inc_64_nv) - mov x4, x0 /* need r0 for return value */ -1: ldxr x0, [x4] /* load old value */ - add x0, x0, #1 /* calculate new value (return value) */ - stxr w3, x0, [x4] /* try to store */ - cbnz w3, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_inc_64_nv) - -ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S deleted file mode 100644 index 9ac756224..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_nand_16.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_nand_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_nand_16) - mov x4, x0 -1: ldxrh w0, [x4] /* load old value (to be returned) */ - mvn w3, w0 /* complement source */ - and w3, w3, w1 /* calculate new value */ - stxrh w2, w3, [x4] /* try to store */ - cbnz w2, 1b /* succeed? no, try again */ - dmb st - ret /* return old value */ -END(_atomic_nand_16) - -ATOMIC_OP_ALIAS(atomic_nand_16,_atomic_nand_16) -ATOMIC_OP_ALIAS(atomic_nand_ushort,_atomic_nand_16) -STRONG_ALIAS(__sync_fetch_and_nand_2,_atomic_nand_16) -STRONG_ALIAS(_atomic_nand_ushort,_atomic_nand_16) - -ENTRY_NP(_atomic_nand_16_nv) - mov x4, x0 /* need r0 for return value */ -1: ldxrh w0, [x4] /* load old value */ - mvn w0, w0 /* complement source */ - and w0, w0, w1 /* calculate new value (return value) */ - stxrh w2, w0, [x4] /* try to store */ - cbnz w2, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_nand_16_nv) - -ATOMIC_OP_ALIAS(atomic_nand_16_nv,_atomic_nand_16_nv) -ATOMIC_OP_ALIAS(atomic_nand_ushort_nv,_atomic_nand_16_nv) -STRONG_ALIAS(__sync_nand_and_fetch_2,_atomic_nand_16_nv) -STRONG_ALIAS(_atomic_nand_ushort_nv,_atomic_nand_16_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S deleted file mode 100644 index 3b22fcf9f..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_nand_32.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_nand_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_nand_32) - mov x4, x0 -1: ldxr w0, [x4] /* load old value (to be returned) */ - mvn w3, w0 /* complement source */ - and w3, w3, w1 /* calculate new value */ - stxr w2, w3, [x4] /* try to store */ - cbnz w2, 1b /* succeed? no, try again */ - dmb st - ret /* return old value */ -END(_atomic_nand_32) - -ATOMIC_OP_ALIAS(atomic_nand_32,_atomic_nand_32) -ATOMIC_OP_ALIAS(atomic_nand_uint,_atomic_nand_32) -STRONG_ALIAS(__sync_fetch_and_nand_4,_atomic_nand_32) -STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32) - -ENTRY_NP(_atomic_nand_32_nv) - mov x4, x0 /* need r0 for return value */ -1: ldxr w0, [x4] /* load old value */ - mvn w0, w0 /* complement source */ - and w0, w0, w1 /* calculate new value (return value) */ - stxr w2, w0, [x4] /* try to store */ - cbnz w2, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_nand_32_nv) - -ATOMIC_OP_ALIAS(atomic_nand_32_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_uint_nv,_atomic_nand_32_nv) -STRONG_ALIAS(__sync_nand_and_fetch_4,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_uint_nv,_atomic_nand_32_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S deleted file mode 100644 index 8868fdb0a..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_nand_64.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_nand_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_nand_64) - mov x4, x0 -1: ldxr x0, [x4] /* load old value (to be returned) */ - mvn x2, x0 /* complement source */ - and x2, x2, x1 /* calculate new value */ - stxr w3, x2, [x4] /* try to store */ - cbnz w3, 1b /* succeed? no, try again */ - dmb st - ret /* return old value */ -END(_atomic_nand_64) - -ATOMIC_OP_ALIAS(atomic_nand_64,_atomic_nand_64) -ATOMIC_OP_ALIAS(atomic_nand_ulong,_atomic_nand_64) -STRONG_ALIAS(__sync_fetch_and_nand_8,_atomic_nand_64) -STRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_64) - -ENTRY_NP(_atomic_nand_64_nv) - mov x4, x0 /* need r0 for return value */ -1: ldxr x0, [x4] /* load old value */ - mvn x0, x0 /* complement source */ - and x0, x0, x1 /* calculate new value (return value) */ - stxr w3, x0, [x4] /* try to store */ - cbnz w3, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_nand_64_nv) - -ATOMIC_OP_ALIAS(atomic_nand_64_nv,_atomic_nand_64_nv) -ATOMIC_OP_ALIAS(atomic_nand_ulong_nv,_atomic_nand_64_nv) -STRONG_ALIAS(__sync_nand_and_fetch_8,_atomic_nand_64_nv) -STRONG_ALIAS(_atomic_nand_ulong_nv,_atomic_nand_64_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S deleted file mode 100644 index fdd282c09..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_nand_8.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_nand_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_nand_8) - mov x4, x0 -1: ldxrb w0, [x4] /* load old value (to be returned) */ - mvn w3, w0 /* complement source */ - and w3, w3, w1 /* calculate new value */ - stxrb w2, w3, [x4] /* try to store */ - cbnz w2, 1b /* succeed? no, try again */ - dmb st - ret /* return old value */ -END(_atomic_nand_8) - -ATOMIC_OP_ALIAS(atomic_nand_8,_atomic_nand_8) -ATOMIC_OP_ALIAS(atomic_nand_uchar,_atomic_nand_8) -STRONG_ALIAS(__sync_fetch_and_nand_1,_atomic_nand_8) -STRONG_ALIAS(_atomic_nand_uchar,_atomic_nand_8) - -ENTRY_NP(_atomic_nand_8_nv) - mov x4, x0 /* need r0 for return value */ -1: ldxrb w0, [x4] /* load old value */ - mvn w0, w0 /* complement source */ - and w0, w0, w1 /* calculate new value (return value) */ - stxrb w2, w0, [x4] /* try to store */ - cbnz w2, 1b /* succeed? no, try again? */ - dmb st - ret /* return new value */ -END(_atomic_nand_8_nv) - -ATOMIC_OP_ALIAS(atomic_nand_8_nv,_atomic_nand_8_nv) -ATOMIC_OP_ALIAS(atomic_nand_uchar_nv,_atomic_nand_8_nv) -STRONG_ALIAS(__sync_nand_and_fetch_1,_atomic_nand_8_nv) -STRONG_ALIAS(_atomic_nand_uchar_nv,_atomic_nand_8_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_op_asm.h b/common/lib/libc/arch/aarch64/atomic/atomic_op_asm.h deleted file mode 100644 index 1f092e9b3..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_op_asm.h +++ /dev/null @@ -1,135 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#define ATOMIC_OP8(OP, INSN) \ -ENTRY_NP(_atomic_##OP##_8) ;\ - mov x4, x0 ;\ -1: ldxrb w0, [x4] /* load old value */ ;\ - INSN w2, w1, w0 /* calculate new value */ ;\ - stxrb w3, w2, [x4] /* try to store */ ;\ - cbnz w3, 1b /* succeed? no, try again */ ;\ - dmb st ;\ - ret /* return old value */ ;\ -END(_atomic_##OP##_8) - -#define ATOMIC_OP8_NV(OP, INSN) \ -ENTRY_NP(_atomic_##OP##_8_nv) ;\ - mov x4, x0 /* need r0 for return value */ ;\ -1: ldxrb w0, [x4] /* load old value */ ;\ - INSN w2, w1, w0 /* calc new (return) value */ ;\ - stxrb w3, w2, [x4] /* try to store */ ;\ - cbnz w3, 1b /* succeed? no, try again */ ;\ - dmb st ;\ - ret /* return new value */ ;\ -END(_atomic_##OP##_8_nv) - -#define ATOMIC_OP16(OP, INSN) \ -ENTRY_NP(_atomic_##OP##_16) ;\ - mov x4, x0 ;\ -1: ldxrh w0, [x4] /* load old value */ ;\ - INSN w2, w1, w0 /* calculate new value */ ;\ - stxrh w3, w2, [x4] /* try to store */ ;\ - cbnz w3, 1b /* succeed? no, try again */ ;\ - dmb st ;\ - ret /* return old value */ ;\ -END(_atomic_##OP##_16) - -#define ATOMIC_OP16_NV(OP, INSN) \ -ENTRY_NP(_atomic_##OP##_16_nv) ;\ - mov x4, x0 /* need r0 for return value */ ;\ -1: ldxrh w0, [x4] /* load old value */ ;\ - INSN w2, w1, w0 /* calc new (return) value */ ;\ - stxrh w3, w2, [x4] /* try to store */ ;\ - cbnz w3, 1b /* succeed? no, try again */ ;\ - dmb st ;\ - ret /* return new value */ ;\ -END(_atomic_##OP##_16_nv) - -#define ATOMIC_OP32(OP, INSN) \ -ENTRY_NP(_atomic_##OP##_32) ;\ - mov x4, x0 ;\ -1: ldxr w0, [x4] /* load old value */ ;\ - INSN w2, w1, w0 /* calculate new value */ ;\ - stxr w3, w2, [x4] /* try to store */ ;\ - cbnz w3, 1b /* succeed? no, try again */ ;\ - dmb st ;\ - ret /* return old value */ ;\ -END(_atomic_##OP##_32) - -#define ATOMIC_OP32_NV(OP, INSN) \ -ENTRY_NP(_atomic_##OP##_32_nv) ;\ - mov x4, x0 /* need r0 for return value */ ;\ -1: ldxr w0, [x4] /* load old value */ ;\ - INSN w0, w0, w1 /* calc new (return) value */ ;\ - stxr w3, w0, [x4] /* try to store */ ;\ - cbnz w3, 1b /* succeed? no, try again? */ ;\ - dmb sy ;\ - ret /* return new value */ ;\ -END(_atomic_##OP##_32_nv) - -#define ATOMIC_OP64(OP, INSN) \ -ENTRY_NP(_atomic_##OP##_64) ;\ - mov x4, x0 ;\ -1: ldxr x0, [x4] /* load old value */ ;\ - INSN x2, x1, x0 /* calculate new value */ ;\ - stxr w3, x2, [x4] /* try to store */ ;\ - cbnz w3, 1b /* succeed? no, try again */ ;\ - dmb st ;\ - ret /* return old value */ ;\ -END(_atomic_##OP##_64) - -#define ATOMIC_OP64_NV(OP, INSN) \ -ENTRY_NP(_atomic_##OP##_64_nv) ;\ - mov x4, x0 /* need r0 for return value */ ;\ -1: ldxr x0, [x4] /* load old value */ ;\ - INSN x0, x0, x1 /* calc new (return) value */ ;\ - stxr w3, x0, [x4] /* try to store */ ;\ - cbnz w3, 1b /* succeed? no, try again? */ ;\ - dmb sy ;\ - ret /* return new value */ ;\ -END(_atomic_##OP##_64_nv) - -#if defined(_KERNEL) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) - -#endif /* _KERNEL */ - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_or_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_or_16.S deleted file mode 100644 index e16773475..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_or_16.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_or_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP16(or, orr) - -ATOMIC_OP_ALIAS(atomic_or_16,_atomic_or_16) -ATOMIC_OP_ALIAS(atomic_or_ushort,_atomic_or_16) -STRONG_ALIAS(__sync_fetch_and_or_2,_atomic_or_16) -STRONG_ALIAS(_atomic_or_ushort,_atomic_or_16) - -ATOMIC_OP16_NV(or, orr) - -ATOMIC_OP_ALIAS(atomic_or_16_nv,_atomic_or_16_nv) -ATOMIC_OP_ALIAS(atomic_or_ushort_nv,_atomic_or_16_nv) -STRONG_ALIAS(__sync_or_and_fetch_2,_atomic_or_16_nv) -STRONG_ALIAS(_atomic_or_ushort_nv,_atomic_or_16_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_or_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_or_32.S deleted file mode 100644 index 2411812ca..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_or_32.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_or_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP32(or, orr) - -ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(__sync_fetch_and_or_4,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) - -ATOMIC_OP32_NV(or, orr) - -ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(__sync_or_and_fetch_4,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_or_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_or_64.S deleted file mode 100644 index 1cbe8ab36..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_or_64.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_or_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP64(or, orr) - -ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64) -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_64) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64) -STRONG_ALIAS(__sync_fetch_and_or_8,_atomic_or_64) - -ATOMIC_OP64_NV(or, orr) - -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv) -ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64_nv) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_64_nv) -STRONG_ALIAS(__sync_or_and_fetch_8,_atomic_or_64) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_or_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_or_8.S deleted file mode 100644 index 3f4e5615f..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_or_8.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_or_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP8(or, orr) - -ATOMIC_OP_ALIAS(atomic_or_8,_atomic_or_8) -ATOMIC_OP_ALIAS(atomic_or_uchar,_atomic_or_8) -STRONG_ALIAS(__sync_fetch_and_or_1,_atomic_or_8) -STRONG_ALIAS(_atomic_or_uchar,_atomic_or_8) - -ATOMIC_OP8_NV(or, orr) - -ATOMIC_OP_ALIAS(atomic_or_8_nv,_atomic_or_8_nv) -ATOMIC_OP_ALIAS(atomic_or_uchar_nv,_atomic_or_8_nv) -STRONG_ALIAS(__sync_or_and_fetch_1,_atomic_or_8_nv) -STRONG_ALIAS(_atomic_or_uchar_nv,_atomic_or_8_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_sub_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_sub_16.S deleted file mode 100644 index 44554e475..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_sub_16.S +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: atomic_sub_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP16(sub, sub) - -ATOMIC_OP_ALIAS(atomic_sub_16,_atomic_sub_16) -ATOMIC_OP_ALIAS(atomic_sub_short,_atomic_sub_16) -ATOMIC_OP_ALIAS(atomic_sub_ushort,_atomic_sub_16) -STRONG_ALIAS(__sync_fetch_and_sub_2,_atomic_sub_16) -STRONG_ALIAS(_atomic_sub_short,_atomic_sub_16) -STRONG_ALIAS(_atomic_sub_ushort,_atomic_sub_16) - -ATOMIC_OP16_NV(sub, sub) - -ATOMIC_OP_ALIAS(atomic_sub_16_nv,_atomic_sub_16_nv) -ATOMIC_OP_ALIAS(atomic_sub_short_nv,_atomic_sub_16_nv) -ATOMIC_OP_ALIAS(atomic_sub_ushort_nv,_atomic_sub_16_nv) -STRONG_ALIAS(__sync_sub_and_fetch_2,_atomic_sub_16_nv) -STRONG_ALIAS(_atomic_sub_short_nv,_atomic_sub_16_nv) -STRONG_ALIAS(_atomic_sub_ushort_nv,_atomic_sub_16_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_sub_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_sub_32.S deleted file mode 100644 index b59c1d939..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_sub_32.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_sub_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP32(sub, sub) - -ATOMIC_OP_ALIAS(atomic_sub_32,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_int,_atomic_sub_32) -STRONG_ALIAS(__sync_fetch_and_sub_4,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_int,_atomic_sub_32) - -ATOMIC_OP32_NV(sub, sub) - -ATOMIC_OP_ALIAS(atomic_sub_32_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_int_nv,_atomic_sub_32_nv) -STRONG_ALIAS(__sync_sub_and_fetch_4,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_int_nv,_atomic_sub_32_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_sub_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_sub_64.S deleted file mode 100644 index ce1706a04..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_sub_64.S +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: atomic_sub_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP64(sub, sub) - -ATOMIC_OP_ALIAS(atomic_sub_64_nv,_atomic_sub_64_nv) -ATOMIC_OP_ALIAS(atomic_sub_ptr_nv,_atomic_sub_64_nv) -ATOMIC_OP_ALIAS(atomic_sub_long_nv,_atomic_sub_64_nv) -STRONG_ALIAS(_atomic_sub_ptr_nv,_atomic_sub_64_nv) -STRONG_ALIAS(_atomic_sub_long_nv,_atomic_sub_64_nv) -STRONG_ALIAS(__sync_sub_and_fetch_8,_atomic_sub_64_nv) - -ATOMIC_OP64_NV(sub, sub) - -ATOMIC_OP_ALIAS(atomic_sub_64,_atomic_sub_64) -ATOMIC_OP_ALIAS(atomic_sub_ptr,_atomic_sub_64) -ATOMIC_OP_ALIAS(atomic_sub_long,_atomic_sub_64) -STRONG_ALIAS(_atomic_sub_ptr,_atomic_sub_64) -STRONG_ALIAS(_atomic_sub_long,_atomic_sub_64) -STRONG_ALIAS(__sync_fetch_and_sub_8,_atomic_sub_64) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_sub_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_sub_8.S deleted file mode 100644 index 6bdb77483..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_sub_8.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_sub_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP8(sub, sub) - -ATOMIC_OP_ALIAS(atomic_sub_8,_atomic_sub_8) -ATOMIC_OP_ALIAS(atomic_sub_char,_atomic_sub_8) -STRONG_ALIAS(__sync_fetch_and_sub_1,_atomic_sub_8) -STRONG_ALIAS(_atomic_sub_char,_atomic_sub_8) - -ATOMIC_OP8_NV(sub, sub) - -ATOMIC_OP_ALIAS(atomic_sub_8_nv,_atomic_sub_8_nv) -ATOMIC_OP_ALIAS(atomic_sub_char_nv,_atomic_sub_8_nv) -STRONG_ALIAS(__sync_sub_and_fetch_1,_atomic_sub_8_nv) -STRONG_ALIAS(_atomic_sub_char_nv,_atomic_sub_8_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S deleted file mode 100644 index 5b90dc79f..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_16.S +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: atomic_swap_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_16) - mov x4, x0 -1: ldxrh w0, [x4] - stxrh w3, w1, [x4] - cbnz w3, 1b - dmb st - ret -END(_atomic_swap_16) - -ATOMIC_OP_ALIAS(atomic_swap_16,_atomic_swap_16) -ATOMIC_OP_ALIAS(atomic_swap_short,_atomic_swap_16) -ATOMIC_OP_ALIAS(atomic_swap_ushort,_atomic_swap_16) -STRONG_ALIAS(__sync_lock_test_and_set_2,_atomic_swap_16) -STRONG_ALIAS(_atomic_swap_short,_atomic_swap_16) -STRONG_ALIAS(_atomic_swap_ushort,_atomic_swap_16) - -ENTRY_NP(__sync_lock_release_2) - stlrh wzr, [x0] - ret -END(__sync_lock_release_2) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S deleted file mode 100644 index 42aa90427..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_32.S +++ /dev/null @@ -1,51 +0,0 @@ -/* $NetBSD: atomic_swap_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_32) - mov x4, x0 -1: ldxr w0, [x4] - stxr w3, w1, [x4] - cbnz w3, 1b - dmb st - ret -END(_atomic_swap_32) - -ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(__sync_lock_test_and_set_4,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) - -ENTRY_NP(__sync_lock_release_4) - stlr wzr, [x0] - ret -END(__sync_lock_release_4) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S deleted file mode 100644 index d950d80bd..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_64.S +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: atomic_swap_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_64) - mov x4, x0 -1: ldxr x0, [x4] - stxr w3, x1, [x4] - cbnz w3, 1b - dmb st - ret -END(_atomic_swap_64) - -ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_64) -STRONG_ALIAS(__sync_lock_test_and_set_8,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64) - -ENTRY_NP(__sync_lock_release_8) - stlr xzr, [x0] - ret -END(__sync_lock_release_8) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S deleted file mode 100644 index 4f25f4409..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_swap_8.S +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: atomic_swap_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_8) - mov x4, x0 -1: ldxrb w0, [x4] - stxrb w3, w1, [x4] - cbnz w3, 1b - dmb st - ret -END(_atomic_swap_8) - -ATOMIC_OP_ALIAS(atomic_swap_8,_atomic_swap_8) -ATOMIC_OP_ALIAS(atomic_swap_char,_atomic_swap_8) -ATOMIC_OP_ALIAS(atomic_swap_uchar,_atomic_swap_8) -STRONG_ALIAS(__sync_lock_test_and_set_1,_atomic_swap_8) -STRONG_ALIAS(_atomic_swap_char,_atomic_swap_8) -STRONG_ALIAS(_atomic_swap_uchar,_atomic_swap_8) - -ENTRY_NP(__sync_lock_release_1) - stlrb wzr, [x0] - ret -END(__sync_lock_release_1) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_xor_16.S b/common/lib/libc/arch/aarch64/atomic/atomic_xor_16.S deleted file mode 100644 index 564ba8685..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_xor_16.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_xor_16.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP16(xor, eor) - -ATOMIC_OP_ALIAS(atomic_xor_16,_atomic_xor_16) -ATOMIC_OP_ALIAS(atomic_xor_ushort,_atomic_xor_16) -STRONG_ALIAS(__sync_fetch_and_xor_2,_atomic_xor_16) -STRONG_ALIAS(_atomic_xor_ushort,_atomic_xor_16) - -ATOMIC_OP16_NV(xor, eor) - -ATOMIC_OP_ALIAS(atomic_xor_16_nv,_atomic_xor_16_nv) -ATOMIC_OP_ALIAS(atomic_xor_ushort_nv,_atomic_xor_16_nv) -STRONG_ALIAS(__sync_xor_and_fetch_2,_atomic_xor_16_nv) -STRONG_ALIAS(_atomic_xor_ushort_nv,_atomic_xor_16_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_xor_32.S b/common/lib/libc/arch/aarch64/atomic/atomic_xor_32.S deleted file mode 100644 index f1bfdc4f4..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_xor_32.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_xor_32.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP32(xor, eor) - -ATOMIC_OP_ALIAS(atomic_xor_32,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_uint,_atomic_xor_32) -STRONG_ALIAS(__sync_fetch_and_xor_4,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_uint,_atomic_xor_32) - -ATOMIC_OP32_NV(xor, eor) - -ATOMIC_OP_ALIAS(atomic_xor_32_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_uint_nv,_atomic_xor_32_nv) -STRONG_ALIAS(__sync_xor_and_fetch_4,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_uint_nv,_atomic_xor_32_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_xor_64.S b/common/lib/libc/arch/aarch64/atomic/atomic_xor_64.S deleted file mode 100644 index 588d8a0ef..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_xor_64.S +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: atomic_xor_64.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP64(xor, eor) - -ATOMIC_OP_ALIAS(atomic_xor_64,_atomic_xor_64) -ATOMIC_OP_ALIAS(atomic_xor_ulong,_atomic_xor_64) -STRONG_ALIAS(__sync_fetch_and_xor_8,_atomic_xor_64) - -ATOMIC_OP64_NV(xor, eor) - -ATOMIC_OP_ALIAS(atomic_xor_64_nv,_atomic_xor_64_nv) -ATOMIC_OP_ALIAS(atomic_xor_ulong_nv,_atomic_xor_64_nv) -STRONG_ALIAS(__sync_xor_and_fetch_8,_atomic_xor_64_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/atomic_xor_8.S b/common/lib/libc/arch/aarch64/atomic/atomic_xor_8.S deleted file mode 100644 index 9eeff7e51..000000000 --- a/common/lib/libc/arch/aarch64/atomic/atomic_xor_8.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: atomic_xor_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ATOMIC_OP8(xor, eor) - -ATOMIC_OP_ALIAS(atomic_xor_8,_atomic_xor_8) -ATOMIC_OP_ALIAS(atomic_xor_uchar,_atomic_xor_8) -STRONG_ALIAS(__sync_fetch_and_xor_1,_atomic_xor_8) -STRONG_ALIAS(_atomic_xor_uchar,_atomic_xor_8) - -ATOMIC_OP8_NV(xor, eor) - -ATOMIC_OP_ALIAS(atomic_xor_8_nv,_atomic_xor_8_nv) -ATOMIC_OP_ALIAS(atomic_xor_uchar_nv,_atomic_xor_8_nv) -STRONG_ALIAS(__sync_xor_and_fetch_1,_atomic_xor_8_nv) -STRONG_ALIAS(_atomic_xor_uchar_nv,_atomic_xor_8_nv) diff --git a/common/lib/libc/arch/aarch64/atomic/membar_ops.S b/common/lib/libc/arch/aarch64/atomic/membar_ops.S deleted file mode 100644 index 1c965e475..000000000 --- a/common/lib/libc/arch/aarch64/atomic/membar_ops.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_membar_producer) - dsb sy - ret -END(_membar_producer) -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) -ATOMIC_OP_ALIAS(membar_write,_membar_producer) -STRONG_ALIAS(_membar_write,_membar_producer) - -ENTRY_NP(_membar_sync) - dmb sy - ret -END(_membar_sync) -ATOMIC_OP_ALIAS(membar_sync,_membar_sync) -ATOMIC_OP_ALIAS(membar_enter,_membar_sync) -ATOMIC_OP_ALIAS(membar_exit,_membar_sync) -ATOMIC_OP_ALIAS(membar_consumer,_membar_sync) -ATOMIC_OP_ALIAS(membar_read,_membar_sync) -STRONG_ALIAS(__sync_synchronize,_membar_sync) -STRONG_ALIAS(_membar_enter,_membar_sync) -STRONG_ALIAS(_membar_exit,_membar_sync) -STRONG_ALIAS(_membar_consumer,_membar_sync) -STRONG_ALIAS(_membar_read,_membar_sync) diff --git a/common/lib/libc/arch/aarch64/gen/byte_swap_2.S b/common/lib/libc/arch/aarch64/gen/byte_swap_2.S deleted file mode 100644 index 03565d7e9..000000000 --- a/common/lib/libc/arch/aarch64/gen/byte_swap_2.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define FUNC _C_LABEL(bswap16) -#else -#define FUNC _C_LABEL(__bswap16) -#endif - -ENTRY(FUNC) - rev16 w0, w0 - ret -END(FUNC) -#if BYTE_ORDER == LITTLE_ENDIAN -STRONG_ALIAS(_C_LABEL(ntohs), FUNC) -STRONG_ALIAS(_C_LABEL(htons), FUNC) -#endif diff --git a/common/lib/libc/arch/aarch64/gen/byte_swap_4.S b/common/lib/libc/arch/aarch64/gen/byte_swap_4.S deleted file mode 100644 index 1244d2aa3..000000000 --- a/common/lib/libc/arch/aarch64/gen/byte_swap_4.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define FUNC _C_LABEL(bswap32) -#else -#define FUNC _C_LABEL(__bswap32) -#endif - -ENTRY(FUNC) - rev w0, w0 - ret -END(FUNC) -#if BYTE_ORDER == LITTLE_ENDIAN -STRONG_ALIAS(_C_LABEL(ntohl), FUNC) -STRONG_ALIAS(_C_LABEL(htonl), FUNC) -#endif diff --git a/common/lib/libc/arch/aarch64/gen/byte_swap_8.S b/common/lib/libc/arch/aarch64/gen/byte_swap_8.S deleted file mode 100644 index 5a235a2b9..000000000 --- a/common/lib/libc/arch/aarch64/gen/byte_swap_8.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: byte_swap_8.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define FUNC _C_LABEL(bswap64) -#else -#define FUNC _C_LABEL(__bswap64) -#endif - -ENTRY(FUNC) - rev x0, x0 - ret -END(FUNC) -#if BYTE_ORDER == LITTLE_ENDIAN -STRONG_ALIAS(_C_LABEL(ntohll), FUNC) -STRONG_ALIAS(_C_LABEL(htonll), FUNC) -#endif diff --git a/common/lib/libc/arch/aarch64/gen/clzdi2.S b/common/lib/libc/arch/aarch64/gen/clzdi2.S deleted file mode 100644 index 2c23496d7..000000000 --- a/common/lib/libc/arch/aarch64/gen/clzdi2.S +++ /dev/null @@ -1,10 +0,0 @@ -/* $NetBSD: clzdi2.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -#include - -RCSID("$NetBSD: clzdi2.S,v 1.1 2014/08/10 05:47:35 matt Exp $") - -ENTRY(clzdi2) - clz x0, x0 - ret -END(clsdi2) diff --git a/common/lib/libc/arch/aarch64/gen/ctzdi2.S b/common/lib/libc/arch/aarch64/gen/ctzdi2.S deleted file mode 100644 index c8df66a46..000000000 --- a/common/lib/libc/arch/aarch64/gen/ctzdi2.S +++ /dev/null @@ -1,11 +0,0 @@ -/* $NetBSD: ctzdi2.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -#include - -RCSID("$NetBSD: ctzdi2.S,v 1.1 2014/08/10 05:47:35 matt Exp $") - -ENTRY(ctzdi2) - rbit x0, x0 - clz x0, x0 - ret -END(ctzdi2) diff --git a/common/lib/libc/arch/aarch64/gen/ffsdi2.S b/common/lib/libc/arch/aarch64/gen/ffsdi2.S deleted file mode 100644 index 9245a5d7a..000000000 --- a/common/lib/libc/arch/aarch64/gen/ffsdi2.S +++ /dev/null @@ -1,14 +0,0 @@ -/* $NetBSD: ffsdi2.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -#include - -RCSID("$NetBSD: ffsdi2.S,v 1.1 2014/08/10 05:47:35 matt Exp $") - -ENTRY(ffsdi2) - rbit x1, x0 - clz x1, x1 - add x1, x1, #1 - cmp x0, #0 - csel w0, wzr, w1, eq - ret -END(ffsdi2) diff --git a/common/lib/libc/arch/aarch64/string/memcmp.S b/common/lib/libc/arch/aarch64/string/memcmp.S deleted file mode 100644 index 6bd982bde..000000000 --- a/common/lib/libc/arch/aarch64/string/memcmp.S +++ /dev/null @@ -1,187 +0,0 @@ -/* $NetBSD: memcmp.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: memcmp.S,v 1.1 2014/08/10 05:47:35 matt Exp $") - -ENTRY(memcmp) - mov x9, x0 - mov x10, x1 - mov x0, xzr - cbz x2, .Lmemcmp_ret -#ifdef _KERNEL - cmp x2, #6 - b.eq .Lmemcmp_6bytes -#endif - cmp x2, #7 - b.ls .Lmemcmp_lessthan8 - - ands x3, x9, #7 - b.eq .Lmemcmp_dword_loop - -/* - * The two addresses have identical alignment but are not yet dword aligned. - */ - add x2, x2, x3 /* add unalignment to length */ - sub x2, x2, #8 /* now subtract a dword */ - - sub x9, x9, x3 /* dword align src1 */ - sub x10, x10, x3 /* adjust src2 */ - - lsl x3, x3, #3 /* convert bytes to bits */ - ldr x4, [x9], #8 /* load dword from src1 */ - ldr x6, [x10], #8 /* load dword from src2 */ -#ifdef __AARCH64EB__ - lsl x4, x4, x3 /* discard leading bytes from data1 */ - lsl x6, x6, x3 /* discard leading bytes from data2 */ -#else - lsr x4, x4, x3 /* discard leading bytes from data1 */ - lsr x6, x6, x3 /* discard leading bytes from data2 */ -#endif - subs x0, x4, x6 /* compare data */ -#ifdef __AARCH64EL__ - b.ne .Lmemcmp_last_compare /* difference. find it */ -#else - b.eq .Lmemcmp_dword_loop /* no difference. go to loop */ - rev x4, x4 /* byte swap data1 */ - rev x6, x6 /* byte swap data2 */ - b .Lmemcmp_last_compare /* go find the difference. */ -#endif - -.Lmemcmp_dword_loop: - subs x2, x2, #8 - b.mi .Lmemcmp_finish_dword - ldr x4, [x9], #8 - ldr x6, [x10], #8 - subs x0, x4, x6 - b.eq .Lmemcmp_dword_loop /* no difference. go to loop */ -#ifdef __AARCH64EB__ - rev x4, x4 /* byte swap data1 */ - rev x6, x6 /* byte swap data2 */ -#endif - b .Lmemcmp_last_compare /* go find the difference. */ - -.Lmemcmp_finish_dword: - /* - * we might have gotten here with nothing left. If so, just bail. - */ - tst x2, #7 - b.eq .Lmemcmp_ret - /* - * - */ - tbz x2, #2, .Lmemcmp_finish_word - ldr w4, [x9], #4 - ldr w6, [x10], #4 -#ifdef __AARCH64EB__ - lsl x4, x4, #32 /* move to MSW */ - lsl x6, x6, #32 /* move to MSW */ -#endif - -.Lmemcmp_finish_word: - tbz x2, #1, .Lmemcmp_finish_hword - ldrh w5, [x9], #2 - ldrh w7, [x10], #2 -#ifdef __AARCH64EB__ - orr x4, x4, x5, lsl #16 - orr x6, x6, x7, lsl #16 -#else - orr x4, x4, x5, lsl #32 - orr x6, x6, x7, lsl #32 -#endif - -.Lmemcmp_finish_hword: -#ifdef __AARCH64EB__ - rev x4, x4 /* byte swap data1 */ - rev x6, x6 /* byte swap data1 */ -#endif - tbz x2, #0, .Lmemcmp_last_compare - ldrb w5, [x9] - ldrb w7, [x10] - orr x4, x4, x5, lsl #48 - orr x6, x6, x7, lsl #48 - b .Lmemcmp_last_compare /* go find the difference. */ - -/* - * D - */ -.Lmemcmp_lessthan8: - sub x2, x2, #1 -1: ldrb w4, [x9], #1 - ldrb w5, [x10], #1 - subs x2, x2, #1 - ccmp x4, x5, #0, cs - b.eq 1b - sub x0, x4, x5 - -.Lmemcmp_ret: - ret - -#ifdef _KERNEL -.Lmemcmp_6bytes: - ldr w4, [x9], #4 - ldrh w5, [x9] -#if __AARCH64EB__ - orr x4, x4, x5, lsl #48 - rev x4, x4 -#else - orr x4, x4, x5, lsl #32 -#endif - ldr w6, [x10], #4 - ldrh w7, [x10] -#if __AARCH64EB__ - orr x6, x6, x7, lsl #48 - rev x6, x6 -#else - orr x6, x6, x7, lsl #32 -#endif -#endif /* _KERNEL */ - -/* - * We have loaded the final bytes in x4 and x6 in LE format. Now we have - * to figure what the difference is (if any). First we subtract. Any bytes - * that are the same will be 0. So to find the first non-zero byte we byterev - * and then use clz to find that byte. - * We mask the location to get the start of the byte. We shift both - * data dwords left to remove the equal part. Then we shift right to discard - * the trailing bytes. Then we subtract and return. - */ - subs x0, x4, x6 - b.eq .Lmemcmp_ret -.Lmemcmp_last_compare: - rev x1, x0 /* byte reverse */ - clz x1, x1 /* find first non-zero byte */ - bfi x1, xzr, #0, #3 /* make it byte aligned */ - lsr x0, x0, x1 /* shift to LSB */ - sxtb w0, w0 /* sign extend */ - ret -END(memcmp) diff --git a/common/lib/libc/arch/aarch64/string/memcpy.S b/common/lib/libc/arch/aarch64/string/memcpy.S deleted file mode 100644 index 7749b4abd..000000000 --- a/common/lib/libc/arch/aarch64/string/memcpy.S +++ /dev/null @@ -1,126 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: memcpy.S,v 1.1 2014/08/10 05:47:35 matt Exp $") - -/* LINTSTUB: void *memcpy(void * restrict, const void * restrict, size_t); */ - -ENTRY(memcpy) - mov x10, x0 - mov x11, x1 - cbz x2, .Lmemcpy_ret - - cmp x2, #7 - b.ls .Lmemcpy_last_dword - - ands x3, x10, #7 - b.eq .Lmemcpy_dword_aligned - -/* - * The dst address doesn't have dword alignment. The src address may or may - * not have the same alignment. Make dst dword aligned. Hope src will be - * dword aligned but if it isn't, take advantage of unaligned access. - */ - add x2, x2, x3 /* add unalignment to length */ - sub x2, x2, #8 /* now subtract a dword */ - - tbz x10, #0, .Lmemcpy_hword_aligned - ldrb w4, [x11], #1 - strb w4, [x10], #1 -.Lmemcpy_hword_aligned: - tbz x10, #1, .Lmemcpy_word_aligned - ldrh w4, [x11], #2 - strh w4, [x10], #2 -.Lmemcpy_word_aligned: - tbz x10, #2, .Lmemcpy_dword_aligned - ldr w4, [x11], #4 - str w4, [x10], #4 -.Lmemcpy_dword_aligned: - /* - * destination is now dword aligned. - */ - subs x2, x2, #32 - b.mi .Lmemcpy_last_oword - -.Lmemcpy_oword_loop: - ldp x4, x5, [x11], #16 - ldp x6, x7, [x11], #16 - stp x4, x5, [x10], #16 - stp x6, x7, [x10], #16 - cbz x2, .Lmemcpy_ret - subs x2, x2, #32 - b.pl .Lmemcpy_oword_loop - -.Lmemcpy_last_oword: - /* - * We have 31 bytes or less to copy. First see if we can write a qword - */ - tbz x2, #4, .Lmemcpy_last_qword - ldp x4, x5, [x11], #16 /* read word */ - stp x4, x5, [x10], #16 /* write word */ - -.Lmemcpy_last_qword: - /* - * We have 15 bytes or less to copy. First see if we can write a dword - */ - tbz x2, #3, .Lmemcpy_last_dword - ldr x4, [x11], #8 /* read word */ - str x4, [x10], #8 /* write word */ - -.Lmemcpy_last_dword: - /* - * We have 7 bytes or less to copy. First see if we can write a word - */ - tbz x2, #2, .Lmemcpy_last_word - ldr w4, [x11], #4 /* read word */ - str w4, [x10], #4 /* write word */ - -.Lmemcpy_last_word: - /* - * We have 3 bytes or less to copy. First see if we can write a hword - */ - tbz x2, #1, .Lmemcpy_last_hword - ldrh w4, [x11], #2 - strh w4, [x10], #2 - -.Lmemcpy_last_hword: - /* - * We have 1 or none bytes to copy. - */ - tbz x2, #0, .Lmemcpy_ret - ldrb w4, [x11] - strb w4, [x10] - -.Lmemcpy_ret: - ret -END(memcpy) diff --git a/common/lib/libc/arch/aarch64/string/memset.S b/common/lib/libc/arch/aarch64/string/memset.S deleted file mode 100644 index 1d6e5186f..000000000 --- a/common/lib/libc/arch/aarch64/string/memset.S +++ /dev/null @@ -1,200 +0,0 @@ -/* $NetBSD: memset.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -ENTRY(memset) - cbz x2, .Lret - mov x15, x0 /* working data pointer */ - cbz x1, .Lzerofill - cbz x1, .Lfilled - /* - * Non zero fill, replicate to all 64 bits of x1. - */ - and x1, x1, #0xff - orr x1, x1, x1, lsl #8 - orr x1, x1, x1, lsl #16 - orr x1, x1, x1, lsl #32 -.Lfilled: - cmp x2, #15 /* if it's small, ignore alignment */ - b.ls .Llast_subqword - - mov x6, x1 - tst x15, #15 - b.eq .Lqword_loop - -/* - * We have at least 15 to copy which means we can get qword alignment - * without having to check the amount left. - */ - tbz x15, #0, .Lhword_aligned - strb w1, [x15], #1 -.Lhword_aligned: - tbz x15, #1, .Lword_aligned - strh w1, [x15], #2 -.Lword_aligned: - tbz x15, #2, .Ldword_aligned - str w1, [x15], #4 -.Ldword_aligned: - tbz x15, #3, .Lqword_aligned - str x1, [x15], #8 -/* - * Now we qword aligned. Figure how much we have to write to get here. - * Then subtract from the length. If we get 0, we're done. - */ -.Lqword_aligned: - sub x5, x15, x0 - subs x2, x2, x5 - b.eq .Lret - -/* - * Write 16 bytes at time. If we don't have 16 bytes to write, bail. - * Keep looping if there's data to set. - */ -.Lqword_loop: - subs x2, x2, #16 - b.mi .Llast_subqword - stp x1, x6, [x15], #16 - b.ne .Lqword_loop - ret - -/* - * We have less than a qword to write. We hope we are aligned but since - * unaligned access works, we don't have to be aligned. - */ -.Llast_subqword: - tbz x2, #3, .Llast_subdword - str x1, [x15], #8 -.Llast_subdword: - tbz x2, #2, .Llast_subword - str w1, [x15], #4 -.Llast_subword: - tbz x2, #1, .Llast_subhword - strh w1, [x15], #2 -.Llast_subhword: - tbz x2, #0, .Lret - strb w1, [x15] -.Lret: ret - -/* - * If we are filling with zeros then let's see if we can use the - * dc zva, - * instruction to speed things up. - */ -.Lzerofill: - mrs x9, dczid_el0 - /* - * Make sure we can the instruction isn't prohibited. - */ - tbnz x9, #4, .Lfilled - /* - * Now find out the block size. - */ - ubfx x9, x9, #0, #4 /* extract low 4 bits */ - add x9, x9, #2 /* add log2(word) */ - mov x10, #1 /* the value is log2(words) */ - lsl x10, x10, x9 /* shift to get the block size */ - cmp x2, x10 /* are we even copying a block? */ - b.lt .Lfilled /* no, do it 16 bytes at a time */ - /* - * Now we figure out how many aligned blocks we have - */ - sub x11, x10, #1 /* make block size a mask */ - add x12, x15, x11 /* round start to a block boundary */ - asr x12, x12, x9 /* "starting" block number */ - add x13, x15, x2 /* get ending address */ - asr x13, x13, x9 /* "ending" block numebr */ - cmp x13, x12 /* how many blocks? */ - b.eq .Lfilled /* none, do it 16 bytes at a time */ - - /* - * Now we have one or more blocks to deal with. First now we need - * to get block aligned. - */ - and x7, x15, x11 /* are already aligned on a block boundary? */ - cbz x7, .Lblock_aligned - - sub x7, x10, x7 /* subtract offset from block length */ - sub x2, x2, x7 /* subtract that from length */ - asr x7, x7, #2 /* qword -> word */ - - tbz x15, #0, .Lzero_hword_aligned - strb wzr, [x15], #1 -.Lzero_hword_aligned: - tbz x15, #1, .Lzero_word_aligned - strh wzr, [x15], #2 -.Lzero_word_aligned: - tbz x15, #2, .Lzero_dword_aligned - str wzr, [x15], #4 -.Lzero_dword_aligned: - tbz x15, #3, .Lzero_qword_aligned - str xzr, [x15], #8 -.Lzero_qword_aligned: - cbz x7, .Lblock_aligned /* no qwords? just branch */ - adr x6, .Lblock_aligned - sub x6, x6, x7 /* backup to write the last N qwords */ - br x6 /* and do it */ - /* - * This is valid for cache lines <= 256 bytes. - */ - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - stp xzr, xzr, [x15], #16 - -/* - * Now we are block aligned. - */ -.Lblock_aligned: - subs x2, x2, x10 - b.mi .Lblock_done - dc zva, x15 - add x15, x15, x10 - b.ne .Lblock_aligned - ret - -.Lblock_done: - and x2, x2, x12 /* make positive again */ - mov x6, xzr /* fill 2nd xword */ - b .Lqword_loop /* and finish filling */ - -END(memset) diff --git a/common/lib/libc/arch/aarch64/string/strcat.S b/common/lib/libc/arch/aarch64/string/strcat.S deleted file mode 100644 index 1ba30851f..000000000 --- a/common/lib/libc/arch/aarch64/string/strcat.S +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: strcat.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strcat.S,v 1.1 2014/08/10 05:47:35 matt Exp $") - -/* - * Implementation of strcat using strlen/strcpy. - */ -ENTRY(strcat) - stp x29, x30, [sp, #-32]! /* save fp, lr */ - mov x29, sp /* init fp */ - stp x27, x28, [x29, #16] /* save registers */ - - mov x27, x0 /* save dst */ - mov x28, x1 /* save append */ - - bl _C_LABEL(strlen) /* find length of dst */ - - add x0, x0, x27 /* add to dst pointer */ - mov x1, x28 /* fetch append */ - bl _C_LABEL(strcpy) /* append string */ - - mov x0, x27 /* restore dst as return value */ - ldp x27, x28, [x29, #16] /* save registers */ - ldp x29, x30, [sp], #32 /* save fp, lr; pop stack */ - ret -END(strcat) diff --git a/common/lib/libc/arch/aarch64/string/strlen.S b/common/lib/libc/arch/aarch64/string/strlen.S deleted file mode 100644 index e1378d903..000000000 --- a/common/lib/libc/arch/aarch64/string/strlen.S +++ /dev/null @@ -1,113 +0,0 @@ -/* $NetBSD: strlen.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strlen.S,v 1.1 2014/08/10 05:47:35 matt Exp $") - -#ifdef STRNLEN -#define FUNCNAME strnlen -/* LINTSTUB: size_t strnlen(const char *, size_t); */ -#else -#define FUNCNAME strlen -/* LINTSTUB: size_t strlen(const char *); */ -#endif - -#define MASK8_0x01 0x0101010101010101 -#define MASK8_0x7f 0x7f7f7f7f7f7f7f7f - -ENTRY(FUNCNAME) - mov x4, x0 /* need x0 for return */ - add x9, x0, #8 /* start + dword */ -#ifdef STRNLEN - add x10, x0, x1 /* don't go past here */ -#endif - mov x11, #MASK8_0x01 /* test mask */ - - ands x3, x4, #7 /* extract alignment */ - neg x0, x3 /* alignment fixup */ - b.eq .Lstrlen_dword_loop /* already dword aligned */ - - /* - * Load the dword containing the leading bytes. Make sure bytes - * before the data won't match as NUL. - */ - add x4, x4, x0 /* make dword aligned */ - ldr x7, [x4], #8 /* load dword */ - lsl x3, x3, #3 /* convert bytes to bits */ -#ifdef __AARCH64EB__ - lsr x5, x11, x3 /* make mask for BE */ -#else - lsl x5, x11, x3 /* make mask for LE */ -#endif - eor x5, x5, x11 /* invert mask */ - orr x7, x7, x5 /* prevent NULs */ - b .Lstrlen_dword_loop_noload - -.Lstrlen_dword_loop: -#ifdef STRNLEN - cmp x4, x10 - b.ge .Lstrlen_done -#endif - ldr x7, [x4], #8 /* load dword */ -.Lstrlen_dword_loop_noload: - /* - * Use the formula (X - 1) & ~(X | 0x7f) to find NUL bytes. - * Any NUL byte found will be replaced by 0x80 otherwise any byte - * will be replaced by 0x00. - */ - sub x6, x7, x11 /* a = X - 1 */ - orr x7, x7, #MASK8_0x7f /* b = X | 0x7f */ - bic x6, x6, x7 /* a & ~b */ - cbz x6, .Lstrlen_dword_loop /* no NULs so get next dword */ - - /* - * We know there is a NUL in this dword. Use clz to find it. - */ -#ifdef __AARCH64EL__ - rev x7, x7 /* convert to BE */ -#endif - clz x7, x7 /* find null byte */ - add x0, x0, x7, lsr #3 /* add offset to the length */ - - add x0, x0, x4 /* add end to the length */ - sub x0, x0, x9 /* subtract start from the length */ -#ifdef STRNLEN - cmp x0, x1 /* did we go too far? */ - csel x0, x0, x1, lt /* yes, return max length */ -#endif - ret -#ifdef STRNLEN -.Lstrlen_done: - mov x0, x1 - ret -#endif -END(FUNCNAME) diff --git a/common/lib/libc/arch/aarch64/string/strnlen.S b/common/lib/libc/arch/aarch64/string/strnlen.S deleted file mode 100644 index 083c1e2d8..000000000 --- a/common/lib/libc/arch/aarch64/string/strnlen.S +++ /dev/null @@ -1,5 +0,0 @@ -/* $NetBSD: strnlen.S,v 1.1 2014/08/10 05:47:35 matt Exp $ */ - -#define STRNLEN - -#include "strlen.S" diff --git a/common/lib/libc/arch/alpha/atomic/Makefile.inc b/common/lib/libc/arch/alpha/atomic/Makefile.inc deleted file mode 100644 index d0e048660..000000000 --- a/common/lib/libc/arch/alpha/atomic/Makefile.inc +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.5 2009/01/04 17:54:29 pooka Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ - atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -SRCS+= atomic_init_cas.c - -.endif diff --git a/common/lib/libc/arch/alpha/atomic/atomic_add.S b/common/lib/libc/arch/alpha/atomic/atomic_add.S deleted file mode 100644 index e4fdb25f4..000000000 --- a/common/lib/libc/arch/alpha/atomic/atomic_add.S +++ /dev/null @@ -1,88 +0,0 @@ -/* $NetBSD: atomic_add.S,v 1.4 2008/05/25 15:56:11 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -LEAF(_atomic_add_32, 2) -1: ldl_l t1, 0(a0) - addl t1, a1, t2 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) - -LEAF(_atomic_add_32_nv, 2) -1: ldl_l t1, 0(a0) - addl t1, a1, t2 - mov t2, v0 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) - -LEAF(_atomic_add_64, 2) -1: ldq_l t1, 0(a0) - addq t1, a1, t2 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_64) -STRONG_ALIAS(_atomic_add_long,_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_64) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64) - -LEAF(_atomic_add_64_nv, 2) -1: ldq_l t1, 0(a0) - addq t1, a1, t2 - mov t2, v0 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv) diff --git a/common/lib/libc/arch/alpha/atomic/atomic_and.S b/common/lib/libc/arch/alpha/atomic/atomic_and.S deleted file mode 100644 index bc5daca3e..000000000 --- a/common/lib/libc/arch/alpha/atomic/atomic_and.S +++ /dev/null @@ -1,84 +0,0 @@ -/* $NetBSD: atomic_and.S,v 1.4 2008/05/25 15:56:11 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -LEAF(_atomic_and_32, 2) -1: ldl_l t1, 0(a0) - and t1, a1, t2 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) - -LEAF(_atomic_and_32_nv, 2) -1: ldl_l t1, 0(a0) - and t1, a1, t2 - mov t2, v0 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) - -LEAF(_atomic_and_64, 2) -1: ldq_l t1, 0(a0) - and t1, a1, t2 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_and_64) -ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64) -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_64) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64) - -LEAF(_atomic_and_64_nv, 2) -1: ldq_l t1, 0(a0) - and t1, a1, t2 - mov t2, v0 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_and_64_nv) -ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64_nv) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_64_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64_nv) diff --git a/common/lib/libc/arch/alpha/atomic/atomic_cas.S b/common/lib/libc/arch/alpha/atomic/atomic_cas.S deleted file mode 100644 index d959485c2..000000000 --- a/common/lib/libc/arch/alpha/atomic/atomic_cas.S +++ /dev/null @@ -1,78 +0,0 @@ -/* $NetBSD: atomic_cas.S,v 1.5 2008/05/25 15:56:11 chs Exp $ */ - -/*- - * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -LEAF(_atomic_cas_32, 3) -1: mov a2, t2 - ldl_l v0, 0(a0) - cmpeq v0, a1, t1 - beq t1, 2f - stl_c t2, 0(a0) - beq t2, 3f -2: RET -3: br 1b - END(_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) - -LEAF(_atomic_cas_64, 3) -1: mov a2, t2 - ldq_l v0, 0(a0) - cmpeq v0, a1, t1 - beq t1, 2f - stq_c t2, 0(a0) - beq t2, 3f -2: RET -3: br 1b - END(_atomic_cas_64) - -ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) - -ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_64_ni,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64) diff --git a/common/lib/libc/arch/alpha/atomic/atomic_dec.S b/common/lib/libc/arch/alpha/atomic/atomic_dec.S deleted file mode 100644 index 982a1dab8..000000000 --- a/common/lib/libc/arch/alpha/atomic/atomic_dec.S +++ /dev/null @@ -1,88 +0,0 @@ -/* $NetBSD: atomic_dec.S,v 1.4 2008/05/25 15:56:11 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -LEAF(_atomic_dec_32, 1) -1: ldl_l t1, 0(a0) - subl t1, 1, t2 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) - -LEAF(_atomic_dec_32_nv, 1) -1: ldl_l t1, 0(a0) - subl t1, 1, t2 - mov t2, v0 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) - -LEAF(_atomic_dec_64, 1) -1: ldq_l t1, 0(a0) - subq t1, 1, t2 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64) - -LEAF(_atomic_dec_64_nv, 1) -1: ldq_l t1, 0(a0) - subq t1, 1, t2 - mov t2, v0 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_64_nv,_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_64_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_64_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_64_nv) diff --git a/common/lib/libc/arch/alpha/atomic/atomic_inc.S b/common/lib/libc/arch/alpha/atomic/atomic_inc.S deleted file mode 100644 index 6796cbf1e..000000000 --- a/common/lib/libc/arch/alpha/atomic/atomic_inc.S +++ /dev/null @@ -1,88 +0,0 @@ -/* $NetBSD: atomic_inc.S,v 1.4 2008/05/25 15:56:11 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -LEAF(_atomic_inc_32, 1) -1: ldl_l t1, 0(a0) - addl t1, 1, t2 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) - -LEAF(_atomic_inc_32_nv, 1) -1: ldl_l t1, 0(a0) - addl t1, 1, t2 - mov t2, v0 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) - -LEAF(_atomic_inc_64, 1) -1: ldq_l t1, 0(a0) - addq t1, 1, t2 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64) - -LEAF(_atomic_inc_64_nv, 1) -1: ldq_l t1, 0(a0) - addq t1, 1, t2 - mov t2, v0 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64_nv) diff --git a/common/lib/libc/arch/alpha/atomic/atomic_op_asm.h b/common/lib/libc/arch/alpha/atomic/atomic_op_asm.h deleted file mode 100644 index 5f01f3f9d..000000000 --- a/common/lib/libc/arch/alpha/atomic/atomic_op_asm.h +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) - -#endif /* _KERNEL */ - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/alpha/atomic/atomic_or.S b/common/lib/libc/arch/alpha/atomic/atomic_or.S deleted file mode 100644 index a08a71cd7..000000000 --- a/common/lib/libc/arch/alpha/atomic/atomic_or.S +++ /dev/null @@ -1,84 +0,0 @@ -/* $NetBSD: atomic_or.S,v 1.4 2008/05/25 15:56:11 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -LEAF(_atomic_or_32, 2) -1: ldl_l t1, 0(a0) - bis t1, a1, t2 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) - -LEAF(_atomic_or_32_nv, 2) -1: ldl_l t1, 0(a0) - bis t1, a1, t2 - mov t2, v0 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) - -LEAF(_atomic_or_64, 2) -1: ldq_l t1, 0(a0) - bis t1, a1, t2 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_or_64) -ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64) -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_64) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64) - -LEAF(_atomic_or_64_nv, 2) -1: ldq_l t1, 0(a0) - bis t1, a1, t2 - mov t2, v0 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_or_64_nv) -ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64_nv) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_64_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv) diff --git a/common/lib/libc/arch/alpha/atomic/atomic_swap.S b/common/lib/libc/arch/alpha/atomic/atomic_swap.S deleted file mode 100644 index 3ccfe2fc5..000000000 --- a/common/lib/libc/arch/alpha/atomic/atomic_swap.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: atomic_swap.S,v 1.4 2008/05/25 15:56:11 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -LEAF(_atomic_swap_32, 2) -1: ldl_l v0, 0(a0) - mov a1, t2 - stl_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) - -LEAF(_atomic_swap_64, 2) -1: ldq_l v0, 0(a0) - mov a1, t2 - stq_c t2, 0(a0) - beq t2, 2f - RET -2: br 1b - END(_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64) diff --git a/common/lib/libc/arch/alpha/atomic/membar_ops.S b/common/lib/libc/arch/alpha/atomic/membar_ops.S deleted file mode 100644 index bf9f6075b..000000000 --- a/common/lib/libc/arch/alpha/atomic/membar_ops.S +++ /dev/null @@ -1,91 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.7 2015/01/08 22:27:17 riastradh Exp $ */ - -/*- - * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -#ifdef _KERNEL - -/* - * We start out with no-op versions that do nothing. We hot-patch when - * we detect a MP system. - */ -LEAF(_membar_producer, 0) - RET - nop - END(_membar_producer) -EXPORT(_membar_producer_end) - -LEAF(_membar_sync, 0) - RET - nop - END(_membar_sync) -EXPORT(_membar_sync_end) - -LEAF(_membar_producer_mp, 0) - wmb - RET - END(_membar_producer_mp) -EXPORT(_membar_producer_mp_end) - -LEAF(_membar_sync_mp, 0) - mb - RET - END(_membar_sync_mp) -EXPORT(_membar_sync_mp_end) - -#else /* _KERNEL */ - -LEAF(_membar_producer, 0) - mb - RET - END(_membar_producer) -EXPORT(_membar_producer_end) - -LEAF(_membar_sync, 0) - mb - RET - END(_membar_sync) -EXPORT(_membar_sync_end) - -#endif /* _KERNEL */ - -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) -ATOMIC_OP_ALIAS(membar_sync,_membar_sync) -ATOMIC_OP_ALIAS(membar_enter,_membar_sync) -STRONG_ALIAS(_membar_enter,_membar_sync) -ATOMIC_OP_ALIAS(membar_exit,_membar_sync) -STRONG_ALIAS(_membar_exit,_membar_sync) -ATOMIC_OP_ALIAS(membar_consumer,_membar_sync) -STRONG_ALIAS(_membar_consumer,_membar_sync) -ATOMIC_OP_ALIAS(membar_datadep_consumer,_membar_sync) -STRONG_ALIAS(_membar_datadep_consumer,_membar_sync) diff --git a/common/lib/libc/arch/alpha/gen/byte_swap_2.S b/common/lib/libc/arch/alpha/gen/byte_swap_2.S deleted file mode 100644 index 95dab09e9..000000000 --- a/common/lib/libc/arch/alpha/gen/byte_swap_2.S +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.3 2008/02/16 17:37:13 apb Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include - -/* - * Byte-swap a 2-byte quantity. (Convert 0x0123 to 0x2301.) - * - * Argument is an unsigned 2-byte integer (uint16_t). - */ -#if defined(_KERNEL) || defined(_STANDALONE) -#define BSWAP16 bswap16 -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -#define BSWAP16 __bswap16 -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ -LEAF(BSWAP16, 1) /* a0 contains 0x0123 */ -XLEAF(htons, 1) -XLEAF(ntohs, 1) - insbl a0, 1, t0 /* t0 = 0x23 */ - extbl a0, 1, t1 /* t1 = 0x 01 */ - or t0, t1, v0 /* v0 = 0x2301 */ - RET -END(BSWAP16) diff --git a/common/lib/libc/arch/alpha/gen/byte_swap_4.S b/common/lib/libc/arch/alpha/gen/byte_swap_4.S deleted file mode 100644 index 38b11f8f0..000000000 --- a/common/lib/libc/arch/alpha/gen/byte_swap_4.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.3 2008/02/16 17:37:13 apb Exp $ */ - -/* - * Copyright (c) 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include - -/* - * Byte-swap a 4-byte quantity. (Convert 0x01234567 to 0x67452301.) - * - * Argument is an unsigned 4-byte integer (uint32_t). - */ -#if defined(_KERNEL) || defined(_STANDALONE) -#define BSWAP32 bswap32 -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -#define BSWAP32 __bswap32 -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ -LEAF(BSWAP32, 1) /* a0 contains 0x01234567 */ -XLEAF(htonl, 1) -XLEAF(ntohl, 1) - insbl a0, 3, t0 /* t0 = 0x67 */ - extbl a0, 1, t1 /* t1 = 0x 45 */ - extbl a0, 2, t2 /* t2 = 0x 23 */ - extbl a0, 3, t3 /* t3 = 0x 01 */ - sll t1, 16, t1 /* t1 = 0x 45 */ - sll t2, 8, t2 /* t2 = 0x 23 */ - or t3, t0, v0 /* v0 = 0x67 01 */ - or t1, t2, t1 /* t1 = 0x 4523 */ - or t1, v0, v0 /* v0 = 0x67452301 */ - RET -END(BSWAP32) diff --git a/common/lib/libc/arch/alpha/gmon/_mcount.S b/common/lib/libc/arch/alpha/gmon/_mcount.S deleted file mode 100644 index 53d92e6b3..000000000 --- a/common/lib/libc/arch/alpha/gmon/_mcount.S +++ /dev/null @@ -1,128 +0,0 @@ -/* $NetBSD: _mcount.S,v 1.2 2005/12/21 18:11:11 christos Exp $ */ - -/* - * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#if defined(GPROF) && !defined(_STANDALONE) - -#include -#include - -#define OFFSET_AT (0 * 8) -#define OFFSET_V0 (1 * 8) -#define OFFSET_T0 (2 * 8) -#define OFFSET_T1 (3 * 8) -#define OFFSET_T2 (4 * 8) -#define OFFSET_T3 (5 * 8) -#define OFFSET_T4 (6 * 8) -#define OFFSET_T5 (7 * 8) -#define OFFSET_T6 (8 * 8) -#define OFFSET_T7 (9 * 8) -#define OFFSET_S6 (10 * 8) -#define OFFSET_A0 (11 * 8) -#define OFFSET_A1 (12 * 8) -#define OFFSET_A2 (13 * 8) -#define OFFSET_A3 (14 * 8) -#define OFFSET_A4 (15 * 8) -#define OFFSET_A5 (16 * 8) -#define OFFSET_T8 (17 * 8) -#define OFFSET_T9 (18 * 8) -#define OFFSET_T10 (19 * 8) -#define OFFSET_T11 (20 * 8) -#define OFFSET_RA (21 * 8) -#define OFFSET_T12 (22 * 8) -#define OFFSET_GP (23 * 8) -#define FRAME_SIZE (24 * 8) - -LEAF_NOPROFILE(_mcount,0) /* XXX */ - .set noat - .set noreorder - - lda sp, -FRAME_SIZE(sp) - - stq at_reg, OFFSET_AT(sp) - stq v0, OFFSET_V0(sp) - stq t0, OFFSET_T0(sp) - stq t1, OFFSET_T1(sp) - stq t2, OFFSET_T2(sp) - stq t3, OFFSET_T3(sp) - stq t4, OFFSET_T4(sp) - stq t5, OFFSET_T5(sp) - stq t6, OFFSET_T6(sp) - stq t7, OFFSET_T7(sp) - stq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */ - stq a0, OFFSET_A0(sp) - stq a1, OFFSET_A1(sp) - stq a2, OFFSET_A2(sp) - stq a3, OFFSET_A3(sp) - stq a4, OFFSET_A4(sp) - stq a5, OFFSET_A5(sp) - stq t8, OFFSET_T8(sp) - stq t9, OFFSET_T9(sp) - stq t10, OFFSET_T10(sp) - stq t11, OFFSET_T11(sp) - stq ra, OFFSET_RA(sp) - stq t12, OFFSET_T12(sp) - stq gp, OFFSET_GP(sp) - - br pv, 1f -1: LDGP(pv) - mov ra, a0 - mov at_reg, a1 - CALL(_MCOUNT_FUNC) - - ldq v0, OFFSET_V0(sp) - ldq t0, OFFSET_T0(sp) - ldq t1, OFFSET_T1(sp) - ldq t2, OFFSET_T2(sp) - ldq t3, OFFSET_T3(sp) - ldq t4, OFFSET_T4(sp) - ldq t5, OFFSET_T5(sp) - ldq t6, OFFSET_T6(sp) - ldq t7, OFFSET_T7(sp) - ldq s6, OFFSET_S6(sp) /* XXX because run _after_ prologue. */ - ldq a0, OFFSET_A0(sp) - ldq a1, OFFSET_A1(sp) - ldq a2, OFFSET_A2(sp) - ldq a3, OFFSET_A3(sp) - ldq a4, OFFSET_A4(sp) - ldq a5, OFFSET_A5(sp) - ldq t8, OFFSET_T8(sp) - ldq t9, OFFSET_T9(sp) - ldq t10, OFFSET_T10(sp) - ldq t11, OFFSET_T11(sp) - ldq ra, OFFSET_RA(sp) - ldq t12, OFFSET_T12(sp) - ldq gp, OFFSET_GP(sp) - - ldq at_reg, OFFSET_AT(sp) - - lda sp, FRAME_SIZE(sp) - ret zero, (at_reg), 1 - - END(_mcount) -#endif diff --git a/common/lib/libc/arch/alpha/string/bcopy.S b/common/lib/libc/arch/alpha/string/bcopy.S deleted file mode 100644 index 785e354b7..000000000 --- a/common/lib/libc/arch/alpha/string/bcopy.S +++ /dev/null @@ -1,288 +0,0 @@ -/* $NetBSD: bcopy.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Trevor Blackwell. Support for use as memcpy() and memmove() - * added by Chris Demetriou. - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include - -#if defined(MEMCOPY) || defined(MEMMOVE) -#ifdef MEMCOPY -#define FUNCTION memcpy -#else -#define FUNCTION memmove -#endif -#define SRCREG a1 -#define DSTREG a0 -#else /* !(defined(MEMCOPY) || defined(MEMMOVE)) */ -#define FUNCTION bcopy -#define SRCREG a0 -#define DSTREG a1 -#endif /* !(defined(MEMCOPY) || defined(MEMMOVE)) */ - -#define SIZEREG a2 - -/* - * Copy bytes. - * - * void bcopy(char *from, char *to, size_t len); - * char *memcpy(void *to, const void *from, size_t len); - * char *memmove(void *to, const void *from, size_t len); - * - * No matter how invoked, the source and destination registers - * for calculation. There's no point in copying them to "working" - * registers, since the code uses their values "in place," and - * copying them would be slower. - */ - -LEAF(FUNCTION,3) - -#if defined(MEMCOPY) || defined(MEMMOVE) - /* set up return value, while we still can */ - mov DSTREG,v0 -#endif - - /* Check for negative length */ - ble SIZEREG,bcopy_done - - /* Check for overlap */ - subq DSTREG,SRCREG,t5 - cmpult t5,SIZEREG,t5 - bne t5,bcopy_overlap - - /* a3 = end address */ - addq SRCREG,SIZEREG,a3 - - /* Get the first word */ - ldq_u t2,0(SRCREG) - - /* Do they have the same alignment? */ - xor SRCREG,DSTREG,t0 - and t0,7,t0 - and DSTREG,7,t1 - bne t0,bcopy_different_alignment - - /* src & dst have same alignment */ - beq t1,bcopy_all_aligned - - ldq_u t3,0(DSTREG) - addq SIZEREG,t1,SIZEREG - mskqh t2,SRCREG,t2 - mskql t3,SRCREG,t3 - or t2,t3,t2 - - /* Dst is 8-byte aligned */ - -bcopy_all_aligned: - /* If less than 8 bytes,skip loop */ - subq SIZEREG,1,t0 - and SIZEREG,7,SIZEREG - bic t0,7,t0 - beq t0,bcopy_samealign_lp_end - -bcopy_samealign_lp: - stq_u t2,0(DSTREG) - addq DSTREG,8,DSTREG - ldq_u t2,8(SRCREG) - subq t0,8,t0 - addq SRCREG,8,SRCREG - bne t0,bcopy_samealign_lp - -bcopy_samealign_lp_end: - /* If we're done, exit */ - bne SIZEREG,bcopy_small_left - stq_u t2,0(DSTREG) - RET - -bcopy_small_left: - mskql t2,SIZEREG,t4 - ldq_u t3,0(DSTREG) - mskqh t3,SIZEREG,t3 - or t4,t3,t4 - stq_u t4,0(DSTREG) - RET - -bcopy_different_alignment: - /* - * this is the fun part - */ - addq SRCREG,SIZEREG,a3 - cmpule SIZEREG,8,t0 - bne t0,bcopy_da_finish - - beq t1,bcopy_da_noentry - - /* Do the initial partial word */ - subq zero,DSTREG,t0 - and t0,7,t0 - ldq_u t3,7(SRCREG) - extql t2,SRCREG,t2 - extqh t3,SRCREG,t3 - or t2,t3,t5 - insql t5,DSTREG,t5 - ldq_u t6,0(DSTREG) - mskql t6,DSTREG,t6 - or t5,t6,t5 - stq_u t5,0(DSTREG) - addq SRCREG,t0,SRCREG - addq DSTREG,t0,DSTREG - subq SIZEREG,t0,SIZEREG - ldq_u t2,0(SRCREG) - -bcopy_da_noentry: - subq SIZEREG,1,t0 - bic t0,7,t0 - and SIZEREG,7,SIZEREG - beq t0,bcopy_da_finish2 - -bcopy_da_lp: - ldq_u t3,7(SRCREG) - addq SRCREG,8,SRCREG - extql t2,SRCREG,t4 - extqh t3,SRCREG,t5 - subq t0,8,t0 - or t4,t5,t5 - stq t5,0(DSTREG) - addq DSTREG,8,DSTREG - beq t0,bcopy_da_finish1 - ldq_u t2,7(SRCREG) - addq SRCREG,8,SRCREG - extql t3,SRCREG,t4 - extqh t2,SRCREG,t5 - subq t0,8,t0 - or t4,t5,t5 - stq t5,0(DSTREG) - addq DSTREG,8,DSTREG - bne t0,bcopy_da_lp - -bcopy_da_finish2: - /* Do the last new word */ - mov t2,t3 - -bcopy_da_finish1: - /* Do the last partial word */ - ldq_u t2,-1(a3) - extql t3,SRCREG,t3 - extqh t2,SRCREG,t2 - or t2,t3,t2 - br zero,bcopy_samealign_lp_end - -bcopy_da_finish: - /* Do the last word in the next source word */ - ldq_u t3,-1(a3) - extql t2,SRCREG,t2 - extqh t3,SRCREG,t3 - or t2,t3,t2 - insqh t2,DSTREG,t3 - insql t2,DSTREG,t2 - lda t4,-1(zero) - mskql t4,SIZEREG,t5 - cmovne t5,t5,t4 - insqh t4,DSTREG,t5 - insql t4,DSTREG,t4 - addq DSTREG,SIZEREG,a4 - ldq_u t6,0(DSTREG) - ldq_u t7,-1(a4) - bic t6,t4,t6 - bic t7,t5,t7 - and t2,t4,t2 - and t3,t5,t3 - or t2,t6,t2 - or t3,t7,t3 - stq_u t3,-1(a4) - stq_u t2,0(DSTREG) - RET - -bcopy_overlap: - /* - * Basically equivalent to previous case, only backwards. - * Not quite as highly optimized - */ - addq SRCREG,SIZEREG,a3 - addq DSTREG,SIZEREG,a4 - - /* less than 8 bytes - don't worry about overlap */ - cmpule SIZEREG,8,t0 - bne t0,bcopy_ov_short - - /* Possibly do a partial first word */ - and a4,7,t4 - beq t4,bcopy_ov_nostart2 - subq a3,t4,a3 - subq a4,t4,a4 - ldq_u t1,0(a3) - subq SIZEREG,t4,SIZEREG - ldq_u t2,7(a3) - ldq t3,0(a4) - extql t1,a3,t1 - extqh t2,a3,t2 - or t1,t2,t1 - mskqh t3,t4,t3 - mskql t1,t4,t1 - or t1,t3,t1 - stq t1,0(a4) - -bcopy_ov_nostart2: - bic SIZEREG,7,t4 - and SIZEREG,7,SIZEREG - beq t4,bcopy_ov_lp_end - -bcopy_ov_lp: - /* This could be more pipelined, but it doesn't seem worth it */ - ldq_u t0,-8(a3) - subq a4,8,a4 - ldq_u t1,-1(a3) - subq a3,8,a3 - extql t0,a3,t0 - extqh t1,a3,t1 - subq t4,8,t4 - or t0,t1,t0 - stq t0,0(a4) - bne t4,bcopy_ov_lp - -bcopy_ov_lp_end: - beq SIZEREG,bcopy_done - - ldq_u t0,0(SRCREG) - ldq_u t1,7(SRCREG) - ldq_u t2,0(DSTREG) - extql t0,SRCREG,t0 - extqh t1,SRCREG,t1 - or t0,t1,t0 - insql t0,DSTREG,t0 - mskql t2,DSTREG,t2 - or t2,t0,t2 - stq_u t2,0(DSTREG) - -bcopy_done: - RET - -bcopy_ov_short: - ldq_u t2,0(SRCREG) - br zero,bcopy_da_finish - - END(FUNCTION) diff --git a/common/lib/libc/arch/alpha/string/bzero.S b/common/lib/libc/arch/alpha/string/bzero.S deleted file mode 100644 index a808b0d95..000000000 --- a/common/lib/libc/arch/alpha/string/bzero.S +++ /dev/null @@ -1,110 +0,0 @@ -/* $NetBSD: bzero.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Trevor Blackwell - * - * Permission to use, copy, modify and distribute this software and - * its documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND - * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie the - * rights to redistribute these changes. - */ - -#include - -LEAF(bzero,2) - ble a1,bzero_done - bic a1,63,t3 /* t3 is # bytes to do 64 bytes at a time */ - - /* If nothing in first word, ignore it */ - subq zero,a0,t0 - and t0,7,t0 /* t0 = (0-size)%8 */ - beq t0,bzero_nostart1 - - cmpult a1,t0,t1 /* if size > size%8 goto noshort */ - beq t1,bzero_noshort - - /* - * The whole thing is less than a word. - * Mask off 1..7 bytes, and finish. - */ - ldq_u t2,0(a0) - lda t0,-1(zero) /* t0=-1 */ - mskql t0,a1,t0 /* Get ff in bytes (a0%8)..((a0+a1-1)%8) */ - insql t0,a0,t0 - bic t2,t0,t2 /* zero those bytes in word */ - stq_u t2,0(a0) - RET - -bzero_noshort: - /* Handle the first partial word */ - ldq_u t2,0(a0) - subq a1,t0,a1 - mskql t2,a0,t2 /* zero bytes (a0%8)..7 in word */ - stq_u t2,0(a0) - - addq a0,t0,a0 /* round a0 up to next word */ - bic a1,63,t3 /* recalc t3 (# bytes to do 64 bytes at a - time) */ - -bzero_nostart1: - /* - * Loop, zeroing 64 bytes at a time - */ - beq t3,bzero_lp_done -bzero_lp: - stq zero,0(a0) - stq zero,8(a0) - stq zero,16(a0) - stq zero,24(a0) - subq t3,64,t3 - stq zero,32(a0) - stq zero,40(a0) - stq zero,48(a0) - stq zero,56(a0) - addq a0,64,a0 - bne t3,bzero_lp - -bzero_lp_done: - /* - * Handle the last 0..7 words. - * We mask off the low bits, so we don't need an extra - * compare instruction for the loop (just a bne. heh-heh) - */ - and a1,0x38,t4 - beq t4,bzero_finish_lp_done -bzero_finish_lp: - stq zero,0(a0) - subq t4,8,t4 - addq a0,8,a0 - bne t4,bzero_finish_lp - - /* Do the last partial word */ -bzero_finish_lp_done: - and a1,7,t5 /* 0..7 bytes left */ - beq t5,bzero_done /* mskqh won't change t0 if t5==0, but I - don't want to touch, say, a new VM page */ - ldq t0,0(a0) - mskqh t0,t5,t0 - stq t0,0(a0) -bzero_done: - RET - - END(bzero) diff --git a/common/lib/libc/arch/alpha/string/ffs.S b/common/lib/libc/arch/alpha/string/ffs.S deleted file mode 100644 index 788089a9c..000000000 --- a/common/lib/libc/arch/alpha/string/ffs.S +++ /dev/null @@ -1,94 +0,0 @@ -/* $NetBSD: ffs.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ - -/* - * Copyright (c) 1995 Christopher G. Demetriou - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the - * NetBSD Project. See http://www.NetBSD.org/ for - * information about NetBSD. - * 4. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * <> - */ - -#include - -LEAF(ffs, 1) - addl a0, 0, t0 - beq t0, Lallzero - - /* - * Initialize return value (v0), and set up t1 so that it - * contains the mask with only the lowest bit set. - */ - subl zero, t0, t1 - ldil v0, 1 - and t0, t1, t1 - - and t1, 0xff, t2 - bne t2, Ldo8 - - /* - * If lower 16 bits empty, add 16 to result and use upper 16. - */ - zapnot t1, 0x03, t3 - bne t3, Ldo16 - sra t1, 16, t1 - addl v0, 16, v0 - -Ldo16: - /* - * If lower 8 bits empty, add 8 to result and use upper 8. - */ - and t1, 0xff, t4 - bne t4, Ldo8 - sra t1, 8, t1 - addl v0, 8, v0 - -Ldo8: - and t1, 0x0f, t5 /* lower 4 of 8 empty? */ - and t1, 0x33, t6 /* lower 2 of each 4 empty? */ - and t1, 0x55, t7 /* lower 1 of each 2 empty? */ - - /* If lower 4 bits empty, add 4 to result. */ - bne t5, Ldo4 - addl v0, 4, v0 - -Ldo4: /* If lower 2 bits of each 4 empty, add 2 to result. */ - bne t6, Ldo2 - addl v0, 2, v0 - -Ldo2: /* If lower bit of each 2 empty, add 1 to result. */ - bne t7, Ldone - addl v0, 1, v0 - -Ldone: - RET - -Lallzero: - bis zero, zero, v0 - RET -END(ffs) diff --git a/common/lib/libc/arch/alpha/string/memcpy.S b/common/lib/libc/arch/alpha/string/memcpy.S deleted file mode 100644 index 11245b492..000000000 --- a/common/lib/libc/arch/alpha/string/memcpy.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ - -#define MEMCOPY -#include "bcopy.S" diff --git a/common/lib/libc/arch/alpha/string/memmove.S b/common/lib/libc/arch/alpha/string/memmove.S deleted file mode 100644 index d9d518633..000000000 --- a/common/lib/libc/arch/alpha/string/memmove.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ - -#define MEMMOVE -#include "bcopy.S" diff --git a/common/lib/libc/arch/arm/atomic/Makefile.inc b/common/lib/libc/arch/arm/atomic/Makefile.inc deleted file mode 100644 index f4aac3d9b..000000000 --- a/common/lib/libc/arch/arm/atomic/Makefile.inc +++ /dev/null @@ -1,89 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.29 2015/06/07 15:06:24 matt Exp $ - -.ifnmake obj -.include "${NETBSDSRCDIR}/common/lib/libc/arch/arm/features.mk" -.endif - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump" || (defined(__MINIX) && ${LIB} == "sys")) - -.if "${FEAT_LDREX}" == "no" -SRCS.atomic+= atomic_add_32_cas.c atomic_add_32_nv_cas.c \ - atomic_and_32_cas.c atomic_and_32_nv_cas.c \ - atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ - atomic_inc_32_cas.c atomic_inc_32_nv_cas.c \ - atomic_or_32_cas.c atomic_or_32_nv_cas.c \ - atomic_swap_32_cas.c membar_ops_nop.c - -.if ${LIB} == "c" -SRCS.atomic+= atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c \ - atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c \ - atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c \ - atomic_or_16_cas.c atomic_or_8_cas.c \ - atomic_and_16_cas.c atomic_and_8_cas.c \ - atomic_add_16_cas.c atomic_add_8_cas.c \ - atomic_swap_16_cas.c atomic_swap_8_cas.c \ - atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \ - atomic_load.c atomic_store.c \ - atomic_and_16_nv_cas.c atomic_and_8_nv_cas.c \ - atomic_c11_compare_exchange_cas_32.c \ - atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_8.c -.endif - -.else -.for op in add and cas nand or xor -.for sz in 8 16 32 64 -SRCS.atomic+= atomic_${op}_${sz}.S -.endfor -.endfor -SRCS.atomic+= atomic_dec_32.S atomic_dec_64.S -SRCS.atomic+= atomic_inc_32.S atomic_inc_64.S -SRCS.atomic+= atomic_sub_64.S -SRCS.atomic+= atomic_swap.S atomic_swap_16.S atomic_swap_64.S -SRCS.atomic+= membar_ops.S -.if defined(LIB) && ${LIB} != "kern" && ${LIB} != "rump" -.for op in add and nand or sub xor -SRCS.atomic+= sync_fetch_and_${op}_8.S -.endfor -.for sz in 1 2 4 8 -SRCS.atomic+= sync_bool_compare_and_swap_${sz}.S -.endfor -.endif -.endif - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread" || ${LIB} == "rump") - -SRCS.atomic+= atomic_simplelock.c -.if "${FEAT_THUMB2}" == "no" -CPUFLAGS.atomic_simplelock.c+= -marm -.endif - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -.if "${FEAT_LDREX}" == "no" -SRCS.atomic+= atomic_init_testset.c -SRCS.atomic+= atomic_cas_up.S -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_16_UP -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_8_UP -.if "${FEAT_EABI}" == "yes" && "${FEAT_LDRD}" == "yes" -CPPFLAGS+= -D__HAVE_ATOMIC_CAS_64_UP -D__HAVE_ASM_ATOMIC_CAS_64_UP -.endif -.else -SRCS.atomic+= atomic_init_cas.c -.endif #FEAT_LDREX - -.endif #LIB - -.if "${FEAT_THUMB2}" == "no" -.for f in ${SRCS.atomic:M*.S} -CPUFLAGS.$f+= -marm -.endfor -.endif - -SRCS+= ${SRCS.atomic} diff --git a/common/lib/libc/arch/arm/atomic/atomic_add_16.S b/common/lib/libc/arch/arm/atomic/atomic_add_16.S deleted file mode 100644 index 773009dff..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_add_16.S +++ /dev/null @@ -1,102 +0,0 @@ -/* $NetBSD: atomic_add_16.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_sub_16) - negs r1, r1 - /* FALLTHROUGH */ -ENTRY_NP(_atomic_add_16) - mov ip, r0 -1: ldrexh r0, [ip] /* load old value */ - adds r3, r0, r1 /* calculate new value */ - strexh r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_add_16) -END(_atomic_sub_16) - -ATOMIC_OP_ALIAS(atomic_add_16,_atomic_add_16) -ATOMIC_OP_ALIAS(atomic_add_short,_atomic_add_16) -ATOMIC_OP_ALIAS(atomic_add_ushort,_atomic_add_16) -CRT_ALIAS(__sync_fetch_and_add_2,_atomic_add_16) -CRT_ALIAS(__atomic_fetch_add_2,_atomic_add_16) -STRONG_ALIAS(_atomic_add_short,_atomic_add_16) -STRONG_ALIAS(_atomic_add_ushort,_atomic_add_16) - -ATOMIC_OP_ALIAS(atomic_sub_16,_atomic_sub_16) -ATOMIC_OP_ALIAS(atomic_sub_short,_atomic_sub_16) -ATOMIC_OP_ALIAS(atomic_sub_ushort,_atomic_sub_16) -CRT_ALIAS(__sync_fetch_and_sub_2,_atomic_sub_16) -CRT_ALIAS(__atomic_fetch_sub_2,_atomic_sub_16) -STRONG_ALIAS(_atomic_sub_short,_atomic_sub_16) -STRONG_ALIAS(_atomic_sub_ushort,_atomic_sub_16) - -ENTRY_NP(_atomic_sub_16_nv) - negs r1, r1 - /* FALLTHROUGH */ -ENTRY_NP(_atomic_add_16_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexh r0, [ip] /* load old value */ - adds r0, r0, r1 /* calculate new value (return value) */ - strexh r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_add_16_nv) -END(_atomic_sub_16_nv) -ATOMIC_OP_ALIAS(atomic_add_16_nv,_atomic_add_16_nv) -ATOMIC_OP_ALIAS(atomic_add_short_nv,_atomic_add_16_nv) -ATOMIC_OP_ALIAS(atomic_add_ushort_nv,_atomic_add_16_nv) -CRT_ALIAS(__sync_add_and_fetch_2,_atomic_add_16_nv) -STRONG_ALIAS(_atomic_add_short_nv,_atomic_add_16_nv) -STRONG_ALIAS(_atomic_add_ushort_nv,_atomic_add_16_nv) - -ATOMIC_OP_ALIAS(atomic_sub_16_nv,_atomic_sub_16_nv) -ATOMIC_OP_ALIAS(atomic_sub_short_nv,_atomic_sub_16_nv) -ATOMIC_OP_ALIAS(atomic_sub_ushort_nv,_atomic_sub_16_nv) -CRT_ALIAS(__sync_sub_and_fetch_2,_atomic_sub_16_nv) -STRONG_ALIAS(_atomic_sub_short_nv,_atomic_sub_16_nv) -STRONG_ALIAS(_atomic_sub_ushort_nv,_atomic_sub_16_nv) -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_add_32.S b/common/lib/libc/arch/arm/atomic/atomic_add_32.S deleted file mode 100644 index 15062572c..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_add_32.S +++ /dev/null @@ -1,110 +0,0 @@ -/* $NetBSD: atomic_add_32.S,v 1.8 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_sub_32) - negs r1, r1 - /* FALLTHROUGH */ -ENTRY_NP(_atomic_add_32) - mov ip, r0 -1: ldrex r0, [ip] /* load old value */ - adds r3, r0, r1 /* calculate new value */ - strex r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_add_32) -END(_atomic_sub_32) - -ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_32) -CRT_ALIAS(__sync_fetch_and_add_4,_atomic_add_32) -CRT_ALIAS(__atomic_fetch_add_4,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_long,_atomic_add_32) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32) - -ATOMIC_OP_ALIAS(atomic_sub_32,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_int,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_long,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_ptr,_atomic_sub_32) -CRT_ALIAS(__sync_fetch_and_sub_4,_atomic_sub_32) -CRT_ALIAS(__atomic_fetch_sub_4,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_int,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_long,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_ptr,_atomic_sub_32) - -ENTRY_NP(_atomic_sub_32_nv) - negs r1, r1 - /* FALLTHROUGH */ -ENTRY_NP(_atomic_add_32_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrex r0, [ip] /* load old value */ - adds r0, r0, r1 /* calculate new value (return value) */ - strex r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_add_32_nv) -END(_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) -CRT_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) - -ATOMIC_OP_ALIAS(atomic_sub_32_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_int_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_long_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_ptr_nv,_atomic_sub_32_nv) -CRT_ALIAS(__sync_sub_and_fetch_4,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_int_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_long_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_ptr_nv,_atomic_sub_32_nv) -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_add_64.S b/common/lib/libc/arch/arm/atomic/atomic_add_64.S deleted file mode 100644 index 698a9c799..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_add_64.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_add_64.S,v 1.11 2014/03/04 16:15:28 matt Exp $ */ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_add_64_nv) - push {r3,r4} /* save temporary */ - mov ip, r0 /* need r0 for return value */ -#ifndef __ARM_EABI__ - mov r3, r2 - mov r2, r1 -#endif -1: ldrexd r0, r1, [ip] /* load old value */ - adds LO, LO, NLO /* calculate new value lo */ - adcs HI, HI, NHI /* calculate new value hi */ - strexd r4, r0, r1, [ip] /* try to store */ - cmp r4, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ -#endif - pop {r3,r4} /* restore temporary */ - RET /* return new value */ -END(_atomic_add_64_nv) - -STRONG_ALIAS(_atomic_add_64,_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64) -CRT_ALIAS(__sync_add_and_fetch_8,_atomic_add_64_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_add_8.S b/common/lib/libc/arch/arm/atomic/atomic_add_8.S deleted file mode 100644 index 5484f7421..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_add_8.S +++ /dev/null @@ -1,102 +0,0 @@ -/* $NetBSD: atomic_add_8.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_sub_8) - negs r1, r1 - /* FALLTHROUGH */ -ENTRY_NP(_atomic_add_8) - mov ip, r0 -1: ldrexb r0, [ip] /* load old value */ - adds r3, r0, r1 /* calculate new value */ - strexb r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_add_8) -END(_atomic_sub_8) - -ATOMIC_OP_ALIAS(atomic_add_8,_atomic_add_8) -ATOMIC_OP_ALIAS(atomic_add_char,_atomic_add_8) -ATOMIC_OP_ALIAS(atomic_add_uchar,_atomic_add_8) -CRT_ALIAS(__sync_fetch_and_add_1,_atomic_add_8) -CRT_ALIAS(__atomic_fetch_add_1,_atomic_add_8) -STRONG_ALIAS(_atomic_add_char,_atomic_add_8) -STRONG_ALIAS(_atomic_add_uchar,_atomic_add_8) - -ATOMIC_OP_ALIAS(atomic_sub_8,_atomic_sub_8) -ATOMIC_OP_ALIAS(atomic_sub_char,_atomic_sub_8) -ATOMIC_OP_ALIAS(atomic_sub_uchar,_atomic_sub_8) -CRT_ALIAS(__sync_fetch_and_sub_1,_atomic_sub_8) -CRT_ALIAS(__atomic_fetch_sub_1,_atomic_sub_8) -STRONG_ALIAS(_atomic_sub_char,_atomic_sub_8) -STRONG_ALIAS(_atomic_sub_uchar,_atomic_sub_8) - -ENTRY_NP(_atomic_sub_8_nv) - negs r1, r1 - /* FALLTHROUGH */ -ENTRY_NP(_atomic_add_8_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexb r0, [ip] /* load old value */ - adds r0, r0, r1 /* calculate new value (return value) */ - strexb r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_add_8_nv) -END(_atomic_sub_8_nv) -ATOMIC_OP_ALIAS(atomic_add_8_nv,_atomic_add_8_nv) -ATOMIC_OP_ALIAS(atomic_add_char_nv,_atomic_add_8_nv) -ATOMIC_OP_ALIAS(atomic_add_uchar_nv,_atomic_add_8_nv) -CRT_ALIAS(__sync_add_and_fetch_1,_atomic_add_8_nv) -STRONG_ALIAS(_atomic_add_char_nv,_atomic_add_8_nv) -STRONG_ALIAS(_atomic_add_uchar_nv,_atomic_add_8_nv) - -ATOMIC_OP_ALIAS(atomic_sub_8_nv,_atomic_sub_8_nv) -ATOMIC_OP_ALIAS(atomic_sub_char_nv,_atomic_sub_8_nv) -ATOMIC_OP_ALIAS(atomic_sub_uchar_nv,_atomic_sub_8_nv) -CRT_ALIAS(__sync_sub_and_fetch_1,_atomic_sub_8_nv) -STRONG_ALIAS(_atomic_sub_char_nv,_atomic_sub_8_nv) -STRONG_ALIAS(_atomic_sub_uchar_nv,_atomic_sub_8_nv) -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_and_16.S b/common/lib/libc/arch/arm/atomic/atomic_and_16.S deleted file mode 100644 index 66f830043..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_and_16.S +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: atomic_and_16.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_and_16) - mov ip, r0 -1: ldrexh r0, [ip] /* load old value (to be returned) */ - ands r3, r0, r1 /* calculate new value */ - strexh r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_and_16) - -ATOMIC_OP_ALIAS(atomic_and_16,_atomic_and_16) -ATOMIC_OP_ALIAS(atomic_and_ushort,_atomic_and_16) -CRT_ALIAS(__sync_fetch_and_and_2,_atomic_and_16) -CRT_ALIAS(__atomic_fetch_and_2,_atomic_and_16) -STRONG_ALIAS(_atomic_and_ushort,_atomic_and_16) - -ENTRY_NP(_atomic_and_16_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexh r0, [ip] /* load old value */ - ands r0, r0, r1 /* calculate new value (return value) */ - strexh r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_and_16_nv) - -ATOMIC_OP_ALIAS(atomic_and_16_nv,_atomic_and_16_nv) -ATOMIC_OP_ALIAS(atomic_and_ushort_nv,_atomic_and_16_nv) -CRT_ALIAS(__sync_and_and_fetch_2,_atomic_and_16_nv) -STRONG_ALIAS(_atomic_and_ushort_nv,_atomic_and_16_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_and_32.S b/common/lib/libc/arch/arm/atomic/atomic_and_32.S deleted file mode 100644 index f4cad4480..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_and_32.S +++ /dev/null @@ -1,81 +0,0 @@ -/* $NetBSD: atomic_and_32.S,v 1.8 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_and_32) - mov ip, r0 -1: ldrex r0, [ip] /* load old value (to be returned) */ - ands r3, r0, r1 /* calculate new value */ - strex r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_and_32) - -ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) -CRT_ALIAS(__sync_fetch_and_and_4,_atomic_and_32) -CRT_ALIAS(__atomic_fetch_and_4,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) - -ENTRY_NP(_atomic_and_32_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrex r0, [ip] /* load old value */ - ands r0, r0, r1 /* calculate new value (return value) */ - strex r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_and_32_nv) - -ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) -CRT_ALIAS(__sync_and_and_fetch_4,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_and_64.S b/common/lib/libc/arch/arm/atomic/atomic_and_64.S deleted file mode 100644 index 885896426..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_and_64.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_and_64.S,v 1.10 2014/03/04 16:15:28 matt Exp $ */ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_and_64_nv) - push {r3,r4} /* save temporary */ -#ifndef __ARM_EABI__ - mov r3, r2 - mov r2, r1 -#endif - mov ip, r0 /* need r0 for return value */ -1: ldrexd r0, r1, [ip] /* load old value */ - ands r0, r0, r2 /* calculate new value */ - ands r1, r1, r3 /* calculate new value */ - strexd r4, r0, r1, [ip] /* try to store */ - cmp r4, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ -#endif - pop {r3,r4} /* restore temporary */ - RET /* return new value */ -END(_atomic_and_64_nv) - -STRONG_ALIAS(_atomic_and_64,_atomic_and_64_nv) -ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64_nv) -ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64_nv) -CRT_ALIAS(__sync_and_and_fetch_8,_atomic_and_64_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_and_8.S b/common/lib/libc/arch/arm/atomic/atomic_and_8.S deleted file mode 100644 index a99583b64..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_and_8.S +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: atomic_and_8.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_and_8) - mov ip, r0 -1: ldrexb r0, [ip] /* load old value (to be returned) */ - ands r3, r0, r1 /* calculate new value */ - strexb r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_and_8) - -ATOMIC_OP_ALIAS(atomic_and_8,_atomic_and_8) -ATOMIC_OP_ALIAS(atomic_and_uchar,_atomic_and_8) -CRT_ALIAS(__sync_fetch_and_and_1,_atomic_and_8) -CRT_ALIAS(__atomic_fetch_and_1,_atomic_and_8) -STRONG_ALIAS(_atomic_and_uchar,_atomic_and_8) - -ENTRY_NP(_atomic_and_8_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexb r0, [ip] /* load old value */ - ands r0, r0, r1 /* calculate new value (return value) */ - strexb r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_and_8_nv) - -ATOMIC_OP_ALIAS(atomic_and_8_nv,_atomic_and_8_nv) -ATOMIC_OP_ALIAS(atomic_and_uchar_nv,_atomic_and_8_nv) -CRT_ALIAS(__sync_and_and_fetch_1,_atomic_and_8_nv) -STRONG_ALIAS(_atomic_and_uchar_nv,_atomic_and_8_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_cas_16.S b/common/lib/libc/arch/arm/atomic/atomic_cas_16.S deleted file mode 100644 index 45c7fdc99..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_cas_16.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_cas_16.S,v 1.2 2014/03/04 16:15:28 matt Exp $ */ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) -/* - * ARMv6 has load-exclusive/store-exclusive which works for both user - * and kernel. - */ -ENTRY_NP(_atomic_cas_16) - mov ip, r0 /* we need r0 for return value */ -1: - ldrexh r0, [ip] /* load old value */ - cmp r0, r1 /* compare? */ -#ifdef __thumb__ - bne 2f -#else - RETc(ne) /* return if different */ -#endif - strexh r3, r2, [ip] /* store new value */ - cmp r3, #0 /* succeed? */ - bne 1b /* nope, try again. */ -#ifdef _ARM_ARCH_7 - dsb /* data synchronization barrier */ -#else - mcr p15, 0, r3, c7, c10, 4 /* data synchronization barrier */ -#endif -2: RET /* return. */ -END(_atomic_cas_16) - -ATOMIC_OP_ALIAS(atomic_cas_16,_atomic_cas_16) -STRONG_ALIAS(_atomic_cas_short,_atomic_cas_16) -STRONG_ALIAS(_atomic_cas_ushort,_atomic_cas_16) -CRT_ALIAS(__sync_val_compare_and_swap_2,_atomic_cas_16) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_cas_32.S b/common/lib/libc/arch/arm/atomic/atomic_cas_32.S deleted file mode 100644 index 5fd832123..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_cas_32.S +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: atomic_cas_32.S,v 1.7 2014/03/04 16:15:28 matt Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) -/* - * ARMv6 has load-exclusive/store-exclusive which works for both user - * and kernel. - */ -ENTRY_NP(_atomic_cas_32) - mov ip, r0 /* we need r0 for return value */ -1: - ldrex r0, [ip] /* load old value */ - cmp r0, r1 /* compare? */ -#ifdef __thumb__ - bne 2f /* return if different */ -#else - RETc(ne) /* return if different */ -#endif - strex r3, r2, [ip] /* store new value */ - cmp r3, #0 /* succeed? */ - bne 1b /* nope, try again. */ -#ifdef _ARM_ARCH_7 - dsb -#else - mcr p15, 0, r3, c7, c10, 4 /* data synchronization barrier */ -#endif -2: RET /* return. */ -END(_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32) -CRT_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_cas_64.S b/common/lib/libc/arch/arm/atomic/atomic_cas_64.S deleted file mode 100644 index 3e670b02b..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_cas_64.S +++ /dev/null @@ -1,75 +0,0 @@ -/* $NetBSD: atomic_cas_64.S,v 1.10 2014/03/05 17:20:48 matt Exp $ */ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) -/* - * ARMv6 has load-exclusive/store-exclusive which works for both user - * and kernel. - */ -ENTRY_NP(_atomic_cas_64) - push {r4-r7} /* save temporaries */ - mov ip, r0 /* we need r0 for return value */ -#ifdef __ARM_EABI__ - ldrd r4, r5, [sp, #16] /* fetch new value */ -#else - ldr r5, [sp, #16] /* second word third argument */ - mov r4, r3 /* first word third argument */ - mov r3, r2 /* r2 will be overwritten by r1 which ... */ - mov r2, r1 /* r1 will be overwritten by ldrexd */ -#endif -1: - ldrexd r0, r1, [ip] /* load current value */ - cmp r0, r2 /* compare to old? 1st half */ -#ifdef __thumb__ - bne 2f /* jump to return if different */ - cmp r1, r3 /* compare to old? 2nd half */ -#else - cmpeq r1, r3 /* compare to old? 2nd half */ -#endif - bne 2f /* jump to return if different */ - strexd r6, r4, r5, [ip] /* store new value */ - cmp r6, #0 /* succeed? */ - bne 1b /* nope, try again. */ -#ifdef _ARM_ARCH_7 - dsb -#else - mcr p15, 0, ip, c7, c10, 4 /* data synchronization barrier */ -#endif -2: - pop {r4-r7} /* restore temporaries */ - RET /* return. */ -END(_atomic_cas_64) - -ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) -CRT_ALIAS(__sync_val_compare_and_swap_8,_atomic_cas_64) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_cas_8.S b/common/lib/libc/arch/arm/atomic/atomic_cas_8.S deleted file mode 100644 index 582e0fbe7..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_cas_8.S +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_cas_8.S,v 1.7 2014/03/04 16:15:28 matt Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) -/* - * ARMv6 has load-exclusive/store-exclusive which works for both user - * and kernel. - */ -ENTRY_NP(_atomic_cas_8) - mov ip, r0 /* we need r0 for return value */ -1: - ldrexb r0, [ip] /* load old value */ - cmp r0, r1 /* compare? */ -#ifdef __thumb__ - bne 2f -#else - RETc(ne) /* return if different */ -#endif - strexb r3, r2, [ip] /* store new value */ - cmp r3, #0 /* succeed? */ - bne 1b /* nope, try again. */ -#ifdef _ARM_ARCH_7 - dsb /* data synchronization barrier */ -#else - mcr p15, 0, r3, c7, c10, 4 /* data synchronization barrier */ -#endif -2: RET /* return. */ - END(_atomic_cas_8) - -ATOMIC_OP_ALIAS(atomic_cas_8,_atomic_cas_8) -STRONG_ALIAS(_atomic_cas_char,_atomic_cas_8) -STRONG_ALIAS(_atomic_cas_uchar,_atomic_cas_8) -CRT_ALIAS(__sync_val_compare_and_swap_1,_atomic_cas_8) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_cas_up.S b/common/lib/libc/arch/arm/atomic/atomic_cas_up.S deleted file mode 100644 index c2799a93b..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_cas_up.S +++ /dev/null @@ -1,100 +0,0 @@ -/* $NetBSD: atomic_cas_up.S,v 1.7 2014/03/04 03:36:24 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Steve C. Woodford. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -ENTRY(_atomic_cas_up) - .hidden _C_LABEL(_atomic_cas_up) - mov r3, r0 - .align 0 -RAS_START_ASM_HIDDEN(_atomic_cas) - ldr r0, [r3] - cmp r0, r1 -#if defined(__thumb__) - beq 1f -#else - streq r2, [r3] -#endif - .align 0 -RAS_END_ASM_HIDDEN(_atomic_cas) -1: RET -END(_atomic_cas_up) - -#if defined(__HAVE_ASM_ATOMIC_CAS_64_UP) -ARM_ENTRY(_atomic_cas_64_up) - push {r4-r5} - mov ip, r0 - ldrd r4, r5, [sp, #8] - .align 0 -RAS_START_ASM_HIDDEN(_atomic_cas_64) - ldrd r0, r1, [ip] - cmp r0, r2 - cmpeq r1, r3 - strdeq r4, r5, [ip] - .align 0 -RAS_END_ASM_HIDDEN(_atomic_cas_64) -1: pop {r4-r5} - bx lr -END(_atomic_cas_64_up) -#endif /* __HAVE_ASM_ATOMIC_64_UP */ - -ENTRY(_atomic_cas_16_up) - mov r3, r0 - .align 0 -RAS_START_ASM_HIDDEN(_atomic_cas_16) - ldrh r0, [r3] - cmp r0, r1 -#if defined(__thumb__) - beq 1f -#else - strheq r2, [r3] -#endif - .align 0 -RAS_END_ASM_HIDDEN(_atomic_cas_16) -1: RET -END(_atomic_cas_16_up) - -ENTRY(_atomic_cas_8_up) - mov r3, r0 - .align 0 -RAS_START_ASM_HIDDEN(_atomic_cas_8) - ldrb r0, [r3] - cmp r0, r1 -#if defined(__thumb__) - beq 1f -#else - strbeq r2, [r3] -#endif - .align 0 -RAS_END_ASM_HIDDEN(_atomic_cas_8) -1: RET -END(_atomic_cas_8_up) diff --git a/common/lib/libc/arch/arm/atomic/atomic_dec_32.S b/common/lib/libc/arch/arm/atomic/atomic_dec_32.S deleted file mode 100644 index 34f013630..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_dec_32.S +++ /dev/null @@ -1,80 +0,0 @@ -/* $NetBSD: atomic_dec_32.S,v 1.5 2013/08/11 04:41:17 matt Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_dec_32) -1: ldrex r3, [r0] /* load old value (return value) */ - subs r3, r3, #1 /* calculate new value */ - strex r2, r3, [r0] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_dec_32) - -ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_32) - -ENTRY_NP(_atomic_dec_32_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrex r0, [ip] /* load old value */ - subs r0, r0, #1 /* calculate new value (return value) */ - strex r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_dec_32_nv) - -ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_32_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_dec_64.S b/common/lib/libc/arch/arm/atomic/atomic_dec_64.S deleted file mode 100644 index 33fe0827c..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_dec_64.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_dec_64.S,v 1.7 2013/11/30 21:09:11 joerg Exp $ */ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_dec_64_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexd r0, r1, [ip] /* load old value */ - subs LO, LO, #1 /* calculate new value */ - sbcs HI, HI, #0 /* calculate new value */ - strexd r2, r0, r1, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_dec_64_nv) - -STRONG_ALIAS(_atomic_dec_64,_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_64_nv,_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_inc_32.S b/common/lib/libc/arch/arm/atomic/atomic_inc_32.S deleted file mode 100644 index 845a90668..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_inc_32.S +++ /dev/null @@ -1,78 +0,0 @@ -/* $NetBSD: atomic_inc_32.S,v 1.7 2013/11/08 22:42:52 matt Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_inc_32) -1: ldrex r3, [r0] /* load old value (return value) */ - adds r3, r3, #1 /* calculate new value */ - strex r2, r3, [r0] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32) - -ENTRY_NP(_atomic_inc_32_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrex r0, [ip] /* load old value */ - adds r0, r0, #1 /* calculate new value (return value) */ - strex r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_inc_64.S b/common/lib/libc/arch/arm/atomic/atomic_inc_64.S deleted file mode 100644 index c078f0730..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_inc_64.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_inc_64.S,v 1.9 2013/11/30 21:09:11 joerg Exp $ */ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_inc_64_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexd r0, r1, [ip] /* load old value */ - adds LO, LO, #1 /* calculate new value (return value) */ - adcs HI, HI, #0 /* fold carry into high */ - strexd r2, r0, r1, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_inc_64_nv) - -STRONG_ALIAS(_atomic_inc_64,_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_nand_16.S b/common/lib/libc/arch/arm/atomic/atomic_nand_16.S deleted file mode 100644 index eb2946989..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_nand_16.S +++ /dev/null @@ -1,78 +0,0 @@ -/* $NetBSD: atomic_nand_16.S,v 1.2 2014/03/04 16:15:28 matt Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_nand_16) - mov ip, r0 -1: ldrexh r0, [ip] /* load old value (to be returned) */ - mvns r3, r0 /* complement source */ - ands r3, r3, r1 /* calculate new value */ - strexh r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_nand_16) - -ATOMIC_OP_ALIAS(atomic_nand_16,_atomic_nand_16) -ATOMIC_OP_ALIAS(atomic_nand_ushort,_atomic_nand_16) -CRT_ALIAS(__sync_fetch_and_nand_2,_atomic_nand_16) -STRONG_ALIAS(_atomic_nand_ushort,_atomic_nand_16) - -ENTRY_NP(_atomic_nand_16_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexh r0, [ip] /* load old value */ - mvns r0, r0 /* complement source */ - ands r0, r0, r1 /* calculate new value (return value) */ - strexh r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_nand_16_nv) - -ATOMIC_OP_ALIAS(atomic_nand_16_nv,_atomic_nand_16_nv) -ATOMIC_OP_ALIAS(atomic_nand_ushort_nv,_atomic_nand_16_nv) -CRT_ALIAS(__sync_nand_and_fetch_2,_atomic_nand_16_nv) -STRONG_ALIAS(_atomic_nand_ushort_nv,_atomic_nand_16_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_nand_32.S b/common/lib/libc/arch/arm/atomic/atomic_nand_32.S deleted file mode 100644 index 500fd655f..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_nand_32.S +++ /dev/null @@ -1,82 +0,0 @@ -/* $NetBSD: atomic_nand_32.S,v 1.2 2014/03/04 16:15:28 matt Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_nand_32) - mov ip, r0 -1: ldrex r0, [ip] /* load old value (to be returned) */ - mvns r3, r0 /* complement source */ - ands r3, r3, r1 /* calculate new value */ - strex r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_nand_32) - -ATOMIC_OP_ALIAS(atomic_nand_32,_atomic_nand_32) -ATOMIC_OP_ALIAS(atomic_nand_uint,_atomic_nand_32) -ATOMIC_OP_ALIAS(atomic_nand_ulong,_atomic_nand_32) -CRT_ALIAS(__sync_fetch_and_nand_4,_atomic_nand_32) -STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32) -STRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_32) - -ENTRY_NP(_atomic_nand_32_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrex r0, [ip] /* load old value */ - mvns r0, r0 /* complement source */ - ands r0, r0, r1 /* calculate new value (return value) */ - strex r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_nand_32_nv) - -ATOMIC_OP_ALIAS(atomic_nand_32_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_uint_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_ulong_nv,_atomic_nand_32_nv) -CRT_ALIAS(__sync_nand_and_fetch_4,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_uint_nv,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_ulong_nv,_atomic_nand_32_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_nand_64.S b/common/lib/libc/arch/arm/atomic/atomic_nand_64.S deleted file mode 100644 index b7b7364a0..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_nand_64.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_nand_64.S,v 1.3 2014/03/04 16:15:28 matt Exp $ */ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_nand_64_nv) - push {r3,r4} /* save temporary */ -#ifndef __ARM_EABI__ - mov r3, r2 - mov r2, r1 -#endif - mov ip, r0 /* need r0 for return value */ -1: ldrexd r0, r1, [ip] /* load old value */ - mvns r0, r0 /* complement old value */ - mvns r1, r1 /* complement old value */ - ands r0, r0, r2 /* calculate new value */ - ands r1, r1, r3 /* calculate new value */ - strexd r4, r0, r1, [ip] /* try to store */ - cmp r4, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ -#endif - pop {r3,r4} /* restore temporary */ - RET /* return new value */ -END(_atomic_nand_64_nv) - -STRONG_ALIAS(_atomic_nand_64,_atomic_nand_64_nv) -ATOMIC_OP_ALIAS(atomic_nand_64_nv,_atomic_nand_64_nv) -ATOMIC_OP_ALIAS(atomic_nand_64,_atomic_nand_64_nv) -CRT_ALIAS(__sync_nand_and_fetch_8,_atomic_nand_64_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_nand_8.S b/common/lib/libc/arch/arm/atomic/atomic_nand_8.S deleted file mode 100644 index 939fc2ca6..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_nand_8.S +++ /dev/null @@ -1,78 +0,0 @@ -/* $NetBSD: atomic_nand_8.S,v 1.2 2014/03/04 16:15:28 matt Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_nand_8) - mov ip, r0 -1: ldrexb r0, [ip] /* load old value (to be returned) */ - mvns r3, r0 /* complement source */ - ands r3, r3, r1 /* calculate new value */ - strexb r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_nand_8) - -ATOMIC_OP_ALIAS(atomic_nand_8,_atomic_nand_8) -ATOMIC_OP_ALIAS(atomic_nand_uchar,_atomic_nand_8) -CRT_ALIAS(__sync_fetch_and_nand_1,_atomic_nand_8) -STRONG_ALIAS(_atomic_nand_uchar,_atomic_nand_8) - -ENTRY_NP(_atomic_nand_8_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexb r0, [ip] /* load old value */ - mvns r0, r0 /* complement source */ - ands r0, r0, r1 /* calculate new value (return value) */ - strexb r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_nand_8_nv) - -ATOMIC_OP_ALIAS(atomic_nand_8_nv,_atomic_nand_8_nv) -ATOMIC_OP_ALIAS(atomic_nand_uchar_nv,_atomic_nand_8_nv) -CRT_ALIAS(__sync_nand_and_fetch_1,_atomic_nand_8_nv) -STRONG_ALIAS(_atomic_nand_uchar_nv,_atomic_nand_8_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_op_asm.h b/common/lib/libc/arch/arm/atomic/atomic_op_asm.h deleted file mode 100644 index 3a38273ae..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_op_asm.h +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.7 2015/05/17 20:57:11 justin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) -#ifdef _LIBC -#define CRT_ALIAS(a,s) STRONG_ALIAS(a,s) -#endif - -#endif /* _KERNEL */ - -#ifdef __ARMEB__ -#define HI r0 -#define LO r1 -#define NHI r2 -#define NLO r3 -#define THI r4 -#define TLO r5 -#else -#define LO r0 -#define HI r1 -#define NLO r2 -#define NHI r3 -#define TLO r4 -#define THI r5 -#endif - -#ifndef CRT_ALIAS -#define CRT_ALIAS(a,s) -#endif - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_or_16.S b/common/lib/libc/arch/arm/atomic/atomic_or_16.S deleted file mode 100644 index 5113fd5df..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_or_16.S +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: atomic_or_16.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_or_16) - mov ip, r0 -1: ldrexh r0, [ip] /* load old value (to be returned) */ - orrs r3, r0, r1 /* calculate new value */ - strexh r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_or_16) - -ATOMIC_OP_ALIAS(atomic_or_16,_atomic_or_16) -ATOMIC_OP_ALIAS(atomic_or_ushort,_atomic_or_16) -CRT_ALIAS(__sync_fetch_and_or_2,_atomic_or_16) -CRT_ALIAS(__atomic_fetch_or_2,_atomic_or_16) -STRONG_ALIAS(_atomic_or_ushort,_atomic_or_16) - -ENTRY_NP(_atomic_or_16_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexh r0, [ip] /* load old value */ - orrs r0, r0, r1 /* calculate new value (return value) */ - strexh r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_or_16_nv) - -ATOMIC_OP_ALIAS(atomic_or_16_nv,_atomic_or_16_nv) -ATOMIC_OP_ALIAS(atomic_or_ushort_nv,_atomic_or_16_nv) -CRT_ALIAS(__sync_or_and_fetch_2,_atomic_or_16_nv) -STRONG_ALIAS(_atomic_or_ushort_nv,_atomic_or_16_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_or_32.S b/common/lib/libc/arch/arm/atomic/atomic_or_32.S deleted file mode 100644 index 1ee4190d6..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_or_32.S +++ /dev/null @@ -1,80 +0,0 @@ -/* $NetBSD: atomic_or_32.S,v 1.8 2014/06/23 21:53:45 joerg Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_or_32) - mov ip, r0 -1: ldrex r0, [ip] /* load old value (to be returned) */ - orrs r3, r0, r1 /* calculate new value */ - strex r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_or_32) - -ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) -CRT_ALIAS(__sync_fetch_and_or_4,_atomic_or_32) -CRT_ALIAS(__atomic_fetch_or_4,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) - -ENTRY_NP(_atomic_or_32_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrex r0, [ip] /* load old value */ - orrs r0, r0, r1 /* calculate new value (return value) */ - strex r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_or_32_nv) - -ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) -CRT_ALIAS(__sync_or_and_fetch_4,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_or_64.S b/common/lib/libc/arch/arm/atomic/atomic_or_64.S deleted file mode 100644 index 818cde3cb..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_or_64.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_or_64.S,v 1.10 2014/03/04 16:15:28 matt Exp $ */ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_or_64_nv) - push {r3,r4} /* save temporary */ -#ifndef __ARM_EABI__ - mov r3, r2 - mov r2, r1 -#endif - mov ip, r0 /* need r0 for return value */ -1: ldrexd r0, r1, [ip] /* load old value */ - orrs r0, r0, r2 /* calculate new value (return value) */ - orrs r1, r1, r3 /* calculate new value (return value) */ - strexd r4, r0, r1, [ip] /* try to store */ - cmp r4, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ -#endif - pop {r3,r4} /* restore temporary */ - RET /* return new value */ -END(_atomic_or_64_nv) - -STRONG_ALIAS(_atomic_or_64,_atomic_or_64_nv) -ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64_nv) -ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64) -CRT_ALIAS(__sync_or_and_fetch_8,_atomic_or_64) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_or_8.S b/common/lib/libc/arch/arm/atomic/atomic_or_8.S deleted file mode 100644 index 155a28bce..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_or_8.S +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: atomic_or_8.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_or_8) - mov ip, r0 -1: ldrexb r0, [ip] /* load old value (to be returned) */ - orrs r3, r0, r1 /* calculate new value */ - strexb r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_or_8) - -ATOMIC_OP_ALIAS(atomic_or_8,_atomic_or_8) -ATOMIC_OP_ALIAS(atomic_or_char,_atomic_or_8) -CRT_ALIAS(__sync_fetch_and_or_1,_atomic_or_8) -CRT_ALIAS(__atomic_fetch_or_1,_atomic_or_8) -STRONG_ALIAS(_atomic_or_char,_atomic_or_8) - -ENTRY_NP(_atomic_or_8_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexb r0, [ip] /* load old value */ - orrs r0, r0, r1 /* calculate new value (return value) */ - strexb r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_or_8_nv) - -ATOMIC_OP_ALIAS(atomic_or_8_nv,_atomic_or_8_nv) -ATOMIC_OP_ALIAS(atomic_or_char_nv,_atomic_or_8_nv) -CRT_ALIAS(__sync_or_and_fetch_1,_atomic_or_8_nv) -STRONG_ALIAS(_atomic_or_char_nv,_atomic_or_8_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_simplelock.c b/common/lib/libc/arch/arm/atomic/atomic_simplelock.c deleted file mode 100644 index b0bb09a4a..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_simplelock.c +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: atomic_simplelock.c,v 1.2 2013/08/16 01:47:41 matt Exp $"); - -#include - -#if !defined(_ARM_ARCH_T2) -/* - * We need to use the inlines so redefine out of the way. - */ -#define __cpu_simple_lock __arm_simple_lock -#define __cpu_simple_lock_try __arm_simple_lock_try -#include -/* - * Now get rid of them. - */ -#undef __cpu_simple_lock -#undef __cpu_simple_lock_try - -/* - * Since we overrode lock.h we have to provide these ourselves. - */ -#ifdef __LIBPTHREAD_SOURCE__ -__dso_hidden void __cpu_simple_lock(__cpu_simple_lock_t *); -__dso_hidden int __cpu_simple_lock_try(__cpu_simple_lock_t *); -#else -void __cpu_simple_lock(__cpu_simple_lock_t *); -int __cpu_simple_lock_try(__cpu_simple_lock_t *); -#endif - -void -__cpu_simple_lock(__cpu_simple_lock_t *alp) -{ - - __arm_simple_lock(alp); -} - -int -__cpu_simple_lock_try(__cpu_simple_lock_t *alp) -{ - - return __arm_simple_lock_try(alp); -} -#endif diff --git a/common/lib/libc/arch/arm/atomic/atomic_sub_64.S b/common/lib/libc/arch/arm/atomic/atomic_sub_64.S deleted file mode 100644 index 0158ae9b6..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_sub_64.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_sub_64.S,v 1.2 2014/03/04 16:15:28 matt Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_sub_64_nv) - push {r3,r4} /* save temporary */ - mov ip, r0 /* need r0 for return value */ -#ifndef __ARM_EABI__ - mov r3, r2 - mov r2, r1 -#endif -1: ldrexd r0, [ip] /* load old value */ - subs LO, LO, NLO /* calculate new value lo */ - sbcs HI, HI, NHI /* calculate new value hi */ - strexd r4, r0, [ip] /* try to store */ - cmp r4, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ -#endif - pop {r3,r4} /* restore temporary */ - RET /* return new value */ -END(_atomic_sub_64_nv) - -STRONG_ALIAS(_atomic_sub_64,_atomic_sub_64_nv) -ATOMIC_OP_ALIAS(atomic_sub_64_nv,_atomic_sub_64_nv) -ATOMIC_OP_ALIAS(atomic_sub_64,_atomic_sub_64) -CRT_ALIAS(__sync_sub_and_fetch_8,_atomic_sub_64_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_swap.S b/common/lib/libc/arch/arm/atomic/atomic_swap.S deleted file mode 100644 index 1157c6564..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_swap.S +++ /dev/null @@ -1,139 +0,0 @@ -/* $NetBSD: atomic_swap.S,v 1.14 2015/05/17 20:57:11 justin Exp $ */ - -/*- - * Copyright (c) 2007,2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe and Matt Thomas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -/* - * While SWP{B} is sufficient on its own for pre-ARMv7 CPUs, on MP ARMv7 cores - * SWP{B} is disabled since it's no longer atomic among multiple CPUs. They - * will actually raise an UNDEFINED exception. - * - * So if we use the LDREX/STREX template, but use a SWP instruction followed - * by a MOV instruction (using a temporary register), that gives a handler - * for the SWP UNDEFINED exception enough information to "patch" this instance - * SWP with correct forms of LDREX/STREX. (note that this would happen even - * "read-only" pages. If the page gets tossed, we will get another exception - * and fix yet again). - */ - -ENTRY_NP(_atomic_swap_32) - mov ip, r0 -1: -#ifdef _ARM_ARCH_6 - ldrex r0, [ip] - cmp r0, r1 -#ifdef __thumb__ - beq 99f - strex r3, r1, [ip] - cmp r3, #0 -#else - strexne r3, r1, [ip] - cmpne r3, #0 -#endif -#else - swp r0, r1, [ip] - cmp r0, r1 - movsne r3, #0 - cmpne r3, #0 -#endif - bne 1b -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r3, c7, c10, 5 /* data memory barrier */ -#endif -99: - RET -END(_atomic_swap_32) - -ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32) -CRT_ALIAS(__sync_lock_test_and_set_4,_atomic_swap_32) -CRT_ALIAS(__atomic_exchange_4,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) - -#if (!defined(_KERNEL) || !defined(_RUMPKERNEL)) && !defined(_STANDALONE) -ENTRY_NP(__sync_lock_release_4) - mov r1, #0 -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r1, c7, c10, 5 /* data memory barrier */ -#endif - strb r1, [r0] - RET -END(__sync_lock_release_4) -#endif - -ENTRY_NP(_atomic_swap_8) - mov ip, r0 -1: -#ifdef _ARM_ARCH_6 - ldrexb r0, [ip] - strexb r3, r1, [ip] -#else - swpb r0, r1, [ip] - mov r3, #0 -#endif - cmp r3, #0 - bne 1b -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, ip, c7, c10, 5 /* data memory barrier */ -#endif - RET -END(_atomic_swap_8) - -ATOMIC_OP_ALIAS(atomic_swap_8,_atomic_swap_8) -ATOMIC_OP_ALIAS(atomic_swap_char,_atomic_swap_8) -ATOMIC_OP_ALIAS(atomic_swap_uchar,_atomic_swap_8) -CRT_ALIAS(__sync_lock_test_and_set_1,_atomic_swap_8) -CRT_ALIAS(__atomic_exchange_1,_atomic_swap_8) -STRONG_ALIAS(_atomic_swap_char,_atomic_swap_8) -STRONG_ALIAS(_atomic_swap_uchar,_atomic_swap_8) - -#if (!defined(_KERNEL) || !defined(_RUMPKERNEL)) && !defined(_STANDALONE) -ENTRY_NP(__sync_lock_release_1) - mov r1, #0 -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r1, c7, c10, 5 /* data memory barrier */ -#endif - strb r1, [r0] - RET -END(__sync_lock_release_1) -#endif diff --git a/common/lib/libc/arch/arm/atomic/atomic_swap_16.S b/common/lib/libc/arch/arm/atomic/atomic_swap_16.S deleted file mode 100644 index 83bb0f97b..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_swap_16.S +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_swap_16.S,v 1.4 2015/05/17 20:57:11 justin Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 -ENTRY_NP(_atomic_swap_16) - mov ip, r0 -1: - ldrexh r0, [ip] - strexh r3, r1, [ip] - cmp r3, #0 - bne 1b -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, ip, c7, c10, 5 /* data memory barrier */ -#endif - RET -END(_atomic_swap_16) - -ATOMIC_OP_ALIAS(atomic_swap_16,_atomic_swap_16) -ATOMIC_OP_ALIAS(atomic_swap_short,_atomic_swap_16) -ATOMIC_OP_ALIAS(atomic_swap_ushort,_atomic_swap_16) -CRT_ALIAS(__sync_lock_test_and_set_2,_atomic_swap_16) -CRT_ALIAS(__atomic_exchange_2,_atomic_swap_16) -STRONG_ALIAS(_atomic_swap_short,_atomic_swap_16) -STRONG_ALIAS(_atomic_swap_ushort,_atomic_swap_16) - -#if (!defined(_KERNEL) || !defined(_RUMPKERNEL)) && !defined(_STANDALONE) -ENTRY_NP(__sync_lock_release_2) - mov r1, #0 - strh r1, [r0] - RET -END(__sync_lock_release_2) -#endif -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_swap_64.S b/common/lib/libc/arch/arm/atomic/atomic_swap_64.S deleted file mode 100644 index a4b6e7cfd..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_swap_64.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_swap_64.S,v 1.10 2015/05/17 20:57:11 justin Exp $ */ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_64) - push {r3,r4} /* save temporary */ - mov ip, r0 /* return value will be in r0 */ -#ifndef __ARM_EABI__ - mov r3, r2 /* r2 will be overwriten by r1 */ - mov r2, r1 /* and r1 will be overwritten by ldrexd */ -#endif -1: ldrexd r0, r1, [ip] /* load old value */ - strexd r4, r2, r3, [ip] /* store new value */ - cmp r4, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ -#endif - pop {r3,r4} /* restore temporary */ - RET -END(_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64) -CRT_ALIAS(__sync_lock_test_and_set_8,_atomic_swap_64) -CRT_ALIAS(__atomic_exchange_8,_atomic_swap_64) - -#if (!defined(_KERNEL) || !defined(_RUMPKERNEL)) && !defined(_STANDALONE) -ENTRY_NP(__sync_lock_release_8) - mov r2, #0 - mov r3, #0 - strd r2, r3, [r0] - RET -END(__sync_lock_release_8) -#endif diff --git a/common/lib/libc/arch/arm/atomic/atomic_xor_16.S b/common/lib/libc/arch/arm/atomic/atomic_xor_16.S deleted file mode 100644 index 8de7f7cb2..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_xor_16.S +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: atomic_xor_16.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_xor_16) - mov ip, r0 -1: ldrexh r0, [ip] /* load old value (to be returned) */ - eors r3, r0, r1 /* calculate new value */ - strexh r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_xor_16) - -ATOMIC_OP_ALIAS(atomic_xor_16,_atomic_xor_16) -ATOMIC_OP_ALIAS(atomic_xor_ushort,_atomic_xor_16) -CRT_ALIAS(__sync_fetch_and_xor_2,_atomic_xor_16) -CRT_ALIAS(__atomic_fetch_xor_2,_atomic_xor_16) -STRONG_ALIAS(_atomic_xor_ushort,_atomic_xor_16) - -ENTRY_NP(_atomic_xor_16_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexh r0, [ip] /* load old value */ - eors r0, r0, r1 /* calculate new value (return value) */ - strexh r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_xor_16_nv) - -ATOMIC_OP_ALIAS(atomic_xor_16_nv,_atomic_xor_16_nv) -ATOMIC_OP_ALIAS(atomic_xor_ushort_nv,_atomic_xor_16_nv) -CRT_ALIAS(__sync_xor_and_fetch_2,_atomic_xor_16_nv) -STRONG_ALIAS(_atomic_xor_ushort_nv,_atomic_xor_16_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_xor_32.S b/common/lib/libc/arch/arm/atomic/atomic_xor_32.S deleted file mode 100644 index c79137a37..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_xor_32.S +++ /dev/null @@ -1,80 +0,0 @@ -/* $NetBSD: atomic_xor_32.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_xor_32) - mov ip, r0 -1: ldrex r0, [ip] /* load old value (to be returned) */ - eors r3, r0, r1 /* calculate new value */ - strex r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_xor_32) - -ATOMIC_OP_ALIAS(atomic_xor_32,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_uint,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_ulong,_atomic_xor_32) -CRT_ALIAS(__sync_fetch_and_xor_4,_atomic_xor_32) -CRT_ALIAS(__atomic_fetch_xor_4,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_uint,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_ulong,_atomic_xor_32) - -ENTRY_NP(_atomic_xor_32_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrex r0, [ip] /* load old value */ - eors r0, r0, r1 /* calculate new value (return value) */ - strex r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_xor_32_nv) - -ATOMIC_OP_ALIAS(atomic_xor_32_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_uint_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_ulong_nv,_atomic_xor_32_nv) -CRT_ALIAS(__sync_xor_and_fetch_4,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_uint_nv,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_ulong_nv,_atomic_xor_32_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_xor_64.S b/common/lib/libc/arch/arm/atomic/atomic_xor_64.S deleted file mode 100644 index 1c28a0e3b..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_xor_64.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_xor_64.S,v 1.3 2014/03/04 16:15:28 matt Exp $ */ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_xor_64_nv) - push {r3,r4} /* save temporary */ -#ifndef __ARM_EABI__ - mov r3, r2 - mov r2, r1 -#endif - mov ip, r0 /* need r0 for return value */ -1: ldrexd r0, r1, [ip] /* load old value */ - eors r0, r0, r2 /* calculate new value (return value) */ - eors r1, r1, r3 /* calculate new value (return value) */ - strexd r4, r0, r1, [ip] /* try to store */ - cmp r4, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r4, c7, c10, 5 /* data memory barrier */ -#endif - pop {r3,r4} /* restore temporary */ - RET /* return new value */ -END(_atomic_xor_64_nv) - -STRONG_ALIAS(_atomic_xor_64,_atomic_xor_64_nv) -ATOMIC_OP_ALIAS(atomic_xor_64_nv,_atomic_xor_64_nv) -ATOMIC_OP_ALIAS(atomic_xor_64,_atomic_xor_64) -CRT_ALIAS(__sync_xor_and_fetch_8,_atomic_xor_64) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/atomic_xor_8.S b/common/lib/libc/arch/arm/atomic/atomic_xor_8.S deleted file mode 100644 index 42e405d4e..000000000 --- a/common/lib/libc/arch/arm/atomic/atomic_xor_8.S +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: atomic_xor_8.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_atomic_xor_8) - mov ip, r0 -1: ldrexb r0, [ip] /* load old value (to be returned) */ - eors r3, r0, r1 /* calculate new value */ - strexb r2, r3, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return old value */ -END(_atomic_xor_8) - -ATOMIC_OP_ALIAS(atomic_xor_8,_atomic_xor_8) -ATOMIC_OP_ALIAS(atomic_xor_uchar,_atomic_xor_8) -CRT_ALIAS(__sync_fetch_and_xor_1,_atomic_xor_8) -CRT_ALIAS(__atomic_fetch_xor_1,_atomic_xor_8) -STRONG_ALIAS(_atomic_xor_uchar,_atomic_xor_8) - -ENTRY_NP(_atomic_xor_8_nv) - mov ip, r0 /* need r0 for return value */ -1: ldrexb r0, [ip] /* load old value */ - eors r0, r0, r1 /* calculate new value (return value) */ - strexb r2, r0, [ip] /* try to store */ - cmp r2, #0 /* succeed? */ - bne 1b /* no, try again? */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - RET /* return new value */ -END(_atomic_xor_8_nv) - -ATOMIC_OP_ALIAS(atomic_xor_8_nv,_atomic_xor_8_nv) -ATOMIC_OP_ALIAS(atomic_xor_uchar_nv,_atomic_xor_8_nv) -CRT_ALIAS(__sync_xor_and_fetch_1,_atomic_xor_8_nv) -STRONG_ALIAS(_atomic_xor_uchar_nv,_atomic_xor_8_nv) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/membar_ops.S b/common/lib/libc/arch/arm/atomic/membar_ops.S deleted file mode 100644 index 6b3695975..000000000 --- a/common/lib/libc/arch/arm/atomic/membar_ops.S +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.6 2014/03/28 21:32:41 skrll Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#ifdef _ARM_ARCH_6 - -ENTRY_NP(_membar_producer) -#ifdef _ARM_ARCH_7 - dsb -#else - mov r0, #0 - mcr p15, 0, r0, c7, c10, 4 /* Data Synchronization Barrier */ -#endif - RET -END(_membar_producer) -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) -ATOMIC_OP_ALIAS(membar_write,_membar_producer) -STRONG_ALIAS(_membar_write,_membar_producer) - -ENTRY_NP(_membar_sync) -#ifdef _ARM_ARCH_7 - dmb -#else - mov r0, #0 - mcr p15, 0, r0, c7, c10, 5 /* Data Memory Barrier */ -#endif - RET -END(_membar_sync) -ATOMIC_OP_ALIAS(membar_sync,_membar_sync) -ATOMIC_OP_ALIAS(membar_enter,_membar_sync) -ATOMIC_OP_ALIAS(membar_exit,_membar_sync) -ATOMIC_OP_ALIAS(membar_consumer,_membar_sync) -ATOMIC_OP_ALIAS(membar_read,_membar_sync) -CRT_ALIAS(__sync_synchronize,_membar_sync) -STRONG_ALIAS(_membar_enter,_membar_sync) -STRONG_ALIAS(_membar_exit,_membar_sync) -STRONG_ALIAS(_membar_consumer,_membar_sync) -STRONG_ALIAS(_membar_read,_membar_sync) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_1.S b/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_1.S deleted file mode 100644 index e67217e51..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_1.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: sync_bool_compare_and_swap_1.S,v 1.3 2015/05/17 22:08:24 justin Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) -/* - * ARMv6 has load-exclusive/store-exclusive which works for both user - * and kernel. - */ -ENTRY_NP(__sync_bool_compare_and_swap_1) - mov ip, r0 /* we need r0 for return value */ - mov r0, #0 /* assume no match */ -1: - ldrexb r3, [ip] /* load old value */ - cmp r3, r1 /* compare? */ -#ifdef __thumb__ - bne 2f -#else - RETc(ne) /* return if different */ -#endif - strexb r0, r2, [ip] /* store new value */ - cmp r0, #0 /* succeed? */ - bne 1b /* nope, try again. */ - mov r0, #1 /* it was a success */ -#ifdef _ARM_ARCH_7 - dsb /* data synchronization barrier */ -#else - mcr p15, 0, r3, c7, c10, 4 /* data synchronization barrier */ -#endif -2: RET /* return. */ -END(__sync_bool_compare_and_swap_1) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_2.S b/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_2.S deleted file mode 100644 index c70855d2d..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_2.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: sync_bool_compare_and_swap_2.S,v 1.3 2015/05/17 22:08:24 justin Exp $ */ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) -/* - * ARMv6 has load-exclusive/store-exclusive which works for both user - * and kernel. - */ -ENTRY_NP(__sync_bool_compare_and_swap_2) - mov ip, r0 /* we need r0 for return value */ - movs r0, #0 /* assume failure */ -1: - ldrexh r3, [ip] /* load old value */ - cmp r3, r1 /* compare? */ -#ifdef __thumb__ - bne 2f -#else - RETc(ne) /* return if different */ -#endif - strexh r0, r2, [ip] /* store new value */ - cmp r0, #0 /* succeed? */ - bne 1b /* nope, try again. */ - movs r0, #1 /* indicate success */ -#ifdef _ARM_ARCH_7 - dsb /* data synchronization barrier */ -#else - mcr p15, 0, r3, c7, c10, 4 /* data synchronization barrier */ -#endif -2: RET /* return. */ -END(__sync_bool_compare_and_swap_2) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_4.S b/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_4.S deleted file mode 100644 index 321679be6..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_4.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: sync_bool_compare_and_swap_4.S,v 1.3 2015/05/17 22:08:24 justin Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) -/* - * ARMv6 has load-exclusive/store-exclusive which works for both user - * and kernel. - */ -ENTRY_NP(__sync_bool_compare_and_swap_4) - mov ip, r0 /* we need r0 for return value */ - movs r0, #0 /* assume failure */ -1: - ldrex r3, [ip] /* load old value */ - cmp r3, r1 /* compare? */ -#ifdef __thumb__ - bne 2f /* return if different */ -#else - RETc(ne) /* return if different */ -#endif - strex r0, r2, [ip] /* store new value */ - cmp r0, #0 /* succeed? */ - bne 1b /* nope, try again. */ - movs r0, #1 /* indicate success */ -#ifdef _ARM_ARCH_7 - dsb -#else - mcr p15, 0, r3, c7, c10, 4 /* data synchronization barrier */ -#endif -2: RET /* return. */ -END(__sync_bool_compare_and_swap_4) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_8.S b/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_8.S deleted file mode 100644 index 8d5ab1fe3..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_bool_compare_and_swap_8.S +++ /dev/null @@ -1,73 +0,0 @@ -/* $NetBSD: sync_bool_compare_and_swap_8.S,v 1.4 2015/05/17 22:08:24 justin Exp $ */ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) -/* - * ARMv6 has load-exclusive/store-exclusive which works for both user - * and kernel. - */ -ENTRY_NP(__sync_bool_compare_and_swap_8) - push {r4-r7} /* save temporaries */ - mov ip, r0 /* we need r0 for return value */ - movs r0, #0 /* assume failure */ -#ifdef __ARM_EABI__ - ldrd r4, r5, [sp] /* fetch new value from stack */ -#else - ldr r4, [sp, #0] /* fetch new value from stack */ - ldr r5, [sp, #4] /* fetch new value from stack */ - mov r3, r2 /* r2 will be overwritten by r1 which ... */ - mov r2, r1 /* r1 will be overwritten by ldrexd */ -#endif -1: - ldrexd r6, r7, [ip] /* load current value */ - cmp r6, r2 /* compare to old? 1st half */ -#ifdef __thumb__ - bne 2f /* jump to return if different */ - cmp r7, r3 /* compare to old? 2nd half */ -#else - cmpeq r7, r3 /* compare to old? 2nd half */ -#endif - bne 2f /* jump to return if different */ - strexd r0, r4, r5, [ip] /* store new value */ - cmp r0, #0 /* succeed? */ - bne 1b /* nope, try again. */ - movs r0, #1 /* indicate success */ -#ifdef _ARM_ARCH_7 - dsb -#else - mcr p15, 0, ip, c7, c10, 4 /* data synchronization barrier */ -#endif -2: pop {r4-r7} /* restore temporaries */ - RET /* return. */ -END(__sync_bool_compare_and_swap_8) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_fetch_and_add_8.S b/common/lib/libc/arch/arm/atomic/sync_fetch_and_add_8.S deleted file mode 100644 index 9dcd894e6..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_fetch_and_add_8.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: sync_fetch_and_add_8.S,v 1.5 2015/05/17 22:08:24 justin Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) - -ENTRY_NP(__sync_fetch_and_add_8) - push {r4-r7} - mov ip, r0 -#ifndef __ARM__EABI__ - mov r3, r2 - mov r2, r1 -#endif -1: ldrexd r0, r1, [ip] /* load old value */ - adds TLO, LO, NLO /* calculate new value */ - adcs THI, HI, NHI /* calculate new value */ - strexd r6, r4, r5, [ip] /* try to store */ - cmp r6, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - pop {r4-r7} - RET /* return old value */ -END(__sync_fetch_and_add_8) - -CRT_ALIAS(__atomic_fetch_add_8,__sync_fetch_and_add_8) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_fetch_and_and_8.S b/common/lib/libc/arch/arm/atomic/sync_fetch_and_and_8.S deleted file mode 100644 index cc461a930..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_fetch_and_and_8.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: sync_fetch_and_and_8.S,v 1.5 2015/05/17 22:08:24 justin Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) - -ENTRY_NP(__sync_fetch_and_and_8) - push {r4-r7} - mov ip, r0 -#ifndef __ARM__EABI__ - mov r3, r2 - mov r2, r1 -#endif -1: ldrexd r0, r1, [ip] /* load old value */ - ands r4, r0, r2 /* calculate new value */ - ands r5, r1, r3 /* calculate new value */ - strexd r6, r4, r5, [ip] /* try to store */ - cmp r6, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - pop {r4-r7} - RET /* return old value */ -END(__sync_fetch_and_and_8) - -CRT_ALIAS(__atomic_fetch_and_8,__sync_fetch_and_and_8) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_fetch_and_nand_8.S b/common/lib/libc/arch/arm/atomic/sync_fetch_and_nand_8.S deleted file mode 100644 index a5bdb89b8..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_fetch_and_nand_8.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: sync_fetch_and_nand_8.S,v 1.4 2015/05/17 22:08:24 justin Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) - -ENTRY_NP(__sync_fetch_and_nand_8) - push {r4-r7} - mov ip, r0 -#ifndef __ARM__EABI__ - mov r3, r2 - mov r2, r1 -#endif -1: ldrexd r0, r1, [ip] /* load old value */ - mvns r4, r0 /* complement old value */ - mvns r5, r0 /* complement old value */ - ands r4, r4, r2 /* calculate new value */ - ands r5, r5, r3 /* calculate new value */ - strexd r6, r4, r5, [ip] /* try to store */ - cmp r6, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - pop {r4-r7} - RET /* return old value */ -END(__sync_fetch_and_nand_8) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_fetch_and_or_8.S b/common/lib/libc/arch/arm/atomic/sync_fetch_and_or_8.S deleted file mode 100644 index 9c642063c..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_fetch_and_or_8.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: sync_fetch_and_or_8.S,v 1.5 2015/05/17 22:08:24 justin Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) - -ENTRY_NP(__sync_fetch_and_or_8) - push {r4-r7} - mov ip, r0 -#ifndef __ARM__EABI__ - mov r3, r2 - mov r2, r1 -#endif -1: ldrexd r0, r1, [ip] /* load old value */ - orrs r4, r0, r2 /* calculate new value */ - orrs r5, r1, r3 /* calculate new value */ - strexd r6, r4, r5, [ip] /* try to store */ - cmp r6, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - pop {r4-r7} - RET /* return old value */ -END(__sync_fetch_and_or_8) - -CRT_ALIAS(__atomic_fetch_or_8,__sync_fetch_and_or_8) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_fetch_and_sub_8.S b/common/lib/libc/arch/arm/atomic/sync_fetch_and_sub_8.S deleted file mode 100644 index 5a9c1e17f..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_fetch_and_sub_8.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: sync_fetch_and_sub_8.S,v 1.5 2015/05/17 22:08:24 justin Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) - -ENTRY_NP(__sync_fetch_and_sub_8) - push {r4-r7} - mov ip, r0 -#ifndef __ARM__EABI__ - mov r3, r2 - mov r2, r1 -#endif -1: ldrexd r0, r1, [ip] /* load old value */ - subs TLO, LO, NLO /* calculate new value */ - sbcs THI, HI, NHI /* calculate new value */ - strexd r6, r4, r5, [ip] /* try to store */ - cmp r6, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - pop {r4-r7} - RET /* return old value */ -END(__sync_fetch_and_sub_8) - -CRT_ALIAS(__atomic_fetch_sub_8,__sync_fetch_and_sub_8) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/atomic/sync_fetch_and_xor_8.S b/common/lib/libc/arch/arm/atomic/sync_fetch_and_xor_8.S deleted file mode 100644 index 085902d23..000000000 --- a/common/lib/libc/arch/arm/atomic/sync_fetch_and_xor_8.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: sync_fetch_and_xor_8.S,v 1.5 2015/05/17 22:08:24 justin Exp $ */ - -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -#if defined(_ARM_ARCH_6) - -ENTRY_NP(__sync_fetch_and_xor_8) - push {r4-r7} - mov ip, r0 -#ifndef __ARM__EABI__ - mov r3, r2 - mov r2, r1 -#endif -1: ldrexd r0, r1, [ip] /* load old value */ - eors r4, r0, r2 /* calculate new value */ - eors r5, r1, r3 /* calculate new value */ - strexd r6, r4, r5, [ip] /* try to store */ - cmp r6, #0 /* succeed? */ - bne 1b /* no, try again */ -#ifdef _ARM_ARCH_7 - dmb -#else - mcr p15, 0, r2, c7, c10, 5 /* data memory barrier */ -#endif - pop {r4-r7} - RET /* return old value */ -END(__sync_fetch_and_xor_8) - -CRT_ALIAS(__atomic_fetch_xor_8,__sync_fetch_and_xor_8) - -#endif /* _ARM_ARCH_6 */ diff --git a/common/lib/libc/arch/arm/features.c b/common/lib/libc/arch/arm/features.c deleted file mode 100644 index 1271acda8..000000000 --- a/common/lib/libc/arch/arm/features.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $NetBSD: features.c,v 1.1 2014/02/27 09:37:02 matt Exp $ */ -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * This file is used to have the compiler check for feature and then - * have make set a variable based on that test. - * - * FEAT_EABI!=if ${COMPILE.c} -fsyntax-only -DEABI_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi - * FEAT_LDREX!=if ${COMPILE.c} -fsyntax-only -DLDREX_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi - * FEAT_LDRD!=if ${COMPILE.c} -fsyntax-only -DLDRD_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi - * FEAT_THUMB2!=if ${COMPILE.c} -fsyntax-only -DTHUMB2_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi - */ - -#if defined (__ARM_ARCH_8A__) || defined (__ARM_ARCH_7__) || \ - defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__) || \ - defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__) || \ - defined (__ARM_ARCH_6T2__) -#define HAVE_THUMB2 -#endif - -#if defined (HAVE_THUMB2) || defined (__ARM_ARCH_6__) || \ - defined (__ARM_ARCH_6J__) || defined (__ARM_ARCH_6K__) || \ - defined (__ARM_ARCH_6Z__) || defined (__ARM_ARCH_6ZK__) || \ - defined (__ARM_ARCH_6ZM__) -#define HAVE_LDREX -#endif - -#if defined (HAVE_LDREX) || defined(__ARM_ARCH_5TE__) || \ - defined (__ARM_ARCH_5TEJ__) -#define HAVE_LDRD -#endif - -#if defined(THUMB2_TEST) && !defined(HAVE_THUMB2) -#error no thumb2 -#endif - -#if defined(LDREX_TEST) && !defined(HAVE_LDREX) -#error no ldrex -#endif - -#if defined(LDRD_TEST) && !defined(HAVE_LDRD) -#error no ldrd -#endif - -#if defined(EABI_TEST) && !defined(__ARM_EABI__) -#error not eabi -#endif diff --git a/common/lib/libc/arch/arm/features.mk b/common/lib/libc/arch/arm/features.mk deleted file mode 100644 index a1e1ad3a8..000000000 --- a/common/lib/libc/arch/arm/features.mk +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: features.mk,v 1.2 2015/06/07 15:05:34 matt Exp $ - -.ifnmake obj -TESTFILE=${NETBSDSRCDIR}/common/lib/libc/arch/arm/features.c -FEAT_EABI!=if ${COMPILE.c} ${COPTS} -fsyntax-only -DEABI_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi -FEAT_LDREX!=if ${COMPILE.c} ${COPTS} -fsyntax-only -DLDREX_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi -FEAT_LDRD!=if ${COMPILE.c} ${COPTS} -fsyntax-only -DLDRD_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi -FEAT_THUMB2!=if ${COMPILE.c} ${COPTS} -fsyntax-only -DTHUMB2_TEST ${TESTFILE} >/dev/null 2>/dev/null; then echo yes; else echo no; fi -.endif diff --git a/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c b/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c deleted file mode 100644 index ecd42b26f..000000000 --- a/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -__RCSID("$NetBSD: __aeabi_idiv0.c,v 1.3 2014/01/29 22:29:43 joerg Exp $"); - -#if defined(_KERNEL) || defined(_STANDALONE) -#include -#else -#include -#include -#include -#include -#include -#endif - -#include - -int -__aeabi_idiv0(int result) -{ -#if defined(_KERNEL) || defined(_STANDALONE) - panic("divide by 0"); -#else -#if !defined(__minix) /* LSC: No sigqueueinfo on Minix. */ - siginfo_t info; - - memset(&info, 0, sizeof info); - info.si_signo = SIGFPE; - info.si_pid = getpid(); - info.si_uid = geteuid(); - info.si_code = FPE_INTDIV; - sigqueueinfo(getpid(), &info); -#else - /* LSC: So just trigger the signal. */ - raise(SIGFPE); -#endif /* !defined(__minix) */ -#endif - return result; -} diff --git a/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c b/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c deleted file mode 100644 index a91bfa4c5..000000000 --- a/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c +++ /dev/null @@ -1,67 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -__RCSID("$NetBSD: __aeabi_ldiv0.c,v 1.3 2014/01/29 22:29:43 joerg Exp $"); - -#if defined(_KERNEL) || defined(_STANDALONE) -#include -#else -#include -#include -#include -#include -#include -#endif - -#include - -long long -__aeabi_ldiv0(long long result) -{ -#if defined(_KERNEL) || defined(_STANDALONE) - panic("divide by 0"); -#else -#if !defined(__minix) /* LSC: No sigqueueinfo on Minix. */ - siginfo_t info; - - memset(&info, 0, sizeof info); - info.si_signo = SIGFPE; - info.si_pid = getpid(); - info.si_uid = geteuid(); - info.si_code = FPE_INTDIV; - sigqueueinfo(getpid(), &info); -#else - /* LSC: So just trigger the signal. */ - raise(SIGFPE); -#endif /* !defined(__minix) */ -#endif - return result; -} diff --git a/common/lib/libc/arch/arm/gen/byte_swap_2.S b/common/lib/libc/arch/arm/gen/byte_swap_2.S deleted file mode 100644 index 5a816f583..000000000 --- a/common/lib/libc/arch/arm/gen/byte_swap_2.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.6 2013/08/19 03:44:18 matt Exp $ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Charles M. Hannum. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define FUNC _C_LABEL(bswap16) -#else -#define FUNC _C_LABEL(__bswap16) -#endif - -ENTRY(FUNC) -#ifdef _ARM_ARCH_6 - rev16 r0, r0 -#elif !defined(__thumb__) - and r1, r0, #0xff - mov r0, r0, lsr #8 - orr r0, r0, r1, lsl #8 -#else - movs r2, #0xff - movs r1, r0 - ands r1, r1, r2 - lsls r1, r1, #8 - lsrs r0, r0, #8 - ands r0, r0, r2 - orrs r0, r0, r1 -#endif - RET -END(FUNC) -#if BYTE_ORDER == LITTLE_ENDIAN -STRONG_ALIAS(_C_LABEL(ntohs), FUNC) -STRONG_ALIAS(_C_LABEL(htons), FUNC) -#endif diff --git a/common/lib/libc/arch/arm/gen/byte_swap_4.S b/common/lib/libc/arch/arm/gen/byte_swap_4.S deleted file mode 100644 index a898f9772..000000000 --- a/common/lib/libc/arch/arm/gen/byte_swap_4.S +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.7 2013/08/19 03:44:47 matt Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Neil A. Carson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define FUNC _C_LABEL(bswap32) -#else -#define FUNC _C_LABEL(__bswap32) -#endif -ENTRY(FUNC) -#ifdef _ARM_ARCH_6 - rev r0, r0 -#elif !defined(__thumb__) - eor r1, r0, r0, ror #16 /* 4.3.2.1 -> 42.31.42.31 */ - bic r1, r1, #0x00FF0000 /* 42.31.42.31 -> 42.0.42.31 */ - mov r0, r0, ror #8 /* 4.3.2.1 -> 1.4.3.2 */ - eor r0, r0, r1, lsr #8 /* 1.4.3.2 ^ 0.42.0.42 -> 1.2.3.4 */ -#else - movs r3, #16 - lsls r1, r0, #8 /* 4.3.2.1 -> 3.2.1.0 /* - lsrs r0, r0, #8 /* 4.3.2.1 -> 0.4.3.2 */ - rors r1, r3 /* 3.2.1.0 -> 1.0.3.2 */ - rors r0, r3 /* 0.4.3.2 -> 3.2.0.4 */ - lsrs r1, r1, #8 /* 1.0.3.2 -> 0.1.0.3 */ - lsls r1, r1, #8 /* 0.1.0.3 -> 1.0.3.0 */ - lsls r0, r0, #8 /* 3.2.0.4 -> 2.0.4.0 */ - lsrs r0, r0, #8 /* 2.0.4.0 -> 0.2.0.4 */ - orrs r0, r0, r1 /* 1.0.3.0 | 0.2.0.4 -> 1.2.3.4 */ -#endif - RET -END(FUNC) - -#if BYTE_ORDER == LITTLE_ENDIAN -STRONG_ALIAS(_C_LABEL(ntohl), FUNC) -STRONG_ALIAS(_C_LABEL(htonl), FUNC) -#endif diff --git a/common/lib/libc/arch/arm/gen/neon_mask.S b/common/lib/libc/arch/arm/gen/neon_mask.S deleted file mode 100644 index 07ac56024..000000000 --- a/common/lib/libc/arch/arm/gen/neon_mask.S +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#ifdef _ARM_ARCH_7 - -RCSID("$NetBSD: neon_mask.S,v 1.2 2012/12/18 06:14:23 matt Exp $") - -/* - * __neon_loading_qword_bitmask(size_t len); - * IN r0 = length of mask in bits - * OUT q0 = mask - */ -ENTRY(__neon_leading_qword_bitmask) - cmp r0, #64 /* which dword is partial? */ -#ifdef __ARMEL__ - sublt r0, r0, #64 /* 1st dword needs MSBs cleared */ - subge r1, r0, #128 /* 2nd dword needs MSBs cleared */ -#else - rsblt r0, r0, #64 /* 1st dword needs LSBs cleared */ - rsbge r1, r0, #128 /* 2nd dword needs LSBs cleared */ -#endif - movge r0, #0 /* 1st dword needs to left alone */ - movlt r1, #64 /* 2st dword needs to be cleared */ - vmov d2, r0, r1 /* move dword shifts to SIMD */ - vmovl.u32 q1, d2 /* 2 U32 -> 2 U64 */ - vmvn.u64 q0, #0 /* create a mask */ - vshl.u64 q0, q0, q1 /* shift out unneeded bytes */ - RET -END(__neon_leading_qword_bitmask) - -#endif /* _ARM_ARCH_7 */ diff --git a/common/lib/libc/arch/arm/quad/__aeabi_lcmp.c b/common/lib/libc/arch/arm/quad/__aeabi_lcmp.c deleted file mode 100644 index fbbd836f5..000000000 --- a/common/lib/libc/arch/arm/quad/__aeabi_lcmp.c +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include - -__RCSID("$NetBSD: __aeabi_lcmp.c,v 1.2 2012/08/06 02:15:51 matt Exp $"); - -#include "quad.h" -#include - -/* - * Return -1, 0, 1 (like strcmp) if a [<, =, >] b - */ -int -__aeabi_lcmp(long long a, long long b) -{ - const union uu aa = { .q = a }, bb = { .q = b }; - - if (aa.sl[H] < bb.sl[H]) - return -1; - if (aa.sl[H] > bb.sl[H]) - return 1; - - if (aa.sl[L] < bb.sl[L]) - return -1; - if (aa.sl[L] > bb.sl[L]) - return 1; - - return 0; -} diff --git a/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S b/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S deleted file mode 100644 index 5be933349..000000000 --- a/common/lib/libc/arch/arm/quad/__aeabi_ldivmod.S +++ /dev/null @@ -1,255 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: __aeabi_ldivmod.S,v 1.13 2014/05/06 16:02:11 joerg Exp $") - -#ifdef __ARMEB__ -#define ALO r1 /* incoming numerator, outgoing quotient */ -#define AHI r0 /* incoming numerator, outgoing quotient */ -#define BLO r3 /* incoming denominator, outgoing remainder */ -#define BHI r2 /* incoming denominator, outgoing remainder */ -#else -#define ALO r0 /* incoming numerator, outgoing quotient */ -#define AHI r1 /* incoming numerator, outgoing quotient */ -#define BLO r2 /* incoming denominator, outgoing remainder */ -#define BHI r3 /* incoming denominator, outgoing remainder */ -#endif - -ENTRY(__aeabi_ldivmod) -#ifdef __ARM_EABI__ -# if !defined(__ARM_DWARF_EH__) - .fnstart -# endif - .cfi_startproc -#endif -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if !defined(__thumb__) - orrs ip, BLO, BHI - beq .Ldivbyzero -#elif defined(_ARM_ARCH_T2) - cbnz BLO, 1f - cbz BHI, .Ldivbyzero -#else - cmp BLO, #0 - bne 1f - cmp BHI, #0 - beq .Ldivbyzero -#endif -1: -#endif - - push {r4-r6, lr} -#ifdef __ARM_EABI__ - .cfi_def_cfa_offset 16 - .cfi_offset 14, -4 - .cfi_offset 6, -8 - .cfi_offset 5, -12 - .cfi_offset 4, -16 -#endif -#define NEG r5 - movs NEG, #0 - - cmp BHI, #0 - bge 2f - movs NEG, #1 /* flip quotient sign */ - bl .Lnegate_b - bcs .Lmaxdenom - -2: - cmp AHI, #0 -#ifdef __thumb__ - bge 3f - movs r4, #3 - eors NEG, NEG, r4 /* flip quotient sign, flip remainder sign */ - bl .Lnegate_a -3: -#else - eorlt NEG, NEG, #3 /* flip quotient sign, flip remainder sign */ - bllt .Lnegate_a -#endif - - /* - * Arguments are setup, allocate some stack for the remainder - * and call __qdivrem for the heavy lifting. - */ -#ifdef __ARM_EABI__ - .cfi_def_cfa_offset 32 -#endif - sub sp, sp, #16 -#if !defined(__thumb__) || defined(_ARM_ARCH_T2) - adds r4, sp, #8 -#else - mov r4, sp - adds r4, r4, #8 -#endif - str r4, [sp] - bl PLT_SYM(__qdivrem) - add sp, sp, #8 -#ifdef __ARM_EABI__ - .cfi_def_cfa_offset 24 - .cfi_offset 3, -20 - .cfi_offset 2, -24 -#endif - - /* - * The quotient is already in the right place and neither value - * needs its sign flipped. - */ -#if defined(__thumb__) && defined(_ARM_ARCH_T2) - cbz NEG, .Lnegate_neither -#else - cmp NEG, #0 /* any signs to flip? */ - beq .Lnegate_neither -#endif - - cmp NEG, #2 /* does remainder need to be negative? */ - beq .Lnegate_b_only /* 2 means b only */ - bgt .Lnegate_both /* 3 means both */ -.Lnegate_a_only: - bl .Lnegate_a /* 1 means a only */ -.Lnegate_neither: - pop {r2-r6, pc} /* grab b from stack */ -.Lnegate_both: - bl .Lnegate_a -.Lnegate_b_only: - pop {r2-r3} /* get remainder */ -#ifdef __ARM_EABI__ - .cfi_def_cfa_offset 16 -#endif - bl .Lnegate_b /* negate it */ - pop {r4-r6, pc} - - .align 0 -.Lnegate_a: -#ifdef __thumb__ - movs r4, AHI - movs AHI, #0 - negs ALO, ALO - sbcs AHI, AHI, r4 -#else - negs ALO, ALO - rsc AHI, AHI, #0 -#endif - RET - - .align 0 -.Lnegate_b: -#ifdef __thumb__ - movs r4, BHI - movs BHI, #0 - negs BLO, BLO - sbcs BHI, BHI, r4 -#else - negs BLO, BLO - rsc BHI, BHI, #0 -#endif - RET - - .align 0 -.Lmaxdenom: - /* - * We had a carry so the denominator must have INT64_MIN - * Also BLO and BHI never changed values so we can use - * them to see if the numerator has the same value. We - * don't have to worry about sign. - */ - cmp BHI, AHI -#ifdef __thumb__ - bne 1f - cmp BLO, ALO -#else - cmpeq BLO, ALO -#endif - bne 1f - - /* - * They were equal, so we return a quotient of 1 and remainder of 0. - */ - movs ALO, #1 - movs AHI, #0 - movs BLO, #0 - movs BHI, #0 - pop {r4-r6, pc} - - /* - * Our remainder must be the numerator and our quotient is 0. - */ - .align 0 -1: movs BLO, ALO - movs BHI, AHI - movs ALO, #0 - movs AHI, #0 - pop {r4-r6, pc} - -#if !defined(_KERNEL) && !defined(_STANDALONE) - .align 0 -.Ldivbyzero: - push {r0-r1,r4,lr} -#ifdef __ARM_EABI__ -# if !defined(__ARM_DWARF_EH__) - .save {r0-r1,r4,lr} -# endif - .cfi_def_cfa_offset 16 - .cfi_offset 14, -4 - .cfi_offset 4, -8 -#endif - cmp AHI, #0 -#if !defined(__thumb__) || defined(_ARM_ARCH_T2) -#ifdef __thumb__ - ittee ge -#endif - mvnge ALO, #0 - mvnge AHI, #0x80000000 - movlt ALO, #0 - movlt AHI, #0x80000000 -#else - blt 1f - movs ALO, #0 - mvns ALO, ALO - mov AHI, ALO - lsrs AHI, AHI, #1 - b 2f -1: - movs ALO, #0 - movs AHI, #1 - lsls AHI, AHI, #31 -2: -#endif /* __thumb__ && !_ARM_ARCH_T2 */ - bl PLT_SYM(__aeabi_ldiv0) - pop {r2-r4, pc} -#endif /* !_KERNEL && !_STANDALONE */ -#ifdef __ARM_EABI__ - .cfi_endproc -# if !defined(__ARM_DWARF_EH__) - .fnend -# endif -#endif -END(__aeabi_ldivmod) diff --git a/common/lib/libc/arch/arm/quad/__aeabi_ulcmp.c b/common/lib/libc/arch/arm/quad/__aeabi_ulcmp.c deleted file mode 100644 index 1bcf17173..000000000 --- a/common/lib/libc/arch/arm/quad/__aeabi_ulcmp.c +++ /dev/null @@ -1,55 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include - -__RCSID("$NetBSD: __aeabi_ulcmp.c,v 1.2 2012/08/06 02:15:51 matt Exp $"); - -#include "quad.h" -#include - -/* - * Return -1, 0, 1 (like strcmp) if a [<, =, >] b - */ -int -__aeabi_ulcmp(unsigned long long a, unsigned long long b) -{ - const union uu aa = { .uq = a }, bb = { .uq = b }; - - if (aa.ul[H] < bb.ul[H]) - return -1; - if (aa.ul[H] > bb.ul[H]) - return 1; - - if (aa.ul[L] < bb.ul[L]) - return -1; - if (aa.ul[L] > bb.ul[L]) - return 1; - - return 0; -} diff --git a/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S b/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S deleted file mode 100644 index 5c09893e6..000000000 --- a/common/lib/libc/arch/arm/quad/__aeabi_uldivmod.S +++ /dev/null @@ -1,124 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: __aeabi_uldivmod.S,v 1.9 2014/05/06 16:02:11 joerg Exp $") - -/* - * typedef struct { unsigned long long quo, rem } ulldiv_t; - * __value_in_regs ulldiv_t __aeabi_uldivmod(unsigned long long n, - * unsigned long long d); - */ - -ENTRY(__aeabi_uldivmod) -#ifdef __ARM_EABI__ -# if !defined(__ARM_DWARF_EH__) - .fnstart -#endif - .cfi_startproc -#endif -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if !defined(__thumb__) - orrs ip, r2, r3 - beq .Ldivbyzero -#elif defined(_ARM_ARCH_T2) - cbnz r2, 1f - cbz r3, .Ldivbyzero -1: -#else - cmp r2, #0 - bne 1f - cmp r3, #0 - beq .Ldivbyzero -1: -#endif -#endif - - push {r4,lr} -#ifdef __ARM_EABI__ -# if !defined(__ARM_DWARF_EH__) - .save {r4,lr} -# endif - .cfi_def_cfa_offset 8 - .cfi_offset 14, -4 - .cfi_offset 4, -8 -#endif - sub sp, sp, #16 -#ifdef __ARM_EABI__ - .cfi_def_cfa_offset 24 -#endif -#if !defined(__thumb__) || defined(_ARM_ARCH_T2) - add r4, sp, #8 -#else - mov r4, sp - adds r4, r4, #8 -#endif - str r4, [sp] - bl PLT_SYM(__qdivrem) - add sp, sp, #8 -#ifdef __ARM_EABI__ - .cfi_def_cfa_offset 16 - .cfi_offset 3, -12 - .cfi_offset 2, -16 -#endif - /* - * The remainder is already on the stack just waiting to be popped - * into r2/r3. - */ - pop {r2-r4,pc} - -#if !defined(_KERNEL) && !defined(_STANDALONE) -.Ldivbyzero: - push {r0-r1,r4,lr} -#ifdef __ARM_EABI__ -# if !defined(__ARM_DWARF_EH__) - .save {r0-r1,r4,lr} -# endif - .cfi_def_cfa_offset 16 - .cfi_offset 14, -4 - .cfi_offset 4, -8 -#endif -#ifdef __thumb__ - movs r0, #0 - mvns r0, r0 -#else - mvn r0, #0 -#endif - movs r1, r0 - bl PLT_SYM(__aeabi_ldiv0) - pop {r2-r4,pc} -#endif -#ifdef __ARM_EABI__ - .cfi_endproc -# if !defined(__ARM_DWARF_EH__) - .fnend -# endif -#endif -END(__aeabi_uldivmod) diff --git a/common/lib/libc/arch/arm/string/ffs.S b/common/lib/libc/arch/arm/string/ffs.S deleted file mode 100644 index 301e2930e..000000000 --- a/common/lib/libc/arch/arm/string/ffs.S +++ /dev/null @@ -1,94 +0,0 @@ -/* $NetBSD: ffs.S,v 1.9 2015/05/17 22:14:38 justin Exp $ */ -/* - * Copyright (c) 2001 Christopher Gilbert - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: ffs.S,v 1.9 2015/05/17 22:14:38 justin Exp $") - -/* - * ffs - find first set bit, this algorithm isolates the first set - * bit, then multiplies the number by 0x0450fbaf which leaves the top - * 6 bits as an index into the table. This algorithm should be a win - * over the checking each bit in turn as per the C compiled version. - * - * On ARMv5 we use CLZ (count leading Zero's) and then subtract the result - * from 32. - * - * This is the ffs algorithm devised by d.seal and posted to comp.sys.arm on - * 16 Feb 1994. - */ -#ifndef _RUMPKERNEL -STRONG_ALIAS(__ffssi2,ffs) -#endif -#if (defined(_ARM_ARCH_5) && !defined(__thumb__)) || defined(_ARM_ARCH_T2) -#if defined(_ARM_ARCH_T2) -ENTRY(ffs) -#else -ARM_ENTRY(ffs) -#endif - /* (X & -X) gives LSB or zero. */ - neg r1, r0 - and r0, r0, r1 - clz r0, r0 - rsb r0, r0, #32 - RET -END(ffs) -#else -ARM_ENTRY(ffs) - /* Standard trick to isolate bottom bit in r0 or 0 if r0 = 0 on entry */ - neg r1, r0 - ands r0, r0, r1 - /* - * now r0 has at most one set bit, call this X - * if X = 0, all further instructions are skipped - */ - adrne r2, .L_ffs_table - orrne r0, r0, r0, lsl #4 /* r0 = X * 0x11 */ - orrne r0, r0, r0, lsl #6 /* r0 = X * 0x451 */ - rsbne r0, r0, r0, lsl #16 /* r0 = X * 0x0450fbaf */ - - /* now lookup in table indexed on top 6 bits of r0 */ - ldrbne r0, [r2, r0, lsr #26] - - RET -.text; -.type .L_ffs_table, _ASM_TYPE_OBJECT; -.L_ffs_table: -/* 0 1 2 3 4 5 6 7 */ - .byte 0, 1, 2, 13, 3, 7, 0, 14 /* 0- 7 */ - .byte 4, 0, 8, 0, 0, 0, 0, 15 /* 8-15 */ - .byte 11, 5, 0, 0, 9, 0, 0, 26 /* 16-23 */ - .byte 0, 0, 0, 0, 0, 22, 28, 16 /* 24-31 */ - .byte 32, 12, 6, 0, 0, 0, 0, 0 /* 32-39 */ - .byte 10, 0, 0, 25, 0, 0, 21, 27 /* 40-47 */ - .byte 31, 0, 0, 0, 0, 24, 0, 20 /* 48-55 */ - .byte 30, 0, 23, 19, 29, 18, 17, 0 /* 56-63 */ -END(ffs) -#endif diff --git a/common/lib/libc/arch/arm/string/memcmp.S b/common/lib/libc/arch/arm/string/memcmp.S deleted file mode 100644 index 4dd2841ab..000000000 --- a/common/lib/libc/arch/arm/string/memcmp.S +++ /dev/null @@ -1,185 +0,0 @@ -/* $NetBSD: memcmp.S,v 1.5 2015/03/26 13:34:51 justin Exp $ */ - -/* - * Copyright 2003 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Steve C. Woodford for Wasabi Systems, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 2002 ARM Ltd - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the company may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: memcmp.S,v 1.5 2015/03/26 13:34:51 justin Exp $") - -ENTRY(memcmp) - mov ip, r0 -#if defined(_KERNEL) && !defined(_STANDALONE) - cmp r2, #0x06 - beq .Lmemcmp_6bytes -#endif - mov r0, #0x00 - - /* Are both addresses aligned the same way? */ - cmp r2, #0x00 - eorsne r3, ip, r1 - RETc(eq) /* len == 0, or same addresses! */ - tst r3, #0x03 - subne r2, r2, #0x01 - bne .Lmemcmp_bytewise2 /* Badly aligned. Do it the slow way */ - - /* Word-align the addresses, if necessary */ - sub r3, r1, #0x05 - ands r3, r3, #0x03 - add r3, r3, r3, lsl #1 - addne pc, pc, r3, lsl #3 - nop - - /* Compare up to 3 bytes */ - ldrb r0, [ip], #0x01 - ldrb r3, [r1], #0x01 - subs r0, r0, r3 - RETc(ne) - subs r2, r2, #0x01 - RETc(eq) - - /* Compare up to 2 bytes */ - ldrb r0, [ip], #0x01 - ldrb r3, [r1], #0x01 - subs r0, r0, r3 - RETc(ne) - subs r2, r2, #0x01 - RETc(eq) - - /* Compare 1 byte */ - ldrb r0, [ip], #0x01 - ldrb r3, [r1], #0x01 - subs r0, r0, r3 - RETc(ne) - subs r2, r2, #0x01 - RETc(eq) - - /* Compare 4 bytes at a time, if possible */ - subs r2, r2, #0x04 - bcc .Lmemcmp_bytewise -.Lmemcmp_word_aligned: - ldr r0, [ip], #0x04 - ldr r3, [r1], #0x04 - subs r2, r2, #0x04 - cmpcs r0, r3 - beq .Lmemcmp_word_aligned - sub r0, r0, r3 - - /* Correct for extra subtraction, and check if done */ - adds r2, r2, #0x04 - cmpeq r0, #0x00 /* If done, did all bytes match? */ - RETc(eq) /* Yup. Just return */ - - /* Re-do the final word byte-wise */ - sub ip, ip, #0x04 - sub r1, r1, #0x04 - -.Lmemcmp_bytewise: - add r2, r2, #0x03 -.Lmemcmp_bytewise2: - ldrb r0, [ip], #0x01 - ldrb r3, [r1], #0x01 - subs r2, r2, #0x01 - cmpcs r0, r3 - beq .Lmemcmp_bytewise2 - sub r0, r0, r3 - RET - -#if defined(_KERNEL) && !defined(_STANDALONE) - /* - * 6 byte compares are very common, thanks to the network stack. - * This code is hand-scheduled to reduce the number of stalls for - * load results. Everything else being equal, this will be ~32% - * faster than a byte-wise memcmp. - */ - .align 5 -.Lmemcmp_6bytes: - ldrb r3, [r1, #0x00] /* r3 = b2#0 */ - ldrb r0, [ip, #0x00] /* r0 = b1#0 */ - ldrb r2, [r1, #0x01] /* r2 = b2#1 */ - subs r0, r0, r3 /* r0 = b1#0 - b2#0 */ - ldrbeq r3, [ip, #0x01] /* r3 = b1#1 */ - RETc(ne) /* Return if mismatch on #0 */ - subs r0, r3, r2 /* r0 = b1#1 - b2#1 */ - ldrbeq r3, [r1, #0x02] /* r3 = b2#2 */ - ldrbeq r0, [ip, #0x02] /* r0 = b1#2 */ - RETc(ne) /* Return if mismatch on #1 */ - ldrb r2, [r1, #0x03] /* r2 = b2#3 */ - subs r0, r0, r3 /* r0 = b1#2 - b2#2 */ - ldrbeq r3, [ip, #0x03] /* r3 = b1#3 */ - RETc(ne) /* Return if mismatch on #2 */ - subs r0, r3, r2 /* r0 = b1#3 - b2#3 */ - ldrbeq r3, [r1, #0x04] /* r3 = b2#4 */ - ldrbeq r0, [ip, #0x04] /* r0 = b1#4 */ - RETc(ne) /* Return if mismatch on #3 */ - ldrb r2, [r1, #0x05] /* r2 = b2#5 */ - subs r0, r0, r3 /* r0 = b1#4 - b2#4 */ - ldrbeq r3, [ip, #0x05] /* r3 = b1#5 */ - RETc(ne) /* Return if mismatch on #4 */ - sub r0, r3, r2 /* r0 = b1#5 - b2#5 */ - RET -#endif -END(memcmp) - -#if defined(__ARM_EABI__) && !defined(_RUMPKERNEL) -STRONG_ALIAS(__aeabi_memcmp, memcmp) -#endif diff --git a/common/lib/libc/arch/arm/string/memcpy.S b/common/lib/libc/arch/arm/string/memcpy.S deleted file mode 100644 index 9bff35fdd..000000000 --- a/common/lib/libc/arch/arm/string/memcpy.S +++ /dev/null @@ -1,15 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.8 2015/06/07 11:41:59 joerg Exp $ */ - -#include - -#if !defined(__XSCALE__) || defined(_STANDALONE) -#include "memcpy_arm.S" -#else -#include "memcpy_xscale.S" -#endif - -#if defined(__ARM_EABI__) && !defined(_RUMPKERNEL) -STRONG_ALIAS(__aeabi_memcpy, memcpy) -STRONG_ALIAS(__aeabi_memcpy4, memcpy) -STRONG_ALIAS(__aeabi_memcpy8, memcpy) -#endif diff --git a/common/lib/libc/arch/arm/string/memcpy_arm.S b/common/lib/libc/arch/arm/string/memcpy_arm.S deleted file mode 100644 index dba109619..000000000 --- a/common/lib/libc/arch/arm/string/memcpy_arm.S +++ /dev/null @@ -1,333 +0,0 @@ -/* $NetBSD: memcpy_arm.S,v 1.5 2013/12/02 21:21:33 joerg Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Neil A. Carson and Mark Brinicombe - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -/* - * This is one fun bit of code ... - * Some easy listening music is suggested while trying to understand this - * code e.g. Iron Maiden - * - * For anyone attempting to understand it : - * - * The core code is implemented here with simple stubs for memcpy(). - * - * All local labels are prefixed with Lmemcpy_ - * Following the prefix a label starting f is used in the forward copy code - * while a label using b is used in the backwards copy code - * The source and destination addresses determine whether a forward or - * backward copy is performed. - * Separate bits of code are used to deal with the following situations - * for both the forward and backwards copy. - * unaligned source address - * unaligned destination address - * Separate copy routines are used to produce an optimised result for each - * of these cases. - * The copy code will use LDM/STM instructions to copy up to 32 bytes at - * a time where possible. - * - * Note: r12 (aka ip) can be trashed during the function along with - * r0-r3 although r0-r2 have defined uses i.e. src, dest, len through out. - * Additional registers are preserved prior to use i.e. r4, r5 & lr - * - * Apologies for the state of the comments ;-) - */ -/* LINTSTUB: Func: void *memcpy(void *dst, const void *src, size_t len) */ -ENTRY(memcpy) - /* save leaf functions having to store this away */ - push {r0, lr} /* memcpy() returns dest addr */ - - subs r2, r2, #4 - blt .Lmemcpy_l4 /* less than 4 bytes */ - ands r12, r0, #3 - bne .Lmemcpy_destul /* oh unaligned destination addr */ - ands r12, r1, #3 - bne .Lmemcpy_srcul /* oh unaligned source addr */ - -.Lmemcpy_t8: - /* We have aligned source and destination */ - subs r2, r2, #8 - blt .Lmemcpy_l12 /* less than 12 bytes (4 from above) */ - subs r2, r2, #0x14 - blt .Lmemcpy_l32 /* less than 32 bytes (12 from above) */ - push {r4} /* borrow r4 */ - - /* blat 32 bytes at a time */ - /* XXX for really big copies perhaps we should use more registers */ -.Lmemcpy_loop32: - ldmia r1!, {r3, r4, r12, lr} - stmia r0!, {r3, r4, r12, lr} - ldmia r1!, {r3, r4, r12, lr} - stmia r0!, {r3, r4, r12, lr} - subs r2, r2, #0x20 - bge .Lmemcpy_loop32 - - cmn r2, #0x10 - ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ - stmiage r0!, {r3, r4, r12, lr} - subge r2, r2, #0x10 - pop {r4} /* return r4 */ - -.Lmemcpy_l32: - adds r2, r2, #0x14 - - /* blat 12 bytes at a time */ -.Lmemcpy_loop12: - ldmiage r1!, {r3, r12, lr} - stmiage r0!, {r3, r12, lr} - subsge r2, r2, #0x0c - bge .Lmemcpy_loop12 - -.Lmemcpy_l12: - adds r2, r2, #8 - blt .Lmemcpy_l4 - - subs r2, r2, #4 - ldrlt r3, [r1], #4 - strlt r3, [r0], #4 - ldmiage r1!, {r3, r12} - stmiage r0!, {r3, r12} - subge r2, r2, #4 - -.Lmemcpy_l4: - /* less than 4 bytes to go */ - adds r2, r2, #4 -#ifdef __APCS_26_ - ldmiaeq sp!, {r0, pc}^ /* done */ -#else - popeq {r0, pc} /* done */ -#endif - /* copy the crud byte at a time */ - cmp r2, #2 - ldrb r3, [r1], #1 - strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 - pop {r0, pc} - - /* erg - unaligned destination */ -.Lmemcpy_destul: - rsb r12, r12, #4 - cmp r12, #2 - - /* align destination with byte copies */ - ldrb r3, [r1], #1 - strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 - subs r2, r2, r12 - blt .Lmemcpy_l4 /* less the 4 bytes */ - - ands r12, r1, #3 - beq .Lmemcpy_t8 /* we have an aligned source */ - - /* erg - unaligned source */ - /* This is where it gets nasty ... */ -.Lmemcpy_srcul: - bic r1, r1, #3 - ldr lr, [r1], #4 - cmp r12, #2 - bgt .Lmemcpy_srcul3 - beq .Lmemcpy_srcul2 - cmp r2, #0x0c - blt .Lmemcpy_srcul1loop4 - sub r2, r2, #0x0c - push {r4, r5} - -.Lmemcpy_srcul1loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #8 -#else - mov r3, lr, lsr #8 -#endif - ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #24 - mov r4, r4, lsl #8 - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r12, lsr #24 - mov r12, r12, lsl #8 - orr r12, r12, lr, lsr #24 -#else - orr r3, r3, r4, lsl #24 - mov r4, r4, lsr #8 - orr r4, r4, r5, lsl #24 - mov r5, r5, lsr #8 - orr r5, r5, r12, lsl #24 - mov r12, r12, lsr #8 - orr r12, r12, lr, lsl #24 -#endif - stmia r0!, {r3-r5, r12} - subs r2, r2, #0x10 - bge .Lmemcpy_srcul1loop16 - pop {r4, r5} - adds r2, r2, #0x0c - blt .Lmemcpy_srcul1l4 - -.Lmemcpy_srcul1loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #8 -#else - mov r12, lr, lsr #8 -#endif - ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #24 -#else - orr r12, r12, lr, lsl #24 -#endif - str r12, [r0], #4 - subs r2, r2, #4 - bge .Lmemcpy_srcul1loop4 - -.Lmemcpy_srcul1l4: - sub r1, r1, #3 - b .Lmemcpy_l4 - -.Lmemcpy_srcul2: - cmp r2, #0x0c - blt .Lmemcpy_srcul2loop4 - sub r2, r2, #0x0c - push {r4, r5} - -.Lmemcpy_srcul2loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #16 -#else - mov r3, lr, lsr #16 -#endif - ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #16 - mov r4, r4, lsl #16 - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r12, lsr #16 - mov r12, r12, lsl #16 - orr r12, r12, lr, lsr #16 -#else - orr r3, r3, r4, lsl #16 - mov r4, r4, lsr #16 - orr r4, r4, r5, lsl #16 - mov r5, r5, lsr #16 - orr r5, r5, r12, lsl #16 - mov r12, r12, lsr #16 - orr r12, r12, lr, lsl #16 -#endif - stmia r0!, {r3-r5, r12} - subs r2, r2, #0x10 - bge .Lmemcpy_srcul2loop16 - pop {r4, r5} - adds r2, r2, #0x0c - blt .Lmemcpy_srcul2l4 - -.Lmemcpy_srcul2loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #16 -#else - mov r12, lr, lsr #16 -#endif - ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #16 -#else - orr r12, r12, lr, lsl #16 -#endif - str r12, [r0], #4 - subs r2, r2, #4 - bge .Lmemcpy_srcul2loop4 - -.Lmemcpy_srcul2l4: - sub r1, r1, #2 - b .Lmemcpy_l4 - -.Lmemcpy_srcul3: - cmp r2, #0x0c - blt .Lmemcpy_srcul3loop4 - sub r2, r2, #0x0c - push {r4, r5} - -.Lmemcpy_srcul3loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #24 -#else - mov r3, lr, lsr #24 -#endif - ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #8 - mov r4, r4, lsl #24 - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r12, lsr #8 - mov r12, r12, lsl #24 - orr r12, r12, lr, lsr #8 -#else - orr r3, r3, r4, lsl #8 - mov r4, r4, lsr #24 - orr r4, r4, r5, lsl #8 - mov r5, r5, lsr #24 - orr r5, r5, r12, lsl #8 - mov r12, r12, lsr #24 - orr r12, r12, lr, lsl #8 -#endif - stmia r0!, {r3-r5, r12} - subs r2, r2, #0x10 - bge .Lmemcpy_srcul3loop16 - pop {r4, r5} - adds r2, r2, #0x0c - blt .Lmemcpy_srcul3l4 - -.Lmemcpy_srcul3loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #24 -#else - mov r12, lr, lsr #24 -#endif - ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #8 -#else - orr r12, r12, lr, lsl #8 -#endif - str r12, [r0], #4 - subs r2, r2, #4 - bge .Lmemcpy_srcul3loop4 - -.Lmemcpy_srcul3l4: - sub r1, r1, #1 - b .Lmemcpy_l4 -END(memcpy) diff --git a/common/lib/libc/arch/arm/string/memcpy_neon.S b/common/lib/libc/arch/arm/string/memcpy_neon.S deleted file mode 100644 index 229833300..000000000 --- a/common/lib/libc/arch/arm/string/memcpy_neon.S +++ /dev/null @@ -1,277 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: memcpy_neon.S,v 1.1 2013/01/03 09:34:44 matt Exp $") - - .text -ENTRY(memcpy) - teq r2, #0 /* 0 length? */ - cmpne r0, r1 /* if not, does src == dst? */ - RETc(eq) /* yes, (to either) return */ - - mov r3, r0 /* keep r0 unchanged */ -#if 0 - cmp r2, #16 /* copy less than 8 bytes? */ - bge .Ldst_aligner /* nope, do it the long way */ - -1: ldrb ip, [r1], #1 /* load a byte from src */ - subs r2, r2, #1 /* and more to transfer? */ - strb ip, [r3], #1 /* save it to dst */ - bne 1b /* yes, do next byte */ - RET /* return */ -#endif - -.Ldst_aligner: - tst r3, #7 /* is dst pointer word aligned? */ - beq .Lsrc_aligner /* yes, check src pointer */ - /* - * Until the dst pointer is word aligned, read src and dst byte by - * byte until it is aligned or we've copied everything. - */ - ldrb ip, [r1], #1 /* load a byte from src */ - strb ip, [r3], #1 /* save the byte to dst */ - subs r2, r2, #1 /* end of transfer? */ - bne .Ldst_aligner /* no, try next byte */ - RET /* yes, we're done! */ - -.Lsrc_aligner: - push {r4-r5} /* save some registers */ - add r4, r2, r3 /* keep a pointer to the end of src */ - ands r5, r1, #7 /* get misalignment of src pointer */ - beq .Lcongruent_main /* aligned, do it the fast way */ - - vdup.8 d1, r5 /* set offset for table */ - rsb r5, r5, #8 /* calculate leftover of each word */ - bic r1, r1, #7 /* dword align src pointer */ - - vldr d0, .Ltbl_value /* load table value */ - vadd.u8 d0, d0, d1 /* add offset to it */ - - vld1.64 {d1}, [r1:64]! /* load a dword from src */ - - cmp r2, r5 /* do we already have enough? */ - bgt .Lincongruent /* no, so read more */ - -.Lincongruent_finish: - vtbl.8 d0, {d1-d2}, d0 /* merge last dwords */ - cmp r2, #8 /* room for a full dword? */ -#ifdef __ARMEB__ - vrev64.32 d0, d0 /* word swap to LE */ -#endif - blt .Lfinish /* no, write final partial dword */ - vst1.32 {d0}, [r3:64] /* yes, write final full dword */ - b .Ldone /* and we're done! */ - -.Lincongruent: - vld1.64 {d2}, [r1:64]! /* load a dword */ - cmp r2, #8 /* can we write a full dword? */ - blt .Lincongruent_finish /* no, finish it. */ - vtbl.8 d1, {d1-d2}, d0 /* reorder */ - vst1.64 {d1}, [r3:64]! /* store a dword */ - subs r2, r2, #8 /* have we written everything? */ - beq .Ldone /* yes, we're done! */ - vmov d1, d2 /* prepare for next dword */ - tst r3, #63 /* are we 64-byte aligned? */ - bne .Lincongruent /* no, load next dword */ - - /* - * We are now 64-byte aligneds so all writes should fill one or more - * cachelines. Even if d1 has 7 bytes cached, to write 32 bytes we - * still need to read 4 dwords (3 full dwords and 1 dword for that - * last byte). - */ - cmp r2, #32 /* can we write 4 more dwords? */ - blt .Lincongruent_dword /* no, handle dword by dword */ - vld1.64 {d2-d5}, [r1:64]! /* read 4 dwords */ - cmp r2, #64 /* can we write 4 more dwords? */ - blt .Lincongruent_4dword /* no, handle it */ - -1: vld1.64 {d7-d10}, [r1:64]! /* read 4 dwords */ - vtbl.8 d1, {d1-d2}, d0 /* reorder */ - vtbl.8 d2, {d2-d3}, d0 /* reorder */ - vtbl.8 d3, {d3-d4}, d0 /* reorder */ - vtbl.8 d4, {d4-d5}, d0 /* reorder */ - vst1.64 {d1-d4}, [r3:64]! /* write 4 dwords */ - vmov d6, d5 /* move out of the way the load */ - cmp r2, #96 /* have 8+4 dwords to write? */ - blt 2f /* no more data, skip the load */ - vld1.64 {d2-d5}, [r1:64]! /* more data, load 4 dwords */ -2: vtbl.8 d6, {d6-d7}, d0 /* reorder */ - vtbl.8 d7, {d7-d8}, d0 /* reorder */ - vtbl.8 d8, {d8-d9}, d0 /* reorder */ - vtbl.8 d9, {d9-d10}, d0 /* reorder */ - vst1.64 {d6-d9}, [r3:64]! /* write 4 dwords */ - subs r2, r2, #64 - beq .Ldone - vmov d1, d10 - cmp r2, #64 - bge 1b - - /* - * we have leftovers in d1 and new untranslated date in d2-d5. - */ -.Lincongruent_4dword: - cmp r2, #32 - blt .Lincongruent_dword - - vtbl.8 d1, {d1-d2}, d0 /* reorder */ - vtbl.8 d2, {d2-d3}, d0 /* reorder */ - vtbl.8 d3, {d3-d4}, d0 /* reorder */ - vtbl.8 d4, {d4-d5}, d0 /* reorder */ - vst1.64 {d1-d4}, [r3:64]! /* write 4 dwords */ - vmov d1, d5 /* move leftovers */ - subs r2, r2, #32 - beq .Ldone - -.Lincongruent_dword: -#if 0 - cmp r2, r5 /* enough in leftovers? */ - ble .Lincongruent_finish /* yes, finish it. */ - vld1.64 {d2}, [r1:64]! /* load a dword */ - cmp r2, #8 /* can we write a full dword? */ - blt .Lincongruent_finish /* no, finish it. */ - vtbl.8 d1, {d1-d2}, d0 /* reorder */ - vst1.64 {d1}, [r3:64]! /* store a dword */ - subs r2, r2, #8 /* have we written everything? */ - beq .Ldone /* yes, we're done! */ - b .Lincongruent_dword /* and go get it */ -#else - cmp r2, r5 /* are the bytes we have enough? */ - ble .Lincongruent_finish /* yes, finish it. */ - mov ip, r2 /* get remaining count */ - bic ip, ip, #7 /* truncate to a dword */ - rsb ip, ip, #32 /* subtract from 32 */ - ands r2, r2, #7 /* count mod 8 */ - add pc, pc, ip, lsl #1 /* and jump! */ - nop - vld1.64 {d2}, [r1:64]! /* load a dword */ - vtbl.8 d1, {d1-d2}, d0 /* reorder */ - vst1.64 {d1}, [r3:64]! /* store a dword */ - vmov d1, d2 /* prepare for next dword */ - vld1.64 {d2}, [r1:64]! /* load a dword */ - vtbl.8 d1, {d1-d2}, d0 /* reorder */ - vst1.64 {d1}, [r3:64]! /* store a dword */ - vmov d1, d2 /* prepare for next dword */ - vld1.64 {d2}, [r1:64]! /* load a dword */ - vtbl.8 d1, {d1-d2}, d0 /* reorder */ - vst1.64 {d1}, [r3:64]! /* store a dword */ - vmov d1, d2 /* prepare for next dword */ - vld1.64 {d2}, [r1:64]! /* load a dword */ - vtbl.8 d1, {d1-d2}, d0 /* reorder */ - vst1.64 {d1}, [r3:64]! /* store a dword */ - vmov d1, d2 /* prepare for next dword */ - beq .Ldone - vld1.64 {d2}, [r1:64]! /* load a dword */ - b .Lincongruent_finish /* write last partial dowrd */ -#endif - -.Lcongruent_main: - vld1.32 {d0}, [r1:64]! /* load next dword */ - cmp r2, #8 /* compare current ptr against end */ - blt .Lfinish /* greater so write final dword */ - vst1.32 {d0}, [r3:64]! /* store dword */ - subs r2, r2, #8 /* compare current ptr against end */ - beq .Ldone /* equal? we're done! */ - tst r3, #63 /* have we hit a 64-byte boundary? */ - bne .Lcongruent_main /* no, write next word */ - - cmp r2, #64 /* can we write 4 dwords? */ - blt .Lcongruent_loop /* no, this dword by dword */ - vldm r1!, {d0-d7} /* load next 7 dwords */ - cmp r2, #128 /* can we write 16 dwords */ - blt 3f /* no, then deal with 8 dwords */ - - /* - * The following writes two 64-byte interleaving stores and loads. - */ -1: vldm r1!, {d8-d15} /* load next 8 dwords */ - vstm r3!, {d0-d7} /* store 8 more dwords */ - cmp r2, #192 /* can we write 16+8 dwords? */ - blt 2f /* no, don't load the next 8 dwords */ - vldm r1!, {d0-d7} /* yes, load next 8 dwords */ -2: vstm r3!, {d8-d15} /* store 8 more dwords */ - sub r2, r2, #128 /* we just stored 16 (8+8) dwords */ - beq .Ldone /* if 0, we're done! */ - cmp r2, #128 /* can we write 16 dwords */ - bge 1b /* yes, do it again */ - cmp r2, #64 /* have we loaded 8 dwords? */ - blt .Lcongruent_loop /* no, proceed to do it dword */ - - /* - * We now have 8 dwords we can write in d0-d7. - */ -3: vstm r3!, {d0-d7} /* store 8 more dwords */ - subs r2, r2, #64 /* we wrote 8 dwords */ - beq .Ldone /* if 0, we're done! */ - -.Lcongruent_loop: - vld1.32 {d0}, [r1]! /* load dword from src */ - cmp r2, #8 /* can we write a full dword? */ - blt .Lfinish /* no, write last partial dword */ -.Lcongruent_loop_start: - vst1.32 {d0}, [r3]! /* store dword into dst */ - subs r2, r2, #8 /* subtract it from length */ - beq .Ldone /* if 0, we're done! */ - vld1.32 {d0}, [r1]! /* load dword from src */ - cmp r2, #8 /* can we write a full dword? */ - bge .Lcongruent_loop_start /* yes, so do it */ - -.Lfinish: - vmov r4, r5, d0 /* get last dword from NEON */ - tst r2, #4 /* do we have at least 4 bytes left? */ - strne r4, [r3], #4 /* store the 1st word */ - movne r4, r5 /* move 2nd word into place */ - tst r2, #2 /* do we have at least 2 bytes left? */ -#ifdef __ARMEB__ - movne r4, r4, ror #16 /* yes, swap halfwords */ -#endif - strneh r4, [r3], #2 /* yes, store the halfword */ -#ifdef __ARMEL__ - movne r4, r4, lsr #16 /* yes, discard just written bytes */ -#endif - tst r2, #1 /* do we have a final byte? */ -#ifdef __ARMEB__ - movne r4, r4, lsr #24 /* yes, move MSB to LSB */ -#endif - strneb r4, [r3], #1 /* yes, store it */ - -.Ldone: - pop {r4-r5} /* restore registers */ - RET - - .p2align 3 -.Ltbl_value: -#ifdef __ARMEL__ - .quad 0x0706050403020100 -#else - .quad 0x0001020304050607 -#endif -END(memcpy) diff --git a/common/lib/libc/arch/arm/string/memcpy_xscale.S b/common/lib/libc/arch/arm/string/memcpy_xscale.S deleted file mode 100644 index 35d4fb9db..000000000 --- a/common/lib/libc/arch/arm/string/memcpy_xscale.S +++ /dev/null @@ -1,1894 +0,0 @@ -/* $NetBSD: memcpy_xscale.S,v 1.5 2013/12/17 01:27:21 joerg Exp $ */ - -/* - * Copyright 2003 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Steve C. Woodford for Wasabi Systems, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -/* LINTSTUB: Func: void *memcpy(void *dst, const void *src, size_t len) */ -ENTRY(memcpy) - pld [r1] - cmp r2, #0x0c - ble .Lmemcpy_short /* <= 12 bytes */ - mov r3, r0 /* We must not clobber r0 */ - - /* Word-align the destination buffer */ - ands ip, r3, #0x03 /* Already word aligned? */ - beq .Lmemcpy_wordaligned /* Yup */ - cmp ip, #0x02 - ldrb ip, [r1], #0x01 - sub r2, r2, #0x01 - strb ip, [r3], #0x01 - ldrble ip, [r1], #0x01 - suble r2, r2, #0x01 - strble ip, [r3], #0x01 - ldrblt ip, [r1], #0x01 - sublt r2, r2, #0x01 - strblt ip, [r3], #0x01 - - /* Destination buffer is now word aligned */ -.Lmemcpy_wordaligned: - ands ip, r1, #0x03 /* Is src also word-aligned? */ - bne .Lmemcpy_bad_align /* Nope. Things just got bad */ - - /* Quad-align the destination buffer */ - tst r3, #0x07 /* Already quad aligned? */ - ldrne ip, [r1], #0x04 - push {r4-r9} /* Free up some registers */ - subne r2, r2, #0x04 - strne ip, [r3], #0x04 - - /* Destination buffer quad aligned, source is at least word aligned */ - subs r2, r2, #0x80 - blt .Lmemcpy_w_lessthan128 - - /* Copy 128 bytes at a time */ -.Lmemcpy_w_loop128: - ldr r4, [r1], #0x04 /* LD:00-03 */ - ldr r5, [r1], #0x04 /* LD:04-07 */ - pld [r1, #0x18] /* Prefetch 0x20 */ - ldr r6, [r1], #0x04 /* LD:08-0b */ - ldr r7, [r1], #0x04 /* LD:0c-0f */ - ldr r8, [r1], #0x04 /* LD:10-13 */ - ldr r9, [r1], #0x04 /* LD:14-17 */ - strd r4, r5, [r3], #0x08 /* ST:00-07 */ - ldr r4, [r1], #0x04 /* LD:18-1b */ - ldr r5, [r1], #0x04 /* LD:1c-1f */ - strd r6, r7, [r3], #0x08 /* ST:08-0f */ - ldr r6, [r1], #0x04 /* LD:20-23 */ - ldr r7, [r1], #0x04 /* LD:24-27 */ - pld [r1, #0x18] /* Prefetch 0x40 */ - strd r8, r9, [r3], #0x08 /* ST:10-17 */ - ldr r8, [r1], #0x04 /* LD:28-2b */ - ldr r9, [r1], #0x04 /* LD:2c-2f */ - strd r4, r5, [r3], #0x08 /* ST:18-1f */ - ldr r4, [r1], #0x04 /* LD:30-33 */ - ldr r5, [r1], #0x04 /* LD:34-37 */ - strd r6, r7, [r3], #0x08 /* ST:20-27 */ - ldr r6, [r1], #0x04 /* LD:38-3b */ - ldr r7, [r1], #0x04 /* LD:3c-3f */ - strd r8, r9, [r3], #0x08 /* ST:28-2f */ - ldr r8, [r1], #0x04 /* LD:40-43 */ - ldr r9, [r1], #0x04 /* LD:44-47 */ - pld [r1, #0x18] /* Prefetch 0x60 */ - strd r4, r5, [r3], #0x08 /* ST:30-37 */ - ldr r4, [r1], #0x04 /* LD:48-4b */ - ldr r5, [r1], #0x04 /* LD:4c-4f */ - strd r6, r7, [r3], #0x08 /* ST:38-3f */ - ldr r6, [r1], #0x04 /* LD:50-53 */ - ldr r7, [r1], #0x04 /* LD:54-57 */ - strd r8, r9, [r3], #0x08 /* ST:40-47 */ - ldr r8, [r1], #0x04 /* LD:58-5b */ - ldr r9, [r1], #0x04 /* LD:5c-5f */ - strd r4, r5, [r3], #0x08 /* ST:48-4f */ - ldr r4, [r1], #0x04 /* LD:60-63 */ - ldr r5, [r1], #0x04 /* LD:64-67 */ - pld [r1, #0x18] /* Prefetch 0x80 */ - strd r6, r7, [r3], #0x08 /* ST:50-57 */ - ldr r6, [r1], #0x04 /* LD:68-6b */ - ldr r7, [r1], #0x04 /* LD:6c-6f */ - strd r8, r9, [r3], #0x08 /* ST:58-5f */ - ldr r8, [r1], #0x04 /* LD:70-73 */ - ldr r9, [r1], #0x04 /* LD:74-77 */ - strd r4, r5, [r3], #0x08 /* ST:60-67 */ - ldr r4, [r1], #0x04 /* LD:78-7b */ - ldr r5, [r1], #0x04 /* LD:7c-7f */ - strd r6, r7, [r3], #0x08 /* ST:68-6f */ - strd r8, r9, [r3], #0x08 /* ST:70-77 */ - subs r2, r2, #0x80 - strd r4, r5, [r3], #0x08 /* ST:78-7f */ - bge .Lmemcpy_w_loop128 - -.Lmemcpy_w_lessthan128: - adds r2, r2, #0x80 /* Adjust for extra sub */ - popeq {r4-r9} - RETc(eq) /* Return now if done */ - subs r2, r2, #0x20 - blt .Lmemcpy_w_lessthan32 - - /* Copy 32 bytes at a time */ -.Lmemcpy_w_loop32: - ldr r4, [r1], #0x04 - ldr r5, [r1], #0x04 - pld [r1, #0x18] - ldr r6, [r1], #0x04 - ldr r7, [r1], #0x04 - ldr r8, [r1], #0x04 - ldr r9, [r1], #0x04 - strd r4, r5, [r3], #0x08 - ldr r4, [r1], #0x04 - ldr r5, [r1], #0x04 - strd r6, r7, [r3], #0x08 - strd r8, r9, [r3], #0x08 - subs r2, r2, #0x20 - strd r4, r5, [r3], #0x08 - bge .Lmemcpy_w_loop32 - -.Lmemcpy_w_lessthan32: - adds r2, r2, #0x20 /* Adjust for extra sub */ - popeq {r4-r9} - RETc(eq) /* Return now if done */ - - and r4, r2, #0x18 - rsbs r4, r4, #0x18 - addne pc, pc, r4, lsl #1 - nop - - /* At least 24 bytes remaining */ - ldr r4, [r1], #0x04 - ldr r5, [r1], #0x04 - sub r2, r2, #0x08 - strd r4, r5, [r3], #0x08 - - /* At least 16 bytes remaining */ - ldr r4, [r1], #0x04 - ldr r5, [r1], #0x04 - sub r2, r2, #0x08 - strd r4, r5, [r3], #0x08 - - /* At least 8 bytes remaining */ - ldr r4, [r1], #0x04 - ldr r5, [r1], #0x04 - subs r2, r2, #0x08 - strd r4, r5, [r3], #0x08 - - /* Less than 8 bytes remaining */ - pop {r4-r9} - RETc(eq) /* Return now if done */ - subs r2, r2, #0x04 - ldrge ip, [r1], #0x04 - strge ip, [r3], #0x04 - RETc(eq) /* Return now if done */ - addlt r2, r2, #0x04 - ldrb ip, [r1], #0x01 - cmp r2, #0x02 - ldrbge r2, [r1], #0x01 - strb ip, [r3], #0x01 - ldrbgt ip, [r1] - strbge r2, [r3], #0x01 - strbgt ip, [r3] - RET - - -/* - * At this point, it has not been possible to word align both buffers. - * The destination buffer is word aligned, but the source buffer is not. - */ -.Lmemcpy_bad_align: - push {r4-r7} - bic r1, r1, #0x03 - cmp ip, #2 - ldr ip, [r1], #0x04 - bgt .Lmemcpy_bad3 - beq .Lmemcpy_bad2 - b .Lmemcpy_bad1 - -.Lmemcpy_bad1_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else - mov r4, ip, lsr #8 -#endif - ldr r5, [r1], #0x04 - pld [r1, #0x018] - ldr r6, [r1], #0x04 - ldr r7, [r1], #0x04 - ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r6, lsr #24 - mov r6, r6, lsl #8 - orr r6, r6, r7, lsr #24 - mov r7, r7, lsl #8 - orr r7, r7, ip, lsr #24 -#else - orr r4, r4, r5, lsl #24 - mov r5, r5, lsr #8 - orr r5, r5, r6, lsl #24 - mov r6, r6, lsr #8 - orr r6, r6, r7, lsl #24 - mov r7, r7, lsr #8 - orr r7, r7, ip, lsl #24 -#endif - str r4, [r3], #0x04 - str r5, [r3], #0x04 - str r6, [r3], #0x04 - str r7, [r3], #0x04 - sub r2, r2, #0x10 - -.Lmemcpy_bad1: - cmp r2, #0x20 - bge .Lmemcpy_bad1_loop16 - cmp r2, #0x10 - blt .Lmemcpy_bad1_loop16_short - - /* copy last 16 bytes (without preload) */ -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else - mov r4, ip, lsr #8 -#endif - ldr r5, [r1], #0x04 - ldr r6, [r1], #0x04 - ldr r7, [r1], #0x04 - ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r6, lsr #24 - mov r6, r6, lsl #8 - orr r6, r6, r7, lsr #24 - mov r7, r7, lsl #8 - orr r7, r7, ip, lsr #24 -#else - orr r4, r4, r5, lsl #24 - mov r5, r5, lsr #8 - orr r5, r5, r6, lsl #24 - mov r6, r6, lsr #8 - orr r6, r6, r7, lsl #24 - mov r7, r7, lsr #8 - orr r7, r7, ip, lsl #24 -#endif - str r4, [r3], #0x04 - str r5, [r3], #0x04 - str r6, [r3], #0x04 - str r7, [r3], #0x04 - subs r2, r2, #0x10 - popeq {r4-r7} - RETc(eq) /* Return now if done */ - -.Lmemcpy_bad1_loop16_short: - subs r2, r2, #0x04 - sublt r1, r1, #0x03 - blt .Lmemcpy_bad_done - -.Lmemcpy_bad1_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else - mov r4, ip, lsr #8 -#endif - ldr ip, [r1], #0x04 - subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #24 -#else - orr r4, r4, ip, lsl #24 -#endif - str r4, [r3], #0x04 - bge .Lmemcpy_bad1_loop4 - sub r1, r1, #0x03 - b .Lmemcpy_bad_done - -.Lmemcpy_bad2_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else - mov r4, ip, lsr #16 -#endif - ldr r5, [r1], #0x04 - pld [r1, #0x018] - ldr r6, [r1], #0x04 - ldr r7, [r1], #0x04 - ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r6, lsr #16 - mov r6, r6, lsl #16 - orr r6, r6, r7, lsr #16 - mov r7, r7, lsl #16 - orr r7, r7, ip, lsr #16 -#else - orr r4, r4, r5, lsl #16 - mov r5, r5, lsr #16 - orr r5, r5, r6, lsl #16 - mov r6, r6, lsr #16 - orr r6, r6, r7, lsl #16 - mov r7, r7, lsr #16 - orr r7, r7, ip, lsl #16 -#endif - str r4, [r3], #0x04 - str r5, [r3], #0x04 - str r6, [r3], #0x04 - str r7, [r3], #0x04 - sub r2, r2, #0x10 - -.Lmemcpy_bad2: - cmp r2, #0x20 - bge .Lmemcpy_bad2_loop16 - cmp r2, #0x10 - blt .Lmemcpy_bad2_loop16_short - - /* copy last 16 bytes (without preload) */ -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else - mov r4, ip, lsr #16 -#endif - ldr r5, [r1], #0x04 - ldr r6, [r1], #0x04 - ldr r7, [r1], #0x04 - ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r6, lsr #16 - mov r6, r6, lsl #16 - orr r6, r6, r7, lsr #16 - mov r7, r7, lsl #16 - orr r7, r7, ip, lsr #16 -#else - orr r4, r4, r5, lsl #16 - mov r5, r5, lsr #16 - orr r5, r5, r6, lsl #16 - mov r6, r6, lsr #16 - orr r6, r6, r7, lsl #16 - mov r7, r7, lsr #16 - orr r7, r7, ip, lsl #16 -#endif - str r4, [r3], #0x04 - str r5, [r3], #0x04 - str r6, [r3], #0x04 - str r7, [r3], #0x04 - subs r2, r2, #0x10 - popeq {r4-r7} - RETc(eq) /* Return now if done */ - -.Lmemcpy_bad2_loop16_short: - subs r2, r2, #0x04 - sublt r1, r1, #0x02 - blt .Lmemcpy_bad_done - -.Lmemcpy_bad2_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else - mov r4, ip, lsr #16 -#endif - ldr ip, [r1], #0x04 - subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #16 -#else - orr r4, r4, ip, lsl #16 -#endif - str r4, [r3], #0x04 - bge .Lmemcpy_bad2_loop4 - sub r1, r1, #0x02 - b .Lmemcpy_bad_done - -.Lmemcpy_bad3_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else - mov r4, ip, lsr #24 -#endif - ldr r5, [r1], #0x04 - pld [r1, #0x018] - ldr r6, [r1], #0x04 - ldr r7, [r1], #0x04 - ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r6, lsr #8 - mov r6, r6, lsl #24 - orr r6, r6, r7, lsr #8 - mov r7, r7, lsl #24 - orr r7, r7, ip, lsr #8 -#else - orr r4, r4, r5, lsl #8 - mov r5, r5, lsr #24 - orr r5, r5, r6, lsl #8 - mov r6, r6, lsr #24 - orr r6, r6, r7, lsl #8 - mov r7, r7, lsr #24 - orr r7, r7, ip, lsl #8 -#endif - str r4, [r3], #0x04 - str r5, [r3], #0x04 - str r6, [r3], #0x04 - str r7, [r3], #0x04 - sub r2, r2, #0x10 - -.Lmemcpy_bad3: - cmp r2, #0x20 - bge .Lmemcpy_bad3_loop16 - cmp r2, #0x10 - blt .Lmemcpy_bad3_loop16_short - - /* copy last 16 bytes (without preload) */ -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else - mov r4, ip, lsr #24 -#endif - ldr r5, [r1], #0x04 - ldr r6, [r1], #0x04 - ldr r7, [r1], #0x04 - ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r6, lsr #8 - mov r6, r6, lsl #24 - orr r6, r6, r7, lsr #8 - mov r7, r7, lsl #24 - orr r7, r7, ip, lsr #8 -#else - orr r4, r4, r5, lsl #8 - mov r5, r5, lsr #24 - orr r5, r5, r6, lsl #8 - mov r6, r6, lsr #24 - orr r6, r6, r7, lsl #8 - mov r7, r7, lsr #24 - orr r7, r7, ip, lsl #8 -#endif - str r4, [r3], #0x04 - str r5, [r3], #0x04 - str r6, [r3], #0x04 - str r7, [r3], #0x04 - subs r2, r2, #0x10 - popeq {r4-r7} - RETc(eq) /* Return now if done */ - -.Lmemcpy_bad3_loop16_short: - subs r2, r2, #0x04 - sublt r1, r1, #0x01 - blt .Lmemcpy_bad_done - -.Lmemcpy_bad3_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else - mov r4, ip, lsr #24 -#endif - ldr ip, [r1], #0x04 - subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #8 -#else - orr r4, r4, ip, lsl #8 -#endif - str r4, [r3], #0x04 - bge .Lmemcpy_bad3_loop4 - sub r1, r1, #0x01 - -.Lmemcpy_bad_done: - pop {r4-r7} - adds r2, r2, #0x04 - RETc(eq) - ldrb ip, [r1], #0x01 - cmp r2, #0x02 - ldrbge r2, [r1], #0x01 - strb ip, [r3], #0x01 - ldrbgt ip, [r1] - strbge r2, [r3], #0x01 - strbgt ip, [r3] - RET - - -/* - * Handle short copies (less than 16 bytes), possibly misaligned. - * Some of these are *very* common, thanks to the network stack, - * and so are handled specially. - */ -.Lmemcpy_short: -#ifndef _STANDALONE - add pc, pc, r2, lsl #2 - nop - RET /* 0x00 */ - b .Lmemcpy_bytewise /* 0x01 */ - b .Lmemcpy_bytewise /* 0x02 */ - b .Lmemcpy_bytewise /* 0x03 */ - b .Lmemcpy_4 /* 0x04 */ - b .Lmemcpy_bytewise /* 0x05 */ - b .Lmemcpy_6 /* 0x06 */ - b .Lmemcpy_bytewise /* 0x07 */ - b .Lmemcpy_8 /* 0x08 */ - b .Lmemcpy_bytewise /* 0x09 */ - b .Lmemcpy_bytewise /* 0x0a */ - b .Lmemcpy_bytewise /* 0x0b */ - b .Lmemcpy_c /* 0x0c */ -#endif -.Lmemcpy_bytewise: - mov r3, r0 /* We must not clobber r0 */ - ldrb ip, [r1], #0x01 -1: subs r2, r2, #0x01 - strb ip, [r3], #0x01 - ldrbne ip, [r1], #0x01 - bne 1b - RET - -#ifndef _STANDALONE -/****************************************************************************** - * Special case for 4 byte copies - */ -#define LMEMCPY_4_LOG2 6 /* 64 bytes */ -#define LMEMCPY_4_PAD .align LMEMCPY_4_LOG2 - LMEMCPY_4_PAD -.Lmemcpy_4: - and r2, r1, #0x03 - orr r2, r2, r0, lsl #2 - ands r2, r2, #0x0f - sub r3, pc, #0x14 - addne pc, r3, r2, lsl #LMEMCPY_4_LOG2 - -/* - * 0000: dst is 32-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] - str r2, [r0] - RET - LMEMCPY_4_PAD - -/* - * 0001: dst is 32-bit aligned, src is 8-bit aligned - */ - ldr r3, [r1, #-1] /* BE:r3 = x012 LE:r3 = 210x */ - ldr r2, [r1, #3] /* BE:r2 = 3xxx LE:r2 = xxx3 */ -#ifdef __ARMEB__ - mov r3, r3, lsl #8 /* r3 = 012. */ - orr r3, r3, r2, lsr #24 /* r3 = 0123 */ -#else - mov r3, r3, lsr #8 /* r3 = .210 */ - orr r3, r3, r2, lsl #24 /* r3 = 3210 */ -#endif - str r3, [r0] - RET - LMEMCPY_4_PAD - -/* - * 0010: dst is 32-bit aligned, src is 16-bit aligned - */ -#ifdef __ARMEB__ - ldrh r3, [r1] - ldrh r2, [r1, #0x02] -#else - ldrh r3, [r1, #0x02] - ldrh r2, [r1] -#endif - orr r3, r2, r3, lsl #16 - str r3, [r0] - RET - LMEMCPY_4_PAD - -/* - * 0011: dst is 32-bit aligned, src is 8-bit aligned - */ - ldr r3, [r1, #-3] /* BE:r3 = xxx0 LE:r3 = 0xxx */ - ldr r2, [r1, #1] /* BE:r2 = 123x LE:r2 = x321 */ -#ifdef __ARMEB__ - mov r3, r3, lsl #24 /* r3 = 0... */ - orr r3, r3, r2, lsr #8 /* r3 = 0123 */ -#else - mov r3, r3, lsr #24 /* r3 = ...0 */ - orr r3, r3, r2, lsl #8 /* r3 = 3210 */ -#endif - str r3, [r0] - RET - LMEMCPY_4_PAD - -/* - * 0100: dst is 8-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] -#ifdef __ARMEB__ - strb r2, [r0, #0x03] - mov r3, r2, lsr #8 - mov r1, r2, lsr #24 - strb r1, [r0] -#else - strb r2, [r0] - mov r3, r2, lsr #8 - mov r1, r2, lsr #24 - strb r1, [r0, #0x03] -#endif - strh r3, [r0, #0x01] - RET - LMEMCPY_4_PAD - -/* - * 0101: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldrb r1, [r1, #0x03] - strb r2, [r0] - strh r3, [r0, #0x01] - strb r1, [r0, #0x03] - RET - LMEMCPY_4_PAD - -/* - * 0110: dst is 8-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldrh r3, [r1, #0x02] /* LE:r3 = ..23 LE:r3 = ..32 */ -#ifdef __ARMEB__ - mov r1, r2, lsr #8 /* r1 = ...0 */ - strb r1, [r0] - mov r2, r2, lsl #8 /* r2 = .01. */ - orr r2, r2, r3, lsr #8 /* r2 = .012 */ -#else - strb r2, [r0] - mov r2, r2, lsr #8 /* r2 = ...1 */ - orr r2, r2, r3, lsl #8 /* r2 = .321 */ - mov r3, r3, lsr #8 /* r3 = ...3 */ -#endif - strh r2, [r0, #0x01] - strb r3, [r0, #0x03] - RET - LMEMCPY_4_PAD - -/* - * 0111: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldrb r1, [r1, #0x03] - strb r2, [r0] - strh r3, [r0, #0x01] - strb r1, [r0, #0x03] - RET - LMEMCPY_4_PAD - -/* - * 1000: dst is 16-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] -#ifdef __ARMEB__ - strh r2, [r0, #0x02] - mov r3, r2, lsr #16 - strh r3, [r0] -#else - strh r2, [r0] - mov r3, r2, lsr #16 - strh r3, [r0, #0x02] -#endif - RET - LMEMCPY_4_PAD - -/* - * 1001: dst is 16-bit aligned, src is 8-bit aligned - */ - ldr r2, [r1, #-1] /* BE:r2 = x012 LE:r2 = 210x */ - ldr r3, [r1, #3] /* BE:r3 = 3xxx LE:r3 = xxx3 */ - mov r1, r2, lsr #8 /* BE:r1 = .x01 LE:r1 = .210 */ - strh r1, [r0] -#ifdef __ARMEB__ - mov r2, r2, lsl #8 /* r2 = 012. */ - orr r2, r2, r3, lsr #24 /* r2 = 0123 */ -#else - mov r2, r2, lsr #24 /* r2 = ...2 */ - orr r2, r2, r3, lsl #8 /* r2 = xx32 */ -#endif - strh r2, [r0, #0x02] - RET - LMEMCPY_4_PAD - -/* - * 1010: dst is 16-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] - ldrh r3, [r1, #0x02] - strh r2, [r0] - strh r3, [r0, #0x02] - RET - LMEMCPY_4_PAD - -/* - * 1011: dst is 16-bit aligned, src is 8-bit aligned - */ - ldr r3, [r1, #1] /* BE:r3 = 123x LE:r3 = x321 */ - ldr r2, [r1, #-3] /* BE:r2 = xxx0 LE:r2 = 0xxx */ - mov r1, r3, lsr #8 /* BE:r1 = .123 LE:r1 = .x32 */ - strh r1, [r0, #0x02] -#ifdef __ARMEB__ - mov r3, r3, lsr #24 /* r3 = ...1 */ - orr r3, r3, r2, lsl #8 /* r3 = xx01 */ -#else - mov r3, r3, lsl #8 /* r3 = 321. */ - orr r3, r3, r2, lsr #24 /* r3 = 3210 */ -#endif - strh r3, [r0] - RET - LMEMCPY_4_PAD - -/* - * 1100: dst is 8-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] /* BE:r2 = 0123 LE:r2 = 3210 */ -#ifdef __ARMEB__ - strb r2, [r0, #0x03] - mov r3, r2, lsr #8 - mov r1, r2, lsr #24 - strh r3, [r0, #0x01] - strb r1, [r0] -#else - strb r2, [r0] - mov r3, r2, lsr #8 - mov r1, r2, lsr #24 - strh r3, [r0, #0x01] - strb r1, [r0, #0x03] -#endif - RET - LMEMCPY_4_PAD - -/* - * 1101: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldrb r1, [r1, #0x03] - strb r2, [r0] - strh r3, [r0, #0x01] - strb r1, [r0, #0x03] - RET - LMEMCPY_4_PAD - -/* - * 1110: dst is 8-bit aligned, src is 16-bit aligned - */ -#ifdef __ARMEB__ - ldrh r3, [r1, #0x02] /* BE:r3 = ..23 LE:r3 = ..32 */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - strb r3, [r0, #0x03] - mov r3, r3, lsr #8 /* r3 = ...2 */ - orr r3, r3, r2, lsl #8 /* r3 = ..12 */ - strh r3, [r0, #0x01] - mov r2, r2, lsr #8 /* r2 = ...0 */ - strb r2, [r0] -#else - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldrh r3, [r1, #0x02] /* BE:r3 = ..23 LE:r3 = ..32 */ - strb r2, [r0] - mov r2, r2, lsr #8 /* r2 = ...1 */ - orr r2, r2, r3, lsl #8 /* r2 = .321 */ - strh r2, [r0, #0x01] - mov r3, r3, lsr #8 /* r3 = ...3 */ - strb r3, [r0, #0x03] -#endif - RET - LMEMCPY_4_PAD - -/* - * 1111: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldrb r1, [r1, #0x03] - strb r2, [r0] - strh r3, [r0, #0x01] - strb r1, [r0, #0x03] - RET - LMEMCPY_4_PAD - - -/****************************************************************************** - * Special case for 6 byte copies - */ -#define LMEMCPY_6_LOG2 6 /* 64 bytes */ -#define LMEMCPY_6_PAD .align LMEMCPY_6_LOG2 - LMEMCPY_6_PAD -.Lmemcpy_6: - and r2, r1, #0x03 - orr r2, r2, r0, lsl #2 - ands r2, r2, #0x0f - sub r3, pc, #0x14 - addne pc, r3, r2, lsl #LMEMCPY_6_LOG2 - -/* - * 0000: dst is 32-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] - ldrh r3, [r1, #0x04] - str r2, [r0] - strh r3, [r0, #0x04] - RET - LMEMCPY_6_PAD - -/* - * 0001: dst is 32-bit aligned, src is 8-bit aligned - */ - ldr r2, [r1, #-1] /* BE:r2 = x012 LE:r2 = 210x */ - ldr r3, [r1, #0x03] /* BE:r3 = 345x LE:r3 = x543 */ -#ifdef __ARMEB__ - mov r2, r2, lsl #8 /* r2 = 012. */ - orr r2, r2, r3, lsr #24 /* r2 = 0123 */ -#else - mov r2, r2, lsr #8 /* r2 = .210 */ - orr r2, r2, r3, lsl #24 /* r2 = 3210 */ -#endif - mov r3, r3, lsr #8 /* BE:r3 = .345 LE:r3 = .x54 */ - str r2, [r0] - strh r3, [r0, #0x04] - RET - LMEMCPY_6_PAD - -/* - * 0010: dst is 32-bit aligned, src is 16-bit aligned - */ - ldr r3, [r1, #0x02] /* BE:r3 = 2345 LE:r3 = 5432 */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ -#ifdef __ARMEB__ - mov r1, r3, lsr #16 /* r1 = ..23 */ - orr r1, r1, r2, lsl #16 /* r1 = 0123 */ - str r1, [r0] - strh r3, [r0, #0x04] -#else - mov r1, r3, lsr #16 /* r1 = ..54 */ - orr r2, r2, r3, lsl #16 /* r2 = 3210 */ - str r2, [r0] - strh r1, [r0, #0x04] -#endif - RET - LMEMCPY_6_PAD - -/* - * 0011: dst is 32-bit aligned, src is 8-bit aligned - */ - ldr r2, [r1, #-3] /* BE:r2 = xxx0 LE:r2 = 0xxx */ - ldr r3, [r1, #1] /* BE:r3 = 1234 LE:r3 = 4321 */ - ldr r1, [r1, #5] /* BE:r1 = 5xxx LE:r3 = xxx5 */ -#ifdef __ARMEB__ - mov r2, r2, lsl #24 /* r2 = 0... */ - orr r2, r2, r3, lsr #8 /* r2 = 0123 */ - mov r3, r3, lsl #8 /* r3 = 234. */ - orr r1, r3, r1, lsr #24 /* r1 = 2345 */ -#else - mov r2, r2, lsr #24 /* r2 = ...0 */ - orr r2, r2, r3, lsl #8 /* r2 = 3210 */ - mov r1, r1, lsl #8 /* r1 = xx5. */ - orr r1, r1, r3, lsr #24 /* r1 = xx54 */ -#endif - str r2, [r0] - strh r1, [r0, #0x04] - RET - LMEMCPY_6_PAD - -/* - * 0100: dst is 8-bit aligned, src is 32-bit aligned - */ - ldr r3, [r1] /* BE:r3 = 0123 LE:r3 = 3210 */ - ldrh r2, [r1, #0x04] /* BE:r2 = ..45 LE:r2 = ..54 */ - mov r1, r3, lsr #8 /* BE:r1 = .012 LE:r1 = .321 */ - strh r1, [r0, #0x01] -#ifdef __ARMEB__ - mov r1, r3, lsr #24 /* r1 = ...0 */ - strb r1, [r0] - mov r3, r3, lsl #8 /* r3 = 123. */ - orr r3, r3, r2, lsr #8 /* r3 = 1234 */ -#else - strb r3, [r0] - mov r3, r3, lsr #24 /* r3 = ...3 */ - orr r3, r3, r2, lsl #8 /* r3 = .543 */ - mov r2, r2, lsr #8 /* r2 = ...5 */ -#endif - strh r3, [r0, #0x03] - strb r2, [r0, #0x05] - RET - LMEMCPY_6_PAD - -/* - * 0101: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldrh ip, [r1, #0x03] - ldrb r1, [r1, #0x05] - strb r2, [r0] - strh r3, [r0, #0x01] - strh ip, [r0, #0x03] - strb r1, [r0, #0x05] - RET - LMEMCPY_6_PAD - -/* - * 0110: dst is 8-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldr r1, [r1, #0x02] /* BE:r1 = 2345 LE:r1 = 5432 */ -#ifdef __ARMEB__ - mov r3, r2, lsr #8 /* r3 = ...0 */ - strb r3, [r0] - strb r1, [r0, #0x05] - mov r3, r1, lsr #8 /* r3 = .234 */ - strh r3, [r0, #0x03] - mov r3, r2, lsl #8 /* r3 = .01. */ - orr r3, r3, r1, lsr #24 /* r3 = .012 */ - strh r3, [r0, #0x01] -#else - strb r2, [r0] - mov r3, r1, lsr #24 - strb r3, [r0, #0x05] - mov r3, r1, lsr #8 /* r3 = .543 */ - strh r3, [r0, #0x03] - mov r3, r2, lsr #8 /* r3 = ...1 */ - orr r3, r3, r1, lsl #8 /* r3 = 4321 */ - strh r3, [r0, #0x01] -#endif - RET - LMEMCPY_6_PAD - -/* - * 0111: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldrh ip, [r1, #0x03] - ldrb r1, [r1, #0x05] - strb r2, [r0] - strh r3, [r0, #0x01] - strh ip, [r0, #0x03] - strb r1, [r0, #0x05] - RET - LMEMCPY_6_PAD - -/* - * 1000: dst is 16-bit aligned, src is 32-bit aligned - */ -#ifdef __ARMEB__ - ldr r2, [r1] /* r2 = 0123 */ - ldrh r3, [r1, #0x04] /* r3 = ..45 */ - mov r1, r2, lsr #16 /* r1 = ..01 */ - orr r3, r3, r2, lsl#16 /* r3 = 2345 */ - strh r1, [r0] - str r3, [r0, #0x02] -#else - ldrh r2, [r1, #0x04] /* r2 = ..54 */ - ldr r3, [r1] /* r3 = 3210 */ - mov r2, r2, lsl #16 /* r2 = 54.. */ - orr r2, r2, r3, lsr #16 /* r2 = 5432 */ - strh r3, [r0] - str r2, [r0, #0x02] -#endif - RET - LMEMCPY_6_PAD - -/* - * 1001: dst is 16-bit aligned, src is 8-bit aligned - */ - ldr r3, [r1, #-1] /* BE:r3 = x012 LE:r3 = 210x */ - ldr r2, [r1, #3] /* BE:r2 = 345x LE:r2 = x543 */ - mov r1, r3, lsr #8 /* BE:r1 = .x01 LE:r1 = .210 */ -#ifdef __ARMEB__ - mov r2, r2, lsr #8 /* r2 = .345 */ - orr r2, r2, r3, lsl #24 /* r2 = 2345 */ -#else - mov r2, r2, lsl #8 /* r2 = 543. */ - orr r2, r2, r3, lsr #24 /* r2 = 5432 */ -#endif - strh r1, [r0] - str r2, [r0, #0x02] - RET - LMEMCPY_6_PAD - -/* - * 1010: dst is 16-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] - ldr r3, [r1, #0x02] - strh r2, [r0] - str r3, [r0, #0x02] - RET - LMEMCPY_6_PAD - -/* - * 1011: dst is 16-bit aligned, src is 8-bit aligned - */ - ldrb r3, [r1] /* r3 = ...0 */ - ldr r2, [r1, #0x01] /* BE:r2 = 1234 LE:r2 = 4321 */ - ldrb r1, [r1, #0x05] /* r1 = ...5 */ -#ifdef __ARMEB__ - mov r3, r3, lsl #8 /* r3 = ..0. */ - orr r3, r3, r2, lsr #24 /* r3 = ..01 */ - orr r1, r1, r2, lsl #8 /* r1 = 2345 */ -#else - orr r3, r3, r2, lsl #8 /* r3 = 3210 */ - mov r1, r1, lsl #24 /* r1 = 5... */ - orr r1, r1, r2, lsr #8 /* r1 = 5432 */ -#endif - strh r3, [r0] - str r1, [r0, #0x02] - RET - LMEMCPY_6_PAD - -/* - * 1100: dst is 8-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] /* BE:r2 = 0123 LE:r2 = 3210 */ - ldrh r1, [r1, #0x04] /* BE:r1 = ..45 LE:r1 = ..54 */ -#ifdef __ARMEB__ - mov r3, r2, lsr #24 /* r3 = ...0 */ - strb r3, [r0] - mov r2, r2, lsl #8 /* r2 = 123. */ - orr r2, r2, r1, lsr #8 /* r2 = 1234 */ -#else - strb r2, [r0] - mov r2, r2, lsr #8 /* r2 = .321 */ - orr r2, r2, r1, lsl #24 /* r2 = 4321 */ - mov r1, r1, lsr #8 /* r1 = ...5 */ -#endif - str r2, [r0, #0x01] - strb r1, [r0, #0x05] - RET - LMEMCPY_6_PAD - -/* - * 1101: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldrh ip, [r1, #0x03] - ldrb r1, [r1, #0x05] - strb r2, [r0] - strh r3, [r0, #0x01] - strh ip, [r0, #0x03] - strb r1, [r0, #0x05] - RET - LMEMCPY_6_PAD - -/* - * 1110: dst is 8-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldr r1, [r1, #0x02] /* BE:r1 = 2345 LE:r1 = 5432 */ -#ifdef __ARMEB__ - mov r3, r2, lsr #8 /* r3 = ...0 */ - strb r3, [r0] - mov r2, r2, lsl #24 /* r2 = 1... */ - orr r2, r2, r1, lsr #8 /* r2 = 1234 */ -#else - strb r2, [r0] - mov r2, r2, lsr #8 /* r2 = ...1 */ - orr r2, r2, r1, lsl #8 /* r2 = 4321 */ - mov r1, r1, lsr #24 /* r1 = ...5 */ -#endif - str r2, [r0, #0x01] - strb r1, [r0, #0x05] - RET - LMEMCPY_6_PAD - -/* - * 1111: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldr r3, [r1, #0x01] - ldrb r1, [r1, #0x05] - strb r2, [r0] - str r3, [r0, #0x01] - strb r1, [r0, #0x05] - RET - LMEMCPY_6_PAD - - -/****************************************************************************** - * Special case for 8 byte copies - */ -#define LMEMCPY_8_LOG2 6 /* 64 bytes */ -#define LMEMCPY_8_PAD .align LMEMCPY_8_LOG2 - LMEMCPY_8_PAD -.Lmemcpy_8: - and r2, r1, #0x03 - orr r2, r2, r0, lsl #2 - ands r2, r2, #0x0f - sub r3, pc, #0x14 - addne pc, r3, r2, lsl #LMEMCPY_8_LOG2 - -/* - * 0000: dst is 32-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] - ldr r3, [r1, #0x04] - str r2, [r0] - str r3, [r0, #0x04] - RET - LMEMCPY_8_PAD - -/* - * 0001: dst is 32-bit aligned, src is 8-bit aligned - */ - ldr r3, [r1, #-1] /* BE:r3 = x012 LE:r3 = 210x */ - ldr r2, [r1, #0x03] /* BE:r2 = 3456 LE:r2 = 6543 */ - ldrb r1, [r1, #0x07] /* r1 = ...7 */ -#ifdef __ARMEB__ - mov r3, r3, lsl #8 /* r3 = 012. */ - orr r3, r3, r2, lsr #24 /* r3 = 0123 */ - orr r2, r1, r2, lsl #8 /* r2 = 4567 */ -#else - mov r3, r3, lsr #8 /* r3 = .210 */ - orr r3, r3, r2, lsl #24 /* r3 = 3210 */ - mov r1, r1, lsl #24 /* r1 = 7... */ - orr r2, r1, r2, lsr #8 /* r2 = 7654 */ -#endif - str r3, [r0] - str r2, [r0, #0x04] - RET - LMEMCPY_8_PAD - -/* - * 0010: dst is 32-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldr r3, [r1, #0x02] /* BE:r3 = 2345 LE:r3 = 5432 */ - ldrh r1, [r1, #0x06] /* BE:r1 = ..67 LE:r1 = ..76 */ -#ifdef __ARMEB__ - mov r2, r2, lsl #16 /* r2 = 01.. */ - orr r2, r2, r3, lsr #16 /* r2 = 0123 */ - orr r3, r1, r3, lsl #16 /* r3 = 4567 */ -#else - orr r2, r2, r3, lsl #16 /* r2 = 3210 */ - mov r3, r3, lsr #16 /* r3 = ..54 */ - orr r3, r3, r1, lsl #16 /* r3 = 7654 */ -#endif - str r2, [r0] - str r3, [r0, #0x04] - RET - LMEMCPY_8_PAD - -/* - * 0011: dst is 32-bit aligned, src is 8-bit aligned - */ - ldrb r3, [r1] /* r3 = ...0 */ - ldr r2, [r1, #0x01] /* BE:r2 = 1234 LE:r2 = 4321 */ - ldr r1, [r1, #0x05] /* BE:r1 = 567x LE:r1 = x765 */ -#ifdef __ARMEB__ - mov r3, r3, lsl #24 /* r3 = 0... */ - orr r3, r3, r2, lsr #8 /* r3 = 0123 */ - mov r2, r2, lsl #24 /* r2 = 4... */ - orr r2, r2, r1, lsr #8 /* r2 = 4567 */ -#else - orr r3, r3, r2, lsl #8 /* r3 = 3210 */ - mov r2, r2, lsr #24 /* r2 = ...4 */ - orr r2, r2, r1, lsl #8 /* r2 = 7654 */ -#endif - str r3, [r0] - str r2, [r0, #0x04] - RET - LMEMCPY_8_PAD - -/* - * 0100: dst is 8-bit aligned, src is 32-bit aligned - */ - ldr r3, [r1] /* BE:r3 = 0123 LE:r3 = 3210 */ - ldr r2, [r1, #0x04] /* BE:r2 = 4567 LE:r2 = 7654 */ -#ifdef __ARMEB__ - mov r1, r3, lsr #24 /* r1 = ...0 */ - strb r1, [r0] - mov r1, r3, lsr #8 /* r1 = .012 */ - strb r2, [r0, #0x07] - mov r3, r3, lsl #24 /* r3 = 3... */ - orr r3, r3, r2, lsr #8 /* r3 = 3456 */ -#else - strb r3, [r0] - mov r1, r2, lsr #24 /* r1 = ...7 */ - strb r1, [r0, #0x07] - mov r1, r3, lsr #8 /* r1 = .321 */ - mov r3, r3, lsr #24 /* r3 = ...3 */ - orr r3, r3, r2, lsl #8 /* r3 = 6543 */ -#endif - strh r1, [r0, #0x01] - str r3, [r0, #0x03] - RET - LMEMCPY_8_PAD - -/* - * 0101: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldr ip, [r1, #0x03] - ldrb r1, [r1, #0x07] - strb r2, [r0] - strh r3, [r0, #0x01] - str ip, [r0, #0x03] - strb r1, [r0, #0x07] - RET - LMEMCPY_8_PAD - -/* - * 0110: dst is 8-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldr r3, [r1, #0x02] /* BE:r3 = 2345 LE:r3 = 5432 */ - ldrh r1, [r1, #0x06] /* BE:r1 = ..67 LE:r1 = ..76 */ -#ifdef __ARMEB__ - mov ip, r2, lsr #8 /* ip = ...0 */ - strb ip, [r0] - mov ip, r2, lsl #8 /* ip = .01. */ - orr ip, ip, r3, lsr #24 /* ip = .012 */ - strb r1, [r0, #0x07] - mov r3, r3, lsl #8 /* r3 = 345. */ - orr r3, r3, r1, lsr #8 /* r3 = 3456 */ -#else - strb r2, [r0] /* 0 */ - mov ip, r1, lsr #8 /* ip = ...7 */ - strb ip, [r0, #0x07] /* 7 */ - mov ip, r2, lsr #8 /* ip = ...1 */ - orr ip, ip, r3, lsl #8 /* ip = 4321 */ - mov r3, r3, lsr #8 /* r3 = .543 */ - orr r3, r3, r1, lsl #24 /* r3 = 6543 */ -#endif - strh ip, [r0, #0x01] - str r3, [r0, #0x03] - RET - LMEMCPY_8_PAD - -/* - * 0111: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r3, [r1] /* r3 = ...0 */ - ldr ip, [r1, #0x01] /* BE:ip = 1234 LE:ip = 4321 */ - ldrh r2, [r1, #0x05] /* BE:r2 = ..56 LE:r2 = ..65 */ - ldrb r1, [r1, #0x07] /* r1 = ...7 */ - strb r3, [r0] - mov r3, ip, lsr #16 /* BE:r3 = ..12 LE:r3 = ..43 */ -#ifdef __ARMEB__ - strh r3, [r0, #0x01] - orr r2, r2, ip, lsl #16 /* r2 = 3456 */ -#else - strh ip, [r0, #0x01] - orr r2, r3, r2, lsl #16 /* r2 = 6543 */ -#endif - str r2, [r0, #0x03] - strb r1, [r0, #0x07] - RET - LMEMCPY_8_PAD - -/* - * 1000: dst is 16-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] /* BE:r2 = 0123 LE:r2 = 3210 */ - ldr r3, [r1, #0x04] /* BE:r3 = 4567 LE:r3 = 7654 */ - mov r1, r2, lsr #16 /* BE:r1 = ..01 LE:r1 = ..32 */ -#ifdef __ARMEB__ - strh r1, [r0] - mov r1, r3, lsr #16 /* r1 = ..45 */ - orr r2, r1 ,r2, lsl #16 /* r2 = 2345 */ -#else - strh r2, [r0] - orr r2, r1, r3, lsl #16 /* r2 = 5432 */ - mov r3, r3, lsr #16 /* r3 = ..76 */ -#endif - str r2, [r0, #0x02] - strh r3, [r0, #0x06] - RET - LMEMCPY_8_PAD - -/* - * 1001: dst is 16-bit aligned, src is 8-bit aligned - */ - ldr r2, [r1, #-1] /* BE:r2 = x012 LE:r2 = 210x */ - ldr r3, [r1, #0x03] /* BE:r3 = 3456 LE:r3 = 6543 */ - ldrb ip, [r1, #0x07] /* ip = ...7 */ - mov r1, r2, lsr #8 /* BE:r1 = .x01 LE:r1 = .210 */ - strh r1, [r0] -#ifdef __ARMEB__ - mov r1, r2, lsl #24 /* r1 = 2... */ - orr r1, r1, r3, lsr #8 /* r1 = 2345 */ - orr r3, ip, r3, lsl #8 /* r3 = 4567 */ -#else - mov r1, r2, lsr #24 /* r1 = ...2 */ - orr r1, r1, r3, lsl #8 /* r1 = 5432 */ - mov r3, r3, lsr #24 /* r3 = ...6 */ - orr r3, r3, ip, lsl #8 /* r3 = ..76 */ -#endif - str r1, [r0, #0x02] - strh r3, [r0, #0x06] - RET - LMEMCPY_8_PAD - -/* - * 1010: dst is 16-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] - ldr ip, [r1, #0x02] - ldrh r3, [r1, #0x06] - strh r2, [r0] - str ip, [r0, #0x02] - strh r3, [r0, #0x06] - RET - LMEMCPY_8_PAD - -/* - * 1011: dst is 16-bit aligned, src is 8-bit aligned - */ - ldr r3, [r1, #0x05] /* BE:r3 = 567x LE:r3 = x765 */ - ldr r2, [r1, #0x01] /* BE:r2 = 1234 LE:r2 = 4321 */ - ldrb ip, [r1] /* ip = ...0 */ - mov r1, r3, lsr #8 /* BE:r1 = .567 LE:r1 = .x76 */ - strh r1, [r0, #0x06] -#ifdef __ARMEB__ - mov r3, r3, lsr #24 /* r3 = ...5 */ - orr r3, r3, r2, lsl #8 /* r3 = 2345 */ - mov r2, r2, lsr #24 /* r2 = ...1 */ - orr r2, r2, ip, lsl #8 /* r2 = ..01 */ -#else - mov r3, r3, lsl #24 /* r3 = 5... */ - orr r3, r3, r2, lsr #8 /* r3 = 5432 */ - orr r2, ip, r2, lsl #8 /* r2 = 3210 */ -#endif - str r3, [r0, #0x02] - strh r2, [r0] - RET - LMEMCPY_8_PAD - -/* - * 1100: dst is 8-bit aligned, src is 32-bit aligned - */ - ldr r3, [r1, #0x04] /* BE:r3 = 4567 LE:r3 = 7654 */ - ldr r2, [r1] /* BE:r2 = 0123 LE:r2 = 3210 */ - mov r1, r3, lsr #8 /* BE:r1 = .456 LE:r1 = .765 */ - strh r1, [r0, #0x05] -#ifdef __ARMEB__ - strb r3, [r0, #0x07] - mov r1, r2, lsr #24 /* r1 = ...0 */ - strb r1, [r0] - mov r2, r2, lsl #8 /* r2 = 123. */ - orr r2, r2, r3, lsr #24 /* r2 = 1234 */ - str r2, [r0, #0x01] -#else - strb r2, [r0] - mov r1, r3, lsr #24 /* r1 = ...7 */ - strb r1, [r0, #0x07] - mov r2, r2, lsr #8 /* r2 = .321 */ - orr r2, r2, r3, lsl #24 /* r2 = 4321 */ - str r2, [r0, #0x01] -#endif - RET - LMEMCPY_8_PAD - -/* - * 1101: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r3, [r1] /* r3 = ...0 */ - ldrh r2, [r1, #0x01] /* BE:r2 = ..12 LE:r2 = ..21 */ - ldr ip, [r1, #0x03] /* BE:ip = 3456 LE:ip = 6543 */ - ldrb r1, [r1, #0x07] /* r1 = ...7 */ - strb r3, [r0] - mov r3, ip, lsr #16 /* BE:r3 = ..34 LE:r3 = ..65 */ -#ifdef __ARMEB__ - strh ip, [r0, #0x05] - orr r2, r3, r2, lsl #16 /* r2 = 1234 */ -#else - strh r3, [r0, #0x05] - orr r2, r2, ip, lsl #16 /* r2 = 4321 */ -#endif - str r2, [r0, #0x01] - strb r1, [r0, #0x07] - RET - LMEMCPY_8_PAD - -/* - * 1110: dst is 8-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldr r3, [r1, #0x02] /* BE:r3 = 2345 LE:r3 = 5432 */ - ldrh r1, [r1, #0x06] /* BE:r1 = ..67 LE:r1 = ..76 */ -#ifdef __ARMEB__ - mov ip, r2, lsr #8 /* ip = ...0 */ - strb ip, [r0] - mov ip, r2, lsl #24 /* ip = 1... */ - orr ip, ip, r3, lsr #8 /* ip = 1234 */ - strb r1, [r0, #0x07] - mov r1, r1, lsr #8 /* r1 = ...6 */ - orr r1, r1, r3, lsl #8 /* r1 = 3456 */ -#else - strb r2, [r0] - mov ip, r2, lsr #8 /* ip = ...1 */ - orr ip, ip, r3, lsl #8 /* ip = 4321 */ - mov r2, r1, lsr #8 /* r2 = ...7 */ - strb r2, [r0, #0x07] - mov r1, r1, lsl #8 /* r1 = .76. */ - orr r1, r1, r3, lsr #24 /* r1 = .765 */ -#endif - str ip, [r0, #0x01] - strh r1, [r0, #0x05] - RET - LMEMCPY_8_PAD - -/* - * 1111: dst is 8-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] - ldr ip, [r1, #0x01] - ldrh r3, [r1, #0x05] - ldrb r1, [r1, #0x07] - strb r2, [r0] - str ip, [r0, #0x01] - strh r3, [r0, #0x05] - strb r1, [r0, #0x07] - RET - LMEMCPY_8_PAD - -/****************************************************************************** - * Special case for 12 byte copies - */ -#define LMEMCPY_C_LOG2 7 /* 128 bytes */ -#define LMEMCPY_C_PAD .align LMEMCPY_C_LOG2 - LMEMCPY_C_PAD -.Lmemcpy_c: - and r2, r1, #0x03 - orr r2, r2, r0, lsl #2 - ands r2, r2, #0x0f - sub r3, pc, #0x14 - addne pc, r3, r2, lsl #LMEMCPY_C_LOG2 - -/* - * 0000: dst is 32-bit aligned, src is 32-bit aligned - */ - ldr r2, [r1] - ldr r3, [r1, #0x04] - ldr r1, [r1, #0x08] - str r2, [r0] - str r3, [r0, #0x04] - str r1, [r0, #0x08] - RET - LMEMCPY_C_PAD - -/* - * 0001: dst is 32-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1, #0xb] /* r2 = ...B */ - ldr ip, [r1, #0x07] /* BE:ip = 789A LE:ip = A987 */ - ldr r3, [r1, #0x03] /* BE:r3 = 3456 LE:r3 = 6543 */ - ldr r1, [r1, #-1] /* BE:r1 = x012 LE:r1 = 210x */ -#ifdef __ARMEB__ - orr r2, r2, ip, lsl #8 /* r2 = 89AB */ - str r2, [r0, #0x08] - mov r2, ip, lsr #24 /* r2 = ...7 */ - orr r2, r2, r3, lsl #8 /* r2 = 4567 */ - mov r1, r1, lsl #8 /* r1 = 012. */ - orr r1, r1, r3, lsr #24 /* r1 = 0123 */ -#else - mov r2, r2, lsl #24 /* r2 = B... */ - orr r2, r2, ip, lsr #8 /* r2 = BA98 */ - str r2, [r0, #0x08] - mov r2, ip, lsl #24 /* r2 = 7... */ - orr r2, r2, r3, lsr #8 /* r2 = 7654 */ - mov r1, r1, lsr #8 /* r1 = .210 */ - orr r1, r1, r3, lsl #24 /* r1 = 3210 */ -#endif - str r2, [r0, #0x04] - str r1, [r0] - RET - LMEMCPY_C_PAD - -/* - * 0010: dst is 32-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldr r3, [r1, #0x02] /* BE:r3 = 2345 LE:r3 = 5432 */ - ldr ip, [r1, #0x06] /* BE:ip = 6789 LE:ip = 9876 */ - ldrh r1, [r1, #0x0a] /* BE:r1 = ..AB LE:r1 = ..BA */ -#ifdef __ARMEB__ - mov r2, r2, lsl #16 /* r2 = 01.. */ - orr r2, r2, r3, lsr #16 /* r2 = 0123 */ - str r2, [r0] - mov r3, r3, lsl #16 /* r3 = 45.. */ - orr r3, r3, ip, lsr #16 /* r3 = 4567 */ - orr r1, r1, ip, lsl #16 /* r1 = 89AB */ -#else - orr r2, r2, r3, lsl #16 /* r2 = 3210 */ - str r2, [r0] - mov r3, r3, lsr #16 /* r3 = ..54 */ - orr r3, r3, ip, lsl #16 /* r3 = 7654 */ - mov r1, r1, lsl #16 /* r1 = BA.. */ - orr r1, r1, ip, lsr #16 /* r1 = BA98 */ -#endif - str r3, [r0, #0x04] - str r1, [r0, #0x08] - RET - LMEMCPY_C_PAD - -/* - * 0011: dst is 32-bit aligned, src is 8-bit aligned - */ - ldrb r2, [r1] /* r2 = ...0 */ - ldr r3, [r1, #0x01] /* BE:r3 = 1234 LE:r3 = 4321 */ - ldr ip, [r1, #0x05] /* BE:ip = 5678 LE:ip = 8765 */ - ldr r1, [r1, #0x09] /* BE:r1 = 9ABx LE:r1 = xBA9 */ -#ifdef __ARMEB__ - mov r2, r2, lsl #24 /* r2 = 0... */ - orr r2, r2, r3, lsr #8 /* r2 = 0123 */ - str r2, [r0] - mov r3, r3, lsl #24 /* r3 = 4... */ - orr r3, r3, ip, lsr #8 /* r3 = 4567 */ - mov r1, r1, lsr #8 /* r1 = .9AB */ - orr r1, r1, ip, lsl #24 /* r1 = 89AB */ -#else - orr r2, r2, r3, lsl #8 /* r2 = 3210 */ - str r2, [r0] - mov r3, r3, lsr #24 /* r3 = ...4 */ - orr r3, r3, ip, lsl #8 /* r3 = 7654 */ - mov r1, r1, lsl #8 /* r1 = BA9. */ - orr r1, r1, ip, lsr #24 /* r1 = BA98 */ -#endif - str r3, [r0, #0x04] - str r1, [r0, #0x08] - RET - LMEMCPY_C_PAD - -/* - * 0100: dst is 8-bit aligned (byte 1), src is 32-bit aligned - */ - ldr r2, [r1] /* BE:r2 = 0123 LE:r2 = 3210 */ - ldr r3, [r1, #0x04] /* BE:r3 = 4567 LE:r3 = 7654 */ - ldr ip, [r1, #0x08] /* BE:ip = 89AB LE:ip = BA98 */ - mov r1, r2, lsr #8 /* BE:r1 = .012 LE:r1 = .321 */ - strh r1, [r0, #0x01] -#ifdef __ARMEB__ - mov r1, r2, lsr #24 /* r1 = ...0 */ - strb r1, [r0] - mov r1, r2, lsl #24 /* r1 = 3... */ - orr r2, r1, r3, lsr #8 /* r1 = 3456 */ - mov r1, r3, lsl #24 /* r1 = 7... */ - orr r1, r1, ip, lsr #8 /* r1 = 789A */ -#else - strb r2, [r0] - mov r1, r2, lsr #24 /* r1 = ...3 */ - orr r2, r1, r3, lsl #8 /* r1 = 6543 */ - mov r1, r3, lsr #24 /* r1 = ...7 */ - orr r1, r1, ip, lsl #8 /* r1 = A987 */ - mov ip, ip, lsr #24 /* ip = ...B */ -#endif - str r2, [r0, #0x03] - str r1, [r0, #0x07] - strb ip, [r0, #0x0b] - RET - LMEMCPY_C_PAD - -/* - * 0101: dst is 8-bit aligned (byte 1), src is 8-bit aligned (byte 1) - */ - ldrb r2, [r1] - ldrh r3, [r1, #0x01] - ldr ip, [r1, #0x03] - strb r2, [r0] - ldr r2, [r1, #0x07] - ldrb r1, [r1, #0x0b] - strh r3, [r0, #0x01] - str ip, [r0, #0x03] - str r2, [r0, #0x07] - strb r1, [r0, #0x0b] - RET - LMEMCPY_C_PAD - -/* - * 0110: dst is 8-bit aligned (byte 1), src is 16-bit aligned - */ - ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - ldr r3, [r1, #0x02] /* BE:r3 = 2345 LE:r3 = 5432 */ - ldr ip, [r1, #0x06] /* BE:ip = 6789 LE:ip = 9876 */ - ldrh r1, [r1, #0x0a] /* BE:r1 = ..AB LE:r1 = ..BA */ -#ifdef __ARMEB__ - mov r2, r2, ror #8 /* r2 = 1..0 */ - strb r2, [r0] - mov r2, r2, lsr #16 /* r2 = ..1. */ - orr r2, r2, r3, lsr #24 /* r2 = ..12 */ - strh r2, [r0, #0x01] - mov r2, r3, lsl #8 /* r2 = 345. */ - orr r3, r2, ip, lsr #24 /* r3 = 3456 */ - mov r2, ip, lsl #8 /* r2 = 789. */ - orr r2, r2, r1, lsr #8 /* r2 = 789A */ -#else - strb r2, [r0] - mov r2, r2, lsr #8 /* r2 = ...1 */ - orr r2, r2, r3, lsl #8 /* r2 = 4321 */ - strh r2, [r0, #0x01] - mov r2, r3, lsr #8 /* r2 = .543 */ - orr r3, r2, ip, lsl #24 /* r3 = 6543 */ - mov r2, ip, lsr #8 /* r2 = .987 */ - orr r2, r2, r1, lsl #24 /* r2 = A987 */ - mov r1, r1, lsr #8 /* r1 = ...B */ -#endif - str r3, [r0, #0x03] - str r2, [r0, #0x07] - strb r1, [r0, #0x0b] - RET - LMEMCPY_C_PAD - -/* - * 0111: dst is 8-bit aligned (byte 1), src is 8-bit aligned (byte 3) - */ - ldrb r2, [r1] - ldr r3, [r1, #0x01] /* BE:r3 = 1234 LE:r3 = 4321 */ - ldr ip, [r1, #0x05] /* BE:ip = 5678 LE:ip = 8765 */ - ldr r1, [r1, #0x09] /* BE:r1 = 9ABx LE:r1 = xBA9 */ - strb r2, [r0] -#ifdef __ARMEB__ - mov r2, r3, lsr #16 /* r2 = ..12 */ - strh r2, [r0, #0x01] - mov r3, r3, lsl #16 /* r3 = 34.. */ - orr r3, r3, ip, lsr #16 /* r3 = 3456 */ - mov ip, ip, lsl #16 /* ip = 78.. */ - orr ip, ip, r1, lsr #16 /* ip = 789A */ - mov r1, r1, lsr #8 /* r1 = .9AB */ -#else - strh r3, [r0, #0x01] - mov r3, r3, lsr #16 /* r3 = ..43 */ - orr r3, r3, ip, lsl #16 /* r3 = 6543 */ - mov ip, ip, lsr #16 /* ip = ..87 */ - orr ip, ip, r1, lsl #16 /* ip = A987 */ - mov r1, r1, lsr #16 /* r1 = ..xB */ -#endif - str r3, [r0, #0x03] - str ip, [r0, #0x07] - strb r1, [r0, #0x0b] - RET - LMEMCPY_C_PAD - -/* - * 1000: dst is 16-bit aligned, src is 32-bit aligned - */ - ldr ip, [r1] /* BE:ip = 0123 LE:ip = 3210 */ - ldr r3, [r1, #0x04] /* BE:r3 = 4567 LE:r3 = 7654 */ - ldr r2, [r1, #0x08] /* BE:r2 = 89AB LE:r2 = BA98 */ - mov r1, ip, lsr #16 /* BE:r1 = ..01 LE:r1 = ..32 */ -#ifdef __ARMEB__ - strh r1, [r0] - mov r1, ip, lsl #16 /* r1 = 23.. */ - orr r1, r1, r3, lsr #16 /* r1 = 2345 */ - mov r3, r3, lsl #16 /* r3 = 67.. */ - orr r3, r3, r2, lsr #16 /* r3 = 6789 */ -#else - strh ip, [r0] - orr r1, r1, r3, lsl #16 /* r1 = 5432 */ - mov r3, r3, lsr #16 /* r3 = ..76 */ - orr r3, r3, r2, lsl #16 /* r3 = 9876 */ - mov r2, r2, lsr #16 /* r2 = ..BA */ -#endif - str r1, [r0, #0x02] - str r3, [r0, #0x06] - strh r2, [r0, #0x0a] - RET - LMEMCPY_C_PAD - -/* - * 1001: dst is 16-bit aligned, src is 8-bit aligned (byte 1) - */ - ldr r2, [r1, #-1] /* BE:r2 = x012 LE:r2 = 210x */ - ldr r3, [r1, #0x03] /* BE:r3 = 3456 LE:r3 = 6543 */ - mov ip, r2, lsr #8 /* BE:ip = .x01 LE:ip = .210 */ - strh ip, [r0] - ldr ip, [r1, #0x07] /* BE:ip = 789A LE:ip = A987 */ - ldrb r1, [r1, #0x0b] /* r1 = ...B */ -#ifdef __ARMEB__ - mov r2, r2, lsl #24 /* r2 = 2... */ - orr r2, r2, r3, lsr #8 /* r2 = 2345 */ - mov r3, r3, lsl #24 /* r3 = 6... */ - orr r3, r3, ip, lsr #8 /* r3 = 6789 */ - orr r1, r1, ip, lsl #8 /* r1 = 89AB */ -#else - mov r2, r2, lsr #24 /* r2 = ...2 */ - orr r2, r2, r3, lsl #8 /* r2 = 5432 */ - mov r3, r3, lsr #24 /* r3 = ...6 */ - orr r3, r3, ip, lsl #8 /* r3 = 9876 */ - mov r1, r1, lsl #8 /* r1 = ..B. */ - orr r1, r1, ip, lsr #24 /* r1 = ..BA */ -#endif - str r2, [r0, #0x02] - str r3, [r0, #0x06] - strh r1, [r0, #0x0a] - RET - LMEMCPY_C_PAD - -/* - * 1010: dst is 16-bit aligned, src is 16-bit aligned - */ - ldrh r2, [r1] - ldr r3, [r1, #0x02] - ldr ip, [r1, #0x06] - ldrh r1, [r1, #0x0a] - strh r2, [r0] - str r3, [r0, #0x02] - str ip, [r0, #0x06] - strh r1, [r0, #0x0a] - RET - LMEMCPY_C_PAD - -/* - * 1011: dst is 16-bit aligned, src is 8-bit aligned (byte 3) - */ - ldr r2, [r1, #0x09] /* BE:r2 = 9ABx LE:r2 = xBA9 */ - ldr r3, [r1, #0x05] /* BE:r3 = 5678 LE:r3 = 8765 */ - mov ip, r2, lsr #8 /* BE:ip = .9AB LE:ip = .xBA */ - strh ip, [r0, #0x0a] - ldr ip, [r1, #0x01] /* BE:ip = 1234 LE:ip = 4321 */ - ldrb r1, [r1] /* r1 = ...0 */ -#ifdef __ARMEB__ - mov r2, r2, lsr #24 /* r2 = ...9 */ - orr r2, r2, r3, lsl #8 /* r2 = 6789 */ - mov r3, r3, lsr #24 /* r3 = ...5 */ - orr r3, r3, ip, lsl #8 /* r3 = 2345 */ - mov r1, r1, lsl #8 /* r1 = ..0. */ - orr r1, r1, ip, lsr #24 /* r1 = ..01 */ -#else - mov r2, r2, lsl #24 /* r2 = 9... */ - orr r2, r2, r3, lsr #8 /* r2 = 9876 */ - mov r3, r3, lsl #24 /* r3 = 5... */ - orr r3, r3, ip, lsr #8 /* r3 = 5432 */ - orr r1, r1, ip, lsl #8 /* r1 = 3210 */ -#endif - str r2, [r0, #0x06] - str r3, [r0, #0x02] - strh r1, [r0] - RET - LMEMCPY_C_PAD - -/* - * 1100: dst is 8-bit aligned (byte 3), src is 32-bit aligned - */ - ldr r2, [r1] /* BE:r2 = 0123 LE:r2 = 3210 */ - ldr ip, [r1, #0x04] /* BE:ip = 4567 LE:ip = 7654 */ - ldr r1, [r1, #0x08] /* BE:r1 = 89AB LE:r1 = BA98 */ -#ifdef __ARMEB__ - mov r3, r2, lsr #24 /* r3 = ...0 */ - strb r3, [r0] - mov r2, r2, lsl #8 /* r2 = 123. */ - orr r2, r2, ip, lsr #24 /* r2 = 1234 */ - str r2, [r0, #0x01] - mov r2, ip, lsl #8 /* r2 = 567. */ - orr r2, r2, r1, lsr #24 /* r2 = 5678 */ - str r2, [r0, #0x05] - mov r2, r1, lsr #8 /* r2 = ..9A */ - strh r2, [r0, #0x09] - strb r1, [r0, #0x0b] -#else - strb r2, [r0] - mov r3, r2, lsr #8 /* r3 = .321 */ - orr r3, r3, ip, lsl #24 /* r3 = 4321 */ - str r3, [r0, #0x01] - mov r3, ip, lsr #8 /* r3 = .765 */ - orr r3, r3, r1, lsl #24 /* r3 = 8765 */ - str r3, [r0, #0x05] - mov r1, r1, lsr #8 /* r1 = .BA9 */ - strh r1, [r0, #0x09] - mov r1, r1, lsr #16 /* r1 = ...B */ - strb r1, [r0, #0x0b] -#endif - RET - LMEMCPY_C_PAD - -/* - * 1101: dst is 8-bit aligned (byte 3), src is 8-bit aligned (byte 1) - */ - ldrb r2, [r1, #0x0b] /* r2 = ...B */ - ldr r3, [r1, #0x07] /* BE:r3 = 789A LE:r3 = A987 */ - ldr ip, [r1, #0x03] /* BE:ip = 3456 LE:ip = 6543 */ - ldr r1, [r1, #-1] /* BE:r1 = x012 LE:r1 = 210x */ - strb r2, [r0, #0x0b] -#ifdef __ARMEB__ - strh r3, [r0, #0x09] - mov r3, r3, lsr #16 /* r3 = ..78 */ - orr r3, r3, ip, lsl #16 /* r3 = 5678 */ - mov ip, ip, lsr #16 /* ip = ..34 */ - orr ip, ip, r1, lsl #16 /* ip = 1234 */ - mov r1, r1, lsr #16 /* r1 = ..x0 */ -#else - mov r2, r3, lsr #16 /* r2 = ..A9 */ - strh r2, [r0, #0x09] - mov r3, r3, lsl #16 /* r3 = 87.. */ - orr r3, r3, ip, lsr #16 /* r3 = 8765 */ - mov ip, ip, lsl #16 /* ip = 43.. */ - orr ip, ip, r1, lsr #16 /* ip = 4321 */ - mov r1, r1, lsr #8 /* r1 = .210 */ -#endif - str r3, [r0, #0x05] - str ip, [r0, #0x01] - strb r1, [r0] - RET - LMEMCPY_C_PAD - -/* - * 1110: dst is 8-bit aligned (byte 3), src is 16-bit aligned - */ -#ifdef __ARMEB__ - ldrh r2, [r1, #0x0a] /* r2 = ..AB */ - ldr ip, [r1, #0x06] /* ip = 6789 */ - ldr r3, [r1, #0x02] /* r3 = 2345 */ - ldrh r1, [r1] /* r1 = ..01 */ - strb r2, [r0, #0x0b] - mov r2, r2, lsr #8 /* r2 = ...A */ - orr r2, r2, ip, lsl #8 /* r2 = 789A */ - mov ip, ip, lsr #8 /* ip = .678 */ - orr ip, ip, r3, lsl #24 /* ip = 5678 */ - mov r3, r3, lsr #8 /* r3 = .234 */ - orr r3, r3, r1, lsl #24 /* r3 = 1234 */ - mov r1, r1, lsr #8 /* r1 = ...0 */ - strb r1, [r0] - str r3, [r0, #0x01] - str ip, [r0, #0x05] - strh r2, [r0, #0x09] -#else - ldrh r2, [r1] /* r2 = ..10 */ - ldr r3, [r1, #0x02] /* r3 = 5432 */ - ldr ip, [r1, #0x06] /* ip = 9876 */ - ldrh r1, [r1, #0x0a] /* r1 = ..BA */ - strb r2, [r0] - mov r2, r2, lsr #8 /* r2 = ...1 */ - orr r2, r2, r3, lsl #8 /* r2 = 4321 */ - mov r3, r3, lsr #24 /* r3 = ...5 */ - orr r3, r3, ip, lsl #8 /* r3 = 8765 */ - mov ip, ip, lsr #24 /* ip = ...9 */ - orr ip, ip, r1, lsl #8 /* ip = .BA9 */ - mov r1, r1, lsr #8 /* r1 = ...B */ - str r2, [r0, #0x01] - str r3, [r0, #0x05] - strh ip, [r0, #0x09] - strb r1, [r0, #0x0b] -#endif - RET - LMEMCPY_C_PAD - -/* - * 1111: dst is 8-bit aligned (byte 3), src is 8-bit aligned (byte 3) - */ - ldrb r2, [r1] - ldr r3, [r1, #0x01] - ldr ip, [r1, #0x05] - strb r2, [r0] - ldrh r2, [r1, #0x09] - ldrb r1, [r1, #0x0b] - str r3, [r0, #0x01] - str ip, [r0, #0x05] - strh r2, [r0, #0x09] - strb r1, [r0, #0x0b] - RET -END(memcpy) -#endif /* !_STANDALONE */ diff --git a/common/lib/libc/arch/arm/string/memmove.S b/common/lib/libc/arch/arm/string/memmove.S deleted file mode 100644 index f1d39cd71..000000000 --- a/common/lib/libc/arch/arm/string/memmove.S +++ /dev/null @@ -1,592 +0,0 @@ -/* $NetBSD: memmove.S,v 1.9 2015/03/26 13:34:51 justin Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Neil A. Carson and Mark Brinicombe - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#ifndef _BCOPY -/* LINTSTUB: Func: void *memmove(void *, const void *, size_t) */ -ENTRY(memmove) -#else -/* bcopy = memcpy/memmove with arguments reversed. */ -/* LINTSTUB: Func: void bcopy(void *, void *, size_t) */ -ENTRY(bcopy) - /* switch the source and destination registers */ - eor r0, r1, r0 - eor r1, r0, r1 - eor r0, r1, r0 -#endif - /* Do the buffers overlap? */ - cmp r0, r1 - RETc(eq) /* Bail now if src/dst are the same */ - subhs r3, r0, r1 /* if (dst > src) r3 = dst - src */ - sublo r3, r1, r0 /* if (src > dst) r3 = src - dst */ - cmp r3, r2 /* if (r3 >= len) we have an overlap */ - bhs PLT_SYM(_C_LABEL(memcpy)) - - /* Determine copy direction */ - cmp r1, r0 - bcc .Lmemmove_backwards - - moveq r0, #0 /* Quick abort for len=0 */ - RETc(eq) - - push {r0, lr} /* memmove() returns dest addr */ - subs r2, r2, #4 - blt .Lmemmove_fl4 /* less than 4 bytes */ - ands r12, r0, #3 - bne .Lmemmove_fdestul /* oh unaligned destination addr */ - ands r12, r1, #3 - bne .Lmemmove_fsrcul /* oh unaligned source addr */ - -.Lmemmove_ft8: - /* We have aligned source and destination */ - subs r2, r2, #8 - blt .Lmemmove_fl12 /* less than 12 bytes (4 from above) */ - subs r2, r2, #0x14 - blt .Lmemmove_fl32 /* less than 32 bytes (12 from above) */ - push {r4} /* borrow r4 */ - - /* blat 32 bytes at a time */ - /* XXX for really big copies perhaps we should use more registers */ -.Lmemmove_floop32: - ldmia r1!, {r3, r4, r12, lr} - stmia r0!, {r3, r4, r12, lr} - ldmia r1!, {r3, r4, r12, lr} - stmia r0!, {r3, r4, r12, lr} - subs r2, r2, #0x20 - bge .Lmemmove_floop32 - - cmn r2, #0x10 - ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ - stmiage r0!, {r3, r4, r12, lr} - subge r2, r2, #0x10 - pop {r4} /* return r4 */ - -.Lmemmove_fl32: - adds r2, r2, #0x14 - - /* blat 12 bytes at a time */ -.Lmemmove_floop12: - ldmiage r1!, {r3, r12, lr} - stmiage r0!, {r3, r12, lr} - subsge r2, r2, #0x0c - bge .Lmemmove_floop12 - -.Lmemmove_fl12: - adds r2, r2, #8 - blt .Lmemmove_fl4 - - subs r2, r2, #4 - ldrlt r3, [r1], #4 - strlt r3, [r0], #4 - ldmiage r1!, {r3, r12} - stmiage r0!, {r3, r12} - subge r2, r2, #4 - -.Lmemmove_fl4: - /* less than 4 bytes to go */ - adds r2, r2, #4 - popeq {r0, pc} /* done */ - - /* copy the crud byte at a time */ - cmp r2, #2 - ldrb r3, [r1], #1 - strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 - pop {r0, pc} - - /* erg - unaligned destination */ -.Lmemmove_fdestul: - rsb r12, r12, #4 - cmp r12, #2 - - /* align destination with byte copies */ - ldrb r3, [r1], #1 - strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 - subs r2, r2, r12 - blt .Lmemmove_fl4 /* less the 4 bytes */ - - ands r12, r1, #3 - beq .Lmemmove_ft8 /* we have an aligned source */ - - /* erg - unaligned source */ - /* This is where it gets nasty ... */ -.Lmemmove_fsrcul: - bic r1, r1, #3 - ldr lr, [r1], #4 - cmp r12, #2 - bgt .Lmemmove_fsrcul3 - beq .Lmemmove_fsrcul2 - cmp r2, #0x0c - blt .Lmemmove_fsrcul1loop4 - sub r2, r2, #0x0c - push {r4, r5} - -.Lmemmove_fsrcul1loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #8 -#else - mov r3, lr, lsr #8 -#endif - ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #24 - mov r4, r4, lsl #8 - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r12, lsr #24 - mov r12, r12, lsl #8 - orr r12, r12, lr, lsr #24 -#else - orr r3, r3, r4, lsl #24 - mov r4, r4, lsr #8 - orr r4, r4, r5, lsl #24 - mov r5, r5, lsr #8 - orr r5, r5, r12, lsl #24 - mov r12, r12, lsr #8 - orr r12, r12, lr, lsl #24 -#endif - stmia r0!, {r3-r5, r12} - subs r2, r2, #0x10 - bge .Lmemmove_fsrcul1loop16 - pop {r4, r5} - adds r2, r2, #0x0c - blt .Lmemmove_fsrcul1l4 - -.Lmemmove_fsrcul1loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #8 -#else - mov r12, lr, lsr #8 -#endif - ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #24 -#else - orr r12, r12, lr, lsl #24 -#endif - str r12, [r0], #4 - subs r2, r2, #4 - bge .Lmemmove_fsrcul1loop4 - -.Lmemmove_fsrcul1l4: - sub r1, r1, #3 - b .Lmemmove_fl4 - -.Lmemmove_fsrcul2: - cmp r2, #0x0c - blt .Lmemmove_fsrcul2loop4 - sub r2, r2, #0x0c - push {r4, r5} - -.Lmemmove_fsrcul2loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #16 -#else - mov r3, lr, lsr #16 -#endif - ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #16 - mov r4, r4, lsl #16 - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r12, lsr #16 - mov r12, r12, lsl #16 - orr r12, r12, lr, lsr #16 -#else - orr r3, r3, r4, lsl #16 - mov r4, r4, lsr #16 - orr r4, r4, r5, lsl #16 - mov r5, r5, lsr #16 - orr r5, r5, r12, lsl #16 - mov r12, r12, lsr #16 - orr r12, r12, lr, lsl #16 -#endif - stmia r0!, {r3-r5, r12} - subs r2, r2, #0x10 - bge .Lmemmove_fsrcul2loop16 - pop {r4, r5} - adds r2, r2, #0x0c - blt .Lmemmove_fsrcul2l4 - -.Lmemmove_fsrcul2loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #16 -#else - mov r12, lr, lsr #16 -#endif - ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #16 -#else - orr r12, r12, lr, lsl #16 -#endif - str r12, [r0], #4 - subs r2, r2, #4 - bge .Lmemmove_fsrcul2loop4 - -.Lmemmove_fsrcul2l4: - sub r1, r1, #2 - b .Lmemmove_fl4 - -.Lmemmove_fsrcul3: - cmp r2, #0x0c - blt .Lmemmove_fsrcul3loop4 - sub r2, r2, #0x0c - push {r4, r5} - -.Lmemmove_fsrcul3loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #24 -#else - mov r3, lr, lsr #24 -#endif - ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #8 - mov r4, r4, lsl #24 - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r12, lsr #8 - mov r12, r12, lsl #24 - orr r12, r12, lr, lsr #8 -#else - orr r3, r3, r4, lsl #8 - mov r4, r4, lsr #24 - orr r4, r4, r5, lsl #8 - mov r5, r5, lsr #24 - orr r5, r5, r12, lsl #8 - mov r12, r12, lsr #24 - orr r12, r12, lr, lsl #8 -#endif - stmia r0!, {r3-r5, r12} - subs r2, r2, #0x10 - bge .Lmemmove_fsrcul3loop16 - pop {r4, r5} - adds r2, r2, #0x0c - blt .Lmemmove_fsrcul3l4 - -.Lmemmove_fsrcul3loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #24 -#else - mov r12, lr, lsr #24 -#endif - ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #8 -#else - orr r12, r12, lr, lsl #8 -#endif - str r12, [r0], #4 - subs r2, r2, #4 - bge .Lmemmove_fsrcul3loop4 - -.Lmemmove_fsrcul3l4: - sub r1, r1, #1 - b .Lmemmove_fl4 - -.Lmemmove_backwards: - add r1, r1, r2 - add r0, r0, r2 - subs r2, r2, #4 - blt .Lmemmove_bl4 /* less than 4 bytes */ - ands r12, r0, #3 - bne .Lmemmove_bdestul /* oh unaligned destination addr */ - ands r12, r1, #3 - bne .Lmemmove_bsrcul /* oh unaligned source addr */ - -.Lmemmove_bt8: - /* We have aligned source and destination */ - subs r2, r2, #8 - blt .Lmemmove_bl12 /* less than 12 bytes (4 from above) */ - push {r4, lr} - subs r2, r2, #0x14 /* less than 32 bytes (12 from above) */ - blt .Lmemmove_bl32 - - /* blat 32 bytes at a time */ - /* XXX for really big copies perhaps we should use more registers */ -.Lmemmove_bloop32: - ldmdb r1!, {r3, r4, r12, lr} - stmdb r0!, {r3, r4, r12, lr} - ldmdb r1!, {r3, r4, r12, lr} - stmdb r0!, {r3, r4, r12, lr} - subs r2, r2, #0x20 - bge .Lmemmove_bloop32 - -.Lmemmove_bl32: - cmn r2, #0x10 - ldmdbge r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ - stmdbge r0!, {r3, r4, r12, lr} - subge r2, r2, #0x10 - adds r2, r2, #0x14 - ldmdbge r1!, {r3, r12, lr} /* blat a remaining 12 bytes */ - stmdbge r0!, {r3, r12, lr} - subge r2, r2, #0x0c - pop {r4, lr} - -.Lmemmove_bl12: - adds r2, r2, #8 - blt .Lmemmove_bl4 - subs r2, r2, #4 - ldrlt r3, [r1, #-4]! - strlt r3, [r0, #-4]! - ldmdbge r1!, {r3, r12} - stmdbge r0!, {r3, r12} - subge r2, r2, #4 - -.Lmemmove_bl4: - /* less than 4 bytes to go */ - adds r2, r2, #4 - RETc(eq) - - /* copy the crud byte at a time */ - cmp r2, #2 - ldrb r3, [r1, #-1]! - strb r3, [r0, #-1]! - ldrbge r3, [r1, #-1]! - strbge r3, [r0, #-1]! - ldrbgt r3, [r1, #-1]! - strbgt r3, [r0, #-1]! - RET - - /* erg - unaligned destination */ -.Lmemmove_bdestul: - cmp r12, #2 - - /* align destination with byte copies */ - ldrb r3, [r1, #-1]! - strb r3, [r0, #-1]! - ldrbge r3, [r1, #-1]! - strbge r3, [r0, #-1]! - ldrbgt r3, [r1, #-1]! - strbgt r3, [r0, #-1]! - subs r2, r2, r12 - blt .Lmemmove_bl4 /* less than 4 bytes to go */ - ands r12, r1, #3 - beq .Lmemmove_bt8 /* we have an aligned source */ - - /* erg - unaligned source */ - /* This is where it gets nasty ... */ -.Lmemmove_bsrcul: - bic r1, r1, #3 - ldr r3, [r1, #0] - cmp r12, #2 - blt .Lmemmove_bsrcul1 - beq .Lmemmove_bsrcul2 - cmp r2, #0x0c - blt .Lmemmove_bsrcul3loop4 - sub r2, r2, #0x0c - push {r4, r5, lr} - -.Lmemmove_bsrcul3loop16: -#ifdef __ARMEB__ - mov lr, r3, lsr #8 -#else - mov lr, r3, lsl #8 -#endif - ldmdb r1!, {r3-r5, r12} -#ifdef __ARMEB__ - orr lr, lr, r12, lsl #24 - mov r12, r12, lsr #8 - orr r12, r12, r5, lsl #24 - mov r5, r5, lsr #8 - orr r5, r5, r4, lsl #24 - mov r4, r4, lsr #8 - orr r4, r4, r3, lsl #24 -#else - orr lr, lr, r12, lsr #24 - mov r12, r12, lsl #8 - orr r12, r12, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r4, lsr #24 - mov r4, r4, lsl #8 - orr r4, r4, r3, lsr #24 -#endif - stmdb r0!, {r4, r5, r12, lr} - subs r2, r2, #0x10 - bge .Lmemmove_bsrcul3loop16 - pop {r4, r5, lr} - adds r2, r2, #0x0c - blt .Lmemmove_bsrcul3l4 - -.Lmemmove_bsrcul3loop4: -#ifdef __ARMEB__ - mov r12, r3, lsr #8 -#else - mov r12, r3, lsl #8 -#endif - ldr r3, [r1, #-4]! -#ifdef __ARMEB__ - orr r12, r12, r3, lsl #24 -#else - orr r12, r12, r3, lsr #24 -#endif - str r12, [r0, #-4]! - subs r2, r2, #4 - bge .Lmemmove_bsrcul3loop4 - -.Lmemmove_bsrcul3l4: - add r1, r1, #3 - b .Lmemmove_bl4 - -.Lmemmove_bsrcul2: - cmp r2, #0x0c - blt .Lmemmove_bsrcul2loop4 - sub r2, r2, #0x0c - push {r4, r5, lr} - -.Lmemmove_bsrcul2loop16: -#ifdef __ARMEB__ - mov lr, r3, lsr #16 -#else - mov lr, r3, lsl #16 -#endif - ldmdb r1!, {r3-r5, r12} -#ifdef __ARMEB__ - orr lr, lr, r12, lsl #16 - mov r12, r12, lsr #16 - orr r12, r12, r5, lsl #16 - mov r5, r5, lsr #16 - orr r5, r5, r4, lsl #16 - mov r4, r4, lsr #16 - orr r4, r4, r3, lsl #16 -#else - orr lr, lr, r12, lsr #16 - mov r12, r12, lsl #16 - orr r12, r12, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r4, lsr #16 - mov r4, r4, lsl #16 - orr r4, r4, r3, lsr #16 -#endif - stmdb r0!, {r4, r5, r12, lr} - subs r2, r2, #0x10 - bge .Lmemmove_bsrcul2loop16 - pop {r4, r5, lr} - adds r2, r2, #0x0c - blt .Lmemmove_bsrcul2l4 - -.Lmemmove_bsrcul2loop4: -#ifdef __ARMEB__ - mov r12, r3, lsr #16 -#else - mov r12, r3, lsl #16 -#endif - ldr r3, [r1, #-4]! -#ifdef __ARMEB__ - orr r12, r12, r3, lsl #16 -#else - orr r12, r12, r3, lsr #16 -#endif - str r12, [r0, #-4]! - subs r2, r2, #4 - bge .Lmemmove_bsrcul2loop4 - -.Lmemmove_bsrcul2l4: - add r1, r1, #2 - b .Lmemmove_bl4 - -.Lmemmove_bsrcul1: - cmp r2, #0x0c - blt .Lmemmove_bsrcul1loop4 - sub r2, r2, #0x0c - push {r4, r5, lr} - -.Lmemmove_bsrcul1loop32: -#ifdef __ARMEB__ - mov lr, r3, lsr #24 -#else - mov lr, r3, lsl #24 -#endif - ldmdb r1!, {r3-r5, r12} -#ifdef __ARMEB__ - orr lr, lr, r12, lsl #8 - mov r12, r12, lsr #24 - orr r12, r12, r5, lsl #8 - mov r5, r5, lsr #24 - orr r5, r5, r4, lsl #8 - mov r4, r4, lsr #24 - orr r4, r4, r3, lsl #8 -#else - orr lr, lr, r12, lsr #8 - mov r12, r12, lsl #24 - orr r12, r12, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r4, lsr #8 - mov r4, r4, lsl #24 - orr r4, r4, r3, lsr #8 -#endif - stmdb r0!, {r4, r5, r12, lr} - subs r2, r2, #0x10 - bge .Lmemmove_bsrcul1loop32 - pop {r4, r5, lr} - adds r2, r2, #0x0c - blt .Lmemmove_bsrcul1l4 - -.Lmemmove_bsrcul1loop4: -#ifdef __ARMEB__ - mov r12, r3, lsr #24 -#else - mov r12, r3, lsl #24 -#endif - ldr r3, [r1, #-4]! -#ifdef __ARMEB__ - orr r12, r12, r3, lsl #8 -#else - orr r12, r12, r3, lsr #8 -#endif - str r12, [r0, #-4]! - subs r2, r2, #4 - bge .Lmemmove_bsrcul1loop4 - -.Lmemmove_bsrcul1l4: - add r1, r1, #1 - b .Lmemmove_bl4 -#ifndef _BCOPY -END(memmove) -#else -END(bcopy) -#endif - -#if defined(__ARM_EABI__) && !defined(BCOPY) && !defined(_RUMPKERNEL) -STRONG_ALIAS(__aeabi_memmove, memmove) -STRONG_ALIAS(__aeabi_memmove4, memmove) -STRONG_ALIAS(__aeabi_memmove8, memmove) -#endif diff --git a/common/lib/libc/arch/arm/string/memset.S b/common/lib/libc/arch/arm/string/memset.S deleted file mode 100644 index c3e0ad377..000000000 --- a/common/lib/libc/arch/arm/string/memset.S +++ /dev/null @@ -1,259 +0,0 @@ -/* $NetBSD: memset.S,v 1.8 2015/03/26 13:34:51 justin Exp $ */ - -/* - * Copyright 2003 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Steve C. Woodford for Wasabi Systems, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Copyright (c) 1995 Mark Brinicombe. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by Mark Brinicombe. - * 4. The name of the company nor the name of the author may be used to - * endorse or promote products derived from this software without specific - * prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(__ARM_EABI__) && !defined(_BZERO) && !defined(_RUMPKERNEL) -ENTRY(__aeabi_memset) - mov r3, r1 - mov r1, r2 - mov r2, r3 - b memset -END(__aeabi_memset) -STRONG_ALIAS(__aeabi_memset4, __aeabi_memset) -STRONG_ALIAS(__aeabi_memset8, __aeabi_memset) - -ENTRY(__aeabi_memclr) - mov r2, r1 - mov r1, #0 - b memset -END(__aeabi_memclr) -STRONG_ALIAS(__aeabi_memclr4, __aeabi_memclr) -STRONG_ALIAS(__aeabi_memclr8, __aeabi_memclr) -#endif - -/* - * memset: Sets a block of memory to the specified value - * - * On entry: - * r0 - dest address - * r1 - byte to write - * r2 - number of bytes to write - * - * On exit: - * r0 - dest address - */ -#ifdef _BZERO -/* LINTSTUB: Func: void bzero(void *, size_t) */ -ENTRY(bzero) - mov r3, #0x00 -#else -/* LINTSTUB: Func: void *memset(void *, int, size_t) */ -ENTRY(memset) - and r3, r1, #0xff /* We deal with bytes */ - mov r1, r2 -#endif - cmp r1, #0x04 /* Do we have less than 4 bytes */ - mov ip, r0 - blt .Lmemset_lessthanfour - - /* Ok first we will word align the address */ - ands r2, ip, #0x03 /* Get the bottom two bits */ - bne .Lmemset_wordunaligned /* The address is not word aligned */ - - /* We are now word aligned */ -.Lmemset_wordaligned: -#ifndef _BZERO - orr r3, r3, r3, lsl #8 /* Extend value to 16-bits */ -#endif -#ifdef _ARM_ARCH_DWORD_OK - tst ip, #0x04 /* Quad-align for Xscale */ -#else - cmp r1, #0x10 -#endif -#ifndef _BZERO - orr r3, r3, r3, lsl #16 /* Extend value to 32-bits */ -#endif -#ifdef _ARM_ARCH_DWORD_OK - subne r1, r1, #0x04 /* Quad-align if necessary */ - strne r3, [ip], #0x04 - cmp r1, #0x10 -#endif - blt .Lmemset_loop4 /* If less than 16 then use words */ - mov r2, r3 /* Duplicate data */ - cmp r1, #0x80 /* If < 128 then skip the big loop */ - blt .Lmemset_loop32 - - /* Do 128 bytes at a time */ -.Lmemset_loop128: - subs r1, r1, #0x80 -#ifdef _ARM_ARCH_DWORD_OK - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 -#else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} -#endif - bgt .Lmemset_loop128 - RETc(eq) /* Zero length so just exit */ - - add r1, r1, #0x80 /* Adjust for extra sub */ - - /* Do 32 bytes at a time */ -.Lmemset_loop32: - subs r1, r1, #0x20 -#ifdef _ARM_ARCH_DWORD_OK - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 -#else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} -#endif - bgt .Lmemset_loop32 - RETc(eq) /* Zero length so just exit */ - - adds r1, r1, #0x10 /* Partially adjust for extra sub */ - - /* Deal with 16 bytes or more */ -#ifdef _ARM_ARCH_DWORD_OK - strdge r2, r3, [ip], #0x08 - strdge r2, r3, [ip], #0x08 -#else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} -#endif - RETc(eq) /* Zero length so just exit */ - - addlt r1, r1, #0x10 /* Possibly adjust for extra sub */ - - /* We have at least 4 bytes so copy as words */ -.Lmemset_loop4: - subs r1, r1, #0x04 - strge r3, [ip], #0x04 - bgt .Lmemset_loop4 - RETc(eq) /* Zero length so just exit */ - -#ifdef _ARM_ARCH_DWORD_OK - /* Compensate for 64-bit alignment check */ - adds r1, r1, #0x04 - RETc(eq) - cmp r1, #2 -#else - cmp r1, #-2 -#endif - - strb r3, [ip], #0x01 /* Set 1 byte */ - strbge r3, [ip], #0x01 /* Set another byte */ - strbgt r3, [ip] /* and a third */ - RET /* Exit */ - -.Lmemset_wordunaligned: - rsb r2, r2, #0x004 - strb r3, [ip], #0x01 /* Set 1 byte */ - cmp r2, #0x02 - strbge r3, [ip], #0x01 /* Set another byte */ - sub r1, r1, r2 - strbgt r3, [ip], #0x01 /* and a third */ - cmp r1, #0x04 /* More than 4 bytes left? */ - bge .Lmemset_wordaligned /* Yup */ - -.Lmemset_lessthanfour: - cmp r1, #0x00 - RETc(eq) /* Zero length so exit */ - strb r3, [ip], #0x01 /* Set 1 byte */ - cmp r1, #0x02 - strbge r3, [ip], #0x01 /* Set another byte */ - strbgt r3, [ip] /* and a third */ - RET /* Exit */ -#ifdef _BZERO -END(bzero) -#else -END(memset) -#endif diff --git a/common/lib/libc/arch/arm/string/memset_arm.S b/common/lib/libc/arch/arm/string/memset_arm.S deleted file mode 100644 index b7831df6f..000000000 --- a/common/lib/libc/arch/arm/string/memset_arm.S +++ /dev/null @@ -1,173 +0,0 @@ -/* $NetBSD: memset_arm.S,v 1.2 2013/01/14 19:15:13 matt Exp $ */ - -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include - -#if defined(NEON) -#define STORE8 vst1.32 {d0}, [ip:64]! -#define STORE16 vst1.32 {d0-d1}, [ip:64]! -#define STORE32 vst1.32 {d0-d3}, [ip:64]! -#elif defined(VFP) -#define STORE8 vstmia ip!, {d0} -#define STORE16 vstmia ip!, {d0-d1} -#define STORE32 vstmia ip!, {d0-d3} -#elif defined(_ARM_ARCH_DWORD_OK) -#define STORE8 strd r2, [ip], #8 -#define STORE16 STORE8; STORE8 -#define STORE32 STORE16; STORE16 -#else -#define STORE8 stmia ip!, {r2,r3} -#define STORE16 STORE8; STORE8 -#define STORE32 STORE16; STORE16 -#endif -/* - * memset: Sets a block of memory to the specified value - * Using NEON instructions - * - * On entry: - * r0 - dest address - * r1 - byte to write - * r2 - number of bytes to write - * - * On exit: - * r0 - dest address - */ -/* LINTSTUB: Func: void *memset(void *, int, size_t) */ -ENTRY(memset) - ands r3, r1, #0xff /* We deal with bytes */ - orrne r3, r3, r3, lsl #8 /* replicate to all bytes */ - orrne r3, r3, r3, lsl #16 /* replicate to all bytes */ - movs r1, r2 /* we need r2 & r3 */ - RETc(eq) /* return if length is 0 */ - mov ip, r0 /* r0 needs to stay the same */ - - cmp r1, #12 /* is this a small memset? *? - blt .Lbyte_by_byte /* then do it byte by byte */ - - /* Ok first we will dword align the address */ - ands r2, ip, #7 /* grab the bottom three bits */ - beq .Lmemset_dwordaligned /* The addr is dword aligned */ - - rsb r2, r2, #8 /* how far until dword aligned? */ - sub r1, r1, r2 /* subtract it from remaining length */ - mov r2, r3 /* duplicate fill value */ - - tst ip, #1 /* halfword aligned? */ - strneb r3, [ip], #1 /* no, write a byte */ - tst ip, #2 /* word aligned? */ - strneh r3, [ip], #2 /* no, write a halfword */ - tst ip, #4 /* dword aligned? */ - strne r3, [ip], #4 /* no, write a word */ - - /* We are now doubleword aligned */ -.Lmemset_dwordaligned: -#if defined(NEON) - vdup.8 q0, r3 /* move fill to SIMD */ - vmov q1, q0 /* put fill in q1 (d2-d3) */ -#elif defined(VFP) - mov r2, r3 /* duplicate fill value */ - vmov d0, r2, r3 /* move to VFP */ - vmov d1, r2, r3 - vmov d2, r2, r3 - vmov d3, r2, r3 -#endif - -#if 1 - cmp r1, #128 - blt .Lmemset_mainloop - ands r2, ip, #63 /* check for 64-byte alignment */ - beq .Lmemset_mainloop - /* - * Let's align to a 64-byte boundary so that stores don't cross - * cacheline boundaries. We also know we have at least 128-bytes to - * copy so we don't have to worry about the length at the moment. - */ - rsb r2, r2, #64 /* how many bytes until 64 bytes */ - sub r1, r1, r2 /* subtract from remaining length */ -#if !defined(NEON) && !defined(VFP) - mov r2, r3 /* put fill back in r2 */ -#endif - - tst ip, #8 /* quadword aligned? */ - beq 1f /* yes */ - STORE8 /* no, store a dword */ -1: tst ip, #16 /* octaword aligned? *? - beq 2f /* yes */ - STORE16 /* no, store a quadword */ -2: tst ip, #32 /* 32 word aligned? */ - beq .Lmemset_mainloop /* yes */ - STORE32 /* no, make 64-byte aligned */ -#endif - -.Lmemset_mainloop: -#if !defined(NEON) && !defined(VFP) - mov r2, r3 /* put fill back in r2 */ -#endif - subs r1, r1, #64 /* subtract an initial 64 */ - blt .Lmemset_lessthan_64bytes - -3: STORE32 /* store first octaword */ - STORE32 /* store second octaword */ - RETc(eq) /* return if done */ - subs r1, r1, #64 /* subtract another 64 */ - bge 3b /* and do other if still >= 0 */ -.Lmemset_lessthan_64bytes: - tst r1, #32 /* do we have 16 bytes left? */ - beq .Lmemset_lessthan_32bytes - STORE32 /* yes, store an octaword */ - bics r1, r1, #32 /* subtract 16 */ - RETc(eq) /* return if length is 0 */ -.Lmemset_lessthan_32bytes: - tst r1, #16 /* do we have 16 bytes left? */ - beq .Lmemset_lessthan_16bytes - STORE16 /* yes, store a quadword */ - bics r1, r1, #16 /* subtract 16 */ - RETc(eq) /* return if length is 0 */ -.Lmemset_lessthan_16bytes: - tst r1, #8 /* do we have 8 bytes left? */ - beq .Lmemset_lessthan_8bytes/* no */ - STORE8 /* yes, store a dword */ - bics r1, r1, #8 /* subtract 8 */ - RETc(eq) /* return if length is 0 */ -.Lmemset_lessthan_8bytes: - tst r1, #4 /* do we have a word left? */ - strne r2, [ip], #4 /* yes, so write one */ - tst r1, #2 /* do we have a halfword left? */ - strneh r2, [ip], #2 /* yes, so write one */ - tst r1, #1 /* do we have a byte left? */ - strneb r2, [ip], #1 /* yes, so write one */ - RET /* return */ - -.Lbyte_by_byte: - subs r1, r1, #1 /* can we write a byte? */ - RETc(lt) /* no, we're done */ - strb r3, [ip], #1 /* yes, so do it */ - b .Lbyte_by_byte /* try next byte */ -END(memset) diff --git a/common/lib/libc/arch/arm/string/memset_naive.S b/common/lib/libc/arch/arm/string/memset_naive.S deleted file mode 100644 index 78b339480..000000000 --- a/common/lib/libc/arch/arm/string/memset_naive.S +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: memset_naive.S,v 1.1 2013/01/08 20:15:00 matt Exp $") - -/* - * This isn't quite as simple/short as it could be but the truly trivial - * memset was an order of magnitude slower than this. - */ - -ENTRY(memset) -/* LINTSTUB: void *memset(void *, int, size_t) */ - mov ip, r0 /* need to preserve r0 */ - cmp r2, #10 /* 10 bytes or less? */ - ble .Lbyte_by_byte /* yes, bytewise is faster */ - ands r3, r1, #0xff /* we are dealing with bytes */ - orrne r3, r3, r3, lsl #8 /* move value into 2nd byte lane */ - orrne r3, r3, r3, lsl #16 /* move value into all byte lanes */ - mov r1, r2 /* move count */ - ands r2, ip, #7 /* are we dword aligned? */ - beq 1f /* yes we are */ - rsb r2, r2, #8 /* how many bytes until aligned? */ - sub r1, r1, r2 /* subtract from count */ - tst ip, #1 /* halfword aligned? */ - strneb r3, [ip], #1 /* nope, write a byte */ - tst ip, #2 /* word aligned? */ - strneh r3, [ip], #2 /* nope, write a halfword */ - tst ip, #4 /* dword aligned? */ - strne r3, [ip], #4 /* nope, write a word */ - /* - * At this point, we are dword aligned. - */ -1: mov r2, r3 /* duplicate fill value */ -2: subs r1, r1, #16 /* can we write 16 bytes? */ - stmgeia ip!, {r2,r3} /* yes, write the first 8 of them */ - stmgeia ip!, {r2,r3} /* yes, write the second 8 of them */ - bgt 2b /* more left to fill */ - RETc(eq) /* no, return */ - /* - * Our count went negative but the bits below 16 haven't changed. - * So we are effectively testing modulo 16. - */ - tst r1, #8 /* can we write at least 8 bytes? */ - stmneia ip!, {r2,r3} /* so do it */ - tst r1, #4 /* can we write at least 4 bytes? */ - strne r3, [ip], #4 /* so do it */ - tst r1, #2 /* can we write at least 2 bytes? */ - strneh r3, [ip], #2 /* so do it */ - tst r1, #1 /* can we write 1 bytes? */ - strneb r3, [ip], #1 /* so do it */ - RET /* return */ - -.Lbyte_by_byte: - subs r2, r2, #1 /* can we write a byte? */ - RETc(lt) /* no, return */ - strb r3, [ip], #1 /* write a byte */ - b .Lbyte_by_byte /* do next byte */ -END(memset) diff --git a/common/lib/libc/arch/arm/string/memset_neon.S b/common/lib/libc/arch/arm/string/memset_neon.S deleted file mode 100644 index f32c96f51..000000000 --- a/common/lib/libc/arch/arm/string/memset_neon.S +++ /dev/null @@ -1,186 +0,0 @@ -/* $NetBSD: memset_neon.S,v 1.1 2012/12/13 01:41:59 matt Exp $ */ - -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include -#include "assym.h" - -/* - * memset: Sets a block of memory to the specified value - * Using NEON instructions - * - * On entry: - * r0 - dest address - * r1 - byte to write - * r2 - number of bytes to write - * - * On exit: - * r0 - dest address - */ -/* LINTSTUB: Func: void *memset(void *, int, size_t) */ -ENTRY(memset) - and r3, r1, #0xff /* We deal with bytes */ - mov r1, r2 - mov ip, r0 /* r0 needs to stay the same */ - - vdup.8 q0, r3 /* move fill to SIMD */ - /* we no longer need to keep the fill value in a ARM register */ - - /* Ok first we will dword align the address */ - ands r2, ip, #7 /* grab the bottom three bits */ - beq .Lmemset_dwordaligned /* The addr is dword aligned */ - - bic ip, ip, #7 /* clear bottom three bits of addr */ - vldr d7, [ip] /* load from memory */ - add r1, r1, r2 /* add "pre-fill" to length */ - lsl r2, r2, #3 /* byte to no-fill bit count */ - -#ifdef __ARMEB__ - neg r1, r1 /* start from the MSB */ -#endif - vmov s4, r2 /* move to SIMD d2 */ - vmvn.u64 d3, #0 /* set all ones */ - vshl.u64 d3, d3, d2 /* create a no-fill mask */ - vmvn.u64 d2, d3 /* invert mask for a fill-mask */ - vand d7, d7, d3 /* mask out fill bits */ - vand d2, d0, d2 /* mask out no-fill bits */ - vorr d7, d2, d7 /* merge fill and memory */ - - cmp r1, #8 /* Do we have less than 8 bytes */ - movlt r2, #0 /* indicate this is the last word */ - blt .Lmemset_lessthaneight_noload - - vstmia ip!, {d7} /* write back to memory */ - subs r1, r1, #8 /* and remove 8 bytes from the length */ - RETc(eq) - - /* We are now doubleword aligned */ -.Lmemset_dwordaligned: - vmov q1, q0 /* put fill in q1 (d2-d3) */ - vmov q2, q0 /* put fill in q2 (d4-d5) */ - vmov q3, q0 /* put fill in q3 (d6-d7) */ - - and r2, ip, #63 /* check for 64-byte alignment */ - beq .Lmemset_8dwordaligned - /* - * Let's align to a 64-byte boundary so that stores don't cross - * cacheline boundaries. We also know we have at least 128-bytes to - * copy so we don't have to worry about the length at the moment. - */ - rsb r2, r2, #64 /* how many bytes until 64 bytes */ - cmp r1, r2 /* compare against length */ - andlt r2, r1, #0x38 /* if < len, use trunc(len, 8) */ - subs r1, r1, r2 /* subtract from len */ - add pc, pc, r2 /* and jump to it */ - nop - RETc(eq); b .Lmemset_lessthaneight - vstmia ip!, {d0}; b .Lmemset_8dwordaligned - vstmia ip!, {d0-d1}; b .Lmemset_8dwordaligned - vstmia ip!, {d0-d2}; b .Lmemset_8dwordaligned - vstmia ip!, {d0-d3}; b .Lmemset_8dwordaligned - vstmia ip!, {d0-d4}; b .Lmemset_8dwordaligned - vstmia ip!, {d0-d5}; b .Lmemset_8dwordaligned - vstmia ip!, {d0-d6} -.Lmemset_8dwordaligned: - vmov d0, d1 /* restore in case of unaligned start */ - cmp r1, #8 /* do we have less than 8 bytes */ - movlt r2, #0 /* indicate last word */ - blt .Lmemset_lessthaneight - - cmp r1, #512 - blt .Lmemset_sub512 - - /* Do 512 bytes at a time */ - mov r2, #512 -.Lmemset_512: - vstmia ip!, {d0-d7} - vstmia ip!, {d0-d7} - vstmia ip!, {d0-d7} - vstmia ip!, {d0-d7} - vstmia ip!, {d0-d7} - vstmia ip!, {d0-d7} - vstmia ip!, {d0-d7} - vstmia ip!, {d0-d7} -.Lmemset_0: - subs r1, r1, r2 - RETc(eq) /* return if done */ - cmp r1, #512 - bge .Lmemset_512 - - /* - * We have less than 512 bytes left, but since the sequence above - * store 64 bytes at a time, we determine the number of instructions - * we need to store the remainder (if >= 64 bytes) and execute that - * many vstmia. - */ -.Lmemset_sub512: - lsr r2, r1, #6 /* divide by 64 */ - lslne r4, r2, #2 /* multiply by 4 */ - addne r4, r4, #1f + 8 - .Lmemset_0 - /* add the # of bytes between */ -1: subne pc, r4 /* and go */ - - /* - * We have less than 64 bytes to copy on a 8dword aligned address - */ - and r2, r1, #56 /* get # of full dwords */ - ands r1, r1, #7 /* get # of extra bytes */ - beq .Lmemset_finalstore - /* - * The last word is a partial fill so load its value and update it - * to include the fill value. - */ -.Lmemset_lessthaneight: - vldr d7, [ip, r2] /* load the last partial dword */ -.Lmemset_lessthaneight_noload: - lsl r1, r1, #3 /* byte to fill bit count */ -#ifdef __ARMEB__ - neg r1, r1 /* start from the MSB */ -#endif - vmov s4, r1 /* move to SIMD d2 */ - vmvn.u64 d3, #0 /* set all ones */ - vshl.u64 d3, d3, d2 /* create a no-fill mask */ - vmvn.u64 d2, d3 /* invert mask */ - vand d7, d7, d2 /* keep no-fill bits */ - vand d2, d0, d3 /* mask out no-fill bits */ - vorr d7, d2, d7 /* merge fill and no-fill */ - vmov q1, q0 /* restore d2 & d3 */ - add r2, r2, #8 /* compensate for the partial dword */ -.Lmemset_finalstore: - add pc, pc, r2 /* and jump to it */ - nop - vstr d7, [ip]; RET - vstmia ip, {d6-d7}; RET - vstmia ip, {d5-d7}; RET - vstmia ip, {d4-d7}; RET - vstmia ip, {d3-d7}; RET - vstmia ip, {d2-d7}; RET - vstmia ip, {d1-d7}; RET - vstmia ip, {d0-d7}; RET -END(memset) diff --git a/common/lib/libc/arch/arm/string/strcat.S b/common/lib/libc/arch/arm/string/strcat.S deleted file mode 100644 index be9abc8ac..000000000 --- a/common/lib/libc/arch/arm/string/strcat.S +++ /dev/null @@ -1,7 +0,0 @@ -/* $NetBSD: strcat.S,v 1.1 2013/01/23 05:46:17 matt Exp $ */ - -#if defined(_STANDALONE) -#include "strcat_naive.S" -#else -#include "strcat_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strcat_arm.S b/common/lib/libc/arch/arm/string/strcat_arm.S deleted file mode 100644 index a6b42d9ef..000000000 --- a/common/lib/libc/arch/arm/string/strcat_arm.S +++ /dev/null @@ -1,71 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -/* - * Implementation of strcat using strlen/strcpy. - */ -ENTRY(strcat) -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) -# if !defined(__ARM_DWARF_EH__) - .fnstart -# endif - .cfi_startproc -#endif - push {r3-r5, lr} /* save registers */ -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) -# if !defined(__ARM_DWARF_EH__) - .save {r3-r5, lr} -# endif - .cfi_def_cfa_offset 16 - .cfi_offset 14, -4 - .cfi_offset 5, -8 - .cfi_offset 4, -12 - .cfi_offset 3, -16 -#endif - - mov r4, r0 /* save dst */ - mov r5, r1 /* save append */ - - bl PLT_SYM(strlen) /* find length of dst */ - - adds r0, r0, r4 /* add to dst pointer */ - mov r1, r5 /* fetch append */ - bl PLT_SYM(strcpy) /* append string */ - - mov r0, r4 /* restore dst as return value */ - pop {r3-r5, pc} /* restore registers */ -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) - .cfi_endproc -# if !defined(__ARM_DWARF_EH__) - .fnend -# endif -#endif -END(strcat) diff --git a/common/lib/libc/arch/arm/string/strcat_naive.S b/common/lib/libc/arch/arm/string/strcat_naive.S deleted file mode 100644 index a3ea68ead..000000000 --- a/common/lib/libc/arch/arm/string/strcat_naive.S +++ /dev/null @@ -1,62 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strcat_naive.S,v 1.3 2013/08/19 17:02:25 matt Exp $") - -ENTRY(strcat) - mov ip, r0 /* need to preserve r0 */ -#if defined(__thumb__) -1: ldrb r2, [r0] /* load next byte */ - adds r0, r0, #1 /* advance */ - cmp r2, #0 /* was it a NUL? */ - bne 1b /* no, get next byte */ - subs r0, r0, #1 /* back up one to the NUL */ - subs r1, r1, r0 /* save one increment */ -2: ldrb r2, [r1, r0] /* load next byte from append */ - strb r2, [r0] /* store it */ - adds r0, r0, #1 /* advance */ - cmp r2, #0 /* was it a NUL? */ - bne 2b /* no, get next byte */ - mov r0, ip /* restore dst address */ - RET /* return */ -#else /* !__thumb__ */ - mov ip, r0 /* need to preserve r0 */ -1: ldrb r2, [ip], #1 /* load next byte */ - teq r2, #0 /* was it a NUL? */ - bne 1b /* no, get next byte */ - sub ip, ip, #1 /* back up one to the NUL */ -2: ldrb r2, [r1], #1 /* load next byte from append */ - strb r2, [ip], #1 /* store it */ - teq r2, #0 /* was it a NUL? */ - bne 2b /* no, get next byte */ - RET /* return */ -#endif -END(strcat) diff --git a/common/lib/libc/arch/arm/string/strchr.S b/common/lib/libc/arch/arm/string/strchr.S deleted file mode 100644 index 621734eb8..000000000 --- a/common/lib/libc/arch/arm/string/strchr.S +++ /dev/null @@ -1,11 +0,0 @@ -/* $NetBSD: strchr.S,v 1.4 2013/08/20 08:07:30 matt Exp $ */ - -#include - -STRONG_ALIAS(index, strchr) - -#if defined(_STANDALONE) || (defined(__thumb__) && !defined(_ARM_ARCH_T2)) -#include "strchr_naive.S" -#else -#include "strchr_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strchr_arm.S b/common/lib/libc/arch/arm/string/strchr_arm.S deleted file mode 100644 index 864ce61a8..000000000 --- a/common/lib/libc/arch/arm/string/strchr_arm.S +++ /dev/null @@ -1,172 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strchr_arm.S,v 1.8 2013/08/19 17:50:04 matt Exp $") - -#if defined(__thumb__) && !defined(_ARM_ARCH_T2) -#error Only Thumb2 or ARM supported -#endif - -#ifdef __ARMEL__ -#define BYTE0 0x000000ff -#define BYTE1 0x0000ff00 -#define BYTE2 0x00ff0000 -#define BYTE3 0xff000000 -#define lshi lsl -#define lshis lsls -#else -#define BYTE0 0xff000000 -#define BYTE1 0x00ff0000 -#define BYTE2 0x0000ff00 -#define BYTE3 0x000000ff -#define lshi lsr -#define lshis lsrs -#endif - - .text -ENTRY(strchr) - and r2, r1, #0xff /* restrict to byte value */ -1: tst r0, #3 /* test for word alignment */ - beq .Lpre_main_loop /* finally word aligned */ - ldrb r3, [r0], #1 /* load a byte */ - cmp r3, r2 /* is it a match? */ - beq 2f /* yes, return current ptr - 1 */ - cmp r3, #0 /* no, was it 0? */ - bne 1b /* no, try next byte */ - movs r0, #0 /* yes, set return value to NULL */ - RET /* return */ -2: subs r0, r0, #1 /* back up by one */ - RET /* return */ -.Lpre_main_loop: -#if defined(_ARM_ARCH_7) - movw ip, #0xfefe /* magic constant; 254 in each byte */ - movt ip, #0xfefe /* magic constant; 254 in each byte */ -#elif defined(_ARM_ARCH_6) - mov ip, #0xfe /* put 254 in low byte */ - orr ip, ip, ip, lsl #8 /* move to next byte */ - orr ip, ip, ip, lsl #16 /* move to next halfword */ -#endif /* _ARM_ARCH_6 */ - orr r2, r2, r2, lsl #8 /* move to next byte */ - orr r2, r2, r2, lsl #16 /* move to next halfword */ -.Lmain_loop: - ldr r3, [r0], #4 /* load next word */ -#if defined(_ARM_ARCH_6) - /* - * Add 254 to each byte using the UQADD8 (unsigned saturating add 8) - * instruction. For every non-NUL byte, the result for that byte will - * become 255. For NUL, it will be 254. When we complement the - * result, if the result is non-0 then we must have encountered a NUL. - */ - uqadd8 r1, r3, ip /* NUL detection happens here */ - eors r3, r3, r2 /* xor to clear each lane */ - uqadd8 r3, r3, ip /* char detection happens here */ - ands r3, r3, r1 /* merge results */ - mvns r3, r3 /* is the complement non-0? */ - beq .Lmain_loop /* no, then keep going */ - - /* - * We've encountered a NUL or a match but we don't know which happened - * first. - */ -#if defined(__thumb__) && defined(_ARM_ARCH_T2) - cbz r2, .Lfind_match /* searching for NUL? yes, find it */ -#else - cmp r2, #0 /* searching for NUL? */ - beq .Lfind_match /* yes, find the match */ -#endif - mvns r1, r1 /* did we encounter a NUL? */ - beq .Lfind_match /* no, find the match */ - bics r3, r3, r1 /* clear match for the NUL(s) */ - beq .Lnomatch /* any left set? if not, no match */ - lshis r1, r1, #8 /* replicate NUL bit to other bytes */ -#ifdef __thumb__ - itt ne -#endif - orrne r1, r1, r1, lshi #8 /* replicate NUL bit to other bytes */ - orrne r1, r1, r1, lshi #8 /* replicate NUL bit to other bytes */ - bics r3, r3, r1 /* clear any match bits after the NUL */ - beq .Lnomatch /* any left set? if not, no match */ -.Lfind_match: -#ifdef __ARMEL__ - rev r3, r3 /* we want this in BE for the CLZ */ -#endif - clz r3, r3 /* count how many leading zeros */ - add r0, r0, r3, lsr #3 /* divide that by 8 and add to count */ - subs r0, r0, #4 /* compensate for the post-inc */ - RET -.Lnomatch: - movs r0, #0 - RET -#else - /* - * No fancy shortcuts so just test each byte lane for a NUL. - * (other tests for NULs in a word take more instructions/cycles). - */ - eor r1, r3, r2 /* xor .. */ - tst r3, #BYTE0 /* is this byte NUL? */ - tstne r1, #BYTE0 /* no, does this byte match? */ - tstne r3, #BYTE1 /* no, is this byte NUL? */ - tstne r1, #BYTE1 /* no, does this byte match? */ - tstne r3, #BYTE2 /* no, is this byte NUL? */ - tstne r1, #BYTE2 /* no, does this byte match? */ - tstne r3, #BYTE3 /* no, is this byte NUL? */ - tstne r1, #BYTE3 /* no, does this byte match? */ - bne .Lmain_loop - - sub r2, r0, #4 /* un post-inc */ - mov r0, #0 /* assume no match */ - - tst r1, #BYTE0 /* does this byte match? */ - moveq r0, r2 /* yes, point to it */ - RETc(eq) /* and return */ - tst r3, #BYTE0 /* is this byte NUL? */ - RETc(eq) /* yes, return NULL */ - - tst r1, #BYTE1 /* does this byte match? */ - addeq r0, r2, #1 /* yes, point to it */ - RETc(eq) /* and return */ - tst r3, #BYTE1 /* is this byte NUL? */ - RETc(eq) /* yes, return NULL */ - - tst r1, #BYTE2 /* does this byte match? */ - addeq r0, r2, #2 /* yes, point to it */ - RETc(eq) /* and return */ - tst r3, #BYTE2 /* is this byte NUL? */ - RETc(eq) /* yes, return NULL */ - - tst r1, #BYTE3 /* does this byte match? */ - addeq r0, r2, #3 /* yes, point to it */ - /* - * Since no NULs and no matches this must be the only case left. - */ - RET /* return */ -#endif /* _ARM_ARCH_6 */ -END(strchr) diff --git a/common/lib/libc/arch/arm/string/strchr_naive.S b/common/lib/libc/arch/arm/string/strchr_naive.S deleted file mode 100644 index 9cbdcf53d..000000000 --- a/common/lib/libc/arch/arm/string/strchr_naive.S +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include - -RCSID("$NetBSD: strchr_naive.S,v 1.4 2013/08/19 17:02:25 matt Exp $") - -/* LINTSTUB: char * strchr(const char *, int) */ -ENTRY(strchr) -#ifdef __thumb__ - movs r3, #0xff - ands r1, r1, r3 /* restrict to a byte value */ -1: ldrb r3, [r0] /* read a byte */ - cmp r3, r1 /* does it match? */ - beq 2f /* yes, set return value */ - adds r0, r0, #1 /* advance to next byte */ - cmp r3, #0 /* was it a NUL? */ - bne 1b /* no, get next byte */ - movs r0, #0 /* set return to NULL */ -2: RET /* return */ -#else - mov r2, r0 /* using r0 as return value */ - mov r0, #0 /* default to no match */ - and r1, r1, #0xff /* restrict to a byte value */ -1: ldrb r3, [r2], #1 /* read a byte */ - cmp r3, r1 /* does it match? */ - subeq r0, r2, #1 /* yes, set return value to point to it */ - cmpne r3, #0 /* no, was it a NUL? */ - bne 1b /* no, get next byte */ - RET -#endif -END(strchr) diff --git a/common/lib/libc/arch/arm/string/strcmp.S b/common/lib/libc/arch/arm/string/strcmp.S deleted file mode 100644 index 186991457..000000000 --- a/common/lib/libc/arch/arm/string/strcmp.S +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: strcmp.S,v 1.2 2013/08/19 00:56:12 matt Exp $ */ - -/* - * Copyright (c) 2002 ARM Ltd - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the company may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strcmp.S,v 1.2 2013/08/19 00:56:12 matt Exp $") - -ENTRY(strcmp) -#if !defined(__thumb__) -1: ldrb r2, [r0], #1 - ldrb r3, [r1], #1 - cmp r2, #1 - cmpcs r2, r3 -#else - subs r1, r1, r0 /* this allows us to only one increment */ -1: ldrb r2, [r0] - ldrb r3, [r1, r0] - adds r0, r0, #1 /* increment */ - cmp r2, #1 - bcc 2f - cmp r2, r3 -#endif - beq 1b -2: subs r0, r2, r3 - RET -END(strcmp) diff --git a/common/lib/libc/arch/arm/string/strcpy.S b/common/lib/libc/arch/arm/string/strcpy.S deleted file mode 100644 index 9585c97a1..000000000 --- a/common/lib/libc/arch/arm/string/strcpy.S +++ /dev/null @@ -1,11 +0,0 @@ -/* $NetBSD: strcpy.S,v 1.5 2013/08/20 21:35:24 matt Exp $ */ - -#if defined(_STANDALONE) -#ifdef __thumb__ -#include "strcpy_thumb.S" -#else -#include "strcpy_naive.S" -#endif -#else -#include "strcpy_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strcpy_arm.S b/common/lib/libc/arch/arm/string/strcpy_arm.S deleted file mode 100644 index 8ad6ea079..000000000 --- a/common/lib/libc/arch/arm/string/strcpy_arm.S +++ /dev/null @@ -1,527 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strcpy_arm.S,v 1.3 2013/08/11 04:56:32 matt Exp $") - -#ifdef STRLCPY -#ifdef _LIBC -WEAK_ALIAS(strlcpy, _strlcpy) -#endif -#define FUNCNAME strlcpy -#elif defined(STRNCPY) -#define FUNCNAME strncpy -#else -#define FUNCNAME strcpy -#endif - -#ifdef _LIBC -#include "namespace.h" -#endif - -#ifdef __ARMEL__ -#define lslo lsr /* shift to lower address */ -#define lshi lsl /* shift to higher address */ -#define BYTE0 0x000000ff -#define BYTE1 0x0000ff00 -#define BYTE2 0x00ff0000 -#define BYTE3 0xff000000 -#else -#define lslo lsl /* shift to lower address */ -#define lshi lsr /* shift to higher address */ -#define BYTE0 0xff000000 -#define BYTE1 0x00ff0000 -#define BYTE2 0x0000ff00 -#define BYTE3 0x000000ff -#endif - -/* - * On armv6 and later, to quickly determine if a word contains a NUL (0) byte, - * we add 254 to each byte using the UQADD8 (unsigned saturating add 8) - * instruction. For every non-NUL byte, the result for that byte will become - * 255. For NUL, it will be 254. When we complement the result of all 4 adds, - * if the result is non-0 then we must have encountered a NUL. - * - * For earlier architecture, we just use tst on all 4 bytes. There are other - * algorithms to detect NULs but they take longer and use more instructions. - */ - -/* - * char *strcpy(char *dst, const char *src); - * char *strncpy(char *dst, const char *src, size_t len); - * size_t strlcpy(char *dst, const char *src, size_t len); - */ - - .text -ENTRY(FUNCNAME) -#if defined(STRLCPY) - cmp r2, #1 /* is length 1 or less? */ - bhi 1f /* no, do normal */ - moveq r3, #0 /* = 1? load NUL */ - strbeq r3, [r0] /* = 1? write NUL to dst */ - mov r0, r1 /* move src to r0 */ - b PLT_SYM(_C_LABEL(strlen)) /* and tailcall strlen */ -1: - sub r2, r2, #1 /* leave one byte for NUL */ -#endif -#if defined(STRNCPY) - cmp r2, #0 /* 0 length? */ - RETc(eq) /* yes, just return */ -#endif - push {r4-r9} /* save some registers */ -#ifdef _ARM_ARCH_6 -#ifdef _ARM_ARCH_7 - movw r7, #0xfefe /* magic constant; 254 in each byte */ -#else - mov r7, #0xfe /* put 254 in low byte */ - orr r7, r7, r7, lsl #8 /* move to next byte */ -#endif - orr r7, r7, r7, lsl #16 /* move to next halfword */ -#endif - -#if defined(STRLCPY) - add r6, r1, #1 /* save for return (deal with NUL) */ -#else - mov r6, r0 /* save for return */ -#endif - -.Ldst_align: - tst r0, #3 /* check for dst alignment */ - beq .Ldst_aligned /* ok, proceed to next check */ - ldrb r5, [r1], #1 /* load a byte */ -#if defined(STRNCPY) - subs r2, r2, #1 /* subtract out from count */ - bmi .Ldst_full /* zero? the dst has no more room */ -#endif - strb r5, [r0], #1 /* store a byte */ - teq r5, #0 /* was it a NUL? */ - beq .Lend_of_string /* yes, we are done */ -#if defined(STRLCPY) - subs r2, r2, #1 /* subtract one from count */ - strbeq r2, [r0], #1 /* zero? write trailing NUL */ - beq .Ldst_full /* zero? the dst has no more room */ -#endif - b .Ldst_align /* loop around for next byte */ -.Ldst_aligned: - tst r1, #3 /* get the misalignment of src */ - bne .Lincongruent /* !=? incongruent (slower) */ - - /* =? congruent (faster) */ - -.Lcongruent: -#if defined(STRLCPY) - add r6, r6, #3 /* compensate for word post-inc */ -#endif - b .Lcongruent_mainloop_load -.Lcongruent_mainloop: -#if defined(STRLCPY) || defined(STRNCPY) - subs r2, r2, #4 /* subtract 4 from the count */ - bmi .Lno_more_room -#endif - str r5, [r0], #4 /* store word into dst */ -#if defined(STRLCPY) - beq .Lno_more_room /* count is 0? no room in dst */ -#endif -#if defined(STRNCPY) - beq .Ldst_full_word_aligned /* count is 0? no room in dst */ -#endif -.Lcongruent_mainloop_load: - ldr r5, [r1], #4 /* load word from source */ -#if defined(_ARM_ARCH_6) - uqadd8 r3, r5, r7 /* magic happens here */ - mvns r3, r3 /* is the complemented result 0? */ - beq .Lcongruent_mainloop /* yes, no NULs, do it again */ -#else - tst r5, #BYTE0 /* does byte 0 contain a NUL? */ - tstne r5, #BYTE1 /* no, does byte 1 contain a NUL? */ - tstne r5, #BYTE2 /* no, does byte 2 contain a NUL? */ - tstne r5, #BYTE3 /* no, does byte 3 contain a NUL? */ - bne .Lcongruent_mainloop /* yes, no NULs, do it again */ -#endif -#if defined(STRLCPY) && 0 - sub r1, r1, #3 /* back up src pointer */ -#endif -#if defined(_ARM_ARCH_6) -#ifdef __ARMEL__ - rev r3, r3 /* CLZ needs BE data */ -#endif - clz r3, r3 /* count leading zeros */ -#else - mov r3, #0 /* assume NUL is in byte 0 */ - tst r5, #BYTE0 /* is NUL in byte 2? */ - beq .Lcongruent_last_bytes /* yes, done searching. */ - mov r3, #8 /* assume NUL is in byte 1 */ - tst r5, #BYTE1 /* is NUL in byte 2? */ - beq .Lcongruent_last_bytes /* yes, done searching. */ - mov r3, #16 /* assume NUL is in byte 2 */ - tst r5, #BYTE2 /* is NUL in byte 2? */ -#if !defined(STRLCPY) - beq .Lcongruent_last_bytes /* yes, done searching. */ - mov r3, #24 /* NUL must be in byte 3 */ -#else - movne r3, #24 /* no, then NUL is in byte 3 */ -#endif -#endif /* _ARM_ARCH_6 */ -#if defined(STRLCPY) -.Lcongruent_last_bytes: -#endif -#if defined(STRLCPY) - add r1, r1, r3, lsr #3 /* position to point at NUL + 4 */ -#endif - b .Llast_bytes /* store the last bytes */ - - -.Lincongruent: - /* - * At this point dst is word aligned by src is not. Read bytes - * from src until it is read aligned. - */ - and r3, r1, #3 /* extract misalignment */ - mov r9, r3, lsl #3 /* calculate discard shift */ - rsb r8, r9, #32 /* calculate insertion shift */ -#if defined(STRLCPY) - add r6, r6, #3 /* compensate for word post-inc */ -#endif - bic r1, r1, #3 /* word align src */ - ldr r5, [r1], #4 /* load word frm src */ - mov r4, r5, lslo r9 /* discard lo bytes from src */ - tst r4, #BYTE0 /* does byte 0 contain a NUL? */ -#if defined(STRNCPY) - beq .Lend_of_string /* yes, zero fill rest of string */ -#else - moveq r3, r9 /* yes, set offset */ - beq .Lincongruent_end_of_string /* yes, deal with the last bytes */ -#endif - /* - * To make our test for NULs below do not generate false positives, - * fill the bytes in the word we don't want to match with all 1s. - */ - mvn r3, #0 /* create a mask */ - mov r3, r3, lslo r8 /* zero out bytes being kept */ - orr r5, r5, r3 /* merge src and mask */ -#ifdef _ARM_ARCH_6 - uqadd8 r3, r5, r7 /* NUL detection magic happens */ - mvns r3, r3 /* is the complemented result 0? */ - beq .Lincongruent_mainloop_load /* yes, no NUL encountered! */ -#ifdef __ARMEL__ - rev r3, r3 /* CLZ wants BE input */ -#endif - clz r3, r3 /* count leading zeros */ -#else - /* - * We already tested for byte 0 above so we don't need to it again. - */ - mov r3, #24 /* assume NUL is in byte 3 */ - tst r5, #BYTE1 /* did we find a NUL in byte 1? */ - subeq r3, r3, #8 /* yes, decremnt byte position */ - tstne r5, #BYTE2 /* no, did we find a NUL in byte 2? */ - subeq r3, r3, #8 /* yes, decremnt byte position */ - tstne r5, #BYTE3 /* no, did we find a NUL in byte 3? */ - bne .Lincongruent_mainloop_load /* no, no NUL encountered! */ -#endif - mov r5, r4 /* discard already dealt with bytes */ -.Lincongruent_end_of_string: -#if defined(STRLCPY) - add r1, r1, r3, lsr #3 /* then add offset to NUL */ -#endif - sub r3, r3, r9 /* adjust NUL offset */ - b .Llast_bytes /* NUL encountered! finish up */ - -#if defined(STRLCPY) || defined(STRNCPY) -.Lincongruent_no_more_room: - mov r5, r4 /* move data to be stored to r5 */ - b .Lno_more_room /* fill remaining space */ -#endif /* STRLCPY || STRNCPY */ - - /* - * At this point both dst and src are word aligned and r4 contains - * partial contents from src. - */ -.Lincongruent_mainloop: - orr r4, r4, r5, lshi r8 /* put new src data into dst word */ -#if defined(STRLCPY) || defined(STRNCPY) - subs r2, r2, #4 /* subtract 4 from count */ - bmi .Lincongruent_no_more_room /* count < 0? dst will be full */ -#endif - str r4, [r0], #4 /* store word in dst */ -#if defined(STRLCPY) - beq .Lno_more_room /* space left is 0? stop copy */ -#endif -#if defined(STRNCPY) - beq .Ldst_full_word_aligned /* space left is 0? stop copy */ -#endif - mov r4, r5, lslo r9 /* move rest of src into dst word */ -.Lincongruent_mainloop_load: - ldr r5, [r1], #4 /* read src */ -#ifdef _ARM_ARCH_6 - uqadd8 r3, r5, r7 /* magic happens here */ - mvns r3, r3 /* is the complemented result 0? */ - beq .Lincongruent_mainloop /* yes, no NUL encountered! */ - /* - * fall into this since we encountered a NULL. At this point we have - * from 1-5 bytes (excluding trailing NUL) to write. - */ -#ifdef __ARMEL__ - rev r3, r3 /* CLZ works on BE data */ -#endif - clz r3, r3 /* count leading zeroes */ -#else - tst r5, #BYTE0 /* does byte 0 contain a NUL? */ - tstne r5, #BYTE1 /* no, does byte 1 contain a NUL? */ - tstne r5, #BYTE2 /* no, does byte 2 contain a NUL? */ - tstne r5, #BYTE3 /* no, does byte 3 contain a NUL? */ - bne .Lincongruent_mainloop /* no, no NUL encountered! */ - /* - * fall into this since we encountered a NULL. At this point we have - * from 1-5 bytes (excluding trailing NUL) to write. - */ - mov r3, #0 /* assume a NUL is in byte 0 */ - tst r5, #BYTE0 /* is there a NUL in byte 0? */ - beq 1f /* yes, found a NUL! */ - mov r3, #8 /* assume a NUL is in byte 1 */ - tst r5, #BYTE1 /* is there a NUL in byte 0? */ - beq 1f /* yes, found a NUL! */ - tst r5, #BYTE2 /* is there a NUL in byte 2? */ - moveq r3, #16 /* yes, mark its position */ - movne r3, #24 /* no, it must be in byte 3 */ -1: -#endif - orr r4, r4, r5, lshi r8 /* merge new and old src words */ -#if defined(STRLCPY) - add r1, r1, r3, lsr #3 /* adjust src to point to NUL */ -#endif - add r3, r3, r8 /* add remainder bytes worth */ - cmp r3, #32 /* do we have at least one word to write? */ - movlt r5, r4 /* no, move source bytes to expected reg */ - blt .Llast_bytes /* no, deal with them */ -#if defined(STRLCPY) - subs r2, r2, #4 /* subtract 4 from count */ - bpl 1f /* we have space for at least 4 */ - /* - * Since the space just went minus, we don't have enough room to - * write all 4 bytes. In fact, the most we can write is 3 so just - * just lie and say we have 3 bytes to write and discard the rest. - */ - add r2, r2, #4 /* add 4 back */ - mov r3, #24 /* say we have 3 bytes */ - mov r5, r4 /* discard the bytes we can't store */ - b .Llast_bytes /* and treat this as our last word */ -1: -#elif defined(STRNCPY) - subs r2, r2, #4 /* subtract 4 from count */ - bmi .Lincongruent_no_more_room /* count < 0? dst will be full */ -#endif - str r4, [r0], #4 /* store dst word */ -#if defined(STRNCPY) - beq .Ldst_full_word_aligned /* space left is 0? stop copy */ -#endif -#if defined(STRLCPY) - bne 1f /* we still have space remaining */ - strb r2, [r0] /* write final NUL */ - b .Lend_of_string /* we are done */ -1: -#endif - /* - * Subtract the 32 bits just written from the number of bits left - * to write. If 0 bits are left and not doing strncpy, just write - * the trailing NUL and be done. - */ - subs r3, r3, #32 /* we wrote one word */ -#if !defined(STRNCPY) - bne 1f /* no more data? */ - strb r3, [r0] /* write final NUL */ - b .Lend_of_string /* we are done */ -1: -#endif - /* - * At this point after writing 4 bytes, we have 0 or 1 bytes left to - * write (excluding the trailing NUL). - */ - mov r5, r5, lslo r9 /* get remainder of src */ - - /* fall into .Llast_bytes */ - -#if !defined(STRLCPY) -.Lcongruent_last_bytes: -#endif -.Llast_bytes: - /* - * r5 contains the last word and is in host byte order. - * r3 contains number of bits left to copy (0..31). - * r1 should point to the NUL + 4. - */ - bics ip, r3, #7 /* truncate bits, is result 0? */ -#if !defined(STRNCPY) - bne 1f /* no, have to write some bytes */ - strb ip, [r0] /* yes, write trailing NUL */ - b .Lend_of_string /* yes, and we are the end */ -1: -#endif -#if defined(STRLCPY) || defined(STRNCPY) - cmp r2, ip, lsr #3 /* is there enough room? */ - movlt ip, r2, lsl #3 /* no, only fill remaining space */ -#endif - mvn r3, #0 /* create a mask */ - mov r3, r3, lshi ip /* clear leading bytes */ - bic r5, r5, r3 /* clear trailing bytes */ -#if defined(STRNCPY) - cmp r2, #4 /* room for 4 bytes? */ - movge ip, #32 /* yes, we will write 4 bytes */ - bge 2f /* yes, and go do it */ - mvn r3, #0 /* create a mask (again) */ - mov ip, r2, lsl #3 /* remaining space bytes -> bits */ - mov r3, r3, lshi ip /* clear remaining bytes */ -#elif defined(STRLCPY) - cmp r2, #3 /* do we have room for 3 bytes & NUL? */ - bge 2f /* yes, just clear out dst */ - mov r3, r3, lshi #8 /* mask out trailing NUL */ -#else - cmp ip, #24 /* are we writing 3 bytes & a NUL? */ - bge 2f /* yes, just overwrite dst */ - mov r3, r3, lshi #8 /* mask out trailing NUL */ -#endif /* !STRNCPY */ - ldr r4, [r0] /* fetch dst word */ - and r4, r4, r3 /* preserve trailing bytes */ - orr r5, r5, r4 /* merge dst with src */ -2: str r5, [r0], #4 /* store last word */ -#if defined(STRNCPY) - subs r2, r2, ip, lsr #3 /* subtract bytes cleared from count */ - beq .Ldst_full_word_aligned -#endif - b .Lend_of_string - -#if defined(STRLCPY) || defined(STRNCPY) -.Lno_more_room: -#if defined(STRLCPY) - cmp r2, #-1 /* tried to write 3 bytes? */ - blt 1f /* less, partial word write */ - cmp r2, #0 /* no space left? */ - strbeq r2, [r0] /* write the final NUL */ - bicne r5, r5, #BYTE3 /* clear trailing NUL */ - strne r5, [r0] /* write last word */ - b .Ldst_full_word_aligned /* the dst buffer is full */ -1: -#endif /* STRLCPY */ - add r2, r2, #4 /* restore remaining space */ - ldr r4, [r0] /* load dst */ - mvn r3, #0 /* create a mask */ - mov r2, r2, lsl #3 /* bytes -> bits */ - mov r3, r3, lshi r2 /* clear leading bytes */ - bic r5, r5, r3 /* clear trailing bytes from src */ -#if defined(STRLCPY) - mov r3, r3, lshi #8 /* mask out trailing NUL */ -#endif /* STRLCPY */ - and r4, r4, r3 /* preserve trailing bytes in dst */ - orr r4, r4, r5 /* merge src with dst */ - str r4, [r0], #4 /* write last word */ - b .Ldst_full_word_aligned -#endif /* STRLCPY || STRNCPY */ - -#if defined(STRLCPY) - /* - * Destination was filled (and NUL terminated). - * All that's left is count the number of bytes left in src. - */ -.Ldst_full: -1: tst r1, #3 /* dst word aligned? */ - beq 2f /* yes, so do it word by word */ - ldrb r5, [r1], #1 /* load next byte */ - teq r5, #0 /* is it a NUL? */ - bne 1b /* no, check alignment */ - b .Lend_of_string /* and return */ -2: add r6, r6, #3 /* compensate for post-inc */ -.Ldst_full_word_aligned: -3: ldr r5, [r1], #4 /* load word from src */ -#ifdef _ARM_ARCH_6 - uqadd8 r5, r5, r7 /* perform NUL magic */ - mvns r5, r5 /* complement all 0s? */ - beq 3b /* yes, no NUL so get next word */ -#else - tst r5, #BYTE0 /* does byte 0 contain a NUL? */ - tstne r5, #BYTE1 /* no, does byte 1 contain a NUL? */ - tstne r5, #BYTE2 /* no, does byte 2 contain a NUL? */ - tstne r5, #BYTE3 /* no, does byte 3 contain a NUL? */ - bne 3b /* no, no NUL encountered! */ -#endif -#ifdef _ARM_ARCH_6 -#ifdef __ARMEL__ - rev r5, r5 /* CLZ needs BE data */ -#endif - clz r5, r5 /* count leading zeros */ - add r1, r1, r5, lsr #3 /* add offset to NUL to src pointer */ -#else - tst r5, #BYTE0 /* is there a NUL in byte 0? */ - beq 4f /* yes, don't check any further */ - add r1, r1, #1 /* no, advance src pointer by 1 */ - tst r5, #BYTE1 /* is there a NUL in byte 1? */ - beq 4f /* yes, don't check any further */ - add r1, r1, #1 /* no, advance src pointer by 1 */ - tst r5, #BYTE2 /* is there a NUL in byte 2? */ - addne r1, r1, #1 /* no, there must be in byte 3 */ -4: -#endif /* _ARM_ARCH_6 */ -.Lend_of_string: - sub r0, r1, r6 /* subtract start from finish */ - pop {r4-r9} /* restore registers */ - RET -#elif defined(STRNCPY) -.Lend_of_string: - teq r2, #0 /* any bytes left to zero? */ - beq 3f /* no, just return. */ - mov r1, #0 /* yes, prepare to zero */ - cmp r2, #16 /* some, but not a lot? */ - ble 1f - mov r4, lr /* preserve lr */ - bl PLT_SYM(_C_LABEL(memset)) /* yes, and let memset do it */ - mov lr, r4 /* restore lr */ - b 3f /* return */ -1: add ip, r0, r2 /* calculate stopping point */ -2: strb r1, [r0], #1 /* clear a byte */ - cmp r0, ip /* done? */ - blt 2b /* no, clear next byte */ -3: mov r0, r6 /* restore dst pointer */ - pop {r4-r9} /* restore registers */ - RET -.Ldst_full: -.Ldst_full_word_aligned: - /* - * Destination was filled (but not NUL terminated). - * All that's left is return the start of dst - */ - mov r0, r6 /* restore dst pointer */ - pop {r4-r9} /* restore registers */ - RET -#else -.Lend_of_string: - mov r0, r6 /* restore dst pointer */ - pop {r4-r9} /* restore registers */ - RET -#endif -END(FUNCNAME) diff --git a/common/lib/libc/arch/arm/string/strcpy_naive.S b/common/lib/libc/arch/arm/string/strcpy_naive.S deleted file mode 100644 index b11fc833b..000000000 --- a/common/lib/libc/arch/arm/string/strcpy_naive.S +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include - -RCSID("$NetBSD: strcpy_naive.S,v 1.4 2013/08/20 21:37:39 matt Exp $") - -#ifdef _LIBC -#ifdef STRLCPY -WEAK_ALIAS(strlcpy, _strlcpy) -#endif -#include "namespace.h" -#endif - -/* - * These are "naive" versions of the str*cpy routines designed to be simple - * and small. - */ - -#if defined(STRLCPY) -/* LINTSTUB: size_t strlcpy(char *, const char *, size_t) */ -ENTRY(strlcpy) - add ip, r1, #1 /* save src pointer (+ NUL) */ - subs r2, r2, #1 /* make sure there's room for a NUL */ - blt 3f /* no room, do the strlen */ - add r2, r2, r0 /* get end of dst */ -1: cmp r0, r2 /* room for another char? */ - beq 2f /* no, write NUL and do the strlen */ - ldrb r3, [r1], #1 /* read a byte */ - strb r3, [r0], #1 /* write a byte */ - teq r3, #0 /* was it a NUL? */ - bne 1b /* no, do next byte */ - b 4f /* yes, end of string, so return */ -2: mov r3, #0 /* NUL */ - strb r3, [r0] /* write to end of string */ -3: ldrb r3, [r1], #1 /* read a byte */ - teq r3, #0 /* was it a NUL? */ - bne 3b /* no, get next byte */ -4: sub r0, r1, ip /* return length of src string */ - RET -END(strlcpy) -#elif defined(STRNCPY) -/* LINTSTUB: char * strncpy(char *, const char *, size_t) */ -ENTRY(strncpy) - mov ip, r0 /* we want to preserve r0 */ - add r2, r2, r0 /* get end of dst buffer */ -1: cmp ip, r2 /* are at the end of dst already? */ - RETc(eq) /* yes, just return. */ - ldrb r3, [r1], #1 /* read a byte */ - strb r3, [ip], #1 /* write a byte */ - teq r3, #0 /* was it a NUL? */ - bne 1b /* no, try next byte */ -2: cmp ip, r2 /* are at the end of dst already? */ - strblt r3, [ip], #1 /* no, write a NUL */ - blt 2b /* until dst is filled */ -3: RET /* return dst pointer */ -END(strncpy) -#else -/* LINTSTUB: char * strcpy(char *, const char *) */ -ENTRY(strcpy) - mov ip, r0 /* we want to preserve r0 */ -1: ldrb r3, [r1], #1 /* read a byte */ - strb r3, [ip], #1 /* write a byte */ - teq r3, #0 /* was it a NUL? */ - bne 1b /* no, try next byte */ - RET /* return dst pointer */ -END(strcpy) -#endif diff --git a/common/lib/libc/arch/arm/string/strcpy_thumb.S b/common/lib/libc/arch/arm/string/strcpy_thumb.S deleted file mode 100644 index 4b5f892ea..000000000 --- a/common/lib/libc/arch/arm/string/strcpy_thumb.S +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include - -RCSID("$NetBSD: strcpy_thumb.S,v 1.1 2013/08/20 21:32:50 matt Exp $") - -#ifdef _LIBC -#ifdef STRLCPY -WEAK_ALIAS(strlcpy, _strlcpy) -#endif -#include "namespace.h" -#endif - -/* - * These are "naive" versions of the str*cpy routines designed to be simple - * and small. - */ - -#if defined(STRLCPY) -/* LINTSTUB: size_t strlcpy(char *, const char *, size_t) */ -ENTRY(strlcpy) - adds r3, r1, #1 /* save src pointer (+ NUL) */ - subs r2, r2, #1 /* make sure there's room for a NUL */ - blt 3f /* no room, do the strlen */ - adds r2, r2, r0 /* get end of dst */ - subs r0, r0, r1 /* bias against r1 so one incr */ -1: cmp r0, r2 /* room for another char? */ - beq 2f /* no, write NUL and do the strlen */ - ldrb r3, [r1] /* read a byte */ - strb r3, [r0, r1] /* write a byte */ - adds r1, r1, #1 /* advance to next byte */ - cmp r3, #0 /* was it a NUL? */ - bne 1b /* no, do next byte */ - b 4f /* yes, end of string, so return */ -2: movs r3, #0 /* NUL */ - strb r3, [r0] /* write to end of string */ -3: ldrb r3, [r1] /* read a byte */ - adds r1, r1, #1 /* advance to next byte */ - cmp r3, #0 /* was it a NUL? */ - bne 3b /* no, get next byte */ -4: subs r0, r1, r3 /* return length of src string */ - RET -END(strlcpy) -#elif defined(STRNCPY) -/* LINTSTUB: char * strncpy(char *, const char *, size_t) */ -ENTRY(strncpy) - mov ip, r0 /* we want to preserve r0 */ - adds r2, r2, r0 /* get end of dst buffer */ - subs r1, r1, r0 /* allows to only increment once */ -1: cmp r0, r2 /* are at the end of dst already? */ - beq 3f /* yes, just return. */ - ldrb r3, [r1, r0] /* read a byte */ - strb r3, [r0] /* write a byte */ - adds r0, r0, #1 /* advance a byte */ - cmp r3, #0 /* was it a NUL? */ - bne 1b /* no, try next byte */ -2: cmp r0, r2 /* are at the end of dst already? */ - beq 3f /* yes, exit loop - strb r3, [r0] /* write a NUL */ - adds r0, r0, #1 /* advance a bytes */ - b 2b /* until dst is filled */ -3: mov r0, ip /* return dst pointer */ - RET -END(strncpy) -#else -/* LINTSTUB: char * strcpy(char *, const char *) */ -ENTRY(strcpy) - subs r2, r0, r1 /* we want to preserve r0 */ -1: ldrb r3, [r1] /* read a byte */ - strb r3, [r2, r1] /* write a byte */ - adds r1, r1, #1 /* advance to next byte */ - cmp r3, #0 /* was it a NUL? */ - bne 1b /* no, try next byte */ - RET /* return dst pointer */ -END(strcpy) -#endif diff --git a/common/lib/libc/arch/arm/string/strlcat.S b/common/lib/libc/arch/arm/string/strlcat.S deleted file mode 100644 index 2828e4181..000000000 --- a/common/lib/libc/arch/arm/string/strlcat.S +++ /dev/null @@ -1,14 +0,0 @@ -/* $NetBSD: strlcat.S,v 1.2 2013/08/20 21:08:54 matt Exp $ */ - -#include - -#ifdef _LIBC -WEAK_ALIAS(strlcat, _strlcat) -#include "namespace.h" -#endif - -#if defined(_STANDALONE) && 0 /* arm version is always smaller */ -#include "strlcat_naive.S" -#else -#include "strlcat_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strlcat_arm.S b/common/lib/libc/arch/arm/string/strlcat_arm.S deleted file mode 100644 index 3b8c38493..000000000 --- a/common/lib/libc/arch/arm/string/strlcat_arm.S +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strlcat_arm.S,v 1.6 2014/05/06 16:02:11 joerg Exp $") - -/* LINTSTUB: size_t strlcat(char *, const char *, size_t) */ -ENTRY(strlcat) -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) -# if !defined(__ARM_DWARF_EH__) - .fnstart -# endif - .cfi_startproc -#endif - push {r4-r6, lr} -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) -# if !defined(__ARM_DWARF_EH__) - .save {r4-r6, lr} -# endif - .cfi_def_cfa_offset 16 - .cfi_offset 14, -4 - .cfi_offset 6, -8 - .cfi_offset 5, -12 - .cfi_offset 4, -16 -#endif - mov r4, r0 /* save dst */ - mov r5, r1 /* save src */ - mov r6, r2 /* save siz */ - - mov r1, r6 /* get siz */ - bl PLT_SYM(strnlen) /* find length of dst (up to siz) */ - - subs r2, r6, r0 /* get remaining space in dst */ - mov r1, r5 /* restore src */ - mov r5, r0 /* save remaining space */ - adds r0, r0, r4 /* set start to end of dst */ - bl PLT_SYM(strlcpy) /* attempt to copy src */ - adds r0, r0, r5 /* add remaining to strlcpy return */ - pop {r4-r6, pc} /* restore registers and return */ -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) - .cfi_endproc -# if !defined(__ARM_DWARF_EH__) - .fnend -# endif -#endif -END(strlcat) diff --git a/common/lib/libc/arch/arm/string/strlcat_naive.S b/common/lib/libc/arch/arm/string/strlcat_naive.S deleted file mode 100644 index 9fa3ac8a3..000000000 --- a/common/lib/libc/arch/arm/string/strlcat_naive.S +++ /dev/null @@ -1,79 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strlcat_naive.S,v 1.3 2013/08/22 19:25:00 matt Exp $") - -/* LINTSTUB: size_t strlcat(char *, const char *, size_t) */ -ENTRY(strlcat) - adds r3, r2, r0 /* point to just end of dst */ - mov ip, r0 /* need to keep r0 for a while */ -1: cmp ip, r3 /* still within dst? */ - beq 3f /* no, get length of src */ - ldrb r2, [ip], #1 /* load next byte */ - cmp r2, #0 /* was it a NUL? */ - bne 1b /* no, get next byte */ - - sub r0, ip, r0 /* get actual length of dst */ - subs r0, r0, #1 /* account for the trailing NUL */ - subs r3, r3, #1 /* back up to last byte in dst */ - sub ip, ip, #1 /* back up over the NUL */ - -2: ldrb r2, [r1], #1 /* load next byte from append */ -#if defined(__thumb__) && defined(_ARM_ARCH_T2) - cbz r2, 5f /* was it a NUL? yes, end of append */ -#else - cmp r2, #0 /* was it a NUL? */ - beq 5f /* yes, end of append */ -#endif - adds r0, r0, #1 /* count another byte */ - cmp ip, r3 /* do we have enough room for it? */ -#ifdef __thumb__ - bge 2b - strb r2, [ip], #1 /* yes, store it */ -#else - strblt r2, [ip], #1 /* yes, store it */ -#endif - b 2b /* get next byte from append */ - -3: subs r0, r3, r0 /* move size to return value */ -4: ldrb r2, [r1], #1 /* load next byte from append */ -#if defined(__thumb__) && defined(_ARM_ARCH_T2) - cbz r2, 6f /* was it a NUL? yes, we're done */ -#else - RETc(eq) /* yes, we're done */ -#endif - adds r0, r0, #1 /* add one to return value */ - b 4b /* get next byte from append */ - -5: movs r2, #0 /* NUL */ - strb r2, [ip] /* append final NUL */ -6: RET /* return */ -END(strlcat) diff --git a/common/lib/libc/arch/arm/string/strlcpy.S b/common/lib/libc/arch/arm/string/strlcpy.S deleted file mode 100644 index 83708ac4b..000000000 --- a/common/lib/libc/arch/arm/string/strlcpy.S +++ /dev/null @@ -1,13 +0,0 @@ -/* $NetBSD: strlcpy.S,v 1.5 2013/08/20 21:35:24 matt Exp $ */ - -#define STRLCPY - -#if defined(_STANDALONE) -#if defined(__thumb__) -#include "strcpy_thumb.S" -#else -#include "strcpy_naive.S" -#endif -#else -#include "strcpy_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strlen.S b/common/lib/libc/arch/arm/string/strlen.S deleted file mode 100644 index 034289bd3..000000000 --- a/common/lib/libc/arch/arm/string/strlen.S +++ /dev/null @@ -1,9 +0,0 @@ -/* $NetBSD: strlen.S,v 1.4 2013/08/20 08:07:30 matt Exp $ */ - -#include - -#if defined(_STANDALONE) || (defined(__thumb__) && !defined(_ARM_ARCH_T2)) -#include "strlen_naive.S" -#else -#include "strlen_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strlen_arm.S b/common/lib/libc/arch/arm/string/strlen_arm.S deleted file mode 100644 index aa4b93d66..000000000 --- a/common/lib/libc/arch/arm/string/strlen_arm.S +++ /dev/null @@ -1,186 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strlen_arm.S,v 1.9 2014/05/06 16:02:11 joerg Exp $") - -#if defined(__thumb__) && !defined(_ARM_ARCH_T2) -#error Only Thumb2 or ARM supported -#endif - -#ifdef __ARMEL__ -#define BYTE0 0x000000ff -#define BYTE1 0x0000ff00 -#define BYTE2 0x00ff0000 -#define BYTE3 0xff000000 -#else -#define BYTE0 0xff000000 -#define BYTE1 0x00ff0000 -#define BYTE2 0x0000ff00 -#define BYTE3 0x000000ff -#endif - -#ifdef STRNLEN -#define FUNCNAME strnlen -#else -#define FUNCNAME strlen -#endif - - .text -ENTRY(FUNCNAME) -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) -# if !defined(__ARM_DWARF_EH__) - .fnstart -# endif - .cfi_startproc -#endif -#ifdef STRNLEN - push {r4,r5} /* save some registers */ -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) -# if !defined(__ARM_DWARF_EH__) - .save {r4,r5} -# endif - .cfi_def_cfa_offset 8 - .cfi_offset 5, -4 - .cfi_offset 4, -8 -#endif - adds r5, r0, r1 /* get ptr to end of string */ - mov r4, r1 /* save maxlen */ -#endif - adds r2, r0, #4 /* for the final post-inc */ -1: tst r0, #3 /* test for word alignment */ - beq .Lpre_main_loop /* finally word aligned */ -#ifdef STRNLEN - cmp r0, r5 /* have we gone too far? */ - beq .Lmaxed_out /* yes, return maxlen */ -#endif - ldrb r3, [r0], #1 /* load a byte */ - cmp r3, #0 /* is it 0? */ - bne 1b /* no, try next byte */ - subs r2, r2, #3 /* subtract (4 - the NUL) */ - subs r0, r0, r2 /* subtract start */ -#ifdef STRNLEN - pop {r4, r5} /* restore registers */ -#endif - RET /* return */ -.Lpre_main_loop: -#if defined(_ARM_ARCH_7) - movw r1, #0xfefe /* magic constant; 254 in each byte */ - movt r1, #0xfefe /* magic constant; 254 in each byte */ -#elif defined(_ARM_ARCH_6) - mov r1, #0xfe /* put 254 in low byte */ - orr r1, r1, r1, lsl #8 /* move to next byte */ - orr r1, r1, r1, lsl #16 /* move to next halfword */ -#endif /* _ARM_ARCH_6 */ -.Lmain_loop: -#ifdef STRNLEN - cmp r0, r5 /* gone too far? */ - bge .Lmaxed_out /* yes, return maxlen */ -#endif - ldr r3, [r0], #4 /* load next word */ -#if defined(_ARM_ARCH_6) - /* - * Add 254 to each byte using the UQADD8 (unsigned saturating add 8) - * instruction. For every non-NUL byte, the result for that byte will - * become 255. For NUL, it will be 254. When we complement the - * result, if the result is non-0 then we must have encountered a NUL. - */ - uqadd8 r3, r3, r1 /* magic happens here */ - mvns r3, r3 /* is the complemented result non-0? */ - beq .Lmain_loop /* no, then we encountered no NULs */ -#else - /* - * No fancy shortcuts so just test each byte lane for a NUL. - * (other tests for NULs in a word take more instructions/cycles). - */ - tst r3, #BYTE0 /* is this byte 0? */ - tstne r3, #BYTE1 /* no, is this byte 0? */ - tstne r3, #BYTE2 /* no, is this byte 0? */ - tstne r3, #BYTE3 /* no, is this byte 0? */ - bne .Lmain_loop /* no, then get next word */ -#endif -#if defined(_ARM_ARCH_6) - /* - * We encountered a NUL. Find out where by doing a CLZ and then - * shifting right by 3. That will be the number of non-NUL bytes. - */ -#ifdef __ARMEL__ - rev r3, r3 /* we want this in BE for the CLZ */ -#endif - clz r3, r3 /* count how many leading zeros */ -#ifdef __thumb__ - lsrs r3, r3, #3 - adds r0, r0, r3 /* divide that by 8 and add to count */ -#else - add r0, r0, r3, lsr #3 /* divide that by 8 and add to count */ -#endif -#else - /* - * We encountered a NUL. - */ - tst r3, #BYTE0 /* 1st byte was NUL? */ - beq 1f /* yes, done adding */ - add r0, r0, #1 /* we have one more non-NUL byte */ - tst r3, #BYTE1 /* 2nd byte was NUL? */ - beq 1f /* yes, done adding */ - add r0, r0, #1 /* we have one more non-NUL byte */ - tst r3, #BYTE2 /* 3rd byte was NUL? */ - addne r0, r0, #1 /* no, we have one more non-NUL byte */ -1: -#endif /* _ARM_ARCH_6 */ - /* - * r0 now points to 4 past the NUL due to the post-inc. Subtract the - * start of the string (which also has 4 added to it to compensate for - * the post-inc. - */ - subs r0, r0, r2 /* subtract start to get length */ -#ifdef STRNLEN - cmp r0, r4 /* is it larger than maxlen? */ -#ifdef __thumb__ - it gt -#endif - movgt r0, r4 /* yes, return maxlen */ - pop {r4, r5} /* restore registers */ -#endif - RET /* return */ - -#ifdef STRNLEN -.Lmaxed_out: - mov r0, r4 /* return maxlen */ - pop {r4, r5} /* restore registers */ - RET /* return */ -#endif -#if defined(__ARM_EABI__) && defined(__UNWIND_TABLES__) - .cfi_endproc -# if !defined(__ARM_DWARF_EH__) - .fnend -# endif -#endif -END(FUNCNAME) diff --git a/common/lib/libc/arch/arm/string/strlen_naive.S b/common/lib/libc/arch/arm/string/strlen_naive.S deleted file mode 100644 index 557ace97c..000000000 --- a/common/lib/libc/arch/arm/string/strlen_naive.S +++ /dev/null @@ -1,74 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include - -RCSID("$NetBSD: strlen_naive.S,v 1.8 2013/08/19 17:02:25 matt Exp $") - -#ifdef STRNLEN -/* LINTSTUB: size_t strnlen(const char *, size_t) */ -ENTRY(strnlen) - adds r3, r0, #1 /* start of src + NUL */ -#ifdef __thumb__ - adds r2, r0, r1 /* &src[maxlen] */ - mov ip, r2 -#else - adds ip, r0, r1 /* &src[maxlen] */ -#endif -1: cmp r0, ip /* is this of string? */ - beq 2f /* yes it is */ -#ifdef __thumb__ - ldrb r2, [r0] /* read a byte */ - adds r0, r0, #1 /* advance to next byte */ -#else - ldrb r2, [r0], #1 /* read a byte */ -#endif - cmp r2, #0 /* is it a NUL? */ - bne 1b /* no, get next byte */ - subs r0, r0, r3 /* get difference between start and end */ - RET /* return */ -2: mov r0, r1 /* get maxlen */ - RET /* return */ -END(strnlen) -#else /* STRNLEN */ -/* LINTSTUB: size_t strlen(const char *) */ -ENTRY(strlen) - adds r3, r0, #1 /* start of src + NUL */ -1: -#ifdef __thumb__ - ldrb r2, [r0] /* read a byte */ - adds r0, r0, #1 -#else - ldrb r2, [r0], #1 /* read a byte */ -#endif - cmp r2, #0 /* is it a NUL? */ - bne 1b /* no, get next byte */ - subs r0, r0, r3 /* return difference between start and end */ - RET -END(strlen) -#endif /* !STRNLEN */ diff --git a/common/lib/libc/arch/arm/string/strlen_neon.S b/common/lib/libc/arch/arm/string/strlen_neon.S deleted file mode 100644 index c5c07aac6..000000000 --- a/common/lib/libc/arch/arm/string/strlen_neon.S +++ /dev/null @@ -1,86 +0,0 @@ -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strlen_neon.S,v 1.3 2012/12/28 05:15:08 matt Exp $") - .text - -ENTRY(strlen) - mov ip, r0 /* we use r0 for return value */ - ands r1, r0, #15 /* verify qword alignment */ - neg r0, r1 /* subtract misalignment from count */ - veor q2, q2, q2 /* clear mask */ - mov r3, #7 /* NBBY - 1 */ - vdup.32 q3, r3 /* dup throughout q3 */ - movw r3, #0x0404 /* magic since there are 4 bytes per U32 */ - orr r3, r3, lsl #16 /* copy to upper 16 bits */ - beq .Lmain_loop - veor q0, q0, q0 /* clear q0 */ - vmvn q2, q2 /* set all 16 bytes of mask to all 1s */ - bic ip, ip, #15 /* qword align string address */ - lsl r1, r1, #3 /* convert to bits */ - cmp r1, #64 - rsbgt r1, r1, #128 /* > 64? BE so we are shifting LSW right */ - movgt r2, #0 /* > 64? leave MSW alone */ - rsble r2, r1, #64 /* <=64? BE so we are shifting MSW right */ - movle r1, #64 /* <=64? clear LSW */ - vmov d0, r1, r2 /* set shifts for lower and upper halves */ - vmovl.u32 q0, d0 /* 2 U32 -> 2 U64 */ - vshl.u64 q2, q2, q0 /* shift */ - /* - * Main loop. Load 16 bytes, do a clz, - */ -.Lmain_loop: - vld1.64 {d0, d1}, [ip:128]! /* load qword */ -#ifdef __ARMEL__ - vrev64.8 q0, q0 /* convert to BE for clz */ -#endif - vswp d0, d1 /* swap dwords to get BE qword */ - vorr q0, q0, q2 /* or "in" leading byte mask */ - veor q2, q2, q2 /* clear leading byte mask */ - vceq.i8 q1, q0, #0 /* test each byte for 0 */ - /* Why couldn't there be a 64-bit CLZ? */ - vclz.u32 q1, q1 /* count leading zeroes to find the 0 byte */ - vadd.u32 q1, q1, q3 /* round up to byte bounary */ - vshr.u32 q1, q1, #3 /* convert to bytes */ - vmovn.u32 d0, q1 /* 4 I32 -> 4 I16 */ - vmovn.u16 d0, q0 /* 4 I16 -> 4 I8 */ - vmov r2, s0 /* get counts */ - eors r2, r2, r3 /* xor with 0x04040404 */ - addeq r0, #16 /* 0? no NULs */ - beq .Lmain_loop /* get next qword */ - clz ip, r2 /* count leading zeros */ - mov r2, r2, lsl ip /* discard them */ - mov ip, ip, lsr #3 /* divide leading zeroes by 8 */ - add r0, r0, ip, lsl #2 /* multiple by 4 and add to count */ - and r2, r2, #(3 << 29) - add r0, r0, r2, lsr #29 - RET /* and return. */ -END(strlen) diff --git a/common/lib/libc/arch/arm/string/strncmp.S b/common/lib/libc/arch/arm/string/strncmp.S deleted file mode 100644 index 992dc36f9..000000000 --- a/common/lib/libc/arch/arm/string/strncmp.S +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: strncmp.S,v 1.2 2013/08/19 00:57:25 matt Exp $ */ - -/* - * Copyright (c) 2002 ARM Ltd - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the company may not be used to endorse or promote - * products derived from this software without specific prior written - * permission. - * - * THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS'' AND ANY EXPRESS OR IMPLIED - * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strncmp.S,v 1.2 2013/08/19 00:57:25 matt Exp $") - -ENTRY(strncmp) -/* if ((len - 1) < 0) return 0 */ - subs r2, r2, #1 -#ifdef __thumb__ - bmi 5f -#else - movmi r0, #0 - RETc(mi) -#endif - -/* ip == last src address to compare */ -#ifdef __thumb__ - adds r3, r0, r2 - mov ip, r3 - subs r1, r1, r0 -#else - add ip, r0, r2 -#endif -1: -#ifdef __thumb__ - ldrb r2, [r0] - ldrb r3, [r1, r0] - adds r0, r0, #1 - cmp ip, r0 /* exhausted length? */ - bcc 4f /* yes, we're done */ - cmp r2, #1 /* NUL? */ - bcc 4f /* yes, we're done */ - cmp r2, r3 /* different? */ -#else - ldrb r2, [r0], #1 - ldrb r3, [r1], #1 - cmp ip, r0 - cmpcs r2, #1 - cmpcs r2, r3 -#endif - beq 1b -4: subs r0, r2, r3 - RET -#ifdef __thumb__ -5: movs r0, #0 - RET -#endif -END(strncmp) diff --git a/common/lib/libc/arch/arm/string/strncpy.S b/common/lib/libc/arch/arm/string/strncpy.S deleted file mode 100644 index dc3465e04..000000000 --- a/common/lib/libc/arch/arm/string/strncpy.S +++ /dev/null @@ -1,13 +0,0 @@ -/* $NetBSD: strncpy.S,v 1.3 2013/08/20 21:35:24 matt Exp $ */ - -#define STRNCPY - -#if defined(_STANDALONE) -#if defined(__thumb__) -#include "strcpy_thumb.S" -#else -#include "strcpy_naive.S" -#endif -#else -#include "strcpy_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strnlen.S b/common/lib/libc/arch/arm/string/strnlen.S deleted file mode 100644 index 21fbf2737..000000000 --- a/common/lib/libc/arch/arm/string/strnlen.S +++ /dev/null @@ -1,11 +0,0 @@ -/* $NetBSD: strnlen.S,v 1.3 2013/08/20 08:08:59 matt Exp $ */ - -#include /* for _ARM_ARCH_T2 */ - -#define STRNLEN - -#if defined(_STANDALONE) || (defined(__thumb__) && !defined(_ARM_ARCH_T2)) -#include "strlen_naive.S" -#else -#include "strlen_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strrchr.S b/common/lib/libc/arch/arm/string/strrchr.S deleted file mode 100644 index cbbe9de48..000000000 --- a/common/lib/libc/arch/arm/string/strrchr.S +++ /dev/null @@ -1,11 +0,0 @@ -/* $NetBSD: strrchr.S,v 1.4 2013/08/20 08:07:30 matt Exp $ */ - -#include - -STRONG_ALIAS(rindex, strrchr) - -#if defined(_STANDALONE) || (defined(__thumb__) && !defined(_ARM_ARCH_T2)) -#include "strrchr_naive.S" -#else -#include "strrchr_arm.S" -#endif diff --git a/common/lib/libc/arch/arm/string/strrchr_arm.S b/common/lib/libc/arch/arm/string/strrchr_arm.S deleted file mode 100644 index c07e28096..000000000 --- a/common/lib/libc/arch/arm/string/strrchr_arm.S +++ /dev/null @@ -1,161 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: strrchr_arm.S,v 1.6 2013/08/25 06:15:06 matt Exp $") - -#ifdef __ARMEL__ -#define BYTE0 0x000000ff -#define BYTE1 0x0000ff00 -#define BYTE2 0x00ff0000 -#define BYTE3 0xff000000 -#define lshi lsl -#define lshis lsls -#else -#define BYTE0 0xff000000 -#define BYTE1 0x00ff0000 -#define BYTE2 0x0000ff00 -#define BYTE3 0x000000ff -#define lshi lsr -#define lshis lsrs -#endif - -ENTRY(strrchr) - ands r2, r1, #0xff /* is the byte value NUL? */ - bne 1f /* no, do it the hard way */ - push {r0, lr} /* save pointer and return addr */ - bl PLT_SYM(strlen) /* get length */ - pop {r1, r2} /* restore pointer / return addr */ - adds r0, r0, r1 /* add pointer to length */ - RETr(r2) /* return */ - -1: mov r1, r0 /* we use r0 at the return value */ - movs r0, #0 /* return NULL by default */ -2: tst r1, #3 /* test for word alignment */ - beq .Lpre_main_loop /* finally word aligned */ - ldrb r3, [r1], #1 /* load a byte */ - cmp r3, r2 /* did it match? */ -#ifdef __thumb__ - it eq -#endif - subeq r0, r1, #1 /* yes, remember that it did */ - cmp r3, #0 /* was it NUL? */ - bne 2b /* no, try next byte */ - RET /* return */ -.Lpre_main_loop: - push {r4, r5} /* save some registers */ -#if defined(_ARM_ARCH_7) - movw ip, #0xfefe /* magic constant; 254 in each byte */ - movt ip, #0xfefe /* magic constant; 254 in each byte */ -#elif defined(_ARM_ARCH_6) - mov ip, #0xfe /* put 254 in low byte */ - orr ip, ip, ip, lsl #8 /* move to next byte */ - orr ip, ip, ip, lsl #16 /* move to next halfword */ -#endif /* _ARM_ARCH_6 */ - orr r2, r2, r2, lsl #8 /* move to next byte */ - orr r2, r2, r2, lsl #16 /* move to next halfword */ -.Lmain_loop: - ldr r3, [r1], #4 /* load next word */ -#if defined(_ARM_ARCH_6) - /* - * Add 254 to each byte using the UQADD8 (unsigned saturating add 8) - * instruction. For every non-NUL byte, the result for that byte will - * become 255. For NUL, it will be 254. When we complement the - * result, if the result is non-0 then we must have encountered a NUL. - */ - uqadd8 r4, r3, ip /* NUL detection happens here */ - usub8 r3, r3, r2 /* bias for char looked for? */ - uqadd8 r5, r3, ip /* char detection happens here */ - ands r3, r4, r5 /* merge results */ - mvns r3, r3 /* is the complement non-0? */ - beq .Lmain_loop /* no, then keep going */ - - mvns r5, r5 /* get we find any matching bytes? */ - beq .Ldone /* no, then we hit the end, return */ - mvns r4, r4 /* did we encounter a NUL? */ - beq .Lfind_match /* no, find matching byte */ - /* - * Copy the NUL bit to the following byte lanes. Then clear any match - * bits in those byte lanes to prevent false positives in those bytes. - */ - bics r5, r5, r4 /* clear any NUL match bits */ - beq .Ldone /* no remaining matches, we're done */ - lshis r3, r4, #8 /* shift up a byte */ -#ifdef __thumb__ - itt ne -#endif - orrsne r3, r3, r3, lshi #8 /* if non 0, copy up to next byte */ - orrsne r3, r3, r3, lshi #8 /* if non 0, copy up to last byte */ - bics r5, r5, r3 /* clear match bits */ - beq .Ldone /* no remaining matches, we're done */ -.Lfind_match: -#ifdef __ARMEL__ - rev r5, r5 /* we want this in BE for the CLZ */ -#endif - /* - * If we have multiple matches, we want to the select the "last" match - * in the word which will be the lowest bit set. - */ - subs r3, r5, #1 /* subtract 1 */ - ands r3, r3, r5 /* and with mask */ - eors r5, r5, r3 /* only have the lowest bit set left */ - clz r5, r5 /* count how many leading zeros */ - add r0, r1, r5, lsr #3 /* divide that by 8 and add to count */ - subs r0, r0, #4 /* compensate for the post-inc */ - cmp r4, #0 /* did we read any NULs? */ - beq .Lmain_loop /* no, get next word */ -#else - /* - * No fancy shortcuts so just test each byte lane for a NUL. - * (other tests for NULs in a word take more instructions/cycles). - */ - eor r4, r3, r2 /* xor .. */ - tst r3, #BYTE0 /* is byte 0 a NUL? */ - beq .Ldone /* yes, then we're done */ - tst r4, #BYTE0 /* is byte 0 a match? */ - subeq r0, r1, #4 /* yes, remember its location */ - tst r3, #BYTE1 /* is byte 1 a NUL? */ - beq .Ldone /* yes, then we're done */ - tst r4, #BYTE1 /* is byte 1 a match? */ - subeq r0, r1, #3 /* yes, remember its location */ - tst r3, #BYTE2 /* is byte 2 a NUL? */ - beq .Ldone /* yes, then we're done */ - tst r4, #BYTE2 /* is byte 2 a match? */ - subeq r0, r1, #2 /* yes, remember its location */ - tst r3, #BYTE3 /* is byte 3 a NUL? */ - beq .Ldone /* yes, then we're done */ - tst r4, #BYTE3 /* is byte 3 a match? */ - subeq r0, r1, #1 /* yes, remember its location */ - b .Lmain_loop -#endif /* _ARM_ARCH_6 */ -.Ldone: - pop {r4, r5} - RET -END(strrchr) diff --git a/common/lib/libc/arch/arm/string/strrchr_naive.S b/common/lib/libc/arch/arm/string/strrchr_naive.S deleted file mode 100644 index 2af949865..000000000 --- a/common/lib/libc/arch/arm/string/strrchr_naive.S +++ /dev/null @@ -1,56 +0,0 @@ -/*- - * Copyright (c) 2013 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#include - -RCSID("$NetBSD: strrchr_naive.S,v 1.4 2013/08/19 17:02:25 matt Exp $") - -/* LINTSTUB: char * strrchr(const char *, int) */ -ENTRY(strrchr) - mov r2, r0 /* using r0 as return value */ - movs r0, #0 /* default to no match */ -#ifdef __thumb__ - movs r3, #0xff - ands r1, r1, r3 /* restrict to a byte value */ -1: ldrb r3, [r2] /* read a byte */ - cmp r3, r1 /* does it match? */ - bne 2f /* no, go and advance */ - mov r0, r2 /* yes, set return value to point to it */ -2: adds r2, r2, #1 /* advance to next byte */ - cmp r3, #0 /* was it a NUL? */ - bne 1b /* no, get next byte */ -#else - and r1, r1, #0xff /* restrict to a byte value */ -1: ldrb r3, [r2], #1 /* read a byte */ - cmp r3, r1 /* does it match? */ - subeq r0, r2, #1 /* yes, set return value to point to it */ - cmp r3, #0 /* was it a NUL? */ - bne 1b /* no, get next byte */ -#endif - RET -END(strrchr) diff --git a/common/lib/libc/arch/hppa/atomic/Makefile.inc b/common/lib/libc/arch/hppa/atomic/Makefile.inc deleted file mode 100644 index 5015fa6d4..000000000 --- a/common/lib/libc/arch/hppa/atomic/Makefile.inc +++ /dev/null @@ -1,40 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.13 2014/10/14 07:25:05 martin Exp $ - -.if defined(LIB) - -. if (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" || \ - ${LIB} == "rump") - -SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c \ - atomic_and_32_cas.c atomic_and_32_nv_cas.c \ - atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ - atomic_inc_32_cas.c atomic_inc_32_nv_cas.c \ - atomic_or_32_cas.c atomic_or_32_nv_cas.c \ - atomic_swap_32_cas.c \ - membar_ops_nop.c - -. endif - -. if (${LIB} == "c" || ${LIB} == "pthread") - -SRCS+= atomic_init_testset.c -SRCS+= atomic_cas_up.S -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_16_UP -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_8_UP -. endif - -.if defined(LIB) && ${LIB} == "c" -SRCS+= atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c \ - atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c \ - atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c \ - atomic_or_16_cas.c atomic_or_8_cas.c \ - atomic_and_16_cas.c atomic_and_8_cas.c \ - atomic_add_16_cas.c atomic_add_8_cas.c \ - atomic_swap_16_cas.c atomic_swap_8_cas.c \ - atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \ - atomic_c11_compare_exchange_cas_32.c \ - atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_8.c -.endif -.endif diff --git a/common/lib/libc/arch/hppa/atomic/atomic_cas_up.S b/common/lib/libc/arch/hppa/atomic/atomic_cas_up.S deleted file mode 100644 index 387234f98..000000000 --- a/common/lib/libc/arch/hppa/atomic/atomic_cas_up.S +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: atomic_cas_up.S,v 1.4 2014/01/29 11:34:25 skrll Exp $ */ - -/*- - * Copyright (c) 2008, 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Nick Hudson - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -LEAF_ENTRY_NOPROFILE(_atomic_cas_up) - .hidden _C_LABEL(_atomic_cas_up) - -RAS_START_ASM_HIDDEN(_atomic_cas) - ldw 0(%arg0), %ret0 - comb,<>,n %arg1, %ret0, 1f - stw %arg2, 0(%arg0) -RAS_END_ASM_HIDDEN(_atomic_cas) -1: - bv,n %r0(%rp) - -EXIT(_atomic_cas_up) - -LEAF_ENTRY_NOPROFILE(_atomic_cas_16_up) - .hidden _C_LABEL(_atomic_cas_16_up) - -RAS_START_ASM_HIDDEN(_atomic_cas_16) - ldh 0(%arg0),%ret0 - comb,<>,n %arg1, %ret0, 1f - sth %arg2, 0(%arg0) -RAS_END_ASM_HIDDEN(_atomic_cas_16) -1: - bv,n %r0(%rp) -EXIT(_atomic_cas_16_up) - -LEAF_ENTRY_NOPROFILE(_atomic_cas_8_up) - .hidden _C_LABEL(_atomic_cas_8_up) - -RAS_START_ASM_HIDDEN(_atomic_cas_8) - ldb 0(%arg0),%ret0 - comb,<>,n %arg1, %ret0, 1f - stb %arg2, 0(%arg0) -RAS_END_ASM_HIDDEN(_atomic_cas_8) -1: - bv,n %r0(%rp) -EXIT(_atomic_cas_8_up) diff --git a/common/lib/libc/arch/hppa/atomic/membar_ops.S b/common/lib/libc/arch/hppa/atomic/membar_ops.S deleted file mode 100644 index a732c642c..000000000 --- a/common/lib/libc/arch/hppa/atomic/membar_ops.S +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.1 2011/01/17 07:40:21 skrll Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe, and by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -RCSID("$NetBSD: membar_ops.S,v 1.1 2011/01/17 07:40:21 skrll Exp $") - - .text - -LEAF_ENTRY(_membar_consumer) - sync - nop - nop - nop - nop - nop - bv %r0(%rp) - nop -EXIT(_membar_consumer) - -LEAF_ENTRY(_membar_producer) - sync - nop - nop - nop - nop - nop - bv %r0(%rp) - nop -EXIT(_membar_producer) - -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) -ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer) -ATOMIC_OP_ALIAS(membar_enter,_membar_consumer) -STRONG_ALIAS(_membar_enter,_membar_consumer) -ATOMIC_OP_ALIAS(membar_exit,_membar_producer) -STRONG_ALIAS(_membar_exit,_membar_producer) -ATOMIC_OP_ALIAS(membar_sync,_membar_producer) -STRONG_ALIAS(_membar_sync,_membar_producer) diff --git a/common/lib/libc/arch/i386/atomic/Makefile.inc b/common/lib/libc/arch/i386/atomic/Makefile.inc deleted file mode 100644 index e52e06aa7..000000000 --- a/common/lib/libc/arch/i386/atomic/Makefile.inc +++ /dev/null @@ -1,19 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.8 2014/02/18 10:16:55 martin Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump" || (defined(__MINIX) && ${LIB} == "sys")) - -SRCS+= atomic_add_64_cas.c atomic_add_64_nv_cas.c atomic_and_64_cas.c \ - atomic_and_64_nv_cas.c atomic_dec_64_cas.c atomic_dec_64_nv_cas.c \ - atomic_inc_64_cas.c atomic_inc_64_nv_cas.c atomic_or_64_cas.c \ - atomic_or_64_nv_cas.c atomic_swap_64_cas.c atomic.S \ - atomic_nand_64_cas.c atomic_xor_64_cas.c atomic_sub_64_cas.c \ - atomic_cas_64_cas.c - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -SRCS+= atomic_init_cas.c - -.endif diff --git a/common/lib/libc/arch/i386/atomic/atomic.S b/common/lib/libc/arch/i386/atomic/atomic.S deleted file mode 100644 index f67e13749..000000000 --- a/common/lib/libc/arch/i386/atomic/atomic.S +++ /dev/null @@ -1,405 +0,0 @@ -/* $NetBSD: atomic.S,v 1.22 2014/05/23 03:17:31 uebayasi Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe, and by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include -/* - * __HAVE_ constants should not be in - * because we can't use them from assembly. OTOH we - * only need __HAVE_ATOMIC64_OPS here, and we don't. - */ -#ifdef _KERNEL -#define ALIAS(f, t) STRONG_ALIAS(f,t) -#else -#define ALIAS(f, t) WEAK_ALIAS(f,t) -#endif - -#ifdef _HARDKERNEL -#define LOCK(n) .Lpatch ## n: lock -#define ENDLABEL(a) _ALIGN_TEXT; LABEL(a) -#else -#define LOCK(n) lock -#define ENDLABEL(a) /* nothing */ -#endif - - .text - -ENTRY(_atomic_add_32) - movl 4(%esp), %edx - movl 8(%esp), %eax - LOCK(1) - addl %eax, (%edx) - ret -END(_atomic_add_32) - -ENTRY(_atomic_add_32_nv) - movl 4(%esp), %edx - movl 8(%esp), %eax - movl %eax, %ecx - LOCK(2) - xaddl %eax, (%edx) - addl %ecx, %eax - ret -END(_atomic_add_32_nv) - -ENTRY(_atomic_and_32) - movl 4(%esp), %edx - movl 8(%esp), %eax - LOCK(3) - andl %eax, (%edx) - ret -END(_atomic_and_32) - -ENTRY(_atomic_and_32_nv) - movl 4(%esp), %edx - movl (%edx), %eax -0: - movl %eax, %ecx - andl 8(%esp), %ecx - LOCK(4) - cmpxchgl %ecx, (%edx) - jnz 1f - movl %ecx, %eax - ret -1: - jmp 0b -END(_atomic_and_32_nv) - -ENTRY(_atomic_dec_32) - movl 4(%esp), %edx - LOCK(5) - decl (%edx) - ret -END(_atomic_dec_32) - -ENTRY(_atomic_dec_32_nv) - movl 4(%esp), %edx - movl $-1, %eax - LOCK(6) - xaddl %eax, (%edx) - decl %eax - ret -END(_atomic_dec_32_nv) - -ENTRY(_atomic_inc_32) - movl 4(%esp), %edx - LOCK(7) - incl (%edx) - ret -END(_atomic_inc_32) - -ENTRY(_atomic_inc_32_nv) - movl 4(%esp), %edx - movl $1, %eax - LOCK(8) - xaddl %eax, (%edx) - incl %eax - ret -END(_atomic_inc_32_nv) - -ENTRY(_atomic_or_32) - movl 4(%esp), %edx - movl 8(%esp), %eax - LOCK(9) - orl %eax, (%edx) - ret -END(_atomic_or_32) - -ENTRY(_atomic_or_32_nv) - movl 4(%esp), %edx - movl (%edx), %eax -0: - movl %eax, %ecx - orl 8(%esp), %ecx - LOCK(10) - cmpxchgl %ecx, (%edx) - jnz 1f - movl %ecx, %eax - ret -1: - jmp 0b -END(_atomic_or_32_nv) - -ENTRY(_atomic_swap_32) - movl 4(%esp), %edx - movl 8(%esp), %eax - xchgl %eax, (%edx) - ret -END(_atomic_swap_32) - -ENTRY(_atomic_cas_32) - movl 4(%esp), %edx - movl 8(%esp), %eax - movl 12(%esp), %ecx - LOCK(12) - cmpxchgl %ecx, (%edx) - /* %eax now contains the old value */ - ret -END(_atomic_cas_32) - -ENTRY(_atomic_cas_32_ni) - movl 4(%esp), %edx - movl 8(%esp), %eax - movl 12(%esp), %ecx - cmpxchgl %ecx, (%edx) - /* %eax now contains the old value */ - ret -END(_atomic_cas_32_ni) - -ENTRY(_membar_consumer) - LOCK(13) - addl $0, -4(%esp) - ret -END(_membar_consumer) -ENDLABEL(membar_consumer_end) - -ENTRY(_membar_producer) - /* A store is enough */ - movl $0, -4(%esp) - ret -END(_membar_producer) -ENDLABEL(membar_producer_end) - -ENTRY(_membar_sync) - LOCK(14) - addl $0, -4(%esp) - ret -END(_membar_sync) -ENDLABEL(membar_sync_end) - -#if defined(__HAVE_ATOMIC64_OPS) || defined(_KERNEL) -ENTRY(_atomic_cas_64) -#ifdef _HARDKERNEL - pushf - cli -#endif /* _HARDKERNEL */ - pushl %edi - pushl %ebx - movl 12(%esp), %edi - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 24(%esp), %ebx - movl 28(%esp), %ecx - cmpl 0(%edi), %eax - jne 2f - cmpl 4(%edi), %edx - jne 2f - movl %ebx, 0(%edi) - movl %ecx, 4(%edi) -1: - popl %ebx - popl %edi -#ifdef _HARDKERNEL - popf -#endif /* _HARDKERNEL */ - ret -2: - movl 0(%edi), %eax - movl 4(%edi), %edx - jmp 1b -END(_atomic_cas_64) -ENDLABEL(_atomic_cas_64_end) - -ENTRY(_atomic_cas_cx8) - pushl %edi - pushl %ebx - movl 12(%esp), %edi - movl 16(%esp), %eax - movl 20(%esp), %edx - movl 24(%esp), %ebx - movl 28(%esp), %ecx - LOCK(15) - cmpxchg8b (%edi) - popl %ebx - popl %edi - ret -#ifdef _HARDKERNEL -#ifdef GPROF - .space 16, 0x90 -#else - .space 32, 0x90 -#endif -#endif /* _HARDKERNEL */ -END(_atomic_cas_cx8) -ENDLABEL(_atomic_cas_cx8_end) -#endif /* __HAVE_ATOMIC64_OPS || _KERNEL */ - -#ifdef _HARDKERNEL -ENTRY(sse2_lfence) - lfence - ret -END(sse2_lfence) -ENDLABEL(sse2_lfence_end) - -ENTRY(sse2_mfence) - mfence - ret -END(sse2_mfence) -ENDLABEL(sse2_mfence_end) - -atomic_lockpatch: - .globl atomic_lockpatch - .long .Lpatch1, .Lpatch2, .Lpatch3, .Lpatch4, .Lpatch5 - .long .Lpatch6, .Lpatch7, .Lpatch8, .Lpatch9, .Lpatch10 - .long .Lpatch12, .Lpatch13, .Lpatch14, .Lpatch15, 0 -#endif /* _HARDKERNEL */ - -ALIAS(atomic_add_32,_atomic_add_32) -ALIAS(atomic_add_int,_atomic_add_32) -ALIAS(atomic_add_long,_atomic_add_32) -ALIAS(atomic_add_ptr,_atomic_add_32) - -ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -ALIAS(atomic_add_long_nv,_atomic_add_32_nv) -ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) - -ALIAS(atomic_and_32,_atomic_and_32) -ALIAS(atomic_and_uint,_atomic_and_32) -ALIAS(atomic_and_ulong,_atomic_and_32) -ALIAS(atomic_and_ptr,_atomic_and_32) - -ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) -ALIAS(atomic_and_ptr_nv,_atomic_and_32_nv) - -ALIAS(atomic_dec_32,_atomic_dec_32) -ALIAS(atomic_dec_uint,_atomic_dec_32) -ALIAS(atomic_dec_ulong,_atomic_dec_32) -ALIAS(atomic_dec_ptr,_atomic_dec_32) - -ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -ALIAS(atomic_dec_ulong_nv,_atomic_dec_32_nv) -ALIAS(atomic_dec_ptr_nv,_atomic_dec_32_nv) - -ALIAS(atomic_inc_32,_atomic_inc_32) -ALIAS(atomic_inc_uint,_atomic_inc_32) -ALIAS(atomic_inc_ulong,_atomic_inc_32) -ALIAS(atomic_inc_ptr,_atomic_inc_32) - -ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv) -ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv) - -ALIAS(atomic_or_32,_atomic_or_32) -ALIAS(atomic_or_uint,_atomic_or_32) -ALIAS(atomic_or_ulong,_atomic_or_32) -ALIAS(atomic_or_ptr,_atomic_or_32) - -ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) -ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv) - -ALIAS(atomic_swap_32,_atomic_swap_32) -ALIAS(atomic_swap_uint,_atomic_swap_32) -ALIAS(atomic_swap_ulong,_atomic_swap_32) -ALIAS(atomic_swap_ptr,_atomic_swap_32) - -ALIAS(atomic_cas_32,_atomic_cas_32) -ALIAS(atomic_cas_uint,_atomic_cas_32) -ALIAS(atomic_cas_ulong,_atomic_cas_32) -ALIAS(atomic_cas_ptr,_atomic_cas_32) - -ALIAS(atomic_cas_32_ni,_atomic_cas_32_ni) -ALIAS(atomic_cas_uint_ni,_atomic_cas_32_ni) -ALIAS(atomic_cas_ulong_ni,_atomic_cas_32_ni) -ALIAS(atomic_cas_ptr_ni,_atomic_cas_32_ni) - -#if defined(__HAVE_ATOMIC64_OPS) || defined(_KERNEL) -ALIAS(atomic_cas_64,_atomic_cas_64) -ALIAS(atomic_cas_64_ni,_atomic_cas_64) -ALIAS(__sync_val_compare_and_swap_8,_atomic_cas_64) -#endif /* __HAVE_ATOMIC64_OPS || _KERNEL */ - -ALIAS(membar_consumer,_membar_consumer) -ALIAS(membar_producer,_membar_producer) -ALIAS(membar_enter,_membar_consumer) -ALIAS(membar_exit,_membar_producer) -ALIAS(membar_sync,_membar_sync) - -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_long,_atomic_add_32) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32) - -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) - -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ptr,_atomic_and_32) - -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_32_nv) - -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_32) - -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_32_nv) - -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32) - -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv) - -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ptr,_atomic_or_32) - -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv) - -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) - -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) - -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32_ni) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32_ni) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32_ni) - -STRONG_ALIAS(_membar_enter,_membar_consumer) -STRONG_ALIAS(_membar_exit,_membar_producer) diff --git a/common/lib/libc/arch/i386/gen/byte_swap_2.S b/common/lib/libc/arch/i386/gen/byte_swap_2.S deleted file mode 100644 index 00eb54e12..000000000 --- a/common/lib/libc/arch/i386/gen/byte_swap_2.S +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.4 2014/05/23 03:17:31 uebayasi Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)htons.s 5.2 (Berkeley) 12/17/90 - */ - -#include -#if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_2.S,v 1.4 2014/05/23 03:17:31 uebayasi Exp $") -#endif - -#if defined(_KERNEL) || defined(_STANDALONE) -_ENTRY(_C_LABEL(bswap16)) -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -_ENTRY(_C_LABEL(__bswap16)) -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ -_ENTRY(_C_LABEL(ntohs)) -_ENTRY(_C_LABEL(htons)) -_PROF_PROLOGUE - movzwl 4(%esp),%eax - xchgb %al, %ah - ret -#if defined(_KERNEL) || defined(_STANDALONE) -END(_C_LABEL(bswap16)) -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -END(_C_LABEL(__bswap16)) -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ -END(_C_LABEL(ntohs)) -END(_C_LABEL(htons)) diff --git a/common/lib/libc/arch/i386/gen/byte_swap_4.S b/common/lib/libc/arch/i386/gen/byte_swap_4.S deleted file mode 100644 index c1dfed3ef..000000000 --- a/common/lib/libc/arch/i386/gen/byte_swap_4.S +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.4 2014/05/23 03:17:31 uebayasi Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * William Jolitz. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: @(#)htonl.s 5.3 (Berkeley) 12/17/90 - */ - -#include -#if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_4.S,v 1.4 2014/05/23 03:17:31 uebayasi Exp $") -#endif - -#if defined(_KERNEL) || defined(_STANDALONE) -_ENTRY(_C_LABEL(bswap32)) -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -_ENTRY(_C_LABEL(__bswap32)) -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ -_ENTRY(_C_LABEL(ntohl)) -_ENTRY(_C_LABEL(htonl)) -_PROF_PROLOGUE - movl 4(%esp),%eax - bswap %eax - ret -#if defined(_KERNEL) || defined(_STANDALONE) -END(_C_LABEL(bswap32)) -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -END(_C_LABEL(__bswap32)) -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ -END(_C_LABEL(ntohl)) -END(_C_LABEL(htonl)) diff --git a/common/lib/libc/arch/i386/string/ffs.S b/common/lib/libc/arch/i386/string/ffs.S deleted file mode 100644 index 603df4ffe..000000000 --- a/common/lib/libc/arch/i386/string/ffs.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: ffs.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -ENTRY(ffs) - bsfl 4(%esp),%eax - jz L1 /* ZF is set if all bits are 0 */ - incl %eax /* bits numbered from 1, not 0 */ - ret - - _ALIGN_TEXT -L1: xorl %eax,%eax /* clear result */ - ret -END(ffs) diff --git a/common/lib/libc/arch/i386/string/memchr.S b/common/lib/libc/arch/i386/string/memchr.S deleted file mode 100644 index cf7eec249..000000000 --- a/common/lib/libc/arch/i386/string/memchr.S +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memchr.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -ENTRY(memchr) - pushl %esi - movl 8(%esp),%eax - movzbl 12(%esp),%ecx - movl 16(%esp),%esi - - /* - * Align to word boundary. - * Consider unrolling loop? - */ - testl %esi,%esi /* nbytes == 0? */ - je .Lzero -.Lalign: - testb $3,%al - je .Lword_aligned - cmpb (%eax),%cl - je .Ldone - incl %eax - decl %esi - jnz .Lalign - jmp .Lzero - -.Lword_aligned: - /* copy char to all bytes in word */ - movb %cl,%ch - movl %ecx,%edx - sall $16,%ecx - orl %edx,%ecx - - _ALIGN_TEXT -.Lloop: - cmpl $3,%esi /* nbytes > 4 */ - jbe .Lbyte - movl (%eax),%edx - addl $4,%eax - xorl %ecx,%edx - subl $4,%esi - subl $0x01010101,%edx - testl $0x80808080,%edx - je .Lloop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word are - * equal to ch. - */ - - /* - * High load-use latency on the Athlon leads to significant - * stalls, so we preload the next char as soon as possible - * instead of using cmp mem8, reg8. - * - * Alignment here avoids a stall on the Athlon, even though - * it's not a branch target. - */ - _ALIGN_TEXT - cmpb -4(%eax),%cl /* 1st byte == ch? */ - movb -3(%eax),%dl - jne 1f - subl $4,%eax - jmp .Ldone - - _ALIGN_TEXT -1: cmpb %dl,%cl /* 2nd byte == ch? */ - movb -2(%eax),%dl - jne 1f - subl $3,%eax - jmp .Ldone - - _ALIGN_TEXT -1: cmpb %dl,%cl /* 3rd byte == ch? */ - movb -1(%eax),%dl - jne 1f - subl $2,%eax - jmp .Ldone - - _ALIGN_TEXT -1: cmpb %dl,%cl /* 4th byte == ch? */ - jne .Lloop - decl %eax - jmp .Ldone - -.Lbyte: - testl %esi,%esi - je .Lzero -.Lbyte_loop: - cmpb (%eax),%cl - je .Ldone - incl %eax - decl %esi - jnz .Lbyte_loop - -.Lzero: - xorl %eax,%eax - -.Ldone: - popl %esi - ret -END(memchr) diff --git a/common/lib/libc/arch/i386/string/memcmp.S b/common/lib/libc/arch/i386/string/memcmp.S deleted file mode 100644 index 3de3a5922..000000000 --- a/common/lib/libc/arch/i386/string/memcmp.S +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memcmp.S,v 1.3 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -ENTRY(memcmp) - pushl %edi - pushl %esi - movl 12(%esp),%edi - movl 16(%esp),%esi - - movl 20(%esp),%ecx /* compare by words */ - shrl $2,%ecx - repe - cmpsl - jne L5 /* do we match so far? */ - - movl 20(%esp),%ecx /* compare remainder by bytes */ - andl $3,%ecx - repe - cmpsb - jne L6 /* do we match? */ - - xorl %eax,%eax /* we match, return zero */ - popl %esi - popl %edi - ret - -L5: movl $4,%ecx /* We know that one of the next */ - subl %ecx,%edi /* four pairs of bytes do not */ - subl %ecx,%esi /* match. */ - repe - cmpsb -L6: xorl %eax,%eax /* Perform unsigned comparison */ - movb -1(%edi),%al - xorl %edx,%edx - movb -1(%esi),%dl - subl %edx,%eax - popl %esi - popl %edi - ret -END(memcmp) diff --git a/common/lib/libc/arch/i386/string/memcpy.S b/common/lib/libc/arch/i386/string/memcpy.S deleted file mode 100644 index e3e1404b0..000000000 --- a/common/lib/libc/arch/i386/string/memcpy.S +++ /dev/null @@ -1,143 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.4 2014/03/22 19:38:46 jakllsch Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from locore.s. - * Optimised by David Laight 2003 - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memcpy.S,v 1.4 2014/03/22 19:38:46 jakllsch Exp $") -#endif - - /* - * (ov)bcopy (src,dst,cnt) - * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 - */ - -#ifdef BCOPY -ENTRY(bcopy) -#else -#ifdef MEMMOVE -ENTRY(memmove) -#else -#define MEMCPY -#define NO_OVERLAP -ENTRY(memcpy) -#endif -#endif - push %esi - mov %edi,%edx -#if defined(MEMCPY) || defined(MEMMOVE) - movl 8(%esp),%edi - movl 12(%esp),%esi -#else - movl 8(%esp),%esi - movl 12(%esp),%edi -#endif - movl 16(%esp),%ecx -#if defined(NO_OVERLAP) - movl %ecx,%eax -#else - movl %edi,%eax - subl %esi,%eax - cmpl %ecx,%eax /* overlapping? */ - movl %ecx,%eax - jb .Lbackwards -#endif - /* nope, copy forwards. */ - shrl $2,%ecx /* copy by words */ - rep - movsl - and $3,%eax /* any bytes left? */ - jnz .Ltrailing -.Ldone: -#if defined(MEMCPY) || defined(MEMMOVE) - movl 8(%esp),%eax -#endif - mov %edx,%edi - pop %esi - ret - -.Ltrailing: - cmp $2,%eax - jb 1f - movw (%esi),%ax - movw %ax,(%edi) - je .Ldone - movb 2(%esi),%al - movb %al,2(%edi) - jmp .Ldone -1: movb (%esi),%al - movb %al,(%edi) - jmp .Ldone - -#if !defined(NO_OVERLAP) -.Lbackwards: - addl %ecx,%edi /* copy backwards. */ - addl %ecx,%esi - and $3,%eax /* any fractional bytes? */ - jnz .Lback_align -.Lback_aligned: - shrl $2,%ecx - subl $4,%esi - subl $4,%edi - std - rep - movsl - cld - jmp .Ldone - -.Lback_align: - sub %eax,%esi - sub %eax,%edi - cmp $2,%eax - jb 1f - je 2f - movb 2(%esi),%al - movb %al,2(%edi) -2: movw (%esi),%ax - movw %ax,(%edi) - jmp .Lback_aligned -1: movb (%esi),%al - movb %al,(%edi) - jmp .Lback_aligned -#endif - -#ifdef BCOPY -END(bcopy) -#else -#ifdef MEMMOVE -END(memmove) -#else -END(memcpy) -#endif -#endif diff --git a/common/lib/libc/arch/i386/string/memmove.S b/common/lib/libc/arch/i386/string/memmove.S deleted file mode 100644 index 2b8ea6dd2..000000000 --- a/common/lib/libc/arch/i386/string/memmove.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ - -#define MEMMOVE -#include "memcpy.S" diff --git a/common/lib/libc/arch/i386/string/memset.S b/common/lib/libc/arch/i386/string/memset.S deleted file mode 100644 index b2e7c51e6..000000000 --- a/common/lib/libc/arch/i386/string/memset.S +++ /dev/null @@ -1,111 +0,0 @@ -/* $NetBSD: memset.S,v 1.5 2014/05/23 03:17:31 uebayasi Exp $ */ - -/*- - * Copyright (c) 2003 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by David Laight. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memset.S,v 1.5 2014/05/23 03:17:31 uebayasi Exp $") -#endif - -#ifdef BZERO -ENTRY(bzero) -#else -ENTRY(memset) -#endif -#ifdef BZERO - movl 8(%esp),%ecx - xor %eax,%eax -#else - movl 12(%esp),%ecx - movzbl 8(%esp),%eax /* unsigned char, zero extend */ -#endif - cmpl $0x0f,%ecx /* avoid mispredicted branch... */ - - pushl %edi - movl 8(%esp),%edi - - /* - * if the string is too short, it's really not worth the overhead - * of aligning to word boundries, etc. So we jump to a plain - * unaligned set. - * - * NB aligning the transfer is actually pointless on my athlon 700, - * It does make a difference to a PII though. - * - * The PII, PIII and PIV all seem to have a massive performance - * drop when the initial target address is an odd multiple of 4. - */ - jbe .Lby_bytes - -#ifndef BZERO - movb %al,%ah /* copy char to all bytes in word */ - movl %eax,%edx - sall $16,%eax - orl %edx,%eax -#endif - - movl %edi,%edx /* detect misalignment */ - neg %edx - andl $7,%edx - jnz .Lalign -.Laligned: - movl %eax,-4(%edi,%ecx) /* zap last 4 bytes */ - shrl $2,%ecx /* zero by words */ - rep - stosl -.Ldone: -#ifndef BZERO - movl 8(%esp),%eax /* return address of buffer */ -#endif - pop %edi - ret - -.Lalign: - movl %eax,(%edi) /* zap first 8 bytes */ - movl %eax,4(%edi) - subl %edx,%ecx /* remove from main count */ - add %edx,%edi - jmp .Laligned - -.Lby_bytes: - rep - stosb - -#ifndef BZERO - movl 8(%esp),%eax /* return address of buffer */ -#endif - popl %edi - ret -#ifdef BZERO -END(bzero) -#else -END(memset) -#endif diff --git a/common/lib/libc/arch/i386/string/small/memcmp.S b/common/lib/libc/arch/i386/string/small/memcmp.S deleted file mode 100644 index 6f10ca43a..000000000 --- a/common/lib/libc/arch/i386/string/small/memcmp.S +++ /dev/null @@ -1,51 +0,0 @@ -/* $NetBSD: memcmp.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $ */ -/*- - * Copyright (c) 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - RCSID("$NetBSD: memcmp.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") - -ENTRY(memcmp) - pushl %esi - pushl %edi - movl 12(%esp), %edi - movl 16(%esp), %esi - movl 20(%esp), %ecx - xorl %eax, %eax - rep - cmpsb - popl %edi - popl %esi - ja 1f - setnz %al - ret -1: - decl %eax - ret -END(memcmp) diff --git a/common/lib/libc/arch/i386/string/small/memcpy.S b/common/lib/libc/arch/i386/string/small/memcpy.S deleted file mode 100644 index 97066d2d7..000000000 --- a/common/lib/libc/arch/i386/string/small/memcpy.S +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.2 2014/05/23 03:17:31 uebayasi Exp $ */ -/*- - * Copyright (c) 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - RCSID("$NetBSD: memcpy.S,v 1.2 2014/05/23 03:17:31 uebayasi Exp $") - -# ifdef BCOPY -ENTRY(bcopy) - pushl %esi - pushl %edi - movl 12(%esp), %esi - movl 16(%esp), %edi - jmp __memmove_start -# endif -# if defined(MEMMOVE) -ENTRY(memcpy) -ENTRY(memmove) - pushl %esi - pushl %edi - movl 12(%esp), %edi - movl 16(%esp), %esi - .globl __memmove_start -__memmove_start: - movl 20(%esp), %ecx - pushl %edi - testl %ecx, %ecx - jz 2f - cmpl %esi, %edi - jb 1f - addl %ecx, %esi - decl %esi - addl %ecx, %edi - decl %edi - std -1: - rep - movsb -2: - cld - popl %eax - popl %edi - popl %esi - ret -END(memcpy) -END(memmove) -# endif /* MEMMOVE */ -# ifdef BCOPY -END(bcopy) -# endif diff --git a/common/lib/libc/arch/i386/string/small/memmove.S b/common/lib/libc/arch/i386/string/small/memmove.S deleted file mode 100644 index d19f25767..000000000 --- a/common/lib/libc/arch/i386/string/small/memmove.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2011/06/16 16:39:14 joerg Exp $ */ - -#define MEMMOVE -#include "memcpy.S" diff --git a/common/lib/libc/arch/i386/string/small/memset.S b/common/lib/libc/arch/i386/string/small/memset.S deleted file mode 100644 index d78937b2a..000000000 --- a/common/lib/libc/arch/i386/string/small/memset.S +++ /dev/null @@ -1,46 +0,0 @@ -/* $NetBSD: memset.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $ */ - -/*- - * Copyright (c) 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - RCSID("$NetBSD: memset.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") - -ENTRY(memset) - pushl %edi - movl 8(%esp), %edi - movl 12(%esp), %eax - movl 16(%esp), %ecx - pushl %edi - rep - stosb - popl %eax - popl %edi - ret -END(memset) diff --git a/common/lib/libc/arch/i386/string/small/strchr.S b/common/lib/libc/arch/i386/string/small/strchr.S deleted file mode 100644 index 5aebe4691..000000000 --- a/common/lib/libc/arch/i386/string/small/strchr.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: strchr.S,v 1.3 2014/09/22 20:31:56 khorben Exp $ */ -/*- - * Copyright (c) 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - RCSID("$NetBSD: strchr.S,v 1.3 2014/09/22 20:31:56 khorben Exp $") - -ENTRY(strchr) - popl %edx /* Return address */ - popl %eax /* String pointer */ - popl %ecx /* Character to find */ - pushl %ecx - pushl %eax - pushl %edx -1: - cmpb %cl, 0(%eax) - je 3f - cmpb $0, 0(%eax) - je 2f - incl %eax - jmp 1b -2: - xorl %eax, %eax -3: - ret -END(strchr) diff --git a/common/lib/libc/arch/i386/string/small/strcmp.S b/common/lib/libc/arch/i386/string/small/strcmp.S deleted file mode 100644 index c189a1807..000000000 --- a/common/lib/libc/arch/i386/string/small/strcmp.S +++ /dev/null @@ -1,51 +0,0 @@ -/* $NetBSD: strcmp.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $ */ -/*- - * Copyright (c) 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - RCSID("$NetBSD: strcmp.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") - -ENTRY(strcmp) - pushl %esi - movl 12(%esp), %ecx - movl 8(%esp), %esi - decl %ecx -1: - incl %ecx - lodsb - cmpb 0(%ecx), %al - jne 2f - testb %al, %al - jne 1b -2: - subb 0(%ecx), %al - movsbl %al, %eax - popl %esi - ret -END(strcmp) diff --git a/common/lib/libc/arch/i386/string/small/strcpy.S b/common/lib/libc/arch/i386/string/small/strcpy.S deleted file mode 100644 index 962cd6a81..000000000 --- a/common/lib/libc/arch/i386/string/small/strcpy.S +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: strcpy.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $ */ -/*- - * Copyright (c) 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - RCSID("$NetBSD: strcpy.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") - -ENTRY(strcpy) - pushl %esi - pushl %edi - movl 12(%esp), %edi - movl 16(%esp), %esi - pushl %edi -1: - lodsb - stosb - testb %al, %al - jne 1b - popl %eax - popl %edi - popl %esi - ret -END(strcpy) diff --git a/common/lib/libc/arch/i386/string/small/strlen.S b/common/lib/libc/arch/i386/string/small/strlen.S deleted file mode 100644 index 1dbcc4682..000000000 --- a/common/lib/libc/arch/i386/string/small/strlen.S +++ /dev/null @@ -1,42 +0,0 @@ -/* $NetBSD: strlen.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $ */ -/*- - * Copyright (c) 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by David Laight. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - RCSID("$NetBSD: strlen.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") -ENTRY(strlen) - movl 8(%esp), %ecx - xorl %eax, %eax - dec %eax -1: - incl %eax - cmpb $0, 0(%ecx,%eax,1) - jnz 1b - ret -END(strlen) diff --git a/common/lib/libc/arch/i386/string/strcat.S b/common/lib/libc/arch/i386/string/strcat.S deleted file mode 100644 index ef6799789..000000000 --- a/common/lib/libc/arch/i386/string/strcat.S +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcat.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -ENTRY(strcat) - pushl %ebx - movl 8(%esp),%ecx - movl 12(%esp),%eax - - /* - * Align destination to word boundary. - * Consider unrolling loop? - */ -.Lscan: -.Lscan_align: - testb $3,%cl - je .Lscan_aligned - cmpb $0,(%ecx) - je .Lcopy - incl %ecx - jmp .Lscan_align - - _ALIGN_TEXT -.Lscan_aligned: -.Lscan_loop: - movl (%ecx),%ebx - addl $4,%ecx - leal -0x01010101(%ebx),%edx - testl $0x80808080,%edx - je .Lscan_loop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word equal 0. - */ - - /* - * The optimal code for determining whether each byte is zero - * differs by processor. This space-optimized code should be - * acceptable on all, especially since we don't expect it to - * be run frequently, - */ - - testb %bl,%bl /* 1st byte == 0? */ - jne 1f - subl $4,%ecx - jmp .Lcopy - -1: testb %bh,%bh /* 2nd byte == 0? */ - jne 1f - subl $3,%ecx - jmp .Lcopy - -1: shrl $16,%ebx - testb %bl,%bl /* 3rd byte == 0? */ - jne 1f - subl $2,%ecx - jmp .Lcopy - -1: testb %bh,%bh /* 4th byte == 0? */ - jne .Lscan_loop - subl $1,%ecx - - /* - * Align source to a word boundary. - * Consider unrolling loop? - */ -.Lcopy: -.Lcopy_align: - testl $3,%eax - je .Lcopy_aligned - movb (%eax),%bl - incl %eax - movb %bl,(%ecx) - incl %ecx - testb %bl,%bl - jne .Lcopy_align - jmp .Ldone - - _ALIGN_TEXT -.Lcopy_loop: - movl %ebx,(%ecx) - addl $4,%ecx -.Lcopy_aligned: - movl (%eax),%ebx - addl $4,%eax - leal -0x01010101(%ebx),%edx - testl $0x80808080,%edx - je .Lcopy_loop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word equal 0. - */ - - movb %bl,(%ecx) - incl %ecx - testb %bl,%bl - je .Ldone - - movb %bh,(%ecx) - incl %ecx - testb %bh,%bh - je .Ldone - - shrl $16,%ebx - movb %bl,(%ecx) - incl %ecx - testb %bl,%bl - je .Ldone - - movb %bh,(%ecx) - incl %ecx - testb %bh,%bh - jne .Lcopy_aligned - -.Ldone: - movl 8(%esp),%eax - popl %ebx - ret -END(strcat) diff --git a/common/lib/libc/arch/i386/string/strchr.S b/common/lib/libc/arch/i386/string/strchr.S deleted file mode 100644 index 591b4b457..000000000 --- a/common/lib/libc/arch/i386/string/strchr.S +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strchr.S,v 1.3 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -ENTRY(strchr) - pushl %esi - pushl %ebx - movl 12(%esp),%eax - movzbl 16(%esp),%ecx - - /* - * Align to word boundary. - * Consider unrolling loop? - */ -.Lalign: - testb $3,%al - je .Lword_aligned - movb (%eax),%bl - cmpb %cl,%bl - je .Ldone - testb %bl,%bl - je .Lzero - incl %eax - jmp .Lalign - -.Lword_aligned: - /* copy char to all bytes in word */ - movb %cl,%ch - movl %ecx,%edx - sall $16,%ecx - orl %edx,%ecx - - /* Check whether any byte in the word is equal to ch or 0. */ - _ALIGN_TEXT -.Lloop: - movl (%eax),%ebx - addl $4,%eax - movl %ebx,%esi - leal -0x01010101(%ebx),%edx - xorl %ecx,%esi - subl $0x01010101,%esi - orl %esi,%edx - testl $0x80808080,%edx - je .Lloop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word match - * ch or are equal to 0. - */ - - /* - * Alignment here avoids a stall on the Athlon, even though - * it's not a branch target. - */ - - _ALIGN_TEXT - cmpb %cl,%bl /* 1st byte == ch? */ - jne 1f - subl $4,%eax - jmp .Ldone -1: testb %bl,%bl /* 1st byte == 0? */ - je .Lzero - - cmpb %cl,%bh /* 2nd byte == ch? */ - jne 1f - subl $3,%eax - jmp .Ldone -1: testb %bh,%bh /* 2nd byte == 0? */ - je .Lzero - - shrl $16,%ebx - cmpb %cl,%bl /* 3rd byte == ch? */ - jne 1f - subl $2,%eax - jmp .Ldone -1: testb %bl,%bl /* 3rd byte == 0? */ - je .Lzero - - cmpb %cl,%bh /* 4th byte == ch? */ - jne 1f - decl %eax - jmp .Ldone -1: testb %bh,%bh /* 4th byte == 0? */ - jne .Lloop - -.Lzero: - /* If a ch wasn't found, return 0. */ - xorl %eax,%eax - -.Ldone: - popl %ebx - popl %esi - ret -END(strchr) - -STRONG_ALIAS(index,strchr) diff --git a/common/lib/libc/arch/i386/string/strcmp.S b/common/lib/libc/arch/i386/string/strcmp.S deleted file mode 100644 index b4a6fb795..000000000 --- a/common/lib/libc/arch/i386/string/strcmp.S +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcmp.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -ENTRY(strcmp) - pushl %esi - pushl %ebx - movl 12(%esp),%ebx - movl 16(%esp),%esi - - /* - * Align s1 to word boundary. - * Consider unrolling loop? - */ -.Ls1align: - testb $3,%bl - je .Ls1aligned - movb (%ebx),%al - incl %ebx - movb (%esi),%dl - incl %esi - testb %al,%al - je .Ldone - cmpb %al,%dl - je .Ls1align - jmp .Ldone - - /* - * Check whether s2 is aligned to a word boundary. If it is, we - * can compare by words. Otherwise we have to compare by bytes. - */ -.Ls1aligned: - testl $3,%esi - jne .Lbyte_loop - - subl $4,%ebx - subl $4,%esi - - _ALIGN_TEXT -.Lword_loop: - movl 4(%ebx),%eax - addl $4,%ebx - movl 4(%esi),%edx - addl $4,%esi - cmpl %eax,%edx - jne .Lbyte_loop - subl $0x01010101,%edx - notl %eax - andl %eax,%edx - testl $0x80808080,%edx - je .Lword_loop - - _ALIGN_TEXT -.Lbyte_loop: - movb (%ebx),%al - incl %ebx - movb (%esi),%dl - incl %esi - testb %al,%al - je .Ldone - cmpb %al,%dl - je .Lbyte_loop - -.Ldone: - movzbl %al,%eax - movzbl %dl,%edx - subl %edx,%eax - popl %ebx - popl %esi - ret -END(strcmp) diff --git a/common/lib/libc/arch/i386/string/strcpy.S b/common/lib/libc/arch/i386/string/strcpy.S deleted file mode 100644 index 82aef2837..000000000 --- a/common/lib/libc/arch/i386/string/strcpy.S +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcpy.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -/* - * This strcpy implementation copies a byte at a time until the - * source pointer is aligned to a word boundary, it then copies by - * words until it finds a word containing a zero byte, and finally - * copies by bytes until the end of the string is reached. - * - * While this may result in unaligned stores if the source and - * destination pointers are unaligned with respect to each other, - * it is still faster than either byte copies or the overhead of - * an implementation suitable for machines with strict alignment - * requirements. - */ - -ENTRY(strcpy) - pushl %ebx - movl 8(%esp),%ecx - movl 12(%esp),%eax - - /* - * Align source to a word boundary. - * Consider unrolling loop? - */ - _ALIGN_TEXT -.Lalign: - testl $3,%eax - je .Lword_aligned - movb (%eax),%bl - incl %eax - movb %bl,(%ecx) - incl %ecx - testb %bl,%bl - jne .Lalign - jmp .Ldone - - _ALIGN_TEXT -.Lloop: - movl %ebx,(%ecx) - addl $4,%ecx -.Lword_aligned: - movl (%eax),%ebx - addl $4,%eax - leal -0x01010101(%ebx),%edx - testl $0x80808080,%edx - je .Lloop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word equal 0. - */ - - movb %bl,(%ecx) - incl %ecx - testb %bl,%bl - je .Ldone - - movb %bh,(%ecx) - incl %ecx - testb %bh,%bh - je .Ldone - - shrl $16,%ebx - movb %bl,(%ecx) - incl %ecx - testb %bl,%bl - je .Ldone - - movb %bh,(%ecx) - incl %ecx - testb %bh,%bh - jne .Lword_aligned - -.Ldone: - movl 8(%esp),%eax - popl %ebx - ret -END(strcpy) diff --git a/common/lib/libc/arch/i386/string/strlen.S b/common/lib/libc/arch/i386/string/strlen.S deleted file mode 100644 index a41c2a0de..000000000 --- a/common/lib/libc/arch/i386/string/strlen.S +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strlen.S,v 1.2 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -ENTRY(strlen) - movl 4(%esp),%eax - -.Lalign: - /* Consider unrolling loop? */ - testb $3,%al - je .Lword_aligned - cmpb $0,(%eax) - je .Ldone - incl %eax - jmp .Lalign - - /* - * There are many well known branch-free sequences which are used - * for determining whether a zero-byte is contained within a word. - * These sequences are generally much more efficent than loading - * and comparing each byte individually. - * - * The expression [1,2]: - * - * (1) ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | (x | 0x7f7f7f7f)) - * - * evaluates to a non-zero value if any of the bytes in the - * original word is zero. - * - * It also has the useful property that bytes in the result word - * that correspond to non-zero bytes in the original word have - * the value 0x00, while bytes corresponding to zero bytes have - * the value 0x80. This allows calculation of the first (and - * last) occurrence of a zero byte within the word (useful for C's - * str* primitives) by counting the number of leading (or - * trailing) zeros and dividing the result by 8. On machines - * without (or with slow) clz() / ctz() instructions, testing - * each byte in the result word for zero is necessary. - * - * This typically takes 4 instructions (5 on machines without - * "not-or") not including those needed to load the constant. - * - * - * The expression: - * - * (2) ((x - 0x01010101) & ~x & 0x80808080) - * - * evaluates to a non-zero value if any of the bytes in the - * original word is zero. - * - * On little endian machines, the first byte in the result word - * that corresponds to a zero byte in the original byte is 0x80, - * so clz() can be used as above. On big endian machines, and - * little endian machines without (or with a slow) clz() insn, - * testing each byte in the original for zero is necessary. - * - * This typically takes 3 instructions (4 on machines without - * "and with complement") not including those needed to load - * constants. - * - * - * The expression: - * - * (3) ((x - 0x01010101) & 0x80808080) - * - * always evaluates to a non-zero value if any of the bytes in - * the original word is zero. However, in rare cases, it also - * evaluates to a non-zero value when none of the bytes in the - * original word is zero. - * - * To account for possible false positives, each byte of the - * original word must be checked when the expression evaluates to - * a non-zero value. However, because it is simpler than those - * presented above, code that uses it will be faster as long as - * the rate of false positives is low. - * - * This is likely, because the the false positive can only occur - * if the most siginificant bit of a byte within the word is set. - * The expression will never fail for typical 7-bit ASCII strings. - * - * This typically takes 2 instructions not including those needed - * to load constants. - * - * - * [1] Henry S. Warren Jr., "Hacker's Delight", Addison-Westley 2003 - * - * [2] International Business Machines, "The PowerPC Compiler Writer's - * Guide", Warthman Associates, 1996 - */ - - _ALIGN_TEXT -.Lword_aligned: -.Lloop: - movl (%eax),%ecx - addl $4,%eax - leal -0x01010101(%ecx),%edx - testl $0x80808080,%edx - je .Lloop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word equal 0. - */ - - /* - * The optimal code for determining whether each byte is zero - * differs by processor. This space-optimized code should be - * acceptable on all, especially since we don't expect it to - * be run frequently, - */ - - testb %cl,%cl /* 1st byte == 0? */ - jne 1f - subl $4,%eax - jmp .Ldone - -1: testb %ch,%ch /* 2nd byte == 0? */ - jne 1f - subl $3,%eax - jmp .Ldone - -1: shrl $16,%ecx - testb %cl,%cl /* 3rd byte == 0? */ - jne 1f - subl $2,%eax - jmp .Ldone - -1: testb %ch,%ch /* 4th byte == 0? */ - jne .Lloop - decl %eax - -.Ldone: - subl 4(%esp),%eax - ret -END(strlen) diff --git a/common/lib/libc/arch/i386/string/strrchr.S b/common/lib/libc/arch/i386/string/strrchr.S deleted file mode 100644 index 50593e45a..000000000 --- a/common/lib/libc/arch/i386/string/strrchr.S +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strrchr.S,v 1.3 2014/03/22 19:38:46 jakllsch Exp $") -#endif - -ENTRY(strrchr) - pushl %esi - pushl %edi - pushl %ebx - movl 16(%esp),%edx - movzbl 20(%esp),%ecx - - /* zero return value */ - xorl %eax,%eax - - /* - * Align to word boundary. - * Consider unrolling loop? - */ -.Lalign: - testb $3,%dl - je .Lword_aligned - movb (%edx),%bl - cmpb %cl,%bl - jne 1f - movl %edx,%eax -1: testb %bl,%bl - je .Ldone - incl %edx - jmp .Lalign - -.Lword_aligned: - /* copy char to all bytes in word */ - movb %cl,%ch - movl %ecx,%edi - sall $16,%ecx - orl %edi,%ecx - - /* Check whether any byte in the word is equal to ch or 0. */ - _ALIGN_TEXT -.Lloop: - movl (%edx),%ebx - addl $4,%edx - movl %ebx,%esi - leal -0x01010101(%ebx),%edi - xorl %ecx,%esi - subl $0x01010101,%esi - orl %esi,%edi - testl $0x80808080,%edi - je .Lloop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word match - * ch or are equal to 0. - */ - - _ALIGN_TEXT - cmpb %cl,%bl /* 1st byte == ch? */ - jne 1f - leal -4(%edx),%eax -1: testb %bl,%bl /* 1st byte == 0? */ - je .Ldone - - cmpb %cl,%bh /* 2nd byte == ch? */ - jne 1f - leal -3(%edx),%eax -1: testb %bh,%bh /* 2nd byte == 0? */ - je .Ldone - - shrl $16,%ebx - cmpb %cl,%bl /* 3rd byte == ch? */ - jne 1f - leal -2(%edx),%eax -1: testb %bl,%bl /* 3rd byte == 0? */ - je .Ldone - - cmpb %cl,%bh /* 4th byte == ch? */ - jne 1f - leal -1(%edx),%eax -1: testb %bh,%bh /* 4th byte == 0? */ - jne .Lloop - -.Ldone: - popl %ebx - popl %edi - popl %esi - ret -END(strrchr) - -STRONG_ALIAS(rindex,strrchr) diff --git a/common/lib/libc/arch/ia64/atomic/Makefile.inc b/common/lib/libc/arch/ia64/atomic/Makefile.inc deleted file mode 100644 index 2bef12c41..000000000 --- a/common/lib/libc/arch/ia64/atomic/Makefile.inc +++ /dev/null @@ -1,21 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.3 2009/01/04 17:54:29 pooka Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c \ - atomic_add_64_cas.c atomic_add_64_nv_cas.c \ - atomic_and_32_cas.c atomic_and_32_nv_cas.c \ - atomic_and_64_cas.c atomic_and_64_nv_cas.c \ - atomic_or_32_cas.c atomic_or_32_nv_cas.c \ - atomic_or_64_cas.c atomic_or_64_nv_cas.c - -SRCS+= atomic.S - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -SRCS += atomic_init_cas.c - -.endif diff --git a/common/lib/libc/arch/ia64/atomic/atomic.S b/common/lib/libc/arch/ia64/atomic/atomic.S deleted file mode 100644 index 192d2421a..000000000 --- a/common/lib/libc/arch/ia64/atomic/atomic.S +++ /dev/null @@ -1,270 +0,0 @@ -/* $NetBSD: atomic.S,v 1.5 2009/11/09 14:22:02 skrll Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Takayoshi Kochi. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#ifdef _KERNEL -#define ALIAS(f, t) STRONG_ALIAS(f,t) -#else -#define ALIAS(f, t) WEAK_ALIAS(f,t) -#endif - - .text - -ENTRY(_atomic_dec_32,1) - fetchadd4.rel r8=[r32],-1 - br.ret.sptk rp -END(_atomic_dec_32) - -ENTRY(_atomic_dec_64,1) - fetchadd8.rel r8=[r32],-1 - br.ret.sptk rp -END(_atomic_dec_64) - -ENTRY(_atomic_dec_32_nv,1) - fetchadd4.rel r8=[r32],-1 - br.ret.sptk rp -END(_atomic_dec_32_nv) - -ENTRY(_atomic_dec_64_nv,1) - fetchadd8.rel r8=[r32],-1 - br.ret.sptk rp -END(_atomic_dec_64_nv) - -ENTRY(_atomic_inc_32,1) - fetchadd4.rel r8=[r32],1 - br.ret.sptk rp -END(_atomic_inc_32) - -ENTRY(_atomic_inc_64,1) - fetchadd8.rel r8=[r32],1 - br.ret.sptk rp -END(_atomic_inc_64) - -ENTRY(_atomic_inc_32_nv,1) - fetchadd4.rel r8=[r32],1 - br.ret.sptk rp -END(_atomic_inc_32_nv) - -ENTRY(_atomic_inc_64_nv,1) - fetchadd8.rel r8=[r32],1 - br.ret.sptk rp -END(_atomic_inc_64_nv) - -ENTRY(_atomic_swap_32,2) - xchg4 r8=[r32],r33 - ;; - mov r33=r8 - br.ret.sptk rp -END(_atomic_swap_32) - -ENTRY(_atomic_swap_64,2) - xchg8 r8=[r32],r33 - ;; - mov r33=r8 - br.ret.sptk rp -END(_atomic_swap_64) - -ENTRY(_atomic_cas_32,3) - mov ar.ccv=r33 - ;; - cmpxchg4.acq r8=[r32],r34,ar.ccv - br.ret.sptk rp -END(_atomic_cas_32) - -ENTRY(_atomic_cas_64,3) - mov ar.ccv=r33 - ;; - cmpxchg8.acq r8=[r32],r34,ar.ccv - br.ret.sptk rp -END(_atomic_cas_64) - -ENTRY(_membar_consumer,0) - mf - br.ret.sptk rp -END(_membar_consumer) - -ENTRY(_membar_producer,0) - mf - br.ret.sptk rp -END(_membar_producer) - -ENTRY(_membar_enter,0) - mf - br.ret.sptk rp -END(_membar_enter) - -ENTRY(_membar_exit,0) - mf - br.ret.sptk rp -END(_membar_exit) - -ENTRY(_membar_sync,0) - mf - br.ret.sptk rp -END(_membar_sync) - - -ALIAS(atomic_add_32,_atomic_add_32) -ALIAS(atomic_add_int,_atomic_add_32) -ALIAS(atomic_add_64,_atomic_add_64) -ALIAS(atomic_add_long,_atomic_add_64) -ALIAS(atomic_add_ptr,_atomic_add_64) - -ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -ALIAS(atomic_add_64_nv,_atomic_add_64_nv) -ALIAS(atomic_add_long_nv,_atomic_add_64_nv) -ALIAS(atomic_add_ptr_nv,_atomic_add_64_nv) - -ALIAS(atomic_and_32,_atomic_and_32) -ALIAS(atomic_and_uint,_atomic_and_32) -ALIAS(atomic_and_64,_atomic_and_64) -ALIAS(atomic_and_ulong,_atomic_and_64) -ALIAS(atomic_and_ptr,_atomic_and_64) - -ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -ALIAS(atomic_and_64_nv,_atomic_and_64_nv) -ALIAS(atomic_and_ulong_nv,_atomic_and_64_nv) -ALIAS(atomic_and_ptr_nv,_atomic_and_64_nv) - -ALIAS(atomic_dec_32,_atomic_dec_32) -ALIAS(atomic_dec_uint,_atomic_dec_32) -ALIAS(atomic_dec_64,_atomic_dec_64) -ALIAS(atomic_dec_ulong,_atomic_dec_64) -ALIAS(atomic_dec_ptr,_atomic_dec_64) - -ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -ALIAS(atomic_dec_64_nv,_atomic_dec_64_nv) -ALIAS(atomic_dec_ulong_nv,_atomic_dec_64_nv) -ALIAS(atomic_dec_ptr_nv,_atomic_dec_64_nv) - -ALIAS(atomic_inc_32,_atomic_inc_32) -ALIAS(atomic_inc_uint,_atomic_inc_32) -ALIAS(atomic_inc_64,_atomic_inc_64) -ALIAS(atomic_inc_ulong,_atomic_inc_64) -ALIAS(atomic_inc_ptr,_atomic_inc_64) - -ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -ALIAS(atomic_inc_64_nv,_atomic_inc_64_nv) -ALIAS(atomic_inc_ulong_nv,_atomic_inc_64_nv) -ALIAS(atomic_inc_ptr_nv,_atomic_inc_64_nv) - -ALIAS(atomic_or_32,_atomic_or_32) -ALIAS(atomic_or_uint,_atomic_or_32) -ALIAS(atomic_or_64,_atomic_or_64) -ALIAS(atomic_or_ulong,_atomic_or_64) -ALIAS(atomic_or_ptr,_atomic_or_64) - -ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -ALIAS(atomic_or_64_nv,_atomic_or_64_nv) -ALIAS(atomic_or_ulong_nv,_atomic_or_64_nv) -ALIAS(atomic_or_ptr_nv,_atomic_or_64_nv) - -ALIAS(atomic_swap_32,_atomic_swap_32) -ALIAS(atomic_swap_uint,_atomic_swap_32) -ALIAS(atomic_swap_64,_atomic_swap_64) -ALIAS(atomic_swap_ulong,_atomic_swap_64) -ALIAS(atomic_swap_ptr,_atomic_swap_64) - -ALIAS(atomic_cas_32,_atomic_cas_32) -ALIAS(atomic_cas_uint,_atomic_cas_32) -ALIAS(atomic_cas_64,_atomic_cas_64) -ALIAS(atomic_cas_ulong,_atomic_cas_64) -ALIAS(atomic_cas_ptr,_atomic_cas_64) - -ALIAS(atomic_cas_32_ni,_atomic_cas_32) -ALIAS(atomic_cas_uint_ni,_atomic_cas_32) -ALIAS(atomic_cas_64_ni,_atomic_cas_64) -ALIAS(atomic_cas_ulong_ni,_atomic_cas_64) -ALIAS(atomic_cas_ptr_ni,_atomic_cas_64) - -ALIAS(membar_consumer,_membar_consumer) -ALIAS(membar_producer,_membar_producer) -ALIAS(membar_enter,_membar_enter) -ALIAS(membar_exit,_membar_exit) -ALIAS(membar_sync,_membar_sync) - -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_long,_atomic_add_64) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64) - -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv) - -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64) -STRONG_ALIAS(_atomic_and_ptr,_atomic_and_64) - -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64_nv) -STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_64_nv) - -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64) - -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_64_nv) - -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64) - -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64_nv) - -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64) -STRONG_ALIAS(_atomic_or_ptr,_atomic_or_64) - -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv) -STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_64_nv) - -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64) - -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) - -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64) diff --git a/common/lib/libc/arch/m68k/atomic/Makefile.inc b/common/lib/libc/arch/m68k/atomic/Makefile.inc deleted file mode 100644 index 7ffc6660f..000000000 --- a/common/lib/libc/arch/m68k/atomic/Makefile.inc +++ /dev/null @@ -1,58 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.14 2014/11/20 07:07:13 matt Exp $ - -# -# Note: The atomic operations here in these assembly files are atomic -# only with respect to regular memory on uniprocessor systems. Since -# we don't support any MP m68k systems, this is just fine. If we ever -# do, then these routines will probably need to be replaced with CAS- -# based routines (CAS generates an atomic bus cycle, whereas these -# others are merely single-instruction). -# - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") -.if ${MACHINE_ARCH} == "m68k" - -SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ - atomic_inc.S atomic_or.S atomic_swap.S membar_ops_nop.c \ - atomic_sub.S atomic_xor.S atomic_nand.S - -.else - -SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ - atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ - atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ - atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c - -.if ${LIB} == "c" -SRCS+= atomic_add_16_cas.c atomic_add_8_cas.c \ - atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c \ - atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c \ - atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c \ - atomic_and_32_cas.c atomic_and_16_cas.c atomic_and_8_cas.c \ - atomic_or_32_cas.c atomic_or_16_cas.c atomic_or_8_cas.c \ - atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \ - atomic_swap_32_cas.c atomic_swap_16_cas.c atomic_swap_8_cas.c - -SRCS+= atomic_c11_compare_exchange_cas_8.c \ - atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_32.c -.endif - -.endif -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") -.if ${MACHINE_ARCH} == "m68k" - -SRCS+= atomic_init_cas.c - -.else - -SRCS+= atomic_init_testset.c -SRCS+= atomic_cas_68000.S -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP -D__HAVE_ASM_ATOMIC_CAS_16_UP \ - -D__HAVE_ASM_ATOMIC_CAS_8_UP - -.endif -.endif diff --git a/common/lib/libc/arch/m68k/atomic/atomic_add.S b/common/lib/libc/arch/m68k/atomic/atomic_add.S deleted file mode 100644 index 54af653a4..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_add.S +++ /dev/null @@ -1,128 +0,0 @@ -/* $NetBSD: atomic_add.S,v 1.10 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - .align 2 - -ENTRY(_atomic_add_32) - movl 4(%sp), %a0 - movl 8(%sp), %d0 - addl %d0, (%a0) - rts -END(_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32) -STRONG_ALIAS(_atomic_add_long,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_32) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32) - -ENTRY(_atomic_add_32_nv) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - addl 8(%sp), %d0 - casl %d1, %d0, (%a0) - bne 1b - movl %d0, %a0 /* pointers return also in %a0 */ - rts -END(_atomic_add_32_nv) - -ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) -CRT_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv) - -ENTRY(__sync_fetch_and_add_4) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - addl 8(%sp), %d1 - casl %d0, %d1, (%a0) - bne 1b - movl %d0, %a0 /* pointers return also in %a0 */ - rts -END(__sync_fetch_and_add_4) - -ENTRY(_atomic_add_16_nv) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - addw 8(%sp), %d0 - casw %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_add_16_nv) - -CRT_ALIAS(__sync_add_and_fetch_2,_atomic_add_16_nv) - -ENTRY(__sync_fetch_and_add_2) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - addw 8(%sp), %d1 - casw %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_add_2) - -ENTRY(_atomic_add_8_nv) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - addb 8(%sp), %d0 - casb %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_add_8_nv) - -CRT_ALIAS(__sync_add_and_fetch_1,_atomic_add_8_nv) - -ENTRY(__sync_fetch_and_add_1) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - addb 8(%sp), %d1 - casb %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_add_1) - -CRT_ALIAS(__atomic_fetch_add_1,__sync_fetch_and_add_1) -CRT_ALIAS(__atomic_fetch_add_2,__sync_fetch_and_add_2) -CRT_ALIAS(__atomic_fetch_add_4,__sync_fetch_and_add_4) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_and.S b/common/lib/libc/arch/m68k/atomic/atomic_and.S deleted file mode 100644 index 5f9a79810..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_and.S +++ /dev/null @@ -1,128 +0,0 @@ -/* $NetBSD: atomic_and.S,v 1.11 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_and_32) - movl 4(%sp), %a0 - movl 8(%sp), %d0 - andl %d0, (%a0) - rts -END(_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_ptr,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ptr,_atomic_and_32) - -ENTRY(_atomic_and_32_nv) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - andl 8(%sp), %d0 - casl %d1, %d0, (%a0) - bne 1b - movl %d0, %a0 - rts -END(_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_ptr_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_32_nv) -CRT_ALIAS(__sync_and_and_fetch_4,_atomic_and_32_nv) - -ENTRY(__sync_fetch_and_and_4) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - andl 8(%sp), %d1 - casl %d0, %d1, (%a0) - bne 1b - movl %d0, %a0 - rts -END(__sync_fetch_and_and_4) - - -ENTRY(_atomic_and_16_nv) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - andw 8(%sp), %d0 - casw %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_and_16_nv) - -CRT_ALIAS(__sync_and_and_fetch_2,_atomic_and_16_nv) - -ENTRY(__sync_fetch_and_and_2) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - andw 8(%sp), %d1 - casw %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_and_2) - - -ENTRY(_atomic_and_8_nv) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - andb 8(%sp), %d0 - casb %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_and_8_nv) - -CRT_ALIAS(__sync_and_and_fetch_1,_atomic_and_8_nv) - -ENTRY(__sync_fetch_and_and_1) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - andb 8(%sp), %d1 - casb %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_and_1) - -CRT_ALIAS(__atomic_fetch_and_1,__sync_fetch_and_and_1) -CRT_ALIAS(__atomic_fetch_and_2,__sync_fetch_and_and_2) -CRT_ALIAS(__atomic_fetch_and_4,__sync_fetch_and_and_4) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_cas.S b/common/lib/libc/arch/m68k/atomic/atomic_cas.S deleted file mode 100644 index d39c26671..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_cas.S +++ /dev/null @@ -1,126 +0,0 @@ -/* $NetBSD: atomic_cas.S,v 1.13 2015/07/10 20:16:01 mlelstv Exp $ */ - -/*- - * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_cas_32) - movl 4(%sp), %a0 - movl 8(%sp), %d0 - movl 12(%sp), %d1 - casl %d0, %d1, (%a0) - /* %d0 now contains the old value */ - movl %d0, %a0 /* pointers return also in %a0 */ - rts -END(_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) -CRT_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32) - -ENTRY(__sync_bool_compare_and_swap_4) - movl 4(%sp), %a0 - movl 8(%sp), %d0 - movl 12(%sp), %d1 - casl %d0, %d1, (%a0) - beqs 1f - clrl %d0 /* return false */ - rts -1: movql #1, %d0 /* return success */ - rts -END(__sync_bool_compare_and_swap_4) - -ENTRY(_atomic_cas_16) - movl 4(%sp), %a0 - movw 8+2(%sp), %d0 /* lower word */ - movw 12+2(%sp), %d1 /* lower word */ - casw %d0, %d1, (%a0) - /* %d0 now contains the old value */ - rts -END(_atomic_cas_16) - -ATOMIC_OP_ALIAS(atomic_cas_16,_atomic_cas_16) -CRT_ALIAS(__sync_val_compare_and_swap_2,_atomic_cas_16) - -ENTRY(__sync_bool_compare_and_swap_2) - movl 4(%sp), %a0 - movw 8+2(%sp), %d0 /* lower word */ - movw 12+2(%sp), %d1 /* lower word */ - casw %d0, %d1, (%a0) - /* %d0 now contains the old value */ - beqs 1f - clrl %d0 /* return failure */ - rts -1: movql #1, %d0 /* return success */ - rts -END(__sync_bool_compare_and_swap_2) - -ENTRY(_atomic_cas_8) - movl 4(%sp), %a0 - movb 8+3(%sp), %d0 /* lower byte */ - movb 12+3(%sp), %d1 /* lower byte */ - casb %d0, %d1, (%a0) - /* %d0 now contains the old value */ - rts -END(_atomic_cas_8) - -ATOMIC_OP_ALIAS(atomic_cas_8,_atomic_cas_8) -CRT_ALIAS(__sync_val_compare_and_swap_1,_atomic_cas_8) - - -ENTRY(__sync_bool_compare_and_swap_1) - movl 4(%sp), %a0 - movb 8+3(%sp), %d0 /* lower byte */ - movb 12+3(%sp), %d1 /* lower byte */ - casb %d0, %d1, (%a0) - /* %d0 now contains the old value */ - beqs 1f - clrl %d0 /* return failure */ - rts -1: movql #1, %d0 /* return success */ - rts -END(__sync_bool_compare_and_swap_1) - diff --git a/common/lib/libc/arch/m68k/atomic/atomic_cas_68000.S b/common/lib/libc/arch/m68k/atomic/atomic_cas_68000.S deleted file mode 100644 index 87b156878..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_cas_68000.S +++ /dev/null @@ -1,78 +0,0 @@ -/* $NetBSD: atomic_cas_68000.S,v 1.6 2014/01/29 10:20:11 martin Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Steve C. Woodford. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_cas_up) - .hidden _C_LABEL(_atomic_cas_up) - - movl 4(%sp), %a0 /* Fetch ptr */ - -RAS_START_ASM_HIDDEN(_atomic_cas) - movl (%a0), %d0 /* d0 = *ptr */ - cmpl 8(%sp), %d0 /* Same as old? */ - jne 1f /* Nope */ - movl 12(%sp), (%a0) /* *ptr = new */ -RAS_END_ASM_HIDDEN(_atomic_cas) -1: rts -END(_atomic_cas_up) - -ENTRY(_atomic_cas_16_up) - .hidden _C_LABEL(_atomic_cas_16_up) - - movl 4(%sp), %a0 /* Fetch ptr */ - -RAS_START_ASM_HIDDEN(_atomic_cas_16) - movw (%a0), %d0 /* d0 = *ptr */ - cmpw 8(%sp), %d0 /* Same as old? */ - jne 1f /* Nope */ - movw 12(%sp), (%a0) /* *ptr = new */ -RAS_END_ASM_HIDDEN(_atomic_cas_16) -1: rts -END(_atomic_cas_16_up) - - -ENTRY(_atomic_cas_8_up) - .hidden _C_LABEL(_atomic_cas_8_up) - - movl 4(%sp), %a0 /* Fetch ptr */ - -RAS_START_ASM_HIDDEN(_atomic_cas_8) - movb (%a0), %d0 /* d0 = *ptr */ - cmpb 8(%sp), %d0 /* Same as old? */ - jne 1f /* Nope */ - movb 12(%sp), (%a0) /* *ptr = new */ -RAS_END_ASM_HIDDEN(_atomic_cas_8) -1: rts -END(_atomic_cas_8_up) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_dec.S b/common/lib/libc/arch/m68k/atomic/atomic_dec.S deleted file mode 100644 index fab1cfa9c..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_dec.S +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_dec.S,v 1.6 2013/07/16 23:24:18 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_dec_32) - movl 4(%sp), %a0 - subql #1, (%a0) - rts -END(_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_32) - -ENTRY(_atomic_dec_32_nv) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - subql #1, %d0 - casl %d1, %d0, (%a0) - bne 1b - movl %d0, %a0 /* pointers return also in %a0 */ - rts -END(_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_32_nv) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_inc.S b/common/lib/libc/arch/m68k/atomic/atomic_inc.S deleted file mode 100644 index 6579aaac4..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_inc.S +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_inc.S,v 1.6 2013/07/16 23:24:18 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_inc_32) - movl 4(%sp), %a0 - addql #1, (%a0) - rts -END(_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32) - -ENTRY(_atomic_inc_32_nv) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - addql #1, %d0 - casl %d1, %d0, (%a0) - bne 1b - movl %d0, %a0 /* pointers return also in %a0 */ - rts -END(_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_nand.S b/common/lib/libc/arch/m68k/atomic/atomic_nand.S deleted file mode 100644 index f691b616c..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_nand.S +++ /dev/null @@ -1,123 +0,0 @@ -/* $NetBSD: atomic_nand.S,v 1.2 2014/02/22 17:08:30 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_nand_32_nv) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - andl 8(%sp), %d0 - notl %d0 - casl %d1, %d0, (%a0) - bne 1b - movl %d0, %a0 - rts -END(_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_32_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_uint_nv,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_uint_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_ulong_nv,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_ulong_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_ptr_nv,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_ptr_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_32,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_uint,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_ulong,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_ptr,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_ptr,_atomic_nand_32_nv) -CRT_ALIAS(__sync_nand_and_fetch_4,_atomic_nand_32_nv) - -ENTRY(__sync_fetch_and_nand_4) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - andl 8(%sp), %d1 - notl %d1 - casl %d0, %d1, (%a0) - bne 1b - movl %d0, %a0 - rts -END(__sync_fetch_and_nand_4) - - -ENTRY(_atomic_nand_16_nv) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - andw 8(%sp), %d0 - notw %d0 - casw %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_nand_16_nv) - -CRT_ALIAS(__sync_nand_and_fetch_2,_atomic_nand_16_nv) - -ENTRY(__sync_fetch_and_nand_2) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - andw 8(%sp), %d1 - notw %d1 - casw %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_nand_2) - - -ENTRY(_atomic_nand_8_nv) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - andb 8(%sp), %d0 - notb %d0 - casb %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_nand_8_nv) - -CRT_ALIAS(__sync_nand_and_fetch_1,_atomic_nand_8_nv) - -ENTRY(__sync_fetch_and_nand_1) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - andb 8(%sp), %d1 - notb %d1 - casb %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_nand_1) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_op_asm.h b/common/lib/libc/arch/m68k/atomic/atomic_op_asm.h deleted file mode 100644 index 480847e42..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_op_asm.h +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.5 2014/02/23 07:43:38 martin Exp $ */ - -/*- - * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) -#ifdef _HARDKERNEL -#define CRT_ALIAS(a,s) STRONG_ALIAS(a,s) -#endif - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) -#ifdef _LIBC -#define CRT_ALIAS(a,s) STRONG_ALIAS(a,s) -#endif - -#endif /* _KERNEL */ - -#ifndef CRT_ALIAS -#define CRT_ALIAS(a,s) -#endif - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/m68k/atomic/atomic_or.S b/common/lib/libc/arch/m68k/atomic/atomic_or.S deleted file mode 100644 index fea79793d..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_or.S +++ /dev/null @@ -1,129 +0,0 @@ -/* $NetBSD: atomic_or.S,v 1.11 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_or_32) - movl 4(%sp), %a0 - movl 8(%sp), %d0 - orl %d0, (%a0) - rts -END(_atomic_or_32) - -ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_ptr,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ptr,_atomic_or_32) - -ENTRY(_atomic_or_32_nv) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - orl 8(%sp), %d0 - casl %d1, %d0, (%a0) - bne 1b - movl %d0, %a0 - rts -END(_atomic_or_32_nv) - -ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_ptr_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_32_nv) -CRT_ALIAS(__sync_or_and_fetch_4, _atomic_or_32_nv) - - -ENTRY(__sync_fetch_and_or_4) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - orl 8(%sp), %d1 - casl %d0, %d1, (%a0) - bne 1b - movl %d0, %a0 - rts -END(__sync_fetch_and_or_4) - - -ENTRY(_atomic_or_16_nv) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - orw 8(%sp), %d0 - casw %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_or_16_nv) -CRT_ALIAS(__sync_or_and_fetch_2, _atomic_or_16_nv) - -ENTRY(__sync_fetch_and_or_2) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - orw 8(%sp), %d1 - casw %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_or_2) - - -ENTRY(_atomic_or_8_nv) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - orb 8(%sp), %d0 - casb %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_or_8_nv) -CRT_ALIAS(__sync_or_and_fetch_1, _atomic_or_8_nv) - -ENTRY(__sync_fetch_and_or_1) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - orb 8(%sp), %d1 - casb %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_or_1) - -CRT_ALIAS(__atomic_fetch_or_1,__sync_fetch_and_or_1) -CRT_ALIAS(__atomic_fetch_or_2,__sync_fetch_and_or_2) -CRT_ALIAS(__atomic_fetch_or_4,__sync_fetch_and_or_4) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_sub.S b/common/lib/libc/arch/m68k/atomic/atomic_sub.S deleted file mode 100644 index 0585a8cb4..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_sub.S +++ /dev/null @@ -1,128 +0,0 @@ -/* $NetBSD: atomic_sub.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - .align 2 - -ENTRY(_atomic_sub_32) - movl 4(%sp), %a0 - movl 8(%sp), %d0 - subl %d0, (%a0) - rts -END(_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_32,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_int,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_int,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_long,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_long,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_ptr,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_ptr,_atomic_sub_32) - -ENTRY(_atomic_sub_32_nv) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - subl 8(%sp), %d0 - casl %d1, %d0, (%a0) - bne 1b - movl %d0, %a0 /* pointers return also in %a0 */ - rts -END(_atomic_sub_32_nv) - -ATOMIC_OP_ALIAS(atomic_sub_32_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_int_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_int_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_long_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_long_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_ptr_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_ptr_nv,_atomic_sub_32_nv) -CRT_ALIAS(__sync_sub_and_fetch_4,_atomic_sub_32_nv) - -ENTRY(__sync_fetch_and_sub_4) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - subl 8(%sp), %d1 - casl %d0, %d1, (%a0) - bne 1b - movl %d0, %a0 /* pointers return also in %a0 */ - rts -END(__sync_fetch_and_sub_4) - -ENTRY(_atomic_sub_16_nv) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - subw 8(%sp), %d0 - casw %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_sub_16_nv) - -CRT_ALIAS(__sync_sub_and_fetch_2,_atomic_sub_16_nv) - -ENTRY(__sync_fetch_and_sub_2) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - subw 8(%sp), %d1 - casw %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_sub_2) - -ENTRY(_atomic_sub_8_nv) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - subb 8(%sp), %d0 - casb %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_sub_8_nv) - -CRT_ALIAS(__sync_sub_and_fetch_1,_atomic_sub_8_nv) - -ENTRY(__sync_fetch_and_sub_1) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - subb 8(%sp), %d1 - casb %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_sub_1) - -CRT_ALIAS(__atomic_fetch_sub_1,__sync_fetch_and_sub_1) -CRT_ALIAS(__atomic_fetch_sub_2,__sync_fetch_and_sub_2) -CRT_ALIAS(__atomic_fetch_sub_4,__sync_fetch_and_sub_4) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_swap.S b/common/lib/libc/arch/m68k/atomic/atomic_swap.S deleted file mode 100644 index af8760d58..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_swap.S +++ /dev/null @@ -1,81 +0,0 @@ -/* $NetBSD: atomic_swap.S,v 1.9 2014/06/28 20:18:55 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_swap_32) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl 8(%sp), %d1 - casl %d0, %d1, (%a0) - bne 1b - /* %d0 now contains the old value */ - movl %d0, %a0 /* pointers return also in %a0 */ - rts -END(_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) -CRT_ALIAS(__sync_lock_test_and_set_4,_atomic_swap_32) -CRT_ALIAS(__atomic_exchange_4,_atomic_swap_32) - - -ENTRY(_atomic_swap_16) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw 8(%sp), %d1 - casw %d0, %d1, (%a0) - bne 1b - /* %d0 now contains the old value */ - rts -END(_atomic_swap_16) -ATOMIC_OP_ALIAS(atomic_swap_16,_atomic_swap_16) -CRT_ALIAS(__sync_lock_test_and_set_2,_atomic_swap_16) -CRT_ALIAS(__atomic_exchange_2,_atomic_swap_16) - -ENTRY(_atomic_swap_8) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb 8(%sp), %d1 - casb %d0, %d1, (%a0) - bne 1b - /* %d0 now contains the old value */ - rts -END(_atomic_swap_8) -ATOMIC_OP_ALIAS(atomic_swap_8,_atomic_swap_8) -CRT_ALIAS(__sync_lock_test_and_set_1,_atomic_swap_8) -CRT_ALIAS(__atomic_exchange_1,_atomic_swap_8) diff --git a/common/lib/libc/arch/m68k/atomic/atomic_xor.S b/common/lib/libc/arch/m68k/atomic/atomic_xor.S deleted file mode 100644 index d9b935012..000000000 --- a/common/lib/libc/arch/m68k/atomic/atomic_xor.S +++ /dev/null @@ -1,135 +0,0 @@ -/* $NetBSD: atomic_xor.S,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_xor_32) - movl 4(%sp), %a0 - movl 8(%sp), %d0 - eorl %d0, (%a0) - rts -END(_atomic_xor_32) - -ATOMIC_OP_ALIAS(atomic_xor_32,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_uint,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_uint,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_ulong,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_ulong,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_ptr,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_ptr,_atomic_xor_32) - -ENTRY(_atomic_xor_32_nv) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - movl 8(%sp), %d2 - eorl %d2, %d0 - casl %d1, %d0, (%a0) - bne 1b - movl %d0, %a0 - rts -END(_atomic_xor_32_nv) - -ATOMIC_OP_ALIAS(atomic_xor_32_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_uint_nv,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_uint_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_ulong_nv,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_ulong_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_ptr_nv,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_ptr_nv,_atomic_xor_32_nv) -CRT_ALIAS(__sync_xor_and_fetch_4, _atomic_xor_32_nv) - - -ENTRY(__sync_fetch_and_xor_4) - movl 4(%sp), %a0 -1: movl (%a0), %d0 - movl %d0, %d1 - movl 8(%sp), %d2 - eorl %d2, %d1 - casl %d0, %d1, (%a0) - bne 1b - movl %d0, %a0 - rts -END(__sync_fetch_and_xor_4) - - -ENTRY(_atomic_xor_16_nv) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - movw 8(%sp), %d2 - eorw %d2, %d0 - casw %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_xor_16_nv) -CRT_ALIAS(__sync_xor_and_fetch_2, _atomic_xor_16_nv) - -ENTRY(__sync_fetch_and_xor_2) - movl 4(%sp), %a0 -1: movw (%a0), %d0 - movw %d0, %d1 - movw 8(%sp), %d2 - eorw %d2, %d1 - casw %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_xor_2) - - -ENTRY(_atomic_xor_8_nv) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - movb 8(%sp), %d2 - eorb %d2, %d0 - casb %d1, %d0, (%a0) - bne 1b - rts -END(_atomic_xor_8_nv) -CRT_ALIAS(__sync_xor_and_fetch_1, _atomic_xor_8_nv) - -ENTRY(__sync_fetch_and_xor_1) - movl 4(%sp), %a0 -1: movb (%a0), %d0 - movb %d0, %d1 - movb 8(%sp), %d2 - eorb %d2, %d1 - casb %d0, %d1, (%a0) - bne 1b - rts -END(__sync_fetch_and_xor_1) - -CRT_ALIAS(__atomic_fetch_xor_1,__sync_fetch_and_xor_1) -CRT_ALIAS(__atomic_fetch_xor_2,__sync_fetch_and_xor_2) -CRT_ALIAS(__atomic_fetch_xor_4,__sync_fetch_and_xor_4) diff --git a/common/lib/libc/arch/m68k/gen/bswap16.S b/common/lib/libc/arch/m68k/gen/bswap16.S deleted file mode 100644 index b835f6e7d..000000000 --- a/common/lib/libc/arch/m68k/gen/bswap16.S +++ /dev/null @@ -1,54 +0,0 @@ -/* $NetBSD: bswap16.S,v 1.6 2014/03/18 18:20:35 riastradh Exp $ */ - -/* - * Copyright (C) 1996 Scott Reynolds. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define BSWAP16 _C_LABEL(bswap16) -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -#define BSWAP16 _C_LABEL(__bswap16) -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ - -_ENTRY(BSWAP16) -#ifdef __mcfisac__ - mvzw 6(%sp),%d0 - swap %d0 - byterev %d0 -#elif defined(__mcoldfire__) - mvzw 6(%sp),%d0 - movl %d0,%d1 - mvzb %d0,%d0 - lsll #8,%d0 - lsrl #8,%d1 - orl %d1,%d0 -#else - movl 4(%sp),%d0 - rolw #8,%d0 -#endif - rts -END(BSWAP16) diff --git a/common/lib/libc/arch/m68k/gen/bswap32.S b/common/lib/libc/arch/m68k/gen/bswap32.S deleted file mode 100644 index 1b2a4a314..000000000 --- a/common/lib/libc/arch/m68k/gen/bswap32.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: bswap32.S,v 1.6 2014/03/18 18:20:35 riastradh Exp $ */ - -/* - * Copyright (C) 1996 Scott Reynolds. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define BSWAP32 _C_LABEL(bswap32) -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -#define BSWAP32 _C_LABEL(__bswap32) -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ - -_ENTRY(BSWAP32) - movl 4(%sp),%d0 -#ifdef __mcfisac__ - byterev %d0 -#elif defined(__mcoldfire__) - movl %d0,%d1 - lsrl #8,%d0 | ABCD -> 0ABC - andl #0x00ff00ff,%d0 | 0ABC -> 0A0C - andl #0x00ff00ff,%d1 | ABCD -> 0B0D - lsll #8,%d1 | 0B0D -> B0D0 - orl %d1,%d0 | 0A0C | B0D0 -> BADC - swap %d0 | BADC -> DCBA -#else - rolw #8,%d0 - swap %d0 - rolw #8,%d0 -#endif - rts -END(BSWAP32) diff --git a/common/lib/libc/arch/m68k/gen/bswap64.S b/common/lib/libc/arch/m68k/gen/bswap64.S deleted file mode 100644 index 64061a27b..000000000 --- a/common/lib/libc/arch/m68k/gen/bswap64.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: bswap64.S,v 1.5 2014/03/18 18:20:35 riastradh Exp $ */ - -/* - * Copyright (C) 1996 Scott Reynolds. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -ENTRY(bswap64) - movl 4(%sp),%d1 - movl 8(%sp),%d0 -#ifdef __mcfisac__ - byterev %d0 - byterev %d1 -#elif defined(__mcoldfire__) - movl %d3,-(%sp) - movl %d2,-(%sp) - movl #0x00ff00ff, %d3 - movl %d0,%d2 - andl %d3,%d2 - lsll #8,%d2 - lsrl #8,%d0 - andl %d3,%d0 - orl %d2,%d0 - movl %d1,%d2 - andl %d3,%d2 - lsll #8,%d2 - lsrl #8,%d1 - andl %d3,%d1 - orl %d2,%d1 - movl (%sp)+,%d2 - movl (%sp)+,%d3 -#else - rolw #8,%d1 - rolw #8,%d0 - swap %d1 - swap %d0 - rolw #8,%d0 - rolw #8,%d1 -#endif - rts -END(bswap64) diff --git a/common/lib/libc/arch/m68k/gen/divsi3.S b/common/lib/libc/arch/m68k/gen/divsi3.S deleted file mode 100644 index 278c33123..000000000 --- a/common/lib/libc/arch/m68k/gen/divsi3.S +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: divsi3.S,v 1.5 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)divsi3.s 5.1 (Berkeley) 6/7/90") -#else - RCSID("$NetBSD: divsi3.S,v 1.5 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* int / int */ -#ifndef __mc68010__ -ENTRY(__divsi3) - movel 4(%sp),%d0 - divsl 8(%sp),%d0 - rts -END(__divsi3) -#else -ENTRY(__divsi3) -| NB: this requires that __udivsi3 preserve %a0: - movel 4(%sp), %d1 | load the dividend - bpl 1f - negl 4(%sp) | store abs(dividend) -1: movel 8(%sp), %d0 | load the divisor - bpl 2f - negl 8(%sp) | store abs(divisor) -2: eorl %d1, %d0 - bpl 3f | branch if sgn(divisor) == sgn(dividend) - movel (%sp)+, %a0 | pop return address - pea (.Lret,%pc) | push our return address -3: jmp _C_LABEL(__udivsi3) -.Lret: negl %d0 | negate quotient - jmp (%a0) -END(__divsi3) -#endif /* __mc68010__ */ diff --git a/common/lib/libc/arch/m68k/gen/modsi3.S b/common/lib/libc/arch/m68k/gen/modsi3.S deleted file mode 100644 index bff62d66a..000000000 --- a/common/lib/libc/arch/m68k/gen/modsi3.S +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: modsi3.S,v 1.7 2014/03/04 04:03:49 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)modsi3.s 5.1 (Berkeley) 6/7/90") -#else - RCSID("$NetBSD: modsi3.S,v 1.7 2014/03/04 04:03:49 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* int % int */ -#ifndef __mc68010__ -ENTRY(__modsi3) - movel 4(%sp),%d1 -#ifdef __mcoldfire__ - remsl 8(%sp),%d0:%d1 - divsl 8(%sp),%d1 -#else - divsll 8(%sp),%d0:%d1 -#endif - rts -END(__modsi3) -#else -ENTRY(__modsi3) -| NB: this requires that __udivsi3 preserve %a0 and return -| the modulus in %d1: - movel (%sp)+, %a0 | pop return address - movel 4(%sp), %d1 | load the divisor - bpl 1f - negl 4(%sp) | store abs(divisor) -1: movel (%sp), %d0 | load the dividend - pea (.Lret,%pc) | push our return address - bpl 2f - negl 4(%sp) | store abs(dividend) - subql #2, (%sp) | adjust return address -2: jmp _C_LABEL(__udivsi3) - negl %d1 | negate modulus -.Lret: movl %d1, %d0 | move modulus into %d0 - jmp (%a0) -END(__modsi3) -#endif /* __mc68010__ */ diff --git a/common/lib/libc/arch/m68k/gen/mulsi3.S b/common/lib/libc/arch/m68k/gen/mulsi3.S deleted file mode 100644 index c4c739131..000000000 --- a/common/lib/libc/arch/m68k/gen/mulsi3.S +++ /dev/null @@ -1,69 +0,0 @@ -/* $NetBSD: mulsi3.S,v 1.4 2013/07/16 23:24:18 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)mulsi3.s 5.1 (Berkeley) 6/7/90") -#else - RCSID("$NetBSD: mulsi3.S,v 1.4 2013/07/16 23:24:18 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* int * int */ -ENTRY(__mulsi3) -#ifndef __mc68010__ - movel 4(%sp),%d0 - mulsl 8(%sp),%d0 -#else -| NB: this requires that __udivsi3 preserve %a0 and return -| the modulus in %d1: - movew 6(%sp), %d0 - movel %d0, %a0 | save B - muluw 8(%sp), %d0 | %d0 holds B * C - movew 10(%sp), %d1 - movel %d1, %a1 | save D - muluw 4(%sp), %d1 | %d1 holds A * D - addw %d1, %d0 | %d0 holds (B * C) + (A * D) - swap %d0 - clrw %d0 | %d0 holds ((B * C) + (A * D)) << 16 - exg %a0, %d0 | restore B - movel %a1, %d1 | restore D - muluw %d1, %d0 | %d0 holds B * D - addl %a0, %d0 | final result -#endif /* __mc68010__ */ - rts -END(__mulsi3) diff --git a/common/lib/libc/arch/m68k/gen/udivsi3.S b/common/lib/libc/arch/m68k/gen/udivsi3.S deleted file mode 100644 index b0c19a92c..000000000 --- a/common/lib/libc/arch/m68k/gen/udivsi3.S +++ /dev/null @@ -1,129 +0,0 @@ -/* $NetBSD: udivsi3.S,v 1.4 2013/07/16 23:24:18 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)udivsi3.s 5.1 (Berkeley) 6/7/90") -#else - RCSID("$NetBSD: udivsi3.S,v 1.4 2013/07/16 23:24:18 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* unsigned / unsigned */ -#ifndef __mc68010__ -ENTRY(__udivsi3) - movel 4(%sp),%d0 - divul 8(%sp),%d0 - rts -END(__udivsi3) -#else -ENTRY(__udivsi3) - movel %d2, -(%sp) | save %d2 - movel 12(%sp), %d0 | load divisor - movel 8(%sp), %d1 | load dividend - -| first, we divide the divisor and dividend by two until -| the divisor fits into 16 bits: -1: cmpil #0x10000, %d0 - bcs 2f - lsrl #1, %d0 - lsrl #1, %d1 - bra 1b -2: - -| now we can do the divide. to avoid overflow, we have to -| do the divide in two parts, high and low, and add the -| results together: - movew %d1, %d2 | save low(dividend) - clrw %d1 - swap %d1 | %d1 = dividend >> 16 - divuw %d0, %d1 | do the high divide - moveal %d1, %a1 | save high divide result - movew %d2, %d1 | concat(remainder, low(dividend)) - divuw %d0, %d1 | do the low divide - movel %a1, %d0 | recover high divide result - swap %d0 - clrw %d0 | %d0 = finished high divide result - andil #0xffff, %d1 | %d1 = finished low divide result - addl %d1, %d0 | %d0 = quotient guess - -| the quotient we have so far is only a guess. the divide we -| did above was really the divide of some dividendB by some -| divisorB, where the following hold: -| -| (dividend - divisor) <= dividendB <= dividend -| (divisor / 2) < divisorB <= divisor -| -| so our guess quotient cannot be less than our real desired -| quotient. however, it might be one too big. -| -| to adjust this quotient, we multiply it by the original -| divisor and subtract the result from the original dividend. -| if the result is nonnegative, our guessed quotient was -| correct, and the subtraction result is our remainder. -| if the result is negative, our guessed quotient was one -| too big, and the subtraction result plus the original -| divisor is our remainder. -| -| as in mulsi3, we have to do the multiply in stages to avoid -| overflow: - - movel 12(%sp), %d2 | load divisor - swap %d2 - movel %d0, %d1 - muluw %d2, %d1 | high(divisor) * low(guess) - moveal %d1, %a1 | save high(divisor) * low(guess) - swap %d2 - movel %d0, %d1 - swap %d1 - muluw %d2, %d1 | low(divisor) * high(guess) - addl %a1, %d1 - swap %d1 - clrw %d1 | %d1 = finished high multiply result - moveal %d2, %a1 | save original divisor - muluw %d0, %d2 | low(guess) * low(divisor) - addl %d1, %d2 | %d2 = guess * divisor - - movel 8(%sp), %d1 | load original dividend - subl %d2, %d1 | subtract - bcc 3f - subql #1, %d0 | adjust quotient - addl %a1, %d1 | adjust remainder -3: movel (%sp)+, %d2 | restore %d2 - rts -END(__udivsi3) -#endif /* __mc68010__ */ diff --git a/common/lib/libc/arch/m68k/gen/umodsi3.S b/common/lib/libc/arch/m68k/gen/umodsi3.S deleted file mode 100644 index 8390bb2b0..000000000 --- a/common/lib/libc/arch/m68k/gen/umodsi3.S +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: umodsi3.S,v 1.5 2014/03/04 06:15:33 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)umodsi3.s 5.1 (Berkeley) 6/7/90")( -#else - RCSID("$NetBSD: umodsi3.S,v 1.5 2014/03/04 06:15:33 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* unsigned % unsigned */ -#ifndef __mc68010__ -ENTRY(__umodsi3) - movel 4(%sp),%d1 -#ifdef __mcoldfire__ - remul 8(%sp),%d0:%d1 - divul 8(%sp),%d1 -#else - divull 8(%sp),%d0:%d1 -#endif - rts -END(__umodsi3) -#else -ENTRY(__umodsi3) -| NB: this requires that __udivsi3 preserve the %a0 -| register, and that it returns the modulus in %d1: - movel (%sp)+, %a0 | pop the return address - jsr _C_LABEL(__udivsi3) - movel %d1, %d0 | move the modulus into %d0 - jmp (%a0) | return -END(__umodsi3) -#endif /* __mc68010__ */ diff --git a/common/lib/libc/arch/m68k/net/htonl.S b/common/lib/libc/arch/m68k/net/htonl.S deleted file mode 100644 index b388f2089..000000000 --- a/common/lib/libc/arch/m68k/net/htonl.S +++ /dev/null @@ -1,51 +0,0 @@ -/* $NetBSD: htonl.S,v 1.3 2013/07/16 23:24:19 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)htonl.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: htonl.S,v 1.3 2013/07/16 23:24:19 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* netorder = htonl(hostorder) */ - -ENTRY(htonl) - movl 4(%sp),%d0 - rts -END(htonl) diff --git a/common/lib/libc/arch/m68k/net/htons.S b/common/lib/libc/arch/m68k/net/htons.S deleted file mode 100644 index 35aa35686..000000000 --- a/common/lib/libc/arch/m68k/net/htons.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: htons.S,v 1.3 2013/07/16 23:24:19 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)htons.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: htons.S,v 1.3 2013/07/16 23:24:19 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* hostorder = htons(netorder) */ - -ENTRY(htons) - clrl %d0 - movw 6(%sp),%d0 - rts -END(htons) diff --git a/common/lib/libc/arch/m68k/net/ntohl.S b/common/lib/libc/arch/m68k/net/ntohl.S deleted file mode 100644 index e2a90dad7..000000000 --- a/common/lib/libc/arch/m68k/net/ntohl.S +++ /dev/null @@ -1,51 +0,0 @@ -/* $NetBSD: ntohl.S,v 1.3 2013/07/16 23:24:19 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)ntohl.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: ntohl.S,v 1.3 2013/07/16 23:24:19 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* hostorder = ntohl(netorder) */ - -ENTRY(ntohl) - movl 4(%sp),%d0 - rts -END(ntohl) diff --git a/common/lib/libc/arch/m68k/net/ntohs.S b/common/lib/libc/arch/m68k/net/ntohs.S deleted file mode 100644 index cd12d7c83..000000000 --- a/common/lib/libc/arch/m68k/net/ntohs.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: ntohs.S,v 1.3 2013/07/16 23:24:19 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)ntohs.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: ntohs.S,v 1.3 2013/07/16 23:24:19 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* hostorder = ntohs(netorder) */ - -ENTRY(ntohs) - clrl %d0 - movw 6(%sp),%d0 - rts -END(ntohs) diff --git a/common/lib/libc/arch/m68k/string/bcmp.S b/common/lib/libc/arch/m68k/string/bcmp.S deleted file mode 100644 index 081a551cb..000000000 --- a/common/lib/libc/arch/m68k/string/bcmp.S +++ /dev/null @@ -1,196 +0,0 @@ -/* $NetBSD: bcmp.S,v 1.6 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by J.T. Conklin. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)bcmp.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: bcmp.S,v 1.6 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -#ifdef __mcoldfire__ -#define CMPMB(a,b) movb b,%d2; cmpb a,%d2 -#define CMPMW(a,b) movw b,%d2; cmpw a,%d2 -#define CMPML(a,b) movl b,%d2; cmpl a,%d2 -#else -#define CMPMB(a,b) cmpmb a,b -#define CMPMW(a,b) cmpmw a,b -#define CMPML(a,b) cmpml a,b -#endif - -ENTRY(bcmp) - movl 4(%sp),%a0 | string 1 - movl 8(%sp),%a1 | string 2 - movl 12(%sp),%d1 | length -#ifdef __mcoldfire__ - movl %d2,-(%sp) | save temp -#endif - - /* - * It isn't worth the overhead of aligning to {long}word boundries - * if the string is too short. - */ - cmpl #8,%d1 - jlt .Lbcbyte - -#ifdef __mc68010__ - /* - * The 68010 cannot access a word or long on an odd boundary, - * period. If the source and the destination addresses aren't - * of the same evenness, we're forced to do a bytewise compare. - */ - movl %a0,%d0 - addl %a1,%d0 - btst #0,%d0 - jne .Lbcbyte -#endif /* __mc68010__ */ - - /* word align */ - movl %a0,%d0 - btst #0,%d0 - jeq .Lbcalgndw - CMPMB((%a0)+,(%a1)+) - jne .Lbcnoteq - subql #1,%d1 -.Lbcalgndw: - /* long word align */ - btst #1,%d0 - jeq .Lbcalgndl - CMPMW((%a0)+,(%a1)+) - jne .Lbcnoteq - subql #2,%d1 -.Lbcalgndl: - /* compare by 8 longwords */ - movl %d1,%d0 - lsrl #5,%d0 | cnt = len / 32 - jeq .Lbclong | if (cnt) - andl #31,%d1 | len %= 32 - subql #1,%d0 | set up for dbf -.Lbc32loop: - CMPML((%a0)+,(%a1)+) | compare 1 of 8 longwords - jne .Lbcnoteq | not equal, return non-zero - CMPML((%a0)+,(%a1)+) | compare 2 of 8 longwords - jne .Lbcnoteq - CMPML((%a0)+,(%a1)+) | compare 3 of 8 longwords - jne .Lbcnoteq - CMPML((%a0)+,(%a1)+) | compare 4 of 8 longwords - jne .Lbcnoteq - CMPML((%a0)+,(%a1)+) | compare 5 of 8 longwords - jne .Lbcnoteq - CMPML((%a0)+,(%a1)+) | compare 6 of 8 longwords - jne .Lbcnoteq - CMPML((%a0)+,(%a1)+) | compare 7 of 8 longwords - jne .Lbcnoteq - CMPML((%a0)+,(%a1)+) | compare 8 of 8 longwords - jne .Lbcnoteq -#ifndef __mcoldfire__ - dbf %d0,.Lbc32loop | till done - clrw %d0 -#endif - subql #1,%d0 - jcc .Lbc32loop - -.Lbclong: - /* compare by longwords */ - movl %d1,%d0 - lsrl #2,%d0 | cnt = len / 4 - jeq .Lbcbyte | if (cnt) - subql #1,%d0 | set up for dbf -.Lbclloop: - CMPML((%a0)+,(%a1)+) | compare a longword - jne .Lbcnoteq | not equal, return non-zero -#ifdef __mcoldfire__ - subql #1,%d0 | decrement - jcc .Lbclloop | till done -#else - dbf %d0,.Lbclloop | till done -#endif - andl #3,%d1 | len %= 4 - jeq .Lbcdone - - subql #1,%d1 | set up for dbf -.Lbcbloop: - CMPMB((%a0)+,(%a1)+) | compare a byte - jne .Lbcnoteq | not equal, return non-zero -.Lbcbyte: -#ifdef __mcoldfire__ - subql #1,%d0 | decrement - jcc .Lbcbloop | till done -#else - dbf %d1,.Lbcbloop -#endif -.Lbcdone: -#ifdef __mcoldfire__ - movl (%sp)+,%d2 | restore temp -#endif - movql #0,%d0 - rts - -.Lbcnoteq: - movql #1,%d0 - rts -END(bcmp) diff --git a/common/lib/libc/arch/m68k/string/bcopy.S b/common/lib/libc/arch/m68k/string/bcopy.S deleted file mode 100644 index 2775ac4c9..000000000 --- a/common/lib/libc/arch/m68k/string/bcopy.S +++ /dev/null @@ -1,281 +0,0 @@ -/* $NetBSD: bcopy.S,v 1.6 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by J.T. Conklin. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)bcopy.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: bcopy.S,v 1.6 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - - -#ifdef MEMCOPY -#define XCOPY memcpy -#elif defined(MEMMOVE) -#define XCOPY memmove -#else -#define XCOPY bcopy -#endif - -ENTRY(XCOPY) -#if defined(MEMCOPY) || defined(MEMMOVE) - movl 4(%sp),%a1 | dest address - movl 8(%sp),%a0 | src address -#else - movl 4(%sp),%a0 | src address - movl 8(%sp),%a1 | dest address -#endif - movl 12(%sp),%d1 | count - - cmpl %a1,%a0 | src after dest? - jlt .Lbcback | yes, must copy backwards - - /* - * It isn't worth the overhead of aligning to {long}word boundries - * if the string is too short. - */ - cmpl #8,%d1 - jlt .Lbcfbyte - -#ifdef __mc68010__ - /* - * The 68010 cannot access a word or long on an odd boundary, - * period. If the source and the destination addresses aren't - * of the same evenness, we're forced to do a bytewise copy. - */ - movl %a0,%d0 - addl %a1,%d0 - btst #0,%d0 - jne .Lbcfbyte -#endif /* __mc68010__ */ - - /* word align */ - movl %a1,%d0 - btst #0,%d0 | if (dst & 1) - jeq .Lbcfalgndw | - movb (%a0)+,(%a1)+ | *(char *)dst++ = *(char *) src++ - subql #1,%d1 | len-- -.Lbcfalgndw: - /* long word align */ - btst #1,%d0 | if (dst & 2) - jeq .Lbcfalgndl - movw (%a0)+,(%a1)+ | *(short *)dst++ = *(short *) dst++ - subql #2,%d1 | len -= 2 -.Lbcfalgndl: - /* copy by 8 longwords */ - movel %d1,%d0 - lsrl #5,%d0 | cnt = len / 32 - jeq .Lbcflong | if (cnt) - andl #31,%d1 | len %= 32 - subql #1,%d0 | set up for dbf -.Lbcf32loop: - movl (%a0)+,(%a1)+ | copy 8 long words - movl (%a0)+,(%a1)+ - movl (%a0)+,(%a1)+ - movl (%a0)+,(%a1)+ - movl (%a0)+,(%a1)+ - movl (%a0)+,(%a1)+ - movl (%a0)+,(%a1)+ - movl (%a0)+,(%a1)+ -#ifndef __mcoldfire__ - dbf %d0,.Lbcf32loop | till done - clrw %d0 -#endif - subql #1,%d0 - jcc .Lbcf32loop - -.Lbcflong: - /* copy by longwords */ - movel %d1,%d0 - lsrl #2,%d0 | cnt = len / 4 - jeq .Lbcfbyte | if (cnt) - subql #1,%d0 | set up for dbf -.Lbcflloop: - movl (%a0)+,(%a1)+ | copy longwords -#ifdef __mcoldfire__ - subql #1,%d0 | decrement - jcc .Lbcflloop | til done -#else - dbf %d0,.Lbcflloop | til done -#endif - andl #3,%d1 | len %= 4 - jeq .Lbcdone - - subql #1,%d1 | set up for dbf -.Lbcfbloop: - movb (%a0)+,(%a1)+ | copy bytes -.Lbcfbyte: -#ifdef __mcoldfire__ - subql #1,%d0 | decrement - jcc .Lbcfbloop | til done -#else - dbf %d1,.Lbcfbloop | till done -#endif -.Lbcdone: -#if defined(MEMCOPY) || defined(MEMMOVE) - movl 4(%sp),%d0 | dest address -#if defined(__SVR4_ABI__) - moveal %d0,%a0 -#endif -#endif - rts - - -.Lbcback: - addl %d1,%a0 | src pointer to end - addl %d1,%a1 | dest pointer to end - - /* - * It isn't worth the overhead of aligning to {long}word boundries - * if the string is too short. - */ - cmpl #8,%d1 - jlt .Lbcbbyte - -#ifdef __mc68010__ - /* - * The 68010 cannot access a word or long on an odd boundary, - * period. If the source and the destination addresses aren't - * of the same evenness, we're forced to do a bytewise copy. - */ - movl %a0,%d0 - addl %a1,%d0 - btst #0,%d0 - jne .Lbcbbyte -#endif /* __mc68010__ */ - - /* word align */ - movl %a1,%d0 - btst #0,%d0 | if (dst & 1) - jeq .Lbcbalgndw | - movb -(%a0),-(%a1) | *(char *)dst-- = *(char *) src-- - subql #1,%d1 | len-- -.Lbcbalgndw: - /* long word align */ - btst #1,%d0 | if (dst & 2) - jeq .Lbcbalgndl - movw -(%a0),-(%a1) | *(short *)dst-- = *(short *) dst-- - subql #2,%d1 | len -= 2 -.Lbcbalgndl: - /* copy by 8 longwords */ - movel %d1,%d0 - lsrl #5,%d0 | cnt = len / 32 - jeq .Lbcblong | if (cnt) - andl #31,%d1 | len %= 32 - subql #1,%d0 | set up for dbf -.Lbcb32loop: - movl -(%a0),-(%a1) | copy 8 long words - movl -(%a0),-(%a1) - movl -(%a0),-(%a1) - movl -(%a0),-(%a1) - movl -(%a0),-(%a1) - movl -(%a0),-(%a1) - movl -(%a0),-(%a1) - movl -(%a0),-(%a1) -#ifndef __mcoldfire__ - dbf %d0,.Lbcb32loop | till done - clrw %d0 -#endif - subql #1,%d0 - jcc .Lbcb32loop - -.Lbcblong: - /* copy by longwords */ - movel %d1,%d0 - lsrl #2,%d0 | cnt = len / 4 - jeq .Lbcbbyte | if (cnt) - subql #1,%d0 | set up for dbf -.Lbcblloop: - movl -(%a0),-(%a1) | copy longwords -#ifdef __mcoldfire__ - subql #1,%d0 | decrement - jcc .Lbcblloop | til done -#else - dbf %d0,.Lbcblloop | til done -#endif - andl #3,%d1 | len %= 4 - jeq .Lbcdone - - subql #1,%d1 | set up for dbf -.Lbcbbloop: - movb -(%a0),-(%a1) | copy bytes -.Lbcbbyte: -#ifdef __mcoldfire__ - subql #1,%d0 | decrement - jcc .Lbcbbloop | til done -#else - dbf %d1,.Lbcbbloop | till done -#endif - -#if defined(MEMCOPY) || defined(MEMMOVE) - movl 4(%sp),%d0 | dest address -#if defined(__SVR4_ABI__) - moveal %d0,%a0 -#endif -#endif - rts -END(XCOPY) diff --git a/common/lib/libc/arch/m68k/string/bzero.S b/common/lib/libc/arch/m68k/string/bzero.S deleted file mode 100644 index 0228eabf3..000000000 --- a/common/lib/libc/arch/m68k/string/bzero.S +++ /dev/null @@ -1,154 +0,0 @@ -/* $NetBSD: bzero.S,v 1.6 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by J.T. Conklin. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)bzero.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: bzero.S,v 1.6 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(bzero) - movl %d2,-(%sp) - movl 8(%sp),%a0 | destination - movl 12(%sp),%d1 | count - - clrl %d2 - - /* - * It isn't worth the overhead of aligning to {long}word boundries - * if the string is too short. - */ - cmpl #8,%d1 - jlt .Lbzbyte - - /* word align */ - movl %a0,%d0 - btst #0,%d0 | if (dst & 1) - jeq .Lbzalgndw | - movb %d2,(%a0)+ | *(char *)dst++ = 0 - subql #1,%d1 | len-- -.Lbzalgndw: - /* long word align */ - btst #1,%d0 | if (dst & 2) - jeq .Lbzalgndl | - movw %d2,(%a0)+ | *(short *)dst++ = 0 - subql #2,%d1 | len -= 2 -.Lbzalgndl: - /* zero by 8 longwords */ - movel %d1,%d0 - lsrl #5,%d0 | cnt = len / 32 - jeq .Lbzlong | if (cnt) - andl #31,%d1 | len %= 32 - subql #1,%d0 | set up for dbf -.Lbz32loop: - movl %d2,(%a0)+ | zero 8 long words - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ -#ifndef __mcoldfire__ - dbf %d0,.Lbz32loop | till done - clrw %d0 -#endif - subql #1,%d0 - jcc .Lbz32loop - -.Lbzlong: - /* copy by longwords */ - movel %d1,%d0 - lsrl #2,%d0 | cnt = len / 4 - jeq .Lbzbyte | if (cnt) - subql #1,%d0 | set up for dbf -.Lbzlloop: - movl %d2,(%a0)+ | clear longwords -#ifdef __mcoldfire__ - subql #1,%d0 | decrement - jcc .Lbzlloop | till done -#else - dbf %d0,.Lbzlloop | till done -#endif - andl #3,%d1 | len %= 4 - jeq .Lbzdone - - subql #1,%d1 | set up for dbf -.Lbzbloop: - movb %d2,(%a0)+ | zero bytes -.Lbzbyte: -#ifdef __mcoldfire__ - subql #1,%d0 | decrement - jcc .Lbzbloop | till done -#else - dbf %d1,.Lbzbloop | till done -#endif -.Lbzdone: - movl (%sp)+,%d2 - rts -END(bzero) diff --git a/common/lib/libc/arch/m68k/string/ffs.S b/common/lib/libc/arch/m68k/string/ffs.S deleted file mode 100644 index 2fc4347b2..000000000 --- a/common/lib/libc/arch/m68k/string/ffs.S +++ /dev/null @@ -1,95 +0,0 @@ -/* $NetBSD: ffs.S,v 1.6 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)ffs.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: ffs.S,v 1.6 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* bit = ffs(value) */ - -WEAK_ALIAS(__ffssi2,ffs) - -#if (!defined(__mc68010__) && !defined(__mcoldfire__)) || defined(__mcfisac__) - -ENTRY(ffs) - movl 4(%sp),%d0 - movl %d0,%d1 - negl %d0 - andl %d0,%d1 - movql #32,%d0 -#if defined(__mcfisac__) - ff1.l %d1 | count leading zeros -#else - bfffo %d1{#0:#32},%d1 -#endif - subl %d1,%d0 - rts -END(ffs) - -#elif defined(__mcoldfire__) - -ENTRY(ffs) - clrl %d0 - movl 4(%sp),%d1 - jeq .L2 | return 0 if 0 -.L1: - addql #1,%d0 - lsrl #1,%d1 | shift low bit into carry - jcc .L1 | keep looping while carry is clear. -.L2: - rts - -#else /* __mc68010__ */ - -ENTRY(ffs) - movl 4(%sp),%d0 - jeq .L2 - movql #31,%d1 -.L1: - lsrl #1,%d0 - dbcs %d1,.L1 - movql #32,%d0 - subl %d1,%d0 -.L2: - rts -END(ffs) - -#endif /* __mc68010__ */ diff --git a/common/lib/libc/arch/m68k/string/memcmp.S b/common/lib/libc/arch/m68k/string/memcmp.S deleted file mode 100644 index f6d17b1c7..000000000 --- a/common/lib/libc/arch/m68k/string/memcmp.S +++ /dev/null @@ -1,117 +0,0 @@ -/* $NetBSD: memcmp.S,v 1.5 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)bcmp.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: memcmp.S,v 1.5 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* memcmp(s1, s2, n) */ - -#ifdef __mcoldfire__ -#define CMPMB(a,b) movb b,%d2; cmpb a,%d2 -#define CMPMW(a,b) movw b,%d2; cmpw a,%d2 -#define CMPML(a,b) movl b,%d2; cmpl a,%d2 -#else -#define CMPMB(a,b) cmpmb a,b -#define CMPMW(a,b) cmpmw a,b -#define CMPML(a,b) cmpml a,b -#endif - -/* - * This is probably not the best we can do, but it is still 2-10 times - * faster than the C version in the portable gen directory. - * - * Things that might help: - * - longword align when possible (only on the 68020) - * - use nested DBcc instructions or use one and limit size to 64K - */ -ENTRY(memcmp) - movl 4(%sp),%a0 | string 1 - movl 8(%sp),%a1 | string 2 - movl 12(%sp),%d0 | length -#ifdef __mcoldfire__ - movl %d2,-(%sp) | save temp -#endif - jeq .Lbcdone | if zero, nothing to do - movl %a0,%d1 - btst #0,%d1 | string 1 address odd? - jeq .Lbceven | no, skip alignment - CMPMB((%a0)+,(%a1)+) | yes, compare a byte - jne .Lbcnoteq | not equal, return non-zero - subql #1,%d0 | adjust count - jeq .Lbcdone | count 0, reutrn zero -.Lbceven: - movl %a1,%d1 - btst #0,%d1 | string 2 address odd? - jne .Lbcbloop | yes, no hope for alignment, compare bytes - movl %d0,%d1 | no, both even - lsrl #2,%d1 | convert count to longword count - jeq .Lbcbloop | count 0, skip longword loop -.Lbclloop: - CMPML((%a0)+,(%a1)+) | compare a longword - jne .Lbcnoteql | not equal, return non-zero - subql #1,%d1 | adjust count - jne .Lbclloop | still more, keep comparing - andl #3,%d0 | what remains - jeq .Lbcdone | nothing, all done -.Lbcbloop: - CMPMB((%a0)+,(%a1)+) | compare a byte - jne .Lbcnoteq | not equal, return non-zero - subql #1,%d0 | adjust count - jne .Lbcbloop | still more, keep going - rts -.Lbcnoteql: - subql #4,%a0 - subql #4,%a1 - movl #4,%d0 - jra .Lbcbloop -.Lbcnoteq: - clrl %d0 - clrl %d1 - movb -(%a0),%d0 - movb -(%a1),%d1 - subl %d1,%d0 -.Lbcdone: -#ifdef __mcoldfire__ - movl (%sp)+,%sp | restore temp -#endif - rts -END(memcmp) diff --git a/common/lib/libc/arch/m68k/string/memcpy.S b/common/lib/libc/arch/m68k/string/memcpy.S deleted file mode 100644 index 11245b492..000000000 --- a/common/lib/libc/arch/m68k/string/memcpy.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ - -#define MEMCOPY -#include "bcopy.S" diff --git a/common/lib/libc/arch/m68k/string/memmove.S b/common/lib/libc/arch/m68k/string/memmove.S deleted file mode 100644 index d9d518633..000000000 --- a/common/lib/libc/arch/m68k/string/memmove.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2005/12/20 19:28:49 christos Exp $ */ - -#define MEMMOVE -#include "bcopy.S" diff --git a/common/lib/libc/arch/m68k/string/memset.S b/common/lib/libc/arch/m68k/string/memset.S deleted file mode 100644 index d8dbecab1..000000000 --- a/common/lib/libc/arch/m68k/string/memset.S +++ /dev/null @@ -1,174 +0,0 @@ -/* $NetBSD: memset.S,v 1.7 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by J.T. Conklin. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)bzero.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: memset.S,v 1.7 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(memset) - movl %d2,-(%sp) - movl 8(%sp),%a0 | destination - movl 16(%sp),%d1 | count - movb 15(%sp),%d2 | get fill character - - /* - * It isn't worth the overhead of aligning to {long}word boundries - * if the string is too short. - */ - cmpl #15,%d1 - jlt .Lbzbyte - - clrl %d0 - moveb %d2,%d0 - movel %d0,%d2 - lsll #8,%d0 - orl %d0,%d2 - lsll #8,%d0 - orl %d0,%d2 - lsll #8,%d0 - orl %d0,%d2 - - /* word align */ - movl %a0,%d0 - btst #0,%d0 | if (dst & 1) - jeq .Lbzalgndw | - movb %d2,(%a0)+ | *(char *)dst++ = X - subql #1,%d1 | len-- - addql #1,%d0 -.Lbzalgndw: -#ifndef __mc68010__ - /* long word align */ - btst #1,%d0 | if (dst & 2) - jeq .Lbzalgndl | - movw %d2,(%a0)+ | *(short *)dst++ = X - subql #2,%d1 | len -= 2 -.Lbzalgndl: - /* set by 8 longwords */ - movel %d1,%d0 - lsrl #5,%d0 | cnt = len / 32 - jeq .Lbzlong | if (cnt) - andl #31,%d1 | len %= 32 - subql #1,%d0 | set up for dbf -.Lbz32loop: - movl %d2,(%a0)+ | set 8 long words - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ - movl %d2,(%a0)+ -#ifndef __mcoldfire__ - dbf %d0,.Lbz32loop | till done - clrw %d0 -#endif - subql #1,%d0 - jcc .Lbz32loop -#endif /* !__mc68010__ */ - -.Lbzlong: - /* set by longwords */ - movel %d1,%d0 - lsrl #2,%d0 | cnt = len / 4 - jeq .Lbzbyte | if (cnt) - subql #1,%d0 | set up for dbf -.Lbzlloop: - movl %d2,(%a0)+ | clear longwords -#ifndef __mcoldfire__ - dbf %d0,.Lbzlloop | till done -#endif -#ifdef __mc68010__ - clrw %d0 -#endif /* __mc68010__ */ -#if defined(__m68010) || defined(__mcoldfire__) - subql #1,%d0 - jcc .Lbzlloop -#endif /* __mc68010__ || __mcoldfire__ */ - andl #3,%d1 | len %= 4 - jeq .Lbzdone - - subql #1,%d1 | set up for dbf -.Lbzbloop: - movb %d2,(%a0)+ | set bytes -.Lbzbyte: -#ifdef __mcoldfire__ - subql #1,%d1 | decrement - jcc .Lbzbloop | till done -#else - dbf %d1,.Lbzbloop | till done -#endif -.Lbzdone: - movl 8(%sp),%d0 | return destination -#ifdef __SVR4_ABI__ - moveal %d0,%a0 -#endif - movl (%sp)+,%d2 - rts -END(memset) diff --git a/common/lib/libc/arch/m68k/string/strcat.S b/common/lib/libc/arch/m68k/string/strcat.S deleted file mode 100644 index 53678c7d9..000000000 --- a/common/lib/libc/arch/m68k/string/strcat.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: strcat.S,v 1.4 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)strcpy.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: strcat.S,v 1.4 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(strcat) - movl 8(%sp),%a0 | a0 = fromaddr - movl 4(%sp),%d0 | return value is toaddr - movl %d0,%a1 | a1 = toaddr -.Lslloop: - tstb (%a1)+ | null? - jne .Lslloop | no, keep going - subql #1,%a1 -.Lscloop: - movb (%a0)+,(%a1)+ | copy a byte - jne .Lscloop | copied non-null, keep going -#ifdef __SVR4_ABI__ - moveal %d0,%a0 -#endif - rts -END(strcat) diff --git a/common/lib/libc/arch/m68k/string/strchr.S b/common/lib/libc/arch/m68k/string/strchr.S deleted file mode 100644 index b27ead865..000000000 --- a/common/lib/libc/arch/m68k/string/strchr.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: strchr.S,v 1.4 2013/07/16 23:24:19 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)index.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: strchr.S,v 1.4 2013/07/16 23:24:19 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(strchr) - movl 4(%sp),%a0 | string - movb 11(%sp),%d0 | char to look for -ixloop: - cmpb (%a0),%d0 | found our char? - jeq ixfound | yes, break out - tstb (%a0)+ | null? - jne ixloop | no, keep going - moveq #0,%d0 | not found, return null -#ifdef __SVR4_ABI__ - moveal %d0,%a0 -#endif - rts -ixfound: - movl %a0,%d0 | found, return pointer - rts -END(strchr) - -STRONG_ALIAS(index,strchr) diff --git a/common/lib/libc/arch/m68k/string/strcmp.S b/common/lib/libc/arch/m68k/string/strcmp.S deleted file mode 100644 index 8f438abc8..000000000 --- a/common/lib/libc/arch/m68k/string/strcmp.S +++ /dev/null @@ -1,85 +0,0 @@ -/* $NetBSD: strcmp.S,v 1.7 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Hiroshi Horimoto and - * by J.T. Conklin . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: strcmp.S,v 1.7 2013/09/07 19:06:29 chs Exp $") -#endif /* LIBC_SCCS and not lint */ - -#ifdef __mcoldfire__ -#define GETC(a,b) mvsb a,b -#define SUBC(a,b) mvsb a,%d0; subl %d0,b -#else -#define GETC(a,b) movb a,b -#define SUBC(a,b) subb a,b -#endif - -ENTRY(strcmp) - movl 4(%sp),%a0 - movl 8(%sp),%a1 -.L1: /* unrolled by 4 for 680[23]0's */ - GETC((%a0)+,%d1) - jeq .L2 - SUBC((%a1)+,%d1) - jne .L3 - - GETC((%a0)+,%d1) - jeq .L2 - SUBC((%a1)+,%d1) - jne .L3 - - GETC((%a0)+,%d1) - jeq .L2 - SUBC((%a1)+,%d1) - jne .L3 - - GETC((%a0)+,%d1) - jeq .L2 - SUBC((%a1)+,%d1) - jeq .L1 - -.L3: -#ifdef __mcoldfire__ - movl %d1,%d0 -#else - scs %d0 - EXTBL(%d0) - movb %d1,%d0 -#endif - rts - -.L2: movq #0,%d0 - movb (%a1),%d0 - negl %d0 - rts -END(strcmp) diff --git a/common/lib/libc/arch/m68k/string/strcpy.S b/common/lib/libc/arch/m68k/string/strcpy.S deleted file mode 100644 index 572e18833..000000000 --- a/common/lib/libc/arch/m68k/string/strcpy.S +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: strcpy.S,v 1.4 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)strcpy.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: strcpy.S,v 1.4 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(strcpy) - movl 8(%sp),%a0 | a0 = fromaddr - movl 4(%sp),%d0 | return value is toaddr - movl %d0,%a1 | a1 = toaddr -.Lscloop: - movb (%a0)+,(%a1)+ | copy a byte - jne .Lscloop | copied non-null, keep going -#ifdef __SVR4_ABI__ - moveal %d0,%a0 -#endif - rts -END(strcpy) diff --git a/common/lib/libc/arch/m68k/string/strlen.S b/common/lib/libc/arch/m68k/string/strlen.S deleted file mode 100644 index b6b9c8ef3..000000000 --- a/common/lib/libc/arch/m68k/string/strlen.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: strlen.S,v 1.4 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)strlen.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: strlen.S,v 1.4 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(strlen) - movl 4(%sp),%a0 | string - movl %a0,%d0 - notl %d0 -.Lslloop: - tstb (%a0)+ | null? - jne .Lslloop | no, keep going - addl %a0,%d0 - rts -END(strlen) diff --git a/common/lib/libc/arch/m68k/string/strncmp.S b/common/lib/libc/arch/m68k/string/strncmp.S deleted file mode 100644 index 9faad4522..000000000 --- a/common/lib/libc/arch/m68k/string/strncmp.S +++ /dev/null @@ -1,100 +0,0 @@ -/* $NetBSD: strncmp.S,v 1.7 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Hiroshi Horimoto and - * by J.T. Conklin . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: strncmp.S,v 1.7 2013/09/07 19:06:29 chs Exp $") -#endif /* LIBC_SCCS and not lint */ - - -#ifdef __mcoldfire__ -#define GETC(a,b) mvsb a,b -#define SUBC(a,b) mvsb a,%d2; subl %d2,b -#else -#define GETC(a,b) movb a,b -#define SUBC(a,b) subb a,b -#endif - -ENTRY(strncmp) - movl 12(%sp),%d0 - jeq .L4 - movl 4(%sp),%a0 - movl 8(%sp),%a1 -#ifdef __coldfire__ - movl %d2,-(%sp) | save temp -#endif -.L1: /* unroll by 4 for m680[23]0's */ - GETC((%a0)+,%d1) - jeq .L2 - SUBC((%a1)+,%d1) - jne .L3 - subql #1,%d0 - jeq .L4 - - GETC((%a0)+,%d1) - jeq .L2 - SUBC((%a1)+,%d1) - jne .L3 - subql #1,%d0 - jeq .L4 - - GETC((%a0)+,%d1) - jeq .L2 - SUBC((%a1)+,%d1) - jne .L3 - subql #1,%d0 - jeq .L4 - - GETC((%a0)+,%d1) - jeq .L2 - SUBC((%a1)+,%d1) - jne .L3 - subql #1,%d0 - jne .L1 -#ifdef __mcoldfire__ - movl (%sp)+,%d2 | restore temp -#endif -.L4: rts - -.L2: SUBC((%a1),%d1) -.L3: -#ifdef __mcoldfire__ - movl (%sp)+,%d2 | restore temp - movl %d1,%d0 -#else - scs %d0 - EXTBL(%d0) - moveb %d1,%d0 -#endif - rts -END(strncmp) diff --git a/common/lib/libc/arch/m68k/string/strncpy.S b/common/lib/libc/arch/m68k/string/strncpy.S deleted file mode 100644 index eac819f87..000000000 --- a/common/lib/libc/arch/m68k/string/strncpy.S +++ /dev/null @@ -1,80 +0,0 @@ -/* $NetBSD: strncpy.S,v 1.5 2013/09/07 19:06:29 chs Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)strncpy.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: strncpy.S,v 1.5 2013/09/07 19:06:29 chs Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(strncpy) - movl 4(%sp),%d0 | return value is toaddr - movl 12(%sp),%d1 | count - jeq .Lscdone | nothing to do - movl 8(%sp),%a0 | a0 = fromaddr - movl %d0,%a1 | a1 = toaddr - subql #1,%d1 -.Lscloop: - movb (%a0)+,(%a1)+ | copy a byte -#ifndef __mcoldfire__ - dbeq %d1,.Lscloop | loop through low word of d1 -#endif - jeq .Lscpadding | copied null, padding if necessary -#ifndef __mcoldfire__ - clrw %d1 | clear low word of d1 -#endif - subql #1,%d1 | adjust count for long copies - jcc .Lscloop | more room, keep going -.Lscdone: -#ifdef __SVR4_ABI__ - moveal %d0,%a0 -#endif - rts - -.Lscploop: - clrb (%a1)+ | clear a byte -#ifndef __mcoldfire__ - dbra %d1,.Lscploop | keep going - clrw %d1 -#endif -.Lscpadding: - subql #1,%d1 - jcc .Lscploop - jra .Lscdone -END(strncpy) diff --git a/common/lib/libc/arch/m68k/string/strrchr.S b/common/lib/libc/arch/m68k/string/strrchr.S deleted file mode 100644 index 7db5c2538..000000000 --- a/common/lib/libc/arch/m68k/string/strrchr.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: strrchr.S,v 1.4 2013/07/16 23:24:19 matt Exp $ */ - -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * the Systems Programming Group of the University of Utah Computer - * Science Department. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)rindex.s 5.1 (Berkeley) 5/12/90") -#else - RCSID("$NetBSD: strrchr.S,v 1.4 2013/07/16 23:24:19 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(strrchr) - movl 4(%sp),%a1 | string - movb 11(%sp),%d0 | char to look for - subl %a0,%a0 | clear rindex pointer -rixloop: - cmpb (%a1),%d0 | found our char? - jne rixnope | no, check for null - movl %a1,%a0 | yes, remember location -rixnope: - tstb (%a1)+ | null? - jne rixloop | no, keep going - movl %a0,%d0 | return value - rts -END(strrchr) - -STRONG_ALIAS(rindex,strrchr) diff --git a/common/lib/libc/arch/mips/atomic/Makefile.inc b/common/lib/libc/arch/mips/atomic/Makefile.inc deleted file mode 100644 index 30996033e..000000000 --- a/common/lib/libc/arch/mips/atomic/Makefile.inc +++ /dev/null @@ -1,59 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.13 2014/10/13 13:00:55 martin Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -.if ${MACHINE_ARCH:Mmips64*} == "" -SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c \ - atomic_and_32_cas.c atomic_and_32_nv_cas.c \ - atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ - atomic_inc_32_cas.c atomic_inc_32_nv_cas.c \ - atomic_or_32_cas.c atomic_or_32_nv_cas.c \ - atomic_swap_32_cas.c \ - atomic_add_64_cas.c atomic_add_64_nv_cas.c \ - atomic_and_64_cas.c atomic_and_64_nv_cas.c \ - atomic_dec_64_cas.c atomic_dec_64_nv_cas.c \ - atomic_inc_64_cas.c atomic_inc_64_nv_cas.c \ - atomic_or_64_cas.c atomic_or_64_nv_cas.c \ - atomic_swap_64_cas.c - -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP - -.else -SRCS+= atomic_add.S atomic_dec.S atomic_inc.S -SRCS+= atomic_and.S atomic_or.S -SRCS+= atomic_swap.S -.endif - -SRCS+= membar_ops.S -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -.if ${MACHINE_ARCH:Mmips64*} == "" -SRCS+= atomic_init_testset.c atomic_cas_up.S -.else -SRCS+= atomic_cas.S atomic_init_cas.c atomic_cas_by_cas32.c -.endif - -.endif - -.if defined(LIB) && ${LIB} == "c" -SRCS+= atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c \ - atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c \ - atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c \ - atomic_or_16_cas.c atomic_or_8_cas.c \ - atomic_and_16_cas.c atomic_and_8_cas.c \ - atomic_add_16_cas.c atomic_add_8_cas.c \ - atomic_swap_16_cas.c atomic_swap_8_cas.c \ - atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \ - atomic_c11_compare_exchange_cas_32.c \ - atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_8.c -.endif - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "rump") - -SRCS+= membar_ops.S - -.endif diff --git a/common/lib/libc/arch/mips/atomic/atomic_add.S b/common/lib/libc/arch/mips/atomic/atomic_add.S deleted file mode 100644 index 886b6d54c..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_add.S +++ /dev/null @@ -1,127 +0,0 @@ -/* $NetBSD: atomic_add.S,v 1.5 2015/06/01 23:16:54 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - -RCSID("$NetBSD: atomic_add.S,v 1.5 2015/06/01 23:16:54 matt Exp $") - - .text - .set noreorder -#ifdef _KERNEL_OPT -#include "opt_cputype.h" -#ifndef MIPS3_LOONGSON2F - .set noat - .set nomacro -#endif -#else /* _KERNEL_OPT */ - .set noat - .set nomacro -#endif /* _KERNEL_OPT */ - - -LEAF(_atomic_add_32) -#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2) - saa a1, (a0) -#else -1: INT_LL t0, 0(a0) - nop - INT_ADDU t0, a1 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop -#endif - j ra - nop -END(_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_32, _atomic_add_32) - -LEAF(_atomic_add_32_nv) -1: INT_LL v0, 0(a0) - nop - INT_ADDU v0, a1 - move t0, v0 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_32_nv, _atomic_add_32_nv) - -#if !defined(__mips_o32) -LEAF(_atomic_add_64) -#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2) - saad a1, (a0) -#else -1: REG_LL t0, 0(a0) - nop - REG_ADDU t0, a1 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop -#endif - j ra - nop -END(_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_64, _atomic_add_64) - -LEAF(_atomic_add_64_nv) -1: REG_LL v0, 0(a0) - nop - REG_ADDU v0, a1 - move t0, v0 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_64_nv, _atomic_add_64_nv) -#endif - -#ifdef _LP64 -STRONG_ALIAS(_atomic_add_long, _atomic_add_64) -STRONG_ALIAS(_atomic_add_long_nv, _atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_ptr, _atomic_add_64) -STRONG_ALIAS(_atomic_add_ptr_nv, _atomic_add_64_nv) -#else -STRONG_ALIAS(_atomic_add_long, _atomic_add_32) -STRONG_ALIAS(_atomic_add_long_nv, _atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_ptr, _atomic_add_32) -STRONG_ALIAS(_atomic_add_ptr_nv, _atomic_add_32_nv) -#endif -STRONG_ALIAS(_atomic_add_int, _atomic_add_32) -STRONG_ALIAS(_atomic_add_int_nv, _atomic_add_32_nv) - -ATOMIC_OP_ALIAS(atomic_add_int, _atomic_add_int) -ATOMIC_OP_ALIAS(atomic_add_int_nv, _atomic_add_int_nv) -ATOMIC_OP_ALIAS(atomic_add_ptr, _atomic_add_ptr) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv, _atomic_add_ptr_nv) -ATOMIC_OP_ALIAS(atomic_add_long, _atomic_add_long) -ATOMIC_OP_ALIAS(atomic_add_long_nv, _atomic_add_long_nv) diff --git a/common/lib/libc/arch/mips/atomic/atomic_and.S b/common/lib/libc/arch/mips/atomic/atomic_and.S deleted file mode 100644 index cb1eb4848..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_and.S +++ /dev/null @@ -1,113 +0,0 @@ -/* $NetBSD: atomic_and.S,v 1.4 2012/03/14 16:50:34 christos Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - -RCSID("$NetBSD: atomic_and.S,v 1.4 2012/03/14 16:50:34 christos Exp $") - - .text - .set noreorder -#ifdef _KERNEL_OPT -#include "opt_cputype.h" -#ifndef MIPS3_LOONGSON2F - .set noat - .set nomacro -#endif -#else /* _KERNEL_OPT */ - .set noat - .set nomacro -#endif /* _KERNEL_OPT */ - - -LEAF(_atomic_and_32) -1: INT_LL t0, 0(a0) - nop - and t0, a1 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_32, _atomic_and_32) - -LEAF(_atomic_and_32_nv) -1: INT_LL v0, 0(a0) - nop - and v0, a1 - move t0, v0 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_32_nv, _atomic_and_32_nv) - -#if !defined(__mips_o32) -LEAF(_atomic_and_64) -1: REG_LL t0, 0(a0) - nop - and t0, a1 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_and_64) -ATOMIC_OP_ALIAS(atomic_and_64, _atomic_and_64) - -LEAF(_atomic_and_64_nv) -1: REG_LL v0, 0(a0) - nop - and v0, a1 - move t0, v0 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_and_64_nv) -ATOMIC_OP_ALIAS(atomic_and_64_nv, _atomic_and_64_nv) -#endif - -#ifdef _LP64 -STRONG_ALIAS(_atomic_and_ulong, _atomic_and_64) -STRONG_ALIAS(_atomic_and_ulong_nv, _atomic_and_64_nv) -#else -STRONG_ALIAS(_atomic_and_ulong, _atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong_nv, _atomic_and_32_nv) -#endif -STRONG_ALIAS(_atomic_and_uint, _atomic_and_32) -STRONG_ALIAS(_atomic_and_uint_nv, _atomic_and_32_nv) - -ATOMIC_OP_ALIAS(atomic_and_uint, _atomic_and_uint) -ATOMIC_OP_ALIAS(atomic_and_uint_nv, _atomic_and_uint_nv) -ATOMIC_OP_ALIAS(atomic_and_ulong, _atomic_and_ulong) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv, _atomic_and_ulong_nv) diff --git a/common/lib/libc/arch/mips/atomic/atomic_cas.S b/common/lib/libc/arch/mips/atomic/atomic_cas.S deleted file mode 100644 index b921c9772..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_cas.S +++ /dev/null @@ -1,98 +0,0 @@ -/* $NetBSD: atomic_cas.S,v 1.4 2015/06/01 23:16:54 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - -RCSID("$NetBSD: atomic_cas.S,v 1.4 2015/06/01 23:16:54 matt Exp $") - - .text - .set noat - .set noreorder - .set nomacro - -LEAF(_atomic_cas_32) -1: INT_LL v0, 0(a0) - nop - bne v0, a1, 2f - nop - move t0, a2 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop - move v0, a1 -#ifdef _MIPS_ARCH_OCTEONP - syncw -#endif -2: - j ra - nop -END(_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_32, _atomic_cas_32) - -#if !defined(__mips_o32) -LEAF(_atomic_cas_64) -1: REG_LL v0, 0(a0) - nop - bne v0, a1, 2f - nop - move t0, a2 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop - move v0, a1 -#ifdef _MIPS_ARCH_OCTEONP - syncw -#endif -2: - j ra - nop -END(_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_64, _atomic_cas_64) -#endif - -#ifdef _LP64 -STRONG_ALIAS(_atomic_cas_ptr, _atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr_ni, _atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong, _atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong_ni, _atomic_cas_64) -#else -STRONG_ALIAS(_atomic_cas_ptr, _atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr_ni, _atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong, _atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong_ni, _atomic_cas_32) -#endif -STRONG_ALIAS(_atomic_cas_uint, _atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni, _atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_ptr, _atomic_cas_ptr) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni, _atomic_cas_ptr_ni) -ATOMIC_OP_ALIAS(atomic_cas_uint, _atomic_cas_uint) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni, _atomic_cas_uint_ni) -ATOMIC_OP_ALIAS(atomic_cas_ulong, _atomic_cas_ulong) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni, _atomic_cas_ulong_ni) diff --git a/common/lib/libc/arch/mips/atomic/atomic_cas_up.S b/common/lib/libc/arch/mips/atomic/atomic_cas_up.S deleted file mode 100644 index 6f3040d81..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_cas_up.S +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: atomic_cas_up.S,v 1.2 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - - .text - .set noat - .set noreorder - -LEAF(_atomic_cas_up) - .hidden _C_LABEL(_atomic_cas_up) -RAS_START_ASM_HIDDEN(_atomic_cas) - lw t0, (a0) - nop - bne t0, a1, 1f - nop - sw a2, (a0) -RAS_END_ASM_HIDDEN(_atomic_cas) - j ra - addu v0, zero, a1 -1: - j ra - addu v0, zero, t0 -END(_atomic_cas_up) diff --git a/common/lib/libc/arch/mips/atomic/atomic_dec.S b/common/lib/libc/arch/mips/atomic/atomic_dec.S deleted file mode 100644 index 641ad9b3c..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_dec.S +++ /dev/null @@ -1,128 +0,0 @@ -/* $NetBSD: atomic_dec.S,v 1.5 2015/06/01 23:16:54 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - -RCSID("$NetBSD: atomic_dec.S,v 1.5 2015/06/01 23:16:54 matt Exp $") - - .text - .set noreorder -#ifdef _KERNEL_OPT -#include "opt_cputype.h" -#ifndef MIPS3_LOONGSON2F - .set noat - .set nomacro -#endif -#else /* _KERNEL_OPT */ - .set noat - .set nomacro -#endif /* _KERNEL_OPT */ - -LEAF(_atomic_dec_32) -#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2) - li t0, -1 - saa t0, (a0) -#else -1: INT_LL t0, 0(a0) - nop - INT_ADDU t0, -1 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop -#endif - j ra - nop -END(_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_32, _atomic_dec_32) - -LEAF(_atomic_dec_32_nv) -1: INT_LL v0, 0(a0) - nop - INT_ADDU v0, -1 - move t0, v0 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_32_nv, _atomic_dec_32_nv) - -#if !defined(__mips_o32) -LEAF(_atomic_dec_64) -#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2) - li t0, -1 - saad t0, (a0) -#else -1: REG_LL t0, 0(a0) - nop - REG_ADDU t0, -1 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop -#endif - j ra - nop -END(_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_64, _atomic_dec_64) - -LEAF(_atomic_dec_64_nv) -1: REG_LL v0, 0(a0) - nop - REG_ADDU v0, -1 - move t0, v0 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_64_nv, _atomic_dec_64_nv) -#endif - -#ifdef _LP64 -STRONG_ALIAS(_atomic_dec_ptr, _atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ptr_nv, _atomic_dec_64_nv) -STRONG_ALIAS(_atomic_dec_ulong, _atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ulong_nv, _atomic_dec_64_nv) -#else -STRONG_ALIAS(_atomic_dec_ptr, _atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ptr_nv, _atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ulong, _atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong_nv, _atomic_dec_32_nv) -#endif -STRONG_ALIAS(_atomic_dec_uint, _atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint_nv, _atomic_dec_32_nv) - -ATOMIC_OP_ALIAS(atomic_dec_ptr, _atomic_dec_ptr) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv, _atomic_dec_ptr_nv) -ATOMIC_OP_ALIAS(atomic_dec_uint, _atomic_dec_uint) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv, _atomic_dec_uint_nv) -ATOMIC_OP_ALIAS(atomic_dec_ulong, _atomic_dec_ulong) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv, _atomic_dec_ulong_nv) diff --git a/common/lib/libc/arch/mips/atomic/atomic_inc.S b/common/lib/libc/arch/mips/atomic/atomic_inc.S deleted file mode 100644 index 40fadb8c4..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_inc.S +++ /dev/null @@ -1,129 +0,0 @@ -/* $NetBSD: atomic_inc.S,v 1.5 2015/06/01 23:16:54 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - -RCSID("$NetBSD: atomic_inc.S,v 1.5 2015/06/01 23:16:54 matt Exp $") - - .text - .set noreorder -#ifdef _KERNEL_OPT -#include "opt_cputype.h" -#ifndef MIPS3_LOONGSON2F - .set noat - .set nomacro -#endif -#else /* _KERNEL_OPT */ - .set noat - .set nomacro -#endif /* _KERNEL_OPT */ - - -LEAF(_atomic_inc_32) -#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2) - li t0, 1 - saa t0, (a0) -#else -1: INT_LL t0, 0(a0) - nop - INT_ADDU t0, 1 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop -#endif - j ra - nop -END(_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_32, _atomic_inc_32) - -LEAF(_atomic_inc_32_nv) -1: INT_LL v0, 0(a0) - nop - INT_ADDU v0, 1 - move t0, v0 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_32_nv, _atomic_inc_32_nv) - -#if !defined(__mips_o32) -LEAF(_atomic_inc_64) -#if defined(_MIPS_ARCH_OCTEONP) || defined(_MIPS_ARCH_OCTEON2) - li t0, 1 - saad t0, (a0) -#else -1: REG_LL t0, 0(a0) - nop - REG_ADDU t0, 1 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop -#endif - j ra - nop -END(_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_64, _atomic_inc_64) - -LEAF(_atomic_inc_64_nv) -1: REG_LL v0, 0(a0) - nop - REG_ADDU v0, 1 - move t0, v0 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_64_nv, _atomic_inc_64_nv) -#endif - -#ifdef _LP64 -STRONG_ALIAS(_atomic_inc_ptr, _atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ptr_nv, _atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ulong, _atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ulong_nv, _atomic_inc_64_nv) -#else -STRONG_ALIAS(_atomic_inc_ptr, _atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ptr_nv, _atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ulong, _atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong_nv, _atomic_inc_32_nv) -#endif -STRONG_ALIAS(_atomic_inc_uint, _atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint_nv, _atomic_inc_32_nv) - -ATOMIC_OP_ALIAS(atomic_inc_ptr, _atomic_inc_ptr) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv, _atomic_inc_ptr_nv) -ATOMIC_OP_ALIAS(atomic_inc_uint, _atomic_inc_uint) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv, _atomic_inc_uint_nv) -ATOMIC_OP_ALIAS(atomic_inc_ulong, _atomic_inc_ulong) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv, _atomic_inc_ulong_nv) diff --git a/common/lib/libc/arch/mips/atomic/atomic_op_asm.h b/common/lib/libc/arch/mips/atomic/atomic_op_asm.h deleted file mode 100644 index 4caa77a08..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_op_asm.h +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.3 2015/06/01 23:16:54 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) - -#endif /* _KERNEL */ - -#ifdef __OCTEON__ -#define SYNCW syncw -#else -#define SYNCW nop -#endif - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/mips/atomic/atomic_or.S b/common/lib/libc/arch/mips/atomic/atomic_or.S deleted file mode 100644 index 595bc4ec7..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_or.S +++ /dev/null @@ -1,110 +0,0 @@ -/* $NetBSD: atomic_or.S,v 1.4 2012/03/14 16:50:34 christos Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - - .text - .set noreorder -#ifdef _KERNEL_OPT -#include "opt_cputype.h" -#ifndef MIPS3_LOONGSON2F - .set noat - .set nomacro -#endif -#else /* _KERNEL_OPT */ - .set noat - .set nomacro -#endif /* _KERNEL_OPT */ - -LEAF(_atomic_or_32) -1: INT_LL t0, 0(a0) - nop - or t0, a1 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_32, _atomic_or_32) - -LEAF(_atomic_or_32_nv) -1: INT_LL v0, 0(a0) - nop - or v0, a1 - move t0, v0 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_32_nv, _atomic_or_32_nv) - -#if !defined(__mips_o32) -LEAF(_atomic_or_64) -1: REG_LL t0, 0(a0) - nop - or t0, a1 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_or_64) -ATOMIC_OP_ALIAS(atomic_or_64, _atomic_or_64) - -LEAF(_atomic_or_64_nv) -1: REG_LL v0, 0(a0) - nop - or v0, a1 - move t0, v0 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop - j ra - nop -END(_atomic_or_64_nv) -ATOMIC_OP_ALIAS(atomic_or_64_nv, _atomic_or_64_nv) -#endif - -#ifdef _LP64 -STRONG_ALIAS(_atomic_or_ulong, _atomic_or_64) -STRONG_ALIAS(_atomic_or_ulong_nv, _atomic_or_64_nv) -#else -STRONG_ALIAS(_atomic_or_ulong, _atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong_nv, _atomic_or_32_nv) -#endif -STRONG_ALIAS(_atomic_or_uint, _atomic_or_32) -STRONG_ALIAS(_atomic_or_uint_nv, _atomic_or_32_nv) - -ATOMIC_OP_ALIAS(atomic_or_uint, _atomic_or_uint) -ATOMIC_OP_ALIAS(atomic_or_uint_nv, _atomic_or_uint_nv) -ATOMIC_OP_ALIAS(atomic_or_ulong, _atomic_or_ulong) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv, _atomic_or_ulong_nv) diff --git a/common/lib/libc/arch/mips/atomic/atomic_swap.S b/common/lib/libc/arch/mips/atomic/atomic_swap.S deleted file mode 100644 index 591665ff6..000000000 --- a/common/lib/libc/arch/mips/atomic/atomic_swap.S +++ /dev/null @@ -1,87 +0,0 @@ -/* $NetBSD: atomic_swap.S,v 1.5 2015/06/01 23:16:54 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - -RCSID("$NetBSD: atomic_swap.S,v 1.5 2015/06/01 23:16:54 matt Exp $") - - .text - .set noreorder -#ifdef _KERNEL_OPT -#include "opt_cputype.h" -#ifndef MIPS3_LOONGSON2F - .set noat - .set nomacro -#endif -#else /* _KERNEL_OPT */ - .set noat - .set nomacro -#endif /* _KERNEL_OPT */ - - -LEAF(_atomic_swap_32) -1: INT_LL v0, 0(a0) - nop - move t0, a1 - INT_SC t0, 0(a0) - beq t0, zero, 1b - nop -2: - j ra - SYNCW -END(_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_32, _atomic_swap_32) - -#if !defined(__mips_o32) -LEAF(_atomic_swap_64) -1: REG_LL v0, 0(a0) - nop - move t0, a1 - REG_SC t0, 0(a0) - beq t0, zero, 1b - nop -2: - j ra - SYNCW -END(_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_64, _atomic_swap_64) -#endif - -#ifdef _LP64 -STRONG_ALIAS(_atomic_swap_ptr, _atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ulong, _atomic_swap_64) -#else -STRONG_ALIAS(_atomic_swap_ptr, _atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ulong, _atomic_swap_32) -#endif -STRONG_ALIAS(_atomic_swap_uint, _atomic_swap_32) - -ATOMIC_OP_ALIAS(atomic_swap_ptr, _atomic_swap_ptr) -ATOMIC_OP_ALIAS(atomic_swap_uint, _atomic_swap_uint) -ATOMIC_OP_ALIAS(atomic_swap_ulong, _atomic_swap_ulong) diff --git a/common/lib/libc/arch/mips/atomic/membar_ops.S b/common/lib/libc/arch/mips/atomic/membar_ops.S deleted file mode 100644 index 0153b41aa..000000000 --- a/common/lib/libc/arch/mips/atomic/membar_ops.S +++ /dev/null @@ -1,80 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.8 2015/06/23 20:56:17 matt Exp $ */ - -/*- - * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe, and by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -// If we are on building for MIPS III or later, put in SYNCs -#if __mips >= 3 || !defined(__mips_o32) -# define SYNC sync -#else -# define SYNC nop -#endif - - .text - .set noreorder - -LEAF(_membar_sync) - j ra - SYNC -END(_membar_sync) - -#ifdef __OCTEON__ -LEAF(_membar_producer) - j ra - syncw -END(_membar_producer) -#endif - -#ifdef _KERNEL -STRONG_ALIAS(mb_read, _membar_sync) -#ifdef __OCTEON__ -STRONG_ALIAS(mb_write, _membar_producer) -#else -STRONG_ALIAS(mb_write, _membar_sync) -#endif -STRONG_ALIAS(mb_memory, _membar_sync) -#endif - -ATOMIC_OP_ALIAS(membar_sync,_membar_sync) -ATOMIC_OP_ALIAS(membar_enter,_membar_sync) -STRONG_ALIAS(_membar_enter,_membar_sync) -#ifdef __OCTEON__ -ATOMIC_OP_ALIAS(membar_exit,_membar_producer) -STRONG_ALIAS(_membar_exit,_membar_producer) -STRONG_ALIAS(membar_producer,_membar_producer) -#else -ATOMIC_OP_ALIAS(membar_exit,_membar_sync) -STRONG_ALIAS(_membar_exit,_membar_sync) -ATOMIC_OP_ALIAS(membar_producer,_membar_sync) -STRONG_ALIAS(_membar_producer,_membar_sync) -#endif -ATOMIC_OP_ALIAS(membar_consumer,_membar_sync) -STRONG_ALIAS(_membar_consumer,_membar_sync) diff --git a/common/lib/libc/arch/mips/gen/byte_swap_2.S b/common/lib/libc/arch/mips/gen/byte_swap_2.S deleted file mode 100644 index 52c6a97ef..000000000 --- a/common/lib/libc/arch/mips/gen/byte_swap_2.S +++ /dev/null @@ -1,83 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.3 2009/12/14 00:39:00 matt Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)htons.s 8.1 (Berkeley) 6/4/93") -#else - RCSID("$NetBSD: byte_swap_2.S,v 1.3 2009/12/14 00:39:00 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -#undef _LOCORE -#define _LOCORE /* XXX not really, just assembly-code source */ -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define BSWAP16_NAME bswap16 -#else -#define BSWAP16_NAME __bswap16 -#endif - -NLEAF(BSWAP16_NAME) -#if BYTE_ORDER == LITTLE_ENDIAN -ALEAF(htons) -ALEAF(ntohs) -#endif -#if (__mips == 32 || __mips == 64) && __mips_isa_rev == 2 - /* - * If we are on MIPS32r2 or MIPS64r2, use the new instructions - */ - wsbh a0, a0 # word swap bytes within halfwords - and v0, a0, 0xffff # bound it to 16bits - j ra -#else - srl v0, a0, 8 - and v0, v0, 0xff - sll v1, a0, 8 - and v1, v1, 0xff00 - or v0, v0, v1 - j ra -#endif -END(BSWAP16_NAME) - -#if BYTE_ORDER == BIG_ENDIAN -NLEAF(htons) -ALEAF(ntohs) - move v0, a0 - j ra -END(htons) -#endif diff --git a/common/lib/libc/arch/mips/gen/byte_swap_4.S b/common/lib/libc/arch/mips/gen/byte_swap_4.S deleted file mode 100644 index aa13e25cb..000000000 --- a/common/lib/libc/arch/mips/gen/byte_swap_4.S +++ /dev/null @@ -1,87 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.3 2009/12/14 00:39:00 matt Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)htonl.s 8.1 (Berkeley) 6/4/93") -#else - RCSID("$NetBSD: byte_swap_4.S,v 1.3 2009/12/14 00:39:00 matt Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -#undef _LOCORE -#define _LOCORE /* XXX not really, just assembly-code source */ -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -#define BSWAP32_NAME bswap32 -#else -#define BSWAP32_NAME __bswap32 -#endif - -NLEAF(BSWAP32_NAME) # a0 = 0x11223344, return 0x44332211 -#if BYTE_ORDER == LITTLE_ENDIAN -ALEAF(htonl) # a0 = 0x11223344, return 0x44332211 -ALEAF(ntohl) -#endif -#if (__mips == 32 || __mips == 64) && __mips_isa_rev == 2 - /* - * If we are on MIPS32R2 or MIPS64R2 it's much easier - */ - wsbh a0, a0 # word swap bytes within halfwords - rotr v0, a0, 16 # rotate word 16bits - j ra -#else - srl v1, a0, 24 # v1 = 0x00000011 - sll v0, a0, 24 # v0 = 0x44000000 - or v0, v0, v1 - and v1, a0, 0xff00 - sll v1, v1, 8 # v1 = 0x00330000 - or v0, v0, v1 - srl v1, a0, 8 - and v1, v1, 0xff00 # v1 = 0x00002200 - or v0, v0, v1 - j ra -#endif -END(BSWAP32_NAME) - -#if BYTE_ORDER == BIG_ENDIAN -NLEAF(htonl) # a0 = 0x11223344, return 0x44332211 -ALEAF(ntohl) - move v0, a0 - j ra -END(htonl) -#endif diff --git a/common/lib/libc/arch/mips/gen/byte_swap_8.S b/common/lib/libc/arch/mips/gen/byte_swap_8.S deleted file mode 100644 index 4b3cb859b..000000000 --- a/common/lib/libc/arch/mips/gen/byte_swap_8.S +++ /dev/null @@ -1,118 +0,0 @@ -/* $NetBSD: byte_swap_8.S,v 1.2 2009/12/14 00:39:00 matt Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: byte_swap_8.S,v 1.2 2009/12/14 00:39:00 matt Exp $") -#endif /* LIBC_SCCS and not lint */ - -#undef _LOCORE -#define _LOCORE /* XXX not really, just assembly-code source */ -#include - -NLEAF(bswap64) # a0 = 0xffeeddccbbaa9988 return 0x8899aabbccddeeff -#if (__mips == 32 || __mips == 64) && __mips_isa_rev == 2 -#if !defined(__mips_o32) - /* - * If we are on MIPS32r2 or MIPS64r2 use the new instructions. - */ - dsbh v0, a0 # dwords swap bytes within halfwords - dshd v0, v0 # dwords swap halwords within dwords - j ra -#else /* defined(__mips_o32) */ - /* - * If we are on MIPS32r2 or MIPS64r2 use the new instructions. - * (except we must use the 32bit versions) - */ - wsbh v1, a0 # word swap bytes within halfwords - wsbh v0, a1 # word swap bytes within halfwords - rotr v1, v1, 16 # rotate word 16bits and swap word - rotr v0, v0, 16 # rotate word 16bits and swap word - j ra -#endif /* defined(__mips_o32) */ -#elif !defined(__mips_o32) - # a0 = 0xffeeddccbbaa9988 - li t0, 0xffff # t0 = 0x000000000000ffff - dsll t1, t0, 32 # t1 = 0x0000ffff00000000 - or t0, t1 # t0 = 0x0000ffff0000ffff - dsll t2, t0, 8 # t2 = 0x00ffff0000ffff00 - xor t2, t0 # t2 = 0x00ff00ff00ff00ff - /* - * We could swap by halfword, but that would be one instruction longer. - */ - dsrl ta0, a0, 32 # ta0 = 0x00000000ffeeddcc - dsll ta1, a0, 32 # ta1 = 0xbbaa998800000000 - or a1, ta0, ta1 # a1 = 0xbbaa9988ffeeddcc - # words swapped - and ta0, a1, t0 # ta0 = 0x000099880000ddcc - dsrl ta1, a1, 16 # ta1 = 0x0000bbaa9988ffee - and ta1, t0 # ta1 = 0x0000bbaa0000ffee - dsll a2, ta0, 16 # a2 = 0x99880000ddcc0000 - or a2, ta1 # a2 = 0x9988bbaaddccffee - # halfwords swapped - and ta0, a2, t2 # ta0 = 0x008800aa00cc00ee - dsrl ta1, a2, 8 # ta1 = 0x009988bbaaddccff - and ta1, t2 # ta1 = 0x009900bb00dd00ff - dsll v0, ta0, 8 # v0 = 0x8800aa00cc00ee00 - or v0, ta1 # v0 = 0x8899aabbccddeeff - # bytes swapped - j ra -#else /* defined(__mips_o32) */ - /* - * 32bit ABI. - */ - # a0 = 0xccddeeff - # a1 = 0x8899aabb - srl t0, a0, 24 # t0 = 0x000000cc - srl t1, a1, 24 # t1 = 0x00000088 - sll ta0, a0, 24 # ta0 = 0xff000000 - sll ta1, a1, 24 # ta1 = 0xbb000000 - or ta0, ta0, t0 # ta0 = 0xff0000cc - or ta1, ta1, t1 # ta1 = 0xbb000088 - and t0, a0, 0xff00 # t0 = 0x0000ee00 - and t1, a1, 0xff00 # t1 = 0x0000aa00 - sll t0, t0, 8 # t0 = 0x00ee0000 - sll t1, t1, 8 # t1 = 0x00aa0000 - or ta0, ta0, t0 # ta0 = 0xffee00cc - or ta1, ta1, t1 # ta1 = 0xbbaa0088 - srl t0, a0, 8 # t0 = 0x00ccddee - srl t1, a1, 8 # t1 = 0x008899aa - and t0, t0, 0xff00 # t0 = 0x0000dd00 - and t1, t1, 0xff00 # t1 = 0x00009900 - or v1, ta0, t0 # v1 = 0xffeeddcc - or v0, ta1, t1 # v0 = 0xbbaa9988 - j ra -#endif /* defined(__mips_o32) */ -END(bswap64) diff --git a/common/lib/libc/arch/mips/string/bcopy.S b/common/lib/libc/arch/mips/string/bcopy.S deleted file mode 100644 index d301185ef..000000000 --- a/common/lib/libc/arch/mips/string/bcopy.S +++ /dev/null @@ -1,298 +0,0 @@ -/* $NetBSD: bcopy.S,v 1.4 2011/08/27 13:23:52 bouyer Exp $ */ - -/* - * Mach Operating System - * Copyright (c) 1993 Carnegie Mellon University - * All Rights Reserved. - * - * Permission to use, copy, modify and distribute this software and its - * documentation is hereby granted, provided that both the copyright - * notice and this permission notice appear in all copies of the - * software, derivative works or modified versions, and any portions - * thereof, and that both notices appear in supporting documentation. - * - * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" - * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR - * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * - * Carnegie Mellon requests users of this software to return to - * - * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU - * School of Computer Science - * Carnegie Mellon University - * Pittsburgh PA 15213-3890 - * - * any improvements or extensions that they make and grant Carnegie Mellon - * the rights to redistribute these changes. - */ - -/* - * File: mips_bcopy.s - * Author: Chris Maeda - * Date: June 1993 - * - * Fast copy routine. Derived from aligned_block_copy. - */ - - -#include -#ifndef _LOCORE -#define _LOCORE /* XXX not really, just assembly-code source */ -#endif -#include - - -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - RCSID("from: @(#)mips_bcopy.s 2.2 CMU 18/06/93") -#else - RCSID("$NetBSD: bcopy.S,v 1.4 2011/08/27 13:23:52 bouyer Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * bcopy(caddr_t src, caddr_t dst, unsigned int len) - * - * a0 src address - * a1 dst address - * a2 length - */ - -#if defined(MEMCOPY) || defined(MEMMOVE) -#ifdef MEMCOPY -#define FUNCTION memcpy -#else -#define FUNCTION memmove -#endif -#define SRCREG a1 -#define DSTREG a0 -#else -#define FUNCTION bcopy -#define SRCREG a0 -#define DSTREG a1 -#endif - -#define SIZEREG a2 - -LEAF(FUNCTION) - .set noat - .set noreorder - -#if defined(MEMCOPY) || defined(MEMMOVE) - /* set up return value, while we still can */ - move v0,DSTREG -#endif - /* - * Make sure we can copy forwards. - */ - sltu t0,SRCREG,DSTREG # t0 == SRCREG < DSTREG - bne t0,zero,6f # copy backwards - - /* - * There are four alignment cases (with frequency) - * (Based on measurements taken with a DECstation 5000/200 - * inside a Mach kernel.) - * - * aligned -> aligned (mostly) - * unaligned -> aligned (sometimes) - * aligned,unaligned -> unaligned (almost never) - * - * Note that we could add another case that checks if - * the destination and source are unaligned but the - * copy is alignable. eg if src and dest are both - * on a halfword boundary. - */ - andi t1,DSTREG,(SZREG-1) # get last bits of dest - bne t1,zero,3f # dest unaligned - andi t0,SRCREG,(SZREG-1) # get last bits of src - bne t0,zero,5f - - /* - * Forward aligned->aligned copy, 8 words at a time. - */ -98: - li AT,-(SZREG*8) - and t0,SIZEREG,AT # count truncated to multiples - PTR_ADDU a3,SRCREG,t0 # run fast loop up to this addr - sltu AT,SRCREG,a3 # any work to do? - beq AT,zero,2f - PTR_SUBU SIZEREG,t0 - - /* - * loop body - */ -1: # cp - REG_L t3,(0*SZREG)(SRCREG) - REG_L v1,(1*SZREG)(SRCREG) - REG_L t0,(2*SZREG)(SRCREG) - REG_L t1,(3*SZREG)(SRCREG) - PTR_ADDU SRCREG,SZREG*8 - REG_S t3,(0*SZREG)(DSTREG) - REG_S v1,(1*SZREG)(DSTREG) - REG_S t0,(2*SZREG)(DSTREG) - REG_S t1,(3*SZREG)(DSTREG) - REG_L t1,(-1*SZREG)(SRCREG) - REG_L t0,(-2*SZREG)(SRCREG) - REG_L v1,(-3*SZREG)(SRCREG) - REG_L t3,(-4*SZREG)(SRCREG) - PTR_ADDU DSTREG,SZREG*8 - REG_S t1,(-1*SZREG)(DSTREG) - REG_S t0,(-2*SZREG)(DSTREG) - REG_S v1,(-3*SZREG)(DSTREG) - bne SRCREG,a3,1b - REG_S t3,(-4*SZREG)(DSTREG) - - /* - * Copy a word at a time, no loop unrolling. - */ -2: # wordcopy - andi t2,SIZEREG,(SZREG-1) # get byte count / SZREG - PTR_SUBU t2,SIZEREG,t2 # t2 = words to copy * SZREG - beq t2,zero,3f - PTR_ADDU t0,SRCREG,t2 # stop at t0 - PTR_SUBU SIZEREG,SIZEREG,t2 -1: - REG_L t3,0(SRCREG) - PTR_ADDU SRCREG,SZREG - REG_S t3,0(DSTREG) - bne SRCREG,t0,1b - PTR_ADDU DSTREG,SZREG - -3: # bytecopy - beq SIZEREG,zero,4f # nothing left to do? - nop -1: - lb t3,0(SRCREG) - PTR_ADDU SRCREG,1 - sb t3,0(DSTREG) - PTR_SUBU SIZEREG,1 - bgtz SIZEREG,1b - PTR_ADDU DSTREG,1 - -4: # copydone - .set at #-mfix-loongson2f-btb - j ra - nop - .set noat - - /* - * Copy from unaligned source to aligned dest. - */ -5: # destaligned - andi t0,SIZEREG,(SZREG-1) # t0 = bytecount mod SZREG - PTR_SUBU a3,SIZEREG,t0 # number of words to transfer - beq a3,zero,3b - nop - move SIZEREG,t0 # this many to do after we are done - PTR_ADDU a3,SRCREG,a3 # stop point - -1: - REG_LHI t3,0(SRCREG) - REG_LLO t3,SZREG-1(SRCREG) - PTR_ADDI SRCREG,SZREG - REG_S t3,0(DSTREG) - bne SRCREG,a3,1b - PTR_ADDI DSTREG,SZREG - - b 3b - nop - -6: # backcopy -- based on above - PTR_ADDU SRCREG,SIZEREG - PTR_ADDU DSTREG,SIZEREG - andi t1,DSTREG,SZREG-1 # get last 3 bits of dest - bne t1,zero,3f - andi t0,SRCREG,SZREG-1 # get last 3 bits of src - bne t0,zero,5f - - /* - * Forward aligned->aligned copy, 8*4 bytes at a time. - */ - li AT,(-8*SZREG) - and t0,SIZEREG,AT # count truncated to multiple of 32 - beq t0,zero,2f # any work to do? - PTR_SUBU SIZEREG,t0 - PTR_SUBU a3,SRCREG,t0 - - /* - * loop body - */ -1: # cp - REG_L t3,(-4*SZREG)(SRCREG) - REG_L v1,(-3*SZREG)(SRCREG) - REG_L t0,(-2*SZREG)(SRCREG) - REG_L t1,(-1*SZREG)(SRCREG) - PTR_SUBU SRCREG,8*SZREG - REG_S t3,(-4*SZREG)(DSTREG) - REG_S v1,(-3*SZREG)(DSTREG) - REG_S t0,(-2*SZREG)(DSTREG) - REG_S t1,(-1*SZREG)(DSTREG) - REG_L t1,(3*SZREG)(SRCREG) - REG_L t0,(2*SZREG)(SRCREG) - REG_L v1,(1*SZREG)(SRCREG) - REG_L t3,(0*SZREG)(SRCREG) - PTR_SUBU DSTREG,8*SZREG - REG_S t1,(3*SZREG)(DSTREG) - REG_S t0,(2*SZREG)(DSTREG) - REG_S v1,(1*SZREG)(DSTREG) - bne SRCREG,a3,1b - REG_S t3,(0*SZREG)(DSTREG) - - /* - * Copy a word at a time, no loop unrolling. - */ -2: # wordcopy - andi t2,SIZEREG,SZREG-1 # get byte count / 4 - PTR_SUBU t2,SIZEREG,t2 # t2 = number of words to copy - beq t2,zero,3f - PTR_SUBU t0,SRCREG,t2 # stop at t0 - PTR_SUBU SIZEREG,SIZEREG,t2 -1: - REG_L t3,-SZREG(SRCREG) - PTR_SUBU SRCREG,SZREG - REG_S t3,-SZREG(DSTREG) - bne SRCREG,t0,1b - PTR_SUBU DSTREG,SZREG - -3: # bytecopy - beq SIZEREG,zero,4f # nothing left to do? - nop -1: - lb t3,-1(SRCREG) - PTR_SUBU SRCREG,1 - sb t3,-1(DSTREG) - PTR_SUBU SIZEREG,1 - bgtz SIZEREG,1b - PTR_SUBU DSTREG,1 - -4: # copydone - .set at #-mfix-loongson2f-btb - j ra - nop - .set noat - - /* - * Copy from unaligned source to aligned dest. - */ -5: # destaligned - andi t0,SIZEREG,SZREG-1 # t0 = bytecount mod 4 - PTR_SUBU a3,SIZEREG,t0 # number of words to transfer - beq a3,zero,3b - nop - move SIZEREG,t0 # this many to do after we are done - PTR_SUBU a3,SRCREG,a3 # stop point - -1: - REG_LHI t3,-SZREG(SRCREG) - REG_LLO t3,-1(SRCREG) - PTR_SUBU SRCREG,SZREG - REG_S t3,-SZREG(DSTREG) - bne SRCREG,a3,1b - PTR_SUBU DSTREG,SZREG - - b 3b - nop - - .set reorder - .set at - END(FUNCTION) diff --git a/common/lib/libc/arch/mips/string/ffs.S b/common/lib/libc/arch/mips/string/ffs.S deleted file mode 100644 index 1fca471a8..000000000 --- a/common/lib/libc/arch/mips/string/ffs.S +++ /dev/null @@ -1,110 +0,0 @@ -/* $NetBSD: ffs.S,v 1.4 2011/07/04 11:35:26 mrg Exp $ */ - -/*- - * Copyright (c) 2010 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: ffs.S,v 1.4 2011/07/04 11:35:26 mrg Exp $") - -/* bit = ffs(value) */ - - .text - .set noreorder - -WEAK_ALIAS(__ffssi2,ffs) -#if __mips == 64 || __mips == 32 -LEAF(ffs) -#ifndef _LP64 -XLEAF(ffsl) -#endif - .set push - .set mips32 - li v1, 32 -#if __mips == 64 - sll a0, a0, 0 -#endif - negu a1, a0 - and a0, a1 - clz v0, a0 - j ra - subu v0, v1, v0 - .set pop -END(ffs) -#if defined(_LP64) && __mips == 64 -LEAF(ffsl) - li v1, 64 - negu a1, a0 - and a0, a1 - dclz v0, a0 - j ra - subu v0, v1, v0 -END(ffsl) -#endif -#else /* __mips != 64 && __mips != 32 */ - -#ifdef _LP64 -XLEAF(ffsl) - beqz a0, 6f # fast escape if 0 - li v0, 0 - - li v0, 1 - li a3, 0xffffffff # initial mask - b 1f - li a2, 32 # bit count of mask -#endif /* _LP64 */ -LEAF(ffs) -#ifndef _LP64 -XLEAF(ffsl) -#endif /* !_LP64 */ - beqz a0, 6f - li v0, 0 - - li v0, 1 - li a3, 0xffff # initial mask - li a2, 16 # bit count of mask -1: - and v1, a0, a3 # focus no lower half of bits left - bnez v1, 2f # any of the lower half set? - nop - addu v0, a2 # nope, then bit is in the upper half -#ifdef _LP64 - dsrlv a0, a0, a2 # discard low bits -#else - srlv a0, a0, a2 # discard low bits -#endif -2: - srl a2, 1 # divide bit count by 2 - bnez a2, 1b # still bits left to text? - srlv a3, a3, a2 # shrink mask in half -6: - j ra - nop -END(ffs) -#endif /* __mips == 64 || __mips == 32 */ diff --git a/common/lib/libc/arch/mips/string/memcpy.S b/common/lib/libc/arch/mips/string/memcpy.S deleted file mode 100644 index 564d86c86..000000000 --- a/common/lib/libc/arch/mips/string/memcpy.S +++ /dev/null @@ -1,5 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - - -#define MEMCOPY -#include "bcopy.S" diff --git a/common/lib/libc/arch/mips/string/memmove.S b/common/lib/libc/arch/mips/string/memmove.S deleted file mode 100644 index fa1922b24..000000000 --- a/common/lib/libc/arch/mips/string/memmove.S +++ /dev/null @@ -1,5 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - - -#define MEMMOVE -#include "bcopy.S" diff --git a/common/lib/libc/arch/mips/string/strchr.S b/common/lib/libc/arch/mips/string/strchr.S deleted file mode 100644 index dc4e3b9e7..000000000 --- a/common/lib/libc/arch/mips/string/strchr.S +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: strchr.S,v 1.4 2015/05/26 06:55:08 matt Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - ASMSTR("from: @(#)index.s 8.1 (Berkeley) 6/4/93") - ASMSTR("$NetBSD: strchr.S,v 1.4 2015/05/26 06:55:08 matt Exp $") -#endif /* LIBC_SCCS and not lint */ - -#ifdef __ABICALLS__ - .abicalls -#endif - -LEAF(strchr) -XLEAF(index) - and a1, 0xff # limit to byte value -1: - lbu a2, 0(a0) # get a byte - PTR_ADDU a0, 1 - beq a2, a1, fnd - bne a2, zero, 1b -notfnd: - move v0, zero - j ra -fnd: - PTR_SUBU v0, a0, 1 - j ra -END(strchr) diff --git a/common/lib/libc/arch/mips/string/strcmp.S b/common/lib/libc/arch/mips/string/strcmp.S deleted file mode 100644 index 6d576922f..000000000 --- a/common/lib/libc/arch/mips/string/strcmp.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: strcmp.S,v 1.2 2009/12/14 00:39:00 matt Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - /* RCSID("from: @(#)strcmp.s 8.1 (Berkeley) 6/4/93") */ - RCSID("$NetBSD: strcmp.S,v 1.2 2009/12/14 00:39:00 matt Exp $") -#endif /* LIBC_SCCS and not lint */ - -/* - * NOTE: this version assumes unsigned chars in order to be "8 bit clean". - */ -LEAF(strcmp) -1: - lbu t0, 0(a0) # get two bytes and compare them - lbu t1, 0(a1) - beq t0, zero, LessOrEq # end of first string? - bne t0, t1, NotEq - lbu t0, 1(a0) # unroll loop - lbu t1, 1(a1) - PTR_ADD a0, a0, 2 - beq t0, zero, LessOrEq # end of first string? - PTR_ADD a1, a1, 2 - beq t0, t1, 1b -NotEq: - subu v0, t0, t1 - j ra -LessOrEq: - subu v0, zero, t1 - j ra -END(strcmp) diff --git a/common/lib/libc/arch/mips/string/strlen.S b/common/lib/libc/arch/mips/string/strlen.S deleted file mode 100644 index 842dcf93f..000000000 --- a/common/lib/libc/arch/mips/string/strlen.S +++ /dev/null @@ -1,50 +0,0 @@ -/* $NetBSD: strlen.S,v 1.2 2009/12/14 00:39:00 matt Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - /* RCSID("from: @(#)strlen.s 8.1 (Berkeley) 6/4/93") */ - RCSID("$NetBSD: strlen.S,v 1.2 2009/12/14 00:39:00 matt Exp $") -#endif /* LIBC_SCCS and not lint */ - -LEAF(strlen) - PTR_ADDU v1, a0, 1 -1: - lb v0, 0(a0) # get byte from string - PTR_ADDU a0, a0, 1 # increment pointer - bne v0, zero, 1b # continue if not end - PTR_SUBU v0, a0, v1 # compute length - 1 for '\0' char - j ra -END(strlen) diff --git a/common/lib/libc/arch/mips/string/strrchr.S b/common/lib/libc/arch/mips/string/strrchr.S deleted file mode 100644 index f1c5dcb4d..000000000 --- a/common/lib/libc/arch/mips/string/strrchr.S +++ /dev/null @@ -1,58 +0,0 @@ -/* $NetBSD: strrchr.S,v 1.3 2015/05/26 06:55:08 matt Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ralph Campbell. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - ASMSTR("from: @(#)rindex.s 8.1 (Berkeley) 6/4/93") - ASMSTR("$NetBSD: strrchr.S,v 1.3 2015/05/26 06:55:08 matt Exp $") -#endif /* LIBC_SCCS and not lint */ - -#ifdef __ABICALLS__ - .abicalls -#endif - -LEAF(strrchr) -XLEAF(rindex) - and a1, 0xff # limit to byte value - move v0, zero # default if not found -1: - lbu a3, 0(a0) # get a byte - PTR_ADDU a0, a0, 1 - bne a3, a1, 2f - PTR_SUBU v0, a0, 1 # save address of last match -2: - bne a3, zero, 1b # continue if not end - j ra -END(strrchr) diff --git a/common/lib/libc/arch/or1k/atomic/Makefile.inc b/common/lib/libc/arch/or1k/atomic/Makefile.inc deleted file mode 100644 index f221cc627..000000000 --- a/common/lib/libc/arch/or1k/atomic/Makefile.inc +++ /dev/null @@ -1,28 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.1 2014/09/03 19:34:25 matt Exp $ - -.for op in add and cas nand or swap xor -.for sz in 32 -SRCS.atomic+= atomic_${op}_${sz}.S -.endfor -.for sz in 8 16 -SRCS.atomic+= atomic_${op}_${sz}_cas.c -.endfor -.endfor -SRCS.atomic+= atomic_dec_32.S atomic_inc_32.S -SRCS.atomic+= membar_ops.S -SRCS.atomic+= atomic_cas_by_cas32.c -.if defined(LIB) && ${LIB} != "kern" -SRCS.atomic+= sync_bool_compare_and_swap_4.S -.endif - -#.if defined(LIB) && (${LIB} != "kern") -#SRCS.atomic+= atomic_simplelock.c -#.endif - -.if defined(LIB) && (${LIB} != "kern" && ${LIB} != "rump") - -SRCS.atomic+= atomic_init_cas.c - -.endif #LIB - -SRCS+= ${SRCS.atomic} diff --git a/common/lib/libc/arch/or1k/atomic/atomic_add_32.S b/common/lib/libc/arch/or1k/atomic/atomic_add_32.S deleted file mode 100644 index 80fdf547f..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_add_32.S +++ /dev/null @@ -1,97 +0,0 @@ -/* $NetBSD: atomic_add_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_sub_32) - l.sub r4, r0, r4 /* negate */ - /* FALLTHROUGH */ -ENTRY_NP(_atomic_add_32) -1: l.lwa r11, 0(r3) /* load old value */ - l.add r5, r11, r4 /* calculate new value */ - l.swa 0(r3), r5 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_add_32) -END(_atomic_sub_32) - -ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_32) -CRT_ALIAS(__sync_fetch_and_add_4,_atomic_add_32) -CRT_ALIAS(__atomic_fetch_add_4,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_long,_atomic_add_32) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32) - -ATOMIC_OP_ALIAS(atomic_sub_32,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_int,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_long,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_ptr,_atomic_sub_32) -CRT_ALIAS(__sync_fetch_and_sub_4,_atomic_sub_32) -CRT_ALIAS(__atomic_fetch_sub_4,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_int,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_long,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_ptr,_atomic_sub_32) - -ENTRY_NP(_atomic_sub_32_nv) - l.sub r4, r0, r4 /* negate */ - /* FALLTHROUGH */ -ENTRY_NP(_atomic_add_32_nv) -1: l.lwa r5, 0(r3) /* load old value */ - l.add r11, r5, r4 /* calculate new value */ - l.swa 0(r3), r11 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_add_32_nv) -END(_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) -CRT_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) - -ATOMIC_OP_ALIAS(atomic_sub_32_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_int_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_long_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_ptr_nv,_atomic_sub_32_nv) -CRT_ALIAS(__sync_sub_and_fetch_4,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_int_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_long_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_ptr_nv,_atomic_sub_32_nv) diff --git a/common/lib/libc/arch/or1k/atomic/atomic_and_32.S b/common/lib/libc/arch/or1k/atomic/atomic_and_32.S deleted file mode 100644 index 5aecae24e..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_and_32.S +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: atomic_and_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_and_32) -1: l.lwa r11, 0(r3) /* load old value */ - l.and r5, r11, r4 /* calculate new value */ - l.swa 0(r3), r5 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_and_32) - -ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) -CRT_ALIAS(__sync_fetch_and_and_4,_atomic_and_32) -CRT_ALIAS(__atomic_fetch_and_4,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) - -ENTRY_NP(_atomic_and_32_nv) -1: l.lwa r5, 0(r3) /* load old value */ - l.and r11, r5, r4 /* calculate new value */ - l.swa 0(r3), r11 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_and_32_nv) - -ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) -CRT_ALIAS(__sync_and_and_fetch_4,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) diff --git a/common/lib/libc/arch/or1k/atomic/atomic_cas_32.S b/common/lib/libc/arch/or1k/atomic/atomic_cas_32.S deleted file mode 100644 index 438d78b2c..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_cas_32.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: atomic_cas_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_cas_32) -1: l.lwa r11, 0(r3) - l.sfeq r11, r4 - l.bnf 2f - l.nop - l.swa 0(r3), r5 - l.bnf 1b - l.nop -2: l.jr lr - l.nop -END(_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32) -CRT_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) diff --git a/common/lib/libc/arch/or1k/atomic/atomic_dec_32.S b/common/lib/libc/arch/or1k/atomic/atomic_dec_32.S deleted file mode 100644 index 29e05bc6b..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_dec_32.S +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: atomic_dec_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_dec_32) -1: l.lwa r11, 0(r3) /* load old value */ - l.addi r5, r11, -1 /* calculate new value */ - l.swa 0(r3), r5 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_dec_32) - -ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_32) - -ENTRY_NP(_atomic_dec_32_nv) -1: l.lwa r5, 0(r3) /* load old value */ - l.addi r11, r5, -1 /* calculate new value */ - l.swa 0(r3), r11 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_dec_32_nv) - -ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_32_nv) diff --git a/common/lib/libc/arch/or1k/atomic/atomic_inc_32.S b/common/lib/libc/arch/or1k/atomic/atomic_inc_32.S deleted file mode 100644 index 7075d2b26..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_inc_32.S +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_inc_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_inc_32) -1: l.lwa r11, 0(r3) /* load old value */ - l.addi r5, r11, 1 /* calculate new value */ - l.swa 0(r3), r5 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32) - -ENTRY_NP(_atomic_inc_32_nv) -1: l.lwa r5, 0(r3) /* load old value */ - l.addi r11, r5, 1 /* calculate new value */ - l.swa 0(r3), r11 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv) diff --git a/common/lib/libc/arch/or1k/atomic/atomic_nand_32.S b/common/lib/libc/arch/or1k/atomic/atomic_nand_32.S deleted file mode 100644 index 79cf37738..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_nand_32.S +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: atomic_nand_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_nand_32) -1: l.lwa r11, 0(r3) /* load old value */ - l.and r5, r11, r4 /* calculate new value */ - l.xori r5, r5, -1 /* complement */ - l.swa 0(r3), r5 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_nand_32) - -ATOMIC_OP_ALIAS(atomic_nand_32,_atomic_nand_32) -ATOMIC_OP_ALIAS(atomic_nand_uint,_atomic_nand_32) -ATOMIC_OP_ALIAS(atomic_nand_ulong,_atomic_nand_32) -CRT_ALIAS(__sync_fetch_and_nand_4,_atomic_nand_32) -STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32) -STRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_32) - -ENTRY_NP(_atomic_nand_32_nv) -1: l.lwa r5, 0(r3) /* load old value */ - l.add r11, r5, r4 /* calculate new value */ - l.xori r11, r11, -1 /* complement */ - l.swa 0(r3), r11 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_nand_32_nv) - -ATOMIC_OP_ALIAS(atomic_nand_32_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_uint_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_ulong_nv,_atomic_nand_32_nv) -CRT_ALIAS(__sync_nand_and_fetch_4,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_uint_nv,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_ulong_nv,_atomic_nand_32_nv) diff --git a/common/lib/libc/arch/or1k/atomic/atomic_op_asm.h b/common/lib/libc/arch/or1k/atomic/atomic_op_asm.h deleted file mode 100644 index 927d2e6e8..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_op_asm.h +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) -#ifdef _RUMPKERNEL -#define CRT_ALIAS(a,s) STRONG_ALIAS(a,s) -#endif - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) -#ifdef _LIBC -#define CRT_ALIAS(a,s) STRONG_ALIAS(a,s) -#endif - -#endif /* _KERNEL */ - -#ifndef CRT_ALIAS -#define CRT_ALIAS(a,s) -#endif - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/or1k/atomic/atomic_or_32.S b/common/lib/libc/arch/or1k/atomic/atomic_or_32.S deleted file mode 100644 index 85b961b2f..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_or_32.S +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: atomic_or_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_or_32) -1: l.lwa r11, 0(r3) /* load old value */ - l.or r5, r11, r4 /* calculate new value */ - l.swa 0(r3), r5 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_or_32) - -ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) -CRT_ALIAS(__sync_fetch_and_or_4,_atomic_or_32) -CRT_ALIAS(__atomic_fetch_or_4,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) - -ENTRY_NP(_atomic_or_32_nv) -1: l.lwa r5, 0(r3) /* load old value */ - l.or r11, r5, r4 /* calculate new value */ - l.swa 0(r3), r11 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_or_32_nv) - -ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) -CRT_ALIAS(__sync_or_and_fetch_4,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) diff --git a/common/lib/libc/arch/or1k/atomic/atomic_swap_32.S b/common/lib/libc/arch/or1k/atomic/atomic_swap_32.S deleted file mode 100644 index 511f868e6..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_swap_32.S +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: atomic_swap_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2007,2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe and Matt Thomas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_32) -1: l.lwa r11, 0(r3) - l.swa 0(r3), r4 - l.bnf 1b - l.nop -2: l.jr lr - l.nop -END(_atomic_swap_32) - -ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32) -CRT_ALIAS(__sync_lock_test_and_set_4,_atomic_swap_32) -CRT_ALIAS(__atomic_exchange_4,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) - -#if (!defined(_KERNEL) || defined(_RUMPKERNEL)) && !defined(_STANDALONE) -ENTRY_NP(__sync_lock_release_4) - l.sw 0(r3), r0 - l.jr lr - l.nop -END(__sync_lock_release_4) -#endif diff --git a/common/lib/libc/arch/or1k/atomic/atomic_xor_32.S b/common/lib/libc/arch/or1k/atomic/atomic_xor_32.S deleted file mode 100644 index be6dc50b7..000000000 --- a/common/lib/libc/arch/or1k/atomic/atomic_xor_32.S +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: atomic_xor_32.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_xor_32) -1: l.lwa r11, 0(r3) /* load old value */ - l.xor r5, r11, r4 /* calculate new value */ - l.swa 0(r3), r5 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_xor_32) - -ATOMIC_OP_ALIAS(atomic_xor_32,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_uint,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_ulong,_atomic_xor_32) -CRT_ALIAS(__sync_fetch_and_xor_4,_atomic_xor_32) -CRT_ALIAS(__atomic_fetch_xor_4,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_uint,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_ulong,_atomic_xor_32) - -ENTRY_NP(_atomic_xor_32_nv) -1: l.lwa r5, 0(r3) /* load old value */ - l.xor r11, r5, r4 /* calculate new value */ - l.swa 0(r3), r11 /* try to store */ - l.bnf 1b /* succeed? no, try again */ - l.nop /* -- delay slot -- */ - l.jr lr /* return old value */ - l.nop -END(_atomic_xor_32_nv) - -ATOMIC_OP_ALIAS(atomic_xor_32_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_uint_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_ulong_nv,_atomic_xor_32_nv) -CRT_ALIAS(__sync_xor_and_fetch_4,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_uint_nv,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_ulong_nv,_atomic_xor_32_nv) diff --git a/common/lib/libc/arch/or1k/atomic/membar_ops.S b/common/lib/libc/arch/or1k/atomic/membar_ops.S deleted file mode 100644 index 3ce1b1870..000000000 --- a/common/lib/libc/arch/or1k/atomic/membar_ops.S +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_membar_producer) - l.msync - l.jr lr - l.nop -END(_membar_producer) -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) -ATOMIC_OP_ALIAS(membar_write,_membar_producer) -STRONG_ALIAS(_membar_write,_membar_producer) - -ENTRY_NP(_membar_sync) - l.msync - l.jr lr - l.nop -END(_membar_sync) -ATOMIC_OP_ALIAS(membar_sync,_membar_sync) -ATOMIC_OP_ALIAS(membar_enter,_membar_sync) -ATOMIC_OP_ALIAS(membar_exit,_membar_sync) -ATOMIC_OP_ALIAS(membar_consumer,_membar_sync) -ATOMIC_OP_ALIAS(membar_read,_membar_sync) -CRT_ALIAS(__sync_synchronize,_membar_sync) -STRONG_ALIAS(_membar_enter,_membar_sync) -STRONG_ALIAS(_membar_exit,_membar_sync) -STRONG_ALIAS(_membar_consumer,_membar_sync) -STRONG_ALIAS(_membar_read,_membar_sync) diff --git a/common/lib/libc/arch/or1k/atomic/sync_bool_compare_and_swap_4.S b/common/lib/libc/arch/or1k/atomic/sync_bool_compare_and_swap_4.S deleted file mode 100644 index dde6fca57..000000000 --- a/common/lib/libc/arch/or1k/atomic/sync_bool_compare_and_swap_4.S +++ /dev/null @@ -1,45 +0,0 @@ -/* $NetBSD: sync_bool_compare_and_swap_4.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(__sync_bool_compare_and_swap_4) - l.or r11, r0, r0 /* assume failure */ -1: l.lwa r8, 0(r3) /* load it */ - l.sfeq r8, r4 /* is this what we want? */ - l.bnf 2f /* no, return failure */ - l.nop /* -- delay slot -- */ - l.swa 0(r3), r5 /* store new value */ - l.bnf 1b /* store failed, try again */ - l.nop /* -- delay slot -- */ - l.addi r11, r11, 1 /* indicate success */ -2: l.jr lr /* return */ - l.nop /* -- delay slot -- */ -END(__sync_bool_compare_and_swap_4) diff --git a/common/lib/libc/arch/or1k/gen/mulsi3.S b/common/lib/libc/arch/or1k/gen/mulsi3.S deleted file mode 100644 index 6b49b2e39..000000000 --- a/common/lib/libc/arch/or1k/gen/mulsi3.S +++ /dev/null @@ -1,74 +0,0 @@ -/* $NetBSD: mulsi3.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -__RCSID("$NetBSD: mulsi3.S,v 1.1 2014/09/03 19:34:25 matt Exp $") - -ENTRY(__mulsi3) - l.movhi r11, 0 - - l.sfeqi r3, 0 - l.bf .Lret - l.nop - - l.sfeqi r4, 0 - l.bf .Lret - l.nop - - l.sfleu r3, r4 # is r3 < r4 (unsigned) -#if 0 - l.ori r6, r3, 0 # move r3 to r6 - l.bf .Lloop # yes, r6 already has smaller value, - l.nop - l.ori r6, r4, 0 # move r4 to r6 because it's smaller than r3 -#else - l.cmov r6, r3, r4 # choose lesser of r3 or r4 -#endif - -.Lloop: - l.andi r5, r6, 1 # get LSB - l.sub r8, r0, r5 # 0 -> 0, 1 -> 0xffffffff - l.and r8, r8, r4 # r8 = r6 & 1 ? r4 : 0 - l.add r11, r11, r8 # add to result - l.srli r4, r4, 1 # discard LSB - l.slli r6, r6, 1 # multiply by 2 -.Lentry: - l.sfeqi r4, 0 # only 0 left? - l.bf .Lret # yes, we're done - l.nop - l.sfeqi r6, 0 # only 0 left? - l.bnf .Lloop # no, another round of long multiplication. - l.nop - -.Lret: l.jr lr - l.nop -END(__mulsi3) diff --git a/common/lib/libc/arch/or1k/string/bcopy.S b/common/lib/libc/arch/or1k/string/bcopy.S deleted file mode 100644 index a52290b8b..000000000 --- a/common/lib/libc/arch/or1k/string/bcopy.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: bcopy.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -#define _BCOPY -#include "memmove.S" diff --git a/common/lib/libc/arch/or1k/string/bzero.S b/common/lib/libc/arch/or1k/string/bzero.S deleted file mode 100644 index 97e146a02..000000000 --- a/common/lib/libc/arch/or1k/string/bzero.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: bzero.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -#define _BZERO -#include "memset.S" diff --git a/common/lib/libc/arch/or1k/string/clz.S b/common/lib/libc/arch/or1k/string/clz.S deleted file mode 100644 index f45cbe47a..000000000 --- a/common/lib/libc/arch/or1k/string/clz.S +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: clz.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (C) 2001 Martin J. Laubach - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*----------------------------------------------------------------------*/ - -#include - -__RCSID("$NetBSD: clz.S,v 1.1 2014/09/03 19:34:25 matt Exp $") - -ENTRY_NP(__clzsi2) -#ifdef _LP64 - l.slli r3, r3, 32 - l.addi r5, r0, 64 -#else - l.addi r5, r0, 32 -#endif - l.fl1 r11, r3 - l.sub r11, r5, r11 - l.jr lr - l.nop -END(__clzsi2) - -ENTRY_NP(__clzdi2) -#ifdef _LP64 - l.addi r5, r0, 64 -#else - l.sfeqi r3, 0 - l.bf 1f - l.nop - l.addi r5, r0, 32 -#endif - l.fl1 r11, r3 - l.sub r11, r5, r11 - l.jr lr - l.nop -#ifndef _LP64 -1: l.addi r5, r0, 64 - l.fl1 r11, r4 - l.sub r11, r5, r11 - l.jr lr - l.nop -#endif -END(__clzdi2) diff --git a/common/lib/libc/arch/or1k/string/ctz.S b/common/lib/libc/arch/or1k/string/ctz.S deleted file mode 100644 index 1c7108a5c..000000000 --- a/common/lib/libc/arch/or1k/string/ctz.S +++ /dev/null @@ -1,69 +0,0 @@ -/* $NetBSD: ctz.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (C) 2001 Martin J. Laubach - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*----------------------------------------------------------------------*/ - -#include - -__RCSID("$NetBSD: ctz.S,v 1.1 2014/09/03 19:34:25 matt Exp $") - -ENTRY_NP(__ctzsi2) -#ifdef _LP64 - l.extwz r3, r3 -#endif - l.ff1 r11, r3 - l.addi r11, r11, -1 - l.jr lr - l.nop -END(__ctzsi2) - -ENTRY_NP(__ctzdi2) -#ifdef _LP64 - l.ff1 r11, r3 - l.addi r11, r11, -1 - l.jr lr - l.nop -#else - l.sfeqi r4, 0 - l.bf 1f - l.nop - - l.ff1 r11, r4 - l.addi r11, r11, -1 - l.jr lr - l.nop - -1: l.sfeqi r3, 0 - l.addi r12, r0, 64 - l.ff1 r11, r3 - l.addi r11, r11, 31 - l.cmov r11, r12, r11 - l.jr lr - l.nop -#endif -END(__ctzdi2) diff --git a/common/lib/libc/arch/or1k/string/ffs.S b/common/lib/libc/arch/or1k/string/ffs.S deleted file mode 100644 index 5998a4f82..000000000 --- a/common/lib/libc/arch/or1k/string/ffs.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: ffs.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (C) 2001 Martin J. Laubach - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*----------------------------------------------------------------------*/ - -#include - -__RCSID("$NetBSD: ffs.S,v 1.1 2014/09/03 19:34:25 matt Exp $") - -ENTRY_NP(__ffssi2) -#ifdef _LP64 - l.extwz r3, r3 -#endif - l.ff1 r11, r3 - l.jr lr - l.nop -END(__ffssi2) -STRONG_ALIAS(ffs, __ffssi2) - -ENTRY_NP(__ffsdi2) -#ifdef _LP64 - l.ff1 r11, r3 - l.jr lr - l.nop -#else - l.sfeqi r4, 0 - l.bf 1f - l.nop - - l.ff1 r11, r4 - l.jr lr - l.nop - -1: l.ff1 r11, r3 - l.addi r11, r11, 32 - l.jr lr - l.nop -#endif -END(__ffsdi2) diff --git a/common/lib/libc/arch/or1k/string/memcmp.S b/common/lib/libc/arch/or1k/string/memcmp.S deleted file mode 100644 index 85ccd29dd..000000000 --- a/common/lib/libc/arch/or1k/string/memcmp.S +++ /dev/null @@ -1,213 +0,0 @@ -/* $NetBSD: memcmp.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * - * - * int memcmp(const char *s1, const char *s2, size_t n); - * - * for (; n-- != 0; s1++, s2++) { - * if (*s1 < *s2) - * return -1; - * if (*s1 > *s2) - * return 1; - * } - * return 0; - * - * Return: ((s1 > s2) ? 1 : (s1 < s2) ? -1 : 0) - * - * ========================================================================== - */ - -#include - - .text - .align 4 -/* LINTSTUB: Func: void *memcmp(const void *, const void *, size_t) */ -ENTRY(memcmp) - - /* - * Check count passed in R5. If zero, return 0; otherwise continue. - */ - l.sfeqi r5, 0 /* nothing to compare? */ - l.bf .Lret_0 /* yes, return equality */ - l.nop - -#ifdef _KERNEL - l.sfeqi r5, 6 /* less than two words? */ - l.bnf .Lsixbyte_compare /* yes, just compare by bytes */ - l.nop -#endif - - l.sfgesi r5, 7 /* less than two words? */ - l.bnf .Lbyte_compare /* yes, just compare by bytes */ - l.nop - - l.xor r6, r3, r4 /* check alignment compatibility */ - l.andi r6, r6, 3 /* only care about the two bits */ - l.sfeqi r6, 0 /* same alignment? */ - l.bnf .Lmisaligned /* no, avoid alignment errors */ - l.nop - - /* - * At this point, we know we read the data via word accesses. - */ - - l.andi r7, r3, 3 /* check alignment */ - l.sfeqi r7, 0 /* word aligned? */ - l.bf .Lword_compare /* yes, it is. */ - - l.sub r3, r3, r7 /* align string 1 */ - l.sub r4, r4, r7 /* align string 2 */ - l.add r5, r5, r7 /* pad length */ - - l.lwz r15, 0(r3) /* load word from s1 */ - l.lwz r17, 0(r4) /* load word from s2 */ - - l.slli r7, r7, 3 /* bytes to bits */ - l.sll r15, r15, r7 /* shift away leading bytes */ - l.sll r17, r17, r7 /* shift away leading bytes */ - l.j .Lword_compare /* now we can compare them */ - l.nop - -.Lword_loop: - l.lwz r15, 0(r3) /* load s1 word */ - l.lwz r17, 0(r4) /* load s2 word */ -.Lword_compare: - l.sfeq r15, r17 /* compare s1 and s2 words */ - l.bnf .Lall_done /* different? we're done */ - - l.addi r3, r3, 4 /* advance s1 one word */ - l.addi r4, r4, 4 /* advance s2 one word */ - l.addi r5, r5, -4 /* decrement one word */ - l.sfgtsi r5, 4 /* at least more than a word? */ - l.bf .Lword_loop /* yes, loop around */ - l.nop - l.sfeqi r5, 0 /* nothing left? */ - l.bf .Lret_0 /* yes, return equality */ - l.nop - - /* - * Fall through to handle the last word - */ - - l.sub r3, r0, r5 /* If count <= 4, handle */ - l.andi r3, r3, 3 /* mask off low 2 bits */ - l.slli r3, r3, 3 /* count *= 8 */ - l.srl r15, r15, r3 /* discard extra s1 bytes */ - l.srl r17, r17, r3 /* discard extra s2 bytes */ - - l.sfeq r17, r15 /* compare result */ - l.bnf .Lall_done -.Lret_0: - l.addi r11, r0, 0 - l.jr lr - l.nop - -/* - * The two string don't have the same word alignment. - */ -.Lmisaligned: - l.sfeqi r6, 2 /* check for halfword alignment */ - l.bnf .Lbyte_compare - l.nop - l.andi r7, r3, 1 - l.sfeqi r7, 0 - l.bf .Lhalfword_loop - l.nop - l.addi r5, r5, 1 - l.addi r3, r3, -1 - l.addi r4, r4, -1 - l.lbz r15, 1(r3) - l.lbz r17, 1(r4) - l.j .Lhalfword_compare - l.nop -.Lhalfword_loop: - l.lhz r15, 0(r3) - l.lhz r17, 0(r4) -.Lhalfword_compare: - l.sfeq r15, r17 - l.bnf .Lall_done - l.nop - l.addi r3, r3, 2 - l.addi r4, r4, 2 - l.addi r5, r5, -2 - l.sfgesi r5, 2 - l.bf .Lhalfword_loop - l.nop - -.Lbyte_compare: - l.addi r5, r5, -1 - l.sfgesi r5, 0 - l.bnf .Lret_0 - l.nop - l.lbz r15, 0(r3) - l.lbz r17, 0(r4) - l.addi r3, r3, 1 - l.addi r4, r4, 1 - l.sfeq r15, r17 - l.bf .Lbyte_compare - l.nop - -.Lall_done: - l.sub r11, r15, r17 /* subtract s2 from s1 */ - l.srai r11, r11, 30 /* replicate sign bit thru bit 1 */ - l.ori r11, r11, 1 /* make sure bit 0 is set */ - l.jr lr - l.nop - -#ifdef _KERNEL -.Lsixbyte_compare: - l.or r7, r3, r4 - l.andi r7, r7, 1 - l.sfeqi r7, 0 - l.bnf .Lbyte_compare - l.nop - l.lhz r15, 0(r3) - l.lhz r17, 0(r4) - l.sfeq r15, r17 - l.bnf .Lall_done - l.nop - l.lhz r15, 2(r3) - l.lhz r17, 2(r4) - l.sfeq r15, r17 - l.bnf .Lall_done - l.nop - l.lhz r15, 4(r3) - l.lhz r17, 4(r4) - l.sfeq r15, r17 - l.bnf .Lall_done - l.nop - l.addi r11, r0, 0 - l.jr lr - l.nop -#endif -END(memcmp) diff --git a/common/lib/libc/arch/or1k/string/memcpy.c b/common/lib/libc/arch/or1k/string/memcpy.c deleted file mode 100644 index 6be57836c..000000000 --- a/common/lib/libc/arch/or1k/string/memcpy.c +++ /dev/null @@ -1,135 +0,0 @@ -/* $NetBSD: memcpy.c,v 1.1 2014/09/03 19:34:25 matt Exp $ */ -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -__RCSID("$NetBSD: memcpy.c,v 1.1 2014/09/03 19:34:25 matt Exp $"); - -#include -#include -#include - -static inline unsigned long -combine_words(unsigned long w1, unsigned long w2, int shift1, int shift2) -{ -#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ - return (w1 << shift1) | (w2 >> shift2); -#else - return (w1 >> shift1) | (w2 << shift2); -#endif -} - -void * -memcpy(void * restrict a, const void * restrict b, size_t len) -{ - const unsigned char *cb = b; - unsigned char *ca = a; - - if (len == 0) - return a; - - /* - * Make sure the destination is long aligned. - */ - while ((uintptr_t)ca & (sizeof(long) - 1)) { - *ca++ = *cb++; - if (--len == 0) - return a; - } - - unsigned long *la = (long *)ca; - const int offset = (uintptr_t)cb & (sizeof(*la) - 1); - const unsigned long *lb = (const unsigned long *) (cb - offset); - unsigned long * const ea = la + len / sizeof(*la); - - if (offset == 0) { - /* - * a & b are now both long alignment. - * First try to copy 4 longs at a time, - */ - for (; la + 4 <= ea; la += 4, lb += 4) { - la[0] = lb[0]; - la[1] = lb[1]; - la[2] = lb[2]; - la[3] = lb[3]; - } - /* - * Now try to copy one long at a time. - */ - while (la <= ea) { - *la++ = *lb++; - } - } else { - const int shift1 = offset * 8; - const int shift2 = sizeof(*la) * 8 - shift1; - unsigned long w1 = *lb++; - - /* - * We try to write 4 words per loop. - */ - for (; la + 4 <= ea; la += 4, lb += 4) { - unsigned long w2 = lb[0]; - - la[0] = combine_words(w1, w2, shift1, shift2); - - w1 = lb[1]; - - la[1] = combine_words(w2, w1, shift1, shift2); - - w2 = lb[2]; - - la[2] = combine_words(w1, w2, shift1, shift2); - - w1 = lb[3]; - - la[3] = combine_words(w2, w1, shift1, shift2); - } - - /* - * Now try to copy one long at a time. - */ - while (la <= ea) { - unsigned long w2 = *lb++; - - *la++ = combine_words(w1, w2, shift1, shift2); - - w1 = w2; - } - } - len &= sizeof(*la) - 1; - if (len) { - cb = (const unsigned char *)lb + offset; - ca = (unsigned char *)la; - while (len-- > 0) { - *ca++ = *cb++; - } - } - return a; -} diff --git a/common/lib/libc/arch/or1k/string/memmove.S b/common/lib/libc/arch/or1k/string/memmove.S deleted file mode 100644 index a79268cc8..000000000 --- a/common/lib/libc/arch/or1k/string/memmove.S +++ /dev/null @@ -1,218 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/* stropt/memmove.S, pl_string_common, pl_linux 10/11/04 11:45:37 - * ========================================================================== - * Optimized memmove implementation for IBM PowerPC 405/440. - * - * Copyright (c) 2003, IBM Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * * Neither the name of IBM nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ========================================================================== - * - * Function: Move memory area (handles overlapping regions) - * - * void *memmove(void * dest, const void * src, int n) - * - * Input: r3 - destination address - * r4 - source address - * r5 - byte count - * Output: r11 - destination address - * - * ========================================================================== - */ - -#include - -#ifdef _BCOPY -/* bcopy = memcpy/memmove with arguments reversed. */ -/* LINTSTUB: Func: void bcopy(void *, void *, size_t) */ -ENTRY(bcopy) - l.or r6, r3, r0 /* swap src/dst */ - l.or r3, r4, r0 - l.or r4, r6, r0 -#else -/* LINTSTUB: Func: void *memmove(void *, const void *, size_t) */ -ENTRY(memmove) -#endif - - l.or r11, r3, r0 /* Save dst (return value) */ - - l.sfges r4, r3 /* Branch to reverse if */ - l.bnf .Lreverse /* src < dest. Don't want to */ - /* overwrite end of src with */ - /* start of dest */ - - l.addi r4, r4, -4 /* Back up src and dst pointers */ - l.addi r3, r3, -4 /* due to auto-update of 'load' */ - - l.srli r13, r5, 2 /* How many words in total cnt */ - l.sfeqi r13, 0 - l.bf .Llast1 /* Handle byte by byte if < 4 */ - /* bytes total */ - l.lwz r7, 4(r4) /* Preload first word */ - l.addi r4, r4, 4 - - l.j .Lg1 - l.nop - -.Lg0: /* Main loop */ - - l.lwz r7, 4(r4) /* Load a new word */ - l.sw 4(r3), r6 /* Store previous word */ - l.addi r4, r4, 4 /* advance */ - l.addi r3, r3, 4 /* advance */ - -.Lg1: - - l.addi r13, r13, -1 - l.sfeqi r13, 0 - l.bf .Llast /* Dec cnt, and branch if just */ - l.nop - /* one word to store */ - l.lwz r6, 4(r4) /* Load another word */ - l.sw 4(r3), r7 /* Store previous word */ - l.addi r4, r4, 4 /* advance to next word */ - l.addi r3, r3, 4 /* advance to next word */ - l.addi r13, r13, -1 /* Decrement count */ - l.sfeqi r13, 0 /* last word? */ - l.bnf .Lg0 /* no, loop, more words */ - l.nop - - l.or r7, r6, r0 /* If word count -> 0, then... */ - -.Llast: - - l.sw 4(r3), r7 /* ... store last word */ - l.addi r3, r3, 4 - -.Llast1: /* Byte-by-byte copy */ - - l.andi r5, r5, 3 /* get remaining byte count */ - l.sfeqi r5, 0 /* is it 0? */ - l.bf .Ldone /* yes, we're done */ - l.nop /* -- delay slot -- */ - - l.lbz r6, 4(r4) /* 1st byte: update addr by 4 */ - l.sb 4(r3), r6 /* since we pre-adjusted by 4 */ - l.addi r4, r4, 4 /* advance to next word */ - l.addi r3, r3, 4 /* advance to next word */ - l.addi r5, r5, -1 /* decrement count */ - l.sfeqi r5, 0 /* is it 0? */ - l.bf .Ldone /* yes, we're done */ - l.nop /* -- delay slot -- */ - -.Llast2: - - l.lbz r6, 1(r4) /* But handle the rest by */ - l.sb 1(r3), r6 /* updating addr by 1 */ - l.addi r4, r4, 1 /* advance to next word */ - l.addi r3, r3, 1 /* advance to next word */ - l.addi r5, r5, -1 /* decrement count */ - l.sfeqi r5, 0 /* is it 0? */ - l.bnf .Llast2 /* yes, we're done */ - l.nop /* -- delay slot -- */ -.Ldone: - l.jr lr /* return */ - l.nop /* -- delay slot -- */ - - /* We're here since src < dest. Don't want to overwrite end of */ - /* src with start of dest */ - -.Lreverse: - - l.add r4, r4, r5 /* Work from end to beginning */ - l.add r3, r3, r5 /* so add count to string ptrs */ - l.srli r13, r5, 2 /* Words in total count */ - l.sfeqi r13, 0 - l.bf .Lrlast1 /* Handle byte by byte if < 4 */ - /* bytes total */ - l.nop - - l.lwz r7, -4(r4) /* Preload first word */ - l.addi r4, r4, -4 /* update pointer */ - - l.j .Lrg1 - -.Lrg0: /* Main loop */ - - l.lwz r7, -4(r4) /* Load a new word */ - l.sw -4(r3), r6 /* Store previous word */ - l.addi r4, r4, -4 - l.addi r3, r3, -4 - -.Lrg1: - - l.addi r13, r13, -1 /* decrement count */ - l.sfeqi r13, 0 /* just one pending word left? */ - l.bf .Lrlast /* yes, deal with it */ - - l.lwz r6, -4(r4) /* Load another word */ - l.sw -4(r3), r7 /* Store previous word */ - l.addi r4, r4, -4 - l.addi r3, r3, -4 - - l.addi r13, r13, -1 /* decrement count */ - l.sfeqi r13, 0 /* just one pending word left? */ - l.bnf .Lrg0 /* no, loop again more words */ - l.nop - - l.or r7, r6, r0 /* If word count -> 0, then... */ - -.Lrlast: - - l.sw -4(r3), r7 /* ... store last word */ - l.addi r3, r3, -4 /* update pointer */ - -.Lrlast1: /* Byte-by-byte copy */ - - l.andi r5, r5, 3 - l.sfeqi r5, 0 - l.bf .Lrdone - -.Lrlast2: - - l.lbz r6, -1(r4) /* Handle the rest, byte by */ - l.sb -1(r3), r6 /* byte */ - l.addi r4, r4, -1 - l.addi r3, r3, -1 - l.addi r5, r5, -1 /* decrement count */ - l.sfeqi r5, 0 /* is it 0? */ - l.bnf .Lrlast2 /* no, loop again */ - l.nop -.Lrdone: - l.jr lr - l.nop - -#ifdef _BCOPY -END(bcopy) -#else -END(memmove) -#endif diff --git a/common/lib/libc/arch/or1k/string/memset.S b/common/lib/libc/arch/or1k/string/memset.S deleted file mode 100644 index 928c6cbf7..000000000 --- a/common/lib/libc/arch/or1k/string/memset.S +++ /dev/null @@ -1,135 +0,0 @@ -/* $NetBSD: memset.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - - -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: memset.S,v 1.1 2014/09/03 19:34:25 matt Exp $") -#endif /* LIBC_SCCS && !lint */ - -/*----------------------------------------------------------------------*/ -/* - void bzero(void *b r3, size_t len r4); - void * memset(void *b r3, int c r4, size_t len r5); -*/ -/*----------------------------------------------------------------------*/ - - -#ifdef _BZERO -#define r_fill r0 -ENTRY(bzero) -#else -#define r_fill r4 -ENTRY(memset) -#endif -#ifdef _BZERO - l.ori r5, r4, 0 - l.or r4, r0, r0 -#else - l.or r11, r3, r0 /* move start to return value */ -#endif - l.sfeqi r5, 0 /* anything to do? */ - l.bf .Lret /* no, just return */ - l.nop - - l.sfgeui r5, 7 /* small buffer? */ - l.add r5, r5, r3 /* r5 is end pointer */ - l.bnf .Lbyte_fill /* yes. just byte fill */ - l.nop - -#ifndef _BZERO - // Let's see the fill type - l.sfeqi r4, 0 /* filling with 0? */ - l.bf .Lalignment_check /* don't to replicate */ - l.nop - l.extbz r4, r4 /* truncate to 8 bits */ - l.slli r13, r4, 8 /* shift left 8 bits */ - l.or r4, r4, r13 /* merge the two bytes */ - l.slli r13, r4, 16 /* shift left 16 bits */ - l.or r4, r4, r13 /* merge the two halves */ - -.Lalignment_check: -#endif - l.andi r13, r3, 3 /* get low bits of start */ - l.sfeqi r13, 0 /* word aligned? */ - l.bf .Lword_fill /* yes, start setting */ - l.nop - - l.add r5, r5, r13 /* increase length */ - l.sub r3, r3, r13 /* mask word aligned */ - l.slli r13, r13, 3 /* bytes to bits */ - l.addi r15, r13, -8 /* minus one byte */ - - l.lwz r6, 0(r3) /* get first word */ - l.movhi r7, 0xff00 /* 0xff000000 */ - l.sra r7, r7, r13 /* shift right align bytes */ - l.and r6, r6, r7 /* clear bytes to be filled */ -#ifndef _BZERO - l.srl r7, r_fill, r13 /* clear bytes to preserve */ - l.or r6, r6, r7 /* merge existing with new */ -#endif - l.sw 0(r3), r6 /* store first word */ - l.addi r3, r3, 4 /* advance to next word */ - l.addi r5, r5, -4 /* one less word to do */ - -.Lword_aligned: - l.srli r6, r5, 2 /* clear low two bits of len */ - l.srli r6, r6, 2 /* ... */ - l.sfgeu r3, r6 /* any more full words? */ - l.bf .Lend_fill /* no, handle the last bytes */ - l.nop - -.Lword_fill: - l.sw 0(r3), r_fill /* store a word */ - l.addi r3, r3, 4 /* advance */ - l.sfgeu r3, r6 /* any more full words? */ - l.bnf .Lword_fill /* yes, fill next word */ - l.nop - l.j .Lend_fill /* fill any leftover bytes */ - l.nop - -.Lbyte_fill: - l.sb 0(r3), r_fill /* store a byte */ - l.addi r3, r3, 1 /* advance */ -.Lend_fill: - l.sfeq r3, r5 /* at the end? */ - l.bnf .Lbyte_fill /* no, fill next byte */ - l.nop - -.Lret: - l.jr lr /* return */ - l.nop -#ifdef _BZERO -END(bzero) -#else -END(memset) -#endif diff --git a/common/lib/libc/arch/or1k/string/strlen.S b/common/lib/libc/arch/or1k/string/strlen.S deleted file mode 100644 index 3069e41cf..000000000 --- a/common/lib/libc/arch/or1k/string/strlen.S +++ /dev/null @@ -1,123 +0,0 @@ -/* $NetBSD: strlen.S,v 1.1 2014/09/03 19:34:25 matt Exp $ */ - -/*- - * Copyright (C) 2001 Martin J. Laubach - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*----------------------------------------------------------------------*/ - -#include - -__RCSID("$NetBSD: strlen.S,v 1.1 2014/09/03 19:34:25 matt Exp $"); - -/*----------------------------------------------------------------------*/ -/* The algorithm here uses the following techniques: - - 1) Given a word 'x', we can test to see if it contains any 0 bytes - by subtracting 0x01010101, and seeing if any of the high bits of each - byte changed from 0 to 1. This works because the least significant - 0 byte must have had no incoming carry (otherwise it's not the least - significant), so it is 0x00 - 0x01 == 0xff. For all other - byte values, either they have the high bit set initially, or when - 1 is subtracted you get a value in the range 0x00-0x7f, none of which - have their high bit set. The expression here is - (x + 0xfefefeff) & ~(x | 0x7f7f7f7f), which gives 0x00000000 when - there were no 0x00 bytes in the word. - - 2) Given a word 'x', we can test to see _which_ byte was zero by - calculating ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f). - This produces 0x80 in each byte that was zero, and 0x00 in all - the other bytes. The '| 0x7f7f7f7f' clears the low 7 bits in each - byte, and the '| x' part ensures that bytes with the high bit set - produce 0x00. The addition will carry into the high bit of each byte - iff that byte had one of its low 7 bits set. We can then just see - which was the most significant bit set and divide by 8 to find how - many to add to the index. - This is from the book 'The PowerPC Compiler Writer's Guide', - by Steve Hoxey, Faraydon Karim, Bill Hay and Hank Warren. -*/ -/*----------------------------------------------------------------------*/ - -ENTRY(strlen) - - l.or r12, r3, r0 /* save start */ - - /* Setup constants */ - l.movhi r13, 0x7f7f - l.movhi r15, 0xfefe - l.ori r13, r13, 0x7f7f - l.ori r15, r15, 0xfeff - -1: l.andi r7, r12, 3 /* get low bits of start */ - l.sfeqi r7, 0 /* all clear? */ - l.bf 3f /* yes, skip alignment */ - l.nop /* -- delay slot -- */ - - l.sub r12, r12, r7 /* word align start */ - l.lwz r8, 0(r12) /* load data */ - l.addi r6, r0, -1 /* r6 = 0xffffffff */ - l.slli r5, r7, 3 /* bits to bytes */ - l.srl r6, r6, r5 /* clear low (MSB) bytes */ - l.xori r6, r6, -1 /* complement */ - l.or r8, r8, r6 /* merge with loaded word */ - l.j 4f /* and process */ - l.nop /* -- delay-slot -- */ - -2: l.addi r12, r12, 4 /* advance to next word */ -3: l.lwz r8, 0(r12) /* fetch data word */ - - // Step 1: (x + 0xfefefeff) & ~(x | 0x7f7f7f7f) -4: l.or r7, r8, r13 /* t0 = x | 0x7f7f7f7f */ - l.xori r6, r7, -1 /* t1 = ~t0 */ - l.add r5, r8, r15 /* t2 = x + 0xfefefeff */ - l.and r4, r7, r5 /* t3 = t1 & t2 */ - l.sfeqi r4, 0 - l.bf 2b /* no NUL bytes here */ - l.nop /* -- delay slot -- */ - - // Step 2: ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f) - l.and r7, r8, r13 /* t0 = x & 0x7f7f7f7f */ - l.or r6, r8, r13 /* t1 = x | 0x7f7f7f7f */ - l.add r5, r7, r13 /* t2 = t0 + 0x7f7f7f7f */ - l.or r4, r5, r6 /* t3 = t2 | t1 */ - l.xori r4, r4, -1 /* t3 = ~t3 */ - - l.fl1 r5, r4 /* find last bit set */ - l.ori r6, r0, 32 /* bits per word */ - l.sub r7, r6, r5 /* cvt to leading zeros */ - l.srli r8, r7, 3 /* shift to byte count */ - -Ldone: - l.add r12, r12, r8 /* r12 contains end pointer */ - - /* NOTE: Keep it so this function returns the end pointer - in r12, so we can it use from other str* calls (strcat - comes to mind */ - - l.sub r11, r12, r3 /* length = end - start */ - l.jr lr /* return */ - l.nop /* -- delay slot -- */ -END(strlen) -/*----------------------------------------------------------------------*/ diff --git a/common/lib/libc/arch/powerpc/atomic/Makefile.inc b/common/lib/libc/arch/powerpc/atomic/Makefile.inc deleted file mode 100644 index bc058908e..000000000 --- a/common/lib/libc/arch/powerpc/atomic/Makefile.inc +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.6 2009/01/04 17:54:29 pooka Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ - atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -SRCS+= atomic_init_cas.c - -.endif diff --git a/common/lib/libc/arch/powerpc/atomic/atomic_add.S b/common/lib/libc/arch/powerpc/atomic/atomic_add.S deleted file mode 100644 index e5d7ceb26..000000000 --- a/common/lib/libc/arch/powerpc/atomic/atomic_add.S +++ /dev/null @@ -1,73 +0,0 @@ -/* $NetBSD: atomic_add.S,v 1.8 2014/03/07 07:17:54 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -__RCSID("$NetBSD: atomic_add.S,v 1.8 2014/03/07 07:17:54 matt Exp $") - - .text -ATOMIC_OP_32(add) -ATOMIC_OP_32_NV(add) - -ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) - -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) - -#ifdef _LP64 -ATOMIC_OP_64(add) -ATOMIC_OP_64_NV(add) - -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_64_nv) - -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_64_nv) - -STRONG_ALIAS(_atomic_add_long,_atomic_add_64) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv) - -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv) -#else -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv) - -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) - -STRONG_ALIAS(_atomic_add_long,_atomic_add_32) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) - -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) -#endif diff --git a/common/lib/libc/arch/powerpc/atomic/atomic_and.S b/common/lib/libc/arch/powerpc/atomic/atomic_and.S deleted file mode 100644 index de31a314b..000000000 --- a/common/lib/libc/arch/powerpc/atomic/atomic_and.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: atomic_and.S,v 1.7 2014/03/07 07:17:54 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -__RCSID("$NetBSD: atomic_and.S,v 1.7 2014/03/07 07:17:54 matt Exp $") - - .text -ATOMIC_OP_32(and) -ATOMIC_OP_32_NV(and) - -ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) - -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) - -#if defined(_LP64) -ATOMIC_OP_64(and) -ATOMIC_OP_64_NV(and) - -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_64) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_64_nv) - -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64_nv) -#else -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) - -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) -#endif diff --git a/common/lib/libc/arch/powerpc/atomic/atomic_cas.S b/common/lib/libc/arch/powerpc/atomic/atomic_cas.S deleted file mode 100644 index 1d23b0cb7..000000000 --- a/common/lib/libc/arch/powerpc/atomic/atomic_cas.S +++ /dev/null @@ -1,95 +0,0 @@ -/* $NetBSD: atomic_cas.S,v 1.8 2014/03/07 07:17:54 matt Exp $ */ - -/*- - * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -__RCSID("$NetBSD: atomic_cas.S,v 1.8 2014/03/07 07:17:54 matt Exp $") - - .text -ENTRY(_atomic_cas_32) - mr %r10,%r3 -1: lwarx %r3,0,%r10 - cmpw %r3,%r4 - bnelr- - stwcx. %r5,0,%r10 - beqlr+ - b 1b -END(_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32) - -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) - -#if defined(_LP64) -ENTRY(_atomic_cas_64) - mr %r10,%r3 -1: ldarx %r3,0,%r10 - cmpd %r3,%r4 - bnelr- - stdcx. %r5,0,%r10 - beqlr+ - b 1b -END(_atomic_cas_64) - -ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_64_ni,_atomic_cas_64) - -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_64) - -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_64) - -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64) - -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64) -#else -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32) - -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32) - -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32) -#endif diff --git a/common/lib/libc/arch/powerpc/atomic/atomic_dec.S b/common/lib/libc/arch/powerpc/atomic/atomic_dec.S deleted file mode 100644 index 3e5c9f7f5..000000000 --- a/common/lib/libc/arch/powerpc/atomic/atomic_dec.S +++ /dev/null @@ -1,72 +0,0 @@ -/* $NetBSD: atomic_dec.S,v 1.7 2014/03/07 07:17:54 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -__RCSID("$NetBSD: atomic_dec.S,v 1.7 2014/03/07 07:17:54 matt Exp $") - .text -ATOMIC_OP_32_ARG(dec,addi,-1) -ATOMIC_OP_32_ARG_NV(dec,addi,-1) - -ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) - -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) - -#if defined(_LP64) -ATOMIC_OP_64_ARG(dec,addi,-1) -ATOMIC_OP_64_ARG_NV(dec,addi,-1) - -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_64_nv) - -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_64_nv) - -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64_nv) - -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_64_nv) -#else -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_32_nv) - -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_32_nv) - -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_32_nv) - -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_32_nv) -#endif diff --git a/common/lib/libc/arch/powerpc/atomic/atomic_inc.S b/common/lib/libc/arch/powerpc/atomic/atomic_inc.S deleted file mode 100644 index d98afaf8e..000000000 --- a/common/lib/libc/arch/powerpc/atomic/atomic_inc.S +++ /dev/null @@ -1,73 +0,0 @@ -/* $NetBSD: atomic_inc.S,v 1.7 2014/03/07 07:17:54 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -__RCSID("$NetBSD: atomic_inc.S,v 1.7 2014/03/07 07:17:54 matt Exp $") - - .text -ATOMIC_OP_32_ARG(inc,addi,1) -ATOMIC_OP_32_ARG_NV(inc,addi,1) - -ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) - -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) - -#if defined(_LP64) -ATOMIC_OP_64_ARG(inc,addi,1) -ATOMIC_OP_64_ARG_NV(inc,addi,1) - -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_64_nv) - -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_64_nv) - -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64_nv) - -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64_nv) -#else -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv) - -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv) - -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv) - -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv) -#endif diff --git a/common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h b/common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h deleted file mode 100644 index 9cf07062a..000000000 --- a/common/lib/libc/arch/powerpc/atomic/atomic_op_asm.h +++ /dev/null @@ -1,97 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.6 2014/03/07 07:17:54 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) - -#endif /* _KERNEL */ - -#define ATOMIC_OP_32_ARG(op,insn,arg) \ -ENTRY(_atomic_##op##_32) ; \ - mr %r10,%r3 ; \ -1: lwarx %r3,0,%r10 ; \ - insn %r5,%r3,arg ; \ - stwcx. %r5,0,%r10 ; \ - beqlr+ ; \ - b 1b ; \ -END(_atomic_##op##_32) ; \ -ATOMIC_OP_ALIAS(atomic_##op##_32,_atomic_##op##_32) - -#define ATOMIC_OP_64_ARG(op,insn,arg) \ -ENTRY(_atomic_##op##_64) ; \ - mr %r10,%r3 ; \ -1: ldarx %r3,0,%r10 ; \ - insn %r5,%r3,arg ; \ - stdcx. %r5,0,%r10 ; \ - beqlr+ ; \ - b 1b ; \ -END(_atomic_##op##_64) ; \ -ATOMIC_OP_ALIAS(atomic_##op##_64,_atomic_##op##_64) - -#define ATOMIC_OP_32_ARG_NV(op,insn,arg) \ -ENTRY(_atomic_##op##_32_nv) ; \ - mr %r10,%r3 ; \ -1: lwarx %r3,0,%r10 ; \ - insn %r3,%r3,arg ; \ - stwcx. %r3,0,%r10 ; \ - beqlr+ ; \ - b 1b ; \ -END(_atomic_##op##_32_nv) ; \ -ATOMIC_OP_ALIAS(atomic_##op##_32_nv,_atomic_##op##_32_nv) - -#define ATOMIC_OP_64_ARG_NV(op,insn,arg) \ -ENTRY(_atomic_##op##_64_nv) ; \ - mr %r10,%r3 ; \ -1: ldarx %r3,0,%r10 ; \ - insn %r3,%r3,arg ; \ - stdcx. %r3,0,%r10 ; \ - beqlr+ ; \ - b 1b ; \ -END(_atomic_##op##_64_nv) ; \ -ATOMIC_OP_ALIAS(atomic_##op##_64_nv,_atomic_##op##_64_nv) - -#define ATOMIC_OP_32(op) ATOMIC_OP_32_ARG(op,op,%r4) -#define ATOMIC_OP_32_NV(op) ATOMIC_OP_32_ARG_NV(op,op,%r4) - -#define ATOMIC_OP_64(op) ATOMIC_OP_64_ARG(op,op,%r4) -#define ATOMIC_OP_64_NV(op) ATOMIC_OP_64_ARG_NV(op,op,%r4) - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/powerpc/atomic/atomic_or.S b/common/lib/libc/arch/powerpc/atomic/atomic_or.S deleted file mode 100644 index 54c50ece4..000000000 --- a/common/lib/libc/arch/powerpc/atomic/atomic_or.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: atomic_or.S,v 1.7 2014/03/07 07:17:54 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -__RCSID("$NetBSD: atomic_or.S,v 1.7 2014/03/07 07:17:54 matt Exp $") - - .text -ATOMIC_OP_32(or) -ATOMIC_OP_32_NV(or) - -ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) - -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) - -#if defined(_LP64) -ATOMIC_OP_64(or) -ATOMIC_OP_64_NV(or) - -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_64) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_64_nv) - -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv) -#else -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) - -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) -#endif diff --git a/common/lib/libc/arch/powerpc/atomic/atomic_swap.S b/common/lib/libc/arch/powerpc/atomic/atomic_swap.S deleted file mode 100644 index 90523a572..000000000 --- a/common/lib/libc/arch/powerpc/atomic/atomic_swap.S +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: atomic_swap.S,v 1.7 2014/03/07 07:17:54 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -__RCSID("$NetBSD: atomic_swap.S,v 1.7 2014/03/07 07:17:54 matt Exp $") - - .text -ENTRY(_atomic_swap_32) - mr %r10,%r3 -1: lwarx %r3,0,%r10 - stwcx. %r4,0,%r10 - beqlr+ - b 1b -END(_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) - -ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) - -#if defined(_LP64) -ENTRY(_atomic_swap_64) - mr %r10,%r3 -1: ldarx %r3,0,%r10 - stdcx. %r4,0,%r10 - beqlr+ - b 1b -END(_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64) - -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_64) - -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64) -#else -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32) - -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) -#endif diff --git a/common/lib/libc/arch/powerpc/atomic/membar_ops.S b/common/lib/libc/arch/powerpc/atomic/membar_ops.S deleted file mode 100644 index dd103cfc9..000000000 --- a/common/lib/libc/arch/powerpc/atomic/membar_ops.S +++ /dev/null @@ -1,56 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.4 2011/01/15 07:31:11 matt Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe, and by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -__RCSID("$NetBSD: membar_ops.S,v 1.4 2011/01/15 07:31:11 matt Exp $") - - .text -/* These assume Total Store Order (TSO) */ - -ENTRY(_membar_consumer) - isync - blr -END(_membar_consumer) - -ENTRY(_membar_producer) - sync - blr -END(_membar_producer) - -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) -ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer) -ATOMIC_OP_ALIAS(membar_enter,_membar_consumer) -STRONG_ALIAS(_membar_enter,_membar_consumer) -ATOMIC_OP_ALIAS(membar_exit,_membar_producer) -STRONG_ALIAS(_membar_exit,_membar_producer) -ATOMIC_OP_ALIAS(membar_sync,_membar_producer) -STRONG_ALIAS(_membar_sync,_membar_producer) diff --git a/common/lib/libc/arch/powerpc/string/bcopy.S b/common/lib/libc/arch/powerpc/string/bcopy.S deleted file mode 100644 index 35582a8fa..000000000 --- a/common/lib/libc/arch/powerpc/string/bcopy.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: bcopy.S,v 1.1 2008/02/21 17:35:47 garbled Exp $ */ - -#define _BCOPY -#include "memmove.S" diff --git a/common/lib/libc/arch/powerpc/string/ffs.S b/common/lib/libc/arch/powerpc/string/ffs.S deleted file mode 100644 index 9a8c31213..000000000 --- a/common/lib/libc/arch/powerpc/string/ffs.S +++ /dev/null @@ -1,45 +0,0 @@ -/* $NetBSD: ffs.S,v 1.5 2011/01/15 07:31:12 matt Exp $ */ - -/*- - * Copyright (C) 2001 Martin J. Laubach - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*----------------------------------------------------------------------*/ - -#include - -__RCSID("$NetBSD: ffs.S,v 1.5 2011/01/15 07:31:12 matt Exp $") - - .align 4 -ENTRY(ffs) - neg %r4, %r3 - and %r3, %r4, %r3 - cntlzw %r3, %r3 - li %r0, 32 - subf %r3, %r3, %r0 - blr -END(ffs) - -/*----------------------------------------------------------------------*/ diff --git a/common/lib/libc/arch/powerpc/string/memcmp.S b/common/lib/libc/arch/powerpc/string/memcmp.S deleted file mode 100644 index cac9a87bf..000000000 --- a/common/lib/libc/arch/powerpc/string/memcmp.S +++ /dev/null @@ -1,270 +0,0 @@ -/* $NetBSD: memcmp.S,v 1.4 2013/07/04 20:57:59 matt Exp $ */ - -/* stropt/memcmp.S, pl_string_common, pl_linux 10/11/04 11:45:35 - * ========================================================================== - * Optimized memcmp implementation for IBM PowerPC 405/440. - * - * Copyright (c) 2003, IBM Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * * Neither the name of IBM nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ========================================================================== - * - * Function: Compare two character strings (up to n characters) - * - * int memcmp(const char *s1, const char *s2, int n) - * - * Input: r3 - buffer 1 address - * r4 - buffer 2 address - * r5 - maximum characters to compare - * Output: r3 <0 (less), 0 (equal), >0 (greater) - * - * ========================================================================== - */ - -#include - - .text - .align 4 -/* LINTSTUB: Func: void *memcmp(const void *, const void *, size_t) */ -ENTRY(memcmp) - - /* - * Check count passed in R5. If zero, return 0; otherwise continue. - */ - cmpwi %r5,0 - beq- ret_0; - - /* - * Most of the time the difference is found in the first - * several bytes. The following code minimizes the number - * of load operations for short compares. - */ - - mr %r11, %r3 /* Save buffer 1 */ - -again: - - not %r10, %r4 /* buffer 2: bytes to page bdy */ - rlwinm. %r10, %r10,29,23,31 /* buffer 2: dwords to page bdy */ - beq- bytebybyte /* If < 8 bytes to the page bdy */ - /* do byte by byte */ - lwz %r8, 0(%r4) /* load 1st buffer 2 word */ - - not %r12, %r11 /* buffer 1: bytes to page bdy */ - rlwinm. %r12, %r12,29,23,31 /* buffer 1: dwords to page bdy */ - beq- bytebybyte /* If < 8 bytes to the page bdy */ - /* do byte by byte */ - lwz %r6, 0(%r11) /* load 1st buffer 1 word */ - - cmpwi %r5, 4 /* If remaining count <= 4 */ - ble+ first4 /* handle specially. DWG */ - - cmplw %r8, %r6 /* compare buffer 2 and buffer 1*/ - bne+ all_done /* different => we're done */ - - lwzu %r9, 4(%r4) /* load 2nd buffer 2 word */ - lwzu %r7, 4(%r11) /* load 2nd buffer 1 word */ - - cmpwi %r5, 8 /* If remaining count <= 8 */ - ble+ last4 /* handle specially. DWG */ - - cmplw %r9, %r7 /* compare buffer 2 and buffer 1*/ - bne+ all_done /* different => we're done */ - - addi %r5, %r5, -8 /* Update character counter DWG */ - addi %r10, %r4, 0x0004 /* DWG*/ - not %r10, %r10 /* buffer 2: bytes to page bdy DWG */ - rlwinm. %r10, %r10,29,23,31 /* buffer 2: dwords to page bdy DWG */ - addi %r12, %r11, 0x0004 /* DWG */ - not %r12, %r12 /* buffer 1: bytes to page bdy DWG */ - rlwinm. %r12, %r12,29,23,31 /* buffer 1: dwords to page bdy DWG */ - - /* The following section prior to loop: figures out whether */ - /* the buffer 1 or buffer 2 is closer to the page boundary. */ - /* The main loop count is then set up to reflect the number of */ - /* double words of the buffer that is closest */ - - cmpw %r10, %r12 /* Find closest */ - blt lt - - mr %r10, %r12 - -lt: - - srwi %r12, %r5, 3 /* Double check the total count */ - cmpw %r10, %r12 /* limitation */ - blt lt2 - - mr %r10, %r12 /* DWG */ -lt2: /* DWG */ - cmpwi %r10, 0 /* DWG */ - bne lt3 /* DWG */ - addi %r4, %r4, 0x0004 /* DWG */ - addi %r11,%r11,0x0004 /* DWG */ - b again /* DWG */ -lt3: /* DWG */ - mtctr %r10 /* dword count for loop */ - lwzu %r6, 4(%r11) /* pre-load buffer 1 word */ - - b in /* To the loop */ - -loop: /* main loop */ - - cmplw %r8, %r6 /* Compare first buffer 2 word */ - bne- all_done /* with first buffer 1 word */ - /* If different, we're done */ - cmplw %r9, %r7 /* Compare second buffer 2 word */ - /* with second buffer 1 word */ - lwzu %r6, 4(%r11) /* pre-load buffer 1 word */ - - bne- all_done /* If different, we're done */ - -in: - - lwzu %r7, 4(%r11) /* pre-load buffer 1 word */ - lwzu %r8, 4(%r4) /* pre-load buffer 2 word */ - lwzu %r9, 4(%r4) /* pre-load buffer 2 word */ - - bdnz+ loop /* Do more DW's if cnt > 0 */ - - /*mfctr %r12*/ /*DWG*/ /* number of dwords left */ - /*subf %r10, %r12, %r10*/ /*DWG*//* number of dwords compared */ - slwi %r10, %r10, 3 - subf %r5, %r10, %r5 /* adjust byte counter */ - /*bne+ partial*/ /*DWG*/ /* If less than 8 bytes, handle */ - /* specially */ - /*cmpwi %r5, 8*/ /* Removed. DWG */ - /*blt partial*/ /* Removed. DWG */ - - /*addic %r5, %r5, -8*/ /*DWG*/ /* Subtract two words from count*/ - - cmplw %r8, %r6 /* compare last dword */ - addi %r4, %r4, 4 - bne- all_done - - cmplw %r9, %r7 - addi %r11, %r11, 4 - bne- all_done - -bytebybyte: - - /* We've gotten close to a page boundary: do a byte-byte-byte - * compare for the following 8 bytes, and then go back to - * the full-word compare loop. - */ - - li %r3, 8 /* loop count */ - cmpw %r3, %r5 /* take min(8, counter) */ - ble f2 - - mr. %r3, %r5 - - beqlr - -f2: - - mtctr %r3 - subf %r5, %r3, %r5 /* adjust counter */ - -bbb: - - lbz %r6, 0(%r11) /* byte copy loop */ - - addi %r11, %r11, 1 - - lbz %r8, 0(%r4) - - addi %r4, %r4, 1 - - cmplw %r8, %r6 - - bdnzt eq, bbb - - bne all_done - - cmpwi %r5, 0 - bgt again /* handle the rest */ - - xor %r3,%r3,%r3 - - blr - -#if 0 /* Removed code section. DWG */ -partial: - - mr. %r3, %r5 - - beqlr /* If count -> 0, we're done */ - -f1: - - subfic %r3, %r3, 4 /* zero/end in first word? */ - cmpwi %r3, 0 - blt last4 -#endif /* DWG */ - -first4: - subfic %r3, %r5, 4 /* If count <= 4, handle */ - rlwinm %r3, %r3, 3, 0, 31 /* count *= 8 */ - srw %r6, %r6, %r3 /* align 1st buffer 1 word */ - srw %r8, %r8, %r3 /* align 1st buffer 2 word */ - - cmplw %r8, %r6 /* get result */ - bne all_done - xor %r3,%r3,%r3 - blr - -last4: - subfic %r10, %r5, 8 /*DWG*/ - rlwinm %r10, %r10, 3, 0, 31 /* count *= 8 */ - srw %r7, %r7, %r10 /* align 2nd buffer 1 word */ - srw %r9, %r9, %r10 /* align 2nd buffer 2 word */ - - cmplw %r9, %r7 /* get result */ - bne all_done -ret_0: - xor %r3,%r3,%r3 /* Equal result */ - blr - -all_done: - - blt finish_lt - - addi %r3,0,-1 /* Less than result */ - - blr - -finish_lt: - - addi %r3,0,1 /* Greater than result */ - - blr -END(memcmp) diff --git a/common/lib/libc/arch/powerpc/string/memcpy.S b/common/lib/libc/arch/powerpc/string/memcpy.S deleted file mode 100644 index 0abaeb047..000000000 --- a/common/lib/libc/arch/powerpc/string/memcpy.S +++ /dev/null @@ -1,149 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.6 2014/03/04 17:05:14 macallan Exp $ */ - -/* stropt/memcpy_440.S, pl_string_common, pl_linux 10/11/04 11:45:36 - * ========================================================================== - * Optimized memcpy implementation for IBM PowerPC 440. - * - * Copyright (c) 2003, IBM Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * * Neither the name of IBM nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ========================================================================== - * - * Function: Copy n bytes of the source to the destination. Behavior is - * undefined for objects that overlap. - * - * - * void *memcpy(void * dest, const void * src, int n) - * - * Input: r3 - destination address - * r4 - source address - * r5 - byte count - * Output: r3 - destination address - * - * ========================================================================== - */ - -#include -#ifdef _KERNEL_OPT -#include "opt_ppcarch.h" -#endif - - .text - .align 4 -/* LINTSTUB: Func: void *memcpy(void *, const void *, size_t) */ -ENTRY(memcpy) - /* - * Check count passed in R5. If zero, return; otherwise continue. - */ - cmpwi %r5,0 - beqlr- - -#if defined(_KERNEL) && defined(PPC_OEA601) - /* - * 601 will generate alignment exceptions if operand crosses - * 4k page boundary, so do byte copy when exception handler - * not available. Maybe want to have a different memcpy for 601 - * that checks for page boundaries/word alignment... - */ - mfspr %r6, 287 /* mfpvbr %r6 PVR = 287 */ - srwi %r6, %r6, 0x10 /* get version field from PVR */ - cmpwi %r6, 0x1 /* 601 CPU = 0x0001 */ - bne bnorm /* skip byte-only unless 601 */ - - or %r6, %r3, %r4 /* see if both source and dest */ - andi. %r6, %r6, 3 /* are 32bit aligned */ - beq bnorm /* skip byte-only if they are */ -bcpy: - mtctr %r5 /* byte copy everything */ - li %r6, 0 -bloop: - lbzx %r7, %r4, %r6 - stbx %r7, %r3, %r6 - addi %r6, %r6, 1 - bdnz bloop - blr - -bnorm: - -#endif - - mr %r8, %r3 /* Copy dst (return value) */ - - addi %r4, %r4, -4 /* Prepare for main loop's auto */ - addi %r8, %r8, -4 /* update */ - - srwi. %r9,%r5,2 /* Word count -> r9 */ - beq- last1 /* Partial copy if <4 bytes */ - - mtctr %r9 /* Word cnt in CTR for loop */ - lwzu %r7, 4(%r4) /* Preload for main loop */ - - b g1 - -g0: /* Main loop */ - - lwzu %r7, 4(%r4) /* Load a new word */ - stwu %r6, 4(%r8) /* Store previous word */ - -g1: - - bdz- last /* Dec ctr and exit loop if no */ - /* more words */ - lwzu %r6, 4(%r4) /* Load another word */ - stwu %r7, 4(%r8) /* Store previous word */ - bdnz+ g0 /* Dec ctr and continue loop if */ - /* more words */ - - mr %r7, %r6 - -last: - - stwu %r7, 4(%r8) /* Store last word */ - -last1: /* Byte-by-byte copy */ - - clrlwi. %r5,%r5,30 - beqlr - - mtctr %r5 - - lbzu %r6, 4(%r4) /* 1st byte: update by word */ - stbu %r6, 4(%r8) - bdzlr- - -last2: - - lbzu %r6, 1(%r4) /* Handle the rest */ - stbu %r6, 1(%r8) - bdnz+ last2 - - blr -END(memcpy) diff --git a/common/lib/libc/arch/powerpc/string/memmove.S b/common/lib/libc/arch/powerpc/string/memmove.S deleted file mode 100644 index cd676ca92..000000000 --- a/common/lib/libc/arch/powerpc/string/memmove.S +++ /dev/null @@ -1,182 +0,0 @@ -/* $NetBSD: memmove.S,v 1.3 2011/01/15 07:31:12 matt Exp $ */ - -/* stropt/memmove.S, pl_string_common, pl_linux 10/11/04 11:45:37 - * ========================================================================== - * Optimized memmove implementation for IBM PowerPC 405/440. - * - * Copyright (c) 2003, IBM Corporation - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or - * without modification, are permitted provided that the following - * conditions are met: - * - * * Redistributions of source code must retain the above - * copyright notice, this list of conditions and the following - * disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following - * disclaimer in the documentation and/or other materials - * provided with the distribution. - * * Neither the name of IBM nor the names of its contributors - * may be used to endorse or promote products derived from this - * software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, - * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * ========================================================================== - * - * Function: Move memory area (handles overlapping regions) - * - * void *memmove(void * dest, const void * src, int n) - * - * Input: r3 - destination address - * r4 - source address - * r5 - byte count - * Output: r3 - destination address - * - * ========================================================================== - */ - -#include - - .text - .align 4 -#ifdef _BCOPY -/* bcopy = memcpy/memmove with arguments reversed. */ -/* LINTSTUB: Func: void bcopy(void *, void *, size_t) */ -ENTRY(bcopy) - mr %r6, %r3 /* swap src/dst */ - mr %r3, %r4 - mr %r4, %r6 -#else -/* LINTSTUB: Func: void *memmove(void *, const void *, size_t) */ -ENTRY(memmove) -#endif - - mr %r8, %r3 /* Save dst (return value) */ - - cmpw %r4, %r8 /* Branch to reverse if */ - blt reverse /* src < dest. Don't want to */ - /* overwrite end of src with */ - /* start of dest */ - - addi %r4, %r4, -4 /* Back up src and dst pointers */ - addi %r8, %r8, -4 /* due to auto-update of 'load' */ - - srwi. %r9,%r5,2 /* How many words in total cnt */ - beq- last1 /* Handle byte by byte if < 4 */ - /* bytes total */ - mtctr %r9 /* Count of words for loop */ - lwzu %r7, 4(%r4) /* Preload first word */ - - b g1 - -g0: /* Main loop */ - - lwzu %r7, 4(%r4) /* Load a new word */ - stwu %r6, 4(%r8) /* Store previous word */ - -g1: - - bdz- last /* Dec cnt, and branch if just */ - /* one word to store */ - lwzu %r6, 4(%r4) /* Load another word */ - stwu %r7, 4(%r8) /* Store previous word */ - bdnz+ g0 /* Dec cnt, and loop again if */ - /* more words */ - mr %r7, %r6 /* If word count -> 0, then... */ - -last: - - stwu %r7, 4(%r8) /* ... store last word */ - -last1: /* Byte-by-byte copy */ - - clrlwi. %r5,%r5,30 /* If count -> 0, then ... */ - beqlr /* we're done */ - - mtctr %r5 /* else load count for loop */ - - lbzu %r6, 4(%r4) /* 1st byte: update addr by 4 */ - stbu %r6, 4(%r8) /* since we pre-adjusted by 4 */ - bdzlr- /* in anticipation of main loop */ - -last2: - - lbzu %r6, 1(%r4) /* But handle the rest by */ - stbu %r6, 1(%r8) /* updating addr by 1 */ - bdnz+ last2 - - blr - - /* We're here since src < dest. Don't want to overwrite end of */ - /* src with start of dest */ - -reverse: - - add %r4, %r4, %r5 /* Work from end to beginning */ - add %r8, %r8, %r5 /* so add count to string ptrs */ - srwi. %r9,%r5,2 /* Words in total count */ - beq- rlast1 /* Handle byte by byte if < 4 */ - /* bytes total */ - - mtctr %r9 /* Count of words for loop */ - - lwzu %r7, -4(%r4) /* Preload first word */ - b rg1 - -rg0: /* Main loop */ - - lwzu %r7, -4(%r4) /* Load a new word */ - stwu %r6, -4(%r8) /* Store previous word */ - -rg1: - - bdz- rlast /* Dec cnt, and branch if just */ - /* one word to store */ - - lwzu %r6, -4(%r4) /* Load another word */ - stwu %r7, -4(%r8) /* Store previous word */ - - bdnz+ rg0 /* Dec cnt, and loop again if */ - /* more words */ - - mr %r7, %r6 /* If word count -> 0, then... */ - -rlast: - - stwu %r7, -4(%r8) /* ... store last word */ - -rlast1: /* Byte-by-byte copy */ - - clrlwi. %r5,%r5,30 /* If count -> 0, then... */ - beqlr /* ... we're done */ - - mtctr %r5 /* else load count for loop */ - -rlast2: - - lbzu %r6, -1(%r4) /* Handle the rest, byte by */ - stbu %r6, -1(%r8) /* byte */ - - bdnz+ rlast2 /* Dec ctr, and branch if more */ - /* bytes left */ - blr - -#ifdef _BCOPY -END(bcopy) -#else -END(memmove) -#endif diff --git a/common/lib/libc/arch/powerpc/string/strlen.S b/common/lib/libc/arch/powerpc/string/strlen.S deleted file mode 100644 index e822e89bc..000000000 --- a/common/lib/libc/arch/powerpc/string/strlen.S +++ /dev/null @@ -1,118 +0,0 @@ -/* $NetBSD: strlen.S,v 1.6 2011/01/15 07:31:12 matt Exp $ */ - -/*- - * Copyright (C) 2001 Martin J. Laubach - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/*----------------------------------------------------------------------*/ - -#include - -__RCSID("$NetBSD: strlen.S,v 1.6 2011/01/15 07:31:12 matt Exp $"); - -/*----------------------------------------------------------------------*/ -/* The algorithm here uses the following techniques: - - 1) Given a word 'x', we can test to see if it contains any 0 bytes - by subtracting 0x01010101, and seeing if any of the high bits of each - byte changed from 0 to 1. This works because the least significant - 0 byte must have had no incoming carry (otherwise it's not the least - significant), so it is 0x00 - 0x01 == 0xff. For all other - byte values, either they have the high bit set initially, or when - 1 is subtracted you get a value in the range 0x00-0x7f, none of which - have their high bit set. The expression here is - (x + 0xfefefeff) & ~(x | 0x7f7f7f7f), which gives 0x00000000 when - there were no 0x00 bytes in the word. - - 2) Given a word 'x', we can test to see _which_ byte was zero by - calculating ~(((x & 0x7f7f7f7f) + 0x7f7f7f7f) | x | 0x7f7f7f7f). - This produces 0x80 in each byte that was zero, and 0x00 in all - the other bytes. The '| 0x7f7f7f7f' clears the low 7 bits in each - byte, and the '| x' part ensures that bytes with the high bit set - produce 0x00. The addition will carry into the high bit of each byte - iff that byte had one of its low 7 bits set. We can then just see - which was the most significant bit set and divide by 8 to find how - many to add to the index. - This is from the book 'The PowerPC Compiler Writer's Guide', - by Steve Hoxey, Faraydon Karim, Bill Hay and Hank Warren. -*/ -/*----------------------------------------------------------------------*/ - - .text - .align 4 - -ENTRY(strlen) - - /* Setup constants */ - lis %r10, 0x7f7f - lis %r9, 0xfefe - ori %r10, %r10, 0x7f7f - ori %r9, %r9, 0xfeff - - /* Mask out leading bytes on non aligned strings */ - rlwinm. %r8, %r3, 3, 27, 28 /* leading bits to mask */ -#ifdef _LP64 - clrrdi %r5, %r3, 2 /* clear low 2 addr bits */ -#else - clrrwi %r5, %r3, 2 /* clear low 2 addr bits */ -#endif - li %r0, -1 - beq+ 3f /* skip alignment if already */ - /* aligned */ - - srw %r0, %r0, %r8 /* make 0000...1111 mask */ - - lwz %r7, 0(%r5) - nor %r0, %r0, %r0 /* invert mask */ - or %r7, %r7, %r0 /* make leading bytes != 0 */ - b 2f - -3: subi %r5, %r5, 4 - -1: lwzu %r7, 4(%r5) /* fetch data word */ - -2: nor %r0, %r7, %r10 /* do step 1 */ - add %r6, %r7, %r9 - and. %r0, %r0, %r6 - - beq+ 1b /* no NUL bytes here */ - - and %r8, %r7, %r10 /* ok, a NUL is somewhere */ - or %r7, %r7, %r10 /* do step 2 to find out */ - add %r0, %r8, %r10 /* where */ - nor %r8, %r7, %r0 - - cntlzw %r0, %r8 /* offset from this word */ - srwi %r4, %r0, 3 - - add %r4, %r5, %r4 /* r4 contains end pointer */ - /* NOTE: Keep it so this function returns the end pointer - in r4, so we can it use from other str* calls (strcat - comes to mind */ - - subf %r3, %r3, %r4 - blr -END(strlen) -/*----------------------------------------------------------------------*/ diff --git a/common/lib/libc/arch/powerpc64/atomic/Makefile.inc b/common/lib/libc/arch/powerpc64/atomic/Makefile.inc deleted file mode 100644 index a6b68726d..000000000 --- a/common/lib/libc/arch/powerpc64/atomic/Makefile.inc +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.7 2014/03/07 07:20:24 matt Exp $ - -.PATH: ${NETBSDSRCDIR}/common/lib/libc/arch/powerpc/atomic - -.include "${NETBSDSRCDIR}/common/lib/libc/arch/powerpc/atomic/Makefile.inc" diff --git a/common/lib/libc/arch/powerpc64/string/ffs.S b/common/lib/libc/arch/powerpc64/string/ffs.S deleted file mode 100644 index 4cce87c52..000000000 --- a/common/lib/libc/arch/powerpc64/string/ffs.S +++ /dev/null @@ -1,3 +0,0 @@ -/* $NetBSD: ffs.S,v 1.1 2006/07/07 07:37:44 ross Exp $ */ - -#include "../../powerpc/string/ffs.S" diff --git a/common/lib/libc/arch/powerpc64/string/strlen.S b/common/lib/libc/arch/powerpc64/string/strlen.S deleted file mode 100644 index 871907b5c..000000000 --- a/common/lib/libc/arch/powerpc64/string/strlen.S +++ /dev/null @@ -1,5 +0,0 @@ -/* $NetBSD: strlen.S,v 1.1 2006/07/07 07:37:44 ross Exp $ */ - -/* XXX could be optimized for ppc64 */ - -#include "../../powerpc/string/strlen.S" diff --git a/common/lib/libc/arch/riscv/atomic/Makefile.inc b/common/lib/libc/arch/riscv/atomic/Makefile.inc deleted file mode 100644 index 3159e6591..000000000 --- a/common/lib/libc/arch/riscv/atomic/Makefile.inc +++ /dev/null @@ -1,30 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.2 2014/10/16 18:52:17 dennis Exp $ - -.for op in add and cas nand or sub swap xor -sizes=32 -.if "${MLIBDIR}" != "" -.if ${COMMON_MACHINE_ARCH} == "riscv64" -sizes+=64 -.endif -.elif ${MACHINE_ARCH} == "riscv64" -sizes+=64 -.endif -.for sz in ${sizes} -SRCS.atomic+= atomic_${op}_${sz}.S -.endfor -.for sz in 8 16 -SRCS.atomic+= atomic_${op}_${sz}_cas.c -.endfor -.endfor -SRCS.atomic+= membar_ops.S -SRCS.atomic+= atomic_cas_by_cas32.c - -.if defined(LIB) && (${LIB} != "kern" && ${LIB} != "rump") - -SRCS.atomic+= atomic_init_cas.c \ - atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_8.c - -.endif #LIB - -SRCS+= ${SRCS.atomic} diff --git a/common/lib/libc/arch/riscv/atomic/atomic_add_32.S b/common/lib/libc/arch/riscv/atomic/atomic_add_32.S deleted file mode 100644 index 11a10efdc..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_add_32.S +++ /dev/null @@ -1,93 +0,0 @@ -/* $NetBSD: atomic_add_32.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_inc_32) - li a1, 1 -ENTRY_NP(_atomic_add_32) - amoadd.w.aq a0, a1, 0(a0) - ret -END(_atomic_add_32) -END(_atomic_inc_32) - -ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_32) -STRONG_ALIAS(_atomic_add_long,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_32) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_32) -#endif -CRT_ALIAS(__sync_fetch_and_add_4,_atomic_add_32) -CRT_ALIAS(__atomic_fetch_add_4,_atomic_add_32) - -ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_32) -#endif - -ENTRY_NP(_atomic_inc_32_nv) - li a1, 1 -ENTRY_NP(_atomic_add_32_nv) - amoadd.w.aq t0, a1, 0(a0) /* update memory and get old value */ - INT_ADD a0, t0, a1 /* turn into new value */ - ret -END(_atomic_add_32_nv) -END(_atomic_inc_32_nv) - -ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_32_nv) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_32_nv) -#endif -CRT_ALIAS(__sync_add_and_fetch_4,_atomic_add_32_nv) -CRT_ALIAS(__atomic_add_fetch_4,_atomic_add_32_nv) - -ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_32_nv) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_32_nv) -#endif diff --git a/common/lib/libc/arch/riscv/atomic/atomic_add_64.S b/common/lib/libc/arch/riscv/atomic/atomic_add_64.S deleted file mode 100644 index 5b701d271..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_add_64.S +++ /dev/null @@ -1,77 +0,0 @@ -/* $NetBSD: atomic_add_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_inc_64) - li a1, 1 -ENTRY_NP(_atomic_add_64) - amoadd.d.aq a0, a1, 0(a0) - ret -END(_atomic_add_64) -END(_atomic_inc_64) - -ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_long,_atomic_add_64) -STRONG_ALIAS(_atomic_add_long,_atomic_add_64) -ATOMIC_OP_ALIAS(atomic_add_ptr,_atomic_add_64) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64) -CRT_ALIAS(__sync_fetch_and_add_8,_atomic_add_64) -CRT_ALIAS(__atomic_fetch_add_8,_atomic_add_64) - -ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_ulong,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64) -ATOMIC_OP_ALIAS(atomic_inc_ptr,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64) - -ENTRY_NP(_atomic_inc_64_nv) - li a1, 1 -ENTRY_NP(_atomic_add_64_nv) - amoadd.d.aq t0, a1, 0(a0) /* update memory and get old value */ - LONG_ADD a0, t0, a1 /* turn into new value */ - ret -END(_atomic_add_64_nv) -END(_atomic_inc_64_nv) - -ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_long_nv,_atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv) -ATOMIC_OP_ALIAS(atomic_add_ptr_nv,_atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv) -CRT_ALIAS(__sync_add_and_fetch_8,_atomic_add_64_nv) -CRT_ALIAS(__atomic_add_fetch_8,_atomic_add_64_nv) - -ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_ulong_nv,_atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64_nv) -ATOMIC_OP_ALIAS(atomic_inc_ptr_nv,_atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_and_32.S b/common/lib/libc/arch/riscv/atomic/atomic_and_32.S deleted file mode 100644 index 10093df6f..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_and_32.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_and_32.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_and_32) - amoand.w.aq a0, a1, 0(a0) - ret -END(_atomic_and_32) - -ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_32) -#endif -CRT_ALIAS(__sync_fetch_and_and_4,_atomic_and_32) -CRT_ALIAS(__atomic_fetch_and_4,_atomic_and_32) - -ENTRY_NP(_atomic_and_32_nv) - amoand.w.aq t0, a1, 0(a0) /* update memory and get old value */ - and a0, t0, a1 /* turn into new value */ - ret -END(_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_32_nv) -#endif -CRT_ALIAS(__sync_and_and_fetch_4,_atomic_and_32_nv) -CRT_ALIAS(__atomic_and_fetch_4,_atomic_and_32_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_and_64.S b/common/lib/libc/arch/riscv/atomic/atomic_and_64.S deleted file mode 100644 index 71351a085..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_and_64.S +++ /dev/null @@ -1,54 +0,0 @@ -/* $NetBSD: atomic_and_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_and_64) - amoand.d.aq a0, a1, 0(a0) - ret -END(_atomic_and_64) - -ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64) -ATOMIC_OP_ALIAS(atomic_and_ulong,_atomic_and_64) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64) -CRT_ALIAS(__sync_fetch_and_and_8,_atomic_and_64) -CRT_ALIAS(__atomic_fetch_and_8,_atomic_and_64) - -ENTRY_NP(_atomic_and_64_nv) - amoand.d.aq t0, a1, 0(a0) /* update memory and get old value */ - and a0, t0, a1 /* turn into new value */ - ret -END(_atomic_and_64_nv) -ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64_nv) -ATOMIC_OP_ALIAS(atomic_and_ulong_nv,_atomic_and_64_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64_nv) -CRT_ALIAS(__sync_and_and_fetch_8,_atomic_and_64_nv) -CRT_ALIAS(__atomic_and_fetch_8,_atomic_and_64_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_cas_32.S b/common/lib/libc/arch/riscv/atomic/atomic_cas_32.S deleted file mode 100644 index 4df78315b..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_cas_32.S +++ /dev/null @@ -1,71 +0,0 @@ -/* $NetBSD: atomic_cas_32.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_cas_32) - mv t0, a0 -1: lr.w a0, 0(t0) - bne a1, a0, 2f - sc.w t1, a2, 0(t0) - bnez t1, 1b -2: - ret -END(_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32) -#endif -CRT_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32) - -ENTRY_NP(_atomic_bool_cas_32) - mv t0, a0 - li a0, 0 -1: lr.w t1, 0(t0) - bne a1, t1, 2f - sc.w t1, a2, 0(t0) - bnez t1, 1b - li a0, 1 -2: - ret -END(_atomic_bool_cas_32) - -ATOMIC_OP_ALIAS(atomic_bool_cas_32,_atomic_bool_cas_32) -CRT_ALIAS(__bool_val_compare_and_swap_4,_atomic_bool_cas_32) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_cas_64.S b/common/lib/libc/arch/riscv/atomic/atomic_cas_64.S deleted file mode 100644 index caedd8e77..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_cas_64.S +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: atomic_cas_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef _LP64 -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_cas_64) - mv t0, a0 -1: lr.d a0, 0(t0) - bne a1, a0, 2f - sc.d t1, a2, 0(t0) - bnez t1, 1b -2: - ret -END(_atomic_cas_64) - -ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64) - -CRT_ALIAS(__sync_val_compare_and_swap_8,_atomic_cas_64) - -ENTRY_NP(_atomic_bool_cas_64) - mv t0, a0 - li a0, 0 -1: lr.d t1, 0(t0) - bne a1, t1, 2f - sc.d t1, a2, 0(t0) - bnez t1, 1b - li a0, 1 -2: - ret -END(_atomic_bool_cas_64) - -ATOMIC_OP_ALIAS(atomic_bool_cas_64,_atomic_bool_cas_64) -CRT_ALIAS(__bool_val_compare_and_swap_8,_atomic_bool_cas_64) -#endif /* _LP64 */ diff --git a/common/lib/libc/arch/riscv/atomic/atomic_nand_32.S b/common/lib/libc/arch/riscv/atomic/atomic_nand_32.S deleted file mode 100644 index d6c95327c..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_nand_32.S +++ /dev/null @@ -1,71 +0,0 @@ -/* $NetBSD: atomic_nand_32.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_nand_32) - mv t0, a0 -1: lr.w a0, 0(t0) - not t2, a0 - and t2, t2, a1 - sc.w t1, t2, 0(t0) - bnez t1, 1b - ret -END(_atomic_nand_32) - -ATOMIC_OP_ALIAS(atomic_nand_32,_atomic_nand_32) -ATOMIC_OP_ALIAS(atomic_nand_uint,_atomic_nand_32) -STRONG_ALIAS(_atomic_nand_uint,_atomic_nand_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_nand_ulong,_atomic_nand_32) -STRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_32) -#endif -CRT_ALIAS(__sync_fetch_and_nand_4,_atomic_nand_32) -CRT_ALIAS(__atomic_fetch_nand_4,_atomic_nand_32) - -ENTRY_NP(_atomic_nand_32_nv) - mv t0, a0 -1: lr.w a0, 0(t0) - not a0, a0 - and a0, a0, a1 - sc.w t1, a0, 0(t0) - bnez t1, 1b - ret -END(_atomic_nand_32_nv) - -ATOMIC_OP_ALIAS(atomic_nand_32_nv,_atomic_nand_32_nv) -ATOMIC_OP_ALIAS(atomic_nand_uint_nv,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_uint_nv,_atomic_nand_32_nv) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_nand_ulong_nv,_atomic_nand_32_nv) -STRONG_ALIAS(_atomic_nand_ulong_nv,_atomic_nand_32_nv) -#endif -CRT_ALIAS(__sync_nand_and_fetch_4,_atomic_nand_32_nv) -CRT_ALIAS(__atomic_nand_fetch_4,_atomic_nand_32_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_nand_64.S b/common/lib/libc/arch/riscv/atomic/atomic_nand_64.S deleted file mode 100644 index 0756c6d9c..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_nand_64.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_nand_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_nand_64) - mv t0, a0 -1: lr.d a0, 0(t0) - not t2, a0 - and t2, t2, a1 - sc.d t1, t2, 0(t0) - bnez t1, 1b - ret -END(_atomic_nand_64) - -ATOMIC_OP_ALIAS(atomic_nand_64,_atomic_nand_64) -ATOMIC_OP_ALIAS(atomic_nand_ulong,_atomic_nand_64) -STRONG_ALIAS(_atomic_nand_ulong,_atomic_nand_64) -CRT_ALIAS(__sync_fetch_and_nand_8,_atomic_nand_64) -CRT_ALIAS(__atomic_fetch_nand_8,_atomic_nand_64) - -ENTRY_NP(_atomic_nand_64_nv) - mv t0, a0 -1: lr.d a0, 0(t0) - not a0, a0 - and a0, a0, a1 - sc.d t1, a0, 0(t0) - bnez t1, 1b - ret -END(_atomic_nand_64_nv) - -ATOMIC_OP_ALIAS(atomic_nand_64_nv,_atomic_nand_64_nv) -ATOMIC_OP_ALIAS(atomic_nand_ulong_nv,_atomic_nand_64_nv) -STRONG_ALIAS(_atomic_nand_ulong_nv,_atomic_nand_64_nv) -CRT_ALIAS(__sync_nand_and_fetch_8,_atomic_nand_64_nv) -CRT_ALIAS(__atomic_nand_fetch_8,_atomic_nand_64_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_op_asm.h b/common/lib/libc/arch/riscv/atomic/atomic_op_asm.h deleted file mode 100644 index fa43a94b3..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_op_asm.h +++ /dev/null @@ -1,54 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.2 2015/05/18 08:24:10 justin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) -#ifdef _LIBC -#define CRT_ALIAS(a,s) STRONG_ALIAS(a,s) -#endif - -#endif /* _KERNEL */ - -#ifndef CRT_ALIAS -#define CRT_ALIAS(a,s) -#endif - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/riscv/atomic/atomic_or_32.S b/common/lib/libc/arch/riscv/atomic/atomic_or_32.S deleted file mode 100644 index bad55b458..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_or_32.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_or_32.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_or_32) - amoor.w.aq a0, a1, 0(a0) - ret -END(_atomic_or_32) - -ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_32) -#endif -CRT_ALIAS(__sync_fetch_and_or_4,_atomic_or_32) -CRT_ALIAS(__atomic_fetch_or_4,_atomic_or_32) - -ENTRY_NP(_atomic_or_32_nv) - amoor.w.aq t0, a1, 0(a0) /* update memory and get old value */ - or a0, t0, a1 /* turn into new value */ - ret -END(_atomic_or_32_nv) - -ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_32_nv) -#endif -CRT_ALIAS(__sync_or_and_fetch_4,_atomic_or_32_nv) -CRT_ALIAS(__atomic_or_fetch_4,_atomic_or_32_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_or_64.S b/common/lib/libc/arch/riscv/atomic/atomic_or_64.S deleted file mode 100644 index b780179c9..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_or_64.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_or_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_or_64) - amoor.d.aq a0, a1, 0(a0) - ret -END(_atomic_or_64) - -ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64) -ATOMIC_OP_ALIAS(atomic_or_ulong,_atomic_or_64) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64) -CRT_ALIAS(__sync_fetch_and_or_8,_atomic_or_64) -CRT_ALIAS(__atomic_fetch_or_8,_atomic_or_64) - -ENTRY_NP(_atomic_or_64_nv) - amoor.d.aq t0, a1, 0(a0) /* update memory and get old value */ - or a0, t0, a1 /* turn into new value */ - ret -END(_atomic_or_64_nv) - -ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64_nv) -ATOMIC_OP_ALIAS(atomic_or_ulong_nv,_atomic_or_64_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv) -CRT_ALIAS(__sync_or_and_fetch_8,_atomic_or_64_nv) -CRT_ALIAS(__atomic_or_fetch_8,_atomic_or_64_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_sub_32.S b/common/lib/libc/arch/riscv/atomic/atomic_sub_32.S deleted file mode 100644 index 730f55b69..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_sub_32.S +++ /dev/null @@ -1,95 +0,0 @@ -/* $NetBSD: atomic_sub_32.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_dec_32) - li a1, 1 -ENTRY_NP(_atomic_sub_32) - INT_SUB t0, zero, a1 - amoadd.w.aq a0, t0, 0(a0) - ret -END(_atomic_sub_32) -END(_atomic_dec_32) - -ATOMIC_OP_ALIAS(atomic_sub_32,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_int,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_int,_atomic_sub_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_sub_long,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_long,_atomic_sub_32) -ATOMIC_OP_ALIAS(atomic_sub_ptr,_atomic_sub_32) -STRONG_ALIAS(_atomic_sub_ptr,_atomic_sub_32) -#endif -CRT_ALIAS(__sync_fetch_and_sub_4,_atomic_sub_32) -CRT_ALIAS(__atomic_fetch_sub_4,_atomic_sub_32) - -ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_32) -#endif - -ENTRY_NP(_atomic_dec_32_nv) - li a1, 1 -ENTRY_NP(_atomic_sub_32_nv) - INT_SUB t1, zero, a1 - amoadd.w.aq t0, t1, 0(a0) /* update memory and get old value */ - INT_ADD a0, t0, t1 /* turn into new value */ - ret -END(_atomic_sub_32_nv) -END(_atomic_dec_32_nv) - -ATOMIC_OP_ALIAS(atomic_sub_32_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_int_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_int_nv,_atomic_sub_32_nv) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_sub_long_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_long_nv,_atomic_sub_32_nv) -ATOMIC_OP_ALIAS(atomic_sub_ptr_nv,_atomic_sub_32_nv) -STRONG_ALIAS(_atomic_sub_ptr_nv,_atomic_sub_32_nv) -#endif -CRT_ALIAS(__sync_sub_and_fetch_4,_atomic_sub_32_nv) -CRT_ALIAS(__atomic_sub_fetch_4,_atomic_sub_32_nv) - -ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_32_nv) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_32_nv) -#endif diff --git a/common/lib/libc/arch/riscv/atomic/atomic_sub_64.S b/common/lib/libc/arch/riscv/atomic/atomic_sub_64.S deleted file mode 100644 index e7036b8f3..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_sub_64.S +++ /dev/null @@ -1,79 +0,0 @@ -/* $NetBSD: atomic_sub_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_dec_64) - li a1, 1 -ENTRY_NP(_atomic_sub_64) - neg t1, a1 - amoadd.d.aq a0, t1, 0(a0) - ret -END(_atomic_sub_64) -END(_atomic_dec_64) - -ATOMIC_OP_ALIAS(atomic_sub_64,_atomic_sub_64) -ATOMIC_OP_ALIAS(atomic_sub_long,_atomic_sub_64) -STRONG_ALIAS(_atomic_sub_long,_atomic_sub_64) -ATOMIC_OP_ALIAS(atomic_sub_ptr,_atomic_sub_64) -STRONG_ALIAS(_atomic_sub_ptr,_atomic_sub_64) -CRT_ALIAS(__sync_fetch_and_sub_8,_atomic_sub_64) -CRT_ALIAS(__atomic_fetch_sub_8,_atomic_sub_64) - -ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_ulong,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64) -ATOMIC_OP_ALIAS(atomic_dec_ptr,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64) - -ENTRY_NP(_atomic_dec_64_nv) - li a1, 1 -ENTRY_NP(_atomic_sub_64_nv) - neg t1, a1 - amoadd.d.aq t0, t1, 0(a0) /* update memory and get old value */ - add a0, t0, t1 /* turn into new value */ - ret -END(_atomic_sub_64_nv) -END(_atomic_dec_64_nv) - -ATOMIC_OP_ALIAS(atomic_sub_64_nv,_atomic_sub_64_nv) -ATOMIC_OP_ALIAS(atomic_sub_long_nv,_atomic_sub_64_nv) -STRONG_ALIAS(_atomic_sub_long_nv,_atomic_sub_64_nv) -ATOMIC_OP_ALIAS(atomic_sub_ptr_nv,_atomic_sub_64_nv) -STRONG_ALIAS(_atomic_sub_ptr_nv,_atomic_sub_64_nv) -CRT_ALIAS(__sync_sub_and_fetch_8,_atomic_sub_64_nv) -CRT_ALIAS(__atomic_sub_fetch_8,_atomic_sub_64_nv) - -ATOMIC_OP_ALIAS(atomic_dec_64_nv,_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_ulong_nv,_atomic_dec_64_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64_nv) -ATOMIC_OP_ALIAS(atomic_dec_ptr_nv,_atomic_sub_64_nv) -STRONG_ALIAS(_atomic_sub_ptr_nv,_atomic_sub_64_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_swap_32.S b/common/lib/libc/arch/riscv/atomic/atomic_swap_32.S deleted file mode 100644 index ab60def9e..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_swap_32.S +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: atomic_swap_32.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_32) - amoswap.w.aq a0, a1, 0(a0) - ret -END(_atomic_swap_32) - -ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_32) -#endif -CRT_ALIAS(__sync_lock_test_and_set_4,_atomic_swap_32) -CRT_ALIAS(__atomic_exchange_4,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) -#ifndef _LP64 -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_32) -#endif - -ENTRY_NP(_atomic_release_32) - amoswap.w.rl zero, zero, 0(a0) - ret -END(_atomic_release_32) -ATOMIC_OP_ALIAS(atomic_release_32,_atomic_release_32) - -CRT_ALIAS(__sync_lock_release_4,_atomic_release_32) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_swap_64.S b/common/lib/libc/arch/riscv/atomic/atomic_swap_64.S deleted file mode 100644 index 7718d8e31..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_swap_64.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_swap_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifdef _LP64 -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_swap_64) - amoswap.d.aq a0, a1, 0(a0) - ret -END(_atomic_swap_64) - -ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_ulong,_atomic_swap_64) -ATOMIC_OP_ALIAS(atomic_swap_ptr,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64) -CRT_ALIAS(__sync_lock_test_and_set_8,_atomic_swap_64) -CRT_ALIAS(__atomic_exchange_8,_atomic_swap_64) - -ENTRY_NP(_atomic_release_64) - amoswap.d.rl zero, zero, 0(a0) - ret -END(_atomic_release_64) -ATOMIC_OP_ALIAS(atomic_release_64,_atomic_release_64) - -CRT_ALIAS(__sync_lock_release_8,_atomic_release_64) -#endif /* _LP64 */ diff --git a/common/lib/libc/arch/riscv/atomic/atomic_xor_32.S b/common/lib/libc/arch/riscv/atomic/atomic_xor_32.S deleted file mode 100644 index aeee5f9aa..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_xor_32.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_xor_32.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_xor_32) - amoxor.w.aq a0, a1, 0(a0) - ret -END(_atomic_xor_32) - -ATOMIC_OP_ALIAS(atomic_xor_32,_atomic_xor_32) -ATOMIC_OP_ALIAS(atomic_xor_uint,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_uint,_atomic_xor_32) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_xor_ulong,_atomic_xor_32) -STRONG_ALIAS(_atomic_xor_ulong,_atomic_xor_32) -#endif -CRT_ALIAS(__sync_fetch_and_xor_4,_atomic_xor_32) -CRT_ALIAS(__atomic_fetch_xor_4,_atomic_xor_32) - -ENTRY_NP(_atomic_xor_32_nv) - amoxor.w.aq t0, a1, 0(a0) /* update memory and get old value */ - xor a0, t0, a1 /* turn into new value */ - ret -END(_atomic_xor_32_nv) - -ATOMIC_OP_ALIAS(atomic_xor_32_nv,_atomic_xor_32_nv) -ATOMIC_OP_ALIAS(atomic_xor_uint_nv,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_uint_nv,_atomic_xor_32_nv) -#ifndef _LP64 -ATOMIC_OP_ALIAS(atomic_xor_ulong_nv,_atomic_xor_32_nv) -STRONG_ALIAS(_atomic_xor_ulong_nv,_atomic_xor_32_nv) -#endif -CRT_ALIAS(__sync_xor_and_fetch_4,_atomic_xor_32_nv) -CRT_ALIAS(__atomic_xor_fetch_4,_atomic_xor_32_nv) diff --git a/common/lib/libc/arch/riscv/atomic/atomic_xor_64.S b/common/lib/libc/arch/riscv/atomic/atomic_xor_64.S deleted file mode 100644 index e5c8950a3..000000000 --- a/common/lib/libc/arch/riscv/atomic/atomic_xor_64.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_xor_64.S,v 1.2 2015/03/27 06:42:37 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas of 3am Software Foundry. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_atomic_xor_64) - amoxor.d.aq a0, a1, 0(a0) - ret -END(_atomic_xor_64) - -ATOMIC_OP_ALIAS(atomic_xor_64,_atomic_xor_64) -ATOMIC_OP_ALIAS(atomic_xor_ulong,_atomic_xor_64) -STRONG_ALIAS(_atomic_xor_ulong,_atomic_xor_64) -CRT_ALIAS(__sync_fetch_and_xor_8,_atomic_xor_64) -CRT_ALIAS(__atomic_fetch_xor_8,_atomic_xor_64) - -ENTRY_NP(_atomic_xor_64_nv) - amoxor.d.aq t0, a1, 0(a0) /* update memory and get old value */ - xor a0, t0, a1 /* turn into new value */ - ret -END(_atomic_xor_64_nv) - -ATOMIC_OP_ALIAS(atomic_xor_64_nv,_atomic_xor_64_nv) -ATOMIC_OP_ALIAS(atomic_xor_ulong_nv,_atomic_xor_64_nv) -STRONG_ALIAS(_atomic_xor_ulong_nv,_atomic_xor_64_nv) -CRT_ALIAS(__sync_xor_and_fetch_8,_atomic_xor_64_nv) -CRT_ALIAS(__atomic_xor_fetch_8,_atomic_xor_64_nv) diff --git a/common/lib/libc/arch/riscv/atomic/membar_ops.S b/common/lib/libc/arch/riscv/atomic/membar_ops.S deleted file mode 100644 index 9c29901a8..000000000 --- a/common/lib/libc/arch/riscv/atomic/membar_ops.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.1 2014/09/19 17:36:24 matt Exp $ */ - -/*- - * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe, and by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - -ENTRY_NP(_membar_sync) - fence rw,rw - ret -END(_membar_sync) -ATOMIC_OP_ALIAS(membar_sync,_membar_sync) -CRT_ALIAS(__sync_synchronize,_membar_sync) - -ENTRY_NP(_membar_enter) - fence w,rw - ret -END(_membar_enter) -ATOMIC_OP_ALIAS(membar_enter,_membar_enter) - -ENTRY_NP(_membar_exit) - fence rw,w - ret -END(_membar_exit) -ATOMIC_OP_ALIAS(membar_exit,_membar_exit) - -ENTRY_NP(_membar_producer) - fence w,w - ret -END(_membar_producer) -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) - -ENTRY_NP(_membar_consumer) - fence r,r - ret -END(_membar_consumer) -ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer) diff --git a/common/lib/libc/arch/riscv/string/ffs.c b/common/lib/libc/arch/riscv/string/ffs.c deleted file mode 100644 index c1cdebd7a..000000000 --- a/common/lib/libc/arch/riscv/string/ffs.c +++ /dev/null @@ -1,12 +0,0 @@ -/* $NetBSD: ffs.c,v 1.1 2014/09/19 17:36:24 matt Exp $ */ - -#include - -__strong_alias(ffs, __ffssi2); -int __ffssi2(int); - -int -__ffssi2(int i) -{ - return i == 0 ? 0 : __buildint_ctz(i) + 1; -} diff --git a/common/lib/libc/arch/sh3/atomic/Makefile.inc b/common/lib/libc/arch/sh3/atomic/Makefile.inc deleted file mode 100644 index 77a31ae18..000000000 --- a/common/lib/libc/arch/sh3/atomic/Makefile.inc +++ /dev/null @@ -1,31 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.7 2014/10/13 13:00:55 martin Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ - atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ - atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ - atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c - -.if ${LIB} == "c" -SRCS+= atomic_add_16_cas.c atomic_add_8_cas.c \ - atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c \ - atomic_and_16_cas.c atomic_and_8_cas.c \ - atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c \ - atomic_or_16_cas.c atomic_or_8_cas.c \ - atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c \ - atomic_swap_16_cas.c atomic_swap_8_cas.c \ - atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \ - atomic_c11_compare_exchange_cas_32.c \ - atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_8.c -.endif - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -SRCS+= atomic_init_testset.c - -.endif diff --git a/common/lib/libc/arch/sh3/string/ffs.S b/common/lib/libc/arch/sh3/string/ffs.S deleted file mode 100644 index d0725338d..000000000 --- a/common/lib/libc/arch/sh3/string/ffs.S +++ /dev/null @@ -1,97 +0,0 @@ -/* $NetBSD: ffs.S,v 1.3 2011/07/04 12:18:05 mrg Exp $ */ - -/*- - * Copyright (c) 2002 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by ITOH Yasufumi. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: ffs.S,v 1.3 2011/07/04 12:18:05 mrg Exp $") -#endif - -/* - * ffs - find first bit set - * - * This code makes use of ``test 8bit'' and ``shift 8bit'' instructions. - * The remaining 8bit is tested in every 2bit. - */ - -WEAK_ALIAS(__ffssi2,ffs) -ENTRY(ffs) - mov r4,r0 ! using r0 specific instructions - tst #0xff,r0 - bf/s L8bit - mov #0+1,r1 ! ret = 1..8 - - tst r0,r0 ! ffs(0) is 0 - bt Lzero ! testing here to accelerate ret=1..8 cases - - shlr8 r0 - tst #0xff,r0 - bf/s L8bit - mov #8+1,r1 ! ret = 9..16 - - shlr8 r0 - tst #0xff,r0 - bf/s L8bit - mov #16+1,r1 ! ret = 17..24 - - shlr8 r0 - mov #24+1,r1 ! ret = 25..32 - -L8bit: - tst #0x0f,r0 - bt 4f - - tst #0x03,r0 - bt 2f - tst #0x01,r0 ! not bit 0 -> T - mov #0,r0 - rts - addc r1,r0 ! 0 + r1 + T -> r0 - -2: tst #0x04,r0 - mov #2,r0 - rts - addc r1,r0 - -4: tst #0x30,r0 - bt 6f - tst #0x10,r0 - mov #4,r0 - rts - addc r1,r0 - -6: tst #0x40,r0 - mov #6,r0 - rts - addc r1,r0 - -Lzero: rts - nop diff --git a/common/lib/libc/arch/sh3/string/memcpy.S b/common/lib/libc/arch/sh3/string/memcpy.S deleted file mode 100644 index aca97dd34..000000000 --- a/common/lib/libc/arch/sh3/string/memcpy.S +++ /dev/null @@ -1,271 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.2 2006/04/22 23:53:47 uwe Exp $ */ - -/* - * Copyright (c) 2000 SHIMIZU Ryo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: memcpy.S,v 1.2 2006/04/22 23:53:47 uwe Exp $") -#endif - -#if !defined(MEMCOPY) && !defined(MEMMOVE) && !defined(BCOPY) -#define MEMCOPY -#endif - -#if defined(MEMCOPY) || defined(MEMMOVE) -#define REG_DST0 r3 -#define REG_SRC r5 -#define REG_DST r4 -#else -#define REG_SRC r4 -#define REG_DST r5 -#endif - -#define REG_LEN r6 - -#if defined(MEMCOPY) -ENTRY(memcpy) -#elif defined(MEMMOVE) -ENTRY(memmove) -#elif defined(BCOPY) -ENTRY(bcopy) -#endif -#ifdef REG_DST0 - mov REG_DST,REG_DST0 -#endif - cmp/eq REG_DST,REG_SRC /* if ( src == dst ) return; */ - bt/s bcopy_return - cmp/hi REG_DST,REG_SRC - bf/s bcopy_overlap - - mov REG_SRC,r0 - xor REG_DST,r0 - and #3,r0 - mov r0,r1 - tst r0,r0 /* (src ^ dst) & 3 */ - bf/s word_align - -longword_align: - tst REG_LEN,REG_LEN /* if ( len==0 ) return; */ - bt/s bcopy_return - - - mov REG_SRC,r0 - tst #1,r0 /* if ( src & 1 ) */ - bt 1f - mov.b @REG_SRC+,r0 /* *dst++ = *src++; */ - add #-1,REG_LEN - mov.b r0,@REG_DST - add #1,REG_DST -1: - - - mov #1,r0 - cmp/hi r0,REG_LEN /* if ( (len > 1) && */ - bf/s 1f - mov REG_SRC,r0 - tst #2,r0 /* (src & 2) { */ - bt 1f - mov.w @REG_SRC+,r0 /* *((unsigned short*)dst)++ = *((unsigned short*)src)++; */ - add #-2,REG_LEN /* len -= 2; */ - mov.w r0,@REG_DST - add #2,REG_DST /* } */ -1: - - - mov #3,r1 - cmp/hi r1,REG_LEN /* while ( len > 3 ) { */ - bf/s no_align_delay - tst REG_LEN,REG_LEN -2: - mov.l @REG_SRC+,r0 /* *((unsigned long*)dst)++ = *((unsigned long*)src)++; */ - add #-4,REG_LEN /* len -= 4; */ - mov.l r0,@REG_DST - cmp/hi r1,REG_LEN - bt/s 2b - add #4,REG_DST /* } */ - - bra no_align_delay - tst REG_LEN,REG_LEN - - -word_align: - mov r1,r0 - tst #1,r0 - bf/s no_align_delay - tst REG_LEN,REG_LEN /* if ( len == 0 ) return; */ - bt bcopy_return - - - mov REG_SRC,r0 /* if ( src & 1 ) */ - tst #1,r0 - bt 1f - mov.b @REG_SRC+,r0 /* *dst++ = *src++; */ - add #-1,REG_LEN - mov.b r0,@REG_DST - add #1,REG_DST -1: - - - mov #1,r1 - cmp/hi r1,REG_LEN /* while ( len > 1 ) { */ - bf/s no_align_delay - tst REG_LEN,REG_LEN -2: - mov.w @REG_SRC+,r0 /* *((unsigned short*)dst)++ = *((unsigned short*)src)++; */ - add #-2,REG_LEN /* len -= 2; */ - mov.w r0,@REG_DST - cmp/hi r1,REG_LEN - bt/s 2b - add #2,REG_DST /* } */ - - -no_align: - tst REG_LEN,REG_LEN /* while ( len!= ) { */ -no_align_delay: - bt bcopy_return -1: - mov.b @REG_SRC+,r0 /* *dst++ = *src++; */ - add #-1,REG_LEN /* len--; */ - mov.b r0,@REG_DST - tst REG_LEN,REG_LEN - bf/s 1b - add #1,REG_DST /* } */ -bcopy_return: - rts -#ifdef REG_DST0 - mov REG_DST0,r0 -#else - nop -#endif - - -bcopy_overlap: - add REG_LEN,REG_SRC - add REG_LEN,REG_DST - - mov REG_SRC,r0 - xor REG_DST,r0 - and #3,r0 - mov r0,r1 - tst r0,r0 /* (src ^ dst) & 3 */ - bf/s ov_word_align - -ov_longword_align: - tst REG_LEN,REG_LEN /* if ( len==0 ) return; */ - bt/s bcopy_return - - - mov REG_SRC,r0 - tst #1,r0 /* if ( src & 1 ) */ - bt 1f - add #-1,REG_SRC /* *--dst = *--src; */ - mov.b @REG_SRC,r0 - mov.b r0,@-REG_DST - add #-1,REG_LEN -1: - - - mov #1,r0 - cmp/hi r0,REG_LEN /* if ( (len > 1) && */ - bf/s 1f - mov REG_SRC,r0 - tst #2,r0 /* (src & 2) { */ - bt 1f - add #-2,REG_SRC /* *--((unsigned short*)dst) = *--((unsigned short*)src); */ - mov.w @REG_SRC,r0 - add #-2,REG_LEN /* len -= 2; */ - mov.w r0,@-REG_DST /* } */ -1: - - - mov #3,r1 - cmp/hi r1,REG_LEN /* while ( len > 3 ) { */ - bf/s ov_no_align_delay - tst REG_LEN,REG_LEN -2: - add #-4,REG_SRC - mov.l @REG_SRC,r0 /* *((unsigned long*)dst)++ = *((unsigned long*)src)++; */ - add #-4,REG_LEN /* len -= 4; */ - cmp/hi r1,REG_LEN - bt/s 2b - mov.l r0,@-REG_DST /* } */ - - bra ov_no_align_delay - tst REG_LEN,REG_LEN - - -ov_word_align: - mov r1,r0 - tst #1,r0 - bf/s ov_no_align_delay - tst REG_LEN,REG_LEN /* if ( len == 0 ) return; */ - bt bcopy_return - - - mov REG_SRC,r0 /* if ( src & 1 ) */ - tst #1,r0 - bt 1f - add #-1,REG_SRC - mov.b @REG_SRC,r0 /* *--dst = *--src; */ - add #-1,REG_LEN - mov.b r0,@-REG_DST -1: - - - mov #1,r1 - cmp/hi r1,REG_LEN /* while ( len > 1 ) { */ - bf/s ov_no_align_delay - tst REG_LEN,REG_LEN -2: - add #-2,REG_SRC - mov.w @REG_SRC,r0 /* *--((unsigned short*)dst) = *--((unsigned short*)src); */ - add #-2,REG_LEN /* len -= 2; */ - cmp/hi r1,REG_LEN - bt/s 2b - mov.w r0,@-REG_DST /* } */ - - -ov_no_align: - tst REG_LEN,REG_LEN /* while ( len!= ) { */ -ov_no_align_delay: - bt 9f -1: - add #-1,REG_SRC - mov.b @REG_SRC,r0 /* *--dst = *--src; */ - add #-1,REG_LEN /* len--; */ - tst REG_LEN,REG_LEN - bf/s 1b - mov.b r0,@-REG_DST /* } */ -9: - rts -#ifdef REG_DST0 - mov REG_DST0,r0 -#else - nop -#endif diff --git a/common/lib/libc/arch/sh3/string/memmove.S b/common/lib/libc/arch/sh3/string/memmove.S deleted file mode 100644 index 0ccd67bbe..000000000 --- a/common/lib/libc/arch/sh3/string/memmove.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memmove.S,v 1.2 2006/04/22 23:53:47 uwe Exp $ */ - -#define MEMMOVE -#include "memcpy.S" diff --git a/common/lib/libc/arch/sh3/string/memset.S b/common/lib/libc/arch/sh3/string/memset.S deleted file mode 100644 index c0ab17156..000000000 --- a/common/lib/libc/arch/sh3/string/memset.S +++ /dev/null @@ -1,298 +0,0 @@ -/* $NetBSD: memset.S,v 1.2 2008/02/16 17:37:13 apb Exp $ */ - -/*- - * Copyright (c) 2002 SHIMIZU Ryo. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. The name of the author may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: memset.S,v 1.2 2008/02/16 17:37:13 apb Exp $") -#endif - -#define REG_PTR r0 -#define REG_TMP1 r1 - -#ifdef BZERO -# define REG_C r2 -# define REG_DST r4 -# define REG_LEN r5 -#else -# define REG_DST0 r3 -# define REG_DST r4 -# define REG_C r5 -# define REG_LEN r6 -#endif - -#ifdef BZERO -ENTRY(bzero) -#else -ENTRY(memset) - mov REG_DST,REG_DST0 /* for return value */ -#endif - /* small amount to fill ? */ - mov #28,REG_TMP1 - cmp/hs REG_TMP1,REG_LEN /* if (len >= 28) goto large; */ - bt/s large - mov #12,REG_TMP1 /* if (len >= 12) goto small; */ - cmp/hs REG_TMP1,REG_LEN - bt/s small -#ifdef BZERO - mov #0,REG_C -#endif - /* very little fill (0 ~ 11 bytes) */ - tst REG_LEN,REG_LEN - add REG_DST,REG_LEN - bt/s done - add #1,REG_DST - - /* unroll 4 loops */ - cmp/eq REG_DST,REG_LEN -1: mov.b REG_C,@-REG_LEN - bt/s done - cmp/eq REG_DST,REG_LEN - mov.b REG_C,@-REG_LEN - bt/s done - cmp/eq REG_DST,REG_LEN - mov.b REG_C,@-REG_LEN - bt/s done - cmp/eq REG_DST,REG_LEN - mov.b REG_C,@-REG_LEN - bf/s 1b - cmp/eq REG_DST,REG_LEN -done: -#ifdef BZERO - rts - nop -#else - rts - mov REG_DST0,r0 -#endif - - -small: - mov REG_DST,r0 - tst #1,r0 - bt/s small_aligned - mov REG_DST,REG_TMP1 - shll REG_LEN - mova 1f,r0 /* 1f must be 4bytes aligned! */ - add #16,REG_TMP1 /* REG_TMP1 = dst+16; */ - sub REG_LEN,r0 - jmp @r0 - mov REG_C,r0 - - .align 2 - mov.b r0,@(15,REG_TMP1) - mov.b r0,@(14,REG_TMP1) - mov.b r0,@(13,REG_TMP1) - mov.b r0,@(12,REG_TMP1) - mov.b r0,@(11,REG_TMP1) - mov.b r0,@(10,REG_TMP1) - mov.b r0,@(9,REG_TMP1) - mov.b r0,@(8,REG_TMP1) - mov.b r0,@(7,REG_TMP1) - mov.b r0,@(6,REG_TMP1) - mov.b r0,@(5,REG_TMP1) - mov.b r0,@(4,REG_TMP1) - mov.b r0,@(3,REG_TMP1) - mov.b r0,@(2,REG_TMP1) - mov.b r0,@(1,REG_TMP1) - mov.b r0,@REG_TMP1 - mov.b r0,@(15,REG_DST) - mov.b r0,@(14,REG_DST) - mov.b r0,@(13,REG_DST) - mov.b r0,@(12,REG_DST) - mov.b r0,@(11,REG_DST) - mov.b r0,@(10,REG_DST) - mov.b r0,@(9,REG_DST) - mov.b r0,@(8,REG_DST) - mov.b r0,@(7,REG_DST) - mov.b r0,@(6,REG_DST) - mov.b r0,@(5,REG_DST) - mov.b r0,@(4,REG_DST) - mov.b r0,@(3,REG_DST) - mov.b r0,@(2,REG_DST) - mov.b r0,@(1,REG_DST) -#ifdef BZERO - rts -1: mov.b r0,@REG_DST -#else - mov.b r0,@REG_DST -1: rts - mov REG_DST0,r0 -#endif - - -/* 2 bytes aligned small fill */ -small_aligned: -#ifndef BZERO - extu.b REG_C,REG_TMP1 /* REG_C = ??????xx, REG_TMP1 = ????00xx */ - shll8 REG_C /* REG_C = ????xx00, REG_TMP1 = ????00xx */ - or REG_TMP1,REG_C /* REG_C = ????xxxx */ -#endif - - mov REG_LEN,r0 - tst #1,r0 /* len is aligned? */ - bt/s 1f - add #-1,r0 - mov.b REG_C,@(r0,REG_DST) /* fill last a byte */ - mov r0,REG_LEN -1: - - mova 1f,r0 /* 1f must be 4bytes aligned! */ - sub REG_LEN,r0 - jmp @r0 - mov REG_C,r0 - - .align 2 - mov.w r0,@(30,REG_DST) - mov.w r0,@(28,REG_DST) - mov.w r0,@(26,REG_DST) - mov.w r0,@(24,REG_DST) - mov.w r0,@(22,REG_DST) - mov.w r0,@(20,REG_DST) - mov.w r0,@(18,REG_DST) - mov.w r0,@(16,REG_DST) - mov.w r0,@(14,REG_DST) - mov.w r0,@(12,REG_DST) - mov.w r0,@(10,REG_DST) - mov.w r0,@(8,REG_DST) - mov.w r0,@(6,REG_DST) - mov.w r0,@(4,REG_DST) - mov.w r0,@(2,REG_DST) -#ifdef BZERO - rts -1: mov.w r0,@REG_DST -#else - mov.w r0,@REG_DST -1: rts - mov REG_DST0,r0 -#endif - - - - .align 2 -large: -#ifdef BZERO - mov #0,REG_C -#else - extu.b REG_C,REG_TMP1 /* REG_C = ??????xx, REG_TMP1 = ????00xx */ - shll8 REG_C /* REG_C = ????xx00, REG_TMP1 = ????00xx */ - or REG_C,REG_TMP1 /* REG_C = ????xx00, REG_TMP1 = ????xxxx */ - swap.w REG_TMP1,REG_C /* REG_C = xxxx????, REG_TMP1 = ????xxxx */ - xtrct REG_TMP1,REG_C /* REG_C = xxxxxxxx */ -#endif - - mov #3,REG_TMP1 - tst REG_TMP1,REG_DST - mov REG_DST,REG_PTR - bf/s unaligned_dst - add REG_LEN,REG_PTR /* REG_PTR = dst + len; */ - tst REG_TMP1,REG_LEN - bf/s unaligned_len - -aligned: - /* fill 32*n bytes */ - mov #32,REG_TMP1 - cmp/hi REG_LEN,REG_TMP1 - bt 9f - .align 2 -1: sub REG_TMP1,REG_PTR - mov.l REG_C,@REG_PTR - sub REG_TMP1,REG_LEN - mov.l REG_C,@(4,REG_PTR) - cmp/hi REG_LEN,REG_TMP1 - mov.l REG_C,@(8,REG_PTR) - mov.l REG_C,@(12,REG_PTR) - mov.l REG_C,@(16,REG_PTR) - mov.l REG_C,@(20,REG_PTR) - mov.l REG_C,@(24,REG_PTR) - bf/s 1b - mov.l REG_C,@(28,REG_PTR) -9: - - /* fill left 4*n bytes */ - cmp/eq REG_DST,REG_PTR - bt 9f - add #4,REG_DST - cmp/eq REG_DST,REG_PTR -1: mov.l REG_C,@-REG_PTR - bt/s 9f - cmp/eq REG_DST,REG_PTR - mov.l REG_C,@-REG_PTR - bt/s 9f - cmp/eq REG_DST,REG_PTR - mov.l REG_C,@-REG_PTR - bt/s 9f - cmp/eq REG_DST,REG_PTR - mov.l REG_C,@-REG_PTR - bf/s 1b - cmp/eq REG_DST,REG_PTR -9: -#ifdef BZERO - rts - nop -#else - rts - mov REG_DST0,r0 -#endif - - -unaligned_dst: - mov #1,REG_TMP1 - tst REG_TMP1,REG_DST /* if (dst & 1) { */ - add #1,REG_TMP1 - bt/s 2f - tst REG_TMP1,REG_DST - mov.b REG_C,@REG_DST /* *dst++ = c; */ - add #1,REG_DST - tst REG_TMP1,REG_DST -2: /* } */ - /* if (dst & 2) { */ - bt 4f - mov.w REG_C,@REG_DST /* *(uint16_t*)dst++ = c; */ - add #2,REG_DST -4: /* } */ - - - tst #3,REG_PTR /* if (ptr & 3) { */ - bt/s 4f /* */ -unaligned_len: - tst #1,REG_PTR /* if (ptr & 1) { */ - bt/s 2f - tst #2,REG_PTR - mov.b REG_C,@-REG_PTR /* --ptr = c; */ -2: /* } */ - /* if (ptr & 2) { */ - bt 4f - mov.w REG_C,@-REG_PTR /* *--(uint16_t*)ptr = c; */ -4: /* } */ - /* } */ - - mov REG_PTR,REG_LEN - bra aligned - sub REG_DST,REG_LEN - diff --git a/common/lib/libc/arch/sparc/atomic/Makefile.inc b/common/lib/libc/arch/sparc/atomic/Makefile.inc deleted file mode 100644 index a2c4eb04c..000000000 --- a/common/lib/libc/arch/sparc/atomic/Makefile.inc +++ /dev/null @@ -1,55 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.18 2014/10/13 08:59:41 martin Exp $ - -.include - -# This is called with MACHINE=sparc64 && MACHINE_ARCH=sparc when building -# 32 bit kernels for ultrasparc hardware -.if ${MACHINE} == "sparc64" - -SPARC64DIR= ${.PARSEDIR}/../../sparc64/atomic -.PATH.c: ${SPARC64DIR} -.PATH.S: ${SPARC64DIR} - -.include "${SPARC64DIR}/Makefile.inc" - -.else - -. if defined(LIB) - -. if (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") -SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ - atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ - atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ - atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops.S \ - atomic_cas_32_cas.c atomic_nand_32_cas.c atomic_sub_32_cas.c \ - atomic_xor_32_cas.c -. endif - -. if ${LIB} == "c" -SRCS+= atomic_nand_16_cas.c atomic_nand_8_cas.c \ - atomic_and_16_cas.c atomic_and_8_cas.c \ - atomic_xor_16_cas.c atomic_xor_8_cas.c \ - atomic_add_16_cas.c atomic_add_8_cas.c \ - atomic_cas_16_cas.c atomic_cas_8_cas.c \ - atomic_sub_16_cas.c atomic_sub_8_cas.c \ - atomic_or_16_cas.c atomic_or_8_cas.c \ - atomic_swap_16_cas.c atomic_swap_8_cas.c \ - atomic_c11_compare_exchange_cas_32.c \ - atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_8.c -. endif - -. if (${LIB} == "kern" || ${LIB} == "rump") -SRCS+= atomic_cas.S -. endif - -. if (${LIB} == "c" || ${LIB} == "pthread") -CPPFLAGS+= -D__HAVE_ASM_ATOMIC_CAS_UP -D__HAVE_ASM_ATOMIC_CAS_16_UP \ - -D__HAVE_ASM_ATOMIC_CAS_8_UP -SRCS+= atomic_init_testset.c atomic_cas_up.S -. endif - -. endif - -.endif diff --git a/common/lib/libc/arch/sparc/atomic/atomic_cas.S b/common/lib/libc/arch/sparc/atomic/atomic_cas.S deleted file mode 100644 index 77fb1c190..000000000 --- a/common/lib/libc/arch/sparc/atomic/atomic_cas.S +++ /dev/null @@ -1,159 +0,0 @@ -/* $NetBSD: atomic_cas.S,v 1.13 2014/02/21 16:21:02 martin Exp $ */ - -/*- - * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Andrew Doran and Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - -#if defined(_HARDKERNEL) - -#include - -#include "opt_multiprocessor.h" - -#define DISABLE_INTERRUPTS \ - rd %psr, %o4 /* disable interrupts */;\ - or %o4, PSR_PIL, %o5 ;\ - wr %o5, 0, %psr ;\ - nop ;\ - nop ;\ - nop - -#define RESTORE_INTERRUPTS \ - wr %o4, 0, %psr /* enable interrupts */ ;\ - nop ;\ - nop ;\ - nop - -#else /* _HARDKERNEL */ - -#define MULTIPROCESSOR 1 -#define DISABLE_INTERRUPTS /* nothing */ -#define RESTORE_INTERRUPTS /* nothing */ - -#endif /* _HARDKERNEL */ - -#if defined(MULTIPROCESSOR) - .section .bss - .align 1024 -#ifdef __PIC__ - .globl _C_LABEL(_atomic_cas_locktab) -#endif -OTYPE(_C_LABEL(_atomic_cas_locktab)) -_C_LABEL(_atomic_cas_locktab): - .space 1024 - -#ifdef __PIC__ -/* o4 is not used for PSR in PIC cases, so we can use it here */ -#define GETLOCKTAB \ - PIC_PROLOGUE(%o3,%o4) ;\ - set _C_LABEL(_atomic_cas_locktab), %o4 ;\ - ld [%o3 + %o4], %o3 -#else -#define GETLOCKTAB \ - sethi %hi(_C_LABEL(_atomic_cas_locktab)), %o3 -#endif - -#define ACQUIRE_INTERLOCK \ - DISABLE_INTERRUPTS ;\ - srl %o0, 3, %o5 /* get lock address */ ;\ - and %o5, 1023, %o5 ;\ - GETLOCKTAB ;\ - add %o5, %o3, %o5 ;\ - ;\ - /* %o5 has interlock address */ ;\ - ;\ -1: ldstub [%o5], %o3 /* acquire lock */ ;\ - tst %o3 ;\ - bz,a 2f ;\ - nop ;\ - nop ;\ - nop ;\ - b,a 1b /* spin */ ;\ - nop ;\ - /* We now hold the interlock */ ;\ -2: - -#define RELEASE_INTERLOCK \ - stb %g0, [%o5] /* release interlock */ ;\ - RESTORE_INTERRUPTS - -#else /* ! MULTIPROCESSOR */ - -#define ACQUIRE_INTERLOCK DISABLE_INTERRUPTS - -#define RELEASE_INTERLOCK RESTORE_INTERRUPTS - -#endif /* MULTIPROCESSOR */ - - .text - -/* - * The v7 and v8 SPARC doesn't have compare-and-swap, so we block interrupts - * and use an interlock. - * - * XXX On single CPU systems, this should use a restartable sequence: - * XXX there we don't need the overhead of interlocking. - * - * XXX NOTE! The interlock trick only works if EVERYTHING writes to - * XXX the memory cell through this code path! - */ -ENTRY(_atomic_cas_32) - ACQUIRE_INTERLOCK - ! %o4 has saved PSR value - ! %o5 has interlock address - - ld [%o0], %o3 ! get old value - cmp %o1, %o3 ! old == new? - beq,a 3f ! yes, do the store - st %o2, [%o0] ! (in the delay slot) - -3: RELEASE_INTERLOCK - - retl - mov %o3, %o0 ! return old value - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_32) -STRONG_ALIAS(__sync_val_compare_and_swap_4,_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ulong_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_ptr_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_32) diff --git a/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S b/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S deleted file mode 100644 index 828876e2d..000000000 --- a/common/lib/libc/arch/sparc/atomic/atomic_cas_up.S +++ /dev/null @@ -1,69 +0,0 @@ -/* $NetBSD: atomic_cas_up.S,v 1.2 2014/01/29 13:06:36 martin Exp $ */ - -/*- - * Copyright (c) 2012 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_cas_up) - .hidden _C_LABEL(_atomic_cas_up) -RAS_START_ASM_HIDDEN(_atomic_cas) - ld [%o0], %o3 ! get old value - cmp %o1, %o3 ! old == new? - beq,a 1f ! yes, do the store - st %o2, [%o0] ! (in the delay slot) -RAS_END_ASM_HIDDEN(_atomic_cas) -1: - retl - mov %o3, %o0 ! return old value - -ENTRY(_atomic_cas_16_up) - .hidden _C_LABEL(_atomic_cas_16_up) -RAS_START_ASM_HIDDEN(_atomic_cas_16) - lduh [%o0], %o3 ! get old value - cmp %o1, %o3 ! old == new? - beq,a 1f ! yes, do the store - sth %o2, [%o0] ! (in the delay slot) -RAS_END_ASM_HIDDEN(_atomic_cas_16) -1: - retl - mov %o3, %o0 ! return old value - -ENTRY(_atomic_cas_8_up) - .hidden _C_LABEL(_atomic_cas_8_up) -RAS_START_ASM_HIDDEN(_atomic_cas_8) - ldub [%o0], %o3 ! get old value - cmp %o1, %o3 ! old == new? - beq,a 1f ! yes, do the store - stb %o2, [%o0] ! (in the delay slot) -RAS_END_ASM_HIDDEN(_atomic_cas_8) -1: - retl - mov %o3, %o0 ! return old value - diff --git a/common/lib/libc/arch/sparc/atomic/atomic_op_asm.h b/common/lib/libc/arch/sparc/atomic/atomic_op_asm.h deleted file mode 100644 index f7472d6a0..000000000 --- a/common/lib/libc/arch/sparc/atomic/atomic_op_asm.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.6 2011/01/17 18:11:09 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) - -#ifdef __arch64__ -#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _64) -#else -#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _32) -#endif - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) - -#ifdef __arch64__ -#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s ## _64) -#else -#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s ## _32) -#endif - -#endif /* _KERNEL */ - -#ifdef __arch64__ -#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _64) -#else -#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _32) -#endif - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/sparc/atomic/membar_ops.S b/common/lib/libc/arch/sparc/atomic/membar_ops.S deleted file mode 100644 index f3317c83a..000000000 --- a/common/lib/libc/arch/sparc/atomic/membar_ops.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.4 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe, and by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -/* These assume Total Store Order (TSO) */ - -ENTRY(_membar_producer) - retl - nop - -ENTRY(_membar_consumer) - add %sp, -112, %sp - st %g0, [%sp+100] - retl - sub %sp, -112, %sp - -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) -ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer) -ATOMIC_OP_ALIAS(membar_enter,_membar_consumer) -STRONG_ALIAS(_membar_enter,_membar_consumer) -ATOMIC_OP_ALIAS(membar_exit,_membar_consumer) -STRONG_ALIAS(_membar_exit,_membar_consumer) -ATOMIC_OP_ALIAS(membar_sync,_membar_consumer) -STRONG_ALIAS(_membar_sync,_membar_consumer) diff --git a/common/lib/libc/arch/sparc/gen/mul.S b/common/lib/libc/arch/sparc/gen/mul.S deleted file mode 100644 index a10a9e6c6..000000000 --- a/common/lib/libc/arch/sparc/gen/mul.S +++ /dev/null @@ -1,156 +0,0 @@ -/* $NetBSD: mul.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: mul.s,v 1.5 92/06/25 13:24:03 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)mul.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: mul.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * Signed multiply, from Appendix E of the Sparc Version 8 - * Architecture Manual. - * - * Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the upper 32 bits of - * the 64-bit product). - * - * This code optimizes short (less than 13-bit) multiplies. - */ - -FUNC(.mul) - mov %o0, %y ! multiplier -> Y - andncc %o0, 0xfff, %g0 ! test bits 12..31 - be Lmul_shortway ! if zero, can do it the short way - andcc %g0, %g0, %o4 ! zero the partial product and clear N and V - - /* - * Long multiply. 32 steps, followed by a final shift step. - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %o1, %o4 ! 13 - mulscc %o4, %o1, %o4 ! 14 - mulscc %o4, %o1, %o4 ! 15 - mulscc %o4, %o1, %o4 ! 16 - mulscc %o4, %o1, %o4 ! 17 - mulscc %o4, %o1, %o4 ! 18 - mulscc %o4, %o1, %o4 ! 19 - mulscc %o4, %o1, %o4 ! 20 - mulscc %o4, %o1, %o4 ! 21 - mulscc %o4, %o1, %o4 ! 22 - mulscc %o4, %o1, %o4 ! 23 - mulscc %o4, %o1, %o4 ! 24 - mulscc %o4, %o1, %o4 ! 25 - mulscc %o4, %o1, %o4 ! 26 - mulscc %o4, %o1, %o4 ! 27 - mulscc %o4, %o1, %o4 ! 28 - mulscc %o4, %o1, %o4 ! 29 - mulscc %o4, %o1, %o4 ! 30 - mulscc %o4, %o1, %o4 ! 31 - mulscc %o4, %o1, %o4 ! 32 - mulscc %o4, %g0, %o4 ! final shift - - ! If %o0 was negative, the result is - ! (%o0 * %o1) + (%o1 << 32)) - ! We fix that here. - - tst %o0 - bge 1f - rd %y, %o0 - - ! %o0 was indeed negative; fix upper 32 bits of result by subtracting - ! %o1 (i.e., return %o4 - %o1 in %o1). - retl - sub %o4, %o1, %o1 - -1: - retl - mov %o4, %o1 - -Lmul_shortway: - /* - * Short multiply. 12 steps, followed by a final shift step. - * The resulting bits are off by 12 and (32-12) = 20 bit positions, - * but there is no problem with %o0 being negative (unlike above). - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %g0, %o4 ! final shift - - /* - * %o4 has 20 of the bits that should be in the low part of the - * result; %y has the bottom 12 (as %y's top 12). That is: - * - * %o4 %y - * +----------------+----------------+ - * | -12- | -20- | -12- | -20- | - * +------(---------+------)---------+ - * --hi-- ----low-part---- - * - * The upper 12 bits of %o4 should be sign-extended to form the - * high part of the product (i.e., highpart = %o4 >> 20). - */ - - rd %y, %o5 - sll %o4, 12, %o0 ! shift middle bits left 12 - srl %o5, 20, %o5 ! shift low bits right 20, zero fill at left - or %o5, %o0, %o0 ! construct low part of result - retl - sra %o4, 20, %o1 ! ... and extract high part of result diff --git a/common/lib/libc/arch/sparc/gen/saveregs.S b/common/lib/libc/arch/sparc/gen/saveregs.S deleted file mode 100644 index 9b497ac5d..000000000 --- a/common/lib/libc/arch/sparc/gen/saveregs.S +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: saveregs.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: saveregs.s,v 1.1 91/07/06 17:22:33 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: saveregs.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif /* LIBC_SCCS and not lint */ - -/* - * Save register arguments in caller's `arg dump' area, so that - * stdarg functions work. - * - * This really should be done with a pointer to the arg dump area; - * our caller should allocate that area, not our caller's caller. - * But then, they did not let me invent the calling sequence.... - * - * We assume the caller has executed a `save' instruction. - */ - -ENTRY(__builtin_saveregs) - st %i0, [%fp + 0x44] ! fr->fr_argd[0] - st %i1, [%fp + 0x48] ! fr->fr_argd[1] - st %i2, [%fp + 0x4c] ! fr->fr_argd[2] - st %i3, [%fp + 0x50] ! fr->fr_argd[3] - st %i4, [%fp + 0x54] ! fr->fr_argd[4] - retl - st %i5, [%fp + 0x58] ! fr->fr_argd[5] diff --git a/common/lib/libc/arch/sparc/gen/umul.S b/common/lib/libc/arch/sparc/gen/umul.S deleted file mode 100644 index 1622237a5..000000000 --- a/common/lib/libc/arch/sparc/gen/umul.S +++ /dev/null @@ -1,189 +0,0 @@ -/* $NetBSD: umul.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: umul.s,v 1.4 92/06/25 13:24:05 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)umul.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: umul.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * Unsigned multiply. Returns %o0 * %o1 in %o1%o0 (i.e., %o1 holds the - * upper 32 bits of the 64-bit product). - * - * This code optimizes short (less than 13-bit) multiplies. Short - * multiplies require 25 instruction cycles, and long ones require - * 45 instruction cycles. - * - * On return, overflow has occurred (%o1 is not zero) if and only if - * the Z condition code is clear, allowing, e.g., the following: - * - * call .umul - * nop - * bnz overflow (or tnz) - */ - -FUNC(.umul) - or %o0, %o1, %o4 - mov %o0, %y ! multiplier -> Y - andncc %o4, 0xfff, %g0 ! test bits 12..31 of *both* args - be Lmul_shortway ! if zero, can do it the short way - andcc %g0, %g0, %o4 ! zero the partial product and clear N and V - - /* - * Long multiply. 32 steps, followed by a final shift step. - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %o1, %o4 ! 13 - mulscc %o4, %o1, %o4 ! 14 - mulscc %o4, %o1, %o4 ! 15 - mulscc %o4, %o1, %o4 ! 16 - mulscc %o4, %o1, %o4 ! 17 - mulscc %o4, %o1, %o4 ! 18 - mulscc %o4, %o1, %o4 ! 19 - mulscc %o4, %o1, %o4 ! 20 - mulscc %o4, %o1, %o4 ! 21 - mulscc %o4, %o1, %o4 ! 22 - mulscc %o4, %o1, %o4 ! 23 - mulscc %o4, %o1, %o4 ! 24 - mulscc %o4, %o1, %o4 ! 25 - mulscc %o4, %o1, %o4 ! 26 - mulscc %o4, %o1, %o4 ! 27 - mulscc %o4, %o1, %o4 ! 28 - mulscc %o4, %o1, %o4 ! 29 - mulscc %o4, %o1, %o4 ! 30 - mulscc %o4, %o1, %o4 ! 31 - mulscc %o4, %o1, %o4 ! 32 - mulscc %o4, %g0, %o4 ! final shift - - - /* - * Normally, with the shift-and-add approach, if both numbers are - * positive you get the correct result. WIth 32-bit two's-complement - * numbers, -x is represented as - * - * x 32 - * ( 2 - ------ ) mod 2 * 2 - * 32 - * 2 - * - * (the `mod 2' subtracts 1 from 1.bbbb). To avoid lots of 2^32s, - * we can treat this as if the radix point were just to the left - * of the sign bit (multiply by 2^32), and get - * - * -x = (2 - x) mod 2 - * - * Then, ignoring the `mod 2's for convenience: - * - * x * y = xy - * -x * y = 2y - xy - * x * -y = 2x - xy - * -x * -y = 4 - 2x - 2y + xy - * - * For signed multiplies, we subtract (x << 32) from the partial - * product to fix this problem for negative multipliers (see mul.s). - * Because of the way the shift into the partial product is calculated - * (N xor V), this term is automatically removed for the multiplicand, - * so we don't have to adjust. - * - * But for unsigned multiplies, the high order bit wasn't a sign bit, - * and the correction is wrong. So for unsigned multiplies where the - * high order bit is one, we end up with xy - (y << 32). To fix it - * we add y << 32. - */ - tst %o1 - bl,a 1f ! if %o1 < 0 (high order bit = 1), - add %o4, %o0, %o4 ! %o4 += %o0 (add y to upper half) -1: rd %y, %o0 ! get lower half of product - retl - addcc %o4, %g0, %o1 ! put upper half in place and set Z for %o1==0 - -Lmul_shortway: - /* - * Short multiply. 12 steps, followed by a final shift step. - * The resulting bits are off by 12 and (32-12) = 20 bit positions, - * but there is no problem with %o0 being negative (unlike above), - * and overflow is impossible (the answer is at most 24 bits long). - */ - mulscc %o4, %o1, %o4 ! 1 - mulscc %o4, %o1, %o4 ! 2 - mulscc %o4, %o1, %o4 ! 3 - mulscc %o4, %o1, %o4 ! 4 - mulscc %o4, %o1, %o4 ! 5 - mulscc %o4, %o1, %o4 ! 6 - mulscc %o4, %o1, %o4 ! 7 - mulscc %o4, %o1, %o4 ! 8 - mulscc %o4, %o1, %o4 ! 9 - mulscc %o4, %o1, %o4 ! 10 - mulscc %o4, %o1, %o4 ! 11 - mulscc %o4, %o1, %o4 ! 12 - mulscc %o4, %g0, %o4 ! final shift - - /* - * %o4 has 20 of the bits that should be in the result; %y has - * the bottom 12 (as %y's top 12). That is: - * - * %o4 %y - * +----------------+----------------+ - * | -12- | -20- | -12- | -20- | - * +------(---------+------)---------+ - * -----result----- - * - * The 12 bits of %o4 left of the `result' area are all zero; - * in fact, all top 20 bits of %o4 are zero. - */ - - rd %y, %o5 - sll %o4, 12, %o0 ! shift middle bits left 12 - srl %o5, 20, %o5 ! shift low bits right 20 - or %o5, %o0, %o0 - retl - addcc %g0, %g0, %o1 ! %o1 = zero, and set Z diff --git a/common/lib/libc/arch/sparc/net/htonl.S b/common/lib/libc/arch/sparc/net/htonl.S deleted file mode 100644 index 17e1986e5..000000000 --- a/common/lib/libc/arch/sparc/net/htonl.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: htonl.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: htonl.s,v 1.1 92/06/25 12:47:05 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)htonl.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: htonl.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* netorder = htonl(hostorder) */ - - -ENTRY(htonl) - retl - nop diff --git a/common/lib/libc/arch/sparc/net/htons.S b/common/lib/libc/arch/sparc/net/htons.S deleted file mode 100644 index 14daafa73..000000000 --- a/common/lib/libc/arch/sparc/net/htons.S +++ /dev/null @@ -1,51 +0,0 @@ -/* $NetBSD: htons.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: htons.s,v 1.1 92/06/25 12:47:05 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)htons.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: htons.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* netorder = htons(hostorder) */ -ENTRY(htons) - sethi %hi(0xffff0000), %o1 - retl - andn %o0, %o1, %o0 diff --git a/common/lib/libc/arch/sparc/net/ntohl.S b/common/lib/libc/arch/sparc/net/ntohl.S deleted file mode 100644 index 4fc522af3..000000000 --- a/common/lib/libc/arch/sparc/net/ntohl.S +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: ntohl.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: ntohl.s,v 1.1 92/06/25 12:47:06 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)ntohl.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: ntohl.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* hostorder = ntohl(netorder) */ -ENTRY(ntohl) - retl - nop diff --git a/common/lib/libc/arch/sparc/net/ntohs.S b/common/lib/libc/arch/sparc/net/ntohs.S deleted file mode 100644 index 8ab75118a..000000000 --- a/common/lib/libc/arch/sparc/net/ntohs.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: ntohs.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: ntohs.s,v 1.1 92/06/25 12:47:07 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)ntohs.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: ntohs.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* hostorder = ntohs(netorder) */ - -ENTRY(ntohs) - sethi %hi(0xffff0000), %o1 - retl - andn %o0, %o1, %o0 diff --git a/common/lib/libc/arch/sparc/string/bzero.S b/common/lib/libc/arch/sparc/string/bzero.S deleted file mode 100644 index 857bf2031..000000000 --- a/common/lib/libc/arch/sparc/string/bzero.S +++ /dev/null @@ -1,179 +0,0 @@ -/* $NetBSD: bzero.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: bzero.s,v 1.1 92/06/25 12:52:46 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)bzero.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: bzero.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * We should unroll the loop, but at the moment this would - * gain nothing since the `std' instructions are what limits us. - */ - -#ifdef MEMSET -/* - * void * - * memset(void *addr, int pattern, size_t len) - */ -ENTRY(memset) - ! %o0 = addr, %o1 = pattern, %o2 = len - /* - * Expand the byte pattern to fill 64 bits in an even-aligned - * register pair; shuffle arguments to match those of bzero. - */ - and %o1, 0xff, %o3 - mov %o2, %o1 ! shuffle argument - sll %o3, 8, %o2 - or %o2, %o3, %o2 - mov %o0, %g1 ! save original pointer - sll %o2, 16, %o3 - or %o2, %o3, %o2 - ! Optimize a common case: addr and len are both multiples of 8. - or %o0, %o1, %o5 - btst 7, %o5 ! ((addr | len) & 7) != 0? - bnz 1f ! if so, cannot optimize - mov %o2, %o3 ! in any case, complete pat expansion -#else -/* - * void - * bzero(void *addr, size_t len) - */ -ENTRY(bzero) - ! %o0 = addr, %o1 = len - - clr %o2 - ! Optimize a common case: addr and len are both multiples of 8. - or %o0, %o1, %o5 - btst 7, %o5 ! ((addr | len) & 7) != 0? - bnz 1f ! if so, cannot optimize - clr %o3 ! in any case, we want o3=0 -#endif - - /* `Good' operands, can just store doubles. */ -0: - deccc 8, %o1 ! while ((len -= 8) >= 0) - bge,a 0b - std %o2, [%o0 + %o1] ! *(quad *)(addr + len) = 0; - retl - nop - - /* - * Either the address is unaligned, or the count is not a - * multiple of 8, or both. We will have to align the address - * in order to use anything `better' than stb. - */ -1: - cmp %o1, 15 ! len >= 15? - bge,a Lstd ! yes, use std - btst 1, %o0 ! (but first check alignment) - - ! not enough to bother: do byte-at-a-time loop. -2: - deccc %o1 ! while (--len >= 0) - bge,a 2b - stb %o2, [%o0 + %o1] ! addr[len] = 0; - retl - nop - -Lstd: - /* - * There are at least 15 bytes to zero. - * We may have to zero some initial stuff to align - * the address. - */ - bz,a 1f ! if (addr & 1) { - btst 2, %o0 - stb %o2, [%o0] ! *addr = 0; - inc %o0 ! addr++; - dec %o1 ! len--; - btst 2, %o0 ! } -1: - bz,a 1f ! if (addr & 2) { - btst 4, %o0 - sth %o2, [%o0] ! *(short *)addr = 0; - inc 2, %o0 ! addr += 2; - dec 2, %o1 ! len -= 2; - btst 4, %o0 ! } -1: - bz 1f ! if (addr & 4) { - dec 8, %o1 - st %o2, [%o0] ! *(int *)addr = 0; - inc 4, %o0 ! addr += 4; - dec 4, %o1 ! len -= 4; - ! } - /* - * Address is double word aligned; len is 8 less than - * the number of bytes remaining (i.e., len is 0 if - * the remaining count is 8, 1 if it is 9, etc.). - */ -1: - std %o2, [%o0] ! do { -2: ! *(quad *)addr = 0; - inc 8, %o0 ! addr += 8; - deccc 8, %o1 ! } while ((len -= 8) >= 0); - bge,a 2b - std %o2, [%o0] - - /* - * Len is in [-8..-1] where -8 => done, -7 => 1 byte to zero, - * -6 => two bytes, etc. Mop up this remainder, if any. - */ - btst 4, %o1 - bz 1f ! if (len & 4) { - btst 2, %o1 - st %o2, [%o0] ! *(int *)addr = 0; - inc 4, %o0 ! addr += 4; -1: - bz 1f ! if (len & 2) { - btst 1, %o1 - sth %o2, [%o0] ! *(short *)addr = 0; - inc 2, %o0 ! addr += 2; -1: - bnz,a 1f ! if (len & 1) - stb %o2, [%o0] ! *addr = 0; -1: - retl -#ifdef MEMSET - mov %g1, %o0 ! restore original pointer -#else - nop -#endif diff --git a/common/lib/libc/arch/sparc/string/ffs.S b/common/lib/libc/arch/sparc/string/ffs.S deleted file mode 100644 index f37cbd905..000000000 --- a/common/lib/libc/arch/sparc/string/ffs.S +++ /dev/null @@ -1,114 +0,0 @@ -/* $NetBSD: ffs.S,v 1.4 2013/09/12 15:36:14 joerg Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: ffs.s,v 1.3 92/07/07 00:23:57 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)ffs.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: ffs.S,v 1.4 2013/09/12 15:36:14 joerg Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * ffs returns the number of the rightmost bit set in its argument, - * i.e., the lowest value such that (x & (ffs(x) - 1)) is nonzero. - * If no bits are set, ffs returns 0. - * - * We use a table lookup on each byte. - * - * In each section below, %o1 is the current byte (0, 1, 2, or 3). - * The last byte is handled specially: for the first three, - * if that byte is nonzero, we return the table value - * (plus 0, 8, or 16 for the byte number), but for the last - * one, we just return the table value plus 24. This means - * that ffstab[0] must be -24 so that ffs(0) will return 0. - */ -WEAK_ALIAS(__ffssi2,ffs) -ENTRY(ffs) -#ifdef __PIC__ - PICCY_SET(ffstab, %o2, %o3) -#else - set ffstab, %o2 -#endif - andcc %o0, 0xff, %o1 ! get low byte - be,a 1f ! try again if 0 - srl %o0, 8, %o0 ! delay slot, get ready for next byte - - retl ! return ffstab[%o1] - ldsb [%o2 + %o1], %o0 - -1: - andcc %o0, 0xff, %o1 ! byte 1 like byte 0... - be,a 2f - srl %o0, 8, %o0 ! (use delay to prepare for byte 2) - - ldsb [%o2 + %o1], %o0 - retl ! return ffstab[%o1] + 8 - add %o0, 8, %o0 - -2: - andcc %o0, 0xff, %o1 - be,a 3f - srl %o0, 8, %o0 ! (prepare for byte 3) - - ldsb [%o2 + %o1], %o0 - retl ! return ffstab[%o1] + 16 - add %o0, 16, %o0 - -3: ! just return ffstab[%o0] + 24 - ldsb [%o2 + %o0], %o0 - retl - add %o0, 24, %o0 - -ffstab: - .byte -24,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 00-0f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-1f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 20-2f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 30-3f */ - .byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 40-4f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 50-5f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 60-6f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 70-7f */ - .byte 8,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 80-8f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-9f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* a0-af */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* b0-bf */ - .byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* c0-cf */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* d0-df */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* e0-ef */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* f0-ff */ diff --git a/common/lib/libc/arch/sparc/string/memset.S b/common/lib/libc/arch/sparc/string/memset.S deleted file mode 100644 index 9bbf1eb79..000000000 --- a/common/lib/libc/arch/sparc/string/memset.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memset.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -#define MEMSET -#include "bzero.S" diff --git a/common/lib/libc/arch/sparc/string/strlen.S b/common/lib/libc/arch/sparc/string/strlen.S deleted file mode 100644 index 0bb811e65..000000000 --- a/common/lib/libc/arch/sparc/string/strlen.S +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: strlen.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: strlen.s,v 1.1 92/06/25 12:52:47 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)strlen.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: strlen.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -ENTRY(strlen) - add %o0, 1, %o1 ! save starting point + 1 -1: - ldsb [%o0], %o2 ! fetch byte - tst %o2 ! null? - bne 1b ! no, keep going - inc %o0 ! always increment pointer - retl - sub %o0, %o1, %o0 ! return length (ptr - (origptr+1)) diff --git a/common/lib/libc/arch/sparc64/atomic/Makefile.inc b/common/lib/libc/arch/sparc64/atomic/Makefile.inc deleted file mode 100644 index bc058908e..000000000 --- a/common/lib/libc/arch/sparc64/atomic/Makefile.inc +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.6 2009/01/04 17:54:29 pooka Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -SRCS+= atomic_add.S atomic_and.S atomic_cas.S atomic_dec.S \ - atomic_inc.S atomic_or.S atomic_swap.S membar_ops.S - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -SRCS+= atomic_init_cas.c - -.endif diff --git a/common/lib/libc/arch/sparc64/atomic/atomic_add.S b/common/lib/libc/arch/sparc64/atomic/atomic_add.S deleted file mode 100644 index f9df71745..000000000 --- a/common/lib/libc/arch/sparc64/atomic/atomic_add.S +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: atomic_add.S,v 1.6 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_add_32) - ld [%o0], %o2 -1: add %o1, %o2, %o3 - cas [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %icc, 1b - mov %o3, %o2 - retl - add %o1, %o2, %o0 -ATOMIC_OP_ALIAS(atomic_add_32,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) - -ATOMIC_OP_ALIAS(atomic_add_32_nv,_atomic_add_32) -STRONG_ALIAS(_atomic_add_32_nv,_atomic_add_32) -ATOMIC_OP_ALIAS(atomic_add_int_nv,_atomic_add_32) -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32) - -ENTRY(_atomic_add_64) - ldx [%o0], %o2 -1: add %o1, %o2, %o3 - casx [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %xcc, 1b - mov %o3, %o2 - retl - add %o1, %o2, %o0 -ATOMIC_OP_ALIAS(atomic_add_64,_atomic_add_64) - -ATOMIC_OP_ALIAS(atomic_add_64_nv,_atomic_add_64) -STRONG_ALIAS(_atomic_add_64_nv,_atomic_add_64) - -ATOMIC_OP_ALIAS_SIZE(atomic_add_long,_atomic_add) -STRONG_ALIAS_SIZE(_atomic_add_long,_atomic_add) -ATOMIC_OP_ALIAS_SIZE(atomic_add_ptr,_atomic_add) -STRONG_ALIAS_SIZE(_atomic_add_ptr,_atomic_add) - -ATOMIC_OP_ALIAS_SIZE(atomic_add_long_nv,_atomic_add) -STRONG_ALIAS_SIZE(_atomic_add_long_nv,_atomic_add) -ATOMIC_OP_ALIAS_SIZE(atomic_add_ptr_nv,_atomic_add) -STRONG_ALIAS_SIZE(_atomic_add_ptr_nv,_atomic_add) diff --git a/common/lib/libc/arch/sparc64/atomic/atomic_and.S b/common/lib/libc/arch/sparc64/atomic/atomic_and.S deleted file mode 100644 index d60b3b577..000000000 --- a/common/lib/libc/arch/sparc64/atomic/atomic_and.S +++ /dev/null @@ -1,72 +0,0 @@ -/* $NetBSD: atomic_and.S,v 1.6 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_and_32) - ld [%o0], %o2 -1: and %o1, %o2, %o3 - cas [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %icc, 1b - mov %o3, %o2 - retl - and %o1, %o2, %o0 -ATOMIC_OP_ALIAS(atomic_and_32,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) - -ATOMIC_OP_ALIAS(atomic_and_32_nv,_atomic_and_32) -STRONG_ALIAS(_atomic_and_32_nv,_atomic_and_32) -ATOMIC_OP_ALIAS(atomic_and_uint_nv,_atomic_and_32) -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32) - -ENTRY(_atomic_and_64) - ldx [%o0], %o2 -1: and %o1, %o2, %o3 - casx [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %xcc, 1b - mov %o3, %o2 - retl - and %o1, %o2, %o0 -ATOMIC_OP_ALIAS(atomic_and_64,_atomic_and_64) - -ATOMIC_OP_ALIAS(atomic_and_64_nv,_atomic_and_64) -STRONG_ALIAS(_atomic_and_64_nv,_atomic_and_64) - -ATOMIC_OP_ALIAS_SIZE(atomic_and_ulong,_atomic_and) -STRONG_ALIAS_SIZE(_atomic_and_ulong,_atomic_and) - -ATOMIC_OP_ALIAS_SIZE(atomic_and_ulong_nv,_atomic_and) -STRONG_ALIAS_SIZE(_atomic_and_ulong_nv,_atomic_and) diff --git a/common/lib/libc/arch/sparc64/atomic/atomic_cas.S b/common/lib/libc/arch/sparc64/atomic/atomic_cas.S deleted file mode 100644 index 03668b54f..000000000 --- a/common/lib/libc/arch/sparc64/atomic/atomic_cas.S +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: atomic_cas.S,v 1.6 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_cas_32) - cas [%o0], %o1, %o2 - retl - mov %o2, %o0 - -ATOMIC_OP_ALIAS(atomic_cas_32,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) - -ATOMIC_OP_ALIAS(atomic_cas_32_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_32_ni,_atomic_cas_32) -ATOMIC_OP_ALIAS(atomic_cas_uint_ni,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32) - -ENTRY(_atomic_cas_64) - casx [%o0], %o1, %o2 - retl - mov %o2, %o0 - -ATOMIC_OP_ALIAS(atomic_cas_64,_atomic_cas_64) -ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong,_atomic_cas) -STRONG_ALIAS_SIZE(_atomic_cas_ulong,_atomic_cas) -ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr,_atomic_cas) -STRONG_ALIAS_SIZE(_atomic_cas_ptr,_atomic_cas) - -ATOMIC_OP_ALIAS(atomic_cas_64_ni,_atomic_cas_64) -STRONG_ALIAS_SIZE(_atomic_cas_64_ni,_atomic_cas) -ATOMIC_OP_ALIAS_SIZE(atomic_cas_ulong_ni,_atomic_cas) -STRONG_ALIAS_SIZE(_atomic_cas_ulong_ni,_atomic_cas) -ATOMIC_OP_ALIAS_SIZE(atomic_cas_ptr_ni,_atomic_cas) -STRONG_ALIAS_SIZE(_atomic_cas_ptr_ni,_atomic_cas) diff --git a/common/lib/libc/arch/sparc64/atomic/atomic_dec.S b/common/lib/libc/arch/sparc64/atomic/atomic_dec.S deleted file mode 100644 index 79dbac8c6..000000000 --- a/common/lib/libc/arch/sparc64/atomic/atomic_dec.S +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: atomic_dec.S,v 1.7 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_dec_32) - ld [%o0], %o2 -1: add %o2, -1, %o3 - cas [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %icc, 1b - mov %o3, %o2 - retl - add %o2, -1, %o0 -ATOMIC_OP_ALIAS(atomic_dec_32,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) - -ATOMIC_OP_ALIAS(atomic_dec_32_nv,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_32_nv,_atomic_dec_32) -ATOMIC_OP_ALIAS(atomic_dec_uint_nv,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32) - -ENTRY(_atomic_dec_64) - ldx [%o0], %o2 -1: add %o2, -1, %o3 - casx [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %xcc, 1b - mov %o3, %o2 - retl - add %o2, -1, %o0 -ATOMIC_OP_ALIAS(atomic_dec_64,_atomic_dec_64) - -ATOMIC_OP_ALIAS(atomic_dec_64_nv,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_64_nv,_atomic_dec_64) - -ATOMIC_OP_ALIAS_SIZE(atomic_dec_ulong,_atomic_dec) -STRONG_ALIAS_SIZE(_atomic_dec_ulong,_atomic_dec) -ATOMIC_OP_ALIAS_SIZE(atomic_dec_ptr,_atomic_dec) -STRONG_ALIAS_SIZE(_atomic_dec_ptr,_atomic_dec) - -ATOMIC_OP_ALIAS_SIZE(atomic_dec_ulong_nv,_atomic_dec) -STRONG_ALIAS_SIZE(_atomic_dec_ulong_nv,_atomic_dec) -ATOMIC_OP_ALIAS_SIZE(atomic_dec_ptr_nv,_atomic_dec) -STRONG_ALIAS_SIZE(_atomic_dec_ptr_nv,_atomic_dec) diff --git a/common/lib/libc/arch/sparc64/atomic/atomic_inc.S b/common/lib/libc/arch/sparc64/atomic/atomic_inc.S deleted file mode 100644 index 7c0128686..000000000 --- a/common/lib/libc/arch/sparc64/atomic/atomic_inc.S +++ /dev/null @@ -1,76 +0,0 @@ -/* $NetBSD: atomic_inc.S,v 1.6 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_inc_32) - ld [%o0], %o2 -1: add %o2, 1, %o3 - cas [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %icc, 1b - mov %o3, %o2 - retl - add %o2, 1, %o0 -ATOMIC_OP_ALIAS(atomic_inc_32,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) - -ATOMIC_OP_ALIAS(atomic_inc_32_nv,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_32_nv,_atomic_inc_32) -ATOMIC_OP_ALIAS(atomic_inc_uint_nv,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32) - -ENTRY(_atomic_inc_64) - ldx [%o0], %o2 -1: add %o2, 1, %o3 - casx [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %xcc, 1b - mov %o3, %o2 - retl - add %o2, 1, %o0 -ATOMIC_OP_ALIAS(atomic_inc_64,_atomic_inc_64) - -ATOMIC_OP_ALIAS(atomic_inc_64_nv,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_64_nv,_atomic_inc_64) - -ATOMIC_OP_ALIAS_SIZE(atomic_inc_ulong,_atomic_inc) -STRONG_ALIAS_SIZE(_atomic_inc_ulong,_atomic_inc) -ATOMIC_OP_ALIAS_SIZE(atomic_inc_ptr,_atomic_inc) -STRONG_ALIAS_SIZE(_atomic_inc_ptr,_atomic_inc) - -ATOMIC_OP_ALIAS_SIZE(atomic_inc_ulong_nv,_atomic_inc) -STRONG_ALIAS_SIZE(_atomic_inc_ulong_nv,_atomic_inc) -ATOMIC_OP_ALIAS_SIZE(atomic_inc_ptr_nv,_atomic_inc) -STRONG_ALIAS_SIZE(_atomic_inc_ptr_nv,_atomic_inc) diff --git a/common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h b/common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h deleted file mode 100644 index 68c611261..000000000 --- a/common/lib/libc/arch/sparc64/atomic/atomic_op_asm.h +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_op_asm.h,v 1.6 2011/01/17 18:11:10 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_ASM_H_ -#define _ATOMIC_OP_ASM_H_ - -#include - -#if defined(_KERNEL) - -#define ATOMIC_OP_ALIAS(a,s) STRONG_ALIAS(a,s) - -#ifdef __arch64__ -#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _64) -#else -#define ATOMIC_OP_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _32) -#endif - -#else /* _KERNEL */ - -#define ATOMIC_OP_ALIAS(a,s) WEAK_ALIAS(a,s) - -#ifdef __arch64__ -#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s ## _64) -#else -#define ATOMIC_OP_ALIAS_SIZE(a,s) WEAK_ALIAS(a,s ## _32) -#endif - -#endif /* _KERNEL */ - -#ifdef __arch64__ -#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _64) -#else -#define STRONG_ALIAS_SIZE(a,s) STRONG_ALIAS(a,s ## _32) -#endif - -#endif /* _ATOMIC_OP_ASM_H_ */ diff --git a/common/lib/libc/arch/sparc64/atomic/atomic_or.S b/common/lib/libc/arch/sparc64/atomic/atomic_or.S deleted file mode 100644 index edb82d393..000000000 --- a/common/lib/libc/arch/sparc64/atomic/atomic_or.S +++ /dev/null @@ -1,72 +0,0 @@ -/* $NetBSD: atomic_or.S,v 1.7 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_or_32) - ld [%o0], %o2 -1: or %o1, %o2, %o3 - cas [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %icc, 1b - mov %o3, %o2 - retl - or %o1, %o2, %o0 -ATOMIC_OP_ALIAS(atomic_or_32,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) - -ATOMIC_OP_ALIAS(atomic_or_32_nv,_atomic_or_32) -STRONG_ALIAS(_atomic_or_32_nv,_atomic_or_32) -ATOMIC_OP_ALIAS(atomic_or_uint_nv,_atomic_or_32) -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32) - -ENTRY(_atomic_or_64) - ldx [%o0], %o2 -1: or %o1, %o2, %o3 - casx [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %xcc, 1b - mov %o3, %o2 - retl - or %o1, %o2, %o0 -ATOMIC_OP_ALIAS(atomic_or_64,_atomic_or_64) - -ATOMIC_OP_ALIAS(atomic_or_64_nv,_atomic_or_64) -STRONG_ALIAS(_atomic_or_64_nv,_atomic_or_64) - -ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong,_atomic_or) -STRONG_ALIAS_SIZE(_atomic_or_ulong,_atomic_or) - -ATOMIC_OP_ALIAS_SIZE(atomic_or_ulong_nv,_atomic_or) -STRONG_ALIAS_SIZE(_atomic_or_ulong_nv,_atomic_or) diff --git a/common/lib/libc/arch/sparc64/atomic/atomic_swap.S b/common/lib/libc/arch/sparc64/atomic/atomic_swap.S deleted file mode 100644 index 03f3288bb..000000000 --- a/common/lib/libc/arch/sparc64/atomic/atomic_swap.S +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_swap.S,v 1.6 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -ENTRY(_atomic_swap_32) - ld [%o0], %o2 -1: mov %o1, %o3 - cas [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %icc, 1b - mov %o3, %o2 - retl - mov %o3, %o0 -ATOMIC_OP_ALIAS(atomic_swap_32,_atomic_swap_32) -ATOMIC_OP_ALIAS(atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) - -ENTRY(_atomic_swap_64) - ldx [%o0], %o2 -1: mov %o1, %o3 - casx [%o0], %o2, %o3 - cmp %o2, %o3 - bne,a,pn %xcc, 1b - mov %o3, %o2 - retl - mov %o3, %o0 -ATOMIC_OP_ALIAS(atomic_swap_64,_atomic_swap_64) - -ATOMIC_OP_ALIAS_SIZE(atomic_swap_ulong,_atomic_swap) -STRONG_ALIAS_SIZE(_atomic_swap_ulong,_atomic_swap) -ATOMIC_OP_ALIAS_SIZE(atomic_swap_ptr,_atomic_swap) -STRONG_ALIAS_SIZE(_atomic_swap_ptr,_atomic_swap) diff --git a/common/lib/libc/arch/sparc64/atomic/membar_ops.S b/common/lib/libc/arch/sparc64/atomic/membar_ops.S deleted file mode 100644 index a3f5cb59f..000000000 --- a/common/lib/libc/arch/sparc64/atomic/membar_ops.S +++ /dev/null @@ -1,54 +0,0 @@ -/* $NetBSD: membar_ops.S,v 1.5 2008/05/25 15:56:12 chs Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe, and by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_asm.h" - - .text - -/* These assume Total Store Order (TSO) */ - -ENTRY(_membar_producer) - retl - nop - -ENTRY(_membar_consumer) - membar #LoadLoad - retl - nop - -ATOMIC_OP_ALIAS(membar_producer,_membar_producer) -ATOMIC_OP_ALIAS(membar_consumer,_membar_consumer) -ATOMIC_OP_ALIAS(membar_enter,_membar_consumer) -STRONG_ALIAS(_membar_enter,_membar_consumer) -ATOMIC_OP_ALIAS(membar_exit,_membar_consumer) -STRONG_ALIAS(_membar_exit,_membar_consumer) -ATOMIC_OP_ALIAS(membar_sync,_membar_consumer) -STRONG_ALIAS(_membar_sync,_membar_consumer) diff --git a/common/lib/libc/arch/sparc64/gen/mul.S b/common/lib/libc/arch/sparc64/gen/mul.S deleted file mode 100644 index b4f9f3449..000000000 --- a/common/lib/libc/arch/sparc64/gen/mul.S +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: mul.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: mul.s,v 1.5 92/06/25 13:24:03 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)mul.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: mul.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * Signed multiply. - * - * Returns %o0 * %o1 in %o0 - * - * According to the manual the smaller parameter should be in - * rs1, so we'll move it there. - */ - -FUNC(.mul) - cmp %o0, %o1 - bge 1f - nop - retl - mulx %o0, %o1, %o0 -1: - retl - mulx %o1, %o0, %o0 diff --git a/common/lib/libc/arch/sparc64/gen/saveregs.S b/common/lib/libc/arch/sparc64/gen/saveregs.S deleted file mode 100644 index 0cd77ba2b..000000000 --- a/common/lib/libc/arch/sparc64/gen/saveregs.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: saveregs.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: saveregs.s,v 1.1 91/07/06 17:22:33 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: saveregs.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif /* LIBC_SCCS and not lint */ - -/* - * Save register arguments in caller's `arg dump' area, so that - * stdarg functions work. - * - * This really should be done with a pointer to the arg dump area; - * our caller should allocate that area, not our caller's caller. - * But then, they did not let me invent the calling sequence.... - * - * We assume the caller has executed a `save' instruction. - */ -#define REGOFF (BIAS - CC64FSZ) - -ENTRY(__builtin_saveregs) - stx %i0, [%fp + REGOFF + 0x00] ! fr->fr_argd[0] - stx %i1, [%fp + REGOFF + 0x08] ! fr->fr_argd[1] - stx %i2, [%fp + REGOFF + 0x10] ! fr->fr_argd[2] - stx %i3, [%fp + REGOFF + 0x18] ! fr->fr_argd[3] - stx %i4, [%fp + REGOFF + 0x20] ! fr->fr_argd[4] - retl - stx %i5, [%fp + REGOFF + 0x28] ! fr->fr_argd[5] diff --git a/common/lib/libc/arch/sparc64/gen/umul.S b/common/lib/libc/arch/sparc64/gen/umul.S deleted file mode 100644 index d97d01bd2..000000000 --- a/common/lib/libc/arch/sparc64/gen/umul.S +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: umul.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: umul.s,v 1.4 92/06/25 13:24:05 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)umul.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: umul.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * Unsigned multiply. Returns %o0 * %o1 in %o0 - * - * According to the manual the smaller parameter should be in - * rs1, so we'll move it there. - */ - -FUNC(.umul) - cmp %o0, %o1 - bge 1f - nop - retl - mulx %o0, %o1, %o0 -1: - retl - mulx %o1, %o0, %o0 diff --git a/common/lib/libc/arch/sparc64/net/htonl.S b/common/lib/libc/arch/sparc64/net/htonl.S deleted file mode 100644 index 15f0e4e53..000000000 --- a/common/lib/libc/arch/sparc64/net/htonl.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: htonl.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: htonl.s,v 1.1 92/06/25 12:47:05 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)htonl.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: htonl.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* netorder = htonl(hostorder) */ - - -ENTRY(htonl) - retl - srl %o0, 0, %o0 /* zero extend -- or do we sign extend? */ diff --git a/common/lib/libc/arch/sparc64/net/htons.S b/common/lib/libc/arch/sparc64/net/htons.S deleted file mode 100644 index 2d06027fc..000000000 --- a/common/lib/libc/arch/sparc64/net/htons.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: htons.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: htons.s,v 1.1 92/06/25 12:47:05 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)htons.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: htons.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* netorder = htons(hostorder) */ -ENTRY(htons) - sethi %hi(0xffff0000), %o1 - signx %o1, %o1 - retl - andn %o0, %o1, %o0 diff --git a/common/lib/libc/arch/sparc64/net/ntohl.S b/common/lib/libc/arch/sparc64/net/ntohl.S deleted file mode 100644 index cb5bde8b5..000000000 --- a/common/lib/libc/arch/sparc64/net/ntohl.S +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: ntohl.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: ntohl.s,v 1.1 92/06/25 12:47:06 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)ntohl.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: ntohl.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* hostorder = ntohl(netorder) */ -ENTRY(ntohl) - retl - signx %o0, %o0 diff --git a/common/lib/libc/arch/sparc64/net/ntohs.S b/common/lib/libc/arch/sparc64/net/ntohs.S deleted file mode 100644 index f377d9798..000000000 --- a/common/lib/libc/arch/sparc64/net/ntohs.S +++ /dev/null @@ -1,54 +0,0 @@ -/* $NetBSD: ntohs.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: ntohs.s,v 1.1 92/06/25 12:47:07 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)ntohs.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: ntohs.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -/* hostorder = ntohs(netorder) */ - -ENTRY(ntohs) - sethi %hi(0xffff0000), %o1 - signx %o1, %o1 - retl - andn %o0, %o1, %o0 - diff --git a/common/lib/libc/arch/sparc64/string/ffs.S b/common/lib/libc/arch/sparc64/string/ffs.S deleted file mode 100644 index 2d459492f..000000000 --- a/common/lib/libc/arch/sparc64/string/ffs.S +++ /dev/null @@ -1,135 +0,0 @@ -/* $NetBSD: ffs.S,v 1.3 2013/09/12 15:36:14 joerg Exp $ */ - -/* - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * from: Header: ffs.s,v 1.3 92/07/07 00:23:57 torek Exp - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 - .asciz "@(#)ffs.s 8.1 (Berkeley) 6/4/93" -#else - RCSID("$NetBSD: ffs.S,v 1.3 2013/09/12 15:36:14 joerg Exp $") -#endif -#endif /* LIBC_SCCS and not lint */ - -#if 0 - /* - * We have a popcount instruction -- use it. - * only uses %o0, %o1, %o2 - * - * Here's the pseudo-code from the v9 spec: - * - * int ffs(unsigned zz) { - * return popc( zz ^ ( ~ (-zz))); - * } - * - * XXXX sptifires and blackbirds don't implement popc, - * so we won't use this nice clean code 8^(. - */ -ENTRY(ffs) - neg %o0, %o1 ! %o1 = -zz - xnor %o0, %o1, %o2 ! %o2 = zz ^ ~ -zz - popc %o2, %o1 - movrz %o0, %g0, %o1 ! result of ffs(0) should be zero - retl - mov %o1, %o0 -#endif -/* - * ffs returns the number of the rightmost bit set in its argument, - * i.e., the lowest value such that (x & (ffs(x) - 1)) is nonzero. - * If no bits are set, ffs returns 0. - * - * We use a table lookup on each byte. - * - * In each section below, %o1 is the current byte (0, 1, 2, or 3). - * The last byte is handled specially: for the first three, - * if that byte is nonzero, we return the table value - * (plus 0, 8, or 16 for the byte number), but for the last - * one, we just return the table value plus 24. This means - * that ffstab[0] must be -24 so that ffs(0) will return 0. - */ -ENTRY(ffs) -#ifdef __PIC__ - PICCY_SET(ffstab, %o2, %o3) -#else - set ffstab, %o2 -#endif - andcc %o0, 0xff, %o1 ! get low byte - be,a 1f ! try again if 0 - srl %o0, 8, %o0 ! delay slot, get ready for next byte - - retl ! return ffstab[%o1] - ldsb [%o2 + %o1], %o0 - -1: - andcc %o0, 0xff, %o1 ! byte 1 like byte 0... - be,a 2f - srl %o0, 8, %o0 ! (use delay to prepare for byte 2) - - ldsb [%o2 + %o1], %o0 - retl ! return ffstab[%o1] + 8 - add %o0, 8, %o0 - -2: - andcc %o0, 0xff, %o1 - be,a 3f - srl %o0, 8, %o0 ! (prepare for byte 3) - - ldsb [%o2 + %o1], %o0 - retl ! return ffstab[%o1] + 16 - add %o0, 16, %o0 - -3: ! just return ffstab[%o0] + 24 - ldsb [%o2 + %o0], %o0 - retl - add %o0, 24, %o0 - -ffstab: - .byte -24,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 00-0f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-1f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 20-2f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 30-3f */ - .byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 40-4f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 50-5f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 60-6f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 70-7f */ - .byte 8,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 80-8f */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* 10-9f */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* a0-af */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* b0-bf */ - .byte 7,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* c0-cf */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* d0-df */ - .byte 6,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* e0-ef */ - .byte 5,1,2,1,3,1,2,1,4,1,2,1,3,1,2,1 /* f0-ff */ diff --git a/common/lib/libc/arch/sparc64/string/memcpy.S b/common/lib/libc/arch/sparc64/string/memcpy.S deleted file mode 100644 index 1b65a11ba..000000000 --- a/common/lib/libc/arch/sparc64/string/memcpy.S +++ /dev/null @@ -1,1627 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.2 2013/03/17 02:13:10 christos Exp $ */ - -/* - * Copyright (c) 1996-2002 Eduardo Horvath - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include "strmacros.h" -#if defined(LIBC_SCCS) && !defined(lint) -RCSID("$NetBSD: memcpy.S,v 1.2 2013/03/17 02:13:10 christos Exp $") -#endif /* LIBC_SCCS and not lint */ - -/* - * memcpy - * Assumes regions do not overlap; - * - * Must not use %g7 (see copyin/copyout above). - */ -ENTRY(memcpy) /* dest, src, size */ - /* - * Swap args for bcopy. Gcc generates calls to memcpy for - * structure assignments. - */ - mov %o0, %o3 - mov %o1, %o0 - mov %o3, %o1 -#if !defined(_KERNEL) || defined(_RUMPKERNEL) -ENTRY(bcopy) /* src, dest, size */ -#endif -#ifdef DEBUG -#if defined(_KERNEL) && !defined(_RUMPKERNEL) - set pmapdebug, %o4 - ld [%o4], %o4 - btst 0x80, %o4 ! PDB_COPY - bz,pt %icc, 3f - nop -#endif - save %sp, -CC64FSZ, %sp - mov %i0, %o1 - set 2f, %o0 - mov %i1, %o2 - call printf - mov %i2, %o3 -! ta 1; nop - restore - .data -2: .asciz "memcpy(%p<-%p,%x)\n" - _ALIGN - .text -3: -#endif - - cmp %o2, BCOPY_SMALL - -Lmemcpy_start: - bge,pt CCCR, 2f ! if >= this many, go be fancy. - cmp %o2, 256 - - mov %o1, %o5 ! Save memcpy return value - /* - * Not much to copy, just do it a byte at a time. - */ - deccc %o2 ! while (--len >= 0) - bl 1f - .empty -0: - inc %o0 - ldsb [%o0 - 1], %o4 ! (++dst)[-1] = *src++; - stb %o4, [%o1] - deccc %o2 - bge 0b - inc %o1 -1: - retl - mov %o5, %o0 - NOTREACHED - - /* - * Plenty of data to copy, so try to do it optimally. - */ -2: -#ifdef USE_BLOCK_STORE_LOAD - ! If it is big enough, use VIS instructions - bge Lmemcpy_block - nop -#endif /* USE_BLOCK_STORE_LOAD */ -Lmemcpy_fancy: - - !! - !! First align the output to a 8-byte entity - !! - - save %sp, -CC64FSZ, %sp - - mov %i0, %l0 - mov %i1, %l1 - - mov %i2, %l2 - btst 1, %l1 - - bz,pt %icc, 4f - btst 2, %l1 - ldub [%l0], %l4 ! Load 1st byte - - deccc 1, %l2 - ble,pn CCCR, Lmemcpy_finish ! XXXX - inc 1, %l0 - - stb %l4, [%l1] ! Store 1st byte - inc 1, %l1 ! Update address - btst 2, %l1 -4: - bz,pt %icc, 4f - - btst 1, %l0 - bz,a 1f - lduh [%l0], %l4 ! Load short - - ldub [%l0], %l4 ! Load bytes - - ldub [%l0+1], %l3 - sllx %l4, 8, %l4 - or %l3, %l4, %l4 - -1: - deccc 2, %l2 - ble,pn CCCR, Lmemcpy_finish ! XXXX - inc 2, %l0 - sth %l4, [%l1] ! Store 1st short - - inc 2, %l1 -4: - btst 4, %l1 - bz,pt CCCR, 4f - - btst 3, %l0 - bz,a,pt CCCR, 1f - lduw [%l0], %l4 ! Load word -1 - - btst 1, %l0 - bz,a,pt %icc, 2f - lduh [%l0], %l4 - - ldub [%l0], %l4 - - lduh [%l0+1], %l3 - sllx %l4, 16, %l4 - or %l4, %l3, %l4 - - ldub [%l0+3], %l3 - sllx %l4, 8, %l4 - ba,pt %icc, 1f - or %l4, %l3, %l4 - -2: - lduh [%l0+2], %l3 - sllx %l4, 16, %l4 - or %l4, %l3, %l4 - -1: - deccc 4, %l2 - ble,pn CCCR, Lmemcpy_finish ! XXXX - inc 4, %l0 - - st %l4, [%l1] ! Store word - inc 4, %l1 -4: - !! - !! We are now 32-bit aligned in the dest. - !! -Lmemcpy_common: - - and %l0, 7, %l4 ! Shift amount - andn %l0, 7, %l0 ! Source addr - - brz,pt %l4, Lmemcpy_noshift8 ! No shift version... - - sllx %l4, 3, %l4 ! In bits - mov 8<<3, %l3 - - ldx [%l0], %o0 ! Load word -1 - sub %l3, %l4, %l3 ! Reverse shift - deccc 12*8, %l2 ! Have enough room? - - sllx %o0, %l4, %o0 - bl,pn CCCR, 2f - and %l3, 0x38, %l3 -Lmemcpy_unrolled8: - - /* - * This is about as close to optimal as you can get, since - * the shifts require EU0 and cannot be paired, and you have - * 3 dependent operations on the data. - */ - -! ldx [%l0+0*8], %o0 ! Already done -! sllx %o0, %l4, %o0 ! Already done - ldx [%l0+1*8], %o1 - ldx [%l0+2*8], %o2 - ldx [%l0+3*8], %o3 - ldx [%l0+4*8], %o4 - ba,pt %icc, 1f - ldx [%l0+5*8], %o5 - .align 8 -1: - srlx %o1, %l3, %g1 - inc 6*8, %l0 - - sllx %o1, %l4, %o1 - or %g1, %o0, %g6 - ldx [%l0+0*8], %o0 - - stx %g6, [%l1+0*8] - srlx %o2, %l3, %g1 - - sllx %o2, %l4, %o2 - or %g1, %o1, %g6 - ldx [%l0+1*8], %o1 - - stx %g6, [%l1+1*8] - srlx %o3, %l3, %g1 - - sllx %o3, %l4, %o3 - or %g1, %o2, %g6 - ldx [%l0+2*8], %o2 - - stx %g6, [%l1+2*8] - srlx %o4, %l3, %g1 - - sllx %o4, %l4, %o4 - or %g1, %o3, %g6 - ldx [%l0+3*8], %o3 - - stx %g6, [%l1+3*8] - srlx %o5, %l3, %g1 - - sllx %o5, %l4, %o5 - or %g1, %o4, %g6 - ldx [%l0+4*8], %o4 - - stx %g6, [%l1+4*8] - srlx %o0, %l3, %g1 - deccc 6*8, %l2 ! Have enough room? - - sllx %o0, %l4, %o0 ! Next loop - or %g1, %o5, %g6 - ldx [%l0+5*8], %o5 - - stx %g6, [%l1+5*8] - bge,pt CCCR, 1b - inc 6*8, %l1 - -Lmemcpy_unrolled8_cleanup: - !! - !! Finished 8 byte block, unload the regs. - !! - srlx %o1, %l3, %g1 - inc 5*8, %l0 - - sllx %o1, %l4, %o1 - or %g1, %o0, %g6 - - stx %g6, [%l1+0*8] - srlx %o2, %l3, %g1 - - sllx %o2, %l4, %o2 - or %g1, %o1, %g6 - - stx %g6, [%l1+1*8] - srlx %o3, %l3, %g1 - - sllx %o3, %l4, %o3 - or %g1, %o2, %g6 - - stx %g6, [%l1+2*8] - srlx %o4, %l3, %g1 - - sllx %o4, %l4, %o4 - or %g1, %o3, %g6 - - stx %g6, [%l1+3*8] - srlx %o5, %l3, %g1 - - sllx %o5, %l4, %o5 - or %g1, %o4, %g6 - - stx %g6, [%l1+4*8] - inc 5*8, %l1 - - mov %o5, %o0 ! Save our unused data - dec 5*8, %l2 -2: - inccc 12*8, %l2 - bz,pn %icc, Lmemcpy_complete - - !! Unrolled 8 times -Lmemcpy_aligned8: -! ldx [%l0], %o0 ! Already done -! sllx %o0, %l4, %o0 ! Shift high word - - deccc 8, %l2 ! Pre-decrement - bl,pn CCCR, Lmemcpy_finish -1: - ldx [%l0+8], %o1 ! Load word 0 - inc 8, %l0 - - srlx %o1, %l3, %g6 - or %g6, %o0, %g6 ! Combine - - stx %g6, [%l1] ! Store result - inc 8, %l1 - - deccc 8, %l2 - bge,pn CCCR, 1b - sllx %o1, %l4, %o0 - - btst 7, %l2 ! Done? - bz,pt CCCR, Lmemcpy_complete - - !! - !! Loadup the last dregs into %o0 and shift it into place - !! - srlx %l3, 3, %g6 ! # bytes in %o0 - dec 8, %g6 ! - 8 - !! n-8 - (by - 8) -> n - by - subcc %l2, %g6, %g0 ! # bytes we need - ble,pt %icc, Lmemcpy_finish - nop - ldx [%l0+8], %o1 ! Need another word - srlx %o1, %l3, %o1 - ba,pt %icc, Lmemcpy_finish - or %o0, %o1, %o0 ! All loaded up. - -Lmemcpy_noshift8: - deccc 6*8, %l2 ! Have enough room? - bl,pn CCCR, 2f - nop - ba,pt %icc, 1f - nop - .align 32 -1: - ldx [%l0+0*8], %o0 - ldx [%l0+1*8], %o1 - ldx [%l0+2*8], %o2 - stx %o0, [%l1+0*8] - stx %o1, [%l1+1*8] - stx %o2, [%l1+2*8] - - - ldx [%l0+3*8], %o3 - ldx [%l0+4*8], %o4 - ldx [%l0+5*8], %o5 - inc 6*8, %l0 - stx %o3, [%l1+3*8] - deccc 6*8, %l2 - stx %o4, [%l1+4*8] - stx %o5, [%l1+5*8] - bge,pt CCCR, 1b - inc 6*8, %l1 -2: - inc 6*8, %l2 -1: - deccc 8, %l2 - bl,pn %icc, 1f ! < 0 --> sub word - nop - ldx [%l0], %g6 - inc 8, %l0 - stx %g6, [%l1] - bg,pt %icc, 1b ! Exactly 0 --> done - inc 8, %l1 -1: - btst 7, %l2 ! Done? - bz,pt CCCR, Lmemcpy_complete - clr %l4 - ldx [%l0], %o0 -Lmemcpy_finish: - - brz,pn %l2, 2f ! 100% complete? - cmp %l2, 8 ! Exactly 8 bytes? - bz,a,pn CCCR, 2f - stx %o0, [%l1] - - btst 4, %l2 ! Word store? - bz CCCR, 1f - srlx %o0, 32, %g6 ! Shift high word down - stw %g6, [%l1] - inc 4, %l1 - mov %o0, %g6 ! Operate on the low bits -1: - btst 2, %l2 - mov %g6, %o0 - bz 1f - srlx %o0, 16, %g6 - - sth %g6, [%l1] ! Store short - inc 2, %l1 - mov %o0, %g6 ! Operate on low bytes -1: - mov %g6, %o0 - btst 1, %l2 ! Byte aligned? - bz 2f - srlx %o0, 8, %g6 - - stb %g6, [%l1] ! Store last byte - inc 1, %l1 ! Update address -2: -Lmemcpy_complete: -#if 0 - !! - !! verify copy success. - !! - - mov %i0, %o2 - mov %i1, %o4 - mov %i2, %l4 -0: - ldub [%o2], %o1 - inc %o2 - ldub [%o4], %o3 - inc %o4 - cmp %o3, %o1 - bnz 1f - dec %l4 - brnz %l4, 0b - nop - ba 2f - nop - -1: - set 0f, %o0 - call printf - sub %i2, %l4, %o5 - set 1f, %o0 - mov %i0, %o2 - mov %i1, %o1 - call printf - mov %i2, %o3 - ta 1 - .data -0: .asciz "memcpy failed: %x@%p != %x@%p byte %d\n" -1: .asciz "memcpy(%p, %p, %lx)\n" - .align 8 - .text -2: -#endif - ret - restore %i1, %g0, %o0 - -#ifdef USE_BLOCK_STORE_LOAD - -/* - * Block copy. Useful for >256 byte copies. - * - * Benchmarking has shown this always seems to be slower than - * the integer version, so this is disabled. Maybe someone will - * figure out why sometime. - */ - -Lmemcpy_block: - sethi %hi(block_disable), %o3 - ldx [ %o3 + %lo(block_disable) ], %o3 - brnz,pn %o3, Lmemcpy_fancy - !! Make sure our trap table is installed - set _C_LABEL(trapbase), %o5 - rdpr %tba, %o3 - sub %o3, %o5, %o3 - brnz,pn %o3, Lmemcpy_fancy ! No, then don't use block load/store - nop -#if defined(_KERNEL) && !defined(_RUMPKERNEL) -/* - * Kernel: - * - * Here we use VIS instructions to do a block clear of a page. - * But before we can do that we need to save and enable the FPU. - * The last owner of the FPU registers is fplwp, and - * fplwp->l_md.md_fpstate is the current fpstate. If that's not - * null, call savefpstate() with it to store our current fp state. - * - * Next, allocate an aligned fpstate on the stack. We will properly - * nest calls on a particular stack so this should not be a problem. - * - * Now we grab either curlwp (or if we're on the interrupt stack - * lwp0). We stash its existing fpstate in a local register and - * put our new fpstate in curlwp->p_md.md_fpstate. We point - * fplwp at curlwp (or lwp0) and enable the FPU. - * - * If we are ever preempted, our FPU state will be saved in our - * fpstate. Then, when we're resumed and we take an FPDISABLED - * trap, the trap handler will be able to fish our FPU state out - * of curlwp (or lwp0). - * - * On exiting this routine we undo the damage: restore the original - * pointer to curlwp->p_md.md_fpstate, clear our fplwp, and disable - * the MMU. - * - * - * Register usage, Kernel only (after save): - * - * %i0 src - * %i1 dest - * %i2 size - * - * %l0 XXXX DEBUG old fpstate - * %l1 fplwp (hi bits only) - * %l2 orig fplwp - * %l3 orig fpstate - * %l5 curlwp - * %l6 old fpstate - * - * Register ussage, Kernel and user: - * - * %g1 src (retval for memcpy) - * - * %o0 src - * %o1 dest - * %o2 end dest - * %o5 last safe fetchable address - */ - - ENABLE_FPU(0) - - mov %i0, %o0 ! Src addr. - mov %i1, %o1 ! Store our dest ptr here. - mov %i2, %o2 ! Len counter -#endif /* _KERNEL */ - - !! - !! First align the output to a 64-bit entity - !! - - mov %o1, %g1 ! memcpy retval - add %o0, %o2, %o5 ! End of source block - - andn %o0, 7, %o3 ! Start of block - dec %o5 - fzero %f0 - - andn %o5, BLOCK_ALIGN, %o5 ! Last safe addr. - ldd [%o3], %f2 ! Load 1st word - - dec 8, %o3 ! Move %o3 1 word back - btst 1, %o1 - bz 4f - - mov -7, %o4 ! Lowest src addr possible - alignaddr %o0, %o4, %o4 ! Base addr for load. - - cmp %o3, %o4 - be,pt CCCR, 1f ! Already loaded? - mov %o4, %o3 - fmovd %f2, %f0 ! No. Shift - ldd [%o3+8], %f2 ! And load -1: - - faligndata %f0, %f2, %f4 ! Isolate 1st byte - - stda %f4, [%o1] ASI_FL8_P ! Store 1st byte - inc 1, %o1 ! Update address - inc 1, %o0 - dec 1, %o2 -4: - btst 2, %o1 - bz 4f - - mov -6, %o4 ! Calculate src - 6 - alignaddr %o0, %o4, %o4 ! calculate shift mask and dest. - - cmp %o3, %o4 ! Addresses same? - be,pt CCCR, 1f - mov %o4, %o3 - fmovd %f2, %f0 ! Shuffle data - ldd [%o3+8], %f2 ! Load word 0 -1: - faligndata %f0, %f2, %f4 ! Move 1st short low part of f8 - - stda %f4, [%o1] ASI_FL16_P ! Store 1st short - dec 2, %o2 - inc 2, %o1 - inc 2, %o0 -4: - brz,pn %o2, Lmemcpy_blockfinish ! XXXX - - btst 4, %o1 - bz 4f - - mov -4, %o4 - alignaddr %o0, %o4, %o4 ! calculate shift mask and dest. - - cmp %o3, %o4 ! Addresses same? - beq,pt CCCR, 1f - mov %o4, %o3 - fmovd %f2, %f0 ! Shuffle data - ldd [%o3+8], %f2 ! Load word 0 -1: - faligndata %f0, %f2, %f4 ! Move 1st short low part of f8 - - st %f5, [%o1] ! Store word - dec 4, %o2 - inc 4, %o1 - inc 4, %o0 -4: - brz,pn %o2, Lmemcpy_blockfinish ! XXXX - !! - !! We are now 32-bit aligned in the dest. - !! -Lmemcpy_block_common: - - mov -0, %o4 - alignaddr %o0, %o4, %o4 ! base - shift - - cmp %o3, %o4 ! Addresses same? - beq,pt CCCR, 1f - mov %o4, %o3 - fmovd %f2, %f0 ! Shuffle data - ldd [%o3+8], %f2 ! Load word 0 -1: - add %o3, 8, %o0 ! now use %o0 for src - - !! - !! Continue until our dest is block aligned - !! -Lmemcpy_block_aligned8: -1: - brz %o2, Lmemcpy_blockfinish - btst BLOCK_ALIGN, %o1 ! Block aligned? - bz 1f - - faligndata %f0, %f2, %f4 ! Generate result - deccc 8, %o2 - ble,pn %icc, Lmemcpy_blockfinish ! Should never happen - fmovd %f4, %f48 - - std %f4, [%o1] ! Store result - inc 8, %o1 - - fmovd %f2, %f0 - inc 8, %o0 - ba,pt %xcc, 1b ! Not yet. - ldd [%o0], %f2 ! Load next part -Lmemcpy_block_aligned64: -1: - -/* - * 64-byte aligned -- ready for block operations. - * - * Here we have the destination block aligned, but the - * source pointer may not be. Sub-word alignment will - * be handled by faligndata instructions. But the source - * can still be potentially aligned to 8 different words - * in our 64-bit block, so we have 8 different copy routines. - * - * Once we figure out our source alignment, we branch - * to the appropriate copy routine, which sets up the - * alignment for faligndata and loads (sets) the values - * into the source registers and does the copy loop. - * - * When were down to less than 1 block to store, we - * exit the copy loop and execute cleanup code. - * - * Block loads and stores are not properly interlocked. - * Stores save one reg/cycle, so you can start overwriting - * registers the cycle after the store is issued. - * - * Block loads require a block load to a different register - * block or a membar #Sync before accessing the loaded - * data. - * - * Since the faligndata instructions may be offset as far - * as 7 registers into a block (if you are shifting source - * 7 -> dest 0), you need 3 source register blocks for full - * performance: one you are copying, one you are loading, - * and one for interlocking. Otherwise, we would need to - * sprinkle the code with membar #Sync and lose the advantage - * of running faligndata in parallel with block stores. This - * means we are fetching a full 128 bytes ahead of the stores. - * We need to make sure the prefetch does not inadvertently - * cross a page boundary and fault on data that we will never - * store. - * - */ -#if 1 - and %o0, BLOCK_ALIGN, %o3 - srax %o3, 3, %o3 ! Isolate the offset - - brz %o3, L100 ! 0->0 - btst 4, %o3 - bnz %xcc, 4f - btst 2, %o3 - bnz %xcc, 2f - btst 1, %o3 - ba,pt %xcc, L101 ! 0->1 - nop /* XXX spitfire bug */ -2: - bz %xcc, L102 ! 0->2 - nop - ba,pt %xcc, L103 ! 0->3 - nop /* XXX spitfire bug */ -4: - bnz %xcc, 2f - btst 1, %o3 - bz %xcc, L104 ! 0->4 - nop - ba,pt %xcc, L105 ! 0->5 - nop /* XXX spitfire bug */ -2: - bz %xcc, L106 ! 0->6 - nop - ba,pt %xcc, L107 ! 0->7 - nop /* XXX spitfire bug */ -#else - - !! - !! Isolate the word offset, which just happens to be - !! the slot in our jump table. - !! - !! This is 6 insns, most of which cannot be paired, - !! which is about the same as the above version. - !! - rd %pc, %o4 -1: - and %o0, 0x31, %o3 - add %o3, (Lmemcpy_block_jmp - 1b), %o3 - jmpl %o4 + %o3, %g0 - nop - - !! - !! Jump table - !! - -Lmemcpy_block_jmp: - ba,a,pt %xcc, L100 - nop - ba,a,pt %xcc, L101 - nop - ba,a,pt %xcc, L102 - nop - ba,a,pt %xcc, L103 - nop - ba,a,pt %xcc, L104 - nop - ba,a,pt %xcc, L105 - nop - ba,a,pt %xcc, L106 - nop - ba,a,pt %xcc, L107 - nop -#endif - - !! - !! Source is block aligned. - !! - !! Just load a block and go. - !! -L100: -#ifdef RETURN_NAME - sethi %hi(1f), %g1 - ba,pt %icc, 2f - or %g1, %lo(1f), %g1 -1: - .asciz "L100" - .align 8 -2: -#endif - fmovd %f0 , %f62 - ldda [%o0] ASI_BLK_P, %f0 - inc BLOCK_SIZE, %o0 - cmp %o0, %o5 - bleu,a,pn %icc, 3f - ldda [%o0] ASI_BLK_P, %f16 - ba,pt %icc, 3f - membar #Sync - - .align 32 ! ICache align. -3: - faligndata %f62, %f0, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f0, %f2, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f2, %f4, %f36 - cmp %o0, %o5 - faligndata %f4, %f6, %f38 - faligndata %f6, %f8, %f40 - faligndata %f8, %f10, %f42 - faligndata %f10, %f12, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f12, %f14, %f46 - - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f48 - membar #Sync -2: - stda %f32, [%o1] ASI_STORE - faligndata %f14, %f16, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f16, %f18, %f34 - inc BLOCK_SIZE, %o1 - faligndata %f18, %f20, %f36 - dec BLOCK_SIZE, %o2 - faligndata %f20, %f22, %f38 - cmp %o0, %o5 - faligndata %f22, %f24, %f40 - faligndata %f24, %f26, %f42 - faligndata %f26, %f28, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f28, %f30, %f46 - - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f0 - membar #Sync -2: - stda %f32, [%o1] ASI_STORE - faligndata %f30, %f48, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f48, %f50, %f34 - inc BLOCK_SIZE, %o1 - faligndata %f50, %f52, %f36 - dec BLOCK_SIZE, %o2 - faligndata %f52, %f54, %f38 - cmp %o0, %o5 - faligndata %f54, %f56, %f40 - faligndata %f56, %f58, %f42 - faligndata %f58, %f60, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f60, %f62, %f46 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 ! Increment is at top - membar #Sync -2: - stda %f32, [%o1] ASI_STORE - ba 3b - inc BLOCK_SIZE, %o1 - - !! - !! Source at BLOCK_ALIGN+8 - !! - !! We need to load almost 1 complete block by hand. - !! -L101: -#ifdef RETURN_NAME - sethi %hi(1f), %g1 - ba,pt %icc, 2f - or %g1, %lo(1f), %g1 -1: - .asciz "L101" - .align 8 -2: -#endif -! fmovd %f0, %f0 ! Hoist fmovd - ldd [%o0], %f2 - inc 8, %o0 - ldd [%o0], %f4 - inc 8, %o0 - ldd [%o0], %f6 - inc 8, %o0 - ldd [%o0], %f8 - inc 8, %o0 - ldd [%o0], %f10 - inc 8, %o0 - ldd [%o0], %f12 - inc 8, %o0 - ldd [%o0], %f14 - inc 8, %o0 - - cmp %o0, %o5 - bleu,a,pn %icc, 3f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -3: - faligndata %f0, %f2, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f2, %f4, %f34 - cmp %o0, %o5 - faligndata %f4, %f6, %f36 - dec BLOCK_SIZE, %o2 - faligndata %f6, %f8, %f38 - faligndata %f8, %f10, %f40 - faligndata %f10, %f12, %f42 - faligndata %f12, %f14, %f44 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f48 - membar #Sync -2: - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f14, %f16, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f16, %f18, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f18, %f20, %f34 - inc BLOCK_SIZE, %o1 - faligndata %f20, %f22, %f36 - cmp %o0, %o5 - faligndata %f22, %f24, %f38 - dec BLOCK_SIZE, %o2 - faligndata %f24, %f26, %f40 - faligndata %f26, %f28, %f42 - faligndata %f28, %f30, %f44 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f0 - membar #Sync -2: - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f30, %f48, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f48, %f50, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f50, %f52, %f34 - inc BLOCK_SIZE, %o1 - faligndata %f52, %f54, %f36 - cmp %o0, %o5 - faligndata %f54, %f56, %f38 - dec BLOCK_SIZE, %o2 - faligndata %f56, %f58, %f40 - faligndata %f58, %f60, %f42 - faligndata %f60, %f62, %f44 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f62, %f0, %f46 - - stda %f32, [%o1] ASI_STORE - ba 3b - inc BLOCK_SIZE, %o1 - - !! - !! Source at BLOCK_ALIGN+16 - !! - !! We need to load 6 doubles by hand. - !! -L102: -#ifdef RETURN_NAME - sethi %hi(1f), %g1 - ba,pt %icc, 2f - or %g1, %lo(1f), %g1 -1: - .asciz "L102" - .align 8 -2: -#endif - ldd [%o0], %f4 - inc 8, %o0 - fmovd %f0, %f2 ! Hoist fmovd - ldd [%o0], %f6 - inc 8, %o0 - - ldd [%o0], %f8 - inc 8, %o0 - ldd [%o0], %f10 - inc 8, %o0 - ldd [%o0], %f12 - inc 8, %o0 - ldd [%o0], %f14 - inc 8, %o0 - - cmp %o0, %o5 - bleu,a,pn %icc, 3f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -3: - faligndata %f2, %f4, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f4, %f6, %f34 - cmp %o0, %o5 - faligndata %f6, %f8, %f36 - dec BLOCK_SIZE, %o2 - faligndata %f8, %f10, %f38 - faligndata %f10, %f12, %f40 - faligndata %f12, %f14, %f42 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f48 - membar #Sync -2: - faligndata %f14, %f16, %f44 - - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f16, %f18, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f18, %f20, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f20, %f22, %f34 - inc BLOCK_SIZE, %o1 - faligndata %f22, %f24, %f36 - cmp %o0, %o5 - faligndata %f24, %f26, %f38 - dec BLOCK_SIZE, %o2 - faligndata %f26, %f28, %f40 - faligndata %f28, %f30, %f42 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f0 - membar #Sync -2: - faligndata %f30, %f48, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f48, %f50, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f50, %f52, %f32 - inc BLOCK_SIZE, %o0 - faligndata %f52, %f54, %f34 - inc BLOCK_SIZE, %o1 - faligndata %f54, %f56, %f36 - cmp %o0, %o5 - faligndata %f56, %f58, %f38 - dec BLOCK_SIZE, %o2 - faligndata %f58, %f60, %f40 - faligndata %f60, %f62, %f42 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - faligndata %f62, %f0, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f0, %f2, %f46 - - stda %f32, [%o1] ASI_STORE - ba 3b - inc BLOCK_SIZE, %o1 - - !! - !! Source at BLOCK_ALIGN+24 - !! - !! We need to load 5 doubles by hand. - !! -L103: -#ifdef RETURN_NAME - sethi %hi(1f), %g1 - ba,pt %icc, 2f - or %g1, %lo(1f), %g1 -1: - .asciz "L103" - .align 8 -2: -#endif - fmovd %f0, %f4 - ldd [%o0], %f6 - inc 8, %o0 - ldd [%o0], %f8 - inc 8, %o0 - ldd [%o0], %f10 - inc 8, %o0 - ldd [%o0], %f12 - inc 8, %o0 - ldd [%o0], %f14 - inc 8, %o0 - - cmp %o0, %o5 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - inc BLOCK_SIZE, %o0 -3: - faligndata %f4, %f6, %f32 - cmp %o0, %o5 - faligndata %f6, %f8, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f8, %f10, %f36 - faligndata %f10, %f12, %f38 - faligndata %f12, %f14, %f40 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f48 - membar #Sync -2: - faligndata %f14, %f16, %f42 - inc BLOCK_SIZE, %o0 - faligndata %f16, %f18, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f18, %f20, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f20, %f22, %f32 - cmp %o0, %o5 - faligndata %f22, %f24, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f24, %f26, %f36 - inc BLOCK_SIZE, %o1 - faligndata %f26, %f28, %f38 - faligndata %f28, %f30, %f40 - ble,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f0 - membar #Sync -2: - faligndata %f30, %f48, %f42 - inc BLOCK_SIZE, %o0 - faligndata %f48, %f50, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f50, %f52, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f52, %f54, %f32 - cmp %o0, %o5 - faligndata %f54, %f56, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f56, %f58, %f36 - faligndata %f58, %f60, %f38 - inc BLOCK_SIZE, %o1 - faligndata %f60, %f62, %f40 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - faligndata %f62, %f0, %f42 - inc BLOCK_SIZE, %o0 - faligndata %f0, %f2, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f2, %f4, %f46 - - stda %f32, [%o1] ASI_STORE - ba 3b - inc BLOCK_SIZE, %o1 - - !! - !! Source at BLOCK_ALIGN+32 - !! - !! We need to load 4 doubles by hand. - !! -L104: -#ifdef RETURN_NAME - sethi %hi(1f), %g1 - ba,pt %icc, 2f - or %g1, %lo(1f), %g1 -1: - .asciz "L104" - .align 8 -2: -#endif - fmovd %f0, %f6 - ldd [%o0], %f8 - inc 8, %o0 - ldd [%o0], %f10 - inc 8, %o0 - ldd [%o0], %f12 - inc 8, %o0 - ldd [%o0], %f14 - inc 8, %o0 - - cmp %o0, %o5 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - inc BLOCK_SIZE, %o0 -3: - faligndata %f6, %f8, %f32 - cmp %o0, %o5 - faligndata %f8, %f10, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f10, %f12, %f36 - faligndata %f12, %f14, %f38 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f48 - membar #Sync -2: - faligndata %f14, %f16, %f40 - faligndata %f16, %f18, %f42 - inc BLOCK_SIZE, %o0 - faligndata %f18, %f20, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f20, %f22, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f22, %f24, %f32 - cmp %o0, %o5 - faligndata %f24, %f26, %f34 - faligndata %f26, %f28, %f36 - inc BLOCK_SIZE, %o1 - faligndata %f28, %f30, %f38 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f0 - membar #Sync -2: - faligndata %f30, %f48, %f40 - dec BLOCK_SIZE, %o2 - faligndata %f48, %f50, %f42 - inc BLOCK_SIZE, %o0 - faligndata %f50, %f52, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f52, %f54, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f54, %f56, %f32 - cmp %o0, %o5 - faligndata %f56, %f58, %f34 - faligndata %f58, %f60, %f36 - inc BLOCK_SIZE, %o1 - faligndata %f60, %f62, %f38 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - faligndata %f62, %f0, %f40 - dec BLOCK_SIZE, %o2 - faligndata %f0, %f2, %f42 - inc BLOCK_SIZE, %o0 - faligndata %f2, %f4, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f4, %f6, %f46 - - stda %f32, [%o1] ASI_STORE - ba 3b - inc BLOCK_SIZE, %o1 - - !! - !! Source at BLOCK_ALIGN+40 - !! - !! We need to load 3 doubles by hand. - !! -L105: -#ifdef RETURN_NAME - sethi %hi(1f), %g1 - ba,pt %icc, 2f - or %g1, %lo(1f), %g1 -1: - .asciz "L105" - .align 8 -2: -#endif - fmovd %f0, %f8 - ldd [%o0], %f10 - inc 8, %o0 - ldd [%o0], %f12 - inc 8, %o0 - ldd [%o0], %f14 - inc 8, %o0 - - cmp %o0, %o5 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - inc BLOCK_SIZE, %o0 -3: - faligndata %f8, %f10, %f32 - cmp %o0, %o5 - faligndata %f10, %f12, %f34 - faligndata %f12, %f14, %f36 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f48 - membar #Sync -2: - faligndata %f14, %f16, %f38 - dec BLOCK_SIZE, %o2 - faligndata %f16, %f18, %f40 - inc BLOCK_SIZE, %o0 - faligndata %f18, %f20, %f42 - faligndata %f20, %f22, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f22, %f24, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f24, %f26, %f32 - cmp %o0, %o5 - faligndata %f26, %f28, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f28, %f30, %f36 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f0 - membar #Sync -2: - faligndata %f30, %f48, %f38 - inc BLOCK_SIZE, %o1 - faligndata %f48, %f50, %f40 - inc BLOCK_SIZE, %o0 - faligndata %f50, %f52, %f42 - faligndata %f52, %f54, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f54, %f56, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f56, %f58, %f32 - cmp %o0, %o5 - faligndata %f58, %f60, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f60, %f62, %f36 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - faligndata %f62, %f0, %f38 - inc BLOCK_SIZE, %o1 - faligndata %f0, %f2, %f40 - inc BLOCK_SIZE, %o0 - faligndata %f2, %f4, %f42 - faligndata %f4, %f6, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f6, %f8, %f46 - - stda %f32, [%o1] ASI_STORE - ba 3b - inc BLOCK_SIZE, %o1 - - - !! - !! Source at BLOCK_ALIGN+48 - !! - !! We need to load 2 doubles by hand. - !! -L106: -#ifdef RETURN_NAME - sethi %hi(1f), %g1 - ba,pt %icc, 2f - or %g1, %lo(1f), %g1 -1: - .asciz "L106" - .align 8 -2: -#endif - fmovd %f0, %f10 - ldd [%o0], %f12 - inc 8, %o0 - ldd [%o0], %f14 - inc 8, %o0 - - cmp %o0, %o5 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - inc BLOCK_SIZE, %o0 -3: - faligndata %f10, %f12, %f32 - cmp %o0, %o5 - faligndata %f12, %f14, %f34 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f48 - membar #Sync -2: - faligndata %f14, %f16, %f36 - dec BLOCK_SIZE, %o2 - faligndata %f16, %f18, %f38 - inc BLOCK_SIZE, %o0 - faligndata %f18, %f20, %f40 - faligndata %f20, %f22, %f42 - faligndata %f22, %f24, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f24, %f26, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f26, %f28, %f32 - cmp %o0, %o5 - faligndata %f28, %f30, %f34 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f0 - membar #Sync -2: - faligndata %f30, %f48, %f36 - dec BLOCK_SIZE, %o2 - faligndata %f48, %f50, %f38 - inc BLOCK_SIZE, %o1 - faligndata %f50, %f52, %f40 - faligndata %f52, %f54, %f42 - inc BLOCK_SIZE, %o0 - faligndata %f54, %f56, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f56, %f58, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f58, %f60, %f32 - cmp %o0, %o5 - faligndata %f60, %f62, %f34 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - faligndata %f62, %f0, %f36 - dec BLOCK_SIZE, %o2 - faligndata %f0, %f2, %f38 - inc BLOCK_SIZE, %o1 - faligndata %f2, %f4, %f40 - faligndata %f4, %f6, %f42 - inc BLOCK_SIZE, %o0 - faligndata %f6, %f8, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f8, %f10, %f46 - - stda %f32, [%o1] ASI_STORE - ba 3b - inc BLOCK_SIZE, %o1 - - - !! - !! Source at BLOCK_ALIGN+56 - !! - !! We need to load 1 double by hand. - !! -L107: -#ifdef RETURN_NAME - sethi %hi(1f), %g1 - ba,pt %icc, 2f - or %g1, %lo(1f), %g1 -1: - .asciz "L107" - .align 8 -2: -#endif - fmovd %f0, %f12 - ldd [%o0], %f14 - inc 8, %o0 - - cmp %o0, %o5 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - inc BLOCK_SIZE, %o0 -3: - faligndata %f12, %f14, %f32 - cmp %o0, %o5 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f48 - membar #Sync -2: - faligndata %f14, %f16, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f16, %f18, %f36 - inc BLOCK_SIZE, %o0 - faligndata %f18, %f20, %f38 - faligndata %f20, %f22, %f40 - faligndata %f22, %f24, %f42 - faligndata %f24, %f26, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f26, %f28, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f28, %f30, %f32 - cmp %o0, %o5 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f0 - membar #Sync -2: - faligndata %f30, %f48, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f48, %f50, %f36 - inc BLOCK_SIZE, %o1 - faligndata %f50, %f52, %f38 - faligndata %f52, %f54, %f40 - inc BLOCK_SIZE, %o0 - faligndata %f54, %f56, %f42 - faligndata %f56, %f58, %f44 - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f58, %f60, %f46 - - stda %f32, [%o1] ASI_STORE - - faligndata %f60, %f62, %f32 - cmp %o0, %o5 - bleu,a,pn %icc, 2f - ldda [%o0] ASI_BLK_P, %f16 - membar #Sync -2: - faligndata %f62, %f0, %f34 - dec BLOCK_SIZE, %o2 - faligndata %f0, %f2, %f36 - inc BLOCK_SIZE, %o1 - faligndata %f2, %f4, %f38 - faligndata %f4, %f6, %f40 - inc BLOCK_SIZE, %o0 - faligndata %f6, %f8, %f42 - faligndata %f8, %f10, %f44 - - brlez,pn %o2, Lmemcpy_blockdone - faligndata %f10, %f12, %f46 - - stda %f32, [%o1] ASI_STORE - ba 3b - inc BLOCK_SIZE, %o1 - -Lmemcpy_blockdone: - inc BLOCK_SIZE, %o2 ! Fixup our overcommit - membar #Sync ! Finish any pending loads -#define FINISH_REG(f) \ - deccc 8, %o2; \ - bl,a Lmemcpy_blockfinish; \ - fmovd f, %f48; \ - std f, [%o1]; \ - inc 8, %o1 - - FINISH_REG(%f32) - FINISH_REG(%f34) - FINISH_REG(%f36) - FINISH_REG(%f38) - FINISH_REG(%f40) - FINISH_REG(%f42) - FINISH_REG(%f44) - FINISH_REG(%f46) - FINISH_REG(%f48) -#undef FINISH_REG - !! - !! The low 3 bits have the sub-word bits needed to be - !! stored [because (x-8)&0x7 == x]. - !! -Lmemcpy_blockfinish: - brz,pn %o2, 2f ! 100% complete? - fmovd %f48, %f4 - cmp %o2, 8 ! Exactly 8 bytes? - bz,a,pn CCCR, 2f - std %f4, [%o1] - - btst 4, %o2 ! Word store? - bz CCCR, 1f - nop - st %f4, [%o1] - inc 4, %o1 -1: - btst 2, %o2 - fzero %f0 - bz 1f - - mov -6, %o4 - alignaddr %o1, %o4, %g0 - - faligndata %f0, %f4, %f8 - - stda %f8, [%o1] ASI_FL16_P ! Store short - inc 2, %o1 -1: - btst 1, %o2 ! Byte aligned? - bz 2f - - mov -7, %o0 ! Calculate dest - 7 - alignaddr %o1, %o0, %g0 ! Calculate shift mask and dest. - - faligndata %f0, %f4, %f8 ! Move 1st byte to low part of f8 - - stda %f8, [%o1] ASI_FL8_P ! Store 1st byte - inc 1, %o1 ! Update address -2: - membar #Sync -#if 0 - !! - !! verify copy success. - !! - - mov %i0, %o2 - mov %i1, %o4 - mov %i2, %l4 -0: - ldub [%o2], %o1 - inc %o2 - ldub [%o4], %o3 - inc %o4 - cmp %o3, %o1 - bnz 1f - dec %l4 - brnz %l4, 0b - nop - ba 2f - nop - -1: - set block_disable, %o0 - stx %o0, [%o0] - - set 0f, %o0 - call prom_printf - sub %i2, %l4, %o5 - set 1f, %o0 - mov %i0, %o2 - mov %i1, %o1 - call prom_printf - mov %i2, %o3 - ta 1 - .data - _ALIGN -0: .asciz "block memcpy failed: %x@%p != %x@%p byte %d\r\n" -1: .asciz "memcpy(%p, %p, %lx)\r\n" - _ALIGN - .text -2: -#endif -#if defined(_KERNEL) && !defined(_RUMPKERNEL) - -/* - * Weve saved our possible fpstate, now disable the fpu - * and continue with life. - */ - RESTORE_FPU - ret - restore %g1, 0, %o0 ! Return DEST for memcpy -#endif - retl - mov %g1, %o0 -/* - * Use block_disable to turn off block insns for - * memcpy/memset - */ - .data - .align 8 - .globl block_disable -block_disable: .xword 1 - .text -#endif /* USE_BLOCK_STORE_LOAD */ diff --git a/common/lib/libc/arch/sparc64/string/memset.S b/common/lib/libc/arch/sparc64/string/memset.S deleted file mode 100644 index d24773c61..000000000 --- a/common/lib/libc/arch/sparc64/string/memset.S +++ /dev/null @@ -1,218 +0,0 @@ -/* $NetBSD: memset.S,v 1.2 2013/03/17 02:12:41 christos Exp $ */ - -/* - * Copyright (c) 1996-2002 Eduardo Horvath - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ -#include "strmacros.h" -#if defined(LIBC_SCCS) && !defined(lint) -RCSID("$NetBSD: memset.S,v 1.2 2013/03/17 02:12:41 christos Exp $") -#endif /* LIBC_SCCS and not lint */ - - -/* - * XXXXXXXXXXXXXXXXXXXX - * We need to make sure that this doesn't use floating point - * before our trap handlers are installed or we could panic - * XXXXXXXXXXXXXXXXXXXX - */ -/* - * memset(addr, c, len) - * - * We want to use VIS instructions if we're clearing out more than - * 256 bytes, but to do that we need to properly save and restore the - * FP registers. Unfortunately the code to do that in the kernel needs - * to keep track of the current owner of the FPU, hence the different - * code. - * - * XXXXX To produce more efficient code, we do not allow lengths - * greater than 0x80000000000000000, which are negative numbers. - * This should not really be an issue since the VA hole should - * cause any such ranges to fail anyway. - */ -#if !defined(_KERNEL) || defined(_RUMPKERNEL) -ENTRY(bzero) - ! %o0 = addr, %o1 = len - mov %o1, %o2 - clr %o1 ! ser pattern -#endif -ENTRY(memset) - ! %o0 = addr, %o1 = pattern, %o2 = len - mov %o0, %o4 ! Save original pointer - -Lmemset_internal: - btst 7, %o0 ! Word aligned? - bz,pn %xcc, 0f - nop - inc %o0 - deccc %o2 ! Store up to 7 bytes - bge,a,pt CCCR, Lmemset_internal - stb %o1, [%o0 - 1] - - retl ! Duplicate Lmemset_done - mov %o4, %o0 -0: - /* - * Duplicate the pattern so it fills 64-bits. - */ - andcc %o1, 0x0ff, %o1 ! No need to extend zero - bz,pt %icc, 1f - sllx %o1, 8, %o3 ! sigh. all dependent insns. - or %o1, %o3, %o1 - sllx %o1, 16, %o3 - or %o1, %o3, %o1 - sllx %o1, 32, %o3 - or %o1, %o3, %o1 -1: -#ifdef USE_BLOCK_STORE_LOAD - !! Now we are 64-bit aligned - cmp %o2, 256 ! Use block clear if len > 256 - bge,pt CCCR, Lmemset_block ! use block store insns -#endif /* USE_BLOCK_STORE_LOAD */ - deccc 8, %o2 -Lmemset_longs: - bl,pn CCCR, Lmemset_cleanup ! Less than 8 bytes left - nop -3: - inc 8, %o0 - deccc 8, %o2 - bge,pt CCCR, 3b - stx %o1, [%o0 - 8] ! Do 1 longword at a time - - /* - * Len is in [-8..-1] where -8 => done, -7 => 1 byte to zero, - * -6 => two bytes, etc. Mop up this remainder, if any. - */ -Lmemset_cleanup: - btst 4, %o2 - bz,pt CCCR, 5f ! if (len & 4) { - nop - stw %o1, [%o0] ! *(int *)addr = 0; - inc 4, %o0 ! addr += 4; -5: - btst 2, %o2 - bz,pt CCCR, 7f ! if (len & 2) { - nop - sth %o1, [%o0] ! *(short *)addr = 0; - inc 2, %o0 ! addr += 2; -7: - btst 1, %o2 - bnz,a %icc, Lmemset_done ! if (len & 1) - stb %o1, [%o0] ! *addr = 0; -Lmemset_done: - retl - mov %o4, %o0 ! Restore ponter for memset (ugh) - -#ifdef USE_BLOCK_STORE_LOAD -Lmemset_block: - sethi %hi(block_disable), %o3 - ldx [ %o3 + %lo(block_disable) ], %o3 - brnz,pn %o3, Lmemset_longs - !! Make sure our trap table is installed - set _C_LABEL(trapbase), %o5 - rdpr %tba, %o3 - sub %o3, %o5, %o3 - brnz,pn %o3, Lmemset_longs ! No, then don't use block load/store - nop -/* - * Kernel: - * - * Here we use VIS instructions to do a block clear of a page. - * But before we can do that we need to save and enable the FPU. - * The last owner of the FPU registers is fplwp, and - * fplwp->l_md.md_fpstate is the current fpstate. If that's not - * null, call savefpstate() with it to store our current fp state. - * - * Next, allocate an aligned fpstate on the stack. We will properly - * nest calls on a particular stack so this should not be a problem. - * - * Now we grab either curlwp (or if we're on the interrupt stack - * lwp0). We stash its existing fpstate in a local register and - * put our new fpstate in curlwp->p_md.md_fpstate. We point - * fplwp at curlwp (or lwp0) and enable the FPU. - * - * If we are ever preempted, our FPU state will be saved in our - * fpstate. Then, when we're resumed and we take an FPDISABLED - * trap, the trap handler will be able to fish our FPU state out - * of curlwp (or lwp0). - * - * On exiting this routine we undo the damage: restore the original - * pointer to curlwp->p_md.md_fpstate, clear our fplwp, and disable - * the MMU. - * - */ - - ENABLE_FPU(0) - - !! We are now 8-byte aligned. We need to become 64-byte aligned. - btst 63, %i0 - bz,pt CCCR, 2f - nop -1: - stx %i1, [%i0] - inc 8, %i0 - btst 63, %i0 - bnz,pt %xcc, 1b - dec 8, %i2 - -2: - brz %i1, 3f ! Skip the memory op - fzero %f0 ! if pattern is 0 - -#ifdef _LP64 - stx %i1, [%i0] ! Flush this puppy to RAM - membar #StoreLoad - ldd [%i0], %f0 -#else - stw %i1, [%i0] ! Flush this puppy to RAM - membar #StoreLoad - ld [%i0], %f0 - fmovsa %icc, %f0, %f1 -#endif - -3: - fmovd %f0, %f2 ! Duplicate the pattern - fmovd %f0, %f4 - fmovd %f0, %f6 - fmovd %f0, %f8 - fmovd %f0, %f10 - fmovd %f0, %f12 - fmovd %f0, %f14 - - !! Remember: we were 8 bytes too far - dec 56, %i2 ! Go one iteration too far -5: - stda %f0, [%i0] ASI_STORE ! Store 64 bytes - deccc BLOCK_SIZE, %i2 - bg,pt %icc, 5b - inc BLOCK_SIZE, %i0 - - membar #Sync -/* - * We've saved our possible fpstate, now disable the fpu - * and continue with life. - */ - RESTORE_FPU - addcc %i2, 56, %i2 ! Restore the count - ba,pt %xcc, Lmemset_longs ! Finish up the remainder - restore -#endif /* USE_BLOCK_STORE_LOAD */ diff --git a/common/lib/libc/arch/sparc64/string/strlen.S b/common/lib/libc/arch/sparc64/string/strlen.S deleted file mode 100644 index 82c52beb5..000000000 --- a/common/lib/libc/arch/sparc64/string/strlen.S +++ /dev/null @@ -1,165 +0,0 @@ -/* $NetBSD: strlen.S,v 1.1 2005/12/20 19:28:50 christos Exp $ */ - -/* - * Copyright 2002 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Eduardo Horvath for Wasabi Systems, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - - - -#include -#if defined(LIBC_SCCS) && !defined(lint) - RCSID("$NetBSD: strlen.S,v 1.1 2005/12/20 19:28:50 christos Exp $") -#endif /* LIBC_SCCS and not lint */ - -/* The algorithm here uses the following techniques: - * - * 1) Given a word 'x', we can test to see if it contains any 0 bytes - * by subtracting 0x01010101, and seeing if any of the high bits of each - * byte changed from 0 to 1. This works because the least significant - * 0 byte must have had no incoming carry (otherwise it's not the least - * significant), so it is 0x00 - 0x01 == 0xff. For all other - * byte values, either they have the high bit set initially, or when - * 1 is subtracted you get a value in the range 0x00-0x7f, none of which - * have their high bit set. The expression here is - * (x + 0xfefefeff) & ~(x | 0x7f7f7f7f), which gives 0x00000000 when - * there were no 0x00 bytes in the word. - * - * 2) Now just hunt for the first byte that's 0x00 in 'x'. - * - * This is from the book 'The PowerPC Compiler Writer's Guide', - * by Steve Hoxey, Faraydon Karim, Bill Hay and Hank Warren. - */ - -ENTRY(strlen) - /* - * Calculate address for and load the first xword. - */ - andn %o0, 0x7, %o1 - ldx [%o1], %g1 - - /* - * Now prepare some constants while the data arrives... - */ - sethi %hi(0xfefefefe), %o3 - sethi %hi(0x7f7f7f7f), %o2 - - or %o3, %lo(0xfefefefe), %o3 - or %o2, %lo(0x7f7f7f7f), %o2 - - sllx %o3, 32, %o5 - andcc %o0, 0x7, %g5 ! Hoisted from below to fill a slot - - sllx %o2, 32, %o4 - or %o3, %o5, %o3 - - sll %g5, 3, %g5 ! Convert to bytes. hoisted - or %o2, %o4, %o2 - - inc %o3 - neg %g5 ! hoisted - - /* - * Mask off the leading bits: - * - * if (ptr & 0x7) - * mask = -1 << (64 - ((ptr & 0x7) << 3)); - */ - -! andcc %o0, 0x7, %g5 ! Hoisted above - bz,pt %icc, 0f - - -! sll %g5, 3, %g5 ! Convert to bytes. Also hoisted - -! neg %g5 ! Hoisted - - add %g5, 64, %g5 - mov -1, %o4 - - sllx %o4, %g5, %o4 - - or %o4, %g1, %g1 ! Make leading bytes != 0 - -0: - or %g1, %o2, %o5 ! Do step 1 -- use or/andn instead of nor/and - add %g1, %o3, %g5 - - inc 8, %o1 ! Point to next word - andncc %g5, %o5, %g0 - bz,a,pt %xcc, 0b - ldx [%o1], %g1 - - mov -1, %o4 - dec 8, %o1 - - sllx %o4, 64-8, %o5 - - btst %g1, %o5 ! Check high byte - bz %xcc,0f - srlx %o5, 8, %o5 - - inc %o1 - btst %g1, %o5 ! Check 2nd byte - bz %xcc,0f - srlx %o5, 8, %o5 - - inc %o1 - btst %g1, %o5 ! Check 3rd byte - bz %xcc,0f - srlx %o5, 8, %o5 - - inc %o1 - btst %g1, %o5 ! Check 4th byte - bz %xcc,0f - srlx %o5, 8, %o5 - - inc %o1 - btst %g1, %o5 ! Check 5th byte - bz %xcc,0f - srlx %o5, 8, %o5 - - inc %o1 - btst %g1, %o5 ! Check 6th byte - bz %xcc,0f - srlx %o5, 8, %o5 - - inc %o1 - btst %g1, %o5 ! Check 7th byte - bz %xcc,0f - nop - - inc %o1 -0: - retl - sub %o1, %o0, %o0 ! return length (ptr - (origptr+1)) diff --git a/common/lib/libc/arch/sparc64/string/strmacros.h b/common/lib/libc/arch/sparc64/string/strmacros.h deleted file mode 100644 index 420c6ab55..000000000 --- a/common/lib/libc/arch/sparc64/string/strmacros.h +++ /dev/null @@ -1,119 +0,0 @@ -/* $NetBSD: strmacros.h,v 1.1 2013/03/17 00:42:32 christos Exp $ */ - -/* - * Copyright (c) 1996-2002 Eduardo Horvath - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - *notice, this list of conditions and the following disclaimer. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#include -#if defined(_KERNEL) && !defined(_RUMPKERNEL) -#define USE_BLOCK_STORE_LOAD /* enable block load/store ops */ -#include "assym.h" -#include -#include -#include -#include -#include -#include - -#ifdef USE_BLOCK_STORE_LOAD - -#define BLOCK_SIZE SPARC64_BLOCK_SIZE -#define BLOCK_ALIGN SPARC64_BLOCK_ALIGN - -/* - * The following routines allow fpu use in the kernel. - * - * They allocate a stack frame and use all local regs. Extra - * local storage can be requested by setting the siz parameter, - * and can be accessed at %sp+CC64FSZ. - */ - -#define ENABLE_FPU(siz) \ - save %sp, -(CC64FSZ), %sp; /* Allocate a stack frame */ \ - sethi %hi(FPLWP), %l1; \ - add %fp, STKB-FS_SIZE, %l0; /* Allocate a fpstate */\ - LDPTR [%l1 + %lo(FPLWP)], %l2; /* Load fplwp */ \ - andn %l0, BLOCK_ALIGN, %l0; /* Align it */ \ - clr %l3; /* NULL fpstate */ \ - brz,pt %l2, 1f; /* fplwp == NULL? */ \ - add %l0, -STKB-CC64FSZ-(siz), %sp; /* Set proper %sp */ \ - LDPTR [%l2 + L_FPSTATE], %l3; \ - brz,pn %l3, 1f; /* Make sure we have an fpstate */ \ - mov %l3, %o0; \ - call _C_LABEL(savefpstate); /* Save the old fpstate */ \ -1: \ - set EINTSTACK-STKB, %l4; /* Are we on intr stack? */ \ - cmp %sp, %l4; \ - bgu,pt %xcc, 1f; \ - set INTSTACK-STKB, %l4; \ - cmp %sp, %l4; \ - blu %xcc, 1f; \ -0: \ - sethi %hi(_C_LABEL(lwp0)), %l4; /* Yes, use lpw0 */ \ - ba,pt %xcc, 2f; /* XXXX needs to change to CPUs idle proc */ \ - or %l4, %lo(_C_LABEL(lwp0)), %l5; \ -1: \ - sethi %hi(CURLWP), %l4; /* Use curlwp */ \ - LDPTR [%l4 + %lo(CURLWP)], %l5; \ - brz,pn %l5, 0b; nop; /* If curlwp is NULL need to use lwp0 */\ -2: \ - LDPTR [%l5 + L_FPSTATE], %l6; /* Save old fpstate */ \ - STPTR %l0, [%l5 + L_FPSTATE]; /* Insert new fpstate */\ - STPTR %l5, [%l1 + %lo(FPLWP)]; /* Set new fplwp */ \ - wr %g0, FPRS_FEF, %fprs /* Enable FPU */ - -/* - * Weve saved our possible fpstate, now disable the fpu - * and continue with life. - */ -#ifdef DEBUG -#define __CHECK_FPU \ - LDPTR [%l5 + L_FPSTATE], %l7; \ - cmp %l7, %l0; \ - tnz 1; -#else -#define __CHECK_FPU -#endif - -#define RESTORE_FPU \ - __CHECK_FPU \ - STPTR %l2, [%l1 + %lo(FPLWP)]; /* Restore old fproc */ \ - wr %g0, 0, %fprs; /* Disable fpu */ \ - brz,pt %l3, 1f; /* Skip if no fpstate */ \ - STPTR %l6, [%l5 + L_FPSTATE]; /* Restore old fpstate */\ - \ - mov %l3, %o0; \ - call _C_LABEL(loadfpstate); /* Reload orig fpstate */\ -1: \ - membar #Sync; /* Finish all FP ops */ - -#endif /* USE_BLOCK_STORE_LOAD */ - -#ifdef USE_BLOCK_STORE_LOAD -#if 0 -#define ASI_STORE ASI_BLK_COMMIT_P -#else -#define ASI_STORE ASI_BLK_P -#endif -#endif /* USE_BLOCK_STORE_LOAD */ -#endif /* _KERNEL && !_RUMPKERNEL */ diff --git a/common/lib/libc/arch/vax/atomic/Makefile.inc b/common/lib/libc/arch/vax/atomic/Makefile.inc deleted file mode 100644 index e3acd1540..000000000 --- a/common/lib/libc/arch/vax/atomic/Makefile.inc +++ /dev/null @@ -1,31 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.7 2014/10/12 17:53:33 martin Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -SRCS+= atomic_add_32_cas.c atomic_add_32_nv_cas.c atomic_and_32_cas.c \ - atomic_and_32_nv_cas.c atomic_dec_32_cas.c atomic_dec_32_nv_cas.c \ - atomic_inc_32_cas.c atomic_inc_32_nv_cas.c atomic_or_32_cas.c \ - atomic_or_32_nv_cas.c atomic_swap_32_cas.c membar_ops_nop.c - -.if ${LIB} == "c" -SRCS+= atomic_add_16_cas.c atomic_add_8_cas.c \ - atomic_sub_32_cas.c atomic_sub_16_cas.c atomic_sub_8_cas.c \ - atomic_or_16_cas.c atomic_or_8_cas.c \ - atomic_xor_32_cas.c atomic_xor_16_cas.c atomic_xor_8_cas.c \ - atomic_and_16_cas.c atomic_and_8_cas.c \ - atomic_nand_32_cas.c atomic_nand_16_cas.c atomic_nand_8_cas.c \ - atomic_cas_32_cas.c atomic_cas_16_cas.c atomic_cas_8_cas.c \ - atomic_swap_16_cas.c atomic_swap_8_cas.c \ - atomic_c11_compare_exchange_cas_32.c \ - atomic_c11_compare_exchange_cas_16.c \ - atomic_c11_compare_exchange_cas_8.c -.endif - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -SRCS+= atomic_init_testset.c - -.endif diff --git a/common/lib/libc/arch/vax/gen/bswap16.S b/common/lib/libc/arch/vax/gen/bswap16.S deleted file mode 100644 index b89c98d99..000000000 --- a/common/lib/libc/arch/vax/gen/bswap16.S +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: bswap16.S,v 1.3 2011/01/25 04:45:28 matt Exp $ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: bswap16.S,v 1.3 2011/01/25 04:45:28 matt Exp $") - -#if defined(_KERNEL) || defined(_STANDALONE) -ALTENTRY(_C_LABEL(bswap16)) -#else -ALTENTRY(_C_LABEL(ntohs)) -ALTENTRY(_C_LABEL(htons)) -#endif -ENTRY(_C_LABEL(__bswap16), 0) - movl 4(%ap), %r1 - extzv $8, $8, %r1, %r0 - insv %r1, $8, $8, %r0 - ret -END(_C_LABEL(__bswap16)) diff --git a/common/lib/libc/arch/vax/gen/bswap32.S b/common/lib/libc/arch/vax/gen/bswap32.S deleted file mode 100644 index 73b818577..000000000 --- a/common/lib/libc/arch/vax/gen/bswap32.S +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: bswap32.S,v 1.3 2011/01/25 04:45:28 matt Exp $ */ - -/*- - * Copyright (c) 1997 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -RCSID("$NetBSD: bswap32.S,v 1.3 2011/01/25 04:45:28 matt Exp $") - -#if defined(_KERNEL) || defined(_STANDALONE) -ALTENTRY(_C_LABEL(bswap32)) -#else -ALTENTRY(_C_LABEL(ntohl)) -ALTENTRY(_C_LABEL(htonl)) -#endif -ENTRY(_C_LABEL(__bswap32), 0) - rotl $-8, 4(%ap), %r0 - insv %r0, $16, $8, %r0 - rotl $8, 4(%ap), %r1 - movb %r1, %r0 - ret -END(_C_LABEL(__bswap32)) diff --git a/common/lib/libc/arch/vax/gen/bswap64.S b/common/lib/libc/arch/vax/gen/bswap64.S deleted file mode 100644 index c94ba3caa..000000000 --- a/common/lib/libc/arch/vax/gen/bswap64.S +++ /dev/null @@ -1,18 +0,0 @@ -/* Written by Anders Magnusson. Public Domain */ - -#include - -RCSID("$NetBSD: bswap64.S,v 1.3 2011/01/25 04:45:28 matt Exp $") - -ENTRY(bswap64, 0) - movq 4(%ap),%r3 - rotl $-8,%r3,%r1 - insv %r1,$16,$8,%r1 - rotl $8,%r3,%r2 - movb %r2,%r1 - rotl $-8,%r4,%r0 - insv %r0,$16,$8,%r0 - rotl $8,%r4,%r2 - movb %r2,%r0 - ret -END(bswap64) diff --git a/common/lib/libc/arch/vax/gen/udiv.S b/common/lib/libc/arch/vax/gen/udiv.S deleted file mode 100644 index 676b59823..000000000 --- a/common/lib/libc/arch/vax/gen/udiv.S +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Donn Seeley at UUNET Technologies, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - - /* .asciz "@(#)udiv.s 8.1 (Berkeley) 6/4/93" */ -RCSID("$NetBSD: udiv.S,v 1.3 2011/01/25 04:45:28 matt Exp $") - -/* - * Unsigned division, PCC flavor. - * udiv() takes an ordinary dividend/divisor pair; - * audiv() takes a pointer to a dividend and an ordinary divisor. - */ - -#define DIVIDEND 4(%ap) -#define DIVISOR 8(%ap) - -ASENTRY(__udiv,0) - movl DIVISOR,%r2 - jlss Leasy # big divisor: settle by comparison - movl DIVIDEND,%r0 - jlss Lhard # big dividend: extended division - divl2 %r2,%r0 # small divisor and dividend: signed division - ret -Lhard: - clrl %r1 - ediv %r2,%r0,%r0,%r1 - ret -Leasy: - cmpl DIVIDEND,%r2 - jgequ Lone # if dividend is as big or bigger, return 1 - clrl %r0 # else return 0 - ret -Lone: - movl $1,%r0 - ret -END(__udiv) - -ASENTRY(__audiv,0) - movl DIVIDEND,%r3 - movl DIVISOR,%r2 - jlss La_easy # big divisor: settle by comparison - movl (%r3),%r0 - jlss La_hard # big dividend: extended division - divl2 %r2,%r0 # small divisor and dividend: signed division - movl %r0,(%r3) # leave the value of the assignment in %r0 - ret -La_hard: - clrl %r1 - ediv %r2,%r0,%r0,%r1 - movl %r0,(%r3) - ret -La_easy: - cmpl (%r3),%r2 - jgequ La_one # if dividend is as big or bigger, return 1 - clrl %r0 # else return 0 - clrl (%r3) - ret -La_one: - movl $1,%r0 - movl %r0,(%r3) - ret -END(__audiv) diff --git a/common/lib/libc/arch/vax/gen/urem.S b/common/lib/libc/arch/vax/gen/urem.S deleted file mode 100644 index 985747c98..000000000 --- a/common/lib/libc/arch/vax/gen/urem.S +++ /dev/null @@ -1,92 +0,0 @@ -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Donn Seeley at UUNET Technologies, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - - /* .asciz "@(#)urem.s 8.1 (Berkeley) 6/4/93" */ -RCSID("$NetBSD: urem.S,v 1.3 2011/01/25 04:45:28 matt Exp $") - -/* - * Unsigned modulus, PCC flavor. - * urem() takes an ordinary dividend/divisor pair; - * aurem() takes a pointer to a dividend and an ordinary divisor. - */ - -#define DIVIDEND 4(%ap) -#define DIVISOR 8(%ap) - -ASENTRY(__urem,0) - movl DIVISOR,%r2 - jlss Leasy # big divisor: settle by comparison - movl DIVIDEND,%r0 - jlss Lhard # big dividend: need extended division - divl3 %r2,%r0,%r1 # small divisor and dividend: signed modulus - mull2 %r2,%r1 - subl2 %r1,%r0 - ret -Lhard: - clrl %r1 - ediv %r2,%r0,%r1,%r0 - ret -Leasy: - subl3 %r2,DIVIDEND,%r0 - jcc Ldifference # if divisor goes in once, return difference - movl DIVIDEND,%r0 # if divisor is bigger, return dividend -Ldifference: - ret -END(__urem) - -ASENTRY(__aurem,0) - movl DIVIDEND,%r3 - movl DIVISOR,%r2 - jlss La_easy # big divisor: settle by comparison - movl (%r3),%r0 - jlss La_hard # big dividend: need extended division - divl3 %r2,%r0,%r1 # small divisor and dividend: signed modulus - mull2 %r2,%r1 - subl2 %r1,%r0 - movl %r0,(%r3) # leave the value of the assignment in %r0 - ret -La_hard: - clrl %r1 - ediv %r2,%r0,%r1,%r0 - movl %r0,(%r3) - ret -La_easy: - subl3 %r2,(%r3),%r0 - jcs La_dividend # if divisor is bigger, leave dividend alone - movl %r0,(%r3) # if divisor goes in once, store difference - ret -La_dividend: - movl (%r3),%r0 - ret -END(__aurem) diff --git a/common/lib/libc/arch/vax/string/memcpy.S b/common/lib/libc/arch/vax/string/memcpy.S deleted file mode 100644 index df766cf0c..000000000 --- a/common/lib/libc/arch/vax/string/memcpy.S +++ /dev/null @@ -1,90 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.3 2011/01/25 04:45:28 matt Exp $ */ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -/* .asciz "@(#)memcpy.s 8.1 (Berkeley) 6/4/93" */ -RCSID("$NetBSD: memcpy.S,v 1.3 2011/01/25 04:45:28 matt Exp $") - -/* - * void *memcpy(dst, src, size) - * returns dst - * - * This optimises the usual case (count < 65536) at the expense - * of some extra memory references and branches when count >= 65536. - */ - -ENTRY(memcpy, 0) - movzwl $65535,%r0 /* %r0 = 64K (needed below) */ - movq 8(%ap),%r1 /* %r1 = src, %r2 = length */ - movl 4(%ap),%r3 /* %r3 = dst */ - cmpl %r1,%r3 - bgtru 1f /* normal forward case */ - beql 2f /* equal, nothing to do */ - addl2 %r2,%r1 /* overlaps iff srcdst */ - cmpl %r1,%r3 - bgtru 4f /* overlapping, must move backwards */ - subl2 %r2,%r1 - -1: /* move forward */ - cmpl %r2,%r0 - bgtru 3f /* stupid movc3 limitation */ - movc3 %r2,(%r1),(%r3) /* move it all */ -2: - movl 4(%ap),%r0 /* return original dst */ - ret -3: - subl2 %r0,12(%ap) /* adjust length by 64K */ - movc3 %r0,(%r1),(%r3) /* move 64K */ - movl 12(%ap),%r2 - decw %r0 /* from 0 to 65535 */ - brb 1b /* retry */ - -4: /* move backward */ - addl2 %r2,%r3 -5: - cmpl %r2,%r0 - bgtru 6f /* stupid movc3 limitation */ - subl2 %r2,%r1 - subl2 %r2,%r3 - movc3 %r2,(%r1),(%r3) /* move it all */ - movl 4(%ap),%r0 /* return original dst */ - ret -6: - subl2 %r0,12(%ap) /* adjust length by 64K */ - subl2 %r0,%r1 - subl2 %r0,%r3 - movc3 %r0,(%r1),(%r3) /* move 64K */ - movl 12(%ap),%r2 - decw %r0 - subl2 %r0,%r1 - subl2 %r0,%r3 - brb 5b -END(memcpy) diff --git a/common/lib/libc/arch/vax/string/memmove.S b/common/lib/libc/arch/vax/string/memmove.S deleted file mode 100644 index b71526fdc..000000000 --- a/common/lib/libc/arch/vax/string/memmove.S +++ /dev/null @@ -1,90 +0,0 @@ -/* $NetBSD: memmove.S,v 1.3 2011/01/25 04:45:28 matt Exp $ */ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -/* .asciz "@(#)memmove.s 8.1 (Berkeley) 6/4/93" */ -RCSID("$NetBSD: memmove.S,v 1.3 2011/01/25 04:45:28 matt Exp $") - -/* - * void *memmove(dst, src, size) - * returns dst - * - * This optimises the usual case (count < 65536) at the expense - * of some extra memory references and branches when count >= 65536. - */ - -ENTRY(memmove, 0) - movzwl $65535,%r0 /* %r0 = 64K (needed below) */ - movq 8(%ap),%r1 /* %r1 = src, %r2 = length */ - movl 4(%ap),%r3 /* %r3 = dst */ - cmpl %r1,%r3 - bgtru 1f /* normal forward case */ - beql 2f /* equal, nothing to do */ - addl2 %r2,%r1 /* overlaps iff srcdst */ - cmpl %r1,%r3 - bgtru 4f /* overlapping, must move backwards */ - subl2 %r2,%r1 - -1: /* move forward */ - cmpl %r2,%r0 - bgtru 3f /* stupid movc3 limitation */ - movc3 %r2,(%r1),(%r3) /* move it all */ -2: - movl 4(%ap),%r0 /* return original dst */ - ret -3: - subl2 %r0,12(%ap) /* adjust length by 64K */ - movc3 %r0,(%r1),(%r3) /* move 64K */ - movl 12(%ap),%r2 - decw %r0 /* from 0 to 65535 */ - brb 1b /* retry */ - -4: /* move backward */ - addl2 %r2,%r3 -5: - cmpl %r2,%r0 - bgtru 6f /* stupid movc3 limitation */ - subl2 %r2,%r1 - subl2 %r2,%r3 - movc3 %r2,(%r1),(%r3) /* move it all */ - movl 4(%ap),%r0 /* return original dst */ - ret -6: - subl2 %r0,12(%ap) /* adjust length by 64K */ - subl2 %r0,%r1 - subl2 %r0,%r3 - movc3 %r0,(%r1),(%r3) /* move 64K */ - movl 12(%ap),%r2 - decw %r0 - subl2 %r0,%r1 - subl2 %r0,%r3 - brb 5b -END(memmove) diff --git a/common/lib/libc/arch/vax/string/memset.S b/common/lib/libc/arch/vax/string/memset.S deleted file mode 100644 index 3d725c892..000000000 --- a/common/lib/libc/arch/vax/string/memset.S +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: memset.S,v 1.2 2011/01/25 04:45:28 matt Exp $ */ -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -/* .asciz "@(#)memset.s 8.1 (Berkeley) 6/4/93" */ -RCSID("$NetBSD: memset.S,v 1.2 2011/01/25 04:45:28 matt Exp $") - -/* void *memset(base, c, length) */ - -ENTRY(memset, 0) - movl 4(%ap),%r3 -1: - movzwl $65535,%r0 - movq 8(%ap),%r1 - cmpl %r2,%r0 - jgtru 2f - movc5 $0,(%r3),%r1,%r2,(%r3) - movl %r1,%r0 - ret -2: - subl2 %r0,12(%ap) - movc5 $0,(%r3),%r1,%r0,(%r3) - jbr 1b -END(memset) diff --git a/common/lib/libc/arch/x86_64/atomic/Makefile.inc b/common/lib/libc/arch/x86_64/atomic/Makefile.inc deleted file mode 100644 index a590a2a8a..000000000 --- a/common/lib/libc/arch/x86_64/atomic/Makefile.inc +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.6 2009/01/04 17:54:29 pooka Exp $ - -.if defined(LIB) && (${LIB} == "kern" || ${LIB} == "c" || ${LIB} == "pthread" \ - || ${LIB} == "rump") - -SRCS+= atomic.S - -.endif - -.if defined(LIB) && (${LIB} == "c" || ${LIB} == "pthread") - -SRCS+= atomic_init_cas.c - -.endif diff --git a/common/lib/libc/arch/x86_64/atomic/atomic.S b/common/lib/libc/arch/x86_64/atomic/atomic.S deleted file mode 100644 index 8858aa293..000000000 --- a/common/lib/libc/arch/x86_64/atomic/atomic.S +++ /dev/null @@ -1,435 +0,0 @@ -/* $NetBSD: atomic.S,v 1.17 2014/05/22 15:23:11 uebayasi Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe, and by Andrew Doran. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#ifdef _KERNEL -#define ALIAS(f, t) STRONG_ALIAS(f,t) -#else -#define ALIAS(f, t) WEAK_ALIAS(f,t) -#endif - -#ifdef _HARDKERNEL -#define LOCK(n) .Lpatch ## n: lock -#define ENDLABEL(a) _ALIGN_TEXT; LABEL(a) -#else -#define LOCK(n) lock -#define ENDLABEL(a) /* nothing */ -#endif - - .text - -/* 32-bit */ - -ENTRY(_atomic_add_32) - LOCK(1) - addl %esi, (%rdi) - ret -END(_atomic_add_32) - -ENTRY(_atomic_add_32_nv) - movl %esi, %eax - LOCK(2) - xaddl %eax, (%rdi) - addl %esi, %eax - ret -END(_atomic_add_32_nv) - -ENTRY(_atomic_and_32) - LOCK(3) - andl %esi, (%rdi) - ret -END(_atomic_and_32) - -ENTRY(_atomic_and_32_nv) - movl (%rdi), %eax -1: - movl %eax, %ecx - andl %esi, %ecx - LOCK(4) - cmpxchgl %ecx, (%rdi) - jnz 1b - movl %ecx, %eax - ret -END(_atomic_and_32_nv) - -ENTRY(_atomic_dec_32) - LOCK(5) - decl (%rdi) - ret -END(_atomic_dec_32) - -ENTRY(_atomic_dec_32_nv) - movl $-1, %eax - LOCK(6) - xaddl %eax, (%rdi) - decl %eax - ret -END(_atomic_dec_32_nv) - -ENTRY(_atomic_inc_32) - LOCK(7) - incl (%rdi) - ret -END(_atomic_inc_32) - -ENTRY(_atomic_inc_32_nv) - movl $1, %eax - LOCK(8) - xaddl %eax, (%rdi) - incl %eax - ret -END(_atomic_inc_32_nv) - -ENTRY(_atomic_or_32) - LOCK(9) - orl %esi, (%rdi) - ret -END(_atomic_or_32) - -ENTRY(_atomic_or_32_nv) - movl (%rdi), %eax -1: - movl %eax, %ecx - orl %esi, %ecx - LOCK(10) - cmpxchgl %ecx, (%rdi) - jnz 1b - movl %ecx, %eax - ret -END(_atomic_or_32_nv) - -ENTRY(_atomic_swap_32) - movl %esi, %eax - xchgl %eax, (%rdi) - ret -END(_atomic_swap_32) - -ENTRY(_atomic_cas_32) - movl %esi, %eax - LOCK(12) - cmpxchgl %edx, (%rdi) - /* %eax now contains the old value */ - ret -END(_atomic_cas_32) - -ENTRY(_atomic_cas_32_ni) - movl %esi, %eax - cmpxchgl %edx, (%rdi) - /* %eax now contains the old value */ - ret -END(_atomic_cas_32_ni) - -/* 64-bit */ - -ENTRY(_atomic_add_64) - LOCK(13) - addq %rsi, (%rdi) - ret -END(_atomic_add_64) - -ENTRY(_atomic_add_64_nv) - movq %rsi, %rax - LOCK(14) - xaddq %rax, (%rdi) - addq %rsi, %rax - ret -END(_atomic_add_64_nv) - -ENTRY(_atomic_and_64) - LOCK(15) - andq %rsi, (%rdi) - ret -END(_atomic_and_64) - -ENTRY(_atomic_and_64_nv) - movq (%rdi), %rax -1: - movq %rax, %rcx - andq %rsi, %rcx - LOCK(16) - cmpxchgq %rcx, (%rdi) - jnz 1b - movq %rcx, %rax - ret -END(_atomic_and_64_nv) - -ENTRY(_atomic_dec_64) - LOCK(17) - decq (%rdi) - ret -END(_atomic_dec_64) - -ENTRY(_atomic_dec_64_nv) - movq $-1, %rax - LOCK(18) - xaddq %rax, (%rdi) - decq %rax - ret -END(_atomic_dec_64_nv) - -ENTRY(_atomic_inc_64) - LOCK(19) - incq (%rdi) - ret -END(_atomic_inc_64) - -ENTRY(_atomic_inc_64_nv) - movq $1, %rax - LOCK(20) - xaddq %rax, (%rdi) - incq %rax - ret -END(_atomic_inc_64_nv) - -ENTRY(_atomic_or_64) - LOCK(21) - orq %rsi, (%rdi) - ret -END(_atomic_or_64) - -ENTRY(_atomic_or_64_nv) - movq (%rdi), %rax -1: - movq %rax, %rcx - orq %rsi, %rcx - LOCK(22) - cmpxchgq %rcx, (%rdi) - jnz 1b - movq %rcx, %rax - ret -END(_atomic_or_64_nv) - -ENTRY(_atomic_swap_64) - movq %rsi, %rax - xchgq %rax, (%rdi) - ret -END(_atomic_swap_64) - -ENTRY(_atomic_cas_64) - movq %rsi, %rax - LOCK(24) - cmpxchgq %rdx, (%rdi) - /* %eax now contains the old value */ - ret -END(_atomic_cas_64) - -ENTRY(_atomic_cas_64_ni) - movq %rsi, %rax - cmpxchgq %rdx, (%rdi) - /* %eax now contains the old value */ - ret -END(_atomic_cas_64_ni) - -/* memory barriers */ - -ENTRY(_membar_consumer) - LOCK(25) - addq $0, -8(%rsp) - ret -END(_membar_consumer) -ENDLABEL(membar_consumer_end) - -ENTRY(_membar_producer) - /* A store is enough */ - movq $0, -8(%rsp) - ret -END(_membar_producer) -ENDLABEL(membar_producer_end) - -ENTRY(_membar_sync) - LOCK(26) - addq $0, -8(%rsp) - ret -END(_membar_sync) -ENDLABEL(membar_sync_end) - -#ifdef _HARDKERNEL -ENTRY(sse2_lfence) - lfence - ret -END(sse2_lfence) -ENDLABEL(sse2_lfence_end) - -ENTRY(sse2_mfence) - mfence - ret -END(sse2_mfence) -ENDLABEL(sse2_mfence_end) - -atomic_lockpatch: - .globl atomic_lockpatch - .quad .Lpatch1, .Lpatch2, .Lpatch3, .Lpatch4, .Lpatch5 - .quad .Lpatch6, .Lpatch7, .Lpatch8, .Lpatch9, .Lpatch10 - .quad .Lpatch12, .Lpatch13, .Lpatch14, .Lpatch15 - .quad .Lpatch16, .Lpatch17, .Lpatch18, .Lpatch19, .Lpatch20 - .quad .Lpatch21, .Lpatch22, .Lpatch24, .Lpatch25 - .quad .Lpatch26, 0 -#endif /* _HARDKERNEL */ - -ALIAS(atomic_add_32,_atomic_add_32) -ALIAS(atomic_add_64,_atomic_add_64) -ALIAS(atomic_add_int,_atomic_add_32) -ALIAS(atomic_add_long,_atomic_add_64) -ALIAS(atomic_add_ptr,_atomic_add_64) - -ALIAS(atomic_add_32_nv,_atomic_add_32_nv) -ALIAS(atomic_add_64_nv,_atomic_add_64_nv) -ALIAS(atomic_add_int_nv,_atomic_add_32_nv) -ALIAS(atomic_add_long_nv,_atomic_add_64_nv) -ALIAS(atomic_add_ptr_nv,_atomic_add_64_nv) - -ALIAS(atomic_and_32,_atomic_and_32) -ALIAS(atomic_and_64,_atomic_and_64) -ALIAS(atomic_and_uint,_atomic_and_32) -ALIAS(atomic_and_ulong,_atomic_and_64) -ALIAS(atomic_and_ptr,_atomic_and_64) - -ALIAS(atomic_and_32_nv,_atomic_and_32_nv) -ALIAS(atomic_and_64_nv,_atomic_and_64_nv) -ALIAS(atomic_and_uint_nv,_atomic_and_32_nv) -ALIAS(atomic_and_ulong_nv,_atomic_and_64_nv) -ALIAS(atomic_and_ptr_nv,_atomic_and_64_nv) - -ALIAS(atomic_dec_32,_atomic_dec_32) -ALIAS(atomic_dec_64,_atomic_dec_64) -ALIAS(atomic_dec_uint,_atomic_dec_32) -ALIAS(atomic_dec_ulong,_atomic_dec_64) -ALIAS(atomic_dec_ptr,_atomic_dec_64) - -ALIAS(atomic_dec_32_nv,_atomic_dec_32_nv) -ALIAS(atomic_dec_64_nv,_atomic_dec_64_nv) -ALIAS(atomic_dec_uint_nv,_atomic_dec_32_nv) -ALIAS(atomic_dec_ulong_nv,_atomic_dec_64_nv) -ALIAS(atomic_dec_ptr_nv,_atomic_dec_64_nv) - -ALIAS(atomic_inc_32,_atomic_inc_32) -ALIAS(atomic_inc_64,_atomic_inc_64) -ALIAS(atomic_inc_uint,_atomic_inc_32) -ALIAS(atomic_inc_ulong,_atomic_inc_64) -ALIAS(atomic_inc_ptr,_atomic_inc_64) - -ALIAS(atomic_inc_32_nv,_atomic_inc_32_nv) -ALIAS(atomic_inc_64_nv,_atomic_inc_64_nv) -ALIAS(atomic_inc_uint_nv,_atomic_inc_32_nv) -ALIAS(atomic_inc_ulong_nv,_atomic_inc_64_nv) -ALIAS(atomic_inc_ptr_nv,_atomic_inc_64_nv) - -ALIAS(atomic_or_32,_atomic_or_32) -ALIAS(atomic_or_uint,_atomic_or_32) -ALIAS(atomic_or_ulong,_atomic_or_64) -ALIAS(atomic_or_ptr,_atomic_or_64) - -ALIAS(atomic_or_32_nv,_atomic_or_32_nv) -ALIAS(atomic_or_64_nv,_atomic_or_64_nv) -ALIAS(atomic_or_uint_nv,_atomic_or_32_nv) -ALIAS(atomic_or_ulong_nv,_atomic_or_64_nv) -ALIAS(atomic_or_ptr_nv,_atomic_or_64_nv) - -ALIAS(atomic_swap_32,_atomic_swap_32) -ALIAS(atomic_swap_64,_atomic_swap_64) -ALIAS(atomic_swap_uint,_atomic_swap_32) -ALIAS(atomic_swap_ulong,_atomic_swap_64) -ALIAS(atomic_swap_ptr,_atomic_swap_64) - -ALIAS(atomic_cas_32,_atomic_cas_32) -ALIAS(atomic_cas_64,_atomic_cas_64) -ALIAS(atomic_cas_uint,_atomic_cas_32) -ALIAS(atomic_cas_ulong,_atomic_cas_64) -ALIAS(atomic_cas_ptr,_atomic_cas_64) - -ALIAS(atomic_cas_32_ni,_atomic_cas_32_ni) -ALIAS(atomic_cas_64_ni,_atomic_cas_64_ni) -ALIAS(atomic_cas_uint_ni,_atomic_cas_32_ni) -ALIAS(atomic_cas_ulong_ni,_atomic_cas_64_ni) -ALIAS(atomic_cas_ptr_ni,_atomic_cas_64_ni) - -ALIAS(membar_consumer,_membar_consumer) -ALIAS(membar_producer,_membar_producer) -ALIAS(membar_enter,_membar_consumer) -ALIAS(membar_exit,_membar_producer) -ALIAS(membar_sync,_membar_sync) - -STRONG_ALIAS(_atomic_add_int,_atomic_add_32) -STRONG_ALIAS(_atomic_add_long,_atomic_add_64) -STRONG_ALIAS(_atomic_add_ptr,_atomic_add_64) - -STRONG_ALIAS(_atomic_add_int_nv,_atomic_add_32_nv) -STRONG_ALIAS(_atomic_add_long_nv,_atomic_add_64_nv) -STRONG_ALIAS(_atomic_add_ptr_nv,_atomic_add_64_nv) - -STRONG_ALIAS(_atomic_and_uint,_atomic_and_32) -STRONG_ALIAS(_atomic_and_ulong,_atomic_and_64) -STRONG_ALIAS(_atomic_and_ptr,_atomic_and_64) - -STRONG_ALIAS(_atomic_and_uint_nv,_atomic_and_32_nv) -STRONG_ALIAS(_atomic_and_ulong_nv,_atomic_and_64_nv) -STRONG_ALIAS(_atomic_and_ptr_nv,_atomic_and_64_nv) - -STRONG_ALIAS(_atomic_dec_uint,_atomic_dec_32) -STRONG_ALIAS(_atomic_dec_ulong,_atomic_dec_64) -STRONG_ALIAS(_atomic_dec_ptr,_atomic_dec_64) - -STRONG_ALIAS(_atomic_dec_uint_nv,_atomic_dec_32_nv) -STRONG_ALIAS(_atomic_dec_ulong_nv,_atomic_dec_64_nv) -STRONG_ALIAS(_atomic_dec_ptr_nv,_atomic_dec_64_nv) - -STRONG_ALIAS(_atomic_inc_uint,_atomic_inc_32) -STRONG_ALIAS(_atomic_inc_ulong,_atomic_inc_64) -STRONG_ALIAS(_atomic_inc_ptr,_atomic_inc_64) - -STRONG_ALIAS(_atomic_inc_uint_nv,_atomic_inc_32_nv) -STRONG_ALIAS(_atomic_inc_ulong_nv,_atomic_inc_64_nv) -STRONG_ALIAS(_atomic_inc_ptr_nv,_atomic_inc_64_nv) - -STRONG_ALIAS(_atomic_or_uint,_atomic_or_32) -STRONG_ALIAS(_atomic_or_ulong,_atomic_or_64) -STRONG_ALIAS(_atomic_or_ptr,_atomic_or_64) - -STRONG_ALIAS(_atomic_or_uint_nv,_atomic_or_32_nv) -STRONG_ALIAS(_atomic_or_ulong_nv,_atomic_or_64_nv) -STRONG_ALIAS(_atomic_or_ptr_nv,_atomic_or_64_nv) - -STRONG_ALIAS(_atomic_swap_uint,_atomic_swap_32) -STRONG_ALIAS(_atomic_swap_ulong,_atomic_swap_64) -STRONG_ALIAS(_atomic_swap_ptr,_atomic_swap_64) - -STRONG_ALIAS(_atomic_cas_uint,_atomic_cas_32) -STRONG_ALIAS(_atomic_cas_ulong,_atomic_cas_64) -STRONG_ALIAS(_atomic_cas_ptr,_atomic_cas_64) - -STRONG_ALIAS(_atomic_cas_uint_ni,_atomic_cas_32_ni) -STRONG_ALIAS(_atomic_cas_ulong_ni,_atomic_cas_64_ni) -STRONG_ALIAS(_atomic_cas_ptr_ni,_atomic_cas_64_ni) - -STRONG_ALIAS(_membar_enter,_membar_consumer) -STRONG_ALIAS(_membar_exit,_membar_producer) diff --git a/common/lib/libc/arch/x86_64/gen/byte_swap_2.S b/common/lib/libc/arch/x86_64/gen/byte_swap_2.S deleted file mode 100644 index 69db3b939..000000000 --- a/common/lib/libc/arch/x86_64/gen/byte_swap_2.S +++ /dev/null @@ -1,26 +0,0 @@ -/* $NetBSD: byte_swap_2.S,v 1.3 2014/05/22 15:23:11 uebayasi Exp $ */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_2.S,v 1.3 2014/05/22 15:23:11 uebayasi Exp $") -#endif - -#if defined(_KERNEL) || defined(_STANDALONE) -_ENTRY(_C_LABEL(bswap16)) -#else -_ENTRY(_C_LABEL(__bswap16)) -#endif -_ENTRY(_C_LABEL(ntohs)) -_ENTRY(_C_LABEL(htons)) -_PROF_PROLOGUE - movl %edi,%eax - xchgb %ah,%al - ret -#if defined(_KERNEL) || defined(_STANDALONE) -END(_C_LABEL(bswap16)) -#else -END(_C_LABEL(__bswap16)) -#endif -END(_C_LABEL(ntohs)) -END(_C_LABEL(htons)) diff --git a/common/lib/libc/arch/x86_64/gen/byte_swap_4.S b/common/lib/libc/arch/x86_64/gen/byte_swap_4.S deleted file mode 100644 index 78c9109c7..000000000 --- a/common/lib/libc/arch/x86_64/gen/byte_swap_4.S +++ /dev/null @@ -1,25 +0,0 @@ -/* $NetBSD: byte_swap_4.S,v 1.3 2014/05/22 15:23:11 uebayasi Exp $ */ - -#include -#if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_4.S,v 1.3 2014/05/22 15:23:11 uebayasi Exp $") -#endif - -#if defined(_KERNEL) || defined(_STANDALONE) -_ENTRY(_C_LABEL(bswap32)) -#else -_ENTRY(_C_LABEL(__bswap32)) -#endif -_ENTRY(_C_LABEL(ntohl)) -_ENTRY(_C_LABEL(htonl)) -_PROF_PROLOGUE - movl %edi,%eax - bswapl %eax - ret -#if defined(_KERNEL) || defined(_STANDALONE) -END(_C_LABEL(bswap32)) -#else -END(_C_LABEL(__bswap32)) -#endif -END(_C_LABEL(ntohl)) -END(_C_LABEL(htonl)) diff --git a/common/lib/libc/arch/x86_64/gen/byte_swap_8.S b/common/lib/libc/arch/x86_64/gen/byte_swap_8.S deleted file mode 100644 index 993f9ada1..000000000 --- a/common/lib/libc/arch/x86_64/gen/byte_swap_8.S +++ /dev/null @@ -1,18 +0,0 @@ -/* $NetBSD: byte_swap_8.S,v 1.2 2014/05/22 15:23:11 uebayasi Exp $ */ - -/* - * Written by Frank van der Linden (fvdl@wasabisystems.com) - * Public Domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: byte_swap_8.S,v 1.2 2014/05/22 15:23:11 uebayasi Exp $") -#endif - -ENTRY(bswap64) - bswapq %rdi - movq %rdi,%rax - ret -END(bswap64) diff --git a/common/lib/libc/arch/x86_64/string/bcmp.S b/common/lib/libc/arch/x86_64/string/bcmp.S deleted file mode 100644 index e361b8c6c..000000000 --- a/common/lib/libc/arch/x86_64/string/bcmp.S +++ /dev/null @@ -1,24 +0,0 @@ -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: bcmp.S,v 1.3 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -ENTRY(bcmp) - xorl %eax,%eax /* clear return value */ - - movq %rdx,%rcx /* compare by words */ - shrq $3,%rcx - repe - cmpsq - jne L1 - - movq %rdx,%rcx /* compare remainder by bytes */ - andq $7,%rcx - repe - cmpsb - je L2 - -L1: incl %eax -L2: ret -END(bcmp) diff --git a/common/lib/libc/arch/x86_64/string/bcopy.S b/common/lib/libc/arch/x86_64/string/bcopy.S deleted file mode 100644 index e8355dbe3..000000000 --- a/common/lib/libc/arch/x86_64/string/bcopy.S +++ /dev/null @@ -1,170 +0,0 @@ -/*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. - * - * This code is derived from locore.s. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: bcopy.S,v 1.5 2014/03/22 19:16:34 jakllsch Exp $") -#endif - - /* - * (ov)bcopy (src,dst,cnt) - * ws@tools.de (Wolfgang Solfrank, TooLs GmbH) +49-228-985800 - * - * Hacked about by dsl@netbsd.org - */ - -#ifdef MEMCOPY -ENTRY(memcpy) -#define NO_OVERLAP -#else -#ifdef MEMMOVE -ENTRY(memmove) -#else -ENTRY(bcopy) -#endif -#endif - movq %rdx,%rcx -#if defined(MEMCOPY) || defined(MEMMOVE) - movq %rdi,%rax /* must return destination address */ - mov %rdi,%r11 /* for misaligned check */ -#else - mov %rsi,%r11 /* for misaligned check */ - xchgq %rdi,%rsi /* bcopy() has arg order reversed */ -#endif - -#if !defined(NO_OVERLAP) - movq %rdi,%r8 - subq %rsi,%r8 -#endif - - shrq $3,%rcx /* count for copy by words */ - jz 8f /* j if less than 8 bytes */ - - lea -8(%rdi,%rdx),%r9 /* target address of last 8 */ - mov -8(%rsi,%rdx),%r10 /* get last word */ -#if !defined(NO_OVERLAP) - cmpq %rdx,%r8 /* overlapping? */ - jb 10f -#endif - -/* - * Non-overlaping, copy forwards. - * Newer Intel cpus (Nehalem) will do 16byte read/write transfers - * if %ecx is more than 76. - * AMD might do something similar some day. - */ - and $7,%r11 /* destination misaligned ? */ - jnz 2f - rep - movsq - mov %r10,(%r9) /* write last word */ - ret - -/* - * Destination misaligned - * AMD say it is better to align the destination (not the source). - * This will also re-align copies if the source and dest are both - * misaligned by the same amount) - * (I think Nehalem will use its accelerated copy if the source - * and destination have the same alignment.) - */ -2: - lea -9(%r11,%rdx),%rcx /* post re-alignment count */ - neg %r11 /* now -1 .. -7 */ - mov (%rsi),%rdx /* get first word */ - mov %rdi,%r8 /* target for first word */ - lea 8(%rsi,%r11),%rsi - lea 8(%rdi,%r11),%rdi - shr $3,%rcx - rep - movsq - mov %rdx,(%r8) /* write first word */ - mov %r10,(%r9) /* write last word */ - ret - -#if !defined(NO_OVERLAP) -/* Must copy backwards. - * Reverse copy is probably easy to code faster than 'rep movds' - * since that requires (IIRC) an extra clock every 3 iterations (AMD). - * However I don't suppose anything cares that much! - * The big cost is the std/cld pair - reputedly 50+ cycles on Netburst P4. - * The copy is aligned with the buffer start (more likely to - * be a multiple of 8 than the end). - */ -10: - lea -8(%rsi,%rcx,8),%rsi - lea -8(%rdi,%rcx,8),%rdi - std - rep - movsq - cld - mov %r10,(%r9) /* write last bytes */ - ret -#endif - -/* Less than 8 bytes to copy, copy by bytes */ -/* Intel Nehalem optimise 'rep movsb' for <= 7 bytes (9-15 clocks). - * For longer transfers it is 50+ ! - */ -8: mov %rdx,%rcx - -#if !defined(NO_OVERLAP) - cmpq %rdx,%r8 /* overlapping? */ - jb 81f -#endif - - /* nope, copy forwards. */ - rep - movsb - ret - -#if !defined(NO_OVERLAP) -/* Must copy backwards */ -81: - lea -1(%rsi,%rcx),%rsi - lea -1(%rdi,%rcx),%rdi - std - rep - movsb - cld - ret -#endif - -#ifdef MEMCOPY -END(memcpy) -#else -#ifdef MEMMOVE -END(memmove) -#else -END(bcopy) -#endif -#endif diff --git a/common/lib/libc/arch/x86_64/string/ffs.S b/common/lib/libc/arch/x86_64/string/ffs.S deleted file mode 100644 index 00d4437c1..000000000 --- a/common/lib/libc/arch/x86_64/string/ffs.S +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: ffs.S,v 1.5 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -ENTRY(ffs) - bsfl %edi,%eax - jz 1f /* ZF is set if all bits are 0 */ - incl %eax /* bits numbered from 1, not 0 */ - ret - -1: xorl %eax,%eax /* clear result */ - ret -END(ffs) diff --git a/common/lib/libc/arch/x86_64/string/memchr.S b/common/lib/libc/arch/x86_64/string/memchr.S deleted file mode 100644 index de096dc90..000000000 --- a/common/lib/libc/arch/x86_64/string/memchr.S +++ /dev/null @@ -1,109 +0,0 @@ -/* $NetBSD: memchr.S,v 1.6 2014/03/22 19:16:34 jakllsch Exp $ */ - -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by David Laight. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memchr.S,v 1.6 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -/* - * The instruction sequences used try to avoid data dependencies - * between adjacent instructions (to allow parallel execution). - * The 'imul' for %r9 could be put into the delay following the - * memory read (ie inside the loop) at no obvious cost - except - * that the loop is currently exactly 32 bytes - 2 fetch blocks!. - * - * I don't think aligning any of the other branch targets is useful. - */ - -ENTRY(memchr) - movabsq $0x0101010101010101,%r8 - lea (%rdi,%rdx),%r10 /* limit of buffer to scan */ - movzbq %sil,%rsi /* mask high bits! */ - - /* 'directpath' imuls can execute 3 at a time ... (amd) */ - imul %r8,%rsi /* search byte replicated in word */ - imul $0x80,%r8,%r9 /* 0x8080808080808080 */ - test $7,%dil - jnz 20f /* jump if misaligned */ - jmp 1f /* jump to avoid 4 nops (13 bytes) in gap */ - - _ALIGN_TEXT /* entire loop now in 32 aligned bytes */ -1: - cmpq %r10,%rdi /* end of buffer ? */ - jae 30f /* jump if so */ - - movq (%rdi),%rax /* value to check */ - addq $8,%rdi - xorq %rsi,%rax /* now looking for zeros */ -2: - mov %rax,%rcx - subq %r8,%rax /* x - 0x01 */ - not %rcx - andq %r9,%rax /* (x - 0x01) & 0x80 */ - andq %rcx,%rax /* ((x - 0x01) & 0x80) & ~x */ - je 1b /* jump if not found */ - -/* Found byte in word, get its address */ - bsf %rax,%rax - shr $3,%eax - lea -8(%rax,%rdi),%rax - cmpq %r10,%rax /* need to check not beyond buffer */ - jae 30f - rep - ret /* amd - no ret after jmp */ - -/* Input misaligned, read aligned and make low bytes invalid */ -20: - mov %dil,%cl /* misalignment amount 1..7 (+high bits )*/ - and $~7,%dil /* %rdi now start of word */ - test %rdx,%rdx /* zero length, don't read */ - jz 30f - - neg %cl /* 7..1 (+high bits) */ - mov (%rdi),%rax /* word containing first byte */ - addq $8,%rdi - and $7,%cl /* 7..1 */ - - mov %r8,%r11 /* any value with bits in each byte */ - shl $3,%cl /* 56..8 */ - xorq %rsi,%rax /* now looking for zeros */ - - /* Set low bytes non-zero */ - shr %cl,%r11 /* non-zero in unwanted bytes */ - or %r11,%rax /* low bytes now set */ - jmp 2b - -/* Not found */ -30: xorq %rax,%rax - ret -END(memchr) diff --git a/common/lib/libc/arch/x86_64/string/memcmp.S b/common/lib/libc/arch/x86_64/string/memcmp.S deleted file mode 100644 index bb3a920f0..000000000 --- a/common/lib/libc/arch/x86_64/string/memcmp.S +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Written by J.T. Conklin . - * Public domain. - * Adapted for NetBSD/x86_64 by Frank van der Linden - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memcmp.S,v 1.3 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -ENTRY(memcmp) - movq %rdx,%rcx /* compare by longs */ - shrq $3,%rcx - repe - cmpsq - jne L5 /* do we match so far? */ - - movq %rdx,%rcx /* compare remainder by bytes */ - andq $7,%rcx - repe - cmpsb - jne L6 /* do we match? */ - - xorl %eax,%eax /* we match, return zero */ - ret - -L5: movl $8,%ecx /* We know that one of the next */ - subq %rcx,%rdi /* eight pairs of bytes do not */ - subq %rcx,%rsi /* match. */ - repe - cmpsb -L6: xorl %eax,%eax /* Perform unsigned comparison */ - movb -1(%rdi),%al - xorl %edx,%edx - movb -1(%rsi),%dl - subl %edx,%eax - ret -END(memcmp) diff --git a/common/lib/libc/arch/x86_64/string/memcpy.S b/common/lib/libc/arch/x86_64/string/memcpy.S deleted file mode 100644 index a53243b5f..000000000 --- a/common/lib/libc/arch/x86_64/string/memcpy.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memcpy.S,v 1.1 2005/12/20 19:28:51 christos Exp $ */ - -#define MEMCOPY -#include "bcopy.S" diff --git a/common/lib/libc/arch/x86_64/string/memmove.S b/common/lib/libc/arch/x86_64/string/memmove.S deleted file mode 100644 index f4b7b0825..000000000 --- a/common/lib/libc/arch/x86_64/string/memmove.S +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: memmove.S,v 1.1 2005/12/20 19:28:51 christos Exp $ */ - -#define MEMMOVE -#include "bcopy.S" diff --git a/common/lib/libc/arch/x86_64/string/memset.S b/common/lib/libc/arch/x86_64/string/memset.S deleted file mode 100644 index cd2a93c10..000000000 --- a/common/lib/libc/arch/x86_64/string/memset.S +++ /dev/null @@ -1,96 +0,0 @@ -/* $NetBSD: memset.S,v 1.5 2014/05/22 16:47:31 pooka Exp $ */ - -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by David Laight. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: memset.S,v 1.5 2014/05/22 16:47:31 pooka Exp $") -#endif - -#ifndef _KERNEL -/* bzero, %rdi is buffer, %rsi length */ - -ENTRY(bzero) - mov %rsi,%rdx /* length */ - xor %eax,%eax /* value to write */ - jmp 1f -#endif - -/* memset, %rdi is buffer, %rsi char to fill, %rdx length */ - -ENTRY(memset) - movzbq %sil,%rax /* byte value to fill */ - mov %rdx,%rsi /* copy of length */ - mov $0x0101010101010101,%r9 - imul %r9,%rax /* fill value in all bytes */ - -1: - mov %rdi,%r9 /* Need to return buffer address */ - or %edi,%edx /* address | length */ - mov %rsi,%rcx - cmp $7,%rsi - jbe 10f /* jump if short fill */ - test $7,%dl /* check for misaligned fill */ - jnz 20f /* jump if misaligned */ - -/* Target aligned and length multiple of 8 */ -2: - shr $3,%rcx - rep stosq - mov %r9,%rax - ret - -/* - * Short transfer, any faffing here will generate mispredicted branches. - * So we keep it simple. - */ -10: rep stosb - mov %r9,%rax - ret - -/* - * Buffer or length misaligned. - * Write pattern to first and last word of buffer, then fill middle. - * (This writes to some bytes more than once - possibly three times!.) - */ -20: - mov %rax,(%rdi) - movzbq %dil,%rdx /* low address for alignment */ - mov %rax,-8(%rcx,%rdi) - and $7,%dl /* offset in word */ - sub %rdx,%rcx /* adjust length ... */ - add %rdx,%rdi /* ... and target */ - jmp 2b -END(memset) - -#ifndef _KERNEL -END(bzero) -#endif diff --git a/common/lib/libc/arch/x86_64/string/strcat.S b/common/lib/libc/arch/x86_64/string/strcat.S deleted file mode 100644 index 42bafb9f5..000000000 --- a/common/lib/libc/arch/x86_64/string/strcat.S +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcat.S,v 1.2 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -ENTRY(strcat) - movq %rdi,%rax - movabsq $0x0101010101010101,%r8 - movabsq $0x8080808080808080,%r9 - - /* - * Align destination to word boundary. - * Consider unrolling loop? - */ -.Lscan: -.Lscan_align: - testb $7,%dil - je .Lscan_aligned - cmpb $0,(%rdi) - je .Lcopy - incq %rdi - jmp .Lscan_align - - _ALIGN_TEXT -.Lscan_aligned: -.Lscan_loop: - movq (%rdi),%rdx - addq $8,%rdi - subq %r8,%rdx - testq %r9,%rdx - je .Lscan_loop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word equal 0. - */ - - cmpb $0,-8(%rdi) /* 1st byte == 0? */ - jne 1f - subq $8,%rdi - jmp .Lcopy - -1: cmpb $0,-7(%rdi) /* 2nd byte == 0? */ - jne 1f - subq $7,%rdi - jmp .Lcopy - -1: cmpb $0,-6(%rdi) /* 3rd byte == 0? */ - jne 1f - subq $6,%rdi - jmp .Lcopy - -1: cmpb $0,-5(%rdi) /* 4th byte == 0? */ - jne 1f - subq $5,%rdi - jmp .Lcopy - -1: cmpb $0,-4(%rdi) /* 5th byte == 0? */ - jne 1f - subq $4,%rdi - jmp .Lcopy - -1: cmpb $0,-3(%rdi) /* 6th byte == 0? */ - jne 1f - subq $3,%rdi - jmp .Lcopy - -1: cmpb $0,-2(%rdi) /* 7th byte == 0? */ - jne 1f - subq $2,%rdi - jmp .Lcopy - -1: cmpb $0,-1(%rdi) /* 8th byte == 0? */ - jne .Lscan_loop - subq $1,%rdi - - /* - * Align source to a word boundary. - * Consider unrolling loop? - */ -.Lcopy: -.Lcopy_align: - testb $7,%sil - je .Lcopy_aligned - movb (%rsi),%dl - incq %rsi - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl - jne .Lcopy_align - ret - - _ALIGN_TEXT -.Lcopy_loop: - movq %rdx,(%rdi) - addq $8,%rdi -.Lcopy_aligned: - movq (%rsi),%rdx - movq %rdx,%rcx - addq $8,%rsi - subq %r8,%rcx - testq %r9,%rcx - je .Lcopy_loop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word equal 0. - */ - - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 1st byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 2nd byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 3rd byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 4th byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 5th byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 6th byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 7th byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 8th byte == 0? */ - jne .Lcopy_aligned - -.Ldone: - ret -END(strcat) diff --git a/common/lib/libc/arch/x86_64/string/strchr.S b/common/lib/libc/arch/x86_64/string/strchr.S deleted file mode 100644 index 774d63e76..000000000 --- a/common/lib/libc/arch/x86_64/string/strchr.S +++ /dev/null @@ -1,159 +0,0 @@ -/* $NetBSD: strchr.S,v 1.7 2014/03/22 19:16:34 jakllsch Exp $ */ - -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by David Laight. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* See comments in strlen.S about checking words for byte values */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strchr.S,v 1.7 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -/* - * On entry %rdi is the buffer and the low byte of %rsi (%sil) the - * character to search for. - * - * Registers %rdx, %rcx, %r8-%r11 and %rax are also usable - */ - -/* Uncomment below to get regression test to run this version but - * have everything else use the trivial one below. */ -/* #define TEST_STRCHR */ - -#ifdef TEST_STRCHR -ENTRY(test_strchr) -#else -ENTRY(strchr) -#endif - movabsq $0x0101010101010101,%r8 - - movzbq %sil,%rdx /* value to search for (c) */ - /* These imul are 'directpath' on athlons, so are fast */ - imul $0x80,%r8,%r9 /* 0x8080808080808080 */ - imul %r8,%rdx /* (c) copied to all bytes */ - test $7,%dil - jnz 20f /* jump if misaligned */ - - _ALIGN_TEXT /* one byte nop */ -1: - movq (%rdi),%rax /* bytes to check (x) */ -2: - addq $8,%rdi - mov %rax,%r10 - mov %rax,%r11 /* for 'char' check */ - not %r10 /* invert of data (~x) */ - - xorq %rdx,%r11 /* convert 'char' test to one for NUL */ - subq %r8,%rax /* x - 0x10 */ - movq %r10,%rsi /* ~x */ - subq %r8,%r11 /* (x ^ c) - 0x10 */ -/* - * Here we could check ((x - 0x10) | ((x ^ c) - 0x10)) & 0x80 - * and short-circuit the case where no top bits are set, and - * we continue the loop. - * However it needs 3 more clocks that are difficult to interleave - * in the existing dependency chain ... - */ - andq %r9,%rax /* (x - 0x10) & 0x80 */ - xorq %rdx,%rsi /* c ^ ~x == ~(c ^ x) */ - andq %r9,%r11 /* ((x ^ c) - 0x10) & 0x80 */ - andq %r10,%rax /* (x - 0x10) & 0x80 & ~x */ - jne 10f /* jump if string ends */ - andq %rsi,%r11 /* ((x ^ c) - 0x10) & 0x80 & ~(x ^ c) */ - je 1b /* jump if no match */ - - /* Found char, since LE can use bit scan */ - bsf %r11,%r11 /* 7, 15, 23 ... 63 */ -8: shr $3,%r11 /* 0, 1, 2 .. 7 */ - lea -8(%r11,%rdi),%rax - ret - -/* End of string, check whether char is before NUL */ - _ALIGN_TEXT /* adds three byte nop */ -10: - bsf %rax,%rax /* count to NUL */ - andq %rsi,%r11 /* check for char in last 8 bytes */ - je 11f - bsf %r11,%r11 /* NUL and char - see which was first */ - cmp %r11,%rax - jae 8b /* return 'found' if same - searching for NUL */ -11: xor %eax,%eax /* char not found */ - ret - -/* Source misaligned: read aligned word and make low bytes invalid */ -/* I (dsl) think a _ALIGN_TEXT here will slow things down! */ -20: - xor %rcx,%rcx - sub %dil,%cl /* Convert low address values 1..7 ... */ - sbb %rsi,%rsi /* carry was set, so %rsi now ~0u! */ - and $7,%cl /* ... to 7..1 */ - and $~7,%dil /* move address to start of word */ - shl $3,%cl /* now 56, 48 ... 16, 8 */ - movq (%rdi),%rax /* aligned word containing first data */ - xor %rdx,%rsi /* invert of search pattern (~c) */ - je 22f /* searching for 0xff */ -21: shr %cl,%rsi /* ~c in low bytes */ - or %rsi,%rax /* set some bits making low bytes invalid */ - jmp 2b - -/* We are searching for 0xff, so can't use ~pattern for invalid value */ -22: - mov %r8,%r10 /* 0x01 pattern */ - lea (%r8,%r8),%rsi /* 0x02 - bits gets set (above) */ - not %r10 /* now 0xfe */ - sar %cl,%r10 /* top bytes 0xff */ - and %r10,%rax /* clear lsb from unwanted low bytes */ - jmp 21b -#ifdef TEST_STRCHR -END(test_strchr) -#else -END(strchr) -#endif - -#ifdef TEST_STRCHR -/* Trivial version for bug-fixing above */ -ENTRY(strchr) - movq %rsi,%rdx - movq %rdi,%rsi -1: - lodsb - cmp %al,%dl - je 2f - test %al,%al - jne 1b - xor %eax,%eax - ret -2: lea -1(%rsi),%rax - ret -END(strchr) -#endif - -STRONG_ALIAS(index,strchr) diff --git a/common/lib/libc/arch/x86_64/string/strcmp.S b/common/lib/libc/arch/x86_64/string/strcmp.S deleted file mode 100644 index d03804b3a..000000000 --- a/common/lib/libc/arch/x86_64/string/strcmp.S +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcmp.S,v 1.2 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -ENTRY(strcmp) - /* - * Align s1 to word boundary. - * Consider unrolling loop? - */ -.Ls1align: - testb $7,%dil - je .Ls1aligned - movb (%rdi),%al - incq %rdi - movb (%rsi),%dl - incq %rsi - testb %al,%al - je .Ldone - cmpb %al,%dl - je .Ls1align - jmp .Ldone - - /* - * Check whether s2 is aligned to a word boundary. If it is, we - * can compare by words. Otherwise we have to compare by bytes. - */ -.Ls1aligned: - testb $7,%sil - jne .Lbyte_loop - - movabsq $0x0101010101010101,%r8 - subq $8,%rdi - movabsq $0x8080808080808080,%r9 - subq $8,%rsi - - _ALIGN_TEXT -.Lword_loop: - movq 8(%rdi),%rax - addq $8,%rdi - movq 8(%rsi),%rdx - addq $8,%rsi - cmpq %rax,%rdx - jne .Lbyte_loop - subq %r8,%rdx - notq %rax - andq %rax,%rdx - testq %r9,%rdx - je .Lword_loop - - _ALIGN_TEXT -.Lbyte_loop: - movb (%rdi),%al - incq %rdi - movb (%rsi),%dl - incq %rsi - testb %al,%al - je .Ldone - cmpb %al,%dl - je .Lbyte_loop - -.Ldone: - movzbq %al,%rax - movzbq %dl,%rdx - subq %rdx,%rax - ret -END(strcmp) diff --git a/common/lib/libc/arch/x86_64/string/strcpy.S b/common/lib/libc/arch/x86_64/string/strcpy.S deleted file mode 100644 index f12ac093f..000000000 --- a/common/lib/libc/arch/x86_64/string/strcpy.S +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strcpy.S,v 1.2 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -/* - * This strcpy implementation copies a byte at a time until the - * source pointer is aligned to a word boundary, it then copies by - * words until it finds a word containing a zero byte, and finally - * copies by bytes until the end of the string is reached. - * - * While this may result in unaligned stores if the source and - * destination pointers are unaligned with respect to each other, - * it is still faster than either byte copies or the overhead of - * an implementation suitable for machines with strict alignment - * requirements. - */ - -ENTRY(strcpy) - movq %rdi,%rax - movabsq $0x0101010101010101,%r8 - movabsq $0x8080808080808080,%r9 - - /* - * Align source to a word boundary. - * Consider unrolling loop? - */ - _ALIGN_TEXT -.Lalign: - testb $7,%sil - je .Lword_aligned - movb (%rsi),%dl - incq %rsi - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl - jne .Lalign - ret - - _ALIGN_TEXT -.Lloop: - movq %rdx,(%rdi) - addq $8,%rdi -.Lword_aligned: - movq (%rsi),%rdx - movq %rdx,%rcx - addq $8,%rsi - subq %r8,%rcx - testq %r9,%rcx - je .Lloop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word equal 0. - */ - - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 1st byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 2nd byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 3rd byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 4th byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 5th byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 6th byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 7th byte == 0? */ - je .Ldone - - shrq $8,%rdx - movb %dl,(%rdi) - incq %rdi - testb %dl,%dl /* 8th byte == 0? */ - jne .Lword_aligned - -.Ldone: - ret -END(strcpy) diff --git a/common/lib/libc/arch/x86_64/string/strlen.S b/common/lib/libc/arch/x86_64/string/strlen.S deleted file mode 100644 index e528ee800..000000000 --- a/common/lib/libc/arch/x86_64/string/strlen.S +++ /dev/null @@ -1,182 +0,0 @@ -/* $NetBSD: strlen.S,v 1.6 2014/03/22 19:16:34 jakllsch Exp $ */ - -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by David Laight. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Inspired by a version written by J.T. Conklin - * (Only the long comment really remains his work!) - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strlen.S,v 1.6 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -/* - * There are many well known branch-free sequences which are used - * for determining whether a zero-byte is contained within a word. - * These sequences are generally much more efficent than loading - * and comparing each byte individually. - * - * The expression [1,2]: - * - * (1) ~(((x & 0x7f....7f) + 0x7f....7f) | (x | 0x7f....7f)) - * - * evaluates to a non-zero value if any of the bytes in the - * original word is zero. - * - * It also has the useful property that bytes in the result word - * that correspond to non-zero bytes in the original word have - * the value 0x00, while bytes corresponding to zero bytes have - * the value 0x80. This allows calculation of the first (and - * last) occurrence of a zero byte within the word (useful for C's - * str* primitives) by counting the number of leading (or - * trailing) zeros and dividing the result by 8. On machines - * without (or with slow) clz() / ctz() instructions, testing - * each byte in the result word for zero is necessary. - * - * This typically takes 4 instructions (5 on machines without - * "not-or") not including those needed to load the constant. - * - * - * The expression: - * - * (2) ((x - 0x01....01) & 0x80....80 & ~x) - * - * evaluates to a non-zero value if any of the bytes in the - * original word is zero. - * - * On little endian machines, the first byte in the result word - * that corresponds to a zero byte in the original byte is 0x80, - * so clz() can be used as above. On big endian machines, and - * little endian machines without (or with a slow) clz() insn, - * testing each byte in the original for zero is necessary. - * - * This typically takes 3 instructions (4 on machines without - * "and with complement") not including those needed to load - * constants. - * - * - * The expression: - * - * (3) ((x - 0x01....01) & 0x80....80) - * - * always evaluates to a non-zero value if any of the bytes in - * the original word is zero or has the top bit set. - * For strings that are likely to only contain 7-bit ascii these - * false positives will be rare. - * - * To account for possible false positives, each byte of the - * original word must be checked when the expression evaluates to - * a non-zero value. However, because it is simpler than those - * presented above, code that uses it will be faster as long as - * the rate of false positives is low. - * - * This is likely, because the the false positive can only occur - * if the most siginificant bit of a byte within the word is set. - * The expression will never fail for typical 7-bit ASCII strings. - * - * This typically takes 2 instructions not including those needed - * to load constants. - * - * - * [1] Henry S. Warren Jr., "Hacker's Delight", Addison-Westley 2003 - * - * [2] International Business Machines, "The PowerPC Compiler Writer's - * Guide", Warthman Associates, 1996 - */ - -#ifdef TEST_STRLEN -ENTRY(test_strlen) -#else -ENTRY(strlen) -#endif - movabsq $0x0101010101010101,%r8 - - test $7,%dil - movq %rdi,%rax /* Buffer, %rdi unchanged */ - movabsq $0x8080808080808080,%r9 - jnz 10f /* Jump if misaligned */ - - _ALIGN_TEXT -1: - movq (%rax),%rdx /* get bytes to check */ -2: - addq $8,%rax - mov %rdx,%rcx /* save for later check */ - subq %r8,%rdx /* alg (3) above first */ - not %rcx /* Invert of data */ - andq %r9,%rdx - je 1b /* jump if all 0x01-0x80 */ - - /* Do check from alg (2) above - loops for 0x81..0xff bytes */ - andq %rcx,%rdx - je 1b - - /* Since we are LE, use bit scan for first 0x80 byte */ - sub %rdi,%rax /* length to next word */ - bsf %rdx,%rdx /* 7, 15, 23 ... 63 */ - shr $3,%rdx /* 0, 1, 2 ... 7 */ - lea -8(%rax,%rdx),%rax - ret - -/* Misaligned, read aligned word and make low bytes non-zero */ - _ALIGN_TEXT -10: - mov %al,%cl - mov $1,%rsi - and $7,%cl /* offset into word 1..7 */ - and $~7,%al /* start of word with buffer */ - shl $3,%cl /* bit count 8, 16 .. 56 */ - movq (%rax),%rdx /* first data in high bytes */ - shl %cl,%rsi - dec %rsi - or %rsi,%rdx /* low bytes now non-zero */ - jmp 2b -#ifdef TEST_STRLEN -END(test_strlen) -#else -END(strlen) -#endif - -#ifdef TEST_STRLEN -/* trivial implementation when testing above! */ -ENTRY(strlen) - mov %rdi,%rax -1: - cmpb $0,(%rax) - jz 2f - inc %rax - jmp 1b -2: sub %rdi,%rax - ret -END(strlen) -#endif diff --git a/common/lib/libc/arch/x86_64/string/strrchr.S b/common/lib/libc/arch/x86_64/string/strrchr.S deleted file mode 100644 index 4d654aa64..000000000 --- a/common/lib/libc/arch/x86_64/string/strrchr.S +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Written by J.T. Conklin - * Public domain. - */ - -#include - -#if defined(LIBC_SCCS) - RCSID("$NetBSD: strrchr.S,v 1.3 2014/03/22 19:16:34 jakllsch Exp $") -#endif - -ENTRY(strrchr) - movzbq %sil,%rcx - - /* zero return value */ - xorq %rax,%rax - - /* - * Align to word boundary. - * Consider unrolling loop? - */ -.Lalign: - testb $7,%dil - je .Lword_aligned - movb (%rdi),%dl - cmpb %cl,%dl - cmoveq %rdi,%rax - incq %rdi - testb %dl,%dl - jne .Lalign - jmp .Ldone - -.Lword_aligned: - /* copy char to all bytes in word */ - movb %cl,%ch - movq %rcx,%rdx - salq $16,%rcx - orq %rdx,%rcx - movq %rcx,%rdx - salq $32,%rcx - orq %rdx,%rcx - - movabsq $0x0101010101010101,%r8 - movabsq $0x8080808080808080,%r9 - - /* Check whether any byte in the word is equal to ch or 0. */ - _ALIGN_TEXT -.Lloop: - movq (%rdi),%rdx - addq $8,%rdi - movq %rdx,%rsi - subq %r8,%rdx - xorq %rcx,%rsi - subq %r8,%rsi - orq %rsi,%rdx - testq %r9,%rdx - je .Lloop - - /* - * In rare cases, the above loop may exit prematurely. We must - * return to the loop if none of the bytes in the word match - * ch or are equal to 0. - */ - - movb -8(%rdi),%dl - cmpb %cl,%dl /* 1st byte == ch? */ - jne 1f - leaq -8(%rdi),%rax -1: testb %dl,%dl /* 1st byte == 0? */ - je .Ldone - - movb -7(%rdi),%dl - cmpb %cl,%dl /* 2nd byte == ch? */ - jne 1f - leaq -7(%rdi),%rax -1: testb %dl,%dl /* 2nd byte == 0? */ - je .Ldone - - movb -6(%rdi),%dl - cmpb %cl,%dl /* 3rd byte == ch? */ - jne 1f - leaq -6(%rdi),%rax -1: testb %dl,%dl /* 3rd byte == 0? */ - je .Ldone - - movb -5(%rdi),%dl - cmpb %cl,%dl /* 4th byte == ch? */ - jne 1f - leaq -5(%rdi),%rax -1: testb %dl,%dl /* 4th byte == 0? */ - je .Ldone - - movb -4(%rdi),%dl - cmpb %cl,%dl /* 5th byte == ch? */ - jne 1f - leaq -4(%rdi),%rax -1: testb %dl,%dl /* 5th byte == 0? */ - je .Ldone - - movb -3(%rdi),%dl - cmpb %cl,%dl /* 6th byte == ch? */ - jne 1f - leaq -3(%rdi),%rax -1: testb %dl,%dl /* 6th byte == 0? */ - je .Ldone - - movb -2(%rdi),%dl - cmpb %cl,%dl /* 7th byte == ch? */ - jne 1f - leaq -2(%rdi),%rax -1: testb %dl,%dl /* 7th byte == 0? */ - je .Ldone - - movb -1(%rdi),%dl - cmpb %cl,%dl /* 8th byte == ch? */ - jne 1f - leaq -1(%rdi),%rax -1: testb %dl,%dl /* 8th byte == 0? */ - jne .Lloop - -.Ldone: - ret -END(strrchr) - -STRONG_ALIAS(rindex,strrchr) diff --git a/common/lib/libc/atomic/atomic_add_16_cas.c b/common/lib/libc/atomic/atomic_add_16_cas.c deleted file mode 100644 index 257267632..000000000 --- a/common/lib/libc/atomic/atomic_add_16_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_add_16_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint16_t fetch_and_add_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_fetch_and_add_2"); -uint16_t add_and_fetch_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_add_and_fetch_2"); - -uint16_t -fetch_and_add_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old + val; - } while (atomic_cas_16(addr, old, new) != old); - return old; -} - -uint16_t -add_and_fetch_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old + val; - } while (atomic_cas_16(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_add_2,__sync_fetch_and_add_2) diff --git a/common/lib/libc/atomic/atomic_add_32_cas.c b/common/lib/libc/atomic/atomic_add_32_cas.c deleted file mode 100644 index cabb5a2e0..000000000 --- a/common/lib/libc/atomic/atomic_add_32_cas.c +++ /dev/null @@ -1,78 +0,0 @@ -/* $NetBSD: atomic_add_32_cas.c,v 1.9 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t fetch_and_add_4(volatile uint32_t *, uint32_t, ...) -#if defined(_LIBC) || defined(_HARDKERNEL) - asm("__sync_fetch_and_add_4"); /* C runtime internal */ -#else - ; -#endif - -uint32_t -fetch_and_add_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = old + val; - } while (atomic_cas_32(addr, old, new) != old); - return old; -} - -void -atomic_add_32(volatile uint32_t *addr, int32_t val) -{ - (void) fetch_and_add_4(addr, val); -} - -#undef atomic_add_32 -atomic_op_alias(atomic_add_32,_atomic_add_32) - -#undef atomic_add_int -atomic_op_alias(atomic_add_int,_atomic_add_32) -__strong_alias(_atomic_add_int,_atomic_add_32) - -#if !defined(_LP64) -#undef atomic_add_long -atomic_op_alias(atomic_add_long,_atomic_add_32) -__strong_alias(_atomic_add_long,_atomic_add_32) - -#undef atomic_add_ptr -atomic_op_alias(atomic_add_ptr,_atomic_add_32) -__strong_alias(_atomic_add_ptr,_atomic_add_32) -#endif /* _LP64 */ - -__strong_alias(__atomic_fetch_add_4,__sync_fetch_and_add_4) diff --git a/common/lib/libc/atomic/atomic_add_32_nv_cas.c b/common/lib/libc/atomic/atomic_add_32_nv_cas.c deleted file mode 100644 index e79807790..000000000 --- a/common/lib/libc/atomic/atomic_add_32_nv_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_add_32_nv_cas.c,v 1.6 2014/02/22 17:08:30 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t -atomic_add_32_nv(volatile uint32_t *addr, int32_t val) -{ - uint32_t old, new; - - do { - old = *addr; - new = old + val; - } while (atomic_cas_32(addr, old, new) != old); - - return (new); -} - -#undef atomic_add_32_nv -atomic_op_alias(atomic_add_32_nv,_atomic_add_32_nv) -crt_alias(__sync_add_and_fetch_4,_atomic_add_32_nv) - -#undef atomic_add_int_nv -atomic_op_alias(atomic_add_int_nv,_atomic_add_32_nv) -__strong_alias(_atomic_add_int_nv,_atomic_add_32_nv) - -#if !defined(_LP64) -#undef atomic_add_long_nv -atomic_op_alias(atomic_add_long_nv,_atomic_add_32_nv) -__strong_alias(_atomic_add_long_nv,_atomic_add_32_nv) - -#undef atomic_add_ptr_nv -atomic_op_alias(atomic_add_ptr_nv,_atomic_add_32_nv) -__strong_alias(_atomic_add_ptr_nv,_atomic_add_32_nv) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_add_64_cas.c b/common/lib/libc/atomic/atomic_add_64_cas.c deleted file mode 100644 index 87049ba4e..000000000 --- a/common/lib/libc/atomic/atomic_add_64_cas.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $NetBSD: atomic_add_64_cas.c,v 1.9 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t fetch_and_add_8(volatile uint64_t *, uint64_t, ...) - asm("__sync_fetch_and_add_8"); - -uint64_t -fetch_and_add_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = old + val; - } while (atomic_cas_64(addr, old, new) != old); - return old; -} - -void -atomic_add_64(volatile uint64_t *addr, int64_t val) -{ - (void) fetch_and_add_8(addr, val); -} - -__strong_alias(__atomic_fetch_add_8,__sync_fetch_and_add_8) - -#undef atomic_add_64 -atomic_op_alias(atomic_add_64,_atomic_add_64) - -#if defined(_LP64) -#undef atomic_add_long -atomic_op_alias(atomic_add_long,_atomic_add_64) -__strong_alias(_atomic_add_long,_atomic_add_64) - -#undef atomic_add_ptr -atomic_op_alias(atomic_add_ptr,_atomic_add_64) -__strong_alias(_atomic_add_ptr,_atomic_add_64) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_add_64_nv_cas.c b/common/lib/libc/atomic/atomic_add_64_nv_cas.c deleted file mode 100644 index 986060776..000000000 --- a/common/lib/libc/atomic/atomic_add_64_nv_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_add_64_nv_cas.c,v 1.7 2014/02/22 17:08:30 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t -atomic_add_64_nv(volatile uint64_t *addr, int64_t val) -{ - uint64_t old, new; - - do { - old = *addr; - new = old + val; - } while (atomic_cas_64(addr, old, new) != old); - - return (new); -} - -#undef atomic_add_64_nv -atomic_op_alias(atomic_add_64_nv,_atomic_add_64_nv) -crt_alias(__sync_add_and_fetch_8,_atomic_add_64_nv) - -#if defined(_LP64) -#undef atomic_add_long_nv -atomic_op_alias(atomic_add_long_nv,_atomic_add_64_nv) -__strong_alias(_atomic_add_long_nv,_atomic_add_64_nv) - -#undef atomic_add_ptr_nv -atomic_op_alias(atomic_add_ptr_nv,_atomic_add_64_nv) -__strong_alias(_atomic_add_ptr_nv,_atomic_add_64_nv) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_add_8_cas.c b/common/lib/libc/atomic/atomic_add_8_cas.c deleted file mode 100644 index 8d04f3b11..000000000 --- a/common/lib/libc/atomic/atomic_add_8_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_add_8_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint8_t fetch_and_add_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_fetch_and_add_1"); -uint8_t add_and_fetch_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_add_and_fetch_1"); - -uint8_t -fetch_and_add_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old + val; - } while (atomic_cas_8(addr, old, new) != old); - return old; -} - -uint8_t -add_and_fetch_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old + val; - } while (atomic_cas_8(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_add_1,__sync_fetch_and_add_1) diff --git a/common/lib/libc/atomic/atomic_and_16_cas.c b/common/lib/libc/atomic/atomic_and_16_cas.c deleted file mode 100644 index 6916aa507..000000000 --- a/common/lib/libc/atomic/atomic_and_16_cas.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $NetBSD: atomic_and_16_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint16_t fetch_and_and_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_fetch_and_and_2"); - -uint16_t -fetch_and_and_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old & val; - } while (atomic_cas_16(addr, old, new) != old); - return old; -} - -__strong_alias(__atomic_fetch_and_2,__sync_fetch_and_and_2) diff --git a/common/lib/libc/atomic/atomic_and_16_nv_cas.c b/common/lib/libc/atomic/atomic_and_16_nv_cas.c deleted file mode 100644 index 28ff0bffb..000000000 --- a/common/lib/libc/atomic/atomic_and_16_nv_cas.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: atomic_and_16_nv_cas.c,v 1.2 2014/10/13 07:31:12 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint16_t atomic_and_16_nv(volatile uint16_t *addr, uint16_t val); - -uint16_t -atomic_and_16_nv(volatile uint16_t *addr, uint16_t val) -{ - uint16_t old, new; - - do { - old = *addr; - new = old & val; - } while (atomic_cas_16(addr, old, new) != old); - - return (new); -} - -#undef atomic_and_16_nv -atomic_op_alias(atomic_and_16_nv,_atomic_and_16_nv) -crt_alias(__sync_and_and_fetch_2,_atomic_and_16_nv) diff --git a/common/lib/libc/atomic/atomic_and_32_cas.c b/common/lib/libc/atomic/atomic_and_32_cas.c deleted file mode 100644 index 851a406a4..000000000 --- a/common/lib/libc/atomic/atomic_and_32_cas.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $NetBSD: atomic_and_32_cas.c,v 1.10 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t fetch_and_and_4(volatile uint32_t *, uint32_t, ...) -#if defined(_LIBC) || defined(_HARDKERNEL) - asm("__sync_fetch_and_and_4"); /* C runtime internal */ -#else - ; -#endif - -uint32_t -fetch_and_and_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = old & val; - } while (atomic_cas_32(addr, old, new) != old); - return old; -} - -void -atomic_and_32(volatile uint32_t *addr, uint32_t val) -{ - (void) fetch_and_and_4(addr, val); -} - -__strong_alias(__atomic_fetch_and_4,__sync_fetch_and_and_4) - -#undef atomic_and_32 -atomic_op_alias(atomic_and_32,_atomic_and_32) - -#undef atomic_and_uint -atomic_op_alias(atomic_and_uint,_atomic_and_32) -__strong_alias(_atomic_and_uint,_atomic_and_32) -#if !defined(_LP64) -#undef atomic_and_ulong -atomic_op_alias(atomic_and_ulong,_atomic_and_32) -__strong_alias(_atomic_and_ulong,_atomic_and_32) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_and_32_nv_cas.c b/common/lib/libc/atomic/atomic_and_32_nv_cas.c deleted file mode 100644 index 8851ae803..000000000 --- a/common/lib/libc/atomic/atomic_and_32_nv_cas.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: atomic_and_32_nv_cas.c,v 1.7 2014/02/22 17:08:30 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t -atomic_and_32_nv(volatile uint32_t *addr, uint32_t val) -{ - uint32_t old, new; - - do { - old = *addr; - new = old & val; - } while (atomic_cas_32(addr, old, new) != old); - - return (new); -} - -#undef atomic_and_32_nv -atomic_op_alias(atomic_and_32_nv,_atomic_and_32_nv) -crt_alias(__sync_and_and_fetch_4,_atomic_and_32_nv) - -#undef atomic_and_uint_nv -atomic_op_alias(atomic_and_uint_nv,_atomic_and_32_nv) -__strong_alias(_atomic_and_uint_nv,_atomic_and_32_nv) -#if !defined(_LP64) -#undef atomic_and_ulong_nv -atomic_op_alias(atomic_and_ulong_nv,_atomic_and_32_nv) -__strong_alias(_atomic_and_ulong_nv,_atomic_and_32_nv) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_and_64_cas.c b/common/lib/libc/atomic/atomic_and_64_cas.c deleted file mode 100644 index f2deba079..000000000 --- a/common/lib/libc/atomic/atomic_and_64_cas.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: atomic_and_64_cas.c,v 1.10 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t fetch_and_and_8(volatile uint64_t *, uint64_t, ...) - asm("__sync_fetch_and_and_8"); - -uint64_t -fetch_and_and_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = old & val; - } while (atomic_cas_64(addr, old, new) != old); - return old; -} - -void -atomic_and_64(volatile uint64_t *addr, uint64_t val) -{ - (void) fetch_and_and_8(addr, val); -} - -__strong_alias(__atomic_fetch_and_8,__sync_fetch_and_and_8) - -#undef atomic_and_64 -atomic_op_alias(atomic_and_64,_atomic_and_64) - -#if defined(_LP64) -#undef atomic_and_ulong -atomic_op_alias(atomic_and_ulong,_atomic_and_64) -__strong_alias(_atomic_and_ulong,_atomic_and_64) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_and_64_nv_cas.c b/common/lib/libc/atomic/atomic_and_64_nv_cas.c deleted file mode 100644 index 0ab38ba9d..000000000 --- a/common/lib/libc/atomic/atomic_and_64_nv_cas.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: atomic_and_64_nv_cas.c,v 1.7 2014/02/22 17:08:30 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t -atomic_and_64_nv(volatile uint64_t *addr, uint64_t val) -{ - uint64_t old, new; - - do { - old = *addr; - new = old & val; - } while (atomic_cas_64(addr, old, new) != old); - - return (new); -} - -#undef atomic_and_64_nv -atomic_op_alias(atomic_and_64_nv,_atomic_and_64_nv) -crt_alias(__sync_and_and_fetch_8,_atomic_add_64_nv) - -#if defined(_LP64) -#undef atomic_and_ulong_nv -atomic_op_alias(atomic_and_ulong_nv,_atomic_and_64_nv) -__strong_alias(_atomic_and_ulong_nv,_atomic_and_64_nv) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_and_8_cas.c b/common/lib/libc/atomic/atomic_and_8_cas.c deleted file mode 100644 index e85ca5d8a..000000000 --- a/common/lib/libc/atomic/atomic_and_8_cas.c +++ /dev/null @@ -1,51 +0,0 @@ -/* $NetBSD: atomic_and_8_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint8_t fetch_and_and_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_fetch_and_and_1"); - -uint8_t -fetch_and_and_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old & val; - } while (atomic_cas_8(addr, old, new) != old); - return old; -} - -__strong_alias(__atomic_fetch_and_1,__sync_fetch_and_and_1) diff --git a/common/lib/libc/atomic/atomic_and_8_nv_cas.c b/common/lib/libc/atomic/atomic_and_8_nv_cas.c deleted file mode 100644 index ce4d03623..000000000 --- a/common/lib/libc/atomic/atomic_and_8_nv_cas.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: atomic_and_8_nv_cas.c,v 1.2 2014/10/13 07:31:12 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint8_t atomic_and_8_nv(volatile uint8_t *addr, uint8_t val); - -uint8_t -atomic_and_8_nv(volatile uint8_t *addr, uint8_t val) -{ - uint8_t old, new; - - do { - old = *addr; - new = old & val; - } while (atomic_cas_8(addr, old, new) != old); - - return (new); -} - -#undef atomic_and_8_nv -atomic_op_alias(atomic_and_8_nv,_atomic_and_8_nv) -crt_alias(__sync_and_and_fetch_1,_atomic_and_8_nv) diff --git a/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c b/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c deleted file mode 100644 index f626a78d9..000000000 --- a/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_16.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_16.c,v 1.2 2014/11/04 19:56:44 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Martin Husemann. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif -#include - -bool __atomic_compare_exchange_2(volatile uint16_t *, uint16_t *, uint16_t, - bool, int, int); - -bool -__atomic_compare_exchange_2(volatile uint16_t *mem, - uint16_t *expected, uint16_t desired, - bool weak, int success, int failure) -{ - uint16_t old = *expected; - - /* - * Ignore the details (weak, memory model on success and failure) - * and just do the cas. If we get here the compiler couldn't - * do better and it mostly will not matter at all. - */ - return atomic_cas_16(mem, old, desired) == old; -} diff --git a/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c b/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c deleted file mode 100644 index e7b72039c..000000000 --- a/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_32.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_32.c,v 1.2 2014/11/04 19:56:44 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Martin Husemann. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif -#include - -bool __atomic_compare_exchange_4(volatile uint32_t *, uint32_t *, uint32_t, - bool, int, int); - -bool -__atomic_compare_exchange_4(volatile uint32_t *mem, - uint32_t *expected, uint32_t desired, - bool weak, int success, int failure) -{ - uint32_t old = *expected; - - /* - * Ignore the details (weak, memory model on success and failure) - * and just do the cas. If we get here the compiler couldn't - * do better and it mostly will not matter at all. - */ - return atomic_cas_32(mem, old, desired) == old; -} diff --git a/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c b/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c deleted file mode 100644 index 3126bcc87..000000000 --- a/common/lib/libc/atomic/atomic_c11_compare_exchange_cas_8.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_c11_compare_exchange_cas_8.c,v 1.2 2014/11/04 19:56:44 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Martin Husemann. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif -#include - -bool __atomic_compare_exchange_1(volatile uint8_t *, uint8_t *, uint8_t, - bool, int, int); - -bool -__atomic_compare_exchange_1(volatile uint8_t *mem, - uint8_t *expected, uint8_t desired, - bool weak, int success, int failure) -{ - uint8_t old = *expected; - - /* - * Ignore the details (weak, memory model on success and failure) - * and just do the cas. If we get here the compiler couldn't - * do better and it mostly will not matter at all. - */ - return atomic_cas_8(mem, old, desired) == old; -} diff --git a/common/lib/libc/atomic/atomic_cas_16_cas.c b/common/lib/libc/atomic/atomic_cas_16_cas.c deleted file mode 100644 index 5e8aa46ac..000000000 --- a/common/lib/libc/atomic/atomic_cas_16_cas.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: atomic_cas_16_cas.c,v 1.3 2014/02/21 16:06:48 martin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif -#include - -bool bool_compare_and_swap_2(volatile uint16_t *, uint16_t, uint16_t, ...) - asm("__sync_bool_compare_and_swap_2"); - -bool -bool_compare_and_swap_2(volatile uint16_t *addr, uint16_t oldval, - uint16_t newval, ...) -{ - return atomic_cas_16(addr, oldval, newval) == oldval; -} diff --git a/common/lib/libc/atomic/atomic_cas_32_cas.c b/common/lib/libc/atomic/atomic_cas_32_cas.c deleted file mode 100644 index da9f9f84b..000000000 --- a/common/lib/libc/atomic/atomic_cas_32_cas.c +++ /dev/null @@ -1,45 +0,0 @@ -/* $NetBSD: atomic_cas_32_cas.c,v 1.1 2014/02/21 10:52:50 martin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif -#include - -bool bool_compare_and_swap_4(volatile uint32_t *, uint32_t, uint32_t, ...) - asm("__sync_bool_compare_and_swap_4"); - -bool -bool_compare_and_swap_4(volatile uint32_t *addr, uint32_t oldval, - uint32_t newval, ...) -{ - return atomic_cas_32(addr, oldval, newval) == oldval; -} diff --git a/common/lib/libc/atomic/atomic_cas_64_cas.c b/common/lib/libc/atomic/atomic_cas_64_cas.c deleted file mode 100644 index 464b79aab..000000000 --- a/common/lib/libc/atomic/atomic_cas_64_cas.c +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: atomic_cas_64_cas.c,v 1.2 2014/02/18 12:23:07 martin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif -#include - -#ifdef __HAVE_ATOMIC64_OPS - -bool bool_compare_and_swap_8(volatile uint64_t *, uint64_t, uint64_t, ...) - asm("__sync_bool_compare_and_swap_8"); - -bool -bool_compare_and_swap_8(volatile uint64_t *addr, uint64_t oldval, - uint64_t newval, ...) -{ - return atomic_cas_64(addr, oldval, newval) == oldval; -} - -#endif diff --git a/common/lib/libc/atomic/atomic_cas_8_cas.c b/common/lib/libc/atomic/atomic_cas_8_cas.c deleted file mode 100644 index 37ef97b54..000000000 --- a/common/lib/libc/atomic/atomic_cas_8_cas.c +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: atomic_cas_8_cas.c,v 1.3 2014/02/21 16:06:48 martin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif -#include - -bool bool_compare_and_swap_1(volatile uint8_t *, uint8_t, uint8_t, ...) - asm("__sync_bool_compare_and_swap_1"); - -bool -bool_compare_and_swap_1(volatile uint8_t *addr, uint8_t oldval, - uint8_t newval, ...) -{ - return atomic_cas_8(addr, oldval, newval) == oldval; -} diff --git a/common/lib/libc/atomic/atomic_cas_by_cas32.c b/common/lib/libc/atomic/atomic_cas_by_cas32.c deleted file mode 100644 index 9119c2cd0..000000000 --- a/common/lib/libc/atomic/atomic_cas_by_cas32.c +++ /dev/null @@ -1,91 +0,0 @@ -/* $NetBSD: atomic_cas_by_cas32.c,v 1.4 2014/09/03 19:30:47 matt Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include - -#include "atomic_op_namespace.h" - -uint32_t _atomic_cas_32(volatile uint32_t *addr, uint32_t old, uint32_t new); -uint16_t _atomic_cas_16(volatile uint16_t *addr, uint16_t old, uint16_t new); -uint8_t _atomic_cas_8(volatile uint8_t *addr, uint8_t old, uint8_t new); - -/* - * This file provides emulation of 8 bit and 16 bit CAS operations based on - * 32 bit CAS. - */ -uint16_t -_atomic_cas_16(volatile uint16_t *addr, uint16_t old, uint16_t new) -{ - const uintptr_t base = (uintptr_t)addr & ~3; - const size_t off = (uintptr_t)addr - base; - volatile uint32_t * ptr = (volatile uint32_t *)base; - const size_t shift = off*8; - const uint32_t mask = 0x0ffff << shift; - const uint32_t old32_part = (uint32_t)old << shift; - const uint32_t new32_part = (uint32_t)new << shift; - uint32_t old32, new32; - - do { - old32 = *ptr; - if ((old32 & mask) != old32_part) - return (uint16_t)((old32 & mask) >> shift); - new32 = (old32 & ~mask) | new32_part; - } while (_atomic_cas_32(ptr, old32, new32) != old32); - - return old; -} - -crt_alias(__sync_val_compare_and_swap_2,_atomic_cas_16) - -uint8_t -_atomic_cas_8(volatile uint8_t *addr, uint8_t old, uint8_t new) -{ - const uintptr_t base = (uintptr_t)addr & ~3; - const size_t off = (uintptr_t)addr - base; - volatile uint32_t * ptr = (volatile uint32_t *)base; - const size_t shift = off*8; - const uint32_t mask = 0x0ff << shift; - const uint32_t old32_part = (uint32_t)old << shift; - const uint32_t new32_part = (uint32_t)new << shift; - uint32_t old32, new32; - - do { - old32 = *ptr; - if ((old32 & mask) != old32_part) - return (uint8_t)((old32 & mask) >> shift); - new32 = (old32 & ~mask) | new32_part; - } while (_atomic_cas_32(ptr, old32, new32) != old32); - - return old; -} - -crt_alias(__sync_val_compare_and_swap_1,_atomic_cas_8) diff --git a/common/lib/libc/atomic/atomic_dec_32_add.c b/common/lib/libc/atomic/atomic_dec_32_add.c deleted file mode 100644 index 46285d672..000000000 --- a/common/lib/libc/atomic/atomic_dec_32_add.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_dec_32_add.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -void -atomic_dec_32(volatile uint32_t *addr) -{ - - atomic_add_32(addr, -1); -} - -#undef atomic_dec_32 -atomic_op_alias(atomic_dec_32,_atomic_dec_32) -#undef atomic_dec_uint -atomic_op_alias(atomic_dec_uint,_atomic_dec_32) -__strong_alias(_atomic_dec_uint,_atomic_dec_32) -#if !defined(_LP64) -#undef atomic_dec_ulong -atomic_op_alias(atomic_dec_ulong,_atomic_dec_32) -__strong_alias(_atomic_dec_ulong,_atomic_dec_32) -#undef atomic_dec_ptr -atomic_op_alias(atomic_dec_ptr,_atomic_dec_32) -__strong_alias(_atomic_dec_ptr,_atomic_dec_32) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_dec_32_cas.c b/common/lib/libc/atomic/atomic_dec_32_cas.c deleted file mode 100644 index 0f977f391..000000000 --- a/common/lib/libc/atomic/atomic_dec_32_cas.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_dec_32_cas.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -void -atomic_dec_32(volatile uint32_t *addr) -{ - uint32_t old, new; - - do { - old = *addr; - new = old - 1; - } while (atomic_cas_32(addr, old, new) != old); -} - -#undef atomic_dec_32 -atomic_op_alias(atomic_dec_32,_atomic_dec_32) - -#undef atomic_dec_uint -atomic_op_alias(atomic_dec_uint,_atomic_dec_32) -__strong_alias(_atomic_dec_uint,_atomic_dec_32) - -#if !defined(_LP64) -#undef atomic_dec_ulong -atomic_op_alias(atomic_dec_ulong,_atomic_dec_32) -__strong_alias(_atomic_dec_ulong,_atomic_dec_32) - -#undef atomic_dec_ptr -atomic_op_alias(atomic_dec_ptr,_atomic_dec_32) -__strong_alias(_atomic_dec_ptr,_atomic_dec_32) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_dec_32_nv_add.c b/common/lib/libc/atomic/atomic_dec_32_nv_add.c deleted file mode 100644 index 4af68c50c..000000000 --- a/common/lib/libc/atomic/atomic_dec_32_nv_add.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_dec_32_nv_add.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t -atomic_dec_32_nv(volatile uint32_t *addr) -{ - - return (atomic_add_32_nv(addr, -1)); -} - -#undef atomic_dec_32_nv -atomic_op_alias(atomic_dec_32_nv,_atomic_dec_32_nv) -#undef atomic_dec_uint_nv -atomic_op_alias(atomic_dec_uint_nv,_atomic_dec_32_nv) -__strong_alias(_atomic_dec_uint_nv,_atomic_dec_32_nv) -#if !defined(_LP64) -#undef atomic_dec_ulong_nv -atomic_op_alias(atomic_dec_ulong_nv,_atomic_dec_32_nv) -__strong_alias(_atomic_dec_ulong_nv,_atomic_dec_32_nv) -#undef atomic_dec_ptr_nv -atomic_op_alias(atomic_dec_ptr_nv,_atomic_dec_32_nv) -__strong_alias(_atomic_dec_ptr_nv,_atomic_dec_32_nv) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_dec_32_nv_cas.c b/common/lib/libc/atomic/atomic_dec_32_nv_cas.c deleted file mode 100644 index 9f7d6ae65..000000000 --- a/common/lib/libc/atomic/atomic_dec_32_nv_cas.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_dec_32_nv_cas.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t -atomic_dec_32_nv(volatile uint32_t *addr) -{ - uint32_t old, new; - - do { - old = *addr; - new = old - 1; - } while (atomic_cas_32(addr, old, new) != old); - - return (new); -} - -#undef atomic_dec_32_nv -atomic_op_alias(atomic_dec_32_nv,_atomic_dec_32_nv) - -#undef atomic_dec_uint_nv -atomic_op_alias(atomic_dec_uint_nv,_atomic_dec_32_nv) -__strong_alias(_atomic_dec_uint_nv,_atomic_dec_32_nv) - -#if !defined(_LP64) -#undef atomic_dec_ulong_nv -atomic_op_alias(atomic_dec_ulong_nv,_atomic_dec_32_nv) -__strong_alias(_atomic_dec_ulong_nv,_atomic_dec_32_nv) - -#undef atomic_dec_ptr_nv -atomic_op_alias(atomic_dec_ptr_nv,_atomic_dec_32_nv) -__strong_alias(_atomic_dec_ptr_nv,_atomic_dec_32_nv) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_dec_64_add.c b/common/lib/libc/atomic/atomic_dec_64_add.c deleted file mode 100644 index dca0ee344..000000000 --- a/common/lib/libc/atomic/atomic_dec_64_add.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $NetBSD: atomic_dec_64_add.c,v 1.4 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -void -atomic_dec_64(volatile uint64_t *addr) -{ - - atomic_add_64(addr, -1); -} - -#undef atomic_dec_64 -atomic_op_alias(atomic_dec_64,_atomic_dec_64) -#if defined(_LP64) -#undef atomic_dec_ulong -atomic_op_alias(atomic_dec_ulong,_atomic_dec_64) -__strong_alias(_atomic_dec_ulong,_atomic_dec_64) -#undef atomic_dec_ptr -atomic_op_alias(atomic_dec_ptr,_atomic_dec_64) -__strong_alias(_atomic_dec_ptr,_atomic_dec_64) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_dec_64_cas.c b/common/lib/libc/atomic/atomic_dec_64_cas.c deleted file mode 100644 index 0c20aceb0..000000000 --- a/common/lib/libc/atomic/atomic_dec_64_cas.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_dec_64_cas.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -void -atomic_dec_64(volatile uint64_t *addr) -{ - uint64_t old, new; - - do { - old = *addr; - new = old - 1; - } while (atomic_cas_64(addr, old, new) != old); -} - -#undef atomic_dec_64 -atomic_op_alias(atomic_dec_64,_atomic_dec_64) - -#if defined(_LP64) -#undef atomic_dec_ulong -atomic_op_alias(atomic_dec_ulong,_atomic_dec_64) -__strong_alias(_atomic_dec_ulong,_atomic_dec_64) - -#undef atomic_dec_ptr -atomic_op_alias(atomic_dec_ptr,_atomic_dec_64) -__strong_alias(_atomic_dec_ptr,_atomic_dec_64) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_dec_64_nv_add.c b/common/lib/libc/atomic/atomic_dec_64_nv_add.c deleted file mode 100644 index 02a90b0a3..000000000 --- a/common/lib/libc/atomic/atomic_dec_64_nv_add.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $NetBSD: atomic_dec_64_nv_add.c,v 1.4 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t -atomic_dec_64_nv(volatile uint64_t *addr) -{ - - return (atomic_add_64_nv(addr, -1)); -} - -#undef atomic_dec_64_nv -atomic_op_alias(atomic_dec_64_nv,_atomic_dec_64_nv) -#if defined(_LP64) -#undef atomic_dec_ulong_nv -atomic_op_alias(atomic_dec_ulong_nv,_atomic_dec_64_nv) -__strong_alias(_atomic_dec_ulong_nv,_atomic_dec_64_nv) -#undef atomic_dec_ptr_nv -atomic_op_alias(atomic_dec_ptr_nv,_atomic_dec_64_nv) -__strong_alias(_atomic_dec_ptr_nv,_atomic_dec_64_nv) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_dec_64_nv_cas.c b/common/lib/libc/atomic/atomic_dec_64_nv_cas.c deleted file mode 100644 index 22f5c9044..000000000 --- a/common/lib/libc/atomic/atomic_dec_64_nv_cas.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_dec_64_nv_cas.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t -atomic_dec_64_nv(volatile uint64_t *addr) -{ - uint64_t old, new; - - do { - old = *addr; - new = old - 1; - } while (atomic_cas_64(addr, old, new) != old); - - return (new); -} - -#undef atomic_dec_64_nv -atomic_op_alias(atomic_dec_64_nv,_atomic_dec_64_nv) - -#if defined(_LP64) -#undef atomic_dec_ulong_nv -atomic_op_alias(atomic_dec_ulong_nv,_atomic_dec_64_nv) -__strong_alias(_atomic_dec_ulong_nv,_atomic_dec_64_nv) - -#undef atomic_dec_ptr_nv -atomic_op_alias(atomic_dec_ptr_nv,_atomic_dec_64_nv) -__strong_alias(_atomic_dec_ptr_nv,_atomic_dec_64_nv) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_inc_32_add.c b/common/lib/libc/atomic/atomic_inc_32_add.c deleted file mode 100644 index 06aaa46b0..000000000 --- a/common/lib/libc/atomic/atomic_inc_32_add.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_inc_32_add.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -void -atomic_inc_32(volatile uint32_t *addr) -{ - - atomic_add_32(addr, 1); -} - -#undef atomic_inc_32 -atomic_op_alias(atomic_inc_32,_atomic_inc_32) -#undef atomic_inc_uint -atomic_op_alias(atomic_inc_uint,_atomic_inc_32) -__strong_alias(_atomic_inc_uint,_atomic_inc_32) -#if !defined(_LP64) -#undef atomic_inc_ulong -atomic_op_alias(atomic_inc_ulong,_atomic_inc_32) -__strong_alias(_atomic_inc_ulong,_atomic_inc_32) -#undef atomic_inc_ptr -atomic_op_alias(atomic_inc_ptr,_atomic_inc_32) -__strong_alias(_atomic_inc_ptr,_atomic_inc_32) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_inc_32_cas.c b/common/lib/libc/atomic/atomic_inc_32_cas.c deleted file mode 100644 index 2f8f9151f..000000000 --- a/common/lib/libc/atomic/atomic_inc_32_cas.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_inc_32_cas.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -void -atomic_inc_32(volatile uint32_t *addr) -{ - uint32_t old, new; - - do { - old = *addr; - new = old + 1; - } while (atomic_cas_32(addr, old, new) != old); -} - -#undef atomic_inc_32 -atomic_op_alias(atomic_inc_32,_atomic_inc_32) - -#undef atomic_inc_uint -atomic_op_alias(atomic_inc_uint,_atomic_inc_32) -__strong_alias(_atomic_inc_uint,_atomic_inc_32) - -#if !defined(_LP64) -#undef atomic_inc_ulong -atomic_op_alias(atomic_inc_ulong,_atomic_inc_32) -__strong_alias(_atomic_inc_ulong,_atomic_inc_32) - -#undef atomic_inc_ptr -atomic_op_alias(atomic_inc_ptr,_atomic_inc_32) -__strong_alias(_atomic_inc_ptr,_atomic_inc_32) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_inc_32_nv_add.c b/common/lib/libc/atomic/atomic_inc_32_nv_add.c deleted file mode 100644 index 6fc0900df..000000000 --- a/common/lib/libc/atomic/atomic_inc_32_nv_add.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: atomic_inc_32_nv_add.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t -atomic_inc_32_nv(volatile uint32_t *addr) -{ - - return (atomic_add_32_nv(addr, 1)); -} - -#undef atomic_inc_32_nv -atomic_op_alias(atomic_inc_32_nv,_atomic_inc_32_nv) -#undef atomic_inc_uint_nv -atomic_op_alias(atomic_inc_uint_nv,_atomic_inc_32_nv) -__strong_alias(_atomic_inc_uint_nv,_atomic_inc_32_nv) -#if !defined(_LP64) -#undef atomic_inc_ulong_nv -atomic_op_alias(atomic_inc_ulong_nv,_atomic_inc_32_nv) -__strong_alias(_atomic_inc_ulong_nv,_atomic_inc_32_nv) -#undef atomic_inc_ptr_nv -atomic_op_alias(atomic_inc_ptr_nv,_atomic_inc_32_nv) -__strong_alias(_atomic_inc_ptr_nv,_atomic_inc_32_nv) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_inc_32_nv_cas.c b/common/lib/libc/atomic/atomic_inc_32_nv_cas.c deleted file mode 100644 index 45fdffbf3..000000000 --- a/common/lib/libc/atomic/atomic_inc_32_nv_cas.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_inc_32_nv_cas.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t -atomic_inc_32_nv(volatile uint32_t *addr) -{ - uint32_t old, new; - - do { - old = *addr; - new = old + 1; - } while (atomic_cas_32(addr, old, new) != old); - - return (new); -} - -#undef atomic_inc_32_nv -atomic_op_alias(atomic_inc_32_nv,_atomic_inc_32_nv) - -#undef atomic_inc_uint_nv -atomic_op_alias(atomic_inc_uint_nv,_atomic_inc_32_nv) -__strong_alias(_atomic_inc_uint_nv,_atomic_inc_32_nv) - -#if !defined(_LP64) -#undef atomic_inc_ulong_nv -atomic_op_alias(atomic_inc_ulong_nv,_atomic_inc_32_nv) -__strong_alias(_atomic_inc_ulong_nv,_atomic_inc_32_nv) - -#undef atomic_inc_ptr_nv -atomic_op_alias(atomic_inc_ptr_nv,_atomic_inc_32_nv) -__strong_alias(_atomic_inc_ptr_nv,_atomic_inc_32_nv) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_inc_64_add.c b/common/lib/libc/atomic/atomic_inc_64_add.c deleted file mode 100644 index 626eb1cec..000000000 --- a/common/lib/libc/atomic/atomic_inc_64_add.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $NetBSD: atomic_inc_64_add.c,v 1.4 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -void -atomic_inc_64(volatile uint64_t *addr) -{ - - atomic_add_64(addr, 1); -} - -#undef atomic_inc_64 -atomic_op_alias(atomic_inc_64,_atomic_inc_64) -#if defined(_LP64) -#undef atomic_inc_ulong -atomic_op_alias(atomic_inc_ulong,_atomic_inc_64) -__strong_alias(_atomic_inc_ulong,_atomic_inc_64) -#undef atomic_inc_ptr -atomic_op_alias(atomic_inc_ptr,_atomic_inc_64) -__strong_alias(_atomic_inc_ptr,_atomic_inc_64) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_inc_64_cas.c b/common/lib/libc/atomic/atomic_inc_64_cas.c deleted file mode 100644 index ded46ca56..000000000 --- a/common/lib/libc/atomic/atomic_inc_64_cas.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: atomic_inc_64_cas.c,v 1.3 2008/04/28 20:22:52 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -void -atomic_inc_64(volatile uint64_t *addr) -{ - uint64_t old, new; - - do { - old = *addr; - new = old + 1; - } while (atomic_cas_64(addr, old, new) != old); -} - -#undef atomic_inc_64 -atomic_op_alias(atomic_inc_64,_atomic_inc_64) - -#if defined(_LP64) -#undef atomic_inc_ulong -atomic_op_alias(atomic_inc_ulong,_atomic_inc_64) -__strong_alias(_atomic_inc_ulong,_atomic_inc_64) - -#undef atomic_inc_ptr -atomic_op_alias(atomic_inc_ptr,_atomic_inc_64) -__strong_alias(_atomic_inc_ptr,_atomic_inc_64) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_inc_64_nv_add.c b/common/lib/libc/atomic/atomic_inc_64_nv_add.c deleted file mode 100644 index 71bbc9ace..000000000 --- a/common/lib/libc/atomic/atomic_inc_64_nv_add.c +++ /dev/null @@ -1,56 +0,0 @@ -/* $NetBSD: atomic_inc_64_nv_add.c,v 1.4 2008/04/28 20:22:53 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t -atomic_inc_64_nv(volatile uint64_t *addr) -{ - - return (atomic_add_64_nv(addr, 1)); -} - -#undef atomic_inc_64_nv -atomic_op_alias(atomic_inc_64_nv,_atomic_inc_64_nv) -#if defined(_LP64) -#undef atomic_inc_ulong_nv -atomic_op_alias(atomic_inc_ulong_nv,_atomic_inc_64_nv) -__strong_alias(_atomic_inc_ulong_nv,_atomic_inc_64_nv) -#undef atomic_inc_ptr_nv -atomic_op_alias(atomic_inc_ptr_nv,_atomic_inc_64_nv) -__strong_alias(_atomic_inc_ptr_nv,_atomic_inc_64_nv) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_inc_64_nv_cas.c b/common/lib/libc/atomic/atomic_inc_64_nv_cas.c deleted file mode 100644 index f835df598..000000000 --- a/common/lib/libc/atomic/atomic_inc_64_nv_cas.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_inc_64_nv_cas.c,v 1.4 2008/04/28 20:22:53 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t -atomic_inc_64_nv(volatile uint64_t *addr) -{ - uint64_t old, new; - - do { - old = *addr; - new = old + 1; - } while (atomic_cas_64(addr, old, new) != old); - - return (new); -} - -#undef atomic_inc_64_nv -atomic_op_alias(atomic_inc_64_nv,_atomic_inc_64_nv) - -#if defined(_LP64) -#undef atomic_add_ulong_nv -atomic_op_alias(atomic_inc_ulong_nv,_atomic_inc_64_nv) -__strong_alias(_atomic_inc_ulong_nv,_atomic_inc_64_nv) - -#undef atomic_inc_ptr_nv -atomic_op_alias(atomic_inc_ptr_nv,_atomic_inc_64_nv) -__strong_alias(_atomic_inc_ptr_nv,_atomic_inc_64_nv) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_init_cas.c b/common/lib/libc/atomic/atomic_init_cas.c deleted file mode 100644 index f99d96ccc..000000000 --- a/common/lib/libc/atomic/atomic_init_cas.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: atomic_init_cas.c,v 1.4 2013/08/21 03:00:56 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * libc glue for atomic operations where the hardware _does_ provide - * compare-and-swap. - */ - -#include -__RCSID("$NetBSD: atomic_init_cas.c,v 1.4 2013/08/21 03:00:56 matt Exp $"); - -void __libc_atomic_init(void) __attribute__ ((visibility("hidden"))); - -void __section(".text.startup") -__libc_atomic_init(void) -{ - - /* nothing to do */ -} diff --git a/common/lib/libc/atomic/atomic_init_testset.c b/common/lib/libc/atomic/atomic_init_testset.c deleted file mode 100644 index f9743f16e..000000000 --- a/common/lib/libc/atomic/atomic_init_testset.c +++ /dev/null @@ -1,366 +0,0 @@ -/* $NetBSD: atomic_init_testset.c,v 1.15 2014/02/27 09:39:00 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * libc glue for atomic operations where the hardware does not provide - * compare-and-swap. It's assumed that this will only be used on 32-bit - * platforms. - * - * This should be compiled with '-fno-reorder-blocks -fomit-frame-pointer' - * if using gcc. - */ - -#include -__RCSID("$NetBSD: atomic_init_testset.c,v 1.15 2014/02/27 09:39:00 matt Exp $"); - -#include "atomic_op_namespace.h" - -#include -#include -#include -#include -#include - -#include - -#define I2 __SIMPLELOCK_UNLOCKED, __SIMPLELOCK_UNLOCKED, -#define I16 I2 I2 I2 I2 I2 I2 I2 I2 -#define I128 I16 I16 I16 I16 I16 I16 I16 I16 - -static __cpu_simple_lock_t atomic_locks[128] = { I128 }; -/* - * Pick a lock out of above array depending on the object address - * passed. Most variables used atomically will not be in the same - * cacheline - and if they are, using the same lock is fine. - */ -#define HASH(PTR) (((uintptr_t)(PTR) >> 3) & 127) - -#ifdef __HAVE_ASM_ATOMIC_CAS_UP -extern uint32_t _atomic_cas_up(volatile uint32_t *, uint32_t, uint32_t); -#else -static uint32_t _atomic_cas_up(volatile uint32_t *, uint32_t, uint32_t); -#endif -static uint32_t (*_atomic_cas_fn)(volatile uint32_t *, uint32_t, uint32_t) = - _atomic_cas_up; -RAS_DECL(_atomic_cas); - -#ifdef __HAVE_ATOMIC_CAS_64_UP -#ifdef __HAVE_ASM_ATOMIC_CAS_64_UP -extern uint64_t _atomic_cas_64_up(volatile uint64_t *, uint64_t, uint64_t); -#else -static uint64_t _atomic_cas_64_up(volatile uint64_t *, uint64_t, uint64_t); -#endif -static uint64_t (*_atomic_cas_64_fn)(volatile uint64_t *, uint64_t, uint64_t) = - _atomic_cas_64_up; -RAS_DECL(_atomic_cas_64); -#endif - -#ifdef __HAVE_ASM_ATOMIC_CAS_16_UP -extern uint16_t _atomic_cas_16_up(volatile uint16_t *, uint16_t, uint16_t); -#else -static uint16_t _atomic_cas_16_up(volatile uint16_t *, uint16_t, uint16_t); -#endif -static uint16_t (*_atomic_cas_16_fn)(volatile uint16_t *, uint16_t, uint16_t) = - _atomic_cas_16_up; -RAS_DECL(_atomic_cas_16); - -#ifdef __HAVE_ASM_ATOMIC_CAS_8_UP -extern uint8_t _atomic_cas_8_up(volatile uint8_t *, uint8_t, uint8_t); -#else -static uint8_t _atomic_cas_8_up(volatile uint8_t *, uint8_t, uint8_t); -#endif -static uint8_t (*_atomic_cas_8_fn)(volatile uint8_t *, uint8_t, uint8_t) = - _atomic_cas_8_up; -RAS_DECL(_atomic_cas_8); - -void __libc_atomic_init(void) __attribute__ ((visibility("hidden"))); - -#ifndef __HAVE_ASM_ATOMIC_CAS_UP -static uint32_t -_atomic_cas_up(volatile uint32_t *ptr, uint32_t old, uint32_t new) -{ - uint32_t ret; - - RAS_START(_atomic_cas); - ret = *ptr; - if (__predict_false(ret != old)) { - return ret; - } - *ptr = new; - RAS_END(_atomic_cas); - - return ret; -} -#endif - -#if defined(__HAVE_ATOMIC_CAS_64_UP) && !defined(__HAVE_ASM_ATOMIC_CAS_64_UP) -static uint64_t -_atomic_cas_64_up(volatile uint64_t *ptr, uint64_t old, uint64_t new) -{ - uint64_t ret; - - RAS_START(_atomic_cas_64); - ret = *ptr; - if (__predict_false(ret != old)) { - return ret; - } - *ptr = new; - RAS_END(_atomic_cas_64); - - return ret; -} -#endif - -#ifndef __HAVE_ASM_ATOMIC_CAS_16_UP -static uint16_t -_atomic_cas_16_up(volatile uint16_t *ptr, uint16_t old, uint16_t new) -{ - uint16_t ret; - - RAS_START(_atomic_cas_16); - ret = *ptr; - if (__predict_false(ret != old)) { - return ret; - } - *ptr = new; - RAS_END(_atomic_cas_16); - - return ret; -} -#endif - -#ifndef __HAVE_ASM_ATOMIC_CAS_8_UP -static uint8_t -_atomic_cas_8_up(volatile uint8_t *ptr, uint8_t old, uint8_t new) -{ - uint8_t ret; - - RAS_START(_atomic_cas_8); - ret = *ptr; - if (__predict_false(ret != old)) { - return ret; - } - *ptr = new; - RAS_END(_atomic_cas_8); - - return ret; -} -#endif - -static uint32_t -_atomic_cas_mp(volatile uint32_t *ptr, uint32_t old, uint32_t new) -{ - __cpu_simple_lock_t *lock; - uint32_t ret; - - lock = &atomic_locks[HASH(ptr)]; - __cpu_simple_lock(lock); - ret = *ptr; - if (__predict_true(ret == old)) { - *ptr = new; - } - __cpu_simple_unlock(lock); - - return ret; -} - -#ifdef __HAVE_ATOMIC_CAS_64_UP -static uint64_t -_atomic_cas_64_mp(volatile uint64_t *ptr, uint64_t old, uint64_t new) -{ - __cpu_simple_lock_t *lock; - uint64_t ret; - - lock = &atomic_locks[HASH(ptr)]; - __cpu_simple_lock(lock); - ret = *ptr; - if (__predict_true(ret == old)) { - *ptr = new; - } - __cpu_simple_unlock(lock); - - return ret; -} -#endif - -static uint16_t -_atomic_cas_16_mp(volatile uint16_t *ptr, uint16_t old, uint16_t new) -{ - __cpu_simple_lock_t *lock; - uint16_t ret; - - lock = &atomic_locks[HASH(ptr)]; - __cpu_simple_lock(lock); - ret = *ptr; - if (__predict_true(ret == old)) { - *ptr = new; - } - __cpu_simple_unlock(lock); - - return ret; -} - -static uint8_t -_atomic_cas_8_mp(volatile uint8_t *ptr, uint8_t old, uint8_t new) -{ - __cpu_simple_lock_t *lock; - uint8_t ret; - - lock = &atomic_locks[HASH(ptr)]; - __cpu_simple_lock(lock); - ret = *ptr; - if (__predict_true(ret == old)) { - *ptr = new; - } - __cpu_simple_unlock(lock); - - return ret; -} - -uint32_t -_atomic_cas_32(volatile uint32_t *ptr, uint32_t old, uint32_t new) -{ - - return (*_atomic_cas_fn)(ptr, old, new); -} - -#ifdef __HAVE_ATOMIC_CAS_64_UP -uint64_t _atomic_cas_64(volatile uint64_t *, uint64_t, uint64_t); - -uint64_t -_atomic_cas_64(volatile uint64_t *ptr, uint64_t old, uint64_t new) -{ - - return (*_atomic_cas_64_fn)(ptr, old, new); -} -#endif - -uint16_t -_atomic_cas_16(volatile uint16_t *ptr, uint16_t old, uint16_t new) -{ - - return (*_atomic_cas_16_fn)(ptr, old, new); -} - -uint8_t _atomic_cas_8(volatile uint8_t *, uint8_t, uint8_t); - -uint8_t -_atomic_cas_8(volatile uint8_t *ptr, uint8_t old, uint8_t new) -{ - - return (*_atomic_cas_8_fn)(ptr, old, new); -} - -void __section(".text.startup") -__libc_atomic_init(void) -{ -#if !defined(__minix) - int ncpu, mib[2]; - size_t len; -#endif /* !defined(__minix) */ - - _atomic_cas_fn = _atomic_cas_mp; -#ifdef __HAVE_ATOMIC_CAS_64_UP - _atomic_cas_64_fn = _atomic_cas_64_mp; -#endif - _atomic_cas_16_fn = _atomic_cas_16_mp; - _atomic_cas_8_fn = _atomic_cas_8_mp; - -#if !defined(__minix) - mib[0] = CTL_HW; - mib[1] = HW_NCPU; - len = sizeof(ncpu); - if (sysctl(mib, 2, &ncpu, &len, NULL, 0) == -1) - return; - if (ncpu > 1) - return; - if (rasctl(RAS_ADDR(_atomic_cas), RAS_SIZE(_atomic_cas), - RAS_INSTALL) == 0) { - _atomic_cas_fn = _atomic_cas_up; - return; - } - -#ifdef __HAVE_ATOMIC_CAS_64_UP - if (rasctl(RAS_ADDR(_atomic_cas_64), RAS_SIZE(_atomic_cas_64), - RAS_INSTALL) == 0) { - _atomic_cas_64_fn = _atomic_cas_64_up; - return; - } -#endif - - if (rasctl(RAS_ADDR(_atomic_cas_16), RAS_SIZE(_atomic_cas_16), - RAS_INSTALL) == 0) { - _atomic_cas_16_fn = _atomic_cas_16_up; - return; - } - - if (rasctl(RAS_ADDR(_atomic_cas_8), RAS_SIZE(_atomic_cas_8), - RAS_INSTALL) == 0) { - _atomic_cas_8_fn = _atomic_cas_8_up; - return; - } -#endif /* !defined(__minix) */ -} - -#undef atomic_cas_32 -#undef atomic_cas_uint -#undef atomic_cas_ulong -#undef atomic_cas_ptr -#undef atomic_cas_32_ni -#undef atomic_cas_uint_ni -#undef atomic_cas_ulong_ni -#undef atomic_cas_ptr_ni - -atomic_op_alias(atomic_cas_32,_atomic_cas_32) -atomic_op_alias(atomic_cas_uint,_atomic_cas_32) -__strong_alias(_atomic_cas_uint,_atomic_cas_32) -atomic_op_alias(atomic_cas_ulong,_atomic_cas_32) -__strong_alias(_atomic_cas_ulong,_atomic_cas_32) -atomic_op_alias(atomic_cas_ptr,_atomic_cas_32) -__strong_alias(_atomic_cas_ptr,_atomic_cas_32) - -atomic_op_alias(atomic_cas_32_ni,_atomic_cas_32) -__strong_alias(_atomic_cas_32_ni,_atomic_cas_32) -atomic_op_alias(atomic_cas_uint_ni,_atomic_cas_32) -__strong_alias(_atomic_cas_uint_ni,_atomic_cas_32) -atomic_op_alias(atomic_cas_ulong_ni,_atomic_cas_32) -__strong_alias(_atomic_cas_ulong_ni,_atomic_cas_32) -atomic_op_alias(atomic_cas_ptr_ni,_atomic_cas_32) -__strong_alias(_atomic_cas_ptr_ni,_atomic_cas_32) - -//atomic_op_alias(atomic_cas_16,_atomic_cas_16) -//atomic_op_alias(atomic_cas_16_ni,_atomic_cas_16) -//atomic_op_alias(atomic_cas_8,_atomic_cas_8) -//atomic_op_alias(atomic_cas_8_ni,_atomic_cas_8) -#ifdef __HAVE_ATOMIC_CAS_64_UP -//atomic_op_alias(atomic_cas_64_ni,_atomic_cas_64) -crt_alias(__sync_val_compare_and_swap_8,_atomic_cas_64) -#endif -crt_alias(__sync_val_compare_and_swap_4,_atomic_cas_32) -crt_alias(__sync_val_compare_and_swap_2,_atomic_cas_16) -crt_alias(__sync_val_compare_and_swap_1,_atomic_cas_8) diff --git a/common/lib/libc/atomic/atomic_load.c b/common/lib/libc/atomic/atomic_load.c deleted file mode 100644 index 41550fdf0..000000000 --- a/common/lib/libc/atomic/atomic_load.c +++ /dev/null @@ -1,54 +0,0 @@ -/* $NetBSD: atomic_load.c,v 1.2 2014/07/06 01:19:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: atomic_load.c,v 1.2 2014/07/06 01:19:45 joerg Exp $"); - -#include "atomic_op_namespace.h" - -#include -#include - -#define atomic_load_n(n,b) \ -uint ## b ## _t __atomic_load_ ## n(volatile uint ## b ## _t *, int); \ -uint ## b ## _t \ -__atomic_load_ ## n(volatile uint ## b ## _t *ptr, int memmodel) \ -{ \ - uint## b ##_t val; \ - membar_enter(); \ - val = *ptr; \ - membar_exit(); \ - return val; \ -} - -atomic_load_n(1, 8) -atomic_load_n(2, 16) -atomic_load_n(4, 32) -#ifdef __HAVE_ATOMIC_CAS_64_UP -atomic_load_n(8, 64) -#endif diff --git a/common/lib/libc/atomic/atomic_nand_16_cas.c b/common/lib/libc/atomic/atomic_nand_16_cas.c deleted file mode 100644 index b37808f29..000000000 --- a/common/lib/libc/atomic/atomic_nand_16_cas.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_nand_16_cas.c,v 1.2 2014/02/21 16:06:48 martin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint16_t fetch_and_nand_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_fetch_and_nand_2"); -uint16_t nand_and_fetch_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_nand_and_fetch_2"); - -uint16_t -fetch_and_nand_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = ~(old & val); - } while (atomic_cas_16(addr, old, new) != old); - return old; -} - -uint16_t -nand_and_fetch_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = ~(old & val); - } while (atomic_cas_16(addr, old, new) != old); - return new; -} diff --git a/common/lib/libc/atomic/atomic_nand_32_cas.c b/common/lib/libc/atomic/atomic_nand_32_cas.c deleted file mode 100644 index 558ff1e30..000000000 --- a/common/lib/libc/atomic/atomic_nand_32_cas.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: atomic_nand_32_cas.c,v 1.1 2014/02/21 10:52:50 martin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -uint32_t fetch_and_nand_4(volatile uint32_t *, uint32_t, ...) - asm("__sync_fetch_and_nand_4"); -uint32_t nand_and_fetch_4(volatile uint32_t *, uint32_t, ...) - asm("__sync_nand_and_fetch_4"); - -uint32_t -fetch_and_nand_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = ~(old & val); - } while (atomic_cas_32(addr, old, new) != old); - return old; -} - -uint32_t -nand_and_fetch_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = ~(old & val); - } while (atomic_cas_32(addr, old, new) != old); - return new; -} diff --git a/common/lib/libc/atomic/atomic_nand_64_cas.c b/common/lib/libc/atomic/atomic_nand_64_cas.c deleted file mode 100644 index 8d79985fd..000000000 --- a/common/lib/libc/atomic/atomic_nand_64_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_nand_64_cas.c,v 1.2 2014/02/18 13:21:04 martin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t fetch_and_nand_8(volatile uint64_t *, uint64_t, ...) - asm("__sync_fetch_and_nand_8"); -uint64_t nand_and_fetch_8(volatile uint64_t *, uint64_t, ...) - asm("__sync_nand_and_fetch_8"); - -uint64_t -fetch_and_nand_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = ~(old & val); - } while (atomic_cas_64(addr, old, new) != old); - return old; -} - -uint64_t -nand_and_fetch_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = ~(old & val); - } while (atomic_cas_64(addr, old, new) != old); - return new; -} - -#endif diff --git a/common/lib/libc/atomic/atomic_nand_8_cas.c b/common/lib/libc/atomic/atomic_nand_8_cas.c deleted file mode 100644 index 15358cea6..000000000 --- a/common/lib/libc/atomic/atomic_nand_8_cas.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_nand_8_cas.c,v 1.2 2014/02/21 16:06:48 martin Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint8_t fetch_and_nand_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_fetch_and_nand_1"); -uint8_t nand_and_fetch_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_nand_and_fetch_1"); - -uint8_t -fetch_and_nand_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = ~(old & val); - } while (atomic_cas_8(addr, old, new) != old); - return old; -} - -uint8_t -nand_and_fetch_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = ~(old & val); - } while (atomic_cas_8(addr, old, new) != old); - return new; -} diff --git a/common/lib/libc/atomic/atomic_op_namespace.h b/common/lib/libc/atomic/atomic_op_namespace.h deleted file mode 100644 index 45789143e..000000000 --- a/common/lib/libc/atomic/atomic_op_namespace.h +++ /dev/null @@ -1,139 +0,0 @@ -/* $NetBSD: atomic_op_namespace.h,v 1.7 2014/10/13 07:31:12 martin Exp $ */ - -/*- - * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _ATOMIC_OP_NAMESPACE_H_ -#define _ATOMIC_OP_NAMESPACE_H_ - -#include - -#if !defined(__lint__) - -#define atomic_add_32 _atomic_add_32 -#define atomic_add_int _atomic_add_int -#define atomic_add_long _atomic_add_long -#define atomic_add_ptr _atomic_add_ptr -#define atomic_add_64 _atomic_add_64 - -#define atomic_add_32_nv _atomic_add_32_nv -#define atomic_add_int_nv _atomic_add_int_nv -#define atomic_add_long_nv _atomic_add_long_nv -#define atomic_add_ptr_nv _atomic_add_ptr_nv -#define atomic_add_64_nv _atomic_add_64_nv - -#define atomic_and_32 _atomic_and_32 -#define atomic_and_uint _atomic_and_uint -#define atomic_and_ulong _atomic_and_ulong -#define atomic_and_64 _atomic_and_64 - -#define atomic_and_32_nv _atomic_and_32_nv -#define atomic_and_uint_nv _atomic_and_uint_nv -#define atomic_and_ulong_nv _atomic_and_ulong_nv -#define atomic_and_64_nv _atomic_and_64_nv -#define atomic_and_16_nv _atomic_and_16_nv -#define atomic_and_8_nv _atomic_and_8_nv - -#define atomic_or_32 _atomic_or_32 -#define atomic_or_uint _atomic_or_uint -#define atomic_or_ulong _atomic_or_ulong -#define atomic_or_64 _atomic_or_64 - -#define atomic_or_32_nv _atomic_or_32_nv -#define atomic_or_uint_nv _atomic_or_uint_nv -#define atomic_or_ulong_nv _atomic_or_ulong_nv -#define atomic_or_64_nv _atomic_or_64_nv - -#define atomic_cas_32 _atomic_cas_32 -#define atomic_cas_uint _atomic_cas_uint -#define atomic_cas_ulong _atomic_cas_ulong -#define atomic_cas_ptr _atomic_cas_ptr -#define atomic_cas_64 _atomic_cas_64 -#define atomic_cas_16 _atomic_cas_16 -#define atomic_cas_8 _atomic_cas_8 - -#define atomic_cas_32_ni _atomic_cas_32_ni -#define atomic_cas_uint_ni _atomic_cas_uint_ni -#define atomic_cas_ulong_ni _atomic_cas_ulong_ni -#define atomic_cas_ptr_ni _atomic_cas_ptr_ni -#define atomic_cas_64_ni _atomic_cas_64_ni - -#define atomic_swap_32 _atomic_swap_32 -#define atomic_swap_uint _atomic_swap_uint -#define atomic_swap_ulong _atomic_swap_ulong -#define atomic_swap_ptr _atomic_swap_ptr -#define atomic_swap_64 _atomic_swap_64 - -#define atomic_dec_32 _atomic_dec_32 -#define atomic_dec_uint _atomic_dec_uint -#define atomic_dec_ulong _atomic_dec_ulong -#define atomic_dec_ptr _atomic_dec_ptr -#define atomic_dec_64 _atomic_dec_64 - -#define atomic_dec_32_nv _atomic_dec_32_nv -#define atomic_dec_uint_nv _atomic_dec_uint_nv -#define atomic_dec_ptr_nv _atomic_dec_ptr_nv -#define atomic_dec_64_nv _atomic_dec_64_nv - -#define atomic_inc_32 _atomic_inc_32 -#define atomic_inc_uint _atomic_inc_uint -#define atomic_inc_ulong _atomic_inc_ulong -#define atomic_inc_ptr _atomic_inc_ptr -#define atomic_inc_64 _atomic_inc_64 - -#define atomic_inc_32_nv _atomic_inc_32_nv -#define atomic_inc_uint_nv _atomic_inc_uint_nv -#define atomic_inc_ptr_nv _atomic_inc_ptr_nv -#define atomic_inc_64_nv _atomic_inc_64_nv - -#define membar_enter _membar_enter -#define membar_exit _membar_exit -#define membar_producer _membar_producer -#define membar_consumer _membar_consumer -#define membar_sync _membar_sync - -#endif /* __lint__ */ - -#if defined(_KERNEL) -#define atomic_op_alias(a,s) __strong_alias(a,s) -#ifdef _HARDKERNEL -#define crt_alias(a,s) __strong_alias(a,s) -#endif -#else -#define atomic_op_alias(a,s) __weak_alias(a,s) -#ifdef _LIBC -#define crt_alias(a,s) __strong_alias(a,s) -#endif -#endif /* _KERNEL */ - -#ifndef crt_alias -#define crt_alias(a,s) -#endif - -#endif /* _ATOMIC_OP_NAMESPACE_H_ */ diff --git a/common/lib/libc/atomic/atomic_or_16_cas.c b/common/lib/libc/atomic/atomic_or_16_cas.c deleted file mode 100644 index 260c1a57c..000000000 --- a/common/lib/libc/atomic/atomic_or_16_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_or_16_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint16_t fetch_and_or_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_fetch_and_or_2"); -uint16_t or_and_fetch_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_or_and_fetch_2"); - -uint16_t -fetch_and_or_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old | val; - } while (atomic_cas_16(addr, old, new) != old); - return old; -} - -uint16_t -or_and_fetch_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old | val; - } while (atomic_cas_16(addr, old, new) != old); - return old; -} - -__strong_alias(__atomic_fetch_or_2,__sync_fetch_and_or_2) diff --git a/common/lib/libc/atomic/atomic_or_32_cas.c b/common/lib/libc/atomic/atomic_or_32_cas.c deleted file mode 100644 index da191f2c6..000000000 --- a/common/lib/libc/atomic/atomic_or_32_cas.c +++ /dev/null @@ -1,73 +0,0 @@ -/* $NetBSD: atomic_or_32_cas.c,v 1.10 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t fetch_and_or_4(volatile uint32_t *, uint32_t, ...) -#if defined(_LIBC) || defined(_HARDKERNEL) - asm("__sync_fetch_and_or_4"); /* C runtime internal */ -#else - ; -#endif - -uint32_t -fetch_and_or_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = old | val; - } while (atomic_cas_32(addr, old, new) != old); - return old; -} - -void -atomic_or_32(volatile uint32_t *addr, uint32_t val) -{ - (void) fetch_and_or_4(addr, val); -} - -__strong_alias(__atomic_fetch_or_4,__sync_fetch_and_or_4) - -#undef atomic_or_32 -atomic_op_alias(atomic_or_32,_atomic_or_32) - -#undef atomic_or_uint -atomic_op_alias(atomic_or_uint,_atomic_or_32) -__strong_alias(_atomic_or_uint,_atomic_or_32) -#if !defined(_LP64) -#undef atomic_or_ulong -atomic_op_alias(atomic_or_ulong,_atomic_or_32) -__strong_alias(_atomic_or_ulong,_atomic_or_32) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_or_32_nv_cas.c b/common/lib/libc/atomic/atomic_or_32_nv_cas.c deleted file mode 100644 index da66deb19..000000000 --- a/common/lib/libc/atomic/atomic_or_32_nv_cas.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: atomic_or_32_nv_cas.c,v 1.6 2014/02/22 17:08:30 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t -atomic_or_32_nv(volatile uint32_t *addr, uint32_t val) -{ - uint32_t old, new; - - do { - old = *addr; - new = old | val; - } while (atomic_cas_32(addr, old, new) != old); - - return (new); -} - -#undef atomic_or_32_nv -atomic_op_alias(atomic_or_32_nv,_atomic_or_32_nv) -crt_alias(__sync_or_and_fetch_4,_atomic_or_32_nv) - -#undef atomic_or_uint_nv -atomic_op_alias(atomic_or_uint_nv,_atomic_or_32_nv) -__strong_alias(_atomic_or_uint_nv,_atomic_or_32_nv) -#if !defined(_LP64) -#undef atomic_or_ulong_nv -atomic_op_alias(atomic_or_ulong_nv,_atomic_or_32_nv) -__strong_alias(_atomic_or_ulong_nv,_atomic_or_32_nv) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_or_64_cas.c b/common/lib/libc/atomic/atomic_or_64_cas.c deleted file mode 100644 index 22947b9e5..000000000 --- a/common/lib/libc/atomic/atomic_or_64_cas.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: atomic_or_64_cas.c,v 1.10 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t fetch_and_or_8(volatile uint64_t *addr, uint64_t val, ...) - asm("__sync_fetch_and_or_8"); - -uint64_t -fetch_and_or_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = old | val; - } while (atomic_cas_64(addr, old, new) != old); - return old; -} - -void -atomic_or_64(volatile uint64_t *addr, uint64_t val) -{ - (void) fetch_and_or_8(addr, val); -} - -__strong_alias(__atomic_fetch_or_8,__sync_fetch_and_or_8) - -#undef atomic_or_64 -atomic_op_alias(atomic_or_64,_atomic_or_64) - -#if defined(_LP64) -#undef atomic_or_ulong -atomic_op_alias(atomic_or_ulong,_atomic_or_64) -__strong_alias(_atomic_or_ulong,_atomic_or_64) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_or_64_nv_cas.c b/common/lib/libc/atomic/atomic_or_64_nv_cas.c deleted file mode 100644 index b9c00d677..000000000 --- a/common/lib/libc/atomic/atomic_or_64_nv_cas.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: atomic_or_64_nv_cas.c,v 1.7 2014/02/22 17:08:30 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t -atomic_or_64_nv(volatile uint64_t *addr, uint64_t val) -{ - uint64_t old, new; - - do { - old = *addr; - new = old | val; - } while (atomic_cas_64(addr, old, new) != old); - - return (new); -} - -#undef atomic_or_64_nv -atomic_op_alias(atomic_or_64_nv,_atomic_or_64_nv) -crt_alias(__sync_or_and_fetch_8,_atomic_or_64_nv) - -#if defined(_LP64) -#undef atomic_or_ulong_nv -atomic_op_alias(atomic_or_ulong_nv,_atomic_or_64_nv) -__strong_alias(_atomic_or_ulong_nv,_atomic_or_64_nv) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_or_8_cas.c b/common/lib/libc/atomic/atomic_or_8_cas.c deleted file mode 100644 index 27e1e91fc..000000000 --- a/common/lib/libc/atomic/atomic_or_8_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_or_8_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint8_t fetch_and_or_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_fetch_and_or_1"); -uint8_t or_and_fetch_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_or_and_fetch_1"); - -uint8_t -fetch_and_or_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old | val; - } while (atomic_cas_8(addr, old, new) != old); - return old; -} - -uint8_t -or_and_fetch_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old | val; - } while (atomic_cas_8(addr, old, new) != old); - return old; -} - -__strong_alias(__atomic_fetch_or_1,__sync_fetch_and_or_1) diff --git a/common/lib/libc/atomic/atomic_store.c b/common/lib/libc/atomic/atomic_store.c deleted file mode 100644 index e1afddb98..000000000 --- a/common/lib/libc/atomic/atomic_store.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: atomic_store.c,v 1.2 2014/07/06 01:19:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: atomic_store.c,v 1.2 2014/07/06 01:19:45 joerg Exp $"); - -#include "atomic_op_namespace.h" - -#include -#include - -#define atomic_store_n(n,b) \ -void __atomic_store_ ## n(volatile uint ## b ## _t *, uint ## b ## _t, int); \ -void \ -__atomic_store_ ## n(volatile uint ## b ## _t *ptr, uint ## b ## _t val, \ - int memmodel) \ -{ \ - membar_enter(); \ - *ptr = val; \ - membar_exit(); \ -} - -atomic_store_n(1, 8) -atomic_store_n(2, 16) -atomic_store_n(4, 32) -#ifdef __HAVE_ATOMIC_CAS_64_UP -atomic_store_n(8, 64) -#endif diff --git a/common/lib/libc/atomic/atomic_sub_16_cas.c b/common/lib/libc/atomic/atomic_sub_16_cas.c deleted file mode 100644 index 217f554c6..000000000 --- a/common/lib/libc/atomic/atomic_sub_16_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_sub_16_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint16_t fetch_and_sub_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_fetch_and_sub_2"); -uint16_t sub_and_fetch_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_sub_and_fetch_2"); - -uint16_t -fetch_and_sub_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old - val; - } while (atomic_cas_16(addr, old, new) != old); - return old; -} - -uint16_t -sub_and_fetch_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old - val; - } while (atomic_cas_16(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_sub_2,__sync_fetch_and_sub_2) diff --git a/common/lib/libc/atomic/atomic_sub_32_cas.c b/common/lib/libc/atomic/atomic_sub_32_cas.c deleted file mode 100644 index 13611e775..000000000 --- a/common/lib/libc/atomic/atomic_sub_32_cas.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_sub_32_cas.c,v 1.2 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -uint32_t fetch_and_sub_4(volatile uint32_t *, uint32_t, ...) - asm("__sync_fetch_and_sub_4"); -uint32_t sub_and_fetch_4(volatile uint32_t *, uint32_t, ...) - asm("__sync_sub_and_fetch_4"); - -uint32_t -fetch_and_sub_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = old - val; - } while (atomic_cas_32(addr, old, new) != old); - return old; -} - -uint32_t -sub_and_fetch_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = old - val; - } while (atomic_cas_32(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_sub_4,__sync_fetch_and_sub_4) diff --git a/common/lib/libc/atomic/atomic_sub_64_cas.c b/common/lib/libc/atomic/atomic_sub_64_cas.c deleted file mode 100644 index 656ae81e2..000000000 --- a/common/lib/libc/atomic/atomic_sub_64_cas.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: atomic_sub_64_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t fetch_and_sub_8(volatile uint64_t *, uint64_t, ...) - asm("__sync_fetch_and_sub_8"); -uint64_t sub_and_fetch_8(volatile uint64_t *, uint64_t, ...) - asm("__sync_sub_and_fetch_8"); - -uint64_t -fetch_and_sub_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = old - val; - } while (atomic_cas_64(addr, old, new) != old); - return old; -} - -uint64_t -sub_and_fetch_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = old - val; - } while (atomic_cas_64(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_sub_8,__sync_fetch_and_sub_8) - -#endif diff --git a/common/lib/libc/atomic/atomic_sub_8_cas.c b/common/lib/libc/atomic/atomic_sub_8_cas.c deleted file mode 100644 index d60017211..000000000 --- a/common/lib/libc/atomic/atomic_sub_8_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_sub_8_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint8_t fetch_and_sub_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_fetch_and_sub_1"); -uint8_t sub_and_fetch_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_sub_and_fetch_1"); - -uint8_t -fetch_and_sub_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old - val; - } while (atomic_cas_8(addr, old, new) != old); - return old; -} - -uint8_t -sub_and_fetch_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old - val; - } while (atomic_cas_8(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_sub_1,__sync_fetch_and_sub_1) diff --git a/common/lib/libc/atomic/atomic_swap_16_cas.c b/common/lib/libc/atomic/atomic_swap_16_cas.c deleted file mode 100644 index 0091fd475..000000000 --- a/common/lib/libc/atomic/atomic_swap_16_cas.c +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: atomic_swap_16_cas.c,v 1.3 2014/06/28 20:18:55 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint16_t -atomic_swap_16(volatile uint16_t *addr, uint16_t new) - asm("__sync_lock_test_and_set_2"); - -uint16_t -atomic_swap_16(volatile uint16_t *addr, uint16_t new) -{ - uint16_t old; - - do { - old = *addr; - } while (atomic_cas_16(addr, old, new) != old); - - return old; -} - -crt_alias(__atomic_exchange_2,__sync_lock_test_and_set_2) diff --git a/common/lib/libc/atomic/atomic_swap_32_cas.c b/common/lib/libc/atomic/atomic_swap_32_cas.c deleted file mode 100644 index a4bdb7485..000000000 --- a/common/lib/libc/atomic/atomic_swap_32_cas.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_swap_32_cas.c,v 1.7 2014/06/28 20:18:55 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint32_t -atomic_swap_32(volatile uint32_t *addr, uint32_t new) -{ - uint32_t old; - - do { - old = *addr; - } while (atomic_cas_32(addr, old, new) != old); - - return (old); -} - -crt_alias(__atomic_exchange_4,_atomic_swap_32) - -#undef atomic_swap_32 -atomic_op_alias(atomic_swap_32,_atomic_swap_32) -#undef atomic_swap_uint -atomic_op_alias(atomic_swap_uint,_atomic_swap_32) -__strong_alias(_atomic_swap_uint,_atomic_swap_32) -crt_alias(__sync_lock_test_and_set_4,_atomic_swap_32) -#if !defined(_LP64) -#undef atomic_swap_ulong -atomic_op_alias(atomic_swap_ulong,_atomic_swap_32) -__strong_alias(_atomic_swap_ulong,_atomic_swap_32) -#undef atomic_swap_ptr -atomic_op_alias(atomic_swap_ptr,_atomic_swap_32) -__strong_alias(_atomic_swap_ptr,_atomic_swap_32) -#endif /* _LP64 */ diff --git a/common/lib/libc/atomic/atomic_swap_64_cas.c b/common/lib/libc/atomic/atomic_swap_64_cas.c deleted file mode 100644 index 047018b1b..000000000 --- a/common/lib/libc/atomic/atomic_swap_64_cas.c +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: atomic_swap_64_cas.c,v 1.9 2014/06/28 20:18:55 joerg Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t -atomic_swap_64(volatile uint64_t *addr, uint64_t new) -{ - uint64_t old; - - do { - old = *addr; - } while (atomic_cas_64(addr, old, new) != old); - - return (old); -} - -crt_alias(__atomic_exchange_8,_atomic_swap_8) - -#undef atomic_swap_64 -atomic_op_alias(atomic_swap_64,_atomic_swap_64) -crt_alias(__sync_lock_test_and_set_8,_atomic_swap_64) -#if defined(_LP64) -#undef atomic_swap_ulong -atomic_op_alias(atomic_swap_ulong,_atomic_swap_64) -__strong_alias(_atomic_swap_ulong,_atomic_swap_64) -#undef atomic_swap_ptr -atomic_op_alias(atomic_swap_ptr,_atomic_swap_64) -__strong_alias(_atomic_swap_ptr,_atomic_swap_64) -#endif /* _LP64 */ - -#endif diff --git a/common/lib/libc/atomic/atomic_swap_8_cas.c b/common/lib/libc/atomic/atomic_swap_8_cas.c deleted file mode 100644 index 63427c7ad..000000000 --- a/common/lib/libc/atomic/atomic_swap_8_cas.c +++ /dev/null @@ -1,52 +0,0 @@ -/* $NetBSD: atomic_swap_8_cas.c,v 1.3 2014/06/28 20:18:55 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint8_t -atomic_swap_8(volatile uint8_t *addr, uint8_t new) - asm("__sync_lock_test_and_set_1"); - -uint8_t -atomic_swap_8(volatile uint8_t *addr, uint8_t new) -{ - uint8_t old; - - do { - old = *addr; - } while (atomic_cas_8(addr, old, new) != old); - - return old; -} - -crt_alias(__atomic_exchange_1,__sync_lock_test_and_set_1) diff --git a/common/lib/libc/atomic/atomic_xor_16_cas.c b/common/lib/libc/atomic/atomic_xor_16_cas.c deleted file mode 100644 index a872cb44f..000000000 --- a/common/lib/libc/atomic/atomic_xor_16_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_xor_16_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint16_t fetch_and_xor_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_fetch_and_xor_2"); -uint16_t xor_and_fetch_2(volatile uint16_t *, uint16_t, ...) - asm("__sync_xor_and_fetch_2"); - -uint16_t -fetch_and_xor_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old ^ val; - } while (atomic_cas_16(addr, old, new) != old); - return old; -} - -uint16_t -xor_and_fetch_2(volatile uint16_t *addr, uint16_t val, ...) -{ - uint16_t old, new; - - do { - old = *addr; - new = old ^ val; - } while (atomic_cas_16(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_xor_2,__sync_fetch_and_xor_2) diff --git a/common/lib/libc/atomic/atomic_xor_32_cas.c b/common/lib/libc/atomic/atomic_xor_32_cas.c deleted file mode 100644 index a58088194..000000000 --- a/common/lib/libc/atomic/atomic_xor_32_cas.c +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: atomic_xor_32_cas.c,v 1.2 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -uint32_t fetch_and_xor_4(volatile uint32_t *, uint32_t, ...) - asm("__sync_fetch_and_xor_4"); -uint32_t xor_and_fetch_4(volatile uint32_t *, uint32_t, ...) - asm("__sync_xor_and_fetch_4"); - -uint32_t -fetch_and_xor_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = old ^ val; - } while (atomic_cas_32(addr, old, new) != old); - return old; -} - -uint32_t -xor_and_fetch_4(volatile uint32_t *addr, uint32_t val, ...) -{ - uint32_t old, new; - - do { - old = *addr; - new = old ^ val; - } while (atomic_cas_32(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_xor_4,__sync_fetch_and_xor_4) diff --git a/common/lib/libc/atomic/atomic_xor_64_cas.c b/common/lib/libc/atomic/atomic_xor_64_cas.c deleted file mode 100644 index c83a91105..000000000 --- a/common/lib/libc/atomic/atomic_xor_64_cas.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: atomic_xor_64_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include - -#ifdef __HAVE_ATOMIC64_OPS - -uint64_t fetch_and_xor_8(volatile uint64_t *, uint64_t, ...) - asm("__sync_fetch_and_xor_8"); -uint64_t xor_and_fetch_8(volatile uint64_t *, uint64_t, ...) - asm("__sync_xor_and_fetch_8"); - -uint64_t -fetch_and_xor_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = old ^ val; - } while (atomic_cas_64(addr, old, new) != old); - return old; -} - -uint64_t -xor_and_fetch_8(volatile uint64_t *addr, uint64_t val, ...) -{ - uint64_t old, new; - - do { - old = *addr; - new = old ^ val; - } while (atomic_cas_64(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_xor_8,__sync_fetch_and_xor_8) - -#endif diff --git a/common/lib/libc/atomic/atomic_xor_8_cas.c b/common/lib/libc/atomic/atomic_xor_8_cas.c deleted file mode 100644 index ce08110b4..000000000 --- a/common/lib/libc/atomic/atomic_xor_8_cas.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: atomic_xor_8_cas.c,v 1.3 2014/06/23 21:53:45 joerg Exp $ */ - -/*- - * Copyright (c) 2014 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -uint8_t fetch_and_xor_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_fetch_and_xor_1"); -uint8_t xor_and_fetch_1(volatile uint8_t *, uint8_t, ...) - asm("__sync_xor_and_fetch_1"); - -uint8_t -fetch_and_xor_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old ^ val; - } while (atomic_cas_8(addr, old, new) != old); - return old; -} - -uint8_t -xor_and_fetch_1(volatile uint8_t *addr, uint8_t val, ...) -{ - uint8_t old, new; - - do { - old = *addr; - new = old ^ val; - } while (atomic_cas_8(addr, old, new) != old); - return new; -} - -__strong_alias(__atomic_fetch_xor_1,__sync_fetch_and_xor_1) diff --git a/common/lib/libc/atomic/membar_ops_nop.c b/common/lib/libc/atomic/membar_ops_nop.c deleted file mode 100644 index 1d71089ed..000000000 --- a/common/lib/libc/atomic/membar_ops_nop.c +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: membar_ops_nop.c,v 1.7 2014/02/22 17:08:30 martin Exp $ */ - -/*- - * Copyright (c) 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "atomic_op_namespace.h" - -#include - -void -membar_sync(void) -{ - - /* nothing */ -} - -#undef membar_enter -atomic_op_alias(membar_enter,_membar_sync) -__strong_alias(_membar_enter,_membar_sync) -#undef membar_exit -atomic_op_alias(membar_exit,_membar_sync) -__strong_alias(_membar_exit,_membar_sync) -#undef membar_producer -atomic_op_alias(membar_producer,_membar_sync) -__strong_alias(_membar_producer,_membar_sync) -#undef membar_consumer -atomic_op_alias(membar_consumer,_membar_sync) -__strong_alias(_membar_consumer,_membar_sync) -#undef membar_sync -atomic_op_alias(membar_sync,_membar_sync) -crt_alias(__sync_synchronize,_membar_sync) diff --git a/common/lib/libc/cdb/cdbr.c b/common/lib/libc/cdb/cdbr.c deleted file mode 100644 index 9dcdbd0e3..000000000 --- a/common/lib/libc/cdb/cdbr.c +++ /dev/null @@ -1,313 +0,0 @@ -/* $NetBSD: cdbr.c,v 1.1 2013/12/11 01:24:08 joerg Exp $ */ -/*- - * Copyright (c) 2010 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -__RCSID("$NetBSD: cdbr.c,v 1.1 2013/12/11 01:24:08 joerg Exp $"); - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include "namespace.h" -#endif - -#if !HAVE_NBTOOL_CONFIG_H -#include -#endif -#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H -#include -#endif - -#if defined(_KERNEL) || defined(_STANDALONE) -#include -#include -#include -#include -#define SET_ERRNO(val) -#define malloc(size) kmem_alloc(size, KM_SLEEP) -#define free(ptr) kmem_free(ptr, sizeof(struct cdbr)) -#else -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#define SET_ERRNO(val) errno = (val) -#endif - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#ifdef __weak_alias -__weak_alias(cdbr_close,_cdbr_close) -__weak_alias(cdbr_find,_cdbr_find) -__weak_alias(cdbr_get,_cdbr_get) -__weak_alias(cdbr_open,_cdbr_open) -__weak_alias(cdbr_open_mem,_cdbr_open_mem) -#endif -#endif - -#if HAVE_NBTOOL_CONFIG_H -#define fast_divide32_prepare(d,m,s1,s2) (void)0 -#define fast_remainder32(v,d,m,s1,s2) (v%d) -#endif - -struct cdbr { - void (*unmap)(void *, void *, size_t); - void *cookie; - uint8_t *mmap_base; - size_t mmap_size; - - uint8_t *hash_base; - uint8_t *offset_base; - uint8_t *data_base; - - uint32_t data_size; - uint32_t entries; - uint32_t entries_index; - uint32_t seed; - - uint8_t offset_size; - uint8_t index_size; - - uint32_t entries_m; - uint32_t entries_index_m; - uint8_t entries_s1, entries_s2; - uint8_t entries_index_s1, entries_index_s2; -}; - -#if !defined(_KERNEL) && !defined(_STANDALONE) -static void -cdbr_unmap(void *cookie __unused, void *base, size_t size) -{ - munmap(base, size); -} - -/* ARGSUSED */ -struct cdbr * -cdbr_open(const char *path, int flags) -{ - void *base; - size_t size; - int fd; - struct cdbr *cdbr; - struct stat sb; - - if ((fd = open(path, O_RDONLY)) == -1) - return NULL; - if (fstat(fd, &sb) == -1) { - close(fd); - return NULL; - } - - if (sb.st_size >= SSIZE_MAX) { - close(fd); - SET_ERRNO(EINVAL); - return NULL; - } - - - size = (size_t)sb.st_size; - base = mmap(NULL, size, PROT_READ, MAP_FILE|MAP_SHARED, fd, 0); - close(fd); - - if (base == MAP_FAILED) - return NULL; - - cdbr = cdbr_open_mem(base, size, flags, cdbr_unmap, NULL); - if (cdbr == NULL) - munmap(base, size); - return cdbr; -} -#endif - -struct cdbr * -cdbr_open_mem(void *base, size_t size, int flags, - void (*unmap)(void *, void *, size_t), void *cookie) -{ - struct cdbr *cdbr; - uint8_t *buf = base; - if (size < 40 || memcmp(buf, "NBCDB\n\0\001", 8)) { - SET_ERRNO(EINVAL); - return NULL; - } - - cdbr = malloc(sizeof(*cdbr)); - cdbr->unmap = unmap; - cdbr->cookie = cookie; - - cdbr->data_size = le32dec(buf + 24); - cdbr->entries = le32dec(buf + 28); - cdbr->entries_index = le32dec(buf + 32); - cdbr->seed = le32dec(buf + 36); - - if (cdbr->data_size < 0x100) - cdbr->offset_size = 1; - else if (cdbr->data_size < 0x10000) - cdbr->offset_size = 2; - else - cdbr->offset_size = 4; - - if (cdbr->entries_index < 0x100) - cdbr->index_size = 1; - else if (cdbr->entries_index < 0x10000) - cdbr->index_size = 2; - else - cdbr->index_size = 4; - - cdbr->mmap_base = base; - cdbr->mmap_size = size; - - cdbr->hash_base = cdbr->mmap_base + 40; - cdbr->offset_base = cdbr->hash_base + cdbr->entries_index * cdbr->index_size; - if (cdbr->entries_index * cdbr->index_size % cdbr->offset_size) - cdbr->offset_base += cdbr->offset_size - - cdbr->entries_index * cdbr->index_size % cdbr->offset_size; - cdbr->data_base = cdbr->offset_base + (cdbr->entries + 1) * cdbr->offset_size; - - if (cdbr->hash_base < cdbr->mmap_base || - cdbr->offset_base < cdbr->mmap_base || - cdbr->data_base < cdbr->mmap_base || - cdbr->data_base + cdbr->data_size < cdbr->mmap_base || - cdbr->data_base + cdbr->data_size > - cdbr->mmap_base + cdbr->mmap_size) { - SET_ERRNO(EINVAL); - free(cdbr); - return NULL; - } - - if (cdbr->entries) { - fast_divide32_prepare(cdbr->entries, &cdbr->entries_m, - &cdbr->entries_s1, &cdbr->entries_s2); - } - if (cdbr->entries_index) { - fast_divide32_prepare(cdbr->entries_index, - &cdbr->entries_index_m, - &cdbr->entries_index_s1, &cdbr->entries_index_s2); - } - - return cdbr; -} - -static inline uint32_t -get_uintX(const uint8_t *addr, uint32_t idx, int size) -{ - addr += idx * size; - - if (size == 4) - return /* LINTED */le32toh(*(const uint32_t *)addr); - else if (size == 2) - return /* LINTED */le16toh(*(const uint16_t *)addr); - else - return *addr; -} - -uint32_t -cdbr_entries(struct cdbr *cdbr) -{ - - return cdbr->entries; -} - -int -cdbr_get(struct cdbr *cdbr, uint32_t idx, const void **data, size_t *data_len) -{ - uint32_t start, end; - - if (idx >= cdbr->entries) { - SET_ERRNO(EINVAL); - return -1; - } - - start = get_uintX(cdbr->offset_base, idx, cdbr->offset_size); - end = get_uintX(cdbr->offset_base, idx + 1, cdbr->offset_size); - - if (start > end) { - SET_ERRNO(EIO); - return -1; - } - - if (end > cdbr->data_size) { - SET_ERRNO(EIO); - return -1; - } - - *data = cdbr->data_base + start; - *data_len = end - start; - - return 0; -} - -int -cdbr_find(struct cdbr *cdbr, const void *key, size_t key_len, - const void **data, size_t *data_len) -{ - uint32_t hashes[3], idx; - - if (cdbr->entries_index == 0) { - SET_ERRNO(EINVAL); - return -1; - } - - mi_vector_hash(key, key_len, cdbr->seed, hashes); - - hashes[0] = fast_remainder32(hashes[0], cdbr->entries_index, - cdbr->entries_index_m, cdbr->entries_index_s1, - cdbr->entries_index_s2); - hashes[1] = fast_remainder32(hashes[1], cdbr->entries_index, - cdbr->entries_index_m, cdbr->entries_index_s1, - cdbr->entries_index_s2); - hashes[2] = fast_remainder32(hashes[2], cdbr->entries_index, - cdbr->entries_index_m, cdbr->entries_index_s1, - cdbr->entries_index_s2); - - idx = get_uintX(cdbr->hash_base, hashes[0], cdbr->index_size); - idx += get_uintX(cdbr->hash_base, hashes[1], cdbr->index_size); - idx += get_uintX(cdbr->hash_base, hashes[2], cdbr->index_size); - - return cdbr_get(cdbr, fast_remainder32(idx, cdbr->entries, - cdbr->entries_m, cdbr->entries_s1, cdbr->entries_s2), data, - data_len); -} - -void -cdbr_close(struct cdbr *cdbr) -{ - if (cdbr->unmap) - (*cdbr->unmap)(cdbr->cookie, cdbr->mmap_base, cdbr->mmap_size); - free(cdbr); -} diff --git a/common/lib/libc/gen/bswap16.c b/common/lib/libc/gen/bswap16.c deleted file mode 100644 index 99133f166..000000000 --- a/common/lib/libc/gen/bswap16.c +++ /dev/null @@ -1,23 +0,0 @@ -/* $NetBSD: bswap16.c,v 1.4 2012/03/17 20:57:35 martin Exp $ */ - -/* - * Written by Manuel Bouyer . - * Public domain. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: bswap16.c,v 1.4 2012/03/17 20:57:35 martin Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -#undef bswap16 - -uint16_t -bswap16(uint16_t x) -{ - /*LINTED*/ - return ((x << 8) & 0xff00) | ((x >> 8) & 0x00ff); -} diff --git a/common/lib/libc/gen/bswap32.c b/common/lib/libc/gen/bswap32.c deleted file mode 100644 index fee64d61c..000000000 --- a/common/lib/libc/gen/bswap32.c +++ /dev/null @@ -1,25 +0,0 @@ -/* $NetBSD: bswap32.c,v 1.3 2011/07/04 21:20:27 joerg Exp $ */ - -/* - * Written by Manuel Bouyer . - * Public domain. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: bswap32.c,v 1.3 2011/07/04 21:20:27 joerg Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -#undef bswap32 - -uint32_t -bswap32(uint32_t x) -{ - return ((x << 24) & 0xff000000 ) | - ((x << 8) & 0x00ff0000 ) | - ((x >> 8) & 0x0000ff00 ) | - ((x >> 24) & 0x000000ff ); -} diff --git a/common/lib/libc/gen/bswap64.c b/common/lib/libc/gen/bswap64.c deleted file mode 100644 index b2decf94d..000000000 --- a/common/lib/libc/gen/bswap64.c +++ /dev/null @@ -1,44 +0,0 @@ -/* $NetBSD: bswap64.c,v 1.3 2009/03/16 05:59:21 cegger Exp $ */ - -/* - * Written by Manuel Bouyer . - * Public domain. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: bswap64.c,v 1.3 2009/03/16 05:59:21 cegger Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -#undef bswap64 - -uint64_t -bswap64(uint64_t x) -{ -#ifdef _LP64 - /* - * Assume we have wide enough registers to do it without touching - * memory. - */ - return ( (x << 56) & 0xff00000000000000UL ) | - ( (x << 40) & 0x00ff000000000000UL ) | - ( (x << 24) & 0x0000ff0000000000UL ) | - ( (x << 8) & 0x000000ff00000000UL ) | - ( (x >> 8) & 0x00000000ff000000UL ) | - ( (x >> 24) & 0x0000000000ff0000UL ) | - ( (x >> 40) & 0x000000000000ff00UL ) | - ( (x >> 56) & 0x00000000000000ffUL ); -#else - /* - * Split the operation in two 32bit steps. - */ - uint32_t tl, th; - - th = bswap32((uint32_t)(x & 0x00000000ffffffffULL)); - tl = bswap32((uint32_t)((x >> 32) & 0x00000000ffffffffULL)); - return ((uint64_t)th << 32) | tl; -#endif -} diff --git a/common/lib/libc/gen/ptree.c b/common/lib/libc/gen/ptree.c deleted file mode 100644 index da1895500..000000000 --- a/common/lib/libc/gen/ptree.c +++ /dev/null @@ -1,1230 +0,0 @@ -/* $NetBSD: ptree.c,v 1.10 2012/10/06 22:15:09 matt Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define _PT_PRIVATE - -#if defined(PTCHECK) && !defined(PTDEBUG) -#define PTDEBUG -#endif - -#if defined(_KERNEL) || defined(_STANDALONE) -#include -#include -#include -#include -__KERNEL_RCSID(0, "$NetBSD: ptree.c,v 1.10 2012/10/06 22:15:09 matt Exp $"); -#else -#include -#include -#include -#include -#include -#ifdef PTDEBUG -#include -#define KASSERT(e) assert(e) -#else -#define KASSERT(e) do { } while (/*CONSTCOND*/ 0) -#endif -__RCSID("$NetBSD: ptree.c,v 1.10 2012/10/06 22:15:09 matt Exp $"); -#endif /* _KERNEL || _STANDALONE */ - -#ifdef _LIBC -#include "namespace.h" -#endif - -#ifdef PTTEST -#include "ptree.h" -#else -#include -#endif - -/* - * This is an implementation of a radix / PATRICIA tree. As in a traditional - * patricia tree, all the data is at the leaves of the tree. An N-value - * tree would have N leaves, N-1 branching nodes, and a root pointer. Each - * branching node would have left(0) and right(1) pointers that either point - * to another branching node or a leaf node. The root pointer would also - * point to either the first branching node or a leaf node. Leaf nodes - * have no need for pointers. - * - * However, allocation for these branching nodes is problematic since the - * allocation could fail. This would cause insertions to fail for reasons - * beyond the user's control. So to prevent this, in this implementation - * each node has two identities: its leaf identity and its branch identity. - * Each is separate from the other. Every branch is tagged as to whether - * it points to a leaf or a branch. This is not an attribute of the object - * but of the pointer to the object. The low bit of the pointer is used as - * the tag to determine whether it points to a leaf or branch identity, with - * branch identities having the low bit set. - * - * A node's branch identity has one rule: when traversing the tree from the - * root to the node's leaf identity, one of the branches traversed will be via - * the node's branch identity. Of course, that has an exception: since to - * store N leaves, you need N-1 branches. That one node whose branch identity - * isn't used is stored as "oddman"-out in the root. - * - * Branching nodes also has a bit offset and a bit length which determines - * which branch slot is used. The bit length can be zero resulting in a - * one-way branch. This happens in two special cases: the root and - * interior mask nodes. - * - * To support longest match first lookups, when a mask node (one that only - * match the first N bits) has children who first N bits match the mask nodes, - * that mask node is converted from being a leaf node to being a one-way - * branch-node. The mask becomes fixed in position in the tree. The mask - * will always be the longest mask match for its descendants (unless they - * traverse an even longer match). - */ - -#define NODETOITEM(pt, ptn) \ - ((void *)((uintptr_t)(ptn) - (pt)->pt_node_offset)) -#define NODETOKEY(pt, ptn) \ - ((void *)((uintptr_t)(ptn) - (pt)->pt_node_offset + pt->pt_key_offset)) -#define ITEMTONODE(pt, ptn) \ - ((pt_node_t *)((uintptr_t)(ptn) + (pt)->pt_node_offset)) - -bool ptree_check(const pt_tree_t *); -#if PTCHECK > 1 -#define PTREE_CHECK(pt) ptree_check(pt) -#else -#define PTREE_CHECK(pt) do { } while (/*CONSTCOND*/ 0) -#endif - -static inline bool -ptree_matchnode(const pt_tree_t *pt, const pt_node_t *target, - const pt_node_t *ptn, pt_bitoff_t max_bitoff, - pt_bitoff_t *bitoff_p, pt_slot_t *slots_p) -{ - return (*pt->pt_ops->ptto_matchnode)(NODETOKEY(pt, target), - (ptn != NULL ? NODETOKEY(pt, ptn) : NULL), - max_bitoff, bitoff_p, slots_p, pt->pt_context); -} - -static inline pt_slot_t -ptree_testnode(const pt_tree_t *pt, const pt_node_t *target, - const pt_node_t *ptn) -{ - const pt_bitlen_t bitlen = PTN_BRANCH_BITLEN(ptn); - if (bitlen == 0) - return PT_SLOT_ROOT; /* mask or root, doesn't matter */ - return (*pt->pt_ops->ptto_testnode)(NODETOKEY(pt, target), - PTN_BRANCH_BITOFF(ptn), bitlen, pt->pt_context); -} - -static inline bool -ptree_matchkey(const pt_tree_t *pt, const void *key, - const pt_node_t *ptn, pt_bitoff_t bitoff, pt_bitlen_t bitlen) -{ - return (*pt->pt_ops->ptto_matchkey)(key, NODETOKEY(pt, ptn), - bitoff, bitlen, pt->pt_context); -} - -static inline pt_slot_t -ptree_testkey(const pt_tree_t *pt, const void *key, const pt_node_t *ptn) -{ - const pt_bitlen_t bitlen = PTN_BRANCH_BITLEN(ptn); - if (bitlen == 0) - return PT_SLOT_ROOT; /* mask or root, doesn't matter */ - return (*pt->pt_ops->ptto_testkey)(key, PTN_BRANCH_BITOFF(ptn), - PTN_BRANCH_BITLEN(ptn), pt->pt_context); -} - -static inline void -ptree_set_position(uintptr_t node, pt_slot_t position) -{ - if (PT_LEAF_P(node)) - PTN_SET_LEAF_POSITION(PT_NODE(node), position); - else - PTN_SET_BRANCH_POSITION(PT_NODE(node), position); -} - -void -ptree_init(pt_tree_t *pt, const pt_tree_ops_t *ops, void *context, - size_t node_offset, size_t key_offset) -{ - memset(pt, 0, sizeof(*pt)); - pt->pt_node_offset = node_offset; - pt->pt_key_offset = key_offset; - pt->pt_context = context; - pt->pt_ops = ops; -} - -typedef struct { - uintptr_t *id_insertp; - pt_node_t *id_parent; - uintptr_t id_node; - pt_slot_t id_parent_slot; - pt_bitoff_t id_bitoff; - pt_slot_t id_slot; -} pt_insertdata_t; - -typedef bool (*pt_insertfunc_t)(pt_tree_t *, pt_node_t *, pt_insertdata_t *); - -/* - * Move a branch identify from src to dst. The leaves don't care since - * nothing for them has changed. - */ -/*ARGSUSED*/ -static uintptr_t -ptree_move_branch(pt_tree_t * const pt, pt_node_t * const dst, - const pt_node_t * const src) -{ - KASSERT(PTN_BRANCH_BITLEN(src) == 1); - /* set branch bitlen and bitoff in one step. */ - dst->ptn_branchdata = src->ptn_branchdata; - PTN_SET_BRANCH_POSITION(dst, PTN_BRANCH_POSITION(src)); - PTN_COPY_BRANCH_SLOTS(dst, src); - return PTN_BRANCH(dst); -} - -#ifndef PTNOMASK -static inline uintptr_t * -ptree_find_branch(pt_tree_t * const pt, uintptr_t branch_node) -{ - pt_node_t * const branch = PT_NODE(branch_node); - pt_node_t *parent; - - for (parent = &pt->pt_rootnode;;) { - uintptr_t *nodep = - &PTN_BRANCH_SLOT(parent, ptree_testnode(pt, branch, parent)); - if (*nodep == branch_node) - return nodep; - if (PT_LEAF_P(*nodep)) - return NULL; - parent = PT_NODE(*nodep); - } -} - -static bool -ptree_insert_leaf_after_mask(pt_tree_t * const pt, pt_node_t * const target, - pt_insertdata_t * const id) -{ - const uintptr_t target_node = PTN_LEAF(target); - const uintptr_t mask_node = id->id_node; - pt_node_t * const mask = PT_NODE(mask_node); - const pt_bitlen_t mask_len = PTN_MASK_BITLEN(mask); - - KASSERT(PT_LEAF_P(mask_node)); - KASSERT(PTN_LEAF_POSITION(mask) == id->id_parent_slot); - KASSERT(mask_len <= id->id_bitoff); - KASSERT(PTN_ISMASK_P(mask)); - KASSERT(!PTN_ISMASK_P(target) || mask_len < PTN_MASK_BITLEN(target)); - - if (mask_node == PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode)) { - KASSERT(id->id_parent != mask); - /* - * Nice, mask was an oddman. So just set the oddman to target. - */ - PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode) = target_node; - } else { - /* - * We need to find out who's pointing to mask's branch - * identity. We know that between root and the leaf identity, - * we must traverse the node's branch identity. - */ - uintptr_t * const mask_nodep = ptree_find_branch(pt, PTN_BRANCH(mask)); - KASSERT(mask_nodep != NULL); - KASSERT(*mask_nodep == PTN_BRANCH(mask)); - KASSERT(PTN_BRANCH_BITLEN(mask) == 1); - - /* - * Alas, mask was used as a branch. Since the mask is becoming - * a one-way branch, we need make target take over mask's - * branching responsibilities. Only then can we change it. - */ - *mask_nodep = ptree_move_branch(pt, target, mask); - - /* - * However, it's possible that mask's parent is itself. If - * that's true, update the insert point to use target since it - * has taken over mask's branching duties. - */ - if (id->id_parent == mask) - id->id_insertp = &PTN_BRANCH_SLOT(target, - id->id_parent_slot); - } - - PTN_SET_BRANCH_BITLEN(mask, 0); - PTN_SET_BRANCH_BITOFF(mask, mask_len); - - PTN_BRANCH_ROOT_SLOT(mask) = target_node; - PTN_BRANCH_ODDMAN_SLOT(mask) = PT_NULL; - PTN_SET_LEAF_POSITION(target, PT_SLOT_ROOT); - PTN_SET_BRANCH_POSITION(mask, id->id_parent_slot); - - /* - * Now that everything is done, to make target visible we need to - * change mask from a leaf to a branch. - */ - *id->id_insertp = PTN_BRANCH(mask); - PTREE_CHECK(pt); - return true; -} - -/*ARGSUSED*/ -static bool -ptree_insert_mask_before_node(pt_tree_t * const pt, pt_node_t * const target, - pt_insertdata_t * const id) -{ - const uintptr_t node = id->id_node; - pt_node_t * const ptn = PT_NODE(node); - const pt_slot_t mask_len = PTN_MASK_BITLEN(target); - const pt_bitlen_t node_mask_len = PTN_MASK_BITLEN(ptn); - - KASSERT(PT_LEAF_P(node) || id->id_parent_slot == PTN_BRANCH_POSITION(ptn)); - KASSERT(PT_BRANCH_P(node) || id->id_parent_slot == PTN_LEAF_POSITION(ptn)); - KASSERT(PTN_ISMASK_P(target)); - - /* - * If the node we are placing ourself in front is a mask with the - * same mask length as us, return failure. - */ - if (PTN_ISMASK_P(ptn) && node_mask_len == mask_len) - return false; - - PTN_SET_BRANCH_BITLEN(target, 0); - PTN_SET_BRANCH_BITOFF(target, mask_len); - - PTN_BRANCH_SLOT(target, PT_SLOT_ROOT) = node; - *id->id_insertp = PTN_BRANCH(target); - - PTN_SET_BRANCH_POSITION(target, id->id_parent_slot); - ptree_set_position(node, PT_SLOT_ROOT); - - PTREE_CHECK(pt); - return true; -} -#endif /* !PTNOMASK */ - -/*ARGSUSED*/ -static bool -ptree_insert_branch_at_node(pt_tree_t * const pt, pt_node_t * const target, - pt_insertdata_t * const id) -{ - const uintptr_t target_node = PTN_LEAF(target); - const uintptr_t node = id->id_node; - const pt_slot_t other_slot = id->id_slot ^ PT_SLOT_OTHER; - - KASSERT(PT_BRANCH_P(node) || id->id_parent_slot == PTN_LEAF_POSITION(PT_NODE(node))); - KASSERT(PT_LEAF_P(node) || id->id_parent_slot == PTN_BRANCH_POSITION(PT_NODE(node))); - KASSERT((node == pt->pt_root) == (id->id_parent == &pt->pt_rootnode)); -#ifndef PTNOMASK - KASSERT(!PTN_ISMASK_P(target) || id->id_bitoff <= PTN_MASK_BITLEN(target)); -#endif - KASSERT(node == pt->pt_root || PTN_BRANCH_BITOFF(id->id_parent) + PTN_BRANCH_BITLEN(id->id_parent) <= id->id_bitoff); - - PTN_SET_BRANCH_BITOFF(target, id->id_bitoff); - PTN_SET_BRANCH_BITLEN(target, 1); - - PTN_BRANCH_SLOT(target, id->id_slot) = target_node; - PTN_BRANCH_SLOT(target, other_slot) = node; - *id->id_insertp = PTN_BRANCH(target); - - PTN_SET_LEAF_POSITION(target, id->id_slot); - ptree_set_position(node, other_slot); - - PTN_SET_BRANCH_POSITION(target, id->id_parent_slot); - PTREE_CHECK(pt); - return true; -} - -static bool -ptree_insert_leaf(pt_tree_t * const pt, pt_node_t * const target, - pt_insertdata_t * const id) -{ - const uintptr_t leaf_node = id->id_node; - pt_node_t * const leaf = PT_NODE(leaf_node); -#ifdef PTNOMASK - const bool inserting_mask = false; - const bool at_mask = false; -#else - const bool inserting_mask = PTN_ISMASK_P(target); - const bool at_mask = PTN_ISMASK_P(leaf); - const pt_bitlen_t leaf_masklen = PTN_MASK_BITLEN(leaf); - const pt_bitlen_t target_masklen = PTN_MASK_BITLEN(target); -#endif - pt_insertfunc_t insertfunc = ptree_insert_branch_at_node; - bool matched; - - /* - * In all likelyhood we are going simply going to insert a branch - * where this leaf is which will point to the old and new leaves. - */ - KASSERT(PT_LEAF_P(leaf_node)); - KASSERT(PTN_LEAF_POSITION(leaf) == id->id_parent_slot); - matched = ptree_matchnode(pt, target, leaf, UINT_MAX, - &id->id_bitoff, &id->id_slot); - if (__predict_false(!inserting_mask)) { - /* - * We aren't inserting a mask nor is the leaf a mask, which - * means we are trying to insert a duplicate leaf. Can't do - * that. - */ - if (!at_mask && matched) - return false; - -#ifndef PTNOMASK - /* - * We are at a mask and the leaf we are about to insert - * is at or beyond the mask, we need to convert the mask - * from a leaf to a one-way branch interior mask. - */ - if (at_mask && id->id_bitoff >= leaf_masklen) - insertfunc = ptree_insert_leaf_after_mask; -#endif /* PTNOMASK */ - } -#ifndef PTNOMASK - else { - /* - * We are inserting a mask. - */ - if (matched) { - /* - * If the leaf isn't a mask, we obviously have to - * insert the new mask before non-mask leaf. If the - * leaf is a mask, and the new node has a LEQ mask - * length it too needs to inserted before leaf (*). - * - * In other cases, we place the new mask as leaf after - * leaf mask. Which mask comes first will be a one-way - * branch interior mask node which has the other mask - * node as a child. - * - * (*) ptree_insert_mask_before_node can detect a - * duplicate mask and return failure if needed. - */ - if (!at_mask || target_masklen <= leaf_masklen) - insertfunc = ptree_insert_mask_before_node; - else - insertfunc = ptree_insert_leaf_after_mask; - } else if (at_mask && id->id_bitoff >= leaf_masklen) { - /* - * If the new mask has a bit offset GEQ than the leaf's - * mask length, convert the left to a one-way branch - * interior mask and make that point to the new [leaf] - * mask. - */ - insertfunc = ptree_insert_leaf_after_mask; - } else { - /* - * The new mask has a bit offset less than the leaf's - * mask length or if the leaf isn't a mask at all, the - * new mask deserves to be its own leaf so we use the - * default insertfunc to do that. - */ - } - } -#endif /* PTNOMASK */ - - return (*insertfunc)(pt, target, id); -} - -static bool -ptree_insert_node_common(pt_tree_t *pt, void *item) -{ - pt_node_t * const target = ITEMTONODE(pt, item); -#ifndef PTNOMASK - const bool inserting_mask = PTN_ISMASK_P(target); - const pt_bitlen_t target_masklen = PTN_MASK_BITLEN(target); -#endif - pt_insertfunc_t insertfunc; - pt_insertdata_t id; - - /* - * If this node already exists in the tree, return failure. - */ - if (target == PT_NODE(pt->pt_root)) - return false; - - /* - * We need a leaf so we can match against. Until we get a leaf - * we having nothing to test against. - */ - if (__predict_false(PT_NULL_P(pt->pt_root))) { - PTN_BRANCH_ROOT_SLOT(&pt->pt_rootnode) = PTN_LEAF(target); - PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode) = PTN_LEAF(target); - PTN_SET_LEAF_POSITION(target, PT_SLOT_ROOT); - PTREE_CHECK(pt); - return true; - } - - id.id_bitoff = 0; - id.id_parent = &pt->pt_rootnode; - id.id_parent_slot = PT_SLOT_ROOT; - id.id_insertp = &PTN_BRANCH_ROOT_SLOT(id.id_parent); - for (;;) { - pt_bitoff_t branch_bitoff; - pt_node_t * const ptn = PT_NODE(*id.id_insertp); - id.id_node = *id.id_insertp; - - /* - * If this node already exists in the tree, return failure. - */ - if (target == ptn) - return false; - - /* - * If we hit a leaf, try to insert target at leaf. We could - * have inlined ptree_insert_leaf here but that would have - * made this routine much harder to understand. Trust the - * compiler to optimize this properly. - */ - if (PT_LEAF_P(id.id_node)) { - KASSERT(PTN_LEAF_POSITION(ptn) == id.id_parent_slot); - insertfunc = ptree_insert_leaf; - break; - } - - /* - * If we aren't a leaf, we must be a branch. Make sure we are - * in the slot we think we are. - */ - KASSERT(PT_BRANCH_P(id.id_node)); - KASSERT(PTN_BRANCH_POSITION(ptn) == id.id_parent_slot); - - /* - * Where is this branch? - */ - branch_bitoff = PTN_BRANCH_BITOFF(ptn); - -#ifndef PTNOMASK - /* - * If this is a one-way mask node, its offset must equal - * its mask's bitlen. - */ - KASSERT(!(PTN_ISMASK_P(ptn) && PTN_BRANCH_BITLEN(ptn) == 0) || PTN_MASK_BITLEN(ptn) == branch_bitoff); - - /* - * If we are inserting a mask, and we know that at this point - * all bits before the current bit offset match both the target - * and the branch. If the target's mask length is LEQ than - * this branch's bit offset, then this is where the mask needs - * to added to the tree. - */ - if (__predict_false(inserting_mask) - && (PTN_ISROOT_P(pt, id.id_parent) - || id.id_bitoff < target_masklen) - && target_masklen <= branch_bitoff) { - /* - * We don't know about the bits (if any) between - * id.id_bitoff and the target's mask length match - * both the target and the branch. If the target's - * mask length is greater than the current bit offset - * make sure the untested bits match both the target - * and the branch. - */ - if (target_masklen == id.id_bitoff - || ptree_matchnode(pt, target, ptn, target_masklen, - &id.id_bitoff, &id.id_slot)) { - /* - * The bits matched, so insert the mask as a - * one-way branch. - */ - insertfunc = ptree_insert_mask_before_node; - break; - } else if (id.id_bitoff < branch_bitoff) { - /* - * They didn't match, so create a normal branch - * because this mask needs to a be a new leaf. - */ - insertfunc = ptree_insert_branch_at_node; - break; - } - } -#endif /* PTNOMASK */ - - /* - * If we are skipping some bits, verify they match the node. - * If they don't match, it means we have a leaf to insert. - * Note that if we are advancing bit by bit, we'll skip - * doing matchnode and walk the tree bit by bit via testnode. - */ - if (id.id_bitoff < branch_bitoff - && !ptree_matchnode(pt, target, ptn, branch_bitoff, - &id.id_bitoff, &id.id_slot)) { - KASSERT(id.id_bitoff < branch_bitoff); - insertfunc = ptree_insert_branch_at_node; - break; - } - - /* - * At this point, all bits before branch_bitoff are known - * to match the target. - */ - KASSERT(id.id_bitoff >= branch_bitoff); - - /* - * Decend the tree one level. - */ - id.id_parent = ptn; - id.id_parent_slot = ptree_testnode(pt, target, id.id_parent); - id.id_bitoff += PTN_BRANCH_BITLEN(id.id_parent); - id.id_insertp = &PTN_BRANCH_SLOT(id.id_parent, id.id_parent_slot); - } - - /* - * Do the actual insertion. - */ - return (*insertfunc)(pt, target, &id); -} - -bool -ptree_insert_node(pt_tree_t *pt, void *item) -{ - pt_node_t * const target = ITEMTONODE(pt, item); - - memset(target, 0, sizeof(*target)); - return ptree_insert_node_common(pt, target); -} - -#ifndef PTNOMASK -bool -ptree_insert_mask_node(pt_tree_t *pt, void *item, pt_bitlen_t mask_len) -{ - pt_node_t * const target = ITEMTONODE(pt, item); - pt_bitoff_t bitoff = mask_len; - pt_slot_t slot; - - memset(target, 0, sizeof(*target)); - KASSERT(mask_len == 0 || (~PT__MASK(PTN_MASK_BITLEN) & mask_len) == 0); - /* - * Only the first bits can be non-zero. - * All other bits must be 0. - */ - if (!ptree_matchnode(pt, target, NULL, UINT_MAX, &bitoff, &slot)) - return false; - PTN_SET_MASK_BITLEN(target, mask_len); - PTN_MARK_MASK(target); - return ptree_insert_node_common(pt, target); -} -#endif /* !PTNOMASH */ - -void * -ptree_find_filtered_node(pt_tree_t *pt, const void *key, pt_filter_t filter, - void *filter_arg) -{ -#ifndef PTNOMASK - pt_node_t *mask = NULL; -#endif - bool at_mask = false; - pt_node_t *ptn, *parent; - pt_bitoff_t bitoff; - pt_slot_t parent_slot; - - if (PT_NULL_P(PTN_BRANCH_ROOT_SLOT(&pt->pt_rootnode))) - return NULL; - - bitoff = 0; - parent = &pt->pt_rootnode; - parent_slot = PT_SLOT_ROOT; - for (;;) { - const uintptr_t node = PTN_BRANCH_SLOT(parent, parent_slot); - const pt_slot_t branch_bitoff = PTN_BRANCH_BITOFF(PT_NODE(node)); - ptn = PT_NODE(node); - - if (PT_LEAF_P(node)) { -#ifndef PTNOMASK - at_mask = PTN_ISMASK_P(ptn); -#endif - break; - } - - if (bitoff < branch_bitoff) { - if (!ptree_matchkey(pt, key, ptn, bitoff, branch_bitoff - bitoff)) { -#ifndef PTNOMASK - if (mask != NULL) - return NODETOITEM(pt, mask); -#endif - return NULL; - } - bitoff = branch_bitoff; - } - -#ifndef PTNOMASK - if (PTN_ISMASK_P(ptn) && PTN_BRANCH_BITLEN(ptn) == 0 - && (!filter - || (*filter)(filter_arg, NODETOITEM(pt, ptn), - PT_FILTER_MASK))) - mask = ptn; -#endif - - parent = ptn; - parent_slot = ptree_testkey(pt, key, parent); - bitoff += PTN_BRANCH_BITLEN(parent); - } - - KASSERT(PTN_ISROOT_P(pt, parent) || PTN_BRANCH_BITOFF(parent) + PTN_BRANCH_BITLEN(parent) == bitoff); - if (!filter || (*filter)(filter_arg, NODETOITEM(pt, ptn), at_mask ? PT_FILTER_MASK : 0)) { -#ifndef PTNOMASK - if (PTN_ISMASK_P(ptn)) { - const pt_bitlen_t mask_len = PTN_MASK_BITLEN(ptn); - if (bitoff == PTN_MASK_BITLEN(ptn)) - return NODETOITEM(pt, ptn); - if (ptree_matchkey(pt, key, ptn, bitoff, mask_len - bitoff)) - return NODETOITEM(pt, ptn); - } else -#endif /* !PTNOMASK */ - if (ptree_matchkey(pt, key, ptn, bitoff, UINT_MAX)) - return NODETOITEM(pt, ptn); - } - -#ifndef PTNOMASK - /* - * By virtue of how the mask was placed in the tree, - * all nodes descended from it will match it. But the bits - * before the mask still need to be checked and since the - * mask was a branch, that was done implicitly. - */ - if (mask != NULL) { - KASSERT(ptree_matchkey(pt, key, mask, 0, PTN_MASK_BITLEN(mask))); - return NODETOITEM(pt, mask); - } -#endif /* !PTNOMASK */ - - /* - * Nothing matched. - */ - return NULL; -} - -void * -ptree_iterate(pt_tree_t *pt, const void *item, pt_direction_t direction) -{ - const pt_node_t * const target = ITEMTONODE(pt, item); - uintptr_t node, next_node; - - if (direction != PT_ASCENDING && direction != PT_DESCENDING) - return NULL; - - node = PTN_BRANCH_ROOT_SLOT(&pt->pt_rootnode); - if (PT_NULL_P(node)) - return NULL; - - if (item == NULL) { - pt_node_t * const ptn = PT_NODE(node); - if (direction == PT_ASCENDING - && PTN_ISMASK_P(ptn) && PTN_BRANCH_BITLEN(ptn) == 0) - return NODETOITEM(pt, ptn); - next_node = node; - } else { -#ifndef PTNOMASK - uintptr_t mask_node = PT_NULL; -#endif /* !PTNOMASK */ - next_node = PT_NULL; - while (!PT_LEAF_P(node)) { - pt_node_t * const ptn = PT_NODE(node); - pt_slot_t slot; -#ifndef PTNOMASK - if (PTN_ISMASK_P(ptn) && PTN_BRANCH_BITLEN(ptn) == 0) { - if (ptn == target) - break; - if (direction == PT_DESCENDING) { - mask_node = node; - next_node = PT_NULL; - } - } -#endif /* !PTNOMASK */ - slot = ptree_testnode(pt, target, ptn); - node = PTN_BRANCH_SLOT(ptn, slot); - if (direction == PT_ASCENDING) { - if (slot != (pt_slot_t)((1 << PTN_BRANCH_BITLEN(ptn)) - 1)) - next_node = PTN_BRANCH_SLOT(ptn, slot + 1); - } else { - if (slot > 0) { -#ifndef PTNOMASK - mask_node = PT_NULL; -#endif /* !PTNOMASK */ - next_node = PTN_BRANCH_SLOT(ptn, slot - 1); - } - } - } - if (PT_NODE(node) != target) - return NULL; -#ifndef PTNOMASK - if (PT_BRANCH_P(node)) { - pt_node_t *ptn = PT_NODE(node); - KASSERT(PTN_ISMASK_P(PT_NODE(node)) && PTN_BRANCH_BITLEN(PT_NODE(node)) == 0); - if (direction == PT_ASCENDING) { - next_node = PTN_BRANCH_ROOT_SLOT(ptn); - ptn = PT_NODE(next_node); - } - } - /* - * When descending, if we countered a mask node then that's - * we want to return. - */ - if (direction == PT_DESCENDING && !PT_NULL_P(mask_node)) { - KASSERT(PT_NULL_P(next_node)); - return NODETOITEM(pt, PT_NODE(mask_node)); - } -#endif /* !PTNOMASK */ - } - - node = next_node; - if (PT_NULL_P(node)) - return NULL; - - while (!PT_LEAF_P(node)) { - pt_node_t * const ptn = PT_NODE(node); - pt_slot_t slot; - if (direction == PT_ASCENDING) { -#ifndef PTNOMASK - if (PT_BRANCH_P(node) - && PTN_ISMASK_P(ptn) - && PTN_BRANCH_BITLEN(ptn) == 0) - return NODETOITEM(pt, ptn); -#endif /* !PTNOMASK */ - slot = PT_SLOT_LEFT; - } else { - slot = (1 << PTN_BRANCH_BITLEN(ptn)) - 1; - } - node = PTN_BRANCH_SLOT(ptn, slot); - } - return NODETOITEM(pt, PT_NODE(node)); -} - -void -ptree_remove_node(pt_tree_t *pt, void *item) -{ - pt_node_t * const target = ITEMTONODE(pt, item); - const pt_slot_t leaf_slot = PTN_LEAF_POSITION(target); - const pt_slot_t branch_slot = PTN_BRANCH_POSITION(target); - pt_node_t *ptn, *parent; - uintptr_t node; - uintptr_t *removep; - uintptr_t *nodep; - pt_bitoff_t bitoff; - pt_slot_t parent_slot; -#ifndef PTNOMASK - bool at_mask; -#endif - - if (PT_NULL_P(PTN_BRANCH_ROOT_SLOT(&pt->pt_rootnode))) { - KASSERT(!PT_NULL_P(PTN_BRANCH_ROOT_SLOT(&pt->pt_rootnode))); - return; - } - - bitoff = 0; - removep = NULL; - nodep = NULL; - parent = &pt->pt_rootnode; - parent_slot = PT_SLOT_ROOT; - for (;;) { - node = PTN_BRANCH_SLOT(parent, parent_slot); - ptn = PT_NODE(node); -#ifndef PTNOMASK - at_mask = PTN_ISMASK_P(ptn); -#endif - - if (PT_LEAF_P(node)) - break; - - /* - * If we are at the target, then we are looking at its branch - * identity. We need to remember who's pointing at it so we - * stop them from doing that. - */ - if (__predict_false(ptn == target)) { - KASSERT(nodep == NULL); -#ifndef PTNOMASK - /* - * Interior mask nodes are trivial to get rid of. - */ - if (at_mask && PTN_BRANCH_BITLEN(ptn) == 0) { - PTN_BRANCH_SLOT(parent, parent_slot) = - PTN_BRANCH_ROOT_SLOT(ptn); - KASSERT(PT_NULL_P(PTN_BRANCH_ODDMAN_SLOT(ptn))); - PTREE_CHECK(pt); - return; - } -#endif /* !PTNOMASK */ - nodep = &PTN_BRANCH_SLOT(parent, parent_slot); - KASSERT(*nodep == PTN_BRANCH(target)); - } - /* - * We need also need to know who's pointing at our parent. - * After we remove ourselves from our parent, he'll only - * have one child and that's unacceptable. So we replace - * the pointer to the parent with our abadoned sibling. - */ - removep = &PTN_BRANCH_SLOT(parent, parent_slot); - - /* - * Descend into the tree. - */ - parent = ptn; - parent_slot = ptree_testnode(pt, target, parent); - bitoff += PTN_BRANCH_BITLEN(parent); - } - - /* - * We better have found that the leaf we are looking for is target. - */ - if (target != ptn) { - KASSERT(target == ptn); - return; - } - - /* - * If we didn't encounter target as branch, then target must be the - * oddman-out. - */ - if (nodep == NULL) { - KASSERT(PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode) == PTN_LEAF(target)); - KASSERT(nodep == NULL); - nodep = &PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode); - } - - KASSERT((removep == NULL) == (parent == &pt->pt_rootnode)); - - /* - * We have to special remove the last leaf from the root since - * the only time the tree can a PT_NULL node is when it's empty. - */ - if (__predict_false(PTN_ISROOT_P(pt, parent))) { - KASSERT(removep == NULL); - KASSERT(parent == &pt->pt_rootnode); - KASSERT(nodep == &PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode)); - KASSERT(*nodep == PTN_LEAF(target)); - PTN_BRANCH_ROOT_SLOT(&pt->pt_rootnode) = PT_NULL; - PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode) = PT_NULL; - return; - } - - KASSERT((parent == target) == (removep == nodep)); - if (PTN_BRANCH(parent) == PTN_BRANCH_SLOT(target, PTN_BRANCH_POSITION(parent))) { - /* - * The pointer to the parent actually lives in the target's - * branch identity. We can't just move the target's branch - * identity since that would result in the parent pointing - * to its own branch identity and that's fobidden. - */ - const pt_slot_t slot = PTN_BRANCH_POSITION(parent); - const pt_slot_t other_slot = slot ^ PT_SLOT_OTHER; - const pt_bitlen_t parent_bitlen = PTN_BRANCH_BITLEN(parent); - - KASSERT(PTN_BRANCH_BITOFF(target) < PTN_BRANCH_BITOFF(parent)); - - /* - * This gets so confusing. The target's branch identity - * points to the branch identity of the parent of the target's - * leaf identity: - * - * TB = { X, PB = { TL, Y } } - * or TB = { X, PB = { TL } } - * - * So we can't move the target's branch identity to the parent - * because that would corrupt the tree. - */ - if (__predict_true(parent_bitlen > 0)) { - /* - * The parent is a two-way branch. We have to have - * do to this chang in two steps to keep internally - * consistent. First step is to copy our sibling from - * our parent to where we are pointing to parent's - * branch identiy. This remove all references to his - * branch identity from the tree. We then simply make - * the parent assume the target's branching duties. - * - * TB = { X, PB = { Y, TL } } --> PB = { X, Y }. - * TB = { X, PB = { TL, Y } } --> PB = { X, Y }. - * TB = { PB = { Y, TL }, X } --> PB = { Y, X }. - * TB = { PB = { TL, Y }, X } --> PB = { Y, X }. - */ - PTN_BRANCH_SLOT(target, slot) = - PTN_BRANCH_SLOT(parent, parent_slot ^ PT_SLOT_OTHER); - *nodep = ptree_move_branch(pt, parent, target); - PTREE_CHECK(pt); - return; - } else { - /* - * If parent was a one-way branch, it must have been - * mask which pointed to a single leaf which we are - * removing. This means we have to convert the - * parent back to a leaf node. So in the same - * position that target pointed to parent, we place - * leaf pointer to parent. In the other position, - * we just put the other node from target. - * - * TB = { X, PB = { TL } } --> PB = { X, PL } - */ - KASSERT(PTN_ISMASK_P(parent)); - KASSERT(slot == ptree_testnode(pt, parent, target)); - PTN_BRANCH_SLOT(parent, slot) = PTN_LEAF(parent); - PTN_BRANCH_SLOT(parent, other_slot) = - PTN_BRANCH_SLOT(target, other_slot); - PTN_SET_LEAF_POSITION(parent,slot); - PTN_SET_BRANCH_BITLEN(parent, 1); - } - PTN_SET_BRANCH_BITOFF(parent, PTN_BRANCH_BITOFF(target)); - PTN_SET_BRANCH_POSITION(parent, PTN_BRANCH_POSITION(target)); - - *nodep = PTN_BRANCH(parent); - PTREE_CHECK(pt); - return; - } - -#ifndef PTNOMASK - if (__predict_false(PTN_BRANCH_BITLEN(parent) == 0)) { - /* - * Parent was a one-way branch which is changing back to a leaf. - * Since parent is no longer a one-way branch, it can take over - * target's branching duties. - * - * GB = { PB = { TL } } --> GB = { PL } - * TB = { X, Y } --> PB = { X, Y } - */ - KASSERT(PTN_ISMASK_P(parent)); - KASSERT(parent != target); - *removep = PTN_LEAF(parent); - } else -#endif /* !PTNOMASK */ - { - /* - * Now we are the normal removal case. Since after the - * target's leaf identity is removed from the its parent, - * that parent will only have one decendent. So we can - * just as easily replace the node that has the parent's - * branch identity with the surviving node. This freeing - * parent from its branching duties which means it can - * take over target's branching duties. - * - * GB = { PB = { X, TL } } --> GB = { X } - * TB = { V, W } --> PB = { V, W } - */ - const pt_slot_t other_slot = parent_slot ^ PT_SLOT_OTHER; - uintptr_t other_node = PTN_BRANCH_SLOT(parent, other_slot); - const pt_slot_t target_slot = (parent == target ? branch_slot : leaf_slot); - - *removep = other_node; - - ptree_set_position(other_node, target_slot); - - /* - * If target's branch identity contained its leaf identity, we - * have nothing left to do. We've already moved 'X' so there - * is no longer anything in the target's branch identiy that - * has to be preserved. - */ - if (parent == target) { - /* - * GB = { TB = { X, TL } } --> GB = { X } - * TB = { X, TL } --> don't care - */ - PTREE_CHECK(pt); - return; - } - } - - /* - * If target wasn't used as a branch, then it must have been the - * oddman-out of the tree (the one node that doesn't have a branch - * identity). This makes parent the new oddman-out. - */ - if (*nodep == PTN_LEAF(target)) { - KASSERT(nodep == &PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode)); - PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode) = PTN_LEAF(parent); - PTREE_CHECK(pt); - return; - } - - /* - * Finally move the target's branching duties to the parent. - */ - KASSERT(PTN_BRANCH_BITOFF(parent) > PTN_BRANCH_BITOFF(target)); - *nodep = ptree_move_branch(pt, parent, target); - PTREE_CHECK(pt); -} - -#ifdef PTCHECK -static const pt_node_t * -ptree_check_find_node2(const pt_tree_t *pt, const pt_node_t *parent, - uintptr_t target) -{ - const pt_bitlen_t slots = 1 << PTN_BRANCH_BITLEN(parent); - pt_slot_t slot; - - for (slot = 0; slot < slots; slot++) { - const uintptr_t node = PTN_BRANCH_SLOT(parent, slot); - if (PTN_BRANCH_SLOT(parent, slot) == node) - return parent; - } - for (slot = 0; slot < slots; slot++) { - const uintptr_t node = PTN_BRANCH_SLOT(parent, slot); - const pt_node_t *branch; - if (!PT_BRANCH_P(node)) - continue; - branch = ptree_check_find_node2(pt, PT_NODE(node), target); - if (branch != NULL) - return branch; - } - - return NULL; -} - -static bool -ptree_check_leaf(const pt_tree_t *pt, const pt_node_t *parent, - const pt_node_t *ptn) -{ - const pt_bitoff_t leaf_position = PTN_LEAF_POSITION(ptn); - const pt_bitlen_t bitlen = PTN_BRANCH_BITLEN(ptn); - const pt_bitlen_t mask_len = PTN_MASK_BITLEN(ptn); - const uintptr_t leaf_node = PTN_LEAF(ptn); - const bool is_parent_root = (parent == &pt->pt_rootnode); - const bool is_mask = PTN_ISMASK_P(ptn); - bool ok = true; - - if (is_parent_root) { - ok = ok && PTN_BRANCH_ODDMAN_SLOT(parent) == leaf_node; - KASSERT(ok); - return ok; - } - - if (is_mask && PTN_ISMASK_P(parent) && PTN_BRANCH_BITLEN(parent) == 0) { - ok = ok && PTN_MASK_BITLEN(parent) < mask_len; - KASSERT(ok); - ok = ok && PTN_BRANCH_BITOFF(parent) < mask_len; - KASSERT(ok); - } - ok = ok && PTN_BRANCH_SLOT(parent, leaf_position) == leaf_node; - KASSERT(ok); - ok = ok && leaf_position == ptree_testnode(pt, ptn, parent); - KASSERT(ok); - if (PTN_BRANCH_ODDMAN_SLOT(&pt->pt_rootnode) != leaf_node) { - ok = ok && bitlen > 0; - KASSERT(ok); - ok = ok && ptn == ptree_check_find_node2(pt, ptn, PTN_LEAF(ptn)); - KASSERT(ok); - } - return ok; -} - -static bool -ptree_check_branch(const pt_tree_t *pt, const pt_node_t *parent, - const pt_node_t *ptn) -{ - const bool is_parent_root = (parent == &pt->pt_rootnode); - const pt_slot_t branch_slot = PTN_BRANCH_POSITION(ptn); - const pt_bitoff_t bitoff = PTN_BRANCH_BITOFF(ptn); - const pt_bitoff_t bitlen = PTN_BRANCH_BITLEN(ptn); - const pt_bitoff_t parent_bitoff = PTN_BRANCH_BITOFF(parent); - const pt_bitoff_t parent_bitlen = PTN_BRANCH_BITLEN(parent); - const bool is_parent_mask = PTN_ISMASK_P(parent) && parent_bitlen == 0; - const bool is_mask = PTN_ISMASK_P(ptn) && bitlen == 0; - const pt_bitoff_t parent_mask_len = PTN_MASK_BITLEN(parent); - const pt_bitoff_t mask_len = PTN_MASK_BITLEN(ptn); - const pt_bitlen_t slots = 1 << bitlen; - pt_slot_t slot; - bool ok = true; - - ok = ok && PTN_BRANCH_SLOT(parent, branch_slot) == PTN_BRANCH(ptn); - KASSERT(ok); - ok = ok && branch_slot == ptree_testnode(pt, ptn, parent); - KASSERT(ok); - - if (is_mask) { - ok = ok && bitoff == mask_len; - KASSERT(ok); - if (is_parent_mask) { - ok = ok && parent_mask_len < mask_len; - KASSERT(ok); - ok = ok && parent_bitoff < bitoff; - KASSERT(ok); - } - } else { - if (is_parent_mask) { - ok = ok && parent_bitoff <= bitoff; - } else if (!is_parent_root) { - ok = ok && parent_bitoff < bitoff; - } - KASSERT(ok); - } - - for (slot = 0; slot < slots; slot++) { - const uintptr_t node = PTN_BRANCH_SLOT(ptn, slot); - pt_bitoff_t tmp_bitoff = 0; - pt_slot_t tmp_slot; - ok = ok && node != PTN_BRANCH(ptn); - KASSERT(ok); - if (bitlen > 0) { - ok = ok && ptree_matchnode(pt, PT_NODE(node), ptn, bitoff, &tmp_bitoff, &tmp_slot); - KASSERT(ok); - tmp_slot = ptree_testnode(pt, PT_NODE(node), ptn); - ok = ok && slot == tmp_slot; - KASSERT(ok); - } - if (PT_LEAF_P(node)) - ok = ok && ptree_check_leaf(pt, ptn, PT_NODE(node)); - else - ok = ok && ptree_check_branch(pt, ptn, PT_NODE(node)); - } - - return ok; -} -#endif /* PTCHECK */ - -/*ARGSUSED*/ -bool -ptree_check(const pt_tree_t *pt) -{ - bool ok = true; -#ifdef PTCHECK - const pt_node_t * const parent = &pt->pt_rootnode; - const uintptr_t node = pt->pt_root; - const pt_node_t * const ptn = PT_NODE(node); - - ok = ok && PTN_BRANCH_BITOFF(parent) == 0; - ok = ok && !PTN_ISMASK_P(parent); - - if (PT_NULL_P(node)) - return ok; - - if (PT_LEAF_P(node)) - ok = ok && ptree_check_leaf(pt, parent, ptn); - else - ok = ok && ptree_check_branch(pt, parent, ptn); -#endif - return ok; -} - -bool -ptree_mask_node_p(pt_tree_t *pt, const void *item, pt_bitlen_t *lenp) -{ - const pt_node_t * const mask = ITEMTONODE(pt, item); - - if (!PTN_ISMASK_P(mask)) - return false; - - if (lenp != NULL) - *lenp = PTN_MASK_BITLEN(mask); - - return true; -} diff --git a/common/lib/libc/gen/radixtree.c b/common/lib/libc/gen/radixtree.c deleted file mode 100644 index cd1ec6c32..000000000 --- a/common/lib/libc/gen/radixtree.c +++ /dev/null @@ -1,1466 +0,0 @@ -/* $NetBSD: radixtree.c,v 1.17 2011/11/02 13:49:43 yamt Exp $ */ - -/*- - * Copyright (c)2011 YAMAMOTO Takashi, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * radixtree.c - * - * this is an implementation of radix tree, whose keys are uint64_t and leafs - * are user provided pointers. - * - * leaf nodes are just void * and this implementation doesn't care about - * what they actually point to. however, this implementation has an assumption - * about their alignment. specifically, this implementation assumes that their - * 2 LSBs are zero and uses them internally. - * - * intermediate nodes are automatically allocated and freed internally and - * basically users don't need to care about them. only radix_tree_insert_node - * function can allocate memory for intermediate nodes and thus can fail for - * ENOMEM. - * - * efficiency: - * it's designed to work efficiently with dense index distribution. - * the memory consumption (number of necessary intermediate nodes) - * heavily depends on index distribution. basically, more dense index - * distribution consumes less nodes per item. - * approximately, - * the best case: about RADIX_TREE_PTR_PER_NODE items per intermediate node. - * the worst case: RADIX_TREE_MAX_HEIGHT intermediate nodes per item. - * - * gang lookup: - * this implementation provides a way to lookup many nodes quickly via - * radix_tree_gang_lookup_node function and its varients. - * - * tags: - * this implementation provides tagging functionality to allow quick - * scanning of a subset of leaf nodes. leaf nodes are untagged when - * inserted into the tree and can be tagged by radix_tree_set_tag function. - * radix_tree_gang_lookup_tagged_node function and its variants returns - * only leaf nodes with the given tag. to reduce amount of nodes to visit for - * these functions, this implementation keeps tagging information in internal - * intermediate nodes and quickly skips uninterested parts of a tree. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: radixtree.c,v 1.17 2011/11/02 13:49:43 yamt Exp $"); -#include -#include -#include -#include -#include -#if defined(_STANDALONE) -#include -#endif /* defined(_STANDALONE) */ -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -__RCSID("$NetBSD: radixtree.c,v 1.17 2011/11/02 13:49:43 yamt Exp $"); -#include -#include -#include -#include -#include -#if 1 -#define KASSERT assert -#else -#define KASSERT(a) /* nothing */ -#endif -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ - -#include - -#define RADIX_TREE_BITS_PER_HEIGHT 4 /* XXX tune */ -#define RADIX_TREE_PTR_PER_NODE (1 << RADIX_TREE_BITS_PER_HEIGHT) -#define RADIX_TREE_MAX_HEIGHT (64 / RADIX_TREE_BITS_PER_HEIGHT) -#define RADIX_TREE_INVALID_HEIGHT (RADIX_TREE_MAX_HEIGHT + 1) -__CTASSERT((64 % RADIX_TREE_BITS_PER_HEIGHT) == 0); - -__CTASSERT(((1 << RADIX_TREE_TAG_ID_MAX) & (sizeof(int) - 1)) == 0); -#define RADIX_TREE_TAG_MASK ((1 << RADIX_TREE_TAG_ID_MAX) - 1) - -static inline void * -entry_ptr(void *p) -{ - - return (void *)((uintptr_t)p & ~RADIX_TREE_TAG_MASK); -} - -static inline unsigned int -entry_tagmask(void *p) -{ - - return (uintptr_t)p & RADIX_TREE_TAG_MASK; -} - -static inline void * -entry_compose(void *p, unsigned int tagmask) -{ - - return (void *)((uintptr_t)p | tagmask); -} - -static inline bool -entry_match_p(void *p, unsigned int tagmask) -{ - - KASSERT(entry_ptr(p) != NULL || entry_tagmask(p) == 0); - if (p == NULL) { - return false; - } - if (tagmask == 0) { - return true; - } - return (entry_tagmask(p) & tagmask) != 0; -} - -static inline unsigned int -tagid_to_mask(radix_tree_tagid_t id) -{ - - KASSERT(id >= 0); - KASSERT(id < RADIX_TREE_TAG_ID_MAX); - return 1U << id; -} - -/* - * radix_tree_node: an intermediate node - * - * we don't care the type of leaf nodes. they are just void *. - */ - -struct radix_tree_node { - void *n_ptrs[RADIX_TREE_PTR_PER_NODE]; - unsigned int n_nptrs; /* # of non-NULL pointers in n_ptrs */ -}; - -/* - * any_children_tagmask: - * - * return OR'ed tagmask of the given node's children. - */ - -static unsigned int -any_children_tagmask(const struct radix_tree_node *n) -{ - unsigned int mask; - int i; - - mask = 0; - for (i = 0; i < RADIX_TREE_PTR_PER_NODE; i++) { - mask |= (unsigned int)(uintptr_t)n->n_ptrs[i]; - } - return mask & RADIX_TREE_TAG_MASK; -} - -/* - * p_refs[0].pptr == &t->t_root - * : - * p_refs[n].pptr == &(*p_refs[n-1])->n_ptrs[x] - * : - * : - * p_refs[t->t_height].pptr == &leaf_pointer - */ - -struct radix_tree_path { - struct radix_tree_node_ref { - void **pptr; - } p_refs[RADIX_TREE_MAX_HEIGHT + 1]; /* +1 for the root ptr */ - /* - * p_lastidx is either the index of the last valid element of p_refs[] - * or RADIX_TREE_INVALID_HEIGHT. - * RADIX_TREE_INVALID_HEIGHT means that radix_tree_lookup_ptr found - * that the height of the tree is not enough to cover the given index. - */ - unsigned int p_lastidx; -}; - -static inline void ** -path_pptr(const struct radix_tree *t, const struct radix_tree_path *p, - unsigned int height) -{ - - KASSERT(height <= t->t_height); - return p->p_refs[height].pptr; -} - -static inline struct radix_tree_node * -path_node(const struct radix_tree * t, const struct radix_tree_path *p, - unsigned int height) -{ - - KASSERT(height <= t->t_height); - return entry_ptr(*path_pptr(t, p, height)); -} - -/* - * radix_tree_init_tree: - * - * initialize a tree. - */ - -void -radix_tree_init_tree(struct radix_tree *t) -{ - - t->t_height = 0; - t->t_root = NULL; -} - -/* - * radix_tree_init_tree: - * - * clean up a tree. - */ - -void -radix_tree_fini_tree(struct radix_tree *t) -{ - - KASSERT(t->t_root == NULL); - KASSERT(t->t_height == 0); -} - -bool -radix_tree_empty_tree_p(struct radix_tree *t) -{ - - return t->t_root == NULL; -} - -bool -radix_tree_empty_tagged_tree_p(struct radix_tree *t, radix_tree_tagid_t tagid) -{ - const unsigned int tagmask = tagid_to_mask(tagid); - - return (entry_tagmask(t->t_root) & tagmask) == 0; -} - -static void -radix_tree_node_init(struct radix_tree_node *n) -{ - - memset(n, 0, sizeof(*n)); -} - -#if defined(_KERNEL) -pool_cache_t radix_tree_node_cache __read_mostly; - -static int -radix_tree_node_ctor(void *dummy, void *item, int flags) -{ - struct radix_tree_node *n = item; - - KASSERT(dummy == NULL); - radix_tree_node_init(n); - return 0; -} - -/* - * radix_tree_init: - * - * initialize the subsystem. - */ - -void -radix_tree_init(void) -{ - - radix_tree_node_cache = pool_cache_init(sizeof(struct radix_tree_node), - 0, 0, 0, "radix_tree_node", NULL, IPL_NONE, radix_tree_node_ctor, - NULL, NULL); - KASSERT(radix_tree_node_cache != NULL); -} -#endif /* defined(_KERNEL) */ - -static bool __unused -radix_tree_node_clean_p(const struct radix_tree_node *n) -{ - unsigned int i; - - if (n->n_nptrs != 0) { - return false; - } - for (i = 0; i < RADIX_TREE_PTR_PER_NODE; i++) { - if (n->n_ptrs[i] != NULL) { - return false; - } - } - return true; -} - -static struct radix_tree_node * -radix_tree_alloc_node(void) -{ - struct radix_tree_node *n; - -#if defined(_KERNEL) - n = pool_cache_get(radix_tree_node_cache, PR_NOWAIT); -#else /* defined(_KERNEL) */ -#if defined(_STANDALONE) - n = alloc(sizeof(*n)); -#else /* defined(_STANDALONE) */ - n = malloc(sizeof(*n)); -#endif /* defined(_STANDALONE) */ - if (n != NULL) { - radix_tree_node_init(n); - } -#endif /* defined(_KERNEL) */ - KASSERT(n == NULL || radix_tree_node_clean_p(n)); - return n; -} - -static void -radix_tree_free_node(struct radix_tree_node *n) -{ - - KASSERT(radix_tree_node_clean_p(n)); -#if defined(_KERNEL) - pool_cache_put(radix_tree_node_cache, n); -#elif defined(_STANDALONE) - dealloc(n, sizeof(*n)); -#else - free(n); -#endif -} - -static int -radix_tree_grow(struct radix_tree *t, unsigned int newheight) -{ - const unsigned int tagmask = entry_tagmask(t->t_root); - - KASSERT(newheight <= 64 / RADIX_TREE_BITS_PER_HEIGHT); - if (t->t_root == NULL) { - t->t_height = newheight; - return 0; - } - while (t->t_height < newheight) { - struct radix_tree_node *n; - - n = radix_tree_alloc_node(); - if (n == NULL) { - /* - * don't bother to revert our changes. - * the caller will likely retry. - */ - return ENOMEM; - } - n->n_nptrs = 1; - n->n_ptrs[0] = t->t_root; - t->t_root = entry_compose(n, tagmask); - t->t_height++; - } - return 0; -} - -/* - * radix_tree_lookup_ptr: - * - * an internal helper function used for various exported functions. - * - * return the pointer to store the node for the given index. - * - * if alloc is true, try to allocate the storage. (note for _KERNEL: - * in that case, this function can block.) if the allocation failed or - * alloc is false, return NULL. - * - * if path is not NULL, fill it for the caller's investigation. - * - * if tagmask is not zero, search only for nodes with the tag set. - * note that, however, this function doesn't check the tagmask for the leaf - * pointer. it's a caller's responsibility to investigate the value which - * is pointed by the returned pointer if necessary. - * - * while this function is a bit large, as it's called with some constant - * arguments, inlining might have benefits. anyway, a compiler will decide. - */ - -static inline void ** -radix_tree_lookup_ptr(struct radix_tree *t, uint64_t idx, - struct radix_tree_path *path, bool alloc, const unsigned int tagmask) -{ - struct radix_tree_node *n; - int hshift = RADIX_TREE_BITS_PER_HEIGHT * t->t_height; - int shift; - void **vpp; - const uint64_t mask = (UINT64_C(1) << RADIX_TREE_BITS_PER_HEIGHT) - 1; - struct radix_tree_node_ref *refs = NULL; - - /* - * check unsupported combinations - */ - KASSERT(tagmask == 0 || !alloc); - KASSERT(path == NULL || !alloc); - vpp = &t->t_root; - if (path != NULL) { - refs = path->p_refs; - refs->pptr = vpp; - } - n = NULL; - for (shift = 64 - RADIX_TREE_BITS_PER_HEIGHT; shift >= 0;) { - struct radix_tree_node *c; - void *entry; - const uint64_t i = (idx >> shift) & mask; - - if (shift >= hshift) { - unsigned int newheight; - - KASSERT(vpp == &t->t_root); - if (i == 0) { - shift -= RADIX_TREE_BITS_PER_HEIGHT; - continue; - } - if (!alloc) { - if (path != NULL) { - KASSERT((refs - path->p_refs) == 0); - path->p_lastidx = - RADIX_TREE_INVALID_HEIGHT; - } - return NULL; - } - newheight = shift / RADIX_TREE_BITS_PER_HEIGHT + 1; - if (radix_tree_grow(t, newheight)) { - return NULL; - } - hshift = RADIX_TREE_BITS_PER_HEIGHT * t->t_height; - } - entry = *vpp; - c = entry_ptr(entry); - if (c == NULL || - (tagmask != 0 && - (entry_tagmask(entry) & tagmask) == 0)) { - if (!alloc) { - if (path != NULL) { - path->p_lastidx = refs - path->p_refs; - } - return NULL; - } - c = radix_tree_alloc_node(); - if (c == NULL) { - return NULL; - } - *vpp = c; - if (n != NULL) { - KASSERT(n->n_nptrs < RADIX_TREE_PTR_PER_NODE); - n->n_nptrs++; - } - } - n = c; - vpp = &n->n_ptrs[i]; - if (path != NULL) { - refs++; - refs->pptr = vpp; - } - shift -= RADIX_TREE_BITS_PER_HEIGHT; - } - if (alloc) { - KASSERT(*vpp == NULL); - if (n != NULL) { - KASSERT(n->n_nptrs < RADIX_TREE_PTR_PER_NODE); - n->n_nptrs++; - } - } - if (path != NULL) { - path->p_lastidx = refs - path->p_refs; - } - return vpp; -} - -/* - * radix_tree_insert_node: - * - * insert the node at idx. - * it's illegal to insert NULL. - * it's illegal to insert a non-aligned pointer. - * - * this function returns ENOMEM if necessary memory allocation failed. - * otherwise, this function returns 0. - * - * note that inserting a node can involves memory allocation for intermediate - * nodes. if _KERNEL, it's done with no-sleep IPL_NONE memory allocation. - * - * for the newly inserted node, all tags are cleared. - */ - -int -radix_tree_insert_node(struct radix_tree *t, uint64_t idx, void *p) -{ - void **vpp; - - KASSERT(p != NULL); - KASSERT(entry_compose(p, 0) == p); - vpp = radix_tree_lookup_ptr(t, idx, NULL, true, 0); - if (vpp == NULL) { - return ENOMEM; - } - KASSERT(*vpp == NULL); - *vpp = p; - return 0; -} - -/* - * radix_tree_replace_node: - * - * replace a node at the given index with the given node. - * return the old node. - * it's illegal to try to replace a node which has not been inserted. - * - * this function doesn't change tags. - */ - -void * -radix_tree_replace_node(struct radix_tree *t, uint64_t idx, void *p) -{ - void **vpp; - void *oldp; - - KASSERT(p != NULL); - KASSERT(entry_compose(p, 0) == p); - vpp = radix_tree_lookup_ptr(t, idx, NULL, false, 0); - KASSERT(vpp != NULL); - oldp = *vpp; - KASSERT(oldp != NULL); - *vpp = entry_compose(p, entry_tagmask(*vpp)); - return entry_ptr(oldp); -} - -/* - * radix_tree_remove_node: - * - * remove the node at idx. - * it's illegal to try to remove a node which has not been inserted. - */ - -void * -radix_tree_remove_node(struct radix_tree *t, uint64_t idx) -{ - struct radix_tree_path path; - void **vpp; - void *oldp; - int i; - - vpp = radix_tree_lookup_ptr(t, idx, &path, false, 0); - KASSERT(vpp != NULL); - oldp = *vpp; - KASSERT(oldp != NULL); - KASSERT(path.p_lastidx == t->t_height); - KASSERT(vpp == path_pptr(t, &path, path.p_lastidx)); - *vpp = NULL; - for (i = t->t_height - 1; i >= 0; i--) { - void *entry; - struct radix_tree_node ** const pptr = - (struct radix_tree_node **)path_pptr(t, &path, i); - struct radix_tree_node *n; - - KASSERT(pptr != NULL); - entry = *pptr; - n = entry_ptr(entry); - KASSERT(n != NULL); - KASSERT(n->n_nptrs > 0); - n->n_nptrs--; - if (n->n_nptrs > 0) { - break; - } - radix_tree_free_node(n); - *pptr = NULL; - } - /* - * fix up height - */ - if (i < 0) { - KASSERT(t->t_root == NULL); - t->t_height = 0; - } - /* - * update tags - */ - for (; i >= 0; i--) { - void *entry; - struct radix_tree_node ** const pptr = - (struct radix_tree_node **)path_pptr(t, &path, i); - struct radix_tree_node *n; - unsigned int newmask; - - KASSERT(pptr != NULL); - entry = *pptr; - n = entry_ptr(entry); - KASSERT(n != NULL); - KASSERT(n->n_nptrs > 0); - newmask = any_children_tagmask(n); - if (newmask == entry_tagmask(entry)) { - break; - } - *pptr = entry_compose(n, newmask); - } - /* - * XXX is it worth to try to reduce height? - * if we do that, make radix_tree_grow rollback its change as well. - */ - return entry_ptr(oldp); -} - -/* - * radix_tree_lookup_node: - * - * returns the node at idx. - * returns NULL if nothing is found at idx. - */ - -void * -radix_tree_lookup_node(struct radix_tree *t, uint64_t idx) -{ - void **vpp; - - vpp = radix_tree_lookup_ptr(t, idx, NULL, false, 0); - if (vpp == NULL) { - return NULL; - } - return entry_ptr(*vpp); -} - -static inline void -gang_lookup_init(struct radix_tree *t, uint64_t idx, - struct radix_tree_path *path, const unsigned int tagmask) -{ - void **vpp; - - vpp = radix_tree_lookup_ptr(t, idx, path, false, tagmask); - KASSERT(vpp == NULL || - vpp == path_pptr(t, path, path->p_lastidx)); - KASSERT(&t->t_root == path_pptr(t, path, 0)); - KASSERT(path->p_lastidx == RADIX_TREE_INVALID_HEIGHT || - path->p_lastidx == t->t_height || - !entry_match_p(*path_pptr(t, path, path->p_lastidx), tagmask)); -} - -/* - * gang_lookup_scan: - * - * a helper routine for radix_tree_gang_lookup_node and its variants. - */ - -static inline unsigned int -__attribute__((__always_inline__)) -gang_lookup_scan(struct radix_tree *t, struct radix_tree_path *path, - void **results, unsigned int maxresults, const unsigned int tagmask, - bool reverse) -{ - - /* - * we keep the path updated only for lastidx-1. - * vpp is what path_pptr(t, path, lastidx) would be. - */ - void **vpp; - unsigned int nfound; - unsigned int lastidx; - /* - * set up scan direction dependant constants so that we can iterate - * n_ptrs as the following. - * - * for (i = first; i != guard; i += step) - * visit n->n_ptrs[i]; - */ - const int step = reverse ? -1 : 1; - const unsigned int first = reverse ? RADIX_TREE_PTR_PER_NODE - 1 : 0; - const unsigned int last = reverse ? 0 : RADIX_TREE_PTR_PER_NODE - 1; - const unsigned int guard = last + step; - - KASSERT(maxresults > 0); - KASSERT(&t->t_root == path_pptr(t, path, 0)); - lastidx = path->p_lastidx; - KASSERT(lastidx == RADIX_TREE_INVALID_HEIGHT || - lastidx == t->t_height || - !entry_match_p(*path_pptr(t, path, lastidx), tagmask)); - nfound = 0; - if (lastidx == RADIX_TREE_INVALID_HEIGHT) { - if (reverse) { - lastidx = 0; - vpp = path_pptr(t, path, lastidx); - goto descend; - } - return 0; - } - vpp = path_pptr(t, path, lastidx); - while (/*CONSTCOND*/true) { - struct radix_tree_node *n; - unsigned int i; - - if (entry_match_p(*vpp, tagmask)) { - KASSERT(lastidx == t->t_height); - /* - * record the matching non-NULL leaf. - */ - results[nfound] = entry_ptr(*vpp); - nfound++; - if (nfound == maxresults) { - return nfound; - } - } -scan_siblings: - /* - * try to find the next matching non-NULL sibling. - */ - if (lastidx == 0) { - /* - * the root has no siblings. - * we've done. - */ - KASSERT(vpp == &t->t_root); - break; - } - n = path_node(t, path, lastidx - 1); - if (*vpp != NULL && n->n_nptrs == 1) { - /* - * optimization; if the node has only a single pointer - * and we've already visited it, there's no point to - * keep scanning in this node. - */ - goto no_siblings; - } - for (i = vpp - n->n_ptrs + step; i != guard; i += step) { - KASSERT(i < RADIX_TREE_PTR_PER_NODE); - if (entry_match_p(n->n_ptrs[i], tagmask)) { - vpp = &n->n_ptrs[i]; - break; - } - } - if (i == guard) { -no_siblings: - /* - * not found. go to parent. - */ - lastidx--; - vpp = path_pptr(t, path, lastidx); - goto scan_siblings; - } -descend: - /* - * following the left-most (or right-most in the case of - * reverse scan) child node, decend until reaching the leaf or - * an non-matching entry. - */ - while (entry_match_p(*vpp, tagmask) && lastidx < t->t_height) { - /* - * save vpp in the path so that we can come back to this - * node after finishing visiting children. - */ - path->p_refs[lastidx].pptr = vpp; - n = entry_ptr(*vpp); - vpp = &n->n_ptrs[first]; - lastidx++; - } - } - return nfound; -} - -/* - * radix_tree_gang_lookup_node: - * - * search nodes starting from idx in the ascending order. - * results should be an array large enough to hold maxresults pointers. - * returns the number of nodes found, up to maxresults. - * returning less than maxresults means there are no more nodes. - * - * the result of this function is semantically equivalent to what could be - * obtained by repeated calls of radix_tree_lookup_node with increasing index. - * but this function is much faster when node indexes are distributed sparsely. - * - * note that this function doesn't return exact values of node indexes of - * found nodes. if they are important for a caller, it's the caller's - * responsibility to check them, typically by examinining the returned nodes - * using some caller-specific knowledge about them. - */ - -unsigned int -radix_tree_gang_lookup_node(struct radix_tree *t, uint64_t idx, - void **results, unsigned int maxresults) -{ - struct radix_tree_path path; - - gang_lookup_init(t, idx, &path, 0); - return gang_lookup_scan(t, &path, results, maxresults, 0, false); -} - -/* - * radix_tree_gang_lookup_node_reverse: - * - * same as radix_tree_gang_lookup_node except that this one scans the - * tree in the reverse order. ie. descending index values. - */ - -unsigned int -radix_tree_gang_lookup_node_reverse(struct radix_tree *t, uint64_t idx, - void **results, unsigned int maxresults) -{ - struct radix_tree_path path; - - gang_lookup_init(t, idx, &path, 0); - return gang_lookup_scan(t, &path, results, maxresults, 0, true); -} - -/* - * radix_tree_gang_lookup_tagged_node: - * - * same as radix_tree_gang_lookup_node except that this one only returns - * nodes tagged with tagid. - */ - -unsigned int -radix_tree_gang_lookup_tagged_node(struct radix_tree *t, uint64_t idx, - void **results, unsigned int maxresults, radix_tree_tagid_t tagid) -{ - struct radix_tree_path path; - const unsigned int tagmask = tagid_to_mask(tagid); - - gang_lookup_init(t, idx, &path, tagmask); - return gang_lookup_scan(t, &path, results, maxresults, tagmask, false); -} - -/* - * radix_tree_gang_lookup_tagged_node_reverse: - * - * same as radix_tree_gang_lookup_tagged_node except that this one scans the - * tree in the reverse order. ie. descending index values. - */ - -unsigned int -radix_tree_gang_lookup_tagged_node_reverse(struct radix_tree *t, uint64_t idx, - void **results, unsigned int maxresults, radix_tree_tagid_t tagid) -{ - struct radix_tree_path path; - const unsigned int tagmask = tagid_to_mask(tagid); - - gang_lookup_init(t, idx, &path, tagmask); - return gang_lookup_scan(t, &path, results, maxresults, tagmask, true); -} - -/* - * radix_tree_get_tag: - * - * return if the tag is set for the node at the given index. (true if set) - * it's illegal to call this function for a node which has not been inserted. - */ - -bool -radix_tree_get_tag(struct radix_tree *t, uint64_t idx, - radix_tree_tagid_t tagid) -{ -#if 1 - const unsigned int tagmask = tagid_to_mask(tagid); - void **vpp; - - vpp = radix_tree_lookup_ptr(t, idx, NULL, false, tagmask); - if (vpp == NULL) { - return false; - } - KASSERT(*vpp != NULL); - return (entry_tagmask(*vpp) & tagmask) != 0; -#else - const unsigned int tagmask = tagid_to_mask(tagid); - void **vpp; - - vpp = radix_tree_lookup_ptr(t, idx, NULL, false, 0); - KASSERT(vpp != NULL); - return (entry_tagmask(*vpp) & tagmask) != 0; -#endif -} - -/* - * radix_tree_set_tag: - * - * set the tag for the node at the given index. - * it's illegal to call this function for a node which has not been inserted. - */ - -void -radix_tree_set_tag(struct radix_tree *t, uint64_t idx, - radix_tree_tagid_t tagid) -{ - struct radix_tree_path path; - const unsigned int tagmask = tagid_to_mask(tagid); - void **vpp; - int i; - - vpp = radix_tree_lookup_ptr(t, idx, &path, false, 0); - KASSERT(vpp != NULL); - KASSERT(*vpp != NULL); - KASSERT(path.p_lastidx == t->t_height); - KASSERT(vpp == path_pptr(t, &path, path.p_lastidx)); - for (i = t->t_height; i >= 0; i--) { - void ** const pptr = (void **)path_pptr(t, &path, i); - void *entry; - - KASSERT(pptr != NULL); - entry = *pptr; - if ((entry_tagmask(entry) & tagmask) != 0) { - break; - } - *pptr = (void *)((uintptr_t)entry | tagmask); - } -} - -/* - * radix_tree_clear_tag: - * - * clear the tag for the node at the given index. - * it's illegal to call this function for a node which has not been inserted. - */ - -void -radix_tree_clear_tag(struct radix_tree *t, uint64_t idx, - radix_tree_tagid_t tagid) -{ - struct radix_tree_path path; - const unsigned int tagmask = tagid_to_mask(tagid); - void **vpp; - int i; - - vpp = radix_tree_lookup_ptr(t, idx, &path, false, 0); - KASSERT(vpp != NULL); - KASSERT(*vpp != NULL); - KASSERT(path.p_lastidx == t->t_height); - KASSERT(vpp == path_pptr(t, &path, path.p_lastidx)); - /* - * if already cleared, nothing to do - */ - if ((entry_tagmask(*vpp) & tagmask) == 0) { - return; - } - /* - * clear the tag only if no children have the tag. - */ - for (i = t->t_height; i >= 0; i--) { - void ** const pptr = (void **)path_pptr(t, &path, i); - void *entry; - - KASSERT(pptr != NULL); - entry = *pptr; - KASSERT((entry_tagmask(entry) & tagmask) != 0); - *pptr = entry_compose(entry_ptr(entry), - entry_tagmask(entry) & ~tagmask); - /* - * check if we should proceed to process the next level. - */ - if (0 < i) { - struct radix_tree_node *n = path_node(t, &path, i - 1); - - if ((any_children_tagmask(n) & tagmask) != 0) { - break; - } - } - } -} - -#if defined(UNITTEST) - -#include -#include - -static void -radix_tree_dump_node(const struct radix_tree *t, void *vp, - uint64_t offset, unsigned int height) -{ - struct radix_tree_node *n; - unsigned int i; - - for (i = 0; i < t->t_height - height; i++) { - printf(" "); - } - if (entry_tagmask(vp) == 0) { - printf("[%" PRIu64 "] %p", offset, entry_ptr(vp)); - } else { - printf("[%" PRIu64 "] %p (tagmask=0x%x)", offset, entry_ptr(vp), - entry_tagmask(vp)); - } - if (height == 0) { - printf(" (leaf)\n"); - return; - } - n = entry_ptr(vp); - assert(any_children_tagmask(n) == entry_tagmask(vp)); - printf(" (%u children)\n", n->n_nptrs); - for (i = 0; i < __arraycount(n->n_ptrs); i++) { - void *c; - - c = n->n_ptrs[i]; - if (c == NULL) { - continue; - } - radix_tree_dump_node(t, c, - offset + i * (UINT64_C(1) << - (RADIX_TREE_BITS_PER_HEIGHT * (height - 1))), height - 1); - } -} - -void radix_tree_dump(const struct radix_tree *); - -void -radix_tree_dump(const struct radix_tree *t) -{ - - printf("tree %p height=%u\n", t, t->t_height); - radix_tree_dump_node(t, t->t_root, 0, t->t_height); -} - -static void -test1(void) -{ - struct radix_tree s; - struct radix_tree *t = &s; - void *results[3]; - - radix_tree_init_tree(t); - radix_tree_dump(t); - assert(radix_tree_lookup_node(t, 0) == NULL); - assert(radix_tree_lookup_node(t, 1000) == NULL); - assert(radix_tree_gang_lookup_node(t, 0, results, 3) == 0); - assert(radix_tree_gang_lookup_node(t, 1000, results, 3) == 0); - assert(radix_tree_gang_lookup_node_reverse(t, 0, results, 3) == 0); - assert(radix_tree_gang_lookup_node_reverse(t, 1000, results, 3) == 0); - assert(radix_tree_gang_lookup_tagged_node(t, 0, results, 3, 0) == 0); - assert(radix_tree_gang_lookup_tagged_node(t, 1000, results, 3, 0) == 0); - assert(radix_tree_gang_lookup_tagged_node_reverse(t, 0, results, 3, 0) - == 0); - assert(radix_tree_gang_lookup_tagged_node_reverse(t, 1000, results, 3, - 0) == 0); - assert(radix_tree_empty_tree_p(t)); - assert(radix_tree_empty_tagged_tree_p(t, 0)); - assert(radix_tree_empty_tagged_tree_p(t, 1)); - assert(radix_tree_insert_node(t, 0, (void *)0xdeadbea0) == 0); - assert(!radix_tree_empty_tree_p(t)); - assert(radix_tree_empty_tagged_tree_p(t, 0)); - assert(radix_tree_empty_tagged_tree_p(t, 1)); - assert(radix_tree_lookup_node(t, 0) == (void *)0xdeadbea0); - assert(radix_tree_lookup_node(t, 1000) == NULL); - memset(results, 0, sizeof(results)); - assert(radix_tree_gang_lookup_node(t, 0, results, 3) == 1); - assert(results[0] == (void *)0xdeadbea0); - assert(radix_tree_gang_lookup_node(t, 1000, results, 3) == 0); - memset(results, 0, sizeof(results)); - assert(radix_tree_gang_lookup_node_reverse(t, 0, results, 3) == 1); - assert(results[0] == (void *)0xdeadbea0); - memset(results, 0, sizeof(results)); - assert(radix_tree_gang_lookup_node_reverse(t, 1000, results, 3) == 1); - assert(results[0] == (void *)0xdeadbea0); - assert(radix_tree_gang_lookup_tagged_node(t, 0, results, 3, 0) - == 0); - assert(radix_tree_gang_lookup_tagged_node_reverse(t, 0, results, 3, 0) - == 0); - assert(radix_tree_insert_node(t, 1000, (void *)0xdeadbea0) == 0); - assert(radix_tree_remove_node(t, 0) == (void *)0xdeadbea0); - assert(!radix_tree_empty_tree_p(t)); - radix_tree_dump(t); - assert(radix_tree_lookup_node(t, 0) == NULL); - assert(radix_tree_lookup_node(t, 1000) == (void *)0xdeadbea0); - memset(results, 0, sizeof(results)); - assert(radix_tree_gang_lookup_node(t, 0, results, 3) == 1); - assert(results[0] == (void *)0xdeadbea0); - memset(results, 0, sizeof(results)); - assert(radix_tree_gang_lookup_node(t, 1000, results, 3) == 1); - assert(results[0] == (void *)0xdeadbea0); - assert(radix_tree_gang_lookup_node_reverse(t, 0, results, 3) == 0); - memset(results, 0, sizeof(results)); - assert(radix_tree_gang_lookup_node_reverse(t, 1000, results, 3) == 1); - assert(results[0] == (void *)0xdeadbea0); - assert(radix_tree_gang_lookup_tagged_node(t, 0, results, 3, 0) - == 0); - assert(radix_tree_gang_lookup_tagged_node_reverse(t, 0, results, 3, 0) - == 0); - assert(!radix_tree_get_tag(t, 1000, 0)); - assert(!radix_tree_get_tag(t, 1000, 1)); - assert(radix_tree_empty_tagged_tree_p(t, 0)); - assert(radix_tree_empty_tagged_tree_p(t, 1)); - radix_tree_set_tag(t, 1000, 1); - assert(!radix_tree_get_tag(t, 1000, 0)); - assert(radix_tree_get_tag(t, 1000, 1)); - assert(radix_tree_empty_tagged_tree_p(t, 0)); - assert(!radix_tree_empty_tagged_tree_p(t, 1)); - radix_tree_dump(t); - assert(radix_tree_lookup_node(t, 1000) == (void *)0xdeadbea0); - assert(radix_tree_insert_node(t, 0, (void *)0xbea0) == 0); - radix_tree_dump(t); - assert(radix_tree_lookup_node(t, 0) == (void *)0xbea0); - assert(radix_tree_lookup_node(t, 1000) == (void *)0xdeadbea0); - assert(radix_tree_insert_node(t, UINT64_C(10000000000), (void *)0xdea0) - == 0); - radix_tree_dump(t); - assert(radix_tree_lookup_node(t, 0) == (void *)0xbea0); - assert(radix_tree_lookup_node(t, 1000) == (void *)0xdeadbea0); - assert(radix_tree_lookup_node(t, UINT64_C(10000000000)) == - (void *)0xdea0); - radix_tree_dump(t); - assert(!radix_tree_get_tag(t, 0, 1)); - assert(radix_tree_get_tag(t, 1000, 1)); - assert(!radix_tree_get_tag(t, UINT64_C(10000000000), 1)); - radix_tree_set_tag(t, 0, 1);; - radix_tree_set_tag(t, UINT64_C(10000000000), 1); - radix_tree_dump(t); - assert(radix_tree_get_tag(t, 0, 1)); - assert(radix_tree_get_tag(t, 1000, 1)); - assert(radix_tree_get_tag(t, UINT64_C(10000000000), 1)); - radix_tree_clear_tag(t, 0, 1);; - radix_tree_clear_tag(t, UINT64_C(10000000000), 1); - radix_tree_dump(t); - assert(!radix_tree_get_tag(t, 0, 1)); - assert(radix_tree_get_tag(t, 1000, 1)); - assert(!radix_tree_get_tag(t, UINT64_C(10000000000), 1)); - radix_tree_dump(t); - assert(radix_tree_replace_node(t, 1000, (void *)0x12345678) == - (void *)0xdeadbea0); - assert(!radix_tree_get_tag(t, 1000, 0)); - assert(radix_tree_get_tag(t, 1000, 1)); - assert(radix_tree_gang_lookup_node(t, 0, results, 3) == 3); - assert(results[0] == (void *)0xbea0); - assert(results[1] == (void *)0x12345678); - assert(results[2] == (void *)0xdea0); - assert(radix_tree_gang_lookup_node(t, 1, results, 3) == 2); - assert(results[0] == (void *)0x12345678); - assert(results[1] == (void *)0xdea0); - assert(radix_tree_gang_lookup_node(t, 1001, results, 3) == 1); - assert(results[0] == (void *)0xdea0); - assert(radix_tree_gang_lookup_node(t, UINT64_C(10000000001), results, 3) - == 0); - assert(radix_tree_gang_lookup_node(t, UINT64_C(1000000000000), results, - 3) == 0); - assert(radix_tree_gang_lookup_tagged_node(t, 0, results, 100, 1) == 1); - assert(results[0] == (void *)0x12345678); - assert(entry_tagmask(t->t_root) != 0); - assert(radix_tree_remove_node(t, 1000) == (void *)0x12345678); - assert(entry_tagmask(t->t_root) == 0); - radix_tree_dump(t); - assert(radix_tree_remove_node(t, UINT64_C(10000000000)) == - (void *)0xdea0); - radix_tree_dump(t); - assert(radix_tree_remove_node(t, 0) == (void *)0xbea0); - radix_tree_dump(t); - radix_tree_fini_tree(t); -} - -#include - -struct testnode { - uint64_t idx; - bool tagged[RADIX_TREE_TAG_ID_MAX]; -}; - -static void -printops(const char *title, const char *name, int tag, unsigned int n, - const struct timeval *stv, const struct timeval *etv) -{ - uint64_t s = stv->tv_sec * 1000000 + stv->tv_usec; - uint64_t e = etv->tv_sec * 1000000 + etv->tv_usec; - - printf("RESULT %s %s %d %lf op/s\n", title, name, tag, - (double)n / (e - s) * 1000000); -} - -#define TEST2_GANG_LOOKUP_NODES 16 - -static bool -test2_should_tag(unsigned int i, radix_tree_tagid_t tagid) -{ - - if (tagid == 0) { - return (i & 0x3) == 0; /* 25% */ - } else { - return (i % 7) == 0; /* 14% */ - } -} - -static void -test2(const char *title, bool dense) -{ - struct radix_tree s; - struct radix_tree *t = &s; - struct testnode *n; - unsigned int i; - unsigned int nnodes = 100000; - unsigned int removed; - radix_tree_tagid_t tag; - unsigned int ntagged[RADIX_TREE_TAG_ID_MAX]; - struct testnode *nodes; - struct timeval stv; - struct timeval etv; - - nodes = malloc(nnodes * sizeof(*nodes)); - for (tag = 0; tag < RADIX_TREE_TAG_ID_MAX; tag++) { - ntagged[tag] = 0; - } - radix_tree_init_tree(t); - for (i = 0; i < nnodes; i++) { - n = &nodes[i]; - n->idx = random(); - if (sizeof(long) == 4) { - n->idx <<= 32; - n->idx |= (uint32_t)random(); - } - if (dense) { - n->idx %= nnodes * 2; - } - while (radix_tree_lookup_node(t, n->idx) != NULL) { - n->idx++; - } - radix_tree_insert_node(t, n->idx, n); - for (tag = 0; tag < RADIX_TREE_TAG_ID_MAX; tag++) { - n->tagged[tag] = test2_should_tag(i, tag); - if (n->tagged[tag]) { - radix_tree_set_tag(t, n->idx, tag); - ntagged[tag]++; - } - assert(n->tagged[tag] == - radix_tree_get_tag(t, n->idx, tag)); - } - } - - gettimeofday(&stv, NULL); - for (i = 0; i < nnodes; i++) { - n = &nodes[i]; - assert(radix_tree_lookup_node(t, n->idx) == n); - } - gettimeofday(&etv, NULL); - printops(title, "lookup", 0, nnodes, &stv, &etv); - - for (tag = 0; tag < RADIX_TREE_TAG_ID_MAX; tag++) { - unsigned int count = 0; - - gettimeofday(&stv, NULL); - for (i = 0; i < nnodes; i++) { - bool tagged; - - n = &nodes[i]; - tagged = radix_tree_get_tag(t, n->idx, tag); - assert(n->tagged[tag] == tagged); - if (tagged) { - count++; - } - } - gettimeofday(&etv, NULL); - assert(ntagged[tag] == count); - printops(title, "get_tag", tag, nnodes, &stv, &etv); - } - - gettimeofday(&stv, NULL); - for (i = 0; i < nnodes; i++) { - n = &nodes[i]; - radix_tree_remove_node(t, n->idx); - } - gettimeofday(&etv, NULL); - printops(title, "remove", 0, nnodes, &stv, &etv); - - gettimeofday(&stv, NULL); - for (i = 0; i < nnodes; i++) { - n = &nodes[i]; - radix_tree_insert_node(t, n->idx, n); - } - gettimeofday(&etv, NULL); - printops(title, "insert", 0, nnodes, &stv, &etv); - - for (tag = 0; tag < RADIX_TREE_TAG_ID_MAX; tag++) { - ntagged[tag] = 0; - gettimeofday(&stv, NULL); - for (i = 0; i < nnodes; i++) { - n = &nodes[i]; - if (n->tagged[tag]) { - radix_tree_set_tag(t, n->idx, tag); - ntagged[tag]++; - } - } - gettimeofday(&etv, NULL); - printops(title, "set_tag", tag, ntagged[tag], &stv, &etv); - } - - gettimeofday(&stv, NULL); - { - struct testnode *results[TEST2_GANG_LOOKUP_NODES]; - uint64_t nextidx; - unsigned int nfound; - unsigned int total; - - nextidx = 0; - total = 0; - while ((nfound = radix_tree_gang_lookup_node(t, nextidx, - (void *)results, __arraycount(results))) > 0) { - nextidx = results[nfound - 1]->idx + 1; - total += nfound; - if (nextidx == 0) { - break; - } - } - assert(total == nnodes); - } - gettimeofday(&etv, NULL); - printops(title, "ganglookup", 0, nnodes, &stv, &etv); - - gettimeofday(&stv, NULL); - { - struct testnode *results[TEST2_GANG_LOOKUP_NODES]; - uint64_t nextidx; - unsigned int nfound; - unsigned int total; - - nextidx = UINT64_MAX; - total = 0; - while ((nfound = radix_tree_gang_lookup_node_reverse(t, nextidx, - (void *)results, __arraycount(results))) > 0) { - nextidx = results[nfound - 1]->idx - 1; - total += nfound; - if (nextidx == UINT64_MAX) { - break; - } - } - assert(total == nnodes); - } - gettimeofday(&etv, NULL); - printops(title, "ganglookup_reverse", 0, nnodes, &stv, &etv); - - for (tag = 0; tag < RADIX_TREE_TAG_ID_MAX; tag++) { - gettimeofday(&stv, NULL); - { - struct testnode *results[TEST2_GANG_LOOKUP_NODES]; - uint64_t nextidx; - unsigned int nfound; - unsigned int total; - - nextidx = 0; - total = 0; - while ((nfound = radix_tree_gang_lookup_tagged_node(t, - nextidx, (void *)results, __arraycount(results), - tag)) > 0) { - nextidx = results[nfound - 1]->idx + 1; - total += nfound; - } - assert(total == ntagged[tag]); - } - gettimeofday(&etv, NULL); - printops(title, "ganglookup_tag", tag, ntagged[tag], &stv, - &etv); - } - - for (tag = 0; tag < RADIX_TREE_TAG_ID_MAX; tag++) { - gettimeofday(&stv, NULL); - { - struct testnode *results[TEST2_GANG_LOOKUP_NODES]; - uint64_t nextidx; - unsigned int nfound; - unsigned int total; - - nextidx = UINT64_MAX; - total = 0; - while ((nfound = - radix_tree_gang_lookup_tagged_node_reverse(t, - nextidx, (void *)results, __arraycount(results), - tag)) > 0) { - nextidx = results[nfound - 1]->idx - 1; - total += nfound; - if (nextidx == UINT64_MAX) { - break; - } - } - assert(total == ntagged[tag]); - } - gettimeofday(&etv, NULL); - printops(title, "ganglookup_tag_reverse", tag, ntagged[tag], - &stv, &etv); - } - - removed = 0; - for (tag = 0; tag < RADIX_TREE_TAG_ID_MAX; tag++) { - unsigned int total; - - total = 0; - gettimeofday(&stv, NULL); - { - struct testnode *results[TEST2_GANG_LOOKUP_NODES]; - uint64_t nextidx; - unsigned int nfound; - - nextidx = 0; - while ((nfound = radix_tree_gang_lookup_tagged_node(t, - nextidx, (void *)results, __arraycount(results), - tag)) > 0) { - for (i = 0; i < nfound; i++) { - radix_tree_remove_node(t, - results[i]->idx); - } - nextidx = results[nfound - 1]->idx + 1; - total += nfound; - if (nextidx == 0) { - break; - } - } - assert(tag != 0 || total == ntagged[tag]); - assert(total <= ntagged[tag]); - } - gettimeofday(&etv, NULL); - printops(title, "ganglookup_tag+remove", tag, total, &stv, - &etv); - removed += total; - } - - gettimeofday(&stv, NULL); - { - struct testnode *results[TEST2_GANG_LOOKUP_NODES]; - uint64_t nextidx; - unsigned int nfound; - unsigned int total; - - nextidx = 0; - total = 0; - while ((nfound = radix_tree_gang_lookup_node(t, nextidx, - (void *)results, __arraycount(results))) > 0) { - for (i = 0; i < nfound; i++) { - assert(results[i] == radix_tree_remove_node(t, - results[i]->idx)); - } - nextidx = results[nfound - 1]->idx + 1; - total += nfound; - if (nextidx == 0) { - break; - } - } - assert(total == nnodes - removed); - } - gettimeofday(&etv, NULL); - printops(title, "ganglookup+remove", 0, nnodes - removed, &stv, &etv); - - assert(radix_tree_empty_tree_p(t)); - assert(radix_tree_empty_tagged_tree_p(t, 0)); - assert(radix_tree_empty_tagged_tree_p(t, 1)); - radix_tree_fini_tree(t); - free(nodes); -} - -int -main(int argc, char *argv[]) -{ - - test1(); - test2("dense", true); - test2("sparse", false); - return 0; -} - -#endif /* defined(UNITTEST) */ diff --git a/common/lib/libc/gen/rb.c b/common/lib/libc/gen/rb.c deleted file mode 100644 index 081f52dfe..000000000 --- a/common/lib/libc/gen/rb.c +++ /dev/null @@ -1,1337 +0,0 @@ -/* $NetBSD: rb.c,v 1.13 2014/08/22 17:19:48 matt Exp $ */ - -/*- - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#include -#ifdef RBDEBUG -#define KASSERT(s) assert(s) -#else -#define KASSERT(s) do { } while (/*CONSTCOND*/ 0) -#endif -__RCSID("$NetBSD: rb.c,v 1.13 2014/08/22 17:19:48 matt Exp $"); -#else -#include -__KERNEL_RCSID(0, "$NetBSD: rb.c,v 1.13 2014/08/22 17:19:48 matt Exp $"); -#endif - -#ifdef _LIBC -__weak_alias(rb_tree_init, _rb_tree_init) -__weak_alias(rb_tree_find_node, _rb_tree_find_node) -__weak_alias(rb_tree_find_node_geq, _rb_tree_find_node_geq) -__weak_alias(rb_tree_find_node_leq, _rb_tree_find_node_leq) -__weak_alias(rb_tree_insert_node, _rb_tree_insert_node) -__weak_alias(rb_tree_remove_node, _rb_tree_remove_node) -__weak_alias(rb_tree_iterate, _rb_tree_iterate) -#ifdef RBDEBUG -__weak_alias(rb_tree_check, _rb_tree_check) -__weak_alias(rb_tree_depths, _rb_tree_depths) -#endif - -#include "namespace.h" -#endif - -#ifdef RBTEST -#include "rbtree.h" -#else -#include -#endif - -static void rb_tree_insert_rebalance(struct rb_tree *, struct rb_node *); -static void rb_tree_removal_rebalance(struct rb_tree *, struct rb_node *, - unsigned int); -#ifdef RBDEBUG -static const struct rb_node *rb_tree_iterate_const(const struct rb_tree *, - const struct rb_node *, const unsigned int); -static bool rb_tree_check_node(const struct rb_tree *, const struct rb_node *, - const struct rb_node *, bool); -#else -#define rb_tree_check_node(a, b, c, d) true -#endif - -#define RB_NODETOITEM(rbto, rbn) \ - ((void *)((uintptr_t)(rbn) - (rbto)->rbto_node_offset)) -#define RB_ITEMTONODE(rbto, rbn) \ - ((rb_node_t *)((uintptr_t)(rbn) + (rbto)->rbto_node_offset)) - -#define RB_SENTINEL_NODE NULL - -void -rb_tree_init(struct rb_tree *rbt, const rb_tree_ops_t *ops) -{ - - rbt->rbt_ops = ops; - rbt->rbt_root = RB_SENTINEL_NODE; - RB_TAILQ_INIT(&rbt->rbt_nodes); -#ifndef RBSMALL - rbt->rbt_minmax[RB_DIR_LEFT] = rbt->rbt_root; /* minimum node */ - rbt->rbt_minmax[RB_DIR_RIGHT] = rbt->rbt_root; /* maximum node */ -#endif -#ifdef RBSTATS - rbt->rbt_count = 0; - rbt->rbt_insertions = 0; - rbt->rbt_removals = 0; - rbt->rbt_insertion_rebalance_calls = 0; - rbt->rbt_insertion_rebalance_passes = 0; - rbt->rbt_removal_rebalance_calls = 0; - rbt->rbt_removal_rebalance_passes = 0; -#endif -} - -void * -rb_tree_find_node(struct rb_tree *rbt, const void *key) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - rbto_compare_key_fn compare_key = rbto->rbto_compare_key; - struct rb_node *parent = rbt->rbt_root; - - while (!RB_SENTINEL_P(parent)) { - void *pobj = RB_NODETOITEM(rbto, parent); - const signed int diff = (*compare_key)(rbto->rbto_context, - pobj, key); - if (diff == 0) - return pobj; - parent = parent->rb_nodes[diff < 0]; - } - - return NULL; -} - -void * -rb_tree_find_node_geq(struct rb_tree *rbt, const void *key) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - rbto_compare_key_fn compare_key = rbto->rbto_compare_key; - struct rb_node *parent = rbt->rbt_root, *last = NULL; - - while (!RB_SENTINEL_P(parent)) { - void *pobj = RB_NODETOITEM(rbto, parent); - const signed int diff = (*compare_key)(rbto->rbto_context, - pobj, key); - if (diff == 0) - return pobj; - if (diff > 0) - last = parent; - parent = parent->rb_nodes[diff < 0]; - } - - return last == NULL ? NULL : RB_NODETOITEM(rbto, last); -} - -void * -rb_tree_find_node_leq(struct rb_tree *rbt, const void *key) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - rbto_compare_key_fn compare_key = rbto->rbto_compare_key; - struct rb_node *parent = rbt->rbt_root, *last = NULL; - - while (!RB_SENTINEL_P(parent)) { - void *pobj = RB_NODETOITEM(rbto, parent); - const signed int diff = (*compare_key)(rbto->rbto_context, - pobj, key); - if (diff == 0) - return pobj; - if (diff < 0) - last = parent; - parent = parent->rb_nodes[diff < 0]; - } - - return last == NULL ? NULL : RB_NODETOITEM(rbto, last); -} - -void * -rb_tree_insert_node(struct rb_tree *rbt, void *object) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - rbto_compare_nodes_fn compare_nodes = rbto->rbto_compare_nodes; - struct rb_node *parent, *tmp, *self = RB_ITEMTONODE(rbto, object); - unsigned int position; - bool rebalance; - - RBSTAT_INC(rbt->rbt_insertions); - - tmp = rbt->rbt_root; - /* - * This is a hack. Because rbt->rbt_root is just a struct rb_node *, - * just like rb_node->rb_nodes[RB_DIR_LEFT], we can use this fact to - * avoid a lot of tests for root and know that even at root, - * updating RB_FATHER(rb_node)->rb_nodes[RB_POSITION(rb_node)] will - * update rbt->rbt_root. - */ - parent = (struct rb_node *)(void *)&rbt->rbt_root; - position = RB_DIR_LEFT; - - /* - * Find out where to place this new leaf. - */ - while (!RB_SENTINEL_P(tmp)) { - void *tobj = RB_NODETOITEM(rbto, tmp); - const signed int diff = (*compare_nodes)(rbto->rbto_context, - tobj, object); - if (__predict_false(diff == 0)) { - /* - * Node already exists; return it. - */ - return tobj; - } - parent = tmp; - position = (diff < 0); - tmp = parent->rb_nodes[position]; - } - -#ifdef RBDEBUG - { - struct rb_node *prev = NULL, *next = NULL; - - if (position == RB_DIR_RIGHT) - prev = parent; - else if (tmp != rbt->rbt_root) - next = parent; - - /* - * Verify our sequential position - */ - KASSERT(prev == NULL || !RB_SENTINEL_P(prev)); - KASSERT(next == NULL || !RB_SENTINEL_P(next)); - if (prev != NULL && next == NULL) - next = TAILQ_NEXT(prev, rb_link); - if (prev == NULL && next != NULL) - prev = TAILQ_PREV(next, rb_node_qh, rb_link); - KASSERT(prev == NULL || !RB_SENTINEL_P(prev)); - KASSERT(next == NULL || !RB_SENTINEL_P(next)); - KASSERT(prev == NULL || (*compare_nodes)(rbto->rbto_context, - RB_NODETOITEM(rbto, prev), RB_NODETOITEM(rbto, self)) < 0); - KASSERT(next == NULL || (*compare_nodes)(rbto->rbto_context, - RB_NODETOITEM(rbto, self), RB_NODETOITEM(rbto, next)) < 0); - } -#endif - - /* - * Initialize the node and insert as a leaf into the tree. - */ - RB_SET_FATHER(self, parent); - RB_SET_POSITION(self, position); - if (__predict_false(parent == (struct rb_node *)(void *)&rbt->rbt_root)) { - RB_MARK_BLACK(self); /* root is always black */ -#ifndef RBSMALL - rbt->rbt_minmax[RB_DIR_LEFT] = self; - rbt->rbt_minmax[RB_DIR_RIGHT] = self; -#endif - rebalance = false; - } else { - KASSERT(position == RB_DIR_LEFT || position == RB_DIR_RIGHT); -#ifndef RBSMALL - /* - * Keep track of the minimum and maximum nodes. If our - * parent is a minmax node and we on their min/max side, - * we must be the new min/max node. - */ - if (parent == rbt->rbt_minmax[position]) - rbt->rbt_minmax[position] = self; -#endif /* !RBSMALL */ - /* - * All new nodes are colored red. We only need to rebalance - * if our parent is also red. - */ - RB_MARK_RED(self); - rebalance = RB_RED_P(parent); - } - KASSERT(RB_SENTINEL_P(parent->rb_nodes[position])); - self->rb_left = parent->rb_nodes[position]; - self->rb_right = parent->rb_nodes[position]; - parent->rb_nodes[position] = self; - KASSERT(RB_CHILDLESS_P(self)); - - /* - * Insert the new node into a sorted list for easy sequential access - */ - RBSTAT_INC(rbt->rbt_count); -#ifdef RBDEBUG - if (RB_ROOT_P(rbt, self)) { - RB_TAILQ_INSERT_HEAD(&rbt->rbt_nodes, self, rb_link); - } else if (position == RB_DIR_LEFT) { - KASSERT((*compare_nodes)(rbto->rbto_context, - RB_NODETOITEM(rbto, self), - RB_NODETOITEM(rbto, RB_FATHER(self))) < 0); - RB_TAILQ_INSERT_BEFORE(RB_FATHER(self), self, rb_link); - } else { - KASSERT((*compare_nodes)(rbto->rbto_context, - RB_NODETOITEM(rbto, RB_FATHER(self)), - RB_NODETOITEM(rbto, self)) < 0); - RB_TAILQ_INSERT_AFTER(&rbt->rbt_nodes, RB_FATHER(self), - self, rb_link); - } -#endif - KASSERT(rb_tree_check_node(rbt, self, NULL, !rebalance)); - - /* - * Rebalance tree after insertion - */ - if (rebalance) { - rb_tree_insert_rebalance(rbt, self); - KASSERT(rb_tree_check_node(rbt, self, NULL, true)); - } - - /* Succesfully inserted, return our node pointer. */ - return object; -} - -/* - * Swap the location and colors of 'self' and its child @ which. The child - * can not be a sentinel node. This is our rotation function. However, - * since it preserves coloring, it great simplifies both insertion and - * removal since rotation almost always involves the exchanging of colors - * as a separate step. - */ -/*ARGSUSED*/ -static void -rb_tree_reparent_nodes(struct rb_tree *rbt, struct rb_node *old_father, - const unsigned int which) -{ - const unsigned int other = which ^ RB_DIR_OTHER; - struct rb_node * const grandpa = RB_FATHER(old_father); - struct rb_node * const old_child = old_father->rb_nodes[which]; - struct rb_node * const new_father = old_child; - struct rb_node * const new_child = old_father; - - KASSERT(which == RB_DIR_LEFT || which == RB_DIR_RIGHT); - - KASSERT(!RB_SENTINEL_P(old_child)); - KASSERT(RB_FATHER(old_child) == old_father); - - KASSERT(rb_tree_check_node(rbt, old_father, NULL, false)); - KASSERT(rb_tree_check_node(rbt, old_child, NULL, false)); - KASSERT(RB_ROOT_P(rbt, old_father) || - rb_tree_check_node(rbt, grandpa, NULL, false)); - - /* - * Exchange descendant linkages. - */ - grandpa->rb_nodes[RB_POSITION(old_father)] = new_father; - new_child->rb_nodes[which] = old_child->rb_nodes[other]; - new_father->rb_nodes[other] = new_child; - - /* - * Update ancestor linkages - */ - RB_SET_FATHER(new_father, grandpa); - RB_SET_FATHER(new_child, new_father); - - /* - * Exchange properties between new_father and new_child. The only - * change is that new_child's position is now on the other side. - */ -#if 0 - { - struct rb_node tmp; - tmp.rb_info = 0; - RB_COPY_PROPERTIES(&tmp, old_child); - RB_COPY_PROPERTIES(new_father, old_father); - RB_COPY_PROPERTIES(new_child, &tmp); - } -#else - RB_SWAP_PROPERTIES(new_father, new_child); -#endif - RB_SET_POSITION(new_child, other); - - /* - * Make sure to reparent the new child to ourself. - */ - if (!RB_SENTINEL_P(new_child->rb_nodes[which])) { - RB_SET_FATHER(new_child->rb_nodes[which], new_child); - RB_SET_POSITION(new_child->rb_nodes[which], which); - } - - KASSERT(rb_tree_check_node(rbt, new_father, NULL, false)); - KASSERT(rb_tree_check_node(rbt, new_child, NULL, false)); - KASSERT(RB_ROOT_P(rbt, new_father) || - rb_tree_check_node(rbt, grandpa, NULL, false)); -} - -static void -rb_tree_insert_rebalance(struct rb_tree *rbt, struct rb_node *self) -{ - struct rb_node * father = RB_FATHER(self); - struct rb_node * grandpa = RB_FATHER(father); - struct rb_node * uncle; - unsigned int which; - unsigned int other; - - KASSERT(!RB_ROOT_P(rbt, self)); - KASSERT(RB_RED_P(self)); - KASSERT(RB_RED_P(father)); - RBSTAT_INC(rbt->rbt_insertion_rebalance_calls); - - for (;;) { - KASSERT(!RB_SENTINEL_P(self)); - - KASSERT(RB_RED_P(self)); - KASSERT(RB_RED_P(father)); - /* - * We are red and our parent is red, therefore we must have a - * grandfather and he must be black. - */ - grandpa = RB_FATHER(father); - KASSERT(RB_BLACK_P(grandpa)); - KASSERT(RB_DIR_RIGHT == 1 && RB_DIR_LEFT == 0); - which = (father == grandpa->rb_right); - other = which ^ RB_DIR_OTHER; - uncle = grandpa->rb_nodes[other]; - - if (RB_BLACK_P(uncle)) - break; - - RBSTAT_INC(rbt->rbt_insertion_rebalance_passes); - /* - * Case 1: our uncle is red - * Simply invert the colors of our parent and - * uncle and make our grandparent red. And - * then solve the problem up at his level. - */ - RB_MARK_BLACK(uncle); - RB_MARK_BLACK(father); - if (__predict_false(RB_ROOT_P(rbt, grandpa))) { - /* - * If our grandpa is root, don't bother - * setting him to red, just return. - */ - KASSERT(RB_BLACK_P(grandpa)); - return; - } - RB_MARK_RED(grandpa); - self = grandpa; - father = RB_FATHER(self); - KASSERT(RB_RED_P(self)); - if (RB_BLACK_P(father)) { - /* - * If our greatgrandpa is black, we're done. - */ - KASSERT(RB_BLACK_P(rbt->rbt_root)); - return; - } - } - - KASSERT(!RB_ROOT_P(rbt, self)); - KASSERT(RB_RED_P(self)); - KASSERT(RB_RED_P(father)); - KASSERT(RB_BLACK_P(uncle)); - KASSERT(RB_BLACK_P(grandpa)); - /* - * Case 2&3: our uncle is black. - */ - if (self == father->rb_nodes[other]) { - /* - * Case 2: we are on the same side as our uncle - * Swap ourselves with our parent so this case - * becomes case 3. Basically our parent becomes our - * child. - */ - rb_tree_reparent_nodes(rbt, father, other); - KASSERT(RB_FATHER(father) == self); - KASSERT(self->rb_nodes[which] == father); - KASSERT(RB_FATHER(self) == grandpa); - self = father; - father = RB_FATHER(self); - } - KASSERT(RB_RED_P(self) && RB_RED_P(father)); - KASSERT(grandpa->rb_nodes[which] == father); - /* - * Case 3: we are opposite a child of a black uncle. - * Swap our parent and grandparent. Since our grandfather - * is black, our father will become black and our new sibling - * (former grandparent) will become red. - */ - rb_tree_reparent_nodes(rbt, grandpa, which); - KASSERT(RB_FATHER(self) == father); - KASSERT(RB_FATHER(self)->rb_nodes[RB_POSITION(self) ^ RB_DIR_OTHER] == grandpa); - KASSERT(RB_RED_P(self)); - KASSERT(RB_BLACK_P(father)); - KASSERT(RB_RED_P(grandpa)); - - /* - * Final step: Set the root to black. - */ - RB_MARK_BLACK(rbt->rbt_root); -} - -static void -rb_tree_prune_node(struct rb_tree *rbt, struct rb_node *self, bool rebalance) -{ - const unsigned int which = RB_POSITION(self); - struct rb_node *father = RB_FATHER(self); -#ifndef RBSMALL - const bool was_root = RB_ROOT_P(rbt, self); -#endif - - KASSERT(rebalance || (RB_ROOT_P(rbt, self) || RB_RED_P(self))); - KASSERT(!rebalance || RB_BLACK_P(self)); - KASSERT(RB_CHILDLESS_P(self)); - KASSERT(rb_tree_check_node(rbt, self, NULL, false)); - - /* - * Since we are childless, we know that self->rb_left is pointing - * to the sentinel node. - */ - father->rb_nodes[which] = self->rb_left; - - /* - * Remove ourselves from the node list, decrement the count, - * and update min/max. - */ - RB_TAILQ_REMOVE(&rbt->rbt_nodes, self, rb_link); - RBSTAT_DEC(rbt->rbt_count); -#ifndef RBSMALL - if (__predict_false(rbt->rbt_minmax[RB_POSITION(self)] == self)) { - rbt->rbt_minmax[RB_POSITION(self)] = father; - /* - * When removing the root, rbt->rbt_minmax[RB_DIR_LEFT] is - * updated automatically, but we also need to update - * rbt->rbt_minmax[RB_DIR_RIGHT]; - */ - if (__predict_false(was_root)) { - rbt->rbt_minmax[RB_DIR_RIGHT] = father; - } - } - RB_SET_FATHER(self, NULL); -#endif - - /* - * Rebalance if requested. - */ - if (rebalance) - rb_tree_removal_rebalance(rbt, father, which); - KASSERT(was_root || rb_tree_check_node(rbt, father, NULL, true)); -} - -/* - * When deleting an interior node - */ -static void -rb_tree_swap_prune_and_rebalance(struct rb_tree *rbt, struct rb_node *self, - struct rb_node *standin) -{ - const unsigned int standin_which = RB_POSITION(standin); - unsigned int standin_other = standin_which ^ RB_DIR_OTHER; - struct rb_node *standin_son; - struct rb_node *standin_father = RB_FATHER(standin); - bool rebalance = RB_BLACK_P(standin); - - if (standin_father == self) { - /* - * As a child of self, any childen would be opposite of - * our parent. - */ - KASSERT(RB_SENTINEL_P(standin->rb_nodes[standin_other])); - standin_son = standin->rb_nodes[standin_which]; - } else { - /* - * Since we aren't a child of self, any childen would be - * on the same side as our parent. - */ - KASSERT(RB_SENTINEL_P(standin->rb_nodes[standin_which])); - standin_son = standin->rb_nodes[standin_other]; - } - - /* - * the node we are removing must have two children. - */ - KASSERT(RB_TWOCHILDREN_P(self)); - /* - * If standin has a child, it must be red. - */ - KASSERT(RB_SENTINEL_P(standin_son) || RB_RED_P(standin_son)); - - /* - * Verify things are sane. - */ - KASSERT(rb_tree_check_node(rbt, self, NULL, false)); - KASSERT(rb_tree_check_node(rbt, standin, NULL, false)); - - if (__predict_false(RB_RED_P(standin_son))) { - /* - * We know we have a red child so if we flip it to black - * we don't have to rebalance. - */ - KASSERT(rb_tree_check_node(rbt, standin_son, NULL, true)); - RB_MARK_BLACK(standin_son); - rebalance = false; - - if (standin_father == self) { - KASSERT(RB_POSITION(standin_son) == standin_which); - } else { - KASSERT(RB_POSITION(standin_son) == standin_other); - /* - * Change the son's parentage to point to his grandpa. - */ - RB_SET_FATHER(standin_son, standin_father); - RB_SET_POSITION(standin_son, standin_which); - } - } - - if (standin_father == self) { - /* - * If we are about to delete the standin's father, then when - * we call rebalance, we need to use ourselves as our father. - * Otherwise remember our original father. Also, sincef we are - * our standin's father we only need to reparent the standin's - * brother. - * - * | R --> S | - * | Q S --> Q T | - * | t --> | - */ - KASSERT(RB_SENTINEL_P(standin->rb_nodes[standin_other])); - KASSERT(!RB_SENTINEL_P(self->rb_nodes[standin_other])); - KASSERT(self->rb_nodes[standin_which] == standin); - /* - * Have our son/standin adopt his brother as his new son. - */ - standin_father = standin; - } else { - /* - * | R --> S . | - * | / \ | T --> / \ | / | - * | ..... | S --> ..... | T | - * - * Sever standin's connection to his father. - */ - standin_father->rb_nodes[standin_which] = standin_son; - /* - * Adopt the far son. - */ - standin->rb_nodes[standin_other] = self->rb_nodes[standin_other]; - RB_SET_FATHER(standin->rb_nodes[standin_other], standin); - KASSERT(RB_POSITION(self->rb_nodes[standin_other]) == standin_other); - /* - * Use standin_other because we need to preserve standin_which - * for the removal_rebalance. - */ - standin_other = standin_which; - } - - /* - * Move the only remaining son to our standin. If our standin is our - * son, this will be the only son needed to be moved. - */ - KASSERT(standin->rb_nodes[standin_other] != self->rb_nodes[standin_other]); - standin->rb_nodes[standin_other] = self->rb_nodes[standin_other]; - RB_SET_FATHER(standin->rb_nodes[standin_other], standin); - - /* - * Now copy the result of self to standin and then replace - * self with standin in the tree. - */ - RB_COPY_PROPERTIES(standin, self); - RB_SET_FATHER(standin, RB_FATHER(self)); - RB_FATHER(standin)->rb_nodes[RB_POSITION(standin)] = standin; - - /* - * Remove ourselves from the node list, decrement the count, - * and update min/max. - */ - RB_TAILQ_REMOVE(&rbt->rbt_nodes, self, rb_link); - RBSTAT_DEC(rbt->rbt_count); -#ifndef RBSMALL - if (__predict_false(rbt->rbt_minmax[RB_POSITION(self)] == self)) - rbt->rbt_minmax[RB_POSITION(self)] = RB_FATHER(self); - RB_SET_FATHER(self, NULL); -#endif - - KASSERT(rb_tree_check_node(rbt, standin, NULL, false)); - KASSERT(RB_FATHER_SENTINEL_P(standin) - || rb_tree_check_node(rbt, standin_father, NULL, false)); - KASSERT(RB_LEFT_SENTINEL_P(standin) - || rb_tree_check_node(rbt, standin->rb_left, NULL, false)); - KASSERT(RB_RIGHT_SENTINEL_P(standin) - || rb_tree_check_node(rbt, standin->rb_right, NULL, false)); - - if (!rebalance) - return; - - rb_tree_removal_rebalance(rbt, standin_father, standin_which); - KASSERT(rb_tree_check_node(rbt, standin, NULL, true)); -} - -/* - * We could do this by doing - * rb_tree_node_swap(rbt, self, which); - * rb_tree_prune_node(rbt, self, false); - * - * But it's more efficient to just evalate and recolor the child. - */ -static void -rb_tree_prune_blackred_branch(struct rb_tree *rbt, struct rb_node *self, - unsigned int which) -{ - struct rb_node *father = RB_FATHER(self); - struct rb_node *son = self->rb_nodes[which]; -#ifndef RBSMALL - const bool was_root = RB_ROOT_P(rbt, self); -#endif - - KASSERT(which == RB_DIR_LEFT || which == RB_DIR_RIGHT); - KASSERT(RB_BLACK_P(self) && RB_RED_P(son)); - KASSERT(!RB_TWOCHILDREN_P(son)); - KASSERT(RB_CHILDLESS_P(son)); - KASSERT(rb_tree_check_node(rbt, self, NULL, false)); - KASSERT(rb_tree_check_node(rbt, son, NULL, false)); - - /* - * Remove ourselves from the tree and give our former child our - * properties (position, color, root). - */ - RB_COPY_PROPERTIES(son, self); - father->rb_nodes[RB_POSITION(son)] = son; - RB_SET_FATHER(son, father); - - /* - * Remove ourselves from the node list, decrement the count, - * and update minmax. - */ - RB_TAILQ_REMOVE(&rbt->rbt_nodes, self, rb_link); - RBSTAT_DEC(rbt->rbt_count); -#ifndef RBSMALL - if (__predict_false(was_root)) { - KASSERT(rbt->rbt_minmax[which] == son); - rbt->rbt_minmax[which ^ RB_DIR_OTHER] = son; - } else if (rbt->rbt_minmax[RB_POSITION(self)] == self) { - rbt->rbt_minmax[RB_POSITION(self)] = son; - } - RB_SET_FATHER(self, NULL); -#endif - - KASSERT(was_root || rb_tree_check_node(rbt, father, NULL, true)); - KASSERT(rb_tree_check_node(rbt, son, NULL, true)); -} - -void -rb_tree_remove_node(struct rb_tree *rbt, void *object) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - struct rb_node *standin, *self = RB_ITEMTONODE(rbto, object); - unsigned int which; - - KASSERT(!RB_SENTINEL_P(self)); - RBSTAT_INC(rbt->rbt_removals); - - /* - * In the following diagrams, we (the node to be removed) are S. Red - * nodes are lowercase. T could be either red or black. - * - * Remember the major axiom of the red-black tree: the number of - * black nodes from the root to each leaf is constant across all - * leaves, only the number of red nodes varies. - * - * Thus removing a red leaf doesn't require any other changes to a - * red-black tree. So if we must remove a node, attempt to rearrange - * the tree so we can remove a red node. - * - * The simpliest case is a childless red node or a childless root node: - * - * | T --> T | or | R --> * | - * | s --> * | - */ - if (RB_CHILDLESS_P(self)) { - const bool rebalance = RB_BLACK_P(self) && !RB_ROOT_P(rbt, self); - rb_tree_prune_node(rbt, self, rebalance); - return; - } - KASSERT(!RB_CHILDLESS_P(self)); - if (!RB_TWOCHILDREN_P(self)) { - /* - * The next simpliest case is the node we are deleting is - * black and has one red child. - * - * | T --> T --> T | - * | S --> R --> R | - * | r --> s --> * | - */ - which = RB_LEFT_SENTINEL_P(self) ? RB_DIR_RIGHT : RB_DIR_LEFT; - KASSERT(RB_BLACK_P(self)); - KASSERT(RB_RED_P(self->rb_nodes[which])); - KASSERT(RB_CHILDLESS_P(self->rb_nodes[which])); - rb_tree_prune_blackred_branch(rbt, self, which); - return; - } - KASSERT(RB_TWOCHILDREN_P(self)); - - /* - * We invert these because we prefer to remove from the inside of - * the tree. - */ - which = RB_POSITION(self) ^ RB_DIR_OTHER; - - /* - * Let's find the node closes to us opposite of our parent - * Now swap it with ourself, "prune" it, and rebalance, if needed. - */ - standin = RB_ITEMTONODE(rbto, rb_tree_iterate(rbt, object, which)); - rb_tree_swap_prune_and_rebalance(rbt, self, standin); -} - -static void -rb_tree_removal_rebalance(struct rb_tree *rbt, struct rb_node *parent, - unsigned int which) -{ - KASSERT(!RB_SENTINEL_P(parent)); - KASSERT(RB_SENTINEL_P(parent->rb_nodes[which])); - KASSERT(which == RB_DIR_LEFT || which == RB_DIR_RIGHT); - RBSTAT_INC(rbt->rbt_removal_rebalance_calls); - - while (RB_BLACK_P(parent->rb_nodes[which])) { - unsigned int other = which ^ RB_DIR_OTHER; - struct rb_node *brother = parent->rb_nodes[other]; - - RBSTAT_INC(rbt->rbt_removal_rebalance_passes); - - KASSERT(!RB_SENTINEL_P(brother)); - /* - * For cases 1, 2a, and 2b, our brother's children must - * be black and our father must be black - */ - if (RB_BLACK_P(parent) - && RB_BLACK_P(brother->rb_left) - && RB_BLACK_P(brother->rb_right)) { - if (RB_RED_P(brother)) { - /* - * Case 1: Our brother is red, swap its - * position (and colors) with our parent. - * This should now be case 2b (unless C or E - * has a red child which is case 3; thus no - * explicit branch to case 2b). - * - * B -> D - * A d -> b E - * C E -> A C - */ - KASSERT(RB_BLACK_P(parent)); - rb_tree_reparent_nodes(rbt, parent, other); - brother = parent->rb_nodes[other]; - KASSERT(!RB_SENTINEL_P(brother)); - KASSERT(RB_RED_P(parent)); - KASSERT(RB_BLACK_P(brother)); - KASSERT(rb_tree_check_node(rbt, brother, NULL, false)); - KASSERT(rb_tree_check_node(rbt, parent, NULL, false)); - } else { - /* - * Both our parent and brother are black. - * Change our brother to red, advance up rank - * and go through the loop again. - * - * B -> *B - * *A D -> A d - * C E -> C E - */ - RB_MARK_RED(brother); - KASSERT(RB_BLACK_P(brother->rb_left)); - KASSERT(RB_BLACK_P(brother->rb_right)); - if (RB_ROOT_P(rbt, parent)) - return; /* root == parent == black */ - KASSERT(rb_tree_check_node(rbt, brother, NULL, false)); - KASSERT(rb_tree_check_node(rbt, parent, NULL, false)); - which = RB_POSITION(parent); - parent = RB_FATHER(parent); - continue; - } - } - /* - * Avoid an else here so that case 2a above can hit either - * case 2b, 3, or 4. - */ - if (RB_RED_P(parent) - && RB_BLACK_P(brother) - && RB_BLACK_P(brother->rb_left) - && RB_BLACK_P(brother->rb_right)) { - KASSERT(RB_RED_P(parent)); - KASSERT(RB_BLACK_P(brother)); - KASSERT(RB_BLACK_P(brother->rb_left)); - KASSERT(RB_BLACK_P(brother->rb_right)); - /* - * We are black, our father is red, our brother and - * both nephews are black. Simply invert/exchange the - * colors of our father and brother (to black and red - * respectively). - * - * | f --> F | - * | * B --> * b | - * | N N --> N N | - */ - RB_MARK_BLACK(parent); - RB_MARK_RED(brother); - KASSERT(rb_tree_check_node(rbt, brother, NULL, true)); - break; /* We're done! */ - } else { - /* - * Our brother must be black and have at least one - * red child (it may have two). - */ - KASSERT(RB_BLACK_P(brother)); - KASSERT(RB_RED_P(brother->rb_nodes[which]) || - RB_RED_P(brother->rb_nodes[other])); - if (RB_BLACK_P(brother->rb_nodes[other])) { - /* - * Case 3: our brother is black, our near - * nephew is red, and our far nephew is black. - * Swap our brother with our near nephew. - * This result in a tree that matches case 4. - * (Our father could be red or black). - * - * | F --> F | - * | x B --> x B | - * | n --> n | - */ - KASSERT(RB_RED_P(brother->rb_nodes[which])); - rb_tree_reparent_nodes(rbt, brother, which); - KASSERT(RB_FATHER(brother) == parent->rb_nodes[other]); - brother = parent->rb_nodes[other]; - KASSERT(RB_RED_P(brother->rb_nodes[other])); - } - /* - * Case 4: our brother is black and our far nephew - * is red. Swap our father and brother locations and - * change our far nephew to black. (these can be - * done in either order so we change the color first). - * The result is a valid red-black tree and is a - * terminal case. (again we don't care about the - * father's color) - * - * If the father is red, we will get a red-black-black - * tree: - * | f -> f --> b | - * | B -> B --> F N | - * | n -> N --> | - * - * If the father is black, we will get an all black - * tree: - * | F -> F --> B | - * | B -> B --> F N | - * | n -> N --> | - * - * If we had two red nephews, then after the swap, - * our former father would have a red grandson. - */ - KASSERT(RB_BLACK_P(brother)); - KASSERT(RB_RED_P(brother->rb_nodes[other])); - RB_MARK_BLACK(brother->rb_nodes[other]); - rb_tree_reparent_nodes(rbt, parent, other); - break; /* We're done! */ - } - } - KASSERT(rb_tree_check_node(rbt, parent, NULL, true)); -} - -void * -rb_tree_iterate(struct rb_tree *rbt, void *object, const unsigned int direction) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - const unsigned int other = direction ^ RB_DIR_OTHER; - struct rb_node *self; - - KASSERT(direction == RB_DIR_LEFT || direction == RB_DIR_RIGHT); - - if (object == NULL) { -#ifndef RBSMALL - if (RB_SENTINEL_P(rbt->rbt_root)) - return NULL; - return RB_NODETOITEM(rbto, rbt->rbt_minmax[direction]); -#else - self = rbt->rbt_root; - if (RB_SENTINEL_P(self)) - return NULL; - while (!RB_SENTINEL_P(self->rb_nodes[direction])) - self = self->rb_nodes[direction]; - return RB_NODETOITEM(rbto, self); -#endif /* !RBSMALL */ - } - self = RB_ITEMTONODE(rbto, object); - KASSERT(!RB_SENTINEL_P(self)); - /* - * We can't go any further in this direction. We proceed up in the - * opposite direction until our parent is in direction we want to go. - */ - if (RB_SENTINEL_P(self->rb_nodes[direction])) { - while (!RB_ROOT_P(rbt, self)) { - if (other == RB_POSITION(self)) - return RB_NODETOITEM(rbto, RB_FATHER(self)); - self = RB_FATHER(self); - } - return NULL; - } - - /* - * Advance down one in current direction and go down as far as possible - * in the opposite direction. - */ - self = self->rb_nodes[direction]; - KASSERT(!RB_SENTINEL_P(self)); - while (!RB_SENTINEL_P(self->rb_nodes[other])) - self = self->rb_nodes[other]; - return RB_NODETOITEM(rbto, self); -} - -#ifdef RBDEBUG -static const struct rb_node * -rb_tree_iterate_const(const struct rb_tree *rbt, const struct rb_node *self, - const unsigned int direction) -{ - const unsigned int other = direction ^ RB_DIR_OTHER; - KASSERT(direction == RB_DIR_LEFT || direction == RB_DIR_RIGHT); - - if (self == NULL) { -#ifndef RBSMALL - if (RB_SENTINEL_P(rbt->rbt_root)) - return NULL; - return rbt->rbt_minmax[direction]; -#else - self = rbt->rbt_root; - if (RB_SENTINEL_P(self)) - return NULL; - while (!RB_SENTINEL_P(self->rb_nodes[direction])) - self = self->rb_nodes[direction]; - return self; -#endif /* !RBSMALL */ - } - KASSERT(!RB_SENTINEL_P(self)); - /* - * We can't go any further in this direction. We proceed up in the - * opposite direction until our parent is in direction we want to go. - */ - if (RB_SENTINEL_P(self->rb_nodes[direction])) { - while (!RB_ROOT_P(rbt, self)) { - if (other == RB_POSITION(self)) - return RB_FATHER(self); - self = RB_FATHER(self); - } - return NULL; - } - - /* - * Advance down one in current direction and go down as far as possible - * in the opposite direction. - */ - self = self->rb_nodes[direction]; - KASSERT(!RB_SENTINEL_P(self)); - while (!RB_SENTINEL_P(self->rb_nodes[other])) - self = self->rb_nodes[other]; - return self; -} - -static unsigned int -rb_tree_count_black(const struct rb_node *self) -{ - unsigned int left, right; - - if (RB_SENTINEL_P(self)) - return 0; - - left = rb_tree_count_black(self->rb_left); - right = rb_tree_count_black(self->rb_right); - - KASSERT(left == right); - - return left + RB_BLACK_P(self); -} - -static bool -rb_tree_check_node(const struct rb_tree *rbt, const struct rb_node *self, - const struct rb_node *prev, bool red_check) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - rbto_compare_nodes_fn compare_nodes = rbto->rbto_compare_nodes; - - KASSERT(!RB_SENTINEL_P(self)); - KASSERT(prev == NULL || (*compare_nodes)(rbto->rbto_context, - RB_NODETOITEM(rbto, prev), RB_NODETOITEM(rbto, self)) < 0); - - /* - * Verify our relationship to our parent. - */ - if (RB_ROOT_P(rbt, self)) { - KASSERT(self == rbt->rbt_root); - KASSERT(RB_POSITION(self) == RB_DIR_LEFT); - KASSERT(RB_FATHER(self)->rb_nodes[RB_DIR_LEFT] == self); - KASSERT(RB_FATHER(self) == (const struct rb_node *) &rbt->rbt_root); - } else { - int diff = (*compare_nodes)(rbto->rbto_context, - RB_NODETOITEM(rbto, self), - RB_NODETOITEM(rbto, RB_FATHER(self))); - - KASSERT(self != rbt->rbt_root); - KASSERT(!RB_FATHER_SENTINEL_P(self)); - if (RB_POSITION(self) == RB_DIR_LEFT) { - KASSERT(diff < 0); - KASSERT(RB_FATHER(self)->rb_nodes[RB_DIR_LEFT] == self); - } else { - KASSERT(diff > 0); - KASSERT(RB_FATHER(self)->rb_nodes[RB_DIR_RIGHT] == self); - } - } - - /* - * Verify our position in the linked list against the tree itself. - */ - { - const struct rb_node *prev0 = rb_tree_iterate_const(rbt, self, RB_DIR_LEFT); - const struct rb_node *next0 = rb_tree_iterate_const(rbt, self, RB_DIR_RIGHT); - KASSERT(prev0 == TAILQ_PREV(self, rb_node_qh, rb_link)); - KASSERT(next0 == TAILQ_NEXT(self, rb_link)); -#ifndef RBSMALL - KASSERT(prev0 != NULL || self == rbt->rbt_minmax[RB_DIR_LEFT]); - KASSERT(next0 != NULL || self == rbt->rbt_minmax[RB_DIR_RIGHT]); -#endif - } - - /* - * The root must be black. - * There can never be two adjacent red nodes. - */ - if (red_check) { - KASSERT(!RB_ROOT_P(rbt, self) || RB_BLACK_P(self)); - (void) rb_tree_count_black(self); - if (RB_RED_P(self)) { - const struct rb_node *brother; - KASSERT(!RB_ROOT_P(rbt, self)); - brother = RB_FATHER(self)->rb_nodes[RB_POSITION(self) ^ RB_DIR_OTHER]; - KASSERT(RB_BLACK_P(RB_FATHER(self))); - /* - * I'm red and have no children, then I must either - * have no brother or my brother also be red and - * also have no children. (black count == 0) - */ - KASSERT(!RB_CHILDLESS_P(self) - || RB_SENTINEL_P(brother) - || RB_RED_P(brother) - || RB_CHILDLESS_P(brother)); - /* - * If I'm not childless, I must have two children - * and they must be both be black. - */ - KASSERT(RB_CHILDLESS_P(self) - || (RB_TWOCHILDREN_P(self) - && RB_BLACK_P(self->rb_left) - && RB_BLACK_P(self->rb_right))); - /* - * If I'm not childless, thus I have black children, - * then my brother must either be black or have two - * black children. - */ - KASSERT(RB_CHILDLESS_P(self) - || RB_BLACK_P(brother) - || (RB_TWOCHILDREN_P(brother) - && RB_BLACK_P(brother->rb_left) - && RB_BLACK_P(brother->rb_right))); - } else { - /* - * If I'm black and have one child, that child must - * be red and childless. - */ - KASSERT(RB_CHILDLESS_P(self) - || RB_TWOCHILDREN_P(self) - || (!RB_LEFT_SENTINEL_P(self) - && RB_RIGHT_SENTINEL_P(self) - && RB_RED_P(self->rb_left) - && RB_CHILDLESS_P(self->rb_left)) - || (!RB_RIGHT_SENTINEL_P(self) - && RB_LEFT_SENTINEL_P(self) - && RB_RED_P(self->rb_right) - && RB_CHILDLESS_P(self->rb_right))); - - /* - * If I'm a childless black node and my parent is - * black, my 2nd closet relative away from my parent - * is either red or has a red parent or red children. - */ - if (!RB_ROOT_P(rbt, self) - && RB_CHILDLESS_P(self) - && RB_BLACK_P(RB_FATHER(self))) { - const unsigned int which = RB_POSITION(self); - const unsigned int other = which ^ RB_DIR_OTHER; - const struct rb_node *relative0, *relative; - - relative0 = rb_tree_iterate_const(rbt, - self, other); - KASSERT(relative0 != NULL); - relative = rb_tree_iterate_const(rbt, - relative0, other); - KASSERT(relative != NULL); - KASSERT(RB_SENTINEL_P(relative->rb_nodes[which])); -#if 0 - KASSERT(RB_RED_P(relative) - || RB_RED_P(relative->rb_left) - || RB_RED_P(relative->rb_right) - || RB_RED_P(RB_FATHER(relative))); -#endif - } - } - /* - * A grandparent's children must be real nodes and not - * sentinels. First check out grandparent. - */ - KASSERT(RB_ROOT_P(rbt, self) - || RB_ROOT_P(rbt, RB_FATHER(self)) - || RB_TWOCHILDREN_P(RB_FATHER(RB_FATHER(self)))); - /* - * If we are have grandchildren on our left, then - * we must have a child on our right. - */ - KASSERT(RB_LEFT_SENTINEL_P(self) - || RB_CHILDLESS_P(self->rb_left) - || !RB_RIGHT_SENTINEL_P(self)); - /* - * If we are have grandchildren on our right, then - * we must have a child on our left. - */ - KASSERT(RB_RIGHT_SENTINEL_P(self) - || RB_CHILDLESS_P(self->rb_right) - || !RB_LEFT_SENTINEL_P(self)); - - /* - * If we have a child on the left and it doesn't have two - * children make sure we don't have great-great-grandchildren on - * the right. - */ - KASSERT(RB_TWOCHILDREN_P(self->rb_left) - || RB_CHILDLESS_P(self->rb_right) - || RB_CHILDLESS_P(self->rb_right->rb_left) - || RB_CHILDLESS_P(self->rb_right->rb_left->rb_left) - || RB_CHILDLESS_P(self->rb_right->rb_left->rb_right) - || RB_CHILDLESS_P(self->rb_right->rb_right) - || RB_CHILDLESS_P(self->rb_right->rb_right->rb_left) - || RB_CHILDLESS_P(self->rb_right->rb_right->rb_right)); - - /* - * If we have a child on the right and it doesn't have two - * children make sure we don't have great-great-grandchildren on - * the left. - */ - KASSERT(RB_TWOCHILDREN_P(self->rb_right) - || RB_CHILDLESS_P(self->rb_left) - || RB_CHILDLESS_P(self->rb_left->rb_left) - || RB_CHILDLESS_P(self->rb_left->rb_left->rb_left) - || RB_CHILDLESS_P(self->rb_left->rb_left->rb_right) - || RB_CHILDLESS_P(self->rb_left->rb_right) - || RB_CHILDLESS_P(self->rb_left->rb_right->rb_left) - || RB_CHILDLESS_P(self->rb_left->rb_right->rb_right)); - - /* - * If we are fully interior node, then our predecessors and - * successors must have no children in our direction. - */ - if (RB_TWOCHILDREN_P(self)) { - const struct rb_node *prev0; - const struct rb_node *next0; - - prev0 = rb_tree_iterate_const(rbt, self, RB_DIR_LEFT); - KASSERT(prev0 != NULL); - KASSERT(RB_RIGHT_SENTINEL_P(prev0)); - - next0 = rb_tree_iterate_const(rbt, self, RB_DIR_RIGHT); - KASSERT(next0 != NULL); - KASSERT(RB_LEFT_SENTINEL_P(next0)); - } - } - - return true; -} - -void -rb_tree_check(const struct rb_tree *rbt, bool red_check) -{ - const struct rb_node *self; - const struct rb_node *prev; -#ifdef RBSTATS - unsigned int count = 0; -#endif - - KASSERT(rbt->rbt_root != NULL); - KASSERT(RB_LEFT_P(rbt->rbt_root)); - -#if defined(RBSTATS) && !defined(RBSMALL) - KASSERT(rbt->rbt_count > 1 - || rbt->rbt_minmax[RB_DIR_LEFT] == rbt->rbt_minmax[RB_DIR_RIGHT]); -#endif - - prev = NULL; - TAILQ_FOREACH(self, &rbt->rbt_nodes, rb_link) { - rb_tree_check_node(rbt, self, prev, false); -#ifdef RBSTATS - count++; -#endif - } -#ifdef RBSTATS - KASSERT(rbt->rbt_count == count); -#endif - if (red_check) { - KASSERT(RB_BLACK_P(rbt->rbt_root)); - KASSERT(RB_SENTINEL_P(rbt->rbt_root) - || rb_tree_count_black(rbt->rbt_root)); - - /* - * The root must be black. - * There can never be two adjacent red nodes. - */ - TAILQ_FOREACH(self, &rbt->rbt_nodes, rb_link) { - rb_tree_check_node(rbt, self, NULL, true); - } - } -} -#endif /* RBDEBUG */ - -#ifdef RBSTATS -static void -rb_tree_mark_depth(const struct rb_tree *rbt, const struct rb_node *self, - size_t *depths, size_t depth) -{ - if (RB_SENTINEL_P(self)) - return; - - if (RB_TWOCHILDREN_P(self)) { - rb_tree_mark_depth(rbt, self->rb_left, depths, depth + 1); - rb_tree_mark_depth(rbt, self->rb_right, depths, depth + 1); - return; - } - depths[depth]++; - if (!RB_LEFT_SENTINEL_P(self)) { - rb_tree_mark_depth(rbt, self->rb_left, depths, depth + 1); - } - if (!RB_RIGHT_SENTINEL_P(self)) { - rb_tree_mark_depth(rbt, self->rb_right, depths, depth + 1); - } -} - -void -rb_tree_depths(const struct rb_tree *rbt, size_t *depths) -{ - rb_tree_mark_depth(rbt, rbt->rbt_root, depths, 1); -} -#endif /* RBSTATS */ diff --git a/common/lib/libc/gen/rpst.c b/common/lib/libc/gen/rpst.c deleted file mode 100644 index 5ab09d086..000000000 --- a/common/lib/libc/gen/rpst.c +++ /dev/null @@ -1,716 +0,0 @@ -/* $NetBSD: rpst.c,v 1.11 2011/04/26 20:53:34 yamt Exp $ */ - -/*- - * Copyright (c)2009 YAMAMOTO Takashi, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * radix priority search tree - * - * described in: - * SIAM J. COMPUT. - * Vol. 14, No. 2, May 1985 - * PRIORITY SEARCH TREES - * EDWARD M. McCREIGHT - * - * ideas from linux: - * - grow tree height on-demand. - * - allow duplicated X values. in that case, we act as a heap. - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: rpst.c,v 1.11 2011/04/26 20:53:34 yamt Exp $"); -#include -#include -#if defined(_STANDALONE) -#include -#endif /* defined(_STANDALONE) */ -#else /* defined(_KERNEL) || defined(_STANDALONE) */ -__RCSID("$NetBSD: rpst.c,v 1.11 2011/04/26 20:53:34 yamt Exp $"); -#include -#include -#include -#if 1 -#define KASSERT assert -#else -#define KASSERT(a) -#endif -#endif /* defined(_KERNEL) || defined(_STANDALONE) */ - -#include - -/* - * rpst_init_tree: initialize a tree. - */ - -void -rpst_init_tree(struct rpst_tree *t) -{ - - t->t_root = NULL; - t->t_height = 0; -} - -/* - * rpst_height2max: calculate the maximum index which can be handled by - * a tree with the given height. - * - * 0 ... 0x0000000000000001 - * 1 ... 0x0000000000000003 - * 2 ... 0x0000000000000007 - * 3 ... 0x000000000000000f - * - * 31 ... 0x00000000ffffffff - * - * 63 ... 0xffffffffffffffff - */ - -static uint64_t -rpst_height2max(unsigned int height) -{ - - KASSERT(height < 64); - if (height == 63) { - return UINT64_MAX; - } - return (UINT64_C(1) << (height + 1)) - 1; -} - -/* - * rpst_level2mask: calculate the mask for the given level in the tree. - * - * the mask used to index root's children is level 0. - */ - -static uint64_t -rpst_level2mask(const struct rpst_tree *t, unsigned int level) -{ - uint64_t mask; - - if (t->t_height < level) { - mask = 0; - } else { - mask = UINT64_C(1) << (t->t_height - level); - } - return mask; -} - -/* - * rpst_startmask: calculate the mask for the start of a search. - * (ie. the mask for the top-most bit) - */ - -static uint64_t -rpst_startmask(const struct rpst_tree *t) -{ - const uint64_t mask = rpst_level2mask(t, 0); - - KASSERT((mask | (mask - 1)) == rpst_height2max(t->t_height)); - return mask; -} - -/* - * rpst_update_parents: update n_parent of children - */ - -static inline void -rpst_update_parents(struct rpst_node *n) -{ - int i; - - for (i = 0; i < 2; i++) { - if (n->n_children[i] != NULL) { - n->n_children[i]->n_parent = n; - } - } -} - -/* - * rpst_enlarge_tree: enlarge tree so that 'idx' can be stored - */ - -static void -rpst_enlarge_tree(struct rpst_tree *t, uint64_t idx) -{ - - while (idx > rpst_height2max(t->t_height)) { - struct rpst_node *n = t->t_root; - - if (n != NULL) { - rpst_remove_node(t, n); - memset(&n->n_children, 0, sizeof(n->n_children)); - n->n_children[0] = t->t_root; - t->t_root->n_parent = n; - t->t_root = n; - n->n_parent = NULL; - } - t->t_height++; - } -} - -/* - * rpst_insert_node1: a helper for rpst_insert_node. - */ - -static struct rpst_node * -rpst_insert_node1(struct rpst_node **where, struct rpst_node *n, uint64_t mask) -{ - struct rpst_node *parent; - struct rpst_node *cur; - unsigned int idx; - - KASSERT((n->n_x & ((-mask) << 1)) == 0); - parent = NULL; -next: - cur = *where; - if (cur == NULL) { - n->n_parent = parent; - memset(&n->n_children, 0, sizeof(n->n_children)); - *where = n; - return NULL; - } - KASSERT(cur->n_parent == parent); - if (n->n_y == cur->n_y && n->n_x == cur->n_x) { - return cur; - } - if (n->n_y < cur->n_y) { - /* - * swap cur and n. - * note that n is not in tree. - */ - memcpy(n->n_children, cur->n_children, sizeof(n->n_children)); - n->n_parent = cur->n_parent; - rpst_update_parents(n); - *where = n; - n = cur; - cur = *where; - } - KASSERT(*where == cur); - idx = (n->n_x & mask) != 0; - where = &cur->n_children[idx]; - parent = cur; - KASSERT((*where) == NULL || ((((*where)->n_x & mask) != 0) == idx)); - KASSERT((*where) == NULL || (*where)->n_y >= cur->n_y); - mask >>= 1; - goto next; -} - -/* - * rpst_insert_node: insert a node into the tree. - * - * => return NULL on success. - * => if a duplicated node (a node with the same X,Y pair as ours) is found, - * return the node. in that case, the tree is intact. - */ - -struct rpst_node * -rpst_insert_node(struct rpst_tree *t, struct rpst_node *n) -{ - - rpst_enlarge_tree(t, n->n_x); - return rpst_insert_node1(&t->t_root, n, rpst_startmask(t)); -} - -/* - * rpst_find_pptr: find a pointer to the given node. - * - * also, return the parent node via parentp. (NULL for the root node.) - */ - -static inline struct rpst_node ** -rpst_find_pptr(struct rpst_tree *t, struct rpst_node *n, - struct rpst_node **parentp) -{ - struct rpst_node * const parent = n->n_parent; - unsigned int i; - - *parentp = parent; - if (parent == NULL) { - return &t->t_root; - } - for (i = 0; i < 2 - 1; i++) { - if (parent->n_children[i] == n) { - break; - } - } - KASSERT(parent->n_children[i] == n); - return &parent->n_children[i]; -} - -/* - * rpst_remove_node_at: remove a node at *where. - */ - -static void -rpst_remove_node_at(struct rpst_node *parent, struct rpst_node **where, - struct rpst_node *cur) -{ - struct rpst_node *tmp[2]; - struct rpst_node *selected; - unsigned int selected_idx = 0; /* XXX gcc */ - unsigned int i; - - KASSERT(cur != NULL); - KASSERT(parent == cur->n_parent); -next: - selected = NULL; - for (i = 0; i < 2; i++) { - struct rpst_node *c; - - c = cur->n_children[i]; - KASSERT(c == NULL || c->n_parent == cur); - if (selected == NULL || (c != NULL && c->n_y < selected->n_y)) { - selected = c; - selected_idx = i; - } - } - /* - * now we have: - * - * parent - * \ <- where - * cur - * / \ - * A selected - * / \ - * B C - */ - *where = selected; - if (selected == NULL) { - return; - } - /* - * swap selected->n_children and cur->n_children. - */ - memcpy(tmp, selected->n_children, sizeof(tmp)); - memcpy(selected->n_children, cur->n_children, sizeof(tmp)); - memcpy(cur->n_children, tmp, sizeof(tmp)); - rpst_update_parents(cur); - rpst_update_parents(selected); - selected->n_parent = parent; - /* - * parent - * \ <- where - * selected - * / \ - * A selected - * - * cur - * / \ - * B C - */ - where = &selected->n_children[selected_idx]; - /* - * parent - * \ - * selected - * / \ <- where - * A selected (*) - * - * cur (**) - * / \ - * B C - * - * (*) this 'selected' will be overwritten in the next iteration. - * (**) cur->n_parent is bogus. - */ - parent = selected; - goto next; -} - -/* - * rpst_remove_node: remove a node from the tree. - */ - -void -rpst_remove_node(struct rpst_tree *t, struct rpst_node *n) -{ - struct rpst_node *parent; - struct rpst_node **where; - - where = rpst_find_pptr(t, n, &parent); - rpst_remove_node_at(parent, where, n); -} - -static bool __unused -rpst_iterator_match_p(const struct rpst_node *n, const struct rpst_iterator *it) -{ - - if (n->n_y > it->it_max_y) { - return false; - } - if (n->n_x < it->it_min_x) { - return false; - } - if (n->n_x > it->it_max_x) { - return false; - } - return true; -} - -struct rpst_node * -rpst_iterate_first(struct rpst_tree *t, uint64_t max_y, uint64_t min_x, - uint64_t max_x, struct rpst_iterator *it) -{ - struct rpst_node *n; - - KASSERT(min_x <= max_x); - n = t->t_root; - if (n == NULL || n->n_y > max_y) { - return NULL; - } - if (rpst_height2max(t->t_height) < min_x) { - return NULL; - } - it->it_tree = t; - it->it_cur = n; - it->it_idx = (min_x & rpst_startmask(t)) != 0; - it->it_level = 0; - it->it_max_y = max_y; - it->it_min_x = min_x; - it->it_max_x = max_x; - return rpst_iterate_next(it); -} - -static inline unsigned int -rpst_node_on_edge_p(const struct rpst_node *n, uint64_t val, uint64_t mask) -{ - - return ((n->n_x ^ val) & ((-mask) << 1)) == 0; -} - -static inline uint64_t -rpst_maxidx(const struct rpst_node *n, uint64_t max_x, uint64_t mask) -{ - - if (rpst_node_on_edge_p(n, max_x, mask)) { - return (max_x & mask) != 0; - } else { - return 1; - } -} - -static inline uint64_t -rpst_minidx(const struct rpst_node *n, uint64_t min_x, uint64_t mask) -{ - - if (rpst_node_on_edge_p(n, min_x, mask)) { - return (min_x & mask) != 0; - } else { - return 0; - } -} - -struct rpst_node * -rpst_iterate_next(struct rpst_iterator *it) -{ - struct rpst_tree *t; - struct rpst_node *n; - struct rpst_node *next; - const uint64_t max_y = it->it_max_y; - const uint64_t min_x = it->it_min_x; - const uint64_t max_x = it->it_max_x; - unsigned int idx; - unsigned int maxidx; - unsigned int level; - uint64_t mask; - - t = it->it_tree; - n = it->it_cur; - idx = it->it_idx; - level = it->it_level; - mask = rpst_level2mask(t, level); - maxidx = rpst_maxidx(n, max_x, mask); - KASSERT(n == t->t_root || rpst_iterator_match_p(n, it)); -next: - KASSERT(mask == rpst_level2mask(t, level)); - KASSERT(idx >= rpst_minidx(n, min_x, mask)); - KASSERT(maxidx == rpst_maxidx(n, max_x, mask)); - KASSERT(idx <= maxidx + 2); - KASSERT(n != NULL); -#if 0 - printf("%s: cur=%p, idx=%u maxidx=%u level=%u mask=%" PRIx64 "\n", - __func__, (void *)n, idx, maxidx, level, mask); -#endif - if (idx == maxidx + 1) { /* visit the current node */ - idx++; - if (min_x <= n->n_x && n->n_x <= max_x) { - it->it_cur = n; - it->it_idx = idx; - it->it_level = level; - KASSERT(rpst_iterator_match_p(n, it)); - return n; /* report */ - } - goto next; - } else if (idx == maxidx + 2) { /* back to the parent */ - struct rpst_node **where; - - where = rpst_find_pptr(t, n, &next); - if (next == NULL) { - KASSERT(level == 0); - KASSERT(t->t_root == n); - KASSERT(&t->t_root == where); - return NULL; /* done */ - } - KASSERT(level > 0); - level--; - n = next; - mask = rpst_level2mask(t, level); - maxidx = rpst_maxidx(n, max_x, mask); - idx = where - n->n_children + 1; - KASSERT(idx < 2 + 1); - goto next; - } - /* go to a child */ - KASSERT(idx < 2); - next = n->n_children[idx]; - if (next == NULL || next->n_y > max_y) { - idx++; - goto next; - } - KASSERT(next->n_parent == n); - KASSERT(next->n_y >= n->n_y); - level++; - mask >>= 1; - n = next; - idx = rpst_minidx(n, min_x, mask); - maxidx = rpst_maxidx(n, max_x, mask); -#if 0 - printf("%s: visit %p idx=%u level=%u mask=%llx\n", - __func__, n, idx, level, mask); -#endif - goto next; -} - -#if defined(UNITTEST) -#include - -#include -#include -#include - -static void -rpst_dump_node(const struct rpst_node *n, unsigned int depth) -{ - unsigned int i; - - for (i = 0; i < depth; i++) { - printf(" "); - } - printf("[%u]", depth); - if (n == NULL) { - printf("NULL\n"); - return; - } - printf("%p x=%" PRIx64 "(%" PRIu64 ") y=%" PRIx64 "(%" PRIu64 ")\n", - (const void *)n, n->n_x, n->n_x, n->n_y, n->n_y); - for (i = 0; i < 2; i++) { - rpst_dump_node(n->n_children[i], depth + 1); - } -} - -static void -rpst_dump_tree(const struct rpst_tree *t) -{ - - printf("pst %p height=%u\n", (const void *)t, t->t_height); - rpst_dump_node(t->t_root, 0); -} - -struct testnode { - struct rpst_node n; - struct testnode *next; - bool failed; - bool found; -}; - -struct rpst_tree t; -struct testnode *h = NULL; - -static uintmax_t -tvdiff(const struct timeval *tv1, const struct timeval *tv2) -{ - - return (uintmax_t)tv1->tv_sec * 1000000 + tv1->tv_usec - - tv2->tv_sec * 1000000 - tv2->tv_usec; -} - -static unsigned int -query(uint64_t max_y, uint64_t min_x, uint64_t max_x) -{ - struct testnode *n; - struct rpst_node *rn; - struct rpst_iterator it; - struct timeval start; - struct timeval end; - unsigned int done; - - printf("quering max_y=%" PRIu64 " min_x=%" PRIu64 " max_x=%" PRIu64 - "\n", - max_y, min_x, max_x); - done = 0; - gettimeofday(&start, NULL); - for (rn = rpst_iterate_first(&t, max_y, min_x, max_x, &it); - rn != NULL; - rn = rpst_iterate_next(&it)) { - done++; -#if 0 - printf("found %p x=%" PRIu64 " y=%" PRIu64 "\n", - (void *)rn, rn->n_x, rn->n_y); -#endif - n = (void *)rn; - assert(!n->found); - n->found = true; - } - gettimeofday(&end, NULL); - printf("%u nodes found in %ju usecs\n", done, - tvdiff(&end, &start)); - - gettimeofday(&start, NULL); - for (n = h; n != NULL; n = n->next) { - assert(n->failed || - n->found == rpst_iterator_match_p(&n->n, &it)); - n->found = false; - } - gettimeofday(&end, NULL); - printf("(linear search took %ju usecs)\n", tvdiff(&end, &start)); - return done; -} - -int -main(int argc, char *argv[]) -{ - struct testnode *n; - unsigned int i; - struct rpst_iterator it; - struct timeval start; - struct timeval end; - uint64_t min_y = UINT64_MAX; - uint64_t max_y = 0; - uint64_t min_x = UINT64_MAX; - uint64_t max_x = 0; - uint64_t w; - unsigned int done; - unsigned int fail; - unsigned int num = 500000; - - rpst_init_tree(&t); - rpst_dump_tree(&t); - assert(NULL == rpst_iterate_first(&t, UINT64_MAX, 0, UINT64_MAX, &it)); - - for (i = 0; i < num; i++) { - n = malloc(sizeof(*n)); - if (i > 499000) { - n->n.n_x = 10; - n->n.n_y = random(); - } else if (i > 400000) { - n->n.n_x = i; - n->n.n_y = random(); - } else { - n->n.n_x = random(); - n->n.n_y = random(); - } - if (n->n.n_y < min_y) { - min_y = n->n.n_y; - } - if (n->n.n_y > max_y) { - max_y = n->n.n_y; - } - if (n->n.n_x < min_x) { - min_x = n->n.n_x; - } - if (n->n.n_x > max_x) { - max_x = n->n.n_x; - } - n->found = false; - n->failed = false; - n->next = h; - h = n; - } - - done = 0; - fail = 0; - gettimeofday(&start, NULL); - for (n = h; n != NULL; n = n->next) { - struct rpst_node *o; -#if 0 - printf("insert %p x=%" PRIu64 " y=%" PRIu64 "\n", - n, n->n.n_x, n->n.n_y); -#endif - o = rpst_insert_node(&t, &n->n); - if (o == NULL) { - done++; - } else { - n->failed = true; - fail++; - } - } - gettimeofday(&end, NULL); - printf("%u nodes inserted and %u insertion failed in %ju usecs\n", - done, fail, - tvdiff(&end, &start)); - - assert(min_y == 0 || 0 == query(min_y - 1, 0, UINT64_MAX)); - assert(max_x == UINT64_MAX || - 0 == query(UINT64_MAX, max_x + 1, UINT64_MAX)); - assert(min_x == 0 || 0 == query(UINT64_MAX, 0, min_x - 1)); - - done = query(max_y, min_x, max_x); - assert(done == num - fail); - - done = query(UINT64_MAX, 0, UINT64_MAX); - assert(done == num - fail); - - w = max_x - min_x; - query(max_y / 2, min_x, max_x); - query(max_y, min_x + w / 2, max_x); - query(max_y / 2, min_x + w / 2, max_x); - query(max_y / 2, min_x, max_x - w / 2); - query(max_y / 2, min_x + w / 3, max_x - w / 3); - query(max_y - 1, min_x + 1, max_x - 1); - query(UINT64_MAX, 10, 10); - - done = 0; - gettimeofday(&start, NULL); - for (n = h; n != NULL; n = n->next) { - if (n->failed) { - continue; - } -#if 0 - printf("remove %p x=%" PRIu64 " y=%" PRIu64 "\n", - n, n->n.n_x, n->n.n_y); -#endif - rpst_remove_node(&t, &n->n); - done++; - } - gettimeofday(&end, NULL); - printf("%u nodes removed in %ju usecs\n", done, - tvdiff(&end, &start)); - - rpst_dump_tree(&t); -} -#endif /* defined(UNITTEST) */ diff --git a/common/lib/libc/gmon/mcount.c b/common/lib/libc/gmon/mcount.c deleted file mode 100644 index 128abe6f9..000000000 --- a/common/lib/libc/gmon/mcount.c +++ /dev/null @@ -1,274 +0,0 @@ -/* $NetBSD: mcount.c,v 1.10 2012/03/20 16:21:41 matt Exp $ */ - -/* - * Copyright (c) 2003, 2004 Wasabi Systems, Inc. - * All rights reserved. - * - * Written by Nathan J. Williams for Wasabi Systems, Inc. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed for the NetBSD Project by - * Wasabi Systems, Inc. - * 4. The name of Wasabi Systems, Inc. may not be used to endorse - * or promote products derived from this software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY WASABI SYSTEMS, INC. ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL WASABI SYSTEMS, INC - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1983, 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* If building a standalone libkern, don't include mcount. */ -#if (!defined(_KERNEL) || defined(GPROF)) && !defined(_STANDALONE) - -#ifdef _KERNEL_OPT -#include "opt_multiprocessor.h" -#endif - -#include -#if !defined(lint) && !defined(_KERNEL) && defined(LIBC_SCCS) -#if 0 -static char sccsid[] = "@(#)mcount.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: mcount.c,v 1.10 2012/03/20 16:21:41 matt Exp $"); -#endif -#endif - -#include -#include - -#ifndef _KERNEL -#include "reentrant.h" -#endif - -#ifdef _REENTRANT -extern thread_key_t _gmonkey; -extern struct gmonparam _gmondummy; -struct gmonparam *_m_gmon_alloc(void); -#endif - -#ifndef __LINT__ -_MCOUNT_DECL(u_long, u_long) -#ifdef _KERNEL - __attribute__((__no_instrument_function__)) -#endif - __used; -#endif - -/* XXX: make these interfaces */ -#ifdef _RUMPKERNEL -#undef MCOUNT_ENTER -#define MCOUNT_ENTER -#undef MCOUNT_EXIT -#define MCOUNT_EXIT -#undef MCOUNT -#define MCOUNT -#endif - -/* - * mcount is called on entry to each function compiled with the profiling - * switch set. _mcount(), which is declared in a machine-dependent way - * with _MCOUNT_DECL, does the actual work and is either inlined into a - * C routine or called by an assembly stub. In any case, this magic is - * taken care of by the MCOUNT definition in . - * - * _mcount updates data structures that represent traversals of the - * program's call graph edges. frompc and selfpc are the return - * address and function address that represents the given call graph edge. - * - * Note: the original BSD code used the same variable (frompcindex) for - * both frompcindex and frompc. Any reasonable, modern compiler will - * perform this optimization. - */ -#ifndef __LINT__ -/* _mcount; may be static, inline, etc */ -_MCOUNT_DECL(u_long frompc, u_long selfpc) -{ - u_short *frompcindex; - struct tostruct *top, *prevtop; - struct gmonparam *p; - long toindex; -#if defined(_KERNEL) && !defined(_RUMPKERNEL) - int s; -#endif - -#if defined(_REENTRANT) && !defined(_KERNEL) - if (__isthreaded) { - p = thr_getspecific(_gmonkey); - if (p == NULL) { - /* Prevent recursive calls while allocating */ - thr_setspecific(_gmonkey, &_gmondummy); - p = _m_gmon_alloc(); - } - } else -#endif - p = &_gmonparam; - /* - * check that we are profiling - * and that we aren't recursively invoked. - */ - if (p->state != GMON_PROF_ON) - return; -#ifdef _KERNEL - MCOUNT_ENTER; -#endif - p->state = GMON_PROF_BUSY; - /* - * check that frompcindex is a reasonable pc value. - * for example: signal catchers get called from the stack, - * not from text space. too bad. - */ - frompc -= p->lowpc; - if (frompc > p->textsize) - goto done; - -#if (HASHFRACTION & (HASHFRACTION - 1)) == 0 - if (p->hashfraction == HASHFRACTION) - frompcindex = - &p->froms[ - (size_t)(frompc / (HASHFRACTION * sizeof(*p->froms)))]; - else -#endif - frompcindex = - &p->froms[ - (size_t)(frompc / (p->hashfraction * sizeof(*p->froms)))]; - toindex = *frompcindex; - if (toindex == 0) { - /* - * first time traversing this arc - */ - toindex = ++p->tos[0].link; - if (toindex >= p->tolimit) - /* halt further profiling */ - goto overflow; - - *frompcindex = (u_short)toindex; - top = &p->tos[(size_t)toindex]; - top->selfpc = selfpc; - top->count = 1; - top->link = 0; - goto done; - } - top = &p->tos[(size_t)toindex]; - if (top->selfpc == selfpc) { - /* - * arc at front of chain; usual case. - */ - top->count++; - goto done; - } - /* - * have to go looking down chain for it. - * top points to what we are looking at, - * prevtop points to previous top. - * we know it is not at the head of the chain. - */ - for (; /* goto done */; ) { - if (top->link == 0) { - /* - * top is end of the chain and none of the chain - * had top->selfpc == selfpc. - * so we allocate a new tostruct - * and link it to the head of the chain. - */ - toindex = ++p->tos[0].link; - if (toindex >= p->tolimit) - goto overflow; - - top = &p->tos[(size_t)toindex]; - top->selfpc = selfpc; - top->count = 1; - top->link = *frompcindex; - *frompcindex = (u_short)toindex; - goto done; - } - /* - * otherwise, check the next arc on the chain. - */ - prevtop = top; - top = &p->tos[top->link]; - if (top->selfpc == selfpc) { - /* - * there it is. - * increment its count - * move it to the head of the chain. - */ - top->count++; - toindex = prevtop->link; - prevtop->link = top->link; - top->link = *frompcindex; - *frompcindex = (u_short)toindex; - goto done; - } - - } -done: - p->state = GMON_PROF_ON; -#ifdef _KERNEL - MCOUNT_EXIT; -#endif - return; -overflow: - p->state = GMON_PROF_ERROR; -#ifdef _KERNEL - MCOUNT_EXIT; -#endif - return; -} -#endif - -#ifdef MCOUNT -/* - * Actual definition of mcount function. Defined in , - * which is included by . - */ -MCOUNT -#endif - -#endif /* (!_KERNEL || GPROF) && !_STANDALONE */ diff --git a/common/lib/libc/hash/murmurhash/murmurhash.c b/common/lib/libc/hash/murmurhash/murmurhash.c deleted file mode 100644 index e4a987ce7..000000000 --- a/common/lib/libc/hash/murmurhash/murmurhash.c +++ /dev/null @@ -1,109 +0,0 @@ -/* $NetBSD: murmurhash.c,v 1.6 2013/10/26 21:06:38 rmind Exp $ */ - -/* - * MurmurHash2 -- from the original code: - * - * "MurmurHash2 was written by Austin Appleby, and is placed in the public - * domain. The author hereby disclaims copyright to this source code." - * - * References: - * http://code.google.com/p/smhasher/ - * https://sites.google.com/site/murmurhash/ - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: murmurhash.c,v 1.6 2013/10/26 21:06:38 rmind Exp $"); - -#else - -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: murmurhash.c,v 1.6 2013/10/26 21:06:38 rmind Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include "namespace.h" -#endif - -#include -#include -#include - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#ifdef __weak_alias -__weak_alias(murmurhash2,_murmurhash2) -#endif -#endif - -uint32_t -murmurhash2(const void *key, size_t len, uint32_t seed) -{ - /* - * Note: 'm' and 'r' are mixing constants generated offline. - * They're not really 'magic', they just happen to work well. - * Initialize the hash to a 'random' value. - */ - const uint32_t m = 0x5bd1e995; - const int r = 24; - - const uint8_t *data = key; - uint32_t h = seed ^ (uint32_t)len; - - if (__predict_true(ALIGNED_POINTER(key, uint32_t))) { - while (len >= sizeof(uint32_t)) { - uint32_t k = *(const uint32_t *)data; - - k *= m; - k ^= k >> r; - k *= m; - - h *= m; - h ^= k; - - data += sizeof(uint32_t); - len -= sizeof(uint32_t); - } - } else { - while (len >= sizeof(uint32_t)) { - uint32_t k; - - k = data[0]; - k |= data[1] << 8; - k |= data[2] << 16; - k |= data[3] << 24; - - k *= m; - k ^= k >> r; - k *= m; - - h *= m; - h ^= k; - - data += sizeof(uint32_t); - len -= sizeof(uint32_t); - } - } - - /* Handle the last few bytes of the input array. */ - switch (len) { - case 3: - h ^= data[2] << 16; - /* FALLTHROUGH */ - case 2: - h ^= data[1] << 8; - /* FALLTHROUGH */ - case 1: - h ^= data[0]; - h *= m; - } - - /* - * Do a few final mixes of the hash to ensure the last few - * bytes are well-incorporated. - */ - h ^= h >> 13; - h *= m; - h ^= h >> 15; - - return h; -} diff --git a/common/lib/libc/hash/rmd160/rmd160.c b/common/lib/libc/hash/rmd160/rmd160.c deleted file mode 100644 index 6b0f6b5b5..000000000 --- a/common/lib/libc/hash/rmd160/rmd160.c +++ /dev/null @@ -1,394 +0,0 @@ -/* $NetBSD: rmd160.c,v 1.7 2015/04/21 12:47:33 riastradh Exp $ */ -/* $KAME: rmd160.c,v 1.2 2003/07/25 09:37:55 itojun Exp $ */ -/* $OpenBSD: rmd160.c,v 1.3 2001/09/26 21:40:13 markus Exp $ */ -/* - * Copyright (c) 2001 Markus Friedl. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", - * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, - * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf - */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: rmd160.c,v 1.7 2015/04/21 12:47:33 riastradh Exp $"); - -#include - -#else - -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: rmd160.c,v 1.7 2015/04/21 12:47:33 riastradh Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include "namespace.h" -#include -#include - -#endif - -#include -#include -#include -#include - - -#define PUT_64BIT_LE(cp, value) do { \ - (cp)[7] = (u_char)((value) >> 56); \ - (cp)[6] = (u_char)((value) >> 48); \ - (cp)[5] = (u_char)((value) >> 40); \ - (cp)[4] = (u_char)((value) >> 32); \ - (cp)[3] = (u_char)((value) >> 24); \ - (cp)[2] = (u_char)((value) >> 16); \ - (cp)[1] = (u_char)((value) >> 8); \ - (cp)[0] = (u_char)((value)); } while (/*CONSTCOND*/0) - -#define PUT_32BIT_LE(cp, value) do { \ - (cp)[3] = (value) >> 24; \ - (cp)[2] = (value) >> 16; \ - (cp)[1] = (value) >> 8; \ - (cp)[0] = (value); } while (/*CONSTCOND*/0) - -#define H0 0x67452301U -#define H1 0xEFCDAB89U -#define H2 0x98BADCFEU -#define H3 0x10325476U -#define H4 0xC3D2E1F0U - -#define K0 0x00000000U -#define K1 0x5A827999U -#define K2 0x6ED9EBA1U -#define K3 0x8F1BBCDCU -#define K4 0xA953FD4EU - -#define KK0 0x50A28BE6U -#define KK1 0x5C4DD124U -#define KK2 0x6D703EF3U -#define KK3 0x7A6D76E9U -#define KK4 0x00000000U - -/* rotate x left n bits. */ -#define ROL(n, x) (((x) << (n)) | ((x) >> (32-(n)))) - -#define F0(x, y, z) ((x) ^ (y) ^ (z)) -#define F1(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define F2(x, y, z) (((x) | (~y)) ^ (z)) -#define F3(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define F4(x, y, z) ((x) ^ ((y) | (~z))) - -#define R(a, b, c, d, e, Fj, Kj, sj, rj) \ - do { \ - a = ROL(sj, a + Fj(b,c,d) + X(rj) + Kj) + e; \ - c = ROL(10, c); \ - } while(/*CONSTCOND*/0) - -#define X(i) x[i] - -static const u_char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if defined(__weak_alias) -__weak_alias(RMD160Init,_RMD160Init) -__weak_alias(RMD160Update,_RMD160Update) -__weak_alias(RMD160Final,_RMD160Final) -__weak_alias(RMD160Transform,_RMD160Transform) -#endif -#endif - -void -RMD160Init(RMD160_CTX *ctx) -{ - ctx->count = 0; - ctx->state[0] = H0; - ctx->state[1] = H1; - ctx->state[2] = H2; - ctx->state[3] = H3; - ctx->state[4] = H4; -} - -void -RMD160Update(RMD160_CTX *ctx, const u_char *input, uint32_t len) -{ - uint32_t have, off, need; - - have = (uint32_t)((ctx->count/8) % 64); - need = 64 - have; - ctx->count += 8 * len; - off = 0; - - if (len >= need) { - if (have) { - memcpy(ctx->buffer + have, input, (size_t)need); - RMD160Transform(ctx->state, ctx->buffer); - off = need; - have = 0; - } - /* now the buffer is empty */ - while (off + 64 <= len) { - RMD160Transform(ctx->state, input+off); - off += 64; - } - } - if (off < len) - memcpy(ctx->buffer + have, input+off, (size_t)len-off); -} - -void -RMD160Final(u_char digest[20], RMD160_CTX *ctx) -{ - int i; - u_char size[8]; - uint32_t padlen; - - PUT_64BIT_LE(size, ctx->count); - - /* - * pad to 64 byte blocks, at least one byte from PADDING plus 8 bytes - * for the size - */ - padlen = (uint32_t)(64 - ((ctx->count/8) % 64)); - if (padlen < 1 + 8) - padlen += 64; - RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ - RMD160Update(ctx, size, 8); - - if (digest != NULL) - for (i = 0; i < 5; i++) - PUT_32BIT_LE(digest + i*4, ctx->state[i]); - - memset(ctx, 0, sizeof (*ctx)); -} - -void -RMD160Transform(uint32_t state[5], const u_char block[64]) -{ - uint32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16]; - -#if BYTE_ORDER == LITTLE_ENDIAN - memcpy(x, block, (size_t)64); -#else - int i; - - for (i = 0; i < 16; i++) - x[i] = le32dec(block+i*4); -#endif - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - - /* Round 1 */ - R(a, b, c, d, e, F0, K0, 11, 0); - R(e, a, b, c, d, F0, K0, 14, 1); - R(d, e, a, b, c, F0, K0, 15, 2); - R(c, d, e, a, b, F0, K0, 12, 3); - R(b, c, d, e, a, F0, K0, 5, 4); - R(a, b, c, d, e, F0, K0, 8, 5); - R(e, a, b, c, d, F0, K0, 7, 6); - R(d, e, a, b, c, F0, K0, 9, 7); - R(c, d, e, a, b, F0, K0, 11, 8); - R(b, c, d, e, a, F0, K0, 13, 9); - R(a, b, c, d, e, F0, K0, 14, 10); - R(e, a, b, c, d, F0, K0, 15, 11); - R(d, e, a, b, c, F0, K0, 6, 12); - R(c, d, e, a, b, F0, K0, 7, 13); - R(b, c, d, e, a, F0, K0, 9, 14); - R(a, b, c, d, e, F0, K0, 8, 15); /* #15 */ - /* Round 2 */ - R(e, a, b, c, d, F1, K1, 7, 7); - R(d, e, a, b, c, F1, K1, 6, 4); - R(c, d, e, a, b, F1, K1, 8, 13); - R(b, c, d, e, a, F1, K1, 13, 1); - R(a, b, c, d, e, F1, K1, 11, 10); - R(e, a, b, c, d, F1, K1, 9, 6); - R(d, e, a, b, c, F1, K1, 7, 15); - R(c, d, e, a, b, F1, K1, 15, 3); - R(b, c, d, e, a, F1, K1, 7, 12); - R(a, b, c, d, e, F1, K1, 12, 0); - R(e, a, b, c, d, F1, K1, 15, 9); - R(d, e, a, b, c, F1, K1, 9, 5); - R(c, d, e, a, b, F1, K1, 11, 2); - R(b, c, d, e, a, F1, K1, 7, 14); - R(a, b, c, d, e, F1, K1, 13, 11); - R(e, a, b, c, d, F1, K1, 12, 8); /* #31 */ - /* Round 3 */ - R(d, e, a, b, c, F2, K2, 11, 3); - R(c, d, e, a, b, F2, K2, 13, 10); - R(b, c, d, e, a, F2, K2, 6, 14); - R(a, b, c, d, e, F2, K2, 7, 4); - R(e, a, b, c, d, F2, K2, 14, 9); - R(d, e, a, b, c, F2, K2, 9, 15); - R(c, d, e, a, b, F2, K2, 13, 8); - R(b, c, d, e, a, F2, K2, 15, 1); - R(a, b, c, d, e, F2, K2, 14, 2); - R(e, a, b, c, d, F2, K2, 8, 7); - R(d, e, a, b, c, F2, K2, 13, 0); - R(c, d, e, a, b, F2, K2, 6, 6); - R(b, c, d, e, a, F2, K2, 5, 13); - R(a, b, c, d, e, F2, K2, 12, 11); - R(e, a, b, c, d, F2, K2, 7, 5); - R(d, e, a, b, c, F2, K2, 5, 12); /* #47 */ - /* Round 4 */ - R(c, d, e, a, b, F3, K3, 11, 1); - R(b, c, d, e, a, F3, K3, 12, 9); - R(a, b, c, d, e, F3, K3, 14, 11); - R(e, a, b, c, d, F3, K3, 15, 10); - R(d, e, a, b, c, F3, K3, 14, 0); - R(c, d, e, a, b, F3, K3, 15, 8); - R(b, c, d, e, a, F3, K3, 9, 12); - R(a, b, c, d, e, F3, K3, 8, 4); - R(e, a, b, c, d, F3, K3, 9, 13); - R(d, e, a, b, c, F3, K3, 14, 3); - R(c, d, e, a, b, F3, K3, 5, 7); - R(b, c, d, e, a, F3, K3, 6, 15); - R(a, b, c, d, e, F3, K3, 8, 14); - R(e, a, b, c, d, F3, K3, 6, 5); - R(d, e, a, b, c, F3, K3, 5, 6); - R(c, d, e, a, b, F3, K3, 12, 2); /* #63 */ - /* Round 5 */ - R(b, c, d, e, a, F4, K4, 9, 4); - R(a, b, c, d, e, F4, K4, 15, 0); - R(e, a, b, c, d, F4, K4, 5, 5); - R(d, e, a, b, c, F4, K4, 11, 9); - R(c, d, e, a, b, F4, K4, 6, 7); - R(b, c, d, e, a, F4, K4, 8, 12); - R(a, b, c, d, e, F4, K4, 13, 2); - R(e, a, b, c, d, F4, K4, 12, 10); - R(d, e, a, b, c, F4, K4, 5, 14); - R(c, d, e, a, b, F4, K4, 12, 1); - R(b, c, d, e, a, F4, K4, 13, 3); - R(a, b, c, d, e, F4, K4, 14, 8); - R(e, a, b, c, d, F4, K4, 11, 11); - R(d, e, a, b, c, F4, K4, 8, 6); - R(c, d, e, a, b, F4, K4, 5, 15); - R(b, c, d, e, a, F4, K4, 6, 13); /* #79 */ - - aa = a ; bb = b; cc = c; dd = d; ee = e; - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - - /* Parallel round 1 */ - R(a, b, c, d, e, F4, KK0, 8, 5); - R(e, a, b, c, d, F4, KK0, 9, 14); - R(d, e, a, b, c, F4, KK0, 9, 7); - R(c, d, e, a, b, F4, KK0, 11, 0); - R(b, c, d, e, a, F4, KK0, 13, 9); - R(a, b, c, d, e, F4, KK0, 15, 2); - R(e, a, b, c, d, F4, KK0, 15, 11); - R(d, e, a, b, c, F4, KK0, 5, 4); - R(c, d, e, a, b, F4, KK0, 7, 13); - R(b, c, d, e, a, F4, KK0, 7, 6); - R(a, b, c, d, e, F4, KK0, 8, 15); - R(e, a, b, c, d, F4, KK0, 11, 8); - R(d, e, a, b, c, F4, KK0, 14, 1); - R(c, d, e, a, b, F4, KK0, 14, 10); - R(b, c, d, e, a, F4, KK0, 12, 3); - R(a, b, c, d, e, F4, KK0, 6, 12); /* #15 */ - /* Parallel round 2 */ - R(e, a, b, c, d, F3, KK1, 9, 6); - R(d, e, a, b, c, F3, KK1, 13, 11); - R(c, d, e, a, b, F3, KK1, 15, 3); - R(b, c, d, e, a, F3, KK1, 7, 7); - R(a, b, c, d, e, F3, KK1, 12, 0); - R(e, a, b, c, d, F3, KK1, 8, 13); - R(d, e, a, b, c, F3, KK1, 9, 5); - R(c, d, e, a, b, F3, KK1, 11, 10); - R(b, c, d, e, a, F3, KK1, 7, 14); - R(a, b, c, d, e, F3, KK1, 7, 15); - R(e, a, b, c, d, F3, KK1, 12, 8); - R(d, e, a, b, c, F3, KK1, 7, 12); - R(c, d, e, a, b, F3, KK1, 6, 4); - R(b, c, d, e, a, F3, KK1, 15, 9); - R(a, b, c, d, e, F3, KK1, 13, 1); - R(e, a, b, c, d, F3, KK1, 11, 2); /* #31 */ - /* Parallel round 3 */ - R(d, e, a, b, c, F2, KK2, 9, 15); - R(c, d, e, a, b, F2, KK2, 7, 5); - R(b, c, d, e, a, F2, KK2, 15, 1); - R(a, b, c, d, e, F2, KK2, 11, 3); - R(e, a, b, c, d, F2, KK2, 8, 7); - R(d, e, a, b, c, F2, KK2, 6, 14); - R(c, d, e, a, b, F2, KK2, 6, 6); - R(b, c, d, e, a, F2, KK2, 14, 9); - R(a, b, c, d, e, F2, KK2, 12, 11); - R(e, a, b, c, d, F2, KK2, 13, 8); - R(d, e, a, b, c, F2, KK2, 5, 12); - R(c, d, e, a, b, F2, KK2, 14, 2); - R(b, c, d, e, a, F2, KK2, 13, 10); - R(a, b, c, d, e, F2, KK2, 13, 0); - R(e, a, b, c, d, F2, KK2, 7, 4); - R(d, e, a, b, c, F2, KK2, 5, 13); /* #47 */ - /* Parallel round 4 */ - R(c, d, e, a, b, F1, KK3, 15, 8); - R(b, c, d, e, a, F1, KK3, 5, 6); - R(a, b, c, d, e, F1, KK3, 8, 4); - R(e, a, b, c, d, F1, KK3, 11, 1); - R(d, e, a, b, c, F1, KK3, 14, 3); - R(c, d, e, a, b, F1, KK3, 14, 11); - R(b, c, d, e, a, F1, KK3, 6, 15); - R(a, b, c, d, e, F1, KK3, 14, 0); - R(e, a, b, c, d, F1, KK3, 6, 5); - R(d, e, a, b, c, F1, KK3, 9, 12); - R(c, d, e, a, b, F1, KK3, 12, 2); - R(b, c, d, e, a, F1, KK3, 9, 13); - R(a, b, c, d, e, F1, KK3, 12, 9); - R(e, a, b, c, d, F1, KK3, 5, 7); - R(d, e, a, b, c, F1, KK3, 15, 10); - R(c, d, e, a, b, F1, KK3, 8, 14); /* #63 */ - /* Parallel round 5 */ - R(b, c, d, e, a, F0, KK4, 8, 12); - R(a, b, c, d, e, F0, KK4, 5, 15); - R(e, a, b, c, d, F0, KK4, 12, 10); - R(d, e, a, b, c, F0, KK4, 9, 4); - R(c, d, e, a, b, F0, KK4, 12, 1); - R(b, c, d, e, a, F0, KK4, 5, 5); - R(a, b, c, d, e, F0, KK4, 14, 8); - R(e, a, b, c, d, F0, KK4, 6, 7); - R(d, e, a, b, c, F0, KK4, 8, 6); - R(c, d, e, a, b, F0, KK4, 13, 2); - R(b, c, d, e, a, F0, KK4, 6, 13); - R(a, b, c, d, e, F0, KK4, 5, 14); - R(e, a, b, c, d, F0, KK4, 15, 0); - R(d, e, a, b, c, F0, KK4, 13, 3); - R(c, d, e, a, b, F0, KK4, 11, 9); - R(b, c, d, e, a, F0, KK4, 11, 11); /* #79 */ - - t = state[1] + cc + d; - state[1] = state[2] + dd + e; - state[2] = state[3] + ee + a; - state[3] = state[4] + aa + b; - state[4] = state[0] + bb + c; - state[0] = t; -} diff --git a/common/lib/libc/hash/sha1/sha1.c b/common/lib/libc/hash/sha1/sha1.c deleted file mode 100644 index cbd60fc79..000000000 --- a/common/lib/libc/hash/sha1/sha1.c +++ /dev/null @@ -1,289 +0,0 @@ -/* $NetBSD: sha1.c,v 1.6 2009/11/06 20:31:18 joerg Exp $ */ -/* $OpenBSD: sha1.c,v 1.9 1997/07/23 21:12:32 kstailey Exp $ */ - -/* - * SHA-1 in C - * By Steve Reid - * 100% Public Domain - * - * Test Vectors (from FIPS PUB 180-1) - * "abc" - * A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D - * "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq" - * 84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1 - * A million repetitions of "a" - * 34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F - */ - -#define SHA1HANDSOFF /* Copies data before messing with it. */ - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: sha1.c,v 1.6 2009/11/06 20:31:18 joerg Exp $"); - -#include - -#else - -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: sha1.c,v 1.6 2009/11/06 20:31:18 joerg Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include "namespace.h" -#include -#include - -#endif - -#include -#include - - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#if !HAVE_SHA1_H - -#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) - -/* - * blk0() and blk() perform the initial expand. - * I got the idea of expanding during the round function from SSLeay - */ -#if BYTE_ORDER == LITTLE_ENDIAN -# define blk0(i) (block->l[i] = (rol(block->l[i],24)&0xFF00FF00) \ - |(rol(block->l[i],8)&0x00FF00FF)) -#else -# define blk0(i) block->l[i] -#endif -#define blk(i) (block->l[i&15] = rol(block->l[(i+13)&15]^block->l[(i+8)&15] \ - ^block->l[(i+2)&15]^block->l[i&15],1)) - -/* - * (R0+R1), R2, R3, R4 are the different operations (rounds) used in SHA1 - */ -#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y)+blk(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R2(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); -#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk(i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); -#define R4(v,w,x,y,z,i) z+=(w^x^y)+blk(i)+0xCA62C1D6+rol(v,5);w=rol(w,30); - - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if defined(__weak_alias) -__weak_alias(SHA1Transform,_SHA1Transform) -__weak_alias(SHA1Init,_SHA1Init) -__weak_alias(SHA1Update,_SHA1Update) -__weak_alias(SHA1Final,_SHA1Final) -#endif -#endif - -typedef union { - uint8_t c[64]; - uint32_t l[16]; -} CHAR64LONG16; - -/* old sparc64 gcc could not compile this */ -#undef SPARC64_GCC_WORKAROUND -#if defined(__sparc64__) && defined(__GNUC__) && __GNUC__ < 3 -#define SPARC64_GCC_WORKAROUND -#endif - -#ifdef SPARC64_GCC_WORKAROUND -void do_R01(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *); -void do_R2(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *); -void do_R3(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *); -void do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *); - -#define nR0(v,w,x,y,z,i) R0(*v,*w,*x,*y,*z,i) -#define nR1(v,w,x,y,z,i) R1(*v,*w,*x,*y,*z,i) -#define nR2(v,w,x,y,z,i) R2(*v,*w,*x,*y,*z,i) -#define nR3(v,w,x,y,z,i) R3(*v,*w,*x,*y,*z,i) -#define nR4(v,w,x,y,z,i) R4(*v,*w,*x,*y,*z,i) - -void -do_R01(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block) -{ - nR0(a,b,c,d,e, 0); nR0(e,a,b,c,d, 1); nR0(d,e,a,b,c, 2); nR0(c,d,e,a,b, 3); - nR0(b,c,d,e,a, 4); nR0(a,b,c,d,e, 5); nR0(e,a,b,c,d, 6); nR0(d,e,a,b,c, 7); - nR0(c,d,e,a,b, 8); nR0(b,c,d,e,a, 9); nR0(a,b,c,d,e,10); nR0(e,a,b,c,d,11); - nR0(d,e,a,b,c,12); nR0(c,d,e,a,b,13); nR0(b,c,d,e,a,14); nR0(a,b,c,d,e,15); - nR1(e,a,b,c,d,16); nR1(d,e,a,b,c,17); nR1(c,d,e,a,b,18); nR1(b,c,d,e,a,19); -} - -void -do_R2(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block) -{ - nR2(a,b,c,d,e,20); nR2(e,a,b,c,d,21); nR2(d,e,a,b,c,22); nR2(c,d,e,a,b,23); - nR2(b,c,d,e,a,24); nR2(a,b,c,d,e,25); nR2(e,a,b,c,d,26); nR2(d,e,a,b,c,27); - nR2(c,d,e,a,b,28); nR2(b,c,d,e,a,29); nR2(a,b,c,d,e,30); nR2(e,a,b,c,d,31); - nR2(d,e,a,b,c,32); nR2(c,d,e,a,b,33); nR2(b,c,d,e,a,34); nR2(a,b,c,d,e,35); - nR2(e,a,b,c,d,36); nR2(d,e,a,b,c,37); nR2(c,d,e,a,b,38); nR2(b,c,d,e,a,39); -} - -void -do_R3(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block) -{ - nR3(a,b,c,d,e,40); nR3(e,a,b,c,d,41); nR3(d,e,a,b,c,42); nR3(c,d,e,a,b,43); - nR3(b,c,d,e,a,44); nR3(a,b,c,d,e,45); nR3(e,a,b,c,d,46); nR3(d,e,a,b,c,47); - nR3(c,d,e,a,b,48); nR3(b,c,d,e,a,49); nR3(a,b,c,d,e,50); nR3(e,a,b,c,d,51); - nR3(d,e,a,b,c,52); nR3(c,d,e,a,b,53); nR3(b,c,d,e,a,54); nR3(a,b,c,d,e,55); - nR3(e,a,b,c,d,56); nR3(d,e,a,b,c,57); nR3(c,d,e,a,b,58); nR3(b,c,d,e,a,59); -} - -void -do_R4(uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d, uint32_t *e, CHAR64LONG16 *block) -{ - nR4(a,b,c,d,e,60); nR4(e,a,b,c,d,61); nR4(d,e,a,b,c,62); nR4(c,d,e,a,b,63); - nR4(b,c,d,e,a,64); nR4(a,b,c,d,e,65); nR4(e,a,b,c,d,66); nR4(d,e,a,b,c,67); - nR4(c,d,e,a,b,68); nR4(b,c,d,e,a,69); nR4(a,b,c,d,e,70); nR4(e,a,b,c,d,71); - nR4(d,e,a,b,c,72); nR4(c,d,e,a,b,73); nR4(b,c,d,e,a,74); nR4(a,b,c,d,e,75); - nR4(e,a,b,c,d,76); nR4(d,e,a,b,c,77); nR4(c,d,e,a,b,78); nR4(b,c,d,e,a,79); -} -#endif - -/* - * Hash a single 512-bit block. This is the core of the algorithm. - */ -void SHA1Transform(uint32_t state[5], const uint8_t buffer[64]) -{ - uint32_t a, b, c, d, e; - CHAR64LONG16 *block; - -#ifdef SHA1HANDSOFF - CHAR64LONG16 workspace; -#endif - - _DIAGASSERT(buffer != 0); - _DIAGASSERT(state != 0); - -#ifdef SHA1HANDSOFF - block = &workspace; - (void)memcpy(block, buffer, 64); -#else - block = (CHAR64LONG16 *)(void *)buffer; -#endif - - /* Copy context->state[] to working vars */ - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - -#ifdef SPARC64_GCC_WORKAROUND - do_R01(&a, &b, &c, &d, &e, block); - do_R2(&a, &b, &c, &d, &e, block); - do_R3(&a, &b, &c, &d, &e, block); - do_R4(&a, &b, &c, &d, &e, block); -#else - /* 4 rounds of 20 operations each. Loop unrolled. */ - R0(a,b,c,d,e, 0); R0(e,a,b,c,d, 1); R0(d,e,a,b,c, 2); R0(c,d,e,a,b, 3); - R0(b,c,d,e,a, 4); R0(a,b,c,d,e, 5); R0(e,a,b,c,d, 6); R0(d,e,a,b,c, 7); - R0(c,d,e,a,b, 8); R0(b,c,d,e,a, 9); R0(a,b,c,d,e,10); R0(e,a,b,c,d,11); - R0(d,e,a,b,c,12); R0(c,d,e,a,b,13); R0(b,c,d,e,a,14); R0(a,b,c,d,e,15); - R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); - R2(a,b,c,d,e,20); R2(e,a,b,c,d,21); R2(d,e,a,b,c,22); R2(c,d,e,a,b,23); - R2(b,c,d,e,a,24); R2(a,b,c,d,e,25); R2(e,a,b,c,d,26); R2(d,e,a,b,c,27); - R2(c,d,e,a,b,28); R2(b,c,d,e,a,29); R2(a,b,c,d,e,30); R2(e,a,b,c,d,31); - R2(d,e,a,b,c,32); R2(c,d,e,a,b,33); R2(b,c,d,e,a,34); R2(a,b,c,d,e,35); - R2(e,a,b,c,d,36); R2(d,e,a,b,c,37); R2(c,d,e,a,b,38); R2(b,c,d,e,a,39); - R3(a,b,c,d,e,40); R3(e,a,b,c,d,41); R3(d,e,a,b,c,42); R3(c,d,e,a,b,43); - R3(b,c,d,e,a,44); R3(a,b,c,d,e,45); R3(e,a,b,c,d,46); R3(d,e,a,b,c,47); - R3(c,d,e,a,b,48); R3(b,c,d,e,a,49); R3(a,b,c,d,e,50); R3(e,a,b,c,d,51); - R3(d,e,a,b,c,52); R3(c,d,e,a,b,53); R3(b,c,d,e,a,54); R3(a,b,c,d,e,55); - R3(e,a,b,c,d,56); R3(d,e,a,b,c,57); R3(c,d,e,a,b,58); R3(b,c,d,e,a,59); - R4(a,b,c,d,e,60); R4(e,a,b,c,d,61); R4(d,e,a,b,c,62); R4(c,d,e,a,b,63); - R4(b,c,d,e,a,64); R4(a,b,c,d,e,65); R4(e,a,b,c,d,66); R4(d,e,a,b,c,67); - R4(c,d,e,a,b,68); R4(b,c,d,e,a,69); R4(a,b,c,d,e,70); R4(e,a,b,c,d,71); - R4(d,e,a,b,c,72); R4(c,d,e,a,b,73); R4(b,c,d,e,a,74); R4(a,b,c,d,e,75); - R4(e,a,b,c,d,76); R4(d,e,a,b,c,77); R4(c,d,e,a,b,78); R4(b,c,d,e,a,79); -#endif - - /* Add the working vars back into context.state[] */ - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - state[4] += e; - - /* Wipe variables */ - a = b = c = d = e = 0; -} - - -/* - * SHA1Init - Initialize new context - */ -void SHA1Init(SHA1_CTX *context) -{ - - _DIAGASSERT(context != 0); - - /* SHA1 initialization constants */ - context->state[0] = 0x67452301; - context->state[1] = 0xEFCDAB89; - context->state[2] = 0x98BADCFE; - context->state[3] = 0x10325476; - context->state[4] = 0xC3D2E1F0; - context->count[0] = context->count[1] = 0; -} - - -/* - * Run your data through this. - */ -void SHA1Update(SHA1_CTX *context, const uint8_t *data, unsigned int len) -{ - unsigned int i, j; - - _DIAGASSERT(context != 0); - _DIAGASSERT(data != 0); - - j = context->count[0]; - if ((context->count[0] += len << 3) < j) - context->count[1] += (len>>29)+1; - j = (j >> 3) & 63; - if ((j + len) > 63) { - (void)memcpy(&context->buffer[j], data, (i = 64-j)); - SHA1Transform(context->state, context->buffer); - for ( ; i + 63 < len; i += 64) - SHA1Transform(context->state, &data[i]); - j = 0; - } else { - i = 0; - } - (void)memcpy(&context->buffer[j], &data[i], len - i); -} - - -/* - * Add padding and return the message digest. - */ -void SHA1Final(uint8_t digest[20], SHA1_CTX *context) -{ - unsigned int i; - uint8_t finalcount[8]; - - _DIAGASSERT(digest != 0); - _DIAGASSERT(context != 0); - - for (i = 0; i < 8; i++) { - finalcount[i] = (uint8_t)((context->count[(i >= 4 ? 0 : 1)] - >> ((3-(i & 3)) * 8) ) & 255); /* Endian independent */ - } - SHA1Update(context, (const uint8_t *)"\200", 1); - while ((context->count[0] & 504) != 448) - SHA1Update(context, (const uint8_t *)"\0", 1); - SHA1Update(context, finalcount, 8); /* Should cause a SHA1Transform() */ - - if (digest) { - for (i = 0; i < 20; i++) - digest[i] = (uint8_t) - ((context->state[i>>2] >> ((3-(i & 3)) * 8) ) & 255); - } -} - -#endif /* HAVE_SHA1_H */ diff --git a/common/lib/libc/hash/sha2/sha2.c b/common/lib/libc/hash/sha2/sha2.c deleted file mode 100644 index 54fd84e32..000000000 --- a/common/lib/libc/hash/sha2/sha2.c +++ /dev/null @@ -1,970 +0,0 @@ -/* $NetBSD: sha2.c,v 1.24 2013/06/09 19:46:56 christos Exp $ */ -/* $KAME: sha2.c,v 1.9 2003/07/20 00:28:38 itojun Exp $ */ - -/* - * sha2.c - * - * Version 1.0.0beta1 - * - * Written by Aaron D. Gifford - * - * Copyright 2000 Aaron D. Gifford. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the copyright holder nor the names of contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) AND CONTRIBUTOR(S) ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) OR CONTRIBUTOR(S) BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include - -#if defined(_KERNEL) || defined(_STANDALONE) -__KERNEL_RCSID(0, "$NetBSD: sha2.c,v 1.24 2013/06/09 19:46:56 christos Exp $"); - -#include /* XXX: to pull for vax memset(9) */ -#include - -#else - -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: sha2.c,v 1.24 2013/06/09 19:46:56 christos Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include "namespace.h" -#include - -#if defined(__minix) && defined(_LIBMINC) -#include /* for uintptr_t */ -#endif /* defined(__minix) && defined(_LIBMINC) */ - -#endif - -#include -#include - -#if HAVE_SYS_ENDIAN_H -# include -#endif - -/*** SHA-256/384/512 Various Length Definitions ***********************/ -/* NOTE: Most of these are in sha2.h */ -#define SHA256_SHORT_BLOCK_LENGTH (SHA256_BLOCK_LENGTH - 8) -#define SHA384_SHORT_BLOCK_LENGTH (SHA384_BLOCK_LENGTH - 16) -#define SHA512_SHORT_BLOCK_LENGTH (SHA512_BLOCK_LENGTH - 16) - -/* - * Macro for incrementally adding the unsigned 64-bit integer n to the - * unsigned 128-bit integer (represented using a two-element array of - * 64-bit words): - */ -#define ADDINC128(w,n) { \ - (w)[0] += (uint64_t)(n); \ - if ((w)[0] < (n)) { \ - (w)[1]++; \ - } \ -} - -/*** THE SIX LOGICAL FUNCTIONS ****************************************/ -/* - * Bit shifting and rotation (used by the six SHA-XYZ logical functions: - * - * NOTE: The naming of R and S appears backwards here (R is a SHIFT and - * S is a ROTATION) because the SHA-256/384/512 description document - * (see http://csrc.nist.gov/cryptval/shs/sha256-384-512.pdf) uses this - * same "backwards" definition. - */ -/* Shift-right (used in SHA-256, SHA-384, and SHA-512): */ -#define R(b,x) ((x) >> (b)) -/* 32-bit Rotate-right (used in SHA-256): */ -#define S32(b,x) (((x) >> (b)) | ((x) << (32 - (b)))) -/* 64-bit Rotate-right (used in SHA-384 and SHA-512): */ -#define S64(b,x) (((x) >> (b)) | ((x) << (64 - (b)))) - -/* Two of six logical functions used in SHA-256, SHA-384, and SHA-512: */ -#define Ch(x,y,z) (((x) & (y)) ^ ((~(x)) & (z))) -#define Maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -/* Four of six logical functions used in SHA-256: */ -#define Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) -#define Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) -#define sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) -#define sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) - -/* Four of six logical functions used in SHA-384 and SHA-512: */ -#define Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) -#define Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) -#define sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) -#define sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) - -/*** INTERNAL FUNCTION PROTOTYPES *************************************/ -/* NOTE: These should not be accessed directly from outside this - * library -- they are intended for private internal visibility/use - * only. - */ -static void SHA512_Last(SHA512_CTX *); -void SHA224_Transform(SHA224_CTX *, const uint32_t*); -void SHA256_Transform(SHA256_CTX *, const uint32_t*); -void SHA384_Transform(SHA384_CTX *, const uint64_t*); -void SHA512_Transform(SHA512_CTX *, const uint64_t*); - - -/*** SHA-XYZ INITIAL HASH VALUES AND CONSTANTS ************************/ -/* Hash constant words K for SHA-256: */ -static const uint32_t K256[64] = { - 0x428a2f98UL, 0x71374491UL, 0xb5c0fbcfUL, 0xe9b5dba5UL, - 0x3956c25bUL, 0x59f111f1UL, 0x923f82a4UL, 0xab1c5ed5UL, - 0xd807aa98UL, 0x12835b01UL, 0x243185beUL, 0x550c7dc3UL, - 0x72be5d74UL, 0x80deb1feUL, 0x9bdc06a7UL, 0xc19bf174UL, - 0xe49b69c1UL, 0xefbe4786UL, 0x0fc19dc6UL, 0x240ca1ccUL, - 0x2de92c6fUL, 0x4a7484aaUL, 0x5cb0a9dcUL, 0x76f988daUL, - 0x983e5152UL, 0xa831c66dUL, 0xb00327c8UL, 0xbf597fc7UL, - 0xc6e00bf3UL, 0xd5a79147UL, 0x06ca6351UL, 0x14292967UL, - 0x27b70a85UL, 0x2e1b2138UL, 0x4d2c6dfcUL, 0x53380d13UL, - 0x650a7354UL, 0x766a0abbUL, 0x81c2c92eUL, 0x92722c85UL, - 0xa2bfe8a1UL, 0xa81a664bUL, 0xc24b8b70UL, 0xc76c51a3UL, - 0xd192e819UL, 0xd6990624UL, 0xf40e3585UL, 0x106aa070UL, - 0x19a4c116UL, 0x1e376c08UL, 0x2748774cUL, 0x34b0bcb5UL, - 0x391c0cb3UL, 0x4ed8aa4aUL, 0x5b9cca4fUL, 0x682e6ff3UL, - 0x748f82eeUL, 0x78a5636fUL, 0x84c87814UL, 0x8cc70208UL, - 0x90befffaUL, 0xa4506cebUL, 0xbef9a3f7UL, 0xc67178f2UL -}; - -/* Initial hash value H for SHA-224: */ -static const uint32_t sha224_initial_hash_value[8] = { - 0xc1059ed8UL, - 0x367cd507UL, - 0x3070dd17UL, - 0xf70e5939UL, - 0xffc00b31UL, - 0x68581511UL, - 0x64f98fa7UL, - 0xbefa4fa4UL -}; - -/* Initial hash value H for SHA-256: */ -static const uint32_t sha256_initial_hash_value[8] = { - 0x6a09e667UL, - 0xbb67ae85UL, - 0x3c6ef372UL, - 0xa54ff53aUL, - 0x510e527fUL, - 0x9b05688cUL, - 0x1f83d9abUL, - 0x5be0cd19UL -}; - -/* Hash constant words K for SHA-384 and SHA-512: */ -static const uint64_t K512[80] = { - 0x428a2f98d728ae22ULL, 0x7137449123ef65cdULL, - 0xb5c0fbcfec4d3b2fULL, 0xe9b5dba58189dbbcULL, - 0x3956c25bf348b538ULL, 0x59f111f1b605d019ULL, - 0x923f82a4af194f9bULL, 0xab1c5ed5da6d8118ULL, - 0xd807aa98a3030242ULL, 0x12835b0145706fbeULL, - 0x243185be4ee4b28cULL, 0x550c7dc3d5ffb4e2ULL, - 0x72be5d74f27b896fULL, 0x80deb1fe3b1696b1ULL, - 0x9bdc06a725c71235ULL, 0xc19bf174cf692694ULL, - 0xe49b69c19ef14ad2ULL, 0xefbe4786384f25e3ULL, - 0x0fc19dc68b8cd5b5ULL, 0x240ca1cc77ac9c65ULL, - 0x2de92c6f592b0275ULL, 0x4a7484aa6ea6e483ULL, - 0x5cb0a9dcbd41fbd4ULL, 0x76f988da831153b5ULL, - 0x983e5152ee66dfabULL, 0xa831c66d2db43210ULL, - 0xb00327c898fb213fULL, 0xbf597fc7beef0ee4ULL, - 0xc6e00bf33da88fc2ULL, 0xd5a79147930aa725ULL, - 0x06ca6351e003826fULL, 0x142929670a0e6e70ULL, - 0x27b70a8546d22ffcULL, 0x2e1b21385c26c926ULL, - 0x4d2c6dfc5ac42aedULL, 0x53380d139d95b3dfULL, - 0x650a73548baf63deULL, 0x766a0abb3c77b2a8ULL, - 0x81c2c92e47edaee6ULL, 0x92722c851482353bULL, - 0xa2bfe8a14cf10364ULL, 0xa81a664bbc423001ULL, - 0xc24b8b70d0f89791ULL, 0xc76c51a30654be30ULL, - 0xd192e819d6ef5218ULL, 0xd69906245565a910ULL, - 0xf40e35855771202aULL, 0x106aa07032bbd1b8ULL, - 0x19a4c116b8d2d0c8ULL, 0x1e376c085141ab53ULL, - 0x2748774cdf8eeb99ULL, 0x34b0bcb5e19b48a8ULL, - 0x391c0cb3c5c95a63ULL, 0x4ed8aa4ae3418acbULL, - 0x5b9cca4f7763e373ULL, 0x682e6ff3d6b2b8a3ULL, - 0x748f82ee5defb2fcULL, 0x78a5636f43172f60ULL, - 0x84c87814a1f0ab72ULL, 0x8cc702081a6439ecULL, - 0x90befffa23631e28ULL, 0xa4506cebde82bde9ULL, - 0xbef9a3f7b2c67915ULL, 0xc67178f2e372532bULL, - 0xca273eceea26619cULL, 0xd186b8c721c0c207ULL, - 0xeada7dd6cde0eb1eULL, 0xf57d4f7fee6ed178ULL, - 0x06f067aa72176fbaULL, 0x0a637dc5a2c898a6ULL, - 0x113f9804bef90daeULL, 0x1b710b35131c471bULL, - 0x28db77f523047d84ULL, 0x32caab7b40c72493ULL, - 0x3c9ebe0a15c9bebcULL, 0x431d67c49c100d4cULL, - 0x4cc5d4becb3e42b6ULL, 0x597f299cfc657e2aULL, - 0x5fcb6fab3ad6faecULL, 0x6c44198c4a475817ULL -}; - -/* Initial hash value H for SHA-384 */ -static const uint64_t sha384_initial_hash_value[8] = { - 0xcbbb9d5dc1059ed8ULL, - 0x629a292a367cd507ULL, - 0x9159015a3070dd17ULL, - 0x152fecd8f70e5939ULL, - 0x67332667ffc00b31ULL, - 0x8eb44a8768581511ULL, - 0xdb0c2e0d64f98fa7ULL, - 0x47b5481dbefa4fa4ULL -}; - -/* Initial hash value H for SHA-512 */ -static const uint64_t sha512_initial_hash_value[8] = { - 0x6a09e667f3bcc908ULL, - 0xbb67ae8584caa73bULL, - 0x3c6ef372fe94f82bULL, - 0xa54ff53a5f1d36f1ULL, - 0x510e527fade682d1ULL, - 0x9b05688c2b3e6c1fULL, - 0x1f83d9abfb41bd6bULL, - 0x5be0cd19137e2179ULL -}; - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if defined(__weak_alias) -__weak_alias(SHA224_Init,_SHA224_Init) -__weak_alias(SHA224_Update,_SHA224_Update) -__weak_alias(SHA224_Final,_SHA224_Final) -__weak_alias(SHA224_Transform,_SHA224_Transform) - -__weak_alias(SHA256_Init,_SHA256_Init) -__weak_alias(SHA256_Update,_SHA256_Update) -__weak_alias(SHA256_Final,_SHA256_Final) -__weak_alias(SHA256_Transform,_SHA256_Transform) - -__weak_alias(SHA384_Init,_SHA384_Init) -__weak_alias(SHA384_Update,_SHA384_Update) -__weak_alias(SHA384_Final,_SHA384_Final) -__weak_alias(SHA384_Transform,_SHA384_Transform) - -__weak_alias(SHA512_Init,_SHA512_Init) -__weak_alias(SHA512_Update,_SHA512_Update) -__weak_alias(SHA512_Final,_SHA512_Final) -__weak_alias(SHA512_Transform,_SHA512_Transform) -#endif -#endif - -/*** SHA-256: *********************************************************/ -int -SHA256_Init(SHA256_CTX *context) -{ - if (context == NULL) - return 1; - - memcpy(context->state, sha256_initial_hash_value, - (size_t)(SHA256_DIGEST_LENGTH)); - memset(context->buffer, 0, (size_t)(SHA256_BLOCK_LENGTH)); - context->bitcount = 0; - - return 1; -} - -#ifdef SHA2_UNROLL_TRANSFORM - -/* Unrolled SHA-256 round macros: */ - -#define ROUND256_0_TO_15(a,b,c,d,e,f,g,h) \ - W256[j] = be32dec(data); \ - ++data; \ - T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + \ - K256[j] + W256[j]; \ - (d) += T1; \ - (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ - j++ - -#define ROUND256(a,b,c,d,e,f,g,h) \ - s0 = W256[(j+1)&0x0f]; \ - s0 = sigma0_256(s0); \ - s1 = W256[(j+14)&0x0f]; \ - s1 = sigma1_256(s1); \ - T1 = (h) + Sigma1_256(e) + Ch((e), (f), (g)) + K256[j] + \ - (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); \ - (d) += T1; \ - (h) = T1 + Sigma0_256(a) + Maj((a), (b), (c)); \ - j++ - -void -SHA256_Transform(SHA256_CTX *context, const uint32_t *data) -{ - uint32_t a, b, c, d, e, f, g, h, s0, s1; - uint32_t T1, *W256; - int j; - - W256 = (uint32_t *)context->buffer; - - /* Initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { - /* Rounds 0 to 15 (unrolled): */ - ROUND256_0_TO_15(a,b,c,d,e,f,g,h); - ROUND256_0_TO_15(h,a,b,c,d,e,f,g); - ROUND256_0_TO_15(g,h,a,b,c,d,e,f); - ROUND256_0_TO_15(f,g,h,a,b,c,d,e); - ROUND256_0_TO_15(e,f,g,h,a,b,c,d); - ROUND256_0_TO_15(d,e,f,g,h,a,b,c); - ROUND256_0_TO_15(c,d,e,f,g,h,a,b); - ROUND256_0_TO_15(b,c,d,e,f,g,h,a); - } while (j < 16); - - /* Now for the remaining rounds to 64: */ - do { - ROUND256(a,b,c,d,e,f,g,h); - ROUND256(h,a,b,c,d,e,f,g); - ROUND256(g,h,a,b,c,d,e,f); - ROUND256(f,g,h,a,b,c,d,e); - ROUND256(e,f,g,h,a,b,c,d); - ROUND256(d,e,f,g,h,a,b,c); - ROUND256(c,d,e,f,g,h,a,b); - ROUND256(b,c,d,e,f,g,h,a); - } while (j < 64); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = 0; -} - -#else /* SHA2_UNROLL_TRANSFORM */ - -void -SHA256_Transform(SHA256_CTX *context, const uint32_t *data) -{ - uint32_t a, b, c, d, e, f, g, h, s0, s1; - uint32_t T1, T2, *W256; - int j; - - W256 = (uint32_t *)(void *)context->buffer; - - /* Initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { - W256[j] = be32dec(data); - ++data; - /* Apply the SHA-256 compression function to update a..h */ - T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + W256[j]; - T2 = Sigma0_256(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - - j++; - } while (j < 16); - - do { - /* Part of the message block expansion: */ - s0 = W256[(j+1)&0x0f]; - s0 = sigma0_256(s0); - s1 = W256[(j+14)&0x0f]; - s1 = sigma1_256(s1); - - /* Apply the SHA-256 compression function to update a..h */ - T1 = h + Sigma1_256(e) + Ch(e, f, g) + K256[j] + - (W256[j&0x0f] += s1 + W256[(j+9)&0x0f] + s0); - T2 = Sigma0_256(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - - j++; - } while (j < 64); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = T2 = 0; -} - -#endif /* SHA2_UNROLL_TRANSFORM */ - -int -SHA256_Update(SHA256_CTX *context, const uint8_t *data, size_t len) -{ - unsigned int freespace, usedspace; - - if (len == 0) { - /* Calling with no data is valid - we do nothing */ - return 1; - } - - usedspace = (unsigned int)((context->bitcount >> 3) % - SHA256_BLOCK_LENGTH); - if (usedspace > 0) { - /* Calculate how much free space is available in the buffer */ - freespace = SHA256_BLOCK_LENGTH - usedspace; - - if (len >= freespace) { - /* Fill the buffer completely and process it */ - memcpy(&context->buffer[usedspace], data, - (size_t)(freespace)); - context->bitcount += freespace << 3; - len -= freespace; - data += freespace; - SHA256_Transform(context, - (uint32_t *)(void *)context->buffer); - } else { - /* The buffer is not yet full */ - memcpy(&context->buffer[usedspace], data, len); - context->bitcount += len << 3; - /* Clean up: */ - usedspace = freespace = 0; - return 1; - } - } - /* - * Process as many complete blocks as possible. - * - * Check alignment of the data pointer. If it is 32bit aligned, - * SHA256_Transform can be called directly on the data stream, - * otherwise enforce the alignment by copy into the buffer. - */ - if ((uintptr_t)data % 4 == 0) { - while (len >= SHA256_BLOCK_LENGTH) { - SHA256_Transform(context, - (const uint32_t *)(const void *)data); - context->bitcount += SHA256_BLOCK_LENGTH << 3; - len -= SHA256_BLOCK_LENGTH; - data += SHA256_BLOCK_LENGTH; - } - } else { - while (len >= SHA256_BLOCK_LENGTH) { - memcpy(context->buffer, data, SHA256_BLOCK_LENGTH); - SHA256_Transform(context, - (const uint32_t *)(const void *)context->buffer); - context->bitcount += SHA256_BLOCK_LENGTH << 3; - len -= SHA256_BLOCK_LENGTH; - data += SHA256_BLOCK_LENGTH; - } - } - if (len > 0) { - /* There's left-overs, so save 'em */ - memcpy(context->buffer, data, len); - context->bitcount += len << 3; - } - /* Clean up: */ - usedspace = freespace = 0; - - return 1; -} - -static int -SHA224_256_Final(uint8_t digest[], SHA256_CTX *context, size_t len) -{ - unsigned int usedspace; - size_t i; - - /* If no digest buffer is passed, we don't bother doing this: */ - if (digest != NULL) { - usedspace = (unsigned int)((context->bitcount >> 3) % - SHA256_BLOCK_LENGTH); - context->bitcount = htobe64(context->bitcount); - if (usedspace > 0) { - /* Begin padding with a 1 bit: */ - context->buffer[usedspace++] = 0x80; - - if (usedspace <= SHA256_SHORT_BLOCK_LENGTH) { - /* Set-up for the last transform: */ - memset(&context->buffer[usedspace], 0, - (size_t)(SHA256_SHORT_BLOCK_LENGTH - - usedspace)); - } else { - if (usedspace < SHA256_BLOCK_LENGTH) { - memset(&context->buffer[usedspace], 0, - (size_t)(SHA256_BLOCK_LENGTH - - usedspace)); - } - /* Do second-to-last transform: */ - SHA256_Transform(context, - (uint32_t *)(void *)context->buffer); - - /* And set-up for the last transform: */ - memset(context->buffer, 0, - (size_t)(SHA256_SHORT_BLOCK_LENGTH)); - } - } else { - /* Set-up for the last transform: */ - memset(context->buffer, 0, - (size_t)(SHA256_SHORT_BLOCK_LENGTH)); - - /* Begin padding with a 1 bit: */ - *context->buffer = 0x80; - } - /* Set the bit count: */ - memcpy(&context->buffer[SHA256_SHORT_BLOCK_LENGTH], - &context->bitcount, sizeof(context->bitcount)); - - /* Final transform: */ - SHA256_Transform(context, (uint32_t *)(void *)context->buffer); - - for (i = 0; i < len / 4; i++) - be32enc(digest + 4 * i, context->state[i]); - } - - /* Clean up state data: */ - memset(context, 0, sizeof(*context)); - usedspace = 0; - - return 1; -} - -int -SHA256_Final(uint8_t digest[], SHA256_CTX *context) -{ - return SHA224_256_Final(digest, context, SHA256_DIGEST_LENGTH); -} - -/*** SHA-224: *********************************************************/ -int -SHA224_Init(SHA224_CTX *context) -{ - if (context == NULL) - return 1; - - /* The state and buffer size are driven by SHA256, not by SHA224. */ - memcpy(context->state, sha224_initial_hash_value, - (size_t)(SHA256_DIGEST_LENGTH)); - memset(context->buffer, 0, (size_t)(SHA256_BLOCK_LENGTH)); - context->bitcount = 0; - - return 1; -} - -int -SHA224_Update(SHA224_CTX *context, const uint8_t *data, size_t len) -{ - return SHA256_Update((SHA256_CTX *)context, data, len); -} - -void -SHA224_Transform(SHA224_CTX *context, const uint32_t *data) -{ - SHA256_Transform((SHA256_CTX *)context, data); -} - -int -SHA224_Final(uint8_t digest[], SHA224_CTX *context) -{ - return SHA224_256_Final(digest, (SHA256_CTX *)context, - SHA224_DIGEST_LENGTH); -} - -/*** SHA-512: *********************************************************/ -int -SHA512_Init(SHA512_CTX *context) -{ - if (context == NULL) - return 1; - - memcpy(context->state, sha512_initial_hash_value, - (size_t)(SHA512_DIGEST_LENGTH)); - memset(context->buffer, 0, (size_t)(SHA512_BLOCK_LENGTH)); - context->bitcount[0] = context->bitcount[1] = 0; - - return 1; -} - -#ifdef SHA2_UNROLL_TRANSFORM - -/* Unrolled SHA-512 round macros: */ -#define ROUND512_0_TO_15(a,b,c,d,e,f,g,h) \ - W512[j] = be64dec(data); \ - ++data; \ - T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + \ - K512[j] + W512[j]; \ - (d) += T1, \ - (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)), \ - j++ - -#define ROUND512(a,b,c,d,e,f,g,h) \ - s0 = W512[(j+1)&0x0f]; \ - s0 = sigma0_512(s0); \ - s1 = W512[(j+14)&0x0f]; \ - s1 = sigma1_512(s1); \ - T1 = (h) + Sigma1_512(e) + Ch((e), (f), (g)) + K512[j] + \ - (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); \ - (d) += T1; \ - (h) = T1 + Sigma0_512(a) + Maj((a), (b), (c)); \ - j++ - -void -SHA512_Transform(SHA512_CTX *context, const uint64_t *data) -{ - uint64_t a, b, c, d, e, f, g, h, s0, s1; - uint64_t T1, *W512 = (uint64_t *)context->buffer; - int j; - - /* Initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { - ROUND512_0_TO_15(a,b,c,d,e,f,g,h); - ROUND512_0_TO_15(h,a,b,c,d,e,f,g); - ROUND512_0_TO_15(g,h,a,b,c,d,e,f); - ROUND512_0_TO_15(f,g,h,a,b,c,d,e); - ROUND512_0_TO_15(e,f,g,h,a,b,c,d); - ROUND512_0_TO_15(d,e,f,g,h,a,b,c); - ROUND512_0_TO_15(c,d,e,f,g,h,a,b); - ROUND512_0_TO_15(b,c,d,e,f,g,h,a); - } while (j < 16); - - /* Now for the remaining rounds up to 79: */ - do { - ROUND512(a,b,c,d,e,f,g,h); - ROUND512(h,a,b,c,d,e,f,g); - ROUND512(g,h,a,b,c,d,e,f); - ROUND512(f,g,h,a,b,c,d,e); - ROUND512(e,f,g,h,a,b,c,d); - ROUND512(d,e,f,g,h,a,b,c); - ROUND512(c,d,e,f,g,h,a,b); - ROUND512(b,c,d,e,f,g,h,a); - } while (j < 80); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = 0; -} - -#else /* SHA2_UNROLL_TRANSFORM */ - -void -SHA512_Transform(SHA512_CTX *context, const uint64_t *data) -{ - uint64_t a, b, c, d, e, f, g, h, s0, s1; - uint64_t T1, T2, *W512 = (void *)context->buffer; - int j; - - /* Initialize registers with the prev. intermediate value */ - a = context->state[0]; - b = context->state[1]; - c = context->state[2]; - d = context->state[3]; - e = context->state[4]; - f = context->state[5]; - g = context->state[6]; - h = context->state[7]; - - j = 0; - do { - W512[j] = be64dec(data); - ++data; - /* Apply the SHA-512 compression function to update a..h */ - T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + W512[j]; - T2 = Sigma0_512(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - - j++; - } while (j < 16); - - do { - /* Part of the message block expansion: */ - s0 = W512[(j+1)&0x0f]; - s0 = sigma0_512(s0); - s1 = W512[(j+14)&0x0f]; - s1 = sigma1_512(s1); - - /* Apply the SHA-512 compression function to update a..h */ - T1 = h + Sigma1_512(e) + Ch(e, f, g) + K512[j] + - (W512[j&0x0f] += s1 + W512[(j+9)&0x0f] + s0); - T2 = Sigma0_512(a) + Maj(a, b, c); - h = g; - g = f; - f = e; - e = d + T1; - d = c; - c = b; - b = a; - a = T1 + T2; - - j++; - } while (j < 80); - - /* Compute the current intermediate hash value */ - context->state[0] += a; - context->state[1] += b; - context->state[2] += c; - context->state[3] += d; - context->state[4] += e; - context->state[5] += f; - context->state[6] += g; - context->state[7] += h; - - /* Clean up */ - a = b = c = d = e = f = g = h = T1 = T2 = 0; -} - -#endif /* SHA2_UNROLL_TRANSFORM */ - -int -SHA512_Update(SHA512_CTX *context, const uint8_t *data, size_t len) -{ - unsigned int freespace, usedspace; - - if (len == 0) { - /* Calling with no data is valid - we do nothing */ - return 1; - } - - usedspace = (unsigned int)((context->bitcount[0] >> 3) % - SHA512_BLOCK_LENGTH); - if (usedspace > 0) { - /* Calculate how much free space is available in the buffer */ - freespace = SHA512_BLOCK_LENGTH - usedspace; - - if (len >= freespace) { - /* Fill the buffer completely and process it */ - memcpy(&context->buffer[usedspace], data, - (size_t)(freespace)); - ADDINC128(context->bitcount, freespace << 3); - len -= freespace; - data += freespace; - SHA512_Transform(context, - (uint64_t *)(void *)context->buffer); - } else { - /* The buffer is not yet full */ - memcpy(&context->buffer[usedspace], data, len); - ADDINC128(context->bitcount, len << 3); - /* Clean up: */ - usedspace = freespace = 0; - return 1; - } - } - /* - * Process as many complete blocks as possible. - * - * Check alignment of the data pointer. If it is 64bit aligned, - * SHA512_Transform can be called directly on the data stream, - * otherwise enforce the alignment by copy into the buffer. - */ - if ((uintptr_t)data % 8 == 0) { - while (len >= SHA512_BLOCK_LENGTH) { - SHA512_Transform(context, - (const uint64_t*)(const void *)data); - ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); - len -= SHA512_BLOCK_LENGTH; - data += SHA512_BLOCK_LENGTH; - } - } else { - while (len >= SHA512_BLOCK_LENGTH) { - memcpy(context->buffer, data, SHA512_BLOCK_LENGTH); - SHA512_Transform(context, - (const void *)context->buffer); - ADDINC128(context->bitcount, SHA512_BLOCK_LENGTH << 3); - len -= SHA512_BLOCK_LENGTH; - data += SHA512_BLOCK_LENGTH; - } - } - if (len > 0) { - /* There's left-overs, so save 'em */ - memcpy(context->buffer, data, len); - ADDINC128(context->bitcount, len << 3); - } - /* Clean up: */ - usedspace = freespace = 0; - - return 1; -} - -static void -SHA512_Last(SHA512_CTX *context) -{ - unsigned int usedspace; - - usedspace = (unsigned int)((context->bitcount[0] >> 3) % SHA512_BLOCK_LENGTH); - context->bitcount[0] = htobe64(context->bitcount[0]); - context->bitcount[1] = htobe64(context->bitcount[1]); - if (usedspace > 0) { - /* Begin padding with a 1 bit: */ - context->buffer[usedspace++] = 0x80; - - if (usedspace <= SHA512_SHORT_BLOCK_LENGTH) { - /* Set-up for the last transform: */ - memset(&context->buffer[usedspace], 0, - (size_t)(SHA512_SHORT_BLOCK_LENGTH - usedspace)); - } else { - if (usedspace < SHA512_BLOCK_LENGTH) { - memset(&context->buffer[usedspace], 0, - (size_t)(SHA512_BLOCK_LENGTH - usedspace)); - } - /* Do second-to-last transform: */ - SHA512_Transform(context, - (uint64_t *)(void *)context->buffer); - - /* And set-up for the last transform: */ - memset(context->buffer, 0, - (size_t)(SHA512_BLOCK_LENGTH - 2)); - } - } else { - /* Prepare for final transform: */ - memset(context->buffer, 0, (size_t)(SHA512_SHORT_BLOCK_LENGTH)); - - /* Begin padding with a 1 bit: */ - *context->buffer = 0x80; - } - /* Store the length of input data (in bits): */ - memcpy(&context->buffer[SHA512_SHORT_BLOCK_LENGTH], - &context->bitcount[1], sizeof(context->bitcount[1])); - memcpy(&context->buffer[SHA512_SHORT_BLOCK_LENGTH + 8], - &context->bitcount[0], sizeof(context->bitcount[0])); - - /* Final transform: */ - SHA512_Transform(context, (uint64_t *)(void *)context->buffer); -} - -int -SHA512_Final(uint8_t digest[], SHA512_CTX *context) -{ - size_t i; - - /* If no digest buffer is passed, we don't bother doing this: */ - if (digest != NULL) { - SHA512_Last(context); - - /* Save the hash data for output: */ - for (i = 0; i < 8; ++i) - be64enc(digest + 8 * i, context->state[i]); - } - - /* Zero out state data */ - memset(context, 0, sizeof(*context)); - - return 1; -} - -/*** SHA-384: *********************************************************/ -int -SHA384_Init(SHA384_CTX *context) -{ - if (context == NULL) - return 1; - - memcpy(context->state, sha384_initial_hash_value, - (size_t)(SHA512_DIGEST_LENGTH)); - memset(context->buffer, 0, (size_t)(SHA384_BLOCK_LENGTH)); - context->bitcount[0] = context->bitcount[1] = 0; - - return 1; -} - -int -SHA384_Update(SHA384_CTX *context, const uint8_t *data, size_t len) -{ - return SHA512_Update((SHA512_CTX *)context, data, len); -} - -void -SHA384_Transform(SHA512_CTX *context, const uint64_t *data) -{ - SHA512_Transform((SHA512_CTX *)context, data); -} - -int -SHA384_Final(uint8_t digest[], SHA384_CTX *context) -{ - size_t i; - - /* If no digest buffer is passed, we don't bother doing this: */ - if (digest != NULL) { - SHA512_Last((SHA512_CTX *)context); - - /* Save the hash data for output: */ - for (i = 0; i < 6; ++i) - be64enc(digest + 8 * i, context->state[i]); - } - - /* Zero out state data */ - memset(context, 0, sizeof(*context)); - - return 1; -} diff --git a/common/lib/libc/inet/inet_addr.c b/common/lib/libc/inet/inet_addr.c deleted file mode 100644 index 1360ce970..000000000 --- a/common/lib/libc/inet/inet_addr.c +++ /dev/null @@ -1,224 +0,0 @@ -/* $NetBSD: inet_addr.c,v 1.3 2012/03/09 15:41:16 christos Exp $ */ - -/* - * Copyright (c) 1983, 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * Portions Copyright (c) 1993 by Digital Equipment Corporation. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies, and that - * the name of Digital Equipment Corporation not be used in advertising or - * publicity pertaining to distribution of the document or software without - * specific, written prior permission. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT - * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL - * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR - * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS - * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS - * SOFTWARE. - */ - -/* - * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC") - * Portions Copyright (c) 1996-1999 by Internet Software Consortium. - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES - * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF - * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR - * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN - * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static const char sccsid[] = "@(#)inet_addr.c 8.1 (Berkeley) 6/17/93"; -static const char rcsid[] = "Id: inet_addr.c,v 1.2.206.2 2004/03/17 00:29:45 marka Exp"; -#else -__RCSID("$NetBSD: inet_addr.c,v 1.3 2012/03/09 15:41:16 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "port_before.h" - -#include "namespace.h" -#include -#include - -#include -#include - -#include - -#include "port_after.h" - -#ifdef __weak_alias -__weak_alias(inet_aton,_inet_aton) -#endif -#else -#include -#include -#endif - -/* - * Ascii internet address interpretation routine. - * The value returned is in network order. - */ -uint32_t -inet_addr(const char *cp) { - struct in_addr val; - - if (inet_aton(cp, &val)) - return (val.s_addr); - return (INADDR_NONE); -} - -/* - * Check whether "cp" is a valid ascii representation - * of an Internet address and convert to a binary address. - * Returns 1 if the address is valid, 0 if not. - * This replaces inet_addr, the return value from which - * cannot distinguish between failure and a local broadcast address. - */ -int -inet_aton(const char *cp, struct in_addr *addr) { - uint32_t val; - int base; - size_t n; - char c; - uint8_t parts[4]; - uint8_t *pp = parts; - int digit; - - c = *cp; - for (;;) { - /* - * Collect number up to ``.''. - * Values are specified as for C: - * 0x=hex, 0=octal, isdigit=decimal. - */ - if (!isdigit((unsigned char)c)) - return (0); - val = 0; base = 10; digit = 0; - if (c == '0') { - c = *++cp; - if (c == 'x' || c == 'X') - base = 16, c = *++cp; - else { - base = 8; - digit = 1 ; - } - } - for (;;) { - if (isascii(c) && isdigit((unsigned char)c)) { - if (base == 8 && (c == '8' || c == '9')) - return (0); - val = (val * base) + (c - '0'); - c = *++cp; - digit = 1; - } else if (base == 16 && isascii(c) && - isxdigit((unsigned char)c)) { - val = (val << 4) | - (c + 10 - (islower((unsigned char)c) ? 'a' : 'A')); - c = *++cp; - digit = 1; - } else - break; - } - if (c == '.') { - /* - * Internet format: - * a.b.c.d - * a.b.c (with c treated as 16 bits) - * a.b (with b treated as 24 bits) - */ - if (pp >= parts + 3 || val > 0xffU) - return (0); - *pp++ = val; - c = *++cp; - } else - break; - } - /* - * Check for trailing characters. - */ - if (c != '\0' && (!isascii(c) || !isspace((unsigned char)c))) - return (0); - /* - * Did we get a valid digit? - */ - if (!digit) - return (0); - /* - * Concoct the address according to - * the number of parts specified. - */ - n = pp - parts + 1; - switch (n) { - case 1: /* a -- 32 bits */ - break; - - case 2: /* a.b -- 8.24 bits */ - if (val > 0xffffffU) - return (0); - val |= parts[0] << 24; - break; - - case 3: /* a.b.c -- 8.8.16 bits */ - if (val > 0xffffU) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16); - break; - - case 4: /* a.b.c.d -- 8.8.8.8 bits */ - if (val > 0xffU) - return (0); - val |= (parts[0] << 24) | (parts[1] << 16) | (parts[2] << 8); - break; - } - if (addr != NULL) - addr->s_addr = htonl(val); - return (1); -} diff --git a/common/lib/libc/md/md4c.c b/common/lib/libc/md/md4c.c deleted file mode 100644 index d51d95fcb..000000000 --- a/common/lib/libc/md/md4c.c +++ /dev/null @@ -1,324 +0,0 @@ -/* $NetBSD: md4c.c,v 1.5 2012/03/20 16:21:41 matt Exp $ */ - -/* - * This file is derived from the RSA Data Security, Inc. MD4 Message-Digest - * Algorithm and has been modified by Jason R. Thorpe - * for portability and formatting. - */ - -/* - * Copyright (C) 1990-2, RSA Data Security, Inc. All rights reserved. - * - * License to copy and use this software is granted provided that it - * is identified as the "RSA Data Security, Inc. MD4 Message-Digest - * Algorithm" in all material mentioning or referencing this software - * or this function. - * - * License is also granted to make and use derivative works provided - * that such works are identified as "derived from the RSA Data - * Security, Inc. MD4 Message-Digest Algorithm" in all material - * mentioning or referencing the derived work. - * - * RSA Data Security, Inc. makes no representations concerning either - * the merchantability of this software or the suitability of this - * software for any particular purpose. It is provided "as is" - * without express or implied warranty of any kind. - * - * These notices must be retained in any copies of any part of this - * documentation and/or software. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: md4c.c,v 1.5 2012/03/20 16:21:41 matt Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include "namespace.h" - -#include - -#include -#include -#include - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#else - -#include -#include -#include - -#endif /* !_KERNEL && !_STANDALONE */ - -#if !HAVE_MD4_H - -typedef unsigned char *POINTER; -typedef uint16_t UINT2; -typedef uint32_t UINT4; - -/* - * Constants for MD4Transform routine. - */ -#define S11 3 -#define S12 7 -#define S13 11 -#define S14 19 -#define S21 3 -#define S22 5 -#define S23 9 -#define S24 13 -#define S31 3 -#define S32 9 -#define S33 11 -#define S34 15 - -static void MD4Transform(UINT4 [4], const unsigned char [64]); - -static void Encode(unsigned char *, UINT4 *, unsigned int); -static void Decode(UINT4 *, const unsigned char *, unsigned int); - -static const unsigned char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* - * F, G and H are basic MD4 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (y)) | ((x) & (z)) | ((y) & (z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) - -/* - * ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* - * FF, GG and HH are transformations for rounds 1, 2 and 3. - * Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s) { \ - (a) += F ((b), (c), (d)) + (x); \ - (a) = ROTATE_LEFT ((a), (s)); \ -} - -#define GG(a, b, c, d, x, s) { \ - (a) += G ((b), (c), (d)) + (x) + (UINT4)0x5a827999; \ - (a) = ROTATE_LEFT ((a), (s)); \ -} - -#define HH(a, b, c, d, x, s) { \ - (a) += H ((b), (c), (d)) + (x) + (UINT4)0x6ed9eba1; \ - (a) = ROTATE_LEFT ((a), (s)); \ -} - -#if !defined(_KERNEL) && !defined(_STANDALONE) && defined(__weak_alias) -__weak_alias(MD4Init,_MD4Init) -__weak_alias(MD4Update,_MD4Update) -__weak_alias(MD4Final,_MD4Final) -__weak_alias(MD4Transform,_MD4Transform) -#endif - -/* - * MD4 initialization. Begins an MD4 operation, writing a new context. - */ -void -MD4Init(MD4_CTX *context) /* context */ -{ - - _DIAGASSERT(context != 0); - - context->count[0] = context->count[1] = 0; - - /* Load magic initialization constants. */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} - -/* - * MD4 block update operation. Continues an MD4 message-digest - * operation, processing another message block, and updating the - * context. - */ -void -MD4Update (MD4_CTX *context, /* context */ - const unsigned char *input, /* input block */ - unsigned int inputLen) /* length of input block */ -{ - unsigned int i, idx, partLen; - - _DIAGASSERT(context != 0); - _DIAGASSERT(input != 0); - - /* Compute number of bytes mod 64 */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((UINT4)inputLen << 3)) - < ((UINT4)inputLen << 3)) - context->count[1]++; - context->count[1] += ((UINT4)inputLen >> 29); - - partLen = 64 - idx; - - /* Transform as many times as possible. */ - if (inputLen >= partLen) { - memcpy(&context->buffer[idx], input, partLen); - MD4Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD4Transform(context->state, &input[i]); - - idx = 0; - } else - i = 0; - - /* Buffer remaining input */ - memcpy(&context->buffer[idx], &input[i], inputLen - i); -} - -/* - * MD4 finalization. Ends an MD4 message-digest operation, writing the - * message digest and zeroing the context. - */ -void -MD4Final (unsigned char digest[16], /* message digest */ - MD4_CTX *context) /* context */ -{ - unsigned char bits[8]; - unsigned int idx, padLen; - - _DIAGASSERT(digest != 0); - _DIAGASSERT(context != 0); - - /* Save number of bits */ - Encode(bits, context->count, 8); - - /* Pad out to 56 mod 64. */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (idx < 56) ? (56 - idx) : (120 - idx); - MD4Update(context, PADDING, padLen); - - /* Append length (before padding) */ - MD4Update(context, bits, 8); - - /* Store state in digest */ - Encode(digest, context->state, 16); - - /* Zeroize sensitive information. */ - memset(context, 0, sizeof(*context)); -} - -/* - * MD4 basic transformation. Transforms state based on block. - */ -static void -MD4Transform (UINT4 state[4], const unsigned char block[64]) -{ - UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode(x, block, 64); - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11); /* 1 */ - FF (d, a, b, c, x[ 1], S12); /* 2 */ - FF (c, d, a, b, x[ 2], S13); /* 3 */ - FF (b, c, d, a, x[ 3], S14); /* 4 */ - FF (a, b, c, d, x[ 4], S11); /* 5 */ - FF (d, a, b, c, x[ 5], S12); /* 6 */ - FF (c, d, a, b, x[ 6], S13); /* 7 */ - FF (b, c, d, a, x[ 7], S14); /* 8 */ - FF (a, b, c, d, x[ 8], S11); /* 9 */ - FF (d, a, b, c, x[ 9], S12); /* 10 */ - FF (c, d, a, b, x[10], S13); /* 11 */ - FF (b, c, d, a, x[11], S14); /* 12 */ - FF (a, b, c, d, x[12], S11); /* 13 */ - FF (d, a, b, c, x[13], S12); /* 14 */ - FF (c, d, a, b, x[14], S13); /* 15 */ - FF (b, c, d, a, x[15], S14); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 0], S21); /* 17 */ - GG (d, a, b, c, x[ 4], S22); /* 18 */ - GG (c, d, a, b, x[ 8], S23); /* 19 */ - GG (b, c, d, a, x[12], S24); /* 20 */ - GG (a, b, c, d, x[ 1], S21); /* 21 */ - GG (d, a, b, c, x[ 5], S22); /* 22 */ - GG (c, d, a, b, x[ 9], S23); /* 23 */ - GG (b, c, d, a, x[13], S24); /* 24 */ - GG (a, b, c, d, x[ 2], S21); /* 25 */ - GG (d, a, b, c, x[ 6], S22); /* 26 */ - GG (c, d, a, b, x[10], S23); /* 27 */ - GG (b, c, d, a, x[14], S24); /* 28 */ - GG (a, b, c, d, x[ 3], S21); /* 29 */ - GG (d, a, b, c, x[ 7], S22); /* 30 */ - GG (c, d, a, b, x[11], S23); /* 31 */ - GG (b, c, d, a, x[15], S24); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 0], S31); /* 33 */ - HH (d, a, b, c, x[ 8], S32); /* 34 */ - HH (c, d, a, b, x[ 4], S33); /* 35 */ - HH (b, c, d, a, x[12], S34); /* 36 */ - HH (a, b, c, d, x[ 2], S31); /* 37 */ - HH (d, a, b, c, x[10], S32); /* 38 */ - HH (c, d, a, b, x[ 6], S33); /* 39 */ - HH (b, c, d, a, x[14], S34); /* 40 */ - HH (a, b, c, d, x[ 1], S31); /* 41 */ - HH (d, a, b, c, x[ 9], S32); /* 42 */ - HH (c, d, a, b, x[ 5], S33); /* 43 */ - HH (b, c, d, a, x[13], S34); /* 44 */ - HH (a, b, c, d, x[ 3], S31); /* 45 */ - HH (d, a, b, c, x[11], S32); /* 46 */ - HH (c, d, a, b, x[ 7], S33); /* 47 */ - HH (b, c, d, a, x[15], S34); /* 48 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. */ - memset(x, 0, sizeof (x)); -} - -/* - * Encodes input (UINT4) into output (unsigned char). Assumes len is - * a multiple of 4. - */ -static void -Encode(unsigned char *output, UINT4 *input, unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); - } -} - -/* - * Decodes input (unsigned char) into output (UINT4). Assumes len is - * a multiple of 4. - */ -static void -Decode(UINT4 *output, const unsigned char *input, unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | - (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); -} - -#endif /* HAVE_MD4_H */ diff --git a/common/lib/libc/md/md5c.c b/common/lib/libc/md/md5c.c deleted file mode 100644 index a3703cd73..000000000 --- a/common/lib/libc/md/md5c.c +++ /dev/null @@ -1,357 +0,0 @@ -/* $NetBSD: md5c.c,v 1.5 2012/03/20 16:21:41 matt Exp $ */ - -/* - * This file is derived from the RSA Data Security, Inc. MD5 Message-Digest - * Algorithm and has been modified by Jason R. Thorpe - * for portability and formatting. - */ - -/* - * Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All - * rights reserved. - * - * License to copy and use this software is granted provided that it - * is identified as the "RSA Data Security, Inc. MD5 Message-Digest - * Algorithm" in all material mentioning or referencing this software - * or this function. - * - * License is also granted to make and use derivative works provided - * that such works are identified as "derived from the RSA Data - * Security, Inc. MD5 Message-Digest Algorithm" in all material - * mentioning or referencing the derived work. - * - * RSA Data Security, Inc. makes no representations concerning either - * the merchantability of this software or the suitability of this - * software for any particular purpose. It is provided "as is" - * without express or implied warranty of any kind. - * - * These notices must be retained in any copies of any part of this - * documentation and/or software. - */ - -#if defined(_KERNEL) || defined(_STANDALONE) -#include -#include -#include -#else -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: md5c.c,v 1.5 2012/03/20 16:21:41 matt Exp $"); -#endif /* LIBC_SCCS and not lint */ -#include "namespace.h" -#include -#include -#include -#include -#endif /* _KERNEL || _STANDALONE */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#if !HAVE_MD5_H - -#define ZEROIZE(d, l) memset((d), 0, (l)) - -typedef unsigned char *POINTER; -typedef uint16_t UINT2; -typedef uint32_t UINT4; - -/* - * Constants for MD5Transform routine. - */ -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - -#if !defined(_KERNEL) && !defined(_STANDALONE) && defined(__weak_alias) -__weak_alias(MD5Init,_MD5Init) -__weak_alias(MD5Update,_MD5Update) -__weak_alias(MD5Final,_MD5Final) -__weak_alias(MD5Transform,_MD5Transform) -#endif - -static void MD5Transform(UINT4 [4], const unsigned char [64]); - -static void Encode(unsigned char *, UINT4 *, unsigned int); -static void Decode(UINT4 *, const unsigned char *, unsigned int); - -/* - * Encodes input (UINT4) into output (unsigned char). Assumes len is - * a multiple of 4. - */ -static void -Encode (unsigned char *output, - UINT4 *input, - unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) { - output[j] = (unsigned char)(input[i] & 0xff); - output[j+1] = (unsigned char)((input[i] >> 8) & 0xff); - output[j+2] = (unsigned char)((input[i] >> 16) & 0xff); - output[j+3] = (unsigned char)((input[i] >> 24) & 0xff); - } -} - -/* - * Decodes input (unsigned char) into output (UINT4). Assumes len is - * a multiple of 4. - */ -static void -Decode (UINT4 *output, - const unsigned char *input, - unsigned int len) -{ - unsigned int i, j; - - for (i = 0, j = 0; j < len; i++, j += 4) - output[i] = ((UINT4)input[j]) | (((UINT4)input[j+1]) << 8) | - (((UINT4)input[j+2]) << 16) | (((UINT4)input[j+3]) << 24); -} - -static const unsigned char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* - * F, G, H and I are basic MD5 functions. - */ -#define F(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define G(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define I(x, y, z) ((y) ^ ((x) | (~z))) - -/* - * ROTATE_LEFT rotates x left n bits. - */ -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32-(n)))) - -/* - * FF, GG, HH, and II transformations for rounds 1, 2, 3, and 4. - * Rotation is separate from addition to prevent recomputation. - */ -#define FF(a, b, c, d, x, s, ac) { \ - (a) += F ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ -} - -#define GG(a, b, c, d, x, s, ac) { \ - (a) += G ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ -} - -#define HH(a, b, c, d, x, s, ac) { \ - (a) += H ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ -} - -#define II(a, b, c, d, x, s, ac) { \ - (a) += I ((b), (c), (d)) + (x) + (UINT4)(ac); \ - (a) = ROTATE_LEFT ((a), (s)); \ - (a) += (b); \ -} - -/* - * MD5 initialization. Begins an MD5 operation, writing a new context. - */ -void -MD5Init(MD5_CTX *context) -{ - - _DIAGASSERT(context != 0); - - context->count[0] = context->count[1] = 0; - - /* Load magic initialization constants. */ - context->state[0] = 0x67452301; - context->state[1] = 0xefcdab89; - context->state[2] = 0x98badcfe; - context->state[3] = 0x10325476; -} - -/* - * MD5 block update operation. Continues an MD5 message-digest - * operation, processing another message block, and updating the - * context. - */ -void -MD5Update(MD5_CTX *context, - const unsigned char *input, /* input block */ - unsigned int inputLen) /* length of input block */ -{ - unsigned int i, idx, partLen; - - _DIAGASSERT(context != 0); - _DIAGASSERT(input != 0); - - /* Compute number of bytes mod 64 */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3F); - - /* Update number of bits */ - if ((context->count[0] += ((UINT4)inputLen << 3)) - < ((UINT4)inputLen << 3)) - context->count[1]++; - context->count[1] += ((UINT4)inputLen >> 29); - - partLen = 64 - idx; - - /* Transform as many times as possible. */ - if (inputLen >= partLen) { - memcpy((POINTER)&context->buffer[idx], input, partLen); - MD5Transform(context->state, context->buffer); - - for (i = partLen; i + 63 < inputLen; i += 64) - MD5Transform(context->state, &input[i]); - - idx = 0; - } else - i = 0; - - /* Buffer remaining input */ - memcpy(&context->buffer[idx], &input[i], inputLen - i); -} - -/* - * MD5 finalization. Ends an MD5 message-digest operation, writing the - * message digest and zeroing the context. - */ -void -MD5Final(unsigned char digest[16], /* message digest */ - MD5_CTX *context) /* context */ -{ - unsigned char bits[8]; - unsigned int idx, padLen; - - _DIAGASSERT(digest != 0); - _DIAGASSERT(context != 0); - - /* Save number of bits */ - Encode(bits, context->count, 8); - - /* Pad out to 56 mod 64. */ - idx = (unsigned int)((context->count[0] >> 3) & 0x3f); - padLen = (idx < 56) ? (56 - idx) : (120 - idx); - MD5Update (context, PADDING, padLen); - - /* Append length (before padding) */ - MD5Update(context, bits, 8); - - /* Store state in digest */ - Encode(digest, context->state, 16); - - /* Zeroize sensitive information. */ - ZEROIZE((POINTER)(void *)context, sizeof(*context)); -} - -/* - * MD5 basic transformation. Transforms state based on block. - */ -static void -MD5Transform(UINT4 state[4], const unsigned char block[64]) -{ - UINT4 a = state[0], b = state[1], c = state[2], d = state[3], x[16]; - - Decode(x, block, 64); - - /* Round 1 */ - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); /* 1 */ - FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); /* 2 */ - FF (c, d, a, b, x[ 2], S13, 0x242070db); /* 3 */ - FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); /* 4 */ - FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); /* 5 */ - FF (d, a, b, c, x[ 5], S12, 0x4787c62a); /* 6 */ - FF (c, d, a, b, x[ 6], S13, 0xa8304613); /* 7 */ - FF (b, c, d, a, x[ 7], S14, 0xfd469501); /* 8 */ - FF (a, b, c, d, x[ 8], S11, 0x698098d8); /* 9 */ - FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); /* 10 */ - FF (c, d, a, b, x[10], S13, 0xffff5bb1); /* 11 */ - FF (b, c, d, a, x[11], S14, 0x895cd7be); /* 12 */ - FF (a, b, c, d, x[12], S11, 0x6b901122); /* 13 */ - FF (d, a, b, c, x[13], S12, 0xfd987193); /* 14 */ - FF (c, d, a, b, x[14], S13, 0xa679438e); /* 15 */ - FF (b, c, d, a, x[15], S14, 0x49b40821); /* 16 */ - - /* Round 2 */ - GG (a, b, c, d, x[ 1], S21, 0xf61e2562); /* 17 */ - GG (d, a, b, c, x[ 6], S22, 0xc040b340); /* 18 */ - GG (c, d, a, b, x[11], S23, 0x265e5a51); /* 19 */ - GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); /* 20 */ - GG (a, b, c, d, x[ 5], S21, 0xd62f105d); /* 21 */ - GG (d, a, b, c, x[10], S22, 0x2441453); /* 22 */ - GG (c, d, a, b, x[15], S23, 0xd8a1e681); /* 23 */ - GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); /* 24 */ - GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); /* 25 */ - GG (d, a, b, c, x[14], S22, 0xc33707d6); /* 26 */ - GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); /* 27 */ - GG (b, c, d, a, x[ 8], S24, 0x455a14ed); /* 28 */ - GG (a, b, c, d, x[13], S21, 0xa9e3e905); /* 29 */ - GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); /* 30 */ - GG (c, d, a, b, x[ 7], S23, 0x676f02d9); /* 31 */ - GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); /* 32 */ - - /* Round 3 */ - HH (a, b, c, d, x[ 5], S31, 0xfffa3942); /* 33 */ - HH (d, a, b, c, x[ 8], S32, 0x8771f681); /* 34 */ - HH (c, d, a, b, x[11], S33, 0x6d9d6122); /* 35 */ - HH (b, c, d, a, x[14], S34, 0xfde5380c); /* 36 */ - HH (a, b, c, d, x[ 1], S31, 0xa4beea44); /* 37 */ - HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); /* 38 */ - HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); /* 39 */ - HH (b, c, d, a, x[10], S34, 0xbebfbc70); /* 40 */ - HH (a, b, c, d, x[13], S31, 0x289b7ec6); /* 41 */ - HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); /* 42 */ - HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); /* 43 */ - HH (b, c, d, a, x[ 6], S34, 0x4881d05); /* 44 */ - HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); /* 45 */ - HH (d, a, b, c, x[12], S32, 0xe6db99e5); /* 46 */ - HH (c, d, a, b, x[15], S33, 0x1fa27cf8); /* 47 */ - HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); /* 48 */ - - /* Round 4 */ - II (a, b, c, d, x[ 0], S41, 0xf4292244); /* 49 */ - II (d, a, b, c, x[ 7], S42, 0x432aff97); /* 50 */ - II (c, d, a, b, x[14], S43, 0xab9423a7); /* 51 */ - II (b, c, d, a, x[ 5], S44, 0xfc93a039); /* 52 */ - II (a, b, c, d, x[12], S41, 0x655b59c3); /* 53 */ - II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); /* 54 */ - II (c, d, a, b, x[10], S43, 0xffeff47d); /* 55 */ - II (b, c, d, a, x[ 1], S44, 0x85845dd1); /* 56 */ - II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); /* 57 */ - II (d, a, b, c, x[15], S42, 0xfe2ce6e0); /* 58 */ - II (c, d, a, b, x[ 6], S43, 0xa3014314); /* 59 */ - II (b, c, d, a, x[13], S44, 0x4e0811a1); /* 60 */ - II (a, b, c, d, x[ 4], S41, 0xf7537e82); /* 61 */ - II (d, a, b, c, x[11], S42, 0xbd3af235); /* 62 */ - II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); /* 63 */ - II (b, c, d, a, x[ 9], S44, 0xeb86d391); /* 64 */ - - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - - /* Zeroize sensitive information. */ - ZEROIZE((POINTER)(void *)x, sizeof (x)); -} - -#endif /* HAVE_MD5_H */ diff --git a/common/lib/libc/net/htonl.c b/common/lib/libc/net/htonl.c deleted file mode 100644 index 8fc35967e..000000000 --- a/common/lib/libc/net/htonl.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $NetBSD: htonl.c,v 1.3 2012/03/21 20:02:56 he Exp $ */ - -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: htonl.c,v 1.3 2012/03/21 20:02:56 he Exp $"); -#endif - -#include - -#undef htonl - -uint32_t -htonl(uint32_t x) -{ -#if BYTE_ORDER == LITTLE_ENDIAN - u_char *s = (void *)&x; - return (uint32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); -#else - return x; -#endif -} diff --git a/common/lib/libc/net/htons.c b/common/lib/libc/net/htons.c deleted file mode 100644 index 9ac41eee9..000000000 --- a/common/lib/libc/net/htons.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $NetBSD: htons.c,v 1.3 2012/03/21 20:02:56 he Exp $ */ - -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: htons.c,v 1.3 2012/03/21 20:02:56 he Exp $"); -#endif - -#include - -#undef htons - -uint16_t -htons(uint16_t x) -{ -#if BYTE_ORDER == LITTLE_ENDIAN - u_char *s = (void *) &x; - return (uint16_t)(s[0] << 8 | s[1]); -#else - return x; -#endif -} diff --git a/common/lib/libc/net/ntohl.c b/common/lib/libc/net/ntohl.c deleted file mode 100644 index cbd2b770e..000000000 --- a/common/lib/libc/net/ntohl.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $NetBSD: ntohl.c,v 1.3 2012/03/21 20:02:56 he Exp $ */ - -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: ntohl.c,v 1.3 2012/03/21 20:02:56 he Exp $"); -#endif - -#include - -#undef ntohl - -uint32_t -ntohl(uint32_t x) -{ -#if BYTE_ORDER == LITTLE_ENDIAN - u_char *s = (void *)&x; - return (uint32_t)(s[0] << 24 | s[1] << 16 | s[2] << 8 | s[3]); -#else - return x; -#endif -} diff --git a/common/lib/libc/net/ntohs.c b/common/lib/libc/net/ntohs.c deleted file mode 100644 index bea167f54..000000000 --- a/common/lib/libc/net/ntohs.c +++ /dev/null @@ -1,26 +0,0 @@ -/* $NetBSD: ntohs.c,v 1.3 2012/03/21 20:02:56 he Exp $ */ - -/* - * Written by J.T. Conklin . - * Public domain. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: ntohs.c,v 1.3 2012/03/21 20:02:56 he Exp $"); -#endif - -#include - -#undef ntohs - -uint16_t -ntohs(uint16_t x) -{ -#if BYTE_ORDER == LITTLE_ENDIAN - u_char *s = (void *) &x; - return (uint16_t)(s[0] << 8 | s[1]); -#else - return x; -#endif -} diff --git a/common/lib/libc/quad/adddi3.c b/common/lib/libc/quad/adddi3.c deleted file mode 100644 index 81eaede17..000000000 --- a/common/lib/libc/quad/adddi3.c +++ /dev/null @@ -1,62 +0,0 @@ -/* $NetBSD: adddi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)adddi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: adddi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Add two quads. This is trivial since a one-bit carry from a single - * u_int addition x+y occurs if and only if the sum x+y is less than - * either x or y (the choice to compare with x or y is arbitrary). - */ -quad_t -__adddi3(quad_t a, quad_t b) -{ - union uu aa, bb, sum; - - aa.q = a; - bb.q = b; - sum.ul[L] = aa.ul[L] + bb.ul[L]; - sum.ul[H] = aa.ul[H] + bb.ul[H] + (sum.ul[L] < bb.ul[L]); - return (sum.q); -} diff --git a/common/lib/libc/quad/anddi3.c b/common/lib/libc/quad/anddi3.c deleted file mode 100644 index 4a5605afb..000000000 --- a/common/lib/libc/quad/anddi3.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: anddi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)anddi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: anddi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return a & b, in quad. - */ -quad_t -__anddi3(quad_t a, quad_t b) -{ - union uu aa, bb; - - aa.q = a; - bb.q = b; - aa.ul[0] &= bb.ul[0]; - aa.ul[1] &= bb.ul[1]; - return (aa.q); -} diff --git a/common/lib/libc/quad/ashldi3.c b/common/lib/libc/quad/ashldi3.c deleted file mode 100644 index fab582ca6..000000000 --- a/common/lib/libc/quad/ashldi3.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: ashldi3.c,v 1.3 2012/03/09 15:41:16 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)ashldi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: ashldi3.c,v 1.3 2012/03/09 15:41:16 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Shift a (signed) quad value left (arithmetic shift left). - * This is the same as logical shift left! - */ -quad_t -__ashldi3(quad_t a, qshift_t shift) -{ - union uu aa; - - if (shift == 0) - return(a); - aa.q = a; - if (shift >= INT_BITS) { - aa.ul[H] = aa.ul[L] << (unsigned int)(shift - INT_BITS); - aa.ul[L] = 0; - } else { - aa.ul[H] = (aa.ul[H] << shift) | - (aa.ul[L] >> (INT_BITS - shift)); - aa.ul[L] <<= shift; - } - return (aa.q); -} diff --git a/common/lib/libc/quad/ashrdi3.c b/common/lib/libc/quad/ashrdi3.c deleted file mode 100644 index ee1c1c4c0..000000000 --- a/common/lib/libc/quad/ashrdi3.c +++ /dev/null @@ -1,82 +0,0 @@ -/* $NetBSD: ashrdi3.c,v 1.4 2012/08/06 02:31:54 matt Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)ashrdi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: ashrdi3.c,v 1.4 2012/08/06 02:31:54 matt Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -ARM_EABI_ALIAS(__aeabi_lasr, __ashrdi3) /* no semicolon */ - -/* - * Shift a (signed) quad value right (arithmetic shift right). - */ -quad_t -__ashrdi3(quad_t a, qshift_t shift) -{ - union uu aa; - - if (shift == 0) - return(a); - aa.q = a; - if (shift >= INT_BITS) { - int s; - - /* - * Smear bits rightward using the machine's right-shift - * method, whether that is sign extension or zero fill, - * to get the `sign word' s. Note that shifting by - * INT_BITS is undefined, so we shift (INT_BITS-1), - * then 1 more, to get our answer. - */ - /* LINTED inherits machine dependency */ - s = (aa.sl[H] >> (INT_BITS - 1)) >> 1; - /* LINTED inherits machine dependency*/ - aa.ul[L] = aa.sl[H] >> (shift - INT_BITS); - aa.ul[H] = s; - } else { - aa.ul[L] = (aa.ul[L] >> shift) | - (aa.ul[H] << (unsigned int)(INT_BITS - shift)); - /* LINTED inherits machine dependency */ - aa.sl[H] >>= shift; - } - return (aa.q); -} diff --git a/common/lib/libc/quad/cmpdi2.c b/common/lib/libc/quad/cmpdi2.c deleted file mode 100644 index e1b3c4268..000000000 --- a/common/lib/libc/quad/cmpdi2.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: cmpdi2.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)cmpdi2.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: cmpdi2.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return 0, 1, or 2 as a <, =, > b respectively. - * Both a and b are considered signed---which means only the high word is - * signed. - */ -int -__cmpdi2(quad_t a, quad_t b) -{ - union uu aa, bb; - - aa.q = a; - bb.q = b; - return (aa.sl[H] < bb.sl[H] ? 0 : aa.sl[H] > bb.sl[H] ? 2 : - aa.ul[L] < bb.ul[L] ? 0 : aa.ul[L] > bb.ul[L] ? 2 : 1); -} diff --git a/common/lib/libc/quad/divdi3.c b/common/lib/libc/quad/divdi3.c deleted file mode 100644 index b241ed1d4..000000000 --- a/common/lib/libc/quad/divdi3.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $NetBSD: divdi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)divdi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: divdi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Divide two signed quads. - * ??? if -1/2 should produce -1 on this machine, this code is wrong - */ -quad_t -__divdi3(quad_t a, quad_t b) -{ - u_quad_t ua, ub, uq; - int neg = 0; - - ua = a; - ub = b; - - if (a < 0) - ua = -ua, neg ^= 1; - if (b < 0) - ub = -ub, neg ^= 1; - - uq = __qdivrem(ua, ub, (u_quad_t *)0); - if (neg) - uq = - uq; - return uq; -} diff --git a/common/lib/libc/quad/iordi3.c b/common/lib/libc/quad/iordi3.c deleted file mode 100644 index 300bdca21..000000000 --- a/common/lib/libc/quad/iordi3.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: iordi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)iordi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: iordi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return a | b, in quad. - */ -quad_t -__iordi3(quad_t a, quad_t b) -{ - union uu aa, bb; - - aa.q = a; - bb.q = b; - aa.ul[0] |= bb.ul[0]; - aa.ul[1] |= bb.ul[1]; - return (aa.q); -} diff --git a/common/lib/libc/quad/lshldi3.c b/common/lib/libc/quad/lshldi3.c deleted file mode 100644 index 9263c4a77..000000000 --- a/common/lib/libc/quad/lshldi3.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: lshldi3.c,v 1.4 2012/12/07 15:41:02 christos Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)lshldi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: lshldi3.c,v 1.4 2012/12/07 15:41:02 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -ARM_EABI_ALIAS(__aeabi_llsl, __lshldi3) /* no semicolon */ - -/* - * Shift an (unsigned) quad value left (logical shift left). - * This is the same as arithmetic shift left! - */ -quad_t -__lshldi3(quad_t a, qshift_t shift) -{ - union uu aa; - - if (shift == 0) - return(a); - aa.q = a; - if (shift >= INT_BITS) { - aa.ul[H] = aa.ul[L] << (unsigned int)(shift - INT_BITS); - aa.ul[L] = 0; - } else { - aa.ul[H] = (aa.ul[H] << shift) | - (aa.ul[L] >> (INT_BITS - shift)); - aa.ul[L] <<= shift; - } - return (aa.q); -} diff --git a/common/lib/libc/quad/lshrdi3.c b/common/lib/libc/quad/lshrdi3.c deleted file mode 100644 index c40932cb0..000000000 --- a/common/lib/libc/quad/lshrdi3.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $NetBSD: lshrdi3.c,v 1.4 2012/08/06 02:31:54 matt Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)lshrdi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: lshrdi3.c,v 1.4 2012/08/06 02:31:54 matt Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -ARM_EABI_ALIAS(__aeabi_llsr, __lshrdi3) /* no semicolon */ - -/* - * Shift an (unsigned) quad value right (logical shift right). - */ -quad_t -__lshrdi3(quad_t a, qshift_t shift) -{ - union uu aa; - - if (shift == 0) - return(a); - aa.q = a; - if (shift >= INT_BITS) { - aa.ul[L] = aa.ul[H] >> (shift - INT_BITS); - aa.ul[H] = 0; - } else { - aa.ul[L] = (aa.ul[L] >> shift) | - (aa.ul[H] << (unsigned int)(INT_BITS - shift)); - aa.ul[H] >>= shift; - } - return (aa.q); -} diff --git a/common/lib/libc/quad/moddi3.c b/common/lib/libc/quad/moddi3.c deleted file mode 100644 index 74333b90e..000000000 --- a/common/lib/libc/quad/moddi3.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $NetBSD: moddi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)moddi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: moddi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return remainder after dividing two signed quads. - * - * XXX we assume a % b < 0 iff a < 0, but this is actually machine-dependent. - */ -quad_t -__moddi3(quad_t a, quad_t b) -{ - u_quad_t ua, ub, ur; - int neg = 0; - - ua = a; - ub = b; - - if (a < 0) - ua = -ua, neg ^= 1; - if (b < 0) - ub = -ub; - (void)__qdivrem(ua, ub, &ur); - if (neg) - ur = -ur; - return (ur); -} diff --git a/common/lib/libc/quad/muldi3.c b/common/lib/libc/quad/muldi3.c deleted file mode 100644 index f557c9354..000000000 --- a/common/lib/libc/quad/muldi3.c +++ /dev/null @@ -1,250 +0,0 @@ -/* $NetBSD: muldi3.c,v 1.3 2012/08/06 02:31:54 matt Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)muldi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: muldi3.c,v 1.3 2012/08/06 02:31:54 matt Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -ARM_EABI_ALIAS(__aeabi_lmul, __muldi3) /* no semicolon */ - -/* - * Multiply two quads. - * - * Our algorithm is based on the following. Split incoming quad values - * u and v (where u,v >= 0) into - * - * u = 2^n u1 * u0 (n = number of bits in `u_int', usu. 32) - * - * and - * - * v = 2^n v1 * v0 - * - * Then - * - * uv = 2^2n u1 v1 + 2^n u1 v0 + 2^n v1 u0 + u0 v0 - * = 2^2n u1 v1 + 2^n (u1 v0 + v1 u0) + u0 v0 - * - * Now add 2^n u1 v1 to the first term and subtract it from the middle, - * and add 2^n u0 v0 to the last term and subtract it from the middle. - * This gives: - * - * uv = (2^2n + 2^n) (u1 v1) + - * (2^n) (u1 v0 - u1 v1 + u0 v1 - u0 v0) + - * (2^n + 1) (u0 v0) - * - * Factoring the middle a bit gives us: - * - * uv = (2^2n + 2^n) (u1 v1) + [u1v1 = high] - * (2^n) (u1 - u0) (v0 - v1) + [(u1-u0)... = mid] - * (2^n + 1) (u0 v0) [u0v0 = low] - * - * The terms (u1 v1), (u1 - u0) (v0 - v1), and (u0 v0) can all be done - * in just half the precision of the original. (Note that either or both - * of (u1 - u0) or (v0 - v1) may be negative.) - * - * This algorithm is from Knuth vol. 2 (2nd ed), section 4.3.3, p. 278. - * - * Since C does not give us a `int * int = quad' operator, we split - * our input quads into two ints, then split the two ints into two - * shorts. We can then calculate `short * short = int' in native - * arithmetic. - * - * Our product should, strictly speaking, be a `long quad', with 128 - * bits, but we are going to discard the upper 64. In other words, - * we are not interested in uv, but rather in (uv mod 2^2n). This - * makes some of the terms above vanish, and we get: - * - * (2^n)(high) + (2^n)(mid) + (2^n + 1)(low) - * - * or - * - * (2^n)(high + mid + low) + low - * - * Furthermore, `high' and `mid' can be computed mod 2^n, as any factor - * of 2^n in either one will also vanish. Only `low' need be computed - * mod 2^2n, and only because of the final term above. - */ -static quad_t __lmulq(u_int, u_int); - -quad_t -__muldi3(quad_t a, quad_t b) -{ - union uu u, v, low, prod; - u_int high, mid, udiff, vdiff; - int negall, negmid; -#define u1 u.ul[H] -#define u0 u.ul[L] -#define v1 v.ul[H] -#define v0 v.ul[L] - - /* - * Get u and v such that u, v >= 0. When this is finished, - * u1, u0, v1, and v0 will be directly accessible through the - * int fields. - */ - if (a >= 0) - u.q = a, negall = 0; - else - u.q = -a, negall = 1; - if (b >= 0) - v.q = b; - else - v.q = -b, negall ^= 1; - - if (u1 == 0 && v1 == 0) { - /* - * An (I hope) important optimization occurs when u1 and v1 - * are both 0. This should be common since most numbers - * are small. Here the product is just u0*v0. - */ - prod.q = __lmulq(u0, v0); - } else { - /* - * Compute the three intermediate products, remembering - * whether the middle term is negative. We can discard - * any upper bits in high and mid, so we can use native - * u_int * u_int => u_int arithmetic. - */ - low.q = __lmulq(u0, v0); - - if (u1 >= u0) - negmid = 0, udiff = u1 - u0; - else - negmid = 1, udiff = u0 - u1; - if (v0 >= v1) - vdiff = v0 - v1; - else - vdiff = v1 - v0, negmid ^= 1; - mid = udiff * vdiff; - - high = u1 * v1; - - /* - * Assemble the final product. - */ - prod.ul[H] = high + (negmid ? -mid : mid) + low.ul[L] + - low.ul[H]; - prod.ul[L] = low.ul[L]; - } - return (negall ? -prod.q : prod.q); -#undef u1 -#undef u0 -#undef v1 -#undef v0 -} - -/* - * Multiply two 2N-bit ints to produce a 4N-bit quad, where N is half - * the number of bits in an int (whatever that is---the code below - * does not care as long as quad.h does its part of the bargain---but - * typically N==16). - * - * We use the same algorithm from Knuth, but this time the modulo refinement - * does not apply. On the other hand, since N is half the size of an int, - * we can get away with native multiplication---none of our input terms - * exceeds (UINT_MAX >> 1). - * - * Note that, for u_int l, the quad-precision result - * - * l << N - * - * splits into high and low ints as HHALF(l) and LHUP(l) respectively. - */ -static quad_t -__lmulq(u_int u, u_int v) -{ - u_int u1, u0, v1, v0, udiff, vdiff, high, mid, low; - u_int prodh, prodl, was; - union uu prod; - int neg; - - u1 = HHALF(u); - u0 = LHALF(u); - v1 = HHALF(v); - v0 = LHALF(v); - - low = u0 * v0; - - /* This is the same small-number optimization as before. */ - if (u1 == 0 && v1 == 0) - return (low); - - if (u1 >= u0) - udiff = u1 - u0, neg = 0; - else - udiff = u0 - u1, neg = 1; - if (v0 >= v1) - vdiff = v0 - v1; - else - vdiff = v1 - v0, neg ^= 1; - mid = udiff * vdiff; - - high = u1 * v1; - - /* prod = (high << 2N) + (high << N); */ - prodh = high + HHALF(high); - prodl = LHUP(high); - - /* if (neg) prod -= mid << N; else prod += mid << N; */ - if (neg) { - was = prodl; - prodl -= LHUP(mid); - prodh -= HHALF(mid) + (prodl > was); - } else { - was = prodl; - prodl += LHUP(mid); - prodh += HHALF(mid) + (prodl < was); - } - - /* prod += low << N */ - was = prodl; - prodl += LHUP(low); - prodh += HHALF(low) + (prodl < was); - /* ... + low; */ - if ((prodl += low) < low) - prodh++; - - /* return 4N-bit product */ - prod.ul[H] = prodh; - prod.ul[L] = prodl; - return (prod.q); -} diff --git a/common/lib/libc/quad/negdi2.c b/common/lib/libc/quad/negdi2.c deleted file mode 100644 index 000889a9f..000000000 --- a/common/lib/libc/quad/negdi2.c +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: negdi2.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)negdi2.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: negdi2.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return -a (or, equivalently, 0 - a), in quad. See subdi3.c. - */ -quad_t -__negdi2(quad_t a) -{ - union uu aa, res; - - aa.q = a; - res.ul[L] = -aa.ul[L]; - res.ul[H] = -aa.ul[H] - (res.ul[L] > 0); - return (res.q); -} diff --git a/common/lib/libc/quad/notdi2.c b/common/lib/libc/quad/notdi2.c deleted file mode 100644 index 1706b6d46..000000000 --- a/common/lib/libc/quad/notdi2.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: notdi2.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)notdi2.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: notdi2.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return ~a. For some reason gcc calls this `one's complement' rather - * than `not'. - */ -quad_t -__one_cmpldi2(quad_t a) -{ - union uu aa; - - aa.q = a; - aa.ul[0] = ~aa.ul[0]; - aa.ul[1] = ~aa.ul[1]; - return (aa.q); -} diff --git a/common/lib/libc/quad/qdivrem.c b/common/lib/libc/quad/qdivrem.c deleted file mode 100644 index 384318d78..000000000 --- a/common/lib/libc/quad/qdivrem.c +++ /dev/null @@ -1,284 +0,0 @@ -/* $NetBSD: qdivrem.c,v 1.4 2012/03/20 16:21:41 matt Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)qdivrem.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: qdivrem.c,v 1.4 2012/03/20 16:21:41 matt Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -/* - * Multiprecision divide. This algorithm is from Knuth vol. 2 (2nd ed), - * section 4.3.1, pp. 257--259. - */ - -#include "quad.h" - -#define B ((int)1 << (unsigned int)HALF_BITS) /* digit base */ - -/* Combine two `digits' to make a single two-digit number. */ -#define COMBINE(a, b) (((u_int)(a) << (unsigned int)HALF_BITS) | (b)) - -/* select a type for digits in base B: use unsigned short if they fit */ -#if UINT_MAX == 0xffffffffU && USHRT_MAX >= 0xffff -typedef unsigned short digit; -#else -typedef u_int digit; -#endif - -static void shl(digit *p, int len, int sh); - -/* - * __qdivrem(u, v, rem) returns u/v and, optionally, sets *rem to u%v. - * - * We do this in base 2-sup-HALF_BITS, so that all intermediate products - * fit within u_int. As a consequence, the maximum length dividend and - * divisor are 4 `digits' in this base (they are shorter if they have - * leading zeros). - */ -u_quad_t -__qdivrem(u_quad_t uq, u_quad_t vq, u_quad_t *arq) -{ - union uu tmp; - digit *u, *v, *q; - digit v1, v2; - u_int qhat, rhat, t; - int m, n, d, j, i; - digit uspace[5], vspace[5], qspace[5]; - - /* - * Take care of special cases: divide by zero, and u < v. - */ - if (vq == 0) { - /* divide by zero. */ - static volatile const unsigned int zero = 0; - - tmp.ul[H] = tmp.ul[L] = 1 / zero; - if (arq) - *arq = uq; - return (tmp.q); - } - if (uq < vq) { - if (arq) - *arq = uq; - return (0); - } - u = &uspace[0]; - v = &vspace[0]; - q = &qspace[0]; - - /* - * Break dividend and divisor into digits in base B, then - * count leading zeros to determine m and n. When done, we - * will have: - * u = (u[1]u[2]...u[m+n]) sub B - * v = (v[1]v[2]...v[n]) sub B - * v[1] != 0 - * 1 < n <= 4 (if n = 1, we use a different division algorithm) - * m >= 0 (otherwise u < v, which we already checked) - * m + n = 4 - * and thus - * m = 4 - n <= 2 - */ - tmp.uq = uq; - u[0] = 0; - u[1] = (digit)HHALF(tmp.ul[H]); - u[2] = (digit)LHALF(tmp.ul[H]); - u[3] = (digit)HHALF(tmp.ul[L]); - u[4] = (digit)LHALF(tmp.ul[L]); - tmp.uq = vq; - v[1] = (digit)HHALF(tmp.ul[H]); - v[2] = (digit)LHALF(tmp.ul[H]); - v[3] = (digit)HHALF(tmp.ul[L]); - v[4] = (digit)LHALF(tmp.ul[L]); - for (n = 4; v[1] == 0; v++) { - if (--n == 1) { - u_int rbj; /* r*B+u[j] (not root boy jim) */ - digit q1, q2, q3, q4; - - /* - * Change of plan, per exercise 16. - * r = 0; - * for j = 1..4: - * q[j] = floor((r*B + u[j]) / v), - * r = (r*B + u[j]) % v; - * We unroll this completely here. - */ - t = v[2]; /* nonzero, by definition */ - q1 = (digit)(u[1] / t); - rbj = COMBINE(u[1] % t, u[2]); - q2 = (digit)(rbj / t); - rbj = COMBINE(rbj % t, u[3]); - q3 = (digit)(rbj / t); - rbj = COMBINE(rbj % t, u[4]); - q4 = (digit)(rbj / t); - if (arq) - *arq = rbj % t; - tmp.ul[H] = COMBINE(q1, q2); - tmp.ul[L] = COMBINE(q3, q4); - return (tmp.q); - } - } - - /* - * By adjusting q once we determine m, we can guarantee that - * there is a complete four-digit quotient at &qspace[1] when - * we finally stop. - */ - for (m = 4 - n; u[1] == 0; u++) - m--; - for (i = 4 - m; --i >= 0;) - q[i] = 0; - q += 4 - m; - - /* - * Here we run Program D, translated from MIX to C and acquiring - * a few minor changes. - * - * D1: choose multiplier 1 << d to ensure v[1] >= B/2. - */ - d = 0; - for (t = v[1]; t < B / 2; t <<= (unsigned int)1) - d++; - if (d > 0) { - shl(&u[0], m + n, d); /* u <<= d */ - shl(&v[1], n - 1, d); /* v <<= d */ - } - /* - * D2: j = 0. - */ - j = 0; - v1 = v[1]; /* for D3 -- note that v[1..n] are constant */ - v2 = v[2]; /* for D3 */ - do { - digit uj0, uj1, uj2; - - /* - * D3: Calculate qhat (\^q, in TeX notation). - * Let qhat = min((u[j]*B + u[j+1])/v[1], B-1), and - * let rhat = (u[j]*B + u[j+1]) mod v[1]. - * While rhat < B and v[2]*qhat > rhat*B+u[j+2], - * decrement qhat and increase rhat correspondingly. - * Note that if rhat >= B, v[2]*qhat < rhat*B. - */ - uj0 = u[j + 0]; /* for D3 only -- note that u[j+...] change */ - uj1 = u[j + 1]; /* for D3 only */ - uj2 = u[j + 2]; /* for D3 only */ - if (uj0 == v1) { - qhat = B; - rhat = uj1; - goto qhat_too_big; - } else { - u_int nn = COMBINE(uj0, uj1); - qhat = nn / v1; - rhat = nn % v1; - } - while (v2 * qhat > COMBINE(rhat, uj2)) { - qhat_too_big: - qhat--; - if ((rhat += v1) >= B) - break; - } - /* - * D4: Multiply and subtract. - * The variable `t' holds any borrows across the loop. - * We split this up so that we do not require v[0] = 0, - * and to eliminate a final special case. - */ - for (t = 0, i = n; i > 0; i--) { - t = u[i + j] - v[i] * qhat - t; - u[i + j] = (digit)LHALF(t); - t = (B - HHALF(t)) & (B - 1); - } - t = u[j] - t; - u[j] = (digit)LHALF(t); - /* - * D5: test remainder. - * There is a borrow if and only if HHALF(t) is nonzero; - * in that (rare) case, qhat was too large (by exactly 1). - * Fix it by adding v[1..n] to u[j..j+n]. - */ - if (HHALF(t)) { - qhat--; - for (t = 0, i = n; i > 0; i--) { /* D6: add back. */ - t += u[i + j] + v[i]; - u[i + j] = (digit)LHALF(t); - t = HHALF(t); - } - u[j] = (digit)LHALF(u[j] + t); - } - q[j] = (digit)qhat; - } while (++j <= m); /* D7: loop on j. */ - - /* - * If caller wants the remainder, we have to calculate it as - * u[m..m+n] >> d (this is at most n digits and thus fits in - * u[m+1..m+n], but we may need more source digits). - */ - if (arq) { - if (d) { - for (i = m + n; i > m; --i) - u[i] = (digit)(((u_int)u[i] >> d) | - LHALF((u_int)u[i - 1] << (unsigned int)(HALF_BITS - d))); - u[i] = 0; - } - tmp.ul[H] = COMBINE(uspace[1], uspace[2]); - tmp.ul[L] = COMBINE(uspace[3], uspace[4]); - *arq = tmp.q; - } - - tmp.ul[H] = COMBINE(qspace[1], qspace[2]); - tmp.ul[L] = COMBINE(qspace[3], qspace[4]); - return (tmp.q); -} - -/* - * Shift p[0]..p[len] left `sh' bits, ignoring any bits that - * `fall out' the left (there never will be any such anyway). - * We may assume len >= 0. NOTE THAT THIS WRITES len+1 DIGITS. - */ -static void -shl(digit *p, int len, int sh) -{ - int i; - - for (i = 0; i < len; i++) - p[i] = (digit)(LHALF((u_int)p[i] << sh) | - ((u_int)p[i + 1] >> (HALF_BITS - sh))); - p[i] = (digit)(LHALF((u_int)p[i] << sh)); -} diff --git a/common/lib/libc/quad/quad.h b/common/lib/libc/quad/quad.h deleted file mode 100644 index cd4ef98e9..000000000 --- a/common/lib/libc/quad/quad.h +++ /dev/null @@ -1,150 +0,0 @@ -/* $NetBSD: quad.h,v 1.7 2012/08/06 02:31:54 matt Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)quad.h 8.1 (Berkeley) 6/4/93 - */ - -/* - * Quad arithmetic. - * - * This library makes the following assumptions: - * - * - The type long long (aka quad_t) exists. - * - * - A quad variable is exactly twice as long as `int'. - * - * - The machine's arithmetic is two's complement. - * - * This library can provide 128-bit arithmetic on a machine with 128-bit - * quads and 64-bit ints, for instance, or 96-bit arithmetic on machines - * with 48-bit ints. - */ - -#include -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -#if defined(__ARM_EABI__) && !defined(lint) -#define ARM_EABI_ALIAS(alias,sym) __strong_alias(alias,sym); -#else -#define ARM_EABI_ALIAS(alias,sym) /* nothing */ -#endif - -/* - * Depending on the desired operation, we view a `long long' (aka quad_t) in - * one or more of the following formats. - */ -union uu { - quad_t q; /* as a (signed) quad */ - u_quad_t uq; /* as an unsigned quad */ - int sl[2]; /* as two signed ints */ - u_int ul[2]; /* as two unsigned ints */ -}; - -/* - * Define high and low parts of a quad_t. - */ -#define H _QUAD_HIGHWORD -#define L _QUAD_LOWWORD - -/* - * Total number of bits in a quad_t and in the pieces that make it up. - * These are used for shifting, and also below for halfword extraction - * and assembly. - */ -#define QUAD_BITS (sizeof(quad_t) * CHAR_BIT) -#define INT_BITS (sizeof(int) * CHAR_BIT) -#define HALF_BITS (sizeof(int) * CHAR_BIT / 2) - -/* - * Extract high and low shortwords from longword, and move low shortword of - * longword to upper half of long, i.e., produce the upper longword of - * ((quad_t)(x) << (number_of_bits_in_int/2)). (`x' must actually be u_int.) - * - * These are used in the multiply code, to split a longword into upper - * and lower halves, and to reassemble a product as a quad_t, shifted left - * (sizeof(int)*CHAR_BIT/2). - */ -#define HHALF(x) ((u_int)(x) >> HALF_BITS) -#define LHALF(x) ((u_int)(x) & (((int)1 << (u_int)HALF_BITS) - 1)) -#define LHUP(x) ((u_int)(x) << (u_int)HALF_BITS) - -/* - * XXX - * Compensate for gcc 1 vs gcc 2. Gcc 1 defines ?sh?di3's second argument - * as u_quad_t, while gcc 2 correctly uses int. Unfortunately, we still use - * both compilers. - */ -#if __GNUC_PREREQ__(2, 0) || defined(lint) -typedef unsigned int qshift_t; -#else -typedef u_quad_t qshift_t; -#endif - -__BEGIN_DECLS -quad_t __adddi3(quad_t, quad_t); -quad_t __anddi3(quad_t, quad_t); -quad_t __ashldi3(quad_t, qshift_t); -quad_t __ashrdi3(quad_t, qshift_t); -int __cmpdi2(quad_t, quad_t); -quad_t __divdi3(quad_t, quad_t); -quad_t __fixtfdi(long double); -quad_t __fixdfdi(double); -quad_t __fixsfdi(float); -u_quad_t __fixunstfdi(long double); -u_quad_t __fixunsdfdi(double); -u_quad_t __fixunssfdi(float); -long double __floatditf(quad_t); -double __floatdidf(quad_t); -float __floatdisf(quad_t); -long double __floatunditf(u_quad_t); -double __floatundidf(u_quad_t); -float __floatundisf(u_quad_t); -quad_t __iordi3(quad_t, quad_t); -quad_t __lshldi3(quad_t, qshift_t); -quad_t __lshrdi3(quad_t, qshift_t); -quad_t __moddi3(quad_t, quad_t); -quad_t __muldi3(quad_t, quad_t); -quad_t __negdi2(quad_t); -quad_t __one_cmpldi2(quad_t); -u_quad_t __qdivrem(u_quad_t, u_quad_t, u_quad_t *); -quad_t __subdi3(quad_t, quad_t); -int __ucmpdi2(u_quad_t, u_quad_t); -u_quad_t __udivdi3(u_quad_t, u_quad_t ); -u_quad_t __umoddi3(u_quad_t, u_quad_t ); -quad_t __xordi3(quad_t, quad_t); -__END_DECLS diff --git a/common/lib/libc/quad/subdi3.c b/common/lib/libc/quad/subdi3.c deleted file mode 100644 index b84ef05f9..000000000 --- a/common/lib/libc/quad/subdi3.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: subdi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)subdi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: subdi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Subtract two quad values. This is trivial since a one-bit carry - * from a single u_int difference x-y occurs if and only if (x-y) > x. - */ -quad_t -__subdi3(quad_t a, quad_t b) -{ - union uu aa, bb, diff; - - aa.q = a; - bb.q = b; - diff.ul[L] = aa.ul[L] - bb.ul[L]; - diff.ul[H] = aa.ul[H] - bb.ul[H] - (diff.ul[L] > aa.ul[L]); - return (diff.q); -} diff --git a/common/lib/libc/quad/ucmpdi2.c b/common/lib/libc/quad/ucmpdi2.c deleted file mode 100644 index 04e713314..000000000 --- a/common/lib/libc/quad/ucmpdi2.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: ucmpdi2.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)ucmpdi2.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: ucmpdi2.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return 0, 1, or 2 as a <, =, > b respectively. - * Neither a nor b are considered signed. - */ -int -__ucmpdi2(u_quad_t a, u_quad_t b) -{ - union uu aa, bb; - - aa.uq = a; - bb.uq = b; - return (aa.ul[H] < bb.ul[H] ? 0 : aa.ul[H] > bb.ul[H] ? 2 : - aa.ul[L] < bb.ul[L] ? 0 : aa.ul[L] > bb.ul[L] ? 2 : 1); -} diff --git a/common/lib/libc/quad/udivdi3.c b/common/lib/libc/quad/udivdi3.c deleted file mode 100644 index 72a95c746..000000000 --- a/common/lib/libc/quad/udivdi3.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: udivdi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)udivdi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: udivdi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Divide two unsigned quads. - */ -u_quad_t -__udivdi3(u_quad_t a, u_quad_t b) -{ - - return (__qdivrem(a, b, (u_quad_t *)0)); -} diff --git a/common/lib/libc/quad/umoddi3.c b/common/lib/libc/quad/umoddi3.c deleted file mode 100644 index 2fef61e5f..000000000 --- a/common/lib/libc/quad/umoddi3.c +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: umoddi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)umoddi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: umoddi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return remainder after dividing two unsigned quads. - */ -u_quad_t -__umoddi3(u_quad_t a, u_quad_t b) -{ - u_quad_t r; - - (void)__qdivrem(a, b, &r); - return (r); -} diff --git a/common/lib/libc/quad/xordi3.c b/common/lib/libc/quad/xordi3.c deleted file mode 100644 index 1a1fa4f27..000000000 --- a/common/lib/libc/quad/xordi3.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: xordi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $ */ - -/*- - * Copyright (c) 1992, 1993 - * The Regents of the University of California. All rights reserved. - * - * This software was developed by the Computer Systems Engineering group - * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and - * contributed to Berkeley. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)xordi3.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: xordi3.c,v 1.2 2009/03/15 22:31:12 cegger Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "quad.h" - -/* - * Return a ^ b, in quad. - */ -quad_t -__xordi3(quad_t a, quad_t b) -{ - union uu aa, bb; - - aa.q = a; - bb.q = b; - aa.ul[0] ^= bb.ul[0]; - aa.ul[1] ^= bb.ul[1]; - return (aa.q); -} diff --git a/common/lib/libc/stdlib/_strtoi.h b/common/lib/libc/stdlib/_strtoi.h deleted file mode 100644 index e6b0ce778..000000000 --- a/common/lib/libc/stdlib/_strtoi.h +++ /dev/null @@ -1,144 +0,0 @@ -/* $NetBSD: _strtoi.h,v 1.2 2015/01/18 17:55:22 christos Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Original version ID: - * NetBSD: src/lib/libc/locale/_wcstoul.h,v 1.2 2003/08/07 16:43:03 agc Exp - * - * Created by Kamil Rytarowski, based on ID: - * NetBSD: src/common/lib/libc/stdlib/_strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp - */ - -/* - * function template for strtoi and strtou - * - * parameters: - * _FUNCNAME : function name - * __TYPE : return and range limits type - * __WRAPPED : wrapped function, strtoimax or strtoumax - */ - -#define __WRAPPED_L_(x) x ## _l -#define __WRAPPED_L__(x) __WRAPPED_L_(x) -#define __WRAPPED_L __WRAPPED_L__(__WRAPPED) - -#if defined(_KERNEL) || defined(_STANDALONE) || \ - defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) -__TYPE -_FUNCNAME(const char * __restrict nptr, char ** __restrict endptr, int base, - __TYPE lo, __TYPE hi, int * rstatus) -#else -#include -#include "setlocale_local.h" -#define INT_FUNCNAME_(pre, name, post) pre ## name ## post -#define INT_FUNCNAME(pre, name, post) INT_FUNCNAME_(pre, name, post) - -static __TYPE -INT_FUNCNAME(_int_, _FUNCNAME, _l)(const char * __restrict nptr, - char ** __restrict endptr, int base, - __TYPE lo, __TYPE hi, int * rstatus, locale_t loc) -#endif -{ -#if !defined(_KERNEL) && !defined(_STANDALONE) - int serrno; -#endif - __TYPE im; - char *ep; - int rep; - - _DIAGASSERT(hi >= lo); - - _DIAGASSERT(nptr != NULL); - /* endptr may be NULL */ - - if (endptr == NULL) - endptr = &ep; - - if (rstatus == NULL) - rstatus = &rep; - -#if !defined(_KERNEL) && !defined(_STANDALONE) - serrno = errno; - errno = 0; -#endif - -#if defined(_KERNEL) || defined(_STANDALONE) || \ - defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) - im = __WRAPPED(nptr, endptr, base); -#else - im = __WRAPPED_L(nptr, endptr, base, loc); -#endif - -#if !defined(_KERNEL) && !defined(_STANDALONE) - *rstatus = errno; - errno = serrno; -#endif - - if (*rstatus == 0) { - /* No digits were found */ - if (nptr == *endptr) - *rstatus = ECANCELED; - /* There are further characters after number */ - else if (**endptr != '\0') - *rstatus = ENOTSUP; - } - - if (im < lo) { - if (*rstatus == 0) - *rstatus = ERANGE; - return lo; - } - if (im > hi) { - if (*rstatus == 0) - *rstatus = ERANGE; - return hi; - } - - return im; -} - -#if !defined(_KERNEL) && !defined(_STANDALONE) && \ - !defined(HAVE_NBTOOL_CONFIG_H) && !defined(BCS_ONLY) -__TYPE -_FUNCNAME(const char * __restrict nptr, char ** __restrict endptr, int base, - __TYPE lo, __TYPE hi, int * rstatus) -{ - return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, lo, hi, - rstatus, _current_locale()); -} - -__TYPE -INT_FUNCNAME(, _FUNCNAME, _l)(const char * __restrict nptr, - char ** __restrict endptr, int base, - __TYPE lo, __TYPE hi, int * rstatus, locale_t loc) -{ - return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, lo, hi, - rstatus, loc); -} -#endif diff --git a/common/lib/libc/stdlib/_strtol.h b/common/lib/libc/stdlib/_strtol.h deleted file mode 100644 index 1901e560d..000000000 --- a/common/lib/libc/stdlib/_strtol.h +++ /dev/null @@ -1,203 +0,0 @@ -/* $NetBSD: _strtol.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Original version ID: - * NetBSD: src/lib/libc/locale/_wcstol.h,v 1.2 2003/08/07 16:43:03 agc Exp - */ - -/* - * function template for strtol, strtoll and strtoimax. - * - * parameters: - * _FUNCNAME : function name - * __INT : return type - * __INT_MIN : lower limit of the return type - * __INT_MAX : upper limit of the return type - */ -#if defined(_KERNEL) || defined(_STANDALONE) || defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) -__INT -_FUNCNAME(const char *nptr, char **endptr, int base) -#else -#include -#include "setlocale_local.h" -#define INT_FUNCNAME_(pre, name, post) pre ## name ## post -#define INT_FUNCNAME(pre, name, post) INT_FUNCNAME_(pre, name, post) - -static __INT -INT_FUNCNAME(_int_, _FUNCNAME, _l)(const char *nptr, char **endptr, - int base, locale_t loc) -#endif -{ - const char *s; - __INT acc, cutoff; - unsigned char c; - int i, neg, any, cutlim; - - _DIAGASSERT(nptr != NULL); - /* endptr may be NULL */ - - /* check base value */ - if (base && (base < 2 || base > 36)) { -#if !defined(_KERNEL) && !defined(_STANDALONE) - errno = EINVAL; - if (endptr != NULL) - /* LINTED interface specification */ - *endptr = __UNCONST(nptr); - return 0; -#else - panic("%s: invalid base %d", __func__, base); -#endif - } - - /* - * Skip white space and pick up leading +/- sign if any. - * If base is 0, allow 0x for hex and 0 for octal, else - * assume decimal; if base is already 16, allow 0x. - */ - s = nptr; -#if defined(_KERNEL) || defined(_STANDALONE) || \ - defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) - do { - c = *s++; - } while (isspace(c)); -#else - do { - c = *s++; - } while (isspace_l(c, loc)); -#endif - if (c == '-') { - neg = 1; - c = *s++; - } else { - neg = 0; - if (c == '+') - c = *s++; - } - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = (c == '0' ? 8 : 10); - - /* - * Compute the cutoff value between legal numbers and illegal - * numbers. That is the largest legal value, divided by the - * base. An input number that is greater than this value, if - * followed by a legal input character, is too big. One that - * is equal to this value may be valid or not; the limit - * between valid and invalid numbers is then based on the last - * digit. For instance, if the range for longs is - * [-2147483648..2147483647] and the input base is 10, - * cutoff will be set to 214748364 and cutlim to either - * 7 (neg==0) or 8 (neg==1), meaning that if we have accumulated - * a value > 214748364, or equal but the next digit is > 7 (or 8), - * the number is too big, and we will return a range error. - * - * Set any if any `digits' consumed; make it negative to indicate - * overflow. - */ - cutoff = (__INT)(neg ? __INT_MIN : __INT_MAX); - cutlim = (int)(cutoff % base); - cutoff /= base; - if (neg) { - if (cutlim > 0) { - cutlim -= base; - cutoff += 1; - } - cutlim = -cutlim; - } - for (acc = 0, any = 0;; c = *s++) { - if (c >= '0' && c <= '9') - i = c - '0'; - else if (c >= 'a' && c <= 'z') - i = (c - 'a') + 10; - else if (c >= 'A' && c <= 'Z') - i = (c - 'A') + 10; - else - break; - if (i >= base) - break; - if (any < 0) - continue; - if (neg) { - if (acc < cutoff || (acc == cutoff && i > cutlim)) { - acc = __INT_MIN; -#if !defined(_KERNEL) && !defined(_STANDALONE) - any = -1; - errno = ERANGE; -#else - any = 0; - break; -#endif - } else { - any = 1; - acc *= base; - acc -= i; - } - } else { - if (acc > cutoff || (acc == cutoff && i > cutlim)) { - acc = __INT_MAX; -#if !defined(_KERNEL) && !defined(_STANDALONE) - any = -1; - errno = ERANGE; -#else - any = 0; - break; -#endif - } else { - any = 1; - acc *= base; - acc += i; - } - } - } - if (endptr != NULL) - /* LINTED interface specification */ - *endptr = __UNCONST(any ? s - 1 : nptr); - return(acc); -} - -#if !defined(_KERNEL) && !defined(_STANDALONE) && \ - !defined(HAVE_NBTOOL_CONFIG_H) && !defined(BCS_ONLY) -__INT -_FUNCNAME(const char *nptr, char **endptr, int base) -{ - return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, _current_locale()); -} - -__INT -INT_FUNCNAME(, _FUNCNAME, _l)(const char *nptr, char **endptr, int base, locale_t loc) -{ - return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, loc); -} -#endif diff --git a/common/lib/libc/stdlib/_strtoul.h b/common/lib/libc/stdlib/_strtoul.h deleted file mode 100644 index 27e2e079d..000000000 --- a/common/lib/libc/stdlib/_strtoul.h +++ /dev/null @@ -1,163 +0,0 @@ -/* $NetBSD: _strtoul.h,v 1.7 2013/05/17 12:55:56 joerg Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Original version ID: - * NetBSD: src/lib/libc/locale/_wcstoul.h,v 1.2 2003/08/07 16:43:03 agc Exp - */ - -/* - * function template for strtoul, strtoull and strtoumax. - * - * parameters: - * _FUNCNAME : function name - * __UINT : return type - * __UINT_MAX : upper limit of the return type - */ -#if defined(_KERNEL) || defined(_STANDALONE) || \ - defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) -__UINT -_FUNCNAME(const char *nptr, char **endptr, int base) -#else -#include -#include "setlocale_local.h" -#define INT_FUNCNAME_(pre, name, post) pre ## name ## post -#define INT_FUNCNAME(pre, name, post) INT_FUNCNAME_(pre, name, post) - -static __UINT -INT_FUNCNAME(_int_, _FUNCNAME, _l)(const char *nptr, char **endptr, - int base, locale_t loc) -#endif -{ - const char *s; - __UINT acc, cutoff; - unsigned char c; - int i, neg, any, cutlim; - - _DIAGASSERT(nptr != NULL); - /* endptr may be NULL */ - - /* check base value */ - if (base && (base < 2 || base > 36)) { -#if !defined(_KERNEL) && !defined(_STANDALONE) - errno = EINVAL; - return(0); -#else - panic("%s: invalid base %d", __func__, base); -#endif - } - - /* - * Skip white space and pick up leading +/- sign if any. - * If base is 0, allow 0x for hex and 0 for octal, else - * assume decimal; if base is already 16, allow 0x. - */ - s = nptr; -#if defined(_KERNEL) || defined(_STANDALONE) || \ - defined(HAVE_NBTOOL_CONFIG_H) || defined(BCS_ONLY) - do { - c = *s++; - } while (isspace(c)); -#else - do { - c = *s++; - } while (isspace_l(c, loc)); -#endif - if (c == '-') { - neg = 1; - c = *s++; - } else { - neg = 0; - if (c == '+') - c = *s++; - } - if ((base == 0 || base == 16) && - c == '0' && (*s == 'x' || *s == 'X')) { - c = s[1]; - s += 2; - base = 16; - } - if (base == 0) - base = (c == '0' ? 8 : 10); - - /* - * See strtol for comments as to the logic used. - */ - cutoff = ((__UINT)__UINT_MAX / (__UINT)base); - cutlim = (int)((__UINT)__UINT_MAX % (__UINT)base); - for (acc = 0, any = 0;; c = *s++) { - if (c >= '0' && c <= '9') - i = c - '0'; - else if (c >= 'a' && c <= 'z') - i = (c - 'a') + 10; - else if (c >= 'A' && c <= 'Z') - i = (c - 'A') + 10; - else - break; - if (i >= base) - break; - if (any < 0) - continue; - if (acc > cutoff || (acc == cutoff && i > cutlim)) { - acc = __UINT_MAX; -#if !defined(_KERNEL) && !defined(_STANDALONE) - any = -1; - errno = ERANGE; -#else - any = 0; - break; -#endif - } else { - any = 1; - acc *= (__UINT)base; - acc += i; - } - } - if (neg && any > 0) - acc = -acc; - if (endptr != NULL) - /* LINTED interface specification */ - *endptr = __UNCONST(any ? s - 1 : nptr); - return(acc); -} - -#if !defined(_KERNEL) && !defined(_STANDALONE) && \ - !defined(HAVE_NBTOOL_CONFIG_H) && !defined(BCS_ONLY) -__UINT -_FUNCNAME(const char *nptr, char **endptr, int base) -{ - return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, _current_locale()); -} - -__UINT -INT_FUNCNAME(, _FUNCNAME, _l)(const char *nptr, char **endptr, int base, locale_t loc) -{ - return INT_FUNCNAME(_int_, _FUNCNAME, _l)(nptr, endptr, base, loc); -} -#endif diff --git a/common/lib/libc/stdlib/heapsort.c b/common/lib/libc/stdlib/heapsort.c deleted file mode 100644 index d0c74c59b..000000000 --- a/common/lib/libc/stdlib/heapsort.c +++ /dev/null @@ -1,229 +0,0 @@ -/* $NetBSD: heapsort.c,v 1.3 2008/11/17 10:21:30 jnemeth Exp $ */ - -/*- - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Ronnie Kon at Mindcraft Inc., Kevin Lew and Elmer Yglesias. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -/* - * XXX Undefine the renames of these functions so that we don't - * XXX rename the versions found in the host's headers by mistake! - */ -#undef heapsort -#endif - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "from: @(#)heapsort.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: heapsort.c,v 1.3 2008/11/17 10:21:30 jnemeth Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if defined(_KERNEL) || defined(_STANDALONE) -#include - -#include -#else /* _KERNEL || _STANDALONE */ -#include "namespace.h" -#include - -#include -#include -#include - -#if HAVE_NBTOOL_CONFIG_H -/* XXX Now, re-apply the renaming that we undid above. */ -#define heapsort __nbcompat_heapsort -#endif - -#ifdef __weak_alias -__weak_alias(heapsort,_heapsort) -#endif -#endif /* _KERNEL || _STANDALONE */ - -/* - * Swap two areas of size number of bytes. Although qsort(3) permits random - * blocks of memory to be sorted, sorting pointers is almost certainly the - * common case (and, were it not, could easily be made so). Regardless, it - * isn't worth optimizing; the SWAP's get sped up by the cache, and pointer - * arithmetic gets lost in the time required for comparison function calls. - */ -#define SWAP(a, b, count, size, tmp) { \ - count = size; \ - do { \ - tmp = *a; \ - *a++ = *b; \ - *b++ = tmp; \ - } while (--count); \ -} - -/* Copy one block of size size to another. */ -#define COPY(a, b, count, size, tmp1, tmp2) { \ - count = size; \ - tmp1 = a; \ - tmp2 = b; \ - do { \ - *tmp1++ = *tmp2++; \ - } while (--count); \ -} - -/* - * Build the list into a heap, where a heap is defined such that for - * the records K1 ... KN, Kj/2 >= Kj for 1 <= j/2 <= j <= N. - * - * There are two cases. If j == nmemb, select largest of Ki and Kj. If - * j < nmemb, select largest of Ki, Kj and Kj+1. - */ -#define CREATE(initval, nmemb, par_i, child_i, par, child, size, count, tmp) { \ - for (par_i = initval; (child_i = par_i * 2) <= nmemb; \ - par_i = child_i) { \ - child = base + child_i * size; \ - if (child_i < nmemb && compar(child, child + size) < 0) { \ - child += size; \ - ++child_i; \ - } \ - par = base + par_i * size; \ - if (compar(child, par) <= 0) \ - break; \ - SWAP(par, child, count, size, tmp); \ - } \ -} - -/* - * Select the top of the heap and 'heapify'. Since by far the most expensive - * action is the call to the compar function, a considerable optimization - * in the average case can be achieved due to the fact that k, the displaced - * element, is usually quite small, so it would be preferable to first - * heapify, always maintaining the invariant that the larger child is copied - * over its parent's record. - * - * Then, starting from the *bottom* of the heap, finding k's correct place, - * again maintaining the invariant. As a result of the invariant no element - * is 'lost' when k is assigned its correct place in the heap. - * - * The time savings from this optimization are on the order of 15-20% for the - * average case. See Knuth, Vol. 3, page 158, problem 18. - * - * XXX Don't break the #define SELECT line, below. Reiser cpp gets upset. - */ -#define SELECT(par_i, child_i, nmemb, par, child, size, k, count, tmp1, tmp2) { \ - for (par_i = 1; (child_i = par_i * 2) <= nmemb; par_i = child_i) { \ - child = base + child_i * size; \ - if (child_i < nmemb && compar(child, child + size) < 0) { \ - child += size; \ - ++child_i; \ - } \ - par = base + par_i * size; \ - COPY(par, child, count, size, tmp1, tmp2); \ - } \ - for (;;) { \ - child_i = par_i; \ - par_i = child_i / 2; \ - child = base + child_i * size; \ - par = base + par_i * size; \ - if (child_i == 1 || compar(k, par) < 0) { \ - COPY(child, k, count, size, tmp1, tmp2); \ - break; \ - } \ - COPY(child, par, count, size, tmp1, tmp2); \ - } \ -} - -/* - * Heapsort -- Knuth, Vol. 3, page 145. Runs in O (N lg N), both average - * and worst. While heapsort is faster than the worst case of quicksort, - * the BSD quicksort does median selection so that the chance of finding - * a data set that will trigger the worst case is nonexistent. Heapsort's - * only advantage over quicksort is that it requires little additional memory. - */ -#if defined(_KERNEL) || defined(_STANDALONE) -int -kheapsort(void *vbase, size_t nmemb, size_t size, - int (*compar)(const void *, const void *), void *k) -#else -int -heapsort(void *vbase, size_t nmemb, size_t size, - int (*compar)(const void *, const void *)) -#endif -{ - size_t cnt, i, j, l; - char tmp, *tmp1, *tmp2; - char *base, *p, *t; -#if !defined(_KERNEL) && !defined(_STANDALONE) - char *k; -#endif - - _DIAGASSERT(vbase != NULL); - _DIAGASSERT(compar != NULL); - - if (nmemb <= 1) - return (0); - - if (!size) { -#if !defined(_KERNEL) && !defined(_STANDALONE) - errno = EINVAL; -#endif - return (-1); - } - -#if !defined(_KERNEL) && !defined(_STANDALONE) - if ((k = malloc(size)) == NULL) - return (-1); -#endif - - /* - * Items are numbered from 1 to nmemb, so offset from size bytes - * below the starting address. - */ - base = (char *)vbase - size; - - for (l = nmemb / 2 + 1; --l;) - CREATE(l, nmemb, i, j, t, p, size, cnt, tmp); - - /* - * For each element of the heap, save the largest element into its - * final slot, save the displaced element (k), then recreate the - * heap. - */ - while (nmemb > 1) { - COPY(k, base + nmemb * size, cnt, size, tmp1, tmp2); - COPY(base + nmemb * size, base + size, cnt, size, tmp1, tmp2); - --nmemb; - SELECT(i, j, nmemb, t, p, size, k, cnt, tmp1, tmp2); - } -#if !defined(_KERNEL) && !defined(_STANDALONE) - free(k); -#endif - return (0); -} diff --git a/common/lib/libc/stdlib/mi_vector_hash.c b/common/lib/libc/stdlib/mi_vector_hash.c deleted file mode 100644 index 7c26df271..000000000 --- a/common/lib/libc/stdlib/mi_vector_hash.c +++ /dev/null @@ -1,182 +0,0 @@ -/* $NetBSD: mi_vector_hash.c,v 1.1 2013/12/11 01:24:08 joerg Exp $ */ -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* - * See http://burtleburtle.net/bob/hash/doobs.html for the full description - * and the original version of the code. This version differs by exposing - * the full internal state and avoiding byte operations in the inner loop - * if the key is aligned correctly. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -__RCSID("$NetBSD: mi_vector_hash.c,v 1.1 2013/12/11 01:24:08 joerg Exp $"); - -#if !HAVE_NBTOOL_CONFIG_H || HAVE_SYS_ENDIAN_H -#include -#endif - -#if defined(_KERNEL) || defined(_STANDALONE) -#include -#include -#include -#else -#include "namespace.h" - -#include -#include -#endif - -#define mix(a, b, c) do { \ - a -= b; a -= c; a ^= (c >> 13); \ - b -= c; b -= a; b ^= (a << 8); \ - c -= a; c -= b; c ^= (b >> 13); \ - a -= b; a -= c; a ^= (c >> 12); \ - b -= c; b -= a; b ^= (a << 16); \ - c -= a; c -= b; c ^= (b >> 5); \ - a -= b; a -= c; a ^= (c >> 3); \ - b -= c; b -= a; b ^= (a << 10); \ - c -= a; c -= b; c ^= (b >> 15); \ -} while (/* CONSTCOND */0) - -#define FIXED_SEED 0x9e3779b9 /* Golden ratio, arbitrary constant */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#ifdef __weak_alias -__weak_alias(mi_vector_hash, _mi_vector_hash) -#endif -#endif - -void -mi_vector_hash(const void * __restrict key, size_t len, uint32_t seed, - uint32_t hashes[3]) -{ - static const uint32_t mask[4] = { - 0x000000ff, 0x0000ffff, 0x00ffffff, 0xffffffff - }; - uint32_t orig_len, a, b, c; - const uint8_t *k; - - orig_len = (uint32_t)len; - - a = b = FIXED_SEED; - c = seed; - - if ((uintptr_t)key & 3) { - k = key; - while (len >= 12) { - a += le32dec(k); - b += le32dec(k + 4); - c += le32dec(k + 8); - mix(a, b, c); - k += 12; - len -= 12; - } - c += orig_len; - - if (len > 8) { - switch (len) { - case 11: - c += (uint32_t)k[10] << 24; - /* FALLTHROUGH */ - case 10: - c += (uint32_t)k[9] << 16; - /* FALLTHROUGH */ - case 9: - c += (uint32_t)k[8] << 8; - /* FALLTHROUGH */ - } - b += le32dec(k + 4); - a += le32dec(k); - } else if (len > 4) { - switch (len) { - case 8: - b += (uint32_t)k[7] << 24; - /* FALLTHROUGH */ - case 7: - b += (uint32_t)k[6] << 16; - /* FALLTHROUGH */ - case 6: - b += (uint32_t)k[5] << 8; - /* FALLTHROUGH */ - case 5: - b += k[4]; - /* FALLTHROUGH */ - } - a += le32dec(k); - } else if (len) { - switch (len) { - case 4: - a += (uint32_t)k[3] << 24; - /* FALLTHROUGH */ - case 3: - a += (uint32_t)k[2] << 16; - /* FALLTHROUGH */ - case 2: - a += (uint32_t)k[1] << 8; - /* FALLTHROUGH */ - case 1: - a += k[0]; - /* FALLTHROUGH */ - } - } - } else { - const uint32_t *key32 = key; - while (len >= 12) { - a += le32toh(key32[0]); - b += le32toh(key32[1]); - c += le32toh(key32[2]); - mix(a, b, c); - key32 += 3; - len -= 12; - } - c += orig_len; - - if (len > 8) { - c += (le32toh(key32[2]) & mask[len - 9]) << 8; - b += le32toh(key32[1]); - a += le32toh(key32[0]); - } else if (len > 4) { - b += le32toh(key32[1]) & mask[len - 5]; - a += le32toh(key32[0]); - } else if (len) - a += le32toh(key32[0]) & mask[len - 1]; - } - mix(a, b, c); - hashes[0] = a; - hashes[1] = b; - hashes[2] = c; -} diff --git a/common/lib/libc/stdlib/random.c b/common/lib/libc/stdlib/random.c deleted file mode 100644 index e7503c7d5..000000000 --- a/common/lib/libc/stdlib/random.c +++ /dev/null @@ -1,530 +0,0 @@ -/* $NetBSD: random.c,v 1.4 2014/06/12 20:59:46 christos Exp $ */ - -/* - * Copyright (c) 1983, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)random.c 8.2 (Berkeley) 5/19/95"; -#else -__RCSID("$NetBSD: random.c,v 1.4 2014/06/12 20:59:46 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include "namespace.h" - -#include -#include -#include -#include "reentrant.h" - -#ifdef __weak_alias -__weak_alias(initstate,_initstate) -__weak_alias(random,_random) -__weak_alias(setstate,_setstate) -__weak_alias(srandom,_srandom) -#endif - - -#ifdef _REENTRANT -static mutex_t random_mutex = MUTEX_INITIALIZER; -#endif -#else -#include -#define mutex_lock(a) (void)0 -#define mutex_unlock(a) (void)0 -#endif - -#ifndef SMALL_RANDOM -static void srandom_unlocked(unsigned int); -static long random_unlocked(void); - -#define USE_BETTER_RANDOM - -/* - * random.c: - * - * An improved random number generation package. In addition to the standard - * rand()/srand() like interface, this package also has a special state info - * interface. The initstate() routine is called with a seed, an array of - * bytes, and a count of how many bytes are being passed in; this array is - * then initialized to contain information for random number generation with - * that much state information. Good sizes for the amount of state - * information are 32, 64, 128, and 256 bytes. The state can be switched by - * calling the setstate() routine with the same array as was initiallized - * with initstate(). By default, the package runs with 128 bytes of state - * information and generates far better random numbers than a linear - * congruential generator. If the amount of state information is less than - * 32 bytes, a simple linear congruential R.N.G. is used. - * - * Internally, the state information is treated as an array of ints; the - * zeroeth element of the array is the type of R.N.G. being used (small - * integer); the remainder of the array is the state information for the - * R.N.G. Thus, 32 bytes of state information will give 7 ints worth of - * state information, which will allow a degree seven polynomial. (Note: - * the zeroeth word of state information also has some other information - * stored in it -- see setstate() for details). - * - * The random number generation technique is a linear feedback shift register - * approach, employing trinomials (since there are fewer terms to sum up that - * way). In this approach, the least significant bit of all the numbers in - * the state table will act as a linear feedback shift register, and will - * have period 2^deg - 1 (where deg is the degree of the polynomial being - * used, assuming that the polynomial is irreducible and primitive). The - * higher order bits will have longer periods, since their values are also - * influenced by pseudo-random carries out of the lower bits. The total - * period of the generator is approximately deg*(2**deg - 1); thus doubling - * the amount of state information has a vast influence on the period of the - * generator. Note: the deg*(2**deg - 1) is an approximation only good for - * large deg, when the period of the shift register is the dominant factor. - * With deg equal to seven, the period is actually much longer than the - * 7*(2**7 - 1) predicted by this formula. - * - * Modified 28 December 1994 by Jacob S. Rosenberg. - * The following changes have been made: - * All references to the type u_int have been changed to unsigned long. - * All references to type int have been changed to type long. Other - * cleanups have been made as well. A warning for both initstate and - * setstate has been inserted to the effect that on Sparc platforms - * the 'arg_state' variable must be forced to begin on word boundaries. - * This can be easily done by casting a long integer array to char *. - * The overall logic has been left STRICTLY alone. This software was - * tested on both a VAX and Sun SpacsStation with exactly the same - * results. The new version and the original give IDENTICAL results. - * The new version is somewhat faster than the original. As the - * documentation says: "By default, the package runs with 128 bytes of - * state information and generates far better random numbers than a linear - * congruential generator. If the amount of state information is less than - * 32 bytes, a simple linear congruential R.N.G. is used." For a buffer of - * 128 bytes, this new version runs about 19 percent faster and for a 16 - * byte buffer it is about 5 percent faster. - * - * Modified 07 January 2002 by Jason R. Thorpe. - * The following changes have been made: - * All the references to "long" have been changed back to "int". This - * fixes memory corruption problems on LP64 platforms. - */ - -/* - * For each of the currently supported random number generators, we have a - * break value on the amount of state information (you need at least this - * many bytes of state info to support this random number generator), a degree - * for the polynomial (actually a trinomial) that the R.N.G. is based on, and - * the separation between the two lower order coefficients of the trinomial. - */ -#define TYPE_0 0 /* linear congruential */ -#define BREAK_0 8 -#define DEG_0 0 -#define SEP_0 0 - -#define TYPE_1 1 /* x**7 + x**3 + 1 */ -#define BREAK_1 32 -#define DEG_1 7 -#define SEP_1 3 - -#define TYPE_2 2 /* x**15 + x + 1 */ -#define BREAK_2 64 -#define DEG_2 15 -#define SEP_2 1 - -#define TYPE_3 3 /* x**31 + x**3 + 1 */ -#define BREAK_3 128 -#define DEG_3 31 -#define SEP_3 3 - -#define TYPE_4 4 /* x**63 + x + 1 */ -#define BREAK_4 256 -#define DEG_4 63 -#define SEP_4 1 - -/* - * Array versions of the above information to make code run faster -- - * relies on fact that TYPE_i == i. - */ -#define MAX_TYPES 5 /* max number of types above */ - -static const int degrees[MAX_TYPES] = { DEG_0, DEG_1, DEG_2, DEG_3, DEG_4 }; -static const int seps[MAX_TYPES] = { SEP_0, SEP_1, SEP_2, SEP_3, SEP_4 }; - -/* - * Initially, everything is set up as if from: - * - * initstate(1, &randtbl, 128); - * - * Note that this initialization takes advantage of the fact that srandom() - * advances the front and rear pointers 10*rand_deg times, and hence the - * rear pointer which starts at 0 will also end up at zero; thus the zeroeth - * element of the state information, which contains info about the current - * position of the rear pointer is just - * - * MAX_TYPES * (rptr - state) + TYPE_3 == TYPE_3. - */ - -/* LINTED */ -static int randtbl[DEG_3 + 1] = { - TYPE_3, -#ifdef USE_BETTER_RANDOM - 0x991539b1, 0x16a5bce3, 0x6774a4cd, - 0x3e01511e, 0x4e508aaa, 0x61048c05, - 0xf5500617, 0x846b7115, 0x6a19892c, - 0x896a97af, 0xdb48f936, 0x14898454, - 0x37ffd106, 0xb58bff9c, 0x59e17104, - 0xcf918a49, 0x09378c83, 0x52c7a471, - 0x8d293ea9, 0x1f4fc301, 0xc3db71be, - 0x39b44e1c, 0xf8a44ef9, 0x4c8b80b1, - 0x19edc328, 0x87bf4bdd, 0xc9b240e5, - 0xe9ee4b1b, 0x4382aee7, 0x535b6b41, - 0xf3bec5da, -#else - 0x9a319039, 0x32d9c024, 0x9b663182, - 0x5da1f342, 0xde3b81e0, 0xdf0a6fb5, - 0xf103bc02, 0x48f340fb, 0x7449e56b, - 0xbeb1dbb0, 0xab5c5918, 0x946554fd, - 0x8c2e680f, 0xeb3d799f, 0xb11ee0b7, - 0x2d436b86, 0xda672e2a, 0x1588ca88, - 0xe369735d, 0x904f35f7, 0xd7158fd6, - 0x6fa6f051, 0x616e6b96, 0xac94efdc, - 0x36413f93, 0xc622c298, 0xf5a42ab8, - 0x8a88d77b, 0xf5ad9d0e, 0x8999220b, - 0x27fb47b9, -#endif /* USE_BETTER_RANDOM */ -}; - -/* - * fptr and rptr are two pointers into the state info, a front and a rear - * pointer. These two pointers are always rand_sep places aparts, as they - * cycle cyclically through the state information. (Yes, this does mean we - * could get away with just one pointer, but the code for random() is more - * efficient this way). The pointers are left positioned as they would be - * from the call - * - * initstate(1, randtbl, 128); - * - * (The position of the rear pointer, rptr, is really 0 (as explained above - * in the initialization of randtbl) because the state table pointer is set - * to point to randtbl[1] (as explained below). - */ -static int *fptr = &randtbl[SEP_3 + 1]; -static int *rptr = &randtbl[1]; - -/* - * The following things are the pointer to the state information table, the - * type of the current generator, the degree of the current polynomial being - * used, and the separation between the two pointers. Note that for efficiency - * of random(), we remember the first location of the state information, not - * the zeroeth. Hence it is valid to access state[-1], which is used to - * store the type of the R.N.G. Also, we remember the last location, since - * this is more efficient than indexing every time to find the address of - * the last element to see if the front and rear pointers have wrapped. - */ -static int *state = &randtbl[1]; -static int rand_type = TYPE_3; -static int rand_deg = DEG_3; -static int rand_sep = SEP_3; -static int *end_ptr = &randtbl[DEG_3 + 1]; - -/* - * srandom: - * - * Initialize the random number generator based on the given seed. If the - * type is the trivial no-state-information type, just remember the seed. - * Otherwise, initializes state[] based on the given "seed" via a linear - * congruential generator. Then, the pointers are set to known locations - * that are exactly rand_sep places apart. Lastly, it cycles the state - * information a given number of times to get rid of any initial dependencies - * introduced by the L.C.R.N.G. Note that the initialization of randtbl[] - * for default usage relies on values produced by this routine. - */ -static void -srandom_unlocked(unsigned int x) -{ - int i; - - if (rand_type == TYPE_0) - state[0] = x; - else { - state[0] = x; - for (i = 1; i < rand_deg; i++) { -#ifdef USE_BETTER_RANDOM - int x1, hi, lo, t; - - /* - * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). - * From "Random number generators: good ones are hard - * to find", Park and Miller, Communications of the ACM, - * vol. 31, no. 10, - * October 1988, p. 1195. - */ - x1 = state[i - 1]; - hi = x1 / 127773; - lo = x1 % 127773; - t = 16807 * lo - 2836 * hi; - if (t <= 0) - t += 0x7fffffff; - state[i] = t; -#else - state[i] = 1103515245 * state[i - 1] + 12345; -#endif /* USE_BETTER_RANDOM */ - } - fptr = &state[rand_sep]; - rptr = &state[0]; - for (i = 0; i < 10 * rand_deg; i++) - (void)random_unlocked(); - } -} - -void -srandom(unsigned int x) -{ - - mutex_lock(&random_mutex); - srandom_unlocked(x); - mutex_unlock(&random_mutex); -} - -/* - * initstate: - * - * Initialize the state information in the given array of n bytes for future - * random number generation. Based on the number of bytes we are given, and - * the break values for the different R.N.G.'s, we choose the best (largest) - * one we can and set things up for it. srandom() is then called to - * initialize the state information. - * - * Note that on return from srandom(), we set state[-1] to be the type - * multiplexed with the current value of the rear pointer; this is so - * successive calls to initstate() won't lose this information and will be - * able to restart with setstate(). - * - * Note: the first thing we do is save the current state, if any, just like - * setstate() so that it doesn't matter when initstate is called. - * - * Returns a pointer to the old state. - * - * Note: The Sparc platform requires that arg_state begin on an int - * word boundary; otherwise a bus error will occur. Even so, lint will - * complain about mis-alignment, but you should disregard these messages. - */ -char * -initstate( - unsigned int seed, /* seed for R.N.G. */ - char *arg_state, /* pointer to state array */ - size_t n) /* # bytes of state info */ -{ - void *ostate = (void *)(&state[-1]); - int *int_arg_state; - - _DIAGASSERT(arg_state != NULL); - - int_arg_state = (int *)(void *)arg_state; - - mutex_lock(&random_mutex); - if (rand_type == TYPE_0) - state[-1] = rand_type; - else - state[-1] = MAX_TYPES * (int)(rptr - state) + rand_type; - if (n < BREAK_0) { - mutex_unlock(&random_mutex); - return (NULL); - } else if (n < BREAK_1) { - rand_type = TYPE_0; - rand_deg = DEG_0; - rand_sep = SEP_0; - } else if (n < BREAK_2) { - rand_type = TYPE_1; - rand_deg = DEG_1; - rand_sep = SEP_1; - } else if (n < BREAK_3) { - rand_type = TYPE_2; - rand_deg = DEG_2; - rand_sep = SEP_2; - } else if (n < BREAK_4) { - rand_type = TYPE_3; - rand_deg = DEG_3; - rand_sep = SEP_3; - } else { - rand_type = TYPE_4; - rand_deg = DEG_4; - rand_sep = SEP_4; - } - state = (int *) (int_arg_state + 1); /* first location */ - end_ptr = &state[rand_deg]; /* must set end_ptr before srandom */ - srandom_unlocked(seed); - if (rand_type == TYPE_0) - int_arg_state[0] = rand_type; - else - int_arg_state[0] = MAX_TYPES * (int)(rptr - state) + rand_type; - mutex_unlock(&random_mutex); - return((char *)ostate); -} - -/* - * setstate: - * - * Restore the state from the given state array. - * - * Note: it is important that we also remember the locations of the pointers - * in the current state information, and restore the locations of the pointers - * from the old state information. This is done by multiplexing the pointer - * location into the zeroeth word of the state information. - * - * Note that due to the order in which things are done, it is OK to call - * setstate() with the same state as the current state. - * - * Returns a pointer to the old state information. - * - * Note: The Sparc platform requires that arg_state begin on a long - * word boundary; otherwise a bus error will occur. Even so, lint will - * complain about mis-alignment, but you should disregard these messages. - */ -char * -setstate(char *arg_state) /* pointer to state array */ -{ - int *new_state; - int type; - int rear; - void *ostate = (void *)(&state[-1]); - - _DIAGASSERT(arg_state != NULL); - - new_state = (int *)(void *)arg_state; - type = (int)(new_state[0] % MAX_TYPES); - rear = (int)(new_state[0] / MAX_TYPES); - - mutex_lock(&random_mutex); - if (rand_type == TYPE_0) - state[-1] = rand_type; - else - state[-1] = MAX_TYPES * (int)(rptr - state) + rand_type; - switch(type) { - case TYPE_0: - case TYPE_1: - case TYPE_2: - case TYPE_3: - case TYPE_4: - rand_type = type; - rand_deg = degrees[type]; - rand_sep = seps[type]; - break; - default: - mutex_unlock(&random_mutex); - return (NULL); - } - state = (int *) (new_state + 1); - if (rand_type != TYPE_0) { - rptr = &state[rear]; - fptr = &state[(rear + rand_sep) % rand_deg]; - } - end_ptr = &state[rand_deg]; /* set end_ptr too */ - mutex_unlock(&random_mutex); - return((char *)ostate); -} - -/* - * random: - * - * If we are using the trivial TYPE_0 R.N.G., just do the old linear - * congruential bit. Otherwise, we do our fancy trinomial stuff, which is - * the same in all the other cases due to all the global variables that have - * been set up. The basic operation is to add the number at the rear pointer - * into the one at the front pointer. Then both pointers are advanced to - * the next location cyclically in the table. The value returned is the sum - * generated, reduced to 31 bits by throwing away the "least random" low bit. - * - * Note: the code takes advantage of the fact that both the front and - * rear pointers can't wrap on the same call by not testing the rear - * pointer if the front one has wrapped. - * - * Returns a 31-bit random number. - */ -static long -random_unlocked(void) -{ - int i; - int *f, *r; - - if (rand_type == TYPE_0) { - i = state[0]; - state[0] = i = (i * 1103515245 + 12345) & 0x7fffffff; - } else { - /* - * Use local variables rather than static variables for speed. - */ - f = fptr; r = rptr; - *f += *r; - /* chucking least random bit */ - i = ((unsigned int)*f >> 1) & 0x7fffffff; - if (++f >= end_ptr) { - f = state; - ++r; - } - else if (++r >= end_ptr) { - r = state; - } - - fptr = f; rptr = r; - } - return(i); -} - -long -random(void) -{ - long r; - - mutex_lock(&random_mutex); - r = random_unlocked(); - mutex_unlock(&random_mutex); - return (r); -} -#else -long -random(void) -{ - static u_long randseed = 1; - long x, hi, lo, t; - - /* - * Compute x[n + 1] = (7^5 * x[n]) mod (2^31 - 1). - * From "Random number generators: good ones are hard to find", - * Park and Miller, Communications of the ACM, vol. 31, no. 10, - * October 1988, p. 1195. - */ - x = randseed; - hi = x / 127773; - lo = x % 127773; - t = 16807 * lo - 2836 * hi; - if (t <= 0) - t += 0x7fffffff; - randseed = t; - return (t); -} -#endif /* SMALL_RANDOM */ diff --git a/common/lib/libc/stdlib/strtoi.c b/common/lib/libc/stdlib/strtoi.c deleted file mode 100644 index 5817e01ee..000000000 --- a/common/lib/libc/stdlib/strtoi.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $NetBSD: strtoi.c,v 1.2 2015/05/01 14:17:56 christos Exp $ */ - -/*- - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * Copyright (c) 2003 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Created by Kamil Rytarowski, based on ID: - * NetBSD: src/common/lib/libc/stdlib/strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -__RCSID("$NetBSD: strtoi.c,v 1.2 2015/05/01 14:17:56 christos Exp $"); - -#ifdef _LIBC -#include "namespace.h" -#endif - -#if defined(_KERNEL) -#include -#include -#include -#elif defined(_STANDALONE) -#include -#include -#include -#include -#else -#include -#include -#include -#include -#endif - -#define _FUNCNAME strtoi -#define __TYPE intmax_t -#define __WRAPPED strtoimax - -#include "_strtoi.h" - -#ifdef _LIBC -__weak_alias(strtoi, _strtoi) -__weak_alias(strtoi_l, _strtoi_l) -#endif diff --git a/common/lib/libc/stdlib/strtoimax.c b/common/lib/libc/stdlib/strtoimax.c deleted file mode 100644 index c31d56120..000000000 --- a/common/lib/libc/stdlib/strtoimax.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $DragonFly: src/lib/libc/stdlib/strtoimax.c,v 1.2 2008/08/19 15:50:24 joerg Exp $ */ - -/*- - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * Copyright (c) 2003 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -__RCSID("$NetBSD: strtoimax.c,v 1.2 2013/12/02 12:20:44 joerg Exp $"); - -#ifdef _LIBC -#include "namespace.h" -#endif - -#if defined(_KERNEL) -#include -#include -#elif defined(_STANDALONE) -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#include -#endif - -#define _FUNCNAME strtoimax -#define __INT intmax_t -#define __INT_MIN INTMAX_MIN -#define __INT_MAX INTMAX_MAX - -#include "_strtol.h" - -#ifdef _LIBC -__weak_alias(strtoimax, _strtoimax) -__weak_alias(strtoimax_l, _strtoimax_l) -#endif diff --git a/common/lib/libc/stdlib/strtoll.c b/common/lib/libc/stdlib/strtoll.c deleted file mode 100644 index 551f5f4ff..000000000 --- a/common/lib/libc/stdlib/strtoll.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: strtoll.c,v 1.7 2013/04/16 21:44:06 joerg Exp $ */ - -/*- - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * Copyright (c) 2003 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -__RCSID("$NetBSD: strtoll.c,v 1.7 2013/04/16 21:44:06 joerg Exp $"); - -#ifdef _LIBC -#include "namespace.h" -#endif - -#if defined(_KERNEL) -#include -#include -#elif defined(_STANDALONE) -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#endif - -#define _FUNCNAME strtoll -#define __INT long long -#define __INT_MIN LLONG_MIN -#define __INT_MAX LLONG_MAX - -#include "_strtol.h" - -#ifdef _LIBC -__weak_alias(strtoll, _strtoll) -__weak_alias(strtoll_l, _strtoll_l) -#endif diff --git a/common/lib/libc/stdlib/strtou.c b/common/lib/libc/stdlib/strtou.c deleted file mode 100644 index 9ce2897ec..000000000 --- a/common/lib/libc/stdlib/strtou.c +++ /dev/null @@ -1,69 +0,0 @@ -/* $NetBSD: strtou.c,v 1.2 2015/05/01 14:17:56 christos Exp $ */ - -/*- - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * Copyright (c) 2003 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * Created by Kamil Rytarowski, based on ID: - * NetBSD: src/common/lib/libc/stdlib/strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -__RCSID("$NetBSD: strtou.c,v 1.2 2015/05/01 14:17:56 christos Exp $"); - -#ifdef _LIBC -#include "namespace.h" -#endif - -#if defined(_KERNEL) -#include -#include -#include -#elif defined(_STANDALONE) -#include -#include -#include -#include -#else -#include -#include -#include -#include -#endif - -#define _FUNCNAME strtou -#define __TYPE uintmax_t -#define __WRAPPED strtoumax - -#include "_strtoi.h" - -#ifdef _LIBC -__weak_alias(strtou, _strtou) -__weak_alias(strtou_l, _strtou_l) -#endif diff --git a/common/lib/libc/stdlib/strtoul.c b/common/lib/libc/stdlib/strtoul.c deleted file mode 100644 index 764b09189..000000000 --- a/common/lib/libc/stdlib/strtoul.c +++ /dev/null @@ -1,53 +0,0 @@ -/* $NetBSD: strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp $ */ - -/*- - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * Copyright (c) 2003 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: strtoul.c,v 1.3 2008/08/20 19:58:34 oster Exp $"); - -#if defined(_KERNEL) -#include -#include -#elif defined(_STANDALONE) -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#endif - -#define _FUNCNAME strtoul -#define __UINT unsigned long int -#define __UINT_MAX ULONG_MAX - -#include "_strtoul.h" diff --git a/common/lib/libc/stdlib/strtoull.c b/common/lib/libc/stdlib/strtoull.c deleted file mode 100644 index afd04776f..000000000 --- a/common/lib/libc/stdlib/strtoull.c +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: strtoull.c,v 1.6 2013/04/16 21:44:06 joerg Exp $ */ - -/*- - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * Copyright (c) 2003 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -__RCSID("$NetBSD: strtoull.c,v 1.6 2013/04/16 21:44:06 joerg Exp $"); - -#ifdef _LIBC -#include "namespace.h" -#endif - -#if defined(_KERNEL) -#include -#include -#elif defined(_STANDALONE) -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#endif - -#define _FUNCNAME strtoull -#define __UINT unsigned long long int -#define __UINT_MAX ULLONG_MAX - -#include "_strtoul.h" - -#ifdef _LIBC -__weak_alias(strtoull, _strtoull) -__weak_alias(strtoull_l, _strtoull_l) -#endif diff --git a/common/lib/libc/stdlib/strtoumax.c b/common/lib/libc/stdlib/strtoumax.c deleted file mode 100644 index cf098d1d2..000000000 --- a/common/lib/libc/stdlib/strtoumax.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: strtoumax.c,v 1.6 2013/04/16 21:44:06 joerg Exp $ */ - -/*- - * Copyright (c) 2005 The DragonFly Project. All rights reserved. - * Copyright (c) 2003 Citrus Project, - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -__RCSID("$NetBSD: strtoumax.c,v 1.6 2013/04/16 21:44:06 joerg Exp $"); - -#ifdef _LIBC -#include "namespace.h" -#endif - -#if defined(_KERNEL) -#include -#include -#elif defined(_STANDALONE) -#include -#include -#include -#else -#include -#include -#include -#include -#include -#include -#include -#endif - -#define _FUNCNAME strtoumax -#define __UINT uintmax_t -#define __UINT_MAX UINTMAX_MAX - -#include "_strtoul.h" - -#ifdef _LIBC -__weak_alias(strtoumax, _strtoumax) -__weak_alias(strtoumax_l, _strtoumax_l) -#endif diff --git a/common/lib/libc/string/bcmp.c b/common/lib/libc/string/bcmp.c deleted file mode 100644 index 97bf3977c..000000000 --- a/common/lib/libc/string/bcmp.c +++ /dev/null @@ -1,70 +0,0 @@ -/* $NetBSD: bcmp.c,v 1.7 2012/03/09 15:41:16 christos Exp $ */ - -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)bcmp.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: bcmp.c,v 1.7 2012/03/09 15:41:16 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - - -#if defined(_KERNEL) || defined(_STANDALONE) -#include -#if defined(_STANDALONE) -#include -#endif -#else -#include -#include -#endif - -/* - * bcmp -- vax cmpc3 instruction - */ -int -bcmp(const void *b1, const void *b2, size_t length) -{ - const char *p1 = b1, *p2 = b2; - - _DIAGASSERT(b1 != 0); - _DIAGASSERT(b2 != 0); - - if (length == 0) - return(0); - do - if (*p1++ != *p2++) - break; - while (--length); - return length != 0; -} diff --git a/common/lib/libc/string/bcopy.c b/common/lib/libc/string/bcopy.c deleted file mode 100644 index 75a65f60c..000000000 --- a/common/lib/libc/string/bcopy.c +++ /dev/null @@ -1,209 +0,0 @@ -/* $NetBSD: bcopy.c,v 1.11 2014/04/16 20:39:55 joerg Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)bcopy.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: bcopy.c,v 1.11 2014/04/16 20:39:55 joerg Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#if !defined(MEMCOPY) && defined(_STANDALONE) -#include -#endif -#endif - -#if defined(_FORTIFY_SOURCE) || defined(_STANDALONE) || defined(_KERNEL) -#undef bcopy -#undef memcpy -#undef memmove -#endif - -#ifndef __OPTIMIZE_SIZE__ -/* - * sizeof(word) MUST BE A POWER OF TWO - * SO THAT wmask BELOW IS ALL ONES - */ -typedef long word; /* "word" used for optimal copy speed */ - -#define wsize sizeof(word) -#define wmask (wsize - 1) - -/* - * Copy a block of memory, handling overlap. - * This is the routine that actually implements - * (the portable versions of) bcopy, memcpy, and memmove. - */ -#if defined(MEMCOPY) -void * -memcpy(void *dst0, const void *src0, size_t length) -#elif defined(MEMMOVE) -void * -memmove(void *dst0, const void *src0, size_t length) -#else -void -bcopy(const void *src0, void *dst0, size_t length) -#endif -{ - char *dst = dst0; - const char *src = src0; - size_t t; - unsigned long u; - -#if !defined(_KERNEL) - _DIAGASSERT((dst0 && src0) || length == 0); -#endif - - if (length == 0 || dst == src) /* nothing to do */ - goto done; - - /* - * Macros: loop-t-times; and loop-t-times, t>0 - */ -#define TLOOP(s) if (t) TLOOP1(s) -#define TLOOP1(s) do { s; } while (--t) - - if ((unsigned long)dst < (unsigned long)src) { - /* - * Copy forward. - */ - u = (unsigned long)src; /* only need low bits */ - if ((u | (unsigned long)dst) & wmask) { - /* - * Try to align operands. This cannot be done - * unless the low bits match. - */ - if ((u ^ (unsigned long)dst) & wmask || length < wsize) - t = length; - else - t = wsize - (size_t)(u & wmask); - length -= t; - TLOOP1(*dst++ = *src++); - } - /* - * Copy whole words, then mop up any trailing bytes. - */ - t = length / wsize; - TLOOP(*(word *)(void *)dst = *(const word *)(const void *)src; src += wsize; dst += wsize); - t = length & wmask; - TLOOP(*dst++ = *src++); - } else { - /* - * Copy backwards. Otherwise essentially the same. - * Alignment works as before, except that it takes - * (t&wmask) bytes to align, not wsize-(t&wmask). - */ - src += length; - dst += length; - _DIAGASSERT((unsigned long)dst >= (unsigned long)dst0); - _DIAGASSERT((unsigned long)src >= (unsigned long)src0); - u = (unsigned long)src; - if ((u | (unsigned long)dst) & wmask) { - if ((u ^ (unsigned long)dst) & wmask || length <= wsize) - t = length; - else - t = (size_t)(u & wmask); - length -= t; - TLOOP1(*--dst = *--src); - } - t = length / wsize; - TLOOP(src -= wsize; dst -= wsize; *(word *)(void *)dst = *(const word *)(const void *)src); - t = length & wmask; - TLOOP(*--dst = *--src); - } -done: -#if defined(MEMCOPY) || defined(MEMMOVE) - return (dst0); -#else - return; -#endif -} -#else /* __OPTIMIZE_SIZE__ */ -#if defined(MEMCOPY) -/* - * This is designed to be small, not fast. - */ -void * -memcpy(void *s1, const void *s2, size_t n) -{ - const char *f = s2; - char *t = s1; - - while (n-- > 0) - *t++ = *f++; - return s1; -} -#elif defined(MEMMOVE) -/* - * This is designed to be small, not fast. - */ -void * -memmove(void *s1, const void *s2, size_t n) -{ - const char *f = s2; - char *t = s1; - - if (f < t) { - f += n; - t += n; - while (n-- > 0) - *--t = *--f; - } else { - while (n-- > 0) - *t++ = *f++; - } - return s1; -} -#else -/* - * This is designed to be small, not fast. - */ -void -bcopy(const void *s2, void *s1, size_t n) -{ - const char *f = s2; - char *t = s1; - - while (n-- > 0) - *t++ = *f++; -} -#endif -#endif /* __OPTIMIZE_SIZE__ */ diff --git a/common/lib/libc/string/bzero.c b/common/lib/libc/string/bzero.c deleted file mode 100644 index 8db58bb9f..000000000 --- a/common/lib/libc/string/bzero.c +++ /dev/null @@ -1,4 +0,0 @@ -/* $NetBSD: bzero.c,v 1.1 2005/12/20 19:28:52 christos Exp $ */ - -#define BZERO -#include "memset.c" diff --git a/common/lib/libc/string/bzero2.c b/common/lib/libc/string/bzero2.c deleted file mode 100644 index 0522034e7..000000000 --- a/common/lib/libc/string/bzero2.c +++ /dev/null @@ -1,36 +0,0 @@ -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#define BZERO - -#include "memset2.c" - -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: bzero2.c,v 1.2 2009/12/14 00:39:01 matt Exp $"); -#endif /* LIBC_SCCS and not lint */ diff --git a/common/lib/libc/string/consttime_memequal.c b/common/lib/libc/string/consttime_memequal.c deleted file mode 100644 index 79263c19d..000000000 --- a/common/lib/libc/string/consttime_memequal.c +++ /dev/null @@ -1,37 +0,0 @@ -/* $NetBSD: consttime_memequal.c,v 1.6 2015/03/18 20:11:35 riastradh Exp $ */ - -/* - * Written by Matthias Drochner . - * Public domain. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include "namespace.h" -#include -#ifdef __weak_alias -__weak_alias(consttime_memequal,_consttime_memequal) -#endif -#else -#include -#endif - -int -consttime_memequal(const void *b1, const void *b2, size_t len) -{ - const unsigned char *c1 = b1, *c2 = b2; - unsigned int res = 0; - - while (len--) - res |= *c1++ ^ *c2++; - - /* - * Map 0 to 1 and [1, 256) to 0 using only constant-time - * arithmetic. - * - * This is not simply `!res' because although many CPUs support - * branchless conditional moves and many compilers will take - * advantage of them, certain compilers generate branches on - * certain CPUs for `!res'. - */ - return (1 & ((res - 1) >> 8)); -} diff --git a/common/lib/libc/string/explicit_memset.c b/common/lib/libc/string/explicit_memset.c deleted file mode 100644 index 5fbd2f762..000000000 --- a/common/lib/libc/string/explicit_memset.c +++ /dev/null @@ -1,30 +0,0 @@ -/* $NetBSD: explicit_memset.c,v 1.4 2014/06/24 16:39:39 drochner Exp $ */ - -/* - * Written by Matthias Drochner . - * Public domain. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include "namespace.h" -#include -#ifdef __weak_alias -__weak_alias(explicit_memset,_explicit_memset) -#endif -#define explicit_memset_impl __explicit_memset_impl -#else -#include -#endif - -/* - * The use of a volatile pointer guarantees that the compiler - * will not optimise the call away. - */ -void *(* volatile explicit_memset_impl)(void *, int, size_t) = memset; - -void * -explicit_memset(void *b, int c, size_t len) -{ - - return (*explicit_memset_impl)(b, c, len); -} diff --git a/common/lib/libc/string/ffs.c b/common/lib/libc/string/ffs.c deleted file mode 100644 index 59969507d..000000000 --- a/common/lib/libc/string/ffs.c +++ /dev/null @@ -1,61 +0,0 @@ -/* $NetBSD: ffs.c,v 1.4 2011/08/07 01:52:47 mrg Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)ffs.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: ffs.c,v 1.4 2011/08/07 01:52:47 mrg Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include -#include - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -/* #undef ffs() - might be defined as macro to __builtin_ffs() */ -#undef ffs - -/* - * ffs -- vax ffs instruction - */ -__weak_alias(__ffssi2,ffs) -int -ffs(int mask) -{ - return ffs32((uint32_t)mask); -} diff --git a/common/lib/libc/string/memchr.c b/common/lib/libc/string/memchr.c deleted file mode 100644 index 93d11cd59..000000000 --- a/common/lib/libc/string/memchr.c +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: memchr.c,v 1.3 2008/01/08 21:57:06 martin Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)memchr.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: memchr.c,v 1.3 2008/01/08 21:57:06 martin Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -void * -memchr(const void *s, int c, size_t n) -{ - _DIAGASSERT(s != NULL); - - if (n != 0) { - const unsigned char *p = s; - const unsigned char cmp = c; - - do { - if (*p++ == cmp) - return __UNCONST(p - 1); - } while (--n != 0); - } - return NULL; -} diff --git a/common/lib/libc/string/memcmp.c b/common/lib/libc/string/memcmp.c deleted file mode 100644 index 444f771bf..000000000 --- a/common/lib/libc/string/memcmp.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)memcmp.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: memcmp.c,v 1.4 2013/12/02 21:21:33 joerg Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -#undef memcmp -/* - * Compare memory regions. - */ -int -memcmp(const void *s1, const void *s2, size_t n) -{ - _DIAGASSERT(s1 != 0); - _DIAGASSERT(s2 != 0); - - if (n != 0) { - const unsigned char *p1 = s1, *p2 = s2; - - do { - if (*p1++ != *p2++) - return (*--p1 - *--p2); - } while (--n != 0); - } - return (0); -} - -#if defined(__ARM_EABI__) -__strong_alias(__aeabi_memcmp, memcmp) -#endif diff --git a/common/lib/libc/string/memcpy.c b/common/lib/libc/string/memcpy.c deleted file mode 100644 index 4f2517271..000000000 --- a/common/lib/libc/string/memcpy.c +++ /dev/null @@ -1,8 +0,0 @@ -/* $NetBSD: memcpy.c,v 1.2 2013/12/02 21:21:33 joerg Exp $ */ - -#define MEMCOPY -#include "bcopy.c" - -#if defined(__ARM_EABI__) -__strong_alias(__aeabi_memcpy, memcpy) -#endif diff --git a/common/lib/libc/string/memmove.c b/common/lib/libc/string/memmove.c deleted file mode 100644 index a1a18f60d..000000000 --- a/common/lib/libc/string/memmove.c +++ /dev/null @@ -1,10 +0,0 @@ -/* $NetBSD: memmove.c,v 1.2 2013/12/02 21:21:33 joerg Exp $ */ - -#define MEMMOVE -#include "bcopy.c" - -#if defined(__ARM_EABI__) -__strong_alias(__aeabi_memmove, memmove) -__strong_alias(__aeabi_memmove4, memmove) -__strong_alias(__aeabi_memmove8, memmove) -#endif diff --git a/common/lib/libc/string/memset.c b/common/lib/libc/string/memset.c deleted file mode 100644 index 6468c2293..000000000 --- a/common/lib/libc/string/memset.c +++ /dev/null @@ -1,187 +0,0 @@ -/* $NetBSD: memset.c,v 1.10 2013/12/02 21:21:33 joerg Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Mike Hibler and Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)memset.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: memset.c,v 1.10 2013/12/02 21:21:33 joerg Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#include - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#else -#include -#if defined(BZERO) && defined(_STANDALONE) -#include -#endif -#include -#endif - -#define wsize sizeof(u_int) -#define wmask (wsize - 1) - -#ifdef _FORTIFY_SOURCE -#undef bzero -#endif -#undef memset - -#ifndef __OPTIMIZE_SIZE__ -#ifdef BZERO -#define RETURN return -#define VAL 0 -#define WIDEVAL 0 - -void -bzero(void *dst0, size_t length) -#else -#define RETURN return (dst0) -#define VAL c0 -#define WIDEVAL c - -#if defined(__ARM_EABI__) -void __aeabi_memset(void *, size_t, int); -void __aeabi_memclr(void *, size_t); - -__strong_alias(__aeabi_memset4, __aebi_memset) -__strong_alias(__aeabi_memset8, __aebi_memset) - -void -__aeabi_memset(void *dst0, size_t length, int c) -{ - memset(dst0, c, length); -} - -void -__aeabi_memclr(void *dst0, size_t length) -{ - memset(dst0, 0, length); -} -#endif - -void * -memset(void *dst0, int c0, size_t length) -#endif -{ - size_t t; -#ifndef BZERO - u_int c; -#endif - u_char *dst; - - _DIAGASSERT(dst0 != 0); - - dst = dst0; - /* - * If not enough words, just fill bytes. A length >= 2 words - * guarantees that at least one of them is `complete' after - * any necessary alignment. For instance: - * - * |-----------|-----------|-----------| - * |00|01|02|03|04|05|06|07|08|09|0A|00| - * ^---------------------^ - * dst dst+length-1 - * - * but we use a minimum of 3 here since the overhead of the code - * to do word writes is substantial. - */ - if (length < 3 * wsize) { - while (length != 0) { - *dst++ = VAL; - --length; - } - RETURN; - } - -#ifndef BZERO - if ((c = (u_char)c0) != 0) { /* Fill the word. */ - c = (c << 8) | c; /* u_int is 16 bits. */ -#if UINT_MAX > 0xffff - c = (c << 16) | c; /* u_int is 32 bits. */ -#endif -#if UINT_MAX > 0xffffffff - c = (c << 32) | c; /* u_int is 64 bits. */ -#endif - } -#endif - /* Align destination by filling in bytes. */ - if ((t = (size_t)((u_long)dst & wmask)) != 0) { - t = wsize - t; - length -= t; - do { - *dst++ = VAL; - } while (--t != 0); - } - - /* Fill words. Length was >= 2*words so we know t >= 1 here. */ - t = length / wsize; - do { - *(u_int *)(void *)dst = WIDEVAL; - dst += wsize; - } while (--t != 0); - - /* Mop up trailing bytes, if any. */ - t = length & wmask; - if (t != 0) - do { - *dst++ = VAL; - } while (--t != 0); - RETURN; -} -#else /* __OPTIMIZE_SIZE__ */ -#ifdef BZERO -void -bzero(void *dstv, size_t length) -{ - u_char *dst = dstv; - while (length-- > 0) - *dst++ = 0; -} -#else -void * -memset(void *dstv, int c, size_t length) -{ - u_char *dst = dstv; - while (length-- > 0) - *dst++ = c; - return dstv; -} -#endif /* BZERO */ -#endif /* __OPTIMIZE_SIZE__ */ diff --git a/common/lib/libc/string/memset2.c b/common/lib/libc/string/memset2.c deleted file mode 100644 index 13a0407d0..000000000 --- a/common/lib/libc/string/memset2.c +++ /dev/null @@ -1,276 +0,0 @@ -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: memset2.c,v 1.5 2012/03/02 16:22:27 apb Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#include -#else -#include -#include -#endif - -#include -#include - -#ifdef TEST -#include -#define _DIAGASSERT(a) assert(a) -#endif - -#ifdef _FORTIFY_SOURCE -#undef bzero -#endif -#undef memset - -/* - * Assume uregister_t is the widest non-synthetic unsigned type. - */ -typedef uregister_t memword_t; - -__CTASSERT((~(memword_t)0U >> 1) != ~(memword_t)0U); - -#ifdef BZERO -static inline -#define memset memset0 -#endif - -#ifdef TEST -static -#define memset test_memset -#endif - -void * -memset(void *addr, int c, size_t len) -{ - memword_t *dstp = addr; - memword_t *edstp; - memword_t fill; -#ifndef __OPTIMIZE_SIZE__ - memword_t keep_mask = 0; -#endif - size_t fill_count; - - _DIAGASSERT(addr != 0); - - if (__predict_false(len == 0)) - return addr; - - /* - * Pad out the fill byte (v) across a memword_t. - * The conditional at the end prevents GCC from complaing about - * shift count >= width of type - */ - fill = c; - fill |= fill << 8; - fill |= fill << 16; - fill |= fill << (sizeof(c) < sizeof(fill) ? 32 : 0); - - /* - * Get the number of unaligned bytes to fill in the first word. - */ - fill_count = -(uintptr_t)addr & (sizeof(memword_t) - 1); - - if (__predict_false(fill_count != 0)) { -#ifndef __OPTIMIZE_SIZE__ - /* - * We want to clear trailing bytes in the word. - * On big/little endian, these are the least/most significant, - * bits respectively. So as we shift, the keep_mask will only - * have bits set for the bytes we won't be filling. - */ -#if BYTE_ORDER == BIG_ENDIAN - keep_mask = ~(memword_t)0U << (fill_count * 8); -#endif -#if BYTE_ORDER == LITTLE_ENDIAN - keep_mask = ~(memword_t)0U >> (fill_count * 8); -#endif - /* - * Make sure dstp is aligned to a memword_t boundary. - */ - dstp = (memword_t *)((uintptr_t)addr & -sizeof(memword_t)); - if (len >= fill_count) { - /* - * If we can fill the rest of this word, then we mask - * off the bytes we are filling and then fill in those - * bytes with the new fill value. - */ - *dstp = (*dstp & keep_mask) | (fill & ~keep_mask); - len -= fill_count; - if (__predict_false(len == 0)) - return addr; - /* - * Since we were able to fill the rest of this word, - * we will advance to the next word and thus have no - * bytes to preserve. - * - * If we don't have enough to fill the rest of this - * word, we will fall through the following loop - * (since there are no full words to fill). Then we - * use the keep_mask above to preserve the leading - * bytes of word. - */ - dstp++; - keep_mask = 0; - } else { - len += (uintptr_t)addr & (sizeof(memword_t) - 1); - } -#else /* __OPTIMIZE_SIZE__ */ - uint8_t *dp, *ep; - if (len < fill_count) - fill_count = len; - for (dp = (uint8_t *)dstp, ep = dp + fill_count; - dp != ep; dp++) - *dp = fill; - if ((len -= fill_count) == 0) - return addr; - dstp = (memword_t *)ep; -#endif /* __OPTIMIZE_SIZE__ */ - } - - /* - * Simply fill memory one word at time (for as many full words we have - * to write). - */ - for (edstp = dstp + len / sizeof(memword_t); dstp != edstp; dstp++) - *dstp = fill; - - /* - * We didn't subtract out the full words we just filled since we know - * by the time we get here we will have less than a words worth to - * write. So we can concern ourselves with only the subword len bits. - */ - len &= sizeof(memword_t)-1; - if (len > 0) { -#ifndef __OPTIMIZE_SIZE__ - /* - * We want to clear leading bytes in the word. - * On big/little endian, these are the most/least significant - * bits, respectively, But as we want the mask of the bytes to - * keep, we have to complement the mask. So after we shift, - * the keep_mask will only have bits set for the bytes we won't - * be filling. - * - * But the keep_mask could already have bytes to preserve - * if the amount to fill was less than the amount of traiing - * space in the first word. - */ -#if BYTE_ORDER == BIG_ENDIAN - keep_mask |= ~(memword_t)0U >> (len * 8); -#endif -#if BYTE_ORDER == LITTLE_ENDIAN - keep_mask |= ~(memword_t)0U << (len * 8); -#endif - /* - * Now we mask off the bytes we are filling and then fill in - * those bytes with the new fill value. - */ - *dstp = (*dstp & keep_mask) | (fill & ~keep_mask); -#else /* __OPTIMIZE_SIZE__ */ - uint8_t *dp, *ep; - for (dp = (uint8_t *)dstp, ep = dp + len; - dp != ep; dp++) - *dp = fill; -#endif /* __OPTIMIZE_SIZE__ */ - } - - /* - * Return the initial addr - */ - return addr; -} - -#ifdef BZERO -/* - * For bzero, simply inline memset and let the compiler optimize things away. - */ -void -bzero(void *addr, size_t len) -{ - memset(addr, 0, len); -} -#endif - -#ifdef TEST -#include -#include - -#undef memset - -static union { - uint8_t bytes[sizeof(memword_t) * 4]; - memword_t words[4]; -} testmem; - -int -main(int argc, char **argv) -{ - size_t start; - size_t len; - bool failed = false; - - for (start = 1; start < sizeof(testmem) - 1; start++) { - for (len = 1; start + len < sizeof(testmem) - 1; len++) { - bool ok = true; - size_t i; - uint8_t check_value; - memset(testmem.bytes, 0xff, sizeof(testmem)); - test_memset(testmem.bytes + start, 0x00, len); - for (i = 0; i < sizeof(testmem); i++) { - if (i == 0 || i == start + len) - check_value = 0xff; - else if (i == start) - check_value = 0x00; - if (testmem.bytes[i] != check_value) { - if (ok) - printf("pass @ %zu .. %zu failed", - start, start + len - 1); - ok = false; - printf(" [%zu]=0x%02x(!0x%02x)", - i, testmem.bytes[i], check_value); - } - } - if (!ok) { - printf("\n"); - failed = 1; - } - } - } - - return failed ? 1 : 0; -} -#endif /* TEST */ diff --git a/common/lib/libc/string/popcount32.c b/common/lib/libc/string/popcount32.c deleted file mode 100644 index b23b4da1a..000000000 --- a/common/lib/libc/string/popcount32.c +++ /dev/null @@ -1,82 +0,0 @@ -/* $NetBSD: popcount32.c,v 1.5 2015/05/29 19:39:41 matt Exp $ */ -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: popcount32.c,v 1.5 2015/05/29 19:39:41 matt Exp $"); - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#else -#include -#include -#endif - -#ifndef popcount32 // might be a builtin - -/* - * This a hybrid algorithm for bit counting between parallel counting and - * using multiplication. The idea is to sum up the bits in each Byte, so - * that the final accumulation can be done with a single multiplication. - * If the platform has a slow multiplication instruction, it can be replaced - * by the commented out version below. - */ - -unsigned int -popcount32(uint32_t v) -{ - unsigned int c; - - v = v - ((v >> 1) & 0x55555555U); - v = (v & 0x33333333U) + ((v >> 2) & 0x33333333U); - v = (v + (v >> 4)) & 0x0f0f0f0fU; - c = (v * 0x01010101U) >> 24; - /* - * v = (v >> 16) + v; - * v = (v >> 8) + v; - * c = v & 255; - */ - - return c; -} - -#if UINT_MAX == 0xffffffffU -__strong_alias(popcount, popcount32) -#endif - -#if ULONG_MAX == 0xffffffffU -__strong_alias(popcountl, popcount32) -#endif - -#endif /* !popcount32 */ diff --git a/common/lib/libc/string/popcount64.c b/common/lib/libc/string/popcount64.c deleted file mode 100644 index 4617e259d..000000000 --- a/common/lib/libc/string/popcount64.c +++ /dev/null @@ -1,92 +0,0 @@ -/* $NetBSD: popcount64.c,v 1.8 2015/05/29 19:39:41 matt Exp $ */ -/*- - * Copyright (c) 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Joerg Sonnenberger. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: popcount64.c,v 1.8 2015/05/29 19:39:41 matt Exp $"); - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#else -#include -#include -#endif - -#ifndef popcount64 // might be defined to use a __builtin - -/* - * If uint64_t is larger than size_t, the follow assumes that - * splitting into 32bit halves is faster. - * - * The native pocount64 version is based on the same ideas as popcount32(3), - * see popcount32.c for comments. - */ - -#if SIZE_MAX < 0xffffffffffffffffULL -unsigned int -popcount64(uint64_t v) -{ - return popcount32((uint32_t)(v >> 32)) + - popcount32((uint32_t)(v & 0xffffffffULL)); -} -#else -unsigned int -popcount64(uint64_t v) -{ - unsigned int c; - - v = v - ((v >> 1) & (uint64_t)0x5555555555555555ULL); - v = (v & (uint64_t)0x3333333333333333ULL) + - ((v >> 2) & (uint64_t)0x3333333333333333ULL); - v = ((v + (v >> 4)) & (uint64_t)0x0f0f0f0f0f0f0f0fULL) * - (uint64_t)0x0101010101010101ULL; - c = (unsigned int)(v >> 56); - - return c; -} -#endif - -#if ULONG_MAX == 0xffffffffffffffffULL -__strong_alias(popcountl, popcount64) -#endif - -#if ULLONG_MAX == 0xffffffffffffffffULL -__strong_alias(popcountll, popcount64) -#endif - -#if defined(__minix) -__strong_alias(popcountti2, popcount64) -#endif /* defined(__minix) */ - -#endif /* !popcount64 */ diff --git a/common/lib/libc/string/strcasecmp.c b/common/lib/libc/string/strcasecmp.c deleted file mode 100644 index ad4e78ee7..000000000 --- a/common/lib/libc/string/strcasecmp.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: strcasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */ - -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strcasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include "namespace.h" -#include -#include -#include -#ifdef __weak_alias -__weak_alias(strcasecmp,_strcasecmp) -__weak_alias(strncasecmp,_strncasecmp) -#endif -#else -#include -#include -#endif - -int -strcasecmp(const char *s1, const char *s2) -{ - const unsigned char *us1 = (const unsigned char *)s1, - *us2 = (const unsigned char *)s2; - - _DIAGASSERT(s1 != NULL); - _DIAGASSERT(s2 != NULL); - - while (tolower(*us1) == tolower(*us2++)) - if (*us1++ == '\0') - return (0); - return (tolower(*us1) - tolower(*--us2)); -} diff --git a/common/lib/libc/string/strcat.c b/common/lib/libc/string/strcat.c deleted file mode 100644 index 0d83d4562..000000000 --- a/common/lib/libc/string/strcat.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: strcat.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */ - -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strcat.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strcat.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -#ifdef _FORTIFY_SOURCE -#undef strcat -#endif - -char * -strcat(char *s, const char *append) -{ - char *t = s; - - _DIAGASSERT(t != NULL); - _DIAGASSERT(append != NULL); - - for (; *t; ++t) - ; - while ((*t++ = *append++) != '\0') - ; - return (s); -} diff --git a/common/lib/libc/string/strchr.c b/common/lib/libc/string/strchr.c deleted file mode 100644 index 2e01b1b34..000000000 --- a/common/lib/libc/string/strchr.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: strchr.c,v 1.5 2011/08/31 15:48:32 plunky Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)index.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strchr.c,v 1.5 2011/08/31 15:48:32 plunky Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include "namespace.h" -#include -#include -#else -#include -#endif - -__strong_alias(index, strchr) -char * -strchr(const char *p, int ch) -{ - const char cmp = ch; - _DIAGASSERT(p != NULL); - - for (;; ++p) { - if (*p == cmp) { - /* LINTED const cast-away */ - return(__UNCONST(p)); - } - if (!*p) - return(NULL); - } - /* NOTREACHED */ -} diff --git a/common/lib/libc/string/strcmp.c b/common/lib/libc/string/strcmp.c deleted file mode 100644 index 4105de552..000000000 --- a/common/lib/libc/string/strcmp.c +++ /dev/null @@ -1,67 +0,0 @@ -/* $NetBSD: strcmp.c,v 1.3 2013/07/01 20:51:59 joerg Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strcmp.c,v 1.3 2013/07/01 20:51:59 joerg Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -#undef strcmp - -/* - * Compare strings. - */ -int -strcmp(const char *s1, const char *s2) -{ - - _DIAGASSERT(s1 != NULL); - _DIAGASSERT(s2 != NULL); - - while (*s1 == *s2++) - if (*s1++ == 0) - return (0); - return (*(const unsigned char *)s1 - *(const unsigned char *)--s2); -} diff --git a/common/lib/libc/string/strcpy.c b/common/lib/libc/string/strcpy.c deleted file mode 100644 index 3a3d2fb54..000000000 --- a/common/lib/libc/string/strcpy.c +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: strcpy.c,v 1.3 2011/11/08 16:52:11 joerg Exp $ */ - -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strcpy.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strcpy.c,v 1.3 2011/11/08 16:52:11 joerg Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -#undef strcpy - -char * -strcpy(char *to, const char *from) -{ - char *save = to; - - _DIAGASSERT(to != NULL); - _DIAGASSERT(from != NULL); - - for (; (*to = *from) != '\0'; ++from, ++to); - return(save); -} diff --git a/common/lib/libc/string/strcspn.c b/common/lib/libc/string/strcspn.c deleted file mode 100644 index eb11edec8..000000000 --- a/common/lib/libc/string/strcspn.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $NetBSD: strcspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $ */ - -/*- - * Copyright (c) 2008 Joerg Sonnenberger - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: strcspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $"); - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#include -#else -#include -#endif - -/* 64bit version is in strspn.c */ -#if ULONG_MAX != 0xffffffffffffffffull - -size_t -strcspn(const char *s, const char *charset) -{ - static const uint8_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; - const char *t; - uint8_t set[32]; -#define UC(a) ((unsigned int)(unsigned char)(a)) - - _DIAGASSERT(s != NULL); - _DIAGASSERT(charset != NULL); - - if (charset[0] == '\0') - return strlen(s); - if (charset[1] == '\0') { - for (t = s; *t != '\0'; ++t) - if (*t == *charset) - break; - return t - s; - } - - (void)memset(set, 0, sizeof(set)); - - for (; *charset != '\0'; ++charset) - set[UC(*charset) >> 3] |= idx[UC(*charset) & 7]; - - for (t = s; *t != '\0'; ++t) - if (set[UC(*t) >> 3] & idx[UC(*t) & 7]) - break; - return t - s; -} - -#endif diff --git a/common/lib/libc/string/strlcat.c b/common/lib/libc/string/strlcat.c deleted file mode 100644 index 909dc9b29..000000000 --- a/common/lib/libc/string/strlcat.c +++ /dev/null @@ -1,101 +0,0 @@ -/* $NetBSD: strlcat.c,v 1.4 2013/01/23 07:57:27 matt Exp $ */ -/* $OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE - * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strlcat.c,v 1.4 2013/01/23 07:57:27 matt Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#ifdef _LIBC -#include "namespace.h" -#endif -#include -#include -#include - -#ifdef _LIBC -# ifdef __weak_alias -__weak_alias(strlcat, _strlcat) -# endif -#endif - -#else -#include -#endif /* !_KERNEL && !_STANDALONE */ - -#if !HAVE_STRLCAT -/* - * Appends src to string dst of size siz (unlike strncat, siz is the - * full size of dst, not space left). At most siz-1 characters - * will be copied. Always NUL terminates (unless siz <= strlen(dst)). - * Returns strlen(src) + MIN(siz, strlen(initial dst)). - * If retval >= siz, truncation occurred. - */ -size_t -strlcat(char *dst, const char *src, size_t siz) -{ -#if 1 - char *d = dst; - const char *s = src; - size_t n = siz; - size_t dlen; - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - - /* Find the end of dst and adjust bytes left but don't go past end */ - while (n-- != 0 && *d != '\0') - d++; - dlen = d - dst; - n = siz - dlen; - - if (n == 0) - return(dlen + strlen(s)); - while (*s != '\0') { - if (n != 1) { - *d++ = *s; - n--; - } - s++; - } - *d = '\0'; - - return(dlen + (s - src)); /* count does not include NUL */ -#else - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - - /* - * Find length of string in dst (maxing out at siz). - */ - size_t dlen = strnlen(dst, siz); - - /* - * Copy src into any remaining space in dst (truncating if needed). - * Note strlcpy(dst, src, 0) returns strlen(src). - */ - return dlen + strlcpy(dst + dlen, src, siz - dlen); -#endif -} -#endif diff --git a/common/lib/libc/string/strlcpy.c b/common/lib/libc/string/strlcpy.c deleted file mode 100644 index fbb5f4dd2..000000000 --- a/common/lib/libc/string/strlcpy.c +++ /dev/null @@ -1,81 +0,0 @@ -/* $NetBSD: strlcpy.c,v 1.3 2007/06/04 18:19:27 christos Exp $ */ -/* $OpenBSD: strlcpy.c,v 1.7 2003/04/12 21:56:39 millert Exp $ */ - -/* - * Copyright (c) 1998 Todd C. Miller - * - * Permission to use, copy, modify, and distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. - * - * THE SOFTWARE IS PROVIDED "AS IS" AND TODD C. MILLER DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL TODD C. MILLER BE LIABLE - * FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strlcpy.c,v 1.3 2007/06/04 18:19:27 christos Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#ifdef _LIBC -#include "namespace.h" -#endif -#include -#include -#include - -#ifdef _LIBC -# ifdef __weak_alias -__weak_alias(strlcpy, _strlcpy) -# endif -#endif -#else -#include -#endif /* !_KERNEL && !_STANDALONE */ - - -#if !HAVE_STRLCPY -/* - * Copy src to string dst of size siz. At most siz-1 characters - * will be copied. Always NUL terminates (unless siz == 0). - * Returns strlen(src); if retval >= siz, truncation occurred. - */ -size_t -strlcpy(char *dst, const char *src, size_t siz) -{ - char *d = dst; - const char *s = src; - size_t n = siz; - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - - /* Copy as many bytes as will fit */ - if (n != 0 && --n != 0) { - do { - if ((*d++ = *s++) == 0) - break; - } while (--n != 0); - } - - /* Not enough room in dst, add NUL and traverse rest of src */ - if (n == 0) { - if (siz != 0) - *d = '\0'; /* NUL-terminate dst */ - while (*s++) - ; - } - - return(s - src - 1); /* count does not include NUL */ -} -#endif diff --git a/common/lib/libc/string/strlen.c b/common/lib/libc/string/strlen.c deleted file mode 100644 index 84195a3fa..000000000 --- a/common/lib/libc/string/strlen.c +++ /dev/null @@ -1,58 +0,0 @@ -/* $NetBSD: strlen.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strlen.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strlen.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -size_t -strlen(const char *str) -{ - const char *s; - - _DIAGASSERT(str != NULL); - - for (s = str; *s; ++s) - continue; - return(s - str); -} diff --git a/common/lib/libc/string/strncasecmp.c b/common/lib/libc/string/strncasecmp.c deleted file mode 100644 index e58a5daf1..000000000 --- a/common/lib/libc/string/strncasecmp.c +++ /dev/null @@ -1,74 +0,0 @@ -/* $NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */ - -/* - * Copyright (c) 1987, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strncasecmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include "namespace.h" -#include -#include -#include -#ifdef __weak_alias -__weak_alias(strcasecmp,_strcasecmp) -__weak_alias(strncasecmp,_strncasecmp) -#endif -#else -#include -#include -#endif - -int -strncasecmp(const char *s1, const char *s2, size_t n) -{ - - _DIAGASSERT(s1 != NULL); - _DIAGASSERT(s2 != NULL); - - if (n != 0) { - const unsigned char *us1 = (const unsigned char *)s1, - *us2 = (const unsigned char *)s2; - - do { - if (tolower(*us1) != tolower(*us2++)) - return (tolower(*us1) - tolower(*--us2)); - if (*us1++ == '\0') - break; - } while (--n != 0); - } - return (0); -} diff --git a/common/lib/libc/string/strncat.c b/common/lib/libc/string/strncat.c deleted file mode 100644 index f0de7e370..000000000 --- a/common/lib/libc/string/strncat.c +++ /dev/null @@ -1,80 +0,0 @@ -/* $NetBSD: strncat.c,v 1.2 2013/12/27 20:26:53 christos Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strncat.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strncat.c,v 1.2 2013/12/27 20:26:53 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -#ifdef _FORTIFY_SOURCE -#undef strncat -#endif - -/* - * Concatenate src on the end of dst. At most strlen(dst)+n+1 bytes - * are written at dst (at most n+1 bytes being appended). Return dst. - */ -char * -strncat(char *dst, const char *src, size_t n) -{ - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - - if (n != 0) { - char *d = dst; - const char *s = src; - - while (*d != 0) - d++; - do { - if ((*d = *s++) == 0) - break; - d++; - } while (--n != 0); - *d = 0; - } - return (dst); -} diff --git a/common/lib/libc/string/strncmp.c b/common/lib/libc/string/strncmp.c deleted file mode 100644 index 105e9149c..000000000 --- a/common/lib/libc/string/strncmp.c +++ /dev/null @@ -1,65 +0,0 @@ -/* $NetBSD: strncmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $ */ - -/* - * Copyright (c) 1989, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strncmp.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strncmp.c,v 1.2 2007/06/04 18:19:27 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -int -strncmp(const char *s1, const char *s2, size_t n) -{ - - _DIAGASSERT(s1 != NULL); - _DIAGASSERT(s2 != NULL); - - if (n == 0) - return (0); - do { - if (*s1 != *s2++) - return (*(const unsigned char *)s1 - - *(const unsigned char *)--s2); - if (*s1++ == 0) - break; - } while (--n != 0); - return (0); -} diff --git a/common/lib/libc/string/strncpy.c b/common/lib/libc/string/strncpy.c deleted file mode 100644 index afed6c039..000000000 --- a/common/lib/libc/string/strncpy.c +++ /dev/null @@ -1,80 +0,0 @@ -/* $NetBSD: strncpy.c,v 1.3 2007/06/04 18:19:28 christos Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strncpy.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strncpy.c,v 1.3 2007/06/04 18:19:28 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -#ifdef _FORTIFY_SOURCE -#undef strncpy -#endif - -/* - * Copy src to dst, truncating or null-padding to always copy n bytes. - * Return dst. - */ -char * -strncpy(char *dst, const char *src, size_t n) -{ - - _DIAGASSERT(dst != NULL); - _DIAGASSERT(src != NULL); - - if (n != 0) { - char *d = dst; - const char *s = src; - - do { - if ((*d++ = *s++) == 0) { - /* NUL pad the remaining n-1 bytes */ - while (--n != 0) - *d++ = 0; - break; - } - } while (--n != 0); - } - return (dst); -} diff --git a/common/lib/libc/string/strnlen.c b/common/lib/libc/string/strnlen.c deleted file mode 100644 index e7e18e613..000000000 --- a/common/lib/libc/string/strnlen.c +++ /dev/null @@ -1,57 +0,0 @@ -/* $NetBSD: strnlen.c,v 1.2 2014/01/09 11:25:11 apb Exp $ */ - -/*- - * Copyright (c) 2009 David Schultz - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: strnlen.c,v 1.2 2014/01/09 11:25:11 apb Exp $"); -#endif /* LIBC_SCCS and not lint */ -/* FreeBSD: src/lib/libc/string/strnlen.c,v 1.1 2009/02/28 06:00:58 das Exp */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#else -#include -#endif - -#if !HAVE_STRNLEN -size_t -strnlen(const char *s, size_t maxlen) -{ - size_t len; - - for (len = 0; len < maxlen; len++, s++) { - if (!*s) - break; - } - return (len); -} -#endif /* !HAVE_STRNLEN */ diff --git a/common/lib/libc/string/strpbrk.c b/common/lib/libc/string/strpbrk.c deleted file mode 100644 index c0531c4b0..000000000 --- a/common/lib/libc/string/strpbrk.c +++ /dev/null @@ -1,79 +0,0 @@ -/* $NetBSD: strpbrk.c,v 1.1 2014/07/19 18:38:33 lneto Exp $ */ - -/*- - * Copyright (c) 2008 Joerg Sonnenberger - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: strpbrk.c,v 1.1 2014/07/19 18:38:33 lneto Exp $"); - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#include -#else -#include -#endif - -#define FAST_STRPBRK 1 -#define UC(a) ((unsigned int)(unsigned char)(a)) - -#ifdef FAST_STRPBRK -#define ADD_NEW_TO_SET(i) (set[inv[i] = idx++] = (i)) -#define IS_IN_SET(i) (inv[i] < idx && set[inv[i]] == (i)) -#define ADD_TO_SET(i) (void)(IS_IN_SET(i) || /*LINTED no effect*/ADD_NEW_TO_SET(i)) -#else -#define IS_IN_SET(i) (set[(i) >> 3] & idx[(i) & 7]) -#define ADD_TO_SET(i) (void)(set[(i) >> 3] |= idx[(i) & 7]) -#endif - -char * -strpbrk(const char *s, const char *charset) -{ -#ifdef FAST_STRPBRK - uint8_t set[256], inv[256], idx = 0; -#else - static const size_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; - uint8_t set[32]; - - (void)memset(set, 0, sizeof(set)); -#endif - - _DIAGASSERT(s != NULL); - _DIAGASSERT(charset != NULL); - - if (charset[0] == '\0') - return NULL; - if (charset[1] == '\0') - return strchr(s, charset[0]); - - for (; *charset != '\0'; ++charset) - ADD_TO_SET(UC(*charset)); - - for (; *s != '\0'; ++s) - if (IS_IN_SET(UC(*s))) - return __UNCONST(s); - return NULL; -} diff --git a/common/lib/libc/string/strrchr.c b/common/lib/libc/string/strrchr.c deleted file mode 100644 index c3ddb6452..000000000 --- a/common/lib/libc/string/strrchr.c +++ /dev/null @@ -1,66 +0,0 @@ -/* $NetBSD: strrchr.c,v 1.5 2009/07/17 19:37:57 dsl Exp $ */ - -/* - * Copyright (c) 1988, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)rindex.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strrchr.c,v 1.5 2009/07/17 19:37:57 dsl Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#endif - -__strong_alias(rindex, strrchr) -char * -strrchr(const char *p, int ch) -{ - char *save; - const char c = ch; - - _DIAGASSERT(p != NULL); - - for (save = NULL;; ++p) { - if (*p == c) { - /* LINTED const cast-away */ - save = __UNCONST(p); - } - if (!*p) - return(save); - } - /* NOTREACHED */ -} diff --git a/common/lib/libc/string/strsep.c b/common/lib/libc/string/strsep.c deleted file mode 100644 index 7972b32e6..000000000 --- a/common/lib/libc/string/strsep.c +++ /dev/null @@ -1,97 +0,0 @@ -/* $NetBSD: strsep.c,v 1.3 2007/06/04 18:19:28 christos Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strsep.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strsep.c,v 1.3 2007/06/04 18:19:28 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include "namespace.h" - -#include -#include - -#ifdef __weak_alias -__weak_alias(strsep,_strsep) -#endif - -#else -#include -#include -#endif /* !_KERNEL && !_STANDALONE */ - -#if !HAVE_STRSEP -/* - * Get next token from string *stringp, where tokens are possibly-empty - * strings separated by characters from delim. - * - * Writes NULs into the string at *stringp to end tokens. - * delim need not remain constant from call to call. - * On return, *stringp points past the last NUL written (if there might - * be further tokens), or is NULL (if there are definitely no more tokens). - * - * If *stringp is NULL, strsep returns NULL. - */ -char * -strsep(char **stringp, const char *delim) -{ - char *s; - const char *spanp; - int c, sc; - char *tok; - - _DIAGASSERT(stringp != NULL); - _DIAGASSERT(delim != NULL); - - if ((s = *stringp) == NULL) - return (NULL); - for (tok = s;;) { - c = *s++; - spanp = delim; - do { - if ((sc = *spanp++) == c) { - if (c == 0) - s = NULL; - else - s[-1] = 0; - *stringp = s; - return (tok); - } - } while (sc != 0); - } - /* NOTREACHED */ -} -#endif diff --git a/common/lib/libc/string/strspn.c b/common/lib/libc/string/strspn.c deleted file mode 100644 index fc6c7e79f..000000000 --- a/common/lib/libc/string/strspn.c +++ /dev/null @@ -1,155 +0,0 @@ -/* $NetBSD: strspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $ */ - -/*- - * Copyright (c) 2008 Joerg Sonnenberger - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include -__RCSID("$NetBSD: strspn.c,v 1.1 2014/07/19 18:38:33 lneto Exp $"); - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#include -#else -#include -#endif - -#if ULONG_MAX != 0xffffffffffffffffull - -size_t -strspn(const char *s, const char *charset) -{ - static const uint8_t idx[8] = { 1, 2, 4, 8, 16, 32, 64, 128 }; - uint8_t set[32]; - const char *t; -#define UC(a) ((unsigned int)(unsigned char)(a)) - - _DIAGASSERT(s != NULL); - _DIAGASSERT(charset != NULL); - - if (charset[0] == '\0') - return 0; - if (charset[1] == '\0') { - for (t = s; *t != '\0'; ++t) { - if (*t != *charset) - break; - } - return t - s; - } - - (void)memset(set, 0, sizeof(set)); - - for (; *charset != '\0'; ++charset) - set[UC(*charset) >> 3] |= idx[UC(*charset) & 7]; - - for (t = s; *t != '\0'; ++t) - if ((set[UC(*t) >> 3] & idx[UC(*t) & 7]) == 0) - break; - return t - s; -} - -#else - -/* 64 bit system, use four 64 bits registers for bitmask */ - -static size_t -strspn_x(const char *s_s, const char *charset_s, unsigned long invert) -{ - const unsigned char *s = (const unsigned char *)s_s; - const unsigned char *charset = (const unsigned char *)charset_s; - unsigned long m_0, m_4, m_8, m_c; - unsigned char ch, next_ch; - unsigned long bit; - unsigned long check; - size_t count; - - /* Four 64bit registers have one bit for each character value */ - m_0 = 0; - m_4 = 0; - m_8 = 0; - m_c = 0; - - for (ch = *charset; ch != 0; ch = next_ch) { - next_ch = *++charset; - bit = 1ul << (ch & 0x3f); - if (__predict_true(ch < 0x80)) { - if (ch < 0x40) - m_0 |= bit; - else - m_4 |= bit; - } else { - if (ch < 0xc0) - m_8 |= bit; - else - m_c |= bit; - } - } - - /* For strcspn() we just invert the validity set */ - m_0 ^= invert; - m_4 ^= invert; - m_8 ^= invert; - m_c ^= invert; - - /* - * We could do remove the lsb from m_0 to terminate at the - * end of the input string. - * However prefetching the next char is benifitial and we must - * not read the byte after the \0 - as it might fault! - * So we take the 'hit' of the compare against 0. - */ - - ch = *s++; - for (count = 0; ch != 0; ch = next_ch) { - next_ch = s[count]; - if (__predict_true(ch < 0x80)) { - check = m_0; - if (ch >= 0x40) - check = m_4; - } else { - check = m_8; - if (ch >= 0xc0) - check = m_c; - } - if (!((check >> (ch & 0x3f)) & 1)) - break; - count++; - } - return count; -} - -size_t -strspn(const char *s, const char *charset) -{ - return strspn_x(s, charset, 0); -} - -size_t -strcspn(const char *s, const char *charset) -{ - return strspn_x(s, charset, ~0ul); -} -#endif diff --git a/common/lib/libc/string/strstr.c b/common/lib/libc/string/strstr.c deleted file mode 100644 index c2fa47d3e..000000000 --- a/common/lib/libc/string/strstr.c +++ /dev/null @@ -1,75 +0,0 @@ -/* $NetBSD: strstr.c,v 1.2 2007/06/04 18:19:28 christos Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#if defined(LIBC_SCCS) && !defined(lint) -#if 0 -static char sccsid[] = "@(#)strstr.c 8.1 (Berkeley) 6/4/93"; -#else -__RCSID("$NetBSD: strstr.c,v 1.2 2007/06/04 18:19:28 christos Exp $"); -#endif -#endif /* LIBC_SCCS and not lint */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#else -#include -#include -#endif - -/* - * Find the first occurrence of find in s. - */ -char * -strstr(const char *s, const char *find) -{ - char c, sc; - size_t len; - - _DIAGASSERT(s != NULL); - _DIAGASSERT(find != NULL); - - if ((c = *find++) != 0) { - len = strlen(find); - do { - do { - if ((sc = *s++) == 0) - return (NULL); - } while (sc != c); - } while (strncmp(s, find, len) != 0); - s--; - } - return __UNCONST(s); -} diff --git a/common/lib/libc/sys/cpuset.c b/common/lib/libc/sys/cpuset.c deleted file mode 100644 index c34d48537..000000000 --- a/common/lib/libc/sys/cpuset.c +++ /dev/null @@ -1,153 +0,0 @@ -/* $NetBSD: cpuset.c,v 1.18 2012/03/09 15:41:16 christos Exp $ */ - -/*- - * Copyright (c) 2008 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _STANDALONE -#include -#if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: cpuset.c,v 1.18 2012/03/09 15:41:16 christos Exp $"); -#endif /* LIBC_SCCS and not lint */ - -#include -#include -#ifdef _KERNEL -#include -#include -#include -#else -#include -#include -#include -#include -#endif - -#define CPUSET_SHIFT 5 -#define CPUSET_MASK 31 -#define CPUSET_NENTRIES(nc) ((nc) > 32 ? ((nc) >> CPUSET_SHIFT) : 1) -#ifndef __lint__ -#define CPUSET_SIZE(n) (sizeof( \ - struct { \ - uint32_t bits[0]; \ - }) + sizeof(uint32_t) * (n)) -#else -#define CPUSET_SIZE(n) 0 -#endif - -struct _cpuset { - uint32_t bits[0]; -}; - -#ifndef _KERNEL - -static size_t cpuset_size = 0; -static size_t cpuset_nentries = 0; - -size_t -/*ARGSUSED*/ -_cpuset_size(const cpuset_t *c) -{ - - return cpuset_size; -} - -void -_cpuset_zero(cpuset_t *c) -{ - - memset(c->bits, 0, cpuset_nentries * sizeof(c->bits[0])); -} - -int -_cpuset_isset(cpuid_t i, const cpuset_t *c) -{ - const unsigned long j = i >> CPUSET_SHIFT; - - if (j >= cpuset_nentries) { - errno = EINVAL; - return -1; - } - return ((1 << (unsigned int)(i & CPUSET_MASK)) & c->bits[j]) != 0; -} - -int -_cpuset_set(cpuid_t i, cpuset_t *c) -{ - const unsigned long j = i >> CPUSET_SHIFT; - - if (j >= cpuset_nentries) { - errno = EINVAL; - return -1; - } - c->bits[j] |= 1 << (unsigned int)(i & CPUSET_MASK); - return 0; -} - -int -_cpuset_clr(cpuid_t i, cpuset_t *c) -{ - const unsigned long j = i >> CPUSET_SHIFT; - - if (j >= cpuset_nentries) { - errno = EINVAL; - return -1; - } - c->bits[j] &= ~(1 << (unsigned int)(i & CPUSET_MASK)); - return 0; -} - -cpuset_t * -_cpuset_create(void) -{ - - if (cpuset_size == 0) { - static int mib[2] = { CTL_HW, HW_NCPU }; - size_t len; - u_int nc; - - len = sizeof(nc); - if (sysctl(mib, (unsigned int)__arraycount(mib), &nc, &len, - NULL, 0) == -1) - return NULL; - - cpuset_nentries = CPUSET_NENTRIES(nc); - cpuset_size = CPUSET_SIZE(cpuset_nentries); - } - return calloc(1, cpuset_size); -} - -void -_cpuset_destroy(cpuset_t *c) -{ - - free(c); -} - -#endif -#endif diff --git a/common/lib/libprop/Makefile.inc b/common/lib/libprop/Makefile.inc deleted file mode 100644 index 2e14639eb..000000000 --- a/common/lib/libprop/Makefile.inc +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.9 2012/07/27 09:10:59 pooka Exp $ - -.PATH: ${.PARSEDIR} - -SRCS+= prop_array.c prop_array_util.c prop_bool.c prop_data.c \ - prop_dictionary.c prop_dictionary_util.c prop_ingest.c \ - prop_kern.c prop_number.c prop_object.c prop_stack.c prop_string.c - -.ifdef (PROPLIB_WANT_RB) -SRCS+= prop_rb.c -.endif diff --git a/common/lib/libprop/prop_array.3 b/common/lib/libprop/prop_array.3 deleted file mode 100644 index 510d62070..000000000 --- a/common/lib/libprop/prop_array.3 +++ /dev/null @@ -1,308 +0,0 @@ -.\" $NetBSD: prop_array.3,v 1.13 2011/09/30 22:08:18 jym Exp $ -.\" -.\" Copyright (c) 2006, 2009 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd October 10, 2009 -.Dt PROP_ARRAY 3 -.Os -.Sh NAME -.Nm prop_array , -.Nm prop_array_create , -.Nm prop_array_create_with_capacity , -.Nm prop_array_copy , -.Nm prop_array_copy_mutable , -.Nm prop_array_capacity , -.Nm prop_array_count , -.Nm prop_array_ensure_capacity , -.Nm prop_array_iterator , -.Nm prop_array_make_immutable , -.Nm prop_array_mutable , -.Nm prop_array_get , -.Nm prop_array_set , -.Nm prop_array_add , -.Nm prop_array_remove , -.Nm prop_array_externalize , -.Nm prop_array_internalize , -.Nm prop_array_externalize_to_file , -.Nm prop_array_internalize_from_file , -.Nm prop_array_externalize_to_pref , -.Nm prop_array_internalize_from_pref , -.Nm prop_array_equals -.Nd array property collection object -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft prop_array_t -.Fn prop_array_create "void" -.Ft prop_array_t -.Fn prop_array_create_with_capacity "unsigned int capacity" -.\" -.Ft prop_array_t -.Fn prop_array_copy "prop_array_t array" -.Ft prop_array_t -.Fn prop_array_copy_mutable "prop_array_t array" -.\" -.Ft unsigned int -.Fn prop_array_capacity "prop_array_t array" -.Ft unsigned int -.Fn prop_array_count "prop_array_t array" -.Ft bool -.Fn prop_array_ensure_capacity "prop_array_t array" "unsigned int capacity" -.\" -.Ft prop_object_iterator_t -.Fn prop_array_iterator "prop_array_t array" -.\" -.Ft void -.Fn prop_array_make_immutable "prop_array_t array" -.Ft bool -.Fn prop_array_mutable "prop_array_t array" -.\" -.Ft prop_object_t -.Fn prop_array_get "prop_array_t array" "unsigned int index" -.Ft bool -.Fn prop_array_set "prop_array_t array" "unsigned int index" "prop_object_t obj" -.Ft bool -.Fn prop_array_add "prop_array_t array" "prop_object_t obj" -.Ft void -.Fn prop_array_remove "prop_array_t array" "unsigned int index" -.\" -.Ft char * -.Fn prop_array_externalize "prop_array_t array" -.Ft prop_array_t -.Fn prop_array_internalize "const char *xml" -.\" -.Ft bool -.Fn prop_array_externalize_to_file "prop_array_t array" "const char *path" -.Ft prop_array_t -.Fn prop_array_internalize_from_file "const char *path" -.\" -.Ft bool -.Fn prop_array_externalize_to_pref "prop_array_t array" "struct plistref *pref" -.Ft bool -.Fn prop_array_internalize_from_pref "const struct plistref *pref" \ - "prop_array_t *arrayp" -.\" -.Ft bool -.Fn prop_array_equals "prop_array_t array1" "prop_array_t array2" -.Sh DESCRIPTION -The -.Nm prop_array -family of functions operate on the array property collection object type. -An array is an ordered set; an iterated array will return objects in the -same order with which they were stored. -.Bl -tag -width "xxxxx" -.It Fn prop_array_create "void" -Create an empty array. -The array initially has no capacity. -Returns -.Dv NULL -on failure. -.It Fn prop_array_create_with_capacity "unsigned int capacity" -Create an array with the capacity to store -.Fa capacity -objects. -Returns -.Dv NULL -on failure. -.It Fn prop_array_copy "prop_array_t array" -Copy an array. -The new array has an initial capacity equal to the number of objects stored -in the array being copied. -The new array contains references to the original array's objects, not -copies of those objects -.Pq i.e. a shallow copy is made . -If the original array is immutable, the resulting array is also immutable. -Returns -.Dv NULL -on failure. -.It Fn prop_array_copy_mutable "prop_array_t array" -Like -.Fn prop_array_copy , -except the resulting array is always mutable. -.It Fn prop_array_capacity "prop_array_t array" -Returns the total capacity of the array, including objects already stored -in the array. -If the supplied object isn't an array, zero is returned. -.It Fn prop_array_count "prop_array_t array" -Returns the number of objects stored in the array. -If the supplied object isn't an array, zero is returned. -.It Fn prop_array_ensure_capacity "prop_array_t array" "unsigned int capacity" -Ensure that the array has a total capacity of -.Fa capacity , -including objects already stored in the array. -Returns -.Dv true -if the capacity of the array is greater or equal to -.Fa capacity -or if expansion of the array's capacity was successful -and -.Dv false -otherwise. -.It Fn prop_array_iterator "prop_array_t array" -Create an iterator for the array. -The array is retained by the iterator. -An array iterator returns the object references stored in the array. -Storing to or removing from the array invalidates any active iterators for -the array. -Returns -.Dv NULL -on failure. -.It Fn prop_array_make_immutable "prop_array_t array" -Make -.Fa array -immutable. -.It Fn prop_array_mutable "prop_array_t array" -Returns -.Dv true -if the array is mutable. -.It Fn prop_array_get "prop_array_t array" "unsigned int index" -Return the object stored at the array index -.Fa index . -Returns -.Dv NULL -on failure. -.It Fn prop_array_set "prop_array_t array" "unsigned int index" \ - "prop_object_t obj" -Store a reference to the object -.Fa obj -at the array index -.Fa index . -This function is not allowed to create holes in the array; -the caller must either be setting the object just beyond the existing -count or replacing an already existing object reference. -The object will be retained by the array. -If an existing object reference is being replaced, that object will be -released. -Returns -.Dv true -if storing the object was successful and -.Dv false -otherwise. -.It Fn prop_array_add "prop_array_t array" "prop_object_t obj" -Add a reference to the object -.Fa obj -to the array, appending to the end and growing the array's capacity if -necessary. -The object will be retained by the array. -Returns -.Dv true -if storing the object was successful and -.Dv false -otherwise. -.Pp -During expansion, array's capacity is augmented by the -.Dv EXPAND_STEP -constant, as defined in -.Pa libprop/prop_array.c -file, e.g. -.Pp -.Dl #define EXPAND_STEP 16 -.It Fn prop_array_remove "prop_array_t array" "unsigned int index" -Remove the reference to the object stored at array index -.Fa index . -The object will be released and the array compacted following -the removal. -.It Fn prop_array_externalize "prop_array_t array" -Externalizes an array, returning a NUL-terminated buffer containing -the XML representation of the array. -The caller is responsible for freeing the returned buffer. -If converting to the external representation fails for any reason, -.Dv NULL -is returned. -.Pp -In user space, the buffer is allocated using -.Xr malloc 3 . -In the kernel, the buffer is allocated using -.Xr malloc 9 -using the malloc type -.Dv M_TEMP . -.It Fn prop_array_internalize "const char *xml" -Parse the XML representation of a property list in the NUL-terminated -buffer -.Fa xml -and return the corresponding array. -Returns -.Dv NULL -if parsing fails for any reason. -.It Fn prop_array_externalize_to_file "prop_array_t array" "const char *path" -Externalizes an array and writes it to the file specified by -.Fa path . -The file is saved with the mode -.Dv 0666 -as modified by the process's file creation mask -.Pq see Xr umask 2 -and is written atomically. -Returns -.Dv false -if externalizing or writing the array fails for any reason. -.It Fn prop_array_internalize_from_file "const char *path" -Reads the XML property list contained in the file specified by -.Fa path , -internalizes it, and returns the corresponding array. -Returns -.Dv NULL -on failure. -.It Fn prop_array_externalize_to_pref "prop_array_t array" \ - "struct plistref *pref" -Externalizes an array and packs it into the plistref specified by -.Fa pref . -Returns -.Dv false -if externalizing the array fails for any reason. -.It Fn prop_array_internalize_from_pref "const struct plistref *pref" \ - "prop_array_t *arrayp" -Reads the plistref specified by -.Fa pref , -internalizes it, and returns the corresponding array. -Returns -.Dv false -if internalizing or writing the array fails for any reason. -.It Fn prop_array_equals "prop_array_t array1" "prop_array_t array2" -Returns -.Dv true -if the two arrays are equivalent. -If at least one of the supplied objects isn't an array, -.Dv false -is returned. -Note: Objects contained in the array are compared by value, not by reference. -.El -.Sh SEE ALSO -.Xr prop_bool 3 , -.Xr prop_data 3 , -.Xr prop_dictionary 3 , -.Xr prop_number 3 , -.Xr prop_object 3 , -.Xr prop_string 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_array.c b/common/lib/libprop/prop_array.c deleted file mode 100644 index c73996fb2..000000000 --- a/common/lib/libprop/prop_array.c +++ /dev/null @@ -1,911 +0,0 @@ -/* $NetBSD: prop_array.c,v 1.21 2012/07/27 09:10:59 pooka Exp $ */ - -/*- - * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "prop_object_impl.h" -#include - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif - -struct _prop_array { - struct _prop_object pa_obj; - _PROP_RWLOCK_DECL(pa_rwlock) - prop_object_t * pa_array; - unsigned int pa_capacity; - unsigned int pa_count; - int pa_flags; - - uint32_t pa_version; -}; - -#define PA_F_IMMUTABLE 0x01 /* array is immutable */ - -_PROP_POOL_INIT(_prop_array_pool, sizeof(struct _prop_array), "proparay") -_PROP_MALLOC_DEFINE(M_PROP_ARRAY, "prop array", - "property array container object") - -static _prop_object_free_rv_t - _prop_array_free(prop_stack_t, prop_object_t *); -static void _prop_array_emergency_free(prop_object_t); -static bool _prop_array_externalize( - struct _prop_object_externalize_context *, - void *); -static _prop_object_equals_rv_t - _prop_array_equals(prop_object_t, prop_object_t, - void **, void **, - prop_object_t *, prop_object_t *); -static void _prop_array_equals_finish(prop_object_t, prop_object_t); -static prop_object_iterator_t - _prop_array_iterator_locked(prop_array_t); -static prop_object_t - _prop_array_iterator_next_object_locked(void *); -static void _prop_array_iterator_reset_locked(void *); - -static const struct _prop_object_type _prop_object_type_array = { - .pot_type = PROP_TYPE_ARRAY, - .pot_free = _prop_array_free, - .pot_emergency_free = _prop_array_emergency_free, - .pot_extern = _prop_array_externalize, - .pot_equals = _prop_array_equals, - .pot_equals_finish = _prop_array_equals_finish, -}; - -#define prop_object_is_array(x) \ - ((x) != NULL && (x)->pa_obj.po_type == &_prop_object_type_array) - -#define prop_array_is_immutable(x) (((x)->pa_flags & PA_F_IMMUTABLE) != 0) - -struct _prop_array_iterator { - struct _prop_object_iterator pai_base; - unsigned int pai_index; -}; - -#define EXPAND_STEP 16 - -static _prop_object_free_rv_t -_prop_array_free(prop_stack_t stack, prop_object_t *obj) -{ - prop_array_t pa = *obj; - prop_object_t po; - - _PROP_ASSERT(pa->pa_count <= pa->pa_capacity); - _PROP_ASSERT((pa->pa_capacity == 0 && pa->pa_array == NULL) || - (pa->pa_capacity != 0 && pa->pa_array != NULL)); - - /* The easy case is an empty array, just free and return. */ - if (pa->pa_count == 0) { - if (pa->pa_array != NULL) - _PROP_FREE(pa->pa_array, M_PROP_ARRAY); - - _PROP_RWLOCK_DESTROY(pa->pa_rwlock); - - _PROP_POOL_PUT(_prop_array_pool, pa); - - return (_PROP_OBJECT_FREE_DONE); - } - - po = pa->pa_array[pa->pa_count - 1]; - _PROP_ASSERT(po != NULL); - - if (stack == NULL) { - /* - * If we are in emergency release mode, - * just let caller recurse down. - */ - *obj = po; - return (_PROP_OBJECT_FREE_FAILED); - } - - /* Otherwise, try to push the current object on the stack. */ - if (!_prop_stack_push(stack, pa, NULL, NULL, NULL)) { - /* Push failed, entering emergency release mode. */ - return (_PROP_OBJECT_FREE_FAILED); - } - /* Object pushed on stack, caller will release it. */ - --pa->pa_count; - *obj = po; - return (_PROP_OBJECT_FREE_RECURSE); -} - -static void -_prop_array_emergency_free(prop_object_t obj) -{ - prop_array_t pa = obj; - - _PROP_ASSERT(pa->pa_count != 0); - --pa->pa_count; -} - -static bool -_prop_array_externalize(struct _prop_object_externalize_context *ctx, - void *v) -{ - prop_array_t pa = v; - struct _prop_object *po; - prop_object_iterator_t pi; - unsigned int i; - bool rv = false; - - _PROP_RWLOCK_RDLOCK(pa->pa_rwlock); - - if (pa->pa_count == 0) { - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - return (_prop_object_externalize_empty_tag(ctx, "array")); - } - - /* XXXJRT Hint "count" for the internalize step? */ - if (_prop_object_externalize_start_tag(ctx, "array") == false || - _prop_object_externalize_append_char(ctx, '\n') == false) - goto out; - - pi = _prop_array_iterator_locked(pa); - if (pi == NULL) - goto out; - - ctx->poec_depth++; - _PROP_ASSERT(ctx->poec_depth != 0); - - while ((po = _prop_array_iterator_next_object_locked(pi)) != NULL) { - if ((*po->po_type->pot_extern)(ctx, po) == false) { - prop_object_iterator_release(pi); - goto out; - } - } - - prop_object_iterator_release(pi); - - ctx->poec_depth--; - for (i = 0; i < ctx->poec_depth; i++) { - if (_prop_object_externalize_append_char(ctx, '\t') == false) - goto out; - } - if (_prop_object_externalize_end_tag(ctx, "array") == false) - goto out; - - rv = true; - - out: - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - return (rv); -} - -/* ARGSUSED */ -static _prop_object_equals_rv_t -_prop_array_equals(prop_object_t v1, prop_object_t v2, - void **stored_pointer1, void **stored_pointer2, - prop_object_t *next_obj1, prop_object_t *next_obj2) -{ - prop_array_t array1 = v1; - prop_array_t array2 = v2; - uintptr_t idx; - _prop_object_equals_rv_t rv = _PROP_OBJECT_EQUALS_FALSE; - - if (array1 == array2) - return (_PROP_OBJECT_EQUALS_TRUE); - - _PROP_ASSERT(*stored_pointer1 == *stored_pointer2); - idx = (uintptr_t)*stored_pointer1; - - /* For the first iteration, lock the objects. */ - if (idx == 0) { - if ((uintptr_t)array1 < (uintptr_t)array2) { - _PROP_RWLOCK_RDLOCK(array1->pa_rwlock); - _PROP_RWLOCK_RDLOCK(array2->pa_rwlock); - } else { - _PROP_RWLOCK_RDLOCK(array2->pa_rwlock); - _PROP_RWLOCK_RDLOCK(array1->pa_rwlock); - } - } - - if (array1->pa_count != array2->pa_count) - goto out; - if (idx == array1->pa_count) { - rv = _PROP_OBJECT_EQUALS_TRUE; - goto out; - } - _PROP_ASSERT(idx < array1->pa_count); - - *stored_pointer1 = (void *)(idx + 1); - *stored_pointer2 = (void *)(idx + 1); - - *next_obj1 = array1->pa_array[idx]; - *next_obj2 = array2->pa_array[idx]; - - return (_PROP_OBJECT_EQUALS_RECURSE); - - out: - _PROP_RWLOCK_UNLOCK(array1->pa_rwlock); - _PROP_RWLOCK_UNLOCK(array2->pa_rwlock); - return (rv); -} - -static void -_prop_array_equals_finish(prop_object_t v1, prop_object_t v2) -{ - _PROP_RWLOCK_UNLOCK(((prop_array_t)v1)->pa_rwlock); - _PROP_RWLOCK_UNLOCK(((prop_array_t)v2)->pa_rwlock); -} - -static prop_array_t -_prop_array_alloc(unsigned int capacity) -{ - prop_array_t pa; - prop_object_t *array; - - if (capacity != 0) { - array = _PROP_CALLOC(capacity * sizeof(prop_object_t), - M_PROP_ARRAY); - if (array == NULL) - return (NULL); - } else - array = NULL; - - pa = _PROP_POOL_GET(_prop_array_pool); - if (pa != NULL) { - _prop_object_init(&pa->pa_obj, &_prop_object_type_array); - pa->pa_obj.po_type = &_prop_object_type_array; - - _PROP_RWLOCK_INIT(pa->pa_rwlock); - pa->pa_array = array; - pa->pa_capacity = capacity; - pa->pa_count = 0; - pa->pa_flags = 0; - - pa->pa_version = 0; - } else if (array != NULL) - _PROP_FREE(array, M_PROP_ARRAY); - - return (pa); -} - -static bool -_prop_array_expand(prop_array_t pa, unsigned int capacity) -{ - prop_object_t *array, *oarray; - - /* - * Array must be WRITE-LOCKED. - */ - - oarray = pa->pa_array; - - array = _PROP_CALLOC(capacity * sizeof(*array), M_PROP_ARRAY); - if (array == NULL) - return (false); - if (oarray != NULL) - memcpy(array, oarray, pa->pa_capacity * sizeof(*array)); - pa->pa_array = array; - pa->pa_capacity = capacity; - - if (oarray != NULL) - _PROP_FREE(oarray, M_PROP_ARRAY); - - return (true); -} - -static prop_object_t -_prop_array_iterator_next_object_locked(void *v) -{ - struct _prop_array_iterator *pai = v; - prop_array_t pa = pai->pai_base.pi_obj; - prop_object_t po = NULL; - - _PROP_ASSERT(prop_object_is_array(pa)); - - if (pa->pa_version != pai->pai_base.pi_version) - goto out; /* array changed during iteration */ - - _PROP_ASSERT(pai->pai_index <= pa->pa_count); - - if (pai->pai_index == pa->pa_count) - goto out; /* we've iterated all objects */ - - po = pa->pa_array[pai->pai_index]; - pai->pai_index++; - - out: - return (po); -} - -static prop_object_t -_prop_array_iterator_next_object(void *v) -{ - struct _prop_array_iterator *pai = v; - prop_array_t pa _PROP_ARG_UNUSED = pai->pai_base.pi_obj; - prop_object_t po; - - _PROP_ASSERT(prop_object_is_array(pa)); - - _PROP_RWLOCK_RDLOCK(pa->pa_rwlock); - po = _prop_array_iterator_next_object_locked(pai); - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - return (po); -} - -static void -_prop_array_iterator_reset_locked(void *v) -{ - struct _prop_array_iterator *pai = v; - prop_array_t pa = pai->pai_base.pi_obj; - - _PROP_ASSERT(prop_object_is_array(pa)); - - pai->pai_index = 0; - pai->pai_base.pi_version = pa->pa_version; -} - -static void -_prop_array_iterator_reset(void *v) -{ - struct _prop_array_iterator *pai = v; - prop_array_t pa _PROP_ARG_UNUSED = pai->pai_base.pi_obj; - - _PROP_ASSERT(prop_object_is_array(pa)); - - _PROP_RWLOCK_RDLOCK(pa->pa_rwlock); - _prop_array_iterator_reset_locked(pai); - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); -} - -/* - * prop_array_create -- - * Create an empty array. - */ -prop_array_t -prop_array_create(void) -{ - - return (_prop_array_alloc(0)); -} - -/* - * prop_array_create_with_capacity -- - * Create an array with the capacity to store N objects. - */ -prop_array_t -prop_array_create_with_capacity(unsigned int capacity) -{ - - return (_prop_array_alloc(capacity)); -} - -/* - * prop_array_copy -- - * Copy an array. The new array has an initial capacity equal to - * the number of objects stored in the original array. The new - * array contains references to the original array's objects, not - * copies of those objects (i.e. a shallow copy). - */ -prop_array_t -prop_array_copy(prop_array_t opa) -{ - prop_array_t pa; - prop_object_t po; - unsigned int idx; - - if (! prop_object_is_array(opa)) - return (NULL); - - _PROP_RWLOCK_RDLOCK(opa->pa_rwlock); - - pa = _prop_array_alloc(opa->pa_count); - if (pa != NULL) { - for (idx = 0; idx < opa->pa_count; idx++) { - po = opa->pa_array[idx]; - prop_object_retain(po); - pa->pa_array[idx] = po; - } - pa->pa_count = opa->pa_count; - pa->pa_flags = opa->pa_flags; - } - _PROP_RWLOCK_UNLOCK(opa->pa_rwlock); - return (pa); -} - -/* - * prop_array_copy_mutable -- - * Like prop_array_copy(), but the resulting array is mutable. - */ -prop_array_t -prop_array_copy_mutable(prop_array_t opa) -{ - prop_array_t pa; - - pa = prop_array_copy(opa); - if (pa != NULL) - pa->pa_flags &= ~PA_F_IMMUTABLE; - - return (pa); -} - -/* - * prop_array_capacity -- - * Return the capacity of the array. - */ -unsigned int -prop_array_capacity(prop_array_t pa) -{ - unsigned int rv; - - if (! prop_object_is_array(pa)) - return (0); - - _PROP_RWLOCK_RDLOCK(pa->pa_rwlock); - rv = pa->pa_capacity; - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - - return (rv); -} - -/* - * prop_array_count -- - * Return the number of objects stored in the array. - */ -unsigned int -prop_array_count(prop_array_t pa) -{ - unsigned int rv; - - if (! prop_object_is_array(pa)) - return (0); - - _PROP_RWLOCK_RDLOCK(pa->pa_rwlock); - rv = pa->pa_count; - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - - return (rv); -} - -/* - * prop_array_ensure_capacity -- - * Ensure that the array has the capacity to store the specified - * total number of objects (inluding the objects already stored - * in the array). - */ -bool -prop_array_ensure_capacity(prop_array_t pa, unsigned int capacity) -{ - bool rv; - - if (! prop_object_is_array(pa)) - return (false); - - _PROP_RWLOCK_WRLOCK(pa->pa_rwlock); - if (capacity > pa->pa_capacity) - rv = _prop_array_expand(pa, capacity); - else - rv = true; - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - - return (rv); -} - -static prop_object_iterator_t -_prop_array_iterator_locked(prop_array_t pa) -{ - struct _prop_array_iterator *pai; - - if (! prop_object_is_array(pa)) - return (NULL); - - pai = _PROP_CALLOC(sizeof(*pai), M_TEMP); - if (pai == NULL) - return (NULL); - pai->pai_base.pi_next_object = _prop_array_iterator_next_object; - pai->pai_base.pi_reset = _prop_array_iterator_reset; - prop_object_retain(pa); - pai->pai_base.pi_obj = pa; - _prop_array_iterator_reset_locked(pai); - - return (&pai->pai_base); -} - -/* - * prop_array_iterator -- - * Return an iterator for the array. The array is retained by - * the iterator. - */ -prop_object_iterator_t -prop_array_iterator(prop_array_t pa) -{ - prop_object_iterator_t pi; - - _PROP_RWLOCK_RDLOCK(pa->pa_rwlock); - pi = _prop_array_iterator_locked(pa); - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - return (pi); -} - -/* - * prop_array_make_immutable -- - * Make the array immutable. - */ -void -prop_array_make_immutable(prop_array_t pa) -{ - - _PROP_RWLOCK_WRLOCK(pa->pa_rwlock); - if (prop_array_is_immutable(pa) == false) - pa->pa_flags |= PA_F_IMMUTABLE; - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); -} - -/* - * prop_array_mutable -- - * Returns true if the array is mutable. - */ -bool -prop_array_mutable(prop_array_t pa) -{ - bool rv; - - _PROP_RWLOCK_RDLOCK(pa->pa_rwlock); - rv = prop_array_is_immutable(pa) == false; - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - - return (rv); -} - -/* - * prop_array_get -- - * Return the object stored at the specified array index. - */ -prop_object_t -prop_array_get(prop_array_t pa, unsigned int idx) -{ - prop_object_t po = NULL; - - if (! prop_object_is_array(pa)) - return (NULL); - - _PROP_RWLOCK_RDLOCK(pa->pa_rwlock); - if (idx >= pa->pa_count) - goto out; - po = pa->pa_array[idx]; - _PROP_ASSERT(po != NULL); - out: - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - return (po); -} - -static bool -_prop_array_add(prop_array_t pa, prop_object_t po) -{ - - /* - * Array must be WRITE-LOCKED. - */ - - _PROP_ASSERT(pa->pa_count <= pa->pa_capacity); - - if (prop_array_is_immutable(pa) || - (pa->pa_count == pa->pa_capacity && - _prop_array_expand(pa, pa->pa_capacity + EXPAND_STEP) == false)) - return (false); - - prop_object_retain(po); - pa->pa_array[pa->pa_count++] = po; - pa->pa_version++; - - return (true); -} - -/* - * prop_array_set -- - * Store a reference to an object at the specified array index. - * This method is not allowed to create holes in the array; the - * caller must either be setting the object just beyond the existing - * count or replacing an already existing object reference. - */ -bool -prop_array_set(prop_array_t pa, unsigned int idx, prop_object_t po) -{ - prop_object_t opo; - bool rv = false; - - if (! prop_object_is_array(pa)) - return (false); - - _PROP_RWLOCK_WRLOCK(pa->pa_rwlock); - - if (prop_array_is_immutable(pa)) - goto out; - - if (idx == pa->pa_count) { - rv = _prop_array_add(pa, po); - goto out; - } - - _PROP_ASSERT(idx < pa->pa_count); - - opo = pa->pa_array[idx]; - _PROP_ASSERT(opo != NULL); - - prop_object_retain(po); - pa->pa_array[idx] = po; - pa->pa_version++; - - prop_object_release(opo); - - rv = true; - - out: - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - return (rv); -} - -/* - * prop_array_add -- - * Add a reference to an object to the specified array, appending - * to the end and growing the array's capacity, if necessary. - */ -bool -prop_array_add(prop_array_t pa, prop_object_t po) -{ - bool rv; - - if (! prop_object_is_array(pa)) - return (false); - - _PROP_RWLOCK_WRLOCK(pa->pa_rwlock); - rv = _prop_array_add(pa, po); - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - - return (rv); -} - -/* - * prop_array_remove -- - * Remove the reference to an object from an array at the specified - * index. The array will be compacted following the removal. - */ -void -prop_array_remove(prop_array_t pa, unsigned int idx) -{ - prop_object_t po; - - if (! prop_object_is_array(pa)) - return; - - _PROP_RWLOCK_WRLOCK(pa->pa_rwlock); - - _PROP_ASSERT(idx < pa->pa_count); - - /* XXX Should this be a _PROP_ASSERT()? */ - if (prop_array_is_immutable(pa)) { - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - return; - } - - po = pa->pa_array[idx]; - _PROP_ASSERT(po != NULL); - - for (++idx; idx < pa->pa_count; idx++) - pa->pa_array[idx - 1] = pa->pa_array[idx]; - pa->pa_count--; - pa->pa_version++; - - _PROP_RWLOCK_UNLOCK(pa->pa_rwlock); - - prop_object_release(po); -} - -/* - * prop_array_equals -- - * Return true if the two arrays are equivalent. Note we do a - * by-value comparison of the objects in the array. - */ -bool -prop_array_equals(prop_array_t array1, prop_array_t array2) -{ - if (!prop_object_is_array(array1) || !prop_object_is_array(array2)) - return (false); - - return (prop_object_equals(array1, array2)); -} - -/* - * prop_array_externalize -- - * Externalize an array, return a NUL-terminated buffer - * containing the XML-style representation. The buffer is allocated - * with the M_TEMP memory type. - */ -char * -prop_array_externalize(prop_array_t pa) -{ - struct _prop_object_externalize_context *ctx; - char *cp; - - ctx = _prop_object_externalize_context_alloc(); - if (ctx == NULL) - return (NULL); - - if (_prop_object_externalize_header(ctx) == false || - (*pa->pa_obj.po_type->pot_extern)(ctx, pa) == false || - _prop_object_externalize_footer(ctx) == false) { - /* We are responsible for releasing the buffer. */ - _PROP_FREE(ctx->poec_buf, M_TEMP); - _prop_object_externalize_context_free(ctx); - return (NULL); - } - - cp = ctx->poec_buf; - _prop_object_externalize_context_free(ctx); - - return (cp); -} - -/* - * _prop_array_internalize -- - * Parse an ... and return the object created from the - * external representation. - */ -static bool _prop_array_internalize_body(prop_stack_t, prop_object_t *, - struct _prop_object_internalize_context *); - -bool -_prop_array_internalize(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx) -{ - /* We don't currently understand any attributes. */ - if (ctx->poic_tagattr != NULL) - return (true); - - *obj = prop_array_create(); - /* - * We are done if the create failed or no child elements exist. - */ - if (*obj == NULL || ctx->poic_is_empty_element) - return (true); - - /* - * Opening tag is found, now continue to the first element. - */ - return (_prop_array_internalize_body(stack, obj, ctx)); -} - -static bool -_prop_array_internalize_continue(prop_stack_t stack, - prop_object_t *obj, - struct _prop_object_internalize_context *ctx, - void *data, prop_object_t child) -{ - prop_array_t array; - - _PROP_ASSERT(data == NULL); - - if (child == NULL) - goto bad; /* Element could not be parsed. */ - - array = *obj; - - if (prop_array_add(array, child) == false) { - prop_object_release(child); - goto bad; - } - prop_object_release(child); - - /* - * Current element is processed and added, look for next. - */ - return (_prop_array_internalize_body(stack, obj, ctx)); - - bad: - prop_object_release(*obj); - *obj = NULL; - return (true); -} - -static bool -_prop_array_internalize_body(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx) -{ - prop_array_t array = *obj; - - _PROP_ASSERT(array != NULL); - - /* Fetch the next tag. */ - if (_prop_object_internalize_find_tag(ctx, NULL, - _PROP_TAG_TYPE_EITHER) == false) - goto bad; - - /* Check to see if this is the end of the array. */ - if (_PROP_TAG_MATCH(ctx, "array") && - ctx->poic_tag_type == _PROP_TAG_TYPE_END) { - /* It is, so don't iterate any further. */ - return (true); - } - - if (_prop_stack_push(stack, array, - _prop_array_internalize_continue, NULL, NULL)) - return (false); - - bad: - prop_object_release(array); - *obj = NULL; - return (true); -} - -/* - * prop_array_internalize -- - * Create an array by parsing the XML-style representation. - */ -prop_array_t -prop_array_internalize(const char *xml) -{ - return _prop_generic_internalize(xml, "array"); -} - -#if !defined(_KERNEL) && !defined(_STANDALONE) -/* - * prop_array_externalize_to_file -- - * Externalize an array to the specified file. - */ -bool -prop_array_externalize_to_file(prop_array_t array, const char *fname) -{ - char *xml; - bool rv; - int save_errno = 0; /* XXXGCC -Wuninitialized [mips, ...] */ - - xml = prop_array_externalize(array); - if (xml == NULL) - return (false); - rv = _prop_object_externalize_write_file(fname, xml, strlen(xml)); - if (rv == false) - save_errno = errno; - _PROP_FREE(xml, M_TEMP); - if (rv == false) - errno = save_errno; - - return (rv); -} - -/* - * prop_array_internalize_from_file -- - * Internalize an array from a file. - */ -prop_array_t -prop_array_internalize_from_file(const char *fname) -{ - struct _prop_object_internalize_mapped_file *mf; - prop_array_t array; - - mf = _prop_object_internalize_map_file(fname); - if (mf == NULL) - return (NULL); - array = prop_array_internalize(mf->poimf_xml); - _prop_object_internalize_unmap_file(mf); - - return (array); -} -#endif /* _KERNEL && !_STANDALONE */ diff --git a/common/lib/libprop/prop_array_util.3 b/common/lib/libprop/prop_array_util.3 deleted file mode 100644 index 89323a577..000000000 --- a/common/lib/libprop/prop_array_util.3 +++ /dev/null @@ -1,228 +0,0 @@ -.\" $NetBSD: prop_array_util.3,v 1.7 2011/10/17 09:24:54 wiz Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd March 12, 2011 -.Dt PROP_ARRAY_UTIL 3 -.Os -.Sh NAME -.Nm prop_array_util , -.Nm prop_array_get_bool , -.Nm prop_array_set_bool , -.Nm prop_array_get_int8 , -.Nm prop_array_get_uint8 , -.Nm prop_array_set_int8 , -.Nm prop_array_set_uint8 , -.Nm prop_array_get_int16 , -.Nm prop_array_get_uint16 , -.Nm prop_array_set_int16 , -.Nm prop_array_set_uint16 , -.Nm prop_array_get_int32 , -.Nm prop_array_get_uint32 , -.Nm prop_array_set_int32 , -.Nm prop_array_set_uint32 , -.Nm prop_array_get_int64 , -.Nm prop_array_get_uint64 , -.Nm prop_array_set_int64 , -.Nm prop_array_set_uint64 , -.Nm prop_array_add_int8 , -.Nm prop_array_add_uint8 , -.Nm prop_array_add_int16 , -.Nm prop_array_add_uint16 , -.Nm prop_array_add_int32 , -.Nm prop_array_add_uint32 , -.Nm prop_array_add_int64 , -.Nm prop_array_add_uint64 , -.Nm prop_array_get_cstring , -.Nm prop_array_set_cstring , -.Nm prop_array_get_cstring_nocopy , -.Nm prop_array_set_cstring_nocopy , -.Nm prop_array_add_and_rel -.Nd array property collection object utility functions -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft bool -.Fn prop_array_get_bool "prop_array_t dict" "unsigned int indx" \ - "bool *valp" -.Ft bool -.Fn prop_array_set_bool "prop_array_t dict" "unsigned int indx" \ - "bool val" -.\" -.Ft bool -.Fn prop_array_get_int8 "prop_array_t dict" "unsigned int indx" \ - "int8_t *valp" -.Ft bool -.Fn prop_array_get_uint8 "prop_array_t dict" "unsigned int indx" \ - "uint8_t *valp" -.Ft bool -.Fn prop_array_set_int8 "prop_array_t dict" "unsigned int indx" \ - "int8_t val" -.Ft bool -.Fn prop_array_set_uint8 "prop_array_t dict" "unsigned int indx" \ - "uint8_t val" -.\" -.Ft bool -.Fn prop_array_get_int16 "prop_array_t dict" "unsigned int indx" \ - "int16_t *valp" -.Ft bool -.Fn prop_array_get_uint16 "prop_array_t dict" "unsigned int indx" \ - "uint16_t *valp" -.Ft bool -.Fn prop_array_set_int16 "prop_array_t dict" "unsigned int indx" \ - "int16_t val" -.Ft bool -.Fn prop_array_set_uint16 "prop_array_t dict" "unsigned int indx" \ - "uint16_t val" -.\" -.Ft bool -.Fn prop_array_get_int32 "prop_array_t dict" "unsigned int indx" \ - "int32_t *valp" -.Ft bool -.Fn prop_array_get_uint32 "prop_array_t dict" "unsigned int indx" \ - "uint32_t *valp" -.Ft bool -.Fn prop_array_set_int32 "prop_array_t dict" "unsigned int indx" \ - "int32_t val" -.Ft bool -.Fn prop_array_set_uint32 "prop_array_t dict" "unsigned int indx" \ - "uint32_t val" -.\" -.Ft bool -.Fn prop_array_get_int64 "prop_array_t dict" "unsigned int indx" \ - "int64_t *valp" -.Ft bool -.Fn prop_array_get_uint64 "prop_array_t dict" "unsigned int indx" \ - "uint64_t *valp" -.Ft bool -.Fn prop_array_set_int64 "prop_array_t dict" "unsigned int indx" \ - "int64_t val" -.Ft bool -.Fn prop_array_set_uint64 "prop_array_t dict" "unsigned int indx" \ - "uint64_t val" -.\" -.Ft bool -.Fn prop_array_set_int32 "prop_array_t dict" "unsigned int indx" \ - "int32_t val" -.Ft bool -.Fn prop_array_set_uint32 "prop_array_t dict" "unsigned int indx" \ - "uint32_t val" -.\" -.Ft bool -.Fn prop_array_add_int8 "prop_array_t dict" "int8_t val" -.Ft bool -.Fn prop_array_add_uint8 "prop_array_t dict" "uint8_t val" -.Ft bool -.Fn prop_array_add_int16 "prop_array_t dict" "int16_t val" -.Ft bool -.Fn prop_array_add_uint16 "prop_array_t dict" "uint16_t val" -.Ft bool -.Fn prop_array_add_int32 "prop_array_t dict" "int32_t val" -.Ft bool -.Fn prop_array_add_uint32 "prop_array_t dict" "uint32_t val" -.Ft bool -.Fn prop_array_add_int64 "prop_array_t dict" "int64_t val" -.Ft bool -.Fn prop_array_add_uint64 "prop_array_t dict" "uint64_t val" -.\" -.Ft bool -.Fn prop_array_get_cstring "prop_array_t dict" "unsigned int indx" \ - "char **strp" -.Ft bool -.Fn prop_array_set_cstring "prop_array_t dict" "unsigned int indx" \ - "const char *str" -.\" -.Ft bool -.Fn prop_array_get_cstring_nocopy "prop_array_t dict" \ - "unsigned int indx" "const char **strp" -.Ft bool -.Fn prop_array_set_cstring_nocopy "prop_array_t dict" \ - "unsigned int indx" "const char *strp" -.Ft bool -.Fn prop_array_add_and_rel "prop_array_t dict" \ - "prop_object_t obj" -.Sh DESCRIPTION -The -.Nm prop_array_util -family of functions are provided to make getting and setting values in -arrays more convenient in some applications. -.Pp -The getters check the type of the returned object and, in some cases, also -ensure that the returned value is within the range implied by the getter's -value type. -.Pp -The setters handle object creation and release for the caller. -.Pp -The -.Fn prop_array_get_cstring -function returns dynamically allocated memory. -See -.Xr prop_string 3 -for more information. -.Pp -The -.Fn prop_array_get_cstring_nocopy -and -.Fn prop_array_set_cstring_nocopy -functions do not copy the string that is set or returned. -See -.Xr prop_string 3 -for more information. -.Pp -The -.Fn prop_array_add_and_rel -function adds the object to the end of the array and releases it. -The object is also released on failure. -.Sh RETURN VALUES -The -.Nm prop_array_util -getter functions return -.Dv true -if the object exists in the array and the value is in-range, or -.Dv false -otherwise. -.Pp -The -.Nm prop_array_util -setter functions return -.Dv true -if creating the object and storing it in the array is successful, or -.Dv false -otherwise. -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_bool 3 , -.Xr prop_number 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_array_util.c b/common/lib/libprop/prop_array_util.c deleted file mode 100644 index 52e905b68..000000000 --- a/common/lib/libprop/prop_array_util.c +++ /dev/null @@ -1,251 +0,0 @@ -/* $NetBSD: prop_array_util.c,v 1.4 2012/07/27 09:10:59 pooka Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Utility routines to make it more convenient to work with values - * stored in array. - * - * Note: There is no special magic going on here. We use the standard - * proplib(3) APIs to do all of this work. Any application could do - * exactly what we're doing here. - */ - -#include "prop_object_impl.h" /* hide kernel vs. not-kernel vs. standalone */ -#include - -bool -prop_array_get_bool(prop_array_t array, - unsigned int indx, - bool *valp) -{ - prop_bool_t b; - - b = prop_array_get(array, indx); - if (prop_object_type(b) != PROP_TYPE_BOOL) - return (false); - - *valp = prop_bool_true(b); - - return (true); -} - -bool -prop_array_set_bool(prop_array_t array, - unsigned int indx, - bool val) -{ - prop_bool_t b; - int rv; - - b = prop_bool_create(val); - if (b == NULL) - return (false); - rv = prop_array_set(array, indx, b); - prop_object_release(b); - - return (rv); -} - -#define TEMPLATE(size) \ -bool \ -prop_array_get_int ## size (prop_array_t array, \ - unsigned int indx, \ - int ## size ## _t *valp) \ -{ \ - prop_number_t num; \ - \ - num = prop_array_get(array, indx); \ - if (prop_object_type(num) != PROP_TYPE_NUMBER) \ - return (false); \ - \ - if (prop_number_unsigned(num) && \ - prop_number_unsigned_integer_value(num) > \ - /*CONSTCOND*/((size) == 8 ? INT8_MAX : \ - (size) == 16 ? INT16_MAX : \ - (size) == 32 ? INT32_MAX : INT64_MAX)) { \ - return (false); \ - } \ - \ - if (prop_number_size(num) > (size)) \ - return (false); \ - \ - *valp = (int ## size ## _t) prop_number_integer_value(num); \ - \ - return (true); \ -} \ - \ -bool \ -prop_array_get_uint ## size (prop_array_t array, \ - unsigned int indx, \ - uint ## size ## _t *valp) \ -{ \ - prop_number_t num; \ - \ - num = prop_array_get(array, indx); \ - if (prop_object_type(num) != PROP_TYPE_NUMBER) \ - return (false); \ - \ - if (prop_number_unsigned(num) == false && \ - prop_number_integer_value(num) < 0) { \ - return (false); \ - } \ - \ - if (prop_number_size(num) > (size)) \ - return (false); \ - \ - *valp = (uint ## size ## _t) \ - prop_number_unsigned_integer_value(num); \ - \ - return (true); \ -} \ - \ -bool \ - prop_array_set_int ## size (prop_array_t array, \ - unsigned int indx, \ - int ## size ## _t val) \ -{ \ - prop_number_t num; \ - int rv; \ - \ - num = prop_number_create_integer((int64_t) val); \ - if (num == NULL) \ - return (false); \ - rv = prop_array_set(array, indx, num); \ - prop_object_release(num); \ - \ - return (rv); \ -} \ - \ -bool \ -prop_array_set_uint ## size (prop_array_t array, \ - unsigned int indx, \ - uint ## size ## _t val) \ -{ \ - prop_number_t num; \ - int rv; \ - \ - num = prop_number_create_unsigned_integer((uint64_t) val); \ - if (num == NULL) \ - return (false); \ - rv = prop_array_set(array, indx, num); \ - prop_object_release(num); \ - \ - return (rv); \ -} \ - \ -bool \ -prop_array_add_int ## size (prop_array_t array, \ - int ## size ## _t val) \ -{ \ - prop_number_t num; \ - int rv; \ - \ - num = prop_number_create_integer((int64_t) val); \ - if (num == NULL) \ - return (false); \ - rv = prop_array_add(array, num); \ - prop_object_release(num); \ - \ - return (rv); \ -} \ - \ -bool \ -prop_array_add_uint ## size (prop_array_t array, \ - uint ## size ## _t val) \ -{ \ - prop_number_t num; \ - int rv; \ - \ - num = prop_number_create_integer((int64_t) val); \ - if (num == NULL) \ - return (false); \ - rv = prop_array_add(array, num); \ - prop_object_release(num); \ - \ - return (rv); \ -} - -TEMPLATE(8) -TEMPLATE(16) -TEMPLATE(32) -TEMPLATE(64) - -#undef TEMPLATE - -#define TEMPLATE(variant, qualifier) \ -bool \ -prop_array_get_cstring ## variant (prop_array_t array, \ - unsigned int indx, \ - qualifier char **cpp) \ -{ \ - prop_string_t str; \ - \ - str = prop_array_get(array, indx); \ - if (prop_object_type(str) != PROP_TYPE_STRING) \ - return (false); \ - \ - *cpp = prop_string_cstring ## variant (str); \ - \ - return (*cpp == NULL ? false : true); \ -} \ - \ -bool \ -prop_array_set_cstring ## variant (prop_array_t array, \ - unsigned int indx, \ - const char *cp) \ -{ \ - prop_string_t str; \ - int rv; \ - \ - str = prop_string_create_cstring ## variant (cp); \ - if (str == NULL) \ - return (false); \ - rv = prop_array_set(array, indx, str); \ - prop_object_release(str); \ - \ - return (rv); \ -} - -TEMPLATE(,) -TEMPLATE(_nocopy,const) - -#undef TEMPLATE - -bool -prop_array_add_and_rel(prop_array_t array, prop_object_t po) -{ - bool ret; - if (po == NULL) - return false; - ret = prop_array_add(array, po); - prop_object_release(po); - return ret; -} diff --git a/common/lib/libprop/prop_bool.3 b/common/lib/libprop/prop_bool.3 deleted file mode 100644 index f56382dd7..000000000 --- a/common/lib/libprop/prop_bool.3 +++ /dev/null @@ -1,82 +0,0 @@ -.\" $NetBSD: prop_bool.3,v 1.6 2008/08/03 03:11:28 thorpej Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd April 22, 2006 -.Dt PROP_BOOL 3 -.Os -.Sh NAME -.Nm prop_bool , -.Nm prop_bool_create , -.Nm prop_bool_copy , -.Nm prop_bool_true -.Nd boolean value property object -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft prop_bool_t -.Fn prop_bool_create "bool val" -.Ft prop_bool_t -.Fn prop_bool_copy "prop_bool_t bool" -.\" -.Ft bool -.Fn prop_bool_true "prop_bool_t bool" -.Sh DESCRIPTION -The -.Nm prop_bool -family of functions operate on a boolean value property object type. -.Bl -tag -width "xxxxx" -.It Fn prop_bool_create "bool val" -Create a boolean value object with the value -.Fa val . -.It Fn prop_bool_copy "prop_bool_t bool" -Copy a boolean value object. -If the supplied object isn't a boolean, -.Dv NULL -is returned. -.It Fn prop_bool_true "prop_bool_t bool" -Returns the value of the boolean value object. -If the supplied object isn't a boolean, -.Dv false -is returned. -.El -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_data 3 , -.Xr prop_dictionary 3 , -.Xr prop_number 3 , -.Xr prop_object 3 , -.Xr prop_string 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_bool.c b/common/lib/libprop/prop_bool.c deleted file mode 100644 index d9e912b2c..000000000 --- a/common/lib/libprop/prop_bool.c +++ /dev/null @@ -1,222 +0,0 @@ -/* $NetBSD: prop_bool.c,v 1.17 2009/01/03 18:31:33 pooka Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "prop_object_impl.h" - -struct _prop_bool { - struct _prop_object pb_obj; - bool pb_value; -}; - -static struct _prop_bool _prop_bool_true; -static struct _prop_bool _prop_bool_false; - -static _prop_object_free_rv_t - _prop_bool_free(prop_stack_t, prop_object_t *); -static bool _prop_bool_externalize( - struct _prop_object_externalize_context *, - void *); -static _prop_object_equals_rv_t - _prop_bool_equals(prop_object_t, prop_object_t, - void **, void **, - prop_object_t *, prop_object_t *); - -static const struct _prop_object_type _prop_object_type_bool = { - .pot_type = PROP_TYPE_BOOL, - .pot_free = _prop_bool_free, - .pot_extern = _prop_bool_externalize, - .pot_equals = _prop_bool_equals, -}; - -#define prop_object_is_bool(x) \ - ((x) != NULL && (x)->pb_obj.po_type == &_prop_object_type_bool) - -/* ARGSUSED */ -static _prop_object_free_rv_t -_prop_bool_free(prop_stack_t stack, prop_object_t *obj) -{ - /* - * This should never happen as we "leak" our initial reference - * count. - */ - - /* XXX forced assertion failure? */ - return (_PROP_OBJECT_FREE_DONE); -} - -static bool -_prop_bool_externalize(struct _prop_object_externalize_context *ctx, - void *v) -{ - prop_bool_t pb = v; - - return (_prop_object_externalize_empty_tag(ctx, - pb->pb_value ? "true" : "false")); -} - -/* ARGSUSED */ -static _prop_object_equals_rv_t -_prop_bool_equals(prop_object_t v1, prop_object_t v2, - void **stored_pointer1, void **stored_pointer2, - prop_object_t *next_obj1, prop_object_t *next_obj2) -{ - prop_bool_t b1 = v1; - prop_bool_t b2 = v2; - - if (! (prop_object_is_bool(b1) && - prop_object_is_bool(b2))) - return (_PROP_OBJECT_EQUALS_FALSE); - - /* - * Since we only ever allocate one true and one false, - * save ourselves a couple of memory operations. - */ - if (b1 == b2) - return (_PROP_OBJECT_EQUALS_TRUE); - else - return (_PROP_OBJECT_EQUALS_FALSE); -} - -_PROP_ONCE_DECL(_prop_bool_init_once) - -static int -_prop_bool_init(void) -{ - - _prop_object_init(&_prop_bool_true.pb_obj, - &_prop_object_type_bool); - _prop_bool_true.pb_value = true; - - _prop_object_init(&_prop_bool_false.pb_obj, - &_prop_object_type_bool); - _prop_bool_false.pb_value = false; - - return 0; -} - -static prop_bool_t -_prop_bool_alloc(bool val) -{ - prop_bool_t pb; - - _PROP_ONCE_RUN(_prop_bool_init_once, _prop_bool_init); - pb = val ? &_prop_bool_true : &_prop_bool_false; - prop_object_retain(pb); - - return (pb); -} - -/* - * prop_bool_create -- - * Create a prop_bool_t and initialize it with the - * provided boolean value. - */ -prop_bool_t -prop_bool_create(bool val) -{ - - return (_prop_bool_alloc(val)); -} - -/* - * prop_bool_copy -- - * Copy a prop_bool_t. - */ -prop_bool_t -prop_bool_copy(prop_bool_t opb) -{ - - if (! prop_object_is_bool(opb)) - return (NULL); - - /* - * Because we only ever allocate one true and one false, this - * can be reduced to a simple retain operation. - */ - prop_object_retain(opb); - return (opb); -} - -/* - * prop_bool_true -- - * Get the value of a prop_bool_t. - */ -bool -prop_bool_true(prop_bool_t pb) -{ - - if (! prop_object_is_bool(pb)) - return (false); - - return (pb->pb_value); -} - -/* - * prop_bool_equals -- - * Return true if the boolean values are equivalent. - */ -bool -prop_bool_equals(prop_bool_t b1, prop_bool_t b2) -{ - if (!prop_object_is_bool(b1) || !prop_object_is_bool(b2)) - return (false); - - return (prop_object_equals(b1, b2)); -} - -/* - * _prop_bool_internalize -- - * Parse a or and return the object created from - * the external representation. - */ - -/* ARGSUSED */ -bool -_prop_bool_internalize(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx) -{ - bool val; - - /* No attributes, and it must be an empty element. */ - if (ctx->poic_tagattr != NULL || - ctx->poic_is_empty_element == false) - return (true); - - if (_PROP_TAG_MATCH(ctx, "true")) - val = true; - else { - _PROP_ASSERT(_PROP_TAG_MATCH(ctx, "false")); - val = false; - } - *obj = prop_bool_create(val); - return (true); -} diff --git a/common/lib/libprop/prop_copyin_ioctl.9 b/common/lib/libprop/prop_copyin_ioctl.9 deleted file mode 100644 index 1ea482ca1..000000000 --- a/common/lib/libprop/prop_copyin_ioctl.9 +++ /dev/null @@ -1,194 +0,0 @@ -.\" $NetBSD: prop_copyin_ioctl.9,v 1.9 2011/01/20 10:47:33 wiz Exp $ -.\" -.\" Copyright (c) 2006, 2009 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd January 17, 2011 -.Dt PROP_COPYIN_IOCTL 9 -.Os -.Sh NAME -.Nm prop_array_copyin_ioctl , -.Nm prop_array_copyout_ioctl , -.Nm prop_array_copyin , -.Nm prop_array_copyout , -.Nm prop_dictionary_copyin_ioctl , -.Nm prop_dictionary_copyout_ioctl , -.Nm prop_dictionary_copyin , -.Nm prop_dictionary_copyout -.Nd Copy property lists to and from kernel space -.Sh SYNOPSIS -.In prop/proplib.h -.Ft int -.Fn prop_array_copyin_ioctl "const struct plistref *pref" \ - "const u_long cmd" "prop_array_t *arrayp" -.Ft int -.Fn prop_array_copyin "const struct plistref *pref" \ - "prop_array_t *arrayp" -.Ft int -.Fn prop_array_copyout_ioctl "struct plistref *pref" \ - "const u_long cmd" "prop_array_t array" -.Ft int -.Fn prop_array_copyout "struct plistref *pref" \ - "prop_array_t array" -.Ft int -.Fn prop_dictionary_copyin_ioctl "const struct plistref *pref" \ - "const u_long cmd" "prop_dictionary_t *dictp" -.Ft int -.Fn prop_dictionary_copyin "const struct plistref *pref" \ - "prop_dictionary_t *dictp" -.Ft int -.Fn prop_dictionary_copyout_ioctl "struct plistref *pref" \ - "const u_long cmd" "prop_dictionary_t dict" -.Ft int -.Fn prop_dictionary_copyout "struct plistref *pref" \ - "prop_dictionary_t dict" -.Sh DESCRIPTION -The -.Nm prop_array_copyin_ioctl , -.Nm prop_array_copyout_ioctl , -.Nm prop_dictionary_copyin_ioctl , -and -.Nm prop_dictionary_copyout_ioctl -functions implement the kernel side of a protocol for copying property lists -to and from the kernel using -.Xr ioctl 2 . -The functions -.Nm prop_array_copyin , -.Nm prop_array_copyout , -.Nm prop_dictionary_copyin , -and -.Nm prop_dictionary_copyout -implement the kernel side of a protocol for copying property lists to the -kernel as arguments of normal system calls. -.Pp -A kernel routine receiving or returning a property list will be passed a -pointer to a -.Vt struct plistref . -This structure encapsulates the reference to the property list in externalized -form. -.Sh RETURN VALUES -If successful, functions return zero. -Otherwise, an error number will be returned to indicate the error. -.Sh EXAMPLES -The following -.Pq simplified -example demonstrates using -.Fn prop_dictionary_copyin_ioctl -and -.Fn prop_dictionary_copyout_ioctl -in an ioctl routine: -.Bd -literal -extern prop_dictionary_t fooprops; - -int -fooioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct lwp *l) -{ - prop_dictionary_t dict, odict; - int error; - - switch (cmd) { - case FOOSETPROPS: { - const struct plistref *pref = (const struct plistref *) data; - error = prop_dictionary_copyin_ioctl(pref, cmd, \*[Am]dict); - if (error) - return (error); - odict = fooprops; - fooprops = dict; - prop_object_release(odict); - break; - } - - case FOOGETPROPS: { - struct plistref *pref = (struct plistref *) data; - error = prop_dictionary_copyout_ioctl(pref, cmd, fooprops); - break; - } - - default: - return (EPASSTHROUGH); - } - return (error); -} -.Ed -.Pp -The following -.Pq simplified -example demonstrates using -.Fn prop_array_copyin -in a routine: -.Bd -literal -int -foocopyin(const struct plistref *pref)) -{ - prop_array_t array; - int error; - - error = prop_array_copyin(pref, \*[Am]array); - if (error) - return (error); - ... -} -.Ed -.Sh ERRORS -.Fn prop_array_copyin_ioctl -and -.Fn prop_dictionary_copyin_ioctl -will fail if: -.Bl -tag -width Er -.It Bq Er EFAULT -Bad address -.It Bq Er EIO -Input/output error -.It Bq Er ENOMEM -Cannot allocate memory -.It Bq Er ENOTSUP -Not supported -.El -.Pp -.Fn prop_array_copyout_ioctl -and -.Fn prop_dictionary_copyout_ioctl -will fail if: -.Bl -tag -width Er -.It Bq Er EFAULT -Bad address -.It Bq Er ENOMEM -Cannot allocate memory -.It Bq Er ENOTSUP -Not supported -.El -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_dictionary 3 , -.Xr prop_send_ioctl 3 , -.Xr prop_send_syscall 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_data.3 b/common/lib/libprop/prop_data.3 deleted file mode 100644 index 61acf46da..000000000 --- a/common/lib/libprop/prop_data.3 +++ /dev/null @@ -1,148 +0,0 @@ -.\" $NetBSD: prop_data.3,v 1.7 2009/12/14 06:03:23 dholland Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd April 22, 2006 -.Dt PROP_DATA 3 -.Os -.Sh NAME -.Nm prop_data , -.Nm prop_data_create_data , -.Nm prop_data_create_data_nocopy , -.Nm prop_data_copy , -.Nm prop_data_size , -.Nm prop_data_data , -.Nm prop_data_data_nocopy , -.Nm prop_data_equals , -.Nm prop_data_equals_data -.Nd opaque data value property object -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft prop_data_t -.Fn prop_data_create_data "const void *blob" "size_t len" -.Ft prop_data_t -.Fn prop_data_create_data_nocopy "const void *blob" "size_t len" -.\" -.Ft prop_data_t -.Fn prop_data_copy "prop_data_t data" -.\" -.Ft size_t -.Fn prop_data_size "prop_data_t data" -.Ft void * -.Fn prop_data_data "prop_data_t data" -.Ft const void * -.Fn prop_data_data_nocopy "prop_data_t data" -.\" -.Ft bool -.Fn prop_data_equals "prop_data_t dat1" "prop_data_t dat2" -.Ft bool -.Fn prop_data_equals_data "prop_data_t data" "const void *blob" "size_t len" -.Sh DESCRIPTION -The -.Nm prop_data -family of functions operate on an opaque data value property object type. -.Bl -tag -width "xxxxx" -.It Fn prop_data_create_data "const void *blob" "size_t len" -Create a data object that contains a copy of -.Fa blob -with size -.Fa len . -Returns -.Dv NULL -on failure. -.It Fn prop_data_create_data_nocopy "const void *blob" "size_t len" -Create a data object that contains a reference to -.Fa blob -with size -.Fa len . -Returns -.Dv NULL -on failure. -.It Fn prop_data_copy "prop_data_t data" -Copy a data object. -If the data object being copied is an external data reference, -then the copy also references the same external data. -Returns -.Dv NULL -on failure. -.It Fn prop_data_size "prop_data_t data" -Returns the size of the data object. -If the supplied object isn't a data object, zero is returned. -.It Fn prop_data_data "prop_data_t data" -Returns a copy of the data object's contents. -The caller is responsible for freeing the returned buffer. -If the supplied object isn't a data object or -if the data container is empty, -.Dv NULL -is returned. -.Pp -In user space, the buffer is allocated using -.Xr malloc 3 . -In the kernel, the buffer is allocated using -.Xr malloc 9 -using the malloc type -.Dv M_TEMP . -.It Fn prop_data_data_nocopy "prop_data_t data" -Returns an immutable reference to the contents of the data object. -If the supplied object isn't a data object, -.Dv NULL -is returned. -.It Fn prop_data_equals "prop_data_t dat1" "prop_data_t dat2" -Returns -.Dv true -if the two data objects are equivalent. -If at least one of the supplied objects isn't a data object, -.Dv false -is returned. -.It Fn prop_data_equals_data "prop_data_t data" "const void *blob" "size_t len" -Returns -.Dv true -if the data object's value is equivalent to -.Fa blob -with size -.Fa len . -If the supplied object isn't a data object, -.Dv false -is returned. -.El -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_bool 3 , -.Xr prop_dictionary 3 , -.Xr prop_number 3 , -.Xr prop_object 3 , -.Xr prop_string 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_data.c b/common/lib/libprop/prop_data.c deleted file mode 100644 index 5ef9e35e3..000000000 --- a/common/lib/libprop/prop_data.c +++ /dev/null @@ -1,627 +0,0 @@ -/* $NetBSD: prop_data.c,v 1.14 2009/01/25 06:59:35 cyber Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "prop_object_impl.h" - -#if defined(_KERNEL) -#include -#elif defined(_STANDALONE) -#include -#include -#else -#include -#include -#include -#endif - -struct _prop_data { - struct _prop_object pd_obj; - union { - void * pdu_mutable; - const void * pdu_immutable; - } pd_un; -#define pd_mutable pd_un.pdu_mutable -#define pd_immutable pd_un.pdu_immutable - size_t pd_size; - int pd_flags; -}; - -#define PD_F_NOCOPY 0x01 - -_PROP_POOL_INIT(_prop_data_pool, sizeof(struct _prop_data), "propdata") - -_PROP_MALLOC_DEFINE(M_PROP_DATA, "prop data", - "property data container object") - -static _prop_object_free_rv_t - _prop_data_free(prop_stack_t, prop_object_t *); -static bool _prop_data_externalize( - struct _prop_object_externalize_context *, - void *); -static _prop_object_equals_rv_t - _prop_data_equals(prop_object_t, prop_object_t, - void **, void **, - prop_object_t *, prop_object_t *); - -static const struct _prop_object_type _prop_object_type_data = { - .pot_type = PROP_TYPE_DATA, - .pot_free = _prop_data_free, - .pot_extern = _prop_data_externalize, - .pot_equals = _prop_data_equals, -}; - -#define prop_object_is_data(x) \ - ((x) != NULL && (x)->pd_obj.po_type == &_prop_object_type_data) - -/* ARGSUSED */ -static _prop_object_free_rv_t -_prop_data_free(prop_stack_t stack, prop_object_t *obj) -{ - prop_data_t pd = *obj; - - if ((pd->pd_flags & PD_F_NOCOPY) == 0 && pd->pd_mutable != NULL) - _PROP_FREE(pd->pd_mutable, M_PROP_DATA); - _PROP_POOL_PUT(_prop_data_pool, pd); - - return (_PROP_OBJECT_FREE_DONE); -} - -static const char _prop_data_base64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static const char _prop_data_pad64 = '='; - -static bool -_prop_data_externalize(struct _prop_object_externalize_context *ctx, void *v) -{ - prop_data_t pd = v; - size_t i, srclen; - const uint8_t *src; - uint8_t output[4]; - uint8_t input[3]; - - if (pd->pd_size == 0) - return (_prop_object_externalize_empty_tag(ctx, "data")); - - if (_prop_object_externalize_start_tag(ctx, "data") == false) - return (false); - - for (src = pd->pd_immutable, srclen = pd->pd_size; - srclen > 2; srclen -= 3) { - input[0] = *src++; - input[1] = *src++; - input[2] = *src++; - - output[0] = (uint32_t)input[0] >> 2; - output[1] = ((uint32_t)(input[0] & 0x03) << 4) + - ((uint32_t)input[1] >> 4); - output[2] = ((uint32_t)(input[1] & 0x0f) << 2) + - ((uint32_t)input[2] >> 6); - output[3] = input[2] & 0x3f; - _PROP_ASSERT(output[0] < 64); - _PROP_ASSERT(output[1] < 64); - _PROP_ASSERT(output[2] < 64); - _PROP_ASSERT(output[3] < 64); - - if (_prop_object_externalize_append_char(ctx, - _prop_data_base64[output[0]]) == false || - _prop_object_externalize_append_char(ctx, - _prop_data_base64[output[1]]) == false || - _prop_object_externalize_append_char(ctx, - _prop_data_base64[output[2]]) == false || - _prop_object_externalize_append_char(ctx, - _prop_data_base64[output[3]]) == false) - return (false); - } - - if (srclen != 0) { - input[0] = input[1] = input[2] = '\0'; - for (i = 0; i < srclen; i++) - input[i] = *src++; - - output[0] = (uint32_t)input[0] >> 2; - output[1] = ((uint32_t)(input[0] & 0x03) << 4) + - ((uint32_t)input[1] >> 4); - output[2] = ((uint32_t)(input[1] & 0x0f) << 2) + - ((uint32_t)input[2] >> 6); - _PROP_ASSERT(output[0] < 64); - _PROP_ASSERT(output[1] < 64); - _PROP_ASSERT(output[2] < 64); - - if (_prop_object_externalize_append_char(ctx, - _prop_data_base64[output[0]]) == false || - _prop_object_externalize_append_char(ctx, - _prop_data_base64[output[1]]) == false || - _prop_object_externalize_append_char(ctx, - srclen == 1 ? _prop_data_pad64 - : _prop_data_base64[output[2]]) == false || - _prop_object_externalize_append_char(ctx, - _prop_data_pad64) == false) - return (false); - } - - if (_prop_object_externalize_end_tag(ctx, "data") == false) - return (false); - - return (true); -} - -/* ARGSUSED */ -static _prop_object_equals_rv_t -_prop_data_equals(prop_object_t v1, prop_object_t v2, - void **stored_pointer1, void **stored_pointer2, - prop_object_t *next_obj1, prop_object_t *next_obj2) -{ - prop_data_t pd1 = v1; - prop_data_t pd2 = v2; - - if (pd1 == pd2) - return (_PROP_OBJECT_EQUALS_TRUE); - if (pd1->pd_size != pd2->pd_size) - return (_PROP_OBJECT_EQUALS_FALSE); - if (pd1->pd_size == 0) { - _PROP_ASSERT(pd1->pd_immutable == NULL); - _PROP_ASSERT(pd2->pd_immutable == NULL); - return (_PROP_OBJECT_EQUALS_TRUE); - } - if (memcmp(pd1->pd_immutable, pd2->pd_immutable, pd1->pd_size) == 0) - return _PROP_OBJECT_EQUALS_TRUE; - else - return _PROP_OBJECT_EQUALS_FALSE; -} - -static prop_data_t -_prop_data_alloc(void) -{ - prop_data_t pd; - - pd = _PROP_POOL_GET(_prop_data_pool); - if (pd != NULL) { - _prop_object_init(&pd->pd_obj, &_prop_object_type_data); - - pd->pd_mutable = NULL; - pd->pd_size = 0; - pd->pd_flags = 0; - } - - return (pd); -} - -/* - * prop_data_create_data -- - * Create a data container that contains a copy of the data. - */ -prop_data_t -prop_data_create_data(const void *v, size_t size) -{ - prop_data_t pd; - void *nv; - - pd = _prop_data_alloc(); - if (pd != NULL && size != 0) { - nv = _PROP_MALLOC(size, M_PROP_DATA); - if (nv == NULL) { - prop_object_release(pd); - return (NULL); - } - memcpy(nv, v, size); - pd->pd_mutable = nv; - pd->pd_size = size; - } - return (pd); -} - -/* - * prop_data_create_data_nocopy -- - * Create an immutable data container that contains a refrence to the - * provided external data. - */ -prop_data_t -prop_data_create_data_nocopy(const void *v, size_t size) -{ - prop_data_t pd; - - pd = _prop_data_alloc(); - if (pd != NULL) { - pd->pd_immutable = v; - pd->pd_size = size; - pd->pd_flags |= PD_F_NOCOPY; - } - return (pd); -} - -/* - * prop_data_copy -- - * Copy a data container. If the original data is external, then - * the copy is also references the same external data. - */ -prop_data_t -prop_data_copy(prop_data_t opd) -{ - prop_data_t pd; - - if (! prop_object_is_data(opd)) - return (NULL); - - pd = _prop_data_alloc(); - if (pd != NULL) { - pd->pd_size = opd->pd_size; - pd->pd_flags = opd->pd_flags; - if (opd->pd_flags & PD_F_NOCOPY) - pd->pd_immutable = opd->pd_immutable; - else if (opd->pd_size != 0) { - void *nv = _PROP_MALLOC(pd->pd_size, M_PROP_DATA); - if (nv == NULL) { - prop_object_release(pd); - return (NULL); - } - memcpy(nv, opd->pd_immutable, opd->pd_size); - pd->pd_mutable = nv; - } - } - return (pd); -} - -/* - * prop_data_size -- - * Return the size of the data. - */ -size_t -prop_data_size(prop_data_t pd) -{ - - if (! prop_object_is_data(pd)) - return (0); - - return (pd->pd_size); -} - -/* - * prop_data_data -- - * Return a copy of the contents of the data container. - * The data is allocated with the M_TEMP malloc type. - * If the data container is empty, NULL is returned. - */ -void * -prop_data_data(prop_data_t pd) -{ - void *v; - - if (! prop_object_is_data(pd)) - return (NULL); - - if (pd->pd_size == 0) { - _PROP_ASSERT(pd->pd_immutable == NULL); - return (NULL); - } - - _PROP_ASSERT(pd->pd_immutable != NULL); - - v = _PROP_MALLOC(pd->pd_size, M_TEMP); - if (v != NULL) - memcpy(v, pd->pd_immutable, pd->pd_size); - - return (v); -} - -/* - * prop_data_data_nocopy -- - * Return an immutable reference to the contents of the data - * container. - */ -const void * -prop_data_data_nocopy(prop_data_t pd) -{ - - if (! prop_object_is_data(pd)) - return (NULL); - - _PROP_ASSERT((pd->pd_size == 0 && pd->pd_immutable == NULL) || - (pd->pd_size != 0 && pd->pd_immutable != NULL)); - - return (pd->pd_immutable); -} - -/* - * prop_data_equals -- - * Return true if two strings are equivalent. - */ -bool -prop_data_equals(prop_data_t pd1, prop_data_t pd2) -{ - if (!prop_object_is_data(pd1) || !prop_object_is_data(pd2)) - return (false); - - return (prop_object_equals(pd1, pd2)); -} - -/* - * prop_data_equals_data -- - * Return true if the contained data is equivalent to the specified - * external data. - */ -bool -prop_data_equals_data(prop_data_t pd, const void *v, size_t size) -{ - - if (! prop_object_is_data(pd)) - return (false); - - if (pd->pd_size != size) - return (false); - return (memcmp(pd->pd_immutable, v, size) == 0); -} - -static bool -_prop_data_internalize_decode(struct _prop_object_internalize_context *ctx, - uint8_t *target, size_t targsize, size_t *sizep, - const char **cpp) -{ - const char *src; - size_t tarindex; - int state, ch; - const char *pos; - - state = 0; - tarindex = 0; - src = ctx->poic_cp; - - for (;;) { - ch = (unsigned char) *src++; - if (_PROP_EOF(ch)) - return (false); - if (_PROP_ISSPACE(ch)) - continue; - if (ch == '<') { - src--; - break; - } - if (ch == _prop_data_pad64) - break; - - pos = strchr(_prop_data_base64, ch); - if (pos == NULL) - return (false); - - switch (state) { - case 0: - if (target) { - if (tarindex >= targsize) - return (false); - target[tarindex] = - (uint8_t)((pos - _prop_data_base64) << 2); - } - state = 1; - break; - - case 1: - if (target) { - if (tarindex + 1 >= targsize) - return (false); - target[tarindex] |= - (uint32_t)(pos - _prop_data_base64) >> 4; - target[tarindex + 1] = - (uint8_t)(((pos - _prop_data_base64) & 0xf) - << 4); - } - tarindex++; - state = 2; - break; - - case 2: - if (target) { - if (tarindex + 1 >= targsize) - return (false); - target[tarindex] |= - (uint32_t)(pos - _prop_data_base64) >> 2; - target[tarindex + 1] = - (uint8_t)(((pos - _prop_data_base64) - & 0x3) << 6); - } - tarindex++; - state = 3; - break; - - case 3: - if (target) { - if (tarindex >= targsize) - return (false); - target[tarindex] |= (uint8_t) - (pos - _prop_data_base64); - } - tarindex++; - state = 0; - break; - - default: - _PROP_ASSERT(/*CONSTCOND*/0); - } - } - - /* - * We are done decoding the Base64 characters. Let's see if we - * ended up on a byte boundary and/or with unrecognized trailing - * characters. - */ - if (ch == _prop_data_pad64) { - ch = (unsigned char) *src; /* src already advanced */ - if (_PROP_EOF(ch)) - return (false); - switch (state) { - case 0: /* Invalid = in first position */ - case 1: /* Invalid = in second position */ - return (false); - - case 2: /* Valid, one byte of info */ - /* Skip whitespace */ - for (ch = (unsigned char) *src++; - ch != '<'; ch = (unsigned char) *src++) { - if (_PROP_EOF(ch)) - return (false); - if (!_PROP_ISSPACE(ch)) - break; - } - /* Make sure there is another trailing = */ - if (ch != _prop_data_pad64) - return (false); - ch = (unsigned char) *src; - /* FALLTHROUGH */ - - case 3: /* Valid, two bytes of info */ - /* - * We know this char is a =. Is there anything but - * whitespace after it? - */ - for (ch = (unsigned char) *src++; - ch != '<'; ch = (unsigned char) *src++) { - if (_PROP_EOF(ch)) - return (false); - if (!_PROP_ISSPACE(ch)) - return (false); - } - /* back up to '<' */ - src--; - } - } else { - /* - * We ended by seeing the end of the Base64 string. Make - * sure there are no partial bytes lying around. - */ - if (state != 0) - return (false); - } - - _PROP_ASSERT(*src == '<'); - if (sizep != NULL) - *sizep = tarindex; - if (cpp != NULL) - *cpp = src; - - return (true); -} - -/* - * _prop_data_internalize -- - * Parse a ... and return the object created from the - * external representation. - */ - -/* strtoul is used for parsing, enforce. */ -typedef int PROP_DATA_ASSERT[/* CONSTCOND */sizeof(size_t) == sizeof(unsigned long) ? 1 : -1]; - -/* ARGSUSED */ -bool -_prop_data_internalize(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx) -{ - prop_data_t data; - uint8_t *buf; - size_t len, alen; - - /* - * We don't accept empty elements. - * This actually only checks for the node to be - * (Which actually causes another error if found.) - */ - if (ctx->poic_is_empty_element) - return (true); - - /* - * If we got a "size" attribute, get the size of the data blob - * from that. Otherwise, we have to figure it out from the base64. - */ - if (ctx->poic_tagattr != NULL) { - char *cp; - - if (!_PROP_TAGATTR_MATCH(ctx, "size") || - ctx->poic_tagattrval_len == 0) - return (true); - -#ifndef _KERNEL - errno = 0; -#endif - len = strtoul(ctx->poic_tagattrval, &cp, 0); -#ifndef _KERNEL /* XXX can't check for ERANGE in the kernel */ - if (len == ULONG_MAX && errno == ERANGE) - return (true); -#endif - if (cp != ctx->poic_tagattrval + ctx->poic_tagattrval_len) - return (true); - _PROP_ASSERT(*cp == '\"'); - } else if (_prop_data_internalize_decode(ctx, NULL, 0, &len, - NULL) == false) - return (true); - - /* - * Always allocate one extra in case we don't land on an even byte - * boundary during the decode. - */ - buf = _PROP_MALLOC(len + 1, M_PROP_DATA); - if (buf == NULL) - return (true); - - if (_prop_data_internalize_decode(ctx, buf, len + 1, &alen, - &ctx->poic_cp) == false) { - _PROP_FREE(buf, M_PROP_DATA); - return (true); - } - if (alen != len) { - _PROP_FREE(buf, M_PROP_DATA); - return (true); - } - - if (_prop_object_internalize_find_tag(ctx, "data", - _PROP_TAG_TYPE_END) == false) { - _PROP_FREE(buf, M_PROP_DATA); - return (true); - } - - data = _prop_data_alloc(); - if (data == NULL) { - _PROP_FREE(buf, M_PROP_DATA); - return (true); - } - - /* - * Handle alternate type of empty node. - * XML document could contain open/close tags, yet still be empty. - */ - if (alen == 0) { - _PROP_FREE(buf, M_PROP_DATA); - data->pd_mutable = NULL; - } else { - data->pd_mutable = buf; - } - data->pd_size = len; - - *obj = data; - return (true); -} diff --git a/common/lib/libprop/prop_dictionary.3 b/common/lib/libprop/prop_dictionary.3 deleted file mode 100644 index 82743e34d..000000000 --- a/common/lib/libprop/prop_dictionary.3 +++ /dev/null @@ -1,353 +0,0 @@ -.\" $NetBSD: prop_dictionary.3,v 1.18 2011/09/30 22:08:18 jym Exp $ -.\" -.\" Copyright (c) 2006, 2009 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd December 5, 2009 -.Dt PROP_DICTIONARY 3 -.Os -.Sh NAME -.Nm prop_dictionary , -.Nm prop_dictionary_create , -.Nm prop_dictionary_create_with_capacity , -.Nm prop_dictionary_copy , -.Nm prop_dictionary_copy_mutable , -.Nm prop_dictionary_count , -.Nm prop_dictionary_ensure_capacity , -.Nm prop_dictionary_iterator , -.Nm prop_dictionary_all_keys , -.Nm prop_dictionary_make_immutable , -.Nm prop_dictionary_mutable , -.Nm prop_dictionary_get , -.Nm prop_dictionary_set , -.Nm prop_dictionary_remove , -.Nm prop_dictionary_get_keysym , -.Nm prop_dictionary_set_keysym , -.Nm prop_dictionary_remove_keysym , -.Nm prop_dictionary_externalize , -.Nm prop_dictionary_internalize , -.Nm prop_dictionary_externalize_to_file , -.Nm prop_dictionary_internalize_from_file , -.Nm prop_dictionary_externalize_to_pref , -.Nm prop_dictionary_internalize_from_pref , -.Nm prop_dictionary_equals , -.Nm prop_dictionary_keysym_cstring_nocopy , -.Nm prop_dictionary_keysym_equals -.Nd dictionary property collection object -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft prop_dictionary_t -.Fn prop_dictionary_create "void" -.Ft prop_dictionary_t -.Fn prop_dictionary_create_with_capacity "unsigned int capacity" -.\" -.Ft prop_dictionary_t -.Fn prop_dictionary_copy "prop_dictionary_t dict" -.Ft prop_dictionary_t -.Fn prop_dictionary_copy_mutable "prop_dictionary_t dict" -.\" -.Ft unsigned int -.Fn prop_dictionary_count "prop_dictionary_t dict" -.Ft bool -.Fn prop_dictionary_ensure_capacity "prop_dictionary_t dict" \ - "unsigned int capacity" -.\" -.Ft prop_object_iterator_t -.Fn prop_dictionary_iterator "prop_dictionary_t dict" -.Ft prop_array_t -.Fn prop_dictionary_all_keys "prop_dictionary_t dict" -.\" -.Ft void -.Fn prop_dictionary_make_immutable "prop_dictionary_t dict" -.Ft bool -.Fn prop_dictionary_mutable "prop_dictionary_t dict" -.\" -.Ft prop_object_t -.Fn prop_dictionary_get "prop_dictionary_t dict" "const char *key" -.Ft bool -.Fn prop_dictionary_set "prop_dictionary_t dict" "const char *key" \ - "prop_object_t obj" -.Ft void -.Fn prop_dictionary_remove "prop_dictionary_t dict" "const char *key" -.\" -.Ft prop_object_t -.Fn prop_dictionary_get_keysym "prop_dictionary_t dict" \ - "prop_dictionary_keysym_t keysym" -.Ft bool -.Fn prop_dictionary_set_keysym "prop_dictionary_t dict" \ - "prop_dictionary_keysym_t keysym" "prop_object_t obj" -.Ft void -.Fn prop_dictionary_remove_keysym "prop_dictionary_t dict" \ - "prop_dictionary_keysym_t keysym" -.\" -.Ft bool -.Fn prop_dictionary_equals "prop_dictionary_t dict1" "prop_dictionary_t dict2" -.\" -.Ft const char * -.Fn prop_dictionary_keysym_cstring_nocopy "prop_dictionary_keysym_t sym" -.\" -.Ft bool -.Fn prop_dictionary_keysym_equals "prop_dictionary_keysym_t keysym1" \ - "prop_dictionary_keysym_t keysym2" -.\" -.Ft char * -.Fn prop_dictionary_externalize "prop_dictionary_t dict" -.Ft prop_dictionary_t -.Fn prop_dictionary_internalize "const char *xml" -.\" -.Ft bool -.Fn prop_dictionary_externalize_to_file "prop_dictionary_t dict" \ - "const char *path" -.Ft prop_dictionary_t -.Fn prop_dictionary_internalize_from_file "const char *path" -.\" -.Ft bool -.Fn prop_dictionary_externalize_to_pref "prop_dictionary_t dict" \ - "struct plistref *pref" -.Ft bool -.Fn prop_dictionary_internalize_from_pref "const struct plistref *pref" \ - "prop_dictionary_t *dictp" -.\" -.Sh DESCRIPTION -The -.Nm prop_dictionary -family of functions operate on the dictionary property collection object type. -A dictionary is an unordered set of objects stored as key-value pairs. -.Bl -tag -width "xxxxx" -.It Fn prop_dictionary_create "void" -Create an empty dictionary. -The dictionary initially has no capacity. -Returns -.Dv NULL -on failure. -.It Fn prop_dictionary_create_with_capacity "unsigned int capacity" -Create a dictionary with the capacity to store -.Fa capacity -objects. -Returns -.Dv NULL -on failure. -.It Fn prop_dictionary_copy "prop_dictionary_t dict" -Copy a dictionary. -The new dictionary has an initial capacity equal to the number of objects -stored in the dictionary being copied. -The new dictionary contains references to the original dictionary's objects, -not copies of those objects -.Pq i.e. a shallow copy is made . -If the original dictionary is immutable, the resulting dictionary is also -immutable. -.It Fn prop_dictionary_copy_mutable "prop_dictionary_t dict" -Like -.Fn prop_dictionary_copy , -except the resulting dictionary is always mutable. -.It Fn prop_dictionary_count "prop_dictionary_t dict" -Returns the number of objects stored in the dictionary. -.It Fn prop_dictionary_ensure_capacity "prop_dictionary_t dict" \ - "unsigned int capacity" -Ensure that the dictionary has a total capacity of -.Fa capacity , -including objects already stored in the dictionary. -Returns -.Dv true -if the capacity of the dictionary is greater or equal to -.Fa capacity -or if the expansion of the dictionary's capacity was successful -and -.Dv false -otherwise. -If the supplied object isn't a dictionary, -.Dv false -is returned. -.It Fn prop_dictionary_iterator "prop_dictionary_t dict" -Create an iterator for the dictionary. -The dictionary is retained by the iterator. -A dictionary iterator returns the key symbols used to look up objects stored -in the dictionary; to get the object itself, a dictionary lookup using this -key symbol must be performed. -Storing to or removing from the dictionary invalidates any active iterators for -the dictionary. -Returns -.Dv NULL -on failure. -.It Fn prop_dictionary_all_keys "prop_dictionary_t dict" -Return an array of all of the dictionary key symbols -.Pq prop_dictionary_keysym_t -in the dictionary. -This provides a way to iterate over the items in the dictionary while -retaining the ability to mutate the dictionary; instead of iterating -over the dictionary itself, iterate over the array of keys. -The caller is responsible for releasing the array. -Returns -.Dv NULL -on failure. -.It Fn prop_dictionary_make_immutable "prop_dictionary_t dict" -Make -.Fa dict -immutable. -.It Fn prop_dictionary_mutable "prop_dictionary_t dict" -Returns -.Dv true -if the dictionary is mutable. -.It Fn prop_dictionary_get "prop_dictionary_t dict" "const char *key" -Return the object stored in the dictionary with the key -.Fa key . -If no object is stored with the specified key, -.Dv NULL -is returned. -.It Fn prop_dictionary_set "prop_dictionary_t dict" "const char *key" \ - "prop_object_t obj" -Store a reference to the object -.Fa obj -with the key -.Fa key . -The object will be retained by the dictionary. -If the key already exists in the dictionary, the object associated with -that key will be released and replaced with the new object. -Returns -.Dv true -if storing the object was successful and -.Dv false -otherwise. -.It Fn prop_dictionary_remove "prop_dictionary_t dict" "const char *key" -Remove the reference to the object stored in the dictionary with the key -.Fa key . -The object will be released. -.It Fn prop_dictionary_get_keysym "prop_dictionary_t dict" \ - "prop_dictionary_keysym_t sym" -Like -.Fn prop_dictionary_get , -but the lookup is performed using a key symbol returned by a dictionary -iterator. -The results are undefined if the iterator used to obtain the key symbol -is not associated with -.Fa dict . -.It Fn prop_dictionary_set_keysym "prop_dictionary_t dict" \ - "prop_dictionary_keysym_t sym" "prop_object_t obj" -Like -.Fn prop_dictionary_set , -but the lookup of the object to replace is performed using a key symbol -returned by a dictionary iterator. -The results are undefined if the iterator used to obtain the key symbol -is not associated with -.Fa dict . -.It Fn prop_dictionary_remove_keysym "prop_dictionary_t dict" \ - "prop_dictionary_keysym_t sym" -Like -.Fn prop_dictionary_remove , -but the lookup of the object to remove is performed using a key symbol -returned by a dictionary iterator. -The results are undefined if the iterator used to obtain the key symbol -is not associated with -.Fa dict . -.It Fn prop_dictionary_equals "prop_dictionary_t dict1" \ - "prop_dictionary_t dict2" -Returns -.Dv true -if the two dictionaries are equivalent. -Note: Objects contained in the dictionary are compared by value, not by -reference. -.It Fn prop_dictionary_keysym_cstring_nocopy "prop_dictionary_keysym_t keysym" -Returns an immutable reference to the dictionary key symbol's string value. -.It Fn prop_dictionary_keysym_equals "prop_dictionary_keysym_t keysym1" \ - "prop_dictionary_keysym_t keysym2" -Returns -.Dv true -if the two dictionary key symbols are equivalent. -.It Fn prop_dictionary_externalize "prop_dictionary_t dict" -Externalizes a dictionary, returning a NUL-terminated buffer containing -the XML representation of the dictionary. -The caller is responsible for freeing the returned buffer. -If converting to the external representation fails for any reason, -.Dv NULL -is returned. -.Pp -In user space, the buffer is allocated using -.Xr malloc 3 . -In the kernel, the buffer is allocated using -.Xr malloc 9 -using the malloc type -.Dv M_TEMP . -.It Fn prop_dictionary_internalize "const char *xml" -Parse the XML representation of a property list in the NUL-terminated -buffer -.Fa xml -and return the corresponding dictionary. -Returns -.Dv NULL -if parsing fails for any reason. -.It Fn prop_dictionary_externalize_to_file "prop_dictionary_t dict" \ - "const char *path" -Externalizes a dictionary and writes it to the file specified by -.Fa path . -The file is saved with the mode -.Dv 0666 -as modified by the process's file creation mask -.Pq see Xr umask 2 -and is written atomically. -Returns -.Dv false -if externalizing or writing the dictionary fails for any reason. -.It Fn prop_dictionary_internalize_from_file "const char *path" -Reads the XML property list contained in the file specified by -.Fa path , -internalizes it, and returns the corresponding dictionary. -Returns -.Dv NULL -on failure. -.It Fn prop_dictionary_externalize_to_pref "prop_dictionary_t dict" \ - "struct plistref *pref" -Externalizes a dictionary and packs it into the plistref specified by -.Fa pref . -Returns -.Dv false -if externalizing the dictionary fails for any reason. -.It Fn prop_dictionary_internalize_from_pref "const struct plistref *pref" \ - "prop_dictionary_t *dictp" -Reads the plistref specified by -.Fa pref , -internalizes it, and returns the corresponding dictionary. -Returns -.Dv false -if internalizing or writing the dictionary fails for any reason. -.El -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_bool 3 , -.Xr prop_data 3 , -.Xr prop_dictionary_util 3 , -.Xr prop_number 3 , -.Xr prop_object 3 , -.Xr prop_string 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_dictionary.c b/common/lib/libprop/prop_dictionary.c deleted file mode 100644 index 151b39cd6..000000000 --- a/common/lib/libprop/prop_dictionary.c +++ /dev/null @@ -1,1426 +0,0 @@ -/* $NetBSD: prop_dictionary.c,v 1.39 2013/10/18 18:26:20 martin Exp $ */ - -/*- - * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "prop_object_impl.h" -#include -#include -#include -#include "prop_rb_impl.h" - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#endif - -/* - * We implement these like arrays, but we keep them sorted by key. - * This allows us to binary-search as well as keep externalized output - * sane-looking for human eyes. - */ - -#define EXPAND_STEP 16 - -/* - * prop_dictionary_keysym_t is allocated with space at the end to hold the - * key. This must be a regular object so that we can maintain sane iterator - * semantics -- we don't want to require that the caller release the result - * of prop_object_iterator_next(). - * - * We'd like to have some small'ish keysym objects for up-to-16 characters - * in a key, some for up-to-32 characters in a key, and then a final bucket - * for up-to-128 characters in a key (not including NUL). Keys longer than - * 128 characters are not allowed. - */ -struct _prop_dictionary_keysym { - struct _prop_object pdk_obj; - size_t pdk_size; - struct rb_node pdk_link; - char pdk_key[1]; - /* actually variable length */ -}; - - /* pdk_key[1] takes care of the NUL */ -#define PDK_SIZE_16 (sizeof(struct _prop_dictionary_keysym) + 16) -#define PDK_SIZE_32 (sizeof(struct _prop_dictionary_keysym) + 32) -#define PDK_SIZE_128 (sizeof(struct _prop_dictionary_keysym) + 128) - -#define PDK_MAXKEY 128 - -_PROP_POOL_INIT(_prop_dictionary_keysym16_pool, PDK_SIZE_16, "pdict16") -_PROP_POOL_INIT(_prop_dictionary_keysym32_pool, PDK_SIZE_32, "pdict32") -_PROP_POOL_INIT(_prop_dictionary_keysym128_pool, PDK_SIZE_128, "pdict128") - -struct _prop_dict_entry { - prop_dictionary_keysym_t pde_key; - prop_object_t pde_objref; -}; - -struct _prop_dictionary { - struct _prop_object pd_obj; - _PROP_RWLOCK_DECL(pd_rwlock) - struct _prop_dict_entry *pd_array; - unsigned int pd_capacity; - unsigned int pd_count; - int pd_flags; - - uint32_t pd_version; -}; - -#define PD_F_IMMUTABLE 0x01 /* dictionary is immutable */ - -_PROP_POOL_INIT(_prop_dictionary_pool, sizeof(struct _prop_dictionary), - "propdict") -_PROP_MALLOC_DEFINE(M_PROP_DICT, "prop dictionary", - "property dictionary container object") - -static _prop_object_free_rv_t - _prop_dictionary_free(prop_stack_t, prop_object_t *); -static void _prop_dictionary_emergency_free(prop_object_t); -static bool _prop_dictionary_externalize( - struct _prop_object_externalize_context *, - void *); -static _prop_object_equals_rv_t - _prop_dictionary_equals(prop_object_t, prop_object_t, - void **, void **, - prop_object_t *, prop_object_t *); -static void _prop_dictionary_equals_finish(prop_object_t, prop_object_t); -static prop_object_iterator_t - _prop_dictionary_iterator_locked(prop_dictionary_t); -static prop_object_t - _prop_dictionary_iterator_next_object_locked(void *); -static prop_object_t - _prop_dictionary_get_keysym(prop_dictionary_t, - prop_dictionary_keysym_t, bool); -static prop_object_t - _prop_dictionary_get(prop_dictionary_t, const char *, bool); - -static void _prop_dictionary_lock(void); -static void _prop_dictionary_unlock(void); - -static const struct _prop_object_type _prop_object_type_dictionary = { - .pot_type = PROP_TYPE_DICTIONARY, - .pot_free = _prop_dictionary_free, - .pot_emergency_free = _prop_dictionary_emergency_free, - .pot_extern = _prop_dictionary_externalize, - .pot_equals = _prop_dictionary_equals, - .pot_equals_finish = _prop_dictionary_equals_finish, - .pot_lock = _prop_dictionary_lock, - .pot_unlock = _prop_dictionary_unlock, -}; - -static _prop_object_free_rv_t - _prop_dict_keysym_free(prop_stack_t, prop_object_t *); -static bool _prop_dict_keysym_externalize( - struct _prop_object_externalize_context *, - void *); -static _prop_object_equals_rv_t - _prop_dict_keysym_equals(prop_object_t, prop_object_t, - void **, void **, - prop_object_t *, prop_object_t *); - -static const struct _prop_object_type _prop_object_type_dict_keysym = { - .pot_type = PROP_TYPE_DICT_KEYSYM, - .pot_free = _prop_dict_keysym_free, - .pot_extern = _prop_dict_keysym_externalize, - .pot_equals = _prop_dict_keysym_equals, -}; - -#define prop_object_is_dictionary(x) \ - ((x) != NULL && (x)->pd_obj.po_type == &_prop_object_type_dictionary) -#define prop_object_is_dictionary_keysym(x) \ - ((x) != NULL && (x)->pdk_obj.po_type == &_prop_object_type_dict_keysym) - -#define prop_dictionary_is_immutable(x) \ - (((x)->pd_flags & PD_F_IMMUTABLE) != 0) - -struct _prop_dictionary_iterator { - struct _prop_object_iterator pdi_base; - unsigned int pdi_index; -}; - -/* - * Dictionary key symbols are immutable, and we are likely to have many - * duplicated key symbols. So, to save memory, we unique'ify key symbols - * so we only have to have one copy of each string. - */ - -static int -/*ARGSUSED*/ -_prop_dict_keysym_rb_compare_nodes(void *ctx _PROP_ARG_UNUSED, - const void *n1, const void *n2) -{ - const struct _prop_dictionary_keysym *pdk1 = n1; - const struct _prop_dictionary_keysym *pdk2 = n2; - - return strcmp(pdk1->pdk_key, pdk2->pdk_key); -} - -static int -/*ARGSUSED*/ -_prop_dict_keysym_rb_compare_key(void *ctx _PROP_ARG_UNUSED, - const void *n, const void *v) -{ - const struct _prop_dictionary_keysym *pdk = n; - const char *cp = v; - - return strcmp(pdk->pdk_key, cp); -} - -static const rb_tree_ops_t _prop_dict_keysym_rb_tree_ops = { - .rbto_compare_nodes = _prop_dict_keysym_rb_compare_nodes, - .rbto_compare_key = _prop_dict_keysym_rb_compare_key, - .rbto_node_offset = offsetof(struct _prop_dictionary_keysym, pdk_link), - .rbto_context = NULL -}; - -static struct rb_tree _prop_dict_keysym_tree; - -_PROP_ONCE_DECL(_prop_dict_init_once) -_PROP_MUTEX_DECL_STATIC(_prop_dict_keysym_tree_mutex) - -static int -_prop_dict_init(void) -{ - - _PROP_MUTEX_INIT(_prop_dict_keysym_tree_mutex); - _prop_rb_tree_init(&_prop_dict_keysym_tree, - &_prop_dict_keysym_rb_tree_ops); - return 0; -} - -static void -_prop_dict_keysym_put(prop_dictionary_keysym_t pdk) -{ - - if (pdk->pdk_size <= PDK_SIZE_16) - _PROP_POOL_PUT(_prop_dictionary_keysym16_pool, pdk); - else if (pdk->pdk_size <= PDK_SIZE_32) - _PROP_POOL_PUT(_prop_dictionary_keysym32_pool, pdk); - else { - _PROP_ASSERT(pdk->pdk_size <= PDK_SIZE_128); - _PROP_POOL_PUT(_prop_dictionary_keysym128_pool, pdk); - } -} - -/* ARGSUSED */ -static _prop_object_free_rv_t -_prop_dict_keysym_free(prop_stack_t stack, prop_object_t *obj) -{ - prop_dictionary_keysym_t pdk = *obj; - - _prop_rb_tree_remove_node(&_prop_dict_keysym_tree, pdk); - _prop_dict_keysym_put(pdk); - - return _PROP_OBJECT_FREE_DONE; -} - -static bool -_prop_dict_keysym_externalize(struct _prop_object_externalize_context *ctx, - void *v) -{ - prop_dictionary_keysym_t pdk = v; - - /* We externalize these as strings, and they're never empty. */ - - _PROP_ASSERT(pdk->pdk_key[0] != '\0'); - - if (_prop_object_externalize_start_tag(ctx, "string") == false || - _prop_object_externalize_append_encoded_cstring(ctx, - pdk->pdk_key) == false || - _prop_object_externalize_end_tag(ctx, "string") == false) - return (false); - - return (true); -} - -/* ARGSUSED */ -static _prop_object_equals_rv_t -_prop_dict_keysym_equals(prop_object_t v1, prop_object_t v2, - void **stored_pointer1, void **stored_pointer2, - prop_object_t *next_obj1, prop_object_t *next_obj2) -{ - prop_dictionary_keysym_t pdk1 = v1; - prop_dictionary_keysym_t pdk2 = v2; - - /* - * There is only ever one copy of a keysym at any given time, - * so we can reduce this to a simple pointer equality check. - */ - if (pdk1 == pdk2) - return _PROP_OBJECT_EQUALS_TRUE; - else - return _PROP_OBJECT_EQUALS_FALSE; -} - -static prop_dictionary_keysym_t -_prop_dict_keysym_alloc(const char *key) -{ - prop_dictionary_keysym_t opdk, pdk, rpdk; - size_t size; - - _PROP_ONCE_RUN(_prop_dict_init_once, _prop_dict_init); - - /* - * Check to see if this already exists in the tree. If it does, - * we just retain it and return it. - */ - _PROP_MUTEX_LOCK(_prop_dict_keysym_tree_mutex); - opdk = _prop_rb_tree_find(&_prop_dict_keysym_tree, key); - if (opdk != NULL) { - prop_object_retain(opdk); - _PROP_MUTEX_UNLOCK(_prop_dict_keysym_tree_mutex); - return (opdk); - } - _PROP_MUTEX_UNLOCK(_prop_dict_keysym_tree_mutex); - - /* - * Not in the tree. Create it now. - */ - - size = sizeof(*pdk) + strlen(key) /* pdk_key[1] covers the NUL */; - - if (size <= PDK_SIZE_16) - pdk = _PROP_POOL_GET(_prop_dictionary_keysym16_pool); - else if (size <= PDK_SIZE_32) - pdk = _PROP_POOL_GET(_prop_dictionary_keysym32_pool); - else if (size <= PDK_SIZE_128) - pdk = _PROP_POOL_GET(_prop_dictionary_keysym128_pool); - else - pdk = NULL; /* key too long */ - - if (pdk == NULL) - return (NULL); - - _prop_object_init(&pdk->pdk_obj, &_prop_object_type_dict_keysym); - - strcpy(pdk->pdk_key, key); - pdk->pdk_size = size; - - /* - * We dropped the mutex when we allocated the new object, so - * we have to check again if it is in the tree. - */ - _PROP_MUTEX_LOCK(_prop_dict_keysym_tree_mutex); - opdk = _prop_rb_tree_find(&_prop_dict_keysym_tree, key); - if (opdk != NULL) { - prop_object_retain(opdk); - _PROP_MUTEX_UNLOCK(_prop_dict_keysym_tree_mutex); - _prop_dict_keysym_put(pdk); - return (opdk); - } - rpdk = _prop_rb_tree_insert_node(&_prop_dict_keysym_tree, pdk); - _PROP_ASSERT(rpdk == pdk); - _PROP_MUTEX_UNLOCK(_prop_dict_keysym_tree_mutex); - return (rpdk); -} - -static _prop_object_free_rv_t -_prop_dictionary_free(prop_stack_t stack, prop_object_t *obj) -{ - prop_dictionary_t pd = *obj; - prop_dictionary_keysym_t pdk; - prop_object_t po; - - _PROP_ASSERT(pd->pd_count <= pd->pd_capacity); - _PROP_ASSERT((pd->pd_capacity == 0 && pd->pd_array == NULL) || - (pd->pd_capacity != 0 && pd->pd_array != NULL)); - - /* The empty dictorinary is easy, handle that first. */ - if (pd->pd_count == 0) { - if (pd->pd_array != NULL) - _PROP_FREE(pd->pd_array, M_PROP_DICT); - - _PROP_RWLOCK_DESTROY(pd->pd_rwlock); - - _PROP_POOL_PUT(_prop_dictionary_pool, pd); - - return (_PROP_OBJECT_FREE_DONE); - } - - po = pd->pd_array[pd->pd_count - 1].pde_objref; - _PROP_ASSERT(po != NULL); - - if (stack == NULL) { - /* - * If we are in emergency release mode, - * just let caller recurse down. - */ - *obj = po; - return (_PROP_OBJECT_FREE_FAILED); - } - - /* Otherwise, try to push the current object on the stack. */ - if (!_prop_stack_push(stack, pd, NULL, NULL, NULL)) { - /* Push failed, entering emergency release mode. */ - return (_PROP_OBJECT_FREE_FAILED); - } - /* Object pushed on stack, caller will release it. */ - --pd->pd_count; - pdk = pd->pd_array[pd->pd_count].pde_key; - _PROP_ASSERT(pdk != NULL); - - prop_object_release(pdk); - - *obj = po; - return (_PROP_OBJECT_FREE_RECURSE); -} - - -static void -_prop_dictionary_lock(void) -{ - - /* XXX: once necessary or paranoia? */ - _PROP_ONCE_RUN(_prop_dict_init_once, _prop_dict_init); - _PROP_MUTEX_LOCK(_prop_dict_keysym_tree_mutex); -} - -static void -_prop_dictionary_unlock(void) -{ - _PROP_MUTEX_UNLOCK(_prop_dict_keysym_tree_mutex); -} - -static void -_prop_dictionary_emergency_free(prop_object_t obj) -{ - prop_dictionary_t pd = obj; - prop_dictionary_keysym_t pdk; - - _PROP_ASSERT(pd->pd_count != 0); - --pd->pd_count; - - pdk = pd->pd_array[pd->pd_count].pde_key; - _PROP_ASSERT(pdk != NULL); - prop_object_release(pdk); -} - -static bool -_prop_dictionary_externalize(struct _prop_object_externalize_context *ctx, - void *v) -{ - prop_dictionary_t pd = v; - prop_dictionary_keysym_t pdk; - struct _prop_object *po; - prop_object_iterator_t pi; - unsigned int i; - bool rv = false; - - _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); - - if (pd->pd_count == 0) { - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - return (_prop_object_externalize_empty_tag(ctx, "dict")); - } - - if (_prop_object_externalize_start_tag(ctx, "dict") == false || - _prop_object_externalize_append_char(ctx, '\n') == false) - goto out; - - pi = _prop_dictionary_iterator_locked(pd); - if (pi == NULL) - goto out; - - ctx->poec_depth++; - _PROP_ASSERT(ctx->poec_depth != 0); - - while ((pdk = _prop_dictionary_iterator_next_object_locked(pi)) - != NULL) { - po = _prop_dictionary_get_keysym(pd, pdk, true); - if (po == NULL || - _prop_object_externalize_start_tag(ctx, "key") == false || - _prop_object_externalize_append_encoded_cstring(ctx, - pdk->pdk_key) == false || - _prop_object_externalize_end_tag(ctx, "key") == false || - (*po->po_type->pot_extern)(ctx, po) == false) { - prop_object_iterator_release(pi); - goto out; - } - } - - prop_object_iterator_release(pi); - - ctx->poec_depth--; - for (i = 0; i < ctx->poec_depth; i++) { - if (_prop_object_externalize_append_char(ctx, '\t') == false) - goto out; - } - if (_prop_object_externalize_end_tag(ctx, "dict") == false) - goto out; - - rv = true; - - out: - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - return (rv); -} - -/* ARGSUSED */ -static _prop_object_equals_rv_t -_prop_dictionary_equals(prop_object_t v1, prop_object_t v2, - void **stored_pointer1, void **stored_pointer2, - prop_object_t *next_obj1, prop_object_t *next_obj2) -{ - prop_dictionary_t dict1 = v1; - prop_dictionary_t dict2 = v2; - uintptr_t idx; - _prop_object_equals_rv_t rv = _PROP_OBJECT_EQUALS_FALSE; - - if (dict1 == dict2) - return (_PROP_OBJECT_EQUALS_TRUE); - - _PROP_ASSERT(*stored_pointer1 == *stored_pointer2); - - idx = (uintptr_t)*stored_pointer1; - - if (idx == 0) { - if ((uintptr_t)dict1 < (uintptr_t)dict2) { - _PROP_RWLOCK_RDLOCK(dict1->pd_rwlock); - _PROP_RWLOCK_RDLOCK(dict2->pd_rwlock); - } else { - _PROP_RWLOCK_RDLOCK(dict2->pd_rwlock); - _PROP_RWLOCK_RDLOCK(dict1->pd_rwlock); - } - } - - if (dict1->pd_count != dict2->pd_count) - goto out; - - if (idx == dict1->pd_count) { - rv = _PROP_OBJECT_EQUALS_TRUE; - goto out; - } - - _PROP_ASSERT(idx < dict1->pd_count); - - *stored_pointer1 = (void *)(idx + 1); - *stored_pointer2 = (void *)(idx + 1); - - *next_obj1 = dict1->pd_array[idx].pde_objref; - *next_obj2 = dict2->pd_array[idx].pde_objref; - - if (!prop_dictionary_keysym_equals(dict1->pd_array[idx].pde_key, - dict2->pd_array[idx].pde_key)) - goto out; - - return (_PROP_OBJECT_EQUALS_RECURSE); - - out: - _PROP_RWLOCK_UNLOCK(dict1->pd_rwlock); - _PROP_RWLOCK_UNLOCK(dict2->pd_rwlock); - return (rv); -} - -static void -_prop_dictionary_equals_finish(prop_object_t v1, prop_object_t v2) -{ - _PROP_RWLOCK_UNLOCK(((prop_dictionary_t)v1)->pd_rwlock); - _PROP_RWLOCK_UNLOCK(((prop_dictionary_t)v2)->pd_rwlock); -} - -static prop_dictionary_t -_prop_dictionary_alloc(unsigned int capacity) -{ - prop_dictionary_t pd; - struct _prop_dict_entry *array; - - if (capacity != 0) { - array = _PROP_CALLOC(capacity * sizeof(*array), M_PROP_DICT); - if (array == NULL) - return (NULL); - } else - array = NULL; - - pd = _PROP_POOL_GET(_prop_dictionary_pool); - if (pd != NULL) { - _prop_object_init(&pd->pd_obj, &_prop_object_type_dictionary); - - _PROP_RWLOCK_INIT(pd->pd_rwlock); - pd->pd_array = array; - pd->pd_capacity = capacity; - pd->pd_count = 0; - pd->pd_flags = 0; - - pd->pd_version = 0; - } else if (array != NULL) - _PROP_FREE(array, M_PROP_DICT); - - return (pd); -} - -static bool -_prop_dictionary_expand(prop_dictionary_t pd, unsigned int capacity) -{ - struct _prop_dict_entry *array, *oarray; - - /* - * Dictionary must be WRITE-LOCKED. - */ - - oarray = pd->pd_array; - - array = _PROP_CALLOC(capacity * sizeof(*array), M_PROP_DICT); - if (array == NULL) - return (false); - if (oarray != NULL) - memcpy(array, oarray, pd->pd_capacity * sizeof(*array)); - pd->pd_array = array; - pd->pd_capacity = capacity; - - if (oarray != NULL) - _PROP_FREE(oarray, M_PROP_DICT); - - return (true); -} - -static prop_object_t -_prop_dictionary_iterator_next_object_locked(void *v) -{ - struct _prop_dictionary_iterator *pdi = v; - prop_dictionary_t pd = pdi->pdi_base.pi_obj; - prop_dictionary_keysym_t pdk = NULL; - - _PROP_ASSERT(prop_object_is_dictionary(pd)); - - if (pd->pd_version != pdi->pdi_base.pi_version) - goto out; /* dictionary changed during iteration */ - - _PROP_ASSERT(pdi->pdi_index <= pd->pd_count); - - if (pdi->pdi_index == pd->pd_count) - goto out; /* we've iterated all objects */ - - pdk = pd->pd_array[pdi->pdi_index].pde_key; - pdi->pdi_index++; - - out: - return (pdk); -} - -static prop_object_t -_prop_dictionary_iterator_next_object(void *v) -{ - struct _prop_dictionary_iterator *pdi = v; - prop_dictionary_t pd _PROP_ARG_UNUSED = pdi->pdi_base.pi_obj; - prop_dictionary_keysym_t pdk; - - _PROP_ASSERT(prop_object_is_dictionary(pd)); - - _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); - pdk = _prop_dictionary_iterator_next_object_locked(pdi); - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - return (pdk); -} - -static void -_prop_dictionary_iterator_reset_locked(void *v) -{ - struct _prop_dictionary_iterator *pdi = v; - prop_dictionary_t pd = pdi->pdi_base.pi_obj; - - _PROP_ASSERT(prop_object_is_dictionary(pd)); - - pdi->pdi_index = 0; - pdi->pdi_base.pi_version = pd->pd_version; -} - -static void -_prop_dictionary_iterator_reset(void *v) -{ - struct _prop_dictionary_iterator *pdi = v; -#if defined(__minix) && defined(_REENTRANT) - prop_dictionary_t pd _PROP_ARG_UNUSED = pdi->pdi_base.pi_obj; -#endif /* defined(__minix) && defined(_REENTRANT) */ - - _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); - _prop_dictionary_iterator_reset_locked(pdi); - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); -} - -/* - * prop_dictionary_create -- - * Create a dictionary. - */ -prop_dictionary_t -prop_dictionary_create(void) -{ - - return (_prop_dictionary_alloc(0)); -} - -/* - * prop_dictionary_create_with_capacity -- - * Create a dictionary with the capacity to store N objects. - */ -prop_dictionary_t -prop_dictionary_create_with_capacity(unsigned int capacity) -{ - - return (_prop_dictionary_alloc(capacity)); -} - -/* - * prop_dictionary_copy -- - * Copy a dictionary. The new dictionary has an initial capacity equal - * to the number of objects stored int the original dictionary. The new - * dictionary contains refrences to the original dictionary's objects, - * not copies of those objects (i.e. a shallow copy). - */ -prop_dictionary_t -prop_dictionary_copy(prop_dictionary_t opd) -{ - prop_dictionary_t pd; - prop_dictionary_keysym_t pdk; - prop_object_t po; - unsigned int idx; - - if (! prop_object_is_dictionary(opd)) - return (NULL); - - _PROP_RWLOCK_RDLOCK(opd->pd_rwlock); - - pd = _prop_dictionary_alloc(opd->pd_count); - if (pd != NULL) { - for (idx = 0; idx < opd->pd_count; idx++) { - pdk = opd->pd_array[idx].pde_key; - po = opd->pd_array[idx].pde_objref; - - prop_object_retain(pdk); - prop_object_retain(po); - - pd->pd_array[idx].pde_key = pdk; - pd->pd_array[idx].pde_objref = po; - } - pd->pd_count = opd->pd_count; - pd->pd_flags = opd->pd_flags; - } - _PROP_RWLOCK_UNLOCK(opd->pd_rwlock); - return (pd); -} - -/* - * prop_dictionary_copy_mutable -- - * Like prop_dictionary_copy(), but the resulting dictionary is - * mutable. - */ -prop_dictionary_t -prop_dictionary_copy_mutable(prop_dictionary_t opd) -{ - prop_dictionary_t pd; - - if (! prop_object_is_dictionary(opd)) - return (NULL); - - pd = prop_dictionary_copy(opd); - if (pd != NULL) - pd->pd_flags &= ~PD_F_IMMUTABLE; - - return (pd); -} - -/* - * prop_dictionary_make_immutable -- - * Set the immutable flag on that dictionary. - */ -void -prop_dictionary_make_immutable(prop_dictionary_t pd) -{ - - _PROP_RWLOCK_WRLOCK(pd->pd_rwlock); - if (prop_dictionary_is_immutable(pd) == false) - pd->pd_flags |= PD_F_IMMUTABLE; - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); -} - -/* - * prop_dictionary_count -- - * Return the number of objects stored in the dictionary. - */ -unsigned int -prop_dictionary_count(prop_dictionary_t pd) -{ - unsigned int rv; - - if (! prop_object_is_dictionary(pd)) - return (0); - - _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); - rv = pd->pd_count; - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - - return (rv); -} - -/* - * prop_dictionary_ensure_capacity -- - * Ensure that the dictionary has the capacity to store the specified - * total number of objects (including the objects already stored in - * the dictionary). - */ -bool -prop_dictionary_ensure_capacity(prop_dictionary_t pd, unsigned int capacity) -{ - bool rv; - - if (! prop_object_is_dictionary(pd)) - return (false); - - _PROP_RWLOCK_WRLOCK(pd->pd_rwlock); - if (capacity > pd->pd_capacity) - rv = _prop_dictionary_expand(pd, capacity); - else - rv = true; - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - return (rv); -} - -static prop_object_iterator_t -_prop_dictionary_iterator_locked(prop_dictionary_t pd) -{ - struct _prop_dictionary_iterator *pdi; - - if (! prop_object_is_dictionary(pd)) - return (NULL); - - pdi = _PROP_CALLOC(sizeof(*pdi), M_TEMP); - if (pdi == NULL) - return (NULL); - pdi->pdi_base.pi_next_object = _prop_dictionary_iterator_next_object; - pdi->pdi_base.pi_reset = _prop_dictionary_iterator_reset; - prop_object_retain(pd); - pdi->pdi_base.pi_obj = pd; - _prop_dictionary_iterator_reset_locked(pdi); - - return (&pdi->pdi_base); -} - -/* - * prop_dictionary_iterator -- - * Return an iterator for the dictionary. The dictionary is retained by - * the iterator. - */ -prop_object_iterator_t -prop_dictionary_iterator(prop_dictionary_t pd) -{ - prop_object_iterator_t pi; - - _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); - pi = _prop_dictionary_iterator_locked(pd); - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - return (pi); -} - -/* - * prop_dictionary_all_keys -- - * Return an array containing a snapshot of all of the keys - * in the dictionary. - */ -prop_array_t -prop_dictionary_all_keys(prop_dictionary_t pd) -{ - prop_array_t array; - unsigned int idx; - bool rv = true; - - if (! prop_object_is_dictionary(pd)) - return (NULL); - - /* There is no pressing need to lock the dictionary for this. */ - array = prop_array_create_with_capacity(pd->pd_count); - - _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); - - for (idx = 0; idx < pd->pd_count; idx++) { - rv = prop_array_add(array, pd->pd_array[idx].pde_key); - if (rv == false) - break; - } - - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - - if (rv == false) { - prop_object_release(array); - array = NULL; - } - return (array); -} - -static struct _prop_dict_entry * -_prop_dict_lookup(prop_dictionary_t pd, const char *key, - unsigned int *idxp) -{ - struct _prop_dict_entry *pde; - unsigned int base, idx, distance; - int res; - - /* - * Dictionary must be READ-LOCKED or WRITE-LOCKED. - */ - - for (idx = 0, base = 0, distance = pd->pd_count; distance != 0; - distance >>= 1) { - idx = base + (distance >> 1); - pde = &pd->pd_array[idx]; - _PROP_ASSERT(pde->pde_key != NULL); - res = strcmp(key, pde->pde_key->pdk_key); - if (res == 0) { - if (idxp != NULL) - *idxp = idx; - return (pde); - } - if (res > 0) { /* key > pdk_key: move right */ - base = idx + 1; - distance--; - } /* else move left */ - } - - /* idx points to the slot we looked at last. */ - if (idxp != NULL) - *idxp = idx; - return (NULL); -} - -static prop_object_t -_prop_dictionary_get(prop_dictionary_t pd, const char *key, bool locked) -{ - const struct _prop_dict_entry *pde; - prop_object_t po = NULL; - - if (! prop_object_is_dictionary(pd)) - return (NULL); - -#if defined(__minix) && defined(_REENTRANT) - if (!locked) - _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); -#endif /* defined(__minix) && defined(_REENTRANT) */ - pde = _prop_dict_lookup(pd, key, NULL); - if (pde != NULL) { - _PROP_ASSERT(pde->pde_objref != NULL); - po = pde->pde_objref; - } -#if defined(__minix) && defined(_REENTRANT) - if (!locked) - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); -#endif /* defined(__minix) && defined(_REENTRANT) */ - return (po); -} -/* - * prop_dictionary_get -- - * Return the object stored with specified key. - */ -prop_object_t -prop_dictionary_get(prop_dictionary_t pd, const char *key) -{ - prop_object_t po = NULL; - - if (! prop_object_is_dictionary(pd)) - return (NULL); - - _PROP_RWLOCK_RDLOCK(pd->pd_rwlock); - po = _prop_dictionary_get(pd, key, true); - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - return (po); -} - -static prop_object_t -_prop_dictionary_get_keysym(prop_dictionary_t pd, prop_dictionary_keysym_t pdk, - bool locked) -{ - - if (! (prop_object_is_dictionary(pd) && - prop_object_is_dictionary_keysym(pdk))) - return (NULL); - - return (_prop_dictionary_get(pd, pdk->pdk_key, locked)); -} - -/* - * prop_dictionary_get_keysym -- - * Return the object stored at the location encoded by the keysym. - */ -prop_object_t -prop_dictionary_get_keysym(prop_dictionary_t pd, prop_dictionary_keysym_t pdk) -{ - - return (_prop_dictionary_get_keysym(pd, pdk, false)); -} - -/* - * prop_dictionary_set -- - * Store a reference to an object at with the specified key. - * If the key already exisit, the original object is released. - */ -bool -prop_dictionary_set(prop_dictionary_t pd, const char *key, prop_object_t po) -{ - struct _prop_dict_entry *pde; - prop_dictionary_keysym_t pdk; - unsigned int idx; - bool rv = false; - - if (! prop_object_is_dictionary(pd)) - return (false); - - _PROP_ASSERT(pd->pd_count <= pd->pd_capacity); - - if (prop_dictionary_is_immutable(pd)) - return (false); - - _PROP_RWLOCK_WRLOCK(pd->pd_rwlock); - - pde = _prop_dict_lookup(pd, key, &idx); - if (pde != NULL) { - prop_object_t opo = pde->pde_objref; - prop_object_retain(po); - pde->pde_objref = po; - prop_object_release(opo); - rv = true; - goto out; - } - - pdk = _prop_dict_keysym_alloc(key); - if (pdk == NULL) - goto out; - - if (pd->pd_count == pd->pd_capacity && - _prop_dictionary_expand(pd, - pd->pd_capacity + EXPAND_STEP) == false) { - prop_object_release(pdk); - goto out; - } - - /* At this point, the store will succeed. */ - prop_object_retain(po); - - if (pd->pd_count == 0) { - pd->pd_array[0].pde_key = pdk; - pd->pd_array[0].pde_objref = po; - pd->pd_count++; - pd->pd_version++; - rv = true; - goto out; - } - - pde = &pd->pd_array[idx]; - _PROP_ASSERT(pde->pde_key != NULL); - - if (strcmp(key, pde->pde_key->pdk_key) < 0) { - /* - * key < pdk_key: insert to the left. This is the same as - * inserting to the right, except we decrement the current - * index first. - * - * Because we're unsigned, we have to special case 0 - * (grumble). - */ - if (idx == 0) { - memmove(&pd->pd_array[1], &pd->pd_array[0], - pd->pd_count * sizeof(*pde)); - pd->pd_array[0].pde_key = pdk; - pd->pd_array[0].pde_objref = po; - pd->pd_count++; - pd->pd_version++; - rv = true; - goto out; - } - idx--; - } - - memmove(&pd->pd_array[idx + 2], &pd->pd_array[idx + 1], - (pd->pd_count - (idx + 1)) * sizeof(*pde)); - pd->pd_array[idx + 1].pde_key = pdk; - pd->pd_array[idx + 1].pde_objref = po; - pd->pd_count++; - - pd->pd_version++; - - rv = true; - - out: - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); - return (rv); -} - -/* - * prop_dictionary_set_keysym -- - * Replace the object in the dictionary at the location encoded by - * the keysym. - */ -bool -prop_dictionary_set_keysym(prop_dictionary_t pd, prop_dictionary_keysym_t pdk, - prop_object_t po) -{ - - if (! (prop_object_is_dictionary(pd) && - prop_object_is_dictionary_keysym(pdk))) - return (false); - - return (prop_dictionary_set(pd, pdk->pdk_key, po)); -} - -static void -_prop_dictionary_remove(prop_dictionary_t pd, struct _prop_dict_entry *pde, - unsigned int idx) -{ - prop_dictionary_keysym_t pdk = pde->pde_key; - prop_object_t po = pde->pde_objref; - - /* - * Dictionary must be WRITE-LOCKED. - */ - - _PROP_ASSERT(pd->pd_count != 0); - _PROP_ASSERT(idx < pd->pd_count); - _PROP_ASSERT(pde == &pd->pd_array[idx]); - - idx++; - memmove(&pd->pd_array[idx - 1], &pd->pd_array[idx], - (pd->pd_count - idx) * sizeof(*pde)); - pd->pd_count--; - pd->pd_version++; - - - prop_object_release(pdk); - - prop_object_release(po); -} - -/* - * prop_dictionary_remove -- - * Remove the reference to an object with the specified key from - * the dictionary. - */ -void -prop_dictionary_remove(prop_dictionary_t pd, const char *key) -{ - struct _prop_dict_entry *pde; - unsigned int idx; - - if (! prop_object_is_dictionary(pd)) - return; - - _PROP_RWLOCK_WRLOCK(pd->pd_rwlock); - - /* XXX Should this be a _PROP_ASSERT()? */ - if (prop_dictionary_is_immutable(pd)) - goto out; - - pde = _prop_dict_lookup(pd, key, &idx); - /* XXX Should this be a _PROP_ASSERT()? */ - if (pde == NULL) - goto out; - - _prop_dictionary_remove(pd, pde, idx); - out: - _PROP_RWLOCK_UNLOCK(pd->pd_rwlock); -} - -/* - * prop_dictionary_remove_keysym -- - * Remove a reference to an object stored in the dictionary at the - * location encoded by the keysym. - */ -void -prop_dictionary_remove_keysym(prop_dictionary_t pd, - prop_dictionary_keysym_t pdk) -{ - - if (! (prop_object_is_dictionary(pd) && - prop_object_is_dictionary_keysym(pdk))) - return; - - prop_dictionary_remove(pd, pdk->pdk_key); -} - -/* - * prop_dictionary_equals -- - * Return true if the two dictionaries are equivalent. Note we do a - * by-value comparison of the objects in the dictionary. - */ -bool -prop_dictionary_equals(prop_dictionary_t dict1, prop_dictionary_t dict2) -{ - if (!prop_object_is_dictionary(dict1) || - !prop_object_is_dictionary(dict2)) - return (false); - - return (prop_object_equals(dict1, dict2)); -} - -/* - * prop_dictionary_keysym_cstring_nocopy -- - * Return an immutable reference to the keysym's value. - */ -const char * -prop_dictionary_keysym_cstring_nocopy(prop_dictionary_keysym_t pdk) -{ - - if (! prop_object_is_dictionary_keysym(pdk)) - return (NULL); - - return (pdk->pdk_key); -} - -/* - * prop_dictionary_keysym_equals -- - * Return true if the two dictionary key symbols are equivalent. - * Note: We do not compare the object references. - */ -bool -prop_dictionary_keysym_equals(prop_dictionary_keysym_t pdk1, - prop_dictionary_keysym_t pdk2) -{ - if (!prop_object_is_dictionary_keysym(pdk1) || - !prop_object_is_dictionary_keysym(pdk2)) - return (false); - - return (prop_object_equals(pdk1, pdk2)); -} - -/* - * prop_dictionary_externalize -- - * Externalize a dictionary, returning a NUL-terminated buffer - * containing the XML-style representation. The buffer is allocated - * with the M_TEMP memory type. - */ -char * -prop_dictionary_externalize(prop_dictionary_t pd) -{ - struct _prop_object_externalize_context *ctx; - char *cp; - - ctx = _prop_object_externalize_context_alloc(); - if (ctx == NULL) - return (NULL); - - if (_prop_object_externalize_header(ctx) == false || - (*pd->pd_obj.po_type->pot_extern)(ctx, pd) == false || - _prop_object_externalize_footer(ctx) == false) { - /* We are responsible for releasing the buffer. */ - _PROP_FREE(ctx->poec_buf, M_TEMP); - _prop_object_externalize_context_free(ctx); - return (NULL); - } - - cp = ctx->poec_buf; - _prop_object_externalize_context_free(ctx); - - return (cp); -} - -/* - * _prop_dictionary_internalize -- - * Parse a ... and return the object created from the - * external representation. - * - * Internal state in via rec_data is the storage area for the last processed - * key. - * _prop_dictionary_internalize_body is the upper half of the parse loop. - * It is responsible for parsing the key directly and storing it in the area - * referenced by rec_data. - * _prop_dictionary_internalize_cont is the lower half and called with the value - * associated with the key. - */ -static bool _prop_dictionary_internalize_body(prop_stack_t, - prop_object_t *, struct _prop_object_internalize_context *, char *); - -bool -_prop_dictionary_internalize(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx) -{ - prop_dictionary_t dict; - char *tmpkey; - - /* We don't currently understand any attributes. */ - if (ctx->poic_tagattr != NULL) - return (true); - - dict = prop_dictionary_create(); - if (dict == NULL) - return (true); - - if (ctx->poic_is_empty_element) { - *obj = dict; - return (true); - } - - tmpkey = _PROP_MALLOC(PDK_MAXKEY + 1, M_TEMP); - if (tmpkey == NULL) { - prop_object_release(dict); - return (true); - } - - *obj = dict; - /* - * Opening tag is found, storage for key allocated and - * now continue to the first element. - */ - return _prop_dictionary_internalize_body(stack, obj, ctx, tmpkey); -} - -static bool -_prop_dictionary_internalize_continue(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx, void *data, prop_object_t child) -{ - prop_dictionary_t dict = *obj; - char *tmpkey = data; - - _PROP_ASSERT(tmpkey != NULL); - - if (child == NULL || - prop_dictionary_set(dict, tmpkey, child) == false) { - _PROP_FREE(tmpkey, M_TEMP); - if (child != NULL) - prop_object_release(child); - prop_object_release(dict); - *obj = NULL; - return (true); - } - - prop_object_release(child); - - /* - * key, value was added, now continue looking for the next key - * or the closing tag. - */ - return _prop_dictionary_internalize_body(stack, obj, ctx, tmpkey); -} - -static bool -_prop_dictionary_internalize_body(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx, char *tmpkey) -{ - prop_dictionary_t dict = *obj; - size_t keylen; - - /* Fetch the next tag. */ - if (_prop_object_internalize_find_tag(ctx, NULL, _PROP_TAG_TYPE_EITHER) == false) - goto bad; - - /* Check to see if this is the end of the dictionary. */ - if (_PROP_TAG_MATCH(ctx, "dict") && - ctx->poic_tag_type == _PROP_TAG_TYPE_END) { - _PROP_FREE(tmpkey, M_TEMP); - return (true); - } - - /* Ok, it must be a non-empty key start tag. */ - if (!_PROP_TAG_MATCH(ctx, "key") || - ctx->poic_tag_type != _PROP_TAG_TYPE_START || - ctx->poic_is_empty_element) - goto bad; - - if (_prop_object_internalize_decode_string(ctx, - tmpkey, PDK_MAXKEY, &keylen, - &ctx->poic_cp) == false) - goto bad; - - _PROP_ASSERT(keylen <= PDK_MAXKEY); - tmpkey[keylen] = '\0'; - - if (_prop_object_internalize_find_tag(ctx, "key", - _PROP_TAG_TYPE_END) == false) - goto bad; - - /* ..and now the beginning of the value. */ - if (_prop_object_internalize_find_tag(ctx, NULL, - _PROP_TAG_TYPE_START) == false) - goto bad; - - /* - * Key is found, now wait for value to be parsed. - */ - if (_prop_stack_push(stack, *obj, - _prop_dictionary_internalize_continue, - tmpkey, NULL)) - return (false); - - bad: - _PROP_FREE(tmpkey, M_TEMP); - prop_object_release(dict); - *obj = NULL; - return (true); -} - -/* - * prop_dictionary_internalize -- - * Create a dictionary by parsing the NUL-terminated XML-style - * representation. - */ -prop_dictionary_t -prop_dictionary_internalize(const char *xml) -{ - return _prop_generic_internalize(xml, "dict"); -} - -#if !defined(_KERNEL) && !defined(_STANDALONE) -/* - * prop_dictionary_externalize_to_file -- - * Externalize a dictionary to the specified file. - */ -bool -prop_dictionary_externalize_to_file(prop_dictionary_t dict, const char *fname) -{ - char *xml; - bool rv; - int save_errno = 0; /* XXXGCC -Wuninitialized [mips, ...] */ - - xml = prop_dictionary_externalize(dict); - if (xml == NULL) - return (false); - rv = _prop_object_externalize_write_file(fname, xml, strlen(xml)); - if (rv == false) - save_errno = errno; - _PROP_FREE(xml, M_TEMP); - if (rv == false) - errno = save_errno; - - return (rv); -} - -/* - * prop_dictionary_internalize_from_file -- - * Internalize a dictionary from a file. - */ -prop_dictionary_t -prop_dictionary_internalize_from_file(const char *fname) -{ - struct _prop_object_internalize_mapped_file *mf; - prop_dictionary_t dict; - - mf = _prop_object_internalize_map_file(fname); - if (mf == NULL) - return (NULL); - dict = prop_dictionary_internalize(mf->poimf_xml); - _prop_object_internalize_unmap_file(mf); - - return (dict); -} -#endif /* !_KERNEL && !_STANDALONE */ diff --git a/common/lib/libprop/prop_dictionary_util.3 b/common/lib/libprop/prop_dictionary_util.3 deleted file mode 100644 index b262357d9..000000000 --- a/common/lib/libprop/prop_dictionary_util.3 +++ /dev/null @@ -1,200 +0,0 @@ -.\" $NetBSD: prop_dictionary_util.3,v 1.8 2011/10/17 09:24:54 wiz Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd August 7, 2011 -.Dt PROP_DICTIONARY_UTIL 3 -.Os -.Sh NAME -.Nm prop_dictionary_util , -.Nm prop_dictionary_get_dict , -.Nm prop_dictionary_get_bool , -.Nm prop_dictionary_set_bool , -.Nm prop_dictionary_get_int8 , -.Nm prop_dictionary_get_uint8 , -.Nm prop_dictionary_set_int8 , -.Nm prop_dictionary_set_uint8 , -.Nm prop_dictionary_get_int16 , -.Nm prop_dictionary_get_uint16 , -.Nm prop_dictionary_set_int16 , -.Nm prop_dictionary_set_uint16 , -.Nm prop_dictionary_get_int32 , -.Nm prop_dictionary_get_uint32 , -.Nm prop_dictionary_set_int32 , -.Nm prop_dictionary_set_uint32 , -.Nm prop_dictionary_get_int64 , -.Nm prop_dictionary_get_uint64 , -.Nm prop_dictionary_set_int64 , -.Nm prop_dictionary_set_uint64 , -.Nm prop_dictionary_get_cstring , -.Nm prop_dictionary_set_cstring , -.Nm prop_dictionary_get_cstring_nocopy , -.Nm prop_dictionary_set_cstring_nocopy , -.Nm prop_dictionary_set_and_rel -.Nd dictionary property collection object utility functions -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft bool -.Fn prop_dictionary_get_dict "prop_dictionary_t dict" "const char *key" \ - "prop_dictionary_t *dictp" -.Ft bool -.Fn prop_dictionary_get_bool "prop_dictionary_t dict" "const char *key" \ - "bool *valp" -.Ft bool -.Fn prop_dictionary_set_bool "prop_dictionary_t dict" "const char *key" \ - "bool val" -.\" -.Ft bool -.Fn prop_dictionary_get_int8 "prop_dictionary_t dict" "const char *key" \ - "int8_t *valp" -.Ft bool -.Fn prop_dictionary_get_uint8 "prop_dictionary_t dict" "const char *key" \ - "uint8_t *valp" -.Ft bool -.Fn prop_dictionary_set_int8 "prop_dictionary_t dict" "const char *key" \ - "int8_t val" -.Ft bool -.Fn prop_dictionary_set_uint8 "prop_dictionary_t dict" "const char *key" \ - "uint8_t val" -.\" -.Ft bool -.Fn prop_dictionary_get_int16 "prop_dictionary_t dict" "const char *key" \ - "int16_t *valp" -.Ft bool -.Fn prop_dictionary_get_uint16 "prop_dictionary_t dict" "const char *key" \ - "uint16_t *valp" -.Ft bool -.Fn prop_dictionary_set_int16 "prop_dictionary_t dict" "const char *key" \ - "int16_t val" -.Ft bool -.Fn prop_dictionary_set_uint16 "prop_dictionary_t dict" "const char *key" \ - "uint16_t val" -.\" -.Ft bool -.Fn prop_dictionary_get_int32 "prop_dictionary_t dict" "const char *key" \ - "int32_t *valp" -.Ft bool -.Fn prop_dictionary_get_uint32 "prop_dictionary_t dict" "const char *key" \ - "uint32_t *valp" -.Ft bool -.Fn prop_dictionary_set_int32 "prop_dictionary_t dict" "const char *key" \ - "int32_t val" -.Ft bool -.Fn prop_dictionary_set_uint32 "prop_dictionary_t dict" "const char *key" \ - "uint32_t val" -.\" -.Ft bool -.Fn prop_dictionary_get_int64 "prop_dictionary_t dict" "const char *key" \ - "int64_t *valp" -.Ft bool -.Fn prop_dictionary_get_uint64 "prop_dictionary_t dict" "const char *key" \ - "uint64_t *valp" -.Ft bool -.Fn prop_dictionary_set_int64 "prop_dictionary_t dict" "const char *key" \ - "int64_t val" -.Ft bool -.Fn prop_dictionary_set_uint64 "prop_dictionary_t dict" "const char *key" \ - "uint64_t val" -.\" -.Ft bool -.Fn prop_dictionary_get_cstring "prop_dictionary_t dict" "const char *key" \ - "char **strp" -.Ft bool -.Fn prop_dictionary_set_cstring "prop_dictionary_t dict" "const char *key" \ - "const char *str" -.\" -.Ft bool -.Fn prop_dictionary_get_cstring_nocopy "prop_dictionary_t dict" \ - "const char *key" "const char **strp" -.Ft bool -.Fn prop_dictionary_set_cstring_nocopy "prop_dictionary_t dict" \ - "const char *key" "const char *strp" -.Ft bool -.Fn prop_dictionary_set_and_rel "prop_dictionary_t dict" \ - "const char *key" "prop_object_t obj" -.Sh DESCRIPTION -The -.Nm prop_dictionary_util -family of functions are provided to make getting and setting values in -dictionaries more convenient in some applications. -.Pp -The getters check the type of the returned object and, in some cases, also -ensure that the returned value is within the range implied by the getter's -value type. -.Pp -The setters handle object creation and release for the caller. -.Pp -The -.Fn prop_dictionary_get_cstring -function returns dynamically allocated memory. -See -.Xr prop_string 3 -for more information. -.Pp -The -.Fn prop_dictionary_get_cstring_nocopy -and -.Fn prop_dictionary_set_cstring_nocopy -functions do not copy the string that is set or returned. -See -.Xr prop_string 3 -for more information. -.Pp -The -.Fn prop_dictionary_set_and_rel -function adds the object to the dictionary and releases it. -The object is also released on failure. -.Sh RETURN VALUES -The -.Nm prop_dictionary_util -getter functions return -.Dv true -if the object exists in the dictionary and the value is in-range, or -.Dv false -otherwise. -.Pp -The -.Nm prop_dictionary_util -setter functions return -.Dv true -if creating the object and storing it in the dictionary is successful, or -.Dv false -otherwise. -.Sh SEE ALSO -.Xr prop_bool 3 , -.Xr prop_dictionary 3 , -.Xr prop_number 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_dictionary_util.c b/common/lib/libprop/prop_dictionary_util.c deleted file mode 100644 index 0b4867268..000000000 --- a/common/lib/libprop/prop_dictionary_util.c +++ /dev/null @@ -1,232 +0,0 @@ -/* $NetBSD: prop_dictionary_util.c,v 1.5 2012/07/27 09:10:59 pooka Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * Utility routines to make it more convenient to work with values - * stored in dictionaries. - * - * Note: There is no special magic going on here. We use the standard - * proplib(3) APIs to do all of this work. Any application could do - * exactly what we're doing here. - */ - -#include "prop_object_impl.h" /* only to hide kernel vs. not-kernel */ -#include - -bool -prop_dictionary_get_dict(prop_dictionary_t dict, const char *key, prop_dictionary_t *dp) -{ - prop_object_t o; - o = prop_dictionary_get(dict, key); - if (o == NULL || prop_object_type(o) != PROP_TYPE_DICTIONARY) - return false; - *dp = o; - return true; - -} - -bool -prop_dictionary_get_bool(prop_dictionary_t dict, - const char *key, - bool *valp) -{ - prop_bool_t b; - - b = prop_dictionary_get(dict, key); - if (prop_object_type(b) != PROP_TYPE_BOOL) - return (false); - - *valp = prop_bool_true(b); - - return (true); -} - -bool -prop_dictionary_set_bool(prop_dictionary_t dict, - const char *key, - bool val) -{ - prop_bool_t b; - int rv; - - b = prop_bool_create(val); - if (b == NULL) - return (false); - rv = prop_dictionary_set(dict, key, b); - prop_object_release(b); - - return (rv); -} - -#define TEMPLATE(size) \ -bool \ -prop_dictionary_get_int ## size (prop_dictionary_t dict, \ - const char *key, \ - int ## size ## _t *valp) \ -{ \ - prop_number_t num; \ - \ - num = prop_dictionary_get(dict, key); \ - if (prop_object_type(num) != PROP_TYPE_NUMBER) \ - return (false); \ - \ - if (prop_number_unsigned(num) && \ - prop_number_unsigned_integer_value(num) > \ - /*CONSTCOND*/((size) == 8 ? INT8_MAX : \ - (size) == 16 ? INT16_MAX : \ - (size) == 32 ? INT32_MAX : INT64_MAX)) { \ - return (false); \ - } \ - \ - if (prop_number_size(num) > (size)) \ - return (false); \ - \ - *valp = (int ## size ## _t) prop_number_integer_value(num); \ - \ - return (true); \ -} \ - \ -bool \ -prop_dictionary_get_uint ## size (prop_dictionary_t dict, \ - const char *key, \ - uint ## size ## _t *valp) \ -{ \ - prop_number_t num; \ - \ - num = prop_dictionary_get(dict, key); \ - if (prop_object_type(num) != PROP_TYPE_NUMBER) \ - return (false); \ - \ - if (prop_number_unsigned(num) == false && \ - prop_number_integer_value(num) < 0) { \ - return (false); \ - } \ - \ - if (prop_number_size(num) > (size)) \ - return (false); \ - \ - *valp = (uint ## size ## _t) \ - prop_number_unsigned_integer_value(num); \ - \ - return (true); \ -} \ - \ -bool \ -prop_dictionary_set_int ## size (prop_dictionary_t dict, \ - const char *key, \ - int ## size ## _t val) \ -{ \ - prop_number_t num; \ - int rv; \ - \ - num = prop_number_create_integer((int64_t) val); \ - if (num == NULL) \ - return (false); \ - rv = prop_dictionary_set(dict, key, num); \ - prop_object_release(num); \ - \ - return (rv); \ -} \ - \ -bool \ -prop_dictionary_set_uint ## size (prop_dictionary_t dict, \ - const char *key, \ - uint ## size ## _t val) \ -{ \ - prop_number_t num; \ - int rv; \ - \ - num = prop_number_create_unsigned_integer((uint64_t) val); \ - if (num == NULL) \ - return (false); \ - rv = prop_dictionary_set(dict, key, num); \ - prop_object_release(num); \ - \ - return (rv); \ -} - -TEMPLATE(8) -TEMPLATE(16) -TEMPLATE(32) -TEMPLATE(64) - -#undef TEMPLATE - -#define TEMPLATE(variant, qualifier) \ -bool \ -prop_dictionary_get_cstring ## variant (prop_dictionary_t dict, \ - const char *key, \ - qualifier char **cpp) \ -{ \ - prop_string_t str; \ - \ - str = prop_dictionary_get(dict, key); \ - if (prop_object_type(str) != PROP_TYPE_STRING) \ - return (false); \ - \ - *cpp = prop_string_cstring ## variant (str); \ - \ - return (*cpp == NULL ? false : true); \ -} \ - \ -bool \ -prop_dictionary_set_cstring ## variant (prop_dictionary_t dict, \ - const char *key, \ - const char *cp) \ -{ \ - prop_string_t str; \ - int rv; \ - \ - str = prop_string_create_cstring ## variant (cp); \ - if (str == NULL) \ - return (false); \ - rv = prop_dictionary_set(dict, key, str); \ - prop_object_release(str); \ - \ - return (rv); \ -} - -TEMPLATE(,) -TEMPLATE(_nocopy,const) - -#undef TEMPLATE - -bool -prop_dictionary_set_and_rel(prop_dictionary_t dict, const char *key, - prop_object_t po) -{ - bool ret; - if (po == NULL) - return false; - ret = prop_dictionary_set(dict, key, po); - prop_object_release(po); - return ret; -} diff --git a/common/lib/libprop/prop_ingest.3 b/common/lib/libprop/prop_ingest.3 deleted file mode 100644 index ae29f22a3..000000000 --- a/common/lib/libprop/prop_ingest.3 +++ /dev/null @@ -1,181 +0,0 @@ -.\" $NetBSD: prop_ingest.3,v 1.6 2010/02/18 14:00:39 wiz Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd January 21, 2008 -.Dt PROP_INGEST 3 -.Os -.Sh NAME -.Nm prop_ingest_context_alloc , -.Nm prop_ingest_context_free , -.Nm prop_ingest_context_error , -.Nm prop_ingest_context_type , -.Nm prop_ingest_context_key , -.Nm prop_ingest_context_private , -.Nm prop_dictionary_ingest -.Nd Ingest a dictionary into an arbitrary binary format -.Sh SYNOPSIS -.In prop/proplib.h -.Ft prop_ingest_context_t -.Fn prop_ingest_context_alloc "void *private" -.Ft void -.Fn prop_ingest_context_free "prop_ingest_context_t ctx" -.Ft prop_ingest_error_t -.Fn prop_ingest_context_error "prop_ingest_context_t ctx" -.Ft prop_type_t -.Fn prop_ingest_context_type "prop_ingest_context_t ctx" -.Ft const char * -.Fn prop_ingest_context_key "prop_ingest_context_t ctx" -.Ft void * -.Fn prop_ingest_context_private "prop_ingest_context_t ctx" -.Ft bool -.Fn prop_dictionary_ingest "prop_dictionary_t dict" \ - "const prop_ingest_table_entry rules[]" \ - "prop_ingest_context_t ctx" -.Pp -.Ft typedef bool -.Fn (*prop_ingest_handler_t) "prop_ingest_context_t" "prop_object_t" -.Sh DESCRIPTION -The -.Nm prop_dictionary_ingest -function provides a convenient way to convert a property list into -an arbitrary binary format or to extract values from dictionaries in a -way that is convenient to an application -.Pq for configuration files, for example . -.Pp -.Nm prop_dictionary_ingest -is driven by a table of rules provided by the application. -Each rule consists of three items: -.Bl -bullet -.It -A C string containing a key to be looked up in the dictionary. -.It -The expected property type of the object associated with the key -(or -.Dv PROP_TYPE_UNKNOWN -to specify that any type is allowed). -.It -A callback function of type -.Dv prop_ingest_handler_t -that will perform the translation for the application. -.El -.Pp -The table is constructed using a series of macros as follows: -.Bd -literal -static const prop_ingest_table_entry ingest_rules[] = { - PROP_INGEST("file-name", PROP_TYPE_STRING, ingest_filename), - PROP_INGEST("count", PROP_TYPE_NUMBER, ingest_count), - PROP_INGEST_OPTIONAL("required", PROP_TYPE_BOOL, ingest_required), - PROP_INGEST_OPTIONAL("extra", PROP_TYPE_UNKNOWN, ingest_extra), - PROP_INGEST_END -}; -.Ed -.Pp -The -.Dv PROP_INGEST -macro specifies that the key is required to be present in the dictionary. -The -.Dv PROP_INGEST_OPTIONAL -macro specifies that the presence of the key in the dictionary is optional. -The -.Dv PROP_INGEST_END -macro marks the end of the rules table. -.Pp -In each case, -.Nm prop_dictionary_ingest -looks up the rule's key in the dictionary. -If an object is present in the dictionary at that key, its type is checked -against the type specified in the rule. -A type specification of -.Dv PROP_TYPE_UNKNOWN -allows the object to be of any type. -If the object does not exist and the rule is not marked as optional, then -an error is returned. -Otherwise, the handler specified in the rule is invoked with the ingest -context and the object -(or -.Dv NULL -if the key does not exist in the dictionary). -The handler should return -.Dv false -if the value of the object is invalid to indicate failure and -.Dv true -otherwise. -.Pp -The ingest context contains several pieces of information that are -useful during the ingest process. -The context also provides specific error information should the ingest -fail. -.Bl -tag -width "xxxxx" -.It Fn prop_ingest_context_alloc "void *private" -Allocate an ingest context. -The argument -.Fa private -may be used to pass application-specific context to the ingest handlers. -Note that an ingest context can be re-used to perform multiple ingests. -Returns -.Dv NULL -on failure. -.It Fn prop_ingest_context_free "prop_ingest_context_t ctx" -Free an ingest context. -.It Fn prop_ingest_context_error "prop_ingest_context_t ctx" -Returns the code indicating the error encountered during ingest. -The following error codes are defined: -.Pp -.Bl -tag -width "PROP_INGEST_ERROR_HANDLER_FAILED" -compact -.It Dv PROP_INGEST_ERROR_NO_ERROR -No error was encountered during ingest. -.It Dv PROP_INGEST_ERROR_NO_KEY -A non-optional key was not found in the dictionary. -.It Dv PROP_INGEST_ERROR_WRONG_TYPE -An object in the dictionary was not the same type specified in the rules. -.It Dv PROP_INGEST_ERROR_HANDLER_FAILED -An object's handler returned -.Dv false . -.El -.Pp -.It Fn prop_ingest_context_type "prop_ingest_context_t ctx" -Returns the type of the last object visited during an ingest. -When called by an ingest handler, it returns the type of the object -currently being processed. -.It Fn prop_ingest_context_key "prop_ingest_context_t ctx" -Returns the last dictionary key looked up during an ingest. -When called by an ingest handler, it returns the dictionary key corresponding -to the object currently being processed. -.It Fn prop_ingest_context_private "prop_ingest_context_t ctx" -Returns the private data set when the context was allocated with -.Fn prop_ingest_context_alloc . -.El -.Sh SEE ALSO -.Xr prop_dictionary 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_ingest.c b/common/lib/libprop/prop_ingest.c deleted file mode 100644 index 5d3c63a04..000000000 --- a/common/lib/libprop/prop_ingest.c +++ /dev/null @@ -1,159 +0,0 @@ -/* $NetBSD: prop_ingest.c,v 1.5 2014/09/05 05:19:24 matt Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "prop_object_impl.h" -#include - -struct _prop_ingest_context { - prop_ingest_error_t pic_error; - prop_type_t pic_type; - const char * pic_key; - void * pic_private; -}; - -/* - * prop_ingest_context_alloc -- - * Allocate and initialize an ingest context. - */ -prop_ingest_context_t -prop_ingest_context_alloc(void *xprivate) -{ - prop_ingest_context_t ctx; - - ctx = _PROP_MALLOC(sizeof(*ctx), M_TEMP); - if (ctx != NULL) { - ctx->pic_error = PROP_INGEST_ERROR_NO_ERROR; - ctx->pic_type = PROP_TYPE_UNKNOWN; - ctx->pic_key = NULL; - ctx->pic_private = xprivate; - } - return (ctx); -} - -/* - * prop_ingest_context_free -- - * Free an ingest context. - */ -void -prop_ingest_context_free(prop_ingest_context_t ctx) -{ - - _PROP_FREE(ctx, M_TEMP); -} - -/* - * prop_ingest_context_error -- - * Get the error code from an ingest context. - */ -prop_ingest_error_t -prop_ingest_context_error(prop_ingest_context_t ctx) -{ - - return (ctx->pic_error); -} - -/* - * prop_ingest_context_type -- - * Return the type of last object visisted by an ingest context. - */ -prop_type_t -prop_ingest_context_type(prop_ingest_context_t ctx) -{ - - return (ctx->pic_type); -} - -/* - * prop_ingest_context_key -- - * Return the last key looked up by an ingest context. - */ -const char * -prop_ingest_context_key(prop_ingest_context_t ctx) -{ - - return (ctx->pic_key); -} - -/* - * prop_ingest_context_private -- - * Return the caller-private data associated with an ingest context. - */ -void * -prop_ingest_context_private(prop_ingest_context_t ctx) -{ - - return (ctx->pic_private); -} - -/* - * prop_dictionary_ingest -- - * Ingest a dictionary using handlers for each object to translate - * into an arbitrary binary format. - */ -bool -prop_dictionary_ingest(prop_dictionary_t dict, - const prop_ingest_table_entry rules[], - prop_ingest_context_t ctx) -{ - const prop_ingest_table_entry *pite; - prop_object_t obj; - - ctx->pic_error = PROP_INGEST_ERROR_NO_ERROR; - - for (pite = rules; pite->pite_key != NULL; pite++) { - ctx->pic_key = pite->pite_key; - obj = prop_dictionary_get(dict, pite->pite_key); - ctx->pic_type = prop_object_type(obj); - if (obj == NULL) { - if (pite->pite_flags & PROP_INGEST_FLAG_OPTIONAL) { - if ((*pite->pite_handler)(ctx, NULL) == false) { - ctx->pic_error = - PROP_INGEST_ERROR_HANDLER_FAILED; - return (false); - } - continue; - } - ctx->pic_error = PROP_INGEST_ERROR_NO_KEY; - return (false); - } - if (ctx->pic_type != pite->pite_type && - pite->pite_type != PROP_TYPE_UNKNOWN) { - ctx->pic_error = PROP_INGEST_ERROR_WRONG_TYPE; - return (false); - } - if ((*pite->pite_handler)(ctx, obj) == false) { - ctx->pic_error = PROP_INGEST_ERROR_HANDLER_FAILED; - return (false); - } - } - - return (true); -} diff --git a/common/lib/libprop/prop_kern.c b/common/lib/libprop/prop_kern.c deleted file mode 100644 index beb5d04d9..000000000 --- a/common/lib/libprop/prop_kern.c +++ /dev/null @@ -1,601 +0,0 @@ -/* $NetBSD: prop_kern.c,v 1.19 2015/05/11 16:48:34 christos Exp $ */ - -/*- - * Copyright (c) 2006, 2009 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#if defined(__NetBSD__) - -#include -#include - -#include - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#include -#include - -#ifdef RUMP_ACTION -#include -#define ioctl(a,b,c) rump_sys_ioctl(a,b,c) -#endif - -static int -_prop_object_externalize_to_pref(prop_object_t obj, struct plistref *pref, - char **bufp) -{ - char *buf; - - switch (prop_object_type(obj)) { - case PROP_TYPE_DICTIONARY: - buf = prop_dictionary_externalize(obj); - break; - case PROP_TYPE_ARRAY: - buf = prop_array_externalize(obj); - break; - default: - return (ENOTSUP); - } - if (buf == NULL) { - /* Assume we ran out of memory. */ - return (ENOMEM); - } - pref->pref_plist = buf; - pref->pref_len = strlen(buf) + 1; - - *bufp = buf; - - return (0); -} - -bool -prop_array_externalize_to_pref(prop_array_t array, struct plistref *prefp) -{ - char *buf; - int rv; - - rv = _prop_object_externalize_to_pref(array, prefp, &buf); - if (rv != 0) - errno = rv; /* pass up error value in errno */ - return (rv == 0); -} - -/* - * prop_array_externalize_to_pref -- - * Externalize an array into a plistref for sending to the kernel. - */ -int -prop_array_send_syscall(prop_array_t array, struct plistref *prefp) -{ - if (prop_array_externalize_to_pref(array, prefp)) - return 0; - else - return errno; -} - -bool -prop_dictionary_externalize_to_pref(prop_dictionary_t dict, - struct plistref *prefp) -{ - char *buf; - int rv; - - rv = _prop_object_externalize_to_pref(dict, prefp, &buf); - if (rv != 0) - errno = rv; /* pass up error value in errno */ - return (rv == 0); -} - -/* - * prop_dictionary_externalize_to_pref -- - * Externalize an dictionary into a plistref for sending to the kernel. - */ -int -prop_dictionary_send_syscall(prop_dictionary_t dict, - struct plistref *prefp) -{ - if (prop_dictionary_externalize_to_pref(dict, prefp)) - return 0; - else - return errno; -} - -static int -_prop_object_send_ioctl(prop_object_t obj, int fd, unsigned long cmd) -{ - struct plistref pref; - char *buf; - int error; - - error = _prop_object_externalize_to_pref(obj, &pref, &buf); - if (error) - return (error); - - if (ioctl(fd, cmd, &pref) == -1) - error = errno; - else - error = 0; - - free(buf); - - return (error); -} - -/* - * prop_array_send_ioctl -- - * Send an array to the kernel using the specified ioctl. - */ -int -prop_array_send_ioctl(prop_array_t array, int fd, unsigned long cmd) -{ - int rv; - - rv = _prop_object_send_ioctl(array, fd, cmd); - if (rv != 0) { - errno = rv; /* pass up error value in errno */ - return rv; - } else - return 0; -} - -/* - * prop_dictionary_send_ioctl -- - * Send a dictionary to the kernel using the specified ioctl. - */ -int -prop_dictionary_send_ioctl(prop_dictionary_t dict, int fd, unsigned long cmd) -{ - int rv; - - rv = _prop_object_send_ioctl(dict, fd, cmd); - if (rv != 0) { - errno = rv; /* pass up error value in errno */ - return rv; - } else - return 0; -} - -static int -_prop_object_internalize_from_pref(const struct plistref *pref, - prop_type_t type, prop_object_t *objp) -{ - prop_object_t obj = NULL; - char *buf; - int error = 0; - - if (pref->pref_len == 0) { - /* - * This should never happen; we should always get the XML - * for an empty dictionary if it's really empty. - */ - error = EIO; - goto out; - } else { - buf = pref->pref_plist; - buf[pref->pref_len - 1] = '\0'; /* extra insurance */ - switch (type) { - case PROP_TYPE_DICTIONARY: - obj = prop_dictionary_internalize(buf); - break; - case PROP_TYPE_ARRAY: - obj = prop_array_internalize(buf); - break; - default: - error = ENOTSUP; - } - (void) munmap(buf, pref->pref_len); - if (obj == NULL && error == 0) - error = EIO; - } - - out: - if (error == 0) - *objp = obj; - return (error); -} - -/* - * prop_array_internalize_from_pref -- - * Internalize a pref into a prop_array_t object. - */ -bool -prop_array_internalize_from_pref(const struct plistref *prefp, - prop_array_t *arrayp) -{ - int rv; - - rv = _prop_object_internalize_from_pref(prefp, PROP_TYPE_ARRAY, - (prop_object_t *)arrayp); - if (rv != 0) - errno = rv; /* pass up error value in errno */ - return (rv == 0); -} - -/* - * prop_array_recv_syscall -- - * Internalize an array received from the kernel as pref. - */ -int -prop_array_recv_syscall(const struct plistref *prefp, - prop_array_t *arrayp) -{ - if (prop_array_internalize_from_pref(prefp, arrayp)) - return 0; - else - return errno; -} - -/* - * prop_dictionary_internalize_from_pref -- - * Internalize a pref into a prop_dictionary_t object. - */ -bool -prop_dictionary_internalize_from_pref(const struct plistref *prefp, - prop_dictionary_t *dictp) -{ - int rv; - - rv = _prop_object_internalize_from_pref(prefp, PROP_TYPE_DICTIONARY, - (prop_object_t *)dictp); - if (rv != 0) - errno = rv; /* pass up error value in errno */ - return (rv == 0); -} - -/* - * prop_dictionary_recv_syscall -- - * Internalize a dictionary received from the kernel as pref. - */ -int -prop_dictionary_recv_syscall(const struct plistref *prefp, - prop_dictionary_t *dictp) -{ - if (prop_dictionary_internalize_from_pref(prefp, dictp)) - return 0; - else - return errno; -} - - -/* - * prop_array_recv_ioctl -- - * Receive an array from the kernel using the specified ioctl. - */ -int -prop_array_recv_ioctl(int fd, unsigned long cmd, prop_array_t *arrayp) -{ - int rv; - struct plistref pref; - - rv = ioctl(fd, cmd, &pref); - if (rv == -1) - return errno; - - rv = _prop_object_internalize_from_pref(&pref, PROP_TYPE_ARRAY, - (prop_object_t *)arrayp); - if (rv != 0) { - errno = rv; /* pass up error value in errno */ - return rv; - } else - return 0; -} - -/* - * prop_dictionary_recv_ioctl -- - * Receive a dictionary from the kernel using the specified ioctl. - */ -int -prop_dictionary_recv_ioctl(int fd, unsigned long cmd, prop_dictionary_t *dictp) -{ - int rv; - struct plistref pref; - - rv = ioctl(fd, cmd, &pref); - if (rv == -1) - return errno; - - rv = _prop_object_internalize_from_pref(&pref, PROP_TYPE_DICTIONARY, - (prop_object_t *)dictp); - if (rv != 0) { - errno = rv; /* pass up error value in errno */ - return rv; - } else - return 0; -} - -/* - * prop_dictionary_sendrecv_ioctl -- - * Combination send/receive a dictionary to/from the kernel using - * the specified ioctl. - */ -int -prop_dictionary_sendrecv_ioctl(prop_dictionary_t dict, int fd, - unsigned long cmd, prop_dictionary_t *dictp) -{ - struct plistref pref; - char *buf; - int error; - - error = _prop_object_externalize_to_pref(dict, &pref, &buf); - if (error != 0) { - errno = error; - return error; - } - - if (ioctl(fd, cmd, &pref) == -1) - error = errno; - else - error = 0; - - free(buf); - - if (error != 0) - return error; - - error = _prop_object_internalize_from_pref(&pref, PROP_TYPE_DICTIONARY, - (prop_object_t *)dictp); - if (error != 0) { - errno = error; /* pass up error value in errno */ - return error; - } else - return 0; -} -#endif /* !_KERNEL && !_STANDALONE */ - -#if defined(_KERNEL) -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "prop_object_impl.h" - -/* Arbitrary limit ioctl input to 64KB */ -unsigned int prop_object_copyin_limit = 65536; - -/* initialize proplib for use in the kernel */ -void -prop_kern_init(void) -{ - __link_set_decl(prop_linkpools, struct prop_pool_init); - struct prop_pool_init * const *pi; - - __link_set_foreach(pi, prop_linkpools) - pool_init((*pi)->pp, (*pi)->size, 0, 0, 0, (*pi)->wchan, - &pool_allocator_nointr, IPL_NONE); -} - -static int -_prop_object_copyin(const struct plistref *pref, const prop_type_t type, - prop_object_t *objp) -{ - prop_object_t obj = NULL; - char *buf; - int error; - - if (pref->pref_len >= prop_object_copyin_limit) - return EINVAL; - - /* - * Allocate an extra byte so we can guarantee NUL-termination. - * - * Allow malloc to fail in case pmap would be exhausted. - */ - buf = malloc(pref->pref_len + 1, M_TEMP, M_WAITOK | M_CANFAIL); - if (buf == NULL) - return (ENOMEM); - error = copyin(pref->pref_plist, buf, pref->pref_len); - if (error) { - free(buf, M_TEMP); - return (error); - } - buf[pref->pref_len] = '\0'; - - switch (type) { - case PROP_TYPE_ARRAY: - obj = prop_array_internalize(buf); - break; - case PROP_TYPE_DICTIONARY: - obj = prop_dictionary_internalize(buf); - break; - default: - error = ENOTSUP; - } - - free(buf, M_TEMP); - if (obj == NULL) { - if (error == 0) - error = EIO; - } else { - *objp = obj; - } - return (error); -} - - -static int -_prop_object_copyin_ioctl(const struct plistref *pref, const prop_type_t type, - const u_long cmd, prop_object_t *objp) -{ - if ((cmd & IOC_IN) == 0) - return (EFAULT); - - return _prop_object_copyin(pref, type, objp); -} - -/* - * prop_array_copyin -- - * Copy in an array passed as a syscall arg. - */ -int -prop_array_copyin(const struct plistref *pref, prop_array_t *arrayp) -{ - return (_prop_object_copyin(pref, PROP_TYPE_ARRAY, - (prop_object_t *)arrayp)); -} - -/* - * prop_dictionary_copyin -- - * Copy in a dictionary passed as a syscall arg. - */ -int -prop_dictionary_copyin(const struct plistref *pref, prop_dictionary_t *dictp) -{ - return (_prop_object_copyin(pref, PROP_TYPE_DICTIONARY, - (prop_object_t *)dictp)); -} - - -/* - * prop_array_copyin_ioctl -- - * Copy in an array send with an ioctl. - */ -int -prop_array_copyin_ioctl(const struct plistref *pref, const u_long cmd, - prop_array_t *arrayp) -{ - return (_prop_object_copyin_ioctl(pref, PROP_TYPE_ARRAY, - cmd, (prop_object_t *)arrayp)); -} - -/* - * prop_dictionary_copyin_ioctl -- - * Copy in a dictionary sent with an ioctl. - */ -int -prop_dictionary_copyin_ioctl(const struct plistref *pref, const u_long cmd, - prop_dictionary_t *dictp) -{ - return (_prop_object_copyin_ioctl(pref, PROP_TYPE_DICTIONARY, - cmd, (prop_object_t *)dictp)); -} - -static int -_prop_object_copyout(struct plistref *pref, prop_object_t obj) -{ - struct lwp *l = curlwp; /* XXX */ - struct proc *p = l->l_proc; - char *buf; - void *uaddr; - size_t len, rlen; - int error = 0; - - switch (prop_object_type(obj)) { - case PROP_TYPE_ARRAY: - buf = prop_array_externalize(obj); - break; - case PROP_TYPE_DICTIONARY: - buf = prop_dictionary_externalize(obj); - break; - default: - return (ENOTSUP); - } - if (buf == NULL) - return (ENOMEM); - - len = strlen(buf) + 1; - rlen = round_page(len); - uaddr = NULL; - error = uvm_mmap_anon(p, &uaddr, rlen); - if (error == 0) { - error = copyout(buf, uaddr, len); - if (error == 0) { - pref->pref_plist = uaddr; - pref->pref_len = len; - } - } - - free(buf, M_TEMP); - - return (error); -} - -/* - * prop_array_copyout -- - * Copy out an array to a syscall arg. - */ -int -prop_array_copyout(struct plistref *pref, prop_array_t array) -{ - return (_prop_object_copyout(pref, array)); -} - -/* - * prop_dictionary_copyout -- - * Copy out a dictionary to a syscall arg. - */ -int -prop_dictionary_copyout(struct plistref *pref, prop_dictionary_t dict) -{ - return (_prop_object_copyout(pref, dict)); -} - -static int -_prop_object_copyout_ioctl(struct plistref *pref, const u_long cmd, - prop_object_t obj) -{ - if ((cmd & IOC_OUT) == 0) - return (EFAULT); - return _prop_object_copyout(pref, obj); -} - - -/* - * prop_array_copyout_ioctl -- - * Copy out an array being received with an ioctl. - */ -int -prop_array_copyout_ioctl(struct plistref *pref, const u_long cmd, - prop_array_t array) -{ - return (_prop_object_copyout_ioctl(pref, cmd, array)); -} - -/* - * prop_dictionary_copyout_ioctl -- - * Copy out a dictionary being received with an ioctl. - */ -int -prop_dictionary_copyout_ioctl(struct plistref *pref, const u_long cmd, - prop_dictionary_t dict) -{ - return ( - _prop_object_copyout_ioctl(pref, cmd, dict)); -} -#endif /* _KERNEL */ - -#endif /* __NetBSD__ */ diff --git a/common/lib/libprop/prop_number.3 b/common/lib/libprop/prop_number.3 deleted file mode 100644 index 0b5e9cae8..000000000 --- a/common/lib/libprop/prop_number.3 +++ /dev/null @@ -1,210 +0,0 @@ -.\" $NetBSD: prop_number.3,v 1.10 2011/01/20 10:44:42 wiz Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd January 21, 2008 -.Dt PROP_NUMBER 3 -.Os -.Sh NAME -.Nm prop_number , -.Nm prop_number_create_integer , -.Nm prop_number_create_unsigned_integer , -.Nm prop_number_copy , -.Nm prop_number_size , -.Nm prop_number_unsigned , -.Nm prop_number_integer_value , -.Nm prop_number_unsigned_integer_value , -.Nm prop_number_equals , -.Nm prop_number_equals_integer , -.Nm prop_number_equals_unsigned_integer -.Nd numeric value property object -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft prop_number_t -.Fn prop_number_create_integer "int64_t val" -.Ft prop_number_t -.Fn prop_number_create_unsigned_integer "uint64_t val" -.Ft prop_number_t -.Fn prop_number_copy "prop_number_t number" -.\" -.Ft int -.Fn prop_number_size "prop_number_t number" -.Ft bool -.Fn prop_number_unsigned "prop_number_t number" -.Ft int64_t -.Fn prop_number_integer_value "prop_number_t number" -.Ft uint64_t -.Fn prop_number_unsigned_integer_value "prop_number_t number" -.\" -.Ft bool -.Fn prop_number_equals "prop_number_t num1" "prop_number_t num2" -.Ft bool -.Fn prop_number_equals_integer "prop_number_t number" "int64_t val" -.Ft bool -.Fn prop_number_equals_unsigned_integer "prop_number_t number" "uint64_t val" -.Sh DESCRIPTION -The -.Nm prop_number -family of functions operate on a numeric value property object type. -Values are either signed or unsigned, and promoted to a 64-bit type -.Pq int64_t or uint64_t , respectively . -.Pp -It is possible to compare number objects that differ in sign. -Such comparisons first test to see if each object is within the valid -number range of the other: -.Bl -bullet -.It -Signed numbers that are greater than or equal to 0 can be compared to -unsigned numbers. -.It -Unsigned numbers that are less than or equal to the largest signed 64-bit -value -.Pq Dv INT64_MAX -can be compared to signed numbers. -.El -.Pp -Number objects have a different externalized representation depending -on their sign: -.Bl -bullet -.It -Signed numbers are externalized in base-10 -.Pq decimal . -.It -Unsigned numbers are externalized in base-16 -.Pq hexadecimal . -.El -.Pp -When numbers are internalized, the sign of the resulting number object -.Pq and thus its valid range -is determined by a set of rules evaluated in the following order: -.Bl -bullet -.It -If the first character of the number is a -.Sq - -then the number is signed. -.It -If the first two characters of the number are -.Sq 0x -then the number is unsigned. -.It -If the number value fits into the range of a signed number then the -number is signed. -.It -In all other cases, the number is unsigned. -.El -.Bl -tag -width "xxxxx" -.It Fn prop_number_create_integer "int64_t val" -Create a numeric value object with the signed value -.Fa val . -Returns -.Dv NULL -on failure. -.It Fn prop_number_create_unsigned_integer "uint64_t val" -Create a numeric value object with the unsigned value -.Fa val . -Returns -.Dv NULL -on failure. -.It Fn prop_number_copy "prop_number_t number" -Copy a numeric value object. -If the supplied object isn't a numeric value, -.Dv NULL -is returned. -.It Fn prop_number_size "prop_number_t number" -Returns 8, 16, 32, or 64, representing the number of bits required to -hold the value of the object. -If the supplied object isn't a numeric value, -.Dv NULL -is returned. -.It Fn prop_number_unsigned "prop_number_t number" -Returns -.Dv true -if the numeric value object has an unsigned value. -.It Fn prop_number_integer_value "prop_number_t number" -Returns the signed integer value of the numeric value object. -If the supplied object isn't a numeric value, zero is returned. -Thus, -it is not possible to distinguish between -.Dq not a prop_number_t -and -.Dq prop_number_t has a value of 0 . -.It Fn prop_number_unsigned_integer_value "prop_number_t number" -Returns the unsigned integer value of the numeric value object. -If the supplied object isn't a numeric value, zero is returned. -Thus, -it is not possible to distinguish between -.Dq not a prop_number_t -and -.Dq prop_number_t has a value of 0 . -.It Fn prop_number_equals "prop_number_t num1" "prop_number_t num2" -Returns -.Dv true -if the two numeric value objects are equivalent. -If at least one of the supplied objects isn't a numeric value, -.Dv false -is returned. -.It Fn prop_number_equals_integer "prop_number_t number" "int64_t val" -Returns -.Dv true -if the object's value is equivalent to the signed value -.Fa val . -If the supplied object isn't a numerical value or if -.Fa val -exceeds -.Dv INT64_MAX , -.Dv false -is returned. -.It Fn prop_number_equals_unsigned_integer "prop_number_t number" \ - "uint64_t val" -Returns -.Dv true -if the object's value is equivalent to the unsigned value -.Fa val . -If the supplied object isn't a numerical value or if -.Fa val -exceeds -.Dv INT64_MAX , -.Dv false -is returned. -.El -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_bool 3 , -.Xr prop_data 3 , -.Xr prop_dictionary 3 , -.Xr prop_object 3 , -.Xr prop_string 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_number.c b/common/lib/libprop/prop_number.c deleted file mode 100644 index 26aff728f..000000000 --- a/common/lib/libprop/prop_number.c +++ /dev/null @@ -1,597 +0,0 @@ -/* $NetBSD: prop_number.c,v 1.27 2014/09/05 05:19:24 matt Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "prop_object_impl.h" -#include "prop_rb_impl.h" - -#if defined(_KERNEL) -#include -#elif defined(_STANDALONE) -#include -#include -#else -#include -#include -#endif - -struct _prop_number_value { - union { - int64_t pnu_signed; - uint64_t pnu_unsigned; - } pnv_un; -#define pnv_signed pnv_un.pnu_signed -#define pnv_unsigned pnv_un.pnu_unsigned - unsigned int pnv_is_unsigned :1, - :31; -}; - -struct _prop_number { - struct _prop_object pn_obj; - struct rb_node pn_link; - struct _prop_number_value pn_value; -}; - -_PROP_POOL_INIT(_prop_number_pool, sizeof(struct _prop_number), "propnmbr") - -static _prop_object_free_rv_t - _prop_number_free(prop_stack_t, prop_object_t *); -static bool _prop_number_externalize( - struct _prop_object_externalize_context *, - void *); -static _prop_object_equals_rv_t - _prop_number_equals(prop_object_t, prop_object_t, - void **, void **, - prop_object_t *, prop_object_t *); - -static void _prop_number_lock(void); -static void _prop_number_unlock(void); - -static const struct _prop_object_type _prop_object_type_number = { - .pot_type = PROP_TYPE_NUMBER, - .pot_free = _prop_number_free, - .pot_extern = _prop_number_externalize, - .pot_equals = _prop_number_equals, - .pot_lock = _prop_number_lock, - .pot_unlock = _prop_number_unlock, -}; - -#define prop_object_is_number(x) \ - ((x) != NULL && (x)->pn_obj.po_type == &_prop_object_type_number) - -/* - * Number objects are immutable, and we are likely to have many number - * objects that have the same value. So, to save memory, we unique'ify - * numbers so we only have one copy of each. - */ - -static int -_prop_number_compare_values(const struct _prop_number_value *pnv1, - const struct _prop_number_value *pnv2) -{ - - /* Signed numbers are sorted before unsigned numbers. */ - - if (pnv1->pnv_is_unsigned) { - if (! pnv2->pnv_is_unsigned) - return (1); - if (pnv1->pnv_unsigned < pnv2->pnv_unsigned) - return (-1); - if (pnv1->pnv_unsigned > pnv2->pnv_unsigned) - return (1); - return (0); - } - - if (pnv2->pnv_is_unsigned) - return (-1); - if (pnv1->pnv_signed < pnv2->pnv_signed) - return (-1); - if (pnv1->pnv_signed > pnv2->pnv_signed) - return (1); - return (0); -} - -static int -/*ARGSUSED*/ -_prop_number_rb_compare_nodes(void *ctx _PROP_ARG_UNUSED, - const void *n1, const void *n2) -{ - const struct _prop_number *pn1 = n1; - const struct _prop_number *pn2 = n2; - - return _prop_number_compare_values(&pn1->pn_value, &pn2->pn_value); -} - -static int -/*ARGSUSED*/ -_prop_number_rb_compare_key(void *ctx _PROP_ARG_UNUSED, - const void *n, const void *v) -{ - const struct _prop_number *pn = n; - const struct _prop_number_value *pnv = v; - - return _prop_number_compare_values(&pn->pn_value, pnv); -} - -static const rb_tree_ops_t _prop_number_rb_tree_ops = { - .rbto_compare_nodes = _prop_number_rb_compare_nodes, - .rbto_compare_key = _prop_number_rb_compare_key, - .rbto_node_offset = offsetof(struct _prop_number, pn_link), - .rbto_context = NULL -}; - -static struct rb_tree _prop_number_tree; -_PROP_MUTEX_DECL_STATIC(_prop_number_tree_mutex) - -/* ARGSUSED */ -static _prop_object_free_rv_t -_prop_number_free(prop_stack_t stack, prop_object_t *obj) -{ - prop_number_t pn = *obj; - - _prop_rb_tree_remove_node(&_prop_number_tree, pn); - - _PROP_POOL_PUT(_prop_number_pool, pn); - - return (_PROP_OBJECT_FREE_DONE); -} - -_PROP_ONCE_DECL(_prop_number_init_once) - -static int -_prop_number_init(void) -{ - - _PROP_MUTEX_INIT(_prop_number_tree_mutex); - _prop_rb_tree_init(&_prop_number_tree, &_prop_number_rb_tree_ops); - return 0; -} - -static void -_prop_number_lock(void) -{ - /* XXX: init necessary? */ - _PROP_ONCE_RUN(_prop_number_init_once, _prop_number_init); - _PROP_MUTEX_LOCK(_prop_number_tree_mutex); -} - -static void -_prop_number_unlock(void) -{ - _PROP_MUTEX_UNLOCK(_prop_number_tree_mutex); -} - -static bool -_prop_number_externalize(struct _prop_object_externalize_context *ctx, - void *v) -{ - prop_number_t pn = v; - char tmpstr[32]; - - /* - * For unsigned numbers, we output in hex. For signed numbers, - * we output in decimal. - */ - if (pn->pn_value.pnv_is_unsigned) - snprintf(tmpstr, sizeof(tmpstr), "0x%" PRIx64, - pn->pn_value.pnv_unsigned); - else - snprintf(tmpstr, sizeof(tmpstr), "%" PRIi64, - pn->pn_value.pnv_signed); - - if (_prop_object_externalize_start_tag(ctx, "integer") == false || - _prop_object_externalize_append_cstring(ctx, tmpstr) == false || - _prop_object_externalize_end_tag(ctx, "integer") == false) - return (false); - - return (true); -} - -/* ARGSUSED */ -static _prop_object_equals_rv_t -_prop_number_equals(prop_object_t v1, prop_object_t v2, - void **stored_pointer1, void **stored_pointer2, - prop_object_t *next_obj1, prop_object_t *next_obj2) -{ - prop_number_t num1 = v1; - prop_number_t num2 = v2; - - /* - * There is only ever one copy of a number object at any given - * time, so we can reduce this to a simple pointer equality check - * in the common case. - */ - if (num1 == num2) - return (_PROP_OBJECT_EQUALS_TRUE); - - /* - * If the numbers are the same signed-ness, then we know they - * cannot be equal because they would have had pointer equality. - */ - if (num1->pn_value.pnv_is_unsigned == num2->pn_value.pnv_is_unsigned) - return (_PROP_OBJECT_EQUALS_FALSE); - - /* - * We now have one signed value and one unsigned value. We can - * compare them iff: - * - The unsigned value is not larger than the signed value - * can represent. - * - The signed value is not smaller than the unsigned value - * can represent. - */ - if (num1->pn_value.pnv_is_unsigned) { - /* - * num1 is unsigned and num2 is signed. - */ - if (num1->pn_value.pnv_unsigned > INT64_MAX) - return (_PROP_OBJECT_EQUALS_FALSE); - if (num2->pn_value.pnv_signed < 0) - return (_PROP_OBJECT_EQUALS_FALSE); - } else { - /* - * num1 is signed and num2 is unsigned. - */ - if (num1->pn_value.pnv_signed < 0) - return (_PROP_OBJECT_EQUALS_FALSE); - if (num2->pn_value.pnv_unsigned > INT64_MAX) - return (_PROP_OBJECT_EQUALS_FALSE); - } - - if (num1->pn_value.pnv_signed == num2->pn_value.pnv_signed) - return _PROP_OBJECT_EQUALS_TRUE; - else - return _PROP_OBJECT_EQUALS_FALSE; -} - -static prop_number_t -_prop_number_alloc(const struct _prop_number_value *pnv) -{ - prop_number_t opn, pn, rpn; - - _PROP_ONCE_RUN(_prop_number_init_once, _prop_number_init); - - /* - * Check to see if this already exists in the tree. If it does, - * we just retain it and return it. - */ - _PROP_MUTEX_LOCK(_prop_number_tree_mutex); - opn = _prop_rb_tree_find(&_prop_number_tree, pnv); - if (opn != NULL) { - prop_object_retain(opn); - _PROP_MUTEX_UNLOCK(_prop_number_tree_mutex); - return (opn); - } - _PROP_MUTEX_UNLOCK(_prop_number_tree_mutex); - - /* - * Not in the tree. Create it now. - */ - - pn = _PROP_POOL_GET(_prop_number_pool); - if (pn == NULL) - return (NULL); - - _prop_object_init(&pn->pn_obj, &_prop_object_type_number); - - pn->pn_value = *pnv; - - /* - * We dropped the mutex when we allocated the new object, so - * we have to check again if it is in the tree. - */ - _PROP_MUTEX_LOCK(_prop_number_tree_mutex); - opn = _prop_rb_tree_find(&_prop_number_tree, pnv); - if (opn != NULL) { - prop_object_retain(opn); - _PROP_MUTEX_UNLOCK(_prop_number_tree_mutex); - _PROP_POOL_PUT(_prop_number_pool, pn); - return (opn); - } - rpn = _prop_rb_tree_insert_node(&_prop_number_tree, pn); - _PROP_ASSERT(rpn == pn); - _PROP_MUTEX_UNLOCK(_prop_number_tree_mutex); - return (rpn); -} - -/* - * prop_number_create_integer -- - * Create a prop_number_t and initialize it with the - * provided integer value. - */ -prop_number_t -prop_number_create_integer(int64_t val) -{ - struct _prop_number_value pnv; - - memset(&pnv, 0, sizeof(pnv)); - pnv.pnv_signed = val; - pnv.pnv_is_unsigned = false; - - return (_prop_number_alloc(&pnv)); -} - -/* - * prop_number_create_unsigned_integer -- - * Create a prop_number_t and initialize it with the - * provided unsigned integer value. - */ -prop_number_t -prop_number_create_unsigned_integer(uint64_t val) -{ - struct _prop_number_value pnv; - - memset(&pnv, 0, sizeof(pnv)); - pnv.pnv_unsigned = val; - pnv.pnv_is_unsigned = true; - - return (_prop_number_alloc(&pnv)); -} - -/* - * prop_number_copy -- - * Copy a prop_number_t. - */ -prop_number_t -prop_number_copy(prop_number_t opn) -{ - - if (! prop_object_is_number(opn)) - return (NULL); - - /* - * Because we only ever allocate one object for any given - * value, this can be reduced to a simple retain operation. - */ - prop_object_retain(opn); - return (opn); -} - -/* - * prop_number_unsigned -- - * Returns true if the prop_number_t has an unsigned value. - */ -bool -prop_number_unsigned(prop_number_t pn) -{ - - return (pn->pn_value.pnv_is_unsigned); -} - -/* - * prop_number_size -- - * Return the size, in bits, required to hold the value of - * the specified number. - */ -int -prop_number_size(prop_number_t pn) -{ - struct _prop_number_value *pnv; - - if (! prop_object_is_number(pn)) - return (0); - - pnv = &pn->pn_value; - - if (pnv->pnv_is_unsigned) { - if (pnv->pnv_unsigned > UINT32_MAX) - return (64); - if (pnv->pnv_unsigned > UINT16_MAX) - return (32); - if (pnv->pnv_unsigned > UINT8_MAX) - return (16); - return (8); - } - - if (pnv->pnv_signed > INT32_MAX || pnv->pnv_signed < INT32_MIN) - return (64); - if (pnv->pnv_signed > INT16_MAX || pnv->pnv_signed < INT16_MIN) - return (32); - if (pnv->pnv_signed > INT8_MAX || pnv->pnv_signed < INT8_MIN) - return (16); - return (8); -} - -/* - * prop_number_integer_value -- - * Get the integer value of a prop_number_t. - */ -int64_t -prop_number_integer_value(prop_number_t pn) -{ - - /* - * XXX Impossible to distinguish between "not a prop_number_t" - * XXX and "prop_number_t has a value of 0". - */ - if (! prop_object_is_number(pn)) - return (0); - - return (pn->pn_value.pnv_signed); -} - -/* - * prop_number_unsigned_integer_value -- - * Get the unsigned integer value of a prop_number_t. - */ -uint64_t -prop_number_unsigned_integer_value(prop_number_t pn) -{ - - /* - * XXX Impossible to distinguish between "not a prop_number_t" - * XXX and "prop_number_t has a value of 0". - */ - if (! prop_object_is_number(pn)) - return (0); - - return (pn->pn_value.pnv_unsigned); -} - -/* - * prop_number_equals -- - * Return true if two numbers are equivalent. - */ -bool -prop_number_equals(prop_number_t num1, prop_number_t num2) -{ - if (!prop_object_is_number(num1) || !prop_object_is_number(num2)) - return (false); - - return (prop_object_equals(num1, num2)); -} - -/* - * prop_number_equals_integer -- - * Return true if the number is equivalent to the specified integer. - */ -bool -prop_number_equals_integer(prop_number_t pn, int64_t val) -{ - - if (! prop_object_is_number(pn)) - return (false); - - if (pn->pn_value.pnv_is_unsigned && - (pn->pn_value.pnv_unsigned > INT64_MAX || val < 0)) - return (false); - - return (pn->pn_value.pnv_signed == val); -} - -/* - * prop_number_equals_unsigned_integer -- - * Return true if the number is equivalent to the specified - * unsigned integer. - */ -bool -prop_number_equals_unsigned_integer(prop_number_t pn, uint64_t val) -{ - - if (! prop_object_is_number(pn)) - return (false); - - if (! pn->pn_value.pnv_is_unsigned && - (pn->pn_value.pnv_signed < 0 || val > INT64_MAX)) - return (false); - - return (pn->pn_value.pnv_unsigned == val); -} - -static bool -_prop_number_internalize_unsigned(struct _prop_object_internalize_context *ctx, - struct _prop_number_value *pnv) -{ - char *cp; - - _PROP_ASSERT(/*CONSTCOND*/sizeof(unsigned long long) == - sizeof(uint64_t)); - -#ifndef _KERNEL - errno = 0; -#endif - pnv->pnv_unsigned = (uint64_t) strtoull(ctx->poic_cp, &cp, 0); -#ifndef _KERNEL /* XXX can't check for ERANGE in the kernel */ - if (pnv->pnv_unsigned == UINT64_MAX && errno == ERANGE) - return (false); -#endif - pnv->pnv_is_unsigned = true; - ctx->poic_cp = cp; - - return (true); -} - -static bool -_prop_number_internalize_signed(struct _prop_object_internalize_context *ctx, - struct _prop_number_value *pnv) -{ - char *cp; - - _PROP_ASSERT(/*CONSTCOND*/sizeof(long long) == sizeof(int64_t)); - -#ifndef _KERNEL - errno = 0; -#endif - pnv->pnv_signed = (int64_t) strtoll(ctx->poic_cp, &cp, 0); -#ifndef _KERNEL /* XXX can't check for ERANGE in the kernel */ - if ((pnv->pnv_signed == INT64_MAX || pnv->pnv_signed == INT64_MIN) && - errno == ERANGE) - return (false); -#endif - pnv->pnv_is_unsigned = false; - ctx->poic_cp = cp; - - return (true); -} - -/* - * _prop_number_internalize -- - * Parse a ... and return the object created from - * the external representation. - */ -/* ARGSUSED */ -bool -_prop_number_internalize(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx) -{ - struct _prop_number_value pnv; - - memset(&pnv, 0, sizeof(pnv)); - - /* No attributes, no empty elements. */ - if (ctx->poic_tagattr != NULL || ctx->poic_is_empty_element) - return (true); - - /* - * If the first character is '-', then we treat as signed. - * If the first two characters are "0x" (i.e. the number is - * in hex), then we treat as unsigned. Otherwise, we try - * signed first, and if that fails (presumably due to ERANGE), - * then we switch to unsigned. - */ - if (ctx->poic_cp[0] == '-') { - if (_prop_number_internalize_signed(ctx, &pnv) == false) - return (true); - } else if (ctx->poic_cp[0] == '0' && ctx->poic_cp[1] == 'x') { - if (_prop_number_internalize_unsigned(ctx, &pnv) == false) - return (true); - } else { - if (_prop_number_internalize_signed(ctx, &pnv) == false && - _prop_number_internalize_unsigned(ctx, &pnv) == false) - return (true); - } - - if (_prop_object_internalize_find_tag(ctx, "integer", - _PROP_TAG_TYPE_END) == false) - return (true); - - *obj = _prop_number_alloc(&pnv); - return (true); -} diff --git a/common/lib/libprop/prop_object.3 b/common/lib/libprop/prop_object.3 deleted file mode 100644 index 7df09ea01..000000000 --- a/common/lib/libprop/prop_object.3 +++ /dev/null @@ -1,141 +0,0 @@ -.\" $NetBSD: prop_object.3,v 1.8 2011/01/20 10:44:42 wiz Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd August 21, 2006 -.Dt PROP_OBJECT 3 -.Os -.Sh NAME -.Nm prop_object , -.Nm prop_object_retain , -.Nm prop_object_release , -.Nm prop_object_type , -.Nm prop_object_equals , -.Nm prop_object_iterator_next , -.Nm prop_object_iterator_reset , -.Nm prop_object_iterator_release -.Nd general property container object functions -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft void -.Fn prop_object_retain "prop_object_t obj" -.Ft void -.Fn prop_object_release "prop_object_t obj" -.\" -.Ft prop_type_t -.Fn prop_object_type "prop_object_t obj" -.Ft bool -.Fn prop_object_equals "prop_object_t obj1" "prop_object_t obj2" -.\" -.Ft prop_object_t -.Fn prop_object_iterator_next "prop_object_iterator_t iter" -.Ft void -.Fn prop_object_iterator_reset "prop_object_iterator_t iter" -.Ft void -.Fn prop_object_iterator_release "prop_object_iterator_t iter" -.Sh DESCRIPTION -The -.Nm prop_object -family of functions operate on all property container object types. -.Bl -tag -width "" -.It Fn prop_object_retain "prop_object_t obj" -Increment the reference count on an object. -.It Fn prop_object_release "prop_object_t obj" -Decrement the reference count on an object. -If the last reference is dropped, the object is freed. -.It Fn prop_object_type "prop_object_t obj" -Determine the type of the object. -Objects are one of the following types: -.Pp -.Bl -tag -width "PROP_TYPE_DICT_KEYSYM" -compact -.It Dv PROP_TYPE_BOOL -Boolean value -.Pq prop_bool_t -.It Dv PROP_TYPE_NUMBER -Number -.Pq prop_number_t -.It Dv PROP_TYPE_STRING -String -.Pq prop_string_t -.It Dv PROP_TYPE_DATA -Opaque data -.Pq prop_data_t -.It Dv PROP_TYPE_ARRAY -Array -.Pq prop_array_t -.It Dv PROP_TYPE_DICTIONARY -Dictionary -.Pq prop_dictionary_t -.It Dv PROP_TYPE_DICT_KEYSYM -Dictionary key symbol -.Pq prop_dictionary_keysym_t -.El -.Pp -If -.Fa obj -is -.Dv NULL , -then -.Dv PROP_TYPE_UNKNOWN -is returned. -.It Fn prop_object_equals "prop_object_t obj1" "prop_object_t obj2" -Returns -.Dv true -if the two objects are of the same type and are equivalent. -.It Fn prop_object_iterator_next "prop_object_iterator_t iter" -Return the next object in the collection -.Pq array or dictionary -being iterated by the iterator -.Fa iter . -If there are no more objects in the collection, -.Dv NULL -is returned. -.It Fn prop_object_iterator_reset "prop_object_iterator_t iter" -Reset the iterator to the first object in the collection being iterated -by the iterator -.Fa iter . -.It Fn prop_object_iterator_release "prop_object_iterator_t iter" -Release the iterator -.Fa iter . -.El -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_bool 3 , -.Xr prop_data 3 , -.Xr prop_dictionary 3 , -.Xr prop_number 3 , -.Xr prop_string 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_object.c b/common/lib/libprop/prop_object.c deleted file mode 100644 index 384102d4a..000000000 --- a/common/lib/libprop/prop_object.c +++ /dev/null @@ -1,1240 +0,0 @@ -/* $NetBSD: prop_object.c,v 1.30 2015/05/12 14:59:35 christos Exp $ */ - -/*- - * Copyright (c) 2006, 2007 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include "prop_object_impl.h" -#include - -#ifdef _PROP_NEED_REFCNT_MTX -static pthread_mutex_t _prop_refcnt_mtx = PTHREAD_MUTEX_INITIALIZER; -#endif /* _PROP_NEED_REFCNT_MTX */ - -#if !defined(_KERNEL) && !defined(_STANDALONE) -#include -#include -#include -#include -#include -#include -#if defined(__minix) -#include -#endif /* defined(__minix) */ -#endif - -#ifdef _STANDALONE -void * -_prop_standalone_calloc(size_t size) -{ - void *rv; - - rv = alloc(size); - if (rv != NULL) - memset(rv, 0, size); - - return (rv); -} - -void * -_prop_standalone_realloc(void *v, size_t size) -{ - void *rv; - - rv = alloc(size); - if (rv != NULL) { - memcpy(rv, v, size); /* XXX */ - dealloc(v, 0); /* XXX */ - } - - return (rv); -} -#endif /* _STANDALONE */ - -/* - * _prop_object_init -- - * Initialize an object. Called when sub-classes create - * an instance. - */ -void -_prop_object_init(struct _prop_object *po, const struct _prop_object_type *pot) -{ - - po->po_type = pot; - po->po_refcnt = 1; -} - -/* - * _prop_object_fini -- - * Finalize an object. Called when sub-classes destroy - * an instance. - */ -/*ARGSUSED*/ -void -_prop_object_fini(struct _prop_object *po _PROP_ARG_UNUSED) -{ - /* Nothing to do, currently. */ -} - -/* - * _prop_object_externalize_start_tag -- - * Append an XML-style start tag to the externalize buffer. - */ -bool -_prop_object_externalize_start_tag( - struct _prop_object_externalize_context *ctx, const char *tag) -{ - unsigned int i; - - for (i = 0; i < ctx->poec_depth; i++) { - if (_prop_object_externalize_append_char(ctx, '\t') == false) - return (false); - } - if (_prop_object_externalize_append_char(ctx, '<') == false || - _prop_object_externalize_append_cstring(ctx, tag) == false || - _prop_object_externalize_append_char(ctx, '>') == false) - return (false); - - return (true); -} - -/* - * _prop_object_externalize_end_tag -- - * Append an XML-style end tag to the externalize buffer. - */ -bool -_prop_object_externalize_end_tag( - struct _prop_object_externalize_context *ctx, const char *tag) -{ - - if (_prop_object_externalize_append_char(ctx, '<') == false || - _prop_object_externalize_append_char(ctx, '/') == false || - _prop_object_externalize_append_cstring(ctx, tag) == false || - _prop_object_externalize_append_char(ctx, '>') == false || - _prop_object_externalize_append_char(ctx, '\n') == false) - return (false); - - return (true); -} - -/* - * _prop_object_externalize_empty_tag -- - * Append an XML-style empty tag to the externalize buffer. - */ -bool -_prop_object_externalize_empty_tag( - struct _prop_object_externalize_context *ctx, const char *tag) -{ - unsigned int i; - - for (i = 0; i < ctx->poec_depth; i++) { - if (_prop_object_externalize_append_char(ctx, '\t') == false) - return (false); - } - - if (_prop_object_externalize_append_char(ctx, '<') == false || - _prop_object_externalize_append_cstring(ctx, tag) == false || - _prop_object_externalize_append_char(ctx, '/') == false || - _prop_object_externalize_append_char(ctx, '>') == false || - _prop_object_externalize_append_char(ctx, '\n') == false) - return (false); - - return (true); -} - -/* - * _prop_object_externalize_append_cstring -- - * Append a C string to the externalize buffer. - */ -bool -_prop_object_externalize_append_cstring( - struct _prop_object_externalize_context *ctx, const char *cp) -{ - - while (*cp != '\0') { - if (_prop_object_externalize_append_char(ctx, - (unsigned char) *cp) == false) - return (false); - cp++; - } - - return (true); -} - -/* - * _prop_object_externalize_append_encoded_cstring -- - * Append an encoded C string to the externalize buffer. - */ -bool -_prop_object_externalize_append_encoded_cstring( - struct _prop_object_externalize_context *ctx, const char *cp) -{ - - while (*cp != '\0') { - switch (*cp) { - case '<': - if (_prop_object_externalize_append_cstring(ctx, - "<") == false) - return (false); - break; - case '>': - if (_prop_object_externalize_append_cstring(ctx, - ">") == false) - return (false); - break; - case '&': - if (_prop_object_externalize_append_cstring(ctx, - "&") == false) - return (false); - break; - default: - if (_prop_object_externalize_append_char(ctx, - (unsigned char) *cp) == false) - return (false); - break; - } - cp++; - } - - return (true); -} - -#define BUF_EXPAND 256 - -/* - * _prop_object_externalize_append_char -- - * Append a single character to the externalize buffer. - */ -bool -_prop_object_externalize_append_char( - struct _prop_object_externalize_context *ctx, unsigned char c) -{ - - _PROP_ASSERT(ctx->poec_capacity != 0); - _PROP_ASSERT(ctx->poec_buf != NULL); - _PROP_ASSERT(ctx->poec_len <= ctx->poec_capacity); - - if (ctx->poec_len == ctx->poec_capacity) { - char *cp = _PROP_REALLOC(ctx->poec_buf, - ctx->poec_capacity + BUF_EXPAND, - M_TEMP); - if (cp == NULL) - return (false); - ctx->poec_capacity = ctx->poec_capacity + BUF_EXPAND; - ctx->poec_buf = cp; - } - - ctx->poec_buf[ctx->poec_len++] = c; - - return (true); -} - -/* - * _prop_object_externalize_header -- - * Append the standard XML header to the externalize buffer. - */ -bool -_prop_object_externalize_header(struct _prop_object_externalize_context *ctx) -{ - static const char _plist_xml_header[] = -"\n" -"\n"; - - if (_prop_object_externalize_append_cstring(ctx, - _plist_xml_header) == false || - _prop_object_externalize_start_tag(ctx, - "plist version=\"1.0\"") == false || - _prop_object_externalize_append_char(ctx, '\n') == false) - return (false); - - return (true); -} - -/* - * _prop_object_externalize_footer -- - * Append the standard XML footer to the externalize buffer. This - * also NUL-terminates the buffer. - */ -bool -_prop_object_externalize_footer(struct _prop_object_externalize_context *ctx) -{ - - if (_prop_object_externalize_end_tag(ctx, "plist") == false || - _prop_object_externalize_append_char(ctx, '\0') == false) - return (false); - - return (true); -} - -/* - * _prop_object_externalize_context_alloc -- - * Allocate an externalize context. - */ -struct _prop_object_externalize_context * -_prop_object_externalize_context_alloc(void) -{ - struct _prop_object_externalize_context *ctx; - - ctx = _PROP_MALLOC(sizeof(*ctx), M_TEMP); - if (ctx != NULL) { - ctx->poec_buf = _PROP_MALLOC(BUF_EXPAND, M_TEMP); - if (ctx->poec_buf == NULL) { - _PROP_FREE(ctx, M_TEMP); - return (NULL); - } - ctx->poec_len = 0; - ctx->poec_capacity = BUF_EXPAND; - ctx->poec_depth = 0; - } - return (ctx); -} - -/* - * _prop_object_externalize_context_free -- - * Free an externalize context. - */ -void -_prop_object_externalize_context_free( - struct _prop_object_externalize_context *ctx) -{ - - /* Buffer is always freed by the caller. */ - _PROP_FREE(ctx, M_TEMP); -} - -/* - * _prop_object_internalize_skip_comment -- - * Skip the body and end tag of a comment. - */ -static bool -_prop_object_internalize_skip_comment( - struct _prop_object_internalize_context *ctx) -{ - const char *cp = ctx->poic_cp; - - while (!_PROP_EOF(*cp)) { - if (cp[0] == '-' && - cp[1] == '-' && - cp[2] == '>') { - ctx->poic_cp = cp + 3; - return (true); - } - cp++; - } - - return (false); /* ran out of buffer */ -} - -/* - * _prop_object_internalize_find_tag -- - * Find the next tag in an XML stream. Optionally compare the found - * tag to an expected tag name. State of the context is undefined - * if this routine returns false. Upon success, the context points - * to the first octet after the tag. - */ -bool -_prop_object_internalize_find_tag(struct _prop_object_internalize_context *ctx, - const char *tag, _prop_tag_type_t type) -{ - const char *cp; - size_t taglen; - - if (tag != NULL) - taglen = strlen(tag); - else - taglen = 0; - - start_over: - cp = ctx->poic_cp; - - /* - * Find the start of the tag. - */ - while (_PROP_ISSPACE(*cp)) - cp++; - if (_PROP_EOF(*cp)) - return (false); - - if (*cp != '<') - return (false); - - ctx->poic_tag_start = cp++; - if (_PROP_EOF(*cp)) - return (false); - - if (*cp == '!') { - if (cp[1] != '-' || cp[2] != '-') - return (false); - /* - * Comment block -- only allowed if we are allowed to - * return a start tag. - */ - if (type == _PROP_TAG_TYPE_END) - return (false); - ctx->poic_cp = cp + 3; - if (_prop_object_internalize_skip_comment(ctx) == false) - return (false); - goto start_over; - } - - if (*cp == '/') { - if (type != _PROP_TAG_TYPE_END && - type != _PROP_TAG_TYPE_EITHER) - return (false); - cp++; - if (_PROP_EOF(*cp)) - return (false); - ctx->poic_tag_type = _PROP_TAG_TYPE_END; - } else { - if (type != _PROP_TAG_TYPE_START && - type != _PROP_TAG_TYPE_EITHER) - return (false); - ctx->poic_tag_type = _PROP_TAG_TYPE_START; - } - - ctx->poic_tagname = cp; - - while (!_PROP_ISSPACE(*cp) && *cp != '/' && *cp != '>') { - if (_PROP_EOF(*cp)) - return (false); - cp++; - } - - ctx->poic_tagname_len = cp - ctx->poic_tagname; - - /* Make sure this is the tag we're looking for. */ - if (tag != NULL && - (taglen != ctx->poic_tagname_len || - memcmp(tag, ctx->poic_tagname, taglen) != 0)) - return (false); - - /* Check for empty tag. */ - if (*cp == '/') { - if (ctx->poic_tag_type != _PROP_TAG_TYPE_START) - return(false); /* only valid on start tags */ - ctx->poic_is_empty_element = true; - cp++; - if (_PROP_EOF(*cp) || *cp != '>') - return (false); - } else - ctx->poic_is_empty_element = false; - - /* Easy case of no arguments. */ - if (*cp == '>') { - ctx->poic_tagattr = NULL; - ctx->poic_tagattr_len = 0; - ctx->poic_tagattrval = NULL; - ctx->poic_tagattrval_len = 0; - ctx->poic_cp = cp + 1; - return (true); - } - - _PROP_ASSERT(!_PROP_EOF(*cp)); - cp++; - if (_PROP_EOF(*cp)) - return (false); - - while (_PROP_ISSPACE(*cp)) - cp++; - if (_PROP_EOF(*cp)) - return (false); - - ctx->poic_tagattr = cp; - - while (!_PROP_ISSPACE(*cp) && *cp != '=') { - if (_PROP_EOF(*cp)) - return (false); - cp++; - } - - ctx->poic_tagattr_len = cp - ctx->poic_tagattr; - - cp++; - if (*cp != '\"') - return (false); - cp++; - if (_PROP_EOF(*cp)) - return (false); - - ctx->poic_tagattrval = cp; - while (*cp != '\"') { - if (_PROP_EOF(*cp)) - return (false); - cp++; - } - ctx->poic_tagattrval_len = cp - ctx->poic_tagattrval; - - cp++; - if (*cp != '>') - return (false); - - ctx->poic_cp = cp + 1; - return (true); -} - -/* - * _prop_object_internalize_decode_string -- - * Decode an encoded string. - */ -bool -_prop_object_internalize_decode_string( - struct _prop_object_internalize_context *ctx, - char *target, size_t targsize, size_t *sizep, - const char **cpp) -{ - const char *src; - size_t tarindex; - char c; - - tarindex = 0; - src = ctx->poic_cp; - - for (;;) { - if (_PROP_EOF(*src)) - return (false); - if (*src == '<') { - break; - } - - if ((c = *src) == '&') { - if (src[1] == 'a' && - src[2] == 'm' && - src[3] == 'p' && - src[4] == ';') { - c = '&'; - src += 5; - } else if (src[1] == 'l' && - src[2] == 't' && - src[3] == ';') { - c = '<'; - src += 4; - } else if (src[1] == 'g' && - src[2] == 't' && - src[3] == ';') { - c = '>'; - src += 4; - } else if (src[1] == 'a' && - src[2] == 'p' && - src[3] == 'o' && - src[4] == 's' && - src[5] == ';') { - c = '\''; - src += 6; - } else if (src[1] == 'q' && - src[2] == 'u' && - src[3] == 'o' && - src[4] == 't' && - src[5] == ';') { - c = '\"'; - src += 6; - } else - return (false); - } else - src++; - if (target) { - if (tarindex >= targsize) - return (false); - target[tarindex] = c; - } - tarindex++; - } - - _PROP_ASSERT(*src == '<'); - if (sizep != NULL) - *sizep = tarindex; - if (cpp != NULL) - *cpp = src; - - return (true); -} - -/* - * _prop_object_internalize_match -- - * Returns true if the two character streams match. - */ -bool -_prop_object_internalize_match(const char *str1, size_t len1, - const char *str2, size_t len2) -{ - - return (len1 == len2 && memcmp(str1, str2, len1) == 0); -} - -#define INTERNALIZER(t, f) \ -{ t, sizeof(t) - 1, f } - -static const struct _prop_object_internalizer { - const char *poi_tag; - size_t poi_taglen; - prop_object_internalizer_t poi_intern; -} _prop_object_internalizer_table[] = { - INTERNALIZER("array", _prop_array_internalize), - - INTERNALIZER("true", _prop_bool_internalize), - INTERNALIZER("false", _prop_bool_internalize), - - INTERNALIZER("data", _prop_data_internalize), - - INTERNALIZER("dict", _prop_dictionary_internalize), - - INTERNALIZER("integer", _prop_number_internalize), - - INTERNALIZER("string", _prop_string_internalize), - - { 0, 0, NULL } -}; - -#undef INTERNALIZER - -/* - * _prop_object_internalize_by_tag -- - * Determine the object type from the tag in the context and - * internalize it. - */ -prop_object_t -_prop_object_internalize_by_tag(struct _prop_object_internalize_context *ctx) -{ - const struct _prop_object_internalizer *poi; - prop_object_t obj, parent_obj; - void *data, *iter; - prop_object_internalizer_continue_t iter_func; - struct _prop_stack stack; - - _prop_stack_init(&stack); - -match_start: - for (poi = _prop_object_internalizer_table; - poi->poi_tag != NULL; poi++) { - if (_prop_object_internalize_match(ctx->poic_tagname, - ctx->poic_tagname_len, - poi->poi_tag, - poi->poi_taglen)) - break; - } - if ((poi == NULL) || (poi->poi_tag == NULL)) { - while (_prop_stack_pop(&stack, &obj, &iter, &data, NULL)) { - iter_func = (prop_object_internalizer_continue_t)iter; - (*iter_func)(&stack, &obj, ctx, data, NULL); - } - - return (NULL); - } - - obj = NULL; - if (!(*poi->poi_intern)(&stack, &obj, ctx)) - goto match_start; - - parent_obj = obj; - while (_prop_stack_pop(&stack, &parent_obj, &iter, &data, NULL)) { - iter_func = (prop_object_internalizer_continue_t)iter; - if (!(*iter_func)(&stack, &parent_obj, ctx, data, obj)) - goto match_start; - obj = parent_obj; - } - - return (parent_obj); -} - -prop_object_t -_prop_generic_internalize(const char *xml, const char *master_tag) -{ - prop_object_t obj = NULL; - struct _prop_object_internalize_context *ctx; - - ctx = _prop_object_internalize_context_alloc(xml); - if (ctx == NULL) - return (NULL); - - /* We start with a tag. */ - if (_prop_object_internalize_find_tag(ctx, "plist", - _PROP_TAG_TYPE_START) == false) - goto out; - - /* Plist elements cannot be empty. */ - if (ctx->poic_is_empty_element) - goto out; - - /* - * We don't understand any plist attributes, but Apple XML - * property lists often have a "version" attribute. If we - * see that one, we simply ignore it. - */ - if (ctx->poic_tagattr != NULL && - !_PROP_TAGATTR_MATCH(ctx, "version")) - goto out; - - /* Next we expect to see opening master_tag. */ - if (_prop_object_internalize_find_tag(ctx, master_tag, - _PROP_TAG_TYPE_START) == false) - goto out; - - obj = _prop_object_internalize_by_tag(ctx); - if (obj == NULL) - goto out; - - /* - * We've advanced past the closing master_tag. - * Now we want . - */ - if (_prop_object_internalize_find_tag(ctx, "plist", - _PROP_TAG_TYPE_END) == false) { - prop_object_release(obj); - obj = NULL; - } - - out: - _prop_object_internalize_context_free(ctx); - return (obj); -} - -/* - * _prop_object_internalize_context_alloc -- - * Allocate an internalize context. - */ -struct _prop_object_internalize_context * -_prop_object_internalize_context_alloc(const char *xml) -{ - struct _prop_object_internalize_context *ctx; - - ctx = _PROP_MALLOC(sizeof(struct _prop_object_internalize_context), - M_TEMP); - if (ctx == NULL) - return (NULL); - - ctx->poic_xml = ctx->poic_cp = xml; - - /* - * Skip any whitespace and XML preamble stuff that we don't - * know about / care about. - */ - for (;;) { - while (_PROP_ISSPACE(*xml)) - xml++; - if (_PROP_EOF(*xml) || *xml != '<') - goto bad; - -#define MATCH(str) (memcmp(&xml[1], str, sizeof(str) - 1) == 0) - - /* - * Skip over the XML preamble that Apple XML property - * lists usually include at the top of the file. - */ - if (MATCH("?xml ") || - MATCH("!DOCTYPE plist")) { - while (*xml != '>' && !_PROP_EOF(*xml)) - xml++; - if (_PROP_EOF(*xml)) - goto bad; - xml++; /* advance past the '>' */ - continue; - } - - if (MATCH(" S | - * | Q S --> Q T | - * | t --> | - */ - KASSERT(RB_SENTINEL_P(standin->rb_nodes[standin_other])); - KASSERT(!RB_SENTINEL_P(self->rb_nodes[standin_other])); - KASSERT(self->rb_nodes[standin_which] == standin); - /* - * Have our son/standin adopt his brother as his new son. - */ - standin_father = standin; - } else { - /* - * | R --> S . | - * | / \ | T --> / \ | / | - * | ..... | S --> ..... | T | - * - * Sever standin's connection to his father. - */ - standin_father->rb_nodes[standin_which] = standin_son; - /* - * Adopt the far son. - */ - standin->rb_nodes[standin_other] = self->rb_nodes[standin_other]; - RB_SET_FATHER(standin->rb_nodes[standin_other], standin); - KASSERT(RB_POSITION(self->rb_nodes[standin_other]) == standin_other); - /* - * Use standin_other because we need to preserve standin_which - * for the removal_rebalance. - */ - standin_other = standin_which; - } - - /* - * Move the only remaining son to our standin. If our standin is our - * son, this will be the only son needed to be moved. - */ - KASSERT(standin->rb_nodes[standin_other] != self->rb_nodes[standin_other]); - standin->rb_nodes[standin_other] = self->rb_nodes[standin_other]; - RB_SET_FATHER(standin->rb_nodes[standin_other], standin); - - /* - * Now copy the result of self to standin and then replace - * self with standin in the tree. - */ - RB_COPY_PROPERTIES(standin, self); - RB_SET_FATHER(standin, RB_FATHER(self)); - RB_FATHER(standin)->rb_nodes[RB_POSITION(standin)] = standin; - - /* - * Remove ourselves from the node list, decrement the count, - * and update min/max. - */ - RB_TAILQ_REMOVE(&rbt->rbt_nodes, self, rb_link); - RBSTAT_DEC(rbt->rbt_count); -#ifndef RBSMALL - if (__predict_false(rbt->rbt_minmax[RB_POSITION(self)] == self)) - rbt->rbt_minmax[RB_POSITION(self)] = RB_FATHER(self); - RB_SET_FATHER(self, NULL); -#endif - - KASSERT(rb_tree_check_node(rbt, standin, NULL, false)); - KASSERT(RB_FATHER_SENTINEL_P(standin) - || rb_tree_check_node(rbt, standin_father, NULL, false)); - KASSERT(RB_LEFT_SENTINEL_P(standin) - || rb_tree_check_node(rbt, standin->rb_left, NULL, false)); - KASSERT(RB_RIGHT_SENTINEL_P(standin) - || rb_tree_check_node(rbt, standin->rb_right, NULL, false)); - - if (!rebalance) - return; - - rb_tree_removal_rebalance(rbt, standin_father, standin_which); - KASSERT(rb_tree_check_node(rbt, standin, NULL, true)); -} - -/* - * We could do this by doing - * rb_tree_node_swap(rbt, self, which); - * rb_tree_prune_node(rbt, self, false); - * - * But it's more efficient to just evalate and recolor the child. - */ -static void -rb_tree_prune_blackred_branch(struct rb_tree *rbt, struct rb_node *self, - unsigned int which) -{ - struct rb_node *father = RB_FATHER(self); - struct rb_node *son = self->rb_nodes[which]; -#ifndef RBSMALL - const bool was_root = RB_ROOT_P(rbt, self); -#endif - - KASSERT(which == RB_DIR_LEFT || which == RB_DIR_RIGHT); - KASSERT(RB_BLACK_P(self) && RB_RED_P(son)); - KASSERT(!RB_TWOCHILDREN_P(son)); - KASSERT(RB_CHILDLESS_P(son)); - KASSERT(rb_tree_check_node(rbt, self, NULL, false)); - KASSERT(rb_tree_check_node(rbt, son, NULL, false)); - - /* - * Remove ourselves from the tree and give our former child our - * properties (position, color, root). - */ - RB_COPY_PROPERTIES(son, self); - father->rb_nodes[RB_POSITION(son)] = son; - RB_SET_FATHER(son, father); - - /* - * Remove ourselves from the node list, decrement the count, - * and update minmax. - */ - RB_TAILQ_REMOVE(&rbt->rbt_nodes, self, rb_link); - RBSTAT_DEC(rbt->rbt_count); -#ifndef RBSMALL - if (__predict_false(was_root)) { - KASSERT(rbt->rbt_minmax[which] == son); - rbt->rbt_minmax[which ^ RB_DIR_OTHER] = son; - } else if (rbt->rbt_minmax[RB_POSITION(self)] == self) { - rbt->rbt_minmax[RB_POSITION(self)] = son; - } - RB_SET_FATHER(self, NULL); -#endif - - KASSERT(was_root || rb_tree_check_node(rbt, father, NULL, true)); - KASSERT(rb_tree_check_node(rbt, son, NULL, true)); -} - -void -_prop_rb_tree_remove_node(struct rb_tree *rbt, void *object) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - struct rb_node *standin, *self = RB_ITEMTONODE(rbto, object); - unsigned int which; - - KASSERT(!RB_SENTINEL_P(self)); - RBSTAT_INC(rbt->rbt_removals); - - /* - * In the following diagrams, we (the node to be removed) are S. Red - * nodes are lowercase. T could be either red or black. - * - * Remember the major axiom of the red-black tree: the number of - * black nodes from the root to each leaf is constant across all - * leaves, only the number of red nodes varies. - * - * Thus removing a red leaf doesn't require any other changes to a - * red-black tree. So if we must remove a node, attempt to rearrange - * the tree so we can remove a red node. - * - * The simpliest case is a childless red node or a childless root node: - * - * | T --> T | or | R --> * | - * | s --> * | - */ - if (RB_CHILDLESS_P(self)) { - const bool rebalance = RB_BLACK_P(self) && !RB_ROOT_P(rbt, self); - rb_tree_prune_node(rbt, self, rebalance); - return; - } - KASSERT(!RB_CHILDLESS_P(self)); - if (!RB_TWOCHILDREN_P(self)) { - /* - * The next simpliest case is the node we are deleting is - * black and has one red child. - * - * | T --> T --> T | - * | S --> R --> R | - * | r --> s --> * | - */ - which = RB_LEFT_SENTINEL_P(self) ? RB_DIR_RIGHT : RB_DIR_LEFT; - KASSERT(RB_BLACK_P(self)); - KASSERT(RB_RED_P(self->rb_nodes[which])); - KASSERT(RB_CHILDLESS_P(self->rb_nodes[which])); - rb_tree_prune_blackred_branch(rbt, self, which); - return; - } - KASSERT(RB_TWOCHILDREN_P(self)); - - /* - * We invert these because we prefer to remove from the inside of - * the tree. - */ - which = RB_POSITION(self) ^ RB_DIR_OTHER; - - /* - * Let's find the node closes to us opposite of our parent - * Now swap it with ourself, "prune" it, and rebalance, if needed. - */ - standin = RB_ITEMTONODE(rbto,_prop_rb_tree_iterate(rbt, object, which)); - rb_tree_swap_prune_and_rebalance(rbt, self, standin); -} - -static void -rb_tree_removal_rebalance(struct rb_tree *rbt, struct rb_node *parent, - unsigned int which) -{ - KASSERT(!RB_SENTINEL_P(parent)); - KASSERT(RB_SENTINEL_P(parent->rb_nodes[which])); - KASSERT(which == RB_DIR_LEFT || which == RB_DIR_RIGHT); - RBSTAT_INC(rbt->rbt_removal_rebalance_calls); - - while (RB_BLACK_P(parent->rb_nodes[which])) { - unsigned int other = which ^ RB_DIR_OTHER; - struct rb_node *brother = parent->rb_nodes[other]; - - RBSTAT_INC(rbt->rbt_removal_rebalance_passes); - - KASSERT(!RB_SENTINEL_P(brother)); - /* - * For cases 1, 2a, and 2b, our brother's children must - * be black and our father must be black - */ - if (RB_BLACK_P(parent) - && RB_BLACK_P(brother->rb_left) - && RB_BLACK_P(brother->rb_right)) { - if (RB_RED_P(brother)) { - /* - * Case 1: Our brother is red, swap its - * position (and colors) with our parent. - * This should now be case 2b (unless C or E - * has a red child which is case 3; thus no - * explicit branch to case 2b). - * - * B -> D - * A d -> b E - * C E -> A C - */ - KASSERT(RB_BLACK_P(parent)); - rb_tree_reparent_nodes(rbt, parent, other); - brother = parent->rb_nodes[other]; - KASSERT(!RB_SENTINEL_P(brother)); - KASSERT(RB_RED_P(parent)); - KASSERT(RB_BLACK_P(brother)); - KASSERT(rb_tree_check_node(rbt, brother, NULL, false)); - KASSERT(rb_tree_check_node(rbt, parent, NULL, false)); - } else { - /* - * Both our parent and brother are black. - * Change our brother to red, advance up rank - * and go through the loop again. - * - * B -> *B - * *A D -> A d - * C E -> C E - */ - RB_MARK_RED(brother); - KASSERT(RB_BLACK_P(brother->rb_left)); - KASSERT(RB_BLACK_P(brother->rb_right)); - if (RB_ROOT_P(rbt, parent)) - return; /* root == parent == black */ - KASSERT(rb_tree_check_node(rbt, brother, NULL, false)); - KASSERT(rb_tree_check_node(rbt, parent, NULL, false)); - which = RB_POSITION(parent); - parent = RB_FATHER(parent); - continue; - } - } - /* - * Avoid an else here so that case 2a above can hit either - * case 2b, 3, or 4. - */ - if (RB_RED_P(parent) - && RB_BLACK_P(brother) - && RB_BLACK_P(brother->rb_left) - && RB_BLACK_P(brother->rb_right)) { - KASSERT(RB_RED_P(parent)); - KASSERT(RB_BLACK_P(brother)); - KASSERT(RB_BLACK_P(brother->rb_left)); - KASSERT(RB_BLACK_P(brother->rb_right)); - /* - * We are black, our father is red, our brother and - * both nephews are black. Simply invert/exchange the - * colors of our father and brother (to black and red - * respectively). - * - * | f --> F | - * | * B --> * b | - * | N N --> N N | - */ - RB_MARK_BLACK(parent); - RB_MARK_RED(brother); - KASSERT(rb_tree_check_node(rbt, brother, NULL, true)); - break; /* We're done! */ - } else { - /* - * Our brother must be black and have at least one - * red child (it may have two). - */ - KASSERT(RB_BLACK_P(brother)); - KASSERT(RB_RED_P(brother->rb_nodes[which]) || - RB_RED_P(brother->rb_nodes[other])); - if (RB_BLACK_P(brother->rb_nodes[other])) { - /* - * Case 3: our brother is black, our near - * nephew is red, and our far nephew is black. - * Swap our brother with our near nephew. - * This result in a tree that matches case 4. - * (Our father could be red or black). - * - * | F --> F | - * | x B --> x B | - * | n --> n | - */ - KASSERT(RB_RED_P(brother->rb_nodes[which])); - rb_tree_reparent_nodes(rbt, brother, which); - KASSERT(RB_FATHER(brother) == parent->rb_nodes[other]); - brother = parent->rb_nodes[other]; - KASSERT(RB_RED_P(brother->rb_nodes[other])); - } - /* - * Case 4: our brother is black and our far nephew - * is red. Swap our father and brother locations and - * change our far nephew to black. (these can be - * done in either order so we change the color first). - * The result is a valid red-black tree and is a - * terminal case. (again we don't care about the - * father's color) - * - * If the father is red, we will get a red-black-black - * tree: - * | f -> f --> b | - * | B -> B --> F N | - * | n -> N --> | - * - * If the father is black, we will get an all black - * tree: - * | F -> F --> B | - * | B -> B --> F N | - * | n -> N --> | - * - * If we had two red nephews, then after the swap, - * our former father would have a red grandson. - */ - KASSERT(RB_BLACK_P(brother)); - KASSERT(RB_RED_P(brother->rb_nodes[other])); - RB_MARK_BLACK(brother->rb_nodes[other]); - rb_tree_reparent_nodes(rbt, parent, other); - break; /* We're done! */ - } - } - KASSERT(rb_tree_check_node(rbt, parent, NULL, true)); -} - -void * -_prop_rb_tree_iterate(struct rb_tree *rbt, void *object, - const unsigned int direction) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - const unsigned int other = direction ^ RB_DIR_OTHER; - struct rb_node *self; - - KASSERT(direction == RB_DIR_LEFT || direction == RB_DIR_RIGHT); - - if (object == NULL) { -#ifndef RBSMALL - if (RB_SENTINEL_P(rbt->rbt_root)) - return NULL; - return RB_NODETOITEM(rbto, rbt->rbt_minmax[direction]); -#else - self = rbt->rbt_root; - if (RB_SENTINEL_P(self)) - return NULL; - while (!RB_SENTINEL_P(self->rb_nodes[direction])) - self = self->rb_nodes[direction]; - return RB_NODETOITEM(rbto, self); -#endif /* !RBSMALL */ - } - self = RB_ITEMTONODE(rbto, object); - KASSERT(!RB_SENTINEL_P(self)); - /* - * We can't go any further in this direction. We proceed up in the - * opposite direction until our parent is in direction we want to go. - */ - if (RB_SENTINEL_P(self->rb_nodes[direction])) { - while (!RB_ROOT_P(rbt, self)) { - if (other == RB_POSITION(self)) - return RB_NODETOITEM(rbto, RB_FATHER(self)); - self = RB_FATHER(self); - } - return NULL; - } - - /* - * Advance down one in current direction and go down as far as possible - * in the opposite direction. - */ - self = self->rb_nodes[direction]; - KASSERT(!RB_SENTINEL_P(self)); - while (!RB_SENTINEL_P(self->rb_nodes[other])) - self = self->rb_nodes[other]; - return RB_NODETOITEM(rbto, self); -} - -#ifdef RBDEBUG -static const struct rb_node * -rb_tree_iterate_const(const struct rb_tree *rbt, const struct rb_node *self, - const unsigned int direction) -{ - const unsigned int other = direction ^ RB_DIR_OTHER; - KASSERT(direction == RB_DIR_LEFT || direction == RB_DIR_RIGHT); - - if (self == NULL) { -#ifndef RBSMALL - if (RB_SENTINEL_P(rbt->rbt_root)) - return NULL; - return rbt->rbt_minmax[direction]; -#else - self = rbt->rbt_root; - if (RB_SENTINEL_P(self)) - return NULL; - while (!RB_SENTINEL_P(self->rb_nodes[direction])) - self = self->rb_nodes[direction]; - return self; -#endif /* !RBSMALL */ - } - KASSERT(!RB_SENTINEL_P(self)); - /* - * We can't go any further in this direction. We proceed up in the - * opposite direction until our parent is in direction we want to go. - */ - if (RB_SENTINEL_P(self->rb_nodes[direction])) { - while (!RB_ROOT_P(rbt, self)) { - if (other == RB_POSITION(self)) - return RB_FATHER(self); - self = RB_FATHER(self); - } - return NULL; - } - - /* - * Advance down one in current direction and go down as far as possible - * in the opposite direction. - */ - self = self->rb_nodes[direction]; - KASSERT(!RB_SENTINEL_P(self)); - while (!RB_SENTINEL_P(self->rb_nodes[other])) - self = self->rb_nodes[other]; - return self; -} - -static unsigned int -rb_tree_count_black(const struct rb_node *self) -{ - unsigned int left, right; - - if (RB_SENTINEL_P(self)) - return 0; - - left = rb_tree_count_black(self->rb_left); - right = rb_tree_count_black(self->rb_right); - - KASSERT(left == right); - - return left + RB_BLACK_P(self); -} - -static bool -rb_tree_check_node(const struct rb_tree *rbt, const struct rb_node *self, - const struct rb_node *prev, bool red_check) -{ - const rb_tree_ops_t *rbto = rbt->rbt_ops; - rbto_compare_nodes_fn compare_nodes = rbto->rbto_compare_nodes; - - KASSERT(!RB_SENTINEL_P(self)); - KASSERT(prev == NULL || (*compare_nodes)(rbto->rbto_context, - RB_NODETOITEM(rbto, prev), RB_NODETOITEM(rbto, self)) < 0); - - /* - * Verify our relationship to our parent. - */ - if (RB_ROOT_P(rbt, self)) { - KASSERT(self == rbt->rbt_root); - KASSERT(RB_POSITION(self) == RB_DIR_LEFT); - KASSERT(RB_FATHER(self)->rb_nodes[RB_DIR_LEFT] == self); - KASSERT(RB_FATHER(self) == (const struct rb_node *) &rbt->rbt_root); - } else { - int diff = (*compare_nodes)(rbto->rbto_context, - RB_NODETOITEM(rbto, self), - RB_NODETOITEM(rbto, RB_FATHER(self))); - - KASSERT(self != rbt->rbt_root); - KASSERT(!RB_FATHER_SENTINEL_P(self)); - if (RB_POSITION(self) == RB_DIR_LEFT) { - KASSERT(diff < 0); - KASSERT(RB_FATHER(self)->rb_nodes[RB_DIR_LEFT] == self); - } else { - KASSERT(diff > 0); - KASSERT(RB_FATHER(self)->rb_nodes[RB_DIR_RIGHT] == self); - } - } - - /* - * Verify our position in the linked list against the tree itself. - */ - { - const struct rb_node *prev0 = rb_tree_iterate_const(rbt, self, RB_DIR_LEFT); - const struct rb_node *next0 = rb_tree_iterate_const(rbt, self, RB_DIR_RIGHT); - KASSERT(prev0 == TAILQ_PREV(self, rb_node_qh, rb_link)); - KASSERT(next0 == TAILQ_NEXT(self, rb_link)); -#ifndef RBSMALL - KASSERT(prev0 != NULL || self == rbt->rbt_minmax[RB_DIR_LEFT]); - KASSERT(next0 != NULL || self == rbt->rbt_minmax[RB_DIR_RIGHT]); -#endif - } - - /* - * The root must be black. - * There can never be two adjacent red nodes. - */ - if (red_check) { - KASSERT(!RB_ROOT_P(rbt, self) || RB_BLACK_P(self)); - (void) rb_tree_count_black(self); - if (RB_RED_P(self)) { - const struct rb_node *brother; - KASSERT(!RB_ROOT_P(rbt, self)); - brother = RB_FATHER(self)->rb_nodes[RB_POSITION(self) ^ RB_DIR_OTHER]; - KASSERT(RB_BLACK_P(RB_FATHER(self))); - /* - * I'm red and have no children, then I must either - * have no brother or my brother also be red and - * also have no children. (black count == 0) - */ - KASSERT(!RB_CHILDLESS_P(self) - || RB_SENTINEL_P(brother) - || RB_RED_P(brother) - || RB_CHILDLESS_P(brother)); - /* - * If I'm not childless, I must have two children - * and they must be both be black. - */ - KASSERT(RB_CHILDLESS_P(self) - || (RB_TWOCHILDREN_P(self) - && RB_BLACK_P(self->rb_left) - && RB_BLACK_P(self->rb_right))); - /* - * If I'm not childless, thus I have black children, - * then my brother must either be black or have two - * black children. - */ - KASSERT(RB_CHILDLESS_P(self) - || RB_BLACK_P(brother) - || (RB_TWOCHILDREN_P(brother) - && RB_BLACK_P(brother->rb_left) - && RB_BLACK_P(brother->rb_right))); - } else { - /* - * If I'm black and have one child, that child must - * be red and childless. - */ - KASSERT(RB_CHILDLESS_P(self) - || RB_TWOCHILDREN_P(self) - || (!RB_LEFT_SENTINEL_P(self) - && RB_RIGHT_SENTINEL_P(self) - && RB_RED_P(self->rb_left) - && RB_CHILDLESS_P(self->rb_left)) - || (!RB_RIGHT_SENTINEL_P(self) - && RB_LEFT_SENTINEL_P(self) - && RB_RED_P(self->rb_right) - && RB_CHILDLESS_P(self->rb_right))); - - /* - * If I'm a childless black node and my parent is - * black, my 2nd closet relative away from my parent - * is either red or has a red parent or red children. - */ - if (!RB_ROOT_P(rbt, self) - && RB_CHILDLESS_P(self) - && RB_BLACK_P(RB_FATHER(self))) { - const unsigned int which = RB_POSITION(self); - const unsigned int other = which ^ RB_DIR_OTHER; - const struct rb_node *relative0, *relative; - - relative0 = rb_tree_iterate_const(rbt, - self, other); - KASSERT(relative0 != NULL); - relative = rb_tree_iterate_const(rbt, - relative0, other); - KASSERT(relative != NULL); - KASSERT(RB_SENTINEL_P(relative->rb_nodes[which])); -#if 0 - KASSERT(RB_RED_P(relative) - || RB_RED_P(relative->rb_left) - || RB_RED_P(relative->rb_right) - || RB_RED_P(RB_FATHER(relative))); -#endif - } - } - /* - * A grandparent's children must be real nodes and not - * sentinels. First check out grandparent. - */ - KASSERT(RB_ROOT_P(rbt, self) - || RB_ROOT_P(rbt, RB_FATHER(self)) - || RB_TWOCHILDREN_P(RB_FATHER(RB_FATHER(self)))); - /* - * If we are have grandchildren on our left, then - * we must have a child on our right. - */ - KASSERT(RB_LEFT_SENTINEL_P(self) - || RB_CHILDLESS_P(self->rb_left) - || !RB_RIGHT_SENTINEL_P(self)); - /* - * If we are have grandchildren on our right, then - * we must have a child on our left. - */ - KASSERT(RB_RIGHT_SENTINEL_P(self) - || RB_CHILDLESS_P(self->rb_right) - || !RB_LEFT_SENTINEL_P(self)); - - /* - * If we have a child on the left and it doesn't have two - * children make sure we don't have great-great-grandchildren on - * the right. - */ - KASSERT(RB_TWOCHILDREN_P(self->rb_left) - || RB_CHILDLESS_P(self->rb_right) - || RB_CHILDLESS_P(self->rb_right->rb_left) - || RB_CHILDLESS_P(self->rb_right->rb_left->rb_left) - || RB_CHILDLESS_P(self->rb_right->rb_left->rb_right) - || RB_CHILDLESS_P(self->rb_right->rb_right) - || RB_CHILDLESS_P(self->rb_right->rb_right->rb_left) - || RB_CHILDLESS_P(self->rb_right->rb_right->rb_right)); - - /* - * If we have a child on the right and it doesn't have two - * children make sure we don't have great-great-grandchildren on - * the left. - */ - KASSERT(RB_TWOCHILDREN_P(self->rb_right) - || RB_CHILDLESS_P(self->rb_left) - || RB_CHILDLESS_P(self->rb_left->rb_left) - || RB_CHILDLESS_P(self->rb_left->rb_left->rb_left) - || RB_CHILDLESS_P(self->rb_left->rb_left->rb_right) - || RB_CHILDLESS_P(self->rb_left->rb_right) - || RB_CHILDLESS_P(self->rb_left->rb_right->rb_left) - || RB_CHILDLESS_P(self->rb_left->rb_right->rb_right)); - - /* - * If we are fully interior node, then our predecessors and - * successors must have no children in our direction. - */ - if (RB_TWOCHILDREN_P(self)) { - const struct rb_node *prev0; - const struct rb_node *next0; - - prev0 = rb_tree_iterate_const(rbt, self, RB_DIR_LEFT); - KASSERT(prev0 != NULL); - KASSERT(RB_RIGHT_SENTINEL_P(prev0)); - - next0 = rb_tree_iterate_const(rbt, self, RB_DIR_RIGHT); - KASSERT(next0 != NULL); - KASSERT(RB_LEFT_SENTINEL_P(next0)); - } - } - - return true; -} - -void -_prop_rb_tree_check(const struct rb_tree *rbt, bool red_check) -{ - const struct rb_node *self; - const struct rb_node *prev; -#ifdef RBSTATS - unsigned int count = 0; -#endif - - KASSERT(rbt->rbt_root != NULL); - KASSERT(RB_LEFT_P(rbt->rbt_root)); - -#if defined(RBSTATS) && !defined(RBSMALL) - KASSERT(rbt->rbt_count > 1 - || rbt->rbt_minmax[RB_DIR_LEFT] == rbt->rbt_minmax[RB_DIR_RIGHT]); -#endif - - prev = NULL; - TAILQ_FOREACH(self, &rbt->rbt_nodes, rb_link) { - rb_tree_check_node(rbt, self, prev, false); -#ifdef RBSTATS - count++; -#endif - } -#ifdef RBSTATS - KASSERT(rbt->rbt_count == count); -#endif - if (red_check) { - KASSERT(RB_BLACK_P(rbt->rbt_root)); - KASSERT(RB_SENTINEL_P(rbt->rbt_root) - || rb_tree_count_black(rbt->rbt_root)); - - /* - * The root must be black. - * There can never be two adjacent red nodes. - */ - TAILQ_FOREACH(self, &rbt->rbt_nodes, rb_link) { - rb_tree_check_node(rbt, self, NULL, true); - } - } -} -#endif /* RBDEBUG */ - -#ifdef RBSTATS -static void -rb_tree_mark_depth(const struct rb_tree *rbt, const struct rb_node *self, - size_t *depths, size_t depth) -{ - if (RB_SENTINEL_P(self)) - return; - - if (RB_TWOCHILDREN_P(self)) { - rb_tree_mark_depth(rbt, self->rb_left, depths, depth + 1); - rb_tree_mark_depth(rbt, self->rb_right, depths, depth + 1); - return; - } - depths[depth]++; - if (!RB_LEFT_SENTINEL_P(self)) { - rb_tree_mark_depth(rbt, self->rb_left, depths, depth + 1); - } - if (!RB_RIGHT_SENTINEL_P(self)) { - rb_tree_mark_depth(rbt, self->rb_right, depths, depth + 1); - } -} - -void -rb_tree_depths(const struct rb_tree *rbt, size_t *depths) -{ - rb_tree_mark_depth(rbt, rbt->rbt_root, depths, 1); -} -#endif /* RBSTATS */ diff --git a/common/lib/libprop/prop_rb_impl.h b/common/lib/libprop/prop_rb_impl.h deleted file mode 100644 index 0bcf02474..000000000 --- a/common/lib/libprop/prop_rb_impl.h +++ /dev/null @@ -1,196 +0,0 @@ -/* $NetBSD: prop_rb_impl.h,v 1.9 2012/07/27 09:11:00 pooka Exp $ */ - -/*- - * Copyright (c) 2001 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matt Thomas . - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _PROP_RB_IMPL_H_ -#define _PROP_RB_IMPL_H_ - -#if defined(__NetBSD__) || defined(__minix) -#include - -/* - * Define local names for common rb_tree functions. - */ -#define _prop_rb_tree_init rb_tree_init -#define _prop_rb_tree_insert_node rb_tree_insert_node -#define _prop_rb_tree_find rb_tree_find_node -#define _prop_rb_tree_remove_node rb_tree_remove_node -#define _prop_rb_tree_iterate rb_tree_iterate - -#else /* __NetBSD__ */ - -#include -#ifdef RBDEBUG -#include -#endif - -typedef struct rb_node { - struct rb_node *rb_nodes[2]; -#define RB_DIR_LEFT 0 -#define RB_DIR_RIGHT 1 -#define RB_DIR_OTHER 1 -#define rb_left rb_nodes[RB_DIR_LEFT] -#define rb_right rb_nodes[RB_DIR_RIGHT] - - /* - * rb_info contains the two flags and the parent back pointer. - * We put the two flags in the low two bits since we know that - * rb_node will have an alignment of 4 or 8 bytes. - */ - uintptr_t rb_info; -#define RB_FLAG_POSITION 0x2 -#define RB_FLAG_RED 0x1 -#define RB_FLAG_MASK (RB_FLAG_POSITION|RB_FLAG_RED) -#define RB_FATHER(rb) \ - ((struct rb_node *)((rb)->rb_info & ~RB_FLAG_MASK)) -#define RB_SET_FATHER(rb, father) \ - ((void)((rb)->rb_info = (uintptr_t)(father)|((rb)->rb_info & RB_FLAG_MASK))) - -#define RB_SENTINEL_P(rb) ((rb) == NULL) -#define RB_LEFT_SENTINEL_P(rb) RB_SENTINEL_P((rb)->rb_left) -#define RB_RIGHT_SENTINEL_P(rb) RB_SENTINEL_P((rb)->rb_right) -#define RB_FATHER_SENTINEL_P(rb) RB_SENTINEL_P(RB_FATHER((rb))) -#define RB_CHILDLESS_P(rb) \ - (RB_SENTINEL_P(rb) || (RB_LEFT_SENTINEL_P(rb) && RB_RIGHT_SENTINEL_P(rb))) -#define RB_TWOCHILDREN_P(rb) \ - (!RB_SENTINEL_P(rb) && !RB_LEFT_SENTINEL_P(rb) && !RB_RIGHT_SENTINEL_P(rb)) - -#define RB_POSITION(rb) \ - (((rb)->rb_info & RB_FLAG_POSITION) ? RB_DIR_RIGHT : RB_DIR_LEFT) -#define RB_RIGHT_P(rb) (RB_POSITION(rb) == RB_DIR_RIGHT) -#define RB_LEFT_P(rb) (RB_POSITION(rb) == RB_DIR_LEFT) -#define RB_RED_P(rb) (!RB_SENTINEL_P(rb) && ((rb)->rb_info & RB_FLAG_RED) != 0) -#define RB_BLACK_P(rb) (RB_SENTINEL_P(rb) || ((rb)->rb_info & RB_FLAG_RED) == 0) -#define RB_MARK_RED(rb) ((void)((rb)->rb_info |= RB_FLAG_RED)) -#define RB_MARK_BLACK(rb) ((void)((rb)->rb_info &= ~RB_FLAG_RED)) -#define RB_INVERT_COLOR(rb) ((void)((rb)->rb_info ^= RB_FLAG_RED)) -#define RB_ROOT_P(rbt, rb) ((rbt)->rbt_root == (rb)) -#define RB_SET_POSITION(rb, position) \ - ((void)((position) ? ((rb)->rb_info |= RB_FLAG_POSITION) : \ - ((rb)->rb_info &= ~RB_FLAG_POSITION))) -#define RB_ZERO_PROPERTIES(rb) ((void)((rb)->rb_info &= ~RB_FLAG_MASK)) -#define RB_COPY_PROPERTIES(dst, src) \ - ((void)((dst)->rb_info ^= ((dst)->rb_info ^ (src)->rb_info) & RB_FLAG_MASK)) -#define RB_SWAP_PROPERTIES(a, b) do { \ - uintptr_t xorinfo = ((a)->rb_info ^ (b)->rb_info) & RB_FLAG_MASK; \ - (a)->rb_info ^= xorinfo; \ - (b)->rb_info ^= xorinfo; \ - } while (/*CONSTCOND*/ 0) -#ifdef RBDEBUG - TAILQ_ENTRY(rb_node) rb_link; -#endif -} rb_node_t; - -#define RB_TREE_MIN(T) rb_tree_iterate((T), NULL, RB_DIR_LEFT) -#define RB_TREE_MAX(T) rb_tree_iterate((T), NULL, RB_DIR_RIGHT) -#define RB_TREE_FOREACH(N, T) \ - for ((N) = RB_TREE_MIN(T); (N); \ - (N) = rb_tree_iterate((T), (N), RB_DIR_RIGHT)) -#define RB_TREE_FOREACH_REVERSE(N, T) \ - for ((N) = RB_TREE_MAX(T); (N); \ - (N) = rb_tree_iterate((T), (N), RB_DIR_LEFT)) - -#ifdef RBDEBUG -TAILQ_HEAD(rb_node_qh, rb_node); - -#define RB_TAILQ_REMOVE(a, b, c) TAILQ_REMOVE(a, b, c) -#define RB_TAILQ_INIT(a) TAILQ_INIT(a) -#define RB_TAILQ_INSERT_HEAD(a, b, c) TAILQ_INSERT_HEAD(a, b, c) -#define RB_TAILQ_INSERT_BEFORE(a, b, c) TAILQ_INSERT_BEFORE(a, b, c) -#define RB_TAILQ_INSERT_AFTER(a, b, c, d) TAILQ_INSERT_AFTER(a, b, c, d) -#else -#define RB_TAILQ_REMOVE(a, b, c) do { } while (/*CONSTCOND*/0) -#define RB_TAILQ_INIT(a) do { } while (/*CONSTCOND*/0) -#define RB_TAILQ_INSERT_HEAD(a, b, c) do { } while (/*CONSTCOND*/0) -#define RB_TAILQ_INSERT_BEFORE(a, b, c) do { } while (/*CONSTCOND*/0) -#define RB_TAILQ_INSERT_AFTER(a, b, c, d) do { } while (/*CONSTCOND*/0) -#endif /* RBDEBUG */ - -/* - * rbto_compare_nodes_fn: - * return a positive value if the first node > the second node. - * return a negative value if the first node < the second node. - * return 0 if they are considered same. - * - * rbto_compare_key_fn: - * return a positive value if the node > the key. - * return a negative value if the node < the key. - * return 0 if they are considered same. - */ - -typedef signed int (*rbto_compare_nodes_fn)(void *, const void *, const void *); -typedef signed int (*rbto_compare_key_fn)(void *, const void *, const void *); - -typedef struct { - rbto_compare_nodes_fn rbto_compare_nodes; - rbto_compare_key_fn rbto_compare_key; - size_t rbto_node_offset; - void *rbto_context; -} rb_tree_ops_t; - -typedef struct rb_tree { - struct rb_node *rbt_root; - const rb_tree_ops_t *rbt_ops; - struct rb_node *rbt_minmax[2]; -#ifdef RBDEBUG - struct rb_node_qh rbt_nodes; -#endif -#ifdef RBSTATS - unsigned int rbt_count; - unsigned int rbt_insertions; - unsigned int rbt_removals; - unsigned int rbt_insertion_rebalance_calls; - unsigned int rbt_insertion_rebalance_passes; - unsigned int rbt_removal_rebalance_calls; - unsigned int rbt_removal_rebalance_passes; -#endif -} rb_tree_t; - -#ifdef RBSTATS -#define RBSTAT_INC(v) ((void)((v)++)) -#define RBSTAT_DEC(v) ((void)((v)--)) -#else -#define RBSTAT_INC(v) do { } while (/*CONSTCOND*/0) -#define RBSTAT_DEC(v) do { } while (/*CONSTCOND*/0) -#endif - -void _prop_rb_tree_init(rb_tree_t *, const rb_tree_ops_t *); -void * _prop_rb_tree_insert_node(rb_tree_t *, void *); -void * _prop_rb_tree_find(rb_tree_t *, const void *); -void * _prop_rb_tree_find_node(rb_tree_t *, const void *); -void _prop_rb_tree_remove_node(rb_tree_t *, void *); -void * _prop_rb_tree_iterate(rb_tree_t *, void *, const unsigned int); -#ifdef RBDEBUG -void _prop_rb_tree_check(const struct rb_tree *, bool); -#endif - -#endif /* __NetBSD__ */ - -#endif /* _PROP_RB_IMPL_H_*/ diff --git a/common/lib/libprop/prop_send_ioctl.3 b/common/lib/libprop/prop_send_ioctl.3 deleted file mode 100644 index 5a5d53b8d..000000000 --- a/common/lib/libprop/prop_send_ioctl.3 +++ /dev/null @@ -1,151 +0,0 @@ -.\" $NetBSD: prop_send_ioctl.3,v 1.9 2015/08/20 15:55:09 phx Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd January 21, 2008 -.Dt PROP_SEND_IOCTL 3 -.Os -.Sh NAME -.Nm prop_array_send_ioctl , -.Nm prop_array_recv_ioctl , -.Nm prop_dictionary_send_ioctl , -.Nm prop_dictionary_recv_ioctl , -.Nm prop_dictionary_sendrecv_ioctl -.Nd Send and receive property lists to and from the kernel using ioctl -.Sh SYNOPSIS -.In prop/proplib.h -.Ft int -.Fn prop_array_send_ioctl "prop_array_t array" "int fd" "unsigned long cmd" -.Ft int -.Fn prop_array_recv_ioctl "int fd" "unsigned long cmd" "prop_array_t *arrayp" -.Ft int -.Fn prop_dictionary_send_ioctl "prop_dictionary_t dict" "int fd" \ - "unsigned long cmd" -.Ft int -.Fn prop_dictionary_recv_ioctl "int fd" "unsigned long cmd" \ - "prop_dictionary_t *dictp" -.Ft int -.Fn prop_dictionary_sendrecv_ioctl "prop_dictionary_t dict" "int fd" \ - "unsigned long cmd" "prop_dictionary_t *dictp" -.Sh DESCRIPTION -The -.Nm prop_array_send_ioctl , -.Nm prop_array_recv_ioctl , -.Nm prop_dictionary_send_ioctl , -.Nm prop_dictionary_recv_ioctl , -and -.Nm prop_dictionary_sendrecv_ioctl -functions implement the user space side of a protocol for sending property -lists to and from the kernel using -.Xr ioctl 2 . -.Sh RETURN VALUES -If successful, functions return zero. -Otherwise, an error number is returned to indicate the error. -.Sh EXAMPLES -The following -.Pq simplified -example demonstrates using -.Fn prop_dictionary_send_ioctl -and -.Fn prop_dictionary_recv_ioctl -in an application: -.Bd -literal -void -foo_setprops(prop_dictionary_t dict) -{ - int fd; - - fd = open("/dev/foo", O_RDWR, 0640); - if (fd == -1) - return; - - (void) prop_dictionary_send_ioctl(dict, fd, FOOSETPROPS); - - (void) close(fd); -} - -prop_dictionary_t -foo_getprops(void) -{ - prop_dictionary_t dict; - int fd; - - fd = open("/dev/foo", O_RDONLY, 0640); - if (fd == -1) - return (NULL); - - if (prop_dictionary_recv_ioctl(fd, FOOGETPROPS, \*[Am]dict) != 0) - return (NULL); - - (void) close(fd); - - return (dict); -} -.Ed -.Pp -The -.Nm prop_dictionary_sendrecv_ioctl -function combines the send and receive functionality, allowing for -ioctls that require two-way communication -.Pq for example to specify arguments for the ioctl operation . -.Sh ERRORS -.Fn prop_array_send_ioctl -and -.Fn prop_dictionary_send_ioctl -will fail if: -.Bl -tag -width Er -.It Bq Er ENOMEM -Cannot allocate memory -.It Bq Er ENOTSUP -Not supported -.El -.Pp -.Fn prop_array_recv_ioctl -and -.Fn prop_dictionary_recv_ioctl -will fail if: -.Bl -tag -width Er -.It Bq Er EIO -Input/output error -.It Bq Er ENOTSUP -Not supported -.El -.Pp -In addition to these, -.Xr ioctl 2 -errors may be returned. -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_dictionary 3 , -.Xr proplib 3 , -.Xr prop_copyin_ioctl 9 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_send_syscall.3 b/common/lib/libprop/prop_send_syscall.3 deleted file mode 100644 index 4150fd2ac..000000000 --- a/common/lib/libprop/prop_send_syscall.3 +++ /dev/null @@ -1,128 +0,0 @@ -.\" $NetBSD: prop_send_syscall.3,v 1.5 2011/09/30 22:08:18 jym Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd January 17, 2011 -.Dt PROP_SEND_SYCALL 3 -.Os -.Sh NAME -.Nm prop_array_send_syscall , -.Nm prop_array_recv_syscall , -.Nm prop_dictionary_send_syscall , -.Nm prop_dictionary_recv_syscall -.Nd send and receive property lists to and from the kernel using syscalls -.Sh SYNOPSIS -.In prop/proplib.h -.Ft int -.Fn prop_array_send_syscall "prop_array_t array" "struct plistref *prefp" -.Ft int -.Fn prop_array_recv_syscall "const struct plistref *prefp" \ - "prop_array_t *arrayp" -.Ft int -.Fn prop_dictionary_send_syscall "prop_dictionary_t dict" \ - "struct plistref *prefp" -.Ft int -.Fn prop_dictionary_recv_syscall "const struct plistref *prefp" \ - "prop_dictionary_t *dictp" -.Sh DESCRIPTION -The -.Nm prop_array_send_syscall , -.Nm prop_array_recv_syscall , -.Nm prop_dictionary_send_syscall , -and -.Nm prop_dictionary_recv_syscall -functions implement the user space side of a protocol for sending property -lists to and from the kernel using -.Xr syscall 2 . -.Sh RETURN VALUES -If successful, functions return zero. -Otherwise, an error number is returned to indicate the error. -.Sh EXAMPLES -The following -.Pq simplified -example demonstrates using -.Fn prop_dictionary_send_syscall -and -.Fn prop_dictionary_recv_syscall -in an application: -.Bd -literal -void -foo_setprops(prop_dictionary_t dict) -{ - struct pref pref; - - (void) prop_dictionary_send_syscall(dict, \*[Am]pref); - (void) my_syscall_set(\*[Am]pref); - -} - -prop_dictionary_t -foo_getprops(void) -{ - prop_dictionary_t dict; - struct pref pref; - - (void) my_syscall_get(\*[Am]pref); - if (prop_dictionary_recv_syscall(\*[Am]pref, \*[Am]dict) != 0) - return (NULL); - - return (dict); -} -.Ed -.Sh ERRORS -.Fn prop_array_send_syscall -and -.Fn prop_dictionary_send_syscall -will fail if: -.Bl -tag -width Er -.It Bq Er ENOMEM -Cannot allocate memory -.It Bq Er ENOTSUP -Not supported -.El -.Pp -.Fn prop_array_recv_syscall -and -.Fn prop_dictionary_recv_syscall -will fail if: -.Bl -tag -width Er -.It Bq Er EIO -Input/output error -.It Bq Er ENOTSUP -Not supported -.El -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_dictionary 3 , -.Xr proplib 3 , -.Xr prop_copyin_ioctl 9 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_stack.c b/common/lib/libprop/prop_stack.c deleted file mode 100644 index a08118c2a..000000000 --- a/common/lib/libprop/prop_stack.c +++ /dev/null @@ -1,118 +0,0 @@ -/* $NetBSD: prop_stack.c,v 1.2 2007/08/30 12:23:54 joerg Exp $ */ - -/*- - * Copyright (c) 2007 Joerg Sonnenberger . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "prop_stack.h" -#include "prop_object_impl.h" - -void -_prop_stack_init(prop_stack_t stack) -{ - stack->used_intern_elems = 0; - SLIST_INIT(&stack->extern_elems); -} - -bool -_prop_stack_push(prop_stack_t stack, prop_object_t obj, void *data1, - void *data2, void *data3) -{ - struct _prop_stack_extern_elem *eelem; - struct _prop_stack_intern_elem *ielem; - - if (stack->used_intern_elems == PROP_STACK_INTERN_ELEMS) { - eelem = _PROP_MALLOC(sizeof(*eelem), M_TEMP); - - if (eelem == NULL) - return false; - - eelem->object = obj; - eelem->object_data[0] = data1; - eelem->object_data[1] = data2; - eelem->object_data[2] = data3; - - SLIST_INSERT_HEAD(&stack->extern_elems, eelem, stack_link); - - return true; - } - - _PROP_ASSERT(stack->used_intern_elems < PROP_STACK_INTERN_ELEMS); - _PROP_ASSERT(SLIST_EMPTY(&stack->extern_elems)); - - ielem = &stack->intern_elems[stack->used_intern_elems]; - ielem->object = obj; - ielem->object_data[0] = data1; - ielem->object_data[1] = data2; - ielem->object_data[2] = data3; - - ++stack->used_intern_elems; - - return true; -} - -bool -_prop_stack_pop(prop_stack_t stack, prop_object_t *obj, void **data1, - void **data2, void **data3) -{ - struct _prop_stack_extern_elem *eelem; - struct _prop_stack_intern_elem *ielem; - - if (stack->used_intern_elems == 0) - return false; - - if ((eelem = SLIST_FIRST(&stack->extern_elems)) != NULL) { - _PROP_ASSERT(stack->used_intern_elems == PROP_STACK_INTERN_ELEMS); - - SLIST_REMOVE_HEAD(&stack->extern_elems, stack_link); - if (obj) - *obj = eelem->object; - if (data1) - *data1 = eelem->object_data[0]; - if (data2) - *data2 = eelem->object_data[1]; - if (data3) - *data3 = eelem->object_data[2]; - _PROP_FREE(eelem, M_TEMP); - return true; - } - - --stack->used_intern_elems; - ielem = &stack->intern_elems[stack->used_intern_elems]; - - if (obj) - *obj = ielem->object; - if (data1) - *data1 = ielem->object_data[0]; - if (data2) - *data2 = ielem->object_data[1]; - if (data3) - *data3 = ielem->object_data[2]; - - return true; -} diff --git a/common/lib/libprop/prop_stack.h b/common/lib/libprop/prop_stack.h deleted file mode 100644 index dca99c152..000000000 --- a/common/lib/libprop/prop_stack.h +++ /dev/null @@ -1,64 +0,0 @@ -/* $NetBSD: prop_stack.h,v 1.2 2007/08/30 12:23:54 joerg Exp $ */ - -/*- - * Copyright (c) 2007 Joerg Sonnenberger . - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef _PROP_STACK_H -#define _PROP_STACK_H - -#include - -#include - -struct _prop_stack_intern_elem { - prop_object_t object; - void *object_data[3]; -}; - -struct _prop_stack_extern_elem { - SLIST_ENTRY(_prop_stack_extern_elem) stack_link; - prop_object_t object; - void *object_data[3]; -}; - -#define PROP_STACK_INTERN_ELEMS 16 - -struct _prop_stack { - struct _prop_stack_intern_elem intern_elems[PROP_STACK_INTERN_ELEMS]; - size_t used_intern_elems; - SLIST_HEAD(, _prop_stack_extern_elem) extern_elems; -}; - -typedef struct _prop_stack *prop_stack_t; - -void _prop_stack_init(prop_stack_t); -bool _prop_stack_push(prop_stack_t, prop_object_t, void *, void *, void *); -bool _prop_stack_pop(prop_stack_t, prop_object_t *, void **, void **, void **); - -#endif diff --git a/common/lib/libprop/prop_string.3 b/common/lib/libprop/prop_string.3 deleted file mode 100644 index 4b9607108..000000000 --- a/common/lib/libprop/prop_string.3 +++ /dev/null @@ -1,193 +0,0 @@ -.\" $NetBSD: prop_string.3,v 1.8 2011/02/26 12:56:36 wiz Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd January 21, 2008 -.Dt PROP_STRING 3 -.Os -.Sh NAME -.Nm prop_string , -.Nm prop_string_create , -.Nm prop_string_create_cstring , -.Nm prop_string_create_cstring_nocopy , -.Nm prop_string_copy , -.Nm prop_string_copy_mutable , -.Nm prop_string_size , -.Nm prop_string_mutable , -.Nm prop_string_cstring , -.Nm prop_string_cstring_nocopy , -.Nm prop_string_append , -.Nm prop_string_append_cstring , -.Nm prop_string_equals , -.Nm prop_string_equals_cstring -.Nd string value property object -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.\" -.Ft prop_string_t -.Fn prop_string_create "void" -.Ft prop_string_t -.Fn prop_string_create_cstring "const char *cstring" -.Ft prop_string_t -.Fn prop_string_create_cstring_nocopy "const char *cstring" -.\" -.Ft prop_string_t -.Fn prop_string_copy "prop_string_t string" -.Ft prop_string_t -.Fn prop_string_copy_mutable "prop_string_t string" -.\" -.Ft size_t -.Fn prop_string_size "prop_string_t string" -.Ft bool -.Fn prop_string_mutable "prop_string_t string" -.\" -.Ft char * -.Fn prop_string_cstring "prop_string_t string" -.Ft const char * -.Fn prop_string_cstring_nocopy "prop_string_t string" -.\" -.Ft bool -.Fn prop_string_append "prop_string_t str1" "prop_string_t str2" -.Ft bool -.Fn prop_string_append_cstring "prop_string_t string" "const char *cstring" -.\" -.Ft bool -.Fn prop_string_equals "prop_string_t str1" "prop_string_t str2" -.Ft bool -.Fn prop_string_equals_cstring "prop_string_t string" "const char *cstring" -.Sh DESCRIPTION -The -.Nm prop_string -family of functions operate on a string value property object type. -.Bl -tag -width "xxxxx" -.It Fn prop_string_create "void" -Create an empty mutable string. -Returns -.Dv NULL -on failure. -.It Fn prop_string_create_cstring "const char *cstring" -Create a mutable string that contains a copy of -.Fa cstring . -Returns -.Dv NULL -on failure. -.It Fn prop_string_create_cstring_nocopy "const char *cstring" -Create an immutable string that contains a reference to -.Fa cstring . -Returns -.Dv NULL -on failure. -.It Fn prop_string_copy "prop_string_t string" -Copy a string. -If the string being copied is an immutable external C string reference, -then the copy is also immutable and references the same external C string. -Returns -.Dv NULL -on failure. -.It Fn prop_string_copy_mutable "prop_string_t string" -Copy a string, always creating a mutable copy. -Returns -.Dv NULL -on failure. -.It Fn prop_string_size "prop_string_t string" -Returns the size of the string, not including the terminating NUL. -If the supplied object isn't a string, zero is returned. -.It Fn prop_string_mutable "prop_string_t string" -Returns -.Dv true -if the string is mutable. -If the supplied object isn't a string, -.Dv false -is returned. -.It Fn prop_string_cstring "prop_string_t string" -Returns a copy of the string's contents as a C string. -The caller is responsible for freeing the returned buffer. -.Pp -In user space, the buffer is allocated using -.Xr malloc 3 . -In the kernel, the buffer is allocated using -.Xr malloc 9 -using the malloc type -.Dv M_TEMP . -.Pp -Returns -.Dv NULL -on failure. -.It Fn prop_string_cstring_nocopy "prop_string_t string" -Returns an immutable reference to the contents of the string as a -C string. -If the supplied object isn't a string, -.Dv NULL -is returned. -.It Fn prop_string_append "prop_string_t str1" "prop_string_t str2" -Append the contents of -.Fa str2 -to -.Fa str1 , -which must be mutable. -Returns -.Dv true -upon success and -.Dv false -otherwise. -.It Fn prop_string_append_cstring "prop_string_t string" "const char *cstring" -Append the C string -.Fa cstring -to -.Fa string , -which must be mutable. -Returns -.Dv true -upon success and -.Dv false -otherwise. -.It Fn prop_string_equals "prop_string_t str1" "prop_string_t str2" -Returns -.Dv true -if the two string objects are equivalent. -.It Fn prop_string_equals_cstring "prop_string_t string" "const char *cstring" -Returns -.Dv true -if the string's value is equivalent to -.Fa cstring . -.El -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_bool 3 , -.Xr prop_data 3 , -.Xr prop_dictionary 3 , -.Xr prop_number 3 , -.Xr prop_object 3 , -.Xr proplib 3 -.Sh HISTORY -The -.Nm proplib -property container object library first appeared in -.Nx 4.0 . diff --git a/common/lib/libprop/prop_string.c b/common/lib/libprop/prop_string.c deleted file mode 100644 index a53128c81..000000000 --- a/common/lib/libprop/prop_string.c +++ /dev/null @@ -1,471 +0,0 @@ -/* $NetBSD: prop_string.c,v 1.12 2014/03/26 18:12:46 christos Exp $ */ - -/*- - * Copyright (c) 2006 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Jason R. Thorpe. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#include -#include "prop_object_impl.h" - -struct _prop_string { - struct _prop_object ps_obj; - union { - char * psu_mutable; - const char * psu_immutable; - } ps_un; -#define ps_mutable ps_un.psu_mutable -#define ps_immutable ps_un.psu_immutable - size_t ps_size; /* not including \0 */ - int ps_flags; -}; - -#define PS_F_NOCOPY 0x01 - -_PROP_POOL_INIT(_prop_string_pool, sizeof(struct _prop_string), "propstng") - -_PROP_MALLOC_DEFINE(M_PROP_STRING, "prop string", - "property string container object") - -static _prop_object_free_rv_t - _prop_string_free(prop_stack_t, prop_object_t *); -static bool _prop_string_externalize( - struct _prop_object_externalize_context *, - void *); -static _prop_object_equals_rv_t - _prop_string_equals(prop_object_t, prop_object_t, - void **, void **, - prop_object_t *, prop_object_t *); - -static const struct _prop_object_type _prop_object_type_string = { - .pot_type = PROP_TYPE_STRING, - .pot_free = _prop_string_free, - .pot_extern = _prop_string_externalize, - .pot_equals = _prop_string_equals, -}; - -#define prop_object_is_string(x) \ - ((x) != NULL && (x)->ps_obj.po_type == &_prop_object_type_string) -#define prop_string_contents(x) ((x)->ps_immutable ? (x)->ps_immutable : "") - -/* ARGSUSED */ -static _prop_object_free_rv_t -_prop_string_free(prop_stack_t stack, prop_object_t *obj) -{ - prop_string_t ps = *obj; - - if ((ps->ps_flags & PS_F_NOCOPY) == 0 && ps->ps_mutable != NULL) - _PROP_FREE(ps->ps_mutable, M_PROP_STRING); - _PROP_POOL_PUT(_prop_string_pool, ps); - - return (_PROP_OBJECT_FREE_DONE); -} - -static bool -_prop_string_externalize(struct _prop_object_externalize_context *ctx, - void *v) -{ - prop_string_t ps = v; - - if (ps->ps_size == 0) - return (_prop_object_externalize_empty_tag(ctx, "string")); - - if (_prop_object_externalize_start_tag(ctx, "string") == false || - _prop_object_externalize_append_encoded_cstring(ctx, - ps->ps_immutable) == false || - _prop_object_externalize_end_tag(ctx, "string") == false) - return (false); - - return (true); -} - -/* ARGSUSED */ -static _prop_object_equals_rv_t -_prop_string_equals(prop_object_t v1, prop_object_t v2, - void **stored_pointer1, void **stored_pointer2, - prop_object_t *next_obj1, prop_object_t *next_obj2) -{ - prop_string_t str1 = v1; - prop_string_t str2 = v2; - - if (str1 == str2) - return (_PROP_OBJECT_EQUALS_TRUE); - if (str1->ps_size != str2->ps_size) - return (_PROP_OBJECT_EQUALS_FALSE); - if (strcmp(prop_string_contents(str1), prop_string_contents(str2))) - return (_PROP_OBJECT_EQUALS_FALSE); - else - return (_PROP_OBJECT_EQUALS_TRUE); -} - -static prop_string_t -_prop_string_alloc(void) -{ - prop_string_t ps; - - ps = _PROP_POOL_GET(_prop_string_pool); - if (ps != NULL) { - _prop_object_init(&ps->ps_obj, &_prop_object_type_string); - - ps->ps_mutable = NULL; - ps->ps_size = 0; - ps->ps_flags = 0; - } - - return (ps); -} - -/* - * prop_string_create -- - * Create an empty mutable string. - */ -prop_string_t -prop_string_create(void) -{ - - return (_prop_string_alloc()); -} - -/* - * prop_string_create_cstring -- - * Create a string that contains a copy of the provided C string. - */ -prop_string_t -prop_string_create_cstring(const char *str) -{ - prop_string_t ps; - char *cp; - size_t len; - - ps = _prop_string_alloc(); - if (ps != NULL) { - len = strlen(str); - cp = _PROP_MALLOC(len + 1, M_PROP_STRING); - if (cp == NULL) { - prop_object_release(ps); - return (NULL); - } - strcpy(cp, str); - ps->ps_mutable = cp; - ps->ps_size = len; - } - return (ps); -} - -/* - * prop_string_create_cstring_nocopy -- - * Create an immutable string that contains a refrence to the - * provided C string. - */ -prop_string_t -prop_string_create_cstring_nocopy(const char *str) -{ - prop_string_t ps; - - ps = _prop_string_alloc(); - if (ps != NULL) { - ps->ps_immutable = str; - ps->ps_size = strlen(str); - ps->ps_flags |= PS_F_NOCOPY; - } - return (ps); -} - -/* - * prop_string_copy -- - * Copy a string. If the original string is immutable, then the - * copy is also immutable and references the same external data. - */ -prop_string_t -prop_string_copy(prop_string_t ops) -{ - prop_string_t ps; - - if (! prop_object_is_string(ops)) - return (NULL); - - ps = _prop_string_alloc(); - if (ps != NULL) { - ps->ps_size = ops->ps_size; - ps->ps_flags = ops->ps_flags; - if (ops->ps_flags & PS_F_NOCOPY) - ps->ps_immutable = ops->ps_immutable; - else { - char *cp = _PROP_MALLOC(ps->ps_size + 1, M_PROP_STRING); - if (cp == NULL) { - prop_object_release(ps); - return (NULL); - } - strcpy(cp, prop_string_contents(ops)); - ps->ps_mutable = cp; - } - } - return (ps); -} - -/* - * prop_string_copy_mutable -- - * Copy a string, always returning a mutable copy. - */ -prop_string_t -prop_string_copy_mutable(prop_string_t ops) -{ - prop_string_t ps; - char *cp; - - if (! prop_object_is_string(ops)) - return (NULL); - - ps = _prop_string_alloc(); - if (ps != NULL) { - ps->ps_size = ops->ps_size; - cp = _PROP_MALLOC(ps->ps_size + 1, M_PROP_STRING); - if (cp == NULL) { - prop_object_release(ps); - return (NULL); - } - strcpy(cp, prop_string_contents(ops)); - ps->ps_mutable = cp; - } - return (ps); -} - -/* - * prop_string_size -- - * Return the size of the string, not including the terminating NUL. - */ -size_t -prop_string_size(prop_string_t ps) -{ - - if (! prop_object_is_string(ps)) - return (0); - - return (ps->ps_size); -} - -/* - * prop_string_mutable -- - * Return true if the string is a mutable string. - */ -bool -prop_string_mutable(prop_string_t ps) -{ - - if (! prop_object_is_string(ps)) - return (false); - - return ((ps->ps_flags & PS_F_NOCOPY) == 0); -} - -/* - * prop_string_cstring -- - * Return a copy of the contents of the string as a C string. - * The string is allocated with the M_TEMP malloc type. - */ -char * -prop_string_cstring(prop_string_t ps) -{ - char *cp; - - if (! prop_object_is_string(ps)) - return (NULL); - - cp = _PROP_MALLOC(ps->ps_size + 1, M_TEMP); - if (cp != NULL) - strcpy(cp, prop_string_contents(ps)); - - return (cp); -} - -/* - * prop_string_cstring_nocopy -- - * Return an immutable reference to the contents of the string - * as a C string. - */ -const char * -prop_string_cstring_nocopy(prop_string_t ps) -{ - - if (! prop_object_is_string(ps)) - return (NULL); - - return (prop_string_contents(ps)); -} - -/* - * prop_string_append -- - * Append the contents of one string to another. Returns true - * upon success. The destination string must be mutable. - */ -bool -prop_string_append(prop_string_t dst, prop_string_t src) -{ - char *ocp, *cp; - size_t len; - - if (! (prop_object_is_string(dst) && - prop_object_is_string(src))) - return (false); - - if (dst->ps_flags & PS_F_NOCOPY) - return (false); - - len = dst->ps_size + src->ps_size; - cp = _PROP_MALLOC(len + 1, M_PROP_STRING); - if (cp == NULL) - return (false); - snprintf(cp, len + 1, "%s%s", prop_string_contents(dst), - prop_string_contents(src)); - ocp = dst->ps_mutable; - dst->ps_mutable = cp; - dst->ps_size = len; - if (ocp != NULL) - _PROP_FREE(ocp, M_PROP_STRING); - - return (true); -} - -/* - * prop_string_append_cstring -- - * Append a C string to a string. Returns true upon success. - * The destination string must be mutable. - */ -bool -prop_string_append_cstring(prop_string_t dst, const char *src) -{ - char *ocp, *cp; - size_t len; - - if (! prop_object_is_string(dst)) - return (false); - - _PROP_ASSERT(src != NULL); - - if (dst->ps_flags & PS_F_NOCOPY) - return (false); - - len = dst->ps_size + strlen(src); - cp = _PROP_MALLOC(len + 1, M_PROP_STRING); - if (cp == NULL) - return (false); - snprintf(cp, len + 1, "%s%s", prop_string_contents(dst), src); - ocp = dst->ps_mutable; - dst->ps_mutable = cp; - dst->ps_size = len; - if (ocp != NULL) - _PROP_FREE(ocp, M_PROP_STRING); - - return (true); -} - -/* - * prop_string_equals -- - * Return true if two strings are equivalent. - */ -bool -prop_string_equals(prop_string_t str1, prop_string_t str2) -{ - if (!prop_object_is_string(str1) || !prop_object_is_string(str2)) - return (false); - - return prop_object_equals(str1, str2); -} - -/* - * prop_string_equals_cstring -- - * Return true if the string is equivalent to the specified - * C string. - */ -bool -prop_string_equals_cstring(prop_string_t ps, const char *cp) -{ - - if (! prop_object_is_string(ps)) - return (false); - - return (strcmp(prop_string_contents(ps), cp) == 0); -} - -/* - * _prop_string_internalize -- - * Parse a ... and return the object created from the - * external representation. - */ -/* ARGSUSED */ -bool -_prop_string_internalize(prop_stack_t stack, prop_object_t *obj, - struct _prop_object_internalize_context *ctx) -{ - prop_string_t string; - char *str; - size_t len, alen; - - if (ctx->poic_is_empty_element) { - *obj = prop_string_create(); - return (true); - } - - /* No attributes recognized here. */ - if (ctx->poic_tagattr != NULL) - return (true); - - /* Compute the length of the result. */ - if (_prop_object_internalize_decode_string(ctx, NULL, 0, &len, - NULL) == false) - return (true); - - str = _PROP_MALLOC(len + 1, M_PROP_STRING); - if (str == NULL) - return (true); - - if (_prop_object_internalize_decode_string(ctx, str, len, &alen, - &ctx->poic_cp) == false || - alen != len) { - _PROP_FREE(str, M_PROP_STRING); - return (true); - } - str[len] = '\0'; - - if (_prop_object_internalize_find_tag(ctx, "string", - _PROP_TAG_TYPE_END) == false) { - _PROP_FREE(str, M_PROP_STRING); - return (true); - } - - string = _prop_string_alloc(); - if (string == NULL) { - _PROP_FREE(str, M_PROP_STRING); - return (true); - } - - string->ps_mutable = str; - string->ps_size = len; - *obj = string; - - return (true); -} diff --git a/common/lib/libprop/proplib.3 b/common/lib/libprop/proplib.3 deleted file mode 100644 index ed6bc2975..000000000 --- a/common/lib/libprop/proplib.3 +++ /dev/null @@ -1,139 +0,0 @@ -.\" $NetBSD: proplib.3,v 1.8 2012/03/15 22:35:02 njoly Exp $ -.\" -.\" Copyright (c) 2006 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Jason R. Thorpe. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd January 17, 2011 -.Dt PROPLIB 3 -.Os -.Sh NAME -.Nm proplib -.Nd property container object library -.Sh LIBRARY -.Lb libprop -.Sh SYNOPSIS -.In prop/proplib.h -.Sh DESCRIPTION -The -.Nm -library provides an abstract interface for creating and manipulating -property lists. -Property lists have object types for boolean values, opaque data, numbers, -and strings. -Structure is provided by the array and dictionary collection types. -.Pp -Property lists can be passed across protection boundaries by translating -them to an external representation. -This external representation is an XML document whose format is described -by the following DTD: -.Bd -literal -offset indent -.Lk http://www.apple.com/DTDs/PropertyList-1.0.dtd -.Ed -.Pp -Property container objects are reference counted. -When an object is created, its reference count is set to 1. -Any code that keeps a reference to an object, including the collection -types -.Pq arrays and dictionaries , -must -.Dq retain -the object -.Pq increment its reference count . -When that reference is dropped, the object must be -.Dq released -.Pq reference count decremented . -When an object's reference count drops to 0, it is automatically freed. -.Pp -The rules for managing reference counts are very simple: -.Bl -bullet -.It -If you create an object and do not explicitly maintain a reference to it, -you must release it. -.It -If you get a reference to an object from other code and wish to maintain -a reference to it, you must retain the object. -You are responsible for -releasing the object once you drop that reference. -.It -You must never release an object unless you create it or retain it. -.El -.Pp -Object collections may be iterated by creating a special iterator object. -Iterator objects are special; they may not be retained, and they are -released using an iterator-specific release function. -.Sh SEE ALSO -.Xr prop_array 3 , -.Xr prop_bool 3 , -.Xr prop_data 3 , -.Xr prop_dictionary 3 , -.Xr prop_dictionary_util 3 , -.Xr prop_number 3 , -.Xr prop_object 3 , -.Xr prop_send_ioctl 3 , -.Xr prop_send_syscall 3 , -.Xr prop_string 3 -.Sh HISTORY -The -.Nm -property container object library first appeared in -.Nx 4.0 . -.Sh CAVEATS -.Nm -does not have a -.Sq date -object type, and thus will not parse -.Sq date -elements from an Apple XML property list. -.Pp -The -.Nm -.Sq number -object type differs from the Apple XML property list format in the following -ways: -.Bl -bullet -.It -The external representation is in base 16, not base 10. -.Nm -is able to parse base 8, base 10, and base 16 -.Sq integer -elements. -.It -Internally, integers are always stored as unsigned numbers -.Pq uint64_t . -Therefore, the external representation will never be negative. -.It -Because floating point numbers are not supported, -.Sq real -elements from an Apple XML property list will not be parsed. -.El -.Pp -In order to facilitate use of -.Nm -in kernel, standalone, and user space environments, the -.Nm -parser is not a real XML parser. -It is hard-coded to parse only the property list external representation. diff --git a/common/lib/libutil/Makefile.inc b/common/lib/libutil/Makefile.inc deleted file mode 100644 index 2173f7a90..000000000 --- a/common/lib/libutil/Makefile.inc +++ /dev/null @@ -1,8 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.4 2011/11/13 21:56:53 christos Exp $ -.PATH.c: ${.PARSEDIR} -.if defined(__MINIX) -SRCS+= snprintb.c proc_compare.c -.else -SRCS+= snprintb.c proc_compare.c getfstypename.c -.endif # defined(__MINIX) -COPTS.snprintb.c = -Wno-format-nonliteral diff --git a/common/lib/libutil/getfstypename.c b/common/lib/libutil/getfstypename.c deleted file mode 100644 index 4d6ecfc5d..000000000 --- a/common/lib/libutil/getfstypename.c +++ /dev/null @@ -1,131 +0,0 @@ -/* $NetBSD: getfstypename.c,v 1.8 2012/04/07 16:28:59 christos Exp $ */ - -/*- - * Copyright (c) 2011 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Christos Zoulas. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the NetBSD - * Foundation, Inc. and its contributors. - * 4. Neither the name of The NetBSD Foundation nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -#ifndef _STANDALONE -# include -# ifndef _KERNEL -# if !defined(lint) -__RCSID("$NetBSD: getfstypename.c,v 1.8 2012/04/07 16:28:59 christos Exp $"); -# endif -# else -__KERNEL_RCSID(0, "$NetBSD: getfstypename.c,v 1.8 2012/04/07 16:28:59 christos Exp $"); -# endif /* _KERNEL */ - -# define FSTYPE_ENUMNAME fstype_enum -# include -# include -# include -# ifndef _KERNEL -# include -# endif - -const char * -getfstypename(int fstype) -{ - /* - * The cast is so that the compiler can check that we - * cover all the enum values - */ - switch ((enum fstype_enum)fstype) { - case FS_UNUSED: - return DKW_PTYPE_UNUSED; - case FS_SWAP: - return DKW_PTYPE_SWAP; - case FS_V6: - return DKW_PTYPE_V6; - case FS_V7: - return DKW_PTYPE_V7; - case FS_SYSV: - return DKW_PTYPE_SYSV; - case FS_V71K: - return DKW_PTYPE_V71K; - case FS_V8: - return DKW_PTYPE_V8; - case FS_BSDFFS: - return DKW_PTYPE_FFS; - case FS_MSDOS: - return DKW_PTYPE_FAT; - case FS_BSDLFS: - return DKW_PTYPE_LFS; - case FS_OTHER: - return DKW_PTYPE_OTHER; - case FS_HPFS: - return DKW_PTYPE_HPFS; - case FS_ISO9660: - return DKW_PTYPE_ISO9660; - case FS_BOOT: - return DKW_PTYPE_BOOT; - case FS_ADOS: - return DKW_PTYPE_AMIGADOS; - case FS_HFS: - return DKW_PTYPE_APPLEHFS; - case FS_FILECORE: - return DKW_PTYPE_FILECORE; - case FS_EX2FS: - return DKW_PTYPE_EXT2FS; - case FS_NTFS: - return DKW_PTYPE_NTFS; - case FS_RAID: - return DKW_PTYPE_RAIDFRAME; - case FS_CCD: - return DKW_PTYPE_CCD; - case FS_JFS2: - return DKW_PTYPE_JFS2; - case FS_APPLEUFS: - return DKW_PTYPE_APPLEUFS; - case FS_VINUM: - return DKW_PTYPE_VINUM; - case FS_UDF: - return DKW_PTYPE_UDF; - case FS_SYSVBFS: - return DKW_PTYPE_SYSVBFS; - case FS_EFS: - return DKW_PTYPE_EFS; - case FS_NILFS: - return DKW_PTYPE_NILFS; - case FS_CGD: - return DKW_PTYPE_CGD; - case FSMAXTYPES: - return DKW_PTYPE_UNKNOWN; - case FS_MINIXFS3: - return DKW_PTYPE_MINIXFS3; - } - /* Stupid gcc, should know it is impossible to get here */ - /*NOTREACHED*/ - return DKW_PTYPE_UNKNOWN; -} -#endif /* !_STANDALONE */ diff --git a/common/lib/libutil/proc_compare.c b/common/lib/libutil/proc_compare.c deleted file mode 100644 index 1ea981d31..000000000 --- a/common/lib/libutil/proc_compare.c +++ /dev/null @@ -1,146 +0,0 @@ -/* $NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $ */ - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ -#ifndef _STANDALONE -# ifndef _KERNEL - -# if HAVE_NBTOOL_CONFIG_H -# include "nbtool_config.h" -# endif - -# include -# if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $"); -# endif - -# include -# include -# include -# include -# include -# include -# define PROC struct kinfo_proc2 -# define LWP struct kinfo_lwp -# define P_RTIME_SEC p_rtime_sec -# define P_RTIME_USEC p_rtime_usec -# else -# include -__KERNEL_RCSID(0, "$NetBSD: proc_compare.c,v 1.1 2011/10/21 02:09:00 christos Exp $"); -# include -# include -# include -# include -# include -# include -# define PROC struct proc -# define LWP struct lwp -# define P_RTIME_SEC p_rtime.sec -# define P_RTIME_USEC p_rtime.frac -# endif -/* - * Returns 1 if p2 is "better" than p1 - * - * The algorithm for picking the "interesting" process is thus: - * - * 1) Only foreground processes are eligible - implied. - * 2) Runnable processes are favored over anything else. The runner - * with the highest CPU utilization is picked (l_pctcpu). Ties are - * broken by picking the highest pid. - * 3) The sleeper with the shortest sleep time is next. With ties, - * we pick out just "short-term" sleepers (P_SINTR == 0). - * 4) Further ties are broken by picking the one started last. - * 5) Finally the one with the biggest pid wins, but that is nonsense - * because of pid randomization. - */ -#define ISRUN(p) ((p)->p_nrlwps > 0) -#define TESTAB(a, b) (((a) << 1) | (b)) -#define ONLYA 2 -#define ONLYB 1 -#define BOTH 3 - -int -proc_compare(const PROC *p1, const LWP *l1, const PROC *p2, const LWP *l2) -{ - /* - * see if at least one of them is runnable - */ - switch (TESTAB(ISRUN(p1), ISRUN(p2))) { - case ONLYA: - return 0; - case ONLYB: - return 1; - case BOTH: - /* - * tie - favor one with highest recent CPU utilization - */ - if (l2->l_pctcpu > l1->l_pctcpu) - return 1; - goto out; - } - /* - * weed out zombies - */ - switch (TESTAB(P_ZOMBIE(p1), P_ZOMBIE(p2))) { - case ONLYA: - return 1; - case ONLYB: - return 0; - case BOTH: - goto out; - } - /* - * pick the one with the smallest sleep time - */ - if (l1->l_slptime < l2->l_slptime) - return 0; - if (l2->l_slptime < l1->l_slptime) - return 1; - - /* - * favor one sleeping in a non-interruptible sleep - */ - if ((l1->l_flag & LW_SINTR) && (l2->l_flag & LW_SINTR) == 0) - return 0; - if ((l2->l_flag & LW_SINTR) && (l1->l_flag & LW_SINTR) == 0) - return 1; -out: - /* tie, return the one with the smallest realtime */ - if (p1->P_RTIME_SEC < p2->P_RTIME_SEC) - return 0; - if (p2->P_RTIME_SEC < p1->P_RTIME_SEC) - return 1; - if (p1->P_RTIME_USEC < p2->P_RTIME_USEC) - return 0; - if (p2->P_RTIME_USEC < p1->P_RTIME_USEC) - return 1; - - return p2->p_pid > p1->p_pid; /* Nonsense */ -} -#endif /* STANDALONE */ diff --git a/common/lib/libutil/snprintb.c b/common/lib/libutil/snprintb.c deleted file mode 100644 index c31151860..000000000 --- a/common/lib/libutil/snprintb.c +++ /dev/null @@ -1,282 +0,0 @@ -/* $NetBSD: snprintb.c,v 1.16 2014/08/02 11:19:01 ryo Exp $ */ - -/*- - * Copyright (c) 2002 The NetBSD Foundation, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * snprintb: print an interpreted bitmask to a buffer - * - * => returns the length of the buffer that would be required to print the - * string minus the terminating NUL. - */ -#ifndef _STANDALONE -# ifndef _KERNEL - -# if HAVE_NBTOOL_CONFIG_H -# include "nbtool_config.h" -# endif - -# include -# if defined(LIBC_SCCS) && !defined(lint) -__RCSID("$NetBSD: snprintb.c,v 1.16 2014/08/02 11:19:01 ryo Exp $"); -# endif - -# include -# include -# include -# include -# include -# else /* ! _KERNEL */ -# include -__KERNEL_RCSID(0, "$NetBSD: snprintb.c,v 1.16 2014/08/02 11:19:01 ryo Exp $"); -# include -# include -# include -# include -# endif /* ! _KERNEL */ - -# ifndef HAVE_SNPRINTB_M -int -snprintb_m(char *buf, size_t buflen, const char *bitfmt, uint64_t val, - size_t l_max) -{ - char *bp = buf, *s_bp = NULL; - const char *c_fmt, *s_fmt = NULL, *cur_fmt; - const char *sbase; - int bit, ch, t_len, s_len = 0, l_len, f_len, v_len, sep; - int restart = 0; - uint64_t field; - -#ifdef _KERNEL - /* - * For safety; no other *s*printf() do this, but in the kernel - * we don't usually check the return value - */ - (void)memset(buf, 0, buflen); -#endif /* _KERNEL */ - - ch = *bitfmt++; - switch (ch != '\177' ? ch : *bitfmt++) { - case 8: - sbase = "0%" PRIo64; - break; - case 10: - sbase = "%" PRId64; - break; - case 16: - sbase = "0x%" PRIx64; - break; - default: - goto internal; - } - - /* Reserve space for trailing blank line if needed */ - if (l_max > 0) - buflen--; - - t_len = snprintf(bp, buflen, sbase, val); - if (t_len < 0) - goto internal; - - v_len = l_len = t_len; - - if ((size_t)t_len < buflen) - bp += t_len; - else - bp += buflen - 1; - - /* - * If the value we printed was 0 and we're using the old-style format, - * we're done. - */ - if ((val == 0) && (ch != '\177')) - goto terminate; - -#define STORE(c) do { l_len++; \ - if ((size_t)(++t_len) < buflen) \ - *bp++ = (c); \ - } while ( /* CONSTCOND */ 0) - -#define BACKUP do { if (s_bp != NULL) { \ - bp = s_bp; s_bp = NULL; \ - t_len -= l_len - s_len; \ - restart = 1; \ - bitfmt = s_fmt; \ - } \ - STORE('>'); STORE('\0'); \ - if ((size_t)t_len < buflen) \ - snprintf(bp, buflen - t_len, sbase, val); \ - t_len += v_len; l_len = v_len; bp += v_len; \ - } while ( /* CONSTCOND */ 0) - -#define PUTSEP do { \ - if (l_max > 0 && (size_t)l_len >= l_max) { \ - BACKUP; \ - STORE('<'); \ - } else { \ - /* Remember separator location */ \ - if (l_max > 0 && sep != '<') { \ - s_len = l_len; \ - s_bp = bp; \ - s_fmt = cur_fmt; \ - } \ - STORE(sep); \ - restart = 0; \ - } \ - } while ( /* CONSTCOND */ 0) - -#define PUTCHR(c) do { \ - if (l_max > 0 && (size_t)l_len >= (l_max - 1)) {\ - BACKUP; \ - if (restart == 0) \ - STORE(c); \ - else \ - sep = '<'; \ - } else { \ - STORE(c); \ - restart = 0; \ - } \ - } while ( /* CONSTCOND */ 0) - -#define PUTS(s) while ((ch = *(s)++) != 0) { \ - PUTCHR(ch); \ - if (restart) \ - break; \ - } - - /* - * Chris Torek's new bitmask format is identified by a leading \177 - */ - sep = '<'; - if (ch != '\177') { - /* old (standard) format. */ - for (;(bit = *bitfmt) != 0;) { - cur_fmt = bitfmt++; - if (val & (1 << (bit - 1))) { - PUTSEP; - if (restart) - continue; - sep = ','; - for (; (ch = *bitfmt) > ' '; ++bitfmt) { - PUTCHR(ch); - if (restart) - break; - } - } else - for (; *bitfmt > ' '; ++bitfmt) - continue; - } - } else { - /* new quad-capable format; also does fields. */ - field = val; - while (c_fmt = bitfmt, (ch = *bitfmt++) != '\0') { - bit = *bitfmt++; /* now 0-origin */ - switch (ch) { - case 'b': - if (((unsigned int)(val >> bit) & 1) == 0) - goto skip; - cur_fmt = c_fmt; - PUTSEP; - if (restart) - break; - PUTS(bitfmt); - if (restart == 0) - sep = ','; - break; - case 'f': - case 'F': - cur_fmt = c_fmt; - f_len = *bitfmt++; /* field length */ - field = (val >> bit) & - (((uint64_t)1 << f_len) - 1); - PUTSEP; - if (restart == 0) - sep = ','; - if (ch == 'F') /* just extract */ - break; - if (restart == 0) - PUTS(bitfmt); - if (restart == 0) - PUTCHR('='); - if (restart == 0) { - f_len = snprintf(bp, buflen - t_len, - sbase, field); - if (f_len < 0) - goto internal; - t_len += f_len; - l_len += f_len; - if ((size_t)t_len < buflen) - bp += f_len; - if (l_max > 0 && (size_t)l_len > l_max) - PUTCHR('#'); - } - break; - case '=': - case ':': - /* - * Here "bit" is actually a value instead, - * to be compared against the last field. - * This only works for values in [0..255], - * of course. - */ - if ((int)field != bit) - goto skip; - if (ch == '=') - PUTCHR('='); - PUTS(bitfmt); - break; - default: - skip: - while (*bitfmt++ != '\0') - continue; - break; - } - } - } - l_len++; - if (sep != '<' && (size_t)(++t_len) < buflen) - *bp++ = '>'; -terminate: - *bp++ = '\0'; - if (l_max != 0) { - t_len++; - *bp = '\0'; - } - return t_len; -internal: -#ifndef _KERNEL - errno = EINVAL; -#endif - return -1; -} - -int -snprintb(char *buf, size_t buflen, const char *bitfmt, uint64_t val) -{ - return snprintb_m(buf, buflen, bitfmt, val, 0); -} -# endif /* ! HAVE_SNPRINTB_M */ -#endif /* ! _STANDALONE */ diff --git a/etc/Makefile b/etc/Makefile deleted file mode 100644 index 241be2e8d..000000000 --- a/etc/Makefile +++ /dev/null @@ -1,811 +0,0 @@ -# from: @(#)Makefile 8.7 (Berkeley) 5/25/95 - -# Environment variables without default values: -# DESTDIR must be set before anything in this file will work. -# RELEASEDIR is where the tarred up stuff for a snapshot or -# release will be placed. -# -# Environment variables with default values: -# LOCALTIME will set the default local time for the system you -# build; it determines what /etc/localtime is symlink'd to. -# KERNSRCDIR points to kernel source; it is set by default to ../sys, -# but can be overridden. -# KERNOBJDIR is the kernel build directory, it defaults to -# ${KERNSRCDIR}/arch/${MACHINE}/compile, but can be overridden. -# KERNCONFDIR is where the configuration files for kernels are found; -# default is ${KERNSRCDIR}/arch/${MACHINE}/conf but can be overridden. -# MKCRYPTO; if not `no', install crypto-related configuration -# MKPOSTFIX; if not `no', install postfix configuration -# MKUNPRIVED; if not `no', allow non-root installs. -# MKUPDATE; if not `no', don't do a 'make clean' before kernel compile -# -# Targets: -# INSTALL_DONE is set, it will not do a `make install.' -# if DISTRIBUTION_DONE is set, it will not do anything. -# Called by distribution. -# snapshot: calls distribution, above, and then tars up the files -# into a release(7) format in RELEASEDIR/${RELEASEMACHINEDIR}. -# Any port-dependent stuff for this target is found in -# etc.${MACHINE}/Makefile.inc. -# release: a synonym for `snapshot' -# - -# For MK* vars -.include - -.include # for HOST_SH, TOOL_AWK, ... -.include # For KERNSRCDIR, KERNOBJDIR, ... -.include # For TARGET_ENDIANNESS - -.MAKEOVERRIDES+= USETOOLS - -TZDIR= /usr/share/zoneinfo -LOCALTIME?= UTC -CKSUM?= ${TOOL_CKSUM} -MAKESUMS= MAKE=${MAKE:Q} CKSUM=${CKSUM:Q} ${HOST_SH} ${NETBSDSRCDIR}/distrib/sets/makesums -DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh - -GZIP_FLAGS= -9 ${GZIP_N_FLAG} - -# Flags for creating ISO CDROM image -# mkisofs is expected to be in $PATH, install via pkgsrc/sysutils/cdrtools -# Note: At least mkisofs 2.0 should be used. -# -.if !defined(__MINIX) -# LSC: We do not yet support iso creation anyway, then do not try to find it. -.if !defined(MKISOFS) -MKISOFS!= (which mkisofs || echo true) 2>/dev/null -.endif -DISTRIBREV!= ${HOST_SH} ${KERNSRCDIR}/conf/osrelease.sh -s -# ISO 9660 volume ID. Note that this can only contain [A-Z0-9_]. -ISO_VOLID!= echo NETBSD_${DISTRIBREV} | tr a-z A-Z -MKISOFS_FLAGS+= -J -l -hide-joliet-trans-tbl -r -T \ - -V ${ISO_VOLID} \ - -m "${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/cdrom" -.if ${MKISOFS_FLAGS:N-v} -MKISOFS_FLAGS+= -quiet -.endif -.endif # !defined(__MINIX) - - -# MD Makefile.inc may append MD targets to BIN[123]. Make sure all -# are empty, to preserve the old semantics of setting them below with "+=". -# -BIN1= -BIN2= -BIN3= - -# Directories to build in ${RELEASEDIR}/${RELEASEMACHINEDIR}. -# MD Makefile.inc files can add to this. -# NOTE: Parent directories must be listed before subdirectories. -# -INSTALLATION_DIRS= binary binary/sets binary/kernel installation - -.if exists(etc.${RELEASEMACHINE}/Makefile.inc) -.include "etc.${RELEASEMACHINE}/Makefile.inc" -.endif - -# -rw-r--r-- -BINOWN= root -BINGRP= wheel -UTMPGRP= utmp -.if defined(__MINIX) -BIN1+= \ - \ - gettytab \ - man.conf \ - \ - passwd.conf \ - protocols rc rc.cd rc.subr \ - rc.shutdown services shells \ - syslog.conf -# MINIX-only files: -BIN1+= boot.cfg.default rc.minix \ - rs.lwip rs.single termcap utmp -.else -BIN1+= bootptab changelist csh.cshrc csh.login \ - csh.logout daily daily.conf dm.conf envsys.conf floppytab ftpchroot \ - ftpusers gettytab gpio.conf group hosts hosts.lpd inetd.conf \ - locate.conf login.conf mailer.conf man.conf monthly monthly.conf \ - mrouted.conf named.conf netconfig networks newsyslog.conf \ - nsswitch.conf ntp.conf passwd.conf pkgpath.conf phones printcap \ - profile protocols rbootd.conf rc rc.conf rc.local rc.subr \ - rc.shutdown remote rpc security security.conf services shells \ - shrc sysctl.conf syslog.conf weekly weekly.conf wscons.conf - -# Use machine-specific disktab if it exists, or the MI one otherwise -.if exists(etc.${MACHINE}/disktab) -BIN1+= etc.${MACHINE}/disktab -.else -BIN1+= disktab -.endif - -.if exists(etc.${MACHINE}/ld.so.conf) && empty(MACHINE_ARCH:M*arm*hf*) -BIN1+= etc.${MACHINE}/ld.so.conf -.endif - -.if exists(etc.${MACHINE}/ttyaction) -BIN1+= etc.${MACHINE}/ttyaction -.endif - -# -rw-rw-r-- -BIN2+= motd -FILESBUILD_motd= YES - -# -rw------- -BIN3+= hosts.equiv -.endif # defined(__MINIX) - -SYSPKG= etc -ETC_PKG=-T etc_pkg -BASE_PKG=-T base_pkg -ETC_INSTALL_FILE=cd ${.CURDIR} && ${INSTALL_FILE} ${ETC_PKG} -ETC_INSTALL_OBJ_FILE=cd ${.OBJDIR} && ${INSTALL_FILE} ${ETC_PKG} - -.if ${TARGET_ENDIANNESS} == "1234" -PWD_MKDB_ENDIAN= -L -.elif ${TARGET_ENDIANNESS} == "4321" -PWD_MKDB_ENDIAN= -B -.else -PWD_MKDB_ENDIAN= -.endif - - -# distribution -- -# Build a distribution -# -distribution: .PHONY .MAKE check_DESTDIR distrib-dirs -.if !defined(DISTRIBUTION_DONE) -.if !defined(INSTALL_DONE) - ${MAKEDIRTARGET} ${NETBSDSRCDIR} include _DISTRIB= - ${MAKEDIRTARGET} ${NETBSDSRCDIR} install _DISTRIB= -.endif # !INSTALL_DONE - ${MAKEDIRTARGET} . install-etc-files -. if ${MKX11} != "no" - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/mit/xorg distribution -. endif -. if ${MKEXTSRC} != "no" - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/extsrc distribution -. endif - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets makesetfiles -.endif # !DISTRIBUTION_DONE - - -.if !defined(__MINIX) -# motd is copied from a different ${MOTD_SOURCE} depending on DISTRIBVER -# -.if !empty(DISTRIBVER:M*.99.*) -MOTD_SOURCE= motd.current -.elif !empty(DISTRIBVER:M*BETA*) -MOTD_SOURCE= motd.beta -.elif !empty(DISTRIBVER:M*RC*) -MOTD_SOURCE= motd.rc -.elif !empty(DISTRIBVER:M*STABLE*) -MOTD_SOURCE= motd.stable -.else -MOTD_SOURCE= motd.default -.endif -CLEANFILES+= motd -motd: ${.CURDIR}/${MOTD_SOURCE} ${_NETBSD_VERSION_DEPENDS} - ${_MKTARGET_CREATE} - ${HOST_INSTALL_FILE} ${.CURDIR}/${MOTD_SOURCE} ${.TARGET} -.endif # !defined(__MINIX) - -CLEANFILES+= MAKEDEV -.if !defined(__MINIX) -MAKEDEV_MACHINE=${"${MACHINE_CPU}" == "aarch64":?${MACHINE_CPU}:${MACHINE}} -MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ - ${.CURDIR}/etc.${MAKEDEV_MACHINE}/MAKEDEV.conf - ${_MKTARGET_CREATE} - MACHINE=${MAKEDEV_MACHINE:Q} MACHINE_ARCH=${MACHINE_ARCH:Q} \ - NETBSDSRCDIR=${NETBSDSRCDIR:Q} \ - ${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \ - > ${.TARGET} -.else -MAKEDEV: .PHONY - if [ ${MKUNPRIVED} != "yes" ]; then \ - cd ${DESTDIR}/dev && sh ${NETBSDSRCDIR}/minix/commands/MAKEDEV/MAKEDEV.sh -s; \ - else \ - sh ${NETBSDSRCDIR}/minix/commands/MAKEDEV/MAKEDEV.sh -m -s >> ${DESTDIR}/METALOG; \ - fi -.endif # !defined(__MINIX) - -.include "${NETBSDSRCDIR}/etc/Makefile.params" -CLEANFILES+= etc-release -etc-release: .EXEC .MAKE - ${_MKTARGET_CREATE} - echo ; \ - cat ${NETBSDSRCDIR}/sys/conf/copyright; \ - echo ; \ - echo "Build information:"; \ - printf "%20s %s\n" "Build date" "$$(date -u)"; \ - printf "%20s %s\n" "Built by" "$${USER-root}@$$(hostname)"; \ - if [ -n "${BUILDID}" ]; then \ - printf "%20s %s\n" "Build ID" "${BUILDID}" ; \ - fi ; \ - if [ -n "${BUILDINFO}" ]; then \ - echo ; \ - info="$$(printf "%b" ${BUILDINFO:Q})" ; \ - printf "%s\n" "$${info}" \ - | ${TOOL_SED} -e 's/^/ /' ; \ - fi ; \ - echo ; \ - echo "Build settings:"; \ - echo ; \ - ${PRINT_PARAMS} ; \ - ) >${.OBJDIR}/${.TARGET} - -install-etc-release: .PHONY etc-release - ${_MKMSG_INSTALL} etc/release - ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 444 \ - etc-release ${DESTDIR}/etc/release - - -FILESDIR= /etc -CONFIGFILES= -CONFIGSYMLINKS= - -.for file in ${BIN1} -CONFIGFILES+= ${file} -FILESMODE_${file:T}= 644 -.endfor - -.for file in ${BIN2} -CONFIGFILES+= ${file} -FILESMODE_${file:T}= 664 -.endfor - -.for file in ${BIN3} -CONFIGFILES+= ${file} -FILESMODE_${file:T}= 600 -.endfor - -.if (${MKPOSTFIX} != "no") -CONFIGFILES+= aliases -FILESDIR_aliases= /etc/mail -FILESMODE_aliases= 644 -.endif - -.if !defined(__MINIX) -CONFIGFILES+= MAKEDEV.local -FILESDIR_MAKEDEV.local= /dev -FILESMODE_MAKEDEV.local=${BINMODE} - -CONFIGFILES+= crontab -FILESDIR_crontab= /var/cron/tabs -FILESNAME_crontab= root -FILESMODE_crontab= 600 - -CONFIGFILES+= minfree -FILESDIR_minfree= /var/crash -FILESMODE_minfree= 600 - -CONFIGSYMLINKS+= ${TZDIR}/${LOCALTIME} /etc/localtime \ - /usr/sbin/rmt /etc/rmt -.else -CONFIGSYMLINKS+= \ - /usr/log /var/log \ - /usr/tmp /var/tmp \ - /proc/mounts /etc/mtab \ - /usr/service/asr /service/asr - -.endif # !defined(__MINIX) - - -# install-etc-files -- -# Install etc (config) files; not performed by "make build" -# -install-etc-files: .PHONY .MAKE check_DESTDIR MAKEDEV - ${_MKMSG_INSTALL} ${DESTDIR}/etc/master.passwd - ${ETC_INSTALL_FILE} -o root -g wheel -m 600 \ - master.passwd ${DESTDIR}/etc - ${TOOL_PWD_MKDB} -p ${PWD_MKDB_ENDIAN} -d ${DESTDIR}/ \ - ${DESTDIR}/etc/master.passwd -.if ${MKUNPRIVED} != "no" - ( \ - mode=0600; \ - for metaent in spwd.db passwd pwd.db; do \ - echo "./etc/$${metaent} type=file mode=$${mode} uname=root gname=wheel tags=etc_pkg"; \ - mode=0644; \ - done; \ - ) | ${METALOG.add} -.endif # MKUNPRIVED != no -.if defined(__MINIX) -# BJG: Unsafe (i.e. user-editable) files for Minix -.for owner group mode sdir tdir files in \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ group \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ hostname.file \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ hosts \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ inetd.conf \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ mk.conf \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ motd \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ named.conf \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ nsswitch.conf \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ rc.conf \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ shrc \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.cshrc \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.login \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ csh.logout \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ profile - ${_MKMSG_INSTALL} ${DESTDIR}${tdir}${files:T} - if [ ! -e ${tdir} ]; then \ - ${INSTALL_DIR} ${tdir}; \ - fi; \ - ${INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} ${sdir}${files} ${tdir}; -.endfor -.if ${MKX11} == "yes" - ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} -m 755 ${DESTDIR}/etc/X11 - ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 ${NETBSDSRCDIR}/etc/xorg.conf \ - ${DESTDIR}/etc/X11/xorg.conf -.endif # ${MKX11} == "yes" -# LSC: We need a safe install target for etc files, as this is expected from -# our current user base. This safe version only leaves out the master.passwd -# file in order not to loose any user account created. -# -# BJG: For Minix, the -safe target *is* performed by "make build" -# -# LSC: To ensure minimal modifications, the logic is a bit contrived, i.e. the -# is to separate that step into two steps, with the unsafe version refering -# (not by dependency, to ensure correct order of actions) the safe step, and -# use the following mapping in the main Makefile: -# etcfiles -> install-etc-files-safe (new -safe- target) - ${MAKEDIRTARGET} . install-etc-files-safe - -install-etc-files-safe: .PHONY .MAKE check_DESTDIR MAKEDEV -.endif # defined(__MINIX) - ${_MKMSG_INSTALL} ${DESTDIR}/etc/ttys -.if !defined(__MINIX) -.if exists(${.CURDIR}/etc.${MACHINE}/ttys) - ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ - ${.CURDIR}/etc.${MACHINE}/ttys ${DESTDIR}/etc -.else - ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ - ${.CURDIR}/etc.${MACHINE_CPU}/ttys ${DESTDIR}/etc -.endif -.else - ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ - ${.CURDIR}/ttys ${DESTDIR}/etc -.endif # !defined(__MINIX) -.if exists(etc.${MACHINE}/boot.cfg) - ${_MKMSG_INSTALL} ${DESTDIR}/boot.cfg - ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ - ${.CURDIR}/etc.${MACHINE}/boot.cfg ${DESTDIR}/ -.endif -.if !defined(__MINIX) - ${_MKMSG_INSTALL} ${DESTDIR}/dev/MAKEDEV - ${ETC_INSTALL_OBJ_FILE} -o ${BINOWN} -g ${BINGRP} -m 555 \ - MAKEDEV ${DESTDIR}/dev -.else -# As /var/log is a symlink to /usr/log, we need to use /usr/log for files -# in /var/log here. The same applies to the distrib list entries. -.for owner group mode file in \ - ${BINOWN} ${BINGRP} 644 /usr/log/messages \ - ${BINOWN} ${BINGRP} 644 /usr/log/syslog \ - games games 664 /var/games/tetris.scores - ${_MKMSG_INSTALL} ${DESTDIR}${file} - if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ - ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ - /dev/null ${DESTDIR}${file}; \ - else true; fi -.endfor -.endif # !defined(__MINIX) -# TAC as software is imported, copy the files from the .for block below -# TAC to the .for block above. -.if !defined(__MINIX) -.for owner group mode file in \ - ${BINOWN} operator 664 /etc/dumpdates \ - ${BINOWN} operator 600 /etc/skeykeys \ - root wheel 600 /var/at/at.deny \ - root wheel 644 /var/db/locate.database \ - ${BINOWN} ${BINGRP} 600 /var/log/authlog \ - root wheel 600 /var/log/cron \ - ${BINOWN} ${UTMPGRP} 664 /var/log/lastlog \ - ${BINOWN} ${UTMPGRP} 664 /var/log/lastlogx \ - ${BINOWN} ${BINGRP} 640 /var/log/lpd-errs \ - ${BINOWN} ${BINGRP} 600 /var/log/maillog \ - ${BINOWN} ${BINGRP} 644 /var/log/messages \ - ${BINOWN} ${BINGRP} 600 /var/log/secure \ - ${BINOWN} ${UTMPGRP} 664 /var/log/wtmp \ - ${BINOWN} ${UTMPGRP} 664 /var/log/wtmpx \ - ${BINOWN} ${BINGRP} 600 /var/log/xferlog \ - daemon staff 664 /var/msgs/bounds \ - ${BINOWN} ${UTMPGRP} 664 /var/run/utmp \ - ${BINOWN} ${UTMPGRP} 664 /var/run/utmpx \ - games games 664 /var/games/atc_score \ - games games 664 /var/games/battlestar.log \ - games games 664 /var/games/cfscores \ - games games 664 /var/games/criblog \ - games games 660 /var/games/hackdir/perm \ - games games 660 /var/games/hackdir/record \ - games games 664 /var/games/larn/llog12.0 \ - games games 664 /var/games/larn/lscore12.0 \ - games games 664 /var/games/larn/playerids \ - games games 664 /var/games/robots_roll \ - games games 664 /var/games/rogue.scores \ - games games 664 /var/games/saillog \ - games games 664 /var/games/snakerawscores \ - games games 664 /var/games/snake.log \ - games games 664 /var/games/tetris.scores - ${_MKMSG_INSTALL} ${DESTDIR}${file} - if [ ! -e ${DESTDIR}${file} -o -s ${DESTDIR}${file} ]; then \ - ${ETC_INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} \ - /dev/null ${DESTDIR}${file}; \ - else true; fi -.endfor -.for subdir in . defaults bluetooth iscsi mtree namedb pam.d powerd rc.d root skel ssh - ${MAKEDIRTARGET} ${subdir} configinstall -.endfor - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.bin/mail configinstall -.if (${MKPF} != "no") - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/usr.sbin/pf configinstall -.endif -.if (${MKCRYPTO} != "no") - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/crypto/external/bsd/openssh/bin configinstall -.endif -.if (${MKPOSTFIX} != "no") - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/ibm-public/postfix configinstall -.endif -.if (${MKATF} != "no") - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/atf/etc/atf configinstall -.endif -.if (${MKKYUA} != "no") - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/kyua-cli/etc/kyua configinstall -.endif -.else # LSC Minix Specific -.for owner group mode sdir tdir files in \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ daily \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/etc/ rc \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/usr/lib/ crontab \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/ ${DESTDIR}/etc/ system.conf \ - ${BINOWN} ${BINGRP} ${NONBINMODE} ${NETBSDSRCDIR}/etc/usr/ ${DESTDIR}/usr/ Makefile \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/ ${DESTDIR}/etc/devmand/ usb_hub.cfg \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/ ${DESTDIR}/etc/devmand/ usb_storage.cfg \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ block \ - ${BINOWN} ${BINGRP} ${BINMODE} ${NETBSDSRCDIR}/etc/devmand/scripts/ ${DESTDIR}/etc/devmand/scripts/ singlechar \ - - ${_MKMSG_INSTALL} ${DESTDIR}${tdir}${files:T} - if [ ! -e ${tdir} ]; then \ - ${INSTALL_DIR} ${tdir}; \ - fi; \ - ${INSTALL_FILE} -o ${owner} -g ${group} -m ${mode} ${sdir}${files} ${tdir}; -.endfor -.if ${MACHINE_ARCH} == "earm" - ${_MKMSG_INSTALL} ${DESTDIR}/etc/rc.capes - ${INSTALL_DIR} ${DESTDIR}/etc/rc.capes - ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/rc.capes/* ${DESTDIR}/etc/rc.capes - ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/minix/drivers/usb/usbd/usbd.conf ${DESTDIR}/etc/system.conf.d/usbd -.endif # Minix/earm specific -.for subdir in . defaults mtree namedb rc.d root skel - ${MAKEDIRTARGET} ${subdir} configinstall -.endfor - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/external/bsd/dhcpcd/sbin/dhcpcd configinstall - ${_MKMSG_INSTALL} ${DESTDIR}/usr/lib/fonts - ${INSTALL_DIR} ${DESTDIR}/usr/lib/fonts - ${INSTALL_FILE} -m ${BINMODE} -o ${BINOWN} -g ${BINGRP} ${NETBSDSRCDIR}/etc/fonts/*.fnt ${DESTDIR}/usr/lib/fonts/ -.endif # LSC Minix Specific - - -# install-obsolete-lists -- -# Install var/db/obsolete set lists; this is performed by "make build" -# -OBSOLETE.dir= ${.OBJDIR}/obsolete.dir -.if !defined(__MINIX) -OBSOLETE.files= base comp etc games man misc text -.else -OBSOLETE.files= minix-base minix-comp minix-games minix-kernel minix-man -.endif # !defined(__MINIX) -.if ${MKDEBUG} != "no" -OBSOLETE.files+= minix-debug -.endif -.if ${MKKMOD} != "no" -OBSOLETE.files+= modules -.endif -.if ${MKATF} != "no" -OBSOLETE.files+= minix-tests tests -.endif -.if ${MKX11} != "no" -OBSOLETE.files+= xbase xcomp xetc xfont xserver -.endif - -# XXX make "makeobsolete" set wise; then generate files respectively -install-obsolete-lists: .PHONY .MAKE - mkdir -p ${OBSOLETE.dir} -.if ${MKX11} != "no" - (cd ${NETBSDSRCDIR}/distrib/sets && \ - AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -b -t ${OBSOLETE.dir}) -.else - (cd ${NETBSDSRCDIR}/distrib/sets && \ - AWK=${TOOL_AWK:Q} MAKE=${MAKE:Q} ${HOST_SH} ./makeobsolete -t ${OBSOLETE.dir}) -.endif -.for file in ${OBSOLETE.files} - ${_MKMSG_INSTALL} ${DESTDIR}/var/db/obsolete/${file} - if [ ! -e ${DESTDIR}/var/db/obsolete/${file} ] || \ - ! cmp -s ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete/${file}; then \ - ${ETC_INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m 644 \ - ${OBSOLETE.dir}/${file} ${DESTDIR}/var/db/obsolete; \ - else true; fi -.endfor - - -# distrib-dirs -- -# -distrib-dirs: .PHONY check_DESTDIR - cd ${NETBSDSRCDIR}/etc/mtree && ${MAKE} distrib-dirs - - -# release, snapshot -- -# Build a full distribution including kernels & install media. -# -release snapshot: .PHONY .MAKE check_DESTDIR check_RELEASEDIR snap_md_post - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib/sets sets - ${MAKESUMS} -A -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets \ - ${KERNEL_SETS:@.SETS.@kern-${.SETS.}.tgz@} - ${MAKESUMS} -t ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel '*.gz' - - -.if !defined(__MINIX) -# iso-image -- -# Standalone target to create a CDROM image after the release -# was composed. Should be run after "make release" in src and xsrc. -# The do-iso-image is to be called from etc.$MACHINE/Makefile.inc -# -# Note: At least mkisofs 2.0 should be used. -# -CDROM_NAME_ADD?= -CDROM.dir= ${.OBJDIR}/cdrom.dir -CDROM.pathlist= ${.OBJDIR}/cdrom.pathlist - -iso-image: - -.if ${MKISOFS} != true -do-iso-image: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-post - ${MAKESUMS} -t ${RELEASEDIR}/images/ '*.iso' - @echo "iso-image created as: ${CDROM_IMAGE}" -.else -do-iso-image: - @echo iso-image: mkisofs not found -.endif - -iso-image-setup: .PHONY check_RELEASEDIR - rm -f ${CDROM.pathlist} -.for extra in README SOURCE_DATE source -.if exists(${RELEASEDIR}/${extra}) - echo "${extra}=${RELEASEDIR}/${extra}" >> ${CDROM.pathlist} -.endif -.endfor - echo "${MACHINE}/=${RELEASEDIR}/${RELEASEMACHINEDIR}/" >> ${CDROM.pathlist} - mkdir -p ${CDROM.dir} - -check_imagedir: - mkdir -p ${RELEASEDIR}/images - -# iso-image-mi -- -# Create the image after the MD operations have completed. -# -iso-image-mi: .PHONY check_DESTDIR check_RELEASEDIR iso-image-md-pre check_imagedir - @if ! ${MKISOFS} --version; then \ - echo "install pkgsrc/sysutils/cdrtools and run 'make iso-image'." ; \ - false; \ - fi - ${MKISOFS} ${MKISOFS_FLAGS} -graft-points -path-list ${CDROM.pathlist} \ - -o ${CDROM_IMAGE} ${CDROM.dir} - -# iso-image-md-pre -- -# Setup ${CDROM.dir} to produce a bootable CD image. -# Overridden by etc.$MACHINE/Makefile.inc -# -iso-image-md-pre: .PHONY check_DESTDIR check_RELEASEDIR iso-image-setup -# (empty -- look in the machine-dependent Makefile.inc) - -# iso-image-md-post -- -# Fixup the CD-image to be bootable. -# Overridden by etc.$MACHINE/Makefile.inc -# -iso-image-md-post: .PHONY check_DESTDIR check_RELEASEDIR iso-image-mi -# (empty -- look in the machine-dependent Makefile.inc) - - -# live-image -- -# Standalone target to create live images after the release was composed. -# Should be run after "make release" in src and xsrc. -# LIVEIMG_RELEASEDIR specifies where to install live images and -# it can be set in MD etc.${MACHINE}/Makefile.inc. -# -LIVEIMG_RELEASEDIR?= ${RELEASEDIR}/images - -live-image: .PHONY check_DESTDIR check_RELEASEDIR - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib live_image \ - LIVEIMG_RELEASEDIR=${LIVEIMG_RELEASEDIR} - ${MAKESUMS} -t ${LIVEIMG_RELEASEDIR} '*.img.gz' - -# install-image -- -# Standalone target to create installation images -# after the release was composed. -# Should be run after "make release" in src and xsrc. -# INSTIMG_RELEASEDIR specifies where to install live images and -# it can be set in MD etc.${MACHINE}/Makefile.inc. -# -INSTIMG_RELEASEDIR?= ${RELEASEDIR}/images - -install-image: .PHONY check_DESTDIR check_RELEASEDIR - ${MAKEDIRTARGET} ${NETBSDSRCDIR}/distrib install_image \ - INSTIMG_RELEASEDIR=${INSTIMG_RELEASEDIR} - ${MAKESUMS} -t ${INSTIMG_RELEASEDIR} '*.img.gz' -.endif # !defined(__MINIX) - -# snap_pre -- -# Create ${RELEASEDIR} and necessary subdirectories. -# -snap_pre: .PHONY check_DESTDIR check_RELEASEDIR distribution - ${INSTALL} -d -m 755 ${RELEASEDIR} -.if ${MKUPDATE} == "no" -# Could be a mount point, ignore the errors - -/bin/rm -rf ${RELEASEDIR}/${RELEASEMACHINEDIR} -.endif - ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR} -.for dir in ${INSTALLATION_DIRS} - ${INSTALL} -d -m 755 ${RELEASEDIR}/${RELEASEMACHINEDIR}/${dir} -.endfor - -# snap_post -- -# Build the install media and notes from distrib -# -snap_post: .PHONY .MAKE build_kernelsets build_releasekernels -.if ${MKUPDATE} == "no" - cd ${NETBSDSRCDIR}/distrib && ${MAKE} cleandir -.endif - cd ${NETBSDSRCDIR}/distrib && ${MAKE} depend && ${MAKE} && \ - ${MAKE} release - -# build kernels -- -# This target builds the kernels specified by each port. -# A port may specify the following kernels: -# -# KERNEL_SETS The list of kernels that will be -# packaged into sets, named -# kern-${kernel}.tgz. These kernels -# are also placed in the binary/kernel -# area of the release package as -# netbsd-${kernel}.gz. -# -# EXTRA_KERNELS Additional kernels to place in the -# binary/kernel area of the release -# package as netbsd-${kernel}.gz, but -# which are not placed into sets. This -# allows a port to provide e.g. a netbootable -# installation kernel containing a ramdisk. -# -# BUILD_KERNELS Additional kernels to build which are -# not placed into sets nor into the -# binary/kernel area of the release -# package. These are typically kernels -# that are built for inclusion only in -# installation disk/CD-ROM/tape images. -# -# A port may also specify KERNEL_SUFFIXES, which is an optional list -# of filename suffixes for kernels to include in the kernel sets and -# in the binary/kernel area of the release package (e.g. "netbsd" vs. -# "netbsd.ecoff" and "netbsd.srec"). It is not an error if kernels -# with these suffixes do not exist in the kernel build directory. -# -# -# A list of all the kernels to build, which can be overridden from -# external sources (such as make(1)'s environment or command line) -# -ALL_KERNELS?= ${KERNEL_SETS} ${EXTRA_KERNELS} ${BUILD_KERNELS} -.export ALL_KERNELS - -GETKERNELAWK= ${TOOL_AWK} '/^config/ {print $$2; found=1} \ - END{ if (found == 0) print "netbsd"; }' - -build_kernels: .PHONY -# Configure & compile kernels listed in ${ALL_KERNELS} -# -# The 'sync' is so that all writes during the build are pushed back -# to the disk. Not having it causes problems on some host systems -# (e.g. Linux) when building on NFS. -# -.if !defined(KERNELS_DONE) # { -.for configfile in ${ALL_KERNELS:O:u} # { -build_kernels: kern-${configfile} -kern-${configfile}: .PHONY .MAKE - cd ${KERNCONFDIR} && ${TOOL_CONFIG} ${CONFIGOPTS} -s ${KERNSRCDIR} \ - -U DEBUG -b ${KERNOBJDIR}/${configfile:C/.*\///} ${configfile} -.if ${MKUPDATE} == "no" - cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} distclean -.endif - cd ${KERNOBJDIR}/${configfile:C/.*\///} && ${MAKE} depend && ${MAKE} - sync -.endfor # ALL_KERNELS # } -.endif # KERNELS_DONE # } - -build_kernelsets: .PHONY -# Create kernel sets from ${KERNEL_SETS} into -# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets -# -.for configfile in ${KERNEL_SETS:O:u} # { -.for configsel in ${ALL_KERNELS:O:u} -.if ${configfile} == ${configsel} -build_kernelsets: kernset-${configfile} -kernset-${configfile}: .PHONY build_kernels snap_pre - @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile}); \ - kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ - kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ - kern_tgz=${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/sets/kern-${configfile}.tgz; \ - pax_cmd="GZIP=${GZIP_FLAGS:Q} ${TOOL_PAX} --use-compress-program ${TOOL_GZIP:Q} -O -w -M -N ${NETBSDSRCDIR}/etc -f $${kern_tgz}"; \ - cd $${kerndir} && { \ - kernels=; newest=; \ - for kernel in $${kernlist}; do \ - for s in "" $${kernsuffixes}; do \ - ks="$${kernel}$${s}"; \ - [ -f $${ks} ] || continue; \ - kernels="$${kernels} $${ks}"; \ - [ -z "$${newest}" -o $${ks} -nt "$${newest}" ] && \ - newest=$${ks}; \ - done; \ - done; \ - [ $${kern_tgz} -nt "$${newest}" ] || { \ - echo "echo $${kernels} | $${pax_cmd}"; \ - ( echo "/set uname=${BINOWN} gname=${BINGRP}"; \ - echo ". type=dir optional"; \ - for kernel in $${kernels}; do \ - echo "./$${kernel} type=file"; \ - done ) | eval $${pax_cmd}; \ - } \ - } -.endif -.endfor -.endfor # KERNEL_SETS # } - -build_releasekernels: .PHONY -# Build kernel.gz from ${KERNEL_SETS} ${EXTRA_KERNELS} into -# ${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel -# -.for configfile in ${KERNEL_SETS:O:u} ${EXTRA_KERNELS:O:u} # { -.for configsel in ${ALL_KERNELS:O:u} -.if ${configfile} == ${configsel} -build_releasekernels: releasekern-${configfile} -releasekern-${configfile}: .PHONY build_kernels snap_pre - @ kernlist=$$(${GETKERNELAWK} ${KERNCONFDIR}/${configfile:C/.*\///}); \ - kerndir=${KERNOBJDIR}/${configfile:C/.*\///}; \ - kernsuffixes="${KERNEL_SUFFIXES:S/^/./}"; \ - cd $${kerndir} && { \ - for kernel in $${kernlist}; do \ - for s in "" $${kernsuffixes}; do \ - ks="$${kernel}$${s}"; \ - [ ! -f $${ks} ] && continue; \ - knl_gz="${RELEASEDIR}/${RELEASEMACHINEDIR}/binary/kernel/$${kernel}-${configfile:C/.*\///}$${s}.gz"; \ - [ $${knl_gz} -nt $${ks} ] && continue; \ - rm -f $${knl_gz}; \ - echo "${TOOL_GZIP} ${GZIP_FLAGS} -c < $${kerndir}/$${ks} > $${knl_gz}"; \ - ${TOOL_GZIP} ${GZIP_FLAGS} -c < $${ks} > $${knl_gz}; \ - done; \ - done; \ - } -.endif -.endfor -.endfor # KERNEL_SETS EXTRA_KERNELS # } - -# snap_md_post -- -# Machine dependent distribution media operations. -# Overridden by etc.$MACHINE/Makefile.inc -# -snap_md_post: .PHONY check_DESTDIR check_RELEASEDIR snap_post -# (empty -- look in the machine-dependent Makefile.inc) - - -clean: - -rm -rf ${CDROM.dir} ${CDROM.pathlist} ${OBSOLETE.dir} - -.if !defined(__MINIX) -SUBDIR= defaults rc.d mtree -.else -SUBDIR= devmand defaults mtree -.endif # !defined(__MINIX) - -.include -.include - -test: - @echo ${OBSOLETE.files} diff --git a/etc/Makefile.params b/etc/Makefile.params deleted file mode 100644 index 927147c7c..000000000 --- a/etc/Makefile.params +++ /dev/null @@ -1,129 +0,0 @@ -# $NetBSD: Makefile.params,v 1.13 2015/07/23 08:03:25 mrg Exp $ -# -# Makefile fragment for printing build parameters. -# -# Public variables: -# RELEASEVARS -# List of variables whose value should be printed. -# -# PRINT_PARAMS -# A command to print the desired variables and values -# to stdout, without any additional debugging information. -# Values are printed as single-quoted strings, with -# embedded quotes and newlines escaped in a way that's -# acceptable to sh(1). Undefined values are printed -# as "(undefined)" (without quotation marks). -# -# Internal targets: -# _params: -# Prints the names and values of all the variables -# listed in ${RELEASEVARS}. The desired results may be -# redirected somewhere other than stdout, for example by -# setting _params_redirect='>&3'. stdout and stderr may -# contain unwanted debugging information, from make and -# the shell. -# -# Internal variables: -# _params_redirect: -# If set, this should be a shell redirection specification, such -# as '>&3', controlling where the output from "make _params" will -# be sent. -# -# Example: -# . ${NETBSDSRCDIR}/etc/Makefile.params -# show-params: .MAKE .PHONY # print params to stdout -# @${PRINT_PARAMS} -# - -.include # for some variables - -RELEASEVARS= BSDOBJDIR BSDSRCDIR BUILDID BUILDINFO BUILDSEED \ - DESTDIR DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \ - HAVE_LLVM HAVE_PCC INSTALLWORLDDIR \ - KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \ - MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \ - MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \ - MKARZERO MKATF MKBFD MKBINUTILS MKCATPAGES \ - MKCRYPTO MKCRYPTO_RC5 MKCTF MKCVS \ - MKDEBUG MKDEBUGLIB MKDOC MKDTRACE MKDYNAMICROOT \ - MKGCC MKGCCCMDS MKGDB \ - MKHESIOD MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \ - MKKERBEROS MKKYUA MKLDAP MKLINKLIB MKLINT MKLLVM \ - MKMAN MKMANZ MKMDNS MKNLS MKNPF MKOBJ MKOBJDIRS \ - MKPAM MKPCC MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX \ - MKPROFILE MKREPRO \ - MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \ - MKUNPRIVED MKUPDATE MKX11 MKYP \ - NBUILDJOBS NETBSDSRCDIR \ - NOCLEANDIR NODISTRIBDIRS NOINCLUDES \ - OBJMACHINE \ - RELEASEDIR RELEASEMACHINEDIR TOOLCHAIN_MISSING TOOLDIR \ - USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \ - USE_PAM USE_SKEY USE_YP \ - USETOOLS USR_OBJMACHINE \ - X11SRCDIR - - -# -# Duplicate the DISTRIBVER setting from src/etc/Makefile. -# -.ifndef DISTRIBVER -DISTRIBVER!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh -.endif - -# -# _params does the printing. -# -_params_redirect?= # empty - -_params: .PHONY -.for var in ${RELEASEVARS} -.if defined(${var}) - @printf "%20s = '%-s'\n" ${var} ${${var}:C/'/'\\\\''/gW:Q} \ - ${_params_redirect} -.else - @printf "%20s = (undefined)\n" ${var} \ - ${_params_redirect} -.endif -.endfor - -# PRINT_PARAMS: -# -# The output from the "make _params" can include the following types of -# unwanted lines: -# -# make -j prints "--- _params ---"; -# -# if MAKEVERBOSE is set to 3 or more then make prints each "printf" -# command in addition to executing it; -# -# if MAKEVERBOSE is set to 4 then the shell prints each command -# (prefixed with "+"). -# -# So the resulting output can look like this: -# -# --- _params --- -# + echo 'printf "%20s = '\''%-s'\''\n" BSDOBJDIR /usr/obj' -# printf "%20s = '%-s'\n" BSDOBJDIR /usr/obj -# + printf '%20s = '\''%-s'\''\n' BSDOBJDIR /usr/obj -# BSDOBJDIR = '/usr/obj' -# + echo 'printf "%20s = '\''%-s'\''\n" BSDSRCDIR /usr/src' -# printf "%20s = '%-s'\n" BSDSRCDIR /usr/src -# + printf '%20s = '\''%-s'\''\n' BSDSRCDIR /usr/src -# BSDSRCDIR = '/usr/src' -# [...] -# -# where what we want is just this: -# -# BSDOBJDIR = '/usr/obj' -# BSDSRCDIR = '/usr/src' -# [...] -# -# The shell redirections in ${PRINT_PARAMS} ensure that the unwanted -# noise is discarded (via ">/dev/null"), while the desired information -# ends up on the subshell's stdout (via ">&3" and "3>&1"). The value -# of _params_redirect is passed in the environment instead of on the -# command line, to prevent it from appearing in MAKEFLAGS (which would -# appear in the output). -# -PRINT_PARAMS:= (_params_redirect='>&3' ${MAKE} -f ${.PARSEDIR:Q}/${.PARSEFILE:Q} _params 3>&1 >/dev/null) diff --git a/etc/boot.cfg.default b/etc/boot.cfg.default deleted file mode 100644 index 2ad2cc404..000000000 --- a/etc/boot.cfg.default +++ /dev/null @@ -1,8 +0,0 @@ -clear=1 -timeout=5 -default=2 -menu=Start MINIX 3:load_mods /boot/minix_default/mod*;multiboot /boot/minix_default/kernel rootdevname=$rootdevname $args -menu=Start latest MINIX 3:load_mods /boot/minix_latest/mod*;multiboot /boot/minix_latest/kernel rootdevname=$rootdevname $args -menu=Start latest MINIX 3 in single user mode:load_mods /boot/minix_latest/mod*;multiboot /boot/minix_latest/kernel rootdevname=$rootdevname bootopts=-s $args -menu=Edit menu option:edit -menu=Drop to boot prompt:prompt diff --git a/etc/crontab b/etc/crontab deleted file mode 100755 index 9ad432fb9..000000000 --- a/etc/crontab +++ /dev/null @@ -1 +0,0 @@ -? 6 * * * /usr/etc/daily cron diff --git a/etc/csh.cshrc b/etc/csh.cshrc deleted file mode 100644 index b08603404..000000000 --- a/etc/csh.cshrc +++ /dev/null @@ -1,2 +0,0 @@ -# -# System-wide .cshrc file for csh(1). diff --git a/etc/csh.login b/etc/csh.login deleted file mode 100644 index 70603584f..000000000 --- a/etc/csh.login +++ /dev/null @@ -1,3 +0,0 @@ -# $NetBSD: csh.login,v 1.2 1996/05/08 17:19:28 thorpej Exp $ -# -# System-wide .login file for csh(1). diff --git a/etc/csh.logout b/etc/csh.logout deleted file mode 100644 index 73103d809..000000000 --- a/etc/csh.logout +++ /dev/null @@ -1,2 +0,0 @@ -# -# System-wide .logout file for csh(1). diff --git a/etc/defaults/Makefile b/etc/defaults/Makefile deleted file mode 100644 index 9fa7717e2..000000000 --- a/etc/defaults/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2013/05/01 05:36:25 agc Exp $ - -.include - -.if !defined(__MINIX) -CONFIGFILES= daily.conf monthly.conf pkgpath.conf security.conf weekly.conf -.else -CONFIGFILES= minix.rc.conf -.endif # !defined(__MINIX) -FILESDIR= /etc/defaults -FILESMODE= ${NONBINMODE} - -# Manage arch-specific rc.conf(5) file -CONFIGFILES+= rc_conf -FILESNAME_rc_conf= rc.conf -FILESBUILD_rc_conf= yes - -# If present, rc.conf.append is added to the end of the default rc.conf file -RCCONF_SRCS= ${.CURDIR}/rc.conf -.if exists(../etc.${MACHINE}/rc.conf.append) -RCCONF_SRCS+= ${.CURDIR}/../etc.${MACHINE}/rc.conf.append -.endif - -rc_conf: ${RCCONF_SRCS} - ${_MKTARGET_CREATE} - ${TOOL_CAT} ${RCCONF_SRCS} > ${.TARGET} - -.include diff --git a/etc/defaults/minix.rc.conf b/etc/defaults/minix.rc.conf deleted file mode 100644 index e93ecb269..000000000 --- a/etc/defaults/minix.rc.conf +++ /dev/null @@ -1,15 +0,0 @@ -# Minix-specific rc.conf default values - -# Override settings in NetBSD's default rc.conf with different default settings -# for MINIX here, typically to disable scripts that NetBSD enables by default. -#(nothing yet) - -# Where to find servers/drivers binaries -PKG_SERVICE_DIR=/usr/pkg/service -SERVICES_DIRS="/service $PKG_SERVICE_DIR" - -# Where to find system.conf files and system.conf.d directories -# for servers/drivers -SYSTEM_CONF_SUBDIR=system.conf.d -PKG_SYSTEM_CONF_DIR=/usr/pkg/etc -SYSTEM_CONF_DIRS="/etc $PKG_SYSTEM_CONF_DIR" diff --git a/etc/defaults/rc.conf b/etc/defaults/rc.conf deleted file mode 100644 index a29e13a50..000000000 --- a/etc/defaults/rc.conf +++ /dev/null @@ -1,382 +0,0 @@ -# $NetBSD: rc.conf,v 1.133 2015/03/30 10:58:37 chopps Exp $ -# -# /etc/defaults/rc.conf -- -# default configuration of /etc/rc.conf -# -# see rc.conf(5) for more information. -# -# DO NOT EDIT THIS FILE DIRECTLY; IT MAY BE REPLACED DURING A SYSTEM UPGRADE. -# EDIT /etc/rc.conf INSTEAD. -# - -# -# Use program=YES to enable program, NO to disable it. program_flags are -# passed to the program on the command line. -# - -# Uncomment this if you want to use local paths in rc. -# -#export PATH=$PATH:/usr/pkg/sbin:/usr/pkg/bin:/usr/local/sbin:/usr/local/bin - -# Uncomment the following to execute each /etc/rc.d script in -# the current shell rather than in a subshell. This may be -# faster on very slow machines that have an expensive fork(2). -# NOTE: USE THIS AT YOUR OWN RISK; A ROGUE COMMAND -# MAY INADVERTENTLY PREVENT BOOT TO MULTIUSER. -# -#rc_fast_and_loose=YES - -# If rc_silent is true then /etc/rc will suppress most output to -# the console. The default is taken from the AB_SILENT flag passed -# from the boot loader to the kernel in the boothowto(9) variable. -# -# rc_silent_cmd is executed once for each suppressed line of output. -# Useful values are ":" and "twiddle". -# -rc_silent=$( [ "$(( $(/sbin/sysctl -n kern.boothowto 2>/dev/null || echo 0) \ - & 0x40000 ))" != 0 ] && echo true || echo false ) -rc_silent_cmd=twiddle - -# Additional flags to the rcorder(8) that's run by /etc/rc. -# -rc_rcorder_flags="" - -# The directories searched for rc scripts. -# These directories must be part of the root file system. -rc_directories=/etc/rc.d - -# If this is set to NO, shutdown(8) will not run /etc/rc.shutdown. -# -do_rcshutdown=YES - -# Additional flags to the rcorder(8) that's run by /etc/rc.shutdown. -# -rcshutdown_rcorder_flags="" - -# If this is non-blank, use as the number of seconds to run a watchdog -# timer which will terminate /etc/rc.shutdown if the timeout expires. -# -rcshutdown_timeout="" - - -# Basic network configuration -# - -# Fully Qualified Internet Domain Name (a.k.a. hostname, e.g. foo.baz.edu). -# If blank, use /etc/myname. -# -hostname="" - -# If there's only one way out of your IPv4 network, set this to the hostname -# or the IPv4 address of the router that will get your packets off the LAN. -# If blank, use /etc/mygate. -# -defaultroute="" - -# Same thing for IPv6. If blank, use /etc/mygate6. -# -defaultroute6="" - -# The NIS domain name (formerly known as Yellow Pages); not in any way -# related to Internet domain names. -# If blank, use /etc/defaultdomain. -# -domainname="" - -# Filesystems to mount early in boot-up. -# Note that `/var' is needed in $critical_filesystems_local (or -# implied as part of `/') as certain services that need /var (such as -# dhclient) may be needed to get the network operational enough to mount -# the $critical_filesystems_remote. Prepending "OPTIONAL:" means it -# will not be an error if that file system is not present in fstab(5). -# -critical_filesystems_local="OPTIONAL:/var" -critical_filesystems_remote="OPTIONAL:/usr" - -# Swap device controls. -# -no_swap=NO # Set to YES if you have purposefully setup no swap - # partitions and don't want to be warned about it. -swapoff=YES # Remove block-type swap partitions upon shutdown - # This defaults to yes, so that raids shutdown cleanly - -# Concatenated disk driver. -# -ccd=YES - -# RAIDframe driver (manually configured devices). -# -raidframe=YES - -# Crypto file system. -# -cgd=YES - -# Logical Volume Manager -# -lvm=NO - -# One-time actions and programs on boot-up. -# -savecore=YES savecore_flags="-z" - savecore_dir="/var/crash" -resize_root=NO # resize root to fill partition -per_user_tmp=NO # per-user /tmp directories -per_user_tmp_dir="/private/tmp" # real storage for /tmp -clear_tmp=YES # clear /tmp after reboot -update_motd=YES # updates /etc/motd -dmesg=YES dmesg_flags="" # write /var/run/dmesg.boot -accounting=NO # uses /var/account/acct -newsyslog=NO newsyslog_flags="" # trim log files -quota=YES # check and enable quotas -ldconfig=YES # rebuild a.out ldconfig cache -sysdb=YES # build system databases -rndctl=NO rndctl_flags="" # configure rndctl(8) -gpio=NO # configure GPIO devices -modules=YES # process /etc/modules.conf - -# cope with other OSes using the real time clock at localtime on this -# machine (by adjusting kern.rtc_offset at boot) -rtclocaltime=NO - -# NOTE: default coredump name now set in /etc/sysctl.conf - -# -# File system check flags; default to preen mode, checking file systems -# that are listed in /etc/fstab in parallel as the fsck pass number -# permits. Fix minor faults automatically, and exit with non 0 only -# when major errors occur. -# -fsck_flags=-p - -# Security setting. If $securelevel is non-empty, the system securelevel -# is set to this value early in the boot sequence. Otherwise the default -# action is taken (see init(8)). -# -securelevel="" # securelevel to set to - -# To set the IP address of an interface either use -# ifconfig_xxN="IP-NO" -# where xxN is the interface. If this variable is not set then -# contents of the file /etc/ifconfig.xxN is used. - -# Networking startup. -# -mdnsd=NO -npf=NO -ipfilter=NO ipfilter_flags="" # uses /etc/ipf.conf -ipnat=NO # uses /etc/ipnat.conf -ipfs=NO ipfs_flags="" # save/load ipnat and ipf states -ipsec=NO # uses /etc/ipsec.conf -ipmon=NO ipmon_flags="-Dns" # syslog ipfilter messages -pf=NO pf_rules="/etc/pf.conf" pf_flags="" -pflogd=NO -ftp_proxy=NO -racoon=NO # IKE daemon -auto_ifconfig=YES # config all avail. interfaces -net_interfaces="" # used only if above is NO -flushroutes=YES # flush routes in netstart -dhcpcd=NO - dhcpcd_flags="-qM" # For ifconfig_XXX=dhcp. -dhclient=NO # behave as a DHCP client - dhclient_flags="" # blank: config all interfaces -ntpdate=NO ntpdate_flags="-b -s" # May need '-u' thru firewall -ppp=YES ppp_peers="" # /etc/ppp/peers to call -ip6mode=host # host, autohost or router -ip6uniquelocal=NO # IPv6 unique-local forwarding - -# Special treatment for interfaces that need to be downed on -# shutdown (because they might cause unnecessary costs or block resources -# on the peer). All pppoe* interfaces are automatically included in this -# list, add others here manually. -#force_down_interfaces="" - -ifwatchd=NO # execute up/down scripts for in-kernel PPPoE interfaces - ifwatchd_flags="-u /etc/ppp/ip-up -d /etc/ppp/ip-down pppoe0" - -# ALTQ configuration/monitoring daemon -altqd=NO altqd_flags="" - -# Daemons required by servers. These are not needed for strictly client use. -# - -# inetd is used to start the IP-based services enabled in /etc/inetd.conf -# -inetd=YES inetd_flags="-l" # -l logs libwrap - -# identd -# -identd=NO identd_flags="-b -l -u nobody" - -# rpcbind (formerly known as 'portmap') is used to look up RPC-based services. -# -rpcbind=NO rpcbind_flags="-l" # -l logs libwrap - -# Commonly used daemons. -# -syslogd=YES syslogd_flags="-s" # -s "secure" unix domain only -cron=YES -named=NO named_flags="" # see below for named_chrootdir -timed=NO timed_flags="" -ntpd=NO ntpd_flags="" # see below for ntpd_chrootdir -# The default setting for postfix here is YES, but gets re-examined by -# the rc.d/postfix startup script when it runs. The script sets -# _rc_d_postfix to "check", and then causes all rc.conf settings to -# be re-evaluated. If the value of $postfix after this is "check", -# the script then checks to see if /etc/mailer.conf selects the system -# postfix. If not, it does print a warning and does not start postfix -# to avoid conflict with a different MTA. -postfix=${_rc_d_postfix:-YES} -lpd=NO lpd_flags="-s" # -s "secure" unix domain only -sshd=NO sshd_flags="" -ssh_keygen_flags="" -ftpd=NO ftpd_flags="-ll" -httpd=NO httpd_flags="" - httpd_wwwdir="/var/www" - httpd_wwwuser="_httpd" - -# To run the named(8) DNS server as an unprivileged user under a -# chroot(2) cage, uncomment the following after migrating the contents -# of /etc/namedb to /var/chroot/named/etc/namedb -# -#named_chrootdir="/var/chroot/named" - -# To run the ntpd(8) NTP server as an unprivileged user under a -# chroot(2) cage, uncomment the following, after ensuring that: -# - The kernel has "pseudo-device clockctl" compiled in -# - /dev/clockctl is present -# -#ntpd_chrootdir="/var/chroot/ntpd" - -# Routing daemons. -# -routed=NO routed_flags="-q" -gated=NO -mrouted=NO mrouted_flags="" -route6d=NO route6d_flags="" -ldpd=NO - -# Daemons used to boot other hosts over a network. -# -rarpd=NO rarpd_flags="-a" -bootparamd=NO bootparamd_flags="" -dhcpd=NO dhcpd_flags="-q" -dhcrelay=NO dhcrelay_flags="" -rbootd=NO rbootd_flags="" -mopd=NO mopd_flags="-a" -ndbootd=NO ndbootd_flags="-s /tftpboot /tftpboot/bootyy" -rtadvd=NO rtadvd_flags="" -isibootd=NO isibootd_flags="" - -# X11 daemons. -# -xfs=NO xfs_flags="" # X11 font server -xdm=NO xdm_flags="" # X11 display manager; needs - # wscons=YES for local displays. - -# Update fontconfig cache at boot -fccache=YES - -# YP (NIS) daemons. -# -ypbind=NO ypbind_flags="" -ypserv=NO ypserv_flags="-d" -yppasswdd=NO yppasswdd_flags="" - -# NFS daemons and parameters. -# -mountd=NO mountd_flags="" # NFS mount requests daemon -nfs_client=NO # enable client daemons -nfs_server=NO # enable server daemons - nfsd_flags="" -lockd=NO lockd_flags="" -statd=NO statd_flags="" -amd=NO amd_flags="-l syslog -x error,noinfo,nostats" - amd_dir=/amd # mount dir - -# Heimdal Kerberos 5 KDC (with Kerberos IV compatibility) -kdc=NO kdc_flags="--detach" - -# iSCSI target -iscsi_target=NO iscsi_target_flags="" -# iSCSI kernel initiator -iscsid=NO - -# WPA daemons. -hostapd=NO hostapd_flags="-B /etc/hostapd.conf" -wpa_supplicant=NO wpa_supplicant_flags="" # -i -c - -# ISDN daemon -isdnd=NO isdnd_flags="" - -# Bluetooth configuration -bluetooth=NO -# and the following are used when bluetooth=YES -btconfig_devices="" # all -bthcid=YES bthcid_flags="" -sdpd=YES sdpd_flags="" - -# Other daemons. -# -rwhod=NO rwhod_flags="-u _rwhod" -devpubd=NO devpubd_flags="" # autocreate nodes for new devs -envsys=NO # Set /etc/envsys.conf preferences - -# Hardware daemons. -# -apmd=NO apmd_flags="" # APM power management daemon. -powerd=NO powerd_flags="" # power management daemon -screenblank=NO screenblank_flags="" # wscons and FBIO screenblanker - -moused=NO # serial mouse handler - moused_flags="-p /dev/tty00" - -wdogctl=NO # watchdog timer control -# wdogctl_flags="-k devicename" -irdaattach=NO # attach serial lines to IrDA - irdaattach_flags="tty00" - -# Configuration of "wscons" console driver virtual screens. -# -wscons=NO wscons_flags="" # setup wscons from wscons.conf - -# Configuration of "wsmoused" console driver cut-n-paste support -# -wsmoused=NO wsmoused_flags="" - -# Configuration of "tpctl" touch panel calibration utility -# -tpctl=NO tpctl_flags="" - -# Mixer setting -# -mixerctl=NO mixerctl_mixers="" # "mixer0 mixer1" means saving - # and restoring their settings - -# Vi recovery notification. Vi(1)'s -r option can recover files which were -# accidentally closed. See vi(1) for more details. -# -virecover=YES - -# Veriexec signature loading. -# -veriexec=NO -veriexec_strict=0 -veriexec_verbose=0 -veriexec_flags="-k" - -# Entropy load/save to/from /dev/random at startup/shutdown -# -random_seed=YES - -# Creating / updating of man page index on boot -makemandb=YES - -# blacklist daemon, needs npf -blacklistd=NO - -# Start of MINIX 3 specific settings block -if [ -r /etc/defaults/minix.rc.conf ]; then - . /etc/defaults/minix.rc.conf -fi -# End of MINIX 3 specific settings block diff --git a/etc/devmand/Makefile b/etc/devmand/Makefile deleted file mode 100644 index d9415c1c0..000000000 --- a/etc/devmand/Makefile +++ /dev/null @@ -1,4 +0,0 @@ - -SUBDIR+= scripts - -.include diff --git a/etc/devmand/scripts/Makefile b/etc/devmand/scripts/Makefile deleted file mode 100644 index ceab4bb56..000000000 --- a/etc/devmand/scripts/Makefile +++ /dev/null @@ -1,6 +0,0 @@ - -CONFIGFILES+= block singlechar -FILESDIR=/etc/devmand/scripts -FILESMODE=${BINMODE} - -.include diff --git a/etc/devmand/scripts/block b/etc/devmand/scripts/block deleted file mode 100755 index cd16851cf..000000000 --- a/etc/devmand/scripts/block +++ /dev/null @@ -1,42 +0,0 @@ -#!/bin/sh - -DEVSUFFIXES="p0 p0s0 p0s1 p0s2 p0s3 p1 p1s0 p1s1 p1s2 p1s3 p2 p2s0 p2s1 p2s2 p2s3 p3 p3s0 p3s1 p3s2 p3s3" - -if [ "$1" = up ]; -then - mknod /dev/$2 b $3 0; - mknod /dev/$2p0 b $3 1; - mknod /dev/$2p1 b $3 2; - mknod /dev/$2p2 b $3 3; - mknod /dev/$2p3 b $3 4; - mknod /dev/$2p0s0 b $3 128; - mknod /dev/$2p0s1 b $3 129; - mknod /dev/$2p0s2 b $3 130; - mknod /dev/$2p0s3 b $3 131; - mknod /dev/$2p1s0 b $3 132; - mknod /dev/$2p1s1 b $3 133; - mknod /dev/$2p1s2 b $3 134; - mknod /dev/$2p1s3 b $3 135; - mknod /dev/$2p2s0 b $3 136; - mknod /dev/$2p2s1 b $3 137; - mknod /dev/$2p2s2 b $3 138; - mknod /dev/$2p2s3 b $3 139; - mknod /dev/$2p3s0 b $3 140; - mknod /dev/$2p3s1 b $3 141; - mknod /dev/$2p3s2 b $3 142; - mknod /dev/$2p3s3 b $3 143; - echo New USB disk at /dev/$2. -elif [ "$1" = down ]; -then - rm /dev/$2; - count=1; - for SUF in `echo $DEVSUFFIXES`; - do - rm /dev/${2}${SUF}; - count=$(($count+1)); - done -elif - [ "$1" = clean ]; -then - rm -f /dev/$2*; -fi diff --git a/etc/devmand/scripts/singlechar b/etc/devmand/scripts/singlechar deleted file mode 100755 index 9b8f0c08c..000000000 --- a/etc/devmand/scripts/singlechar +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh - -if [ "$1" = up ]; -then - mknod /dev/$2 c $3 0 -elif [ "$1" = down ]; -then - rm /dev/$2 -elif - [ "$1" = clean ]; -then - rm -f /dev/$2*; -fi diff --git a/etc/devmand/usb_hub.cfg b/etc/devmand/usb_hub.cfg deleted file mode 100644 index 71b534aee..000000000 --- a/etc/devmand/usb_hub.cfg +++ /dev/null @@ -1,8 +0,0 @@ -usb_driver usb_hub -{ - binary = /service/usb_hub; - id { - bInterfaceClass = 0x09; - } - devprefix = usb_hub; -} diff --git a/etc/devmand/usb_storage.cfg b/etc/devmand/usb_storage.cfg deleted file mode 100644 index 03c85955c..000000000 --- a/etc/devmand/usb_storage.cfg +++ /dev/null @@ -1,10 +0,0 @@ -usb_driver usb_storage -{ - binary = /service/usb_storage; - id { - bInterfaceClass = 0x08; - } - devprefix = usb_disk; - upscript = /etc/devmand/scripts/block; - downscript = /etc/devmand/scripts/block; -} diff --git a/etc/fonts/cp1251.fnt b/etc/fonts/cp1251.fnt deleted file mode 100755 index f07994e9901138e62d3e0d4bbc09179363122010..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmZu!y^9-16d#VT)gmk15+8Dt!sSBXyoBWrO#XzVNwwHv<6?`eE`ltw&xQYogR2hQ z+#is_U|8;8Ng-Sc5naSpQezHPvI?=v?|sb7uAC=(ci-o{uX!_P%s!0H-=Ckqzc@c1 z31_sM?RK-}Zl}00MFS|4zSZm}WgCssbh%tcQL6kX9YNXSAVVY)?v7!3dy54Kn40F# zpXZ{^#M_IHA1`i|KL~o?4ab0?SV(g~8esv!PkuOw0jH~b!C$|8{Sxr|a#0B(ie~9D zovHkr>VCCpHmm#U4YLn|-r%@79`u3(6;EM08d--8EeF6`_^)TP*`JRI7%%HADeAgN z!nzazep1Q=MLNWu=2LKx)PMQ{_yv)!unCpRHsY+w;+An!Rh3$2>eHero_c;iNy^eL z4>F2ZCcb=LkiSry6zd!H2cdr7l_+4H{}VZi%KD}%gWz3V+6ZpyFp9JKov0;6k(}M3 zUT2J>G?_5;30a0H6ha(@43Up8Pj{(in`Mw4yOuKrm%V~%XG2B2#z8>-X}t|qYcipV ziC~lrVGE%3DQgk0)h6&D4T8XyH#|&>aRZkJqTiqx+ZI2`fY$(RhX(o*v&fgkYVqlN z1pRQRj!PxH`xdw1vU|u{VC4-wSLcb85sxAkKJ15x&eqo$5a#pwU8Vl@DIpCxB=TEy zKuI0H6+F#v5Mgzr8`NwHV&-|V5q^`ucr|>Ly~s6Rif7rXr9ZFh{71oQC0?@M3H49;lX)5T$O7{z zMqLm5EC~arKN|ho@s~_9sC~r>yWt3*OeW1kq5jncc4LX83r@M@9BBMa{f>%vWBV_a z?GnezH<)0j$)TH9scfGxWIk0>?EcRa(>9LVgGFVAVd?g(xz94nHk!a$C~Gu;&EFwb zDj=@=n}o_5o51pu;0vtnkQXRJUK&8< zMHm`3AI5xckl=}r`;N@pdCmS&5qvztFI@{*|Lm5&JIj54us%A#>i6S#OC>ov1V@0w zYvqGicL#_u(g0e2s9^Ra?K+WnGz3DsrN%T*bwBkG>M13NyOSm`Z)SQj5RYV{Q^C*f zu_X%ejkhQfz~2J+U;!Hx}3T6Qx^yb==u=`YP}ARd2UvZ{Hus=SzTI6YQFJ zEBWi!Y7ZXm!M8tkf4^LJfB*i`{Tb7H{J7;T`A`b9-0{QJJmT&6xhPWKA1FzyDzv*X zqTR^WaqaN7U7O!%I-N>=>3D5RoKEBHZ4!()@>)mwtO|Z5&rxxp}J4Wdz9sF7BaF&Pt4*%##_lgnyb>MJo zpWk?>edjOZ&%FQEzLm!mX)yg(RV5op_1F5A*V@O!ej&eBU;W%!dF6kxILm!qk8XXw z_8#+h33yzeBIJ#3#ae}grDLv z$k5bpiK6Mz{1}5t{Bue3cp~z2e>%kV$<9wQ{b{~l==m4^)5T3ao~~BYF{q+HILh%& zAb4Fr(20*D-{Rf-#7Kl)JaX6Y`WzejxvE4T%}wDs|J?Z=dHXb+t^X3+r0ge_k7klf-(?8G0l^@`6X#uT2sIb?W4+x2}dYaDa9T;C^fC3#)p= zYukssYk|JBfa?H0&)t0vTG9edpnu_T3DE)0o|N3pDB3ar?H5Sha|4u4zOJbO77mvN X@bMwPgLZz=0_cECCy#tk0}%cnb%s8B diff --git a/etc/fonts/cp437.fnt b/etc/fonts/cp437.fnt deleted file mode 100644 index a0a13e3cdf28175d2c0eacff21d545f7d4969664..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9728 zcma)B&ub;e5pLG-av8MBZHR>yf)73pcF+!Ckb=p-kc&@)ZJvD?5}o9MOy2HZmK^*C zWG}hpl5?(x$0|&G7}hr-kRo)FF3Tba$dB-tm+z||Ju`1NPFhbhQ(e{FRn^@!^-YJc zT^7&&^6c5SFP=SHC}**`*lbR3HyfivsCtwp-}RQec{3){qPV@iP1C~oX|X`#fkrh% zQsr)>+@5j(7O5@fpL{ac=2Ch3;@fXuoEm?B=Vu?)9ZIb|6myg!#Q;hleSDOm9N%3l z{p9l}pQC(vd$ZJvG`%Qpiwl!~y1c$y^{cz<l5^>n9XKBy~$otbv;zx z*Y-UoV?E;MCFmB#mP3#BYO~5WWR3WIUZ8zao8meXgZfUpxuPDtHgov^%}se$mE_T4 z<)i-u*7^K~fQqZDtIMV7w@ZigR7mC5SOE=J{95T^{t^~0U)lx@tBTC|yjm&0pMUmM z{Z;wd-27#9S>BD>U$yQ0mr8Ra8P3Mz;*(M+e_vL^u-|VmR9$1x8|B}XQsQ{+o4&_% zqFDbo_x;tYffiqrG<(H9c47J%|Lm$scG!dPX`_t?ewin;*nYA2bfPc2mSX)IRr!V^ zeRg)%zo|^Ww!&^~;B=+wOYwo(-?z^>c`tqa6}nxr%=iHj>^R?x@v6}6lO)3DY-+#n zxFXtS**LJ6Or11wzlQ6wq_?pMVh>G=1>pYM!$=jxZGTg!X|V~MpI2X$GDqfL@J}e- zHHn09^k1E@fAcSvW04A@(XyN_{;dKuOpAB|jvU`u$q8}$= zut)h#Tmr72Z|TdE`LI5uJyw9X-_5c$r{rJ{94%tr$R9F#e1U|Z3&7?dO%QwX@jOvG z27$!4RL6K~`)LQJ9@9axIvIgwGxI8iJj$fUN}pWneYnaF_wIu3XKd$WCLZZR80(L< zH-;kWPPM~GvqYa=AZIo zy5$HOVK^Ms8Pg1l{k+87d%S{BcXF^eKmRS|LpZFuuBS&{390&We#BdtJc*!@R(%J4 zR(BJBl0Wt@+f!QRyJmMDptS$ixIP~2*a2yoAXRa}1$ZUAOvscZDG_ z5X#Q`;E>Gnw_-=RxoE6we%G~PTdx5Fi(;vuSxp1=C@p^E5kU=kBMIH=C6gGhw{sybKt zr@x;5{pPRJzkhx`{S(i;eOXPaR%xUUwA|a>wdg1Gw*37p%DbH3MeBZxe?PO>5Q51? zTJ%EyBkTDX^)tO6Ip1i_!@V+ujn(_@kw2J7l=t?|m;0kM%A0-L$P-bVIX{n1wY z*q`c?Zu@t8zM}sG1dT4PpI6;&m4{o!1n?-+CVerD&gr(0hh#^A4;Kb>j z_Zd;Q%h-NIq{WbKV-N&M{Ip0swCCYw!FyEUj}IlidtFt9+H+3V_*6jX_&h7Wn=YS5 zi}&!OcSrx~PRIV{+$r#%!2T)de+%+Qz%T1B!hNbTfPL}?s2_qO{aQ4(MPi;&l&bd2s&_~qdl5G&h4sL8lAU2a#h1|( z%5MRA>@h4vD-#euh44QD;1#{wYQrWOWA`y|cijFw!gfLJbKMk<*(D?(w=G>M+_C&w z46ftO60!Fbs@qN)wT53ZCkI=t#(Xx#=S}i)*l14rk&A`P2cE^El#5;Mo;`_j3g za^pEBZD~x_ zPm)!|o|wh8^cgdCp$vB$>{gWRAlNbY-O%pJ0XNJW!FxyBg-ANq)*W{OZtgJ6bj1Hvi^Cx0a5`79vj)rLt?-t55 zMXkxh6q+`w%LE%oJ)8D;&urLLTs**HK@HJbofscaCNRFmID>=BIlWUXY*5XSumWLv z0eedJBwmAf5Wb8M-?lcM?lL80S4H^S8CnxP8P!@7Ld&W zFMApK1e6+4>}ABm7mJ(*$=pVqD-Y2AzPO*_8A!Rv^v%bcX5rdg75g~$};>{`AoMO!>(tPZ=R7Q^|Qbvdv zQ*@c~4i3f^fv5Vq4W^;qjcw$Wf@bV56W$>}V-`Jq(c15TkIWaFO8!qZn9} zU;{X$P|=a1L`=2?F7%9S3K9(?W_vP%#tZ~8rLc60Bt-ndPl`kvee|on(jsXOjsz75o=Yl76iyji~Z6o$U$slXiHxFg0dW7MQCN9 z>Vx@4zz`b9DKn0wBPfGIv%2Po$lzF-SP82&WX-ZpRvF%8U7F2Xem}-x=1K6c8JKc> zT1a`w1|U!ZMA})UWIr}j3ZT|T@z5m*TEG#cqMIgU$G{)i8edr*&R6}z`Frh+? zi1SVQ5yq=AE|Tv+;}aa^*Af`(?Oc8{oPRNiIN|9M?B`yryCud)mX5P9<~en@hM)3^ zhgo-^kp?%(>RJx3Zs5sdu|EmwfNM#;Z={xbh0yU>689Aik^bnXz$Bz$htl6ZXdE`N ze_428H*2!&7o0yfqaL`yek{ndzGub^2S~1rdgy~m{!{kFI_zcHb%uBbv*n)zs$!V2 zQxUZ?P3j)uPW%Hoxp(G|rp=*3 zf%fVj=7WgWT%r){Fy6YXOKy!P$&>C0Pg`)<@(N7+=pVncW6*k~E4gb@#w6h${~U;i2>g^!K58e20^l00Nf|^BdbCL)y<%e& z?KhPqgF|ez+S8Mii2|!wFMM85%X;>wDU~NvoStLBhrl~(v+<0^a~al=hkbYX9dnnuTXieU z;JQQLTf%+%K3#WZ#(0e6K|ks8z0{OTG@~=Znt`*<*0QV-&zONQ|Jch?#EqKmBXy=*^&6nHu=630aWL{NgXJ>g{h4H+a z=4H&}8VT}wNA#tGP@x0<~7-b7!Q&S#%|_0=cO!uami>$hf0w3$k%CTLZT36#G5 z_U!`g{`slWAKm-t9@_h7tA%#t`HSkTdJ*^^EKbiayUX*_#RD0>G1}VQ>-KiHMmGX` z1=0E36n2~r4No2a=*5c{e|m#WXy4Xl)3!~SwO$$IlO|IV=1_UTo=T%D=+AFx{e&=A z)@5N-WE6E*7X#sLu~-D@()(7^HE;Ff+hys!O^BYCx_zjxl}%GlkKwPW&~Qzy1K|_A((+6@iae8+_bZ%K z>nd1VcwilyD~f{3{R?hrjlj~sabraNg1;TTb#z3JDPvyFAPX({$G6Jf2AQBo)o3&_ z_hvg)v+SVquD;*F8CQexvIgCvg>dNbzOGsMJ%ONbqZ6NPQG$$fjbT2F*JU<}@6YGI zPV}W{X+eIV8ryKBkB*MIubZG>+h8|(7+q=FQfv^`-?b0vyr&j_m2Q`!2;&YJ?0&fu z^HrtWC(C4<-c-5Qd@|c2I9?f`R|X3Wxk=O8LRQ2+eZn|Ix^8VLPC~E)WiW4S>L}%y`4>;oQp(20rT7 zeN6F|uSGvPp7O!H70l-oPH5E#?=nXaEHN zlWxj#=qKSv63A>zEtyZle%iuP@6$jMoy@@2baIZ7C%-TB^jNzGpR&VEoa^_qzOi&} zs6S#a@h4t(Nqm5RNF&=Mbcwt=9H$;3eq=t%OX3A?8`6|Fq}{|N@sZetPhvau|uURfTTI5hj)t4R$@gw^7wCdZ_#cY|_ zljB4CI=oMACVi&-7OT~!^4l;P=Ytmh@Z@3@<}aJy)sg~NSEAn!{NW*^f3@ zzAO!Fy#Z6P0(q|S!E<5gANqS}KaQ(Lst@Tze+1ZIe}QT(;p+5N)9ek8Bh~{h*p3`U zfxq=4uFoHQ@#KpqPYwnwuH*JsarNolNdqO0krnsQ73j&~r?-_wjy5S`^aXs5o9E3q zQqF;Do-6&MJL#WaJxTxk>ksK481A}uX`S^VhL^;fZ&NxOr8Jy*@adyRk3J3S9kX4G zF64R5hiKhxj9-jGZr~^@vIVklEEu#pPAjIUZ_xXuS|er?t;4O;xwWm&_>B%Mkw5fD ze&-MogZKiK)EBbEcZ%EnRQPtgcqduh*(uErZAxP|r{fe-iWNj2@{1KTLL*xxG}2i@2m6J@uNvX= zX6Vla1Pwj{N9@t#Aovl3&@Yi67^7gx?!$cJh^?M4(S^j$e3|AW$V>AR{X57Hk&62n zLTFvo4|Tl&f%DrN&64X}Nw4)6^a<%t^Bd+*Xw09`j`>P^^i!ZwCKWgn|DcFh%|e?nlNQp#E1dKZa!u8h?iOMUja1Wh`QS zj2YCYog4}k&17l|h53f^739BvwpxG@4%|Ta0QduZ4|s3Yas=aiEySrI`{-B>T?^|C z(?=;{CZ*sdzNh{v;%Ww3+T0&c*QEwZFo{Z*tsl-7xb1|Pv@*8ucbKN~#Phz#I76te-Ehswx+ z`L0Y5V7XOIwSscpIDq83DB)x_lYfx{95*yB8pfkFP--5Cs23>jGFuQ-R4q3#IHUuD z!>~5P0Ds5wK*p}%LT1Y=p|n&t~dGEv!H?w7r?~~KP8Q9hxx0*D~ ztZ4!=Q=n~iGGO)qWv4Zto(FaU$QmMk(lMax1YEDo5(HMkM+U4lk5g+l^_YG)Oic=i zx@klTnMzJ06pS}G4Z8MYc*(G|L1~>K#nA?%F-Dh&tXDtQIAEi{ZCJ`3{k02+oq%W6 z8Vp*S38w*P<&?3`Q1cEzv&SY=KVXcIbOSJ}%@9N-_Eb3SPy!2B)@lZ`11g*Uge`JH zrov>=1s}(>)Wj%pQ`DMcDLnS^_bvg)JjkW__Wn-r(Y6BP9v2I2h^vKz%zt=O9Tear$<`X;4^^Fs&d>#ta7E2Zf?!qv z17f20G+|v&MbH~ptA6JUl+w#|kkV6>(o+%YA_kF$4d@C*&XTJom0;Wy;a-PtUyi58 z0o@w76>O`T!Ps65Bbphdni&;At*nn@z0J5H@F|>4(QF$kHJbs`2$Yri49F^u4KTJx zu>%a7LRk8!w>+t67b*7oNaol;Peg^qJiaCwEXAxFh*bfrt)aa055mS zr}qd|KYTXIZW5@1dVT!iKNY7+{^w8a;k^{2MuhrZ==6Ia(@Ta3&hG&%Wy#rtQpD8& zl8P?n9RZ|Vk)WqvT5tCs>Dc(%cW{Ndaq#1Fh%r0<%-%^YzV_HC9J~RWEvTqGu^3+Bm7@pb* zvc#4ej)|a>%Y&2@Q*I#21W&3xa?CYo!GaMo%9k)6I@J^CqW}k823102kyj)^a=Y7p zF!+c(Dv2(RL5iOJ#tFyR-n6e#3S`T1Ae;mG8RsYdq9S9gS+p>57%KrBEl38Y6PX)SjI?^;4CXMD^iJ- zHc{aJ!GMH)xb&S9@Zm0YPNc^xUc-2$FLAB1jUP{OljygR8vrz*$$G6=4l~M~?Kte1z#| zR&!?X3j)Ct*ki%46HLI{E>E~oO<*_tBqksO$*SX}-rY{0_^F2Dhq%JShLWGwH9=GY zAb2$o=pcnBK?5N}xRv8E%gZ?Gi{@oM!W5wo{TAnE!CFnADCSoXP=&4R^$C07Wmf!n zHc-7~wtxy1?DBDb3-f7dUpWC}xXRaZzS^wi*O(>jE}j=tq#7)La*RGyY|w8fUWKtP z^U$llR9JN}dq=aVW!g32MmtTx@{h(<8?VsZXH~%Gn|3PVt3U~`)AkC5Bl@Kzm zHa!!$N-Q%AmlRW+ExJyBp!R6x9G&6}P#Ta#?1Xt1i+NW11LdbjX`dpzua`0ve%&si zK*cizU*Ja#G{hVD;kUf#7MJp$7v?|i{?_rf1(z*{c#jbQe@kSjT+*|@u!Nf;j@2Gg zQexedOS=e7yWa4JM=SpTRpoh&cz(A5+5A143pHfLE08>_2PcB)$MtibJjjQ==rG!i zk?X87w3?78zPN`Aj{PqmfB9Jc&kX86=kBeV`P-A_Yk2-~{QG~8$R`OCos+lW0(?$z zM*ifl`p0e^?79I)i|rEMidqaudvd3uYSZU@|Fh3O|7?H0d1=5h^dgjR9i~G%g1>U) zRV3I@hfyxuO&QN~I|i-bVxhobVL$oUKRx!Nc{_(abpG+!iYY6jtbnr8NsA^*p`7tp ze~fpMwpv%rxxr@4GZ*~H-5+#|E5rkeA$by>zr^@7&A#4jXIVBfMB;r7i7 zupw^z0XL{ed@3#dh|i3chu$(Nq#y}%dNyQb@eeeVuVSkI-1_gk7eD>Y!&lC~Vcmcr eh~+|GDTvQ_o>Y*_vS239yuhwN1LojBX#WHKWo;lG`r?-=+ud$wq#m|X=Fv?!EVnOPs}`NhRWmgUx-<#TlI zXjFqG)7FiYi&q?gMQZc%qmN4ME|sso`0~pyURnG8&O7&KOO%;P$V-$w!vIPjJ~$kq zJiR&>rmX4DJ|v4$;}% z6%HH@1y61N8=~DZC)mHC!?YomnUHkB;hV$x4=e~|n-r$=Y;|J3RroNYQRFE$J zSe<2c^KwxS1}~c0EqK`svr*B!&~B5enoLjOuc^>*O`#3;4PGhPP%B2+P)gQWSmvAD zW?OhLJ3dwv1(mxFp+6hO()GAApnm4>KyMu%(__k*O=ggVV*aTcWp7L-=s`Xh4BWlL zy}VksPrwh|>mlM)bA?3fu3aGi_ua(Zrm#}d0(l%&VS8OcH zYOU>U`S9b}$Hl|a=F8}!xa{>mYnt*yr8$xeXXA14Ny)W+Usgl6-&YuFHp8GRZNDs} z#POQ9Z3}mznEcgMdv?^(GS?){Ua^lNOh0QsKC6d2lpyW2(Z)l2F&PeG|M~o9iM|vq z#pD}R`GzBXe0vkE9tUVxtJ)P{uc$Mq+ z84jhL-c-4_d^6f&aolK`4ePjH!+B9~wy_8zU)^8<`26i*qzde|zsXcL*aWeCe19~f z&T&15DcP6xP(nE5S5wNj`Nh(l^!+~=gdJ=L6wC{RgI^bb@hdZW_e(&`>9#ajt5Bitz(XZ^q;K$;lJ)hj36Wmn~=HNJ!O}9*aF& z*X0?86#K)@yO=6wASb#$crNt)Lx1<@kL{|F>O(rw9}BFvzd$t}a7CYxSJgrPIAT5! zZ0^W08sSqc`t}8$p$qLU-z~Sl(#841vVsz)h>8cOGP*qaeBs-KuebU~eru2X!uNH@FZygcc_t_FdwfN6%iX zKiujc<*7c|_WW-9E6$&Qpx&43=T(V)2Dcdi>&iT}YSdsm`ttVU7rn0tBbDr=OmWlWsWN zTW#M*#&RG%l*acQ5X^dm`py9KS92RI?2U>7Ll>hx!Zz~{>=FL zIA3ADqkIMVk1tjWvfe=W0Qfz84|wm{as=b-X6w|EeFXMwx)s(trjJr&nv}wVU_VRG zIy9eR`7I=mP1Z^;ekCYA#qjMnBX~La4BcUuB-p)=+#R^Th`3!~d#Ss^K|5mtEEz?m z@PhTvVz>cMmdKJ~^_xh&FRioH~j+9H-m8-bPi$bq$LMy**?roKC-CIv)oClZ+^97ZgX zlLCuQrL@iG@RDO`htk@X;%JA_XroI+*3GX?@O{v0lXO~7Q-D*?-FpVzD4J{dAeuz?J6+taIwIKXe}J%{zE@?ppQ;K+|4;S4IHt(U1p=Q6;6l3 zvXm^+!a!+r82l7eJZz^oeEVjMgzt$M@8I@`lxl{_R=Pe7e@8dU|42_?pLS62Vf;x`kL3u=*@fA)YOKY9Uyax8nQ}q3V-YgW){_RZ#DY zpZrsCs>FZ()NZ{}jH(9^X7bz6>HmRD*VqnTBFZ!@a-~n#x<{p)-+)G?Uy4K{4z&?< zm+Hpc#-M9gOP-h?7OUGrV=1Rn%I`SN`}H^@1~XkELIj=S%@l2>STjYMA2=?R(IbkK z5hBJE9n!Y(xNi~KQX5P|eH^M~!T}r1PClYVR+nN*LzFuD7M@)9q)?7BIb@Wlaadgn zB2x%yEQv@0NW+f~9~C`D@aXIc9ffKM9Q(LYU?bzT6dv3-bQVGwWR!OWjE)x#E*e^N zu=rLu9V$x1WDS6!XJjc#+y_XU10(KBKaCj(8%kjr>qp209pdz7>S%c$-e8g;!`pCS z4-}`E5CO;zsoU_N9cijfM3RaGhi?=Kra15>3j7}!kgyMzzH-Q;atf zcfjQWg#-q%&hbwl`6%;TI`9i4anHdv4j$RF7czn1%F*5iCf#3=3v6xX0`H7q-E#XF9 zV%~7yA|L}0qvfUE!&aY2<=K9OD?Drx>8CIv4+Idrng?`1;=2k24TKDKE5~D&mvPh= zr6$0U#8T*^dWSUo!nN{>Q8lEG+l)sb)jLsfggU$M(tuP8+87I z_75#@TX5NOgnnER@VBfKl}mc|d!}$xtYe)INhx7B<#Jv$#l*bcsc}bAKSNe|SztYX zSb?nm!t0R#H2-M+h8!~I6-Z|GAWw#(x!BKfGLw(_qQf|ET)FW!!*fES_|c;S%s;m% z9|8Ga2#;3P{6V?Ai|22~zx?-rd=fBGSv~-lY}+RM@H74MTL-^xfX`xC%bO-;OcJi} zPX>~w*QaS3)gT|Z2Q8TS#%GpwiI~dGB+1|q8wy3S^dw`VAT++DonNSBJ>_Xi<;j$% zQJz3~>ZC~%q)M_j9&4h+(KsIE=(w5|$#|?pIh1id3DR-d?uidm9>|Hw&YF!V)X%aM z5zTkcXgrr;opMi4|BloJX$yYzULt-V?ujEMQvqFAio)!K$qBb_y}*LtWazKgIN)Si zWBti8#81^b@*{N)e$6=sLq3ZI5{mTh@xFg4wxB8S^#cbQ9(w$J??-j_+(~xb?ex5QuU@@+?^X5t zrb5_mvnO9adGht~lP5Ff%r?u-W_i8Y7#%{@p*53TAGteehGbS0*VorsRv14kW*FSl z=!Qt9+>NyB*RL@FoAegtg9oJ!m(JJ6-+g!d+W7m)&b##jtyT?1iB@EoKgIC(SlD-xo&Ce^aDOMcW8wu=XEQfA za5^+RmH%kDT>j-fHldq#I;q;Wnxt)`0`f_hDG7I|KJ%y2=ra5H4XvLL?n=AVxS}JU zcGG;IJj~~F(=NRqR9*E!&)=O)n#QL`H-gtp`tbFF@(r;mFn=(6u+;a*5*4(|AG@=x zXnGTy&)#Twh;`LBygl4J?`-H5tEY*%YOQmJ~3d>?sn72g+ z-toDjDwy042t#j}NI&9ELi;Sm)^=%h%J#KW8J71g4H z$@@CKLon6@{$vWeMYDA1FkaWJ@(o!7KEKZ}KCR7gjYMz0)4p6W4_-@LKEQG_o?TP& zxMJl)e~Q(4d_zFT#l^+>-0a(>LpmCy@@r&3!;D`mU6ik|!uc!PpkY;!S(epG`Ca+x zm-Uy^PfPQc(bMV8VEjefmcLV)Gs$!|ACpg7q5OTxhJL?aVXC^uq*uznnM#ZEwLf$n z!ii@3uWq}Glb#k|leG29`l!O}GydsClkQN1@VQ2t5B%vQP2%|3?30nbR4vW)8&&y+ zBYk>$+WkM0Zl5$2KBK96 z-|~smHqVC#i^zCX52@e$i`1M9p7L-^3Jf`+Q5EKP>zFknzX>AHSRDYlh@t4;*c>yn#Pt_V@w`K@-5@k0CgFCc`+< zIvxV4Z>a^(Q`=8FSn3fSB-zOmST-|1rIAOO>`3W{=lbkFWrw@Ea9Col!G4$Xi}SB_ z#F}3RbjRRJQ+|P$fwZoD${zA>!1oCdi9a-q$EnKm{M^Iw>HeeYlZ)Fc%m4IWV>+~p zvzwc<1$uS-{y~ZFY)ZH758UzC@=lM>lbH&~_2^mCkC(NzYgnw~vA?;xXkXml=3iAe zOWb~4+i9~q@%a%=>}Iz|lL4RIo#Yn~k?}m>6O|X&@WbNU(<*<7gm0KZmaiOt^$)Zw z9ZzG2@u?R{vcI1sULU=H=q=@6sJ!@NMkgwbPb`@k5a~`7TKv%q_59!S@ybVww5EW? zAHC4Gj{6@pmP9W_d8EKz^dEXH0gRt!V;cO$*$NpD#~;du>S-MLJn;D zq4K}_c>M2=-;DqL`_JQl+*ogEt5M%7i}ZoETYDaujopaemcLD+yvzAh#&=u%+r)Aw z1e1%j*aiL3H~J;oXLjFnzR_BTduIq6>-Wb!|6(Fh-p4y%p7*jSZ}xrU>yhV2`Tc$> ze7m2I`9FrJU*tC7$F1>E-uO{oxAA|K; z|NX7;QJ>nAZTojSUeSL7f(9RMpLgACwYyu*MzpQ+YB{i!t^f|rr-g}-bgXh`VnZ1Ac zhK8)ao;fLA$?>gBc*MSO8%hf&bN*c^@4m09Vo$r8r{8|_^5x5KzI`eVIy%dz{~V`J zqs=w^?9_e+>HHfcz2gOa4W;&q;c)PhJo8L)hPW_d_E6T5KtB z==U&RQNDwG#rR)bU(G4{2EYftAHaK{doPwF7UwWS_73bLt|#lQsNNxc)FN(D3aP+x zQk@OK{20n_0eQSr`%N$c@nZ=8GXP%EyJZ_ZHpK2j;O@BnS%mF^+I3R^6DwvH$d1}} zDr?aXq(7U%bv)T3_8vp^H-S3*lDo2gt=3~c8{_lFszb@{;OJa45*wYn(Y7uqB6B;H z9GCBlazo|Db4;!}fyi}HB8lQf@VN3w;iyVA2i31}bIKQAkXXXA!j}gV)yi!M4xK>Y z79$=u1Na@$w`f_j?8Dz$C`H~5ybX67>{gWRAlNatLM|D1;eeZmH;O$ie}bd!LS}HR zt*gB%tE#Rl17?b|eTIm#WnAkRTPUr5{Rb6ULxfNCXZr@W)}tIe;wp=g*WGFvhp}l? z^t(f9Qg~f73aI!?juhZx3!EotTD5fTbEJzyX-Cq^8^dTv(d7L!hTgmlKMQ)6ofEOM zS`Af1&b9`}%_=Fp&UucRHGbd`k#6B-^%?SL!q<+j0q<17%0r~=@e{Eq37vwHhJrAe}#v0V$BKHLh-BoDG$MuCY0k|g*_d3 zK)t3E)r(?YkrcR-405-JyF|M^)ni>57m=<|PX*{Y%%zR}E>?i!R!ctxWSlMsb_>6;Z8d(SlAOEod8;B;-lyCgt0hx6iJ4*@*+NsB_2(qx#VyC(M=4E+kBU$Vv5#7em440$uJ(^bxMJ zIpzoWnAceUVzFKmn1+!|d4q6T6H!wUgOftPV|>q>;c`FQVw=@;kqp3oduFD{SvxX!<;Ua-;D`cqP! zv*y4RS{vGrwN?ZZCe+xh&$ACPUyXTjaTU1u6j%ARoO$(jEx+mSzgV_60fVr9q&F;> zV}2|LcVSAe;ipN(%d8vl*`2OL9GRMjBUyjS5otA%ORB1rUfP8p!FVl+=ZXsv{qz&` zhzCqxib5QhO`@NP7k2X|&wtDKaTx8u1M5dZo^~B`6<(BDnQUGdt^byPz7BhNewpWc z+!yjk0$u&@P6{*wYRqy5`w;|LH$S-k8QnLX@|OU#t_2N|Sy(P-#ca7m{P7b$@}n&O zG{fy3Xni8=M+m&=61iv!qSrXnv3$8l)SAc+q?Jxl$q#a;c(aXOE9Al7$& z>)xB{m`csmDf^UMS1&?0&ctWLsgN_%Z&RT1ao`q1vnyj}y@yy)|~ zN916Y+l$!G&qK+-5_#5OU%l`79V tl3`FU&`Pw)1Rw9<@^JCxWVd*5{MA>-4~qQvyT7i5%}PMNgz#V%{tGAxw#NVf diff --git a/etc/fonts/iso1.fnt b/etc/fonts/iso1.fnt deleted file mode 100644 index e8a34e95ccccefd6f8b7b26ec290f6ca743af6e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9728 zcmZ`%hV*Rq}0~d!G}5Q!0NCDL#|6?n^hte zBWNcmx2k1~>BF3d*37bpfrUY*W!RHJQ0ra_GZeiyA?T**Q|n?(pF|y+s{OwAA~LgD z+OWGKU%VIZFJ8R(lQEae=*fRPdGh?}lP4p^jFv~s<-x1v(!$1M3zQ;ixSoxusDnWq zzk2m52x5y5;t@JmFq%OUD0V63)d2;tNNb$lxsz&lX*_uP{Q1)Zi*IfG{G)t^k}HQe zMTr9lQ22J|c8D@OKUH`<7!OdkU!6^~AqbA*SMiah-<_PE&lmIa)5)%&*Sw8ZZ_#UQ zcx#qC2J2wt6gCuxf?Dz8qobq8AFv2qOp_>^PP53L7D^z$beV#1hw`)jR2WTGe}17< z0^u%y;ajZm2$Mw;)|i{gWMa8X>&H|}2 ztVoe%i%k9q1VJ(Veo}bex6{H|@cq;e!esg_@y0}17VR8kymkb{&?NHVen2ZF@UusTdcbqK81&Y)-NY-6z`!E-c~?^}MsF$}F*b#(3*<$N`#NkVTU2uhM-iU4r_YeG^6ay!3C zR7^1m96rkKB{D|VzrgR1d{+39!ofe=A%E*%gk~fTwf1?Q*}!x_L7GQr&}#r#dL^#> z1(LHRa`Mp;zO)>Zz4JGkbcic^6kn7f;Pi7-`gkX;;zRl)0-Sw~FudT9bemS1F=AfL z9~|;>{6Phf0Z`Hti2x{Jjh~U{yD2qeKDF~{1Evn?Ac;;U23NE{aij@`3hx}3eC>zK zaL4X460k1V8n1Vst^Q~B_U3zgd!~1l1;q2+^WEKD)7y+UH#Y$f_jY&ph9>?n{>9A? z0Ry?aJFoCu4$xdLHl1sH@BQ$nKke@sFx%YhfeOO*{$aC}XKl5PDY?vTy9?&FgKgb* zlonn(yq#1IE%jU4-qK{=+UDdr{oMkg> zgy&;*9JzE~PQSB@nvu2Dq}D2*vNXshz=ER#%=QDf;=al6YrA|+zm^UR<|Y1fB508Y zsh}_KkKV{m#q{g%{`kl5z*XpnLH!-Wz0A6TwLc4{hkAqdl@{`Q_UC7gpPfY| z@&6x>BcU0-43i&f;^#paytGpb1Q?r=mHUunGa4ilX}GjMR3hgb*9A2e=@?al{N|P- zVuvsHAg-nW+F*V5l1LP+#8ae)^ze5*ae;-C!#{X_8~F3^H{Bm=cw~J1pG@rfg~-AV zO;=#DL$IyD$Q3KFK{~0^o2e-`4D26acCX+~FPqI4%!r4?8|=5Zf57&^_b^Hf>_wU& z_v(Iu{;b24Uxy(NU`5aVcE>>PiT-sMd36PEO3&B1R$!!^I?Mp5!!+{2tq(>o zkH6w4ON;^J@QZ@#;A+314z6Hza0SC)c(j7qKVputQ~|EpE_Rkt>L+1BX?IBfFW>#0Fd#Q0I2UDI39I4%x5dG zf&c4x(o-4_5xRfS5Rf3?77Y8KpCm)|JU^20sQw1hha0(n${S<#C@)@y$DTZb~Q+cX0Il`H>v;jcLF8*MGy4z79+brK@AU zf9<{Z-n(`+%JUFB+Be!aZrphPmtXy66VU1be=8Xl<6@X>0b|TN>+iP5?RVGT5vV+i z3)GQfIvs(^yiKS#2%Fu(pxg8YJ;Cw^&XDhti?~T4#G~REnYF{b?~Ofs&;>pS#|U3n zI7ux_G~K+jymQl`SktKvUe>P%T%!{4^lqaI9;aZRyk-2G{6F|15wW zK79BfQC+Sw%y?lXxDg_M%l*PD^k_SHiWcX=vODKaM{RJL(Awg}G2lzlVd) z-wFiYdLt%~T`O(!yv}`;r{^qV9(B6ixZCYK63SeL-ANdHHNH`G$HU{H=9Dms!?k z*Gnhge!uAVP5TN8$cwFfYs<77twsY-)ZgkyrgfwBv-bgQp%fMF@`+coqRi?3y?^{w z-!xF#=-2P}f6;IftUYtIS7olPwxMllv?2!-+h$LcOKq%v-)MOA9Qy`|To3BV; z?c{o_kX$~>+N4-!$@Sh2)~8H$UAr>6+8Awa3DoR{oDh#R52C5ez)D>G0)ffyb{lq? zvuoTXE_Y-{aYy?i#<;l{Y4lKSaU_weYroBSrNrJRpa1&TpMN5GDY_E(W1|UK2tMd$ zU40f%`tdrmo-1Sb0U4ise)pg5DwonoLBDZ6twm3i1>wC?T;WH4b+>}$sA4Z)oPO!8 zWCCDiZ$so;{OS8x^g`s2Dhovj(5P-7taIa)oDR|~=xqOQn>H#GJ~)s==y^DJUEwGU zy8z8E++H(VW66UWSj}q?@@@^n9CnK%H69FVP!nrS#l@I*H%+%k_#>q$*G*VNc~~8L zx{lFF6-0Rz1PL{W{dBG5iokvqRGl%2;|9CJVSkJD?QsW*7%14_mP$a*c3ml*?Fu>D z6=Fx)XCY`-gCt+l85C~TTixx4_a8s%#)(QmFBHZnB?ur8B~%cttsvSbGeXzRoU0fX zfNBj-v+cqC2ZkrwXPsi*4IrLL5^V#HkQ)vC&(D` z@#>35-w{uIctIKQjh9cn?rk?JA~qBaZ786wB-!Os4|6!w%bV@ezSUlT_xiu`=;lss z@+ylrS$U1!KASxK4Clr8v!}bKcziwGHESEaMQ>w`ha5RBi77a%BUABl70zQK)T7{N zgyS>la0Xfmy(ARr2DR*4Y57Jv(YI0eCW;R7%Ip?-u^xvU93*iuhR01^fB3+OXHF9q zliZ(UgD;nCQ{HdkF>}Wxl1Cv9CkYM`{*coWIM=>a%Bz55PK3Fz5KmMbN_m1TriUju z`fH*MFHAo3qhzKvcX9f-*fJNBxlb6ciF3HsT+F}#d~iPI|Evq2SN>?L{Uww_{X{%8 zz&9mR4h~|x%fj2=B!~U8*~M(e*RFz3eQ^rEVZSM_dwAMg@KNuJh1R&AB>ph%@#+EH zW=2m3x#4Ra^*O_RT81YbzWnfMZu-+=@nVY0s^N@<%zpXo zbl9Yw{{<@%wLqg>Xr0TQ*o(za;0GqWO9K)rBO zva%cpW0uwX7cZ@L___r9k3o{pCXkO^Gv31Zbe+#G;HN0#W7aufJQ5ZD{8S#V&fv+R z=*eT94_!|ANR^#QtLDua9e{pw8Y2AYCu5FzGXsXguLT&7P2?|uXByo1e9ZA5p1Be)c|hwgQ(s4f=It`uBd-=Ps5zSoUKpl#w#WH$U9= zv5jxyxk(g)OFzpJuD(d``p*fVIBb2hY5Xt=d}Pzm_ks|$S?}qd^2(?&+QQWac2F-oC9uDs!&^jA{sRSGmr7|sX2F{mFX*A6wYIU=LXAmki;Vwd^q0Sku3fvv zwwnGy=<$sdjT^WJ+i2qh(o=+4a++qH?d$8TyZ>@!<9zdX0>j>f@g4Y>`4=;jOtj9w z(K_ANddAEEeE6x>y?p=Q=KKF{^8=h2EWXH*7lKghsIPU3Ou_afWM+UITj$>>tQiA& zD@$MV>OI|;#9%`FdlFu?2BFqbU+Z*VYrRf~qwKuL-RbZDe3oOH(?1vJr*-~~)_Pg0 z?K$+oTQ*YzX7m3XPp8L|Fwl7q{bc?_KdIAwt)ZvD;ir+*#{Brv=s$U!jMGU<`!z41 zzvKt>mm2+~#=p}Us{L9I_q4{)NINF4pJ5!*ea#D?hoQ7z>!`1Fy010jP4FCktb)+P iD^6Y)u%C%xhyA1uKh+v?Y&$CED>yvMPmTBm@c#jTO13Hh diff --git a/etc/fonts/koi8-r.fnt b/etc/fonts/koi8-r.fnt deleted file mode 100644 index 6553dcd148e5ef9505ba2a8d59a01ee070459bcf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9728 zcmaJ{&1)pb6))t_xinhkHrPU&gAYD7PLPMtNU->jKOnjI)a;tJ4@1yN8Azx1`^QkMd&15jL}IR$k3DD?|oEvk2bEgrsvgr_3C|8Rlnbq zL)dKf({G+8`dH~uKEF}S1A z4Uv&@*V3-vyuk!)(wmnL9+WyOo;1y5oHmsT$R|UlB*LNkES^fE%k1Yjv~EI#D{WKbijJ&k zi>#+S%w{vwF1?>j+Q}y!e`h?dDxV(RNM1GW($@*fH{>SA{K4#js~-;~CeSW_>>iD( z=Jl*flIKn39=vYSQC2k1b=Y_^86Te`U&lftHH9+l6SC4qsdi+eRNAQXu*}!FMO$PL z9iJ=u#LeQ0FEF}i!f7?7~@?QJ;%XPbCnehWou%q#AJg;)yK4~g^W>fXP z=M$%Gmh}%7lbNPf+^^xXC>U)lf~cWtumC)MyO?PLaogV%sv2wp=Z_~}7Lp^2FZjn4 zpI50I;m|)hrhbbrmgcyh|0D_9*bZoj3kE}87l6sDFh+PhLin*ofX_O=&#B(eYq5_> z==@QB6_P_@jF?zVoLUR!O+8~QfwiF_#ntW5AZ@wD!{kDHBlZ=?O@^Wncge>eR1 zpT7?Og|Pk6M?GU{L#3@}PItJ5d$JvWoJ{g=eIO;htZ;YZh>l0L9oLcW>-G4K-o1OL z`Q_`iFLCrPEB+P3A33%-gvLs#dln*k_-Ac@qe=JuQOqBzzX{(MtGK^K;?RdFm3=m# zm!r*mw*!8g+&V3x#e8N?u>QjV{aF@ik%#^Pe}CWhO3?AQNu*uBJn>=rqrF0Z*4gj+ zT^^@Mi_`CBHq#Ac<8SS$kK4{4u?z9_@n+}R<&FQd(;{~_AH)3o+~rHKA|LwrU!=7_ z?C7SsIz2tTihPuuyHOc>8BJ6Weg58i_*==ZRD|}Rq>S>HMTLk}N+bEqe$4+t32BLl z@}-`o2D49-kIz>1Yx2AN+xD>if%T@=#_W@?&5hISd%if8q+jEo{(DF>`8PMnzRT|+ zQ`%hLPpkm30Gu{=jMn61g!yC1M~BJ_pXoRHZt@$NAM1x$|Bbr&817#3|D-WcKJ|%C zo1e=1G}w}U&p+|TF5pH_pGMU3KbV89#$sThvtX+nEfQt`7cpGG5wx@?e$Mb z|Fv`o_6IaqY6JKWVE+*G-+}xQ@XH%I!hKHCfqn8is2{@K_J^Mm=}*O$942=#Us1k; ze8u=*U0=;8dI#VG-}m4>(7hMS5sPz}A$te*5!aLTUR3XpK5CILDTQ;H+3Y*I}P->a&)dM5_^Nylhv}^DM047Q5=`=iE=~b z#&b-rI)TX5DUqzOUF0uP*gUDOL5-_d+D@rMVhL+EbB6VsTDb|qp&ba^a>SQy4}M4V zEm~IGrufsNLXo!vZ^PXNyA@?S2zJbUBU)tKg#&IL2i@`RXge24$J*-cRXLeVCldo^ zinD!&h_Yo|;}}~gzRS_9E)^dld}3sqJJ|Y4#(_s%WjXS5RW0K%HqDrRcSubN$6cj> ziW7I`1cE1MTD7#z3oI9h(vGB+H-yoSqRIRJ7<&Ca{4D5Mf9%3hE7)1BhALJL=7ZyA zl@wmpITc-M??*vF`4$H%w(+G~Bw0cGQyr%%%o>vicJ&Tc$; zQ*I(%>l{9Y5O)Z0e+k|G60)V8o3PeG8zQESkhTwKc_8!cpl2TsMD)ay(EP{4;sPWq zIU3^F_n}yQp;7@1835RbmmEduQ|5};)sXAT_n2@Ex9WFCeL_XdDinS+@9B(qReXqO z)n-4`5kf_zDv}YWnxrn{4UFnKH9jWU$EOjUx=xh@E^nI%Ol{n)J^6^JRP2kG)ciBV zXgtGNu5qJvp zh_JKj|0toDvjZIiz`1e0^uQ*tW{)D$>;p}~nb9&unQj>lsh-sWBBIsux{c%N0k~Z8 zcw5b8s;BpUK!@VW-V8hl?NlB@%GCf+3ZRIy3!J!eEmhNpk^&ZN8S?Gahmp$LN_3=*0}({4K!1AS&Dr3QCOlq4@(3D9~o_coJ)9Q4A>a0RbX= zo5u%%PU?7dE;u#j%r6cka{2uxVBy^m~$BC0Pfze@BJOAp62qJ zuSbH{0M`VmeRVZE`2v^3`4=ZoE(y+_gspADvMp%E)gIsy?ZX{w01D&fYB+er7lcB= zy2j}bIf$(dZOPk2P?iI%2(1uL2I%8*Eno-(8||1J;-#LWg)|_n_7hsE8&_m zWYuh%E;F74qYPOe%Vp+qD2kZ`4lla`uRC6{0ofD)k#<)p)sKkqk_C*Q>17vY610FT zNJTeQ$c_lAR$)3%$HiQqydTla#l5haEmP7!E=wZf)f{hC=m9?Fe|%OcfAU9P@2`MO zGukK9!vemVX(#5vTRFr003Wj{{GZQP^Eq$3ur^jmC*p?t7C{-n7%eaL9=7_#RT=qj z%Y%R%W7s?(dT7%?1VMX%9Z>mR1)>IG2Ez*hNP(Aea_dTj!1;LZg6Zey(_NuCZaTj_ z+NGcWRJ~xMtvDalX94ROS7=RWK9^sQ*bft?cm=)~eTw;}m>0!&pz|rN@~85Gnr_ze z>+b%GWqTDc2>xSv!-5&+hda0nQ+kCsjVHX!x&fcv>C%2nK_rjF|CA%r$yhF_CZ+V! zt`O$Dmc(;O4@5uX1U(V~)0d(U$7Pe~=fVp+S(RnKXZ|>hcHja3u^`XdmTMJJlq){6 zd118rNA~3^>}J_zmhEz1$R7!Gb@vWk2`uk(2@i!skh&GmrS;v%cj|y{d3s$dd~|s& z>w1Jng-UU@L9yz!s#mFApZcwf*Q9>Sg1DfmA{zGre$<+Ojf2TcPOfH_n_g&A^Z~0w zG?tcDS7v|Q`R!EIjK_R>4QbVlRV@4PUi|wQE4(gpN=l6w4z)T&RNQZ=2!qvv7$tFn zoim$v?^|Vt6H?@%L8~#V!}13w-+XiO01m!g{CDvd>bU-a&hjEx^vDDF@dx^zZn1DZ z9`#~TbNZSa3{Rjq`JXe&ztqPi;%d(z2LSkZ?+UJLZ2gyIEi|T)`&>{$ACw3C7_a*Q z&%7*@Z|;`mLBf12>bzcvTqXOIJCF;cX>KoWWn3!b@W16O7>X)6NXQo&{!mW>nlHf$ z-ot(PPb+B`4kOwBG>ZOX`N&V(@D{8(z)fd6@k3PI$= X-!Odv_g_rKd&J`d(F6Z4ZQTC=X^6JR diff --git a/etc/fonts/koi8-u.fnt b/etc/fonts/koi8-u.fnt deleted file mode 100755 index 8ffc447295a53fd2cc4feec689ad11792941c8cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmZu!KZ_ej6d#VT)gmk15+8Eo!sSBXyoBWrOg=)=q+0B-ak0f!7eNNu=fdB?;L6~} zA3%k{AnsssAzX?hx`?Z!#u!y+6=Id&`!h4UvY+lGy?KA<{pP(L8M9BL^S9^cZ(p6C zk3=%s&3C)`YPVC~n5qHUtnV!QnQgO4p08G`B*|5tIU0xyp5wGUu zqerEf^Wx>J4XoL@N5>~3yS;=*yM9GGp*5Qk zVxpL2L-+zIKDHM1T780#@+gWNyzyaPO&g><5c>vTY+LfI0AGXjI5e=AJ&V32QA3X;)|MGpTlcIWUl1`CVD;(DU_^{F5YB_#S= zoB&HFek*)lUSNll3vE!dsYqCs)kfq^`S|JZY4Nz!dMRHN>z4hZuFGG9r$`)5m1{WSXR}%JrPBQB3f*W?bm6I%Tm#*IQ@IwSvDUmVS>jeiuG9@+tfy1*FvasX6c zlwslOVa(?S1)ha{Uz2+`uQ@*gA?!!w)*k_vpKIysvof3yw#Nx@_Wd;75+p~5kO=Yi zTJ_-Q{sCf)900{1CYU{08z;(+hCu9EYD)7|`>BVmo>GDMbkYRoW~O&0l95hwD*V~C ze1>=KaOX~z<++RRWY{LPy64uE-#A`B@9Da;*TlU)Z?F2^UhQ^!{`T|na=rxUHNnNi zr!If{vEHLQd-UV4-PiB$y08EK?!Jua-M!mNmU6H{t#rb0HFvljKUY;A&IcfAp+en_ z5$#8|j%&}i{kr-lS65epFFjt{8mCuj@zIyxOZ0FskCQTLWr*tGrF67MynHY5_~G_f z(Gz3q`x_dV2b(s3l0I~9=md28xinoK_Dyu_^trT%r|B47Kk4ufQ_r*hCh;3qeeD$^ z_P3Geoqq?R>ic||e;D$2{+&LiNQ3FOo=jW=(erSDI6^AD?a{b_N#bn)Y) z%R@fB+FVVY+?Zn?uz|-FfNlW6zuYi9KcewkhyBR)Bj`guIw}Ld6@8yFJ^wD;{D)V) z0eJtcj`{6WX!H2@a`>Y^&&vfd@O8Z$kHy05x*r7}3!=|*f?xS>!LKQOe}C}z zza+$?a<{<$O==)=^2a_kJ~?ai5HtJ^fBL;~h@TrRe;xdX(lYHA0M-pHA(AO~FZ6iJ14y!3)*nCCx?L7; zudc7JZjHZOy!+5@K&@&hYfzct0L5pgXF2Hn`Cf5f_mueS>HAt2vg}*=Sbj74FYEi~ z*YWlFe*Hz*N6BJ&Hl8gP$&rbdP@VPu!j8&7_^bSb&u*xSW*C|x9lD4`mmTOcf5JV` zPcpuOa3I{3j;V1)Ca>PAJW}q~>$Pc@)%VTVybt{2qUbt*JeCo>t_a}^g7OWqDR~*Y z&oB(X%_SOWm;YSOvTnFpcS&+Nbl!rSADn6J_;G|5F z#D_OMDVxoRD=$@kL@?eWeo+C#i(Y;deKgtY2P@+9dyoBTt9<$x-@^4h_U6j<;I+id zyWa7ir;0pUtP9YeM)7qH3%lL!Zf)s$OoxoTkjlRy**j+Zo8q#*fraZED^T~^kXhHw ztMbSC)93bc^{F<08Lq15X#Z{)>R%P}BstE`WAX`U18_^phEVShII3-N=!5Qmu7sxZ zhNp2vI6?WTHl_fP!NfoPkhi?^l+SKO z@lBUX3y1z@Mg0~}Bzh6YKS|sIvG9A7URez}t76=WjIc^n|7hiFuJf1h>9kozn!c_+tlpPZ7sSQ>IT+ zUs4&*1Og*QABsn0Hm&naf zChDH&Kb!Xa{(kDWSe5sy(|Y^m38exuJ|1Oln7&^g&PPos1M0^sjP4>0)(#H+Hp7#M z7T_ChNqOiW=lzkZ;rWBUaris*PgKcVp5uvZi9W3ViT%-XUh&A{-SPx8!td5^(3>L> z=e+$>Gr{CWn|;6d?`hL^+GidJ^5oin^0D0-j`bU!KSurGwD~$IlrQu^#OL%7VeIw~ zoV;(qQvz^%(abT@Va9jE1g+n`G;#c4y$%f1yb$JxH0c=68J}aySXZsjA55#$Ji&M% zTXezli`I#NVV=k42a^22+&IIKw}HjaD}*n29Ta2#;0FfU5BV9EXlj3!{Dgn>HL?6Y zJ-}|5^QluBzCFv(Kl6XV10(&2he0hw=$~QepJCjOPaSO*`%wzhe4_cq-%ejQ*tC(W zFn{9rjRAhcuhb7s#L( zbAQ3`oBbIwAi{93A6WGFh)dI62N=cT54zCL3)m6Q5A;twKhQrhc2fpOejwJoFUhcs u^1Tl6i~#jV^F@oHD4rj9UW}=KhT;Dh^Zs%ieniOp5atu{w;vODH0TFsv7dMV diff --git a/etc/gettytab b/etc/gettytab deleted file mode 100644 index d39875d6e..000000000 --- a/etc/gettytab +++ /dev/null @@ -1,153 +0,0 @@ -# from: @(#)gettytab 8.2 (Berkeley) 4/20/94 -# -# Most of the table entries here are just copies of the old getty table, -# it is by no means certain, or even likely, that any of them are optimal -# for any purpose whatever. Nor is it likely that more than a couple are -# even correct. -# -# The default gettytab entry, used to set defaults for all other -# entries, and in cases where getty is called with no table name -# -default:\ - :ce:ck:np:im=\r\n%s/%m (%h) (%t)\r\n\r\n: - -# -# Fixed speed entries -# -# The "std.NNN" names are known to the special case -# portselector code in getty, however they can -# be assigned to any table desired. -# The "NNN-baud" names are known to the special case -# autobaud code in getty, and likewise can -# be assigned to any table desired (hopefully the same speed). -# -std.110|110-baud:\ - :sp#110: -std.300|300-baud:\ - :sp#300: -std.600|600-baud:\ - :sp#600: -std.1200|1200-baud:\ - :sp#1200: -std.2400|2400-baud:\ - :sp#2400: -std.4800|4800-baud:\ - :sp#4800: -std.9600|9600-baud:\ - :sp#9600: -std.19200|19200-baud:\ - :sp#19200: -std.38400|38400-baud:\ - :sp#38400: -std.57600|57600-baud:\ - :sp#57600: -std.115200|115200-baud:\ - :sp#115200: - -# PPP network link login -# -# these entries can be used by ISPs or others who want to be able -# to offer both a "shell" and a PPP login on the same port. Setting -# the "pp" attribute allows getty(8) to recognize a PPP link start -# negotiation, and invoke the program listed, in addition to normal -# login(1). -# -# N.B.: if PPP is recognized, this bypasses normal login/password -# exchange; the expectation is that you'll configure pppd (or whatever) -# to require a PAP or CHAP handshake for authentication after PPP is -# started up. -# -# It is also recommended that you use hardware (CTS/RTS) flow control -# on the port, and run the port as fast as possible, to allow modems -# extra time to do data compression, if enabled. -# -ppp:np:ce:ck:pp=/usr/sbin/pppd: -# -ppp.19200|PPP-19200:sp#19200:tc=ppp: -ppp.38400|PPP-38400:sp#38400:tc=ppp: -ppp.57600|PPP-57600:sp#57600:tc=ppp: -ppp.115200|PPP-115200:sp#115200:tc=ppp: -ppp.230400|PPP-230400:sp#230400:tc=ppp: - -# -# Dial in rotary tables, speed selection via 'break' -# -d1200|Dial-1200:\ - :nx=d300:sp#1200: -d300|Dial-300:\ - :nx=d1200:sp#300: - -# -# Fast dialup terminals, 2400/1200/300 rotary (can start either way) -# -D2400|d2400|Fast-Dial-2400:\ - :nx=D1200:tc=2400-baud: -D1200|Fast-Dial-1200:\ - :nx=D300:tc=1200-baud: -D300|Fast-Dial-300:\ - :nx=D2400:tc=300-baud: - -# -#telebit (19200) -# -t19200:\ - :nx=t2400:tc=19200-baud: -t2400:\ - :nx=t1200:tc=2400-baud: -t1200:\ - :nx=t19200:tc=1200-baud: - -# -#telebit (9600) -# -t9600:\ - :nx=t2400a:tc=19200-baud: -t2400a:\ - :nx=t1200a:tc=2400-baud: -t1200a:\ - :nx=t9600:tc=1200-baud: - -# -# Odd special case terminals -# -Console|Console Decwriter II:\ - :rw:tc=300-baud: - -Console-1200|Console Decwriter III:\ - :rw:tc=1200-baud: - -X|Xwindow|X window system:\ - :rw:sp#9600: - -Pc|Pc console:\ - :np:ig:ht: - -# 8 bit clean Sun console -suncons|Sun Console:\ - :np:sp#9600: - -# -# Plugboard, and misc other terminals -# -plug-9600|Plugboard-9600:\ - :pf#1:tc=9600-baud: -P9600|Plugboard-9600-rotary:\ - :pf#1:nx=P300:tc=9600-baud: -P300|Plugboard-300:\ - :pf#1:nx=P1200:tc=300-baud: -P1200|Plugboard-1200:\ - :pf#1:nx=P9600:tc=1200-baud: - -# -# XXXX Port selector -# -DSW|Port Selector:\ - :ps:sp#2400: - -# -# Auto-baud speed detect entry for Micom 600. -# Special code in getty will switch this out -# to one of the NNN-baud entries. -# -Auto-baud:\ - :ab:sp#2400:f0#040: diff --git a/etc/group b/etc/group deleted file mode 100755 index a19780c83..000000000 --- a/etc/group +++ /dev/null @@ -1,35 +0,0 @@ -wheel:*:0:root -daemon:*:1:daemon -kmem:*:2:root -sys:*:3:root -tty:*:4:root -operator:*:0:root -mail:*:6: -bin:*:7: -wsrc:*:9: -maildrop:*:11: -postfix:*:12: -games:*:13: -named:*:14: -ntpd:*:15: -sshd:*:16: -_pflogd:*:18: -_rwhod:*:19: -staff:*:20:root -_proxy:*:21: -_timedc:*:22: -_sdpd:*:23: -_httpd:*:24: -_mdnsd:*:25: -_tests:*:26: -_tcpdump:*:27: -_tss:*:28: -_gpio:*:29: -_rtadvd:*:30: -guest:*:31:root -nobody:*:39: -utmp:*:45: -authpf:*:72: -users:*:100: -dialer:*:117: -nogroup:*:32766: diff --git a/etc/hostname.file b/etc/hostname.file deleted file mode 100755 index aa6ca5db6..000000000 --- a/etc/hostname.file +++ /dev/null @@ -1 +0,0 @@ -minix diff --git a/etc/hosts b/etc/hosts deleted file mode 100644 index de55a8ea2..000000000 --- a/etc/hosts +++ /dev/null @@ -1,18 +0,0 @@ -# -# Host name database. -# -# This file contains addresses and aliases for local hosts whose names -# need to be resolvable during system boot; typically this includes only -# the address and FQDN for this machine's hostname. -# -# By default this file is consulted before DNS, so adding additional -# material here that then becomes out of date can lead to confusion. -# See nsswitch.conf(5). -# -::1 localhost localhost. -127.0.0.1 localhost localhost. -# -# RFC 1918 specifies that these networks are "internal": -# 10.0.0.0 - 10.255.255.255 (10/8 prefix) -# 172.16.0.0 - 172.31.255.255 (172.16/12 prefix) -# 192.168.0.0 - 192.168.255.255 (192.168/16 prefix) diff --git a/etc/inet.conf b/etc/inet.conf deleted file mode 100755 index 3a30ce6bf..000000000 --- a/etc/inet.conf +++ /dev/null @@ -1 +0,0 @@ -psip0 { default; }; diff --git a/etc/inetd.conf b/etc/inetd.conf deleted file mode 100644 index 4ad0a7ecd..000000000 --- a/etc/inetd.conf +++ /dev/null @@ -1,85 +0,0 @@ -# -# Internet server configuration database -# -# @(#)inetd.conf 8.2 (Berkeley) 3/18/94 -# -#http stream tcp nowait:600 _httpd /usr/libexec/httpd httpd /var/www -#http stream tcp6 nowait:600 _httpd /usr/libexec/httpd httpd /var/www -#ftp stream tcp nowait root /usr/libexec/ftpd ftpd -ll -#ftp stream tcp6 nowait root /usr/libexec/ftpd ftpd -ll -#telnet stream tcp nowait root /usr/libexec/telnetd telnetd -a valid -#telnet stream tcp6 nowait root /usr/libexec/telnetd telnetd -a valid -#shell stream tcp nowait root /usr/libexec/rshd rshd -L -#shell stream tcp6 nowait root /usr/libexec/rshd rshd -L -#login stream tcp nowait root /usr/libexec/rlogind rlogind -L -#login stream tcp6 nowait root /usr/libexec/rlogind rlogind -L -#exec stream tcp nowait root /usr/libexec/rexecd rexecd -#exec stream tcp6 nowait root /usr/libexec/rexecd rexecd -#finger stream tcp nowait nobody /usr/libexec/fingerd fingerd -lsmu -#finger stream tcp6 nowait nobody /usr/libexec/fingerd fingerd -lsmu -#ident stream tcp nowait nobody /usr/libexec/identd identd -l -o OTHER -e -N -#ident stream tcp6 nowait nobody /usr/libexec/identd identd -l -o OTHER -e -N -#tftp dgram udp wait root /usr/libexec/tftpd tftpd -l -s /tftpboot -#tftp dgram udp6 wait root /usr/libexec/tftpd tftpd -l -s /tftpboot -#comsat dgram udp wait root /usr/libexec/comsat comsat -#comsat dgram udp6 wait root /usr/libexec/comsat comsat -#ntalk dgram udp wait nobody:tty /usr/libexec/ntalkd ntalkd -#bootps dgram udp wait root /usr/sbin/bootpd bootpd -# -# Games -# -#hunt dgram udp wait nobody /usr/games/huntd huntd -# -# Internal services -# -#tcpmux stream tcp nowait root internal -#echo stream tcp nowait nobody internal -#echo stream tcp6 nowait nobody internal -#discard stream tcp nowait nobody internal -#discard stream tcp6 nowait nobody internal -#chargen stream tcp nowait nobody internal -#chargen stream tcp6 nowait nobody internal -#daytime stream tcp nowait nobody internal -#daytime stream tcp6 nowait nobody internal -#time stream tcp nowait nobody internal -#time stream tcp6 nowait nobody internal -#echo dgram udp wait nobody internal -#echo dgram udp6 wait nobody internal -#discard dgram udp wait nobody internal -#discard dgram udp6 wait nobody internal -#chargen dgram udp wait nobody internal -#chargen dgram udp6 wait nobody internal -#daytime dgram udp wait nobody internal -#daytime dgram udp6 wait nobody internal -#time dgram udp wait nobody internal -#time dgram udp6 wait nobody internal -#qotd stream tcp nowait nobody /usr/games/fortune fortune -#qotd stream tcp6 nowait nobody /usr/games/fortune fortune -# -# Kerberos authenticated services -# -#klogin stream tcp nowait root /usr/libexec/rlogind rlogind -k -#eklogin stream tcp nowait root /usr/libexec/rlogind rlogind -k -x -#kshell stream tcp nowait root /usr/libexec/rshd rshd -k -# -# Services run ONLY on the Kerberos server -# -#kerberos-adm stream tcp nowait root /usr/libexec/kadmind kadmind -#kerberos-adm stream tcp6 nowait root /usr/libexec/kadmind kadmind -#kpasswd dgram udp wait root /usr/libexec/kpasswdd kpasswdd -#kpasswd dgram udp6 wait root /usr/libexec/kpasswdd kpasswdd -# -# The hprop service is run on slave KDCs to receive the database from -# the master KDC. -#hprop stream tcp nowait root /usr/libexec/hpropd hpropd -#hprop stream tcp6 nowait root /usr/libexec/hpropd hpropd -# -# RPC based services -# -#rstatd/1-3 dgram rpc/udp wait:100 nobody:kmem /usr/libexec/rpc.rstatd rpc.rstatd -#rstatd/1-3 dgram rpc/udp6 wait:100 nobody:kmem /usr/libexec/rpc.rstatd rpc.rstatd -#rusersd/2-3 dgram rpc/udp wait:100 nobody /usr/libexec/rpc.rusersd rpc.rusersd -#rusersd/2-3 dgram rpc/udp6 wait:100 nobody /usr/libexec/rpc.rusersd rpc.rusersd -#walld/1 dgram rpc/udp wait nobody:tty /usr/libexec/rpc.rwalld rpc.rwalld -#sprayd/1 dgram rpc/udp wait nobody /usr/libexec/rpc.sprayd rpc.sprayd -#rquotad/1-2 dgram rpc/udp wait root /usr/libexec/rpc.rquotad rpc.rquotad diff --git a/etc/man.conf b/etc/man.conf deleted file mode 100644 index 95428409c..000000000 --- a/etc/man.conf +++ /dev/null @@ -1,74 +0,0 @@ - -# Sheer, raging paranoia... -_version BSD.2 - -# The whatis/apropos database. -# MINIX: Use the correct variable for the DB path -_whatdb /usr/man/whatis.db - -# Subdirectories for paths ending in '/', IN SEARCH ORDER. -_subdir cat1 man1 cat8 man8 cat6 man6 cat2 man2 cat3 cat3lua man3 man3lua cat4 man4 cat5 man5 cat7 man7 man3f cat9 cat9lua man9 man9lua catn mann catl manl - -# Files typed by suffix and their commands. -# Note the order, .Z must come after .[1-9].Z, or it will match first. -_suffix .0 -_build .0.Z /usr/bin/zcat %s -_build .0.bz2 /usr/bin/bzcat %s -_build .0.gz /usr/bin/zcat %s -_build .0.xz /usr/bin/xzcat %s -_build .[1-9][a-z]* /usr/bin/mandoc %s -_build .[1-9ln] /usr/bin/mandoc %s -_build .[1-9ln].Z /usr/bin/zcat %s | /usr/bin/mandoc -_build .[1-9ln].bz2 /usr/bin/bzcat %s | /usr/bin/mandoc -_build .[1-9ln].gz /usr/bin/zcat %s | /usr/bin/mandoc -_build .[1-9ln].xz /usr/bin/xzcat %s | /usr/bin/mandoc -_build .tbl /usr/bin/mandoc %s -_build .tbl.Z /usr/bin/zcat %s | /usr/bin/mandoc -_build .tbl.bz2 /usr/bin/bzcat %s | /usr/bin/mandoc -_build .tbl.gz /usr/bin/zcat %s | /usr/bin/mandoc -_build .tbl.xz /usr/bin/xzcat %s | /usr/bin/mandoc - -_build .me /usr/bin/nroff -msafer -me %s 2>/dev/null | cat -s - -_crunch .Z /usr/bin/compress -c > %s -_crunch .bz2 /usr/bin/bzip2 -c > %s -_crunch .gz /usr/bin/gzip -c > %s -_crunch .xz /usr/bin/xz -c > %s - -# Sections and their directories. -# All paths ending in '/' are the equivalent of entries specifying that -# directory with all of the subdirectories listed for the keyword _subdir. - -# default -# LSC, for MINIX: Add /usr/man ... -_default /usr/{,share,X11R7,X11R6,pkg,local}/man/ - -# Other sections that represent complete man subdirectories. -X11R7 /usr/X11R7/man/ -X11R6 /usr/X11R6/man/ -packages /usr/pkg/man/ -local /usr/local/man/ - -# Specific section/directory combinations. -1 {cat,man}1 -2 {cat,man}2 -3 {cat,man}3 -3F {cat,man}3f -3f {cat,man}3f -3lua {cat,man}3lua -3l {cat,man}3lua -4 {cat,man}4 -5 {cat,man}5 -6 {cat,man}6 -7 {cat,man}7 -8 {cat,man}8 -9 {cat,man}9 -9lua {cat,man}9lua -9l {cat,man}9lua -l {cat,man}l -n {cat,man}n - -# machine classes per machine -_i386 x86 -_amd64 x86 -_sparc64 sparc diff --git a/etc/master.passwd b/etc/master.passwd deleted file mode 100644 index 33b699d48..000000000 --- a/etc/master.passwd +++ /dev/null @@ -1,24 +0,0 @@ -root::0:0::0:0:Charlie &:/root:/bin/sh -toor:*:0:0::0:0:Bourne-again Superuser:/root:/bin/sh -daemon:*:1:1::0:0:The devil himself:/:/sbin/nologin -operator:*:2:5::0:0:System &:/usr/guest/operator:/sbin/nologin -bin:*:3:7::0:0:Binaries Commands and Source:/:/bin/sh -games:*:7:13::0:0:& pseudo-user:/usr/games:/sbin/nologin -postfix:*:12:12::0:0:& pseudo-user:/var/spool/postfix:/sbin/nologin -named:*:14:14::0:0:& pseudo-user:/var/chroot/named:/sbin/nologin -ntpd:*:15:15::0:0:& pseudo-user:/var/chroot/ntpd:/sbin/nologin -sshd:*:16:16::0:0:& pseudo-user:/var/chroot/sshd:/sbin/nologin -_pflogd:*:18:18::0:0:& pseudo-user:/var/chroot/pflogd:/sbin/nologin -_rwhod:*:19:19::0:0:& pseudo-user:/var/rwho:/sbin/nologin -_proxy:*:21:21::0:0:Proxy Services:/nonexistent:/sbin/nologin -_timedc:*:22:22::0:0:& pseudo-user:/nonexistent:/sbin/nologin -_sdpd:*:23:23::0:0:& pseudo-user:/nonexistent:/sbin/nologin -_httpd:*:24:24::0:0:& pseudo-user:/var/www:/sbin/nologin -_mdnsd:*:25:25::0:0:& pseudo-user:/nonexistent:/sbin/nologin -_tests:*:26:26::0:0:& pseudo-user:/nonexistent:/sbin/nologin -_tcpdump:*:27:27::0:0:& pseudo-user:/var/chroot/tcpdump:/sbin/nologin -_tss:*:28:28::0:0:& pseudo-user:/var/tpm:/sbin/nologin -_rtadvd:*:30:30::0:0:& pseudo-user:/var/chroot/rtadvd:/sbin/nologin -uucp:*:66:1::0:0:UNIX-to-UNIX Copy:/nonexistent:/sbin/nologin -service:*:999:0::0:0:System Services:/:/sbin/nologin -nobody:*:32767:39::0:0:Unprivileged user:/nonexistent:/sbin/nologin diff --git a/etc/mk.conf b/etc/mk.conf deleted file mode 100644 index e9d0c4a05..000000000 --- a/etc/mk.conf +++ /dev/null @@ -1,5 +0,0 @@ -MAKEVERBOSE?= 1 - -.if defined(BSD_PKG_MK) && "${PROG:U}" != "pkgin" -.error Please use bmake for pkgsrc instead of the base system make. -.endif diff --git a/etc/motd b/etc/motd deleted file mode 100755 index ebb0848fc..000000000 --- a/etc/motd +++ /dev/null @@ -1,9 +0,0 @@ -For post-installation usage tips such as installing binary -packages, please see: -https://wiki.minix3.org/doku.php?id=usersguide:postinstallation - -For more information on how to use MINIX 3, see the wiki: -https://wiki.minix3.org - -We'd like your feedback: https://minix3.org/community/ - diff --git a/etc/mtree/Makefile b/etc/mtree/Makefile deleted file mode 100644 index f7ec7613e..000000000 --- a/etc/mtree/Makefile +++ /dev/null @@ -1,128 +0,0 @@ -# $NetBSD: Makefile,v 1.30 2015/10/09 19:23:18 riz Exp $ - -.include - -.if ${MKX11} != "no" -EXTRA_DIST_FILES= ${.CURDIR}/NetBSD.dist.Xorg -.endif - -.if defined(__MINIX) -.if ${MKLIBSTDCXX} == "yes" -EXTRA_DIST_FILES+= ${.CURDIR}/Minix.libstdcxx -.endif - -.if ${MKLIBCXX} == "yes" -EXTRA_DIST_FILES+= ${.CURDIR}/Minix.libcxx -.endif - -.if ${MKBITCODE} == "yes" -EXTRA_DIST_FILES+= ${.CURDIR}/Minix.bitcode -.endif - -.if exists(NetBSD.dist.${MACHINE_ARCH}) -EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.${MACHINE_ARCH} -.endif -.endif # defined(__MINIX) - -# XXX these are only used by compat currently, but they could be used -# by something else; this may need to be fixed properly in the future. -.if defined(MKCOMPAT) && ${MKCOMPAT} != "no" -.include "${NETBSDSRCDIR}/compat/archdirs.mk" -.if exists(NetBSD.dist.${MACHINE_ARCH}) -EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.${MACHINE_ARCH} -.elif !empty(MACHINE_ARCH:Mearm*) -EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.earm -.endif -EXTRA_DIST_FILES+= NetBSD.dist.compat # autogenerated -.if defined(MKCOMPATX11) && ${MKCOMPATX11} != "no" && ${MKX11} != "no" -EXTRA_DIST_FILES+= NetBSD.dist.xcompat # autogenerated -.endif -.endif - -.if ${MKATF} != "no" -EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.tests -.if defined(MKCOMPATTESTS) && ${MKCOMPATTESTS} != "no" -EXTRA_DIST_FILES+= NetBSD.dist.tests.compat -.endif -.endif - -.if ${MKDTRACE} != "no" -EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.dtrace -.endif - -.if ${MKEXTSRC} != "no" -EXTRA_DIST_FILES+= ${.CURDIR}/NetBSD.dist.extsrc -.endif - -NetBSD.dist: NetBSD.dist.tmp - cmp -s NetBSD.dist.tmp NetBSD.dist || { \ - echo "Updating NetBSD.dist"; \ - mv NetBSD.dist.tmp NetBSD.dist; \ - } -NetBSD.dist.tmp:: ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} - ${TOOL_CAT} ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} > \ - ${.TARGET} - -NetBSD.dist.compat: ${.CURDIR}/NetBSD.dist.compat.in ${.CURDIR}/mkcompat.awk - ${MKCREATE} - ${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \ - -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \ - ${.CURDIR}/NetBSD.dist.compat.in \ - > ${.TARGET} - -NetBSD.dist.xcompat: ${.CURDIR}/NetBSD.dist.xcompat.in ${.CURDIR}/mkcompat.awk - ${MKCREATE} - ${TOOL_AWK} -f ${.CURDIR}/mkcompat.awk \ - -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} \ - ${.CURDIR}/NetBSD.dist.xcompat.in \ - > ${.TARGET} - -NetBSD.dist.tests.compat: ${.CURDIR}/NetBSD.dist.tests \ - ${.CURDIR}/mkcompattree.awk - ${MKCREATE} - ${TOOL_AWK} -f ${.CURDIR}/mkcompattree.awk \ - -v COMPATDIRS=${ARCHDIR_SUBDIR:T:Q} -v S="usr/tests" \ - ${.CURDIR}/NetBSD.dist.tests \ - > ${.TARGET} - -CONFIGFILES= NetBSD.dist special -FILESDIR= /etc/mtree - -# distrib-dirs -- -# Populate $DESTDIR with directories needed by NetBSD -# -.if ${MKUNPRIVED} == "no" -TOOL_MTREE.unpriv= -.else -TOOL_MTREE.unpriv= -W -.endif - -# postinstall(8) invokes this target to produce the right -# /etc/mtree/NetBSD.dist content without duplicating logic from -# the Makefile. -# -emit_dist_file: ${EXTRA_DIST_FILES} - @cat ${.CURDIR}/NetBSD.dist.base ${EXTRA_DIST_FILES} - -distrib-dirs: .PHONY check_DESTDIR NetBSD.dist -.if !defined(DISTRIBUTION_DONE) # { -# Create DESTDIR using HOST_INSTALL_DIR, not INSTALL_DIR, because -# INSTALL_DIR would want to write to the metalog, and it can't do that -# if the metalog is inside DESTDIR but DESTDIR doesn't yet exist. - ${HOST_INSTALL_DIR} -m 755 ${DESTDIR} -# Invoke mtree to create the directories listed in NetBSD.dist; -# then invoke mtree again to register those directories in the metalog. - ${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \ - -p ${DESTDIR}/ -U ${TOOL_MTREE.unpriv} -.if ${MKUNPRIVED} != "no" # { - ${TOOL_MTREE} -def ${.OBJDIR}/NetBSD.dist -N ${.CURDIR}/.. \ - -p ${DESTDIR}/ -C -k all | \ - ${TOOL_AWK} '/ optional/ {next} // {print}' | ${METALOG.add} -.endif # MKUNPRIVED # } -.endif # DISTRIBUTION_DONE # } - -CLEANFILES+= NetBSD.dist NetBSD.dist.tmp -CLEANFILES+= NetBSD.dist.compat -CLEANFILES+= NetBSD.dist.tests.compat - -.include diff --git a/etc/mtree/Minix.bitcode b/etc/mtree/Minix.bitcode deleted file mode 100644 index dd682ed20..000000000 --- a/etc/mtree/Minix.bitcode +++ /dev/null @@ -1,9 +0,0 @@ - /set type=dir uid=0 gid=0 mode=0755 - -./usr/lib/i18n/bc -./usr/tests/lib -./usr/tests/lib/csu -./usr/tests/lib/csu/bc -./usr/tests/lib/libc -./usr/tests/lib/libc/tls -./usr/tests/lib/libc/tls/bc diff --git a/etc/mtree/Minix.libcxx b/etc/mtree/Minix.libcxx deleted file mode 100644 index c9d3dedd4..000000000 --- a/etc/mtree/Minix.libcxx +++ /dev/null @@ -1,12 +0,0 @@ - /set type=dir uid=0 gid=0 mode=0755 - -./usr/include/c++ -./usr/include/c++/backward -./usr/include/c++/bits -./usr/include/c++/debug -./usr/include/c++/decimal -./usr/include/c++/ext -./usr/include/c++/experimental -./usr/include/c++/parallel -./usr/include/c++/tr1 -./usr/include/c++/tr1_impl diff --git a/etc/mtree/Minix.libstdcxx b/etc/mtree/Minix.libstdcxx deleted file mode 100644 index 46833ed4e..000000000 --- a/etc/mtree/Minix.libstdcxx +++ /dev/null @@ -1,40 +0,0 @@ - /set type=dir uid=0 gid=0 mode=0755 - -./usr/include/g++/backward -./usr/include/g++/bits -./usr/include/g++/debug -./usr/include/g++/decimal -./usr/include/g++/ext -./usr/include/g++/ext/pb_ds -./usr/include/g++/ext/pb_ds/detail -./usr/include/g++/ext/pb_ds/detail/bin_search_tree_ -./usr/include/g++/ext/pb_ds/detail/binary_heap_ -./usr/include/g++/ext/pb_ds/detail/binomial_heap_ -./usr/include/g++/ext/pb_ds/detail/binomial_heap_base_ -./usr/include/g++/ext/pb_ds/detail/branch_policy -./usr/include/g++/ext/pb_ds/detail/cc_hash_table_map_ -./usr/include/g++/ext/pb_ds/detail/eq_fn -./usr/include/g++/ext/pb_ds/detail/gp_hash_table_map_ -./usr/include/g++/ext/pb_ds/detail/hash_fn -./usr/include/g++/ext/pb_ds/detail/left_child_next_sibling_heap_ -./usr/include/g++/ext/pb_ds/detail/list_update_map_ -./usr/include/g++/ext/pb_ds/detail/list_update_policy -./usr/include/g++/ext/pb_ds/detail/ov_tree_map_ -./usr/include/g++/ext/pb_ds/detail/pairing_heap_ -./usr/include/g++/ext/pb_ds/detail/pat_trie_ -./usr/include/g++/ext/pb_ds/detail/rb_tree_map_ -./usr/include/g++/ext/pb_ds/detail/rc_binomial_heap_ -./usr/include/g++/ext/pb_ds/detail/resize_policy -./usr/include/g++/ext/pb_ds/detail/splay_tree_ -./usr/include/g++/ext/pb_ds/detail/thin_heap_ -./usr/include/g++/ext/pb_ds/detail/tree_policy -./usr/include/g++/ext/pb_ds/detail/trie_policy -./usr/include/g++/ext/pb_ds/detail/unordered_iterator -./usr/include/g++/parallel -./usr/include/g++/profile -./usr/include/g++/profile/impl -./usr/include/g++/tr1 -./usr/include/g++/tr1_impl -./usr/include/g++/tr2 -./usr/include/gcc-4.8 -./usr/include/objc diff --git a/etc/mtree/mkcompat.awk b/etc/mtree/mkcompat.awk deleted file mode 100644 index 635ab2528..000000000 --- a/etc/mtree/mkcompat.awk +++ /dev/null @@ -1,17 +0,0 @@ -BEGIN { n = 1 } -/^#/ { print } -{ - if (NF > 0 && substr($0, 1, 1) != "#") { - files[n++] = $0; - } - next; -} -END { - split(COMPATDIRS, dirs); - for (d in dirs) { - for (f = 1; f < n; f++) { - x=files[f]; sub("@ARCH_SUBDIR@", dirs[d], x); - print x; - } - } -} diff --git a/etc/mtree/mkcompattree.awk b/etc/mtree/mkcompattree.awk deleted file mode 100644 index e5367028c..000000000 --- a/etc/mtree/mkcompattree.awk +++ /dev/null @@ -1,32 +0,0 @@ -BEGIN { split(COMPATDIRS, dirs); n = 1; last_prefix = "" } -/^#/ { print; } -{ - if (NF > 0) { - pos = index($0, S); - if (pos == 0) { - print; - next; - } - prefix = substr($0, 1, pos) - if (prefix != last_prefix) { - for (d in dirs) { - for (f = 1; f < n; f++) { - x=files[f]; sub(S, S "/" dirs[d], x); - print x; - } - } - delete files; - n = 1; - last_prefix = prefix; - } - files[n++] = $0; - } - next -} -END { - for (d in dirs) { - for (f = 1; f < n; f++) { - x=files[f]; sub(S, S "/" dirs[d], x); print x; - } - } -} diff --git a/etc/mtree/special b/etc/mtree/special deleted file mode 100644 index a58a930ff..000000000 --- a/etc/mtree/special +++ /dev/null @@ -1,443 +0,0 @@ -# $NetBSD: special,v 1.152 2015/03/21 19:10:43 jmcneill Exp $ -# @(#)special 8.2 (Berkeley) 1/23/94 -# -# This file may be overwritten on upgrades. -# Put your custom specifications in /etc/mtree/special.local instead. -# See security.conf(5) for details. - -# -# /etc/security checks: -# - All of these are checked if $check_mtree is enabled. -# - Files with "nodiff" tags are highlighted if they change. -# - Files without "nodiff" or "exclude" tags are displayed -# with diff(1)s if $check_changelist is enabled. -# - -/set uname=root gname=wheel - -. type=dir mode=0755 - -./boot.cfg type=file mode=0644 optional - -./dev type=dir mode=0755 -./dev/drum type=char mode=0640 gname=kmem -./dev/fd type=dir mode=0755 ignore -./dev/kmem type=char mode=0640 gname=kmem -./dev/mem type=char mode=0640 gname=kmem - -./etc type=dir mode=0755 -./etc/Distfile type=file mode=0644 optional -./etc/amd type=dir mode=0755 optional -./etc/apm type=dir mode=0755 optional -./etc/bluetooth type=dir mode=0755 -./etc/bluetooth/btattach.conf type=file mode=0644 -./etc/bluetooth/btdevctl.conf type=file mode=0644 -./etc/bluetooth/hosts type=file mode=0644 -./etc/bluetooth/protocols type=file mode=0644 -./etc/bootparams type=file mode=0644 optional -./etc/bootptab type=file mode=0644 optional -./etc/ccd.conf type=file mode=0644 optional -./etc/cgd type=dir mode=0700 optional -./etc/cgd/cgd.conf type=file mode=0600 optional tags=nodiff -./etc/changelist type=file mode=0644 -./etc/crontab type=file mode=0644 optional -./etc/csh.cshrc type=file mode=0644 -./etc/csh.login type=file mode=0644 -./etc/csh.logout type=file mode=0644 -./etc/daily type=file mode=0644 -./etc/daily.conf type=file mode=0644 -./etc/daily.local type=file mode=0644 optional -./etc/defaultdomain type=file mode=0644 optional -./etc/defaults type=dir mode=0755 -./etc/defaults/daily.conf type=file mode=0444 -./etc/defaults/monthly.conf type=file mode=0444 -./etc/defaults/rc.conf type=file mode=0444 -./etc/defaults/security.conf type=file mode=0444 -./etc/defaults/weekly.conf type=file mode=0444 -./etc/dhclient-enter-hooks type=file mode=0644 optional -./etc/dhclient-exit-hooks type=file mode=0644 optional -./etc/dhclient.conf type=file mode=0644 optional -./etc/dhcpcd.conf type=file mode=0644 -./etc/dhcpcd.duid type=file mode=0644 optional -./etc/dhcpcd.hook type=file mode=0644 optional -./etc/dhcpd.conf type=file mode=0644 optional -./etc/disktab type=file mode=0644 -./etc/dm.conf type=file mode=0644 -./etc/dumpdates type=file mode=0664 gname=operator optional tags=exclude -./etc/envsys.conf type=file mode=0644 optional -./etc/ethers type=file mode=0644 optional -./etc/exports type=file mode=0644 optional -./etc/floppytab type=file mode=0644 -./etc/fstab type=file mode=0644 -./etc/ftpchroot type=file mode=0644 -./etc/ftpd.conf type=file mode=0644 optional -./etc/ftpusers type=file mode=0644 -./etc/ftpwelcome type=file mode=0644 optional -./etc/gateways type=file mode=0644 optional -./etc/gettytab type=file mode=0644 -./etc/gpio.conf type=file mode=0644 -./etc/group type=file mode=0644 -./etc/hesiod.conf type=file mode=0644 optional -./etc/hosts type=file mode=0644 -./etc/hosts.allow type=file mode=0644 optional -./etc/hosts.deny type=file mode=0644 optional -./etc/hosts.equiv type=file mode=0600 optional tags=nodiff -./etc/hosts.lpd type=file mode=0644 optional -./etc/ifaliases type=file mode=0644 optional -./etc/inetd.conf type=file mode=0644 -./etc/ipf.conf type=file mode=0644 optional -./etc/ipf6.conf type=file mode=0644 optional -./etc/ipnat.conf type=file mode=0644 optional -./etc/ipsec.conf type=file mode=0600 optional tags=nodiff -./etc/iscsi type=dir mode=0755 -./etc/iscsi/auths type=file mode=0600 tags=nodiff -./etc/iscsi/targets type=file mode=0644 -./etc/ld.so.conf type=file mode=0644 optional -./etc/localtime type=link mode=0755 -./etc/locate.conf type=file mode=0644 optional -./etc/login.conf type=file mode=0644 optional -./etc/mail type=dir mode=0755 -./etc/mail/aliases type=file mode=0644 -./etc/mail/aliases.db type=file mode=0644 optional tags=exclude -./etc/mail.rc type=file mode=0644 -./etc/mailer.conf type=file mode=0644 -./etc/man.conf type=file mode=0644 -./etc/master.passwd type=file mode=0600 tags=nodiff -./etc/mk.conf type=file mode=0644 optional -./etc/moduli type=file mode=0444 -./etc/monthly type=file mode=0644 -./etc/monthly.conf type=file mode=0644 -./etc/monthly.local type=file mode=0644 optional -./etc/mrouted.conf type=file mode=0644 -./etc/mtree type=dir mode=0755 -./etc/mtree/special type=file mode=0444 -./etc/mtree/special.local type=file mode=0644 optional -./etc/mygate type=file mode=0644 optional -./etc/mygate6 type=file mode=0644 optional -./etc/myname type=file mode=0644 optional -./etc/named.conf type=file mode=0644 optional -./etc/namedb type=dir mode=0755 -./etc/netconfig type=file mode=0644 -./etc/netgroup type=file mode=0644 optional -./etc/netstart.local type=file mode=0644 optional -./etc/networks type=file mode=0644 -./etc/newsyslog.conf type=file mode=0644 -./etc/nsswitch.conf type=file mode=0644 -./etc/ntp.conf type=file mode=0644 optional -./etc/pam.conf type=file mode=0644 optional -./etc/pam.d type=dir mode=0755 -./etc/pam.d/display_manager type=file mode=0644 -./etc/pam.d/ftpd type=file mode=0644 -./etc/pam.d/gdm type=file mode=0644 -./etc/pam.d/imap type=file mode=0644 -./etc/pam.d/kde type=file mode=0644 -./etc/pam.d/login type=file mode=0644 -./etc/pam.d/other type=file mode=0644 -./etc/pam.d/passwd type=file mode=0644 -./etc/pam.d/pop3 type=file mode=0644 -./etc/pam.d/ppp type=file mode=0644 -./etc/pam.d/rexecd type=file mode=0644 -./etc/pam.d/rsh type=file mode=0644 -./etc/pam.d/sshd type=file mode=0644 -./etc/pam.d/su type=file mode=0644 -./etc/pam.d/system type=file mode=0644 -./etc/pam.d/telnetd type=file mode=0644 -./etc/pam.d/xdm type=file mode=0644 -./etc/pam.d/xserver type=file mode=0644 -./etc/passwd type=file mode=0644 -./etc/passwd.conf type=file mode=0644 optional -./etc/pf.conf type=file mode=0644 -./etc/pf.os type=file mode=0444 -./etc/phones type=file mode=0644 -./etc/postfix type=dir mode=0755 optional -./etc/postfix/main.cf type=file mode=0644 optional -./etc/postfix/master.cf type=file mode=0644 optional -./etc/powerd type=dir mode=0755 optional -./etc/powerd/scripts type=dir mode=0755 optional -./etc/powerd/scripts/acadapter type=file mode=0555 optional -./etc/powerd/scripts/hotkey_button type=file mode=0555 optional -./etc/powerd/scripts/lid_switch type=file mode=0555 optional -./etc/powerd/scripts/power_button type=file mode=0555 optional -./etc/powerd/scripts/reset_button type=file mode=0555 optional -./etc/powerd/scripts/sensor_battery type=file mode=0555 optional -./etc/powerd/scripts/sensor_drive type=file mode=0555 optional -./etc/powerd/scripts/sensor_fan type=file mode=0555 optional -./etc/powerd/scripts/sensor_indicator type=file mode=0555 optional -./etc/powerd/scripts/sensor_power type=file mode=0555 optional -./etc/powerd/scripts/sensor_resistance type=file mode=0555 optional -./etc/powerd/scripts/sensor_temperature type=file mode=0555 optional -./etc/powerd/scripts/sensor_voltage type=file mode=0555 optional -./etc/powerd/scripts/sleep_button type=file mode=0555 optional -./etc/ppp type=dir mode=0755 optional -./etc/ppp/options type=file mode=0644 optional -./etc/printcap type=file mode=0644 -./etc/profile type=file mode=0644 -./etc/protocols type=file mode=0644 -./etc/racoon type=dir mode=0755 optional -./etc/racoon/racoon.conf type=file mode=0644 optional -./etc/racoon/psk.txt type=file mode=0600 optional tags=nodiff -./etc/rbootd.conf type=file mode=0644 optional -./etc/rc type=file mode=0644 -./etc/rc.conf type=file mode=0644 -./etc/rc.d type=dir mode=0755 -./etc/rc.d/DAEMON type=file mode=0555 -./etc/rc.d/DISKS type=file mode=0555 -./etc/rc.d/LOGIN type=file mode=0555 -./etc/rc.d/NETWORKING type=file mode=0555 -./etc/rc.d/SERVERS type=file mode=0555 -./etc/rc.d/accounting type=file mode=0555 -./etc/rc.d/altqd type=file mode=0555 -./etc/rc.d/amd type=file mode=0555 -./etc/rc.d/apmd type=file mode=0555 -./etc/rc.d/bluetooth type=file mode=0555 -./etc/rc.d/bootconf.sh type=file mode=0555 -./etc/rc.d/bootparams type=file mode=0555 -./etc/rc.d/ccd type=file mode=0555 -./etc/rc.d/cgd type=file mode=0555 -./etc/rc.d/cleartmp type=file mode=0555 -./etc/rc.d/cron type=file mode=0555 -./etc/rc.d/devpubd type=file mode=0555 -./etc/rc.d/dhclient type=file mode=0555 -./etc/rc.d/dhcpcd type=file mode=0555 -./etc/rc.d/dhcpd type=file mode=0555 -./etc/rc.d/dhcrelay type=file mode=0555 -./etc/rc.d/dmesg type=file mode=0555 -./etc/rc.d/downinterfaces type=file mode=0555 -./etc/rc.d/envsys type=file mode=0555 -./etc/rc.d/fsck type=file mode=0555 -./etc/rc.d/fsck_root type=file mode=0555 -./etc/rc.d/ftp_proxy type=file mode=0555 -./etc/rc.d/ftpd type=file mode=0555 -./etc/rc.d/gpio type=file mode=0555 -./etc/rc.d/hostapd type=file mode=0555 -./etc/rc.d/httpd type=file mode=0555 -./etc/rc.d/identd type=file mode=0555 -./etc/rc.d/ifwatchd type=file mode=0555 -./etc/rc.d/inetd type=file mode=0555 -./etc/rc.d/ipfilter type=file mode=0555 -./etc/rc.d/ipfs type=file mode=0555 -./etc/rc.d/ipmon type=file mode=0555 -./etc/rc.d/ipnat type=file mode=0555 -./etc/rc.d/ipsec type=file mode=0555 -./etc/rc.d/irdaattach type=file mode=0555 -./etc/rc.d/iscsi_target type=file mode=0555 -./etc/rc.d/iscsid type=file mode=0555 -./etc/rc.d/isdnd type=file mode=0555 -./etc/rc.d/isibootd type=file mode=0555 -./etc/rc.d/kdc type=file mode=0555 -./etc/rc.d/ldconfig type=file mode=0555 -./etc/rc.d/ldpd type=file mode=0555 -./etc/rc.d/local type=file mode=0555 -./etc/rc.d/lpd type=file mode=0555 -./etc/rc.d/lvm type=file mode=0555 -./etc/rc.d/makemandb type=file mode=0555 -./etc/rc.d/mdnsd type=file mode=0555 -./etc/rc.d/mixerctl type=file mode=0555 -./etc/rc.d/modules type=file mode=0555 -./etc/rc.d/mopd type=file mode=0555 -./etc/rc.d/motd type=file mode=0555 -./etc/rc.d/mountall type=file mode=0555 -./etc/rc.d/mountcritlocal type=file mode=0555 -./etc/rc.d/mountcritremote type=file mode=0555 -./etc/rc.d/mountd type=file mode=0555 -./etc/rc.d/moused type=file mode=0555 -./etc/rc.d/mrouted type=file mode=0555 -./etc/rc.d/named type=file mode=0555 -./etc/rc.d/ndbootd type=file mode=0555 -./etc/rc.d/network type=file mode=0555 -./etc/rc.d/newsyslog type=file mode=0555 -./etc/rc.d/nfsd type=file mode=0555 -./etc/rc.d/nfslocking type=file mode=0555 -./etc/rc.d/npf type=file mode=0555 -./etc/rc.d/ntpd type=file mode=0555 -./etc/rc.d/ntpdate type=file mode=0555 -./etc/rc.d/perusertmp type=file mode=0555 -./etc/rc.d/pf type=file mode=0555 -./etc/rc.d/pf_boot type=file mode=0555 -./etc/rc.d/pflogd type=file mode=0555 -./etc/rc.d/postfix type=file mode=0555 -./etc/rc.d/powerd type=file mode=0555 -./etc/rc.d/ppp type=file mode=0555 -./etc/rc.d/pwcheck type=file mode=0555 -./etc/rc.d/quota type=file mode=0555 -./etc/rc.d/racoon type=file mode=0555 -./etc/rc.d/raidframe type=file mode=0555 -./etc/rc.d/raidframeparity type=file mode=0555 -./etc/rc.d/random_seed type=file mode=0555 -./etc/rc.d/rarpd type=file mode=0555 -./etc/rc.d/rbootd type=file mode=0555 -./etc/rc.d/rndctl type=file mode=0555 -./etc/rc.d/root type=file mode=0555 -./etc/rc.d/route6d type=file mode=0555 -./etc/rc.d/routed type=file mode=0555 -./etc/rc.d/rpcbind type=file mode=0555 -./etc/rc.d/rtadvd type=file mode=0555 -./etc/saslc.d type=dir mode=0755 -./etc/saslc.d/postfix type=dir mode=0755 -./etc/saslc.d/postfix/mech type=dir mode=0755 -./etc/saslc.d/saslc type=dir mode=0755 -./etc/saslc.d/saslc/mech type=dir mode=0755 -./etc/rc.d/rtclocaltime type=file mode=0555 -./etc/rc.d/rwho type=file mode=0555 -./etc/rc.d/savecore type=file mode=0555 -./etc/rc.d/screenblank type=file mode=0555 -./etc/rc.d/securelevel type=file mode=0555 -./etc/rc.d/sshd type=file mode=0555 -./etc/rc.d/staticroute type=file mode=0555 -./etc/rc.d/swap1 type=file mode=0555 -./etc/rc.d/swap2 type=file mode=0555 -./etc/rc.d/sysctl type=file mode=0555 -./etc/rc.d/sysdb type=file mode=0555 -./etc/rc.d/syslogd type=file mode=0555 -./etc/rc.d/timed type=file mode=0555 -./etc/rc.d/tpctl type=file mode=0555 -./etc/rc.d/ttys type=file mode=0555 -./etc/rc.d/veriexec type=file mode=0555 -./etc/rc.d/virecover type=file mode=0555 -./etc/rc.d/wdogctl type=file mode=0555 -./etc/rc.d/wpa_supplicant type=file mode=0555 -./etc/rc.d/wscons type=file mode=0555 -./etc/rc.d/wsmoused type=file mode=0555 -./etc/rc.d/xdm type=file mode=0555 optional -./etc/rc.d/xfs type=file mode=0555 optional -./etc/rc.d/ypbind type=file mode=0555 -./etc/rc.d/yppasswdd type=file mode=0555 -./etc/rc.d/ypserv type=file mode=0555 -./etc/rc.local type=file mode=0644 optional -./etc/rc.shutdown type=file mode=0644 -./etc/rc.shutdown.local type=file mode=0644 optional -./etc/rc.subr type=file mode=0644 -./etc/remote type=file mode=0644 -./etc/resolv.conf type=file mode=0644 optional -./etc/rpc type=file mode=0644 -./etc/rtadvd.conf type=file mode=0644 optional -./etc/security type=file mode=0644 -./etc/security.conf type=file mode=0644 -./etc/security.local type=file mode=0644 optional -./etc/services type=file mode=0644 -./etc/shells type=file mode=0644 -./etc/shosts.equiv type=file mode=0600 optional tags=nodiff -./etc/skel type=dir mode=0755 optional -./etc/spwd.db type=file mode=0600 tags=exclude tags=nodiff -./etc/ssh type=dir mode=0755 optional -./etc/ssh/ssh_config type=file mode=0644 optional -./etc/ssh/ssh_host_dsa_key type=file mode=0600 optional tags=nodiff -./etc/ssh/ssh_host_dsa_key.pub type=file mode=0644 optional -./etc/ssh/ssh_host_ecdsa_key type=file mode=0600 optional tags=nodiff -./etc/ssh/ssh_host_ecdsa_key.pub type=file mode=0644 optional -./etc/ssh/ssh_host_key type=file mode=0600 optional tags=nodiff tags=nodiff -./etc/ssh/ssh_host_key.pub type=file mode=0644 optional -./etc/ssh/ssh_host_rsa_key type=file mode=0600 optional tags=nodiff -./etc/ssh/ssh_host_rsa_key.pub type=file mode=0644 optional -./etc/ssh/ssh_known_hosts type=file mode=0644 optional -./etc/ssh/ssh_known_hosts2 type=file mode=0644 optional -./etc/ssh/sshd_config type=file mode=0644 optional -./etc/sysctl.conf type=file mode=0644 -./etc/syslog.conf type=file mode=0644 -./etc/ttyaction type=file mode=0644 optional -./etc/ttys type=file mode=0644 -./etc/usermgmt.conf type=file mode=0644 optional -./etc/weekly type=file mode=0644 -./etc/weekly.conf type=file mode=0644 -./etc/weekly.local type=file mode=0644 optional -./etc/wscons.conf type=file mode=0644 -./etc/zfs type=dir mode=0755 - -./private type=dir mode=0755 optional -./private/tmp type=dir mode=0111 optional ignore - -./root type=dir mode=0755 -./root/.cshrc type=file mode=0644 -./root/.klogin type=file mode=0600 optional tags=nodiff -./root/.login type=file mode=0644 -./root/.profile type=file mode=0644 -./root/.rhosts type=file mode=0600 optional tags=nodiff -./root/.shosts type=file mode=0600 optional tags=nodiff -./root/.ssh type=dir mode=0700 optional -./root/.ssh/authorized_keys type=file mode=0600 optional tags=nodiff -./root/.ssh/authorized_keys2 type=file mode=0600 optional tags=nodiff -./root/.ssh/config type=file mode=0644 optional -./root/.ssh/id_dsa type=file mode=0600 optional tags=nodiff -./root/.ssh/id_dsa.pub type=file mode=0644 optional -./root/.ssh/id_rsa type=file mode=0600 optional tags=nodiff -./root/.ssh/id_rsa.pub type=file mode=0644 optional -./root/.ssh/identity type=file mode=0600 optional tags=nodiff -./root/.ssh/identity.pub type=file mode=0644 optional -./root/.ssh/known_hosts type=file mode=0644 optional -./root/.ssh/known_hosts2 type=file mode=0644 optional - -./sbin type=dir mode=0755 ignore - -./usr type=dir mode=0755 -./usr/bin type=dir mode=0755 ignore -./usr/games type=dir mode=0755 optional -./usr/games/hide type=dir mode=0750 gname=games ignore optional -./usr/include type=dir mode=0755 ignore -./usr/lib type=dir mode=0755 ignore -./usr/libdata type=dir mode=0755 ignore -./usr/libexec type=dir mode=0755 ignore -./usr/pkg type=dir mode=0755 ignore optional -./usr/sbin type=dir mode=0755 ignore -./usr/share type=dir mode=0755 ignore - -./var type=dir mode=0755 -./var/account type=dir mode=0755 -./var/account/acct type=file mode=0644 optional tags=exclude -./var/at type=dir mode=0755 ignore -./var/backups type=dir mode=0755 ignore -./var/chroot type=dir mode=0755 -./var/chroot/ftp-proxy type=dir mode=0755 -./var/chroot/named type=dir mode=0755 -./var/chroot/named/dev type=dir mode=0755 -./var/chroot/named/etc type=dir mode=0755 -./var/chroot/named/etc/namedb type=dir mode=0755 -./var/chroot/named/etc/namedb/cache type=dir mode=0775 uname=named gname=named -./var/chroot/named/etc/namedb/keys type=dir mode=0775 uname=named gname=named -./var/chroot/named/usr type=dir mode=0755 -./var/chroot/named/usr/libexec type=dir mode=0755 -./var/chroot/named/var type=dir mode=0755 -./var/chroot/named/var/run type=dir mode=0775 gname=named -./var/chroot/named/var/tmp type=dir mode=01775 gname=named -./var/chroot/ntpd type=dir mode=0755 -./var/chroot/ntpd/dev type=dir mode=0755 -./var/chroot/ntpd/var type=dir mode=0755 -./var/chroot/ntpd/var/db type=dir mode=0775 gname=ntpd -./var/chroot/ntpd/var/run type=dir mode=0775 gname=ntpd -./var/chroot/pflogd type=dir mode=0755 -./var/chroot/rtadvd type=dir mode=0755 -./var/chroot/rtadvd/etc type=dir mode=0755 -./var/chroot/rtadvd/var type=dir mode=0755 -./var/chroot/rtadvd/var/run type=dir mode=0775 gname=_rtadvd -./var/chroot/sshd type=dir mode=0755 -./var/chroot/tcpdump type=dir mode=0755 -./var/chroot/tftp-proxy type=dir mode=0755 -./var/cron type=dir mode=0755 -./var/cron/tabs type=dir mode=0700 -./var/cron/tabs/root type=file mode=0600 tags=nodiff -./var/db type=dir mode=0755 -./var/log type=dir mode=0755 -./var/log/authlog type=file mode=0600 optional tags=exclude -./var/log/lastlog type=file mode=0664 gname=utmp tags=exclude -./var/log/lastlogx type=file mode=0664 gname=utmp tags=exclude -./var/log/wtmp type=file mode=0664 gname=utmp tags=exclude -./var/log/wtmpx type=file mode=0664 gname=utmp tags=exclude -./var/mail type=dir mode=1777 ignore -./var/preserve type=dir mode=0755 ignore -./var/run type=dir mode=0755 -./var/run/mdnsd type=dir mode=0755 gname=_mdnsd uname=_mdnsd optional -./var/run/utmp type=file mode=0664 gname=utmp tags=exclude -./var/run/utmpx type=file mode=0664 gname=utmp tags=exclude -./var/spool type=dir mode=0755 -./var/spool/ftp type=dir mode=0755 optional -./var/spool/ftp/bin type=dir mode=0755 optional -./var/spool/ftp/bin/ls type=file mode=0555 optional -./var/spool/ftp/etc type=dir mode=0755 optional -./var/spool/ftp/etc/group type=file mode=0644 optional -./var/spool/ftp/etc/localtime type=file mode=0644 optional -./var/spool/ftp/etc/master.passwd type=file mode=0600 optional tags=nodiff -./var/spool/ftp/etc/passwd type=file mode=0644 optional -./var/spool/ftp/hidden type=dir mode=0111 ignore optional -./var/spool/ftp/pub type=dir mode=0775 ignore optional -./var/spool/output type=dir mode=0755 ignore -./var/yp type=dir mode=0755 -./var/yp/Makefile type=file mode=0644 optional diff --git a/etc/named.conf b/etc/named.conf deleted file mode 100644 index f9d1e4e8f..000000000 --- a/etc/named.conf +++ /dev/null @@ -1,77 +0,0 @@ - -# boot file for secondary name server -# Note that there should be one primary entry for each SOA record. -# If you cannot get DNSSEC to work, and you see the following message: -# DNSKEY: verify failed due to bad signature (keyid=19036): \ -# RRSIG validity period has not begun -# Fix your clock. You can comment out the dnssec entries temporarily to -# get to an ntp server. - -options { - directory "/etc/namedb"; - dnssec-enable yes; - dnssec-validation auto; - dnssec-lookaside auto; - managed-keys-directory "keys"; - bindkeys-file "bind.keys"; - allow-recursion { localhost; localnets; }; - - # - # This forces all queries to come from port 53; might be - # needed for firewall traversals but should be avoided if - # at all possible because of the risk of spoofing attacks. - # - #query-source address * port 53; -}; - -zone "." { - type hint; - file "root.cache"; -}; - -zone "localhost" { - type master; - file "localhost"; -}; - -zone "127.IN-ADDR.ARPA" { - type master; - file "127"; -}; - -zone "1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa" { - type master; - file "loopback.v6"; -}; - -# example secondary server config: -# -# zone "Berkeley.EDU" { -# type slave; -# file "berkeley.edu.cache"; -# masters { -# 128.32.130.11; -# 128.32.133.1; -# }; -# }; - -# zone "32.128.IN-ADDR.ARPA" { -# type slave; -# file "128.32.cache"; -# masters { -# 128.32.130.11; -# 128.32.133.1; -# }; -# }; - -# example primary server config: -# -# zone "Berkeley.EDU" { -# type master; -# file "berkeley.edu"; -# }; - -# zone "32.128.IN-ADDR.ARPA" { -# type master; -# file "128.32"; -# }; diff --git a/etc/namedb/127 b/etc/namedb/127 deleted file mode 100644 index 58e65924e..000000000 --- a/etc/namedb/127 +++ /dev/null @@ -1,11 +0,0 @@ -; $NetBSD: 127,v 1.4 2001/01/28 06:59:31 itojun Exp $ - -$TTL 3600 -@ IN SOA netbsd.org. hostmaster.netbsd.org. ( - 1999012100 ; Serial - 3600 ; Refresh - 300 ; Retry - 3600000 ; Expire - 3600 ) ; Minimum - IN NS localhost. -1.0.0 IN PTR localhost. diff --git a/etc/namedb/Makefile b/etc/namedb/Makefile deleted file mode 100644 index 21484477b..000000000 --- a/etc/namedb/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2013/04/25 17:02:29 christos Exp $ - -CONFIGFILES= 127 root.cache localhost loopback.v6 bind.keys -FILESDIR= /etc/namedb -FILESMODE= 644 - -.include diff --git a/etc/namedb/bind.keys b/etc/namedb/bind.keys deleted file mode 100644 index 20adfb9c8..000000000 --- a/etc/namedb/bind.keys +++ /dev/null @@ -1,47 +0,0 @@ -/* $NetBSD: bind.keys,v 1.1 2013/04/25 17:02:29 christos Exp $ */ -/* Id: bind.keys,v 1.7 2011-01-03 23:45:07 each Exp */ -# The bind.keys file is used to override the built-in DNSSEC trust anchors -# which are included as part of BIND 9. As of the current release, the only -# trust anchors it contains are those for the DNS root zone ("."), and for -# the ISC DNSSEC Lookaside Validation zone ("dlv.isc.org"). Trust anchors -# for any other zones MUST be configured elsewhere; if they are configured -# here, they will not be recognized or used by named. -# -# The built-in trust anchors are provided for convenience of configuration. -# They are not activated within named.conf unless specifically switched on. -# To use the built-in root key, set "dnssec-validation auto;" in -# named.conf options. To use the built-in DLV key, set -# "dnssec-lookaside auto;". Without these options being set, -# the keys in this file are ignored. -# -# This file is NOT expected to be user-configured. -# -# These keys are current as of January 2011. If any key fails to -# initialize correctly, it may have expired. In that event you should -# replace this file with a current version. The latest version of -# bind.keys can always be obtained from ISC at https://www.isc.org/bind-keys. - -managed-keys { - # ISC DLV: See https://www.isc.org/solutions/dlv for details. - # NOTE: This key is activated by setting "dnssec-lookaside auto;" - # in named.conf. - dlv.isc.org. initial-key 257 3 5 "BEAAAAPHMu/5onzrEE7z1egmhg/WPO0+juoZrW3euWEn4MxDCE1+lLy2 - brhQv5rN32RKtMzX6Mj70jdzeND4XknW58dnJNPCxn8+jAGl2FZLK8t+ - 1uq4W+nnA3qO2+DL+k6BD4mewMLbIYFwe0PG73Te9fZ2kJb56dhgMde5 - ymX4BI/oQ+cAK50/xvJv00Frf8kw6ucMTwFlgPe+jnGxPPEmHAte/URk - Y62ZfkLoBAADLHQ9IrS2tryAe7mbBZVcOwIeU/Rw/mRx/vwwMCTgNboM - QKtUdvNXDrYJDSHZws3xiRXF1Rf+al9UmZfSav/4NWLKjHzpT59k/VSt - TDN0YUuWrBNh"; - - # ROOT KEY: See https://data.iana.org/root-anchors/root-anchors.xml - # for current trust anchor information. - # NOTE: This key is activated by setting "dnssec-validation auto;" - # in named.conf. - . initial-key 257 3 8 "AwEAAagAIKlVZrpC6Ia7gEzahOR+9W29euxhJhVVLOyQbSEW0O8gcCjF - FVQUTf6v58fLjwBd0YI0EzrAcQqBGCzh/RStIoO8g0NfnfL2MTJRkxoX - bfDaUeVPQuYEhg37NZWAJQ9VnMVDxP/VHL496M/QZxkjf5/Efucp2gaD - X6RS6CXpoY68LsvPVjR0ZSwzz1apAzvN9dlzEheX7ICJBBtuA6G3LQpz - W5hOA2hzCTMjJPJ8LbqF6dsV6DoBQzgul0sGIcGOYl7OyQdXfZ57relS - Qageu+ipAdTTJ25AsRTAoub8ONGcLmqrAmRLKBP1dfwhYB4N7knNnulq - QxA+Uk1ihz0="; -}; diff --git a/etc/namedb/localhost b/etc/namedb/localhost deleted file mode 100644 index 1b5c07153..000000000 --- a/etc/namedb/localhost +++ /dev/null @@ -1,12 +0,0 @@ -; $NetBSD: localhost,v 1.2 2000/05/19 13:07:37 sommerfeld Exp $ - -$TTL 3600 -@ IN SOA netbsd.org. hostmaster.netbsd.org. ( - 1999012100 ; Serial - 3600 ; Refresh - 300 ; Retry - 3600000 ; Expire - 3600 ) ; Minimum - IN NS localhost. -localhost. IN A 127.0.0.1 - IN AAAA ::1 diff --git a/etc/namedb/loopback.v6 b/etc/namedb/loopback.v6 deleted file mode 100644 index 43123a072..000000000 --- a/etc/namedb/loopback.v6 +++ /dev/null @@ -1,11 +0,0 @@ -; $NetBSD: loopback.v6,v 1.3 2002/01/22 03:27:24 itojun Exp $ - -$TTL 3600 -@ IN SOA netbsd.org. hostmaster.netbsd.org. ( - 1999012100 ; Serial - 3600 ; Refresh - 300 ; Retry - 3600000 ; Expire - 3600 ) ; Minimum - IN NS localhost. - IN PTR localhost. diff --git a/etc/namedb/root.cache b/etc/namedb/root.cache deleted file mode 100644 index 6ba3f157a..000000000 --- a/etc/namedb/root.cache +++ /dev/null @@ -1,91 +0,0 @@ -; $NetBSD: root.cache,v 1.18 2014/07/01 03:33:28 taca Exp $ -; This file holds the information on root name servers needed to -; initialize cache of Internet domain name servers -; (e.g. reference this file in the "cache . " -; configuration file of BIND domain name servers). -; -; This file is made available by InterNIC -; under anonymous FTP as -; file /domain/named.cache -; on server FTP.INTERNIC.NET -; -OR- RS.INTERNIC.NET -; -; last update: June 2, 2014 -; related version of root zone: 2014060201 -; -; formerly NS.INTERNIC.NET -; -. 3600000 IN NS A.ROOT-SERVERS.NET. -A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4 -A.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:BA3E::2:30 -; -; FORMERLY NS1.ISI.EDU -; -. 3600000 NS B.ROOT-SERVERS.NET. -B.ROOT-SERVERS.NET. 3600000 A 192.228.79.201 -B.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:84::B -; -; FORMERLY C.PSI.NET -; -. 3600000 NS C.ROOT-SERVERS.NET. -C.ROOT-SERVERS.NET. 3600000 A 192.33.4.12 -C.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2::C -; -; FORMERLY TERP.UMD.EDU -; -. 3600000 NS D.ROOT-SERVERS.NET. -D.ROOT-SERVERS.NET. 3600000 A 199.7.91.13 -D.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2D::D -; -; FORMERLY NS.NASA.GOV -; -. 3600000 NS E.ROOT-SERVERS.NET. -E.ROOT-SERVERS.NET. 3600000 A 192.203.230.10 -; -; FORMERLY NS.ISC.ORG -; -. 3600000 NS F.ROOT-SERVERS.NET. -F.ROOT-SERVERS.NET. 3600000 A 192.5.5.241 -F.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:2F::F -; -; FORMERLY NS.NIC.DDN.MIL -; -. 3600000 NS G.ROOT-SERVERS.NET. -G.ROOT-SERVERS.NET. 3600000 A 192.112.36.4 -; -; FORMERLY AOS.ARL.ARMY.MIL -; -. 3600000 NS H.ROOT-SERVERS.NET. -H.ROOT-SERVERS.NET. 3600000 A 128.63.2.53 -H.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:1::803F:235 -; -; FORMERLY NIC.NORDU.NET -; -. 3600000 NS I.ROOT-SERVERS.NET. -I.ROOT-SERVERS.NET. 3600000 A 192.36.148.17 -I.ROOT-SERVERS.NET. 3600000 AAAA 2001:7FE::53 -; -; OPERATED BY VERISIGN, INC. -; -. 3600000 NS J.ROOT-SERVERS.NET. -J.ROOT-SERVERS.NET. 3600000 A 192.58.128.30 -J.ROOT-SERVERS.NET. 3600000 AAAA 2001:503:C27::2:30 -; -; OPERATED BY RIPE NCC -; -. 3600000 NS K.ROOT-SERVERS.NET. -K.ROOT-SERVERS.NET. 3600000 A 193.0.14.129 -K.ROOT-SERVERS.NET. 3600000 AAAA 2001:7FD::1 -; -; OPERATED BY ICANN -; -. 3600000 NS L.ROOT-SERVERS.NET. -L.ROOT-SERVERS.NET. 3600000 A 199.7.83.42 -L.ROOT-SERVERS.NET. 3600000 AAAA 2001:500:3::42 -; -; OPERATED BY WIDE -; -. 3600000 NS M.ROOT-SERVERS.NET. -M.ROOT-SERVERS.NET. 3600000 A 202.12.27.33 -M.ROOT-SERVERS.NET. 3600000 AAAA 2001:DC3::35 -; End of File diff --git a/etc/newfstab.sh b/etc/newfstab.sh deleted file mode 100644 index c925fdf4e..000000000 --- a/etc/newfstab.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -set -e - -if [ $# -ne 1 ] -then echo "Usage: $0 >newfstab" - exit 1 -fi - -fstab="$1" -. $fstab - -if [ -z "$usr" -o -z "$root" ] -then echo "\$root and \$usr not set in $fstab" - exit 1 -fi - -echo "$root / mfs rw 0 2" -echo "$usr /usr mfs rw 0 1" -if [ -n "$home" ] -then echo "$home /home mfs rw 0 1" -fi diff --git a/etc/nsswitch.conf b/etc/nsswitch.conf deleted file mode 100644 index 152fbccdc..000000000 --- a/etc/nsswitch.conf +++ /dev/null @@ -1,29 +0,0 @@ -# $NetBSD: nsswitch.conf,v 1.6 2009/10/25 00:17:06 tsarna Exp $ -# -# nsswitch.conf(5) - -# name service switch configuration file -# - - -# These are the defaults in libc -# -group: compat -group_compat: nis -hosts: files dns -netgroup: files [notfound=return] nis -networks: files -passwd: compat -passwd_compat: nis -shells: files - - -# List of supported sources for each database -# -# group: compat, dns, files, nis -# group_compat: dns, nis -# hosts: dns, files, nis, mdnsd, multicast_dns -# netgroup: files, nis -# networks: dns, files, nis -# passwd: compat, dns, files, nis -# passwd_compat: dns, nis -# shells: dns, files, nis diff --git a/etc/passwd.conf b/etc/passwd.conf deleted file mode 100644 index 99f9b00c0..000000000 --- a/etc/passwd.conf +++ /dev/null @@ -1,8 +0,0 @@ -# -# passwd.conf(5) - -# password configuration file -# - -default: - localcipher = sha1 - ypcipher = old diff --git a/etc/profile b/etc/profile deleted file mode 100755 index 37e8ec4ef..000000000 --- a/etc/profile +++ /dev/null @@ -1,16 +0,0 @@ -# -# System-wide .profile file for sh(1). - -# MINIX specifics -# Set library path -export LD_LIBRARY_PATH="/lib:/usr/lib:/usr/X11R7/lib:/usr/pkg/lib:/usr/local/lib" - -# Set the timezone -export TZ=GMT0 -RC_TZ=/etc/rc.timezone - -if [ -f ${RC_TZ} ]; then - . ${RC_TZ} -fi - -export TZ diff --git a/etc/protocols b/etc/protocols deleted file mode 100644 index 85f392a48..000000000 --- a/etc/protocols +++ /dev/null @@ -1,331 +0,0 @@ -# $NetBSD: protocols,v 1.29 2017/01/16 09:39:26 hauke Exp $ -# See also: protocols(5) -# -# Last Updated -# 2015-10-06 -# -# Available Formats -# [IMG] -# XML [IMG] -# HTML [IMG] -# Plain text -# -# Registry included below -# -# * Assigned Internet Protocol Numbers -# -# Assigned Internet Protocol Numbers -# -# Registration Procedure(s) -# -# IESG Approval or Standards Action -# -# Reference -# [RFC5237][RFC7045] -# -# Note -# -# In the Internet Protocol version 4 (IPv4) [RFC791] there is a field -# called "Protocol" to identify the next level protocol. This is an 8 -# bit field. In Internet Protocol version 6 (IPv6) [RFC2460], this field -# is called the "Next Header" field. -# -# Note -# -# Values that are also IPv6 Extension Header Types should be listed in the -# IPv6 Extension Header Types registry at [IANA registry ipv6-parameters]. -# -# Available Formats -# [IMG] -# CSV -# -# Decimal Keyword Protocol IPv6 Extension Reference -# Header -# protocol num aliases # comments -hopopt 0 HOPOPT # IPv6 Hop-by-Hop Option Y [RFC2460] -icmp 1 ICMP # Internet Control Message [RFC792] -igmp 2 IGMP # Internet Group Management [RFC1112] -ggp 3 GGP # Gateway-to-Gateway [RFC823] -ipv4 4 IPv4 # IPv4 encapsulation [RFC2003] -st 5 ST # Stream [RFC1190][RFC1819] -tcp 6 TCP # Transmission Control [RFC793] -cbt 7 CBT # CBT [Tony_Ballardie] -egp 8 EGP # Exterior Gateway Protocol [RFC888][David_Mills] -# any private interior gateway -igp 9 IGP # (used by Cisco for their [Internet_Assigned_Numbers_Authority] -# IGRP) -bbn-rcc-mon 10 BBN-RCC-MON # BBN RCC Monitoring [Steve_Chipman] -nvp-ii 11 NVP-II # Network Voice Protocol [RFC741][Steve_Casner] -# [Boggs, D., J. Shoch, E. Taft, and R. Metcalfe, "PUP: An Internetwork -pup 12 PUP # PUP Architecture", XEROX Palo Alto Research Center, CSL-79-10, July 1979; -# also in IEEE Transactions on Communication, Volume COM-28, Number 4, -# April 1980.][[XEROX]] -argus 13 ARGUS # (deprecated) ARGUS [Robert_W_Scheifler] -emcon 14 EMCON # EMCON [] -xnet 15 XNET # Cross Net Debugger [Haverty, J., "XNET Formats for Internet Protocol Version 4", IEN 158, -# October 1980.][Jack_Haverty] -chaos 16 CHAOS # Chaos [J_Noel_Chiappa] -udp 17 UDP # User Datagram [RFC768][Jon_Postel] -mux 18 MUX # Multiplexing [Cohen, D. and J. Postel, "Multiplexing Protocol", IEN 90, -# USC/Information Sciences Institute, May 1979.][Jon_Postel] -dcn-meas 19 DCN-MEAS # DCN Measurement Subsystems [David_Mills] -hmp 20 HMP # Host Monitoring [RFC869][Bob_Hinden] -prm 21 PRM # Packet Radio Measurement [Zaw_Sing_Su] -# ["The Ethernet, A Local Area Network: Data Link Layer and Physical Layer -# Specification", AA-K759B-TK, Digital Equipment Corporation, Maynard, MA. -# Also as: "The Ethernet - A Local Area Network", Version 1.0, Digital -# Equipment Corporation, Intel Corporation, Xerox Corporation, September -xns-idp 22 XNS-IDP # XEROX NS IDP 1980. And: "The Ethernet, A Local Area Network: Data Link Layer and -# Physical Layer Specifications", Digital, Intel and Xerox, November 1982. -# And: XEROX, "The Ethernet, A Local Area Network: Data Link Layer and -# Physical Layer Specification", X3T51/80-50, Xerox Corporation, Stamford, -# CT., October 1980.][[XEROX]] -trunk-1 23 TRUNK-1 # Trunk-1 [Barry_Boehm] -trunk-2 24 TRUNK-2 # Trunk-2 [Barry_Boehm] -leaf-1 25 LEAF-1 # Leaf-1 [Barry_Boehm] -leaf-2 26 LEAF-2 # Leaf-2 [Barry_Boehm] -rdp 27 RDP # Reliable Data Protocol [RFC908][Bob_Hinden] -irtp 28 IRTP # Internet Reliable [RFC938][Trudy_Miller] -# Transaction -iso-tp4 29 ISO-TP4 # ISO Transport Protocol Class [RFC905][] -# 4 -netblt 30 NETBLT # Bulk Data Transfer Protocol [RFC969][David_Clark] -# MFE Network Services [Shuttleworth, B., "A Documentary of MFENet, a National Computer -mfe-nsp 31 MFE-NSP # Protocol Network", UCRL-52317, Lawrence Livermore Labs, Livermore, California, -# June 1977.][Barry_Howard] -merit-inp 32 MERIT-INP # MERIT Internodal Protocol [Hans_Werner_Braun] -dccp 33 DCCP # Datagram Congestion Control [RFC4340] -# Protocol -3pc 34 3PC # Third Party Connect Protocol [Stuart_A_Friedberg] -idpr 35 IDPR # Inter-Domain Policy Routing [Martha_Steenstrup] -# Protocol -xtp 36 XTP # XTP [Greg_Chesson] -ddp 37 DDP # Datagram Delivery Protocol [Wesley_Craig] -idpr-cmtp 38 IDPR-CMTP # IDPR Control Message [Martha_Steenstrup] -# Transport Proto -tp++ 39 TP++ # TP++ Transport Protocol [Dirk_Fromhein] -il 40 IL # IL Transport Protocol [Dave_Presotto] -ipv6 41 IPv6 # IPv6 encapsulation [RFC2473] -sdrp 42 SDRP # Source Demand Routing [Deborah_Estrin] -# Protocol -ipv6-route 43 IPv6-Route # Routing Header for IPv6 Y [Steve_Deering] -ipv6-frag 44 IPv6-Frag # Fragment Header for IPv6 Y [Steve_Deering] -idrp 45 IDRP # Inter-Domain Routing [Sue_Hares] -# Protocol -rsvp 46 RSVP # Reservation Protocol [RFC2205][RFC3209][Bob_Braden] -gre 47 GRE # Generic Routing [RFC2784][Tony_Li] -# Encapsulation -dsr 48 DSR # Dynamic Source Routing [RFC4728] -# Protocol -bna 49 BNA # BNA [Gary Salamon] -esp 50 ESP # Encap Security Payload Y [RFC4303] -ah 51 AH # Authentication Header Y [RFC4302] -i-nlsp 52 I-NLSP # Integrated Net Layer [K_Robert_Glenn] -# Security TUBA -swipe 53 SWIPE # (deprecated) IP with Encryption [John_Ioannidis] -narp 54 NARP # NBMA Address Resolution [RFC1735] -# Protocol -mobile 55 MOBILE # IP Mobility [Charlie_Perkins] -# Transport Layer Security -tlsp 56 TLSP # Protocol using Kryptonet key [Christer_Oberg] -# management -skip 57 SKIP # SKIP [Tom_Markson] -ipv6-icmp 58 IPv6-ICMP # ICMP for IPv6 [RFC2460] -ipv6-nonxt 59 IPv6-NoNxt # No Next Header for IPv6 [RFC2460] -ipv6-opts 60 IPv6-Opts # Destination Options for IPv6 Y [RFC2460] -# 61 any host internal protocol [Internet_Assigned_Numbers_Authority] -cftp 62 CFTP # CFTP [Forsdick, H., "CFTP", Network Message, Bolt Beranek and Newman, January -# 1982.][Harry_Forsdick] -# 63 any local network [Internet_Assigned_Numbers_Authority] -sat-expak 64 SAT-EXPAK # SATNET and Backroom EXPAK [Steven_Blumenthal] -kryptolan 65 KRYPTOLAN # Kryptolan [Paul Liu] -rvd 66 RVD # MIT Remote Virtual Disk [Michael_Greenwald] -# Protocol -ippc 67 IPPC # Internet Pluribus Packet [Steven_Blumenthal] -# Core -# 68 any distributed file system [Internet_Assigned_Numbers_Authority] -sat-mon 69 SAT-MON # SATNET Monitoring [Steven_Blumenthal] -visa 70 VISA # VISA Protocol [Gene_Tsudik] -ipcv 71 IPCV # Internet Packet Core Utility [Steven_Blumenthal] -cpnx 72 CPNX # Computer Protocol Network [David Mittnacht] -# Executive -cphb 73 CPHB # Computer Protocol Heart Beat [David Mittnacht] -wsn 74 WSN # Wang Span Network [Victor Dafoulas] -pvp 75 PVP # Packet Video Protocol [Steve_Casner] -br-sat-mon 76 BR-SAT-MON # Backroom SATNET Monitoring [Steven_Blumenthal] -sun-nd 77 SUN-ND # SUN ND PROTOCOL-Temporary [William_Melohn] -wb-mon 78 WB-MON # WIDEBAND Monitoring [Steven_Blumenthal] -wb-expak 79 WB-EXPAK # WIDEBAND EXPAK [Steven_Blumenthal] -iso-ip 80 ISO-IP # ISO Internet Protocol [Marshall_T_Rose] -vmtp 81 VMTP # VMTP [Dave_Cheriton] -secure-vmtp 82 SECURE-VMTP # SECURE-VMTP [Dave_Cheriton] -vines 83 VINES # VINES [Brian Horn] -ttp 84 TTP iptm IPTM # Transaction Transport [Jim_Stevens] -# Protocol -#iptm 84 IPTM # Internet Protocol Traffic [Jim_Stevens] -# Manager -nsfnet-igp 85 NSFNET-IGP # NSFNET-IGP [Hans_Werner_Braun] -dgp 86 DGP # Dissimilar Gateway Protocol [M/A-COM Government Systems, "Dissimilar Gateway Protocol Specification, -# Draft Version", Contract no. CS901145, November 16, 1987.][Mike_Little] -tcf 87 TCF # TCF [Guillermo_A_Loyola] -eigrp 88 EIGRP # EIGRP [Cisco Systems, "Gateway Server Reference Manual", Manual Revision B, -# January 10, 1988.][Guenther_Schreiner] -ospfigp 89 OSPFIGP # OSPFIGP [RFC1583][RFC2328][RFC5340][John_Moy] -# [Welch, B., "The Sprite Remote Procedure Call System", Technical Report, -sprite-rpc 90 Sprite-RPC # Sprite RPC Protocol UCB/Computer Science Dept., 86/302, University of California at Berkeley, -# June 1986.][Bruce Willins] -larp 91 LARP # Locus Address Resolution [Brian Horn] -# Protocol -mtp 92 MTP # Multicast Transport Protocol [Susie_Armstrong] -ax.25 93 AX.25 # AX.25 Frames [Brian_Kantor] -ipip 94 IPIP # IP-within-IP Encapsulation [John_Ioannidis] -# Protocol -micp 95 MICP # (deprecated) Mobile Internetworking [John_Ioannidis] -# Control Pro. -scc-sp 96 SCC-SP # Semaphore Communications [Howard_Hart] -# Sec. Pro. -etherip 97 ETHERIP # Ethernet-within-IP [RFC3378] -# Encapsulation -encap 98 ENCAP # Encapsulation Header [RFC1241][Robert_Woodburn] -# 99 any private encryption [Internet_Assigned_Numbers_Authority] -# scheme -gmtp 100 GMTP # GMTP [[RXB5]] -ifmp 101 IFMP # Ipsilon Flow Management [Bob_Hinden][November 1995, 1997.] -# Protocol -pnni 102 PNNI # PNNI over IP [Ross_Callon] -pim 103 PIM # Protocol Independent [RFC-ietf-pim-rfc4601bis-06][Dino_Farinacci] -# Multicast -aris 104 ARIS # ARIS [Nancy_Feldman] -scps 105 SCPS # SCPS [Robert_Durst] -qnx 106 QNX # QNX [Michael_Hunter] -a/n 107 A/N # Active Networks [Bob_Braden] -ipcomp 108 IPComp # IP Payload Compression [RFC2393] -# Protocol -snp 109 SNP # Sitara Networks Protocol [Manickam_R_Sridhar] -compaq-peer 110 Compaq-Peer # Compaq Peer Protocol [Victor_Volpe] -ipx-in-ip 111 IPX-in-IP # IPX in IP [CJ_Lee] -vrrp 112 VRRP carp # Virtual Router Redundancy [RFC5798] -# Protocol -pgm 113 PGM # PGM Reliable Transport [Tony_Speakman] -# Protocol -# 114 any 0-hop protocol [Internet_Assigned_Numbers_Authority] -l2tp 115 L2TP # Layer Two Tunneling Protocol [RFC3931][Bernard_Aboba] -ddx 116 DDX # D-II Data Exchange (DDX) [John_Worley] -iatp 117 IATP # Interactive Agent Transfer [John_Murphy] -# Protocol -stp 118 STP # Schedule Transfer Protocol [Jean_Michel_Pittet] -srp 119 SRP # SpectraLink Radio Protocol [Mark_Hamilton] -uti 120 UTI # UTI [Peter_Lothberg] -smp 121 SMP # Simple Message Protocol [Leif_Ekblad] -sm 122 SM # (deprecated) Simple Multicast Protocol [Jon_Crowcroft][draft-perlman-simple-multicast] -ptp 123 PTP # Performance Transparency [Michael_Welzl] -# Protocol -isis 124 ISIS # over IPv4 [Tony_Przygienda] -fire 125 FIRE # [Criag_Partridge] -crtp 126 CRTP # Combat Radio Transport [Robert_Sautter] -# Protocol -crudp 127 CRUDP # Combat Radio User Datagram [Robert_Sautter] -sscopmce 128 SSCOPMCE # [Kurt_Waber] -iplt 129 IPLT # [[Hollbach]] -sps 130 SPS # Secure Packet Shield [Bill_McIntosh] -pipe 131 PIPE # Private IP Encapsulation [Bernhard_Petri] -# within IP -sctp 132 SCTP # Stream Control Transmission [Randall_R_Stewart] -# Protocol -fc 133 FC # Fibre Channel [Murali_Rajagopal][RFC6172] -rsvp-e2e-ignore 134 RSVP-E2E-IGNORE # [RFC3175] -mobility 135 Mobility # Header Y [RFC6275] -udplite 136 UDPLite # [RFC3828] -mpls-in-ip 137 MPLS-in-IP # [RFC4023] -manet 138 MANET # MANET Protocols [RFC5498] -hip 139 HIP # Host Identity Protocol Y [RFC7401] -shim6 140 Shim6 # Shim6 Protocol Y [RFC5533] -wesp 141 WESP # Wrapped Encapsulating [RFC5840] -# Security Payload -rohc 142 ROHC # Robust Header Compression [RFC5858] -# 143-239 Unassigned [Internet_Assigned_Numbers_Authority] -pfsync 240 PFSYNC # PF Synchronization -# 241-252 Unassigned [Internet_Assigned_Numbers_Authority] -# 253 Use for experimentation and Y [RFC3692] -# testing -# 254 Use for experimentation and Y [RFC3692] -# testing -reserved 255 Reserved # [Internet_Assigned_Numbers_Authority] -# -# People -# -# ID Name Contact URI Last Updated -# [Barry_Boehm] Barry Boehm mailto:boehm&arpa.mil -# [Barry_Howard] Barry Howard mailto:Howard&nmfecc.llnl.gov -# [Bernard_Aboba] Bernard Aboba mailto:bernardaµsoft.com 1998-04 -# [Bernhard_Petri] Bernhard Petri mailto:bernhard.petri&siemens.com 2012-07-09 -# [Bill_McIntosh] Bill McIntosh mailto:BMcIntosh&fortresstech.com -# [Bob_Braden] Bob Braden mailto:braden&isi.edu 1997-07 -# [Bob_Hinden] Bob Hinden mailto:bob.hinden&gmail.com 2013-02-17 -# [Brian_Kantor] Brian Kantor mailto:brian&ucsd.edu -# [CJ_Lee] CJ Lee mailto:cj_lee&novell.com 1997-10 -# [Charlie_Perkins] Charlie Perkins mailto:perk&watson.ibm.com 1994-10 -# [Christer_Oberg] Christer Oberg mailto:chg&bull.se 1994-10 -# [Criag_Partridge] Criag Partridge mailto:craig&bbn.com 1999-08 -# [Dave_Cheriton] Dave Cheriton mailto:cheriton&pescadero.stanford.edu -# [Dave_Presotto] Dave Presotto mailto:presotto&plan9.att.com 1995-07 -# [David_Clark] David Clark mailto:ddc&lcs.mit.edu -# [David_Mills] David Mills mailto:Mills&huey.udel.edu -# [Deborah_Estrin] Deborah Estrin mailto:estrin&usc.edu -# [Dino_Farinacci] Dino Farinacci mailto:dino&cisco.com 1996-03 -# [Dirk_Fromhein] Dirk Fromhein mailto:df&watershed.com -# [Gene_Tsudik] Gene Tsudik mailto:tsudik&usc.edu -# [Greg_Chesson] Greg Chesson mailto:Greg&sgi.com -# [Guenther_Schreiner] Guenther Schreiner mailto:snmp-admin&ira.uka.de -# [Guillermo_A_Loyola] Guillermo A. Loyola mailto:LOYOLA&ibm.com -# [Hans_Werner_Braun] Hans-Werner Braun mailto:HWB&mcr.umich.edu -# [Harry_Forsdick] Harry Forsdick mailto:Forsdick&bbn.com -# [Howard_Hart] Howard Hart mailto:hch&hybrid.com -# [Internet_Assigned_Numbers_Authority] Internet Assigned Numbers Authority mailto:iana&iana.org 1995-06 -# [J_Noel_Chiappa] J. Noel Chiappa mailto:JNC&xx.lcs.mit.edu -# [Jack_Haverty] Jack Haverty mailto:jhaverty&oracle.com -# [Jean_Michel_Pittet] Jean-Michel Pittet mailto:jmp&gandalf.engr.sgi.com 1998-11 -# [Jim_Stevens] Jim Stevens mailto:jasteven&rockwellcollins.com 2011-01-26 -# [John_Ioannidis] John Ioannidis mailto:ji&tla.org 2015-01-06 -# [John_Moy] John Moy mailto:jmoy&proteon.com -# [John_Murphy] John Murphy mailto:john.m.murphy&mci.com 1998-10 -# [John_Worley] John Worley mailto:worley&milehigh.net 1998-06 -# [Jon_Crowcroft] Jon Crowcroft mailto:jon&cs.ucl.ac.uk 1999-06 -# [Jon_Postel] Jon Postel mailto:postel&isi.edu -# [K_Robert_Glenn] K. Robert Glenn mailto:glenn&osi.ncsl.nist.gov -# [Kurt_Waber] Kurt Waber mailto:kurt.waber&swisscom.com 1999-08 -# [Leif_Ekblad] Leif Ekblad mailto:leif&rdos.net 2012-08-21 -# [Manickam_R_Sridhar] Manickam R. Sridhar mailto:msridhar&sitaranetworks.com 1997-09 -# [Mark_Hamilton] Mark Hamilton mailto:mah&spectralink.com 1998-11 -# [Marshall_T_Rose] Marshall T. Rose mailto:mrose&dbc.mtview.ca.us -# [Martha_Steenstrup] Martha Steenstrup mailto:MSteenst&bbn.com -# [Michael_Greenwald] Michael Greenwald mailto:Greenwald&scrc-stony-brook.symbolics.com -# [Michael_Hunter] Michael Hunter mailto:mphunter&qnx.com 1997-07 -# [Michael_Welzl] Michael Welzl mailto:michael&tk.uni-linz.ac.at 1999-08 -# [Mike_Little] Mike Little mailto:little&macom4.arpa -# [Murali_Rajagopal] Murali Rajagopal mailto:murali&gadzoox.com 2000-05 -# [Nancy_Feldman] Nancy Feldman mailto:nkf&vnet.ibm.com 1997-01 -# [Peter_Lothberg] Peter Lothberg mailto:roll&stupi.se 1999-03 -# [Randall_R_Stewart] Randall R. Stewart mailto:rrs&lakerest.net 2000-04 -# [Robert_Durst] Robert Durst mailto:durst&mitre.org 1997-03 -# [Robert_Sautter] Robert Sautter mailto:rsautter&acdnj.itt.com 1999-08 -# [Robert_W_Scheifler] Robert W. Scheifler mailto:rscheifler&comcast.net 2015-10-06 -# [Robert_Woodburn] Robert Woodburn mailto:woody&cseic.saic.com -# [Ross_Callon] Ross Callon mailto:rcallon&baynetworks.com 1995-12 -# [Steve_Casner] Steve Casner mailto:casner&isi.edu -# [Steve_Chipman] Steve Chipman mailto:Chipman&f.bbn.com -# [Steve_Deering] Steve Deering mailto:deering&parc.xerox.com 1995-03 -# [Steven_Blumenthal] Steven Blumenthal mailto:BLUMENTHAL&vax.bbn.com -# [Stuart_A_Friedberg] Stuart A. Friedberg mailto:stuart&cs.wisc.edu -# [Sue_Hares] Sue Hares mailto:skh&merit.edu -# [Susie_Armstrong] Susie Armstrong mailto:Armstrong.wbst128&xerox.com -# [Tom_Markson] Tom Markson mailto:markson&osmosys.ingog.com 1995-09 -# [Tony_Ballardie] Tony Ballardie mailto:A.Ballardie&cs.ucl.ac.uk -# [Tony_Li] Tony Li mailto:tony.li&tony.li 2012-10-17 -# [Tony_Przygienda] Tony Przygienda mailto:prz&siara.com 1999-08 -# [Tony_Speakman] Tony Speakman mailto:speakman&cisco.com 1998-01 -# [Trudy_Miller] Trudy Miller mailto:Trudy&acc.com -# [Victor_Volpe] Victor Volpe mailto:vvolpe&smtp.microcom.com 1997-10 -# [Wesley_Craig] Wesley Craig mailto:Wesley.Craig&terminator.cc.umich.edu -# [William_Melohn] William Melohn mailto:Melohn&sun.com -# [Zaw_Sing_Su] Zaw-Sing Su mailto:ZSu&tsca.istc.sri. diff --git a/etc/rc b/etc/rc deleted file mode 100644 index 32102c6b7..000000000 --- a/etc/rc +++ /dev/null @@ -1,467 +0,0 @@ -#!/bin/sh -# -# -# rc -- -# Run the scripts in /etc/rc.d with rcorder, and log output -# to /var/run/rc.log. - -# System startup script run by init(8) on autoboot or after single-user. -# Output and error are redirected to console by init, and the console -# is the controlling terminal. - -export HOME=/ -export PATH=/sbin:/bin:/usr/sbin:/usr/bin -umask 022 - -if [ -e ./rc.subr ] ; then - . ./rc.subr # for testing -else - . /etc/rc.subr -fi -. /etc/rc.conf -_rc_conf_loaded=true - -: ${RC_LOG_FILE:="/var/run/rc.log"} - -# rc.subr redefines echo and printf. Undo that here. -unset echo ; unalias echo -unset printf ; unalias printf - -if ! checkyesno rc_configured; then - echo "/etc/rc.conf is not configured. Multiuser boot aborted." - exit 1 -fi - -if [ "$1" = autoboot ]; then - autoboot=yes - rc_fast=yes # run_rc_command(): do fast booting -fi - -# -# Completely ignore INT and QUIT at the outer level. The rc_real_work() -# function should do something different. -# -trap '' INT QUIT - -# -# This string will be used to mark lines of meta-data sent over the pipe -# from the rc_real_work() function to the rc_postprocess() function. Lines -# not so marked are assumed to be output from rc.d scripts. -# -# This string is long and unique to ensure that it does not accidentally -# appear in output from any rc.d script. It must not contain any -# characters that are special to glob expansion ('*', '?', '[', or ']'). -# -rc_metadata_prefix="$0:$$:metadata:"; - -# Child scripts may sometimes want to print directly to the original -# stdout and stderr, bypassing the pipe to the postprocessor. These -# _rc_*_fd variables are private, shared with /etc/rc.subr, but not -# intended to be used directly by child scripts. (Child scripts -# may use rc.subr's no_rc_postprocess function.) -# -_rc_original_stdout_fd=7; export _rc_original_stdout_fd -_rc_original_stderr_fd=8; export _rc_original_stderr_fd -eval "exec ${_rc_original_stdout_fd}>&1" -eval "exec ${_rc_original_stderr_fd}>&2" - -# -# rc_real_work -# Do the real work. Output from this function will be piped into -# rc_postprocess(), and some of the output will be marked as -# metadata. -# -# The body of this function is defined using (...), not {...}, to force -# it to run in a subshell. -# -rc_real_work() -( - stty status '^T' - - # print_rc_metadata() wants to be able to print to the pipe - # that goes to our postprocessor, even if its in a context - # with redirected output. - # - _rc_postprocessor_fd=9 ; export _rc_postprocessor_fd - _rc_pid=$$ ; export _rc_pid - eval "exec ${_rc_postprocessor_fd}>&1" - - # Print a metadata line when we exit - # - trap 'es=$?; print_rc_metadata "exit:$es"; trap "" 0; exit $es' 0 - - # Set shell to ignore SIGINT, but children will not ignore it. - # Shell catches SIGQUIT and returns to single user. - # - trap : INT - trap '_msg="Boot interrupted at $(date)"; - print_rc_metadata "interrupted:${_msg}"; - exit 1' QUIT - - print_rc_metadata "start:$(date)" - - # - # The stop_boot() function in rc.subr may kill $RC_PID. We want - # it to kill the subshell running this rc_real_work() function, - # rather than killing the parent shell, because we want the - # rc_postprocess() function to be able to log the error - # without being killed itself. - # - # "$$" is the pid of the top-level shell, not the pid of the - # subshell that's executing this function. The command below - # tentatively assumes that the parent of the "/bin/sh -c ..." - # process will be the current subshell, and then uses "kill -0 - # ..." to check the result. If the "/bin/sh -c ..." process - # fails, or returns the pid of an ephemeral process that exits - # before the "kill" command, then we fall back to using "$$". - # - RC_PID=$(/bin/sh -c 'ps -p $$ -o ppid=') || RC_PID=$$ - kill -0 $RC_PID >/dev/null 2>&1 || RC_PID=$$ - - # - # As long as process $RC_PID is still running, send a "nop" - # metadata message to the postprocessor every few seconds. - # This should help flush partial lines that may appear when - # rc.d scripts that are NOT marked with "KEYWORD: interactive" - # nevertheless attempt to print prompts and wait for input. - # - ( - # First detach from tty, to avoid intercepting SIGINFO. - eval "exec ${_rc_original_stdout_fd}<&-" - eval "exec ${_rc_original_stderr_fd}<&-" - exec /dev/null 2>&1 - while kill -0 $RC_PID ; do - print_rc_metadata "nop" - sleep 3 - done - ) & - - # - # Get a list of all rc.d scripts, and use rcorder to choose - # what order to execute them. - # - # For testing, allow RC_FILES_OVERRIDE from the environment to - # override this. - # - print_rc_metadata "cmd-name:rcorder" - scripts=$(for rcd in ${rc_directories:-/etc/rc.d}; do - test -d ${rcd} && echo ${rcd}/*; - done) - files=$(rcorder -s nostart ${rc_rcorder_flags} ${scripts}) - print_rc_metadata "cmd-status:rcorder:$?" - - if [ -n "${RC_FILES_OVERRIDE}" ]; then - files="${RC_FILES_OVERRIDE}" - fi - - # - # Run the scripts in order. - # - for _rc_elem in $files; do - print_rc_metadata "cmd-name:$_rc_elem" - run_rc_script $_rc_elem start - print_rc_metadata "cmd-status:$_rc_elem:$?" - done - - print_rc_metadata "end:$(date)" - exit 0 -) - -# -# rc_postprocess -# Post-process the output from the rc_real_work() function. For -# each line of input, we have to decide whether to print the line -# to the console, print a twiddle on the console, print a line to -# the log, or some combination of these. -# -# If rc_silent is true, then suppress most output, instead running -# rc_silent_cmd (typically "twiddle") for each line. -# -# The body of this function is defined using (...), not {...}, to force -# it to run in a subshell. -# -# We have to deal with the following constraints: -# -# * There may be no writable file systems early in the boot, so -# any use of temporary files would be problematic. -# -# * Scripts run during the boot may clear /tmp and/var/run, so even -# if they are writable, using those directories too early may be -# problematic. We assume that it's safe to write to our log file -# after the mountcritlocal script has run. -# -# * /usr/bin/tee cannot be used because the /usr file system may not -# be mounted early in the boot. -# -# * All calls to the rc_log_message and rc_log_flush functions must be -# from the same subshell, otherwise the use of a shell variable to -# buffer log messages will fail. -# -rc_postprocess() -( - local line - local before after - local IFS='' - - # Try quite hard to flush the log to disk when we exit. - trap 'es=$?; rc_log_flush FORCE; trap "" 0; exit $es' 0 - - yesno_to_truefalse rc_silent 2>/dev/null - - while read -r line ; do - case "$line" in - "${rc_metadata_prefix}"*) - after="${line#*"${rc_metadata_prefix}"}" - rc_postprocess_metadata "${after}" - ;; - *"${rc_metadata_prefix}"*) - # magic string is present, but not at the start of - # the line. Treat it as a partial line of - # ordinary data, followed by a line of metadata. - before="${line%"${rc_metadata_prefix}"*}" - rc_postprocess_partial_line "${before}" - after="${line#*"${rc_metadata_prefix}"}" - rc_postprocess_metadata "${after}" - ;; - *) - rc_postprocess_plain_line "${line}" - ;; - esac - done - - # If we get here, then the rc_real_work() function must have - # exited uncleanly. A clean exit would have been accompanied by - # a line of metadata that would have prevented us from getting - # here. - # - exit 1 -) - -# -# rc_postprocess_plain_line string -# $1 is a string representing a line of output from one of the -# rc.d scripts. Append the line to the log, and also either -# display the line on the console, or run $rc_silent_cmd, -# depending on the value of $rc_silent. -# -rc_postprocess_plain_line() -{ - local line="$1" - rc_log_message "${line}" - if $rc_silent; then - eval "$rc_silent_cmd" - else - printf "%s\n" "${line}" - fi -} - -# -# rc_postprocess_partial_line string -# This is just like rc_postprocess_plain_line, except that -# a newline is not appended to the string. -# -rc_postprocess_partial_line() -{ - local line="$1" - rc_log_message_n "${line}" - if $rc_silent; then - eval "$rc_silent_cmd" - else - printf "%s" "${line}" - fi -} - -# -# rc_postprocess_metadata string -# $1 is a string containing metadata from the rc_real_work() -# function. The rc_metadata_prefix marker should already -# have been removed before the string is passed to this function. -# Take appropriate action depending on the content of the string. -# -rc_postprocess_metadata() -{ - local metadata="$1" - local keyword args - local msg - local IFS=':' - - # given metadata="bleep:foo bar:baz", - # set keyword="bleep", args="foo bar:baz", - # $1="foo bar", $2="baz" - # - keyword="${metadata%%:*}" - args="${metadata#*:}" - set -- $args - - case "$keyword" in - start) - # Marks the start of the entire /etc/rc script. - # $args contains a date/time. - rc_log_message "[$0 starting at $args]" - if ! $rc_silent; then - # MINIX 3: the clock has not been set yet! - #printf "%s\n" "$args" - # MINIX 3: end - fi - ;; - cmd-name) - # Marks the start of a child script (usually one of - # the /etc/rc.d/* scripts). - rc_log_message "[running $1]" - ;; - cmd-status) - # Marks the end of a child script. - # $1 is a command name, $2 is the command's exit status. - # If the command failed, report it, and add it to a list. - if [ "$2" != 0 ]; then - rc_failures="${rc_failures}${rc_failures:+ }$1" - msg="$1 $(human_exit_code $2)" - rc_log_message "$msg" - if ! $rc_silent; then - printf "%s\n" "$msg" - fi - fi - # After the mountcritlocal script has finished, it's - # OK to flush the log to disk - case "$1" in - */mountcritlocal) - rc_log_flush OK - ;; - esac - ;; - nop) - # Do nothing. - # This has the side effect of flushing partial lines, - # and the echo() and printf() functions in rc.subr take - # advantage of this. - ;; - note) - # Unlike most metadata messages, which should be used - # only by /etc/rc and rc.subr, the "note" message may be - # used directly by /etc.rc.d/* and similar scripts. - # It adds a note to the log file, without displaying - # it to stdout. - rc_log_message "[NOTE: $args]" - ;; - end) - # Marks the end of processing, after the last child script. - # If any child scripts (or other commands) failed, report them. - # - if [ -n "$rc_failures" ]; then - rc_log_message "[failures]" - msg="The following components reported failures:" - msg="${msg}${nl}$( echo " ${rc_failures}" | fmt )" - msg="${msg}${nl}See ${RC_LOG_FILE} for more information." - rc_log_message "${msg}" - printf "%s\n" "${msg}" - fi - # - # Report the end date/time, even in silent mode - # - rc_log_message "[$0 finished at $args]" - printf "%s\n" "$args" - ;; - exit) - # Marks an exit from the rc_real_work() function. - # This may be a normal or abnormal exit. - # - rc_log_message "[$0 exiting with status $1]" - exit $1 - ;; - interrupted) - # Marks an interrupt trapped by the rc_real_work() function. - # $args is a human-readable message. - rc_log_message "$args" - printf "%s\n" "$args" - ;; - *) - # an unrecognised line of metadata - rc_log_message "[metadata:${metadata}]" - ;; - esac -} - -# -# rc_log_message string [...] -# Write a message to the log file, or buffer it for later. -# This function appends a newline to the message. -# -rc_log_message() -{ - _rc_log_buffer="${_rc_log_buffer}${*}${nl}" - rc_log_flush -} - -# -# rc_log_message_n string [...] -# Just like rc_log_message, except without appending a newline. -# -rc_log_message_n() -{ - _rc_log_buffer="${_rc_log_buffer}${*}" - rc_log_flush -} - -# -# rc_log_flush [OK|FORCE] -# save outstanding messages from $_rc_log_buffer to $RC_LOG_FILE. -# -# The log file is expected to reside in the /var/run directory, which -# may not be writable very early in the boot sequence, and which is -# erased a little later in the boot sequence. We therefore avoid -# writing to the file until we believe it's safe to do so. We also -# assume that it's reasonable to always append to the file, never -# truncating it. -# -# Optional argument $1 may be "OK" to report that writing to the log -# file is expected to be safe from now on, or "FORCE" to force writing -# to the log file even if it may be unsafe. -# -# Returns a non-zero status if messages could not be written to the -# file. -# -rc_log_flush() -{ - # - # If $_rc_log_flush_ok is false, then it's probably too early to - # write to the log file, so don't do it, unless $1 is "FORCE". - # - : ${_rc_log_flush_ok=false} - case "$1:$_rc_log_flush_ok" in - OK:*) - _rc_log_flush_ok=true - ;; - FORCE:*) - : OK just this once - ;; - *:true) - : OK - ;; - *) - # it's too early in the boot sequence, so don't flush - return 1 - ;; - esac - - # - # Now append the buffer to the file. The buffer should already - # contain a trailing newline, so don't add an extra newline. - # - if [ -n "$_rc_log_buffer" ]; then - if { printf "%s" "${_rc_log_buffer}" >>"${RC_LOG_FILE}" ; } \ - 2>/dev/null - then - _rc_log_buffer="" - else - return 1 - fi - fi - return 0 -} - -# -# Most of the action is in the rc_real_work() and rc_postprocess() -# functions. -# -rc_real_work "$@" 2>&1 | rc_postprocess -exit $? diff --git a/etc/rc.capes/BB-BONE-WTHR-01 b/etc/rc.capes/BB-BONE-WTHR-01 deleted file mode 100644 index e50612a4d..000000000 --- a/etc/rc.capes/BB-BONE-WTHR-01 +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh -# -# Start-up script for the BeagleBone Weather cape. - -# TSL2550 Ambient Light Sensor -test -e /dev/tsl2550b3s39 || (cd /dev && MAKEDEV tsl2550b3s39) -/sbin/minix-service up /service/tsl2550 -dev /dev/tsl2550b3s39 \ - -label tsl2550.3.39 -args 'bus=3 address=0x39' && echo -n " tsl2550" - -# SHT21 Temperature and Humidity Sensor -test -e /dev/sht21b3s40 || (cd /dev && MAKEDEV sht21b3s40) -/sbin/minix-service up /service/sht21 -dev /dev/sht21b3s40 \ - -label sht21.3.40 -args 'bus=3 address=0x40' && echo -n " sht21" - -# BMP085 Temperature and Pressure Sensor -test -e /dev/bmp085b3s77 || (cd /dev && MAKEDEV bmp085b3s77) -/sbin/minix-service up /service/bmp085 -dev /dev/bmp085b3s77 \ - -label bmp085.3.77 -args 'bus=3 address=0x77' && echo -n " bmp085" - -# FIXME: replace this with proper commands for inetd(8) -#daemonize tcpd http /usr/share/beaglebone/weather/weatherstation.lua diff --git a/etc/rc.cd b/etc/rc.cd deleted file mode 100644 index f0dc35119..000000000 --- a/etc/rc.cd +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh - -# CD boottime initializations. - -echo -n "Creating ramdisks:" - -# Set up a ramdisk to make a read-only part of the directory tree writable -# $1 : ramdisk dev node to use -# $2 : path to make writeable -# $3 : ramdisk size in blocks -create_ramdisk() -{ - echo -n " $2" - ramdisk $3 /dev/$1 > /dev/null - mkfs.mfs /dev/$1 > /dev/null - - # copy files - mount /dev/$1 /mnt > /dev/null - (cd $2 && pax -rw . /mnt) - - umount /mnt > /dev/null - mount /dev/$1 $2 > /dev/null -} - -# Create /var ramdisk -create_ramdisk ram0 /var 768 -create_ramdisk ram1 /tmp 128 -create_ramdisk ram2 /usr/run 64 -create_ramdisk ram3 /root 512 - -echo diff --git a/etc/rc.conf b/etc/rc.conf deleted file mode 100644 index 9debc8e3f..000000000 --- a/etc/rc.conf +++ /dev/null @@ -1,21 +0,0 @@ -# -# See rc.conf(5) for more information. -# -# Use program=YES to enable program, NO to disable it. program_flags are -# passed to the program on the command line. -# - -# Load the defaults in from /etc/defaults/rc.conf (if it's readable). -# These can be overridden below. -# -if [ -r /etc/defaults/rc.conf ]; then - . /etc/defaults/rc.conf -fi - -# If this is not set to YES, the system will drop into single-user mode. -# MINIX 3: for now, this setting is enabled by default. -# -rc_configured=YES - -# Add local overrides below. -# diff --git a/etc/rc.d/DAEMON b/etc/rc.d/DAEMON deleted file mode 100755 index 378327b4d..000000000 --- a/etc/rc.d/DAEMON +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# $NetBSD: DAEMON,v 1.8 2002/03/22 04:33:57 thorpej Exp $ -# - -# PROVIDE: DAEMON -# REQUIRE: NETWORKING SERVERS - -# This is a dummy dependency, to ensure that general purpose daemons -# are run _after_ the above are. diff --git a/etc/rc.d/DISKS b/etc/rc.d/DISKS deleted file mode 100644 index 1bf7f6164..000000000 --- a/etc/rc.d/DISKS +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# -# $NetBSD: DISKS,v 1.1 2009/04/21 16:08:57 joerg Exp $ -# - -# PROVIDE: DISKS - -# -# This is a dummy dependency, to ensure that all disk devices are -# accessible for fsck and mountcritlocal. -# diff --git a/etc/rc.d/LOGIN b/etc/rc.d/LOGIN deleted file mode 100755 index 1f111fa50..000000000 --- a/etc/rc.d/LOGIN +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/sh -# -# $NetBSD: LOGIN,v 1.7 2002/03/22 04:33:57 thorpej Exp $ -# - -# PROVIDE: LOGIN -# REQUIRE: DAEMON - -# This is a dummy dependency to ensure user services such as xdm, -# inetd, cron and kerberos are started after everything else, incase -# the administrator has increased the system security level and -# wants to delay user logins until the system is (almost) fully -# operational. diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile deleted file mode 100755 index f45fd12d4..000000000 --- a/etc/rc.d/Makefile +++ /dev/null @@ -1,79 +0,0 @@ -# $NetBSD: Makefile,v 1.93 2015/03/30 10:58:37 chopps Exp $ - -.include - -# -# NOTE: -# -# If you're adding new scripts, don't forget to update following: -# src/distrib/sets/lists/etc/mi -# src/etc/mtree/special -# src/usr.sbin/postinstall/postinstall -# -# You can find a script to visualize the dependency graph in -# src/sbin/rcorder. - -# MINIX: the idea for importing rc.d scripts is basically: -# - in principle, import only the scripts for functionality that we support; -# - do not change dependencies ("REQUIRE", "BEFORE") in such scripts; rather, -# satisfy the dependencies, recursively, with the following rules; -# - for each such dependency, if it can be disabled (= it has a "rcvar"), then -# import its script as is, even if we do not support its functionality; -# - if such an unsupported dependency is enabled by default as per -# etc/defaults/rc.conf, then disable it by overriding it explicitly in -# etc/defaults/minix.rc.conf; -# - for unsupported dependencies that can not be disabled, create a stub for it -# (examples: fsck, root, mountcritlocal) but whenever relevant do try to keep -# its dependency listing intact so as not to disturb the regular ordering. -CONFIGFILES=\ - DAEMON DISKS LOGIN NETWORKING SERVERS \ - \ - bootconf.sh \ - \ - dhclient dhcpcd dhcpd dhcrelay downinterfaces \ - fsck ftpd \ - \ - \ - inetd ipfilter ipsec \ - \ - \ - local \ - \ - mountcritlocal mountcritremote \ - named network npf \ - \ - pwcheck \ - \ - \ - root rtadvd \ - \ - \ - staticroute sysctl sysdb syslogd \ - ttys \ - wscons \ - - -.if defined(__MINIX) -# MINIX: we will gradually switch over to the NetBSD rc system. For conflict -# avoidance, all MINIX-specific scripts should have "minix" in their name. -CONFIGFILES+= minixrc -.endif - -FILESDIR= /etc/rc.d -FILESMODE= ${BINMODE} - -.if !defined(__MINIX) # XXX needs testing first -.if ${MKX11} != "no" -CONFIGFILES+= xdm xfs fccache -FILESBUILD_xdm= yes -FILESBUILD_xfs= yes -FILESBUILD_fccache= yes -.endif # !defined(__MINIX) - -.SUFFIXES: .in -.in: - ${_MKTARGET_CREATE} - ${TOOL_SED} -e 's,@X11ROOTDIR@,${X11ROOTDIR},g' < ${.IMPSRC} > ${.TARGET} -.endif - -.include diff --git a/etc/rc.d/NETWORKING b/etc/rc.d/NETWORKING deleted file mode 100755 index 6b5102005..000000000 --- a/etc/rc.d/NETWORKING +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -# -# $NetBSD: NETWORKING,v 1.2 2002/03/22 04:33:57 thorpej Exp $ -# - -# PROVIDE: NETWORKING NETWORK - -# This is a dummy dependency, for services which require networking -# to be operational before starting. diff --git a/etc/rc.d/SERVERS b/etc/rc.d/SERVERS deleted file mode 100755 index 7c364108a..000000000 --- a/etc/rc.d/SERVERS +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/sh -# -# $NetBSD: SERVERS,v 1.9 2002/03/22 04:33:57 thorpej Exp $ -# - -# PROVIDE: SERVERS -# REQUIRE: mountcritremote - -# This is a dummy dependency, for early-start servers relying on -# some basic configuration. diff --git a/etc/rc.d/bootconf.sh b/etc/rc.d/bootconf.sh deleted file mode 100755 index 1e2defa82..000000000 --- a/etc/rc.d/bootconf.sh +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/sh -# -# $NetBSD: bootconf.sh,v 1.15 2012/12/31 23:21:27 christos Exp $ -# - -# PROVIDE: bootconf -# REQUIRE: mountcritlocal -# KEYWORD: interactive - -$_rc_subr_loaded . /etc/rc.subr - -name="bootconf" -start_cmd="bootconf_start" -stop_cmd=":" - -bootconf_start() -{ - # Refer to newbtconf(8) for more information - # - - if [ ! -e /etc/etc.current ]; then - return 0 - fi - if [ -h /etc/etc.default ]; then - def=$(ls -ld /etc/etc.default 2>&1) - default="${def##*-> *etc.}" - else - default=current - fi - if [ "$default" = "current" ]; then - def=$(ls -ld /etc/etc.current 2>&1) - default="${def##*-> *etc.}" - fi - - spc="" - for i in /etc/etc.*; do - name="${i##/etc/etc.}" - case $name in - current|default|\*) - continue - ;; - *) - if [ "$name" = "$default" ]; then - echo -n "${spc}[${name}]" - else - echo -n "${spc}${name}" - fi - spc=" " - ;; - esac - done - echo - _DUMMY=/etc/passwd - conf=${_DUMMY} - while [ ! -d /etc/etc.$conf/. ]; do - trap "conf=$default; echo; echo Using default of $default" ALRM - echo -n "Which configuration [$default] ? " - (sleep 30 && kill -ALRM $RC_PID) >/dev/null 2>&1 & - read conf - trap : ALRM - if [ -z $conf ] ; then - conf=$default - fi - if [ ! -d /etc/etc.$conf/. ]; then - conf=${_DUMMY} - fi - done - - print_rc_metadata "note:Using configuration \"${conf}\"" - - case $conf in - current|default) - ;; - *) - rm -f /etc/etc.current - ln -s etc.$conf /etc/etc.current - sync - ;; - esac - - if [ -f /etc/rc.conf ] ; then - . /etc/rc.conf - fi -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/dhclient b/etc/rc.d/dhclient deleted file mode 100755 index cd71665de..000000000 --- a/etc/rc.d/dhclient +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh -# -# $NetBSD: dhclient,v 1.9 2004/08/13 18:08:03 mycroft Exp $ -# - -# PROVIDE: dhclient -# REQUIRE: network mountcritlocal -# BEFORE: NETWORKING -# -# Note that there no syslog logging of dhclient messages at boot because -# dhclient needs to start before services that syslog depends upon do. -# - -$_rc_subr_loaded . /etc/rc.subr - -name="dhclient" -rcvar=$name -command="/sbin/${name}" -pidfile="/var/run/${name}.pid" - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/dhcpcd b/etc/rc.d/dhcpcd deleted file mode 100755 index 67385bb9e..000000000 --- a/etc/rc.d/dhcpcd +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh - -# PROVIDE: dhcpcd -# REQUIRE: network mountcritlocal -# BEFORE: NETWORKING - -$_rc_subr_loaded . /etc/rc.subr - -name=dhcpcd -rcvar=$name -command=/sbin/$name -extra_commands="reload" - -load_rc_config $name - -# If the last argument to dhcpcd is a valid interface and the prior argument -# is not then dhcpcd will start on one interface only and create a pidfile -# based on the interface name. See PR bin/43490. -if [ -n "$flags" ]; then - myflags=$flags -else - eval myflags=\$${name}_flags -fi -ifname="${myflags##* }" -myflags="${myflags%% $ifname}" -last_flag="${myflags##* }" -if /sbin/ifconfig "$ifname" >/dev/null 2>&1 && - ! /sbin/ifconfig "$last_flag" >/dev/null 2>&1 -then - pidfile=/var/run/$name-"$ifname".pid -else - pidfile=/var/run/$name.pid -fi -unset myflags ifname last_flag - -run_rc_command "$1" diff --git a/etc/rc.d/dhcpd b/etc/rc.d/dhcpd deleted file mode 100755 index e1472f043..000000000 --- a/etc/rc.d/dhcpd +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# -# $NetBSD: dhcpd,v 1.7 2014/07/17 07:17:03 spz Exp $ -# - -# PROVIDE: dhcpd -# REQUIRE: DAEMON -# BEFORE: LOGIN - -$_rc_subr_loaded . /etc/rc.subr - -name="dhcpd" -rcvar=$name -command="/usr/sbin/${name}" -start_precmd="dhcpd_precmd" -pidfile="/var/run/${name}.pid" -required_files="/etc/${name}.conf" - -dhcpd_precmd() -{ - if [ ! -e "/var/db/${name}.leases" ]; then - echo "Creating /var/db/${name}.leases" - touch /var/db/${name}.leases - fi -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/dhcrelay b/etc/rc.d/dhcrelay deleted file mode 100755 index c286f793d..000000000 --- a/etc/rc.d/dhcrelay +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# -# $NetBSD: dhcrelay,v 1.6 2004/08/13 18:08:03 mycroft Exp $ -# - -# PROVIDE: dhcrelay -# REQUIRE: DAEMON -# BEFORE: LOGIN - -$_rc_subr_loaded . /etc/rc.subr - -name="dhcrelay" -rcvar=$name -command="/usr/sbin/${name}" -pidfile="/var/run/${name}.pid" - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/downinterfaces b/etc/rc.d/downinterfaces deleted file mode 100644 index dac099773..000000000 --- a/etc/rc.d/downinterfaces +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/sh -# -# $NetBSD: downinterfaces,v 1.6 2009/09/05 16:26:07 apb Exp $ -# - -# PROVIDE: downinterfaces -# KEYWORD: nostart shutdown - -$_rc_subr_loaded . /etc/rc.subr - -name="downinterfaces" -start_cmd=":" -stop_cmd="downinterfaces_stop" - -downinterfaces_stop() -{ - tmp=$(ifconfig -lu) - iflist="" - for int in $tmp; do - case $int in - pppoe*) iflist="$iflist $int" - ;; - esac - done - iflist="$iflist $force_down_interfaces" - if [ "$iflist" != "" ] && [ "$iflist" != " " ] - then - - echo "Shutting down interfaces:$iflist" - for int in $iflist; do - ifconfig $int down - done - fi -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/fsck b/etc/rc.d/fsck deleted file mode 100755 index 57edfae67..000000000 --- a/etc/rc.d/fsck +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# MINIX 3 stub. - -# PROVIDE: fsck -# REQUIRE: DISKS diff --git a/etc/rc.d/ftpd b/etc/rc.d/ftpd deleted file mode 100755 index e04be0a04..000000000 --- a/etc/rc.d/ftpd +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh -# -# $NetBSD: ftpd,v 1.3 2005/08/09 14:59:33 peter Exp $ -# - -# PROVIDE: ftpd -# REQUIRE: LOGIN -# KEYWORD: shutdown - -$_rc_subr_loaded . /etc/rc.subr - -name="ftpd" -rcvar=$name -command="/usr/libexec/${name}" -command_args="-D" -pidfile="/var/run/${name}.pid" - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/inetd b/etc/rc.d/inetd deleted file mode 100755 index f63adbad8..000000000 --- a/etc/rc.d/inetd +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh -# -# $NetBSD: inetd,v 1.7 2004/08/13 18:08:03 mycroft Exp $ -# - -# PROVIDE: inetd -# REQUIRE: DAEMON LOGIN -# KEYWORD: shutdown - -$_rc_subr_loaded . /etc/rc.subr - -name="inetd" -rcvar=$name -command="/usr/sbin/${name}" -pidfile="/var/run/${name}.pid" -required_files="/etc/${name}.conf" -extra_commands="reload" - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter deleted file mode 100755 index 0a590410b..000000000 --- a/etc/rc.d/ipfilter +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -# -# $NetBSD: ipfilter,v 1.18 2009/03/23 18:52:02 hannken Exp $ -# - -# PROVIDE: ipfilter -# REQUIRE: root bootconf mountcritlocal tty - -$_rc_subr_loaded . /etc/rc.subr - -name="ipfilter" -rcvar=$name -start_precmd="ipfilter_prestart" -start_cmd="ipfilter_start" -stop_precmd="test -f /etc/ipf.conf -o -f /etc/ipf6.conf" -stop_cmd="ipfilter_stop" -reload_precmd="$stop_precmd" -reload_cmd="ipfilter_reload" -resync_precmd="$stop_precmd" -resync_cmd="ipfilter_resync" -status_precmd="$stop_precmd" -status_cmd="ipfilter_status" -extra_commands="reload resync status" - -ipfilter_prestart() -{ - if [ ! -f /etc/ipf.conf ] && [ ! -f /etc/ipf6.conf ]; then - warn "/etc/ipf*.conf not readable; ipfilter start aborted." - - stop_boot - return 1 - fi - return 0 -} - -ipfilter_start() -{ - echo "Enabling ipfilter." - /sbin/ipf ${rc_flags} -E - - # Do the flush first; since older ipf has different semantics. - # - if [ -f /etc/ipf.conf ]; then - /sbin/ipf -Fa - fi - if [ -f /etc/ipf6.conf ]; then - /sbin/ipf -6 -Fa - fi - - # Now load the config files - # - if [ -f /etc/ipf.conf ]; then - /sbin/ipf -f /etc/ipf.conf - fi - if [ -f /etc/ipf6.conf ]; then - /sbin/ipf -6 -f /etc/ipf6.conf - fi -} - -ipfilter_stop() -{ - echo "Disabling ipfilter." - /sbin/ipf -D -} - -ipfilter_reload() -{ - echo "Reloading ipfilter rules." - - # Do the flush first; since older ipf has different semantics. - # - if [ -f /etc/ipf.conf ]; then - /sbin/ipf -I -Fa - fi - if [ -f /etc/ipf6.conf ]; then - /sbin/ipf -6 -I -Fa - fi - - # Now load the config files into the Inactive set - # - if [ -f /etc/ipf.conf ] && ! /sbin/ipf -I -f /etc/ipf.conf; then - err 1 "reload of ipf.conf failed; not swapping to new ruleset." - fi - if [ -f /etc/ipf6.conf ] && ! /sbin/ipf -I -6 -f /etc/ipf6.conf; then - err 1 "reload of ipf6.conf failed; not swapping to new ruleset." - fi - - # Swap in the new rules - # - /sbin/ipf -s -} - -ipfilter_resync() -{ - /sbin/ipf -y -} - -ipfilter_status() -{ - /sbin/ipf -V -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/ipsec b/etc/rc.d/ipsec deleted file mode 100755 index d5fc0caf7..000000000 --- a/etc/rc.d/ipsec +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh -# -# $NetBSD: ipsec,v 1.13 2013/09/12 19:52:50 christos Exp $ -# - -# PROVIDE: ipsec -# REQUIRE: root bootconf mountcritlocal tty -# BEFORE: DAEMON - -$_rc_subr_loaded . /etc/rc.subr - -name="ipsec" -rcvar=$name -start_precmd="ipsec_prestart" -start_cmd="ipsec_start" -stop_precmd="test -f /etc/ipsec.conf" -stop_cmd="ipsec_stop" -reload_cmd="ipsec_reload" -extra_commands="reload" - -ipsec_prestart() -{ - if [ ! -f /etc/ipsec.conf ]; then - warn "/etc/ipsec.conf not readable; ipsec start aborted." - - stop_boot - return 1 - fi - return 0 -} - -ipsec_getip() { - ifconfig $1 | while read what address rest; do - case "$what" in - inet) echo "$address";; - esac - done -} - -ipsec_load() { - if [ -z "$1" ]; then - /sbin/setkey -f /etc/ipsec.conf - else - sed -e "s/@LOCAL_ADDR@/$1/" < /etc/ipsec.conf | \ - /sbin/setkey -f - - fi -} - -ipsec_configure() { - while true; do - local addr="$(ipsec_getip "$ipsec_flags")" - case "$addr" in - '') sleep 1;; - "0.0.0.0") sleep 1;; - *) ipsec_load "$addr"; return;; - esac - done & -} - -ipsec_start() -{ - echo "Installing ipsec manual keys/policies." - if [ -n "$ipsec_flags" ]; then - ipsec_configure - else - ipsec_load - fi -} - -ipsec_stop() -{ - echo "Clearing ipsec manual keys/policies." - - # still not 100% sure if we would like to do this. - # it is very questionable to do this during shutdown session, since - # it can hang any of remaining IPv4/v6 session. - # - /sbin/setkey -F - /sbin/setkey -FP -} - -ipsec_reload() -{ - echo "Reloading ipsec manual keys/policies." - ipsec_stop - ipsec_start -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/local b/etc/rc.d/local deleted file mode 100755 index 4ba600176..000000000 --- a/etc/rc.d/local +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh -# -# $NetBSD: local,v 1.7 2004/08/13 18:08:03 mycroft Exp $ -# - -# REQUIRE: DAEMON -# PROVIDE: local -# BEFORE: LOGIN -# KEYWORD: shutdown - -$_rc_subr_loaded . /etc/rc.subr - -name="local" -start_cmd="local_start" -stop_cmd="local_stop" - -local_start() -{ - if [ -f /etc/rc.local ]; then - . /etc/rc.local - fi -} - -local_stop() -{ - if [ -f /etc/rc.shutdown.local ]; then - . /etc/rc.shutdown.local - fi -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/minixrc b/etc/rc.d/minixrc deleted file mode 100755 index 07aa251f5..000000000 --- a/etc/rc.d/minixrc +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh -# MINIX 3 bridge from NetBSD rc to MINIX rc. Must be called as the very first -# script at startup (hence the current 'before'). Ideally the MINIX rc would -# be decomposed into a number of small rc scripts, though. - -# PROVIDE: minixrc -# BEFORE: DISKS -# KEYWORD: shutdown - -$_rc_subr_loaded . /etc/rc.subr - -name="minixrc" -start_cmd="sh /etc/rc.minix start" -stop_cmd="sh /etc/rc.minix stop" - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/mountcritlocal b/etc/rc.d/mountcritlocal deleted file mode 100755 index 02d0655ee..000000000 --- a/etc/rc.d/mountcritlocal +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# MINIX 3 stub. - -# PROVIDE: mountcritlocal -# REQUIRE: fsck diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote deleted file mode 100755 index b47dd5928..000000000 --- a/etc/rc.d/mountcritremote +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh -# MINIX 3 stub. -# Even though this script does not appear to do much, it will in some cases -# invoke the mount command with a syntax that we do not support. - -# PROVIDE: mountcritremote -# REQUIRE: NETWORKING root mountcritlocal diff --git a/etc/rc.d/named b/etc/rc.d/named deleted file mode 100755 index e84d91099..000000000 --- a/etc/rc.d/named +++ /dev/null @@ -1,146 +0,0 @@ -#!/bin/sh -# -# $NetBSD: named,v 1.25 2014/07/13 22:06:56 tls Exp $ -# - -# PROVIDE: named -# REQUIRE: NETWORKING mountcritremote syslogd -# BEFORE: DAEMON -# KEYWORD: chrootdir - -$_rc_subr_loaded . /etc/rc.subr - -name="named" -rcvar=$name -command="/usr/sbin/${name}" -pidfile="/var/run/${name}/${name}.pid" -start_precmd="named_precmd" -extra_commands="reload" -required_dirs="$named_chrootdir" # if it is set, it must exist - -named_migrate() -{ - local src="$1" - local dst="$2$1" - echo "Migrating $src to $dst" -( - diff=false - cd "$src" - mkdir -p "$dst" - for f in $(find . -type f) - do - f="${f##./}" - case "$f" in - */*) - ds="$(dirname "$f")" - dd="$dst/$ds" - mkdir -p "$dd" - chmod "$(stat -f "%p" "$ds" | - sed -e 's/.*\([0-7][0-7][0-7][0-7]\)$/\1/g')" "$dd" - chown "$(stat -f %u:%g "$ds")" "$dd" - ;; - *) - ;; - esac - if [ -r "$dst/$f" ] - then - if ! cmp "$f" "$dst/$f"; then - diff=true - fi - else - cp -p "$f" "$dst/$f" - fi - done - if $diff; then - echo "Cannot complete migration because files are different" - echo "Run 'diff -r $src $dst' resolve the differences" - else - rm -fr "$src" - ln -s "$dst" "$src" - fi -) -} - -named_precmd() -{ - if [ ! -e "/etc/rndc.key" ]; then - echo "Generating rndc.key" - /usr/sbin/rndc-confgen -a - fi - - if [ -z "$named_chrootdir" ]; then - if [ ! -d "/etc/namedb/keys" ]; then - mkdir -m 775 "/etc/namedb/keys" - chown named:named "/etc/namedb/keys" - fi - return 0; - fi - - # If running in a chroot cage, ensure that the appropriate files - # exist inside the cage, as well as helper symlinks into the cage - # from outside. - # - # As this is called after the is_running and required_dir checks - # are made in run_rc_command(), we can safely assume ${named_chrootdir} - # exists and named isn't running at this point (unless forcestart - # is used). - # - case "$($command -v)" in - BIND*) # 9 no group, named-xfer, or ndc - ;; - named*) # 4 and 8 - rc_flags="-g named $rc_flags" - if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \ - "${named_chrootdir}/usr/libexec/named-xfer" -ot \ - /usr/libexec/named-xfer ]; then - rm -f "${named_chrootdir}/usr/libexec/named-xfer" - cp -p /usr/libexec/named-xfer \ - "${named_chrootdir}/usr/libexec" - fi - ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc - ;; - esac - - for i in null random urandom; do - if [ ! -c "${named_chrootdir}/dev/$i" ]; then - rm -f "${named_chrootdir}/dev/$i" - (cd /dev && - /bin/pax -rw -pe "$i" "${named_chrootdir}/dev") - fi - done - - if [ ! -h /etc/namedb ]; then - named_migrate /etc/namedb ${named_chrootdir} - fi - - for i in named.conf rndc.key; do - if [ \( -r "/etc/$i" \) -a \( ! -h "/etc/$i" \) -a \ - \( ! -r "${named_chrootdir}/etc/$i" \) ]; then - mv "/etc/$i" "${named_chrootdir}/etc/$i" - ln -s "${named_chrootdir}/etc/$i" "/etc/$i" - fi - done - - if [ \( ! -r ${named_chrootdir}/etc/named.conf \) -a \ - \( -r ${named_chrootdir}/etc/namedb/named.conf \) ]; then - ln -s namedb/named.conf ${named_chrootdir}/etc - fi - - if [ -f /etc/localtime ]; then - cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \ - cp -p /etc/localtime "${named_chrootdir}/etc/localtime" - fi - - local piddir="$(dirname "${pidfile}")" - mkdir -p "${named_chrootdir}${piddir}" "${piddir}" - chmod 755 "${named_chrootdir}${piddir}" "${piddir}" - chown named:named "${named_chrootdir}${piddir}" "${piddir}" - ln -fs "${named_chrootdir}${pidfile}" "${pidfile}" - - # Change run_rc_commands()'s internal copy of $named_flags - # - rc_flags="-u named -t ${named_chrootdir} $rc_flags" -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/network b/etc/rc.d/network deleted file mode 100755 index ac41ebb80..000000000 --- a/etc/rc.d/network +++ /dev/null @@ -1,546 +0,0 @@ -#!/bin/sh -# -# $NetBSD: network,v 1.69 2014/10/14 20:49:47 christos Exp $ -# - -# PROVIDE: network -# REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl -# BEFORE: NETWORKING - -$_rc_subr_loaded . /etc/rc.subr - -name="network" -start_cmd="network_start" -stop_cmd="network_stop" - -nl=' -' # a newline - -intmissing() -{ - local int="$1" - shift - for i; do - if [ "$int" = "$i" ]; then - return 1 - fi - done - return 0 -} - -have_inet6() -{ - /sbin/ifconfig lo0 inet6 >/dev/null 2>&1 -} - -network_start() -{ - # set hostname, turn on network - # - echo "Starting network." - - network_start_hostname - network_start_domainname - network_start_loopback - have_inet6 && - network_start_ipv6_route - [ "$net_interfaces" != NO ] && - network_start_interfaces - network_start_aliases - network_start_defaultroute - network_start_defaultroute6 - have_inet6 && - network_start_ipv6_autoconf - network_start_local -} - -network_start_hostname() -{ - # If $hostname is set, use it for my Internet name, - # otherwise use /etc/myname - # - if [ -z "$hostname" ] && [ -f /etc/myname ]; then - hostname=$(cat /etc/myname) - fi - if [ -n "$hostname" ]; then - echo "Hostname: $hostname" - hostname $hostname - else - # Don't warn about it if we're going to run - # DHCP later, as we will probably get the - # hostname at that time. - # - if ! checkyesno dhclient && ! checkyesno dhcpcd && \ - [ -z "$(hostname)" ] - then - warn "\$hostname not set." - fi - fi -} - -network_start_domainname() -{ - # Check $domainname first, then /etc/defaultdomain, - # for NIS/YP domain name - # - if [ -z "$domainname" ] && [ -f /etc/defaultdomain ]; then - domainname=$(cat /etc/defaultdomain) - fi - if [ -n "$domainname" ]; then - echo "NIS domainname: $domainname" - domainname $domainname - fi - - # Flush all routes just to make sure it is clean - if checkyesno flushroutes; then - /sbin/route -qn flush - fi -} - -network_start_loopback() -{ - # Set the address for the first loopback interface, so that the - # auto-route from a newly configured interface's address to lo0 - # works correctly. - # - # NOTE: obscure networking problems will occur if lo0 isn't configured. - # - /sbin/ifconfig lo0 inet 127.0.0.1 - - # According to RFC1122, 127.0.0.0/8 must not leave the node. - # - /sbin/route -q add -inet 127.0.0.0 -netmask 0xff000000 127.0.0.1 -reject -} - -network_start_ipv6_route() -{ - # IPv6 routing setups, and host/router mode selection. - # - # We have IPv6 support in kernel. - - # disallow link-local unicast dest without outgoing scope - # identifiers. - # - /sbin/route -q add -inet6 fe80:: -prefixlen 10 ::1 -reject - - # disallow the use of the RFC3849 documentation address - # - /sbin/route -q add -inet6 2001:db8:: -prefixlen 32 ::1 -reject - - # IPv6 site-local scoped address prefix (fec0::/10) - # has been deprecated by RFC3879. - # - if [ -n "$ip6sitelocal" ]; then - warn "\$ip6sitelocal is no longer valid" - fi - - # disallow "internal" addresses to appear on the wire. - # - /sbin/route -q add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject - - # disallow packets to malicious IPv4 compatible prefix - # - /sbin/route -q add -inet6 ::224.0.0.0 -prefixlen 100 ::1 -reject - /sbin/route -q add -inet6 ::127.0.0.0 -prefixlen 104 ::1 -reject - /sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject - /sbin/route -q add -inet6 ::255.0.0.0 -prefixlen 104 ::1 -reject - - # disallow packets to malicious 6to4 prefix - # - /sbin/route -q add -inet6 2002:e000:: -prefixlen 20 ::1 -reject - /sbin/route -q add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject - /sbin/route -q add -inet6 2002:0000:: -prefixlen 24 ::1 -reject - /sbin/route -q add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject - - # Completely disallow packets to IPv4 compatible prefix. - # This may conflict with RFC1933 under following circumstances: - # (1) An IPv6-only KAME node tries to originate packets to IPv4 - # compatible destination. The KAME node has no IPv4 - # compatible support. Under RFC1933, it should transmit - # native IPv6 packets toward IPv4 compatible destination, - # hoping it would reach a router that forwards the packet - # toward auto-tunnel interface. - # (2) An IPv6-only node originates a packet to IPv4 compatible - # destination. A KAME node is acting as an IPv6 router, and - # asked to forward it. - # Due to rare use of IPv4 compatible address, and security - # issues with it, we disable it by default. - # - /sbin/route -q add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject - - /sbin/sysctl -qw net.inet6.ip6.forwarding=0 - /sbin/sysctl -qw net.inet6.ip6.accept_rtadv=0 - - case $ip6mode in - router) - echo 'IPv6 mode: router' - /sbin/sysctl -qw net.inet6.ip6.forwarding=1 - - # disallow unique-local unicast forwarding without - # explicit configuration. - if ! checkyesno ip6uniquelocal; then - /sbin/route -q add -inet6 fc00:: -prefixlen 7 \ - ::1 -reject - fi - ;; - - autohost) - echo 'IPv6 mode: autoconfigured host' - /sbin/sysctl -qw net.inet6.ip6.accept_rtadv=1 - ;; - - host) - echo 'IPv6 mode: host' - ;; - - *) warn "invalid \$ip6mode value "\"$ip6mode\" - ;; - - esac -} - -network_start_interfaces() -{ - # Configure all of the network interfaces listed in $net_interfaces; - # if $auto_ifconfig is YES, grab all interfaces from ifconfig. - # In the following, "xxN" stands in for interface names, like "le0". - # - # For any interfaces that has an $ifconfig_xxN variable - # associated, we break it into lines using ';' as a separator, - # then process it just like the contents of an /etc/ifconfig.xxN - # file. - # - # For each line from the $ifconfig_xxN variable or the - # /etc/ifconfig.xxN file, we ignore comments and blank lines, - # treat lines beginning with "!" as commands to execute, treat - # "dhcp" as a special case to invoke dhcpcd, and for any other - # line we run "ifconfig xxN", using each line of the file as the - # arguments for a separate "ifconfig" invocation. - # - # In order to configure an interface reasonably, you at the very least - # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"), - # and probably a netmask (as in "netmask 0xffffffe0"). You will - # frequently need to specify a media type, as in "media UTP", for - # interface cards with multiple media connections that do not - # autoconfigure. See the ifconfig manual page for details. - # - # Note that /etc/ifconfig.xxN takes multiple lines. The following - # configuration is possible: - # inet 10.1.1.1 netmask 0xffffff00 - # inet 10.1.1.2 netmask 0xffffff00 alias - # inet6 2001:db8::1 prefixlen 64 alias - # - # You can put shell script fragment into /etc/ifconfig.xxN by - # starting a line with "!". Refer to ifconfig.if(5) for details. - # - ifaces="$(/sbin/ifconfig -l)" - if checkyesno auto_ifconfig; then - tmp="$ifaces" - for cloner in $(/sbin/ifconfig -C); do - for int in /etc/ifconfig.${cloner}[0-9]*; do - [ ! -f $int ] && break - tmp="$tmp ${int##*.}" - done - done - else - tmp="$net_interfaces" - fi - echo -n 'Configuring network interfaces:' - for int in $tmp; do - eval argslist=\$ifconfig_$int - - # Skip interfaces that do not have explicit - # configuration information. If auto_ifconfig is - # false then also warn about such interfaces. - # - if [ -z "$argslist" ] && ! [ -f /etc/ifconfig.$int ] - then - if ! checkyesno auto_ifconfig; then - echo - warn \ - "/etc/ifconfig.$int missing and ifconfig_$int not set;" - warn "interface $int not configured." - fi - continue - fi - - echo -n " $int" - - # Create the interface if necessary. - # If the interface did not exist before, - # then also resync ipf(4). - # - if intmissing $int $ifaces; then - if /sbin/ifconfig $int create && \ - checkyesno ipfilter; then - /sbin/ipf -y >/dev/null - fi - fi - - # If $ifconfig_xxN is empty, then use - # /etc/ifconfig.xxN, which we know exists due to - # an earlier test. - # - # If $ifconfig_xxN is non-empty and contains a - # newline, then just use it as is. (This allows - # semicolons through unmolested.) - # - # If $ifconfig_xxN is non-empty and does not - # contain a newline, then convert all semicolons - # to newlines. - # - case "$argslist" in - '') - cat /etc/ifconfig.$int - ;; - *"${nl}"*) - echo "$argslist" - ;; - *) - ( - set -o noglob - IFS=';'; set -- $argslist - #echo >&2 "[$#] [$1] [$2] [$3] [$4]" - IFS="$nl"; echo "$*" - ) - ;; - esac | - collapse_backslash_newline | - while read -r args; do - case "$args" in - ''|"#"*|create) - ;; - "!"*) - # Run arbitrary command in a subshell. - ( eval "${args#*!}" ) - ;; - dhcp) - if ! checkyesno dhcpcd; then - /sbin/dhcpcd -n \ - ${dhcpcd_flags} $int - fi - ;; - *) - # Pass args to ifconfig. Note - # that args may contain embedded - # shell metacharacters, such as - # "ssid 'foo;*>bar'". We eval - # one more time so that things - # like ssid "Columbia University" work. - ( - set -o noglob - eval set -- $args - #echo >&2 "[$#] [$1] [$2] [$3]" - /sbin/ifconfig $int "$@" - ) - ;; - esac - done - configured_interfaces="$configured_interfaces $int" - done - echo "." -} - -network_start_aliases() -{ - echo -n "Adding interface aliases:" - - # Check if each configured interface xxN has an $ifaliases_xxN variable - # associated, then configure additional IP addresses for that interface. - # The variable contains a list of "address netmask" pairs, with - # "netmask" set to "-" if the interface default netmask is to be used. - # - # Note that $ifaliases_xxN works only in certain cases and its - # use is not recommended. Use /etc/ifconfig.xxN or multiple - # commands in $ifconfig_xxN instead. - # - for int in lo0 $configured_interfaces; do - eval args=\$ifaliases_$int - if [ -n "$args" ]; then - set -- $args - while [ $# -ge 2 ]; do - addr=$1 ; net=$2 ; shift 2 - if [ "$net" = "-" ]; then - # for compatibility only, obsolete - /sbin/ifconfig $int inet alias $addr - else - /sbin/ifconfig $int inet alias $addr \ - netmask $net - fi - echo -n " $int:$addr" - done - fi - done - - # /etc/ifaliases, if it exists, contains the names of additional IP - # addresses for each interface. It is formatted as a series of lines - # that contain - # address interface netmask - # - # Note that /etc/ifaliases works only in certain cases and its - # use is not recommended. Use /etc/ifconfig.xxN or multiple - # commands in $ifconfig_xxN instead. - # - if [ -f /etc/ifaliases ]; then - while read addr int net; do - if [ -z "$net" ]; then - # for compatibility only, obsolete - /sbin/ifconfig $int inet alias $addr - else - /sbin/ifconfig $int inet alias $addr netmask $net - fi - done < /etc/ifaliases - fi - - echo "." # for "Adding interface aliases:" -} - -network_start_defaultroute() -{ - # Check $defaultroute, then /etc/mygate, for the name or address - # of my IPv4 gateway host. If using a name, that name must be in - # /etc/hosts. - # - if [ -z "$defaultroute" ] && [ -f /etc/mygate ]; then - defaultroute=$(cat /etc/mygate) - fi - if [ -n "$defaultroute" ]; then - /sbin/route add default $defaultroute - fi -} - -network_start_defaultroute6() -{ - # Check $defaultroute6, then /etc/mygate6, for the name or address - # of my IPv6 gateway host. If using a name, that name must be in - # /etc/hosts. Note that the gateway host address must be a link-local - # address if it is not using an stf* interface. - # - if [ -z "$defaultroute6" ] && [ -f /etc/mygate6 ]; then - defaultroute6=$(cat /etc/mygate6) - fi - if [ -n "$defaultroute6" ]; then - if [ "$ip6mode" = "autohost" ]; then - echo - warn \ - "ip6mode is set to 'autohost' and a v6 default route is also set." - fi - /sbin/route add -inet6 default $defaultroute6 - fi -} - -network_start_ipv6_autoconf() -{ - # IPv6 interface autoconfiguration. - - dadcount=$(/sbin/sysctl -n net.inet6.ip6.dad_count 2>/dev/null) - if [ -n "$dadcount" -a "$dadcount" != 0 ]; then - # wait till DAD is completed - echo 'Waiting for DAD to complete for' \ - 'statically configured addresses...' - # Add 1 for MAX_RTR_SOLICITATION_DELAY and another - # to give time for the last DAD packet to respond and - # a few more for luck. - waitsecs=$((dadcount + 4)) - /sbin/ifconfig -w $waitsecs - fi - - # dhcpcd will ensure DAD completes before forking - if checkyesnox rtsol && ! checkyesno dhcpcd; then - if [ "$ip6mode" = "autohost" ]; then - echo - warn "rtsol has been removed, " \ - "please configure dhcpcd in its place." - fi - fi -} - -network_start_local() -{ - # XXX this must die - if [ -s /etc/netstart.local ]; then - sh /etc/netstart.local start - fi -} - -network_stop() -{ - echo "Stopping network." - - network_stop_local - network_stop_aliases - [ "$net_interfaces" != NO ] && - network_stop_interfaces - network_stop_route -} - -network_stop_local() -{ - # XXX this must die - if [ -s /etc/netstart.local ]; then - sh /etc/netstart.local stop - fi -} - -network_stop_aliases() -{ - echo "Deleting aliases." - if [ -f /etc/ifaliases ]; then - while read addr int net; do - /sbin/ifconfig $int inet delete $addr - done < /etc/ifaliases - fi - - for int in $(/sbin/ifconfig -lu); do - eval args=\$ifaliases_$int - if [ -n "$args" ]; then - set -- $args - while [ $# -ge 2 ]; do - addr=$1 ; net=$2 ; shift 2 - /sbin/ifconfig $int inet delete $addr - done - fi - done -} - -network_stop_interfaces() -{ - # down interfaces - # - echo -n 'Downing network interfaces:' - if checkyesno auto_ifconfig; then - tmp=$(/sbin/ifconfig -l) - else - tmp="$net_interfaces" - fi - for int in $tmp; do - eval args=\$ifconfig_$int - if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then - echo -n " $int" - if [ -f /var/run/dhcpcd-$int.pid ]; then - /sbin/dhcpcd -k $int 2> /dev/null - fi - /sbin/ifconfig $int down - if /sbin/ifconfig $int destroy 2>/dev/null && \ - checkyesno ipfilter; then - # resync ipf(4) - /sbin/ipf -y >/dev/null - fi - fi - done - echo "." -} - -network_stop_route() -{ - # flush routes - # - /sbin/route -qn flush - -} - -load_rc_config $name -load_rc_config_var dhclient dhclient -load_rc_config_var dhcpcd dhcpcd -load_rc_config_var ipfilter ipfilter -run_rc_command "$1" diff --git a/etc/rc.d/npf b/etc/rc.d/npf deleted file mode 100644 index f1b58e003..000000000 --- a/etc/rc.d/npf +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh -# -# $NetBSD: npf,v 1.3 2012/11/01 06:06:14 mrg Exp $ -# -# Public Domain. -# - -# PROVIDE: npf -# REQUIRE: root bootconf mountcritlocal tty network -# BEFORE: NETWORKING - -$_rc_subr_loaded . /etc/rc.subr - -name="npf" -rcvar=$name - -config="/etc/npf.conf" - -start_cmd="npf_start" -stop_cmd="npf_stop" - -reload_cmd="npf_reload" -status_cmd="npf_status" -extra_commands="reload status" - -npf_cfg_check() -{ - if [ ! -f ${config} ]; then - warn "${config} is not readable; failed." - exit 1 - fi -} - -npf_start() -{ - echo "Enabling NPF." - npf_cfg_check - /sbin/npfctl reload - /sbin/npfctl start -} - -npf_stop() -{ - echo "Disabling NPF." - /sbin/npfctl stop - /sbin/npfctl flush -} - -npf_reload() -{ - echo "Reloading NPF ruleset." - npf_cfg_check - /sbin/npfctl reload -} - -npf_status() -{ - : -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/pwcheck b/etc/rc.d/pwcheck deleted file mode 100755 index 1982797cd..000000000 --- a/etc/rc.d/pwcheck +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/sh -# -# $NetBSD: pwcheck,v 1.5 2004/08/13 18:08:03 mycroft Exp $ -# - -# PROVIDE: pwcheck -# REQUIRE: mountcritremote syslogd -# BEFORE: DAEMON - -$_rc_subr_loaded . /etc/rc.subr - -name="pwcheck" -start_cmd="pwcheck_start" -stop_cmd=":" - -pwcheck_start() -{ - # check the password temp/lock file - # - if [ -f /etc/ptmp ]; then - logger -s -p auth.err \ - "password file may be incorrect -- /etc/ptmp exists" - fi -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/root b/etc/rc.d/root deleted file mode 100755 index 37b9f6b38..000000000 --- a/etc/rc.d/root +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -# MINIX 3 stub. - -# PROVIDE: root diff --git a/etc/rc.d/rtadvd b/etc/rc.d/rtadvd deleted file mode 100755 index 5fe67720f..000000000 --- a/etc/rc.d/rtadvd +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/sh -# -# $NetBSD: rtadvd,v 1.8 2013/07/09 09:34:58 roy Exp $ -# - -# PROVIDE: rtadvd -# REQUIRE: DAEMON -# BEFORE: LOGIN - -$_rc_subr_loaded . /etc/rc.subr - -name=rtadvd -rcvar=$name -command="/usr/sbin/$name" -pidfile="/var/run/$name.pid" -extra_commands=reload -start_precmd=rtadvd_prestart -reload_precmd=rtadvd_prereload - -rtadvd_prereload() -{ - local chdir="$(getent passwd _rtadvd | cut -d: -f6)" - local conf=/etc/rtadvd.conf myflags o confdir - - [ -z "$chdir" -o "$chdir" = / ] && return 0 - - if [ -n "$flags" ]; then - myflags=$flags - else - eval myflags=\$${name}_flags - fi - set -- ${myflags} - while getopts c:dDfM:Rs o; do - case "$1" in - -c) conf="$OPTARG";; - esac - shift - done - confdir=$(dirname "$conf") - - echo "$name: copying $conf to $chdir$conf" - cp "$conf" "$chdir$conf" - - # Provide a link to the chrooted dump file - ln -snf "$chdir/var/run/$name.dump" /var/run -} - -rtadvd_prestart() -{ - if [ "$ip6mode" != router ]; then - warn \ - "${name} cannot be used on IPv6 host, only on an IPv6 router." - return 1 - fi - - rtadvd_prereload -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/staticroute b/etc/rc.d/staticroute deleted file mode 100755 index c0804a3a9..000000000 --- a/etc/rc.d/staticroute +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# -# $NetBSD: staticroute,v 1.6 2012/05/02 15:57:15 gendalia Exp $ -# - -# PROVIDE: staticroute -# REQUIRE: network -# BEFORE: NETWORKING - -# See the route.conf(5) manual page for details. - -$_rc_subr_loaded . /etc/rc.subr - -name="staticroute" -start_cmd="staticroute_doit Adding add" -stop_cmd="staticroute_doit Deleting delete" - -staticroute_doit() { - retval=0 - - if [ -s /etc/route.conf ]; then - echo "$1 static routes." - ( while read args; do - [ -z "$args" ] && continue - case "$args" in - "#"*) - ;; - "+"*) - if [ $2 = "add" ]; then - eval "${args#*+}" || retval=1 - fi - ;; - "-"*) - if [ $2 = "delete" ]; then - eval "${args#*-}" || retval=1 - fi - ;; - "!"*) - eval "${args#*!}" || retval=1 - ;; - *) - eval "route -q $2 -$args" || retval=1 - ;; - esac - done < /etc/route.conf ) - fi - - return $retval -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/sysctl b/etc/rc.d/sysctl deleted file mode 100755 index d34d3ef91..000000000 --- a/etc/rc.d/sysctl +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/sh -# -# $NetBSD: sysctl,v 1.13 2004/08/13 18:08:03 mycroft Exp $ -# - -# PROVIDE: sysctl -# REQUIRE: root ipfilter ipsec -# BEFORE: DAEMON - -$_rc_subr_loaded . /etc/rc.subr - -name="sysctl" -start_cmd="sysctl_start" -stop_cmd=":" - -sysctl_start() -{ - if [ -r /etc/sysctl.conf ]; then - echo "Setting sysctl variables:" - sysctl -f /etc/sysctl.conf - fi -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/sysdb b/etc/rc.d/sysdb deleted file mode 100755 index 2e3003c0d..000000000 --- a/etc/rc.d/sysdb +++ /dev/null @@ -1,93 +0,0 @@ -#!/bin/sh -# -# $NetBSD: sysdb,v 1.24 2012/06/03 21:42:45 joerg Exp $ -# - -# PROVIDE: sysdb -# REQUIRE: mountcritremote -# BEFORE: DAEMON - -$_rc_subr_loaded . /etc/rc.subr - -name="sysdb" -rcvar=$name -start_cmd="sysdb_start" -stop_cmd=":" -extra_commands="devdb utmp services netgroup password" -devdb_cmd="build_devdb" -utmp_cmd="build_utmp" -services_cmd="build_services" -netgroup_cmd="build_netgroup" -password_cmd="build_password" -echo=: - -sysdb_start() -{ - echo -n "Building databases:" - echo=echo - comma=" " - $devdb_cmd - $utmp_cmd - $services_cmd - $netgroup_cmd - $password_cmd - echo "." -} - -check_file() -{ - local src="$1" - local db="$2" - - shift 2 - if [ ! -e "$src" ]; then - return - fi - if [ \( ! -f "$db" \) -o \( "$src" -nt "$db" \) ]; then - $echo -n "$comma$(basename "$src")" - comma=", " - "$@" - fi -} - -build_services() -{ - check_file /etc/services /var/db/services.cdb services_mkdb -q -} - -build_netgroup() -{ - check_file /etc/netgroup /var/db/netgroup.db netgroup_mkdb -} - -build_devdb() -{ - check_file /dev /var/run/dev.db dev_mkdb - check_file /dev /var/run/dev.cdb dev_mkdb -} - -build_password() -{ - local p=/etc/master.passwd - check_file $p /etc/spwd.db pwd_mkdb -w $p -} - -build_utmp() -{ - # Re-create /var/run/utmp and /var/run/utmpx, which are - # deleted by mountcritlocal but can't be recreated by it - # because install and chown may not be available then - # (possibly no /usr). - # - local i - for i in "" x; do - if [ ! -f /var/run/utmp$i ]; then - $echo -n "${comma}utmp$i" - comma=", " - install -c -m 664 -g utmp /dev/null /var/run/utmp$i - fi - done -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/syslogd b/etc/rc.d/syslogd deleted file mode 100755 index b467acac9..000000000 --- a/etc/rc.d/syslogd +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -# -# $NetBSD: syslogd,v 1.15 2004/10/11 13:29:52 lukem Exp $ -# - -# PROVIDE: syslogd -# REQUIRE: mountcritremote sysdb wscons -# BEFORE: SERVERS - -$_rc_subr_loaded . /etc/rc.subr - -name="syslogd" -rcvar=$name -command="/usr/sbin/${name}" -pidfile="/var/run/${name}.pid" -required_files="/etc/syslog.conf" -start_precmd="syslogd_precmd" -extra_commands="reload" - -_sockfile="/var/run/syslogd.sockets" - -syslogd_precmd() -{ - # Transitional symlink for old binaries - # - # MINIX 3: unsupported, disabled - #if [ ! -h /dev/log ]; then - # ln -sf /var/run/log /dev/log - #fi - # MINIX 3: end - - # Create default list of syslog sockets to watch - # - ( umask 022 ; > $_sockfile ) - - # Find /etc/rc.d scripts with "chrootdir" rcorder(8) keyword, - # and if $${app}_chrootdir is a directory, add appropriate - # syslog socket to list of sockets to watch. - # - for _lr in $(rcorder -k chrootdir /etc/rc.d/*); do - ( - _l=${_lr##*/} - load_rc_config ${_l} - eval _ldir=\$${_l}_chrootdir - if checkyesno $_l && [ -n "$_ldir" ]; then - echo "${_ldir}/var/run/log" >> $_sockfile - fi - ) - done - - # If other sockets have been provided, change run_rc_command()'s - # internal copy of $syslogd_flags to force use of specific - # syslogd sockets. - # - if [ -s $_sockfile ]; then - echo "/var/run/log" >> $_sockfile - rc_flags="-P $_sockfile $rc_flags" - fi - - return 0 -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.d/ttys b/etc/rc.d/ttys deleted file mode 100755 index 199b909be..000000000 --- a/etc/rc.d/ttys +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -# MINIX 3 stub. -# There is currently nothing in the NetBSD script that we want: setting tty -# flags is not yet a supported concept, and changing /dev/tty permissions does -# not work from the installation CD with its read-only /dev directory. - -# PROVIDE: tty -# REQUIRE: root bootconf diff --git a/etc/rc.d/wscons b/etc/rc.d/wscons deleted file mode 100755 index 33612e817..000000000 --- a/etc/rc.d/wscons +++ /dev/null @@ -1,186 +0,0 @@ -#!/bin/sh -# -# $NetBSD: wscons,v 1.13 2011/08/09 08:08:10 mbalmer Exp $ -# - -# PROVIDE: wscons -# REQUIRE: mountcritremote -# BEFORE: LOGIN - -$_rc_subr_loaded . /etc/rc.subr - -name="wscons" -rcvar=$name -start_cmd="wscons_start" -stop_cmd=":" - -wscons_start() -{ - wscfg=/usr/sbin/wsconscfg - wsfld=/usr/sbin/wsfontload - wsctl=/sbin/wsconsctl - config=/etc/wscons.conf - usage="Usage: wsconfig [-n] [-f configfile] [-font fontpgm] [-screen screenpgm]" - DOIT= - - while [ $# -gt 0 ]; do - case $1 in - -n) - DOIT=echo - ;; - -f) - config=$2 - shift - ;; - -font) - wsfld=$2 - shift - ;; - -screen) - wscfg=$2 - shift - ;; - *) - echo $usage - exit 1 - ;; - esac - shift - done - - - # args mean: - # screen idx scr emul - # font name width height enc file - ( while read type arg1 arg2 arg3 arg4 arg5; do - case "$type" in - \#*|"") - continue - ;; - - font) - name=$arg1 - width=$arg2 - height=$arg3 - enc=$arg4 - file=$arg5 - cmd=$wsfld - - case $width in - -) - ;; - *) - cmd="$cmd -w $width" - ;; - esac - case $height in - -) - ;; - *) - cmd="$cmd -h $height" - ;; - esac - case $enc in - -) - ;; - *) - cmd="$cmd -e $enc" - ;; - esac - cmd="$cmd -N $name $file" - eval $DOIT $cmd - ;; - - screen) - idx=$arg1 - scr=$arg2 - emul=$arg3 - cmd=$wscfg - - case $scr in - -) - ;; - *) - cmd="$cmd -t $scr" - ;; - esac - case $emul in - -) - ;; - *) - cmd="$cmd -e $emul" - ;; - esac - cmd="$cmd $idx" - eval $DOIT $cmd - ;; - - keyboard) - kbd=$arg1 - cmd=$wscfg - case $kbd in - -|auto) - cmd="$cmd -k" - ;; - *) - cmd="$cmd -k $kbd" - ;; - esac - eval $DOIT $cmd - ;; - - encoding) - map=$arg1 - cmd="$wsctl -w \"encoding=$map\"" - echo -n 'Keyboard ' - eval $DOIT $cmd - ;; - - mapfile) - mapfile=$arg1 - ( while read entry; do - case "$entry" in - \#*|"") - continue - ;; - *) - cmd="$wsctl -w \"map+=$entry\"" - cmd="$cmd >/dev/null" - eval $DOIT $cmd - ;; - esac - done ) < $mapfile - ;; - - mux) - cmd="$wscfg -m $arg1" - eval $DOIT $cmd - ;; - - setvar) - dev=$arg1 - var=$arg2 - val=$arg3 - - case $dev in - ttyE*) - cmdmod="-d" - ;; - wskbd*) - cmdmod="-k" - ;; - wsmouse*) - cmdmod="-m" - ;; - esac - echo -n "$dev: " - cmd="$wsctl -f /dev/$dev $cmdmod -w $var=$val" - eval $DOIT $cmd - ;; - - esac - done ) < $config -} - -load_rc_config $name -run_rc_command "$1" diff --git a/etc/rc.minix b/etc/rc.minix deleted file mode 100755 index cfcd09324..000000000 --- a/etc/rc.minix +++ /dev/null @@ -1,238 +0,0 @@ -# /etc/rc.minix - MINIX system startup script - -PATH=/sbin:/usr/sbin:/bin:/usr/bin - -# The normal system boot situation is that init(8) invokes the ramdisk RC -# script through /etc/rc.d/minixrc. With a boot ramdisk (x86_ramimage), the -# ramdisk RC is bypassed altogether, but stored as /etc/rc.ramdisk. We then -# have to invoke it here (for startup only!) to let it perform its tasks first. -if sysenv bootramdisk >/dev/null -then - [ "$1" = "start" ] && sh /etc/rc.ramdisk "$@" -fi - -# Same settings as in the default /etc/profile. We do not source this file -# as the system administrator may decide to change those values for his users. -RC_TZ=/etc/rc.timezone - -# Are we booting from CD? -bootcd="`/bin/sysenv bootcd`" - -# Set TERM to minix if not present. -TERM="${TERM-minix}" - -export TERM PATH - -# Local variables -ARCH="`sysenv arch`" - -usage() -{ - echo >&2 "Usage: $0 [-saf] [start|stop]" - exec intr sh -} - -up() -{ - # Function to dynamically start a system service - opt="" - prefix=$(expr "$1 " : '\(-\)') - if [ "$prefix" = "-" ]; - then - opt=$1 - shift - fi - service=$1 - shift - - minix-service $opt up /service/$service "$@" -} - -edit() -{ - # Function to dynamically edit system service settings - opt="" - prefix=$(expr "$1 " : '\(-\)') - if [ "$prefix" = "-" ]; - then - opt=$1 - shift - fi - service=$1 - shift - - # Assume binaries are always in /service or /usr/pkg/service - binlocation=/service/$service - if [ ! -x $binlocation ] - then binlocation=/usr/pkg/service/$service - fi - - # Mostly to find init... - if [ ! -x $binlocation ] - then binlocation=/sbin/$service - fi - minix-service $opt edit $binlocation -label $service "$@" -} - -set -- `sysenv bootopt` "$@" -while getopts 'saf' opt -do - case $opt in - s) sflag=t ;; # Single user - a) aflag=t ;; # Ask for /usr - f) fflag=-f ;; # Force a full file system check - *) usage - esac -done -shift `expr $OPTIND - 1` - -case "$#:$1" in -1:start|1:stop) - action=$1 - ;; -*) usage -esac - -case $action in -start) - # If booting from CD, we want some directories to be ramdisks - if [ ! -z "$bootcd" ] - then - . /etc/rc.cd - fi - - # National keyboard? - test -f /etc/keymap && loadkeys /etc/keymap - - # options for fsck. default is -r, which prompts the user for repairs. - optname=fsckopts - fsckopts=-p - if sysenv $optname >/dev/null - then fsckopts="`sysenv $optname`" - fi - - if [ "`sysenv debug_fkeys`" != 0 ] - then - up -n is -period 5HZ - fi - - # Set timezone. - export TZ=GMT0 - if [ -f "$RC_TZ" ] - then - . "$RC_TZ" - fi - - # Start real time clock driver & set system time, otherwise default date. - up readclock.drv - readclock -q || date 201301010000 - - # We are not shutting down. - if [ -f /etc/nologin ] - then - rm -f /etc/nologin - fi - - # Use MFS binary only from kernel image? - if [ "`sysenv bin_img`" = 1 ] - then - bin_img="-i " - fi - - # fsck + mount using /etc/fstab. - fsck -x / $fflag $fsckopts - mount -a - - if [ -z "`sysenv bootramdisk`" ] - then - # Unmount and free now defunct ramdisk - umount /dev/imgrd > /dev/null || echo "Failed to unmount boot ramdisk" - ramdisk 0 /dev/imgrd || echo "Failed to free boot ramdisk" - fi - - # Initialize files. - >/var/run/utmp # /etc/utmp keeps track of logins - >/var/run/utmpx # /etc/utmpx keeps track of logins - - # Edit settings for boot system services - if [ "`sysenv skip_boot_config`" != 1 ] - then - edit rs - edit vm - edit pm - edit sched - edit vfs - edit ds - edit tty - edit memory - edit mib - edit pfs - edit init - # - # Keep a copy around to recover the root FS from crashes - # - rootline=`cat /etc/mtab | grep "on / "` - rootfs=fs_`echo "$rootline" | cut -d' ' -f1 | cut -d'/' -f3` - [ "$rootfs" = "fs_bootramdisk" ] && rootfs=fs_imgrd - roottype=`echo "$rootline" | cut -d' ' -f5` - minix-service -c edit /service/$roottype -label $rootfs - fi - - if [ "$sflag" ] - then - echo "Single user. Press ^D to resume multiuser startup." - intr sh - echo - fi - - echo "Multiuser startup in progress ..." - - case "`printroot -r`":$bootcd in - /dev/ram:) - # Remove boot-only things to make space, - # unless booting from CD, in which case we need them. - rm -rf /boot - # put the compiler on ram - cp /usr/lib/em* /usr/lib/cpp* /lib - esac - - echo -n "Starting hotplugging infrastructure... " - rm -f /var/run/devmand.pid - devmand -d /etc/devmand -d /usr/pkg/etc/devmand & - echo "done." - - # Things should be alright now. - ;; -stop) - sync - if [ -f /var/run/devmand.pid ] - then - kill -INT `cat /var/run/devmand.pid` - # without this delay the following will - # be printed in the console - # RS: devman not running? - sleep 1 - fi - - if [ -x /service/usbd ] - then - minix-service down usbd - fi - - # Tell RS server we're going down. - minix-service shutdown - ;; -esac - -# Further initialization. -test -f /usr/etc/rc && sh /usr/etc/rc $action -test -f /usr/local/etc/rc && sh /usr/local/etc/rc $action - -# Any messages? -if [ "$action" = start ] -then if [ -f /etc/issue ] - then cat /etc/issue - fi -fi - -exit 0 diff --git a/etc/rc.shutdown b/etc/rc.shutdown deleted file mode 100644 index 20104d6e3..000000000 --- a/etc/rc.shutdown +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/sh -# -# -# rc.shutdown -- -# Run the scripts in /etc/rc.d with reverse rcorder. - -# System shutdown script run by shutdown(8) at system shutdown time. -# Note that halt(8) and reboot(8) do NOT invoke this script. - -export HOME=/ -export PATH=/sbin:/bin:/usr/sbin:/usr/bin - -. /etc/rc.subr -. /etc/rc.conf - -if ! checkyesno do_rcshutdown; then - echo "Skipping shutdown hooks." - exit 0 -fi - -stty status '^T' - -# Set shell to ignore SIGINT, but not children; -# shell catches SIGQUIT and returns to single user. -# -trap : INT -trap "echo 'Shutdown interrupted.'; exit 1" QUIT - -# If requested, start a watchdog timer in the background which -# will terminate rc.shutdown if rc.shutdown doesn't complete -# within the specified time. -# -_rcshutdown_watchdog= -if [ -n "$rcshutdown_timeout" ]; then - sleep $rcshutdown_timeout && ( - _msg="$rcshutdown_timeout second watchdog timeout expired. Shutdown terminated." - logger -t rc.shutdown "$_msg" - echo "$_msg" - date - kill -KILL $$ >/dev/null 2>&1 - ) & - _rcshutdown_watchdog=$! -fi - - -# Determine the shutdown order of the rc.d scripts, -# and perform the operation -# -scripts=$(for rcd in ${rc_directories:-/etc/rc.d}; do - test -d ${rcd} && echo ${rcd}/*; done) -files=$(rcorder -k shutdown ${rcshutdown_rcorder_flags} ${scripts}) - -for _rc_elem in $(reverse_list $files); do - run_rc_script $_rc_elem stop -done - - -# Terminate the background watchdog timer (if it is running) -# -if [ -n "$_rcshutdown_watchdog" ]; then - kill -TERM $_rcshutdown_watchdog >/dev/null 2>&1 -fi - -date -exit 0 diff --git a/etc/rc.subr b/etc/rc.subr deleted file mode 100644 index 0a7ac5d40..000000000 --- a/etc/rc.subr +++ /dev/null @@ -1,1358 +0,0 @@ -# -# Copyright (c) 1997-2011 The NetBSD Foundation, Inc. -# All rights reserved. -# -# This code is derived from software contributed to The NetBSD Foundation -# by Luke Mewburn. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -# POSSIBILITY OF SUCH DAMAGE. -# -# rc.subr -# functions used by various rc scripts -# - -: ${rcvar_manpage:='rc.conf(5)'} -: ${RC_PID:=$$} ; export RC_PID -nl=' -' # a literal newline - -# -# functions -# --------- - -# -# checkyesno var -# Test $1 variable. -# Return 0 if it's "yes" (et al), 1 if it's "no" (et al), 2 otherwise. -# -checkyesnox() -{ - eval _value=\$${1} - case $_value in - - # "yes", "true", "on", or "1" - [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1) - return 0 - ;; - - # "no", "false", "off", or "0" - [Nn][Oo]|[Ff][Aa][Ll][Ss][Ee]|[Oo][Ff][Ff]|0) - return 1 - ;; - *) - return 2 - ;; - esac -} - -# -# checkyesno var -# Test $1 variable, and warn if not set to YES or NO. -# Return 0 if it's "yes" (et al), nonzero otherwise. -# -checkyesno() -{ - local var - - checkyesnox $1 - var=$? - [ $var = 0 -o $var = 1 ] && return $var - warn "\$${1} is not set properly - see ${rcvar_manpage}." - return 1 -} - -# -# yesno_to_truefalse var -# Convert the value of a variable from any of the values -# understood by checkyesno() to "true" or "false". -# -yesno_to_truefalse() -{ - local var=$1 - if checkyesno $var; then - eval $var=true - return 0 - else - eval $var=false - return 1 - fi -} - -# -# reverse_list list -# print the list in reverse order -# -reverse_list() -{ - _revlist= - for _revfile; do - _revlist="$_revfile $_revlist" - done - echo $_revlist -} - -# -# If booting directly to multiuser, send SIGTERM to -# the parent (/etc/rc) to abort the boot. -# Otherwise just exit. -# -stop_boot() -{ - if [ "$autoboot" = yes ]; then - echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!" - kill -TERM ${RC_PID} - fi - exit 1 -} - -# -# mount_critical_filesystems type -# Go through the list of critical file systems as provided in -# the rc.conf(5) variable $critical_filesystems_${type}, checking -# each one to see if it is mounted, and if it is not, mounting it. -# It's not an error if file systems prefixed with "OPTIONAL:" -# are not mentioned in /etc/fstab. -# -mount_critical_filesystems() -{ - eval _fslist=\$critical_filesystems_${1} - _mountcrit_es=0 - for _fs in $_fslist; do - _optional=false - case "$_fs" in - OPTIONAL:*) - _optional=true - _fs="${_fs#*:}" - ;; - esac - _ismounted=false - # look for a line like "${fs} on * type *" - # or "* on ${fs} type *" in the output from mount. - case "${nl}$( mount )${nl}" in - *" on ${_fs} type "*) - _ismounted=true - ;; - *"${nl}${_fs} on "*) - _ismounted=true - ;; - esac - if $_ismounted; then - print_rc_metadata \ - "note:File system ${_fs} was already mounted" - else - _mount_output=$( mount $_fs 2>&1 ) - _mount_es=$? - case "$_mount_output" in - *"${nl}"*) - # multiple lines can't be good, - # not even if $_optional is true - ;; - *[uU]'nknown special file or file system'*) - if $_optional; then - # ignore this error - print_rc_metadata \ - "note:Optional file system ${_fs} is not present" - _mount_es=0 - _mount_output="" - fi - ;; - esac - if [ -n "$_mount_output" ]; then - printf >&2 "%s\n" "$_mount_output" - fi - if [ "$_mount_es" != 0 ]; then - _mountcrit_es="$_mount_es" - fi - fi - done - return $_mountcrit_es -} - -# -# check_pidfile pidfile procname [interpreter] -# Parses the first line of pidfile for a PID, and ensures -# that the process is running and matches procname. -# Prints the matching PID upon success, nothing otherwise. -# interpreter is optional; see _find_processes() for details. -# -check_pidfile() -{ - _pidfile=$1 - _procname=$2 - _interpreter=$3 - if [ -z "$_pidfile" -o -z "$_procname" ]; then - err 3 'USAGE: check_pidfile pidfile procname [interpreter]' - fi - if [ ! -f $_pidfile ]; then - return - fi - read _pid _junk < $_pidfile - if [ -z "$_pid" ]; then - return - fi - _find_processes $_procname ${_interpreter:-.} '-p '"$_pid" -} - -# -# check_process procname [interpreter] -# Ensures that a process (or processes) named procname is running. -# Prints a list of matching PIDs. -# interpreter is optional; see _find_processes() for details. -# -check_process() -{ - _procname=$1 - _interpreter=$2 - if [ -z "$_procname" ]; then - err 3 'USAGE: check_process procname [interpreter]' - fi - _find_processes $_procname ${_interpreter:-.} '-ax' -} - -# -# _find_processes procname interpreter psargs -# Search for procname in the output of ps generated by psargs. -# Prints the PIDs of any matching processes, space separated. -# -# If interpreter == ".", check the following variations of procname -# against the first word of each command: -# procname -# `basename procname` -# `basename procname` + ":" -# "(" + `basename procname` + ")" -# -# If interpreter != ".", read the first line of procname, remove the -# leading #!, normalise whitespace, append procname, and attempt to -# match that against each command, either as is, or with extra words -# at the end. As an alternative, to deal with interpreted daemons -# using perl, the basename of the interpreter plus a colon is also -# tried as the prefix to procname. -# -_find_processes() -{ - if [ $# -ne 3 ]; then - err 3 'USAGE: _find_processes procname interpreter psargs' - fi - _procname=$1 - _interpreter=$2 - _psargs=$3 - - _pref= - _procnamebn=${_procname##*/} - if [ $_interpreter != "." ]; then # an interpreted script - read _interp < ${_chroot:-}/$_procname # read interpreter name - _interp=${_interp#\#!} # strip #! - set -- $_interp - if [ $1 = "/usr/bin/env" ]; then - shift - set -- $(type $1) - shift $(($# - 1)) - _interp="${1##*/} $_procname" - else - _interp="$* $_procname" - fi - if [ $_interpreter != $1 ]; then - warn "\$command_interpreter $_interpreter != $1" - fi - _interpbn=${1##*/} - _fp_args='_argv' - _fp_match='case "$_argv" in - ${_interp}|"${_interp} "*|"${_interpbn}: "*${_procnamebn}*)' - else # a normal daemon - _fp_args='_arg0 _argv' - _fp_match='case "$_arg0" in - $_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})")' - fi - - _proccheck=' - ps -o "pid,command" '"$_psargs"' | - while read _npid '"$_fp_args"'; do - case "$_npid" in - PID) - continue ;; - esac ; '"$_fp_match"' - echo -n "$_pref$_npid" ; - _pref=" " - ;; - esac - done' - -#echo 1>&2 "proccheck is :$_proccheck:" - eval $_proccheck -} - -# -# wait_for_pids pid [pid ...] -# spins until none of the pids exist -# -wait_for_pids() -{ - _list="$@" - if [ -z "$_list" ]; then - return - fi - _prefix= - while true; do - _nlist=""; - for _j in $_list; do - if kill -0 $_j 2>/dev/null; then - _nlist="${_nlist}${_nlist:+ }$_j" - fi - done - if [ -z "$_nlist" ]; then - break - fi - if [ "$_list" != "$_nlist" ]; then - _list=$_nlist - echo -n ${_prefix:-"Waiting for PIDS: "}$_list - _prefix=", " - fi - # We want this to be a tight loop for a fast exit - sleep 0.05 - done - if [ -n "$_prefix" ]; then - echo "." - fi -} - -# -# run_rc_command argument [parameters] -# Search for argument in the list of supported commands, which is: -# "start stop restart rcvar status poll ${extra_commands}" -# If there's a match, run ${argument}_cmd or the default method -# (see below), and pass the optional list of parameters to it. -# -# If argument has a given prefix, then change the operation as follows: -# Prefix Operation -# ------ --------- -# fast Skip the pid check, and set rc_fast=yes -# force Set ${rcvar} to YES, and set rc_force=yes -# one Set ${rcvar} to YES -# -# The following globals are used: -# -# Name Needed Purpose -# ---- ------ ------- -# name y Name of script. -# -# command n Full path to command. -# Not needed if ${rc_arg}_cmd is set for -# each keyword. -# -# command_args n Optional args/shell directives for command. -# -# command_interpreter n If not empty, command is interpreted, so -# call check_{pidfile,process}() appropriately. -# -# extra_commands n List of extra commands supported. -# -# pidfile n If set, use check_pidfile $pidfile $command, -# otherwise use check_process $command. -# In either case, only check if $command is set. -# -# procname n Process name to check for instead of $command. -# -# rcvar n This is checked with checkyesno to determine -# if the action should be run. -# -# ${name}_chroot n Directory to chroot to before running ${command} -# Requires /usr to be mounted. -# -# ${name}_chdir n Directory to cd to before running ${command} -# (if not using ${name}_chroot). -# -# ${name}_flags n Arguments to call ${command} with. -# NOTE: $flags from the parent environment -# can be used to override this. -# -# ${name}_env n Additional environment variable settings -# for running ${command} -# -# ${name}_nice n Nice level to run ${command} at. -# -# ${name}_user n User to run ${command} as, using su(1) if not -# using ${name}_chroot. -# Requires /usr to be mounted. -# -# ${name}_group n Group to run chrooted ${command} as. -# Requires /usr to be mounted. -# -# ${name}_groups n Comma separated list of supplementary groups -# to run the chrooted ${command} with. -# Requires /usr to be mounted. -# -# ${rc_arg}_cmd n If set, use this as the method when invoked; -# Otherwise, use default command (see below) -# -# ${rc_arg}_precmd n If set, run just before performing the -# ${rc_arg}_cmd method in the default -# operation (i.e, after checking for required -# bits and process (non)existence). -# If this completes with a non-zero exit code, -# don't run ${rc_arg}_cmd. -# -# ${rc_arg}_postcmd n If set, run just after performing the -# ${rc_arg}_cmd method, if that method -# returned a zero exit code. -# -# required_dirs n If set, check for the existence of the given -# directories before running the default -# (re)start command. -# -# required_files n If set, check for the readability of the given -# files before running the default (re)start -# command. -# -# required_vars n If set, perform checkyesno on each of the -# listed variables before running the default -# (re)start command. -# -# Default behaviour for a given argument, if no override method is -# provided: -# -# Argument Default behaviour -# -------- ----------------- -# start if !running && checkyesno ${rcvar} -# ${command} -# -# stop if ${pidfile} -# rc_pid=$(check_pidfile $pidfile $command) -# else -# rc_pid=$(check_process $command) -# kill $sig_stop $rc_pid -# wait_for_pids $rc_pid -# ($sig_stop defaults to TERM.) -# -# reload Similar to stop, except use $sig_reload instead, -# and doesn't wait_for_pids. -# $sig_reload defaults to HUP. -# -# restart Run `stop' then `start'. -# -# status Show if ${command} is running, etc. -# -# poll Wait for ${command} to exit. -# -# rcvar Display what rc.conf variable is used (if any). -# -# Variables available to methods, and after run_rc_command() has -# completed: -# -# Variable Purpose -# -------- ------- -# rc_arg Argument to command, after fast/force/one processing -# performed -# -# rc_flags Flags to start the default command with. -# Defaults to ${name}_flags, unless overridden -# by $flags from the environment. -# This variable may be changed by the precmd method. -# -# rc_pid PID of command (if appropriate) -# -# rc_fast Not empty if "fast" was provided (q.v.) -# -# rc_force Not empty if "force" was provided (q.v.) -# -# -run_rc_command() -{ - rc_arg=$1 - if [ -z "$name" ]; then - err 3 'run_rc_command: $name is not set.' - fi - - _rc_prefix= - case "$rc_arg" in - fast*) # "fast" prefix; don't check pid - rc_arg=${rc_arg#fast} - rc_fast=yes - ;; - force*) # "force" prefix; always run - rc_force=yes - _rc_prefix=force - rc_arg=${rc_arg#${_rc_prefix}} - if [ -n "${rcvar}" ]; then - eval ${rcvar}=YES - fi - ;; - one*) # "one" prefix; set ${rcvar}=yes - _rc_prefix=one - rc_arg=${rc_arg#${_rc_prefix}} - if [ -n "${rcvar}" ]; then - eval ${rcvar}=YES - fi - ;; - esac - - _keywords="start stop restart rcvar" - if [ -n "$extra_commands" ]; then - _keywords="${_keywords} ${extra_commands}" - fi - rc_pid= - _pidcmd= - _procname=${procname:-${command}} - - # setup pid check command if not fast - if [ -z "$rc_fast" -a -n "$_procname" ]; then - if [ -n "$pidfile" ]; then - _pidcmd='rc_pid=$(check_pidfile '"$pidfile $_procname $command_interpreter"')' - else - _pidcmd='rc_pid=$(check_process '"$_procname $command_interpreter"')' - fi - if [ -n "$_pidcmd" ]; then - _keywords="${_keywords} status poll" - fi - fi - - if [ -z "$rc_arg" ]; then - rc_usage "$_keywords" - fi - shift # remove $rc_arg from the positional parameters - - if [ -n "$flags" ]; then # allow override from environment - rc_flags=$flags - else - eval rc_flags=\$${name}_flags - fi - eval _chdir=\$${name}_chdir _chroot=\$${name}_chroot \ - _nice=\$${name}_nice _user=\$${name}_user \ - _group=\$${name}_group _groups=\$${name}_groups \ - _env=\"\$${name}_env\" - - if [ -n "$_user" ]; then # unset $_user if running as that user - if [ "$_user" = "$(id -un)" ]; then - unset _user - fi - fi - - # if ${rcvar} is set, and $1 is not - # "rcvar", then run - # checkyesno ${rcvar} - # and return if that failed or warn - # user and exit when interactive - # - if [ -n "${rcvar}" -a "$rc_arg" != "rcvar" ]; then - if ! checkyesno ${rcvar}; then - # check whether interactive or not - if [ -n "$_run_rc_script" ]; then - return 0 - fi - for _elem in $_keywords; do - if [ "$_elem" = "$rc_arg" ]; then - cat 1>&2 <&2 "$0: unknown directive '$rc_arg'." - rc_usage "$_keywords" - fi - fi - - eval $_pidcmd # determine the pid if necessary - - for _elem in $_keywords; do - if [ "$_elem" != "$rc_arg" ]; then - continue - fi - - # if there's a custom ${XXX_cmd}, - # run that instead of the default - # - eval _cmd=\$${rc_arg}_cmd _precmd=\$${rc_arg}_precmd \ - _postcmd=\$${rc_arg}_postcmd - if [ -n "$_cmd" ]; then - # if the precmd failed and force - # isn't set, exit - # - if ! eval $_precmd && [ -z "$rc_force" ]; then - return 1 - fi - - if ! eval $_cmd \"\${@}\" && [ -z "$rc_force" ]; then - return 1 - fi - eval $_postcmd - return 0 - fi - - if [ ${#} -gt 0 ]; then - err 1 "the $rc_arg command does not take any parameters" - fi - - case "$rc_arg" in # default operations... - - status) - if [ -n "$rc_pid" ]; then - echo "${name} is running as pid $rc_pid." - else - echo "${name} is not running." - return 1 - fi - ;; - - start) - if [ -n "$rc_pid" ]; then - echo 1>&2 "${name} already running? (pid=$rc_pid)." - exit 1 - fi - - if [ ! -x ${_chroot}${command} ]; then - return 0 - fi - - # check for required variables, - # directories, and files - # - for _f in $required_vars; do - if ! checkyesno $_f; then - warn "\$${_f} is not enabled." - if [ -z "$rc_force" ]; then - return 1 - fi - fi - done - for _f in $required_dirs; do - if [ ! -d "${_f}/." ]; then - warn "${_f} is not a directory." - if [ -z "$rc_force" ]; then - return 1 - fi - fi - done - for _f in $required_files; do - if [ ! -r "${_f}" ]; then - warn "${_f} is not readable." - if [ -z "$rc_force" ]; then - return 1 - fi - fi - done - - # if the precmd failed and force - # isn't set, exit - # - if ! eval $_precmd && [ -z "$rc_force" ]; then - return 1 - fi - - # setup the command to run, and run it - # - echo "Starting ${name}." - if [ -n "$_chroot" ]; then - _doit="\ -${_env:+env $_env }\ -${_nice:+nice -n $_nice }\ -chroot ${_user:+-u $_user }${_group:+-g $_group }${_groups:+-G $_groups }\ -$_chroot $command $rc_flags $command_args" - else - _doit="\ -${_chdir:+cd $_chdir; }\ -${_env:+env $_env }\ -${_nice:+nice -n $_nice }\ -$command $rc_flags $command_args" - if [ -n "$_user" ]; then - _doit="su -m $_user -c 'sh -c \"$_doit\"'" - fi - fi - - # if the cmd failed and force - # isn't set, exit - # - if ! eval $_doit && [ -z "$rc_force" ]; then - return 1 - fi - - # finally, run postcmd - # - eval $_postcmd - ;; - - stop) - if [ -z "$rc_pid" ]; then - if [ -n "$pidfile" ]; then - echo 1>&2 \ - "${name} not running? (check $pidfile)." - else - echo 1>&2 "${name} not running?" - fi - exit 1 - fi - - # if the precmd failed and force - # isn't set, exit - # - if ! eval $_precmd && [ -z "$rc_force" ]; then - return 1 - fi - - # send the signal to stop - # - echo "Stopping ${name}." - _doit="kill -${sig_stop:-TERM} $rc_pid" - if [ -n "$_user" ]; then - _doit="su -m $_user -c 'sh -c \"$_doit\"'" - fi - - # if the stop cmd failed and force - # isn't set, exit - # - if ! eval $_doit && [ -z "$rc_force" ]; then - return 1 - fi - - # wait for the command to exit, - # and run postcmd. - wait_for_pids $rc_pid - eval $_postcmd - ;; - - reload) - if [ -z "$rc_pid" ]; then - if [ -n "$pidfile" ]; then - echo 1>&2 \ - "${name} not running? (check $pidfile)." - else - echo 1>&2 "${name} not running?" - fi - exit 1 - fi - echo "Reloading ${name} config files." - if ! eval $_precmd && [ -z "$rc_force" ]; then - return 1 - fi - _doit="kill -${sig_reload:-HUP} $rc_pid" - if [ -n "$_user" ]; then - _doit="su -m $_user -c 'sh -c \"$_doit\"'" - fi - if ! eval $_doit && [ -z "$rc_force" ]; then - return 1 - fi - eval $_postcmd - ;; - - restart) - if ! eval $_precmd && [ -z "$rc_force" ]; then - return 1 - fi - # prevent restart being called more - # than once by any given script - # - if ${_rc_restart_done:-false}; then - return 0 - fi - _rc_restart_done=true - - ( $0 ${_rc_prefix}stop ) - $0 ${_rc_prefix}start - - eval $_postcmd - ;; - - poll) - if [ -n "$rc_pid" ]; then - wait_for_pids $rc_pid - fi - ;; - - rcvar) - echo "# $name" - if [ -n "$rcvar" ]; then - if checkyesno ${rcvar}; then - echo "\$${rcvar}=YES" - else - echo "\$${rcvar}=NO" - fi - fi - ;; - - *) - rc_usage "$_keywords" - ;; - - esac - return 0 - done - - echo 1>&2 "$0: unknown directive '$rc_arg'." - rc_usage "$_keywords" - exit 1 -} - -# -# _have_rc_postprocessor -# Test whether the current script is running in a context that -# was invoked from /etc/rc with a postprocessor. -# -# If the test fails, some variables may be unset to make -# such tests more efficient in future. -# -_have_rc_postprocessor() -{ - # Cheap tests that fd and pid are set, fd is writable. - [ -n "${_rc_postprocessor_fd}" ] || return 1 - [ -n "${_rc_pid}" ] || return 1 - eval ": >&${_rc_postprocessor_fd}" 2>/dev/null || return 1 - - # More expensive test that pid is running. - # Unset _rc_pid if this fails. - kill -0 "${_rc_pid}" 2>/dev/null \ - || { unset _rc_pid; return 1; } - - # More expensive test that pid appears to be - # a shell running an rc script. - # Unset _rc_pid if this fails. - expr "$(ps -p "${_rc_pid}" -o command=)" : ".*sh .*/rc.*" >/dev/null \ - || { unset _rc_pid; return 1; } - - return 0 -} - -# -# run_rc_script file arg -# Start the script `file' with `arg', and correctly handle the -# return value from the script. If `file' ends with `.sh', it's -# sourced into the current environment. If `file' appears to be -# a backup or scratch file, ignore it. Otherwise if it's -# executable run as a child process. -# -# If `file' contains "KEYWORD: interactive" and if we are -# running inside /etc/rc with postprocessing, then the script's -# stdout and stderr are redirected to $_rc_original_stdout_fd and -# $_rc_original_stderr_fd, so the output will be displayed on the -# console but not intercepted by /etc/rc's postprocessor. -# -run_rc_script() -{ - _file=$1 - _arg=$2 - if [ -z "$_file" -o -z "$_arg" ]; then - err 3 'USAGE: run_rc_script file arg' - fi - - _run_rc_script=true - - unset name command command_args command_interpreter \ - extra_commands pidfile procname \ - rcvar required_dirs required_files required_vars - eval unset ${_arg}_cmd ${_arg}_precmd ${_arg}_postcmd - - _must_redirect=false - if _have_rc_postprocessor \ - && _has_rcorder_keyword interactive $_file - then - _must_redirect=true - fi - - case "$_file" in - *.sh) # run in current shell - if $_must_redirect; then - print_rc_metadata \ - "note:Output from ${_file} is not logged" - no_rc_postprocess eval \ - 'set $_arg ; . $_file' - else - set $_arg ; . $_file - fi - ;; - *[~#]|*.OLD|*.orig|*,v) # scratch file; skip - warn "Ignoring scratch file $_file" - ;; - *) # run in subshell - if [ -x $_file ] && $_must_redirect; then - print_rc_metadata \ - "note:Output from ${_file} is not logged" - if [ -n "$rc_fast_and_loose" ]; then - no_rc_postprocess eval \ - 'set $_arg ; . $_file' - else - no_rc_postprocess eval \ - '( set $_arg ; . $_file )' - fi - elif [ -x $_file ]; then - if [ -n "$rc_fast_and_loose" ]; then - set $_arg ; . $_file - else - ( set $_arg ; . $_file ) - fi - else - warn "Ignoring non-executable file $_file" - fi - ;; - esac -} - -# -# load_rc_config command -# Source in the configuration file for a given command. -# -load_rc_config() -{ - _command=$1 - if [ -z "$_command" ]; then - err 3 'USAGE: load_rc_config command' - fi - - if ${_rc_conf_loaded:-false}; then - : - else - . /etc/rc.conf - _rc_conf_loaded=true - fi - if [ -f /etc/rc.conf.d/"$_command" ]; then - . /etc/rc.conf.d/"$_command" - fi -} - -# -# load_rc_config_var cmd var -# Read the rc.conf(5) var for cmd and set in the -# current shell, using load_rc_config in a subshell to prevent -# unwanted side effects from other variable assignments. -# -load_rc_config_var() -{ - if [ $# -ne 2 ]; then - err 3 'USAGE: load_rc_config_var cmd var' - fi - eval $(eval '( - load_rc_config '$1' >/dev/null; - if [ -n "${'$2'}" -o "${'$2'-UNSET}" != "UNSET" ]; then - echo '$2'=\'\''${'$2'}\'\''; - fi - )' ) -} - -# -# rc_usage commands -# Print a usage string for $0, with `commands' being a list of -# valid commands. -# -rc_usage() -{ - echo -n 1>&2 "Usage: $0 [fast|force|one](" - - _sep= - for _elem; do - echo -n 1>&2 "$_sep$_elem" - _sep="|" - done - echo 1>&2 ")" - exit 1 -} - -# -# err exitval message -# Display message to stderr and log to the syslog, and exit with exitval. -# -err() -{ - exitval=$1 - shift - - if [ -x /usr/bin/logger ]; then - logger "$0: ERROR: $*" - fi - echo 1>&2 "$0: ERROR: $*" - exit $exitval -} - -# -# warn message -# Display message to stderr and log to the syslog. -# -warn() -{ - if [ -x /usr/bin/logger ]; then - logger "$0: WARNING: $*" - fi - echo 1>&2 "$0: WARNING: $*" -} - -# -# backup_file action file cur backup -# Make a backup copy of `file' into `cur', and save the previous -# version of `cur' as `backup' or use rcs for archiving. -# -# This routine checks the value of the backup_uses_rcs variable, -# which can be either YES or NO. -# -# The `action' keyword can be one of the following: -# -# add `file' is now being backed up (and is possibly -# being reentered into the backups system). `cur' -# is created and RCS files, if necessary, are -# created as well. -# -# update `file' has changed and needs to be backed up. -# If `cur' exists, it is copied to to `back' or -# checked into RCS (if the repository file is old), -# and then `file' is copied to `cur'. Another RCS -# check in done here if RCS is being used. -# -# remove `file' is no longer being tracked by the backups -# system. If RCS is not being used, `cur' is moved -# to `back', otherwise an empty file is checked in, -# and then `cur' is removed. -# -# -backup_file() -{ - _action=$1 - _file=$2 - _cur=$3 - _back=$4 - - if checkyesno backup_uses_rcs; then - _msg0="backup archive" - _msg1="update" - - # ensure that history file is not locked - if [ -f $_cur,v ]; then - rcs -q -u -U -M $_cur - fi - - # ensure after switching to rcs that the - # current backup is not lost - if [ -f $_cur ]; then - # no archive, or current newer than archive - if [ ! -f $_cur,v -o $_cur -nt $_cur,v ]; then - ci -q -f -u -t-"$_msg0" -m"$_msg1" $_cur - rcs -q -kb -U $_cur - co -q -f -u $_cur - fi - fi - - case $_action in - add|update) - cp -p $_file $_cur - ci -q -f -u -t-"$_msg0" -m"$_msg1" $_cur - rcs -q -kb -U $_cur - co -q -f -u $_cur - chown root:wheel $_cur $_cur,v - ;; - remove) - cp /dev/null $_cur - ci -q -f -u -t-"$_msg0" -m"$_msg1" $_cur - rcs -q -kb -U $_cur - chown root:wheel $_cur $_cur,v - rm $_cur - ;; - esac - else - case $_action in - add|update) - if [ -f $_cur ]; then - cp -p $_cur $_back - fi - cp -p $_file $_cur - chown root:wheel $_cur - ;; - remove) - mv -f $_cur $_back - ;; - esac - fi -} - -# -# handle_fsck_error fsck_exit_code -# Take action depending on the return code from fsck. -# -handle_fsck_error() -{ - case $1 in - 0) # OK - return - ;; - 2) # Needs re-run, still fs errors - echo "File system still has errors; re-run fsck manually!" - ;; - 4) # Root modified - echo "Root file system was modified, rebooting ..." - reboot -n - echo "Reboot failed; help!" - ;; - 8) # Check failed - echo "Automatic file system check failed; help!" - ;; - 12) # Got signal - echo "Boot interrupted." - ;; - *) - echo "Unknown error $1; help!" - ;; - esac - stop_boot -} - -# -# _has_rcorder_keyword word file -# Check whether a file contains a "# KEYWORD:" comment with a -# specified keyword in the style used by rcorder(8). -# -_has_rcorder_keyword() -{ - local word="$1" - local file="$2" - local line - - [ -r "$file" ] || return 1 - while read line; do - case "${line} " in - "# KEYWORD:"*[\ \ ]"${word}"[\ \ ]*) - return 0 - ;; - "#"*) - continue - ;; - *[A-Za-z0-9]*) - # give up at the first non-empty non-comment line - return 1 - ;; - esac - done <"$file" - return 1 -} - -# -# print_rc_metadata string -# Print the specified string in such a way that the post-processor -# inside /etc/rc will treat it as meta-data. -# -# If we are not running inside /etc/rc, do nothing. -# -# For public use by any rc.d script, the string must begin with -# "note:", followed by arbitrary text. The intent is that the text -# will appear in a log file but not on the console. -# -# For private use within /etc/rc, the string must contain a -# keyword recognised by the rc_postprocess_metadata() function -# defined in /etc/rc, followed by a colon, followed by one or more -# colon-separated arguments associated with the keyword. -# -print_rc_metadata() -{ - # _rc_postprocessor fd, if defined, is the fd to which we must - # print, prefixing the output with $_rc_metadata_prefix. - # - if _have_rc_postprocessor; then - command printf "%s%s\n" "$rc_metadata_prefix" "$1" \ - >&${_rc_postprocessor_fd} - fi -} - -# -# _flush_rc_output -# Arrange for output to be flushed, if we are running -# inside /etc/rc with postprocessing. -# -_flush_rc_output() -{ - print_rc_metadata "nop" -} - -# -# print_rc_normal [-n] string -# Print the specified string in such way that it is treated as -# normal output, regardless of whether or not we are running -# inside /etc/rc with post-processing. -# -# If "-n" is specified in $1, then the string in $2 is printed -# without a newline; otherwise, the string in $1 is printed -# with a newline. -# -# Intended use cases include: -# -# o An rc.d script can use ``print_rc_normal -n'' to print a -# partial line in such a way that it appears immediately -# instead of being buffered by rc(8)'s post-processor. -# -# o An rc.d script that is run via the no_rc_postprocess -# function (so most of its output is invisible to rc(8)'s -# post-processor) can use print_rc_normal to force some of its -# output to be seen by the post-processor. -# -# -print_rc_normal() -{ - # print to stdout or _rc_postprocessor_fd, depending on - # whether not we have an rc postprocessor. - # - local fd=1 - _have_rc_postprocessor && fd="${_rc_postprocessor_fd}" - case "$1" in - "-n") - command printf "%s" "$2" >&${fd} - _flush_rc_output - ;; - *) - command printf "%s\n" "$1" >&${fd} - ;; - esac -} - -# -# no_rc_postprocess cmd... -# Execute the specified command in such a way that its output -# bypasses the post-processor that handles the output from -# most commands that are run inside /etc/rc. If we are not -# inside /etc/rc, then just execute the command without special -# treatment. -# -# The intent is that interactive commands can be run via -# no_rc_postprocess(), and their output will apear immediately -# on the console instead of being hidden or delayed by the -# post-processor. An unfortunate consequence of the output -# bypassing the post-processor is that the output will not be -# logged. -# -no_rc_postprocess() -{ - if _have_rc_postprocessor; then - "$@" >&${_rc_original_stdout_fd} 2>&${_rc_original_stderr_fd} - else - "$@" - fi -} - -# -# twiddle -# On each call, print a different one of "/", "-", "\\", "|", -# followed by a backspace. The most recently printed value is -# saved in $_twiddle_state. -# -# Output is to /dev/tty, so this function may be useful even inside -# a script whose output is redirected. -# -twiddle() -{ - case "$_twiddle_state" in - '/') _next='-' ;; - '-') _next='\' ;; - '\') _next='|' ;; - *) _next='/' ;; - esac - command printf "%s\b" "$_next" >/dev/tty - _twiddle_state="$_next" -} - -# -# human_exit_code -# Print the a human version of the exit code. -# -human_exit_code() -{ - if [ "$1" -lt 127 ] - then - echo "exited with code $1" - elif [ "$(expr $1 % 256)" -eq 127 ] - then - # This cannot really happen because the shell will not - # pass stopped job status out and the exit code is limited - # to 8 bits. This code is here just for completeness. - echo "stopped with signal $(expr $1 / 256)" - else - echo "terminated with signal $(expr $1 - 128)" - fi -} - -# -# collapse_backslash_newline -# Copy input to output, collapsing -# to nothing, but leaving other backslashes alone. -# -collapse_backslash_newline() -{ - local line - while read -r line ; do - case "$line" in - *\\) - # print it, without the backslash or newline - command printf "%s" "${line%?}" - ;; - *) - # print it, with a newline - command printf "%s\n" "${line}" - ;; - esac - done -} - -# Shell implementations of basename and dirname, usable before -# the /usr file system is mounted. -# -basename() -{ - local file="$1" - local suffix="$2" - local base - - base="${file##*/}" # remove up to and including last '/' - base="${base%${suffix}}" # remove suffix, if any - command printf "%s\n" "${base}" -} - -dirname() -{ - local file="$1" - local dir - - case "$file" in - /*/*) dir="${file%/*}" ;; # common case: absolute path - /*) dir="/" ;; # special case: name in root dir - */*) dir="${file%/*}" ;; # common case: relative path with '/' - *) dir="." ;; # special case: name without '/' - esac - command printf "%s\n" "${dir}" -} - -# Override the normal "echo" and "printf" commands, so that -# partial lines printed by rc.d scripts appear immediately, -# instead of being buffered by rc(8)'s post-processor. -# -# Naive use of the echo or printf commands from rc.d scripts, -# elsewhere in rc.subr, or anything else that sources rc.subr, -# will call these functions. To call the real echo and printf -# commands, use "command echo" or "command printf". -# -echo() -{ - command echo "$@" - case "$1" in - '-n') _flush_rc_output ;; - esac -} -printf() -{ - command printf "$@" - case "$1" in - *'\n') : ;; - *) _flush_rc_output ;; - esac -} - -_rc_subr_loaded=: diff --git a/etc/root/Makefile b/etc/root/Makefile deleted file mode 100644 index 3c9209271..000000000 --- a/etc/root/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2012/11/17 23:08:38 uwe Exp $ - -CONFIGFILES= dot.cshrc dot.klogin dot.login dot.profile dot.shrc - -FILESDIR= /root -FILESMODE= 644 -FILESMODE_dot.klogin= 600 -.for F in ${CONFIGFILES} -FILESNAME_${F}= ${F:S/dot//} -.endfor - -.include -.if !defined(__MINIX) -CONFIGLINKS= /root/.cshrc /.cshrc \ - /root/.profile /.profile -.endif # !defined(__MINIX) - -.include -.include diff --git a/etc/root/dot.cshrc b/etc/root/dot.cshrc deleted file mode 100644 index 781d7592f..000000000 --- a/etc/root/dot.cshrc +++ /dev/null @@ -1,38 +0,0 @@ - -alias h history -alias j jobs -l -alias hup '( set pid=$< ; kill -HUP $pid ) < /var/run/\!$.pid' -alias la ls -a -alias lf ls -FA -alias ll ls -l - -alias x exit -alias z suspend - -alias back 'set back="$old"; set old="$cwd"; cd "$back"; unset back; dirs' -alias cd 'set old="$cwd"; chdir \!*' -alias pd pushd -alias pd2 pushd +2 -alias pd3 pushd +3 -alias pd4 pushd +4 -alias tset 'set noglob histchars=""; eval `\tset -s \!*`; unset noglob histchars' - -setenv BLOCKSIZE 1k - -# Uncomment the following line(s) to install binary packages - -set history=1000 -set path=(/sbin /usr/sbin /bin /usr/bin /usr/pkg/sbin /usr/pkg/bin /usr/X11R7/bin /usr/X11R6/bin /usr/local/sbin /usr/local/bin) - -# directory stuff: cdpath/cd/back -set cdpath=(/usr/src/{sys,bin,sbin,usr.{bin,sbin},lib,libexec,share,local,games,gnu/{usr.{bin,sbin},libexec,lib,games}}) - -if ($?prompt && -x /usr/bin/id ) then - if (`/usr/bin/id -u` == 0) then - set prompt="`hostname -s`# " - else - set prompt="`hostname -s`% " - endif -endif - -umask 022 diff --git a/etc/root/dot.klogin b/etc/root/dot.klogin deleted file mode 100644 index a7d8774cd..000000000 --- a/etc/root/dot.klogin +++ /dev/null @@ -1,2 +0,0 @@ -# $NetBSD: dot.klogin,v 1.3 1997/10/28 03:33:20 mrg Exp $ - diff --git a/etc/root/dot.login b/etc/root/dot.login deleted file mode 100644 index 79688acd4..000000000 --- a/etc/root/dot.login +++ /dev/null @@ -1,7 +0,0 @@ - -eval `tset -sQrm 'unknown:?unknown'` - -# Do not display in 'su -' case -if ( ! $?SU_FROM ) then - echo "We recommend that you create a non-root account and use su(1) for root access." -endif diff --git a/etc/root/dot.profile b/etc/root/dot.profile deleted file mode 100644 index d3e9b6814..000000000 --- a/etc/root/dot.profile +++ /dev/null @@ -1,24 +0,0 @@ - -export PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/pkg/sbin:/usr/pkg/bin -export PATH=${PATH}:/usr/X11R7/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin - -# Uncomment the following line(s) to install binary packages - -export BLOCKSIZE=1k - -export HOST="$(hostname)" - -if [ -x /usr/bin/tset ]; then - eval $(tset -sQrm 'unknown:?unknown') -fi - -umask 022 -#ulimit -c 0 - -export ENV=/root/.shrc - -# Do not display in 'su -' case -# Would be nice, but still not tested enough on MINIX -#if [ -z "$SU_FROM" ]; then -# echo "We recommend that you create a non-root account and use su(1) for root access." -#fi diff --git a/etc/root/dot.shrc b/etc/root/dot.shrc deleted file mode 100644 index 04354200e..000000000 --- a/etc/root/dot.shrc +++ /dev/null @@ -1,11 +0,0 @@ - -if [ -f /etc/shrc ]; then - . /etc/shrc -fi - -hup(){ (read pid; kill -HUP $pid) /dev/console -exec 2> /dev/console - -export HOME=/ -export PATH=/sbin:/usr/sbin:/bin:/usr/bin - -. /etc/rc.subr -. /etc/rc.conf - -# Restart the LWIP service. - -# There is no need to shut down daemons before bringing back up the service. -# Note that "minix-service restart" does not do the same as these steps, and in -# fact breaks a proper LWIP restart. -restarts=$(grep restarts /proc/service/$1 | cut -d: -f2) -minix-service down "$1" -minix-service up /service/lwip -dev /dev/bpf -script /etc/rs.lwip \ - -restarts $(($restarts + 1)) - -# Reload TCP ISN, or make a new one if there is none. Do not save anything. -TCPISN_FILE=/usr/adm/tcpisn.dat -TCPISN_LEN=$(sysctl -n net.inet.tcp.isn_secret | awk '{print length/2}') -if [ ! -f $TCPISN_FILE ]; then TCPISN_FILE=/dev/random; fi -sysctl -qw net.inet.tcp.isn_secret=`dd if=$TCPISN_FILE bs=$TCPISN_LEN \ - count=1 2>/dev/null | hexdump -v -e '/1 "%02x"'` 2>/dev/null - -# Let LWIP find all network drivers before performing initialization. -sleep 1 - -# Restart all network daemons. - -# Start with dhcpcd, which may be launched directly from ifconfig.if(5) scripts -# and therefore may not be enabled in, and thus stopped by, rc.d scripts below. -service dhcpcd onestop >/dev/null 2>&1 - -# Then stop and start all known network daemons using their rc.d scripts. -regex='/('"$(echo $RC_SCRIPTS | tr ' ' '|')"')$' -scripts=$(for rcd in ${rc_directories:-/etc/rc.d}; do - test -d ${rcd} && echo ${rcd}/*; done) -files=$(rcorder ${scripts} | grep -E "$regex") - -for _rc_elem in $(reverse_list $files); do - # We have already stopped dhcpcd if it was running, so skip it here. - [ $_rc_elem != /etc/rc.d/dhcpcd ] && run_rc_script $_rc_elem stop -done - -for _rc_elem in $files; do - run_rc_script $_rc_elem start -done diff --git a/etc/rs.single b/etc/rs.single deleted file mode 100644 index 1dc3a0732..000000000 --- a/etc/rs.single +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -# 'Recovery' script that doesn't. This script is to be used for drivers that -# should not be restarted. Instead, the scripts configures the driver 'down'. -#echo "Arguments: $@" >/dev/console -/sbin/minix-service down "$1" diff --git a/etc/services b/etc/services deleted file mode 100644 index e2f95f992..000000000 --- a/etc/services +++ /dev/null @@ -1,23433 +0,0 @@ -# $NetBSD: services,v 1.99 2015/11/14 16:25:48 christos Exp $ -# See also: services(5), http://www.sethwklein.net/projects/iana-etc/ -# -# Last Updated -# 2015-11-13 -# -# Expert(s) -# -#TCP/UDP: Joe Touch; Eliot Lear, Allison Mankin, Markku Kojo, Kumiko Ono, Martin Stiemerling, -#Lars Eggert, Alexey Melnikov, Wes Eddy, and Alexander Zimmermann -#SCTP: Allison Mankin and Michael Tuexen -#DCCP: Eddie Kohler and Yoshifumi Nishida -# -# Reference -# [RFC6335] -# -# Note -# -#Service names and port numbers are used to distinguish between different -#services that run over transport protocols such as TCP, UDP, DCCP, and -#SCTP. -# -#Service names are assigned on a first-come, first-served process, as -#documented in [RFC6335]. -# -#Port numbers are assigned in various ways, based on three ranges: System -#Ports (0-1023), User Ports (1024-49151), and the Dynamic and/or Private -#Ports (49152-65535); the difference uses of these ranges is described in -#[RFC6335]. System Ports are assigned by IETF -#process for standards-track protocols, as per [RFC6335]. User Ports -#are assigned by IANA using the "IETF Review" process, the "IESG -#Approval" process, or the "Expert Review" process, as per -#[RFC6335]. Dynamic Ports are not assigned. -# -#The registration procedures for service names and port numbers are -#described in [RFC6335]. -# -#Assigned ports both System and User ports SHOULD NOT be used without -#or prior to IANA registration. -# -#************************************************************************ -#* PLEASE NOTE THE FOLLOWING: * -#* * -#* ASSIGNMENT OF A PORT NUMBER DOES NOT IN ANY WAY IMPLY AN * -#* ENDORSEMENT OF AN APPLICATION OR PRODUCT, AND THE FACT THAT NETWORK * -#* TRAFFIC IS FLOWING TO OR FROM A REGISTERED PORT DOES NOT MEAN THAT * -#* IT IS "GOOD" TRAFFIC, NOR THAT IT NECESSARILY CORRESPONDS TO THE * -#* ASSIGNED SERVICE. FIREWALL AND SYSTEM ADMINISTRATORS SHOULD * -#* CHOOSE HOW TO CONFIGURE THEIR SYSTEMS BASED ON THEIR KNOWLEDGE OF * -#* THE TRAFFIC IN QUESTION, NOT WHETHER THERE IS A PORT NUMBER * -#* REGISTERED OR NOT. * -#************************************************************************ -# -# Available Formats -# [IMG] -# CSV [IMG] -# XML [IMG] -# HTML [IMG] -# Plain text -# -# Transport Registration Modification Service Known -#Service Name Port Number Protocol Description Assignee Contact Date Date Reference Code Unauthorized Assignment Notes -# Uses -# 0 tcp Reserved [Jon_Postel] [Jon_Postel] -# 0 udp Reserved [Jon_Postel] [Jon_Postel] -tcpmux 1/tcp # TCP Port Service Multiplexer [Mark_Lottor] [Mark_Lottor] -tcpmux 1/udp # TCP Port Service Multiplexer [Mark_Lottor] [Mark_Lottor] -compressnet 2/tcp # Management Utility -compressnet 2/udp # Management Utility -compressnet 3/tcp # Compression Process [Bernie_Volz] [Bernie_Volz] -compressnet 3/udp # Compression Process [Bernie_Volz] [Bernie_Volz] -# 4 tcp Unassigned -# 4 udp Unassigned -rje 5/tcp # Remote Job Entry [Jon_Postel] [Jon_Postel] -rje 5/udp # Remote Job Entry [Jon_Postel] [Jon_Postel] -# 6 tcp Unassigned -# 6 udp Unassigned -echo 7/tcp # Echo [Jon_Postel] [Jon_Postel] -echo 7/udp # Echo [Jon_Postel] [Jon_Postel] -# 8 tcp Unassigned -# 8 udp Unassigned -discard 9/tcp # Discard [Jon_Postel] [Jon_Postel] -discard 9/udp # Discard [Jon_Postel] [Jon_Postel] -discard 9/sctp # Discard [Randall_Stewart] [Randall_Stewart] [RFC4960] -discard 9/dccp # Discard [Eddie_Kohler] [Eddie_Kohler] [RFC4340] 1145656131 -# 10 tcp Unassigned -# 10 udp Unassigned -systat 11/tcp # Active Users [Jon_Postel] [Jon_Postel] -systat 11/udp # Active Users [Jon_Postel] [Jon_Postel] -# 12 tcp Unassigned -# 12 udp Unassigned -daytime 13/tcp # Daytime [Jon_Postel] [Jon_Postel] [RFC867] -daytime 13/udp # Daytime [Jon_Postel] [Jon_Postel] [RFC867] -# 14 tcp Unassigned -# 14 udp Unassigned -# 15 tcp Unassigned [was netstat] -# 15 udp Unassigned -# 16 tcp Unassigned -# 16 udp Unassigned -qotd 17/tcp # Quote of the Day [Jon_Postel] [Jon_Postel] -qotd 17/udp # Quote of the Day [Jon_Postel] [Jon_Postel] -msp 18/tcp # Message Send Protocol [Rina_Nethaniel] [Rina_Nethaniel] -# (historic) -msp 18/udp # Message Send Protocol [Rina_Nethaniel] [Rina_Nethaniel] -# (historic) -chargen 19/tcp # Character Generator -chargen 19/udp # Character Generator -ftp-data 20/tcp # File Transfer [Default Data] [Jon_Postel] [Jon_Postel] -ftp-data 20/udp # File Transfer [Default Data] [Jon_Postel] [Jon_Postel] -ftp-data 20/sctp # FTP [Randall_Stewart] [Randall_Stewart] [RFC4960] -ftp 21/tcp # File Transfer Protocol [Jon_Postel] [Jon_Postel] [RFC959] Defined TXT keys: u= p= path= -# [Control] -ftp 21/udp # File Transfer Protocol [Jon_Postel] [Jon_Postel] [RFC959] Defined TXT keys: u= p= path= -# [Control] -ftp 21/sctp # FTP [Randall_Stewart] [Randall_Stewart] [RFC4960] Defined TXT keys: u= p= path= -ssh 22/tcp # The Secure Shell (SSH) [RFC4251] Defined TXT keys: u= p= -# Protocol -ssh 22/udp # The Secure Shell (SSH) [RFC4251] Defined TXT keys: u= p= -# Protocol -ssh 22/sctp # SSH [Randall_Stewart] [Randall_Stewart] [RFC4960] Defined TXT keys: u= p= -telnet 23/tcp # Telnet [Jon_Postel] [Jon_Postel] [RFC854] Defined TXT keys: u= p= -telnet 23/udp # Telnet [Jon_Postel] [Jon_Postel] [RFC854] Defined TXT keys: u= p= -# 24 tcp any private mail system [Rick_Adams] [Rick_Adams] -# 24 udp any private mail system [Rick_Adams] [Rick_Adams] -smtp 25/tcp # Simple Mail Transfer [Jon_Postel] [Jon_Postel] -smtp 25/udp # Simple Mail Transfer [Jon_Postel] [Jon_Postel] -# 26 tcp Unassigned -# 26 udp Unassigned -nsw-fe 27/tcp # NSW User System FE [Robert_Thomas] [Robert_Thomas] -nsw-fe 27/udp # NSW User System FE [Robert_Thomas] [Robert_Thomas] -# 28 tcp Unassigned -# 28 udp Unassigned -msg-icp 29/tcp # MSG ICP [Robert_Thomas] [Robert_Thomas] -msg-icp 29/udp # MSG ICP [Robert_Thomas] [Robert_Thomas] -# 30 tcp Unassigned -# 30 udp Unassigned -msg-auth 31/tcp # MSG Authentication [Robert_Thomas] [Robert_Thomas] -msg-auth 31/udp # MSG Authentication [Robert_Thomas] [Robert_Thomas] -# 32 tcp Unassigned -# 32 udp Unassigned -dsp 33/tcp # Display Support Protocol [Ed_Cain] [Ed_Cain] -dsp 33/udp # Display Support Protocol [Ed_Cain] [Ed_Cain] -# 34 tcp Unassigned -# 34 udp Unassigned -# 35 tcp any private printer server [Jon_Postel] [Jon_Postel] -# 35 udp any private printer server [Jon_Postel] [Jon_Postel] -# 36 tcp Unassigned -# 36 udp Unassigned -time 37/tcp # Time [Jon_Postel] [Jon_Postel] -time 37/udp # Time [Jon_Postel] [Jon_Postel] -rap 38/tcp # Route Access Protocol [Robert_Ullmann] [Robert_Ullmann] -rap 38/udp # Route Access Protocol [Robert_Ullmann] [Robert_Ullmann] -rlp 39/tcp # Resource Location Protocol [Mike_Accetta] [Mike_Accetta] -rlp 39/udp # Resource Location Protocol [Mike_Accetta] [Mike_Accetta] -# 40 tcp Unassigned -# 40 udp Unassigned -graphics 41/tcp # Graphics -graphics 41/udp # Graphics -name 42/tcp # Host Name Server -name 42/udp # Host Name Server -nameserver 42/tcp # Host Name Server -nameserver 42/udp # Host Name Server -nicname 43/tcp whois # Who Is -nicname 43/udp whois # Who Is -mpm-flags 44/tcp # MPM FLAGS Protocol -mpm-flags 44/udp # MPM FLAGS Protocol -mpm 45/tcp # Message Processing Module -# [recv] -mpm 45/udp # Message Processing Module -# [recv] -mpm-snd 46/tcp # MPM [default send] [Jon_Postel] [Jon_Postel] -mpm-snd 46/udp # MPM [default send] [Jon_Postel] [Jon_Postel] -ni-ftp 47/tcp # NI FTP [Steve_Kille] [Steve_Kille] -ni-ftp 47/udp # NI FTP [Steve_Kille] [Steve_Kille] -auditd 48/tcp # Digital Audit Daemon [Larry_Scott] [Larry_Scott] -auditd 48/udp # Digital Audit Daemon [Larry_Scott] [Larry_Scott] -tacacs 49/tcp # Login Host Protocol (TACACS) [Pieter_Ditmars] [Pieter_Ditmars] -tacacs 49/udp # Login Host Protocol (TACACS) [Pieter_Ditmars] [Pieter_Ditmars] -re-mail-ck 50/tcp # Remote Mail Checking [Steve_Dorner] [Steve_Dorner] -# Protocol -re-mail-ck 50/udp # Remote Mail Checking [Steve_Dorner] [Steve_Dorner] -# Protocol -# 51 Reserved 2013-05-24 This entry is being removed on 2013-05-24. -xns-time 52/tcp # XNS Time Protocol [Susie_Armstrong] [Susie_Armstrong] -xns-time 52/udp # XNS Time Protocol [Susie_Armstrong] [Susie_Armstrong] -domain 53/tcp # Domain Name Server [Paul_Mockapetris] [Paul_Mockapetris] -domain 53/udp # Domain Name Server [Paul_Mockapetris] [Paul_Mockapetris] -xns-ch 54/tcp # XNS Clearinghouse [Susie_Armstrong] [Susie_Armstrong] -xns-ch 54/udp # XNS Clearinghouse [Susie_Armstrong] [Susie_Armstrong] -isi-gl 55/tcp # ISI Graphics Language -isi-gl 55/udp # ISI Graphics Language -xns-auth 56/tcp # XNS Authentication [Susie_Armstrong] [Susie_Armstrong] -xns-auth 56/udp # XNS Authentication [Susie_Armstrong] [Susie_Armstrong] -# 57 tcp any private terminal access [Jon_Postel] [Jon_Postel] -# 57 udp any private terminal access [Jon_Postel] [Jon_Postel] -xns-mail 58/tcp # XNS Mail [Susie_Armstrong] [Susie_Armstrong] -xns-mail 58/udp # XNS Mail [Susie_Armstrong] [Susie_Armstrong] -# 59 tcp any private file service [Jon_Postel] [Jon_Postel] -# 59 udp any private file service [Jon_Postel] [Jon_Postel] -# 60 tcp Unassigned -# 60 udp Unassigned -ni-mail 61/tcp # NI MAIL [Steve_Kille] [Steve_Kille] -ni-mail 61/udp # NI MAIL [Steve_Kille] [Steve_Kille] -acas 62/tcp # ACA Services [E_Wald] [E_Wald] -acas 62/udp # ACA Services [E_Wald] [E_Wald] -# whois++ -# -whoispp 63/tcp # IANA assigned this [Rickard_Schoultz] [Rickard_Schoultz] -# well-formed service name as -# a replacement for "whois++". -# This entry is an alias to "whoispp". This entry is now -whois++ 63/tcp # whois++ [Rickard_Schoultz] [Rickard_Schoultz] historic, not usable for use with many common service -# discovery mechanisms. -# whois++ -# -whoispp 63/udp # IANA assigned this [Rickard_Schoultz] [Rickard_Schoultz] -# well-formed service name as -# a replacement for "whois++". -# This entry is an alias to "whoispp". This entry is now -whois++ 63/udp # whois++ [Rickard_Schoultz] [Rickard_Schoultz] historic, not usable for use with many common service -# discovery mechanisms. -covia 64/tcp # Communications Integrator [Dan_Smith] [Dan_Smith] -# (CI) -covia 64/udp # Communications Integrator [Dan_Smith] [Dan_Smith] -# (CI) -tacacs-ds 65/tcp # TACACS-Database Service [Kathy_Huber] [Kathy_Huber] -tacacs-ds 65/udp # TACACS-Database Service [Kathy_Huber] [Kathy_Huber] -# Oracle SQL*NET -# -sql-net 66/tcp # IANA assigned this [Jack_Haverty] [Jack_Haverty] -# well-formed service name as -# a replacement for "sql*net". -# This entry is an alias to "sql-net". This entry is now -sql*net 66/tcp # Oracle SQL*NET [Jack_Haverty] [Jack_Haverty] historic, not usable for use with many common service -# discovery mechanisms. -# Oracle SQL*NET -# -sql-net 66/udp # IANA assigned this [Jack_Haverty] [Jack_Haverty] -# well-formed service name as -# a replacement for "sql*net". -# This entry is an alias to "sql-net". This entry is now -sql*net 66/udp # Oracle SQL*NET [Jack_Haverty] [Jack_Haverty] historic, not usable for use with many common service -# discovery mechanisms. -bootps 67/tcp # Bootstrap Protocol Server [Bill_Croft] [Bill_Croft] [RFC951] Defined TXT keys: None -bootps 67/udp # Bootstrap Protocol Server -bootpc 68/tcp # Bootstrap Protocol Client [Bill_Croft] [Bill_Croft] -bootpc 68/udp # Bootstrap Protocol Client [Bill_Croft] [Bill_Croft] -tftp 69/tcp # Trivial File Transfer [David_Clark] [David_Clark] -tftp 69/udp # Trivial File Transfer [David_Clark] [David_Clark] -gopher 70/tcp # Gopher [Mark_McCahill] [Mark_McCahill] -gopher 70/udp # Gopher [Mark_McCahill] [Mark_McCahill] -netrjs-1 71/tcp # Remote Job Service -netrjs-1 71/udp # Remote Job Service -netrjs-2 72/tcp # Remote Job Service -netrjs-2 72/udp # Remote Job Service -netrjs-3 73/tcp # Remote Job Service -netrjs-3 73/udp # Remote Job Service -netrjs-4 74/tcp # Remote Job Service [Bob_Braden] [Bob_Braden] -netrjs-4 74/udp # Remote Job Service [Bob_Braden] [Bob_Braden] -# 75 tcp any private dial out service [Jon_Postel] [Jon_Postel] -# 75 udp any private dial out service [Jon_Postel] [Jon_Postel] -deos 76/tcp # Distributed External Object [Robert_Ullmann] [Robert_Ullmann] -# Store -deos 76/udp # Distributed External Object [Robert_Ullmann] [Robert_Ullmann] -# Store -# 77 tcp any private RJE service [Jon_Postel] [Jon_Postel] -# 77 udp any private RJE service [Jon_Postel] [Jon_Postel] -vettcp 78/tcp # vettcp [Christopher_Leong] [Christopher_Leong] -vettcp 78/udp # vettcp [Christopher_Leong] [Christopher_Leong] -# Unauthorized -# use by some -finger 79/tcp # Finger [David_Zimmerman] [David_Zimmerman] mail users -# (see -# [RFC4146] -# for details) -# Unauthorized -# use by some -finger 79/udp # Finger [David_Zimmerman] [David_Zimmerman] mail users -# (see -# [RFC4146] -# for details) -http 80/tcp # World Wide Web HTTP Defined TXT keys: u= p= path= -http 80/udp # World Wide Web HTTP Defined TXT keys: u= p= path= -www 80/tcp # World Wide Web HTTP This is a duplicate of the "http" service and should not be -# used for discovery purposes. -www 80/udp # World Wide Web HTTP This is a duplicate of the "http" service and should not be -# used for discovery purposes. -# This is a duplicate of the "http" service and should not be -# used for discovery purposes. u= p= -# path= (see txtrecords.html#http) Known -# Subtypes: _printer NOTE: The meaning of this service type, -# though called just "http", actually denotes something more -# precise than just "any data transported using HTTP". The -# DNS-SD service type "http" should only be used to advertise -# content that: * is served over HTTP, * can be displayed by -# "typical" web browser client software, and * is intented -# primarily to be viewed by a human user. Of course, the -# definition of "typical web browser" is subjective, and may -www-http 80/tcp # World Wide Web HTTP [Tim_Berners_Lee] [Tim_Berners_Lee] change over time, but for practical purposes the DNS-SD -# service type "http" can be understood as meaning -# "human-readable HTML content served over HTTP". In some cases -# other widely-supported content types may also be appropriate, -# such as plain text over HTTP, or JPEG image over HTTP. -# Content types not intented primarily for viewing by a human -# user, or not widely-supported in web browsing clients, should -# not be advertised as DNS-SD service type "http", even if they -# do happen to be transported over HTTP. Such types should be -# advertised as their own logical service type with their own -# DNS-SD service type, for example, XUL (XML User Interface -# Language) transported over HTTP is advertised explicitly as -# DNS-SD service type "xul-http". -# This is a duplicate of the "http" service and should not be -# used for discovery purposes. u= p= -# path= (see txtrecords.html#http) Known -# Subtypes: _printer NOTE: The meaning of this service type, -# though called just "http", actually denotes something more -# precise than just "any data transported using HTTP". The -# DNS-SD service type "http" should only be used to advertise -# content that: * is served over HTTP, * can be displayed by -# "typical" web browser client software, and * is intented -# primarily to be viewed by a human user. Of course, the -# definition of "typical web browser" is subjective, and may -www-http 80/udp # World Wide Web HTTP [Tim_Berners_Lee] [Tim_Berners_Lee] change over time, but for practical purposes the DNS-SD -# service type "http" can be understood as meaning -# "human-readable HTML content served over HTTP". In some cases -# other widely-supported content types may also be appropriate, -# such as plain text over HTTP, or JPEG image over HTTP. -# Content types not intented primarily for viewing by a human -# user, or not widely-supported in web browsing clients, should -# not be advertised as DNS-SD service type "http", even if they -# do happen to be transported over HTTP. Such types should be -# advertised as their own logical service type with their own -# DNS-SD service type, for example, XUL (XML User Interface -# Language) transported over HTTP is advertised explicitly as -# DNS-SD service type "xul-http". -http 80/sctp # HTTP [Randall_Stewart] [Randall_Stewart] [RFC4960] Defined TXT keys: u= p= path= -# 81 Unassigned 2007-09-06 -xfer 82/tcp # XFER Utility [Thomas_M_Smith] [Thomas_M_Smith] -xfer 82/udp # XFER Utility [Thomas_M_Smith] [Thomas_M_Smith] -mit-ml-dev 83/tcp # MIT ML Device [David_Reed] [David_Reed] -mit-ml-dev 83/udp # MIT ML Device [David_Reed] [David_Reed] -ctf 84/tcp # Common Trace Facility [Hugh_Thomas] [Hugh_Thomas] -ctf 84/udp # Common Trace Facility [Hugh_Thomas] [Hugh_Thomas] -mit-ml-dev 85/tcp # MIT ML Device [David_Reed] [David_Reed] -mit-ml-dev 85/udp # MIT ML Device [David_Reed] [David_Reed] -mfcobol 86/tcp # Micro Focus Cobol [Simon_Edwards] [Simon_Edwards] -mfcobol 86/udp # Micro Focus Cobol [Simon_Edwards] [Simon_Edwards] -# 87 tcp any private terminal link [Jon_Postel] [Jon_Postel] -# 87 udp any private terminal link [Jon_Postel] [Jon_Postel] -kerberos 88/tcp # Kerberos [B_Clifford_Neuman] [B_Clifford_Neuman] -kerberos 88/udp # Kerberos [B_Clifford_Neuman] [B_Clifford_Neuman] -su-mit-tg 89/tcp # SU/MIT Telnet Gateway [Mark_Crispin] [Mark_Crispin] -su-mit-tg 89/udp # SU/MIT Telnet Gateway [Mark_Crispin] [Mark_Crispin] -# PORT 90 also -dnsix 90/tcp # DNSIX Securit Attribute [Charles_Watt] [Charles_Watt] being used -# Token Map unofficially -# by Pointcast -# PORT 90 also -dnsix 90/udp # DNSIX Securit Attribute [Charles_Watt] [Charles_Watt] being used -# Token Map unofficially -# by Pointcast -mit-dov 91/tcp # MIT Dover Spooler [Eliot_Moss] [Eliot_Moss] -mit-dov 91/udp # MIT Dover Spooler [Eliot_Moss] [Eliot_Moss] -npp 92/tcp # Network Printing Protocol [Louis_Mamakos] [Louis_Mamakos] -npp 92/udp # Network Printing Protocol [Louis_Mamakos] [Louis_Mamakos] -dcp 93/tcp # Device Control Protocol [Daniel_Tappan] [Daniel_Tappan] -dcp 93/udp # Device Control Protocol [Daniel_Tappan] [Daniel_Tappan] -objcall 94/tcp # Tivoli Object Dispatcher [Tom_Bereiter] [Tom_Bereiter] -objcall 94/udp # Tivoli Object Dispatcher [Tom_Bereiter] [Tom_Bereiter] -supdup 95/tcp # SUPDUP [Mark_Crispin] [Mark_Crispin] -supdup 95/udp # SUPDUP [Mark_Crispin] [Mark_Crispin] -dixie 96/tcp # DIXIE Protocol Specification [Tim_Howes] [Tim_Howes] -dixie 96/udp # DIXIE Protocol Specification [Tim_Howes] [Tim_Howes] -swift-rvf 97/tcp # Swift Remote Virtural File [Maurice_R_Turcotte] [Maurice_R_Turcotte] -# Protocol -swift-rvf 97/udp # Swift Remote Virtural File [Maurice_R_Turcotte] [Maurice_R_Turcotte] -# Protocol -tacnews 98/tcp # TAC News [Jon_Postel] [Jon_Postel] -tacnews 98/udp # TAC News [Jon_Postel] [Jon_Postel] -metagram 99/tcp # Metagram Relay [Geoff_Goodfellow] [Geoff_Goodfellow] -metagram 99/udp # Metagram Relay [Geoff_Goodfellow] [Geoff_Goodfellow] -# Known -# 100 Unassigned 2012-03-21 Unauthorized -# Use on 100 -hostname 101/tcp # NIC Host Name Server [Jon_Postel] [Jon_Postel] -hostname 101/udp # NIC Host Name Server [Jon_Postel] [Jon_Postel] -iso-tsap 102/tcp # ISO-TSAP Class 0 [Marshall_Rose] [Marshall_Rose] -iso-tsap 102/udp # ISO-TSAP Class 0 [Marshall_Rose] [Marshall_Rose] -gppitnp 103/tcp # Genesis Point-to-Point Trans -# Net -gppitnp 103/udp # Genesis Point-to-Point Trans -# Net -acr-nema 104/tcp # ACR-NEMA Digital Imag. & [Patrick_McNamee] [Patrick_McNamee] -# Comm. 300 -acr-nema 104/udp # ACR-NEMA Digital Imag. & [Patrick_McNamee] [Patrick_McNamee] -# Comm. 300 -cso 105/tcp # CCSO name server protocol [Martin_Hamilton] [Martin_Hamilton] -cso 105/udp # CCSO name server protocol [Martin_Hamilton] [Martin_Hamilton] -csnet-ns 105/tcp # Mailbox Name Nameserver [Marvin_Solomon] [Marvin_Solomon] -csnet-ns 105/udp # Mailbox Name Nameserver [Marvin_Solomon] [Marvin_Solomon] -# Known -3com-tsmux 106/tcp # 3COM-TSMUX [Jeremy_Siegel] [Jeremy_Siegel] Unauthorized -# Use on 106 -# Known -3com-tsmux 106/udp # 3COM-TSMUX [Jeremy_Siegel] [Jeremy_Siegel] Unauthorized -# Use on 106 -rtelnet 107/tcp # Remote Telnet Service [Jon_Postel] [Jon_Postel] -rtelnet 107/udp # Remote Telnet Service [Jon_Postel] [Jon_Postel] -snagas 108/tcp # SNA Gateway Access Server [Kevin_Murphy] [Kevin_Murphy] -snagas 108/udp # SNA Gateway Access Server [Kevin_Murphy] [Kevin_Murphy] -pop2 109/tcp # Post Office Protocol - [Joyce_K_Reynolds] [Joyce_K_Reynolds] -# Version 2 -pop2 109/udp # Post Office Protocol - [Joyce_K_Reynolds] [Joyce_K_Reynolds] -# Version 2 -pop3 110/tcp # Post Office Protocol - [Marshall_Rose] [Marshall_Rose] -# Version 3 -pop3 110/udp # Post Office Protocol - [Marshall_Rose] [Marshall_Rose] -# Version 3 -sunrpc 111/tcp # SUN Remote Procedure Call [Chuck_McManis] [Chuck_McManis] -sunrpc 111/udp # SUN Remote Procedure Call [Chuck_McManis] [Chuck_McManis] -mcidas 112/tcp # McIDAS Data Transmission [Glenn_Davis] [Glenn_Davis] -# Protocol -mcidas 112/udp # McIDAS Data Transmission [Glenn_Davis] [Glenn_Davis] -# Protocol -ident 113/tcp -auth 113/tcp # Authentication Service [Mike_St_Johns] [Mike_St_Johns] -auth 113/udp # Authentication Service [Mike_St_Johns] [Mike_St_Johns] -# 114 unassigned Deprecated June 2004 -sftp 115/tcp # Simple File Transfer [Mark_Lottor] [Mark_Lottor] -# Protocol -sftp 115/udp # Simple File Transfer [Mark_Lottor] [Mark_Lottor] -# Protocol -ansanotify 116/tcp # ANSA REX Notify [Nicola_J_Howarth] [Nicola_J_Howarth] -ansanotify 116/udp # ANSA REX Notify [Nicola_J_Howarth] [Nicola_J_Howarth] -uucp-path 117/tcp # UUCP Path Service -uucp-path 117/udp # UUCP Path Service -sqlserv 118/tcp # SQL Services [Larry_Barnes] [Larry_Barnes] -sqlserv 118/udp # SQL Services [Larry_Barnes] [Larry_Barnes] -nntp 119/tcp # Network News Transfer [Phil_Lapsley] [Phil_Lapsley] -# Protocol -nntp 119/udp # Network News Transfer [Phil_Lapsley] [Phil_Lapsley] -# Protocol -cfdptkt 120/tcp # CFDPTKT [John_Ioannidis] [John_Ioannidis] -cfdptkt 120/udp # CFDPTKT [John_Ioannidis] [John_Ioannidis] -erpc 121/tcp # Encore Expedited Remote [Jack_ONeil] [Jack_ONeil] -# Pro.Call -erpc 121/udp # Encore Expedited Remote [Jack_ONeil] [Jack_ONeil] -# Pro.Call -smakynet 122/tcp # SMAKYNET [Pierre_Arnaud] [Pierre_Arnaud] -smakynet 122/udp # SMAKYNET [Pierre_Arnaud] [Pierre_Arnaud] -ntp 123/tcp # Network Time Protocol [Dave_Mills] [Dave_Mills] [RFC5905] -ntp 123/udp # Network Time Protocol [Dave_Mills] [Dave_Mills] [RFC5905] -ansatrader 124/tcp # ANSA REX Trader [Nicola_J_Howarth] [Nicola_J_Howarth] -ansatrader 124/udp # ANSA REX Trader [Nicola_J_Howarth] [Nicola_J_Howarth] -locus-map 125/tcp # Locus PC-Interface Net Map [Eric_Peterson] [Eric_Peterson] -# Ser -locus-map 125/udp # Locus PC-Interface Net Map [Eric_Peterson] [Eric_Peterson] -# Ser -# Port 126 Previously assigned to application below unitary -nxedit 126/tcp # NXEdit [Don_Payette] [Don_Payette] 126/tcp Unisys Unitary Login unitary 126/udp Unisys Unitary -# Login Port 126 Previously -# assigned to application above -# Port 126 Previously assigned to application below unitary -nxedit 126/udp # NXEdit [Don_Payette] [Don_Payette] 126/tcp Unisys Unitary Login unitary 126/udp Unisys Unitary -# Login Port 126 Previously -# assigned to application above -locus-con 127/tcp # Locus PC-Interface Conn [Eric_Peterson] [Eric_Peterson] -# Server -locus-con 127/udp # Locus PC-Interface Conn [Eric_Peterson] [Eric_Peterson] -# Server -gss-xlicen 128/tcp # GSS X License Verification [John_Light] [John_Light] -gss-xlicen 128/udp # GSS X License Verification [John_Light] [John_Light] -pwdgen 129/tcp # Password Generator Protocol [Frank_J_Wacho] [Frank_J_Wacho] -pwdgen 129/udp # Password Generator Protocol [Frank_J_Wacho] [Frank_J_Wacho] -cisco-fna 130/tcp # cisco FNATIVE -cisco-fna 130/udp # cisco FNATIVE -cisco-tna 131/tcp # cisco TNATIVE -cisco-tna 131/udp # cisco TNATIVE -cisco-sys 132/tcp # cisco SYSMAINT -cisco-sys 132/udp # cisco SYSMAINT -statsrv 133/tcp # Statistics Service [Dave_Mills_2] [Dave_Mills_2] -statsrv 133/udp # Statistics Service [Dave_Mills_2] [Dave_Mills_2] -ingres-net 134/tcp # INGRES-NET Service [Mike_Berrow] [Mike_Berrow] -ingres-net 134/udp # INGRES-NET Service [Mike_Berrow] [Mike_Berrow] -epmap 135/tcp # DCE endpoint resolution [Joe_Pato] [Joe_Pato] -epmap 135/udp # DCE endpoint resolution [Joe_Pato] [Joe_Pato] -profile 136/tcp # PROFILE Naming System [Larry_Peterson] [Larry_Peterson] -profile 136/udp # PROFILE Naming System [Larry_Peterson] [Larry_Peterson] -netbios-ns 137/tcp # NETBIOS Name Service -netbios-ns 137/udp # NETBIOS Name Service -netbios-dgm 138/tcp # NETBIOS Datagram Service -netbios-dgm 138/udp # NETBIOS Datagram Service -netbios-ssn 139/tcp # NETBIOS Session Service [Jon_Postel] [Jon_Postel] -netbios-ssn 139/udp # NETBIOS Session Service [Jon_Postel] [Jon_Postel] -emfis-data 140/tcp # EMFIS Data Service -emfis-data 140/udp # EMFIS Data Service -emfis-cntl 141/tcp # EMFIS Control Service [Gerd_Beling] [Gerd_Beling] -emfis-cntl 141/udp # EMFIS Control Service [Gerd_Beling] [Gerd_Beling] -bl-idm 142/tcp # Britton-Lee IDM [Susie_Snitzer] [Susie_Snitzer] -bl-idm 142/udp # Britton-Lee IDM [Susie_Snitzer] [Susie_Snitzer] -imap 143/tcp # Internet Message Access [Mark_Crispin_2] [Mark_Crispin_2] -# Protocol -imap 143/udp # Internet Message Access [Mark_Crispin_2] [Mark_Crispin_2] -# Protocol -uma 144/tcp # Universal Management [Jay_Whitney] [Jay_Whitney] -# Architecture -uma 144/udp # Universal Management [Jay_Whitney] [Jay_Whitney] -# Architecture -uaac 145/tcp # UAAC Protocol [David_A_Gomberg] [David_A_Gomberg] -uaac 145/udp # UAAC Protocol [David_A_Gomberg] [David_A_Gomberg] -iso-tp0 146/tcp # ISO-IP0 -iso-tp0 146/udp # ISO-IP0 -iso-ip 147/tcp # ISO-IP [Marshall_Rose] [Marshall_Rose] -iso-ip 147/udp # ISO-IP [Marshall_Rose] [Marshall_Rose] -jargon 148/tcp # Jargon [Bill_Weinman] [Bill_Weinman] -jargon 148/udp # Jargon [Bill_Weinman] [Bill_Weinman] -aed-512 149/tcp # AED 512 Emulation Service [Albert_G_Broscius] [Albert_G_Broscius] -aed-512 149/udp # AED 512 Emulation Service [Albert_G_Broscius] [Albert_G_Broscius] -sql-net 150/tcp # SQL-NET [Martin_Picard] [Martin_Picard] -sql-net 150/udp # SQL-NET [Martin_Picard] [Martin_Picard] -hems 151/tcp # HEMS -hems 151/udp # HEMS -bftp 152/tcp # Background File Transfer [Annette_DeSchon] [Annette_DeSchon] -# Program -bftp 152/udp # Background File Transfer [Annette_DeSchon] [Annette_DeSchon] -# Program -sgmp 153/tcp # SGMP [Marty_Schoffstahl] [Marty_Schoffstahl] -sgmp 153/udp # SGMP [Marty_Schoffstahl] [Marty_Schoffstahl] -netsc-prod 154/tcp # NETSC -netsc-prod 154/udp # NETSC -netsc-dev 155/tcp # NETSC [Sergio_Heker] [Sergio_Heker] -netsc-dev 155/udp # NETSC [Sergio_Heker] [Sergio_Heker] -sqlsrv 156/tcp # SQL Service [Craig_Rogers] [Craig_Rogers] -sqlsrv 156/udp # SQL Service [Craig_Rogers] [Craig_Rogers] -knet-cmp 157/tcp # KNET/VM Command/Message [Gary_S_Malkin] [Gary_S_Malkin] -# Protocol -knet-cmp 157/udp # KNET/VM Command/Message [Gary_S_Malkin] [Gary_S_Malkin] -# Protocol -pcmail-srv 158/tcp # PCMail Server [Mark_L_Lambert] [Mark_L_Lambert] -pcmail-srv 158/udp # PCMail Server [Mark_L_Lambert] [Mark_L_Lambert] -nss-routing 159/tcp # NSS-Routing [Yakov_Rekhter] [Yakov_Rekhter] -nss-routing 159/udp # NSS-Routing [Yakov_Rekhter] [Yakov_Rekhter] -sgmp-traps 160/tcp # SGMP-TRAPS [Marty_Schoffstahl] [Marty_Schoffstahl] -sgmp-traps 160/udp # SGMP-TRAPS [Marty_Schoffstahl] [Marty_Schoffstahl] -snmp 161/tcp # SNMP -snmp 161/udp # SNMP -snmptrap 162/tcp # SNMPTRAP [Marshall_Rose] [Marshall_Rose] -snmptrap 162/udp # SNMPTRAP [Marshall_Rose] [Marshall_Rose] -cmip-man 163/tcp # CMIP/TCP Manager -cmip-man 163/udp # CMIP/TCP Manager -cmip-agent 164/tcp # CMIP/TCP Agent [Amatzia_Ben_Artzi] [Amatzia_Ben_Artzi] -cmip-agent 164/udp # CMIP/TCP Agent [Amatzia_Ben_Artzi] [Amatzia_Ben_Artzi] -xns-courier 165/tcp # Xerox [Susie_Armstrong_2] [Susie_Armstrong_2] -xns-courier 165/udp # Xerox [Susie_Armstrong_2] [Susie_Armstrong_2] -s-net 166/tcp # Sirius Systems [Brian_Lloyd] [Brian_Lloyd] -s-net 166/udp # Sirius Systems [Brian_Lloyd] [Brian_Lloyd] -namp 167/tcp # NAMP [Marty_Schoffstahl] [Marty_Schoffstahl] -namp 167/udp # NAMP [Marty_Schoffstahl] [Marty_Schoffstahl] -rsvd 168/tcp # RSVD [Alan_Sandell] [Alan_Sandell] 2008-05-01 -rsvd 168/udp # RSVD [Alan_Sandell] [Alan_Sandell] 2008-05-01 -send 169/tcp # SEND [William_Oldwin] [William_Oldwin] 2013-06-17 -send 169/udp # SEND [William_Oldwin] [William_Oldwin] 2013-06-17 -print-srv 170/tcp # Network PostScript [Brian_Reid] [Brian_Reid] -print-srv 170/udp # Network PostScript [Brian_Reid] [Brian_Reid] -multiplex 171/tcp # Network Innovations -# Multiplex -multiplex 171/udp # Network Innovations -# Multiplex -# Network Innovations CL/1 -# -cl-1 172/tcp # IANA assigned this [Kevin_DeVault] [Kevin_DeVault] -# well-formed service name as -# a replacement for "cl/1". -# This entry is an alias to "cl-1". This entry is now historic, -cl/1 172/tcp # Network Innovations CL/1 [Kevin_DeVault] [Kevin_DeVault] not usable for use with many common service discovery -# mechanisms. -# Network Innovations CL/1 -# -cl-1 172/udp # IANA assigned this [Kevin_DeVault] [Kevin_DeVault] -# well-formed service name as -# a replacement for "cl/1". -# This entry is an alias to "cl-1". This entry is now historic, -cl/1 172/udp # Network Innovations CL/1 [Kevin_DeVault] [Kevin_DeVault] not usable for use with many common service discovery -# mechanisms. -xyplex-mux 173/tcp # Xyplex [Bob_Stewart] [Bob_Stewart] -xyplex-mux 173/udp # Xyplex [Bob_Stewart] [Bob_Stewart] -mailq 174/tcp # MAILQ [Rayan_Zachariassen] [Rayan_Zachariassen] -mailq 174/udp # MAILQ [Rayan_Zachariassen] [Rayan_Zachariassen] -vmnet 175/tcp # VMNET [Christopher_Tengi] [Christopher_Tengi] -vmnet 175/udp # VMNET [Christopher_Tengi] [Christopher_Tengi] -genrad-mux 176/tcp # GENRAD-MUX [Ron_Thornton] [Ron_Thornton] -genrad-mux 176/udp # GENRAD-MUX [Ron_Thornton] [Ron_Thornton] -xdmcp 177/tcp # X Display Manager Control [Robert_W_Scheifler] [Robert_W_Scheifler] -# Protocol -xdmcp 177/udp # X Display Manager Control [Robert_W_Scheifler] [Robert_W_Scheifler] -# Protocol -nextstep 178/tcp # NextStep Window Server [Leo_Hourvitz] [Leo_Hourvitz] -nextstep 178/udp # NextStep Window Server [Leo_Hourvitz] [Leo_Hourvitz] -bgp 179/tcp # Border Gateway Protocol [Kirk_Lougheed] [Kirk_Lougheed] -bgp 179/udp # Border Gateway Protocol [Kirk_Lougheed] [Kirk_Lougheed] -bgp 179/sctp # BGP [Randall_Stewart] [Randall_Stewart] [RFC4960] -ris 180/tcp # Intergraph [Dave_Buehmann] [Dave_Buehmann] -ris 180/udp # Intergraph [Dave_Buehmann] [Dave_Buehmann] -unify 181/tcp # Unify [Daegis_Inc] [Chris_Anderson] 2012-07-31 -unify 181/udp # Unify [Daegis_Inc] [Chris_Anderson] 2012-07-31 -audit 182/tcp # Unisys Audit SITP [Gil_Greenbaum] [Gil_Greenbaum] -audit 182/udp # Unisys Audit SITP [Gil_Greenbaum] [Gil_Greenbaum] -ocbinder 183/tcp # OCBinder -ocbinder 183/udp # OCBinder -ocserver 184/tcp # OCServer [Jerrilynn_Okamura] [Jerrilynn_Okamura] -ocserver 184/udp # OCServer [Jerrilynn_Okamura] [Jerrilynn_Okamura] -remote-kis 185/tcp # Remote-KIS -remote-kis 185/udp # Remote-KIS -kis 186/tcp # KIS Protocol [Ralph_Droms] [Ralph_Droms] -kis 186/udp # KIS Protocol [Ralph_Droms] [Ralph_Droms] -aci 187/tcp # Application Communication [Rick_Carlos] [Rick_Carlos] -# Interface -aci 187/udp # Application Communication [Rick_Carlos] [Rick_Carlos] -# Interface -mumps 188/tcp # Plus Five's MUMPS [Hokey_Stenn] [Hokey_Stenn] -mumps 188/udp # Plus Five's MUMPS [Hokey_Stenn] [Hokey_Stenn] -qft 189/tcp # Queued File Transport [Wayne_Schroeder] [Wayne_Schroeder] -qft 189/udp # Queued File Transport [Wayne_Schroeder] [Wayne_Schroeder] -gacp 190/tcp # Gateway Access Control [C_Philip_Wood] [C_Philip_Wood] -# Protocol -gacp 190/udp # Gateway Access Control [C_Philip_Wood] [C_Philip_Wood] -# Protocol -prospero 191/tcp # Prospero Directory Service [B_Clifford_Neuman] [B_Clifford_Neuman] -prospero 191/udp # Prospero Directory Service [B_Clifford_Neuman] [B_Clifford_Neuman] -osu-nms 192/tcp # OSU Network Monitoring [Doug_Karl] [Doug_Karl] -# System -osu-nms 192/udp # OSU Network Monitoring [Doug_Karl] [Doug_Karl] -# System -srmp 193/tcp # Spider Remote Monitoring [Ted_J_Socolofsky] [Ted_J_Socolofsky] -# Protocol -srmp 193/udp # Spider Remote Monitoring [Ted_J_Socolofsky] [Ted_J_Socolofsky] -# Protocol -irc 194/tcp # Internet Relay Chat Protocol [Jarkko_Oikarinen] [Jarkko_Oikarinen] -irc 194/udp # Internet Relay Chat Protocol [Jarkko_Oikarinen] [Jarkko_Oikarinen] -dn6-nlm-aud 195/tcp # DNSIX Network Level Module -# Audit -dn6-nlm-aud 195/udp # DNSIX Network Level Module -# Audit -dn6-smm-red 196/tcp # DNSIX Session Mgt Module [Lawrence_Lebahn] [Lawrence_Lebahn] -# Audit Redir -dn6-smm-red 196/udp # DNSIX Session Mgt Module [Lawrence_Lebahn] [Lawrence_Lebahn] -# Audit Redir -dls 197/tcp # Directory Location Service -dls 197/udp # Directory Location Service -dls-mon 198/tcp # Directory Location Service [Scott_Bellew] [Scott_Bellew] -# Monitor -dls-mon 198/udp # Directory Location Service [Scott_Bellew] [Scott_Bellew] -# Monitor -smux 199/tcp # SMUX [Marshall_Rose] [Marshall_Rose] -smux 199/udp # SMUX [Marshall_Rose] [Marshall_Rose] -src 200/tcp # IBM System Resource [Gerald_McBrearty] [Gerald_McBrearty] -# Controller -src 200/udp # IBM System Resource [Gerald_McBrearty] [Gerald_McBrearty] -# Controller -at-rtmp 201/tcp # AppleTalk Routing -# Maintenance -at-rtmp 201/udp # AppleTalk Routing -# Maintenance -at-nbp 202/tcp # AppleTalk Name Binding -at-nbp 202/udp # AppleTalk Name Binding -at-3 203/tcp # AppleTalk Unused -at-3 203/udp # AppleTalk Unused -at-echo 204/tcp # AppleTalk Echo -at-echo 204/udp # AppleTalk Echo -at-5 205/tcp # AppleTalk Unused -at-5 205/udp # AppleTalk Unused -at-zis 206/tcp # AppleTalk Zone Information -at-zis 206/udp # AppleTalk Zone Information -at-7 207/tcp # AppleTalk Unused -at-7 207/udp # AppleTalk Unused -at-8 208/tcp # AppleTalk Unused [Rob_Chandhok] [Rob_Chandhok] -at-8 208/udp # AppleTalk Unused [Rob_Chandhok] [Rob_Chandhok] -qmtp 209/tcp # The Quick Mail Transfer [Dan_Bernstein] [Dan_Bernstein] -# Protocol -qmtp 209/udp # The Quick Mail Transfer [Dan_Bernstein] [Dan_Bernstein] -# Protocol -# ANSI Z39.50 -# -z39-50 210/tcp # IANA assigned this [Mark_H_Needleman] [Mark_H_Needleman] -# well-formed service name as -# a replacement for "z39.50". -# This entry is an alias to "z39-50". This entry is now -z39.50 210/tcp # ANSI Z39.50 [Mark_H_Needleman] [Mark_H_Needleman] historic, not usable for use with many common service -# discovery mechanisms. -# ANSI Z39.50 -# -z39-50 210/udp # IANA assigned this [Mark_H_Needleman] [Mark_H_Needleman] -# well-formed service name as -# a replacement for "z39.50". -# This entry is an alias to "z39-50". This entry is now -z39.50 210/udp # ANSI Z39.50 [Mark_H_Needleman] [Mark_H_Needleman] historic, not usable for use with many common service -# discovery mechanisms. -# Texas Instruments 914C/G -# Terminal -914c-g 211/tcp # [Bill_Harrell] [Bill_Harrell] -# IANA assigned this -# well-formed service name as -# a replacement for "914c/g". -# Texas Instruments 914C/G This entry is an alias to "914c-g". This entry is now -914c/g 211/tcp # Terminal [Bill_Harrell] [Bill_Harrell] historic, not usable for use with many common service -# discovery mechanisms. -# Texas Instruments 914C/G -# Terminal -914c-g 211/udp # [Bill_Harrell] [Bill_Harrell] -# IANA assigned this -# well-formed service name as -# a replacement for "914c/g". -# Texas Instruments 914C/G This entry is an alias to "914c-g". This entry is now -914c/g 211/udp # Terminal [Bill_Harrell] [Bill_Harrell] historic, not usable for use with many common service -# discovery mechanisms. -anet 212/tcp # ATEXSSTR [Jim_Taylor] [Jim_Taylor] -anet 212/udp # ATEXSSTR [Jim_Taylor] [Jim_Taylor] -ipx 213/tcp # IPX [Don_Provan] [Don_Provan] -ipx 213/udp # IPX [Don_Provan] [Don_Provan] -vmpwscs 214/tcp # VM PWSCS [Dan_Shia] [Dan_Shia] -vmpwscs 214/udp # VM PWSCS [Dan_Shia] [Dan_Shia] -softpc 215/tcp # Insignia Solutions [Martyn_Thomas] [Martyn_Thomas] -softpc 215/udp # Insignia Solutions [Martyn_Thomas] [Martyn_Thomas] -CAIlic 216/tcp # Computer Associates Int'l [Chuck_Spitz] [Chuck_Spitz] -# License Server -CAIlic 216/udp # Computer Associates Int'l [Chuck_Spitz] [Chuck_Spitz] -# License Server -dbase 217/tcp # dBASE Unix [Don_Gibson] [Don_Gibson] -dbase 217/udp # dBASE Unix [Don_Gibson] [Don_Gibson] -mpp 218/tcp # Netix Message Posting [Shannon_Yeh] [Shannon_Yeh] -# Protocol -mpp 218/udp # Netix Message Posting [Shannon_Yeh] [Shannon_Yeh] -# Protocol -uarps 219/tcp # Unisys ARPs [Ashok_Marwaha] [Ashok_Marwaha] -uarps 219/udp # Unisys ARPs [Ashok_Marwaha] [Ashok_Marwaha] -imap3 220/tcp # Interactive Mail Access [James_Rice] [James_Rice] -# Protocol v3 -imap3 220/udp # Interactive Mail Access [James_Rice] [James_Rice] -# Protocol v3 -fln-spx 221/tcp # Berkeley rlogind with SPX -# auth -fln-spx 221/udp # Berkeley rlogind with SPX -# auth -rsh-spx 222/tcp # Berkeley rshd with SPX auth -rsh-spx 222/udp # Berkeley rshd with SPX auth -cdc 223/tcp # Certificate Distribution [Kannan_Alagappan] [Kannan_Alagappan] -# Center -cdc 223/udp # Certificate Distribution [Kannan_Alagappan] [Kannan_Alagappan] -# Center -masqdialer 224/tcp # masqdialer [Charles_Wright] [Charles_Wright] Possible Conflict of Port 222 with "Masqdialer" -masqdialer 224/udp # masqdialer [Charles_Wright] [Charles_Wright] Possible Conflict of Port 222 with "Masqdialer" -# 225-241 Reserved [Jon_Postel] [Jon_Postel] -direct 242/tcp # Direct [Herb_Sutter] [Herb_Sutter] -direct 242/udp # Direct [Herb_Sutter] [Herb_Sutter] -sur-meas 243/tcp # Survey Measurement [Dave_Clark] [Dave_Clark] -sur-meas 243/udp # Survey Measurement [Dave_Clark] [Dave_Clark] -inbusiness 244/tcp # inbusiness [Derrick_Hisatake] [Derrick_Hisatake] -inbusiness 244/udp # inbusiness [Derrick_Hisatake] [Derrick_Hisatake] -link 245/tcp # LINK -link 245/udp # LINK -dsp3270 246/tcp # Display Systems Protocol [Weldon_J_Showalter] [Weldon_J_Showalter] -dsp3270 246/udp # Display Systems Protocol [Weldon_J_Showalter] [Weldon_J_Showalter] -# SUBNTBCST_TFTP -# -subntbcst-tftp 247/tcp # IANA assigned this [John_Fake] [John_Fake] -# well-formed service name as -# a replacement for -# "subntbcst_tftp". -# This entry is an alias to "subntbcst-tftp". This entry is now -subntbcst_tftp 247/tcp # SUBNTBCST_TFTP [John_Fake] [John_Fake] historic, not usable for use with many common service -# discovery mechanisms. -# SUBNTBCST_TFTP -# -subntbcst-tftp 247/udp # IANA assigned this [John_Fake] [John_Fake] -# well-formed service name as -# a replacement for -# "subntbcst_tftp". -# This entry is an alias to "subntbcst-tftp". This entry is now -subntbcst_tftp 247/udp # SUBNTBCST_TFTP [John_Fake] [John_Fake] historic, not usable for use with many common service -# discovery mechanisms. -bhfhs 248/tcp # bhfhs [John_Kelly] [John_Kelly] -bhfhs 248/udp # bhfhs [John_Kelly] [John_Kelly] -# 249-255 Reserved [Jon_Postel] [Jon_Postel] -rap 256/tcp # RAP [J_S_Greenfield] [J_S_Greenfield] -rap 256/udp # RAP [J_S_Greenfield] [J_S_Greenfield] -set 257/tcp # Secure Electronic [Donald_Eastlake] [Donald_Eastlake] -# Transaction -set 257/udp # Secure Electronic [Donald_Eastlake] [Donald_Eastlake] -# Transaction -# 258 Unassigned 2006-09-13 -esro-gen 259/tcp # Efficient Short Remote [Mohsen_Banan] [Mohsen_Banan] -# Operations -esro-gen 259/udp # Efficient Short Remote [Mohsen_Banan] [Mohsen_Banan] -# Operations -openport 260/tcp # Openport [John_Marland] [John_Marland] -openport 260/udp # Openport [John_Marland] [John_Marland] -nsiiops 261/tcp # IIOP Name Service over [Jeff_Stewart] [Jeff_Stewart] -# TLS/SSL -nsiiops 261/udp # IIOP Name Service over [Jeff_Stewart] [Jeff_Stewart] -# TLS/SSL -arcisdms 262/tcp # Arcisdms [Russell_Crook] [Russell_Crook] -arcisdms 262/udp # Arcisdms [Russell_Crook] [Russell_Crook] -hdap 263/tcp # HDAP [Troy_Gau] [Troy_Gau] -hdap 263/udp # HDAP [Troy_Gau] [Troy_Gau] -bgmp 264/tcp # BGMP [Dave_Thaler] [Dave_Thaler] -bgmp 264/udp # BGMP [Dave_Thaler] [Dave_Thaler] -x-bone-ctl 265/tcp # X-Bone CTL [Joe_Touch] [Joe_Touch] -x-bone-ctl 265/udp # X-Bone CTL [Joe_Touch] [Joe_Touch] -sst 266/tcp # SCSI on ST [Donald_D_Woelz] [Donald_D_Woelz] -sst 266/udp # SCSI on ST [Donald_D_Woelz] [Donald_D_Woelz] -td-service 267/tcp # Tobit David Service Layer -td-service 267/udp # Tobit David Service Layer -td-replica 268/tcp # Tobit David Replica [Franz_Josef_Leuders] [Franz_Josef_Leuders] -td-replica 268/udp # Tobit David Replica [Franz_Josef_Leuders] [Franz_Josef_Leuders] -manet 269/tcp # MANET Protocols [RFC5498] -manet 269/udp # MANET Protocols [RFC5498] -# 270 tcp Reserved -gist 270/udp # Q-mode encapsulation for [RFC5971] -# GIST messages -# IETF Network Endpoint -pt-tls 271/tcp # Assessment (NEA) Posture [IESG] [IETF_Chair] 2012-07-31 [RFC6876] -# Transport Protocol over TLS -# (PT-TLS) -# 271 udp Reserved -# 272-279 Unassigned -http-mgmt 280/tcp # http-mgmt [Adrian_Pell] [Adrian_Pell] -http-mgmt 280/udp # http-mgmt [Adrian_Pell] [Adrian_Pell] -personal-link 281/tcp # Personal Link [Dan_Cummings] [Dan_Cummings] -personal-link 281/udp # Personal Link [Dan_Cummings] [Dan_Cummings] -cableport-ax 282/tcp # Cable Port A/X [Craig_Langfahl] [Craig_Langfahl] -cableport-ax 282/udp # Cable Port A/X [Craig_Langfahl] [Craig_Langfahl] -rescap 283/tcp # rescap [Paul_Hoffman] [Paul_Hoffman] -rescap 283/udp # rescap [Paul_Hoffman] [Paul_Hoffman] -corerjd 284/tcp # corerjd [Chris_Thornhill] [Chris_Thornhill] -corerjd 284/udp # corerjd [Chris_Thornhill] [Chris_Thornhill] -# 285 Unassigned -fxp 286/tcp # FXP Communication [James_Darnall] [James_Darnall] -fxp 286/udp # FXP Communication [James_Darnall] [James_Darnall] -k-block 287/tcp # K-BLOCK [Simon_P_Jackson] [Simon_P_Jackson] -k-block 287/udp # K-BLOCK [Simon_P_Jackson] [Simon_P_Jackson] -# 288-307 Unassigned -novastorbakcup 308/tcp # Novastor Backup [Brian_Dickman] [Brian_Dickman] -novastorbakcup 308/udp # Novastor Backup [Brian_Dickman] [Brian_Dickman] -entrusttime 309/tcp # EntrustTime [Peter_Whittaker] [Peter_Whittaker] -entrusttime 309/udp # EntrustTime [Peter_Whittaker] [Peter_Whittaker] -bhmds 310/tcp # bhmds [John_Kelly] [John_Kelly] -bhmds 310/udp # bhmds [John_Kelly] [John_Kelly] -asip-webadmin 311/tcp # AppleShare IP WebAdmin [Ann_Huang] [Ann_Huang] -asip-webadmin 311/udp # AppleShare IP WebAdmin [Ann_Huang] [Ann_Huang] -vslmp 312/tcp # VSLMP [Gerben_Wierda] [Gerben_Wierda] -vslmp 312/udp # VSLMP [Gerben_Wierda] [Gerben_Wierda] -magenta-logic 313/tcp # Magenta Logic [Karl_Rousseau] [Karl_Rousseau] -magenta-logic 313/udp # Magenta Logic [Karl_Rousseau] [Karl_Rousseau] -opalis-robot 314/tcp # Opalis Robot [Laurent_Domenech] [Laurent_Domenech] -opalis-robot 314/udp # Opalis Robot [Laurent_Domenech] [Laurent_Domenech] -dpsi 315/tcp # DPSI [Tony_Scamurra] [Tony_Scamurra] -dpsi 315/udp # DPSI [Tony_Scamurra] [Tony_Scamurra] -decauth 316/tcp # decAuth [Michael_Agishtein] [Michael_Agishtein] -decauth 316/udp # decAuth [Michael_Agishtein] [Michael_Agishtein] -zannet 317/tcp # Zannet [Zan_Oliphant] [Zan_Oliphant] -zannet 317/udp # Zannet [Zan_Oliphant] [Zan_Oliphant] -pkix-timestamp 318/tcp # PKIX TimeStamp [Robert_Zuccherato] [Robert_Zuccherato] -pkix-timestamp 318/udp # PKIX TimeStamp [Robert_Zuccherato] [Robert_Zuccherato] -ptp-event 319/tcp # PTP Event [Kang_Lee] [Kang_Lee] 2010-07-27 -ptp-event 319/udp # PTP Event [Kang_Lee] [Kang_Lee] 2010-07-27 -ptp-general 320/tcp # PTP General [Kang_Lee] [Kang_Lee] 2010-07-27 -ptp-general 320/udp # PTP General [Kang_Lee] [Kang_Lee] 2010-07-27 -pip 321/tcp # PIP [Gordon_Mohr] [Gordon_Mohr] -pip 321/udp # PIP [Gordon_Mohr] [Gordon_Mohr] -rtsps 322/tcp # RTSPS [Anders_Klemets] [Anders_Klemets] -rtsps 322/udp # RTSPS [Anders_Klemets] [Anders_Klemets] -rpki-rtr 323/tcp # Resource PKI to Router [IESG] [IETF_Chair] [RFC6810] -# Protocol -# 323 udp Reserved -rpki-rtr-tls 324/tcp # Resource PKI to Router [IESG] [IETF_Chair] [RFC6810] -# Protocol over TLS -# 324 udp Reserved -# 325-332 Unassigned -texar 333/tcp # Texar Security Port [Eugen_Bacic] [Eugen_Bacic] -texar 333/udp # Texar Security Port [Eugen_Bacic] [Eugen_Bacic] -# 334-343 Unassigned -pdap 344/tcp # Prospero Data Access [B_Clifford_Neuman] [B_Clifford_Neuman] -# Protocol -pdap 344/udp # Prospero Data Access [B_Clifford_Neuman] [B_Clifford_Neuman] -# Protocol -pawserv 345/tcp # Perf Analysis Workbench -pawserv 345/udp # Perf Analysis Workbench -zserv 346/tcp # Zebra server -zserv 346/udp # Zebra server -fatserv 347/tcp # Fatmen Server -fatserv 347/udp # Fatmen Server -csi-sgwp 348/tcp # Cabletron Management -# Protocol -csi-sgwp 348/udp # Cabletron Management -# Protocol -mftp 349/tcp # mftp [Dave_Feinleib] [Dave_Feinleib] -mftp 349/udp # mftp [Dave_Feinleib] [Dave_Feinleib] -matip-type-a 350/tcp # MATIP Type A [Alain_Robert] [Alain_Robert] [RFC2351] -matip-type-a 350/udp # MATIP Type A [Alain_Robert] [Alain_Robert] [RFC2351] -matip-type-b 351/tcp # MATIP Type B [Alain_Robert] [Alain_Robert] [RFC2351] -matip-type-b 351/udp # MATIP Type B [Alain_Robert] [Alain_Robert] [RFC2351] -bhoetty 351/tcp # bhoetty [John_Kelly] [John_Kelly] This entry records an unassigned but widespread use (added -# 5/21/97) -bhoetty 351/udp # bhoetty [John_Kelly] [John_Kelly] This entry records an unassigned but widespread use (added -# 5/21/97) -dtag-ste-sb 352/tcp # DTAG [Ruediger_Wald] [Ruediger_Wald] (assigned long ago) -dtag-ste-sb 352/udp # DTAG [Ruediger_Wald] [Ruediger_Wald] (assigned long ago) -bhoedap4 352/tcp # bhoedap4 [John_Kelly] [John_Kelly] This entry records an unassigned but widespread use (added -# 5/21/97) -bhoedap4 352/udp # bhoedap4 [John_Kelly] [John_Kelly] This entry records an unassigned but widespread use (added -# 5/21/97) -ndsauth 353/tcp # NDSAUTH [Jayakumar_Ramalingam] [Jayakumar_Ramalingam] -ndsauth 353/udp # NDSAUTH [Jayakumar_Ramalingam] [Jayakumar_Ramalingam] -bh611 354/tcp # bh611 [John_Kelly] [John_Kelly] -bh611 354/udp # bh611 [John_Kelly] [John_Kelly] -datex-asn 355/tcp # DATEX-ASN [Kenneth_Vaughn] [Kenneth_Vaughn] -datex-asn 355/udp # DATEX-ASN [Kenneth_Vaughn] [Kenneth_Vaughn] -cloanto-net-1 356/tcp # Cloanto Net 1 [Michael_Battilana] [Michael_Battilana] 2010-04-30 -cloanto-net-1 356/udp # Cloanto Net 1 [Michael_Battilana] [Michael_Battilana] 2010-04-30 -bhevent 357/tcp # bhevent [John_Kelly] [John_Kelly] -bhevent 357/udp # bhevent [John_Kelly] [John_Kelly] -shrinkwrap 358/tcp # Shrinkwrap [Bill_Simpson] [Bill_Simpson] -shrinkwrap 358/udp # Shrinkwrap [Bill_Simpson] [Bill_Simpson] -nsrmp 359/tcp # Network Security Risk [Eric_Jacksch] [Eric_Jacksch] -# Management Protocol -nsrmp 359/udp # Network Security Risk [Eric_Jacksch] [Eric_Jacksch] -# Management Protocol -scoi2odialog 360/tcp # scoi2odialog [Keith_Petley] [Keith_Petley] -scoi2odialog 360/udp # scoi2odialog [Keith_Petley] [Keith_Petley] -semantix 361/tcp # Semantix [Semantix] [Semantix] -semantix 361/udp # Semantix [Semantix] [Semantix] -srssend 362/tcp # SRS Send [Curt_Mayer] [Curt_Mayer] -srssend 362/udp # SRS Send [Curt_Mayer] [Curt_Mayer] -# RSVP Tunnel -# -rsvp-tunnel 363/tcp # IANA assigned this [Andreas_Terzis] [Andreas_Terzis] -# well-formed service name as -# a replacement for -# "rsvp_tunnel". -# This entry is an alias to "rsvp-tunnel". This entry is now -rsvp_tunnel 363/tcp # RSVP Tunnel [Andreas_Terzis] [Andreas_Terzis] historic, not usable for use with many common service -# discovery mechanisms. -# RSVP Tunnel -# -rsvp-tunnel 363/udp # IANA assigned this [Andreas_Terzis] [Andreas_Terzis] -# well-formed service name as -# a replacement for -# "rsvp_tunnel". -# This entry is an alias to "rsvp-tunnel". This entry is now -rsvp_tunnel 363/udp # RSVP Tunnel [Andreas_Terzis] [Andreas_Terzis] historic, not usable for use with many common service -# discovery mechanisms. -aurora-cmgr 364/tcp # Aurora CMGR [Philip_Budne] [Philip_Budne] -aurora-cmgr 364/udp # Aurora CMGR [Philip_Budne] [Philip_Budne] -dtk 365/tcp # DTK [Fred_Cohen] [Fred_Cohen] -dtk 365/udp # DTK [Fred_Cohen] [Fred_Cohen] -odmr 366/tcp # ODMR [Randall_Gellens] [Randall_Gellens] -odmr 366/udp # ODMR [Randall_Gellens] [Randall_Gellens] -mortgageware 367/tcp # MortgageWare [Ole_Hellevik] [Ole_Hellevik] -mortgageware 367/udp # MortgageWare [Ole_Hellevik] [Ole_Hellevik] -qbikgdp 368/tcp # QbikGDP [Adrien_de_Croy] [Adrien_de_Croy] -qbikgdp 368/udp # QbikGDP [Adrien_de_Croy] [Adrien_de_Croy] -rpc2portmap 369/tcp # rpc2portmap -rpc2portmap 369/udp # rpc2portmap -codaauth2 370/tcp # codaauth2 [Robert_Watson] [Robert_Watson] -codaauth2 370/udp # codaauth2 [Robert_Watson] [Robert_Watson] -clearcase 371/tcp # Clearcase [Dave_LeBlang] [Dave_LeBlang] -clearcase 371/udp # Clearcase [Dave_LeBlang] [Dave_LeBlang] -ulistproc 372/tcp # ListProcessor [Anastasios_Kotsikona] [Anastasios_Kotsikona] -ulistproc 372/udp # ListProcessor [Anastasios_Kotsikona] [Anastasios_Kotsikona] -legent-1 373/tcp # Legent Corporation -legent-1 373/udp # Legent Corporation -legent-2 374/tcp # Legent Corporation [Keith_Boyce] [Keith_Boyce] -legent-2 374/udp # Legent Corporation [Keith_Boyce] [Keith_Boyce] -hassle 375/tcp # Hassle [Reinhard_Doelz] [Reinhard_Doelz] -hassle 375/udp # Hassle [Reinhard_Doelz] [Reinhard_Doelz] -nip 376/tcp # Amiga Envoy Network Inquiry [Heinz_Wrobel] [Heinz_Wrobel] -# Proto -nip 376/udp # Amiga Envoy Network Inquiry [Heinz_Wrobel] [Heinz_Wrobel] -# Proto -tnETOS 377/tcp # NEC Corporation -tnETOS 377/udp # NEC Corporation -dsETOS 378/tcp # NEC Corporation [Tomoo_Fujita] [Tomoo_Fujita] -dsETOS 378/udp # NEC Corporation [Tomoo_Fujita] [Tomoo_Fujita] -is99c 379/tcp # TIA/EIA/IS-99 modem client -is99c 379/udp # TIA/EIA/IS-99 modem client -is99s 380/tcp # TIA/EIA/IS-99 modem server [Frank_Quick] [Frank_Quick] -is99s 380/udp # TIA/EIA/IS-99 modem server [Frank_Quick] [Frank_Quick] -hp-collector 381/tcp # hp performance data -# collector -hp-collector 381/udp # hp performance data -# collector -hp-managed-node 382/tcp # hp performance data managed -# node -hp-managed-node 382/udp # hp performance data managed -# node -hp-alarm-mgr 383/tcp # hp performance data alarm [Frank_Blakely] [Frank_Blakely] -# manager -hp-alarm-mgr 383/udp # hp performance data alarm [Frank_Blakely] [Frank_Blakely] -# manager -arns 384/tcp # A Remote Network Server [David_Hornsby] [David_Hornsby] -# System -arns 384/udp # A Remote Network Server [David_Hornsby] [David_Hornsby] -# System -ibm-app 385/tcp # IBM Application [Lisa_Tomita] [Lisa_Tomita] -ibm-app 385/udp # IBM Application [Lisa_Tomita] [Lisa_Tomita] -asa 386/tcp # ASA Message Router Object [Steve_Laitinen] [Steve_Laitinen] -# Def. -asa 386/udp # ASA Message Router Object [Steve_Laitinen] [Steve_Laitinen] -# Def. -aurp 387/tcp # Appletalk Update-Based [Chris_Ranch] [Chris_Ranch] -# Routing Pro. -aurp 387/udp # Appletalk Update-Based [Chris_Ranch] [Chris_Ranch] -# Routing Pro. -unidata-ldm 388/tcp # Unidata LDM [University_Corporation_for_Atmospheric_Research2] [Steven_Emmerson2] 2012-05-18 -unidata-ldm 388/udp # Unidata LDM [University_Corporation_for_Atmospheric_Research2] [Steven_Emmerson2] 2012-05-18 -ldap 389/tcp # Lightweight Directory Access [Tim_Howes] [Tim_Howes] -# Protocol -ldap 389/udp # Lightweight Directory Access [Tim_Howes] [Tim_Howes] -# Protocol -uis 390/tcp # UIS [Ed_Barron] [Ed_Barron] -uis 390/udp # UIS [Ed_Barron] [Ed_Barron] -synotics-relay 391/tcp # SynOptics SNMP Relay Port -synotics-relay 391/udp # SynOptics SNMP Relay Port -synotics-broker 392/tcp # SynOptics Port Broker Port [Illan_Raab] [Illan_Raab] -synotics-broker 392/udp # SynOptics Port Broker Port [Illan_Raab] [Illan_Raab] -meta5 393/tcp # Meta5 [Jim_Kanzler] [Jim_Kanzler] -meta5 393/udp # Meta5 [Jim_Kanzler] [Jim_Kanzler] -embl-ndt 394/tcp # EMBL Nucleic Data Transfer [Peter_Gad] [Peter_Gad] -embl-ndt 394/udp # EMBL Nucleic Data Transfer [Peter_Gad] [Peter_Gad] -netcp 395/tcp # NetScout Control Protocol [Ashwani_Singhal] [Ashwani_Singhal] 2010-04-07 -netcp 395/udp # NetScout Control Protocol [Ashwani_Singhal] [Ashwani_Singhal] 2010-04-07 -netware-ip 396/tcp # Novell Netware over IP -netware-ip 396/udp # Novell Netware over IP -mptn 397/tcp # Multi Protocol Trans. Net. [Soumitra_Sarkar] [Soumitra_Sarkar] -mptn 397/udp # Multi Protocol Trans. Net. [Soumitra_Sarkar] [Soumitra_Sarkar] -kryptolan 398/tcp # Kryptolan [Peter_de_Laval] [Peter_de_Laval] -kryptolan 398/udp # Kryptolan [Peter_de_Laval] [Peter_de_Laval] -iso-tsap-c2 399/tcp # ISO Transport Class 2 [Yanick_Pouffary] [Yanick_Pouffary] -# Non-Control over TCP -iso-tsap-c2 399/udp # ISO Transport Class 2 [Yanick_Pouffary] [Yanick_Pouffary] -# Non-Control over UDP -osb-sd 400/tcp # Oracle Secure Backup [Joseph_Dziedzic] [Joseph_Dziedzic] 2008-06-06 Formerly was Workstation Solutions -osb-sd 400/udp # Oracle Secure Backup [Joseph_Dziedzic] [Joseph_Dziedzic] 2008-06-06 Formerly was Workstation Solutions -ups 401/tcp # Uninterruptible Power Supply [Charles_Bennett] [Charles_Bennett] 2008-08-29 -ups 401/udp # Uninterruptible Power Supply [Charles_Bennett] [Charles_Bennett] 2008-08-29 -genie 402/tcp # Genie Protocol [Mark_Hankin] [Mark_Hankin] -genie 402/udp # Genie Protocol [Mark_Hankin] [Mark_Hankin] -decap 403/tcp # decap -decap 403/udp # decap -nced 404/tcp # nced -nced 404/udp # nced -ncld 405/tcp # ncld [Richard_Jones] [Richard_Jones] -ncld 405/udp # ncld [Richard_Jones] [Richard_Jones] -imsp 406/tcp # Interactive Mail Support [John_Myers] [John_Myers] -# Protocol -imsp 406/udp # Interactive Mail Support [John_Myers] [John_Myers] -# Protocol -timbuktu 407/tcp # Timbuktu [Marc_Epard] [Marc_Epard] -timbuktu 407/udp # Timbuktu [Marc_Epard] [Marc_Epard] -prm-sm 408/tcp # Prospero Resource Manager -# Sys. Man. -prm-sm 408/udp # Prospero Resource Manager -# Sys. Man. -prm-nm 409/tcp # Prospero Resource Manager [B_Clifford_Neuman] [B_Clifford_Neuman] -# Node Man. -prm-nm 409/udp # Prospero Resource Manager [B_Clifford_Neuman] [B_Clifford_Neuman] -# Node Man. -decladebug 410/tcp # DECLadebug Remote Debug [Hewlett_Packard] [Hewlett_Packard] -# Protocol -decladebug 410/udp # DECLadebug Remote Debug [Hewlett_Packard] [Hewlett_Packard] -# Protocol -rmt 411/tcp # Remote MT Protocol [Peter_Eriksson] [Peter_Eriksson] -rmt 411/udp # Remote MT Protocol [Peter_Eriksson] [Peter_Eriksson] -synoptics-trap 412/tcp # Trap Convention Port [Illan_Raab] [Illan_Raab] -synoptics-trap 412/udp # Trap Convention Port [Illan_Raab] [Illan_Raab] -smsp 413/tcp # Storage Management Services [Murthy_Srinivas] [Murthy_Srinivas] -# Protocol -smsp 413/udp # Storage Management Services [Murthy_Srinivas] [Murthy_Srinivas] -# Protocol -infoseek 414/tcp # InfoSeek [Steve_Kirsch] [Steve_Kirsch] -infoseek 414/udp # InfoSeek [Steve_Kirsch] [Steve_Kirsch] -bnet 415/tcp # BNet [Jim_Mertz] [Jim_Mertz] -bnet 415/udp # BNet [Jim_Mertz] [Jim_Mertz] -silverplatter 416/tcp # Silverplatter [Peter_Ciuffetti] [Peter_Ciuffetti] -silverplatter 416/udp # Silverplatter [Peter_Ciuffetti] [Peter_Ciuffetti] -onmux 417/tcp # Onmux [Stephen_Hanna] [Stephen_Hanna] -onmux 417/udp # Onmux [Stephen_Hanna] [Stephen_Hanna] -hyper-g 418/tcp # Hyper-G [Frank_Kappe] [Frank_Kappe] -hyper-g 418/udp # Hyper-G [Frank_Kappe] [Frank_Kappe] -ariel1 419/tcp # Ariel 1 [Joel_Karafin] [Joel_Karafin] -ariel1 419/udp # Ariel 1 [Joel_Karafin] [Joel_Karafin] -smpte 420/tcp # SMPTE [Si_Becker] [Si_Becker] -smpte 420/udp # SMPTE [Si_Becker] [Si_Becker] -ariel2 421/tcp # Ariel 2 -ariel2 421/udp # Ariel 2 -ariel3 422/tcp # Ariel 3 [Joel_Karafin] [Joel_Karafin] -ariel3 422/udp # Ariel 3 [Joel_Karafin] [Joel_Karafin] -opc-job-start 423/tcp # IBM Operations Planning and -# Control Start -opc-job-start 423/udp # IBM Operations Planning and -# Control Start -opc-job-track 424/tcp # IBM Operations Planning and [Conny_Larsson] [Conny_Larsson] -# Control Track -opc-job-track 424/udp # IBM Operations Planning and [Conny_Larsson] [Conny_Larsson] -# Control Track -icad-el 425/tcp # ICAD [Larry_Stone] [Larry_Stone] -icad-el 425/udp # ICAD [Larry_Stone] [Larry_Stone] -smartsdp 426/tcp # smartsdp [Marie_Pierre_Belange] [Marie_Pierre_Belange] -smartsdp 426/udp # smartsdp [Marie_Pierre_Belange] [Marie_Pierre_Belange] -svrloc 427/tcp # Server Location [Veizades] [Veizades] -svrloc 427/udp # Server Location [Veizades] [Veizades] -# OCS_CMU -# -ocs-cmu 428/tcp # IANA assigned this -# well-formed service name as -# a replacement for "ocs_cmu". -# This entry is an alias to "ocs-cmu". This entry is now -ocs_cmu 428/tcp # OCS_CMU historic, not usable for use with many common service -# discovery mechanisms. -# OCS_CMU -# -ocs-cmu 428/udp # IANA assigned this -# well-formed service name as -# a replacement for "ocs_cmu". -# This entry is an alias to "ocs-cmu". This entry is now -ocs_cmu 428/udp # OCS_CMU historic, not usable for use with many common service -# discovery mechanisms. -# OCS_AMU -# -ocs-amu 429/tcp # IANA assigned this [Florence_Wyman] [Florence_Wyman] -# well-formed service name as -# a replacement for "ocs_amu". -# This entry is an alias to "ocs-amu". This entry is now -ocs_amu 429/tcp # OCS_AMU [Florence_Wyman] [Florence_Wyman] historic, not usable for use with many common service -# discovery mechanisms. -# OCS_AMU -# -ocs-amu 429/udp # IANA assigned this [Florence_Wyman] [Florence_Wyman] -# well-formed service name as -# a replacement for "ocs_amu". -# This entry is an alias to "ocs-amu". This entry is now -ocs_amu 429/udp # OCS_AMU [Florence_Wyman] [Florence_Wyman] historic, not usable for use with many common service -# discovery mechanisms. -utmpsd 430/tcp # UTMPSD -utmpsd 430/udp # UTMPSD -utmpcd 431/tcp # UTMPCD -utmpcd 431/udp # UTMPCD -iasd 432/tcp # IASD [Nir_Baroz] [Nir_Baroz] -iasd 432/udp # IASD [Nir_Baroz] [Nir_Baroz] -nnsp 433/tcp # NNSP [Rob_Robertson] [Rob_Robertson] -nnsp 433/udp # NNSP [Rob_Robertson] [Rob_Robertson] -mobileip-agent 434/tcp # MobileIP-Agent -mobileip-agent 434/udp # MobileIP-Agent -mobilip-mn 435/tcp # MobilIP-MN [Kannan_Alagappan_2] [Kannan_Alagappan_2] -mobilip-mn 435/udp # MobilIP-MN [Kannan_Alagappan_2] [Kannan_Alagappan_2] -dna-cml 436/tcp # DNA-CML [Dan_Flowers] [Dan_Flowers] -dna-cml 436/udp # DNA-CML [Dan_Flowers] [Dan_Flowers] -comscm 437/tcp # comscm [Jim_Teague] [Jim_Teague] -comscm 437/udp # comscm [Jim_Teague] [Jim_Teague] -dsfgw 438/tcp # dsfgw [Andy_McKeen] [Andy_McKeen] -dsfgw 438/udp # dsfgw [Andy_McKeen] [Andy_McKeen] -dasp 439/tcp # dasp [Thomas_Obermair] [Thomas_Obermair] -dasp 439/udp # dasp [Thomas_Obermair] [Thomas_Obermair] -sgcp 440/tcp # sgcp [Marshall_Rose] [Marshall_Rose] -sgcp 440/udp # sgcp [Marshall_Rose] [Marshall_Rose] -decvms-sysmgt 441/tcp # decvms-sysmgt [Lee_Barton] [Lee_Barton] -decvms-sysmgt 441/udp # decvms-sysmgt [Lee_Barton] [Lee_Barton] -# cvc_hostd -# -cvc-hostd 442/tcp # IANA assigned this [Bill_Davidson] [Bill_Davidson] -# well-formed service name as -# a replacement for -# "cvc_hostd". -# This entry is an alias to "cvc-hostd". This entry is now -cvc_hostd 442/tcp # cvc_hostd [Bill_Davidson] [Bill_Davidson] historic, not usable for use with many common service -# discovery mechanisms. -# cvc_hostd -# -cvc-hostd 442/udp # IANA assigned this [Bill_Davidson] [Bill_Davidson] -# well-formed service name as -# a replacement for -# "cvc_hostd". -# This entry is an alias to "cvc-hostd". This entry is now -cvc_hostd 442/udp # cvc_hostd [Bill_Davidson] [Bill_Davidson] historic, not usable for use with many common service -# discovery mechanisms. -https 443/tcp # http protocol over TLS/SSL [Kipp_E_B_Hickman] [Kipp_E_B_Hickman] -https 443/udp # http protocol over TLS/SSL [Kipp_E_B_Hickman] [Kipp_E_B_Hickman] -https 443/sctp # HTTPS [Randall_Stewart] [Randall_Stewart] [RFC4960] -snpp 444/tcp # Simple Network Paging [RFC1568] -# Protocol -snpp 444/udp # Simple Network Paging [RFC1568] -# Protocol -microsoft-ds 445/tcp # Microsoft-DS [Pradeep_Bahl] [Pradeep_Bahl] -microsoft-ds 445/udp # Microsoft-DS [Pradeep_Bahl] [Pradeep_Bahl] -ddm-rdb 446/tcp # DDM-Remote Relational -# Database Access -ddm-rdb 446/udp # DDM-Remote Relational -# Database Access -ddm-dfm 447/tcp # DDM-Distributed File [Steven_Ritland] [Steven_Ritland] -# Management -ddm-dfm 447/udp # DDM-Distributed File [Steven_Ritland] [Steven_Ritland] -# Management -ddm-ssl 448/tcp # DDM-Remote DB Access Using [Steven_Ritland] [Steven_Ritland] -# Secure Sockets -ddm-ssl 448/udp # DDM-Remote DB Access Using [Steven_Ritland] [Steven_Ritland] -# Secure Sockets -as-servermap 449/tcp # AS Server Mapper [Barbara_Foss] [Barbara_Foss] -as-servermap 449/udp # AS Server Mapper [Barbara_Foss] [Barbara_Foss] -# Computer Supported -tserver 450/tcp # Telecomunication [Harvey_S_Schultz] [Harvey_S_Schultz] -# Applications -# Computer Supported -tserver 450/udp # Telecomunication [Harvey_S_Schultz] [Harvey_S_Schultz] -# Applications -sfs-smp-net 451/tcp # Cray Network Semaphore -# server -sfs-smp-net 451/udp # Cray Network Semaphore -# server -sfs-config 452/tcp # Cray SFS config server [Walter_Poxon] [Walter_Poxon] -sfs-config 452/udp # Cray SFS config server [Walter_Poxon] [Walter_Poxon] -creativeserver 453/tcp # CreativeServer -creativeserver 453/udp # CreativeServer -contentserver 454/tcp # ContentServer -contentserver 454/udp # ContentServer -creativepartnr 455/tcp # CreativePartnr [Jesus_Ortiz] [Jesus_Ortiz] -creativepartnr 455/udp # CreativePartnr [Jesus_Ortiz] [Jesus_Ortiz] -macon-tcp 456/tcp # macon-tcp [Yoshinobu_Inoue] [Yoshinobu_Inoue] -macon-udp 456/udp # macon-udp [Yoshinobu_Inoue] [Yoshinobu_Inoue] -scohelp 457/tcp # scohelp [Faith_Zack] [Faith_Zack] -scohelp 457/udp # scohelp [Faith_Zack] [Faith_Zack] -appleqtc 458/tcp # apple quick time [Murali_Ranganathan] [Murali_Ranganathan] -appleqtc 458/udp # apple quick time [Murali_Ranganathan] [Murali_Ranganathan] -ampr-rcmd 459/tcp # ampr-rcmd [Rob_Janssen] [Rob_Janssen] -ampr-rcmd 459/udp # ampr-rcmd [Rob_Janssen] [Rob_Janssen] -skronk 460/tcp # skronk [Henry_Strickland] [Henry_Strickland] -skronk 460/udp # skronk [Henry_Strickland] [Henry_Strickland] -datasurfsrv 461/tcp # DataRampSrv -datasurfsrv 461/udp # DataRampSrv -datasurfsrvsec 462/tcp # DataRampSrvSec [Diane_Downie] [Diane_Downie] -datasurfsrvsec 462/udp # DataRampSrvSec [Diane_Downie] [Diane_Downie] -alpes 463/tcp # alpes [Alain_Durand] [Alain_Durand] -alpes 463/udp # alpes [Alain_Durand] [Alain_Durand] -kpasswd 464/tcp # kpasswd [Theodore_Ts_o] [Theodore_Ts_o] -kpasswd 464/udp # kpasswd [Theodore_Ts_o] [Theodore_Ts_o] -urd 465/tcp # URL Rendesvous Directory for [Toerless_Eckert] [Toerless_Eckert] -# SSM -igmpv3lite 465/udp # IGMP over UDP for SSM [Toerless_Eckert] [Toerless_Eckert] -digital-vrc 466/tcp # digital-vrc [Peter_Higginson] [Peter_Higginson] -digital-vrc 466/udp # digital-vrc [Peter_Higginson] [Peter_Higginson] -mylex-mapd 467/tcp # mylex-mapd [Gary_Lewis] [Gary_Lewis] -mylex-mapd 467/udp # mylex-mapd [Gary_Lewis] [Gary_Lewis] -photuris 468/tcp # proturis [Bill_Simpson_2] [Bill_Simpson_2] -photuris 468/udp # proturis [Bill_Simpson_2] [Bill_Simpson_2] -rcp 469/tcp # Radio Control Protocol [Jim_Jennings] [Jim_Jennings] -rcp 469/udp # Radio Control Protocol [Jim_Jennings] [Jim_Jennings] -scx-proxy 470/tcp # scx-proxy [Scott_Narveson] [Scott_Narveson] -scx-proxy 470/udp # scx-proxy [Scott_Narveson] [Scott_Narveson] -mondex 471/tcp # Mondex [Bill_Reding] [Bill_Reding] -mondex 471/udp # Mondex [Bill_Reding] [Bill_Reding] -ljk-login 472/tcp # ljk-login [LJK] [LJK] -ljk-login 472/udp # ljk-login [LJK] [LJK] -hybrid-pop 473/tcp # hybrid-pop [Rami_Rubin] [Rami_Rubin] -hybrid-pop 473/udp # hybrid-pop [Rami_Rubin] [Rami_Rubin] -tn-tl-w1 474/tcp # tn-tl-w1 -tn-tl-w2 474/udp # tn-tl-w2 [Ed_Kress] [Ed_Kress] -tcpnethaspsrv 475/tcp # tcpnethaspsrv [Michael_Zunke] [Michael_Zunke] 2010-07-23 -tcpnethaspsrv 475/udp # tcpnethaspsrv [Michael_Zunke] [Michael_Zunke] 2010-07-23 -tn-tl-fd1 476/tcp # tn-tl-fd1 [Ed_Kress] [Ed_Kress] -tn-tl-fd1 476/udp # tn-tl-fd1 [Ed_Kress] [Ed_Kress] -ss7ns 477/tcp # ss7ns [Jean_Michel_URSCH] [Jean_Michel_URSCH] -ss7ns 477/udp # ss7ns [Jean_Michel_URSCH] [Jean_Michel_URSCH] -spsc 478/tcp # spsc [Mike_Rieker] [Mike_Rieker] -spsc 478/udp # spsc [Mike_Rieker] [Mike_Rieker] -iafserver 479/tcp # iafserver -iafserver 479/udp # iafserver -iafdbase 480/tcp # iafdbase [Rick_Yazwinski] [Rick_Yazwinski] -iafdbase 480/udp # iafdbase [Rick_Yazwinski] [Rick_Yazwinski] -ph 481/tcp # Ph service [Roland_Hedberg] [Roland_Hedberg] -ph 481/udp # Ph service [Roland_Hedberg] [Roland_Hedberg] -bgs-nsi 482/tcp # bgs-nsi [Jon_Saperia] [Jon_Saperia] -bgs-nsi 482/udp # bgs-nsi [Jon_Saperia] [Jon_Saperia] -ulpnet 483/tcp # ulpnet [Kevin_Mooney] [Kevin_Mooney] -ulpnet 483/udp # ulpnet [Kevin_Mooney] [Kevin_Mooney] -integra-sme 484/tcp # Integra Software Management [Randall_Dow] [Randall_Dow] -# Environment -integra-sme 484/udp # Integra Software Management [Randall_Dow] [Randall_Dow] -# Environment -powerburst 485/tcp # Air Soft Power Burst [gary] [gary] -powerburst 485/udp # Air Soft Power Burst [gary] [gary] -avian 486/tcp # avian [Robert_Ullmann_2] [Robert_Ullmann_2] -avian 486/udp # avian [Robert_Ullmann_2] [Robert_Ullmann_2] -saft 487/tcp # saft Simple Asynchronous [Ulli_Horlacher] [Ulli_Horlacher] -# File Transfer -saft 487/udp # saft Simple Asynchronous [Ulli_Horlacher] [Ulli_Horlacher] -# File Transfer -gss-http 488/tcp # gss-http [Doug_Rosenthal] [Doug_Rosenthal] -gss-http 488/udp # gss-http [Doug_Rosenthal] [Doug_Rosenthal] -nest-protocol 489/tcp # nest-protocol [Gilles_Gameiro] [Gilles_Gameiro] -nest-protocol 489/udp # nest-protocol [Gilles_Gameiro] [Gilles_Gameiro] -micom-pfs 490/tcp # micom-pfs [David_Misunas] [David_Misunas] -micom-pfs 490/udp # micom-pfs [David_Misunas] [David_Misunas] -go-login 491/tcp # go-login [Troy_Morrison] [Troy_Morrison] -go-login 491/udp # go-login [Troy_Morrison] [Troy_Morrison] -ticf-1 492/tcp # Transport Independent -# Convergence for FNA -ticf-1 492/udp # Transport Independent -# Convergence for FNA -ticf-2 493/tcp # Transport Independent [Mamoru_Ito] [Mamoru_Ito] -# Convergence for FNA -ticf-2 493/udp # Transport Independent [Mamoru_Ito] [Mamoru_Ito] -# Convergence for FNA -pov-ray 494/tcp # POV-Ray [POV_Team_Co_ordinato] [POV_Team_Co_ordinato] -pov-ray 494/udp # POV-Ray [POV_Team_Co_ordinato] [POV_Team_Co_ordinato] -intecourier 495/tcp # intecourier [Steve_Favor] [Steve_Favor] -intecourier 495/udp # intecourier [Steve_Favor] [Steve_Favor] -pim-rp-disc 496/tcp # PIM-RP-DISC [Dino_Farinacci] [Dino_Farinacci] -pim-rp-disc 496/udp # PIM-RP-DISC [Dino_Farinacci] [Dino_Farinacci] -retrospect 497/tcp # Retrospect backup and [Retrospect_Inc] [JG_Heithcock] 2012-02-02 -# restore service -retrospect 497/udp # Retrospect backup and [Retrospect_Inc] [JG_Heithcock] 2012-02-02 -# restore service -siam 498/tcp # siam [Philippe_Gilbert] [Philippe_Gilbert] -siam 498/udp # siam [Philippe_Gilbert] [Philippe_Gilbert] -iso-ill 499/tcp # ISO ILL Protocol [Mark_H_Needleman] [Mark_H_Needleman] -iso-ill 499/udp # ISO ILL Protocol [Mark_H_Needleman] [Mark_H_Needleman] -isakmp 500/tcp # isakmp [Mark_Schertler] [Mark_Schertler] -isakmp 500/udp # isakmp [Mark_Schertler] [Mark_Schertler] -stmf 501/tcp # STMF [Alan_Ungar] [Alan_Ungar] -stmf 501/udp # STMF [Alan_Ungar] [Alan_Ungar] -mbap 502/tcp # Modbus Application Protocol [modbus.org] [Dennis_Dube] 2014-06-10 -mbap 502/udp # Modbus Application Protocol [modbus.org] [Dennis_Dube] 2014-06-10 -intrinsa 503/tcp # Intrinsa [Robert_Ford] [Robert_Ford] -intrinsa 503/udp # Intrinsa [Robert_Ford] [Robert_Ford] -citadel 504/tcp # citadel [Art_Cancro] [Art_Cancro] -citadel 504/udp # citadel [Art_Cancro] [Art_Cancro] -mailbox-lm 505/tcp # mailbox-lm [Beverly_Moody] [Beverly_Moody] -mailbox-lm 505/udp # mailbox-lm [Beverly_Moody] [Beverly_Moody] -ohimsrv 506/tcp # ohimsrv [Scott_Powell] [Scott_Powell] -ohimsrv 506/udp # ohimsrv [Scott_Powell] [Scott_Powell] -crs 507/tcp # crs [Brad_Wright] [Brad_Wright] -crs 507/udp # crs [Brad_Wright] [Brad_Wright] -xvttp 508/tcp # xvttp [Keith_J_Alphonso] [Keith_J_Alphonso] -xvttp 508/udp # xvttp [Keith_J_Alphonso] [Keith_J_Alphonso] -snare 509/tcp # snare [Dennis_Batchelder] [Dennis_Batchelder] -snare 509/udp # snare [Dennis_Batchelder] [Dennis_Batchelder] -fcp 510/tcp # FirstClass Protocol [Mike_Marshburn] [Mike_Marshburn] -fcp 510/udp # FirstClass Protocol [Mike_Marshburn] [Mike_Marshburn] -passgo 511/tcp # PassGo [John_Rainford] [John_Rainford] -passgo 511/udp # PassGo [John_Rainford] [John_Rainford] -# remote process execution; -exec 512/tcp # authentication performed -# using passwords and UNIX -# login names -comsat 512/udp -# used by mail system to -# notify users of new mail -biff 512/udp # received; currently receives -# messages only from processes -# on the same machine -# remote login a la telnet; -# automatic authentication -# performed based on -login 513/tcp # priviledged port numbers and -# distributed data bases which -# identify "authentication -# domains" -# maintains data bases showing -who 513/udp # who's logged in to machines -# on a local net and the load -# average of the machine -# cmd like exec, but automatic -shell 514/tcp # authentication is performed -# as for login server -syslog 514/udp -printer 515/tcp # spooler -printer 515/udp # spooler -videotex 516/tcp # videotex [Daniel_Mavrakis] [Daniel_Mavrakis] -videotex 516/udp # videotex [Daniel_Mavrakis] [Daniel_Mavrakis] -# like tenex link, but across -# machine - unfortunately, -# doesn't use link protocol -talk 517/tcp # (this is actually just a -# rendezvous port from which a -# tcp connection is -# established) -# like tenex link, but across -# machine - unfortunately, -# doesn't use link protocol -talk 517/udp # (this is actually just a -# rendezvous port from which a -# tcp connection is -# established) -ntalk 518/tcp -ntalk 518/udp -utime 519/tcp # unixtime -utime 519/udp # unixtime -efs 520/tcp # extended file name server -# local routing process (on -router 520/udp # site); uses variant of Xerox -# NS routing information -# protocol - RIP -ripng 521/tcp # ripng [Robert_E_Minnear] [Robert_E_Minnear] -ripng 521/udp # ripng [Robert_E_Minnear] [Robert_E_Minnear] -ulp 522/tcp # ULP [Max_Morris] [Max_Morris] -ulp 522/udp # ULP [Max_Morris] [Max_Morris] -ibm-db2 523/tcp # IBM-DB2 [Juliana_Hsu] [Juliana_Hsu] -ibm-db2 523/udp # IBM-DB2 [Juliana_Hsu] [Juliana_Hsu] -ncp 524/tcp # NCP [Don_Provan_2] [Don_Provan_2] -ncp 524/udp # NCP [Don_Provan_2] [Don_Provan_2] -timed 525/tcp # timeserver -timed 525/udp # timeserver -tempo 526/tcp # newdate -tempo 526/udp # newdate -stx 527/tcp # Stock IXChange [Fraxion_Software] [Ferdi_Ladeira] 2012-03-21 -stx 527/udp # Stock IXChange [Fraxion_Software] [Ferdi_Ladeira] 2012-03-21 -custix 528/tcp # Customer IXChange [Fraxion_Software] [Ferdi_Ladeira] 2012-03-21 -custix 528/udp # Customer IXChange [Fraxion_Software] [Ferdi_Ladeira] 2012-03-21 -irc-serv 529/tcp # IRC-SERV [Brian_Tackett] [Brian_Tackett] -irc-serv 529/udp # IRC-SERV [Brian_Tackett] [Brian_Tackett] -courier 530/tcp # rpc -courier 530/udp # rpc -conference 531/tcp # chat -conference 531/udp # chat -netnews 532/tcp # readnews -netnews 532/udp # readnews -netwall 533/tcp # for emergency broadcasts [Andreas_Heidemann] [Andreas_Heidemann] -netwall 533/udp # for emergency broadcasts [Andreas_Heidemann] [Andreas_Heidemann] -windream 534/tcp # windream Admin [Uwe_Honermann] [Uwe_Honermann] -windream 534/udp # windream Admin [Uwe_Honermann] [Uwe_Honermann] -iiop 535/tcp # iiop [Jeff_M_Michaud] [Jeff_M_Michaud] -iiop 535/udp # iiop [Jeff_M_Michaud] [Jeff_M_Michaud] -opalis-rdv 536/tcp # opalis-rdv [Laurent_Domenech] [Laurent_Domenech] -opalis-rdv 536/udp # opalis-rdv [Laurent_Domenech] [Laurent_Domenech] -nmsp 537/tcp # Networked Media Streaming [Paul_Santinelli_Jr] [Paul_Santinelli_Jr] -# Protocol -nmsp 537/udp # Networked Media Streaming [Paul_Santinelli_Jr] [Paul_Santinelli_Jr] -# Protocol -gdomap 538/tcp # gdomap [Richard_Frith_Macdon] [Richard_Frith_Macdon] -gdomap 538/udp # gdomap [Richard_Frith_Macdon] [Richard_Frith_Macdon] -apertus-ldp 539/tcp # Apertus Technologies Load -# Determination -apertus-ldp 539/udp # Apertus Technologies Load -# Determination -uucp 540/tcp # uucpd -uucp 540/udp # uucpd -uucp-rlogin 541/tcp # uucp-rlogin [Stuart_Lynne] [Stuart_Lynne] -uucp-rlogin 541/udp # uucp-rlogin [Stuart_Lynne] [Stuart_Lynne] -commerce 542/tcp # commerce [Randy_Epstein] [Randy_Epstein] -commerce 542/udp # commerce [Randy_Epstein] [Randy_Epstein] -klogin 543/tcp -klogin 543/udp -kshell 544/tcp # krcmd -kshell 544/udp # krcmd -appleqtcsrvr 545/tcp # appleqtcsrvr [Murali_Ranganathan] [Murali_Ranganathan] -appleqtcsrvr 545/udp # appleqtcsrvr [Murali_Ranganathan] [Murali_Ranganathan] -dhcpv6-client 546/tcp # DHCPv6 Client -dhcpv6-client 546/udp # DHCPv6 Client -dhcpv6-server 547/tcp # DHCPv6 Server [Jim_Bound] [Jim_Bound] -dhcpv6-server 547/udp # DHCPv6 Server [Jim_Bound] [Jim_Bound] -afpovertcp 548/tcp # AFP over TCP [Leland_Wallace] [Leland_Wallace] Defined TXT keys: u= p= path= -afpovertcp 548/udp # AFP over TCP [Leland_Wallace] [Leland_Wallace] Defined TXT keys: u= p= path= -idfp 549/tcp # IDFP [Ramana_Kovi] [Ramana_Kovi] -idfp 549/udp # IDFP [Ramana_Kovi] [Ramana_Kovi] -new-rwho 550/tcp # new-who [n/a] -new-rwho 550/udp # new-who [n/a] -cybercash 551/tcp # cybercash [Donald_E_Eastlake] [Donald_E_Eastlake] [RFC1898] -cybercash 551/udp # cybercash [Donald_E_Eastlake] [Donald_E_Eastlake] [RFC1898] -devshr-nts 552/tcp # DeviceShare [Benjamin_Rosenberg] [Benjamin_Rosenberg] -devshr-nts 552/udp # DeviceShare [Benjamin_Rosenberg] [Benjamin_Rosenberg] -pirp 553/tcp # pirp [D_J_Bernstein] [D_J_Bernstein] -pirp 553/udp # pirp [D_J_Bernstein] [D_J_Bernstein] -rtsp 554/tcp # Real Time Streaming Protocol [Rob_Lanphier] [Rob_Lanphier] -# (RTSP) -rtsp 554/udp # Real Time Streaming Protocol [Rob_Lanphier] [Rob_Lanphier] -# (RTSP) -dsf 555/tcp -dsf 555/udp -remotefs 556/tcp # rfs server -remotefs 556/udp # rfs server -openvms-sysipc 557/tcp # openvms-sysipc [Alan_Potter] [Alan_Potter] -openvms-sysipc 557/udp # openvms-sysipc [Alan_Potter] [Alan_Potter] -sdnskmp 558/tcp # SDNSKMP -sdnskmp 558/udp # SDNSKMP -teedtap 559/tcp # TEEDTAP [Charlie_Limoges] [Charlie_Limoges] -teedtap 559/udp # TEEDTAP [Charlie_Limoges] [Charlie_Limoges] -rmonitor 560/tcp # rmonitord -rmonitor 560/udp # rmonitord -monitor 561/tcp -monitor 561/udp -chshell 562/tcp # chcmd -chshell 562/udp # chcmd -nntps 563/tcp # nntp protocol over TLS/SSL [Kipp_E_B_Hickman_2] [Kipp_E_B_Hickman_2] -# (was snntp) -nntps 563/udp # nntp protocol over TLS/SSL [Kipp_E_B_Hickman_2] [Kipp_E_B_Hickman_2] -# (was snntp) -9pfs 564/tcp # plan 9 file service -9pfs 564/udp # plan 9 file service -whoami 565/tcp # whoami -whoami 565/udp # whoami -streettalk 566/tcp # streettalk -streettalk 566/udp # streettalk -banyan-rpc 567/tcp # banyan-rpc [Tom_Lemaire] [Tom_Lemaire] -banyan-rpc 567/udp # banyan-rpc [Tom_Lemaire] [Tom_Lemaire] -ms-shuttle 568/tcp # microsoft shuttle [Rudolph_Balaz] [Rudolph_Balaz] -ms-shuttle 568/udp # microsoft shuttle [Rudolph_Balaz] [Rudolph_Balaz] -ms-rome 569/tcp # microsoft rome [Rudolph_Balaz] [Rudolph_Balaz] -ms-rome 569/udp # microsoft rome [Rudolph_Balaz] [Rudolph_Balaz] -meter 570/tcp # demon -meter 570/udp # demon -meter 571/tcp # udemon -meter 571/udp # udemon -sonar 572/tcp # sonar [Keith_Moore] [Keith_Moore] -sonar 572/udp # sonar [Keith_Moore] [Keith_Moore] -banyan-vip 573/tcp # banyan-vip [Denis_Leclerc] [Denis_Leclerc] -banyan-vip 573/udp # banyan-vip [Denis_Leclerc] [Denis_Leclerc] -ftp-agent 574/tcp # FTP Software Agent System [Michael_S_Greenberg] [Michael_S_Greenberg] -ftp-agent 574/udp # FTP Software Agent System [Michael_S_Greenberg] [Michael_S_Greenberg] -vemmi 575/tcp # VEMMI [Daniel_Mavrakis_2] [Daniel_Mavrakis_2] -vemmi 575/udp # VEMMI [Daniel_Mavrakis_2] [Daniel_Mavrakis_2] -ipcd 576/tcp # ipcd -ipcd 576/udp # ipcd -vnas 577/tcp # vnas -vnas 577/udp # vnas -ipdd 578/tcp # ipdd [Jay_Farhat] [Jay_Farhat] -ipdd 578/udp # ipdd [Jay_Farhat] [Jay_Farhat] -decbsrv 579/tcp # decbsrv [Rudi_Martin] [Rudi_Martin] -decbsrv 579/udp # decbsrv [Rudi_Martin] [Rudi_Martin] -sntp-heartbeat 580/tcp # SNTP HEARTBEAT [Louis_Mamakos_2] [Louis_Mamakos_2] -sntp-heartbeat 580/udp # SNTP HEARTBEAT [Louis_Mamakos_2] [Louis_Mamakos_2] -bdp 581/tcp # Bundle Discovery Protocol [Gary_Malkin] [Gary_Malkin] -bdp 581/udp # Bundle Discovery Protocol [Gary_Malkin] [Gary_Malkin] -scc-security 582/tcp # SCC Security [Prashant_Dholakia] [Prashant_Dholakia] -scc-security 582/udp # SCC Security [Prashant_Dholakia] [Prashant_Dholakia] -philips-vc 583/tcp # Philips Video-Conferencing [Janna_Chang] [Janna_Chang] -philips-vc 583/udp # Philips Video-Conferencing [Janna_Chang] [Janna_Chang] -keyserver 584/tcp # Key Server [Gary_Howland] [Gary_Howland] -keyserver 584/udp # Key Server [Gary_Howland] [Gary_Howland] -# 585 De-registered 2006-04-25 Use of 585 is not recommended, use 993 instead -password-chg 586/tcp # Password Change -password-chg 586/udp # Password Change -submission 587/tcp # Message Submission 2011-11-17 [RFC6409] -submission 587/udp # Message Submission 2011-11-17 [RFC6409] -cal 588/tcp # CAL [Myron_Hattig] [Myron_Hattig] -cal 588/udp # CAL [Myron_Hattig] [Myron_Hattig] -eyelink 589/tcp # EyeLink [Dave_Stampe] [Dave_Stampe] -eyelink 589/udp # EyeLink [Dave_Stampe] [Dave_Stampe] -tns-cml 590/tcp # TNS CML [Jerome_Albin] [Jerome_Albin] -tns-cml 590/udp # TNS CML [Jerome_Albin] [Jerome_Albin] -http-alt 591/tcp # FileMaker, Inc. - HTTP [Clay_Maeckel] [Clay_Maeckel] -# Alternate (see Port 80) -http-alt 591/udp # FileMaker, Inc. - HTTP [Clay_Maeckel] [Clay_Maeckel] -# Alternate (see Port 80) -eudora-set 592/tcp # Eudora Set [Randall_Gellens] [Randall_Gellens] -eudora-set 592/udp # Eudora Set [Randall_Gellens] [Randall_Gellens] -http-rpc-epmap 593/tcp # HTTP RPC Ep Map [Edward_Reus] [Edward_Reus] -http-rpc-epmap 593/udp # HTTP RPC Ep Map [Edward_Reus] [Edward_Reus] -tpip 594/tcp # TPIP [Brad_Spear] [Brad_Spear] -tpip 594/udp # TPIP [Brad_Spear] [Brad_Spear] -cab-protocol 595/tcp # CAB Protocol [Winston_Hetherington] [Winston_Hetherington] -cab-protocol 595/udp # CAB Protocol [Winston_Hetherington] [Winston_Hetherington] -smsd 596/tcp # SMSD [Wayne_Barlow] [Wayne_Barlow] -smsd 596/udp # SMSD [Wayne_Barlow] [Wayne_Barlow] -ptcnameservice 597/tcp # PTC Name Service [Yuri_Machkasov] [Yuri_Machkasov] -ptcnameservice 597/udp # PTC Name Service [Yuri_Machkasov] [Yuri_Machkasov] -sco-websrvrmg3 598/tcp # SCO Web Server Manager 3 [Simon_Baldwin] [Simon_Baldwin] -sco-websrvrmg3 598/udp # SCO Web Server Manager 3 [Simon_Baldwin] [Simon_Baldwin] -acp 599/tcp # Aeolon Core Protocol [Michael_Alyn_Miller] [Michael_Alyn_Miller] -acp 599/udp # Aeolon Core Protocol [Michael_Alyn_Miller] [Michael_Alyn_Miller] -ipcserver 600/tcp # Sun IPC server [Bill_Schiefelbein] [Bill_Schiefelbein] -ipcserver 600/udp # Sun IPC server [Bill_Schiefelbein] [Bill_Schiefelbein] -syslog-conn 601/tcp # Reliable Syslog Service [RFC3195] -syslog-conn 601/udp # Reliable Syslog Service [RFC3195] -xmlrpc-beep 602/tcp # XML-RPC over BEEP [RFC3529] -xmlrpc-beep 602/udp # XML-RPC over BEEP [RFC3529] -idxp 603/tcp # IDXP [RFC4767] -idxp 603/udp # IDXP [RFC4767] -tunnel 604/tcp # TUNNEL [RFC3620] -tunnel 604/udp # TUNNEL [RFC3620] -soap-beep 605/tcp # SOAP over BEEP [RFC4227] -soap-beep 605/udp # SOAP over BEEP [RFC4227] -urm 606/tcp # Cray Unified Resource -# Manager -urm 606/udp # Cray Unified Resource -# Manager -nqs 607/tcp # nqs [Bill_Schiefelbein] [Bill_Schiefelbein] -nqs 607/udp # nqs [Bill_Schiefelbein] [Bill_Schiefelbein] -sift-uft 608/tcp # Sender-Initiated/Unsolicited [Rick_Troth] [Rick_Troth] -# File Transfer -sift-uft 608/udp # Sender-Initiated/Unsolicited [Rick_Troth] [Rick_Troth] -# File Transfer -npmp-trap 609/tcp # npmp-trap -npmp-trap 609/udp # npmp-trap -npmp-local 610/tcp # npmp-local -npmp-local 610/udp # npmp-local -npmp-gui 611/tcp # npmp-gui [John_Barnes] [John_Barnes] -npmp-gui 611/udp # npmp-gui [John_Barnes] [John_Barnes] -hmmp-ind 612/tcp # HMMP Indication -hmmp-ind 612/udp # HMMP Indication -hmmp-op 613/tcp # HMMP Operation [Andrew_Sinclair] [Andrew_Sinclair] -hmmp-op 613/udp # HMMP Operation [Andrew_Sinclair] [Andrew_Sinclair] -sshell 614/tcp # SSLshell [Simon_J_Gerraty] [Simon_J_Gerraty] -sshell 614/udp # SSLshell [Simon_J_Gerraty] [Simon_J_Gerraty] -sco-inetmgr 615/tcp # Internet Configuration -# Manager -sco-inetmgr 615/udp # Internet Configuration -# Manager -sco-sysmgr 616/tcp # SCO System Administration -# Server -sco-sysmgr 616/udp # SCO System Administration -# Server -sco-dtmgr 617/tcp # SCO Desktop Administration [Christopher_Durham] [Christopher_Durham] -# Server -sco-dtmgr 617/udp # SCO Desktop Administration [Christopher_Durham] [Christopher_Durham] -# Server -dei-icda 618/tcp # DEI-ICDA [David_Turner] [David_Turner] -dei-icda 618/udp # DEI-ICDA [David_Turner] [David_Turner] -compaq-evm 619/tcp # Compaq EVM [Jem_Treadwell] [Jem_Treadwell] -compaq-evm 619/udp # Compaq EVM [Jem_Treadwell] [Jem_Treadwell] -sco-websrvrmgr 620/tcp # SCO WebServer Manager [Christopher_Durham] [Christopher_Durham] -sco-websrvrmgr 620/udp # SCO WebServer Manager [Christopher_Durham] [Christopher_Durham] -escp-ip 621/tcp # ESCP [Lai_Zit_Seng] [Lai_Zit_Seng] -escp-ip 621/udp # ESCP [Lai_Zit_Seng] [Lai_Zit_Seng] -collaborator 622/tcp # Collaborator [Johnson_Davis] [Johnson_Davis] -collaborator 622/udp # Collaborator [Johnson_Davis] [Johnson_Davis] -oob-ws-http 623/tcp # DMTF out-of-band web [Jim_Davis] [Jim_Davis] 2007-06 -# services management protocol -asf-rmcp 623/udp # ASF Remote Management and [Carl_First] [Carl_First] -# Control Protocol -cryptoadmin 624/tcp # Crypto Admin [Tony_Walker] [Tony_Walker] -cryptoadmin 624/udp # Crypto Admin [Tony_Walker] [Tony_Walker] -# DEC DLM -# -dec-dlm 625/tcp # IANA assigned this [Rudi_Martin_2] [Rudi_Martin_2] -# well-formed service name as -# a replacement for "dec_dlm". -# This entry is an alias to "dec-dlm". This entry is now -dec_dlm 625/tcp # DEC DLM [Rudi_Martin_2] [Rudi_Martin_2] historic, not usable for use with many common service -# discovery mechanisms. -# DEC DLM -# -dec-dlm 625/udp # IANA assigned this [Rudi_Martin_2] [Rudi_Martin_2] -# well-formed service name as -# a replacement for "dec_dlm". -# This entry is an alias to "dec-dlm". This entry is now -dec_dlm 625/udp # DEC DLM [Rudi_Martin_2] [Rudi_Martin_2] historic, not usable for use with many common service -# discovery mechanisms. -asia 626/tcp # ASIA [Michael_Dasenbrock] [Michael_Dasenbrock] -asia 626/udp # ASIA [Michael_Dasenbrock] [Michael_Dasenbrock] -passgo-tivoli 627/tcp # PassGo Tivoli [John_Rainford_2] [John_Rainford_2] -passgo-tivoli 627/udp # PassGo Tivoli [John_Rainford_2] [John_Rainford_2] -qmqp 628/tcp # QMQP [Dan_Bernstein_2] [Dan_Bernstein_2] -qmqp 628/udp # QMQP [Dan_Bernstein_2] [Dan_Bernstein_2] -3com-amp3 629/tcp # 3Com AMP3 [Prakash_Banthia] [Prakash_Banthia] -3com-amp3 629/udp # 3Com AMP3 [Prakash_Banthia] [Prakash_Banthia] -rda 630/tcp # RDA [John_Hadjioannou] [John_Hadjioannou] -rda 630/udp # RDA [John_Hadjioannou] [John_Hadjioannou] -ipp 631/tcp # IPP (Internet Printing [Carl_Uno_Manros] [Carl_Uno_Manros] Defined TXT keys: See BonjourPrinting.pdf. -# Protocol) -ipp 631/udp # IPP (Internet Printing [Carl_Uno_Manros] [Carl_Uno_Manros] Defined TXT keys: See BonjourPrinting.pdf. -# Protocol) -bmpp 632/tcp # bmpp [Troy_Rollo] [Troy_Rollo] -bmpp 632/udp # bmpp [Troy_Rollo] [Troy_Rollo] -servstat 633/tcp # Service Status update [Greg_Rose] [Greg_Rose] -# (Sterling Software) -servstat 633/udp # Service Status update [Greg_Rose] [Greg_Rose] -# (Sterling Software) -ginad 634/tcp # ginad [Mark_Crother] [Mark_Crother] -ginad 634/udp # ginad [Mark_Crother] [Mark_Crother] -rlzdbase 635/tcp # RLZ DBase [Michael_Ginn] [Michael_Ginn] -rlzdbase 635/udp # RLZ DBase [Michael_Ginn] [Michael_Ginn] -ldaps 636/tcp # ldap protocol over TLS/SSL [Pat_Richard] [Pat_Richard] -# (was sldap) -ldaps 636/udp # ldap protocol over TLS/SSL [Pat_Richard] [Pat_Richard] -# (was sldap) -lanserver 637/tcp # lanserver [Chris_Larsson] [Chris_Larsson] -lanserver 637/udp # lanserver [Chris_Larsson] [Chris_Larsson] -mcns-sec 638/tcp # mcns-sec [Kaz_Ozawa] [Kaz_Ozawa] -mcns-sec 638/udp # mcns-sec [Kaz_Ozawa] [Kaz_Ozawa] -msdp 639/tcp # MSDP [Dino_Farinacci] [Dino_Farinacci] -msdp 639/udp # MSDP [Dino_Farinacci] [Dino_Farinacci] -entrust-sps 640/tcp # entrust-sps [Marek_Buchler] [Marek_Buchler] -entrust-sps 640/udp # entrust-sps [Marek_Buchler] [Marek_Buchler] -repcmd 641/tcp # repcmd [Scott_Dale] [Scott_Dale] -repcmd 641/udp # repcmd [Scott_Dale] [Scott_Dale] -esro-emsdp 642/tcp # ESRO-EMSDP V1.3 [Mohsen_Banan_2] [Mohsen_Banan_2] -esro-emsdp 642/udp # ESRO-EMSDP V1.3 [Mohsen_Banan_2] [Mohsen_Banan_2] -sanity 643/tcp # SANity [Peter_Viscarola] [Peter_Viscarola] -sanity 643/udp # SANity [Peter_Viscarola] [Peter_Viscarola] -dwr 644/tcp # dwr [Bill_Fenner] [Bill_Fenner] -dwr 644/udp # dwr [Bill_Fenner] [Bill_Fenner] -pssc 645/tcp # PSSC [Egon_Meier_Engelen] [Egon_Meier_Engelen] -pssc 645/udp # PSSC [Egon_Meier_Engelen] [Egon_Meier_Engelen] -ldp 646/tcp # LDP [Bob_Thomas] [Bob_Thomas] -ldp 646/udp # LDP [Bob_Thomas] [Bob_Thomas] -dhcp-failover 647/tcp # DHCP Failover [Bernard_Volz] [Bernard_Volz] -dhcp-failover 647/udp # DHCP Failover [Bernard_Volz] [Bernard_Volz] -rrp 648/tcp # Registry Registrar Protocol [Scott_Hollenbeck] [Scott_Hollenbeck] -# (RRP) -rrp 648/udp # Registry Registrar Protocol [Scott_Hollenbeck] [Scott_Hollenbeck] -# (RRP) -cadview-3d 649/tcp # Cadview-3d - streaming 3d [David_Cooper] [David_Cooper] -# models over the internet -cadview-3d 649/udp # Cadview-3d - streaming 3d [David_Cooper] [David_Cooper] -# models over the internet -obex 650/tcp # OBEX [Jeff_Garbers] [Jeff_Garbers] -obex 650/udp # OBEX [Jeff_Garbers] [Jeff_Garbers] -ieee-mms 651/tcp # IEEE MMS [Curtis_Anderson] [Curtis_Anderson] -ieee-mms 651/udp # IEEE MMS [Curtis_Anderson] [Curtis_Anderson] -hello-port 652/tcp # HELLO_PORT [Patrick_Cipiere] [Patrick_Cipiere] -hello-port 652/udp # HELLO_PORT [Patrick_Cipiere] [Patrick_Cipiere] -repscmd 653/tcp # RepCmd [Scott_Dale_2] [Scott_Dale_2] -repscmd 653/udp # RepCmd [Scott_Dale_2] [Scott_Dale_2] -aodv 654/tcp # AODV [Charles_Perkins] [Charles_Perkins] -aodv 654/udp # AODV [Charles_Perkins] [Charles_Perkins] -tinc 655/tcp # TINC [Ivo_Timmermans] [Ivo_Timmermans] -tinc 655/udp # TINC [Ivo_Timmermans] [Ivo_Timmermans] -spmp 656/tcp # SPMP [Jakob_Kaivo] [Jakob_Kaivo] -spmp 656/udp # SPMP [Jakob_Kaivo] [Jakob_Kaivo] -rmc 657/tcp # RMC [Michael_Schmidt] [Michael_Schmidt] -rmc 657/udp # RMC [Michael_Schmidt] [Michael_Schmidt] -tenfold 658/tcp # TenFold [Louis_Olszyk] [Louis_Olszyk] -tenfold 658/udp # TenFold [Louis_Olszyk] [Louis_Olszyk] -# 659 Removed 2001-06-06 -mac-srvr-admin 660/tcp # MacOS Server Admin [Forest_Hill] [Forest_Hill] -mac-srvr-admin 660/udp # MacOS Server Admin [Forest_Hill] [Forest_Hill] -hap 661/tcp # HAP [Igor_Plotnikov] [Igor_Plotnikov] -hap 661/udp # HAP [Igor_Plotnikov] [Igor_Plotnikov] -pftp 662/tcp # PFTP [Ben_Schluricke] [Ben_Schluricke] -pftp 662/udp # PFTP [Ben_Schluricke] [Ben_Schluricke] -purenoise 663/tcp # PureNoise [Sam_Osa] [Sam_Osa] -purenoise 663/udp # PureNoise [Sam_Osa] [Sam_Osa] -oob-ws-https 664/tcp # DMTF out-of-band secure web [Jim_Davis] [Jim_Davis] 2007-06 -# services management protocol -asf-secure-rmcp 664/udp # ASF Secure Remote Management [Carl_First] [Carl_First] -# and Control Protocol -sun-dr 665/tcp # Sun DR [Harinder_Bhasin] [Harinder_Bhasin] -sun-dr 665/udp # Sun DR [Harinder_Bhasin] [Harinder_Bhasin] -mdqs 666/tcp -mdqs 666/udp -doom 666/tcp # doom Id Software [ddt] [ddt] -doom 666/udp # doom Id Software [ddt] [ddt] -# campaign contribution -disclose 667/tcp # disclosures - SDR [Jim_Dixon] [Jim_Dixon] -# Technologies -# campaign contribution -disclose 667/udp # disclosures - SDR [Jim_Dixon] [Jim_Dixon] -# Technologies -mecomm 668/tcp # MeComm -mecomm 668/udp # MeComm -meregister 669/tcp # MeRegister [Armin_Sawusch] [Armin_Sawusch] -meregister 669/udp # MeRegister [Armin_Sawusch] [Armin_Sawusch] -vacdsm-sws 670/tcp # VACDSM-SWS -vacdsm-sws 670/udp # VACDSM-SWS -vacdsm-app 671/tcp # VACDSM-APP -vacdsm-app 671/udp # VACDSM-APP -vpps-qua 672/tcp # VPPS-QUA -vpps-qua 672/udp # VPPS-QUA -cimplex 673/tcp # CIMPLEX [Ulysses_G_Smith_Jr] [Ulysses_G_Smith_Jr] -cimplex 673/udp # CIMPLEX [Ulysses_G_Smith_Jr] [Ulysses_G_Smith_Jr] -acap 674/tcp # ACAP [Chris_Newman] [Chris_Newman] 2010-10-15 -acap 674/udp # ACAP [Chris_Newman] [Chris_Newman] 2010-10-15 -dctp 675/tcp # DCTP [Andre_Kramer] [Andre_Kramer] -dctp 675/udp # DCTP [Andre_Kramer] [Andre_Kramer] -vpps-via 676/tcp # VPPS Via [Ulysses_G_Smith_Jr] [Ulysses_G_Smith_Jr] -vpps-via 676/udp # VPPS Via [Ulysses_G_Smith_Jr] [Ulysses_G_Smith_Jr] -vpp 677/tcp # Virtual Presence Protocol [Klaus_Wolf] [Klaus_Wolf] -vpp 677/udp # Virtual Presence Protocol [Klaus_Wolf] [Klaus_Wolf] -ggf-ncp 678/tcp # GNU Generation Foundation [Noah_Paul] [Noah_Paul] -# NCP -ggf-ncp 678/udp # GNU Generation Foundation [Noah_Paul] [Noah_Paul] -# NCP -mrm 679/tcp # MRM [Liming_Wei] [Liming_Wei] -mrm 679/udp # MRM [Liming_Wei] [Liming_Wei] -entrust-aaas 680/tcp # entrust-aaas -entrust-aaas 680/udp # entrust-aaas -entrust-aams 681/tcp # entrust-aams [Adrian_Mancini] [Adrian_Mancini] -entrust-aams 681/udp # entrust-aams [Adrian_Mancini] [Adrian_Mancini] -xfr 682/tcp # XFR [Noah_Paul_2] [Noah_Paul_2] -xfr 682/udp # XFR [Noah_Paul_2] [Noah_Paul_2] -corba-iiop 683/tcp # CORBA IIOP -corba-iiop 683/udp # CORBA IIOP -corba-iiop-ssl 684/tcp # CORBA IIOP SSL [Andrew_Watson] [Andrew_Watson] -corba-iiop-ssl 684/udp # CORBA IIOP SSL [Andrew_Watson] [Andrew_Watson] -mdc-portmapper 685/tcp # MDC Port Mapper [Noah_Paul] [Noah_Paul] -mdc-portmapper 685/udp # MDC Port Mapper [Noah_Paul] [Noah_Paul] -hcp-wismar 686/tcp # Hardware Control Protocol [David_Merchant] [David_Merchant] -# Wismar -hcp-wismar 686/udp # Hardware Control Protocol [David_Merchant] [David_Merchant] -# Wismar -asipregistry 687/tcp # asipregistry [Erik_Sea] [Erik_Sea] -asipregistry 687/udp # asipregistry [Erik_Sea] [Erik_Sea] -realm-rusd 688/tcp # ApplianceWare managment [Stacy_Kenworthy] [Stacy_Kenworthy] -# protocol -realm-rusd 688/udp # ApplianceWare managment [Stacy_Kenworthy] [Stacy_Kenworthy] -# protocol -nmap 689/tcp # NMAP [Peter_Dennis_Bartok] [Peter_Dennis_Bartok] -nmap 689/udp # NMAP [Peter_Dennis_Bartok] [Peter_Dennis_Bartok] -vatp 690/tcp # Velneo Application Transfer [Velneo] [David_Gutierrez] 2015-02-03 -# Protocol -vatp 690/udp # Velneo Application Transfer [Velneo] [David_Gutierrez] 2015-02-03 -# Protocol -msexch-routing 691/tcp # MS Exchange Routing [David_Lemson] [David_Lemson] -msexch-routing 691/udp # MS Exchange Routing [David_Lemson] [David_Lemson] -hyperwave-isp 692/tcp # Hyperwave-ISP [Gerald_Mesaric] [Gerald_Mesaric] -hyperwave-isp 692/udp # Hyperwave-ISP [Gerald_Mesaric] [Gerald_Mesaric] -connendp 693/tcp # almanid Connection Endpoint [Ronny_Bremer] [Ronny_Bremer] -connendp 693/udp # almanid Connection Endpoint [Ronny_Bremer] [Ronny_Bremer] -ha-cluster 694/tcp # ha-cluster [Alan_Robertson] [Alan_Robertson] -ha-cluster 694/udp # ha-cluster [Alan_Robertson] [Alan_Robertson] -ieee-mms-ssl 695/tcp # IEEE-MMS-SSL [Curtis_Anderson_2] [Curtis_Anderson_2] -ieee-mms-ssl 695/udp # IEEE-MMS-SSL [Curtis_Anderson_2] [Curtis_Anderson_2] -rushd 696/tcp # RUSHD [Greg_Ercolano] [Greg_Ercolano] -rushd 696/udp # RUSHD [Greg_Ercolano] [Greg_Ercolano] -uuidgen 697/tcp # UUIDGEN [James_Falkner] [James_Falkner] -uuidgen 697/udp # UUIDGEN [James_Falkner] [James_Falkner] -olsr 698/tcp # OLSR [Thomas_Clausen] [Thomas_Clausen] -olsr 698/udp # OLSR [Thomas_Clausen] [Thomas_Clausen] -accessnetwork 699/tcp # Access Network [Yingchun_Xu] [Yingchun_Xu] -accessnetwork 699/udp # Access Network [Yingchun_Xu] [Yingchun_Xu] -epp 700/tcp # Extensible Provisioning [RFC5734] -# Protocol -epp 700/udp # Extensible Provisioning [RFC5734] -# Protocol -lmp 701/tcp # Link Management Protocol [RFC4204] -# (LMP) -lmp 701/udp # Link Management Protocol [RFC4204] -# (LMP) -iris-beep 702/tcp # IRIS over BEEP [RFC3983] -iris-beep 702/udp # IRIS over BEEP [RFC3983] -# 703 Unassigned -elcsd 704/tcp # errlog copy/server daemon -elcsd 704/udp # errlog copy/server daemon -agentx 705/tcp # AgentX [Bob_Natale] [Bob_Natale] -agentx 705/udp # AgentX [Bob_Natale] [Bob_Natale] -silc 706/tcp # SILC [Pekka_Riikonen] [Pekka_Riikonen] -silc 706/udp # SILC [Pekka_Riikonen] [Pekka_Riikonen] -borland-dsj 707/tcp # Borland DSJ [Gerg_Cole] [Gerg_Cole] -borland-dsj 707/udp # Borland DSJ [Gerg_Cole] [Gerg_Cole] -# 708 Unassigned -entrust-kmsh 709/tcp # Entrust Key Management -# Service Handler -entrust-kmsh 709/udp # Entrust Key Management -# Service Handler -entrust-ash 710/tcp # Entrust Administration [Peter_Whittaker] [Peter_Whittaker] -# Service Handler -entrust-ash 710/udp # Entrust Administration [Peter_Whittaker] [Peter_Whittaker] -# Service Handler -cisco-tdp 711/tcp # Cisco TDP [Bruce_Davie] [Bruce_Davie] -cisco-tdp 711/udp # Cisco TDP [Bruce_Davie] [Bruce_Davie] -tbrpf 712/tcp # TBRPF [RFC3684] -tbrpf 712/udp # TBRPF [RFC3684] -iris-xpc 713/tcp # IRIS over XPC -iris-xpc 713/udp # IRIS over XPC -iris-xpcs 714/tcp # IRIS over XPCS [RFC4992] -iris-xpcs 714/udp # IRIS over XPCS [RFC4992] -iris-lwz 715/tcp # IRIS-LWZ [RFC4993] -iris-lwz 715/udp # IRIS-LWZ [RFC4993] -pana 716/udp # PANA Messages [RFC5191] -# 717-728 Unassigned -netviewdm1 729/tcp # IBM NetView DM/6000 -# Server/Client -netviewdm1 729/udp # IBM NetView DM/6000 -# Server/Client -netviewdm2 730/tcp # IBM NetView DM/6000 send/tcp -netviewdm2 730/udp # IBM NetView DM/6000 send/tcp -netviewdm3 731/tcp # IBM NetView DM/6000 [Philippe_Binet] [Philippe_Binet] -# receive/tcp -netviewdm3 731/udp # IBM NetView DM/6000 [Philippe_Binet] [Philippe_Binet] -# receive/tcp -# 732-740 Unassigned -netgw 741/tcp # netGW [Oliver_Korfmacher] [Oliver_Korfmacher] -netgw 741/udp # netGW [Oliver_Korfmacher] [Oliver_Korfmacher] -netrcs 742/tcp # Network based Rev. Cont. [Gordon_C_Galligher] [Gordon_C_Galligher] -# Sys. -netrcs 742/udp # Network based Rev. Cont. [Gordon_C_Galligher] [Gordon_C_Galligher] -# Sys. -# 743 Unassigned -flexlm 744/tcp # Flexible License Manager [Matt_Christiano] [Matt_Christiano] -flexlm 744/udp # Flexible License Manager [Matt_Christiano] [Matt_Christiano] -# 745-746 Unassigned -fujitsu-dev 747/tcp # Fujitsu Device Control -fujitsu-dev 747/udp # Fujitsu Device Control -ris-cm 748/tcp # Russell Info Sci Calendar -# Manager -ris-cm 748/udp # Russell Info Sci Calendar -# Manager -kerberos-adm 749/tcp # kerberos administration -kerberos-adm 749/udp # kerberos administration -rfile 750/tcp -loadav 750/udp -kerberos-iv 750/udp # kerberos version iv [Martin_Hamilton] [Martin_Hamilton] -pump 751/tcp -pump 751/udp -qrh 752/tcp -qrh 752/udp -rrh 753/tcp -rrh 753/udp -tell 754/tcp # send [Josyula_R_Rao] [Josyula_R_Rao] -tell 754/udp # send [Josyula_R_Rao] [Josyula_R_Rao] -# 755-756 Unassigned -nlogin 758/tcp -nlogin 758/udp -con 759/tcp -con 759/udp -ns 760/tcp -ns 760/udp -rxe 761/tcp -rxe 761/udp -quotad 762/tcp -quotad 762/udp -cycleserv 763/tcp -cycleserv 763/udp -omserv 764/tcp -omserv 764/udp -webster 765/tcp # [Josyula_R_Rao] [Josyula_R_Rao] -webster 765/udp # [Josyula_R_Rao] [Josyula_R_Rao] -# 766 Unassigned -phonebook 767/tcp # phone [Josyula_R_Rao] [Josyula_R_Rao] -phonebook 767/udp # phone [Josyula_R_Rao] [Josyula_R_Rao] -# 768 Unassigned -vid 769/tcp -vid 769/udp -cadlock 770/tcp -cadlock 770/udp -rtip 771/tcp -rtip 771/udp -cycleserv2 772/tcp -cycleserv2 772/udp -submit 773/tcp -notify 773/udp -rpasswd 774/tcp -# IANA assigned this -acmaint-dbd 774/udp # well-formed service name as -# a replacement for -# "acmaint_dbd". -# This entry is an alias to "acmaint-dbd". This entry is now -acmaint_dbd 774/udp # historic, not usable for use with many common service -# discovery mechanisms. -entomb 775/tcp -# IANA assigned this -acmaint-transd 775/udp # well-formed service name as -# a replacement for -# "acmaint_transd". -# This entry is an alias to "acmaint-transd". This entry is now -acmaint_transd 775/udp # historic, not usable for use with many common service -# discovery mechanisms. -wpages 776/tcp # [Josyula_R_Rao] [Josyula_R_Rao] -wpages 776/udp # [Josyula_R_Rao] [Josyula_R_Rao] -multiling-http 777/tcp # Multiling HTTP [Alejandro_Bonet] [Alejandro_Bonet] -multiling-http 777/udp # Multiling HTTP [Alejandro_Bonet] [Alejandro_Bonet] -# 778-779 Unassigned -wpgs 780/tcp # [Josyula_R_Rao] [Josyula_R_Rao] -wpgs 780/udp # [Josyula_R_Rao] [Josyula_R_Rao] -# 781-785 Unassigned -# 786 Unassigned 2002-05-08 -# 787 Unassigned 2002-10-08 -# Unauthorized -# 788-799 Unassigned Use Known on -# port 796 -# IANA assigned this -mdbs-daemon 800/tcp # well-formed service name as -# a replacement for -# "mdbs_daemon". -# This entry is an alias to "mdbs-daemon". This entry is now -mdbs_daemon 800/tcp # historic, not usable for use with many common service -# discovery mechanisms. -# IANA assigned this -mdbs-daemon 800/udp # well-formed service name as -# a replacement for -# "mdbs_daemon". -# This entry is an alias to "mdbs-daemon". This entry is now -mdbs_daemon 800/udp # historic, not usable for use with many common service -# discovery mechanisms. -device 801/tcp -device 801/udp -mbap-s 802/tcp # Modbus Application Protocol [modbus.org] [Dennis_Dube] 2014-06-10 -# Secure -mbap-s 802/udp # Modbus Application Protocol [modbus.org] [Dennis_Dube] 2014-06-10 -# Secure -# 803-809 Unassigned -fcp-udp 810/tcp # FCP [Paul_Whittemore] [Paul_Whittemore] -fcp-udp 810/udp # FCP Datagram [Paul_Whittemore] [Paul_Whittemore] -# 811-827 Unassigned -itm-mcell-s 828/tcp # itm-mcell-s [Portnoy_Boxman] [Portnoy_Boxman] -itm-mcell-s 828/udp # itm-mcell-s [Portnoy_Boxman] [Portnoy_Boxman] -pkix-3-ca-ra 829/tcp # PKIX-3 CA/RA [Carlisle_Adams] [Carlisle_Adams] -pkix-3-ca-ra 829/udp # PKIX-3 CA/RA [Carlisle_Adams] [Carlisle_Adams] -netconf-ssh 830/tcp # NETCONF over SSH [RFC6242] -netconf-ssh 830/udp # NETCONF over SSH [RFC6242] -netconf-beep 831/tcp # NETCONF over BEEP [RFC4744] -netconf-beep 831/udp # NETCONF over BEEP [RFC4744] -netconfsoaphttp 832/tcp # NETCONF for SOAP over HTTPS [RFC4743] -netconfsoaphttp 832/udp # NETCONF for SOAP over HTTPS [RFC4743] -netconfsoapbeep 833/tcp # NETCONF for SOAP over BEEP [RFC4743] -netconfsoapbeep 833/udp # NETCONF for SOAP over BEEP [RFC4743] -# 834-846 Unassigned -dhcp-failover2 847/tcp # dhcp-failover 2 [Bernard_Volz] [Bernard_Volz] -dhcp-failover2 847/udp # dhcp-failover 2 [Bernard_Volz] [Bernard_Volz] -gdoi 848/tcp # GDOI [RFC3547] -gdoi 848/udp # GDOI [RFC3547] -# 849-852 Unassigned -domain-s 853/tcp # DNS query-response protocol [IETF_DPRIVE_Working_Group_Chairs] [Paul_Hoffman_1] 2015-10-08 [draft-ietf-dprive-dns-over-tls] TEMPORARY - registered 2015-10-08, expires 2016-10-08 -# run over TLS/DTLS -domain-s 853/udp # DNS query-response protocol [IETF_DPRIVE_Working_Group_Chairs] [Dan_Wing] 2015-10-08 [draft-ietf-dprive-dnsodtls] TEMPORARY - registered 2015-10-08, expires 2016-10-08 -# run over TLS/DTLS -# 854-859 Unassigned -iscsi 860/tcp # iSCSI [IESG] [IETF_Chair] 2013-08-27 [RFC7143] -iscsi 860/udp # iSCSI [IESG] [IETF_Chair] 2013-08-27 [RFC7143] -owamp-control 861/tcp # OWAMP-Control [RFC4656] -owamp-control 861/udp # OWAMP-Control [RFC4656] -twamp-control 862/tcp # Two-way Active Measurement [RFC5357] -# Protocol (TWAMP) Control -twamp-control 862/udp # Two-way Active Measurement [RFC5357] -# Protocol (TWAMP) Control -# 863-872 Unassigned -rsync 873/tcp # rsync [Andrew_Tridgell] [Andrew_Tridgell] -rsync 873/udp # rsync [Andrew_Tridgell] [Andrew_Tridgell] -# 874-885 Unassigned -iclcnet-locate 886/tcp # ICL coNETion locate server [Bob_Lyon] [Bob_Lyon] -iclcnet-locate 886/udp # ICL coNETion locate server [Bob_Lyon] [Bob_Lyon] -# ICL coNETion server info -# -iclcnet-svinfo 887/tcp # IANA assigned this [Bob_Lyon] [Bob_Lyon] -# well-formed service name as -# a replacement for -# "iclcnet_svinfo". -# This entry is an alias to "iclcnet-svinfo". This entry is now -iclcnet_svinfo 887/tcp # ICL coNETion server info [Bob_Lyon] [Bob_Lyon] historic, not usable for use with many common service -# discovery mechanisms. -# ICL coNETion server info -# -iclcnet-svinfo 887/udp # IANA assigned this [Bob_Lyon] [Bob_Lyon] -# well-formed service name as -# a replacement for -# "iclcnet_svinfo". -# This entry is an alias to "iclcnet-svinfo". This entry is now -iclcnet_svinfo 887/udp # ICL coNETion server info [Bob_Lyon] [Bob_Lyon] historic, not usable for use with many common service -# discovery mechanisms. -accessbuilder 888/tcp # AccessBuilder [Steve_Sweeney] [Steve_Sweeney] -accessbuilder 888/udp # AccessBuilder [Steve_Sweeney] [Steve_Sweeney] -cddbp 888/tcp # CD Database Protocol [Steve_Scherf] [Steve_Scherf] This entry records an unassigned but widespread use -# 889-899 Unassigned -omginitialrefs 900/tcp # OMG Initial Refs [Christian_Callsen] [Christian_Callsen] -omginitialrefs 900/udp # OMG Initial Refs [Christian_Callsen] [Christian_Callsen] -smpnameres 901/tcp # SMPNAMERES [Leif_Ekblad] [Leif_Ekblad] -smpnameres 901/udp # SMPNAMERES [Leif_Ekblad] [Leif_Ekblad] -ideafarm-door 902/tcp # self documenting Telnet Door -ideafarm-door 902/udp # self documenting Door: send -# 0x00 for info -ideafarm-panic 903/tcp # self documenting Telnet [Wo_o_Ideafarm] [Wo_o_Ideafarm] -# Panic Door -ideafarm-panic 903/udp # self documenting Panic Door: [Wo_o_Ideafarm] [Wo_o_Ideafarm] -# send 0x00 for info -# 904-909 Unassigned -kink 910/tcp # Kerberized Internet [RFC4430] -# Negotiation of Keys (KINK) -kink 910/udp # Kerberized Internet [RFC4430] -# Negotiation of Keys (KINK) -xact-backup 911/tcp # xact-backup [Bill_Carroll] [Bill_Carroll] -xact-backup 911/udp # xact-backup [Bill_Carroll] [Bill_Carroll] -apex-mesh 912/tcp # APEX relay-relay service -apex-mesh 912/udp # APEX relay-relay service -apex-edge 913/tcp # APEX endpoint-relay service [RFC3340] -apex-edge 913/udp # APEX endpoint-relay service [RFC3340] -# 914-988 Unassigned -ftps-data 989/tcp # ftp protocol, data, over -# TLS/SSL -ftps-data 989/udp # ftp protocol, data, over -# TLS/SSL -ftps 990/tcp # ftp protocol, control, over [Christopher_Allen] [Christopher_Allen] -# TLS/SSL -ftps 990/udp # ftp protocol, control, over [Christopher_Allen] [Christopher_Allen] -# TLS/SSL -nas 991/tcp # Netnews Administration [Vera_Heinau][Heiko_Schlichting] [Vera_Heinau][Heiko_Schlichting] -# System -nas 991/udp # Netnews Administration [Vera_Heinau][Heiko_Schlichting] [Vera_Heinau][Heiko_Schlichting] -# System -telnets 992/tcp # telnet protocol over TLS/SSL -telnets 992/udp # telnet protocol over TLS/SSL -imaps 993/tcp # imap4 protocol over TLS/SSL -imaps 993/udp # imap4 protocol over TLS/SSL -# 994 tcp Reserved 2011-08-31 (previous contact was[Christopher_Allen]) -# 994 udp Reserved -pop3s 995/tcp # pop3 protocol over TLS/SSL [Gordon_Mangione] [Gordon_Mangione] -# (was spop3) -pop3s 995/udp # pop3 protocol over TLS/SSL [Gordon_Mangione] [Gordon_Mangione] -# (was spop3) -vsinet 996/tcp # vsinet [Rob_Juergens] [Rob_Juergens] -vsinet 996/udp # vsinet [Rob_Juergens] [Rob_Juergens] -maitrd 997/tcp -maitrd 997/udp -busboy 998/tcp -puparp 998/udp -garcon 999/tcp -applix 999/udp # Applix ac -puprouter 999/tcp -puprouter 999/udp -cadlock2 1000/tcp -cadlock2 1000/udp -# 1001-1009 Unassigned -# 1008 udp Possibly used by Sun -# Solaris???? -surf 1010/tcp # surf [Joseph_Geer] [Joseph_Geer] -surf 1010/udp # surf [Joseph_Geer] [Joseph_Geer] -# 1011-1020 Reserved -exp1 1021/tcp # RFC3692-style Experiment 1 [IESG] [IETF_Chair] [1][RFC4727][RFC6335] -exp1 1021/udp # RFC3692-style Experiment 1 [IESG] [IETF_Chair] [1][RFC4727][RFC6335] -exp1 1021/sctp # RFC3692-style Experiment 1 [IESG] [IETF_Chair] [1][RFC4727][RFC6335] -exp1 1021/dccp # RFC3692-style Experiment 1 [IESG] [IETF_Chair] [1][RFC4727][RFC6335] -exp2 1022/tcp # RFC3692-style Experiment 2 [IESG] [IETF_Chair] [1][RFC4727][RFC6335] -exp2 1022/udp # RFC3692-style Experiment 2 [IESG] [IETF_Chair] [1][RFC4727][RFC6335] -exp2 1022/sctp # RFC3692-style Experiment 2 [IESG] [IETF_Chair] [1][RFC4727][RFC6335] -exp2 1022/dccp # RFC3692-style Experiment 2 [IESG] [IETF_Chair] [1][RFC4727][RFC6335] -# 1023 tcp Reserved [IANA] [IANA] -# 1023 udp Reserved [IANA] [IANA] -# 1024 tcp Reserved [IANA] [IANA] -# 1024 udp Reserved [IANA] [IANA] -blackjack 1025/tcp # network blackjack -blackjack 1025/udp # network blackjack -cap 1026/tcp # Calendar Access Protocol [Doug_Royer] [Doug_Royer] 2010-12-09 -cap 1026/udp # Calendar Access Protocol [Doug_Royer] [Doug_Royer] 2010-12-09 -6a44 1027/udp # IPv6 Behind NAT44 CPEs [IESG] [IETF_Chair] 2012-08-02 [RFC6751] -# 1027 tcp Reserved -# 1028 Deprecated 2004-02 -solid-mux 1029/tcp # Solid Mux Server [Anders_Borg] [Anders_Borg] 2004-11 -solid-mux 1029/udp # Solid Mux Server [Anders_Borg] [Anders_Borg] 2004-11 -# 1030 Reserved 2013-05-24 This entry is being removed on 2013-05-24. -# 1031 Reserved 2013-05-24 This entry is being removed on 2013-05-24. -# 1032 Reserved 2013-05-24 This entry is being removed on 2013-05-24. -netinfo-local 1033/tcp # local netinfo port [Marc_Majka] [Marc_Majka] 2002-08 -netinfo-local 1033/udp # local netinfo port [Marc_Majka] [Marc_Majka] 2002-08 -activesync 1034/tcp # ActiveSync Notifications [Sandra_Vargas] [Sandra_Vargas] 2003-03 -activesync 1034/udp # ActiveSync Notifications [Sandra_Vargas] [Sandra_Vargas] 2003-03 -mxxrlogin 1035/tcp # MX-XR RPC [Valassis] [John_Eckert] 2003-04 2015-05-05 -mxxrlogin 1035/udp # MX-XR RPC [Valassis] [John_Eckert] 2003-04 2015-05-05 -nsstp 1036/tcp # Nebula Secure Segment [Steve_Ravida] [Steve_Ravida] -# Transfer Protocol -nsstp 1036/udp # Nebula Secure Segment [Steve_Ravida] [Steve_Ravida] -# Transfer Protocol -ams 1037/tcp # AMS [Ronald_R_Ohmer] [Ronald_R_Ohmer] 2004-02 -ams 1037/udp # AMS [Ronald_R_Ohmer] [Ronald_R_Ohmer] 2004-02 -mtqp 1038/tcp # Message Tracking Query [RFC3887] -# Protocol -mtqp 1038/udp # Message Tracking Query [RFC3887] -# Protocol -sbl 1039/tcp # Streamlined Blackhole [Jonathan_A_Zdziaras] [Jonathan_A_Zdziaras] 2004-11 -sbl 1039/udp # Streamlined Blackhole [Jonathan_A_Zdziaras] [Jonathan_A_Zdziaras] 2004-11 -netarx 1040/tcp # Netarx Netcare [Sandy_Kronenberg] [Sandy_Kronenberg] 2008-04-03 -netarx 1040/udp # Netarx Netcare [Sandy_Kronenberg] [Sandy_Kronenberg] 2008-04-03 -danf-ak2 1041/tcp # AK2 Product [Karl_Palsson] [Karl_Palsson] 2004-11 -danf-ak2 1041/udp # AK2 Product [Karl_Palsson] [Karl_Palsson] 2004-11 -afrog 1042/tcp # Subnet Roaming [Michael_Chapman] [Michael_Chapman] 2004-11 -afrog 1042/udp # Subnet Roaming [Michael_Chapman] [Michael_Chapman] 2004-11 -boinc-client 1043/tcp # BOINC Client Control [David_Anderson] [David_Anderson] 2004-11 -boinc-client 1043/udp # BOINC Client Control [David_Anderson] [David_Anderson] 2004-11 -dcutility 1044/tcp # Dev Consortium Utility [Chris_Ryland] [Chris_Ryland] 2004-11 -dcutility 1044/udp # Dev Consortium Utility [Chris_Ryland] [Chris_Ryland] 2004-11 -fpitp 1045/tcp # Fingerprint Image Transfer [Steven_Fields] [Steven_Fields] 2002-02 -# Protocol -fpitp 1045/udp # Fingerprint Image Transfer [Steven_Fields] [Steven_Fields] 2002-02 -# Protocol -wfremotertm 1046/tcp # WebFilter Remote Monitor [Tim_Morgan] [Tim_Morgan] 2004-11 -wfremotertm 1046/udp # WebFilter Remote Monitor [Tim_Morgan] [Tim_Morgan] 2004-11 -neod1 1047/tcp # Sun's NEO Object Request -# Broker -neod1 1047/udp # Sun's NEO Object Request -# Broker -neod2 1048/tcp # Sun's NEO Object Request [Rohit_Garg] [Rohit_Garg] -# Broker -neod2 1048/udp # Sun's NEO Object Request [Rohit_Garg] [Rohit_Garg] -# Broker -td-postman 1049/tcp # Tobit David Postman VPMN [Franz_Josef_Leuders] [Franz_Josef_Leuders] -td-postman 1049/udp # Tobit David Postman VPMN [Franz_Josef_Leuders] [Franz_Josef_Leuders] -cma 1050/tcp # CORBA Management Agent [Ramy_Zaarour] [Ramy_Zaarour] -cma 1050/udp # CORBA Management Agent [Ramy_Zaarour] [Ramy_Zaarour] -optima-vnet 1051/tcp # Optima VNET [Ralf_Doewich] [Ralf_Doewich] -optima-vnet 1051/udp # Optima VNET [Ralf_Doewich] [Ralf_Doewich] -ddt 1052/tcp # Dynamic DNS Tools [Remi_Lefebvre] [Remi_Lefebvre] -ddt 1052/udp # Dynamic DNS Tools [Remi_Lefebvre] [Remi_Lefebvre] -# Unauthorized -remote-as 1053/tcp # Remote Assistant (RA) [Roman_Kriis] [Roman_Kriis] Use Known on -# port 1053 -remote-as 1053/udp # Remote Assistant (RA) [Roman_Kriis] [Roman_Kriis] -brvread 1054/tcp # BRVREAD [A_Boninn] [A_Boninn] -brvread 1054/udp # BRVREAD [A_Boninn] [A_Boninn] -ansyslmd 1055/tcp # ANSYS - License Manager [Suzanne_Lorrin] [Suzanne_Lorrin] -ansyslmd 1055/udp # ANSYS - License Manager [Suzanne_Lorrin] [Suzanne_Lorrin] -vfo 1056/tcp # VFO [Anthony_Gonzalez] [Anthony_Gonzalez] -vfo 1056/udp # VFO [Anthony_Gonzalez] [Anthony_Gonzalez] -startron 1057/tcp # STARTRON [Markus_Sabadello] [Markus_Sabadello] -startron 1057/udp # STARTRON [Markus_Sabadello] [Markus_Sabadello] -nim 1058/tcp # nim -nim 1058/udp # nim -nimreg 1059/tcp # nimreg [Robert_Gordon] [Robert_Gordon] -nimreg 1059/udp # nimreg [Robert_Gordon] [Robert_Gordon] -polestar 1060/tcp # POLESTAR [Masakuni_Okada] [Masakuni_Okada] -polestar 1060/udp # POLESTAR [Masakuni_Okada] [Masakuni_Okada] -kiosk 1061/tcp # KIOSK [Ken_Ksiazek] [Ken_Ksiazek] -kiosk 1061/udp # KIOSK [Ken_Ksiazek] [Ken_Ksiazek] -veracity 1062/tcp # Veracity [Ross_Williams] [Ross_Williams] -veracity 1062/udp # Veracity [Ross_Williams] [Ross_Williams] -kyoceranetdev 1063/tcp # KyoceraNetDev [Shigenaka_Kanemitsu] [Shigenaka_Kanemitsu] -kyoceranetdev 1063/udp # KyoceraNetDev [Shigenaka_Kanemitsu] [Shigenaka_Kanemitsu] -jstel 1064/tcp # JSTEL [Duane_Kiser] [Duane_Kiser] -jstel 1064/udp # JSTEL [Duane_Kiser] [Duane_Kiser] -syscomlan 1065/tcp # SYSCOMLAN [Alexandre_Lechenne] [Alexandre_Lechenne] 2008-12-10 -syscomlan 1065/udp # SYSCOMLAN [Alexandre_Lechenne] [Alexandre_Lechenne] 2008-12-10 -fpo-fns 1066/tcp # FPO-FNS [Jens_Klose] [Jens_Klose] -fpo-fns 1066/udp # FPO-FNS [Jens_Klose] [Jens_Klose] -# Installation Bootstrap -# Proto. Serv. -# -instl-boots 1067/tcp # IANA assigned this -# well-formed service name as -# a replacement for -# "instl_boots". -# Installation Bootstrap This entry is an alias to "instl-boots". This entry is now -instl_boots 1067/tcp # Proto. Serv. historic, not usable for use with many common service -# discovery mechanisms. -# Installation Bootstrap -# Proto. Serv. -# -instl-boots 1067/udp # IANA assigned this -# well-formed service name as -# a replacement for -# "instl_boots". -# Installation Bootstrap This entry is an alias to "instl-boots". This entry is now -instl_boots 1067/udp # Proto. Serv. historic, not usable for use with many common service -# discovery mechanisms. -# Installation Bootstrap -# Proto. Cli. -# -instl-bootc 1068/tcp # IANA assigned this [David_Arko] [David_Arko] -# well-formed service name as -# a replacement for -# "instl_bootc". -# Installation Bootstrap This entry is an alias to "instl-bootc". This entry is now -instl_bootc 1068/tcp # Proto. Cli. [David_Arko] [David_Arko] historic, not usable for use with many common service -# discovery mechanisms. -# Installation Bootstrap -# Proto. Cli. -# -instl-bootc 1068/udp # IANA assigned this [David_Arko] [David_Arko] -# well-formed service name as -# a replacement for -# "instl_bootc". -# Installation Bootstrap This entry is an alias to "instl-bootc". This entry is now -instl_bootc 1068/udp # Proto. Cli. [David_Arko] [David_Arko] historic, not usable for use with many common service -# discovery mechanisms. -cognex-insight 1069/tcp # COGNEX-INSIGHT [Steve_Olson] [Steve_Olson] -cognex-insight 1069/udp # COGNEX-INSIGHT [Steve_Olson] [Steve_Olson] -gmrupdateserv 1070/tcp # GMRUpdateSERV [Steve_Kellogg] [Steve_Kellogg] -gmrupdateserv 1070/udp # GMRUpdateSERV [Steve_Kellogg] [Steve_Kellogg] -bsquare-voip 1071/tcp # BSQUARE-VOIP [Yen_Lee] [Yen_Lee] -bsquare-voip 1071/udp # BSQUARE-VOIP [Yen_Lee] [Yen_Lee] -cardax 1072/tcp # CARDAX [Charles_Oram] [Charles_Oram] -cardax 1072/udp # CARDAX [Charles_Oram] [Charles_Oram] -bridgecontrol 1073/tcp # Bridge Control [Andy_Heron] [Andy_Heron] -bridgecontrol 1073/udp # Bridge Control [Andy_Heron] [Andy_Heron] -warmspotMgmt 1074/tcp # Warmspot Management Protocol [Robert_C_Henningsga] [Robert_C_Henningsga] -warmspotMgmt 1074/udp # Warmspot Management Protocol [Robert_C_Henningsga] [Robert_C_Henningsga] -rdrmshc 1075/tcp # RDRMSHC [Ericko_Shimada] [Ericko_Shimada] -rdrmshc 1075/udp # RDRMSHC [Ericko_Shimada] [Ericko_Shimada] -dab-sti-c 1076/tcp # DAB STI-C [World_DAB] [World_DAB] -dab-sti-c 1076/udp # DAB STI-C [World_DAB] [World_DAB] -imgames 1077/tcp # IMGames [Jean_A_Ames] [Jean_A_Ames] -imgames 1077/udp # IMGames [Jean_A_Ames] [Jean_A_Ames] -avocent-proxy 1078/tcp # Avocent Proxy Protocol [Steven_W_Clark] [Steven_W_Clark] -avocent-proxy 1078/udp # Avocent Proxy Protocol [Steven_W_Clark] [Steven_W_Clark] -asprovatalk 1079/tcp # ASPROVATalk [Chiew_Farn_Chung] [Chiew_Farn_Chung] -asprovatalk 1079/udp # ASPROVATalk [Chiew_Farn_Chung] [Chiew_Farn_Chung] -socks 1080/tcp # Socks [Ying_Da_Lee] [Ying_Da_Lee] -socks 1080/udp # Socks [Ying_Da_Lee] [Ying_Da_Lee] -pvuniwien 1081/tcp # PVUNIWIEN [Peter_Lipp] [Peter_Lipp] -pvuniwien 1081/udp # PVUNIWIEN [Peter_Lipp] [Peter_Lipp] -amt-esd-prot 1082/tcp # AMT-ESD-PROT [AMTEC_S_p_A] [AMTEC_S_p_A] -amt-esd-prot 1082/udp # AMT-ESD-PROT [AMTEC_S_p_A] [AMTEC_S_p_A] -ansoft-lm-1 1083/tcp # Anasoft License Manager -ansoft-lm-1 1083/udp # Anasoft License Manager -ansoft-lm-2 1084/tcp # Anasoft License Manager -ansoft-lm-2 1084/udp # Anasoft License Manager -webobjects 1085/tcp # Web Objects [Andy_Belk] [Andy_Belk] -webobjects 1085/udp # Web Objects [Andy_Belk] [Andy_Belk] -cplscrambler-lg 1086/tcp # CPL Scrambler Logging -cplscrambler-lg 1086/udp # CPL Scrambler Logging -cplscrambler-in 1087/tcp # CPL Scrambler Internal -cplscrambler-in 1087/udp # CPL Scrambler Internal -cplscrambler-al 1088/tcp # CPL Scrambler Alarm Log [Richard_Corn] [Richard_Corn] -cplscrambler-al 1088/udp # CPL Scrambler Alarm Log [Richard_Corn] [Richard_Corn] -ff-annunc 1089/tcp # FF Annunciation -ff-annunc 1089/udp # FF Annunciation -ff-fms 1090/tcp # FF Fieldbus Message -# Specification -ff-fms 1090/udp # FF Fieldbus Message -# Specification -ff-sm 1091/tcp # FF System Management [Fieldbus_Foundation] [Fieldbus_Foundation] -ff-sm 1091/udp # FF System Management [Fieldbus_Foundation] [Fieldbus_Foundation] -obrpd 1092/tcp # Open Business Reporting [William_Randolph_Roy] [William_Randolph_Roy] -# Protocol -obrpd 1092/udp # Open Business Reporting [William_Randolph_Roy] [William_Randolph_Roy] -# Protocol -proofd 1093/tcp # PROOFD -proofd 1093/udp # PROOFD -rootd 1094/tcp # ROOTD [Fons_Rademakers] [Fons_Rademakers] -rootd 1094/udp # ROOTD [Fons_Rademakers] [Fons_Rademakers] -nicelink 1095/tcp # NICELink [Jordi_Lisbona] [Jordi_Lisbona] -nicelink 1095/udp # NICELink [Jordi_Lisbona] [Jordi_Lisbona] -cnrprotocol 1096/tcp # Common Name Resolution [Michael_Mealling] [Michael_Mealling] -# Protocol -cnrprotocol 1096/udp # Common Name Resolution [Michael_Mealling] [Michael_Mealling] -# Protocol -sunclustermgr 1097/tcp # Sun Cluster Manager [Ashit_Patel] [Ashit_Patel] -sunclustermgr 1097/udp # Sun Cluster Manager [Ashit_Patel] [Ashit_Patel] -rmiactivation 1098/tcp # RMI Activation -rmiactivation 1098/udp # RMI Activation -rmiregistry 1099/tcp # RMI Registry [Mark_Hodapp] [Mark_Hodapp] -rmiregistry 1099/udp # RMI Registry [Mark_Hodapp] [Mark_Hodapp] -mctp 1100/tcp # MCTP [Vitaly_Revsin] [Vitaly_Revsin] -mctp 1100/udp # MCTP [Vitaly_Revsin] [Vitaly_Revsin] -pt2-discover 1101/tcp # PT2-DISCOVER [Ralph_Kammerlander] [Ralph_Kammerlander] -pt2-discover 1101/udp # PT2-DISCOVER [Ralph_Kammerlander] [Ralph_Kammerlander] -adobeserver-1 1102/tcp # ADOBE SERVER 1 -adobeserver-1 1102/udp # ADOBE SERVER 1 -adobeserver-2 1103/tcp # ADOBE SERVER 2 [Frank_Soetebeer] [Frank_Soetebeer] -adobeserver-2 1103/udp # ADOBE SERVER 2 [Frank_Soetebeer] [Frank_Soetebeer] -xrl 1104/tcp # XRL [Patrick_Robinson] [Patrick_Robinson] -xrl 1104/udp # XRL [Patrick_Robinson] [Patrick_Robinson] -ftranhc 1105/tcp # FTRANHC [Eriko_Shimada] [Eriko_Shimada] -ftranhc 1105/udp # FTRANHC [Eriko_Shimada] [Eriko_Shimada] -isoipsigport-1 1106/tcp # ISOIPSIGPORT-1 -isoipsigport-1 1106/udp # ISOIPSIGPORT-1 -isoipsigport-2 1107/tcp # ISOIPSIGPORT-2 [Peter_Egli] [Peter_Egli] -isoipsigport-2 1107/udp # ISOIPSIGPORT-2 [Peter_Egli] [Peter_Egli] -ratio-adp 1108/tcp # ratio-adp [Oliver_Thulke] [Oliver_Thulke] -ratio-adp 1108/udp # ratio-adp [Oliver_Thulke] [Oliver_Thulke] -# 1109 Reserved - IANA -webadmstart 1110/tcp # Start web admin server -nfsd-keepalive 1110/udp # Client status info [Beth_Crespo] [Beth_Crespo] -lmsocialserver 1111/tcp # LM Social Server [Ron_Lussier] [Ron_Lussier] -lmsocialserver 1111/udp # LM Social Server [Ron_Lussier] [Ron_Lussier] -icp 1112/tcp # Intelligent Communication [Mark_H_David] [Mark_H_David] -# Protocol -icp 1112/udp # Intelligent Communication [Mark_H_David] [Mark_H_David] -# Protocol -ltp-deepspace 1113/tcp # Licklider Transmission [RFC5326] -# Protocol -ltp-deepspace 1113/udp # Licklider Transmission 2014-02-21 [RFC5326][RFC7122] -# Protocol -ltp-deepspace 1113/dccp # Licklider Transmission 2013-11-12 2014-02-21 [RFC7122] 7107696 -# Protocol -mini-sql 1114/tcp # Mini SQL [David_Hughes] [David_Hughes] -mini-sql 1114/udp # Mini SQL [David_Hughes] [David_Hughes] -ardus-trns 1115/tcp # ARDUS Transfer -ardus-trns 1115/udp # ARDUS Transfer -ardus-cntl 1116/tcp # ARDUS Control -ardus-cntl 1116/udp # ARDUS Control -ardus-mtrns 1117/tcp # ARDUS Multicast Transfer [Shinya_Abe] [Shinya_Abe] -ardus-mtrns 1117/udp # ARDUS Multicast Transfer [Shinya_Abe] [Shinya_Abe] -sacred 1118/tcp # SACRED [RFC3767] -sacred 1118/udp # SACRED [RFC3767] -bnetgame 1119/tcp # Battle.net Chat/Game -# Protocol -bnetgame 1119/udp # Battle.net Chat/Game -# Protocol -bnetfile 1120/tcp # Battle.net File Transfer [Domain_Tech] [Domain_Tech] 2005-04 -# Protocol -bnetfile 1120/udp # Battle.net File Transfer [Domain_Tech] [Domain_Tech] 2005-04 -# Protocol -rmpp 1121/tcp # Datalode RMPP [Dave_Ruedger] [Dave_Ruedger] 2003-11 -rmpp 1121/udp # Datalode RMPP [Dave_Ruedger] [Dave_Ruedger] 2003-11 -availant-mgr 1122/tcp # availant-mgr [Steven_Pelletier] [Steven_Pelletier] -availant-mgr 1122/udp # availant-mgr [Steven_Pelletier] [Steven_Pelletier] -murray 1123/tcp # Murray [Stu_Mark] [Stu_Mark] -murray 1123/udp # Murray [Stu_Mark] [Stu_Mark] -hpvmmcontrol 1124/tcp # HP VMM Control -hpvmmcontrol 1124/udp # HP VMM Control -hpvmmagent 1125/tcp # HP VMM Agent -hpvmmagent 1125/udp # HP VMM Agent -hpvmmdata 1126/tcp # HP VMM Agent [John_Morton] [John_Morton] 2004-11 -hpvmmdata 1126/udp # HP VMM Agent [John_Morton] [John_Morton] 2004-11 -kwdb-commn 1127/tcp # KWDB Remote Communication [Lal_Samuel_Varghese] [Lal_Samuel_Varghese] 2005-08 -kwdb-commn 1127/udp # KWDB Remote Communication [Lal_Samuel_Varghese] [Lal_Samuel_Varghese] 2005-08 -saphostctrl 1128/tcp # SAPHostControl over -# SOAP/HTTP -saphostctrl 1128/udp # SAPHostControl over -# SOAP/HTTP -saphostctrls 1129/tcp # SAPHostControl over [Muscarella_Fabrizio] [Muscarella_Fabrizio] 2006-04 -# SOAP/HTTPS -saphostctrls 1129/udp # SAPHostControl over [Muscarella_Fabrizio] [Muscarella_Fabrizio] 2006-04 -# SOAP/HTTPS -casp 1130/tcp # CAC App Service Protocol -casp 1130/udp # CAC App Service Protocol -caspssl 1131/tcp # CAC App Service Protocol [Enrique_Corujo] [Enrique_Corujo] 2006-02 -# Encripted -caspssl 1131/udp # CAC App Service Protocol [Enrique_Corujo] [Enrique_Corujo] 2006-02 -# Encripted -kvm-via-ip 1132/tcp # KVM-via-IP Management [Ian_Miller] [Ian_Miller] 2006-03 -# Service -kvm-via-ip 1132/udp # KVM-via-IP Management [Ian_Miller] [Ian_Miller] 2006-03 -# Service -dfn 1133/tcp # Data Flow Network [Dmitry_Obuvalin] [Dmitry_Obuvalin] 2006-02 -dfn 1133/udp # Data Flow Network [Dmitry_Obuvalin] [Dmitry_Obuvalin] 2006-02 -aplx 1134/tcp # MicroAPL APLX [Richard_Nabavi] [Richard_Nabavi] 2006-02 -aplx 1134/udp # MicroAPL APLX [Richard_Nabavi] [Richard_Nabavi] 2006-02 -omnivision 1135/tcp # OmniVision Communication [Serge_Vacquier] [Serge_Vacquier] 2006-02 -# Service -omnivision 1135/udp # OmniVision Communication [Serge_Vacquier] [Serge_Vacquier] 2006-02 -# Service -hhb-gateway 1136/tcp # HHB Gateway Control [Richard_Harwell] [Richard_Harwell] 2006-02 -hhb-gateway 1136/udp # HHB Gateway Control [Richard_Harwell] [Richard_Harwell] 2006-02 -trim 1137/tcp # TRIM Workgroup Service [Siva_Poobalasingam] [Siva_Poobalasingam] 2006-03 -trim 1137/udp # TRIM Workgroup Service [Siva_Poobalasingam] [Siva_Poobalasingam] 2006-03 -# encrypted admin requests -# -encrypted-admin 1138/tcp # IANA assigned this [Michael_Elizarov] [Michael_Elizarov] 2007-01 -# well-formed service name as -# a replacement for -# "encrypted_admin". -# This entry is an alias to "encrypted-admin". This entry is -encrypted_admin 1138/tcp # encrypted admin requests [Michael_Elizarov] [Michael_Elizarov] 2007-01 now historic, not usable for use with many common service -# discovery mechanisms. -# encrypted admin requests -# -encrypted-admin 1138/udp # IANA assigned this [Michael_Elizarov] [Michael_Elizarov] 2007-01 -# well-formed service name as -# a replacement for -# "encrypted_admin". -# This entry is an alias to "encrypted-admin". This entry is -encrypted_admin 1138/udp # encrypted admin requests [Michael_Elizarov] [Michael_Elizarov] 2007-01 now historic, not usable for use with many common service -# discovery mechanisms. -evm 1139/tcp # Enterprise Virtual Manager [Thomas_Hennessy] [Thomas_Hennessy] 2007-10-04 -evm 1139/udp # Enterprise Virtual Manager [Thomas_Hennessy] [Thomas_Hennessy] 2007-10-04 -autonoc 1140/tcp # AutoNOC Network Operations [Kyle_Lussier] [Kyle_Lussier] 2005-12 -# Protocol -autonoc 1140/udp # AutoNOC Network Operations [Kyle_Lussier] [Kyle_Lussier] 2005-12 -# Protocol -mxomss 1141/tcp # User Message Service [Chaoyi_Lang] [Chaoyi_Lang] 2006-01 -mxomss 1141/udp # User Message Service [Chaoyi_Lang] [Chaoyi_Lang] 2006-01 -edtools 1142/tcp # User Discovery Service [Lee_Dolson] [Lee_Dolson] 2006-01 -edtools 1142/udp # User Discovery Service [Lee_Dolson] [Lee_Dolson] 2006-01 -imyx 1143/tcp # Infomatryx Exchange [David_Walling] [David_Walling] 2006-03 -imyx 1143/udp # Infomatryx Exchange [David_Walling] [David_Walling] 2006-03 -fuscript 1144/tcp # Fusion Script [Peter_Loveday] [Peter_Loveday] 2006-01 -fuscript 1144/udp # Fusion Script [Peter_Loveday] [Peter_Loveday] 2006-01 -x9-icue 1145/tcp # X9 iCue Show Control [Brandon_Potter] [Brandon_Potter] 2006-01 -x9-icue 1145/udp # X9 iCue Show Control [Brandon_Potter] [Brandon_Potter] 2006-01 -audit-transfer 1146/tcp # audit transfer [Mark_Wahl] [Mark_Wahl] 2005-11 -audit-transfer 1146/udp # audit transfer [Mark_Wahl] [Mark_Wahl] 2005-11 -capioverlan 1147/tcp # CAPIoverLAN [Diego_Friedel] [Diego_Friedel] 2005-11 -capioverlan 1147/udp # CAPIoverLAN [Diego_Friedel] [Diego_Friedel] 2005-11 -elfiq-repl 1148/tcp # Elfiq Replication Service [Frederick_Parent] [Frederick_Parent] 2005-11 -elfiq-repl 1148/udp # Elfiq Replication Service [Frederick_Parent] [Frederick_Parent] 2005-11 -bvtsonar 1149/tcp # BlueView Sonar Service [Teledyne_BlueView_Inc] [Cat_Zimmermann] 2005-11 2012-09-19 -bvtsonar 1149/udp # BlueView Sonar Service [Teledyne_BlueView_Inc] [Cat_Zimmermann] 2005-11 2012-09-19 -blaze 1150/tcp # Blaze File Server [Curt_Schimmel] [Curt_Schimmel] 2005-11 -blaze 1150/udp # Blaze File Server [Curt_Schimmel] [Curt_Schimmel] 2005-11 -unizensus 1151/tcp # Unizensus Login Server [Dirk_Materlik] [Dirk_Materlik] 2005-11 -unizensus 1151/udp # Unizensus Login Server [Dirk_Materlik] [Dirk_Materlik] 2005-11 -winpoplanmess 1152/tcp # Winpopup LAN Messenger [Vitali_Fomine] [Vitali_Fomine] 2005-11 -winpoplanmess 1152/udp # Winpopup LAN Messenger [Vitali_Fomine] [Vitali_Fomine] 2005-11 -c1222-acse 1153/tcp # ANSI C12.22 Port [RFC6142] -c1222-acse 1153/udp # ANSI C12.22 Port [RFC6142] -resacommunity 1154/tcp # Community Service [Stephane_MONS] [Stephane_MONS] 2005-09 -resacommunity 1154/udp # Community Service [Stephane_MONS] [Stephane_MONS] 2005-09 -nfa 1155/tcp # Network File Access [James_Powell] [James_Powell] -nfa 1155/udp # Network File Access [James_Powell] [James_Powell] -iascontrol-oms 1156/tcp # iasControl OMS [Todd_Guay] [Todd_Guay] 2004-11 -iascontrol-oms 1156/udp # iasControl OMS [Todd_Guay] [Todd_Guay] 2004-11 -iascontrol 1157/tcp # Oracle iASControl [Todd_Guay] [Todd_Guay] 2004-11 -iascontrol 1157/udp # Oracle iASControl [Todd_Guay] [Todd_Guay] 2004-11 -dbcontrol-oms 1158/tcp # dbControl OMS [Todd_Guay] [Todd_Guay] 2004-11 -dbcontrol-oms 1158/udp # dbControl OMS [Todd_Guay] [Todd_Guay] 2004-11 -oracle-oms 1159/tcp # Oracle OMS [Todd_Guay] [Todd_Guay] 2004-11 -oracle-oms 1159/udp # Oracle OMS [Todd_Guay] [Todd_Guay] 2004-11 -olsv 1160/tcp # DB Lite Mult-User Server [Philip_Stephenson] [Philip_Stephenson] 2005-08 -olsv 1160/udp # DB Lite Mult-User Server [Philip_Stephenson] [Philip_Stephenson] 2005-08 -health-polling 1161/tcp # Health Polling -health-polling 1161/udp # Health Polling -health-trap 1162/tcp # Health Trap -health-trap 1162/udp # Health Trap -sddp 1163/tcp # SmartDialer Data Protocol [Lee_Griffiths] [Lee_Griffiths] 2004-11 -sddp 1163/udp # SmartDialer Data Protocol [Lee_Griffiths] [Lee_Griffiths] 2004-11 -qsm-proxy 1164/tcp # QSM Proxy Service [Norm_Lunde] [Norm_Lunde] 2004-11 -qsm-proxy 1164/udp # QSM Proxy Service [Norm_Lunde] [Norm_Lunde] 2004-11 -qsm-gui 1165/tcp # QSM GUI Service [Norm_Lunde] [Norm_Lunde] 2004-11 -qsm-gui 1165/udp # QSM GUI Service [Norm_Lunde] [Norm_Lunde] 2004-11 -qsm-remote 1166/tcp # QSM RemoteExec [Norm_Lunde] [Norm_Lunde] 2004-11 -qsm-remote 1166/udp # QSM RemoteExec [Norm_Lunde] [Norm_Lunde] 2004-11 -cisco-ipsla 1167/tcp # Cisco IP SLAs Control [Emmanuel_Tychon] [Emmanuel_Tychon] 2006-03 -# Protocol -cisco-ipsla 1167/udp # Cisco IP SLAs Control [Emmanuel_Tychon] [Emmanuel_Tychon] 2006-03 -# Protocol -cisco-ipsla 1167/sctp # Cisco IP SLAs Control [Emmanuel_Tychon] [Emmanuel_Tychon] 2006-03 -# Protocol -vchat 1168/tcp # VChat Conference Service [Andreas_Wetzel] [Andreas_Wetzel] 2002-09 -vchat 1168/udp # VChat Conference Service [Andreas_Wetzel] [Andreas_Wetzel] 2002-09 -tripwire 1169/tcp # TRIPWIRE [Ed_Metcalf][Albert_Holt] [Ed_Metcalf][Albert_Holt] -tripwire 1169/udp # TRIPWIRE [Ed_Metcalf][Albert_Holt] [Ed_Metcalf][Albert_Holt] -atc-lm 1170/tcp # AT+C License Manager [Peter_Schafer] [Peter_Schafer] 2004-02 -atc-lm 1170/udp # AT+C License Manager [Peter_Schafer] [Peter_Schafer] 2004-02 -atc-appserver 1171/tcp # AT+C FmiApplicationServer [Peter_Schafer] [Peter_Schafer] 2004-02 -atc-appserver 1171/udp # AT+C FmiApplicationServer [Peter_Schafer] [Peter_Schafer] 2004-02 -dnap 1172/tcp # DNA Protocol [David_McLaughlin] [David_McLaughlin] 2004-11 -dnap 1172/udp # DNA Protocol [David_McLaughlin] [David_McLaughlin] 2004-11 -d-cinema-rrp 1173/tcp # D-Cinema Request-Response [Robert_Baldwin] [Robert_Baldwin] 2004-11 -d-cinema-rrp 1173/udp # D-Cinema Request-Response [Robert_Baldwin] [Robert_Baldwin] 2004-11 -fnet-remote-ui 1174/tcp # FlashNet Remote Admin [Terry_Smyth] [Terry_Smyth] 2004-11 -fnet-remote-ui 1174/udp # FlashNet Remote Admin [Terry_Smyth] [Terry_Smyth] 2004-11 -dossier 1175/tcp # Dossier Server [Rob_Minerick] [Rob_Minerick] 2004-11 -dossier 1175/udp # Dossier Server [Rob_Minerick] [Rob_Minerick] 2004-11 -indigo-server 1176/tcp # Indigo Home Server [Matt_Bendiksen] [Matt_Bendiksen] 2004-11 -indigo-server 1176/udp # Indigo Home Server [Matt_Bendiksen] [Matt_Bendiksen] 2004-11 -dkmessenger 1177/tcp # DKMessenger Protocol [Douglas_Kadlecek] [Douglas_Kadlecek] 2004-11 -dkmessenger 1177/udp # DKMessenger Protocol [Douglas_Kadlecek] [Douglas_Kadlecek] 2004-11 -sgi-storman 1178/tcp # SGI Storage Manager [Greg_Banks] [Greg_Banks] 2004-11 -sgi-storman 1178/udp # SGI Storage Manager [Greg_Banks] [Greg_Banks] 2004-11 -b2n 1179/tcp # Backup To Neighbor [Thomas_Fok] [Thomas_Fok] 2004-11 -b2n 1179/udp # Backup To Neighbor [Thomas_Fok] [Thomas_Fok] 2004-11 -mc-client 1180/tcp # Millicent Client Proxy [Steve_Glassman] [Steve_Glassman] -mc-client 1180/udp # Millicent Client Proxy [Steve_Glassman] [Steve_Glassman] -3comnetman 1181/tcp # 3Com Net Management [Peter_White] [Peter_White] 2004-11 -3comnetman 1181/udp # 3Com Net Management [Peter_White] [Peter_White] 2004-11 -accelenet 1182/tcp # AcceleNet Control -accelenet-data 1182/udp # AcceleNet Data [Peter_Lepeska] [Peter_Lepeska] 2010-09-10 -llsurfup-http 1183/tcp # LL Surfup HTTP -llsurfup-http 1183/udp # LL Surfup HTTP -llsurfup-https 1184/tcp # LL Surfup HTTPS [Katy_Lynn_McCullough] [Katy_Lynn_McCullough] -llsurfup-https 1184/udp # LL Surfup HTTPS [Katy_Lynn_McCullough] [Katy_Lynn_McCullough] -catchpole 1185/tcp # Catchpole port [Christian_Catchpole] [Christian_Catchpole] 2002-03 -catchpole 1185/udp # Catchpole port [Christian_Catchpole] [Christian_Catchpole] 2002-03 -mysql-cluster 1186/tcp # MySQL Cluster Manager [Arjen_Lentz] [Arjen_Lentz] 2004-11 -mysql-cluster 1186/udp # MySQL Cluster Manager [Arjen_Lentz] [Arjen_Lentz] 2004-11 -alias 1187/tcp # Alias Service [Paul_Tokarchuk] [Paul_Tokarchuk] 2004-11 -alias 1187/udp # Alias Service [Paul_Tokarchuk] [Paul_Tokarchuk] 2004-11 -hp-webadmin 1188/tcp # HP Web Admin [Lance_Kind] [Lance_Kind] -hp-webadmin 1188/udp # HP Web Admin [Lance_Kind] [Lance_Kind] -unet 1189/tcp # Unet Connection [Anthony_Stahler] [Anthony_Stahler] 2004-11 -unet 1189/udp # Unet Connection [Anthony_Stahler] [Anthony_Stahler] 2004-11 -commlinx-avl 1190/tcp # CommLinx GPS / AVL System [Peter_Johnson] [Peter_Johnson] 2004-11 -commlinx-avl 1190/udp # CommLinx GPS / AVL System [Peter_Johnson] [Peter_Johnson] 2004-11 -gpfs 1191/tcp # General Parallel File System [Dave_Craft] [Dave_Craft] 2004-11 -gpfs 1191/udp # General Parallel File System [Dave_Craft] [Dave_Craft] 2004-11 -caids-sensor 1192/tcp # caids sensors channel [Gregory_Hostettler] [Gregory_Hostettler] 2004-11 -caids-sensor 1192/udp # caids sensors channel [Gregory_Hostettler] [Gregory_Hostettler] 2004-11 -fiveacross 1193/tcp # Five Across Server [Glenn_Reid] [Glenn_Reid] 2004-11 -fiveacross 1193/udp # Five Across Server [Glenn_Reid] [Glenn_Reid] 2004-11 -openvpn 1194/tcp # OpenVPN [James_Yonan] [James_Yonan] 2004-11 -openvpn 1194/udp # OpenVPN [James_Yonan] [James_Yonan] 2004-11 -rsf-1 1195/tcp # RSF-1 clustering [Dave_Hines] [Dave_Hines] 2004-11 -rsf-1 1195/udp # RSF-1 clustering [Dave_Hines] [Dave_Hines] 2004-11 -netmagic 1196/tcp # Network Magic [Nick_Holt] [Nick_Holt] 2005-08 -netmagic 1196/udp # Network Magic [Nick_Holt] [Nick_Holt] 2005-08 -carrius-rshell 1197/tcp # Carrius Remote Access [Gerry_Dubois] [Gerry_Dubois] 2005-08 -carrius-rshell 1197/udp # Carrius Remote Access [Gerry_Dubois] [Gerry_Dubois] 2005-08 -cajo-discovery 1198/tcp # cajo reference discovery [John_Catherino] [John_Catherino] 2005-08 -cajo-discovery 1198/udp # cajo reference discovery [John_Catherino] [John_Catherino] 2005-08 -dmidi 1199/tcp # DMIDI [Phil_Kerr] [Phil_Kerr] 2002-02 -dmidi 1199/udp # DMIDI [Phil_Kerr] [Phil_Kerr] 2002-02 -scol 1200/tcp # SCOL [Cryo_Networks] [Cryo_Networks] -scol 1200/udp # SCOL [Cryo_Networks] [Cryo_Networks] -nucleus-sand 1201/tcp # Nucleus Sand Database Server [James_Marsh] [James_Marsh] -nucleus-sand 1201/udp # Nucleus Sand Database Server [James_Marsh] [James_Marsh] -caiccipc 1202/tcp # caiccipc [Vince_Re] [Vince_Re] -caiccipc 1202/udp # caiccipc [Vince_Re] [Vince_Re] -ssslic-mgr 1203/tcp # License Validation -ssslic-mgr 1203/udp # License Validation -ssslog-mgr 1204/tcp # Log Request Listener [Eric_Bruno] [Eric_Bruno] -ssslog-mgr 1204/udp # Log Request Listener [Eric_Bruno] [Eric_Bruno] -accord-mgc 1205/tcp # Accord-MGC [Roni_Even] [Roni_Even] -accord-mgc 1205/udp # Accord-MGC [Roni_Even] [Roni_Even] -anthony-data 1206/tcp # Anthony Data [Paul_Dollemore] [Paul_Dollemore] -anthony-data 1206/udp # Anthony Data [Paul_Dollemore] [Paul_Dollemore] -metasage 1207/tcp # MetaSage [Peter_Anvelt] [Peter_Anvelt] -metasage 1207/udp # MetaSage [Peter_Anvelt] [Peter_Anvelt] -seagull-ais 1208/tcp # SEAGULL AIS [Lee_Breisacher] [Lee_Breisacher] -seagull-ais 1208/udp # SEAGULL AIS [Lee_Breisacher] [Lee_Breisacher] -ipcd3 1209/tcp # IPCD3 [Mark_Ciskey] [Mark_Ciskey] -ipcd3 1209/udp # IPCD3 [Mark_Ciskey] [Mark_Ciskey] -eoss 1210/tcp # EOSS [Robert_Armes] [Robert_Armes] -eoss 1210/udp # EOSS [Robert_Armes] [Robert_Armes] -groove-dpp 1211/tcp # Groove DPP [Ken_Moore] [Ken_Moore] -groove-dpp 1211/udp # Groove DPP [Ken_Moore] [Ken_Moore] -lupa 1212/tcp # lupa [Barney_Wolff] [Barney_Wolff] -lupa 1212/udp # lupa [Barney_Wolff] [Barney_Wolff] -mpc-lifenet 1213/tcp # Medtronic/Physio-Control [Physio-Control_Inc] [Kevin_Drew] 2014-02-14 -# LIFENET -mpc-lifenet 1213/udp # Medtronic/Physio-Control [Physio-Control_Inc] [Kevin_Drew] 2014-02-14 -# LIFENET -kazaa 1214/tcp # KAZAA [Ahti_Heinla] [Ahti_Heinla] -kazaa 1214/udp # KAZAA [Ahti_Heinla] [Ahti_Heinla] -scanstat-1 1215/tcp # scanSTAT 1.0 [William_Scheding] [William_Scheding] -scanstat-1 1215/udp # scanSTAT 1.0 [William_Scheding] [William_Scheding] -etebac5 1216/tcp # ETEBAC 5 [Jean_Louis_Barbut] [Jean_Louis_Barbut] -etebac5 1216/udp # ETEBAC 5 [Jean_Louis_Barbut] [Jean_Louis_Barbut] -hpss-ndapi 1217/tcp # HPSS NonDCE Gateway [Michael_Gleicher] [Michael_Gleicher] -hpss-ndapi 1217/udp # HPSS NonDCE Gateway [Michael_Gleicher] [Michael_Gleicher] -aeroflight-ads 1218/tcp # AeroFlight-ADs -aeroflight-ads 1218/udp # AeroFlight-ADs -aeroflight-ret 1219/tcp # AeroFlight-Ret [Eric_Johnson] [Eric_Johnson] -aeroflight-ret 1219/udp # AeroFlight-Ret [Eric_Johnson] [Eric_Johnson] -qt-serveradmin 1220/tcp # QT SERVER ADMIN [Chris_LeCroy] [Chris_LeCroy] -qt-serveradmin 1220/udp # QT SERVER ADMIN [Chris_LeCroy] [Chris_LeCroy] -sweetware-apps 1221/tcp # SweetWARE Apps [David_Dunetz] [David_Dunetz] -sweetware-apps 1221/udp # SweetWARE Apps [David_Dunetz] [David_Dunetz] -nerv 1222/tcp # SNI R&D network [Martin_Freiss] [Martin_Freiss] -nerv 1222/udp # SNI R&D network [Martin_Freiss] [Martin_Freiss] -tgp 1223/tcp # TrulyGlobal Protocol [Gur_Kimchi] [Gur_Kimchi] 2008-05-20 -tgp 1223/udp # TrulyGlobal Protocol [Gur_Kimchi] [Gur_Kimchi] 2008-05-20 -vpnz 1224/tcp # VPNz [Tom_Strack] [Tom_Strack] -vpnz 1224/udp # VPNz [Tom_Strack] [Tom_Strack] -slinkysearch 1225/tcp # SLINKYSEARCH [Desmond_Chan] [Desmond_Chan] -slinkysearch 1225/udp # SLINKYSEARCH [Desmond_Chan] [Desmond_Chan] -stgxfws 1226/tcp # STGXFWS [Tetsuya_Shioda] [Tetsuya_Shioda] -stgxfws 1226/udp # STGXFWS [Tetsuya_Shioda] [Tetsuya_Shioda] -dns2go 1227/tcp # DNS2Go [Deerfield_Communications_Inc] [Mike_Courterier] 2015-07-15 -dns2go 1227/udp # DNS2Go [Deerfield_Communications_Inc] [Mike_Courterier] 2015-07-15 -florence 1228/tcp # FLORENCE [Brian_Trammell] [Brian_Trammell] -florence 1228/udp # FLORENCE [Brian_Trammell] [Brian_Trammell] -zented 1229/tcp # ZENworks Tiered Electronic [Ty_Ellis] [Ty_Ellis] -# Distribution -zented 1229/udp # ZENworks Tiered Electronic [Ty_Ellis] [Ty_Ellis] -# Distribution -periscope 1230/tcp # Periscope [Kevin_Madden] [Kevin_Madden] -periscope 1230/udp # Periscope [Kevin_Madden] [Kevin_Madden] -menandmice-lpm 1231/tcp # menandmice-lpm [Sigfus_Magnusson] [Sigfus_Magnusson] -menandmice-lpm 1231/udp # menandmice-lpm [Sigfus_Magnusson] [Sigfus_Magnusson] -first-defense 1232/tcp # Remote systems monitoring [Nexum] [Michael_Fread] 2012-09-21 Microsoft (unoffically) using 1232 -first-defense 1232/udp # Remote systems monitoring [Nexum] [Michael_Fread] 2012-09-21 Microsoft (unoffically) using 1232 -univ-appserver 1233/tcp # Universal App Server [Tim_Sent] [Tim_Sent] -univ-appserver 1233/udp # Universal App Server [Tim_Sent] [Tim_Sent] -search-agent 1234/tcp # Infoseek Search Agent [Jackie_Wu] [Jackie_Wu] -search-agent 1234/udp # Infoseek Search Agent [Jackie_Wu] [Jackie_Wu] -mosaicsyssvc1 1235/tcp # mosaicsyssvc1 [Brian_Matthews] [Brian_Matthews] -mosaicsyssvc1 1235/udp # mosaicsyssvc1 [Brian_Matthews] [Brian_Matthews] -bvcontrol 1236/tcp # bvcontrol [Daniel_J_Walsh] [Daniel_J_Walsh] -bvcontrol 1236/udp # bvcontrol [Daniel_J_Walsh] [Daniel_J_Walsh] -tsdos390 1237/tcp # tsdos390 [Ben_Pracht] [Ben_Pracht] -tsdos390 1237/udp # tsdos390 [Ben_Pracht] [Ben_Pracht] -hacl-qs 1238/tcp # hacl-qs [Farid_Faez] [Farid_Faez] -hacl-qs 1238/udp # hacl-qs [Farid_Faez] [Farid_Faez] -nmsd 1239/tcp # NMSD [Yuri_Machkasov] [Yuri_Machkasov] -nmsd 1239/udp # NMSD [Yuri_Machkasov] [Yuri_Machkasov] -instantia 1240/tcp # Instantia [Ruth_Slater] [Ruth_Slater] -instantia 1240/udp # Instantia [Ruth_Slater] [Ruth_Slater] -nessus 1241/tcp # nessus [Jordan_Hrycaj] [Jordan_Hrycaj] -nessus 1241/udp # nessus [Jordan_Hrycaj] [Jordan_Hrycaj] -nmasoverip 1242/tcp # NMAS over IP [Hal_Henderson] [Hal_Henderson] -nmasoverip 1242/udp # NMAS over IP [Hal_Henderson] [Hal_Henderson] -serialgateway 1243/tcp # SerialGateway [Stephen_LaValley] [Stephen_LaValley] -serialgateway 1243/udp # SerialGateway [Stephen_LaValley] [Stephen_LaValley] -isbconference1 1244/tcp # isbconference1 -isbconference1 1244/udp # isbconference1 -isbconference2 1245/tcp # isbconference2 [Arnold_Dittmann] [Arnold_Dittmann] -isbconference2 1245/udp # isbconference2 [Arnold_Dittmann] [Arnold_Dittmann] -payrouter 1246/tcp # payrouter [David_Wilson] [David_Wilson] -payrouter 1246/udp # payrouter [David_Wilson] [David_Wilson] -visionpyramid 1247/tcp # VisionPyramid [Gavin_Hutchinson] [Gavin_Hutchinson] -visionpyramid 1247/udp # VisionPyramid [Gavin_Hutchinson] [Gavin_Hutchinson] -hermes 1248/tcp # hermes -hermes 1248/udp # hermes -mesavistaco 1249/tcp # Mesa Vista Co [Rick_LaBanca] [Rick_LaBanca] -mesavistaco 1249/udp # Mesa Vista Co [Rick_LaBanca] [Rick_LaBanca] -swldy-sias 1250/tcp # swldy-sias [Peter_E_Williams] [Peter_E_Williams] -swldy-sias 1250/udp # swldy-sias [Peter_E_Williams] [Peter_E_Williams] -servergraph 1251/tcp # servergraph [Lindsay_Morris] [Lindsay_Morris] -servergraph 1251/udp # servergraph [Lindsay_Morris] [Lindsay_Morris] -bspne-pcc 1252/tcp # bspne-pcc -bspne-pcc 1252/udp # bspne-pcc -q55-pcc 1253/tcp # q55-pcc [Prem_Tirilok] [Prem_Tirilok] -q55-pcc 1253/udp # q55-pcc [Prem_Tirilok] [Prem_Tirilok] -de-noc 1254/tcp # de-noc -de-noc 1254/udp # de-noc -de-cache-query 1255/tcp # de-cache-query -de-cache-query 1255/udp # de-cache-query -de-server 1256/tcp # de-server [Jeff_Burdette] [Jeff_Burdette] -de-server 1256/udp # de-server [Jeff_Burdette] [Jeff_Burdette] -shockwave2 1257/tcp # Shockwave 2 [Dave_Simmons] [Dave_Simmons] -shockwave2 1257/udp # Shockwave 2 [Dave_Simmons] [Dave_Simmons] -opennl 1258/tcp # Open Network Library -opennl 1258/udp # Open Network Library -opennl-voice 1259/tcp # Open Network Library Voice [Phil_Frisbie] [Phil_Frisbie] -opennl-voice 1259/udp # Open Network Library Voice [Phil_Frisbie] [Phil_Frisbie] -ibm-ssd 1260/tcp # ibm-ssd [Barry_Whyte] [Barry_Whyte] -ibm-ssd 1260/udp # ibm-ssd [Barry_Whyte] [Barry_Whyte] -mpshrsv 1261/tcp # mpshrsv [Makoto_Ikeyama] [Makoto_Ikeyama] -mpshrsv 1261/udp # mpshrsv [Makoto_Ikeyama] [Makoto_Ikeyama] -qnts-orb 1262/tcp # QNTS-ORB [Raghurama_Bhat] [Raghurama_Bhat] -qnts-orb 1262/udp # QNTS-ORB [Raghurama_Bhat] [Raghurama_Bhat] -dka 1263/tcp # dka [Chris_Griffin] [Chris_Griffin] -dka 1263/udp # dka [Chris_Griffin] [Chris_Griffin] -prat 1264/tcp # PRAT [Keith_Wood] [Keith_Wood] -prat 1264/udp # PRAT [Keith_Wood] [Keith_Wood] -dssiapi 1265/tcp # DSSIAPI [Jim_Turner] [Jim_Turner] -dssiapi 1265/udp # DSSIAPI [Jim_Turner] [Jim_Turner] -dellpwrappks 1266/tcp # DELLPWRAPPKS [David_Troeger] [David_Troeger] -dellpwrappks 1266/udp # DELLPWRAPPKS [David_Troeger] [David_Troeger] -epc 1267/tcp # eTrust Policy Compliance [Aaron_Stein] [Aaron_Stein] -epc 1267/udp # eTrust Policy Compliance [Aaron_Stein] [Aaron_Stein] -propel-msgsys 1268/tcp # PROPEL-MSGSYS [Bert_Van_der_Linden] [Bert_Van_der_Linden] -propel-msgsys 1268/udp # PROPEL-MSGSYS [Bert_Van_der_Linden] [Bert_Van_der_Linden] -watilapp 1269/tcp # WATiLaPP [Frederic_Weymann] [Frederic_Weymann] -watilapp 1269/udp # WATiLaPP [Frederic_Weymann] [Frederic_Weymann] -opsmgr 1270/tcp # Microsoft Operations Manager [Ashvin_Sanghvi] [Ashvin_Sanghvi] -opsmgr 1270/udp # Microsoft Operations Manager [Ashvin_Sanghvi] [Ashvin_Sanghvi] -excw 1271/tcp # eXcW [Norm_Freedman] [Norm_Freedman] -excw 1271/udp # eXcW [Norm_Freedman] [Norm_Freedman] -cspmlockmgr 1272/tcp # CSPMLockMgr [Ibtsam_Mahfouz] [Ibtsam_Mahfouz] -cspmlockmgr 1272/udp # CSPMLockMgr [Ibtsam_Mahfouz] [Ibtsam_Mahfouz] -emc-gateway 1273/tcp # EMC-Gateway [Rene_Fontaine] [Rene_Fontaine] -emc-gateway 1273/udp # EMC-Gateway [Rene_Fontaine] [Rene_Fontaine] -t1distproc 1274/tcp # t1distproc [Julian_Biddle] [Julian_Biddle] -t1distproc 1274/udp # t1distproc [Julian_Biddle] [Julian_Biddle] -ivcollector 1275/tcp # ivcollector -ivcollector 1275/udp # ivcollector -# 1276 tcp Reserved 2014-05-23 This entry has been removed on 2014-05-23. -# 1276 udp Reserved 2014-05-23 This entry has been removed on 2014-05-23. -miva-mqs 1277/tcp # mqs [Miva_Corporation] [Miva_Corporation] -miva-mqs 1277/udp # mqs [Miva_Corporation] [Miva_Corporation] -dellwebadmin-1 1278/tcp # Dell Web Admin 1 -dellwebadmin-1 1278/udp # Dell Web Admin 1 -dellwebadmin-2 1279/tcp # Dell Web Admin 2 [Bridget_Navoda] [Bridget_Navoda] -dellwebadmin-2 1279/udp # Dell Web Admin 2 [Bridget_Navoda] [Bridget_Navoda] -pictrography 1280/tcp # Pictrography [Takashi_Hoshino] [Takashi_Hoshino] -pictrography 1280/udp # Pictrography [Takashi_Hoshino] [Takashi_Hoshino] -healthd 1281/tcp # healthd [James_E_Housley] [James_E_Housley] -healthd 1281/udp # healthd [James_E_Housley] [James_E_Housley] -emperion 1282/tcp # Emperion [Claus_Thor_Barth] [Claus_Thor_Barth] -emperion 1282/udp # Emperion [Claus_Thor_Barth] [Claus_Thor_Barth] -productinfo 1283/tcp # Product Information -productinfo 1283/udp # Product Information -iee-qfx 1284/tcp # IEE-QFX [Mehrdad_Ashtiani] [Mehrdad_Ashtiani] 2009-10-19 -iee-qfx 1284/udp # IEE-QFX [Mehrdad_Ashtiani] [Mehrdad_Ashtiani] 2009-10-19 -neoiface 1285/tcp # neoiface [Jason_McManus] [Jason_McManus] -neoiface 1285/udp # neoiface [Jason_McManus] [Jason_McManus] -netuitive 1286/tcp # netuitive [JF_Huard] [JF_Huard] -netuitive 1286/udp # netuitive [JF_Huard] [JF_Huard] -routematch 1287/tcp # RouteMatch Com [Jeff_Jones] [Jeff_Jones] 2005-11 -routematch 1287/udp # RouteMatch Com [Jeff_Jones] [Jeff_Jones] 2005-11 -navbuddy 1288/tcp # NavBuddy [Eric_Hackman] [Eric_Hackman] -navbuddy 1288/udp # NavBuddy [Eric_Hackman] [Eric_Hackman] -jwalkserver 1289/tcp # JWalkServer -jwalkserver 1289/udp # JWalkServer -winjaserver 1290/tcp # WinJaServer -winjaserver 1290/udp # WinJaServer -seagulllms 1291/tcp # SEAGULLLMS [Lee_Breisacher] [Lee_Breisacher] -seagulllms 1291/udp # SEAGULLLMS [Lee_Breisacher] [Lee_Breisacher] -dsdn 1292/tcp # dsdn [Stanislaw_Skowronek] [Stanislaw_Skowronek] -dsdn 1292/udp # dsdn [Stanislaw_Skowronek] [Stanislaw_Skowronek] -pkt-krb-ipsec 1293/tcp # PKT-KRB-IPSec [Nancy_Davoust] [Nancy_Davoust] -pkt-krb-ipsec 1293/udp # PKT-KRB-IPSec [Nancy_Davoust] [Nancy_Davoust] -cmmdriver 1294/tcp # CMMdriver [Lutz_Karras] [Lutz_Karras] -cmmdriver 1294/udp # CMMdriver [Lutz_Karras] [Lutz_Karras] -ehtp 1295/tcp # End-by-Hop Transmission [Alexander_Bogdanov] [Alexander_Bogdanov] -# Protocol -ehtp 1295/udp # End-by-Hop Transmission [Alexander_Bogdanov] [Alexander_Bogdanov] -# Protocol -dproxy 1296/tcp # dproxy -dproxy 1296/udp # dproxy -sdproxy 1297/tcp # sdproxy [Raimond_Diederik] [Raimond_Diederik] -sdproxy 1297/udp # sdproxy [Raimond_Diederik] [Raimond_Diederik] -lpcp 1298/tcp # lpcp [Christian_Stredicke] [Christian_Stredicke] -lpcp 1298/udp # lpcp [Christian_Stredicke] [Christian_Stredicke] -hp-sci 1299/tcp # hp-sci [Kim_Scott] [Kim_Scott] -hp-sci 1299/udp # hp-sci [Kim_Scott] [Kim_Scott] -h323hostcallsc 1300/tcp # H.323 Secure Call Control [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signalling -h323hostcallsc 1300/udp # H.323 Secure Call Control [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signalling -ci3-software-1 1301/tcp # CI3-Software-1 -ci3-software-1 1301/udp # CI3-Software-1 -ci3-software-2 1302/tcp # CI3-Software-2 [Kelli_Watson] [Kelli_Watson] -ci3-software-2 1302/udp # CI3-Software-2 [Kelli_Watson] [Kelli_Watson] -sftsrv 1303/tcp # sftsrv [Robert_Frazier] [Robert_Frazier] -sftsrv 1303/udp # sftsrv [Robert_Frazier] [Robert_Frazier] -boomerang 1304/tcp # Boomerang [Bruce_Lueckenhoff] [Bruce_Lueckenhoff] -boomerang 1304/udp # Boomerang [Bruce_Lueckenhoff] [Bruce_Lueckenhoff] -pe-mike 1305/tcp # pe-mike [Stephen_Hemminger] [Stephen_Hemminger] -pe-mike 1305/udp # pe-mike [Stephen_Hemminger] [Stephen_Hemminger] -re-conn-proto 1306/tcp # RE-Conn-Proto [Sandeep_Singhal] [Sandeep_Singhal] -re-conn-proto 1306/udp # RE-Conn-Proto [Sandeep_Singhal] [Sandeep_Singhal] -pacmand 1307/tcp # Pacmand [Edward_T_O_Shea] [Edward_T_O_Shea] -pacmand 1307/udp # Pacmand [Edward_T_O_Shea] [Edward_T_O_Shea] -odsi 1308/tcp # Optical Domain Service [K_Arvind] [K_Arvind] -# Interconnect (ODSI) -odsi 1308/udp # Optical Domain Service [K_Arvind] [K_Arvind] -# Interconnect (ODSI) -jtag-server 1309/tcp # JTAG server [Andrew_Draper] [Andrew_Draper] -jtag-server 1309/udp # JTAG server [Andrew_Draper] [Andrew_Draper] -husky 1310/tcp # Husky [Mark_Zang] [Mark_Zang] -husky 1310/udp # Husky [Mark_Zang] [Mark_Zang] -rxmon 1311/tcp # RxMon [Javier_Jiminez] [Javier_Jiminez] -rxmon 1311/udp # RxMon [Javier_Jiminez] [Javier_Jiminez] -sti-envision 1312/tcp # STI Envision [Don_Stedman] [Don_Stedman] -sti-envision 1312/udp # STI Envision [Don_Stedman] [Don_Stedman] -# BMC_PATROLDB -# -bmc-patroldb 1313/tcp # IANA assigned this [Portnoy_Boxman] [Portnoy_Boxman] -# well-formed service name as -# a replacement for -# "bmc_patroldb". -# This entry is an alias to "bmc-patroldb". This entry is now -bmc_patroldb 1313/tcp # BMC_PATROLDB [Portnoy_Boxman] [Portnoy_Boxman] historic, not usable for use with many common service -# discovery mechanisms. -# BMC_PATROLDB -# -bmc-patroldb 1313/udp # IANA assigned this [Portnoy_Boxman] [Portnoy_Boxman] -# well-formed service name as -# a replacement for -# "bmc_patroldb". -# This entry is an alias to "bmc-patroldb". This entry is now -bmc_patroldb 1313/udp # BMC_PATROLDB [Portnoy_Boxman] [Portnoy_Boxman] historic, not usable for use with many common service -# discovery mechanisms. -pdps 1314/tcp # Photoscript Distributed [Les_Klein] [Les_Klein] -# Printing System -pdps 1314/udp # Photoscript Distributed [Les_Klein] [Les_Klein] -# Printing System -els 1315/tcp # E.L.S., Event Listener [Jim_Cleppe] [Jim_Cleppe] -# Service -els 1315/udp # E.L.S., Event Listener [Jim_Cleppe] [Jim_Cleppe] -# Service -exbit-escp 1316/tcp # Exbit-ESCP [Morten_Christensen] [Morten_Christensen] -exbit-escp 1316/udp # Exbit-ESCP [Morten_Christensen] [Morten_Christensen] -vrts-ipcserver 1317/tcp # vrts-ipcserver [Bruce_Hestand] [Bruce_Hestand] -vrts-ipcserver 1317/udp # vrts-ipcserver [Bruce_Hestand] [Bruce_Hestand] -krb5gatekeeper 1318/tcp # krb5gatekeeper [Patrick_Moore] [Patrick_Moore] -krb5gatekeeper 1318/udp # krb5gatekeeper [Patrick_Moore] [Patrick_Moore] -amx-icsp 1319/tcp # AMX-ICSP [Jeff_Burch] [Jeff_Burch] -amx-icsp 1319/udp # AMX-ICSP [Jeff_Burch] [Jeff_Burch] -amx-axbnet 1320/tcp # AMX-AXBNET [Jeff_Burch] [Jeff_Burch] -amx-axbnet 1320/udp # AMX-AXBNET [Jeff_Burch] [Jeff_Burch] -pip 1321/tcp # PIP [Gordon_Mohr] [Gordon_Mohr] -pip 1321/udp # PIP [Gordon_Mohr] [Gordon_Mohr] -novation 1322/tcp # Novation [Alan_Dano] [Alan_Dano] -novation 1322/udp # Novation [Alan_Dano] [Alan_Dano] -brcd 1323/tcp # brcd [Todd_Picquelle] [Todd_Picquelle] -brcd 1323/udp # brcd [Todd_Picquelle] [Todd_Picquelle] -delta-mcp 1324/tcp # delta-mcp [Quinton_Tormanen] [Quinton_Tormanen] -delta-mcp 1324/udp # delta-mcp [Quinton_Tormanen] [Quinton_Tormanen] -dx-instrument 1325/tcp # DX-Instrument [Walt_Modic] [Walt_Modic] -dx-instrument 1325/udp # DX-Instrument [Walt_Modic] [Walt_Modic] -wimsic 1326/tcp # WIMSIC [James_Brown] [James_Brown] -wimsic 1326/udp # WIMSIC [James_Brown] [James_Brown] -ultrex 1327/tcp # Ultrex [Tim_Walsh] [Tim_Walsh] -ultrex 1327/udp # Ultrex [Tim_Walsh] [Tim_Walsh] -ewall 1328/tcp # EWALL [Jeff_Busma] [Jeff_Busma] -ewall 1328/udp # EWALL [Jeff_Busma] [Jeff_Busma] -netdb-export 1329/tcp # netdb-export [Konstantinos_Kostis] [Konstantinos_Kostis] -netdb-export 1329/udp # netdb-export [Konstantinos_Kostis] [Konstantinos_Kostis] -streetperfect 1330/tcp # StreetPerfect [Michael_R_Young] [Michael_R_Young] -streetperfect 1330/udp # StreetPerfect [Michael_R_Young] [Michael_R_Young] -intersan 1331/tcp # intersan [Barry_H_Feild] [Barry_H_Feild] -intersan 1331/udp # intersan [Barry_H_Feild] [Barry_H_Feild] -pcia-rxp-b 1332/tcp # PCIA RXP-B [James_Dabbs] [James_Dabbs] -pcia-rxp-b 1332/udp # PCIA RXP-B [James_Dabbs] [James_Dabbs] -passwrd-policy 1333/tcp # Password Policy [Tonio_Pirotta] [Tonio_Pirotta] -passwrd-policy 1333/udp # Password Policy [Tonio_Pirotta] [Tonio_Pirotta] -writesrv 1334/tcp # writesrv [Marvin_Toungate] [Marvin_Toungate] -writesrv 1334/udp # writesrv [Marvin_Toungate] [Marvin_Toungate] -digital-notary 1335/tcp # Digital Notary Protocol [Wes_Doonan] [Wes_Doonan] -digital-notary 1335/udp # Digital Notary Protocol [Wes_Doonan] [Wes_Doonan] -ischat 1336/tcp # Instant Service Chat [Mike_Clise] [Mike_Clise] -ischat 1336/udp # Instant Service Chat [Mike_Clise] [Mike_Clise] -menandmice-dns 1337/tcp # menandmice DNS [Sigfus_Magnusson] [Sigfus_Magnusson] -menandmice-dns 1337/udp # menandmice DNS [Sigfus_Magnusson] [Sigfus_Magnusson] -wmc-log-svc 1338/tcp # WMC-log-svr [Scott_Anderson] [Scott_Anderson] -wmc-log-svc 1338/udp # WMC-log-svr [Scott_Anderson] [Scott_Anderson] -kjtsiteserver 1339/tcp # kjtsiteserver [Jason_Aubain] [Jason_Aubain] -kjtsiteserver 1339/udp # kjtsiteserver [Jason_Aubain] [Jason_Aubain] -naap 1340/tcp # NAAP [Henry_Haverinen] [Henry_Haverinen] -naap 1340/udp # NAAP [Henry_Haverinen] [Henry_Haverinen] -qubes 1341/tcp # QuBES [Eric_Grange] [Eric_Grange] -qubes 1341/udp # QuBES [Eric_Grange] [Eric_Grange] -esbroker 1342/tcp # ESBroker [Alexander_Medvinsky] [Alexander_Medvinsky] -esbroker 1342/udp # ESBroker [Alexander_Medvinsky] [Alexander_Medvinsky] -re101 1343/tcp # re101 [Doriano_Blengino] [Doriano_Blengino] -re101 1343/udp # re101 [Doriano_Blengino] [Doriano_Blengino] -icap 1344/tcp # ICAP [Jeremy_Elson] [Jeremy_Elson] -icap 1344/udp # ICAP [Jeremy_Elson] [Jeremy_Elson] -vpjp 1345/tcp # VPJP [Michael_Collins] [Michael_Collins] -vpjp 1345/udp # VPJP [Michael_Collins] [Michael_Collins] -alta-ana-lm 1346/tcp # Alta Analytics License -# Manager -alta-ana-lm 1346/udp # Alta Analytics License -# Manager -bbn-mmc 1347/tcp # multi media conferencing -bbn-mmc 1347/udp # multi media conferencing -bbn-mmx 1348/tcp # multi media conferencing -bbn-mmx 1348/udp # multi media conferencing -sbook 1349/tcp # Registration Network -# Protocol -sbook 1349/udp # Registration Network -# Protocol -editbench 1350/tcp # Registration Network [Simson_L_Garfinkel] [Simson_L_Garfinkel] -# Protocol -editbench 1350/udp # Registration Network [Simson_L_Garfinkel] [Simson_L_Garfinkel] -# Protocol -equationbuilder 1351/tcp # Digital Tool Works (MIT) [Terrence_J_Talbot] [Terrence_J_Talbot] -equationbuilder 1351/udp # Digital Tool Works (MIT) [Terrence_J_Talbot] [Terrence_J_Talbot] -lotusnote 1352/tcp # Lotus Note [Greg_Pflaum] [Greg_Pflaum] 1992-07 -lotusnote 1352/udp # Lotus Note [Greg_Pflaum] [Greg_Pflaum] 1992-07 -relief 1353/tcp # Relief Consulting [John_Feiler] [John_Feiler] -relief 1353/udp # Relief Consulting [John_Feiler] [John_Feiler] -XSIP-network 1354/tcp # Five Across XSIP Network [Glenn_Reid] [Glenn_Reid] -XSIP-network 1354/udp # Five Across XSIP Network [Glenn_Reid] [Glenn_Reid] -intuitive-edge 1355/tcp # Intuitive Edge [Montgomery_Zukowski] [Montgomery_Zukowski] -intuitive-edge 1355/udp # Intuitive Edge [Montgomery_Zukowski] [Montgomery_Zukowski] -cuillamartin 1356/tcp # CuillaMartin Company -cuillamartin 1356/udp # CuillaMartin Company -pegboard 1357/tcp # Electronic PegBoard [Chris_Cuilla] [Chris_Cuilla] -pegboard 1357/udp # Electronic PegBoard [Chris_Cuilla] [Chris_Cuilla] -connlcli 1358/tcp # CONNLCLI -connlcli 1358/udp # CONNLCLI -ftsrv 1359/tcp # FTSRV [Ines_Homem_de_Melo] [Ines_Homem_de_Melo] -ftsrv 1359/udp # FTSRV [Ines_Homem_de_Melo] [Ines_Homem_de_Melo] -mimer 1360/tcp # MIMER [Per_Schroeder] [Per_Schroeder] -mimer 1360/udp # MIMER [Per_Schroeder] [Per_Schroeder] -linx 1361/tcp # LinX [Steffen_Schilke] [Steffen_Schilke] -linx 1361/udp # LinX [Steffen_Schilke] [Steffen_Schilke] -timeflies 1362/tcp # TimeFlies [Doug_Kent] [Doug_Kent] -timeflies 1362/udp # TimeFlies [Doug_Kent] [Doug_Kent] -ndm-requester 1363/tcp # Network DataMover Requester -ndm-requester 1363/udp # Network DataMover Requester -ndm-server 1364/tcp # Network DataMover Server [Toshio_Watanabe] [Toshio_Watanabe] -ndm-server 1364/udp # Network DataMover Server [Toshio_Watanabe] [Toshio_Watanabe] -adapt-sna 1365/tcp # Network Software Associates [Jeffery_Chiao] [Jeffery_Chiao] -adapt-sna 1365/udp # Network Software Associates [Jeffery_Chiao] [Jeffery_Chiao] -netware-csp 1366/tcp # Novell NetWare Comm Service [Laurie_Lindsey] [Laurie_Lindsey] -# Platform -netware-csp 1366/udp # Novell NetWare Comm Service [Laurie_Lindsey] [Laurie_Lindsey] -# Platform -dcs 1367/tcp # DCS [Stefan_Siebert] [Stefan_Siebert] -dcs 1367/udp # DCS [Stefan_Siebert] [Stefan_Siebert] -screencast 1368/tcp # ScreenCast [Bill_Tschumy] [Bill_Tschumy] -screencast 1368/udp # ScreenCast [Bill_Tschumy] [Bill_Tschumy] -gv-us 1369/tcp # GlobalView to Unix Shell -gv-us 1369/udp # GlobalView to Unix Shell -us-gv 1370/tcp # Unix Shell to GlobalView [Makoto_Mita] [Makoto_Mita] -us-gv 1370/udp # Unix Shell to GlobalView [Makoto_Mita] [Makoto_Mita] -fc-cli 1371/tcp # Fujitsu Config Protocol -fc-cli 1371/udp # Fujitsu Config Protocol -fc-ser 1372/tcp # Fujitsu Config Protocol [Ryuichi_Horie] [Ryuichi_Horie] -fc-ser 1372/udp # Fujitsu Config Protocol [Ryuichi_Horie] [Ryuichi_Horie] -chromagrafx 1373/tcp # Chromagrafx [Mike_Barthelemy] [Mike_Barthelemy] -chromagrafx 1373/udp # Chromagrafx [Mike_Barthelemy] [Mike_Barthelemy] -molly 1374/tcp # EPI Software Systems [Jim_Vlcek] [Jim_Vlcek] -molly 1374/udp # EPI Software Systems [Jim_Vlcek] [Jim_Vlcek] -bytex 1375/tcp # Bytex [Mary_Ann_Burt] [Mary_Ann_Burt] -bytex 1375/udp # Bytex [Mary_Ann_Burt] [Mary_Ann_Burt] -ibm-pps 1376/tcp # IBM Person to Person [Simon_Phipps] [Simon_Phipps] -# Software -ibm-pps 1376/udp # IBM Person to Person [Simon_Phipps] [Simon_Phipps] -# Software -cichlid 1377/tcp # Cichlid License Manager [Andy_Burgess] [Andy_Burgess] -cichlid 1377/udp # Cichlid License Manager [Andy_Burgess] [Andy_Burgess] -elan 1378/tcp # Elan License Manager [Ken_Greer] [Ken_Greer] -elan 1378/udp # Elan License Manager [Ken_Greer] [Ken_Greer] -dbreporter 1379/tcp # Integrity Solutions [Tim_Dawson] [Tim_Dawson] -dbreporter 1379/udp # Integrity Solutions [Tim_Dawson] [Tim_Dawson] -telesis-licman 1380/tcp # Telesis Network License [Karl_Schendel_Jr] [Karl_Schendel_Jr] -# Manager -telesis-licman 1380/udp # Telesis Network License [Karl_Schendel_Jr] [Karl_Schendel_Jr] -# Manager -apple-licman 1381/tcp # Apple Network License [Earl_Wallace] [Earl_Wallace] -# Manager -apple-licman 1381/udp # Apple Network License [Earl_Wallace] [Earl_Wallace] -# Manager -# udt_os -# -udt-os 1382/tcp # IANA assigned this -# well-formed service name as -# a replacement for "udt_os". -# This entry is an alias to "udt-os". This entry is now -udt_os 1382/tcp # udt_os historic, not usable for use with many common service -# discovery mechanisms. -# udt_os -# -udt-os 1382/udp # IANA assigned this -# well-formed service name as -# a replacement for "udt_os". -# This entry is an alias to "udt-os". This entry is now -udt_os 1382/udp # udt_os historic, not usable for use with many common service -# discovery mechanisms. -gwha 1383/tcp # GW Hannaway Network License [J_Gabriel_Foster] [J_Gabriel_Foster] -# Manager -gwha 1383/udp # GW Hannaway Network License [J_Gabriel_Foster] [J_Gabriel_Foster] -# Manager -os-licman 1384/tcp # Objective Solutions License [Donald_Cornwell] [Donald_Cornwell] -# Manager -os-licman 1384/udp # Objective Solutions License [Donald_Cornwell] [Donald_Cornwell] -# Manager -# Atex Publishing License -# Manager -# -atex-elmd 1385/tcp # IANA assigned this [Brett_Sorenson] [Brett_Sorenson] -# well-formed service name as -# a replacement for -# "atex_elmd". -# Atex Publishing License This entry is an alias to "atex-elmd". This entry is now -atex_elmd 1385/tcp # Manager [Brett_Sorenson] [Brett_Sorenson] historic, not usable for use with many common service -# discovery mechanisms. -# Atex Publishing License -# Manager -# -atex-elmd 1385/udp # IANA assigned this [Brett_Sorenson] [Brett_Sorenson] -# well-formed service name as -# a replacement for -# "atex_elmd". -# Atex Publishing License This entry is an alias to "atex-elmd". This entry is now -atex_elmd 1385/udp # Manager [Brett_Sorenson] [Brett_Sorenson] historic, not usable for use with many common service -# discovery mechanisms. -checksum 1386/tcp # CheckSum License Manager [Andreas_Glocker] [Andreas_Glocker] -checksum 1386/udp # CheckSum License Manager [Andreas_Glocker] [Andreas_Glocker] -cadsi-lm 1387/tcp # Computer Aided Design [Sulistio_Muljadi] [Sulistio_Muljadi] -# Software Inc LM -cadsi-lm 1387/udp # Computer Aided Design [Sulistio_Muljadi] [Sulistio_Muljadi] -# Software Inc LM -objective-dbc 1388/tcp # Objective Solutions DataBase [Donald_Cornwell_2] [Donald_Cornwell_2] -# Cache -objective-dbc 1388/udp # Objective Solutions DataBase [Donald_Cornwell_2] [Donald_Cornwell_2] -# Cache -iclpv-dm 1389/tcp # Document Manager -iclpv-dm 1389/udp # Document Manager -iclpv-sc 1390/tcp # Storage Controller -iclpv-sc 1390/udp # Storage Controller -iclpv-sas 1391/tcp # Storage Access Server -iclpv-sas 1391/udp # Storage Access Server -iclpv-pm 1392/tcp # Print Manager -iclpv-pm 1392/udp # Print Manager -iclpv-nls 1393/tcp # Network Log Server -iclpv-nls 1393/udp # Network Log Server -iclpv-nlc 1394/tcp # Network Log Client -iclpv-nlc 1394/udp # Network Log Client -iclpv-wsm 1395/tcp # PC Workstation Manager [A_P_Hobson] [A_P_Hobson] -# software -iclpv-wsm 1395/udp # PC Workstation Manager [A_P_Hobson] [A_P_Hobson] -# software -dvl-activemail 1396/tcp # DVL Active Mail -dvl-activemail 1396/udp # DVL Active Mail -audio-activmail 1397/tcp # Audio Active Mail -audio-activmail 1397/udp # Audio Active Mail -video-activmail 1398/tcp # Video Active Mail [Avshalom_Houri] [Avshalom_Houri] -video-activmail 1398/udp # Video Active Mail [Avshalom_Houri] [Avshalom_Houri] -cadkey-licman 1399/tcp # Cadkey License Manager -cadkey-licman 1399/udp # Cadkey License Manager -cadkey-tablet 1400/tcp # Cadkey Tablet Daemon [Joe_McCollough] [Joe_McCollough] -cadkey-tablet 1400/udp # Cadkey Tablet Daemon [Joe_McCollough] [Joe_McCollough] -goldleaf-licman 1401/tcp # Goldleaf License Manager [John_Fox] [John_Fox] -goldleaf-licman 1401/udp # Goldleaf License Manager [John_Fox] [John_Fox] -prm-sm-np 1402/tcp # Prospero Resource Manager -prm-sm-np 1402/udp # Prospero Resource Manager -prm-nm-np 1403/tcp # Prospero Resource Manager [B_Clifford_Neuman] [B_Clifford_Neuman] -prm-nm-np 1403/udp # Prospero Resource Manager [B_Clifford_Neuman] [B_Clifford_Neuman] -igi-lm 1404/tcp # Infinite Graphics License -# Manager -igi-lm 1404/udp # Infinite Graphics License -# Manager -ibm-res 1405/tcp # IBM Remote Execution Starter -ibm-res 1405/udp # IBM Remote Execution Starter -netlabs-lm 1406/tcp # NetLabs License Manager -netlabs-lm 1406/udp # NetLabs License Manager -tibet-server 1407/tcp # TIBET Data Server [Technical_Pursuit_Inc] [Scott_Shattuck] 2015-06-16 This port has been retasked on 2015-06-16. -# 1407 udp Reserved This port has been removed on 2015-06-16. -sophia-lm 1408/tcp # Sophia License Manager [Eric_Brown] [Eric_Brown] -sophia-lm 1408/udp # Sophia License Manager [Eric_Brown] [Eric_Brown] -here-lm 1409/tcp # Here License Manager [David_Ison] [David_Ison] -here-lm 1409/udp # Here License Manager [David_Ison] [David_Ison] -hiq 1410/tcp # HiQ License Manager [Rick_Pugh] [Rick_Pugh] -hiq 1410/udp # HiQ License Manager [Rick_Pugh] [Rick_Pugh] -af 1411/tcp # AudioFile [Jim_Gettys] [Jim_Gettys] -af 1411/udp # AudioFile [Jim_Gettys] [Jim_Gettys] -innosys 1412/tcp # InnoSys -innosys 1412/udp # InnoSys -innosys-acl 1413/tcp # Innosys-ACL [Eric_Welch] [Eric_Welch] -innosys-acl 1413/udp # Innosys-ACL [Eric_Welch] [Eric_Welch] -ibm-mqseries 1414/tcp # IBM MQSeries [Roger_Meli] [Roger_Meli] -ibm-mqseries 1414/udp # IBM MQSeries [Roger_Meli] [Roger_Meli] -dbstar 1415/tcp # DBStar [Jeffrey_Millman] [Jeffrey_Millman] -dbstar 1415/udp # DBStar [Jeffrey_Millman] [Jeffrey_Millman] -# Novell LU6.2 -# -novell-lu6-2 1416/tcp # IANA assigned this [Peter_Liu] [Peter_Liu] -# well-formed service name as -# a replacement for -# "novell-lu6.2". -# This entry is an alias to "novell-lu6-2". This entry is now -novell-lu6.2 1416/tcp # Novell LU6.2 [Peter_Liu] [Peter_Liu] historic, not usable for use with many common service -# discovery mechanisms. -# Novell LU6.2 -# -novell-lu6-2 1416/udp # IANA assigned this [Peter_Liu] [Peter_Liu] -# well-formed service name as -# a replacement for -# "novell-lu6.2". -# This entry is an alias to "novell-lu6-2". This entry is now -novell-lu6.2 1416/udp # Novell LU6.2 [Peter_Liu] [Peter_Liu] historic, not usable for use with many common service -# discovery mechanisms. -timbuktu-srv1 1417/tcp # Timbuktu Service 1 Port -timbuktu-srv1 1417/udp # Timbuktu Service 1 Port -timbuktu-srv2 1418/tcp # Timbuktu Service 2 Port -timbuktu-srv2 1418/udp # Timbuktu Service 2 Port -timbuktu-srv3 1419/tcp # Timbuktu Service 3 Port -timbuktu-srv3 1419/udp # Timbuktu Service 3 Port -timbuktu-srv4 1420/tcp # Timbuktu Service 4 Port [Marc_Epard] [Marc_Epard] -timbuktu-srv4 1420/udp # Timbuktu Service 4 Port [Marc_Epard] [Marc_Epard] -gandalf-lm 1421/tcp # Gandalf License Manager [gilmer] [gilmer] -gandalf-lm 1421/udp # Gandalf License Manager [gilmer] [gilmer] -autodesk-lm 1422/tcp # Autodesk License Manager [David_Ko] [David_Ko] -autodesk-lm 1422/udp # Autodesk License Manager [David_Ko] [David_Ko] -essbase 1423/tcp # Essbase Arbor Software -essbase 1423/udp # Essbase Arbor Software -hybrid 1424/tcp # Hybrid Encryption Protocol [Howard_Hart] [Howard_Hart] -hybrid 1424/udp # Hybrid Encryption Protocol [Howard_Hart] [Howard_Hart] -zion-lm 1425/tcp # Zion Software License [David_Ferrero] [David_Ferrero] -# Manager -zion-lm 1425/udp # Zion Software License [David_Ferrero] [David_Ferrero] -# Manager -sais 1426/tcp # Satellite-data Acquisition [Bill_Taylor] [Bill_Taylor] -# System 1 -sais 1426/udp # Satellite-data Acquisition [Bill_Taylor] [Bill_Taylor] -# System 1 -mloadd 1427/tcp # mloadd monitoring tool [Bob_Braden_2] [Bob_Braden_2] -mloadd 1427/udp # mloadd monitoring tool [Bob_Braden_2] [Bob_Braden_2] -informatik-lm 1428/tcp # Informatik License Manager [Harald_Schlangmann] [Harald_Schlangmann] -informatik-lm 1428/udp # Informatik License Manager [Harald_Schlangmann] [Harald_Schlangmann] -nms 1429/tcp # Hypercom NMS -nms 1429/udp # Hypercom NMS -tpdu 1430/tcp # Hypercom TPDU [Noor_Chowdhury] [Noor_Chowdhury] -tpdu 1430/udp # Hypercom TPDU [Noor_Chowdhury] [Noor_Chowdhury] -rgtp 1431/tcp # Reverse Gossip Transport [Ian_Jackson] [Ian_Jackson] -rgtp 1431/udp # Reverse Gossip Transport [Ian_Jackson] [Ian_Jackson] -blueberry-lm 1432/tcp # Blueberry Software License [Steve_Beigel] [Steve_Beigel] -# Manager -blueberry-lm 1432/udp # Blueberry Software License [Steve_Beigel] [Steve_Beigel] -# Manager -ms-sql-s 1433/tcp # Microsoft-SQL-Server -ms-sql-s 1433/udp # Microsoft-SQL-Server -ms-sql-m 1434/tcp # Microsoft-SQL-Monitor [Peter_Hussey] [Peter_Hussey] -ms-sql-m 1434/udp # Microsoft-SQL-Monitor [Peter_Hussey] [Peter_Hussey] -ibm-cics 1435/tcp # IBM CICS [Geoff_Meacock] [Geoff_Meacock] -ibm-cics 1435/udp # IBM CICS [Geoff_Meacock] [Geoff_Meacock] -saism 1436/tcp # Satellite-data Acquisition [Bill_Taylor] [Bill_Taylor] -# System 2 -saism 1436/udp # Satellite-data Acquisition [Bill_Taylor] [Bill_Taylor] -# System 2 -tabula 1437/tcp # Tabula [Marcelo_Einhorn] [Marcelo_Einhorn] -tabula 1437/udp # Tabula [Marcelo_Einhorn] [Marcelo_Einhorn] -eicon-server 1438/tcp # Eicon Security Agent/Server -eicon-server 1438/udp # Eicon Security Agent/Server -eicon-x25 1439/tcp # Eicon X25/SNA Gateway -eicon-x25 1439/udp # Eicon X25/SNA Gateway -eicon-slp 1440/tcp # Eicon Service Location [Pat_Calhoun] [Pat_Calhoun] -# Protocol -eicon-slp 1440/udp # Eicon Service Location [Pat_Calhoun] [Pat_Calhoun] -# Protocol -cadis-1 1441/tcp # Cadis License Management -cadis-1 1441/udp # Cadis License Management -cadis-2 1442/tcp # Cadis License Management [Todd_Wichers] [Todd_Wichers] -cadis-2 1442/udp # Cadis License Management [Todd_Wichers] [Todd_Wichers] -ies-lm 1443/tcp # Integrated Engineering [David_Tong] [David_Tong] -# Software -ies-lm 1443/udp # Integrated Engineering [David_Tong] [David_Tong] -# Software -marcam-lm 1444/tcp # Marcam License Management [Therese_Hunt] [Therese_Hunt] -marcam-lm 1444/udp # Marcam License Management [Therese_Hunt] [Therese_Hunt] -proxima-lm 1445/tcp # Proxima License Manager -proxima-lm 1445/udp # Proxima License Manager -ora-lm 1446/tcp # Optical Research Associates -# License Manager -ora-lm 1446/udp # Optical Research Associates -# License Manager -apri-lm 1447/tcp # Applied Parallel Research LM [Jim_Dillon] [Jim_Dillon] -apri-lm 1447/udp # Applied Parallel Research LM [Jim_Dillon] [Jim_Dillon] -oc-lm 1448/tcp # OpenConnect License Manager [Sue_Barnhill] [Sue_Barnhill] -oc-lm 1448/udp # OpenConnect License Manager [Sue_Barnhill] [Sue_Barnhill] -peport 1449/tcp # PEport [Qentin_Neill] [Qentin_Neill] -peport 1449/udp # PEport [Qentin_Neill] [Qentin_Neill] -dwf 1450/tcp # Tandem Distributed Workbench [Mike_Bert] [Mike_Bert] -# Facility -dwf 1450/udp # Tandem Distributed Workbench [Mike_Bert] [Mike_Bert] -# Facility -infoman 1451/tcp # IBM Information Management [Karen_Burns] [Karen_Burns] -infoman 1451/udp # IBM Information Management [Karen_Burns] [Karen_Burns] -gtegsc-lm 1452/tcp # GTE Government Systems [Mike_Gregory] [Mike_Gregory] -# License Man -gtegsc-lm 1452/udp # GTE Government Systems [Mike_Gregory] [Mike_Gregory] -# License Man -genie-lm 1453/tcp # Genie License Manager [Paul_Applegate] [Paul_Applegate] -genie-lm 1453/udp # Genie License Manager [Paul_Applegate] [Paul_Applegate] -# interHDL License Manager -# -interhdl-elmd 1454/tcp # IANA assigned this [Eli_Sternheim] [Eli_Sternheim] -# well-formed service name as -# a replacement for -# "interhdl_elmd". -# This entry is an alias to "interhdl-elmd". This entry is now -interhdl_elmd 1454/tcp # interHDL License Manager [Eli_Sternheim] [Eli_Sternheim] historic, not usable for use with many common service -# discovery mechanisms. -# interHDL License Manager -# -interhdl-elmd 1454/udp # IANA assigned this [Eli_Sternheim] [Eli_Sternheim] -# well-formed service name as -# a replacement for -# "interhdl_elmd". -# This entry is an alias to "interhdl-elmd". This entry is now -interhdl_elmd 1454/udp # interHDL License Manager [Eli_Sternheim] [Eli_Sternheim] historic, not usable for use with many common service -# discovery mechanisms. -esl-lm 1455/tcp # ESL License Manager [Abel_Chou] [Abel_Chou] -esl-lm 1455/udp # ESL License Manager [Abel_Chou] [Abel_Chou] -dca 1456/tcp # DCA [Jeff_Garbers_2] [Jeff_Garbers_2] -dca 1456/udp # DCA [Jeff_Garbers_2] [Jeff_Garbers_2] -valisys-lm 1457/tcp # Valisys License Manager [Leslie_Lincoln] [Leslie_Lincoln] -valisys-lm 1457/udp # Valisys License Manager [Leslie_Lincoln] [Leslie_Lincoln] -nrcabq-lm 1458/tcp # Nichols Research Corp. [Howard_Cole] [Howard_Cole] -nrcabq-lm 1458/udp # Nichols Research Corp. [Howard_Cole] [Howard_Cole] -proshare1 1459/tcp # Proshare Notebook -# Application -proshare1 1459/udp # Proshare Notebook -# Application -proshare2 1460/tcp # Proshare Notebook [Robin_Kar] [Robin_Kar] -# Application -proshare2 1460/udp # Proshare Notebook [Robin_Kar] [Robin_Kar] -# Application -# IBM Wireless LAN -# -ibm-wrless-lan 1461/tcp # IANA assigned this [flanne] [flanne] -# well-formed service name as -# a replacement for -# "ibm_wrless_lan". -# This entry is an alias to "ibm-wrless-lan". This entry is now -ibm_wrless_lan 1461/tcp # IBM Wireless LAN [flanne] [flanne] historic, not usable for use with many common service -# discovery mechanisms. -# IBM Wireless LAN -# -ibm-wrless-lan 1461/udp # IANA assigned this [flanne] [flanne] -# well-formed service name as -# a replacement for -# "ibm_wrless_lan". -# This entry is an alias to "ibm-wrless-lan". This entry is now -ibm_wrless_lan 1461/udp # IBM Wireless LAN [flanne] [flanne] historic, not usable for use with many common service -# discovery mechanisms. -world-lm 1462/tcp # World License Manager [Michael_S_Amirault] [Michael_S_Amirault] -world-lm 1462/udp # World License Manager [Michael_S_Amirault] [Michael_S_Amirault] -nucleus 1463/tcp # Nucleus [Venky_Nagar] [Venky_Nagar] -nucleus 1463/udp # Nucleus [Venky_Nagar] [Venky_Nagar] -# MSL License Manager -# -msl-lmd 1464/tcp # IANA assigned this [Matt_Timmermans] [Matt_Timmermans] -# well-formed service name as -# a replacement for "msl_lmd". -# This entry is an alias to "msl-lmd". This entry is now -msl_lmd 1464/tcp # MSL License Manager [Matt_Timmermans] [Matt_Timmermans] historic, not usable for use with many common service -# discovery mechanisms. -# MSL License Manager -# -msl-lmd 1464/udp # IANA assigned this [Matt_Timmermans] [Matt_Timmermans] -# well-formed service name as -# a replacement for "msl_lmd". -# This entry is an alias to "msl-lmd". This entry is now -msl_lmd 1464/udp # MSL License Manager [Matt_Timmermans] [Matt_Timmermans] historic, not usable for use with many common service -# discovery mechanisms. -pipes 1465/tcp # Pipes Platform [Mark_Farlin] [Mark_Farlin] -pipes 1465/udp # Pipes Platform [Mark_Farlin] [Mark_Farlin] -oceansoft-lm 1466/tcp # Ocean Software License [Randy_Leonard] [Randy_Leonard] -# Manager -oceansoft-lm 1466/udp # Ocean Software License [Randy_Leonard] [Randy_Leonard] -# Manager -csdmbase 1467/tcp # CSDMBASE -csdmbase 1467/udp # CSDMBASE -csdm 1468/tcp # CSDM [Robert_Stabl] [Robert_Stabl] -csdm 1468/udp # CSDM [Robert_Stabl] [Robert_Stabl] -aal-lm 1469/tcp # Active Analysis Limited [David_Snocken] [David_Snocken] -# License Manager -aal-lm 1469/udp # Active Analysis Limited [David_Snocken] [David_Snocken] -# License Manager -uaiact 1470/tcp # Universal Analytics [Mark_R_Ludwig] [Mark_R_Ludwig] -uaiact 1470/udp # Universal Analytics [Mark_R_Ludwig] [Mark_R_Ludwig] -csdmbase 1471/tcp # csdmbase -csdmbase 1471/udp # csdmbase -csdm 1472/tcp # csdm [Robert_Stabl] [Robert_Stabl] -csdm 1472/udp # csdm [Robert_Stabl] [Robert_Stabl] -openmath 1473/tcp # OpenMath [Garth_Mayville] [Garth_Mayville] -openmath 1473/udp # OpenMath [Garth_Mayville] [Garth_Mayville] -telefinder 1474/tcp # Telefinder [Jim_White] [Jim_White] -telefinder 1474/udp # Telefinder [Jim_White] [Jim_White] -taligent-lm 1475/tcp # Taligent License Manager [Mark_Sapsford] [Mark_Sapsford] -taligent-lm 1475/udp # Taligent License Manager [Mark_Sapsford] [Mark_Sapsford] -clvm-cfg 1476/tcp # clvm-cfg [Eric_Soderberg] [Eric_Soderberg] -clvm-cfg 1476/udp # clvm-cfg [Eric_Soderberg] [Eric_Soderberg] -ms-sna-server 1477/tcp # ms-sna-server -ms-sna-server 1477/udp # ms-sna-server -ms-sna-base 1478/tcp # ms-sna-base [Gordon_Mangione] [Gordon_Mangione] -ms-sna-base 1478/udp # ms-sna-base [Gordon_Mangione] [Gordon_Mangione] -dberegister 1479/tcp # dberegister [Brian_Griswold] [Brian_Griswold] -dberegister 1479/udp # dberegister [Brian_Griswold] [Brian_Griswold] -pacerforum 1480/tcp # PacerForum [Peter_Caswell] [Peter_Caswell] -pacerforum 1480/udp # PacerForum [Peter_Caswell] [Peter_Caswell] -airs 1481/tcp # AIRS [Bruce_Wilson] [Bruce_Wilson] -airs 1481/udp # AIRS [Bruce_Wilson] [Bruce_Wilson] -miteksys-lm 1482/tcp # Miteksys License Manager [Shane_McRoberts] [Shane_McRoberts] -miteksys-lm 1482/udp # Miteksys License Manager [Shane_McRoberts] [Shane_McRoberts] -afs 1483/tcp # AFS License Manager [Michael_R_Pizolato] [Michael_R_Pizolato] -afs 1483/udp # AFS License Manager [Michael_R_Pizolato] [Michael_R_Pizolato] -confluent 1484/tcp # Confluent License Manager [James_Greenfiel] [James_Greenfiel] -confluent 1484/udp # Confluent License Manager [James_Greenfiel] [James_Greenfiel] -lansource 1485/tcp # LANSource [Christopher_Wells] [Christopher_Wells] -lansource 1485/udp # LANSource [Christopher_Wells] [Christopher_Wells] -# nms_topo_serv -# -nms-topo-serv 1486/tcp # IANA assigned this [Sylvia_Siu] [Sylvia_Siu] -# well-formed service name as -# a replacement for -# "nms_topo_serv". -# This entry is an alias to "nms-topo-serv". This entry is now -nms_topo_serv 1486/tcp # nms_topo_serv [Sylvia_Siu] [Sylvia_Siu] historic, not usable for use with many common service -# discovery mechanisms. -# nms_topo_serv -# -nms-topo-serv 1486/udp # IANA assigned this [Sylvia_Siu] [Sylvia_Siu] -# well-formed service name as -# a replacement for -# "nms_topo_serv". -# This entry is an alias to "nms-topo-serv". This entry is now -nms_topo_serv 1486/udp # nms_topo_serv [Sylvia_Siu] [Sylvia_Siu] historic, not usable for use with many common service -# discovery mechanisms. -localinfosrvr 1487/tcp # LocalInfoSrvr [Brian_Matthews_2] [Brian_Matthews_2] -localinfosrvr 1487/udp # LocalInfoSrvr [Brian_Matthews_2] [Brian_Matthews_2] -docstor 1488/tcp # DocStor [Brian_Spears] [Brian_Spears] -docstor 1488/udp # DocStor [Brian_Spears] [Brian_Spears] -dmdocbroker 1489/tcp # dmdocbroker [Razmik_Abnous] [Razmik_Abnous] -dmdocbroker 1489/udp # dmdocbroker [Razmik_Abnous] [Razmik_Abnous] -insitu-conf 1490/tcp # insitu-conf [Paul_Blacknell] [Paul_Blacknell] -insitu-conf 1490/udp # insitu-conf [Paul_Blacknell] [Paul_Blacknell] -# Unauthorized -# 1491 Unassigned 2009-08-05 Use Known on -# port 1491 -stone-design-1 1492/tcp # stone-design-1 [Andrew_Stone] [Andrew_Stone] -stone-design-1 1492/udp # stone-design-1 [Andrew_Stone] [Andrew_Stone] -# netmap_lm -# -netmap-lm 1493/tcp # IANA assigned this [Phillip_Magson] [Phillip_Magson] -# well-formed service name as -# a replacement for -# "netmap_lm". -# This entry is an alias to "netmap-lm". This entry is now -netmap_lm 1493/tcp # netmap_lm [Phillip_Magson] [Phillip_Magson] historic, not usable for use with many common service -# discovery mechanisms. -# netmap_lm -# -netmap-lm 1493/udp # IANA assigned this [Phillip_Magson] [Phillip_Magson] -# well-formed service name as -# a replacement for -# "netmap_lm". -# This entry is an alias to "netmap-lm". This entry is now -netmap_lm 1493/udp # netmap_lm [Phillip_Magson] [Phillip_Magson] historic, not usable for use with many common service -# discovery mechanisms. -ica 1494/tcp # ica [John_Richardson] [John_Richardson] -ica 1494/udp # ica [John_Richardson] [John_Richardson] -cvc 1495/tcp # cvc [Bill_Davidson] [Bill_Davidson] -cvc 1495/udp # cvc [Bill_Davidson] [Bill_Davidson] -liberty-lm 1496/tcp # liberty-lm [Jim_Rogers] [Jim_Rogers] -liberty-lm 1496/udp # liberty-lm [Jim_Rogers] [Jim_Rogers] -rfx-lm 1497/tcp # rfx-lm [Bill_Bishop] [Bill_Bishop] -rfx-lm 1497/udp # rfx-lm [Bill_Bishop] [Bill_Bishop] -sybase-sqlany 1498/tcp # Sybase SQL Any [Dave_Neudoerffer] [Dave_Neudoerffer] -sybase-sqlany 1498/udp # Sybase SQL Any [Dave_Neudoerffer] [Dave_Neudoerffer] -fhc 1499/tcp # Federico Heinz Consultora [Federico_Heinz] [Federico_Heinz] -fhc 1499/udp # Federico Heinz Consultora [Federico_Heinz] [Federico_Heinz] -vlsi-lm 1500/tcp # VLSI License Manager [Shue_Lin_Kuo] [Shue_Lin_Kuo] -vlsi-lm 1500/udp # VLSI License Manager [Shue_Lin_Kuo] [Shue_Lin_Kuo] -saiscm 1501/tcp # Satellite-data Acquisition [Bill_Taylor] [Bill_Taylor] -# System 3 -saiscm 1501/udp # Satellite-data Acquisition [Bill_Taylor] [Bill_Taylor] -# System 3 -shivadiscovery 1502/tcp # Shiva [Jonathan_Wenocur] [Jonathan_Wenocur] -shivadiscovery 1502/udp # Shiva [Jonathan_Wenocur] [Jonathan_Wenocur] -imtc-mcs 1503/tcp # Databeam [Jim_Johnston] [Jim_Johnston] -imtc-mcs 1503/udp # Databeam [Jim_Johnston] [Jim_Johnston] -evb-elm 1504/tcp # EVB Software Engineering [B_G_Mahesh] [B_G_Mahesh] -# License Manager -evb-elm 1504/udp # EVB Software Engineering [B_G_Mahesh] [B_G_Mahesh] -# License Manager -funkproxy 1505/tcp # Funk Software, Inc. [Robert_D_Vincent] [Robert_D_Vincent] -funkproxy 1505/udp # Funk Software, Inc. [Robert_D_Vincent] [Robert_D_Vincent] -utcd 1506/tcp # Universal Time daemon (utcd) [Walter_Poxon] [Walter_Poxon] -utcd 1506/udp # Universal Time daemon (utcd) [Walter_Poxon] [Walter_Poxon] -symplex 1507/tcp # symplex [Mike_Turley] [Mike_Turley] -symplex 1507/udp # symplex [Mike_Turley] [Mike_Turley] -diagmond 1508/tcp # diagmond [Pete_Moscatelli] [Pete_Moscatelli] -diagmond 1508/udp # diagmond [Pete_Moscatelli] [Pete_Moscatelli] -robcad-lm 1509/tcp # Robcad, Ltd. License Manager [Hindin_Joseph] [Hindin_Joseph] -robcad-lm 1509/udp # Robcad, Ltd. License Manager [Hindin_Joseph] [Hindin_Joseph] -mvx-lm 1510/tcp # Midland Valley Exploration [Neil_Salter] [Neil_Salter] -# Ltd. Lic. Man. -mvx-lm 1510/udp # Midland Valley Exploration [Neil_Salter] [Neil_Salter] -# Ltd. Lic. Man. -3l-l1 1511/tcp # 3l-l1 [Ian_A_Young] [Ian_A_Young] -3l-l1 1511/udp # 3l-l1 [Ian_A_Young] [Ian_A_Young] -wins 1512/tcp # Microsoft's Windows Internet [Pradeep_Bahl] [Pradeep_Bahl] -# Name Service -wins 1512/udp # Microsoft's Windows Internet [Pradeep_Bahl] [Pradeep_Bahl] -# Name Service -fujitsu-dtc 1513/tcp # Fujitsu Systems Business of -# America, Inc -fujitsu-dtc 1513/udp # Fujitsu Systems Business of -# America, Inc -fujitsu-dtcns 1514/tcp # Fujitsu Systems Business of [Charles_A_Higgins] [Charles_A_Higgins] -# America, Inc -fujitsu-dtcns 1514/udp # Fujitsu Systems Business of [Charles_A_Higgins] [Charles_A_Higgins] -# America, Inc -ifor-protocol 1515/tcp # ifor-protocol [Dr_R_P_Alston] [Dr_R_P_Alston] -ifor-protocol 1515/udp # ifor-protocol [Dr_R_P_Alston] [Dr_R_P_Alston] -vpad 1516/tcp # Virtual Places Audio data -vpad 1516/udp # Virtual Places Audio data -vpac 1517/tcp # Virtual Places Audio control -vpac 1517/udp # Virtual Places Audio control -vpvd 1518/tcp # Virtual Places Video data -vpvd 1518/udp # Virtual Places Video data -vpvc 1519/tcp # Virtual Places Video control [Avshalom_Houri] [Avshalom_Houri] -vpvc 1519/udp # Virtual Places Video control [Avshalom_Houri] [Avshalom_Houri] -atm-zip-office 1520/tcp # atm zip office [Wilson_Kwan] [Wilson_Kwan] -atm-zip-office 1520/udp # atm zip office [Wilson_Kwan] [Wilson_Kwan] -ncube-lm 1521/tcp # nCube License Manager [Maxine_Yuen] [Maxine_Yuen] -ncube-lm 1521/udp # nCube License Manager [Maxine_Yuen] [Maxine_Yuen] -ricardo-lm 1522/tcp # Ricardo North America [Mike_Flemming] [Mike_Flemming] -# License Manager -ricardo-lm 1522/udp # Ricardo North America [Mike_Flemming] [Mike_Flemming] -# License Manager -cichild-lm 1523/tcp # cichild [Andy_Burgess] [Andy_Burgess] -cichild-lm 1523/udp # cichild [Andy_Burgess] [Andy_Burgess] -ingreslock 1524/tcp # ingres -ingreslock 1524/udp # ingres -orasrv 1525/tcp # oracle -orasrv 1525/udp # oracle -prospero-np 1525/tcp # Prospero Directory Service -# non-priv -prospero-np 1525/udp # Prospero Directory Service -# non-priv -pdap-np 1526/tcp # Prospero Data Access Prot [B_Clifford_Neuman] [B_Clifford_Neuman] -# non-priv -pdap-np 1526/udp # Prospero Data Access Prot [B_Clifford_Neuman] [B_Clifford_Neuman] -# non-priv -tlisrv 1527/tcp # oracle -tlisrv 1527/udp # oracle -# 1528 Unassigned 2007-10-04 -coauthor 1529/tcp # oracle -coauthor 1529/udp # oracle -rap-service 1530/tcp # rap-service -rap-service 1530/udp # rap-service -rap-listen 1531/tcp # rap-listen [Phil_Servita] [Phil_Servita] -rap-listen 1531/udp # rap-listen [Phil_Servita] [Phil_Servita] -miroconnect 1532/tcp # miroconnect [Michael_Fischer_2] [Michael_Fischer_2] -miroconnect 1532/udp # miroconnect [Michael_Fischer_2] [Michael_Fischer_2] -virtual-places 1533/tcp # Virtual Places Software [Avshalom_Houri] [Avshalom_Houri] -virtual-places 1533/udp # Virtual Places Software [Avshalom_Houri] [Avshalom_Houri] -micromuse-lm 1534/tcp # micromuse-lm [Adam_Kerrison] [Adam_Kerrison] -micromuse-lm 1534/udp # micromuse-lm [Adam_Kerrison] [Adam_Kerrison] -ampr-info 1535/tcp # ampr-info -ampr-info 1535/udp # ampr-info -ampr-inter 1536/tcp # ampr-inter [Rob_Janssen] [Rob_Janssen] -ampr-inter 1536/udp # ampr-inter [Rob_Janssen] [Rob_Janssen] -sdsc-lm 1537/tcp # isi-lm [Len_Wanger] [Len_Wanger] -sdsc-lm 1537/udp # isi-lm [Len_Wanger] [Len_Wanger] -3ds-lm 1538/tcp # 3ds-lm [Keith_Trummel] [Keith_Trummel] -3ds-lm 1538/udp # 3ds-lm [Keith_Trummel] [Keith_Trummel] -intellistor-lm 1539/tcp # Intellistor License Manager [Ron_Vaughn] [Ron_Vaughn] -intellistor-lm 1539/udp # Intellistor License Manager [Ron_Vaughn] [Ron_Vaughn] -rds 1540/tcp # rds -rds 1540/udp # rds -rds2 1541/tcp # rds2 [Sudhakar_Rajamannar] [Sudhakar_Rajamannar] -rds2 1541/udp # rds2 [Sudhakar_Rajamannar] [Sudhakar_Rajamannar] -gridgen-elmd 1542/tcp # gridgen-elmd [John_R_Chawner] [John_R_Chawner] -gridgen-elmd 1542/udp # gridgen-elmd [John_R_Chawner] [John_R_Chawner] -simba-cs 1543/tcp # simba-cs [Betsy_Alexander] [Betsy_Alexander] -simba-cs 1543/udp # simba-cs [Betsy_Alexander] [Betsy_Alexander] -aspeclmd 1544/tcp # aspeclmd [V_Balaji] [V_Balaji] -aspeclmd 1544/udp # aspeclmd [V_Balaji] [V_Balaji] -vistium-share 1545/tcp # vistium-share [Allison_Carleton] [Allison_Carleton] -vistium-share 1545/udp # vistium-share [Allison_Carleton] [Allison_Carleton] -abbaccuray 1546/tcp # abbaccuray [John_Wendt] [John_Wendt] -abbaccuray 1546/udp # abbaccuray [John_Wendt] [John_Wendt] -laplink 1547/tcp # laplink [Michael_Crawford] [Michael_Crawford] -laplink 1547/udp # laplink [Michael_Crawford] [Michael_Crawford] -axon-lm 1548/tcp # Axon License Manager [Mark_Pearce] [Mark_Pearce] -axon-lm 1548/udp # Axon License Manager [Mark_Pearce] [Mark_Pearce] -shivahose 1549/tcp # Shiva Hose -shivasound 1549/udp # Shiva Sound [Kin_Chan] [Kin_Chan] -3m-image-lm 1550/tcp # Image Storage license [J_C_Canessa] [J_C_Canessa] -# manager 3M Company -3m-image-lm 1550/udp # Image Storage license [J_C_Canessa] [J_C_Canessa] -# manager 3M Company -hecmtl-db 1551/tcp # HECMTL-DB [Maxime_Belanger] [Maxime_Belanger] -hecmtl-db 1551/udp # HECMTL-DB [Maxime_Belanger] [Maxime_Belanger] -pciarray 1552/tcp # pciarray [Ron_Folk] [Ron_Folk] -pciarray 1552/udp # pciarray [Ron_Folk] [Ron_Folk] -sna-cs 1553/tcp # sna-cs [Tony_Sowter] [Tony_Sowter] -sna-cs 1553/udp # sna-cs [Tony_Sowter] [Tony_Sowter] -caci-lm 1554/tcp # CACI Products Company [Erik_Blume] [Erik_Blume] -# License Manager -caci-lm 1554/udp # CACI Products Company [Erik_Blume] [Erik_Blume] -# License Manager -livelan 1555/tcp # livelan [Kaynam_Hedayat] [Kaynam_Hedayat] -livelan 1555/udp # livelan [Kaynam_Hedayat] [Kaynam_Hedayat] -# VERITAS Private Branch -# Exchange -# -veritas-pbx 1556/tcp # IANA assigned this [Stefan_Winkel] [Stefan_Winkel] 2004-04 -# well-formed service name as -# a replacement for -# "veritas_pbx". -# VERITAS Private Branch This entry is an alias to "veritas-pbx". This entry is now -veritas_pbx 1556/tcp # Exchange [Stefan_Winkel] [Stefan_Winkel] 2004-04 historic, not usable for use with many common service -# discovery mechanisms. -# VERITAS Private Branch -# Exchange -# -veritas-pbx 1556/udp # IANA assigned this [Stefan_Winkel] [Stefan_Winkel] 2004-04 -# well-formed service name as -# a replacement for -# "veritas_pbx". -# VERITAS Private Branch This entry is an alias to "veritas-pbx". This entry is now -veritas_pbx 1556/udp # Exchange [Stefan_Winkel] [Stefan_Winkel] 2004-04 historic, not usable for use with many common service -# discovery mechanisms. -arbortext-lm 1557/tcp # ArborText License Manager [David_J_Wilson] [David_J_Wilson] -arbortext-lm 1557/udp # ArborText License Manager [David_J_Wilson] [David_J_Wilson] -xingmpeg 1558/tcp # xingmpeg [Howard_Gordon] [Howard_Gordon] -xingmpeg 1558/udp # xingmpeg [Howard_Gordon] [Howard_Gordon] -web2host 1559/tcp # web2host [Stephen_Johnson] [Stephen_Johnson] -web2host 1559/udp # web2host [Stephen_Johnson] [Stephen_Johnson] -asci-val 1560/tcp # ASCI-RemoteSHADOW [Benjamin_Rosenberg] [Benjamin_Rosenberg] -asci-val 1560/udp # ASCI-RemoteSHADOW [Benjamin_Rosenberg] [Benjamin_Rosenberg] -facilityview 1561/tcp # facilityview [Ed_Green] [Ed_Green] -facilityview 1561/udp # facilityview [Ed_Green] [Ed_Green] -pconnectmgr 1562/tcp # pconnectmgr [Bob_Kaiser] [Bob_Kaiser] -pconnectmgr 1562/udp # pconnectmgr [Bob_Kaiser] [Bob_Kaiser] -cadabra-lm 1563/tcp # Cadabra License Manager [Arthur_Castonguay] [Arthur_Castonguay] -cadabra-lm 1563/udp # Cadabra License Manager [Arthur_Castonguay] [Arthur_Castonguay] -pay-per-view 1564/tcp # Pay-Per-View [Brian_Tung] [Brian_Tung] -pay-per-view 1564/udp # Pay-Per-View [Brian_Tung] [Brian_Tung] -winddlb 1565/tcp # WinDD [Kelly_Sims] [Kelly_Sims] -winddlb 1565/udp # WinDD [Kelly_Sims] [Kelly_Sims] -corelvideo 1566/tcp # CORELVIDEO [Ming_Poon] [Ming_Poon] -corelvideo 1566/udp # CORELVIDEO [Ming_Poon] [Ming_Poon] -jlicelmd 1567/tcp # jlicelmd [Christian_Schormann] [Christian_Schormann] -jlicelmd 1567/udp # jlicelmd [Christian_Schormann] [Christian_Schormann] -tsspmap 1568/tcp # tsspmap [Paul_W_Nelson] [Paul_W_Nelson] -tsspmap 1568/udp # tsspmap [Paul_W_Nelson] [Paul_W_Nelson] -ets 1569/tcp # ets [Carstein_Seeberg] [Carstein_Seeberg] -ets 1569/udp # ets [Carstein_Seeberg] [Carstein_Seeberg] -orbixd 1570/tcp # orbixd [Bridget_Walsh] [Bridget_Walsh] -orbixd 1570/udp # orbixd [Bridget_Walsh] [Bridget_Walsh] -rdb-dbs-disp 1571/tcp # Oracle Remote Data Base [mackin] [mackin] -rdb-dbs-disp 1571/udp # Oracle Remote Data Base [mackin] [mackin] -chip-lm 1572/tcp # Chipcom License Manager -chip-lm 1572/udp # Chipcom License Manager -itscomm-ns 1573/tcp # itscomm-ns [Rich_Thompson] [Rich_Thompson] -itscomm-ns 1573/udp # itscomm-ns [Rich_Thompson] [Rich_Thompson] -mvel-lm 1574/tcp # mvel-lm [David_Bisset] [David_Bisset] -mvel-lm 1574/udp # mvel-lm [David_Bisset] [David_Bisset] -oraclenames 1575/tcp # oraclenames [P_V_Shivkumar] [P_V_Shivkumar] -oraclenames 1575/udp # oraclenames [P_V_Shivkumar] [P_V_Shivkumar] -moldflow-lm 1576/tcp # Moldflow License Manager [Lech_Laskowski] [Lech_Laskowski] -moldflow-lm 1576/udp # Moldflow License Manager [Lech_Laskowski] [Lech_Laskowski] -hypercube-lm 1577/tcp # hypercube-lm [Christopher_McLendon] [Christopher_McLendon] -hypercube-lm 1577/udp # hypercube-lm [Christopher_McLendon] [Christopher_McLendon] -jacobus-lm 1578/tcp # Jacobus License Manager [Tony_Cleveland] [Tony_Cleveland] -jacobus-lm 1578/udp # Jacobus License Manager [Tony_Cleveland] [Tony_Cleveland] -ioc-sea-lm 1579/tcp # ioc-sea-lm [Paul_Nelson] [Paul_Nelson] -ioc-sea-lm 1579/udp # ioc-sea-lm [Paul_Nelson] [Paul_Nelson] -tn-tl-r1 1580/tcp # tn-tl-r1 -tn-tl-r2 1580/udp # tn-tl-r2 [Ed_Kress] [Ed_Kress] -mil-2045-47001 1581/tcp # MIL-2045-47001 [Eric_Whitehill] [Eric_Whitehill] -mil-2045-47001 1581/udp # MIL-2045-47001 [Eric_Whitehill] [Eric_Whitehill] -msims 1582/tcp # MSIMS [Glenn_Olander] [Glenn_Olander] -msims 1582/udp # MSIMS [Glenn_Olander] [Glenn_Olander] -simbaexpress 1583/tcp # simbaexpress [Betsy_Alexander] [Betsy_Alexander] -simbaexpress 1583/udp # simbaexpress [Betsy_Alexander] [Betsy_Alexander] -tn-tl-fd2 1584/tcp # tn-tl-fd2 [Ed_Kress] [Ed_Kress] -tn-tl-fd2 1584/udp # tn-tl-fd2 [Ed_Kress] [Ed_Kress] -intv 1585/tcp # intv [Dermot_Tynand] [Dermot_Tynand] -intv 1585/udp # intv [Dermot_Tynand] [Dermot_Tynand] -ibm-abtact 1586/tcp # ibm-abtact [Sandeep_K_Singhal] [Sandeep_K_Singhal] -ibm-abtact 1586/udp # ibm-abtact [Sandeep_K_Singhal] [Sandeep_K_Singhal] -# pra_elmd -# -pra-elmd 1587/tcp # IANA assigned this [Dennis_Mastin] [Dennis_Mastin] -# well-formed service name as -# a replacement for -# "pra_elmd". -# This entry is an alias to "pra-elmd". This entry is now -pra_elmd 1587/tcp # pra_elmd [Dennis_Mastin] [Dennis_Mastin] historic, not usable for use with many common service -# discovery mechanisms. -# pra_elmd -# -pra-elmd 1587/udp # IANA assigned this [Dennis_Mastin] [Dennis_Mastin] -# well-formed service name as -# a replacement for -# "pra_elmd". -# This entry is an alias to "pra-elmd". This entry is now -pra_elmd 1587/udp # pra_elmd [Dennis_Mastin] [Dennis_Mastin] historic, not usable for use with many common service -# discovery mechanisms. -triquest-lm 1588/tcp # triquest-lm [Nand_Kumar] [Nand_Kumar] -triquest-lm 1588/udp # triquest-lm [Nand_Kumar] [Nand_Kumar] -vqp 1589/tcp # VQP [Keith_McCloghrie] [Keith_McCloghrie] -vqp 1589/udp # VQP [Keith_McCloghrie] [Keith_McCloghrie] -gemini-lm 1590/tcp # gemini-lm [Tony_Sawyer] [Tony_Sawyer] -gemini-lm 1590/udp # gemini-lm [Tony_Sawyer] [Tony_Sawyer] -ncpm-pm 1591/tcp # ncpm-pm [Ted_Power] [Ted_Power] -ncpm-pm 1591/udp # ncpm-pm [Ted_Power] [Ted_Power] -commonspace 1592/tcp # commonspace [Rob_Chandhok_2] [Rob_Chandhok_2] -commonspace 1592/udp # commonspace [Rob_Chandhok_2] [Rob_Chandhok_2] -mainsoft-lm 1593/tcp # mainsoft-lm [Anand_Gangadharan] [Anand_Gangadharan] -mainsoft-lm 1593/udp # mainsoft-lm [Anand_Gangadharan] [Anand_Gangadharan] -sixtrak 1594/tcp # sixtrak [Red_Lion_Controls] [Denis_Aull] 2014-09-22 -sixtrak 1594/udp # sixtrak [Red_Lion_Controls] [Denis_Aull] 2014-09-22 -radio 1595/tcp # radio -radio 1595/udp # radio -radio-sm 1596/tcp # radio-sm -radio-bc 1596/udp # radio-bc [Ken_Chapman] [Ken_Chapman] -orbplus-iiop 1597/tcp # orbplus-iiop [Robert_A_Kukura] [Robert_A_Kukura] -orbplus-iiop 1597/udp # orbplus-iiop [Robert_A_Kukura] [Robert_A_Kukura] -picknfs 1598/tcp # picknfs [John_Lombardo] [John_Lombardo] -picknfs 1598/udp # picknfs [John_Lombardo] [John_Lombardo] -simbaservices 1599/tcp # simbaservices [Betsy_Alexander] [Betsy_Alexander] -simbaservices 1599/udp # simbaservices [Betsy_Alexander] [Betsy_Alexander] -issd 1600/tcp # issd -issd 1600/udp # issd -aas 1601/tcp # aas [Bob_Beard] [Bob_Beard] -aas 1601/udp # aas [Bob_Beard] [Bob_Beard] -inspect 1602/tcp # inspect [Frank_O_Neill] [Frank_O_Neill] -inspect 1602/udp # inspect [Frank_O_Neill] [Frank_O_Neill] -picodbc 1603/tcp # pickodbc [John_Lombardo] [John_Lombardo] -picodbc 1603/udp # pickodbc [John_Lombardo] [John_Lombardo] -icabrowser 1604/tcp # icabrowser [Brad_Pedersen] [Brad_Pedersen] -icabrowser 1604/udp # icabrowser [Brad_Pedersen] [Brad_Pedersen] -slp 1605/tcp # Salutation Manager -# (Salutation Protocol) -slp 1605/udp # Salutation Manager -# (Salutation Protocol) -slm-api 1606/tcp # Salutation Manager (SLM-API) [Tohru_Mori] [Tohru_Mori] -slm-api 1606/udp # Salutation Manager (SLM-API) [Tohru_Mori] [Tohru_Mori] -stt 1607/tcp # stt [Ryan_Bolz] [Ryan_Bolz] -stt 1607/udp # stt [Ryan_Bolz] [Ryan_Bolz] -smart-lm 1608/tcp # Smart Corp. License Manager [Connie_Qiu] [Connie_Qiu] -smart-lm 1608/udp # Smart Corp. License Manager [Connie_Qiu] [Connie_Qiu] -isysg-lm 1609/tcp # isysg-lm [Adam_Curtin] [Adam_Curtin] -isysg-lm 1609/udp # isysg-lm [Adam_Curtin] [Adam_Curtin] -taurus-wh 1610/tcp # taurus-wh [Jeff_Moffatt] [Jeff_Moffatt] -taurus-wh 1610/udp # taurus-wh [Jeff_Moffatt] [Jeff_Moffatt] -ill 1611/tcp # Inter Library Loan [Niall_Murphy] [Niall_Murphy] -ill 1611/udp # Inter Library Loan [Niall_Murphy] [Niall_Murphy] -netbill-trans 1612/tcp # NetBill Transaction Server -netbill-trans 1612/udp # NetBill Transaction Server -netbill-keyrep 1613/tcp # NetBill Key Repository -netbill-keyrep 1613/udp # NetBill Key Repository -netbill-cred 1614/tcp # NetBill Credential Server -netbill-cred 1614/udp # NetBill Credential Server -netbill-auth 1615/tcp # NetBill Authorization Server -netbill-auth 1615/udp # NetBill Authorization Server -netbill-prod 1616/tcp # NetBill Product Server [Marvin_Sirbu] [Marvin_Sirbu] -netbill-prod 1616/udp # NetBill Product Server [Marvin_Sirbu] [Marvin_Sirbu] -nimrod-agent 1617/tcp # Nimrod Inter-Agent [Charles_Lynn] [Charles_Lynn] -# Communication -nimrod-agent 1617/udp # Nimrod Inter-Agent [Charles_Lynn] [Charles_Lynn] -# Communication -skytelnet 1618/tcp # skytelnet [Byron_Jones] [Byron_Jones] -skytelnet 1618/udp # skytelnet [Byron_Jones] [Byron_Jones] -xs-openstorage 1619/tcp # xs-openstorage [XuiS_Software_Ltd] [XuiS_Software_Ltd] -xs-openstorage 1619/udp # xs-openstorage [XuiS_Software_Ltd] [XuiS_Software_Ltd] -faxportwinport 1620/tcp # faxportwinport [Chris_Wells] [Chris_Wells] -faxportwinport 1620/udp # faxportwinport [Chris_Wells] [Chris_Wells] -softdataphone 1621/tcp # softdataphone [Dror_Gill] [Dror_Gill] -softdataphone 1621/udp # softdataphone [Dror_Gill] [Dror_Gill] -ontime 1622/tcp # ontime [Keith_Rhodes] [Keith_Rhodes] -ontime 1622/udp # ontime [Keith_Rhodes] [Keith_Rhodes] -jaleosnd 1623/tcp # jaleosnd [Christian_Schormann] [Christian_Schormann] -jaleosnd 1623/udp # jaleosnd [Christian_Schormann] [Christian_Schormann] -udp-sr-port 1624/tcp # udp-sr-port [Herb_Jensen] [Herb_Jensen] -udp-sr-port 1624/udp # udp-sr-port [Herb_Jensen] [Herb_Jensen] -svs-omagent 1625/tcp # svs-omagent [Alberto_Berlen] [Alberto_Berlen] -svs-omagent 1625/udp # svs-omagent [Alberto_Berlen] [Alberto_Berlen] -shockwave 1626/tcp # Shockwave [Sarah_Allen] [Sarah_Allen] -shockwave 1626/udp # Shockwave [Sarah_Allen] [Sarah_Allen] -t128-gateway 1627/tcp # T.128 Gateway [Phil_May] [Phil_May] -t128-gateway 1627/udp # T.128 Gateway [Phil_May] [Phil_May] -lontalk-norm 1628/tcp # LonTalk normal -lontalk-norm 1628/udp # LonTalk normal -lontalk-urgnt 1629/tcp # LonTalk urgent [Bob_Dolin] [Bob_Dolin] 2008-04-10 -lontalk-urgnt 1629/udp # LonTalk urgent [Bob_Dolin] [Bob_Dolin] 2008-04-10 -oraclenet8cman 1630/tcp # Oracle Net8 Cman [Tong_Ming_Lee] [Tong_Ming_Lee] -oraclenet8cman 1630/udp # Oracle Net8 Cman [Tong_Ming_Lee] [Tong_Ming_Lee] -visitview 1631/tcp # Visit view [Tom_Whittaker] [Tom_Whittaker] -visitview 1631/udp # Visit view [Tom_Whittaker] [Tom_Whittaker] -pammratc 1632/tcp # PAMMRATC -pammratc 1632/udp # PAMMRATC -pammrpc 1633/tcp # PAMMRPC [John_Britton] [John_Britton] -pammrpc 1633/udp # PAMMRPC [John_Britton] [John_Britton] -loaprobe 1634/tcp # Log On America Probe [James_Tavares] [James_Tavares] -loaprobe 1634/udp # Log On America Probe [James_Tavares] [James_Tavares] -edb-server1 1635/tcp # EDB Server 1 [Carlos_Portela] [Carlos_Portela] -edb-server1 1635/udp # EDB Server 1 [Carlos_Portela] [Carlos_Portela] -isdc 1636/tcp # ISP shared public data -# control -isdc 1636/udp # ISP shared public data -# control -islc 1637/tcp # ISP shared local data -# control -islc 1637/udp # ISP shared local data -# control -ismc 1638/tcp # ISP shared management [Nick_Austin] [Nick_Austin] -# control -ismc 1638/udp # ISP shared management [Nick_Austin] [Nick_Austin] -# control -cert-initiator 1639/tcp # cert-initiator -cert-initiator 1639/udp # cert-initiator -cert-responder 1640/tcp # cert-responder [Tom_Markson] [Tom_Markson] -cert-responder 1640/udp # cert-responder [Tom_Markson] [Tom_Markson] -invision 1641/tcp # InVision [Christopher_Davey] [Christopher_Davey] -invision 1641/udp # InVision [Christopher_Davey] [Christopher_Davey] -isis-am 1642/tcp # isis-am -isis-am 1642/udp # isis-am -isis-ambc 1643/tcp # isis-ambc [Ken_Chapman] [Ken_Chapman] -isis-ambc 1643/udp # isis-ambc [Ken_Chapman] [Ken_Chapman] -saiseh 1644/tcp # Satellite-data Acquisition [Bill_Taylor] [Bill_Taylor] -# System 4 -saiseh 1644/udp # Satellite-data Acquisition [Bill_Taylor] [Bill_Taylor] -# System 4 -sightline 1645/tcp # SightLine [admin] [admin] -sightline 1645/udp # SightLine [admin] [admin] -sa-msg-port 1646/tcp # sa-msg-port [Eric_Whitehill] [Eric_Whitehill] -sa-msg-port 1646/udp # sa-msg-port [Eric_Whitehill] [Eric_Whitehill] -rsap 1647/tcp # rsap [Holger_Reif] [Holger_Reif] -rsap 1647/udp # rsap [Holger_Reif] [Holger_Reif] -concurrent-lm 1648/tcp # concurrent-lm [Maggie_Brinsford] [Maggie_Brinsford] -concurrent-lm 1648/udp # concurrent-lm [Maggie_Brinsford] [Maggie_Brinsford] -kermit 1649/tcp # kermit [Frank_da_Cruz] [Frank_da_Cruz] -kermit 1649/udp # kermit [Frank_da_Cruz] [Frank_da_Cruz] -nkd 1650/tcp # nkdn -nkd 1650/udp # nkd -# shiva_confsrvr -# -shiva-confsrvr 1651/tcp # IANA assigned this [Mike_Horowitz] [Mike_Horowitz] -# well-formed service name as -# a replacement for -# "shiva_confsrvr". -# This entry is an alias to "shiva-confsrvr". This entry is now -shiva_confsrvr 1651/tcp # shiva_confsrvr [Mike_Horowitz] [Mike_Horowitz] historic, not usable for use with many common service -# discovery mechanisms. -# shiva_confsrvr -# -shiva-confsrvr 1651/udp # IANA assigned this [Mike_Horowitz] [Mike_Horowitz] -# well-formed service name as -# a replacement for -# "shiva_confsrvr". -# This entry is an alias to "shiva-confsrvr". This entry is now -shiva_confsrvr 1651/udp # shiva_confsrvr [Mike_Horowitz] [Mike_Horowitz] historic, not usable for use with many common service -# discovery mechanisms. -xnmp 1652/tcp # xnmp [Ali_Saleh] [Ali_Saleh] -xnmp 1652/udp # xnmp [Ali_Saleh] [Ali_Saleh] -alphatech-lm 1653/tcp # alphatech-lm [Joseph_Hauk] [Joseph_Hauk] -alphatech-lm 1653/udp # alphatech-lm [Joseph_Hauk] [Joseph_Hauk] -stargatealerts 1654/tcp # stargatealerts [Tim_Coppernoll] [Tim_Coppernoll] -stargatealerts 1654/udp # stargatealerts [Tim_Coppernoll] [Tim_Coppernoll] -dec-mbadmin 1655/tcp # dec-mbadmin -dec-mbadmin 1655/udp # dec-mbadmin -dec-mbadmin-h 1656/tcp # dec-mbadmin-h [Nick_Shipman] [Nick_Shipman] -dec-mbadmin-h 1656/udp # dec-mbadmin-h [Nick_Shipman] [Nick_Shipman] -fujitsu-mmpdc 1657/tcp # fujitsu-mmpdc [Katsumi_Oomuro] [Katsumi_Oomuro] -fujitsu-mmpdc 1657/udp # fujitsu-mmpdc [Katsumi_Oomuro] [Katsumi_Oomuro] -sixnetudr 1658/tcp # sixnetudr [Red_Lion_Controls] [Denis_Aull] 2014-05-21 -sixnetudr 1658/udp # sixnetudr [Red_Lion_Controls] [Denis_Aull] 2014-05-21 -sg-lm 1659/tcp # Silicon Grail License [William_R_Bishop] [William_R_Bishop] -# Manager -sg-lm 1659/udp # Silicon Grail License [William_R_Bishop] [William_R_Bishop] -# Manager -skip-mc-gikreq 1660/tcp # skip-mc-gikreq [Tom_Markson] [Tom_Markson] -skip-mc-gikreq 1660/udp # skip-mc-gikreq [Tom_Markson] [Tom_Markson] -netview-aix-1 1661/tcp # netview-aix-1 -netview-aix-1 1661/udp # netview-aix-1 -netview-aix-2 1662/tcp # netview-aix-2 -netview-aix-2 1662/udp # netview-aix-2 -netview-aix-3 1663/tcp # netview-aix-3 -netview-aix-3 1663/udp # netview-aix-3 -netview-aix-4 1664/tcp # netview-aix-4 -netview-aix-4 1664/udp # netview-aix-4 -netview-aix-5 1665/tcp # netview-aix-5 -netview-aix-5 1665/udp # netview-aix-5 -netview-aix-6 1666/tcp # netview-aix-6 -netview-aix-6 1666/udp # netview-aix-6 -netview-aix-7 1667/tcp # netview-aix-7 -netview-aix-7 1667/udp # netview-aix-7 -netview-aix-8 1668/tcp # netview-aix-8 -netview-aix-8 1668/udp # netview-aix-8 -netview-aix-9 1669/tcp # netview-aix-9 -netview-aix-9 1669/udp # netview-aix-9 -netview-aix-10 1670/tcp # netview-aix-10 -netview-aix-10 1670/udp # netview-aix-10 -netview-aix-11 1671/tcp # netview-aix-11 -netview-aix-11 1671/udp # netview-aix-11 -netview-aix-12 1672/tcp # netview-aix-12 [Martha_Crisson] [Martha_Crisson] -netview-aix-12 1672/udp # netview-aix-12 [Martha_Crisson] [Martha_Crisson] -proshare-mc-1 1673/tcp # Intel Proshare Multicast -proshare-mc-1 1673/udp # Intel Proshare Multicast -proshare-mc-2 1674/tcp # Intel Proshare Multicast [Mark_Lewis] [Mark_Lewis] -proshare-mc-2 1674/udp # Intel Proshare Multicast [Mark_Lewis] [Mark_Lewis] -pdp 1675/tcp # Pacific Data Products [Gary_Morton] [Gary_Morton] -pdp 1675/udp # Pacific Data Products [Gary_Morton] [Gary_Morton] -netcomm1 1676/tcp # netcomm1 -netcomm2 1676/udp # netcomm2 [Bulent_Kasman] [Bulent_Kasman] -groupwise 1677/tcp # groupwise [Brent_Bradshaw] [Brent_Bradshaw] -groupwise 1677/udp # groupwise [Brent_Bradshaw] [Brent_Bradshaw] -prolink 1678/tcp # prolink [Brian_Abramson] [Brian_Abramson] -prolink 1678/udp # prolink [Brian_Abramson] [Brian_Abramson] -darcorp-lm 1679/tcp # darcorp-lm [DARcorp] [DARcorp] -darcorp-lm 1679/udp # darcorp-lm [DARcorp] [DARcorp] -microcom-sbp 1680/tcp # microcom-sbp [Boris_B_Maiden] [Boris_B_Maiden] -microcom-sbp 1680/udp # microcom-sbp [Boris_B_Maiden] [Boris_B_Maiden] -sd-elmd 1681/tcp # sd-elmd [Bryan_Otey] [Bryan_Otey] -sd-elmd 1681/udp # sd-elmd [Bryan_Otey] [Bryan_Otey] -lanyon-lantern 1682/tcp # lanyon-lantern [Robin_Lewis] [Robin_Lewis] -lanyon-lantern 1682/udp # lanyon-lantern [Robin_Lewis] [Robin_Lewis] -ncpm-hip 1683/tcp # ncpm-hip [Ken_Hearn] [Ken_Hearn] -ncpm-hip 1683/udp # ncpm-hip [Ken_Hearn] [Ken_Hearn] -snaresecure 1684/tcp # SnareSecure [Marty_Batchelder] [Marty_Batchelder] -snaresecure 1684/udp # SnareSecure [Marty_Batchelder] [Marty_Batchelder] -n2nremote 1685/tcp # n2nremote [Kin_Chan_2] [Kin_Chan_2] -n2nremote 1685/udp # n2nremote [Kin_Chan_2] [Kin_Chan_2] -cvmon 1686/tcp # cvmon [Carol_Ann_Krug] [Carol_Ann_Krug] -cvmon 1686/udp # cvmon [Carol_Ann_Krug] [Carol_Ann_Krug] -nsjtp-ctrl 1687/tcp # nsjtp-ctrl -nsjtp-ctrl 1687/udp # nsjtp-ctrl -nsjtp-data 1688/tcp # nsjtp-data [Orazio_Granato] [Orazio_Granato] -nsjtp-data 1688/udp # nsjtp-data [Orazio_Granato] [Orazio_Granato] -firefox 1689/tcp # firefox [Mark_S_Edwards] [Mark_S_Edwards] -firefox 1689/udp # firefox [Mark_S_Edwards] [Mark_S_Edwards] -ng-umds 1690/tcp # ng-umds [Louis_E_Simard] [Louis_E_Simard] -ng-umds 1690/udp # ng-umds [Louis_E_Simard] [Louis_E_Simard] -empire-empuma 1691/tcp # empire-empuma [Bobby_Krupczak] [Bobby_Krupczak] -empire-empuma 1691/udp # empire-empuma [Bobby_Krupczak] [Bobby_Krupczak] -sstsys-lm 1692/tcp # sstsys-lm [Yih_Wu_Wang] [Yih_Wu_Wang] -sstsys-lm 1692/udp # sstsys-lm [Yih_Wu_Wang] [Yih_Wu_Wang] -rrirtr 1693/tcp # rrirtr -rrirtr 1693/udp # rrirtr -rrimwm 1694/tcp # rrimwm -rrimwm 1694/udp # rrimwm -rrilwm 1695/tcp # rrilwm -rrilwm 1695/udp # rrilwm -rrifmm 1696/tcp # rrifmm -rrifmm 1696/udp # rrifmm -rrisat 1697/tcp # rrisat [Allen_Briggs] [Allen_Briggs] -rrisat 1697/udp # rrisat [Allen_Briggs] [Allen_Briggs] -rsvp-encap-1 1698/tcp # RSVP-ENCAPSULATION-1 -rsvp-encap-1 1698/udp # RSVP-ENCAPSULATION-1 -rsvp-encap-2 1699/tcp # RSVP-ENCAPSULATION-2 [Bob_Braden_2] [Bob_Braden_2] -rsvp-encap-2 1699/udp # RSVP-ENCAPSULATION-2 [Bob_Braden_2] [Bob_Braden_2] -mps-raft 1700/tcp # mps-raft [Jason_Leupen] [Jason_Leupen] -mps-raft 1700/udp # mps-raft [Jason_Leupen] [Jason_Leupen] -l2f 1701/tcp # l2f -l2f 1701/udp # l2f -l2tp 1701/tcp # l2tp [Andy_Valencia] [Andy_Valencia] -l2tp 1701/udp # l2tp [Andy_Valencia] [Andy_Valencia] -deskshare 1702/tcp # deskshare [Sarah_Thompson] [Sarah_Thompson] -deskshare 1702/udp # deskshare [Sarah_Thompson] [Sarah_Thompson] -hb-engine 1703/tcp # hb-engine [Charles_C_L_Chou] [Charles_C_L_Chou] -hb-engine 1703/udp # hb-engine [Charles_C_L_Chou] [Charles_C_L_Chou] -bcs-broker 1704/tcp # bcs-broker [Andy_Warner] [Andy_Warner] -bcs-broker 1704/udp # bcs-broker [Andy_Warner] [Andy_Warner] -slingshot 1705/tcp # slingshot [Paul_Groarke] [Paul_Groarke] -slingshot 1705/udp # slingshot [Paul_Groarke] [Paul_Groarke] -jetform 1706/tcp # jetform [gdeinsta] [gdeinsta] -jetform 1706/udp # jetform [gdeinsta] [gdeinsta] -vdmplay 1707/tcp # vdmplay [David_Thielen] [David_Thielen] -vdmplay 1707/udp # vdmplay [David_Thielen] [David_Thielen] -gat-lmd 1708/tcp # gat-lmd [Igor_Zaoutine] [Igor_Zaoutine] -gat-lmd 1708/udp # gat-lmd [Igor_Zaoutine] [Igor_Zaoutine] -centra 1709/tcp # centra [Drew_Wolff] [Drew_Wolff] -centra 1709/udp # centra [Drew_Wolff] [Drew_Wolff] -impera 1710/tcp # impera [Stepehen_Campbell] [Stepehen_Campbell] -impera 1710/udp # impera [Stepehen_Campbell] [Stepehen_Campbell] -pptconference 1711/tcp # pptconference [John_Tafoya] [John_Tafoya] -pptconference 1711/udp # pptconference [John_Tafoya] [John_Tafoya] -registrar 1712/tcp # resource monitoring service [Ron_Lawson] [Ron_Lawson] -registrar 1712/udp # resource monitoring service [Ron_Lawson] [Ron_Lawson] -conferencetalk 1713/tcp # ConferenceTalk [George_Kajos] [George_Kajos] -conferencetalk 1713/udp # ConferenceTalk [George_Kajos] [George_Kajos] -sesi-lm 1714/tcp # sesi-lm -sesi-lm 1714/udp # sesi-lm -houdini-lm 1715/tcp # houdini-lm [Paul_Breslin] [Paul_Breslin] -houdini-lm 1715/udp # houdini-lm [Paul_Breslin] [Paul_Breslin] -xmsg 1716/tcp # xmsg [Mark_E_Fogle] [Mark_E_Fogle] -xmsg 1716/udp # xmsg [Mark_E_Fogle] [Mark_E_Fogle] -fj-hdnet 1717/tcp # fj-hdnet [Manabu_Makino] [Manabu_Makino] -fj-hdnet 1717/udp # fj-hdnet [Manabu_Makino] [Manabu_Makino] -h323gatedisc 1718/tcp # H.323 Multicast Gatekeeper [ITU-T] [ITU-T_TSB] 2013-01-31 -# Discover -h323gatedisc 1718/udp # H.323 Multicast Gatekeeper [ITU-T] [ITU-T_TSB] 2013-01-31 -# Discover -h323gatestat 1719/tcp # H.323 Unicast Gatekeeper [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signaling -h323gatestat 1719/udp # H.323 Unicast Gatekeeper [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signaling -h323hostcall 1720/tcp # H.323 Call Control [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signalling -h323hostcall 1720/udp # H.323 Call Control [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signalling -h323hostcall 1720/sctp # H.323 Call Control [ITU-T] 2014-07-30 -caicci 1721/tcp # caicci [Sylvia_Scheuren] [Sylvia_Scheuren] -caicci 1721/udp # caicci [Sylvia_Scheuren] [Sylvia_Scheuren] -hks-lm 1722/tcp # HKS License Manager [Michael_Wood] [Michael_Wood] -hks-lm 1722/udp # HKS License Manager [Michael_Wood] [Michael_Wood] -pptp 1723/tcp # pptp [Ken_Crocker] [Ken_Crocker] -pptp 1723/udp # pptp [Ken_Crocker] [Ken_Crocker] -csbphonemaster 1724/tcp # csbphonemaster [Hans_Peter_Heffels] [Hans_Peter_Heffels] -csbphonemaster 1724/udp # csbphonemaster [Hans_Peter_Heffels] [Hans_Peter_Heffels] -iden-ralp 1725/tcp # iden-ralp [Chris_Stanaway] [Chris_Stanaway] -iden-ralp 1725/udp # iden-ralp [Chris_Stanaway] [Chris_Stanaway] -iberiagames 1726/tcp # IBERIAGAMES [Jose_Luis] [Jose_Luis] -iberiagames 1726/udp # IBERIAGAMES [Jose_Luis] [Jose_Luis] -winddx 1727/tcp # winddx [Bill_Andrews] [Bill_Andrews] -winddx 1727/udp # winddx [Bill_Andrews] [Bill_Andrews] -telindus 1728/tcp # TELINDUS [Paul_Pyck] [Paul_Pyck] -telindus 1728/udp # TELINDUS [Paul_Pyck] [Paul_Pyck] -citynl 1729/tcp # CityNL License Management [CityDisc] [CityDisc] -citynl 1729/udp # CityNL License Management [CityDisc] [CityDisc] -roketz 1730/tcp # roketz [Ahti_Heinla] [Ahti_Heinla] -roketz 1730/udp # roketz [Ahti_Heinla] [Ahti_Heinla] -msiccp 1731/tcp # MSICCP [Max_Morris] [Max_Morris] -msiccp 1731/udp # MSICCP [Max_Morris] [Max_Morris] -proxim 1732/tcp # proxim [Srinivas_N_Mogalapa] [Srinivas_N_Mogalapa] -proxim 1732/udp # proxim [Srinivas_N_Mogalapa] [Srinivas_N_Mogalapa] -siipat 1733/tcp # SIMS - SIIPAT Protocol for [Steve_Ryckman] [Steve_Ryckman] -# Alarm Transmission -siipat 1733/udp # SIMS - SIIPAT Protocol for [Steve_Ryckman] [Steve_Ryckman] -# Alarm Transmission -cambertx-lm 1734/tcp # Camber Corporation License [Jeannie_Burleson] [Jeannie_Burleson] -# Management -cambertx-lm 1734/udp # Camber Corporation License [Jeannie_Burleson] [Jeannie_Burleson] -# Management -privatechat 1735/tcp # PrivateChat [Louis_E_Simard] [Louis_E_Simard] -privatechat 1735/udp # PrivateChat [Louis_E_Simard] [Louis_E_Simard] -street-stream 1736/tcp # street-stream [Glenn_Levitt] [Glenn_Levitt] -street-stream 1736/udp # street-stream [Glenn_Levitt] [Glenn_Levitt] -ultimad 1737/tcp # ultimad [Michael_Lanzetta] [Michael_Lanzetta] -ultimad 1737/udp # ultimad [Michael_Lanzetta] [Michael_Lanzetta] -gamegen1 1738/tcp # GameGen1 [Glen_Pearson] [Glen_Pearson] -gamegen1 1738/udp # GameGen1 [Glen_Pearson] [Glen_Pearson] -webaccess 1739/tcp # webaccess [Christian_Saether] [Christian_Saether] -webaccess 1739/udp # webaccess [Christian_Saether] [Christian_Saether] -encore 1740/tcp # encore [Stuart_Button] [Stuart_Button] -encore 1740/udp # encore [Stuart_Button] [Stuart_Button] -cisco-net-mgmt 1741/tcp # cisco-net-mgmt [John_McCormack] [John_McCormack] -cisco-net-mgmt 1741/udp # cisco-net-mgmt [John_McCormack] [John_McCormack] -3Com-nsd 1742/tcp # 3Com-nsd [Nitza_Steinberg] [Nitza_Steinberg] -3Com-nsd 1742/udp # 3Com-nsd [Nitza_Steinberg] [Nitza_Steinberg] -cinegrfx-lm 1743/tcp # Cinema Graphics License [Rodney_Iwashina] [Rodney_Iwashina] -# Manager -cinegrfx-lm 1743/udp # Cinema Graphics License [Rodney_Iwashina] [Rodney_Iwashina] -# Manager -ncpm-ft 1744/tcp # ncpm-ft [Ken_Hearn] [Ken_Hearn] -ncpm-ft 1744/udp # ncpm-ft [Ken_Hearn] [Ken_Hearn] -remote-winsock 1745/tcp # remote-winsock [Avi_Nathan] [Avi_Nathan] -remote-winsock 1745/udp # remote-winsock [Avi_Nathan] [Avi_Nathan] -ftrapid-1 1746/tcp # ftrapid-1 -ftrapid-1 1746/udp # ftrapid-1 -ftrapid-2 1747/tcp # ftrapid-2 [Richard_J_Williams] [Richard_J_Williams] -ftrapid-2 1747/udp # ftrapid-2 [Richard_J_Williams] [Richard_J_Williams] -oracle-em1 1748/tcp # oracle-em1 [Bob_Purvy] [Bob_Purvy] -oracle-em1 1748/udp # oracle-em1 [Bob_Purvy] [Bob_Purvy] -aspen-services 1749/tcp # aspen-services [Mark_B_Hurst] [Mark_B_Hurst] -aspen-services 1749/udp # aspen-services [Mark_B_Hurst] [Mark_B_Hurst] -sslp 1750/tcp # Simple Socket Library's [Dr_Charles_E_Campb] [Dr_Charles_E_Campb] -# PortMaster -sslp 1750/udp # Simple Socket Library's [Dr_Charles_E_Campb] [Dr_Charles_E_Campb] -# PortMaster -swiftnet 1751/tcp # SwiftNet [Terry_Lim] [Terry_Lim] -swiftnet 1751/udp # SwiftNet [Terry_Lim] [Terry_Lim] -lofr-lm 1752/tcp # Leap of Faith Research -# License Manager -lofr-lm 1752/udp # Leap of Faith Research -# License Manager -predatar-comms 1753/tcp # Predatar Comms Service [Silverstring_Ltd] [Ronnie_De_Giorgio] 2011-09-15 -# 1753 udp Reserved -oracle-em2 1754/tcp # oracle-em2 [Bob_Purvy] [Bob_Purvy] -oracle-em2 1754/udp # oracle-em2 [Bob_Purvy] [Bob_Purvy] -ms-streaming 1755/tcp # ms-streaming [Bret_O_Rourke] [Bret_O_Rourke] -ms-streaming 1755/udp # ms-streaming [Bret_O_Rourke] [Bret_O_Rourke] -capfast-lmd 1756/tcp # capfast-lmd [Chuck_Neal] [Chuck_Neal] -capfast-lmd 1756/udp # capfast-lmd [Chuck_Neal] [Chuck_Neal] -cnhrp 1757/tcp # cnhrp [William_Stoye] [William_Stoye] -cnhrp 1757/udp # cnhrp [William_Stoye] [William_Stoye] -tftp-mcast 1758/tcp # tftp-mcast [Tom_Emberson] [Tom_Emberson] -tftp-mcast 1758/udp # tftp-mcast [Tom_Emberson] [Tom_Emberson] -spss-lm 1759/tcp # SPSS License Manager [Tex_Hull] [Tex_Hull] -spss-lm 1759/udp # SPSS License Manager [Tex_Hull] [Tex_Hull] -www-ldap-gw 1760/tcp # www-ldap-gw [Nick_Emery] [Nick_Emery] -www-ldap-gw 1760/udp # www-ldap-gw [Nick_Emery] [Nick_Emery] -cft-0 1761/tcp # cft-0 [Martine_Marchand] [Martine_Marchand] -cft-0 1761/udp # cft-0 [Martine_Marchand] [Martine_Marchand] -cft-1 1762/tcp # cft-1 [Martine_Marchand] [Martine_Marchand] -cft-1 1762/udp # cft-1 [Martine_Marchand] [Martine_Marchand] -cft-2 1763/tcp # cft-2 [Martine_Marchand] [Martine_Marchand] -cft-2 1763/udp # cft-2 [Martine_Marchand] [Martine_Marchand] -cft-3 1764/tcp # cft-3 [Martine_Marchand] [Martine_Marchand] -cft-3 1764/udp # cft-3 [Martine_Marchand] [Martine_Marchand] -cft-4 1765/tcp # cft-4 [Martine_Marchand] [Martine_Marchand] -cft-4 1765/udp # cft-4 [Martine_Marchand] [Martine_Marchand] -cft-5 1766/tcp # cft-5 [Martine_Marchand] [Martine_Marchand] -cft-5 1766/udp # cft-5 [Martine_Marchand] [Martine_Marchand] -cft-6 1767/tcp # cft-6 [Martine_Marchand] [Martine_Marchand] -cft-6 1767/udp # cft-6 [Martine_Marchand] [Martine_Marchand] -cft-7 1768/tcp # cft-7 [Martine_Marchand] [Martine_Marchand] -cft-7 1768/udp # cft-7 [Martine_Marchand] [Martine_Marchand] -bmc-net-adm 1769/tcp # bmc-net-adm [Portnoy_Boxman] [Portnoy_Boxman] -bmc-net-adm 1769/udp # bmc-net-adm [Portnoy_Boxman] [Portnoy_Boxman] -bmc-net-svc 1770/tcp # bmc-net-svc [Portnoy_Boxman] [Portnoy_Boxman] -bmc-net-svc 1770/udp # bmc-net-svc [Portnoy_Boxman] [Portnoy_Boxman] -vaultbase 1771/tcp # vaultbase [Jose_A_Sesin] [Jose_A_Sesin] -vaultbase 1771/udp # vaultbase [Jose_A_Sesin] [Jose_A_Sesin] -essweb-gw 1772/tcp # EssWeb Gateway [Bob_Nattenberg] [Bob_Nattenberg] -essweb-gw 1772/udp # EssWeb Gateway [Bob_Nattenberg] [Bob_Nattenberg] -kmscontrol 1773/tcp # KMSControl [Roy_Chastain] [Roy_Chastain] -kmscontrol 1773/udp # KMSControl [Roy_Chastain] [Roy_Chastain] -global-dtserv 1774/tcp # global-dtserv [Nicholas_Davies] [Nicholas_Davies] -global-dtserv 1774/udp # global-dtserv [Nicholas_Davies] [Nicholas_Davies] -vdab 1775/tcp # data interchange between [MJA_Technology_LLC] [Mark_J._App] 2014-04-23 -# visual processing containers -# 1775 udp Reserved -femis 1776/tcp # Federal Emergency Management [Larry_Gerhardstein] [Larry_Gerhardstein] -# Information System -femis 1776/udp # Federal Emergency Management [Larry_Gerhardstein] [Larry_Gerhardstein] -# Information System -powerguardian 1777/tcp # powerguardian [Charles_Bennett] [Charles_Bennett] 2008-08-29 -powerguardian 1777/udp # powerguardian [Charles_Bennett] [Charles_Bennett] 2008-08-29 -prodigy-intrnet 1778/tcp # prodigy-internet [Bob_Dedrick] [Bob_Dedrick] -prodigy-intrnet 1778/udp # prodigy-internet [Bob_Dedrick] [Bob_Dedrick] -pharmasoft 1779/tcp # pharmasoft [Ola_Strandberg] [Ola_Strandberg] -pharmasoft 1779/udp # pharmasoft [Ola_Strandberg] [Ola_Strandberg] -dpkeyserv 1780/tcp # dpkeyserv [Yasunari_Gon_Yamasit] [Yasunari_Gon_Yamasit] -dpkeyserv 1780/udp # dpkeyserv [Yasunari_Gon_Yamasit] [Yasunari_Gon_Yamasit] -answersoft-lm 1781/tcp # answersoft-lm [James_A_Brewster] [James_A_Brewster] -answersoft-lm 1781/udp # answersoft-lm [James_A_Brewster] [James_A_Brewster] -hp-hcip 1782/tcp # hp-hcip [Allen_Baker] [Allen_Baker] -hp-hcip 1782/udp # hp-hcip [Allen_Baker] [Allen_Baker] -# 1783 Decomissioned Port 04/14/00, [naonao] [naonao] -# ms -finle-lm 1784/tcp # Finle License Manager [Dongling_Wang] [Dongling_Wang] -finle-lm 1784/udp # Finle License Manager [Dongling_Wang] [Dongling_Wang] -windlm 1785/tcp # Wind River Systems License [Will_Dere] [Will_Dere] -# Manager -windlm 1785/udp # Wind River Systems License [Will_Dere] [Will_Dere] -# Manager -funk-logger 1786/tcp # funk-logger -funk-logger 1786/udp # funk-logger -funk-license 1787/tcp # funk-license [Cimarron_Boozer][Eric_Wilde] [Cimarron_Boozer][Eric_Wilde] -funk-license 1787/udp # funk-license [Cimarron_Boozer][Eric_Wilde] [Cimarron_Boozer][Eric_Wilde] -psmond 1788/tcp # psmond [Will_Golson] [Will_Golson] -psmond 1788/udp # psmond [Will_Golson] [Will_Golson] -hello 1789/tcp # hello [D_J_Bernstein_2] [D_J_Bernstein_2] -hello 1789/udp # hello [D_J_Bernstein_2] [D_J_Bernstein_2] -nmsp 1790/tcp # Narrative Media Streaming [Paul_Santinelli_Jr] [Paul_Santinelli_Jr] -# Protocol -nmsp 1790/udp # Narrative Media Streaming [Paul_Santinelli_Jr] [Paul_Santinelli_Jr] -# Protocol -ea1 1791/tcp # EA1 [Kirk_MacLean] [Kirk_MacLean] -ea1 1791/udp # EA1 [Kirk_MacLean] [Kirk_MacLean] -ibm-dt-2 1792/tcp # ibm-dt-2 [Sam_Borman] [Sam_Borman] -ibm-dt-2 1792/udp # ibm-dt-2 [Sam_Borman] [Sam_Borman] -rsc-robot 1793/tcp # rsc-robot [Andrew_Jay_Schneider] [Andrew_Jay_Schneider] -rsc-robot 1793/udp # rsc-robot [Andrew_Jay_Schneider] [Andrew_Jay_Schneider] -cera-bcm 1794/tcp # cera-bcm [Leo_Moesgaard] [Leo_Moesgaard] -cera-bcm 1794/udp # cera-bcm [Leo_Moesgaard] [Leo_Moesgaard] -dpi-proxy 1795/tcp # dpi-proxy [Charles_Gordon] [Charles_Gordon] -dpi-proxy 1795/udp # dpi-proxy [Charles_Gordon] [Charles_Gordon] -vocaltec-admin 1796/tcp # Vocaltec Server [Scott_Petrack] [Scott_Petrack] -# Administration -vocaltec-admin 1796/udp # Vocaltec Server [Scott_Petrack] [Scott_Petrack] -# Administration -uma 1797/tcp # UMA [Martin_Kirk] [Martin_Kirk] -uma 1797/udp # UMA [Martin_Kirk] [Martin_Kirk] -etp 1798/tcp # Event Transfer Protocol [Mike_Wray] [Mike_Wray] -etp 1798/udp # Event Transfer Protocol [Mike_Wray] [Mike_Wray] -netrisk 1799/tcp # NETRISK [Kevin_Green] [Kevin_Green] -netrisk 1799/udp # NETRISK [Kevin_Green] [Kevin_Green] -ansys-lm 1800/tcp # ANSYS-License manager [Suzanne_Lorrin_2] [Suzanne_Lorrin_2] -ansys-lm 1800/udp # ANSYS-License manager [Suzanne_Lorrin_2] [Suzanne_Lorrin_2] -msmq 1801/tcp # Microsoft Message Que [Amnon_Horowitz] [Amnon_Horowitz] -msmq 1801/udp # Microsoft Message Que [Amnon_Horowitz] [Amnon_Horowitz] -concomp1 1802/tcp # ConComp1 [Ed_Vincent] [Ed_Vincent] -concomp1 1802/udp # ConComp1 [Ed_Vincent] [Ed_Vincent] -hp-hcip-gwy 1803/tcp # HP-HCIP-GWY [Allen_Baker] [Allen_Baker] -hp-hcip-gwy 1803/udp # HP-HCIP-GWY [Allen_Baker] [Allen_Baker] -enl 1804/tcp # ENL [Brian_Olson] [Brian_Olson] -enl 1804/udp # ENL [Brian_Olson] [Brian_Olson] -enl-name 1805/tcp # ENL-Name [Brian_Olson] [Brian_Olson] -enl-name 1805/udp # ENL-Name [Brian_Olson] [Brian_Olson] -musiconline 1806/tcp # Musiconline [Craig_Weeks] [Craig_Weeks] -musiconline 1806/udp # Musiconline [Craig_Weeks] [Craig_Weeks] -fhsp 1807/tcp # Fujitsu Hot Standby Protocol [Eiki_Iwata] [Eiki_Iwata] -fhsp 1807/udp # Fujitsu Hot Standby Protocol [Eiki_Iwata] [Eiki_Iwata] -oracle-vp2 1808/tcp # Oracle-VP2 [Craig_Fowler] [Craig_Fowler] -oracle-vp2 1808/udp # Oracle-VP2 [Craig_Fowler] [Craig_Fowler] -oracle-vp1 1809/tcp # Oracle-VP1 [Craig_Fowler] [Craig_Fowler] -oracle-vp1 1809/udp # Oracle-VP1 [Craig_Fowler] [Craig_Fowler] -jerand-lm 1810/tcp # Jerand License Manager [Robert_Monat] [Robert_Monat] -jerand-lm 1810/udp # Jerand License Manager [Robert_Monat] [Robert_Monat] -scientia-sdb 1811/tcp # Scientia-SDB [SYSTEMS_MANAGER] [SYSTEMS_MANAGER] -scientia-sdb 1811/udp # Scientia-SDB [SYSTEMS_MANAGER] [SYSTEMS_MANAGER] -radius 1812/tcp # RADIUS [RFC2865] -radius 1812/udp # RADIUS [RFC2865] -radius-acct 1813/tcp # RADIUS Accounting [RFC2866] -radius-acct 1813/udp # RADIUS Accounting [RFC2866] -tdp-suite 1814/tcp # TDP Suite [Rob_Lockhart] [Rob_Lockhart] -tdp-suite 1814/udp # TDP Suite [Rob_Lockhart] [Rob_Lockhart] -mmpft 1815/tcp # MMPFT [Ralf_Muckenhirn] [Ralf_Muckenhirn] -mmpft 1815/udp # MMPFT [Ralf_Muckenhirn] [Ralf_Muckenhirn] -harp 1816/tcp # HARP [Bjorn_Chambless] [Bjorn_Chambless] -harp 1816/udp # HARP [Bjorn_Chambless] [Bjorn_Chambless] -rkb-oscs 1817/tcp # RKB-OSCS [Robert_Kevin_Breton] [Robert_Kevin_Breton] -rkb-oscs 1817/udp # RKB-OSCS [Robert_Kevin_Breton] [Robert_Kevin_Breton] -etftp 1818/tcp # Enhanced Trivial File [William_Polites] [William_Polites] -# Transfer Protocol -etftp 1818/udp # Enhanced Trivial File [William_Polites] [William_Polites] -# Transfer Protocol -plato-lm 1819/tcp # Plato License Manager [Mark_Morris] [Mark_Morris] -plato-lm 1819/udp # Plato License Manager [Mark_Morris] [Mark_Morris] -mcagent 1820/tcp # mcagent [Ryoichi_Shinohara] [Ryoichi_Shinohara] -mcagent 1820/udp # mcagent [Ryoichi_Shinohara] [Ryoichi_Shinohara] -donnyworld 1821/tcp # donnyworld [Don_Oliver] [Don_Oliver] -donnyworld 1821/udp # donnyworld [Don_Oliver] [Don_Oliver] -es-elmd 1822/tcp # es-elmd [David_Duncan] [David_Duncan] -es-elmd 1822/udp # es-elmd [David_Duncan] [David_Duncan] -unisys-lm 1823/tcp # Unisys Natural Language [Raymond_A_Diedrichs] [Raymond_A_Diedrichs] -# License Manager -unisys-lm 1823/udp # Unisys Natural Language [Raymond_A_Diedrichs] [Raymond_A_Diedrichs] -# License Manager -metrics-pas 1824/tcp # metrics-pas [Tom_Haapanen] [Tom_Haapanen] -metrics-pas 1824/udp # metrics-pas [Tom_Haapanen] [Tom_Haapanen] -direcpc-video 1825/tcp # DirecPC Video [Chris_Kerrigan] [Chris_Kerrigan] -direcpc-video 1825/udp # DirecPC Video [Chris_Kerrigan] [Chris_Kerrigan] -ardt 1826/tcp # ARDT [Mike_Goddard] [Mike_Goddard] -ardt 1826/udp # ARDT [Mike_Goddard] [Mike_Goddard] -asi 1827/tcp # ASI [Bob_Tournoux] [Bob_Tournoux] -asi 1827/udp # ASI [Bob_Tournoux] [Bob_Tournoux] -itm-mcell-u 1828/tcp # itm-mcell-u [Portnoy_Boxman] [Portnoy_Boxman] -itm-mcell-u 1828/udp # itm-mcell-u [Portnoy_Boxman] [Portnoy_Boxman] -optika-emedia 1829/tcp # Optika eMedia [Daryle_DeBalski] [Daryle_DeBalski] -optika-emedia 1829/udp # Optika eMedia [Daryle_DeBalski] [Daryle_DeBalski] -net8-cman 1830/tcp # Oracle Net8 CMan Admin [Shuvayu_Kanjilal] [Shuvayu_Kanjilal] -net8-cman 1830/udp # Oracle Net8 CMan Admin [Shuvayu_Kanjilal] [Shuvayu_Kanjilal] -myrtle 1831/tcp # Myrtle [Ron_Achin] [Ron_Achin] -myrtle 1831/udp # Myrtle [Ron_Achin] [Ron_Achin] -tht-treasure 1832/tcp # ThoughtTreasure [Erik_Mueller] [Erik_Mueller] -tht-treasure 1832/udp # ThoughtTreasure [Erik_Mueller] [Erik_Mueller] -udpradio 1833/tcp # udpradio [Guus_Sliepen] [Guus_Sliepen] -udpradio 1833/udp # udpradio [Guus_Sliepen] [Guus_Sliepen] -ardusuni 1834/tcp # ARDUS Unicast -ardusuni 1834/udp # ARDUS Unicast -ardusmul 1835/tcp # ARDUS Multicast [Toshikatsu_Ito] [Toshikatsu_Ito] -ardusmul 1835/udp # ARDUS Multicast [Toshikatsu_Ito] [Toshikatsu_Ito] -ste-smsc 1836/tcp # ste-smsc [Tom_Snauwaert] [Tom_Snauwaert] -ste-smsc 1836/udp # ste-smsc [Tom_Snauwaert] [Tom_Snauwaert] -csoft1 1837/tcp # csoft1 [John_Coll] [John_Coll] -csoft1 1837/udp # csoft1 [John_Coll] [John_Coll] -talnet 1838/tcp # TALNET [Aaron_Lav] [Aaron_Lav] -talnet 1838/udp # TALNET [Aaron_Lav] [Aaron_Lav] -netopia-vo1 1839/tcp # netopia-vo1 -netopia-vo1 1839/udp # netopia-vo1 -netopia-vo2 1840/tcp # netopia-vo2 -netopia-vo2 1840/udp # netopia-vo2 -netopia-vo3 1841/tcp # netopia-vo3 -netopia-vo3 1841/udp # netopia-vo3 -netopia-vo4 1842/tcp # netopia-vo4 -netopia-vo4 1842/udp # netopia-vo4 -netopia-vo5 1843/tcp # netopia-vo5 [Marc_Epard] [Marc_Epard] -netopia-vo5 1843/udp # netopia-vo5 [Marc_Epard] [Marc_Epard] -direcpc-dll 1844/tcp # DirecPC-DLL [Chris_Kerrigan] [Chris_Kerrigan] -direcpc-dll 1844/udp # DirecPC-DLL [Chris_Kerrigan] [Chris_Kerrigan] -altalink 1845/tcp # altalink [Alberto_Raydan] [Alberto_Raydan] -altalink 1845/udp # altalink [Alberto_Raydan] [Alberto_Raydan] -tunstall-pnc 1846/tcp # Tunstall PNC [Robert_M_Moore] [Robert_M_Moore] -tunstall-pnc 1846/udp # Tunstall PNC [Robert_M_Moore] [Robert_M_Moore] -slp-notify 1847/tcp # SLP Notification [RFC3082] -slp-notify 1847/udp # SLP Notification [RFC3082] -fjdocdist 1848/tcp # fjdocdist [Yuichi_Ohiwa] [Yuichi_Ohiwa] -fjdocdist 1848/udp # fjdocdist [Yuichi_Ohiwa] [Yuichi_Ohiwa] -alpha-sms 1849/tcp # ALPHA-SMS [Benjamin_Grimm] [Benjamin_Grimm] -alpha-sms 1849/udp # ALPHA-SMS [Benjamin_Grimm] [Benjamin_Grimm] -gsi 1850/tcp # GSI [William_Mullaney] [William_Mullaney] -gsi 1850/udp # GSI [William_Mullaney] [William_Mullaney] -ctcd 1851/tcp # ctcd [John_Ryan] [John_Ryan] -ctcd 1851/udp # ctcd [John_Ryan] [John_Ryan] -virtual-time 1852/tcp # Virtual Time [Angie_S_Morner] [Angie_S_Morner] -virtual-time 1852/udp # Virtual Time [Angie_S_Morner] [Angie_S_Morner] -vids-avtp 1853/tcp # VIDS-AVTP [Sascha_Kuemmel] [Sascha_Kuemmel] -vids-avtp 1853/udp # VIDS-AVTP [Sascha_Kuemmel] [Sascha_Kuemmel] -buddy-draw 1854/tcp # Buddy Draw [Marvin_Shin] [Marvin_Shin] -buddy-draw 1854/udp # Buddy Draw [Marvin_Shin] [Marvin_Shin] -fiorano-rtrsvc 1855/tcp # Fiorano RtrSvc -fiorano-rtrsvc 1855/udp # Fiorano RtrSvc -fiorano-msgsvc 1856/tcp # Fiorano MsgSvc [Albert_Holt_2] [Albert_Holt_2] -fiorano-msgsvc 1856/udp # Fiorano MsgSvc [Albert_Holt_2] [Albert_Holt_2] -datacaptor 1857/tcp # DataCaptor [Steven_M_Forrester] [Steven_M_Forrester] -datacaptor 1857/udp # DataCaptor [Steven_M_Forrester] [Steven_M_Forrester] -privateark 1858/tcp # PrivateArk [Ronen_Zoran] [Ronen_Zoran] -privateark 1858/udp # PrivateArk [Ronen_Zoran] [Ronen_Zoran] -gammafetchsvr 1859/tcp # Gamma Fetcher Server [Cnaan_Aviv] [Cnaan_Aviv] -gammafetchsvr 1859/udp # Gamma Fetcher Server [Cnaan_Aviv] [Cnaan_Aviv] -sunscalar-svc 1860/tcp # SunSCALAR Services [Sanjay_Radia] [Sanjay_Radia] -sunscalar-svc 1860/udp # SunSCALAR Services [Sanjay_Radia] [Sanjay_Radia] -lecroy-vicp 1861/tcp # LeCroy VICP [Anthony_Cake] [Anthony_Cake] -lecroy-vicp 1861/udp # LeCroy VICP [Anthony_Cake] [Anthony_Cake] -mysql-cm-agent 1862/tcp # MySQL Cluster Manager Agent [Andrew_Morgan] [Andrew_Morgan] 2009-12-08 -mysql-cm-agent 1862/udp # MySQL Cluster Manager Agent [Andrew_Morgan] [Andrew_Morgan] 2009-12-08 -msnp 1863/tcp # MSNP [William_Lai] [William_Lai] -msnp 1863/udp # MSNP [William_Lai] [William_Lai] -paradym-31port 1864/tcp # Paradym 31 Port [David_Wooden] [David_Wooden] -paradym-31port 1864/udp # Paradym 31 Port [David_Wooden] [David_Wooden] -entp 1865/tcp # ENTP [Seiko_Epson] [Seiko_Epson] -entp 1865/udp # ENTP [Seiko_Epson] [Seiko_Epson] -swrmi 1866/tcp # swrmi [Jun_Yoshii] [Jun_Yoshii] -swrmi 1866/udp # swrmi [Jun_Yoshii] [Jun_Yoshii] -udrive 1867/tcp # UDRIVE [Robby_Walker] [Robby_Walker] -udrive 1867/udp # UDRIVE [Robby_Walker] [Robby_Walker] -viziblebrowser 1868/tcp # VizibleBrowser [Jimmy_Talbot] [Jimmy_Talbot] -viziblebrowser 1868/udp # VizibleBrowser [Jimmy_Talbot] [Jimmy_Talbot] -transact 1869/tcp # TransAct [TransAct_Futures_Dev] [TransAct_Futures_Dev] -transact 1869/udp # TransAct [TransAct_Futures_Dev] [TransAct_Futures_Dev] -sunscalar-dns 1870/tcp # SunSCALAR DNS Service [Sanjay_Radia] [Sanjay_Radia] -sunscalar-dns 1870/udp # SunSCALAR DNS Service [Sanjay_Radia] [Sanjay_Radia] -canocentral0 1871/tcp # Cano Central 0 -canocentral0 1871/udp # Cano Central 0 -canocentral1 1872/tcp # Cano Central 1 [Mark_McNamara] [Mark_McNamara] -canocentral1 1872/udp # Cano Central 1 [Mark_McNamara] [Mark_McNamara] -fjmpjps 1873/tcp # Fjmpjps -fjmpjps 1873/udp # Fjmpjps -fjswapsnp 1874/tcp # Fjswapsnp [Y_Ohiwa] [Y_Ohiwa] -fjswapsnp 1874/udp # Fjswapsnp [Y_Ohiwa] [Y_Ohiwa] -westell-stats 1875/tcp # westell stats [Thomas_McCabe] [Thomas_McCabe] -westell-stats 1875/udp # westell stats [Thomas_McCabe] [Thomas_McCabe] -ewcappsrv 1876/tcp # ewcappsrv [Howard_Yin] [Howard_Yin] -ewcappsrv 1876/udp # ewcappsrv [Howard_Yin] [Howard_Yin] -hp-webqosdb 1877/tcp # hp-webqosdb [Kim_Scott] [Kim_Scott] -hp-webqosdb 1877/udp # hp-webqosdb [Kim_Scott] [Kim_Scott] -drmsmc 1878/tcp # drmsmc [Katsuhiko_Abe] [Katsuhiko_Abe] -drmsmc 1878/udp # drmsmc [Katsuhiko_Abe] [Katsuhiko_Abe] -nettgain-nms 1879/tcp # NettGain NMS [Dr_Yair_Shapira] [Dr_Yair_Shapira] -nettgain-nms 1879/udp # NettGain NMS [Dr_Yair_Shapira] [Dr_Yair_Shapira] -vsat-control 1880/tcp # Gilat VSAT Control [Yariv_Kaplan] [Yariv_Kaplan] -vsat-control 1880/udp # Gilat VSAT Control [Yariv_Kaplan] [Yariv_Kaplan] -ibm-mqseries2 1881/tcp # IBM WebSphere MQ Everyplace [Jane_Porter] [Jane_Porter] -ibm-mqseries2 1881/udp # IBM WebSphere MQ Everyplace [Jane_Porter] [Jane_Porter] -ecsqdmn 1882/tcp # CA eTrust Common Services [Paul_Wissmiller] [Paul_Wissmiller] -ecsqdmn 1882/udp # CA eTrust Common Services [Paul_Wissmiller] [Paul_Wissmiller] -mqtt 1883/tcp # Message Queuing Telemetry [OASIS] [Robin_Cover] 2015-02-10 -# Transport Protocol -mqtt 1883/udp # Message Queuing Telemetry [OASIS] [Robin_Cover] 2015-02-10 -# Transport Protocol -idmaps 1884/tcp # Internet Distance Map Svc [Sugih_Jamim] [Sugih_Jamim] -idmaps 1884/udp # Internet Distance Map Svc [Sugih_Jamim] [Sugih_Jamim] -vrtstrapserver 1885/tcp # Veritas Trap Server [Russell_Thrasher] [Russell_Thrasher] -vrtstrapserver 1885/udp # Veritas Trap Server [Russell_Thrasher] [Russell_Thrasher] -leoip 1886/tcp # Leonardo over IP [Dietmar_Finkler] [Dietmar_Finkler] -leoip 1886/udp # Leonardo over IP [Dietmar_Finkler] [Dietmar_Finkler] -filex-lport 1887/tcp # FileX Listening Port [Megan_Woods] [Megan_Woods] -filex-lport 1887/udp # FileX Listening Port [Megan_Woods] [Megan_Woods] -ncconfig 1888/tcp # NC Config Port [Simon_Parker] [Simon_Parker] -ncconfig 1888/udp # NC Config Port [Simon_Parker] [Simon_Parker] -unify-adapter 1889/tcp # Unify Web Adapter Service [Daegis_Inc] [Chris_Anderson] 2012-07-31 -unify-adapter 1889/udp # Unify Web Adapter Service [Daegis_Inc] [Chris_Anderson] 2012-07-31 -wilkenlistener 1890/tcp # wilkenListener [Wilken_GmbH] [Wilken_GmbH] -wilkenlistener 1890/udp # wilkenListener [Wilken_GmbH] [Wilken_GmbH] -childkey-notif 1891/tcp # ChildKey Notification -childkey-notif 1891/udp # ChildKey Notification -childkey-ctrl 1892/tcp # ChildKey Control [Ivan_Berardinelli] [Ivan_Berardinelli] -childkey-ctrl 1892/udp # ChildKey Control [Ivan_Berardinelli] [Ivan_Berardinelli] -elad 1893/tcp # ELAD Protocol [Franco_Milan] [Franco_Milan] -elad 1893/udp # ELAD Protocol [Franco_Milan] [Franco_Milan] -o2server-port 1894/tcp # O2Server Port [Tim_Howard] [Tim_Howard] -o2server-port 1894/udp # O2Server Port [Tim_Howard] [Tim_Howard] -# 1895 tcp unassigned Microsoft (unoffically) using 1895 -# 1895 udp unassigned Microsoft (unoffically) using 1895 -b-novative-ls 1896/tcp # b-novative license server [Matthias_Riese] [Matthias_Riese] -b-novative-ls 1896/udp # b-novative license server [Matthias_Riese] [Matthias_Riese] -metaagent 1897/tcp # MetaAgent [Marie_France_Dubreui] [Marie_France_Dubreui] -metaagent 1897/udp # MetaAgent [Marie_France_Dubreui] [Marie_France_Dubreui] -cymtec-port 1898/tcp # Cymtec secure management [Michael_Mester] [Michael_Mester] -cymtec-port 1898/udp # Cymtec secure management [Michael_Mester] [Michael_Mester] -mc2studios 1899/tcp # MC2Studios [Michael_Coon] [Michael_Coon] -mc2studios 1899/udp # MC2Studios [Michael_Coon] [Michael_Coon] -ssdp 1900/tcp # SSDP [UPnP_Forum] [UPnP_Forum] -ssdp 1900/udp # SSDP [UPnP_Forum] [UPnP_Forum] -fjicl-tep-a 1901/tcp # Fujitsu ICL Terminal [Bob_Lyon] [Bob_Lyon] -# Emulator Program A -fjicl-tep-a 1901/udp # Fujitsu ICL Terminal [Bob_Lyon] [Bob_Lyon] -# Emulator Program A -fjicl-tep-b 1902/tcp # Fujitsu ICL Terminal [Bob_Lyon] [Bob_Lyon] -# Emulator Program B -fjicl-tep-b 1902/udp # Fujitsu ICL Terminal [Bob_Lyon] [Bob_Lyon] -# Emulator Program B -linkname 1903/tcp # Local Link Name Resolution [Dan_Harrington] [Dan_Harrington] -linkname 1903/udp # Local Link Name Resolution [Dan_Harrington] [Dan_Harrington] -fjicl-tep-c 1904/tcp # Fujitsu ICL Terminal [Bob_Lyon] [Bob_Lyon] -# Emulator Program C -fjicl-tep-c 1904/udp # Fujitsu ICL Terminal [Bob_Lyon] [Bob_Lyon] -# Emulator Program C -sugp 1905/tcp # Secure UP.Link Gateway [Peter_King] [Peter_King] -# Protocol -sugp 1905/udp # Secure UP.Link Gateway [Peter_King] [Peter_King] -# Protocol -tpmd 1906/tcp # TPortMapperReq [Sheila_Devins] [Sheila_Devins] -tpmd 1906/udp # TPortMapperReq [Sheila_Devins] [Sheila_Devins] -intrastar 1907/tcp # IntraSTAR [Peter_Schoenberger] [Peter_Schoenberger] -intrastar 1907/udp # IntraSTAR [Peter_Schoenberger] [Peter_Schoenberger] -dawn 1908/tcp # Dawn [Michael_Crawford_2] [Michael_Crawford_2] -dawn 1908/udp # Dawn [Michael_Crawford_2] [Michael_Crawford_2] -global-wlink 1909/tcp # Global World Link [Nicholas_Davies] [Nicholas_Davies] -global-wlink 1909/udp # Global World Link [Nicholas_Davies] [Nicholas_Davies] -ultrabac 1910/tcp # UltraBac Software [Paul_Bunn] [Paul_Bunn] -# communications port -ultrabac 1910/udp # UltraBac Software [Paul_Bunn] [Paul_Bunn] -# communications port -# Starlight Networks -mtp 1911/tcp # Multimedia Transport [Bruce_Lieberman] [Bruce_Lieberman] -# Protocol -# Starlight Networks -mtp 1911/udp # Multimedia Transport [Bruce_Lieberman] [Bruce_Lieberman] -# Protocol -rhp-iibp 1912/tcp # rhp-iibp [George_Nachman][Tom_Lake] [George_Nachman][Tom_Lake] -rhp-iibp 1912/udp # rhp-iibp [George_Nachman][Tom_Lake] [George_Nachman][Tom_Lake] -armadp 1913/tcp # armadp [Kevin_Welton] [Kevin_Welton] -armadp 1913/udp # armadp [Kevin_Welton] [Kevin_Welton] -elm-momentum 1914/tcp # Elm-Momentum [Willie_Wu] [Willie_Wu] -elm-momentum 1914/udp # Elm-Momentum [Willie_Wu] [Willie_Wu] -facelink 1915/tcp # FACELINK [J_H_Hermans] [J_H_Hermans] -facelink 1915/udp # FACELINK [J_H_Hermans] [J_H_Hermans] -persona 1916/tcp # Persoft Persona [Tom_Spidell] [Tom_Spidell] -persona 1916/udp # Persoft Persona [Tom_Spidell] [Tom_Spidell] -noagent 1917/tcp # nOAgent [Martin_Bestmann] [Martin_Bestmann] -noagent 1917/udp # nOAgent [Martin_Bestmann] [Martin_Bestmann] -can-nds 1918/tcp # IBM Tivole Directory Service -# - NDS -can-nds 1918/udp # IBM Tivole Directory Service -# - NDS -can-dch 1919/tcp # IBM Tivoli Directory Service -# - DCH -can-dch 1919/udp # IBM Tivoli Directory Service -# - DCH -can-ferret 1920/tcp # IBM Tivoli Directory Service [Nic_Catrambone] [Nic_Catrambone] -# - FERRET -can-ferret 1920/udp # IBM Tivoli Directory Service [Nic_Catrambone] [Nic_Catrambone] -# - FERRET -noadmin 1921/tcp # NoAdmin [Martin_Bestmann] [Martin_Bestmann] -noadmin 1921/udp # NoAdmin [Martin_Bestmann] [Martin_Bestmann] -tapestry 1922/tcp # Tapestry [Ken_Oliver] [Ken_Oliver] -tapestry 1922/udp # Tapestry [Ken_Oliver] [Ken_Oliver] -spice 1923/tcp # SPICE [Nicholas_Chua] [Nicholas_Chua] -spice 1923/udp # SPICE [Nicholas_Chua] [Nicholas_Chua] -xiip 1924/tcp # XIIP [Alain_Robert_2] [Alain_Robert_2] -xiip 1924/udp # XIIP [Alain_Robert_2] [Alain_Robert_2] -discovery-port 1925/tcp # Surrogate Discovery Port [Keith_Thompson] [Keith_Thompson] -discovery-port 1925/udp # Surrogate Discovery Port [Keith_Thompson] [Keith_Thompson] -egs 1926/tcp # Evolution Game Server [Simon_Butcher] [Simon_Butcher] -egs 1926/udp # Evolution Game Server [Simon_Butcher] [Simon_Butcher] -videte-cipc 1927/tcp # Videte CIPC Port [Videte_IT] [Videte_IT] -videte-cipc 1927/udp # Videte CIPC Port [Videte_IT] [Videte_IT] -emsd-port 1928/tcp # Expnd Maui Srvr Dscovr [Edo_Yahav] [Edo_Yahav] -emsd-port 1928/udp # Expnd Maui Srvr Dscovr [Edo_Yahav] [Edo_Yahav] -bandwiz-system 1929/tcp # Bandwiz System - Server [Joseph_Weihs] [Joseph_Weihs] -bandwiz-system 1929/udp # Bandwiz System - Server [Joseph_Weihs] [Joseph_Weihs] -driveappserver 1930/tcp # Drive AppServer [Andrew_Johnson] [Andrew_Johnson] -driveappserver 1930/udp # Drive AppServer [Andrew_Johnson] [Andrew_Johnson] -amdsched 1931/tcp # AMD SCHED [Michael_Walsh] [Michael_Walsh] -amdsched 1931/udp # AMD SCHED [Michael_Walsh] [Michael_Walsh] -ctt-broker 1932/tcp # CTT Broker [Jens_Edlund] [Jens_Edlund] -ctt-broker 1932/udp # CTT Broker [Jens_Edlund] [Jens_Edlund] -xmapi 1933/tcp # IBM LM MT Agent -xmapi 1933/udp # IBM LM MT Agent -xaapi 1934/tcp # IBM LM Appl Agent [Helga_Wolin] [Helga_Wolin] -xaapi 1934/udp # IBM LM Appl Agent [Helga_Wolin] [Helga_Wolin] -macromedia-fcs 1935/tcp # Macromedia Flash [Pritham_Shetty] [Pritham_Shetty] -# Communications Server MX -macromedia-fcs 1935/udp # Macromedia Flash [Pritham_Shetty] [Pritham_Shetty] -# Communications server MX -jetcmeserver 1936/tcp # JetCmeServer Server Port -jetcmeserver 1936/udp # JetCmeServer Server Port -jwserver 1937/tcp # JetVWay Server Port -jwserver 1937/udp # JetVWay Server Port -jwclient 1938/tcp # JetVWay Client Port -jwclient 1938/udp # JetVWay Client Port -jvserver 1939/tcp # JetVision Server Port -jvserver 1939/udp # JetVision Server Port -jvclient 1940/tcp # JetVision Client Port [Stephen_Tsun] [Stephen_Tsun] -jvclient 1940/udp # JetVision Client Port [Stephen_Tsun] [Stephen_Tsun] -dic-aida 1941/tcp # DIC-Aida [Frans_S_C_Witte] [Frans_S_C_Witte] -dic-aida 1941/udp # DIC-Aida [Frans_S_C_Witte] [Frans_S_C_Witte] -res 1942/tcp # Real Enterprise Service [Bob_Janssen] [Bob_Janssen] -res 1942/udp # Real Enterprise Service [Bob_Janssen] [Bob_Janssen] -beeyond-media 1943/tcp # Beeyond Media [Bob_Deblier] [Bob_Deblier] -beeyond-media 1943/udp # Beeyond Media [Bob_Deblier] [Bob_Deblier] -close-combat 1944/tcp # close-combat [David_Hua] [David_Hua] -close-combat 1944/udp # close-combat [David_Hua] [David_Hua] -dialogic-elmd 1945/tcp # dialogic-elmd [Roger_Kay] [Roger_Kay] -dialogic-elmd 1945/udp # dialogic-elmd [Roger_Kay] [Roger_Kay] -tekpls 1946/tcp # tekpls [Brian_Abramson_2] [Brian_Abramson_2] -tekpls 1946/udp # tekpls [Brian_Abramson_2] [Brian_Abramson_2] -sentinelsrm 1947/tcp # SentinelSRM [Michael_Zunke_2] [Michael_Zunke_2] 2010-07-23 -sentinelsrm 1947/udp # SentinelSRM [Michael_Zunke_2] [Michael_Zunke_2] 2010-07-23 -eye2eye 1948/tcp # eye2eye [Trevor_Bell] [Trevor_Bell] -eye2eye 1948/udp # eye2eye [Trevor_Bell] [Trevor_Bell] -ismaeasdaqlive 1949/tcp # ISMA Easdaq Live [Stephen_Dunne] [Stephen_Dunne] -ismaeasdaqlive 1949/udp # ISMA Easdaq Live [Stephen_Dunne] [Stephen_Dunne] -ismaeasdaqtest 1950/tcp # ISMA Easdaq Test [Stephen_Dunne] [Stephen_Dunne] -ismaeasdaqtest 1950/udp # ISMA Easdaq Test [Stephen_Dunne] [Stephen_Dunne] -bcs-lmserver 1951/tcp # bcs-lmserver [Andy_Warner] [Andy_Warner] -bcs-lmserver 1951/udp # bcs-lmserver [Andy_Warner] [Andy_Warner] -mpnjsc 1952/tcp # mpnjsc [Takenori_Miyahara] [Takenori_Miyahara] -mpnjsc 1952/udp # mpnjsc [Takenori_Miyahara] [Takenori_Miyahara] -rapidbase 1953/tcp # Rapid Base [Antoni_Wolski] [Antoni_Wolski] -rapidbase 1953/udp # Rapid Base [Antoni_Wolski] [Antoni_Wolski] -abr-api 1954/tcp # ABR-API (diskbridge) -abr-api 1954/udp # ABR-API (diskbridge) -abr-secure 1955/tcp # ABR-Secure Data (diskbridge) [Graham_Wooden] [Graham_Wooden] -abr-secure 1955/udp # ABR-Secure Data (diskbridge) [Graham_Wooden] [Graham_Wooden] -vrtl-vmf-ds 1956/tcp # Vertel VMF DS [Alan_Akahoshi] [Alan_Akahoshi] -vrtl-vmf-ds 1956/udp # Vertel VMF DS [Alan_Akahoshi] [Alan_Akahoshi] -unix-status 1957/tcp # unix-status [Thomas_Erskine] [Thomas_Erskine] -unix-status 1957/udp # unix-status [Thomas_Erskine] [Thomas_Erskine] -dxadmind 1958/tcp # CA Administration Daemon [John_Birrell] [John_Birrell] -dxadmind 1958/udp # CA Administration Daemon [John_Birrell] [John_Birrell] -simp-all 1959/tcp # SIMP Channel [Tim_Hunnewell] [Tim_Hunnewell] -simp-all 1959/udp # SIMP Channel [Tim_Hunnewell] [Tim_Hunnewell] -nasmanager 1960/tcp # Merit DAC NASmanager [Richard_S_Conto] [Richard_S_Conto] -nasmanager 1960/udp # Merit DAC NASmanager [Richard_S_Conto] [Richard_S_Conto] -bts-appserver 1961/tcp # BTS APPSERVER [Carl_Obsorn] [Carl_Obsorn] -bts-appserver 1961/udp # BTS APPSERVER [Carl_Obsorn] [Carl_Obsorn] -biap-mp 1962/tcp # BIAP-MP [Louis_Slothouber] [Louis_Slothouber] -biap-mp 1962/udp # BIAP-MP [Louis_Slothouber] [Louis_Slothouber] -webmachine 1963/tcp # WebMachine [Tim_Jowers] [Tim_Jowers] -webmachine 1963/udp # WebMachine [Tim_Jowers] [Tim_Jowers] -solid-e-engine 1964/tcp # SOLID E ENGINE [Ari_Valtanen] [Ari_Valtanen] -solid-e-engine 1964/udp # SOLID E ENGINE [Ari_Valtanen] [Ari_Valtanen] -tivoli-npm 1965/tcp # Tivoli NPM [Ivana_Cuozzo] [Ivana_Cuozzo] -tivoli-npm 1965/udp # Tivoli NPM [Ivana_Cuozzo] [Ivana_Cuozzo] -slush 1966/tcp # Slush [Damien_Miller] [Damien_Miller] -slush 1966/udp # Slush [Damien_Miller] [Damien_Miller] -sns-quote 1967/tcp # SNS Quote [Robert_Ellman] [Robert_Ellman] -sns-quote 1967/udp # SNS Quote [Robert_Ellman] [Robert_Ellman] -lipsinc 1968/tcp # LIPSinc -lipsinc 1968/udp # LIPSinc -lipsinc1 1969/tcp # LIPSinc 1 [Robert_Armington] [Robert_Armington] -lipsinc1 1969/udp # LIPSinc 1 [Robert_Armington] [Robert_Armington] -netop-rc 1970/tcp # NetOp Remote Control -netop-rc 1970/udp # NetOp Remote Control -netop-school 1971/tcp # NetOp School [NetOp_Technical_Supp] [NetOp_Technical_Supp] -netop-school 1971/udp # NetOp School [NetOp_Technical_Supp] [NetOp_Technical_Supp] -intersys-cache 1972/tcp # Cache [Mark_Hanson] [Mark_Hanson] -intersys-cache 1972/udp # Cache [Mark_Hanson] [Mark_Hanson] -dlsrap 1973/tcp # Data Link Switching Remote [Steve_T_Chiang] [Steve_T_Chiang] -# Access Protocol -dlsrap 1973/udp # Data Link Switching Remote [Steve_T_Chiang] [Steve_T_Chiang] -# Access Protocol -drp 1974/tcp # DRP [Richard_Alan_Johnson] [Richard_Alan_Johnson] -drp 1974/udp # DRP [Richard_Alan_Johnson] [Richard_Alan_Johnson] -tcoflashagent 1975/tcp # TCO Flash Agent -tcoflashagent 1975/udp # TCO Flash Agent -tcoregagent 1976/tcp # TCO Reg Agent -tcoregagent 1976/udp # TCO Reg Agent -tcoaddressbook 1977/tcp # TCO Address Book [Allan_Panitch] [Allan_Panitch] -tcoaddressbook 1977/udp # TCO Address Book [Allan_Panitch] [Allan_Panitch] -unisql 1978/tcp # UniSQL -unisql 1978/udp # UniSQL -unisql-java 1979/tcp # UniSQL Java [Keith_Yarbrough] [Keith_Yarbrough] -unisql-java 1979/udp # UniSQL Java [Keith_Yarbrough] [Keith_Yarbrough] -pearldoc-xact 1980/tcp # PearlDoc XACT [Chris_Vertonghen] [Chris_Vertonghen] -pearldoc-xact 1980/udp # PearlDoc XACT [Chris_Vertonghen] [Chris_Vertonghen] -p2pq 1981/tcp # p2pQ [Warren_Alexander] [Warren_Alexander] -p2pq 1981/udp # p2pQ [Warren_Alexander] [Warren_Alexander] -estamp 1982/tcp # Evidentiary Timestamp [Todd_Glassey] [Todd_Glassey] -estamp 1982/udp # Evidentiary Timestamp [Todd_Glassey] [Todd_Glassey] -lhtp 1983/tcp # Loophole Test Protocol [Kade_Hansson] [Kade_Hansson] -lhtp 1983/udp # Loophole Test Protocol [Kade_Hansson] [Kade_Hansson] -bb 1984/tcp # BB [Sean_MacGuire] [Sean_MacGuire] -bb 1984/udp # BB [Sean_MacGuire] [Sean_MacGuire] -hsrp 1985/tcp # Hot Standby Router Protocol [RFC2281] -hsrp 1985/udp # Hot Standby Router Protocol [RFC2281] -licensedaemon 1986/tcp # cisco license management -licensedaemon 1986/udp # cisco license management -tr-rsrb-p1 1987/tcp # cisco RSRB Priority 1 port -tr-rsrb-p1 1987/udp # cisco RSRB Priority 1 port -tr-rsrb-p2 1988/tcp # cisco RSRB Priority 2 port -tr-rsrb-p2 1988/udp # cisco RSRB Priority 2 port -tr-rsrb-p3 1989/tcp # cisco RSRB Priority 3 port -tr-rsrb-p3 1989/udp # cisco RSRB Priority 3 port -mshnet 1989/tcp # MHSnet system [Bob_Kummerfeld] [Bob_Kummerfeld] This entry records an unassigned but widespread use -mshnet 1989/udp # MHSnet system [Bob_Kummerfeld] [Bob_Kummerfeld] This entry records an unassigned but widespread use -stun-p1 1990/tcp # cisco STUN Priority 1 port -stun-p1 1990/udp # cisco STUN Priority 1 port -stun-p2 1991/tcp # cisco STUN Priority 2 port -stun-p2 1991/udp # cisco STUN Priority 2 port -stun-p3 1992/tcp # cisco STUN Priority 3 port -stun-p3 1992/udp # cisco STUN Priority 3 port -ipsendmsg 1992/tcp # IPsendmsg [Bob_Kummerfeld] [Bob_Kummerfeld] This entry records an unassigned but widespread use -ipsendmsg 1992/udp # IPsendmsg [Bob_Kummerfeld] [Bob_Kummerfeld] This entry records an unassigned but widespread use -snmp-tcp-port 1993/tcp # cisco SNMP TCP port -snmp-tcp-port 1993/udp # cisco SNMP TCP port -stun-port 1994/tcp # cisco serial tunnel port -stun-port 1994/udp # cisco serial tunnel port -perf-port 1995/tcp # cisco perf port -perf-port 1995/udp # cisco perf port -tr-rsrb-port 1996/tcp # cisco Remote SRB port -tr-rsrb-port 1996/udp # cisco Remote SRB port -gdp-port 1997/tcp # cisco Gateway Discovery -# Protocol -gdp-port 1997/udp # cisco Gateway Discovery -# Protocol -x25-svc-port 1998/tcp # cisco X.25 service (XOT) -x25-svc-port 1998/udp # cisco X.25 service (XOT) -tcp-id-port 1999/tcp # cisco identification port -tcp-id-port 1999/udp # cisco identification port -cisco-sccp 2000/tcp # Cisco SCCP [Dan_Wing] [Dan_Wing] 2003-11 -cisco-sccp 2000/udp # Cisco SCCp [Dan_Wing] [Dan_Wing] 2003-11 -dc 2001/tcp -wizard 2001/udp # curry -globe 2002/tcp -globe 2002/udp -brutus 2003/tcp # Brutus Server [Johannes_Skov_Frands] [Johannes_Skov_Frands] 2008-02-28 -brutus 2003/udp # Brutus Server [Johannes_Skov_Frands] [Johannes_Skov_Frands] 2008-02-28 -mailbox 2004/tcp -emce 2004/udp # CCWS mm conf -berknet 2005/tcp -oracle 2005/udp -invokator 2006/tcp -raid-cd 2006/udp # raid -dectalk 2007/tcp -raid-am 2007/udp -conf 2008/tcp -terminaldb 2008/udp -news 2009/tcp -whosockami 2009/udp -search 2010/tcp -# IANA assigned this -pipe-server 2010/udp # well-formed service name as -# a replacement for -# "pipe_server". -# This entry is an alias to "pipe-server". This entry is now -pipe_server 2010/udp # historic, not usable for use with many common service -# discovery mechanisms. -raid-cc 2011/tcp # raid -servserv 2011/udp -ttyinfo 2012/tcp -raid-ac 2012/udp -raid-am 2013/tcp -raid-cd 2013/udp -troff 2014/tcp -raid-sf 2014/udp -cypress 2015/tcp -raid-cs 2015/udp -bootserver 2016/tcp -bootserver 2016/udp -cypress-stat 2017/tcp -bootclient 2017/udp -terminaldb 2018/tcp -rellpack 2018/udp -whosockami 2019/tcp -about 2019/udp -xinupageserver 2020/tcp -xinupageserver 2020/udp -servexec 2021/tcp -xinuexpansion1 2021/udp -down 2022/tcp -xinuexpansion2 2022/udp -xinuexpansion3 2023/tcp -xinuexpansion3 2023/udp -xinuexpansion4 2024/tcp -xinuexpansion4 2024/udp -ellpack 2025/tcp -xribs 2025/udp -scrabble 2026/tcp -scrabble 2026/udp -shadowserver 2027/tcp -shadowserver 2027/udp -submitserver 2028/tcp -submitserver 2028/udp -hsrpv6 2029/tcp # Hot Standby Router Protocol [Ian_Wilson] [Ian_Wilson] 2004-11 -# IPv6 -hsrpv6 2029/udp # Hot Standby Router Protocol [Ian_Wilson] [Ian_Wilson] 2004-11 -# IPv6 -device2 2030/tcp -device2 2030/udp -mobrien-chat 2031/tcp # mobrien-chat [Mike_O_Brien] [Mike_O_Brien] 2004-11 -mobrien-chat 2031/udp # mobrien-chat [Mike_O_Brien] [Mike_O_Brien] 2004-11 -blackboard 2032/tcp -blackboard 2032/udp -glogger 2033/tcp -glogger 2033/udp -scoremgr 2034/tcp -scoremgr 2034/udp -imsldoc 2035/tcp -imsldoc 2035/udp -e-dpnet 2036/tcp # Ethernet WS DP network [Peter_Kaever] [Peter_Kaever] 2005-08 -e-dpnet 2036/udp # Ethernet WS DP network [Peter_Kaever] [Peter_Kaever] 2005-08 -applus 2037/tcp # APplus Application Server [Thomas_Boerkel] [Thomas_Boerkel] 2008-06-06 Formerly was P2plus Application Server -applus 2037/udp # APplus Application Server [Thomas_Boerkel] [Thomas_Boerkel] 2008-06-06 Formerly was P2plus Application Server -objectmanager 2038/tcp -objectmanager 2038/udp -prizma 2039/tcp # Prizma Monitoring Service [Dotan_Ofek] [Dotan_Ofek] 2005-12 -prizma 2039/udp # Prizma Monitoring Service [Dotan_Ofek] [Dotan_Ofek] 2005-12 -lam 2040/tcp -lam 2040/udp -interbase 2041/tcp -interbase 2041/udp -isis 2042/tcp # isis -isis 2042/udp # isis -isis-bcast 2043/tcp # isis-bcast [Ken_Chapman] [Ken_Chapman] -isis-bcast 2043/udp # isis-bcast [Ken_Chapman] [Ken_Chapman] -rimsl 2044/tcp -rimsl 2044/udp -cdfunc 2045/tcp -cdfunc 2045/udp -sdfunc 2046/tcp -sdfunc 2046/udp -dls 2047/tcp -dls 2047/udp -dls-monitor 2048/tcp -dls-monitor 2048/udp -shilp 2049/tcp # <== NOTE Conflict on 2049 ! -shilp 2049/udp # <== NOTE Conflict on 2049 ! -nfs 2049/tcp # Network File System - Sun [Brent_Callaghan] [Brent_Callaghan] Defined TXT keys: path= -# Microsystems -nfs 2049/udp # Network File System - Sun [Brent_Callaghan] [Brent_Callaghan] Defined TXT keys: path= -# Microsystems -nfs 2049/sctp # Network File System [RFC5665] Defined TXT keys: path= -av-emb-config 2050/tcp # Avaya EMB Config Port [John_Yeager] [John_Yeager] -av-emb-config 2050/udp # Avaya EMB Config Port [John_Yeager] [John_Yeager] -epnsdp 2051/tcp # EPNSDP [Hiroyasu_Ogata] [Hiroyasu_Ogata] -epnsdp 2051/udp # EPNSDP [Hiroyasu_Ogata] [Hiroyasu_Ogata] -clearvisn 2052/tcp # clearVisn Services Port [Dave_Lyons] [Dave_Lyons] -clearvisn 2052/udp # clearVisn Services Port [Dave_Lyons] [Dave_Lyons] -lot105-ds-upd 2053/tcp # Lot105 DSuper Updates [Piers_Scannell] [Piers_Scannell] -lot105-ds-upd 2053/udp # Lot105 DSuper Updates [Piers_Scannell] [Piers_Scannell] -weblogin 2054/tcp # Weblogin Port [Diego_Saravia] [Diego_Saravia] -weblogin 2054/udp # Weblogin Port [Diego_Saravia] [Diego_Saravia] -iop 2055/tcp # Iliad-Odyssey Protocol [Bruce_Lueckenhoff] [Bruce_Lueckenhoff] -iop 2055/udp # Iliad-Odyssey Protocol [Bruce_Lueckenhoff] [Bruce_Lueckenhoff] -omnisky 2056/tcp # OmniSky Port [Oren_Hurvitz] [Oren_Hurvitz] -omnisky 2056/udp # OmniSky Port [Oren_Hurvitz] [Oren_Hurvitz] -rich-cp 2057/tcp # Rich Content Protocol [Ronen_Vainish] [Ronen_Vainish] -rich-cp 2057/udp # Rich Content Protocol [Ronen_Vainish] [Ronen_Vainish] -newwavesearch 2058/tcp # NewWaveSearchables RMI [Thomas_Kerkau] [Thomas_Kerkau] -newwavesearch 2058/udp # NewWaveSearchables RMI [Thomas_Kerkau] [Thomas_Kerkau] -bmc-messaging 2059/tcp # BMC Messaging Service [Portnoy_Boxman] [Portnoy_Boxman] -bmc-messaging 2059/udp # BMC Messaging Service [Portnoy_Boxman] [Portnoy_Boxman] -teleniumdaemon 2060/tcp # Telenium Daemon IF [Nick_Woronuk] [Nick_Woronuk] -teleniumdaemon 2060/udp # Telenium Daemon IF [Nick_Woronuk] [Nick_Woronuk] -netmount 2061/tcp # NetMount [Alex_Oberlander] [Alex_Oberlander] -netmount 2061/udp # NetMount [Alex_Oberlander] [Alex_Oberlander] -icg-swp 2062/tcp # ICG SWP Port -icg-swp 2062/udp # ICG SWP Port -icg-bridge 2063/tcp # ICG Bridge Port -icg-bridge 2063/udp # ICG Bridge Port -icg-iprelay 2064/tcp # ICG IP Relay Port [Steve_Quintana] [Steve_Quintana] -icg-iprelay 2064/udp # ICG IP Relay Port [Steve_Quintana] [Steve_Quintana] -dlsrpn 2065/tcp # Data Link Switch Read Port [Amir_Peless] [Amir_Peless] -# Number -dlsrpn 2065/udp # Data Link Switch Read Port [Amir_Peless] [Amir_Peless] -# Number -aura 2066/tcp # AVM USB Remote Architecture [Diego_Friedel] [Diego_Friedel] 2006-03 -aura 2066/udp # AVM USB Remote Architecture [Diego_Friedel] [Diego_Friedel] 2006-03 -dlswpn 2067/tcp # Data Link Switch Write Port [Amir_Peless] [Amir_Peless] -# Number -dlswpn 2067/udp # Data Link Switch Write Port [Amir_Peless] [Amir_Peless] -# Number -avauthsrvprtcl 2068/tcp # Avocent AuthSrv Protocol [Steven_W_Clark_2] [Steven_W_Clark_2] -avauthsrvprtcl 2068/udp # Avocent AuthSrv Protocol [Steven_W_Clark_2] [Steven_W_Clark_2] -event-port 2069/tcp # HTTP Event Port [Larry_Emlich] [Larry_Emlich] -event-port 2069/udp # HTTP Event Port [Larry_Emlich] [Larry_Emlich] -ah-esp-encap 2070/tcp # AH and ESP Encapsulated in [Amy_Weaver] [Amy_Weaver] -# UDP packet -ah-esp-encap 2070/udp # AH and ESP Encapsulated in [Amy_Weaver] [Amy_Weaver] -# UDP packet -acp-port 2071/tcp # Axon Control Protocol [Christiaan_Simons] [Christiaan_Simons] -acp-port 2071/udp # Axon Control Protocol [Christiaan_Simons] [Christiaan_Simons] -msync 2072/tcp # GlobeCast mSync [Piers_Scannell_2] [Piers_Scannell_2] -msync 2072/udp # GlobeCast mSync [Piers_Scannell_2] [Piers_Scannell_2] -gxs-data-port 2073/tcp # DataReel Database Socket [Douglas_M_Gaer] [Douglas_M_Gaer] -gxs-data-port 2073/udp # DataReel Database Socket [Douglas_M_Gaer] [Douglas_M_Gaer] -vrtl-vmf-sa 2074/tcp # Vertel VMF SA [Alan_Akahoshi] [Alan_Akahoshi] -vrtl-vmf-sa 2074/udp # Vertel VMF SA [Alan_Akahoshi] [Alan_Akahoshi] -newlixengine 2075/tcp # Newlix ServerWare Engine -newlixengine 2075/udp # Newlix ServerWare Engine -newlixconfig 2076/tcp # Newlix JSPConfig [Jean_Serge_Gagnon] [Jean_Serge_Gagnon] -newlixconfig 2076/udp # Newlix JSPConfig [Jean_Serge_Gagnon] [Jean_Serge_Gagnon] -tsrmagt 2077/tcp # Old Tivoli Storage Manager -tsrmagt 2077/udp # Old Tivoli Storage Manager -tpcsrvr 2078/tcp # IBM Total Productivity [Justin_R_Bendich] [Justin_R_Bendich] -# Center Server -tpcsrvr 2078/udp # IBM Total Productivity [Justin_R_Bendich] [Justin_R_Bendich] -# Center Server -idware-router 2079/tcp # IDWARE Router Port [Zdenek_Kolba] [Zdenek_Kolba] -idware-router 2079/udp # IDWARE Router Port [Zdenek_Kolba] [Zdenek_Kolba] -autodesk-nlm 2080/tcp # Autodesk NLM (FLEXlm) [Greg_Suppes] [Greg_Suppes] -autodesk-nlm 2080/udp # Autodesk NLM (FLEXlm) [Greg_Suppes] [Greg_Suppes] -kme-trap-port 2081/tcp # KME PRINTER TRAP PORT [Masakatsu_Matsuo] [Masakatsu_Matsuo] -kme-trap-port 2081/udp # KME PRINTER TRAP PORT [Masakatsu_Matsuo] [Masakatsu_Matsuo] -infowave 2082/tcp # Infowave Mobility Server [Kaz_Kylheku] [Kaz_Kylheku] -infowave 2082/udp # Infowave Mobility Server [Kaz_Kylheku] [Kaz_Kylheku] -# The TCP port 2083 was already previously assigned by IANA for -# "RadSec", an early implementation of RADIUS/TLS, prior to -radsec 2083/tcp # Secure Radius Service [IESG] [IETF_Chair] 2005-05 [RFC6614] issuance of this RFC. This early implementation can be -# configured to be compatible to RADIUS/TLS as specified by the -# IETF. See [RFC6614], Appendix A for details. -# The UDP port 2083 was already previously assigned by IANA for -radsec 2083/udp # Secure Radius Service [IESG] [IETF_Chair] 2005-05 2014-07-14 [RFC7360] "RadSec", an early implementation of RADIUS/TLS, prior to -# issuance of this RFC. -sunclustergeo 2084/tcp # SunCluster Geographic [Oracle_2] [Steve_McKinty] 2005-11 2013-08-14 -sunclustergeo 2084/udp # SunCluster Geographic [Oracle_2] [Steve_McKinty] 2005-11 2013-08-14 -ada-cip 2085/tcp # ADA Control [Eugene_Frenkel] [Eugene_Frenkel] 2005-11 -ada-cip 2085/udp # ADA Control [Eugene_Frenkel] [Eugene_Frenkel] 2005-11 -gnunet 2086/tcp # GNUnet [Christian_Grothoff] [Christian_Grothoff] 2002-10 -gnunet 2086/udp # GNUnet [Christian_Grothoff] [Christian_Grothoff] 2002-10 -eli 2087/tcp # ELI - Event Logging [Maya_Zimerman] [Maya_Zimerman] -# Integration -eli 2087/udp # ELI - Event Logging [Maya_Zimerman] [Maya_Zimerman] -# Integration -ip-blf 2088/tcp # IP Busy Lamp Field [Jeffrey_Szczepanski] [Jeffrey_Szczepanski] 2005-02 -ip-blf 2088/udp # IP Busy Lamp Field [Jeffrey_Szczepanski] [Jeffrey_Szczepanski] 2005-02 -sep 2089/tcp # Security Encapsulation [Maya_Zimerman] [Maya_Zimerman] -# Protocol - SEP -sep 2089/udp # Security Encapsulation [Maya_Zimerman] [Maya_Zimerman] -# Protocol - SEP -lrp 2090/tcp # Load Report Protocol [Amir_Peless] [Amir_Peless] -lrp 2090/udp # Load Report Protocol [Amir_Peless] [Amir_Peless] -prp 2091/tcp # PRP [Amir_Peless] [Amir_Peless] -prp 2091/udp # PRP [Amir_Peless] [Amir_Peless] -descent3 2092/tcp # Descent 3 [Kevin_Bentley] [Kevin_Bentley] -descent3 2092/udp # Descent 3 [Kevin_Bentley] [Kevin_Bentley] -nbx-cc 2093/tcp # NBX CC -nbx-cc 2093/udp # NBX CC -nbx-au 2094/tcp # NBX AU -nbx-au 2094/udp # NBX AU -nbx-ser 2095/tcp # NBX SER -nbx-ser 2095/udp # NBX SER -nbx-dir 2096/tcp # NBX DIR [Henry_Houh] [Henry_Houh] -nbx-dir 2096/udp # NBX DIR [Henry_Houh] [Henry_Houh] -jetformpreview 2097/tcp # Jet Form Preview [Zygmunt_Wiercioch] [Zygmunt_Wiercioch] -jetformpreview 2097/udp # Jet Form Preview [Zygmunt_Wiercioch] [Zygmunt_Wiercioch] -dialog-port 2098/tcp # Dialog Port [Joseph_Mathew] [Joseph_Mathew] -dialog-port 2098/udp # Dialog Port [Joseph_Mathew] [Joseph_Mathew] -h2250-annex-g 2099/tcp # H.225.0 Annex G Signalling [ITU-T] [ITU-T_TSB] 2013-01-31 -h2250-annex-g 2099/udp # H.225.0 Annex G Signalling [ITU-T] [ITU-T_TSB] 2013-01-31 -amiganetfs 2100/tcp # Amiga Network Filesystem [Rudi_Chiarito] [Rudi_Chiarito] -amiganetfs 2100/udp # Amiga Network Filesystem [Rudi_Chiarito] [Rudi_Chiarito] -rtcm-sc104 2101/tcp # rtcm-sc104 [Wolfgang_Rupprecht] [Wolfgang_Rupprecht] -rtcm-sc104 2101/udp # rtcm-sc104 [Wolfgang_Rupprecht] [Wolfgang_Rupprecht] -zephyr-srv 2102/tcp # Zephyr server -zephyr-srv 2102/udp # Zephyr server -zephyr-clt 2103/tcp # Zephyr serv-hm connection -zephyr-clt 2103/udp # Zephyr serv-hm connection -zephyr-hm 2104/tcp # Zephyr hostmanager [Greg_Hudson] [Greg_Hudson] -zephyr-hm 2104/udp # Zephyr hostmanager [Greg_Hudson] [Greg_Hudson] -minipay 2105/tcp # MiniPay [Amir_Herzberg] [Amir_Herzberg] -minipay 2105/udp # MiniPay [Amir_Herzberg] [Amir_Herzberg] -mzap 2106/tcp # MZAP [Dave_Thaler_2] [Dave_Thaler_2] -mzap 2106/udp # MZAP [Dave_Thaler_2] [Dave_Thaler_2] -bintec-admin 2107/tcp # BinTec Admin [Thomas_Schmidt] [Thomas_Schmidt] -bintec-admin 2107/udp # BinTec Admin [Thomas_Schmidt] [Thomas_Schmidt] -comcam 2108/tcp # Comcam [Don_Gilbreath] [Don_Gilbreath] -comcam 2108/udp # Comcam [Don_Gilbreath] [Don_Gilbreath] -ergolight 2109/tcp # Ergolight [Jindra_Ryvola] [Jindra_Ryvola] -ergolight 2109/udp # Ergolight [Jindra_Ryvola] [Jindra_Ryvola] -umsp 2110/tcp # UMSP [Alexander_Bogdanov_2] [Alexander_Bogdanov_2] -umsp 2110/udp # UMSP [Alexander_Bogdanov_2] [Alexander_Bogdanov_2] -dsatp 2111/tcp # OPNET Dynamic Sampling Agent [OPNET_Technologies_Inc] [Edward_Macomber] 2011-09-21 -# Transaction Protocol -dsatp 2111/udp # OPNET Dynamic Sampling Agent [OPNET_Technologies_Inc] [Edward_Macomber] 2011-09-21 -# Transaction Protocol -idonix-metanet 2112/tcp # Idonix MetaNet [Paul_Harrison] [Paul_Harrison] -idonix-metanet 2112/udp # Idonix MetaNet [Paul_Harrison] [Paul_Harrison] -hsl-storm 2113/tcp # HSL StoRM [Jost_Faganel] [Jost_Faganel] -hsl-storm 2113/udp # HSL StoRM [Jost_Faganel] [Jost_Faganel] -newheights 2114/tcp # NEWHEIGHTS [Michael_Levy] [Michael_Levy] -newheights 2114/udp # NEWHEIGHTS [Michael_Levy] [Michael_Levy] -kdm 2115/tcp # Key Distribution Manager [Mike_Little] [Mike_Little] -kdm 2115/udp # Key Distribution Manager [Mike_Little] [Mike_Little] -ccowcmr 2116/tcp # CCOWCMR [Mark_Morwood] [Mark_Morwood] -ccowcmr 2116/udp # CCOWCMR [Mark_Morwood] [Mark_Morwood] -mentaclient 2117/tcp # MENTACLIENT -mentaclient 2117/udp # MENTACLIENT -mentaserver 2118/tcp # MENTASERVER [Ilan_Shlosberg] [Ilan_Shlosberg] -mentaserver 2118/udp # MENTASERVER [Ilan_Shlosberg] [Ilan_Shlosberg] -gsigatekeeper 2119/tcp # GSIGATEKEEPER [Steve_Tuecke] [Steve_Tuecke] -gsigatekeeper 2119/udp # GSIGATEKEEPER [Steve_Tuecke] [Steve_Tuecke] -qencp 2120/tcp # Quick Eagle Networks CP [Santa_Dasu] [Santa_Dasu] -qencp 2120/udp # Quick Eagle Networks CP [Santa_Dasu] [Santa_Dasu] -scientia-ssdb 2121/tcp # SCIENTIA-SSDB [SYSTEMS_MANAGER] [SYSTEMS_MANAGER] -scientia-ssdb 2121/udp # SCIENTIA-SSDB [SYSTEMS_MANAGER] [SYSTEMS_MANAGER] -caupc-remote 2122/tcp # CauPC Remote Control [Environics_Oy] [Environics_Oy] -caupc-remote 2122/udp # CauPC Remote Control [Environics_Oy] [Environics_Oy] -gtp-control 2123/tcp # GTP-Control Plane (3GPP) [Alessio_Casati] [Alessio_Casati] -gtp-control 2123/udp # GTP-Control Plane (3GPP) [Alessio_Casati] [Alessio_Casati] -elatelink 2124/tcp # ELATELINK [Tim_Lawrence] [Tim_Lawrence] -elatelink 2124/udp # ELATELINK [Tim_Lawrence] [Tim_Lawrence] -lockstep 2125/tcp # LOCKSTEP [Karl_Forster] [Karl_Forster] -lockstep 2125/udp # LOCKSTEP [Karl_Forster] [Karl_Forster] -pktcable-cops 2126/tcp # PktCable-COPS [Glenn_Russell] [Glenn_Russell] -pktcable-cops 2126/udp # PktCable-COPS [Glenn_Russell] [Glenn_Russell] -index-pc-wb 2127/tcp # INDEX-PC-WB [James_David_Fisher] [James_David_Fisher] -index-pc-wb 2127/udp # INDEX-PC-WB [James_David_Fisher] [James_David_Fisher] -net-steward 2128/tcp # Net Steward Control [Martin_Norman] [Martin_Norman] -net-steward 2128/udp # Net Steward Control [Martin_Norman] [Martin_Norman] -cs-live 2129/tcp # cs-live.com [Matt_Lachance] [Matt_Lachance] -cs-live 2129/udp # cs-live.com [Matt_Lachance] [Matt_Lachance] -xds 2130/tcp # XDS [Peter_Zurich] [Peter_Zurich] -xds 2130/udp # XDS [Peter_Zurich] [Peter_Zurich] -avantageb2b 2131/tcp # Avantageb2b [Avi_Software] [Avi_Software] -avantageb2b 2131/udp # Avantageb2b [Avi_Software] [Avi_Software] -solera-epmap 2132/tcp # SoleraTec End Point Map [Mark_Armstrong] [Mark_Armstrong] -solera-epmap 2132/udp # SoleraTec End Point Map [Mark_Armstrong] [Mark_Armstrong] -zymed-zpp 2133/tcp # ZYMED-ZPP [Gregg_Welker] [Gregg_Welker] -zymed-zpp 2133/udp # ZYMED-ZPP [Gregg_Welker] [Gregg_Welker] -avenue 2134/tcp # AVENUE [Jason_Cater] [Jason_Cater] -avenue 2134/udp # AVENUE [Jason_Cater] [Jason_Cater] -gris 2135/tcp # Grid Resource Information [Steve_Tuecke] [Steve_Tuecke] -# Server -gris 2135/udp # Grid Resource Information [Steve_Tuecke] [Steve_Tuecke] -# Server -appworxsrv 2136/tcp # APPWORXSRV [Fred_McLain] [Fred_McLain] -appworxsrv 2136/udp # APPWORXSRV [Fred_McLain] [Fred_McLain] -connect 2137/tcp # CONNECT [Reid_Ligon] [Reid_Ligon] -connect 2137/udp # CONNECT [Reid_Ligon] [Reid_Ligon] -unbind-cluster 2138/tcp # UNBIND-CLUSTER [Francois_Harvey] [Francois_Harvey] -unbind-cluster 2138/udp # UNBIND-CLUSTER [Francois_Harvey] [Francois_Harvey] -ias-auth 2139/tcp # IAS-AUTH -ias-auth 2139/udp # IAS-AUTH -ias-reg 2140/tcp # IAS-REG -ias-reg 2140/udp # IAS-REG -ias-admind 2141/tcp # IAS-ADMIND [Baiju_V_Patel] [Baiju_V_Patel] -ias-admind 2141/udp # IAS-ADMIND [Baiju_V_Patel] [Baiju_V_Patel] -tdmoip 2142/tcp # TDM OVER IP [RFC5087] -tdmoip 2142/udp # TDM OVER IP [RFC5087] -lv-jc 2143/tcp # Live Vault Job Control -lv-jc 2143/udp # Live Vault Job Control -lv-ffx 2144/tcp # Live Vault Fast Object -# Transfer -lv-ffx 2144/udp # Live Vault Fast Object -# Transfer -lv-pici 2145/tcp # Live Vault Remote Diagnostic -# Console Support -lv-pici 2145/udp # Live Vault Remote Diagnostic -# Console Support -lv-not 2146/tcp # Live Vault Admin Event -# Notification -lv-not 2146/udp # Live Vault Admin Event -# Notification -lv-auth 2147/tcp # Live Vault Authentication [Ted_Hess] [Ted_Hess] -lv-auth 2147/udp # Live Vault Authentication [Ted_Hess] [Ted_Hess] -veritas-ucl 2148/tcp # VERITAS UNIVERSAL [Songlin_Ren] [Songlin_Ren] -# COMMUNICATION LAYER -veritas-ucl 2148/udp # VERITAS UNIVERSAL [Songlin_Ren] [Songlin_Ren] -# COMMUNICATION LAYER -acptsys 2149/tcp # ACPTSYS [Michael_Lekias] [Michael_Lekias] -acptsys 2149/udp # ACPTSYS [Michael_Lekias] [Michael_Lekias] -dynamic3d 2150/tcp # DYNAMIC3D [Tobias_Wegner] [Tobias_Wegner] -dynamic3d 2150/udp # DYNAMIC3D [Tobias_Wegner] [Tobias_Wegner] -docent 2151/tcp # DOCENT [Hali_Lindbloom] [Hali_Lindbloom] -docent 2151/udp # DOCENT [Hali_Lindbloom] [Hali_Lindbloom] -gtp-user 2152/tcp # GTP-User Plane (3GPP) [Alessio_Casati] [Alessio_Casati] -gtp-user 2152/udp # GTP-User Plane (3GPP) [Alessio_Casati] [Alessio_Casati] -ctlptc 2153/tcp # Control Protocol -ctlptc 2153/udp # Control Protocol -stdptc 2154/tcp # Standard Protocol -stdptc 2154/udp # Standard Protocol -brdptc 2155/tcp # Bridge Protocol [Hideki_Hatta] [Hideki_Hatta] 2007-09-27 -brdptc 2155/udp # Bridge Protocol [Hideki_Hatta] [Hideki_Hatta] 2007-09-27 -trp 2156/tcp # Talari Reliable Protocol [John_E_Dickey] [John_E_Dickey] 2007-09-27 -trp 2156/udp # Talari Reliable Protocol [John_E_Dickey] [John_E_Dickey] 2007-09-27 -xnds 2157/tcp # Xerox Network Document Scan [William_R_Lear] [William_R_Lear] 2008-03-06 -# Protocol -xnds 2157/udp # Xerox Network Document Scan [William_R_Lear] [William_R_Lear] 2008-03-06 -# Protocol -touchnetplus 2158/tcp # TouchNetPlus Service [Brian_Toothill] [Brian_Toothill] 2008-03-06 -touchnetplus 2158/udp # TouchNetPlus Service [Brian_Toothill] [Brian_Toothill] 2008-03-06 -gdbremote 2159/tcp # GDB Remote Debug Port [Nigel_Stephens] [Nigel_Stephens] -gdbremote 2159/udp # GDB Remote Debug Port [Nigel_Stephens] [Nigel_Stephens] -apc-2160 2160/tcp # APC 2160 [American_Power_Conve] [American_Power_Conve] -apc-2160 2160/udp # APC 2160 [American_Power_Conve] [American_Power_Conve] -apc-2161 2161/tcp # APC 2161 [American_Power_Conve] [American_Power_Conve] -apc-2161 2161/udp # APC 2161 [American_Power_Conve] [American_Power_Conve] -navisphere 2162/tcp # Navisphere -navisphere 2162/udp # Navisphere -navisphere-sec 2163/tcp # Navisphere Secure [Andreas_Bauer] [Andreas_Bauer] -navisphere-sec 2163/udp # Navisphere Secure [Andreas_Bauer] [Andreas_Bauer] -ddns-v3 2164/tcp # Dynamic DNS Version 3 [Alan_Yates] [Alan_Yates] -ddns-v3 2164/udp # Dynamic DNS Version 3 [Alan_Yates] [Alan_Yates] -x-bone-api 2165/tcp # X-Bone API [Joe_Touch] [Joe_Touch] -x-bone-api 2165/udp # X-Bone API [Joe_Touch] [Joe_Touch] -iwserver 2166/tcp # iwserver [Fred_Surr] [Fred_Surr] -iwserver 2166/udp # iwserver [Fred_Surr] [Fred_Surr] -raw-serial 2167/tcp # Raw Async Serial Link [Benjamin_Green] [Benjamin_Green] -raw-serial 2167/udp # Raw Async Serial Link [Benjamin_Green] [Benjamin_Green] -easy-soft-mux 2168/tcp # easy-soft Multiplexer [Norbert_Kintzler] [Norbert_Kintzler] 2004-11 -easy-soft-mux 2168/udp # easy-soft Multiplexer [Norbert_Kintzler] [Norbert_Kintzler] 2004-11 -# Backbone for Academic -brain 2169/tcp # Information Notification [Archishmat_Gore] [Archishmat_Gore] 2004-11 -# (BRAIN) -# Backbone for Academic -brain 2169/udp # Information Notification [Archishmat_Gore] [Archishmat_Gore] 2004-11 -# (BRAIN) -eyetv 2170/tcp # EyeTV Server Port [Elgato_Systems] [Elgato_Systems] 2004-11 -eyetv 2170/udp # EyeTV Server Port [Elgato_Systems] [Elgato_Systems] 2004-11 -msfw-storage 2171/tcp # MS Firewall Storage -msfw-storage 2171/udp # MS Firewall Storage -msfw-s-storage 2172/tcp # MS Firewall SecureStorage -msfw-s-storage 2172/udp # MS Firewall SecureStorage -msfw-replica 2173/tcp # MS Firewall Replication -msfw-replica 2173/udp # MS Firewall Replication -msfw-array 2174/tcp # MS Firewall Intra Array [Itai_Greenberg] [Itai_Greenberg] 2004-11 -msfw-array 2174/udp # MS Firewall Intra Array [Itai_Greenberg] [Itai_Greenberg] 2004-11 -airsync 2175/tcp # Microsoft Desktop AirSync -# Protocol -airsync 2175/udp # Microsoft Desktop AirSync -# Protocol -rapi 2176/tcp # Microsoft ActiveSync Remote [Jon_Xu] [Jon_Xu] 2005-08 -# API -rapi 2176/udp # Microsoft ActiveSync Remote [Jon_Xu] [Jon_Xu] 2005-08 -# API -qwave 2177/tcp # qWAVE Bandwidth Estimate [Gabe_Frost] [Gabe_Frost] 2005-08 -qwave 2177/udp # qWAVE Bandwidth Estimate [Gabe_Frost] [Gabe_Frost] 2005-08 -bitspeer 2178/tcp # Peer Services for BITS [Jeff_Roberts] [Jeff_Roberts] 2005-11 -bitspeer 2178/udp # Peer Services for BITS [Jeff_Roberts] [Jeff_Roberts] 2005-11 -vmrdp 2179/tcp # Microsoft RDP for virtual [Brian_Henry] [Brian_Henry] 2007-03 -# machines -vmrdp 2179/udp # Microsoft RDP for virtual [Brian_Henry] [Brian_Henry] 2007-03 -# machines -mc-gt-srv 2180/tcp # Millicent Vendor Gateway [Steve_Glassman] [Steve_Glassman] -# Server -mc-gt-srv 2180/udp # Millicent Vendor Gateway [Steve_Glassman] [Steve_Glassman] -# Server -eforward 2181/tcp # eforward [Greg_Pringle] [Greg_Pringle] -eforward 2181/udp # eforward [Greg_Pringle] [Greg_Pringle] -cgn-stat 2182/tcp # CGN status -cgn-stat 2182/udp # CGN status -cgn-config 2183/tcp # Code Green configuration [Chris_Michaelson] [Chris_Michaelson] 2005-08 -cgn-config 2183/udp # Code Green configuration [Chris_Michaelson] [Chris_Michaelson] 2005-08 -nvd 2184/tcp # NVD User [Yves_Gattegno] [Yves_Gattegno] 2004-12 -nvd 2184/udp # NVD User [Yves_Gattegno] [Yves_Gattegno] 2004-12 -onbase-dds 2185/tcp # OnBase Distributed Disk [Paul_Tam] [Paul_Tam] 2004-12 -# Services -onbase-dds 2185/udp # OnBase Distributed Disk [Paul_Tam] [Paul_Tam] 2004-12 -# Services -gtaua 2186/tcp # Guy-Tek Automated Update [Daniel_Story] [Daniel_Story] 2008-01-25 -# Applications -gtaua 2186/udp # Guy-Tek Automated Update [Daniel_Story] [Daniel_Story] 2008-01-25 -# Applications -ssmc 2187/tcp # Sepehr System Management -# Control -ssmd 2187/udp # Sepehr System Management [Shahriar_Pourazin] [Shahriar_Pourazin] 2008-12-02 -# Data -radware-rpm 2188/tcp # Radware Resource Pool [Radware_LTD] [Samuel_Bercovici] 2011-08-05 -# Manager -# 2188 udp Reserved -radware-rpm-s 2189/tcp # Secure Radware Resource Pool [Radware_LTD] [Samuel_Bercovici] 2011-08-05 -# Manager -# 2189 udp Reserved -tivoconnect 2190/tcp # TiVoConnect Beacon [Jeffrey_J_Peters] [Jeffrey_J_Peters] 2002-08 -tivoconnect 2190/udp # TiVoConnect Beacon [Jeffrey_J_Peters] [Jeffrey_J_Peters] 2002-08 -tvbus 2191/tcp # TvBus Messaging [Brian_W_Beach] [Brian_W_Beach] 2003-01 -tvbus 2191/udp # TvBus Messaging [Brian_W_Beach] [Brian_W_Beach] 2003-01 -asdis 2192/tcp # ASDIS software management [ASDIS_Support] [ASDIS_Support] 2005-08 -asdis 2192/udp # ASDIS software management [ASDIS_Support] [ASDIS_Support] 2005-08 -drwcs 2193/tcp # Dr.Web Enterprise Management [Eugeny_Gladkih] [Eugeny_Gladkih] 2008-01-31 -# Service -drwcs 2193/udp # Dr.Web Enterprise Management [Eugeny_Gladkih] [Eugeny_Gladkih] 2008-01-31 -# Service -# Unauthorized -# 2194-2196 Unassigned Use Known on -# ports -# 2194-2196 -mnp-exchange 2197/tcp # MNP data exchange [Peter_Pramberger] [Peter_Pramberger] 2004-11 -mnp-exchange 2197/udp # MNP data exchange [Peter_Pramberger] [Peter_Pramberger] 2004-11 -onehome-remote 2198/tcp # OneHome Remote Access -onehome-remote 2198/udp # OneHome Remote Access -onehome-help 2199/tcp # OneHome Service Port [Jim_Herman] [Jim_Herman] 2005-08 -onehome-help 2199/udp # OneHome Service Port [Jim_Herman] [Jim_Herman] 2005-08 -ici 2200/tcp # ICI [Brent_Hines] [Brent_Hines] -ici 2200/udp # ICI [Brent_Hines] [Brent_Hines] -ats 2201/tcp # Advanced Training System -# Program -ats 2201/udp # Advanced Training System -# Program -imtc-map 2202/tcp # Int. Multimedia [Pat_Galvin] [Pat_Galvin] -# Teleconferencing Cosortium -imtc-map 2202/udp # Int. Multimedia [Pat_Galvin] [Pat_Galvin] -# Teleconferencing Cosortium -b2-runtime 2203/tcp # b2 Runtime Protocol -b2-runtime 2203/udp # b2 Runtime Protocol -b2-license 2204/tcp # b2 License Server [Helge_Frank_Zimpel] [Helge_Frank_Zimpel] 2006-01 -b2-license 2204/udp # b2 License Server [Helge_Frank_Zimpel] [Helge_Frank_Zimpel] 2006-01 -jps 2205/tcp # Java Presentation Server [Leif_Jakob] [Leif_Jakob] 2006-01 -jps 2205/udp # Java Presentation Server [Leif_Jakob] [Leif_Jakob] 2006-01 -hpocbus 2206/tcp # HP OpenCall bus [Jerome_Forissier] [Jerome_Forissier] 2005-12 -hpocbus 2206/udp # HP OpenCall bus [Jerome_Forissier] [Jerome_Forissier] 2005-12 -hpssd 2207/tcp # HP Status and Services [Donald_Welch] [Donald_Welch] 2006-05 -hpssd 2207/udp # HP Status and Services [Donald_Welch] [Donald_Welch] 2006-05 -hpiod 2208/tcp # HP I/O Backend [David_Suffield] [David_Suffield] 2006-05 -hpiod 2208/udp # HP I/O Backend [David_Suffield] [David_Suffield] 2006-05 -rimf-ps 2209/tcp # HP RIM for Files Portal [Patty_Ho] [Patty_Ho] 2007-05 -# Service -rimf-ps 2209/udp # HP RIM for Files Portal [Patty_Ho] [Patty_Ho] 2007-05 -# Service -noaaport 2210/tcp # NOAAPORT Broadcast Network -noaaport 2210/udp # NOAAPORT Broadcast Network -emwin 2211/tcp # EMWIN [Antonio_Querubin] [Antonio_Querubin] 2008-03-10 -emwin 2211/udp # EMWIN [Antonio_Querubin] [Antonio_Querubin] 2008-03-10 -leecoposserver 2212/tcp # LeeCO POS Server Service [Patrick_Lee] [Patrick_Lee] 2008-03-10 -leecoposserver 2212/udp # LeeCO POS Server Service [Patrick_Lee] [Patrick_Lee] 2008-03-10 -kali 2213/tcp # Kali [Jay_Cotton] [Jay_Cotton] -kali 2213/udp # Kali [Jay_Cotton] [Jay_Cotton] -rpi 2214/tcp # RDQ Protocol Interface [Les_Mather] [Les_Mather] 2005-12 -rpi 2214/udp # RDQ Protocol Interface [Les_Mather] [Les_Mather] 2005-12 -ipcore 2215/tcp # IPCore.co.za GPRS [Administrator] [Administrator] 2005-12 -ipcore 2215/udp # IPCore.co.za GPRS [Administrator] [Administrator] 2005-12 -vtu-comms 2216/tcp # VTU data service [David_Barrass] [David_Barrass] 2006-01 -vtu-comms 2216/udp # VTU data service [David_Barrass] [David_Barrass] 2006-01 -gotodevice 2217/tcp # GoToDevice Device Management [John_Lisek] [John_Lisek] 2006-01 -gotodevice 2217/udp # GoToDevice Device Management [John_Lisek] [John_Lisek] 2006-01 -bounzza 2218/tcp # Bounzza IRC Proxy [Danko_Alexeyev] [Danko_Alexeyev] 2006-02 -bounzza 2218/udp # Bounzza IRC Proxy [Danko_Alexeyev] [Danko_Alexeyev] 2006-02 -netiq-ncap 2219/tcp # NetIQ NCAP Protocol [Roger_Huebner] [Roger_Huebner] 2010-08-25 -netiq-ncap 2219/udp # NetIQ NCAP Protocol [Roger_Huebner] [Roger_Huebner] 2010-08-25 -netiq 2220/tcp # NetIQ End2End [Michael_Sharpe] [Michael_Sharpe] 2010-09-14 -netiq 2220/udp # NetIQ End2End [Michael_Sharpe] [Michael_Sharpe] 2010-09-14 -ethernet-ip-s 2221/tcp # EtherNet/IP over TLS [ODVA_Inc] [Brian_Batke_3] 2015-05-28 -ethernet-ip-s 2221/udp # EtherNet/IP over DTLS [ODVA_Inc] [Brian_Batke_3] 2015-05-28 -# EtherNet/IP I/O -# -EtherNet-IP-1 2222/tcp # IANA assigned this [Brian_Batke_2] [Brian_Batke_2] New contact added for port 2222 on 2008-02-01 -# well-formed service name as -# a replacement for -# "EtherNet/IP-1". -# New contact added for port 2222 on 2008-02-01 This entry is -EtherNet/IP-1 2222/tcp # EtherNet/IP I/O [Brian_Batke_2] [Brian_Batke_2] an alias to "EtherNet-IP-1". This entry is now historic, not -# usable for use with many common service discovery mechanisms. -# EtherNet/IP I/O -# -EtherNet-IP-1 2222/udp # IANA assigned this [Brian_Batke_2] [Brian_Batke_2] New contact added for port 2222 on 2008-02-01 -# well-formed service name as -# a replacement for -# "EtherNet/IP-1". -# New contact added for port 2222 on 2008-02-01 This entry is -EtherNet/IP-1 2222/udp # EtherNet/IP I/O [Brian_Batke_2] [Brian_Batke_2] an alias to "EtherNet-IP-1". This entry is now historic, not -# usable for use with many common service discovery mechanisms. -rockwell-csp2 2223/tcp # Rockwell CSP2 [Brian_Batke] [Brian_Batke] -rockwell-csp2 2223/udp # Rockwell CSP2 [Brian_Batke] [Brian_Batke] -efi-mg 2224/tcp # Easy Flexible [Thomas_Efer] [Thomas_Efer] 2006-03 -# Internet/Multiplayer Games -efi-mg 2224/udp # Easy Flexible [Thomas_Efer] [Thomas_Efer] 2006-03 -# Internet/Multiplayer Games -rcip-itu 2225/tcp # Resource Connection [ITU_TSB] [ITU_TSB] -# Initiation Protocol -# 2225 udp Reserved -rcip-itu 2225/sctp # Resource Connection [ITU_TSB] [ITU_TSB] -# Initiation Protocol -di-drm 2226/tcp # Digital Instinct DRM -di-drm 2226/udp # Digital Instinct DRM -di-msg 2227/tcp # DI Messaging Service [Sean_Ni] [Sean_Ni] 2006-02 -di-msg 2227/udp # DI Messaging Service [Sean_Ni] [Sean_Ni] 2006-02 -ehome-ms 2228/tcp # eHome Message Server [Peter_Gabriel] [Peter_Gabriel] 2006-01 -ehome-ms 2228/udp # eHome Message Server [Peter_Gabriel] [Peter_Gabriel] 2006-01 -datalens 2229/tcp # DataLens Service [Christopher_Bidwell] [Christopher_Bidwell] 2006-02 -datalens 2229/udp # DataLens Service [Christopher_Bidwell] [Christopher_Bidwell] 2006-02 -queueadm 2230/tcp # MetaSoft Job Queue [Ilya_Melamed] [Ilya_Melamed] 2006-06 -# Administration Service -queueadm 2230/udp # MetaSoft Job Queue [Ilya_Melamed] [Ilya_Melamed] 2006-06 -# Administration Service -wimaxasncp 2231/tcp # WiMAX ASN Control Plane [Prakash_Iyer] [Prakash_Iyer] 2006-06 -# Protocol -wimaxasncp 2231/udp # WiMAX ASN Control Plane [Prakash_Iyer] [Prakash_Iyer] 2006-06 -# Protocol -ivs-video 2232/tcp # IVS Video default [Thierry_Turletti] [Thierry_Turletti] -ivs-video 2232/udp # IVS Video default [Thierry_Turletti] [Thierry_Turletti] -infocrypt 2233/tcp # INFOCRYPT [Erica_Liu] [Erica_Liu] -infocrypt 2233/udp # INFOCRYPT [Erica_Liu] [Erica_Liu] -directplay 2234/tcp # DirectPlay [Ajay_Jindal] [Ajay_Jindal] -directplay 2234/udp # DirectPlay [Ajay_Jindal] [Ajay_Jindal] -sercomm-wlink 2235/tcp # Sercomm-WLink [Melinda_Tsao] [Melinda_Tsao] -sercomm-wlink 2235/udp # Sercomm-WLink [Melinda_Tsao] [Melinda_Tsao] -nani 2236/tcp # Nani [Steve_Benoit] [Steve_Benoit] -nani 2236/udp # Nani [Steve_Benoit] [Steve_Benoit] -optech-port1-lm 2237/tcp # Optech Port1 License Manager [Gerard_Cannie] [Gerard_Cannie] -optech-port1-lm 2237/udp # Optech Port1 License Manager [Gerard_Cannie] [Gerard_Cannie] -aviva-sna 2238/tcp # AVIVA SNA SERVER [Vick_Keshishian] [Vick_Keshishian] -aviva-sna 2238/udp # AVIVA SNA SERVER [Vick_Keshishian] [Vick_Keshishian] -imagequery 2239/tcp # Image Query [Charles_Jacobs] [Charles_Jacobs] -imagequery 2239/udp # Image Query [Charles_Jacobs] [Charles_Jacobs] -recipe 2240/tcp # RECIPe [Charlie_Limoges] [Charlie_Limoges] 1997-12-16 -recipe 2240/udp # RECIPe [Charlie_Limoges] [Charlie_Limoges] 1997-12-16 -ivsd 2241/tcp # IVS Daemon [Thierry_Turletti] [Thierry_Turletti] -ivsd 2241/udp # IVS Daemon [Thierry_Turletti] [Thierry_Turletti] -foliocorp 2242/tcp # Folio Remote Server [Pat_Mcgowan] [Pat_Mcgowan] -foliocorp 2242/udp # Folio Remote Server [Pat_Mcgowan] [Pat_Mcgowan] -magicom 2243/tcp # Magicom Protocol [Yossi_Appleboum] [Yossi_Appleboum] -magicom 2243/udp # Magicom Protocol [Yossi_Appleboum] [Yossi_Appleboum] -nmsserver 2244/tcp # NMS Server [Dmitry_Krasnonosenki] [Dmitry_Krasnonosenki] -nmsserver 2244/udp # NMS Server [Dmitry_Krasnonosenki] [Dmitry_Krasnonosenki] -hao 2245/tcp # HaO [Panic_Ride] [Panic_Ride] -hao 2245/udp # HaO [Panic_Ride] [Panic_Ride] -pc-mta-addrmap 2246/tcp # PacketCable MTA Addr Map [Dave_Maxwell] [Dave_Maxwell] -pc-mta-addrmap 2246/udp # PacketCable MTA Addr Map [Dave_Maxwell] [Dave_Maxwell] -antidotemgrsvr 2247/tcp # Antidote Deployment Manager [Rod_Waltermann] [Rod_Waltermann] 2006-02 -# Service -antidotemgrsvr 2247/udp # Antidote Deployment Manager [Rod_Waltermann] [Rod_Waltermann] 2006-02 -# Service -ums 2248/tcp # User Management Service [Andrew_Crockford] [Andrew_Crockford] -ums 2248/udp # User Management Service [Andrew_Crockford] [Andrew_Crockford] -rfmp 2249/tcp # RISO File Manager Protocol [Shinji_Yamanaka] [Shinji_Yamanaka] -rfmp 2249/udp # RISO File Manager Protocol [Shinji_Yamanaka] [Shinji_Yamanaka] -remote-collab 2250/tcp # remote-collab [Richard_Walters] [Richard_Walters] -remote-collab 2250/udp # remote-collab [Richard_Walters] [Richard_Walters] -dif-port 2251/tcp # Distributed Framework Port [Sebastien_Lambla] [Sebastien_Lambla] -dif-port 2251/udp # Distributed Framework Port [Sebastien_Lambla] [Sebastien_Lambla] -njenet-ssl 2252/tcp # NJENET using SSL [Hans_U_Schmidt] [Hans_U_Schmidt] -njenet-ssl 2252/udp # NJENET using SSL [Hans_U_Schmidt] [Hans_U_Schmidt] -dtv-chan-req 2253/tcp # DTV Channel Request [Richard_Hodges] [Richard_Hodges] -dtv-chan-req 2253/udp # DTV Channel Request [Richard_Hodges] [Richard_Hodges] -seispoc 2254/tcp # Seismic P.O.C. Port [Robert_Reimiller] [Robert_Reimiller] -seispoc 2254/udp # Seismic P.O.C. Port [Robert_Reimiller] [Robert_Reimiller] -vrtp 2255/tcp # VRTP - ViRtue Transfer [Max_Fudim] [Max_Fudim] -# Protocol -vrtp 2255/udp # VRTP - ViRtue Transfer [Max_Fudim] [Max_Fudim] -# Protocol -pcc-mfp 2256/tcp # PCC MFP [Kunihiko_Morota] [Kunihiko_Morota] 2005-08 -pcc-mfp 2256/udp # PCC MFP [Kunihiko_Morota] [Kunihiko_Morota] 2005-08 -simple-tx-rx 2257/tcp # simple text/file transfer [Daniel_Kilsdonk] [Daniel_Kilsdonk] 2006-08 -simple-tx-rx 2257/udp # simple text/file transfer [Daniel_Kilsdonk] [Daniel_Kilsdonk] 2006-08 -rcts 2258/tcp # Rotorcraft Communications [Terry_Eldridge] [Terry_Eldridge] 2006-08 -# Test System -rcts 2258/udp # Rotorcraft Communications [Terry_Eldridge] [Terry_Eldridge] 2006-08 -# Test System -# 2259 Unassigned 2011-06-28 -apc-2260 2260/tcp # APC 2260 [American_Power_Conve] [American_Power_Conve] 2002-02 -apc-2260 2260/udp # APC 2260 [American_Power_Conve] [American_Power_Conve] 2002-02 -comotionmaster 2261/tcp # CoMotion Master Server -comotionmaster 2261/udp # CoMotion Master Server -comotionback 2262/tcp # CoMotion Backup Server [Friedman_Wagner_Dobl] [Friedman_Wagner_Dobl] 2005-09 -comotionback 2262/udp # CoMotion Backup Server [Friedman_Wagner_Dobl] [Friedman_Wagner_Dobl] 2005-09 -ecwcfg 2263/tcp # ECweb Configuration Service [Anders_Hjelm] [Anders_Hjelm] 2006-03 -ecwcfg 2263/udp # ECweb Configuration Service [Anders_Hjelm] [Anders_Hjelm] 2006-03 -apx500api-1 2264/tcp # Audio Precision Apx500 API -# Port 1 -apx500api-1 2264/udp # Audio Precision Apx500 API -# Port 1 -apx500api-2 2265/tcp # Audio Precision Apx500 API [Robert_Wright] [Robert_Wright] -# Port 2 -apx500api-2 2265/udp # Audio Precision Apx500 API [Robert_Wright] [Robert_Wright] -# Port 2 -mfserver 2266/tcp # M-Files Server [Samppa_Lahtinen] [Samppa_Lahtinen] 2004-06 -mfserver 2266/udp # M-files Server [Samppa_Lahtinen] [Samppa_Lahtinen] 2004-06 -ontobroker 2267/tcp # OntoBroker [Dr_Michael_Erdmann] [Dr_Michael_Erdmann] 2004-12 -ontobroker 2267/udp # OntoBroker [Dr_Michael_Erdmann] [Dr_Michael_Erdmann] 2004-12 -amt 2268/tcp # AMT [IESG] [IETF_Chair] 2004-12 2014-12-17 [RFC7450] -amt 2268/udp # AMT [IESG] [IETF_Chair] 2004-12 2014-12-17 [RFC7450] -mikey 2269/tcp # MIKEY [Karl_Norrman] [Karl_Norrman] 2004-12 -mikey 2269/udp # MIKEY [Karl_Norrman] [Karl_Norrman] 2004-12 -starschool 2270/tcp # starSchool [Adam_Ernst] [Adam_Ernst] 2004-12 -starschool 2270/udp # starSchool [Adam_Ernst] [Adam_Ernst] 2004-12 -mmcals 2271/tcp # Secure Meeting Maker -# Scheduling -mmcals 2271/udp # Secure Meeting Maker -# Scheduling -mmcal 2272/tcp # Meeting Maker Scheduling [Andrew_H_Derbyshire] [Andrew_H_Derbyshire] 2004-12 -mmcal 2272/udp # Meeting Maker Scheduling [Andrew_H_Derbyshire] [Andrew_H_Derbyshire] 2004-12 -mysql-im 2273/tcp # MySQL Instance Manager [Petr_Chardin] [Petr_Chardin] 2004-12 -mysql-im 2273/udp # MySQL Instance Manager [Petr_Chardin] [Petr_Chardin] 2004-12 -pcttunnell 2274/tcp # PCTTunneller [ProControl_Technolog] [ProControl_Technolog] 2004-12 -pcttunnell 2274/udp # PCTTunneller [ProControl_Technolog] [ProControl_Technolog] 2004-12 -ibridge-data 2275/tcp # iBridge Conferencing -ibridge-data 2275/udp # iBridge Conferencing -ibridge-mgmt 2276/tcp # iBridge Management [Patrick_Fisher] [Patrick_Fisher] 2004-12 -ibridge-mgmt 2276/udp # iBridge Management [Patrick_Fisher] [Patrick_Fisher] 2004-12 -bluectrlproxy 2277/tcp # Bt device control proxy [Mark_de_Rooi] [Mark_de_Rooi] 2004-12 -bluectrlproxy 2277/udp # Bt device control proxy [Mark_de_Rooi] [Mark_de_Rooi] 2004-12 -s3db 2278/tcp # Simple Stacked Sequences [David_Brandon] [David_Brandon] 2006-08 -# Database -s3db 2278/udp # Simple Stacked Sequences [David_Brandon] [David_Brandon] 2006-08 -# Database -xmquery 2279/tcp # xmquery [Niels_Christiansen] [Niels_Christiansen] -xmquery 2279/udp # xmquery [Niels_Christiansen] [Niels_Christiansen] -lnvpoller 2280/tcp # LNVPOLLER -lnvpoller 2280/udp # LNVPOLLER -lnvconsole 2281/tcp # LNVCONSOLE -lnvconsole 2281/udp # LNVCONSOLE -lnvalarm 2282/tcp # LNVALARM -lnvalarm 2282/udp # LNVALARM -lnvstatus 2283/tcp # LNVSTATUS -lnvstatus 2283/udp # LNVSTATUS -lnvmaps 2284/tcp # LNVMAPS -lnvmaps 2284/udp # LNVMAPS -lnvmailmon 2285/tcp # LNVMAILMON [John_Payne] [John_Payne] -lnvmailmon 2285/udp # LNVMAILMON [John_Payne] [John_Payne] -nas-metering 2286/tcp # NAS-Metering [Steven_Sawkins] [Steven_Sawkins] -nas-metering 2286/udp # NAS-Metering [Steven_Sawkins] [Steven_Sawkins] -dna 2287/tcp # DNA [Tung_Nguyen] [Tung_Nguyen] -dna 2287/udp # DNA [Tung_Nguyen] [Tung_Nguyen] -netml 2288/tcp # NETML [Jochen_Hansmeyer] [Jochen_Hansmeyer] -netml 2288/udp # NETML [Jochen_Hansmeyer] [Jochen_Hansmeyer] -dict-lookup 2289/tcp # Lookup dict server [William_Fernando_Mat] [William_Fernando_Mat] 2005-01 -dict-lookup 2289/udp # Lookup dict server [William_Fernando_Mat] [William_Fernando_Mat] 2005-01 -sonus-logging 2290/tcp # Sonus Logging Services [Adwait_Sathe] [Adwait_Sathe] 2005-08 -sonus-logging 2290/udp # Sonus Logging Services [Adwait_Sathe] [Adwait_Sathe] 2005-08 -eapsp 2291/tcp # EPSON Advanced Printer Share [SEIKO_EPSON] [SEIKO_EPSON] 2006-06 -# Protocol -eapsp 2291/udp # EPSON Advanced Printer Share [SEIKO_EPSON] [SEIKO_EPSON] 2006-06 -# Protocol -mib-streaming 2292/tcp # Sonus Element Management [Linda_Lin] [Linda_Lin] 2006-08 -# Services -mib-streaming 2292/udp # Sonus Element Management [Linda_Lin] [Linda_Lin] 2006-08 -# Services -npdbgmngr 2293/tcp # Network Platform Debug [Robert_Byrne] [Robert_Byrne] 2006-09 -# Manager -npdbgmngr 2293/udp # Network Platform Debug [Robert_Byrne] [Robert_Byrne] 2006-09 -# Manager -konshus-lm 2294/tcp # Konshus License Manager [Francois_Painchaud] [Francois_Painchaud] -# (FLEX) -konshus-lm 2294/udp # Konshus License Manager [Francois_Painchaud] [Francois_Painchaud] -# (FLEX) -advant-lm 2295/tcp # Advant License Manager [Lars_Goran_Magnusson] [Lars_Goran_Magnusson] -advant-lm 2295/udp # Advant License Manager [Lars_Goran_Magnusson] [Lars_Goran_Magnusson] -theta-lm 2296/tcp # Theta License Manager [David_Thompson] [David_Thompson] -# (Rainbow) -theta-lm 2296/udp # Theta License Manager [David_Thompson] [David_Thompson] -# (Rainbow) -d2k-datamover1 2297/tcp # D2K DataMover 1 -d2k-datamover1 2297/udp # D2K DataMover 1 -d2k-datamover2 2298/tcp # D2K DataMover 2 [Eric_Lan] [Eric_Lan] -d2k-datamover2 2298/udp # D2K DataMover 2 [Eric_Lan] [Eric_Lan] -pc-telecommute 2299/tcp # PC Telecommute [John_Daniel_Bonamico] [John_Daniel_Bonamico] -pc-telecommute 2299/udp # PC Telecommute [John_Daniel_Bonamico] [John_Daniel_Bonamico] -cvmmon 2300/tcp # CVMMON [Roger_Kumpf] [Roger_Kumpf] -cvmmon 2300/udp # CVMMON [Roger_Kumpf] [Roger_Kumpf] -cpq-wbem 2301/tcp # Compaq HTTP [Scott_Shaffer] [Scott_Shaffer] -cpq-wbem 2301/udp # Compaq HTTP [Scott_Shaffer] [Scott_Shaffer] -binderysupport 2302/tcp # Bindery Support [Narasimha_Rao_N] [Narasimha_Rao_N] -binderysupport 2302/udp # Bindery Support [Narasimha_Rao_N] [Narasimha_Rao_N] -proxy-gateway 2303/tcp # Proxy Gateway [Paul_Funk] [Paul_Funk] -proxy-gateway 2303/udp # Proxy Gateway [Paul_Funk] [Paul_Funk] -attachmate-uts 2304/tcp # Attachmate UTS [George_Gianelos] [George_Gianelos] -attachmate-uts 2304/udp # Attachmate UTS [George_Gianelos] [George_Gianelos] -mt-scaleserver 2305/tcp # MT ScaleServer [Paul_Glaubitz] [Paul_Glaubitz] -mt-scaleserver 2305/udp # MT ScaleServer [Paul_Glaubitz] [Paul_Glaubitz] -tappi-boxnet 2306/tcp # TAPPI BoxNet [Richard_Spartz] [Richard_Spartz] -tappi-boxnet 2306/udp # TAPPI BoxNet [Richard_Spartz] [Richard_Spartz] -pehelp 2307/tcp # pehelp [Jens_Kilian] [Jens_Kilian] -pehelp 2307/udp # pehelp [Jens_Kilian] [Jens_Kilian] -sdhelp 2308/tcp # sdhelp [Annette_Klecha] [Annette_Klecha] -sdhelp 2308/udp # sdhelp [Annette_Klecha] [Annette_Klecha] -sdserver 2309/tcp # SD Server -sdserver 2309/udp # SD Server -sdclient 2310/tcp # SD Client [Jeurgen_Broesamle] [Jeurgen_Broesamle] -sdclient 2310/udp # SD Client [Jeurgen_Broesamle] [Jeurgen_Broesamle] -messageservice 2311/tcp # Message Service -messageservice 2311/udp # Message Service -wanscaler 2312/tcp # WANScaler Communication [Allen_Samuels] [Allen_Samuels] 2006-11 -# Service -wanscaler 2312/udp # WANScaler Communication [Allen_Samuels] [Allen_Samuels] 2006-11 -# Service -iapp 2313/tcp # IAPP (Inter Access Point [Henri_Moelard] [Henri_Moelard] -# Protocol) -iapp 2313/udp # IAPP (Inter Access Point [Henri_Moelard] [Henri_Moelard] -# Protocol) -cr-websystems 2314/tcp # CR WebSystems [Robin_Giese] [Robin_Giese] -cr-websystems 2314/udp # CR WebSystems [Robin_Giese] [Robin_Giese] -precise-sft 2315/tcp # Precise Sft. [Michael_Landwehr] [Michael_Landwehr] -precise-sft 2315/udp # Precise Sft. [Michael_Landwehr] [Michael_Landwehr] -sent-lm 2316/tcp # SENT License Manager [Pisharath_Krishnan] [Pisharath_Krishnan] -sent-lm 2316/udp # SENT License Manager [Pisharath_Krishnan] [Pisharath_Krishnan] -attachmate-g32 2317/tcp # Attachmate G32 [Bryce_Bhatnagar] [Bryce_Bhatnagar] -attachmate-g32 2317/udp # Attachmate G32 [Bryce_Bhatnagar] [Bryce_Bhatnagar] -cadencecontrol 2318/tcp # Cadence Control [Buck_Caldwell] [Buck_Caldwell] -cadencecontrol 2318/udp # Cadence Control [Buck_Caldwell] [Buck_Caldwell] -infolibria 2319/tcp # InfoLibria [Chris_Chiotasso] [Chris_Chiotasso] -infolibria 2319/udp # InfoLibria [Chris_Chiotasso] [Chris_Chiotasso] -siebel-ns 2320/tcp # Siebel NS [Gilberto_Arnaiz] [Gilberto_Arnaiz] -siebel-ns 2320/udp # Siebel NS [Gilberto_Arnaiz] [Gilberto_Arnaiz] -rdlap 2321/tcp # RDLAP [Robert_Wiebe] [Robert_Wiebe] -rdlap 2321/udp # RDLAP [Robert_Wiebe] [Robert_Wiebe] -ofsd 2322/tcp # ofsd -ofsd 2322/udp # ofsd -3d-nfsd 2323/tcp # 3d-nfsd [Mike_Sherrill] [Mike_Sherrill] -3d-nfsd 2323/udp # 3d-nfsd [Mike_Sherrill] [Mike_Sherrill] -cosmocall 2324/tcp # Cosmocall [Steve_Dellutri] [Steve_Dellutri] -cosmocall 2324/udp # Cosmocall [Steve_Dellutri] [Steve_Dellutri] -ansysli 2325/tcp # ANSYS Licensing Interconnect [Suzanne_Lorrin] [Suzanne_Lorrin] Modified: 27 October 2008 -ansysli 2325/udp # ANSYS Licensing Interconnect [Suzanne_Lorrin] [Suzanne_Lorrin] Modified: 27 October 2008 -idcp 2326/tcp # IDCP [Keisokugiken_Corp] [Keisokugiken_Corp] -idcp 2326/udp # IDCP [Keisokugiken_Corp] [Keisokugiken_Corp] -xingcsm 2327/tcp # xingcsm [Dave_Spencer] [Dave_Spencer] -xingcsm 2327/udp # xingcsm [Dave_Spencer] [Dave_Spencer] -netrix-sftm 2328/tcp # Netrix SFTM [Garrett_Herschleb] [Garrett_Herschleb] -netrix-sftm 2328/udp # Netrix SFTM [Garrett_Herschleb] [Garrett_Herschleb] -nvd 2329/tcp # NVD [Peter_Weyman] [Peter_Weyman] -nvd 2329/udp # NVD [Peter_Weyman] [Peter_Weyman] -tscchat 2330/tcp # TSCCHAT [Mike_Jackson] [Mike_Jackson] -tscchat 2330/udp # TSCCHAT [Mike_Jackson] [Mike_Jackson] -agentview 2331/tcp # AGENTVIEW [Ram_Iyer] [Ram_Iyer] -agentview 2331/udp # AGENTVIEW [Ram_Iyer] [Ram_Iyer] -rcc-host 2332/tcp # RCC Host [Martin_Shoemaker] [Martin_Shoemaker] -rcc-host 2332/udp # RCC Host [Martin_Shoemaker] [Martin_Shoemaker] -snapp 2333/tcp # SNAPP [Dan_Burrows] [Dan_Burrows] 2009-09-25 -snapp 2333/udp # SNAPP [Dan_Burrows] [Dan_Burrows] 2009-09-25 -ace-client 2334/tcp # ACE Client Auth -ace-client 2334/udp # ACE Client Auth -ace-proxy 2335/tcp # ACE Proxy [Riaz_Zolfonoon] [Riaz_Zolfonoon] -ace-proxy 2335/udp # ACE Proxy [Riaz_Zolfonoon] [Riaz_Zolfonoon] -appleugcontrol 2336/tcp # Apple UG Control [Gene_Tyacke] [Gene_Tyacke] -appleugcontrol 2336/udp # Apple UG Control [Gene_Tyacke] [Gene_Tyacke] -ideesrv 2337/tcp # ideesrv [Marazzi] [Marazzi] -ideesrv 2337/udp # ideesrv [Marazzi] [Marazzi] -norton-lambert 2338/tcp # Norton Lambert [Richard_de_Mornay] [Richard_de_Mornay] -norton-lambert 2338/udp # Norton Lambert [Richard_de_Mornay] [Richard_de_Mornay] -3com-webview 2339/tcp # 3Com WebView [Jennifer_Grace] [Jennifer_Grace] -3com-webview 2339/udp # 3Com WebView [Jennifer_Grace] [Jennifer_Grace] -# WRS Registry -# -wrs-registry 2340/tcp # IANA assigned this [Christophe_Cleraux] [Christophe_Cleraux] -# well-formed service name as -# a replacement for -# "wrs_registry". -# This entry is an alias to "wrs-registry". This entry is now -wrs_registry 2340/tcp # WRS Registry [Christophe_Cleraux] [Christophe_Cleraux] historic, not usable for use with many common service -# discovery mechanisms. -# WRS Registry -# -wrs-registry 2340/udp # IANA assigned this [Christophe_Cleraux] [Christophe_Cleraux] -# well-formed service name as -# a replacement for -# "wrs_registry". -# This entry is an alias to "wrs-registry". This entry is now -wrs_registry 2340/udp # WRS Registry [Christophe_Cleraux] [Christophe_Cleraux] historic, not usable for use with many common service -# discovery mechanisms. -xiostatus 2341/tcp # XIO Status [Randy_Maas] [Randy_Maas] -xiostatus 2341/udp # XIO Status [Randy_Maas] [Randy_Maas] -manage-exec 2342/tcp # Seagate Manage Exec [Jim_Flaherty] [Jim_Flaherty] -manage-exec 2342/udp # Seagate Manage Exec [Jim_Flaherty] [Jim_Flaherty] -nati-logos 2343/tcp # nati logos [James_Juhasz] [James_Juhasz] -nati-logos 2343/udp # nati logos [James_Juhasz] [James_Juhasz] -fcmsys 2344/tcp # fcmsys -fcmsys 2344/udp # fcmsys -dbm 2345/tcp # dbm [Dean_Robson] [Dean_Robson] -dbm 2345/udp # dbm [Dean_Robson] [Dean_Robson] -# Game Connection Port -# -redstorm-join 2346/tcp # IANA assigned this -# well-formed service name as -# a replacement for -# "redstorm_join". -# This entry is an alias to "redstorm-join". This entry is now -redstorm_join 2346/tcp # Game Connection Port historic, not usable for use with many common service -# discovery mechanisms. -# Game Connection Port -# -redstorm-join 2346/udp # IANA assigned this -# well-formed service name as -# a replacement for -# "redstorm_join". -# This entry is an alias to "redstorm-join". This entry is now -redstorm_join 2346/udp # Game Connection Port historic, not usable for use with many common service -# discovery mechanisms. -# Game Announcement and -# Location -# -redstorm-find 2347/tcp # IANA assigned this -# well-formed service name as -# a replacement for -# "redstorm_find". -# Game Announcement and This entry is an alias to "redstorm-find". This entry is now -redstorm_find 2347/tcp # Location historic, not usable for use with many common service -# discovery mechanisms. -# Game Announcement and -# Location -# -redstorm-find 2347/udp # IANA assigned this -# well-formed service name as -# a replacement for -# "redstorm_find". -# Game Announcement and This entry is an alias to "redstorm-find". This entry is now -redstorm_find 2347/udp # Location historic, not usable for use with many common service -# discovery mechanisms. -# Information to query for -# game status -# -redstorm-info 2348/tcp # IANA assigned this -# well-formed service name as -# a replacement for -# "redstorm_info". -# Information to query for This entry is an alias to "redstorm-info". This entry is now -redstorm_info 2348/tcp # game status historic, not usable for use with many common service -# discovery mechanisms. -# Information to query for -# game status -# -redstorm-info 2348/udp # IANA assigned this -# well-formed service name as -# a replacement for -# "redstorm_info". -# Information to query for This entry is an alias to "redstorm-info". This entry is now -redstorm_info 2348/udp # game status historic, not usable for use with many common service -# discovery mechanisms. -# Diagnostics Port -# -redstorm-diag 2349/tcp # IANA assigned this [David_Weinstein] [David_Weinstein] -# well-formed service name as -# a replacement for -# "redstorm_diag". -# This entry is an alias to "redstorm-diag". This entry is now -redstorm_diag 2349/tcp # Diagnostics Port [David_Weinstein] [David_Weinstein] historic, not usable for use with many common service -# discovery mechanisms. -# Diagnostics Port -# -redstorm-diag 2349/udp # IANA assigned this [David_Weinstein] [David_Weinstein] -# well-formed service name as -# a replacement for -# "redstorm_diag". -# This entry is an alias to "redstorm-diag". This entry is now -redstorm_diag 2349/udp # Diagnostics Port [David_Weinstein] [David_Weinstein] historic, not usable for use with many common service -# discovery mechanisms. -psbserver 2350/tcp # Pharos Booking Server -psbserver 2350/udp # Pharos Booking Server -psrserver 2351/tcp # psrserver -psrserver 2351/udp # psrserver -pslserver 2352/tcp # pslserver -pslserver 2352/udp # pslserver -pspserver 2353/tcp # pspserver -pspserver 2353/udp # pspserver -psprserver 2354/tcp # psprserver -psprserver 2354/udp # psprserver -psdbserver 2355/tcp # psdbserver [Paul_Reddy] [Paul_Reddy] -psdbserver 2355/udp # psdbserver [Paul_Reddy] [Paul_Reddy] -gxtelmd 2356/tcp # GXT License Managemant [Robert_Hodgson] [Robert_Hodgson] -gxtelmd 2356/udp # GXT License Managemant [Robert_Hodgson] [Robert_Hodgson] -unihub-server 2357/tcp # UniHub Server [Tim_Kenyon] [Tim_Kenyon] -unihub-server 2357/udp # UniHub Server [Tim_Kenyon] [Tim_Kenyon] -futrix 2358/tcp # Futrix [Peter_Frankenberg] [Peter_Frankenberg] -futrix 2358/udp # Futrix [Peter_Frankenberg] [Peter_Frankenberg] -flukeserver 2359/tcp # FlukeServer [Bill_Marbaker] [Bill_Marbaker] -flukeserver 2359/udp # FlukeServer [Bill_Marbaker] [Bill_Marbaker] -nexstorindltd 2360/tcp # NexstorIndLtd [NexStor_India_Limite] [NexStor_India_Limite] -nexstorindltd 2360/udp # NexstorIndLtd [NexStor_India_Limite] [NexStor_India_Limite] -tl1 2361/tcp # TL1 [Charles_Scott_Robers] [Charles_Scott_Robers] -tl1 2361/udp # TL1 [Charles_Scott_Robers] [Charles_Scott_Robers] -digiman 2362/tcp # digiman [Aaron_S_Kurland] [Aaron_S_Kurland] -digiman 2362/udp # digiman [Aaron_S_Kurland] [Aaron_S_Kurland] -mediacntrlnfsd 2363/tcp # Media Central NFSD [Shivakumar_S_Govind] [Shivakumar_S_Govind] -mediacntrlnfsd 2363/udp # Media Central NFSD [Shivakumar_S_Govind] [Shivakumar_S_Govind] -oi-2000 2364/tcp # OI-2000 [Software_Horizons_In] [Software_Horizons_In] -oi-2000 2364/udp # OI-2000 [Software_Horizons_In] [Software_Horizons_In] -dbref 2365/tcp # dbref [Yoshihiro_Yamazaki] [Yoshihiro_Yamazaki] -dbref 2365/udp # dbref [Yoshihiro_Yamazaki] [Yoshihiro_Yamazaki] -qip-login 2366/tcp # qip-login [Mike_Morgan] [Mike_Morgan] -qip-login 2366/udp # qip-login [Mike_Morgan] [Mike_Morgan] -service-ctrl 2367/tcp # Service Control [Humberto_Sanchez] [Humberto_Sanchez] -service-ctrl 2367/udp # Service Control [Humberto_Sanchez] [Humberto_Sanchez] -opentable 2368/tcp # OpenTable [Brett_Goldstein] [Brett_Goldstein] -opentable 2368/udp # OpenTable [Brett_Goldstein] [Brett_Goldstein] -# 2369 Unassigned De-registered (28 March 2006) -l3-hbmon 2370/tcp # L3-HBMon [Dolores_Scott] [Dolores_Scott] 2014-04-09 -l3-hbmon 2370/udp # L3-HBMon [Dolores_Scott] [Dolores_Scott] 2014-04-09 -hp-rda 2371/tcp # HP Remote Device Access [Hewlett_Packard_3] [Michael_Spratte][Steve_Roscio] 2014-04-09 -# 2371 udp Reserved 2014-04-09 -lanmessenger 2372/tcp # LanMessenger [Garrett_Padera] [Garrett_Padera] 2008-02-01 -lanmessenger 2372/udp # LanMessenger [Garrett_Padera] [Garrett_Padera] 2008-02-01 -remographlm 2373/tcp # Remograph License Manager [Per_Fahlberg] [Per_Fahlberg] 2009-01-21 -# 2373 udp Reserved -hydra 2374/tcp # Hydra RPC [Jacob_Feisley] [Jacob_Feisley] 2009-01-21 -# 2374 udp Reserved -docker 2375/tcp # Docker REST API (plain text) [DOCKER] [Christopher_Liljenstolpe] 2014-04-17 -# 2375 udp Reserved -docker-s 2376/tcp # Docker REST API (ssl) [DOCKER] [Christopher_Liljenstolpe] 2014-04-17 -# 2377-2378 Unassigned -etcd-client 2379/tcp # etcd client communication [CoreOS] [Brian_Harrington] 2014-07-09 -# 2379 udp Reserved -etcd-server 2380/tcp # etcd server to server [CoreOS] [Brian_Harrington] 2014-07-09 -# communication -# 2380 udp Reserved -compaq-https 2381/tcp # Compaq HTTPS [Scott_Shaffer] [Scott_Shaffer] -compaq-https 2381/udp # Compaq HTTPS [Scott_Shaffer] [Scott_Shaffer] -ms-olap3 2382/tcp # Microsoft OLAP -ms-olap3 2382/udp # Microsoft OLAP -ms-olap4 2383/tcp # Microsoft OLAP [Mosha_Pasumansky] [Mosha_Pasumansky] -ms-olap4 2383/udp # Microsoft OLAP [Mosha_Pasumansky] [Mosha_Pasumansky] -sd-request 2384/tcp # SD-REQUEST -sd-capacity 2384/udp # SD-CAPACITY [Jason_McManus_2] [Jason_McManus_2] -sd-data 2385/tcp # SD-DATA [Jason_McManus_2] [Jason_McManus_2] -sd-data 2385/udp # SD-DATA [Jason_McManus_2] [Jason_McManus_2] -virtualtape 2386/tcp # Virtual Tape -virtualtape 2386/udp # Virtual Tape -vsamredirector 2387/tcp # VSAM Redirector [Ingo_Franzki] [Ingo_Franzki] -vsamredirector 2387/udp # VSAM Redirector [Ingo_Franzki] [Ingo_Franzki] -mynahautostart 2388/tcp # MYNAH AutoStart [Thomas_J_Klehr] [Thomas_J_Klehr] -mynahautostart 2388/udp # MYNAH AutoStart [Thomas_J_Klehr] [Thomas_J_Klehr] -ovsessionmgr 2389/tcp # OpenView Session Mgr [Eric_Pulsipher] [Eric_Pulsipher] -ovsessionmgr 2389/udp # OpenView Session Mgr [Eric_Pulsipher] [Eric_Pulsipher] -rsmtp 2390/tcp # RSMTP [Geoff_Collyer] [Geoff_Collyer] -rsmtp 2390/udp # RSMTP [Geoff_Collyer] [Geoff_Collyer] -3com-net-mgmt 2391/tcp # 3COM Net Management [Prathibha_Nagvar] [Prathibha_Nagvar] -3com-net-mgmt 2391/udp # 3COM Net Management [Prathibha_Nagvar] [Prathibha_Nagvar] -tacticalauth 2392/tcp # Tactical Auth [David_Yon] [David_Yon] -tacticalauth 2392/udp # Tactical Auth [David_Yon] [David_Yon] -ms-olap1 2393/tcp # MS OLAP 1 -ms-olap1 2393/udp # MS OLAP 1 -ms-olap2 2394/tcp # MS OLAP 2 [Mosha_Pasumansky] [Mosha_Pasumansky] -ms-olap2 2394/udp # MS OLAP 2 [Mosha_Pasumansky] [Mosha_Pasumansky] -# LAN900 Remote -# -lan900-remote 2395/tcp # IANA assigned this [Tom_Quinlan] [Tom_Quinlan] -# well-formed service name as -# a replacement for -# "lan900_remote". -# This entry is an alias to "lan900-remote". This entry is now -lan900_remote 2395/tcp # LAN900 Remote [Tom_Quinlan] [Tom_Quinlan] historic, not usable for use with many common service -# discovery mechanisms. -# LAN900 Remote -# -lan900-remote 2395/udp # IANA assigned this [Tom_Quinlan] [Tom_Quinlan] -# well-formed service name as -# a replacement for -# "lan900_remote". -# This entry is an alias to "lan900-remote". This entry is now -lan900_remote 2395/udp # LAN900 Remote [Tom_Quinlan] [Tom_Quinlan] historic, not usable for use with many common service -# discovery mechanisms. -wusage 2396/tcp # Wusage [Thomas_Boutell] [Thomas_Boutell] -wusage 2396/udp # Wusage [Thomas_Boutell] [Thomas_Boutell] -ncl 2397/tcp # NCL [Robert_Wiebe] [Robert_Wiebe] -ncl 2397/udp # NCL [Robert_Wiebe] [Robert_Wiebe] -orbiter 2398/tcp # Orbiter [David_Goldberg] [David_Goldberg] -orbiter 2398/udp # Orbiter [David_Goldberg] [David_Goldberg] -fmpro-fdal 2399/tcp # FileMaker, Inc. - Data [Clay_Maeckal] [Clay_Maeckal] -# Access Layer -fmpro-fdal 2399/udp # FileMaker, Inc. - Data [Clay_Maeckal] [Clay_Maeckal] -# Access Layer -opequus-server 2400/tcp # OpEquus Server [Gavin_Hutchinson_2] [Gavin_Hutchinson_2] -opequus-server 2400/udp # OpEquus Server [Gavin_Hutchinson_2] [Gavin_Hutchinson_2] -cvspserver 2401/tcp # cvspserver [Jim_Kingdon] [Jim_Kingdon] -cvspserver 2401/udp # cvspserver [Jim_Kingdon] [Jim_Kingdon] -taskmaster2000 2402/tcp # TaskMaster 2000 Server -taskmaster2000 2402/udp # TaskMaster 2000 Server -taskmaster2000 2403/tcp # TaskMaster 2000 Web [Ed_Odjaghian] [Ed_Odjaghian] -taskmaster2000 2403/udp # TaskMaster 2000 Web [Ed_Odjaghian] [Ed_Odjaghian] -iec-104 2404/tcp # IEC 60870-5-104 process [Walter_K_Eichelburg] [Walter_K_Eichelburg] -# control over IP -iec-104 2404/udp # IEC 60870-5-104 process [Walter_K_Eichelburg] [Walter_K_Eichelburg] -# control over IP -trc-netpoll 2405/tcp # TRC Netpoll [Bizhan_Ghavami] [Bizhan_Ghavami] -trc-netpoll 2405/udp # TRC Netpoll [Bizhan_Ghavami] [Bizhan_Ghavami] -jediserver 2406/tcp # JediServer [Paul_McEntire] [Paul_McEntire] -jediserver 2406/udp # JediServer [Paul_McEntire] [Paul_McEntire] -orion 2407/tcp # Orion [Matthew_Horoschun] [Matthew_Horoschun] -orion 2407/udp # Orion [Matthew_Horoschun] [Matthew_Horoschun] -railgun-webaccl 2408/tcp # CloudFlare Railgun Web [CloudFlare] [John_Graham_Cumming] 2012-03-09 -# Acceleration Protocol -# 2408 udp Reserved 2012-03-09 This entry is being removed on 2012-03-09. -sns-protocol 2409/tcp # SNS Protocol [Amir_Blich] [Amir_Blich] -sns-protocol 2409/udp # SNS Protocol [Amir_Blich] [Amir_Blich] -vrts-registry 2410/tcp # VRTS Registry [Pranay_Varma] [Pranay_Varma] -vrts-registry 2410/udp # VRTS Registry [Pranay_Varma] [Pranay_Varma] -netwave-ap-mgmt 2411/tcp # Netwave AP Management [Johnny_Zweig] [Johnny_Zweig] -netwave-ap-mgmt 2411/udp # Netwave AP Management [Johnny_Zweig] [Johnny_Zweig] -cdn 2412/tcp # CDN [Alan_Noble] [Alan_Noble] -cdn 2412/udp # CDN [Alan_Noble] [Alan_Noble] -orion-rmi-reg 2413/tcp # orion-rmi-reg [J_S_Greenfield_2] [J_S_Greenfield_2] -orion-rmi-reg 2413/udp # orion-rmi-reg [J_S_Greenfield_2] [J_S_Greenfield_2] -beeyond 2414/tcp # Beeyond [Bob_Deblier] [Bob_Deblier] -beeyond 2414/udp # Beeyond [Bob_Deblier] [Bob_Deblier] -codima-rtp 2415/tcp # Codima Remote Transaction [Sylvia_Ross] [Sylvia_Ross] -# Protocol -codima-rtp 2415/udp # Codima Remote Transaction [Sylvia_Ross] [Sylvia_Ross] -# Protocol -rmtserver 2416/tcp # RMT Server [Yvon_Marineau] [Yvon_Marineau] -rmtserver 2416/udp # RMT Server [Yvon_Marineau] [Yvon_Marineau] -composit-server 2417/tcp # Composit Server [Katsuaki_Naoi] [Katsuaki_Naoi] -composit-server 2417/udp # Composit Server [Katsuaki_Naoi] [Katsuaki_Naoi] -cas 2418/tcp # cas [Akiyoshi_Ochi] [Akiyoshi_Ochi] -cas 2418/udp # cas [Akiyoshi_Ochi] [Akiyoshi_Ochi] -attachmate-s2s 2419/tcp # Attachmate S2S [Chris_Rominski] [Chris_Rominski] -attachmate-s2s 2419/udp # Attachmate S2S [Chris_Rominski] [Chris_Rominski] -dslremote-mgmt 2420/tcp # DSL Remote Management [Westell] [Westell] -dslremote-mgmt 2420/udp # DSL Remote Management [Westell] [Westell] -g-talk 2421/tcp # G-Talk [Matt_Hammond] [Matt_Hammond] -g-talk 2421/udp # G-Talk [Matt_Hammond] [Matt_Hammond] -crmsbits 2422/tcp # CRMSBITS [Rod_Ward] [Rod_Ward] -crmsbits 2422/udp # CRMSBITS [Rod_Ward] [Rod_Ward] -rnrp 2423/tcp # RNRP [Per_Sahlqvist] [Per_Sahlqvist] -rnrp 2423/udp # RNRP [Per_Sahlqvist] [Per_Sahlqvist] -kofax-svr 2424/tcp # KOFAX-SVR [Steven_Kilby] [Steven_Kilby] 2011-04-25 -kofax-svr 2424/udp # KOFAX-SVR [Steven_Kilby] [Steven_Kilby] 2011-04-25 -fjitsuappmgr 2425/tcp # Fujitsu App Manager [Hiroyuki_Kawabuchi] [Hiroyuki_Kawabuchi] -fjitsuappmgr 2425/udp # Fujitsu App Manager [Hiroyuki_Kawabuchi] [Hiroyuki_Kawabuchi] -vcmp 2426/tcp # VeloCloud MultiPath Protocol [VeloCloud_Networks] [Tim_Van_Herck] 2014-11-13 This port was previously removed on 2002-04-29. -vcmp 2426/udp # VeloCloud MultiPath Protocol [VeloCloud_Networks] [Tim_Van_Herck] 2014-11-13 This port was previously removed on 2002-04-29. -mgcp-gateway 2427/tcp # Media Gateway Control [Christian_Huitema] [Christian_Huitema] -# Protocol Gateway -mgcp-gateway 2427/udp # Media Gateway Control [Christian_Huitema] [Christian_Huitema] -# Protocol Gateway -ott 2428/tcp # One Way Trip Time [Greg_Troxel] [Greg_Troxel] -ott 2428/udp # One Way Trip Time [Greg_Troxel] [Greg_Troxel] -ft-role 2429/tcp # FT-ROLE [Doug_Boone] [Doug_Boone] -ft-role 2429/udp # FT-ROLE [Doug_Boone] [Doug_Boone] -venus 2430/tcp # venus -venus 2430/udp # venus -venus-se 2431/tcp # venus-se -venus-se 2431/udp # venus-se -codasrv 2432/tcp # codasrv -codasrv 2432/udp # codasrv -codasrv-se 2433/tcp # codasrv-se [Robert_Watson] [Robert_Watson] -codasrv-se 2433/udp # codasrv-se [Robert_Watson] [Robert_Watson] -pxc-epmap 2434/tcp # pxc-epmap [Jun_Nakamura] [Jun_Nakamura] -pxc-epmap 2434/udp # pxc-epmap [Jun_Nakamura] [Jun_Nakamura] -optilogic 2435/tcp # OptiLogic [Clark_Williams] [Clark_Williams] -optilogic 2435/udp # OptiLogic [Clark_Williams] [Clark_Williams] -topx 2436/tcp # TOP/X [Dragos_Pop] [Dragos_Pop] -topx 2436/udp # TOP/X [Dragos_Pop] [Dragos_Pop] -unicontrol 2437/tcp # UniControl [Ing_Markus_Huemer] [Ing_Markus_Huemer] -unicontrol 2437/udp # UniControl [Ing_Markus_Huemer] [Ing_Markus_Huemer] -msp 2438/tcp # MSP [Evan_Caves] [Evan_Caves] -msp 2438/udp # MSP [Evan_Caves] [Evan_Caves] -sybasedbsynch 2439/tcp # SybaseDBSynch [Dave_Neudoerffer] [Dave_Neudoerffer] -sybasedbsynch 2439/udp # SybaseDBSynch [Dave_Neudoerffer] [Dave_Neudoerffer] -spearway 2440/tcp # Spearway Lockers [Pierre_Frisch] [Pierre_Frisch] -spearway 2440/udp # Spearway Lockers [Pierre_Frisch] [Pierre_Frisch] -pvsw-inet 2441/tcp # Pervasive I*net Data Server [Chuck_Talk] [Chuck_Talk] -pvsw-inet 2441/udp # Pervasive I*net Data Server [Chuck_Talk] [Chuck_Talk] -netangel 2442/tcp # Netangel [Ladislav_Baranyay] [Ladislav_Baranyay] -netangel 2442/udp # Netangel [Ladislav_Baranyay] [Ladislav_Baranyay] -powerclientcsf 2443/tcp # PowerClient Central Storage [Brian_Klassen] [Brian_Klassen] -# Facility -powerclientcsf 2443/udp # PowerClient Central Storage [Brian_Klassen] [Brian_Klassen] -# Facility -btpp2sectrans 2444/tcp # BT PP2 Sectrans [Ian_Daniels] [Ian_Daniels] -btpp2sectrans 2444/udp # BT PP2 Sectrans [Ian_Daniels] [Ian_Daniels] -dtn1 2445/tcp # DTN1 [Bob_Gaddie] [Bob_Gaddie] -dtn1 2445/udp # DTN1 [Bob_Gaddie] [Bob_Gaddie] -# bues_service -# -bues-service 2446/tcp # IANA assigned this [Leonhard_Diekmann] [Leonhard_Diekmann] -# well-formed service name as -# a replacement for -# "bues_service". -# This entry is an alias to "bues-service". This entry is now -bues_service 2446/tcp # bues_service [Leonhard_Diekmann] [Leonhard_Diekmann] historic, not usable for use with many common service -# discovery mechanisms. -# bues_service -# -bues-service 2446/udp # IANA assigned this [Leonhard_Diekmann] [Leonhard_Diekmann] -# well-formed service name as -# a replacement for -# "bues_service". -# This entry is an alias to "bues-service". This entry is now -bues_service 2446/udp # bues_service [Leonhard_Diekmann] [Leonhard_Diekmann] historic, not usable for use with many common service -# discovery mechanisms. -ovwdb 2447/tcp # OpenView NNM daemon [Eric_Pulsipher_2] [Eric_Pulsipher_2] -ovwdb 2447/udp # OpenView NNM daemon [Eric_Pulsipher_2] [Eric_Pulsipher_2] -hpppssvr 2448/tcp # hpppsvr [Bridgette_Landers] [Bridgette_Landers] -hpppssvr 2448/udp # hpppsvr [Bridgette_Landers] [Bridgette_Landers] -ratl 2449/tcp # RATL [Paul_Greenfield] [Paul_Greenfield] -ratl 2449/udp # RATL [Paul_Greenfield] [Paul_Greenfield] -netadmin 2450/tcp # netadmin -netadmin 2450/udp # netadmin -netchat 2451/tcp # netchat [Julian_Mehnle] [Julian_Mehnle] -netchat 2451/udp # netchat [Julian_Mehnle] [Julian_Mehnle] -snifferclient 2452/tcp # SnifferClient [Amy_Weaver_2] [Amy_Weaver_2] -snifferclient 2452/udp # SnifferClient [Amy_Weaver_2] [Amy_Weaver_2] -madge-ltd 2453/tcp # madge ltd [Mark_Lyall] [Mark_Lyall] -madge-ltd 2453/udp # madge ltd [Mark_Lyall] [Mark_Lyall] -indx-dds 2454/tcp # IndX-DDS [Paul_Carmichael] [Paul_Carmichael] -indx-dds 2454/udp # IndX-DDS [Paul_Carmichael] [Paul_Carmichael] -wago-io-system 2455/tcp # WAGO-IO-SYSTEM [Jorg_Hoffmann] [Jorg_Hoffmann] -wago-io-system 2455/udp # WAGO-IO-SYSTEM [Jorg_Hoffmann] [Jorg_Hoffmann] -altav-remmgt 2456/tcp # altav-remmgt [Gary_M_Allen] [Gary_M_Allen] -altav-remmgt 2456/udp # altav-remmgt [Gary_M_Allen] [Gary_M_Allen] -rapido-ip 2457/tcp # Rapido_IP [Man_Shuen_Cheung] [Man_Shuen_Cheung] -rapido-ip 2457/udp # Rapido_IP [Man_Shuen_Cheung] [Man_Shuen_Cheung] -griffin 2458/tcp # griffin [Tom_Taylor] [Tom_Taylor] -griffin 2458/udp # griffin [Tom_Taylor] [Tom_Taylor] -community 2459/tcp # Community [David_Schwartz] [David_Schwartz] -community 2459/udp # Community [David_Schwartz] [David_Schwartz] -ms-theater 2460/tcp # ms-theater [Anton_Kucer] [Anton_Kucer] -ms-theater 2460/udp # ms-theater [Anton_Kucer] [Anton_Kucer] -qadmifoper 2461/tcp # qadmifoper -qadmifoper 2461/udp # qadmifoper -qadmifevent 2462/tcp # qadmifevent [Pekka_Takaranta] [Pekka_Takaranta] -qadmifevent 2462/udp # qadmifevent [Pekka_Takaranta] [Pekka_Takaranta] -lsi-raid-mgmt 2463/tcp # LSI RAID Management [NetApp] [MSW_architecture_team] 2014-07-18 -lsi-raid-mgmt 2463/udp # LSI RAID Management [NetApp] [MSW_architecture_team] 2014-07-18 -direcpc-si 2464/tcp # DirecPC SI [Doug_Dillon] [Doug_Dillon] -direcpc-si 2464/udp # DirecPC SI [Doug_Dillon] [Doug_Dillon] -lbm 2465/tcp # Load Balance Management -lbm 2465/udp # Load Balance Management -lbf 2466/tcp # Load Balance Forwarding [Kazuhiro_Koide] [Kazuhiro_Koide] -lbf 2466/udp # Load Balance Forwarding [Kazuhiro_Koide] [Kazuhiro_Koide] -high-criteria 2467/tcp # High Criteria [Konstantin_Iavid] [Konstantin_Iavid] -high-criteria 2467/udp # High Criteria [Konstantin_Iavid] [Konstantin_Iavid] -qip-msgd 2468/tcp # qip_msgd [Mike_Morgan] [Mike_Morgan] -qip-msgd 2468/udp # qip_msgd [Mike_Morgan] [Mike_Morgan] -mti-tcs-comm 2469/tcp # MTI-TCS-COMM [Mario_Bonin] [Mario_Bonin] -mti-tcs-comm 2469/udp # MTI-TCS-COMM [Mario_Bonin] [Mario_Bonin] -taskman-port 2470/tcp # taskman port [Boris_Panteleev] [Boris_Panteleev] -taskman-port 2470/udp # taskman port [Boris_Panteleev] [Boris_Panteleev] -seaodbc 2471/tcp # SeaODBC [Adrian_Hornby] [Adrian_Hornby] -seaodbc 2471/udp # SeaODBC [Adrian_Hornby] [Adrian_Hornby] -c3 2472/tcp # C3 [Eckhard_Grieger] [Eckhard_Grieger] -c3 2472/udp # C3 [Eckhard_Grieger] [Eckhard_Grieger] -aker-cdp 2473/tcp # Aker-cdp [Rodrigo_Ormonde] [Rodrigo_Ormonde] -aker-cdp 2473/udp # Aker-cdp [Rodrigo_Ormonde] [Rodrigo_Ormonde] -vitalanalysis 2474/tcp # Vital Analysis [Srinivas_Reddy] [Srinivas_Reddy] -vitalanalysis 2474/udp # Vital Analysis [Srinivas_Reddy] [Srinivas_Reddy] -ace-server 2475/tcp # ACE Server -ace-server 2475/udp # ACE Server -ace-svr-prop 2476/tcp # ACE Server Propagation -ace-svr-prop 2476/udp # ACE Server Propagation -ssm-cvs 2477/tcp # SecurSight Certificate -# Valifation Service -ssm-cvs 2477/udp # SecurSight Certificate -# Valifation Service -ssm-cssps 2478/tcp # SecurSight Authentication -# Server (SSL) -ssm-cssps 2478/udp # SecurSight Authentication -# Server (SSL) -ssm-els 2479/tcp # SecurSight Event Logging [John_Linn] [John_Linn] -# Server (SSL) -ssm-els 2479/udp # SecurSight Event Logging [John_Linn] [John_Linn] -# Server (SSL) -powerexchange 2480/tcp # Informatica PowerExchange [Dale_Norman] [Dale_Norman] -# Listener -powerexchange 2480/udp # Informatica PowerExchange [Dale_Norman] [Dale_Norman] -# Listener -giop 2481/tcp # Oracle GIOP -giop 2481/udp # Oracle GIOP -giop-ssl 2482/tcp # Oracle GIOP SSL -giop-ssl 2482/udp # Oracle GIOP SSL -ttc 2483/tcp # Oracle TTC -ttc 2483/udp # Oracle TTC -ttc-ssl 2484/tcp # Oracle TTC SSL [Chandar_Venkataraman] [Chandar_Venkataraman] -ttc-ssl 2484/udp # Oracle TTC SSL [Chandar_Venkataraman] [Chandar_Venkataraman] -netobjects1 2485/tcp # Net Objects1 -netobjects1 2485/udp # Net Objects1 -netobjects2 2486/tcp # Net Objects2 [Francois_Granade] [Francois_Granade] -netobjects2 2486/udp # Net Objects2 [Francois_Granade] [Francois_Granade] -pns 2487/tcp # Policy Notice Service [Akiyoshi_Ochi] [Akiyoshi_Ochi] -pns 2487/udp # Policy Notice Service [Akiyoshi_Ochi] [Akiyoshi_Ochi] -moy-corp 2488/tcp # Moy Corporation [Gang_Gong_Moy] [Gang_Gong_Moy] -moy-corp 2488/udp # Moy Corporation [Gang_Gong_Moy] [Gang_Gong_Moy] -tsilb 2489/tcp # TSILB [James_Irwin] [James_Irwin] -tsilb 2489/udp # TSILB [James_Irwin] [James_Irwin] -qip-qdhcp 2490/tcp # qip_qdhcp [Mike_Morgan] [Mike_Morgan] -qip-qdhcp 2490/udp # qip_qdhcp [Mike_Morgan] [Mike_Morgan] -conclave-cpp 2491/tcp # Conclave CPP [Larry_Lipstone] [Larry_Lipstone] -conclave-cpp 2491/udp # Conclave CPP [Larry_Lipstone] [Larry_Lipstone] -groove 2492/tcp # GROOVE [Ray_Ozzie] [Ray_Ozzie] -groove 2492/udp # GROOVE [Ray_Ozzie] [Ray_Ozzie] -talarian-mqs 2493/tcp # Talarian MQS [Jim_Stabile] [Jim_Stabile] -talarian-mqs 2493/udp # Talarian MQS [Jim_Stabile] [Jim_Stabile] -bmc-ar 2494/tcp # BMC AR [Portnoy_Boxman] [Portnoy_Boxman] -bmc-ar 2494/udp # BMC AR [Portnoy_Boxman] [Portnoy_Boxman] -fast-rem-serv 2495/tcp # Fast Remote Services [Scott_St_Clair] [Scott_St_Clair] -fast-rem-serv 2495/udp # Fast Remote Services [Scott_St_Clair] [Scott_St_Clair] -dirgis 2496/tcp # DIRGIS [Deutschland_Informat] [Deutschland_Informat] -dirgis 2496/udp # DIRGIS [Deutschland_Informat] [Deutschland_Informat] -quaddb 2497/tcp # Quad DB [Jeff_Rosenthal] [Jeff_Rosenthal] -quaddb 2497/udp # Quad DB [Jeff_Rosenthal] [Jeff_Rosenthal] -odn-castraq 2498/tcp # ODN-CasTraq [Richard_Hodges_2] [Richard_Hodges_2] -odn-castraq 2498/udp # ODN-CasTraq [Richard_Hodges_2] [Richard_Hodges_2] -unicontrol 2499/tcp # UniControl [Ing_Markus_Huemer] [Ing_Markus_Huemer] -unicontrol 2499/udp # UniControl [Ing_Markus_Huemer] [Ing_Markus_Huemer] -rtsserv 2500/tcp # Resource Tracking system -# server -rtsserv 2500/udp # Resource Tracking system -# server -rtsclient 2501/tcp # Resource Tracking system [Aubrey_Turner] [Aubrey_Turner] -# client -rtsclient 2501/udp # Resource Tracking system [Aubrey_Turner] [Aubrey_Turner] -# client -kentrox-prot 2502/tcp # Kentrox Protocol [Anil_Lakhwara] [Anil_Lakhwara] -kentrox-prot 2502/udp # Kentrox Protocol [Anil_Lakhwara] [Anil_Lakhwara] -nms-dpnss 2503/tcp # NMS-DPNSS [Jean_Christophe_Desi] [Jean_Christophe_Desi] -nms-dpnss 2503/udp # NMS-DPNSS [Jean_Christophe_Desi] [Jean_Christophe_Desi] -wlbs 2504/tcp # WLBS [William_Bain] [William_Bain] -wlbs 2504/udp # WLBS [William_Bain] [William_Bain] -ppcontrol 2505/tcp # PowerPlay Control [Max_Magliaro] [Max_Magliaro] 2004-11 -ppcontrol 2505/udp # PowerPlay Control [Max_Magliaro] [Max_Magliaro] 2004-11 -jbroker 2506/tcp # jbroker [Rohit_Garg_2] [Rohit_Garg_2] -jbroker 2506/udp # jbroker [Rohit_Garg_2] [Rohit_Garg_2] -spock 2507/tcp # spock [Jon_A_Christopher] [Jon_A_Christopher] -spock 2507/udp # spock [Jon_A_Christopher] [Jon_A_Christopher] -jdatastore 2508/tcp # JDataStore [Tod_Landis] [Tod_Landis] -jdatastore 2508/udp # JDataStore [Tod_Landis] [Tod_Landis] -fjmpss 2509/tcp # fjmpss [Makoto_Watanabe] [Makoto_Watanabe] -fjmpss 2509/udp # fjmpss [Makoto_Watanabe] [Makoto_Watanabe] -fjappmgrbulk 2510/tcp # fjappmgrbulk [Hiroyuki_Kawabuchi] [Hiroyuki_Kawabuchi] -fjappmgrbulk 2510/udp # fjappmgrbulk [Hiroyuki_Kawabuchi] [Hiroyuki_Kawabuchi] -metastorm 2511/tcp # Metastorm [Eric_Isom] [Eric_Isom] -metastorm 2511/udp # Metastorm [Eric_Isom] [Eric_Isom] -citrixima 2512/tcp # Citrix IMA -citrixima 2512/udp # Citrix IMA -citrixadmin 2513/tcp # Citrix ADMIN [Myk_Willis] [Myk_Willis] -citrixadmin 2513/udp # Citrix ADMIN [Myk_Willis] [Myk_Willis] -facsys-ntp 2514/tcp # Facsys NTP -facsys-ntp 2514/udp # Facsys NTP -facsys-router 2515/tcp # Facsys Router [Jeff_Hoffman] [Jeff_Hoffman] -facsys-router 2515/udp # Facsys Router [Jeff_Hoffman] [Jeff_Hoffman] -maincontrol 2516/tcp # Main Control [Nathan_Sadia] [Nathan_Sadia] -maincontrol 2516/udp # Main Control [Nathan_Sadia] [Nathan_Sadia] -call-sig-trans 2517/tcp # H.323 Annex E Call Control [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signalling Transport -call-sig-trans 2517/udp # H.323 Annex E Call Control [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signalling Transport -willy 2518/tcp # Willy [Carl_Johan_Wik] [Carl_Johan_Wik] -willy 2518/udp # Willy [Carl_Johan_Wik] [Carl_Johan_Wik] -globmsgsvc 2519/tcp # globmsgsvc [David_Wiltz] [David_Wiltz] -globmsgsvc 2519/udp # globmsgsvc [David_Wiltz] [David_Wiltz] -pvsw 2520/tcp # Pervasive Listener [Chuck_Talk] [Chuck_Talk] -pvsw 2520/udp # Pervasive Listener [Chuck_Talk] [Chuck_Talk] -adaptecmgr 2521/tcp # Adaptec Manager [Mark_Parenti] [Mark_Parenti] -adaptecmgr 2521/udp # Adaptec Manager [Mark_Parenti] [Mark_Parenti] -windb 2522/tcp # WinDb [Larry_Traylor] [Larry_Traylor] -windb 2522/udp # WinDb [Larry_Traylor] [Larry_Traylor] -qke-llc-v3 2523/tcp # Qke LLC V.3 [Joerg_Niehoff] [Joerg_Niehoff] -qke-llc-v3 2523/udp # Qke LLC V.3 [Joerg_Niehoff] [Joerg_Niehoff] -optiwave-lm 2524/tcp # Optiwave License Management [Slawomir_Krzesinski] [Slawomir_Krzesinski] -optiwave-lm 2524/udp # Optiwave License Management [Slawomir_Krzesinski] [Slawomir_Krzesinski] -ms-v-worlds 2525/tcp # MS V-Worlds [Pete_Wong] [Pete_Wong] -ms-v-worlds 2525/udp # MS V-Worlds [Pete_Wong] [Pete_Wong] -ema-sent-lm 2526/tcp # EMA License Manager [Thaddeus_Perala] [Thaddeus_Perala] -ema-sent-lm 2526/udp # EMA License Manager [Thaddeus_Perala] [Thaddeus_Perala] -iqserver 2527/tcp # IQ Server [Nick_Straguzzi] [Nick_Straguzzi] -iqserver 2527/udp # IQ Server [Nick_Straguzzi] [Nick_Straguzzi] -# NCR CCL -# -ncr-ccl 2528/tcp # IANA assigned this [Amitava_Dutta] [Amitava_Dutta] -# well-formed service name as -# a replacement for "ncr_ccl". -# This entry is an alias to "ncr-ccl". This entry is now -ncr_ccl 2528/tcp # NCR CCL [Amitava_Dutta] [Amitava_Dutta] historic, not usable for use with many common service -# discovery mechanisms. -# NCR CCL -# -ncr-ccl 2528/udp # IANA assigned this [Amitava_Dutta] [Amitava_Dutta] -# well-formed service name as -# a replacement for "ncr_ccl". -# This entry is an alias to "ncr-ccl". This entry is now -ncr_ccl 2528/udp # NCR CCL [Amitava_Dutta] [Amitava_Dutta] historic, not usable for use with many common service -# discovery mechanisms. -utsftp 2529/tcp # UTS FTP [David_Moore] [David_Moore] -utsftp 2529/udp # UTS FTP [David_Moore] [David_Moore] -vrcommerce 2530/tcp # VR Commerce [Yosi_Mass] [Yosi_Mass] -vrcommerce 2530/udp # VR Commerce [Yosi_Mass] [Yosi_Mass] -ito-e-gui 2531/tcp # ITO-E GUI [Michael_Haeuptle] [Michael_Haeuptle] -ito-e-gui 2531/udp # ITO-E GUI [Michael_Haeuptle] [Michael_Haeuptle] -ovtopmd 2532/tcp # OVTOPMD [Eric_Pulsipher] [Eric_Pulsipher] -ovtopmd 2532/udp # OVTOPMD [Eric_Pulsipher] [Eric_Pulsipher] -snifferserver 2533/tcp # SnifferServer [Amy_Weaver_3] [Amy_Weaver_3] -snifferserver 2533/udp # SnifferServer [Amy_Weaver_3] [Amy_Weaver_3] -combox-web-acc 2534/tcp # Combox Web Access [Yochai_Cohen] [Yochai_Cohen] -combox-web-acc 2534/udp # Combox Web Access [Yochai_Cohen] [Yochai_Cohen] -madcap 2535/tcp # MADCAP [Stephen_Hanna_2] [Stephen_Hanna_2] -madcap 2535/udp # MADCAP [Stephen_Hanna_2] [Stephen_Hanna_2] -btpp2audctr1 2536/tcp # btpp2audctr1 [Ian_Daniels] [Ian_Daniels] -btpp2audctr1 2536/udp # btpp2audctr1 [Ian_Daniels] [Ian_Daniels] -upgrade 2537/tcp # Upgrade Protocol [Breck_Auten] [Breck_Auten] -upgrade 2537/udp # Upgrade Protocol [Breck_Auten] [Breck_Auten] -vnwk-prapi 2538/tcp # vnwk-prapi [John_Hasselkus] [John_Hasselkus] -vnwk-prapi 2538/udp # vnwk-prapi [John_Hasselkus] [John_Hasselkus] -vsiadmin 2539/tcp # VSI Admin [Rob_Juergens] [Rob_Juergens] -vsiadmin 2539/udp # VSI Admin [Rob_Juergens] [Rob_Juergens] -lonworks 2540/tcp # LonWorks -lonworks 2540/udp # LonWorks -lonworks2 2541/tcp # LonWorks2 [Gary_Bartlett] [Gary_Bartlett] -lonworks2 2541/udp # LonWorks2 [Gary_Bartlett] [Gary_Bartlett] -udrawgraph 2542/tcp # uDraw(Graph) [Bremen] [Bremen] -udrawgraph 2542/udp # uDraw(Graph) [Bremen] [Bremen] -reftek 2543/tcp # REFTEK [Phil_Davidson] [Phil_Davidson] -reftek 2543/udp # REFTEK [Phil_Davidson] [Phil_Davidson] -novell-zen 2544/tcp # Management Daemon Refresh [Ty_Ellis] [Ty_Ellis] -novell-zen 2544/udp # Management Daemon Refresh [Ty_Ellis] [Ty_Ellis] -sis-emt 2545/tcp # sis-emt [Bill_Crawford] [Bill_Crawford] -sis-emt 2545/udp # sis-emt [Bill_Crawford] [Bill_Crawford] -vytalvaultbrtp 2546/tcp # vytalvaultbrtp -vytalvaultbrtp 2546/udp # vytalvaultbrtp -vytalvaultvsmp 2547/tcp # vytalvaultvsmp -vytalvaultvsmp 2547/udp # vytalvaultvsmp -vytalvaultpipe 2548/tcp # vytalvaultpipe [Tim_Boldt] [Tim_Boldt] -vytalvaultpipe 2548/udp # vytalvaultpipe [Tim_Boldt] [Tim_Boldt] -ipass 2549/tcp # IPASS [Michael_Fischer] [Michael_Fischer] -ipass 2549/udp # IPASS [Michael_Fischer] [Michael_Fischer] -ads 2550/tcp # ADS [Michael_O_Connor] [Michael_O_Connor] -ads 2550/udp # ADS [Michael_O_Connor] [Michael_O_Connor] -isg-uda-server 2551/tcp # ISG UDA Server [Dror_Harari] [Dror_Harari] -isg-uda-server 2551/udp # ISG UDA Server [Dror_Harari] [Dror_Harari] -call-logging 2552/tcp # Call Logging [Dean_Webb] [Dean_Webb] -call-logging 2552/udp # Call Logging [Dean_Webb] [Dean_Webb] -efidiningport 2553/tcp # efidiningport [Lynn_Carter] [Lynn_Carter] -efidiningport 2553/udp # efidiningport [Lynn_Carter] [Lynn_Carter] -vcnet-link-v10 2554/tcp # VCnet-Link v10 [Csaba_Mate] [Csaba_Mate] -vcnet-link-v10 2554/udp # VCnet-Link v10 [Csaba_Mate] [Csaba_Mate] -compaq-wcp 2555/tcp # Compaq WCP [Ferruccio_Barletta] [Ferruccio_Barletta] -compaq-wcp 2555/udp # Compaq WCP [Ferruccio_Barletta] [Ferruccio_Barletta] -nicetec-nmsvc 2556/tcp # nicetec-nmsvc -nicetec-nmsvc 2556/udp # nicetec-nmsvc -nicetec-mgmt 2557/tcp # nicetec-mgmt [Joerg_Paulus] [Joerg_Paulus] -nicetec-mgmt 2557/udp # nicetec-mgmt [Joerg_Paulus] [Joerg_Paulus] -pclemultimedia 2558/tcp # PCLE Multi Media [Jacob_Gsoedl] [Jacob_Gsoedl] -pclemultimedia 2558/udp # PCLE Multi Media [Jacob_Gsoedl] [Jacob_Gsoedl] -lstp 2559/tcp # LSTP [Waiki_Wright] [Waiki_Wright] -lstp 2559/udp # LSTP [Waiki_Wright] [Waiki_Wright] -labrat 2560/tcp # labrat [John_Harvey] [John_Harvey] -labrat 2560/udp # labrat [John_Harvey] [John_Harvey] -mosaixcc 2561/tcp # MosaixCC [Steven_Frare] [Steven_Frare] -mosaixcc 2561/udp # MosaixCC [Steven_Frare] [Steven_Frare] -delibo 2562/tcp # Delibo [NovaWiz_LTD] [NovaWiz_LTD] -delibo 2562/udp # Delibo [NovaWiz_LTD] [NovaWiz_LTD] -cti-redwood 2563/tcp # CTI Redwood [Songwon_Chi] [Songwon_Chi] -cti-redwood 2563/udp # CTI Redwood [Songwon_Chi] [Songwon_Chi] -hp-3000-telnet 2564/tcp # HP 3000 NS/VT block mode -# telnet -hp-3000-telnet 2564/udp # HP 3000 NS/VT block mode -# telnet -coord-svr 2565/tcp # Coordinator Server [Richard_Steiger] [Richard_Steiger] -coord-svr 2565/udp # Coordinator Server [Richard_Steiger] [Richard_Steiger] -pcs-pcw 2566/tcp # pcs-pcw [W_Jordan_Fitzhugh] [W_Jordan_Fitzhugh] -pcs-pcw 2566/udp # pcs-pcw [W_Jordan_Fitzhugh] [W_Jordan_Fitzhugh] -clp 2567/tcp # Cisco Line Protocol [Susan_Hinrichs] [Susan_Hinrichs] -clp 2567/udp # Cisco Line Protocol [Susan_Hinrichs] [Susan_Hinrichs] -spamtrap 2568/tcp # SPAM TRAP [Charles_Bennett] [Charles_Bennett] 2008-08-29 -spamtrap 2568/udp # SPAM TRAP [Charles_Bennett] [Charles_Bennett] 2008-08-29 -sonuscallsig 2569/tcp # Sonus Call Signal [Mark_Garti] [Mark_Garti] -sonuscallsig 2569/udp # Sonus Call Signal [Mark_Garti] [Mark_Garti] -hs-port 2570/tcp # HS Port [Uri_Doron] [Uri_Doron] -hs-port 2570/udp # HS Port [Uri_Doron] [Uri_Doron] -cecsvc 2571/tcp # CECSVC [Roger_Pao] [Roger_Pao] -cecsvc 2571/udp # CECSVC [Roger_Pao] [Roger_Pao] -ibp 2572/tcp # IBP [Jonathan_Downes] [Jonathan_Downes] -ibp 2572/udp # IBP [Jonathan_Downes] [Jonathan_Downes] -trustestablish 2573/tcp # Trust Establish [Yosi_Mass] [Yosi_Mass] -trustestablish 2573/udp # Trust Establish [Yosi_Mass] [Yosi_Mass] -blockade-bpsp 2574/tcp # Blockade BPSP [Blockade] [Blockade] -blockade-bpsp 2574/udp # Blockade BPSP [Blockade] [Blockade] -hl7 2575/tcp # HL7 [Tim_Jacobs] [Tim_Jacobs] -hl7 2575/udp # HL7 [Tim_Jacobs] [Tim_Jacobs] -tclprodebugger 2576/tcp # TCL Pro Debugger -tclprodebugger 2576/udp # TCL Pro Debugger -scipticslsrvr 2577/tcp # Scriptics Lsrvr [Brent_Welch] [Brent_Welch] -scipticslsrvr 2577/udp # Scriptics Lsrvr [Brent_Welch] [Brent_Welch] -rvs-isdn-dcp 2578/tcp # RVS ISDN DCP [Michael_Zirpel] [Michael_Zirpel] -rvs-isdn-dcp 2578/udp # RVS ISDN DCP [Michael_Zirpel] [Michael_Zirpel] -mpfoncl 2579/tcp # mpfoncl [Itaru_Kimura] [Itaru_Kimura] -mpfoncl 2579/udp # mpfoncl [Itaru_Kimura] [Itaru_Kimura] -tributary 2580/tcp # Tributary [Louis_Lu] [Louis_Lu] -tributary 2580/udp # Tributary [Louis_Lu] [Louis_Lu] -argis-te 2581/tcp # ARGIS TE -argis-te 2581/udp # ARGIS TE -argis-ds 2582/tcp # ARGIS DS [John_Legh_Page] [John_Legh_Page] -argis-ds 2582/udp # ARGIS DS [John_Legh_Page] [John_Legh_Page] -mon 2583/tcp # MON [Jim_Trocki] [Jim_Trocki] -mon 2583/udp # MON [Jim_Trocki] [Jim_Trocki] -cyaserv 2584/tcp # cyaserv [Morgan_Jones] [Morgan_Jones] -cyaserv 2584/udp # cyaserv [Morgan_Jones] [Morgan_Jones] -netx-server 2585/tcp # NETX Server -netx-server 2585/udp # NETX Server -netx-agent 2586/tcp # NETX Agent [Brett_Dolecheck] [Brett_Dolecheck] -netx-agent 2586/udp # NETX Agent [Brett_Dolecheck] [Brett_Dolecheck] -masc 2587/tcp # MASC [Pavlin_Ivanov_Radosl] [Pavlin_Ivanov_Radosl] -masc 2587/udp # MASC [Pavlin_Ivanov_Radosl] [Pavlin_Ivanov_Radosl] -privilege 2588/tcp # Privilege [Gil_Hecht] [Gil_Hecht] -privilege 2588/udp # Privilege [Gil_Hecht] [Gil_Hecht] -quartus-tcl 2589/tcp # quartus tcl [Subroto_Datta] [Subroto_Datta] -quartus-tcl 2589/udp # quartus tcl [Subroto_Datta] [Subroto_Datta] -idotdist 2590/tcp # idotdist [Jason_Hunter] [Jason_Hunter] -idotdist 2590/udp # idotdist [Jason_Hunter] [Jason_Hunter] -maytagshuffle 2591/tcp # Maytag Shuffle [Ken_Ksiazek] [Ken_Ksiazek] -maytagshuffle 2591/udp # Maytag Shuffle [Ken_Ksiazek] [Ken_Ksiazek] -netrek 2592/tcp # netrek [Al_Guetzlaff] [Al_Guetzlaff] -netrek 2592/udp # netrek [Al_Guetzlaff] [Al_Guetzlaff] -mns-mail 2593/tcp # MNS Mail Notice Service [Rumiko_Kikuta] [Rumiko_Kikuta] -mns-mail 2593/udp # MNS Mail Notice Service [Rumiko_Kikuta] [Rumiko_Kikuta] -dts 2594/tcp # Data Base Server [Andreas_Roene] [Andreas_Roene] -dts 2594/udp # Data Base Server [Andreas_Roene] [Andreas_Roene] -worldfusion1 2595/tcp # World Fusion 1 -worldfusion1 2595/udp # World Fusion 1 -worldfusion2 2596/tcp # World Fusion 2 [World_Fusion] [World_Fusion] -worldfusion2 2596/udp # World Fusion 2 [World_Fusion] [World_Fusion] -homesteadglory 2597/tcp # Homestead Glory [John_Tokash] [John_Tokash] -homesteadglory 2597/udp # Homestead Glory [John_Tokash] [John_Tokash] -citriximaclient 2598/tcp # Citrix MA Client [Myk_Willis] [Myk_Willis] -citriximaclient 2598/udp # Citrix MA Client [Myk_Willis] [Myk_Willis] -snapd 2599/tcp # Snap Discovery [Kevin_Osborn] [Kevin_Osborn] -snapd 2599/udp # Snap Discovery [Kevin_Osborn] [Kevin_Osborn] -hpstgmgr 2600/tcp # HPSTGMGR [Kevin_Collins] [Kevin_Collins] -hpstgmgr 2600/udp # HPSTGMGR [Kevin_Collins] [Kevin_Collins] -discp-client 2601/tcp # discp client -discp-client 2601/udp # discp client -discp-server 2602/tcp # discp server [Peter_White] [Peter_White] -discp-server 2602/udp # discp server [Peter_White] [Peter_White] -servicemeter 2603/tcp # Service Meter [Duncan_Hare] [Duncan_Hare] -servicemeter 2603/udp # Service Meter [Duncan_Hare] [Duncan_Hare] -nsc-ccs 2604/tcp # NSC CCS -nsc-ccs 2604/udp # NSC CCS -nsc-posa 2605/tcp # NSC POSA [Tom_Findley] [Tom_Findley] -nsc-posa 2605/udp # NSC POSA [Tom_Findley] [Tom_Findley] -netmon 2606/tcp # Dell Netmon -netmon 2606/udp # Dell Netmon -connection 2607/tcp # Dell Connection [Sudhir_Shetty] [Sudhir_Shetty] -connection 2607/udp # Dell Connection [Sudhir_Shetty] [Sudhir_Shetty] -wag-service 2608/tcp # Wag Service [Gilles_Bourquard] [Gilles_Bourquard] -wag-service 2608/udp # Wag Service [Gilles_Bourquard] [Gilles_Bourquard] -system-monitor 2609/tcp # System Monitor [Greg_Robson_Garth] [Greg_Robson_Garth] -system-monitor 2609/udp # System Monitor [Greg_Robson_Garth] [Greg_Robson_Garth] -versa-tek 2610/tcp # VersaTek [James_Kou] [James_Kou] -versa-tek 2610/udp # VersaTek [James_Kou] [James_Kou] -lionhead 2611/tcp # LIONHEAD [Tim_Rance] [Tim_Rance] -lionhead 2611/udp # LIONHEAD [Tim_Rance] [Tim_Rance] -qpasa-agent 2612/tcp # Qpasa Agent [Craig_Ching] [Craig_Ching] -qpasa-agent 2612/udp # Qpasa Agent [Craig_Ching] [Craig_Ching] -smntubootstrap 2613/tcp # SMNTUBootstrap [Matt_Cecile] [Matt_Cecile] -smntubootstrap 2613/udp # SMNTUBootstrap [Matt_Cecile] [Matt_Cecile] -neveroffline 2614/tcp # Never Offline [Dustin_Brand] [Dustin_Brand] -neveroffline 2614/udp # Never Offline [Dustin_Brand] [Dustin_Brand] -firepower 2615/tcp # firepower [Jason_Volk] [Jason_Volk] -firepower 2615/udp # firepower [Jason_Volk] [Jason_Volk] -appswitch-emp 2616/tcp # appswitch-emp [Ted_Ross] [Ted_Ross] -appswitch-emp 2616/udp # appswitch-emp [Ted_Ross] [Ted_Ross] -cmadmin 2617/tcp # Clinical Context Managers [Mark_Morwood] [Mark_Morwood] -cmadmin 2617/udp # Clinical Context Managers [Mark_Morwood] [Mark_Morwood] -priority-e-com 2618/tcp # Priority E-Com [Marcelo_Einhorn_2] [Marcelo_Einhorn_2] -priority-e-com 2618/udp # Priority E-Com [Marcelo_Einhorn_2] [Marcelo_Einhorn_2] -bruce 2619/tcp # bruce [Alec_Muffett] [Alec_Muffett] -bruce 2619/udp # bruce [Alec_Muffett] [Alec_Muffett] -lpsrecommender 2620/tcp # LPSRecommender [Pritham_Shetty_2] [Pritham_Shetty_2] -lpsrecommender 2620/udp # LPSRecommender [Pritham_Shetty_2] [Pritham_Shetty_2] -miles-apart 2621/tcp # Miles Apart Jukebox Server [Michael_Rathmann] [Michael_Rathmann] -miles-apart 2621/udp # Miles Apart Jukebox Server [Michael_Rathmann] [Michael_Rathmann] -metricadbc 2622/tcp # MetricaDBC [Russ_Olivant] [Russ_Olivant] -metricadbc 2622/udp # MetricaDBC [Russ_Olivant] [Russ_Olivant] -lmdp 2623/tcp # LMDP [Ken_Bailey] [Ken_Bailey] -lmdp 2623/udp # LMDP [Ken_Bailey] [Ken_Bailey] -aria 2624/tcp # Aria [Logan_Bruns] [Logan_Bruns] -aria 2624/udp # Aria [Logan_Bruns] [Logan_Bruns] -blwnkl-port 2625/tcp # Blwnkl Port [Weng_Chin_Yung] [Weng_Chin_Yung] -blwnkl-port 2625/udp # Blwnkl Port [Weng_Chin_Yung] [Weng_Chin_Yung] -gbjd816 2626/tcp # gbjd816 [George_Balesta] [George_Balesta] -gbjd816 2626/udp # gbjd816 [George_Balesta] [George_Balesta] -moshebeeri 2627/tcp # Moshe Beeri [Moshe_Beeri] [Moshe_Beeri] -moshebeeri 2627/udp # Moshe Beeri [Moshe_Beeri] [Moshe_Beeri] -dict 2628/tcp # DICT [Rik_Faith] [Rik_Faith] -dict 2628/udp # DICT [Rik_Faith] [Rik_Faith] -sitaraserver 2629/tcp # Sitara Server -sitaraserver 2629/udp # Sitara Server -sitaramgmt 2630/tcp # Sitara Management -sitaramgmt 2630/udp # Sitara Management -sitaradir 2631/tcp # Sitara Dir [Manickam_R_Sridhar] [Manickam_R_Sridhar] -sitaradir 2631/udp # Sitara Dir [Manickam_R_Sridhar] [Manickam_R_Sridhar] -irdg-post 2632/tcp # IRdg Post [IRdg] [IRdg] -irdg-post 2632/udp # IRdg Post [IRdg] [IRdg] -interintelli 2633/tcp # InterIntelli [Mike_Gagle] [Mike_Gagle] -interintelli 2633/udp # InterIntelli [Mike_Gagle] [Mike_Gagle] -pk-electronics 2634/tcp # PK Electronics [Seb_Ibis] [Seb_Ibis] -pk-electronics 2634/udp # PK Electronics [Seb_Ibis] [Seb_Ibis] -backburner 2635/tcp # Back Burner [Kevin_Teiskoetter] [Kevin_Teiskoetter] -backburner 2635/udp # Back Burner [Kevin_Teiskoetter] [Kevin_Teiskoetter] -solve 2636/tcp # Solve [Peter_Morrison] [Peter_Morrison] -solve 2636/udp # Solve [Peter_Morrison] [Peter_Morrison] -imdocsvc 2637/tcp # Import Document Service [Zia_Bhatti] [Zia_Bhatti] -imdocsvc 2637/udp # Import Document Service [Zia_Bhatti] [Zia_Bhatti] -sybaseanywhere 2638/tcp # Sybase Anywhere [Dave_Neudoerffer] [Dave_Neudoerffer] -sybaseanywhere 2638/udp # Sybase Anywhere [Dave_Neudoerffer] [Dave_Neudoerffer] -aminet 2639/tcp # AMInet [Alcorn_McBride_Inc] [Alcorn_McBride_Inc] -aminet 2639/udp # AMInet [Alcorn_McBride_Inc] [Alcorn_McBride_Inc] -# Sabbagh Associates Licence -# Manager -# -sai-sentlm 2640/tcp # IANA assigned this [Elias_Sabbagh] [Elias_Sabbagh] -# well-formed service name as -# a replacement for -# "sai_sentlm". -# Sabbagh Associates Licence This entry is an alias to "sai-sentlm". This entry is now -sai_sentlm 2640/tcp # Manager [Elias_Sabbagh] [Elias_Sabbagh] historic, not usable for use with many common service -# discovery mechanisms. -# Sabbagh Associates Licence -# Manager -# -sai-sentlm 2640/udp # IANA assigned this [Elias_Sabbagh] [Elias_Sabbagh] -# well-formed service name as -# a replacement for -# "sai_sentlm". -# Sabbagh Associates Licence This entry is an alias to "sai-sentlm". This entry is now -sai_sentlm 2640/udp # Manager [Elias_Sabbagh] [Elias_Sabbagh] historic, not usable for use with many common service -# discovery mechanisms. -hdl-srv 2641/tcp # HDL Server [David_Ely] [David_Ely] -hdl-srv 2641/udp # HDL Server [David_Ely] [David_Ely] -tragic 2642/tcp # Tragic [Stu_Mark] [Stu_Mark] -tragic 2642/udp # Tragic [Stu_Mark] [Stu_Mark] -gte-samp 2643/tcp # GTE-SAMP [Asher_Altman] [Asher_Altman] -gte-samp 2643/udp # GTE-SAMP [Asher_Altman] [Asher_Altman] -travsoft-ipx-t 2644/tcp # Travsoft IPX Tunnel [Jack_Wilson] [Jack_Wilson] -travsoft-ipx-t 2644/udp # Travsoft IPX Tunnel [Jack_Wilson] [Jack_Wilson] -novell-ipx-cmd 2645/tcp # Novell IPX CMD [Juan_Carlos_Luciani] [Juan_Carlos_Luciani] -novell-ipx-cmd 2645/udp # Novell IPX CMD [Juan_Carlos_Luciani] [Juan_Carlos_Luciani] -and-lm 2646/tcp # AND License Manager [Dick_van_der_Sijs] [Dick_van_der_Sijs] -and-lm 2646/udp # AND License Manager [Dick_van_der_Sijs] [Dick_van_der_Sijs] -syncserver 2647/tcp # SyncServer [Shawn_Casey] [Shawn_Casey] -syncserver 2647/udp # SyncServer [Shawn_Casey] [Shawn_Casey] -upsnotifyprot 2648/tcp # Upsnotifyprot [Mario_Leboute] [Mario_Leboute] -upsnotifyprot 2648/udp # Upsnotifyprot [Mario_Leboute] [Mario_Leboute] -vpsipport 2649/tcp # VPSIPPORT [Joon_Radley] [Joon_Radley] -vpsipport 2649/udp # VPSIPPORT [Joon_Radley] [Joon_Radley] -eristwoguns 2650/tcp # eristwoguns [Jason_Lockett][Melanie_Kacerek] [Jason_Lockett][Melanie_Kacerek] 2008-12-16 -eristwoguns 2650/udp # eristwoguns [Jason_Lockett][Melanie_Kacerek] [Jason_Lockett][Melanie_Kacerek] 2008-12-16 -ebinsite 2651/tcp # EBInSite [Lefteris_Kalamaras] [Lefteris_Kalamaras] -ebinsite 2651/udp # EBInSite [Lefteris_Kalamaras] [Lefteris_Kalamaras] -interpathpanel 2652/tcp # InterPathPanel [Stephen_Misel] [Stephen_Misel] -interpathpanel 2652/udp # InterPathPanel [Stephen_Misel] [Stephen_Misel] -sonus 2653/tcp # Sonus [Mark_Garti] [Mark_Garti] -sonus 2653/udp # Sonus [Mark_Garti] [Mark_Garti] -# Corel VNC Admin -# -corel-vncadmin 2654/tcp # IANA assigned this [Oleg_Noskov] [Oleg_Noskov] -# well-formed service name as -# a replacement for -# "corel_vncadmin". -# This entry is an alias to "corel-vncadmin". This entry is now -corel_vncadmin 2654/tcp # Corel VNC Admin [Oleg_Noskov] [Oleg_Noskov] historic, not usable for use with many common service -# discovery mechanisms. -# Corel VNC Admin -# -corel-vncadmin 2654/udp # IANA assigned this [Oleg_Noskov] [Oleg_Noskov] -# well-formed service name as -# a replacement for -# "corel_vncadmin". -# This entry is an alias to "corel-vncadmin". This entry is now -corel_vncadmin 2654/udp # Corel VNC Admin [Oleg_Noskov] [Oleg_Noskov] historic, not usable for use with many common service -# discovery mechanisms. -unglue 2655/tcp # UNIX Nt Glue [Peter_Santoro] [Peter_Santoro] -unglue 2655/udp # UNIX Nt Glue [Peter_Santoro] [Peter_Santoro] -kana 2656/tcp # Kana [Colin_Goldstein] [Colin_Goldstein] -kana 2656/udp # Kana [Colin_Goldstein] [Colin_Goldstein] -sns-dispatcher 2657/tcp # SNS Dispatcher -sns-dispatcher 2657/udp # SNS Dispatcher -sns-admin 2658/tcp # SNS Admin -sns-admin 2658/udp # SNS Admin -sns-query 2659/tcp # SNS Query [Mary_Holstege] [Mary_Holstege] -sns-query 2659/udp # SNS Query [Mary_Holstege] [Mary_Holstege] -gcmonitor 2660/tcp # GC Monitor [Gustavo_Rodriguez_Ri] [Gustavo_Rodriguez_Ri] -gcmonitor 2660/udp # GC Monitor [Gustavo_Rodriguez_Ri] [Gustavo_Rodriguez_Ri] -olhost 2661/tcp # OLHOST [Robert_Ripberger] [Robert_Ripberger] -olhost 2661/udp # OLHOST [Robert_Ripberger] [Robert_Ripberger] -# Unauthorized -bintec-capi 2662/tcp # BinTec-CAPI Use Known on -# port 2662 -# Unauthorized -bintec-capi 2662/udp # BinTec-CAPI Use Known on -# port 2662 -bintec-tapi 2663/tcp # BinTec-TAPI -bintec-tapi 2663/udp # BinTec-TAPI -patrol-mq-gm 2664/tcp # Patrol for MQ GM -patrol-mq-gm 2664/udp # Patrol for MQ GM -patrol-mq-nm 2665/tcp # Patrol for MQ NM [Portnoy_Boxman] [Portnoy_Boxman] -patrol-mq-nm 2665/udp # Patrol for MQ NM [Portnoy_Boxman] [Portnoy_Boxman] -extensis 2666/tcp # extensis [Milton_Sagen] [Milton_Sagen] -extensis 2666/udp # extensis [Milton_Sagen] [Milton_Sagen] -alarm-clock-s 2667/tcp # Alarm Clock Server -alarm-clock-s 2667/udp # Alarm Clock Server -alarm-clock-c 2668/tcp # Alarm Clock Client -alarm-clock-c 2668/udp # Alarm Clock Client -toad 2669/tcp # TOAD [Michael_Marking] [Michael_Marking] -toad 2669/udp # TOAD [Michael_Marking] [Michael_Marking] -tve-announce 2670/tcp # TVE Announce [Dean_Blackketter] [Dean_Blackketter] -tve-announce 2670/udp # TVE Announce [Dean_Blackketter] [Dean_Blackketter] -newlixreg 2671/tcp # newlixreg [Jean_Serge_Gagnon_2] [Jean_Serge_Gagnon_2] -newlixreg 2671/udp # newlixreg [Jean_Serge_Gagnon_2] [Jean_Serge_Gagnon_2] -nhserver 2672/tcp # nhserver [Adrian_Hornby] [Adrian_Hornby] -nhserver 2672/udp # nhserver [Adrian_Hornby] [Adrian_Hornby] -firstcall42 2673/tcp # First Call 42 [Luke_Bowen] [Luke_Bowen] -firstcall42 2673/udp # First Call 42 [Luke_Bowen] [Luke_Bowen] -ewnn 2674/tcp # ewnn [Yasunari_Yamashita] [Yasunari_Yamashita] -ewnn 2674/udp # ewnn [Yasunari_Yamashita] [Yasunari_Yamashita] -ttc-etap 2675/tcp # TTC ETAP [Daniel_Becker] [Daniel_Becker] -ttc-etap 2675/udp # TTC ETAP [Daniel_Becker] [Daniel_Becker] -simslink 2676/tcp # SIMSLink [Steve_Ryckman] [Steve_Ryckman] -simslink 2676/udp # SIMSLink [Steve_Ryckman] [Steve_Ryckman] -gadgetgate1way 2677/tcp # Gadget Gate 1 Way -gadgetgate1way 2677/udp # Gadget Gate 1 Way -gadgetgate2way 2678/tcp # Gadget Gate 2 Way [Matt_Rollins] [Matt_Rollins] -gadgetgate2way 2678/udp # Gadget Gate 2 Way [Matt_Rollins] [Matt_Rollins] -syncserverssl 2679/tcp # Sync Server SSL [Shawn_Casey] [Shawn_Casey] -syncserverssl 2679/udp # Sync Server SSL [Shawn_Casey] [Shawn_Casey] -pxc-sapxom 2680/tcp # pxc-sapxom [Hideki_Kiriyama] [Hideki_Kiriyama] -pxc-sapxom 2680/udp # pxc-sapxom [Hideki_Kiriyama] [Hideki_Kiriyama] -mpnjsomb 2681/tcp # mpnjsomb [Takenori_Miyahara] [Takenori_Miyahara] -mpnjsomb 2681/udp # mpnjsomb [Takenori_Miyahara] [Takenori_Miyahara] -# 2682 Removed 2002-04-30 -ncdloadbalance 2683/tcp # NCDLoadBalance [Tim_Stevenson] [Tim_Stevenson] -ncdloadbalance 2683/udp # NCDLoadBalance [Tim_Stevenson] [Tim_Stevenson] -mpnjsosv 2684/tcp # mpnjsosv -mpnjsosv 2684/udp # mpnjsosv -mpnjsocl 2685/tcp # mpnjsocl -mpnjsocl 2685/udp # mpnjsocl -mpnjsomg 2686/tcp # mpnjsomg [Takenori_Miyahara] [Takenori_Miyahara] -mpnjsomg 2686/udp # mpnjsomg [Takenori_Miyahara] [Takenori_Miyahara] -pq-lic-mgmt 2687/tcp # pq-lic-mgmt [Bob_Sledge] [Bob_Sledge] -pq-lic-mgmt 2687/udp # pq-lic-mgmt [Bob_Sledge] [Bob_Sledge] -md-cg-http 2688/tcp # md-cf-http [Lyndon_Nerenberg] [Lyndon_Nerenberg] -md-cg-http 2688/udp # md-cf-http [Lyndon_Nerenberg] [Lyndon_Nerenberg] -fastlynx 2689/tcp # FastLynx [Dave_Sewell] [Dave_Sewell] -fastlynx 2689/udp # FastLynx [Dave_Sewell] [Dave_Sewell] -hp-nnm-data 2690/tcp # HP NNM Embedded Database [Chris_Das] [Chris_Das] -hp-nnm-data 2690/udp # HP NNM Embedded Database [Chris_Das] [Chris_Das] -itinternet 2691/tcp # ITInternet ISM Server [Ron_Ehli] [Ron_Ehli] -itinternet 2691/udp # ITInternet ISM Server [Ron_Ehli] [Ron_Ehli] -admins-lms 2692/tcp # Admins LMS [Dagfinn_Saether] [Dagfinn_Saether] -admins-lms 2692/udp # Admins LMS [Dagfinn_Saether] [Dagfinn_Saether] -# 2693 tcp Unassigned (Removed 2004-2-6) -# 2693 udp Unassigned (Removed 2004-2-6) -pwrsevent 2694/tcp # pwrsevent [Yoshinobu_Nakamura] [Yoshinobu_Nakamura] -pwrsevent 2694/udp # pwrsevent [Yoshinobu_Nakamura] [Yoshinobu_Nakamura] -vspread 2695/tcp # VSPREAD [Sumitake_kobayashi] [Sumitake_kobayashi] -vspread 2695/udp # VSPREAD [Sumitake_kobayashi] [Sumitake_kobayashi] -unifyadmin 2696/tcp # Unify Admin [Daegis_Inc] [Chris_Anderson] 2012-07-31 -unifyadmin 2696/udp # Unify Admin [Daegis_Inc] [Chris_Anderson] 2012-07-31 -oce-snmp-trap 2697/tcp # Oce SNMP Trap Port [Peter_Teeuwen] [Peter_Teeuwen] -oce-snmp-trap 2697/udp # Oce SNMP Trap Port [Peter_Teeuwen] [Peter_Teeuwen] -mck-ivpip 2698/tcp # MCK-IVPIP [Robert_Vincent] [Robert_Vincent] -mck-ivpip 2698/udp # MCK-IVPIP [Robert_Vincent] [Robert_Vincent] -csoft-plusclnt 2699/tcp # Csoft Plus Client [Nedelcho_Stanev] [Nedelcho_Stanev] -csoft-plusclnt 2699/udp # Csoft Plus Client [Nedelcho_Stanev] [Nedelcho_Stanev] -tqdata 2700/tcp # tqdata [Al_Guetzlaff] [Al_Guetzlaff] -tqdata 2700/udp # tqdata [Al_Guetzlaff] [Al_Guetzlaff] -sms-rcinfo 2701/tcp # SMS RCINFO -sms-rcinfo 2701/udp # SMS RCINFO -sms-xfer 2702/tcp # SMS XFER -sms-xfer 2702/udp # SMS XFER -sms-chat 2703/tcp # SMS CHAT -sms-chat 2703/udp # SMS CHAT -sms-remctrl 2704/tcp # SMS REMCTRL [Tom_Friend] [Tom_Friend] -sms-remctrl 2704/udp # SMS REMCTRL [Tom_Friend] [Tom_Friend] -sds-admin 2705/tcp # SDS Admin [Don_Traub] [Don_Traub] -sds-admin 2705/udp # SDS Admin [Don_Traub] [Don_Traub] -ncdmirroring 2706/tcp # NCD Mirroring [Tim_Stevenson] [Tim_Stevenson] -ncdmirroring 2706/udp # NCD Mirroring [Tim_Stevenson] [Tim_Stevenson] -emcsymapiport 2707/tcp # EMCSYMAPIPORT [Bruce_Ferjulian] [Bruce_Ferjulian] -emcsymapiport 2707/udp # EMCSYMAPIPORT [Bruce_Ferjulian] [Bruce_Ferjulian] -banyan-net 2708/tcp # Banyan-Net [R_Thirumurthy] [R_Thirumurthy] -banyan-net 2708/udp # Banyan-Net [R_Thirumurthy] [R_Thirumurthy] -supermon 2709/tcp # Supermon [Ron_Minnich] [Ron_Minnich] -supermon 2709/udp # Supermon [Ron_Minnich] [Ron_Minnich] -sso-service 2710/tcp # SSO Service -sso-service 2710/udp # SSO Service -sso-control 2711/tcp # SSO Control [Axel_Kern] [Axel_Kern] -sso-control 2711/udp # SSO Control [Axel_Kern] [Axel_Kern] -aocp 2712/tcp # Axapta Object Communication [Jakob_Steen_Hansen] [Jakob_Steen_Hansen] -# Protocol -aocp 2712/udp # Axapta Object Communication [Jakob_Steen_Hansen] [Jakob_Steen_Hansen] -# Protocol -raventbs 2713/tcp # Raven Trinity Broker Service -raventbs 2713/udp # Raven Trinity Broker Service -raventdm 2714/tcp # Raven Trinity Data Mover [Daniel_Sorlov] [Daniel_Sorlov] -raventdm 2714/udp # Raven Trinity Data Mover [Daniel_Sorlov] [Daniel_Sorlov] -hpstgmgr2 2715/tcp # HPSTGMGR2 [Kevin_Collins_2] [Kevin_Collins_2] -hpstgmgr2 2715/udp # HPSTGMGR2 [Kevin_Collins_2] [Kevin_Collins_2] -inova-ip-disco 2716/tcp # Inova IP Disco [Chris_Koeritz] [Chris_Koeritz] -inova-ip-disco 2716/udp # Inova IP Disco [Chris_Koeritz] [Chris_Koeritz] -pn-requester 2717/tcp # PN REQUESTER -pn-requester 2717/udp # PN REQUESTER -pn-requester2 2718/tcp # PN REQUESTER 2 [Portnoy_Boxman] [Portnoy_Boxman] -pn-requester2 2718/udp # PN REQUESTER 2 [Portnoy_Boxman] [Portnoy_Boxman] -scan-change 2719/tcp # Scan & Change [Alexander_Raji] [Alexander_Raji] -scan-change 2719/udp # Scan & Change [Alexander_Raji] [Alexander_Raji] -wkars 2720/tcp # wkars [Barry_Shelton] [Barry_Shelton] -wkars 2720/udp # wkars [Barry_Shelton] [Barry_Shelton] -smart-diagnose 2721/tcp # Smart Diagnose [Geoffry_Meek] [Geoffry_Meek] -smart-diagnose 2721/udp # Smart Diagnose [Geoffry_Meek] [Geoffry_Meek] -proactivesrvr 2722/tcp # Proactive Server [Dalit_Naor] [Dalit_Naor] -proactivesrvr 2722/udp # Proactive Server [Dalit_Naor] [Dalit_Naor] -watchdog-nt 2723/tcp # WatchDog NT Protocol [Glen_Sansoucie] [Glen_Sansoucie] -watchdog-nt 2723/udp # WatchDog NT Protocol [Glen_Sansoucie] [Glen_Sansoucie] -qotps 2724/tcp # qotps [Piotr_Parlewicz] [Piotr_Parlewicz] -qotps 2724/udp # qotps [Piotr_Parlewicz] [Piotr_Parlewicz] -msolap-ptp2 2725/tcp # MSOLAP PTP2 [Cristian_Petculescu] [Cristian_Petculescu] -msolap-ptp2 2725/udp # MSOLAP PTP2 [Cristian_Petculescu] [Cristian_Petculescu] -tams 2726/tcp # TAMS [David_Leinbach] [David_Leinbach] -tams 2726/udp # TAMS [David_Leinbach] [David_Leinbach] -mgcp-callagent 2727/tcp # Media Gateway Control [Christian_Huitema] [Christian_Huitema] -# Protocol Call Agent -mgcp-callagent 2727/udp # Media Gateway Control [Christian_Huitema] [Christian_Huitema] -# Protocol Call Agent -sqdr 2728/tcp # SQDR [Matthew_Orzen] [Matthew_Orzen] -sqdr 2728/udp # SQDR [Matthew_Orzen] [Matthew_Orzen] -tcim-control 2729/tcp # TCIM Control [Dean_Skelton] [Dean_Skelton] -tcim-control 2729/udp # TCIM Control [Dean_Skelton] [Dean_Skelton] -nec-raidplus 2730/tcp # NEC RaidPlus [Yusuke_Asai] [Yusuke_Asai] -nec-raidplus 2730/udp # NEC RaidPlus [Yusuke_Asai] [Yusuke_Asai] -fyre-messanger 2731/tcp # Fyre Messanger [Robert_Waters] [Robert_Waters] -fyre-messanger 2731/udp # Fyre Messagner [Robert_Waters] [Robert_Waters] -g5m 2732/tcp # G5M [Graham_Klyne] [Graham_Klyne] -g5m 2732/udp # G5M [Graham_Klyne] [Graham_Klyne] -signet-ctf 2733/tcp # Signet CTF [Greg_Broiles] [Greg_Broiles] -signet-ctf 2733/udp # Signet CTF [Greg_Broiles] [Greg_Broiles] -ccs-software 2734/tcp # CCS Software [Bertus_Jacobs] [Bertus_Jacobs] -ccs-software 2734/udp # CCS Software [Bertus_Jacobs] [Bertus_Jacobs] -netiq-mc 2735/tcp # NetIQ Monitor Console [Scott_Southard] [Scott_Southard] 2010-08-25 -netiq-mc 2735/udp # NetIQ Monitor Console [Scott_Southard] [Scott_Southard] 2010-08-25 -radwiz-nms-srv 2736/tcp # RADWIZ NMS SRV [Israel_Shainert] [Israel_Shainert] -radwiz-nms-srv 2736/udp # RADWIZ NMS SRV [Israel_Shainert] [Israel_Shainert] -srp-feedback 2737/tcp # SRP Feedback [Werner_Almesberger] [Werner_Almesberger] -srp-feedback 2737/udp # SRP Feedback [Werner_Almesberger] [Werner_Almesberger] -ndl-tcp-ois-gw 2738/tcp # NDL TCP-OSI Gateway [Martin_Norman] [Martin_Norman] -ndl-tcp-ois-gw 2738/udp # NDL TCP-OSI Gateway [Martin_Norman] [Martin_Norman] -tn-timing 2739/tcp # TN Timing [Paul_Roberts] [Paul_Roberts] -tn-timing 2739/udp # TN Timing [Paul_Roberts] [Paul_Roberts] -alarm 2740/tcp # Alarm [Uriy_Makasjuk] [Uriy_Makasjuk] -alarm 2740/udp # Alarm [Uriy_Makasjuk] [Uriy_Makasjuk] -tsb 2741/tcp # TSB -tsb 2741/udp # TSB -tsb2 2742/tcp # TSB2 [Ashish_Chatterjee] [Ashish_Chatterjee] -tsb2 2742/udp # TSB2 [Ashish_Chatterjee] [Ashish_Chatterjee] -murx 2743/tcp # murx [Thomas_Kuiper] [Thomas_Kuiper] -murx 2743/udp # murx [Thomas_Kuiper] [Thomas_Kuiper] -honyaku 2744/tcp # honyaku [Yasunari_Yamashita] [Yasunari_Yamashita] -honyaku 2744/udp # honyaku [Yasunari_Yamashita] [Yasunari_Yamashita] -urbisnet 2745/tcp # URBISNET [Urbis_Net_Ltd] [Urbis_Net_Ltd] -urbisnet 2745/udp # URBISNET [Urbis_Net_Ltd] [Urbis_Net_Ltd] -cpudpencap 2746/tcp # CPUDPENCAP [Tamir_Zegman] [Tamir_Zegman] -cpudpencap 2746/udp # CPUDPENCAP [Tamir_Zegman] [Tamir_Zegman] -fjippol-swrly 2747/tcp -fjippol-swrly 2747/udp -fjippol-polsvr 2748/tcp -fjippol-polsvr 2748/udp -fjippol-cnsl 2749/tcp -fjippol-cnsl 2749/udp -fjippol-port1 2750/tcp -fjippol-port1 2750/udp -fjippol-port2 2751/tcp # [Shoichi_Tachibana] [Shoichi_Tachibana] -fjippol-port2 2751/udp # [Shoichi_Tachibana] [Shoichi_Tachibana] -rsisysaccess 2752/tcp # RSISYS ACCESS [Christophe_Besant] [Christophe_Besant] -rsisysaccess 2752/udp # RSISYS ACCESS [Christophe_Besant] [Christophe_Besant] -de-spot 2753/tcp # de-spot [Sanjay_Parekh] [Sanjay_Parekh] -de-spot 2753/udp # de-spot [Sanjay_Parekh] [Sanjay_Parekh] -apollo-cc 2754/tcp # APOLLO CC [Brand_Communications] [Brand_Communications] -apollo-cc 2754/udp # APOLLO CC [Brand_Communications] [Brand_Communications] -expresspay 2755/tcp # Express Pay [Ben_Higgins] [Ben_Higgins] -expresspay 2755/udp # Express Pay [Ben_Higgins] [Ben_Higgins] -simplement-tie 2756/tcp # simplement-tie [Tzvika_Chumash] [Tzvika_Chumash] -simplement-tie 2756/udp # simplement-tie [Tzvika_Chumash] [Tzvika_Chumash] -cnrp 2757/tcp # CNRP [Jacob_Ulmert] [Jacob_Ulmert] -cnrp 2757/udp # CNRP [Jacob_Ulmert] [Jacob_Ulmert] -apollo-status 2758/tcp # APOLLO Status -apollo-status 2758/udp # APOLLO Status -apollo-gms 2759/tcp # APOLLO GMS [Simon_Hovell] [Simon_Hovell] -apollo-gms 2759/udp # APOLLO GMS [Simon_Hovell] [Simon_Hovell] -sabams 2760/tcp # Saba MS [Davoud_Maha] [Davoud_Maha] -sabams 2760/udp # Saba MS [Davoud_Maha] [Davoud_Maha] -dicom-iscl 2761/tcp # DICOM ISCL -dicom-iscl 2761/udp # DICOM ISCL -dicom-tls 2762/tcp # DICOM TLS [Lawrence_Tarbox] [Lawrence_Tarbox] -dicom-tls 2762/udp # DICOM TLS [Lawrence_Tarbox] [Lawrence_Tarbox] -desktop-dna 2763/tcp # Desktop DNA [Jon_Walker] [Jon_Walker] -desktop-dna 2763/udp # Desktop DNA [Jon_Walker] [Jon_Walker] -data-insurance 2764/tcp # Data Insurance [Brent_Irwin] [Brent_Irwin] -data-insurance 2764/udp # Data Insurance [Brent_Irwin] [Brent_Irwin] -qip-audup 2765/tcp # qip-audup [Mike_Morgan] [Mike_Morgan] -qip-audup 2765/udp # qip-audup [Mike_Morgan] [Mike_Morgan] -compaq-scp 2766/tcp # Compaq SCP [Ferruccio_Barletta] [Ferruccio_Barletta] -compaq-scp 2766/udp # Compaq SCP [Ferruccio_Barletta] [Ferruccio_Barletta] -uadtc 2767/tcp # UADTC -uadtc 2767/udp # UADTC -uacs 2768/tcp # UACS [Vishwas_Lele] [Vishwas_Lele] -uacs 2768/udp # UACS [Vishwas_Lele] [Vishwas_Lele] -exce 2769/tcp # eXcE [Norm_Freedman] [Norm_Freedman] -exce 2769/udp # eXcE [Norm_Freedman] [Norm_Freedman] -veronica 2770/tcp # Veronica [Jonas_Oberg] [Jonas_Oberg] -veronica 2770/udp # Veronica [Jonas_Oberg] [Jonas_Oberg] -vergencecm 2771/tcp # Vergence CM [Mark_Morwood] [Mark_Morwood] -vergencecm 2771/udp # Vergence CM [Mark_Morwood] [Mark_Morwood] -auris 2772/tcp # auris [Francisco_Saez_Aranc] [Francisco_Saez_Aranc] -auris 2772/udp # auris [Francisco_Saez_Aranc] [Francisco_Saez_Aranc] -rbakcup1 2773/tcp # RBackup Remote Backup -rbakcup1 2773/udp # RBackup Remote Backup -rbakcup2 2774/tcp # RBackup Remote Backup [Rob_Cosgrove] [Rob_Cosgrove] -rbakcup2 2774/udp # RBackup Remote Backup [Rob_Cosgrove] [Rob_Cosgrove] -smpp 2775/tcp # SMPP [Owen_Sullivan] [Owen_Sullivan] -smpp 2775/udp # SMPP [Owen_Sullivan] [Owen_Sullivan] -ridgeway1 2776/tcp # Ridgeway Systems & Software -ridgeway1 2776/udp # Ridgeway Systems & Software -ridgeway2 2777/tcp # Ridgeway Systems & Software [Steve_Read] [Steve_Read] -ridgeway2 2777/udp # Ridgeway Systems & Software [Steve_Read] [Steve_Read] -gwen-sonya 2778/tcp # Gwen-Sonya [Mark_Hurst] [Mark_Hurst] -gwen-sonya 2778/udp # Gwen-Sonya [Mark_Hurst] [Mark_Hurst] -lbc-sync 2779/tcp # LBC Sync -lbc-sync 2779/udp # LBC Sync -lbc-control 2780/tcp # LBC Control [Keiji_Michine] [Keiji_Michine] -lbc-control 2780/udp # LBC Control [Keiji_Michine] [Keiji_Michine] -whosells 2781/tcp # whosells [William_Randolph_Roy] [William_Randolph_Roy] -whosells 2781/udp # whosells [William_Randolph_Roy] [William_Randolph_Roy] -everydayrc 2782/tcp # everydayrc [Ahti_Heinla] [Ahti_Heinla] -everydayrc 2782/udp # everydayrc [Ahti_Heinla] [Ahti_Heinla] -aises 2783/tcp # AISES [Daniel_Grazioli] [Daniel_Grazioli] -aises 2783/udp # AISES [Daniel_Grazioli] [Daniel_Grazioli] -www-dev 2784/tcp # world wide web - development -www-dev 2784/udp # world wide web - development -aic-np 2785/tcp # aic-np [Brad_Parker] [Brad_Parker] -aic-np 2785/udp # aic-np [Brad_Parker] [Brad_Parker] -aic-oncrpc 2786/tcp # aic-oncrpc - Destiny MCD [Brad_Parker] [Brad_Parker] -# database -aic-oncrpc 2786/udp # aic-oncrpc - Destiny MCD [Brad_Parker] [Brad_Parker] -# database -piccolo 2787/tcp # piccolo - Cornerstone [Dave_Bellivea] [Dave_Bellivea] -# Software -piccolo 2787/udp # piccolo - Cornerstone [Dave_Bellivea] [Dave_Bellivea] -# Software -fryeserv 2788/tcp # NetWare Loadable Module - [Joseph_LoPilato] [Joseph_LoPilato] -# Seagate Software -fryeserv 2788/udp # NetWare Loadable Module - [Joseph_LoPilato] [Joseph_LoPilato] -# Seagate Software -media-agent 2789/tcp # Media Agent [Nitzan_Daube] [Nitzan_Daube] -media-agent 2789/udp # Media Agent [Nitzan_Daube] [Nitzan_Daube] -plgproxy 2790/tcp # PLG Proxy [Charlie_Hava] [Charlie_Hava] -plgproxy 2790/udp # PLG Proxy [Charlie_Hava] [Charlie_Hava] -mtport-regist 2791/tcp # MT Port Registrator [Maxim_Tseitlin] [Maxim_Tseitlin] -mtport-regist 2791/udp # MT Port Registrator [Maxim_Tseitlin] [Maxim_Tseitlin] -f5-globalsite 2792/tcp # f5-globalsite [Christian_Saether_2] [Christian_Saether_2] -f5-globalsite 2792/udp # f5-globalsite [Christian_Saether_2] [Christian_Saether_2] -initlsmsad 2793/tcp # initlsmsad [Kelly_Green] [Kelly_Green] -initlsmsad 2793/udp # initlsmsad [Kelly_Green] [Kelly_Green] -# 2794 Unassigned 2006-12-04 -livestats 2795/tcp # LiveStats [Chris_Greene] [Chris_Greene] -livestats 2795/udp # LiveStats [Chris_Greene] [Chris_Greene] -ac-tech 2796/tcp # ac-tech [Chiming_Huang] [Chiming_Huang] -ac-tech 2796/udp # ac-tech [Chiming_Huang] [Chiming_Huang] -esp-encap 2797/tcp # esp-encap [Jorn_Sierwald] [Jorn_Sierwald] -esp-encap 2797/udp # esp-encap [Jorn_Sierwald] [Jorn_Sierwald] -tmesis-upshot 2798/tcp # TMESIS-UPShot [Brian_Schenkenberger] [Brian_Schenkenberger] -tmesis-upshot 2798/udp # TMESIS-UPShot [Brian_Schenkenberger] [Brian_Schenkenberger] -icon-discover 2799/tcp # ICON Discover [Alexander_Falk] [Alexander_Falk] -icon-discover 2799/udp # ICON Discover [Alexander_Falk] [Alexander_Falk] -acc-raid 2800/tcp # ACC RAID [Scott_St_Clair] [Scott_St_Clair] -acc-raid 2800/udp # ACC RAID [Scott_St_Clair] [Scott_St_Clair] -igcp 2801/tcp # IGCP [David_Hampson] [David_Hampson] -igcp 2801/udp # IGCP [David_Hampson] [David_Hampson] -veritas-tcp1 2802/tcp # Veritas TCP1 -veritas-udp1 2802/udp # Veritas UDP1 [Russ_Thrasher] [Russ_Thrasher] -btprjctrl 2803/tcp # btprjctrl [Huw_Thomas] [Huw_Thomas] -btprjctrl 2803/udp # btprjctrl [Huw_Thomas] [Huw_Thomas] -# March Networks Digital Video -dvr-esm 2804/tcp # Recorders and Enterprise [Paul_Streatch] [Paul_Streatch] 2004-06 -# Service Manager products -# March Networks Digital Video -dvr-esm 2804/udp # Recorders and Enterprise [Paul_Streatch] [Paul_Streatch] 2004-06 -# Service Manager products -wta-wsp-s 2805/tcp # WTA WSP-S [Sebastien_Bury] [Sebastien_Bury] -wta-wsp-s 2805/udp # WTA WSP-S [Sebastien_Bury] [Sebastien_Bury] -cspuni 2806/tcp # cspuni -cspuni 2806/udp # cspuni -cspmulti 2807/tcp # cspmulti [Terumasa_Yoneda] [Terumasa_Yoneda] -cspmulti 2807/udp # cspmulti [Terumasa_Yoneda] [Terumasa_Yoneda] -j-lan-p 2808/tcp # J-LAN-P [Takeshi_Sahara] [Takeshi_Sahara] -j-lan-p 2808/udp # J-LAN-P [Takeshi_Sahara] [Takeshi_Sahara] -corbaloc 2809/tcp # CORBA LOC [Ted_McFadden] [Ted_McFadden] -corbaloc 2809/udp # CORBA LOC [Ted_McFadden] [Ted_McFadden] -netsteward 2810/tcp # Active Net Steward [Keith_Morley] [Keith_Morley] -netsteward 2810/udp # Active Net Steward [Keith_Morley] [Keith_Morley] -gsiftp 2811/tcp # GSI FTP [Von_Welch] [Von_Welch] -gsiftp 2811/udp # GSI FTP [Von_Welch] [Von_Welch] -atmtcp 2812/tcp # atmtcp [Werner_Almesberger] [Werner_Almesberger] -atmtcp 2812/udp # atmtcp [Werner_Almesberger] [Werner_Almesberger] -llm-pass 2813/tcp # llm-pass -llm-pass 2813/udp # llm-pass -llm-csv 2814/tcp # llm-csv [Glen_Sansoucie_2] [Glen_Sansoucie_2] -llm-csv 2814/udp # llm-csv [Glen_Sansoucie_2] [Glen_Sansoucie_2] -lbc-measure 2815/tcp # LBC Measurement -lbc-measure 2815/udp # LBC Measurement -lbc-watchdog 2816/tcp # LBC Watchdog [Akiyoshi_Ochi] [Akiyoshi_Ochi] -lbc-watchdog 2816/udp # LBC Watchdog [Akiyoshi_Ochi] [Akiyoshi_Ochi] -nmsigport 2817/tcp # NMSig Port [Peter_Egli_2] [Peter_Egli_2] -nmsigport 2817/udp # NMSig Port [Peter_Egli_2] [Peter_Egli_2] -rmlnk 2818/tcp # rmlnk -rmlnk 2818/udp # rmlnk -fc-faultnotify 2819/tcp # FC Fault Notification [Dave_Watkins] [Dave_Watkins] -fc-faultnotify 2819/udp # FC Fault Notification [Dave_Watkins] [Dave_Watkins] -univision 2820/tcp # UniVision [Keith_Ansell] [Keith_Ansell] -univision 2820/udp # UniVision [Keith_Ansell] [Keith_Ansell] -vrts-at-port 2821/tcp # VERITAS Authentication [Stefan_Winkel] [Stefan_Winkel] -# Service -vrts-at-port 2821/udp # VERITAS Authentication [Stefan_Winkel] [Stefan_Winkel] -# Service -ka0wuc 2822/tcp # ka0wuc [Kit_Haskins] [Kit_Haskins] -ka0wuc 2822/udp # ka0wuc [Kit_Haskins] [Kit_Haskins] -cqg-netlan 2823/tcp # CQG Net/LAN -cqg-netlan 2823/udp # CQG Net/LAN -cqg-netlan-1 2824/tcp # CQG Net/LAN 1 [Jeff_Wood] [Jeff_Wood] -cqg-netlan-1 2824/udp # CQG Net/Lan 1 [Jeff_Wood] [Jeff_Wood] -# 2825 (unassigned) Possibly -# assigned -slc-systemlog 2826/tcp # slc systemlog -slc-systemlog 2826/udp # slc systemlog -slc-ctrlrloops 2827/tcp # slc ctrlrloops [Erwin_Hogeweg] [Erwin_Hogeweg] -slc-ctrlrloops 2827/udp # slc ctrlrloops [Erwin_Hogeweg] [Erwin_Hogeweg] -itm-lm 2828/tcp # ITM License Manager [Portnoy_Boxman] [Portnoy_Boxman] -itm-lm 2828/udp # ITM License Manager [Portnoy_Boxman] [Portnoy_Boxman] -silkp1 2829/tcp # silkp1 -silkp1 2829/udp # silkp1 -silkp2 2830/tcp # silkp2 -silkp2 2830/udp # silkp2 -silkp3 2831/tcp # silkp3 -silkp3 2831/udp # silkp3 -silkp4 2832/tcp # silkp4 [Erik_Skyten] [Erik_Skyten] -silkp4 2832/udp # silkp4 [Erik_Skyten] [Erik_Skyten] -glishd 2833/tcp # glishd [Darrell_Schiebel] [Darrell_Schiebel] -glishd 2833/udp # glishd [Darrell_Schiebel] [Darrell_Schiebel] -evtp 2834/tcp # EVTP -evtp 2834/udp # EVTP -evtp-data 2835/tcp # EVTP-DATA [Eric_Bruno] [Eric_Bruno] -evtp-data 2835/udp # EVTP-DATA [Eric_Bruno] [Eric_Bruno] -catalyst 2836/tcp # catalyst [Garret_Tollkuhn] [Garret_Tollkuhn] -catalyst 2836/udp # catalyst [Garret_Tollkuhn] [Garret_Tollkuhn] -repliweb 2837/tcp # Repliweb [William_Orme] [William_Orme] -repliweb 2837/udp # Repliweb [William_Orme] [William_Orme] -starbot 2838/tcp # Starbot [Markus_Sabadello_2] [Markus_Sabadello_2] -starbot 2838/udp # Starbot [Markus_Sabadello_2] [Markus_Sabadello_2] -nmsigport 2839/tcp # NMSigPort [Peter_Egli_2] [Peter_Egli_2] -nmsigport 2839/udp # NMSigPort [Peter_Egli_2] [Peter_Egli_2] -l3-exprt 2840/tcp # l3-exprt -l3-exprt 2840/udp # l3-exprt -l3-ranger 2841/tcp # l3-ranger -l3-ranger 2841/udp # l3-ranger -l3-hawk 2842/tcp # l3-hawk [Dolores_Scott_2] [Dolores_Scott_2] -l3-hawk 2842/udp # l3-hawk [Dolores_Scott_2] [Dolores_Scott_2] -pdnet 2843/tcp # PDnet [Torsten_Scheffler] [Torsten_Scheffler] -pdnet 2843/udp # PDnet [Torsten_Scheffler] [Torsten_Scheffler] -bpcp-poll 2844/tcp # BPCP POLL -bpcp-poll 2844/udp # BPCP POLL -bpcp-trap 2845/tcp # BPCP TRAP [Steve_Van_Duser] [Steve_Van_Duser] -bpcp-trap 2845/udp # BPCP TRAP [Steve_Van_Duser] [Steve_Van_Duser] -aimpp-hello 2846/tcp # AIMPP Hello -aimpp-hello 2846/udp # AIMPP Hello -aimpp-port-req 2847/tcp # AIMPP Port Req [Brian_Martinicky] [Brian_Martinicky] -aimpp-port-req 2847/udp # AIMPP Port Req [Brian_Martinicky] [Brian_Martinicky] -amt-blc-port 2848/tcp # AMT-BLC-PORT [Sandra_Frulloni] [Sandra_Frulloni] -amt-blc-port 2848/udp # AMT-BLC-PORT [Sandra_Frulloni] [Sandra_Frulloni] -fxp 2849/tcp # FXP [Martin_Lichtin] [Martin_Lichtin] -fxp 2849/udp # FXP [Martin_Lichtin] [Martin_Lichtin] -metaconsole 2850/tcp # MetaConsole [Rakesh_Mahajan] [Rakesh_Mahajan] -metaconsole 2850/udp # MetaConsole [Rakesh_Mahajan] [Rakesh_Mahajan] -webemshttp 2851/tcp # webemshttp [Stephen_Tsun] [Stephen_Tsun] -webemshttp 2851/udp # webemshttp [Stephen_Tsun] [Stephen_Tsun] -bears-01 2852/tcp # bears-01 [Bruce_McKinnon] [Bruce_McKinnon] -bears-01 2852/udp # bears-01 [Bruce_McKinnon] [Bruce_McKinnon] -ispipes 2853/tcp # ISPipes [Rajesh_Nandyalam] [Rajesh_Nandyalam] -ispipes 2853/udp # ISPipes [Rajesh_Nandyalam] [Rajesh_Nandyalam] -infomover 2854/tcp # InfoMover [Carla_Caputo] [Carla_Caputo] -infomover 2854/udp # InfoMover [Carla_Caputo] [Carla_Caputo] -msrp 2855/tcp # MSRP over TCP 2014-04-09 [RFC4976] -# 2855 udp Reserved 2014-04-09 -cesdinv 2856/tcp # cesdinv [Yoshiaki_Tokumoto] [Yoshiaki_Tokumoto] -cesdinv 2856/udp # cesdinv [Yoshiaki_Tokumoto] [Yoshiaki_Tokumoto] -simctlp 2857/tcp # SimCtIP [Christian_Zietz] [Christian_Zietz] -simctlp 2857/udp # SimCtIP [Christian_Zietz] [Christian_Zietz] -ecnp 2858/tcp # ECNP [Robert_Reimiller] [Robert_Reimiller] -ecnp 2858/udp # ECNP [Robert_Reimiller] [Robert_Reimiller] -activememory 2859/tcp # Active Memory [Joe_Graham] [Joe_Graham] -activememory 2859/udp # Active Memory [Joe_Graham] [Joe_Graham] -dialpad-voice1 2860/tcp # Dialpad Voice 1 -dialpad-voice1 2860/udp # Dialpad Voice 1 -dialpad-voice2 2861/tcp # Dialpad Voice 2 [Wongyu_Cho] [Wongyu_Cho] -dialpad-voice2 2861/udp # Dialpad Voice 2 [Wongyu_Cho] [Wongyu_Cho] -ttg-protocol 2862/tcp # TTG Protocol [Mark_Boler] [Mark_Boler] -ttg-protocol 2862/udp # TTG Protocol [Mark_Boler] [Mark_Boler] -sonardata 2863/tcp # Sonar Data [Ian_Higginbottom] [Ian_Higginbottom] -sonardata 2863/udp # Sonar Data [Ian_Higginbottom] [Ian_Higginbottom] -astromed-main 2864/tcp # main 5001 cmd [Chris_Tate] [Chris_Tate] -astromed-main 2864/udp # main 5001 cmd [Chris_Tate] [Chris_Tate] -pit-vpn 2865/tcp # pit-vpn [Norbert_Sendetzky] [Norbert_Sendetzky] -pit-vpn 2865/udp # pit-vpn [Norbert_Sendetzky] [Norbert_Sendetzky] -iwlistener 2866/tcp # iwlistener [Fred_Surr] [Fred_Surr] -iwlistener 2866/udp # iwlistener [Fred_Surr] [Fred_Surr] -esps-portal 2867/tcp # esps-portal [Nicholas_Stowfis] [Nicholas_Stowfis] -esps-portal 2867/udp # esps-portal [Nicholas_Stowfis] [Nicholas_Stowfis] -npep-messaging 2868/tcp # Norman Proprietaqry Events [AVG_Technologies_Norway_AS] [Kristian_A_Bognaes_2] 2015-05-20 -# Protocol -npep-messaging 2868/udp # Norman Proprietaqry Events [AVG_Technologies_Norway_AS] [Kristian_A_Bognaes_2] 2015-05-20 -# Protocol -icslap 2869/tcp # ICSLAP [Richard_Lamb] [Richard_Lamb] -icslap 2869/udp # ICSLAP [Richard_Lamb] [Richard_Lamb] -daishi 2870/tcp # daishi [Patrick_Chipman] [Patrick_Chipman] -daishi 2870/udp # daishi [Patrick_Chipman] [Patrick_Chipman] -msi-selectplay 2871/tcp # MSI Select Play [Paul_Fonte] [Paul_Fonte] -msi-selectplay 2871/udp # MSI Select Play [Paul_Fonte] [Paul_Fonte] -radix 2872/tcp # RADIX [Stein_Roger_Skaflott] [Stein_Roger_Skaflott] 2011-07-06 -radix 2872/udp # RADIX [Stein_Roger_Skaflott] [Stein_Roger_Skaflott] 2011-07-06 -# 2873 Unassigned 2003-07-23 -dxmessagebase1 2874/tcp # DX Message Base Transport -# Protocol -dxmessagebase1 2874/udp # DX Message Base Transport -# Protocol -dxmessagebase2 2875/tcp # DX Message Base Transport [G_E_Ozz_Nixon_Jr] [G_E_Ozz_Nixon_Jr] 2009-01-13 -# Protocol -dxmessagebase2 2875/udp # DX Message Base Transport [G_E_Ozz_Nixon_Jr] [G_E_Ozz_Nixon_Jr] 2009-01-13 -# Protocol -sps-tunnel 2876/tcp # SPS Tunnel [Bill_McIntosh] [Bill_McIntosh] -sps-tunnel 2876/udp # SPS Tunnel [Bill_McIntosh] [Bill_McIntosh] -bluelance 2877/tcp # BLUELANCE [Michael_Padrezas] [Michael_Padrezas] -bluelance 2877/udp # BLUELANCE [Michael_Padrezas] [Michael_Padrezas] -aap 2878/tcp # AAP [Stephen_Hanna_2] [Stephen_Hanna_2] -aap 2878/udp # AAP [Stephen_Hanna_2] [Stephen_Hanna_2] -ucentric-ds 2879/tcp # ucentric-ds [Alex_Vasilevsky] [Alex_Vasilevsky] -ucentric-ds 2879/udp # ucentric-ds [Alex_Vasilevsky] [Alex_Vasilevsky] -synapse 2880/tcp # Synapse Transport [Ali_Fracyon] [Ali_Fracyon] -synapse 2880/udp # Synapse Transport [Ali_Fracyon] [Ali_Fracyon] -ndsp 2881/tcp # NDSP -ndsp 2881/udp # NDSP -ndtp 2882/tcp # NDTP -ndtp 2882/udp # NDTP -ndnp 2883/tcp # NDNP [Khelben_Blackstaff] [Khelben_Blackstaff] -ndnp 2883/udp # NDNP [Khelben_Blackstaff] [Khelben_Blackstaff] -flashmsg 2884/tcp # Flash Msg [Jeffrey_Zinkerman] [Jeffrey_Zinkerman] -flashmsg 2884/udp # Flash Msg [Jeffrey_Zinkerman] [Jeffrey_Zinkerman] -topflow 2885/tcp # TopFlow [Ted_Ross] [Ted_Ross] -topflow 2885/udp # TopFlow [Ted_Ross] [Ted_Ross] -responselogic 2886/tcp # RESPONSELOGIC [Bruce_Casey] [Bruce_Casey] -responselogic 2886/udp # RESPONSELOGIC [Bruce_Casey] [Bruce_Casey] -aironetddp 2887/tcp # aironet [Victor_Griswold] [Victor_Griswold] -aironetddp 2887/udp # aironet [Victor_Griswold] [Victor_Griswold] -spcsdlobby 2888/tcp # SPCSDLOBBY [Matthew_Williams] [Matthew_Williams] -spcsdlobby 2888/udp # SPCSDLOBBY [Matthew_Williams] [Matthew_Williams] -rsom 2889/tcp # RSOM [Justine_Higgins] [Justine_Higgins] -rsom 2889/udp # RSOM [Justine_Higgins] [Justine_Higgins] -cspclmulti 2890/tcp # CSPCLMULTI [Yoneda_Terumasa] [Yoneda_Terumasa] -cspclmulti 2890/udp # CSPCLMULTI [Yoneda_Terumasa] [Yoneda_Terumasa] -cinegrfx-elmd 2891/tcp # CINEGRFX-ELMD License [Greg_Ercolano_2] [Greg_Ercolano_2] -# Manager -cinegrfx-elmd 2891/udp # CINEGRFX-ELMD License [Greg_Ercolano_2] [Greg_Ercolano_2] -# Manager -snifferdata 2892/tcp # SNIFFERDATA [Jeff_Mangasarian] [Jeff_Mangasarian] -snifferdata 2892/udp # SNIFFERDATA [Jeff_Mangasarian] [Jeff_Mangasarian] -vseconnector 2893/tcp # VSECONNECTOR [Ingo_Franzki] [Ingo_Franzki] -vseconnector 2893/udp # VSECONNECTOR [Ingo_Franzki] [Ingo_Franzki] -abacus-remote 2894/tcp # ABACUS-REMOTE [Mike_Bello] [Mike_Bello] -abacus-remote 2894/udp # ABACUS-REMOTE [Mike_Bello] [Mike_Bello] -natuslink 2895/tcp # NATUS LINK [Jonathan_Mergy] [Jonathan_Mergy] -natuslink 2895/udp # NATUS LINK [Jonathan_Mergy] [Jonathan_Mergy] -ecovisiong6-1 2896/tcp # ECOVISIONG6-1 [Henrik_Holst] [Henrik_Holst] -ecovisiong6-1 2896/udp # ECOVISIONG6-1 [Henrik_Holst] [Henrik_Holst] -citrix-rtmp 2897/tcp # Citrix RTMP [Myk_Willis] [Myk_Willis] -citrix-rtmp 2897/udp # Citrix RTMP [Myk_Willis] [Myk_Willis] -appliance-cfg 2898/tcp # APPLIANCE-CFG [Gary_A_James] [Gary_A_James] -appliance-cfg 2898/udp # APPLIANCE-CFG [Gary_A_James] [Gary_A_James] -powergemplus 2899/tcp # POWERGEMPLUS [Koich_Nakamura] [Koich_Nakamura] -powergemplus 2899/udp # POWERGEMPLUS [Koich_Nakamura] [Koich_Nakamura] -quicksuite 2900/tcp # QUICKSUITE [William_Egge] [William_Egge] -quicksuite 2900/udp # QUICKSUITE [William_Egge] [William_Egge] -allstorcns 2901/tcp # ALLSTORCNS [Steve_Dobson] [Steve_Dobson] -allstorcns 2901/udp # ALLSTORCNS [Steve_Dobson] [Steve_Dobson] -netaspi 2902/tcp # NET ASPI [Johnson_Luo] [Johnson_Luo] -netaspi 2902/udp # NET ASPI [Johnson_Luo] [Johnson_Luo] -suitcase 2903/tcp # SUITCASE [Milton_E_Sagen] [Milton_E_Sagen] -suitcase 2903/udp # SUITCASE [Milton_E_Sagen] [Milton_E_Sagen] -m2ua 2904/tcp # M2UA [Lyndon_Ong] [Lyndon_Ong] -m2ua 2904/udp # M2UA [Lyndon_Ong] [Lyndon_Ong] -m2ua 2904/sctp # M2UA [Lyndon_Ong] [Lyndon_Ong] -m3ua 2905/tcp # M3UA [Lyndon_Ong] [Lyndon_Ong] [RFC4666] -# 2905 udp De-registered 2001-06-07 -m3ua 2905/sctp # M3UA [Lyndon_Ong] [Lyndon_Ong] [RFC4666] -caller9 2906/tcp # CALLER9 [Shams_Naqi] [Shams_Naqi] -caller9 2906/udp # CALLER9 [Shams_Naqi] [Shams_Naqi] -webmethods-b2b 2907/tcp # WEBMETHODS B2B [Joseph_Hines] [Joseph_Hines] -webmethods-b2b 2907/udp # WEBMETHODS B2B [Joseph_Hines] [Joseph_Hines] -mao 2908/tcp # mao [Marc_Baudoin] [Marc_Baudoin] -mao 2908/udp # mao [Marc_Baudoin] [Marc_Baudoin] -funk-dialout 2909/tcp # Funk Dialout [Cimarron_Boozer] [Cimarron_Boozer] -funk-dialout 2909/udp # Funk Dialout [Cimarron_Boozer] [Cimarron_Boozer] -tdaccess 2910/tcp # TDAccess [Tom_Haapanen] [Tom_Haapanen] -tdaccess 2910/udp # TDAccess [Tom_Haapanen] [Tom_Haapanen] -blockade 2911/tcp # Blockade [Blockade] [Blockade] -blockade 2911/udp # Blockade [Blockade] [Blockade] -epicon 2912/tcp # Epicon [Michael_Khalandovsky] [Michael_Khalandovsky] -epicon 2912/udp # Epicon [Michael_Khalandovsky] [Michael_Khalandovsky] -boosterware 2913/tcp # Booster Ware [Ido_Ben_David] [Ido_Ben_David] -boosterware 2913/udp # Booster Ware [Ido_Ben_David] [Ido_Ben_David] -gamelobby 2914/tcp # Game Lobby [Paul_Ford_Hutchinson] [Paul_Ford_Hutchinson] -gamelobby 2914/udp # Game Lobby [Paul_Ford_Hutchinson] [Paul_Ford_Hutchinson] -tksocket 2915/tcp # TK Socket [Dino_Ciano] [Dino_Ciano] 2011-03-02 -tksocket 2915/udp # TK Socket [Dino_Ciano] [Dino_Ciano] 2011-03-02 -# Elvin Server -# -elvin-server 2916/tcp # IANA assigned this -# well-formed service name as -# a replacement for -# "elvin_server". -# This entry is an alias to "elvin-server". This entry is now -elvin_server 2916/tcp # Elvin Server historic, not usable for use with many common service -# discovery mechanisms. -# Elvin Server -# -elvin-server 2916/udp # IANA assigned this -# well-formed service name as -# a replacement for -# "elvin_server". -# This entry is an alias to "elvin-server". This entry is now -elvin_server 2916/udp # Elvin Server historic, not usable for use with many common service -# discovery mechanisms. -# Elvin Client -# -elvin-client 2917/tcp # IANA assigned this [David_Arnold] [David_Arnold] -# well-formed service name as -# a replacement for -# "elvin_client". -# This entry is an alias to "elvin-client". This entry is now -elvin_client 2917/tcp # Elvin Client [David_Arnold] [David_Arnold] historic, not usable for use with many common service -# discovery mechanisms. -# Elvin Client -# -elvin-client 2917/udp # IANA assigned this [David_Arnold] [David_Arnold] -# well-formed service name as -# a replacement for -# "elvin_client". -# This entry is an alias to "elvin-client". This entry is now -elvin_client 2917/udp # Elvin Client [David_Arnold] [David_Arnold] historic, not usable for use with many common service -# discovery mechanisms. -kastenchasepad 2918/tcp # Kasten Chase Pad [Marc_Gauthier] [Marc_Gauthier] -kastenchasepad 2918/udp # Kasten Chase Pad [Marc_Gauthier] [Marc_Gauthier] -roboer 2919/tcp # roboER [Paul_Snook] [Paul_Snook] -roboer 2919/udp # roboER [Paul_Snook] [Paul_Snook] -roboeda 2920/tcp # roboEDA [Paul_Snook] [Paul_Snook] -roboeda 2920/udp # roboEDA [Paul_Snook] [Paul_Snook] -cesdcdman 2921/tcp # CESD Contents Delivery [Shinya_Abe] [Shinya_Abe] -# Management -cesdcdman 2921/udp # CESD Contents Delivery [Shinya_Abe] [Shinya_Abe] -# Management -cesdcdtrn 2922/tcp # CESD Contents Delivery Data [Shinya_Abe] [Shinya_Abe] -# Transfer -cesdcdtrn 2922/udp # CESD Contents Delivery Data [Shinya_Abe] [Shinya_Abe] -# Transfer -wta-wsp-wtp-s 2923/tcp # WTA-WSP-WTP-S [Sebastien_Bury] [Sebastien_Bury] -wta-wsp-wtp-s 2923/udp # WTA-WSP-WTP-S [Sebastien_Bury] [Sebastien_Bury] -precise-vip 2924/tcp # PRECISE-VIP [Michael_Landwehr] [Michael_Landwehr] -precise-vip 2924/udp # PRECISE-VIP [Michael_Landwehr] [Michael_Landwehr] -# 2925 Unassigned (FRP-Released -# 12/7/00) -mobile-file-dl 2926/tcp # MOBILE-FILE-DL [Mitsuji_Toda] [Mitsuji_Toda] -mobile-file-dl 2926/udp # MOBILE-FILE-DL [Mitsuji_Toda] [Mitsuji_Toda] -unimobilectrl 2927/tcp # UNIMOBILECTRL [Vikas] [Vikas] -unimobilectrl 2927/udp # UNIMOBILECTRL [Vikas] [Vikas] -redstone-cpss 2928/tcp # REDSTONE-CPSS [Jeff_Looman] [Jeff_Looman] -redstone-cpss 2928/udp # REDSTONE-CPSS [Jeff_Looman] [Jeff_Looman] -amx-webadmin 2929/tcp # AMX-WEBADMIN [Mike_Morris] [Mike_Morris] -amx-webadmin 2929/udp # AMX-WEBADMIN [Mike_Morris] [Mike_Morris] -amx-weblinx 2930/tcp # AMX-WEBLINX [Mike_Morris] [Mike_Morris] -amx-weblinx 2930/udp # AMX-WEBLINX [Mike_Morris] [Mike_Morris] -circle-x 2931/tcp # Circle-X [Norm_Freedman_2] [Norm_Freedman_2] -circle-x 2931/udp # Circle-X [Norm_Freedman_2] [Norm_Freedman_2] -incp 2932/tcp # INCP [Keith_Paulsen] [Keith_Paulsen] -incp 2932/udp # INCP [Keith_Paulsen] [Keith_Paulsen] -4-tieropmgw 2933/tcp # 4-TIER OPM GW [Francois_Peloffy] [Francois_Peloffy] -4-tieropmgw 2933/udp # 4-TIER OPM GW [Francois_Peloffy] [Francois_Peloffy] -4-tieropmcli 2934/tcp # 4-TIER OPM CLI [Francois_Peloffy] [Francois_Peloffy] -4-tieropmcli 2934/udp # 4-TIER OPM CLI [Francois_Peloffy] [Francois_Peloffy] -qtp 2935/tcp # QTP [Cameron_Young] [Cameron_Young] -qtp 2935/udp # QTP [Cameron_Young] [Cameron_Young] -otpatch 2936/tcp # OTPatch [Brett_Goldstein] [Brett_Goldstein] -otpatch 2936/udp # OTPatch [Brett_Goldstein] [Brett_Goldstein] -pnaconsult-lm 2937/tcp # PNACONSULT-LM [Theo_Nijssen] [Theo_Nijssen] -pnaconsult-lm 2937/udp # PNACONSULT-LM [Theo_Nijssen] [Theo_Nijssen] -sm-pas-1 2938/tcp # SM-PAS-1 -sm-pas-1 2938/udp # SM-PAS-1 -sm-pas-2 2939/tcp # SM-PAS-2 -sm-pas-2 2939/udp # SM-PAS-2 -sm-pas-3 2940/tcp # SM-PAS-3 -sm-pas-3 2940/udp # SM-PAS-3 -sm-pas-4 2941/tcp # SM-PAS-4 -sm-pas-4 2941/udp # SM-PAS-4 -sm-pas-5 2942/tcp # SM-PAS-5 [Tom_Haapanen] [Tom_Haapanen] -sm-pas-5 2942/udp # SM-PAS-5 [Tom_Haapanen] [Tom_Haapanen] -ttnrepository 2943/tcp # TTNRepository [Robert_Orr] [Robert_Orr] -ttnrepository 2943/udp # TTNRepository [Robert_Orr] [Robert_Orr] -megaco-h248 2944/tcp # Megaco H-248 [Tom_Taylor_2] [Tom_Taylor_2] -megaco-h248 2944/udp # Megaco H-248 [Tom_Taylor_2] [Tom_Taylor_2] -megaco-h248 2944/sctp # Megaco-H.248 text [Tom_Taylor_3] [Tom_Taylor_3] 2006-09 -h248-binary 2945/tcp # H248 Binary [Tom_Taylor_2] [Tom_Taylor_2] -h248-binary 2945/udp # H248 Binary [Tom_Taylor_2] [Tom_Taylor_2] -h248-binary 2945/sctp # Megaco/H.248 binary [Tom_Taylor_3] [Tom_Taylor_3] 2006-09 -fjsvmpor 2946/tcp # FJSVmpor [Naoki_Hayashi] [Naoki_Hayashi] -fjsvmpor 2946/udp # FJSVmpor [Naoki_Hayashi] [Naoki_Hayashi] -gpsd 2947/tcp # GPS Daemon request/response [Eric_S_Raymond] [Eric_S_Raymond] 2010-04-19 -# protocol -gpsd 2947/udp # GPS Daemon request/response [Eric_S_Raymond] [Eric_S_Raymond] 2010-04-19 -# protocol -wap-push 2948/tcp # WAP PUSH -wap-push 2948/udp # WAP PUSH -wap-pushsecure 2949/tcp # WAP PUSH SECURE [WAP_Forum] [WAP_Forum] -wap-pushsecure 2949/udp # WAP PUSH SECURE [WAP_Forum] [WAP_Forum] -esip 2950/tcp # ESIP [David_Stephenson] [David_Stephenson] -esip 2950/udp # ESIP [David_Stephenson] [David_Stephenson] -ottp 2951/tcp # OTTP [Brent_Foster] [Brent_Foster] -ottp 2951/udp # OTTP [Brent_Foster] [Brent_Foster] -mpfwsas 2952/tcp # MPFWSAS [Toru_Murai] [Toru_Murai] -mpfwsas 2952/udp # MPFWSAS [Toru_Murai] [Toru_Murai] -ovalarmsrv 2953/tcp # OVALARMSRV -ovalarmsrv 2953/udp # OVALARMSRV -ovalarmsrv-cmd 2954/tcp # OVALARMSRV-CMD [Eric_Pulsipher] [Eric_Pulsipher] -ovalarmsrv-cmd 2954/udp # OVALARMSRV-CMD [Eric_Pulsipher] [Eric_Pulsipher] -csnotify 2955/tcp # CSNOTIFY [Israel_Beniaminy] [Israel_Beniaminy] -csnotify 2955/udp # CSNOTIFY [Israel_Beniaminy] [Israel_Beniaminy] -ovrimosdbman 2956/tcp # OVRIMOSDBMAN [Dimitrios_Souflis] [Dimitrios_Souflis] -ovrimosdbman 2956/udp # OVRIMOSDBMAN [Dimitrios_Souflis] [Dimitrios_Souflis] -jmact5 2957/tcp # JAMCT5 -jmact5 2957/udp # JAMCT5 -jmact6 2958/tcp # JAMCT6 -jmact6 2958/udp # JAMCT6 -rmopagt 2959/tcp # RMOPAGT [Shuji_Okubo] [Shuji_Okubo] -rmopagt 2959/udp # RMOPAGT [Shuji_Okubo] [Shuji_Okubo] -dfoxserver 2960/tcp # DFOXSERVER [David_Holden] [David_Holden] -dfoxserver 2960/udp # DFOXSERVER [David_Holden] [David_Holden] -boldsoft-lm 2961/tcp # BOLDSOFT-LM [Fredrik_Haglund] [Fredrik_Haglund] -boldsoft-lm 2961/udp # BOLDSOFT-LM [Fredrik_Haglund] [Fredrik_Haglund] -iph-policy-cli 2962/tcp # IPH-POLICY-CLI -iph-policy-cli 2962/udp # IPH-POLICY-CLI -iph-policy-adm 2963/tcp # IPH-POLICY-ADM [Shai_Herzog] [Shai_Herzog] -iph-policy-adm 2963/udp # IPH-POLICY-ADM [Shai_Herzog] [Shai_Herzog] -bullant-srap 2964/tcp # BULLANT SRAP -bullant-srap 2964/udp # BULLANT SRAP -bullant-rap 2965/tcp # BULLANT RAP [Michael_Cahill] [Michael_Cahill] -bullant-rap 2965/udp # BULLANT RAP [Michael_Cahill] [Michael_Cahill] -idp-infotrieve 2966/tcp # IDP-INFOTRIEVE [Kevin_Bruckert] [Kevin_Bruckert] -idp-infotrieve 2966/udp # IDP-INFOTRIEVE [Kevin_Bruckert] [Kevin_Bruckert] -ssc-agent 2967/tcp # SSC-AGENT [George_Dzieciol] [George_Dzieciol] -ssc-agent 2967/udp # SSC-AGENT [George_Dzieciol] [George_Dzieciol] -enpp 2968/tcp # ENPP [Kazuhito_Gassho] [Kazuhito_Gassho] -enpp 2968/udp # ENPP [Kazuhito_Gassho] [Kazuhito_Gassho] -essp 2969/tcp # ESSP [Hitoshi_Ishida] [Hitoshi_Ishida] -essp 2969/udp # ESSP [Hitoshi_Ishida] [Hitoshi_Ishida] -index-net 2970/tcp # INDEX-NET [Chris_J_Wren] [Chris_J_Wren] -index-net 2970/udp # INDEX-NET [Chris_J_Wren] [Chris_J_Wren] -netclip 2971/tcp # NetClip clipboard daemon [Rudi_Chiarito] [Rudi_Chiarito] -netclip 2971/udp # NetClip clipboard daemon [Rudi_Chiarito] [Rudi_Chiarito] -pmsm-webrctl 2972/tcp # PMSM Webrctl [Markus_Michels] [Markus_Michels] -pmsm-webrctl 2972/udp # PMSM Webrctl [Markus_Michels] [Markus_Michels] -svnetworks 2973/tcp # SV Networks [Sylvia_Siu_2] [Sylvia_Siu_2] -svnetworks 2973/udp # SV Networks [Sylvia_Siu_2] [Sylvia_Siu_2] -signal 2974/tcp # Signal [Wyatt_Williams] [Wyatt_Williams] -signal 2974/udp # Signal [Wyatt_Williams] [Wyatt_Williams] -fjmpcm 2975/tcp # Fujitsu Configuration [Hiroki_Kawano] [Hiroki_Kawano] -# Management Service -fjmpcm 2975/udp # Fujitsu Configuration [Hiroki_Kawano] [Hiroki_Kawano] -# Management Service -cns-srv-port 2976/tcp # CNS Server Port [Ram_Golla] [Ram_Golla] -cns-srv-port 2976/udp # CNS Server Port [Ram_Golla] [Ram_Golla] -ttc-etap-ns 2977/tcp # TTCs Enterprise Test Access -# Protocol - NS -ttc-etap-ns 2977/udp # TTCs Enterprise Test Access -# Protocol - NS -ttc-etap-ds 2978/tcp # TTCs Enterprise Test Access [Daniel_Becker_2] [Daniel_Becker_2] -# Protocol - DS -ttc-etap-ds 2978/udp # TTCs Enterprise Test Access [Daniel_Becker_2] [Daniel_Becker_2] -# Protocol - DS -h263-video 2979/tcp # H.263 Video Streaming [Jauvane_C_de_Olivei] [Jauvane_C_de_Olivei] -h263-video 2979/udp # H.263 Video Streaming [Jauvane_C_de_Olivei] [Jauvane_C_de_Olivei] -wimd 2980/tcp # Instant Messaging Service [Kevin_Birch] [Kevin_Birch] -wimd 2980/udp # Instant Messaging Service [Kevin_Birch] [Kevin_Birch] -mylxamport 2981/tcp # MYLXAMPORT [Wei_Gao] [Wei_Gao] -mylxamport 2981/udp # MYLXAMPORT [Wei_Gao] [Wei_Gao] -iwb-whiteboard 2982/tcp # IWB-WHITEBOARD [David_W_Radcliffe] [David_W_Radcliffe] -iwb-whiteboard 2982/udp # IWB-WHITEBOARD [David_W_Radcliffe] [David_W_Radcliffe] -netplan 2983/tcp # NETPLAN [Thomas_Driemeyer] [Thomas_Driemeyer] -netplan 2983/udp # NETPLAN [Thomas_Driemeyer] [Thomas_Driemeyer] -hpidsadmin 2984/tcp # HPIDSADMIN -hpidsadmin 2984/udp # HPIDSADMIN -hpidsagent 2985/tcp # HPIDSAGENT [John_Trudeau] [John_Trudeau] -hpidsagent 2985/udp # HPIDSAGENT [John_Trudeau] [John_Trudeau] -stonefalls 2986/tcp # STONEFALLS [Scott_Grau] [Scott_Grau] -stonefalls 2986/udp # STONEFALLS [Scott_Grau] [Scott_Grau] -identify 2987/tcp # identify -identify 2987/udp # identify -hippad 2988/tcp # HIPPA Reporting Protocol [William_Randolph_Roy] [William_Randolph_Roy] -hippad 2988/udp # HIPPA Reporting Protocol [William_Randolph_Roy] [William_Randolph_Roy] -zarkov 2989/tcp # ZARKOV Intelligent Agent [Robin_Felix] [Robin_Felix] 2014-02-17 -# Communication -zarkov 2989/udp # ZARKOV Intelligent Agent [Robin_Felix] [Robin_Felix] 2014-02-17 -# Communication -boscap 2990/tcp # BOSCAP [Dirk_Hillbrecht] [Dirk_Hillbrecht] -boscap 2990/udp # BOSCAP [Dirk_Hillbrecht] [Dirk_Hillbrecht] -wkstn-mon 2991/tcp # WKSTN-MON [William_David] [William_David] -wkstn-mon 2991/udp # WKSTN-MON [William_David] [William_David] -avenyo 2992/tcp # Avenyo Server [Bodo_Rueskamp] [Bodo_Rueskamp] -avenyo 2992/udp # Avenyo Server [Bodo_Rueskamp] [Bodo_Rueskamp] -veritas-vis1 2993/tcp # VERITAS VIS1 -veritas-vis1 2993/udp # VERITAS VIS1 -veritas-vis2 2994/tcp # VERITAS VIS2 [Dinkar_Chivaluri] [Dinkar_Chivaluri] -veritas-vis2 2994/udp # VERITAS VIS2 [Dinkar_Chivaluri] [Dinkar_Chivaluri] -idrs 2995/tcp # IDRS [Jeff_Eaton] [Jeff_Eaton] -idrs 2995/udp # IDRS [Jeff_Eaton] [Jeff_Eaton] -vsixml 2996/tcp # vsixml [Rob_Juergens] [Rob_Juergens] -vsixml 2996/udp # vsixml [Rob_Juergens] [Rob_Juergens] -rebol 2997/tcp # REBOL [Holger_Kruse] [Holger_Kruse] -rebol 2997/udp # REBOL [Holger_Kruse] [Holger_Kruse] -realsecure 2998/tcp # Real Secure [Wes_Wilson] [Wes_Wilson] -realsecure 2998/udp # Real Secure [Wes_Wilson] [Wes_Wilson] -remoteware-un 2999/tcp # RemoteWare Unassigned [Tim_Farley] [Tim_Farley] -remoteware-un 2999/udp # RemoteWare Unassigned [Tim_Farley] [Tim_Farley] -hbci 3000/tcp # HBCI [Kurt_Haubner] [Kurt_Haubner] -hbci 3000/udp # HBCI [Kurt_Haubner] [Kurt_Haubner] -remoteware-cl 3000/tcp # RemoteWare Client [Tim_Farley] [Tim_Farley] This entry records an unassigned but widespread use -remoteware-cl 3000/udp # RemoteWare Client [Tim_Farley] [Tim_Farley] This entry records an unassigned but widespread use -origo-native 3001/tcp # OrigoDB Server Native [Devrex_Labs] [Robert_Friberg] 2013-03-29 port 3001 previously "Removed on 2006-05-25" -# Interface -# 3001 udp Reserved 2013-03-29 port 3001 previously "Removed on 2006-05-25" -exlm-agent 3002/tcp # EXLM Agent [Randy_Martin] [Randy_Martin] -exlm-agent 3002/udp # EXLM Agent [Randy_Martin] [Randy_Martin] -remoteware-srv 3002/tcp # RemoteWare Server [Tim_Farley] [Tim_Farley] This entry records an unassigned but widespread use -remoteware-srv 3002/udp # RemoteWare Server [Tim_Farley] [Tim_Farley] This entry records an unassigned but widespread use -cgms 3003/tcp # CGMS [Corey_Clinton] [Corey_Clinton] 2011-02-02 -cgms 3003/udp # CGMS [Corey_Clinton] [Corey_Clinton] 2011-02-02 -csoftragent 3004/tcp # Csoft Agent [Nedelcho_Stanev_2] [Nedelcho_Stanev_2] -csoftragent 3004/udp # Csoft Agent [Nedelcho_Stanev_2] [Nedelcho_Stanev_2] -geniuslm 3005/tcp # Genius License Manager [Jakob_Spies] [Jakob_Spies] -geniuslm 3005/udp # Genius License Manager [Jakob_Spies] [Jakob_Spies] -ii-admin 3006/tcp # Instant Internet Admin [Lewis_Donzis] [Lewis_Donzis] -ii-admin 3006/udp # Instant Internet Admin [Lewis_Donzis] [Lewis_Donzis] -lotusmtap 3007/tcp # Lotus Mail Tracking Agent [Ken_Lin] [Ken_Lin] -# Protocol -lotusmtap 3007/udp # Lotus Mail Tracking Agent [Ken_Lin] [Ken_Lin] -# Protocol -midnight-tech 3008/tcp # Midnight Technologies [Kyle_Unice] [Kyle_Unice] -midnight-tech 3008/udp # Midnight Technologies [Kyle_Unice] [Kyle_Unice] -pxc-ntfy 3009/tcp # PXC-NTFY [Takeshi_Nishizawa] [Takeshi_Nishizawa] -pxc-ntfy 3009/udp # PXC-NTFY [Takeshi_Nishizawa] [Takeshi_Nishizawa] -gw 3010/tcp # Telerate Workstation -ping-pong 3010/udp # Telerate Workstation [Timo_Sivonen] [Timo_Sivonen] -trusted-web 3011/tcp # Trusted Web -trusted-web 3011/udp # Trusted Web -twsdss 3012/tcp # Trusted Web Client [Alex_Duncan] [Alex_Duncan] -twsdss 3012/udp # Trusted Web Client [Alex_Duncan] [Alex_Duncan] -gilatskysurfer 3013/tcp # Gilat Sky Surfer [Yossi_Gal] [Yossi_Gal] -gilatskysurfer 3013/udp # Gilat Sky Surfer [Yossi_Gal] [Yossi_Gal] -# Broker Service -# -broker-service 3014/tcp # IANA assigned this [Dale_Bethers] [Dale_Bethers] -# well-formed service name as -# a replacement for -# "broker_service". -# This entry is an alias to "broker-service". This entry is now -broker_service 3014/tcp # Broker Service [Dale_Bethers] [Dale_Bethers] historic, not usable for use with many common service -# discovery mechanisms. -# Broker Service -# -broker-service 3014/udp # IANA assigned this [Dale_Bethers] [Dale_Bethers] -# well-formed service name as -# a replacement for -# "broker_service". -# This entry is an alias to "broker-service". This entry is now -broker_service 3014/udp # Broker Service [Dale_Bethers] [Dale_Bethers] historic, not usable for use with many common service -# discovery mechanisms. -nati-dstp 3015/tcp # NATI DSTP [Paul_Austin] [Paul_Austin] -nati-dstp 3015/udp # NATI DSTP [Paul_Austin] [Paul_Austin] -# Notify Server -# -notify-srvr 3016/tcp # IANA assigned this [Hugo_Parra] [Hugo_Parra] -# well-formed service name as -# a replacement for -# "notify_srvr". -# This entry is an alias to "notify-srvr". This entry is now -notify_srvr 3016/tcp # Notify Server [Hugo_Parra] [Hugo_Parra] historic, not usable for use with many common service -# discovery mechanisms. -# Notify Server -# -notify-srvr 3016/udp # IANA assigned this [Hugo_Parra] [Hugo_Parra] -# well-formed service name as -# a replacement for -# "notify_srvr". -# This entry is an alias to "notify-srvr". This entry is now -notify_srvr 3016/udp # Notify Server [Hugo_Parra] [Hugo_Parra] historic, not usable for use with many common service -# discovery mechanisms. -# Event Listener -# -event-listener 3017/tcp # IANA assigned this [Ted_Tronson] [Ted_Tronson] -# well-formed service name as -# a replacement for -# "event_listener". -# This entry is an alias to "event-listener". This entry is now -event_listener 3017/tcp # Event Listener [Ted_Tronson] [Ted_Tronson] historic, not usable for use with many common service -# discovery mechanisms. -# Event Listener -# -event-listener 3017/udp # IANA assigned this [Ted_Tronson] [Ted_Tronson] -# well-formed service name as -# a replacement for -# "event_listener". -# This entry is an alias to "event-listener". This entry is now -event_listener 3017/udp # Event Listener [Ted_Tronson] [Ted_Tronson] historic, not usable for use with many common service -# discovery mechanisms. -# Service Registry -# -srvc-registry 3018/tcp # IANA assigned this [Mark_Killgore] [Mark_Killgore] -# well-formed service name as -# a replacement for -# "srvc_registry". -# This entry is an alias to "srvc-registry". This entry is now -srvc_registry 3018/tcp # Service Registry [Mark_Killgore] [Mark_Killgore] historic, not usable for use with many common service -# discovery mechanisms. -# Service Registry -# -srvc-registry 3018/udp # IANA assigned this [Mark_Killgore] [Mark_Killgore] -# well-formed service name as -# a replacement for -# "srvc_registry". -# This entry is an alias to "srvc-registry". This entry is now -srvc_registry 3018/udp # Service Registry [Mark_Killgore] [Mark_Killgore] historic, not usable for use with many common service -# discovery mechanisms. -# Resource Manager -# -resource-mgr 3019/tcp # IANA assigned this [Gary_Glover] [Gary_Glover] -# well-formed service name as -# a replacement for -# "resource_mgr". -# This entry is an alias to "resource-mgr". This entry is now -resource_mgr 3019/tcp # Resource Manager [Gary_Glover] [Gary_Glover] historic, not usable for use with many common service -# discovery mechanisms. -# Resource Manager -# -resource-mgr 3019/udp # IANA assigned this [Gary_Glover] [Gary_Glover] -# well-formed service name as -# a replacement for -# "resource_mgr". -# This entry is an alias to "resource-mgr". This entry is now -resource_mgr 3019/udp # Resource Manager [Gary_Glover] [Gary_Glover] historic, not usable for use with many common service -# discovery mechanisms. -cifs 3020/tcp # CIFS [Paul_Leach] [Paul_Leach] -cifs 3020/udp # CIFS [Paul_Leach] [Paul_Leach] -agriserver 3021/tcp # AGRI Server [Frank_Neulichedl] [Frank_Neulichedl] -agriserver 3021/udp # AGRI Server [Frank_Neulichedl] [Frank_Neulichedl] -csregagent 3022/tcp # CSREGAGENT [Nedelcho_Stanev] [Nedelcho_Stanev] -csregagent 3022/udp # CSREGAGENT [Nedelcho_Stanev] [Nedelcho_Stanev] -magicnotes 3023/tcp # magicnotes [Karl_Edwall] [Karl_Edwall] -magicnotes 3023/udp # magicnotes [Karl_Edwall] [Karl_Edwall] -# NDS_SSO -# -nds-sso 3024/tcp # IANA assigned this [Mel_Oyler] [Mel_Oyler] -# well-formed service name as -# a replacement for "nds_sso". -# This entry is an alias to "nds-sso". This entry is now -nds_sso 3024/tcp # NDS_SSO [Mel_Oyler] [Mel_Oyler] historic, not usable for use with many common service -# discovery mechanisms. -# NDS_SSO -# -nds-sso 3024/udp # IANA assigned this [Mel_Oyler] [Mel_Oyler] -# well-formed service name as -# a replacement for "nds_sso". -# This entry is an alias to "nds-sso". This entry is now -nds_sso 3024/udp # NDS_SSO [Mel_Oyler] [Mel_Oyler] historic, not usable for use with many common service -# discovery mechanisms. -arepa-raft 3025/tcp # Arepa Raft [Stuart_Schaefer] [Stuart_Schaefer] -arepa-raft 3025/udp # Arepa Raft [Stuart_Schaefer] [Stuart_Schaefer] -agri-gateway 3026/tcp # AGRI Gateway [Agri_Datalog] [Agri_Datalog] -agri-gateway 3026/udp # AGRI Gateway [Agri_Datalog] [Agri_Datalog] -# LiebDevMgmt_C -# -LiebDevMgmt-C 3027/tcp # IANA assigned this -# well-formed service name as -# a replacement for -# "LiebDevMgmt_C". -# This entry is an alias to "LiebDevMgmt-C". This entry is now -LiebDevMgmt_C 3027/tcp # LiebDevMgmt_C historic, not usable for use with many common service -# discovery mechanisms. -# LiebDevMgmt_C -# -LiebDevMgmt-C 3027/udp # IANA assigned this -# well-formed service name as -# a replacement for -# "LiebDevMgmt_C". -# This entry is an alias to "LiebDevMgmt-C". This entry is now -LiebDevMgmt_C 3027/udp # LiebDevMgmt_C historic, not usable for use with many common service -# discovery mechanisms. -# LiebDevMgmt_DM -# -LiebDevMgmt-DM 3028/tcp # IANA assigned this -# well-formed service name as -# a replacement for -# "LiebDevMgmt_DM". -# This entry is an alias to "LiebDevMgmt-DM". This entry is now -LiebDevMgmt_DM 3028/tcp # LiebDevMgmt_DM historic, not usable for use with many common service -# discovery mechanisms. -# LiebDevMgmt_DM -# -LiebDevMgmt-DM 3028/udp # IANA assigned this -# well-formed service name as -# a replacement for -# "LiebDevMgmt_DM". -# This entry is an alias to "LiebDevMgmt-DM". This entry is now -LiebDevMgmt_DM 3028/udp # LiebDevMgmt_DM historic, not usable for use with many common service -# discovery mechanisms. -# LiebDevMgmt_A -# -LiebDevMgmt-A 3029/tcp # IANA assigned this [Mike_Velten] [Mike_Velten] -# well-formed service name as -# a replacement for -# "LiebDevMgmt_A". -# This entry is an alias to "LiebDevMgmt-A". This entry is now -LiebDevMgmt_A 3029/tcp # LiebDevMgmt_A [Mike_Velten] [Mike_Velten] historic, not usable for use with many common service -# discovery mechanisms. -# LiebDevMgmt_A -# -LiebDevMgmt-A 3029/udp # IANA assigned this [Mike_Velten] [Mike_Velten] -# well-formed service name as -# a replacement for -# "LiebDevMgmt_A". -# This entry is an alias to "LiebDevMgmt-A". This entry is now -LiebDevMgmt_A 3029/udp # LiebDevMgmt_A [Mike_Velten] [Mike_Velten] historic, not usable for use with many common service -# discovery mechanisms. -arepa-cas 3030/tcp # Arepa Cas [Stuart_Schaefer] [Stuart_Schaefer] -arepa-cas 3030/udp # Arepa Cas [Stuart_Schaefer] [Stuart_Schaefer] -eppc 3031/tcp # Remote AppleEvents/PPC [Steve_Zellers] [Steve_Zellers] -# Toolbox -eppc 3031/udp # Remote AppleEvents/PPC [Steve_Zellers] [Steve_Zellers] -# Toolbox -redwood-chat 3032/tcp # Redwood Chat [Songwon_Chi] [Songwon_Chi] -redwood-chat 3032/udp # Redwood Chat [Songwon_Chi] [Songwon_Chi] -pdb 3033/tcp # PDB [Don_Bowman] [Don_Bowman] -pdb 3033/udp # PDB [Don_Bowman] [Don_Bowman] -osmosis-aeea 3034/tcp # Osmosis / Helix (R) AEEA [Larry_Atkin] [Larry_Atkin] -# Port -osmosis-aeea 3034/udp # Osmosis / Helix (R) AEEA [Larry_Atkin] [Larry_Atkin] -# Port -fjsv-gssagt 3035/tcp # FJSV gssagt [Tomoji_Koike] [Tomoji_Koike] -fjsv-gssagt 3035/udp # FJSV gssagt [Tomoji_Koike] [Tomoji_Koike] -hagel-dump 3036/tcp # Hagel DUMP [Haim_Gelfenbeyn] [Haim_Gelfenbeyn] -hagel-dump 3036/udp # Hagel DUMP [Haim_Gelfenbeyn] [Haim_Gelfenbeyn] -hp-san-mgmt 3037/tcp # HP SAN Mgmt [Steve_Britt] [Steve_Britt] -hp-san-mgmt 3037/udp # HP SAN Mgmt [Steve_Britt] [Steve_Britt] -santak-ups 3038/tcp # Santak UPS [Tom_Liu] [Tom_Liu] -santak-ups 3038/udp # Santak UPS [Tom_Liu] [Tom_Liu] -cogitate 3039/tcp # Cogitate, Inc. [Jim_Harlan] [Jim_Harlan] -cogitate 3039/udp # Cogitate, Inc. [Jim_Harlan] [Jim_Harlan] -tomato-springs 3040/tcp # Tomato Springs [Jack_Waller_III] [Jack_Waller_III] -tomato-springs 3040/udp # Tomato Springs [Jack_Waller_III] [Jack_Waller_III] -di-traceware 3041/tcp # di-traceware [Carlos_Hung] [Carlos_Hung] -di-traceware 3041/udp # di-traceware [Carlos_Hung] [Carlos_Hung] -journee 3042/tcp # journee [Kevin_Calman] [Kevin_Calman] -journee 3042/udp # journee [Kevin_Calman] [Kevin_Calman] -brp 3043/tcp # Broadcast Routing Protocol [John_Border] [John_Border] -brp 3043/udp # Broadcast Routing Protocol [John_Border] [John_Border] -epp 3044/tcp # EndPoint Protocol [Stephen_Cipolli] [Stephen_Cipolli] -epp 3044/udp # EndPoint Protocol [Stephen_Cipolli] [Stephen_Cipolli] -responsenet 3045/tcp # ResponseNet [Chul_Yoon] [Chul_Yoon] -responsenet 3045/udp # ResponseNet [Chul_Yoon] [Chul_Yoon] -di-ase 3046/tcp # di-ase [Carlos_Hung] [Carlos_Hung] -di-ase 3046/udp # di-ase [Carlos_Hung] [Carlos_Hung] -hlserver 3047/tcp # Fast Security HL Server [Safenet_Inc.] [Michael_Zunke_3] 2014-07-02 -hlserver 3047/udp # Fast Security HL Server [Safenet_Inc.] [Michael_Zunke_3] 2014-07-02 -pctrader 3048/tcp # Sierra Net PC Trader [Chris_Hahn] [Chris_Hahn] -pctrader 3048/udp # Sierra Net PC Trader [Chris_Hahn] [Chris_Hahn] -nsws 3049/tcp # NSWS [Ray_Gwinn] [Ray_Gwinn] -nsws 3049/udp # NSWS [Ray_Gwinn] [Ray_Gwinn] -# gds_db -# -gds-db 3050/tcp # IANA assigned this [Madhukar_N_Thakur] [Madhukar_N_Thakur] -# well-formed service name as -# a replacement for "gds_db". -# This entry is an alias to "gds-db". This entry is now -gds_db 3050/tcp # gds_db [Madhukar_N_Thakur] [Madhukar_N_Thakur] historic, not usable for use with many common service -# discovery mechanisms. -# gds_db -# -gds-db 3050/udp # IANA assigned this [Madhukar_N_Thakur] [Madhukar_N_Thakur] -# well-formed service name as -# a replacement for "gds_db". -# This entry is an alias to "gds-db". This entry is now -gds_db 3050/udp # gds_db [Madhukar_N_Thakur] [Madhukar_N_Thakur] historic, not usable for use with many common service -# discovery mechanisms. -galaxy-server 3051/tcp # Galaxy Server [Michael_Andre] [Michael_Andre] -galaxy-server 3051/udp # Galaxy Server [Michael_Andre] [Michael_Andre] -apc-3052 3052/tcp # APC 3052 [American_Power_Conve] [American_Power_Conve] -apc-3052 3052/udp # APC 3052 [American_Power_Conve] [American_Power_Conve] -dsom-server 3053/tcp # dsom-server [Daniel_Sisk] [Daniel_Sisk] -dsom-server 3053/udp # dsom-server [Daniel_Sisk] [Daniel_Sisk] -amt-cnf-prot 3054/tcp # AMT CNF PROT [Marco_Marcucci] [Marco_Marcucci] -amt-cnf-prot 3054/udp # AMT CNF PROT [Marco_Marcucci] [Marco_Marcucci] -policyserver 3055/tcp # Policy Server [Mark_Garti] [Mark_Garti] -policyserver 3055/udp # Policy Server [Mark_Garti] [Mark_Garti] -cdl-server 3056/tcp # CDL Server [Paul_Roberts] [Paul_Roberts] -cdl-server 3056/udp # CDL Server [Paul_Roberts] [Paul_Roberts] -goahead-fldup 3057/tcp # GoAhead FldUp [Alan_Pickrell] [Alan_Pickrell] -goahead-fldup 3057/udp # GoAhead FldUp [Alan_Pickrell] [Alan_Pickrell] -videobeans 3058/tcp # videobeans [Hiroyuki_Takahashi] [Hiroyuki_Takahashi] -videobeans 3058/udp # videobeans [Hiroyuki_Takahashi] [Hiroyuki_Takahashi] -qsoft 3059/tcp # qsoft [James_Kunz] [James_Kunz] -qsoft 3059/udp # qsoft [James_Kunz] [James_Kunz] -# Known -interserver 3060/tcp # interserver [Madhukar_N_Thakur] [Madhukar_N_Thakur] Unauthorized -# Use on port -# 3060 -# Known -interserver 3060/udp # interserver [Madhukar_N_Thakur] [Madhukar_N_Thakur] Unauthorized -# Use on port -# 3060 -cautcpd 3061/tcp # cautcpd -cautcpd 3061/udp # cautcpd -ncacn-ip-tcp 3062/tcp # ncacn-ip-tcp -ncacn-ip-tcp 3062/udp # ncacn-ip-tcp -ncadg-ip-udp 3063/tcp # ncadg-ip-udp [Gabi_Kalmar] [Gabi_Kalmar] -ncadg-ip-udp 3063/udp # ncadg-ip-udp [Gabi_Kalmar] [Gabi_Kalmar] -rprt 3064/tcp # Remote Port Redirector [Robin_Johnston] [Robin_Johnston] -rprt 3064/udp # Remote Port Redirector [Robin_Johnston] [Robin_Johnston] -slinterbase 3065/tcp # slinterbase [Bie_Tie] [Bie_Tie] -slinterbase 3065/udp # slinterbase [Bie_Tie] [Bie_Tie] -netattachsdmp 3066/tcp # NETATTACHSDMP [Mike_Young] [Mike_Young] -netattachsdmp 3066/udp # NETATTACHSDMP [Mike_Young] [Mike_Young] -fjhpjp 3067/tcp # FJHPJP [Ryozo_Furutani] [Ryozo_Furutani] -fjhpjp 3067/udp # FJHPJP [Ryozo_Furutani] [Ryozo_Furutani] -ls3bcast 3068/tcp # ls3 Broadcast -ls3bcast 3068/udp # ls3 Broadcast -ls3 3069/tcp # ls3 [Jim_Thompson] [Jim_Thompson] -ls3 3069/udp # ls3 [Jim_Thompson] [Jim_Thompson] -mgxswitch 3070/tcp # MGXSWITCH [George_Walter] [George_Walter] -mgxswitch 3070/udp # MGXSWITCH [George_Walter] [George_Walter] -csd-mgmt-port 3071/tcp # ContinuStor Manager Port [NetApp] [MSW_architecture_team] 2014-07-18 -csd-mgmt-port 3071/udp # ContinuStor Manager Port [NetApp] [MSW_architecture_team] 2014-07-18 -csd-monitor 3072/tcp # ContinuStor Monitor Port [NetApp] [MSW_architecture_team] 2014-07-18 -csd-monitor 3072/udp # ContinuStor Monitor Port [NetApp] [MSW_architecture_team] 2014-07-18 -vcrp 3073/tcp # Very simple chatroom prot [Andreas_Wurf] [Andreas_Wurf] -vcrp 3073/udp # Very simple chatroom prot [Andreas_Wurf] [Andreas_Wurf] -xbox 3074/tcp # Xbox game port [Damon_Danieli] [Damon_Danieli] -xbox 3074/udp # Xbox game port [Damon_Danieli] [Damon_Danieli] -orbix-locator 3075/tcp # Orbix 2000 Locator -orbix-locator 3075/udp # Orbix 2000 Locator -orbix-config 3076/tcp # Orbix 2000 Config -orbix-config 3076/udp # Orbix 2000 Config -orbix-loc-ssl 3077/tcp # Orbix 2000 Locator SSL -orbix-loc-ssl 3077/udp # Orbix 2000 Locator SSL -orbix-cfg-ssl 3078/tcp # Orbix 2000 Locator SSL [Eric_Newcomer] [Eric_Newcomer] -orbix-cfg-ssl 3078/udp # Orbix 2000 Locator SSL [Eric_Newcomer] [Eric_Newcomer] -lv-frontpanel 3079/tcp # LV Front Panel [Darshan_Shah] [Darshan_Shah] -lv-frontpanel 3079/udp # LV Front Panel [Darshan_Shah] [Darshan_Shah] -# stm_pproc -# -stm-pproc 3080/tcp # IANA assigned this [Paul_McGinnis] [Paul_McGinnis] -# well-formed service name as -# a replacement for -# "stm_pproc". -# This entry is an alias to "stm-pproc". This entry is now -stm_pproc 3080/tcp # stm_pproc [Paul_McGinnis] [Paul_McGinnis] historic, not usable for use with many common service -# discovery mechanisms. -# stm_pproc -# -stm-pproc 3080/udp # IANA assigned this [Paul_McGinnis] [Paul_McGinnis] -# well-formed service name as -# a replacement for -# "stm_pproc". -# This entry is an alias to "stm-pproc". This entry is now -stm_pproc 3080/udp # stm_pproc [Paul_McGinnis] [Paul_McGinnis] historic, not usable for use with many common service -# discovery mechanisms. -tl1-lv 3081/tcp # TL1-LV -tl1-lv 3081/udp # TL1-LV -tl1-raw 3082/tcp # TL1-RAW -tl1-raw 3082/udp # TL1-RAW -tl1-telnet 3083/tcp # TL1-TELNET [SONET_Internetworkin] [SONET_Internetworkin] -tl1-telnet 3083/udp # TL1-TELNET [SONET_Internetworkin] [SONET_Internetworkin] -itm-mccs 3084/tcp # ITM-MCCS [Portnoy_Boxman] [Portnoy_Boxman] -itm-mccs 3084/udp # ITM-MCCS [Portnoy_Boxman] [Portnoy_Boxman] -pcihreq 3085/tcp # PCIHReq [Paul_Sanders] [Paul_Sanders] -pcihreq 3085/udp # PCIHReq [Paul_Sanders] [Paul_Sanders] -jdl-dbkitchen 3086/tcp # JDL-DBKitchen [Hideo_Wakabayashi] [Hideo_Wakabayashi] -jdl-dbkitchen 3086/udp # JDL-DBKitchen [Hideo_Wakabayashi] [Hideo_Wakabayashi] -asoki-sma 3087/tcp # Asoki SMA [Andrew_Mossberg] [Andrew_Mossberg] -asoki-sma 3087/udp # Asoki SMA [Andrew_Mossberg] [Andrew_Mossberg] -xdtp 3088/tcp # eXtensible Data Transfer [Michael_Shearson] [Michael_Shearson] -# Protocol -xdtp 3088/udp # eXtensible Data Transfer [Michael_Shearson] [Michael_Shearson] -# Protocol -ptk-alink 3089/tcp # ParaTek Agent Linking [Robert_Hodgson_2] [Robert_Hodgson_2] -ptk-alink 3089/udp # ParaTek Agent Linking [Robert_Hodgson_2] [Robert_Hodgson_2] -stss 3090/tcp # Senforce Session Services [Peter_Boucher] [Peter_Boucher] -stss 3090/udp # Senforce Session Services [Peter_Boucher] [Peter_Boucher] -1ci-smcs 3091/tcp # 1Ci Server Management [Ralf_Bensmann] [Ralf_Bensmann] -1ci-smcs 3091/udp # 1Ci Server Management [Ralf_Bensmann] [Ralf_Bensmann] -# 3092 Unassigned 2008-04-22 -rapidmq-center 3093/tcp # Jiiva RapidMQ Center -rapidmq-center 3093/udp # Jiiva RapidMQ Center -rapidmq-reg 3094/tcp # Jiiva RapidMQ Registry [Mark_Ericksen] [Mark_Ericksen] -rapidmq-reg 3094/udp # Jiiva RapidMQ Registry [Mark_Ericksen] [Mark_Ericksen] -panasas 3095/tcp # Panasas rendevous port [Peter_Berger] [Peter_Berger] -panasas 3095/udp # Panasas rendevous port [Peter_Berger] [Peter_Berger] -ndl-aps 3096/tcp # Active Print Server Port [Martin_Norman] [Martin_Norman] -ndl-aps 3096/udp # Active Print Server Port [Martin_Norman] [Martin_Norman] -# 3097 tcp Reserved -# 3097 udp Reserved -itu-bicc-stc 3097/sctp # ITU-T Q.1902.1/Q.2150.3 [Greg_Sidebottom] [Greg_Sidebottom] -umm-port 3098/tcp # Universal Message Manager [Phil_Braham] [Phil_Braham] -umm-port 3098/udp # Universal Message Manager [Phil_Braham] [Phil_Braham] -chmd 3099/tcp # CHIPSY Machine Daemon [Trond_Borsting] [Trond_Borsting] -chmd 3099/udp # CHIPSY Machine Daemon [Trond_Borsting] [Trond_Borsting] -opcon-xps 3100/tcp # OpCon/xps [David_Bourland] [David_Bourland] -opcon-xps 3100/udp # OpCon/xps [David_Bourland] [David_Bourland] -hp-pxpib 3101/tcp # HP PolicyXpert PIB Server [Brian_O_Keefe] [Brian_O_Keefe] -hp-pxpib 3101/udp # HP PolicyXpert PIB Server [Brian_O_Keefe] [Brian_O_Keefe] -slslavemon 3102/tcp # SoftlinK Slave Mon Port [Moshe_Livne] [Moshe_Livne] -slslavemon 3102/udp # SoftlinK Slave Mon Port [Moshe_Livne] [Moshe_Livne] -autocuesmi 3103/tcp # Autocue SMI Protocol -autocuesmi 3103/udp # Autocue SMI Protocol -autocuelog 3104/tcp # Autocue Logger Protocol -autocuetime 3104/udp # Autocue Time Service [Geoff_Back] [Geoff_Back] -cardbox 3105/tcp # Cardbox -cardbox 3105/udp # Cardbox -cardbox-http 3106/tcp # Cardbox HTTP [Martin_Kochanski] [Martin_Kochanski] -cardbox-http 3106/udp # Cardbox HTTP [Martin_Kochanski] [Martin_Kochanski] -business 3107/tcp # Business protocol -business 3107/udp # Business protocol -geolocate 3108/tcp # Geolocate protocol -geolocate 3108/udp # Geolocate protocol -personnel 3109/tcp # Personnel protocol [William_Randolph_Roy] [William_Randolph_Roy] -personnel 3109/udp # Personnel protocol [William_Randolph_Roy] [William_Randolph_Roy] -sim-control 3110/tcp # simulator control port [Ian_Bell] [Ian_Bell] -sim-control 3110/udp # simulator control port [Ian_Bell] [Ian_Bell] -wsynch 3111/tcp # Web Synchronous Services [Valery_Fremaux] [Valery_Fremaux] -wsynch 3111/udp # Web Synchronous Services [Valery_Fremaux] [Valery_Fremaux] -ksysguard 3112/tcp # KDE System Guard [Chris_Schlaeger] [Chris_Schlaeger] -ksysguard 3112/udp # KDE System Guard [Chris_Schlaeger] [Chris_Schlaeger] -cs-auth-svr 3113/tcp # CS-Authenticate Svr Port [Cliff_Diamond][Andy_Georgiou] [Cliff_Diamond][Andy_Georgiou] -cs-auth-svr 3113/udp # CS-Authenticate Svr Port [Cliff_Diamond][Andy_Georgiou] [Cliff_Diamond][Andy_Georgiou] -ccmad 3114/tcp # CCM AutoDiscover [Ram_Sudama] [Ram_Sudama] -ccmad 3114/udp # CCM AutoDiscover [Ram_Sudama] [Ram_Sudama] -mctet-master 3115/tcp # MCTET Master -mctet-master 3115/udp # MCTET Master -mctet-gateway 3116/tcp # MCTET Gateway -mctet-gateway 3116/udp # MCTET Gateway -mctet-jserv 3117/tcp # MCTET Jserv [Portnoy_Boxman] [Portnoy_Boxman] -mctet-jserv 3117/udp # MCTET Jserv [Portnoy_Boxman] [Portnoy_Boxman] -pkagent 3118/tcp # PKAgent [Michael_Douglass] [Michael_Douglass] -pkagent 3118/udp # PKAgent [Michael_Douglass] [Michael_Douglass] -d2000kernel 3119/tcp # D2000 Kernel Port -d2000kernel 3119/udp # D2000 Kernel Port -d2000webserver 3120/tcp # D2000 Webserver Port [Tomas_Rajcan] [Tomas_Rajcan] -d2000webserver 3120/udp # D2000 Webserver Port [Tomas_Rajcan] [Tomas_Rajcan] -# The pacemaker remote -# (pcmk-remote) service -pcmk-remote 3121/tcp # extends high availability [David_Vossel] [Andrew_Beekhof] 2013-03-15 port 3121 previously noted "Removed on 2003-09-17" -# functionality outside of the -# Linux cluster into remote -# nodes. -# 3121 udp Reserved 2013-03-15 port 3121 previously noted "Removed on 2003-09-17" -vtr-emulator 3122/tcp # MTI VTR Emulator port [John_Mertus] [John_Mertus] -vtr-emulator 3122/udp # MTI VTR Emulator port [John_Mertus] [John_Mertus] -edix 3123/tcp # EDI Translation Protocol [William_Randolph_Roy] [William_Randolph_Roy] -edix 3123/udp # EDI Translation Protocol [William_Randolph_Roy] [William_Randolph_Roy] -beacon-port 3124/tcp # Beacon Port [James_Paul_Duncan] [James_Paul_Duncan] -beacon-port 3124/udp # Beacon Port [James_Paul_Duncan] [James_Paul_Duncan] -a13-an 3125/tcp # A13-AN Interface [Douglas_Knisely] [Douglas_Knisely] -a13-an 3125/udp # A13-AN Interface [Douglas_Knisely] [Douglas_Knisely] -# 3126 Unassigned 2007-10-04 -ctx-bridge 3127/tcp # CTX Bridge Port [Alexander_Dubrovsky] [Alexander_Dubrovsky] -ctx-bridge 3127/udp # CTX Bridge Port [Alexander_Dubrovsky] [Alexander_Dubrovsky] -ndl-aas 3128/tcp # Active API Server Port [Martin_Norman] [Martin_Norman] -ndl-aas 3128/udp # Active API Server Port [Martin_Norman] [Martin_Norman] -netport-id 3129/tcp # NetPort Discovery Port [P_T_K_Farrar] [P_T_K_Farrar] -netport-id 3129/udp # NetPort Discovery Port [P_T_K_Farrar] [P_T_K_Farrar] -icpv2 3130/tcp # ICPv2 [Duane_Wessels] [Duane_Wessels] -icpv2 3130/udp # ICPv2 [Duane_Wessels] [Duane_Wessels] -# Known -netbookmark 3131/tcp # Net Book Mark [Yiftach_Ravid] [Yiftach_Ravid] Unauthorized -# Use on port -# 3131 -# Known -netbookmark 3131/udp # Net Book Mark [Yiftach_Ravid] [Yiftach_Ravid] Unauthorized -# Use on port -# 3131 -ms-rule-engine 3132/tcp # Microsoft Business Rule [Anush_Kumar] [Anush_Kumar] -# Engine Update Service -ms-rule-engine 3132/udp # Microsoft Business Rule [Anush_Kumar] [Anush_Kumar] -# Engine Update Service -prism-deploy 3133/tcp # Prism Deploy User Port [Joan_Linck] [Joan_Linck] -prism-deploy 3133/udp # Prism Deploy User Port [Joan_Linck] [Joan_Linck] -ecp 3134/tcp # Extensible Code Protocol [Jim_Trek][Mark_Bocko] [Jim_Trek][Mark_Bocko] -ecp 3134/udp # Extensible Code Protocol [Jim_Trek][Mark_Bocko] [Jim_Trek][Mark_Bocko] -peerbook-port 3135/tcp # PeerBook Port [John_Flowers] [John_Flowers] -peerbook-port 3135/udp # PeerBook Port [John_Flowers] [John_Flowers] -grubd 3136/tcp # Grub Server Port [Kord_Campbell] [Kord_Campbell] -grubd 3136/udp # Grub Server Port [Kord_Campbell] [Kord_Campbell] -rtnt-1 3137/tcp # rtnt-1 data packets -rtnt-1 3137/udp # rtnt-1 data packets -rtnt-2 3138/tcp # rtnt-2 data packets [Ron_Muellerschoen] [Ron_Muellerschoen] -rtnt-2 3138/udp # rtnt-2 data packets [Ron_Muellerschoen] [Ron_Muellerschoen] -incognitorv 3139/tcp # Incognito Rendez-Vous [Stephane_Bourque] [Stephane_Bourque] -incognitorv 3139/udp # Incognito Rendez-Vous [Stephane_Bourque] [Stephane_Bourque] -ariliamulti 3140/tcp # Arilia Multiplexor [Stephane_Bourque_2] [Stephane_Bourque_2] -ariliamulti 3140/udp # Arilia Multiplexor [Stephane_Bourque_2] [Stephane_Bourque_2] -vmodem 3141/tcp # VMODEM [Ray_Gwinn] [Ray_Gwinn] -vmodem 3141/udp # VMODEM [Ray_Gwinn] [Ray_Gwinn] -rdc-wh-eos 3142/tcp # RDC WH EOS [Udi_Nir] [Udi_Nir] -rdc-wh-eos 3142/udp # RDC WH EOS [Udi_Nir] [Udi_Nir] -seaview 3143/tcp # Sea View [Jim_Flaherty_2] [Jim_Flaherty_2] -seaview 3143/udp # Sea View [Jim_Flaherty_2] [Jim_Flaherty_2] -tarantella 3144/tcp # Tarantella [Roger_Binns] [Roger_Binns] -tarantella 3144/udp # Tarantella [Roger_Binns] [Roger_Binns] -# Known -csi-lfap 3145/tcp # CSI-LFAP [Paul_Amsden] [Paul_Amsden] UNAUTHORIZED -# USE: port -# 3145 -# Known -csi-lfap 3145/udp # CSI-LFAP [Paul_Amsden] [Paul_Amsden] UNAUTHORIZED -# USE: port -# 3145 -bears-02 3146/tcp # bears-02 [Bruce_McKinnon_2] [Bruce_McKinnon_2] -bears-02 3146/udp # bears-02 [Bruce_McKinnon_2] [Bruce_McKinnon_2] -rfio 3147/tcp # RFIO [Frederic_Hemmer] [Frederic_Hemmer] -rfio 3147/udp # RFIO [Frederic_Hemmer] [Frederic_Hemmer] -nm-game-admin 3148/tcp # NetMike Game Administrator -nm-game-admin 3148/udp # NetMike Game Administrator -nm-game-server 3149/tcp # NetMike Game Server -nm-game-server 3149/udp # NetMike Game Server -nm-asses-admin 3150/tcp # NetMike Assessor -# Administrator -nm-asses-admin 3150/udp # NetMike Assessor -# Administrator -nm-assessor 3151/tcp # NetMike Assessor [Andrew_Sharpe] [Andrew_Sharpe] -nm-assessor 3151/udp # NetMike Assessor [Andrew_Sharpe] [Andrew_Sharpe] -feitianrockey 3152/tcp # FeiTian Port [Huang_Yu] [Huang_Yu] -feitianrockey 3152/udp # FeiTian Port [Huang_Yu] [Huang_Yu] -s8-client-port 3153/tcp # S8Cargo Client Port [Jon_S_Kyle] [Jon_S_Kyle] -s8-client-port 3153/udp # S8Cargo Client Port [Jon_S_Kyle] [Jon_S_Kyle] -ccmrmi 3154/tcp # ON RMI Registry [Ram_Sudama] [Ram_Sudama] -ccmrmi 3154/udp # ON RMI Registry [Ram_Sudama] [Ram_Sudama] -jpegmpeg 3155/tcp # JpegMpeg Port [Richard_Bassous] [Richard_Bassous] -jpegmpeg 3155/udp # JpegMpeg Port [Richard_Bassous] [Richard_Bassous] -indura 3156/tcp # Indura Collector [Bruce_Kosbab] [Bruce_Kosbab] -indura 3156/udp # Indura Collector [Bruce_Kosbab] [Bruce_Kosbab] -e3consultants 3157/tcp # CCC Listener Port [Brian_Carnell] [Brian_Carnell] -e3consultants 3157/udp # CCC Listener Port [Brian_Carnell] [Brian_Carnell] -stvp 3158/tcp # SmashTV Protocol [Christian_Wolff] [Christian_Wolff] -stvp 3158/udp # SmashTV Protocol [Christian_Wolff] [Christian_Wolff] -navegaweb-port 3159/tcp # NavegaWeb Tarification [Miguel_Angel_Fernand] [Miguel_Angel_Fernand] -navegaweb-port 3159/udp # NavegaWeb Tarification [Miguel_Angel_Fernand] [Miguel_Angel_Fernand] -tip-app-server 3160/tcp # TIP Application Server [Olivier_Mascia] [Olivier_Mascia] -tip-app-server 3160/udp # TIP Application Server [Olivier_Mascia] [Olivier_Mascia] -doc1lm 3161/tcp # DOC1 License Manager [Greg_Goodson] [Greg_Goodson] -doc1lm 3161/udp # DOC1 License Manager [Greg_Goodson] [Greg_Goodson] -sflm 3162/tcp # SFLM [System_Administrator] [System_Administrator] -sflm 3162/udp # SFLM [System_Administrator] [System_Administrator] -res-sap 3163/tcp # RES-SAP [Bob_Janssen] [Bob_Janssen] -res-sap 3163/udp # RES-SAP [Bob_Janssen] [Bob_Janssen] -imprs 3164/tcp # IMPRS [Lars_Bohn] [Lars_Bohn] -imprs 3164/udp # IMPRS [Lars_Bohn] [Lars_Bohn] -newgenpay 3165/tcp # Newgenpay Engine Service [Ilan_Zisser] [Ilan_Zisser] -newgenpay 3165/udp # Newgenpay Engine Service [Ilan_Zisser] [Ilan_Zisser] -sossecollector 3166/tcp # Quest Spotlight [Greg_Cottman] [Greg_Cottman] 2008-10-23 -# Out-Of-Process Collector -sossecollector 3166/udp # Quest Spotlight [Greg_Cottman] [Greg_Cottman] 2008-10-23 -# Out-Of-Process Collector -nowcontact 3167/tcp # Now Contact Public Server -nowcontact 3167/udp # Now Contact Public Server -poweronnud 3168/tcp # Now Up-to-Date Public Server [John_Wallace] [John_Wallace] -poweronnud 3168/udp # Now Up-to-Date Public Server [John_Wallace] [John_Wallace] -serverview-as 3169/tcp # SERVERVIEW-AS -serverview-as 3169/udp # SERVERVIEW-AS -serverview-asn 3170/tcp # SERVERVIEW-ASN -serverview-asn 3170/udp # SERVERVIEW-ASN -serverview-gf 3171/tcp # SERVERVIEW-GF -serverview-gf 3171/udp # SERVERVIEW-GF -serverview-rm 3172/tcp # SERVERVIEW-RM -serverview-rm 3172/udp # SERVERVIEW-RM -serverview-icc 3173/tcp # SERVERVIEW-ICC [Detlef_Rothe] [Detlef_Rothe] 2009-05-15 -serverview-icc 3173/udp # SERVERVIEW-ICC [Detlef_Rothe] [Detlef_Rothe] 2009-05-15 -armi-server 3174/tcp # ARMI Server [Bobby_Martin] [Bobby_Martin] -armi-server 3174/udp # ARMI Server [Bobby_Martin] [Bobby_Martin] -t1-e1-over-ip 3175/tcp # T1_E1_Over_IP [Mark_Doyle] [Mark_Doyle] -t1-e1-over-ip 3175/udp # T1_E1_Over_IP [Mark_Doyle] [Mark_Doyle] -ars-master 3176/tcp # ARS Master [Portnoy_Boxman] [Portnoy_Boxman] -ars-master 3176/udp # ARS Master [Portnoy_Boxman] [Portnoy_Boxman] -phonex-port 3177/tcp # Phonex Protocol [Doug_Grover] [Doug_Grover] -phonex-port 3177/udp # Phonex Protocol [Doug_Grover] [Doug_Grover] -radclientport 3178/tcp # Radiance UltraEdge Port [Sri_Subramaniam] [Sri_Subramaniam] -radclientport 3178/udp # Radiance UltraEdge Port [Sri_Subramaniam] [Sri_Subramaniam] -h2gf-w-2m 3179/tcp # H2GF W.2m Handover prot. [Arne_Norefors] [Arne_Norefors] -h2gf-w-2m 3179/udp # H2GF W.2m Handover prot. [Arne_Norefors] [Arne_Norefors] -mc-brk-srv 3180/tcp # Millicent Broker Server [Steve_Glassman] [Steve_Glassman] -mc-brk-srv 3180/udp # Millicent Broker Server [Steve_Glassman] [Steve_Glassman] -bmcpatrolagent 3181/tcp # BMC Patrol Agent -bmcpatrolagent 3181/udp # BMC Patrol Agent -bmcpatrolrnvu 3182/tcp # BMC Patrol Rendezvous [Portnoy_Boxman] [Portnoy_Boxman] -bmcpatrolrnvu 3182/udp # BMC Patrol Rendezvous [Portnoy_Boxman] [Portnoy_Boxman] -cops-tls 3183/tcp # COPS/TLS [Mark_Stevens] [Mark_Stevens] -cops-tls 3183/udp # COPS/TLS [Mark_Stevens] [Mark_Stevens] -apogeex-port 3184/tcp # ApogeeX Port [Tom_Nys] [Tom_Nys] -apogeex-port 3184/udp # ApogeeX Port [Tom_Nys] [Tom_Nys] -smpppd 3185/tcp # SuSE Meta PPPD [Arvin_Schnell] [Arvin_Schnell] -smpppd 3185/udp # SuSE Meta PPPD [Arvin_Schnell] [Arvin_Schnell] -iiw-port 3186/tcp # IIW Monitor User Port [Corey_Burnett] [Corey_Burnett] -iiw-port 3186/udp # IIW Monitor User Port [Corey_Burnett] [Corey_Burnett] -odi-port 3187/tcp # Open Design Listen Port [Phivos_Aristides] [Phivos_Aristides] -odi-port 3187/udp # Open Design Listen Port [Phivos_Aristides] [Phivos_Aristides] -brcm-comm-port 3188/tcp # Broadcom Port [Thomas_L_Johnson] [Thomas_L_Johnson] -brcm-comm-port 3188/udp # Broadcom Port [Thomas_L_Johnson] [Thomas_L_Johnson] -pcle-infex 3189/tcp # Pinnacle Sys InfEx Port [Anthon_van_der_Neut] [Anthon_van_der_Neut] -pcle-infex 3189/udp # Pinnacle Sys InfEx Port [Anthon_van_der_Neut] [Anthon_van_der_Neut] -csvr-proxy 3190/tcp # ConServR Proxy -csvr-proxy 3190/udp # ConServR Proxy -csvr-sslproxy 3191/tcp # ConServR SSL Proxy [Mikhail_Kruk] [Mikhail_Kruk] -csvr-sslproxy 3191/udp # ConServR SSL Proxy [Mikhail_Kruk] [Mikhail_Kruk] -firemonrcc 3192/tcp # FireMon Revision Control [Michael_Bishop] [Michael_Bishop] -firemonrcc 3192/udp # FireMon Revision Control [Michael_Bishop] [Michael_Bishop] -spandataport 3193/tcp # SpanDataPort [Jesse_McKay] [Jesse_McKay] -spandataport 3193/udp # SpanDataPort [Jesse_McKay] [Jesse_McKay] -magbind 3194/tcp # Rockstorm MAG protocol [Jens_Nilsson] [Jens_Nilsson] -magbind 3194/udp # Rockstorm MAG protocol [Jens_Nilsson] [Jens_Nilsson] -ncu-1 3195/tcp # Network Control Unit -ncu-1 3195/udp # Network Control Unit -ncu-2 3196/tcp # Network Control Unit [Charlie_Hundre] [Charlie_Hundre] -ncu-2 3196/udp # Network Control Unit [Charlie_Hundre] [Charlie_Hundre] -embrace-dp-s 3197/tcp # Embrace Device Protocol -# Server -embrace-dp-s 3197/udp # Embrace Device Protocol -# Server -embrace-dp-c 3198/tcp # Embrace Device Protocol [Elliot_Schwartz] [Elliot_Schwartz] -# Client -embrace-dp-c 3198/udp # Embrace Device Protocol [Elliot_Schwartz] [Elliot_Schwartz] -# Client -dmod-workspace 3199/tcp # DMOD WorkSpace [Nick_Plante] [Nick_Plante] -dmod-workspace 3199/udp # DMOD WorkSpace [Nick_Plante] [Nick_Plante] -tick-port 3200/tcp # Press-sense Tick Port [Boris_Svetlitsky] [Boris_Svetlitsky] -tick-port 3200/udp # Press-sense Tick Port [Boris_Svetlitsky] [Boris_Svetlitsky] -cpq-tasksmart 3201/tcp # CPQ-TaskSmart [Jackie_Lau] [Jackie_Lau] -cpq-tasksmart 3201/udp # CPQ-TaskSmart [Jackie_Lau] [Jackie_Lau] -intraintra 3202/tcp # IntraIntra [Matthew_Asham] [Matthew_Asham] -intraintra 3202/udp # IntraIntra [Matthew_Asham] [Matthew_Asham] -netwatcher-mon 3203/tcp # Network Watcher Monitor -netwatcher-mon 3203/udp # Network Watcher Monitor -netwatcher-db 3204/tcp # Network Watcher DB Access [Hirokazu_Fujisawa] [Hirokazu_Fujisawa] -netwatcher-db 3204/udp # Network Watcher DB Access [Hirokazu_Fujisawa] [Hirokazu_Fujisawa] -isns 3205/tcp # iSNS Server Port [RFC4171] -isns 3205/udp # iSNS Server Port [RFC4171] -ironmail 3206/tcp # IronMail POP Proxy [Mike_Hudack] [Mike_Hudack] -ironmail 3206/udp # IronMail POP Proxy [Mike_Hudack] [Mike_Hudack] -vx-auth-port 3207/tcp # Veritas Authentication Port [Senthil_Ponnuswamy] [Senthil_Ponnuswamy] -vx-auth-port 3207/udp # Veritas Authentication Port [Senthil_Ponnuswamy] [Senthil_Ponnuswamy] -pfu-prcallback 3208/tcp # PFU PR Callback [Tetsuharu_Hanada] [Tetsuharu_Hanada] -pfu-prcallback 3208/udp # PFU PR Callback [Tetsuharu_Hanada] [Tetsuharu_Hanada] -netwkpathengine 3209/tcp # HP OpenView Network Path [Anthony_Walker] [Anthony_Walker] -# Engine Server -netwkpathengine 3209/udp # HP OpenView Network Path [Anthony_Walker] [Anthony_Walker] -# Engine Server -flamenco-proxy 3210/tcp # Flamenco Networks Proxy [Corey_Corrick] [Corey_Corrick] -flamenco-proxy 3210/udp # Flamenco Networks Proxy [Corey_Corrick] [Corey_Corrick] -avsecuremgmt 3211/tcp # Avocent Secure Management [Brian_S_Stewart] [Brian_S_Stewart] -avsecuremgmt 3211/udp # Avocent Secure Management [Brian_S_Stewart] [Brian_S_Stewart] -surveyinst 3212/tcp # Survey Instrument [Al_Amet] [Al_Amet] -surveyinst 3212/udp # Survey Instrument [Al_Amet] [Al_Amet] -neon24x7 3213/tcp # NEON 24X7 Mission Control [Tony_Lubrano] [Tony_Lubrano] -neon24x7 3213/udp # NEON 24X7 Mission Control [Tony_Lubrano] [Tony_Lubrano] -jmq-daemon-1 3214/tcp # JMQ Daemon Port 1 -jmq-daemon-1 3214/udp # JMQ Daemon Port 1 -jmq-daemon-2 3215/tcp # JMQ Daemon Port 2 [Martin_West] [Martin_West] -jmq-daemon-2 3215/udp # JMQ Daemon Port 2 [Martin_West] [Martin_West] -ferrari-foam 3216/tcp # Ferrari electronic FOAM [Johann_Deutinger] [Johann_Deutinger] -ferrari-foam 3216/udp # Ferrari electronic FOAM [Johann_Deutinger] [Johann_Deutinger] -unite 3217/tcp # Unified IP & Telecom [Christer_Gunnarsson] [Christer_Gunnarsson] 2009-03-26 -# Environment -unite 3217/udp # Unified IP & Telecom [Christer_Gunnarsson] [Christer_Gunnarsson] 2009-03-26 -# Environment -smartpackets 3218/tcp # EMC SmartPackets [Steve_Spataro] [Steve_Spataro] -smartpackets 3218/udp # EMC SmartPackets [Steve_Spataro] [Steve_Spataro] -wms-messenger 3219/tcp # WMS Messenger [Michael_Monasterio] [Michael_Monasterio] -wms-messenger 3219/udp # WMS Messenger [Michael_Monasterio] [Michael_Monasterio] -xnm-ssl 3220/tcp # XML NM over SSL -xnm-ssl 3220/udp # XML NM over SSL -xnm-clear-text 3221/tcp # XML NM over TCP [Mark_Trostler] [Mark_Trostler] -xnm-clear-text 3221/udp # XML NM over TCP [Mark_Trostler] [Mark_Trostler] -glbp 3222/tcp # Gateway Load Balancing Pr [Douglas_McLaggan] [Douglas_McLaggan] -glbp 3222/udp # Gateway Load Balancing Pr [Douglas_McLaggan] [Douglas_McLaggan] -digivote 3223/tcp # DIGIVOTE (R) Vote-Server [Christian_Treczoks] [Christian_Treczoks] -digivote 3223/udp # DIGIVOTE (R) Vote-Server [Christian_Treczoks] [Christian_Treczoks] -aes-discovery 3224/tcp # AES Discovery Port [Ken_Richard] [Ken_Richard] -aes-discovery 3224/udp # AES Discovery Port [Ken_Richard] [Ken_Richard] -fcip-port 3225/tcp # FCIP [RFC3821] -fcip-port 3225/udp # FCIP [RFC3821] -isi-irp 3226/tcp # ISI Industry Software IRP [Peter_Sandstrom] [Peter_Sandstrom] -isi-irp 3226/udp # ISI Industry Software IRP [Peter_Sandstrom] [Peter_Sandstrom] -dwnmshttp 3227/tcp # DiamondWave NMS Server -dwnmshttp 3227/udp # DiamondWave NMS Server -dwmsgserver 3228/tcp # DiamondWave MSG Server [Varma_Bhupatiraju] [Varma_Bhupatiraju] -dwmsgserver 3228/udp # DiamondWave MSG Server [Varma_Bhupatiraju] [Varma_Bhupatiraju] -global-cd-port 3229/tcp # Global CD Port [Vitaly_Revsin_2] [Vitaly_Revsin_2] -global-cd-port 3229/udp # Global CD Port [Vitaly_Revsin_2] [Vitaly_Revsin_2] -sftdst-port 3230/tcp # Software Distributor Port [Andrea_Lanza] [Andrea_Lanza] 2014-02-21 -sftdst-port 3230/udp # Software Distributor Port [Andrea_Lanza] [Andrea_Lanza] 2014-02-21 -# VidiGo communication -vidigo 3231/tcp # (previous was: Delta [Peter_Ijkhout] [Peter_Ijkhout] -# Solutions Direct) -# VidiGo communication -vidigo 3231/udp # (previous was: Delta [Peter_Ijkhout] [Peter_Ijkhout] -# Solutions Direct) -mdtp 3232/tcp # MDT port 2012-02-21 [RFC6513] -mdtp 3232/udp # MDT port 2012-02-21 [RFC6513] -whisker 3233/tcp # WhiskerControl main port [Rudolf_Cardinal] [Rudolf_Cardinal] 2002-02 -whisker 3233/udp # WhiskerControl main port [Rudolf_Cardinal] [Rudolf_Cardinal] 2002-02 -alchemy 3234/tcp # Alchemy Server [Mikhail_Belov] [Mikhail_Belov] 2002-02 -alchemy 3234/udp # Alchemy Server [Mikhail_Belov] [Mikhail_Belov] 2002-02 -mdap-port 3235/tcp # MDAP port [Johan_Deleu] [Johan_Deleu] 2002-02 -mdap-port 3235/udp # MDAP Port [Johan_Deleu] [Johan_Deleu] 2002-02 -apparenet-ts 3236/tcp # appareNet Test Server -apparenet-ts 3236/udp # appareNet Test Server -apparenet-tps 3237/tcp # appareNet Test Packet -# Sequencer -apparenet-tps 3237/udp # appareNet Test Packet -# Sequencer -apparenet-as 3238/tcp # appareNet Analysis Server -apparenet-as 3238/udp # appareNet Analysis Server -apparenet-ui 3239/tcp # appareNet User Interface [Fred_Klassen] [Fred_Klassen] 2002-02 -apparenet-ui 3239/udp # appareNet User Interface [Fred_Klassen] [Fred_Klassen] 2002-02 -triomotion 3240/tcp # Trio Motion Control Port [Tony_Matthews] [Tony_Matthews] 2002-02 -triomotion 3240/udp # Trio Motion Control Port [Tony_Matthews] [Tony_Matthews] 2002-02 -sysorb 3241/tcp # SysOrb Monitoring Server [Jakob_Oestergaard] [Jakob_Oestergaard] 2002-02 -sysorb 3241/udp # SysOrb Monitoring Server [Jakob_Oestergaard] [Jakob_Oestergaard] 2002-02 -sdp-id-port 3242/tcp # Session Description ID [Greg_Rose_2] [Greg_Rose_2] 2002-02 -sdp-id-port 3242/udp # Session Description ID [Greg_Rose_2] [Greg_Rose_2] 2002-02 -timelot 3243/tcp # Timelot Port [David_Ferguson] [David_Ferguson] 2002-02 -timelot 3243/udp # Timelot Port [David_Ferguson] [David_Ferguson] 2002-02 -onesaf 3244/tcp # OneSAF [Gene_McCulley] [Gene_McCulley] 2002-02 -onesaf 3244/udp # OneSAF [Gene_McCulley] [Gene_McCulley] 2002-02 -vieo-fe 3245/tcp # VIEO Fabric Executive [James_Cox] [James_Cox] 2002-02 -vieo-fe 3245/udp # VIEO Fabric Executive [James_Cox] [James_Cox] 2002-02 -dvt-system 3246/tcp # DVT SYSTEM PORT -dvt-system 3246/udp # DVT SYSTEM PORT -dvt-data 3247/tcp # DVT DATA LINK [Phillip_Heil] [Phillip_Heil] 2002-02 -dvt-data 3247/udp # DVT DATA LINK [Phillip_Heil] [Phillip_Heil] 2002-02 -procos-lm 3248/tcp # PROCOS LM [Torsten_Rendelmann] [Torsten_Rendelmann] -procos-lm 3248/udp # PROCOS LM [Torsten_Rendelmann] [Torsten_Rendelmann] -ssp 3249/tcp # State Sync Protocol [Stephane_Beaulieu] [Stephane_Beaulieu] 2002-02 -ssp 3249/udp # State Sync Protocol [Stephane_Beaulieu] [Stephane_Beaulieu] 2002-02 -hicp 3250/tcp # HMS hicp port [Joel_Palsson] [Joel_Palsson] 2002-02 -hicp 3250/udp # HMS hicp port [Joel_Palsson] [Joel_Palsson] 2002-02 -sysscanner 3251/tcp # Sys Scanner [Dick_Georges] [Dick_Georges] 2002-02 -sysscanner 3251/udp # Sys Scanner [Dick_Georges] [Dick_Georges] 2002-02 -dhe 3252/tcp # DHE port [Fabrizio_Massimo_Fer] [Fabrizio_Massimo_Fer] 2002-02 -dhe 3252/udp # DHE port [Fabrizio_Massimo_Fer] [Fabrizio_Massimo_Fer] 2002-02 -pda-data 3253/tcp # PDA Data -pda-data 3253/udp # PDA Data -pda-sys 3254/tcp # PDA System [Jian_Fan] [Jian_Fan] 2002-02 -pda-sys 3254/udp # PDA System [Jian_Fan] [Jian_Fan] 2002-02 -semaphore 3255/tcp # Semaphore Connection Port [Jay_Eckles] [Jay_Eckles] 2002-02 -semaphore 3255/udp # Semaphore Connection Port [Jay_Eckles] [Jay_Eckles] 2002-02 -cpqrpm-agent 3256/tcp # Compaq RPM Agent Port -cpqrpm-agent 3256/udp # Compaq RPM Agent Port -cpqrpm-server 3257/tcp # Compaq RPM Server Port [Royal_King] [Royal_King] 2002-02 -cpqrpm-server 3257/udp # Compaq RPM Server Port [Royal_King] [Royal_King] 2002-02 -ivecon-port 3258/tcp # Ivecon Server Port [Serguei_Tevs] [Serguei_Tevs] 2002-02 -ivecon-port 3258/udp # Ivecon Server Port [Serguei_Tevs] [Serguei_Tevs] 2002-02 -epncdp2 3259/tcp # Epson Network Common Devi [Oishi_Toshiaki] [Oishi_Toshiaki] 2002-02 -epncdp2 3259/udp # Epson Network Common Devi [Oishi_Toshiaki] [Oishi_Toshiaki] 2002-02 -iscsi-target 3260/tcp # iSCSI port [IESG] [IETF_Chair] 2013-08-27 [RFC7143] -iscsi-target 3260/udp # iSCSI port [IESG] [IETF_Chair] 2013-08-27 [RFC7143] -winshadow 3261/tcp # winShadow [Colin_Barry] [Colin_Barry] -winshadow 3261/udp # winShadow [Colin_Barry] [Colin_Barry] -necp 3262/tcp # NECP [Alberto_Cerpa] [Alberto_Cerpa] -necp 3262/udp # NECP [Alberto_Cerpa] [Alberto_Cerpa] -ecolor-imager 3263/tcp # E-Color Enterprise Imager [Tamara_Baker] [Tamara_Baker] -ecolor-imager 3263/udp # E-Color Enterprise Imager [Tamara_Baker] [Tamara_Baker] -ccmail 3264/tcp # cc:mail/lotus [brockman] [brockman] -ccmail 3264/udp # cc:mail/lotus [brockman] [brockman] -altav-tunnel 3265/tcp # Altav Tunnel [Gary_M_Allen] [Gary_M_Allen] -altav-tunnel 3265/udp # Altav Tunnel [Gary_M_Allen] [Gary_M_Allen] -ns-cfg-server 3266/tcp # NS CFG Server [Aivi_Lie] [Aivi_Lie] -ns-cfg-server 3266/udp # NS CFG Server [Aivi_Lie] [Aivi_Lie] -ibm-dial-out 3267/tcp # IBM Dial Out [Skip_Booth] [Skip_Booth] -ibm-dial-out 3267/udp # IBM Dial Out [Skip_Booth] [Skip_Booth] -msft-gc 3268/tcp # Microsoft Global Catalog -msft-gc 3268/udp # Microsoft Global Catalog -msft-gc-ssl 3269/tcp # Microsoft Global Catalog [Asaf_Kashi] [Asaf_Kashi] -# with LDAP/SSL -msft-gc-ssl 3269/udp # Microsoft Global Catalog [Asaf_Kashi] [Asaf_Kashi] -# with LDAP/SSL -verismart 3270/tcp # Verismart [Jay_Weber] [Jay_Weber] -verismart 3270/udp # Verismart [Jay_Weber] [Jay_Weber] -csoft-prev 3271/tcp # CSoft Prev Port [Nedelcho_Stanev_3] [Nedelcho_Stanev_3] -csoft-prev 3271/udp # CSoft Prev Port [Nedelcho_Stanev_3] [Nedelcho_Stanev_3] -user-manager 3272/tcp # Fujitsu User Manager [Yukihiko_Sakurai] [Yukihiko_Sakurai] -user-manager 3272/udp # Fujitsu User Manager [Yukihiko_Sakurai] [Yukihiko_Sakurai] -sxmp 3273/tcp # Simple Extensible [admin] [admin] -# Multiplexed Protocol -sxmp 3273/udp # Simple Extensible [admin] [admin] -# Multiplexed Protocol -ordinox-server 3274/tcp # Ordinox Server [Denis_Ducharme] [Denis_Ducharme] -ordinox-server 3274/udp # Ordinox Server [Denis_Ducharme] [Denis_Ducharme] -samd 3275/tcp # SAMD [Edgar_Circenis] [Edgar_Circenis] -samd 3275/udp # SAMD [Edgar_Circenis] [Edgar_Circenis] -maxim-asics 3276/tcp # Maxim ASICs [Dave_Inman] [Dave_Inman] -maxim-asics 3276/udp # Maxim ASICs [Dave_Inman] [Dave_Inman] -awg-proxy 3277/tcp # AWG Proxy [Alex_McDonald] [Alex_McDonald] -awg-proxy 3277/udp # AWG Proxy [Alex_McDonald] [Alex_McDonald] -lkcmserver 3278/tcp # LKCM Server [Javier_Jimenez] [Javier_Jimenez] -lkcmserver 3278/udp # LKCM Server [Javier_Jimenez] [Javier_Jimenez] -admind 3279/tcp # admind [Jeff_Haynes] [Jeff_Haynes] -admind 3279/udp # admind [Jeff_Haynes] [Jeff_Haynes] -vs-server 3280/tcp # VS Server [Scott_Godlew] [Scott_Godlew] -vs-server 3280/udp # VS Server [Scott_Godlew] [Scott_Godlew] -sysopt 3281/tcp # SYSOPT [Tony_Hoffman] [Tony_Hoffman] -sysopt 3281/udp # SYSOPT [Tony_Hoffman] [Tony_Hoffman] -datusorb 3282/tcp # Datusorb [Thomas_Martin] [Thomas_Martin] -datusorb 3282/udp # Datusorb [Thomas_Martin] [Thomas_Martin] -# Apple Remote -# Desktop (Net 3283 tcp Net Assistant [Michael_Stein] [Michael_Stein] 2011-11-09 -# Assistant) -# Apple Remote -# Desktop (Net 3283 udp Net Assistant [Michael_Stein] [Michael_Stein] 2011-11-09 -# Assistant) -4talk 3284/tcp # 4Talk [Tony_Bushnell] [Tony_Bushnell] -4talk 3284/udp # 4Talk [Tony_Bushnell] [Tony_Bushnell] -plato 3285/tcp # Plato [Jim_Battin] [Jim_Battin] -plato 3285/udp # Plato [Jim_Battin] [Jim_Battin] -e-net 3286/tcp # E-Net [Steven_Grigsby] [Steven_Grigsby] -e-net 3286/udp # E-Net [Steven_Grigsby] [Steven_Grigsby] -directvdata 3287/tcp # DIRECTVDATA [Michael_Friedman] [Michael_Friedman] -directvdata 3287/udp # DIRECTVDATA [Michael_Friedman] [Michael_Friedman] -cops 3288/tcp # COPS [Shai_Herzog] [Shai_Herzog] -cops 3288/udp # COPS [Shai_Herzog] [Shai_Herzog] -enpc 3289/tcp # ENPC [SEIKO_EPSON_2] [SEIKO_EPSON_2] -enpc 3289/udp # ENPC [SEIKO_EPSON_2] [SEIKO_EPSON_2] -caps-lm 3290/tcp # CAPS LOGISTICS TOOLKIT - LM [Joseph_Krebs] [Joseph_Krebs] -caps-lm 3290/udp # CAPS LOGISTICS TOOLKIT - LM [Joseph_Krebs] [Joseph_Krebs] -sah-lm 3291/tcp # S A Holditch & Associates - [Randy_Hudgens] [Randy_Hudgens] -# LM -sah-lm 3291/udp # S A Holditch & Associates - [Randy_Hudgens] [Randy_Hudgens] -# LM -cart-o-rama 3292/tcp # Cart O Rama [Phillip_Dillinger] [Phillip_Dillinger] -cart-o-rama 3292/udp # Cart O Rama [Phillip_Dillinger] [Phillip_Dillinger] -fg-fps 3293/tcp # fg-fps -fg-fps 3293/udp # fg-fps -fg-gip 3294/tcp # fg-gip [Jean_Marc_Frailong] [Jean_Marc_Frailong] -fg-gip 3294/udp # fg-gip [Jean_Marc_Frailong] [Jean_Marc_Frailong] -dyniplookup 3295/tcp # Dynamic IP Lookup [Eugene_Osovetsky] [Eugene_Osovetsky] -dyniplookup 3295/udp # Dynamic IP Lookup [Eugene_Osovetsky] [Eugene_Osovetsky] -rib-slm 3296/tcp # Rib License Manager [Kristean_Heisler] [Kristean_Heisler] -rib-slm 3296/udp # Rib License Manager [Kristean_Heisler] [Kristean_Heisler] -cytel-lm 3297/tcp # Cytel License Manager [Yogesh_P_Gajjar] [Yogesh_P_Gajjar] -cytel-lm 3297/udp # Cytel License Manager [Yogesh_P_Gajjar] [Yogesh_P_Gajjar] -deskview 3298/tcp # DeskView [Manfred_Randelzofer] [Manfred_Randelzofer] -deskview 3298/udp # DeskView [Manfred_Randelzofer] [Manfred_Randelzofer] -pdrncs 3299/tcp # pdrncs [Paul_Wissenbach] [Paul_Wissenbach] -pdrncs 3299/udp # pdrncs [Paul_Wissenbach] [Paul_Wissenbach] -# Knwon -ceph 3300/tcp # Ceph monitor [Sage_Weil] [Sage_Weil] 2015-06-29 Unauthorized -# Use on -# 3300-3301 -# 3300 udp Reserved -# Knwon -# 3301 unassigned Unauthorized -# Use on -# 3300-3301 -mcs-fastmail 3302/tcp # MCS Fastmail [Patti_Jo_Newsom] [Patti_Jo_Newsom] -mcs-fastmail 3302/udp # MCS Fastmail [Patti_Jo_Newsom] [Patti_Jo_Newsom] -opsession-clnt 3303/tcp # OP Session Client -opsession-clnt 3303/udp # OP Session Client -opsession-srvr 3304/tcp # OP Session Server [Amir_Blich] [Amir_Blich] -opsession-srvr 3304/udp # OP Session Server [Amir_Blich] [Amir_Blich] -odette-ftp 3305/tcp # ODETTE-FTP [David_Nash] [David_Nash] [RFC5024] -odette-ftp 3305/udp # ODETTE-FTP [David_Nash] [David_Nash] [RFC5024] -mysql 3306/tcp # MySQL [Monty] [Monty] -mysql 3306/udp # MySQL [Monty] [Monty] -opsession-prxy 3307/tcp # OP Session Proxy [Amir_Blich] [Amir_Blich] -opsession-prxy 3307/udp # OP Session Proxy [Amir_Blich] [Amir_Blich] -tns-server 3308/tcp # TNS Server -tns-server 3308/udp # TNS Server -tns-adv 3309/tcp # TNS ADV [Jerome_Albin] [Jerome_Albin] -tns-adv 3309/udp # TNS ADV [Jerome_Albin] [Jerome_Albin] -dyna-access 3310/tcp # Dyna Access [Dave_Belliveau] [Dave_Belliveau] -dyna-access 3310/udp # Dyna Access [Dave_Belliveau] [Dave_Belliveau] -mcns-tel-ret 3311/tcp # MCNS Tel Ret [Randall_Atkinson] [Randall_Atkinson] -mcns-tel-ret 3311/udp # MCNS Tel Ret [Randall_Atkinson] [Randall_Atkinson] -appman-server 3312/tcp # Application Management -# Server -appman-server 3312/udp # Application Management -# Server -uorb 3313/tcp # Unify Object Broker [Daegis_Inc] [Chris_Anderson] 2012-07-31 -uorb 3313/udp # Unify Object Broker [Daegis_Inc] [Chris_Anderson] 2012-07-31 -uohost 3314/tcp # Unify Object Host [Daegis_Inc] [Chris_Anderson] 2012-07-31 -uohost 3314/udp # Unify Object Host [Daegis_Inc] [Chris_Anderson] 2012-07-31 -cdid 3315/tcp # CDID [Andrew_Borisov] [Andrew_Borisov] -cdid 3315/udp # CDID [Andrew_Borisov] [Andrew_Borisov] -aicc-cmi 3316/tcp # AICC/CMI [William_McDonald] [William_McDonald] -aicc-cmi 3316/udp # AICC/CMI [William_McDonald] [William_McDonald] -vsaiport 3317/tcp # VSAI PORT [Rieko_Asai] [Rieko_Asai] -vsaiport 3317/udp # VSAI PORT [Rieko_Asai] [Rieko_Asai] -ssrip 3318/tcp # Swith to Swith Routing [Baba_Hidekazu] [Baba_Hidekazu] -# Information Protocol -ssrip 3318/udp # Swith to Swith Routing [Baba_Hidekazu] [Baba_Hidekazu] -# Information Protocol -sdt-lmd 3319/tcp # SDT License Manager [Salvo_Nassisi] [Salvo_Nassisi] -sdt-lmd 3319/udp # SDT License Manager [Salvo_Nassisi] [Salvo_Nassisi] -officelink2000 3320/tcp # Office Link 2000 [Mike_Balch] [Mike_Balch] -officelink2000 3320/udp # Office Link 2000 [Mike_Balch] [Mike_Balch] -vnsstr 3321/tcp # VNSSTR [Takeshi_Ohmura] [Takeshi_Ohmura] -vnsstr 3321/udp # VNSSTR [Takeshi_Ohmura] [Takeshi_Ohmura] -# active-net 3322-3325 Active Networks [Bob_Braden_2] [Bob_Braden_2] -sftu 3326/tcp # SFTU [Eduardo_Rosenberg_de] [Eduardo_Rosenberg_de] -sftu 3326/udp # SFTU [Eduardo_Rosenberg_de] [Eduardo_Rosenberg_de] -bbars 3327/tcp # BBARS [Lou_Harris] [Lou_Harris] -bbars 3327/udp # BBARS [Lou_Harris] [Lou_Harris] -egptlm 3328/tcp # Eaglepoint License Manager [Dave_Benton] [Dave_Benton] -egptlm 3328/udp # Eaglepoint License Manager [Dave_Benton] [Dave_Benton] -hp-device-disc 3329/tcp # HP Device Disc [Shivaun_Albright] [Shivaun_Albright] -hp-device-disc 3329/udp # HP Device Disc [Shivaun_Albright] [Shivaun_Albright] -mcs-calypsoicf 3330/tcp # MCS Calypso ICF -mcs-calypsoicf 3330/udp # MCS Calypso ICF -mcs-messaging 3331/tcp # MCS Messaging -mcs-messaging 3331/udp # MCS Messaging -mcs-mailsvr 3332/tcp # MCS Mail Server [Patti_Jo_Newsom] [Patti_Jo_Newsom] -mcs-mailsvr 3332/udp # MCS Mail Server [Patti_Jo_Newsom] [Patti_Jo_Newsom] -dec-notes 3333/tcp # DEC Notes [Kim_Moraros] [Kim_Moraros] -dec-notes 3333/udp # DEC Notes [Kim_Moraros] [Kim_Moraros] -directv-web 3334/tcp # Direct TV Webcasting -directv-web 3334/udp # Direct TV Webcasting -directv-soft 3335/tcp # Direct TV Software Updates -directv-soft 3335/udp # Direct TV Software Updates -directv-tick 3336/tcp # Direct TV Tickers -directv-tick 3336/udp # Direct TV Tickers -directv-catlg 3337/tcp # Direct TV Data Catalog [Michael_Friedman] [Michael_Friedman] -directv-catlg 3337/udp # Direct TV Data Catalog [Michael_Friedman] [Michael_Friedman] -anet-b 3338/tcp # OMF data b -anet-b 3338/udp # OMF data b -anet-l 3339/tcp # OMF data l -anet-l 3339/udp # OMF data l -anet-m 3340/tcp # OMF data m -anet-m 3340/udp # OMF data m -anet-h 3341/tcp # OMF data h [Per_Sahlqvist] [Per_Sahlqvist] -anet-h 3341/udp # OMF data h [Per_Sahlqvist] [Per_Sahlqvist] -webtie 3342/tcp # WebTIE [Kevin_Frender] [Kevin_Frender] -webtie 3342/udp # WebTIE [Kevin_Frender] [Kevin_Frender] -ms-cluster-net 3343/tcp # MS Cluster Net [David_Dion] [David_Dion] 2009-02-12 -ms-cluster-net 3343/udp # MS Cluster Net [David_Dion] [David_Dion] 2009-02-12 -bnt-manager 3344/tcp # BNT Manager [Engineering_Dept] [Engineering_Dept] -bnt-manager 3344/udp # BNT Manager [Engineering_Dept] [Engineering_Dept] -influence 3345/tcp # Influence [Russ_Ferriday] [Russ_Ferriday] -influence 3345/udp # Influence [Russ_Ferriday] [Russ_Ferriday] -trnsprntproxy 3346/tcp # Trnsprnt Proxy [Grant_Kirby] [Grant_Kirby] -trnsprntproxy 3346/udp # Trnsprnt Proxy [Grant_Kirby] [Grant_Kirby] -phoenix-rpc 3347/tcp # Phoenix RPC [Ian_Anderson] [Ian_Anderson] -phoenix-rpc 3347/udp # Phoenix RPC [Ian_Anderson] [Ian_Anderson] -pangolin-laser 3348/tcp # Pangolin Laser [William_Benner] [William_Benner] -pangolin-laser 3348/udp # Pangolin Laser [William_Benner] [William_Benner] -chevinservices 3349/tcp # Chevin Services [Gus_McNaughton] [Gus_McNaughton] -chevinservices 3349/udp # Chevin Services [Gus_McNaughton] [Gus_McNaughton] -findviatv 3350/tcp # FINDVIATV [Oran_Davis] [Oran_Davis] -findviatv 3350/udp # FINDVIATV [Oran_Davis] [Oran_Davis] -btrieve 3351/tcp # Btrieve port -btrieve 3351/udp # Btrieve port -ssql 3352/tcp # Scalable SQL [Chuck_Talk] [Chuck_Talk] -ssql 3352/udp # Scalable SQL [Chuck_Talk] [Chuck_Talk] -fatpipe 3353/tcp # FATPIPE [Sanchaita_Datta] [Sanchaita_Datta] -fatpipe 3353/udp # FATPIPE [Sanchaita_Datta] [Sanchaita_Datta] -suitjd 3354/tcp # SUITJD [Todd_Moyer] [Todd_Moyer] -suitjd 3354/udp # SUITJD [Todd_Moyer] [Todd_Moyer] -ordinox-dbase 3355/tcp # Ordinox Dbase [Denis_Ducharme] [Denis_Ducharme] -ordinox-dbase 3355/udp # Ordinox Dbase [Denis_Ducharme] [Denis_Ducharme] -upnotifyps 3356/tcp # UPNOTIFYPS [Mark_Fox] [Mark_Fox] -upnotifyps 3356/udp # UPNOTIFYPS [Mark_Fox] [Mark_Fox] -adtech-test 3357/tcp # Adtech Test IP [Robin_Uyeshiro] [Robin_Uyeshiro] -adtech-test 3357/udp # Adtech Test IP [Robin_Uyeshiro] [Robin_Uyeshiro] -mpsysrmsvr 3358/tcp # Mp Sys Rmsvr [Hiroyuki_Kawabuchi] [Hiroyuki_Kawabuchi] -mpsysrmsvr 3358/udp # Mp Sys Rmsvr [Hiroyuki_Kawabuchi] [Hiroyuki_Kawabuchi] -wg-netforce 3359/tcp # WG NetForce [Lee_Wheat] [Lee_Wheat] -wg-netforce 3359/udp # WG NetForce [Lee_Wheat] [Lee_Wheat] -kv-server 3360/tcp # KV Server -kv-server 3360/udp # KV Server -kv-agent 3361/tcp # KV Agent [Thomas_Soranno] [Thomas_Soranno] -kv-agent 3361/udp # KV Agent [Thomas_Soranno] [Thomas_Soranno] -dj-ilm 3362/tcp # DJ ILM [Don_Tyson] [Don_Tyson] -dj-ilm 3362/udp # DJ ILM [Don_Tyson] [Don_Tyson] -nati-vi-server 3363/tcp # NATI Vi Server [Robert_Dye] [Robert_Dye] -nati-vi-server 3363/udp # NATI Vi Server [Robert_Dye] [Robert_Dye] -creativeserver 3364/tcp # Creative Server -creativeserver 3364/udp # Creative Server -contentserver 3365/tcp # Content Server -contentserver 3365/udp # Content Server -creativepartnr 3366/tcp # Creative Partner [Jesus_Ortiz_2] [Jesus_Ortiz_2] -creativepartnr 3366/udp # Creative Partner [Jesus_Ortiz_2] [Jesus_Ortiz_2] -# satvid-datalnk 3367-3371 Satellite Video Data Link [Scott_Engel] [Scott_Engel] -tip2 3372/tcp # TIP 2 [Keith_Evans] [Keith_Evans] -tip2 3372/udp # TIP 2 [Keith_Evans] [Keith_Evans] -lavenir-lm 3373/tcp # Lavenir License Manager [Marius_Matioc] [Marius_Matioc] -lavenir-lm 3373/udp # Lavenir License Manager [Marius_Matioc] [Marius_Matioc] -cluster-disc 3374/tcp # Cluster Disc [Jeff_Hughes] [Jeff_Hughes] -cluster-disc 3374/udp # Cluster Disc [Jeff_Hughes] [Jeff_Hughes] -vsnm-agent 3375/tcp # VSNM Agent [Venkat_Rangan] [Venkat_Rangan] -vsnm-agent 3375/udp # VSNM Agent [Venkat_Rangan] [Venkat_Rangan] -cdbroker 3376/tcp # CD Broker [Moon_Ho_Chung] [Moon_Ho_Chung] -cdbroker 3376/udp # CD Broker [Moon_Ho_Chung] [Moon_Ho_Chung] -cogsys-lm 3377/tcp # Cogsys Network License [Simon_Chinnick] [Simon_Chinnick] -# Manager -cogsys-lm 3377/udp # Cogsys Network License [Simon_Chinnick] [Simon_Chinnick] -# Manager -wsicopy 3378/tcp # WSICOPY [James_Overby] [James_Overby] -wsicopy 3378/udp # WSICOPY [James_Overby] [James_Overby] -socorfs 3379/tcp # SOCORFS [Hugo_Charbonneau] [Hugo_Charbonneau] -socorfs 3379/udp # SOCORFS [Hugo_Charbonneau] [Hugo_Charbonneau] -sns-channels 3380/tcp # SNS Channels [Shekar_Pasumarthi] [Shekar_Pasumarthi] -sns-channels 3380/udp # SNS Channels [Shekar_Pasumarthi] [Shekar_Pasumarthi] -geneous 3381/tcp # Geneous [Nick_de_Smith] [Nick_de_Smith] -geneous 3381/udp # Geneous [Nick_de_Smith] [Nick_de_Smith] -fujitsu-neat 3382/tcp # Fujitsu Network Enhanced [Markku_Viima] [Markku_Viima] -# Antitheft function -fujitsu-neat 3382/udp # Fujitsu Network Enhanced [Markku_Viima] [Markku_Viima] -# Antitheft function -esp-lm 3383/tcp # Enterprise Software Products [George_Rudy] [George_Rudy] -# License Manager -esp-lm 3383/udp # Enterprise Software Products [George_Rudy] [George_Rudy] -# License Manager -hp-clic 3384/tcp # Cluster Management Services [Rajesh_Srinivasaragh] [Rajesh_Srinivasaragh] -hp-clic 3384/udp # Hardware Management [Rajesh_Srinivasaragh] [Rajesh_Srinivasaragh] -qnxnetman 3385/tcp # qnxnetman [Michael_Hunter] [Michael_Hunter] -qnxnetman 3385/udp # qnxnetman [Michael_Hunter] [Michael_Hunter] -gprs-data 3386/tcp # GPRS Data -gprs-sig 3386/udp # GPRS SIG [Ansgar_Bergmann] [Ansgar_Bergmann] -backroomnet 3387/tcp # Back Room Net [Clayton_Wilkinson] [Clayton_Wilkinson] -backroomnet 3387/udp # Back Room Net [Clayton_Wilkinson] [Clayton_Wilkinson] -cbserver 3388/tcp # CB Server [Allen_Wei] [Allen_Wei] -cbserver 3388/udp # CB Server [Allen_Wei] [Allen_Wei] -ms-wbt-server 3389/tcp # MS WBT Server [Ritu_Bahl] [Ritu_Bahl] -ms-wbt-server 3389/udp # MS WBT Server [Ritu_Bahl] [Ritu_Bahl] -dsc 3390/tcp # Distributed Service [Charles_Honton] [Charles_Honton] -# Coordinator -dsc 3390/udp # Distributed Service [Charles_Honton] [Charles_Honton] -# Coordinator -savant 3391/tcp # SAVANT [Andy_Bruce] [Andy_Bruce] -savant 3391/udp # SAVANT [Andy_Bruce] [Andy_Bruce] -efi-lm 3392/tcp # EFI License Management [Ross_E_Greinke] [Ross_E_Greinke] -efi-lm 3392/udp # EFI License Management [Ross_E_Greinke] [Ross_E_Greinke] -d2k-tapestry1 3393/tcp # D2K Tapestry Client to -# Server -d2k-tapestry1 3393/udp # D2K Tapestry Client to -# Server -d2k-tapestry2 3394/tcp # D2K Tapestry Server to [Eric_Lan] [Eric_Lan] -# Server -d2k-tapestry2 3394/udp # D2K Tapestry Server to [Eric_Lan] [Eric_Lan] -# Server -dyna-lm 3395/tcp # Dyna License Manager (Elam) [Anjana_Iyer] [Anjana_Iyer] -dyna-lm 3395/udp # Dyna License Manager (Elam) [Anjana_Iyer] [Anjana_Iyer] -# Printer Agent -# -printer-agent 3396/tcp # IANA assigned this [Devon_Taylor] [Devon_Taylor] -# well-formed service name as -# a replacement for -# "printer_agent". -# This entry is an alias to "printer-agent". This entry is now -printer_agent 3396/tcp # Printer Agent [Devon_Taylor] [Devon_Taylor] historic, not usable for use with many common service -# discovery mechanisms. -# Printer Agent -# -printer-agent 3396/udp # IANA assigned this [Devon_Taylor] [Devon_Taylor] -# well-formed service name as -# a replacement for -# "printer_agent". -# This entry is an alias to "printer-agent". This entry is now -printer_agent 3396/udp # Printer Agent [Devon_Taylor] [Devon_Taylor] historic, not usable for use with many common service -# discovery mechanisms. -cloanto-lm 3397/tcp # Cloanto License Manager [Takeo_Sato] [Takeo_Sato] 2010-04-30 -cloanto-lm 3397/udp # Cloanto License Manager [Takeo_Sato] [Takeo_Sato] 2010-04-30 -mercantile 3398/tcp # Mercantile [Erik_Kragh_Jensen] [Erik_Kragh_Jensen] -mercantile 3398/udp # Mercantile [Erik_Kragh_Jensen] [Erik_Kragh_Jensen] -csms 3399/tcp # CSMS -csms 3399/udp # CSMS -csms2 3400/tcp # CSMS2 [Markus_Michels_2] [Markus_Michels_2] -csms2 3400/udp # CSMS2 [Markus_Michels_2] [Markus_Michels_2] -filecast 3401/tcp # filecast [Eden_Sherry] [Eden_Sherry] -filecast 3401/udp # filecast [Eden_Sherry] [Eden_Sherry] -fxaengine-net 3402/tcp # FXa Engine Network Port [Lucas_Alonso] [Lucas_Alonso] 2002-02 -fxaengine-net 3402/udp # FXa Engine Network Port [Lucas_Alonso] [Lucas_Alonso] 2002-02 -# 3403 De-registered 2006-10-27 -# 3404 Removed 2002-05-01 -nokia-ann-ch1 3405/tcp # Nokia Announcement ch 1 -nokia-ann-ch1 3405/udp # Nokia Announcement ch 1 -nokia-ann-ch2 3406/tcp # Nokia Announcement ch 2 [Morteza_Kalhour] [Morteza_Kalhour] 2002-02 -nokia-ann-ch2 3406/udp # Nokia Announcement ch 2 [Morteza_Kalhour] [Morteza_Kalhour] 2002-02 -ldap-admin 3407/tcp # LDAP admin server port [Stephen_Tsun_2] [Stephen_Tsun_2] 2002-02 -ldap-admin 3407/udp # LDAP admin server port [Stephen_Tsun_2] [Stephen_Tsun_2] 2002-02 -BESApi 3408/tcp # BES Api Port [Colin_Griffiths] [Colin_Griffiths] 2002-02 -BESApi 3408/udp # BES Api Port [Colin_Griffiths] [Colin_Griffiths] 2002-02 -networklens 3409/tcp # NetworkLens Event Port -networklens 3409/udp # NetworkLens Event Port -networklenss 3410/tcp # NetworkLens SSL Event [Greg_Bailey] [Greg_Bailey] 2002-02 -networklenss 3410/udp # NetworkLens SSL Event [Greg_Bailey] [Greg_Bailey] 2002-02 -biolink-auth 3411/tcp # BioLink Authenteon server [BioLink_Support] [BioLink_Support] 2002-02 -biolink-auth 3411/udp # BioLink Authenteon server [BioLink_Support] [BioLink_Support] 2002-02 -xmlblaster 3412/tcp # xmlBlaster [Marcel_Ruff] [Marcel_Ruff] 2002-02 -xmlblaster 3412/udp # xmlBlaster [Marcel_Ruff] [Marcel_Ruff] 2002-02 -svnet 3413/tcp # SpecView Networking [Richard_Dickins] [Richard_Dickins] 2002-02 -svnet 3413/udp # SpecView Networking [Richard_Dickins] [Richard_Dickins] 2002-02 -wip-port 3414/tcp # BroadCloud WIP Port -wip-port 3414/udp # BroadCloud WIP Port -bcinameservice 3415/tcp # BCI Name Service [Dennis_Parker] [Dennis_Parker] 2002-02 -bcinameservice 3415/udp # BCI Name Service [Dennis_Parker] [Dennis_Parker] 2002-02 -commandport 3416/tcp # AirMobile IS Command Port [Mike_Klein] [Mike_Klein] 2002-02 -commandport 3416/udp # AirMobile IS Command Port [Mike_Klein] [Mike_Klein] 2002-02 -csvr 3417/tcp # ConServR file translation [Albert_Leung] [Albert_Leung] 2002-02 -csvr 3417/udp # ConServR file translation [Albert_Leung] [Albert_Leung] 2002-02 -rnmap 3418/tcp # Remote nmap [Tuomo_Makinen] [Tuomo_Makinen] 2002-02 -rnmap 3418/udp # Remote nmap [Tuomo_Makinen] [Tuomo_Makinen] 2002-02 -softaudit 3419/tcp # Isogon SoftAudit [Per_Hellberg] [Per_Hellberg] 2002-02 -softaudit 3419/udp # ISogon SoftAudit [Per_Hellberg] [Per_Hellberg] 2002-02 -ifcp-port 3420/tcp # iFCP User Port [RFC4172] -ifcp-port 3420/udp # iFCP User Port [RFC4172] -bmap 3421/tcp # Bull Apprise portmapper [Jeremy_Gilbert] [Jeremy_Gilbert] -bmap 3421/udp # Bull Apprise portmapper [Jeremy_Gilbert] [Jeremy_Gilbert] -rusb-sys-port 3422/tcp # Remote USB System Port [Steven_Klein] [Steven_Klein] 2002-02 -rusb-sys-port 3422/udp # Remote USB System Port [Steven_Klein] [Steven_Klein] 2002-02 -xtrm 3423/tcp # xTrade Reliable Messaging -xtrm 3423/udp # xTrade Reliable Messaging -xtrms 3424/tcp # xTrade over TLS/SSL [Mats_Nilsson] [Mats_Nilsson] 2002-02 -xtrms 3424/udp # xTrade over TLS/SSL [Mats_Nilsson] [Mats_Nilsson] 2002-02 -agps-port 3425/tcp # AGPS Access Port [Kristoffer_Nilsson] [Kristoffer_Nilsson] 2002-02 -agps-port 3425/udp # AGPS Access Port [Kristoffer_Nilsson] [Kristoffer_Nilsson] 2002-02 -arkivio 3426/tcp # Arkivio Storage Protocol [Bruce_Greenblatt] [Bruce_Greenblatt] 2002-02 -arkivio 3426/udp # Arkivio Storage Protocol [Bruce_Greenblatt] [Bruce_Greenblatt] 2002-02 -websphere-snmp 3427/tcp # WebSphere SNMP [Richard_Mills] [Richard_Mills] 2002-02 -websphere-snmp 3427/udp # WebSphere SNMP [Richard_Mills] [Richard_Mills] 2002-02 -twcss 3428/tcp # 2Wire CSS [Wire_IANA_Contact] [Wire_IANA_Contact] 2002-02 -twcss 3428/udp # 2Wire CSS [Wire_IANA_Contact] [Wire_IANA_Contact] 2002-02 -gcsp 3429/tcp # GCSP user port [Anirban_Majumder] [Anirban_Majumder] 2002-03 -gcsp 3429/udp # GCSP user port [Anirban_Majumder] [Anirban_Majumder] 2002-03 -ssdispatch 3430/tcp # Scott Studios Dispatch [Michael_Settles] [Michael_Settles] 2002-03 -ssdispatch 3430/udp # Scott Studios Dispatch [Michael_Settles] [Michael_Settles] 2002-03 -ndl-als 3431/tcp # Active License Server Port [Quentin_Brown] [Quentin_Brown] 2002-03 -ndl-als 3431/udp # Active License Server Port [Quentin_Brown] [Quentin_Brown] 2002-03 -osdcp 3432/tcp # Secure Device Protocol [Peter_Fernandez] [Peter_Fernandez] 2002-03 -osdcp 3432/udp # Secure Device Protocol [Peter_Fernandez] [Peter_Fernandez] 2002-03 -opnet-smp 3433/tcp # OPNET Service Management [OPNET_Technologies_Inc] [Edward_Macomber] 2002-03 2011-09-21 -# Platform -opnet-smp 3433/udp # OPNET Service Management [OPNET_Technologies_Inc] [Edward_Macomber] 2002-03 2011-09-21 -# Platform -opencm 3434/tcp # OpenCM Server [Jonathan_S_Shapiro] [Jonathan_S_Shapiro] 2002-03 -opencm 3434/udp # OpenCM Server [Jonathan_S_Shapiro] [Jonathan_S_Shapiro] 2002-03 -pacom 3435/tcp # Pacom Security User Port [Steve_Barton] [Steve_Barton] 2002-03 -pacom 3435/udp # Pacom Security User Port [Steve_Barton] [Steve_Barton] 2002-03 -gc-config 3436/tcp # GuardControl Exchange [Andreas_Schwarz] [Andreas_Schwarz] 2002-03 -# Protocol -gc-config 3436/udp # GuardControl Exchange [Andreas_Schwarz] [Andreas_Schwarz] 2002-03 -# Protocol -autocueds 3437/tcp # Autocue Directory Service [Geoff_Back] [Geoff_Back] 2002-03 -autocueds 3437/udp # Autocue Directory Service [Geoff_Back] [Geoff_Back] 2002-03 -spiral-admin 3438/tcp # Spiralcraft Admin [Michael_Toth] [Michael_Toth] 2002-03 -spiral-admin 3438/udp # Spiralcraft Admin [Michael_Toth] [Michael_Toth] 2002-03 -hri-port 3439/tcp # HRI Interface Port [John_Fayos] [John_Fayos] 2002-03 -hri-port 3439/udp # HRI Interface Port [John_Fayos] [John_Fayos] 2002-03 -ans-console 3440/tcp # Net Steward Mgmt Console [John_Richmond] [John_Richmond] 2002-03 -ans-console 3440/udp # Net Steward Mgmt Console [John_Richmond] [John_Richmond] 2002-03 -connect-client 3441/tcp # OC Connect Client -connect-client 3441/udp # OC Connect Client -connect-server 3442/tcp # OC Connect Server [Mike_Velten_2] [Mike_Velten_2] 2002-03 -connect-server 3442/udp # OC Connect Server [Mike_Velten_2] [Mike_Velten_2] 2002-03 -ov-nnm-websrv 3443/tcp # OpenView Network Node [Anthony_Walker] [Anthony_Walker] 2002-03 -# Manager WEB Server -ov-nnm-websrv 3443/udp # OpenView Network Node [Anthony_Walker] [Anthony_Walker] 2002-03 -# Manager WEB Server -denali-server 3444/tcp # Denali Server [Joe_Devlin] [Joe_Devlin] 2002-03 -denali-server 3444/udp # Denali Server [Joe_Devlin] [Joe_Devlin] 2002-03 -monp 3445/tcp # Media Object Network [Ron_Herardian] [Ron_Herardian] 2002-03 -monp 3445/udp # Media Object Network [Ron_Herardian] [Ron_Herardian] 2002-03 -3comfaxrpc 3446/tcp # 3Com FAX RPC port [Christopher_Wells_2] [Christopher_Wells_2] 2002-04 -3comfaxrpc 3446/udp # 3Com FAX RPC port [Christopher_Wells_2] [Christopher_Wells_2] 2002-04 -directnet 3447/tcp # DirectNet IM System [Gregory_Richards] [Gregory_Richards] 2002-04 -directnet 3447/udp # DirectNet IM System [Gregory_Richards] [Gregory_Richards] 2002-04 -dnc-port 3448/tcp # Discovery and Net Config [Chi_Chen] [Chi_Chen] 2002-04 -dnc-port 3448/udp # Discovery and Net Config [Chi_Chen] [Chi_Chen] 2002-04 -hotu-chat 3449/tcp # HotU Chat [Tim_Burgess] [Tim_Burgess] 2002-04 -hotu-chat 3449/udp # HotU Chat [Tim_Burgess] [Tim_Burgess] 2002-04 -castorproxy 3450/tcp # CAStorProxy [Raymond_J_Young] [Raymond_J_Young] 2002-04 -castorproxy 3450/udp # CAStorProxy [Raymond_J_Young] [Raymond_J_Young] 2002-04 -asam 3451/tcp # ASAM Services [Mike_Gossett] [Mike_Gossett] 2002-04 -asam 3451/udp # ASAM Services [Mike_Gossett] [Mike_Gossett] 2002-04 -sabp-signal 3452/tcp # SABP-Signalling Protocol [Brendan_McWilliams] [Brendan_McWilliams] 2002-04 -sabp-signal 3452/udp # SABP-Signalling Protocol [Brendan_McWilliams] [Brendan_McWilliams] 2002-04 -pscupd 3453/tcp # PSC Update [Datalogic_ADC_Inc] [Reid_B_Ligon] 2001-11-10 2014-07-31 -pscupd 3453/udp # PSC Update [Datalogic_ADC_Inc] [Reid_B_Ligon] 2001-11-10 2014-07-31 -mira 3454/tcp # Apple Remote Access Protocol [Mike_Alexander] [Mike_Alexander] -mira 3454/udp # Apple Remote Access Protocol [Mike_Alexander] [Mike_Alexander] -prsvp 3455/tcp # RSVP Port [Bob_Braden] [Bob_Braden] -prsvp 3455/udp # RSVP Port [Bob_Braden] [Bob_Braden] -vat 3456/tcp # VAT default data [Van_Jacobson] [Van_Jacobson] -vat 3456/udp # VAT default data [Van_Jacobson] [Van_Jacobson] -vat-control 3457/tcp # VAT default control [Van_Jacobson] [Van_Jacobson] -vat-control 3457/udp # VAT default control [Van_Jacobson] [Van_Jacobson] -d3winosfi 3458/tcp # D3WinOSFI [Brad_Hamilton] [Brad_Hamilton] -d3winosfi 3458/udp # D3WinOSFI [Brad_Hamilton] [Brad_Hamilton] -integral 3459/tcp # TIP Integral [Olivier_Mascia] [Olivier_Mascia] -integral 3459/udp # TIP Integral [Olivier_Mascia] [Olivier_Mascia] -edm-manager 3460/tcp # EDM Manger -edm-manager 3460/udp # EDM Manger -edm-stager 3461/tcp # EDM Stager -edm-stager 3461/udp # EDM Stager -edm-std-notify 3462/tcp # EDM STD Notify -edm-std-notify 3462/udp # EDM STD Notify -edm-adm-notify 3463/tcp # EDM ADM Notify -edm-adm-notify 3463/udp # EDM ADM Notify -edm-mgr-sync 3464/tcp # EDM MGR Sync -edm-mgr-sync 3464/udp # EDM MGR Sync -edm-mgr-cntrl 3465/tcp # EDM MGR Cntrl [Tom_Hennessy] [Tom_Hennessy] -edm-mgr-cntrl 3465/udp # EDM MGR Cntrl [Tom_Hennessy] [Tom_Hennessy] -workflow 3466/tcp # WORKFLOW [Robert_Hufsky] [Robert_Hufsky] -workflow 3466/udp # WORKFLOW [Robert_Hufsky] [Robert_Hufsky] -rcst 3467/tcp # RCST [Kit_Sturgeon] [Kit_Sturgeon] -rcst 3467/udp # RCST [Kit_Sturgeon] [Kit_Sturgeon] -ttcmremotectrl 3468/tcp # TTCM Remote Controll [Yossi_Cohen_Shahar] [Yossi_Cohen_Shahar] -ttcmremotectrl 3468/udp # TTCM Remote Controll [Yossi_Cohen_Shahar] [Yossi_Cohen_Shahar] -pluribus 3469/tcp # Pluribus [Mark_Miller] [Mark_Miller] -pluribus 3469/udp # Pluribus [Mark_Miller] [Mark_Miller] -jt400 3470/tcp # jt400 -jt400 3470/udp # jt400 -jt400-ssl 3471/tcp # jt400-ssl [Clifton_Nock] [Clifton_Nock] -jt400-ssl 3471/udp # jt400-ssl [Clifton_Nock] [Clifton_Nock] -jaugsremotec-1 3472/tcp # JAUGS N-G Remotec 1 -jaugsremotec-1 3472/udp # JAUGS N-G Remotec 1 -jaugsremotec-2 3473/tcp # JAUGS N-G Remotec 2 [Steven_B_Cliff] [Steven_B_Cliff] 2002-04 -jaugsremotec-2 3473/udp # JAUGS N-G Remotec 2 [Steven_B_Cliff] [Steven_B_Cliff] 2002-04 -ttntspauto 3474/tcp # TSP Automation [Arnie_Koster] [Arnie_Koster] 2002-04 -ttntspauto 3474/udp # TSP Automation [Arnie_Koster] [Arnie_Koster] 2002-04 -genisar-port 3475/tcp # Genisar Comm Port [Candace_Niccolson] [Candace_Niccolson] 2002-04 -genisar-port 3475/udp # Genisar Comm Port [Candace_Niccolson] [Candace_Niccolson] 2002-04 -nppmp 3476/tcp # NVIDIA Mgmt Protocol [Gilbert_Yeung] [Gilbert_Yeung] 2002-04 -nppmp 3476/udp # NVIDIA Mgmt Protocol [Gilbert_Yeung] [Gilbert_Yeung] 2002-04 -ecomm 3477/tcp # eComm link port [Thomas_Soerensen] [Thomas_Soerensen] 2002-04 -ecomm 3477/udp # eComm link port [Thomas_Soerensen] [Thomas_Soerensen] 2002-04 -stun 3478/tcp # Session Traversal Utilities [RFC5389] -# for NAT (STUN) port -stun 3478/udp # Session Traversal Utilities [RFC5389] -# for NAT (STUN) port -turn 3478/tcp # TURN over TCP [RFC5766] -turn 3478/udp # TURN over UDP [RFC5766] -stun-behavior 3478/tcp # STUN Behavior Discovery over [RFC5780] -# TCP -stun-behavior 3478/udp # STUN Behavior Discovery over [RFC5780] -# UDP -twrpc 3479/tcp # 2Wire RPC [Wire_IANA_Contact] [Wire_IANA_Contact] 2002-04 -twrpc 3479/udp # 2Wire RPC [Wire_IANA_Contact] [Wire_IANA_Contact] 2002-04 -plethora 3480/tcp # Secure Virtual Workspace [Tim_Simms] [Tim_Simms] 2002-04 -plethora 3480/udp # Secure Virtual Workspace [Tim_Simms] [Tim_Simms] 2002-04 -cleanerliverc 3481/tcp # CleanerLive remote ctrl [David_Mojdehi] [David_Mojdehi] 2002-04 -cleanerliverc 3481/udp # CleanerLive remote ctrl [David_Mojdehi] [David_Mojdehi] 2002-04 -vulture 3482/tcp # Vulture Monitoring System [Jason_Santos] [Jason_Santos] 2002-04 -vulture 3482/udp # Vulture Monitoring System [Jason_Santos] [Jason_Santos] 2002-04 -slim-devices 3483/tcp # Slim Devices Protocol [Sean_Adams] [Sean_Adams] 2002-05 -slim-devices 3483/udp # Slim Devices Protocol [Sean_Adams] [Sean_Adams] 2002-05 -gbs-stp 3484/tcp # GBS SnapTalk Protocol [Eric_Harris_Braun] [Eric_Harris_Braun] 2002-05 -gbs-stp 3484/udp # GBS SnapTalk Protocol [Eric_Harris_Braun] [Eric_Harris_Braun] 2002-05 -celatalk 3485/tcp # CelaTalk [Carl_Blundell] [Carl_Blundell] 2002-05 -celatalk 3485/udp # CelaTalk [Carl_Blundell] [Carl_Blundell] 2002-05 -ifsf-hb-port 3486/tcp # IFSF Heartbeat Port [IFSF_Secretary] [IFSF_Secretary] 2002-05 -ifsf-hb-port 3486/udp # IFSF Heartbeat Port [IFSF_Secretary] [IFSF_Secretary] 2002-05 -ltctcp 3487/tcp # LISA TCP Transfer Channel -ltcudp 3487/udp # LISA UDP Transfer Channel [Pit_Vetterick] [Pit_Vetterick] 2002-05 -fs-rh-srv 3488/tcp # FS Remote Host Server [Brian_Nickles] [Brian_Nickles] 2002-05 -fs-rh-srv 3488/udp # FS Remote Host Server [Brian_Nickles] [Brian_Nickles] 2002-05 -dtp-dia 3489/tcp # DTP/DIA [Alexei_V_Soloviev] [Alexei_V_Soloviev] 2002-05 -dtp-dia 3489/udp # DTP/DIA [Alexei_V_Soloviev] [Alexei_V_Soloviev] 2002-05 -colubris 3490/tcp # Colubris Management Port [Gilbert_Moineau] [Gilbert_Moineau] 2002-05 -colubris 3490/udp # Colubris Management Port [Gilbert_Moineau] [Gilbert_Moineau] 2002-05 -swr-port 3491/tcp # SWR Port [Ian_Manning] [Ian_Manning] 2002-05 -swr-port 3491/udp # SWR Port [Ian_Manning] [Ian_Manning] 2002-05 -tvdumtray-port 3492/tcp # TVDUM Tray Port [Peter_Boers] [Peter_Boers] 2002-05 -tvdumtray-port 3492/udp # TVDUM Tray Port [Peter_Boers] [Peter_Boers] 2002-05 -nut 3493/tcp # Network UPS Tools [Russell_Kroll] [Russell_Kroll] 2002-05 -nut 3493/udp # Network UPS Tools [Russell_Kroll] [Russell_Kroll] 2002-05 -ibm3494 3494/tcp # IBM 3494 [Jeffrey_Pilch] [Jeffrey_Pilch] -ibm3494 3494/udp # IBM 3494 [Jeffrey_Pilch] [Jeffrey_Pilch] -seclayer-tcp 3495/tcp # securitylayer over tcp -seclayer-tcp 3495/udp # securitylayer over tcp -seclayer-tls 3496/tcp # securitylayer over tls [Arno_Hollosi] [Arno_Hollosi] 2002-03 -seclayer-tls 3496/udp # securitylayer over tls [Arno_Hollosi] [Arno_Hollosi] 2002-03 -ipether232port 3497/tcp # ipEther232Port [Marcus_Leufgen] [Marcus_Leufgen] 2002-05 -ipether232port 3497/udp # ipEther232Port [Marcus_Leufgen] [Marcus_Leufgen] 2002-05 -dashpas-port 3498/tcp # DASHPAS user port [Albrecht_Mayer] [Albrecht_Mayer] 2002-05 -dashpas-port 3498/udp # DASHPAS user port [Albrecht_Mayer] [Albrecht_Mayer] 2002-05 -sccip-media 3499/tcp # SccIP Media [David_Yon_2] [David_Yon_2] 2002-05 -sccip-media 3499/udp # SccIP Media [David_Yon_2] [David_Yon_2] 2002-05 -rtmp-port 3500/tcp # RTMP Port [Miriam_Wohlgelernter] [Miriam_Wohlgelernter] -rtmp-port 3500/udp # RTMP Port [Miriam_Wohlgelernter] [Miriam_Wohlgelernter] -isoft-p2p 3501/tcp # iSoft-P2P [David_Walling_2] [David_Walling_2] -isoft-p2p 3501/udp # iSoft-P2P [David_Walling_2] [David_Walling_2] -avinstalldisc 3502/tcp # Avocent Install Discovery [Brian_S_Stewart_2] [Brian_S_Stewart_2] -avinstalldisc 3502/udp # Avocent Install Discovery [Brian_S_Stewart_2] [Brian_S_Stewart_2] -lsp-ping 3503/tcp # MPLS LSP-echo Port [RFC4379] -lsp-ping 3503/udp # MPLS LSP-echo Port [RFC4379] -ironstorm 3504/tcp # IronStorm game server [Arnaud_Clermonte] [Arnaud_Clermonte] -ironstorm 3504/udp # IronStorm game server [Arnaud_Clermonte] [Arnaud_Clermonte] -ccmcomm 3505/tcp # CCM communications port [Tom_Bougan] [Tom_Bougan] -ccmcomm 3505/udp # CCM communications port [Tom_Bougan] [Tom_Bougan] -apc-3506 3506/tcp # APC 3506 [American_Power_Conve] [American_Power_Conve] -apc-3506 3506/udp # APC 3506 [American_Power_Conve] [American_Power_Conve] -nesh-broker 3507/tcp # Nesh Broker Port [Jeremy_Maiden] [Jeremy_Maiden] -nesh-broker 3507/udp # Nesh Broker Port [Jeremy_Maiden] [Jeremy_Maiden] -interactionweb 3508/tcp # Interaction Web [Mike_Gagle_2] [Mike_Gagle_2] -interactionweb 3508/udp # Interaction Web [Mike_Gagle_2] [Mike_Gagle_2] -vt-ssl 3509/tcp # Virtual Token SSL Port [Libor_Sykora] [Libor_Sykora] 2002-05 -vt-ssl 3509/udp # Virtual Token SSL Port [Libor_Sykora] [Libor_Sykora] 2002-05 -xss-port 3510/tcp # XSS Port [Joe_Purcell] [Joe_Purcell] 2002-05 -xss-port 3510/udp # XSS Port [Joe_Purcell] [Joe_Purcell] 2002-05 -webmail-2 3511/tcp # WebMail/2 [Dimitris_Michelinaki] [Dimitris_Michelinaki] 2002-05 -webmail-2 3511/udp # WebMail/2 [Dimitris_Michelinaki] [Dimitris_Michelinaki] 2002-05 -aztec 3512/tcp # Aztec Distribution Port [Alan_Francis] [Alan_Francis] 2002-05 -aztec 3512/udp # Aztec Distribution Port [Alan_Francis] [Alan_Francis] 2002-05 -arcpd 3513/tcp # Adaptec Remote Protocol [Hardy_Doelfel] [Hardy_Doelfel] 2002-05 -arcpd 3513/udp # Adaptec Remote Protocol [Hardy_Doelfel] [Hardy_Doelfel] 2002-05 -must-p2p 3514/tcp # MUST Peer to Peer -must-p2p 3514/udp # MUST Peer to Peer -must-backplane 3515/tcp # MUST Backplane [Rick_Stefanik] [Rick_Stefanik] 2002-05 -must-backplane 3515/udp # MUST Backplane [Rick_Stefanik] [Rick_Stefanik] 2002-05 -smartcard-port 3516/tcp # Smartcard Port [Scott_Guthery] [Scott_Guthery] 2002-05 -smartcard-port 3516/udp # Smartcard Port [Scott_Guthery] [Scott_Guthery] 2002-05 -802-11-iapp 3517/tcp # IEEE 802.11 WLANs WG IAPP [Stuart_J_Kerry] [Stuart_J_Kerry] 2002-05 -802-11-iapp 3517/udp # IEEE 802.11 WLANs WG IAPP [Stuart_J_Kerry] [Stuart_J_Kerry] 2002-05 -artifact-msg 3518/tcp # Artifact Message Server [Ron_Capwell] [Ron_Capwell] 2002-06 -artifact-msg 3518/udp # Artifact Message Server [Ron_Capwell] [Ron_Capwell] 2002-06 -nvmsgd 3519/tcp # Netvion Messenger Port -galileo 3519/udp # Netvion Galileo Port -galileolog 3520/tcp # Netvion Galileo Log Port [Ray_Caruso] [Ray_Caruso] 2002-06 -galileolog 3520/udp # Netvion Galileo Log Port [Ray_Caruso] [Ray_Caruso] 2002-06 -mc3ss 3521/tcp # Telequip Labs MC3SS [Michael_Sparks] [Michael_Sparks] 2002-06 -mc3ss 3521/udp # Telequip Labs MC3SS [Michael_Sparks] [Michael_Sparks] 2002-06 -# NFS service for the domain -# nfs-domainroot tcp root, the root of an [IESG] [IETF_Chair] 2012-04-24 [RFC6641] Defined TXT keys: None -# organization's published -# file namespace. -nssocketport 3522/tcp # DO over NSSocketPort [Douglas_Davidson] [Douglas_Davidson] 2002-06 -nssocketport 3522/udp # DO over NSSocketPort [Douglas_Davidson] [Douglas_Davidson] 2002-06 -odeumservlink 3523/tcp # Odeum Serverlink [Mads_Peter_Back] [Mads_Peter_Back] 2002-06 -odeumservlink 3523/udp # Odeum Serverlink [Mads_Peter_Back] [Mads_Peter_Back] 2002-06 -ecmport 3524/tcp # ECM Server port -ecmport 3524/udp # ECM Server port -eisport 3525/tcp # EIS Server port [Paul_Kraus] [Paul_Kraus] 2002-06 -eisport 3525/udp # EIS Server port [Paul_Kraus] [Paul_Kraus] 2002-06 -starquiz-port 3526/tcp # starQuiz Port [Adam_Ernst_2] [Adam_Ernst_2] 2002-06 -starquiz-port 3526/udp # starQuiz Port [Adam_Ernst_2] [Adam_Ernst_2] 2002-06 -beserver-msg-q 3527/tcp # VERITAS Backup Exec Server [Katherine_Wattwood] [Katherine_Wattwood] 2002-06 -beserver-msg-q 3527/udp # VERITAS Backup Exec Server [Katherine_Wattwood] [Katherine_Wattwood] 2002-06 -jboss-iiop 3528/tcp # JBoss IIOP -jboss-iiop 3528/udp # JBoss IIOP -jboss-iiop-ssl 3529/tcp # JBoss IIOP/SSL [Francisco_Reverbel] [Francisco_Reverbel] 2002-06 -jboss-iiop-ssl 3529/udp # JBoss IIOP/SSL [Francisco_Reverbel] [Francisco_Reverbel] 2002-06 -gf 3530/tcp # Grid Friendly [Daivd_P_Chassin] [Daivd_P_Chassin] 2002-06 -gf 3530/udp # Grid Friendly [Daivd_P_Chassin] [Daivd_P_Chassin] 2002-06 -joltid 3531/tcp # Joltid [Ahti_Heinla] [Ahti_Heinla] 2002-06 -joltid 3531/udp # Joltid [Ahti_Heinla] [Ahti_Heinla] 2002-06 -raven-rmp 3532/tcp # Raven Remote Management -# Control -raven-rmp 3532/udp # Raven Remote Management -# Control -raven-rdp 3533/tcp # Raven Remote Management Data [Daniel_Sorlov_2] [Daniel_Sorlov_2] 2002-06 -raven-rdp 3533/udp # Raven Remote Management Data [Daniel_Sorlov_2] [Daniel_Sorlov_2] 2002-06 -urld-port 3534/tcp # URL Daemon Port [Jim_Binkley] [Jim_Binkley] 2002-06 -urld-port 3534/udp # URL Daemon Port [Jim_Binkley] [Jim_Binkley] 2002-06 -ms-la 3535/tcp # MS-LA [Eric_Ledoux] [Eric_Ledoux] -ms-la 3535/udp # MS-LA [Eric_Ledoux] [Eric_Ledoux] -snac 3536/tcp # SNAC [Tatsuya_Igarashi] [Tatsuya_Igarashi] 2002-07 -snac 3536/udp # SNAC [Tatsuya_Igarashi] [Tatsuya_Igarashi] 2002-07 -ni-visa-remote 3537/tcp # Remote NI-VISA port [Sinnadurai_Dharshan] [Sinnadurai_Dharshan] 2002-07 -ni-visa-remote 3537/udp # Remote NI-VISA port [Sinnadurai_Dharshan] [Sinnadurai_Dharshan] 2002-07 -ibm-diradm 3538/tcp # IBM Directory Server -ibm-diradm 3538/udp # IBM Directory Server -ibm-diradm-ssl 3539/tcp # IBM Directory Server SSL [Mark_Cavage] [Mark_Cavage] 2002-07 -ibm-diradm-ssl 3539/udp # IBM Directory Server SSL [Mark_Cavage] [Mark_Cavage] 2002-07 -pnrp-port 3540/tcp # PNRP User Port [Igor_Kostic] [Igor_Kostic] 2002-07 -pnrp-port 3540/udp # PNRP User Port [Igor_Kostic] [Igor_Kostic] 2002-07 -voispeed-port 3541/tcp # VoiSpeed Port [Virgilio_Lattanzi] [Virgilio_Lattanzi] 2002-07 -voispeed-port 3541/udp # VoiSpeed Port [Virgilio_Lattanzi] [Virgilio_Lattanzi] 2002-07 -hacl-monitor 3542/tcp # HA cluster monitor [Jason_Ko] [Jason_Ko] 2002-07 -hacl-monitor 3542/udp # HA cluster monitor [Jason_Ko] [Jason_Ko] 2002-07 -qftest-lookup 3543/tcp # qftest Lookup Port [Gregor_Schmid] [Gregor_Schmid] 2002-07 -qftest-lookup 3543/udp # qftest Lookup Port [Gregor_Schmid] [Gregor_Schmid] 2002-07 -teredo 3544/tcp # Teredo Port [RFC4380] -teredo 3544/udp # Teredo Port [RFC4380] -camac 3545/tcp # CAMAC equipment [Eugene_Zhiganov] [Eugene_Zhiganov] 2002-07 -camac 3545/udp # CAMAC equipment [Eugene_Zhiganov] [Eugene_Zhiganov] 2002-07 -# 3546 Unassigned 2002-09 -symantec-sim 3547/tcp # Symantec SIM [George_Dzieciol] [George_Dzieciol] 2002-07 -symantec-sim 3547/udp # Symantec SIM [George_Dzieciol] [George_Dzieciol] 2002-07 -interworld 3548/tcp # Interworld [John_Stephen] [John_Stephen] 2002-07 -interworld 3548/udp # Interworld [John_Stephen] [John_Stephen] 2002-07 -tellumat-nms 3549/tcp # Tellumat MDR NMS [Hennie_van_der_Merwe] [Hennie_van_der_Merwe] 2002-07 -tellumat-nms 3549/udp # Tellumat MDR NMS [Hennie_van_der_Merwe] [Hennie_van_der_Merwe] 2002-07 -ssmpp 3550/tcp # Secure SMPP [Cormac_Long] [Cormac_Long] 2002-07 -ssmpp 3550/udp # Secure SMPP [Cormac_Long] [Cormac_Long] 2002-07 -apcupsd 3551/tcp # Apcupsd Information Port [Riccardo_Facchetti] [Riccardo_Facchetti] 2002-07 -apcupsd 3551/udp # Apcupsd Information Port [Riccardo_Facchetti] [Riccardo_Facchetti] 2002-07 -taserver 3552/tcp # TeamAgenda Server Port [Dany_Ayotte] [Dany_Ayotte] 2002-07 -taserver 3552/udp # TeamAgenda Server Port [Dany_Ayotte] [Dany_Ayotte] 2002-07 -rbr-discovery 3553/tcp # Red Box Recorder ADP [Simon_Jolly] [Simon_Jolly] 2002-07 -rbr-discovery 3553/udp # Red Box Recorder ADP [Simon_Jolly] [Simon_Jolly] 2002-07 -questnotify 3554/tcp # Quest Notification Server [Rob_Griffin] [Rob_Griffin] 2002-07 -questnotify 3554/udp # Quest Notification Server [Rob_Griffin] [Rob_Griffin] 2002-07 -razor 3555/tcp # Vipul's Razor [Vipul_Ved_Prakash] [Vipul_Ved_Prakash] 2002-07 -razor 3555/udp # Vipul's Razor [Vipul_Ved_Prakash] [Vipul_Ved_Prakash] 2002-07 -sky-transport 3556/tcp # Sky Transport Protocol [Michael_Paddon] [Michael_Paddon] 2002-07 -sky-transport 3556/udp # Sky Transport Protocol [Michael_Paddon] [Michael_Paddon] 2002-07 -personalos-001 3557/tcp # PersonalOS Comm Port [Shane_Roberts] [Shane_Roberts] 2002-07 -personalos-001 3557/udp # PersonalOS Comm Port [Shane_Roberts] [Shane_Roberts] 2002-07 -mcp-port 3558/tcp # MCP user port [Professor_Paul_S_Wa] [Professor_Paul_S_Wa] 2002-07 -mcp-port 3558/udp # MCP user port [Professor_Paul_S_Wa] [Professor_Paul_S_Wa] 2002-07 -cctv-port 3559/tcp # CCTV control port [John_Skidmore] [John_Skidmore] 2002-07 -cctv-port 3559/udp # CCTV control port [John_Skidmore] [John_Skidmore] 2002-07 -iniserve-port 3560/tcp # INIServe port [Peter_Moylan] [Peter_Moylan] 2002-08 -iniserve-port 3560/udp # INIServe port [Peter_Moylan] [Peter_Moylan] 2002-08 -bmc-onekey 3561/tcp # BMC-OneKey [Portnoy_Boxman] [Portnoy_Boxman] 2002-08 -bmc-onekey 3561/udp # BMC-OneKey [Portnoy_Boxman] [Portnoy_Boxman] 2002-08 -sdbproxy 3562/tcp # SDBProxy [Eric_Grange] [Eric_Grange] 2002-08 -sdbproxy 3562/udp # SDBProxy [Eric_Grange] [Eric_Grange] 2002-08 -watcomdebug 3563/tcp # Watcom Debug [Dave_Neudoerffer] [Dave_Neudoerffer] -watcomdebug 3563/udp # Watcom Debug [Dave_Neudoerffer] [Dave_Neudoerffer] -esimport 3564/tcp # Electromed SIM port [Francois_Marchand] [Francois_Marchand] 2002-08 -esimport 3564/udp # Electromed SIM port [Francois_Marchand] [Francois_Marchand] 2002-08 -m2pa 3565/tcp # M2PA [RFC4165] -# 3565 udp Reserved -m2pa 3565/sctp # M2PA [RFC4165] -quest-data-hub 3566/tcp # Quest Data Hub [Greg_Cottman_2] [Greg_Cottman_2] 2010-10-18 -# 3566 udp Reserved 2010-10-18 -dof-eps 3567/tcp # DOF Protocol Stack [OpenDOF] [Bryant_Eastham] 2002-08 2015-04-23 -dof-eps 3567/udp # DOF Protocol Stack [OpenDOF] [Bryant_Eastham] 2002-08 2015-04-23 -dof-tunnel-sec 3568/tcp # DOF Secure Tunnel [OpenDOF] [Bryant_Eastham] 2003-01 2015-04-23 -dof-tunnel-sec 3568/udp # DOF Secure Tunnel [OpenDOF] [Bryant_Eastham] 2003-01 2015-04-23 -mbg-ctrl 3569/tcp # Meinberg Control Service [Martin_Burnicki] [Martin_Burnicki] 2002-08 -mbg-ctrl 3569/udp # Meinberg Control Service [Martin_Burnicki] [Martin_Burnicki] 2002-08 -mccwebsvr-port 3570/tcp # MCC Web Server Port -mccwebsvr-port 3570/udp # MCC Web Server Port -megardsvr-port 3571/tcp # MegaRAID Server Port -megardsvr-port 3571/udp # MegaRAID Server Port -megaregsvrport 3572/tcp # Registration Server Port [Sreenivas_Bagalkote] [Sreenivas_Bagalkote] 2002-08 -megaregsvrport 3572/udp # Registration Server Port [Sreenivas_Bagalkote] [Sreenivas_Bagalkote] 2002-08 -tag-ups-1 3573/tcp # Advantage Group UPS Suite [James_Goddard] [James_Goddard] 2002-08 -tag-ups-1 3573/udp # Advantage Group UPS Suite [James_Goddard] [James_Goddard] 2002-08 -dmaf-server 3574/tcp # DMAF Server -dmaf-caster 3574/udp # DMAF Caster [Ramakrishna_Nadendla] [Ramakrishna_Nadendla] 2002-08 -ccm-port 3575/tcp # Coalsere CCM Port -ccm-port 3575/udp # Coalsere CCM Port -cmc-port 3576/tcp # Coalsere CMC Port [Chris_Hawkinson] [Chris_Hawkinson] 2002-08 -cmc-port 3576/udp # Coalsere CMC Port [Chris_Hawkinson] [Chris_Hawkinson] 2002-08 -config-port 3577/tcp # Configuration Port -config-port 3577/udp # Configuration Port -data-port 3578/tcp # Data Port [Anupam_Bharali] [Anupam_Bharali] 2002-08 -data-port 3578/udp # Data Port [Anupam_Bharali] [Anupam_Bharali] 2002-08 -ttat3lb 3579/tcp # Tarantella Load Balancing [Jim_Musgrave] [Jim_Musgrave] 2002-08 -ttat3lb 3579/udp # Tarantella Load Balancing [Jim_Musgrave] [Jim_Musgrave] 2002-08 -nati-svrloc 3580/tcp # NATI-ServiceLocator [Jason_Case] [Jason_Case] 2002-08 -nati-svrloc 3580/udp # NATI-ServiceLocator [Jason_Case] [Jason_Case] 2002-08 -kfxaclicensing 3581/tcp # Ascent Capture Licensing [Brad_Hamilton_2] [Brad_Hamilton_2] 2002-08 -kfxaclicensing 3581/udp # Ascent Capture Licensing [Brad_Hamilton_2] [Brad_Hamilton_2] 2002-08 -press 3582/tcp # PEG PRESS Server [Jim_DeLisle] [Jim_DeLisle] 2002-08 -press 3582/udp # PEG PRESS Server [Jim_DeLisle] [Jim_DeLisle] 2002-08 -canex-watch 3583/tcp # CANEX Watch System [Peter_Kollath] [Peter_Kollath] 2002-08 -canex-watch 3583/udp # CANEX Watch System [Peter_Kollath] [Peter_Kollath] 2002-08 -u-dbap 3584/tcp # U-DBase Access Protocol [Bodo_Rueskamp] [Bodo_Rueskamp] 2002-08 -u-dbap 3584/udp # U-DBase Access Protocol [Bodo_Rueskamp] [Bodo_Rueskamp] 2002-08 -emprise-lls 3585/tcp # Emprise License Server -emprise-lls 3585/udp # Emprise License Server -emprise-lsc 3586/tcp # License Server Console [James_J_Diaz] [James_J_Diaz] 2002-08 -emprise-lsc 3586/udp # License Server Console [James_J_Diaz] [James_J_Diaz] 2002-08 -p2pgroup 3587/tcp # Peer to Peer Grouping [Igor_Kostic] [Igor_Kostic] 2002-08 -p2pgroup 3587/udp # Peer to Peer Grouping [Igor_Kostic] [Igor_Kostic] 2002-08 -sentinel 3588/tcp # Sentinel Server [Ian_Gordon] [Ian_Gordon] 2002-08 -sentinel 3588/udp # Sentinel Server [Ian_Gordon] [Ian_Gordon] 2002-08 -isomair 3589/tcp # isomair [Richard_Fleming] [Richard_Fleming] 2002-08 -isomair 3589/udp # isomair [Richard_Fleming] [Richard_Fleming] 2002-08 -wv-csp-sms 3590/tcp # WV CSP SMS Binding [Matti_Salmi] [Matti_Salmi] 2002-08 -wv-csp-sms 3590/udp # WV CSP SMS Binding [Matti_Salmi] [Matti_Salmi] 2002-08 -gtrack-server 3591/tcp # LOCANIS G-TRACK Server -gtrack-server 3591/udp # LOCANIS G-TRACK Server -gtrack-ne 3592/tcp # LOCANIS G-TRACK NE Port [Juergen_Edelhaeuser] [Juergen_Edelhaeuser] 2002-08 -gtrack-ne 3592/udp # LOCANIS G-TRACK NE Port [Juergen_Edelhaeuser] [Juergen_Edelhaeuser] 2002-08 -bpmd 3593/tcp # BP Model Debugger [Keith_Fligg] [Keith_Fligg] 2002-09 -bpmd 3593/udp # BP Model Debugger [Keith_Fligg] [Keith_Fligg] 2002-09 -mediaspace 3594/tcp # MediaSpace -mediaspace 3594/udp # MediaSpace -shareapp 3595/tcp # ShareApp [Jeff_King] [Jeff_King] 2002-09 -shareapp 3595/udp # ShareApp [Jeff_King] [Jeff_King] 2002-09 -iw-mmogame 3596/tcp # Illusion Wireless MMOG [Jan_Vrsinsky] [Jan_Vrsinsky] 2002-09 -iw-mmogame 3596/udp # Illusion Wireless MMOG [Jan_Vrsinsky] [Jan_Vrsinsky] 2002-09 -a14 3597/tcp # A14 (AN-to-SC/MM) -a14 3597/udp # A14 (AN-to-SC/MM) -a15 3598/tcp # A15 (AN-to-AN) [David_Ott] [David_Ott] 2002-09 -a15 3598/udp # A15 (AN-to-AN) [David_Ott] [David_Ott] 2002-09 -quasar-server 3599/tcp # Quasar Accounting Server [Brad_Pepers] [Brad_Pepers] 2002-09 -quasar-server 3599/udp # Quasar Accounting Server [Brad_Pepers] [Brad_Pepers] 2002-09 -trap-daemon 3600/tcp # text relay-answer [John_Willis] [John_Willis] 2002-09 -trap-daemon 3600/udp # text relay-answer [John_Willis] [John_Willis] 2002-09 -visinet-gui 3601/tcp # Visinet Gui [Jeff_Douglass] [Jeff_Douglass] 2002-09 -visinet-gui 3601/udp # Visinet Gui [Jeff_Douglass] [Jeff_Douglass] 2002-09 -infiniswitchcl 3602/tcp # InfiniSwitch Mgr Client [Lee_VanTine] [Lee_VanTine] 2002-09 -infiniswitchcl 3602/udp # InfiniSwitch Mgr Client [Lee_VanTine] [Lee_VanTine] 2002-09 -int-rcv-cntrl 3603/tcp # Integrated Rcvr Control [Dave_Stone] [Dave_Stone] 2002-09 -int-rcv-cntrl 3603/udp # Integrated Rcvr Control [Dave_Stone] [Dave_Stone] 2002-09 -bmc-jmx-port 3604/tcp # BMC JMX Port [Portnoy_Boxman] [Portnoy_Boxman] 2002-09 -bmc-jmx-port 3604/udp # BMC JMX Port [Portnoy_Boxman] [Portnoy_Boxman] 2002-09 -comcam-io 3605/tcp # ComCam IO Port [Don_Gilbreath] [Don_Gilbreath] 2002-09 -comcam-io 3605/udp # ComCam IO Port [Don_Gilbreath] [Don_Gilbreath] 2002-09 -splitlock 3606/tcp # Splitlock Server [Andrew_Tune] [Andrew_Tune] 2002-09 -splitlock 3606/udp # Splitlock Server [Andrew_Tune] [Andrew_Tune] 2002-09 -precise-i3 3607/tcp # Precise I3 [Tomer_Shain] [Tomer_Shain] 2002-09 -precise-i3 3607/udp # Precise I3 [Tomer_Shain] [Tomer_Shain] 2002-09 -trendchip-dcp 3608/tcp # Trendchip control protocol [Ming_Jen_Chen] [Ming_Jen_Chen] 2002-09 -trendchip-dcp 3608/udp # Trendchip control protocol [Ming_Jen_Chen] [Ming_Jen_Chen] 2002-09 -cpdi-pidas-cm 3609/tcp # CPDI PIDAS Connection Mon [Tony_Splaver] [Tony_Splaver] 2002-09 -cpdi-pidas-cm 3609/udp # CPDI PIDAS Connection Mon [Tony_Splaver] [Tony_Splaver] 2002-09 -echonet 3610/tcp # ECHONET [Takeshi_Saito] [Takeshi_Saito] 2002-09 -echonet 3610/udp # ECHONET [Takeshi_Saito] [Takeshi_Saito] 2002-09 -six-degrees 3611/tcp # Six Degrees Port [Zach_Nies] [Zach_Nies] 2002-09 -six-degrees 3611/udp # Six Degrees Port [Zach_Nies] [Zach_Nies] 2002-09 -hp-dataprotect 3612/tcp # HP Data Protector [Hewlett_Packard_2] [Oliver_Breyel] 2002-09 2013-02-07 -hp-dataprotect 3612/udp # HP Data Protector [Hewlett_Packard_2] [Oliver_Breyel] 2002-09 2013-02-07 -alaris-disc 3613/tcp # Alaris Device Discovery [Chris_Dern] [Chris_Dern] 2004-06 -alaris-disc 3613/udp # Alaris Device Discovery [Chris_Dern] [Chris_Dern] 2004-06 -sigma-port 3614/tcp # Satchwell Sigma [Dave_Chapman] [Dave_Chapman] 2011-06-06 -sigma-port 3614/udp # Satchwell Sigma [Dave_Chapman] [Dave_Chapman] 2011-06-06 -start-network 3615/tcp # Start Messaging Network [Peter_Rocca] [Peter_Rocca] 2002-10 -start-network 3615/udp # Start Messaging Network [Peter_Rocca] [Peter_Rocca] 2002-10 -cd3o-protocol 3616/tcp # cd3o Control Protocol [Chris_Wilcox] [Chris_Wilcox] 2002-10 -cd3o-protocol 3616/udp # cd3o Control Protocol [Chris_Wilcox] [Chris_Wilcox] 2002-10 -sharp-server 3617/tcp # ATI SHARP Logic Engine [Bill_Reveile] [Bill_Reveile] -sharp-server 3617/udp # ATI SHARP Logic Engine [Bill_Reveile] [Bill_Reveile] -aairnet-1 3618/tcp # AAIR-Network 1 -aairnet-1 3618/udp # AAIR-Network 1 -aairnet-2 3619/tcp # AAIR-Network 2 [James_Mealey] [James_Mealey] 2002-10 -aairnet-2 3619/udp # AAIR-Network 2 [James_Mealey] [James_Mealey] 2002-10 -ep-pcp 3620/tcp # EPSON Projector Control Port -ep-pcp 3620/udp # EPSON Projector Control Port -ep-nsp 3621/tcp # EPSON Network Screen Port [SEIKO_EPSON_3] [SEIKO_EPSON_3] 2002-10 -ep-nsp 3621/udp # EPSON Network Screen Port [SEIKO_EPSON_3] [SEIKO_EPSON_3] 2002-10 -ff-lr-port 3622/tcp # FF LAN Redundancy Port [Fieldbus_Foundation] [Fieldbus_Foundation] 2002-10 -ff-lr-port 3622/udp # FF LAN Redundancy Port [Fieldbus_Foundation] [Fieldbus_Foundation] 2002-10 -haipe-discover 3623/tcp # HAIPIS Dynamic Discovery [Mike_Irani] [Mike_Irani] 2002-10 -haipe-discover 3623/udp # HAIPIS Dynamic Discovery [Mike_Irani] [Mike_Irani] 2002-10 -dist-upgrade 3624/tcp # Distributed Upgrade Port [Jason_Schoon] [Jason_Schoon] 2002-10 -dist-upgrade 3624/udp # Distributed Upgrade Port [Jason_Schoon] [Jason_Schoon] 2002-10 -volley 3625/tcp # Volley [David_Catmull] [David_Catmull] 2002-10 -volley 3625/udp # Volley [David_Catmull] [David_Catmull] 2002-10 -bvcdaemon-port 3626/tcp # bvControl Daemon [Ravi_Gokhale] [Ravi_Gokhale] 2002-10 -bvcdaemon-port 3626/udp # bvControl Daemon [Ravi_Gokhale] [Ravi_Gokhale] 2002-10 -jamserverport 3627/tcp # Jam Server Port [Art_Pope] [Art_Pope] 2002-10 -jamserverport 3627/udp # Jam Server Port [Art_Pope] [Art_Pope] 2002-10 -ept-machine 3628/tcp # EPT Machine Interface [Victor_H_Farrace] [Victor_H_Farrace] 2002-10 -ept-machine 3628/udp # EPT Machine Interface [Victor_H_Farrace] [Victor_H_Farrace] 2002-10 -escvpnet 3629/tcp # ESC/VP.net [Hiroyuki_Hashimoto] [Hiroyuki_Hashimoto] 2002-10 -escvpnet 3629/udp # ESC/VP.net [Hiroyuki_Hashimoto] [Hiroyuki_Hashimoto] 2002-10 -cs-remote-db 3630/tcp # C&S Remote Database Port -cs-remote-db 3630/udp # C&S Remote Database Port -cs-services 3631/tcp # C&S Web Services Port [Computer_Software_Gm] [Computer_Software_Gm] 2002-10 -cs-services 3631/udp # C&S Web Services Port [Computer_Software_Gm] [Computer_Software_Gm] 2002-10 -distcc 3632/tcp # distributed compiler [Martin_Pool] [Martin_Pool] 2002-11 Defined TXT keys: None -distcc 3632/udp # distributed compiler [Martin_Pool] [Martin_Pool] 2002-11 Defined TXT keys: None -wacp 3633/tcp # Wyrnix AIS port [Harry_T_Vennik] [Harry_T_Vennik] 2002-11 -wacp 3633/udp # Wyrnix AIS port [Harry_T_Vennik] [Harry_T_Vennik] 2002-11 -hlibmgr 3634/tcp # hNTSP Library Manager [Kenji_Tetsuyama] [Kenji_Tetsuyama] 2002-11 -hlibmgr 3634/udp # hNTSP Library Manager [Kenji_Tetsuyama] [Kenji_Tetsuyama] 2002-11 -sdo 3635/tcp # Simple Distributed Objects [Alexander_Philippou] [Alexander_Philippou] 2002-11 -sdo 3635/udp # Simple Distributed Objects [Alexander_Philippou] [Alexander_Philippou] 2002-11 -servistaitsm 3636/tcp # SerVistaITSM [Ralph_Campbell] [Ralph_Campbell] 2002-11 -servistaitsm 3636/udp # SerVistaITSM [Ralph_Campbell] [Ralph_Campbell] 2002-11 -scservp 3637/tcp # Customer Service Port [Jonathan_A_Zdziarsk] [Jonathan_A_Zdziarsk] 2002-11 -scservp 3637/udp # Customer Service Port [Jonathan_A_Zdziarsk] [Jonathan_A_Zdziarsk] 2002-11 -ehp-backup 3638/tcp # EHP Backup Protocol [Ed_Fair] [Ed_Fair] 2002-11 -ehp-backup 3638/udp # EHP Backup Protocol [Ed_Fair] [Ed_Fair] 2002-11 -xap-ha 3639/tcp # Extensible Automation [Mark_Harrison] [Mark_Harrison] 2002-11 -xap-ha 3639/udp # Extensible Automation [Mark_Harrison] [Mark_Harrison] 2002-11 -netplay-port1 3640/tcp # Netplay Port 1 -netplay-port1 3640/udp # Netplay Port 1 -netplay-port2 3641/tcp # Netplay Port 2 [Predrag_Filipovic] [Predrag_Filipovic] 2002-11 -netplay-port2 3641/udp # Netplay Port 2 [Predrag_Filipovic] [Predrag_Filipovic] 2002-11 -juxml-port 3642/tcp # Juxml Replication port [Colin_Reid] [Colin_Reid] 2002-11 -juxml-port 3642/udp # Juxml Replication port [Colin_Reid] [Colin_Reid] 2002-11 -audiojuggler 3643/tcp # AudioJuggler [Morten_Mertner] [Morten_Mertner] 2002-11 -audiojuggler 3643/udp # AudioJuggler [Morten_Mertner] [Morten_Mertner] 2002-11 -ssowatch 3644/tcp # ssowatch [Marie_France_Dubreui] [Marie_France_Dubreui] 2002-11 -ssowatch 3644/udp # ssowatch [Marie_France_Dubreui] [Marie_France_Dubreui] 2002-11 -cyc 3645/tcp # Cyc [Stephen_Reed] [Stephen_Reed] 2003-01 -cyc 3645/udp # Cyc [Stephen_Reed] [Stephen_Reed] 2003-01 -xss-srv-port 3646/tcp # XSS Server Port [Joe_Purcell] [Joe_Purcell] 2003-01 -xss-srv-port 3646/udp # XSS Server Port [Joe_Purcell] [Joe_Purcell] 2003-01 -splitlock-gw 3647/tcp # Splitlock Gateway [Andrew_Tune] [Andrew_Tune] 2003-01 -splitlock-gw 3647/udp # Splitlock Gateway [Andrew_Tune] [Andrew_Tune] 2003-01 -fjcp 3648/tcp # Fujitsu Cooperation Port [Kouji_Sugisawa] [Kouji_Sugisawa] 2003-01 -fjcp 3648/udp # Fujitsu Cooperation Port [Kouji_Sugisawa] [Kouji_Sugisawa] 2003-01 -nmmp 3649/tcp # Nishioka Miyuki Msg Protocol [TAKEDA_Hiroyuki] [TAKEDA_Hiroyuki] 2003-01 -nmmp 3649/udp # Nishioka Miyuki Msg Protocol [TAKEDA_Hiroyuki] [TAKEDA_Hiroyuki] 2003-01 -prismiq-plugin 3650/tcp # PRISMIQ VOD plug-in [Richard_Hodges_3] [Richard_Hodges_3] 2003-01 -prismiq-plugin 3650/udp # PRISMIQ VOD plug-in [Richard_Hodges_3] [Richard_Hodges_3] 2003-01 -xrpc-registry 3651/tcp # XRPC Registry [Slava_Monich] [Slava_Monich] 2003-01 -xrpc-registry 3651/udp # XRPC Registry [Slava_Monich] [Slava_Monich] 2003-01 -vxcrnbuport 3652/tcp # VxCR NBU Default Port [Boris_Star] [Boris_Star] 2003-01 -vxcrnbuport 3652/udp # VxCR NBU Default Port [Boris_Star] [Boris_Star] 2003-01 -tsp 3653/tcp # Tunnel Setup Protocol [Marc_Blanchet] [Marc_Blanchet] 2003-01 [RFC5572] -tsp 3653/udp # Tunnel Setup Protocol [Marc_Blanchet] [Marc_Blanchet] 2003-01 [RFC5572] -vaprtm 3654/tcp # VAP RealTime Messenger [Boris_Polevoy] [Boris_Polevoy] 2003-01 -vaprtm 3654/udp # VAP RealTime Messenger [Boris_Polevoy] [Boris_Polevoy] 2003-01 -abatemgr 3655/tcp # ActiveBatch Exec Agent -abatemgr 3655/udp # ActiveBatch Exec Agent -abatjss 3656/tcp # ActiveBatch Job Scheduler [Ben_Rosenberg] [Ben_Rosenberg] 2003-01 -abatjss 3656/udp # ActiveBatch Job Scheduler [Ben_Rosenberg] [Ben_Rosenberg] 2003-01 -immedianet-bcn 3657/tcp # ImmediaNet Beacon [Bill_Homan] [Bill_Homan] 2003-01 -immedianet-bcn 3657/udp # ImmediaNet Beacon [Bill_Homan] [Bill_Homan] 2003-01 -ps-ams 3658/tcp # PlayStation AMS (Secure) [Edgar_Alan_Tu] [Edgar_Alan_Tu] 2003-01 -ps-ams 3658/udp # PlayStation AMS (Secure) [Edgar_Alan_Tu] [Edgar_Alan_Tu] 2003-01 -apple-sasl 3659/tcp # Apple SASL [David_M_O_Rourke] [David_M_O_Rourke] 2003-01 -apple-sasl 3659/udp # Apple SASL [David_M_O_Rourke] [David_M_O_Rourke] 2003-01 -can-nds-ssl 3660/tcp # IBM Tivoli Directory Service -# using SSL -can-nds-ssl 3660/udp # IBM Tivoli Directory Service -# using SSL -can-ferret-ssl 3661/tcp # IBM Tivoli Directory Service [Nic_Catrambone] [Nic_Catrambone] 2003-01 -# using SSL -can-ferret-ssl 3661/udp # IBM Tivoli Directory Service [Nic_Catrambone] [Nic_Catrambone] 2003-01 -# using SSL -pserver 3662/tcp # pserver [Patrick_Furlong] [Patrick_Furlong] 2003-01 -pserver 3662/udp # pserver [Patrick_Furlong] [Patrick_Furlong] 2003-01 -dtp 3663/tcp # DIRECWAY Tunnel Protocol [John_Border] [John_Border] 2003-01 -dtp 3663/udp # DIRECWAY Tunnel Protocol [John_Border] [John_Border] 2003-01 -ups-engine 3664/tcp # UPS Engine Port -ups-engine 3664/udp # UPS Engine Port -ent-engine 3665/tcp # Enterprise Engine Port [Mike_Delgrosso] [Mike_Delgrosso] 2003-01 -ent-engine 3665/udp # Enterprise Engine Port [Mike_Delgrosso] [Mike_Delgrosso] 2003-01 -eserver-pap 3666/tcp # IBM eServer PAP [Dave_Gimpl] [Dave_Gimpl] 2003-01 -eserver-pap 3666/udp # IBM EServer PAP [Dave_Gimpl] [Dave_Gimpl] 2003-01 -infoexch 3667/tcp # IBM Information Exchange [Paul_Ford_Hutchinson] [Paul_Ford_Hutchinson] 2003-01 -infoexch 3667/udp # IBM Information Exchange [Paul_Ford_Hutchinson] [Paul_Ford_Hutchinson] 2003-01 -dell-rm-port 3668/tcp # Dell Remote Management [Bradley_Bransom] [Bradley_Bransom] 2003-01 -dell-rm-port 3668/udp # Dell Remote Management [Bradley_Bransom] [Bradley_Bransom] 2003-01 -casanswmgmt 3669/tcp # CA SAN Switch Management [Emre_Tunar] [Emre_Tunar] 2003-01 -casanswmgmt 3669/udp # CA SAN Switch Management [Emre_Tunar] [Emre_Tunar] 2003-01 -smile 3670/tcp # SMILE TCP/UDP Interface [Andre_Petras] [Andre_Petras] 2003-01 -smile 3670/udp # SMILE TCP/UDP Interface [Andre_Petras] [Andre_Petras] 2003-01 -efcp 3671/tcp # e Field Control (EIBnet) [Marc_Goossens] [Marc_Goossens] 2003-01 -efcp 3671/udp # e Field Control (EIBnet) [Marc_Goossens] [Marc_Goossens] 2003-01 -lispworks-orb 3672/tcp # LispWorks ORB [Lisp_Support] [Lisp_Support] -lispworks-orb 3672/udp # LispWorks ORB [Lisp_Support] [Lisp_Support] -mediavault-gui 3673/tcp # Openview Media Vault GUI [Stephen_Gold] [Stephen_Gold] 2003-01 -mediavault-gui 3673/udp # Openview Media Vault GUI [Stephen_Gold] [Stephen_Gold] 2003-01 -wininstall-ipc 3674/tcp # WinINSTALL IPC Port [Bill_Somerville] [Bill_Somerville] 2008-08-13 -wininstall-ipc 3674/udp # WinINSTALL IPC Port [Bill_Somerville] [Bill_Somerville] 2008-08-13 -calltrax 3675/tcp # CallTrax Data Port [Oliver_Bailey] [Oliver_Bailey] 2003-01 -calltrax 3675/udp # CallTrax Data Port [Oliver_Bailey] [Oliver_Bailey] 2003-01 -va-pacbase 3676/tcp # VisualAge Pacbase server [Dominique_Lelievre] [Dominique_Lelievre] 2003-01 -va-pacbase 3676/udp # VisualAge Pacbase server [Dominique_Lelievre] [Dominique_Lelievre] 2003-01 -roverlog 3677/tcp # RoverLog IPC [Tom_Mayo] [Tom_Mayo] 2003-01 -roverlog 3677/udp # RoverLog IPC [Tom_Mayo] [Tom_Mayo] 2003-01 -ipr-dglt 3678/tcp # DataGuardianLT [Bruce_Carlson] [Bruce_Carlson] 2003-01 -ipr-dglt 3678/udp # DataGuardianLT [Bruce_Carlson] [Bruce_Carlson] 2003-01 -# Escale (Newton 3679 tcp Newton Dock [Paul_Guyot] [Paul_Guyot] 2011-11-09 -# Dock) -# Escale (Newton 3679 udp Newton Dock [Paul_Guyot] [Paul_Guyot] 2011-11-09 -# Dock) -npds-tracker 3680/tcp # NPDS Tracker [Paul_Guyot] [Paul_Guyot] 2003-01 -npds-tracker 3680/udp # NPDS Tracker [Paul_Guyot] [Paul_Guyot] 2003-01 -bts-x73 3681/tcp # BTS X73 Port [Todd_Cooper] [Todd_Cooper] 2003-01 -bts-x73 3681/udp # BTS X73 Port [Todd_Cooper] [Todd_Cooper] 2003-01 -cas-mapi 3682/tcp # EMC SmartPackets-MAPI [Koen_Schoofs] [Koen_Schoofs] 2003-01 -cas-mapi 3682/udp # EMC SmartPackets-MAPI [Koen_Schoofs] [Koen_Schoofs] 2003-01 -bmc-ea 3683/tcp # BMC EDV/EA [Portnoy_Boxman] [Portnoy_Boxman] 2003-01 -bmc-ea 3683/udp # BMC EDV/EA [Portnoy_Boxman] [Portnoy_Boxman] 2003-01 -faxstfx-port 3684/tcp # FAXstfX [Alec_Carlson] [Alec_Carlson] 2003-01 -faxstfx-port 3684/udp # FAXstfX [Alec_Carlson] [Alec_Carlson] 2003-01 -dsx-agent 3685/tcp # DS Expert Agent [Jason_Lockett][Melanie_Kacerek] [Jason_Lockett][Melanie_Kacerek] 2008-12-16 -dsx-agent 3685/udp # DS Expert Agent [Jason_Lockett][Melanie_Kacerek] [Jason_Lockett][Melanie_Kacerek] 2008-12-16 -tnmpv2 3686/tcp # Trivial Network Management [Andrea_Premoli] [Andrea_Premoli] 2003-01 -tnmpv2 3686/udp # Trivial Network Management [Andrea_Premoli] [Andrea_Premoli] 2003-01 -simple-push 3687/tcp # simple-push -simple-push 3687/udp # simple-push -simple-push-s 3688/tcp # simple-push Secure [C_Enrique_Ortiz] [C_Enrique_Ortiz] 2003-01 -simple-push-s 3688/udp # simple-push Secure [C_Enrique_Ortiz] [C_Enrique_Ortiz] 2003-01 -daap 3689/tcp # Digital Audio Access [Amandeep_Jawa] [Amandeep_Jawa] 2003-01 Defined TXT keys: txtvers, Version, iTSh Version, Machine ID, -# Protocol (iTunes) Database ID, Machine Name, Password -daap 3689/udp # Digital Audio Access [Amandeep_Jawa] [Amandeep_Jawa] 2003-01 Defined TXT keys: txtvers, Version, iTSh Version, Machine ID, -# Protocol (iTunes) Database ID, Machine Name, Password -svn 3690/tcp # Subversion [Greg_Hudson_2] [Greg_Hudson_2] 2003-01 -svn 3690/udp # Subversion [Greg_Hudson_2] [Greg_Hudson_2] 2003-01 -magaya-network 3691/tcp # Magaya Network Port [Jesus_David_Rodrigue] [Jesus_David_Rodrigue] 2003-02 -magaya-network 3691/udp # Magaya Network Port [Jesus_David_Rodrigue] [Jesus_David_Rodrigue] 2003-02 -intelsync 3692/tcp # Brimstone IntelSync [Davey_Taylor] [Davey_Taylor] 2003-02 -intelsync 3692/udp # Brimstone IntelSync [Davey_Taylor] [Davey_Taylor] 2003-02 -easl 3693/tcp # Emergency Automatic [Mele_Associates] [Greg_Hansen][Randy_Yates] 2014-11-26 This port was previously removed on 2007-04-05. -# Structure Lockdown System -# 3693 udp Reserved 2014-11-26 This port was previously removed on 2007-04-05. -# 3694 Unassigned 2007-04-05 -bmc-data-coll 3695/tcp # BMC Data Collection [Portnoy_Boxman] [Portnoy_Boxman] 2003-02 -bmc-data-coll 3695/udp # BMC Data Collection [Portnoy_Boxman] [Portnoy_Boxman] 2003-02 -telnetcpcd 3696/tcp # Telnet Com Port Control [Thomas_J_Pinkl] [Thomas_J_Pinkl] 2003-02 -telnetcpcd 3696/udp # Telnet Com Port Control [Thomas_J_Pinkl] [Thomas_J_Pinkl] 2003-02 -nw-license 3697/tcp # NavisWorks License System [Tim_Wiegand] [Tim_Wiegand] 2003-02 -nw-license 3697/udp # NavisWorks Licnese System [Tim_Wiegand] [Tim_Wiegand] 2003-02 -sagectlpanel 3698/tcp # SAGECTLPANEL [Mark_Gamble] [Mark_Gamble] 2003-02 -sagectlpanel 3698/udp # SAGECTLPANEL [Mark_Gamble] [Mark_Gamble] 2003-02 -kpn-icw 3699/tcp # Internet Call Waiting [B_J_Kortekaas] [B_J_Kortekaas] 2003-02 -kpn-icw 3699/udp # Internet Call Waiting [B_J_Kortekaas] [B_J_Kortekaas] 2003-02 -lrs-paging 3700/tcp # LRS NetPage [Geoffrey_Wossum] [Geoffrey_Wossum] 2003-02 -lrs-paging 3700/udp # LRS NetPage [Geoffrey_Wossum] [Geoffrey_Wossum] 2003-02 -netcelera 3701/tcp # NetCelera [Tarek_Nabhan] [Tarek_Nabhan] 2003-02 -netcelera 3701/udp # NetCelera [Tarek_Nabhan] [Tarek_Nabhan] 2003-02 -ws-discovery 3702/tcp # Web Service Discovery [Christian_Huitema_2] [Christian_Huitema_2] 2003-02 -ws-discovery 3702/udp # Web Service Discovery [Christian_Huitema_2] [Christian_Huitema_2] 2003-02 -adobeserver-3 3703/tcp # Adobe Server 3 -adobeserver-3 3703/udp # Adobe Server 3 -adobeserver-4 3704/tcp # Adobe Server 4 [Frank_Soetebeer] [Frank_Soetebeer] 2003-01 -adobeserver-4 3704/udp # Adobe Server 4 [Frank_Soetebeer] [Frank_Soetebeer] 2003-01 -adobeserver-5 3705/tcp # Adobe Server 5 [Bernd_Paradies] [Bernd_Paradies] 2008-01-14 -adobeserver-5 3705/udp # Adobe Server 5 [Bernd_Paradies] [Bernd_Paradies] 2008-01-14 -rt-event 3706/tcp # Real-Time Event Port -rt-event 3706/udp # Real-Time Event Port -rt-event-s 3707/tcp # Real-Time Event Secure Port [Terry_Gin] [Terry_Gin] 2003-02 -rt-event-s 3707/udp # Real-Time Event Secure Port [Terry_Gin] [Terry_Gin] 2003-02 -sun-as-iiops 3708/tcp # Sun App Svr - Naming [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -sun-as-iiops 3708/udp # Sun App Svr - Naming [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -ca-idms 3709/tcp # CA-IDMS Server [Dave_Ross] [Dave_Ross] -ca-idms 3709/udp # CA-IDMS Server [Dave_Ross] [Dave_Ross] -portgate-auth 3710/tcp # PortGate Authentication [Scott_Harris] [Scott_Harris] 2003-02 -portgate-auth 3710/udp # PortGate Authentication [Scott_Harris] [Scott_Harris] 2003-02 -edb-server2 3711/tcp # EBD Server 2 [Carlos_Portela] [Carlos_Portela] 2003-02 -edb-server2 3711/udp # EBD Server 2 [Carlos_Portela] [Carlos_Portela] 2003-02 -sentinel-ent 3712/tcp # Sentinel Enterprise [Ian_Gordon_2] [Ian_Gordon_2] 2003-03 -sentinel-ent 3712/udp # Sentinel Enterprise [Ian_Gordon_2] [Ian_Gordon_2] 2003-03 -tftps 3713/tcp # TFTP over TLS [Mark_mayernick] [Mark_mayernick] 2003-03 -tftps 3713/udp # TFTP over TLS [Mark_mayernick] [Mark_mayernick] 2003-03 -delos-dms 3714/tcp # DELOS Direct Messaging [Ekkehard_Morgenstern] [Ekkehard_Morgenstern] 2003-03 -delos-dms 3714/udp # DELOS Direct Messaging [Ekkehard_Morgenstern] [Ekkehard_Morgenstern] 2003-03 -anoto-rendezv 3715/tcp # Anoto Rendezvous Port [Ola_Sandstrom] [Ola_Sandstrom] 2003-03 -anoto-rendezv 3715/udp # Anoto Rendezvous Port [Ola_Sandstrom] [Ola_Sandstrom] 2003-03 -wv-csp-sms-cir 3716/tcp # WV CSP SMS CIR Channel -wv-csp-sms-cir 3716/udp # WV CSP SMS CIR Channel -wv-csp-udp-cir 3717/tcp # WV CSP UDP/IP CIR Channel [Jon_Ingi_Ingimundars] [Jon_Ingi_Ingimundars] 2003-03 -wv-csp-udp-cir 3717/udp # WV CSP UDP/IP CIR Channel [Jon_Ingi_Ingimundars] [Jon_Ingi_Ingimundars] 2003-03 -opus-services 3718/tcp # OPUS Server Port [Detlef_Stoever] [Detlef_Stoever] 2003-03 -opus-services 3718/udp # OPUS Server Port [Detlef_Stoever] [Detlef_Stoever] 2003-03 -itelserverport 3719/tcp # iTel Server Port [Mark_Hendricks] [Mark_Hendricks] 2003-03 -itelserverport 3719/udp # iTel Server Port [Mark_Hendricks] [Mark_Hendricks] 2003-03 -ufastro-instr 3720/tcp # UF Astro. Instr. Services [David_B_Hon] [David_B_Hon] 2003-03 -ufastro-instr 3720/udp # UF Astro. Instr. Services [David_B_Hon] [David_B_Hon] 2003-03 -xsync 3721/tcp # Xsync -xsync 3721/udp # Xsync -xserveraid 3722/tcp # Xserve RAID [Bob_Bradley] [Bob_Bradley] 2003-03 -xserveraid 3722/udp # Xserve RAID [Bob_Bradley] [Bob_Bradley] 2003-03 -sychrond 3723/tcp # Sychron Service Daemon [Robert_Marinelli] [Robert_Marinelli] 2003-03 -sychrond 3723/udp # Sychron Service Daemon [Robert_Marinelli] [Robert_Marinelli] 2003-03 -blizwow 3724/tcp # World of Warcraft [Domain_Tech] [Domain_Tech] 2005-04 -blizwow 3724/udp # World of Warcraft [Domain_Tech] [Domain_Tech] 2005-04 -na-er-tip 3725/tcp # Netia NA-ER Port [Jean_Pierre_Garcia] [Jean_Pierre_Garcia] 2003-04 -na-er-tip 3725/udp # Netia NA-ER Port [Jean_Pierre_Garcia] [Jean_Pierre_Garcia] 2003-04 -array-manager 3726/tcp # Xyratex Array Manager [David_A_Lethe] [David_A_Lethe] 2003-04 -array-manager 3726/udp # Xyartex Array Manager [David_A_Lethe] [David_A_Lethe] 2003-04 -e-mdu 3727/tcp # Ericsson Mobile Data Unit -e-mdu 3727/udp # Ericsson Mobile Data Unit -e-woa 3728/tcp # Ericsson Web on Air [Marco_Casole] [Marco_Casole] 2003-04 -e-woa 3728/udp # Ericsson Web on Air [Marco_Casole] [Marco_Casole] 2003-04 -fksp-audit 3729/tcp # Fireking Audit Port [Richard_Thurman] [Richard_Thurman] 2003-04 -fksp-audit 3729/udp # Fireking Audit Port [Richard_Thurman] [Richard_Thurman] 2003-04 -client-ctrl 3730/tcp # Client Control [Lawrence_W_Dunn] [Lawrence_W_Dunn] 2003-04 -client-ctrl 3730/udp # Client Control [Lawrence_W_Dunn] [Lawrence_W_Dunn] 2003-04 -smap 3731/tcp # Service Manager -smap 3731/udp # Service Manager -m-wnn 3732/tcp # Mobile Wnn [Yasunari_Yamashita] [Yasunari_Yamashita] 2003-04 -m-wnn 3732/udp # Mobile Wnn [Yasunari_Yamashita] [Yasunari_Yamashita] 2003-04 -multip-msg 3733/tcp # Multipuesto Msg Port [Felisa_Ares] [Felisa_Ares] 2003-04 -multip-msg 3733/udp # Multipuesto Msg Port [Felisa_Ares] [Felisa_Ares] 2003-04 -synel-data 3734/tcp # Synel Data Collection Port [David_Ashkenazi] [David_Ashkenazi] 2003-04 -synel-data 3734/udp # Synel Data Collection Port [David_Ashkenazi] [David_Ashkenazi] 2003-04 -pwdis 3735/tcp # Password Distribution [Robert_Erl] [Robert_Erl] 2003-04 -pwdis 3735/udp # Password Distribution [Robert_Erl] [Robert_Erl] 2003-04 -rs-rmi 3736/tcp # RealSpace RMI [Barry_McDarby] [Barry_McDarby] 2003-04 -rs-rmi 3736/udp # RealSpace RMI [Barry_McDarby] [Barry_McDarby] 2003-04 -xpanel 3737/tcp # XPanel Daemon [Lilian_Rudenco] [Lilian_Rudenco] 2009-03-04 -# 3737 udp Reserved -versatalk 3738/tcp # versaTalk Server Port [Dr_Kingsley_C_Nwos] [Dr_Kingsley_C_Nwos] 2003-04 -versatalk 3738/udp # versaTalk Server Port [Dr_Kingsley_C_Nwos] [Dr_Kingsley_C_Nwos] 2003-04 -launchbird-lm 3739/tcp # Launchbird LicenseManager [Tom_Hawkins] [Tom_Hawkins] 2003-04 -launchbird-lm 3739/udp # Launchbird LicenseManager [Tom_Hawkins] [Tom_Hawkins] 2003-04 -heartbeat 3740/tcp # Heartbeat Protocol [Jeroen_Massar] [Jeroen_Massar] 2003-04 -heartbeat 3740/udp # Heartbeat Protocol [Jeroen_Massar] [Jeroen_Massar] 2003-04 -wysdma 3741/tcp # WysDM Agent [Jim_McDonald] [Jim_McDonald] 2003-04 -wysdma 3741/udp # WysDM Agent [Jim_McDonald] [Jim_McDonald] 2003-04 -cst-port 3742/tcp # CST - Configuration & [Hai_Ou_Yang] [Hai_Ou_Yang] 2003-04 -# Service Tracker -cst-port 3742/udp # CST - Configuration & [Hai_Ou_Yang] [Hai_Ou_Yang] 2003-04 -# Service Tracker -ipcs-command 3743/tcp # IP Control Systems Ltd. [Paul_Anderson] [Paul_Anderson] 2003-04 -ipcs-command 3743/udp # IP Control Systems Ltd. [Paul_Anderson] [Paul_Anderson] 2003-04 -sasg 3744/tcp # SASG [Cristian_Petculescu_2] [Cristian_Petculescu_2] 2003-04 -sasg 3744/udp # SASG [Cristian_Petculescu_2] [Cristian_Petculescu_2] 2003-04 -gw-call-port 3745/tcp # GWRTC Call Port [Felisa_Ares] [Felisa_Ares] 2003-04 -gw-call-port 3745/udp # GWRTC Call Port [Felisa_Ares] [Felisa_Ares] 2003-04 -linktest 3746/tcp # LXPRO.COM LinkTest -linktest 3746/udp # LXPRO.COM LinkTest -linktest-s 3747/tcp # LXPRO.COM LinkTest SSL [Greg_Bailey] [Greg_Bailey] 2003-04 -linktest-s 3747/udp # LXPRO.COM LinkTest SSL [Greg_Bailey] [Greg_Bailey] 2003-04 -webdata 3748/tcp # webData [Michael_Whiteley] [Michael_Whiteley] 2003-04 -webdata 3748/udp # webData [Michael_Whiteley] [Michael_Whiteley] 2003-04 -cimtrak 3749/tcp # CimTrak [Robert_E_Johnson_II] [Robert_E_Johnson_II] 2003-04 -cimtrak 3749/udp # CimTrak [Robert_E_Johnson_II] [Robert_E_Johnson_II] 2003-04 -cbos-ip-port 3750/tcp # CBOS/IP ncapsalation port [Thomas_Dannemiller] [Thomas_Dannemiller] 2003-04 -cbos-ip-port 3750/udp # CBOS/IP ncapsalatoin port [Thomas_Dannemiller] [Thomas_Dannemiller] 2003-04 -gprs-cube 3751/tcp # CommLinx GPRS Cube [Peter_Johnson] [Peter_Johnson] 2003-04 -gprs-cube 3751/udp # CommLinx GPRS Cube [Peter_Johnson] [Peter_Johnson] 2003-04 -vipremoteagent 3752/tcp # Vigil-IP RemoteAgent [Bryan_Alvord] [Bryan_Alvord] 2003-04 -vipremoteagent 3752/udp # Vigil-IP RemoteAgent [Bryan_Alvord] [Bryan_Alvord] 2003-04 -nattyserver 3753/tcp # NattyServer Port [Akira_Saito] [Akira_Saito] 2003-04 -nattyserver 3753/udp # NattyServer Port [Akira_Saito] [Akira_Saito] 2003-04 -timestenbroker 3754/tcp # TimesTen Broker Port [David_Aspinwall] [David_Aspinwall] 2003-04 -timestenbroker 3754/udp # TimesTen Broker Port [David_Aspinwall] [David_Aspinwall] 2003-04 -sas-remote-hlp 3755/tcp # SAS Remote Help Server [Gary_T_Ciampa] [Gary_T_Ciampa] 2003-04 -sas-remote-hlp 3755/udp # SAS Remote Help Server [Gary_T_Ciampa] [Gary_T_Ciampa] 2003-04 -canon-capt 3756/tcp # Canon CAPT Port [Takashi_Okazawa] [Takashi_Okazawa] 2003-04 -canon-capt 3756/udp # Canon CAPT Port [Takashi_Okazawa] [Takashi_Okazawa] 2003-04 -grf-port 3757/tcp # GRF Server Port [Robert_Banfill] [Robert_Banfill] 2003-04 -grf-port 3757/udp # GRF Server Port [Robert_Banfill] [Robert_Banfill] 2003-04 -apw-registry 3758/tcp # apw RMI registry [Dan_Davis] [Dan_Davis] 2003-04 -apw-registry 3758/udp # apw RMI registry [Dan_Davis] [Dan_Davis] 2003-04 -exapt-lmgr 3759/tcp # Exapt License Manager [Christoph_Kukulies] [Christoph_Kukulies] 2003-04 -exapt-lmgr 3759/udp # Exapt License Manager [Christoph_Kukulies] [Christoph_Kukulies] 2003-04 -adtempusclient 3760/tcp # adTempus Client [Bill_Wingate] [Bill_Wingate] 2003-05 -adtempusclient 3760/udp # adTEmpus Client [Bill_Wingate] [Bill_Wingate] 2003-05 -gsakmp 3761/tcp # gsakmp port [RFC4535] -gsakmp 3761/udp # gsakmp port [RFC4535] -gbs-smp 3762/tcp # GBS SnapMail Protocol [Eric_Harris_Braun] [Eric_Harris_Braun] 2003-06 -gbs-smp 3762/udp # GBS SnapMail Protocol [Eric_Harris_Braun] [Eric_Harris_Braun] 2003-06 -xo-wave 3763/tcp # XO Wave Control Port [Bjorn_Dittmer_Roche] [Bjorn_Dittmer_Roche] 2003-06 -xo-wave 3763/udp # XO Wave Control Port [Bjorn_Dittmer_Roche] [Bjorn_Dittmer_Roche] 2003-06 -mni-prot-rout 3764/tcp # MNI Protected Routing [Tim_Behne] [Tim_Behne] 2003-06 -mni-prot-rout 3764/udp # MNI Protected Routing [Tim_Behne] [Tim_Behne] 2003-06 -rtraceroute 3765/tcp # Remote Traceroute [A_Blake_Cooper] [A_Blake_Cooper] 2003-06 -rtraceroute 3765/udp # Remote Traceroute [A_Blake_Cooper] [A_Blake_Cooper] 2003-06 -sitewatch-s 3766/tcp # SSL e-watch sitewatch server [e-Watch_Corporation] [John_M_Baird_2] 2014-05-13 this port was previously updated on 2009-06-19 -# 3766 udp Reserved this port was previously updated on 2009-06-19 -listmgr-port 3767/tcp # ListMGR Port [Takashi_Kubota] [Takashi_Kubota] 2003-06 -listmgr-port 3767/udp # ListMGR Port [Takashi_Kubota] [Takashi_Kubota] 2003-06 -rblcheckd 3768/tcp # rblcheckd server daemon [Sabri_Berisha] [Sabri_Berisha] 2003-06 -rblcheckd 3768/udp # rblcheckd server daemon [Sabri_Berisha] [Sabri_Berisha] 2003-06 -haipe-otnk 3769/tcp # HAIPE Network Keying [Mike_Irani_2] [Mike_Irani_2] 2003-06 -haipe-otnk 3769/udp # HAIPE Network Keying [Mike_Irani_2] [Mike_Irani_2] 2003-06 -cindycollab 3770/tcp # Cinderella Collaboration [Ulrich_Kortenkamp] [Ulrich_Kortenkamp] 2003-06 -cindycollab 3770/udp # Cinderella Collaboration [Ulrich_Kortenkamp] [Ulrich_Kortenkamp] 2003-06 -paging-port 3771/tcp # RTP Paging Port [Patrick_Ferriter] [Patrick_Ferriter] 2003-06 -paging-port 3771/udp # RTP Paging Port [Patrick_Ferriter] [Patrick_Ferriter] 2003-06 -ctp 3772/tcp # Chantry Tunnel Protocol [Inderpreet_Singh] [Inderpreet_Singh] 2003-06 -ctp 3772/udp # Chantry Tunnel Protocol [Inderpreet_Singh] [Inderpreet_Singh] 2003-06 -ctdhercules 3773/tcp # ctdhercules [Carl_Banzhof] [Carl_Banzhof] 2003-06 -ctdhercules 3773/udp # ctdhercules [Carl_Banzhof] [Carl_Banzhof] 2003-06 -zicom 3774/tcp # ZICOM [Sabu_Das] [Sabu_Das] 2003-06 -zicom 3774/udp # ZICOM [Sabu_Das] [Sabu_Das] 2003-06 -ispmmgr 3775/tcp # ISPM Manager Port [Eric_Anderson] [Eric_Anderson] 2003-06 -ispmmgr 3775/udp # ISPM Manager Port [Eric_Anderson] [Eric_Anderson] 2003-06 -dvcprov-port 3776/tcp # Device Provisioning Port [Rob_Lehew] [Rob_Lehew] 2003-06 -dvcprov-port 3776/udp # Device Provisioning Port [Rob_Lehew] [Rob_Lehew] 2003-06 -jibe-eb 3777/tcp # Jibe EdgeBurst [Chap_Tippin] [Chap_Tippin] 2003-06 -jibe-eb 3777/udp # Jibe EdgeBurst [Chap_Tippin] [Chap_Tippin] 2003-06 -c-h-it-port 3778/tcp # Cutler-Hammer IT Port [Thomas_Ruchti] [Thomas_Ruchti] 2003-06 -c-h-it-port 3778/udp # Cutler-Hammer IT Port [Thomas_Ruchti] [Thomas_Ruchti] 2003-06 -cognima 3779/tcp # Cognima Replication [Ralph_Greenwell] [Ralph_Greenwell] 2003-06 -cognima 3779/udp # Cognima Replication [Ralph_Greenwell] [Ralph_Greenwell] 2003-06 -nnp 3780/tcp # Nuzzler Network Protocol [Andreas_Schwarz_2] [Andreas_Schwarz_2] 2003-06 -nnp 3780/udp # Nuzzler Network Protocol [Andreas_Schwarz_2] [Andreas_Schwarz_2] 2003-06 -abcvoice-port 3781/tcp # ABCvoice server port [Carlos_Gonzalez_Roma] [Carlos_Gonzalez_Roma] 2003-06 -abcvoice-port 3781/udp # ABCvoice server port [Carlos_Gonzalez_Roma] [Carlos_Gonzalez_Roma] 2003-06 -iso-tp0s 3782/tcp # Secure ISO TP0 port [Herbert_Falk] [Herbert_Falk] 2003-06 -iso-tp0s 3782/udp # Secure ISO TP0 port [Herbert_Falk] [Herbert_Falk] 2003-06 -bim-pem 3783/tcp # Impact Mgr./PEM Gateway [Walter_G_Giroir] [Walter_G_Giroir] 2003-07 -bim-pem 3783/udp # Impact Mgr./PEM Gateway [Walter_G_Giroir] [Walter_G_Giroir] 2003-07 -bfd-control 3784/tcp # BFD Control Protocol [RFC5881] -bfd-control 3784/udp # BFD Control Protocol [RFC5881] -bfd-echo 3785/tcp # BFD Echo Protocol [RFC5881] -bfd-echo 3785/udp # BFD Echo Protocol [RFC5881] -upstriggervsw 3786/tcp # VSW Upstrigger port [Mark_Tim_Junghanns] [Mark_Tim_Junghanns] 2003-07 -upstriggervsw 3786/udp # VSW Upstrigger port [Mark_Tim_Junghanns] [Mark_Tim_Junghanns] 2003-07 -fintrx 3787/tcp # Fintrx [Peter_G_L_Potgiese] [Peter_G_L_Potgiese] 2003-07 -fintrx 3787/udp # Fintrx [Peter_G_L_Potgiese] [Peter_G_L_Potgiese] 2003-07 -isrp-port 3788/tcp # SPACEWAY Routing port [Vaibhav_Kumar] [Vaibhav_Kumar] 2003-07 -isrp-port 3788/udp # SPACEWAY Routing port [Vaibhav_Kumar] [Vaibhav_Kumar] 2003-07 -remotedeploy 3789/tcp # RemoteDeploy Administration [Detlef_Rothe] [Detlef_Rothe] 2009-05-15 -# Port [July 2003] -remotedeploy 3789/udp # RemoteDeploy Administration [Detlef_Rothe] [Detlef_Rothe] 2009-05-15 -# Port [July 2003] -quickbooksrds 3790/tcp # QuickBooks RDS [Almira] [Almira] 2003-07 -quickbooksrds 3790/udp # QuickBooks RDS [Almira] [Almira] 2003-07 -tvnetworkvideo 3791/tcp # TV NetworkVideo Data port [Kevin_Brunner] [Kevin_Brunner] 2003-07 -tvnetworkvideo 3791/udp # TV NetworkVideo Data port [Kevin_Brunner] [Kevin_Brunner] 2003-07 -sitewatch 3792/tcp # e-Watch Corporation [John_M_Baird] [John_M_Baird] 2003-07 -# SiteWatch -sitewatch 3792/udp # e-Watch Corporation [John_M_Baird] [John_M_Baird] 2003-07 -# SiteWatch -dcsoftware 3793/tcp # DataCore Software [Andre_Cato] [Andre_Cato] 2003-07 -dcsoftware 3793/udp # DataCore Software [Andre_Cato] [Andre_Cato] 2003-07 -jaus 3794/tcp # JAUS Robots [Steven_B_Cliff] [Steven_B_Cliff] 2003-07 -jaus 3794/udp # JAUS Robots [Steven_B_Cliff] [Steven_B_Cliff] 2003-07 -myblast 3795/tcp # myBLAST Mekentosj port [Alexander_Griekspoor] [Alexander_Griekspoor] 2003-07 -myblast 3795/udp # myBLAST Mekentosj port [Alexander_Griekspoor] [Alexander_Griekspoor] 2003-07 -spw-dialer 3796/tcp # Spaceway Dialer [Patrick_Fisher] [Patrick_Fisher] 2003-07 -spw-dialer 3796/udp # Spaceway Dialer [Patrick_Fisher] [Patrick_Fisher] 2003-07 -idps 3797/tcp # idps [Jean_Francois_Rabass] [Jean_Francois_Rabass] 2003-07 -idps 3797/udp # idps [Jean_Francois_Rabass] [Jean_Francois_Rabass] 2003-07 -minilock 3798/tcp # Minilock [Daniel_Julio_Reyes] [Daniel_Julio_Reyes] 2003-08 -minilock 3798/udp # Minilock [Daniel_Julio_Reyes] [Daniel_Julio_Reyes] 2003-08 -radius-dynauth 3799/tcp # RADIUS Dynamic Authorization [RFC3576] -radius-dynauth 3799/udp # RADIUS Dynamic Authorization [RFC3576] -pwgpsi 3800/tcp # Print Services Interface [Harry_Lewis] [Harry_Lewis] 2003-05 -pwgpsi 3800/udp # Print Services Interface [Harry_Lewis] [Harry_Lewis] 2003-05 -ibm-mgr 3801/tcp # ibm manager service [Tim_Hahn] [Tim_Hahn] 2006-03 -ibm-mgr 3801/udp # ibm manager service [Tim_Hahn] [Tim_Hahn] 2006-03 -vhd 3802/tcp # VHD [Chris_Duncombe] [Chris_Duncombe] -vhd 3802/udp # VHD [Chris_Duncombe] [Chris_Duncombe] -soniqsync 3803/tcp # SoniqSync [Ryan_Melville] [Ryan_Melville] 2004-01 -soniqsync 3803/udp # SoniqSync [Ryan_Melville] [Ryan_Melville] 2004-01 -iqnet-port 3804/tcp # Harman IQNet Port [Bruce_Vander_Werf] [Bruce_Vander_Werf] 2004-02 -iqnet-port 3804/udp # Harman IQNet Port [Bruce_Vander_Werf] [Bruce_Vander_Werf] 2004-02 -tcpdataserver 3805/tcp # ThorGuard Server Port [Joel_E_Steiger] [Joel_E_Steiger] 2004-02 -tcpdataserver 3805/udp # ThorGuard Server Port [Joel_E_Steiger] [Joel_E_Steiger] 2004-02 -wsmlb 3806/tcp # Remote System Manager [Thomas_Fiege] [Thomas_Fiege] 2004-02 -wsmlb 3806/udp # Remote System Manager [Thomas_Fiege] [Thomas_Fiege] 2004-02 -spugna 3807/tcp # SpuGNA Communication Port [Samuele_Sequi] [Samuele_Sequi] 2004-02 -spugna 3807/udp # SpuGNA Communication Port [Samuele_Sequi] [Samuele_Sequi] 2004-02 -sun-as-iiops-ca 3808/tcp # Sun App Svr-IIOPClntAuth [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -sun-as-iiops-ca 3808/udp # Sun App Svr-IIOPClntAuth [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -apocd 3809/tcp # Java Desktop System [Geoff_Higgins] [Geoff_Higgins] 2006-03 -# Configuration Agent -apocd 3809/udp # Java Desktop System [Geoff_Higgins] [Geoff_Higgins] 2006-03 -# Configuration Agent -wlanauth 3810/tcp # WLAN AS server [Bianling_Zhang] [Bianling_Zhang] 2004-02 -wlanauth 3810/udp # WLAN AS server [Bianling_Zhang] [Bianling_Zhang] 2004-02 -amp 3811/tcp # AMP [Northon_Rodrigues] [Northon_Rodrigues] 2004-02 -amp 3811/udp # AMP [Northon_Rodrigues] [Northon_Rodrigues] 2004-02 -neto-wol-server 3812/tcp # netO WOL Server [Martin_Bestmann_2] [Martin_Bestmann_2] 2004-03 -neto-wol-server 3812/udp # netO WOL Server [Martin_Bestmann_2] [Martin_Bestmann_2] 2004-03 -rap-ip 3813/tcp # Rhapsody Interface Protocol [Paul_Zander] [Paul_Zander] 2004-03 -rap-ip 3813/udp # Rhapsody Interface Protocol [Paul_Zander] [Paul_Zander] 2004-03 -neto-dcs 3814/tcp # netO DCS [Martin_Bestmann_2] [Martin_Bestmann_2] 2004-03 -neto-dcs 3814/udp # netO DCS [Martin_Bestmann_2] [Martin_Bestmann_2] 2004-03 -lansurveyorxml 3815/tcp # LANsurveyor XML [Michael_Swan] [Michael_Swan] 2004-04 -lansurveyorxml 3815/udp # LANsurveyor XML [Michael_Swan] [Michael_Swan] 2004-04 -sunlps-http 3816/tcp # Sun Local Patch Server [Barry_Greenberg] [Barry_Greenberg] 2004-04 -sunlps-http 3816/udp # Sun Local Patch Server [Barry_Greenberg] [Barry_Greenberg] 2004-04 -tapeware 3817/tcp # Yosemite Tech Tapeware [Luke_Dion] [Luke_Dion] 2004-04 -tapeware 3817/udp # Yosemite Tech Tapeware [Luke_Dion] [Luke_Dion] 2004-04 -crinis-hb 3818/tcp # Crinis Heartbeat [Eric_McMurry] [Eric_McMurry] 2004-04 -crinis-hb 3818/udp # Crinis Heartbeat [Eric_McMurry] [Eric_McMurry] 2004-04 -epl-slp 3819/tcp # EPL Sequ Layer Protocol [Hans_Weibel] [Hans_Weibel] 2004-10 -epl-slp 3819/udp # EPL Sequ Layer Protocol [Hans_Weibel] [Hans_Weibel] 2004-10 -scp 3820/tcp # Siemens AuD SCP [Johann_Arnold] [Johann_Arnold] 2004-10 -scp 3820/udp # Siemens AuD SCP [Johann_Arnold] [Johann_Arnold] 2004-10 -pmcp 3821/tcp # ATSC PMCP Standard [Graham_Jones] [Graham_Jones] 2004-11 -pmcp 3821/udp # ATSC PMCP Standard [Graham_Jones] [Graham_Jones] 2004-11 -acp-discovery 3822/tcp # Compute Pool Discovery -acp-discovery 3822/udp # Compute Pool Discovery -acp-conduit 3823/tcp # Compute Pool Conduit -acp-conduit 3823/udp # Compute Pool Conduit -acp-policy 3824/tcp # Compute Pool Policy [Andy_Belk_2] [Andy_Belk_2] 2005-02 -acp-policy 3824/udp # Compute Pool Policy [Andy_Belk_2] [Andy_Belk_2] 2005-02 -ffserver 3825/tcp # Antera FlowFusion Process [Armin_Liebchen] [Armin_Liebchen] 2007-06 -# Simulation -ffserver 3825/udp # Antera FlowFusion Process [Armin_Liebchen] [Armin_Liebchen] 2007-06 -# Simulation -warmux 3826/tcp # WarMUX game server [Christophe_Gisquet] [Christophe_Gisquet] 2011-05-26 -warmux 3826/udp # WarMUX game server [Christophe_Gisquet] [Christophe_Gisquet] 2011-05-26 -netmpi 3827/tcp # Netadmin Systems MPI service [G_Runfeldt] [G_Runfeldt] 2007-07-10 -netmpi 3827/udp # Netadmin Systems MPI service [G_Runfeldt] [G_Runfeldt] 2007-07-10 -neteh 3828/tcp # Netadmin Systems Event -# Handler -neteh 3828/udp # Netadmin Systems Event -# Handler -neteh-ext 3829/tcp # Netadmin Systems Event [Jonas_Krogell] [Jonas_Krogell] 2007-07-10 -# Handler External -neteh-ext 3829/udp # Netadmin Systems Event [Jonas_Krogell] [Jonas_Krogell] 2007-07-10 -# Handler External -cernsysmgmtagt 3830/tcp # Cerner System Management [Mike_Craft] [Mike_Craft] 2008-01-29 -# Agent -cernsysmgmtagt 3830/udp # Cerner System Management [Mike_Craft] [Mike_Craft] 2008-01-29 -# Agent -dvapps 3831/tcp # Docsvault Application [Ketul_Patel] [Ketul_Patel] 2006-10 -# Service -dvapps 3831/udp # Docsvault Application [Ketul_Patel] [Ketul_Patel] 2006-10 -# Service -xxnetserver 3832/tcp # xxNETserver [XXT_LLC] [Matt_Ferrari] 2006-10 2012-07-12 -xxnetserver 3832/udp # xxNETserver [XXT_LLC] [Matt_Ferrari] 2006-10 2012-07-12 -aipn-auth 3833/tcp # AIPN LS Authentication [Qiang_Zhang] [Qiang_Zhang] 2006-10 -aipn-auth 3833/udp # AIPN LS Authentication [Qiang_Zhang] [Qiang_Zhang] 2006-10 -spectardata 3834/tcp # Spectar Data Stream Service -spectardata 3834/udp # Spectar Data Stream Service -spectardb 3835/tcp # Spectar Database Rights [Jan_Rutger_Voorhorst] [Jan_Rutger_Voorhorst] 2006-10 -# Service -spectardb 3835/udp # Spectar Database Rights [Jan_Rutger_Voorhorst] [Jan_Rutger_Voorhorst] 2006-10 -# Service -markem-dcp 3836/tcp # MARKEM NEXTGEN DCP -markem-dcp 3836/udp # MARKEM NEXTGEN DCP -mkm-discovery 3837/tcp # MARKEM Auto-Discovery [Vadym_Kargin] [Vadym_Kargin] 2005-08 -mkm-discovery 3837/udp # MARKEM Auto-Discovery [Vadym_Kargin] [Vadym_Kargin] 2005-08 -sos 3838/tcp # Scito Object Server [Arno_Klaassen] [Arno_Klaassen] 2003-11 -sos 3838/udp # Scito Object Server [Arno_Klaassen] [Arno_Klaassen] 2003-11 -amx-rms 3839/tcp # AMX Resource Management [Ron_Barber] [Ron_Barber] 2003-11 -# Suite -amx-rms 3839/udp # AMX Resource Management [Ron_Barber] [Ron_Barber] 2003-11 -# Suite -flirtmitmir 3840/tcp # www.FlirtMitMir.de [Carsten_Falticska] [Carsten_Falticska] 2003-11 -flirtmitmir 3840/udp # www.FlirtMitMir.de [Carsten_Falticska] [Carsten_Falticska] 2003-11 -shiprush-db-svr 3841/tcp # ShipRush Database Server [Z-Firm_LLC] [Rafael_Zimberoff] 2003-11 2014-08-22 -# 3841 udp Reserved 2003-11 2014-08-22 -nhci 3842/tcp # NHCI status port [Eric_Welch_2] [Eric_Welch_2] 2003-11 -nhci 3842/udp # NHCI status port [Eric_Welch_2] [Eric_Welch_2] 2003-11 -quest-agent 3843/tcp # Quest Common Agent [Peter_Maher] [Peter_Maher] 2003-11 -quest-agent 3843/udp # Quest Common Agent [Peter_Maher] [Peter_Maher] 2003-11 -rnm 3844/tcp # RNM [sn_w_of_renegade_lab] [sn_w_of_renegade_lab] 2003-11 -rnm 3844/udp # RNM [sn_w_of_renegade_lab] [sn_w_of_renegade_lab] 2003-11 -v-one-spp 3845/tcp # V-ONE Single Port Proxy [Daniel_Becker_3] [Daniel_Becker_3] -v-one-spp 3845/udp # V-ONE Single Port Proxy [Daniel_Becker_3] [Daniel_Becker_3] -an-pcp 3846/tcp # Astare Network PCP [Tony_Gulino] [Tony_Gulino] 2003-08 -an-pcp 3846/udp # Astare Network PCP [Tony_Gulino] [Tony_Gulino] 2003-08 -msfw-control 3847/tcp # MS Firewall Control [Oren_Trutner] [Oren_Trutner] 2003-08 -msfw-control 3847/udp # MS Firewall Control [Oren_Trutner] [Oren_Trutner] 2003-08 -item 3848/tcp # IT Environmental Monitor [Keith_Wright] [Keith_Wright] 2003-08 -item 3848/udp # IT Environmental Monitor [Keith_Wright] [Keith_Wright] 2003-08 -spw-dnspreload 3849/tcp # SPACEWAY DNS Preload [Daniel_Friedman] [Daniel_Friedman] 2003-08 -spw-dnspreload 3849/udp # SPACEWAY DNS Prelaod [Daniel_Friedman] [Daniel_Friedman] 2003-08 -qtms-bootstrap 3850/tcp # QTMS Bootstrap Protocol [Phil_Willis] [Phil_Willis] 2003-08 -qtms-bootstrap 3850/udp # QTMS Bootstrap Protocol [Phil_Willis] [Phil_Willis] 2003-08 -spectraport 3851/tcp # SpectraTalk Port [Madhav_Karhade] [Madhav_Karhade] 2003-08 -spectraport 3851/udp # SpectraTalk Port [Madhav_Karhade] [Madhav_Karhade] 2003-08 -sse-app-config 3852/tcp # SSE App Configuration [Tim_Wilson] [Tim_Wilson] 2003-08 -sse-app-config 3852/udp # SSE App Configuration [Tim_Wilson] [Tim_Wilson] 2003-08 -sscan 3853/tcp # SONY scanning protocol [Takashi_Aihara] [Takashi_Aihara] 2003-08 -sscan 3853/udp # SONY scanning protocol [Takashi_Aihara] [Takashi_Aihara] 2003-08 -stryker-com 3854/tcp # Stryker Comm Port [Andrew_Schultz] [Andrew_Schultz] 2003-08 -stryker-com 3854/udp # Stryker Comm Port [Andrew_Schultz] [Andrew_Schultz] 2003-08 -opentrac 3855/tcp # OpenTRAC [Scott_Miller] [Scott_Miller] 2003-08 -opentrac 3855/udp # OpenTRAC [Scott_Miller] [Scott_Miller] 2003-08 -informer 3856/tcp # INFORMER [Filippo_Fadda] [Filippo_Fadda] 2003-08 -informer 3856/udp # INFORMER [Filippo_Fadda] [Filippo_Fadda] 2003-08 -trap-port 3857/tcp # Trap Port [Norm_Freedman] [Norm_Freedman] 2003-08 -trap-port 3857/udp # Trap Port [Norm_Freedman] [Norm_Freedman] 2003-08 -trap-port-mom 3858/tcp # Trap Port MOM [Norm_Freedman] [Norm_Freedman] 2003-08 -trap-port-mom 3858/udp # Trap Port MOM [Norm_Freedman] [Norm_Freedman] 2003-08 -nav-port 3859/tcp # Navini Port [Chris_Sanders] [Chris_Sanders] 2003-08 -nav-port 3859/udp # Navini Port [Chris_Sanders] [Chris_Sanders] 2003-08 -sasp 3860/tcp # Server/Application State [Alan_Bivens] [Alan_Bivens] 2003-08 -# Protocol (SASP) -sasp 3860/udp # Server/Application State [Alan_Bivens] [Alan_Bivens] 2003-08 -# Protocol (SASP) -winshadow-hd 3861/tcp # winShadow Host Discovery [Shu_Wei_Tan] [Shu_Wei_Tan] 2003-03 -winshadow-hd 3861/udp # winShadow Host Discovery [Shu_Wei_Tan] [Shu_Wei_Tan] 2003-03 -giga-pocket 3862/tcp # GIGA-POCKET [Yoshikazu_Watanabe] [Yoshikazu_Watanabe] -giga-pocket 3862/udp # GIGA-POCKET [Yoshikazu_Watanabe] [Yoshikazu_Watanabe] -asap-tcp 3863/tcp # asap tcp port -asap-udp 3863/udp # asap udp port [RFC5352] -asap-sctp 3863/sctp # asap sctp [RFC5352] -asap-tcp-tls 3864/tcp # asap/tls tcp port [RFC5352] -# 3864 udp Reserved This entry has been removed on 2006-06-23. -asap-sctp-tls 3864/sctp # asap-sctp/tls [RFC5352] -xpl 3865/tcp # xpl automation protocol [Ian_Lowe] [Ian_Lowe] 2003-08 -xpl 3865/udp # xpl automation protocol [Ian_Lowe] [Ian_Lowe] 2003-08 -dzdaemon 3866/tcp # Sun SDViz DZDAEMON Port [Kevin_Rushforth] [Kevin_Rushforth] 2003-08 -dzdaemon 3866/udp # Sun SDViz DZDAEMON Port [Kevin_Rushforth] [Kevin_Rushforth] 2003-08 -dzoglserver 3867/tcp # Sun SDViz DZOGLSERVER Port [Kevin_Rushforth] [Kevin_Rushforth] 2003-08 -dzoglserver 3867/udp # Sun SDViz DZOGLSERVER Port [Kevin_Rushforth] [Kevin_Rushforth] 2003-08 -diameter 3868/tcp # DIAMETER -# 3868 udp Reserved -diameter 3868/sctp # DIAMETER [RFC3588] -ovsam-mgmt 3869/tcp # hp OVSAM MgmtServer Disco [Mike_Pontillo] [Mike_Pontillo] 2003-08 -ovsam-mgmt 3869/udp # hp OVSAM MgmtServer Disco [Mike_Pontillo] [Mike_Pontillo] 2003-08 -ovsam-d-agent 3870/tcp # hp OVSAM HostAgent Disco [Mike_Pontillo] [Mike_Pontillo] 2003-08 -ovsam-d-agent 3870/udp # hp OVSAM HostAgent Disco [Mike_Pontillo] [Mike_Pontillo] 2003-08 -avocent-adsap 3871/tcp # Avocent DS Authorization [Eduardo_Fernandez] [Eduardo_Fernandez] 2003-08 -avocent-adsap 3871/udp # Avocent DS Authorization [Eduardo_Fernandez] [Eduardo_Fernandez] 2003-08 -oem-agent 3872/tcp # OEM Agent [Narain_Jagathesan] [Narain_Jagathesan] 2003-11 -oem-agent 3872/udp # OEM Agent [Narain_Jagathesan] [Narain_Jagathesan] 2003-11 -fagordnc 3873/tcp # fagordnc [Luis_Zugasti] [Luis_Zugasti] 2003-11 -fagordnc 3873/udp # fagordnc [Luis_Zugasti] [Luis_Zugasti] 2003-11 -sixxsconfig 3874/tcp # SixXS Configuration [Jeroen_Massar] [Jeroen_Massar] 2003-11 -sixxsconfig 3874/udp # SixXS Configuration [Jeroen_Massar] [Jeroen_Massar] 2003-11 -pnbscada 3875/tcp # PNBSCADA [Philip_N_Bergstress] [Philip_N_Bergstress] -pnbscada 3875/udp # PNBSCADA [Philip_N_Bergstress] [Philip_N_Bergstress] -# DirectoryLockdown Agent -# -dl-agent 3876/tcp # IANA assigned this [Jason_Lockett][Melanie_Kacerek] [Jason_Lockett][Melanie_Kacerek] 2008-12-16 -# well-formed service name as -# a replacement for -# "dl_agent". -# This entry is an alias to "dl-agent". This entry is now -dl_agent 3876/tcp # DirectoryLockdown Agent [Jason_Lockett][Melanie_Kacerek] [Jason_Lockett][Melanie_Kacerek] 2008-12-16 historic, not usable for use with many common service -# discovery mechanisms. -# DirectoryLockdown Agent -# -dl-agent 3876/udp # IANA assigned this [Jason_Lockett][Melanie_Kacerek] [Jason_Lockett][Melanie_Kacerek] 2008-12-16 -# well-formed service name as -# a replacement for -# "dl_agent". -# This entry is an alias to "dl-agent". This entry is now -dl_agent 3876/udp # DirectoryLockdown Agent [Jason_Lockett][Melanie_Kacerek] [Jason_Lockett][Melanie_Kacerek] 2008-12-16 historic, not usable for use with many common service -# discovery mechanisms. -xmpcr-interface 3877/tcp # XMPCR Interface Port [Christopher_Carlson] [Christopher_Carlson] 2003-10 -xmpcr-interface 3877/udp # XMPCR Interface Port [Christopher_Carlson] [Christopher_Carlson] 2003-10 -fotogcad 3878/tcp # FotoG CAD interface [Jason_Szabo] [Jason_Szabo] 2003-10 -fotogcad 3878/udp # FotoG CAD interface [Jason_Szabo] [Jason_Szabo] 2003-10 -appss-lm 3879/tcp # appss license manager [Peter_Krueger] [Peter_Krueger] 2003-10 -appss-lm 3879/udp # appss license manager [Peter_Krueger] [Peter_Krueger] 2003-10 -igrs 3880/tcp # IGRS [Huang_Jingnan] [Huang_Jingnan] 2003-10 -igrs 3880/udp # IGRS [Huang_Jingnan] [Huang_Jingnan] 2003-10 -idac 3881/tcp # Data Acquisition and Control [Chatziandreoglou_Chr] [Chatziandreoglou_Chr] 2003-10 -idac 3881/udp # Data Acquisition and Control [Chatziandreoglou_Chr] [Chatziandreoglou_Chr] 2003-10 -msdts1 3882/tcp # DTS Service Port [Sergei_Ivanov] [Sergei_Ivanov] 2003-10 -msdts1 3882/udp # DTS Service Port [Sergei_Ivanov] [Sergei_Ivanov] 2003-10 -vrpn 3883/tcp # VR Peripheral Network [Sensics] [Yuval_Boger] 2003-10 2015-05-04 -vrpn 3883/udp # VR Peripheral Network [Sensics] [Yuval_Boger] 2003-10 2015-05-04 -softrack-meter 3884/tcp # SofTrack Metering [John_T_McCann] [John_T_McCann] 2003-10 -softrack-meter 3884/udp # SofTrack Metering [John_T_McCann] [John_T_McCann] 2003-10 -topflow-ssl 3885/tcp # TopFlow SSL [Ken_Nelson] [Ken_Nelson] -topflow-ssl 3885/udp # TopFlow SSL [Ken_Nelson] [Ken_Nelson] -nei-management 3886/tcp # NEI management port [Kevin_Murphy_2] [Kevin_Murphy_2] 2003-10 -nei-management 3886/udp # NEI management port [Kevin_Murphy_2] [Kevin_Murphy_2] 2003-10 -ciphire-data 3887/tcp # Ciphire Data Transport [Lars_Eilebrecht] [Lars_Eilebrecht] 2003-10 -ciphire-data 3887/udp # Ciphire Data Transport [Lars_Eilebrecht] [Lars_Eilebrecht] 2003-10 -ciphire-serv 3888/tcp # Ciphire Services [Lars_Eilebrecht] [Lars_Eilebrecht] 2003-10 -ciphire-serv 3888/udp # Ciphire Services [Lars_Eilebrecht] [Lars_Eilebrecht] 2003-10 -dandv-tester 3889/tcp # D and V Tester Control Port [Voiko_Loukanov] [Voiko_Loukanov] 2003-10 -dandv-tester 3889/udp # D and V Tester Control Port [Voiko_Loukanov] [Voiko_Loukanov] 2003-10 -ndsconnect 3890/tcp # Niche Data Server Connect [Roland_Schneider] [Roland_Schneider] 2003-10 -ndsconnect 3890/udp # Niche Data Server Connect [Roland_Schneider] [Roland_Schneider] 2003-10 -rtc-pm-port 3891/tcp # Oracle RTC-PM port [PV_Shivkumar] [PV_Shivkumar] 2003-10 -rtc-pm-port 3891/udp # Oracle RTC-PM port [PV_Shivkumar] [PV_Shivkumar] 2003-10 -pcc-image-port 3892/tcp # PCC-image-port [Shiro_Tamoto] [Shiro_Tamoto] 2003-10 -pcc-image-port 3892/udp # PCC-image-port [Shiro_Tamoto] [Shiro_Tamoto] 2003-10 -cgi-starapi 3893/tcp # CGI StarAPI Server [Garry_Moore] [Garry_Moore] 2003-10 -cgi-starapi 3893/udp # CGI StarAPI Server [Garry_Moore] [Garry_Moore] 2003-10 -syam-agent 3894/tcp # SyAM Agent Port [Michael_Daniele] [Michael_Daniele] 2003-10 -syam-agent 3894/udp # SyAM Agent Port [Michael_Daniele] [Michael_Daniele] 2003-10 -syam-smc 3895/tcp # SyAm SMC Service Port [Michael_Daniele] [Michael_Daniele] 2003-10 -syam-smc 3895/udp # SyAm SMC Service Port [Michael_Daniele] [Michael_Daniele] 2003-10 -sdo-tls 3896/tcp # Simple Distributed Objects [Alexander_Philippou] [Alexander_Philippou] 2003-10 -# over TLS -sdo-tls 3896/udp # Simple Distributed Objects [Alexander_Philippou] [Alexander_Philippou] 2003-10 -# over TLS -sdo-ssh 3897/tcp # Simple Distributed Objects [Alexander_Philippou] [Alexander_Philippou] 2003-10 -# over SSH -sdo-ssh 3897/udp # Simple Distributed Objects [Alexander_Philippou] [Alexander_Philippou] 2003-10 -# over SSH -senip 3898/tcp # IAS, Inc. SmartEye NET [Matt_Nowicki] [Matt_Nowicki] 2003-10 -# Internet Protocol -senip 3898/udp # IAS, Inc. SmartEye NET [Matt_Nowicki] [Matt_Nowicki] 2003-10 -# Internet Protocol -itv-control 3899/tcp # ITV Port [Alex_Nicu] [Alex_Nicu] 2003-10 -itv-control 3899/udp # ITV Port [Alex_Nicu] [Alex_Nicu] 2003-10 -# Unidata UDT OS -# -udt-os 3900/tcp # IANA assigned this [James_Powell] [James_Powell] -# well-formed service name as -# a replacement for "udt_os". -# This entry is an alias to "udt-os". This entry is now -udt_os 3900/tcp # Unidata UDT OS [James_Powell] [James_Powell] historic, not usable for use with many common service -# discovery mechanisms. -# Unidata UDT OS -# -udt-os 3900/udp # IANA assigned this [James_Powell] [James_Powell] -# well-formed service name as -# a replacement for "udt_os". -# This entry is an alias to "udt-os". This entry is now -udt_os 3900/udp # Unidata UDT OS [James_Powell] [James_Powell] historic, not usable for use with many common service -# discovery mechanisms. -nimsh 3901/tcp # NIM Service Handler [Paul_B_Finley] [Paul_B_Finley] 2003-10 -nimsh 3901/udp # NIM Service Handler [Paul_B_Finley] [Paul_B_Finley] 2003-10 -nimaux 3902/tcp # NIMsh Auxiliary Port [Paul_B_Finley] [Paul_B_Finley] 2003-10 -nimaux 3902/udp # NIMsh Auxiliary Port [Paul_B_Finley] [Paul_B_Finley] 2003-10 -charsetmgr 3903/tcp # CharsetMGR [Tatsuya_Ueda] [Tatsuya_Ueda] 2003-10 -charsetmgr 3903/udp # CharsetMGR [Tatsuya_Ueda] [Tatsuya_Ueda] 2003-10 -omnilink-port 3904/tcp # Arnet Omnilink Port [Ronen_Shaul] [Ronen_Shaul] 2003-10 -omnilink-port 3904/udp # Arnet Omnilink Port [Ronen_Shaul] [Ronen_Shaul] 2003-10 -mupdate 3905/tcp # Mailbox Update (MUPDATE) [RFC3656] -# protocol -mupdate 3905/udp # Mailbox Update (MUPDATE) [RFC3656] -# protocol -topovista-data 3906/tcp # TopoVista elevation data [Gregg_Townsend] [Gregg_Townsend] 2003-11 -topovista-data 3906/udp # TopoVista elevation data [Gregg_Townsend] [Gregg_Townsend] 2003-11 -imoguia-port 3907/tcp # Imoguia Port [Emidio_Cunha] [Emidio_Cunha] 2003-11 -imoguia-port 3907/udp # Imoguia Port [Emidio_Cunha] [Emidio_Cunha] 2003-11 -hppronetman 3908/tcp # HP Procurve NetManagement [Devon_Dawson] [Devon_Dawson] 2003-11 -hppronetman 3908/udp # HP Procurve NetManagement [Devon_Dawson] [Devon_Dawson] 2003-11 -surfcontrolcpa 3909/tcp # SurfControl CPA [Hywel_Morgan] [Hywel_Morgan] 2003-11 -surfcontrolcpa 3909/udp # SurfControl CPA [Hywel_Morgan] [Hywel_Morgan] 2003-11 -prnrequest 3910/tcp # Printer Request Port [Brett_Green] [Brett_Green] 2003-11 -prnrequest 3910/udp # Printer Request Port [Brett_Green] [Brett_Green] 2003-11 -prnstatus 3911/tcp # Printer Status Port [Brett_Green] [Brett_Green] 2003-11 -prnstatus 3911/udp # Printer Status Port [Brett_Green] [Brett_Green] 2003-11 -gbmt-stars 3912/tcp # Global Maintech Stars [Harry_Goldschmitt] [Harry_Goldschmitt] 2003-11 -gbmt-stars 3912/udp # Global Maintech Stars [Harry_Goldschmitt] [Harry_Goldschmitt] 2003-11 -listcrt-port 3913/tcp # ListCREATOR Port [Tomokazu_Asai] [Tomokazu_Asai] 2003-11 -listcrt-port 3913/udp # ListCREATOR Port [Tomokazu_Asai] [Tomokazu_Asai] 2003-11 -listcrt-port-2 3914/tcp # ListCREATOR Port 2 [Tomokazu_Asai] [Tomokazu_Asai] 2003-11 -listcrt-port-2 3914/udp # ListCREATOR Port 2 [Tomokazu_Asai] [Tomokazu_Asai] 2003-11 -agcat 3915/tcp # Auto-Graphics Cataloging [Paul_Cope] [Paul_Cope] 2003-11 -agcat 3915/udp # Auto-Graphics Cataloging [Paul_Cope] [Paul_Cope] 2003-11 -wysdmc 3916/tcp # WysDM Controller [Jim_McDonald_2] [Jim_McDonald_2] 2003-11 -wysdmc 3916/udp # WysDM Controller [Jim_McDonald_2] [Jim_McDonald_2] 2003-11 -aftmux 3917/tcp # AFT multiplex port [Alfred_Schmidt] [Alfred_Schmidt] 2003-11 -aftmux 3917/udp # AFT multiples port [Alfred_Schmidt] [Alfred_Schmidt] 2003-11 -pktcablemmcops 3918/tcp # PacketCableMultimediaCOPS [Eric_Rosenfeld] [Eric_Rosenfeld] 2003-11 -pktcablemmcops 3918/udp # PacketCableMultimediaCOPS [Eric_Rosenfeld] [Eric_Rosenfeld] 2003-11 -hyperip 3919/tcp # HyperIP [Dave_Reiland] [Dave_Reiland] 2003-11 -hyperip 3919/udp # HyperIP [Dave_Reiland] [Dave_Reiland] 2003-11 -exasoftport1 3920/tcp # Exasoft IP Port [Alan_Malik] [Alan_Malik] 2003-11 -exasoftport1 3920/udp # Exasoft IP Port [Alan_Malik] [Alan_Malik] 2003-11 -herodotus-net 3921/tcp # Herodotus Net [Adam_Gawne_Cain] [Adam_Gawne_Cain] 2003-11 -herodotus-net 3921/udp # Herodotus Net [Adam_Gawne_Cain] [Adam_Gawne_Cain] 2003-11 -sor-update 3922/tcp # Soronti Update Port [Carleton_Watkins] [Carleton_Watkins] 2003-11 -sor-update 3922/udp # Soronti Update Port [Carleton_Watkins] [Carleton_Watkins] 2003-11 -symb-sb-port 3923/tcp # Symbian Service Broker [Ian_McDowall] [Ian_McDowall] 2003-11 -symb-sb-port 3923/udp # Symbian Service Broker [Ian_McDowall] [Ian_McDowall] 2003-11 -mpl-gprs-port 3924/tcp # MPL_GPRS_PORT [David_Barrass_2] [David_Barrass_2] 2003-11 -mpl-gprs-port 3924/udp # MPL_GPRS_Port [David_Barrass_2] [David_Barrass_2] 2003-11 -zmp 3925/tcp # Zoran Media Port [Gerard_Cerchio] [Gerard_Cerchio] 2003-11 -zmp 3925/udp # Zoran Media Port [Gerard_Cerchio] [Gerard_Cerchio] 2003-11 -winport 3926/tcp # WINPort [Alwin_Egger] [Alwin_Egger] 2003-11 -winport 3926/udp # WINPort [Alwin_Egger] [Alwin_Egger] 2003-11 -natdataservice 3927/tcp # ScsTsr [Ghanshyam_Patel] [Ghanshyam_Patel] 2003-11 -natdataservice 3927/udp # ScsTsr [Ghanshyam_Patel] [Ghanshyam_Patel] 2003-11 -netboot-pxe 3928/tcp # PXE NetBoot Manager [Markus_Treinen] [Markus_Treinen] 2003-11 -netboot-pxe 3928/udp # PXE NetBoot Manager [Markus_Treinen] [Markus_Treinen] 2003-11 -smauth-port 3929/tcp # AMS Port [Angelique_Dokos] [Angelique_Dokos] 2003-11 -smauth-port 3929/udp # AMS Port [Angelique_Dokos] [Angelique_Dokos] 2003-11 -syam-webserver 3930/tcp # Syam Web Server Port [Michael_Daniele] [Michael_Daniele] 2003-11 -syam-webserver 3930/udp # Syam Web Server Port [Michael_Daniele] [Michael_Daniele] 2003-11 -msr-plugin-port 3931/tcp # MSR Plugin Port [Ron_Steed] [Ron_Steed] 2003-11 -msr-plugin-port 3931/udp # MSR Plugin Port [Ron_Steed] [Ron_Steed] 2003-11 -dyn-site 3932/tcp # Dynamic Site System [Steve_Qi] [Steve_Qi] 2003-11 -dyn-site 3932/udp # Dynamic Site System [Steve_Qi] [Steve_Qi] 2003-11 -plbserve-port 3933/tcp # PL/B App Server User Port [Edward_R_Boedecker] [Edward_R_Boedecker] 2003-11 -plbserve-port 3933/udp # PL/B App Server User Port [Edward_R_Boedecker] [Edward_R_Boedecker] 2003-11 -sunfm-port 3934/tcp # PL/B File Manager Port [Edward_R_Boedecker] [Edward_R_Boedecker] 2003-11 -sunfm-port 3934/udp # PL/B File Manager Port [Edward_R_Boedecker] [Edward_R_Boedecker] 2003-11 -sdp-portmapper 3935/tcp # SDP Port Mapper Protocol [James_Pinkerton] [James_Pinkerton] 2003-11 -sdp-portmapper 3935/udp # SDP Port Mapper Protocol [James_Pinkerton] [James_Pinkerton] 2003-11 -mailprox 3936/tcp # Mailprox [Christof_Drescher] [Christof_Drescher] 2003-11 -mailprox 3936/udp # Mailprox [Christof_Drescher] [Christof_Drescher] 2003-11 -dvbservdsc 3937/tcp # DVB Service Discovery [Bert_van_Willigen][Peter_MacAvock] [Bert_van_Willigen][Peter_MacAvock] 2003-11 -dvbservdsc 3937/udp # DVB Service Discovery [Bert_van_Willigen][Peter_MacAvock] [Bert_van_Willigen][Peter_MacAvock] 2003-11 -# Oracle dbControl Agent po -# -dbcontrol-agent 3938/tcp # IANA assigned this [Todd_Guay] [Todd_Guay] 2003-11 -# well-formed service name as -# a replacement for -# "dbcontrol_agent". -# This entry is an alias to "dbcontrol-agent". This entry is -dbcontrol_agent 3938/tcp # Oracle dbControl Agent po [Todd_Guay] [Todd_Guay] 2003-11 now historic, not usable for use with many common service -# discovery mechanisms. -# Oracel dbControl Agent po -# -dbcontrol-agent 3938/udp # IANA assigned this [Todd_Guay] [Todd_Guay] 2003-11 -# well-formed service name as -# a replacement for -# "dbcontrol_agent". -# This entry is an alias to "dbcontrol-agent". This entry is -dbcontrol_agent 3938/udp # Oracel dbControl Agent po [Todd_Guay] [Todd_Guay] 2003-11 now historic, not usable for use with many common service -# discovery mechanisms. -aamp 3939/tcp # Anti-virus Application [In_sik_Choi] [In_sik_Choi] 2002-02 -# Management Port -aamp 3939/udp # Anti-virus Application [In_sik_Choi] [In_sik_Choi] 2002-02 -# Management Port -xecp-node 3940/tcp # XeCP Node Service [Brent_McCullough] [Brent_McCullough] 2003-11 -xecp-node 3940/udp # XeCP Node Service [Brent_McCullough] [Brent_McCullough] 2003-11 -homeportal-web 3941/tcp # Home Portal Web Server [Christian_Beaumont] [Christian_Beaumont] 2003-11 -homeportal-web 3941/udp # Home Portal Web Server [Christian_Beaumont] [Christian_Beaumont] 2003-11 -srdp 3942/tcp # satellite distribution [Simone_Molendini] [Simone_Molendini] 2003-11 -srdp 3942/udp # satellite distribution [Simone_Molendini] [Simone_Molendini] 2003-11 -tig 3943/tcp # TetraNode Ip Gateway [B_van_Klinken] [B_van_Klinken] 2003-12 -tig 3943/udp # TetraNode Ip Gateway [B_van_Klinken] [B_van_Klinken] 2003-12 -sops 3944/tcp # S-Ops Management [Stefan_Hochuli] [Stefan_Hochuli] 2003-12 -sops 3944/udp # S-Ops Management [Stefan_Hochuli] [Stefan_Hochuli] 2003-12 -emcads 3945/tcp # EMCADS Server Port [Lars_Struwe_Christen] [Lars_Struwe_Christen] 2004-01 -emcads 3945/udp # EMCADS Server Port [Lars_Struwe_Christen] [Lars_Struwe_Christen] 2004-01 -backupedge 3946/tcp # BackupEDGE Server [Microlite_Corporation] [D_Thomas_Podnar] 2004-06 -backupedge 3946/udp # BackupEDGE Server [Microlite_Corporation] [D_Thomas_Podnar] 2004-06 -# Connect and Control Protocol -ccp 3947/tcp # for Consumer, Commercial, [Aaron_Myer] [Aaron_Myer] 2004-06 -# and Industrial Electronic -# Devices -# Connect and Control Protocol -ccp 3947/udp # for Consumer, Commercial, [Aaron_Myer] [Aaron_Myer] 2004-06 -# and Industrial Electronic -# Devices -apdap 3948/tcp # Anton Paar Device [Martin_Leitner] [Martin_Leitner] 2004-06 -# Administration Protocol -apdap 3948/udp # Anton Paar Device [Martin_Leitner] [Martin_Leitner] 2004-06 -# Administration Protocol -drip 3949/tcp # Dynamic Routing Information [Dana_Blair] [Dana_Blair] 2004-06 -# Protocol -drip 3949/udp # Dynamic Routing Information [Dana_Blair] [Dana_Blair] 2004-06 -# Protocol -namemunge 3950/tcp # Name Munging [John_C_Klensin] [John_C_Klensin] 2004-07 -namemunge 3950/udp # Name Munging [John_C_Klensin] [John_C_Klensin] 2004-07 -pwgippfax 3951/tcp # PWG IPP Facsimile [Ira_McDonald] [Ira_McDonald] 2004-08 -pwgippfax 3951/udp # PWG IPP Facsimile [Ira_McDonald] [Ira_McDonald] 2004-08 -i3-sessionmgr 3952/tcp # I3 Session Manager [Mike_Gagle_2] [Mike_Gagle_2] 2004-08 -i3-sessionmgr 3952/udp # I3 Session Manager [Mike_Gagle_2] [Mike_Gagle_2] 2004-08 -xmlink-connect 3953/tcp # Eydeas XMLink Connect [David_Crewson] [David_Crewson] 2004-09 -xmlink-connect 3953/udp # Eydeas XMLink Connect [David_Crewson] [David_Crewson] 2004-09 -adrep 3954/tcp # AD Replication RPC [Robert_Ball] [Robert_Ball] 2008-03-26 -adrep 3954/udp # AD Replication RPC [Robert_Ball] [Robert_Ball] 2008-03-26 -p2pcommunity 3955/tcp # p2pCommunity [Tiago_Bittencourt_Si] [Tiago_Bittencourt_Si] 2005-08 -p2pcommunity 3955/udp # p2pCommunity [Tiago_Bittencourt_Si] [Tiago_Bittencourt_Si] 2005-08 -gvcp 3956/tcp # GigE Vision Control [Eric_Carey] [Eric_Carey] 2005-08 -gvcp 3956/udp # GigE Vision Control [Eric_Carey] [Eric_Carey] 2005-08 -mqe-broker 3957/tcp # MQEnterprise Broker -mqe-broker 3957/udp # MQEnterprise Broker -mqe-agent 3958/tcp # MQEnterprise Agent [Bob_Lauria] [Bob_Lauria] 2005-08 -mqe-agent 3958/udp # MQEnterprise Agent [Bob_Lauria] [Bob_Lauria] 2005-08 -treehopper 3959/tcp # Tree Hopper Networking [Gary_Whelan] [Gary_Whelan] 2005-08 -treehopper 3959/udp # Tree Hopper Networking [Gary_Whelan] [Gary_Whelan] 2005-08 -bess 3960/tcp # Bess Peer Assessment [Peter_Verdon] [Peter_Verdon] 2005-08 -bess 3960/udp # Bess Peer Assessment [Peter_Verdon] [Peter_Verdon] 2005-08 -proaxess 3961/tcp # ProAxess Server [Jonas_Ahlqvist] [Jonas_Ahlqvist] 2005-08 -proaxess 3961/udp # ProAxess Server [Jonas_Ahlqvist] [Jonas_Ahlqvist] 2005-08 -sbi-agent 3962/tcp # SBI Agent Protocol [Yossi_Appleboum_2] [Yossi_Appleboum_2] 2005-08 -sbi-agent 3962/udp # SBI Agent Protocol [Yossi_Appleboum_2] [Yossi_Appleboum_2] 2005-08 -thrp 3963/tcp # Teran Hybrid Routing [Spencer_Teran] [Spencer_Teran] 2005-08 -# Protocol -thrp 3963/udp # Teran Hybrid Routing [Spencer_Teran] [Spencer_Teran] 2005-08 -# Protocol -sasggprs 3964/tcp # SASG GPRS [Cristian_Petculescu_3] [Cristian_Petculescu_3] 2005-08 -sasggprs 3964/udp # SASG GPRS [Cristian_Petculescu_3] [Cristian_Petculescu_3] 2005-08 -ati-ip-to-ncpe 3965/tcp # Avanti IP to NCPE API [Steve_Meyer_Sr] [Steve_Meyer_Sr] 2005-08 -ati-ip-to-ncpe 3965/udp # Avanti IP to NCPE API [Steve_Meyer_Sr] [Steve_Meyer_Sr] 2005-08 -bflckmgr 3966/tcp # BuildForge Lock Manager [Joe_Senner] [Joe_Senner] 2005-08 -bflckmgr 3966/udp # BuildForge Lock Manager [Joe_Senner] [Joe_Senner] 2005-08 -ppsms 3967/tcp # PPS Message Service [Bart_Schaefer] [Bart_Schaefer] 2005-08 -ppsms 3967/udp # PPS Message Service [Bart_Schaefer] [Bart_Schaefer] 2005-08 -ianywhere-dbns 3968/tcp # iAnywhere DBNS [Graeme_Perrow] [Graeme_Perrow] 2005-08 -ianywhere-dbns 3968/udp # iAnywhere DBNS [Graeme_Perrow] [Graeme_Perrow] 2005-08 -landmarks 3969/tcp # Landmark Messages [Petri_Rauhala] [Petri_Rauhala] 2005-08 -landmarks 3969/udp # Landmark Messages [Petri_Rauhala] [Petri_Rauhala] 2005-08 -# Defined TXT keys: -# txtvers -lanrevagent 3970/tcp # LANrev Agent [Martin_Bestmann_3] [Martin_Bestmann_3] server=
-# vers= -# build= -# id= -# Defined TXT keys: -# txtvers -lanrevagent 3970/udp # LANrev Agent [Martin_Bestmann_3] [Martin_Bestmann_3] server=
-# vers= -# build= -# id= -lanrevserver 3971/tcp # LANrev Server [Martin_Bestmann_3] [Martin_Bestmann_3] 2005-08 -lanrevserver 3971/udp # LANrev Server [Martin_Bestmann_3] [Martin_Bestmann_3] 2005-08 -iconp 3972/tcp # ict-control Protocol [Roel_Harbers] [Roel_Harbers] 2005-08 -iconp 3972/udp # ict-control Protocol [Roel_Harbers] [Roel_Harbers] 2005-08 -progistics 3973/tcp # ConnectShip Progistics [Jeff_Skaistis] [Jeff_Skaistis] 2005-08 -progistics 3973/udp # ConnectShip Progistics [Jeff_Skaistis] [Jeff_Skaistis] 2005-08 -citysearch 3974/tcp # Remote Applicant Tracking [Marc_Castelluccio] [Marc_Castelluccio] 2005-08 -# Service -citysearch 3974/udp # Remote Applicant Tracking [Marc_Castelluccio] [Marc_Castelluccio] 2005-08 -# Service -airshot 3975/tcp # Air Shot [Shingo_Kimura] [Shingo_Kimura] 2005-08 -airshot 3975/udp # Air Shot [Shingo_Kimura] [Shingo_Kimura] 2005-08 -opswagent 3976/tcp # Opsware Agent -opswagent 3976/udp # Opsware Agent -opswmanager 3977/tcp # Opsware Manager [Dave_Jagoda] [Dave_Jagoda] 2006-06 -opswmanager 3977/udp # Opsware Manager [Dave_Jagoda] [Dave_Jagoda] 2006-06 -secure-cfg-svr 3978/tcp # Secured Configuration Server [Dr_Anupam_Bharali] [Dr_Anupam_Bharali] 2006-06 -secure-cfg-svr 3978/udp # Secured Configuration Server [Dr_Anupam_Bharali] [Dr_Anupam_Bharali] 2006-06 -smwan 3979/tcp # Smith Micro Wide Area [David_Sperling] [David_Sperling] 2006-06 -# Network Service -smwan 3979/udp # Smith Micro Wide Area [David_Sperling] [David_Sperling] 2006-06 -# Network Service -acms 3980/tcp # Aircraft Cabin Management [Dustin_Zack] [Dustin_Zack] 2006-06 -# System -acms 3980/udp # Aircraft Cabin Management [Dustin_Zack] [Dustin_Zack] 2006-06 -# System -starfish 3981/tcp # Starfish System Admin [Dan_Razzell] [Dan_Razzell] 2006-06 -starfish 3981/udp # Starfish System Admin [Dan_Razzell] [Dan_Razzell] 2006-06 -eis 3982/tcp # ESRI Image Server -eis 3982/udp # ESRI Image Server -eisp 3983/tcp # ESRI Image Service [Keith_Ryden] [Keith_Ryden] 2006-07 -eisp 3983/udp # ESRI Image Service [Keith_Ryden] [Keith_Ryden] 2006-07 -mapper-nodemgr 3984/tcp # MAPPER network node manager -mapper-nodemgr 3984/udp # MAPPER network node manager -mapper-mapethd 3985/tcp # MAPPER TCP/IP server -mapper-mapethd 3985/udp # MAPPER TCP/IP server -# MAPPER workstation server -# -mapper-ws-ethd 3986/tcp # IANA assigned this [John_C_Horton] [John_C_Horton] -# well-formed service name as -# a replacement for -# "mapper-ws_ethd". -# This entry is an alias to "mapper-ws-ethd". This entry is now -mapper-ws_ethd 3986/tcp # MAPPER workstation server [John_C_Horton] [John_C_Horton] historic, not usable for use with many common service -# discovery mechanisms. -# MAPPER workstation server -# -mapper-ws-ethd 3986/udp # IANA assigned this [John_C_Horton] [John_C_Horton] -# well-formed service name as -# a replacement for -# "mapper-ws_ethd". -# This entry is an alias to "mapper-ws-ethd". This entry is now -mapper-ws_ethd 3986/udp # MAPPER workstation server [John_C_Horton] [John_C_Horton] historic, not usable for use with many common service -# discovery mechanisms. -centerline 3987/tcp # Centerline [Mark_Simpson] [Mark_Simpson] -centerline 3987/udp # Centerline [Mark_Simpson] [Mark_Simpson] -dcs-config 3988/tcp # DCS Configuration Port [Ian_Cargill] [Ian_Cargill] 2005-08 -dcs-config 3988/udp # DCS Configuration Port [Ian_Cargill] [Ian_Cargill] 2005-08 -bv-queryengine 3989/tcp # BindView-Query Engine -bv-queryengine 3989/udp # BindView-Query Engine -bv-is 3990/tcp # BindView-IS -bv-is 3990/udp # BindView-IS -bv-smcsrv 3991/tcp # BindView-SMCServer -bv-smcsrv 3991/udp # BindView-SMCServer -bv-ds 3992/tcp # BindView-DirectoryServer -bv-ds 3992/udp # BindView-DirectoryServer -bv-agent 3993/tcp # BindView-Agent [David_A_Gayler] [David_A_Gayler] 2005-08 -bv-agent 3993/udp # BindView-Agent [David_A_Gayler] [David_A_Gayler] 2005-08 -# 3994 Unassigned 2008-04-24 -iss-mgmt-ssl 3995/tcp # ISS Management Svcs SSL [Wes_Wilson] [Wes_Wilson] 2003-10 -iss-mgmt-ssl 3995/udp # ISS Management Svcs SSL [Wes_Wilson] [Wes_Wilson] 2003-10 -abcsoftware 3996/tcp # abcsoftware-01 [Andrew_Zimmerman] [Andrew_Zimmerman] 2004-06 -abcsoftware 3996/udp # abcsoftware-01 [Andrew_Zimmerman] [Andrew_Zimmerman] 2004-06 -agentsease-db 3997/tcp # aes_db [Colin_Hughes] [Colin_Hughes] 2006-02 -agentsease-db 3997/udp # aes_db [Colin_Hughes] [Colin_Hughes] 2006-02 -dnx 3998/tcp # Distributed Nagios Executor [John_Calcote] [John_Calcote] 2007-11-06 -# Service -dnx 3998/udp # Distributed Nagios Executor [John_Calcote] [John_Calcote] 2007-11-06 -# Service -nvcnet 3999/tcp # Norman distributes scanning [Kristian_A_Bognaes] [Kristian_A_Bognaes] 2007-11-06 -# service -nvcnet 3999/udp # Norman distributes scanning [Kristian_A_Bognaes] [Kristian_A_Bognaes] 2007-11-06 -# service -terabase 4000/tcp # Terabase [Thor_Olson] [Thor_Olson] Potential Conflict of ports PORT 4000 also used by ICQ -# -terabase 4000/udp # Terabase [Thor_Olson] [Thor_Olson] Potential Conflict of ports PORT 4000 also used by ICQ -# -newoak 4001/tcp # NewOak [Jim_Philippou] [Jim_Philippou] -newoak 4001/udp # NewOak [Jim_Philippou] [Jim_Philippou] -pxc-spvr-ft 4002/tcp # pxc-spvr-ft -pxc-spvr-ft 4002/udp # pxc-spvr-ft -pxc-splr-ft 4003/tcp # pxc-splr-ft -pxc-splr-ft 4003/udp # pxc-splr-ft -pxc-roid 4004/tcp # pxc-roid -pxc-roid 4004/udp # pxc-roid -pxc-pin 4005/tcp # pxc-pin -pxc-pin 4005/udp # pxc-pin -pxc-spvr 4006/tcp # pxc-spvr -pxc-spvr 4006/udp # pxc-spvr -pxc-splr 4007/tcp # pxc-splr [Dave_Nesbitt] [Dave_Nesbitt] -pxc-splr 4007/udp # pxc-splr [Dave_Nesbitt] [Dave_Nesbitt] -netcheque 4008/tcp # NetCheque accounting [B_Clifford_Neuman] [B_Clifford_Neuman] -netcheque 4008/udp # NetCheque accounting [B_Clifford_Neuman] [B_Clifford_Neuman] -chimera-hwm 4009/tcp # Chimera HWM [Ken_Anderson] [Ken_Anderson] -chimera-hwm 4009/udp # Chimera HWM [Ken_Anderson] [Ken_Anderson] -samsung-unidex 4010/tcp # Samsung Unidex [Konstantin_V_Vyazni] [Konstantin_V_Vyazni] -samsung-unidex 4010/udp # Samsung Unidex [Konstantin_V_Vyazni] [Konstantin_V_Vyazni] -altserviceboot 4011/tcp # Alternate Service Boot [Eric_Dittert] [Eric_Dittert] -altserviceboot 4011/udp # Alternate Service Boot [Eric_Dittert] [Eric_Dittert] -pda-gate 4012/tcp # PDA Gate [Masakuni_Okada] [Masakuni_Okada] -pda-gate 4012/udp # PDA Gate [Masakuni_Okada] [Masakuni_Okada] -acl-manager 4013/tcp # ACL Manager [Toru_Murai] [Toru_Murai] -acl-manager 4013/udp # ACL Manager [Toru_Murai] [Toru_Murai] -taiclock 4014/tcp # TAICLOCK [Dan_Bernstein_3] [Dan_Bernstein_3] -taiclock 4014/udp # TAICLOCK [Dan_Bernstein_3] [Dan_Bernstein_3] -talarian-mcast1 4015/tcp # Talarian Mcast -talarian-mcast1 4015/udp # Talarian Mcast -talarian-mcast2 4016/tcp # Talarian Mcast -talarian-mcast2 4016/udp # Talarian Mcast -talarian-mcast3 4017/tcp # Talarian Mcast -talarian-mcast3 4017/udp # Talarian Mcast -talarian-mcast4 4018/tcp # Talarian Mcast -talarian-mcast4 4018/udp # Talarian Mcast -talarian-mcast5 4019/tcp # Talarian Mcast [Geoff_Mendal] [Geoff_Mendal] -talarian-mcast5 4019/udp # Talarian Mcast [Geoff_Mendal] [Geoff_Mendal] -trap 4020/tcp # TRAP Port [Jeffrey_C_Byrd] [Jeffrey_C_Byrd] -trap 4020/udp # TRAP Port [Jeffrey_C_Byrd] [Jeffrey_C_Byrd] -nexus-portal 4021/tcp # Nexus Portal [Damian_Tarnawsky] [Damian_Tarnawsky] -nexus-portal 4021/udp # Nexus Portal [Damian_Tarnawsky] [Damian_Tarnawsky] -dnox 4022/tcp # DNOX [Leo_Rathnayake] [Leo_Rathnayake] -dnox 4022/udp # DNOX [Leo_Rathnayake] [Leo_Rathnayake] -esnm-zoning 4023/tcp # ESNM Zoning Port [Yong_Cai] [Yong_Cai] -esnm-zoning 4023/udp # ESNM Zoning Port [Yong_Cai] [Yong_Cai] -tnp1-port 4024/tcp # TNP1 User Port [Tony_Gibbs] [Tony_Gibbs] -tnp1-port 4024/udp # TNP1 User Port [Tony_Gibbs] [Tony_Gibbs] -partimage 4025/tcp # Partition Image Port [Franck_Ladurelle] [Franck_Ladurelle] -partimage 4025/udp # Partition Image Port [Franck_Ladurelle] [Franck_Ladurelle] -as-debug 4026/tcp # Graphical Debug Server [Steve_Halverson] [Steve_Halverson] -as-debug 4026/udp # Graphical Debug Server [Steve_Halverson] [Steve_Halverson] -bxp 4027/tcp # bitxpress [Morgan_Doyle] [Morgan_Doyle] -bxp 4027/udp # bitxpress [Morgan_Doyle] [Morgan_Doyle] -dtserver-port 4028/tcp # DTServer Port [Stephen_Aikins] [Stephen_Aikins] -dtserver-port 4028/udp # DTServer Port [Stephen_Aikins] [Stephen_Aikins] -ip-qsig 4029/tcp # IP Q signaling protocol [Toru_Tachibana] [Toru_Tachibana] -ip-qsig 4029/udp # IP Q signaling protocol [Toru_Tachibana] [Toru_Tachibana] -jdmn-port 4030/tcp # Accell/JSP Daemon Port [Daegis_Inc] [Chris_Anderson] 2012-07-12 -jdmn-port 4030/udp # Accell/JSP Daemon Port [Daegis_Inc] [Chris_Anderson] 2012-07-12 -suucp 4031/tcp # UUCP over SSL [Harald_Welte] [Harald_Welte] -suucp 4031/udp # UUCP over SSL [Harald_Welte] [Harald_Welte] -vrts-auth-port 4032/tcp # VERITAS Authorization [Stefan_Winkel] [Stefan_Winkel] -# Service -vrts-auth-port 4032/udp # VERITAS Authorization [Stefan_Winkel] [Stefan_Winkel] -# Service -sanavigator 4033/tcp # SANavigator Peer Port [Robert_J_Chansler] [Robert_J_Chansler] -sanavigator 4033/udp # SANavigator Peer Port [Robert_J_Chansler] [Robert_J_Chansler] -ubxd 4034/tcp # Ubiquinox Daemon [Kit_Smithers] [Kit_Smithers] -ubxd 4034/udp # Ubiquinox Daemon [Kit_Smithers] [Kit_Smithers] -wap-push-http 4035/tcp # WAP Push OTA-HTTP port -wap-push-http 4035/udp # WAP Push OTA-HTTP port -wap-push-https 4036/tcp # WAP Push OTA-HTTP secure [Matthieu_Lachance] [Matthieu_Lachance] -wap-push-https 4036/udp # WAP Push OTA-HTTP secure [Matthieu_Lachance] [Matthieu_Lachance] -ravehd 4037/tcp # RaveHD network control [Jason_Howard] [Jason_Howard] 2006-01 -ravehd 4037/udp # RaveHD network control [Jason_Howard] [Jason_Howard] 2006-01 -fazzt-ptp 4038/tcp # Fazzt Point-To-Point -fazzt-ptp 4038/udp # Fazzt Point-To-Point -fazzt-admin 4039/tcp # Fazzt Administration [Lewis_Wolfgang] [Lewis_Wolfgang] 2006-05 -fazzt-admin 4039/udp # Fazzt Administration [Lewis_Wolfgang] [Lewis_Wolfgang] 2006-05 -yo-main 4040/tcp # Yo.net main service [John_Tintor] [John_Tintor] -yo-main 4040/udp # Yo.net main service [John_Tintor] [John_Tintor] -houston 4041/tcp # Rocketeer-Houston [Johnny_C_Norris_II] [Johnny_C_Norris_II] -houston 4041/udp # Rocketeer-Houston [Johnny_C_Norris_II] [Johnny_C_Norris_II] -ldxp 4042/tcp # LDXP [Craig_Calef] [Craig_Calef] -ldxp 4042/udp # LDXP [Craig_Calef] [Craig_Calef] -nirp 4043/tcp # Neighbour Identity -# Resolution -nirp 4043/udp # Neighbour Identity -# Resolution -ltp 4044/tcp # Location Tracking Protocol -ltp 4044/udp # Location Tracking Protocol -# Known -npp 4045/tcp # Network Paging Protocol UNAUTHORIZED -# USE: Port -# 4045 -# Known -npp 4045/udp # Network Paging Protocol UNAUTHORIZED -# USE: Port -# 4045 -acp-proto 4046/tcp # Accounting Protocol -acp-proto 4046/udp # Accounting Protocol -ctp-state 4047/tcp # Context Transfer Protocol [Hesham_Soliman] [Hesham_Soliman] 2005-11 -ctp-state 4047/udp # Context Transfer Protocol [Hesham_Soliman] [Hesham_Soliman] 2005-11 -# 4048 Unassigned 2008-04-24 -wafs 4049/tcp # Wide Area File Services [Yuval_Hager] [Yuval_Hager] 2006-01 -wafs 4049/udp # Wide Area File Services [Yuval_Hager] [Yuval_Hager] 2006-01 -cisco-wafs 4050/tcp # Wide Area File Services [Etai_Lev_Ran] [Etai_Lev_Ran] 2005-02 -cisco-wafs 4050/udp # Wide Area File Services [Etai_Lev_Ran] [Etai_Lev_Ran] 2005-02 -cppdp 4051/tcp # Cisco Peer to Peer [Susan_Sauter] [Susan_Sauter] 2006-07 -# Distribution Protocol -cppdp 4051/udp # Cisco Peer to Peer [Susan_Sauter] [Susan_Sauter] 2006-07 -# Distribution Protocol -interact 4052/tcp # VoiceConnect Interact [Jonathan_Custance] [Jonathan_Custance] 2006-07 -interact 4052/udp # VoiceConnect Interact [Jonathan_Custance] [Jonathan_Custance] 2006-07 -ccu-comm-1 4053/tcp # CosmoCall Universe -# Communications Port 1 -ccu-comm-1 4053/udp # CosmoCall Universe -# Communications Port 1 -ccu-comm-2 4054/tcp # CosmoCall Universe -# Communications Port 2 -ccu-comm-2 4054/udp # CosmoCall Universe -# Communications Port 2 -ccu-comm-3 4055/tcp # CosmoCall Universe [Steve_Dellutri_2] [Steve_Dellutri_2] 2006-07 -# Communications Port 3 -ccu-comm-3 4055/udp # CosmoCall Universe [Steve_Dellutri_2] [Steve_Dellutri_2] 2006-07 -# Communications Port 3 -lms 4056/tcp # Location Message Service [Sergey_Burnevsky] [Sergey_Burnevsky] 2006-08 -lms 4056/udp # Location Message Service [Sergey_Burnevsky] [Sergey_Burnevsky] 2006-08 -wfm 4057/tcp # Servigistics WFM server [Yuri_Machkasov_2] [Yuri_Machkasov_2] 2006-08 -wfm 4057/udp # Servigistics WFM server [Yuri_Machkasov_2] [Yuri_Machkasov_2] 2006-08 -kingfisher 4058/tcp # Kingfisher protocol [Vaughan_Wesson] [Vaughan_Wesson] 2006-10 -kingfisher 4058/udp # Kingfisher protocol [Vaughan_Wesson] [Vaughan_Wesson] 2006-10 -dlms-cosem 4059/tcp # DLMS/COSEM [Gyozo_Kmethy] [Gyozo_Kmethy] 2006-11 -dlms-cosem 4059/udp # DLMS/COSEM [Gyozo_Kmethy] [Gyozo_Kmethy] 2006-11 -# DSMETER Inter-Agent Transfer -# Channel -# -dsmeter-iatc 4060/tcp # IANA assigned this [John_McCann] [John_McCann] 2006-12 -# well-formed service name as -# a replacement for -# "dsmeter_iatc". -# DSMETER Inter-Agent Transfer This entry is an alias to "dsmeter-iatc". This entry is now -dsmeter_iatc 4060/tcp # Channel [John_McCann] [John_McCann] 2006-12 historic, not usable for use with many common service -# discovery mechanisms. -# DSMETER Inter-Agent Transfer -# Channel -# -dsmeter-iatc 4060/udp # IANA assigned this [John_McCann] [John_McCann] 2006-12 -# well-formed service name as -# a replacement for -# "dsmeter_iatc". -# DSMETER Inter-Agent Transfer This entry is an alias to "dsmeter-iatc". This entry is now -dsmeter_iatc 4060/udp # Channel [John_McCann] [John_McCann] 2006-12 historic, not usable for use with many common service -# discovery mechanisms. -ice-location 4061/tcp # Ice Location Service (TCP) -ice-location 4061/udp # Ice Location Service (TCP) -ice-slocation 4062/tcp # Ice Location Service (SSL) -ice-slocation 4062/udp # Ice Location Service (SSL) -ice-router 4063/tcp # Ice Firewall Traversal -# Service (TCP) -ice-router 4063/udp # Ice Firewall Traversal -# Service (TCP) -ice-srouter 4064/tcp # Ice Firewall Traversal [Bernard_Normier] [Bernard_Normier] 2006-12 -# Service (SSL) -ice-srouter 4064/udp # Ice Firewall Traversal [Bernard_Normier] [Bernard_Normier] 2006-12 -# Service (SSL) -# Avanti Common Data -# -avanti-cdp 4065/tcp # IANA assigned this [Steve_Meyer_Sr] [Steve_Meyer_Sr] 2007-02 -# well-formed service name as -# a replacement for -# "avanti_cdp". -# This entry is an alias to "avanti-cdp". This entry is now -avanti_cdp 4065/tcp # Avanti Common Data [Steve_Meyer_Sr] [Steve_Meyer_Sr] 2007-02 historic, not usable for use with many common service -# discovery mechanisms. -# Avanti Common Data -# -avanti-cdp 4065/udp # IANA assigned this [Steve_Meyer_Sr] [Steve_Meyer_Sr] 2007-02 -# well-formed service name as -# a replacement for -# "avanti_cdp". -# This entry is an alias to "avanti-cdp". This entry is now -avanti_cdp 4065/udp # Avanti Common Data [Steve_Meyer_Sr] [Steve_Meyer_Sr] 2007-02 historic, not usable for use with many common service -# discovery mechanisms. -pmas 4066/tcp # Performance Measurement and [Zenon_Fortuna] [Zenon_Fortuna] 2007-02 -# Analysis -pmas 4066/udp # Performance Measurement and [Zenon_Fortuna] [Zenon_Fortuna] 2007-02 -# Analysis -idp 4067/tcp # Information Distribution [Michaela_Vanderveen] [Michaela_Vanderveen] 2007-02 -# Protocol -idp 4067/udp # Information Distribution [Michaela_Vanderveen] [Michaela_Vanderveen] 2007-02 -# Protocol -ipfltbcst 4068/tcp # IP Fleet Broadcast [Trung_Huu_Tran] [Trung_Huu_Tran] 2007-03 -ipfltbcst 4068/udp # IP Fleet Broadcast [Trung_Huu_Tran] [Trung_Huu_Tran] 2007-03 -minger 4069/tcp # Minger Email Address [Arvel_Hathcock] [Arvel_Hathcock] 2007-03 -# Validation Service -minger 4069/udp # Minger Email Address [Arvel_Hathcock] [Arvel_Hathcock] 2007-03 -# Validation Service -tripe 4070/tcp # Trivial IP Encryption [Mark_Wooding] [Mark_Wooding] 2007-07-10 -# (TrIPE) -tripe 4070/udp # Trivial IP Encryption [Mark_Wooding] [Mark_Wooding] 2007-07-10 -# (TrIPE) -aibkup 4071/tcp # Automatically Incremental [Volker_Wiegand] [Volker_Wiegand] 2007-07-10 -# Backup -aibkup 4071/udp # Automatically Incremental [Volker_Wiegand] [Volker_Wiegand] 2007-07-10 -# Backup -zieto-sock 4072/tcp # Zieto Socket Communications [Malcolm_McLean] [Malcolm_McLean] 2007-07-19 -zieto-sock 4072/udp # Zieto Socket Communications [Malcolm_McLean] [Malcolm_McLean] 2007-07-19 -iRAPP 4073/tcp # iRAPP Server Protocol [Vladimir_Bickov] [Vladimir_Bickov] 2007-08-20 -iRAPP 4073/udp # iRAPP Server Protocol [Vladimir_Bickov] [Vladimir_Bickov] 2007-08-20 -cequint-cityid 4074/tcp # Cequint City ID UI trigger [Phill_Goeckler] [Phill_Goeckler] 2007-08-20 -cequint-cityid 4074/udp # Cequint City ID UI trigger [Phill_Goeckler] [Phill_Goeckler] 2007-08-20 -perimlan 4075/tcp # ISC Alarm Message Service [Bernie_Malkowski] [Bernie_Malkowski] 2007-08-20 -perimlan 4075/udp # ISC Alarm Message Service [Bernie_Malkowski] [Bernie_Malkowski] 2007-08-20 -seraph 4076/tcp # Seraph DCS [Jason_Spence] [Jason_Spence] 2008-01-22 -seraph 4076/udp # Seraph DCS [Jason_Spence] [Jason_Spence] 2008-01-22 -# 4077 tcp Reserved -ascomalarm 4077/udp # Ascom IP Alarming [Ascom_Austria_GmbH] [Ascom_Austria_GmbH] 2008-05-01 -cssp 4078/tcp # Coordinated Security Service [Michael_McDaniels] [Michael_McDaniels] 2008-05-01 -# Protocol -# 4078 udp Reserved -santools 4079/tcp # SANtools Diagnostic Server [David_A_Lethe_2] [David_A_Lethe_2] 2008-05-01 -santools 4079/udp # SANtools Diagnostic Server [David_A_Lethe_2] [David_A_Lethe_2] 2008-05-01 -lorica-in 4080/tcp # Lorica inside facing -lorica-in 4080/udp # Lorica inside facing -lorica-in-sec 4081/tcp # Lorica inside facing (SSL) -lorica-in-sec 4081/udp # Lorica inside facing (SSL) -lorica-out 4082/tcp # Lorica outside facing -lorica-out 4082/udp # Lorica outside facing -lorica-out-sec 4083/tcp # Lorica outside facing (SSL) [Johannes_Skov_Frands] [Johannes_Skov_Frands] 2008-02-28 -lorica-out-sec 4083/udp # Lorica outside facing (SSL) [Johannes_Skov_Frands] [Johannes_Skov_Frands] 2008-02-28 -# 4084 tcp Reserved -fortisphere-vm 4084/udp # Fortisphere VM Service [Daniel_Becker_4] [Daniel_Becker_4] 2008-06-03 -ezmessagesrv 4085/tcp # EZNews Newsroom Message [Gerald_R_Jensen] [Gerald_R_Jensen] 2008-06-05 -# Service -# 4085 udp Reserved -# 4086 tcp Reserved -ftsync 4086/udp # Firewall/NAT state table [Heiner_Erne] [Heiner_Erne] 2008-06-06 -# synchronization -applusservice 4087/tcp # APplus Service [Thomas_Boerkel] [Thomas_Boerkel] 2008-06-05 -# 4087 udp Reserved -npsp 4088/tcp # Noah Printing Service [Hiromi_Ohara] [Hiromi_Ohara] 2008-06-18 -# Protocol -# 4088 udp Reserved -opencore 4089/tcp # OpenCORE Remote Control [Pim_van_Riezen] [Pim_van_Riezen] 2006-07 -# Service -opencore 4089/udp # OpenCORE Remote Control [Pim_van_Riezen] [Pim_van_Riezen] 2006-07 -# Service -omasgport 4090/tcp # OMA BCAST Service Guide [Mark_Lipford] [Mark_Lipford] 2006-07 -omasgport 4090/udp # OMA BCAST Service Guide [Mark_Lipford] [Mark_Lipford] 2006-07 -ewinstaller 4091/tcp # EminentWare Installer -ewinstaller 4091/udp # EminentWare Installer -ewdgs 4092/tcp # EminentWare DGS [David_A_Gayler_2] [David_A_Gayler_2] 2006-07 -ewdgs 4092/udp # EminentWare DGS [David_A_Gayler_2] [David_A_Gayler_2] 2006-07 -pvxpluscs 4093/tcp # Pvx Plus CS Host [Michael_King] [Michael_King] 2006-07 -pvxpluscs 4093/udp # Pvx Plus CS Host [Michael_King] [Michael_King] 2006-07 -sysrqd 4094/tcp # sysrq daemon [Julien_Danjou] [Julien_Danjou] 2006-07 -sysrqd 4094/udp # sysrq daemon [Julien_Danjou] [Julien_Danjou] 2006-07 -xtgui 4095/tcp # xtgui information service [Jim_Robanske] [Jim_Robanske] 2006-05 -xtgui 4095/udp # xtgui information service [Jim_Robanske] [Jim_Robanske] 2006-05 -bre 4096/tcp # BRE (Bridge Relay Element) [Stephen_Egbert] [Stephen_Egbert] -bre 4096/udp # BRE (Bridge Relay Element) [Stephen_Egbert] [Stephen_Egbert] -patrolview 4097/tcp # Patrol View [Portnoy_Boxman] [Portnoy_Boxman] -patrolview 4097/udp # Patrol View [Portnoy_Boxman] [Portnoy_Boxman] -drmsfsd 4098/tcp # drmsfsd [Masao_Iwai] [Masao_Iwai] -drmsfsd 4098/udp # drmsfsd [Masao_Iwai] [Masao_Iwai] -dpcp 4099/tcp # DPCP [John_Croft] [John_Croft] -dpcp 4099/udp # DPCP [John_Croft] [John_Croft] -igo-incognito 4100/tcp # IGo Incognito Data Port [Paul_Reddy_2] [Paul_Reddy_2] 2002-02 -igo-incognito 4100/udp # IGo Incognito Data Port [Paul_Reddy_2] [Paul_Reddy_2] 2002-02 -brlp-0 4101/tcp # Braille protocol -brlp-0 4101/udp # Braille protocol -brlp-1 4102/tcp # Braille protocol -brlp-1 4102/udp # Braille protocol -brlp-2 4103/tcp # Braille protocol -brlp-2 4103/udp # Braille protocol -brlp-3 4104/tcp # Braille protocol [Sebastien_Hinderer] [Sebastien_Hinderer] 2006-03 -brlp-3 4104/udp # Braille protocol [Sebastien_Hinderer] [Sebastien_Hinderer] 2006-03 -shofar 4105/tcp # Shofar [ShofarNexus] [John_Kozlowski] 2006-07 2012-02-20 -shofar 4105/udp # Shofar [ShofarNexus] [John_Kozlowski] 2006-07 2012-02-20 -synchronite 4106/tcp # Synchronite [James_Figgins] [James_Figgins] 2006-07 -synchronite 4106/udp # Synchronite [James_Figgins] [James_Figgins] 2006-07 -j-ac 4107/tcp # JDL Accounting LAN Service [Takashi_Sahara] [Takashi_Sahara] 2006-09 -j-ac 4107/udp # JDL Accounting LAN Service [Takashi_Sahara] [Takashi_Sahara] 2006-09 -accel 4108/tcp # ACCEL [Masahiro_Koiwai] [Masahiro_Koiwai] 2006-10 -accel 4108/udp # ACCEL [Masahiro_Koiwai] [Masahiro_Koiwai] 2006-10 -izm 4109/tcp # Instantiated Zero-control [David_Miller] [David_Miller] 2007-02 -# Messaging -izm 4109/udp # Instantiated Zero-control [David_Miller] [David_Miller] 2007-02 -# Messaging -g2tag 4110/tcp # G2 RFID Tag Telemetry Data [David_Goodall] [David_Goodall] 2007-02 -g2tag 4110/udp # G2 RFID Tag Telemetry Data [David_Goodall] [David_Goodall] 2007-02 -xgrid 4111/tcp # Xgrid [David_Kramer] [David_Kramer] 2004-11 -xgrid 4111/udp # Xgrid [David_Kramer] [David_Kramer] 2004-11 -apple-vpns-rp 4112/tcp # Apple VPN Server Reporting [Christophe_Allie] [Christophe_Allie] 2006-08 -# Protocol -apple-vpns-rp 4112/udp # Apple VPN Server Reporting [Christophe_Allie] [Christophe_Allie] 2006-08 -# Protocol -aipn-reg 4113/tcp # AIPN LS Registration [Qiang_Zhang_2] [Qiang_Zhang_2] 2006-10 -aipn-reg 4113/udp # AIPN LS Registration [Qiang_Zhang_2] [Qiang_Zhang_2] 2006-10 -jomamqmonitor 4114/tcp # JomaMQMonitor [Marcel_Hofstetter] [Marcel_Hofstetter] 2003-01 -jomamqmonitor 4114/udp # JomaMQMonitor [Marcel_Hofstetter] [Marcel_Hofstetter] 2003-01 -cds 4115/tcp # CDS Transfer Agent [Neil_Coggins] [Neil_Coggins] 2006-07 -cds 4115/udp # CDS Transfer Agent [Neil_Coggins] [Neil_Coggins] 2006-07 -smartcard-tls 4116/tcp # smartcard-TLS [Ilan_Mahalal] [Ilan_Mahalal] 2006-04 -smartcard-tls 4116/udp # smartcard-TLS [Ilan_Mahalal] [Ilan_Mahalal] 2006-04 -hillrserv 4117/tcp # Hillr Connection Manager [Freddy_A_Ayuso_Hens] [Freddy_A_Ayuso_Hens] 2008-05-22 -hillrserv 4117/udp # Hillr Connection Manager [Freddy_A_Ayuso_Hens] [Freddy_A_Ayuso_Hens] 2008-05-22 -netscript 4118/tcp # Netadmin Systems NETscript [Goran_Runfeldt] [Goran_Runfeldt] 2006-12 -# service -netscript 4118/udp # Netadmin Systems NETscript [Goran_Runfeldt] [Goran_Runfeldt] 2006-12 -# service -assuria-slm 4119/tcp # Assuria Log Manager [Nick_Connor] [Nick_Connor] 2006-12 -assuria-slm 4119/udp # Assuria Log Manager [Nick_Connor] [Nick_Connor] 2006-12 -# 4120 Unassigned 2007-02-01 -e-builder 4121/tcp # e-Builder Application [James_Caza] [James_Caza] 2006-12 -# Communication -e-builder 4121/udp # e-Builder Application [James_Caza] [James_Caza] 2006-12 -# Communication -fprams 4122/tcp # Fiber Patrol Alarm Service [Zhizhong_Zhuang] [Zhizhong_Zhuang] 2006-12 -fprams 4122/udp # Fiber Patrol Alarm Service [Zhizhong_Zhuang] [Zhizhong_Zhuang] 2006-12 -z-wave 4123/tcp # Z-Wave Protocol [Sigma_Designs_Inc_2] [Anders_Brandt][Mary_Miller] 2007-02 2012-11-08 -z-wave 4123/udp # Z-Wave Protocol [Sigma_Designs_Inc_2] [Anders_Brandt][Mary_Miller] 2007-02 2012-11-08 -tigv2 4124/tcp # Rohill TetraNode Ip Gateway [Bert_Bouwers] [Bert_Bouwers] 2007-05 -# v2 -tigv2 4124/udp # Rohill TetraNode Ip Gateway [Bert_Bouwers] [Bert_Bouwers] 2007-05 -# v2 -opsview-envoy 4125/tcp # Opsview Envoy [Ton_Voon] [Ton_Voon] 2008-09-26 -opsview-envoy 4125/udp # Opsview Envoy [Ton_Voon] [Ton_Voon] 2008-09-26 -ddrepl 4126/tcp # Data Domain Replication [Pratik_Wadher] [Pratik_Wadher] 2007-05 -# Service -ddrepl 4126/udp # Data Domain Replication [Pratik_Wadher] [Pratik_Wadher] 2007-05 -# Service -unikeypro 4127/tcp # NetUniKeyServer [Raymond_Chaw] [Raymond_Chaw] 2007-05 -unikeypro 4127/udp # NetUniKeyServer [Raymond_Chaw] [Raymond_Chaw] 2007-05 -nufw 4128/tcp # NuFW decision delegation -# protocol -nufw 4128/udp # NuFW decision delegation -# protocol -nuauth 4129/tcp # NuFW authentication protocol [Eric_Leblond] [Eric_Leblond] 2007-06 -nuauth 4129/udp # NuFW authentication protocol [Eric_Leblond] [Eric_Leblond] 2007-06 -fronet 4130/tcp # FRONET message protocol [Christer_Nygren] [Christer_Nygren] 2007-08-07 -fronet 4130/udp # FRONET message protocol [Christer_Nygren] [Christer_Nygren] 2007-08-07 -stars 4131/tcp # Global Maintech Stars [Harry_Goldschmitt_2] [Harry_Goldschmitt_2] 2007-06 -stars 4131/udp # Global Maintech Stars [Harry_Goldschmitt_2] [Harry_Goldschmitt_2] 2007-06 -# NUTS Daemon -# -nuts-dem 4132/tcp # IANA assigned this -# well-formed service name as -# a replacement for -# "nuts_dem". -# This entry is an alias to "nuts-dem". This entry is now -nuts_dem 4132/tcp # NUTS Daemon historic, not usable for use with many common service -# discovery mechanisms. -# NUTS Daemon -# -nuts-dem 4132/udp # IANA assigned this -# well-formed service name as -# a replacement for -# "nuts_dem". -# This entry is an alias to "nuts-dem". This entry is now -nuts_dem 4132/udp # NUTS Daemon historic, not usable for use with many common service -# discovery mechanisms. -# NUTS Bootp Server -# -nuts-bootp 4133/tcp # IANA assigned this [Martin_Freiss_2] [Martin_Freiss_2] -# well-formed service name as -# a replacement for -# "nuts_bootp". -# This entry is an alias to "nuts-bootp". This entry is now -nuts_bootp 4133/tcp # NUTS Bootp Server [Martin_Freiss_2] [Martin_Freiss_2] historic, not usable for use with many common service -# discovery mechanisms. -# NUTS Bootp Server -# -nuts-bootp 4133/udp # IANA assigned this [Martin_Freiss_2] [Martin_Freiss_2] -# well-formed service name as -# a replacement for -# "nuts_bootp". -# This entry is an alias to "nuts-bootp". This entry is now -nuts_bootp 4133/udp # NUTS Bootp Server [Martin_Freiss_2] [Martin_Freiss_2] historic, not usable for use with many common service -# discovery mechanisms. -nifty-hmi 4134/tcp # NIFTY-Serve HMI protocol [Ryuichi_Suzuki] [Ryuichi_Suzuki] -nifty-hmi 4134/udp # NIFTY-Serve HMI protocol [Ryuichi_Suzuki] [Ryuichi_Suzuki] -cl-db-attach 4135/tcp # Classic Line Database Server -# Attach -cl-db-attach 4135/udp # Classic Line Database Server -# Attach -cl-db-request 4136/tcp # Classic Line Database Server -# Request -cl-db-request 4136/udp # Classic Line Database Server -# Request -cl-db-remote 4137/tcp # Classic Line Database Server [Arno_Kirmeir] [Arno_Kirmeir] 2007-01 -# Remote -cl-db-remote 4137/udp # Classic Line Database Server [Arno_Kirmeir] [Arno_Kirmeir] 2007-01 -# Remote -nettest 4138/tcp # nettest [David_Borman] [David_Borman] 2003-03 -nettest 4138/udp # nettest [David_Borman] [David_Borman] 2003-03 -thrtx 4139/tcp # Imperfect Networks Server [Dinkar_Chivaluri_2] [Dinkar_Chivaluri_2] 2006-02 -thrtx 4139/udp # Imperfect Networks Server [Dinkar_Chivaluri_2] [Dinkar_Chivaluri_2] 2006-02 -# Cedros Fraud Detection -# System -# -cedros-fds 4140/tcp # IANA assigned this [Markus_Michels_3] [Markus_Michels_3] 2006-10 -# well-formed service name as -# a replacement for -# "cedros_fds". -# Cedros Fraud Detection This entry is an alias to "cedros-fds". This entry is now -cedros_fds 4140/tcp # System [Markus_Michels_3] [Markus_Michels_3] 2006-10 historic, not usable for use with many common service -# discovery mechanisms. -# Cedros Fraud Detection -# System -# -cedros-fds 4140/udp # IANA assigned this [Markus_Michels_3] [Markus_Michels_3] 2006-10 -# well-formed service name as -# a replacement for -# "cedros_fds". -# Cedros Fraud Detection This entry is an alias to "cedros-fds". This entry is now -cedros_fds 4140/udp # System [Markus_Michels_3] [Markus_Michels_3] 2006-10 historic, not usable for use with many common service -# discovery mechanisms. -oirtgsvc 4141/tcp # Workflow Server -oirtgsvc 4141/udp # Workflow Server -oidocsvc 4142/tcp # Document Server -oidocsvc 4142/udp # Document Server -oidsr 4143/tcp # Document Replication [Norman_Brie] [Norman_Brie] -oidsr 4143/udp # Document Replication [Norman_Brie] [Norman_Brie] -# 4144 Unassigned Compuserve (unoffically) is using port 4144 -vvr-control 4145/tcp # VVR Control [Ming_Xu] [Ming_Xu] -vvr-control 4145/udp # VVR Control [Ming_Xu] [Ming_Xu] -tgcconnect 4146/tcp # TGCConnect Beacon [Brian_Becker] [Brian_Becker] 2006-10 -tgcconnect 4146/udp # TGCConnect Beacon [Brian_Becker] [Brian_Becker] 2006-10 -vrxpservman 4147/tcp # Multum Service Manager [Scott_Mager] [Scott_Mager] 2006-10 -vrxpservman 4147/udp # Multum Service Manager [Scott_Mager] [Scott_Mager] 2006-10 -hhb-handheld 4148/tcp # HHB Handheld Client [Steven_G_Loughner] [Steven_G_Loughner] 2007-03 -hhb-handheld 4148/udp # HHB Handheld Client [Steven_G_Loughner] [Steven_G_Loughner] 2007-03 -agslb 4149/tcp # A10 GSLB Service [John_Chiong] [John_Chiong] 2007-07-02 -agslb 4149/udp # A10 GSLB Service [John_Chiong] [John_Chiong] 2007-07-02 -PowerAlert-nsa 4150/tcp # PowerAlert Network Shutdown [Mike_Delgrosso_2] [Mike_Delgrosso_2] 2007-07-02 -# Agent -PowerAlert-nsa 4150/udp # PowerAlert Network Shutdown [Mike_Delgrosso_2] [Mike_Delgrosso_2] 2007-07-02 -# Agent -# Men & Mice Remote Control -# -menandmice-noh 4151/tcp # IANA assigned this [Eggert_Thorlacius] [Eggert_Thorlacius] 2007-08-30 -# well-formed service name as -# a replacement for -# "menandmice_noh". -# This entry is an alias to "menandmice-noh". This entry is now -menandmice_noh 4151/tcp # Men & Mice Remote Control [Eggert_Thorlacius] [Eggert_Thorlacius] 2007-08-30 historic, not usable for use with many common service -# discovery mechanisms. -# Men & Mice Remote Control -# -menandmice-noh 4151/udp # IANA assigned this [Eggert_Thorlacius] [Eggert_Thorlacius] 2007-08-30 -# well-formed service name as -# a replacement for -# "menandmice_noh". -# This entry is an alias to "menandmice-noh". This entry is now -menandmice_noh 4151/udp # Men & Mice Remote Control [Eggert_Thorlacius] [Eggert_Thorlacius] 2007-08-30 historic, not usable for use with many common service -# discovery mechanisms. -# iDigTech Multiplex -# -idig-mux 4152/tcp # IANA assigned this [Robin_Findley] [Robin_Findley] 2007-05 -# well-formed service name as -# a replacement for -# "idig_mux". -# This entry is an alias to "idig-mux". This entry is now -idig_mux 4152/tcp # iDigTech Multiplex [Robin_Findley] [Robin_Findley] 2007-05 historic, not usable for use with many common service -# discovery mechanisms. -# iDigTech Multiplex -# -idig-mux 4152/udp # IANA assigned this [Robin_Findley] [Robin_Findley] 2007-05 -# well-formed service name as -# a replacement for -# "idig_mux". -# This entry is an alias to "idig-mux". This entry is now -idig_mux 4152/udp # iDigTech Multiplex [Robin_Findley] [Robin_Findley] 2007-05 historic, not usable for use with many common service -# discovery mechanisms. -mbl-battd 4153/tcp # MBL Remote Battery [Claudio_Procida] [Claudio_Procida] 2007-05 -# Monitoring -mbl-battd 4153/udp # MBL Remote Battery [Claudio_Procida] [Claudio_Procida] 2007-05 -# Monitoring -atlinks 4154/tcp # atlinks device discovery [Scott_Griepentrog] [Scott_Griepentrog] 2002-10 -atlinks 4154/udp # atlinks device discovery [Scott_Griepentrog] [Scott_Griepentrog] 2002-10 -bzr 4155/tcp # Bazaar version control [Martin_Pool_2] [Martin_Pool_2] 2007-02 -# system -bzr 4155/udp # Bazaar version control [Martin_Pool_2] [Martin_Pool_2] 2007-02 -# system -stat-results 4156/tcp # STAT Results -stat-results 4156/udp # STAT Results -stat-scanner 4157/tcp # STAT Scanner Control -stat-scanner 4157/udp # STAT Scanner Control -stat-cc 4158/tcp # STAT Command Center [Darwin_Ammala] [Darwin_Ammala] 2007-03 -stat-cc 4158/udp # STAT Command Center [Darwin_Ammala] [Darwin_Ammala] 2007-03 -nss 4159/tcp # Network Security Service [Dave_Wierbowski] [Dave_Wierbowski] 2006-08 -nss 4159/udp # Network Security Service [Dave_Wierbowski] [Dave_Wierbowski] 2006-08 -jini-discovery 4160/tcp # Jini Discovery [Mark_Hodapp] [Mark_Hodapp] -jini-discovery 4160/udp # Jini Discovery [Mark_Hodapp] [Mark_Hodapp] -omscontact 4161/tcp # OMS Contact -omscontact 4161/udp # OMS Contact -omstopology 4162/tcp # OMS Topology [David_Page] [David_Page] 2005-08 -omstopology 4162/udp # OMS Topology [David_Page] [David_Page] 2005-08 -silverpeakpeer 4163/tcp # Silver Peak Peer Protocol [Damon_Ennis] [Damon_Ennis] 2007-03 -silverpeakpeer 4163/udp # Silver Peak Peer Protocol [Damon_Ennis] [Damon_Ennis] 2007-03 -silverpeakcomm 4164/tcp # Silver Peak Communication [Damon_Ennis] [Damon_Ennis] 2007-03 -# Protocol -silverpeakcomm 4164/udp # Silver Peak Communication [Damon_Ennis] [Damon_Ennis] 2007-03 -# Protocol -altcp 4165/tcp # ArcLink over Ethernet [Dmitry_Brant] [Dmitry_Brant] 2007-03 -altcp 4165/udp # ArcLink over Ethernet [Dmitry_Brant] [Dmitry_Brant] 2007-03 -joost 4166/tcp # Joost Peer to Peer Protocol [Colm_MacCarthaigh] [Colm_MacCarthaigh] 2007-04 -joost 4166/udp # Joost Peer to Peer Protocol [Colm_MacCarthaigh] [Colm_MacCarthaigh] 2007-04 -ddgn 4167/tcp # DeskDirect Global Network [Laurie_Charlwood] [Laurie_Charlwood] 2007-08-22 -ddgn 4167/udp # DeskDirect Global Network [Laurie_Charlwood] [Laurie_Charlwood] 2007-08-22 -pslicser 4168/tcp # PrintSoft License Server [David_Weisgerber] [David_Weisgerber] 2007-09-27 -pslicser 4168/udp # PrintSoft License Server [David_Weisgerber] [David_Weisgerber] 2007-09-27 -iadt 4169/tcp # Automation Drive Interface [Paul_Suhler] [Paul_Suhler] 2008-02-15 -# Transport -iadt-disc 4169/udp # Internet ADT Discovery [Paul_A_Suhler] [Paul_A_Suhler] 2009-02-06 -# Protocol -d-cinema-csp 4170/tcp # SMPTE Content Synchonization [Michael_Karagosian] [Michael_Karagosian] 2008-09-04 -# Protocol -# 4170 udp Reserved -ml-svnet 4171/tcp # Maxlogic Supervisor [Taha_Paksu] [Taha_Paksu] 2009-12-21 -# Communication -# 4171 udp Reserved -pcoip 4172/tcp # PC over IP [Teradici] [Jeff_Dillabough] 2009-12-23 2012-03-06 -pcoip 4172/udp # PC over IP [Teradici] [Jeff_Dillabough] 2009-12-23 2012-03-06 -# 4173 tcp Reserved -mma-discovery 4173/udp # MMA Device Discovery [MIDI_Manufacturers_Assoc_Inc] [Tom_White] 2011-11-14 -smcluster 4174/tcp # StorMagic Cluster Services [Chris_Farey] [Chris_Farey] 2011-03-09 -sm-disc 4174/udp # StorMagic Discovery [StorMagic_Ltd] [Chris_Farey] 2011-12-16 -bccp 4175/tcp # Brocade Cluster [Norival_Figueira] [Norival_Figueira] 2010-04-07 -# Communication Protocol -# 4175 udp Reserved -tl-ipcproxy 4176/tcp # Translattice Cluster IPC [Michael_Lyle] [Michael_Lyle] 2009-11-03 -# Proxy -# 4176 udp Reserved -wello 4177/tcp # Wello P2P pubsub service [Christian_Westbrook] [Christian_Westbrook] 2007-11-15 -wello 4177/udp # Wello P2P pubsub service [Christian_Westbrook] [Christian_Westbrook] 2007-11-15 -storman 4178/tcp # StorMan [Werner_Guertler] [Werner_Guertler] 2009-05-11 -storman 4178/udp # StorMan [Werner_Guertler] [Werner_Guertler] 2009-05-11 -MaxumSP 4179/tcp # Maxum Services [Greg_Stine] [Greg_Stine] 2007-07-05 -MaxumSP 4179/udp # Maxum Services [Greg_Stine] [Greg_Stine] 2007-07-05 -httpx 4180/tcp # HTTPX [Paul_McGough] [Paul_McGough] 2007-02 -httpx 4180/udp # HTTPX [Paul_McGough] [Paul_McGough] 2007-02 -macbak 4181/tcp # MacBak [Wes_Peters] [Wes_Peters] 2007-04 -macbak 4181/udp # MacBak [Wes_Peters] [Wes_Peters] 2007-04 -pcptcpservice 4182/tcp # Production Company Pro TCP [Ben_McNeill] [Ben_McNeill] 2007-05 -# Service -pcptcpservice 4182/udp # Production Company Pro TCP [Ben_McNeill] [Ben_McNeill] 2007-05 -# Service -cyborgnet 4183/tcp # CyborgNet communications [Gareth_Nelson] [Gareth_Nelson] 2015-11-13 -# protocol -cyborgnet 4183/udp # CyborgNet communications [Gareth_Nelson] [Gareth_Nelson] 2015-11-13 -# protocol -# UNIVERSE SUITE MESSAGE -# SERVICE -# -universe-suite 4184/tcp # IANA assigned this [Gary_ANDREWS] [Gary_ANDREWS] 2008-01-07 -# well-formed service name as -# a replacement for -# "universe_suite". -# UNIVERSE SUITE MESSAGE This entry is an alias to "universe-suite". This entry is now -universe_suite 4184/tcp # SERVICE [Gary_ANDREWS] [Gary_ANDREWS] 2008-01-07 historic, not usable for use with many common service -# discovery mechanisms. -# UNIVERSE SUITE MESSAGE -# SERVICE -# -universe-suite 4184/udp # IANA assigned this [Gary_ANDREWS] [Gary_ANDREWS] 2008-01-07 -# well-formed service name as -# a replacement for -# "universe_suite". -# UNIVERSE SUITE MESSAGE This entry is an alias to "universe-suite". This entry is now -universe_suite 4184/udp # SERVICE [Gary_ANDREWS] [Gary_ANDREWS] 2008-01-07 historic, not usable for use with many common service -# discovery mechanisms. -wcpp 4185/tcp # Woven Control Plane Protocol [Christopher_LILJENST] [Christopher_LILJENST] 2008-04-14 -wcpp 4185/udp # Woven Control Plane Protocol [Christopher_LILJENST] [Christopher_LILJENST] 2008-04-14 -boxbackupstore 4186/tcp # Box Backup Store Service [Chris_Wilson] [Chris_Wilson] 2008-09-11 -# 4186 udp Reserved -# Cascade Proxy -# -csc-proxy 4187/tcp # IANA assigned this [Matt_Craighead] [Matt_Craighead] 2008-09-11 -# well-formed service name as -# a replacement for -# "csc_proxy". -# This entry is an alias to "csc-proxy". This entry is now -csc_proxy 4187/tcp # Cascade Proxy [Matt_Craighead] [Matt_Craighead] 2008-09-11 historic, not usable for use with many common service -# discovery mechanisms. -# 4187 udp Reserved -vatata 4188/tcp # Vatata Peer to Peer Protocol [Song_Jian] [Song_Jian] 2008-09-15 -vatata 4188/udp # Vatata Peer to Peer Protocol [Song_Jian] [Song_Jian] 2008-09-15 -pcep 4189/tcp # Path Computation Element -# Communication Protocol -# 4189 udp Reserved [RFC5440] -sieve 4190/tcp # ManageSieve Protocol -# 4190 udp Reserved [RFC5804] -# 4191 tcp Reserved -dsmipv6 4191/udp # Dual Stack MIPv6 NAT [RFC5555] -# Traversal -azeti 4192/tcp # Azeti Agent Service [Uwe_Holz] [Uwe_Holz] 2009-11-09 -azeti-bd 4192/udp # azeti blinddate [Michael_Werski] [Michael_Werski] 2010-02-18 -pvxplusio 4193/tcp # PxPlus remote file srvr [Mike_King] [Mike_King] 2009-11-09 -# 4193 udp Reserved -# 4194-4198 Unassigned -eims-admin 4199/tcp # EIMS ADMIN [Glenn_Anderson] [Glenn_Anderson] -eims-admin 4199/udp # EIMS ADMIN [Glenn_Anderson] [Glenn_Anderson] -# vrml-multi-use 4200-4299 VRML Multi User Systems [Mitra] [Mitra] -corelccam 4300/tcp # Corel CCam [Jason_Aiken] [Jason_Aiken] -corelccam 4300/udp # Corel CCam [Jason_Aiken] [Jason_Aiken] -d-data 4301/tcp # Diagnostic Data -d-data 4301/udp # Diagnostic Data -d-data-control 4302/tcp # Diagnostic Data Control [Jon_March] [Jon_March] 2006-09 -d-data-control 4302/udp # Diagnostic Data Control [Jon_March] [Jon_March] 2006-09 -srcp 4303/tcp # Simple Railroad Command [Matthias_Trute] [Matthias_Trute] 2007-01 -# Protocol -srcp 4303/udp # Simple Railroad Command [Matthias_Trute] [Matthias_Trute] 2007-01 -# Protocol -owserver 4304/tcp # One-Wire Filesystem Server [Paul_Alfille] [Paul_Alfille] 2007-01 Defined TXT keys: txtvers -owserver 4304/udp # One-Wire Filesystem Server [Paul_Alfille] [Paul_Alfille] 2007-01 Defined TXT keys: txtvers -batman 4305/tcp # better approach to mobile [Simon_Wunderlich] [Simon_Wunderlich] 2007-08-30 -# ad-hoc networking -batman 4305/udp # better approach to mobile [Simon_Wunderlich] [Simon_Wunderlich] 2007-08-30 -# ad-hoc networking -pinghgl 4306/tcp # Hellgate London [David_Berk] [David_Berk] 2007-08-30 -pinghgl 4306/udp # Hellgate London [David_Berk] [David_Berk] 2007-08-30 -visicron-vs 4307/tcp # Visicron Videoconference [Alexey_Vlaskin] [Alexey_Vlaskin] 2007-10-22 -# Service -visicron-vs 4307/udp # Visicron Videoconference [Alexey_Vlaskin] [Alexey_Vlaskin] 2007-10-22 -# Service -compx-lockview 4308/tcp # CompX-LockView [John_Payson] [John_Payson] 2007-10-22 -compx-lockview 4308/udp # CompX-LockView [John_Payson] [John_Payson] 2007-10-22 -dserver 4309/tcp # Exsequi Appliance Discovery [Angelo_Masci] [Angelo_Masci] 2007-01 -dserver 4309/udp # Exsequi Appliance Discovery [Angelo_Masci] [Angelo_Masci] 2007-01 -mirrtex 4310/tcp # Mir-RT exchange service [Sylvain_Robert] [Sylvain_Robert] 2008-02-14 -mirrtex 4310/udp # Mir-RT exchange service [Sylvain_Robert] [Sylvain_Robert] 2008-02-14 -p6ssmc 4311/tcp # P6R Secure Server Management [Jim_Susoy] [Jim_Susoy] 2010-01-21 -# Console -# 4311 udp Reserved -pscl-mgt 4312/tcp # Parascale Membership Manager [John_Muth] [John_Muth] 2010-01-21 -# 4312 udp Reserved -perrla 4313/tcp # PERRLA User Services [Cliff_Batson] [Cliff_Batson] 2010-01-21 -# 4313 udp Reserved -choiceview-agt 4314/tcp # ChoiceView Agent [Radish_Systems] [Richard_A_Davis] 2013-03-28 -# 4314 udp Reserved -# Unauthorized -# 4315 Unassigned Use Known on -# port 4315 -choiceview-clt 4316/tcp # ChoiceView Client [Radish_Systems] [Richard_A_Davis] 2013-03-28 -# 4316 udp Reserved -# 4317-4319 Unassigned -fdt-rcatp 4320/tcp # FDT Remote Categorization [Russell_P_Holsclaw] [Russell_P_Holsclaw] 2006-03 -# Protocol -fdt-rcatp 4320/udp # FDT Remote Categorization [Russell_P_Holsclaw] [Russell_P_Holsclaw] 2006-03 -# Protocol -rwhois 4321/tcp # Remote Who Is [Mark_Kosters] [Mark_Kosters] [RFC2167] -rwhois 4321/udp # Remote Who Is [Mark_Kosters] [Mark_Kosters] [RFC2167] -trim-event 4322/tcp # TRIM Event Service -trim-event 4322/udp # TRIM Event Service -trim-ice 4323/tcp # TRIM ICE Service [Siva_Poobalasingam_2] [Siva_Poobalasingam_2] 2007-02 -trim-ice 4323/udp # TRIM ICE Service [Siva_Poobalasingam_2] [Siva_Poobalasingam_2] 2007-02 -# 4324 Reserved 2015-05-12 This entry is being removed on 2015-05-12. -geognosisman 4325/tcp # Cadcorp GeognoSIS Manager -# Service -geognosisman 4325/udp # Cadcorp GeognoSIS Manager -# Service -geognosis 4326/tcp # Cadcorp GeognoSIS Service [Martin_Daly] [Martin_Daly] 2006-11 -geognosis 4326/udp # Cadcorp GeognoSIS Service [Martin_Daly] [Martin_Daly] 2006-11 -jaxer-web 4327/tcp # Jaxer Web Protocol [Uri_Sarid] [Uri_Sarid] 2008-01-07 -jaxer-web 4327/udp # Jaxer Web Protocol [Uri_Sarid] [Uri_Sarid] 2008-01-07 -jaxer-manager 4328/tcp # Jaxer Manager Command [Uri_Sarid] [Uri_Sarid] 2008-01-22 -# Protocol -jaxer-manager 4328/udp # Jaxer Manager Command [Uri_Sarid] [Uri_Sarid] 2008-01-22 -# Protocol -# PubliQare Distributed -publiqare-sync 4329/tcp # Environment Synchronisation [Tom_Maaswinkel] [Tom_Maaswinkel] 2011-02-07 -# Engine -# 4329 udp Reserved -dey-sapi 4330/tcp # DEY Storage Administration [DEY_Storage_Systems_Inc] [Garrett_D_Amore] 2013-03-01 -# REST API -# 4330 udp Reserved -# ktickets REST API for event -ktickets-rest 4331/tcp # management and ticketing [KeyTicket_Solutions] [MANG_Ioan-Alexandru] 2014-04-04 -# systems (embedded POS -# devices) -# 4331 udp Reserved -# 4332 Unassigned -ahsp 4333/tcp # ArrowHead Service Protocol [QuantuMatriX_Technologies] [Matthew_Schultz] 2014-04-10 -# (AHSP) -ahsp 4333/udp # ArrowHead Service Protocol [QuantuMatriX_Technologies] [Matthew_Schultz] 2014-04-10 -# (AHSP) -ahsp 4333/sctp # ArrowHead Service Protocol [QuantuMatriX_Technologies] [Matthew_Schultz] 2014-04-10 -# (AHSP) -# 4334-4339 Unassigned -gaia 4340/tcp # Gaia Connector Protocol [Philippe_Detournay] [Philippe_Detournay] 2007-11-12 -gaia 4340/udp # Gaia Connector Protocol [Philippe_Detournay] [Philippe_Detournay] 2007-11-12 -lisp-data 4341/tcp # LISP Data Packets [Dino_Farinacci] [Dino_Farinacci] 2007-11-12 -lisp-data 4341/udp # LISP Data Packets [IESG] [IETF_Chair] 2007-11-12 2012-04-26 [RFC6830] -lisp-cons 4342/tcp # LISP-CONS Control -lisp-control 4342/udp # LISP Control Packets [IESG] [IETF_Chair] 2007-05 2012-04-26 [RFC6830] -unicall 4343/tcp # UNICALL [James_Powell_2] [James_Powell_2] -unicall 4343/udp # UNICALL [James_Powell_2] [James_Powell_2] -vinainstall 4344/tcp # VinaInstall [Jay_Slupesky] [Jay_Slupesky] -vinainstall 4344/udp # VinaInstall [Jay_Slupesky] [Jay_Slupesky] -m4-network-as 4345/tcp # Macro 4 Network AS [Paul_Wren] [Paul_Wren] -m4-network-as 4345/udp # Macro 4 Network AS [Paul_Wren] [Paul_Wren] -elanlm 4346/tcp # ELAN LM [Paul_Ballew] [Paul_Ballew] -elanlm 4346/udp # ELAN LM [Paul_Ballew] [Paul_Ballew] -lansurveyor 4347/tcp # LAN Surveyor [Michael_Swan] [Michael_Swan] -lansurveyor 4347/udp # LAN Surveyor [Michael_Swan] [Michael_Swan] -itose 4348/tcp # ITOSE [Michael_Haeuptle] [Michael_Haeuptle] -itose 4348/udp # ITOSE [Michael_Haeuptle] [Michael_Haeuptle] -fsportmap 4349/tcp # File System Port Map [Ron_Minnich_2] [Ron_Minnich_2] -fsportmap 4349/udp # File System Port Map [Ron_Minnich_2] [Ron_Minnich_2] -net-device 4350/tcp # Net Device [Glenn_Peterson] [Glenn_Peterson] -net-device 4350/udp # Net Device [Glenn_Peterson] [Glenn_Peterson] -plcy-net-svcs 4351/tcp # PLCY Net Services [J_J_Ekstrom] [J_J_Ekstrom] -plcy-net-svcs 4351/udp # PLCY Net Services [J_J_Ekstrom] [J_J_Ekstrom] -pjlink 4352/tcp # Projector Link [Mitsuo_Kodama] [Mitsuo_Kodama] 2005-06 -pjlink 4352/udp # Projector Link [Mitsuo_Kodama] [Mitsuo_Kodama] 2005-06 -f5-iquery 4353/tcp # F5 iQuery [Tom_Kee] [Tom_Kee] -f5-iquery 4353/udp # F5 iQuery [Tom_Kee] [Tom_Kee] -qsnet-trans 4354/tcp # QSNet Transmitter -qsnet-trans 4354/udp # QSNet Transmitter -qsnet-workst 4355/tcp # QSNet Workstation -qsnet-workst 4355/udp # QSNet Workstation -qsnet-assist 4356/tcp # QSNet Assistant -qsnet-assist 4356/udp # QSNet Assistant -qsnet-cond 4357/tcp # QSNet Conductor -qsnet-cond 4357/udp # QSNet Conductor -qsnet-nucl 4358/tcp # QSNet Nucleus [Neer_Kleinman] [Neer_Kleinman] -qsnet-nucl 4358/udp # QSNet Nucleus [Neer_Kleinman] [Neer_Kleinman] -omabcastltkm 4359/tcp # OMA BCAST Long-Term Key [Frank_Hartung] [Frank_Hartung] 2007-09-07 -# Messages -omabcastltkm 4359/udp # OMA BCAST Long-Term Key [Frank_Hartung] [Frank_Hartung] 2007-09-07 -# Messages -# Matrix VNet Communication -# Protocol -# -matrix-vnet 4360/tcp # IANA assigned this [Rehan_Mahmood] [Rehan_Mahmood] 2009-03-18 -# well-formed service name as -# a replacement for -# "matrix_vnet". -# Matrix VNet Communication This entry is an alias to "matrix-vnet". This entry is now -matrix_vnet 4360/tcp # Protocol [Rehan_Mahmood] [Rehan_Mahmood] 2009-03-18 historic, not usable for use with many common service -# discovery mechanisms. -# 4360 udp Reserved -# 4361 tcp Reserved -nacnl 4361/udp # NavCom Discovery and Control [Yilei_Jia] [Yilei_Jia] 2009-03-18 -# Port -# 4362 tcp Reserved -afore-vdp-disc 4362/udp # AFORE vNode Discovery [Michael_Richardson] [Michael_Richardson] 2011-02-08 -# protocol -# 4363-4365 Unassigned -shadowstream 4366/udp # ShadowStream System [StorageCraft_Technology_Corporation] [David_McConkie] 2014-12-17 -# 4366 tcp Reserved -# 4367 Unassigned -wxbrief 4368/tcp # WeatherBrief Direct [Kim_Alan_Waggoner] [Kim_Alan_Waggoner] 2006-11 -wxbrief 4368/udp # WeatherBrief Direct [Kim_Alan_Waggoner] [Kim_Alan_Waggoner] 2006-11 -epmd 4369/tcp # Erlang Port Mapper Daemon [Erlang] [Erlang] -epmd 4369/udp # Erlang Port Mapper Daemon [Erlang] [Erlang] -# ELPRO V2 Protocol Tunnel -# -elpro-tunnel 4370/tcp # IANA assigned this [Harry_Courtice] [Harry_Courtice] 2008-04-14 -# well-formed service name as -# a replacement for -# "elpro_tunnel". -# This entry is an alias to "elpro-tunnel". This entry is now -elpro_tunnel 4370/tcp # ELPRO V2 Protocol Tunnel [Harry_Courtice] [Harry_Courtice] 2008-04-14 historic, not usable for use with many common service -# discovery mechanisms. -# ELPRO V2 Protocol Tunnel -# -elpro-tunnel 4370/udp # IANA assigned this [Harry_Courtice] [Harry_Courtice] 2008-04-14 -# well-formed service name as -# a replacement for -# "elpro_tunnel". -# This entry is an alias to "elpro-tunnel". This entry is now -elpro_tunnel 4370/udp # ELPRO V2 Protocol Tunnel [Harry_Courtice] [Harry_Courtice] 2008-04-14 historic, not usable for use with many common service -# discovery mechanisms. -l2c-control 4371/tcp # LAN2CAN Control [Phil_Tolson] [Phil_Tolson] 2008-07-07 Modified: 21 January 2010 -l2c-disc 4371/udp # LAN2CAN Discovery [Phil_Tolson] [Phil_Tolson] 2010-01-21 -l2c-data 4372/tcp # LAN2CAN Data [Phil_Tolson] [Phil_Tolson] 2008-07-07 Modified: 21 January 2010 -l2c-data 4372/udp # LAN2CAN Data [Phil_Tolson] [Phil_Tolson] 2010-01-21 -remctl 4373/tcp # Remote Authenticated Command [Russ_Allbery] [Russ_Allbery] 2007-08-30 -# Service -remctl 4373/udp # Remote Authenticated Command [Russ_Allbery] [Russ_Allbery] 2007-08-30 -# Service -psi-ptt 4374/tcp # PSI Push-to-Talk Protocol [Frank_B] [Frank_B] 2008-07-17 -# 4374 udp Reserved -tolteces 4375/tcp # Toltec EasyShare [Joon_Radley_2] [Joon_Radley_2] 2008-10-21 -tolteces 4375/udp # Toltec EasyShare [Joon_Radley_2] [Joon_Radley_2] 2008-10-21 -bip 4376/tcp # BioAPI Interworking [Jean_Paul_Lemaire] [Jean_Paul_Lemaire] 2007-07-05 -bip 4376/udp # BioAPI Interworking [Jean_Paul_Lemaire] [Jean_Paul_Lemaire] 2007-07-05 -cp-spxsvr 4377/tcp # Cambridge Pixel SPx Server -cp-spxsvr 4377/udp # Cambridge Pixel SPx Server -cp-spxdpy 4378/tcp # Cambridge Pixel SPx Display [Richard_Warren] [Richard_Warren] 2007-07-05 -cp-spxdpy 4378/udp # Cambridge Pixel SPx Display [Richard_Warren] [Richard_Warren] 2007-07-05 -ctdb 4379/tcp # CTDB [Ronnie_Sahlberg] [Ronnie_Sahlberg] 2007-07-05 -ctdb 4379/udp # CTDB [Ronnie_Sahlberg] [Ronnie_Sahlberg] 2007-07-05 -# 4380-4388 Unassigned -xandros-cms 4389/tcp # Xandros Community Management [Stephen_M_Webb] [Stephen_M_Webb] 2007-05 -# Service -xandros-cms 4389/udp # Xandros Community Management [Stephen_M_Webb] [Stephen_M_Webb] 2007-05 -# Service -wiegand 4390/tcp # Physical Access Control [Scott_Guthery_2] [Scott_Guthery_2] 2008-08-25 -wiegand 4390/udp # Physical Access Control [Scott_Guthery_2] [Scott_Guthery_2] 2008-08-25 -apwi-imserver 4391/tcp # American Printware IMServer [Lech_Lakomy] [Lech_Lakomy] 2009-02-12 -# Protocol -# 4391 udp Reserved -apwi-rxserver 4392/tcp # American Printware RXServer [Lech_Lakomy] [Lech_Lakomy] 2009-02-12 -# Protocol -# 4392 udp Reserved -apwi-rxspooler 4393/tcp # American Printware RXSpooler [Lech_Lakomy] [Lech_Lakomy] 2009-02-12 -# Protocol -# 4393 udp Reserved -# 4394 tcp Reserved -apwi-disc 4394/udp # American Printware Discovery [Lech_Lakomy] [Lech_Lakomy] 2009-02-12 -omnivisionesx 4395/tcp # OmniVision communication for [Vacquier_Serge] [Vacquier_Serge] 2009-02-12 -# Virtual environments -omnivisionesx 4395/udp # OmniVision communication for [Vacquier_Serge] [Vacquier_Serge] 2009-02-12 -# Virtual environments -fly 4396/tcp # Fly Object Space [Nigel_Warren] [Nigel_Warren] 2009-02-12 -# 4396 udp Reserved -# 4397-4399 Unassigned -ds-srv 4400/tcp # ASIGRA Services [David_Farajun] [David_Farajun] 2004-11 -ds-srv 4400/udp # ASIGRA Services [David_Farajun] [David_Farajun] 2004-11 -ds-srvr 4401/tcp # ASIGRA Televaulting -# DS-System Service -ds-srvr 4401/udp # ASIGRA Televaulting -# DS-System Service -ds-clnt 4402/tcp # ASIGRA Televaulting -# DS-Client Service -ds-clnt 4402/udp # ASIGRA Televaulting -# DS-Client Service -# ASIGRA Televaulting -ds-user 4403/tcp # DS-Client -# Monitoring/Management -# ASIGRA Televaulting -ds-user 4403/udp # DS-Client -# Monitoring/Management -# ASIGRA Televaulting -ds-admin 4404/tcp # DS-System -# Monitoring/Management -# ASIGRA Televaulting -ds-admin 4404/udp # DS-System -# Monitoring/Management -ds-mail 4405/tcp # ASIGRA Televaulting Message -# Level Restore service -ds-mail 4405/udp # ASIGRA Televaulting Message -# Level Restore service -ds-slp 4406/tcp # ASIGRA Televaulting [Andrei_Litvinn] [Andrei_Litvinn] 2005-01 -# DS-Sleeper Service -ds-slp 4406/udp # ASIGRA Televaulting [Andrei_Litvinn] [Andrei_Litvinn] 2005-01 -# DS-Sleeper Service -nacagent 4407/tcp # Network Access Control Agent [ITGroup] [ITGroup] 2008-06-30 -# 4407 udp Reserved -slscc 4408/tcp # SLS Technology Control [Steven_Sweeting] [Steven_Sweeting] 2008-01-28 -# Centre -# 4408 udp Reserved -netcabinet-com 4409/tcp # Net-Cabinet comunication [Ian_Manning_2] [Ian_Manning_2] 2009-12-16 -# 4409 udp Reserved -itwo-server 4410/tcp # RIB iTWO Application Server [Kristean_Heisler_2] [Kristean_Heisler_2] 2009-12-16 -# 4410 udp Reserved -found 4411/tcp # Found Messaging Protocol [Found_Software] [John_Mitchell] 2012-04-11 Defined TXT keys: id, key -# 4411 udp Reserved -# 4412 tcp Reserved -smallchat 4412/udp # SmallChat [Valentino_Giudice] [Valentino_Giudice] 2015-08-18 -avi-nms 4413/tcp # AVI Systems NMS [AVI_Systems] [Dave_Hatz] 2015-09-18 -avi-nms-disc 4413/udp # AVI Systems NMS [AVI_Systems] [Dave_Hatz] 2015-09-18 -updog 4414/tcp # Updog Monitoring and Status [Egon_Technologies_LLC] [James_Downs] 2015-10-05 -# Framework -# 4414 udp Reserved -# 4415-4424 Unassigned -netrockey6 4425/tcp # NetROCKEY6 SMART Plus [Feitian_Technologies] [Feitian_Technologies] 2010-09-15 -# Service -netrockey6 4425/udp # NetROCKEY6 SMART Plus [Feitian_Technologies] [Feitian_Technologies] 2010-09-15 -# Service -beacon-port-2 4426/tcp # SMARTS Beacon Port [Eyal_Yardeni] [Eyal_Yardeni] 2003-11 -beacon-port-2 4426/udp # SMARTS Beacon Port [Eyal_Yardeni] [Eyal_Yardeni] 2003-11 -drizzle 4427/tcp # Drizzle database server [Elliot_Murphy] [Elliot_Murphy] 2008-07-09 -# 4427 udp Reserved -omviserver 4428/tcp # OMV-Investigation [Serge_Vacquier] [Serge_Vacquier] 2009-05-20 -# Server-Client -# 4428 udp Reserved -omviagent 4429/tcp # OMV Investigation [Serge_Vacquier] [Serge_Vacquier] 2009-05-20 -# Agent-Server -# 4429 udp Reserved -rsqlserver 4430/tcp # REAL SQL Server [Marco_Bambini] [Marco_Bambini] 2008-08-28 -rsqlserver 4430/udp # REAL SQL Server [Marco_Bambini] [Marco_Bambini] 2008-08-28 -wspipe 4431/tcp # adWISE Pipe [Heikki_E] [Heikki_E] 2009-06-18 -# 4431 udp Reserved -l-acoustics 4432/tcp # L-ACOUSTICS management [L-ACOUSTICS] [Christophe_Pignon] 2012-08-13 -l-acoustics 4432/udp # L-ACOUSTICS management [L-ACOUSTICS] [Christophe_Pignon] 2012-08-13 -vop 4433/tcp # Versile Object Protocol [Versile_AS] [Tore_Skaug] 2012-02-01 -# 4433 udp Reserved -# 4434-4440 Unassigned -# 4441 tcp Reserved -netblox 4441/udp # Netblox Protocol [Brian_S_Locke] [Brian_S_Locke] 2008-07-10 -saris 4442/tcp # Saris -saris 4442/udp # Saris -# Known -pharos 4443/tcp # Pharos [TeleConsult] [TeleConsult] Unauthorized -# Use on port -# 4443 -# Known -pharos 4443/udp # Pharos [TeleConsult] [TeleConsult] Unauthorized -# Use on port -# 4443 -# krb524 -# assigned the -krb524 4444/tcp # KRB524 [B_Clifford_Neuman] [B_Clifford_Neuman] port, nv -# used it -# without an -# assignment -# krb524 -# assigned the -krb524 4444/udp # KRB524 [B_Clifford_Neuman] [B_Clifford_Neuman] port, nv -# used it -# without an -# assignment -# krb524 -# assigned the -nv-video 4444/tcp # NV Video default [Ron_Frederick] [Ron_Frederick] port, nv -# used it -# without an -# assignment -# krb524 -# assigned the -nv-video 4444/udp # NV Video default [Ron_Frederick] [Ron_Frederick] port, nv -# used it -# without an -# assignment -upnotifyp 4445/tcp # UPNOTIFYP [Mark_Fox] [Mark_Fox] -upnotifyp 4445/udp # UPNOTIFYP [Mark_Fox] [Mark_Fox] -n1-fwp 4446/tcp # N1-FWP -n1-fwp 4446/udp # N1-FWP -n1-rmgmt 4447/tcp # N1-RMGMT [Lori_Tassin] [Lori_Tassin] -n1-rmgmt 4447/udp # N1-RMGMT [Lori_Tassin] [Lori_Tassin] -asc-slmd 4448/tcp # ASC Licence Manager [Casper_Stoel] [Casper_Stoel] -asc-slmd 4448/udp # ASC Licence Manager [Casper_Stoel] [Casper_Stoel] -privatewire 4449/tcp # PrivateWire [Uri_Resnitzky] [Uri_Resnitzky] -privatewire 4449/udp # PrivateWire [Uri_Resnitzky] [Uri_Resnitzky] -camp 4450/tcp # Common ASCII Messaging [Control_Technology_Inc] [Clint_Eskew] 2011-10-28 -# Protocol -camp 4450/udp # Common ASCII Messaging [Control_Technology_Inc] [Clint_Eskew] 2011-10-28 -# Protocol -ctisystemmsg 4451/tcp # CTI System Msg [Control_Technology_Inc] [Clint_Eskew] 2011-10-28 -ctisystemmsg 4451/udp # CTI System Msg [Control_Technology_Inc] [Clint_Eskew] 2011-10-28 -ctiprogramload 4452/tcp # CTI Program Load [Control_Technology_Inc] [Clint_Eskew] 2011-10-28 -ctiprogramload 4452/udp # CTI Program Load [Control_Technology_Inc] [Clint_Eskew] 2011-10-28 -nssalertmgr 4453/tcp # NSS Alert Manager -nssalertmgr 4453/udp # NSS Alert Manager -nssagentmgr 4454/tcp # NSS Agent Manager [Jim_Hill] [Jim_Hill] -nssagentmgr 4454/udp # NSS Agent Manager [Jim_Hill] [Jim_Hill] -prchat-user 4455/tcp # PR Chat User -prchat-user 4455/udp # PR Chat User -prchat-server 4456/tcp # PR Chat Server -prchat-server 4456/udp # PR Chat Server -prRegister 4457/tcp # PR Register [Donny_Gilor] [Donny_Gilor] -prRegister 4457/udp # PR Register [Donny_Gilor] [Donny_Gilor] -mcp 4458/tcp # Matrix Configuration [Tim_DeBaillie] [Tim_DeBaillie] 2006-12 -# Protocol -mcp 4458/udp # Matrix Configuration [Tim_DeBaillie] [Tim_DeBaillie] 2006-12 -# Protocol -# 4459-4483 Unassigned -hpssmgmt 4484/tcp # hpssmgmt service [David_Straw] [David_Straw] 2005-11 -hpssmgmt 4484/udp # hpssmgmt service [David_Straw] [David_Straw] 2005-11 -assyst-dr 4485/tcp # Assyst Data Repository [Albert_Cester] [Albert_Cester] 2008-08-26 -# Service -# 4485 udp Reserved -icms 4486/tcp # Integrated Client Message [Resource_Allocation] [Resource_Allocation] 2010-09-27 -# Service -icms 4486/udp # Integrated Client Message [Resource_Allocation] [Resource_Allocation] 2010-09-27 -# Service -prex-tcp 4487/tcp # Protocol for Remote [Daniel_Ruppert] [Daniel_Ruppert] 2010-09-16 -# Execution over TCP -# 4487 udp Reserved -awacs-ice 4488/tcp # Apple Wide Area Connectivity [Rory_McGuire] [Rory_McGuire] 2010-09-24 -# Service ICE Bootstrap -awacs-ice 4488/udp # Apple Wide Area Connectivity [Rory_McGuire] [Rory_McGuire] 2010-09-24 -# Service ICE Bootstrap -# Known -# UNAUTHORIZED -# 4489-4499 Unassigned USE: Ports -# 4490 and -# 4491 -ipsec-nat-t 4500/tcp # IPsec NAT-Traversal [RFC3947] -ipsec-nat-t 4500/udp # IPsec NAT-Traversal [RFC3947] -# 4501 Unassigned [IANA] [IANA] De-registered 08 June 2001 -a25-fap-fgw 4502/sctp # A25 (FAP-FGW) [ThreeGPP_2] [Zhiming_Li] 2012-01-11 -# 4503-4533 Unassigned -# 4534 tcp Reserved -armagetronad 4534/udp # Armagetron Advanced Game [Manuel_Moos] [Yann_Kaiser] 2012-11-02 -# Server -ehs 4535/tcp # Event Heap Server -ehs 4535/udp # Event Heap Server -ehs-ssl 4536/tcp # Event Heap Server SSL [Brad_Johanson] [Brad_Johanson] 2005-08 -ehs-ssl 4536/udp # Event Heap Server SSL [Brad_Johanson] [Brad_Johanson] 2005-08 -wssauthsvc 4537/tcp # WSS Security Service [Mark_Tirschwell] [Mark_Tirschwell] 2006-01 -wssauthsvc 4537/udp # WSS Security Service [Mark_Tirschwell] [Mark_Tirschwell] 2006-01 -swx-gate 4538/tcp # Software Data Exchange [Julien_VALIENTE] [Julien_VALIENTE] 2006-05 -# Gateway -swx-gate 4538/udp # Software Data Exchange [Julien_VALIENTE] [Julien_VALIENTE] 2006-05 -# Gateway -# 4539-4544 Unassigned -worldscores 4545/tcp # WorldScores [Steve_Davis] [Steve_Davis] -worldscores 4545/udp # WorldScores [Steve_Davis] [Steve_Davis] -sf-lm 4546/tcp # SF License Manager [Thomas_Koell] [Thomas_Koell] -# (Sentinel) -sf-lm 4546/udp # SF License Manager [Thomas_Koell] [Thomas_Koell] -# (Sentinel) -lanner-lm 4547/tcp # Lanner License Manager [Les_Enstone] [Les_Enstone] -lanner-lm 4547/udp # Lanner License Manager [Les_Enstone] [Les_Enstone] -synchromesh 4548/tcp # Synchromesh [Tom_Hawkins_2] [Tom_Hawkins_2] 2006-02 -synchromesh 4548/udp # Synchromesh [Tom_Hawkins_2] [Tom_Hawkins_2] 2006-02 -aegate 4549/tcp # Aegate PMR Service [Nick_Warrington] [Nick_Warrington] 2006-03 -aegate 4549/udp # Aegate PMR Service [Nick_Warrington] [Nick_Warrington] 2006-03 -gds-adppiw-db 4550/tcp # Perman I Interbase Server [Leo_Lesage] [Leo_Lesage] 2006-04 -gds-adppiw-db 4550/udp # Perman I Interbase Server [Leo_Lesage] [Leo_Lesage] 2006-04 -ieee-mih 4551/tcp # MIH Services [RFC5677] -ieee-mih 4551/udp # MIH Services [RFC5677] -menandmice-mon 4552/tcp # Men and Mice Monitoring [Carsten_Strotmann] [Carsten_Strotmann] 2009-05-20 -menandmice-mon 4552/udp # Men and Mice Monitoring [Carsten_Strotmann] [Carsten_Strotmann] 2009-05-20 -icshostsvc 4553/tcp # ICS host services [Gordan_Vosicki] [Gordan_Vosicki] 2009-09-23 -# 4553 udp Reserved -msfrs 4554/tcp # MS FRS Replication [Kev_George] [Kev_George] 2006-09 -msfrs 4554/udp # MS FRS Replication [Kev_George] [Kev_George] 2006-09 -rsip 4555/tcp # RSIP Port [RFC3103] -rsip 4555/udp # RSIP Port [RFC3103] -dtn-bundle 4556/tcp # DTN Bundle TCP CL Protocol [Simon_Perreault] [Simon_Perreault] 2014-03-12 [RFC7242] -dtn-bundle 4556/udp # DTN Bundle UDP CL Protocol 2006-11 2014-02-21 [RFC7122] -dtn-bundle 4556/dccp # DTN Bundle DCCP CL Protocol 2013-11-12 2014-02-21 [RFC7122] 1685351985 -# 4557 tcp Reserved -mtcevrunqss 4557/udp # Marathon everRun Quorum [David_Schwartz_2] [David_Schwartz_2] 2009-06-18 -# Service Server -# 4558 tcp Reserved -mtcevrunqman 4558/udp # Marathon everRun Quorum [David_Schwartz_2] [David_Schwartz_2] 2009-06-18 -# Service Manager -hylafax 4559/tcp # HylaFAX [Lee_Howard] [Lee_Howard] 2002-03 -hylafax 4559/udp # HylaFAX [Lee_Howard] [Lee_Howard] 2002-03 -# 4560-4562 Unassigned -amahi-anywhere 4563/tcp # Amahi Anywhere [Amahi] [Carlos_Puchol] 2014-02-27 -# 4563 udp Reserved -# 4564-4565 Unassigned -kwtc 4566/tcp # Kids Watch Time Control [Larry_Zarou] [Larry_Zarou] 2006-10 -# Service -kwtc 4566/udp # Kids Watch Time Control [Larry_Zarou] [Larry_Zarou] 2006-10 -# Service -tram 4567/tcp # TRAM [Joe_Wesley] [Joe_Wesley] -tram 4567/udp # TRAM [Joe_Wesley] [Joe_Wesley] -bmc-reporting 4568/tcp # BMC Reporting [Portnoy_Boxman] [Portnoy_Boxman] -bmc-reporting 4568/udp # BMC Reporting [Portnoy_Boxman] [Portnoy_Boxman] -# Defined TXT keys: -# auth plaintext | md5 | rsakeys -# userid alphanumeric, additionally '_', '+', '-' -# secret any printable ASCII characters -# domain any DNS domain name or IP address -# extension alphanumeric, additionally '*', '#', '_', '+', '-' -# context alphanumeric, additionally '_', '+', '-' -iax 4569/tcp # Inter-Asterisk eXchange [Benjamin_Kowarsch] [Benjamin_Kowarsch] [RFC5456] trunk yes | no | 0 | 1 -# welcome alphanumeric, additionally '*', '#', '_', '+', '-' -# voicemail alphanumeric, additionally '*', '#', '_', '+', '-' -# reception alphanumeric, additionally '*', '#', '_', '+', '-' -# echotest alphanumeric, additionally '*', '#', '_', '+', '-' -# ivrtest alphanumeric, additionally '*', '#', '_', '+', '-' -# All of these TXT record keys are optional, they may be -# omitted. Further keys may be added in the future. -# Defined TXT keys: -# auth plaintext | md5 | rsakeys -# userid alphanumeric, additionally '_', '+', '-' -# secret any printable ASCII characters -# domain any DNS domain name or IP address -# extension alphanumeric, additionally '*', '#', '_', '+', '-' -# context alphanumeric, additionally '_', '+', '-' -iax 4569/udp # Inter-Asterisk eXchange [Benjamin_Kowarsch] [Benjamin_Kowarsch] [RFC5456] trunk yes | no | 0 | 1 -# welcome alphanumeric, additionally '*', '#', '_', '+', '-' -# voicemail alphanumeric, additionally '*', '#', '_', '+', '-' -# reception alphanumeric, additionally '*', '#', '_', '+', '-' -# echotest alphanumeric, additionally '*', '#', '_', '+', '-' -# ivrtest alphanumeric, additionally '*', '#', '_', '+', '-' -# All of these TXT record keys are optional, they may be -# omitted. Further keys may be added in the future. -# Service to distribute and -deploymentmap 4570/tcp # update within a site [Oracle_3] [Dan_Newman] 2013-09-20 -# deployment information for -# Oracle Communications Suite -# 4570 udp Reserved -# 4571-4589 Unassigned -rid 4590/tcp # RID over HTTP/TLS [IESG] [IETF_Chair] [RFC6546] -# 4590 udp Reserved -l3t-at-an 4591/tcp # HRPD L3T (AT-AN) [Avi_Lior] [Avi_Lior] 2009-02-27 -l3t-at-an 4591/udp # HRPD L3T (AT-AN) [Avi_Lior] [Avi_Lior] 2009-02-27 -# 4592 tcp Reserved -hrpd-ith-at-an 4592/udp # HRPD-ITH (AT-AN) [David_Ott] [David_Ott] 2008-06-05 -ipt-anri-anri 4593/tcp # IPT (ANRI-ANRI) -ipt-anri-anri 4593/udp # IPT (ANRI-ANRI) -ias-session 4594/tcp # IAS-Session (ANRI-ANRI) -ias-session 4594/udp # IAS-Session (ANRI-ANRI) -ias-paging 4595/tcp # IAS-Paging (ANRI-ANRI) -ias-paging 4595/udp # IAS-Paging (ANRI-ANRI) -ias-neighbor 4596/tcp # IAS-Neighbor (ANRI-ANRI) [David_Ott] [David_Ott] 2007-07-31 -ias-neighbor 4596/udp # IAS-Neighbor (ANRI-ANRI) [David_Ott] [David_Ott] 2007-07-31 -a21-an-1xbs 4597/tcp # A21 (AN-1xBS) [David_Ott] [David_Ott] 2006-02 -a21-an-1xbs 4597/udp # A21 (AN-1xBS) [David_Ott] [David_Ott] 2006-02 -a16-an-an 4598/tcp # A16 (AN-AN) [David_Ott] [David_Ott] 2005-12 -a16-an-an 4598/udp # A16 (AN-AN) [David_Ott] [David_Ott] 2005-12 -a17-an-an 4599/tcp # A17 (AN-AN) [David_Ott] [David_Ott] 2006-02 -a17-an-an 4599/udp # A17 (AN-AN) [David_Ott] [David_Ott] 2006-02 -piranha1 4600/tcp # Piranha1 -piranha1 4600/udp # Piranha1 -piranha2 4601/tcp # Piranha2 [Primark_Corporation] [Primark_Corporation] -piranha2 4601/udp # Piranha2 [Primark_Corporation] [Primark_Corporation] -mtsserver 4602/tcp # EAX MTS Server [Pedro_A_Rodriguez] [Pedro_A_Rodriguez] 2008-08-06 -# 4602 udp Reserved -menandmice-upg 4603/tcp # Men & Mice Upgrade Agent [Eggert_Thorlacius_2] [Eggert_Thorlacius_2] 2010-01-27 -# 4603 udp Reserved -irp 4604/tcp # Identity Registration [Sixscape_Communications_Pte_Ltd] [Lawrence_E._Hughes] 2014-03-17 2014-08-26 -# Protocol -# 4604 udp Reserved -sixchat 4605/tcp # Direct End to End Secure [Sixscape_Communications_Pte_Ltd] [Lawrence_E._Hughes] 2014-09-11 -# Chat Protocol -# 4605 udp Reserved -# 4606-4657 Unassigned -playsta2-app 4658/tcp # PlayStation2 App Port -playsta2-app 4658/udp # PlayStation2 App Port -playsta2-lob 4659/tcp # PlayStation2 Lobby Port [Noam_Rimon] [Noam_Rimon] 2004-12 -playsta2-lob 4659/udp # PlayStation2 Lobby Port [Noam_Rimon] [Noam_Rimon] 2004-12 -smaclmgr 4660/tcp # smaclmgr [Hiromi_Taki] [Hiromi_Taki] -smaclmgr 4660/udp # smaclmgr [Hiromi_Taki] [Hiromi_Taki] -kar2ouche 4661/tcp # Kar2ouche Peer location [Andy_Krouwel] [Andy_Krouwel] -# service -kar2ouche 4661/udp # Kar2ouche Peer location [Andy_Krouwel] [Andy_Krouwel] -# service -oms 4662/tcp # OrbitNet Message Service [Roy_Davies] [Roy_Davies] 2005-08 -oms 4662/udp # OrbitNet Message Service [Roy_Davies] [Roy_Davies] 2005-08 -noteit 4663/tcp # Note It! Message Service [Pedro_Alpedrinha] [Pedro_Alpedrinha] 2006-02 -noteit 4663/udp # Note It! Message Service [Pedro_Alpedrinha] [Pedro_Alpedrinha] 2006-02 -ems 4664/tcp # Rimage Messaging Server [David_V_Raskin] [David_V_Raskin] 2006-02 -ems 4664/udp # Rimage Messaging Server [David_V_Raskin] [David_V_Raskin] 2006-02 -contclientms 4665/tcp # Container Client Message [Bruce_Thompson] [Bruce_Thompson] 2006-02 -# Service -contclientms 4665/udp # Container Client Message [Bruce_Thompson] [Bruce_Thompson] 2006-02 -# Service -eportcomm 4666/tcp # E-Port Message Service -eportcomm 4666/udp # E-Port Message Service -mmacomm 4667/tcp # MMA Comm Services -mmacomm 4667/udp # MMA Comm Services -mmaeds 4668/tcp # MMA EDS Service [Robert_Shaffer] [Robert_Shaffer] 2006-02 -mmaeds 4668/udp # MMA EDS Service [Robert_Shaffer] [Robert_Shaffer] 2006-02 -eportcommdata 4669/tcp # E-Port Data Service [Robert_Shaffer] [Robert_Shaffer] 2006-02 -eportcommdata 4669/udp # E-Port Data Service [Robert_Shaffer] [Robert_Shaffer] 2006-02 -light 4670/tcp # Light packets transfer [Adam_Golovenko] [Adam_Golovenko] 2006-10 -# protocol -light 4670/udp # Light packets transfer [Adam_Golovenko] [Adam_Golovenko] 2006-10 -# protocol -acter 4671/tcp # Bull RSF action server [Christian_Caudrelier] [Christian_Caudrelier] 2006-02 -acter 4671/udp # Bull RSF action server [Christian_Caudrelier] [Christian_Caudrelier] 2006-02 -rfa 4672/tcp # remote file access server -rfa 4672/udp # remote file access server -cxws 4673/tcp # CXWS Operations [Phil_Abercrombie] [Phil_Abercrombie] 2005-08 -cxws 4673/udp # CXWS Operations [Phil_Abercrombie] [Phil_Abercrombie] 2005-08 -appiq-mgmt 4674/tcp # AppIQ Agent Management [Phil_Abercrombie] [Phil_Abercrombie] 2005-08 -appiq-mgmt 4674/udp # AppIQ Agent Management [Phil_Abercrombie] [Phil_Abercrombie] 2005-08 -dhct-status 4675/tcp # BIAP Device Status -dhct-status 4675/udp # BIAP Device Status -dhct-alerts 4676/tcp # BIAP Generic Alert [Louis_Slothouber] [Louis_Slothouber] 2005-08 -dhct-alerts 4676/udp # BIAP Generic Alert [Louis_Slothouber] [Louis_Slothouber] 2005-08 -bcs 4677/tcp # Business Continuity Servi [Siew_Sim] [Siew_Sim] 2005-08 -bcs 4677/udp # Business Continuity Servi [Siew_Sim] [Siew_Sim] 2005-08 -traversal 4678/tcp # boundary traversal [Kevin_Lu] [Kevin_Lu] 2005-08 -traversal 4678/udp # boundary traversal [Kevin_Lu] [Kevin_Lu] 2005-08 -mgesupervision 4679/tcp # MGE UPS Supervision -mgesupervision 4679/udp # MGE UPS Supervision -mgemanagement 4680/tcp # MGE UPS Management [Lecuivre_J] [Lecuivre_J] 2005-08 -mgemanagement 4680/udp # MGE UPS Management [Lecuivre_J] [Lecuivre_J] 2005-08 -parliant 4681/tcp # Parliant Telephony System [Colin_Henein] [Colin_Henein] 2005-08 -parliant 4681/udp # Parliant Telephony System [Colin_Henein] [Colin_Henein] 2005-08 -finisar 4682/tcp # finisar [Christina_Mercier] [Christina_Mercier] 2005-08 -finisar 4682/udp # finisar [Christina_Mercier] [Christina_Mercier] 2005-08 -spike 4683/tcp # Spike Clipboard Service [Scott_Herscher] [Scott_Herscher] 2005-08 -spike 4683/udp # Spike Clipboard Service [Scott_Herscher] [Scott_Herscher] 2005-08 -rfid-rp1 4684/tcp # RFID Reader Protocol 1.0 [Michael_Mealling_2] [Michael_Mealling_2] 2005-08 -rfid-rp1 4684/udp # RFID Reader Protocol 1.0 [Michael_Mealling_2] [Michael_Mealling_2] 2005-08 -autopac 4685/tcp # Autopac Protocol [Peter_Hallenbeck] [Peter_Hallenbeck] 2005-08 -autopac 4685/udp # Autopac Protocol [Peter_Hallenbeck] [Peter_Hallenbeck] 2005-08 -msp-os 4686/tcp # Manina Service Protocol [Markus_Nix] [Markus_Nix] 2005-08 -msp-os 4686/udp # Manina Service Protocol [Markus_Nix] [Markus_Nix] 2005-08 -nst 4687/tcp # Network Scanner Tool FTP [Mala_Bhat] [Mala_Bhat] 2005-08 -nst 4687/udp # Network Scanner Tool FTP [Mala_Bhat] [Mala_Bhat] 2005-08 -mobile-p2p 4688/tcp # Mobile P2P Service [Hanz_Hager] [Hanz_Hager] 2008-12-04 -mobile-p2p 4688/udp # Mobile P2P Service [Hanz_Hager] [Hanz_Hager] 2008-12-04 -altovacentral 4689/tcp # Altova DatabaseCentral [Altova] [Altova] 2005-08 -altovacentral 4689/udp # Altova DatabaseCentral [Altova] [Altova] 2005-08 -prelude 4690/tcp # Prelude IDS message proto [Yoann_Vandoorselaere] [Yoann_Vandoorselaere] 2005-08 -prelude 4690/udp # Prelude IDS message proto [Yoann_Vandoorselaere] [Yoann_Vandoorselaere] 2005-08 -mtn 4691/tcp # monotone Netsync Protocol [Thomas_Keller] [Thomas_Keller] 2010-12-22 -mtn 4691/udp # monotone Netsync Protocol [Thomas_Keller] [Thomas_Keller] 2010-12-22 -conspiracy 4692/tcp # Conspiracy messaging [Jens_Edlund] [Jens_Edlund] 2005-08 -conspiracy 4692/udp # Conspiracy messaging [Jens_Edlund] [Jens_Edlund] 2005-08 -# 4693-4699 Unassigned -netxms-agent 4700/tcp # NetXMS Agent -netxms-agent 4700/udp # NetXMS Agent -netxms-mgmt 4701/tcp # NetXMS Management -netxms-mgmt 4701/udp # NetXMS Management -netxms-sync 4702/tcp # NetXMS Server [Victor_Kirhenshtein] [Victor_Kirhenshtein] 2006-07 -# Synchronization -netxms-sync 4702/udp # NetXMS Server [Victor_Kirhenshtein] [Victor_Kirhenshtein] 2006-07 -# Synchronization -# Network Performance Quality -npqes-test 4703/tcp # Evaluation System Test [Zhengli] [Zhengli] 2010-06-28 -# Service -# 4703 udp Reserved -assuria-ins 4704/tcp # Assuria Insider [Nick_Connor] [Nick_Connor] 2010-06-30 -# 4704 udp Reserved -# 4705-4724 Unassigned -truckstar 4725/tcp # TruckStar Service [Brian_Toothill] [Brian_Toothill] 2010-10-15 -truckstar 4725/udp # TruckStar Service [Brian_Toothill] [Brian_Toothill] 2010-10-15 -# 4726 tcp Reserved -a26-fap-fgw 4726/udp # A26 (FAP-FGW) [David_Ott] [David_Ott] 2010-10-15 -fcis 4727/tcp # F-Link Client Information -# Service -fcis-disc 4727/udp # F-Link Client Information [Makoto_Zukawa] [Makoto_Zukawa] 2010-10-15 -# Service Discovery -capmux 4728/tcp # CA Port Multiplexer [Nigel_Groves] [Nigel_Groves] 2006-06 -capmux 4728/udp # CA Port Multiplexer [Nigel_Groves] [Nigel_Groves] 2006-06 -# 4729 tcp Reserved -gsmtap 4729/udp # GSM Interface Tap [Harald_Welte] [Harald_Welte] 2009-01-16 -gearman 4730/tcp # Gearman Job Queue System [Eric_Day] [Eric_Day] 2009-01-16 -gearman 4730/udp # Gearman Job Queue System [Eric_Day] [Eric_Day] 2009-01-16 -remcap 4731/tcp # Remote Capture Protocol [Marc_Donner] [Marc_Donner] 2009-01-16 -# 4731 udp Reserved -# 4732 tcp Reserved -ohmtrigger 4732/udp # OHM server trigger [Franck_Lefevre] [Franck_Lefevre] 2009-11-18 -resorcs 4733/tcp # RES Orchestration Catalog [Bob_Janssen_2] [Bob_Janssen_2] 2009-11-18 -# Services -# 4733 udp Reserved -# 4734-4736 Unassigned -ipdr-sp 4737/tcp # IPDR/SP [Ken_Sarno] [Ken_Sarno] 2005-08 -ipdr-sp 4737/udp # IPDR/SP [Ken_Sarno] [Ken_Sarno] 2005-08 -solera-lpn 4738/tcp # SoleraTec Locator [Mark_Armstrong] [Mark_Armstrong] 2005-12 -solera-lpn 4738/udp # SoleraTec Locator [Mark_Armstrong] [Mark_Armstrong] 2005-12 -ipfix 4739/tcp # IP Flow Info Export [Nevil_Brownlee] [Nevil_Brownlee] 2005-08 -ipfix 4739/udp # IP Flow Info Export [Nevil_Brownlee] [Nevil_Brownlee] 2005-08 -ipfix 4739/sctp # IP Flow Info Export [Nevil_Brownlee] [Nevil_Brownlee] 2006-01 -ipfixs 4740/tcp # ipfix protocol over TLS [Nevil_Brownlee] [Nevil_Brownlee] 2006-10 -ipfixs 4740/sctp # ipfix protocol over DTLS [Nevil_Brownlee] [Nevil_Brownlee] 2006-10 -ipfixs 4740/udp # ipfix protocol over DTLS [Nevil_Brownlee] [Nevil_Brownlee] 2006-10 -lumimgrd 4741/tcp # Luminizer Manager [George_Hwa] [George_Hwa] 2007-03 -lumimgrd 4741/udp # Luminizer Manager [George_Hwa] [George_Hwa] 2007-03 -sicct 4742/tcp # SICCT -sicct-sdp 4742/udp # SICCT Service Discovery [TeleTrusT_Deutschlan] [TeleTrusT_Deutschlan] 2006-04 -# Protocol -openhpid 4743/tcp # openhpi HPI service [Thomas_Kanngieser] [Thomas_Kanngieser] 2006-01 -openhpid 4743/udp # openhpi HPI service [Thomas_Kanngieser] [Thomas_Kanngieser] 2006-01 -ifsp 4744/tcp # Internet File [Alex_White] [Alex_White] 2007-09-12 -# Synchronization Protocol -ifsp 4744/udp # Internet File [Alex_White] [Alex_White] 2007-09-12 -# Synchronization Protocol -fmp 4745/tcp # Funambol Mobile Push [Andrea_Gazzaniga] [Andrea_Gazzaniga] 2007-01 -fmp 4745/udp # Funambol Mobile Push [Andrea_Gazzaniga] [Andrea_Gazzaniga] 2007-01 -# 4746 Unassigned -buschtrommel 4747/udp # peer-to-peer file exchange [None] [Tobias_Sturm] 2013-01-14 -# protocol -# 4747 tcp Reserved -# 4748-4748 Unassigned -profilemac 4749/tcp # Profile for Mac [David_Sinclair] [David_Sinclair] 2006-05 -profilemac 4749/udp # Profile for Mac [David_Sinclair] [David_Sinclair] 2006-05 -ssad 4750/tcp # Simple Service Auto [Dr_Horst_Herb] [Dr_Horst_Herb] 2005-12 -# Discovery -ssad 4750/udp # Simple Service Auto [Dr_Horst_Herb] [Dr_Horst_Herb] 2005-12 -# Discovery -spocp 4751/tcp # Simple Policy Control [Roland_Hedberg_2] [Roland_Hedberg_2] 2005-08 -# Protocol -spocp 4751/udp # Simple Policy Control [Roland_Hedberg_2] [Roland_Hedberg_2] 2005-08 -# Protocol -snap 4752/tcp # Simple Network Audio [Dameon_Wagner] [Dameon_Wagner] 2002-02 -# Protocol -snap 4752/udp # Simple Network Audio [Dameon_Wagner] [Dameon_Wagner] 2002-02 -# Protocol -simon 4753/tcp # Simple Invocation of Methods [Alexander_Christian] [Alexander_Christian] 2012-04-19 -# Over Network (SIMON) -# Simple Invocation of Methods -simon-disc 4753/udp # Over Network (SIMON) [Alexander_Christian] [Alexander_Christian] 2012-04-19 -# Discovery -# 4754-4783 Unassigned -bfd-multi-ctl 4784/tcp # BFD Multihop Control [Dave_Katz][Dave_Ward] [Dave_Katz][Dave_Ward] 2006-02 -bfd-multi-ctl 4784/udp # BFD Multihop Control [Dave_Katz][Dave_Ward] [Dave_Katz][Dave_Ward] 2006-02 -# 4785 tcp Reserved -cncp 4785/udp # Cisco Nexus Control Protocol [Joseph_Swaminathan] [Joseph_Swaminathan] 2009-04-01 -smart-install 4786/tcp # Smart Install Service [Amit_Nigam] [Amit_Nigam] 2009-08-24 -# 4786 udp Reserved -# Service Insertion -sia-ctrl-plane 4787/tcp # Architecture (SIA) [Shree_Murthy] [Shree_Murthy] 2009-10-29 -# Control-Plane -# 4787 udp Reserved -# eXtensible Messaging Client Defined TXT keys: txtvers=1 (as described in the draft) -xmcp 4788/tcp # Protocol [Cisco] [Glenn_Matthews] 2011-05-23 2011-10-25 protovers= (examples: "protovers=1.0" "protovers=1.1,2.0" -# 4788 udp Reserved -vxlan 4789/udp # Virtual eXtensible Local [Lawrence_Kreeger] [Lawrence_Kreeger] 2013-04-19 2014-06-17 [RFC7348] -# Area Network (VXLAN) -# 4789 tcp Reserved -# Generic Protocol Extension -vxlan-gpe 4790/udp # for Virtual eXtensible Local [Lawrence_Kreeger] [Lawrence_Kreeger] 2014-08-26 -# Area Network (VXLAN) -# 4790 tcp Reserved -roce 4791/udp # IP Routable RocE [InfiniBand_Trade_Association] [Diego_Crupnicoff] 2014-10-17 -# 4791 tcp Reserved -# 4792-4799 Unassigned -iims 4800/tcp # Icona Instant Messenging -# System -iims 4800/udp # Icona Instant Messenging -# System -iwec 4801/tcp # Icona Web Embedded Chat -iwec 4801/udp # Icona Web Embedded Chat -ilss 4802/tcp # Icona License System Server [Paul_Stephen_Borlie] [Paul_Stephen_Borlie] -ilss 4802/udp # Icona License System Server [Paul_Stephen_Borlie] [Paul_Stephen_Borlie] -notateit 4803/tcp # Notateit Messaging -notateit-disc 4803/udp # Notateit Messaging Discovery [Ean_Black] [Ean_Black] 2009-04-08 -# 4804 tcp Reserved -aja-ntv4-disc 4804/udp # AJA ntv4 Video System [Mike_Bernadett] [Mike_Bernadett] 2010-06-03 -# Discovery -# 4805-4826 Unassigned -htcp 4827/tcp # HTCP [Paul_Vixie] [Paul_Vixie] -htcp 4827/udp # HTCP [Paul_Vixie] [Paul_Vixie] -# 4828-4836 Unassigned -varadero-0 4837/tcp # Varadero-0 -varadero-0 4837/udp # Varadero-0 -varadero-1 4838/tcp # Varadero-1 -varadero-1 4838/udp # Varadero-1 -varadero-2 4839/tcp # Varadero-2 [Carlos_Arteaga] [Carlos_Arteaga] -varadero-2 4839/udp # Varadero-2 [Carlos_Arteaga] [Carlos_Arteaga] -opcua-tcp 4840/tcp # OPC UA TCP Protocol -opcua-udp 4840/udp # OPC UA TCP Protocol [Randy_Armstrong] [Randy_Armstrong] 2006-09 -quosa 4841/tcp # QUOSA Virtual Library [Uri_Blank] [Uri_Blank] 2006-09 -# Service -quosa 4841/udp # QUOSA Virtual Library [Uri_Blank] [Uri_Blank] 2006-09 -# Service -gw-asv 4842/tcp # nCode ICE-flow Library [Ross_Swithenbank] [Ross_Swithenbank] 2006-09 -# AppServer -gw-asv 4842/udp # nCode ICE-flow Library [Ross_Swithenbank] [Ross_Swithenbank] 2006-09 -# AppServer -opcua-tls 4843/tcp # OPC UA TCP Protocol over [Randy_Armstrong] [Randy_Armstrong] 2006-09 -# TLS/SSL -opcua-tls 4843/udp # OPC UA TCP Protocol over [Randy_Armstrong] [Randy_Armstrong] 2006-09 -# TLS/SSL -gw-log 4844/tcp # nCode ICE-flow Library [Ross_Swithenbank] [Ross_Swithenbank] 2006-09 -# LogServer -gw-log 4844/udp # nCode ICE-flow Library [Ross_Swithenbank] [Ross_Swithenbank] 2006-09 -# LogServer -wcr-remlib 4845/tcp # WordCruncher Remote Library [Jason_Dzubak] [Jason_Dzubak] 2008-03-17 -# Service -wcr-remlib 4845/udp # WordCruncher Remote Library [Jason_Dzubak] [Jason_Dzubak] 2008-03-17 -# Service -# Contamac ICM Service -# -contamac-icm 4846/tcp # IANA assigned this [Abdullah_Obeid] [Abdullah_Obeid] 2008-03-20 -# well-formed service name as -# a replacement for -# "contamac_icm". -# This entry is an alias to "contamac-icm". This entry is now -contamac_icm 4846/tcp # Contamac ICM Service [Abdullah_Obeid] [Abdullah_Obeid] 2008-03-20 historic, not usable for use with many common service -# discovery mechanisms. -# Contamac ICM Service -# -contamac-icm 4846/udp # IANA assigned this [Abdullah_Obeid] [Abdullah_Obeid] 2008-03-20 -# well-formed service name as -# a replacement for -# "contamac_icm". -# This entry is an alias to "contamac-icm". This entry is now -contamac_icm 4846/udp # Contamac ICM Service [Abdullah_Obeid] [Abdullah_Obeid] 2008-03-20 historic, not usable for use with many common service -# discovery mechanisms. -wfc 4847/tcp # Web Fresh Communication [Jonathan_Bastnagel] [Jonathan_Bastnagel] 2007-09-17 -wfc 4847/udp # Web Fresh Communication [Jonathan_Bastnagel] [Jonathan_Bastnagel] 2007-09-17 -appserv-http 4848/tcp # App Server - Admin HTTP -appserv-http 4848/udp # App Server - Admin HTTP -appserv-https 4849/tcp # App Server - Admin HTTPS [Sreeram_Duvvuru] [Sreeram_Duvvuru] 2002-04 -appserv-https 4849/udp # App Server - Admin HTTPS [Sreeram_Duvvuru] [Sreeram_Duvvuru] 2002-04 -sun-as-nodeagt 4850/tcp # Sun App Server - NA [Kedar_Mhaswade] [Kedar_Mhaswade] 2004-11 -sun-as-nodeagt 4850/udp # Sun App Server - NA [Kedar_Mhaswade] [Kedar_Mhaswade] 2004-11 -derby-repli 4851/tcp # Apache Derby Replication [Jorgen_Loland] [Jorgen_Loland] 2008-02-27 -derby-repli 4851/udp # Apache Derby Replication [Jorgen_Loland] [Jorgen_Loland] 2008-02-27 -# 4852-4866 Unassigned -unify-debug 4867/tcp # Unify Debugger [Daegis_Inc] [Chris_Anderson] 2006-05 2012-07-31 -unify-debug 4867/udp # Unify Debugger [Daegis_Inc] [Chris_Anderson] 2006-05 2012-07-31 -phrelay 4868/tcp # Photon Relay -phrelay 4868/udp # Photon Relay -phrelaydbg 4869/tcp # Photon Relay Debug [Michael_Hunter] [Michael_Hunter] -phrelaydbg 4869/udp # Photon Relay Debug [Michael_Hunter] [Michael_Hunter] -cc-tracking 4870/tcp # Citcom Tracking Service [Wolfgang_Weidner] [Wolfgang_Weidner] 2005-12 -cc-tracking 4870/udp # Citcom Tracking Service [Wolfgang_Weidner] [Wolfgang_Weidner] 2005-12 -wired 4871/tcp # Wired [Axel_Andersson] [Axel_Andersson] 2006-02 -wired 4871/udp # Wired [Axel_Andersson] [Axel_Andersson] 2006-02 -# 4872-4875 Unassigned -tritium-can 4876/tcp # Tritium CAN Bus Bridge [James_Kennedy] [James_Kennedy] 2011-02-15 -# Service -tritium-can 4876/udp # Tritium CAN Bus Bridge [James_Kennedy] [James_Kennedy] 2011-02-15 -# Service -lmcs 4877/tcp # Lighting Management Control [Timothy_Parry] [Timothy_Parry] 2011-02-15 -# System -lmcs 4877/udp # Lighting Management Control [Timothy_Parry] [Timothy_Parry] 2011-02-15 -# System -# 4878 tcp Reserved -inst-discovery 4878/udp # Agilent Instrument Discovery [Charles_F_Steele] [Charles_F_Steele] 2011-02-15 -wsdl-event 4879/tcp # WSDL Event Receiver [Charles_F_Steele] [Charles_F_Steele] 2011-02-15 -# 4879 udp Reserved -hislip 4880/tcp # IVI High-Speed LAN [Joe_Mueller] [Joe_Mueller] 2010-01-11 -# Instrument Protocol -# 4880 udp Reserved -# 4881 tcp Reserved -socp-t 4881/udp # SOCP Time Synchronization [Joe_Haver] [Joe_Haver] 2010-05-28 -# Protocol -# 4882 tcp Reserved -socp-c 4882/udp # SOCP Control Protocol [Joe_Haver] [Joe_Haver] 2010-05-28 -wmlserver 4883/tcp # Meier-Phelps License Server [William_Phelps] [William_Phelps] 2010-03-22 -# 4883 udp Reserved -hivestor 4884/tcp # HiveStor Distributed File [Nicholas_Young] [Nicholas_Young] 2008-07-10 -# System -hivestor 4884/udp # HiveStor Distributed File [Nicholas_Young] [Nicholas_Young] 2008-07-10 -# System -abbs 4885/tcp # ABBS [Ryan_Rubley] [Ryan_Rubley] -abbs 4885/udp # ABBS [Ryan_Rubley] [Ryan_Rubley] -# 4886-4893 Unassigned -lyskom 4894/tcp # LysKOM Protocol A [Per_Cederqvist] [Per_Cederqvist] -lyskom 4894/udp # LysKOM Protocol A [Per_Cederqvist] [Per_Cederqvist] -# 4895-4898 Unassigned -radmin-port 4899/tcp # RAdmin Port [Dmitri_Znosko] [Dmitri_Znosko] 2003-03 -radmin-port 4899/udp # RAdmin Port [Dmitri_Znosko] [Dmitri_Znosko] 2003-03 -hfcs 4900/tcp # HFSQL Client/Server Database [PC_SOFT] [Jerome_AERTS_2] 2006-03-02 2014-02-02 -# Engine -hfcs 4900/udp # HFSQL Client/Server Database [PC_SOFT] [Jerome_AERTS_2] 2006-03-02 2014-02-02 -# Engine -# FileLocator Remote Search -# Agent -# -flr-agent 4901/tcp # IANA assigned this [David_Vest] [David_Vest] 2008-11-19 -# well-formed service name as -# a replacement for -# "flr_agent". -# FileLocator Remote Search This entry is an alias to "flr-agent". This entry is now -flr_agent 4901/tcp # Agent [David_Vest] [David_Vest] 2008-11-19 historic, not usable for use with many common service -# discovery mechanisms. -# 4901 udp Reserved -magiccontrol 4902/tcp # magicCONROL RF and Data [Andreas_Spalenski] [Andreas_Spalenski] 2008-11-24 -# Interface -# 4902 udp Reserved -# 4903-4911 Unassigned -lutap 4912/tcp # Technicolor LUT Access [Markus_Loeffler] [Markus_Loeffler] 2009-02-17 -# Protocol -# 4912 udp Reserved -lutcp 4913/tcp # LUTher Control Protocol [Markus_Loeffler] [Markus_Loeffler] 2007-07-03 -bones 4914/tcp # Bones Remote Control [Andreas_Foedrowitz] [Andreas_Foedrowitz] 2008-06-18 -bones 4914/udp # Bones Remote Control [Andreas_Foedrowitz] [Andreas_Foedrowitz] 2008-06-18 -frcs 4915/tcp # Fibics Remote Control [Ken_Lagarec] [Ken_Lagarec] 2009-04-17 -# Service -# 4915 udp Reserved -# 4916-4935 Unassigned -an-signaling 4936/udp # Signal protocol port for [Cisco_systems_3] [Toerless_Eckert_2] 2014-06-06 -# autonomic networking -# 4936 tcp Reserved -# 4937 tcp Reserved -atsc-mh-ssc 4937/udp # ATSC-M/H Service Signaling [Jerry_Whitaker] [Jerry_Whitaker] 2008-10-27 -# Channel -# 4938-4939 Unassigned -eq-office-4940 4940/tcp # Equitrac Office -eq-office-4940 4940/udp # Equitrac Office -eq-office-4941 4941/tcp # Equitrac Office -eq-office-4941 4941/udp # Equitrac Office -eq-office-4942 4942/tcp # Equitrac Office [Tom_Haapanen_2] [Tom_Haapanen_2] 2007-07-11 -eq-office-4942 4942/udp # Equitrac Office [Tom_Haapanen_2] [Tom_Haapanen_2] 2007-07-11 -# 4943-4948 Unassigned -munin 4949/tcp # Munin Graphing Framework [Jimmy_Olsen] [Jimmy_Olsen] 2010-12-24 -munin 4949/udp # Munin Graphing Framework [Jimmy_Olsen] [Jimmy_Olsen] 2010-12-24 -sybasesrvmon 4950/tcp # Sybase Server Monitor [Chris_Irie] [Chris_Irie] 2008-03-26 -sybasesrvmon 4950/udp # Sybase Server Monitor [Chris_Irie] [Chris_Irie] 2008-03-26 -pwgwims 4951/tcp # PWG WIMS [Ira_McDonald] [Ira_McDonald] 2005-12 -pwgwims 4951/udp # PWG WIMS [Ira_McDonald] [Ira_McDonald] 2005-12 -sagxtsds 4952/tcp # SAG Directory Server [Michael_Chirila] [Michael_Chirila] 2006-01 -sagxtsds 4952/udp # SAG Directory Server [Michael_Chirila] [Michael_Chirila] 2006-01 -dbsyncarbiter 4953/tcp # Synchronization Arbiter [Dave_Neudoerffer_2] [Dave_Neudoerffer_2] 2009-11-18 -# 4953 udp Reserved -# Known -# 4954-4968 Unassigned UNAUTHORIZED -# USE: port -# 4967 -ccss-qmm 4969/tcp # CCSS QMessageMonitor -ccss-qmm 4969/udp # CCSS QMessageMonitor -ccss-qsm 4970/tcp # CCSS QSystemMonitor [David_Young] [David_Young] 2006-01 -ccss-qsm 4970/udp # CCSS QSystemMonitor [David_Young] [David_Young] 2006-01 -# 4971-4979 Unassigned -ctxs-vpp 4980/udp # Citrix Virtual Path [Citrix_Systems] [Rohith_Ramkumar] 2015-04-17 -# 4980 tcp Reserved -# 4981-4982 Unassigned -# 4983 Unassigned 2005-12-22 -webyast 4984/tcp # WebYast [Federico_Lucifredi] [Federico_Lucifredi] 2009-09-25 -# 4984 udp Reserved -gerhcs 4985/tcp # GER HC Standard [Roger_Ward] [Roger_Ward] 2009-09-25 -# 4985 udp Reserved -mrip 4986/tcp # Model Railway Interface [Howard_Amos] [Howard_Amos] 2006-04 -# Program -mrip 4986/udp # Model Railway Interface [Howard_Amos] [Howard_Amos] 2006-04 -# Program -smar-se-port1 4987/tcp # SMAR Ethernet Port 1 -smar-se-port1 4987/udp # SMAR Ethernet Port 1 -smar-se-port2 4988/tcp # SMAR Ethernet Port 2 [Delcio_Prizon] [Delcio_Prizon] -smar-se-port2 4988/udp # SMAR Ethernet Port 2 [Delcio_Prizon] [Delcio_Prizon] -parallel 4989/tcp # Parallel for GAUSS (tm) [Matthew_Ford] [Matthew_Ford] 2003-03 -parallel 4989/udp # Parallel for GAUSS (tm) [Matthew_Ford] [Matthew_Ford] 2003-03 -busycal 4990/tcp # BusySync Calendar Synch. [David_Riggle] [David_Riggle] 2008-01-07 Defined TXT keys: Proprietary -# Protocol -busycal 4990/udp # BusySync Calendar Synch. [David_Riggle] [David_Riggle] 2008-01-07 Defined TXT keys: Proprietary -# Protocol -vrt 4991/tcp # VITA Radio Transport [Sam_Bretheim] [Sam_Bretheim] 2009-01-08 -vrt 4991/udp # VITA Radio Transport [Sam_Bretheim] [Sam_Bretheim] 2009-01-08 -# 4992-4998 Unassigned -hfcs-manager 4999/tcp # HFSQL Client/Server Database [PC_SOFT] [Jerome_AERTS_2] 2006-03-02 2014-02-02 -# Engine Manager -hfcs-manager 4999/udp # HFSQL Client/Server Database [PC_SOFT] [Jerome_AERTS_2] 2006-03-02 2014-02-02 -# Engine Manager -commplex-main 5000/tcp -commplex-main 5000/udp -commplex-link 5001/tcp -commplex-link 5001/udp -rfe 5002/tcp # radio free ethernet -rfe 5002/udp # radio free ethernet -fmpro-internal 5003/tcp # FileMaker, Inc. - [Clay_Maeckel] [Clay_Maeckel] -# Proprietary transport -fmpro-internal 5003/udp # FileMaker, Inc. - [Clay_Maeckel] [Clay_Maeckel] -# Proprietary name binding -avt-profile-1 5004/tcp # RTP media data [RFC3551][RFC4571] -avt-profile-1 5004/udp # RTP media data [RFC3551] -avt-profile-1 5004/dccp # RTP media data [RFC3551][RFC5762] -avt-profile-2 5005/tcp # RTP control protocol [RFC3551][RFC4571] -avt-profile-2 5005/udp # RTP control protocol [RFC3551] -avt-profile-2 5005/dccp # RTP control protocol [RFC3551][RFC5762] -wsm-server 5006/tcp # wsm server [Adam_Berk] [Adam_Berk] -wsm-server 5006/udp # wsm server [Adam_Berk] [Adam_Berk] -wsm-server-ssl 5007/tcp # wsm server ssl [Adam_Berk] [Adam_Berk] -wsm-server-ssl 5007/udp # wsm server ssl [Adam_Berk] [Adam_Berk] -synapsis-edge 5008/tcp # Synapsis EDGE [Paul_Schilling] [Paul_Schilling] -synapsis-edge 5008/udp # Synapsis EDGE [Paul_Schilling] [Paul_Schilling] -winfs 5009/tcp # Microsoft Windows Filesystem [Simon_Skaria] [Simon_Skaria] 2006-01 -winfs 5009/udp # Microsoft Windows Filesystem [Simon_Skaria] [Simon_Skaria] 2006-01 -telelpathstart 5010/tcp # TelepathStart [Helmuth_Breitenfelln] [Helmuth_Breitenfelln] -telelpathstart 5010/udp # TelepathStart [Helmuth_Breitenfelln] [Helmuth_Breitenfelln] -telelpathattack 5011/tcp # TelepathAttack [Helmuth_Breitenfelln] [Helmuth_Breitenfelln] -telelpathattack 5011/udp # TelepathAttack [Helmuth_Breitenfelln] [Helmuth_Breitenfelln] -nsp 5012/tcp # NetOnTap Service [Kim_Hancock] [Kim_Hancock] 2007-10-24 -nsp 5012/udp # NetOnTap Service [Kim_Hancock] [Kim_Hancock] 2007-10-24 -fmpro-v6 5013/tcp # FileMaker, Inc. - [Alex_Chen] [Alex_Chen] 2007-08-01 -# Proprietary transport -fmpro-v6 5013/udp # FileMaker, Inc. - [Alex_Chen] [Alex_Chen] 2007-08-01 -# Proprietary transport -# 5014 tcp Reserved -onpsocket 5014/udp # Overlay Network Protocol [Roger_Matthias] [Roger_Matthias] 2009-08-24 -fmwp 5015/tcp # FileMaker, Inc. - Web [Alex_Chen] [Alex_Chen] 2009-11-25 -# publishing -# 5015 udp Reserved -# 5016-5019 Unassigned -zenginkyo-1 5020/tcp # zenginkyo-1 [Masashi_Suzaki] [Masashi_Suzaki] -zenginkyo-1 5020/udp # zenginkyo-1 [Masashi_Suzaki] [Masashi_Suzaki] -zenginkyo-2 5021/tcp # zenginkyo-2 [Masashi_Suzaki] [Masashi_Suzaki] -zenginkyo-2 5021/udp # zenginkyo-2 [Masashi_Suzaki] [Masashi_Suzaki] -mice 5022/tcp # mice server [Alan_Clifford] [Alan_Clifford] -mice 5022/udp # mice server [Alan_Clifford] [Alan_Clifford] -htuilsrv 5023/tcp # Htuil Server for PLD2 [Dennis_Reinhardt] [Dennis_Reinhardt] -htuilsrv 5023/udp # Htuil Server for PLD2 [Dennis_Reinhardt] [Dennis_Reinhardt] -scpi-telnet 5024/tcp # SCPI-TELNET [Ryan_Columbus] [Ryan_Columbus] 2002-10 -scpi-telnet 5024/udp # SCPI-TELNET [Ryan_Columbus] [Ryan_Columbus] 2002-10 -scpi-raw 5025/tcp # SCPI-RAW [Ryan_Columbus] [Ryan_Columbus] 2002-10 -scpi-raw 5025/udp # SCPI-RAW [Ryan_Columbus] [Ryan_Columbus] 2002-10 -strexec-d 5026/tcp # Storix I/O daemon (data) [Anthony_Johnson] [Anthony_Johnson] 2005-08 -strexec-d 5026/udp # Storix I/O daemon (data) [Anthony_Johnson] [Anthony_Johnson] 2005-08 -strexec-s 5027/tcp # Storix I/O daemon (stat) [Anthony_Johnson] [Anthony_Johnson] 2005-08 -strexec-s 5027/udp # Storix I/O daemon (stat) [Anthony_Johnson] [Anthony_Johnson] 2005-08 -qvr 5028/tcp # Quiqum Virtual Relais [Philipp_Marcel_Albre] [Philipp_Marcel_Albre] 2009-07-06 -# 5028 udp Reserved -infobright 5029/tcp # Infobright Database Server [Mark_Windrim] [Mark_Windrim] 2009-07-23 -infobright 5029/udp # Infobright Database Server [Mark_Windrim] [Mark_Windrim] 2009-07-23 -surfpass 5030/tcp # SurfPass [Olivier_Guezenec] [Olivier_Guezenec] 2006-12 -surfpass 5030/udp # SurfPass [Olivier_Guezenec] [Olivier_Guezenec] 2006-12 -# 5031 tcp Reserved -dmp 5031/udp # Direct Message Protocol [Gjermund_Wallenius] [Gjermund_Wallenius] 2009-09-30 -signacert-agent 5032/tcp # SignaCert Enterprise Trust [Harris_Corporation] [Daniel_R_Somerfield] 2011-08-05 -# Server Agent -# 5032 udp Reserved -jtnetd-server 5033/tcp # Janstor Secure Data [Janstor_Technology] [Anthony_Johnson_2] 2015-06-08 -# 5033 udp Reserved -jtnetd-status 5034/tcp # Janstor Status [Janstor_Technology] [Anthony_Johnson_2] 2015-06-08 -# 5034 udp Reserved -# 5035-5041 Unassigned -asnaacceler8db 5042/tcp # asnaacceler8db [Walter_Goodwin] [Walter_Goodwin] -asnaacceler8db 5042/udp # asnaacceler8db [Walter_Goodwin] [Walter_Goodwin] -swxadmin 5043/tcp # ShopWorX Administration [Don_W_Fitzpatrick] [Don_W_Fitzpatrick] 2005-08 -swxadmin 5043/udp # ShopWorX Administration [Don_W_Fitzpatrick] [Don_W_Fitzpatrick] 2005-08 -lxi-evntsvc 5044/tcp # LXI Event Service [Nick_Barendt] [Nick_Barendt] 2005-08 -lxi-evntsvc 5044/udp # LXI Event Service [Nick_Barendt] [Nick_Barendt] 2005-08 -osp 5045/tcp # Open Settlement Protocol [Dmitry_Isakbayev] [Dmitry_Isakbayev] 2010-03-05 -# 5045 udp Reserved -# 5046 tcp Reserved -vpm-udp 5046/udp # Vishay PM UDP Service [Ashley_Clarke] [Ashley_Clarke] 2010-06-17 -# 5047 tcp Reserved -iscape 5047/udp # iSCAPE Data Broadcasting [Roland_van_der_Veen] [Roland_van_der_Veen] 2010-06-17 -texai 5048/tcp # Texai Message Service [Stephen_Reed_2] [Stephen_Reed_2] 2010-06-17 -# 5048 udp Reserved -ivocalize 5049/tcp # iVocalize Web Conference [Bryan_Vergato] [Bryan_Vergato] 2006-05 -ivocalize 5049/udp # iVocalize Web Conference [Bryan_Vergato] [Bryan_Vergato] 2006-05 -mmcc 5050/tcp # multimedia conference [Steve_Casner] [Steve_Casner] -# control tool -mmcc 5050/udp # multimedia conference [Steve_Casner] [Steve_Casner] -# control tool -ita-agent 5051/tcp # ITA Agent [Don_Merrell] [Don_Merrell] -ita-agent 5051/udp # ITA Agent [Don_Merrell] [Don_Merrell] -ita-manager 5052/tcp # ITA Manager [Don_Merrell] [Don_Merrell] -ita-manager 5052/udp # ITA Manager [Don_Merrell] [Don_Merrell] -rlm 5053/tcp # RLM License Server [Matt_Christiano_2] [Matt_Christiano_2] 2008-07-28 -rlm-disc 5053/udp # RLM Discovery Server [Reprise_Software_Inc] [Matt_Christiano_3] 2012-11-06 -rlm-admin 5054/tcp # RLM administrative interface [Matt_Christiano_2] [Matt_Christiano_2] 2008-07-28 -# 5054 udp Reserved -unot 5055/tcp # UNOT [Gordon_Mohr_2] [Gordon_Mohr_2] -unot 5055/udp # UNOT [Gordon_Mohr_2] [Gordon_Mohr_2] -intecom-ps1 5056/tcp # Intecom Pointspan 1 [David_Meermans] [David_Meermans] -intecom-ps1 5056/udp # Intecom Pointspan 1 [David_Meermans] [David_Meermans] -intecom-ps2 5057/tcp # Intecom Pointspan 2 [David_Meermans] [David_Meermans] -intecom-ps2 5057/udp # Intecom Pointspan 2 [David_Meermans] [David_Meermans] -# 5058 tcp Reserved -locus-disc 5058/udp # Locus Discovery [Alan_King] [Alan_King] 2009-08-13 -sds 5059/tcp # SIP Directory Services [Arthur_Wilton] [Arthur_Wilton] 2006-03 -sds 5059/udp # SIP Directory Services [Arthur_Wilton] [Arthur_Wilton] 2006-03 -sip 5060/tcp # SIP 2014-04-09 [RFC3263] -sip 5060/udp # SIP 2014-04-09 [RFC3263] -sip 5060/sctp # SIP [RFC4168] -sips 5061/tcp # SIP-TLS 2014-04-09 [RFC3263] -sips 5061/udp # SIP-TLS 2014-04-09 [RFC3263] -sips 5061/sctp # SIP-TLS [RFC4168] -na-localise 5062/tcp # Localisation access [Jean_Pierre_Garcia_2] [Jean_Pierre_Garcia_2] 2009-10-28 -na-localise 5062/udp # Localisation access [Jean_Pierre_Garcia_2] [Jean_Pierre_Garcia_2] 2009-10-28 -csrpc 5063/tcp # centrify secure RPC [Paul_Moore] [Paul_Moore] 2009-10-28 -# 5063 udp Reserved -ca-1 5064/tcp # Channel Access 1 [Jeffrey_Hill] [Jeffrey_Hill] 2002-08 -ca-1 5064/udp # Channel Access 1 [Jeffrey_Hill] [Jeffrey_Hill] 2002-08 -ca-2 5065/tcp # Channel Access 2 [Jeffrey_Hill] [Jeffrey_Hill] 2002-08 -ca-2 5065/udp # Channel Access 2 [Jeffrey_Hill] [Jeffrey_Hill] 2002-08 -stanag-5066 5066/tcp # STANAG-5066-SUBNET-INTF [Donald_G_Kallgren] [Donald_G_Kallgren] -stanag-5066 5066/udp # STANAG-5066-SUBNET-INTF [Donald_G_Kallgren] [Donald_G_Kallgren] -authentx 5067/tcp # Authentx Service [Alberto_Fernandez] [Alberto_Fernandez] 2006-01 -authentx 5067/udp # Authentx Service [Alberto_Fernandez] [Alberto_Fernandez] 2006-01 -bitforestsrv 5068/tcp # Bitforest Data Service [Ville_Pekka_Vahteala] [Ville_Pekka_Vahteala] 2008-06-05 -# 5068 udp Reserved -i-net-2000-npr 5069/tcp # I/Net 2000-NPR [Chris_Megede] [Chris_Megede] -i-net-2000-npr 5069/udp # I/Net 2000-NPR [Chris_Megede] [Chris_Megede] -vtsas 5070/tcp # VersaTrans Server Agent [Christopher_Miller] [Christopher_Miller] 2006-02 -# Service -vtsas 5070/udp # VersaTrans Server Agent [Christopher_Miller] [Christopher_Miller] 2006-02 -# Service -powerschool 5071/tcp # PowerSchool [Greg_Porter] [Greg_Porter] -powerschool 5071/udp # PowerSchool [Greg_Porter] [Greg_Porter] -ayiya 5072/tcp # Anything In Anything [Jeroen_Massar] [Jeroen_Massar] 2005-08 -ayiya 5072/udp # Anything In Anything [Jeroen_Massar] [Jeroen_Massar] 2005-08 -tag-pm 5073/tcp # Advantage Group Port Mgr [James_Goddard] [James_Goddard] 2005-08 -tag-pm 5073/udp # Advantage Group Port Mgr [James_Goddard] [James_Goddard] 2005-08 -alesquery 5074/tcp # ALES Query [Tim_Maloney] [Tim_Maloney] 2005-08 -alesquery 5074/udp # ALES Query [Tim_Maloney] [Tim_Maloney] 2005-08 -pvaccess 5075/tcp # Experimental Physics and [Matej_Sekoranja] [Matej_Sekoranja] 2012-03-23 -# Industrial Control System -# 5075 udp Reserved -# 5076-5077 Unassigned -pixelpusher 5078/udp # PixelPusher pixel data [heroicrobotics.com] [Jasmine_Strong] 2014-06-24 -# 5078 tcp Reserved -# 5079 tcp Reserved -cp-spxrpts 5079/udp # Cambridge Pixel SPx Reports [Richard_Warren] [Richard_Warren] 2008-09-17 -onscreen 5080/tcp # OnScreen Data Collection [Christopher_Miller_2] [Christopher_Miller_2] 2008-01-14 -# Service -onscreen 5080/udp # OnScreen Data Collection [Christopher_Miller_2] [Christopher_Miller_2] 2008-01-14 -# Service -sdl-ets 5081/tcp # SDL - Ent Trans Server [Marc_Morin] [Marc_Morin] 2002-04 -sdl-ets 5081/udp # SDL - Ent Trans Server [Marc_Morin] [Marc_Morin] 2002-04 -qcp 5082/tcp # Qpur Communication Protocol [Joachim_Kluemper] [Joachim_Kluemper] 2008-03-19 -qcp 5082/udp # Qpur Communication Protocol [Joachim_Kluemper] [Joachim_Kluemper] 2008-03-19 -qfp 5083/tcp # Qpur File Protocol [Joachim_Kluemper] [Joachim_Kluemper] 2008-03-19 -qfp 5083/udp # Qpur File Protocol [Joachim_Kluemper] [Joachim_Kluemper] 2008-03-19 -llrp 5084/tcp # EPCglobal Low-Level Reader [Margaret_Wasserman][Paul_Dietrich] [Margaret_Wasserman][Paul_Dietrich] 2006-11 Defined TXT keys: None. RFID reader Low Level Reader Protocol -# Protocol -llrp 5084/udp # EPCglobal Low-Level Reader [Margaret_Wasserman][Paul_Dietrich] [Margaret_Wasserman][Paul_Dietrich] 2006-11 Defined TXT keys: None. RFID reader Low Level Reader Protocol -# Protocol -encrypted-llrp 5085/tcp # EPCglobal Encrypted LLRP [Margaret_Wasserman] [Margaret_Wasserman] 2006-11 -encrypted-llrp 5085/udp # EPCglobal Encrypted LLRP [Margaret_Wasserman] [Margaret_Wasserman] 2006-11 -aprigo-cs 5086/tcp # Aprigo Collection Service [Ron_Zalkind] [Ron_Zalkind] 2010-05-28 -# 5086 udp Reserved -# BIOTIC - Binary Internet of -biotic 5087/tcp # Things Interoperable [Clayster_Laboratorios_Chile_S.A.] [Peter_Waher] 2014-06-16 -# Communication -# 5087 udp Reserved -# 5088-5089 Unassigned -car 5090/sctp # Candidate AR -cxtp 5091/sctp # Context Transfer Protocol 2005-07 [RFC4065] -# 5092 tcp Reserved -magpie 5092/udp # Magpie Binary [Phil_Maker] [Phil_Maker] 2008-06-18 -sentinel-lm 5093/tcp # Sentinel LM [Derick_Snyder] [Derick_Snyder] -sentinel-lm 5093/udp # Sentinel LM [Derick_Snyder] [Derick_Snyder] -hart-ip 5094/tcp # HART-IP [Wally_Pratt_Jr] [Wally_Pratt_Jr] 2010-03-02 -hart-ip 5094/udp # HART-IP [Wally_Pratt_Jr] [Wally_Pratt_Jr] 2010-03-02 -# 5095-5098 Unassigned -sentlm-srv2srv 5099/tcp # SentLM Srv2Srv [Derick_Snyder] [Derick_Snyder] -sentlm-srv2srv 5099/udp # SentLM Srv2Srv [Derick_Snyder] [Derick_Snyder] -socalia 5100/tcp # Socalia service mux [Alberto_Raydan_2] [Alberto_Raydan_2] 2005-08 -socalia 5100/udp # Socalia service mux [Alberto_Raydan_2] [Alberto_Raydan_2] 2005-08 -talarian-tcp 5101/tcp # Talarian_TCP [Leo_Martins] [Leo_Martins] -talarian-udp 5101/udp # Talarian_UDP [Leo_Martins] [Leo_Martins] -oms-nonsecure 5102/tcp # Oracle OMS non-secure [Todd_Guay] [Todd_Guay] 2005-08 -oms-nonsecure 5102/udp # Oracle OMS non-secure [Todd_Guay] [Todd_Guay] 2005-08 -actifio-c2c 5103/tcp # Actifio C2C [Ravi_Kollipara] [Ravi_Kollipara] 2010-06-18 -# 5103 udp Reserved -# 5104 tcp Reserved -tinymessage 5104/udp # TinyMessage [Josip_Medved] [Josip_Medved] 2010-10-20 -# 5105 tcp Reserved -hughes-ap 5105/udp # Hughes Association Protocol [Varun_Santosh] [Varun_Santosh] 2010-10-20 -actifioudsagent 5106/tcp # Actifio UDS Agent [Actifio] [Madhav_Mutalik] 2014-06-05 -# 5106 udp Reserved -actifioreplic 5107/tcp # Disk to Disk replication [Actifio] [Madhav_Mutalik] 2015-10-23 -# between Actifio Clusters -# 5107 udp Reserved -# 5108-5110 Unassigned -taep-as-svc 5111/tcp # TAEP AS service [Liu_Changchun] [Liu_Changchun] 2008-11-05 -taep-as-svc 5111/udp # TAEP AS service [Liu_Changchun] [Liu_Changchun] 2008-11-05 -pm-cmdsvr 5112/tcp # PeerMe Msg Cmd Service [Marcos_Della] [Marcos_Della] 2005-08 -pm-cmdsvr 5112/udp # PeerMe Msg Cmd Service [Marcos_Della] [Marcos_Della] 2005-08 -# 5113 Unassigned 2010-11-09 -ev-services 5114/tcp # Enterprise Vault Services [Richard_Jones_2] [Richard_Jones_2] 2009-05-26 -# 5114 udp Reserved -autobuild 5115/tcp # Symantec Autobuild Service [David_Warden] [David_Warden] 2008-11-17 -# 5115 udp Reserved -# 5116 tcp Reserved -emb-proj-cmd 5116/udp # EPSON Projecter Image [SEIKO_EPSON_4] [SEIKO_EPSON_4] 2008-11-17 -# Transfer -gradecam 5117/tcp # GradeCam Image Processing [Robert_Porter] [Robert_Porter] 2009-09-24 -# 5117 udp Reserved -# 5118-5119 Unassigned -barracuda-bbs 5120/tcp # Barracuda Backup Protocol [Barracuda_Networks] [Andrew_Blyler] 2013-04-05 -barracuda-bbs 5120/udp # Barracuda Backup Protocol [Barracuda_Networks] [Andrew_Blyler] 2013-04-05 -# 5121-5132 Unassigned -nbt-pc 5133/tcp # Policy Commander [Emily_Harris] [Emily_Harris] 2004-11 -nbt-pc 5133/udp # Policy Commander [Emily_Harris] [Emily_Harris] 2004-11 -ppactivation 5134/tcp # PP ActivationServer [Ian_Bradley] [Ian_Bradley] 2009-10-14 -# 5134 udp Reserved -# Defined TXT keys: -erp-scale 5135/tcp # ERP-Scale [Ian_Bradley] [Ian_Bradley] 2009-10-14 RFC= -# Device= -# 5135 udp Reserved -# 5136 tcp Reserved -minotaur-sa 5136/udp # Minotaur SA [Kenneth_Flynn] [Kenneth_Flynn] 2009-10-14 -ctsd 5137/tcp # MyCTS server port [Jilles_Oldenbeuving] [Jilles_Oldenbeuving] 2002-06 -ctsd 5137/udp # MyCTS server port [Jilles_Oldenbeuving] [Jilles_Oldenbeuving] 2002-06 -# 5138-5144 Unassigned -# RMONITOR SECURE -# -rmonitor-secure 5145/tcp # IANA assigned this [Kory_Hamzeh] [Kory_Hamzeh] -# well-formed service name as -# a replacement for -# "rmonitor_secure". -# This entry is an alias to "rmonitor-secure". This entry is -rmonitor_secure 5145/tcp # RMONITOR SECURE [Kory_Hamzeh] [Kory_Hamzeh] now historic, not usable for use with many common service -# discovery mechanisms. -# RMONITOR SECURE -# -rmonitor-secure 5145/udp # IANA assigned this [Kory_Hamzeh] [Kory_Hamzeh] -# well-formed service name as -# a replacement for -# "rmonitor_secure". -# This entry is an alias to "rmonitor-secure". This entry is -rmonitor_secure 5145/udp # RMONITOR SECURE [Kory_Hamzeh] [Kory_Hamzeh] now historic, not usable for use with many common service -# discovery mechanisms. -social-alarm 5146/tcp # Social Alarm Service [Shaun_Byrne] [Shaun_Byrne] 2009-08-18 -# 5146 udp Reserved -# 5147-5149 Unassigned -atmp 5150/tcp # Ascend Tunnel Management [Kory_Hamzeh] [Kory_Hamzeh] -# Protocol -atmp 5150/udp # Ascend Tunnel Management [Kory_Hamzeh] [Kory_Hamzeh] -# Protocol -# ESRI SDE Instance -# Unauthorized -esri-sde 5151/tcp # IANA assigned this [Peter_Aronson] [Peter_Aronson] Use Known on -# well-formed service name as ports 5151 -# a replacement for and 5152 -# "esri_sde". -# This entry is an alias to "esri-sde". This entry is now -esri_sde 5151/tcp # ESRI SDE Instance [Peter_Aronson] [Peter_Aronson] historic, not usable for use with many common service -# discovery mechanisms. -# ESRI SDE Remote Start -# Unauthorized -esri-sde 5151/udp # IANA assigned this [Peter_Aronson] [Peter_Aronson] Use Known on -# well-formed service name as ports 5151 -# a replacement for and 5152 -# "esri_sde". -# This entry is an alias to "esri-sde". This entry is now -esri_sde 5151/udp # ESRI SDE Remote Start [Peter_Aronson] [Peter_Aronson] historic, not usable for use with many common service -# discovery mechanisms. -# Unauthorized -sde-discovery 5152/tcp # ESRI SDE Instance Discovery [Peter_Aronson] [Peter_Aronson] Use Known on -# ports 5151 -# and 5152 -# Unauthorized -sde-discovery 5152/udp # ESRI SDE Instance Discovery [Peter_Aronson] [Peter_Aronson] Use Known on -# ports 5151 -# and 5152 -toruxserver 5153/tcp # ToruX Game Server [Josse_van_Dobben_de] [Josse_van_Dobben_de] 2009-07-01 -# 5153 udp Reserved -bzflag 5154/tcp # BZFlag game server [Tim_Riker] [Tim_Riker] 2003-07 -bzflag 5154/udp # BZFlag game server [Tim_Riker] [Tim_Riker] 2003-07 -asctrl-agent 5155/tcp # Oracle asControl Agent [Todd_Guay] [Todd_Guay] 2005-08 -asctrl-agent 5155/udp # Oracle asControl Agent [Todd_Guay] [Todd_Guay] 2005-08 -rugameonline 5156/tcp # Russian Online Game [Andrey_Mohov] [Andrey_Mohov] 2010-08-17 -# 5156 udp Reserved -mediat 5157/tcp # Mediat Remote Object [Oliver_Anan] [Oliver_Anan] 2010-09-02 -# Exchange -# 5157 udp Reserved -# 5158-5160 Unassigned -snmpssh 5161/tcp # SNMP over SSH Transport [RFC5592] -# Model -# 5161 udp Reserved -# Known -snmpssh-trap 5162/tcp # SNMP Notification over SSH [RFC5592] Unauthorized -# Transport Model Use on port -# 5162 -# Known -# 5162 udp Reserved Unauthorized -# Use on port -# 5162 -sbackup 5163/tcp # Shadow Backup [Glenn_Allen] [Glenn_Allen] 2009-08-05 -# 5163 udp Reserved -vpa 5164/tcp # Virtual Protocol Adapter [Douglas_Goodall] [Douglas_Goodall] 2009-08-05 -vpa-disc 5164/udp # Virtual Protocol Adapter [Douglas_Goodall] [Douglas_Goodall] 2009-08-05 -# Discovery -# ife_1corp -# -ife-icorp 5165/tcp # IANA assigned this [Paul_Annala] [Paul_Annala] -# well-formed service name as -# a replacement for -# "ife_icorp". -# This entry is an alias to "ife-icorp". This entry is now -ife_icorp 5165/tcp # ife_1corp [Paul_Annala] [Paul_Annala] historic, not usable for use with many common service -# discovery mechanisms. -# ife_1corp -# -ife-icorp 5165/udp # IANA assigned this [Paul_Annala] [Paul_Annala] -# well-formed service name as -# a replacement for -# "ife_icorp". -# This entry is an alias to "ife-icorp". This entry is now -ife_icorp 5165/udp # ife_1corp [Paul_Annala] [Paul_Annala] historic, not usable for use with many common service -# discovery mechanisms. -winpcs 5166/tcp # WinPCS Service Connection [Complan_Network_AS] [Complan_Network_AS] 2006-02 -winpcs 5166/udp # WinPCS Service Connection [Complan_Network_AS] [Complan_Network_AS] 2006-02 -scte104 5167/tcp # SCTE104 Connection [Thomas_Russell] [Thomas_Russell] 2005-05 -scte104 5167/udp # SCTE104 Connection [Thomas_Russell] [Thomas_Russell] 2005-05 -scte30 5168/tcp # SCTE30 Connection [Thomas_Russell] [Thomas_Russell] 2005-05 -scte30 5168/udp # SCTE30 Connection [Thomas_Russell] [Thomas_Russell] 2005-05 -# 5169-5171 Unassigned -pcoip-mgmt 5172/tcp # PC over IP Endpoint [Teradici_2] [Paul_Helter] 2014-04-28 -# Management -# 5172 udp Reserved -# 5173-5189 Unassigned -aol 5190/tcp # America-Online [Marty_Lyons] [Marty_Lyons] -aol 5190/udp # America-Online [Marty_Lyons] [Marty_Lyons] -aol-1 5191/tcp # AmericaOnline1 [Bruce_Mackey] [Bruce_Mackey] -aol-1 5191/udp # AmericaOnline1 [Bruce_Mackey] [Bruce_Mackey] -aol-2 5192/tcp # AmericaOnline2 [Bruce_Mackey] [Bruce_Mackey] -aol-2 5192/udp # AmericaOnline2 [Bruce_Mackey] [Bruce_Mackey] -aol-3 5193/tcp # AmericaOnline3 [Bruce_Mackey] [Bruce_Mackey] -aol-3 5193/udp # AmericaOnline3 [Bruce_Mackey] [Bruce_Mackey] -cpscomm 5194/tcp # CipherPoint Config Service [CipherPoint] [CipherPoint] 2010-03-03 -# 5194 udp Reserved -# The protocol is used by a -# license server and client -ampl-lic 5195/tcp # programs to control use of [AMPL_Optimization] [David_M_Gay] 2012-05-25 -# program licenses that float -# to networked machines -# 5195 udp Reserved -# The protocol is used by two -ampl-tableproxy 5196/tcp # programs that exchange [AMPL_Optimization] [David_M_Gay] 2012-05-25 -# "table" data used in the -# AMPL modeling language -# 5196 udp Reserved -tunstall-lwp 5197/tcp # Tunstall Lone worker device [Tunstall_Healthcare_UK_Ltd] [Robert_Moore] 2014-12-10 -# interface -# 5197 udp Reserved -# 5198-5199 Unassigned -targus-getdata 5200/tcp # TARGUS GetData [John_Keaveney] [John_Keaveney] -targus-getdata 5200/udp # TARGUS GetData [John_Keaveney] [John_Keaveney] -targus-getdata1 5201/tcp # TARGUS GetData 1 [John_Keaveney] [John_Keaveney] -targus-getdata1 5201/udp # TARGUS GetData 1 [John_Keaveney] [John_Keaveney] -targus-getdata2 5202/tcp # TARGUS GetData 2 [John_Keaveney] [John_Keaveney] -targus-getdata2 5202/udp # TARGUS GetData 2 [John_Keaveney] [John_Keaveney] -targus-getdata3 5203/tcp # TARGUS GetData 3 [John_Keaveney] [John_Keaveney] -targus-getdata3 5203/udp # TARGUS GetData 3 [John_Keaveney] [John_Keaveney] -# 5204-5208 Unassigned -nomad 5209/tcp # Nomad Device Video Transfer [Morega_System] [Ashraf_Tahir] 2012-08-20 -# 5209 udp Reserved -# 5210-5214 Unassigned -noteza 5215/tcp # NOTEZA Data Safety Service [CNS_a.s.] [Pavel_Mendl_2] 2014-06-12 -# 5215 udp Reserved -noteza 5215/sctp # NOTEZA Data Safety Service [CNS_a.s.] [Pavel_Mendl_2] 2014-06-12 -# 5216-5220 Unassigned -3exmp 5221/tcp # 3eTI Extensible Management [Bill_Rettig] [Bill_Rettig] 2010-05-19 -# Protocol for OAMP -# 5221 udp Reserved -xmpp-client 5222/tcp # XMPP Client Connection [RFC6120] -# 5222 udp Reserved -hpvirtgrp 5223/tcp # HP Virtual Machine Group [John_Williams] [John_Williams] 2007-06 -# Management -hpvirtgrp 5223/udp # HP Virtual Machine Group [John_Williams] [John_Williams] 2007-06 -# Management -hpvirtctrl 5224/tcp # HP Virtual Machine Console [John_Williams] [John_Williams] 2007-06 -# Operations -hpvirtctrl 5224/udp # HP Virtual Machine Console [John_Williams] [John_Williams] 2007-06 -# Operations -hp-server 5225/tcp # HP Server [Brett_Green_2] [Brett_Green_2] -hp-server 5225/udp # HP Server [Brett_Green_2] [Brett_Green_2] -hp-status 5226/tcp # HP Status [Brett_Green_2] [Brett_Green_2] -hp-status 5226/udp # HP Status [Brett_Green_2] [Brett_Green_2] -perfd 5227/tcp # HP System Performance Metric [Chris_Bertin] [Chris_Bertin] 2009-05-19 -# Service -perfd 5227/udp # HP System Performance Metric [Chris_Bertin] [Chris_Bertin] 2009-05-19 -# Service -hpvroom 5228/tcp # HP Virtual Room Service [Scott_Levin] [Scott_Levin] 2009-03-19 -# 5228 udp Reserved -# Netflow/IPFIX/sFlow -jaxflow 5229/tcp # Collector and Forwarder [JaxMP] [Stephen_Hull] 2014-08-15 -# Management -# 5229 udp Reserved -jaxflow-data 5230/tcp # JaxMP RealFlow application [JaxMP] [Stephen_Hull] 2014-08-15 -# and protocol data -# 5230 udp Reserved -crusecontrol 5231/tcp # Remote Control of Scan [Cruse_Spezialmaschinen_GmbH] [Christof_J._Reetz_2] 2014-08-15 -# Software for Cruse Scanners -# 5231 udp Reserved -csedaemon 5232/tcp # Cruse Scanning System [Christof_J_Reetz] [Christof_J_Reetz] 2011-03-09 -# Service -# 5232 udp Reserved -enfs 5233/tcp # Etinnae Network File Service [Chris_Peel] [Chris_Peel] 2011-03-09 -# 5233 udp Reserved -eenet 5234/tcp # EEnet communications [Helmut_Giritzer] [Helmut_Giritzer] 2005-11 -eenet 5234/udp # EEnet communications [Helmut_Giritzer] [Helmut_Giritzer] 2005-11 -galaxy-network 5235/tcp # Galaxy Network Service [Michael_Andre_2] [Michael_Andre_2] 2007-10-04 -galaxy-network 5235/udp # Galaxy Network Service [Michael_Andre_2] [Michael_Andre_2] 2007-10-04 -padl2sim 5236/tcp -padl2sim 5236/udp -mnet-discovery 5237/tcp # m-net discovery [Andy_Crick] [Andy_Crick] 2007-11-13 -mnet-discovery 5237/udp # m-net discovery [Andy_Crick] [Andy_Crick] 2007-11-13 -# 5238-5244 Unassigned -downtools 5245/tcp # DownTools Control Protocol [Jarrod_Sayers] [Jarrod_Sayers] 2009-04-07 -downtools-disc 5245/udp # DownTools Discovery Protocol [Jarrod_Sayers] [Jarrod_Sayers] 2009-04-07 -# 5246 tcp Reserved -capwap-control 5246/udp # CAPWAP Control Protocol [RFC5415] -# 5247 tcp Reserved -capwap-data 5247/udp # CAPWAP Data Protocol [RFC5415] -caacws 5248/tcp # CA Access Control Web [Gabriel_Kalmar] [Gabriel_Kalmar] 2008-03-06 -# Service -caacws 5248/udp # CA Access Control Web [Gabriel_Kalmar] [Gabriel_Kalmar] 2008-03-06 -# Service -caaclang2 5249/tcp # CA AC Lang Service [Gabriel_Kalmar] [Gabriel_Kalmar] 2008-02-19 -caaclang2 5249/udp # CA AC Lang Service [Gabriel_Kalmar] [Gabriel_Kalmar] 2008-02-19 -soagateway 5250/tcp # soaGateway [Greg_Bodine] [Greg_Bodine] 2002-02 -soagateway 5250/udp # soaGateway [Greg_Bodine] [Greg_Bodine] 2002-02 -caevms 5251/tcp # CA eTrust VM Service [Kevin_Bond] [Kevin_Bond] 2004-11 -caevms 5251/udp # CA eTrust VM Service [Kevin_Bond] [Kevin_Bond] 2004-11 -movaz-ssc 5252/tcp # Movaz SSC [Lou_Berger] [Lou_Berger] 2004-11 -movaz-ssc 5252/udp # Movaz SSC [Lou_Berger] [Lou_Berger] 2004-11 -kpdp 5253/tcp # Kohler Power Device Protocol [Bill_Gross] [Bill_Gross] 2010-11-01 -# 5253 udp Reserved -logcabin 5254/tcp # LogCabin storage service [Diego_Ongaro] [Diego_Ongaro] 2015-04-14 -# 5254 udp Reserved -# 5255-5263 Unassigned -3com-njack-1 5264/tcp # 3Com Network Jack Port 1 [Abhay_Rajaram] [Abhay_Rajaram] 2003-03 -3com-njack-1 5264/udp # 3Com Network Jack Port 1 [Abhay_Rajaram] [Abhay_Rajaram] 2003-03 -3com-njack-2 5265/tcp # 3Com Network Jack Port 2 [Abhay_Rajaram] [Abhay_Rajaram] 2003-03 -3com-njack-2 5265/udp # 3Com Network Jack Port 2 [Abhay_Rajaram] [Abhay_Rajaram] 2003-03 -# 5266-5268 Unassigned -xmpp-server 5269/tcp # XMPP Server Connection [RFC6120] -# 5269 udp Reserved -cartographerxmp 5270/tcp # Cartographer XMP [Bobby_Krupczak_2] [Bobby_Krupczak_2] 2008-04-03 2011-08-31 -cartographerxmp 5270/udp # Cartographer XMP [Bobby_Krupczak_2] [Bobby_Krupczak_2] 2008-04-03 2011-08-31 -cuelink 5271/tcp # StageSoft CueLink messaging [Todd_Pichler] [Todd_Pichler] 2010-03-26 -cuelink-disc 5271/udp # StageSoft CueLink discovery [Todd_Pichler] [Todd_Pichler] 2010-03-26 -pk 5272/tcp # PK [Patrick_Kara] [Patrick_Kara] -pk 5272/udp # PK [Patrick_Kara] [Patrick_Kara] -# 5273-5279 Unassigned -xmpp-bosh 5280/tcp # Bidirectional-streams Over [Peter_Saint_Andre] [Peter_Saint_Andre] 2009-11-25 -# Synchronous HTTP (BOSH) -# 5280 udp Reserved -undo-lm 5281/tcp # Undo License Manager [Julian_Smith] [Julian_Smith] 2010-04-19 -# 5281 udp Reserved -transmit-port 5282/tcp # Marimba Transmitter Port [Johan_Eriksson] [Johan_Eriksson] 2002-04 -transmit-port 5282/udp # Marimba Transmitter Port [Johan_Eriksson] [Johan_Eriksson] 2002-04 -# 5283-5297 Unassigned -presence 5298/tcp # XMPP Link-Local Messaging [Eric_St_Onge] [Eric_St_Onge] 2008-01-14 Defined TXT keys: See -# http://www.xmpp.org/registrar/linklocal.html -presence 5298/udp # XMPP Link-Local Messaging [Eric_St_Onge] [Eric_St_Onge] 2008-01-14 Defined TXT keys: See -# http://www.xmpp.org/registrar/linklocal.html -nlg-data 5299/tcp # NLG Data Service [Andy_Shellam] [Andy_Shellam] 2008-02-19 -nlg-data 5299/udp # NLG Data Service [Andy_Shellam] [Andy_Shellam] 2008-02-19 -hacl-hb 5300/tcp # HA cluster heartbeat [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-hb 5300/udp # HA cluster heartbeat [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-gs 5301/tcp # HA cluster general services [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-gs 5301/udp # HA cluster general services [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-cfg 5302/tcp # HA cluster configuration [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-cfg 5302/udp # HA cluster configuration [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-probe 5303/tcp # HA cluster probing [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-probe 5303/udp # HA cluster probing [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-local 5304/tcp # HA Cluster Commands [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-local 5304/udp # HA Cluster Commands [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-test 5305/tcp # HA Cluster Test [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -hacl-test 5305/udp # HA Cluster Test [Eric_Soderberg_2][Edward_Yim] [Eric_Soderberg_2][Edward_Yim] -sun-mc-grp 5306/tcp # Sun MC Group [Michael_DeMoney] [Michael_DeMoney] -sun-mc-grp 5306/udp # Sun MC Group [Michael_DeMoney] [Michael_DeMoney] -sco-aip 5307/tcp # SCO AIP [Barrie_Cooper] [Barrie_Cooper] -sco-aip 5307/udp # SCO AIP [Barrie_Cooper] [Barrie_Cooper] -cfengine 5308/tcp # CFengine [Mark_Burgess] [Mark_Burgess] -cfengine 5308/udp # CFengine [Mark_Burgess] [Mark_Burgess] -jprinter 5309/tcp # J Printer [Ken_Blackwell] [Ken_Blackwell] -jprinter 5309/udp # J Printer [Ken_Blackwell] [Ken_Blackwell] -outlaws 5310/tcp # Outlaws [Richard_Fife] [Richard_Fife] -outlaws 5310/udp # Outlaws [Richard_Fife] [Richard_Fife] -# 5311 Unassigned 2004-05-07 -permabit-cs 5312/tcp # Permabit Client-Server [Jered_Floyd] [Jered_Floyd] 2004-06 -permabit-cs 5312/udp # Permabit Client-Server [Jered_Floyd] [Jered_Floyd] 2004-06 -rrdp 5313/tcp # Real-time & Reliable Data [Ted_Hoshi] [Ted_Hoshi] 2004-06 -rrdp 5313/udp # Real-time & Reliable Data [Ted_Hoshi] [Ted_Hoshi] 2004-06 -opalis-rbt-ipc 5314/tcp # opalis-rbt-ipc [Laurent_Domenech] [Laurent_Domenech] -opalis-rbt-ipc 5314/udp # opalis-rbt-ipc [Laurent_Domenech] [Laurent_Domenech] -hacl-poll 5315/tcp # HA Cluster UDP Polling [Hoa_Nguyen] [Hoa_Nguyen] -hacl-poll 5315/udp # HA Cluster UDP Polling [Hoa_Nguyen] [Hoa_Nguyen] -hpbladems 5316/tcp # HPBladeSystem Monitor [Alan_Minchew] [Alan_Minchew] 2011-05-23 2011-05-16 -# Service -# 5316 udp Unassigned 2011-05-16 -hpdevms 5317/tcp # HP Device Monitor Service [Alan_Minchew] [Alan_Minchew] 2011-05-16 -# 5317 udp Reserved -pkix-cmc 5318/tcp # PKIX Certificate Management [IESG] [IETF_Chair] [RFC6402] -# using CMS (CMC) -# 5318 udp Reserved -# 5319 Unassigned -bsfserver-zn 5320/tcp # Webservices-based Zn [Bert_Paul] [Bert_Paul] 2008-05-01 -# interface of BSF -# 5320 udp Reserved -bsfsvr-zn-ssl 5321/tcp # Webservices-based Zn [Bert_Paul] [Bert_Paul] 2008-07-03 -# interface of BSF over SSL -# 5321 udp Reserved -# 5322-5342 Unassigned -kfserver 5343/tcp # Sculptor Database Server [Keith_Ashman] [Keith_Ashman] 2005-12 -kfserver 5343/udp # Sculptor Database Server [Keith_Ashman] [Keith_Ashman] 2005-12 -xkotodrcp 5344/tcp # xkoto DRCP [Jeff_Heisz] [Jeff_Heisz] 2006-02 -xkotodrcp 5344/udp # xkoto DRCP [Jeff_Heisz] [Jeff_Heisz] 2006-02 -# 5345-5348 Unassigned -stuns 5349/tcp # STUN over TLS [RFC5389] -stuns 5349/udp # STUN over DTLS [IESG] [IETF_Chair] 2014-07-03 [RFC7350] This service name was initially created by [RFC5389]. -turns 5349/tcp # TURN over TLS [RFC5766] -turns 5349/udp # TURN over DTLS [IESG] [IETF_Chair] 2014-07-03 [RFC7350] This service name was initially created by [RFC5766]. -stun-behaviors 5349/tcp # STUN Behavior Discovery over [RFC5780] -# TLS -stun-behaviors 5349/udp # Reserved for a future [RFC5780] -# enhancement of STUN-BEHAVIOR -# 5350 tcp Reserved -pcp-multicast 5350/udp # Port Control Protocol [IESG] [IETF_Chair] [RFC6887] -# Multicast -# 5351 tcp Reserved -pcp 5351/udp # Port Control Protocol [IESG] [IETF_Chair] [RFC6887] -dns-llq 5352/tcp # DNS Long-Lived Queries [Kiren_Sekar] [Kiren_Sekar] 2005-08 -dns-llq 5352/udp # DNS Long-Lived Queries [Kiren_Sekar] [Kiren_Sekar] 2005-08 -mdns 5353/tcp # Multicast DNS [IESG] [IETF_Chair] [RFC6762] -mdns 5353/udp # Multicast DNS [IESG] [IETF_Chair] [RFC6762] -mdnsresponder 5354/tcp # Multicast DNS Responder IPC [Stuart_Cheshire_3] [Stuart_Cheshire_3] 2004-06 -mdnsresponder 5354/udp # Multicast DNS Responder IPC [Stuart_Cheshire_3] [Stuart_Cheshire_3] 2004-06 -llmnr 5355/tcp # LLMNR [Bernard_Aboba] [Bernard_Aboba] 2004-06 -llmnr 5355/udp # LLMNR [Bernard_Aboba] [Bernard_Aboba] 2004-06 -ms-smlbiz 5356/tcp # Microsoft Small Business [Gopikrishna_Sandra] [Gopikrishna_Sandra] 2005-02 -ms-smlbiz 5356/udp # Microsoft Small Business [Gopikrishna_Sandra] [Gopikrishna_Sandra] 2005-02 -wsdapi 5357/tcp # Web Services for Devices [Henry_Rawas] [Henry_Rawas] 2005-08 -wsdapi 5357/udp # Web Services for Devices [Henry_Rawas] [Henry_Rawas] 2005-08 -wsdapi-s 5358/tcp # WS for Devices Secured [Henry_Rawas] [Henry_Rawas] 2005-08 -wsdapi-s 5358/udp # WS for Devices Secured [Henry_Rawas] [Henry_Rawas] 2005-08 -ms-alerter 5359/tcp # Microsoft Alerter [Marc_McClure] [Marc_McClure] 2007-08-07 -ms-alerter 5359/udp # Microsoft Alerter [Marc_McClure] [Marc_McClure] 2007-08-07 -ms-sideshow 5360/tcp # Protocol for Windows [Dan_Polivy] [Dan_Polivy] 2008-03-12 -# SideShow -ms-sideshow 5360/udp # Protocol for Windows [Dan_Polivy] [Dan_Polivy] 2008-03-12 -# SideShow -ms-s-sideshow 5361/tcp # Secure Protocol for Windows [Dan_Polivy] [Dan_Polivy] 2008-03-12 -# SideShow -ms-s-sideshow 5361/udp # Secure Protocol for Windows [Dan_Polivy] [Dan_Polivy] 2008-03-12 -# SideShow -serverwsd2 5362/tcp # Microsoft Windows Server [Erhan_Soyer_Osman] [Erhan_Soyer_Osman] 2008-03-26 -# WSD2 Service -serverwsd2 5362/udp # Microsoft Windows Server [Erhan_Soyer_Osman] [Erhan_Soyer_Osman] 2008-03-26 -# WSD2 Service -net-projection 5363/tcp # Windows Network Projection [Rob_Williams] [Rob_Williams] 2009-02-17 -net-projection 5363/udp # Windows Network Projection [Rob_Williams] [Rob_Williams] 2009-02-17 -kdnet 5364/udp # Microsoft Kernel Debugger [Microsoft_Corporation_4] [Joe_Ballantyne] 2013-06-16 -# 5364 tcp Reserved -# 5365-5396 Unassigned -stresstester 5397/tcp # StressTester(tm) Injector [Graham_Parsons] [Graham_Parsons] 2005-08 -stresstester 5397/udp # StressTester(tm) Injector [Graham_Parsons] [Graham_Parsons] 2005-08 -elektron-admin 5398/tcp # Elektron Administration [Chris_Hawk] [Chris_Hawk] 2005-08 -elektron-admin 5398/udp # Elektron Administration [Chris_Hawk] [Chris_Hawk] 2005-08 -securitychase 5399/tcp # SecurityChase [Daisuke_Shinomiya] [Daisuke_Shinomiya] 2005-08 -securitychase 5399/udp # SecurityChase [Daisuke_Shinomiya] [Daisuke_Shinomiya] 2005-08 -excerpt 5400/tcp # Excerpt Search [John_Hinsdale] [John_Hinsdale] -excerpt 5400/udp # Excerpt Search [John_Hinsdale] [John_Hinsdale] -excerpts 5401/tcp # Excerpt Search Secure [John_Hinsdale] [John_Hinsdale] -excerpts 5401/udp # Excerpt Search Secure [John_Hinsdale] [John_Hinsdale] -mftp 5402/tcp # OmniCast MFTP [Steve_Bannister] [Steve_Bannister] -mftp 5402/udp # OmniCast MFTP [Steve_Bannister] [Steve_Bannister] -hpoms-ci-lstn 5403/tcp # HPOMS-CI-LSTN [Harold_Froehling] [Harold_Froehling] -hpoms-ci-lstn 5403/udp # HPOMS-CI-LSTN [Harold_Froehling] [Harold_Froehling] -hpoms-dps-lstn 5404/tcp # HPOMS-DPS-LSTN [Harold_Froehling] [Harold_Froehling] -hpoms-dps-lstn 5404/udp # HPOMS-DPS-LSTN [Harold_Froehling] [Harold_Froehling] -netsupport 5405/tcp # NetSupport [Paul_Sanders_2] [Paul_Sanders_2] -netsupport 5405/udp # NetSupport [Paul_Sanders_2] [Paul_Sanders_2] -systemics-sox 5406/tcp # Systemics Sox [Gary_Howland] [Gary_Howland] -systemics-sox 5406/udp # Systemics Sox [Gary_Howland] [Gary_Howland] -foresyte-clear 5407/tcp # Foresyte-Clear [Jorge_Aldana] [Jorge_Aldana] -foresyte-clear 5407/udp # Foresyte-Clear [Jorge_Aldana] [Jorge_Aldana] -foresyte-sec 5408/tcp # Foresyte-Sec [Jorge_Aldana] [Jorge_Aldana] -foresyte-sec 5408/udp # Foresyte-Sec [Jorge_Aldana] [Jorge_Aldana] -salient-dtasrv 5409/tcp # Salient Data Server [Richard_Farnham] [Richard_Farnham] -salient-dtasrv 5409/udp # Salient Data Server [Richard_Farnham] [Richard_Farnham] -salient-usrmgr 5410/tcp # Salient User Manager [Richard_Farnham] [Richard_Farnham] -salient-usrmgr 5410/udp # Salient User Manager [Richard_Farnham] [Richard_Farnham] -actnet 5411/tcp # ActNet [Simon_Robillard] [Simon_Robillard] -actnet 5411/udp # ActNet [Simon_Robillard] [Simon_Robillard] -continuus 5412/tcp # Continuus [Steven_Holtsberg] [Steven_Holtsberg] -continuus 5412/udp # Continuus [Steven_Holtsberg] [Steven_Holtsberg] -wwiotalk 5413/tcp # WWIOTALK [Roger_Knobbe] [Roger_Knobbe] -wwiotalk 5413/udp # WWIOTALK [Roger_Knobbe] [Roger_Knobbe] -statusd 5414/tcp # StatusD [Stephen_Misel_2] [Stephen_Misel_2] -statusd 5414/udp # StatusD [Stephen_Misel_2] [Stephen_Misel_2] -ns-server 5415/tcp # NS Server [Jeffrey_Chiao] [Jeffrey_Chiao] -ns-server 5415/udp # NS Server [Jeffrey_Chiao] [Jeffrey_Chiao] -sns-gateway 5416/tcp # SNS Gateway [Mary_Holstage] [Mary_Holstage] -sns-gateway 5416/udp # SNS Gateway [Mary_Holstage] [Mary_Holstage] -sns-agent 5417/tcp # SNS Agent [Mary_Holstage] [Mary_Holstage] -sns-agent 5417/udp # SNS Agent [Mary_Holstage] [Mary_Holstage] -mcntp 5418/tcp # MCNTP [Heiko_Rupp] [Heiko_Rupp] -mcntp 5418/udp # MCNTP [Heiko_Rupp] [Heiko_Rupp] -dj-ice 5419/tcp # DJ-ICE [Don_Tyson_2] [Don_Tyson_2] -dj-ice 5419/udp # DJ-ICE [Don_Tyson_2] [Don_Tyson_2] -cylink-c 5420/tcp # Cylink-C [John_Jobe] [John_Jobe] -cylink-c 5420/udp # Cylink-C [John_Jobe] [John_Jobe] -netsupport2 5421/tcp # Net Support 2 [Paul_Sanders] [Paul_Sanders] -netsupport2 5421/udp # Net Support 2 [Paul_Sanders] [Paul_Sanders] -salient-mux 5422/tcp # Salient MUX [Richard_Farnham] [Richard_Farnham] -salient-mux 5422/udp # Salient MUX [Richard_Farnham] [Richard_Farnham] -virtualuser 5423/tcp # VIRTUALUSER [Chad_Williams] [Chad_Williams] -virtualuser 5423/udp # VIRTUALUSER [Chad_Williams] [Chad_Williams] -beyond-remote 5424/tcp # Beyond Remote [Michael_Berg] [Michael_Berg] 2004-11 -beyond-remote 5424/udp # Beyond Remote [Michael_Berg] [Michael_Berg] 2004-11 -br-channel 5425/tcp # Beyond Remote Command [Michael_Berg] [Michael_Berg] 2005-08 -# Channel -br-channel 5425/udp # Beyond Remote Command [Michael_Berg] [Michael_Berg] 2005-08 -# Channel -devbasic 5426/tcp # DEVBASIC [Curtis_Smith] [Curtis_Smith] -devbasic 5426/udp # DEVBASIC [Curtis_Smith] [Curtis_Smith] -sco-peer-tta 5427/tcp # SCO-PEER-TTA [Andrew_Shire] [Andrew_Shire] -sco-peer-tta 5427/udp # SCO-PEER-TTA [Andrew_Shire] [Andrew_Shire] -telaconsole 5428/tcp # TELACONSOLE [Joseph_M_Newcomer] [Joseph_M_Newcomer] -telaconsole 5428/udp # TELACONSOLE [Joseph_M_Newcomer] [Joseph_M_Newcomer] -base 5429/tcp # Billing and Accounting [Odo_Maletzki] [Odo_Maletzki] -# System Exchange -base 5429/udp # Billing and Accounting [Odo_Maletzki] [Odo_Maletzki] -# System Exchange -radec-corp 5430/tcp # RADEC CORP [David_Chell] [David_Chell] -radec-corp 5430/udp # RADEC CORP [David_Chell] [David_Chell] -park-agent 5431/tcp # PARK AGENT [John_Clifford] [John_Clifford] -park-agent 5431/udp # PARK AGENT [John_Clifford] [John_Clifford] -postgresql 5432/tcp # PostgreSQL Database [Tom_Lane] [Tom_Lane] -postgresql 5432/udp # PostgreSQL Database [Tom_Lane] [Tom_Lane] -pyrrho 5433/tcp # Pyrrho DBMS [Malcolm_Crowe] [Malcolm_Crowe] 2005-11 -pyrrho 5433/udp # Pyrrho DBMS [Malcolm_Crowe] [Malcolm_Crowe] 2005-11 -sgi-arrayd 5434/tcp # SGI Array Services Daemon [Karl_Feind] [Karl_Feind] 2005-10 -sgi-arrayd 5434/udp # SGI Array Services Daemon [Karl_Feind] [Karl_Feind] 2005-10 -sceanics 5435/tcp # SCEANICS situation and [Richard_Olsen] [Richard_Olsen] -# action notification -sceanics 5435/udp # SCEANICS situation and [Richard_Olsen] [Richard_Olsen] -# action notification -# 5436 tcp Reserved -pmip6-cntl 5436/udp # pmip6-cntl [RFC5844] -# 5437 tcp Reserved -pmip6-data 5437/udp # pmip6-data [RFC5844] -# 5438-5442 Unassigned -spss 5443/tcp # Pearson HTTPS [Pearson] [Pearson] 2008-01-17 -spss 5443/udp # Pearson HTTPS [Pearson] [Pearson] 2008-01-17 -# Known -# 5444 Unassigned UNAUTHORIZED -# USE: Port -# 5444 -smbdirect 5445/tcp # Server Message Block over [Microsoft_Corporation_2] [Tom_Talpey] 2012-03-15 -# Remote Direct Memory Access -# 5445 udp Reserved -smbdirect 5445/sctp # Server Message Block over [Microsoft_Corporation_2] [Tom_Talpey] 2012-03-15 -# Remote Direct Memory Access -# 5446-5452 Unassigned -surebox 5453/tcp # SureBox [Emin_BORU] [Emin_BORU] 2004-11 -surebox 5453/udp # SureBox [Emin_BORU] [Emin_BORU] 2004-11 -apc-5454 5454/tcp # APC 5454 [American_Power_Conve] [American_Power_Conve] -apc-5454 5454/udp # APC 5454 [American_Power_Conve] [American_Power_Conve] -apc-5455 5455/tcp # APC 5455 [American_Power_Conve] [American_Power_Conve] -apc-5455 5455/udp # APC 5455 [American_Power_Conve] [American_Power_Conve] -apc-5456 5456/tcp # APC 5456 [American_Power_Conve] [American_Power_Conve] -apc-5456 5456/udp # APC 5456 [American_Power_Conve] [American_Power_Conve] -# 5457-5460 Unassigned -silkmeter 5461/tcp # SILKMETER [Klaus_Fellner] [Klaus_Fellner] -silkmeter 5461/udp # SILKMETER [Klaus_Fellner] [Klaus_Fellner] -ttl-publisher 5462/tcp # TTL Publisher [Peter_Jacobs] [Peter_Jacobs] -ttl-publisher 5462/udp # TTL Publisher [Peter_Jacobs] [Peter_Jacobs] -ttlpriceproxy 5463/tcp # TTL Price Proxy [Peter_Jacobs] [Peter_Jacobs] -ttlpriceproxy 5463/udp # TTL Price Proxy [Peter_Jacobs] [Peter_Jacobs] -quailnet 5464/tcp # Quail Networks Object Broker [Craig_N_Bissell] [Craig_N_Bissell] 2006-04 -quailnet 5464/udp # Quail Networks Object Broker [Craig_N_Bissell] [Craig_N_Bissell] 2006-04 -netops-broker 5465/tcp # NETOPS-BROKER [John_R_Deuel] [John_R_Deuel] -netops-broker 5465/udp # NETOPS-BROKER [John_R_Deuel] [John_R_Deuel] -# 5466-5469 Unassigned -# The Apsolab company's data -apsolab-col 5470/tcp # collection protocol (native [Apsolab_Inc] [Jean-Francois_Gauthier] 2014-11-10 -# api) -# 5470 udp Reserved -# The Apsolab company's secure -apsolab-cols 5471/tcp # data collection protocol [Apsolab_Inc] [Jean-Francois_Gauthier] 2014-11-10 -# (native api) -# 5471 udp Reserved -apsolab-tag 5472/tcp # The Apsolab company's [Apsolab_Inc] [Jean-Francois_Gauthier] 2014-11-10 -# dynamic tag protocol -# 5472 udp Reserved -apsolab-tags 5473/tcp # The Apsolab company's secure [Apsolab_Inc] [Jean-Francois_Gauthier] 2014-11-10 -# dynamic tag protocol -# 5473 udp Reserved -apsolab-rpc 5474/udp # The Apsolab company's status [Apsolab_Inc] [Jean-Francois_Gauthier] 2014-11-10 -# query protocol -# 5474 tcp Reserved -apsolab-data 5475/tcp # The Apsolab company's data [Apsolab_Inc] [Jean-Francois_Gauthier] 2014-11-10 -# retrieval protocol -# 5475 udp Reserved -# 5476-5499 Unassigned -fcp-addr-srvr1 5500/tcp # fcp-addr-srvr1 [Ken_Wittmer] [Ken_Wittmer] -fcp-addr-srvr1 5500/udp # fcp-addr-srvr1 [Ken_Wittmer] [Ken_Wittmer] -fcp-addr-srvr2 5501/tcp # fcp-addr-srvr2 [Ken_Wittmer] [Ken_Wittmer] -fcp-addr-srvr2 5501/udp # fcp-addr-srvr2 [Ken_Wittmer] [Ken_Wittmer] -fcp-srvr-inst1 5502/tcp # fcp-srvr-inst1 [Ken_Wittmer] [Ken_Wittmer] -fcp-srvr-inst1 5502/udp # fcp-srvr-inst1 [Ken_Wittmer] [Ken_Wittmer] -fcp-srvr-inst2 5503/tcp # fcp-srvr-inst2 [Ken_Wittmer] [Ken_Wittmer] -fcp-srvr-inst2 5503/udp # fcp-srvr-inst2 [Ken_Wittmer] [Ken_Wittmer] -fcp-cics-gw1 5504/tcp # fcp-cics-gw1 [Ken_Wittmer] [Ken_Wittmer] -fcp-cics-gw1 5504/udp # fcp-cics-gw1 [Ken_Wittmer] [Ken_Wittmer] -checkoutdb 5505/tcp # Checkout Database [Dirk_Stoop] [Dirk_Stoop] 2007-04 -checkoutdb 5505/udp # Checkout Database [Dirk_Stoop] [Dirk_Stoop] 2007-04 -amc 5506/tcp # Amcom Mobile Connect [Aaron_Fracht_Monroe] [Aaron_Fracht_Monroe] 2010-06-03 -amc 5506/udp # Amcom Mobile Connect [Aaron_Fracht_Monroe] [Aaron_Fracht_Monroe] 2010-06-03 -psl-management 5507/tcp # PowerSysLab Electrical [PowerSysLab] [Lucas_Lorensi] 2015-07-20 -# Management -# 5507 udp Reserved -# 5508-5552 Unassigned -sgi-eventmond 5553/tcp # SGI Eventmond Port [Andrei_Vilkotski] [Andrei_Vilkotski] 2003-06 -sgi-eventmond 5553/udp # SGI Eventmond Port [Andrei_Vilkotski] [Andrei_Vilkotski] 2003-06 -sgi-esphttp 5554/tcp # SGI ESP HTTP [Vladimir_Legalov] [Vladimir_Legalov] -sgi-esphttp 5554/udp # SGI ESP HTTP [Vladimir_Legalov] [Vladimir_Legalov] -# Known -personal-agent 5555/tcp # Personal Agent [Jackie_Wu] [Jackie_Wu] UNAUTHORIZED -# USEs on port -# 5555 -# Known -personal-agent 5555/udp # Personal Agent [Jackie_Wu] [Jackie_Wu] UNAUTHORIZED -# USEs on port -# 5555 -# Known -freeciv 5556/tcp # Freeciv gameplay [Reinier_Post_and_Pau] [Reinier_Post_and_Pau] 2006-01 Unauthorized -# Use on port -# 5556 -# Known -freeciv 5556/udp # Freeciv gameplay [Reinier_Post_and_Pau] [Reinier_Post_and_Pau] 2006-01 Unauthorized -# Use on port -# 5556 -farenet 5557/tcp # Sandlab FARENET [Kay_T_Labinsky] [Kay_T_Labinsky] 2010-05-03 -# 5557 udp Reserved -# 5558-5565 Unassigned -westec-connect 5566/tcp # Westec Connect [Jon_Bolen] [Jon_Bolen] 2009-03-18 -# 5566 udp Reserved -dof-dps-mc-sec 5567/tcp # DOF Protocol Stack [OpenDOF] [Bryant_Eastham] 2004-11 2015-04-23 -# Multicast/Secure Transport -dof-dps-mc-sec 5567/udp # DOF Protocol Stack [OpenDOF] [Bryant_Eastham] 2004-11 2015-04-23 -# Multicast/Secure Transport -sdt 5568/tcp # Session Data Transport [Daniel_W_Antonuk] [Daniel_W_Antonuk] 2006-05 -# Multicast -sdt 5568/udp # Session Data Transport [Daniel_W_Antonuk] [Daniel_W_Antonuk] 2006-05 -# Multicast -# PLASA E1.33, Remote Device -rdmnet-ctrl 5569/tcp # Management (RDM) controller [PLASA] [Simon_Newton] 2012-06-01 -# status notifications -rdmnet-device 5569/udp # PLASA E1.33, Remote Device [PLASA] [Simon_Newton] 2012-06-01 -# Management (RDM) messages -# Known -# 5570-5572 Unassigned UNAUTHORIZED -# USE on Port -# 5570 -sdmmp 5573/tcp # SAS Domain Management [Ron_Zuckerman] [Ron_Zuckerman] 2007-08-30 -# Messaging Protocol -sdmmp 5573/udp # SAS Domain Management [Ron_Zuckerman] [Ron_Zuckerman] 2007-08-30 -# Messaging Protocol -lsi-bobcat 5574/tcp # SAS IO Forwarding [Mandar_Joshi] [Mandar_Joshi] 2009-02-09 -# 5574 udp Reserved -ora-oap 5575/tcp # Oracle Access Protocol [Peter_Povinec] [Peter_Povinec] 2010-04-13 -# 5575 udp Reserved -# 5576-5578 Unassigned -fdtracks 5579/tcp # FleetDisplay Tracking [Henrik_Woffinden] [Henrik_Woffinden] 2008-09-22 -# Service -# 5579 udp Reserved -tmosms0 5580/tcp # T-Mobile SMS Protocol [Ezinne_Oji] [Ezinne_Oji] 2006-06 -# Message 0 -tmosms0 5580/udp # T-Mobile SMS Protocol [Ezinne_Oji] [Ezinne_Oji] 2006-06 -# Message 0 -tmosms1 5581/tcp # T-Mobile SMS Protocol [Ezinne_Oji] [Ezinne_Oji] 2006-06 -# Message 1 -tmosms1 5581/udp # T-Mobile SMS Protocol [Ezinne_Oji] [Ezinne_Oji] 2006-06 -# Message 1 -fac-restore 5582/tcp # T-Mobile SMS Protocol [Jessica_Yan] [Jessica_Yan] 2008-02-19 -# Message 3 -fac-restore 5582/udp # T-Mobile SMS Protocol [Jessica_Yan] [Jessica_Yan] 2008-02-19 -# Message 3 -tmo-icon-sync 5583/tcp # T-Mobile SMS Protocol [Donghwan_Lim] [Donghwan_Lim] 2008-01-22 -# Message 2 -tmo-icon-sync 5583/udp # T-Mobile SMS Protocol [Donghwan_Lim] [Donghwan_Lim] 2008-01-22 -# Message 2 -bis-web 5584/tcp # BeInSync-Web [Adi_Ruppin] [Adi_Ruppin] 2005-08 -bis-web 5584/udp # BeInSync-Web [Adi_Ruppin] [Adi_Ruppin] 2005-08 -bis-sync 5585/tcp # BeInSync-sync [Adi_Ruppin] [Adi_Ruppin] 2005-08 -bis-sync 5585/udp # BeInSync-sync [Adi_Ruppin] [Adi_Ruppin] 2005-08 -# Planning to send mobile -# terminated SMS to the -att-mt-sms 5586/tcp # specific port so that the [ATT] [Dhillesh_Sigilipelli] 2014-08-21 -# SMS is not visible to the -# client -# 5586 udp Reserved -# 5587-5596 Unassigned -ininmessaging 5597/tcp # inin secure messaging [Mike_Gagle_2] [Mike_Gagle_2] 2006-05 -ininmessaging 5597/udp # inin secure messaging [Mike_Gagle_2] [Mike_Gagle_2] 2006-05 -mctfeed 5598/tcp # MCT Market Data Feed [Stephane_Touizer] [Stephane_Touizer] 2006-05 -mctfeed 5598/udp # MCT Market Data Feed [Stephane_Touizer] [Stephane_Touizer] 2006-05 -esinstall 5599/tcp # Enterprise Security Remote [Kimberly_Gibbs] [Kimberly_Gibbs] -# Install -esinstall 5599/udp # Enterprise Security Remote [Kimberly_Gibbs] [Kimberly_Gibbs] -# Install -esmmanager 5600/tcp # Enterprise Security Manager [Kimberly_Gibbs] [Kimberly_Gibbs] -esmmanager 5600/udp # Enterprise Security Manager [Kimberly_Gibbs] [Kimberly_Gibbs] -esmagent 5601/tcp # Enterprise Security Agent [Kimberly_Gibbs] [Kimberly_Gibbs] -esmagent 5601/udp # Enterprise Security Agent [Kimberly_Gibbs] [Kimberly_Gibbs] -a1-msc 5602/tcp # A1-MSC [Mike_Dolan] [Mike_Dolan] -a1-msc 5602/udp # A1-MSC [Mike_Dolan] [Mike_Dolan] -a1-bs 5603/tcp # A1-BS [Mike_Dolan] [Mike_Dolan] -a1-bs 5603/udp # A1-BS [Mike_Dolan] [Mike_Dolan] -a3-sdunode 5604/tcp # A3-SDUNode [Mike_Dolan] [Mike_Dolan] -a3-sdunode 5604/udp # A3-SDUNode [Mike_Dolan] [Mike_Dolan] -a4-sdunode 5605/tcp # A4-SDUNode [Mike_Dolan] [Mike_Dolan] -a4-sdunode 5605/udp # A4-SDUNode [Mike_Dolan] [Mike_Dolan] -# 5606-5617 Unassigned -efr 5618/tcp # Fiscal Registering Protocol [efsta] [Alois_Reisinger] 2013-08-13 -# 5618 udp Reserved -# 5619-5626 Unassigned -ninaf 5627/tcp # Node Initiated Network [Thomas_Scholl] [Thomas_Scholl] 2006-03 -# Association Forma -ninaf 5627/udp # Node Initiated Network [Thomas_Scholl] [Thomas_Scholl] 2006-03 -# Association Forma -htrust 5628/tcp # HTrust API [Karl_Olafsson] [Karl_Olafsson] 2008-10-24 -htrust 5628/udp # HTrust API [Karl_Olafsson] [Karl_Olafsson] 2008-10-24 -symantec-sfdb 5629/tcp # Symantec Storage Foundation [Quang_Thoi] [Quang_Thoi] 2006-11 -# for Database -symantec-sfdb 5629/udp # Symantec Storage Foundation [Quang_Thoi] [Quang_Thoi] 2006-11 -# for Database -precise-comm 5630/tcp # PreciseCommunication [Alon_Tamir] [Alon_Tamir] 2006-04 -precise-comm 5630/udp # PreciseCommunication [Alon_Tamir] [Alon_Tamir] 2006-04 -pcanywheredata 5631/tcp # pcANYWHEREdata [Jon_Rosarky] [Jon_Rosarky] -pcanywheredata 5631/udp # pcANYWHEREdata [Jon_Rosarky] [Jon_Rosarky] -pcanywherestat 5632/tcp # pcANYWHEREstat [Jon_Rosarky] [Jon_Rosarky] -pcanywherestat 5632/udp # pcANYWHEREstat [Jon_Rosarky] [Jon_Rosarky] -beorl 5633/tcp # BE Operations Request [Chirag_Desai] [Chirag_Desai] 2006-02 -# Listener -beorl 5633/udp # BE Operations Request [Chirag_Desai] [Chirag_Desai] 2006-02 -# Listener -xprtld 5634/tcp # SF Message Service [VR_Satish] [VR_Satish] 2007-08-16 -xprtld 5634/udp # SF Message Service [VR_Satish] [VR_Satish] 2007-08-16 -sfmsso 5635/tcp # SFM Authentication Subsystem [De_Chih_Chien] [De_Chih_Chien] 2008-09-15 -# 5635 udp Reserved -sfm-db-server 5636/tcp # SFMdb - SFM DB server [De_Chih_Chien] [De_Chih_Chien] 2008-10-06 -# 5636 udp Reserved -cssc 5637/tcp # Symantec CSSC [Amol_P_Tambe] [Amol_P_Tambe] 2011-02-02 -# 5637 udp Reserved -# Symantec Fingerprint Lookup -flcrs 5638/tcp # and Container Reference [Symantec_Corp] [Neel_A_Bhatt] 2012-01-03 -# Service -# 5638 udp Reserved -ics 5639/tcp # Symantec Integrity Checking [Symantec_Corp2] [Danzhou_Liu] 2012-05-07 -# Service -# 5639 udp Reserved -# 5640-5645 Unassigned -vfmobile 5646/tcp # Ventureforth Mobile [Ventureforth_Inc] [Blakely_Snyder] 2011-11-03 -# 5646 udp Reserved -# Known -# 5647-5669 Unassigned UNAUTHORIZED -# USE: Port -# 5666 -filemq 5670/tcp # ZeroMQ file [Pieter_Hintjens2] [Pieter_Hintjens2] 2012-11-01 2013-02-25 -# publish-subscribe protocol -zre-disc 5670/udp # Local area discovery and [Pieter_Hintjens_3] [Pieter_Hintjens_3] 2012-12-17 -# messaging over ZeroMQ -amqps 5671/tcp # amqp protocol over TLS/SSL [Ted_Ross_2] [Ted_Ross_2] 2008-03-26 -amqps 5671/udp # amqp protocol over TLS/SSL [Ted_Ross_2] [Ted_Ross_2] 2008-03-26 -amqp 5672/tcp # AMQP [Pieter_Hintjens] [Pieter_Hintjens] 2006-01 -amqp 5672/udp # AMQP [Pieter_Hintjens] [Pieter_Hintjens] 2006-01 -amqp 5672/sctp # AMQP [Martin_Sustrik] [Martin_Sustrik] 2007-03 -jms 5673/tcp # JACL Message Server [Stuart_Allen] [Stuart_Allen] 2002-02 -jms 5673/udp # JACL Message Server [Stuart_Allen] [Stuart_Allen] 2002-02 -hyperscsi-port 5674/tcp # HyperSCSI Port [Data_Storage_Institu] [Data_Storage_Institu] 2002-02 -hyperscsi-port 5674/udp # HyperSCSI Port [Data_Storage_Institu] [Data_Storage_Institu] 2002-02 -v5ua 5675/tcp # V5UA application port [RFC3807] -v5ua 5675/udp # V5UA application port [RFC3807] -v5ua 5675/sctp # V5UA application port [RFC3807] -raadmin 5676/tcp # RA Administration [Sergei_Zjaikin] [Sergei_Zjaikin] 2002-02 -raadmin 5676/udp # RA Administration [Sergei_Zjaikin] [Sergei_Zjaikin] 2002-02 -questdb2-lnchr 5677/tcp # Quest Central DB2 Launchr [Robert_M_Mackowiak] [Robert_M_Mackowiak] 2002-02 -questdb2-lnchr 5677/udp # Quest Central DB2 Launchr [Robert_M_Mackowiak] [Robert_M_Mackowiak] 2002-02 -rrac 5678/tcp # Remote Replication Agent -# Connection -rrac 5678/udp # Remote Replication Agent -# Connection -dccm 5679/tcp # Direct Cable Connect Manager [Mark_Miller_2] [Mark_Miller_2] -dccm 5679/udp # Direct Cable Connect Manager [Mark_Miller_2] [Mark_Miller_2] -auriga-router 5680/tcp # Auriga Router Service [Vincent_Gaudeul] [Vincent_Gaudeul] 2006-02 -auriga-router 5680/udp # Auriga Router Service [Vincent_Gaudeul] [Vincent_Gaudeul] 2006-02 -ncxcp 5681/tcp # Net-coneX Control Protocol [Ryan_Werber] [Ryan_Werber] 2006-06 -ncxcp 5681/udp # Net-coneX Control Protocol [Ryan_Werber] [Ryan_Werber] 2006-06 -# 5682 tcp Reserved -brightcore 5682/udp # BrightCore control & data [Marko_Bjelac] [Marko_Bjelac] 2010-06-10 -# transfer exchange -# 5683 tcp Reserved -coap 5683/udp # Constrained Application [IESG] [IETF_Chair] 2011-06-13 2013-07-25 [RFC7252] -# Protocol -# 5684 tcp Reserved -coaps 5684/udp # DTLS-secured CoAP [IESG] [IETF_Chair] 2013-07-25 [RFC7252] -# 5685-5686 Unassigned -gog-multiplayer 5687/udp # GOG multiplayer game [GOG.com] [Michal_Gruchala] 2014-07-31 2014-10-09 -# protocol -# 5687 tcp Reserved -ggz 5688/tcp # GGZ Gaming Zone [Josef_Spillner] [Josef_Spillner] 2003-01 -ggz 5688/udp # GGZ Gaming Zone [Josef_Spillner] [Josef_Spillner] 2003-01 -qmvideo 5689/tcp # QM video network management [Jamie_Lokier] [Jamie_Lokier] 2006-05 -# protocol -qmvideo 5689/udp # QM video network management [Jamie_Lokier] [Jamie_Lokier] 2006-05 -# protocol -# 5690-5692 Unassigned -rbsystem 5693/tcp # Robert Bosch Data Transfer [Robert_Bosch_GmbH] [Klaus_Warth] 2011-08-01 2012-07-17 -# 5693 udp Reserved -# 5694-5695 Unassigned -kmip 5696/tcp # Key Management [OASIS_KMIP_Technical_Committee] [Robin_Cover] 2011-07-25 -# Interoperability Protocol -# 5696 udp Reserved -# 5697-5712 Unassigned -proshareaudio 5713/tcp # proshare conf audio [gunner] [gunner] -proshareaudio 5713/udp # proshare conf audio [gunner] [gunner] -prosharevideo 5714/tcp # proshare conf video [gunner] [gunner] -prosharevideo 5714/udp # proshare conf video [gunner] [gunner] -prosharedata 5715/tcp # proshare conf data [gunner] [gunner] -prosharedata 5715/udp # proshare conf data [gunner] [gunner] -prosharerequest 5716/tcp # proshare conf request [gunner] [gunner] -prosharerequest 5716/udp # proshare conf request [gunner] [gunner] -prosharenotify 5717/tcp # proshare conf notify [gunner] [gunner] -prosharenotify 5717/udp # proshare conf notify -dpm 5718/tcp # DPM Communication Server [Sundar_Srinivasan][Vinay_Badami] [Sundar_Srinivasan][Vinay_Badami] -dpm 5718/udp # DPM Communication Server [Sundar_Srinivasan][Vinay_Badami] [Sundar_Srinivasan][Vinay_Badami] -dpm-agent 5719/tcp # DPM Agent Coordinator [Sundar_Srinivasan][Vinay_Badami] [Sundar_Srinivasan][Vinay_Badami] 2006-05 -dpm-agent 5719/udp # DPM Agent Coordinator [Sundar_Srinivasan][Vinay_Badami] [Sundar_Srinivasan][Vinay_Badami] 2006-05 -ms-licensing 5720/tcp # MS-Licensing [Thomas_Lindeman] [Thomas_Lindeman] 2002-11 -ms-licensing 5720/udp # MS-Licensing [Thomas_Lindeman] [Thomas_Lindeman] 2002-11 -dtpt 5721/tcp # Desktop Passthru Service [Dan_Leising] [Dan_Leising] 2005-01 -dtpt 5721/udp # Desktop Passthru Service [Dan_Leising] [Dan_Leising] 2005-01 -msdfsr 5722/tcp # Microsoft DFS Replication [Guhan_Suriyanarayana] [Guhan_Suriyanarayana] 2006-03 -# Service -msdfsr 5722/udp # Microsoft DFS Replication [Guhan_Suriyanarayana] [Guhan_Suriyanarayana] 2006-03 -# Service -omhs 5723/tcp # Operations Manager - Health [Gerardo_Dilillo] [Gerardo_Dilillo] 2006-08 -# Service -omhs 5723/udp # Operations Manager - Health [Gerardo_Dilillo] [Gerardo_Dilillo] 2006-08 -# Service -omsdk 5724/tcp # Operations Manager - SDK [Gerardo_Dilillo] [Gerardo_Dilillo] 2006-08 -# Service -omsdk 5724/udp # Operations Manager - SDK [Gerardo_Dilillo] [Gerardo_Dilillo] 2006-08 -# Service -ms-ilm 5725/tcp # Microsoft Identity Lifecycle [Rob_Ward] [Rob_Ward] -# Manager -# 5725 udp Reserved 2008-05-02 -ms-ilm-sts 5726/tcp # Microsoft Lifecycle Manager [Rob_Ward] [Rob_Ward] -# Secure Token Service -# 5726 udp Reserved 2008-05-02 -asgenf 5727/tcp # ASG Event Notification [Arman_Bedonian] [Arman_Bedonian] 2009-07-15 -# Framework -# 5727 udp Reserved -io-dist-data 5728/tcp # Dist. I/O Comm. Service Data [Harish_Kuttan] [Harish_Kuttan] 2010-03-22 -# and Control -io-dist-group 5728/udp # Dist. I/O Comm. Service [Harish_Kuttan] [Harish_Kuttan] 2010-03-22 -# Group Membership -openmail 5729/tcp # Openmail User Agent Layer [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -openmail 5729/udp # Openmail User Agent Layer [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -unieng 5730/tcp # Steltor's calendar access [Bernard_Desruisseaux] [Bernard_Desruisseaux] -unieng 5730/udp # Steltor's calendar access [Bernard_Desruisseaux] [Bernard_Desruisseaux] -# 5731-5740 Unassigned -ida-discover1 5741/tcp # IDA Discover Port 1 [MPITech_Support] [MPITech_Support] -ida-discover1 5741/udp # IDA Discover Port 1 [MPITech_Support] [MPITech_Support] -ida-discover2 5742/tcp # IDA Discover Port 2 [MPITech_Support] [MPITech_Support] -ida-discover2 5742/udp # IDA Discover Port 2 [MPITech_Support] [MPITech_Support] -watchdoc-pod 5743/tcp # Watchdoc NetPOD Protocol [Christophe_Chevalier] [Christophe_Chevalier] 2005-08 -watchdoc-pod 5743/udp # Watchdoc NetPOD Protocol [Christophe_Chevalier] [Christophe_Chevalier] 2005-08 -watchdoc 5744/tcp # Watchdoc Server [Christophe_Chevalier] [Christophe_Chevalier] 2004-11 -watchdoc 5744/udp # Watchdoc Server [Christophe_Chevalier] [Christophe_Chevalier] 2004-11 -fcopy-server 5745/tcp # fcopy-server [Moshe_Leibovitch] [Moshe_Leibovitch] -fcopy-server 5745/udp # fcopy-server [Moshe_Leibovitch] [Moshe_Leibovitch] -fcopys-server 5746/tcp # fcopys-server [Moshe_Leibovitch] [Moshe_Leibovitch] -fcopys-server 5746/udp # fcopys-server [Moshe_Leibovitch] [Moshe_Leibovitch] -tunatic 5747/tcp # Wildbits Tunatic [Sylvain_Demongeot] [Sylvain_Demongeot] 2005-08 -tunatic 5747/udp # Wildbits Tunatic [Sylvain_Demongeot] [Sylvain_Demongeot] 2005-08 -tunalyzer 5748/tcp # Wildbits Tunalyzer [Sylvain_Demongeot] [Sylvain_Demongeot] 2005-08 -tunalyzer 5748/udp # Wildbits Tunalyzer [Sylvain_Demongeot] [Sylvain_Demongeot] 2005-08 -# 5749 Unassigned -rscd 5750/tcp # Bladelogic Agent Service [Brian_Trevor] [Brian_Trevor] 2008-10-24 -rscd 5750/udp # Bladelogic Agent Service [Brian_Trevor] [Brian_Trevor] 2008-10-24 -# 5751-5754 Unassigned -openmailg 5755/tcp # OpenMail Desk Gateway server [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -openmailg 5755/udp # OpenMail Desk Gateway server [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -# 5756 Unassigned -x500ms 5757/tcp # OpenMail X.500 Directory [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -# Server -x500ms 5757/udp # OpenMail X.500 Directory [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -# Server -# 5758-5765 Unassigned -openmailns 5766/tcp # OpenMail NewMail Server [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -openmailns 5766/udp # OpenMail NewMail Server [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -s-openmail 5767/tcp # OpenMail Suer Agent Layer [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -# (Secure) -s-openmail 5767/udp # OpenMail Suer Agent Layer [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -# (Secure) -openmailpxy 5768/tcp # OpenMail CMTS Server [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -openmailpxy 5768/udp # OpenMail CMTS Server [OpenMail_Encyclopedi][Don_Loughry] [OpenMail_Encyclopedi][Don_Loughry] -spramsca 5769/tcp # x509solutions Internal CA [Brendan_Fay] [Brendan_Fay] 2006-02 -spramsca 5769/udp # x509solutions Internal CA [Brendan_Fay] [Brendan_Fay] 2006-02 -spramsd 5770/tcp # x509solutions Secure Data [Brendan_Fay] [Brendan_Fay] 2006-02 -spramsd 5770/udp # x509solutions Secure Data [Brendan_Fay] [Brendan_Fay] 2006-02 -netagent 5771/tcp # NetAgent [Bradley_Birnbaum] [Bradley_Birnbaum] -netagent 5771/udp # NetAgent [Bradley_Birnbaum] [Bradley_Birnbaum] -# 5772-5776 Unassigned -dali-port 5777/tcp # DALI Port [Wayne_Morrow][Michael_Melio] [Wayne_Morrow][Michael_Melio] 2003-10 -dali-port 5777/udp # DALI Port [Wayne_Morrow][Michael_Melio] [Wayne_Morrow][Michael_Melio] 2003-10 -# 5778-5779 Unassigned -vts-rpc 5780/tcp # Visual Tag System RPC [Graham_Bloice] [Graham_Bloice] 2009-09-17 -# 5780 udp Reserved -3par-evts 5781/tcp # 3PAR Event Reporting Service [Sushil_Thomas] [Sushil_Thomas] 2008-03-10 -3par-evts 5781/udp # 3PAR Event Reporting Service [Sushil_Thomas] [Sushil_Thomas] 2008-03-10 -3par-mgmt 5782/tcp # 3PAR Management Service [Don_Marselle] [Don_Marselle] 2008-04-09 -3par-mgmt 5782/udp # 3PAR Management Service [Don_Marselle] [Don_Marselle] 2008-04-09 -3par-mgmt-ssl 5783/tcp # 3PAR Management Service with [Don_Marselle] [Don_Marselle] 2008-03-19 -# SSL -3par-mgmt-ssl 5783/udp # 3PAR Management Service with [Don_Marselle] [Don_Marselle] 2008-03-19 -# SSL -# 5784 tcp Reserved -ibar 5784/udp # Cisco Interbox Application [Cullen_Jennings] [Cullen_Jennings] 2010-02-03 -# Redundancy -3par-rcopy 5785/tcp # 3PAR Inform Remote Copy [Don_Marselle] [Don_Marselle] 2010-02-03 -3par-rcopy 5785/udp # 3PAR Inform Remote Copy [Don_Marselle] [Don_Marselle] 2008-04-09 -# 5786 tcp Reserved -cisco-redu 5786/udp # redundancy notification [Ming_Zhang] [Ming_Zhang] 2010-02-04 -# 5787 tcp Reserved -waascluster 5787/udp # Cisco WAAS Cluster Protocol [Winston_Chou] [Winston_Chou] 2011-02-08 -# 5788-5792 Unassigned -xtreamx 5793/tcp # XtreamX Supervised Peer [Ahmad_Tajuddin_Samsu] [Ahmad_Tajuddin_Samsu] 2007-02 -# message -xtreamx 5793/udp # XtreamX Supervised Peer [Ahmad_Tajuddin_Samsu] [Ahmad_Tajuddin_Samsu] 2007-02 -# message -# 5794 tcp Reserved -spdp 5794/udp # Simple Peered Discovery [Dave_Lindquist] [Dave_Lindquist] 2010-05-27 -# Protocol -# 5795-5812 Unassigned -icmpd 5813/tcp # ICMPD [Shane_O_Donnell] [Shane_O_Donnell] -icmpd 5813/udp # ICMPD [Shane_O_Donnell] [Shane_O_Donnell] -spt-automation 5814/tcp # Support Automation [Joshua_Hawkins] [Joshua_Hawkins] 2003-11 -spt-automation 5814/udp # Support Automation [Joshua_Hawkins] [Joshua_Hawkins] 2003-11 -# 5815-5840 Unassigned -# Z-firm ShipRush interface -shiprush-d-ch 5841/tcp # for web access and [Z-Firm_LLC] [Rafael_Zimberoff] 2014-08-22 -# bidirectional data -# 5841 udp Reserved -reversion 5842/tcp # Reversion Backup/Restore [Cameo_Systems_Inc] [Craig_Nelson] 2011-09-26 -# 5842 udp Reserved -# 5843-5858 Unassigned -wherehoo 5859/tcp # WHEREHOO [Jim_Youll] [Jim_Youll] -wherehoo 5859/udp # WHEREHOO [Jim_Youll] [Jim_Youll] -# 5860-5862 Unassigned -ppsuitemsg 5863/tcp # PlanetPress Suite Messeng [Yannick_Fortin] [Yannick_Fortin] 2006-02 -ppsuitemsg 5863/udp # PlanetPress Suite Messeng [Yannick_Fortin] [Yannick_Fortin] 2006-02 -# 5864-5867 Unassigned -diameters 5868/tcp # Diameter over TLS/TCP [IESG] [IETF_Chair] [RFC6733] -# 5868 udp Reserved -diameters 5868/sctp # Diameter over DTLS/SCTP [IESG] [IETF_Chair] [RFC6733] -# 5869-5882 Unassigned -jute 5883/tcp # Javascript Unit Test [Mark_Ethan_Trostler] [Mark_Ethan_Trostler] 2011-11-23 -# Environment -# 5884-5899 Unassigned -rfb 5900/tcp # Remote Framebuffer [Tristan_Richardson] [Tristan_Richardson] 2006-03 [RFC6143] -rfb 5900/udp # Remote Framebuffer [Tristan_Richardson] [Tristan_Richardson] 2006-03 [RFC6143] -# 5901-5909 Unassigned -cm 5910/tcp # Context Management [Eivan_Cerasi] [Eivan_Cerasi] 2008-10-10 -cm 5910/udp # Context Management [Eivan_Cerasi] [Eivan_Cerasi] 2008-10-10 -cm 5910/sctp # Context Management [Justin_Yu] [Justin_Yu] 2011-05-19 -cpdlc 5911/tcp # Controller Pilot Data Link [Eivan_Cerasi] [Eivan_Cerasi] 2008-10-10 -# Communication -cpdlc 5911/udp # Controller Pilot Data Link [Eivan_Cerasi] [Eivan_Cerasi] 2008-10-10 -# Communication -cpdlc 5911/sctp # Controller Pilot Data Link [Justin_Yu] [Justin_Yu] 2011-05-18 -# Communication -fis 5912/tcp # Flight Information Services [Eivan_Cerasi] [Eivan_Cerasi] 2008-10-10 -fis 5912/udp # Flight Information Services [Eivan_Cerasi] [Eivan_Cerasi] 2008-10-10 -fis 5912/sctp # Flight Information Services [Justin_Yu] [Justin_Yu] 2011-05-25 -ads-c 5913/tcp # Automatic Dependent [Eivan_Cerasi] [Eivan_Cerasi] 2008-10-10 -# Surveillance -ads-c 5913/udp # Automatic Dependent [Eivan_Cerasi] [Eivan_Cerasi] 2008-10-10 -# Surveillance -ads-c 5913/sctp # Automatic Dependent [Justin_Yu] [Justin_Yu] 2011-05-25 -# Surveillance -# 5914-5962 Unassigned -indy 5963/tcp # Indy Application Server [Bjorn_Lantz] [Bjorn_Lantz] 2004-11 -indy 5963/udp # Indy Application Server [Bjorn_Lantz] [Bjorn_Lantz] 2004-11 -# 5964-5967 Unassigned -mppolicy-v5 5968/tcp # mppolicy-v5 [Yutaka_Ono] [Yutaka_Ono] -mppolicy-v5 5968/udp # mppolicy-v5 [Yutaka_Ono] [Yutaka_Ono] -mppolicy-mgr 5969/tcp # mppolicy-mgr [Yutaka_Ono] [Yutaka_Ono] -mppolicy-mgr 5969/udp # mppolicy-mgr [Yutaka_Ono] [Yutaka_Ono] -# 5970-5983 Unassigned -couchdb 5984/tcp # CouchDB [Noah_Slater] [Noah_Slater] 2007-11-27 -couchdb 5984/udp # CouchDB [Noah_Slater] [Noah_Slater] 2007-11-27 -wsman 5985/tcp # WBEM WS-Management HTTP [Jim_Davis] [Jim_Davis] 2006-11 -wsman 5985/udp # WBEM WS-Management HTTP [Jim_Davis] [Jim_Davis] 2006-11 -wsmans 5986/tcp # WBEM WS-Management HTTP over [Jim_Davis] [Jim_Davis] 2006-11 -# TLS/SSL -wsmans 5986/udp # WBEM WS-Management HTTP over [Jim_Davis] [Jim_Davis] 2006-11 -# TLS/SSL -wbem-rmi 5987/tcp # WBEM RMI [Jim_Davis] [Jim_Davis] -wbem-rmi 5987/udp # WBEM RMI [Jim_Davis] [Jim_Davis] -wbem-http 5988/tcp # WBEM CIM-XML (HTTP) [Jim_Davis] [Jim_Davis] -wbem-http 5988/udp # WBEM CIM-XML (HTTP) [Jim_Davis] [Jim_Davis] -wbem-https 5989/tcp # WBEM CIM-XML (HTTPS) [Jim_Davis] [Jim_Davis] -wbem-https 5989/udp # WBEM CIM-XML (HTTPS) [Jim_Davis] [Jim_Davis] -wbem-exp-https 5990/tcp # WBEM Export HTTPS [Denise_Eckstein] [Denise_Eckstein] 2004-11 -wbem-exp-https 5990/udp # WBEM Export HTTPS [Denise_Eckstein] [Denise_Eckstein] 2004-11 -nuxsl 5991/tcp # NUXSL [Kai_Kretschmann] [Kai_Kretschmann] 2002-03 -nuxsl 5991/udp # NUXSL [Kai_Kretschmann] [Kai_Kretschmann] 2002-03 -consul-insight 5992/tcp # Consul InSight Security [Arthur_Hillenaar] [Arthur_Hillenaar] 2006-01 -consul-insight 5992/udp # Consul InSight Security [Arthur_Hillenaar] [Arthur_Hillenaar] 2006-01 -cim-rs 5993/tcp # DMTF WBEM CIM REST [WS_Inc] [Jim_Davis_2] 2015-04-24 -# 5993 udp Reserved -# 5994-5998 Unassigned -cvsup 5999/tcp # CVSup [Randall_Atkinson_2] [Randall_Atkinson_2] -cvsup 5999/udp # CVSup [Randall_Atkinson_2] [Randall_Atkinson_2] -# Known -x11 6000/tcp # X Window System [Stephen_Gildea] [Stephen_Gildea] Unauthorized -# Use on port -# 6003 -# Known -x11 6000/udp # X Window System [Stephen_Gildea] [Stephen_Gildea] Unauthorized -# Use on port -# 6003 -ndl-ahp-svc 6064/tcp # NDL-AHP-SVC [John_Richmond_2] [John_Richmond_2] -ndl-ahp-svc 6064/udp # NDL-AHP-SVC [John_Richmond_2] [John_Richmond_2] -winpharaoh 6065/tcp # WinPharaoh [Basil_Lee] [Basil_Lee] -winpharaoh 6065/udp # WinPharaoh [Basil_Lee] [Basil_Lee] -ewctsp 6066/tcp # EWCTSP [Mark_Bailon] [Mark_Bailon] -ewctsp 6066/udp # EWCTSP [Mark_Bailon] [Mark_Bailon] -# 6067 Unassigned 2007-07-17 -gsmp-ancp 6068/tcp # GSMP/ANCP [Avri_Doria] [Avri_Doria] [RFC6320] -# 6068 udp Reserved -trip 6069/tcp # TRIP [Hussein_F_Salama] [Hussein_F_Salama] -trip 6069/udp # TRIP [Hussein_F_Salama] [Hussein_F_Salama] -messageasap 6070/tcp # Messageasap [Murray_Freeman] [Murray_Freeman] -messageasap 6070/udp # Messageasap [Murray_Freeman] [Murray_Freeman] -ssdtp 6071/tcp # SSDTP [Michael_Shearson_2] [Michael_Shearson_2] -ssdtp 6071/udp # SSDTP [Michael_Shearson_2] [Michael_Shearson_2] -diagnose-proc 6072/tcp # DIAGNOSE-PROC [Allan_Miller] [Allan_Miller] -diagnose-proc 6072/udp # DIAGNOSE-PROC [Allan_Miller] [Allan_Miller] -directplay8 6073/tcp # DirectPlay8 [John_Kane] [John_Kane] -directplay8 6073/udp # DirectPlay8 [John_Kane] [John_Kane] -max 6074/tcp # Microsoft Max [Jay_Beavers] [Jay_Beavers] 2006-02 -max 6074/udp # Microsoft Max [Jay_Beavers] [Jay_Beavers] 2006-02 -dpm-acm 6075/tcp # Microsoft DPM Access Control [Prabu_Ambravaneswara] [Prabu_Ambravaneswara] 2009-10-29 -# Manager -# 6075 udp Reserved -msft-dpm-cert 6076/tcp # Microsoft DPM WCF [Microsoft_Corporation] [Prateek_Sharma] 2011-08-04 -# Certificates -# 6076 udp Reserved -iconstructsrv 6077/tcp # iConstruct Server [iConstruct_Aus_Pty_Ltd] [Afshin_Jafari] 2012-12-21 -# 6077 udp Reserved -# 6078-6079 Unassigned -gue 6080/udp # Generic UDP Encapsulation [Tom_Herbert] [Tom_Herbert] 2015-03-05 [draft-herbert-gue] -# 6080 tcp Reserved -# Generic Network -geneve 6081/udp # Virtualization Encapsulation [Jesse_Gross] [Jesse_Gross] 2014-03-27 [draft-gross-geneve-00] -# (Geneve) -# 6081 tcp Reserved -# 6082 tcp Reserved -# APCO Project 25 Common Air -p25cai 6082/udp # Interface - UDP [APCO_Project] [APCO_Project] 2011-05-13 -# encapsulation -# 6083 tcp Reserved -miami-bcast 6083/udp # telecomsoftware miami [Peter_Steiner] [Peter_Steiner] 2011-02-22 -# broadcast -reload-config 6084/tcp # Peer to Peer Infrastructure [IESG] [IETF_Chair] 2009-01-29 2013-03-26 [RFC6940] -# Configuration -# 6084 udp Reserved -konspire2b 6085/tcp # konspire2b p2p network [Jason_Rohrer] [Jason_Rohrer] 2002-10 -konspire2b 6085/udp # konspire2b p2p network [Jason_Rohrer] [Jason_Rohrer] 2002-10 -pdtp 6086/tcp # PDTP P2P [Tony_Arcieri] [Tony_Arcieri] 2006-03 -pdtp 6086/udp # PDTP P2P [Tony_Arcieri] [Tony_Arcieri] 2006-03 -ldss 6087/tcp # Local Download Sharing [Clifford_Heath] [Clifford_Heath] 2006-05 -# Service -ldss 6087/udp # Local Download Sharing [Clifford_Heath] [Clifford_Heath] 2006-05 -# Service -doglms 6088/tcp # SuperDog License Manager [SafeNet] [Rob_Tao] 2012-07-26 -doglms-notify 6088/udp # SuperDog License Manager [SafeNet] [Rob_Tao] 2012-07-26 -# Notifier -# 6089-6098 Unassigned -raxa-mgmt 6099/tcp # RAXA Management [Sukanta_Ganguly] [Sukanta_Ganguly] -# 6099 udp Reserved -# Known -synchronet-db 6100/tcp # SynchroNet-db [Arne_Haugland] [Arne_Haugland] Unauthorized -# Use on port -# 6100 -# Known -synchronet-db 6100/udp # SynchroNet-db [Arne_Haugland] [Arne_Haugland] Unauthorized -# Use on port -# 6100 -synchronet-rtc 6101/tcp # SynchroNet-rtc [Arne_Haugland] [Arne_Haugland] -synchronet-rtc 6101/udp # SynchroNet-rtc [Arne_Haugland] [Arne_Haugland] -synchronet-upd 6102/tcp # SynchroNet-upd [Arne_Haugland] [Arne_Haugland] -synchronet-upd 6102/udp # SynchroNet-upd [Arne_Haugland] [Arne_Haugland] -rets 6103/tcp # RETS [Jeremy_Crawford] [Jeremy_Crawford] -rets 6103/udp # RETS [Jeremy_Crawford] [Jeremy_Crawford] -dbdb 6104/tcp # DBDB [Aaron_Brick] [Aaron_Brick] -dbdb 6104/udp # DBDB [Aaron_Brick] [Aaron_Brick] -primaserver 6105/tcp # Prima Server [Prima_Designs_System] [Prima_Designs_System] -primaserver 6105/udp # Prima Server [Prima_Designs_System] [Prima_Designs_System] -mpsserver 6106/tcp # MPS Server [Prima_Designs_System] [Prima_Designs_System] -mpsserver 6106/udp # MPS Server [Prima_Designs_System] [Prima_Designs_System] -etc-control 6107/tcp # ETC Control [Steve_Polishinski] [Steve_Polishinski] -etc-control 6107/udp # ETC Control [Steve_Polishinski] [Steve_Polishinski] -sercomm-scadmin 6108/tcp # Sercomm-SCAdmin [Melinda_Tsao_2] [Melinda_Tsao_2] -sercomm-scadmin 6108/udp # Sercomm-SCAdmin [Melinda_Tsao_2] [Melinda_Tsao_2] -globecast-id 6109/tcp # GLOBECAST-ID [Piers_Scannell_2] [Piers_Scannell_2] -globecast-id 6109/udp # GLOBECAST-ID [Piers_Scannell_2] [Piers_Scannell_2] -softcm 6110/tcp # HP SoftBench CM [Scott_A_Kramer] [Scott_A_Kramer] -softcm 6110/udp # HP SoftBench CM [Scott_A_Kramer] [Scott_A_Kramer] -spc 6111/tcp # HP SoftBench Sub-Process [Scott_A_Kramer] [Scott_A_Kramer] -# Control -spc 6111/udp # HP SoftBench Sub-Process [Scott_A_Kramer] [Scott_A_Kramer] -# Control -dtspcd 6112/tcp # Desk-Top Sub-Process Control [Doug_Royer] [Doug_Royer] 2010-12-08 -# Daemon -dtspcd 6112/udp # Desk-Top Sub-Process Control [Doug_Royer] [Doug_Royer] 2010-12-08 -# Daemon -dayliteserver 6113/tcp # Daylite Server [Brent_Gulanowski] [Brent_Gulanowski] 2009-08-26 -# 6113 udp Reserved -wrspice 6114/tcp # WRspice IPC Service [Stephen_R_Whiteley] [Stephen_R_Whiteley] 2010-10-07 -# 6114 udp Reserved -xic 6115/tcp # Xic IPC Service [Stephen_R_Whiteley] [Stephen_R_Whiteley] 2010-10-07 -# 6115 udp Reserved -xtlserv 6116/tcp # XicTools License Manager [Stephen_R_Whiteley] [Stephen_R_Whiteley] 2010-10-07 -# Service -# 6116 udp Reserved -daylitetouch 6117/tcp # Daylite Touch Sync [Brent_Gulanowski] [Brent_Gulanowski] 2009-08-26 -# 6117 udp Reserved -tipc 6118/udp # Transparent Inter Process [Ericsson] [Erik_Hugne] 2012-09-05 -# Communication -# 6118 tcp Reserved -# 6119-6120 Unassigned -spdy 6121/tcp # SPDY for a faster web [Matthew_Lloyd] [Matthew_Lloyd] 2010-04-26 -# 6121 udp Reserved -bex-webadmin 6122/tcp # Backup Express Web Server [Catalogic_Software_Inc] [Chi_Shih_Chang] 2008-03-19 2015-02-04 -bex-webadmin 6122/udp # Backup Express Web Server [Catalogic_Software_Inc] [Chi_Shih_Chang] 2008-03-19 2015-02-04 -backup-express 6123/tcp # Backup Express [Catalogic_Software_Inc] [Chi_Shih_Chang] 2008-03-19 2015-02-04 -backup-express 6123/udp # Backup Express [Catalogic_Software_Inc] [Chi_Shih_Chang] 2008-03-19 2015-02-04 -pnbs 6124/tcp # Phlexible Network Backup [William_R_Lear_2] [William_R_Lear_2] 2008-10-23 -# Service -pnbs 6124/udp # Phlexible Network Backup [William_R_Lear_2] [William_R_Lear_2] 2008-10-23 -# Service -# 6125-6129 Unassigned -damewaremobgtwy 6130/tcp # The DameWare Mobile Gateway [SolarWinds] [David_Gayler] 2013-05-29 -# Service -# 6130 udp Reserved -# 6131-6132 Unassigned -nbt-wol 6133/tcp # New Boundary Tech WOL [Elizabeth_Zilen] [Elizabeth_Zilen] 2004-11 -nbt-wol 6133/udp # New Boundary Tech WOL [Elizabeth_Zilen] [Elizabeth_Zilen] 2004-11 -# 6134-6139 Unassigned -pulsonixnls 6140/tcp # Pulsonix Network License [David_Manns] [David_Manns] 2008-02-28 -# Service -pulsonixnls 6140/udp # Pulsonix Network License [David_Manns] [David_Manns] 2008-02-28 -# Service -meta-corp 6141/tcp # Meta Corporation License [Osamu_Masuda] [Osamu_Masuda] -# Manager -meta-corp 6141/udp # Meta Corporation License [Osamu_Masuda] [Osamu_Masuda] -# Manager -aspentec-lm 6142/tcp # Aspen Technology License [Kevin_Massey] [Kevin_Massey] -# Manager -aspentec-lm 6142/udp # Aspen Technology License [Kevin_Massey] [Kevin_Massey] -# Manager -watershed-lm 6143/tcp # Watershed License Manager [David_Ferrero] [David_Ferrero] -watershed-lm 6143/udp # Watershed License Manager [David_Ferrero] [David_Ferrero] -statsci1-lm 6144/tcp # StatSci License Manager - 1 [Scott_Blachowicz] [Scott_Blachowicz] -statsci1-lm 6144/udp # StatSci License Manager - 1 [Scott_Blachowicz] [Scott_Blachowicz] -statsci2-lm 6145/tcp # StatSci License Manager - 2 [Scott_Blachowicz] [Scott_Blachowicz] -statsci2-lm 6145/udp # StatSci License Manager - 2 [Scott_Blachowicz] [Scott_Blachowicz] -lonewolf-lm 6146/tcp # Lone Wolf Systems License [Dan_Klein] [Dan_Klein] -# Manager -lonewolf-lm 6146/udp # Lone Wolf Systems License [Dan_Klein] [Dan_Klein] -# Manager -montage-lm 6147/tcp # Montage License Manager [Michael_Ubell] [Michael_Ubell] -montage-lm 6147/udp # Montage License Manager [Michael_Ubell] [Michael_Ubell] -ricardo-lm 6148/tcp # Ricardo North America [M_Flemming] [M_Flemming] -# License Manager -ricardo-lm 6148/udp # Ricardo North America [M_Flemming] [M_Flemming] -# License Manager -tal-pod 6149/tcp # tal-pod [Steven_Loomis] [Steven_Loomis] -tal-pod 6149/udp # tal-pod [Steven_Loomis] [Steven_Loomis] -# 6150-6158 Unassigned -efb-aci 6159/tcp # EFB Application Control [Jonathan_Schaaf] [Jonathan_Schaaf] 2010-02-10 -# Interface -# 6159 udp Reserved -ecmp 6160/tcp # Emerson Extensible Control [Bryce_Beeston] [Bryce_Beeston] 2011-06-23 -# and Management Protocol -ecmp-data 6160/udp # Emerson Extensible Control [Bryce_Beeston] [Bryce_Beeston] 2011-06-23 -# and Management Protocol Data -patrol-ism 6161/tcp # PATROL Internet Srv Mgr [Portnoy_Boxman] [Portnoy_Boxman] 2005-01 -patrol-ism 6161/udp # PATROL Internet Srv Mgr [Portnoy_Boxman] [Portnoy_Boxman] 2005-01 -patrol-coll 6162/tcp # PATROL Collector [Portnoy_Boxman] [Portnoy_Boxman] 2005-01 -patrol-coll 6162/udp # PATROL Collector [Portnoy_Boxman] [Portnoy_Boxman] 2005-01 -pscribe 6163/tcp # Precision Scribe Cnx Port [Robert_W_Hodges] [Robert_W_Hodges] 2005-01 -pscribe 6163/udp # Precision Scribe Cnx Port [Robert_W_Hodges] [Robert_W_Hodges] 2005-01 -# 6164-6199 Unassigned -# Known -lm-x 6200/tcp # LM-X License Manager by [Henrik_Goldman] [Henrik_Goldman] 2006-10 Unauthorized -# X-Formation Use on port -# 6200 -# Known -lm-x 6200/udp # LM-X License Manager by [Henrik_Goldman] [Henrik_Goldman] 2006-10 Unauthorized -# X-Formation Use on port -# 6200 -# 6201 tcp Reserved -# Management of service nodes -thermo-calc 6201/udp # in a processing grid for [Thermo-Calc_Software] [Thomas_Revesz] 2012-06-28 -# thermodynamic calculations -# 6202-6208 Unassigned -qmtps 6209/tcp # QMTP over TLS [FEHCom] [Erwin_Hoffmann] 2015-01-09 -qmtps 6209/udp # QMTP over TLS [FEHCom] [Erwin_Hoffmann] 2015-01-09 -# 6210-6221 Unassigned -radmind 6222/tcp # Radmind Access Protocol [Patrick_M_McNeal] [Patrick_M_McNeal] 2006-03 -radmind 6222/udp # Radmind Access Protocol [Patrick_M_McNeal] [Patrick_M_McNeal] 2006-03 -# 6223-6240 Unassigned -jeol-nsdtp-1 6241/tcp # JEOL Network Services Data [Kevin_Wellwood] [Kevin_Wellwood] 2008-04-17 -# Transport Protocol 1 -jeol-nsddp-1 6241/udp # JEOL Network Services [Kevin_Wellwood] [Kevin_Wellwood] 2008-04-17 -# Dynamic Discovery Protocol 1 -jeol-nsdtp-2 6242/tcp # JEOL Network Services Data [Kevin_Wellwood] [Kevin_Wellwood] 2008-04-17 -# Transport Protocol 2 -jeol-nsddp-2 6242/udp # JEOL Network Services [Kevin_Wellwood] [Kevin_Wellwood] 2008-04-17 -# Dynamic Discovery Protocol 2 -jeol-nsdtp-3 6243/tcp # JEOL Network Services Data [Kevin_Wellwood] [Kevin_Wellwood] 2008-04-17 -# Transport Protocol 3 -jeol-nsddp-3 6243/udp # JEOL Network Services [Kevin_Wellwood] [Kevin_Wellwood] 2008-04-17 -# Dynamic Discovery Protocol 3 -jeol-nsdtp-4 6244/tcp # JEOL Network Services Data [Kevin_Wellwood] [Kevin_Wellwood] 2008-04-17 -# Transport Protocol 4 -jeol-nsddp-4 6244/udp # JEOL Network Services [Kevin_Wellwood] [Kevin_Wellwood] 2008-04-17 -# Dynamic Discovery Protocol 4 -# 6245-6250 Unassigned -tl1-raw-ssl 6251/tcp # TL1 Raw Over SSL/TLS [Jim_Humphreys] [Jim_Humphreys] 2008-01-29 -tl1-raw-ssl 6251/udp # TL1 Raw Over SSL/TLS [Jim_Humphreys] [Jim_Humphreys] 2008-01-29 -tl1-ssh 6252/tcp # TL1 over SSH [Jim_Humphreys] [Jim_Humphreys] 2008-01-25 -tl1-ssh 6252/udp # TL1 over SSH [Jim_Humphreys] [Jim_Humphreys] 2008-01-25 -crip 6253/tcp # CRIP [Mike_Rodbell] [Mike_Rodbell] -crip 6253/udp # CRIP [Mike_Rodbell] [Mike_Rodbell] -# 6254-6266 Unassigned -gld 6267/tcp # GridLAB-D User Interface [David_Chassin] [David_Chassin] 2010-12-10 -# 6267 udp Reserved -grid 6268/tcp # Grid Authentication [Jason_Hamilton] [Jason_Hamilton] 2006-06 -grid 6268/udp # Grid Authentication [Jason_Hamilton] [Jason_Hamilton] 2006-06 -grid-alt 6269/tcp # Grid Authentication Alt [Jason_Hamilton] [Jason_Hamilton] 2006-06 -grid-alt 6269/udp # Grid Authentication Alt [Jason_Hamilton] [Jason_Hamilton] 2006-06 -# 6270-6299 Unassigned -bmc-grx 6300/tcp # BMC GRX [Portnoy_Boxman] [Portnoy_Boxman] -bmc-grx 6300/udp # BMC GRX [Portnoy_Boxman] [Portnoy_Boxman] -# BMC CONTROL-D LDAP SERVER -# -bmc-ctd-ldap 6301/tcp # IANA assigned this [Portnoy_Boxman_2] [Portnoy_Boxman_2] 2006-09 -# well-formed service name as -# a replacement for -# "bmc_ctd_ldap". -# This entry is an alias to "bmc-ctd-ldap". This entry is now -bmc_ctd_ldap 6301/tcp # BMC CONTROL-D LDAP SERVER [Portnoy_Boxman_2] [Portnoy_Boxman_2] 2006-09 historic, not usable for use with many common service -# discovery mechanisms. -# BMC CONTROL-D LDAP SERVER -# -bmc-ctd-ldap 6301/udp # IANA assigned this [Portnoy_Boxman_2] [Portnoy_Boxman_2] 2006-09 -# well-formed service name as -# a replacement for -# "bmc_ctd_ldap". -# This entry is an alias to "bmc-ctd-ldap". This entry is now -bmc_ctd_ldap 6301/udp # BMC CONTROL-D LDAP SERVER [Portnoy_Boxman_2] [Portnoy_Boxman_2] 2006-09 historic, not usable for use with many common service -# discovery mechanisms. -# 6302-6305 Unassigned -ufmp 6306/tcp # Unified Fabric Management [Albert_Berlovitch] [Albert_Berlovitch] 2009-12-17 -# Protocol -ufmp 6306/udp # Unified Fabric Management [Albert_Berlovitch] [Albert_Berlovitch] 2009-12-17 -# Protocol -# 6307-6314 Unassigned -scup 6315/tcp # Sensor Control Unit Protocol [Sven_Kopacz] [Sven_Kopacz] 2010-09-01 -scup-disc 6315/udp # Sensor Control Unit Protocol [Sven_Kopacz] [Sven_Kopacz] 2010-09-01 -# Discovery Protocol -abb-escp 6316/tcp # Ethernet Sensor [Jaime_Antolin] [Jaime_Antolin] 2008-09-25 -# Communications Protocol -abb-escp 6316/udp # Ethernet Sensor [Jaime_Antolin] [Jaime_Antolin] 2008-09-25 -# Communications Protocol -nav-data-cmd 6317/tcp # Navtech Radar Sensor Data [Navtech_Radar_Ltd] [Guy_Avery] 2013-02-20 -# Command -nav-data 6317/udp # Navtech Radar Sensor Data [Navtech_Radar_Ltd] [Guy_Avery] 2013-02-20 -# 6318-6319 Unassigned -repsvc 6320/tcp # Double-Take Replication [James_Wilkinson] [James_Wilkinson] 2006-04 -# Service -repsvc 6320/udp # Double-Take Replication [James_Wilkinson] [James_Wilkinson] 2006-04 -# Service -emp-server1 6321/tcp # Empress Software [Srdjan_Holovac] [Srdjan_Holovac] -# Connectivity Server 1 -emp-server1 6321/udp # Empress Software [Srdjan_Holovac] [Srdjan_Holovac] -# Connectivity Server 1 -emp-server2 6322/tcp # Empress Software [Srdjan_Holovac] [Srdjan_Holovac] -# Connectivity Server 2 -emp-server2 6322/udp # Empress Software [Srdjan_Holovac] [Srdjan_Holovac] -# Connectivity Server 2 -# 6323 Unassigned -hrd-ncs 6324/tcp # HR Device Network [Hall_Research] [Vishal_Dharmadhikari] 2011-11-29 -# Configuration Service -hrd-ns-disc 6324/udp # HR Device Network service [Hall_Research] [Vishal_Dharmadhikari] 2011-11-29 -dt-mgmtsvc 6325/tcp # Double-Take Management [Vision_Solutions] [James_Wilkinson2] 2012-06-06 -# Service -# 6325 udp Reserved -dt-vra 6326/tcp # Double-Take Virtual Recovery [Vision_Solutions] [James_Wilkinson2] 2012-10-08 -# Assistant -# 6326 udp Reserved -# 6327-6342 Unassigned -sflow 6343/tcp # sFlow traffic monitoring [Peter_Phaal] [Peter_Phaal] 2003-06 -sflow 6343/udp # sFlow traffic monitoring [Peter_Phaal] [Peter_Phaal] 2003-06 -# Argus-Spectr security and -streletz 6344/tcp # fire-prevention systems [Argus_Spectr] [Kirill_Marinushkin] 2013-10-25 -# service -# 6344 udp Reserved -# 6345-6345 Unassigned -gnutella-svc 6346/tcp # gnutella-svc [Serguei_Osokine] [Serguei_Osokine] -gnutella-svc 6346/udp # gnutella-svc [Serguei_Osokine] [Serguei_Osokine] -gnutella-rtr 6347/tcp # gnutella-rtr [Serguei_Osokine] [Serguei_Osokine] -gnutella-rtr 6347/udp # gnutella-rtr [Serguei_Osokine] [Serguei_Osokine] -# 6348-6349 Unassigned -adap 6350/tcp # App Discovery and Access [Thomas_Kjoernes] [Thomas_Kjoernes] 2010-06-22 -# Protocol -adap 6350/udp # App Discovery and Access [Thomas_Kjoernes] [Thomas_Kjoernes] 2010-06-22 -# Protocol -# 6351-6354 Unassigned -pmcs 6355/tcp # PMCS applications [Pavel_Mendl] [Pavel_Mendl] 2007-03 -pmcs 6355/udp # PMCS applications [Pavel_Mendl] [Pavel_Mendl] 2007-03 -# 6356-6359 Unassigned -metaedit-mu 6360/tcp # MetaEdit+ Multi-User [Steven_Kelly] [Steven_Kelly] 2007-11-12 -metaedit-mu 6360/udp # MetaEdit+ Multi-User [Steven_Kelly] [Steven_Kelly] 2007-11-12 -# 6361-6362 Unassigned -ndn 6363/udp # Named Data Networking [Regents_of_the_University_of_California] [Jeff_Burke] 2013-10-30 -# 6363 tcp Reserved -# 6364-6369 Unassigned -metaedit-se 6370/tcp # MetaEdit+ Server [Steven_Kelly] [Steven_Kelly] 2007-11-12 -# Administration -metaedit-se 6370/udp # MetaEdit+ Server [Steven_Kelly] [Steven_Kelly] 2007-11-12 -# Administration -# 6371-6378 Unassigned -redis 6379/tcp # An advanced key-value cache [Salvatore_Sanfilippo] [Itamar_Haber] 2015-04-23 -# and store -# 6379 udp Reserved -# 6380-6381 Unassigned -metatude-mds 6382/tcp # Metatude Dialogue Server [Menno_Zweistra] [Menno_Zweistra] -metatude-mds 6382/udp # Metatude Dialogue Server [Menno_Zweistra] [Menno_Zweistra] -# 6383-6388 Unassigned -clariion-evr01 6389/tcp # clariion-evr01 [Dave_DesRoches] [Dave_DesRoches] -clariion-evr01 6389/udp # clariion-evr01 [Dave_DesRoches] [Dave_DesRoches] -metaedit-ws 6390/tcp # MetaEdit+ WebService API [Steven_Kelly] [Steven_Kelly] 2007-11-12 -metaedit-ws 6390/udp # MetaEdit+ WebService API [Steven_Kelly] [Steven_Kelly] 2007-11-12 -# 6391-6399 Unassigned -# boe-cms 6400 Business Objects CMS contact [Wade_Richards] [Wade_Richards] 2008-05-05 -# port -# boe-was 6401 boe-was [Wade_Richards] [Wade_Richards] 2008-05-05 -# boe-eventsrv 6402 boe-eventsrv [Wade_Richards] [Wade_Richards] 2008-05-05 -# boe-cachesvr 6403 boe-cachesvr [Wade_Richards] [Wade_Richards] 2008-05-05 -# boe-filesvr 6404 Business Objects Enterprise [Wade_Richards] [Wade_Richards] 2008-05-05 -# internal server -# boe-pagesvr 6405 Business Objects Enterprise [Wade_Richards] [Wade_Richards] 2008-05-05 -# internal server -# boe-processsvr 6406 Business Objects Enterprise [Wade_Richards] [Wade_Richards] 2008-05-05 -# internal server -# boe-resssvr1 6407 Business Objects Enterprise [Wade_Richards] [Wade_Richards] 2008-05-05 -# internal server -# boe-resssvr2 6408 Business Objects Enterprise [Wade_Richards] [Wade_Richards] 2008-05-05 -# internal server -# boe-resssvr3 6409 Business Objects Enterprise [Wade_Richards] [Wade_Richards] 2008-05-05 -# internal server -# boe-resssvr4 6410 Business Objects Enterprise [Wade_Richards] [Wade_Richards] 2008-05-05 -# internal server -# 6411-6416 Unassigned -faxcomservice 6417/tcp # Faxcom Message Service [Albert_Leung] [Albert_Leung] 2006-04 -faxcomservice 6417/udp # Faxcom Message Service [Albert_Leung] [Albert_Leung] 2006-04 -syserverremote 6418/tcp # SYserver remote commands [David_Ashkenazi] [David_Ashkenazi] 2010-03-23 -# 6418 udp Reserved -svdrp 6419/tcp # Simple VDR Protocol [Klaus_Schmidinger] [Klaus_Schmidinger] 2010-03-31 -svdrp-disc 6419/udp # Simple VDR Protocol [Klaus_Schmidinger] [Klaus_Schmidinger] 2015-05-08 -# Discovery -nim-vdrshell 6420/tcp # NIM_VDRShell [Rik_Ditter] [Rik_Ditter] 2006-02 -nim-vdrshell 6420/udp # NIM_VDRShell [Rik_Ditter] [Rik_Ditter] 2006-02 -nim-wan 6421/tcp # NIM_WAN [Rik_Ditter] [Rik_Ditter] 2006-02 -nim-wan 6421/udp # NIM_WAN [Rik_Ditter] [Rik_Ditter] 2006-02 -# 6422-6431 Unassigned -pgbouncer 6432/tcp # PgBouncer [Marko_Kreen] [Marko_Kreen] 2009-02-13 -# 6432 udp Reserved -# 6433-6441 Unassigned -tarp 6442/tcp # Transitory Application [Chris_Peel_2] [Chris_Peel_2] 2014-05-16 -# Request Protocol -# 6442 udp Reserved -sun-sr-https 6443/tcp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# HTTPS Domain -sun-sr-https 6443/udp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# HTTPS Domain -# Grid Engine Qmaster Service -# -sge-qmaster 6444/tcp # IANA assigned this [Andreas_Haas] [Andreas_Haas] 2006-08 -# well-formed service name as -# a replacement for -# "sge_qmaster". -# This entry is an alias to "sge-qmaster". This entry is now -sge_qmaster 6444/tcp # Grid Engine Qmaster Service [Andreas_Haas] [Andreas_Haas] 2006-08 historic, not usable for use with many common service -# discovery mechanisms. -# Grid Engine Qmaster Service -# -sge-qmaster 6444/udp # IANA assigned this [Andreas_Haas] [Andreas_Haas] 2006-08 -# well-formed service name as -# a replacement for -# "sge_qmaster". -# This entry is an alias to "sge-qmaster". This entry is now -sge_qmaster 6444/udp # Grid Engine Qmaster Service [Andreas_Haas] [Andreas_Haas] 2006-08 historic, not usable for use with many common service -# discovery mechanisms. -# Grid Engine Execution -# Service -# -sge-execd 6445/tcp # IANA assigned this [Andreas_Haas] [Andreas_Haas] 2006-08 -# well-formed service name as -# a replacement for -# "sge_execd". -# Grid Engine Execution This entry is an alias to "sge-execd". This entry is now -sge_execd 6445/tcp # Service [Andreas_Haas] [Andreas_Haas] 2006-08 historic, not usable for use with many common service -# discovery mechanisms. -# Grid Engine Execution -# Service -# -sge-execd 6445/udp # IANA assigned this [Andreas_Haas] [Andreas_Haas] 2006-08 -# well-formed service name as -# a replacement for -# "sge_execd". -# Grid Engine Execution This entry is an alias to "sge-execd". This entry is now -sge_execd 6445/udp # Service [Andreas_Haas] [Andreas_Haas] 2006-08 historic, not usable for use with many common service -# discovery mechanisms. -mysql-proxy 6446/tcp # MySQL Proxy [Kay_Roepke] [Kay_Roepke] 2009-04-22 -mysql-proxy 6446/udp # MySQL Proxy [Kay_Roepke] [Kay_Roepke] 2009-04-22 -# 6447-6454 Unassigned -skip-cert-recv 6455/tcp # SKIP Certificate Receive [Tom_Markson] [Tom_Markson] -skip-cert-recv 6455/udp # SKIP Certificate Receive [Tom_Markson] [Tom_Markson] -skip-cert-send 6456/tcp # SKIP Certificate Send [Tom_Markson] [Tom_Markson] -skip-cert-send 6456/udp # SKIP Certificate Send [Tom_Markson] [Tom_Markson] -# 6457-6470 Unassigned -lvision-lm 6471/tcp # LVision License Manager [Brian_McKinnon] [Brian_McKinnon] -lvision-lm 6471/udp # LVision License Manager [Brian_McKinnon] [Brian_McKinnon] -# 6472-6479 Unassigned -sun-sr-http 6480/tcp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# HTTP Domain -sun-sr-http 6480/udp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# HTTP Domain -servicetags 6481/tcp # Service Tags [Peter_Schow] [Peter_Schow] 2007-01 -servicetags 6481/udp # Service Tags [Peter_Schow] [Peter_Schow] 2007-01 -ldoms-mgmt 6482/tcp # Logical Domains Management [Eric_Sharakan] [Eric_Sharakan] 2008-02-14 -# Interface -ldoms-mgmt 6482/udp # Logical Domains Management [Eric_Sharakan] [Eric_Sharakan] 2008-02-14 -# Interface -SunVTS-RMI 6483/tcp # SunVTS RMI [Sumit_Arora] [Sumit_Arora] 2007-06 -SunVTS-RMI 6483/udp # SunVTS RMI [Sumit_Arora] [Sumit_Arora] 2007-06 -sun-sr-jms 6484/tcp # Service Registry Default JMS [Paul_Sterk] [Paul_Sterk] 2006-03 -# Domain -sun-sr-jms 6484/udp # Service Registry Default JMS [Paul_Sterk] [Paul_Sterk] 2006-03 -# Domain -sun-sr-iiop 6485/tcp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# IIOP Domain -sun-sr-iiop 6485/udp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# IIOP Domain -sun-sr-iiops 6486/tcp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# IIOPS Domain -sun-sr-iiops 6486/udp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# IIOPS Domain -sun-sr-iiop-aut 6487/tcp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# IIOPAuth Domain -sun-sr-iiop-aut 6487/udp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# IIOPAuth Domain -sun-sr-jmx 6488/tcp # Service Registry Default JMX [Paul_Sterk] [Paul_Sterk] 2006-03 -# Domain -sun-sr-jmx 6488/udp # Service Registry Default JMX [Paul_Sterk] [Paul_Sterk] 2006-03 -# Domain -sun-sr-admin 6489/tcp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# Admin Domain -sun-sr-admin 6489/udp # Service Registry Default [Paul_Sterk] [Paul_Sterk] 2006-03 -# Admin Domain -# 6490-6499 Unassigned -boks 6500/tcp # BoKS Master [Magnus_Nystrom] [Magnus_Nystrom] -boks 6500/udp # BoKS Master [Magnus_Nystrom] [Magnus_Nystrom] -# BoKS Servc -# Known -boks-servc 6501/tcp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] Unauthorized -# well-formed service name as Use on port -# a replacement for 6501 -# "boks_servc". -# Known This entry is an alias to "boks-servc". This entry is now -boks_servc 6501/tcp # BoKS Servc [Magnus_Nystrom] [Magnus_Nystrom] Unauthorized historic, not usable for use with many common service -# Use on port discovery mechanisms. -# 6501 -# BoKS Servc -# -boks-servc 6501/udp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "boks_servc". -# This entry is an alias to "boks-servc". This entry is now -boks_servc 6501/udp # BoKS Servc [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Servm -# -boks-servm 6502/tcp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "boks_servm". -# This entry is an alias to "boks-servm". This entry is now -boks_servm 6502/tcp # BoKS Servm [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Servm -# -boks-servm 6502/udp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "boks_servm". -# This entry is an alias to "boks-servm". This entry is now -boks_servm 6502/udp # BoKS Servm [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Clntd -# -boks-clntd 6503/tcp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "boks_clntd". -# This entry is an alias to "boks-clntd". This entry is now -boks_clntd 6503/tcp # BoKS Clntd [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Clntd -# -boks-clntd 6503/udp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "boks_clntd". -# This entry is an alias to "boks-clntd". This entry is now -boks_clntd 6503/udp # BoKS Clntd [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# 6504 Unassigned -# BoKS Admin Private Port -# -badm-priv 6505/tcp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "badm_priv". -# This entry is an alias to "badm-priv". This entry is now -badm_priv 6505/tcp # BoKS Admin Private Port [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Admin Private Port -# -badm-priv 6505/udp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "badm_priv". -# This entry is an alias to "badm-priv". This entry is now -badm_priv 6505/udp # BoKS Admin Private Port [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Admin Public Port -# -badm-pub 6506/tcp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "badm_pub". -# This entry is an alias to "badm-pub". This entry is now -badm_pub 6506/tcp # BoKS Admin Public Port [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Admin Public Port -# -badm-pub 6506/udp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "badm_pub". -# This entry is an alias to "badm-pub". This entry is now -badm_pub 6506/udp # BoKS Admin Public Port [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Dir Server, Private -# Port -# -bdir-priv 6507/tcp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "bdir_priv". -# BoKS Dir Server, Private This entry is an alias to "bdir-priv". This entry is now -bdir_priv 6507/tcp # Port [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Dir Server, Private -# Port -# -bdir-priv 6507/udp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "bdir_priv". -# BoKS Dir Server, Private This entry is an alias to "bdir-priv". This entry is now -bdir_priv 6507/udp # Port [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Dir Server, Public Port -# -bdir-pub 6508/tcp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "bdir_pub". -# This entry is an alias to "bdir-pub". This entry is now -bdir_pub 6508/tcp # BoKS Dir Server, Public Port [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -# BoKS Dir Server, Public Port -# -bdir-pub 6508/udp # IANA assigned this [Magnus_Nystrom] [Magnus_Nystrom] -# well-formed service name as -# a replacement for -# "bdir_pub". -# This entry is an alias to "bdir-pub". This entry is now -bdir_pub 6508/udp # BoKS Dir Server, Public Port [Magnus_Nystrom] [Magnus_Nystrom] historic, not usable for use with many common service -# discovery mechanisms. -mgcs-mfp-port 6509/tcp # MGCS-MFP Port [Minoru_Ozaki] [Minoru_Ozaki] -mgcs-mfp-port 6509/udp # MGCS-MFP Port [Minoru_Ozaki] [Minoru_Ozaki] -mcer-port 6510/tcp # MCER Port [Portnoy_Boxman] [Portnoy_Boxman] -mcer-port 6510/udp # MCER Port [Portnoy_Boxman] [Portnoy_Boxman] -# 6511 tcp Reserved -# Datagram Congestion Control -dccp-udp 6511/udp # Protocol Encapsulation for [IESG] [IETF_Chair] [RFC6773] -# NAT Traversal -# 6512-6512 Unassigned -netconf-tls 6513/tcp # NETCONF over TLS [IESG] [IETF_Chair] 2015-04-15 [RFC7589] -# 6513 udp Reserved -syslog-tls 6514/tcp # Syslog over TLS [RFC5425] -syslog-tls 6514/udp # syslog over DTLS [RFC6012] -syslog-tls 6514/dccp # syslog over DTLS [RFC6012] -elipse-rec 6515/tcp # Elipse RPC Protocol [F_Englert] [F_Englert] 2007-09-17 -elipse-rec 6515/udp # Elipse RPC Protocol [F_Englert] [F_Englert] 2007-09-17 -# 6516-6542 Unassigned -lds-distrib 6543/tcp # lds_distrib [Jack_Baker] [Jack_Baker] 2003-06 -lds-distrib 6543/udp # lds_distrib [Jack_Baker] [Jack_Baker] 2003-06 -lds-dump 6544/tcp # LDS Dump Service [Jack_Baker] [Jack_Baker] 2006-02 -lds-dump 6544/udp # LDS Dump Service [Jack_Baker] [Jack_Baker] 2006-02 -# 6545-6546 Unassigned -apc-6547 6547/tcp # APC 6547 [American_Power_Conve] [American_Power_Conve] -apc-6547 6547/udp # APC 6547 [American_Power_Conve] [American_Power_Conve] -apc-6548 6548/tcp # APC 6548 [American_Power_Conve] [American_Power_Conve] -apc-6548 6548/udp # APC 6548 [American_Power_Conve] [American_Power_Conve] -apc-6549 6549/tcp # APC 6549 [American_Power_Conve] [American_Power_Conve] -apc-6549 6549/udp # APC 6549 [American_Power_Conve] [American_Power_Conve] -fg-sysupdate 6550/tcp # fg-sysupdate [Mark_Beyer] [Mark_Beyer] -fg-sysupdate 6550/udp # fg-sysupdate [Mark_Beyer] [Mark_Beyer] -sum 6551/tcp # Software Update Manager [Jan_Dirven] [Jan_Dirven] 2007-12-13 -sum 6551/udp # Software Update Manager [Jan_Dirven] [Jan_Dirven] 2007-12-13 -# 6552-6557 Unassigned -xdsxdm 6558/tcp # [Brian_Tackett] [Brian_Tackett] possible contact -xdsxdm 6558/udp # [Brian_Tackett] [Brian_Tackett] possible contact -# 6559-6565 Unassigned -sane-port 6566/tcp # SANE Control Port [Henning_Meier_Geinit] [Henning_Meier_Geinit] 2002-10 -sane-port 6566/udp # SANE Control Port [Henning_Meier_Geinit] [Henning_Meier_Geinit] 2002-10 -# 6567 Reserved 2007-01 2011-08-26 This entry has been removed on 2011-08-26. -# CanIt Storage Manager -# -canit-store 6568/tcp # IANA assigned this [David_F_Skoll] [David_F_Skoll] 2009-04-22 -# well-formed service name as -# a replacement for -# "canit_store". -# This entry is an alias to "canit-store". This entry is now -canit_store 6568/tcp # CanIt Storage Manager [David_F_Skoll] [David_F_Skoll] 2009-04-22 historic, not usable for use with many common service -# discovery mechanisms. -rp-reputation 6568/udp # Roaring Penguin IP Address [David_F_Skoll] [David_F_Skoll] 2010-02-05 -# Reputation Collection -# 6569-6578 Unassigned -affiliate 6579/tcp # Affiliate [David_Catmull] [David_Catmull] 2006-01 -affiliate 6579/udp # Affiliate [David_Catmull] [David_Catmull] 2006-01 -parsec-master 6580/tcp # Parsec Masterserver [Andreas_Varga] [Andreas_Varga] -parsec-master 6580/udp # Parsec Masterserver [Andreas_Varga] [Andreas_Varga] -parsec-peer 6581/tcp # Parsec Peer-to-Peer [Andreas_Varga] [Andreas_Varga] -parsec-peer 6581/udp # Parsec Peer-to-Peer [Andreas_Varga] [Andreas_Varga] -parsec-game 6582/tcp # Parsec Gameserver [Andreas_Varga] [Andreas_Varga] -parsec-game 6582/udp # Parsec Gameserver [Andreas_Varga] [Andreas_Varga] -joaJewelSuite 6583/tcp # JOA Jewel Suite [Bob_Rundle] [Bob_Rundle] 2005-11 -joaJewelSuite 6583/udp # JOA Jewel Suite [Bob_Rundle] [Bob_Rundle] 2005-11 -# 6584-6587 Unassigned -# Unofficial -# use of port -# 6588 Unassigned 6588 by -# AnalogX and -# Microsoft -# 6589-6599 Unassigned -mshvlm 6600/tcp # Microsoft Hyper-V Live [Rajesh_D] [Rajesh_D] 2009-02-03 -# Migration -# 6600 udp Reserved -mstmg-sstp 6601/tcp # Microsoft Threat Management [Ori_Yosefi] [Ori_Yosefi] 2009-05-04 -# Gateway SSTP -# 6601 udp Reserved -wsscomfrmwk 6602/tcp # Windows WSS Communication [Rong_Yu] [Rong_Yu] 2010-08-10 -# Framework -# 6602 udp Reserved -# 6603-6618 Unassigned -odette-ftps 6619/tcp # ODETTE-FTP over TLS/SSL [Ieuan_Friend] [Ieuan_Friend] 2006-03 [RFC5024] -odette-ftps 6619/udp # ODETTE-FTP over TLS/SSL [Ieuan_Friend] [Ieuan_Friend] 2006-03 [RFC5024] -kftp-data 6620/tcp # Kerberos V5 FTP Data [Robert_J_Scott] [Robert_J_Scott] 2005-08 -kftp-data 6620/udp # Kerberos V5 FTP Data [Robert_J_Scott] [Robert_J_Scott] 2005-08 -kftp 6621/tcp # Kerberos V5 FTP Control [Robert_J_Scott] [Robert_J_Scott] 2005-08 -kftp 6621/udp # Kerberos V5 FTP Control [Robert_J_Scott] [Robert_J_Scott] 2005-08 -mcftp 6622/tcp # Multicast FTP [Bruce_Lueckenhoff_2] [Bruce_Lueckenhoff_2] 2006-02 -mcftp 6622/udp # Multicast FTP [Bruce_Lueckenhoff_2] [Bruce_Lueckenhoff_2] 2006-02 -ktelnet 6623/tcp # Kerberos V5 Telnet [Robert_J_Scott] [Robert_J_Scott] 2005-08 -ktelnet 6623/udp # Kerberos V5 Telnet [Robert_J_Scott] [Robert_J_Scott] 2005-08 -datascaler-db 6624/tcp # DataScaler database [Vasu_Murthy] [Vasu_Murthy] 2010-02-08 -# 6624 udp Reserved -datascaler-ctl 6625/tcp # DataScaler control [Vasu_Murthy] [Vasu_Murthy] 2010-02-08 -# 6625 udp Reserved -wago-service 6626/tcp # WAGO Service and Update [Wolfgang_Adler] [Wolfgang_Adler] 2006-04 -wago-service 6626/udp # WAGO Service and Update [Wolfgang_Adler] [Wolfgang_Adler] 2006-04 -nexgen 6627/tcp # Allied Electronics NeXGen [Lou_Seitchik] [Lou_Seitchik] 2005-08 -nexgen 6627/udp # Allied Electronics NeXGen [Lou_Seitchik] [Lou_Seitchik] 2005-08 -afesc-mc 6628/tcp # AFE Stock Channel M/C [K_K_Ho] [K_K_Ho] 2004-04 -afesc-mc 6628/udp # AFE Stock Channel M/C [K_K_Ho] [K_K_Ho] 2004-04 -# 6629-6630 Unassigned -# 6631 Unassigned 2004-05-28 -# Unauthorized -mxodbc-connect 6632/tcp # eGenix mxODBC Connect [Marc_Andre_Lemburg] [Marc_Andre_Lemburg] 2009-11-13 Use Known on -# port 6632 -# 6632 udp Reserved -# 6633 tcp Reserved -cisco-vpath-tun 6633/udp # Cisco vPath Services Overlay [Cisco2] [Surendra_Kumar] 2012-06-11 -mpls-pm 6634/udp # MPLS Performance Measurement [Cisco_Systems_2] [Sagar_Soni] 2014-02-20 -# out-of-band response -# 6634 tcp Reserved -# 6635 tcp Reserved -mpls-udp 6635/udp # Encapsulate MPLS packets in [IESG] [IETF_Chair] 2015-02-10 [RFC7510] -# UDP tunnels. -# 6636 tcp Reserved -mpls-udp-dtls 6636/udp # Encapsulate MPLS packets in [IESG] [IETF_Chair] 2015-02-10 [RFC7510] -# UDP tunnels with DTLS. -# 6637-6639 Unassigned -ovsdb 6640/tcp # Open vSwitch Database [Bruce_Davie_2] [Bruce_Davie_2] 2013-07-31 [RFC7047] -# protocol -# 6640 udp Reserved -# 6641-6652 Unassigned -openflow 6653/tcp # OpenFlow [Open_Networking_Foundation] [Puneet_Agarwal] 2013-07-18 -openflow 6653/udp # OpenFlow [Open_Networking_Foundation] [Puneet_Agarwal] 2013-07-18 -# 6654 Unassigned -pcs-sf-ui-man 6655/tcp # PC SOFT - Software factory [Jerome_AERTS] [Jerome_AERTS] 2010-11-30 -# UI/manager -# 6655 udp Reserved -emgmsg 6656/tcp # Emergency Message Control [Gerry_Gorman] [Gerry_Gorman] 2010-12-06 -# Service -# 6656 udp Reserved -# 6657 tcp Reserved -palcom-disc 6657/udp # PalCom Discovery [Boris_Magnusson] [Boris_Magnusson] 2010-12-06 -# Unauthorized -# 6658-6664 Unassigned Use Known on -# Port 6659 -ircu 6665/tcp # IRCU [Brian_Tackett] [Brian_Tackett] -# 6665-6669 udp Reserved -vocaltec-gold 6670/tcp # Vocaltec Global Online [Scott_Petrack] [Scott_Petrack] -# Directory -vocaltec-gold 6670/udp # Vocaltec Global Online [Scott_Petrack] [Scott_Petrack] -# Directory -p4p-portal 6671/tcp # P4P Portal Service [Chris_Griffiths] [Chris_Griffiths] 2008-07-28 -p4p-portal 6671/udp # P4P Portal Service [Chris_Griffiths] [Chris_Griffiths] 2008-07-28 -# vision_server -# -vision-server 6672/tcp # IANA assigned this [Chris_Kramer] [Chris_Kramer] -# well-formed service name as -# a replacement for -# "vision_server". -# This entry is an alias to "vision-server". This entry is now -vision_server 6672/tcp # vision_server [Chris_Kramer] [Chris_Kramer] historic, not usable for use with many common service -# discovery mechanisms. -# vision_server -# -vision-server 6672/udp # IANA assigned this [Chris_Kramer] [Chris_Kramer] -# well-formed service name as -# a replacement for -# "vision_server". -# This entry is an alias to "vision-server". This entry is now -vision_server 6672/udp # vision_server [Chris_Kramer] [Chris_Kramer] historic, not usable for use with many common service -# discovery mechanisms. -# vision_elmd -# -vision-elmd 6673/tcp # IANA assigned this [Chris_Kramer] [Chris_Kramer] -# well-formed service name as -# a replacement for -# "vision_elmd". -# This entry is an alias to "vision-elmd". This entry is now -vision_elmd 6673/tcp # vision_elmd [Chris_Kramer] [Chris_Kramer] historic, not usable for use with many common service -# discovery mechanisms. -# vision_elmd -# -vision-elmd 6673/udp # IANA assigned this [Chris_Kramer] [Chris_Kramer] -# well-formed service name as -# a replacement for -# "vision_elmd". -# This entry is an alias to "vision-elmd". This entry is now -vision_elmd 6673/udp # vision_elmd [Chris_Kramer] [Chris_Kramer] historic, not usable for use with many common service -# discovery mechanisms. -# 6674-6677 Unassigned -vfbp 6678/tcp # Viscount Freedom Bridge [Chris_MacDonald] [Chris_MacDonald] 2011-03-16 -# Protocol -vfbp-disc 6678/udp # Viscount Freedom Bridge [Chris_MacDonald] [Chris_MacDonald] 2011-03-16 -# Discovery -osaut 6679/tcp # Osorno Automation [Peter_Hombach] [Peter_Hombach] 2011-03-16 -osaut 6679/udp # Osorno Automation [Peter_Hombach] [Peter_Hombach] 2011-03-16 -# 6680-6686 Unassigned -clever-ctrace 6687/tcp # CleverView for cTrace [David_Cheng] [David_Cheng] 2010-02-01 -# Message Service -# 6687 udp Reserved -clever-tcpip 6688/tcp # CleverView for TCP/IP [David_Cheng] [David_Cheng] 2009-10-13 -# Message Service -# 6688 udp Reserved -tsa 6689/tcp # Tofino Security Appliance [Scott_Howard] [Scott_Howard] 2009-10-13 -tsa 6689/udp # Tofino Security Appliance [Scott_Howard] [Scott_Howard] 2009-10-13 -cleverdetect 6690/tcp # CLEVERDetect Message Service [Applied_Expert_Systems_Inc] [David_Cheng] 2014-12-03 -# 6690 udp Reserved -# 6691-6695 Unassigned -# 6696 tcp Reserved -babel 6696/udp # Babel Routing Protocol 2011-08-15 [RFC6126] -ircs-u 6697/tcp # Internet Relay Chat via 2014-02-11 [RFC7194] -# TLS/SSL -# 6697 udp Reserved 2014-02-11 -# 6698-6699 Unassigned -# 6700 Unassigned 2010-01-26 -kti-icad-srvr 6701/tcp # KTI/ICAD Nameserver [Stanley_Knutson] [Stanley_Knutson] -kti-icad-srvr 6701/udp # KTI/ICAD Nameserver [Stanley_Knutson] [Stanley_Knutson] -# 6701 sctp Unassigned 2010-01-26 -e-design-net 6702/tcp # e-Design network [Janos_Lerch] [Janos_Lerch] 2006-02 -e-design-net 6702/udp # e-Design network [Janos_Lerch] [Janos_Lerch] 2006-02 -# 6702 sctp Unassigned 2010-01-26 -e-design-web 6703/tcp # e-Design web [Janos_Lerch] [Janos_Lerch] 2006-02 -e-design-web 6703/udp # e-Design web [Janos_Lerch] [Janos_Lerch] 2006-02 -# 6704 udp Reserved -# 6704 tcp Reserved -frc-hp 6704/sctp # ForCES HP (High Priority) [RFC5811] -# channel -# 6705 udp Reserved -# 6705 tcp Reserved -frc-mp 6705/sctp # ForCES MP (Medium Priority) [RFC5811] -# channel -# 6706 udp Reserved -# 6706 tcp Reserved -frc-lp 6706/sctp # ForCES LP (Low priority) [RFC5811] -# channel -# 6707-6713 Unassigned -ibprotocol 6714/tcp # Internet Backplane Protocol [Alessandro_Bassi] [Alessandro_Bassi] -ibprotocol 6714/udp # Internet Backplane Protocol [Alessandro_Bassi] [Alessandro_Bassi] -fibotrader-com 6715/tcp # Fibotrader Communications [Robert_Wetzold] [Robert_Wetzold] 2006-01 -fibotrader-com 6715/udp # Fibotrader Communications [Robert_Wetzold] [Robert_Wetzold] 2006-01 -princity-agent 6716/tcp # Princity Agent [ENSTEAM_Sp_z.o.o.] [Tomasz_Krakowiak] 2014-07-07 2015-07-08 -# 6716 udp Reserved -# 6717-6766 Unassigned -bmc-perf-agent 6767/tcp # BMC PERFORM AGENT [Portnoy_Boxman] [Portnoy_Boxman] -bmc-perf-agent 6767/udp # BMC PERFORM AGENT [Portnoy_Boxman] [Portnoy_Boxman] -bmc-perf-mgrd 6768/tcp # BMC PERFORM MGRD [Portnoy_Boxman] [Portnoy_Boxman] -bmc-perf-mgrd 6768/udp # BMC PERFORM MGRD [Portnoy_Boxman] [Portnoy_Boxman] -adi-gxp-srvprt 6769/tcp # ADInstruments GxP Server [Mathew_Pitchforth] [Mathew_Pitchforth] 2005-08 -adi-gxp-srvprt 6769/udp # ADInstruments GxP Server [Mathew_Pitchforth] [Mathew_Pitchforth] 2005-08 -plysrv-http 6770/tcp # PolyServe http [Mike_Spitzer] [Mike_Spitzer] 2005-08 -plysrv-http 6770/udp # PolyServe http [Mike_Spitzer] [Mike_Spitzer] 2005-08 -plysrv-https 6771/tcp # PolyServe https [Mike_Spitzer] [Mike_Spitzer] 2005-08 -plysrv-https 6771/udp # PolyServe https [Mike_Spitzer] [Mike_Spitzer] 2005-08 -# 6772-6776 Unassigned -ntz-tracker 6777/tcp # netTsunami Tracker [Tomahawk_Holdings] [Sagara_Wijetunga] 2013-05-01 -# 6777 udp Reserved -ntz-p2p-storage 6778/tcp # netTsunami p2p storage [Tomahawk_Holdings] [Sagara_Wijetunga] 2013-05-01 -# system -# 6778 udp Reserved -# 6779-6783 Unassigned -# 6784 tcp Reserved -# Bidirectional Forwarding -bfd-lag 6784/udp # Detection (BFD) on Link [IESG] [BFD_Chairs] 2012-11-08 2014-01-09 [RFC7130] -# Aggregation Group (LAG) -# Interfaces -dgpf-exchg 6785/tcp # DGPF Individual Exchange [Thomas_Weise] [Thomas_Weise] 2006-04 -dgpf-exchg 6785/udp # DGPF Individual Exchange [Thomas_Weise] [Thomas_Weise] 2006-04 -smc-jmx 6786/tcp # Sun Java Web Console JMX [Bill_Edwards] [Bill_Edwards] 2005-08 -smc-jmx 6786/udp # Sun Java Web Console JMX [Bill_Edwards] [Bill_Edwards] 2005-08 -smc-admin 6787/tcp # Sun Web Console Admin [Bill_Edwards] [Bill_Edwards] 2005-08 -smc-admin 6787/udp # Sun Web Console Admin [Bill_Edwards] [Bill_Edwards] 2005-08 -smc-http 6788/tcp # SMC-HTTP [Ratnadeep_Bhattachar] [Ratnadeep_Bhattachar] 2002-11 -smc-http 6788/udp # SMC-HTTP [Ratnadeep_Bhattachar] [Ratnadeep_Bhattachar] 2002-11 -smc-https 6789/tcp # SMC-HTTPS [Ratnadeep_Bhattachar] [Ratnadeep_Bhattachar] 2002-08 -smc-https 6789/udp # SMC-HTTPS [Ratnadeep_Bhattachar] [Ratnadeep_Bhattachar] 2002-08 -hnmp 6790/tcp # HNMP [Jude_George] [Jude_George] -hnmp 6790/udp # HNMP [Jude_George] [Jude_George] -hnm 6791/tcp # Halcyon Network Manager [Richard_Harriss] [Richard_Harriss] 2005-05 -hnm 6791/udp # Halcyon Network Manager [Richard_Harriss] [Richard_Harriss] 2005-05 -# 6792-6800 Unassigned -acnet 6801/tcp # ACNET Control System [Rich_Neswold] [Rich_Neswold] 2007-02 -# Protocol -acnet 6801/udp # ACNET Control System [Rich_Neswold] [Rich_Neswold] 2007-02 -# Protocol -# 6802-6816 Unassigned -pentbox-sim 6817/tcp # PenTBox Secure IM Protocol [Alberto_Ortega_Llama] [Alberto_Ortega_Llama] 2009-11-04 -# 6817 udp Reserved -# 6818-6830 Unassigned -ambit-lm 6831/tcp # ambit-lm [Don_Hejna] [Don_Hejna] -ambit-lm 6831/udp # ambit-lm [Don_Hejna] [Don_Hejna] -# 6832-6840 Unassigned -netmo-default 6841/tcp # Netmo Default [Urs_Bertschinger] [Urs_Bertschinger] -netmo-default 6841/udp # Netmo Default [Urs_Bertschinger] [Urs_Bertschinger] -netmo-http 6842/tcp # Netmo HTTP [Urs_Bertschinger] [Urs_Bertschinger] -netmo-http 6842/udp # Netmo HTTP [Urs_Bertschinger] [Urs_Bertschinger] -# 6843-6849 Unassigned -iccrushmore 6850/tcp # ICCRUSHMORE [Dave_Hubbard] [Dave_Hubbard] -iccrushmore 6850/udp # ICCRUSHMORE [Dave_Hubbard] [Dave_Hubbard] -# 6851-6867 Unassigned -acctopus-cc 6868/tcp # Acctopus Command Channel [Stefan_Auweiler] [Stefan_Auweiler] 2009-11-16 -acctopus-st 6868/udp # Acctopus Status [Stefan_Auweiler] [Stefan_Auweiler] 2009-11-16 -# 6869-6887 Unassigned -muse 6888/tcp # MUSE [Muse_Communications] [Muse_Communications] -muse 6888/udp # MUSE [Muse_Communications] [Muse_Communications] -# 6889-6900 Unassigned -jetstream 6901/tcp # Novell Jetstream messaging [Anil_Tyagi] [Anil_Tyagi] 2010-06-11 -# protocol -# 6901 udp Reserved -# 6902-6934 Unassigned -ethoscan 6935/tcp # EthoScan Service [Marty_Campbell] [Marty_Campbell] 2011-06-10 -ethoscan 6935/udp # EthoScan Service [Marty_Campbell] [Marty_Campbell] 2011-06-10 -xsmsvc 6936/tcp # XenSource Management Service [Roger_Klorese] [Roger_Klorese] 2006-06 -xsmsvc 6936/udp # XenSource Management Service [Roger_Klorese] [Roger_Klorese] 2006-06 -# 6937-6945 Unassigned -bioserver 6946/tcp # Biometrics Server [ISHII_AKIO] [ISHII_AKIO] 2006-01 -bioserver 6946/udp # Biometrics Server [ISHII_AKIO] [ISHII_AKIO] 2006-01 -# 6947-6950 Unassigned -otlp 6951/tcp # OTLP [Brent_Foster] [Brent_Foster] 2006-04 -otlp 6951/udp # OTLP [Brent_Foster] [Brent_Foster] 2006-04 -# 6952-6960 Unassigned -jmact3 6961/tcp # JMACT3 [Yutaka_Ono] [Yutaka_Ono] -jmact3 6961/udp # JMACT3 [Yutaka_Ono] [Yutaka_Ono] -jmevt2 6962/tcp # jmevt2 [Yutaka_Ono] [Yutaka_Ono] -jmevt2 6962/udp # jmevt2 [Yutaka_Ono] [Yutaka_Ono] -swismgr1 6963/tcp # swismgr1 [Yutaka_Ono] [Yutaka_Ono] -swismgr1 6963/udp # swismgr1 [Yutaka_Ono] [Yutaka_Ono] -swismgr2 6964/tcp # swismgr2 [Yutaka_Ono] [Yutaka_Ono] -swismgr2 6964/udp # swismgr2 [Yutaka_Ono] [Yutaka_Ono] -swistrap 6965/tcp # swistrap [Yutaka_Ono] [Yutaka_Ono] -swistrap 6965/udp # swistrap [Yutaka_Ono] [Yutaka_Ono] -swispol 6966/tcp # swispol [Yutaka_Ono] [Yutaka_Ono] -swispol 6966/udp # swispol [Yutaka_Ono] [Yutaka_Ono] -# 6967-6968 Unassigned -acmsoda 6969/tcp # acmsoda [Daniel_Simms] [Daniel_Simms] -acmsoda 6969/udp # acmsoda [Daniel_Simms] [Daniel_Simms] -conductor 6970/tcp # Conductor test coordination [George_Neville-Neil] [George_Neville-Neil] 2014-09-18 -# protocol -# 6970 udp Reserved -conductor-mpx 6970/sctp # conductor for multiplex [George_Neville-Neil] [George_Neville-Neil] 2014-07-29 -# 6971-6996 Unassigned -MobilitySrv 6997/tcp # Mobility XE Protocol [Joseph_T_Savarese] [Joseph_T_Savarese] 2007-06 -MobilitySrv 6997/udp # Mobility XE Protocol [Joseph_T_Savarese] [Joseph_T_Savarese] 2007-06 -iatp-highpri 6998/tcp # IATP-highPri [John_Murphy] [John_Murphy] -iatp-highpri 6998/udp # IATP-highPri [John_Murphy] [John_Murphy] -iatp-normalpri 6999/tcp # IATP-normalPri [John_Murphy] [John_Murphy] -iatp-normalpri 6999/udp # IATP-normalPri [John_Murphy] [John_Murphy] -afs3-fileserver 7000/tcp # file server itself -afs3-fileserver 7000/udp # file server itself -# Known -afs3-callback 7001/tcp # callbacks to cache managers Unauthorized -# Use on port -# 7001 -# Known -afs3-callback 7001/udp # callbacks to cache managers Unauthorized -# Use on port -# 7001 -# Known -afs3-prserver 7002/tcp # users & groups database Unauthorized -# Use on port -# 7002 -# Known -afs3-prserver 7002/udp # users & groups database Unauthorized -# Use on port -# 7002 -afs3-vlserver 7003/tcp # volume location database -afs3-vlserver 7003/udp # volume location database -afs3-kaserver 7004/tcp # AFS/Kerberos authentication -# service -afs3-kaserver 7004/udp # AFS/Kerberos authentication -# service -# Known -afs3-volser 7005/tcp # volume managment server Unauthorized -# Use on port -# 7005 -# Known -afs3-volser 7005/udp # volume managment server Unauthorized -# Use on port -# 7005 -afs3-errors 7006/tcp # error interpretation service -afs3-errors 7006/udp # error interpretation service -afs3-bos 7007/tcp # basic overseer process -afs3-bos 7007/udp # basic overseer process -afs3-update 7008/tcp # server-to-server updater -afs3-update 7008/udp # server-to-server updater -afs3-rmtsys 7009/tcp # remote cache manager service -afs3-rmtsys 7009/udp # remote cache manager service -ups-onlinet 7010/tcp # onlinet uninterruptable [Jim_Thompson] [Jim_Thompson] -# power supplies -ups-onlinet 7010/udp # onlinet uninterruptable [Jim_Thompson] [Jim_Thompson] -# power supplies -# Known -talon-disc 7011/tcp # Talon Discovery Port [Jim_Thompson] [Jim_Thompson] Unauthorized -# Use on 7011 -# Known -talon-disc 7011/udp # Talon Discovery Port [Jim_Thompson] [Jim_Thompson] Unauthorized -# Use on 7011 -# Known -talon-engine 7012/tcp # Talon Engine [Jim_Thompson] [Jim_Thompson] Unauthorized -# Use on 7011 -# Known -talon-engine 7012/udp # Talon Engine [Jim_Thompson] [Jim_Thompson] Unauthorized -# Use on 7011 -microtalon-dis 7013/tcp # Microtalon Discovery [Jim_Thompson] [Jim_Thompson] -microtalon-dis 7013/udp # Microtalon Discovery [Jim_Thompson] [Jim_Thompson] -microtalon-com 7014/tcp # Microtalon Communications [Jim_Thompson] [Jim_Thompson] -microtalon-com 7014/udp # Microtalon Communications [Jim_Thompson] [Jim_Thompson] -talon-webserver 7015/tcp # Talon Webserver [Jim_Thompson] [Jim_Thompson] -talon-webserver 7015/udp # Talon Webserver [Jim_Thompson] [Jim_Thompson] -# 7016-7017 Unassigned -fisa-svc 7018/tcp # FISA Service [FAUCONNET_Ingenierie] [FAUCONNET_Ingenierie] 2011-05-19 -# 7018 udp Reserved -doceri-ctl 7019/tcp # doceri drawing service [Paul_Brown] [Paul_Brown] 2011-04-27 -# control -doceri-view 7019/udp # doceri drawing service [Paul_Brown] [Paul_Brown] 2011-04-27 -# screen view -dpserve 7020/tcp # DP Serve [Allan_Stanley] [Allan_Stanley] -dpserve 7020/udp # DP Serve [Allan_Stanley] [Allan_Stanley] -dpserveadmin 7021/tcp # DP Serve Admin [Allan_Stanley] [Allan_Stanley] -dpserveadmin 7021/udp # DP Serve Admin [Allan_Stanley] [Allan_Stanley] -ctdp 7022/tcp # CT Discovery Protocol [James_Kirkwood] [James_Kirkwood] 2005-06 -ctdp 7022/udp # CT Discovery Protocol [James_Kirkwood] [James_Kirkwood] 2005-06 -ct2nmcs 7023/tcp # Comtech T2 NMCS [Bryan_Wilcutt] [Bryan_Wilcutt] 2005-06 -ct2nmcs 7023/udp # Comtech T2 NMCS [Bryan_Wilcutt] [Bryan_Wilcutt] 2005-06 -vmsvc 7024/tcp # Vormetric service [Tom_Boyle] [Tom_Boyle] 2005-06 -vmsvc 7024/udp # Vormetric service [Tom_Boyle] [Tom_Boyle] 2005-06 -vmsvc-2 7025/tcp # Vormetric Service II [Tom_Boyle] [Tom_Boyle] 2005-06 -vmsvc-2 7025/udp # Vormetric Service II [Tom_Boyle] [Tom_Boyle] 2005-06 -# 7026-7029 Unassigned -op-probe 7030/tcp # ObjectPlanet probe [Bjorn_Jarle_Kvande] [Bjorn_Jarle_Kvande] 2002-04 -op-probe 7030/udp # ObjectPlanet probe [Bjorn_Jarle_Kvande] [Bjorn_Jarle_Kvande] 2002-04 -iposplanet 7031/tcp # IPOSPLANET retailing multi [Fabrice_Paget] [Fabrice_Paget] 2012-10-23 -# devices protocol -# 7031 udp Reserved -# 7032-7039 Unassigned -# 7040 tcp Reserved -quest-disc 7040/udp # Quest application level [Quest_Software] [Henrik_Johnson] 2012-04-09 -# network service discovery -# 7041-7069 Unassigned -arcp 7070/tcp # ARCP [Jude_George] [Jude_George] -arcp 7070/udp # ARCP [Jude_George] [Jude_George] -iwg1 7071/tcp # IWGADTS Aircraft [Don_Sullivan] [Don_Sullivan] 2010-02-16 -# Housekeeping Message -iwg1 7071/udp # IWGADTS Aircraft [Don_Sullivan] [Don_Sullivan] 2010-02-16 -# Housekeeping Message -# 7072 Unassigned -martalk 7073/tcp # MarTalk protocol [Mahr_GmbH_Göttingen] [Kevin_Bube] 2013-09-02 -# 7073 udp Reserved -# 7074-7079 Unassigned -empowerid 7080/tcp # EmpowerID Communication [Matthew_Whited] [Matthew_Whited] 2008-01-16 -empowerid 7080/udp # EmpowerID Communication [Matthew_Whited] [Matthew_Whited] 2008-01-16 -# 7081-7094 Unassigned -jdp-disc 7095/udp # Java Discovery Protocol [OpenJDK] [Florian_Weimer] 2013-03-12 -# 7095 tcp Reserved -# 7096-7098 Unassigned -lazy-ptop 7099/tcp # lazy-ptop [Guy_Keren] [Guy_Keren] -lazy-ptop 7099/udp # lazy-ptop [Guy_Keren] [Guy_Keren] -font-service 7100/tcp # X Font Service [Stephen_Gildea] [Stephen_Gildea] -font-service 7100/udp # X Font Service [Stephen_Gildea] [Stephen_Gildea] -elcn 7101/tcp # Embedded Light Control [Michael_Scarito] [Michael_Scarito] 2007-02 -# Network -elcn 7101/udp # Embedded Light Control [Michael_Scarito] [Michael_Scarito] 2007-02 -# Network -# 7102-7106 Unassigned -# 7107 tcp Reserved -aes-x170 7107/udp # AES-X170 [Richard_Foss] [Richard_Foss] 2011-02-10 -# 7108-7120 Unassigned -virprot-lm 7121/tcp # Virtual Prototypes License [Victor_Galis] [Victor_Galis] -# Manager -virprot-lm 7121/udp # Virtual Prototypes License [Victor_Galis] [Victor_Galis] -# Manager -# 7122-7127 Unassigned -scenidm 7128/tcp # intelligent data manager [Paul_Ignatius] [Paul_Ignatius] 2006-03 -scenidm 7128/udp # intelligent data manager [Paul_Ignatius] [Paul_Ignatius] 2006-03 -scenccs 7129/tcp # Catalog Content Search [Anil_Sharma] [Anil_Sharma] 2006-04 -scenccs 7129/udp # Catalog Content Search [Anil_Sharma] [Anil_Sharma] 2006-04 -# 7130-7160 Unassigned -cabsm-comm 7161/tcp # CA BSM Comm [Chun_Ho_Chang] [Chun_Ho_Chang] 2004-11 -cabsm-comm 7161/udp # CA BSM Comm [Chun_Ho_Chang] [Chun_Ho_Chang] 2004-11 -caistoragemgr 7162/tcp # CA Storage Manager [Emre_Tunar] [Emre_Tunar] 2004-11 -caistoragemgr 7162/udp # CA Storage Manager [Emre_Tunar] [Emre_Tunar] 2004-11 -cacsambroker 7163/tcp # CA Connection Broker [David_Roberts] [David_Roberts] 2005-05 -cacsambroker 7163/udp # CA Connection Broker [David_Roberts] [David_Roberts] 2005-05 -fsr 7164/tcp # File System Repository Agent [Micha_Ben_Efraim] [Micha_Ben_Efraim] 2007-07-19 -fsr 7164/udp # File System Repository Agent [Micha_Ben_Efraim] [Micha_Ben_Efraim] 2007-07-19 -doc-server 7165/tcp # Document WCF Server [Micha_Ben_Efraim] [Micha_Ben_Efraim] 2008-01-07 -doc-server 7165/udp # Document WCF Server [Micha_Ben_Efraim] [Micha_Ben_Efraim] 2008-01-07 -aruba-server 7166/tcp # Aruba eDiscovery Server [Micha_Ben_Efraim] [Micha_Ben_Efraim] 2008-01-07 -aruba-server 7166/udp # Aruba eDiscovery Server [Micha_Ben_Efraim] [Micha_Ben_Efraim] 2008-01-07 -casrmagent 7167/tcp # CA SRM Agent [Venkata_Krishna] [Venkata_Krishna] 2010-02-24 -# 7167 udp Reserved -cnckadserver 7168/tcp # cncKadServer DB & Inventory [Micha_Ben_Efraim_2] [Micha_Ben_Efraim_2] 2011-01-31 -# Services -# 7168 udp Reserved -ccag-pib 7169/tcp # Consequor Consulting Process [Frank_Goenninger] [Frank_Goenninger] 2010-02-22 -# Integration Bridge -ccag-pib 7169/udp # Consequor Consulting Process [Frank_Goenninger] [Frank_Goenninger] 2010-02-22 -# Integration Bridge -nsrp 7170/tcp # Adaptive Name/Service [Geoff_Back_2] [Geoff_Back_2] 2010-02-01 -# Resolution -nsrp 7170/udp # Adaptive Name/Service [Geoff_Back_2] [Geoff_Back_2] 2010-02-01 -# Resolution -drm-production 7171/tcp # Discovery and Retention Mgt [Micha_Ben_Efraim_3] [Micha_Ben_Efraim_3] 2010-02-18 -# Production -drm-production 7171/udp # Discovery and Retention Mgt [Micha_Ben_Efraim_3] [Micha_Ben_Efraim_3] 2010-02-18 -# Production -metalbend 7172/tcp # Port used for MetalBend [Micha_Ben_Efraim_4] [Micha_Ben_Efraim_4] 2012-11-27 -# programmable interface -# 7172 udp Reserved -zsecure 7173/tcp # zSecure Server [Hans_Schoone] [Hans_Schoone] 2010-10-01 -# 7173 udp Reserved -clutild 7174/tcp # Clutild [Cheryl_Stoutenburg] [Cheryl_Stoutenburg] -clutild 7174/udp # Clutild [Cheryl_Stoutenburg] [Cheryl_Stoutenburg] -# 7175-7180 Unassigned -janus-disc 7181/udp # Janus Guidewire Enterprise [Guidewire_Software_Inc] [Luca_Debiasi] 2014-02-06 -# Discovery Service Bus -# 7181 tcp Reserved -# 7182-7199 Unassigned -fodms 7200/tcp # FODMS FLIP [David_Anthony] [David_Anthony] -fodms 7200/udp # FODMS FLIP [David_Anthony] [David_Anthony] -dlip 7201/tcp # DLIP [Albert_Manfredi] [Albert_Manfredi] -dlip 7201/udp # DLIP [Albert_Manfredi] [Albert_Manfredi] -# 7202-7226 Unassigned -ramp 7227/tcp # Registry A & M Protocol [John_Havard] [John_Havard] 2003-11 -ramp 7227/udp # Registry A $ M Protocol [John_Havard] [John_Havard] 2003-11 -citrixupp 7228/tcp # Citrix Universal Printing [Gary_Barton] [Gary_Barton] 2011-02-24 -# Port -# 7228 udp Reserved -citrixuppg 7229/tcp # Citrix UPP Gateway [Gary_Barton] [Gary_Barton] 2011-02-24 -# 7229 udp Reserved -# 7230-7234 Unassigned -aspcoordination 7235/udp # ASP Coordination Protocol [Wi-Fi_Alliance_2] [Mick_Conley] 2013-12-31 -# 7235 tcp Reserved -display 7236/tcp # Wi-Fi Alliance Wi-Fi Display [Wi-Fi_Alliance] [Thomas_Sciorilli] 2012-04-09 Defined TXT keys: _display.tcp. Display Protocol -# Protocol -# 7236 udp Reserved -pads 7237/tcp # PADS (Public Area Display [Willie_Jan_Bons] [Willie_Jan_Bons] 2011-03-10 -# System) Server -# 7237 udp Reserved -# 7238-7261 Unassigned -cnap 7262/tcp # Calypso Network Access [Scott_Halberg] [Scott_Halberg] 2009-06-02 -# Protocol -cnap 7262/udp # Calypso Network Access [Scott_Halberg] [Scott_Halberg] 2009-06-02 -# Protocol -# 7263-7271 Unassigned -watchme-7272 7272/tcp # WatchMe Monitoring 7272 [Oliver_Heinz] [Oliver_Heinz] 2005-08 -watchme-7272 7272/udp # WatchMe Monitoring 7272 [Oliver_Heinz] [Oliver_Heinz] 2005-08 -oma-rlp 7273/tcp # OMA Roaming Location [Larry_A_Young] [Larry_A_Young] 2005-08 -oma-rlp 7273/udp # OMA Roaming Location [Larry_A_Young] [Larry_A_Young] 2005-08 -oma-rlp-s 7274/tcp # OMA Roaming Location SEC [Larry_A_Young] [Larry_A_Young] 2005-08 -oma-rlp-s 7274/udp # OMA Roaming Location SEC [Larry_A_Young] [Larry_A_Young] 2005-08 -oma-ulp 7275/tcp # OMA UserPlane Location [Larry_A_Young_2] [Larry_A_Young_2] 2006-02 -oma-ulp 7275/udp # OMA UserPlane Location [Larry_A_Young_2] [Larry_A_Young_2] 2006-02 -oma-ilp 7276/tcp # OMA Internal Location [Khiem_Tran] [Khiem_Tran] 2007-11-06 -# Protocol -oma-ilp 7276/udp # OMA Internal Location [Khiem_Tran] [Khiem_Tran] 2007-11-06 -# Protocol -oma-ilp-s 7277/tcp # OMA Internal Location Secure [Khiem_Tran] [Khiem_Tran] 2007-11-06 -# Protocol -oma-ilp-s 7277/udp # OMA Internal Location Secure [Khiem_Tran] [Khiem_Tran] 2007-11-06 -# Protocol -oma-dcdocbs 7278/tcp # OMA Dynamic Content Delivery [Avi_Primo] [Avi_Primo] 2008-01-29 -# over CBS -oma-dcdocbs 7278/udp # OMA Dynamic Content Delivery [Avi_Primo] [Avi_Primo] 2008-01-29 -# over CBS -ctxlic 7279/tcp # Citrix Licensing [Marc_Binstock] [Marc_Binstock] 2008-01-29 -ctxlic 7279/udp # Citrix Licensing [Marc_Binstock] [Marc_Binstock] 2008-01-29 -itactionserver1 7280/tcp # ITACTIONSERVER 1 [Brian_Taylor] [Brian_Taylor] -itactionserver1 7280/udp # ITACTIONSERVER 1 [Brian_Taylor] [Brian_Taylor] -itactionserver2 7281/tcp # ITACTIONSERVER 2 [Brian_Taylor] [Brian_Taylor] -itactionserver2 7281/udp # ITACTIONSERVER 2 [Brian_Taylor] [Brian_Taylor] -mzca-action 7282/tcp # eventACTION/ussACTION (MZCA) [Gord_Tomlin] [Gord_Tomlin] 2009-01-30 -# server -mzca-alert 7282/udp # eventACTION/ussACTION (MZCA) [Gord_Tomlin] [Gord_Tomlin] 2010-01-21 -# alert -genstat 7283/tcp # General Statistics [VSN_International_Ltd] [Sean_D_Sollé] 2011-09-28 -# Rendezvous Protocol -# 7283 udp Reserved -# 7284-7299 Unassigned -# swx 7300-7359 The Swiss Exchange [Edgar_Blum] [Edgar_Blum] -# 7360-7364 Unassigned 2006-02-06 -lcm-server 7365/tcp # LifeKeeper Communications [James_Bottomley] [James_Bottomley] 2006-02 -lcm-server 7365/udp # LifeKeeper Communications [James_Bottomley] [James_Bottomley] 2006-02 -# 7366-7390 Unassigned 2006-02-06 -mindfilesys 7391/tcp # mind-file system server [Dave_Porter] [Dave_Porter] -mindfilesys 7391/udp # mind-file system server [Dave_Porter] [Dave_Porter] -mrssrendezvous 7392/tcp # mrss-rendezvous server [Dave_Porter] [Dave_Porter] -mrssrendezvous 7392/udp # mrss-rendezvous server [Dave_Porter] [Dave_Porter] -nfoldman 7393/tcp # nFoldMan Remote Publish [Richard_McDonald] [Richard_McDonald] 2006-01 -nfoldman 7393/udp # nFoldMan Remote Publish [Richard_McDonald] [Richard_McDonald] 2006-01 -fse 7394/tcp # File system export of backup [Weibao_Wu] [Weibao_Wu] 2006-04 -# images -fse 7394/udp # File system export of backup [Weibao_Wu] [Weibao_Wu] 2006-04 -# images -winqedit 7395/tcp # winqedit [David_Greer] [David_Greer] -winqedit 7395/udp # winqedit [David_Greer] [David_Greer] -# 7396 Unassigned -hexarc 7397/tcp # Hexarc Command Language [George_Moromisato] [George_Moromisato] 2004-11 -hexarc 7397/udp # Hexarc Command Language [George_Moromisato] [George_Moromisato] 2004-11 -# 7398-7399 Unassigned -rtps-discovery 7400/tcp # RTPS Discovery [Gerardo_Pardo_Castel] [Gerardo_Pardo_Castel] 2005-10 -rtps-discovery 7400/udp # RTPS Discovery [Gerardo_Pardo_Castel] [Gerardo_Pardo_Castel] 2005-10 -rtps-dd-ut 7401/tcp # RTPS Data-Distribution [Gerardo_Pardo_Castel] [Gerardo_Pardo_Castel] 2005-10 -# User-Traffic -rtps-dd-ut 7401/udp # RTPS Data-Distribution [Gerardo_Pardo_Castel] [Gerardo_Pardo_Castel] 2005-10 -# User-Traffic -rtps-dd-mt 7402/tcp # RTPS Data-Distribution [Gerardo_Pardo_Castel] [Gerardo_Pardo_Castel] 2005-10 -# Meta-Traffic -rtps-dd-mt 7402/udp # RTPS Data-Distribution [Gerardo_Pardo_Castel] [Gerardo_Pardo_Castel] 2005-10 -# Meta-Traffic -# 7403-7409 Unassigned -ionixnetmon 7410/tcp # Ionix Network Monitor [Maxime_Deputter] [Maxime_Deputter] 2006-04 -ionixnetmon 7410/udp # Ionix Network Monitor [Maxime_Deputter] [Maxime_Deputter] 2006-04 -daqstream 7411/tcp # Streaming of measurement [Hottinger_Baldwin_Messtechnik_GmbH] [Stephan_Gatzka] 2013-03-15 -# data -daqstream 7411/udp # Streaming of measurement [Hottinger_Baldwin_Messtechnik_GmbH] [Stephan_Gatzka] 2013-03-15 -# data -# 7412-7420 Unassigned -mtportmon 7421/tcp # Matisse Port Monitor [Didier_Cabannes] [Didier_Cabannes] 2004-11 -mtportmon 7421/udp # Matisse Port Monitor [Didier_Cabannes] [Didier_Cabannes] 2004-11 -# 7422-7425 Unassigned -pmdmgr 7426/tcp # OpenView DM Postmaster [Dave_Lamb] [Dave_Lamb] -# Manager -pmdmgr 7426/udp # OpenView DM Postmaster [Dave_Lamb] [Dave_Lamb] -# Manager -oveadmgr 7427/tcp # OpenView DM Event Agent [Dave_Lamb] [Dave_Lamb] -# Manager -oveadmgr 7427/udp # OpenView DM Event Agent [Dave_Lamb] [Dave_Lamb] -# Manager -ovladmgr 7428/tcp # OpenView DM Log Agent [Dave_Lamb] [Dave_Lamb] -# Manager -ovladmgr 7428/udp # OpenView DM Log Agent [Dave_Lamb] [Dave_Lamb] -# Manager -opi-sock 7429/tcp # OpenView DM rqt [Dave_Lamb] [Dave_Lamb] -# communication -opi-sock 7429/udp # OpenView DM rqt [Dave_Lamb] [Dave_Lamb] -# communication -xmpv7 7430/tcp # OpenView DM xmpv7 api pipe [Dave_Lamb] [Dave_Lamb] -xmpv7 7430/udp # OpenView DM xmpv7 api pipe [Dave_Lamb] [Dave_Lamb] -pmd 7431/tcp # OpenView DM ovc/xmpv3 api [Dave_Lamb] [Dave_Lamb] -# pipe -pmd 7431/udp # OpenView DM ovc/xmpv3 api [Dave_Lamb] [Dave_Lamb] -# pipe -# 7432-7436 Unassigned -faximum 7437/tcp # Faximum [George_Pajari] [George_Pajari] -faximum 7437/udp # Faximum [George_Pajari] [George_Pajari] -# 7438-7442 Unassigned -oracleas-https 7443/tcp # Oracle Application Server [David_McMarlin] [David_McMarlin] 2006-08 -# HTTPS -oracleas-https 7443/udp # Oracle Application Server [David_McMarlin] [David_McMarlin] 2006-08 -# HTTPS -# 7444-7470 Unassigned -sttunnel 7471/tcp # Stateless Transport [Bruce_Davie_3] [Bruce_Davie_3] 2014-04-28 -# Tunneling Protocol -# 7471 udp Reserved -# 7472 Unassigned -rise 7473/tcp # Rise: The Vieneo Province [Jason_Reskin] [Jason_Reskin] 2007-03 -rise 7473/udp # Rise: The Vieneo Province [Jason_Reskin] [Jason_Reskin] 2007-03 -neo4j 7474/tcp # Neo4j Graph Database [Neo_Technology_Inc] [Julian_Simpson] 2013-02-08 -# 7474 udp Reserved -# 7475-7490 Unassigned -telops-lmd 7491/tcp # telops-lmd [David_Spencer] [David_Spencer] -telops-lmd 7491/udp # telops-lmd [David_Spencer] [David_Spencer] -# Known -# 7492-7499 Unassigned Unauthorized -# Use on port -# 7499 -silhouette 7500/tcp # Silhouette User [Anthony_Payne] [Anthony_Payne] 2004-02 -silhouette 7500/udp # Silhouette User [Anthony_Payne] [Anthony_Payne] 2004-02 -# Known -ovbus 7501/tcp # HP OpenView Bus Daemon [David_M_Rhodes] [David_M_Rhodes] Unauthorized -# Use on port -# 7501 -# Known -ovbus 7501/udp # HP OpenView Bus Daemon [David_M_Rhodes] [David_M_Rhodes] Unauthorized -# Use on port -# 7501 -# 7502-7507 Unassigned -adcp 7508/tcp # Automation Device [Festo_AG] [Joerg_Ullmann] 2011-05-27 2012-07-26 -# Configuration Protocol -# 7508 udp Reserved -acplt 7509/tcp # ACPLT - process automation [Chair_for_Process_Control_Engineering] [Ulrich_Epple] 2010-12-07 2012-08-07 -# service -# 7509 udp Reserved -ovhpas 7510/tcp # HP OpenView Application [Jeff_Conrad] [Jeff_Conrad] -# Server -ovhpas 7510/udp # HP OpenView Application [Jeff_Conrad] [Jeff_Conrad] -# Server -pafec-lm 7511/tcp # pafec-lm [Billy_Dhillon] [Billy_Dhillon] -pafec-lm 7511/udp # pafec-lm [Billy_Dhillon] [Billy_Dhillon] -# 7512-7541 Unassigned -saratoga 7542/tcp # Saratoga Transfer Protocol [Lloyd_Wood] [Lloyd_Wood] 2007-05 -saratoga 7542/udp # Saratoga Transfer Protocol [Lloyd_Wood] [Lloyd_Wood] 2007-05 -atul 7543/tcp # atul server [Mark_Stapp] [Mark_Stapp] 2006-01 -atul 7543/udp # atul server [Mark_Stapp] [Mark_Stapp] 2006-01 -nta-ds 7544/tcp # FlowAnalyzer DisplayServer [Fred_Messinger] [Fred_Messinger] -nta-ds 7544/udp # FlowAnalyzer DisplayServer [Fred_Messinger] [Fred_Messinger] -nta-us 7545/tcp # FlowAnalyzer UtilityServer [Fred_Messinger] [Fred_Messinger] -nta-us 7545/udp # FlowAnalyzer UtilityServer [Fred_Messinger] [Fred_Messinger] -cfs 7546/tcp # Cisco Fabric service [Rituparna_Agrawal] [Rituparna_Agrawal] 2005-09 -cfs 7546/udp # Cisco Fabric service [Rituparna_Agrawal] [Rituparna_Agrawal] 2005-09 -cwmp 7547/tcp # DSL Forum CWMP [Anton_Okmianski] [Anton_Okmianski] 2006-01 -cwmp 7547/udp # DSL Forum CWMP [Anton_Okmianski] [Anton_Okmianski] 2006-01 -tidp 7548/tcp # Threat Information [Chui_Tin_Yen] [Chui_Tin_Yen] 2006-02 -# Distribution Protocol -tidp 7548/udp # Threat Information [Chui_Tin_Yen] [Chui_Tin_Yen] 2006-02 -# Distribution Protocol -nls-tl 7549/tcp # Network Layer Signaling [Melinda_Shore] [Melinda_Shore] 2006-05 -# Transport Layer -nls-tl 7549/udp # Network Layer Signaling [Melinda_Shore] [Melinda_Shore] 2006-05 -# Transport Layer -# 7550 tcp Reserved -cloudsignaling 7550/udp # Cloud Signaling Service [Scott_Dawson] [Scott_Dawson] 2011-07-01 -controlone-con 7551/tcp # ControlONE Console signaling [SIMB_Tecnologia] [Diego_Dias] 2014-11-07 -# 7551 udp Reserved -# 7552-7559 Unassigned -sncp 7560/tcp # Sniffer Command Protocol [Dominick_Cafarelli] [Dominick_Cafarelli] 2005-08 -sncp 7560/udp # Sniffer Command Protocol [Dominick_Cafarelli] [Dominick_Cafarelli] 2005-08 -# 7561-7562 Unassigned -cfw 7563/tcp # Control Framework [RFC6230] -# 7563 udp Reserved -# 7564-7565 Unassigned -vsi-omega 7566/tcp # VSI Omega [Curtis_Smith] [Curtis_Smith] -vsi-omega 7566/udp # VSI Omega [Curtis_Smith] [Curtis_Smith] -# 7567-7568 Unassigned -dell-eql-asm 7569/tcp # Dell EqualLogic Host Group [James_E_King_III] [James_E_King_III] -# Management -# 7569 udp Reserved -aries-kfinder 7570/tcp # Aries Kfinder [James_King_III] [James_King_III] -aries-kfinder 7570/udp # Aries Kfinder [James_King_III] [James_King_III] -# 7571-7573 Unassigned -coherence 7574/tcp # Oracle Coherence Cluster [Oracle_5] [Mark_Falco] 2014-07-09 -# Service -coherence-disc 7574/udp # Oracle Coherence Cluster [Oracle_5] [Mark_Falco] 2014-07-09 -# discovery service -# 7575-7587 Unassigned -sun-lm 7588/tcp # Sun License Manager [Sophie_Deng] [Sophie_Deng] -sun-lm 7588/udp # Sun License Manager [Sophie_Deng] [Sophie_Deng] -# 7589-7623 Unassigned -indi 7624/tcp # Instrument Neutral [Elwood_Downey] [Elwood_Downey] 2002-04 -# Distributed Interface -indi 7624/udp # Instrument Neutral [Elwood_Downey] [Elwood_Downey] 2002-04 -# Distributed Interface -# 7625 Unassigned -simco 7626/tcp # SImple Middlebox [RFC4540] -# COnfiguration (SIMCO) Server -# 7626 udp De-registered 2006-01-30 -simco 7626/sctp # SImple Middlebox [Sebastian_Kiesel] [Sebastian_Kiesel] 2006-01 -# COnfiguration (SIMCO) -soap-http 7627/tcp # SOAP Service Port [Donald_Dylla] [Donald_Dylla] 2004-12 -soap-http 7627/udp # SOAP Service Port [Donald_Dylla] [Donald_Dylla] 2004-12 -zen-pawn 7628/tcp # Primary Agent Work [Ty_Ellis] [Ty_Ellis] 2006-05 -# Notification -zen-pawn 7628/udp # Primary Agent Work [Ty_Ellis] [Ty_Ellis] 2006-05 -# Notification -xdas 7629/tcp # OpenXDAS Wire Protocol [John_Calcote_2] [John_Calcote_2] 2006-10 -xdas 7629/udp # OpenXDAS Wire Protocol [John_Calcote_2] [John_Calcote_2] 2006-10 -hawk 7630/tcp # HA Web Konsole [Tim_Serong] [Tim_Serong] 2010-03-31 -# 7630 udp Reserved -tesla-sys-msg 7631/tcp # TESLA System Messaging [Andy_Perreault] [Andy_Perreault] 2010-03-31 -# 7631 udp Reserved -# 7632 Unassigned -pmdfmgt 7633/tcp # PMDF Management [Hunter_Goatley] [Hunter_Goatley] -pmdfmgt 7633/udp # PMDF Management [Hunter_Goatley] [Hunter_Goatley] -# 7634-7647 Unassigned -cuseeme 7648/tcp # bonjour-cuseeme [Marc_Manthey] [Marc_Manthey] 2006-07 -cuseeme 7648/udp # bonjour-cuseeme [Marc_Manthey] [Marc_Manthey] 2006-07 -# 7649-7671 Unassigned -imqstomp 7672/tcp # iMQ STOMP Server [Amy_Kang] [Amy_Kang] 2009-03-10 -# 7672 udp Reserved -imqstomps 7673/tcp # iMQ STOMP Server over SSL [Amy_Kang] [Amy_Kang] 2009-03-10 -# 7673 udp Reserved -imqtunnels 7674/tcp # iMQ SSL tunnel [Shailesh_S_Bavadeka] [Shailesh_S_Bavadeka] 2002-04 -imqtunnels 7674/udp # iMQ SSL tunnel [Shailesh_S_Bavadeka] [Shailesh_S_Bavadeka] 2002-04 -imqtunnel 7675/tcp # iMQ Tunnel [Shailesh_S_Bavadeka] [Shailesh_S_Bavadeka] 2002-04 -imqtunnel 7675/udp # iMQ Tunnel [Shailesh_S_Bavadeka] [Shailesh_S_Bavadeka] 2002-04 -imqbrokerd 7676/tcp # iMQ Broker Rendezvous [Joseph_Di_Pol] [Joseph_Di_Pol] 2002-04 -imqbrokerd 7676/udp # iMQ Broker Rendezvous [Joseph_Di_Pol] [Joseph_Di_Pol] 2002-04 -sun-user-https 7677/tcp # Sun App Server - HTTPS [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -sun-user-https 7677/udp # Sun App Server - HTTPS [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -# 7678-7679 Unassigned -pando-pub 7680/tcp # Pando Media Public [Laird_Popkin] [Laird_Popkin] 2008-02-27 -# Distribution -pando-pub 7680/udp # Pando Media Public [Laird_Popkin] [Laird_Popkin] 2008-02-27 -# Distribution -# 7681-7682 Unassigned -dmt 7683/tcp # Cleondris DMT [Cleondris_GmbH] [Christian_Plattner] 2015-03-31 -# 7683 udp Reserved -# 7684-7688 Unassigned -collaber 7689/tcp # Collaber Network Service [Rajesh_Akkineni] [Rajesh_Akkineni] 2007-01 -collaber 7689/udp # Collaber Network Service [Rajesh_Akkineni] [Rajesh_Akkineni] 2007-01 -# 7690-7696 Unassigned -klio 7697/tcp # KLIO communications [Helmut_Giritzer_2] [Helmut_Giritzer_2] 2005-08 -klio 7697/udp # KLIO communications [Helmut_Giritzer_2] [Helmut_Giritzer_2] 2005-08 -# 7698-7699 Unassigned -em7-secom 7700/tcp # EM7 Secure Communications [Christopher_Cordray] [Christopher_Cordray] 2008-06-05 -# 7700 udp Reserved -# 7701-7706 Unassigned -sync-em7 7707/tcp # EM7 Dynamic Updates [Christopher_Cordray] [Christopher_Cordray] 2004-11 -sync-em7 7707/udp # EM7 Dynamic Updates [Christopher_Cordray] [Christopher_Cordray] 2004-11 -scinet 7708/tcp # scientia.net [Christoph_Anton_Mitt] [Christoph_Anton_Mitt] 2006-01 -scinet 7708/udp # scientia.net [Christoph_Anton_Mitt] [Christoph_Anton_Mitt] 2006-01 -# 7709-7719 Unassigned -medimageportal 7720/tcp # MedImage Portal [Robert_Helton] [Robert_Helton] 2003-10 -medimageportal 7720/udp # MedImage Portal [Robert_Helton] [Robert_Helton] 2003-10 -# 7721-7723 Unassigned -nsdeepfreezectl 7724/tcp # Novell Snap-in Deep Freeze [David_Crowe] [David_Crowe] 2008-01-07 -# Control -nsdeepfreezectl 7724/udp # Novell Snap-in Deep Freeze [David_Crowe] [David_Crowe] 2008-01-07 -# Control -nitrogen 7725/tcp # Nitrogen Service [Randy_Lomnes] [Randy_Lomnes] 2004-11 -nitrogen 7725/udp # Nitrogen Service [Randy_Lomnes] [Randy_Lomnes] 2004-11 -freezexservice 7726/tcp # FreezeX Console Service [David_Crowe] [David_Crowe] 2005-06 -freezexservice 7726/udp # FreezeX Console Service [David_Crowe] [David_Crowe] 2005-06 -trident-data 7727/tcp # Trident Systems Data [Jeremy_McClintock] [Jeremy_McClintock] 2005-08 -trident-data 7727/udp # Trident Systems Data [Jeremy_McClintock] [Jeremy_McClintock] 2005-08 -osvr 7728/tcp # Open-Source Virtual Reality [Open_Source_Virtual_Reality_OSVR.com] [Yuval_Boger_2] 2015-07-14 -osvr 7728/udp # Open-Source Virtual Reality [Open_Source_Virtual_Reality_OSVR.com] [Yuval_Boger_2] 2015-07-14 -osvr 7728/sctp # Open-Source Virtual Reality [Open_Source_Virtual_Reality_OSVR.com] [Yuval_Boger_2] 2015-07-14 -# 7729-7733 Unassigned -smip 7734/tcp # Smith Protocol over IP [Jim_Pettinato] [Jim_Pettinato] 2007-04 -smip 7734/udp # Smith Protocol over IP [Jim_Pettinato] [Jim_Pettinato] 2007-04 -# 7735-7737 Unassigned -aiagent 7738/tcp # HP Enterprise Discovery [Matthew_Darwin] [Matthew_Darwin] 2005-08 -# Agent -aiagent 7738/udp # HP Enterprise Discovery [Matthew_Darwin] [Matthew_Darwin] 2005-08 -# Agent -# 7739-7740 Unassigned -scriptview 7741/tcp # ScriptView Network [Reinhard_Wolf] [Reinhard_Wolf] 2010-08-19 -scriptview 7741/udp # ScriptView Network [Reinhard_Wolf] [Reinhard_Wolf] 2010-08-19 -msss 7742/tcp # Mugginsoft Script Server [Jonathan_Mitchell] [Jonathan_Mitchell] 2008-09-08 -# Service -# 7742 udp Reserved -sstp-1 7743/tcp # Sakura Script Transfer [Kouichi_Takeda] [Kouichi_Takeda] -# Protocol -sstp-1 7743/udp # Sakura Script Transfer [Kouichi_Takeda] [Kouichi_Takeda] -# Protocol -raqmon-pdu 7744/tcp # RAQMON PDU [RFC4712] -raqmon-pdu 7744/udp # RAQMON PDU [RFC4712] -# 7745-7746 Unassigned -prgp 7747/tcp # Put/Run/Get Protocol [Jayasooriah] [Jayasooriah] 2008-02-22 -prgp 7747/udp # Put/Run/Get Protocol [Jayasooriah] [Jayasooriah] 2008-02-22 -# 7748-7776 Unassigned -# Known -cbt 7777/tcp # cbt [Tony_Ballardie] [Tony_Ballardie] Unauthorized -# Use on port -# 7777 -# Known -cbt 7777/udp # cbt [Tony_Ballardie] [Tony_Ballardie] Unauthorized -# Use on port -# 7777 -interwise 7778/tcp # Interwise [Joseph_Gray] [Joseph_Gray] -interwise 7778/udp # Interwise [Joseph_Gray] [Joseph_Gray] -vstat 7779/tcp # VSTAT [Vinh_Nguyn] [Vinh_Nguyn] -vstat 7779/udp # VSTAT [Vinh_Nguyn] [Vinh_Nguyn] -# 7780 Unassigned -accu-lmgr 7781/tcp # accu-lmgr [Moises_E_Hernandez] [Moises_E_Hernandez] -accu-lmgr 7781/udp # accu-lmgr [Moises_E_Hernandez] [Moises_E_Hernandez] -# 7782-7783 Unassigned -s-bfd 7784/udp # Seamless Bidirectional [IESG] [BFD_Chairs] 2014-12-24 [draft-ietf-bfd-seamless-ip] -# Forwarding Detection (S-BFD) -# 7784 tcp Reserved -# Known -# 7785 Unassigned Unauthorized -# Use on port -# 7785 -# Known -minivend 7786/tcp # MINIVEND [Mike_Heins] [Mike_Heins] Unauthorized -# Use on port -# 7786 -# Known -minivend 7786/udp # MINIVEND [Mike_Heins] [Mike_Heins] Unauthorized -# Use on port -# 7786 -# Known -popup-reminders 7787/tcp # Popup Reminders Receive [Robert_Harvey] [Robert_Harvey] 2006-01 Unauthorized -# Use on port -# 7787 -# Known -popup-reminders 7787/udp # Popup Reminders Receive [Robert_Harvey] [Robert_Harvey] 2006-01 Unauthorized -# Use on port -# 7787 -# Known -# 7788 Unassigned Unauthorized -# Use on port -# 7788 -# Known -office-tools 7789/tcp # Office Tools Pro Receive [Robert_Harvey] [Robert_Harvey] 2006-01 Unauthorized -# Use on port -# 7789 -# Known -office-tools 7789/udp # Office Tools Pro Receive [Robert_Harvey] [Robert_Harvey] 2006-01 Unauthorized -# Use on port -# 7789 -# 7790-7793 Unassigned -q3ade 7794/tcp # Q3ADE Cluster Service [Uffe_Harksen] [Uffe_Harksen] 2005-08 -q3ade 7794/udp # Q3ADE Cluster Service [Uffe_Harksen] [Uffe_Harksen] 2005-08 -# 7795-7796 Unassigned -pnet-conn 7797/tcp # Propel Connector port -pnet-conn 7797/udp # Propel Connector port -pnet-enc 7798/tcp # Propel Encoder port [Leif_Hedstrom] [Leif_Hedstrom] 2002-04 -pnet-enc 7798/udp # Propel Encoder port [Leif_Hedstrom] [Leif_Hedstrom] 2002-04 -altbsdp 7799/tcp # Alternate BSDP Service [Dieter_Siegmund] [Dieter_Siegmund] 2007-10-22 -altbsdp 7799/udp # Alternate BSDP Service [Dieter_Siegmund] [Dieter_Siegmund] 2007-10-22 -asr 7800/tcp # Apple Software Restore [Jim_Kateley][Shantonu_Sen] [Jim_Kateley][Shantonu_Sen] 2006-01 Defined TXT keys: image= -asr 7800/udp # Apple Software Restore [Jim_Kateley][Shantonu_Sen] [Jim_Kateley][Shantonu_Sen] 2006-01 Defined TXT keys: image= -ssp-client 7801/tcp # Secure Server Protocol - [Rick_Macchio] [Rick_Macchio] 2006-11 -# client -ssp-client 7801/udp # Secure Server Protocol - [Rick_Macchio] [Rick_Macchio] 2006-11 -# client -vns-tp 7802/udp # Virtualized Network Services [Juniper_Networks] [Bruno_Rijsman] 2013-02-01 -# Tunnel Protocol -# 7802 tcp Reserved -# 7803-7809 Unassigned -rbt-wanopt 7810/tcp # Riverbed WAN Optimization [Vladimir_Legalov_2] [Vladimir_Legalov_2] 2007-09-04 -# Protocol -rbt-wanopt 7810/udp # Riverbed WAN Optimization [Vladimir_Legalov_2] [Vladimir_Legalov_2] 2007-09-04 -# Protocol -# 7811-7844 Unassigned -apc-7845 7845/tcp # APC 7845 [American_Power_Conve] [American_Power_Conve] -apc-7845 7845/udp # APC 7845 [American_Power_Conve] [American_Power_Conve] -apc-7846 7846/tcp # APC 7846 [American_Power_Conve] [American_Power_Conve] -apc-7846 7846/udp # APC 7846 [American_Power_Conve] [American_Power_Conve] -csoauth 7847/tcp # A product key authentication [Jeff_Wamsley] [Jacob_Kiesel] 2013-09-04 -# protocol made by CSO -# 7847 udp Reserved -# 7848-7868 Unassigned -mobileanalyzer 7869/tcp # MobileAnalyzer& [Jonas_Gyllensvaan] [Jonas_Gyllensvaan] 2009-04-27 -# MobileMonitor -# 7869 udp Reserved -rbt-smc 7870/tcp # Riverbed Steelhead Mobile [Gabriel_Levy] [Gabriel_Levy] 2008-08-29 -# Service -# 7870 udp Reserved -mdm 7871/tcp # Mobile Device Management [Dan_Harkins] [Dan_Harkins] 2011-08-15 -# 7871 udp Reserved -# 7872 tcp Reserved -mipv6tls 7872/udp # TLS-based Mobile IPv6 [IESG] [IETF_Chair] 2012-04-12 [RFC6618] -# Security -# 7873-7877 Unassigned -owms 7878/tcp # Opswise Message Service [Stonebranch_Inc] [Nathan_Hammond_2] 2013-06-25 -# 7878 udp Reserved -# 7879 Unassigned -pss 7880/tcp # Pearson [Pearson] [Pearson] 2008-01-17 -pss 7880/udp # Pearson [Pearson] [Pearson] 2008-01-17 -# 7881-7886 Unassigned -ubroker 7887/tcp # Universal Broker [Nathan_Hammond] [Nathan_Hammond] 2005-10 -ubroker 7887/udp # Universal Broker [Nathan_Hammond] [Nathan_Hammond] 2005-10 -# 7888-7899 Unassigned -mevent 7900/tcp # Multicast Event [YoonSoo_Kim] [YoonSoo_Kim] 2006-05 -mevent 7900/udp # Multicast Event [YoonSoo_Kim] [YoonSoo_Kim] 2006-05 -tnos-sp 7901/tcp # TNOS Service Protocol [Rene_Kurt] [Rene_Kurt] 2005-08 -tnos-sp 7901/udp # TNOS Service Protocol [Rene_Kurt] [Rene_Kurt] 2005-08 -tnos-dp 7902/tcp # TNOS shell Protocol [Rene_Kurt] [Rene_Kurt] 2005-08 -tnos-dp 7902/udp # TNOS shell Protocol [Rene_Kurt] [Rene_Kurt] 2005-08 -tnos-dps 7903/tcp # TNOS Secure DiaguardProtocol [Rene_Kurt] [Rene_Kurt] 2005-08 -tnos-dps 7903/udp # TNOS Secure DiaguardProtocol [Rene_Kurt] [Rene_Kurt] 2005-08 -# 7904-7912 Unassigned -qo-secure 7913/tcp # QuickObjects secure port [Jonas_Bovin] [Jonas_Bovin] -qo-secure 7913/udp # QuickObjects secure port [Jonas_Bovin] [Jonas_Bovin] -# 7914-7931 Unassigned -t2-drm 7932/tcp # Tier 2 Data Resource Manager [Peter_Carlson] [Peter_Carlson] -t2-drm 7932/udp # Tier 2 Data Resource Manager [Peter_Carlson] [Peter_Carlson] -t2-brm 7933/tcp # Tier 2 Business Rules [Peter_Carlson] [Peter_Carlson] -# Manager -t2-brm 7933/udp # Tier 2 Business Rules [Peter_Carlson] [Peter_Carlson] -# Manager -# 7934-7961 Unassigned -# Encrypted, extendable, -generalsync 7962/tcp # general-purpose [Dirk_Steinmetz] [Dirk_Steinmetz] 2014-04-17 -# synchronization protocol -# Encrypted, extendable, -generalsync 7962/udp # general-purpose [Dirk_Steinmetz] [Dirk_Steinmetz] 2014-04-17 -# synchronization protocol -# 7963-7966 Unassigned -supercell 7967/tcp # Supercell [Kevin_Nakagawa] [Kevin_Nakagawa] -supercell 7967/udp # Supercell [Kevin_Nakagawa] [Kevin_Nakagawa] -# 7968-7978 Unassigned -micromuse-ncps 7979/tcp # Micromuse-ncps [Hing_Wing_To] [Hing_Wing_To] -micromuse-ncps 7979/udp # Micromuse-ncps [Hing_Wing_To] [Hing_Wing_To] -quest-vista 7980/tcp # Quest Vista [Preston_Bannister] [Preston_Bannister] -quest-vista 7980/udp # Quest Vista [Preston_Bannister] [Preston_Bannister] -sossd-collect 7981/tcp # Spotlight on SQL Server [Rob_Griffin_2] [Rob_Griffin_2] 2010-08-30 -# Desktop Collect -# 7981 udp Reserved -sossd-agent 7982/tcp # Spotlight on SQL Server [Rob_Griffin_2] [Rob_Griffin_2] 2010-09-13 -# Desktop Agent -sossd-disc 7982/udp # Spotlight on SQL Server [Rob_Griffin_2] [Rob_Griffin_2] 2010-09-13 -# Desktop Agent Discovery -# 7983-7997 Unassigned -pushns 7997/tcp # PUSH Notification Service [Tristan_Seifert] [Tristan_Seifert] 2011-01-31 -# 7997 udp Reserved -# 7998 tcp Reserved -usicontentpush 7998/udp # USI Content Push Service [Prakash_Iyer] [Prakash_Iyer] 2009-08-10 -irdmi2 7999/tcp # iRDMI2 -irdmi2 7999/udp # iRDMI2 -irdmi 8000/tcp # iRDMI [Gil_Shafriri] [Gil_Shafriri] -irdmi 8000/udp # iRDMI [Gil_Shafriri] [Gil_Shafriri] -# Known -vcom-tunnel 8001/tcp # VCOM Tunnel [Mark_Lewandowski] [Mark_Lewandowski] Unauthorized -# Use on port -# 8001 -# Known -vcom-tunnel 8001/udp # VCOM Tunnel [Mark_Lewandowski] [Mark_Lewandowski] Unauthorized -# Use on port -# 8001 -teradataordbms 8002/tcp # Teradata ORDBMS [Curt_Ellmann] [Curt_Ellmann] -teradataordbms 8002/udp # Teradata ORDBMS [Curt_Ellmann] [Curt_Ellmann] -mcreport 8003/tcp # Mulberry Connect Reporting [Dave_Stoneham] [Dave_Stoneham] 2008-03-10 -# Service -mcreport 8003/udp # Mulberry Connect Reporting [Dave_Stoneham] [Dave_Stoneham] 2008-03-10 -# Service -# 8004 Unassigned -mxi 8005/tcp # MXI Generation II for z/OS [Rob_Scott] [Rob_Scott] 2007-05 -mxi 8005/udp # MXI Generation II for z/OS [Rob_Scott] [Rob_Scott] 2007-05 -# 8006-8007 Unassigned -http-alt 8008/tcp # HTTP Alternate [James_Gettys] [James_Gettys] -http-alt 8008/udp # HTTP Alternate [James_Gettys] [James_Gettys] -# 8009-8018 Unassigned -qbdb 8019/tcp # QB DB Dynamic Port [Sridhar_Krishnamurth] [Sridhar_Krishnamurth] 2008-02-15 -qbdb 8019/udp # QB DB Dynamic Port [Sridhar_Krishnamurth] [Sridhar_Krishnamurth] 2008-02-15 -intu-ec-svcdisc 8020/tcp # Intuit Entitlement Service [Daniel_C_McGloin] [Daniel_C_McGloin] 2005-05 -# and Discovery -intu-ec-svcdisc 8020/udp # Intuit Entitlement Service [Daniel_C_McGloin] [Daniel_C_McGloin] 2005-05 -# and Discovery -intu-ec-client 8021/tcp # Intuit Entitlement Client [Daniel_C_McGloin] [Daniel_C_McGloin] 2005-05 -intu-ec-client 8021/udp # Intuit Entitlement Client [Daniel_C_McGloin] [Daniel_C_McGloin] 2005-05 -oa-system 8022/tcp # oa-system [Marie_France_Dubreui] [Marie_France_Dubreui] -oa-system 8022/udp # oa-system [Marie_France_Dubreui] [Marie_France_Dubreui] -# 8023-8024 Unassigned -ca-audit-da 8025/tcp # CA Audit Distribution Agent [Henning_Smith] [Henning_Smith] 2006-07 -ca-audit-da 8025/udp # CA Audit Distribution Agent [Henning_Smith] [Henning_Smith] 2006-07 -ca-audit-ds 8026/tcp # CA Audit Distribution Server [Henning_Smith] [Henning_Smith] 2006-07 -ca-audit-ds 8026/udp # CA Audit Distribution Server [Henning_Smith] [Henning_Smith] 2006-07 -# 8027-8031 Unassigned -pro-ed 8032/tcp # ProEd -pro-ed 8032/udp # ProEd -mindprint 8033/tcp # MindPrint [Larry_Tusoni] [Larry_Tusoni] -mindprint 8033/udp # MindPrint [Larry_Tusoni] [Larry_Tusoni] -vantronix-mgmt 8034/tcp # .vantronix Management [Reyk_Floeter] [Reyk_Floeter] 2008-02-27 -vantronix-mgmt 8034/udp # .vantronix Management [Reyk_Floeter] [Reyk_Floeter] 2008-02-27 -# 8035-8039 Unassigned -ampify 8040/tcp # Ampify Messaging Protocol [Tav_Espian] [Tav_Espian] 2010-08-10 -ampify 8040/udp # Ampify Messaging Protocol [Tav_Espian] [Tav_Espian] 2010-08-10 -# 8041 Unassigned -fs-agent 8042/tcp # FireScope Agent [Matt_Rogers] [Matt_Rogers] 2008-10-16 -# 8042 udp Reserved -fs-server 8043/tcp # FireScope Server [Matt_Rogers] [Matt_Rogers] 2008-10-16 -# 8043 udp Reserved -fs-mgmt 8044/tcp # FireScope Management [Matt_Rogers] [Matt_Rogers] 2008-10-16 -# Interface -# 8044 udp Reserved -# 8045-8050 Unassigned -rocrail 8051/tcp # Rocrail Client Service [Rob_Versluis] [Rob_Versluis] 2011-05-23 -# 8051 udp Reserved -senomix01 8052/tcp # Senomix Timesheets Server [Charles_O_Dale] [Charles_O_Dale] 2006-07 -senomix01 8052/udp # Senomix Timesheets Server [Charles_O_Dale] [Charles_O_Dale] 2006-07 -senomix02 8053/tcp # Senomix Timesheets Client [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix02 8053/udp # Senomix Timesheets Client [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix03 8054/tcp # Senomix Timesheets Server [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix03 8054/udp # Senomix Timesheets Server [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix04 8055/tcp # Senomix Timesheets Server [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix04 8055/udp # Senomix Timesheets Server [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix05 8056/tcp # Senomix Timesheets Server [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix05 8056/udp # Senomix Timesheets Server [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix06 8057/tcp # Senomix Timesheets Client [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix06 8057/udp # Senomix Timesheets Client [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix07 8058/tcp # Senomix Timesheets Client [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix07 8058/udp # Senomix Timesheets Client [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix08 8059/tcp # Senomix Timesheets Client [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -senomix08 8059/udp # Senomix Timesheets Client [1 [Charles_O_Dale] [Charles_O_Dale] 2006-07 -# year assignment] -# 8060 tcp Reserved -aero 8060/udp # Asymmetric Extended Route [IESG] [IETF_Chair] [RFC6706] -# Optimization (AERO) -# 8061-8065 Unassigned -toad-bi-appsrvr 8066/tcp # Toad BI Application Server [Quest_Software_2] [Greg_Cottman_3] 2013-04-19 -# 8066 udp Reserved -infi-async 8067/tcp # Infinidat async replication [INFINIDAT] [Eldar_Kleiner] 2015-05-01 -# 8067 udp Reserved -# 8068-8073 Unassigned -gadugadu 8074/tcp # Gadu-Gadu [Marcin_Gozdalik] [Marcin_Gozdalik] 2006-05 -gadugadu 8074/udp # Gadu-Gadu [Marcin_Gozdalik] [Marcin_Gozdalik] 2006-05 -# 8075-8079 Unassigned -http-alt 8080/tcp # HTTP Alternate (see port 80) [Stephen_Casner] [Stephen_Casner] -http-alt 8080/udp # HTTP Alternate (see port 80) [Stephen_Casner] [Stephen_Casner] -sunproxyadmin 8081/tcp # Sun Proxy Admin Service [Arvind_Srinivasan] [Arvind_Srinivasan] 2005-08 -sunproxyadmin 8081/udp # Sun Proxy Admin Service [Arvind_Srinivasan] [Arvind_Srinivasan] 2005-08 -us-cli 8082/tcp # Utilistor (Client) [Andy_Brewerton] [Andy_Brewerton] 2005-08 -us-cli 8082/udp # Utilistor (Client) [Andy_Brewerton] [Andy_Brewerton] 2005-08 -us-srv 8083/tcp # Utilistor (Server) [Andy_Brewerton] [Andy_Brewerton] 2005-08 -us-srv 8083/udp # Utilistor (Server) [Andy_Brewerton] [Andy_Brewerton] 2005-08 -# 8084-8085 Unassigned -d-s-n 8086/tcp # Distributed SCADA Networking [Gary_Hampton] [Gary_Hampton] 2008-02-27 -# Rendezvous Port -d-s-n 8086/udp # Distributed SCADA Networking [Gary_Hampton] [Gary_Hampton] 2008-02-27 -# Rendezvous Port -simplifymedia 8087/tcp # Simplify Media SPP Protocol [Emmanuel_Saint_Loube] [Emmanuel_Saint_Loube] 2008-08-08 -simplifymedia 8087/udp # Simplify Media SPP Protocol [Emmanuel_Saint_Loube] [Emmanuel_Saint_Loube] 2008-08-08 -radan-http 8088/tcp # Radan HTTP [Steve_Hay] [Steve_Hay] 2008-06-13 -radan-http 8088/udp # Radan HTTP [Steve_Hay] [Steve_Hay] 2008-06-13 -# 8089-8090 Unassigned -jamlink 8091/tcp # Jam Link Framework [Evgeniy_Filatov] [Evgeniy_Filatov] 2009-11-25 -# 8091 udp Reserved -# 8092-8096 Unassigned -sac 8097/tcp # SAC Port Id [Girish_Bhat] [Girish_Bhat] 2006-04 -sac 8097/udp # SAC Port Id [Girish_Bhat] [Girish_Bhat] 2006-04 -# 8098-8099 Unassigned -xprint-server 8100/tcp # Xprint Server [John_McKernan] [John_McKernan] -xprint-server 8100/udp # Xprint Server [John_McKernan] [John_McKernan] -ldoms-migr 8101/tcp # Logical Domains Migration [Liam_Merwick] [Liam_Merwick] 2009-01-16 -# 8101 udp Reserved -kz-migr 8102/tcp # Oracle Kernel zones [Oracle_4] [John_Levon] 2013-12-24 -# migration server -# 8102 udp Reserved -# 8103-8114 Unassigned -mtl8000-matrix 8115/tcp # MTL8000 Matrix [David_Pinch] [David_Pinch] 2002-04 -mtl8000-matrix 8115/udp # MTL8000 Matrix [David_Pinch] [David_Pinch] 2002-04 -cp-cluster 8116/tcp # Check Point Clustering [Roni_Moshitzky] [Roni_Moshitzky] -cp-cluster 8116/udp # Check Point Clustering [Roni_Moshitzky] [Roni_Moshitzky] -# Purity replication -purityrpc 8117/tcp # clustering and remote [Pure_Storage] [Steve_Hodgson] 2013-08-13 -# management -# 8117 udp Reserved -privoxy 8118/tcp # Privoxy HTTP proxy [Andreas_Oesterhelt] [Andreas_Oesterhelt] 2002-06 -privoxy 8118/udp # Privoxy HTTP proxy [Andreas_Oesterhelt] [Andreas_Oesterhelt] 2002-06 -# 8119-8120 Unassigned -apollo-data 8121/tcp # Apollo Data Port [Anthony_Carrabino] [Anthony_Carrabino] 2003-08 -apollo-data 8121/udp # Apollo Data Port [Anthony_Carrabino] [Anthony_Carrabino] 2003-08 -apollo-admin 8122/tcp # Apollo Admin Port [Anthony_Carrabino] [Anthony_Carrabino] 2003-08 -apollo-admin 8122/udp # Apollo Admin Port [Anthony_Carrabino] [Anthony_Carrabino] 2003-08 -# 8123-8127 Unassigned -paycash-online 8128/tcp # PayCash Online Protocol [MegaZone] [MegaZone] 2005-08 -paycash-online 8128/udp # PayCash Online Protocol [MegaZone] [MegaZone] 2005-08 -paycash-wbp 8129/tcp # PayCash Wallet-Browser [MegaZone] [MegaZone] 2005-08 -paycash-wbp 8129/udp # PayCash Wallet-Browser [MegaZone] [MegaZone] 2005-08 -indigo-vrmi 8130/tcp # INDIGO-VRMI [Colin_Caughie] [Colin_Caughie] -indigo-vrmi 8130/udp # INDIGO-VRMI [Colin_Caughie] [Colin_Caughie] -indigo-vbcp 8131/tcp # INDIGO-VBCP [Colin_Caughie] [Colin_Caughie] -indigo-vbcp 8131/udp # INDIGO-VBCP [Colin_Caughie] [Colin_Caughie] -dbabble 8132/tcp # dbabble [Chris_Pugmire] [Chris_Pugmire] -dbabble 8132/udp # dbabble [Chris_Pugmire] [Chris_Pugmire] -# 8133-8139 Unassigned -puppet 8140/tcp # The Puppet master service [Puppet_Labs] [Zach_Leslie] 2014-09-18 -# 8140 udp Reserved -# 8141-8147 Unassigned -isdd 8148/tcp # i-SDD file transfer [Frank_Waarsenburg] [Frank_Waarsenburg] 2004-11 -isdd 8148/udp # i-SDD file transfer [Frank_Waarsenburg] [Frank_Waarsenburg] 2004-11 -# 8149 tcp Reserved -eor-game 8149/udp # Edge of Reality game data [Sky_Schulz] [Sky_Schulz] 2011-05-09 -# 8150-8152 Unassigned -quantastor 8153/tcp # QuantaStor Management [OS_NEXUS] [Steven_Umbehocker] 2012-09-21 -# Interface -# 8153 udp Reserved -# 8154-8159 Unassigned -patrol 8160/tcp # Patrol [Portnoy_Boxman] [Portnoy_Boxman] -patrol 8160/udp # Patrol [Portnoy_Boxman] [Portnoy_Boxman] -patrol-snmp 8161/tcp # Patrol SNMP [Portnoy_Boxman] [Portnoy_Boxman] -patrol-snmp 8161/udp # Patrol SNMP [Portnoy_Boxman] [Portnoy_Boxman] -lpar2rrd 8162/tcp # LPAR2RRD client server [LPAR2RRD_project] [Pavel_Hampl] 2013-08-14 -# communication -# 8162 udp Reserved -# 8163-8180 Unassigned -intermapper 8181/tcp # Intermapper network [William_Fisher] [William_Fisher] 2011-05-09 -# management system -# 8181 udp Reserved -vmware-fdm 8182/tcp # VMware Fault Domain Manager [Ron_Passerini] [Ron_Passerini] 2010-04-27 -vmware-fdm 8182/udp # VMware Fault Domain Manager [Ron_Passerini] [Ron_Passerini] 2010-04-27 -proremote 8183/tcp # ProRemote [Alex_Lelievre] [Alex_Lelievre] 2009-08-18 -# 8183 udp Reserved -itach 8184/tcp # Remote iTach Connection [Barend_Jacobus_van_d] [Barend_Jacobus_van_d] 2010-04-27 -itach 8184/udp # Remote iTach Connection [Barend_Jacobus_van_d] [Barend_Jacobus_van_d] 2010-04-27 -# 8185-8190 Unassigned -limnerpressure 8191/tcp # Limner Pressure [Aaron_Kleinsteiber] [Aaron_Kleinsteiber] 2014-01-16 -# 8191 udp Reserved -spytechphone 8192/tcp # SpyTech Phone Service [Bill_Kay] [Bill_Kay] 2006-04 -spytechphone 8192/udp # SpyTech Phone Service [Bill_Kay] [Bill_Kay] 2006-04 -# 8193 Unassigned -blp1 8194/tcp # Bloomberg data API [Albert_Hou] [Albert_Hou] 2006-05 -blp1 8194/udp # Bloomberg data API [Albert_Hou] [Albert_Hou] 2006-05 -blp2 8195/tcp # Bloomberg feed [Albert_Hou] [Albert_Hou] 2006-05 -blp2 8195/udp # Bloomberg feed [Albert_Hou] [Albert_Hou] 2006-05 -# 8196-8198 Unassigned -vvr-data 8199/tcp # VVR DATA [Ming_Xu] [Ming_Xu] -vvr-data 8199/udp # VVR DATA [Ming_Xu] [Ming_Xu] -trivnet1 8200/tcp # TRIVNET [Saar_Wilf] [Saar_Wilf] -trivnet1 8200/udp # TRIVNET [Saar_Wilf] [Saar_Wilf] -trivnet2 8201/tcp # TRIVNET [Saar_Wilf] [Saar_Wilf] -trivnet2 8201/udp # TRIVNET [Saar_Wilf] [Saar_Wilf] -# 8202 tcp Reserved -aesop 8202/udp # Audio+Ethernet Standard Open [POWERSOFT_SRL] [Paolo_Desii][Claudio_Lastrucci] 2012-01-03 -# Protocol -# 8203-8203 Unassigned -lm-perfworks 8204/tcp # LM Perfworks [Chris_Flynn] [Chris_Flynn] -lm-perfworks 8204/udp # LM Perfworks [Chris_Flynn] [Chris_Flynn] -lm-instmgr 8205/tcp # LM Instmgr [Chris_Flynn] [Chris_Flynn] -lm-instmgr 8205/udp # LM Instmgr [Chris_Flynn] [Chris_Flynn] -lm-dta 8206/tcp # LM Dta [Chris_Flynn] [Chris_Flynn] -lm-dta 8206/udp # LM Dta [Chris_Flynn] [Chris_Flynn] -lm-sserver 8207/tcp # LM SServer [Chris_Flynn] [Chris_Flynn] -lm-sserver 8207/udp # LM SServer [Chris_Flynn] [Chris_Flynn] -lm-webwatcher 8208/tcp # LM Webwatcher [Chris_Flynn] [Chris_Flynn] -lm-webwatcher 8208/udp # LM Webwatcher [Chris_Flynn] [Chris_Flynn] -# 8209-8229 Unassigned -rexecj 8230/tcp # RexecJ Server [Curtiss_Howard] [Curtiss_Howard] 2004-11 -rexecj 8230/udp # RexecJ Server [Curtiss_Howard] [Curtiss_Howard] 2004-11 -# 8231-8242 Unassigned -synapse-nhttps 8243/tcp # Synapse Non Blocking HTTPS [Ruwan_Linton] [Ruwan_Linton] 2008-07-10 -synapse-nhttps 8243/udp # Synapse Non Blocking HTTPS [Ruwan_Linton] [Ruwan_Linton] 2008-07-10 -# 8244-8275 Unassigned -pando-sec 8276/tcp # Pando Media Controlled [Laird_Popkin] [Laird_Popkin] 2008-02-27 -# Distribution -pando-sec 8276/udp # Pando Media Controlled [Laird_Popkin] [Laird_Popkin] 2008-02-27 -# Distribution -# 8277-8279 Unassigned -synapse-nhttp 8280/tcp # Synapse Non Blocking HTTP [Ruwan_Linton] [Ruwan_Linton] 2008-06-05 -synapse-nhttp 8280/udp # Synapse Non Blocking HTTP [Ruwan_Linton] [Ruwan_Linton] 2008-06-05 -# 8281-8291 Unassigned -blp3 8292/tcp # Bloomberg professional [Albert_Hou] [Albert_Hou] 2006-05 -blp3 8292/udp # Bloomberg professional [Albert_Hou] [Albert_Hou] 2006-05 -hiperscan-id 8293/tcp # Hiperscan Identification [Thomas_Klose] [Thomas_Klose] 2009-12-15 -# Service -# 8293 udp Reserved -blp4 8294/tcp # Bloomberg intelligent client [Albert_Hou] [Albert_Hou] 2006-05 -blp4 8294/udp # Bloomberg intelligent client [Albert_Hou] [Albert_Hou] 2006-05 -# 8295-8299 Unassigned -tmi 8300/tcp # Transport Management [Steve_Kneizys] [Steve_Kneizys] 2006-11 -# Interface -tmi 8300/udp # Transport Management [Steve_Kneizys] [Steve_Kneizys] 2006-11 -# Interface -amberon 8301/tcp # Amberon PPC/PPS [Ronald_Snyder] [Ronald_Snyder] 2006-03 -amberon 8301/udp # Amberon PPC/PPS [Ronald_Snyder] [Ronald_Snyder] 2006-03 -# 8302-8312 Unassigned -hub-open-net 8313/tcp # Hub Open Network [Grexie] [Tim_Behrsin] 2012-06-13 Defined TXT keys: _hub._tcp.host.example.com -# 8313 udp Reserved -# 8314-8319 Unassigned -tnp-discover 8320/tcp # Thin(ium) Network Protocol [Aly_Orady] [Aly_Orady] 2007-08-07 -tnp-discover 8320/udp # Thin(ium) Network Protocol [Aly_Orady] [Aly_Orady] 2007-08-07 -tnp 8321/tcp # Thin(ium) Network Protocol [Aly_Orady] [Aly_Orady] 2007-08-07 -tnp 8321/udp # Thin(ium) Network Protocol [Aly_Orady] [Aly_Orady] 2007-08-07 -garmin-marine 8322/tcp # Garmin Marine [Garmin_International_Inc] [Nathan_Karstens] 2015-07-23 -garmin-marine 8322/udp # Garmin Marine [Garmin_International_Inc] [Nathan_Karstens] 2015-07-23 -# 8323-8350 Unassigned -server-find 8351/tcp # Server Find [Chris_Brown] [Chris_Brown] -server-find 8351/udp # Server Find [Chris_Brown] [Chris_Brown] -# 8352-8375 Unassigned -cruise-enum 8376/tcp # Cruise ENUM [Steve_Husak] [Steve_Husak] -cruise-enum 8376/udp # Cruise ENUM [Steve_Husak] [Steve_Husak] -cruise-swroute 8377/tcp # Cruise SWROUTE [Steve_Husak] [Steve_Husak] -cruise-swroute 8377/udp # Cruise SWROUTE [Steve_Husak] [Steve_Husak] -cruise-config 8378/tcp # Cruise CONFIG [Steve_Husak] [Steve_Husak] -cruise-config 8378/udp # Cruise CONFIG [Steve_Husak] [Steve_Husak] -cruise-diags 8379/tcp # Cruise DIAGS [Steve_Husak] [Steve_Husak] -cruise-diags 8379/udp # Cruise DIAGS [Steve_Husak] [Steve_Husak] -cruise-update 8380/tcp # Cruise UPDATE [Steve_Husak] [Steve_Husak] -cruise-update 8380/udp # Cruise UPDATE [Steve_Husak] [Steve_Husak] -# 8381-8382 Unassigned -m2mservices 8383/tcp # M2m Services [Carlos_Arteaga_2] [Carlos_Arteaga_2] 2004-11 -m2mservices 8383/udp # M2m Services [Carlos_Arteaga_2] [Carlos_Arteaga_2] 2004-11 -marathontp 8384/udp # Marathon Transport Protocol [Inertia_Systemes] [Jasmin_Blouin] 2015-06-11 -# 8384 tcp Reserved -# 8385-8399 Unassigned -cvd 8400/tcp # cvd [Aaron_Bilbrey] [Aaron_Bilbrey] -cvd 8400/udp # cvd [Aaron_Bilbrey] [Aaron_Bilbrey] -sabarsd 8401/tcp # sabarsd [Aaron_Bilbrey] [Aaron_Bilbrey] -sabarsd 8401/udp # sabarsd [Aaron_Bilbrey] [Aaron_Bilbrey] -abarsd 8402/tcp # abarsd [Aaron_Bilbrey] [Aaron_Bilbrey] -abarsd 8402/udp # abarsd [Aaron_Bilbrey] [Aaron_Bilbrey] -admind 8403/tcp # admind [Aaron_Bilbrey] [Aaron_Bilbrey] -admind 8403/udp # admind [Aaron_Bilbrey] [Aaron_Bilbrey] -svcloud 8404/tcp # SuperVault Cloud [Nine_Technology_LLC] [Alex_Stoev] 2009-09-14 2011-08-01 -# 8404 udp Reserved -svbackup 8405/tcp # SuperVault Backup [Nine_Technology_LLC] [Alex_Stoev] 2009-09-14 2011-08-01 -# 8405 udp Reserved -# 8406-8414 Unassigned -dlpx-sp 8415/tcp # Delphix Session Protocol [Delphix_Corp] [Peng_Dai] 2012-11-01 -# 8415 udp Reserved -espeech 8416/tcp # eSpeech Session Protocol [Scott_Tarone] [Scott_Tarone] 2002-11 -espeech 8416/udp # eSpeech Session Protocol [Scott_Tarone] [Scott_Tarone] 2002-11 -espeech-rtp 8417/tcp # eSpeech RTP Protocol [Scott_Tarone] [Scott_Tarone] 2003-04 -espeech-rtp 8417/udp # eSpeech RTP Protocol [Scott_Tarone] [Scott_Tarone] 2003-04 -# 8418-8441 Unassigned -cybro-a-bus 8442/tcp # CyBro A-bus Protocol [Damir_Skrjanec] [Damir_Skrjanec] 2007-05 -cybro-a-bus 8442/udp # CyBro A-bus Protocol [Damir_Skrjanec] [Damir_Skrjanec] 2007-05 -pcsync-https 8443/tcp # PCsync HTTPS -pcsync-https 8443/udp # PCsync HTTPS -pcsync-http 8444/tcp # PCsync HTTP [Katy_Lynn_McCullough] [Katy_Lynn_McCullough] -pcsync-http 8444/udp # PCsync HTTP [Katy_Lynn_McCullough] [Katy_Lynn_McCullough] -copy 8445/tcp # Port for copy peer sync [Copy] [Jason_Dictos] 2012-09-19 -# feature -copy-disc 8445/udp # Port for copy discovery [Copy] [Jason_Dictos] 2012-09-19 -# 8446-8449 Unassigned -npmp 8450/tcp # npmp [Ian_Chard] [Ian_Chard] -npmp 8450/udp # npmp [Ian_Chard] [Ian_Chard] -# 8451-8456 Unassigned -nexentamv 8457/tcp # Nexenta Management GUI [Nexenta] [Andrew_Galloway] 2012-12-07 -# 8457 udp Reserved -# 8458-8469 Unassigned -cisco-avp 8470/tcp # Cisco Address Validation [Cullen_Jennings] [Cullen_Jennings] 2009-02-13 -# Protocol -# 8470 udp Reserved -pim-port 8471/tcp # PIM over Reliable Transport [IESG] [IETF_Chair] 2008-08-21 [RFC6559] -pim-port 8471/sctp # PIM over Reliable Transport [IESG] [IETF_Chair] 2008-08-21 [RFC6559] -# 8471 udp Reserved -otv 8472/tcp # Overlay Transport [Dino_Farinacci] [Dino_Farinacci] 2008-01-07 -# Virtualization (OTV) -otv 8472/udp # Overlay Transport [Dino_Farinacci] [Dino_Farinacci] 2008-01-07 -# Virtualization (OTV) -vp2p 8473/tcp # Virtual Point to Point [Jerome_Grimbert] [Jerome_Grimbert] -vp2p 8473/udp # Virtual Point to Point [Jerome_Grimbert] [Jerome_Grimbert] -noteshare 8474/tcp # AquaMinds NoteShare [Michael_McNabb] [Michael_McNabb] 2005-10 -noteshare 8474/udp # AquaMinds NoteShare [Michael_McNabb] [Michael_McNabb] 2005-10 -# 8475-8499 Unassigned -fmtp 8500/tcp # Flight Message Transfer [Eivan_Cerasi] [Eivan_Cerasi] 2003-12 -# Protocol -fmtp 8500/udp # Flight Message Transfer [Eivan_Cerasi] [Eivan_Cerasi] 2003-12 -# Protocol -cmtp-mgt 8501/tcp # CYTEL Message Transfer -# Management -cmtp-av 8501/udp # CYTEL Message Transfer Audio [Frank_Jakel] [Frank_Jakel] 2011-04-29 -# and Video -ftnmtp 8502/tcp # FTN Message Transfer [Yuri_Myakotin] [Yuri_Myakotin] 2014-01-07 -# Protocol -# 8502 udp Reserved -lsp-self-ping 8503/udp # MPLS LSP Self-Ping [IESG] [IETF_Chair] 2015-06-11 2015-11-03 [RFC-ietf-mpls-self-ping-06] -# 8503 tcp Reserved -# 8504-8553 Unassigned -rtsp-alt 8554/tcp # RTSP Alternate (see port [Stephen_Casner_2] [Stephen_Casner_2] -# 554) -rtsp-alt 8554/udp # RTSP Alternate (see port [Stephen_Casner_2] [Stephen_Casner_2] -# 554) -d-fence 8555/tcp # SYMAX D-FENCE [Thomas_Geisel] [Thomas_Geisel] 2003-01 -d-fence 8555/udp # SYMAX D-FENCE [Thomas_Geisel] [Thomas_Geisel] 2003-01 -# 8556-8566 Unassigned -dof-tunnel 8567/tcp # DOF Tunneling Protocol [OpenDOF] [Bryant_Eastham] 2005-08 2015-04-23 -dof-tunnel 8567/udp # DOF Tunneling Protocol [OpenDOF] [Bryant_Eastham] 2005-08 2015-04-23 -# 8568-8599 Unassigned -asterix 8600/tcp # Surveillance Data [Eivan_Cerasi] [Eivan_Cerasi] 2005-11 -asterix 8600/udp # Surveillance Data [Eivan_Cerasi] [Eivan_Cerasi] 2005-11 -# 8601-8608 Unassigned -# 8609 tcp Reserved -canon-cpp-disc 8609/udp # Canon Compact Printer [Canon_Inc] [Ryusuke_Okuhara] 2012-06-08 2012-06-15 -# Protocol Discovery -canon-mfnp 8610/tcp # Canon MFNP Service [Ritsuto_Sako] [Ritsuto_Sako] 2009-05-04 -canon-mfnp 8610/udp # Canon MFNP Service [Ritsuto_Sako] [Ritsuto_Sako] 2009-05-04 -canon-bjnp1 8611/tcp # Canon BJNP Port 1 [Atsushi_Nakamura] [Atsushi_Nakamura] 2003-11 -canon-bjnp1 8611/udp # Canon BJNP Port 1 [Atsushi_Nakamura] [Atsushi_Nakamura] 2003-11 -canon-bjnp2 8612/tcp # Canon BJNP Port 2 [Atsushi_Nakamura] [Atsushi_Nakamura] 2003-11 -canon-bjnp2 8612/udp # Canon BJNP Port 2 [Atsushi_Nakamura] [Atsushi_Nakamura] 2003-11 -canon-bjnp3 8613/tcp # Canon BJNP Port 3 [Atsushi_Nakamura] [Atsushi_Nakamura] 2003-11 -canon-bjnp3 8613/udp # Canon BJNP Port 3 [Atsushi_Nakamura] [Atsushi_Nakamura] 2003-11 -canon-bjnp4 8614/tcp # Canon BJNP Port 4 [Atsushi_Nakamura] [Atsushi_Nakamura] 2003-11 -canon-bjnp4 8614/udp # Canon BJNP Port 4 [Atsushi_Nakamura] [Atsushi_Nakamura] 2003-11 -imink 8615/tcp # Imink Service Control [Canon_Inc] [KEN_ICHI_FUJII] 2011-10-10 -# 8615 udp Reserved -# Unauthorized -# 8616-8664 Unassigned Use Known on -# ports 8616 -# and 8617 -monetra 8665/tcp # Monetra [Main_Street_Softworks] [Brad_House] 2013-04-02 -# 8665 udp Reserved -monetra-admin 8666/tcp # Monetra Administrative [Main_Street_Softworks] [Brad_House] 2013-04-02 -# Access -# 8666 udp Reserved -# 8667-8674 Unassigned -# Motorola Solutions Customer -msi-cps-rm 8675/tcp # Programming Software for [Motorola_Solutions_Inc] [Jenish_Amin] 2012-03-14 -# Radio Management -# Motorola Solutions Customer -msi-cps-rm-disc 8675/udp # Programming Software for [Motorola_Solutions_Inc] [Jenish_Amin] 2012-03-14 -# Radio Management Discovery -# 8676-8685 Unassigned -sun-as-jmxrmi 8686/tcp # Sun App Server - JMX/RMI [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -sun-as-jmxrmi 8686/udp # Sun App Server - JMX/RMI [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -# 8687 Unassigned -openremote-ctrl 8688/tcp # OpenRemote Controller [OpenRemote_Inc] [Juha_Lindfors] 2012-12-18 -# HTTP/REST -# 8688 udp Reserved -# 8689-8698 Unassigned -vnyx 8699/tcp # VNYX Primary Port [Gregg_Green] [Gregg_Green] 2004-11 -# 8699 udp Reserved 2004-11 2013-05-24 This entry is being removed on 2013-05-24. -# 8700-8710 Unassigned -nvc 8711/tcp # Nuance Voice Control [Nuance_Communications_Inc2] [Diego_Negre] 2012-10-05 -# 8711 udp Reserved -# 8712-8731 Unassigned -# 8732 tcp Reserved -dtp-net 8732/udp # DASGIP Net Services [Dr_Matthias_Arnold] [Dr_Matthias_Arnold] 2009-03-23 -ibus 8733/tcp # iBus [Silvano_Maffeis] [Silvano_Maffeis] -ibus 8733/udp # iBus [Silvano_Maffeis] [Silvano_Maffeis] -# 8734-8749 Unassigned -dey-keyneg 8750/tcp # DEY Storage Key Negotiation [DEY_Storage_Systems_Inc] [Garrett_D_Amore] 2013-03-01 -# 8750 udp Reserved -# 8751-8762 Unassigned -mc-appserver 8763/tcp # MC-APPSERVER [Romeo_Kasanwidjojo] [Romeo_Kasanwidjojo] -mc-appserver 8763/udp # MC-APPSERVER [Romeo_Kasanwidjojo] [Romeo_Kasanwidjojo] -openqueue 8764/tcp # OPENQUEUE [Matt_Jensen] [Matt_Jensen] -openqueue 8764/udp # OPENQUEUE [Matt_Jensen] [Matt_Jensen] -ultraseek-http 8765/tcp # Ultraseek HTTP [Walter_Underwood] [Walter_Underwood] -ultraseek-http 8765/udp # Ultraseek HTTP [Walter_Underwood] [Walter_Underwood] -amcs 8766/tcp # Agilent Connectivity Service [Agilent_Technologies_Inc] [Tom_Fay] 2013-01-16 -amcs 8766/udp # Agilent Connectivity Service [Agilent_Technologies_Inc] [Tom_Fay] 2013-01-16 -# 8767-8769 Unassigned -dpap 8770/tcp # Digital Photo Access [Amandeep_Jawa_2] [Amandeep_Jawa_2] 2004-11 Defined TXT keys: txtvers, Version, iPSh Version, Machine ID, -# Protocol (iPhoto) Machine Name, Password -dpap 8770/udp # Digital Photo Access [Amandeep_Jawa_2] [Amandeep_Jawa_2] 2004-11 Defined TXT keys: txtvers, Version, iPSh Version, Machine ID, -# Protocol (iPhoto) Machine Name, Password -# 8771-8777 Unassigned -uec 8778/tcp # Stonebranch Universal [Stonebranch_Inc] [Nathan_Hammond_2] 2013-06-25 -# Enterprise Controller -# 8778 udp Reserved -# 8779-8785 Unassigned -msgclnt 8786/tcp # Message Client -msgclnt 8786/udp # Message Client -msgsrvr 8787/tcp # Message Server [Michael_O_Brien] [Michael_O_Brien] 2003-03 -msgsrvr 8787/udp # Message Server [Michael_O_Brien] [Michael_O_Brien] 2003-03 -# 8788-8792 Unassigned -acd-pm 8793/tcp # Accedian Performance [Marco_Mascitto] [Marco_Mascitto] -# Measurement -acd-pm 8793/udp # Accedian Performance [Marco_Mascitto] [Marco_Mascitto] -# Measurement -# 8794-8799 Unassigned -sunwebadmin 8800/tcp # Sun Web Server Admin Service [Jyri_J_Virkki] [Jyri_J_Virkki] 2005-12 -sunwebadmin 8800/udp # Sun Web Server Admin Service [Jyri_J_Virkki] [Jyri_J_Virkki] 2005-12 -# Known -# 8801-8803 Unassigned UNAUTHORIZED -# USE: Port -# 8801 -truecm 8804/tcp # truecm [Scott_Kramer] [Scott_Kramer] -truecm 8804/udp # truecm [Scott_Kramer] [Scott_Kramer] -# 8805-8872 Unassigned -dxspider 8873/tcp # dxspider linking protocol [Dirk_Koopman] [Dirk_Koopman] 2005-08 -dxspider 8873/udp # dxspider linking protocol [Dirk_Koopman] [Dirk_Koopman] 2005-08 -# 8874-8879 Unassigned -cddbp-alt 8880/tcp # CDDBP [Steve_Scherf] [Steve_Scherf] -cddbp-alt 8880/udp # CDDBP [Steve_Scherf] [Steve_Scherf] -galaxy4d 8881/tcp # Galaxy4D Online Game Engine [Galaxy4D] [Olivier_St-Laurent] 2012-06-18 -# 8881 udp Reserved -# Unauthorized -# 8882 Unassigned Use Known on -# port 8882 -secure-mqtt 8883/tcp # Secure MQTT [OASIS] [Robin_Cover] 2008-02-27 2015-03-06 -secure-mqtt 8883/udp # Secure MQTT [OASIS] [Robin_Cover] 2008-02-27 2015-03-06 -# 8884-8887 Unassigned -# Known -ddi-tcp-1 8888/tcp # NewsEDGE server TCP (TCP 1) [Fred_Yao] [Fred_Yao] Unauthorized -# Use on port -# 8888 -# Known -ddi-udp-1 8888/udp # NewsEDGE server UDP (UDP 1) [Fred_Yao] [Fred_Yao] Unauthorized -# Use on port -# 8888 -# Known -ddi-tcp-2 8889/tcp # Desktop Data TCP 1 [Fred_Yao] [Fred_Yao] Unauthorized -# Use on port -# 8889 -# Known -ddi-udp-2 8889/udp # NewsEDGE server broadcast [Fred_Yao] [Fred_Yao] Unauthorized -# Use on port -# 8889 -# Known -ddi-tcp-3 8890/tcp # Desktop Data TCP 2 [Fred_Yao] [Fred_Yao] Unauthorized -# Use on port -# 8890 -# Known -ddi-udp-3 8890/udp # NewsEDGE client broadcast [Fred_Yao] [Fred_Yao] Unauthorized -# Use on port -# 8890 -ddi-tcp-4 8891/tcp # Desktop Data TCP 3: NESS [Fred_Yao] [Fred_Yao] -# application -ddi-udp-4 8891/udp # Desktop Data UDP 3: NESS [Fred_Yao] [Fred_Yao] -# application -ddi-tcp-5 8892/tcp # Desktop Data TCP 4: FARM [Fred_Yao] [Fred_Yao] -# product -ddi-udp-5 8892/udp # Desktop Data UDP 4: FARM [Fred_Yao] [Fred_Yao] -# product -ddi-tcp-6 8893/tcp # Desktop Data TCP 5: [Fred_Yao] [Fred_Yao] -# NewsEDGE/Web application -ddi-udp-6 8893/udp # Desktop Data UDP 5: [Fred_Yao] [Fred_Yao] -# NewsEDGE/Web application -ddi-tcp-7 8894/tcp # Desktop Data TCP 6: COAL [Fred_Yao] [Fred_Yao] -# application -ddi-udp-7 8894/udp # Desktop Data UDP 6: COAL [Fred_Yao] [Fred_Yao] -# application -# 8895-8898 Unassigned -ospf-lite 8899/tcp # ospf-lite [Matthew_Thomas] [Matthew_Thomas] 2008-01-07 -ospf-lite 8899/udp # ospf-lite [Matthew_Thomas] [Matthew_Thomas] 2008-01-07 -jmb-cds1 8900/tcp # JMB-CDS 1 [Curtis_Bray] [Curtis_Bray] -jmb-cds1 8900/udp # JMB-CDS 1 [Curtis_Bray] [Curtis_Bray] -jmb-cds2 8901/tcp # JMB-CDS 2 [Curtis_Bray] [Curtis_Bray] -jmb-cds2 8901/udp # JMB-CDS 2 [Curtis_Bray] [Curtis_Bray] -# 8902-8909 Unassigned -manyone-http 8910/tcp # manyone-http [Matt_King] [Matt_King] 2002-04 -manyone-http 8910/udp # manyone-http [Matt_King] [Matt_King] 2002-04 -manyone-xml 8911/tcp # manyone-xml [Matt_King] [Matt_King] 2002-04 -manyone-xml 8911/udp # manyone-xml [Matt_King] [Matt_King] 2002-04 -wcbackup 8912/tcp # Windows Client Backup [Jim_Lyon] [Jim_Lyon] 2005-11 -wcbackup 8912/udp # Windows Client Backup [Jim_Lyon] [Jim_Lyon] 2005-11 -dragonfly 8913/tcp # Dragonfly System Service [Paul_Hodara] [Paul_Hodara] 2005-11 -dragonfly 8913/udp # Dragonfly System Service [Paul_Hodara] [Paul_Hodara] 2005-11 -# 8914-8936 Unassigned -twds 8937/tcp # Transaction Warehouse Data [Lance_M_Steenson] [Lance_M_Steenson] 2009-09-18 -# Service -# 8937 udp Reserved -# 8938-8952 Unassigned -ub-dns-control 8953/tcp # unbound dns nameserver [NLnet_Labs_Support] [NLnet_Labs_Support] 2011-05-10 2011-07-11 -# control -# 8953 udp Reserved -cumulus-admin 8954/tcp # Cumulus Admin Port [Thomas_Schleu] [Thomas_Schleu] -cumulus-admin 8954/udp # Cumulus Admin Port [Thomas_Schleu] [Thomas_Schleu] -# 8955-8979 Unassigned -nod-provider 8980/tcp # Network of Devices Provider [David_Muller] [David_Muller] 2015-02-22 -nod-provider 8980/udp # Network of Devices Provider [David_Muller] [David_Muller] 2015-02-22 -nod-client 8981/udp # Network of Devices Client [David_Muller] [David_Muller] 2015-02-22 -# 8981 tcp Reserved -# 8982-8988 Unassigned -sunwebadmins 8989/tcp # Sun Web Server SSL Admin [Jyri_J_Virkki] [Jyri_J_Virkki] 2005-12 -# Service -sunwebadmins 8989/udp # Sun Web Server SSL Admin [Jyri_J_Virkki] [Jyri_J_Virkki] 2005-12 -# Service -http-wmap 8990/tcp # webmail HTTP service [Fred_Batty] [Fred_Batty] 2007-12-03 -http-wmap 8990/udp # webmail HTTP service [Fred_Batty] [Fred_Batty] 2007-12-03 -https-wmap 8991/tcp # webmail HTTPS service [Fred_Batty] [Fred_Batty] 2007-12-03 -https-wmap 8991/udp # webmail HTTPS service [Fred_Batty] [Fred_Batty] 2007-12-03 -# 8992-8996 Unassigned -oracle-ms-ens 8997/tcp # Oracle Messaging Server [Oracle_6] [Hubert_Vijay_Arokiasamy] 2014-10-28 -# Event Notification Service -# 8997 udp Reserved -canto-roboflow 8998/tcp # Canto RoboFlow Control [Canto] [Thomas_Schleu_2] 2014-02-26 -# 8998 udp Reserved -bctp 8999/tcp # Brodos Crypto Trade Protocol [Alexander_Sahler] [Alexander_Sahler] 2002-02 -bctp 8999/udp # Brodos Crypto Trade Protocol [Alexander_Sahler] [Alexander_Sahler] 2002-02 -cslistener 9000/tcp # CSlistener [David_Jones] [David_Jones] -cslistener 9000/udp # CSlistener [David_Jones] [David_Jones] -# Known -etlservicemgr 9001/tcp # ETL Service Manager [Stephen_McCrea] [Stephen_McCrea] 2002-03 Unauthorized -# Use on port -# 9001 -# Known -etlservicemgr 9001/udp # ETL Service Manager [Stephen_McCrea] [Stephen_McCrea] 2002-03 Unauthorized -# Use on port -# 9001 -dynamid 9002/tcp # DynamID authentication [Jerome_Dusautois] [Jerome_Dusautois] 2002-03 -dynamid 9002/udp # DynamID authentication [Jerome_Dusautois] [Jerome_Dusautois] 2002-03 -# 9003-9004 Unassigned -golem 9005/tcp # Golem Inter-System RPC [Jose_Luis_Tallon] [Jose_Luis_Tallon] 2015-03-09 -# 9005 udp Reserved -# 9006 De-Commissioned Port 2000-02-24 -# 9007 tcp Reserved -ogs-client 9007/udp # Open Grid Services Client [Gareth_Nelson_2] [Gareth_Nelson_2] 2008-08-22 -ogs-server 9008/tcp # Open Grid Services Server [Gareth_Nelson_2] [Gareth_Nelson_2] 2008-08-22 -# 9008 udp Reserved -pichat 9009/tcp # Pichat Server [Mark_Seuffert] [Mark_Seuffert] 2004-11 -pichat 9009/udp # Pichat Server [Mark_Seuffert] [Mark_Seuffert] 2004-11 -sdr 9010/tcp # Secure Data Replicator [Sufyan_Almajali] [Sufyan_Almajali] 2008-06-27 -# Protocol -# 9010 udp Reserved -# 9011-9019 Unassigned -tambora 9020/tcp # TAMBORA [Jason_van_Zyl] [Jason_van_Zyl] 2002-03 -tambora 9020/udp # TAMBORA [Jason_van_Zyl] [Jason_van_Zyl] 2002-03 -panagolin-ident 9021/tcp # Pangolin Identification [William_Benner_2] [William_Benner_2] 2002-03 -panagolin-ident 9021/udp # Pangolin Identification [William_Benner_2] [William_Benner_2] 2002-03 -paragent 9022/tcp # PrivateArk Remote Agent [Gal_Cucuy] [Gal_Cucuy] 2002-03 -paragent 9022/udp # PrivateArk Remote Agent [Gal_Cucuy] [Gal_Cucuy] 2002-03 -swa-1 9023/tcp # Secure Web Access - 1 [Tim_McGranaghan] [Tim_McGranaghan] -swa-1 9023/udp # Secure Web Access - 1 [Tim_McGranaghan] [Tim_McGranaghan] -swa-2 9024/tcp # Secure Web Access - 2 [Tim_McGranaghan] [Tim_McGranaghan] -swa-2 9024/udp # Secure Web Access - 2 [Tim_McGranaghan] [Tim_McGranaghan] -swa-3 9025/tcp # Secure Web Access - 3 [Tim_McGranaghan] [Tim_McGranaghan] -swa-3 9025/udp # Secure Web Access - 3 [Tim_McGranaghan] [Tim_McGranaghan] -swa-4 9026/tcp # Secure Web Access - 4 [Tim_McGranaghan] [Tim_McGranaghan] -swa-4 9026/udp # Secure Web Access - 4 [Tim_McGranaghan] [Tim_McGranaghan] -# 9027-9049 Unassigned -versiera 9050/tcp # Versiera Agent Listener [Frank_Pikelner] [Frank_Pikelner] 2010-01-15 -# 9050 udp Reserved -fio-cmgmt 9051/tcp # Fusion-io Central Manager [Jim_Sermersheim] [Jim_Sermersheim] 2010-01-15 -# Service -# 9051 udp Reserved -# 9052-9079 Unassigned -glrpc 9080/tcp # Groove GLRPC [Adrian_Popescu] [Adrian_Popescu] 2002-09 -glrpc 9080/udp # Groove GLRPC [Adrian_Popescu] [Adrian_Popescu] 2002-09 -# 9081 Unassigned -lcs-ap 9082/sctp # LCS Application Protocol [Kimmo_Kymalainen] [Kimmo_Kymalainen] 2010-06-04 -emc-pp-mgmtsvc 9083/tcp # EMC PowerPath Mgmt Service [Jim_Perreault] [Jim_Perreault] 2010-06-04 -# 9083 udp Reserved -aurora 9084/tcp # IBM AURORA Performance [Jeroen_Massar_2] [Jeroen_Massar_2] 2008-08-21 -# Visualizer -aurora 9084/udp # IBM AURORA Performance [Jeroen_Massar_2] [Jeroen_Massar_2] 2008-08-21 -# Visualizer -aurora 9084/sctp # IBM AURORA Performance [Jeroen_Massar_2] [Jeroen_Massar_2] 2008-08-21 -# Visualizer -ibm-rsyscon 9085/tcp # IBM Remote System Console [William_LePera] [William_LePera] 2008-06-18 -ibm-rsyscon 9085/udp # IBM Remote System Console [William_LePera] [William_LePera] 2008-06-18 -net2display 9086/tcp # Vesa Net2Display [Kenneth_B_Ocheltree] [Kenneth_B_Ocheltree] 2008-01-07 -net2display 9086/udp # Vesa Net2Display [Kenneth_B_Ocheltree] [Kenneth_B_Ocheltree] 2008-01-07 -classic 9087/tcp # Classic Data Server [Paul_Cadarette] [Paul_Cadarette] 2007-01 -classic 9087/udp # Classic Data Server [Paul_Cadarette] [Paul_Cadarette] 2007-01 -sqlexec 9088/tcp # IBM Informix SQL Interface [Jonathan_Leffler] [Jonathan_Leffler] 2005-12 -sqlexec 9088/udp # IBM Informix SQL Interface [Jonathan_Leffler] [Jonathan_Leffler] 2005-12 -sqlexec-ssl 9089/tcp # IBM Informix SQL Interface - [Jonathan_Leffler] [Jonathan_Leffler] 2005-12 -# Encrypted -sqlexec-ssl 9089/udp # IBM Informix SQL Interface - [Jonathan_Leffler] [Jonathan_Leffler] 2005-12 -# Encrypted -websm 9090/tcp # WebSM [I_Hsing_Tsao] [I_Hsing_Tsao] -websm 9090/udp # WebSM [I_Hsing_Tsao] [I_Hsing_Tsao] -xmltec-xmlmail 9091/tcp # xmltec-xmlmail [Mitch_Kaufman] [Mitch_Kaufman] -xmltec-xmlmail 9091/udp # xmltec-xmlmail [Mitch_Kaufman] [Mitch_Kaufman] -XmlIpcRegSvc 9092/tcp # Xml-Ipc Server Reg [Casey_Harrington] [Casey_Harrington] 2006-01 -XmlIpcRegSvc 9092/udp # Xml-Ipc Server Reg [Casey_Harrington] [Casey_Harrington] 2006-01 -copycat 9093/tcp # Copycat database replication [Microtec_Informatique] [Raphael_Neve] 2012-03-15 -# service -# 9093 udp Reserved -# 9094-9099 Unassigned -hp-pdl-datastr 9100/tcp # PDL Data Streaming Port [Shivaun_Albright] [Shivaun_Albright] 2002-04 -hp-pdl-datastr 9100/udp # PDL Data Streaming Port [Shivaun_Albright] [Shivaun_Albright] 2002-04 -# The protocol name "pdl-datastream" is primarily registered -pdl-datastream 9100/tcp # Printer PDL Data Stream [Stuart_Cheshire_4] [Stuart_Cheshire_4] 2002-09 for use in DNS SRV records (RFC 2782). DNS SRV records allow -# a protocol to run on any port number, but the default port -# for this protocol is 9100. -# The protocol name "pdl-datastream" is primarily registered -pdl-datastream 9100/udp # Printer PDL Data Stream [Stuart_Cheshire_4] [Stuart_Cheshire_4] 2002-09 for use in DNS SRV records (RFC 2782). DNS SRV records allow -# a protocol to run on any port number, but the default port -# for this protocol is 9100. -bacula-dir 9101/tcp # Bacula Director [Kern_Sibbald] [Kern_Sibbald] 2002-01 -bacula-dir 9101/udp # Bacula Director [Kern_Sibbald] [Kern_Sibbald] 2002-01 -bacula-fd 9102/tcp # Bacula File Daemon [Kern_Sibbald] [Kern_Sibbald] 2002-01 -bacula-fd 9102/udp # Bacula File Daemon [Kern_Sibbald] [Kern_Sibbald] 2002-01 -bacula-sd 9103/tcp # Bacula Storage Daemon [Kern_Sibbald] [Kern_Sibbald] 2002-01 -bacula-sd 9103/udp # Bacula Storage Daemon [Kern_Sibbald] [Kern_Sibbald] 2002-01 -peerwire 9104/tcp # PeerWire [Steven_Gerhardt] [Steven_Gerhardt] 2004-02 -peerwire 9104/udp # PeerWire [Steven_Gerhardt] [Steven_Gerhardt] 2004-02 -# [Ari√´n Huisken -xadmin 9105/tcp # Xadmin Control Service 15 -# June 2009] -# [Ari√´n Huisken -xadmin 9105/udp # Xadmin Control Service 15 -# June 2009] -astergate 9106/tcp # Astergate Control Service [Ari_Huisken] [Ari_Huisken] 2010-01-04 -astergate-disc 9106/udp # Astergate Discovery Service [Ari_Huisken] [Ari_Huisken] 2010-01-04 -astergatefax 9107/tcp # AstergateFax Control Service [Gijs_Middelkamp] [Gijs_Middelkamp] 2010-02-03 -# 9107 udp Reserved -# 9108-9118 Unassigned -mxit 9119/tcp # MXit Instant Messaging [Marnus_Freeman] [Marnus_Freeman] 2006-02 -mxit 9119/udp # MXit Instant Messaging [Marnus_Freeman] [Marnus_Freeman] 2006-02 -# 9120-9121 Unassigned -# Global Relay compliant -grcmp 9122/tcp # mobile instant messaging [Global_Relay] [Mike_Sample] 2012-11-28 -# protocol -# 9122 udp Reserved -grcp 9123/tcp # Global Relay compliant [Global_Relay] [Mike_Sample] 2012-11-28 -# instant messaging protocol -# 9123 udp Reserved -# 9124-9130 Unassigned -dddp 9131/tcp # Dynamic Device Discovery [Shane_Dick] [Shane_Dick] 2005-08 -dddp 9131/udp # Dynamic Device Discovery [Shane_Dick] [Shane_Dick] 2005-08 -# 9132-9159 Unassigned -apani1 9160/tcp # apani1 [Neal_Taylor] [Neal_Taylor] -apani1 9160/udp # apani1 [Neal_Taylor] [Neal_Taylor] -apani2 9161/tcp # apani2 [Neal_Taylor] [Neal_Taylor] -apani2 9161/udp # apani2 [Neal_Taylor] [Neal_Taylor] -apani3 9162/tcp # apani3 [Neal_Taylor] [Neal_Taylor] -apani3 9162/udp # apani3 [Neal_Taylor] [Neal_Taylor] -apani4 9163/tcp # apani4 [Neal_Taylor] [Neal_Taylor] -apani4 9163/udp # apani4 [Neal_Taylor] [Neal_Taylor] -apani5 9164/tcp # apani5 [Neal_Taylor] [Neal_Taylor] -apani5 9164/udp # apani5 [Neal_Taylor] [Neal_Taylor] -# 9165-9190 Unassigned -sun-as-jpda 9191/tcp # Sun AppSvr JPDA [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -sun-as-jpda 9191/udp # Sun AppSvr JPDA [Abhijit_Kumar] [Abhijit_Kumar] 2005-11 -# 9192-9199 Unassigned -wap-wsp 9200/tcp # WAP connectionless session [WAP_Forum] [WAP_Forum] -# service -wap-wsp 9200/udp # WAP connectionless session [WAP_Forum] [WAP_Forum] -# service -wap-wsp-wtp 9201/tcp # WAP session service [WAP_Forum] [WAP_Forum] -wap-wsp-wtp 9201/udp # WAP session service [WAP_Forum] [WAP_Forum] -wap-wsp-s 9202/tcp # WAP secure connectionless [WAP_Forum] [WAP_Forum] -# session service -wap-wsp-s 9202/udp # WAP secure connectionless [WAP_Forum] [WAP_Forum] -# session service -wap-wsp-wtp-s 9203/tcp # WAP secure session service [WAP_Forum] [WAP_Forum] -wap-wsp-wtp-s 9203/udp # WAP secure session service [WAP_Forum] [WAP_Forum] -wap-vcard 9204/tcp # WAP vCard [WAP_Forum] [WAP_Forum] -wap-vcard 9204/udp # WAP vCard [WAP_Forum] [WAP_Forum] -wap-vcal 9205/tcp # WAP vCal [WAP_Forum] [WAP_Forum] -wap-vcal 9205/udp # WAP vCal [WAP_Forum] [WAP_Forum] -wap-vcard-s 9206/tcp # WAP vCard Secure [WAP_Forum] [WAP_Forum] -wap-vcard-s 9206/udp # WAP vCard Secure [WAP_Forum] [WAP_Forum] -wap-vcal-s 9207/tcp # WAP vCal Secure [WAP_Forum] [WAP_Forum] -wap-vcal-s 9207/udp # WAP vCal Secure [WAP_Forum] [WAP_Forum] -rjcdb-vcards 9208/tcp # rjcdb vCard [Robert_John_Churchil] [Robert_John_Churchil] 2006-01 -rjcdb-vcards 9208/udp # rjcdb vCard [Robert_John_Churchil] [Robert_John_Churchil] 2006-01 -almobile-system 9209/tcp # ALMobile System Service [Rob_Graber] [Rob_Graber] 2006-01 -almobile-system 9209/udp # ALMobile System Service [Rob_Graber] [Rob_Graber] 2006-01 -oma-mlp 9210/tcp # OMA Mobile Location Protocol [Hans_Rohnert] [Hans_Rohnert] 2002-04 -oma-mlp 9210/udp # OMA Mobile Location Protocol [Hans_Rohnert] [Hans_Rohnert] 2002-04 -oma-mlp-s 9211/tcp # OMA Mobile Location Protocol [Hans_Rohnert] [Hans_Rohnert] 2002-04 -# Secure -oma-mlp-s 9211/udp # OMA Mobile Location Protocol [Hans_Rohnert] [Hans_Rohnert] 2002-04 -# Secure -serverviewdbms 9212/tcp # Server View dbms access [Detlef_Rothe] [Detlef_Rothe] 2009-05-15 -serverviewdbms 9212/udp # Server View dbms access [Detlef_Rothe] [Detlef_Rothe] 2009-05-15 -serverstart 9213/tcp # ServerStart RemoteControl [Detlef_Rothe] [Detlef_Rothe] 2009-05-15 -serverstart 9213/udp # ServerStart RemoteControl [Detlef_Rothe] [Detlef_Rothe] 2009-05-15 -ipdcesgbs 9214/tcp # IPDC ESG BootstrapService [Joerg_Heuer] [Joerg_Heuer] 2006-02 -ipdcesgbs 9214/udp # IPDC ESG BootstrapService [Joerg_Heuer] [Joerg_Heuer] 2006-02 -insis 9215/tcp # Integrated Setup and Install [Markus_Treinen] [Markus_Treinen] 2006-02 -# Service -insis 9215/udp # Integrated Setup and Install [Markus_Treinen] [Markus_Treinen] 2006-02 -# Service -acme 9216/tcp # Aionex Communication [Mark_Sapp] [Mark_Sapp] 2006-04 -# Management Engine -acme 9216/udp # Aionex Communication [Mark_Sapp] [Mark_Sapp] 2006-04 -# Management Engine -fsc-port 9217/tcp # FSC Communication Port [Teijo_Mustonen] [Teijo_Mustonen] 2002-03 -fsc-port 9217/udp # FSC Communication Port [Teijo_Mustonen] [Teijo_Mustonen] 2002-03 -# 9218-9221 Unassigned -teamcoherence 9222/tcp # QSC Team Coherence [Ewan_McNab] [Ewan_McNab] 2004-11 -teamcoherence 9222/udp # QSC Team Coherence [Ewan_McNab] [Ewan_McNab] 2004-11 -# 9223-9254 Unassigned -mon 9255/tcp # Manager On Network [David_Rouchet] [David_Rouchet] 2007-05 -mon 9255/udp # Manager On Network [David_Rouchet] [David_Rouchet] 2007-05 -# 9256-9276 Unassigned -traingpsdata 9277/udp # GPS Data transmitted from [Alstom_Transport_Preston] [Paul_Steane] 2012-12-14 -# train to ground network -# 9277 tcp Reserved -pegasus 9278/tcp # Pegasus GPS Platform [Nestor_A_Diaz] [Nestor_A_Diaz] 2009-05-12 -pegasus 9278/udp # Pegasus GPS Platform [Nestor_A_Diaz] [Nestor_A_Diaz] 2009-05-12 -pegasus-ctl 9279/tcp # Pegaus GPS System Control [Nestor_A_Diaz] [Nestor_A_Diaz] 2009-05-12 -# Interface -pegasus-ctl 9279/udp # Pegaus GPS System Control [Nestor_A_Diaz] [Nestor_A_Diaz] 2009-05-12 -# Interface -pgps 9280/tcp # Predicted GPS [Jeremy_Freeman] [Jeremy_Freeman] 2008-02-14 -pgps 9280/udp # Predicted GPS [Jeremy_Freeman] [Jeremy_Freeman] 2008-02-14 -swtp-port1 9281/tcp # SofaWare transport port 1 [Amir_Rapson] [Amir_Rapson] 2002-02 -swtp-port1 9281/udp # SofaWare transport port 1 [Amir_Rapson] [Amir_Rapson] 2002-02 -swtp-port2 9282/tcp # SofaWare transport port 2 [Amir_Rapson] [Amir_Rapson] 2002-02 -swtp-port2 9282/udp # SofaWare transport port 2 [Amir_Rapson] [Amir_Rapson] 2002-02 -callwaveiam 9283/tcp # CallWaveIAM [Colin_Kelley] [Colin_Kelley] -callwaveiam 9283/udp # CallWaveIAM [Colin_Kelley] [Colin_Kelley] -visd 9284/tcp # VERITAS Information Serve [Ravi_Tavakely] [Ravi_Tavakely] 2002-02 -visd 9284/udp # VERITAS Information Serve [Ravi_Tavakely] [Ravi_Tavakely] 2002-02 -n2h2server 9285/tcp # N2H2 Filter Service Port [Jim_Irwin] [Jim_Irwin] 2002-02 -n2h2server 9285/udp # N2H2 Filter Service Port [Jim_Irwin] [Jim_Irwin] 2002-02 -# 9286 tcp Reserved -n2receive 9286/udp # n2 monitoring receiver [Peter_van_Dijk] [Peter_van_Dijk] 2011-01-10 -cumulus 9287/tcp # Cumulus [Thomas_Schleu] [Thomas_Schleu] -cumulus 9287/udp # Cumulus [Thomas_Schleu] [Thomas_Schleu] -# 9288-9291 Unassigned -armtechdaemon 9292/tcp # ArmTech Daemon [Rohan_Story] [Rohan_Story] -armtechdaemon 9292/udp # ArmTech Daemon [Rohan_Story] [Rohan_Story] -storview 9293/tcp # StorView Client [Ryan_Smith] [Ryan_Smith] 2006-07 -storview 9293/udp # StorView Client [Ryan_Smith] [Ryan_Smith] 2006-07 -armcenterhttp 9294/tcp # ARMCenter http Service [Eric_Thiebaut_George] [Eric_Thiebaut_George] 2006-04 -armcenterhttp 9294/udp # ARMCenter http Service [Eric_Thiebaut_George] [Eric_Thiebaut_George] 2006-04 -armcenterhttps 9295/tcp # ARMCenter https Service [Eric_Thiebaut_George] [Eric_Thiebaut_George] 2006-04 -armcenterhttps 9295/udp # ARMCenter https Service [Eric_Thiebaut_George] [Eric_Thiebaut_George] 2006-04 -# 9296-9299 Unassigned -vrace 9300/tcp # Virtual Racing Service [Pete_Loeffen] [Pete_Loeffen] 2006-10 -vrace 9300/udp # Virtual Racing Service [Pete_Loeffen] [Pete_Loeffen] 2006-10 -# 9301-9305 Unassigned -sphinxql 9306/tcp # Sphinx search server (MySQL [Andrew_Aksyonoff] [Andrew_Aksyonoff] 2009-10-20 -# listener) -# 9306 udp Reserved -# 9307-9311 Unassigned -sphinxapi 9312/tcp # Sphinx search server [Andrew_Aksyonoff] [Andrew_Aksyonoff] 2009-10-20 -# 9312 udp Reserved -# 9313-9317 Unassigned -secure-ts 9318/tcp # PKIX TimeStamp over TLS [Niklas_Weiss] [Niklas_Weiss] 2004-11 -secure-ts 9318/udp # PKIX TimeStamp over TLS [Niklas_Weiss] [Niklas_Weiss] 2004-11 -# 9319-9320 Unassigned -guibase 9321/tcp # guibase [Yutaka_Ono] [Yutaka_Ono] -guibase 9321/udp # guibase [Yutaka_Ono] [Yutaka_Ono] -# 9322-9342 Unassigned -mpidcmgr 9343/tcp # MpIdcMgr [Yutaka_Ono] [Yutaka_Ono] -mpidcmgr 9343/udp # MpIdcMgr [Yutaka_Ono] [Yutaka_Ono] -mphlpdmc 9344/tcp # Mphlpdmc [Yutaka_Ono] [Yutaka_Ono] -mphlpdmc 9344/udp # Mphlpdmc [Yutaka_Ono] [Yutaka_Ono] -rancher 9345/tcp # Rancher Agent [Rancher_Labs_Inc] [Vincent_Fiduccia] 2015-04-14 -# 9345 udp Reserved -ctechlicensing 9346/tcp # C Tech Licensing [Reed_Copsey_Jr] [Reed_Copsey_Jr] -ctechlicensing 9346/udp # C Tech Licensing [Reed_Copsey_Jr] [Reed_Copsey_Jr] -# 9347-9373 Unassigned -fjdmimgr 9374/tcp # fjdmimgr [Yutaka_Ono] [Yutaka_Ono] -fjdmimgr 9374/udp # fjdmimgr [Yutaka_Ono] [Yutaka_Ono] -# 9375-9379 Unassigned -boxp 9380/tcp # Brivs! Open Extensible [Danko_Alexeyev] [Danko_Alexeyev] 2007-08-08 -# Protocol -boxp 9380/udp # Brivs! Open Extensible [Danko_Alexeyev] [Danko_Alexeyev] 2007-08-08 -# Protocol -# 9381-9386 Unassigned -d2dconfig 9387/tcp # D2D Configuration Service [Pete_Camble] [Pete_Camble] 2008-12-24 -# 9387 udp Reserved -d2ddatatrans 9388/tcp # D2D Data Transfer Service [Pete_Camble] [Pete_Camble] 2008-12-24 -# 9388 udp Reserved -adws 9389/tcp # Active Directory Web [Nitin_Gupta] [Nitin_Gupta] 2008-12-24 -# Services -# 9389 udp Reserved -otp 9390/tcp # OpenVAS Transfer Protocol [Tim_Brown] [Tim_Brown] 2008-12-24 -# 9390 udp Reserved -# 9391-9395 Unassigned -fjinvmgr 9396/tcp # fjinvmgr [Yutaka_Ono] [Yutaka_Ono] -fjinvmgr 9396/udp # fjinvmgr [Yutaka_Ono] [Yutaka_Ono] -mpidcagt 9397/tcp # MpIdcAgt [Yutaka_Ono] [Yutaka_Ono] -mpidcagt 9397/udp # MpIdcAgt [Yutaka_Ono] [Yutaka_Ono] -# 9398-9399 Unassigned -sec-t4net-srv 9400/tcp # Samsung Twain for Network [Dongkeun_Kim] [Dongkeun_Kim] 2007-02 -# Server -sec-t4net-srv 9400/udp # Samsung Twain for Network [Dongkeun_Kim] [Dongkeun_Kim] 2007-02 -# Server -sec-t4net-clt 9401/tcp # Samsung Twain for Network [Dongkeun_Kim] [Dongkeun_Kim] 2007-02 -# Client -sec-t4net-clt 9401/udp # Samsung Twain for Network [Dongkeun_Kim] [Dongkeun_Kim] 2007-02 -# Client -sec-pc2fax-srv 9402/tcp # Samsung PC2FAX for Network [HyeongBae_Yu] [HyeongBae_Yu] 2008-07-31 -# Server -sec-pc2fax-srv 9402/udp # Samsung PC2FAX for Network [HyeongBae_Yu] [HyeongBae_Yu] 2008-07-31 -# Server -# 9403-9417 Unassigned -git 9418/tcp # git pack transfer service [Linus_Torvalds] [Linus_Torvalds] 2005-09 -git 9418/udp # git pack transfer service [Linus_Torvalds] [Linus_Torvalds] 2005-09 -# 9419-9442 Unassigned -tungsten-https 9443/tcp # WSO2 Tungsten HTTPS [Afkham_Azeez] [Afkham_Azeez] 2006-06 -tungsten-https 9443/udp # WSO2 Tungsten HTTPS [Afkham_Azeez] [Afkham_Azeez] 2006-06 -wso2esb-console 9444/tcp # WSO2 ESB Administration [Ruwan_Linton] [Ruwan_Linton] 2008-08-20 -# Console HTTPS -wso2esb-console 9444/udp # WSO2 ESB Administration [Ruwan_Linton] [Ruwan_Linton] 2008-08-20 -# Console HTTPS -mindarray-ca 9445/tcp # MindArray Systems Console [MINDARRAY_SYSTEMS] [ALPESH_DHAMELIA] 2011-10-25 -# Agent -# 9445 udp Reserved -# 9446-9449 Unassigned -sntlkeyssrvr 9450/tcp # Sentinel Keys Server [Martin_Ziskind] [Martin_Ziskind] 2008-08-21 -sntlkeyssrvr 9450/udp # Sentinel Keys Server [Martin_Ziskind] [Martin_Ziskind] 2008-08-21 -# 9451-9499 Unassigned -ismserver 9500/tcp # ismserver [Ian_Gordon_3] [Ian_Gordon_3] -ismserver 9500/udp # ismserver [Ian_Gordon_3] [Ian_Gordon_3] -# 9501-9521 Unassigned -# 9522 tcp Reserved -sma-spw 9522/udp # SMA Speedwire [SMA_Solar_Techology] [SMA_Solar_Techology] 2011-03-08 -# 9523-9534 Unassigned -mngsuite 9535/tcp # Management Suite Remote [Trevor_Perkes] [Trevor_Perkes] 2010-02-01 -# Control -mngsuite 9535/udp # Management Suite Remote [Trevor_Perkes] [Trevor_Perkes] 2010-02-01 -# Control -laes-bf 9536/tcp # Surveillance buffering [Glen_Myers] [Glen_Myers] 2007-05 -# function -laes-bf 9536/udp # Surveillance buffering [Glen_Myers] [Glen_Myers] 2007-05 -# function -# 9537-9554 Unassigned -trispen-sra 9555/tcp # Trispen Secure Remote Access [Jaco_Botha] [Jaco_Botha] 2004-11 -trispen-sra 9555/udp # Trispen Secure Remote Access [Jaco_Botha] [Jaco_Botha] 2004-11 -# 9556-9591 Unassigned -ldgateway 9592/tcp # LANDesk Gateway [Alan_Butt] [Alan_Butt] 2006-03 -ldgateway 9592/udp # LANDesk Gateway [Alan_Butt] [Alan_Butt] 2006-03 -cba8 9593/tcp # LANDesk Management Agent [Trevor_Perkes] [Trevor_Perkes] 2010-02-01 -# (cba8) -cba8 9593/udp # LANDesk Management Agent [Trevor_Perkes] [Trevor_Perkes] 2010-02-01 -# (cba8) -msgsys 9594/tcp # Message System [Alan_Butt] [Alan_Butt] -msgsys 9594/udp # Message System [Alan_Butt] [Alan_Butt] -pds 9595/tcp # Ping Discovery Service [Alan_Butt] [Alan_Butt] -pds 9595/udp # Ping Discovery Service [Alan_Butt] [Alan_Butt] -mercury-disc 9596/tcp # Mercury Discovery [Paul_Mclachlan] [Paul_Mclachlan] 2005-11 -mercury-disc 9596/udp # Mercury Discovery [Paul_Mclachlan] [Paul_Mclachlan] 2005-11 -pd-admin 9597/tcp # PD Administration [Duk_Loi] [Duk_Loi] 2005-11 -pd-admin 9597/udp # PD Administration [Duk_Loi] [Duk_Loi] 2005-11 -vscp 9598/tcp # Very Simple Ctrl Protocol [Ake_Hedman] [Ake_Hedman] 2005-11 -vscp 9598/udp # Very Simple Ctrl Protocol [Ake_Hedman] [Ake_Hedman] 2005-11 -robix 9599/tcp # Robix [Evan_Rosen] [Evan_Rosen] 2005-11 -robix 9599/udp # Robix [Evan_Rosen] [Evan_Rosen] 2005-11 -micromuse-ncpw 9600/tcp # MICROMUSE-NCPW [Hing_Wing_To_2] [Hing_Wing_To_2] -micromuse-ncpw 9600/udp # MICROMUSE-NCPW [Hing_Wing_To_2] [Hing_Wing_To_2] -# 9601-9611 Unassigned -streamcomm-ds 9612/tcp # StreamComm User Directory [Brian_C_Wiles] [Brian_C_Wiles] -streamcomm-ds 9612/udp # StreamComm User Directory [Brian_C_Wiles] [Brian_C_Wiles] -# 9613 Unassigned -iadt-tls 9614/tcp # iADT Protocol over TLS [Paul_A_Suhler] [Paul_A_Suhler] 2009-02-05 -# 9614 udp Reserved -# 9615 Unassigned -# eRunbook Agent -# -erunbook-agent 9616/tcp # IANA assigned this [Gerhard_Wagner] [Gerhard_Wagner] 2009-03-10 -# well-formed service name as -# a replacement for -# "erunbook_agent". -# This entry is an alias to "erunbook-agent". This entry is now -erunbook_agent 9616/tcp # eRunbook Agent [Gerhard_Wagner] [Gerhard_Wagner] 2009-03-10 historic, not usable for use with many common service -# discovery mechanisms. -# 9616 udp Reserved -# eRunbook Server -# -erunbook-server 9617/tcp # IANA assigned this [Gerhard_Wagner] [Gerhard_Wagner] 2009-03-10 -# well-formed service name as -# a replacement for -# "erunbook_server". -# This entry is an alias to "erunbook-server". This entry is -erunbook_server 9617/tcp # eRunbook Server [Gerhard_Wagner] [Gerhard_Wagner] 2009-03-10 now historic, not usable for use with many common service -# discovery mechanisms. -# 9617 udp Reserved -condor 9618/tcp # Condor Collector Service [Todd_Tannenbaum] [Todd_Tannenbaum] 2008-04-03 -condor 9618/udp # Condor Collector Service [Todd_Tannenbaum] [Todd_Tannenbaum] 2008-04-03 -# 9619-9627 Unassigned -odbcpathway 9628/tcp # ODBC Pathway Service [Adrian_Hungate] [Adrian_Hungate] 2007-05 -odbcpathway 9628/udp # ODBC Pathway Service [Adrian_Hungate] [Adrian_Hungate] 2007-05 -uniport 9629/tcp # UniPort SSO Controller [Adrian_Hungate] [Adrian_Hungate] 2007-09-05 -uniport 9629/udp # UniPort SSO Controller [Adrian_Hungate] [Adrian_Hungate] 2007-09-05 -peoctlr 9630/tcp # Peovica Controller [Adrian_Hungate] [Adrian_Hungate] 2009-09-14 -# 9630 udp Reserved -peocoll 9631/tcp # Peovica Collector [Adrian_Hungate] [Adrian_Hungate] 2009-09-14 -# 9631 udp Reserved -# 9632 tcp Reserved -mc-comm 9632/udp # Mobile-C Communications [David_Ko_2] [David_Ko_2] 2009-09-14 -# 9633-9639 Unassigned -pqsflows 9640/tcp # ProQueSys Flows Service [Sarene_Caiazza] [Sarene_Caiazza] 2010-04-27 -# 9640 udp Reserved -# 9641-9665 Unassigned -zoomcp 9666/tcp # Zoom Control Panel Game [Zoom_Control_Panel] [Joshua_Pedroza] 2014-02-26 -# Server Management -# 9666 udp Reserved -xmms2 9667/tcp # Cross-platform Music [Juho_Herttua] [Juho_Herttua] 2009-04-14 -# Multiplexing System -xmms2 9667/udp # Cross-platform Music [Juho_Herttua] [Juho_Herttua] -# Multiplexing System -tec5-sdctp 9668/tcp # tec5 Spectral Device Control [Michael_Muth] [Michael_Muth] 2009-05-11 -# Protocol -tec5-sdctp 9668/udp # tec5 Spectral Device Control [Michael_Muth] [Michael_Muth] 2009-05-11 -# Protocol -# 9669-9693 Unassigned -client-wakeup 9694/tcp # T-Mobile Client Wakeup [Michael_Schonborn] [Michael_Schonborn] 2009-09-11 -# Message -client-wakeup 9694/udp # T-Mobile Client Wakeup [Michael_Schonborn] [Michael_Schonborn] 2009-09-11 -# Message -ccnx 9695/tcp # Content Centric Networking [Van_Jacobson_2][Simon_Barber] [Van_Jacobson_2][Simon_Barber] 2009-09-29 -ccnx 9695/udp # Content Centric Networking [Van_Jacobson_2][Simon_Barber] [Van_Jacobson_2][Simon_Barber] 2009-09-29 -# 9696-9699 Unassigned -board-roar 9700/tcp # Board M.I.T. Service [Francesco_Rosi] [Francesco_Rosi] 2006-01 -board-roar 9700/udp # Board M.I.T. Service [Francesco_Rosi] [Francesco_Rosi] 2006-01 -# 9701-9746 Unassigned -l5nas-parchan 9747/tcp # L5NAS Parallel Channel [Lawrence_J_Dickson] [Lawrence_J_Dickson] 2002-03 -l5nas-parchan 9747/udp # L5NAS Parallel Channel [Lawrence_J_Dickson] [Lawrence_J_Dickson] 2002-03 -# 9748-9749 Unassigned -board-voip 9750/tcp # Board M.I.T. Synchronous [Francesco_Rosi] [Francesco_Rosi] 2006-01 -# Collaboration -board-voip 9750/udp # Board M.I.T. Synchronous [Francesco_Rosi] [Francesco_Rosi] 2006-01 -# Collaboration -# 9751-9752 Unassigned -rasadv 9753/tcp # rasadv [Dave_Thaler_2] [Dave_Thaler_2] -rasadv 9753/udp # rasadv [Dave_Thaler_2] [Dave_Thaler_2] -# 9754-9761 Unassigned -tungsten-http 9762/tcp # WSO2 Tungsten HTTP [Afkham_Azeez] [Afkham_Azeez] 2006-06 -tungsten-http 9762/udp # WSO2 Tungsten HTTP [Afkham_Azeez] [Afkham_Azeez] 2006-06 -# 9763-9799 Unassigned -davsrc 9800/tcp # WebDav Source Port [Ethan_Fremen] [Ethan_Fremen] -davsrc 9800/udp # WebDav Source Port [Ethan_Fremen] [Ethan_Fremen] -sstp-2 9801/tcp # Sakura Script Transfer [Kouichi_Takeda_2] [Kouichi_Takeda_2] -# Protocol-2 -sstp-2 9801/udp # Sakura Script Transfer [Kouichi_Takeda_2] [Kouichi_Takeda_2] -# Protocol-2 -davsrcs 9802/tcp # WebDAV Source TLS/SSL [Rob_Isaac] [Rob_Isaac] 2003-07 -davsrcs 9802/udp # WebDAV Source TLS/SSL [Rob_Isaac] [Rob_Isaac] 2003-07 -# 9803-9874 Unassigned -sapv1 9875/tcp # Session Announcement v1 [RFC2974] -sapv1 9875/udp # Session Announcement v1 [RFC2974] -sd 9876/tcp # Session Director [Van_Jacobson] [Van_Jacobson] -# 9877 Unassigned -# The KX509 Kerberized Historically, this service has been referred to as -kca-service 9878/udp # Certificate Issuance [IESG] [IETF_Chair] 2012-07-12 [RFC6717] "kca_service", but this service name does not meet the -# Protocol in Use in 2012 registry requirements. -# 9878 tcp Reserved -# 9879-9887 Unassigned -cyborg-systems 9888/tcp # CYBORG Systems [Malcolm_Graham] [Malcolm_Graham] -cyborg-systems 9888/udp # CYBORG Systems [Malcolm_Graham] [Malcolm_Graham] -# Port for Cable network -gt-proxy 9889/tcp # related data proxy or [Dawei_Qi] [Dawei_Qi] 2010-07-07 -# repeater -# Port for Cable network -gt-proxy 9889/udp # related data proxy or [Dawei_Qi] [Dawei_Qi] 2010-07-07 -# repeater -# 9890-9897 Unassigned -monkeycom 9898/tcp # MonkeyCom [Yuji_Kuwabara] [Yuji_Kuwabara] -monkeycom 9898/udp # MonkeyCom [Yuji_Kuwabara] [Yuji_Kuwabara] -# 9899 tcp Reserved 2013-04-10 -sctp-tunneling 9899/udp # SCTP TUNNELING [IESG] [IETF_Chair] 2013-04-10 [RFC6951] -iua 9900/tcp # IUA [Lyndon_Ong_2] [Lyndon_Ong_2] -iua 9900/udp # IUA [Lyndon_Ong_2] [Lyndon_Ong_2] -iua 9900/sctp # IUA [Lyndon_Ong_2] [Lyndon_Ong_2] -enrp 9901/udp # enrp server channel -enrp-sctp 9901/sctp # enrp server channel [RFC5353] -enrp-sctp-tls 9902/sctp # enrp/tls server channel [RFC5353] -# 9903 tcp Reserved -multicast-ping 9903/udp # Multicast Ping Protocol 2011-12-09 [RFC6450] -# 9904-9908 Unassigned -domaintime 9909/tcp # domaintime [Jeffry_Dwight] [Jeffry_Dwight] -domaintime 9909/udp # domaintime [Jeffry_Dwight] [Jeffry_Dwight] -# 9910 Unassigned -sype-transport 9911/tcp # SYPECom Transport Protocol [Sylvain_Pedneault] [Sylvain_Pedneault] 2003-03 -sype-transport 9911/udp # SYPECom Transport Protocol [Sylvain_Pedneault] [Sylvain_Pedneault] 2003-03 -# 9912-9924 Unassigned -xybrid-cloud 9925/tcp # XYBRID Cloud [Rx_Networks_Inc_2] [Drew_Davies_2] 2013-04-25 -# 9925 udp Reserved -# 9926-9949 Unassigned -apc-9950 9950/tcp # APC 9950 [American_Power_Conve] [American_Power_Conve] -apc-9950 9950/udp # APC 9950 [American_Power_Conve] [American_Power_Conve] -apc-9951 9951/tcp # APC 9951 [American_Power_Conve] [American_Power_Conve] -apc-9951 9951/udp # APC 9951 [American_Power_Conve] [American_Power_Conve] -apc-9952 9952/tcp # APC 9952 [American_Power_Conve] [American_Power_Conve] -apc-9952 9952/udp # APC 9952 [American_Power_Conve] [American_Power_Conve] -acis 9953/tcp # 9953 [Thomas_Guth] [Thomas_Guth] 2006-01 -acis 9953/udp # 9953 [Thomas_Guth] [Thomas_Guth] 2006-01 -hinp 9954/tcp # HaloteC Instrument Network [HaloteC_Instruments] [Michel_Stam] 2012-02-07 -# Protocol -# 9954 udp Reserved -alljoyn-stm 9955/tcp # Contact Port for AllJoyn [Qualcomm_Innovation_Center] [Craig_Dowell] 2012-03-14 -# standard messaging -# Contact Port for AllJoyn -alljoyn-mcm 9955/udp # multiplexed constrained [Qualcomm_Innovation_Center] [Craig_Dowell] 2012-03-14 -# messaging -# 9956 tcp Reserved -alljoyn 9956/udp # Alljoyn Name Service [Qualcomm_Innovation_Center] [Craig_Dowell] 2011-12-21 -# 9957-9965 Unassigned -odnsp 9966/tcp # OKI Data Network Setting [Masato_Sato] [Masato_Sato] 2006-05 -# Protocol -odnsp 9966/udp # OKI Data Network Setting [Masato_Sato] [Masato_Sato] 2006-05 -# Protocol -# 9967-9977 Unassigned -xybrid-rt 9978/tcp # XYBRID RT Server [Rx_Networks_Inc] [Drew_Davies] 2013-01-24 -# 9978 udp Reserved -# 9979-9986 Unassigned -dsm-scm-target 9987/tcp # DSM/SCM Target Interface [Mike_Dyslin] [Mike_Dyslin] 2006-08 -dsm-scm-target 9987/udp # DSM/SCM Target Interface [Mike_Dyslin] [Mike_Dyslin] 2006-08 -nsesrvr 9988/tcp # Software Essentials Secure [Narayanan_Raju] [Narayanan_Raju] 2009-02-05 -# HTTP server -# 9988 udp Reserved -# 9989-9989 Unassigned -osm-appsrvr 9990/tcp # OSM Applet Server [Vinay_Gupta] [Vinay_Gupta] 2003-08 -osm-appsrvr 9990/udp # OSM Applet Server [Vinay_Gupta] [Vinay_Gupta] 2003-08 -osm-oev 9991/tcp # OSM Event Server [Vinay_Gupta] [Vinay_Gupta] 2003-08 -osm-oev 9991/udp # OSM Event Server [Vinay_Gupta] [Vinay_Gupta] 2003-08 -palace-1 9992/tcp # OnLive-1 [Douglas_Crockford] [Douglas_Crockford] -palace-1 9992/udp # OnLive-1 [Douglas_Crockford] [Douglas_Crockford] -palace-2 9993/tcp # OnLive-2 [Douglas_Crockford] [Douglas_Crockford] -palace-2 9993/udp # OnLive-2 [Douglas_Crockford] [Douglas_Crockford] -palace-3 9994/tcp # OnLive-3 [Douglas_Crockford] [Douglas_Crockford] -palace-3 9994/udp # OnLive-3 [Douglas_Crockford] [Douglas_Crockford] -palace-4 9995/tcp # Palace-4 [Douglas_Crockford] [Douglas_Crockford] -palace-4 9995/udp # Palace-4 [Douglas_Crockford] [Douglas_Crockford] -palace-5 9996/tcp # Palace-5 [Douglas_Crockford] [Douglas_Crockford] -palace-5 9996/udp # Palace-5 [Douglas_Crockford] [Douglas_Crockford] -palace-6 9997/tcp # Palace-6 [Douglas_Crockford] [Douglas_Crockford] -palace-6 9997/udp # Palace-6 [Douglas_Crockford] [Douglas_Crockford] -distinct32 9998/tcp # Distinct32 [Anoop_Tewari] [Anoop_Tewari] -distinct32 9998/udp # Distinct32 [Anoop_Tewari] [Anoop_Tewari] -distinct 9999/tcp # distinct [Anoop_Tewari] [Anoop_Tewari] -distinct 9999/udp # distinct [Anoop_Tewari] [Anoop_Tewari] -ndmp 10000/tcp # Network Data Management [Brian_Ehrmantraut] [Brian_Ehrmantraut] -# Protocol -ndmp 10000/udp # Network Data Management [Brian_Ehrmantraut] [Brian_Ehrmantraut] -# Protocol -scp-config 10001/tcp # SCP Configuration [Michael_Benz] [Michael_Benz] 2010-08-06 -scp-config 10001/udp # SCP Configuration [Michael_Benz] [Michael_Benz] 2010-08-06 -documentum 10002/tcp # EMC-Documentum Content [Reza_Bagherian] [Reza_Bagherian] 2007-07-19 -# Server Product -documentum 10002/udp # EMC-Documentum Content [Reza_Bagherian] [Reza_Bagherian] 2007-07-19 -# Server Product -# EMC-Documentum Content -# Server Product -# -documentum-s 10003/tcp # IANA assigned this [Reza_Bagherian] [Reza_Bagherian] 2007-07-19 -# well-formed service name as -# a replacement for -# "documentum_s". -# EMC-Documentum Content This entry is an alias to "documentum-s". This entry is now -documentum_s 10003/tcp # Server Product [Reza_Bagherian] [Reza_Bagherian] 2007-07-19 historic, not usable for use with many common service -# discovery mechanisms. -# EMC-Documentum Content -# Server Product -# -documentum-s 10003/udp # IANA assigned this [Reza_Bagherian] [Reza_Bagherian] 2007-07-19 -# well-formed service name as -# a replacement for -# "documentum_s". -# EMC-Documentum Content This entry is an alias to "documentum-s". This entry is now -documentum_s 10003/udp # Server Product [Reza_Bagherian] [Reza_Bagherian] 2007-07-19 historic, not usable for use with many common service -# discovery mechanisms. -emcrmirccd 10004/tcp # EMC Replication Manager [Robert_Boudrie] [Robert_Boudrie] 2008-06-09 -# Client -# 10004 udp Reserved -emcrmird 10005/tcp # EMC Replication Manager [Robert_Boudrie] [Robert_Boudrie] 2008-06-09 -# Server -# 10005 udp Reserved -# Sync replication protocol -netapp-sync 10006/tcp # among different NetApp [NetApp_2] [Paul_Mu] 2014-08-07 -# platforms -# 10006 udp Reserved -mvs-capacity 10007/tcp # MVS Capacity [Donna_Dillenberger] [Donna_Dillenberger] -mvs-capacity 10007/udp # MVS Capacity [Donna_Dillenberger] [Donna_Dillenberger] -octopus 10008/tcp # Octopus Multiplexer [Chris_Koeritz_2] [Chris_Koeritz_2] 2002-10 -octopus 10008/udp # Octopus Multiplexer [Chris_Koeritz_2] [Chris_Koeritz_2] 2002-10 -swdtp-sv 10009/tcp # Systemwalker Desktop Patrol [Akira_Ide] [Akira_Ide] 2006-03 -swdtp-sv 10009/udp # Systemwalker Desktop Patrol [Akira_Ide] [Akira_Ide] 2006-03 -rxapi 10010/tcp # ooRexx rxapi services [David_Ashley] [David_Ashley] 2009-07-24 -# 10010 udp Reserved -# 10011-10049 Unassigned -zabbix-agent 10050/tcp # Zabbix Agent [Alexei_Vladishev] [Alexei_Vladishev] 2006-02 -zabbix-agent 10050/udp # Zabbix Agent [Alexei_Vladishev] [Alexei_Vladishev] 2006-02 -zabbix-trapper 10051/tcp # Zabbix Trapper [Alexei_Vladishev] [Alexei_Vladishev] 2006-02 -zabbix-trapper 10051/udp # Zabbix Trapper [Alexei_Vladishev] [Alexei_Vladishev] 2006-02 -# 10052-10054 Unassigned -qptlmd 10055/tcp # Quantapoint FLEXlm Licensing [Justin_Vegso] [Justin_Vegso] 2010-07-01 -# Service -# 10055 udp Reserved -# 10056-10079 Unassigned -amanda 10080/tcp # Amanda [John_Jackson] [John_Jackson] -amanda 10080/udp # Amanda [John_Jackson] [John_Jackson] -famdc 10081/tcp # FAM Archive Server [Frode_Randers] [Frode_Randers] 2006-01 -famdc 10081/udp # FAM Archive Server [Frode_Randers] [Frode_Randers] 2006-01 -# 10082-10099 Unassigned -itap-ddtp 10100/tcp # VERITAS ITAP DDTP [Saugata_Guha] [Saugata_Guha] 2004-05 -itap-ddtp 10100/udp # VERITAS ITAP DDTP [Saugata_Guha] [Saugata_Guha] 2004-05 -ezmeeting-2 10101/tcp # eZmeeting [Albert_C_Yang] [Albert_C_Yang] 2002-03 -ezmeeting-2 10101/udp # eZmeeting [Albert_C_Yang] [Albert_C_Yang] 2002-03 -ezproxy-2 10102/tcp # eZproxy [Albert_C_Yang] [Albert_C_Yang] 2002-03 -ezproxy-2 10102/udp # eZproxy [Albert_C_Yang] [Albert_C_Yang] 2002-03 -ezrelay 10103/tcp # eZrelay [Albert_C_Yang] [Albert_C_Yang] 2002-03 -ezrelay 10103/udp # eZrelay [Albert_C_Yang] [Albert_C_Yang] 2002-03 -swdtp 10104/tcp # Systemwalker Desktop Patrol [Akira_Ide] [Akira_Ide] 2006-09 -swdtp 10104/udp # Systemwalker Desktop Patrol [Akira_Ide] [Akira_Ide] 2006-09 -# 10105-10106 Unassigned -bctp-server 10107/tcp # VERITAS BCTP, server [Saugata_Guha] [Saugata_Guha] 2004-05 -bctp-server 10107/udp # VERITAS BCTP, server [Saugata_Guha] [Saugata_Guha] 2004-05 -# 10108-10109 Unassigned -nmea-0183 10110/tcp # NMEA-0183 Navigational Data [Meindert_Sprang] [Meindert_Sprang] 2009-02-18 -nmea-0183 10110/udp # NMEA-0183 Navigational Data [Meindert_Sprang] [Meindert_Sprang] 2009-02-18 -# 10111 tcp Reserved -nmea-onenet 10111/udp # NMEA OneNet multicast [National_Marine_Electronics_Association] [Steve_Spitzer] 2011-09-15 -# messaging -# 10112 Unassigned -netiq-endpoint 10113/tcp # NetIQ Endpoint [John_Wood] [John_Wood] -netiq-endpoint 10113/udp # NetIQ Endpoint [John_Wood] [John_Wood] -netiq-qcheck 10114/tcp # NetIQ Qcheck [Michael_Sharpe] [Michael_Sharpe] 2010-09-14 -netiq-qcheck 10114/udp # NetIQ Qcheck [Michael_Sharpe] [Michael_Sharpe] 2010-09-14 -netiq-endpt 10115/tcp # NetIQ Endpoint [Gary_Weichinger] [Gary_Weichinger] -netiq-endpt 10115/udp # NetIQ Endpoint [Gary_Weichinger] [Gary_Weichinger] -netiq-voipa 10116/tcp # NetIQ VoIP Assessor [Gary_Weichinger] [Gary_Weichinger] -netiq-voipa 10116/udp # NetIQ VoIP Assessor [Gary_Weichinger] [Gary_Weichinger] -iqrm 10117/tcp # NetIQ IQCResource Managament [Michael_Sharpe] [Michael_Sharpe] 2010-09-14 -# Svc -iqrm 10117/udp # NetIQ IQCResource Managament [Michael_Sharpe] [Michael_Sharpe] 2010-09-14 -# Svc -# 10118-10124 Unassigned -cimple 10125/tcp # HotLink CIMple REST API [HotLink_Corporation] [Richard_Offer] 2014-12-18 -# 10125 udp Reserved -# 10126-10127 Unassigned -bmc-perf-sd 10128/tcp # BMC-PERFORM-SERVICE DAEMON [Portnoy_Boxman] [Portnoy_Boxman] -bmc-perf-sd 10128/udp # BMC-PERFORM-SERVICE DAEMON [Portnoy_Boxman] [Portnoy_Boxman] -bmc-gms 10129/tcp # BMC General Manager Server [Dima_Seliverstov] [Dima_Seliverstov] 2009-07-28 -# 10129 udp Reserved -# 10130-10159 Unassigned -qb-db-server 10160/tcp # QB Database Server [Wei_Wang] [Wei_Wang] 2005-11 -qb-db-server 10160/udp # QB Database Server [Wei_Wang] [Wei_Wang] 2005-11 -snmptls 10161/tcp # SNMP-TLS [RFC6353] -snmpdtls 10161/udp # SNMP-DTLS [RFC6353] -snmptls-trap 10162/tcp # SNMP-Trap-TLS [RFC6353] -snmpdtls-trap 10162/udp # SNMP-Trap-DTLS [RFC6353] -# 10163-10199 Unassigned -trisoap 10200/tcp # Trigence AE Soap Service [Brigitte_Gagne] [Brigitte_Gagne] 2006-08 -trisoap 10200/udp # Trigence AE Soap Service [Brigitte_Gagne] [Brigitte_Gagne] 2006-08 -rsms 10201/tcp # Remote Server Management [Patrick_H_Piper] [Patrick_H_Piper] 2009-03-06 -# Service -rscs 10201/udp # Remote Server Control and [Patrick_H_Piper] [Patrick_H_Piper] 2009-03-06 -# Test Service -# 10202-10251 Unassigned -apollo-relay 10252/tcp # Apollo Relay Port [Anthony_Carrabino] [Anthony_Carrabino] 2003-08 -apollo-relay 10252/udp # Apollo Relay Port [Anthony_Carrabino] [Anthony_Carrabino] 2003-08 -eapol-relay 10253/udp # Relay of EAPOL frames [Wi-SUN_Alliance] [Phil_Beecher] 2015-06-26 -# 10253 tcp Reserved -# 10254-10259 Unassigned -axis-wimp-port 10260/tcp # Axis WIMP Port [Stefan_Eriksson] [Stefan_Eriksson] -axis-wimp-port 10260/udp # Axis WIMP Port [Stefan_Eriksson] [Stefan_Eriksson] -# 10261-10287 Unassigned -blocks 10288/tcp # Blocks [Carl_Malamud] [Carl_Malamud] -blocks 10288/udp # Blocks [Carl_Malamud] [Carl_Malamud] -# 10289-10320 Unassigned -cosir 10321/tcp # Computer Op System [Kevin_C_Barber] [Kevin_C_Barber] 2009-01-13 -# Information Report -# 10321 udp Reserved -# 10322-10438 Unassigned -bngsync 10439/udp # BalanceNG session table [Inlab_Software_GmbH] [Thomas_G._Obermair] 2014-05-02 -# synchronization protocol -# 10439 tcp Reserved -# 10440-10499 Unassigned -# 10500 tcp Reserved -hip-nat-t 10500/udp # HIP NAT-Traversal [Ari_Keranen] [Ari_Keranen] [RFC5770] -# 10501-10539 Unassigned -MOS-lower 10540/tcp # MOS Media Object Metadata [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -# Port -MOS-lower 10540/udp # MOS Media Object Metadata [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -# Port -MOS-upper 10541/tcp # MOS Running Order Port [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -MOS-upper 10541/udp # MOS Running Order Port [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -MOS-aux 10542/tcp # MOS Low Priority Port [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -MOS-aux 10542/udp # MOS Low Priority Port [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -MOS-soap 10543/tcp # MOS SOAP Default Port [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -MOS-soap 10543/udp # MOS SOAP Default Port [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -MOS-soap-opt 10544/tcp # MOS SOAP Optional Port [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -MOS-soap-opt 10544/udp # MOS SOAP Optional Port [Eric_Thorniley] [Eric_Thorniley] 2007-09-17 -# 10545-10547 Unassigned -serverdocs 10548/tcp # Apple Document Sharing [Apple_Inc_3] [Jason_Thorpe] 2015-09-29 -# Service -# 10548 udp Reserved -# 10549-10630 Unassigned -printopia 10631/tcp # Printopia Serve [Decisive_Tactics_Inc] [Chris_Kent] 2011-10-24 2015-04-09 -# 10631 udp Reserved -# 10632-10799 Unassigned -gap 10800/tcp # Gestor de Acaparamiento para [Juan_Carlos_Olivares] [Juan_Carlos_Olivares] 2006-03 -# Pocket PCs -gap 10800/udp # Gestor de Acaparamiento para [Juan_Carlos_Olivares] [Juan_Carlos_Olivares] 2006-03 -# Pocket PCs -# 10801-10804 Unassigned -lpdg 10805/tcp # LUCIA Pareja Data Group [Alvaro_P_Dominguez] [Alvaro_P_Dominguez] 2006-02 -lpdg 10805/udp # LUCIA Pareja Data Group [Alvaro_P_Dominguez] [Alvaro_P_Dominguez] 2006-02 -# 10806-10808 Unassigned -nbd 10809/tcp # Linux Network Block Device [Wouter_Verhelst] [Wouter_Verhelst] 2010-08-02 -# 10809 udp Reserved -# 10810 tcp Reserved -nmc-disc 10810/udp # Nuance Mobile Care Discovery [Gordon_Waddell] [Gordon_Waddell] 2011-03-21 -# 10811-10859 Unassigned -helix 10860/tcp # Helix Client/Server [Matthew_Strange][Larry_Atkin_2] [Matthew_Strange][Larry_Atkin_2] 2009-03-06 -helix 10860/udp # Helix Client/Server [Matthew_Strange][Larry_Atkin_2] [Matthew_Strange][Larry_Atkin_2] 2009-03-06 -# 10861-10879 Unassigned -bveapi 10880/tcp # BVEssentials HTTP API [Tri_Tech_Computers_Ltd] [James_Emerton] 2012-11-19 -bveapi 10880/udp # BVEssentials HTTP API [Tri_Tech_Computers_Ltd] [James_Emerton] 2012-11-19 -# 10881-10932 Unassigned -# Listen port used by the -octopustentacle 10933/tcp # Octopus Deploy Tentacle [Octopus_Deploy_Pty_Ltd] [Paul_Stovell] 2015-01-28 -# deployment agent -# 10933 udp Reserved -# 10934-10989 Unassigned -rmiaux 10990/tcp # Auxiliary RMI Port [Eugen_Bacic_2] [Eugen_Bacic_2] -rmiaux 10990/udp # Auxiliary RMI Port [Eugen_Bacic_2] [Eugen_Bacic_2] -# 10991-10999 Unassigned -irisa 11000/tcp # IRISA [V_A_Brauner] [V_A_Brauner] -irisa 11000/udp # IRISA [V_A_Brauner] [V_A_Brauner] -metasys 11001/tcp # Metasys [Tobin_Schuster] [Tobin_Schuster] -metasys 11001/udp # Metasys [Tobin_Schuster] [Tobin_Schuster] -# 11002-11022 Unassigned -cefd-vmp 10023/udp # Comtech EF-Data's Vipersat [Comtech] [Nathan_Jeffords] 2014-01-23 -# Management Protocol -# 10023 tcp Reserved -# 11024-11094 Unassigned -# Nest device-to-device and -weave 11095/tcp # device-to-service [Nest_Labs_Inc] [Grant_Erickson] 2014-01-16 -# application protocol -# Nest device-to-device and -weave 11095/udp # device-to-service [Nest_Labs_Inc] [Grant_Erickson] 2014-01-16 -# application protocol -# 11096-11102 Unassigned -origo-sync 11103/tcp # OrigoDB Server Sync [Devrex_Labs] [Robert_Friberg] 2013-03-29 -# Interface -# 11103 udp Reserved -netapp-icmgmt 11104/tcp # NetApp Intercluster [Craig_Everhart] [Craig_Everhart] 2010-07-06 -# Management -# 11104 udp Reserved -netapp-icdata 11105/tcp # NetApp Intercluster Data [Craig_Everhart] [Craig_Everhart] 2010-07-06 -# 11105 udp Reserved -sgi-lk 11106/tcp # SGI LK Licensing service [Michel_Bourget] [Michel_Bourget] 2009-01-06 -sgi-lk 11106/udp # SGI LK Licensing service [Michel_Bourget] [Michel_Bourget] 2009-01-06 -# 11107 Unassigned -# Hardware Terminals Discovery -myq-termlink 11108/udp # and Low-Level Communication [JANUS_spol] [Jakub_Ahmadyar] 2013-04-23 -# Protocol -# 11108 tcp Reserved -# Data migration facility -sgi-dmfmgr 11109/tcp # Manager (DMF) is a browser [SGI] [John_Sygulla] 2013-01-07 -# based interface to DMF -# 11109 udp Reserved -# Data migration facility -sgi-soap 11110/tcp # (DMF) SOAP is a web server [SGI] [John_Sygulla] 2013-01-07 -# protocol to support remote -# access to DMF -# 11110 udp Reserved -vce 11111/tcp # Viral Computing Environment [Fred_Cohen] [Fred_Cohen] -# (VCE) -vce 11111/udp # Viral Computing Environment [Fred_Cohen] [Fred_Cohen] -# (VCE) -dicom 11112/tcp # DICOM [David_Clunie] [David_Clunie] 2005-08 -dicom 11112/udp # DICOM [David_Clunie] [David_Clunie] 2005-08 -# 11113-11160 Unassigned -suncacao-snmp 11161/tcp # sun cacao snmp access point [Nick_Stephen] [Nick_Stephen] 2005-08 -suncacao-snmp 11161/udp # sun cacao snmp access point [Nick_Stephen] [Nick_Stephen] 2005-08 -suncacao-jmxmp 11162/tcp # sun cacao JMX-remoting [Nick_Stephen] [Nick_Stephen] 2005-08 -# access point -suncacao-jmxmp 11162/udp # sun cacao JMX-remoting [Nick_Stephen] [Nick_Stephen] 2005-08 -# access point -suncacao-rmi 11163/tcp # sun cacao rmi registry [Nick_Stephen] [Nick_Stephen] 2005-08 -# access point -suncacao-rmi 11163/udp # sun cacao rmi registry [Nick_Stephen] [Nick_Stephen] 2005-08 -# access point -suncacao-csa 11164/tcp # sun cacao command-streaming [Nick_Stephen] [Nick_Stephen] 2005-08 -# access point -suncacao-csa 11164/udp # sun cacao command-streaming [Nick_Stephen] [Nick_Stephen] 2005-08 -# access point -suncacao-websvc 11165/tcp # sun cacao web service access [Nick_Stephen] [Nick_Stephen] 2005-08 -# point -suncacao-websvc 11165/udp # sun cacao web service access [Nick_Stephen] [Nick_Stephen] 2005-08 -# point -# 11166-11170 Unassigned -# 11171 tcp Reserved -snss 11171/udp # Surgical Notes Security [David_Lethe] [David_Lethe] 2010-12-24 -# Service Discovery (SNSS) -oemcacao-jmxmp 11172/tcp # OEM cacao JMX-remoting [David_Sechrest] [David_Sechrest] 2010-09-22 -# access point -# 11172 udp Reserved -t5-straton 11173/tcp # Straton Runtime Programing [COPALP] [Jerome_FOLLUT] 2012-03-01 -# 11173 udp Reserved -oemcacao-rmi 11174/tcp # OEM cacao rmi registry [David_Sechrest] [David_Sechrest] 2010-09-22 -# access point -# 11174 udp Reserved -oemcacao-websvc 11175/tcp # OEM cacao web service access [David_Sechrest] [David_Sechrest] 2010-09-22 -# point -# 11175 udp Reserved -# 11176-11200 Unassigned -smsqp 11201/tcp # smsqp [Andres_Seco_Hernande] [Andres_Seco_Hernande] -smsqp 11201/udp # smsqp [Andres_Seco_Hernande] [Andres_Seco_Hernande] -dcsl-backup 11202/tcp # DCSL Network Backup Services [John_Reynolds] [John_Reynolds] 2012-04-17 Defined TXT keys: DCSL-Service -# 11202 udp Reserved -# 11203-11207 Unassigned -wifree 11208/tcp # WiFree Service [Jose_Luis_Martin_Pei] [Jose_Luis_Martin_Pei] 2006-03 -wifree 11208/udp # WiFree Service [Jose_Luis_Martin_Pei] [Jose_Luis_Martin_Pei] 2006-03 -# 11209-11210 Unassigned -memcache 11211/tcp # Memory cache service [Trond_Norbye] [Trond_Norbye] 2009-02-09 -memcache 11211/udp # Memory cache service [Trond_Norbye] [Trond_Norbye] 2009-02-09 -# 11212-11318 Unassigned -imip 11319/tcp # IMIP [Len_Zuvela] [Len_Zuvela] -imip 11319/udp # IMIP [Len_Zuvela] [Len_Zuvela] -imip-channels 11320/tcp # IMIP Channels Port [Len_Zuvela_2] [Len_Zuvela_2] -imip-channels 11320/udp # IMIP Channels Port [Len_Zuvela_2] [Len_Zuvela_2] -arena-server 11321/tcp # Arena Server Listen [Earl_Brannigan] [Earl_Brannigan] -arena-server 11321/udp # Arena Server Listen [Earl_Brannigan] [Earl_Brannigan] -# 11322-11366 Unassigned -atm-uhas 11367/tcp # ATM UHAS [Todd_Barker] [Todd_Barker] -atm-uhas 11367/udp # ATM UHAS [Todd_Barker] [Todd_Barker] -# 11368-11370 Unassigned -hkp 11371/tcp # OpenPGP HTTP Keyserver [David_Shaw] [David_Shaw] 2003-05 -hkp 11371/udp # OpenPGP HTTP Keyserver [David_Shaw] [David_Shaw] 2003-05 -# 11372-11429 Unassigned -lsdp 11430/udp # Lenbrook Service Discovery [Lenbrook_Industries_Limited] [Kevin_Groeneveld] 2014-03-27 -# Protocol -# 11430 tcp Reserved -# Known -# 11431-11488 Unassigned UNAUTHORIZED -# USE: port -# 11488 -asgcypresstcps 11489/tcp # ASG Cypress Secure Only [David_Luxford] [David_Luxford] 2010-07-01 -# 11489 udp Reserved -# 11490-11599 Unassigned -tempest-port 11600/tcp # Tempest Protocol Port [Francis_Cianfrocca] [Francis_Cianfrocca] -tempest-port 11600/udp # Tempest Protocol Port [Francis_Cianfrocca] [Francis_Cianfrocca] -# 11601-11622 Unassigned -emc-xsw-dconfig 11623/tcp # EMC XtremSW distributed [EMC] [David_Erel] 2013-09-18 -# config -# 11623 udp Reserved -# Unauthorized -# 11624-11719 Unassigned Use Known on -# port 11711 -h323callsigalt 11720/tcp # H.323 Call Control [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signalling Alternate -h323callsigalt 11720/udp # H.323 Call Control [ITU-T] [ITU-T_TSB] 2013-01-31 -# Signalling Alternate -# 11721-11722 Unassigned -emc-xsw-dcache 11723/tcp # EMC XtremSW distributed [EMC] [David_Erel] 2013-09-18 -# cache -emc-xsw-dcache 11723/udp # EMC XtremSW distributed [EMC] [David_Erel] 2013-09-18 -# cache -# 11724-11750 Unassigned -intrepid-ssl 11751/tcp # Intrepid SSL [Robert_Eden] [Robert_Eden] 2003-03 -intrepid-ssl 11751/udp # Intrepid SSL [Robert_Eden] [Robert_Eden] 2003-03 -# 11752-11795 Unassigned -lanschool 11796/tcp # LanSchool [Stoneware_Inc] [Dana_Doggett] 2012-05-18 -lanschool-mpt 11796/udp # Lanschool Multipoint [Stoneware_Inc] [Dana_Doggett] 2012-05-18 -# 11797-11875 Unassigned -xoraya 11876/tcp # X2E Xoraya Multichannel [Hannes_K] [Hannes_K] 2010-09-13 -# protocol -xoraya 11876/udp # X2E Xoraya Multichannel [Hannes_K] [Hannes_K] 2010-09-13 -# protocol -# 11877 tcp Reserved -x2e-disc 11877/udp # X2E service discovery [Hannes_K] [Hannes_K] 2010-09-13 -# protocol -# 11878-11966 Unassigned -sysinfo-sp 11967/tcp # SysInfo Service Protocol [Mike_Cooper] [Mike_Cooper] 2003-03 -sysinfo-sp 11967/udp # SysInfo Sercice Protocol [Mike_Cooper] [Mike_Cooper] 2003-03 -# 11968-11996 Unassigned -wmereceiving 11997/sctp # WorldMailExpress [Greg_Foutz] [Greg_Foutz] 2006-03 -wmedistribution 11998/sctp # WorldMailExpress [Greg_Foutz] [Greg_Foutz] 2006-03 -wmereporting 11999/sctp # WorldMailExpress [Greg_Foutz] [Greg_Foutz] 2006-03 -entextxid 12000/tcp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# XID Exchange -entextxid 12000/udp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# XID Exchange -entextnetwk 12001/tcp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# COS Network Priority -entextnetwk 12001/udp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# COS Network Priority -entexthigh 12002/tcp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# COS High Priority -entexthigh 12002/udp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# COS High Priority -entextmed 12003/tcp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# COS Medium Priority -entextmed 12003/udp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# COS Medium Priority -entextlow 12004/tcp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# COS Low Priority -entextlow 12004/udp # IBM Enterprise Extender SNA [Eugene_Cox] [Eugene_Cox] -# COS Low Priority -dbisamserver1 12005/tcp # DBISAM Database Server - [Tim_Young] [Tim_Young] 2002-05 -# Regular -dbisamserver1 12005/udp # DBISAM Database Server - [Tim_Young] [Tim_Young] 2002-05 -# Regular -dbisamserver2 12006/tcp # DBISAM Database Server - [Tim_Young] [Tim_Young] 2002-05 -# Admin -dbisamserver2 12006/udp # DBISAM Database Server - [Tim_Young] [Tim_Young] 2002-05 -# Admin -accuracer 12007/tcp # Accuracer Database System [Alexander_V_Ivanov] [Alexander_V_Ivanov] 2004-12 -# Server -accuracer 12007/udp # Accuracer Database System [Alexander_V_Ivanov] [Alexander_V_Ivanov] 2004-12 -# Server -accuracer-dbms 12008/tcp # Accuracer Database System [Alexander_V_Ivanov] [Alexander_V_Ivanov] 2004-12 -# Admin -accuracer-dbms 12008/udp # Accuracer Database System [Alexander_V_Ivanov] [Alexander_V_Ivanov] 2004-12 -# Admin -# 12009 tcp Reserved -ghvpn 12009/udp # Green Hills VPN [Green_Hills_Software] [Tom_R_Zavisca] 2012-02-07 -edbsrvr 12010/tcp # ElevateDB Server [Tim_Young] [Tim_Young] 2009-05-06 -# 12010 udp Reserved -# 12011 Unassigned -vipera 12012/tcp # Vipera Messaging Service [Silvano_Maffeis_2] [Silvano_Maffeis_2] 2005-08 -vipera 12012/udp # Vipera Messaging Service [Silvano_Maffeis_2] [Silvano_Maffeis_2] 2005-08 -vipera-ssl 12013/tcp # Vipera Messaging Service [Silvano_Maffeis_2] [Silvano_Maffeis_2] 2008-01-16 -# over SSL Communication -vipera-ssl 12013/udp # Vipera Messaging Service [Silvano_Maffeis_2] [Silvano_Maffeis_2] 2008-01-16 -# over SSL Communication -# 12014-12108 Unassigned -rets-ssl 12109/tcp # RETS over SSL [Jeremy_Crawford] [Jeremy_Crawford] 2003-02 -rets-ssl 12109/udp # RETS over SSL [Jeremy_Crawford] [Jeremy_Crawford] 2003-02 -# 12110-12120 Unassigned -nupaper-ss 12121/tcp # NuPaper Session Service [David_Warden_2] [David_Warden_2] 2005-11 -nupaper-ss 12121/udp # NuPaper Session Service [David_Warden_2] [David_Warden_2] 2005-11 -# 12122-12167 Unassigned -cawas 12168/tcp # CA Web Access Service [Jon_Press] [Jon_Press] 2005-08 -cawas 12168/udp # CA Web Access Service [Jon_Press] [Jon_Press] 2005-08 -# 12169-12171 Unassigned -hivep 12172/tcp # HiveP [Dick_Augustsson] [Dick_Augustsson] -hivep 12172/udp # HiveP [Dick_Augustsson] [Dick_Augustsson] -# 12173-12299 Unassigned -linogridengine 12300/tcp # LinoGrid Engine [Frans_Lundberg] [Frans_Lundberg] 2004-11 -linogridengine 12300/udp # LinoGrid Engine [Frans_Lundberg] [Frans_Lundberg] 2004-11 -# 12301 Unassigned -# Remote Administration Daemon -# (RAD) is a system service -rads 12302/tcp # that offers secure, remote, [Oracle] [Devjani_Ray] 2012-04-20 -# programmatic access to -# Solaris system configuration -# and run-time state -# 12302 udp Reserved -# 12303-12320 Unassigned -warehouse-sss 12321/tcp # Warehouse Monitoring Syst [Craig_Steffen] [Craig_Steffen] 2005-08 -# SSS -warehouse-sss 12321/udp # Warehouse Monitoring Syst [Craig_Steffen] [Craig_Steffen] 2005-08 -# SSS -warehouse 12322/tcp # Warehouse Monitoring Syst [Craig_Steffen] [Craig_Steffen] 2005-08 -warehouse 12322/udp # Warehouse Monitoring Syst [Craig_Steffen] [Craig_Steffen] 2005-08 -# 12323-12344 Unassigned -italk 12345/tcp # Italk Chat System [Takayuki_Ito] [Takayuki_Ito] -italk 12345/udp # Italk Chat System [Takayuki_Ito] [Takayuki_Ito] -# 12346-12752 Unassigned -tsaf 12753/tcp # tsaf port [Andreas_Fehr] [Andreas_Fehr] -tsaf 12753/udp # tsaf port [Andreas_Fehr] [Andreas_Fehr] -# 12754-12864 Unassigned -netperf 12865/tcp # control port for the netperf [netperf.org] [rick_jones] 2013-04-05 -# benchmark -# 12865 udp Reserved -# 12866-13159 Unassigned -i-zipqd 13160/tcp # I-ZIPQD [Chuck_Runquist] [Chuck_Runquist] -i-zipqd 13160/udp # I-ZIPQD [Chuck_Runquist] [Chuck_Runquist] -# 13161-13215 Unassigned -bcslogc 13216/tcp # Black Crow Software [Ramindur_Singh] [Ramindur_Singh] 2008-12-04 -# application logging -bcslogc 13216/udp # Black Crow Software [Ramindur_Singh] [Ramindur_Singh] 2008-12-04 -# application logging -rs-pias 13217/tcp # R&S Proxy Installation [Guido_Kiener] [Guido_Kiener] 2008-12-04 -# Assistant Service -rs-pias 13217/udp # R&S Proxy Installation [Guido_Kiener] [Guido_Kiener] 2008-12-04 -# Assistant Service -emc-vcas-tcp 13218/tcp # EMC Virtual CAS Service -emc-vcas-udp 13218/udp # EMV Virtual CAS Service [Mark_O_Connell] [Mark_O_Connell] 2008-12-04 -# Discovery -# 13219-13222 Unassigned -powwow-client 13223/tcp # PowWow Client [Paul_K_Peterson] [Paul_K_Peterson] -powwow-client 13223/udp # PowWow Client [Paul_K_Peterson] [Paul_K_Peterson] -powwow-server 13224/tcp # PowWow Server [Paul_K_Peterson] [Paul_K_Peterson] -powwow-server 13224/udp # PowWow Server [Paul_K_Peterson] [Paul_K_Peterson] -# 13225-13399 Unassigned -doip-data 13400/tcp # DoIP Data [Joerg_Schneider] [Joerg_Schneider] 2011-01-26 -doip-disc 13400/udp # DoIP Discovery [Joerg_Schneider] [Joerg_Schneider] 2011-01-26 -# 13401-13719 Unassigned -bprd 13720/tcp # BPRD Protocol (VERITAS [Jeff_Holmbeck] [Jeff_Holmbeck] -# NetBackup) -bprd 13720/udp # BPRD Protocol (VERITAS [Jeff_Holmbeck] [Jeff_Holmbeck] -# NetBackup) -bpdbm 13721/tcp # BPDBM Protocol (VERITAS [Jeff_Holmbeck] [Jeff_Holmbeck] -# NetBackup) -bpdbm 13721/udp # BPDBM Protocol (VERITAS [Jeff_Holmbeck] [Jeff_Holmbeck] -# NetBackup) -bpjava-msvc 13722/tcp # BP Java MSVC Protocol [Tim_Schmidt] [Tim_Schmidt] -bpjava-msvc 13722/udp # BP Java MSVC Protocol [Tim_Schmidt] [Tim_Schmidt] -# 13723 Unassigned -vnetd 13724/tcp # Veritas Network Utility [Jeff_Holmbeck] [Jeff_Holmbeck] -vnetd 13724/udp # Veritas Network Utility [Jeff_Holmbeck] [Jeff_Holmbeck] -# 13725-13781 Unassigned -bpcd 13782/tcp # VERITAS NetBackup [Jeff_Holmbeck] [Jeff_Holmbeck] -bpcd 13782/udp # VERITAS NetBackup [Jeff_Holmbeck] [Jeff_Holmbeck] -vopied 13783/tcp # VOPIED Protocol [Jeff_Holmbeck] [Jeff_Holmbeck] -vopied 13783/udp # VOPIED Protocol [Jeff_Holmbeck] [Jeff_Holmbeck] -# 13784 Unassigned -nbdb 13785/tcp # NetBackup Database [Pat_Tovo] [Pat_Tovo] 2004-12 -nbdb 13785/udp # NetBackup Database [Pat_Tovo] [Pat_Tovo] 2004-12 -nomdb 13786/tcp # Veritas-nomdb [Clayton_Haapala] [Clayton_Haapala] 2005-08 -nomdb 13786/udp # Veritas-nomdb [Clayton_Haapala] [Clayton_Haapala] 2005-08 -# 13787-13817 Unassigned -dsmcc-config 13818/tcp # DSMCC Config [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -dsmcc-config 13818/udp # DSMCC Config [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -dsmcc-session 13819/tcp # DSMCC Session Messages [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -dsmcc-session 13819/udp # DSMCC Session Messages [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -dsmcc-passthru 13820/tcp # DSMCC Pass-Thru Messages [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -dsmcc-passthru 13820/udp # DSMCC Pass-Thru Messages [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -dsmcc-download 13821/tcp # DSMCC Download Protocol [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -dsmcc-download 13821/udp # DSMCC Download Protocol [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -dsmcc-ccp 13822/tcp # DSMCC Channel Change [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -# Protocol -dsmcc-ccp 13822/udp # DSMCC Channel Change [Tim_Addington] [Tim_Addington] [ISO/IEC 13818-6 MPEG-2 DSM-CC] -# Protocol -bmdss 13823/tcp # Blackmagic Design Streaming [Sam_Vaughan] [Sam_Vaughan] 2011-03-01 -# Server -# 13823 udp Reserved -# 13824-13893 Unassigned -ucontrol 13894/tcp # Ultimate Control [NEGU_Soft] [borja_lopez_urkidi] 2012-09-10 -# communication protocol -ucontrol 13894/udp # Ultimate Control [NEGU_Soft] [borja_lopez_urkidi] 2012-09-10 -# communication protocol -# 13895-13928 Unassigned -dta-systems 13929/tcp # D-TA SYSTEMS [Alexis_Bose] [Alexis_Bose] 2008-12-08 -dta-systems 13929/udp # D-TA SYSTEMS [Alexis_Bose] [Alexis_Bose] 2008-12-08 -medevolve 13930/tcp # MedEvolve Port Requester [Jon_Robertson] [Jon_Robertson] 2008-10-24 -# 13930 udp Reserved -# 13931-13999 Unassigned -scotty-ft 14000/tcp # SCOTTY High-Speed [Patrick_Verbeek] [Patrick_Verbeek] 2007-05 -# Filetransfer -scotty-ft 14000/udp # SCOTTY High-Speed [Patrick_Verbeek] [Patrick_Verbeek] 2007-05 -# Filetransfer -sua 14001/tcp # SUA [Miguel_Angel_Garcia] [Miguel_Angel_Garcia] -sua 14001/udp # De-Registered [Miguel_Angel_Garcia] [Miguel_Angel_Garcia] 2001-06-06 -sua 14001/sctp # SUA [Miguel_Angel_Garcia] [Miguel_Angel_Garcia] -scotty-disc 14002/udp # Discovery of a SCOTTY [SCOTTY_Group_SE] [Patrick_Verbeek_2] 2013-01-14 -# hardware codec board -# 14002 tcp Reserved -# 14003-14032 Unassigned -sage-best-com1 14033/tcp # sage Best! Config Server 1 [Christian_Rubach] [Christian_Rubach] -sage-best-com1 14033/udp # sage Best! Config Server 1 [Christian_Rubach] [Christian_Rubach] -sage-best-com2 14034/tcp # sage Best! Config Server 2 [Christian_Rubach] [Christian_Rubach] -sage-best-com2 14034/udp # sage Best! Config Server 2 [Christian_Rubach] [Christian_Rubach] -# 14035-14140 Unassigned -vcs-app 14141/tcp # VCS Application [Ming_Xu] [Ming_Xu] -vcs-app 14141/udp # VCS Application [Ming_Xu] [Ming_Xu] -icpp 14142/tcp # IceWall Cert Protocol [Tsutomu_Fujinami] [Tsutomu_Fujinami] 2005-08 -icpp 14142/udp # IceWall Cert Protocol [Tsutomu_Fujinami] [Tsutomu_Fujinami] 2005-08 -# 14143-14144 Unassigned -gcm-app 14145/tcp # GCM Application [Ming_Xu] [Ming_Xu] -gcm-app 14145/udp # GCM Application [Ming_Xu] [Ming_Xu] -# 14146-14148 Unassigned -vrts-tdd 14149/tcp # Veritas Traffic Director [Sameer_Deokule] [Sameer_Deokule] 2002-03 -vrts-tdd 14149/udp # Veritas Traffic Director [Sameer_Deokule] [Sameer_Deokule] 2002-03 -vcscmd 14150/tcp # Veritas Cluster Server [Anand_Bhalerao] [Anand_Bhalerao] 2008-10-02 -# Command Server -# 14150 udp Reserved -# 14151-14153 Unassigned -vad 14154/tcp # Veritas Application Director [Rajeev_Verma] [Rajeev_Verma] 2006-02 -vad 14154/udp # Veritas Application Director [Rajeev_Verma] [Rajeev_Verma] 2006-02 -# 14155-14249 Unassigned -cps 14250/tcp # Fencing Server [Mayank_Vasa] [Mayank_Vasa] 2008-04-03 -cps 14250/udp # Fencing Server [Mayank_Vasa] [Mayank_Vasa] 2008-04-03 -# 14251-14413 Unassigned -ca-web-update 14414/tcp # CA eTrust Web Update Service [Robert_Ciochon] [Robert_Ciochon] 2006-08 -ca-web-update 14414/udp # CA eTrust Web Update Service [Robert_Ciochon] [Robert_Ciochon] 2006-08 -# 14415-14935 Unassigned -hde-lcesrvr-1 14936/tcp # hde-lcesrvr-1 [Horizon_Digital_Ente] [Horizon_Digital_Ente] -hde-lcesrvr-1 14936/udp # hde-lcesrvr-1 [Horizon_Digital_Ente] [Horizon_Digital_Ente] -hde-lcesrvr-2 14937/tcp # hde-lcesrvr-2 [Horizon_Digital_Ente] [Horizon_Digital_Ente] -hde-lcesrvr-2 14937/udp # hde-lcesrvr-2 [Horizon_Digital_Ente] [Horizon_Digital_Ente] -# 14938-14999 Unassigned -hydap 15000/tcp # Hypack Data Aquisition [HYPACK_Inc] [Mircea_Neacsu] 2011-10-27 -hydap 15000/udp # Hypack Data Aquisition [HYPACK_Inc] [Mircea_Neacsu] 2011-10-27 -# 15001 Unassigned -onep-tls 15002/tcp # Open Network Environment TLS [Cisco_3] [Andrew_Thurber] 2014-01-21 -# 15002 udp Reserved -# 15003-15117 Unassigned -# 15118 tcp Reserved -# v2g Supply Equipment -v2g-secc 15118/udp # Communication Controller [Holger_Lochner] [Holger_Lochner] 2011-04-06 -# Discovery Protocol -# 15119-15344 Unassigned -xpilot 15345/tcp # XPilot Contact Port [Bert_Gijsbers] [Bert_Gijsbers] -xpilot 15345/udp # XPilot Contact Port [Bert_Gijsbers] [Bert_Gijsbers] -# 15346-15362 Unassigned -3link 15363/tcp # 3Link Negotiation [Brant_Thomsen] [Brant_Thomsen] 2003-01 -3link 15363/udp # 3Link Negotiation [Brant_Thomsen] [Brant_Thomsen] 2003-01 -# 15364-15554 Unassigned -cisco-snat 15555/tcp # Cisco Stateful NAT [Kaushik_Biswas] [Kaushik_Biswas] 2006-03 -cisco-snat 15555/udp # Cisco Stateful NAT [Kaushik_Biswas] [Kaushik_Biswas] 2006-03 -# 15556-15659 Unassigned -bex-xr 15660/tcp # Backup Express Restore [Catalogic_Software_Inc] [Chi_Shih_Chang] 2008-03-19 2015-02-04 -# Server -bex-xr 15660/udp # Backup Express Restore [Catalogic_Software_Inc] [Chi_Shih_Chang] 2008-03-19 2015-02-04 -# Server -# 15661-15739 Unassigned -ptp 15740/tcp # Picture Transfer Protocol [Petronel_Bigioi] [Petronel_Bigioi] 2004-11 Defined TXT keys: guid= -ptp 15740/udp # Picture Transfer Protocol [Petronel_Bigioi] [Petronel_Bigioi] 2004-11 Defined TXT keys: guid= -# 15741-15997 Unassigned -# 15998 tcp Reserved -2ping 15998/udp # 2ping Bi-Directional Ping [Ryan_Finnie] [Ryan_Finnie] 2010-10-06 -# Service -programmar 15999/tcp # ProGrammar Enterprise [Norman_Wilson] [Norman_Wilson] 2010-10-06 -# 15999 udp Reserved -# Known -fmsas 16000/tcp # Administration Server Access [Mark_Davidson] [Mark_Davidson] 2010-10-06 Unauthorized -# Use on port -# 16000 -# Known -# 16000 udp Reserved Unauthorized -# Use on port -# 16000 -fmsascon 16001/tcp # Administration Server [Mark_Davidson] [Mark_Davidson] 2010-10-06 -# Connector -# 16001 udp Reserved -gsms 16002/tcp # GoodSync Mediation Service [Vadim_Maslov] [Vadim_Maslov] 2010-10-06 -# 16002 udp Reserved -# 16003 tcp Reserved -alfin 16003/udp # Automation and Control by [Ing_Tomas_Halabala] [Ing_Tomas_Halabala] 2010-10-06 -# REGULACE.ORG -# 16004-16019 Unassigned -jwpc 16020/tcp # Filemaker Java Web [Robert_Parks] [Robert_Parks] 2010-05-12 -# Publishing Core -# 16020 udp Reserved -jwpc-bin 16021/tcp # Filemaker Java Web [Robert_Parks] [Robert_Parks] 2010-05-12 -# Publishing Core Binary -# 16021 udp Reserved -# 16022-16160 Unassigned -sun-sea-port 16161/tcp # Solaris SEA Port [Dana_Porter] [Dana_Porter] 2003-10 -sun-sea-port 16161/udp # Solaris SEA Port [Dana_Porter] [Dana_Porter] 2003-10 -solaris-audit 16162/tcp # Solaris Audit - secure [Jan_Friedel] [Jan_Friedel] 2009-05-07 -# remote audit log -# 16162 udp Reserved -# 16163-16308 Unassigned -etb4j 16309/tcp # etb4j [Christopher_R_Smith] [Christopher_R_Smith] 2004-11 -etb4j 16309/udp # etb4j [Christopher_R_Smith] [Christopher_R_Smith] 2004-11 -pduncs 16310/tcp # Policy Distribute, Update [Diane_I_Shannon] [Diane_I_Shannon] 2006-08 -# Notification -pduncs 16310/udp # Policy Distribute, Update [Diane_I_Shannon] [Diane_I_Shannon] 2006-08 -# Notification -pdefmns 16311/tcp # Policy definition and update [Diane_I_Shannon] [Diane_I_Shannon] 2007-04 -# management -pdefmns 16311/udp # Policy definition and update [Diane_I_Shannon] [Diane_I_Shannon] 2007-04 -# management -# 16312-16359 Unassigned -netserialext1 16360/tcp # Network Serial Extension [Michael_J_Hoy] [Michael_J_Hoy] -# Ports One -netserialext1 16360/udp # Network Serial Extension [Michael_J_Hoy] [Michael_J_Hoy] -# Ports One -netserialext2 16361/tcp # Network Serial Extension [Michael_J_Hoy] [Michael_J_Hoy] -# Ports Two -netserialext2 16361/udp # Network Serial Extension [Michael_J_Hoy] [Michael_J_Hoy] -# Ports Two -# 16362-16366 Unassigned -netserialext3 16367/tcp # Network Serial Extension [Michael_J_Hoy] [Michael_J_Hoy] -# Ports Three -netserialext3 16367/udp # Network Serial Extension [Michael_J_Hoy] [Michael_J_Hoy] -# Ports Three -netserialext4 16368/tcp # Network Serial Extension [Michael_J_Hoy] [Michael_J_Hoy] -# Ports Four -netserialext4 16368/udp # Network Serial Extension [Michael_J_Hoy] [Michael_J_Hoy] -# Ports Four -# 16369-16383 Unassigned -connected 16384/tcp # Connected Corp [Nicole_C_Ouellette] [Nicole_C_Ouellette] 2004-02 -connected 16384/udp # Connected Corp [Nicole_C_Ouellette] [Nicole_C_Ouellette] 2004-02 -rdgs 16385/tcp # Reliable Datagram Sockets [Oracle_7] [Sowmini_Varadhan] 2015-04-30 -# 16385 udp Reserved -# 16386-16618 Unassigned -xoms 16619/tcp # X509 Objects Management [Francis_GASCHET] [Francis_GASCHET] 2008-09-08 -# Service -# 16619 udp Reserved -# 16620-16664 Unassigned -axon-tunnel 16665/tcp # Reliable multipath data [Bridgeworks] [Paul_Burgess] 2014-09-26 -# transport for high latencies -# 16665 udp Reserved -# 16666 tcp Reserved -vtp 16666/udp # Vidder Tunnel Protocol [Vidder_Inc] [Ted_Schroeder_2] 2011-10-24 -# 16667-16788 Unassigned -# This server provides -# callable services to -cadsisvr 16789/tcp # mainframe External Security [CA_Technologies] [Thomas_Sakowski] 2015-06-02 -# Managers from any TCP/IP -# platform -# 16789 udp Reserved -# 16790-16899 Unassigned -newbay-snc-mc 16900/tcp # Newbay Mobile Client Update [Srinivasa_Nayudu] [Srinivasa_Nayudu] 2009-07-06 -# Service -newbay-snc-mc 16900/udp # Newbay Mobile Client Update [Srinivasa_Nayudu] [Srinivasa_Nayudu] 2009-07-06 -# Service -# 16901-16949 Unassigned -sgcip 16950/tcp # Simple Generic Client [John_Aquilino] [John_Aquilino] -# Interface Protocol -sgcip 16950/udp # Simple Generic Client [John_Aquilino] [John_Aquilino] -# Interface Protocol -# 16951-16990 Unassigned -intel-rci-mp 16991/tcp # INTEL-RCI-MP [Jane_Dashevsky] [Jane_Dashevsky] -intel-rci-mp 16991/udp # INTEL-RCI-MP [Jane_Dashevsky] [Jane_Dashevsky] -amt-soap-http 16992/tcp # Intel(R) AMT SOAP/HTTP [David_T_Hines] [David_T_Hines] 2005-02 -amt-soap-http 16992/udp # Intel(R) AMT SOAP/HTTP [David_T_Hines] [David_T_Hines] 2005-02 -amt-soap-https 16993/tcp # Intel(R) AMT SOAP/HTTPS [David_T_Hines] [David_T_Hines] 2005-02 -amt-soap-https 16993/udp # Intel(R) AMT SOAP/HTTPS [David_T_Hines] [David_T_Hines] 2005-02 -amt-redir-tcp 16994/tcp # Intel(R) AMT Redirection/TCP [Nimrod_Diamant] [Nimrod_Diamant] 2005-02 -amt-redir-tcp 16994/udp # Intel(R) AMT Redirection/TCP [Nimrod_Diamant] [Nimrod_Diamant] 2005-02 -amt-redir-tls 16995/tcp # Intel(R) AMT Redirection/TLS [Nimrod_Diamant] [Nimrod_Diamant] 2005-02 -amt-redir-tls 16995/udp # Intel(R) AMT Redirection/TLS [Nimrod_Diamant] [Nimrod_Diamant] 2005-02 -# 16996-17006 Unassigned -isode-dua 17007/tcp -isode-dua 17007/udp -# 17008-17183 Unassigned -vestasdlp 17184/tcp # Vestas Data Layer Protocol [Vestas_Wind_Systems] [Teunis_de_Wit] 2013-10-30 -# 17184 udp Reserved -soundsvirtual 17185/tcp # Sounds Virtual [Richard_Snider] [Richard_Snider] -soundsvirtual 17185/udp # Sounds Virtual [Richard_Snider] [Richard_Snider] -# 17186-17218 Unassigned -chipper 17219/tcp # Chipper [Ronald_Jimmink] [Ronald_Jimmink] -chipper 17219/udp # Chipper [Ronald_Jimmink] [Ronald_Jimmink] -# IEEE 1722 Transport Protocol -avtp 17220/tcp # for Time Sensitive [Transport_Protocol_for_Time-Sensitive_Networking_TG] [Ashley_Butterworth] 2014-03-07 -# Applications -# IEEE 1722 Transport Protocol -avtp 17220/udp # for Time Sensitive [Transport_Protocol_for_Time-Sensitive_Networking_TG] [Ashley_Butterworth] 2014-03-07 -# Applications -# IEEE 1722.1 AVB Discovery, -avdecc 17221/tcp # Enumeration, Connection [IEEE_1722_1] [Jeffrey_Daniel_Koftinoff] 2011-11-01 -# management, and Control -# IEEE 1722.1 AVB Discovery, -avdecc 17221/udp # Enumeration, Connection [IEEE_1722_1] [Jeffrey_Daniel_Koftinoff] 2011-11-01 -# management, and Control -# 17222 tcp Reserved -# Control Plane -cpsp 17222/udp # Synchronization Protocol [Randall_Stewart_2] [Randall_Stewart_2] 2011-11-10 -# (SPSP) -# ISA100 GCI is a service -# utilizing a common interface -isa100-gci 17223/tcp # between an ISA100 Wireless [ISA100_Wireless_Compliance_Institute] [Jay_Werb] 2015-07-24 -# gateway and a client -# application -# 17223 udp Reserved -trdp-pd 17224/udp # Train Realtime Data Protocol [IEC_Central_Office] [Gianosvaldo_Fadin] 2015-07-24 -# (TRDP) Process Data -# 17224 tcp Reserved -trdp-md 17225/tcp # Train Realtime Data Protocol [IEC_Central_Office] [Gianosvaldo_Fadin] 2015-07-24 -# (TRDP) Message Data -trdp-md 17225/udp # Train Realtime Data Protocol [IEC_Central_Office] [Gianosvaldo_Fadin] 2015-07-24 -# (TRDP) Message Data -# 17226-17233 Unassigned -integrius-stp 17234/tcp # Integrius Secure Tunnel [Christian_Klemetsson] [Christian_Klemetsson] 2010-03-04 -# Protocol -integrius-stp 17234/udp # Integrius Secure Tunnel [Christian_Klemetsson] [Christian_Klemetsson] 2010-03-04 -# Protocol -ssh-mgmt 17235/tcp # SSH Tectia Manager [Ville_Laurikari] [Ville_Laurikari] 2005-08 -ssh-mgmt 17235/udp # SSH Tectia Manager [Ville_Laurikari] [Ville_Laurikari] 2005-08 -# 17236-17499 Unassigned -db-lsp 17500/tcp # Dropbox LanSync Protocol [Paul_Bohm] [Paul_Bohm] 2010-01-21 -db-lsp-disc 17500/udp # Dropbox LanSync Discovery [Paul_Bohm] [Paul_Bohm] 2010-01-21 -# 17501-17554 Unassigned -ailith 17555/tcp # Ailith management of routers [Thomas_Boje] [Thomas_Boje] 2014-03-27 -# 17555 udp Reserved -# 17556-17728 Unassigned -ea 17729/tcp # Eclipse Aviation [William_Schmidt] [William_Schmidt] 2006-03 -ea 17729/udp # Eclipse Aviation [William_Schmidt] [William_Schmidt] 2006-03 -# 17730-17753 Unassigned -zep 17754/tcp # Encap. ZigBee Packets [Fred_Fierling] [Fred_Fierling] 2006-02 -zep 17754/udp # Encap. ZigBee Packets [Fred_Fierling] [Fred_Fierling] 2006-02 -zigbee-ip 17755/tcp # ZigBee IP Transport Service [Chris_Herzog] [Chris_Herzog] 2006-05 -zigbee-ip 17755/udp # ZigBee IP Transport Service [Chris_Herzog] [Chris_Herzog] 2006-05 -zigbee-ips 17756/tcp # ZigBee IP Transport Secure [Chris_Herzog] [Chris_Herzog] 2006-05 -# Service -zigbee-ips 17756/udp # ZigBee IP Transport Secure [Chris_Herzog] [Chris_Herzog] 2006-05 -# Service -# 17757-17776 Unassigned -sw-orion 17777/tcp # SolarWinds Orion [Joel_Dolisy] [Joel_Dolisy] 2008-09-10 -# 17777 udp Reserved -# 17778-17999 Unassigned -biimenu 18000/tcp # Beckman Instruments, Inc. [R_L_Meyering] [R_L_Meyering] -biimenu 18000/udp # Beckman Instruments, Inc. [R_L_Meyering] [R_L_Meyering] -# 18001-18103 Unassigned -radpdf 18104/tcp # RAD PDF Service [Christopher_Truxaw] [Christopher_Truxaw] 2010-10-15 -# 18104 udp Reserved -# 18105-18135 Unassigned -racf 18136/tcp # z/OS Resource Access Control [Bruce_Wells] [Bruce_Wells] 2010-10-04 -# Facility -# 18136 udp Reserved -# 18137-18180 Unassigned -opsec-cvp 18181/tcp # OPSEC CVP [Alon_Kantor] [Alon_Kantor] -opsec-cvp 18181/udp # OPSEC CVP [Alon_Kantor] [Alon_Kantor] -opsec-ufp 18182/tcp # OPSEC UFP [Alon_Kantor] [Alon_Kantor] -opsec-ufp 18182/udp # OPSEC UFP [Alon_Kantor] [Alon_Kantor] -opsec-sam 18183/tcp # OPSEC SAM [Alon_Kantor] [Alon_Kantor] -opsec-sam 18183/udp # OPSEC SAM [Alon_Kantor] [Alon_Kantor] -opsec-lea 18184/tcp # OPSEC LEA [Alon_Kantor] [Alon_Kantor] -opsec-lea 18184/udp # OPSEC LEA [Alon_Kantor] [Alon_Kantor] -opsec-omi 18185/tcp # OPSEC OMI [Alon_Kantor] [Alon_Kantor] -opsec-omi 18185/udp # OPSEC OMI [Alon_Kantor] [Alon_Kantor] -ohsc 18186/tcp # Occupational Health SC [David_Fudge] [David_Fudge] 2003-08 -ohsc 18186/udp # Occupational Health Sc [David_Fudge] [David_Fudge] 2003-08 -opsec-ela 18187/tcp # OPSEC ELA [Alon_Kantor] [Alon_Kantor] -opsec-ela 18187/udp # OPSEC ELA [Alon_Kantor] [Alon_Kantor] -# 18188-18240 Unassigned -checkpoint-rtm 18241/tcp # Check Point RTM [Dudi_Hazan] [Dudi_Hazan] -checkpoint-rtm 18241/udp # Check Point RTM [Dudi_Hazan] [Dudi_Hazan] -iclid 18242/tcp # Checkpoint router monitoring [Check_Point_Software] [Rahul_Bahadur] 2012-06-28 -# 18242 udp Reserved -clusterxl 18243/tcp # Checkpoint router state [Check_Point_Software] [Rahul_Bahadur] 2012-06-28 -# backup -# 18243 udp Reserved -# 18244-18261 Unassigned -gv-pf 18262/tcp # GV NetConfig Service [Scott_Libert] [Scott_Libert] 2008-01-29 -gv-pf 18262/udp # GV NetConfig Service [Scott_Libert] [Scott_Libert] 2008-01-29 -# 18263-18462 Unassigned -ac-cluster 18463/tcp # AC Cluster [Lisa_Zhong] [Lisa_Zhong] -ac-cluster 18463/udp # AC Cluster [Lisa_Zhong] [Lisa_Zhong] -# 18464-18633 Unassigned -rds-ib 18634/tcp # Reliable Datagram Service [Andy_Grover] [Andy_Grover] 2009-02-27 -rds-ib 18634/udp # Reliable Datagram Service [Andy_Grover] [Andy_Grover] 2009-02-27 -rds-ip 18635/tcp # Reliable Datagram Service [Andy_Grover] [Andy_Grover] 2009-05-20 -# over IP -rds-ip 18635/udp # Reliable Datagram Service [Andy_Grover] [Andy_Grover] 2009-05-20 -# over IP -# 18636-18768 Unassigned -ique 18769/tcp # IQue Protocol [Avi_Drissman] [Avi_Drissman] 2002-07 -ique 18769/udp # IQue Protocol [Avi_Drissman] [Avi_Drissman] 2002-07 -# 18770-18880 Unassigned -infotos 18881/tcp # Infotos [Marcel_Dube] [Marcel_Dube] 2004-11 -infotos 18881/udp # Infotos [Marcel_Dube] [Marcel_Dube] 2004-11 -# 18882-18887 Unassigned -apc-necmp 18888/tcp # APCNECMP [Michael_Yip] [Michael_Yip] -apc-necmp 18888/udp # APCNECMP [Michael_Yip] [Michael_Yip] -# 18889-18999 Unassigned -igrid 19000/tcp # iGrid Server [Massimo_Cafaro] [Massimo_Cafaro] 2004-11 -igrid 19000/udp # iGrid Server [Massimo_Cafaro] [Massimo_Cafaro] 2004-11 -# 19001-19006 Unassigned -scintilla 19007/tcp # Scintilla protocol for [Veejansh_Inc] [Chirag_Patel] 2014-03-04 -# device services -scintilla 19007/udp # Scintilla protocol for [Veejansh_Inc] [Chirag_Patel] 2014-03-04 -# device services -# 19008-19019 Unassigned -j-link 19020/tcp # J-Link TCP/IP Protocol [SEGGER] [SEGGER] -# 19020 udp Reserved -# 19021-19190 Unassigned -opsec-uaa 19191/tcp # OPSEC UAA [Reuven_Harrison] [Reuven_Harrison] -opsec-uaa 19191/udp # OPSEC UAA [Reuven_Harrison] [Reuven_Harrison] -# 19192-19193 Unassigned -ua-secureagent 19194/tcp # UserAuthority SecureAgent [Reuven_Harrison_2] [Reuven_Harrison_2] 2003-01 -ua-secureagent 19194/udp # UserAuthority SecureAgent [Reuven_Harrison_2] [Reuven_Harrison_2] 2003-01 -# 19195-19282 Unassigned -keysrvr 19283/tcp # Key Server for SASSAFRAS [Mark_Valence] [Mark_Valence] -keysrvr 19283/udp # Key Server for SASSAFRAS [Mark_Valence] [Mark_Valence] -# 19284-19314 Unassigned -keyshadow 19315/tcp # Key Shadow for SASSAFRAS [Mark_Valence] [Mark_Valence] -keyshadow 19315/udp # Key Shadow for SASSAFRAS [Mark_Valence] [Mark_Valence] -# 19316-19397 Unassigned -mtrgtrans 19398/tcp # mtrgtrans [Katsuhito_Muroi] [Katsuhito_Muroi] -mtrgtrans 19398/udp # mtrgtrans [Katsuhito_Muroi] [Katsuhito_Muroi] -# 19399-19409 Unassigned -hp-sco 19410/tcp # hp-sco [Larry_Schwartz] [Larry_Schwartz] -hp-sco 19410/udp # hp-sco [Larry_Schwartz] [Larry_Schwartz] -hp-sca 19411/tcp # hp-sca [Larry_Schwartz] [Larry_Schwartz] -hp-sca 19411/udp # hp-sca [Larry_Schwartz] [Larry_Schwartz] -hp-sessmon 19412/tcp # HP-SESSMON [Gita_Murthy] [Gita_Murthy] -hp-sessmon 19412/udp # HP-SESSMON [Gita_Murthy] [Gita_Murthy] -# 19413-19538 Unassigned -fxuptp 19539/tcp # FXUPTP [Keiji_Okuma] [Keiji_Okuma] 2005-08 -fxuptp 19539/udp # FXUPTP [Keiji_Okuma] [Keiji_Okuma] 2005-08 -sxuptp 19540/tcp # SXUPTP [Keiji_Okuma] [Keiji_Okuma] 2002-08 -sxuptp 19540/udp # SXUPTP [Keiji_Okuma] [Keiji_Okuma] 2002-08 -jcp 19541/tcp # JCP Client [Yuji_Sasaki] [Yuji_Sasaki] -jcp 19541/udp # JCP Client [Yuji_Sasaki] [Yuji_Sasaki] -# 19542-19787 Unassigned -mle 19788/udp # Mesh Link Establishment [IESG] [IETF_Chair] 2012-12-18 -# 19788 tcp Reserved -# 19789-19997 Unassigned -iec-104-sec 19998/tcp # IEC 60870-5-104 process [Grant_Gilchrist] [Grant_Gilchrist] 2010-10-18 -# control - secure -# 19998 udp Reserved -dnp-sec 19999/tcp # Distributed Network Protocol [Grant_Gilchrist] [Grant_Gilchrist] 2008-08-04 -# - Secure -dnp-sec 19999/udp # Distributed Network Protocol [Grant_Gilchrist] [Grant_Gilchrist] 2008-08-04 -# - Secure -dnp 20000/tcp # DNP [Michael_Thesing] [Michael_Thesing] -dnp 20000/udp # DNP [Michael_Thesing] [Michael_Thesing] -microsan 20001/tcp # MicroSAN [Thomas_E_Ludwig] [Thomas_E_Ludwig] 2004-02 -microsan 20001/udp # MicroSAN [Thomas_E_Ludwig] [Thomas_E_Ludwig] 2004-02 -commtact-http 20002/tcp # Commtact HTTP [Tomas_Svoboda] [Tomas_Svoboda] 2004-12 -commtact-http 20002/udp # Commtact HTTP [Tomas_Svoboda] [Tomas_Svoboda] 2004-12 -commtact-https 20003/tcp # Commtact HTTPS [Tomas_Svoboda] [Tomas_Svoboda] 2004-12 -commtact-https 20003/udp # Commtact HTTPS [Tomas_Svoboda] [Tomas_Svoboda] 2004-12 -# 20004 Unassigned -openwebnet 20005/tcp # OpenWebNet protocol for [BTicino_S_p_A] [BTicino_S_p_A] 2008-04-09 -# electric network -openwebnet 20005/udp # OpenWebNet protocol for [BTicino_S_p_A] [BTicino_S_p_A] 2008-04-09 -# electric network -# 20006-20011 Unassigned -# 20012 tcp Reserved -ss-idi-disc 20012/udp # Samsung Interdevice [Hong_Jungkih] [Hong_Jungkih] -# Interaction discovery -ss-idi 20013/tcp # Samsung Interdevice [Hong_Jungkih] [Hong_Jungkih] -# Interaction -# 20013 udp Reserved -opendeploy 20014/tcp # OpenDeploy Listener [Todd_Scallan] [Todd_Scallan] 2005-08 -opendeploy 20014/udp # OpenDeploy Listener [Todd_Scallan] [Todd_Scallan] 2005-08 -# 20015-20033 Unassigned -# NetBurner ID Port -# -nburn-id 20034/tcp # IANA assigned this [Paul_Breed] [Paul_Breed] 2003-11 -# well-formed service name as -# a replacement for -# "nburn_id". -# This entry is an alias to "nburn-id". This entry is now -nburn_id 20034/tcp # NetBurner ID Port [Paul_Breed] [Paul_Breed] 2003-11 historic, not usable for use with many common service -# discovery mechanisms. -# NetBurner ID Port -# -nburn-id 20034/udp # IANA assigned this [Paul_Breed] [Paul_Breed] 2003-11 -# well-formed service name as -# a replacement for -# "nburn_id". -# This entry is an alias to "nburn-id". This entry is now -nburn_id 20034/udp # NetBurner ID Port [Paul_Breed] [Paul_Breed] 2003-11 historic, not usable for use with many common service -# discovery mechanisms. -# 20035-20045 Unassigned -tmophl7mts 20046/tcp # TMOP HL7 Message Transfer [Tim_Riley] [Tim_Riley] 2009-07-31 -# Service -tmophl7mts 20046/udp # TMOP HL7 Message Transfer [Tim_Riley] [Tim_Riley] 2009-07-31 -# Service -# 20047-20047 Unassigned -mountd 20048/tcp # NFS mount protocol [Nicolas_Williams] [Nicolas_Williams] 2010-08-09 -mountd 20048/udp # NFS mount protocol [Nicolas_Williams] [Nicolas_Williams] 2010-08-09 -nfsrdma 20049/tcp # Network File System (NFS) [RFC5666] -# over RDMA -nfsrdma 20049/udp # Network File System (NFS) [RFC5666] -# over RDMA -nfsrdma 20049/sctp # Network File System (NFS) [RFC5666] -# over RDMA -# 20050-20166 Unassigned -tolfab 20167/tcp # TOLfab Data Change [Pierre_Couderc] [Pierre_Couderc] 2006-03 -tolfab 20167/udp # TOLfab Data Change [Pierre_Couderc] [Pierre_Couderc] 2006-03 -# 20168-20201 Unassigned -ipdtp-port 20202/tcp # IPD Tunneling Port [Vikki_Yin_Wei] [Vikki_Yin_Wei] 2003-01 -ipdtp-port 20202/udp # IPD Tunneling Port [Vikki_Yin_Wei] [Vikki_Yin_Wei] 2003-01 -# 20203-20221 Unassigned -ipulse-ics 20222/tcp # iPulse-ICS [Meggie_Garica_Woodru] [Meggie_Garica_Woodru] -ipulse-ics 20222/udp # iPulse-ICS [Meggie_Garica_Woodru] [Meggie_Garica_Woodru] -# 20223-20479 Unassigned -emwavemsg 20480/tcp # emWave Message Service [Harald_Striepe] [Harald_Striepe] 2008-02-14 -emwavemsg 20480/udp # emWave Message Service [Harald_Striepe] [Harald_Striepe] 2008-02-14 -# 20481-20669 Unassigned -track 20670/tcp # Track [Michael_Sweet] [Michael_Sweet] -track 20670/udp # Track [Michael_Sweet] [Michael_Sweet] -# 20671-20998 Unassigned -athand-mmp 20999/tcp # At Hand MMP [Stepan_Riha] [Stepan_Riha] -athand-mmp 20999/udp # AT Hand MMP [Stepan_Riha] [Stepan_Riha] -irtrans 21000/tcp # IRTrans Control [Marcus_Mueller] [Marcus_Mueller] 2004-11 -irtrans 21000/udp # IRTrans Control [Marcus_Mueller] [Marcus_Mueller] 2004-11 -# 21001-21009 Unassigned -notezilla-lan 21010/tcp # Notezilla.Lan Server [Conceptworld_Corporation] [Gautam_Jain] 2013-08-20 -# 21010 udp Reserved -# 21011-21552 Unassigned -rdm-tfs 21553/tcp # Raima RDM TFS [Paul_Johnson] [Paul_Johnson] 2011-05-02 -# 21553 udp Reserved -dfserver 21554/tcp # MineScape Design File Server [Michael_Purser] [Michael_Purser] 2006-06 -dfserver 21554/udp # MineScape Design File Server [Michael_Purser] [Michael_Purser] 2006-06 -# 21555-21589 Unassigned -vofr-gateway 21590/tcp # VoFR Gateway [Marty_Borden] [Marty_Borden] -vofr-gateway 21590/udp # VoFR Gateway [Marty_Borden] [Marty_Borden] -# 21591-21799 Unassigned -tvpm 21800/tcp # TVNC Pro Multiplexing [Brian_Blevins] [Brian_Blevins] -tvpm 21800/udp # TVNC Pro Multiplexing [Brian_Blevins] [Brian_Blevins] -# 21801-21844 Unassigned -webphone 21845/tcp # webphone [Toby_Hosterman] [Toby_Hosterman] -webphone 21845/udp # webphone [Toby_Hosterman] [Toby_Hosterman] -netspeak-is 21846/tcp # NetSpeak Corp. Directory [Toby_Hosterman] [Toby_Hosterman] -# Services -netspeak-is 21846/udp # NetSpeak Corp. Directory [Toby_Hosterman] [Toby_Hosterman] -# Services -netspeak-cs 21847/tcp # NetSpeak Corp. Connection [Toby_Hosterman] [Toby_Hosterman] -# Services -netspeak-cs 21847/udp # NetSpeak Corp. Connection [Toby_Hosterman] [Toby_Hosterman] -# Services -netspeak-acd 21848/tcp # NetSpeak Corp. Automatic [Toby_Hosterman] [Toby_Hosterman] -# Call Distribution -netspeak-acd 21848/udp # NetSpeak Corp. Automatic [Toby_Hosterman] [Toby_Hosterman] -# Call Distribution -netspeak-cps 21849/tcp # NetSpeak Corp. Credit [Toby_Hosterman] [Toby_Hosterman] -# Processing System -netspeak-cps 21849/udp # NetSpeak Corp. Credit [Toby_Hosterman] [Toby_Hosterman] -# Processing System -# 21850-21999 Unassigned -snapenetio 22000/tcp # SNAPenetIO [Kevin_Kuhns] [Kevin_Kuhns] -snapenetio 22000/udp # SNAPenetIO [Kevin_Kuhns] [Kevin_Kuhns] -optocontrol 22001/tcp # OptoControl [Kevin_Kuhns] [Kevin_Kuhns] -optocontrol 22001/udp # OptoControl [Kevin_Kuhns] [Kevin_Kuhns] -optohost002 22002/tcp # Opto Host Port 2 [Doug_Leany] [Doug_Leany] 2006-09 -optohost002 22002/udp # Opto Host Port 2 [Doug_Leany] [Doug_Leany] 2006-09 -optohost003 22003/tcp # Opto Host Port 3 [Doug_Leany] [Doug_Leany] 2006-09 -optohost003 22003/udp # Opto Host Port 3 [Doug_Leany] [Doug_Leany] 2006-09 -optohost004 22004/tcp # Opto Host Port 4 [Doug_Leany] [Doug_Leany] 2006-09 -optohost004 22004/udp # Opto Host Port 4 [Doug_Leany] [Doug_Leany] 2006-09 -optohost004 22005/tcp # Opto Host Port 5 [Doug_Leany] [Doug_Leany] 2006-09 -optohost004 22005/udp # Opto Host Port 5 [Doug_Leany] [Doug_Leany] 2006-09 -# 22006-22124 Unassigned -dcap 22125/tcp # dCache Access Protocol [Christoph_Anton_Mitt] [Christoph_Anton_Mitt] 2009-03-10 -# 22125 udp Reserved -# 22126-22127 Unassigned -gsidcap 22128/tcp # GSI dCache Access Protocol [Christoph_Anton_Mitt] [Christoph_Anton_Mitt] 2009-03-10 -# 22128 udp Reserved -# 22129-22221 Unassigned -# EasyEngine is CLI tool to -easyengine 22222/tcp # manage WordPress Sites on [rtCamp_Solutions_Private_Limited] [Rahul_Bansal] 2014-03-10 -# Nginx server -# 22222 udp Reserved -# 22223-22272 Unassigned -wnn6 22273/tcp # wnn6 [Yasunari_Gon_Yamasit] [Yasunari_Gon_Yamasit] -wnn6 22273/udp # wnn6 [Yasunari_Gon_Yamasit] [Yasunari_Gon_Yamasit] -# 22274-22304 Unassigned -cis 22305/tcp # CompactIS Tunnel [Justin_Paupore] [Justin_Paupore] 2007-08-16 -cis 22305/udp # CompactIS Tunnel [Justin_Paupore] [Justin_Paupore] 2007-08-16 -# 22306-22334 Unassigned -shrewd-control 22335/tcp # Initium Labs Security and [Initium_Labs_LLC] [Manbir_Sahni] 2015-03-06 -# Automation Control -shrewd-stream 22335/udp # Initium Labs Security and [Initium_Labs_LLC] [Manbir_Sahni] 2015-03-06 -# Automation Streaming -# 22336-22342 Unassigned -cis-secure 22343/tcp # CompactIS Secure Tunnel [Justin_Paupore] [Justin_Paupore] 2007-08-16 -cis-secure 22343/udp # CompactIS Secure Tunnel [Justin_Paupore] [Justin_Paupore] 2007-08-16 -# 22344-22346 Unassigned -wibukey 22347/tcp # WibuKey Standard WkLan [Wolfgang_Voelker] [Wolfgang_Voelker] 2007-06 -wibukey 22347/udp # WibuKey Standard WkLan [Wolfgang_Voelker] [Wolfgang_Voelker] 2007-06 -# 22348-22349 Unassigned -codemeter 22350/tcp # CodeMeter Standard [Wolfgang_Voelker] [Wolfgang_Voelker] 2007-06 -codemeter 22350/udp # CodeMeter Standard [Wolfgang_Voelker] [Wolfgang_Voelker] 2007-06 -# TPC/IP requests of copy -codemeter-cmwan 22351/tcp # protection software to a [WIBU-SYSTEMS_AG] [Wolfgang_Völker_2] 2013-06-25 -# server -# 22351 udp Reserved -# 22352-22536 Unassigned -caldsoft-backup 22537/tcp # CaldSoft Backup server file [CaldSoft] [Mark_Caldwell] 2011-08-12 -# transfer -# 22537 udp Reserved -# 22538-22554 Unassigned -vocaltec-wconf 22555/tcp # Vocaltec Web Conference [Scott_Petrack] [Scott_Petrack] -vocaltec-phone 22555/udp # Vocaltec Internet Phone [Scott_Petrack] [Scott_Petrack] -# 22556-22762 Unassigned -talikaserver 22763/tcp # Talika Main Server [Laxman_C_Marathe] [Laxman_C_Marathe] 2006-12 -talikaserver 22763/udp # Talika Main Server [Laxman_C_Marathe] [Laxman_C_Marathe] 2006-12 -# 22764-22799 Unassigned -aws-brf 22800/tcp # Telerate Information [Timo_Sivonen] [Timo_Sivonen] -# Platform LAN -aws-brf 22800/udp # Telerate Information [Timo_Sivonen] [Timo_Sivonen] -# Platform LAN -# 22801-22950 Unassigned -brf-gw 22951/tcp # Telerate Information [Timo_Sivonen] [Timo_Sivonen] -# Platform WAN -brf-gw 22951/udp # Telerate Information [Timo_Sivonen] [Timo_Sivonen] -# Platform WAN -# 22952-22999 Unassigned -inovaport1 23000/tcp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 1 -inovaport1 23000/udp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 1 -inovaport2 23001/tcp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 2 -inovaport2 23001/udp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 2 -inovaport3 23002/tcp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 3 -inovaport3 23002/udp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 3 -inovaport4 23003/tcp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 4 -inovaport4 23003/udp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 4 -inovaport5 23004/tcp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 5 -inovaport5 23004/udp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 5 -inovaport6 23005/tcp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 6 -inovaport6 23005/udp # Inova LightLink Server Type [Chris_Koeritz_3] [Chris_Koeritz_3] 2006-10 -# 6 -# 23006-23052 Unassigned -gntp 23053/tcp # Generic Notification [Growl_Project] [Chris_Forsythe] 2012-02-07 -# Transport Protocol -# 23053 udp Reserved -# 23054-23271 Unassigned -# 23272 tcp Reserved -s102 23272/udp # S102 application [Kimmo_Kymalainen] [Kimmo_Kymalainen] 2009-08-26 -# 23273-23332 Unassigned -elxmgmt 23333/tcp # Emulex HBAnyware Remote [Maziar_Tamadon] [Maziar_Tamadon] 2007-11-06 -# Management -elxmgmt 23333/udp # Emulex HBAnyware Remote [Maziar_Tamadon] [Maziar_Tamadon] 2007-11-06 -# Management -# 23334-23399 Unassigned -novar-dbase 23400/tcp # Novar Data [Keith_Kilroy] [Keith_Kilroy] 2006-02 -novar-dbase 23400/udp # Novar Data [Keith_Kilroy] [Keith_Kilroy] 2006-02 -novar-alarm 23401/tcp # Novar Alarm [Keith_Kilroy] [Keith_Kilroy] 2006-02 -novar-alarm 23401/udp # Novar Alarm [Keith_Kilroy] [Keith_Kilroy] 2006-02 -novar-global 23402/tcp # Novar Global [Keith_Kilroy] [Keith_Kilroy] 2006-02 -novar-global 23402/udp # Novar Global [Keith_Kilroy] [Keith_Kilroy] 2006-02 -# 23403-23455 Unassigned -aequus 23456/tcp # Aequus Service [James_Anson] [James_Anson] 2009-02-12 -# 23456 udp Reserved -aequus-alt 23457/tcp # Aequus Service Mgmt [James_Anson] [James_Anson] 2009-02-12 -# 23457 udp Reserved -# 23458-23545 Unassigned -areaguard-neo 23546/tcp # AreaGuard Neo - WebServer [SODATSW_spol] [Roman_Štěpánek] 2012-05-31 -# 23546 udp Reserved -# 23547-23999 Unassigned -med-ltp 24000/tcp # med-ltp [Juergen_Fischbach] [Juergen_Fischbach] -med-ltp 24000/udp # med-ltp [Juergen_Fischbach] [Juergen_Fischbach] -med-fsp-rx 24001/tcp # med-fsp-rx [Juergen_Fischbach] [Juergen_Fischbach] -med-fsp-rx 24001/udp # med-fsp-rx [Juergen_Fischbach] [Juergen_Fischbach] -med-fsp-tx 24002/tcp # med-fsp-tx [Juergen_Fischbach] [Juergen_Fischbach] -med-fsp-tx 24002/udp # med-fsp-tx [Juergen_Fischbach] [Juergen_Fischbach] -med-supp 24003/tcp # med-supp [Juergen_Fischbach] [Juergen_Fischbach] -med-supp 24003/udp # med-supp [Juergen_Fischbach] [Juergen_Fischbach] -med-ovw 24004/tcp # med-ovw [Juergen_Fischbach] [Juergen_Fischbach] -med-ovw 24004/udp # med-ovw [Juergen_Fischbach] [Juergen_Fischbach] -med-ci 24005/tcp # med-ci [Juergen_Fischbach] [Juergen_Fischbach] -med-ci 24005/udp # med-ci [Juergen_Fischbach] [Juergen_Fischbach] -med-net-svc 24006/tcp # med-net-svc [Juergen_Fischbach] [Juergen_Fischbach] -med-net-svc 24006/udp # med-net-svc [Juergen_Fischbach] [Juergen_Fischbach] -# 24007-24241 Unassigned -filesphere 24242/tcp # fileSphere [Carl_Cedergren] [Carl_Cedergren] -filesphere 24242/udp # fileSphere [Carl_Cedergren] [Carl_Cedergren] -# 24243-24248 Unassigned -vista-4gl 24249/tcp # Vista 4GL [Mark_Itzcovitz] [Mark_Itzcovitz] -vista-4gl 24249/udp # Vista 4GL [Mark_Itzcovitz] [Mark_Itzcovitz] -# 24250-24320 Unassigned -ild 24321/tcp # Isolv Local Directory [Mitchell_Bass] [Mitchell_Bass] 2005-08 -ild 24321/udp # Isolv Local Directory [Mitchell_Bass] [Mitchell_Bass] 2005-08 -hid 24322/udp # Transport of Human Interface [Freebox_SAS] [Nicolas_Pouillon] 2012-12-14 -# Device data streams -# 24322 tcp Reserved -# 24323-24385 Unassigned -# Intel RCI -# -intel-rci 24386/tcp # IANA assigned this [Mark_Lewis_2] [Mark_Lewis_2] -# well-formed service name as -# a replacement for -# "intel_rci". -# This entry is an alias to "intel-rci". This entry is now -intel_rci 24386/tcp # Intel RCI [Mark_Lewis_2] [Mark_Lewis_2] historic, not usable for use with many common service -# discovery mechanisms. -# Intel RCI -# -intel-rci 24386/udp # IANA assigned this [Mark_Lewis_2] [Mark_Lewis_2] -# well-formed service name as -# a replacement for -# "intel_rci". -# This entry is an alias to "intel-rci". This entry is now -intel_rci 24386/udp # Intel RCI [Mark_Lewis_2] [Mark_Lewis_2] historic, not usable for use with many common service -# discovery mechanisms. -# 24387-24464 Unassigned -tonidods 24465/tcp # Tonido Domain Server [Madhan_Kanagavel] [Madhan_Kanagavel] 2008-07-18 -tonidods 24465/udp # Tonido Domain Server [Madhan_Kanagavel] [Madhan_Kanagavel] 2008-07-18 -# 24466-24553 Unassigned -binkp 24554/tcp # BINKP [Max_Masyutin] [Max_Masyutin] -binkp 24554/udp # BINKP [Max_Masyutin] [Max_Masyutin] -# 24555-24576 Unassigned -bilobit 24577/tcp # bilobit Service [bilobit_GmbH] [Martin_Schmuker] 2014-08-15 -bilobit-update 24577/udp # bilobit Service Update [bilobit_GmbH] [Martin_Schmuker] 2014-08-15 -# 24578-24665 Unassigned -# Service used by SmarDTV to -sdtvwcam 24666/tcp # communicate between a CAM [SmarDTV] [Vincent_Demortier] 2015-03-04 -# and a second screen -# application -# 24666 udp Reserved -# 24667-24675 Unassigned -canditv 24676/tcp # Canditv Message Service [Gary_Aston] [Gary_Aston] 2009-03-10 -canditv 24676/udp # Canditv Message Service [Gary_Aston] [Gary_Aston] 2009-03-10 -flashfiler 24677/tcp # FlashFiler [Ben_Oram] [Ben_Oram] -flashfiler 24677/udp # FlashFiler [Ben_Oram] [Ben_Oram] -proactivate 24678/tcp # Turbopower Proactivate [Ben_Oram] [Ben_Oram] -proactivate 24678/udp # Turbopower Proactivate [Ben_Oram] [Ben_Oram] -# 24679 Unassigned -tcc-http 24680/tcp # TCC User HTTP Service [Brian_Kennedy] [Brian_Kennedy] 2006-08 -tcc-http 24680/udp # TCC User HTTP Service [Brian_Kennedy] [Brian_Kennedy] 2006-08 -# 24681-24753 Unassigned -cslg 24754/tcp # Citrix StorageLink Gateway [Mark_Nijmeijer] [Mark_Nijmeijer] 2009-04-17 -# 24754 udp Reserved -# 24755-24849 Unassigned -# 24850 tcp Reserved -assoc-disc 24850/udp # Device Association Discovery [Microsoft_Corporation_3] [Sachin_Sheth] 2012-06-27 -# 24851-24921 Unassigned -find 24922/tcp # Find Identification of [Jean_Paul_Moreaux] [Jean_Paul_Moreaux] -# Network Devices -find 24922/udp # Find Identification of [Jean_Paul_Moreaux] [Jean_Paul_Moreaux] -# Network Devices -# 24923-24999 Unassigned -icl-twobase1 25000/tcp # icl-twobase1 [J_A_Sever] [J_A_Sever] -icl-twobase1 25000/udp # icl-twobase1 [J_A_Sever] [J_A_Sever] -icl-twobase2 25001/tcp # icl-twobase2 [J_A_Sever] [J_A_Sever] -icl-twobase2 25001/udp # icl-twobase2 [J_A_Sever] [J_A_Sever] -icl-twobase3 25002/tcp # icl-twobase3 [J_A_Sever] [J_A_Sever] -icl-twobase3 25002/udp # icl-twobase3 [J_A_Sever] [J_A_Sever] -icl-twobase4 25003/tcp # icl-twobase4 [J_A_Sever] [J_A_Sever] -icl-twobase4 25003/udp # icl-twobase4 [J_A_Sever] [J_A_Sever] -icl-twobase5 25004/tcp # icl-twobase5 [J_A_Sever] [J_A_Sever] -icl-twobase5 25004/udp # icl-twobase5 [J_A_Sever] [J_A_Sever] -icl-twobase6 25005/tcp # icl-twobase6 [J_A_Sever] [J_A_Sever] -icl-twobase6 25005/udp # icl-twobase6 [J_A_Sever] [J_A_Sever] -icl-twobase7 25006/tcp # icl-twobase7 [J_A_Sever] [J_A_Sever] -icl-twobase7 25006/udp # icl-twobase7 [J_A_Sever] [J_A_Sever] -icl-twobase8 25007/tcp # icl-twobase8 [J_A_Sever] [J_A_Sever] -icl-twobase8 25007/udp # icl-twobase8 [J_A_Sever] [J_A_Sever] -icl-twobase9 25008/tcp # icl-twobase9 [J_A_Sever] [J_A_Sever] -icl-twobase9 25008/udp # icl-twobase9 [J_A_Sever] [J_A_Sever] -icl-twobase10 25009/tcp # icl-twobase10 [J_A_Sever] [J_A_Sever] -icl-twobase10 25009/udp # icl-twobase10 [J_A_Sever] [J_A_Sever] -# 25010-25470 Unassigned -rna 25471/sctp # RNSAP User Adaptation for [Dario_S_Tonesi] [Dario_S_Tonesi] 2011-02-07 -# Iurh -# 25472-25575 Unassigned -sauterdongle 25576/tcp # Sauter Dongle [Christian_Brecht] [Christian_Brecht] 2010-12-15 -# 25576 udp Reserved -# 25577-25603 Unassigned -idtp 25604/tcp # Identifier Tracing Protocol [Huang_Neng-geng] [Huang_Neng-geng] 2011-08-09 -# 25604 udp Reserved -# 25605-25792 Unassigned -vocaltec-hos 25793/tcp # Vocaltec Address Server [Scott_Petrack] [Scott_Petrack] -vocaltec-hos 25793/udp # Vocaltec Address Server [Scott_Petrack] [Scott_Petrack] -# 25794-25899 Unassigned -tasp-net 25900/tcp # TASP Network Comm [Martin_Ellis] [Martin_Ellis] 2004-11 -tasp-net 25900/udp # TASP Network Comm [Martin_Ellis] [Martin_Ellis] 2004-11 -niobserver 25901/tcp # NIObserver [Roman_Oliynyk] [Roman_Oliynyk] -niobserver 25901/udp # NIObserver [Roman_Oliynyk] [Roman_Oliynyk] -nilinkanalyst 25902/tcp # NILinkAnalyst [Roman_Oliynyk_2] [Roman_Oliynyk_2] 2007-08-30 -nilinkanalyst 25902/udp # NILinkAnalyst [Roman_Oliynyk_2] [Roman_Oliynyk_2] 2007-08-30 -niprobe 25903/tcp # NIProbe [Roman_Oliynyk] [Roman_Oliynyk] -niprobe 25903/udp # NIProbe [Roman_Oliynyk] [Roman_Oliynyk] -# 25904-25953 Unassigned -bf-game 25954/udp # Bitfighter game server [Christopher_Eykamp] [Christopher_Eykamp] 2012-08-16 -# 25954 tcp Reserved -bf-master 25955/udp # Bitfighter master server [Christopher_Eykamp] [Christopher_Eykamp] 2012-08-16 -# 25955 tcp Reserved -# 25956-25999 Unassigned -quake 26000/tcp # quake [Yasunari_Gon_Yamasit] [Yasunari_Gon_Yamasit] -quake 26000/udp # quake [Yasunari_Gon_Yamasit] [Yasunari_Gon_Yamasit] -# 26001-26132 Unassigned -# Symbolic Computation -scscp 26133/tcp # Software Composability [Alexander_Konovalov] [Alexander_Konovalov] 2007-11-27 -# Protocol -# Symbolic Computation -scscp 26133/udp # Software Composability [Alexander_Konovalov] [Alexander_Konovalov] 2007-11-27 -# Protocol -# 26134-26207 Unassigned -wnn6-ds 26208/tcp # wnn6-ds [Yasunari_Gon_Yamasit] [Yasunari_Gon_Yamasit] -wnn6-ds 26208/udp # wnn6-ds [Yasunari_Gon_Yamasit] [Yasunari_Gon_Yamasit] -# 26209-26256 Unassigned -cockroach 26257/tcp # CockroachDB [Cockroach_Labs_Inc] [Ben_Darnell] 2015-09-29 -# 26257 udp Reserved -# 26258-26259 Unassigned -ezproxy 26260/tcp # eZproxy [Albert_C_Yang] [Albert_C_Yang] -ezproxy 26260/udp # eZproxy [Albert_C_Yang] [Albert_C_Yang] -ezmeeting 26261/tcp # eZmeeting [Albert_C_Yang] [Albert_C_Yang] -ezmeeting 26261/udp # eZmeeting [Albert_C_Yang] [Albert_C_Yang] -k3software-svr 26262/tcp # K3 Software-Server [Jim_Baldridge] [Jim_Baldridge] -k3software-svr 26262/udp # K3 Software-Server [Jim_Baldridge] [Jim_Baldridge] -k3software-cli 26263/tcp # K3 Software-Client [Jim_Baldridge] [Jim_Baldridge] -k3software-cli 26263/udp # K3 Software-Client [Jim_Baldridge] [Jim_Baldridge] -# 26264 De-registered 2006-04-06 -# 26265-26485 Unassigned -exoline-tcp 26486/tcp # EXOline-TCP [Lars_Mattsson] [Lars_Mattsson] 2008-12-24 -exoline-udp 26486/udp # EXOline-UDP [Lars_Mattsson] [Lars_Mattsson] 2008-12-24 -exoconfig 26487/tcp # EXOconfig [Urban_Fosseus] [Urban_Fosseus] 2008-12-24 -exoconfig 26487/udp # EXOconfig [Urban_Fosseus] [Urban_Fosseus] 2008-12-24 -# 26488 Unassigned -exonet 26489/tcp # EXOnet [Urban_Fosseus] [Urban_Fosseus] 2008-12-24 -exonet 26489/udp # EXOnet [Urban_Fosseus] [Urban_Fosseus] 2008-12-24 -# 26490-26999 Unassigned -# flex-lm 27000-27009 FLEX LM (1-10) [Daniel_Birns] [Daniel_Birns] -# Unauthorized -# Use Known on -# 27010-27344 Unassigned ports 27017, -# 27018 and -# 27019 -imagepump 27345/tcp # ImagePump [Richard_Minner] [Richard_Minner] -imagepump 27345/udp # ImagePump [Richard_Minner] [Richard_Minner] -# 27346-27441 Unassigned -jesmsjc 27442/tcp # Job controller service [Chris_Newman] [Chris_Newman] 2010-10-15 -jesmsjc 27442/udp # Job controller service [Chris_Newman] [Chris_Newman] 2010-10-15 -# 27443-27503 Unassigned -kopek-httphead 27504/tcp # Kopek HTTP Head Port [Sten_H_Danielsen] [Sten_H_Danielsen] 2002-07 -kopek-httphead 27504/udp # Kopek HTTP Head Port [Sten_H_Danielsen] [Sten_H_Danielsen] 2002-07 -# 27505-27781 Unassigned -ars-vista 27782/tcp # ARS VISTA Application [Spencer_Teran_2] [Spencer_Teran_2] 2004-11 -ars-vista 27782/udp # ARS VISTA Application [Spencer_Teran_2] [Spencer_Teran_2] 2004-11 -# 27783-27875 Unassigned -astrolink 27876/tcp # Astrolink Protocol [Alanax_Technologies_Inc] [Wesley_Eddy] 2013-01-14 -# 27876 udp Reserved -# 27877-27998 Unassigned -tw-auth-key 27999/tcp # TW Authentication/Key [Alex_Duncan_2] [Alex_Duncan_2] -# Distribution and -tw-auth-key 27999/udp # Attribute Certificate [Alex_Duncan_2] [Alex_Duncan_2] -# Services -# Unauthorized -nxlmd 28000/tcp # NX License Manager [Anthony_Greatorex] [Anthony_Greatorex] 2004-11 Use Known on -# port 28000 -nxlmd 28000/udp # NX License Manager [Anthony_Greatorex] [Anthony_Greatorex] 2004-11 -pqsp 28001/tcp # PQ Service [Peter_Laschtowitz] [Peter_Laschtowitz] 2009-09-15 -# 28001 udp Reserved -# Unauthorized -# Use Known on -# 28002-28118 Unassigned ports 28017, -# 28018 and -# 28019 -# 28119 tcp Reserved -a27-ran-ran 28119/udp # A27 cdma2000 RAN Management [ThreeGPP_2] [Zhiming_Li] 2012-04-13 -# 28120-28199 Unassigned -voxelstorm 28200/tcp # VoxelStorm game server [VoxelStorm] [Eugene_Hopkinson] 2012-11-08 -voxelstorm 28200/udp # VoxelStorm game server [VoxelStorm] [Eugene_Hopkinson] 2012-11-08 -# 28201-28239 Unassigned -siemensgsm 28240/tcp # Siemens GSM [David_Anuszewski] [David_Anuszewski] 2004-11 -siemensgsm 28240/udp # Siemens GSM [David_Anuszewski] [David_Anuszewski] 2004-11 -# 28241-29117 Unassigned -# 29118 tcp Reserved -# 29118 udp Reserved -sgsap 29118/sctp # SGsAP in 3GPP [GPP_Specifications] [GPP_Specifications] 2009-06-11 -# 29119-29166 Unassigned -otmp 29167/tcp # ObTools Message Protocol [Paul_Clark] [Paul_Clark] 2006-02 -otmp 29167/udp # ObTools Message Protocol [Paul_Clark] [Paul_Clark] 2006-02 -# 29168 tcp Reserved -# 29168 udp Reserved -sbcap 29168/sctp # SBcAP in 3GPP [GPP_Specifications] [GPP_Specifications] 2009-06-11 -iuhsctpassoc 29169/sctp # HNBAP and RUA Common [John_Meredith] [John_Meredith] 2009-09-08 -# Association -# 29170-29998 Unassigned -# data exchange protocol for -bingbang 29999/tcp # IEC61850 in wind power [DEIF_AS] [Armin_Solies] 2012-10-15 -# plants -# 29999 udp Reserved -ndmps 30000/tcp # Secure Network Data [Alioune_Thiam] [Alioune_Thiam] 2013-02-05 -# Management Protocol -# 30000 udp Reserved -pago-services1 30001/tcp # Pago Services 1 [Balduin_Mueller_Plat] [Balduin_Mueller_Plat] 2002-03 -pago-services1 30001/udp # Pago Services 1 [Balduin_Mueller_Plat] [Balduin_Mueller_Plat] 2002-03 -pago-services2 30002/tcp # Pago Services 2 [Balduin_Mueller_Plat] [Balduin_Mueller_Plat] 2002-03 -pago-services2 30002/udp # Pago Services 2 [Balduin_Mueller_Plat] [Balduin_Mueller_Plat] 2002-03 -amicon-fpsu-ra 30003/tcp # Amicon FPSU-IP Remote [Amicon_OOO] [Alexey_Novotorzhin] 2013-04-25 -# Administration -amicon-fpsu-ra 30003/udp # Amicon FPSU-IP Remote [Amicon_OOO] [Alexey_Novotorzhin] 2013-04-25 -# Administration -amicon-fpsu-s 30004/udp # Amicon FPSU-IP VPN [Amicon_OOO] [Alexey_Novotorzhin] 2013-04-25 -# 30004 tcp Reserved -# 30005-30099 Unassigned -rwp 30100/tcp # Remote Window Protocol [Maxim_Baklanovsky] [Maxim_Baklanovsky] 2015-05-20 -# 30100 udp Reserved -rwp 30100/sctp # Remote Window Protocol [Maxim_Baklanovsky] [Maxim_Baklanovsky] 2015-05-20 -# 30101-30259 Unassigned -kingdomsonline 30260/tcp # Kingdoms Online [Drake_Bankston] [Drake_Bankston] 2009-08-18 -# (CraigAvenue) -kingdomsonline 30260/udp # Kingdoms Online [Drake_Bankston] [Drake_Bankston] 2009-08-18 -# (CraigAvenue) -# 30261-30831 Unassigned -samsung-disc 30832/udp # Samsung Convergence [Samsung_2] [Young_Ki_Kim] 2013-05-29 -# Discovery Protocol -# 30832 tcp Reserved -# 30833-30998 Unassigned -ovobs 30999/tcp # OpenView Service Desk Client [Service_Desk_Product] [Service_Desk_Product] 2006-05 -ovobs 30999/udp # OpenView Service Desk Client [Service_Desk_Product] [Service_Desk_Product] 2006-05 -# 31000-31019 Unassigned -autotrac-acp 31020/tcp # Autotrac ACP 245 [Roberto_Jorge_Dino] [Roberto_Jorge_Dino] -# 31020 udp Reserved -# 31021-31028 Unassigned -# 31029 tcp Reserved -yawn 31029/udp # YaWN - Yet Another Windows [David_Spivey] [David_Spivey] 2010-08-30 -# Notifier -# 31030-31399 Unassigned -pace-licensed 31400/tcp # PACE license server [PACE_Anti-Piracy] [Allen_Cronce] 2014-04-28 -# 31400 udp Reserved -# 31401-31415 Unassigned -xqosd 31416/tcp # XQoS network monitor [Joe_Elliott] [Joe_Elliott] 2002-06 -xqosd 31416/udp # XQoS network monitor [Joe_Elliott] [Joe_Elliott] 2002-06 -# 31417-31456 Unassigned -tetrinet 31457/tcp # TetriNET Protocol [Emmanuel_Bourg] [Emmanuel_Bourg] 2004-11 -tetrinet 31457/udp # TetriNET Protocol [Emmanuel_Bourg] [Emmanuel_Bourg] 2004-11 -# 31458-31619 Unassigned -lm-mon 31620/tcp # lm mon [System_Administrator] [System_Administrator] 2003-06 -lm-mon 31620/udp # lm mon [System_Administrator] [System_Administrator] 2003-06 -# 31621-31684 Unassigned -# DS Expert Monitor -# -dsx-monitor 31685/tcp # IANA assigned this [John_Lowery] [John_Lowery] 2008-08-21 -# well-formed service name as -# a replacement for -# "dsx_monitor". -# This entry is an alias to "dsx-monitor". This entry is now -dsx_monitor 31685/tcp # DS Expert Monitor [John_Lowery] [John_Lowery] 2008-08-21 historic, not usable for use with many common service -# discovery mechanisms. -# 31685 udp Reserved -# 31686-31764 Unassigned -gamesmith-port 31765/tcp # GameSmith Port [Randy_Thompson] [Randy_Thompson] 2002-08 -gamesmith-port 31765/udp # GameSmith Port [Randy_Thompson] [Randy_Thompson] 2002-08 -# 31766-31947 Unassigned -# Embedded Device -# Configuration Protocol TX -# -iceedcp-tx 31948/tcp # IANA assigned this [Oliver_Lewis] [Oliver_Lewis] 2006-08 -# well-formed service name as -# a replacement for -# "iceedcp_tx". -# Embedded Device This entry is an alias to "iceedcp-tx". This entry is now -iceedcp_tx 31948/tcp # Configuration Protocol TX [Oliver_Lewis] [Oliver_Lewis] 2006-08 historic, not usable for use with many common service -# discovery mechanisms. -# Embedded Device -# Configuration Protocol TX -# -iceedcp-tx 31948/udp # IANA assigned this [Oliver_Lewis] [Oliver_Lewis] 2006-08 -# well-formed service name as -# a replacement for -# "iceedcp_tx". -# Embedded Device This entry is an alias to "iceedcp-tx". This entry is now -iceedcp_tx 31948/udp # Configuration Protocol TX [Oliver_Lewis] [Oliver_Lewis] 2006-08 historic, not usable for use with many common service -# discovery mechanisms. -# Embedded Device -# Configuration Protocol RX -# -iceedcp-rx 31949/tcp # IANA assigned this [Oliver_Lewis] [Oliver_Lewis] 2006-08 -# well-formed service name as -# a replacement for -# "iceedcp_rx". -# Embedded Device This entry is an alias to "iceedcp-rx". This entry is now -iceedcp_rx 31949/tcp # Configuration Protocol RX [Oliver_Lewis] [Oliver_Lewis] 2006-08 historic, not usable for use with many common service -# discovery mechanisms. -# Embedded Device -# Configuration Protocol RX -# -iceedcp-rx 31949/udp # IANA assigned this [Oliver_Lewis] [Oliver_Lewis] 2006-08 -# well-formed service name as -# a replacement for -# "iceedcp_rx". -# Embedded Device This entry is an alias to "iceedcp-rx". This entry is now -iceedcp_rx 31949/udp # Configuration Protocol RX [Oliver_Lewis] [Oliver_Lewis] 2006-08 historic, not usable for use with many common service -# discovery mechanisms. -# 31950-32033 Unassigned -iracinghelper 32034/tcp # iRacing helper service [Randy_Cassidy] [Randy_Cassidy] 2007-08-30 -iracinghelper 32034/udp # iRacing helper service [Randy_Cassidy] [Randy_Cassidy] 2007-08-30 -# 32035-32248 Unassigned -t1distproc60 32249/tcp # T1 Distributed Processor [Peter_Beahan] [Peter_Beahan] 2004-11 -t1distproc60 32249/udp # T1 Distributed Processor [Peter_Beahan] [Peter_Beahan] 2004-11 -# 32250-32482 Unassigned -apm-link 32483/tcp # Access Point Manager Link [Tony_Diodato] [Tony_Diodato] 2005-08 -apm-link 32483/udp # Access Point Manager Link [Tony_Diodato] [Tony_Diodato] 2005-08 -# 32484-32634 Unassigned -sec-ntb-clnt 32635/tcp # SecureNotebook-CLNT [Eric_Cantineau] [Eric_Cantineau] 2004-11 -sec-ntb-clnt 32635/udp # SecureNotebook-CLNT [Eric_Cantineau] [Eric_Cantineau] 2004-11 -DMExpress 32636/tcp # DMExpress [Arnie_Farrelly] [Arnie_Farrelly] -DMExpress 32636/udp # DMExpress [Arnie_Farrelly] [Arnie_Farrelly] -# 32637-32766 Unassigned -filenet-powsrm 32767/tcp # FileNet BPM [Chris_Adkins] [Chris_Adkins] 2006-08 -# WS-ReliableMessaging Client -filenet-powsrm 32767/udp # FileNet BPM [Chris_Adkins] [Chris_Adkins] 2006-08 -# WS-ReliableMessaging Client -filenet-tms 32768/tcp # Filenet TMS [Daniel_Whelan] [Daniel_Whelan] -filenet-tms 32768/udp # Filenet TMS [Daniel_Whelan] [Daniel_Whelan] -filenet-rpc 32769/tcp # Filenet RPC [Daniel_Whelan] [Daniel_Whelan] -filenet-rpc 32769/udp # Filenet RPC [Daniel_Whelan] [Daniel_Whelan] -filenet-nch 32770/tcp # Filenet NCH [Daniel_Whelan] [Daniel_Whelan] -filenet-nch 32770/udp # Filenet NCH [Daniel_Whelan] [Daniel_Whelan] -filenet-rmi 32771/tcp # FileNET RMI [Chris_Adkins] [Chris_Adkins] -filenet-rmi 32771/udp # FileNet RMI [Chris_Adkins] [Chris_Adkins] -filenet-pa 32772/tcp # FileNET Process Analyzer [Chris_Adkins] [Chris_Adkins] 2003-01 -filenet-pa 32772/udp # FileNET Process Analyzer [Chris_Adkins] [Chris_Adkins] 2003-01 -filenet-cm 32773/tcp # FileNET Component Manager [Chris_Adkins] [Chris_Adkins] 2003-08 -filenet-cm 32773/udp # FileNET Component Manager [Chris_Adkins] [Chris_Adkins] 2003-08 -filenet-re 32774/tcp # FileNET Rules Engine [Chris_Adkins] [Chris_Adkins] 2003-08 -filenet-re 32774/udp # FileNET Rules Engine [Chris_Adkins] [Chris_Adkins] 2003-08 -filenet-pch 32775/tcp # Performance Clearinghouse [Tim_Morgan_2] [Tim_Morgan_2] 2005-11 -filenet-pch 32775/udp # Performance Clearinghouse [Tim_Morgan_2] [Tim_Morgan_2] 2005-11 -filenet-peior 32776/tcp # FileNET BPM IOR [Chris_Adkins] [Chris_Adkins] 2006-05 -filenet-peior 32776/udp # FileNET BPM IOR [Chris_Adkins] [Chris_Adkins] 2006-05 -filenet-obrok 32777/tcp # FileNet BPM CORBA [Chris_Adkins] [Chris_Adkins] 2006-10 -filenet-obrok 32777/udp # FileNet BPM CORBA [Chris_Adkins] [Chris_Adkins] 2006-10 -# 32778-32800 Unassigned -mlsn 32801/tcp # Multiple Listing Service [Corey_Leong] [Corey_Leong] 2010-10-11 -# Network -mlsn 32801/udp # Multiple Listing Service [Corey_Leong] [Corey_Leong] 2010-10-11 -# Network -# 32802-32810 Unassigned -retp 32811/tcp # Real Estate Transport [Corey_Leong] [Corey_Leong] 2010-10-11 -# Protocol -# 32811 udp Reserved -# 32812-32895 Unassigned -idmgratm 32896/tcp # Attachmate ID Manager [George_Gianelos_2] [George_Gianelos_2] 2003-03 -idmgratm 32896/udp # Attachmate ID Manager [George_Gianelos_2] [George_Gianelos_2] 2003-03 -# 32897-33059 Unassigned -mysqlx 33060/tcp # MySQL Database Extended [Oracle_8] [Omer_BarNir] 2015-08-06 -# Interface -# 33060 udp Reserved -# 33061-33122 Unassigned -aurora-balaena 33123/tcp # Aurora (Balaena Ltd) [Andrew_Mather] [Andrew_Mather] 2008-02-14 -aurora-balaena 33123/udp # Aurora (Balaena Ltd) [Andrew_Mather] [Andrew_Mather] 2008-02-14 -# 33124-33330 Unassigned -diamondport 33331/tcp # DiamondCentral Interface [Edward_Browdy] [Edward_Browdy] 2002-07 -diamondport 33331/udp # DiamondCentral Interface [Edward_Browdy] [Edward_Browdy] 2002-07 -# 33332 Unassigned -dgi-serv 33333/tcp # Digital Gaslight Service [George_Flanagin] [George_Flanagin] 2010-03-02 -# 33333 udp Reserved -speedtrace 33334/tcp # SpeedTrace TraceAgent [Holger_Heinrich] [Holger_Heinrich] 2012-02-01 -speedtrace-disc 33334/udp # SpeedTrace TraceAgent [Holger_Heinrich] [Holger_Heinrich] 2012-02-01 -# Discovery -# 33335-33433 Unassigned -traceroute 33434/tcp # traceroute use [IANA] [IANA] -traceroute 33434/udp # traceroute use [IANA] [IANA] -# 33435-33655 Unassigned -snip-slave 33656/tcp # SNIP Slave [Dr_Chris_Tucker] [Dr_Chris_Tucker] 2005-08 -snip-slave 33656/udp # SNIP Slave [Dr_Chris_Tucker] [Dr_Chris_Tucker] 2005-08 -# 33657-34248 Unassigned -turbonote-2 34249/tcp # TurboNote Relay Server [Peter_Hyde] [Peter_Hyde] -# Default Port -turbonote-2 34249/udp # TurboNote Relay Server [Peter_Hyde] [Peter_Hyde] -# Default Port -# 34250-34377 Unassigned -p-net-local 34378/tcp # P-Net on IP local [Kurt_Nissen] [Kurt_Nissen] 2004-02 -p-net-local 34378/udp # P-Net on IP local [Kurt_Nissen] [Kurt_Nissen] 2004-02 -p-net-remote 34379/tcp # P-Net on IP remote [Kurt_Nissen] [Kurt_Nissen] 2004-02 -p-net-remote 34379/udp # P-Net on IP remote [Kurt_Nissen] [Kurt_Nissen] 2004-02 -# 34380-34566 Unassigned -dhanalakshmi 34567/tcp # dhanalakshmi.org EDI Service [Girish_Gopalakrishna] [Girish_Gopalakrishna] 2010-04-20 -# 34567 udp Reserved -# 34568-34961 Unassigned -profinet-rt 34962/tcp # PROFInet RT Unicast [Peter_Wenzel] [Peter_Wenzel] 2004-11 -profinet-rt 34962/udp # PROFInet RT Unicast [Peter_Wenzel] [Peter_Wenzel] 2004-11 -profinet-rtm 34963/tcp # PROFInet RT Multicast [Peter_Wenzel] [Peter_Wenzel] 2004-11 -profinet-rtm 34963/udp # PROFInet RT Multicast [Peter_Wenzel] [Peter_Wenzel] 2004-11 -profinet-cm 34964/tcp # PROFInet Context Manager [Peter_Wenzel] [Peter_Wenzel] 2004-11 -profinet-cm 34964/udp # PROFInet Context Manager [Peter_Wenzel] [Peter_Wenzel] 2004-11 -# 34965-34979 Unassigned -ethercat 34980/tcp # EtherCAT Port [Martin_Rostan] [Martin_Rostan] 2003-11 -ethercat 34980/udp # EhterCAT Port [Martin_Rostan] [Martin_Rostan] 2003-11 -# 34981-34999 Unassigned -heathview 35000/tcp # HeathView [Heathwest_Systems_Limited] [Andrew_Porrer] 2013-03-21 -# 35000 udp Reserved -rt-viewer 35001/tcp # ReadyTech Viewer [ReadyTech_Corporation] [Kevin_Woodward] 2013-09-13 -rt-viewer 35001/udp # ReadyTech Viewer [ReadyTech_Corporation] [Kevin_Woodward] 2013-09-13 -rt-sound 35002/tcp # ReadyTech Sound Server [ReadyTech_Corporation] [Kevin_Woodward] 2013-09-13 -# 35002 udp Reserved -rt-devicemapper 35003/tcp # ReadyTech DeviceMapper [ReadyTech_Corporation] [Kevin_Woodward] 2013-09-13 -# Server -# 35003 udp Reserved -rt-classmanager 35004/tcp # ReadyTech ClassManager [ReadyTech_Corporation] [Kevin_Woodward] 2013-09-13 -rt-classmanager 35004/udp # ReadyTech ClassManager [ReadyTech_Corporation] [Kevin_Woodward] 2013-09-13 -rt-labtracker 35005/tcp # ReadyTech LabTracker [ReadyTech_Corporation] [Kevin_Woodward] 2013-09-13 -# 35005 udp Reserved -rt-helper 35006/tcp # ReadyTech Helper Service [ReadyTech_Corporation] [Kevin_Woodward] 2013-09-13 -# 35006 udp Reserved -# 35007-35353 Unassigned -kitim 35354/tcp # KIT Messenger [Rudi_Visser] [Rudi_Visser] 2011-07-07 -# 35354 udp Reserved -altova-lm 35355/tcp # Altova License Management [Alexander_Falk_2] [Alexander_Falk_2] 2011-07-07 -altova-lm-disc 35355/udp # Altova License Management [Alexander_Falk_2] [Alexander_Falk_2] 2011-07-07 -# Discovery -guttersnex 35356/tcp # Gutters Note Exchange [Squee_Application_Development] [Tristan_Seifert_2] 2011-07-19 -# 35356 udp Reserved -openstack-id 35357/tcp # OpenStack ID Service [Rackspace_Hosting] [Ziad_Sawalha] 2011-08-15 -# 35357 udp Reserved -# 35358-36000 Unassigned -allpeers 36001/tcp # AllPeers Network [Cedric_Maloux] [Cedric_Maloux] 2007-04 -allpeers 36001/udp # AllPeers Network [Cedric_Maloux] [Cedric_Maloux] 2007-04 -# 36002-36410 Unassigned -wlcp 36411/udp # Wireless LAN Control plane [ThreeGPP_3] [Frederic_Firmin] 2014-11-14 -# Protocol (WLCP) -# 36411 tcp Reserved -# 36412 tcp Reserved -# 36412 udp Reserved -s1-control 36412/sctp # S1-Control Plane (3GPP) [Kimmo_Kymalainen] [Kimmo_Kymalainen] 2009-09-01 -# 36413-36421 Unassigned -# 36422 tcp Reserved -# 36422 udp Reserved -x2-control 36422/sctp # X2-Control Plane (3GPP) [Kimmo_Kymalainen] [Kimmo_Kymalainen] 2009-09-01 -slmap 36423/sctp # SLm Interface Application [ThreeGPP_4] [Kimmo_Kymalainen] 2015-06-18 -# Protocol -nq-ap 36424/sctp # Nq and Nq' Application [ThreeGPP_4] [Kimmo_Kymalainen] 2015-06-18 -# Protocol -# 36425-36442 Unassigned -m2ap 36443/sctp # M2 Application Part [Dario_S_Tonesi] [Dario_S_Tonesi] 2011-02-07 -m3ap 36444/sctp # M3 Application Part [Dario_S_Tonesi] [Dario_S_Tonesi] 2011-02-07 -# 36445-36461 Unassigned -# 36462 tcp Reserved -# 36462 udp Reserved -xw-control 36462/sctp # Xw-Control Plane (3GPP) [Boubacar_KIMNBA_DIT_ADAMOU] [Boubacar_KIMNBA_DIT_ADAMOU] 2015-11-13 -# 36463-36523 Unassigned -febooti-aw 36524/tcp # Febooti Automation Workshop [Maris_Bormanis] [Maris_Bormanis] 2011-06-10 -# 36524 udp Reserved -# 36525-36601 Unassigned -observium-agent 36602/tcp # Observium statistics [Observium] [Adam_Armstrong] 2013-05-10 -# collection agent -# 36602 udp Reserved -# 36603-36699 Unassigned -mapx 36700/tcp # MapX communication [MicroTechniX] [Yarochkin_Michail] 2014-10-13 -# 36700 udp Reserved -# 36701-36864 Unassigned -kastenxpipe 36865/tcp # KastenX Pipe [Guy_Cheng] [Guy_Cheng] -kastenxpipe 36865/udp # KastenX Pipe [Guy_Cheng] [Guy_Cheng] -# 36866-37474 Unassigned -neckar 37475/tcp # science + computing's Venus [Ralf_Allrutz] [Ralf_Allrutz] 2002-02 -# Administration Port -neckar 37475/udp # science + computing's Venus [Ralf_Allrutz] [Ralf_Allrutz] 2002-02 -# Administration Port -# 37476-37482 Unassigned -gdrive-sync 37483/tcp # Google Drive Sync [Google_Inc] [Jason_Schiller] 2013-02-01 2015-07-31 -# 37483 udp Reserved -# 37484-37600 Unassigned -eftp 37601/tcp # Epipole File Transfer [Epipole_Limited] [Colin_Buchanan] 2014-11-13 -# Protocol -# 37601 udp Reserved -# 37602-37653 Unassigned -unisys-eportal 37654/tcp # Unisys ClearPath ePortal [Sung_U_Ro] [Sung_U_Ro] 2006-01 -unisys-eportal 37654/udp # Unisys ClearPath ePortal [Sung_U_Ro] [Sung_U_Ro] 2006-01 -# 37655-37999 Unassigned -ivs-database 38000/tcp # InfoVista Server Database [InfoVista] [Sebastien_Bouchex_Bellomie] 2014-05-23 -# 38000 udp Reserved -ivs-insertion 38001/tcp # InfoVista Server Insertion [InfoVista] [Sebastien_Bouchex_Bellomie] 2014-05-23 -# 38001 udp Reserved -cresco-control 38002/tcp # Cresco Controller [UofK] [Cody_Bumgardner] 2014-11-21 -crescoctrl-disc 38002/udp # Cresco Controller Discovery [UofK] [Cody_Bumgardner] 2014-11-21 -# 38003-38200 Unassigned -galaxy7-data 38201/tcp # Galaxy7 Data Tunnel [Tatham_Oddie] [Tatham_Oddie] 2002-09 -galaxy7-data 38201/udp # Galaxy7 Data Tunnel [Tatham_Oddie] [Tatham_Oddie] 2002-09 -fairview 38202/tcp # Fairview Message Service [Jim_Lyle] [Jim_Lyle] 2005-11 Defined TXT keys: DevID=, DevType=, -# DevStat= -fairview 38202/udp # Fairview Message Service [Jim_Lyle] [Jim_Lyle] 2005-11 Defined TXT keys: DevID=, DevType=, -# DevStat= -agpolicy 38203/tcp # AppGate Policy Server [Martin_Forssen] [Martin_Forssen] 2004-11 -agpolicy 38203/udp # AppGate Policy Server [Martin_Forssen] [Martin_Forssen] 2004-11 -# 38204-38799 Unassigned -# Sruth is a service for the -# distribution of routinely- -# generated but arbitrary -# files based on a -sruth 38800/tcp # publish/subscribe [University_Corporation_for_Atmospheric_Research] [Steven_Emmerson] 2012-05-07 -# distribution model and -# implemented using a -# peer-to-peer transport -# mechanism -# 38800 udp Reserved -# 38801-38864 Unassigned -# Security approval process -secrmmsafecopya 38865/tcp # for use of the secRMM [Squadra_Technologies] [Anthony_LaMark] 2012-03-14 -# SafeCopy program -# 38865 udp Reserved -# 38866-39680 Unassigned -turbonote-1 39681/tcp # TurboNote Default Port [Peter_Hyde] [Peter_Hyde] -turbonote-1 39681/udp # TurboNote Default Port [Peter_Hyde] [Peter_Hyde] -# 39682-39999 Unassigned -safetynetp 40000/tcp # SafetyNET p [Roland_Rupp] [Roland_Rupp] 2006-11 -safetynetp 40000/udp # SafetyNET p [Roland_Rupp] [Roland_Rupp] 2006-11 -# 40001-40403 Unassigned -sptx 40404/tcp # Simplify Printing TX [Tricerat] [Eric_Musgrave] 2013-12-09 -# 40404 udp Reserved -# 40405-40840 Unassigned -cscp 40841/tcp # CSCP [Michael_Dodge] [Michael_Dodge] -cscp 40841/udp # CSCP [Michael_Dodge] [Michael_Dodge] -csccredir 40842/tcp # CSCCREDIR [Sudhir_Menon] [Sudhir_Menon] -csccredir 40842/udp # CSCCREDIR [Sudhir_Menon] [Sudhir_Menon] -csccfirewall 40843/tcp # CSCCFIREWALL [Sudhir_Menon] [Sudhir_Menon] -csccfirewall 40843/udp # CSCCFIREWALL [Sudhir_Menon] [Sudhir_Menon] -# 40844-40852 Unassigned -# 40853 tcp Reserved -ortec-disc 40853/udp # ORTEC Service Discovery [Jesse_Ursery] [Jesse_Ursery] 2010-11-22 -# 40854-41110 Unassigned -fs-qos 41111/tcp # Foursticks QoS Protocol [Chee_Kent_Lam] [Chee_Kent_Lam] 2002-04 -fs-qos 41111/udp # Foursticks QoS Protocol [Chee_Kent_Lam] [Chee_Kent_Lam] 2002-04 -# 41112-41120 Unassigned -tentacle 41121/tcp # Tentacle Server [Sancho_Lerena] [Sancho_Lerena] 2009-06-02 -# 41121 udp Reserved -# 41122-41229 Unassigned -z-wave-s 41230/tcp # Z-Wave Protocol over SSL/TLS [Sigma_Designs_3] [Anders_Brandt_4] 2015-06-26 -z-wave-s 41230/udp # Z-Wave Protocol over DTLS [Sigma_Designs_3] [Anders_Brandt_4] 2015-06-26 -# 41231-41793 Unassigned -crestron-cip 41794/tcp # Crestron Control Port [Ed_Ranney] [Ed_Ranney] 2003-01 -crestron-cip 41794/udp # Crestron Control Port [Ed_Ranney] [Ed_Ranney] 2003-01 -crestron-ctp 41795/tcp # Crestron Terminal Port [Ed_Ranney] [Ed_Ranney] 2003-01 -crestron-ctp 41795/udp # Crestron Terminal Port [Ed_Ranney] [Ed_Ranney] 2003-01 -crestron-cips 41796/tcp # Crestron Secure Control Port [Crestron_Electronics] [Manish_Talreja] 2012-06-27 -# 41796 udp Reserved -crestron-ctps 41797/tcp # Crestron Secure Terminal [Crestron_Electronics] [Manish_Talreja] 2012-06-27 -# Port -# 41797 udp Reserved -# Unauthorized -# 41798-42507 Unassigned Use Known on -# port 42000 -candp 42508/tcp # Computer Associates network [Jon_Press] [Jon_Press] 2005-09 -# discovery protocol -candp 42508/udp # Computer Associates network [Jon_Press] [Jon_Press] 2005-09 -# discovery protocol -candrp 42509/tcp # CA discovery response [Jon_Press] [Jon_Press] 2005-08 -candrp 42509/udp # CA discovery response [Jon_Press] [Jon_Press] 2005-08 -caerpc 42510/tcp # CA eTrust RPC [Jon_Press] [Jon_Press] 2005-08 -caerpc 42510/udp # CA eTrust RPC [Jon_Press] [Jon_Press] 2005-08 -# 42511-42999 Unassigned -recvr-rc 43000/tcp # Receiver Remote Control [Research_Electronics_International] [Ross_Binkley] 2012-12-20 -recvr-rc-disc 43000/udp # Receiver Remote Control [Research_Electronics_International] [Ross_Binkley] 2012-12-20 -# Discovery -# 43001-43187 Unassigned -reachout 43188/tcp # REACHOUT [Roman_Kriis] [Roman_Kriis] -reachout 43188/udp # REACHOUT [Roman_Kriis] [Roman_Kriis] -ndm-agent-port 43189/tcp # NDM-AGENT-PORT [Roman_Kriis] [Roman_Kriis] -ndm-agent-port 43189/udp # NDM-AGENT-PORT [Roman_Kriis] [Roman_Kriis] -ip-provision 43190/tcp # IP-PROVISION [Roman_Kriis] [Roman_Kriis] -ip-provision 43190/udp # IP-PROVISION [Roman_Kriis] [Roman_Kriis] -noit-transport 43191/tcp # Reconnoiter Agent Data [Theo_Schlossnagle] [Theo_Schlossnagle] 2009-05-19 -# Transport -# 43191 udp Reserved -# 43192-43209 Unassigned -shaperai 43210/tcp # Shaper Automation Server [Shaper_Automation] [Yohann_Sulaiman] 2012-06-22 -# Management -shaperai-disc 43210/udp # Shaper Automation Server [Shaper_Automation] [Yohann_Sulaiman] 2012-06-22 -# Management Discovery -# 43211-43438 Unassigned -eq3-update 43439/tcp # EQ3 firmware update [eQ-3_Entwicklung_GmbH] [Tido_de_Vries] 2012-02-10 2014-05-09 -eq3-config 43439/udp # EQ3 discovery and [eQ-3_Entwicklung_GmbH] [Tido_de_Vries] 2012-02-10 2014-05-09 -# configuration -ew-mgmt 43440/tcp # Cisco EnergyWise Management -ew-disc-cmd 43440/udp # Cisco EnergyWise Discovery [John_Parello] [John_Parello] 2009-05-19 -# and Command Flooding -ciscocsdb 43441/tcp # Cisco NetMgmt DB Ports [Cisco_Systems] [Cisco_Systems] 2005-11 -ciscocsdb 43441/udp # Cisco NetMgmt DB Ports [Cisco_Systems] [Cisco_Systems] 2005-11 -# 43442-44122 Unassigned -z-wave-tunnel 44123/tcp # Z-Wave Secure Tunnel [Sigma_Designs_Inc] [Anders_Brandt_3] 2012-10-12 2015-06-26 -# 44123 udp Reserved -# 43124-44320 Unassigned -pmcd 44321/tcp # PCP server (pmcd) [Ken_McDonell] [Ken_McDonell] 2010-12-20 -pmcd 44321/udp # PCP server (pmcd) [Ken_McDonell] [Ken_McDonell] 2010-12-20 -pmcdproxy 44322/tcp # PCP server (pmcd) proxy [Ken_McDonell] [Ken_McDonell] 2003-07 2010-12-20 -pmcdproxy 44322/udp # PCP server (pmcd) proxy [Ken_McDonell] [Ken_McDonell] 2003-07 2010-12-20 -pmwebapi 44323/tcp # HTTP binding for Performance [Performance_Co-Pilot_PCP_Project] [Ken_McDonell_2] 2013-10-09 -# Co-Pilot client API -# 44323 udp Unassigned "pcp" assignment withdrawn, moved to port 5351 per RFC6887 -# 44324-44443 Unassigned -cognex-dataman 44444/tcp # Cognex DataMan Management [Cognex] [Mario_Joussen] 2012-08-28 -# Protocol -# 44444 udp Reserved -# Known -# UNAUTHORIZED -# 44445-44543 Unassigned USE: Ports -# 44515 & -# 44516 -# 44544 tcp Reserved -domiq 44544/udp # DOMIQ Building Automation [DOMIQ_Sp_zoo] [Filip_Zawadiak] 2011-08-29 -# 44545-44552 Unassigned -rbr-debug 44553/tcp # REALbasic Remote Debug [Aaron_Ballman] [Aaron_Ballman] 2004-11 -rbr-debug 44553/udp # REALbasic Remote Debug [Aaron_Ballman] [Aaron_Ballman] 2004-11 -# 44554-44599 Unassigned -# 44600 tcp Reserved -asihpi 44600/udp # AudioScience HPI [Eliot_Blennerhassett] [Eliot_Blennerhassett] 2011-07-07 -# 44601-44817 Unassigned -# EtherNet/IP messaging -# -EtherNet-IP-2 44818/tcp # IANA assigned this [Brian_Batke_2] [Brian_Batke_2] New contact added for port 44818 on 2008-02-01 -# well-formed service name as -# a replacement for -# "EtherNet/IP-2". -# New contact added for port 44818 on 2008-02-01 This entry is -EtherNet/IP-2 44818/tcp # EtherNet/IP messaging [Brian_Batke_2] [Brian_Batke_2] an alias to "EtherNet-IP-2". This entry is now historic, not -# usable for use with many common service discovery mechanisms. -# EtherNet/IP messaging -# -EtherNet-IP-2 44818/udp # IANA assigned this [Brian_Batke_2] [Brian_Batke_2] New contact added for port 44818 on 2008-02-01 -# well-formed service name as -# a replacement for -# "EtherNet/IP-2". -# New contact added for port 44818 on 2008-02-01 This entry is -EtherNet/IP-2 44818/udp # EtherNet/IP messaging [Brian_Batke_2] [Brian_Batke_2] an alias to "EtherNet-IP-2". This entry is now historic, not -# usable for use with many common service discovery mechanisms. -# 44819-44899 Unassigned -# M3DA is used for efficient -m3da 44900/tcp # machine-to-machine [Eclipse_Foundation] [Didier_Lahay] 2013-02-22 -# communications -# M3DA Discovery is used for -m3da-disc 44900/udp # efficient machine-to-machine [Eclipse_Foundation] [Didier_Lahay] 2013-02-22 -# communications -# 44901-44999 Unassigned -# NSi AutoStore Status -asmp 45000/tcp # Monitoring Protocol data [Notable_Solutions_Inc] [Andrew_Andrews] 2011-09-01 -# transfer -# NSi AutoStore Status -asmp-mon 45000/udp # Monitoring Protocol device [Notable_Solutions_Inc] [Andrew_Andrews] 2011-09-01 -# monitoring -# NSi AutoStore Status -asmps 45001/tcp # Monitoring Protocol secure [Notable_Solutions_Inc] [Andrew_Andrews] 2011-09-01 -# data transfer -# 45001 udp Reserved -rs-status 45002/tcp # Redspeed Status Monitor [Redspeed_International_Ltd] [Simon_Griffiths] 2015-03-10 -# 45002 udp Reserved -# 45003-45044 Unassigned -synctest 45045/tcp # Remote application control [Eleks_Ltd] [Andriy_Skop] 2013-04-08 -# protocol -# 45045 udp Reserved -# 45046-45053 Unassigned -invision-ag 45054/tcp # InVision AG [Matthias_Schroer] [Matthias_Schroer] -invision-ag 45054/udp # InVision AG [Matthias_Schroer] [Matthias_Schroer] -# 45055-45677 Unassigned -eba 45678/tcp # EBA PRISE [Patrick_Kara] [Patrick_Kara] -eba 45678/udp # EBA PRISE [Patrick_Kara] [Patrick_Kara] -# 45679-45823 Unassigned -dai-shell 45824/tcp # Server for the DAI family of [Data_Access_Inc] [Adam_Robinson] 2012-04-30 -# client-server products -# 45824 udp Reserved -qdb2service 45825/tcp # Qpuncture Data Access [Michael_Yun] [Michael_Yun] 2007-10-24 -# Service -qdb2service 45825/udp # Qpuncture Data Access [Michael_Yun] [Michael_Yun] 2007-10-24 -# Service -# 45826-45965 Unassigned -ssr-servermgr 45966/tcp # SSRServerMgr [Jeremy_Gilliat] [Jeremy_Gilliat] -ssr-servermgr 45966/udp # SSRServerMgr [Jeremy_Gilliat] [Jeremy_Gilliat] -# 45967-46997 Unassigned -# Connection between a desktop -spremotetablet 46998/tcp # computer or server and a [SOFTPRO_GmbH] [Christoph_Hipp] 2012-07-19 2013-08-02 -# signature tablet to capture -# handwritten signatures -# 46998 udp Reserved -mediabox 46999/tcp # MediaBox Server [Alexander_Graef] [Alexander_Graef] 2004-11 -mediabox 46999/udp # MediaBox Server [Alexander_Graef] [Alexander_Graef] 2004-11 -mbus 47000/tcp # Message Bus [Dirk_Kutscher] [Dirk_Kutscher] -mbus 47000/udp # Message Bus [Dirk_Kutscher] [Dirk_Kutscher] -winrm 47001/tcp # Windows Remote Management [Ryan_Mack] [Ryan_Mack] 2009-04-29 -# Service -# 47001 udp Reserved -# 47002-47099 Unassigned -# Configuration of motors -jvl-mactalk 47100/udp # connected to Industrial [JVL_Industri_Elektronik] [Kim_Berthelsen] 2012-12-21 -# Ethernet -# 47100 tcp Reserved -# 47101-47556 Unassigned -dbbrowse 47557/tcp # Databeam Corporation [Cindy_Martin] [Cindy_Martin] -dbbrowse 47557/udp # Databeam Corporation [Cindy_Martin] [Cindy_Martin] -# 47558-47623 Unassigned -directplaysrvr 47624/tcp # Direct Play Server [Ajay_Jindal] [Ajay_Jindal] -directplaysrvr 47624/udp # Direct Play Server [Ajay_Jindal] [Ajay_Jindal] -# 47625-47805 Unassigned -ap 47806/tcp # ALC Protocol [Dave_Robin] [Dave_Robin] -ap 47806/udp # ALC Protocol [Dave_Robin] [Dave_Robin] -# 47807 Unassigned -bacnet 47808/tcp # Building Automation and [Coleman_Brumley] [Coleman_Brumley] 2011-02-10 -# Control Networks -bacnet 47808/udp # Building Automation and [Coleman_Brumley] [Coleman_Brumley] 2011-02-10 -# Control Networks -presonus-ucnet 47809/udp # PreSonus Universal Control [PreSonus_Audio_Electronics_Inc] [Matthias_Juwan] 2013-07-12 -# Network Protocol -# 47809 tcp Reserved -# 47810-47999 Unassigned -nimcontroller 48000/tcp # Nimbus Controller [Carstein_Seeberg_2] [Carstein_Seeberg_2] -nimcontroller 48000/udp # Nimbus Controller [Carstein_Seeberg_2] [Carstein_Seeberg_2] -nimspooler 48001/tcp # Nimbus Spooler [Carstein_Seeberg_2] [Carstein_Seeberg_2] -nimspooler 48001/udp # Nimbus Spooler [Carstein_Seeberg_2] [Carstein_Seeberg_2] -nimhub 48002/tcp # Nimbus Hub [Carstein_Seeberg_2] [Carstein_Seeberg_2] -nimhub 48002/udp # Nimbus Hub [Carstein_Seeberg_2] [Carstein_Seeberg_2] -nimgtw 48003/tcp # Nimbus Gateway [Carstein_Seeberg_2] [Carstein_Seeberg_2] -nimgtw 48003/udp # Nimbus Gateway [Carstein_Seeberg_2] [Carstein_Seeberg_2] -nimbusdb 48004/tcp # NimbusDB Connector [Stephen_Harrison] [Stephen_Harrison] 2011-01-24 -# 48004 udp Reserved -nimbusdbctrl 48005/tcp # NimbusDB Control [Stephen_Harrison] [Stephen_Harrison] 2011-01-24 -# 48005 udp Reserved -# 48006-48048 Unassigned -3gpp-cbsp 48049/tcp # 3GPP Cell Broadcast Service [Gert_Thomasen] [Gert_Thomasen] 2009-12-07 -# Protocol -# 48049 udp Reserved -# WeFi Access Network -weandsf 48050/tcp # Discovery and Selection [WeFi_Inc] [Eran_Naveh] 2013-07-19 -# Function -# 48050 udp Reserved -# 48051-48127 Unassigned -isnetserv 48128/tcp # Image Systems Network [Bengt_Gustafsson] [Bengt_Gustafsson] 2006-05 -# Services -isnetserv 48128/udp # Image Systems Network [Bengt_Gustafsson] [Bengt_Gustafsson] 2006-05 -# Services -blp5 48129/tcp # Bloomberg locator [Albert_Hou] [Albert_Hou] 2006-05 -blp5 48129/udp # Bloomberg locator [Albert_Hou] [Albert_Hou] 2006-05 -# 48130-48555 Unassigned -com-bardac-dw 48556/tcp # com-bardac-dw [Nicholas_J_Howes] [Nicholas_J_Howes] -com-bardac-dw 48556/udp # com-bardac-dw [Nicholas_J_Howes] [Nicholas_J_Howes] -# 48557-48618 Unassigned -iqobject 48619/tcp # iqobject [Bjorn_de_Bonnenfant] [Bjorn_de_Bonnenfant] 2003-11 -iqobject 48619/udp # iqobject [Bjorn_de_Bonnenfant] [Bjorn_de_Bonnenfant] 2003-11 -# 48620-48652 Unassigned -robotraconteur 48653/tcp # Robot Raconteur transport [Wason_Technology_LLC] [John_Wason] 2014-01-27 -robotraconteur 48653/udp # Robot Raconteur transport [Wason_Technology_LLC] [John_Wason] 2014-01-27 -# 48654-48999 Unassigned -matahari 49000/tcp # Matahari Broker [Matahari_Project] [Zane_Bitter] 2011-08-31 -# 49000 udp Reserved -# 49001-49150 Unassigned -# 49151 IANA Reserved -# argus ARGUS Protocol -# arp Address Resolution Protocol -# bbn-rcc-mon BBN RCC Monitoring -# bootp Bootstrap Protocol -# br-sat-mon Backroom SATNET Monitoring -# cftp CFTP -# chaos CHAOS Protocol -# clock DCNET Time Server Protocol -# cmot Common Mgmnt Info Ser and -# Prot over TCP/IP -# cookie-jar Authentication Scheme -# dcn-meas DCN Measurement Subsystems -# Protocol -# dgp Dissimilar Gateway Protocol -# dmf-mail Digest Message Format for -# Mail -# egp Exterior Gateway Protocol -# ehf-mail Encoding Header Field for -# Mail -# emcon Emission Control Protocol -# fconfig Fujitsu Config Protocol -# ggp Gateway Gateway Protocol -# hmp Host Monitoring Protocol -# host2-ns Host2 Name Server -# icmp Internet Control Message -# Protocol -# igmp Internet Group Management -# Protocol -# igp Interior Gateway Protocol -# imap2 Interim Mail Access Protocol -# version 2 -# ip Internet Protocol -# ipcu Internet Packet Core Utility -# ippc Internet Pluribus Packet -# Core -# ip-arc Internet Protocol on ARCNET -# ip-arpa Internet Protocol on ARPANET -# ip-cmprs Compressing TCP/IP Headers -# ip-dc Internet Protocol on DC -# Networks -# ip-dvmrp Distance Vector Multicast -# Routing Protocol -# ip-e Internet Protocol on -# Ethernet Networks -# ip-ee Internet Protocol on Exp. -# Ethernet Nets -# ip-fddi Transmission of IP over FDDI -# ip-hc Internet Protocol on -# Hyperchannnel -# ip-ieee Internet Protocol on IEEE -# 802 -# ip-ipx Transmission of 802.2 over -# IPX Networks -# ip-mtu IP MTU Discovery Options -# ip-netbios Internet Protocol over -# NetBIOS Networks -# ip-slip Transmission of IP over -# Serial Lines -# ip-wb Internet Protocol on -# Wideband Network -# ip-x25 Internet Protocol on X.25 -# Networks -# irtp Internet Reliable -# Transaction Protocol -# iso-tp4 ISO Transport Protocol Class -# 4 -# larp Locus Address Resoultion -# Protocol -# leaf-1 Leaf-1 Protocol -# leaf-2 Leaf-2 Protocol -# loc-srv Location Service -# mail Format of Electronic Mail -# Messages -# merit-inp MERIT Internodal Protocol -# mib Management Information Base -# mihcs MIH Command Services [RFC5679] -# mihes MIH Event Services [RFC5679] -# mihis MIH Information Services [RFC5679] -# mfe-nsp MFE Network Services -# Protocol -# mit-subnet MIT Subnet Support -# mux Multiplexing Protocol -# netblt Bulk Data Transfer Protocol -# neted Network Standard Text Editor -# netrjs Remote Job Service -# nfile A File Access Protocol -# nvp-ii Network Voice Protocol -# ospf Open Shortest Path First -# Interior GW Protocol -# pcmail Pcmail Transport Protocol -# ppp Point-to-Point Protocol -# prm Packet Radio Measurement -# pup PUP Protocol -# quote Quote of the Day Protocol -# rarp A Reverse Address Resolution -# Protocol -# ratp Reliable Asynchronous -# Transfer Protocol -# rdp Reliable Data Protocol -# rip Routing Information Protocol -# rvd Remote Virtual Disk Protocol -# sat-expak Satnet and Backroom EXPAK -# sat-mon SATNET Monitoring -# smi Structure of Management -# Information -# stp Stream Protocol -# sun-rpc SUN Remote Procedure Call -# tcp Transmission Control -# Protocol -# tcp-aco TCP Alternate Checksum -# Option -# thinwire Thinwire Protocol -# tp-tcp ISO Transport Service on top -# of the TCP -# trunk-1 Trunk-1 Protocol -# trunk-2 Trunk-2 Protocol -# ucl University College London -# Protocol -# udp User Datagram Protocol -# users Active Users Protocol -# via-ftp VIA Systems-File Transfer -# Protocol -# visa VISA Protocol -# vmtp Versatile Message -# Transaction Protocol -# wb-expak Wideband EXPAK -# wb-mon Wideband Monitoring -# xnet Cross Net Debugger -# xns-idp Xerox NS IDP -# 1Password Password Manager -# 1password data sharing and [Roustem_Karimov] [Roustem_Karimov] Defined TXT keys: None -# synchronization protocol -# a-d-sync Altos Design Synchronization [David_Lasker] [David_Lasker] Defined TXT keys: None -# protocol -# Applied Biosystems Universal Defined TXT keys: product= -# abi-instrument Instrument Framework [Tor_Slettnes] [Tor_Slettnes] description= version= -# accessdata-f2d FTK2 Database Discovery [Rick_Russell] [Rick_Russell] Defined TXT keys: Proprietary -# Service -# accessdata-f2w FTK2 Backend Processing [Rick_Russell] [Rick_Russell] Defined TXT keys: Proprietary -# Agent Service -# accessone Strix Systems 5S/AccessOne [Scott_Herscher_2] [Scott_Herscher_2] Defined TXT keys: None -# protocol -# accountedge MYOB AccountEdge Defined TXT keys: None -# acrobatsrv Adobe Acrobat Defined TXT keys: type, path, FeedType -# acs-ctl-ds tcp Access Control Device [Honwywell_Security_Group] [John_Dziadosz] 2012-04-09 Defined TXT keys: MAC=, GW-MAC -# acs-ctl-ds udp Access Control Device [Honwywell_Security_Group] [John_Dziadosz] 2012-04-09 Defined TXT keys: MAC=, GW-MAC -# acs-ctl-gw tcp Access Control Gateway [Honwywell_Security_Group] [John_Dziadosz] 2012-04-09 Defined TXT keys: MAC=, GW-MAC -# acs-ctl-gw udp Access Control Gateway [Honwywell_Security_Group] [John_Dziadosz] 2012-04-09 Defined TXT keys: MAC=, GW-MAC -# actionitems ActionItems [Sailalong_Software] [Sailalong_Software] Defined TXT keys: None -# activeraid Active Storage Proprietary [Skip_Levens] [Skip_Levens] Defined TXT keys: None -# Device Management Protocol -# Encrypted transport of -# activeraid-ssl Active Storage Proprietary [Skip_Levens] [Skip_Levens] Defined TXT keys: None -# Device Management Protocol -# addressbook Address-O-Matic [Massimiliano_Ribuoli] [Massimiliano_Ribuoli] Defined TXT keys: None -# Address Book Server used for -# addressbooksrv tcp contacts and calendar [AddressBookServer] [Alexander_Hartner] 2011-10-14 Defined TXT keys: _suffix, _prefix -# synchronisation -# difusi Cloud based plug & -# play network synchronization -# adnodes protocol, content pool [DIFUSI_Inc] [Mike_Wright] 2011-11-07 Defined TXT keys: Proprietary -# database discovery, and -# cloudOS SAaS discovery -# protocol. -# adobe-shadow tcp Adobe Shadow Server [Adobe_Systems] [Mike_Harris] 2012-04-17 Defined TXT keys: id -# adobe-vc Adobe Version Cue Defined TXT keys: txtvers=1, name, version, build -# adisk Automatic Disk Discovery [Bob_Bradley_2] [Bob_Bradley_2] Defined TXT keys: sys, dkX -# adpro-setup ADPRO Security Device Setup [Patrick_Noffke] [Patrick_Noffke] Defined TXT keys: txtvers, type -# aecoretech Apple Application [Hani_Abdelazim] [Hani_Abdelazim] Defined TXT keys: None -# Engineering Services -# Defined TXT keys: orb_server= (optional) CORBA ORB -# Aeroflex instrumentation and server used for resource discovery product_id= -# aeroflex software [David_Hagood] [David_Hagood] (optional) ID of licensed product -# txtvers="*IDN?=" (optional) as per LXI -# specification (for not yet LXI compatible instruments) -# aerohive-proxy tcp Aerohive Proxy Configuration [Aerohive_Networks] [Matthew_Gast] 2012-05-31 Defined TXT keys: name, port, username -# Service -# airdrop tcp Airdrop [Apple_Inc] [Marc_Krochmal_2] 2012-03-02 Defined TXT keys: flags, phash, ehash, cname -# airplay tcp Protocol for streaming of [Apple_Inc_2] [Bob_Bradley_3] 2012-09-19 Defined TXT keys: am, cn, et, ft, fv, md, pk, pw, sf, tp, vn, -# audio/video content vs -# airplay udp Protocol for streaming of [Apple_Inc_2] [Bob_Bradley_3] 2012-09-19 Defined TXT keys: am, cn, et, ft, fv, md, pk, pw, sf, tp, vn, -# audio/video content vs -# airport AirPort Base Station [Bob_Bradley_2] [Bob_Bradley_2] Defined TXT keys: waMA; -# airpreview tcp Coda AirPreview [Panic_Inc] [Cabel_Sasser] 2012-07-19 Defined TXT keys: hasCamera, name, UUID -# Defined TXT keys: mac= ip= -# airprojector AirProjector [Yoshinori_Nakayama] [Yoshinori_Nakayama] note= use= mainprog=
-# bootprog= -# airsharing Air Sharing [Erik_Rogers][Dave_Howell] [Erik_Rogers][Dave_Howell] Defined TXT keys: None -# airsharingpro Air Sharing Pro [Erik_Rogers][Dave_Howell] [Erik_Rogers][Dave_Howell] Defined TXT keys: None -# aloe-gwp tcp Aloe Gateway Protocol [Layered_Logic] [Brooks_Bell] 2012-01-04 Defined TXT keys: Version -# aloe-pp tcp Aloe Pairing Protocol [Layered_Logic] [Brooks_Bell] 2012-01-04 Defined TXT keys: Version, DeviceName, DeviceModel, -# DeviceSystem, DeviceSystemVersion, AppName, AppVersion -# amba-cam udp Ambarella Cameras [Louis_Sun] [Louis_Sun] Defined TXT keys: product= -# description= version= -# P2PTapWar Sample Application -# amiphd-p2p from "iPhone SDK [Chris_Adamson] [Chris_Adamson] Defined TXT keys: None -# Development" Book -# ams-htm Proprietary protocol for [AccuMed_Services] [Sam_Carleton_2] 2011-10-20 Defined TXT keys: None -# Accu-Med HTM -# animolmd Animo License Manager [Phil_Barrett] [Phil_Barrett] Defined TXT keys: None -# animobserver Animo Batch Server [Phil_Barrett] [Phil_Barrett] Defined TXT keys: None -# Anquet map synchronization -# anquetsync between desktop and handheld [Paul_Lesurf] [Paul_Lesurf] Defined TXT keys: Proprietary -# devices -# antrmai tcp ANT Galio web services [ANT_Software] [Simon_Middleton] 2012-12-06 Defined TXT keys: txtvers, man -# anyremote tcp remote control of Linux PCs [Mikhail_Fedotov] [Mikhail_Fedotov] 2014-12-10 Defined TXT keys: None -# from Android and J2ME -# appelezvous Appelezvous [Marco_Piovanelli] [Marco_Piovanelli] Defined TXT keys: None -# apple-ausend Apple Audio Units [James_McCartney] [James_McCartney] Defined TXT keys: None -# apple-mobdev tcp Apple Mobile Device Protocol [Apple_2] [Paul_Chinn][Justin_Ko] 2011-10-20 Defined TXT keys: None -# apple-midi udp Apple MIDI [Doug_Wyatt] [Doug_Wyatt] Defined TXT keys: None -# applerdbg Apple Remote Debug Services [Dave_Springer] [Dave_Springer] Defined TXT keys: None -# (OpenGL Profiler) -# appletv Apple TV [Amandeep_Jawa_3] [Amandeep_Jawa_3] Defined TXT keys: txtvers, PrVs, OSsi, MniT -# appletv-itunes Apple TV discovery of iTunes [Amandeep_Jawa_3] [Amandeep_Jawa_3] Defined TXT keys: txtvers -# appletv-pair Apple TV Pairing [Amandeep_Jawa_3] [Amandeep_Jawa_3] Defined TXT keys: txtvers -# aquamon AquaMon Defined TXT keys: None -# arcnet udp Arcturus Networks Inc. [Arcturus_Networks_Inc] [Michael_Durrant] 2011-10-20 Defined TXT keys: None -# Hardware Services -# Active Registry Network for -# arn tcp distribution of values and [Mictron] [Michael_Wiklund] 2013-10-17 Defined TXT keys: None -# streams -# aroundsound AroundSound's information [Winzig_LLC] [Around_Sound] 2011-10-20 Defined TXT keys: Proprietary -# sharing protocol -# astnotify udp Asterisk Caller-ID [Sven_Slezak] [Sven_Slezak] Defined TXT keys: prefix= (numeric, -# Notification Service additionally '+') -# astralite Astralite [Tongji_University] [Tongji_University] Defined TXT keys: None -# async address-o-sync [Markus_Brand] [Markus_Brand] Defined TXT keys: None -# Atlassian Application (JIRA, -# atlassianapp Confluence, Fisheye, [Denise_Fernandez] [Denise_Fernandez] Defined TXT keys: app.url -# Crucible, Crowd, Bamboo) -# discovery service -# attero-ad tcp Attero Tech Audio Device [Attero_Tech_LLC] [David_Vaughn] 2015-09-24 Defined TXT keys: txtvers, protovers, CtrlType, Model -# attero-ad udp Attero Tech Audio Device [Attero_Tech_LLC] [David_Vaughn] 2015-09-24 Defined TXT keys: txtvers, protovers, CtrlType, Model -# audirvana-ap tcp Audirvana Remote Access [Audirvana_SCS] [Damien_Plisson] 2015-07-21 Defined TXT keys: txtvers, protovers -# Protocol -# av Allen Vanguard Hardware [Mike_Bush] [Mike_Bush] Defined TXT keys: Proprietary -# Service -# avatars tcp Libravatar federated avatar [libravatar_org] [Francois_Marier] 2011-10-11 Defined TXT keys: none -# hosting service. -# avatars-sec tcp Libravatar federated avatar [libravatar_org] [Francois_Marier] 2011-10-11 Defined TXT keys: none -# hosting service. -# axis-video Axis Video Cameras [Kristina_Sten] [Kristina_Sten] Defined TXT keys: None -# b3d-convince 3M Unitek Digital [Rajiv_Aaron_Manglani] [Rajiv_Aaron_Manglani] Defined TXT keys: txtvers=1, protovers=, -# Orthodontic System guid=<32 hex digits> -# babyphone BabyPhone [Johan_Kool] [Johan_Kool] Defined TXT keys: None -# Peer to peer file sharing -# barroomcomedy tcp for a media player [Fred_Zimmerman] [Fred_Zimmerman] 2013-11-05 Defined TXT keys: None -# application -# bcloud-server tcp Buddycloud Server Delegation [buddycloud] [Simon_Tennant_2] 2014-06-19 Defined TXT keys: v, host -# bdsk BibDesk Sharing [Adam_Maxwell] [Adam_Maxwell] Defined TXT keys: txtvers, authenticate -# beacon Beacon Remote Service [Jeffrey_Sadeli] [Jeffrey_Sadeli] Defined TXT keys: version=, company= -# beamer Beamer Data Sharing Protocol [Frank_Szczerba] [Frank_Szczerba] Defined TXT keys: None -# beatpack BeatPack Synchronization [Mathieu_Garcia] [Mathieu_Garcia] Defined TXT keys: None -# Server for BeatMaker -# Beats Direct allows for the -# beatsdirect tcp discovery and control of [Beats_Electronics_LLC] [Eddie_Borjas] 2013-06-03 Defined TXT keys: None -# devices -# beep Xgrid Technology Preview [David_Kramer_2] [David_Kramer_2] Defined TXT keys: None -# bender Bender Communication [Bender_GmbH_Co_KG] [Markus_Kremer] 2013-10-15 Defined TXT keys: product version bus id featuremask -# Protocol -# bfagent BuildForge Agent [Joe_Senner_2] [Joe_Senner_2] Defined TXT keys: None -# bigbangchess Big Bang Chess [Freeverse_Software] [Freeverse_Software] Defined TXT keys: None -# bigbangmancala Big Bang Mancala [Freeverse_Software] [Freeverse_Software] Defined TXT keys: None -# bitflit tcp Data transfer service [Ramesh_Gupta] [Ramesh_Gupta] 2012-02-21 Defined TXT keys: provider, vendor, user, host, deploy, -# prototype, schedule -# bittorrent BitTorrent Zeroconf Peer [Robin_Perkins] [Robin_Perkins] Defined TXT keys: None -# Discovery Protocol -# Little Black Book Defined TXT keys: product= -# blackbook Information Exchange [David_HM_Spector][Paul_M_Franceus] [David_HM_Spector][Paul_M_Franceus] description= -# Protocol version= protovers= -# bluevertise udp BlueVertise Network Protocol [Fabrizio_Guglielmino] [Fabrizio_Guglielmino] Defined TXT keys: role= -# (BNP) -# boardplus tcp board plus application [CX5_SOFTWARE] [Yohei_Yoshihara] 2013-02-04 Defined TXT keys: None -# transfer protocol -# Booked communication Defined TXT keys: Edition, Version, Public Shares, Machine -# booked-sync tcp protocol - Sharing And Sync [Sören_Havemester] [Sören_Havemester] 2013-02-18 ID, Machine Name -# Service -# bookworm Bookworm Client Discovery [Arne_Dirks] [Arne_Dirks] Defined TXT keys: flavors -# boundaryscan udp Proprietary [Uwe_Ziegler] [Uwe_Ziegler] Defined TXT keys: blocked=, -# version= -# bousg Bag Of Unusual Strategy Defined TXT keys: None -# Games -# boutfitness tcp Bout Fitness Synchronization [Bout_Fitness_LLC] [Jesse_Curry] 2014-06-16 Defined TXT keys: None -# Service -# boutfitness udp Bout Fitness Synchronization [Bout_Fitness_LLC] [Jesse_Curry] 2014-06-16 Defined TXT keys: None -# Service -# boxraysrvr tcp Boxray Devices Host Server [Caprice_Productions] [Lance_Drake] 2012-07-05 Defined TXT keys: none -# bq-cromo tcp bq Cromo protocol [MUNDO_READER_SL] [Adan_Munoz] 2014-09-05 Defined TXT keys: None -# bq-cromo udp bq Cromo protocol [MUNDO_READER_SL] [Adan_Munoz] 2014-09-05 Defined TXT keys: None -# breas tcp Breas [Breas_Medical_AB] [Jonas_Sjostedt] 2015-09-09 Defined TXT keys: None -# breas udp Breas [Breas_Medical_AB] [Jonas_Sjostedt] 2015-09-09 Defined TXT keys: None -# bri RFID Reader Basic Reader [Thaddeus_Ternes] [Thaddeus_Ternes] Defined TXT keys: None -# Interface -# bridgeprotocol tcp JSON RPC Bridge Protocol [Michel_Stam_2] [Michel_Stam_2] 2012-11-20 Defined TXT keys: path, version -# bsqdea Backup Simplicity [Qdea] [Qdea] Defined TXT keys: None -# Beats Transfer Protocol -# btp tcp allows for the discovery and [Beats_Electronics_LLC_2] [Yunho_Huh] 2014-02-17 2014-06-27 Defined TXT keys: None -# control of devices -# buddycloud-api tcp buddycloud API [buddycloud] [Simon_Tennant] 2013-05-20 Defined TXT keys: v, host, protocol, path, port -# caldav tcp Calendaring Extensions to [IESG] [IETF_Chair] 2012-02-17 [RFC6764] This is an extension of the http service. Defined TXT keys: -# WebDAV (CalDAV) - non-TLS path= -# caldavs tcp Calendaring Extensions to [IESG] [IETF_Chair] 2012-02-17 [RFC6764] This is an extension of the https service. Defined TXT keys: -# WebDAV (CalDAV) - over TLS path= -# caltalk CalTalk [Joe_Groff] [Joe_Groff] Defined TXT keys: None -# canon-chmp tcp Canon HTTP Management [Canon_Inc_3] [Tomoyuki_Hansaki] 2014-09-03 2015-03-16 Defined TXT keys: txtvers, mpath -# Protocol -# carddav tcp vCard Extensions to WebDAV [IESG] [IETF_Chair] 2012-02-17 [RFC6352] This is an extension of the http service. Defined TXT keys: -# (CardDAV) - non-TLS path= -# carddavs tcp vCard Extensions to WebDAV [IESG] [IETF_Chair] 2012-02-17 [RFC6352] This is an extension of the https service. Defined TXT keys: -# (CardDAV) - over TLS path= -# cardsend Card Send Protocol [Jeff_Grossman] [Jeff_Grossman] Defined TXT keys: Proprietary -# carousel tcp Carousel Player Protocol [Tightrope_Media_Systems] [Scott_Jann] 2011-10-17 Defined TXT keys: None -# IP and Closed-Circuit Defined TXT keys: u=, p=, path= -# applications -# cheat The Cheat [Chaz_McGarvey] [Chaz_McGarvey] Defined TXT keys: None -# chess Project Gridlock Defined TXT keys: None -# chfts Fluid Theme Server Defined TXT keys: None -# chili The CHILI Radiology System [Andre_Schroter] [Andre_Schroter] Defined TXT keys: None -# ciao tcp Ciao Arduino Protocol [Mike_Colagrosso] [Mike_Colagrosso] 2011-10-24 Defined TXT keys: see www.ciaoapp.com -# Discovery of JDF (CIP4 Job -# cip4discovery Definition Format) enabled [Stefan_Daun] [Stefan_Daun] Defined TXT keys: None -# devices -# clipboard Clipboard Sharing Defined TXT keys: None -# clique udp Clique Link-Local Multicast [Telepathy_project] [Telepathy_project] Defined TXT keys: see -# Chat Room http://telepathy.freedesktop.org/xmpp/clique -# clscts Oracle CLS Cluster Topology [David_Brower] [David_Brower] Defined TXT keys: None -# Service -# collection Published Collection Object [Brady_Anderson] [Brady_Anderson] Defined TXT keys: version=? -# com-ocs-es-mcc ElectraStar media centre [OC] [OC] Defined TXT keys: None -# control protocol -# contactserver Now Contact Defined TXT keys: None -# coolanetaudio tcp Coolatoola Network Audio [Coolatoola.com] [Tim_Hewett] 2014-01-03 Defined TXT keys: None -# corroboree Corroboree Server [Heath_Raftery] [Heath_Raftery] Defined TXT keys: None -# cpnotebook2 NoteBook 2 [Circus_Ponies_Suppor] [Circus_Ponies_Suppor] Defined TXT keys: None -# csi-mmws tcp Canfield Scientific Inc - [Canfield_Scientific_Inc] [James_Crismale] 2013-07-02 Defined TXT keys: path -# Mirror Mobile Web Services -# cw-codetap CodeWarrior HTI Xscale [Ted_Woodward] [Ted_Woodward] Defined TXT keys: None -# PowerTAP -# cw-dpitap CodeWarrior HTI DPI PowerTAP [Ted_Woodward] [Ted_Woodward] Defined TXT keys: None -# cw-oncetap CodeWarrior HTI OnCE [Ted_Woodward] [Ted_Woodward] Defined TXT keys: None -# PowerTAP -# cw-powertap CodeWarrior HTI COP PowerTAP [Ted_Woodward] [Ted_Woodward] Defined TXT keys: None -# cytv CyTV - Network streaming for [Andreas_Junghans] [Andreas_Junghans] Defined TXT keys: None -# Elgato EyeTV -# dacp Digital Audio Control [Amandeep_Jawa_3] [Amandeep_Jawa_3] Defined TXT keys: txtvers, Ver, DbId -# Protocol (iTunes) -# dancepartner Dance partner application [Rory_McClure] [Rory_McClure] Defined TXT keys: None -# for iPhone -# darkhorsetimer tcp Timer LAN service [Dark_Horse_GmbH_Co_KG] [Ludwig_Kannicht] 2015-06-02 Defined TXT keys: None -# dataturbine Open Source DataTurbine [Tony_Fountain] [Tony_Fountain] Defined TXT keys: None -# Streaming Data Middleware -# Defined TXT keys:txtvers= -# dbaudio tcp d&b audiotechnik remote [d_b_audiotechnik] [Christian_Laendner] 2011-10-06 protovers= guid= -# network name= sn= device= -# fwver= -# Defined TXT keys:txtvers= -# dbaudio udp d&b audiotechnik remote [d_b_audiotechnik] [Christian_Laendner] 2011-10-06 protovers= guid= -# network name= sn= device= -# fwver= -# dccp-ping dccp ping/traceroute using DCCP [Samuel_Jero] [Samuel_Jero] 2012-11-14 1885957735 Defined TXT keys: None -# dell-soo-ds tcp Spotlight on Oracle [Dell_2] [Rob_Griffin_3] 2013-10-03 Defined TXT keys: None -# Diagnostic Server -# dell-soo-ds udp Spotlight on Oracle [Dell_2] [Rob_Griffin_3] 2013-10-03 Defined TXT keys: None -# Diagnostic Server -# dell-soss-ds-w tcp Spotlight on SQL Server [Dell_2] [Rob_Griffin_3] 2013-10-03 Defined TXT keys: None -# Diagnostic Server HTTP -# dell-ssms-ds tcp Spotlight SSMS Plugin [Dell_2] [Rob_Griffin_3] 2013-10-03 Defined TXT keys: None -# Diagnostic Server -# device-info Device Info [Stuart_Cheshire_5][Marc_Krochmal] [Stuart_Cheshire_5][Marc_Krochmal] Not a service type. Special name reserved for DNS-SD device -# info. -# devonsync tcp DEVONthink synchronization [DEVONtechnologies_LLC] [Rob_Rix][Eric_Boehnisch-Volkmann] 2011-10-18 Defined TXT keys: None at present -# protocol -# dictation Use of a dictation service [Nuance_Communications_Inc] [Mark_Jackson] 2011-10-27 Defined TXT keys: ver, name -# by a hand-held device -# difi EyeHome [Elgato] [Elgato] Defined TXT keys: None -# disconnect DisConnect Peer to Peer Game [Michael_S_Bogovich] [Michael_S_Bogovich] Defined TXT keys: None -# Protocol -# dist-opencl Distributed OpenCL discovery [William_Dillon] [William_Dillon] 2013-04-10 Defined TXT keys: TCPendpoint, UDPendpoint, UUID -# protocol -# ditrios Ditrios SOA Framework [Mark_Schmatz] [Mark_Schmatz] Defined TXT keys: -# Protocol http://www.ditrios.org/index.php?link=tutorial/index#zeroconf -# divelogsync Dive Log Data Sharing and [Greg_McLaughlin] [Greg_McLaughlin] Defined TXT keys: None -# Synchronization Protocol -# dlpx-sp tcp Delphix Session Protocol [Delphix_Corp] [Peng_Dai] 2012-10-02 Defined TXT keys: None -# dltimesync udp Local Area Dynamic Time [Geoff_Back_3] [Geoff_Back_3] Defined TXT keys: None -# Synchronisation Protocol -# dns-sd DNS Service Discovery [Stuart_Cheshire_5][Marc_Krochmal] [Stuart_Cheshire_5][Marc_Krochmal] Not a service type. Special name reserved for DNS-SD meta -# queries. -# DNS Dynamic Update Service for a given domain may not -# necessarily be provided by the principal name servers as -# advertised by the domain's "NS" records, and may not -# dns-update udp DNS Dynamic Update Service [Kiren_Sekar_2] [Kiren_Sekar_2] necessarily always be provided on port 53. The -# "_dns-update._udp.." SRV record gives the target host -# and port where DNS Dynamic Update Service is provided for the -# named domain. -# dop Roar (Death of Productivity) [Massive_Flow_Product] [Massive_Flow_Product] Defined TXT keys: name= -# dropcopy DropCopy [base_t_Interactive] [base_t_Interactive] Defined TXT keys: None -# dsgsync Datacolor SpyderGallery [Datacolor] [Heath_Barber] 2011-10-14 Defined TXT keys: Proprietary -# Desktop Sync Protocol -# Data Synchronization -# dsl-sync Protocol for Discovery [John_Hogg] [John_Hogg] Defined TXT keys: Proprietary -# Software products -# dtrmtdesktop Desktop Transporter Remote [Daniel_Stodle] [Daniel_Stodle] Defined TXT keys: None -# Desktop Protocol -# A communication protocol -# duckrace tcp that allows a school teacher [Stinky_Kitten_Limited] [Gary_Atkinson] 2013-10-03 Defined TXT keys: txtvers uuid devicename -# to set work activities to -# students over a LAN. -# dxtgsync Documents To Go Desktop Sync [Tim_Boyle] [Tim_Boyle] Defined TXT keys: Proprietary -# Protocol -# ea-dttx-poker Protocol for EA Downtown [Ben_Lewis] [Ben_Lewis] Defined TXT keys: None -# Texas Hold 'em -# earphoria Earphoria [Rogue_Amoeba] [Rogue_Amoeba] Defined TXT keys: None -# easyspndlg-sync tcp Sync service for the Easy [Aaron_L_Bratcher] [Aaron_L_Bratcher] 2011-10-17 Defined TXT keys: None -# Spend Log app -# eb-amuzi Amuzi peer-to-peer session [Zachary_Gramana] [Zachary_Gramana] Defined TXT keys: Proprietary -# synchronization protocol -# eb-sync tcp Easy Books App data sync [Geode_Software_Ltd] [Mathew_Waters] 2014-05-14 Defined TXT keys: None -# helper for Mac OS X and iOS -# eb-sync udp Easy Books App data sync [Geode_Software_Ltd] [Mathew_Waters] 2014-05-14 Defined TXT keys: None -# helper for Mac OS X and iOS -# ebms ebXML Messaging [Matthew_MacKenzie] [Matthew_MacKenzie] Defined TXT keys: Endpoint= -# Northrup Grumman/Mission -# ecms Systems/ESL Data Flow [Dan_Goff] [Dan_Goff] Defined TXT keys: None -# Protocol -# ebreg ebXML Registry [Matthew_MacKenzie] [Matthew_MacKenzie] Defined TXT keys: -# HttpBinding= -# ecbyesfsgksc Net Monitor Anti-Piracy [Guy_Meyer] [Guy_Meyer] Defined TXT keys: None -# Service -# edcp udp LaCie Ethernet Disk [Nicolas_Bouilleaud] [Nicolas_Bouilleaud] Defined TXT keys: ip, mac, dhcp, mask, gtwy, wins, name, -# Configuration Protocol version -# eeg tcp EEG System Discovery across [Shifted_Current] [Joel_Aaron_Clipperton] 2012-09-11 Defined TXT keys: Type -# local and wide area networks -# efkon-elite tcp EFKON Lightweight Interface [EFKON_AG] [Thomas_Kemmer] 2011-10-20 Defined TXT keys: txtvers, protovers, model, serial, scheme, -# to Traffic Events path -# egistix Egistix Auto-Discovery [Dave_Lindquist_2] [Dave_Lindquist_2] Defined TXT keys: None -# Interactive Room Software -# eheap Infrastructure (Event Defined TXT keys: None -# Sharing) -# embrace DataEnvoy [Rob_MacGregor] [Rob_MacGregor] Defined TXT keys: None -# enphase-envoy tcp Enphase Energy Envoy [Enphase_Energy_Inc] [Chris_Eich] 2011-11-08 Defined TXT keys: - txtvers - protovers - serialnum -# Endpoint Protocol (EP) for -# ep use in Home Automation [Tommy_van_der_Vorst] [Tommy_van_der_Vorst] Defined TXT keys: dns-sd_mdns -# systems -# esp tcp Extensis Server Protocol [Loren_Barr] [Loren_Barr] 2006-12 Defined TXT keys: none -# eucalyptus Eucalyptus Discovery [Support_Team] [Support_Team] Defined TXT keys: Eucalyptus-DNS-SD -# eventserver Now Up-to-Date Defined TXT keys: None -# evp tcp EvP - Generic EVENT protocol [Quentin_Glidic] 2013-06-05 Defined TXT keys: None -# evs-notif EVS Notification Center [Eric_Gillet] [Eric_Gillet] Defined TXT keys: ID, Address -# Protocol -# ewalletsync Synchronization Protocol for [Dan_Amstutz] [Dan_Amstutz] Defined TXT keys: name= -# Ilium Software's eWallet -# Not a real service type. Special 'pretend' service types -# example Example Service Type ("_example._udp" and "_example._tcp") reserved for use in -# illustrative examples in books and other documentation. -# exb Exbiblio Cascading Service [Claes_Fredrik_Mannby] [Claes_Fredrik_Mannby] Defined TXT keys: Will be described at www.exbiblio.com -# Protocol -# extensissn Extensis Serial Number [Extensis] [Extensis] Defined TXT keys: None -# eyetvsn EyeTV Sharing [Elgato] [Elgato] Defined TXT keys: txtvers=1, keyhash=<4 bytes> -# facespan FaceSpan [Kerry_Hazelgren] [Kerry_Hazelgren] Defined TXT keys: None -# faxstfx FAXstf [Smith_Micro] [Smith_Micro] Defined TXT keys: None -# feed-sharing NetNewsWire 2.0 [Ranchero_Software] [Ranchero_Software] Defined TXT keys: None -# firetask Firetask task sharing and [Gerald_Aquila] [Gerald_Aquila] Defined TXT keys: None -# synchronization protocol -# fish Fish [Oriol_Ferrer_Mesia] [Oriol_Ferrer_Mesia] Defined TXT keys: None -# Defined TXT keys: Currently valid enumerated values: FIX -# Session Protocol Versions (SESSIONVERSION): 1.1 FIX -# Application Protocol Versions (APPLICATIONVERSION): 2.7, 3.0, -# fix Financial Information [Joakim_Johansson] [Joakim_Johansson] 4.0, 4.1, 4.2, 4.3, 4.4, 5.0 Possible TXT records defined and -# Exchange (FIX) Protocol their values (replace uppercase text with enumerations from -# the list above): txtvers=1 fix=APPLICATIONVERSION fix -# supported=APPLICATIONVERSION[,APPLICATIONVERSION, ... -# ,APPLICATIONVERSION] fixt=SESSIONVERSION -# fjork Fjork [John_Schilling] [John_Schilling] Defined TXT keys: None -# fl-purr udp FilmLight Cluster Power [Darrin_Smart] [Darrin_Smart] Defined TXT keys: Proprietary -# Control Service -# flightdmp tcp Flight Data Monitoring [Brad_Head] [Brad_Head] 2013-02-07 Defined TXT keys: None -# Protocol -# flightdmp udp Flight Data Monitoring [Brad_Head] [Brad_Head] 2013-02-07 Defined TXT keys: None -# Protocol -# flir-ircam tcp FLIR Infrared Camera [FLIR_Systems_AB] [Bjorn_Roth][Klas_Malmborg] 2011-10-20 Defined TXT keys: Proprietary -# FileMaker Server -# fmserver-admin Administration Communication [Eric_Jacobson] [Eric_Jacobson] Defined TXT keys: None -# Service -# fontagentnode FontAgent Pro [Insider_Software] [Insider_Software] Defined TXT keys: None -# foxtrot-serv FoxTrot Search Server [Jerome_Seydoux] [Jerome_Seydoux] Defined TXT keys: None -# Discovery Service -# foxtrot-start FoxTrot Professional Search [Jerome_Seydoux] [Jerome_Seydoux] Defined TXT keys: None -# Discovery Service -# frameforge-lic FrameForge License [James_W_Walker] [James_W_Walker] Defined TXT keys: Proprietary -# freehand FreeHand MusicPad Pro [Ted_Schroeder] [Ted_Schroeder] Defined TXT keys: None -# Interface Protocol -# frog Frog Navigation Systems [Rene_Jager] [Rene_Jager] Defined TXT keys: type, name, id -# ftpcroco Crocodile FTP Server [Xnet_Communications] [Xnet_Communications] Defined TXT keys: None -# fv-cert udp Fairview Certificate [Jim_Lyle_2] [Jim_Lyle_2] Defined TXT keys: DevID=, DevPK= -# fv-key udp Fairview Key [Jim_Lyle_2] [Jim_Lyle_2] Defined TXT keys: KeyID= -# fv-time udp Fairview Time/Date [Jim_Lyle_2] [Jim_Lyle_2] Defined TXT keys: None -# garagepad Entrackment Client Service [Talkative_AB] [Talkative_AB] Defined TXT keys: None -# giffer tcp gif collection browsing [Taber_Buhl] [Taber_Buhl] 2015-09-24 Defined TXT keys: version= -# G-Force Control via -# gforce-ssmp SoundSpectrum's SSMP TCP [Andy_O_Meara] [Andy_O_Meara] Defined TXT keys: None -# Protocol -# glasspad GlassPad Data Exchange [Emmanuel_Merali] [Emmanuel_Merali] Defined TXT keys: guid -# Protocol -# glasspadserver GlassPadServer Data Exchange [Emmanuel_Merali] [Emmanuel_Merali] Defined TXT keys: guid -# Protocol -# glrdrvmon OpenGL Driver Monitor [Dave_Springer] [Dave_Springer] Defined TXT keys: None -# Service related to Google -# Expeditions which is a -# technology for enabling -# googexpeditions tcp multi-participant virtual [Google_Inc] [Jason_Schiller] 2015-07-31 Defined TXT keys: None -# fieldtrip experiences over a -# local wireless network. See -# http://g.co/expeditions for -# more details -# Service related to Google -# Expeditions which is a -# technology for enabling -# googexpeditions udp multi-participant virtual [Google_Inc] [Jason_Schiller] 2015-07-31 Defined TXT keys: None -# fieldtrip experiences over a -# local wireless network. See -# http://g.co/expeditions for -# more details -# Service related to Google -# Cast which is a technology -# googlecast tcp for enabling multi-screen [Google_Inc] [Jason_Schiller] 2014-01-16 Defined TXT keys: None -# experiences. See -# developers.google.com/cast -# for more details -# goorstop tcp For iOS Application named [Charlie_Kim] [Charlie_Kim] 2012-08-28 Defined TXT keys: None -# GoOrStop -# gopro-wake udp GoPro proprietary protocol [GoPro] [Joe_Enke] 2014-10-13 Defined TXT keys: model, fw_version, platform_version, -# to wake devices protocol_version, mac_address -# gopro-web udp GoPro proprietary protocol [GoPro] [Joe_Enke] 2014-10-13 Defined TXT keys: model, fw_version, platform_version, -# for devices protocol_version, mac_address -# gotit tcp Network name Got It! [Bill_Vlahos] [Bill_Vlahos] 2013-12-13 Defined TXT keys: info=name -# gpnp Grid Plug and Play [David_Brower] [David_Brower] Defined TXT keys: None -# grillezvous Roxio ToastAnywhere(tm) Defined TXT keys: AppID= KeyHash= -# groovesquid tcp Groovesquid Democratic Music [www_nsovocal_com] [Ruben_Beltran] 2011-10-18 Defined TXT keys: None -# Control Protocol -# growl Growl Defined TXT keys: None -# gsremotecontrol tcp General Satellite set-top [General_Satellite] [Sergey_Zubov] 2014-02-25 Defined TXT keys: None -# box remote control -# Image Data Transfer API for -# gucam-http tcp Wi-Fi Camera Devices over [Ripplex_Inc] [Hiroshi_Matsuda] 2013-03-04 Defined TXT keys: device-name= -# HTTP -# Defined TXT keys: Varies; Depends on type of service being -# offered/resolved Although DNS-SD does not recommend or -# advocate using GUIDs as the primary name of an offered -# service why not?, it does support use of GUIDs as service -# names where developers want to use them that way. Typically -# users do not browse for GUIDs. They are not user-friendly and -# not very informative. Typically, the service is advertised as -# usual, using a user-friendly name. One of the TXT record -# attributes is a GUID for the service instance. Once the user -# Special service type for has browsed and chosen the desired service instance via its -# guid resolving by GUID (Globally user-friendly name, the service is resolved, the TXT record -# Unique Identifier) is retrieved, and the GUID is stored. A given network service -# instance is therefore being advertised two ways, for example: -# ._ptp._tcp.local ._guid._tcp.local -# On subsequent accesses to the service, the GUID-based name is -# resolved, and that particular service instance is discovered, -# even if the user has subsequently changed the user-friendly -# name to something else. Note: Although each different logical -# service type needs to have its own different DNS-SD service -# type, all GUID-based names use the same pseudo-type: -# "_guid._tcp". There is no possibility of name conflict -# because (by definition) GUIDs are globally unique. -# H.323 Real-time audio, video -# h323 and data communication call [Will_MacDonald] [Will_MacDonald] Defined TXT keys: None -# setup protocol -# hbbtv-ait tcp HbbTV Application [HbbTV_Association] [Paul_Higgs] 2015-09-09 Defined TXT keys: None -# Information Table -# help HELP command [RFC1078] TCP Port Service Multiplexer (TCPMUX) -# hg Mercurial web-based Defined TXT keys: None path= description= -# hinz HINZMobil Synchronization [Jorg_Laschke] [Jorg_Laschke] Defined TXT keys: None -# protocol -# hmcp Home Media Control Protocol [Will_Lahr] [Will_Lahr] Defined TXT keys: None -# home-sharing iTunes Home Sharing [Amandeep_Jawa_3] [Amandeep_Jawa_3] Defined TXT keys: txtvers, hQ, iTSh Version, MID, Database -# ID, dmb, Version, OSsi, hG, hC, Machine ID -# homeauto iDo Technology Home [Tony_de_Rijk] [Tony_de_Rijk] Defined TXT keys: None -# Automation Protocol -# homeconnect tcp Home Connect Protocol [BSH_Bosch_und_Siemens_Hausgeraete_GmbH] [Jens_Clauss] 2013-06-11 Defined TXT keys: txtvers + Proprietary -# honeywell-vid udp Honeywell Video Systems [Shankar_Prasad] [Shankar_Prasad] Defined TXT keys: None -# hotwayd Hotwayd Defined TXT keys: None -# howdy Howdy messaging and [Ozate_Inc] [Joseph_Sickel] 2011-10-12 Defined TXT keys: None -# notification protocol -# hpr-bldlnx HP Remote Build System for [Jeffrey_J_Walls] [Jeffrey_J_Walls] Defined TXT keys: rh73, rhel3, rhel4, deb31, suse102 -# Linux-based Systems -# hpr-bldwin HP Remote Build System for [Jeffrey_J_Walls] [Jeffrey_J_Walls] Defined TXT keys: xp, vista -# Microsoft Windows Systems -# Identifies systems that -# hpr-db house databases for the [Jeffrey_J_Walls] [Jeffrey_J_Walls] Defined TXT keys: bld, tst, mstr -# Remote Build System and -# Remote Test System -# hpr-rep HP Remote Repository for [Jeffrey_J_Walls] [Jeffrey_J_Walls] Defined TXT keys: bld, tst, official -# Build and Test Results -# HP Remote System that houses -# hpr-toollnx compilers and tools for [Jeffrey_J_Walls] [Jeffrey_J_Walls] Defined TXT keys: rh73, rhel3, rhel4, deb31, suse102 -# Linux-based Systems -# HP Remote System that houses -# hpr-toolwin compilers and tools for [Jeffrey_J_Walls] [Jeffrey_J_Walls] Defined TXT keys: xp, vista -# Microsoft Windows Systems -# hpr-tstlnx HP Remote Test System for [Jeffrey_J_Walls] [Jeffrey_J_Walls] Defined TXT keys: rh73, rhel3, rhel4, deb31, suse102 -# Linux-based Systems -# hpr-tstwin HP Remote Test System for [Jeffrey_J_Walls] [Jeffrey_J_Walls] Defined TXT keys: xp, vista -# Microsoft Windows Systems -# hs-off Hobbyist Software Off [Rob_Jonson] [Rob_Jonson] Defined TXT keys: None -# Discovery -# htsp Home Tv Streaming Protocol [Andreas_Oman] [Andreas_Oman] Defined TXT keys: None -# Web browsers like Safari and Internet Explorer (with the -# Bonjour for Windows plugin) DO NOT browse for DNS-SD service -# type "_https._tcp" in addition to browsing for "_http._tcp". -# This is a conscious decision to reduce proliferation of -# service types, to help keep DNS-SD efficient on the network. -# Today, if a user types http://www.mybank.com/ into their web -# browser, the web server automatically redirects the user to -# https://www.mybank.com/. Rather than having an entirely -# different DNS-SD service type for https, we recommend using -# https tcp HTTP over SSL/TLS [Tim_Berners_Lee] [Tim_Berners_Lee] the same redirection mechanism: advertise a plain "http" -# service, which consists of nothing except an HTTP redirection -# to the desired "https" URL. Work is currently being done on -# adding mechanisms to HTTP and TLS to allow the server to tell -# the client that it needs to activate TLS on the current -# connection before proceeding. If this becomes widely adopted, -# it further justifies the decision to not create a separate -# DNS-SD service type "_https._tcp", because security becomes -# just another one of the things that is negotiated on a -# per-connection basis (like content-type negotiation today) -# rather than being an entirely separate thing. -# htvncconf udp HomeTouch Vnc Configuration [Yuval_Rakavy] [Yuval_Rakavy] 2012-07-10 Defined TXT keys: None -# hyperstream Atempo HyperStream [Laurent_Charmet] [Laurent_Charmet] Defined TXT keys: version=x.y.z.w uuid=<36 bytes UUID string> -# deduplication server host= -# iad1 BBN IAD 2013-05-24 This service name is no longer in use. -# iad2 BBN IAD 2013-05-24 This service name is no longer in use. -# iad3 BBN IAD 2013-05-24 This service name is no longer in use. -# iaudit tcp Braemar Inventory audit [Braemar_Consulting] [Richard_Thompson] 2014-03-05 Defined TXT keys: None -# ibiz iBiz Server [IGG_Software] [IGG_Software] Defined TXT keys: None -# ica-networking Image Capture Networking [Baskaran_Subramaniam] [Baskaran_Subramaniam] Defined TXT keys: None -# ican Northrup Grumman/TASC/ICAN [Laurent_Mihalkovic] [Laurent_Mihalkovic] Defined TXT keys: None -# Protocol -# ichalkboard iChalk [Math_Game_House_Soft] [Math_Game_House_Soft] Defined TXT keys: None -# ichat iChat 1.0 [Jens_Alfke] [Jens_Alfke] Defined TXT keys: Proprietary -# iconquer iConquer [Andrew_Zamler_Carhar] [Andrew_Zamler_Carhar] Defined TXT keys: None -# A Remote Control Application -# icontrolbox tcp service used to control [Umair_Cheema] [Umair_Cheema] 2013-07-08 Defined TXT keys: None -# Computers on a Local Area -# Network -# idata Generic Data Acquisition and [Carson_Fenimore] [Carson_Fenimore] Defined TXT keys: None -# Control Protocol -# idcws Intermec Device [Thaddeus_Ternes] [Thaddeus_Ternes] Defined TXT keys: version= -# Configuration Web Services -# idsync SplashID Synchronization [Justin_Cepelak] [Justin_Cepelak] Defined TXT keys: Proprietary -# Service -# ifolder Published iFolder [Brady_Anderson] [Brady_Anderson] Defined TXT keys: version=? -# ihouse Idle Hands iHouse Protocol [Toby_Smith] [Toby_Smith] Defined TXT keys: None -# ii-drills Instant Interactive Drills [Ricky_Sharp] [Ricky_Sharp] Defined TXT keys: None -# ii-konane Instant Interactive Konane [Ricky_Sharp] [Ricky_Sharp] Defined TXT keys: None -# ilynx iLynX [iOS_Software] [iOS_Software] Defined TXT keys: None -# im tcp Instant Messaging [RFC3861] -# im udp Instant Messaging [RFC3861] -# imagescal tcp ImagesCal App Data Sharing [Three_Lights_Software_LLC] [Gus_Asadi] 2014-07-22 Defined TXT keys: None -# imidi iMidi [Robert_Grant] [Robert_Grant] Defined TXT keys: None -# imgsync tcp Protocol synchronizing Image [Canon_Inc_2] [Kazuo_Moritomo] 2013-03-28 Defined TXT keys: srvver, mf, md, mn, tid, srv, sid, myhwa, -# data imglist, devAid, serAid, vever -# ims-ni tcp Noise Inspector [IMS_merilni_sistemi] [Metod_Celestina] 2012-08-24 Defined TXT keys: SN (serial number), SVER (software -# version), HVER (hardware version), PVER (protocol version)) -# indigo-dvr Indigo Security Digital [Haram_Lee] [Haram_Lee] Defined TXT keys: Proprietary -# Video Recorders -# infboard tcp InfBoard interactive [Eric_Sean_Conner] [Eric_Sean_Conner] 2011-10-17 Defined TXT keys: Proprietary -# whiteboard protocol -# innergroup tcp Service for a Communications [Santo_Porpiglia] [Santo_Porpiglia] 2015-05-28 Defined TXT keys: None -# App -# inova-ontrack Inova Solutions OnTrack Defined TXT keys: None -# Display Protocol -# Internet-of-things (IoT) Defined TXT keys: :application specific kind of -# iot tcp JSON telegram service [SEVENSTAX_GmbH] [Ralf_Schwarzer] 2015-11-05 protocol; :version of the 'type'; :device -# descriptor -# iota tcp iotaMed medical records [MITM] [Martin_Wehlou] 2011-10-18 Defined TXT keys: none -# server -# ipbroadcaster IP Broadcaster [base_t_Interactive] [base_t_Interactive] Defined TXT keys: None -# ipspeaker IP Speaker Control Protocol [Dan_Mahn] [Dan_Mahn] Defined TXT keys: None -# ir-hvac-000 tcp HVAC SMIL Server [Ingersoll_Rand_Inc] [John_Taylor] 2011-09-28 Defined TXT keys: None -# irelay iRelay application discovery [Marc_Diamante] [Marc_Diamante] Defined TXT keys: Proprietary -# service -# irmc Intego Remote Management [Olivier_Delecluse] [Olivier_Delecluse] Defined TXT keys: RMC Client Version=, MAC -# Console Address=
-# irobotmcs tcp iRobot Monitor and Control [iRobot_Corporation] [Tim_Farlow] 2013-11-07 Defined TXT keys: None -# Service -# irobotmcs udp iRobot Monitor and Control [iRobot_Corporation] [Tim_Farlow] 2013-11-07 Defined TXT keys: None -# Service -# irradiatd-iclip tcp iClip clipboard transfer [Irradiated_Software] [Thomas_Tempelmann] 2012-06-19 Defined TXT keys: none -# irt-sharing tcp Image Resizer Toolbox [fnxsoftware.com] [Juan_Guerrero] 2015-06-30 Defined TXT keys: irtshrng -# preview sharing service -# isparx iSparx [Philipp_Dreiss] [Philipp_Dreiss] Defined TXT keys: None -# ispq-vc iSpQ VideoChat [Chris_Silverberg] [Chris_Silverberg] Defined TXT keys: None -# ishare iShare [Steve_Dekorte] [Steve_Dekorte] Defined TXT keys: None -# isticky iSticky [Insist] [Insist] Defined TXT keys: None -# istorm iStorm [Math_Game_House_Soft] [Math_Game_House_Soft] Defined TXT keys: None -# isynchronize tcp iSynchronize data [Smart_Apps_LTD] [Sergey_Bolshedvorsky] 2011-10-11 Defined TXT keys: none -# synchronization protocol -# itap-publish tcp iTap Publishing Service [HLW_Software_Development_GmbH] [Michael_Lacher] 2011-10-11 Defined TXT keys: uuid= -# IT-IS International Ltd. Defined TXT keys: type= configuration= description= -# version= -# itsrc iTunes Socket Remote Control [Kevin_Leacock] [Kevin_Leacock] Defined TXT keys: None -# ivef Inter VTS Exchange Format [Harry_ten_Berge] [Harry_ten_Berge] Defined TXT keys: None -# iwork iWork Server [IGG_Software] [IGG_Software] Defined TXT keys: None -# jcan Northrup Grumman/TASC/JCAN [Laurent_Mihalkovic] [Laurent_Mihalkovic] Defined TXT keys: None -# Protocol -# jeditx Jedit X [Satoshi_Matsumoto] [Satoshi_Matsumoto] Defined TXT keys: None -# jini Jini Service Discovery [Daniel_Steinberg] [Daniel_Steinberg] Defined TXT keys: None -# Defined TXT keys: hash=<40hex characters> salt=<40hex -# jollys keychain cloud sync characters> uuid=<40hex characters> Example: -# jnx-kcsync tcp protocol [Patrick_Stein] [Patrick_Stein] 2011-10-24 hash=5e7580598c0d7064d4fc79faaeb42585e1a675f8 -# salt=f0164cb3a0c3d7efe75abea8fda86d2d56c8dda9 -# uuid=db61dc092922252e45bbb264f59147138c7fd5fa -# jtag Proprietary [Uwe_Ziegler] [Uwe_Ziegler] Defined TXT keys: blocked=, -# version= -# jukebox tcp Jukebox Request Service [Gary_Giebler_2] [Gary_Giebler_2] 2011-10-18 Defined TXT keys: None -# KeynoteAccess is used for -# sending remote -# keynoteaccess tcp requests/responses when [Apple] [Brad_Vaughan] 2011-10-12 Defined TXT keys: None -# controlling a slideshow with -# Keynote Remote -# KeynotePairing is used to -# keynotepairing tcp pair Keynote Remote with [Apple] [Brad_Vaughan] 2011-10-12 Defined TXT keys: None -# Keynote -# kiwin tcp Topology Discovery [Stephen_kiwin_PALM] [Stephen_kiwin_PALM] 2015-06-30 Defined TXT keys: kiwin, top -# ktp Kabira Transaction Platform [Ramiro_Sarmiento] [Ramiro_Sarmiento] Defined TXT keys: None -# la-maint IMP Logical Address 2013-05-24 This service name is no longer in use. -# Maintenance -# labyrinth udp Labyrinth local multiplayer [Andreas_Alptun] [Andreas_Alptun] Defined TXT keys: None -# protocol -# lan2p Lan2P Peer-to-Peer Network [Ben_Guild] [Ben_Guild] Defined TXT keys: None -# Protocol -# lapse Gawker [Phil_Piwonka] [Phil_Piwonka] Defined TXT keys: None -# leaf Lua Embedded Application [Ico_Doornekamp] [Ico_Doornekamp] Defined TXT keys: name= product= version= -# lexicon Lexicon Vocabulary Sharing [Jacob_Godwin_Jones] [Jacob_Godwin_Jones] Defined TXT keys: None -# liaison Liaison [Brian_Cully] [Brian_Cully] Defined TXT keys: None -# Delicious Library 2 -# library Collection Data Sharing [William_Shipley] [William_Shipley] Defined TXT keys: None -# Protocol -# Protocol for setup and -# libratone control of Libratone [Libratone_AS] [Claus_Jensen] 2011-10-27 Defined TXT keys: None -# products -# licor LI-COR Biosciences [Software_LI-COR_Biosciences] [Kevin_Ediger] 2011-10-18 Defined TXT keys: None -# instrument discovery -# llrp-secure RFID reader Low Level Reader [Jason_Schoon_2] [Jason_Schoon_2] Defined TXT keys: None -# Protocol over SSL/TLS -# lobby Gobby [Gobby_0x539] [Gobby_0x539] Defined TXT keys: None -# logicnode udp Logic Pro Distributed Audio [Nikolaus_Gerteis] [Nikolaus_Gerteis] Defined TXT keys: None -# lonbridge Echelon LonBridge Server [Rich_Blomseth] [Rich_Blomseth] Defined TXT keys: None -# lontalk LonTalk over IP (ANSI 852) [Michael_Tennefoss] [Michael_Tennefoss] Defined TXT keys: None -# lonworks Echelon LNS Remote Client [Michael_Tennefoss] [Michael_Tennefoss] Defined TXT keys: None -# lsys-appserver Linksys One Application [Frank_Zerangue] [Frank_Zerangue] Defined TXT keys: path=value (relative URL) engname=value -# Server API (string) -# lsys-camera Linksys One Camera API [Frank_Zerangue] [Frank_Zerangue] Defined TXT keys: brand=value (string) model=value (string) -# version=value (string) -# Defined TXT keys: model=value (string) serial=value (sring) -# lsys-ezcfg LinkSys EZ Configuration [Frank_Zerangue] [Frank_Zerangue] hwversion=value (string) swversion=value (string) -# ifversion=value (string) type=value (string) mac=value (12 -# hex digits) -# LinkSys Operations, Defined TXT keys: model=value (string) serial=value (sring) -# lsys-oamp Administration, Management, [Frank_Zerangue] [Frank_Zerangue] hwversion=value (string) swversion=value (string) -# and Provisioning ifversion=value (string) type=value (string) mac=value (12 -# hex digits) -# A protocol to remotely -# lumiere tcp control DMX512 devices over [Gangsta_Ltd] [Jean-Charles_Boude] 2011-10-13 Defined TXT keys: None -# the network -# lumis-lca tcp Lumis Cache Appliance [Lumis] [Rodrigo_Terra] 2011-10-24 Defined TXT keys: none -# Protocol -# lux-dtp Lux Solis Data Transport [Laurence_Flath] [Laurence_Flath] Defined TXT keys: None -# Protocol -# lxi LXI [Nick_Barendt_2] [Nick_Barendt_2] Defined TXT keys: txtvers, *IDN?= -# lyrics iPod Lyrics Service [Gary_Giebler] [Gary_Giebler] Defined TXT keys: Proprietary -# macfoh MacFOH [Shaun_Wexler] [Shaun_Wexler] Defined TXT keys: None -# macfoh-admin MacFOH admin services [Shaun_Wexler] [Shaun_Wexler] Defined TXT keys: None -# macfoh-audio udp MacFOH audio stream [Shaun_Wexler] [Shaun_Wexler] Defined TXT keys: None -# macfoh-events udp MacFOH show control events [Shaun_Wexler] [Shaun_Wexler] Defined TXT keys: None -# macfoh-data udp MacFOH realtime data [Shaun_Wexler] [Shaun_Wexler] Defined TXT keys: None -# macfoh-db MacFOH database [Shaun_Wexler] [Shaun_Wexler] Defined TXT keys: None -# macfoh-remote MacFOH Remote [Shaun_Wexler] [Shaun_Wexler] Defined TXT keys: None -# macminder Mac Minder [Luma_Code] [Luma_Code] Defined TXT keys: None -# maestro Maestro Music Sharing [Luke_Steffen] [Luke_Steffen] Defined TXT keys: None -# Service -# magicdice Magic Dice Game Protocol [Mike_Yenco] [Mike_Yenco] Defined TXT keys: None -# mandos Mandos Password Server [Mandos_Maintainers] [Mandos_Maintainers] Defined TXT keys: None -# matrix MATRIX Remote AV Switching [Ken_Jibiki] [Ken_Jibiki] Defined TXT keys: None -# mavlink tcp MAVLink Micro Air Vehicle [Roderick_Mann] [Roderick_Mann] 2011-10-20 Defined TXT keys: 0 -# Communication Protocol -# mbconsumer MediaBroker++ Consumer [Nate_Rivard] [Nate_Rivard] Defined TXT keys: None -# mbproducer MediaBroker++ Producer [Nate_Rivard] [Nate_Rivard] Defined TXT keys: None -# mbserver MediaBroker++ Server [Nate_Rivard] [Nate_Rivard] Defined TXT keys: None -# mconnect ClairMail Connect [Sachin_Desai] [Sachin_Desai] Defined TXT keys: None -# mcrcp MediaCentral [equinux] [equinux] Defined TXT keys: None -# MediaBoardONE Asset and -# mediaboard1 Information Manager data [Thomas_K_Fischer] [Thomas_K_Fischer] Defined TXT keys: None -# sharing and synchronization -# protocol -# mediatap tcp Mediatap streaming protocol [Mediatap_GbR] [Mario_Pörner] 2011-10-11 Defined TXT keys: Proprietary -# mercurydock tcp Mercury Dock Assistant [Spider_Electronics] [Kenny_Millar] 2014-03-10 Defined TXT keys: status, signature, ver -# mesamis Mes Amis [David_Priest] [David_Priest] Defined TXT keys: None -# mi-raysat Mental Ray for Maya [Autodesk] [Autodesk] Defined TXT keys: None -# mieleathome tcp Miele@home Protocol [Miele_Cie_KG] [Nils_Langhammer] 2014-03-13 Defined TXT keys: txtvers and proprietary keys -# A Remote Control Application -# mn-passage tcp service used to control [Midnight_Oil_Enterprises_LLC] [Dan_Corkill] 2013-07-09 Defined TXT keys: inherited from bonjour/iOS multipeer -# Computers on a Local Area connectivity -# Network -# A Remote Control Application -# mn-passage udp service used to control [Midnight_Oil_Enterprises_LLC] [Dan_Corkill] 2013-07-09 Defined TXT keys: inherited from bonjour/iOS multipeer -# Computers on a Local Area connectivity -# Network -# modolansrv modo LAN Services [Matt_Craig] [Matt_Craig] Defined TXT keys: None -# Authentication service for -# mogeneti-auth tcp Mogeneti Software [Mogeneti] [Bart_Rijpers] 2012-09-26 Defined TXT keys: none -# Applications -# moneysync SplashMoney Synchronization [Justin_Cepelak] [Justin_Cepelak] Defined TXT keys: Proprietary -# Service -# MoneyWorks Gold and -# moneyworks MoneyWorks Datacentre [Rowan_Daniell] [Rowan_Daniell] Defined TXT keys: None -# network service -# moodring Bonjour Mood Ring tutorial [Daniel_Steinberg] [Daniel_Steinberg] Defined TXT keys: txtvers=1 mood= -# program -# mother Mother script server [Jonathan] [Jonathan] Defined TXT keys: user, ssl -# protocol -# movieslate MovieSlate digital [Cliff_Joyce] [Cliff_Joyce] Defined TXT keys: Proprietary -# clapperboard -# mp3sushi MP3 Sushi [Alexandre_Carlhian] [Alexandre_Carlhian] Defined TXT keys: None -# mqtt IBM MQ Telemetry Transport [AndySC] [AndySC] Defined TXT keys: topics=, eg topic=/info -# mslingshot Martian SlingShot [Martin_Technology] [Martin_Technology] Defined TXT keys: displayName, passwordRequired, -# acceptsUpdates -# msrps tcp MSRP protocol over TLS 2014-04-25 [RFC4976] Defined TXT keys: -# mumble Mumble VoIP communication [Thorvald_Natvig] [Thorvald_Natvig] Defined TXT keys: None -# protocol -# musicmachine Protocol for a distributed [Johan_Mjones] [Johan_Mjones] Defined TXT keys: apiversion, passreq -# music playing service -# mysync MySync Protocol [Martin_Redington] [Martin_Redington] Defined TXT keys: None -# mttp MenuTunes Sharing [iThink_Software] [iThink_Software] Defined TXT keys: None -# mxim-art2 Maxim Integrated Products [Zach_Metzinger] [Zach_Metzinger] Defined TXT keys: Proprietary -# Automated Roadtest Mk II -# mxim-ice Maxim Integrated Products [Zach_Metzinger] [Zach_Metzinger] Defined TXT keys: Proprietary -# In-circuit Emulator -# Defined TXT keys: None mxs.system.id= -# mxs MatrixStore [Object_Matrix] [Object_Matrix] mxs.system.version= -# mxs.cluster.id= -# nasmon tcp Proprietary communication [Infinite_Loop] [Claus_Broch2] 2012-10-09 Defined TXT keys: Proprietary -# protocol for NAS Monitor -# nasmon udp Proprietary communication [Infinite_Loop] [Claus_Broch2] 2012-10-09 Defined TXT keys: Proprietary -# protocol for NAS Monitor -# ncbroadcast Network Clipboard Broadcasts [Thom_McGrath] [Thom_McGrath] Defined TXT keys: Contact The ZAZ Software -# ncdirect Network Clipboard Direct [Thom_McGrath] [Thom_McGrath] Defined TXT keys: Contact The ZAZ Software -# The issuer service in the -# ncount-issuer tcp n-Count electronic value [n-Count_Technology_BV] [Eduard_de_Jong] 2013-01-22 Defined TXT keys: None -# transfer system -# ncsyncserver Network Clipboard Sync [Thom_McGrath] [Thom_McGrath] Defined TXT keys: Contact The ZAZ Software -# nedap-aepu tcp Nedap AEOS processing unit [Nedap] [Leon_van_der_Voort_van_der_Kleij] 2014-08-28 Defined TXT keys: None -# neoriders udp NeoRiders Client Discovery [Jesse_W_Towner] [Jesse_W_Towner] Defined TXT keys: None -# Protocol -# netready tcp UpdateLogic NetReady Device [UpdateLogic_Inc] [Chris_Nigbur] 2014-10-27 Defined TXT keys: Proprietary -# Identification -# netrestore NetRestore [Mike_Bombich] [Mike_Bombich] Defined TXT keys: message, status, progress -# netvu-video tcp AD Group NetVu Connected [AD_Holdings] [Kelvin_Lawson] 2011-10-11 Defined TXT keys: none -# Video -# Proprietary communication -# nextcap tcp protocol for NextCap capture [NextDay_Aps] [Claus_Broch] 2012-04-24 Defined TXT keys: Proprietary -# solution -# Proprietary communication -# nextcap udp protocol for NextCap capture [NextDay_Aps] [Claus_Broch] 2012-04-24 Defined TXT keys: Proprietary -# solution -# ni tcp National Instruments Network [National_Instruments] [Joshua_Prewitt] 2011-10-24 Defined TXT keys: MAC, DevClass, ProdId, ProdName, SerialNo, -# Device Status, ImgPath, Comment -# ni-rt tcp National Instruments [National_Instruments] [Joshua_Prewitt] 2011-10-24 Defined TXT keys: MAC, OS, OSVer, ProcArch -# Real-Time Target -# ni-sysapi tcp National Instruments System [National_Instruments] [Joshua_Prewitt] 2011-10-24 Defined TXT keys: MAC, Experts, Version -# API Service -# Lightweight event based -# nodel tcp control protocol utilising [Lumicom] [Michael_Cartmel] 2013-02-07 Defined TXT keys: None -# JavaScript Object Notation -# ntlx-arch American Dynamics Intellex [Gary_Sands] [Gary_Sands] Defined TXT keys: txtvers, macaddress, protovers, model, -# Archive Management Service serial -# American Dynamics Intellex Defined TXT keys: txtvers, macaddress, protovers, model, -# ntlx-ent Enterprise Management [Gary_Sands] [Gary_Sands] serial -# Service -# ntlx-video American Dynamics Intellex [Gary_Sands] [Gary_Sands] Defined TXT keys: txtvers, macaddress, protovers, model, -# Video Service serial, control, event -# ntx udp Tenasys [Carl_Ellis] [Carl_Ellis] Defined TXT keys: None -# obf Observations Framework [Matthew_Baker] [Matthew_Baker] Defined TXT keys: version= -# Means for clients to locate Defined TXT keys: txtvers='1' -# objective servers in an Objective [Marc_Bailey] [Marc_Bailey] type={'production'|'standby'|'test'|'demo'} -# (http://www.objective.com) protocol={['SOAP'],['CORBA']} transport=['iiop']|['http'] -# instance. -# Insecure OCP.1 protocol, -# oca tcp which is the insecure TCP/IP [OCA_Alliance] [Stephan_van_Tienen] 2012-10-11 Defined TXT keys: txtvers=1 protovers=x -# implementation of the Object -# Control Architecture -# Insecure OCP.1 protocol, -# oca udp which is the insecure TCP/IP [OCA_Alliance] [Stephan_van_Tienen] 2012-10-11 Defined TXT keys: txtvers=1 protovers=x -# implementation of the Object -# Control Architecture -# Secure OCP.1 protocol, which -# ocasec tcp is the secure TCP/IP [OCA_Alliance] [Stephan_van_Tienen] 2012-10-11 Defined TXT keys: txtvers=1 protovers=x -# implementation of the Object -# Control Architecture -# Secure OCP.1 protocol, which -# ocasec udp is the secure TCP/IP [OCA_Alliance] [Stephan_van_Tienen] 2012-10-11 Defined TXT keys: txtvers=1 protovers=x -# implementation of the Object -# Control Architecture -# oce Oce Common Exchange Protocol [Dion_Slijp] [Dion_Slijp] Defined TXT keys: type, version -# od-master OpenDirectory Master [Jason_Thorpe] [Jason_Thorpe] Defined TXT keys: None -# odabsharing OD4Contact [Objective_Decision] [Objective_Decision] Defined TXT keys: None -# odisk Optical Disk Sharing [Bob_Bradley_2] [Bob_Bradley_2] Defined TXT keys: sys, dkX -# officetime-sync OfficeTime Synchronization [Support] [Support] Defined TXT keys: None -# Protocol -# ofocus-conf OmniFocus setting [Timothy_J_Wood] [Timothy_J_Wood] Defined TXT keys: None -# configuration -# ofocus-sync OmniFocus document [Timothy_J_Wood] [Timothy_J_Wood] Defined TXT keys: Proprietary -# synchronization -# Web Interface for the Open -# ola tcp Lighting Architecture [Open_Lighting_Project] [Simon_Newton_2] 2013-12-09 2014-02-25 Subtypes: _www-http Defined TXT keys: None -# Software -# olpc-activity1 udp One Laptop per Child [One_Laptop_per_Child] [One_Laptop_per_Child] Defined TXT keys: Shared_Activity_Protocol_1.0 -# activity -# oma-bcast-sg OMA BCAST Service Guide [Stefan_Ekenberg] [Stefan_Ekenberg] Defined TXT keys: None -# Discovery Service -# Open Mobile Alliance (OMA) -# omadm-bootstrap tcp Device Management (DM) [Open_Mobile_Alliance] [Open_Mobile_Alliance_Device_Management_DM_Working_Group] 2011-08-19 Defined TXT keys: None -# Bootstrap Server Discovery -# Service -# omni-bookmark OmniWeb [The_Omni_Group] [The_Omni_Group] Defined TXT keys: None -# Service for remote control -# omni-live of Omnisphere virtual [Glenn_Olander_2] [Glenn_Olander_2] Defined TXT keys: omni-livetxt.html -# instrument -# openbase OpenBase SQL Defined TXT keys: None -# opencu udp Conferencing Protocol [Marc_Manthey_2] [Marc_Manthey_2] Defined TXT keys: None -# oprofile oprofile server protocol [Rob_Bradford] [Rob_Bradford] Defined TXT keys: None -# oscit udp Open Sound Control Interface [Gaspard_Bucher] [Gaspard_Bucher] Defined TXT keys: None -# Transfer -# ovready ObjectVideo OV Ready [Gary_Myers] [Gary_Myers] Defined TXT keys: txtvers, protovers -# Protocol -# owhttpd OWFS (1-wire file system) [Paul_H_Alfille] [Paul_H_Alfille] Defined TXT keys: txtvers -# web server -# parentcontrol Remote Parental Controls [John_Scalo] [John_Scalo] Defined TXT keys: None -# passwordwallet PasswordWallet Data [Sanford_Selznick] [Sanford_Selznick] Defined TXT keys: None -# Synchronization Protocol -# pcast Mac OS X Podcast Producer [Nick_Brosnahan] [Nick_Brosnahan] Defined TXT keys: None -# Server -# p2pchat udp Peer-to-Peer Chat (Sample [Roger_Pantos] [Roger_Pantos] Defined TXT keys: None -# Java Bonjour application) -# p2pstorage-sec tcp DataBOND p2p storage [Dell] [Jessica_Zhang] 2012-11-19 Defined TXT keys: txtvers, machineid, status -# pairandshare tcp Pair & Share data protocol [Intel] [Joshua_Boelter] 2011-10-18 Defined TXT keys: Proprietary -# panoply tcp Panoply multimedia composite [Natarajan_Balasundar] [Natarajan_Balasundar] Defined TXT keys: None -# transfer protocol -# parabay-p2p tcp Parabay P2P protocol [Vishnu_Varadaraj] [Vishnu_Varadaraj] Defined TXT keys: None -# parity tcp PA-R-I-Ty (Public Address - [ims_Info] [Oskar_Persano] 2011-10-20 Defined TXT keys: Proprietary -# Radio - Intercom - Telefony) -# parity udp PA-R-I-Ty (Public Address - [ims_Info] [Oskar_Persano] 2011-10-20 Defined TXT keys: Proprietary -# Radio - Intercom - Telefony) -# pgpkey-hkp Horowitz Key Protocol (HKP) [Marc_Horowitz] [Marc_Horowitz] Defined TXT keys: None -# pgpkey-http PGP Keyserver using HTTP/1.1 [Jeroen_Massar_3] [Jeroen_Massar_3] Defined TXT keys: path= normally: "path=/pks/" -# pgpkey-https PGP Keyserver using HTTPS [Jeroen_Massar_3] [Jeroen_Massar_3] Defined TXT keys: path= normally: "path=/pks/" -# pgpkey-ldap PGP Keyserver using LDAP [Jeroen_Massar_3] [Jeroen_Massar_3] Defined TXT keys: None -# pgpkey-mailto PGP Key submission using [Jeroen_Massar_3] [Jeroen_Massar_3] Defined TXT keys: user= -# SMTP -# photoparata Photo Parata Event [Sam_Carleton] [Sam_Carleton] Defined TXT keys: None -# Photography Software -# photoshow tcp Show Photos over TCP [Hamed_Ishbaitah] [Hamed_Ishbaitah] 2014-07-30 Defined TXT keys: None -# photosmithsync tcp Photosmith's iPad to [Photosmith] [Chris_Horne] 2011-10-27 Defined TXT keys: None -# Lightroom sync protocol -# pictua Pictua Intercommunication [Isaack_Rasmussen] [Isaack_Rasmussen] Defined TXT keys: None -# Protocol -# piesync pieSync Computer to Computer [Timothy_Wayper] [Timothy_Wayper] Defined TXT keys: None -# Synchronization -# piu Pedestal Interface Unit by [James_Nikolai] [James_Nikolai] Defined TXT keys: None -# RPM-PSI -# pkixrep Public Key Infrastructure [RFC4386] -# Repository Locator Service -# poch Parallel OperatiOn and [Dean_Dauger] [Dean_Dauger] Defined TXT keys: None -# Control Heuristic (Pooch) -# podcastproxy tcp Protocol for communication [Moritz_Schmale] [Moritz_Schmale] 2011-10-07 Defined TXT keys: None -# between Podcast -# Communication channel for -# pokeeye "Poke Eye" Elgato EyeTV [Kristoffer_Lawson] [Kristoffer_Lawson] Defined TXT keys: None -# remote controller -# powereasy-erp PowerEasy ERP [Ulaganathan_Sriramul] [Ulaganathan_Sriramul] Defined TXT keys: ip, port, name, instance, cgi-alias, -# major-version, minor-version, custom -# powereasy-pos PowerEasy Point of Sale [Murthy_Parthasarathi] [Murthy_Parthasarathi] Defined TXT keys: ip, port, type, device-id, major-version, -# minor-version, custom -# pplayer-ctrl Piano Player Remote Control [Juraj_Zopp] [Juraj_Zopp] Defined TXT keys: Proprietary -# pres tcp Presence [RFC3861] -# pres udp Presence [RFC3861] -# Defined TXT keys: See -# http://www.xmpp.org/registrar/linklocal.html Note: -# Registration updated May 2007. Was formerly listed as "iChat -# AV" (Apple's IM client for Mac OS X) with TXT keys: txtvers, -# port.p2pj, phsh, vc, 1st, AIM, msg, status, last When first -# shipped in Mac OS X 10.2, iChat's peer-to-peer messaging -# presence Peer-to-peer messaging / [XMPP_Registrar] [XMPP_Registrar] protocol was created to solve the problem of serverless -# Link-Local Messaging messaging between peers on the same link. However, there is -# nothing inherent in the protocol that limits it to being only -# link-local; it was simply an artifact of iChat in Mac OS X -# 10.2 using link-local Multicast DNS to discover peers. With -# the advent of Wide-Area DNS-SD, it is also possible to use -# iChat's peer-to-peer messaging between machines on different -# links. -# print-caps Retrieve a description of a [Troy_Bergstrand] [Troy_Bergstrand] Defined TXT keys: None -# device's print capabilities -# printopia tcp Printopia Server [Decisive_Tactics_Inc] [Chris_Kent] 2011-10-24 2015-04-11 Defined TXT keys: uuid, vers, pvers -# profilemac Profile for Mac medical [David_Sinclair_2] [David_Sinclair_2] Defined TXT keys: None -# practice management software -# prolog Prolog [Mike_Brady] [Mike_Brady] Defined TXT keys: version= -# protonet Protonet node and service [Ali_Jelveh] [Ali_Jelveh] Defined TXT keys: version, notes -# discovery protocol -# psap udp Progal Service Advertising [Soren_Weber] [Soren_Weber] Defined TXT keys: c0, c1, ..., cn -# Protocol -# Physical Security -# psia Interoperability Alliance [Frank_Yeh] [Frank_Yeh] Defined TXT keys: txtvers, protovers -# Protocol -# pstmailsync tcp File synchronization [Arrow_Bit_SL] [Javier_Nigro] 2012-04-26 Defined TXT keys: uuid= -# protocol for Pst Mail Sync -# pstmailsync-ssl tcp Secured file synchronization [Arrow_Bit_SL] [Javier_Nigro] 2012-04-26 Defined TXT keys: uuid= -# protocol for Pst Mail Sync -# ptnetprosrv2 PTNetPro Service [Apple_Computer] [Apple_Computer] Defined TXT keys: None Profiling and performance analysis -# protocol for Shark 4.0 and BigTop. -# ptp-init tcp Picture Transfer [Canon_Inc] [Tatsuhiko_Sakai] 2011-10-03 Defined TXT keys: srvver, mn, mf, md, srv, tid -# Protocol(PTP) Initiator -# ptp-req PTP Initiation Request [Mark_Wood] [Mark_Wood] Defined TXT keys: txtvers, guid, c0, c1, c2, ..., where the -# Protocol number of c_n attributes is variable -# puzzle Protocol used for puzzle [Michael_Thomason] [Michael_Thomason] Defined TXT keys: None -# games -# pvaccess tcp Experimental Physics and [Matej_Sekoranja] [Matej_Sekoranja] 2012-03-23 Defined TXT keys: None -# Industrial Control System -# qbox QBox Appliance Locator [Geoff_Back_4] [Geoff_Back_4] Defined TXT keys: None -# qttp QuickTime Transfer Protocol [Stuart_Cheshire_5] [Stuart_Cheshire_5] Defined TXT keys: u= p= path= (Same as for _http._tcp) -# quad tcp Distributed Game Data [Niall_Hogg] [Niall_Hogg] 2011-10-25 Defined TXT keys: Proprietary -# quinn Quinn Game Server [Simon_Haertel] [Simon_Haertel] Defined TXT keys: None -# Broadcast of Qwizdom -# qwizcollab tcp Presentation sessions for [Qwizdom_Inc.] [Matthew_Owings] 2015-09-21 Defined TXT keys: None -# joining by a client, such as -# Qwizdom Notes+. -# rakket Rakket Client Protocol [Orion_Reblitz_Richar] [Orion_Reblitz_Richar] Defined TXT keys: None -# radiotag RadioTAG: Event tagging for [Andy_Buckingham] [Andy_Buckingham] Defined TXT keys: None -# radio services -# radiovis RadioVIS: Visualisation for [Andy_Buckingham] [Andy_Buckingham] Defined TXT keys: None -# radio services -# RadioEPG: Electronic -# radioepg Programme Guide for radio [Andy_Buckingham] [Andy_Buckingham] Defined TXT keys: None -# services -# radioport tcp RadioPort Message Service [Bob_Iannucci] [Bob_Iannucci] 2011-11-23 Defined TXT keys: NONE -# radioport udp RadioPort Message Service [Bob_Iannucci] [Bob_Iannucci] 2011-11-23 Defined TXT keys: NONE -# Authentication, Accounting, -# and Dynamic Authorization -# via the RADIUS protocol. -# radiusdtls udp This service name is used to [IESG] [IETF_Chair] 2015-03-23 2015-10-06 [RFC7585] Defined TXT keys: None -# construct the SRV service -# label "_radiusdtls" for -# discovery of RADIUS/DTLS -# servers. -# Authentication, Accounting, -# and Dynamic Authorization -# via the RADIUS protocol. -# radiustls tcp This service name is used to [IESG] [IETF_Chair] 2015-03-23 2015-10-06 [RFC7585] Defined TXT keys: None -# construct the SRV service -# label "_radiustls" for -# discovery of RADIUS/TLS -# servers. -# raop Remote Audio Output Protocol [BonjourDev] [BonjourDev] 2011-10-14 Defined TXT keys: None -# (AirTunes) -# rbr RBR Instrument Communication [Greg_Johnson] [Greg_Johnson] Defined TXT keys: None -# rce PowerCard [DeVoeSquared] [DeVoeSquared] Defined TXT keys: None -# rdp Windows Remote Desktop [Jugaari] [Jugaari] Defined TXT keys: None -# Protocol -# realplayfavs RealPlayer Shared Favorites [RealNetworks] [RealNetworks] Defined TXT keys: None -# recipe-box tcp The Recipe Box Exchange [Corpus_Collusion] [Kathy_Tafel] 2011-08-23 Defined TXT keys: txtvers -# recipe-sharing tcp Recipe Sharing Protocol [Daniel_G_Taylor] [Daniel_G_Taylor] 2007-11 Defined TXT keys: -# [http://www.recipemanager.org/rsp/rsp10draft.html#dnssd] -# recolive-cc tcp Remote Camera Control [RecoLive_Sàrl] [Gabriele_Mondada] 2012-08-29 Defined TXT keys: txtvers, cid, nbd, cap -# recolive-cc udp Remote Camera Control [RecoLive_Sàrl] [Gabriele_Mondada] 2012-08-29 Defined TXT keys: txtvers, cid, nbd, cap -# recordit-itp tcp Recordit Image Transport [Freshout] [Ruben_Beltran_del_Rio_2] 2014-04-14 Defined TXT keys: None -# Protocol -# Remote Device Control Defined TXT keys: txtvers= -# remote Protocol [Gregory_Dudek] [Gregory_Dudek] protovers= forground= version= -# Remote Buddy remote control -# remotebuddy tcp software command and data [IOSPIRIT_GmbH] [Felix_Schwarz] 2014-09-23 Defined TXT keys: None -# exchange -# remoteburn LaCie Remote Burn [Serge_DE_LUCA] [Serge_DE_LUCA] Defined TXT keys: server_version, min_client_version -# renderpipe ARTvps RenderDrive/PURE [Andrew_Hoddinott] [Andrew_Hoddinott] Defined TXT keys: None -# Renderer Protocol -# rendezvouspong RendezvousPong [Math_Game_House_Soft] [Math_Game_House_Soft] Defined TXT keys: None -# renkara-sync Renkara synchronization [Michael_J_Primeaux] [Michael_J_Primeaux] Defined TXT keys: None -# protocol -# resol-vbus RESOL VBus [Daniel_Wippermann] [Daniel_Wippermann] Defined TXT keys: None -# retrospect Retrospect backup and [Michael_Marks] [Michael_Marks] Defined TXT keys: None -# restore service -# Remote Frame Buffer Client Defined TXT keys: server=dns-name/ip-address:port of -# rfbc (Used by VNC viewers in [Ole_Morten_Duesund] [Ole_Morten_Duesund] currently displayed VNC server. Empty if not showing -# listen-mode) anything/available. -# rfid RFID Reader Mach1(tm) [Paul_Dietrich] [Paul_Dietrich] Defined TXT keys: None -# Protocol -# rgb tcp RGB Spectrum Device [RGB_Spectrum] [Steve_Hershey] 2011-10-10 Defined TXT keys: Keyboard, Mouse, Option1, Option2, Option3, -# Discovery Option4, ModelName -# riousbprint Remote I/O USB Printer [Rob_Newberry] [Rob_Newberry] Defined TXT keys: See BonjourPrinting.pdf. -# Protocol -# roambot tcp Roambot communication [Roambotics_Inc] [Scott_Menor] 2013-10-18 Defined TXT keys: None -# Like ircu (RFC1459), but -# robustirc tcp failure tolerant due to [Michael_Stapelberg] [Michael_Stapelberg] 2015-01-07 Defined TXT keys: None -# strong consistency among -# n>=3 servers -# roku-rcp Roku Control Protocol [Don_Woodward] [Don_Woodward] Defined TXT keys: txtvers=1 -# rql RemoteQuickLaunch [Daniel_Heffernan] [Daniel_Heffernan] Defined TXT keys: None -# rr-disc Robot Raconteur discovery [Wason_Technology_LLC] [John_Wason] 2014-01-27 Defined TXT keys: None -# rsmp-server Remote System Management [Geoff_Back_3] [Geoff_Back_3] Defined TXT keys: apiver= -# Protocol (Server Instance) -# rubygems RubyGems GemServer [Rich_Kilmer] [Rich_Kilmer] Defined TXT keys: None -# rym-rrc tcp Raymarine remote control [Raymarine_UK_Limited] [Geoffrey_Beer] 2012-05-24 2012-06-04 Defined TXT keys: raymarine-mfd-rrc-version, -# protocol raymarine-mfd-model, raymarine-mfd-serial -# safarimenu Safari Menu [Jesus_De_Meyer] [Jesus_De_Meyer] Defined TXT keys: None -# sallingbridge Salling Clicker Sharing [Jonas_Salling] [Jonas_Salling] Defined TXT keys: None -# sallingclicker Salling Clicker Service [Jonas_Salling] [Jonas_Salling] Defined TXT keys: None -# Salutafugi Peer-To-Peer Java -# salutafugijms Message Service [David_Walend] [David_Walend] Defined TXT keys: SalutaProperties -# Implementation -# sandvox Sandvox [Karelia_Software] [Karelia_Software] Defined TXT keys: None -# savagesoft tcp Proprietary Client Server [Andy_Savage] [Andy_Savage] 2012-07-13 Defined TXT keys: None -# Protocol -# sc-golf StrawberryCat Golf Protocol [Phil_Willoughby] [Phil_Willoughby] Defined TXT keys: None -# scanner Bonjour Scanning [Baskaran_Subramaniam] [Baskaran_Subramaniam] Defined TXT keys: None -# schick Schick [Heiko_Kretschmer] [Heiko_Kretschmer] Defined TXT keys: None -# schmpp tcp Schindler maintenance portal [Schindler_Aufzuege_ag] [Arno_Odermatt] 2015-04-30 Defined TXT keys: None -# protocol -# schoms tcp schindler object messaging [Schindler_Aufzuege_ag] [Arno_Odermatt] 2015-05-12 Defined TXT keys: None -# system -# schsap tcp Schindler service [Schindler_Aufzuege_ag] [Arno_Odermatt] 2015-04-30 Defined TXT keys: None -# authentication portal -# scone Scone [James_Moore] [James_Moore] Defined TXT keys: None -# scpi-raw IEEE 488.2 (SCPI) Socket [Nick_Barendt_3] [Nick_Barendt_3] Defined TXT keys: None -# scpi-telnet IEEE 488.2 (SCPI) Telnet [Nick_Barendt_3] [Nick_Barendt_3] Defined TXT keys: None -# sdsharing Speed Download [Yazsoft] [Yazsoft] Defined TXT keys: None -# see SubEthaEdit 2 [TheCodingMonkeys] [TheCodingMonkeys] Defined TXT keys: txtvers=1, name=, userid=, version=2 -# seeCard seeCard [Stefan_Pantke] [Stefan_Pantke] Defined TXT keys: None -# senteo-http Senteo Assessment Software [Michael_Boyle] [Michael_Boyle] Defined TXT keys: None -# Protocol -# sentillion-vlc Sentillion Vault System [George_Hartz] [George_Hartz] Defined TXT keys: None -# sentillion-vlt Sentillion Vault Systems [George_Hartz] [George_Hartz] Defined TXT keys: None -# Cluster -# sepvsync SEPV Application Data [Kazuya_Ogata] [Kazuya_Ogata] Defined TXT keys: Proprietary -# Synchronization Protocol -# serendipd serendiPd Shared Patches for [Hans_Christoph_Stein] [Hans_Christoph_Stein] Defined TXT keys: None -# Pure Data -# servereye ServerEye AgentContainer [Andreas_Behr] [Andreas_Behr] Defined TXT keys: None -# Communication Protocol -# servermgr Mac OS X Server Admin [Jeff_Albouze] [Jeff_Albouze] Defined TXT keys: None -# services DNS Service Discovery [Stuart_Cheshire_5][Marc_Krochmal] [Stuart_Cheshire_5][Marc_Krochmal] Not a service type. Special name reserved for DNS-SD meta -# queries. -# sessionfs Session File Sharing [Anthony_Williams] [Anthony_Williams] Defined TXT keys: Text keys are the file extensions of any -# file the user plans to share, i.e. pdf, doc, mp3. -# sftp-ssh Secure File Transfer [Bryan_Cole] [Bryan_Cole] Defined TXT keys: u= p= path= -# Protocol over SSH -# Defined TXT keys: username The login username to use -# Window Shifter server (optional) ssh_tunnel Whether an SSH tunnel must be used -# shifter protocol [Antoine_Martin] [Antoine_Martin] (required) iface The network interface the server is on -# (required - may be empty) version Software version (required) -# ID Server Identifier (requried) -# Defined TXT keys: txtvers= -# ship tcp SHIP (Smart Home IP) [EEBus_Initiative] [Andreas_Westermann] 2014-11-10 id= path= -# seesport= -# register= -# shipsgm Swift Office Ships [Verek] [Verek] Defined TXT keys: None -# shipsinvit Swift Office Ships [Verek] [Verek] Defined TXT keys: None -# shoppersync SplashShopper [Justin_Cepelak] [Justin_Cepelak] Defined TXT keys: Proprietary -# Synchronization Service -# shoutcast Nicecast [Rogue_Amoeba_2] [Rogue_Amoeba_2] Defined TXT keys: None -# siminsufflator tcp Simulated insufflator [Niels_Castle_2] [Niels_Castle_2] 2014-06-18 Defined TXT keys: None -# synchronisation protocol -# Medical simulation patient -# simmon monitor syncronisation [Niels_Castle] [Niels_Castle] Defined TXT keys: None -# protocol -# simusoftpong simusoftpong iPhone game [Anders_Svensson] [Anders_Svensson] Defined TXT keys: Proprietary -# protocol -# sipuri Session Initiation Protocol [Jae_Woo_Lee] [Jae_Woo_Lee] Defined TXT keys: Defined in URL specification -# Uniform Resource Identifier -# sironaxray Sirona Xray Protocol [Michael_Dalpiaz] [Michael_Dalpiaz] Defined TXT keys: Manufacturer=Sirona -# The protocol is used to -# skillscapture tcp transfer database records [Legentis_Ltd] [David_Elliman] 2013-07-01 Defined TXT keys: None -# between an iOS device to a -# Mac OS X computer -# The protocol is used to -# skillscapture udp transfer database records [Legentis_Ltd] [David_Elliman] 2013-07-01 Defined TXT keys: None -# between an iOS device to a -# Mac OS X computer -# skype Skype Defined TXT keys: platform, status, auth, rversion, version -# sleep-proxy udp Sleep Proxy Server [Stuart_Cheshire_5][Marc_Krochmal] [Stuart_Cheshire_5][Marc_Krochmal] Defined TXT keys: None -# slimcli SliMP3 Server Command-Line [Dean_Blackketter_2] [Dean_Blackketter_2] Defined TXT keys: None -# Interface -# slimhttp SliMP3 Server Web Interface [Dean_Blackketter_2] [Dean_Blackketter_2] Defined TXT keys: None -# slpda tcp Remote Service Discovery in [RFC3832] -# the Service Location -# slpda udp Remote Service Discovery in [RFC3832] -# the Service Location -# smartenergy Smart Energy Profile [Robby_Simpson] [Robby_Simpson] Defined TXT keys: See http://www.zigbee.org/SmartEnergy -# smartsocket tcp home control [Robert_Diamond] [Robert_Diamond] 2012-07-06 Defined TXT keys: None -# smb Server Message Block over Defined TXT keys: u= p= path= -# TCP/IP -# sms Short Text Message Sending [Christian_Flintrup] [Christian_Flintrup] Defined TXT keys: Proprietary -# and Delivery Status Service -# Syncellence file Defined TXT keys: device= protocol= os= osver= -# soap Simple Object Access [Andrew_Donoho] [Andrew_Donoho] Defined TXT keys: None -# Protocol -# socketcloud Socketcloud distributed [Robert_Goodyear] [Robert_Goodyear] Defined TXT keys: system, service, process, context, -# application framework direction, status, progress, health, directive, flags -# sox Simple Object eXchange [Igor_Mozolevsky] [Igor_Mozolevsky] Defined TXT keys: Proprietary -# sparechange SpareChange data sharing [Dave_Carrigan] [Dave_Carrigan] Defined TXT keys: None -# protocol -# spearcat sPearCat Host Discovery [Pierre_Frisch_2] [Pierre_Frisch_2] Defined TXT keys: applicationname=, -# osname=, sslsupport= -# spidap tcp Sierra Photonics Inc. data [Sierra_Photonics_Inc] [Support_Staff] 2011-10-20 Defined TXT keys: None -# protocol -# spincrisis Spin Crisis [Sphera_Software] [Sphera_Software] Defined TXT keys: None -# spiderelectron tcp Binary message passing [Spider_Electron] [Kenny_Millar] 2015-02-05 Defined TXT keys: VER, STATUS -# protocol -# spl-itunes launchTunes [David_Nanian_2] [David_Nanian_2] Defined TXT keys: None -# spr-itunes netTunes [David_Nanian_2] [David_Nanian_2] Defined TXT keys: None -# splashsync SplashData Synchronization [Justin_Cepelak] [Justin_Cepelak] Defined TXT keys: Proprietary -# Service -# spres tcp SongPresenter [Tobias_Hoffmann] [Tobias_Hoffmann] 2012-10-09 Defined TXT keys: version, name -# ss-sign tcp Samsung Smart Interaction [Samsung] [Lee_HoJun] 2013-01-03 Defined TXT keys: None -# for Group Network -# ss-sign-disc udp Samsung Smart Interaction [Samsung] [Lee_HoJun] 2013-01-03 Defined TXT keys: None -# for Group Network Discovery -# Defined TXT keys: txtvers=1 cport= the port for the content -# HTTP server (secondary HTTP server used for content -# publishing) mode= the mode in which the HMP device is -# spx-hmp tcp SpinetiX HMP [SpinetiX_S_A] [Diego_Santa_Cruz] 2011-10-18 currently operating, one of "normal", "safe" or "recovery" -# serial= serial number of the HMP device firmware= firmware -# version string (e.g., 2.1.0-0.1.7844) model= model string -# (e.g., HMP100) -# ssh tcp SSH Remote Login Protocol [Tatu_Ylonen] [Tatu_Ylonen] Defined TXT keys: u= p= -# ssscreenshare Screen Sharing Defined TXT keys: None -# startrecapp tcp Remote Controlled Multimedia [Luca_Cipressi] [Luca_Cipressi] 2015-03-27 Defined TXT keys: None -# Recorder Network -# stingray-rpc tcp Stingray Remote Procedure [IK_SATPROF_LLC] [Sergey_Zubov_2] 2014-05-02 Defined TXT keys: None -# Call -# stingray-remote tcp Stingray remote control [IK_SATPROF_LLC] [Sergey_Zubov_2] 2014-05-02 Defined TXT keys: None -# strateges Strateges [Jean_Olivier_Lanctot] [Jean_Olivier_Lanctot] Defined TXT keys: None -# sge-exec Sun Grid Engine (Execution [Bill_Van_Etten] [Bill_Van_Etten] Defined TXT keys: None -# Host) -# sge-qmaster Sun Grid Engine (Master) [Bill_Van_Etten] [Bill_Van_Etten] Defined TXT keys: None -# soda tcp Secure On Device API [Smith_Micro_Software_Inc] [David_Sperling_2] 2011-10-10 Defined TXT keys: a. ssid= b. -# bssid= -# souschef SousChef Recipe Sharing [Ben] [Ben] Defined TXT keys: None -# Protocol -# Defined TXT keys: txtvers=1 path= protovers= [if not specified then default -# SPARQL Protocol and RDF is 1.0, corresponding to SPARQL version] binding= [if not specified then default is HTTP] vocabs= [RDF vocabularies or OWL ontologies -# used by the endpoint] metadata= [to fetch RDF/XML -# description of SPARQL service] -# sqp tcp Square Connect Control [Square_Connect_Inc] [Mat_Henshall] 2011-10-07 Defined TXT keys: Proprietary -# Protocol -# stanza Lexcycle Stanza service for [Marc_Prud_hommeaux] [Marc_Prud_hommeaux] Defined TXT keys: None -# discovering shared books -# stickynotes Sticky Notes [Johnnie_Walker] [Johnnie_Walker] Defined TXT keys: None -# stotp tcp One Time Pad Synchronisation [softthere_com] [James_Crosby] 2011-10-17 Defined TXT keys: None -# supple Supple Service protocol [Dave_Christianson] [Dave_Christianson] Defined TXT keys: type url -# surveillus Surveillus Networks [Mark_Lewis_3] [Mark_Lewis_3] Defined TXT keys: None -# Discovery Protocol -# svn Subversion [CollabNet] [CollabNet] Defined TXT keys: None -# swcards Signwave Card Sharing [Signwave_Networking] [Signwave_Networking] Defined TXT keys: None -# Protocol -# switcher Wireless home control remote [Steve_Splonskowski] [Steve_Splonskowski] Defined TXT keys: None -# control protocol -# swordfish Swordfish Protocol for [Jim_Wallace] [Jim_Wallace] Defined TXT keys: None -# Input/Output -# Framework for transferring -# swyp any file from any app, to [ExoMachina] [Alexander_List] 2011-12-06 Defined TXT keys: NONE -# any app on any device: -# simply with a swÿp. -# sxqdea Synchronize! Pro X [Qdea] [Qdea] Defined TXT keys: None -# sybase-tds Sybase Server Defined TXT keys: None -# syncopation Syncopation Synchronization [Sonzea] [Sonzea] Defined TXT keys: None -# Protocol by Sonzea -# syncqdea Synchronize! X Plus 2.0 [Qdea] [Qdea] Defined TXT keys: None -# synergy Synergy Peer Discovery [Karl_Timmermann] [Karl_Timmermann] Defined TXT keys: None -# synksharing SynkSharing synchronization [Benjamin_Rister] [Benjamin_Rister] Defined TXT keys: None -# protocol -# taccounting Data Transmission and [John_MacMullin] [John_MacMullin] Defined TXT keys: None -# Synchronization -# tango Tango Remote Control [Tony_Amundson] [Tony_Amundson] Defined TXT keys: None -# Protocol -# tapinoma-ecs Tapinoma Easycontact [Bonjour] [Bonjour] Defined TXT keys: None -# receiver -# Task Coach Two-way -# taskcoachsync Synchronization Protocol for [Jerome_Laheurte] [Jerome_Laheurte] Defined TXT keys: None -# iPhone -# Defined TXT keys: txtvers=1, sesna, seid, setype, cosna, -# tbricks tbricks internal protocol [Joakim_Johansson] [Joakim_Johansson] coid, cotype, sysna, syna, syid, subsyid, venid, protocols, -# pid -# tcode Time Code [Marshall_Anschutz] [Marshall_Anschutz] Defined TXT keys: None -# tcu Tracking Control Unit by [James_Nikolai] [James_Nikolai] Defined TXT keys: None -# RPM-PSI -# te-faxserver TE-SYSTEMS GmbH Fax Server [Tobias_Erichsen] [Tobias_Erichsen] Defined TXT keys: Proprietary -# Daemon -# teamlist ARTIS Team Task [ARTIS_Software] [ARTIS_Software] Defined TXT keys: None -# teleport udp teleport [Julien_Robert] [Julien_Robert] Defined TXT keys: None -# tenir-rc tcp Proprietary [Tenir_Software] [Steve_Gums] 2011-10-27 Defined TXT keys: Proprietary -# tera-fsmgr Terascala Filesystem Manager [Mike_Nuss] [Mike_Nuss] Defined TXT keys: Proprietary -# Protocol -# tera-mp Terascala Maintenance [Mike_Nuss] [Mike_Nuss] Defined TXT keys: Proprietary -# Protocol -# test-ok tcp Test Controller Card [TEST-OK_BV] [Jeroen_Ommering] 2012-09-05 Defined TXT keys: TEST-OK Test Controller Card TCCxxxx -# tf-redeye ThinkFlood RedEye IR bridge [Matt_Eagar] [Matt_Eagar] Defined TXT keys: None -# thumbwrestling tinkerbuilt Thumb Wrestling [Jamie_Halmick] [Jamie_Halmick] Defined TXT keys: None -# game -# ticonnectmgr TI Connect Manager Discovery [Stephen_Reid] [Stephen_Reid] Defined TXT keys: None -# Service -# timezone tcp Time Zone Data Distribution [IESG] [IETF_Chair] 2015-08-03 [RFC-ietf-tzdist-service-11] This is an extension of the http service. Defined TXT keys: -# Service - non-TLS path= (as per Section 6 of [RFC6763]). -# timezones tcp Time Zone Data Distribution [IESG] [IETF_Chair] 2015-08-03 [RFC-ietf-tzdist-service-11] This is an extension of the https service. Defined TXT keys: -# Service - over TLS path= (as per Section 6 of [RFC6763]). -# tinavigator TI Navigator Hub 1.0 [Stephen_Reid] [Stephen_Reid] Defined TXT keys: None -# Discovery Service -# tivo-device tcp TiVo Device Protocol [TiVo_Inc] [Developer_Support_2] 2011-10-18 Defined TXT keys: None -# tivo-hme TiVo Home Media Engine [Developer_Support] [Developer_Support] Defined TXT keys: None -# Protocol -# tivo-mindrpc tcp TiVo RPC Protocol [TiVo_Inc] [Developer_Support_2] 2011-10-18 Defined TXT keys: None -# tivo-music TiVo Music Protocol [Developer_Support] [Developer_Support] Defined TXT keys: None -# tivo-photos TiVo Photos Protocol [Developer_Support] [Developer_Support] Defined TXT keys: None -# tivo-remote TiVo Remote Protocol [Developer_Support] [Developer_Support] Defined TXT keys: protocol, path, swversion, platform, TSN -# tivo-videos TiVo Videos Protocol [Developer_Support] [Developer_Support] Defined TXT keys: protocol, path, swversion, platform, TSN -# todogwa 2Do Sync Helper Tool for Mac [Fahad_Gilani] [Fahad_Gilani] Defined TXT keys: None -# OS X and PCs -# tomboy Tomboy [Alex_Graveley] [Alex_Graveley] Defined TXT keys: None -# toothpicserver ToothPics Dental Office [Milton_Pulis] [Milton_Pulis] Defined TXT keys: None -# Support Server -# touch-able iPhone and iPod touch Remote [Amandeep_Jawa_3] [Amandeep_Jawa_3] Defined TXT keys: txtvers, CtlN, DbId, Ver, DvTy, OSsi, DvSv -# Controllable -# touch-remote iPhone and iPod touch Remote [Amandeep_Jawa_3] [Amandeep_Jawa_3] Defined TXT keys: txtvers, DvNm, Pair, RemV, RemN, DvTy -# Pairing -# Coordination service for -# tptx-console tcp client users of the [Randy_Davenport] [Chris_Watson] 2014-03-04 Defined TXT keys: None -# TotalPraisTrax iPad -# application -# Service discovery and media -# transmitr tcp transfer for peer to peer [Windward_Code_LLC] [Alex_Belliotti] 2013-11-27 Defined TXT keys: None -# mobile media transfer app -# tri-vis-client triCerat Simplify Visibility [Christopher_Karper] [Christopher_Karper] Defined TXT keys: None -# Client -# tri-vis-server triCerat Simplify Visibility [Christopher_Karper] [Christopher_Karper] Defined TXT keys: None -# Server -# tryst Tryst [Francisco_Ryan_Tolma] [Francisco_Ryan_Tolma] Defined TXT keys: None -# The Social Broadband Defined TXT keys: there is no TXT keys defined for this -# tsbiis tcp Interference Information [Sergio_Luis] [Sergio_Luis] 2012-02-27 protocol -# Sharing -# tt4inarow Trivial Technology's 4 in a [Nicolas_Payette] [Nicolas_Payette] Defined TXT keys: None -# Row -# ttcheckers Trivial Technology's [Nicolas_Payette] [Nicolas_Payette] Defined TXT keys: None -# Checkers -# ttp4daemon TechTool Pro 4 Anti-Piracy [Micromat] [Micromat] Defined TXT keys: None -# Service -# tunage Tunage Media Control Service [Matt_Patenaude] [Matt_Patenaude] Defined TXT keys: None -# tuneranger TuneRanger [Acertant] [Acertant] Defined TXT keys: None -# twinlevel tcp detect sanitary product [Oblamatik_AG] [Simon_Ensslen] 2012-09-05 Defined TXT keys: None -# TZ-Software remote procedure -# tzrpc tcp call based synchronization [Thomas_Zwick] [Thomas_Zwick] 2011-10-12 Defined TXT keys: Proprietary -# protocol -# ubertragen Ubertragen [Widgetschmie_de] [Widgetschmie_de] Defined TXT keys: None -# uddi Universal Description, [Paul_Denning] [Paul_Denning] Defined TXT keys: TBD -# Discovery and Integration -# Universal Description, -# uddi-inq Discovery and Integration [Paul_Denning] [Paul_Denning] Defined TXT keys: TBD -# Inquiry -# Universal Description, -# uddi-pub Discovery and Integration [Paul_Denning] [Paul_Denning] Defined TXT keys: TBD -# Publishing -# Universal Description, -# uddi-sub Discovery and Integration [Paul_Denning] [Paul_Denning] Defined TXT keys: TBD -# Subscription -# Universal Description, -# uddi-sec Discovery and Integration [Paul_Denning] [Paul_Denning] Defined TXT keys: TBD -# Security -# upnp Universal Plug and Play [Andrew_Donoho] [Andrew_Donoho] Defined TXT keys: None -# urlbookmark URL Advertising [Sven_S_Porst] [Sven_S_Porst] Defined TXT keys: URL=, name= -# uswi Universal Switching [Roger_Lemberg] [Roger_Lemberg] Defined TXT keys: None -# Corporation products -# utest uTest [Gregory_Power] [Gregory_Power] Defined TXT keys: None -# uwsgi Unbit Web Server Gateway [Roberto_De_Ioris] [Roberto_De_Ioris] Defined TXT keys: None -# Interface -# ve-decoder American Dynamics VideoEdge [Gary_Sands] [Gary_Sands] Defined TXT keys: txtvers, macaddress, protovers, model, -# Decoder Control Service serial, path, idp -# ve-encoder American Dynamics VideoEdge [Gary_Sands] [Gary_Sands] Defined TXT keys: txtvers, macaddress, protovers, model, -# Encoder Control Service serial, path, idp -# ve-recorder American Dynamics VideoEdge [Gary_Sands] [Gary_Sands] Defined TXT keys: txtvers, macaddress, protovers, model, -# Recorder Control Service serial, path, idp -# vedabase tcp Application specific [Peter_Kollath_2] [Peter_Kollath_2] 2014-05-27 Defined TXT keys: txtvers=1 -# synchronization protocol -# vhusb tcp USB over IP Sharing System [VirtualHere_Pty_Ltd] [Michael_Broadfoot] 2015-04-02 Defined TXT keys: -# virtualdj VirtualDJ Remote Control [Atomix_Productions] [Stephane_Clavel] 2011-10-12 Defined TXT keys: None -# protocol -# Defined TXT keys: Version= Type= Name= Zone= ID= -# SString= SString1= -# Virtual Object System (using Defined TXT keys: url= -# vos VOP/TCP) [Reed_Hedges][Peter_Amstutz] [Reed_Hedges][Peter_Amstutz] type= title= descr= -# vue4rendercow VueProRenderCow Defined TXT keys: None -# vxi-11 VXI-11 TCP/IP Instrument [Nick_Barendt_2] [Nick_Barendt_2] Defined TXT keys: None -# Protocol -# wakeywakey tcp Proprietary [gerry_Brown_associates] [Gerry_Brown] 2012-11-29 Defined TXT keys: None -# walkietalkie Walkie Talkie [Johan_Kool] [Johan_Kool] Defined TXT keys: None -# wd-2go tcp NAS Service Protocol [Western_Digital] [Rajesh_Batra] 2012-07-11 Defined TXT keys: None -# we-jell Proprietary collaborative [Vaughn_Amann] [Vaughn_Amann] Defined TXT keys: user= stat= agent= -# World Wide Web Distributed -# webdav Authoring and Versioning [Y_Y_Goland] [Y_Y_Goland] Defined TXT keys: u= p= path= -# (WebDAV) -# webdavs WebDAV over SSL/TLS [Y_Y_Goland] [Y_Y_Goland] Defined TXT keys: u= p= path= -# webissync WebIS Sync Protocol [Alex_Kac] [Alex_Kac] Defined TXT keys: None -# wedraw weDraw document sharing [Oleksandr_Zakharchuk] [Oleksandr_Zakharchuk] Defined TXT keys: None -# protocol -# whamb Whamb [Whamb] [Whamb] Defined TXT keys: None -# whistler Honeywell Video Systems [Shankar_Prasad_2] [Shankar_Prasad_2] Defined TXT keys: None -# wicop udp WiFi Control Platform [Santorini_LLC] [Cameron_Colpitts] 2011-10-25 Defined TXT keys: state= loc= -# witap WiTap Sample Game Protocol [Rory_McGuire_2] [Rory_McGuire_2] Defined TXT keys: None -# witapvoice witapvoice [Roberto_Garcia] [Roberto_Garcia] Defined TXT keys: None -# wkgrpsvr Workgroup Server Discovery [Forest_Hill] [Forest_Hill] Defined TXT keys: None -# workstation Workgroup Manager [Kevin_Arnold] [Kevin_Arnold] Defined TXT keys: None -# wormhole Roku Cascade Wormhole [Don_Woodward] [Don_Woodward] Defined TXT keys: txtvers=1 -# Protocol -# workgroup Novell collaboration [Brady_Anderson] [Brady_Anderson] Defined TXT keys: version=? description=? -# workgroup -# writietalkie Writie Talkie Data Sharing [Yin_Ki_Lau] [Yin_Ki_Lau] Defined TXT keys: None -# ws Web Services [Andrew_Donoho] [Andrew_Donoho] Defined TXT keys: None -# wtc-heleos Wyatt Technology Corporation [Brent_Fulgham] [Brent_Fulgham] Defined TXT keys: None -# HELEOS -# wtc-qels Wyatt Technology Corporation [Brent_Fulgham] [Brent_Fulgham] Defined TXT keys: None -# QELS -# wtc-rex Wyatt Technology Corporation [Roy_Reapor] [Roy_Reapor] Defined TXT keys: None -# Optilab rEX -# wtc-viscostar Wyatt Technology Corporation [Roy_Reapor] [Roy_Reapor] Defined TXT keys: None -# ViscoStar -# wtc-wpr Wyatt Technology Corporation [Brent_Fulgham] [Brent_Fulgham] Defined TXT keys: None -# DynaPro Plate Reader -# wwdcpic PictureSharing sample code [Marc_Krochmal] [Marc_Krochmal] Defined TXT keys: None -# x-on x-on services [Matthias_Burghardt] [Matthias_Burghardt] Defined TXT keys: Proprietary -# synchronisation protocol -# x-plane9 udp x-plane9 [Austin_Meyer] [Austin_Meyer] Defined TXT keys: None -# xcodedistcc Xcode Distributed Compiler [Scott_Tooker] [Scott_Tooker] Defined TXT keys: None -# xential tcp xential document creation [Xential] [Michiel_Terpstra] 2013-11-13 Defined TXT keys: None -# services -# xgate-rmi xGate Remote Management [Tim_Jobling] [Tim_Jobling] Defined TXT keys: tech=value (string) model=value (string) -# Interface version=value (string) -# xmiserver tcp XMI Systems home terminal [XMI_Systems_SA] [CLAUDE_MALLY] 2013-01-18 Defined TXT keys: coucou -# local connection -# xmp Xperientia Mobile Protocol [Henric_Bergh] [Henric_Bergh] 2007-01 Defined TXT keys: txtvers, user, system, nodeid, desc -# xsanclient Xsan Client [Jeff_Albouze] [Jeff_Albouze] Defined TXT keys: None -# xsanserver Xsan Server [Jeff_Albouze] [Jeff_Albouze] Defined TXT keys: None -# xsansystem Xsan System [Jeff_Albouze] [Jeff_Albouze] Defined TXT keys: None -# xtimelicence xTime License [AppMac_Software] [AppMac_Software] Defined TXT keys: None -# xtshapro xTime Project [AppMac_Software] [AppMac_Software] Defined TXT keys: None -# XUL (XML User Interface Defined TXT keys: u= p= path= (Same as for _http._tcp) -# HTTP -# yakumo udp Yakumo iPhone OS Device [Daniel_Heffernan] [Daniel_Heffernan] Defined TXT keys: None -# Control Protocol -# z-wave tcp Z-Wave Service Discovery [Sigma_Designs_Inc] [Anders_Brandt_2] 2011-10-03 Defined TXT keys: NIF, EP, LM -# z-wave udp Z-Wave Service Discovery [Sigma_Designs_Inc] [Anders_Brandt_2] 2011-10-03 Defined TXT keys: NIF, EP, LM -# zeromq tcp High performance brokerless [Daniel_Holth] [Daniel_Holth] 2012-04-24 Defined TXT keys: type, app, label, note -# messaging -# zeromq udp High performance brokerless [Daniel_Holth] [Daniel_Holth] 2012-04-24 Defined TXT keys: type, app, label, note -# messaging -# zigbee-bridge tcp ZigBee Bridge device [ZigBee_Alliances_Network_Device_working_group] [Leslie_Mulder] 2013-05-28 Defined TXT keys: see: -# http://www.zigbee.org/Standards/ZigBeeNetworkDevices -# zigbee-bridge udp ZigBee Bridge device [ZigBee_Alliances_Network_Device_working_group] [Leslie_Mulder] 2013-05-28 Defined TXT keys: see: -# http://www.zigbee.org/Standards/ZigBeeNetworkDevices -# zigbee-gateway tcp ZigBee IP Gateway [ZigBee_Alliances_Network_Device_working_group] [Leslie_Mulder] 2013-05-28 Defined TXT keys: see: -# http://www.zigbee.org/Standards/ZigBeeNetworkDevices -# zigbee-gateway udp ZigBee IP Gateway [ZigBee_Alliances_Network_Device_working_group] [Leslie_Mulder] 2013-05-28 Defined TXT keys: see: -# http://www.zigbee.org/Standards/ZigBeeNetworkDevices -# -# People -# -# ID Name Organization Contact URI Last -# Updated -# [Actifio] Actifio mailto:madhav.mutalik&actifio.com 2015-10-23 -# [AMTEC_S_p_A] AMTEC S.p.A mailto:sp.amtec&interbusiness.it -# [APCO_Project] Steve Glass APCO Project 25 mailto:admin&sedition.org.au 2011-05-13 -# [ARTIS_Software] ARTIS Software mailto:contact&artissoftware.com -# [ASDIS_Support] ASDIS Support mailto:support&asdis.de 2005-08 -# [A_Blake_Cooper] A. Blake Cooper mailto:blake&cluebie.net 2003-06 -# [A_Boninn] A. Boninn mailto:aboninn&hotmail.com -# [A_P_Hobson] A.P. Hobson mailto:A.P.Hobson&bra0112.wins.icl.co.uk -# [Aaron_Ballman] Aaron Ballman mailto:aaron&realsoftware.com 2004-11 -# [Aaron_Bilbrey] Aaron Bilbrey mailto:abilbrey&commvault.com -# [Aaron_Brick] Aaron Brick mailto:aa&lithic.org -# [Aaron_Fracht_Monroe] Aaron Fracht-Monroe mailto:afracht-monroe&amcomsoft.com 2010-06-03 -# [Aaron_Kleinsteiber] Aaron Kleinsteiber mailto:protocol&limnerapp.com 2014-01-16 -# [Aaron_L_Bratcher] Aaron L. Bratcher mailto:aaronlbratcher&yahoo.com 2011-10-17 -# [Aaron_Lav] Aaron Lav mailto:aaron&taltrade.com -# [Aaron_Myer] Aaron Myer mailto:aaron.myer&in2nets.com 2004-06 -# [Aaron_S_Kurland] Aaron S. Kurland mailto:akurland&netsilicon.com -# [Aaron_Stein] Aaron Stein mailto:aaron.stein&ca.com -# [Abdullah_Obeid] Abdullah Obeid mailto:a.obeid&contamac.nl 2008-03-20 -# [Abel_Chou] Abel Chou mailto:abel&willy.esl.com -# [Abhay_Rajaram] Abhay Rajaram mailto:Abhay_Rajaram&3com.com 2003-03 -# [Abhijit_Kumar] Abhijit Kumar mailto:as-iana-ports&sun.com 2005-11 -# [AccuMed_Services] AccuMed Services mailto:scarleton&accu-med.com 2011-10-20 -# [Acertant] Acertant -# Technologies, Inc. -# [AD_Holdings] AD Holdings mailto:klawson&ad-holdings.co.uk 2011-10-11 -# [Adam_Armstrong] Adam Armstrong Observium mailto:adama&observium.org 2013-05-10 -# [Adam_Berk] Adam Berk mailto:aberk&empirix.com -# [Adam_Curtin] Adam Curtin mailto:adam.curtin&isysg.com -# [Adam_Ernst] Adam Ernst mailto:cosmicsoft&cosmicsoft.net 2004-12 -# [Adam_Ernst_2] Adam Ernst mailto:contact&cosmicsoft.net 2002-06 -# [Adam_Gawne_Cain] Adam Gawne-Cain mailto:adam&gawncainresearch.co.uk 2003-11 -# [Adam_Golovenko] Adam Golovenko mailto:golovenko&gmail.com 2006-10 -# [Adam_Kerrison] Adam Kerrison mailto:adamµmuse.co.uk -# [Adam_Maxwell] Adam Maxwell mailto:amaxwell&mac.com -# [Adam_Robinson] Adam Robinson Data Access, Inc. mailto:adam&dataaccessinc.com 2012-04-30 -# [Adan_Munoz] Adan Muñoz MUNDO READER SL mailto:adan.munoz&bq.com 2014-09-05 -# [AddressBookServer] AddressBookServer.com mailto:iana&addressbookserver.com 2011-10-18 -# [Adi_Ruppin] Adi Ruppin mailto:adi.ruppin&data-pod.com 2005-08 -# [Administrator] Administrator mailto:admin&ipcore.co.za 2005-12 -# [Adobe_Systems] Adobe Systems Inc. mailto:mikeharr&adobe.com 2012-04-17 -# [Adrian_Hornby] Adrian Hornby mailto:Adrian.Hornby&aran.co.uk -# [Adrian_Hungate] Adrian Hungate mailto:adrian&tlspu.com 2014-07-11 -# [Adrian_Mancini] Adrian Mancini mailto:adrian.mancini&entrust.com -# [Adrian_Pell] Adrian Pell mailto:PELL_ADRIAN/HP-UnitedKingdom_om6@hplb.hpl.hp.com -# [Adrian_Popescu] Adrian Popescu mailto:Adrian_Popescu&groove.net 2002-09 -# [Adrien_de_Croy] Adrien de Croy mailto:adrien&qbik.com -# [Adwait_Sathe] Adwait Sathe mailto:asathe&sonusnet.com 2005-08 -# [Aerohive_Networks] Aerohive Networks mailto:iana&aerohive.com 2012-06-04 -# [Afkham_Azeez] Afkham Azeez mailto:azeez&wso2.com 2006-06 -# [Afshin_Jafari] Afshin Jafari iConstruct (Aus) Pty mailto:jafari&pdcwa.com.au 2012-12-21 -# Ltd -# [Agilent_Technologies_Inc] Agilent Technologies, mailto:tom_fay&agilent.com 2013-01-16 -# Inc. -# [Agri_Datalog] Agri Datalog mailto:contact&agri-datalog.com -# [Ahmad_Tajuddin_Samsu] Ahmad Tajuddin Samsudin mailto:tajuddin&tmrnd.com.my 2007-02 -# [Ahti_Heinla] Ahti Heinla mailto:ahti&ahti.bluemoon.ee 2002-06 -# [Aivi_Lie] Aivi Lie mailto:LIEA&netsoft.com -# [Ajay_Jindal] Ajay Jindal mailto:ajayjµsoft.com -# [Ake_Hedman] Ake Hedman mailto:akhe&eurosource.se 2005-11 -# [Akira_Ide] Akira Ide mailto:ide.akira&jp.fujitsu.com 2006-09 -# [Akira_Saito] Akira Saito mailto:admin&kobu.com 2003-04 -# [Akiyoshi_Ochi] Akiyoshi Ochi mailto:akiyoshi&net.paso.fujitsu.co.jp -# [Al_Amet] Al Amet mailto:aamet&point-inc.com -# [Al_Guetzlaff] Al Guetzlaff mailto:aeg&teamquest.com -# [Alain_Durand] Alain Durand mailto:Alain.Durand&imag.fr -# [Alain_Robert] Alain Robert mailto:arobert&par.sita.int -# [Alain_Robert_2] Alain Robert mailto:Alain.Robert&hmrinc.com -# [Alan_Akahoshi] Alan Akahoshi mailto:alan-akahoshi&vertel.com -# [Alan_Bivens] Alan Bivens mailto:jbivens&us.ibm.com 2003-08 -# [Alan_Butt] Alan Butt mailto:alan.butt&landesk.com 2006-03 -# [Alan_Clifford] Alan Clifford mailto:alan&clifford.ac -# [Alan_Dano] Alan Dano mailto:wiseobject&yahoo.com -# [Alan_Francis] Alan Francis mailto:AlanF&zonal.co.uk 2002-05 -# [Alan_King] Alan King Enabling Technology mailto:aking&etdesigners.com 2009-08-13 -# Pty. Ltd. -# [Alan_Malik] Alan Malik mailto:alan&exasoft.co.uk 2003-11 -# [Alan_Minchew] Alan Minchew mailto:alan.minchew&hp.com 2011-05-23 -# [Alan_Noble] Alan Noble mailto:noble&netmind.com -# [Alan_Pickrell] Alan Pickrell mailto:alanp&goahead.com -# [Alan_Potter] Alan Potter mailto:potter&movies.enet.dec.com -# [Alan_Robertson] Alan Robertson mailto:alanr&unix.sh -# [Alan_Sandell] Alan Sandell mailto:alan.sandell&ist.co.uk 2008-05-01 -# [Alan_Ungar] Alan Ungar mailto:aungar&farradyne.com -# [Alan_Yates] Alan Yates mailto:alany&ay.com.au -# [Alanax_Technologies_Inc] Alanax Technologies, mailto:brian.barritt&alanax.com 2013-01-14 -# Inc -# [Albert_Berlovitch] Albert Berlovitch mailto:albertb&voltaire.com 2009-12-17 -# [Albert_C_Yang] Albert C. Yang mailto:albert.yang&ezmeeting.com 2002-03 -# [Albert_Cester] Albert Cester mailto:albert.cester&assyst-intl.com 2008-08-26 -# [Albert_G_Broscius] Albert G. Broscius mailto:broscius&dsl.cis.upenn.edu -# [Albert_Holt] Albert Holt mailto:alberth&triosoftware.com -# [Albert_Holt_2] Albert Holt mailto:alberth&fiorano.com -# [Albert_Hou] Albert Hou mailto:ahou1&bloomberg.com 2006-05 -# [Albert_Leung] Albert Leung mailto:aleung&biscom.com 2006-04 -# [Albert_Manfredi] Albert Manfredi mailto:manfredi&engr05.comsys.rockwell.com -# [Alberto_Berlen] Alberto Berlen mailto:aberlen&vnet.ibm.com -# [Alberto_Cerpa] Alberto Cerpa mailto:cerpa&isi.edu -# [Alberto_Fernandez] Alberto Fernandez mailto:af&xtec.com 2006-01 -# [Alberto_Ortega_Llama] Alberto Ortega Llamas mailto:alberto.kun666&gmail.com 2009-11-04 -# [Alberto_Raydan] Alberto Raydan mailto:alberto&altasol.com -# [Alberto_Raydan_2] Alberto Raydan mailto:raydan_a&socalia.com 2005-08 -# [Albrecht_Mayer] Albrecht Mayer mailto:albrecht.mayer&infineon.com 2002-05 -# [Alcorn_McBride_Inc] Alcorn McBride Inc. mailto:jeff&alcorn.com -# [Alec_Carlson] Alec Carlson mailto:acarlson&smithmicro.com 2003-01 -# [Alec_Muffett] Alec Muffett mailto:alecm&sun.com -# [Alejandro_Bonet] Alejandro Bonet mailto:babel&ctv.es -# [Alessandro_Bassi] Alessandro Bassi mailto:abassi&cs.utk.edu -# [Alessio_Casati] Alessio Casati mailto:a.casati&computer.org -# [Alex_Belliotti] Alex Belliotti Windward Code LLC mailto:alex&windwardcode.com 2013-11-27 -# [Alex_Chen] Alex Chen mailto:alex_chen&filemaker.com 2009-11-25 -# [Alex_Duncan] Alex Duncan mailto:alex.duncan&sse.ie -# [Alex_Duncan_2] Alex Duncan mailto:Alex.Duncan&sse.ie -# [Alex_Graveley] Alex Graveley mailto:alex&beatniksoftware.com -# [Alex_Kac] Alex Kac mailto:webis_sync_protocol&webis.net -# [Alex_Lelievre] Alex Lelievre mailto:alex&folabs.com 2009-08-18 -# [Alex_McDonald] Alex McDonald mailto:alexm&an.hp.com -# [Alex_Nicu] Alex Nicu mailto:alex.nicu&philips.com 2003-10 -# [Alex_Oberlander] Alex Oberlander mailto:alexo&netmount.com -# [Alex_Stoev] Alex Stoev Nine Technology, LLC mailto:astoev&ninetechnology.com 2011-08-01 -# [Alex_Tucker] Alex Tucker mailto:alex&floop.org.uk -# [Alex_Vasilevsky] Alex Vasilevsky mailto:alexv&204.165.216.115 -# [Alex_White] Alex White mailto:alex&intralan.co.uk 2007-09-12 -# [Alexander_Bogdanov] Alexander Bogdanov mailto:alexandr_bgd&softhome.net -# [Alexander_Bogdanov_2] Alexander Bogdanov mailto:alexander_bgd&softhome.net -# [Alexander_Christian] Alexander Christian mailto:alexander.christian&root1.de 2012-04-19 -# [Alexander_Dubrovsky] Alexander Dubrovsky mailto:dubrovsky_alex&emc.com -# [Alexander_Falk] Alexander Falk mailto:falk&icon.at -# [Alexander_Falk_2] Alexander Falk Altova, Inc. mailto:al&altova.com 2011-07-07 -# [Alexander_Graef] Alexander Graef mailto:alex&graef.cc 2004-11 -# [Alexander_Griekspoor] Alexander Griekspoor mailto:a.griekspoor&nki.nl 2003-07 -# [Alexander_Hartner] Alexander Hartner AddressBookServer.com mailto:dev&addressbookserver.com 2011-10-14 -# [Alexander_Konovalov] Alexander Konovalov mailto:konovalov&member.ams.org 2007-11-27 -# [Alexander_List] Alexander List mailto:alist&exomachina.com 2011-12-06 -# [Alexander_Medvinsky] Alexander Medvinsky mailto:smedvinsky&gi.com -# [Alexander_Philippou] Alexander Philippou mailto:alex&noemax.com 2003-10 -# [Alexander_Raji] Alexander Raji mailto:araji&lucent.com -# [Alexander_Sahler] Alexander Sahler mailto:alexander.sahler&brodos.de 2002-02 -# [Alexander_V_Ivanov] Alexander V. Ivanov mailto:support&aidaim.com 2004-12 -# [Alexandre_Carlhian] Alexandre Carlhian mailto:alex&appeule.com -# [Alexandre_Lechenne] Alexandre Lechenne mailto:alexandre.lechenne&selectron.ch 2008-12-10 -# [Alexei_V_Soloviev] Alexei V. Soloviev mailto:avsolov&lab127.karelia.ru 2002-05 -# [Alexei_Vladishev] Alexei Vladishev mailto:alexei.vladishev&zabbix.com 2006-02 -# [Alexey_Novotorzhin] Alexey Novotorzhin Amicon OOO mailto:nav&amicon.ru 2013-04-25 -# [Alexey_Vlaskin] Alexey Vlaskin mailto:avlaskin&visicron.com 2007-10-22 -# [Alexis_Bose] Alexis Bose mailto:abose&d-ta.com 2008-12-08 -# [Alfred_Schmidt] Alfred Schmidt mailto:a.schmidt&aft-werdohl.de 2003-11 -# [Ali_Fracyon] Ali Fracyon mailto:sxdev&modulardreams.com -# [Ali_Jelveh] Ali Jelveh mailto:ali&protonet.info -# [Ali_Saleh] Ali Saleh mailto:scomm&cerf.net -# [Alioune_Thiam] Alioune Thiam mailto:alioune_thiam&symantec.com 2013-02-05 -# [Allan_Miller] Allan Miller mailto:amiller&handsfreenetworks.com -# [Allan_Panitch] Allan Panitch mailto:allanp&tcosoft.com -# [Allan_Stanley] Allan Stanley mailto:allan&hummingbird.com -# [Allen_Baker] Allen Baker mailto:abaker&boi.hp.com -# [Allen_Briggs] Allen Briggs mailto:briggs&access.rrinc.com -# [Allen_Cronce] Allen Cronce PACE Anti-Piracy mailto:allen&paceap.com 2014-04-28 -# [Allen_Samuels] Allen Samuels mailto:allen.samuels&citrix.com 2006-11 -# [Allen_Wei] Allen Wei mailto:Allen_Wei&arborsoft.com -# [Allison_Carleton] Allison Carleton mailto:acarleto&naper1.napervilleil.ncr.com -# [Almira] Almira mailto:almira_niciu&intuit.com 2003-07 -# [Alois_Reisinger] Alois Reisinger European Fiscal mailto:alois.reisinger&efsta.org 2013-08-13 -# Standards Association -# [Alon_Kantor] Alon Kantor mailto:alonk&checkpoint.com -# [Alon_Tamir] Alon Tamir mailto:alon_tamir&symantec.com 2006-04 -# [ALPESH_DHAMELIA] ALPESH DHAMELIA MINDARRAY SYSTEMS (P) mailto:alpesh&mindarraysystems.com 2011-10-25 -# LTD. -# [Alstom_Transport_Preston] Alstom Transport, mailto:paul.steane&transport.alstom.com 2012-12-14 -# Preston -# [Altova] Altova mailto:has&altova.com 2005-08 -# [Alvaro_P_Dominguez] Alvaro P. Dominguez mailto:alpado&gmail.com 2006-02 -# [Alwin_Egger] Alwin Egger mailto:alwin.egger&tegonal.com 2003-11 -# [Aly_Orady] Aly Orady Atto Devices Inc. mailto:aly.orady&attodevices.com 2007-08-07 -# [Amahi] Amahi mailto:iana&amahi.org 2014-02-27 -# [Amanda] mailto:amanda-core&amanda.org -# [Amandeep_Jawa] Amandeep Jawa mailto:daap&apple.com 2003-01 -# [Amandeep_Jawa_2] Amandeep Jawa mailto:dpap&apple.com 2004-11 -# [Amandeep_Jawa_3] Amandeep Jawa mailto:daap&apple.com -# [Amatzia_Ben_Artzi] Amatzia Ben-Artzi -# [American_Power_Conve] American Power mailto:ports&apcc.com 2002-02 -# Conversion -# [Amicon_OOO] Amicon OOO mailto:info&amicon.ru 2013-04-25 -# [Amir_Blich] Amir Blich mailto:amir&netmanage.co.il -# [Amir_Herzberg] Amir Herzberg mailto:amirh&vnet.ibm.com -# [Amir_Peless] Amir Peless mailto:amirp&radware.co.il -# [Amir_Rapson] Amir Rapson mailto:rapson&sofaware.com 2002-02 -# [Amit_Nigam] Amit Nigam mailto:amnigam&cisco.com 2009-08-24 -# [Amitava_Dutta] Amitava Dutta mailto:Amitava.Dutta&woodbridgenj.ncr.com -# [Amnon_Horowitz] Amnon Horowitz mailto:amnonhµsoft.com -# [Amol_P_Tambe] Amol P Tambe mailto:amol_tambe&symantec.com 2011-02-02 -# [AMPL_Optimization] AMPL Optimization, mailto:dmg&l.com 2012-05-25 -# Inc. -# [Amy_Kang] Amy Kang mailto:amy.kang&sun.com 2009-03-10 -# [Amy_Weaver] Amy Weaver mailto:aweaver&vpnet.com -# [Amy_Weaver_2] Amy Weaver mailto:amy_weaver&nai.com -# [Amy_Weaver_3] Amy Weaver mailto:Amy_Weaver&nai.com -# [Anand_Bhalerao] Anand Bhalerao mailto:anand_bhalerao&symantec.com 2008-10-02 -# [Anand_Gangadharan] Anand Gangadharan mailto:anand&goa.mainsoft.com -# [Anastasios_Kotsikona] Anastasios Kotsikonas mailto:tasos&cs.bu.edu -# [Anders_Borg] Anders Borg mailto:anders.borg&solid.se 2004-11 -# [Anders_Brandt] Anders Brandt Sigma Designs, Inc. mailto:Anders_Brandt&sigmadesigns.com 2012-11-08 -# [Anders_Brandt_2] Anders Brandt Sigma Designs, Inc. mailto:anders_brandt&sigmadesigns.com 2011-10-03 -# [Anders_Brandt_3] Anders Brandt Sigma Designs mailto:anders_brandt&sigmadesigns.com 2012-10-12 -# [Anders_Brandt_4] Anders Brandt Sigma Designs mailto:anders_brandt&sigmadesigns.com 2015-06-26 -# [Anders_Hjelm] Anders Hjelm mailto:anders.hjelm&ec.se 2006-03 -# [Anders_Klemets] Anders Klemets mailto:andersklµsoft.com -# [Anders_Svensson] Anders Svensson mailto:pong&simusoft.dk -# [Andre_Cato] Andre Cato mailto:andre.cato&datacore.com 2003-07 -# [Andre_Kramer] Andre Kramer mailto:Andre.Kramer&ansa.co.uk -# [Andre_Petras] Andre Petras mailto:a.petras&arcor.de 2003-01 -# [Andre_Schroter] Andre Schroter mailto:A.Schroeter&chili-radiology.com -# [Andrea_Gazzaniga] Andrea Gazzaniga mailto:gazzaniga&funambol.com 2007-01 -# [Andrea_Lanza] Andrea Lanza mailto:andrea&andrealanza.eu 2014-02-21 -# [Andrea_Premoli] Andrea Premoli mailto:Andrea_maria.Premoli&icn.siemens.it 2003-01 -# [Andreas_Alptun] Andreas Alptun mailto:info&illusionlabs.se -# [Andreas_Bauer] Andreas Bauer mailto:bauer_andreas&emc.com -# [Andreas_Behr] Andreas Behr mailto:andreas.behr&kraemer-it.de -# [Andreas_Fehr] Andreas Fehr mailto:andreas&mrs.ch -# [Andreas_Foedrowitz] Andreas Foedrowitz mailto:andreas.foedrowitz&thomson.net 2008-06-18 -# [Andreas_Glocker] Andreas Glocker mailto:glocker&sirius.com -# [Andreas_Haas] Andreas Haas mailto:andreas.haas&sun.com 2006-08 -# [Andreas_Heidemann] Andreas Heidemann mailto:a.heidemann&ais-gmbh.de -# [Andreas_Junghans] Andreas Junghans mailto:cytv&lucid-cake.net -# [Andreas_Oesterhelt] Andreas Oesterhelt mailto:oes&privoxy.org 2002-06 -# [Andreas_Oman] Andreas Öman mailto:andreas&lonelycoder.com -# [Andreas_Roene] Andreas Roene mailto:support&home-online.de -# [Andreas_Schwarz] Andreas Schwarz mailto:andi&trancefield.de 2002-03 -# [Andreas_Schwarz_2] Andreas Schwarz mailto:andreas.schwarz&securepoint.de 2003-06 -# [Andreas_Spalenski] Andreas Spalenski mailto:andreas.spalenski&trsystems.de 2008-11-24 -# [Andreas_Terzis] Andreas Terzis mailto:terzis&cs.ucla.edu -# [Andreas_Varga] Andreas Varga mailto:sid&parsec.org -# [Andreas_Westermann] Andreas Westermann EEBus Initiative mailto:westermann&eebus.org 2014-11-10 -# [Andreas_Wetzel] Andreas Wetzel mailto:mickey&enforcer.cc 2002-09 -# [Andreas_Wurf] Andreas Wurf mailto:a.wurf&mediatools.de -# [Andrei_Litvinn] Andrei Litvinn mailto:support&asigra.com 2005-01 -# [Andrei_Vilkotski] Andrei Vilkotski mailto:andreiv&sgi.com 2003-06 -# [Andres_Seco_Hernande] Andres Seco Hernandez mailto:AndresSH&alamin.org -# [Andrew_Aksyonoff] Andrew Aksyonoff mailto:shodan&sphinxsearch.com 2009-10-20 -# [Andrew_Andrews] Andrew Andrews mailto:Andrew.Andrews&nsius.com 2011-09-01 -# [Andrew_Beekhof ] Andrew Beekhof mailto:andrew&beekhof.net 2013-03-15 -# [Andrew_Blyler] Andrew Blyler Barracuda Networks mailto:ablyler&barracuda.com 2013-04-05 -# [Andrew_Borisov] Andrew Borisov mailto:hdr&chat.ru -# [Andrew_Chernow] Andrew Chernow mailto:andrew&esilo.com 2007-01 -# [Andrew_Crockford] Andrew Crockford mailto:andrew.crockford&modus-interactive.co.uk -# [Andrew_Donoho] Andrew Donoho mailto:awd&us.ibm.com -# [Andrew_Draper] Andrew Draper mailto:adraper&altera.com -# [Andrew_Galloway] Andrew Galloway Nexenta mailto:andrew.galloway&nexenta.com 2012-12-07 -# [Andrew_H_Derbyshire] Andrew H Derbyshire mailto:ahd&meetingmaker.plus.kew.com 2004-12 -# [Andrew_Hoddinott] Andrew Hoddinott mailto:support&artvps.com -# [Andrew_Jay_Schneider] Andrew Jay Schneider mailto:ajs&relsoft.com -# [Andrew_Johnson] Andrew Johnson mailto:andrew.johnson&bliss-support.demon.co.uk -# [Andrew_Mather] Andrew Mather mailto:info&balaena.com 2008-02-14 -# [Andrew_Morgan] Andrew Morgan mailto:andrew.morgan&sun.com 2009-12-08 -# [Andrew_Mossberg] Andrew Mossberg mailto:amossberg&asoki.net -# [Andrew_Porrer] Andrew Porrer Heathwest Systems mailto:Andrew.Porrer&heathwest.com 2013-03-21 -# Limited -# [Andrew_Schultz] Andrew Schultz mailto:aschultz&strykercom.com 2003-08 -# [Andrew_Sharpe] Andrew Sharpe mailto:help&smartsims.com -# [Andrew_Shire] Andrew Shire mailto:sndrewsh&sco.com -# [Andrew_Sinclair] Andrew Sinclair mailto:andrsinµsoft.com -# [Andrew_Stone] Andrew Stone mailto:andrew&stone.com -# [Andrew_Thurber] Andrew Thurber Cisco mailto:anthurbe@cisco.com> 2014-01-21 -# [Andrew_Tridgell] Andrew Tridgell mailto:tridge&samba.anu.edu.au -# [Andrew_Tune] Andrew Tune mailto:Andrew.Tune&splitlock.com 2003-01 -# [Andrew_Watson] Andrew Watson mailto:andrew&omg.org -# [Andrew_Zamler_Carhar] Andrew Zamler-Carhart mailto:andrew&zamler-carhart.com -# [Andrew_Zimmerman] Andrew Zimmerman mailto:andrew&zimmerman.net 2004-06 -# [Andrey_Mohov] Andrey Mohov mailto:mohov_andrey&mail.ru 2010-08-17 -# [Andriy_Skop] Andriy Skop Eleks, Ltd. mailto:andriy.skop&eleks.com 2013-04-08 -# [AndySC] AndySC mailto:AndySC&uk.ibm.com -# [Andy_Belk] Andy Belk mailto:abelk&apple.com -# [Andy_Belk_2] Andy Belk mailto:register1&azulsystems.com 2005-02 -# [Andy_Brewerton] Andy Brewerton mailto:andy.brewerton&otium.co.uk 2005-08 -# [Andy_Bruce] Andy Bruce mailto:franklin_yah&yahoo.com -# [Andy_Buckingham] Andy Buckingham mailto:feedback&radiodns.org -# [Andy_Burgess] Andy Burgess mailto:aab&cichlid.com -# [Andy_Crick] Andy Crick mailto:acrick&haascnc.com 2007-11-13 -# [Andy_Georgiou] Andy Georgiou mailto:ageorgiou&crypto-solutions.co.uk -# [Andy_Grover] Andy Grover mailto:andy.grover&oracle.com 2009-05-20 -# [Andy_Heron] Andy Heron mailto:btexact.ports&bt.com -# [Andy_Krouwel] Andy Krouwel mailto:andy&kar2ouche.com -# [Andy_McKeen] Andy McKeen mailto:mckeen&osf.org -# [Andy_O_Meara] Andy O'Meara mailto:andy&soundspectrum.com -# [Andy_Perreault] Andy Perreault mailto:aperreault&erlphase.com 2010-03-31 -# [Andy_Savage] Andy Savage mailto:andy.savage1&gmail.com 2012-07-13 -# [Andy_Shellam] Andy Shellam mailto:andy&networkmail.eu 2008-02-19 -# [Andy_Stanford_Clark] Andy Stanford-Clark mailto:andysc&uk.ibm.com -# [Andy_Valencia] Andy Valencia mailto:vandys&vandys-lap.cisco.com -# [Andy_Warner] Andy Warner mailto:andyw&knoware.nl -# [Angelique_Dokos] Angelique Dokos mailto:angelique.dokos&hp.com 2003-11 -# [Angelo_Masci] Angelo Masci mailto:angelomasci&yahoo.co.uk 2007-01 -# [Angie_S_Morner] Angie S. Morner mailto:webmaster&dsbcpas.com -# [Anil_Lakhwara] Anil Lakhwara mailto:anil_lakhwara&kentrox.com -# [Anil_Sharma] Anil Sharma mailto:anil.sharma&scentric.com 2006-04 -# [Anil_Tyagi] Anil Tyagi mailto:tanil&novell.com 2010-06-11 -# [Anirban_Majumder] Anirban Majumder mailto:majumderanirban&lycos.com 2002-03 -# [Anjana_Iyer] Anjana Iyer mailto:anjana&dyna.com -# [Ann_Huang] Ann Huang mailto:annhuang&apple.com -# [Annette_DeSchon] Annette DeSchon mailto:DESCHON&isi.edu -# [Annette_Klecha] Annette Klecha mailto:annette_klecha&bbn.hp.com -# [Anoop_Tewari] Anoop Tewari mailto:anoop&next.distinct.com -# [Ansgar_Bergmann] Ansgar Bergmann mailto:Ansgar.Bergmann&etsi.fr -# [ANT_Software] ANT Software Limited mailto:simon.middleton&antplc.com 2012-12-06 -# [Anthon_van_der_Neut] Anthon van der Neut mailto:anthon&mnt.org -# [Anthony_Cake] Anthony Cake mailto:anthonyrc&lecroy.com -# [Anthony_Carrabino] Anthony Carrabino mailto:anthonyc&vistasoftware.com 2003-08 -# [Anthony_Gonzalez] Anthony Gonzalez mailto:agonzal1&telcordia.com -# [Anthony_Greatorex] Anthony Greatorex mailto:greatore&ugs.com 2004-11 -# [Anthony_Johnson] Anthony Johnson mailto:stxadmin&storix.com 2005-08 -# [Anthony_Johnson_2] Anthony Johnson Janstor Technology mailto:jtadmin&janstor.com 2015-06-08 -# [Anthony_LaMark] Anthony LaMark Squadra Technologies mailto:anthony&squadratechnologies.com 2012-03-14 -# [Anthony_Payne] Anthony Payne mailto:opayne&pacbell.net 2004-02 -# [Anthony_Stahler] Anthony Stahler mailto:imunfair&yahoo.com 2004-11 -# [Anthony_Walker] Anthony Walker mailto:anthony_walker&hp.com 2002-03 -# [Anthony_Williams] Anthony Williams mailto:tonydubs&gmail.com -# [Antoine_Martin] Antoine Martin mailto:antoine&nagafix.co.uk -# [Anton_Kucer] Anton Kucer mailto:akucerµsoft.com -# [Anton_Okmianski] Anton Okmianski mailto:aokmians&cisco.com 2006-01 -# [Antoni_Wolski] Antoni Wolski mailto:antoni.wolski&vtt.fi -# [Antonio_Querubin] Antonio Querubin mailto:tony&lava.net 2008-03-10 -# [Anupam_Bharali] Anupam Bharali mailto:ianaports&juniper.net 2002-08 -# [Anush_Kumar] Anush Kumar mailto:anushkµsoft.com -# [Apple] Apple mailto:vaughan&apple.com 2011-10-12 -# [Apple_2] Apple mailto:justin.ko&apple.com 2011-10-20 -# [Apple_Inc] Apple Inc. mailto:marc&apple.com 2012-03-02 -# [Apple_Inc_2] Apple Inc. mailto:bradley&apple.com 2012-09-19 -# [Apple_Inc_3] Apple Inc. mailto:kazu&apple.com 2015-09-29 -# [Applied_Expert_Systems_Inc] Applied Expert mailto:davec&aesclever.com 2014-12-03 -# Systems, Inc. -# [AppMac_Software] AppMac Software mailto:appmac&appmac.com -# [Apple_Computer] Apple Computer mailto:perftools-feedback&group.apple.com -# [Apsolab_Inc] Apsolab Inc. mailto:admin&apsolab.com 2014-11-10 -# [Archishmat_Gore] Archishmat Gore mailto:archisgore&yahoo.com 2004-11 -# [Arcturus_Networks_Inc] Arcturus Networks mailto:mdurrant&arcturusnetworks.com 2011-10-20 -# Inc. -# [Argus_Spectr] Argus-Spectr mailto:mail&argus-spectr.ru 2013-10-25 -# [Around_Sound] Winzig LLC mailto:aroundsound&winzig.com 2011-10-20 -# [Ari_Huisken] Ariën Huisken mailto:astergate&huisken-systems.nl 2010-01-04 -# [Ari_Keranen] Ari Keränen mailto:ari.keranen&ericsson.com 2009-12-17 -# [Ari_Valtanen] Ari Valtanen mailto:ari.valtanen&solidtech.com -# [Arjen_Lentz] Arjen Lentz mailto:arjen&mysql.com 2004-11 -# [Arman_Bedonian] Arman Bedonian mailto:Arman.Bedonian&asg.com 2009-07-15 -# [Armin_Liebchen] Armin Liebchen mailto:armin&anteradesign.com 2007-06 -# [Armin_Sawusch] Armin Sawusch mailto:armin&esd1.esd.de -# [Armin_Solies] Armin Solies DEIF A/S mailto:aes&deif.com 2012-10-15 -# [Arnaud_Clermonte] Arnaud Clermonte mailto:clermonte&4xtechnologies.com -# [Arne_Dirks] Arne Dirks mailto:ad&bnc.net -# [Arne_Haugland] Arne Haugland mailto:Arne.Haugland¶soldev.com -# [Arne_Norefors] Arne Norefors mailto:Arne.Norefors&ericsson.com -# [Arnie_Farrelly] Arnie Farrelly mailto:afarrelly&syncsort.com -# [Arnie_Koster] Arnie Koster mailto:akoster&teltone.com 2002-04 -# [Arno_Hollosi] Arno Hollosi mailto:arno.hollosi&cio.gv.at 2002-03 -# [Arno_Kirmeir] Arno Kirmeir mailto:Arno.kirmeir&sage.de 2007-01 -# [Arno_Klaassen] Arno Klaassen mailto:arno&ccr.jussieu.fr 2003-11 -# [Arno_Odermatt] Arno Odermatt Schindler Aufzuege ag mailto:arno.odermatt&ch.schindler.com 2015-04-30 -# [Arnold_Dittmann] Arnold Dittmann mailto:dittmann&isbcad.de -# [Arnold_E_Mauer] Arnold E. Mauer mailto:amauer&vrms.com 2003-04 -# [Arrow_Bit_SL] Arrow Bit SL mailto:info&arrowbit.com 2012-04-26 -# [Art_Cancro] Art Cancro mailto:ajc&citadel.org 2015-02-18 -# [Art_Pope] Art Pope mailto:apope&sarnoff.com 2002-10 -# [Arthur_Barr] Arthur Barr mailto:arthur.barr&uk.ibm.com 2008-02-27 -# [Arthur_Castonguay] Arthur Castonguay mailto:arthurc&doe.carleton.ca -# [Arthur_Hillenaar] Arthur Hillenaar mailto:arthur.hillenaar&consul.com 2006-01 -# [Arthur_Wilton] Arthur Wilton mailto:art&awilton.com 2006-03 -# [Arvel_Hathcock] Arvel Hathcock mailto:arvel&altn.com 2007-03 -# [Arvin_Schnell] Arvin Schnell mailto:arvin&suse.de -# [Arvind_Srinivasan] Arvind Srinivasan mailto:arvind.srinivasan&sun.com 2005-08 -# [Asaf_Kashi] Asaf Kashi mailto:asafkµsoft.com -# [Ascom_Austria_GmbH] Ascom Austria GmbH mailto:info&ascom.at 2008-05-01 -# [Asher_Altman] Asher Altman mailto:Asher.Altman&gsc.gte.com -# [Ashish_Chatterjee] Ashish Chatterjee mailto:achatterjee&freeway.proxy.lucent.com -# [Ashit_Patel] Ashit Patel mailto:Ashit.Patel&eng.sun.com -# [Ashley_Butterworth] Ashley Butterworth mailto:abutterworth&apple.com 2014-03-07 -# [Ashley_Clarke] Ashley Clarke mailto:Ashley.clarke&vishaypg.com 2010-06-17 -# [Ashok_Marwaha] Ashok Marwaha -# [Ashraf_Tahir] Ashraf Tahir Morega Systems Inc. mailto:atahir&morega.com 2012-08-20 -# [Ashvin_Sanghvi] Ashvin Sanghvi mailto:AshvinSµsoft.com -# [Ashwani_Singhal] Ashwani Singhal mailto:Ashwani.Singhal&netscout.com 2010-04-07 -# [Atomix_Productions] Atomix Productions mailto:corporate&atomixproductions.com 2011-10-12 -# [Atsushi_Nakamura] Atsushi Nakamura mailto:nakamura.atsushi318&canon.co.jp 2003-11 -# [ATT] AT&T mailto:ds978v&att.com 2014-08-21 -# [Attero_Tech_LLC] Attero Tech LLC mailto:it.dept&atterotech.com 2015-09-24 -# [Aubrey_Turner] Aubrey Turner mailto:S95525ta%25etsuacad.bitnet@ETSUADMN.ETSU.EDU -# [Audirvana_SCS] Audirvana SCS mailto:contact&audirvana.com 2015-07-21 -# [Austin_Meyer] Austin Meyer mailto:austin&x-plane.com -# [Autodesk] Autodesk mailto:me.licensing&autodesk.com -# [AVG_Technologies_Norway_AS] AVG Technologies mailto:kristian.bognaes&avg.com 2015-05-20 -# Norway AS -# [Avi_Drissman] Avi Drissman mailto:ique-protocol&harrisbaseview.com 2002-07 -# [Avi_Lior] Avi Lior mailto:avi&bridgewatersystems.com 2009-02-27 -# [Avi_Nathan] Avi Nathan mailto:avinµsoft.com -# [Avi_Primo] Avi Primo mailto:aprimo&celltick.com 2008-01-29 -# [Avi_Software] Avi Software mailto:srobert&logava.com -# [AVI_Systems] AVI Systems mailto:dave.hatz&avisystems.com 2015-09-18 -# [Avri_Doria] Avri Doria mailto:avri.doria&nokia.com -# [Avshalom_Houri] Avshalom Houri mailto:Avshalom&ubique.com -# [Axel_Andersson] Axel Andersson mailto:axel&zankasoftware.com 2006-02 -# [Axel_Kern] Axel Kern mailto:axel.kern&betasystems.com -# [BTicino_S_p_A] BTicino S.p.A. mailto:admin-myopen&myopen-bticino.it 2008-04-09 -# [B_Clifford_Neuman] B. Clifford Neuman mailto:bcn&isi.edu -# [B_G_Mahesh] B.G. Mahesh mailto:mahesh&sett.com -# [B_J_Kortekaas] B. J. Kortekaas mailto:b.j.kortekaas&kpn.com 2003-02 -# [B_van_Klinken] B. van Klinken mailto:b.vklinken&rohill.nl 2003-12 -# [Baba_Hidekazu] Baba Hidekazu mailto:baba&flare.nd.net.fujitsu.co.jp -# [Baiju_V_Patel] Baiju V. Patel mailto:Baiju.v.patel&intel.com -# [Balduin_Mueller_Plat] Balduin Mueller-Platz mailto:balduin.mueller-platz&pago.de 2002-03 -# [Barbara_Foss] Barbara Foss mailto:BGFOSS&rchvmv.vnet.ibm.com -# [Barend_Jacobus_van_d] Barend Jacobus van der mailto:berneau.v&gmail.com 2010-04-27 -# Merwe -# [Barney_Wolff] Barney Wolff mailto:barney&databus.com -# [Barracuda_Networks] Barracuda Networks mailto:BackupEngineering_Team&barracuda.com 2013-04-05 -# [Barrie_Cooper] Barrie Cooper mailto:barrie&sco.com -# [Barry_Greenberg] Barry Greenberg mailto:barry.greenberg&sun.com 2004-04 -# [Barry_H_Feild] Barry H. Feild mailto:barry&intersan.net -# [Barry_McDarby] Barry McDarby mailto:realspace&starwolf.biz 2003-04 -# [Barry_Shelton] Barry Shelton mailto:bshelton&wirelessknowledge.com -# [Barry_Whyte] Barry Whyte mailto:barry_whyte&uk.ibm.com -# [Bart_Rijpers] Bart Rijpers Mogeneti mailto:bart&mogeneti.com 2012-09-26 -# [Bart_Schaefer] Bart Schaefer mailto:bart&suburbansoftware.com 2005-08 -# [Basil_Lee] Basil Lee mailto:basil.lee&gnnettest.com -# [Baskaran_Subramaniam] Baskaran Subramaniam mailto:baskaran&apple.com -# [Beats_Electronics_LLC] Beats Electronics mailto:eddie&beatsbydre.com 2013-06-03 -# LLC. -# [Beats_Electronics_LLC_2] Beats Electronics mailto:yunho.huh&beatsbydre.com 2014-06-27 -# LLC. -# [Ben] Ben mailto:ben&acaciatreesoftware.com -# [Ben_Darnell] mailto:ben&cockroachlabs.com 2015-09-29 -# [Ben_Guild] Ben Guild mailto:smash&smashsworld.com -# [Ben_Higgins] Ben Higgins mailto:bhiggins&netcom.ca -# [Ben_Lewis] Ben Lewis mailto:apple&method-solutions.com -# [Ben_McNeill] Ben McNeill mailto:ben.mcneill&cinexec.com 2007-05 -# [Ben_Oram] Ben Oram mailto:beno&turbopower.com -# [Ben_Pracht] Ben Pracht mailto:ben.pracht&tivoli.com -# [Ben_Rosenberg] Ben Rosenberg mailto:brosenberg&advsyscon.com 2003-01 -# [Ben_Schluricke] Ben Schluricke mailto:support&pftp.de -# [Ben_Webster] Ben Webster mailto:b.webster&itisint.com -# [Bender_GmbH_Co_KG] Bender GmbH & Co. KG mailto:rnd&bender-de.com 2013-10-15 -# [Bengt_Gustafsson] Bengt Gustafsson mailto:bengt.gustafsson&imagesystems.se 2006-05 -# [Benjamin_Green] Benjamin Green mailto:ben&lh.co.nz -# [Benjamin_Grimm] Benjamin Grimm mailto:bg&webnetix.de -# [Benjamin_Kowarsch] Benjamin Kowarsch mailto:benjamin&sunrise-tel.com 2004-11 -# [Benjamin_Rister] Benjamin Rister mailto:support&decimus.net -# [Benjamin_Rosenberg] Benjamin Rosenberg mailto:brosenberg&advsyscon.com -# [Bernard_Aboba] Bernard Aboba mailto:bernardaµsoft.com 2004-06 -# [Bernard_Desruisseaux] Bernard Desruisseaux mailto:bernard&steltor.com -# [Bernard_Normier] Bernard Normier mailto:bernard&zeroc.com 2006-12 -# [Bernard_Volz] Bernard Volz mailto:volz&cisco.com -# [Bernd_Paradies] Bernd Paradies mailto:bparadie&adobe.com 2008-01-14 -# [Bernie_Malkowski] Bernie Malkowski mailto:bmalkowski&integratedsecuritycorp.com 2007-08-20 -# [Bernie_Volz] Bernie Volz mailto:volz&cisco.com -# [Bert_Bouwers] Bert Bouwers mailto:e.bouwers&rohill.nl 2007-05 -# [Bert_Gijsbers] Bert Gijsbers mailto:bert&xpilot.org -# [Bert_Paul] Bert Paul mailto:bert.paul&apertio.com 2008-07-03 -# [Bert_Van_der_Linden] Bert Van der Linden mailto:bert&propel.com -# [Bert_van_Willigen] Bert van Willigen mailto:bert.vanwilligen&philips.com 2003-11 -# [Bertus_Jacobs] Bertus Jacobs mailto:bertus&ccs-software.co.za -# [Beth_Crespo] Beth Crespo mailto:beth.crespo&hp.com -# [Betsy_Alexander] Betsy Alexander tel:+1-604-681-4549 -# [Beverly_Moody] Beverly Moody mailto:Beverly_Moody&stercomm.com -# [BFD_Chairs] IETF BFD Working Group mailto:bfd-chairs&tools.ietf.org 2014-01-09 -# Chairs -# [Bianling_Zhang] Bianling Zhang mailto:blzhang&iwncomm.com 2004-02 -# [Bie_Tie] Bie Tie mailto:stie&interbase.com -# [Bill_Andrews] Bill Andrews mailto:billa&vnd.tek.com -# [Bill_Bishop] Bill Bishop mailto:bil&rfx.rfx.com -# [Bill_Carroll] Bill Carroll mailto:billc&xactlabs.com -# [Bill_Crawford] Bill Crawford mailto:Bill.Crawford&securicor.co.uk -# [Bill_Croft] Bill Croft mailto:Croft&sumex-aim.stanford.edu -# [Bill_Davidson] Bill Davidson mailto:billd&equalizer.cray.com -# [Bill_Edwards] Bill Edwards mailto:bill.edwards&sun.com 2005-08 -# [Bill_Fenner] Bill Fenner mailto:fenner&parc.xerox.com -# [Bill_Gross] Bill Gross mailto:william.gross&kohler.com 2010-11-01 -# [Bill_Harrell] Bill Harrell -# [Bill_Homan] Bill Homan mailto:bhoman&spanworks.com 2003-01 -# [Bill_Kay] Bill Kay mailto:bkay&spy-tec.com 2006-04 -# [Bill_Marbaker] Bill Marbaker mailto:wrm&fortenet.com -# [Bill_McIntosh] Bill McIntosh mailto:bmcintosh&fortresstech.com -# [Bill_Reding] Bill Reding mailto:redingb&nwdt.natwest.co.uk -# [Bill_Rettig] Bill Rettig mailto:WRettig&efji.com 2010-05-19 -# [Bill_Reveile] Bill Reveile mailto:breveile&allentek.com -# [Bill_Schiefelbein] Bill Schiefelbein mailto:schief&aspen.cray.com -# [Bill_Simpson] Bill Simpson mailto:wsimpson&greendragon.com -# [Bill_Simpson_2] Bill Simpson mailto:Bill.Simpson&um.cc.umich.edu -# [Bill_Somerville] Bill Somerville mailto:Bill.Somerville&scalable.com 2008-08-13 -# [Bill_Taylor] Bill Taylor mailto:sais&ssec.wisc.edu -# [Bill_Tschumy] Bill Tschumy mailto:other!bill&uunet.uu.net -# [Bill_Van_Etten] Bill Van Etten mailto:Bill&bioteam.net -# [Bill_Vlahos] Bill Vlahos mailto:bvlahos&mac.com 2013-12-13 -# [Bill_Weinman] Bill Weinman mailto:wew&bearnet.com -# [Bill_Wingate] Bill Wingate mailto:bill.wingate&arcanadev.com 2003-05 -# [Billy_Dhillon] Billy Dhillon mailto:bdsos&pafec.co.uk -# [bilobit_GmbH] bilobit GmbH mailto:ms&bilobit.com 2014-08-15 -# [BioLink_Support] BioLink Support mailto:reginfo&biolinkusa.com 2002-02 -# [Bizhan_Ghavami] Bizhan Ghavami mailto:ghavami&telcores.com -# [Bjorn_Chambless] Bjorn Chambless mailto:bjorn&cs.pdx.edu -# [Bjorn_Dittmer_Roche] Bjorn Dittmer-Roche mailto:bjorn&xowave.com 2003-06 -# [Bjorn_Jarle_Kvande] Bjorn Jarle Kvande mailto:bjorn&objectplanet.com 2002-04 -# [Bjorn_Lantz] Bjorn Lantz mailto:bjorn.lantz&encode.se 2004-11 -# [Bjorn_Roth] Bjorn Roth FLIR Systems AB mailto:bjorn.roth&flir.se 2011-10-20 -# [Bjorn_de_Bonnenfant] Bjorn de Bonnenfant mailto:bdeb&iqobject.com 2003-11 -# [Blakely_Snyder] Blakely Snyder Ventureforth Inc. mailto:bsnyder&ventureforth.com 2011-11-03 -# [Blockade] VP - Research & mailto:development&blockade.com -# Development -# [Bob_Beard] Bob Beard mailto:bobb&lachman.com -# [Bob_Braden] Bob Braden mailto:Braden&isi.edu -# [Bob_Braden_2] Bob Braden mailto:braden&isi.edu -# [Bob_Bradley] Bob Bradley mailto:bradley&apple.com 2003-03 -# [Bob_Bradley_2] Bob Bradley mailto:bradley&apple.com -# [Bob_Bradley_3] Bob Bradley Apple Inc. mailto:bradley&apple.com 2012-09-19 -# [Bob_Deblier] Bob Deblier mailto:bob&virtualunlimited.com -# [Bob_Dedrick] Bob Dedrick mailto:bob&staff.prodigy.com -# [Bob_Dolin] Bob Dolin mailto:bdolin&echelon.com 2008-04-10 -# [Bob_Gaddie] Bob Gaddie mailto:bobg&dtn.com -# [Bob_Iannucci] Bob Iannucci mailto:bob&rail.com 2011-11-23 -# [Bob_Janssen] Bob Janssen mailto:bob&res.nl -# [Bob_Janssen_2] Bob Janssen mailto:b.janssen&ressoftware.com 2009-11-18 -# [Bob_Kaiser] Bob Kaiser mailto:BKaiser&palindrome.com -# [Bob_Kummerfeld] Bob Kummerfeld mailto:bob&sarad.cs.su.oz.au -# [Bob_Lauria] Bob Lauria mailto:bob.lauria&asg.com 2005-08 -# [Bob_Lyon] Bob Lyon mailto:bl&oasis.icl.co.uk -# [Bob_Natale] Bob Natale mailto:bob.natale&appliedsnmp.com -# [Bob_Nattenberg] Bob Nattenberg mailto:bnattenberg&arborsoft.com -# [Bob_Purvy] Bob Purvy mailto:bpurvy&us.oracle.com -# [Bob_Rennie] Bob Rennie mailto:rjrennie&wizvax.net -# [Bob_Rundle] Bob Rundle mailto:rundle&rundle.com 2005-11 -# [Bob_Sledge] Bob Sledge mailto:bob&pqsystems.com -# [Bob_Stewart] Bob Stewart mailto:STEWART&xyplex.com -# [Bob_Thomas] Bob Thomas mailto:rhthomas&cisco.com -# [Bob_Tournoux] Bob Tournoux mailto:bob.tournoux&usiny.mail.abb.com -# [Bobby_Krupczak] Bobby Krupczak mailto:rdk&empiretech.com -# [Bobby_Krupczak_2] Bobby Krupczak mailto:rdk&krupczak.org 2008-04-03 -# [Bobby_Martin] Bobby Martin mailto:bobbymartin&hotmail.com -# [Bodo_Rueskamp] Bodo Rueskamp mailto:br&itchigo.com 2002-08 -# [Bonjour] Bonjour mailto:bonjour&tapinoma.com -# [BonjourDev] BonjourDev mailto:bonjourdev&apple.com 2011-10-14 -# [Boris_B_Maiden] Boris B. Maiden mailto:Boris_Maiden&smtp.microcom.com -# [Boris_Magnusson] Boris Magnusson mailto:boris&cs.lth.se 2010-12-06 -# [Boris_Panteleev] Boris Panteleev mailto:bpanteleev&himel.com -# [Boris_Polevoy] Boris Polevoy mailto:vapcom&mail.ru 2003-01 -# [Boris_Star] Boris Star mailto:boris.star&veritas.com 2003-01 -# [Boris_Svetlitsky] Boris Svetlitsky mailto:boris&press-sense.com -# [borja_lopez_urkidi] borja lopez urkidi NEGU Soft mailto:lopezurkidi&gmail.com 2012-09-10 -# [Boubacar_KIMNBA_DIT_ADAMOU] Boubacar KIMNBA DIT mailto:jinba&chinamobile.com 2015-11-13 -# ADAMOU -# [Bout_Fitness_LLC] Bout Fitness, LLC mailto:development&boutfitness.com 2014-06-16 -# [Brad_Hamilton] Brad Hamilton mailto:bh&picksys.com -# [Brad_Hamilton_2] Brad Hamilton mailto:brad_hamilton&kofax.com 2002-08 -# [Brad_Head] Brad Head mailto:brad.head&latitudetech.com 2013-02-07 -# [Brad_House] Brad House Main Street Softworks mailto:brad&mainstreetsoftworks.com 2013-04-02 -# Inc -# [Brad_Johanson] Brad Johanson mailto:bradj&tidebreak.com 2005-08 -# [Brad_Parker] Brad Parker mailto:brad&american.com -# [Brad_Pedersen] Brad Pedersen mailto:bradp&citrix.com -# [Brad_Pepers] Brad Pepers mailto:brad&linuxcanada.com 2002-09 -# [Brad_Spear] Brad Spear mailto:spear&platinum.com -# [Brad_Vaughan] Brad Vaughan Apple mailto:vaughan&apple.com 2011-10-12 -# [Brad_Wright] Brad Wright mailto:bradwrµsoft.com -# [Braemar_Consulting] Braemar Consulting mailto:richardt&braemardrive.com 2014-03-05 -# [Bradley_Birnbaum] Bradley Birnbaum mailto:bradley.birnbaum&eshare.com -# [Bradley_Bransom] Bradley Bransom mailto:bradley_bransom&dell.com 2003-01 -# [Brady_Anderson] Brady Anderson mailto:banderso&novell.com -# [Brand_Communications] Brand Communications mailto:donovan&brandcomms.com -# [Brandon_Potter] Brandon Potter mailto:iana&brandonpotter.com 2006-01 -# [Brant_Thomsen] Brant Thomsen mailto:brant_thomsen&3com.com 2003-01 -# [Breas_Medical_AB] Breas Medical AB mailto:jonas.sjostedt&breas.com -# [Breck_Auten] Breck Auten mailto:bauten&dst-inc.com -# [Bremen] University of Bremen, mailto:udrawgraph&informatik.uni-bremen.de -# FB3 -# [Brendan_Fay] Brendan Fay mailto:brendan.fay&x509solutions.com 2006-02 -# [Brendan_McWilliams] Brendan McWilliams mailto:brendan.mcwilliams&vf.vodafone.co.uk 2002-04 -# [Brent_Bradshaw] Brent Bradshaw mailto:bbradshaw&novell.com -# [Brent_Callaghan] Brent Callaghan mailto:brent&terra.eng.sun.com -# [Brent_Foster] Brent Foster mailto:brent.foster&onstreamsystems.com 2006-04 -# [Brent_Fulgham] Brent Fulgham mailto:bfulgham&wyatt.com -# [Brent_Gulanowski] Brent Gulanowski mailto:bgulanowski&marketcircle.com 2009-08-26 -# [Brent_Hines] Brent Hines mailto:brent.hines&unisys.com -# [Brent_Irwin] Brent Irwin mailto:birwin&standard.com -# [Brent_McCullough] Brent McCullough mailto:bmccullough&timemgmt.com 2003-11 -# [Brent_Welch] Brent Welch mailto:welch&scriptics.com -# [Bret_O_Rourke] Bret O'Rourke mailto:bretorµsoft.com -# [Brett_Dolecheck] Brett Dolecheck mailto:Dolecheck&ipmetrics.com -# [Brett_Goldstein] Brett Goldstein mailto:bgoldstein&opentable.com -# [Brett_Green] Brett Green mailto:brett_green&hp.com 2003-11 -# [Brett_Green_2] Brett Green mailto:Brett_Green&hp.com -# [Brett_Sorenson] Brett Sorenson mailto:bcs&atex.com -# [Brian_Abramson] Brian Abramson mailto:brianab&soul.tv.tek.com -# [Brian_Abramson_2] Brian Abramson mailto:brianab&vnd.tek.com -# [Brian_Batke] Brian Batke mailto:csp.protocol&gmail.com -# [Brian_Batke_2] Brian Batke mailto:eip.jsig&gmail.com -# Chair of the -# [Brian_Batke_3] Brian Batke EtherNet/IP System mailto:babatke&ra.rockwell.com 2015-05-28 -# Architecture SIG -# [Brian_Becker] Brian Becker mailto:bbecker&tgc-usa.com 2006-10 -# [Brian_Blevins] Brian Blevins mailto:brian.blevins&tridia.com -# [Brian_C_Wiles] Brian C. Wiles mailto:brian&streamcomm.com -# [Brian_Carnell] Brian Carnell mailto:brian&e3consultants.com -# [Brian_Cully] Brian Cully mailto:shmit&kublai.com -# [Brian_Dickman] Brian Dickman mailto:brian&novastor.com -# [Brian_Ehrmantraut] Brian Ehrmantraut mailto:bae&netapp.com -# [Brian_Griswold] Brian Griswold mailto:brian&dancingbear.com -# [Brian_Harrington] Brian Harrington CoreOS mailto:brian.harrington&coreos.com 2014-07-09 -# [Brian_Henry] Brian Henry mailto:brian.henryµsoft.com 2007-03 -# [Brian_Kennedy] Brian Kennedy mailto:BrianK&targetedconvergence.com 2006-08 -# [Brian_Klassen] Brian Klassen mailto:Brian.Klassen&unisys.com -# [Brian_Lloyd] Brian Lloyd mailto:brian&lloyd.com -# [Brian_Martinicky] Brian Martinicky mailto:Brian_Martinicky&automationintelligence.com -# [Brian_Matthews] Brian Matthews mailto:bmatthews&mosaicsystems.com -# [Brian_Matthews_2] Brian Matthews mailto:brian_matthews&ibist.ibis.com -# [Brian_McKinnon] Brian McKinnon mailto:bmk&lvision.com -# [Brian_Nickles] Brian Nickles mailto:RogueSpear91&hotmail.com 2002-05 -# [Brian_O_Keefe] Brian O'Keefe mailto:bokeefe&cnd.hp.com -# [Brian_Olson] Brian Olson mailto:briolson&pacbell.net -# [Brian_Reid] Brian Reid mailto:reid&decwrl.dec.com -# [Brian_S_Locke] Brian S. Locke mailto:blocke&zortlabs.com 2008-07-10 -# [Brian_S_Stewart] Brian S. Stewart mailto:Brian.Stewart&avocent.com -# [Brian_S_Stewart_2] Brian S. Stewart mailto:Brian.Stewart&avovent.com -# [Brian_Schenkenberger] Brian Schenkenberger mailto:VAXman&tmesis.com -# [Brian_Spears] Brian Spears mailto:bspears&salix.com -# [Brian_Tackett] Brian Tackett mailto:cym&acrux.net -# [Brian_Taylor] Brian Taylor mailto:btaylor&imagetag.com -# [Brian_Toothill] Brian Toothill mailto:brian.toothill&touchstar.co.uk 2010-10-15 -# [Brian_Trammell] Brian Trammell mailto:btrammell&iventurelab.com -# [Brian_Trevor] Brian Trevor mailto:btrevor&bmc.com 2008-10-24 -# [Brian_Tung] Brian Tung mailto:brian&isi.edu -# [Brian_W_Beach] Brian W. Beach mailto:brian&tivo.com 2003-01 -# [Bridget_Navoda] Bridget Navoda mailto:Bridget_Navoda&dell.com -# [Bridget_Walsh] Bridget Walsh mailto:bwalsh&iona.ie -# [Bridgette_Landers] Bridgette Landers mailto:blanders&boi.hp.com -# [Bridgeworks] Bridgeworks mailto:paul.burgess&4bridgeworks.com 2014-09-26 -# [Brigitte_Gagne] Brigitte Gagne mailto:bgagne&trigence.com 2006-08 -# [Brooks_Bell] Brooks Bell Layered Logic, Inc. mailto:brooks&layeredlogic.com 2012-01-04 -# [Bruce_Carlson] Bruce Carlson mailto:bruce.carlson&iprintl.com 2003-01 -# [Bruce_Casey] Bruce Casey mailto:bcasey&responselogic.com -# [Bruce_Davie] Bruce Davie mailto:bsd&cisco.com -# [Bruce_Davie_2] Bruce Davie mailto:bdavie&vmware.com 2013-07-31 -# [Bruce_Davie_3] Bruce Davie mailto:bdavie&vmware.com 2014-04-28 -# [Bruce_Ferjulian] Bruce Ferjulian mailto:ferjulian_bruce&emc.com -# [Bruce_Greenblatt] Bruce Greenblatt mailto:bruce&arkivio.com 2002-02 -# [Bruce_Hestand] Bruce Hestand mailto:Bruce.Hestand&veritas.com -# [Bruce_Kosbab] Bruce Kosbab mailto:bruce.kosbab&indurasoft.com -# [Bruce_Lieberman] Bruce Lieberman mailto:brucel&iserver.starlight.com -# [Bruce_Lueckenhoff] Bruce Lueckenhoff mailto:brucelu&cisco.com -# [Bruce_Lueckenhoff_2] Bruce Lueckenhoff mailto:bruce&scalabledesign.com 2006-02 -# [Bruce_Mackey] Bruce Mackey mailto:BAMackey&aol.com -# [Bruce_McKinnon] Bruce McKinnon mailto:brucemck&bears.aust.com -# [Bruce_McKinnon_2] Bruce McKinnon mailto:brucemck&bearsolutions.com.au -# [Bruce_Thompson] Bruce Thompson mailto:brucet&actioninformationsystems.com 2006-02 -# [Bruce_Vander_Werf] Bruce Vander Werf mailto:bvanderwerf&crownintl.com 2004-02 -# [Bruce_Wells] Bruce Wells mailto:brwells&us.ibm.com 2010-10-04 -# [Bruce_Wilson] Bruce Wilson tel:+1-905-771-6161 -# [Bruno_Rijsman] Bruno Rijsman Juniper Networks mailto:brijsman&juniper.net 2013-02-01 -# [Bryan_Alvord] Bryan Alvord mailto:bryan&vaticor.com 2003-04 -# [Bryan_Cole] Bryan Cole mailto:bryan.cole&teraview.com -# [Bryan_Otey] Bryan Otey mailto:bwo&softdesk.com -# [Bryan_Vergato] Bryan Vergato mailto:iana&ivocalize.com 2006-05 -# [Bryan_Wilcutt] Bryan Wilcutt mailto:bwilcutt&comtechefdata.com 2005-06 -# [Bryant_Eastham] Bryant Eastham OenDOF mailto:protocol&opendof.org 2015-04-23 -# [Bryce_Beeston] Bryce Beeston mailto:bryce.beeston&emerson.com 2011-06-23 -# [Bryce_Bhatnagar] Bryce Bhatnagar mailto:BRYCEBH&attachmate.com -# [BSH_Bosch_und_Siemens_Hausgeraete_GmbH] BSH Bosch und Siemens mailto:juergen.riesmeyer&bshg.com 2013-06-11 -# Hausgeraete GmbH -# [buddycloud] buddycloud mailto:simon&buddycloud.com 2013-05-20 -# [Buck_Caldwell] Buck Caldwell mailto:buck_c&polygon.com -# [Bulent_Kasman] Bulent Kasman mailto:BKasman&symantec.com -# [Byron_Jones] Byron Jones mailto:byronj&bellsouth.net -# [C_Enrique_Ortiz] C. Enrique Ortiz mailto:eortiz&j2medeveloper.com 2003-01 -# [C_Philip_Wood] C. Philip Wood mailto:cpw&lanl.gov -# [CA_Technologies] CA Technologies mailto:sakth01&ca.com 2015-06-02 -# [Cabel_Sasser] Cabel Sasser Panic Inc. mailto:cabel&panic.com 2012-07-19 -# [CaldSoft] CaldSoft mailto:development&caldsoft.co.uk 2011-08-12 -# [Cameo_Systems_Inc] Cameo Systems Inc. mailto:craig&reversion.ca 2011-09-26 -# [Cameron_Colpitts] Cameron Colpitts Santorini, LLC mailto:cameron&santorinillc.com 2011-10-25 -# [Cameron_Young] Cameron Young mailto:Cameron_Young&inetco.com -# [Candace_Niccolson] Candace Niccolson mailto:cniccolson&genisar.com 2002-04 -# [Canfield_Scientific_Inc] Canfield Scientific, mailto:jim.crismale&canfieldsci.com 2013-07-02 -# Inc. -# [Canon_Inc] Canon Inc. mailto:fujii.ken-ichi149&canon.co.jp 2011-10-10 -# [Canon_Inc_2] Canon Inc mailto:fujii.ken-ichi149&canon.co.jp 2013-03-28 -# [Canon_Inc_3] Canon Inc. mailto:fujii.ken-ichi149&canon.co.jp 2014-09-03 -# [Canto] Canto mailto:tschleu&canto.com 2014-02-26 -# [Caprice_Productions] Caprice Productions mailto:ldrake&caprice.com 2012-07-05 -# [Carl_Banzhof] Carl Banzhof mailto:cbanzhof&citadel.com 2003-06 -# [Carl_Blundell] Carl Blundell mailto:cblundell&celador.co.uk 2002-05 -# [Carl_Cedergren] Carl Cedergren mailto:asperon&home.se -# [Carl_Ellis] Carl Ellis mailto:carl.ellis&tenasys.com -# [Carl_First] Carl First mailto:Carl.L.First&intel.com -# [Carl_Johan_Wik] Carl-Johan Wik mailto:cjw&hudsmoar.com -# [Carl_Malamud] Carl Malamud -# [Carl_Obsorn] Carl Obsorn mailto:carl_osborn&sabre.com -# [Carl_Uno_Manros] Carl-Uno Manros mailto:manros&cp10.es.xerox.com -# [Carla_Caputo] Carla Caputo mailto:caputo&emc.com -# [Carleton_Watkins] Carleton Watkins mailto:carleton&soronti.com 2003-11 -# [Carlisle_Adams] Carlisle Adams mailto:Cadams&entrust.com -# [Carlos_Arteaga] Carlos Arteaga mailto:carteaga&abacoinc.com -# [Carlos_Arteaga_2] Carlos Arteaga mailto:carteaga&adelphia.net 2004-11 -# [Carlos_Gonzalez_Roma] Carlos Gonzalez-Roman mailto:iana&abcdatos.com 2003-06 -# Ferrer -# [Carlos_Hung] Carlos Hung mailto:chung&digisle.net -# [Carlos_Portela] Carlos Portela mailto:cportela&simple-sw.com 2003-02 -# [Carlos_Puchol] Carlos Puchol Amahi mailto:iana&amahi.org 2014-02-27 -# [Carol_Ann_Krug] Carol Ann Krug mailto:carolann&hpmfas3.cup.hp.com -# [Carson_Fenimore] Carson Fenimore mailto:carson.fenimore&inl.gov -# [Carstein_Seeberg] Carstein Seeberg mailto:case&boole.no -# [Carstein_Seeberg_2] Carstein Seeberg mailto:case&nimsoft.no -# [Carsten_Falticska] Carsten Falticska mailto:falticska&freenet.de 2003-11 -# [Carsten_Strotmann] Carsten Strotmann mailto:carsten.strotmann&menandmice.com 2009-05-20 -# [Casey_Harrington] Casey Harrington mailto:charrington&isxinc.com 2006-01 -# [Casper_Stoel] Casper Stoel mailto:cbs&ascinc.com -# [Cat_Zimmermann] Cat Zimmermann Teledyne BlueView, mailto:czimmermann&teledyne.com 2012-09-19 -# Inc. -# [Catalogic_Software_Inc] Catalogic Software, mailto:cchang&catalogicsoftware.com 2015-02-04 -# Inc. -# [Cedric_Maloux] Cedric Maloux mailto:cedric&allpeers.com 2007-04 -# [Chad_Williams] Chad Williams mailto:chad&apple.com -# [Chair_for_Process_Control_Engineering] The Chair for Process mailto:ks&plt.rwth-aachen.de 2012-08-07 -# Control Engineering -# [Chandar_Venkataraman] Chandar Venkataraman mailto:CVENKATA&us.oracle.com -# [Chaoyi_Lang] Chaoyi Lang mailto:chao-yi_lang&maxtor.com 2006-01 -# [Chap_Tippin] Chap Tippin mailto:chad.tippin&jibeinc.com 2003-06 -# [Charles_A_Higgins] Charles A. Higgins mailto:75730.2257&compuserve.com -# [Charles_Bennett] Charles Bennett mailto:bennettc&ohio.edu 2008-08-29 -# [Charles_C_L_Chou] Charles C.L. Chou mailto:cchou&zoom.com -# [Charles_F_Steele] Charles F Steele mailto:charles_steele&agilent.com 2011-02-15 -# [Charles_Gordon] Charles Gordon mailto:cgordon&digprod.com -# [Charles_Honton] Charles Honton mailto:chas&honton.org -# [Charles_Jacobs] Charles Jacobs mailto:cjacobs&numinous.com -# [Charles_Lynn] Charles Lynn mailto:clynn&bbn.com -# [Charles_O_Dale] Charles O'Dale mailto:codale&hfx.andara.com 2006-07 -# [Charles_Oram] Charles Oram mailto:charleso&cardax.com -# [Charles_Perkins] Charles Perkins mailto:cperkins&eng.sun.com -# [Charles_Scott_Robers] Charles Scott Roberson mailto:chip&cerent.com -# [Charles_Watt] Charles Watt mailto:watt&sware.com -# [Charles_Wright] Charles Wright mailto:cpwright&villagenet.com -# [Charlie_Hava] Charlie Hava mailto:charlieh&aks.com -# [Charlie_Hundre] Charlie Hundre mailto:charlie&rdsrv.reco.com.tw -# [Charlie_Kim] Charlie Kim mailto:charlie.bea.utiful&gmail.com 2012-08-28 -# [Charlie_Limoges] Charlie Limoges mailto:Charlie.Limoges&gdc4s.com -# [Chatziandreoglou_Chr] Chatziandreoglou Christos mailto:chatzi&xan.forthnet.gr 2003-10 -# [Chaz_McGarvey] Chaz McGarvey mailto:chaz&brokenzipper.com -# [Check_Point_Software] Check Point Software mailto:rbahadur&checkpoint.com 2012-06-28 -# Technologies Ltd. -# [Chee_Kent_Lam] Chee Kent Lam mailto:cklam&foursticks.com 2002-04 -# [Cheryl_Stoutenburg] Cheryl Stoutenburg mailto:cstoutenburg&vnet.ibm.com -# [Chi_Chen] Chi Chen mailto:chichen&us.ibm.com 2002-04 -# [Chi_Shih_Chang] Chi Shih Chang Catalogic Software, mailto:cchang&catalogicsoftware.com 2015-02-04 -# Inc. -# [Chiew_Farn_Chung] Chiew Farn Chung mailto:cfchung&asprova.com -# [Chiming_Huang] Chiming Huang mailto:chuang&ac-tech.com -# [Chirag_Desai] Chirag Desai mailto:Chirag_Desai&symantec.com 2006-02 -# [Chirag_Patel] Chirag Patel Veejansh Inc mailto:cpatel&veejansh.com 2014-03-04 -# [Chris_Adamson] Chris Adamson mailto:invalidname&gmail.com -# [Chris_Adkins] Chris Adkins mailto:cadkins&filenet.com 2006-10 -# [Chris_Anderson] Chris Anderson Daegis, Inc. mailto:ianaportmaster&daegis.com 2012-07-31 -# [Chris_Bertin] Chris Bertin mailto:chris.bertin&hp.com 2009-05-19 -# [Chris_Brown] Chris Brown mailto:chrisb&chancery.com -# [Chris_Chiotasso] Chris Chiotasso mailto:cchiotasso&infolibria.com -# [Chris_Cuilla] Chris Cuilla mailto:balr!vpnet!cuilla!chris&clout.chi.il.us -# [Chris_Das] Chris Das mailto:cdas&cnd.hp.com -# [Chris_Dern] Chris Dern mailto:cdern&nospam.alarismed.com 2004-06 -# [Chris_Duncombe] Chris Duncombe mailto:cdunc&atpeng.com -# [Chris_Eich] Chris Eich Enphase Energy, Inc. mailto:ceich&enphaseenergy.com 2011-11-08 -# [Chris_Farey] Chris Farey StorMagic Ltd mailto:chris_farey&stormagic.com 2011-12-16 -# [Chris_Flynn] Chris Flynn mailto:cflynn&landmark.com -# [Chris_Forsythe] Chris Forsythe The Growl Project mailto:chris&growl.info 2012-02-07 -# [Chris_Greene] Chris Greene mailto:cgreeneOA&avidsports.com -# [Chris_Griffin] Chris Griffin mailto:cgriffin&dka.com -# [Chris_Griffiths] Chris Griffiths mailto:chris_griffiths&cable.comcast.com 2008-07-28 -# [Chris_Hahn] Chris Hahn mailto:chrish&sierra.net -# [Chris_Hawk] Chris Hawk mailto:chris&corriente.net 2005-08 -# [Chris_Hawkinson] Chris Hawkinson mailto:chawkinson&coalsere.com 2002-08 -# [Chris_Herzog] Chris Herzog mailto:zog&stg.com 2006-05 -# [Chris_Horne] Chris Horne Photosmith mailto:ckhorne&photosmithapp.com 2011-10-27 -# [Chris_Irie] Chris Irie mailto:irie&sybase.com 2008-03-26 -# [Chris_J_Wren] Chris J. Wren mailto:C.Wren&lucent.com -# [Chris_Kent] Chris Kent Decisive Tactics, mailto:ckent&decisivetactics.com 2015-04-09 -# Inc. -# [Chris_Kerrigan] Chris Kerrigan mailto:ckerrigan&hns.com -# [Chris_Koeritz] Chris Koeritz mailto:ckoeritz&inovacorp.com -# [Chris_Koeritz_2] Chris Koeritz mailto:fred&gruntose.com 2002-10 -# [Chris_Koeritz_3] Chris Koeritz mailto:portmanager&inovasolutions.com 2006-10 -# [Chris_Kramer] Chris Kramer mailto:CKramer&gis.shl.com -# [Chris_Larsson] Chris Larsson mailto:clarsson&vnet.ibm.com -# [Chris_LeCroy] Chris LeCroy mailto:lecroy&apple.com -# [Chris_MacDonald] Chris MacDonald mailto:chris&viscount.com 2011-03-16 -# [Chris_Megede] Chris Megede mailto:chris.megede&tac.com -# [Chris_Michaelson] Chris Michaelson mailto:chris&codegreennetworks.com 2005-08 -# [Chris_Newman] Chris Newman mailto:chris.newman&oracle.com 2010-10-15 -# [Chris_Nigbur] Chris Nigbur UpdateLogic, Inc. mailto:chris.nigbur&updatelogic.com 2014-10-27 -# [Chris_Peel] Chris Peel mailto:chrispeel.gsi&googlemail.com 2011-03-09 -# [Chris_Peel_2] Chris Peel mailto:chris.gsi&fullphat.net 2014-05-16 -# [Chris_Pugmire] Chris Pugmire mailto:chrisp&netwinsite.com -# [Chris_Ranch] Chris Ranch mailto:cranch&novell.com -# [Chris_Rominski] Chris Rominski mailto:ChrisRom&attachmate.com -# [Chris_Ryland] Chris Ryland mailto:cpr&emsoftware.com 2004-11 -# [Chris_Sanders] Chris Sanders mailto:csanders&navini.com 2003-08 -# [Chris_Schlaeger] Chris Schlaeger mailto:cs&kde.org -# [Chris_Silverberg] Chris Silverberg mailto:csilverberg&nanocom.com -# [Chris_Stanaway] Chris Stanaway mailto:stanaway&comm.mot.com -# [Chris_Tate] Chris Tate mailto:ctate&astromed.com -# [Chris_Thornhill] Chris Thornhill mailto:port_contact&cjt.ca -# [Chris_Vertonghen] Chris Vertonghen mailto:chrisv&pearldoc.com -# [Chris_Watson] Chris Watson mailto:chrisf16&mac.com 2014-03-04 -# [Chris_Wells] Chris Wells mailto:chris_wells&lansource.com -# [Chris_Wilcox] Chris Wilcox mailto:cwilcox&cd3o.com 2002-10 -# [Chris_Wilson] Chris Wilson mailto:chris+iana&qwirx.com 2008-09-11 -# [Christer_Gunnarsson] Christer Gunnarsson mailto:christer.gunnarsson&ascom.se 2009-03-26 -# [Christer_Nygren] Christer Nygren mailto:christer.nygren&fro.se 2007-08-07 -# [Christiaan_Simons] Christiaan Simons mailto:christiaan.simons&axon.nl -# [Christian_Beaumont] Christian Beaumont mailto:chrisb&lantronix.com 2003-11 -# [Christian_Brecht] Christian Brecht mailto:Christian.Brecht&sauter-gmbh.de 2010-12-15 -# [Christian_Callsen] Christian Callsen mailto:Christian.Callsen&eng.sun.com -# [Christian_Catchpole] Christian Catchpole mailto:christian&catchpole.net 2002-03 -# [Christian_Caudrelier] Christian Caudrelier mailto:Christian.Caudrelier&bull.net 2006-02 -# [Christian_Flintrup] Christian Flintrup mailto:chr&gigahost.dk -# [Christian_Grothoff] Christian Grothoff mailto:grothoff&cs.purdue.edu 2002-10 -# [Christian_Huitema] Christian Huitema mailto:huitema&research.telcordia.com -# [Christian_Huitema_2] Christian Huitema mailto:huitemaµsoft.com 2003-02 -# [Christian_Klemetsson] Christian Klemetsson Integrius AB mailto:christian.klemetsson&integrius.se 2010-03-04 -# [Christian_Laendner] Christian Laendner d&b audiotechnik mailto:software.support&dbaudio.com 2011-10-06 -# [Christian_Plattner] Christian Plattner Cleondris GmbH mailto:christian.plattner&cleondris.ch 2015-03-31 -# [Christian_Rubach] Christian Rubach mailto:Christian_Rubach&bestsoftware.com -# [Christian_Saether] Christian Saether mailto:ChristianS&asymetrix.com -# [Christian_Saether_2] Christian Saether mailto:c.saether&f5.com -# [Christian_Schormann] Christian Schormann mailto:100410.3063&compuserve.com -# [Christian_Stredicke] Christian Stredicke mailto:stredicke&snom.de -# [Christian_Treczoks] Christian Treczoks mailto:ct&braehler.com -# [Christian_Westbrook] Christian Westbrook mailto:cw&wellohorld.com 2007-11-15 -# [Christian_Wolff] Christian Wolff mailto:stvp&smash.tv -# [Christian_Zietz] Christian Zietz mailto:czietz&gmx.net -# [Christina_Mercier] Christina Mercier mailto:christina.mercier&finisar.com 2005-08 -# [Christof_Drescher] Christof Drescher mailto:drescher&mailprox.net 2003-11 -# [Christof_J_Reetz] Christof J. Reetz mailto:cjr&netplan.de 2011-03-09 -# [Christof_J._Reetz_2] Christof J. Reetz Cruse mailto:cjr&crusescanner.com 2014-08-15 -# Spezialmaschinen GmbH -# [Christoph_Anton_Mitt] Christoph Anton Mitterer mailto:calestyo&scientia.net 2009-03-10 -# [Christoph_Hipp] Christoph Hipp SOFTPRO GmbH mailto:christoph.hipp&softpro.de 2013-08-02 -# [Christoph_Kukulies] Christoph Kukulies mailto:info&exapt.de 2003-04 -# [Christophe_Allie] Christophe Allie mailto:callie&apple.com 2006-08 -# [Christophe_Besant] Christophe Besant -# [Christophe_Chevalier] Christophe Chevalier mailto:chevalier&archimed.fr 2005-08 -# [Christophe_Cleraux] Christophe Cleraux mailto:chrisc&wrs.com -# [Christophe_Gisquet] Christophe Gisquet mailto:christophe.gisquet&gmail.com 2011-05-26 -# [Christopher_Allen] Christopher Allen mailto:ChristopherA&consensus.com -# [Christopher_Bidwell] Christopher Bidwell mailto:cbidwell&silvercreeksystems.com 2006-02 -# [Christopher_Carlson] Christopher Carlson mailto:cjc&dobbz.com 2003-10 -# [Christopher_Cordray] Christopher Cordray mailto:ccordray&sciencelogic.com 2008-06-05 -# [Christopher_Davey] Christopher Davey mailto:niallocl&quay.ie -# [Christopher_Durham] Christopher Durham mailto:chrisdu&sco.com -# [Christopher_Eykamp] Christopher Eykamp mailto:chris&eykamp.com 2012-08-16 -# [Christopher_Karper] Christopher Karper mailto:ckarper&dev.tricerat.com -# [Christopher_LILJENST] Christopher LILJENSTOLPE mailto:cdl&asgaard.org 2008-04-14 -# [Christopher_Leong] Christopher Leong mailto:leong&kolmod.mlo.dec.com -# [Christopher_Liljenstolpe] Christopher Liljenstolpe mailto:iana&cdl.asgaard.org 2014-04-17 -# [Christopher_McLendon] Christopher McLendon mailto:cem&hyper.com -# [Christopher_Miller] Christopher Miller mailto:Chris.Miller&versatrans.com 2006-02 -# [Christopher_Miller_2] Christopher Miller mailto:chris.miller&versatrans.com 2008-01-14 -# [Christopher_R_Smith] Christopher R. Smith mailto:csmith4&us.ibm.com 2004-11 -# [Christophe_Pignon] Christophe Pignon L-ACOUSTICS mailto:christophe.pignon&l-acoustics.com 2012-08-13 -# [Christopher_Tengi] Christopher Tengi mailto:tengi&princeton.edu -# [Christopher_Truxaw] Christopher Truxaw mailto:ctruxaw&redsoftware.com 2010-10-15 -# [Christopher_Wells] Christopher Wells mailto:Christopher_Wells&3com.com -# [Christopher_Wells_2] Christopher Wells mailto:christopher_wells&3com.com 2002-04 -# [Chuck_McManis] Chuck McManis mailto:cmcmanis&freegate.net -# [Chuck_Neal] Chuck Neal mailto:chuck&phase3.com -# [Chuck_Runquist] Chuck Runquist mailto:crunquist&quarterdeck.com -# [Chuck_Spitz] Chuck Spitz mailto:spich04&cai.com -# [Chuck_Talk] Chuck Talk mailto:ctalk&pervasive.com -# [Chui_Tin_Yen] Chui-Tin Yen mailto:tin&cisco.com 2006-02 -# [Chul_Yoon] Chul Yoon mailto:cyoon&responsenetworks.com -# [Chun_Ho_Chang] Chun-Ho Chang mailto:chun-ho.chang&ca.com 2004-11 -# [Cimarron_Boozer] Cimarron Boozer mailto:cboozer&funk.com -# [Cindy_Martin] Cindy Martin mailto:cmartin&databeam.com -# [CipherPoint] CipherPoint Software, mailto:wshea&cipherpointsoftware.com 2010-03-03 -# inc. -# [Circus_Ponies_Suppor] Circus Ponies Support mailto:support&circusponies.com -# [Cisco] Cisco mailto:glenn.matthews&cisco.com 2011-10-25 -# [Cisco2] Cisco mailto:smkumar&cisco.com 2012-06-11 -# [Cisco_3] Cisco mailto:anthurbe@cisco.com> 2014-01-21 -# [Cisco_Systems] Cisco Systems mailto:nmtg-port-numbers&cisco.com 2005-11 -# [Cisco_Systems_2] Cisco Systems mailto:sagsoni&cisco.com 2014-02-20 -# [Cisco_Systems_3] Cisco Systems mailto:eckert&cisco.com 2014-06-06 -# [Citrix_Systems] Citrix Systems mailto:CloudBridge-PM&citrix.com 2015-04-17 -# [CityDisc] CityDisc mailto:citydisc&euronet.nl -# [Claes_Fredrik_Mannby] Claes-Fredrik Mannby mailto:cf&mannby.com -# [Clark_Williams] Clark Williams mailto:clark&wirespeed.com -# [CLAUDE_MALLY] CLAUDE MALLY XMI Systems SA mailto:cma&xmisystems.com 2013-01-18 -# [Claudio_Lastrucci] Claudio Lastrucci POWERSOFT S.R.L. mailto:claudio.lastrucci&powersoft.it 2012-01-03 -# [Claudio_Procida] Claudio Procida mailto:claudio&emeraldion.it 2007-05 -# [Claus_Broch] Claus Broch NextDay Aps mailto:nextday&infinite-loop.dk 2012-04-24 -# [Claus_Broch2] Claus Broch Infinite Loop mailto:nasmon&infinite-loop.dk 2012-10-09 -# [Claus_Jensen] Claus Jensen Libratone A/S mailto:cjn&libratone.com 2011-10-27 -# [Claus_Thor_Barth] Claus Thor Barth mailto:iana&barth.dk -# [Clay_Maeckal] Clay Maeckal mailto:clay_maeckel&filemaker.com -# [Clay_Maeckel] Clay Maeckel mailto:clay_maeckel&filemaker.com -# [Clayster_Laboratorios_Chile_S.A.] Clayster Laboratorios mailto:peter.waher&clayster.com 2014-06-16 -# Chile S.A. -# [Clayton_Haapala] Clayton Haapala mailto:clay.haapala&veritas.com 2005-08 -# [Clayton_Wilkinson] Clayton Wilkinson mailto:cwilkinson&carreker.com -# [Cleondris_GmbH] Cleondris GmbH mailto:noc&cleondris.ch 2015-03-31 -# [Cliff_Batson] Cliff Batson mailto:cliff&perrla.com 2010-01-21 -# [Cliff_Diamond] Cliff Diamond mailto:cdiamond&crypto-solutions.co.uk -# [Cliff_Joyce] Cliff Joyce mailto:cliffjoyce&pureblend.com -# [Clifford_Heath] Clifford Heath mailto:cjh&managesoft.com 2006-05 -# [Clifton_Nock] Clifton Nock mailto:cnock&us.ibm.com -# [Clint_Eskew] Clint Eskew Control Technology mailto:ceskew&controltechnology.com 2011-10-28 -# Inc. -# [CloudFlare] CloudFlare, Inc. mailto:help&cloudflare.com 2012-03-09 -# [Cnaan_Aviv] Cnaan Aviv mailto:cnaan&gammasite.com -# CNS a.s. (IT company -# [CNS_a.s.] registered in Czech mailto:HAJN.L&cns.cz 2014-06-12 -# republic) -# [Cockroach_Labs_Inc] Cockroach Labs, Inc. mailto:iana-contact&cockroachlabs.com 2015-09-29 -# [Cody_Bumgardner] Cody Bumgardner University of mailto:cody&uky.edu 2014-11-21 -# Kentucky -# [Cognex] Cognex Corporation mailto:contactus&cognex.com 2012-08-28 -# [Coleman_Brumley] Coleman Brumley mailto:cbrumley&polarsoft.biz 2011-02-10 -# [Colin_Barry] Colin Barry mailto:cbarry&gbahn.com -# [Colin_Buchanan] Colin Buchanan Epipole Limited mailto:colin&epipole.com 2014-11-13 -# [Colin_Caughie] Colin Caughie mailto:cfc&indigo-avs.com -# [Colin_Goldstein] Colin Goldstein mailto:Colin&kana.com -# [Colin_Griffiths] Colin Griffiths mailto:colin.griffiths&interlinksoftware.com 2002-02 -# [Colin_Henein] Colin Henein mailto:iana&cmh.parliant.com 2005-08 -# [Colin_Hughes] Colin Hughes mailto:chughes&agentsease.net 2006-02 -# [Colin_Kelley] Colin Kelley mailto:cdk&callwave.com -# [Colin_Reid] Colin Reid mailto:creid&projux.com 2002-11 -# [CollabNet] CollabNet mailto:info&collab.net -# [Colm_MacCarthaigh] Colm MacCarthaigh mailto:colm.maccarthaigh&joost.com 2007-04 -# [Complan_Network_AS] Complan Network AS mailto:knut&winpcs.com 2006-02 -# [Computer_Software_Gm] Computer Software mailto:BrunoRistok&cs-ag.de 2002-10 -# GmbH -# [Comtech] Comtech mailto:njeffords&comtechefdata.com 2014-01-23 -# [Conceptworld_Corporation] Conceptworld mailto:admin&conceptworld.com 2013-08-20 -# Corporation -# [Connie_Qiu] Connie Qiu mailto:connie&scdb.com -# [Conny_Larsson] Conny Larsson mailto:cocke&vnet.ibm.com -# [Control_Technology_Inc] Control Technology mailto:ceskew&controltechnology.com 2011-10-28 -# Inc. -# [Coolatoola.com] Coolatoola.com mailto:helpme&coolatoola.com 2014-01-03 -# [COPALP] COPALP mailto:jf&copalp.com 2012-03-01 -# [Copy] Copy mailto:team©.com 2012-09-19 -# [CoreOS] CoreOS mailto:brian.harrington&coreos.com 2014-07-09 -# [Corey_Burnett] Corey Burnett mailto:corey.burnett&biopop.com -# [Corey_Clinton] Corey Clinton mailto:ccclinton&travisassoc.com 2011-02-02 -# [Corey_Corrick] Corey Corrick mailto:corey.corrick&flamenconetworks.com -# [Corey_Leong] Corey Leong mailto:cleong&gr8c.org 2010-10-11 -# [Cormac_Long] Cormac Long mailto:webmaster&smsforum.net 2002-07 -# [Corpus_Collusion] Corpus Collusion mailto:developer&corpuscollusion.com 2011-08-23 -# [Craig_Calef] Craig Calef mailto:craig&katmango.com -# [Craig_Ching] Craig Ching mailto:cching&mqsoftware.com -# [Craig_Dowell] Craig Dowell Qualcomm Innovation mailto:cdowell&quicinc.com 2011-12-21 -# Center, Inc. -# [Craig_Everhart] Craig Everhart mailto:Craig.Everhart&netapp.com 2010-07-06 -# [Craig_Fowler] Craig Fowler mailto:cfowler&us.oracle.com -# [Craig_Langfahl] Craig Langfahl mailto:Craig_J_Langfahl&ccm.ch.intel.com -# [Craig_N_Bissell] Craig N. Bissell mailto:craig&quailnetworks.com 2006-04 -# [Craig_Nelson] Craig Nelson Cameo Systems Inc. mailto:craig&reversion.ca 2011-09-26 -# [Craig_Rogers] Craig Rogers mailto:Rogers&isi.edu -# [Craig_Steffen] Craig Steffen mailto:csteffen&ncsa.uiuc.edu 2005-08 -# [Craig_Weeks] Craig Weeks mailto:cweeks&syspace.co.uk -# [Crestron_Electronics] Crestron Electronics, mailto:mtalreja&crestron.com 2012-06-27 -# Inc. -# [Cristian_Petculescu] Cristian Petculescu mailto:cristpµsoft.com -# [Cristian_Petculescu_2] Cristian Petculescu mailto:cristp&hotmail.com 2003-04 -# [Cristian_Petculescu_3] Cristian Petculescu mailto:petcu40&gmail.com 2005-08 -# [Cruse_Spezialmaschinen_GmbH] Cruse mailto:cjr&crusescanner.com 2014-08-15 -# Spezialmaschinen GmbH -# [Cryo_Networks] Cryo-Networks mailto:p.favre&cryo-networks.fr -# [Csaba_Mate] Csaba Mate mailto:mc36&freemail.c3.hu -# [Cullen_Jennings] Cullen Jennings mailto:fluffy&cisco.com 2010-02-03 -# [Curt_Ellmann] Curt Ellmann mailto:curt.ellmann&ncr.com -# [Curt_Mayer] Curt Mayer mailto:curt&emergent.com -# [Curt_Schimmel] Curt Schimmel mailto:curt&small-tree.com 2005-11 -# [Curtis_Anderson] Curtis Anderson mailto:canderson&turbolinux.com -# [Curtis_Anderson_2] Curtis Anderson mailto:ecanderson&turbolinux.com -# [Curtis_Bray] Curtis Bray mailto:CurtisB&creativedesign.com -# [Curtis_Smith] Curtis Smith mailto:curtis.smith&vsin.com -# [Curtiss_Howard] Curtiss Howard mailto:cjhoward&unity.ncsu.edu 2004-11 -# [CX5_SOFTWARE] CX5 SOFTWARE mailto:contact&cx5software.com 2013-02-04 -# [DARcorp] mailto:DARcorp&aol.com -# [d_b_audiotechnik] d&b audiotechnik mailto:software.support&dbaudio.com 2011-10-06 -# [D_J_Bernstein] D. J. Bernstein mailto:djb&silverton.berkeley.edu -# [D_J_Bernstein_2] D. J. Bernstein mailto:djb&koobera.math.uic.edu -# [D_Thomas_Podnar] D. Thomas Podnar mailto:tomµlite.com 2015-11-04 -# [Daegis_Inc] Daegis, Inc. mailto:ianaportmaster&daegis.com 2012-07-31 -# [Dagfinn_Saether] Dagfinn Saether mailto:Dagfinn&admins.com -# [Daisuke_Shinomiya] Daisuke Shinomiya mailto:shinomiya.daisu&jp.fujitsu.com 2005-08 -# [Daivd_P_Chassin] Daivd P. Chassin mailto:david.chassin&pnl.gov 2002-06 -# [Dale_Bethers] Dale Bethers mailto:dbethers&novell.com -# [Dale_Norman] Dale Norman mailto:dnorman&informatica.com -# [Dalit_Naor] Dalit Naor mailto:dalit&il.ibm.com -# [Dameon_Wagner] Dameon Wagner mailto:d.wagner&freemail.absa.co.za 2002-02 -# [Damian_Tarnawsky] Damian Tarnawsky mailto:support&nexusconcepts.com -# [Damien_Miller] Damien Miller mailto:damien&ibs.com.au -# [Damien_Plisson] Damien Plisson Audirvana SCS mailto:damien78&audirvana.com 2015-07-21 -# [Damir_Skrjanec] Damir Skrjanec mailto:damir.skrjanec&cybrotech.co.uk 2007-05 -# [Damon_Danieli] Damon Danieli mailto:damondµsoft.com -# [Damon_Ennis] Damon Ennis mailto:damon&silver-peak.com 2007-03 -# [Dan_Amstutz] Dan Amstutz mailto:dan&iliumsoft.com -# [Dan_Bernstein] Dan Bernstein mailto:djb&silverton.berkeley.edu -# [Dan_Bernstein_2] Dan Bernstein mailto:djb&cr.yp.to -# [Dan_Bernstein_3] Dan Bernstein mailto:djb&koobera.math.uic.edu -# [Dan_Burrows] Dan Burrows mailto:dburrows&overlandstorage.com 2009-09-25 -# [Dan_Corkill] Dan Corkill Midnight Oil mailto:corkill&mn-oil.com 2013-07-09 -# Enterprises, LLC -# [Dan_Cummings] Dan Cummings mailto:doc&cnr.com -# [Dan_Davis] Dan Davis mailto:Dan.A.Davis&hp.com 2003-04 -# [Dan_Flowers] Dan Flowers mailto:flowers&smaug.lkg.dec.com -# [Dan_Goff] Dan Goff mailto:Dan.Goff&ngc.com -# [Dan_Harkins] Dan Harkins mailto:dharkins&lounge.org 2011-08-15 -# [Dan_Harrington] Dan Harrington mailto:dth&lucent.com -# [Dan_Klein] Dan Klein mailto:dvk&lonewolf.com -# [Dan_Leising] Dan Leising mailto:dleisingµsoft.com 2005-01 -# [Dan_Mahn] Dan Mahn mailto:dan.mahn&digidescorp.com -# [Dan_Newman] Dan Newman Oracle Corp. mailto:dan.c.newman&oracle.com 2013-09-20 -# [Dan_Polivy] Dan Polivy mailto:dpolivyµsoft.com 2008-03-12 -# [Dan_Razzell] Dan Razzell mailto:dan&starfishsystems.ca 2006-06 -# [Dan_Shia] Dan Shia mailto:dset!shia&uunet.uu.net -# [Dan_Smith] Dan Smith mailto:dan.smith&den.galileo.com -# [Dan_Wing] Dan Wing mailto:dwing&cisco.com 2015-10-08 -# [Dana_Blair] Dana Blair mailto:dblair&cisco.com 2004-06 -# [Dana_Doggett] Dana Doggett Stoneware Inc. mailto:dana.doggett&stone-ware.com 2012-05-18 -# [Dana_Porter] Dana Porter mailto:dana.porter&sun.com 2003-10 -# [Daniel_Becker] Daniel Becker mailto:becker2d&ttc.com -# [Daniel_Becker_2] Daniel Becker mailto:beckerd&ttc.com -# [Daniel_Becker_3] Daniel Becker mailto:dbecker&v-one.com -# [Daniel_Becker_4] Daniel Becker mailto:Dan.Becker&fortisphere.com 2008-06-03 -# [Daniel_Birns] Daniel Birns mailto:daniel&globes.com -# [Daniel_C_McGloin] Daniel C. McGloin mailto:daniel_mcgloin&intuit.com 2005-05 -# [Daniel_Friedman] Daniel Friedman mailto:dfriedman&hns.com 2003-08 -# [Daniel_G_Taylor] Daniel G. Taylor mailto:dan&programmer-art.org 2007-11 -# [Daniel_Grazioli] Daniel Grazioli mailto:dgrazioli&pgaero.co.uk -# [Daniel_Heffernan] Daniel Heffernan mailto:me&daniel.ie -# [Daniel_Holth] Daniel Holth mailto:dholth&fastmail.fm 2012-04-24 -# [Daniel_J_Walsh] Daniel J Walsh mailto:dwalsh&bindview.com -# [Daniel_Julio_Reyes] Daniel Julio Reyes mailto:danieljreyes&yahoo.com 2003-08 -# [Daniel_Kilsdonk] Daniel Kilsdonk mailto:dan&prospeed.net 2006-08 -# [Daniel_Mavrakis] Daniel Mavrakis mailto:system&venus.mctel.fr -# [Daniel_Mavrakis_2] Daniel Mavrakis mailto:mavrakis&mctel.fr -# [Daniel_R_Somerfield] Daniel R Somerfield mailto:dsomerfi&harris.com 2011-08-05 -# [Daniel_Ruppert] Daniel Ruppert mailto:daniel&kaffi.lu 2010-09-16 -# [Daniel_Simms] Daniel Simms mailto:dsimms&acm.uiuc.edu -# [Daniel_Sisk] Daniel Sisk mailto:daniel.sisk&pnl.gov -# [Daniel_Sorlov] Daniel Sorlov mailto:Daniel&sorlov.com -# [Daniel_Sorlov_2] Daniel Sorlov mailto:daniel&sorlov.com 2002-06 -# [Daniel_Steinberg] Daniel Steinberg mailto:daniel&oreilly.com -# [Daniel_Stodle] Daniel Stodle mailto:daniels&cs.uit.no -# [Daniel_Story] Daniel Story mailto:dan&guy-tek.com 2008-01-25 -# [Daniel_Tappan] Daniel Tappan mailto:Tappan&bbn.com -# [Daniel_W_Antonuk] Daniel W. Antonuk mailto:dantonuk&etcconnect.com 2006-05 -# [Daniel_Whelan] Daniel Whelan mailto:dwhelan&filenet.com -# [Daniel_Wippermann] Daniel Wippermann mailto:Daniel.Wippermann&resol.de -# [Danko_Alexeyev] Danko Alexeyev mailto:virtuall&virtuall.info 2007-08-08 -# [Dany_Ayotte] Dany Ayotte mailto:ayotte&teamsoft.com 2002-07 -# [Danzhou_Liu] Danzhou Liu Symantec mailto:Danzhou_Liu&symantec.com 2012-05-07 -# [Dario_S_Tonesi] Dario S. Tonesi mailto:dario.tonesi&nsn.com 2011-02-07 -# [Dark_Horse_GmbH_Co_KG] Dark Horse GmbH & Co mailto:l.kannicht&thedarkhorse.de 2015-06-02 -# KG -# [Darrell_Schiebel] Darrell Schiebel mailto:dschieb&cv.nrao.edu -# [Darrin_Smart] Darrin Smart mailto:dns-sd&filmlight.ltd.uk -# [Darshan_Shah] Darshan Shah mailto:darshan.shah&ni.com -# [Darwin_Ammala] Darwin Ammala mailto:dammala&harris.com 2007-03 -# [Daryle_DeBalski] Daryle DeBalski mailto:ddebalski&optika.com -# [Data_Access_Inc] Data Access, Inc. mailto:development&dataaccessinc.com 2012-04-30 -# Data Storage -# [Data_Storage_Institu] Institute of mailto:Patrick&dsi.nus.edu.sg 2002-02 -# Singapore -# [Datacolor] Datacolor mailto:hbarber&datacolor.com 2011-10-14 -# [Datalogic_ADC_Inc] Datalogic ADC, Inc mailto:ReceptionBLQ&datalogic.com 2014-07-31 -# [Dave_Bellivea] Dave Bellivea mailto:DaveBelliveau&corsof.com -# [Dave_Belliveau] Dave Belliveau mailto:DaveBelliveau&cornerstonesoftware.com -# [Dave_Benton] Dave Benton mailto:dave.benton&eaglepoint.com -# [Dave_Buehmann] Dave Buehmann mailto:ingr!daveb&uunet.uu.net -# [Dave_Carrigan] Dave Carrigan mailto:dave&openshut.net -# [Dave_Chapman] Dave Chapman mailto:dave.chapman&buildings.schneider-electric.com 2011-06-06 -# [Dave_Christianson] Dave Christianson mailto:dbc1&cs.washington.edu -# [Dave_Clark] Dave Clark mailto:ddc&lcs.mit.edu -# [Dave_Craft] Dave Craft mailto:gpfs&ibm.com 2004-11 -# [Dave_DesRoches] Dave DesRoches mailto:ddesroches&clariion.com -# [Dave_Feinleib] Dave Feinleib mailto:davefeµsoft.com -# [Dave_Gimpl] Dave Gimpl mailto:gimpl&us.ibm.com 2003-01 -# [Dave_Hatz] Dave Hatz mailto:dave.hatz&avisystems.com 2015-09-18 -# [Dave_Hines] Dave Hines mailto:d.hines&high-availability.com 2004-11 -# [Dave_Howell] Dave Howell mailto:dave&avatron.com -# [Dave_Hubbard] Dave Hubbard mailto:dave&icc.net -# [Dave_Inman] Dave Inman mailto:davei&mxim.com -# [Dave_Jagoda] Dave Jagoda mailto:dj&opsware.com 2006-06 -# [Dave_Katz] Dave Katz mailto:dkatz&juniper.net 2006-02 -# [Dave_Lamb] Dave Lamb mailto:rdl&rdl.cnd.hp.com -# [Dave_LeBlang] Dave LeBlang mailto:leglang&atria.com -# [Dave_Lindquist] Dave Lindquist mailto:dlindquist&egistix.com 2010-05-27 -# [Dave_Lindquist_2] Dave Lindquist mailto:dlindquist&egistix.com -# [Dave_Lyons] Dave Lyons mailto:dlyons&dnpg.com -# [Dave_Maxwell] Dave Maxwell mailto:d.maxwell&cablelabs.com -# [Dave_Mills] Dave Mills mailto:mills&udel.edu -# [Dave_Mills_2] Dave Mills mailto:Mills&huey.udel.edu -# [Dave_Nesbitt] Dave Nesbitt mailto:nesbitt&cp10.es.xerox.com -# [Dave_Neudoerffer] Dave Neudoerffer mailto:Dave.Neudoerffer&ianywhere.com -# [Dave_Neudoerffer_2] Dave Neudoerffer mailto:dave.neudoerffer&sybase.com 2009-11-18 -# [Dave_Porter] Dave Porter mailto:porter&mango.com -# [Dave_Reiland] Dave Reiland mailto:dave.reiland&netex.com 2003-11 -# [Dave_Robin] Dave Robin mailto:iana_ports&daverobin.com -# [Dave_Ross] Dave Ross mailto:david.ross&ca.com -# [Dave_Ruedger] Dave Ruedger mailto:daver&datalode.com 2003-11 -# [Dave_Sewell] Dave Sewell mailto:dave&sewelldev.com -# [Dave_Simmons] Dave Simmons mailto:dsimmons¯omedia.com -# [Dave_Spencer] Dave Spencer mailto:dspencer&xingtech.com -# [Dave_Springer] Dave Springer mailto:daves&apple.com -# [Dave_Stampe] Dave Stampe mailto:dstampe&psych.toronto.edu -# [Dave_Stone] Dave Stone mailto:dstone01&harris.com 2002-09 -# [Dave_Stoneham] Dave Stoneham mailto:dave&mulberry-consultants.co.uk 2008-03-10 -# [Dave_Thaler] Dave Thaler mailto:thalerd&eecs.umich.edu -# [Dave_Thaler_2] Dave Thaler mailto:dthalerµsoft.com -# [Dave_Ward] Dave Ward mailto:dward&cisco.com 2006-02 -# [Dave_Watkins] Dave Watkins mailto:davew&boi.hp.com -# [Dave_Wierbowski] Dave Wierbowski mailto:wierbows&us.ibm.com 2006-08 -# [Davey_Taylor] Davey Taylor mailto:davey.taylor&brimstone.net 2003-02 -# [David_A_Gayler] David A. Gayler mailto:David.Gayler&bindview.com 2005-08 -# [David_A_Gayler_2] David A. Gayler mailto:dgayler&eminentware.com 2006-07 -# [David_A_Gomberg] David A. Gomberg mailto:gomberg&gateway.mitre.org -# [David_A_Lethe] David A. Lethe mailto:david_lethe&us.xyratex.com 2003-04 -# [David_A_Lethe_2] David A. Lethe mailto:david&santools.com 2013-12-09 -# [David_Anderson] David Anderson mailto:davea&ssl.berkeley.edu 2004-11 -# [David_Anthony] David Anthony mailto:anthony&power.amasd.anatcp.rockwell.com -# [David_Anuszewski] David Anuszewski mailto:david.anuszewski&siemens.com 2004-11 -# [David_Arko] David Arko mailto:darko&hpfcrn.fc.hp.com -# [David_Arnold] David Arnold mailto:davida&pobox.com -# [David_Ashkenazi] David Ashkenazi mailto:david&synel.co.il 2010-03-23 -# [David_Ashley] David Ashley mailto:david.ashley.ibm&gmail.com 2009-07-24 -# [David_Aspinwall] David Aspinwall mailto:aspinwall×ten.com 2003-04 -# [David_B_Hon] David B. Hon mailto:hon&astro.ufl.edu 2003-03 -# [David_Barrass] David Barrass mailto:dbarrass&bartecautoid.com 2006-01 -# [David_Barrass_2] David Barrass mailto:david.barrass&minorplante.com 2003-11 -# [David_Berk] David Berk mailto:dberk&ping-0.com 2007-08-30 -# [David_Bisset] David Bisset mailto:dbisset&mvel.demon.co.uk -# [David_Borman] David Borman mailto:david.borman&quantum.com 2015-02-05 -# [David_Bourland] David Bourland mailto:DBourland&smausa.com -# [David_Brandon] David Brandon mailto:dade&smoolabs.net 2006-08 -# [David_Brower] David Brower mailto:david.brower&oracle.com -# [David_Catmull] David Catmull mailto:uncommon&uncommonplace.com 2006-01 -# [David_Chassin] David Chassin mailto:david.chassin&pnl.gov 2010-12-10 -# [David_Chell] David Chell mailto:david&softlife.co.nz -# [David_Cheng] David Cheng mailto:davec&aesclever.com 2010-02-01 -# [David_Clark] David Clark mailto:ddc&lcs.mit.edu -# [David_Clunie] David Clunie mailto:dclunie&dclunie.com 2005-08 -# [David_Cooper] David Cooper mailto:david.cooper&oracle.com -# [David_Crewson] David Crewson mailto:davidc&eydeas.net 2004-09 -# [David_Crowe] David Crowe mailto:dcrowe&faronics.com 2008-01-07 -# [David_Dion] David Dion mailto:David.Dionµsoft.com 2009-02-12 -# [David_Duncan] David Duncan mailto:dduncan&es.com -# [David_Dunetz] David Dunetz mailto:david&sweetware.com -# [David_Elliman] David Elliman Legentis Ltd mailto:dave&legentis.com 2013-07-01 -# [David_Ely] David Ely mailto:dely&cnri.reston.va.us -# [David_Erel] David Erel EMC mailto:david.erel&emc.com 2013-09-18 -# [David_F_Skoll] David F. Skoll mailto:dfs&roaringpenguin.com 2010-02-05 -# [David_Farajun] David Farajun mailto:dfarajun&asigra.com 2004-11 -# [David_Ferguson] David Ferguson mailto:dferguson&xtralot.com 2002-02 -# [David_Ferrero] David Ferrero mailto:david&zion.com -# [David_Fudge] David Fudge mailto:david.fudge&tssi.co.uk 2003-08 -# [David_Gayler] David Gayler SolarWinds mailto:david.gayler&solarwinds.com 2013-05-29 -# [David_Goldberg] David Goldberg mailto:dgoldberg&callisto.com -# [David_Goodall] David Goodall mailto:david.goodall&g2microsystems.com 2007-02 -# [David_Greer] David Greer mailto:david_greer&robelle.com -# [David_Gutierrez] David Gutiérrez Velneo mailto:velneo&velneo.com 2015-02-03 -# [David_HM_Spector] David HM Spector mailto:spector&zeitgeist.com -# [David_Hagood] David Hagood mailto:david.hagood&aeroflex.com -# [David_Hampson] David Hampson mailto:davidha&codemasters.com -# [David_Holden] David Holden mailto:mdh&rentek.net -# [David_Hornsby] David Hornsby mailto:djh&munnari.oz.au -# [David_Hua] David Hua mailto:davhuaµsoft.com -# [David_Hughes] David Hughes mailto:bambi&hughes.com.au -# [David_Ison] David Ison mailto:here&dialup.oar.net -# [David_J_Wilson] David J. Wilson mailto:djw&arbortext.com -# [David_Jones] David Jones mailto:djones&cincom.com -# [David_Ko] David Ko mailto:dko&autodesk.com -# [David_Ko_2] David Ko mailto:david.dk.ko&gmail.com 2009-09-14 -# [David_Kramer] David Kramer mailto:dkramer&apple.com 2004-11 -# [David_Kramer_2] David Kramer mailto:dkramer&apple.com -# [David_Lasker] David Lasker mailto:dave&altosdesign.com -# [David_Leinbach] David Leinbach mailto:dleinbach&jti.bc.ca -# [David_Lemson] David Lemson mailto:dlemsonµsoft.com -# [David_Lethe] David Lethe mailto:david&santools.com 2010-12-24 -# [David_Luxford] David Luxford mailto:david.luxford&asg.com 2010-07-01 -# [David_M_Gay] David M. Gay AMPL Optimization, mailto:dmg&l.com 2012-05-25 -# Inc. -# [David_M_O_Rourke] David M. O'Rourke mailto:daveo&apple.com 2003-01 -# [David_M_Rhodes] David M. Rhodes mailto:davidrho&cnd.hp.com -# [David_Manns] David Manns mailto:davidm&pulsonix.com 2008-02-28 -# StorageCraft -# [David_McConkie] David McConkie Technology mailto:dave.mcconkie&storagecraft.com 2014-12-17 -# Corporation -# [David_McLaughlin] David McLaughlin mailto:davidmclaughlin&accessdata.com 2004-11 -# [David_McMarlin] David McMarlin mailto:david.mcmarlin&oracle.com 2006-08 -# [David_Meermans] David Meermans mailto:david.meermans&aastra.com -# [David_Merchant] David Merchant mailto:d.f.merchant&livjm.ac.uk -# [David_Miller] David Miller mailto:dave.dsm&gmail.com 2007-02 -# [David_Misunas] David Misunas mailto:DMisunas&micom.com -# [David_Mojdehi] David Mojdehi mailto:david.mojdehi&autodesk.com 2002-04 -# [David_Moore] David Moore mailto:dmoore&uttc-uts.com -# [David_Muller] David Müller mailto:david.muller.cz&gmail.com 2015-02-22 -# [David_Nanian] David Nanian mailto:dnanian&shirt-pocket.com 2007-09-28 -# [David_Nanian_2] David Nanian mailto:dnanian&shirt-pocket.com -# [David_Nash] David Nash mailto:dnash&ford.com -# [David_Ott] David Ott mailto:dott&qualcomm.com 2010-10-15 -# [David_Page] David Page mailto:david.page&sun.com 2005-08 -# [David_Pinch] David Pinch mailto:dpinch&mtl-inst.com 2002-04 -# [David_Priest] David Priest mailto:priest&sfu.ca -# [David_Reed] David Reed -# [David_Riggle] David Riggle mailto:dave&busymac.com 2008-01-07 -# [David_Roberts] David Roberts mailto:David.Roberts&ca.com 2005-05 -# [David_Rouchet] David Rouchet mailto:david.rouchet&medialon.com 2007-05 -# [David_Schwartz] David Schwartz mailto:davids&webmaster.com -# [David_Schwartz_2] David Schwartz mailto:david.schwartz&marathontechnologies.com 2009-06-18 -# [David_Sechrest] David Sechrest mailto:david.sechrest&oracle.com 2010-09-22 -# [David_Shaw] David Shaw mailto:dshaw&jabberwocky.com 2003-05 -# [David_Sinclair] David Sinclair mailto:dev&profilemac.com 2006-05 -# [David_Sinclair_2] David Sinclair mailto:bonjour&profilemac.com -# [David_Snocken] David Snocken tel:+44-71-437-7009 -# [David_Spencer] David Spencer mailto:dspencer&telops.com -# [David_Sperling] David Sperling mailto:dsperling&smithmicro.com 2006-06 -# [David_Sperling_2] David Sperling Smith Micro Software, mailto:dsperling&smithmicro.com 2011-10-10 -# Inc. -# [David_Spivey] David Spivey mailto:DavidTSpivey&gmail.com 2010-08-30 -# [David_Stephenson] David Stephenson mailto:david_stephenson&hp.com -# [David_Straw] David Straw mailto:david.straw&hp.com 2005-11 -# [David_Suffield] David Suffield mailto:david.suffield&hp.com 2006-05 -# [David_T_Hines] David T. Hines mailto:david.hines&intel.com 2005-02 -# [David_Thielen] David Thielen mailto:support&windward.net -# [David_Thompson] David Thompson mailto:theta&theta-ent.com -# [David_Tong] David Tong mailto:David_Tong&integrated.mb.ca -# [David_Troeger] David Troeger mailto:David_Troeger&dell.com -# [David_Turner] David Turner mailto:digital&quetico.tbaytel.net -# [David_V_Raskin] David V. Raskin mailto:draskin&rimage.com 2006-02 -# [David_Vaughn] David Vaughn mailto:dvaughn&atterotech.com 2015-09-24 -# [David_Vest] David Vest mailto:dave&mythicsoft.com 2008-11-19 -# [David_Vossel] David Vossel mailto:dvossel&redhat.com 2013-03-15 -# [David_W_Radcliffe] David W. Radcliffe mailto:info&radsolution.co.uk -# [David_Walend] David Walend mailto:david&walend.net -# mailto:dev&salutafugijms.dev.java.net -# [David_Walling] David Walling mailto:sylvanhollow&yahoo.com 2006-03 -# [David_Walling_2] David Walling mailto:dwalling&isoft.com -# [David_Warden] David Warden mailto:david_warden&symantec.com 2008-11-17 -# [David_Warden_2] David Warden mailto:warden&nupaper.com 2005-11 -# [David_Weinstein] David Weinstein mailto:david.weinstein&redstorm.com -# [David_Weisgerber] David Weisgerber mailto:david.weisgerber&printsoft.de 2007-09-27 -# [David_Wilson] David Wilson mailto:dwilson&integral-ie.com -# [David_Wiltz] David Wiltz mailto:dwiltz&hf.intel.com -# [David_Wooden] David Wooden mailto:dwooden&wizdom.com -# [David_Yon] David Yon mailto:yon&tactical-sw.com -# [David_Yon_2] David Yon mailto:dyon&dialout.net 2002-05 -# [David_Young] David Young mailto:david.young&ccsseurope.co.uk 2006-01 -# [David_Zimmerman] David Zimmerman mailto:dpz&rutgers.edu -# [Davoud_Maha] Davoud Maha mailto:dmaha&saba.com -# [Dawei_Qi] Dawei Qi mailto:dqi&galaxytelecomms.com 2010-07-07 -# [DeVoeSquared] DeVoeSquared mailto:support&devoesquared.com -# [De_Chih_Chien] De-Chih Chien mailto:de-chih_chien&symantec.com 2008-10-06 -# [Dean_Blackketter] Dean Blackketter mailto:dean&corp.webtv.net -# [Dean_Blackketter_2] Dean Blackketter mailto:dean&slimdevices.com -# [Dean_Dauger] Dean Dauger mailto:D&daugerresearch.com -# [Dean_Robson] Dean Robson mailto:dean.robson&fujitsu.com.au -# [Dean_Skelton] Dean Skelton mailto:mdskel&ftw.rsc.raytheon.com -# [Dean_Webb] Dean Webb mailto:dean.webb&ascend.com -# [Decisive_Tactics_Inc] Decisive Tactics, mailto:ckent&decisivetactics.com 2015-04-09 -# Inc. -# [Deerfield_Communications_Inc] Deerfield mailto:mikec&deerfield.net 2015-07-15 -# Communications Inc. -# [DEIF_AS] DEIF A/S mailto:aes&deif.com 2012-10-15 -# [Delcio_Prizon] Delcio Prizon mailto:dprizon&smar.com.br -# [Dell] Dell mailto:jessica_z&dell.com 2012-11-19 -# [Dell_2] Dell mailto:rob.gri55in&gmail.com 2013-10-03 -# [Delphix_Corp] Delphix Corp mailto:peng.dai&delphix.com 2012-11-01 -# [Denis_Aull] Denis Aull Red Lion Controls mailto:Engineering&RedLion.net 2014-05-21 -# [Denis_Ducharme] Denis Ducharme mailto:dducharme&softek.com -# [Denis_Leclerc] Denis Leclerc mailto:DLeclerc&banyan.com -# [Denise_Eckstein] Denise Eckstein mailto:denise.eckstein&hp.com 2004-11 -# [Denise_Fernandez] Denise Fernandez mailto:dcbfernandez&gmail.com -# [Dennis_Batchelder] Dennis Batchelder mailto:dennis&capres.com -# [Dennis_Dube] Dennis Dube mailto:dennis.dube&schneider-electric.com 2014-06-10 -# [Dennis_Mastin] Dennis Mastin mailto:dennis&tasmania.platte.com -# [Dennis_Parker] Dennis Parker mailto:dparker&broadcloud.com 2002-02 -# [Dennis_Reinhardt] Dennis Reinhardt mailto:DennisR&dair.com -# [Derick_Snyder] Derick Snyder mailto:dsnyder&rainbow.com -# [Dermot_Tynand] Dermot Tynand mailto:dtynan&claddagh.ie -# [Derrick_Hisatake] Derrick Hisatake mailto:derrick.i.hisatake&intel.com -# [Desmond_Chan] Desmond Chan mailto:deschan&prismedia.com -# [Detlef_Rothe] Detlef Rothe mailto:detlef.rothe&ts.fujitsu.com 2009-05-15 -# [Detlef_Stoever] Detlef Stoever mailto:mail&ivotec.com 2003-03 -# Deutschland Informations -# [Deutschland_Informat] und mailto:beratung&dirg.de -# Reservierungsgesellschaft -# mbH -# [Developer_Support] Developer Support mailto:devsupport&tivo.com -# [Developer_Support_2] Developer Support TiVo Inc. mailto:devsupport&tivo.com 2011-10-18 -# [Devjani_Ray] Devjani Ray Oracle Corporation mailto:Devjani.Ray&oracle.com 2012-04-20 -# [Devon_Dawson] Devon Dawson mailto:devon.dawson&hp.com 2003-11 -# [Devon_Taylor] Devon Taylor mailto:dtaylor&novell.com -# [DEVONtechnologies_LLC] DEVONtechnologies, mailto:info&devontechnologies.com 2011-10-18 -# LLC -# [Devrex_Labs] Devrex Labs mailto:robert.friberg&devrex.se 2013-03-29 -# [DEY_Storage_Systems_Inc] DEY Storage Systems, mailto:garrett&dey-sys.com 2013-03-01 -# Inc. -# [Dhillesh_Sigilipelli] Dhillesh Sigilipelli AT&T mailto:ds978v&att.com 2014-08-21 -# [Dialectro_Software] Dialectro Software mailto:g&dialectro.com 2011-10-20 -# [Diane_Downie] Diane Downie mailto:downie&jibe.mv.com -# [Diane_I_Shannon] Diane I. Shannon mailto:shannond&us.ibm.com 2007-04 -# [Dick_Augustsson] Dick Augustsson mailto:dick&skenbe.net -# [Dick_Georges] Dick Georges mailto:georges&monaco.net 2002-02 -# [Dick_van_der_Sijs] Dick van der Sijs mailto:dick&and.nl -# [Didier_Cabannes] Didier Cabannes mailto:Didier&matisse.com 2004-11 -# [Didier_Lahay] Didier Lahay mailto:dlahay&sierrawireless.com 2013-02-22 -# [Diego_Crupnicoff] Diego Crupnicoff (IBTA mailto:diego&mellanox.com 2014-10-17 -# TWG Chair) -# [Diego_Dias] Diego Dias SIMB Tecnologia mailto:diego&simb.com.br 2014-11-07 -# [Diego_Friedel] Diego Friedel mailto:d.friedel&avm.de 2006-03 -# [Diego_Negre] Diego Negre Nuance Communications mailto:Diego.Negre&nuance.com 2012-10-05 -# [Diego_Ongaro] Diego Ongaro mailto:ongaro&cs.stanford.edu 2015-04-14 -# [Diego_Santa_Cruz] Diego Santa Cruz SpinetiX S.A. mailto:Diego.SantaCruz&spinetix.com 2011-10-18 -# [Diego_Saravia] Diego Saravia mailto:dsa&unsa.edu.ar -# [Dieter_Siegmund] Dieter Siegmund mailto:dieter&apple.com 2007-10-22 -# [Dietmar_Finkler] Dietmar Finkler mailto:d.finkler&hermstedt.de -# [DIFUSI_Inc] DIFUSI, Inc. mailto:mike&difusi.com 2011-11-07 -# [Dima_Seliverstov] Dima Seliverstov mailto:Dima_Seliverstov&bmc.com 2009-07-28 -# [Dimitrios_Souflis] Dimitrios Souflis mailto:dsouflis&altera.gr -# [Dimitris_Michelinaki] Dimitris Michelinakis mailto:dimitris&michelinakis.gr 2002-05 -# [Dinkar_Chivaluri] Dinkar Chivaluri mailto:dinkar&veritas.com -# [Dinkar_Chivaluri_2] Dinkar Chivaluri mailto:dchivaluri&imperfectnetworks.com 2006-02 -# [Dino_Ciano] Dino Ciano mailto:DCiano&tickets.com 2011-03-02 -# [Dino_Farinacci] Dino Farinacci mailto:dino&cisco.com 2008-08-21 -# [Dion_Slijp] Dion Slijp mailto:dion.slijp&oce.com -# [Dirk_Hillbrecht] Dirk Hillbrecht mailto:dirk&hillbrecht.de -# [Dirk_Koopman] Dirk Koopman mailto:djk&tobit.co.uk 2005-08 -# [Dirk_Kutscher] Dirk Kutscher mailto:dku&informatik.uni-bremen.de -# [Dirk_Materlik] Dirk Materlik mailto:materlik&blubbsoft.de 2005-11 -# [Dirk_Steinmetz] Dirk Steinmetz mailto:ds&generalsync.com 2014-04-17 -# [Dirk_Stoop] Dirk Stoop mailto:dirk&madebysofa.com 2007-04 -# [Dmitri_Znosko] Dmitri Znosko mailto:support&radmin.com 2003-03 -# [Dmitry_Brant] Dmitry Brant mailto:dmitry_brant&lincolnelectric.com 2007-03 -# [Dmitry_Isakbayev] Dmitry Isakbayev mailto:dmitry&transnexus.com 2010-03-05 -# [Dmitry_Krasnonosenki] Dmitry Krasnonosenkikh mailto:Dmitry_Krasnonosenkih&nmss.com -# [Dmitry_Obuvalin] Dmitry Obuvalin mailto:pulse.cc&mail.ru 2006-02 -# [DOCKER] DOCKER mailto:iana&cdl.asgaard.org 2014-04-17 -# [Dolores_Scott] Dolores Scott mailto:Dolores.Scott&l-3security.com -# [Dolores_Scott_2] Dolores Scott mailto:dolores.scott&l-3security.com -# [Domain_Tech] Domain Tech mailto:Domainnametech&blizzard.com 2005-04 -# [Dominick_Cafarelli] Dominick Cafarelli mailto:dominick.cafarelli&networkgeneral.com 2005-08 -# [Dominique_Lelievre] Dominique Lelievre mailto:dominique.lelievre&fr.ibm.com 2003-01 -# [DOMIQ_Sp_zoo] DOMIQ Sp. z o.o. mailto:registries&domiq.pl 2011-08-29 -# [Don_Bowman] Don Bowman mailto:don&pixstream.com -# [Don_Gibson] Don Gibson mailto:sequent!aero!twinsun!ashtate.A-T.COM!dong&uunet.UU.NET -# [Don_Gilbreath] Don Gilbreath mailto:don&comcam.net 2002-09 -# [Don_Hejna] Don Hejna mailto:djhejna&ambit.com -# [Don_Loughry] Don Loughry mailto:DON_LOUGHRY&hp-cupertino-om4.om.hp.com -# [Don_Marselle] Don Marselle mailto:don.marselle&3par.com 2008-04-09 -# [Don_Merrell] Don Merrell mailto:donmer&axent.com -# [Don_Oliver] Don Oliver mailto:don&donnyworld.com -# [Don_Payette] Don Payette mailto:Don.Payette&unisys.com -# [Don_Provan] Don Provan mailto:donp&xlnvax.novell.com -# [Don_Provan_2] Don Provan mailto:donp&sjf.novell.com -# [Don_Stedman] Don Stedman mailto:dones&stisystems.com -# [Don_Sullivan] Don Sullivan mailto:donald.v.sullivan&nasa.gov 2010-02-16 -# [Don_Traub] Don Traub mailto:don.traub&sun.com -# [Don_Tyson] Don Tyson -# [Don_Tyson_2] Don Tyson mailto:don.tyson&cor.dowjones.com -# [Don_W_Fitzpatrick] Don W. Fitzpatrick mailto:dwf&internetworxsystems.com 2005-08 -# [Don_Woodward] Don Woodward mailto:dwoodward&rokulabs.com -# [Donald_Cornwell] Donald Cornwell mailto:don.cornwell&objective.com -# [Donald_Cornwell_2] Donald Cornwell -# [Donald_D_Woelz] Donald D. Woelz mailto:don&genroco.com -# [Donald_Dylla] Donald Dylla mailto:donald.dylla&hp.com 2004-12 -# [Donald_E_Eastlake] Donald E. Eastlake 3rd mailto:d3e3e3&gmail.com -# [Donald_Eastlake] Donald Eastlake mailto:d3e3e3&gmail.com -# [Donald_G_Kallgren] Donald G. Kallgren mailto:Donald.Kallgren&nc3a.nato.int -# [Donald_Welch] Donald Welch mailto:donald.welch&hp.com 2006-05 -# [Donghwan_Lim] Donghwan Lim mailto:donghwan.lim&t-mobile.com 2008-01-22 -# [Dongkeun_Kim] Dongkeun Kim mailto:dongkeun70.kim&samsung.com 2007-02 -# [Dongling_Wang] Dongling Wang mailto:dongling&finle.com -# [Donna_Dillenberger] Donna Dillenberger mailto:engd&us.ibm.com -# [Donny_Gilor] Donny Gilor mailto:dgilor&pop01.ny.us.ibm.net -# [Doriano_Blengino] Doriano Blengino mailto:tecnico_remove_&_remove_xonelectronics.it -# [Dotan_Ofek] Dotan Ofek mailto:dotan.ofek&prizmasoft.com 2005-12 -# [Doug_Boone] Doug Boone mailto:dboone&atg.clr.com -# [Doug_Dillon] Doug Dillon mailto:dillon&hns.com -# [Doug_Grover] Doug Grover mailto:dgrover&phonex.com -# [Doug_Karl] Doug Karl mailto:KARL-D&osu-20.ircc.ohio-state.edu -# [Doug_Kent] Doug Kent mailto:mouthers@slugg&nwnexus.wa.com -# [Doug_Leany] Doug Leany mailto:DLEANY&opto22.com 2006-09 -# [Doug_Rosenthal] Doug Rosenthal mailto:rosenthl&krypton.einet.net -# [Doug_Royer] Doug Royer mailto:DouglasRoyer&gmail.com 2010-12-09 -# [Doug_Wyatt] Doug Wyatt mailto:dwyatt&apple.com -# [Douglas_Crockford] Douglas Crockford mailto:douglas&crockford.com -# [Douglas_Davidson] Douglas Davidson mailto:drd&apple.com 2002-06 -# [Douglas_Goodall] Douglas Goodall mailto:douglas_goodall&mac.com 2009-08-05 -# [Douglas_Kadlecek] Douglas Kadlecek mailto:doug&dkware.com 2004-11 -# [Douglas_Knisely] Douglas Knisely mailto:dnk&lucent.com -# [Douglas_M_Gaer] Douglas M. Gaer mailto:doug&datareel.com -# [Douglas_McLaggan] Douglas McLaggan mailto:glbp-info&cisco.com -# [Dr_Anupam_Bharali] Dr. Anupam Bharali mailto:paniana&gmail.com 2006-06 -# [Dr_Charles_E_Campb] Dr. Charles E. Campbell mailto:cec&gryphon.gsfc.nasa.gov -# Jr. -# [Dr_Chris_Tucker] Dr. Chris Tucker mailto:chris.tucker&ioltd.co.uk 2005-08 -# [Dr_Horst_Herb] Dr Horst Herb mailto:horst&dorrigomedical.com 2005-12 -# [Dr_Kingsley_C_Nwos] Dr. Kingsley C. Nwosu mailto:knwosu&aglowmail.com 2003-04 -# [Dr_Matthias_Arnold] Dr. Matthias Arnold mailto:m.arnold&dasgip.de 2009-03-23 -# [Dr_Michael_Erdmann] Dr. Michael Erdmann mailto:erdmann&ontoprise.de 2004-12 -# [Dr_R_P_Alston] Dr. R.P. Alston mailto:robin&gradient.com -# [Dr_Yair_Shapira] Dr. Yair Shapira mailto:yair&flashnetworks.com -# [Dragos_Pop] Dragos Pop mailto:dragos&cs.ubbcluj.ro -# [Drake_Bankston] Drake Bankston mailto:IANA.KingdomsOnline&gmail.com 2009-08-18 -# [Drew_Davies] Drew Davies Rx Networks Inc. mailto:ddavies&rxnetworks.com 2013-01-24 -# [Drew_Davies_2] Drew Davies Rx Networks Inc. mailto:ddavies&rxnetworks.com 2013-04-25 -# [Drew_Wolff] Drew Wolff mailto:dwolff¢ra.net -# [Dror_Gill] Dror Gill mailto:drorgi&vnet.ibm.com -# [Dror_Harari] Dror Harari mailto:Dror.Harari&isgsoft.com -# [Duane_Gibson] Duane Gibson mailto:ianaportmaster&unify.com -# [Duane_Kiser] Duane Kiser mailto:dkiser&jsexpress.com -# [Duane_Wessels] Duane Wessels mailto:wessels&nlanr.net -# [Dudi_Hazan] Dudi Hazan mailto:dudi&checkpoint.com -# [Duk_Loi] Duk Loi mailto:dloi&peerdirect.com 2005-11 -# [Duncan_Hare] Duncan Hare mailto:Duncan.Hare&synoia.com -# [Dustin_Brand] Dustin Brand mailto:amo&amo.net -# [Dustin_Zack] Dustin Zack mailto:dustin.e.zack&gmail.com 2006-06 -# [e-Watch_Corporation] e-Watch Corporation mailto:jbaird&e-watch.com 2014-05-13 -# [E_Wald] E. Wald mailto:ewald&via.enet.dec.com -# [Ean_Black] Ean Black mailto:eanb&bladesoftware.co.uk 2009-04-08 -# [Earl_Brannigan] Earl Brannigan mailto:earl.brannigan&lindenhous.co.uk -# [Earl_Wallace] Earl Wallace mailto:earlw&apple.com -# [Ecamm_Network_LLC] Ecamm Network, LLC mailto:chris&ecamm.com 2011-10-24 -# [Eckhard_Grieger] Eckhard Grieger mailto:e.grieger&com-on.de -# [Eclipse_Foundation] Eclipse Foundation mailto:license&eclipse.org 2013-02-22 -# [Ed_Barron] Ed Barron -# [Ed_Cain] Ed Cain mailto:cain&edn-unix.dca.mil -# [Ed_Fair] Ed Fair mailto:ed_fair&yahoo.com 2002-11 -# [Ed_Green] Ed Green mailto:egreen&pmeasuring.com -# [Ed_Kress] Ed Kress mailto:eskress&thinknet.com -# [Ed_Metcalf] Ed Metcalf mailto:emetcalf&tripwiresecurity.com -# [Ed_Odjaghian] Ed Odjaghian mailto:edo&datacap.com -# [Ed_Ranney] Ed Ranney mailto:eranney&crestron.com 2003-01 -# [Ed_Vincent] Ed Vincent mailto:edv&concomp.com -# [Eddie_Borjas] Eddie Borjas Beats Electronics mailto:eddie&beatsbydre.com 2013-06-03 -# LLC. -# [Eddie_Kohler] Eddie Kohler IETF dccp WG mailto:kohler&cs.ucla.edu -# [Eden_Sherry] Eden Sherry mailto:eden&pair.com -# [Edgar_Alan_Tu] Edgar Alan Tu mailto:Edgar_Tu&playstation.sony.com 2003-01 -# [Edgar_Blum] Edgar Blum mailto:edgar.blum&swx.ch -# [Edgar_Circenis] Edgar Circenis mailto:ec&fc.hp.com -# [Edo_Yahav] Edo Yahav mailto:standards&expand.com -# [Eduard_de_Jong] Eduard de Jong n-Count Technology mailto:domains&dejongfrz.nl 2013-01-22 -# B.V. -# [Eduardo_Fernandez] Eduardo Fernandez mailto:eduardo.fernandez&avocent.com 2003-08 -# [Eduardo_Rosenberg_de] Eduardo Rosenberg de mailto:eduardor&spacenet.com.br -# Moura -# [Edward_Browdy] Edward Browdy mailto:ebrowdy&cryptek.com 2002-07 -# [Edward_Macomber] Edward Macomber OPNET Technologies mailto:tmacomber&opnet.com 2011-09-21 -# Inc -# [Edward_R_Boedecker] Edward R. Boedecker mailto:boedeck1&flash.net 2003-11 -# [Edward_Reus] Edward Reus mailto:edwardrµsoft.com -# [Edward_T_O_Shea] Edward T. O'Shea mailto:oshea&bellsouth.net -# [Edward_Yim] Edward Yim mailto:eyim&hpmfas4.cup.hp.com -# [EEBus_Initiative] EEBus Initiative mailto:info&eebus.org 2014-11-10 -# [EFKON_AG] EFKON AG mailto:t.kemmer&efkon.com 2011-10-20 -# [Eggert_Thorlacius] Eggert Thorlacius mailto:eggert&menandmice.com 2007-08-30 -# [Eggert_Thorlacius_2] Eggert Thorlacius mailto:eggi&menandmice.com 2010-01-27 -# [Egon_Meier_Engelen] Egon Meier-Engelen mailto:egon.meier-engelen&dlr.de -# [Egon_Technolgies_LLC] Egon Technologies, LLC mailto:james.downs&egontech.com 2015-10-05 -# [Eiki_Iwata] Eiki Iwata mailto:eiki&nd.net.fujitsu.co.jp -# [Eivan_Cerasi] Eivan Cerasi mailto:eivan.cerasi&eurocontrol.int 2008-10-10 -# [Ekkehard_Morgenstern] Ekkehard Morgenstern mailto:ekkehard&ekkehardmorgenstern.de 2003-03 -# [Eldar_Kleiner] Eldar Kleiner INFINIDAT mailto:eldark&infinidat.com 2015-05-01 -# [Eleks_Ltd] Eleks, Ltd. mailto:eleksinfo&eleks.com 2013-04-08 -# [Elgato] Elgato mailto:support&elgato.com -# [Elgato_Systems] Elgato Systems mailto:portinfo&elgato.com 2004-11 -# [Eli_Sternheim] Eli Sternheim mailto:eli&interhdl.com -# [Elias_Sabbagh] Elias Sabbagh mailto:ehs&sabbagh.com -# [Eliot_Blennerhassett] Eliot Blennerhassett mailto:eblennerhassett&audioscience.com 2011-07-07 -# [Eliot_Moss] Eliot Moss mailto:EBM&xx.lcs.mit.edu -# [Elizabeth_Zilen] Elizabeth Zilen mailto:ezilen&newboundary.com 2004-11 -# [Elliot_Murphy] Elliot Murphy mailto:elliot.murphy&gmail.com 2008-07-09 -# [Elliot_Schwartz] Elliot Schwartz mailto:elliot&mit.edu -# [Elwood_Downey] Elwood Downey mailto:ecdowney&clearskyinstitute.com 2002-04 -# [EMC] EMC mailto:david.erel&emc.com 2013-09-18 -# [Emidio_Cunha] Emidio Cunha mailto:emidio&janeladigital.com 2003-11 -# [Emily_Harris] Emily Harris mailto:eharris&newboundary.com 2004-11 -# [Emin_BORU] Emin BORU mailto:emin&danismanlik.net 2004-11 -# [Emmanuel_Bourg] Emmanuel Bourg mailto:smanux&lfjr.net 2004-11 -# [Emmanuel_Merali] Emmanuel Merali mailto:emumerali&gmail.com -# [Emmanuel_Saint_Loube] Emmanuel Saint-Loubert mailto:emmanuel&simplifymedia.com 2008-08-08 -# [Emmanuel_Tychon] Emmanuel Tychon mailto:etychon&cisco.com 2006-03 -# [Emre_Tunar] Emre Tunar mailto:emre.tunar&ca.com 2004-11 -# [Engineering_Dept] Engineering Dept. mailto:domains&badgernt.com -# [Enphase_Energy_Inc] Enphase Energy, Inc. mailto:ceich&enphaseenergy.com 2011-11-08 -# [Enrique_Corujo] Enrique Corujo mailto:enrique&caclearing.com 2006-02 -# [ENSTEAM_Sp_z.o.o.] ENSTEAM Sp. z o.o. mailto:support&ensteam.com 2015-07-08 -# [Environics_Oy] Environics Oy mailto:pasi.nuutinmaki&environics.fi -# [Epipole_Limited] Epipole Limited mailto:info&epipole.com 2014-11-13 -# [eQ-3_Entwicklung_GmbH] eQ-3 Entwicklung GmbH mailto:ports&entwicklung.eq-3.de 2014-05-09 -# [Eran_Gampel] Eran Gampel mailto:eran&aoe6.net -# [Eran_Naveh] Eran Naveh WeFi, Inc. mailto:eranna&wefi.com 2013-07-19 -# [Erhan_Soyer_Osman] Erhan Soyer-Osman mailto:erhansoµsoft.com 2008-03-26 -# [Eric_Anderson] Eric Anderson mailto:eanderson&netvision.com 2003-06 -# [Eric_Boehnisch-Volkmann] Eric Boehnisch-Volkmann DEVONtechnologies, mailto:eboehnisch&devo-technologies.com 2011-10-18 -# LLC -# [Eric_Brown] Eric Brown mailto:sst!emerald!eric&uunet.uu.net -# [Eric_Bruno] Eric Bruno mailto:ebruno&solution-soft.com -# [Eric_Cantineau] Eric Cantineau mailto:eric&securenotebook.com 2004-11 -# [Eric_Carey] Eric Carey mailto:ecarey&corecoimaging.com 2005-08 -# [Eric_Day] Eric Day mailto:eday&oddments.org 2009-01-16 -# [Eric_Dittert] Eric Dittert mailto:Eric_Dittert&ccm.jf.intel.com -# [Eric_Gillet] Eric Gillet mailto:e.gillet&evs.tv -# [Eric_Grange] Eric Grange mailto:egrange&creative-it.net 2002-08 -# [Eric_Hackman] Eric Hackman mailto:ehackman&millapps.com -# [Eric_Harris_Braun] Eric Harris-Braun mailto:eric&glassbead.com 2003-06 -# [Eric_Isom] Eric Isom mailto:eisom&metastorm.com -# [Eric_Jacksch] Eric Jacksch mailto:jacksch&tenebris.ca -# [Eric_Jacobson] Eric Jacobson mailto:eric_jacobson&filemaker.com -# [Eric_Johnson] Eric Johnson mailto:eric&gruver.net -# [Eric_Lan] Eric Lan mailto:elan&d2k.com -# [Eric_Leblond] Eric Leblond mailto:eric&inl.fr 2007-06 -# [Eric_Ledoux] Eric Ledoux mailto:ericleµsoft.com -# [Eric_McMurry] Eric McMurry mailto:emcmurry&crinisnetworks.com 2004-04 -# [Eric_Musgrave] Eric Musgrave Tricerat mailto:emusgrave&tricerat.com 2013-12-09 -# [Eric_Newcomer] Eric Newcomer mailto:eric.newcomer&iona.com -# [Eric_Peterson] Eric Peterson mailto:lcc.eric&seas.ucla.edu -# [Eric_Pulsipher] Eric Pulsipher mailto:eric_pulsipher&hp.com -# [Eric_Pulsipher_2] Eric Pulsipher mailto:eric_pulsipher&fc.hp.com -# [Eric_Rosenfeld] Eric Rosenfeld mailto:e.rosenfeld&cablelabs.com 2003-11 -# [Eric_S_Raymond] Eric S. Raymond mailto:esr&thyrsus.com 2010-04-19 -# [Eric_Sean_Conner] Eric Sean Conner mailto:esconner&me.com 2011-10-17 -# [Eric_Sharakan] Eric Sharakan mailto:ldoms-iana-ports&sun.com 2008-02-14 -# [Eric_Soderberg] Eric Soderberg mailto:seric&cup.hp.com -# [Eric_Soderberg_2] Eric Soderberg mailto:seric&hposl102.cup.hp -# [Eric_St_Onge] Eric St. Onge mailto:stonge&apple.com 2008-01-14 -# [Eric_Thiebaut_George] Eric Thiebaut-George mailto:erict&aurema.com 2006-04 -# [Eric_Thorniley] Eric Thorniley mailto:eric&etcomms.co.uk 2007-09-17 -# [Eric_Welch] Eric Welch -# [Eric_Welch_2] Eric Welch mailto:eric&innosys.com 2003-11 -# [Eric_Whitehill] Eric Whitehill mailto:Eric.Whitehill&itt.com -# [Eric_Wilde] Eric Wilde mailto:eric&funk.com -# [Erica_Liu] Erica Liu mailto:liue&isolation.com -# [Ericko_Shimada] Ericko Shimada mailto:eriko&kel.fujitsu.co.jp -# [Ericsson] Ericsson mailto:erik.hugne&ericsson.com 2012-09-05 -# [Erik_Blume] Erik Blume mailto:erikb&caciasl.com -# [Erik_Hugne] Erik Hugne Ericsson mailto:erik.hugne&ericsson.com 2012-09-05 -# [Erik_Kragh_Jensen] Erik Kragh Jensen mailto:kragh&inet.uni2.dk -# [Erik_Mueller] Erik Mueller mailto:erik&signiform.com -# [Erik_Rogers] Erik Rogers mailto:erik&avatron.com -# [Erik_Sea] Erik Sea mailto:sea&apple.com -# [Erik_Skyten] Erik Skyten mailto:eki&silknet.com -# [Eriko_Shimada] Eriko Shimada mailto:eriko&kel.fujitsu.co.jp -# [Erlang] Erlang/OTP support mailto:epmd&erix.ericsson.se 2004-12 -# [Erwin_Hogeweg] Erwin Hogeweg mailto:erwin&airtech.demon.nl -# [Erwin_Hoffmann] Erwin Hoffmann FEHCom mailto:feh&fehcom.de 2015-01-09 -# [efsta] European Fiscal mailto:dot&efsta.org 2013-08-13 -# Standards Association -# [Eugene_Hopkinson] Eugene Hopkinson VoxelStorm mailto:slowriot&voxelstorm.com 2012-11-08 -# [Etai_Lev_Ran] Etai Lev-Ran mailto:elevran&cisco.com 2005-02 -# [Ethan_Fremen] Ethan Fremen mailto:mindlace&digicool.com -# [Eugen_Bacic] Eugen Bacic mailto:ebacic&texar.com -# [Eugen_Bacic_2] Eugen Bacic mailto:eugen&texar.com -# [Eugene_Cox] Eugene Cox mailto:genecox&raleigh.ibm.com -# [Eugene_Frenkel] Eugene Frenkel mailto:eugene&ada-usa.com 2005-11 -# [Eugene_Osovetsky] Eugene Osovetsky mailto:eugeneo&geocities.com -# [Eugene_Zhiganov] Eugene Zhiganov mailto:zed&dfe3300.karelia.ru 2002-07 -# [Eugeny_Gladkih] Eugeny Gladkih mailto:john&drweb.com 2008-01-31 -# [Evan_Caves] Evan Caves mailto:evan&acc.com -# [Evan_Rosen] Evan Rosen mailto:evan&robix.com 2005-11 -# [Evgeniy_Filatov] Evgeniy Filatov mailto:evgeniyfilatov&yandex.ru 2009-11-25 -# [Ewan_McNab] Ewan McNab mailto:ewan&qsc.co.uk 2004-11 -# [ExoMachina] ExoMachina mailto:hello&exomachina.com 2011-12-06 -# [Extensis] Extensis mailto:webmaster&extensis.com -# [Eyal_Yardeni] Eyal Yardeni mailto:eyal.yardeni&smarts.com 2003-11 -# [Ezinne_Oji] Ezinne Oji mailto:ezinne.oji&t-mobile.com 2006-06 -# [F_Englert] Fl√°vio Englert mailto:flavio&elipse.com.br 2007-09-17 -# [Fabrice_Paget] Fabrice Paget mailto:onefrench&me.com 2012-10-23 -# [Fabrizio_Guglielmino] Fabrizio Guglielmino mailto:guglielmino&infitsrl.com -# [Fabrizio_Massimo_Fer] Fabrizio Massimo Ferrara mailto:fmf&gesi.it 2002-02 -# [Fahad_Gilani] Fahad Gilani mailto:fahad&guidedways.com -# [Faith_Zack] Faith Zack mailto:faithz&sco.com -# [Farid_Faez] Farid Faez mailto:farid_faez&hp.com -# [FAUCONNET_Ingenierie] FAUCONNET Ingénierie mailto:dev&fisa.fr 2011-05-19 -# SA -# [Federico_Heinz] Federico Heinz mailto:federico&heinz.com -# [Federico_Lucifredi] Federico Lucifredi mailto:flucifredi&novell.com 2009-09-25 -# [FEHCom] FEHCom mailto:feh&fehcom.de 2015-01-09 -# [Feitian_Technologies] Feitian Technologies mailto:product&ftsafe.com 2010-09-15 -# [Felisa_Ares] Felisa Ares mailto:faa06&tid.es 2003-04 -# [Felix_Schwarz] Felix Schwarz IOSPIRIT GmbH mailto:felix.schwarz&iospirit.com 2014-09-23 -# [Ferdi_Ladeira] Ferdi Ladeira Fraxion Software mailto:f.lad.mail&gmail.com 2012-03-21 -# [Ferruccio_Barletta] Ferruccio Barletta mailto:ferruccio.barletta&compaq.com -# [Festo_AG] Festo AG & Co. KG mailto:Software-Support&de.festo.com 2012-07-26 -# [Fieldbus_Foundation] Fieldbus Foundation mailto:dave.glanzer&fieldbus.org 2002-10 -# [Filip_Zawadiak] Filip Zawadiak DOMIQ Sp. z o.o. mailto:fzawadiak&domiq.pl 2011-08-29 -# [Filippo_Fadda] Filippo Fadda mailto:fadda&osway.com 2003-08 -# [FLIR_Systems_AB] FLIR Systems AB mailto:bjorn.roth&flir.se 2011-10-20 -# [Florence_Wyman] Florence Wyman mailto:wyman&peabody.plk.af.mil -# [Florian_Weimer] Florian Weimer mailto:fweimer&redhat.com 2013-03-12 -# [fnxsoftware.com] fnxsoftware.com mailto:juan.guerrero&fnxsoftware.com 2015-06-30 -# [Fons_Rademakers] Fons Rademakers mailto:Fons.Rademakers&cern.ch -# [Forest_Hill] Forest Hill mailto:forest&apple.com -# [Found_Software] Found Software, Inc. mailto:john&foundapp.com 2012-04-11 -# [Francesco_Rosi] Francesco Rosi mailto:frosi&orenburg.com 2006-01 -# [Francis_Cianfrocca] Francis Cianfrocca mailto:francis&tempest.com -# [Francis_GASCHET] Francis GASCHET NUMLOG mailto:fg&numlog.fr 2008-09-08 -# [Francisco_Reverbel] Francisco Reverbel mailto:reverbel&ime.usp.br 2002-06 -# [Francisco_Ryan_Tolma] Francisco Ryan Tolmasky mailto:ftolmasky&adelphia.net -# [Francisco_Saez_Aranc] Francisco Saez Arance mailto:fsaez&tid.es -# [Franck_Ladurelle] Franck Ladurelle mailto:ladurelf&partimage.org -# [Franck_Lefevre] Franck Lefevre mailto:franck.lefevre&digitalairways.com 2009-11-18 -# [Franco_Milan] Franco Milan mailto:franco&eladit.com -# [Francois_Granade] Francois Granade mailto:francois&netobjects.com -# [Francois_Harvey] Francois Harvey mailto:securiweb&pandore.qc.ca -# [Francois_Marchand] Francois Marchand mailto:francois.marchand&electromed.com 2002-08 -# [Francois_Marier] Francois Marier libravatar.org mailto:francois&libravatar.org 2011-10-11 -# [Francois_Painchaud] Francois Painchaud mailto:fpainchaud&konshus.com -# [Francois_Peloffy] Francois Peloffy mailto:fpeloffy&4tier.com -# [Frank_B] Frank Bredenbröcker mailto:fbredenbroecker&psi.de 2008-07-17 -# [Frank_Blakely] Frank Blakely mailto:frankb&hpptc16.rose.hp.com -# [Frank_Goenninger] Frank Goenninger mailto:frank.goenninger&consequor.de 2010-02-22 -# [Frank_Hartung] Frank Hartung mailto:Frank.Hartung&ericsson.com 2007-09-07 -# [Frank_J_Wacho] Frank J. Wacho mailto:WANCHO&wsmr-simtel20.army.mil -# [Frank_Jakel] Frank Jäkel mailto:Frank.Jaekel&cytel.de 2011-04-29 -# [Frank_Kappe] Frank Kappe mailto:fkappe&iicm.tu-graz.ac.at -# [Frank_Neulichedl] Frank Neulichedl mailto:frank&websmile.com -# [Frank_O_Neill] Frank O'Neill mailto:frank&morse.ilo.dec.com -# [Frank_Pikelner] Frank Pikelner mailto:frank.pikelner&netcraftcommunications.com 2010-01-15 -# [Frank_Quick] Frank Quick mailto:fquick&qualcomm.com -# [Frank_Rottmann] Frank Rottmann mailto:Frank.Rottmann&web.de -# [Frank_Soetebeer] Frank Soetebeer mailto:frsoeteb&adobe.com 2003-01 -# [Frank_Szczerba] Frank Szczerba mailto:frank&appmobi.com -# [Frank_Waarsenburg] Frank Waarsenburg mailto:frank&eye-display.nl 2004-11 -# [Frank_Yeh] Frank Yeh mailto:fyeh&us.ibm.com -# [Frank_Zerangue] Frank Zerangue mailto:fzerang&cisco.com -# [Frank_da_Cruz] Frank da Cruz mailto:fdc&watsun.cc.columbia.edu -# [Frans_Lundberg] Frans Lundberg mailto:frans&linova.com 2004-11 -# [Frans_S_C_Witte] Frans S.C. Witte mailto:fscwitte&dicgroep.nl -# [Franz_Josef_Leuders] Franz-Josef Leuders mailto:development&tobit.com -# [Fraxion_Software] Fraxion Software mailto:info&fraxion.biz 2012-03-21 -# [Fred_Batty] Fred Batty mailto:fredb&sun.com 2007-12-03 -# [Fred_Cohen] Fred Cohen mailto:fc&all.net -# [Fred_Fierling] Fred Fierling mailto:fff&exegin.com 2006-02 -# [Fred_Klassen] Fred Klassen mailto:fklassen&jaalam.com 2002-02 -# [Fred_McLain] Fred McLain mailto:fmclain&appworx.com -# [Fred_Messinger] Fred Messinger mailto:fredm&cisco.com -# [Fred_Surr] Fred Surr mailto:quest_iana&oz.quest.com -# [Fred_Yao] Fred Yao mailto:Fred_Yao&ddigate2.desktopdata.com -# [Fred_Zimmerman] Fred Zimmerman mailto:fredzim1&gmail.com 2013-11-05 -# [Freddy_A_Ayuso_Hens] Freddy A. Ayuso-Henson mailto:fayusohenson&hillr.com 2008-05-22 -# [Frederic_Firmin] Frederic Firmin mailto:frederic.firmin&etsi.org 2014-11-14 -# [Frederic_Hemmer] Frederic Hemmer mailto:Frederic.Hemmer&cern.ch -# [Frederic_Weymann] Frederic Weymann mailto:contact&fizzban.net -# [Frederick_Parent] Frederick Parent mailto:fparent&elfiq.com 2005-11 -# [Fredrik_Haglund] Fredrik Haglund mailto:fredik.haglund&boldsoft.com -# [Freebox_SAS] Freebox SAS mailto:npouillon&freebox.fr 2012-12-14 -# [Freeverse_Software] Freeverse Software mailto:info&freeverse.com -# [Freshout] Freshout mailto:navid&freshout.us 2014-04-14 -# [Friedman_Wagner_Dobl] Friedman Wagner-Dobler mailto:Friedman.Wagner-Dobler&gdc4s.com 2005-09 -# [Frode_Randers] Frode Randers mailto:Frode.Randers&tietoenator.com 2006-01 -# [GPP_Specifications] John M Meredith 3GPP Specifications mailto:john.meredith&etsi.org 2009-06-11 -# Manager -# [G_E_Ozz_Nixon_Jr] G.E. Ozz Nixon Jr. mailto:ozznixon&gmail.com 2009-01-13 -# [G_Runfeldt] Göran Runfeldt mailto:goran&netadmin.se 2007-07-10 -# [Gabe_Frost] Gabe Frost mailto:gfrostµsoft.com 2005-08 -# [Gabi_Kalmar] Gabi Kalmar mailto:kalga01&cai.com -# [Gabriel_Kalmar] Gabriel Kalmar mailto:kalga01&ca.com 2008-03-06 -# [Gabriel_Levy] Gabriel Levy mailto:glevy&riverbed.com 2008-08-29 -# [Gabriele_Mondada] Gabriele Mondada RecoLive Sàrl mailto:gmondada&recolive.com 2012-08-29 -# [Gal_Cucuy] Gal Cucuy mailto:galc&cyber-ark.com 2002-03 -# [Galaxy4D] Galaxy4D Online Game mailto:admin&galaxy4d.com 2012-06-18 -# Engine -# [Gang_Gong_Moy] Gang Gong Moy -# [Gangsta_Ltd] Gangsta Ltd. mailto:jc&gangstamedia.com 2011-10-13 -# [Gareth_Nelson] Gareth Nelson mailto:gareth&garethnelson.com 2015-11-13 -# [Gareth_Nelson_2] Gareth Nelson mailto:gareth&litesim.com 2008-08-22 -# [Garmin_International_Inc] Garmin International, mailto:nettel&garmin.com 2015-07-23 -# Inc." -# [Garrett_D_Amore] Garrett D'Amore DEY Storage Systems, mailto:garrett&dey-sys.com 2013-03-01 -# Inc. -# [Garret_Tollkuhn] Garret Tollkuhn mailto:garret&multiviewgroup.com -# [Garrett_Herschleb] Garrett Herschleb mailto:garrett&netrix.com -# [Garrett_Padera] Garrett Padera mailto:garrett&garrettsites.net 2008-02-01 -# [Garry_Moore] Garry Moore mailto:garry.moore&cgi.com 2003-10 -# [Garth_Mayville] Garth Mayville mailto:mayville&maplesoft.on.ca -# [Gary_ANDREWS] Gary ANDREWS mailto:gan&orsyp.com 2008-01-07 -# [Gary_A_James] Gary A. James mailto:gary.james&criticallink.com -# [Gary_Aston] Gary Aston mailto:Gary.Aston&datadrivenlogistics.com 2009-03-10 -# [Gary_Atkinson] Gary Atkinson Stinky Kitten Limited mailto:gary&stinkykitten.com 2013-10-03 -# [Gary_Bartlett] Gary Bartlett mailto:garyb&echelon.com -# [Gary_Barton] Gary Barton mailto:gary.barton&citrix.com 2011-02-24 -# [Gary_Giebler] Gary Giebler mailto:gary&giebler.com -# [Gary_Giebler_2] Gary Giebler mailto:gary&giebler.com 2011-10-18 -# [Gary_Glover] Gary Glover mailto:gglover&novell.com -# [Gary_Hampton] Gary Hampton mailto:GH&2hti.com 2008-02-27 -# [Gary_Howland] Gary Howland mailto:gary&systemics.com -# [Gary_Lewis] Gary Lewis mailto:GaryL&hq.mylex.com -# [Gary_M_Allen] Gary M. Allen mailto:gallen&symantec.com -# [Gary_Malkin] Gary Malkin mailto:gmalkin&xylogics.com -# [Gary_Morton] Gary Morton mailto:mortong&pacdata.com -# [Gary_Myers] Gary Myers mailto:gmyers&objectvideo.com -# [Gary_S_Malkin] Gary S. Malkin mailto:GMALKIN&xylogics.com -# [Gary_Sands] Gary Sands mailto:gsands&tycoint.com -# [Gary_T_Ciampa] Gary T. Ciampa mailto:Gary.Ciampa&sas.com 2003-04 -# [Gary_Weichinger] Gary Weichinger mailto:gary.weichinger&netiq.com -# [Gary_Whelan] Gary Whelan mailto:gwhelan&sybonic.com 2005-08 -# [Gaspard_Bucher] Gaspard Bucher mailto:gaspard&teti.ch -# [Gautam_Jain] Gautam Jain Conceptworld mailto:admin&conceptworld.com 2013-08-20 -# Corporation -# [Gavin_Hutchinson] Gavin Hutchinson mailto:gavinh&visionlogistics.com -# [Gavin_Hutchinson_2] Gavin Hutchinson mailto:gavinh&tesl.com -# [Gene_McCulley] Gene McCulley mailto:mcculley&cuspy.com 2002-02 -# [Gene_Tyacke] Gene Tyacke mailto:gene&apple.com -# [General_Satellite] General Satellite mailto:office&gs.ru 2014-02-25 -# [Geode_Software_Ltd] Geode Software Ltd mailto:mathew_waters&geode.co.uk 2014-05-14 -# [Geoff_Back] Geoff Back mailto:geoff&autocue.co.uk 2002-03 -# [Geoff_Back_2] Geoff Back mailto:geoff&demonlair.co.uk 2010-02-01 -# [Geoff_Back_3] Geoff Back mailto:geoff&demonlair.co.uk -# [Geoff_Back_4] Geoff Back mailto:geoff.back&autocue.co.uk -# [Geoff_Collyer] Geoff Collyer mailto:geoff&research.bell-labs.com -# [Geoff_Goodfellow] Geoff Goodfellow mailto:Geoff&fernwood.mpk.ca.us -# [Geoff_Higgins] Geoff Higgins mailto:geoff.higgins&sun.com 2006-03 -# [Geoff_Meacock] Geoff Meacock mailto:gbibmswl&ibmmail.com -# [Geoff_Mendal] Geoff Mendal mailto:mendal&talarian.com -# [Geoffrey_Beer] Geoffrey Beer Raymarine UK Limited mailto:Geoff.Beer&raymarine.com 2012-05-24 -# [Geoffrey_Wossum] Geoffrey Wossum mailto:geoffrey&pager.net 2003-02 -# [Geoffry_Meek] Geoffry Meek mailto:geoff&meek.com -# [George_Balesta] George Balesta mailto:George.Baletsa&tfn.com -# [George_Dzieciol] George Dzieciol mailto:gdzieciol&symantec.com 2002-07 -# [George_Flanagin] George Flanagin mailto:gflanagi&richmond.edu 2010-10-30 -# [George_Gianelos] George Gianelos mailto:Georgegi&attachmate.com -# [George_Gianelos_2] George Gianelos mailto:GeorgeGi&attachmate.com 2003-03 -# [George_Hartz] George Hartz mailto:george.hartz&sentillion.com -# [George_Hwa] George Hwa mailto:ghwa&luminescent.com 2007-03 -# [George_Kajos] George Kajos mailto:gkajos&mail1.videoserver.com -# [George_Moromisato] George Moromisato mailto:gpm&neurohack.com 2004-11 -# [George_Nachman] George Nachman -# [George_Neville-Neil] George Neville-Neil mailto:gnn&neville-neil.com 2014-07-29 -# [George_Pajari] George Pajari mailto:George.Pajari&faximum.com -# [George_Rudy] George Rudy mailto:george&entsoft.com -# [George_Walter] George Walter mailto:george.walter&ascentialsoftware.com -# [Gerald_Aquila] Gerald Aquila mailto:gerald.aquila&gmail.com -# [Gerald_McBrearty] Gerald McBrearty -# [Gerald_Mesaric] Gerald Mesaric mailto:gmesaric&hyperwave.com -# [Gerald_R_Jensen] Gerald R. Jensen mailto:tech&autodatasys.com 2008-06-05 -# [Gerard_Cannie] Gerard Cannie mailto:jcannie&opticaltech.com -# [Gerard_Cerchio] Gerard Cerchio mailto:gjpc&circlesoft.com 2003-11 -# [Gerardo_Dilillo] Gerardo Dilillo mailto:MOMIANAµsoft.com 2006-08 -# [Gerardo_Pardo_Castel] Gerardo Pardo-Castellote mailto:gerardo.pardo&rti.com 2005-10 -# [Gerben_Wierda] Gerben Wierda mailto:Gerben_Wierda&rna.nl -# [Gerd_Beling] Gerd Beling mailto:GBELING&isi.edu -# [Gerg_Cole] Gerg Cole mailto:gcole&corp.borland.com -# [Gerhard_Wagner] Gerhard Wagner mailto:gw&nova-ratio.de 2009-03-10 -# [Gerry_Brown] Gerry Brown gerry Brown mailto:gerry&gbrown.com 2012-11-29 -# associates -# [gerry_Brown_associates] gerry Brown mailto:gerry&gbrown.com 2012-11-29 -# associates -# [Gerry_Dubois] Gerry Dubois mailto:gdubois&carriustech.com 2005-08 -# [Gerry_Gorman] Gerry Gorman mailto:gerry.gorman&emclock.com 2010-12-06 -# [Gert_Thomasen] Gert Thomasen mailto:gert.thomasen&etsi.org 2009-12-07 -# [Ghanshyam_Patel] Ghanshyam Patel mailto:gpatel&natinc.com 2003-11 -# [Gianosvaldo_Fadin] Gianosvaldo Fadin IEC Central Office mailto:gianosvaldo.fadin&anie.it 2015-07-24 -# [Gijs_Middelkamp] Gijs Middelkamp mailto:astergate-fax&huisken-systems.nl 2010-02-03 -# [Gil_Greenbaum] Gil Greenbaum mailto:gcole&nisd.cam.unisys.com -# [Gil_Hecht] Gil Hecht mailto:GilH&aks.com -# [Gil_Shafriri] Gil Shafriri mailto:shafriri&ilccm1.iil.intel.com -# [Gilbert_Moineau] Gilbert Moineau mailto:gilbert.moineau&colubris.com 2002-05 -# [Gilbert_Yeung] Gilbert Yeung mailto:gyeung&nvidia.com 2002-04 -# [Gilberto_Arnaiz] Gilberto Arnaiz mailto:garnaiz&siebel.com -# [Gilles_Bourquard] Gilles Bourquard mailto:gbo&wag.ch -# [Gilles_Gameiro] Gilles Gameiro mailto:ggameiro&birdland.com -# [Girish_Bhat] Girish Bhat mailto:gbhat&cranite.com 2006-04 -# [Girish_Gopalakrishna] Girish Gopalakrishnan mailto:girish&shankar-software.org 2010-04-20 -# [Gita_Murthy] Gita Murthy mailto:gita&cup.hp.com -# [Gjermund_Wallenius] Gjermund Wallenius mailto:gwallenius&ndlocis.mil.no 2009-09-30 -# [Glen_Myers] Glen Myers mailto:glen.myers&ipfabrics.com 2007-05 -# [Glen_Pearson] Glen Pearson mailto:GlenP&multigen.com -# [Glen_Sansoucie] Glen Sansoucie mailto:gsansoucie&loftware.com -# [Glen_Sansoucie_2] Glen Sansoucie mailto:glen&llmwin.com -# [Glenn_Allen] Glenn Allen mailto:gallen&goorooinc.com 2009-08-05 -# [Glenn_Anderson] Glenn Anderson mailto:glenn&qualcomm.co.nz -# [Glenn_Davis] Glenn Davis mailto:support&unidata.ucar.edu -# [Glenn_Levitt] Glenn Levitt mailto:streetd1&ix.netcom.com -# [Glenn_Matthews] Glenn Matthews mailto:glenn.matthews&cisco.com 2011-05-23 -# [Glenn_Olander] Glenn Olander mailto:gjo&msi.com -# [Glenn_Olander_2] Glenn Olander mailto:glenn&greenoak.com -# [Glenn_Peterson] Glenn Peterson mailto:glennpµsoft.com -# [Glenn_Reid] Glenn Reid mailto:port-reg&fiveacross.com 2004-11 -# [Glenn_Russell] Glenn Russell mailto:grussell&cablelabs.com -# [Global_Relay] Global Relay mailto:Michael.Sample&GlobalRelay.net 2012-11-28 -# Communications Inc -# [Gobby_0x539] 0x539 dev group http://darcs.0x539.de/trac/obby/cgi-bin/trac.cgi -# [GOG.com] GOG.com mailto:admin&gog.com 2014-07-31 -# [Google_Inc] Google Inc. mailto:numbers&google.com 2015-07-31 -# [Gopikrishna_Sandra] Gopikrishna Sandra mailto:v-gosandµsoft.com 2005-02 -# [GoPro] GoPro mailto:jenke&gopro.com 2014-10-13 -# [Goran_Runfeldt] Göran Runfeldt mailto:goran&netadmin.se 2006-12 -# [Gord_Peters] Gord Peters Dialectro Software mailto:g&dialectro.com 2011-10-20 -# [Gord_Tomlin] Gord Tomlin mailto:gord.tomlin&actionsoftware.com 2010-01-21 -# [Gordan_Vosicki] Gordan Vosicki mailto:admin&icsa.ch 2009-09-23 -# [Gordon_C_Galligher] Gordon C. Galligher mailto:gorpong&ping.chi.il.us -# [Gordon_Mangione] Gordon Mangione mailto:gordmµsoft.com -# [Gordon_Mohr] Gordon Mohr mailto:gojomo&usa.net -# [Gordon_Mohr_2] Gordon Mohr mailto:gmohr&cmgisolutions.com -# [Gordon_Waddell] Gordon Waddell mailto:gordon.waddell&nuance.com 2011-03-21 -# [Graeme_Perrow] Graeme Perrow mailto:gperrow&ianywhere.com 2005-08 -# [Graham_Bloice] Graham Bloice mailto:graham.bloice&trihedral.com 2009-09-17 -# [Graham_Jones] Graham Jones mailto:gjones&nab.org 2004-11 -# [Graham_Klyne] Graham Klyne mailto:GK&acm.org -# [Graham_Parsons] Graham Parsons mailto:graham.parsons&reflective.com 2005-08 -# [Graham_Wooden] Graham Wooden mailto:graham&g-rock.net -# [Grant_Erickson] Grant Erickson Nest Labs, Inc. mailto:grant&nestlabs.com 2014-01-16 -# [Grant_Gilchrist] Grant Gilchrist mailto:grant&enernex.com 2010-10-18 -# [Grant_Kirby] Grant Kirby mailto:grant_kirby&ccm.al.intel.com -# [Green_Hills_Software] Green Hills Software mailto:iana-contact&ghs.com 2012-02-07 -# [Greg_Bailey] Greg Bailey mailto:gbailey&lxpro.com 2003-04 -# [Greg_Banks] Greg Banks mailto:gnb&sgi.com 2004-11 -# [Greg_Bodine] Greg Bodine mailto:gregory.bodine&ca.com 2002-02 -# [Greg_Broiles] Greg Broiles mailto:greg&sac.net -# [Greg_Cottman] Greg Cottman mailto:greg.cottman&quest.com 2008-10-23 -# [Greg_Cottman_2] Greg Cottman mailto:Greg.Cottman&quest.com 2010-10-18 -# [Greg_Cottman_3] Greg Cottman Quest Software mailto:Greg.Cottman&quest.com 2013-04-19 -# [Greg_Ercolano] Greg Ercolano mailto:erco&netcom.com -# [Greg_Ercolano_2] Greg Ercolano mailto:erco&cinegrfx.com -# [Greg_Foutz] Greg Foutz mailto:gregf&adminovation.com 2006-03 -# [Greg_Goodson] Greg Goodson mailto:ggoodson&group1software.co.uk -# [Greg_Hansen] Greg Hansen Mele Associates mailto:greg.hansen&meleassociates.com 2014-11-26 -# [Greg_Hudson] Greg Hudson mailto:zephyr-bugs&mit.edu -# [Greg_Hudson_2] Greg Hudson mailto:ghudson&mit.edu 2003-01 -# [Greg_Johnson] Greg Johnson mailto:greg.johnson&ieee.org -# [Greg_McLaughlin] Greg McLaughlin mailto:ggregm&moremobilesoftware.com -# [Greg_Pflaum] Greg Pflaum mailto:iris.com!Greg_Pflaum&uunet.uu.net 1992-07 -# [Greg_Porter] Greg Porter mailto:gporter&powerschool.com -# [Greg_Pringle] Greg Pringle mailto:admin&corvedia.com -# [Greg_Robson_Garth] Greg Robson-Garth mailto:gregr&alphalink.com.au -# [Greg_Rose] Greg Rose mailto:Greg_Rose&sydney.sterling.com -# [Greg_Rose_2] Greg Rose mailto:ggr&qualcomm.com 2002-02 -# [Greg_Sidebottom] Greg Sidebottom mailto:gregside&home.com -# [Greg_Stine] Greg Stine mailto:greg.stine&siemens.com 2007-07-05 -# [Greg_Suppes] Greg Suppes mailto:greg.suppes&autodesk.com -# [Greg_Troxel] Greg Troxel mailto:gdt&ir.bbn.com -# [Gregg_Green] Gregg Green mailto:legal&vnyx.net 2004-11 -# [Gregg_Townsend] Gregg Townsend mailto:gmt&cs.arizona.edu 2003-11 -# [Gregg_Welker] Gregg Welker mailto:greggw&zmi.com -# [Gregor_Schmid] Gregor Schmid mailto:gs&qfs.de 2002-07 -# [Gregory_Dudek] Gregory Dudek mailto:dudek&y1d.com -# [Gregory_Hostettler] Gregory Hostettler mailto:ghostettler&caracal.ch 2004-11 -# [Gregory_Power] Gregory Power mailto:gpower&apple.com -# [Gregory_Richards] Gregory Richards mailto:Richards&codu.org 2002-04 -# [Growl_Project] The Growl Project mailto:support&growl.info 2012-02-07 -# [Guhan_Suriyanarayana] Guhan Suriyanarayanan mailto:guhansµsoft.com 2006-03 -# [Guidewire_Software_Inc] Guidewire Software, mailto:info&guidewire.com 2014-02-06 -# Inc -# [Guido_Kiener] Guido Kiener mailto:Guido.Kiener&rohde-schwarz.com 2008-12-04 -# [Gur_Kimchi] Gur Kimchi mailto:gkimchiµsoft.com 2008-05-20 -# [Gus_Asadi] Gus Asadi 3 Lights Software LLC mailto:support&3lightssoftware.com 2014-07-22 -# [Gus_McNaughton] Gus McNaughton mailto:gus&chevin.com -# [Gustavo_Rodriguez_Ri] Gustavo Rodriguez-Rivera mailto:grr&geodesic.com -# [Guus_Sliepen] Guus Sliepen mailto:guus&warande3094.warande.uu.nl -# [Guy_Avery] Guy Avery Navtech Radar mailto:guy.avery&navtechradar.com 2013-02-20 -# [Guy_Cheng] Guy Cheng mailto:GCHE&kastenchase.com -# [Guy_Keren] Guy Keren mailto:Guy_Keren&mail.stil.scitex.com -# [Guy_Meyer] Guy Meyer mailto:rominar&mac.com -# [Gyozo_Kmethy] Gyozo Kmethy mailto:gyozo.kmethy&gnarus.hu 2006-11 -# [Hai_Ou_Yang] Hai Ou-Yang mailto:hai.ou-yang&sun.com 2003-04 -# [Haim_Gelfenbeyn] Haim Gelfenbeyn mailto:haim&hageltech.com -# [Hal_Henderson] Hal Henderson mailto:hhenders&novell.com -# [Hali_Lindbloom] Hali Lindbloom mailto:halil&docent.com -# [Hall_Research] Hall Research mailto:vishal&hallresearch.com 2011-11-29 -# [HaloteC_Instruments] HaloteC Instruments mailto:michel.stam&halotec.com 2012-02-07 -# B.V. -# [Hamed_Ishbaitah] Hamed Ishbaitah mailto:Hamed.i&icloud.com 2014-07-30 -# [Hani_Abdelazim] Hani Abdelazim mailto:hani&apple.com -# [Hannes_K] Hannes K√§lber mailto:hannes.kaelber&x2e.de 2010-09-13 -# [Hans_Christoph_Stein] Hans-Christoph Steiner mailto:hans&eds.org -# [Hans_Kruse] Hans Kruse mailto:kruse&ohio.edu 2013-11-12 -# [Hans_Peter_Heffels] Hans-Peter Heffels mailto:hostmaster&csb-system.com -# [Hans_Rohnert] Hans Rohnert mailto:hans.rohnert&siemens.com 2002-04 -# [Hans_Schoone] Hans Schoone mailto:Hans.Schoone&nl.ibm.com 2010-10-01 -# [Hans_U_Schmidt] Hans U Schmidt mailto:schmidth&de.ibm.com -# [Hans_Weibel] Hans Weibel mailto:hans.weibel&zhwin.ch 2004-10 -# [Hanz_Hager] Hanz Hager mailto:Hanz.Hager&comhem.se 2008-12-04 -# [Harald_Schlangmann] Harald Schlangmann mailto:schlangm&informatik.uni-muenchen.de -# [Harald_Striepe] Harald Striepe mailto:harald&quantumintech.com 2008-02-14 -# [Harald_Welte] Harald Welte mailto:laforge&gnumonks.org 2009-01-16 -# [Haram_Lee] Haram Lee mailto:layne&indigo-security.com -# [Hardy_Doelfel] Hardy Doelfel mailto:hardy_doelfel&adaptec.com 2002-05 -# [Harinder_Bhasin] Harinder Bhasin mailto:Harinder.Bhasin&sun.com -# [Harish_Kuttan] Harish Kuttan mailto:harish.k&hp.com 2010-03-22 -# [Harold_Froehling] Harold Froehling mailto:hrf&cup.hp.com -# [Harris_Corporation] Harris, Corporation mailto:dsomerfi&harris.com 2011-08-05 -# [Harry_Courtice] Harry Courtice mailto:harry.courtice&elprotech.com 2008-04-14 -# [Harry_Goldschmitt] Harry Goldschmitt mailto:hgoldschmitt&hgac.com 2003-11 -# [Harry_Goldschmitt_2] Harry Goldschmitt mailto:harry&hgac.com 2007-06 -# [Harry_Lewis] Harry Lewis mailto:harryl&us.ibm.com 2003-05 -# [Harry_T_Vennik] Harry T. Vennik mailto:htvennik&zonnet.nl 2002-11 -# [Harry_ten_Berge] Harry ten Berge mailto:berge&hitt.nl -# [Harvey_S_Schultz] Harvey S. Schultz mailto:harvey&acm.org -# [HbbTV_Association] HbbTV Association mailto:info&hbbtv.org -# [Heath_Barber] Heath Barber Datacolor mailto:hbarber&datacolor.com 2011-10-14 -# [Heath_Raftery] Heath Raftery mailto:heath&hrsoftworks.net -# [Heathwest_Systems_Limited] Heathwest Systems mailto:info&heathwest.com 2013-03-21 -# Limited -# [Heikki_E] Heikki Ellil√§ mailto:heikki.ellila&western.fi 2009-06-18 -# [Heiko_Kretschmer] Heiko Kretschmer mailto:info&wurst-wasser.net -# [Heiko_Rupp] Heiko Rupp mailto:hwr&pilhuhn.de -# [Heiko_Schlichting] Heiko Schlichting mailto:heiko&fu-berlin.de -# [Heiner_Erne] Heiner Erne Hirschmann Automation mailto:heiner.erne&hirschmann.de 2008-06-06 -# and Control GmbH -# [Heinz_Wrobel] Heinz Wrobel mailto:hwrobel&gmx.de -# [Helga_Wolin] Helga Wolin mailto:hwolin&us.ibm.com -# [Helge_Frank_Zimpel] Helge-Frank Zimpel mailto:helge.zimpel&baeurer.de 2006-01 -# [Helmut_Giritzer] Helmut Giritzer mailto:helmut.giritzer&epluse.at 2005-11 -# [Helmut_Giritzer_2] Helmut Giritzer mailto:helmut.giritzer&o.roteskreuz.at 2005-08 -# [Helmuth_Breitenfelln] Helmuth Breitenfellner mailto:hbreitenf&vnet.imb.com -# [Honwywell_Security_Group] Honwywell Security mailto:john.dziadosz&honeywell.com 2012-04-09 -# Group -# [Hennie_van_der_Merwe] Hennie van der Merwe mailto:hvandermerwe&tellumat.com 2002-07 -# [Henning_Meier_Geinit] Henning Meier-Geinitz mailto:henning&meier-geinitz.de 2002-10 -# [Henning_Mersch] Henning Mersch mailto:h.mersch&plt.rwth-aachen.de 2010-12-07 -# [Henning_Schulzrinne] Henning Schulzrinne mailto:hgs&cs.columbia.edu -# [Henning_Smith] Henning Smith mailto:henning.smith&ca.com 2006-07 -# [Henri_Moelard] Henri Moelard mailto:moelard&lucent.com -# [Henric_Bergh] Henric Bergh mailto:henric&bergh.nu 2007-01 -# [Henrik_Goldman] Henrik Goldman mailto:hg&x-formation.com 2006-10 -# [Henrik_Holst] Henrik Holst mailto:henrik.holst&ecovision.se -# [Henrik_Johnson] Henrik Johnson Quest Software mailto:henrik.johnson&quest.com 2012-04-09 -# [Henrik_Woffinden] Henrik Woffinden mailto:hw&nitramlexa.com 2008-09-22 -# [Henry_Haverinen] Henry Haverinen mailto:henry.haverinen&nokia.com -# [Henry_Houh] Henry Houh mailto:hhouh&nbxcorp.com -# [Henry_Rawas] Henry Rawas mailto:henryrµsoft.com 2005-08 -# [Henry_Strickland] Henry Strickland mailto:strick&yak.net -# [Herb_Jensen] Herb Jensen mailto:HWJensen&nfsrv.avionics.itt.com -# [Herb_Sutter] Herb Sutter mailto:HerbS&cntc.com -# [Herbert_Falk] Herbert Falk mailto:herb&sisconet.com 2003-06 -# [heroicrobotics.com] heroicrobotics.com mailto:jasmine&heroicrobotics.com 2014-06-24 -# [Hesham_Soliman] Hesham Soliman mailto:H.Soliman&flarion.com 2005-11 -# [Hewlett_Packard] Hewlett Packard -# [Hewlett_Packard_2] Hewlett Packard mailto:oliver.breyel&hp.com 2013-02-07 -# [Hewlett_Packard_3] Hewlett Packard mailto:Steve.Roscio&hp.com 2014-04-09 -# [Hideki_Hatta] Hideki Hatta mailto:ponum&canon-is.co.jp 2007-09-27 -# [Hideki_Kiriyama] Hideki Kiriyama mailto:kiriyama&cp10.es.xerox.com -# [Hideo_Wakabayashi] Hideo Wakabayashi mailto:hiwaka&alles.or.jp -# [Hindin_Joseph] Hindin Joseph mailto:hindin%25robcad@uunet.uu.net -# [Hing_Wing_To] Hing Wing To mailto:wing.to&mircromuse.com -# [Hing_Wing_To_2] Hing Wing To mailto:wing.toµmuse.com -# [Hirokazu_Fujisawa] Hirokazu Fujisawa mailto:fujisawa&pfu.fujitsu.com -# [Hiroki_Kawano] Hiroki Kawano mailto:kawano&saint.nm.fujitsu.co.jp -# [Hiromi_Ohara] Hiromi Ohara mailto:Hiromi.Ohara&fujixerox.co.jp 2008-06-18 -# [Hiromi_Taki] Hiromi Taki mailto:stg-togo&saint.nm.fujitsu.co.jp -# [Hiroyasu_Ogata] Hiroyasu Ogata mailto:Ogata.Hiroyasu&exc.epson.co.jp -# [Hiroshi_Matsuda] Hiroshi Matsuda Ripplex Inc. mailto:gucam&ripplex.com 2013-03-04 -# [Hiroyuki_Hashimoto] Hiroyuki Hashimoto mailto:easymp&exc.epson.co.jp 2002-10 -# [Hiroyuki_Kawabuchi] Hiroyuki Kawabuchi mailto:buchi&ael.fujitsu.co.jp -# [Hiroyuki_Takahashi] Hiroyuki Takahashi mailto:hiro.takahashi&eng.sun.com -# [Hitoshi_Ishida] Hitoshi Ishida mailto:ishida.hitoshi&exc.epson.co.jp -# [HLW_Software_Development_GmbH] HLW Software mailto:office&hlw-software.com 2011-10-11 -# Development GmbH -# [Hoa_Nguyen] Hoa Nguyen mailto:hoan&cup.hp.com -# [Hokey_Stenn] Hokey Stenn mailto:hokey&plus5.com -# [Holger_Heinrich] Holger Heinrich mailto:holger2222&googlemail.com 2012-02-01 -# [Holger_Kruse] Holger Kruse mailto:holger&rebol.net -# [Holger_Lochner] Holger Lochner mailto:holger.lochner&daimler.com 2011-04-06 -# [Holger_Reif] Holger Reif mailto:Holger.Reif&prakinf.tu-ilmenau.de -# [Hong_Jungkih] Hong, Jungkih mailto:jungkih.hong&samsung.com 2010-09-20 -# [Horizon_Digital_Ente] Horizon Digital mailto:info&hde.co.jp -# Enterprise Inc. -# [HotLink_Corporation] HotLink Corporation mailto:roffer&hotlink.com 2014-12-18 -# [Hottinger_Baldwin_Messtechnik_GmbH] Hottinger Baldwin mailto:stephan.gatzka&hbm.com 2013-03-15 -# Messtechnik GmbH -# [Howard_Amos] Howard Amos mailto:amos&ccww.co.uk 2006-04 -# [Howard_Cole] Howard Cole mailto:hcole&tumbleweed.nrcabq.com -# [Howard_Gordon] Howard Gordon mailto:hgordon&system.xingtech.com -# [Howard_Hart] Howard Hart mailto:hch&hybrid.com -# [Howard_Yin] Howard Yin mailto:howard.yin&ericsson.com -# [Huang_Jingnan] Huang Jingnan mailto:huangjnb&lenovo.com 2003-10 -# [Huang_Neng-geng] Huang Neng-geng mailto:huangng&ngweb.org 2011-08-09 -# mailto:nghuang&ieee.org -# [Huang_Yu] Huang Yu mailto:llw&ftsafe.com -# [Hubert_Vijay_Arokiasamy] Hubert Vijay Arokiasamy Oracle Corp. mailto:hubert.vijay.arokiasamy&oracle.com 2014-10-28 -# [Hugh_Thomas] Hugh Thomas mailto:thomas&oils.enet.dec.com -# [Hugo_Charbonneau] Hugo Charbonneau -# [Hugo_Parra] Hugo Parra mailto:hparra&novell.com -# [Humberto_Sanchez] Humberto Sanchez mailto:Humberto_Sanchez&hp.com -# [Hunter_Goatley] Hunter Goatley mailto:goathunter&goatley.com -# [Hussein_F_Salama] Hussein F. Salama mailto:hsalama&cisco.com -# [Huw_Thomas] Huw Thomas mailto:huw.thomas&bt.com -# [HyeongBae_Yu] HyeongBae Yu mailto:hyeongbae.yu&samsung.com 2008-07-31 -# [HYPACK_Inc] HYPACK Inc. mailto:mircea&hypack.com 2011-10-27 -# [Hywel_Morgan] Hywel Morgan mailto:hywelm&surfcontrol.com 2003-11 -# [IANA] IANA mailto:iana&iana.org -# [IEEE_1722_1] IEEE-1722.1 mailto:jeff.koftinoff&ieee.com 2011-11-01 -# [IESG] IESG mailto:iesg&ietf.org -# [IETF_Chair] IETF Chair IETF mailto:chair&ietf.org -# [IETF_DPRIVE_Working_Group_Chairs] IETF DPRIVE Working Group IETF mailto:dns-privacy-chairs&tools.ietf.org -# Chairs -# [IFSF_Secretary] IFSF Secretary mailto:secretary&ifsf.org 2002-05 -# [IGG_Software] IGG Software mailto:ian&iggsoftware.com -# [INFINIDAT] INFINIDAT mailto:info&infinidat.com 2015-05-01 -# [IRdg] IRdg, Inc. mailto:jtaylor&irdg.com -# [ISHII_AKIO] ISHII AKIO mailto:ishii.akio&jp.fujitsu.com 2006-01 -# [Itamar_Haber] Itamar Haber Salvatore Sanfilippo mailto:itamar&redislabs.com 2015-04-23 -# [ITGroup] ITGroup mailto:itgroup&stillsecure.com 2008-06-30 -# [ITU-T] ITU-T mailto:tsbsg16&itu.int 2013-01-31 -# [ITU-T_TSB] ITU-T TSB ITU-T mailto:tsbsg16&itu.int 2013-01-31 -# ITU TSB, Place des -# [ITU_TSB] Nations, CH-1211 mailto:tsbmail&itu.int 2006-06 -# Geneva 20 -# [I_Hsing_Tsao] I-Hsing Tsao mailto:itsao&austin.ibm.com -# [Ian_A_Young] Ian A. Young mailto:iay&threel.co.uk -# [Ian_Anderson] Ian Anderson mailto:ian_anderson&phoenix.com -# [Ian_Bell] Ian Bell mailto:ianb&arca-technologies.com -# [Ian_Bradley] Ian Bradley mailto:ian.bradley&pocketprograms.com 2009-10-14 -# mailto:development&pocketprograms.com -# [Ian_Cargill] Ian Cargill mailto:ian.cargill&e-dendrite.com 2005-08 -# [Ian_Chard] Ian Chard mailto:ian&tanagra.demon.co.uk -# [Ian_Daniels] Ian Daniels mailto:btexact.ports&bt.com -# [Ian_Gordon] Ian Gordon mailto:ian.s.gordon&btopenworld.com 2002-08 -# [Ian_Gordon_2] Ian Gordon mailto:ian&n-genltd.co.uk 2003-03 -# [Ian_Gordon_3] Ian Gordon mailto:iangµmuse.co.uk -# [Ian_Higginbottom] Ian Higginbottom mailto:sonardata&sonardata.com -# [Ian_Jackson] Ian Jackson mailto:iwj&cam-orl.co.uk -# [Ian_Lowe] Ian Lowe mailto:ian&xplproject.org.uk 2003-08 -# [Ian_Manning] Ian Manning mailto:imanning&dtsuk.com 2002-05 -# [Ian_Manning_2] Ian Manning mailto:ian&baycastle.co.uk 2009-12-16 -# [Ian_McDowall] Ian McDowall mailto:ian.mcdowall&symbian.com 2003-11 -# [Ian_Miller] Ian Miller mailto:IANA-reg&adder.com 2006-03 -# [Ian_Wilson] Ian Wilson mailto:hsrp-info&cisco.com 2004-11 -# [Ibtsam_Mahfouz] Ibtsam Mahfouz mailto:imahfouz&cisco.com -# [Ico_Doornekamp] Ico Doornekamp mailto:ico&saedra.nl -# [iConstruct_Aus_Pty_Ltd] iConstruct (Aus) Pty mailto:jafari&pdcwa.com.au 2012-12-21 -# Ltd -# [Ido_Ben_David] Ido Ben-David mailto:dgntcom&netvision.net.il -# [IEC_Central_Office] IEC Central Office mailto:cj&iec.ch 2015-07-24 -# [Ieuan_Friend] Ieuan Friend mailto:ieuan.friend&dip.co.uk 2006-03 -# [Igor_Kostic] Igor Kostic mailto:igorkoµsoft.com 2002-08 -# [Igor_Mozolevsky] Igor Mozolevsky mailto:igor&itaufait.com -# [Igor_Plotnikov] Igor Plotnikov mailto:igor&uroam.com -# [Igor_Zaoutine] Igor Zaoutine mailto:igor&global-tech.com -# [IK_SATPROF_LLC] IK SATPROF LLC mailto:reg&iksatprof.ru 2014-05-02 -# [Ilan_Mahalal] Ilan Mahalal mailto:imahalal&axalto.com 2006-04 -# [Ilan_Shlosberg] Ilan Shlosberg mailto:ilan&mentasoftware.com -# [Ilan_Zisser] Ilan Zisser mailto:ilan&newgenpay.com -# [Illan_Raab] Illan Raab mailto:iraab&synoptics.com -# [Ilya_Melamed] Ilya Melamed mailto:ilya77&gmail.com 2006-06 -# [ims_Info] ims Info Management mailto:ope&ims-info.ch 2011-10-20 -# Systems AG -# [IMS_merilni_sistemi] IMS merilni sistemi mailto:info&ims.si 2012-08-24 -# d.o.o. -# [In_sik_Choi] In-sik Choi mailto:iscard&virusdesk.com 2002-02 -# [Inderpreet_Singh] Inderpreet Singh mailto:isingh&chantrynetworks.com 2003-06 -# [Inertia_Systemes] Inertia Systemes mailto:jasmin.blouin&inertiasystemes.com 2015-06-11 -# [Ines_Homem_de_Melo] Ines Homem de Melo mailto:sidinf&brfapesp.bitnet -# [Ing_Markus_Huemer] Ing. Markus Huemer mailto:markus.huemer&hsd.at -# [Ing_Tomas_Halabala] Ing. Tomas Halabala mailto:tomas.halabala®ulace.org 2010-10-06 -# [Ingersoll_Rand_Inc] Ingersoll Rand, Inc. mailto:john.taylor&irco.com 2011-09-28 -# [Ingo_Franzki] Ingo Franzki mailto:ifranzki&de.ibm.com -# [InfiniBand_Trade_Association] InfiniBand Trade mailto:administration&infinibandta.org 2014-10-17 -# Association (IBTA) -# [Infinite_Loop] Infinite Loop mailto:nasmon&infinite-loop.dk 2012-10-09 -# [InfoVista] InfoVista mailto:sbouchex&infovista.com 2014-05-23 -# [Initium_Labs_LLC] Initium Labs LLC mailto:manbir&initiumlabs.com 2015-03-06 -# [Inlab_Software_GmbH] Inlab Software GmbH mailto:info&inlab.de 2014-05-02 -# [Insider_Software] Insider Software http://www.insidersoftware.com -# [Insist] Insist mailto:support&isticky.net -# [Intel] Intel mailto:joshua.boelter&intel.com 2011-10-18 -# [IOSPIRIT_GmbH] IOSPIRIT GmbH mailto:info&iospirit.com 2014-09-23 -# [Ira_McDonald] Ira McDonald mailto:imcdonald&sharplabs.com 2005-12 -# [iRobot_Corporation] iRobot Corporation mailto:DL-ENG-SW-Management&irobot.com 2013-11-07 -# [Irradiated_Software] Irradiated Software mailto:info&irradiatedsoftware.com 2012-06-19 -# [ISA100_Wireless_Compliance_Institute] ISA100 Wireless mailto:jay&jwerb.com 2015-07-24 -# Compliance Institute -# [Isaack_Rasmussen] Isaack Rasmussen mailto:isaack&pictua.com -# [Israel_Beniaminy] Israel Beniaminy mailto:israel.beniaminy&clickservice.com -# [Israel_Shainert] Israel Shainert mailto:israels&209.88.177.2 -# [Itai_Greenberg] Itai Greenberg mailto:itaigµsoft.com 2004-11 -# [Itaru_Kimura] Itaru Kimura mailto:kimura&kel.fujitsu.co.jp -# [Ivan_Berardinelli] Ivan Berardinelli mailto:ivan&gestweb.com -# [Ivana_Cuozzo] Ivana Cuozzo mailto:Ivana.Cuozzo&tivoli.com -# [Ivo_Timmermans] Ivo Timmermans mailto:itimmermans&bigfoot.com -# [JF_Huard] JF Huard mailto:jfhuard&netuitive.com -# [J_A_Sever] J. A. (Tony) Sever mailto:J.A.Sever&bra0119.wins.icl.co.uk -# [J_C_Canessa] J. C. Canessa mailto:jccanessa&mmm.com -# [J_Gabriel_Foster] J. Gabriel Foster mailto:fop&gwha.com -# [J_H_Hermans] J.H. Hermans mailto:j.h.hermans&hiscom.nl -# [J_J_Ekstrom] J.J. Ekstrom -# [J_S_Greenfield] J. S. Greenfield mailto:greeny&raleigh.ibm.com -# [J_S_Greenfield_2] J.S. Greenfield mailto:greeny&us.ibm.com -# [Jack_Baker] Jack Baker mailto:Jack.Baker&l-3com.com 2006-02 -# [Jack_Haverty] Jack Haverty mailto:jhaverty&oracle.com -# [Jack_ONeil] Jack O'Neil -# [Jack_Waller_III] Jack Waller III mailto:jack&tomatosprings.com -# [Jack_Wilson] Jack Wilson mailto:JackW&travsoft.com -# [Jackie_Lau] Jackie Lau mailto:jackie.lau&compaq.com -# [Jackie_Wu] Jackie Wu mailto:jackiew&infoseek.com -# [Jaco_Botha] Jaco Botha mailto:jaco.botha&trispen.com 2004-11 -# [Jacob_Feisley] Jacob Feisley mailto:jacob&hydralabs.com 2009-01-21 -# [Jacob_Godwin_Jones] Jacob Godwin-Jones mailto:jacob&likethought.com -# [Jacob_Gsoedl] Jacob Gsoedl mailto:jgsoedl&pinnaclesys.com -# [Jacob_Kiesel] Jacob Kiesel gocso.net mailto:jake.k&gocso.net 2013-09-04 -# [Jacob_Ulmert] Jacob Ulmert mailto:Jacob.Ulmert&se.abb.com -# [Jae_Woo_Lee] Jae Woo Lee mailto:jae&cs.columbia.edu -# [Jaime_Antolin] Jaime Antolin mailto:jaime.antolin&ie.abb.com 2008-09-25 -# [Jakob_Kaivo] Jakob Kaivo mailto:jkaivo&nodomainname.net -# [Jakob_Oestergaard] Jakob Oestergaard mailto:joe&sysorb.com 2002-02 -# [Jakob_Spies] Jakob Spies mailto:Jakob.Spies&genius.de -# [Jakob_Steen_Hansen] Jakob Steen Hansen mailto:jsh&dk.damgaard.com -# [Jakub_Ahmadyar] Jakub Ahmadyar JANUS, spol. s r.o. mailto:ahmadyar&myq.cz 2013-04-23 -# [James_A_Brewster] James A. Brewster mailto:jimbrew&answersoft.com -# [James_Anson] James Anson mailto:janson&bigpond.com 2009-02-12 -# [James_Bottomley] James Bottomley mailto:James.Bottomley&steeleye.com 2006-02 -# [James_Brown] James Brown mailto:ender&admdev.com -# [James_Caza] James Caza mailto:jcaza&e-builder.net 2006-12 -# [James_Cox] James Cox mailto:jocox&view.com 2002-02 -# [James_Crismale] James Crismale Canfield Scientific, mailto:jim.crismale&canfieldsci.com 2013-07-02 -# Inc. -# [James_Crosby] James Crosby softthere.com mailto:james&softthere.com 2011-10-17 -# [James_Dabbs] James Dabbs mailto:jdabbs&tga.com -# [James_Darnall] James Darnall mailto:james_r_darnall&sbcglobal.net -# [James_David_Fisher] James David Fisher mailto:jfisher1&avaya.com -# [James_Downs] James Downs mailto:james.downs&egontech.com 2015-10-05 -# [James_E_Housley] James E. Housley mailto:jim&thehousleys.net -# [James_E_King_III] James E. King, III mailto:James_E_K&dell.com 2010-06-24 -# [James_Emerton] James Emerton Tri Tech Computers mailto:james&tri-tech.com 2012-11-19 -# Ltd. -# [James_Falkner] James Falkner mailto:james.falkner&sun.com -# [James_Figgins] James Figgins mailto:james.figgins&durodata.co.uk 2006-07 -# [James_Gettys] James Gettys mailto:jg&w3.org -# [James_Goddard] James Goddard mailto:jamesg&taglim.com 2005-08 -# [James_Greenfiel] James Greenfiel mailto:jim&pa.confluent.com -# [James_Irwin] James Irwin mailto:jimi&travsoft.com -# [James_J_Diaz] James J. Diaz mailto:JDiaz&emprisecorporation.com 2002-08 -# [James_Juhasz] James Juhasz mailto:james.juhasz&ni.com -# [James_Kennedy] James Kennedy mailto:james&tritium.com.au 2011-02-15 -# [James_King_III] James King III mailto:jking&ariessys.com -# [James_Kirkwood] James Kirkwood mailto:james.kirkwood&controltechniques.com 2005-06 -# [James_Kou] James Kou mailto:Jamesk&versatek.com -# [James_Kunz] James Kunz mailto:jkunz&earlhaig.com -# [James_Marsh] James Marsh mailto:James_T_Marsh&hotmail.com -# [James_McCartney] James McCartney mailto:jmccartney&apple.com -# [James_Mealey] James Mealey mailto:jymealey&yahoo.com 2002-10 -# [James_Moore] James Moore mailto:jam&wirerimmed.com -# [James_Nikolai] James Nikolai mailto:jamesnikolai&rpm-psi.com -# [James_Overby] James Overby -# [James_Paul_Duncan] James Paul Duncan mailto:pduncan&beaconcrm.com -# [James_Pinkerton] James Pinkerton mailto:jpinkµsoft.com 2003-11 -# [James_Powell] James Powell mailto:james&mailhost.unidata.com -# [James_Powell_2] James Powell mailto:james&enghp.unidata.comp -# [James_Rice] James Rice mailto:RICE&sumex-aim.stanford.edu -# [James_Tavares] James Tavares Log On America mailto:krontor&loa.com -# [James_W_Walker] James W. Walker mailto:jamesw&frameforge3d.com -# [James_Wilkinson] James Wilkinson mailto:jwilkinson&doubletake.com 2006-04 -# [James_Wilkinson2] James Wilkinson Vision Solutions, mailto:james.wilkinson&visionsolutions.com 2012-06-06 -# Inc. -# [James_Yonan] James Yonan mailto:jim&yonan.net 2004-11 -# [Jamie_Halmick] Jamie Halmick mailto:jamie&tinkerbuilt.com -# [Jamie_Lokier] Jamie Lokier mailto:jamie&jlokier.co.uk 2006-05 -# [Jan_Dirven] Jan Dirven mailto:jan.dirven&agfa.com 2007-12-13 -# [Jan_Friedel] Jan Friedel mailto:Jan.Friedel&sun.com 2009-05-07 -# [Jan_Rutger_Voorhorst] Jan Rutger Voorhorst mailto:janrutger&roadware.nl 2006-10 -# [Jan_Vrsinsky] Jan Vrsinsky mailto:jan.vrsinsky&illusionsoftworks.com 2002-09 -# [Jane_Dashevsky] Jane Dashevsky mailto:jane.dashevsky&intel.com -# [Jane_Porter] Jane Porter mailto:janeporter&uk.ibm.com -# [Janna_Chang] Janna Chang mailto:janna&pmc.philips.com -# [Janos_Lerch] Janos Lerch mailto:lerch&softic.hu 2006-02 -# [Janstor_Technology] Janstor Technology mailto:jtadmin&janstor.com 2015-06-08 -# [JANUS_spol] JANUS, spol. s r.o. mailto:ahmadyar&myq.cz 2013-04-23 -# [Jarkko_Oikarinen] Jarkko Oikarinen mailto:jto&tolsun.oulu.fi -# [Jarrod_Sayers] Jarrod Sayers mailto:jarrod&downtools.com.au 2009-04-07 -# [Jasmin_Blouin] Jasmin Blouin Inertia Systemes mailto:jasmin.blouin&inertiasystemes.com 2015-06-11 -# [Jasmine_Strong] Jasmine Strong heroicrobotics.com mailto:jasmine&heroicrobotics.com 2014-06-24 -# [Jason_Aiken] Jason Aiken mailto:jasona&corelcomputer.com -# [Jason_Aubain] Jason Aubain mailto:jaubain&kjt.com -# [Jason_Case] Jason Case mailto:jason.case&ni.com 2002-08 -# [Jason_Cater] Jason Cater mailto:jason&ncsmags.com -# [Jason_Dictos] Jason Dictos mailto:jdictos&barracuda.com 2012-09-19 -# [Jason_Dzubak] Jason Dzubak mailto:dzubak&byu.edu 2008-03-17 -# [Jason_Hamilton] Jason Hamilton mailto:JHamilton&griddatasecurity.com 2006-06 -# [Jason_Howard] Jason Howard mailto:jason&spectsoft.com 2006-01 -# [Jason_Hunter] Jason Hunter mailto:jthunter&invino.com -# [Jason_Ko] Jason Ko mailto:jason_ko&hp.com 2002-07 -# [Jason_Leupen] Jason Leupen mailto:Jleupen&aol.com -# [Jason_Lockett] Jason Lockett mailto:Jay.Lockett&quest.com 2008-12-16 -# [Jason_McManus] Jason McManus mailto:jasonm&neoinformatics.com -# [Jason_McManus_2] Jason McManus mailto:jasonm&sleepdep.net -# [Jason_Reskin] Jason Reskin mailto:iana&unistellar.com 2007-03 -# [Jason_Rohrer] Jason Rohrer mailto:rohrer&cse.ucsc.edu 2002-10 -# [Jason_Santos] Jason Santos mailto:jason.santos&megaslow.net 2002-04 -# [Jason_Schiller] Jason Schiller Google Inc. mailto:jschiller&google.com 2015-07-31 -# [Jason_Schoon] Jason Schoon mailto:jason.schoon&intermec.com 2002-10 -# [Jason_Schoon_2] Jason Schoon mailto:jason.schoon&intermec.com -# [Jason_Spence] Jason Spence mailto:jspence&lightconsulting.com 2008-01-22 -# [Jason_Szabo] Jason Szabo mailto:jason.szabo&vexcel.com 2003-10 -# [Jason_Thorpe] Jason Thorpe mailto:thorpej&apple.com 2015-09-29 -# [Jason_Volk] Jason Volk mailto:jason&teknidude.com -# [Jason_van_Zyl] Jason van Zyl mailto:jvanzyl&zenplex.com 2002-03 -# [Jauvane_C_de_Olivei] Jauvane C. de Oliveira mailto:jauvane&acm.org -# [Javier_Jimenez] Javier Jimenez -# [Javier_Jiminez] Javier Jiminez mailto:javier_l_jimenez&dell.com -# [Javier_Nigro] Javier Nigro Arrow Bit SL mailto:support&arrowbit.com 2012-04-26 -# [JaxMP] JaxMP mailto:shull&jaxmp.com 2014-08-15 -# [Jay_Beavers] Jay Beavers mailto:Jay.Beaversµsoft.com 2006-02 -# [Jay_Cotton] Jay Cotton mailto:JAY&calc.vet.uga.edu -# [Jay_Eckles] Jay Eckles mailto:ecklesweb&yahoo.com 2002-02 -# [Jay_Farhat] Jay Farhat mailto:jfarhat&ipass.com -# [Jay_Slupesky] Jay Slupesky mailto:js&vina-tech.com -# [Jay_Weber] Jay Weber mailto:weber&vfi.com -# [Jay_Werb] Jay Werb ISA100 Wireless mailto:jay&jwerb.com 2015-07-24 -# Compliance Institute -# [Jay_Whitney] Jay Whitney mailto:jw&powercenter.com -# [Jayakumar_Ramalingam] Jayakumar Ramalingam mailto:jayakumar&novell.com -# [Jayasooriah] Jayasooriah mailto:jayasooriah&cast.com.au 2008-02-22 -# [Jean_A_Ames] Jean A. Ames mailto:engr-admin&flipside.com -# [Jean-Charles_Boude] Jean-Charles Boude Gangsta Ltd. mailto:jc&gangstamedia.com 2011-10-17 -# [Jean_Christophe_Desi] Jean-Christophe Desire mailto:Jean-Christophe_Desire&nms-europe.com -# [Jean-Francois_Gauthier] Jean-Francois Gauthier Apsolab Inc. mailto:jfgauthier&apsolab.com 2014-11-10 -# [Jean_Francois_Rabass] Jean-Francois Rabasse mailto:jfr&idps.org 2003-07 -# [Jean_Louis_Barbut] Jean-Louis Barbut mailto:etebac5&gsit.fr -# [Jean_Marc_Frailong] Jean-Marc Frailong mailto:jmf&freegate.net -# [Jean_Michel_URSCH] Jean-Michel URSCH mailto:ursch&taec.enet.dec.com -# [Jean_Olivier_Lanctot] Jean-Olivier Lanctot-D. mailto:jolivierld&clichesw.com -# [Jean_Paul_Lemaire] Jean-Paul Lemaire mailto:jean-paul.lemaire&univ-paris-diderot.fr 2007-07-05 -# [Jean_Paul_Moreaux] Jean-Paul Moreaux mailto:jean-paul.moreaux&airbus.com -# [Jean_Pierre_Garcia] Jean-Pierre Garcia mailto:jp.garcia&netia.net 2003-04 -# [Jean_Pierre_Garcia_2] Jean-Pierre Garcia mailto:jp.garcia&netia.com 2009-10-28 -# [Jean_Serge_Gagnon] Jean-Serge Gagnon mailto:jean-serge.gagnon&newlix.com -# [Jean_Serge_Gagnon_2] Jean-Serge Gagnon mailto:jsg&newlix.com -# [Jeannie_Burleson] Jeannie Burleson mailto:jeannie&cambertx.com -# [Jeff_Albouze] Jeff Albouze mailto:foup&apple.com -# [Jeff_Burch] Jeff Burch mailto:jeff.burch&amx.com -# [Jeff_Burdette] Jeff Burdette mailto:support&digitalenvoy.net -# Regents of the -# [Jeff_Burke] Jeff Burke University of mailto:jburke&remap.ucla.edu 2013-10-30 -# California -# [Jeff_Busma] Jeff Busma mailto:busma&echogent.com -# [Jeff_Conrad] Jeff Conrad mailto:jeff_conrad&hp.com -# [Jeff_Dillabough] Jeff Dillabough Teradici mailto:jdillabough&teradici.com 2012-03-06 -# [Jeff_Douglass] Jeff Douglass mailto:ist&att.net 2002-09 -# [Jeff_Eaton] Jeff Eaton mailto:jeaton&intermec.com -# [Jeff_Garbers] Jeff Garbers mailto:FJG030&email.mot.com -# [Jeff_Garbers_2] Jeff Garbers mailto:jgarbers&netcom.com -# [Jeff_Grossman] Jeff Grossman mailto:jagrossm&andrew.cmu.edu -# [Jeff_Haynes] Jeff Haynes mailto:haynes&chistech.com -# [Jeff_Heisz] Jeff Heisz mailto:jeff.heisz&xkoto.com 2006-02 -# [Jeff_Hoffman] Jeff Hoffman mailto:jeffh&facsys.com -# [Jeff_Holmbeck] Jeff Holmbeck mailto:Jeff.Holmbeck&veritas.com -# [Jeff_Hughes] Jeff Hughes mailto:Jeff.Hughes&columbiasc.ncr.com -# [Jeff_Jones] Jeff Jones mailto:Jeff.Jones&routematch.com 2005-11 -# [Jeff_King] Jeff King mailto:jking&wave3software.com 2002-09 -# [Jeff_Looman] Jeff Looman mailto:jeff&looman.org -# [Jeff_M_Michaud] Jeff M.Michaud mailto:michaud&zk3.dec.com -# [Jeff_Mangasarian] Jeff Mangasarian mailto:jeffrey_mangasarian&nai.com -# [Jeff_Moffatt] Jeff Moffatt mailto:jeff&taurus.com -# [Jeff_Roberts] Jeff Roberts mailto:jrobertsµsoft.com 2005-11 -# [Jeff_Rosenthal] Jeff Rosenthal mailto:jrosenthal&quad-sys.com -# [Jeff_Skaistis] Jeff Skaistis mailto:jskaistis&connectship.com 2005-08 -# [Jeff_Stewart] Jeff Stewart mailto:jstewart&netscape.com -# [Jeff_Wamsley] Jeff Wamsley gocso.net mailto:jeffw&gocso.net 2013-09-04 -# [Jeff_Wood] Jeff Wood mailto:jw&cqg.com -# [Jeffery_Chiao] Jeffery Chiao tel:+714-768-401 -# [Jeffrey_C_Byrd] Jeffrey C. Byrd mailto:admin&vspacegroup.com -# [Jeffrey_Chiao] Jeffrey Chiao mailto:chiaoj&netsoft.com -# [Jeffrey_Daniel_Koftinoff] Jeffrey Daniel Koftinoff IEEE-1722.1 mailto:jeff.koftinoff&ieee.com 2011-11-01 -# [Jeffrey_Hill] Jeffrey Hill mailto:johill&lanl.gov 2002-08 -# [Jeffrey_J_Peters] Jeffrey J. Peters mailto:jpeters&tivo.com 2002-08 -# [Jeffrey_J_Walls] Jeffrey J. Walls mailto:jeff.walls&hp.com -# [Jeffrey_Millman] Jeffrey Millman mailto:jcm&dbstar.com -# [Jeffrey_Pilch] Jeffrey Pilch mailto:jpilch&us.ibm.com -# [Jeffrey_Sadeli] Jeffrey Sadeli mailto:jeffrey&sadeli.com -# [Jeffrey_Szczepanski] Jeffrey Szczepanski mailto:jrs&inscitek.com 2005-02 -# [Jeffrey_Zinkerman] Jeffrey Zinkerman mailto:jeff&zinknet.com -# [Jeffry_Dwight] Jeffry Dwight mailto:jeffryd&greyware.com -# [Jem_Treadwell] Jem Treadwell mailto:Jem.Treadwell&compaq.com -# [Jenish_Amin] Jenish Amin Motorola Solutions, mailto:jenish&motorolasolutions.com 2012-03-14 -# Inc. -# [Jennifer_Grace] Jennifer Grace mailto:Jennifer_Grace&3com.com -# [Jens_Alfke] Jens Alfke mailto:jens&apple.com -# [Jens_Clauss] Jens Clauss BSH Bosch und Siemens mailto:jens.clauss&bshg.com 2013-06-11 -# Hausgeraete GmbH -# [Jens_Edlund] Jens Edlund mailto:edlund&speech.kth.se 2005-08 -# [Jens_Kilian] Jens Kilian mailto:jensk&hpbeo82.bbn.hp.com -# [Jens_Klose] Jens Klose mailto:jklose&intercope.com -# [Jens_Nilsson] Jens Nilsson mailto:jens&rockstorm.se -# [Jered_Floyd] Jered Floyd mailto:jered&permabit.com 2004-06 -# [Jeremy_Crawford] Jeremy Crawford mailto:jeremy&reso.org 2015-09-07 -# [Jeremy_Elson] Jeremy Elson mailto:jelson&isi.edu -# [Jeremy_Freeman] Jeremy Freeman mailto:jeremy&rxnetworks.ca 2008-02-14 -# [Jeremy_Gilbert] Jeremy Gilbert mailto:J.Gilbert&ma30.bull.com -# [Jeremy_Gilliat] Jeremy Gilliat mailto:jeremy.gilliat&geac.com -# [Jeremy_Maiden] Jeremy Maiden mailto:jeremy&komarr.demon.co.uk -# [Jeremy_McClintock] Jeremy McClintock mailto:jeremy&tridsys.com 2005-08 -# [Jeremy_Siegel] Jeremy Siegel mailto:jzs&nsd.3com.com -# [Jeroen_Ommering] Jeroen Ommering TEST-OK B.V. mailto:jeroen.ommering&test-ok.nl 2012-09-05 -# [Jeroen_Massar] Jeroen Massar mailto:jeroen&unfix.org 2005-08 -# [Jeroen_Massar_2] Jeroen Massar mailto:jma&zurich.ibm.com 2008-08-21 -# [Jeroen_Massar_3] Jeroen Massar mailto:jeroen&unfix.org -# [Jerome_AERTS] Jerome AERTS mailto:info&pcsoft.fr 2010-11-30 -# [Jerome_AERTS_2] Jerome AERTS PC SOFT mailto:jae&pcsoft.fr 2014-02-02 -# [Jerome_Albin] Jerome Albin mailto:albin&taec.enet.dec.com -# [Jerome_Dusautois] Jerome Dusautois mailto:jdusautois&scrypto.fr 2002-03 -# [Jerome_FOLLUT] Jerome FOLLUT COPALP mailto:jf&copalp.com 2012-03-01 -# [Jerome_Forissier] Jerome Forissier mailto:Jerome.Forissier&hp.com 2005-12 -# [Jerome_Grimbert] Jerome Grimbert mailto:jerome.grimbert&atosorigin.com -# [Jerome_Laheurte] Jerome Laheurte mailto:fraca7&users.sourceforge.net -# [Jerome_Seydoux] Jerome Seydoux mailto:jerome&ctmdev.com -# [Jerrilynn_Okamura] Jerrilynn Okamura -# [Jerry_Whitaker] Jerry Whitaker mailto:jwhitaker&atsc.org 2008-10-27 -# [Jesse_Curry] Jesse Curry Bout Fitness, LLC mailto:jesse&boutfitness.com 2014-06-16 -# [Jesse_Gross] Jesse Gross mailto:jgross&vmware.com 2014-03-27 -# [Jesse_McKay] Jesse McKay mailto:jesse&spandata.com -# [Jesse_Ursery] Jesse Ursery mailto:jesse.ursery&ametek.com 2010-11-22 -# [Jesse_W_Towner] Jesse W. Towner mailto:jwtowner&dsmedialabs.com -# [Jessica_Yan] Jessica Yan mailto:jessica.yan2&t-mobile.com 2008-02-19 -# [Jessica_Zhang] Jessica Zhang Dell mailto:jessica_z&dell.com 2012-11-19 -# [Jesus_David_Rodrigue] Jesus David Rodriguez mailto:jesusdavid&magaya.com 2003-02 -# [Jesus_De_Meyer] Jesus De Meyer mailto:jesus&edot-studios.com -# [Jesus_Ortiz] Jesus Ortiz mailto:jesus_ortiz&emotion.com -# [Jesus_Ortiz_2] Jesus Ortiz mailto:Jesus_A._Ortiz¬es.emotion.com -# [Jeurgen_Broesamle] Jeurgen Broesamle mailto:juergb&bbn.hp.com -# [JG_Heithcock] JG Heithcock Retrospect, Inc. mailto:JG.Heithcock&retrospect.com 2012-02-02 -# [Jian_Fan] Jian Fan mailto:fjian&dmfsys.com 2002-02 -# [Jilles_Oldenbeuving] Jilles Oldenbeuving mailto:ojilles&hotmail.com 2002-06 -# [Jim_Baldridge] Jim Baldridge mailto:jimb&rpower.com -# [Jim_Battin] Jim Battin mailto:battin&tro.com -# [Jim_Binkley] Jim Binkley mailto:jrb&cs.pdx.edu 2002-06 -# [Jim_Bound] Jim Bound mailto:bound&zk3.dec.com -# [Jim_Cleppe] Jim Cleppe mailto:clep13&hotmail.com -# [Jim_Davis] Jim Davis mailto:jim.davis&wbemsolutions.com 2007-06 -# [Jim_Davis_2] Jim Davis WS, Inc mailto:Jim.Davis&ws-inc.com 2015-04-24 -# [Jim_DeLisle] Jim DeLisle mailto:jdelisle&swellsoftware.com 2002-08 -# [Jim_Dillon] Jim Dillon mailto:jed&apri.com -# [Jim_Dixon] Jim Dixon mailto:jim&lambda.com -# [Jim_Flaherty] Jim Flaherty mailto:jim.flaherty&seagatesoftware.com -# [Jim_Flaherty_2] Jim Flaherty mailto:jim_e_flaherty¬es.seagate.com -# [Jim_Gettys] Jim Gettys mailto:jg&crl.dec.com -# [Jim_Harlan] Jim Harlan mailto:jimh&infowest.com -# [Jim_Herman] Jim Herman mailto:jherman&homelogic.com 2005-08 -# [Jim_Hill] Jim Hill mailto:jhill&symantec.com -# [Jim_Humphreys] Jim Humphreys mailto:jhumphre&ciena.com 2008-01-29 -# [Jim_Irwin] Jim Irwin mailto:jirwin&n2h2.com 2002-02 -# [Jim_Jennings] Jim Jennings tel:+1-708-538-7241 -# [Jim_Johnston] Jim Johnston mailto:jjohnston&databeam.com -# [Jim_Kanzler] Jim Kanzler mailto:jim.kanzler&meta5.com -# [Jim_Kateley] Jim Kateley mailto:asr-dev&group.apple.com 2006-01 -# [Jim_Kingdon] Jim Kingdon mailto:kingdon&harvey.cyclic.com -# [Jim_Lyle] Jim Lyle mailto:jim.lyle&siliconimage.com 2005-11 -# [Jim_Lyle_2] Jim Lyle mailto:jim.lyle&siliconimage.com -# [Jim_Lyon] Jim Lyon mailto:JimLyonµsoft.com 2005-11 -# [Jim_McDonald] Jim McDonald mailto:Jim.McDonald&sysdm.com 2003-04 -# [Jim_McDonald_2] Jim McDonald mailto:jim.mcdonald&sysdm.com 2003-11 -# [Jim_Mertz] Jim Mertz mailto:JMertz+RV09&rvdc.unisys.com -# [Jim_Musgrave] Jim Musgrave mailto:jimm&tarantella.com 2002-08 -# [Jim_Perreault] Jim Perreault mailto:jim.perreault&emc.com 2010-06-04 -# [Jim_Pettinato] Jim Pettinato mailto:jim_pettinato&fmcti.com 2007-04 -# [Jim_Philippou] Jim Philippou mailto:jphilippou&newoak.com -# [Jim_Robanske] Jim Robanske mailto:jimr&cray.com 2006-05 -# [Jim_Rogers] Jim Rogers mailto:trane!jimbo&pacbell.com -# [Jim_Sermersheim] Jim Sermersheim mailto:jims&fusionio.com 2010-01-15 -# [Jim_Stabile] Jim Stabile mailto:jstabile&talarian.com -# [Jim_Susoy] Jim Susoy mailto:jim.susoy&p6r.com 2010-01-21 -# [Jim_Taylor] Jim Taylor mailto:taylor&heart.epps.kodak.com -# [Jim_Teague] Jim Teague mailto:teague&zso.dec.com -# [Jim_Thompson] Jim Thompson mailto:jim.thompson&powerware.com -# [Jim_Trek] Jim Trek mailto:jtrek&rochester.rr.com -# [Jim_Trocki] Jim Trocki mailto:trockij&transmeta.com -# [Jim_Turner] Jim Turner mailto:Jim.Turner&asg.com -# [Jim_Vlcek] Jim Vlcek mailto:jvlcek&veeco.com -# [Jim_Wallace] Jim Wallace mailto:jim&cs.dal.ca -# [Jim_White] Jim White mailto:Jim_White&spiderisland.com -# [Jim_Youll] Jim Youll mailto:jim&media.mit.edu -# [Jimmy_Olsen] Jimmy Olsen mailto:jo&redpill-linpro.com 2010-12-24 -# [Jimmy_Talbot] Jimmy Talbot mailto:jtalbot&vizible.com -# [Jindra_Ryvola] Jindra Ryvola mailto:jryvola&ledalite.com -# [Joachim_Kluemper] Joachim Kluemper mailto:ports&raikosoft.com 2008-03-19 -# [Joakim_Johansson] Joakim Johansson mailto:joakim.johansson&tbricks.com -# [Joan_Linck] Joan Linck mailto:jlinck&lanovation.com -# [Jochen_Hansmeyer] Jochen Hansmeyer mailto:cjh&krypton.de -# [Joe_Ballantyne] Joe Ballantyne Microsoft Corporation mailto:joeballµsoft.com 2013-06-16 -# [Joe_Devlin] Joe Devlin mailto:Joe.Devlin&rocketsoftware.com 2002-03 -# [Joe_Elliott] Joe Elliott mailto:joe&inetd.com 2002-06 -# [Joe_Enke] joe enke GoPro mailto:jenke&gopro.com 2014-10-13 -# [Joe_Graham] Joe Graham mailto:joe&edaconsulting.com -# [Joe_Groff] Joe Groff mailto:arcata&gmail.com -# [Joe_Haver] Joe Haver mailto:joe.haver&jdsu.com 2010-05-28 -# [Joe_McCollough] Joe McCollough mailto:joe&cadkey.com -# [Joe_Mueller] Joe Mueller mailto:joe_mueller&agilent.com 2010-01-11 -# [Joe_Pato] Joe Pato mailto:pato&apollo.hp.com -# [Joe_Purcell] Joe Purcell mailto:jpurcell&ensuretech.com 2003-01 -# [Joe_Senner] Joe Senner mailto:jsenner&buildforge.com 2005-08 -# [Joe_Senner_2] Joe Senner mailto:support&buildforge.com -# [Joe_Touch] Joe Touch mailto:touch&isi.edu -# [Joe_Wesley] Joe Wesley mailto:joe.wesley&east.sun.com -# [Joel_Aaron_Clipperton] Joel Aaron Clipperton Shifted Current LLC mailto:joel&shiftedcurrent.com 2012-09-11 -# [Joel_Dolisy] Joel Dolisy mailto:joel.dolisy&solarwinds.com 2008-09-10 -# [Joel_E_Steiger] Joel E. Steiger mailto:jsteiger&eic-us.com 2004-02 -# [Joel_Karafin] Joel Karafin mailto:jkarafin&infotrieve.com -# [Joel_Palsson] Joel Palsson HMS Industrial mailto:ianacontact&hms.se 2002-02 -# Networks AB -# [Joerg_Heuer] Joerg Heuer mailto:Joerg.Heuer&siemens.com 2006-02 -# [Joerg_Niehoff] Joerg Niehoff mailto:joerg.niehoff&alcatel-ke.de -# [Joerg_Paulus] Joerg Paulus mailto:tech&nicetec.de -# [Joerg_Schneider] Joerg Schneider mailto:joerg.s.schneider&daimler.com 2011-01-26 -# [Joerg_Ullmann] Joerg Ullmann Festo AG & Co. KG mailto:jgu&de.festo.com 2012-07-26 -# [Johan_Deleu] Johan Deleu mailto:johan.deleu&alcatel.be 2002-02 -# [Johan_Eriksson] Johan Eriksson mailto:johan&marimba.com 2002-04 -# [Johan_Kool] Johan Kool mailto:johan&koolistov.net -# [Johan_Mjones] Johan Mjones mailto:johan&nollbit.com -# [Johann_Arnold] Johann Arnold mailto:johann.arnold&siemens.com 2004-10 -# [Johann_Deutinger] Johann Deutinger mailto:deutinger&ferrari-electronic.de -# [Johannes_Skov_Frands] Johannes Skov Frandsen mailto:joe&42tools.com 2008-02-28 -# [John_Aquilino] John Aquilino mailto:john.aquilino&maryville.com -# [John_Barnes] John Barnes mailto:jbarnes&crl.com -# [John_Birrell] John Birrell mailto:birjo99&cai.com -# [John_Border] John Border mailto:border&hns.com 2003-01 -# [John_Britton] John Britton mailto:johnb&peakaudio.com -# [John_C_Horton] John C. Horton mailto:jch&unirsvl.rsvl.unisys.com -# [John_C_Klensin] John C. Klensin mailto:klensin&jck.com 2004-07 -# [John_Calcote] John Calcote mailto:jcalcote&users.sourceforge.net 2007-11-06 -# [John_Calcote_2] John Calcote mailto:jcalcote&novell.com 2006-10 -# [John_Catherino] John Catherino mailto:cajo&dev.java.net 2005-08 -# [John_Chiong] John Chiong mailto:jchiong&a10networks.com 2007-07-02 -# [John_Clifford] John Clifford mailto:John.Clifford&veritas.com -# [John_Coll] John Coll mailto:john&csoft.co.uk -# [John_Croft] John Croft mailto:john.croft&calista.demon.co.uk -# [John_Daniel_Bonamico] John Daniel Bonamico mailto:jbonamico&symantec.com -# [John_Dziadosz] John Dziadosz Honwywell Security mailto:john.dziadosz&honeywell.com 2012-04-09 -# Group -# [John_E_Dickey] John E. Dickey mailto:jdickey&talarinetworks.com 2007-09-27 -# [John_Eckert] John Eckert Valassis mailto:eckertj&valassis.com 2015-05-05 -# [John_Fake] John Fake mailto:fake&us.ibm.com -# [John_Fayos] John Fayos mailto:john.fayos&criticallink.com 2002-03 -# [John_Feiler] John Feiler mailto:relief!jjfeiler&uu2.psi.com -# [John_Flowers] John Flowers mailto:jf&gigamediaaccess.com -# [John_Fox] John Fox -# [John_Graham_Cumming] John Graham-Cumming CloudFlare, Inc. mailto:jgc&cloudflare.com 2012-03-09 -# [John_Hadjioannou] John Hadjioannou mailto:john&minster.co.uk -# [John_Harvey] John Harvey mailto:johnbob&austin.ibm.com -# [John_Hasselkus] John Hasselkus mailto:Jhasselkus&visualnetworks.com -# [John_Havard] John Havard mailto:jh&hxe.us 2003-11 -# [John_Hinsdale] John Hinsdale mailto:hin&alma.com -# [John_Hogg] John Hogg mailto:it&discoverysoftware.com -# [John_Ioannidis] John Ioannidis mailto:ji&close.cs.columbia.ed -# [John_Jackson] John Jackson mailto:jrj&gandalf.cc.purdue.edu -# [John_Jobe] John Jobe mailto:jjobe&cylink.com -# [John_Kane] John Kane mailto:johnkanµsoft.com -# [John_Keaveney] John Keaveney mailto:johnkeaveney&targusinfo.com -# [John_Kelly] John Kelly mailto:johnk&bellhow.com -# [John_Kozlowski] John Kozlowski ShofarNexus.com mailto:John.Kozlowski&ShofarNexus.com 2012-02-20 -# [John_Legh_Page] John Legh-Page mailto:john.legh-page&argis.com -# [John_Levon] John Levon Oracle mailto:john.levon&oracle.com 2013-12-24 -# [John_Light] John Light mailto:johnl&gssc.gss.com -# [John_Linn] John Linn mailto:jlinn&securitydynamics.com -# [John_Lisek] John Lisek mailto:jl&gotodevice.com 2006-01 -# [John_Lombardo] John Lombardo mailto:johnl&picksys.com -# [John_Lowery] John Lowery NetPro Computing mailto:jlowery&netpro.com 2008-08-21 -# [John_M_Baird] John M. Baird mailto:jbaird&e-watch.com 2003-07 -# [John_M_Baird_2] John M Baird e-Watch Corporation mailto:jbaird&e-watch.com 2014-05-13 -# [John_MacMullin] John MacMullin mailto:john.macmullin&cox.net -# [John_Marland] John Marland mailto:jmarland&dean.openport.com -# [John_McCann] John McCann mailto:jmccann&visualclick.com 2006-12 -# [John_McCormack] John McCormack mailto:jmac&cisco.com -# [John_McKernan] John McKernan mailto:John.McKernan&sun.com -# [John_Meredith] John Meredith mailto:John.Meredith&etsi.org 2009-09-08 -# [John_Mertus] John Mertus mailto:mertus&mathtech.com -# [John_Mitchell] John Mitchell Found Software, Inc. mailto:john&foundapp.com 2012-04-11 -# [John_Morton] John Morton mailto:j.morton&hp.com 2004-11 -# [John_Murphy] John Murphy mailto:john.m.murphy&mci.com -# [John_Muth] John Muth mailto:muth¶scale.com 2010-01-21 -# [John_Myers] John Myers mailto:jgm+&cmu.edu -# [John_Parello] John Parello mailto:jparello&cisco.com 2009-05-19 -# [John_Payne] John Payne mailto:jpayne&lotus.com -# [John_Payson] John Payson mailto:john&circad.com 2007-10-22 -# [John_R_Chawner] John R. Chawner tel:+1-817-354-1004 -# [John_R_Deuel] John R. Deuel mailto:kink&netops.com -# [John_Rainford] John Rainford mailto:jrainford&passgo.com -# [John_Rainford_2] John Rainford mailto:john.rainford&passgo.com -# [John_Reynolds] John Reynolds mailto:John.Reynolds&datacoresl.com 2012-04-17 -# [John_Richardson] John Richardson Citrix Systems -# [John_Richmond] John Richmond mailto:developers&securitydesigners.com 2002-03 -# [John_Richmond_2] John Richmond mailto:john&ndl.co.uk -# [John_Ryan] John Ryan mailto:john&cybertrace.com -# [John_Scalo] John Scalo mailto:scalo&apple.com -# [John_Schilling] John Schilling mailto:john&jschilling.net -# [John_Skidmore] John Skidmore mailto:JSkidmore&vicon-cctv.com 2002-07 -# [John_Stephen] John Stephen mailto:iana&mundocani.com 2002-07 -# [John_Sygulla] John Sygulla SGI mailto:jsygulla&sgi.com 2013-01-07 -# [John_T_McCann] John T. McCann mailto:jmccann&softwaremetering.com 2003-10 -# [John_Tafoya] John Tafoya mailto:johntµsoft.com -# [John_Taylor] John Taylor Ingersoll Rand, Inc. mailto:john.taylor&irco.com 2011-09-28 -# [John_Tintor] John Tintor mailto:jt&yo.net -# [John_Tokash] John Tokash mailto:jtokash&homestead.com -# [John_Trudeau] John Trudeau mailto:jtrudeau&cup.hp.com -# [John_Wallace] John Wallace mailto:john&nowsoftware.com -# [John_Wason] John Wason Wason Technology, LLC mailto:wason&wasontech.com 2014-01-27 -# [John_Wendt] John Wendt tel:+1-614-261-2000 -# [John_Williams] John Williams mailto:John.H.Williams&hp.com 2007-06 -# [John_Willis] John Willis mailto:jwillis&arielusa.com 2002-09 -# [John_Wood] John Wood mailto:John.Wood&netiq.com -# [John_Yeager] John Yeager mailto:johnyeager&avaya.com -# [Johnnie_Walker] Johnnie Walker mailto:mrwalker&randomsequence.com -# [Johnny_C_Norris_II] Johnny C. Norris II mailto:jnorris&uiuc.edu -# [Johnny_Zweig] Johnny Zweig mailto:zweig&netwave-wireless.com -# [Johnson_Davis] Johnson Davis mailto:johnsond&opteamasoft.com -# [Johnson_Luo] Johnson Luo mailto:johnson_luo&mail.sercomm.com.tw -# [Jon_A_Christopher] Jon A. Christopher mailto:jac8792&tamu.edu -# [Jon_Bolen] Jon Bolen mailto:jon.bolen&westec.net 2009-03-18 -# [Jon_Ingi_Ingimundars] Jon Ingi Ingimundarson mailto:jii&oz.com 2003-03 -# [Jon_March] Jon March mailto:jon.march&paget-analyst-services.co.uk 2006-09 -# [Jon_Postel] Jon Postel mailto:postel&isi.edu -# [Jon_Press] Jon Press mailto:IANA.Registions&ca.com 2005-09 -# [Jon_Robertson] Jon Robertson mailto:jmrobertson&medevolve.com 2008-10-24 -# [Jon_Rosarky] Jon Rosarky mailto:JRosarky&symantec.com -# [Jon_S_Kyle] Jon S. Kyle mailto:JKyle&speedwaysoftware.com -# [Jon_Saperia] Jon Saperia mailto:saperia&bgs.com -# [Jon_Walker] Jon Walker mailto:jwalker&miramarsys.com -# [Jon_Xu] Jon Xu mailto:jonxuµsoft.com 2005-08 -# [Jonas_Ahlqvist] Jonas Ahlqvist mailto:jonas.a&informationssystem.se 2005-08 -# [Jonas_Bovin] Jonas Bovin mailto:jonas.bovin&quickobjects.com -# [Jonas_Gyllensvaan] Jonas Gyllensvaan mailto:jonas&conceivium.com 2009-04-27 -# [Jonas_Krogell] Jonas Krogell mailto:jonas.krogell&netadmin.se 2007-07-10 -# [Jonas_Oberg] Jonas Oberg mailto:jonas&coyote.org -# [Jonas_Salling] Jonas Salling mailto:jonas&salling.com -# [Jonas_Sjostedt] Jonas Sjostedt mailto:jonas.sjostedt&breas.com -# [Jonathan] Jonathan mailto:jonathan&mugginsoft.com -# [Jonathan_A_Zdziaras] Jonathan A. Zdziaraski mailto:jonathan&nuclearelephant.com 2004-11 -# [Jonathan_A_Zdziarsk] Jonathan A. Zdziarski mailto:johathan&networkdweebs.com 2002-11 -# [Jonathan_Bastnagel] Jonathan Bastnagel mailto:jonthebagel&gmail.com 2007-09-17 -# [Jonathan_Custance] Jonathan Custance mailto:jevc&camrivox.com 2006-07 -# [Jonathan_Downes] Jonathan Downes mailto:jonno&activ.net.au -# [Jonathan_Leffler] Jonathan Leffler mailto:jleffler&us.ibm.com 2005-12 -# [Jonathan_Mergy] Jonathan Mergy mailto:mergy&natus.com -# [Jonathan_Mitchell] Jonathan Mitchell mailto:jonathan&mugginsoft.com 2008-09-08 -# [Jonathan_S_Shapiro] Jonathan S. Shapiro mailto:registrar&eros-os.org 2002-03 -# [Jonathan_Schaaf] Jonathan Schaaf mailto:j.schaaf&astronautics.com 2010-02-10 -# [Jonathan_Wenocur] Jonathan Wenocur mailto:jhw&shiva.com -# [Joon_Radley] Joon Radley mailto:jradley&csir.co.za -# [Joon_Radley_2] Joon Radley mailto:joon&toltec.co.za 2008-10-21 -# mailto:support&toltec.co.za -# [Jordan_Hrycaj] Jordan Hrycaj mailto:jordan&mjh.teddy-net.com -# [Jordi_Lisbona] Jordi Lisbona mailto:jlisbona&tango04.net -# [Jorg_Hoffmann] Jörg Hoffmann mailto:electronicc_rd&wago.com -# [Jorg_Laschke] Jorg Laschke mailto:laschke&hinz.de -# [Jorge_Aldana] Jorge Aldana mailto:operator&foresyte.com -# [Jorgen_Loland] Jorgen Loland mailto:jorgen.loland&sun.com 2008-02-27 -# [Jorn_Sierwald] Jorn Sierwald mailto:joern.sierwald&datafellows.com -# [Jose_A_Sesin] Jose A. Sesin mailto:sesin&vaultbase.com -# [Jose_Luis] Jose Luis mailto:73374.313&compuserve.com -# [Jose_Luis_Martin_Pei] Jose Luis Martin Peinado mailto:jooe&wifree-project.net 2006-03 -# [Jose_Luis_Tallon] Jose Luis Tallon mailto:joseluis&talloncorp.com 2015-03-09 -# [Josef_Spillner] Josef Spillner mailto:admin&ggzgamingzone.org 2003-01 -# [Joseph_Di_Pol] Joseph Di Pol mailto:joe.dipol&sun.com 2002-04 -# [Joseph_Dziedzic] Joseph Dziedzic mailto:tony.dziedzic&oracle.com 2008-06-06 -# [Joseph_Geer] Joseph Geer mailto:jgeer&peapod.com -# [Joseph_Gray] Joseph Gray mailto:gray&interwise.co.il -# [Joseph_Hauk] Joseph Hauk mailto:joseph.hauk&alphatech.com -# [Joseph_Hines] Joseph Hines mailto:jhines&webmethods.com -# [Joseph_Krebs] Joseph Krebs mailto:joek&caps.com -# [Joseph_LoPilato] Joseph LoPilato mailto:Joseph_M_LoPilato¬es.seagate.com -# [Joseph_M_Newcomer] Joseph M. Newcomer mailto:newcomer&flounder.com -# [Joseph_Mathew] Joseph Mathew mailto:mjoseph&dosa.cisco.com -# [Joseph_Sickel] Joseph Sickel mailto:joe&ozate.com 2011-10-12 -# [Joseph_Swaminathan] Joseph Swaminathan mailto:jswamina&cisco.com 2009-04-01 -# [Joseph_T_Savarese] Joseph T Savarese mailto:joesa&nmwco.com 2007-06 -# [Joseph_Weihs] Joseph Weihs mailto:yossi&bandwiz.com -# [Joshua_Boelter] Joshua Boelter Intel mailto:joshua.boelter&intel.com 2011-10-18 -# [Joshua_Graessley] Joshua Graessley mailto:jgraessley&apple.com 2004-12 -# [Joshua_Hawkins] Joshua Hawkins mailto:joshua.hawkins&hp.com 2003-11 -# [Joshua_Pedroza] Joshua Pedroza Zoom Control Panel mailto:info&zoomcp.com 2014-02-26 -# [Joshua_Prewitt] Joshua Prewitt National Instruments mailto:joshua.prewitt&ni.com 2011-10-24 -# [Josip_Medved] Josip Medved mailto:jmedved&jmedved.com 2010-10-20 -# [Josse_van_Dobben_de] Josse van Dobben de Bruyn mailto:jossedobben&hotmail.com 2009-07-01 -# [Jost_Faganel] Jost Faganel mailto:jost.faganel&hermes.si -# [Josyula_R_Rao] Josyula R. Rao mailto:jrrao&watson.ibm.com -# [Joyce_K_Reynolds] Joyce K. Reynolds mailto:jkrey&isi.edu -# [Juan_Carlos_Luciani] Juan Carlos Luciani mailto:jluciani&novell.com -# [Juan_Carlos_Olivares] Juan Carlos Olivares mailto:jcolivares04c&cenidet.edu.mx 2006-03 -# Rojas -# [Juan_Guerrero] Juan Guerrero fnxsoftware.com mailto:ryoma.nagare&gmail.com 2015-06-30 -# [Juha_Lindfors] Juha Lindfors OpenRemote, Inc. mailto:juha&openremote.org 2012-12-18 -# [Jude_George] Jude George mailto:jude&nas.nasa.gov -# [Juergen_Edelhaeuser] Juergen Edelhaeuser mailto:Juergen.Edelhaeuser&locanis.com 2002-08 -# [Juergen_Fischbach] Juergen Fischbach mailto:juergen.fischbach&philips.com -# [Jugaari] Jugaari mailto:support&jugaari.com -# [Juho_Herttua] Juho Vähä-Herttua mailto:juhovh&iki.fi 2009-04-14 -# [Julian_Biddle] Julian Biddle mailto:julian_biddle&technologyonecorp.com -# [Julian_Mehnle] Julian Mehnle mailto:julian&mehnle.net -# [Julian_Simpson] Julian Simpson Neo Technology, Inc mailto:julian.simpson&neotechnology.com 2013-02-08 -# [Julian_Smith] Julian Smith mailto:jsmith&undo-software.com 2010-04-19 -# [Juliana_Hsu] Juliana Hsu mailto:jhsu&ca.ibm.com -# [Julien_Danjou] Julien Danjou mailto:acid&debian.org 2006-07 -# [Julien_Robert] Julien Robert mailto:jul&abyssoft.com -# [Julien_VALIENTE] Julien VALIENTE mailto:j.valiente&objectif-software.com 2006-05 -# [Jun_Nakamura] Jun Nakamura mailto:jnakamur&cp10.es.xerox.com -# [Jun_Yoshii] Jun Yoshii mailto:yoshii&ael.fujitsu.co.jp -# [Juniper_Networks] Juniper Networks mailto:brijsman&juniper.net 2013-02-01 -# [Juniper_Networks_2] Juniper Networks mailto:rbonica&juniper.net 2015-06-10 -# [Juraj_Zopp] Juraj Zopp mailto:juraj.zopp&pianoforce.com -# [Justin_Cepelak] Justin Cepelak mailto:jcepelak&splashdata.com -# [Justin_Ko] Justin Ko Apple mailto:justin.ko&apple.com 2011-10-20 -# [Justin_Paupore] Justin Paupore mailto:jpaupore&blueshiftlabs.net 2007-08-16 -# [Justin_R_Bendich] Justin R. Bendich mailto:jbendich&us.ibm.com -# [Justin_Vegso] Justin Vegso mailto:jvegso&quantapoint.com 2010-07-01 -# [Justin_Yu] Justin Yu mailto:yyu&mitre.org 2011-05-25 -# [Justine_Higgins] Justine Higgins mailto:iana&corsof.com -# [JVL_Industri_Elektronik] JVL Industri mailto:jvl&jvl.dk 2012-12-21 -# Elektronik -# [Jyri_J_Virkki] Jyri J. Virkki mailto:jyri.virkki&sun.com 2005-12 -# [K_Arvind] K. Arvind mailto:arvind&tenornetworks.com -# [K_K_Ho] K. K Ho mailto:kk.ho&afe-solutions.com 2004-04 -# [Kade_Hansson] Kade Hansson mailto:kade_fh&postoffice.utas.edu.au -# [Kai_Kretschmann] Kai Kretschmann mailto:K.Kretschmann&security-gui.de 2002-03 -# [Kang_Lee] Kang Lee I&M Society TC-9 mailto:kang.lee&nist.gov 2010-07-27 -# [Kannan_Alagappan] Kannan Alagappan mailto:kannan&sejour.enet.dec.com -# [Kannan_Alagappan_2] Kannan Alagappan mailto:kannan&sejour.lkg.dec.com -# [Karelia_Software] Karelia Software -# [Karen_Burns] Karen Burns -# [Karl_Edwall] Karl Edwall mailto:karl&magicnotes.com -# [Karl_Feind] Karl Feind mailto:kaf&sgi.com 2005-10 -# [Karl_Forster] Karl Forster mailto:kforster&lockstep.com -# [Karl_Norrman] Karl Norrman mailto:karl.norrman&ericsson.com 2004-12 -# [Karl_Olafsson] Karl Olafsson mailto:Karl.Olafsson&covariant-systems.com 2008-10-24 -# [Karl_Palsson] Karl Palsson mailto:karl_p&danfoss.com 2004-11 -# [Karl_Rousseau] Karl Rousseau mailto:kr&netfusion.co.uk -# [Karl_Schendel_Jr] Karl Schendel, Jr. mailto:wiz&telesis.com -# [Karl_Timmermann] Karl Timmermann mailto:timmerk&gmail.com -# [Katherine_Wattwood] Katherine Wattwood mailto:katherine.wattwood&veritas.com 2002-06 -# [Kathy_Huber] Kathy Huber mailto:khuber&bbn.com -# [Kathy_Tafel] Kathy Tafel Corpus Collusion mailto:kt&corpuscollusion.com 2011-08-23 -# [Katsuaki_Naoi] Katsuaki Naoi mailto:naoi&pfu.co.jp -# [Katsuhiko_Abe] Katsuhiko Abe mailto:kabe&hst.fujitsu.co.jp -# [Katsuhito_Muroi] Katsuhito Muroi mailto:muroi&pfu.co.jp -# [Katsumi_Oomuro] Katsumi Oomuro mailto:NAE01421&niftyserve.or.jp -# [Katy_Lynn_McCullough] Katy Lynn McCullough mailto:KatyM&laplink.com -# [Kaushik_Biswas] Kaushik Biswas mailto:kbiswas&cisco.com 2006-03 -# [Kay_Roepke] Kay Roepke mailto:Kay.Roepke&sun.com 2009-04-22 -# [Kay_T_Labinsky] Kay T. Labinsky mailto:Kay.Labinsky&sandlab.de 2010-05-03 -# [Kaynam_Hedayat] Kaynam Hedayat mailto:khedayat&roadrunner.pictel.com -# [Kaz_Kylheku] Kaz Kylheku mailto:kkylheku&infowave.com -# [Kaz_Ozawa] Kaz Ozawa mailto:k.ozawa&cablelabs.com -# [Kazuhiro_Koide] Kazuhiro Koide mailto:kaz&pfu.co.jp -# [Kazuhito_Gassho] Kazuhito Gassho mailto:Gassho.Kasuhito&exc.epson.co.jp -# [Kazuo_Moritomo] Kazuo Moritomo Canon Inc mailto:moritomo.kazuo&canon.co.jp 2013-03-28 -# [Kazuya_Ogata] Kazuya Ogata mailto:info&sepv.jp -# [Kedar_Mhaswade] Kedar Mhaswade mailto:kedar.Mhaswade&sun.com 2004-11 -# [Keiji_Michine] Keiji Michine mailto:michine&net.paso.fujitsu.co.jp -# [Keiji_Okuma] Keiji Okuma mailto:okuma&silex.jp 2005-08 -# [Keisokugiken_Corp] Keisokugiken Corp. mailto:adda&kgc.co.jp -# [Keith_Ansell] Keith Ansell mailto:KeithA&fastfreenet.com -# [Keith_Ashman] Keith Ashman mailto:sciana&sculptor.co.uk 2005-12 -# [Keith_Boyce] Keith Boyce -# [Keith_Evans] Keith Evans mailto:keith&loc252.tandem.com -# [Keith_Fligg] Keith Fligg mailto:keith&projtech.com 2002-09 -# [Keith_J_Alphonso] Keith J. Alphonso mailto:alphonso&ncs-ssc.com -# [Keith_Kilroy] Keith Kilroy mailto:Keith.Kilroy&novarcontrols.com 2006-02 -# [Keith_McCloghrie] Keith McCloghrie mailto:kzm&cisco.com -# [Keith_Moore] Keith Moore mailto:moore&cs.utk.edu -# [Keith_Morley] Keith Morley mailto:keith&ndl.co.uk -# [Keith_Paulsen] Keith Paulsen mailto:kpaulsen&phobos.com -# [Keith_Petley] Keith Petley mailto:keithp&sco.com -# [Keith_Rhodes] Keith Rhodes tel:+1-810-559-5955 -# [Keith_Ryden] Keith Ryden mailto:kryden&esri.com 2006-07 -# [Keith_Thompson] Keith Thompson mailto:keith.thompson&sun.com -# [Keith_Trummel] Keith Trummel mailto:ktrummel&autodesk.com -# [Keith_Wood] Keith Wood mailto:keith.wood&epid.eurotherm.co.uk -# [Keith_Wright] Keith Wright mailto:kwright&sensatronics.com 2003-08 -# [Keith_Yarbrough] Keith Yarbrough mailto:kyarbro&windtraveller.com -# [Kelli_Watson] Kelli Watson mailto:kwatson&ci3software.com -# [Kelly_Green] Kelly Green mailto:green&compaq.com -# [Kelly_Sims] Kelly Sims mailto:kellys&garnet.wv.tek.com -# [Kelvin_Lawson] Kelvin Lawson AD Holdings mailto:klawson&ad-holdings.co.uk 2011-10-11 -# [Ken_Anderson] Ken Anderson mailto:kanderso&kleber.ics.uci.edu -# [Ken_Bailey] Ken Bailey mailto:kbailey&rockettalk.com -# [Ken_Blackwell] Ken Blackwell mailto:kenb&bristol.com -# [Ken_Chapman] Ken Chapman mailto:kchapman&isis.com -# [Ken_Crocker] Ken Crocker mailto:kcrockerµsoft.com -# [Ken_Greer] Ken Greer mailto:kg&elan.com -# [Ken_Hearn] Ken Hearn mailto:hearn&hpindacx.cup.hp.com -# [KEN_ICHI_FUJII] Ken'ichi FUJII Canon Inc. mailto:fujii.ken-ichi149&canon.co.jp 2011-10-10 -# [Ken_Jibiki] Ken Jibiki mailto:ken&kenjij.com -# [Ken_Ksiazek] Ken Ksiazek mailto:kksiazek&maytag.com -# [Ken_Lagarec] Ken Lagarec mailto:klagarec&fibics.com 2009-04-17 -# [Ken_Lin] Ken Lin mailto:klin&us.ibm.com -# [Ken_McDonell] Ken McDonell mailto:kenj&internode.on.net 2010-12-20 -# [Ken_McDonell_2] Ken_McDonell mailto:kenj&internode.on.net 2013-10-09 -# [Ken_Moore] Ken Moore mailto:kmoore&groove.net -# [Ken_Nelson] Ken Nelson mailto:nelson&toplayer.com -# [Ken_Oliver] Ken Oliver mailto:koliver02&yahoo.com -# [Ken_Richard] Ken Richard mailto:kenr&aeseducation.com -# [Ken_Sarno] Ken Sarno mailto:kensarno&insightbb.com 2005-08 -# [Ken_Wittmer] Ken Wittmer mailto:kenneth.m.wittmer&accenture.com -# [Kenji_Tetsuyama] Kenji Tetsuyama mailto:kenji&onkyo.co.jp 2002-11 -# [Kenneth_B_Ocheltree] Kenneth B. Ocheltree mailto:kennetho&us.ibm.com 2008-01-07 -# [Kenneth_Flynn] Kenneth Flynn mailto:flynnk&darkcornersoftware.com 2009-10-14 -# [Kenneth_Vaughn] Kenneth Vaughn mailto:kvaughn&mail.viggen.com -# [Kenny_Millar] Kenny Millar Spider Electronics mailto:kenny&spider-e.com 2014-03-10 -# [Kern_Sibbald] Kern Sibbald mailto:kern&sibbald.com 2002-01 -# [Kerry_Hazelgren] Kerry Hazelgren mailto:hazelgren&facespan.com -# [Ketul_Patel] Ketul Patel mailto:ketulp76&yahoo.com 2006-10 -# [Kev_George] Kev George mailto:Kev.George&smiths-aerospace.com 2006-09 -# [Kevin_Arnold] Kevin Arnold mailto:imlucid&apple.com -# [Kevin_Bentley] Kevin Bentley mailto:Kevin&outrage.com -# [Kevin_Birch] Kevin Birch mailto:kbirch&pobox.com -# [Kevin_Bond] Kevin Bond mailto:kevin.bond&ca.com 2004-11 -# [Kevin_Bruckert] Kevin Bruckert mailto:kbruckert&idpco.com -# [Kevin_Brunner] Kevin Brunner mailto:brunner&tivo.com 2003-07 -# [Kevin_Bube] Kevin Bube Mahr GmbH Göttingen mailto:kevin.bube&mahr.de 2013-09-02 -# [Kevin_C_Barber] Kevin C. Barber mailto:kevin.c.barber&saic.com 2009-01-13 -# [Kevin_Calman] Kevin Calman mailto:postmaster&journee.com -# [Kevin_Collins] Kevin Collins mailto:kevinc@.cnd.hp.com -# [Kevin_Collins_2] Kevin Collins mailto:kevinc&cnd.hp.com -# [Kevin_Copas] Kevin Copas mailto:Kevin.Copas&lsi.com 2008-02-07 -# [Kevin_DeVault] Kevin DeVault -# [Kevin_Drew] Kevin Drew Physio-Control, Inc. mailto:kevin.c.drew&physio-control.com 2014-02-14 -# [Kevin_Ediger] Kevin Ediger Software LI-COR mailto:kevin.ediger&licor.com 2011-10-18 -# Biosciences -# [Kevin_Frender] Kevin Frender mailto:kbf&ngdc.noaa.gov -# [Kevin_Green] Kevin Green mailto:Kevin_Green&tds.com -# [Kevin_Groeneveld] Kevin Groeneveld Lenbrook Industries mailto:kgroeneveld&lenbrook.com 2014-03-27 -# Limited -# [Kevin_Kuhns] Kevin Kuhns mailto:kkuhns&opto22.com -# [Kevin_Leacock] Kevin Leacock mailto:kevin&itchycode.com -# [Kevin_Lu] Kevin Lu mailto:kevinluµmethod.com 2005-08 -# [Kevin_Madden] Kevin Madden mailto:Kevin&emailxtras.com -# [Kevin_Massey] Kevin Massey mailto:massey&aspentec.com -# [Kevin_Mooney] Kevin Mooney mailto:kevinm&bfs.unibol.com -# [Kevin_Murphy] Kevin Murphy mailto:murphy&sevens.lkg.dec.com -# [Kevin_Murphy_2] Kevin Murphy mailto:kevin.murphy&networkengines.com 2003-10 -# [Kevin_Nakagawa] Kevin Nakagawa mailto:nakagawa&sigsci.com -# [Kevin_Osborn] Kevin Osborn mailto:kosborn&snapappliance.com -# [Kevin_Rushforth] Kevin Rushforth mailto:kevin.rushforth&sun.com 2003-08 -# [Kevin_Teiskoetter] Kevin Teiskoetter mailto:kevint&metacreations.com -# [Kevin_Wellwood] Kevin Wellwood mailto:wellwood&jeol.com 2008-04-17 -# [Kevin_Welton] Kevin Welton mailto:Kevin.Welton&armltd.co.uk -# [Kevin_Woodward] Kevin Woodward ReadyTech Corporation mailto:kwoodward&readytech.com 2013-09-13 -# [KeyTicket_Solutions] KeyTicket Solutions mailto:amang&keyticket.eu 2014-04-04 -# [Khelben_Blackstaff] Khelben Blackstaff mailto:khelben&gmx.at -# [Khiem_Tran] Khiem Tran mailto:Khiem.Tran&andrew.com 2007-11-06 -# [Kim_Alan_Waggoner] Kim Alan Waggoner mailto:kimw&weatherbank.com 2006-11 -# [Kim_Berthelsen] Kim Berthelsen JVL Industri mailto:kb&jvl.dk 2012-12-21 -# Elektronik -# [Kim_Hancock] Kim Hancock mailto:registry&dragondex.com 2007-10-24 -# [Kim_Moraros] Kim Moraros mailto:moraros&via.enet.dec.com -# [Kim_Scott] Kim Scott mailto:kims&cup.hp.com -# [Kimberly_Gibbs] Kimberly Gibbs mailto:kimgib&ccgate-ut.axent.com -# [Kimmo_Kymalainen] Kimmo Kymalainen mailto:kimmo.kymalainen&etsi.org 2010-06-04 -# [Kin_Chan] Kin Chan mailto:kchan&shiva.com -# [Kin_Chan_2] Kin Chan mailto:kchan&net2net.com -# [Kipp_E_B_Hickman] Kipp E.B. Hickman mailto:kipp&mcom.com -# [Kipp_E_B_Hickman_2] Kipp E.B. Hickman mailto:kipp&netscape.com -# [Kiren_Sekar] Kiren Sekar mailto:kiren&apple.com 2005-08 -# [Kiren_Sekar_2] Kiren Sekar mailto:kiren&apple.com -# [Kirill_Marinushkin] Kirill Marinushkin Argus-Spectr mailto:k.marinushkin&argus-spectr.ru 2013-10-25 -# [Kirk_Lougheed] Kirk Lougheed mailto:LOUGHEED&mathom.cisco.com -# [Kirk_MacLean] Kirk MacLean mailto:kmaclean&ea.com -# [Kit_Haskins] Kit Haskins mailto:kit&ka0wuc.org -# [Kit_Smithers] Kit Smithers mailto:ksmithers&argogroup.com -# [Kit_Sturgeon] Kit Sturgeon mailto:Kit&remotecontrolsextoys.com -# [Klas_Malmborg] Klas Malmborg FLIR Systems AB mailto:Klas.Malmborg&flir.se 2011-10-20 -# [Klaus_Fellner] Klaus Fellner mailto:webmaster&segue.com -# mailto:kfellner&segue.com -# [Klaus_Schmidinger] Klaus Schmidinger mailto:Klaus.Schmidinger&tvdr.de 2010-03-31 -# [Klaus_Warth] Klaus Warth Robert Bosch GmbH mailto:Klaus.Warth&bosch.com 2012-07-17 -# [Klaus_Wolf] Klaus Wolf mailto:wolf&cobrow.com -# [Koen_Schoofs] Koen Schoofs mailto:schoofs_koen&emc.com 2003-01 -# [Koich_Nakamura] Koich Nakamura mailto:naka&case.nm.fujitsu.co.jp -# [Konstantin_Iavid] Konstantin Iavid mailto:kiavid&highcriteria.com -# [Konstantin_Schauweck] Konstantin Schauwecker mailto:hi&konstantin-schauwecker.de 2007-02 -# [Konstantin_V_Vyazni] Konstantin V. Vyaznikov mailto:kv&ssm6000.samsung.ru -# [Konstantinos_Kostis] Konstantinos Kostis mailto:netdb&kostis.net -# [Kord_Campbell] Kord Campbell mailto:kord&grub.org -# [Kory_Hamzeh] Kory Hamzeh mailto:kory&ascend.com -# [Kouichi_Takeda] Kouichi Takeda mailto:KHBO5271&nifty.com -# [Kouichi_Takeda_2] Kouichi Takeda mailto:KHB05271&nifty.com -# [Kouji_Sugisawa] Kouji Sugisawa mailto:sugisawa.kouji&soft.fujitsu.com 2003-01 -# [Kristean_Heisler] Kristean Heisler mailto:kh&rib.de -# [Kristean_Heisler_2] Kristean Heisler mailto:Kristean.Heisler&rib-software.com 2009-12-16 -# [Kristian_A_Bognaes] Kristian A. Bognaes Norman Safeground AS mailto:kristian.bognaes&norman.com 2014-01-15 -# [Kristian_A_Bognaes_2] Kristian A. Bognaes AVG Technologies mailto:kristian.bognaes&avg.com 2015-05-20 -# Norway AS -# [Kristina_Sten] Kristina Sten mailto:kristina.sten&axis.com -# [Kristoffer_Lawson] Kristoffer Lawson mailto:setok&scred.com -# [Kristoffer_Nilsson] Kristoffer Nilsson mailto:kristoffer.nilsson&hutchison3g.com 2002-02 -# [Kunihiko_Morota] Kunihiko Morota mailto:morota.kunihiko&jp.panasonic.com 2005-08 -# [Kurt_Haubner] Kurt Haubner mailto:haubner&ibm.net -# [Kurt_Nissen] Kurt Nissen mailto:kn&proces-data.com 2004-02 -# [Kyle_Lussier] Kyle Lussier mailto:klussier&autonoc.com 2005-12 -# [Kyle_Unice] Kyle Unice mailto:kyle&midnighttech.com -# [L-ACOUSTICS] L-ACOUSTICS mailto:christophe.pignon&l-acoustics.com 2012-08-13 -# LJK Software, -# [LJK] Cambridge, mailto:support&ljk.com -# Massachusetts -# [Ladislav_Baranyay] Ladislav Baranyay mailto:identcod&identcode.sk -# [Lai_Zit_Seng] Lai Zit Seng mailto:lzs&pobox.com -# [Laird_Popkin] Laird Popkin mailto:laird&pando.com 2008-02-27 -# [Lal_Samuel_Varghese] Lal Samuel Varghese mailto:lalsam&hp.com 2005-08 -# [Lance_Drake] Lance Drake Caprice Productions mailto:bonjour&caprice.com 2012-07-05 -# [Lance_Kind] Lance Kind mailto:lance_kind&hp.com -# [Lance_M_Steenson] Lance M. Steenson mailto:lance&transactionwarehouse.net 2009-09-18 -# [Larry_A_Young] Larry A. Young mailto:Larry.A.Young&mail.sprint.com 2005-08 -# [Larry_A_Young_2] Larry A. Young mailto:Larry.A.Young&sprint.com 2006-02 -# [Larry_Atkin] Larry Atkin mailto:latkin&commongrnd.com -# [Larry_Atkin_2] Larry Atkin mailto:shasta&qsatoolworks.com -# [Larry_Barnes] Larry Barnes mailto:barnes&broke.enet.dec.com -# [Larry_Emlich] Larry Emlich mailto:larry.emlich&compaq.com -# [Larry_Gerhardstein] Larry Gerhardstein mailto:lh_gerhardstein&pnl.gov -# [Larry_Lipstone] Larry Lipstone mailto:lrl&interdyn.com -# [Larry_Peterson] Larry Peterson mailto:llp&arizona.edu -# [Larry_Schwartz] Larry Schwartz mailto:lrs&cup.hp.com -# [Larry_Scott] Larry Scott mailto:scott&zk3.dec.com -# [Larry_Stone] Larry Stone mailto:lcs&icad.com -# [Larry_Traylor] Larry Traylor mailto:larry&arium.com -# [Larry_Tusoni] Larry Tusoni mailto:larry&goldrush.com -# [Larry_Zarou] Larry Zarou mailto:zarla01&cbsits.com 2006-10 -# [Lars_Bohn] Lars Bohn mailto:Lars.Bohn&nokia.com -# [Lars_Eilebrecht] Lars Eilebrecht mailto:le+iana&leogic.com 2003-10 -# [Lars_Goran_Magnusson] Lars-Goran Magnusson mailto:lars-goran.magnusson&seisy.mail.abb.com -# [Lars_Mattsson] Lars Mattsson mailto:lars.mattsson®in.se 2008-12-24 -# [Lars_Struwe_Christen] Lars Struwe Christensen mailto:lsc&giritech.com 2004-01 -# [Laurence_Flath] Laurence Flath mailto:lflath&luxsolis.com -# [Laurent_Charmet] Laurent Charmet mailto:laurent.charmet&atempo.com -# [Laurent_Domenech] Laurent Domenech Opalis mailto:ldomenech&opalis.com -# [Laurent_Mihalkovic] Laurent Mihalkovic mailto:ljp_m&mac.com -# [Laurie_Charlwood] Laurie Charlwood mailto:laurie.charlwood&printsoft.com 2007-08-22 -# [Laurie_Lindsey] Laurie Lindsey mailto:llindsey&novell.com -# [Lawrence_E._Hughes] Lawrence E. Hughes Sixscape mailto:lhughes&sixscape.com 2014-03-17 -# Communications, Ltd. -# [Lawrence_J_Dickson] Lawrence J. Dickson Land-5 Corporation mailto:ldickson&land-5.com 2002-03 -# [Lawrence_Kreeger] Lawrence Kreeger mailto:kreeger&cisco.com 2013-04-19 -# [Lawrence_Lebahn] Lawrence Lebahn mailto:DIA3&paxrv-nes.navy.mil -# [Lawrence_Tarbox] Lawrence Tarbox mailto:ltarbox&scr.siemens.com -# [Lawrence_W_Dunn] Lawrence W. Dunn mailto:larrydunn&aptcomp.com 2003-04 -# [Laxman_C_Marathe] Laxman C. Marathe mailto:lcmarathe&thomsonpress.com 2006-12 -# [Layered_Logic] Layered Logic, Inc. mailto:brooks&layeredlogic.com 2012-01-04 -# [Lech_Lakomy] Lech Lakomy mailto:llakomy&apwi.com 2009-02-12 -# [Lech_Laskowski] Lech Laskowski mailto:lech_laskowski&moldflow.com -# [Lecuivre_J] Lecuivre J mailto:software.team&mgeups.com 2005-08 -# [Lee_Barton] Lee Barton mailto:barton&star.enet.dec.com -# [Lee_Breisacher] Lee Breisacher mailto:lbreisacher&seagullsw.com -# [Lee_Dolson] Lee Dolson mailto:dolson&f-net.co.kr 2006-01 -# [Lee_Griffiths] Lee Griffiths mailto:lg&dataconnection.com 2004-11 -# [Lee_HoJun] Lee HoJun Samsung mailto:rcn95&samsung.com 2013-01-03 -# [Lee_Howard] Lee Howard mailto:iana&hylafax.org 2002-03 -# [Lee_VanTine] Lee VanTine mailto:lvantine&infiniswitc.com 2002-09 -# [Lee_Wheat] Lee Wheat mailto:wheat&wg.com -# [Lefteris_Kalamaras] Lefteris Kalamaras mailto:lefteris&ebi.com -# [Legentis_Ltd] Legentis Ltd mailto:dave&legentis.com 2013-07-01 -# [Lehpaner_Sasa] Lehpaner Sasa mailto:lsasa&visel.it -# [Leif_Ekblad] Leif Ekblad mailto:leif&rdos.net -# [Leif_Hedstrom] Leif Hedstrom mailto:leif&propel.com 2002-04 -# [Leif_Jakob] Leif Jakob mailto:leif+iana&cube.ch 2006-01 -# [Leland_Wallace] Leland Wallace mailto:randall&apple.com -# [Len_Wanger] Len Wanger mailto:lrw&sdsc.edu -# [Len_Zuvela] Len Zuvela IM Unified Coalition mailto:imu-comments&egroups.com -# [Len_Zuvela_2] Len Zuvela mailto:lenzµsoft.com -# [Lenbrook_Industries_Limited] Lenbrook Industries mailto:tsonderskov&lenbrook.com 2014-03-27 -# Limited -# [Leo_Hourvitz] Leo Hourvitz mailto:leo&next.com -# [Leo_Lesage] Leo Lesage mailto:leo.lesage&adp.nl 2006-04 -# [Leo_Martins] Leo Martins mailto:leo&talarian.com -# [Leo_Moesgaard] Leo Moesgaard mailto:leo_moesgaard&dk.ibm.com -# [Leo_Rathnayake] Leo Rathnayake mailto:leo&perlnet.com -# [Leon_van_der_Voort_van_der_Kleij] Leon van der Voort van Nedap mailto:leon.vandervoortvanderkleij&nedap.com 2014-08-28 -# der Kleij -# [Leonhard_Diekmann] Leonhard Diekmann mailto:diekmann&04.mstr02.telekom400.dbp.de -# [Les_Enstone] Les Enstone mailto:lenstone&lanner.co.uk -# [Les_Klein] Les Klein mailto:sgy&cix.compulink.co.uk -# [Les_Mather] Les Mather mailto:lm&remsdaq.com 2005-12 -# [Leslie_Lincoln] Leslie Lincoln mailto:leslie_lincoln&valisys.com -# ZigBee Alliance's -# [Leslie_Mulder] Leslie Mulder Network Device mailto:ljm&exegin.com 2013-05-28 -# working group -# [Lewis_Donzis] Lewis Donzis mailto:ldonzis&nortelnetworks.com -# [Lewis_Wolfgang] Lewis Wolfgang mailto:wolfgang&kencast.com 2006-05 -# [Liam_Merwick] Liam Merwick mailto:ldoms-iana-ports&sun.com 2009-01-16 -# [Libor_Sykora] Libor Sykora mailto:libor.sykora&st.com 2002-05 -# [Libratone_AS] Libratone A/S mailto:info&libratone.com 2011-10-27 -# [libravatar_org] libravatar.org mailto:francois&libravatar.org 2011-10-11 -# [Lilian_Rudenco] Lilian Rudenco mailto:info&xpanel.com 2009-03-04 -# [Liming_Wei] Liming Wei mailto:lwei&cisco.com -# [Linda_Lin] Linda Lin mailto:llin&sonusnet.com 2006-08 -# [Lindsay_Morris] Lindsay Morris mailto:lmorris&servergraph.com -# [Linus_Torvalds] Linus Torvalds mailto:torvalds&osdl.org 2005-09 -# [Lisa_Tomita] Lisa Tomita -# [Lisa_Zhong] Lisa Zhong mailto:lzhong&cup.hp.com -# [Lisp_Support] Lisp Support mailto:lisp-support&xanalys.com -# [Liu_Changchun] Liu Changchun mailto:blzhang&infospark.cn 2008-11-05 -# [Lloyd_Wood] Lloyd Wood mailto:lwood&cisco.com 2007-05 -# [Logan_Bruns] Logan Bruns mailto:logan&andromedia.com -# [Loren_Barr] Loren Barr mailto:lbarr&extensis.com 2006-12 -# [Lori_Tassin] Lori Tassin mailto:Ramsey&network-1.com -# [Lou_Berger] Lou Berger mailto:lberger&movaz.com 2004-11 -# [Lou_Harris] Lou Harris mailto:lharris&outlx.bandl.com -# [Lou_Seitchik] Lou Seitchik mailto:lou&alliedelectronics.com 2005-08 -# [Louis_E_Simard] Louis E. Simard mailto:76400.3371&compuserve.com -# [Louis_Lu] Louis Lu mailto:LouisL&bristol.com -# [Louis_Mamakos] Louis Mamakos mailto:louie&sayshell.umd.edu -# [Louis_Mamakos_2] Louis Mamakos mailto:louie&uu.net -# [Louis_Olszyk] Louis Olszyk mailto:lolszyk&10fold.com -# [Louis_Slothouber] Louis Slothouber mailto:lpslot&biap.com 2005-08 -# [Louis_Sun] Louis Sun mailto:lysun&ambarella.com -# [LPAR2RRD_project] LPAR2RRD project mailto:pavel.hampl&lpar2rrd.com 2013-08-14 -# [Luca_Cipressi] Luca Cipressi mailto:lucacipressi&gmail.com 2015-03-27 -# [Luca_Debiasi] Luca Debiasi Guidewire Software, mailto:ldebiasi&guidewire.com 2014-02-06 -# Inc -# [Lucas_Alonso] Lucas Alonso mailto:luke&demiurgestudios.com 2002-02 -# [Lucas_Lorensi] Lucas Lorensi mailto:lucas.lorensi&powersyslab.com 2015-07-20 -# [Ludwig_Kannicht] Ludwig Kannicht Dark Horse GmbH & Co mailto:l.kannicht&thedarkhorse.de 2015-06-02 -# KG -# [Luis_Zugasti] Luis Zugasti mailto:lzugasti&fagorautomation.es 2003-11 -# [Luke_Bowen] Luke Bowen mailto:leb&tfn.com -# [Luke_Dion] Luke Dion mailto:ldion&tapeware.com 2004-04 -# [Luke_Steffen] Luke Steffen mailto:lukesteffen&deusty.com -# [Luma_Code] Luma Code mailto:support&lumacode.com -# [Lumicom] Lumicom mailto:support&lumicom.com.au 2013-02-07 -# [Lumis] Lumis mailto:rterra&lumis.com.br 2011-10-24 -# [Lutz_Karras] Lutz Karras mailto:karras&zeiss.de -# [Lyndon_Nerenberg] Lyndon Nerenberg mailto:lyndon&execmail.ca -# [Lyndon_Ong] Lyndon Ong mailto:LyOng&ciena.com -# [Lyndon_Ong_2] Lyndon Ong mailto:Lyong&ciena.com -# [Lynn_Carter] Lynn Carter mailto:carterl&execpc.com -# [MPITech_Support] MPITech Support mailto:morten.christensen&i-data.com -# [M_Flemming] M Flemming mailto:mflemming&aol.com -# [Madhan_Kanagavel] Madhan Kanagavel mailto:madhan&codelathe.com 2008-07-18 -# [Madhav_Karhade] Madhav Karhade mailto:madhav.karhade&wibhu.com 2003-08 -# [Madhav_Mutalik] Madhav Mutalik Actifio mailto:madhav.mutalik&actifio.com 2015-10-23 -# [Madhukar_N_Thakur] Madhukar N. Thakur mailto:mthakur&interbase.com -# [Mads_Peter_Back] Mads Peter Back mailto:iana-contact&webhouse.dk 2002-06 -# [Maggie_Brinsford] Maggie Brinsford mailto:mjb&concurrent.co.uk -# [Magnus_Nystrom] Magnus Nystrom mailto:magnus&dynas.se -# [Mahr_GmbH_Göttingen] Mahr GmbH Göttingen mailto:info&mahr.de 2013-09-02 -# [Main_Street_Softworks] Main Street Softworks mailto:info&mainstreetsoftworks.com 2013-04-02 -# Inc -# [Makoto_Ikeyama] Makoto Ikeyama mailto:ikeyama&ael.fujitsu.co.jp -# [Makoto_Mita] Makoto Mita mailto:mita&ssdev.ksp.fujixerox.co.jp -# [Makoto_Watanabe] Makoto Watanabe mailto:makoto&saint.nm.fujitsu.co.jp -# [Makoto_Zukawa] Makoto Zukawa mailto:zukawa&jp.fujitsu.com 2010-10-15 -# [Mala_Bhat] Mala Bhat mailto:bmala&ssdi.sharp.co.in 2005-08 -# [Malcolm_Crowe] Malcolm Crowe mailto:malcolm.crowe&paisley.ac.uk 2005-11 -# [Malcolm_Graham] Malcolm Graham mailto:Malcolm_Graham&cyborg.com -# [Malcolm_McLean] Malcolm McLean mailto:malcolmm&zieto.co.za 2007-07-19 -# [Mamoru_Ito] Mamoru Ito mailto:Ito&pcnet.ks.pfu.co.jp -# [Man_Shuen_Cheung] Man Shuen Cheung mailto:man_shuen_cheung&wamnet.co.uk -# [Manabu_Makino] Manabu Makino mailto:m-makino&ael.fujitsu.co.jp -# [Manbir_Sahni] Manbir Sahni Initium Labs LLC mailto:manbir&initiumlabs.com 2015-03-06 -# [Mandar_Joshi] Mandar Joshi mailto:mandar.joshi&lsi.com 2009-02-09 -# [Mandos_Maintainers] Mandos Maintainers mailto:mandos&fukt.bsnet.se -# [Manfred_Randelzofer] Manfred Randelzofer mailto:manfred.randelzofer&fujitsu-siemens.com -# [MANG_Ioan-Alexandru] MANG Ioan-Alexandru KeyTicket Solutions mailto:amang&keyticket.eu 2014-04-04 -# [Manickam_R_Sridhar] Manickam R.Sridhar mailto:msridhar&sitaranetworks.com -# [Manish_Talreja] Manish Talreja Crestron Electronics, mailto:mtalreja@crestron.com> 2012-06-27 -# Inc. -# [Manuel_Moos] Manuel Moos mailto:z-man&users.sf.net 2012-11-02 -# [Marazzi] Marazzi mailto:fmarazzi&ideetique.com -# [Marc_Andre_Lemburg] Marc-Andre Lemburg mailto:mal&egenix.com 2009-11-13 -# [Marc_Bailey] Marc Bailey mailto:marc&objective.com -# [Marc_Baudoin] Marc Baudoin mailto:babafou&babafou.eu.org -# [Marc_Binstock] Marc Binstock mailto:marc.binstock&citrix.com 2008-01-29 -# [Marc_Blanchet] Marc Blanchet mailto:marc.blanchet&viagenie.ca 2003-01 -# [Marc_Castelluccio] Marc Castelluccio mailto:mcastell&areanetworks.net 2005-08 -# [Marc_Diamante] Marc Diamante mailto:pgmp&pgmpsolutions.com -# [Marc_Donner] Marc Donner mailto:mail&poweraudio.de 2009-01-16 -# [Marc_Epard] Marc Epard mailto:marc&netopia.com -# [Marc_Gauthier] Marc Gauthier mailto:mgau&kastenchase.com -# [Marc_Goossens] Marc Goossens mailto:mgoossens&eiba.com 2003-01 -# [Marc_Horowitz] Marc Horowitz mailto:marc&mit.edu -# [Marc_Krochmal] Marc Krochmal mailto:marc&apple.com -# [Marc_Krochmal_2] Marc Krochmal Apple Inc. mailto:marc&apple.com 2012-03-02 -# [Marc_Majka] Marc Majka mailto:majka&apple.com 2002-08 -# [Marc_Manthey] Marc Manthey mailto:codewarrior&cuseeme.de 2006-07 -# [Marc_Manthey_2] Marc Manthey mailto:marc&let.de -# [Marc_McClure] Marc McClure mailto:marcmccµsoft.com 2007-08-07 -# [Marc_Morin] Marc Morin mailto:mmorin&sdlintl.com 2002-04 -# [Marc_Prud_hommeaux] Marc Prud'hommeaux mailto:support&lexcycle.com -# [Marcel_Dube] Marcel Dube mailto:marceldube&videotron.ca 2004-11 -# [Marcel_Hofstetter] Marcel Hofstetter mailto:marcel.hofstetter&jomasoft.ch 2003-01 -# [Marcel_Ruff] Marcel Ruff mailto:mr&marcelruff.info 2002-02 -# [Marcelo_Einhorn] Marcelo Einhorn mailto:KGUNE%25HUJIVM1.bitnet@taunivm.tau.ac.il -# [Marcelo_Einhorn_2] Marcelo Einhorn mailto:marcelo&eshbel.com -# [Marcin_Gozdalik] Marcin Gozdalik mailto:gozdal&gadu-gadu.pl 2006-05 -# [Marco_Bambini] Marco Bambini mailto:marco&realsoftware.com 2008-08-28 -# [Marco_Casole] Marco Casole mailto:marco.casole&ericsson.com 2003-04 -# [Marco_Marcucci] Marco Marcucci mailto:mmarcucci.amtec&interbusiness.it -# [Marco_Mascitto] Marco Mascitto mailto:mmascitto&accedian.com 2011-06-28 -# [Marco_Piovanelli] Marco Piovanelli mailto:support&ovolab.com -# [Marcos_Della] Marcos Della mailto:mdella&peerme.com 2005-08 -# [Marcus_Leufgen] Marcus Leufgen mailto:leufgen&ipcas.de 2002-05 -# [Marcus_Mueller] Marcus Mueller mailto:marcus&irtrans.de 2004-11 -# [Marek_Buchler] Marek Buchler mailto:Marek.Buchler&entrust.com -# [Margaret_Wasserman] Margaret Wasserman mailto:margaret&thingmagic.com 2006-11 -# [Marie_France_Dubreui] Marie-France Dubreuil mailto:Marie-France.Dubreuil&evidian.com 2002-11 -# [Marie_Pierre_Belange] Marie-Pierre Belanger mailto:belanger_marie&emc.com -# [Mario_Bonin] Mario Bonin mailto:boninmµtempus.com -# [Mario_Joussen] Mario Joussen Cognex Corporation mailto:mario.joussen&cognex.com 2012-08-28 -# [Mario_Leboute] Mario Leboute mailto:leboute&pro.via-rs.com.br -# [Mario_Pörner] Mario Pörner Mediatap GbR mailto:mario.poerner&googlemail.com 2011-10-11 -# [Maris_Bormanis] Maris Bormanis mailto:info&febooti.com 2011-06-10 -# [Marius_Matioc] Marius Matioc mailto:marius&lavenir.com -# [Mark_Ainsley] Mark Ainsley mailto:ianaportmaster&unify.com -# [Mark_Armstrong] Mark Armstrong mailto:Mark.Armstrong&soleratec.com 2005-12 -# [Mark_B_Hurst] Mark B. Hurst mailto:mhurst&aspenres.com -# [Mark_Bailon] Mark Bailon mailto:mark.bailon&ericsson.com -# [Mark_Beyer] Mark Beyer mailto:mbeyer&freegate.com -# [Mark_Bocko] Mark Bocko mailto:bocko&ece.rochester.edu -# [Mark_Boler] Mark Boler mailto:markb&ttgsoftware.com -# [Mark_Burgess] Mark Burgess mailto:mark.burgess&iu.hioslo.no -# [Mark_Caldwell] Mark Caldwell mailto:development&caldsoft.co.uk 2011-08-12 -# [Mark_Cavage] Mark Cavage mailto:mcavage&us.ibm.com 2002-07 -# [Mark_Ciskey] Mark Ciskey mailto:mlciskey&plato.com -# [Mark_Crispin] Mark Crispin mailto:MRC&panda.com -# [Mark_Crispin_2] Mark Crispin mailto:MRC&cac.washington.edu -# [Mark_Crother] Mark Crother mailto:mark&eis.calstate.edu -# [Mark_Davidson] Mark Davidson mailto:mark_davidson&filemaker.com 2010-10-06 -# [Mark_Doyle] Mark Doyle mailto:mark&engagecom.com -# [Mark_E_Fogle] Mark E. Fogle mailto:mefogle&xantel.com -# [Mark_Ericksen] Mark Ericksen mailto:mark&jiiva.com -# [Mark_Ethan_Trostler] Mark Ethan Trostler mailto:mark&zzo.com 2011-11-23 -# [Mark_Falco] Mark Falco Oracle mailto:mark.falco&oracle.com 2014-07-09 -# [Mark_Farlin] Mark Farlin mailto:mfarlin&peerlogic.com -# [Mark_Fox] Mark Fox mailto:markf&uplanet.com -# [Mark_Gamble] Mark Gamble mailto:mark.gamble&sage.com 2003-02 -# [Mark_Garti] Mark Garti mailto:mgarti&sonusnet.com -# [Mark_H_David] Mark H. David mailto:mhd&gensym.com -# [Mark_H_Needleman] Mark H. Needleman mailto:markn&sirsi.com -# [Mark_Hankin] Mark Hankin -# [Mark_Hanson] Mark Hanson mailto:markh&intersys.com -# [Mark_Harrison] Mark Harrison mailto:Mark&xapautomation.org 2002-11 -# [Mark_Hendricks] Mark Hendricks mailto:markah&copper.net 2003-03 -# [Mark_Hodapp] Mark Hodapp mailto:mark.hodapp&sun.com -# [Mark_Hurst] Mark Hurst mailto:markbhurst&gmail.com 2015-09-16 -# [Mark_Itzcovitz] Mark Itzcovitz mailto:mark.itzcovitz&publishingtechnology.com 2015-09-03 -# [Mark_J._App] Mark J. App MJA_Technology_LLC mailto:markapp&roadrunner.com 2014-04-23 -# [Mark_Jackson] Mark Jackson Nuance mailto:Mark.Jackson&nuance.com 2011-10-27 -# Communications, Inc. -# [Mark_Killgore] Mark Killgore mailto:MKillgore&novell.com -# [Mark_Kosters] Mark Kosters mailto:markk&internic.net -# [Mark_L_Lambert] Mark L. Lambert mailto:markl&ptt.lcs.mit.edu -# [Mark_Lewandowski] Mark Lewandowski mailto:mlewan0&us.ibm.com -# [Mark_Lewis] Mark Lewis mailto:Mark_Lewis&ccm.jf.intel.com -# [Mark_Lewis_2] Mark Lewis mailto:mark.h.lewis&intel.com -# [Mark_Lewis_3] Mark Lewis mailto:mark&surveillus.com -# [Mark_Lipford] Mark Lipford mailto:mark.a.lipford&sprint.com 2006-07 -# [Mark_Lottor] Mark Lottor mailto:MKL&nisc.sri.com -# [Mark_Lyall] Mark Lyall mailto:mark.lyall&madge.com -# [Mark_McCahill] Mark McCahill mailto:mpm&boombox.micro.umn.edu -# [Mark_McNamara] Mark McNamara mailto:markm&research.canon.com.au -# [Mark_Miller] Mark Miller mailto:markm&caplet.com -# [Mark_Miller_2] Mark Miller mailto:mmillerµsoft.com -# [Mark_Morris] Mark Morris mailto:mim&ermuk.com -# [Mark_Morwood] Mark Morwood mailto:markm&sentillion.com -# [Mark_Nijmeijer] Mark Nijmeijer mailto:Mark.Nijmeijer&citrix.com 2009-04-17 -# [Mark_O_Connell] Mark O'Connell mailto:oconnell_marka&emc.com 2008-12-04 -# [Mark_Parenti] Mark Parenti mailto:map&ntc.adaptec.com -# [Mark_Pearce] Mark Pearce mailto:Mark_A.._Pearce/AXON_Networks_Inc..@notes.axon.com -# [Mark_R_Ludwig] Mark R. Ludwig mailto:Mark-Ludwig&uai.com -# [Mark_S_Edwards] Mark S. Edwards mailto:marke&firefox.co.uk -# [Mark_Sapp] Mark Sapp mailto:mark.sapp&aionex.com 2006-04 -# [Mark_Sapsford] Mark Sapsford mailto:Mark_Sapsford&taligent.com -# [Mark_Schertler] Mark Schertler mailto:mjs&tycho.ncsc.mil -# [Mark_Schmatz] Mark Schmatz mailto:ditrios&markschmatz.de -# [Mark_Seuffert] Mark Seuffert mailto:captain2004&pirate.de 2004-11 -# [Mark_Simpson] Mark Simpson mailto:simpson¢erline.com -# [Mark_Stapp] Mark Stapp mailto:mjs&cisco.com 2006-01 -# [Mark_Stevens] Mark Stevens mailto:mstevens&ellacoya.com -# [Mark_Tim_Junghanns] Mark-Tim Junghanns mailto:mjunghanns&vangerow.de 2003-07 -# [Mark_Tirschwell] Mark Tirschwell mailto:mark.tirschwell&wallstreetsystems.com 2006-01 -# [Mark_Trostler] Mark Trostler mailto:trostler&juniper.net -# [Mark_Valence] Mark Valence mailto:kurash&sassafras.com -# [Mark_Wahl] Mark Wahl mailto:mark.wahl&informed-control.com 2005-11 -# [Mark_Windrim] Mark Windrim mailto:mark.windrim&infobright.com 2009-07-23 -# [Mark_Wood] Mark Wood mailto:mark.d.wood&kodak.com -# [Mark_Wooding] Mark Wooding mailto:mdw&distorted.org.uk 2007-07-10 -# [Mark_Zang] Mark Zang mailto:mark&zang.com -# [Mark_de_Rooi] Mark de Rooi mailto:derooi&xs4all.nl 2004-12 -# [Mark_mayernick] Mark mayernick mailto:Mark.Mayernick&thomson.net 2003-03 -# [Markku_Viima] Markku Viima mailto:markku.viima&team.icl.se -# [Marko_Bjelac] Marko Bjelac mailto:marko.bjelac&elma.hr 2010-06-10 -# [Marko_Kreen] Marko Kreen mailto:markokr&gmail.com 2009-02-13 -# [Markus_Brand] Markus Brand mailto:address-o-sync&slamslash.com -# [Markus_Kremer] Markus Kremer Bender GmbH & Co. KG mailto:markus.kremer&bender-de.com 2013-10-15 -# [Markus_Loeffler] Markus Loeffler mailto:markus.loeffler&thomson.net 2009-02-17 -# [Markus_Michels] Markus Michels mailto:mmi&pmsmicado.com -# [Markus_Michels_2] Markus Michels mailto:mmi&cedros.com -# [Markus_Michels_3] Markus Michels mailto:markus.michels&cedros.com 2006-10 -# [Markus_Nix] Markus Nix mailto:mnix&docuverse.de 2005-08 -# [Markus_Sabadello] Markus Sabadello mailto:sabadello&startron.org -# [Markus_Sabadello_2] Markus Sabadello mailto:sabadello&starbot.org -# [Markus_Treinen] Markus Treinen mailto:markus.treinen&siemens.com 2006-02 -# [Marnus_Freeman] Marnus Freeman mailto:marnus&swistgroup.com 2006-02 -# [Marshall_Anschutz] Marshall Anschutz mailto:dnssd.tcode&icehousepro.us -# [Marshall_Rose] Marshall Rose mailto:mrose&dbc.mtview.ca.us -# [Martha_Crisson] Martha Crisson mailto:CRISSON&ralvm12.vnet.ibm.com -# [Martin_Bestmann] Martin Bestmann mailto:martin&datawatch.de -# [Martin_Bestmann_2] Martin Bestmann mailto:martin&no.netopia.com 2004-03 -# [Martin_Bestmann_3] Martin Bestmann mailto:martin&poleposition-sw.com 2005-08 -# [Martin_Burnicki] Martin Burnicki mailto:martin.burnicki&meinberg.de 2002-08 -# [Martin_Daly] Martin Daly mailto:martin.daly&cadcorp.com 2006-11 -# [Martin_Ellis] Martin Ellis mailto:martin&clanleagues.net 2004-11 -# [Martin_Forssen] Martin Forssen mailto:maf&appgate.com 2004-11 -# [Martin_Freiss] Martin Freiss mailto:freiss.pad&sni.de -# [Martin_Freiss_2] Martin Freiss mailto:freiss.pad@sni. -# [Martin_Hamilton] Martin Hamilton mailto:martin&mrrl.lut.as.uk -# [Martin_Kirk] Martin Kirk mailto:m.kirk&opengroup.org -# [Martin_Kochanski] Martin Kochanski mailto:martin&cardbox.co.uk -# [Martin_Leitner] Martin Leitner mailto:info&anton-paar.com 2004-06 -# [Martin_Lichtin] Martin Lichtin mailto:lichtin&oanda.com -# [Martin_Norman] Martin Norman mailto:martin&ndl.co.uk -# [Martin_Picard] Martin Picard -# [Martin_Pool] Martin Pool mailto:mbp&samba.org 2002-11 -# [Martin_Pool_2] Martin Pool mailto:mbp&canonical.com 2007-02 -# [Martin_Redington] Martin Redington mailto:mildm8nnered&gmail.com -# [Martin_Rostan] Martin Rostan mailto:m.rostan&beckhoff.com 2003-11 -# [Martin_Schmuker] Martin Schmuker bilobit GmbH mailto:ms&bilobit.com 2014-08-15 -# [Martin_Shoemaker] Martin Shoemaker mailto:shoemakerml&rapistan.com -# [Martin_Sustrik] Martin Sustrik mailto:sustrik&imatix.com 2007-03 -# [Martin_Technology] Martin Technology mailto:support&martian.com -# [Martin_Wehlou] J. Martin Wehlou Man In The Middle AB mailto:martin&mitm.se 2011-10-18 -# [Martin_West] Martin West mailto:Martin.West&spirit-soft.com -# [Martin_Ziskind] Martin Ziskind mailto:ziskind&us.ibm.com 2008-08-21 -# [Martine_Marchand] Martine Marchand tel:+16-1-46-59-24-84 -# [Marty_Batchelder] Marty Batchelder mailto:marty&capres.com -# [Marty_Borden] Marty Borden mailto:mborden&tollbridgetech.com -# [Marty_Campbell] Marty Campbell mailto:martycðosinfo.com 2011-06-10 -# [Marty_Lyons] Marty Lyons mailto:marty&aol.com -# [Marty_Schoffstahl] Marty Schoffstahl mailto:schoff&nisc.nyser.net -# [Martyn_Thomas] Martyn Thomas -# [Marvin_Shin] Marvin Shin mailto:president&medialingo.com -# [Marvin_Sirbu] Marvin Sirbu mailto:sirbu+&andrew.cmu.edu -# [Marvin_Solomon] Marvin Solomon mailto:solomon&cs.wisc.edu -# [Marvin_Toungate] Marvin Toungate mailto:toungate&austin.ibm.com -# [Mary_Ann_Burt] Mary Ann Burt mailto:bytex!ws054!maryann&uunet.uu.net -# [Mary_Holstage] Mary Holstage mailto:holstege&firstfloor.com -# [Mary_Holstege] Mary Holstege mailto:holstege&firstfloor.com -# [Mary_Miller] Mary Miller Sigma Designs, Inc. mailto:Mary_Miller&sigmadesigns.com 2012-11-08 -# [Masahiro_Koiwai] Masahiro Koiwai mailto:Koiwai.Masahiro&exc.epson.co.jp 2006-10 -# [Masakatsu_Matsuo] Masakatsu Matsuo mailto:masa&sdsft.kme.mei.co.jp -# [Masakuni_Okada] Masakuni Okada mailto:masakuni&jp.ibm.com -# [Masao_Iwai] Masao Iwai mailto:iwai&kel.fujitsu.co.jp -# [Masashi_Suzaki] Masashi Suzaki mailto:susakim&noa.nttdata.jp -# [Masato_Sato] Masato Sato mailto:satou203&oki.com 2006-05 -# [Massimiliano_Ribuoli] Massimiliano Ribuoli and mailto:support&address-o-matic.com -# Marco Stefani -# [Massimo_Cafaro] Massimo Cafaro mailto:massimo.cafaro&unile.it 2004-11 -# [Massive_Flow_Product] Massive Flow Productions mailto:info&massiveflow.de -# [Matahari_Project] Matahari Project mailto:matahari&lists.fedorahosted.org 2011-08-31 -# [Matej_Sekoranja] Matej Sekoranja mailto:matej.sekoranja&cosylab.com 2012-03-23 -# [Math_Game_House_Soft] Math Game House Software mailto:mathgamehouse&mac.com -# [Mathew_Pitchforth] Mathew Pitchforth mailto:mathew&adinstruments.co.nz 2005-08 -# [Mathew_Waters] Mathew Waters Geode Software Ltd mailto:mathew_waters&geode.co.uk 2014-05-14 -# [Mathieu_Garcia] Mathieu Garcia mailto:mathieu.garcia&intua.net -# [Mat_Henshall] Mat Henshall Square Connect, Inc. mailto:mat&squareconnect.com 2011-10-07 -# [Mats_Nilsson] Mats Nilsson mailto:mats.nilsson&xware.se 2002-02 -# [Matt_Bendiksen] Matt Bendiksen mailto:matt&perceptiveautomation.com 2004-11 -# [Matt_Cecile] Matt Cecile mailto:mattc&metrics.com -# [Matt_Christiano] Matt Christiano mailto:globes@matt&oliveb.atc.olivetti.com -# [Matt_Christiano_2] Matt Christiano mailto:matt&reprisesoftware.com 2008-07-28 -# [Matt_Christiano_3] Matt Christiano Reprise Software, mailto:matt&reprisesoftware.com 2012-11-06 -# Inc. -# [Matt_Craig] Matt Craig mailto:matt&luxology.com -# [Matt_Craighead] Matt Craighead mailto:matt.craighead&conifersystems.com 2008-09-11 -# [Matt_Eagar] Matt Eagar mailto:matt.eagar&thinkflood.com -# [Matt_Ferrari] Matt Ferrari XXT LLC mailto:xxt.matt&sbcglobal.net 2012-07-12 -# [Matt_Hammond] Matt Hammond mailto:matt_hammond&four-sight.co.uk -# [Matt_Jensen] Matt Jensen mailto:mattj&newsblip.com -# [Matt_King] Matt King mailto:m&manyone.net 2002-04 -# [Matt_Lachance] Matt Lachance mailto:matt&cs-live.com -# [Matt_Nowicki] Matt Nowicki mailto:nowickim&iasdirect.com 2003-10 -# [Matt_Patenaude] Matt Patenaude mailto:MattPat&mattpat.net -# [Matt_Rogers] Matt Rogers mailto:mrogers&firescope.com 2008-10-16 -# [Matt_Rollins] Matt Rollins mailto:matt&anybusiness.com -# [Matt_Timmermans] Matt Timmermans -# [Matthew_Asham] Matthew Asham mailto:matthewa&bcwireless.net -# [Matthew_Baker] Matthew Baker mailto:matt.baker&intermec.com -# [Matthew_Darwin] Matthew Darwin mailto:matthew.darwin&hp.com 2005-08 -# [Matthew_Ford] Matthew Ford mailto:Matthew.Ford&forward.com.au 2003-03 -# [Matthew_Gast] Matthew Gast Aerohive Networks mailto:mgast&aerohive.com 2012-05-31 -# [Matthew_Horoschun] Matthew Horoschun mailto:mhoroschun&canprint.com.au -# [Matthew_Lloyd] Matthew Lloyd mailto:mlloyd&google.com 2010-04-26 -# [Matthew_MacKenzie] Matthew MacKenzie mailto:mattm&adobe.com -# [Matthew_Orzen] Matthew Orzen mailto:standards&starquest.com -# [Matthew_Owings] Matthew Owings mailto:matt&qwizdom.com 2015-09-21 -# [Matthew_Schultz] Matthew Schultz QuantuMatriX mailto:matt&qmxtech.com 2014-04-10 -# Technologies -# [Matthew_Strange] Matthew Strange mailto:matt&qsatoolworks.com 2009-03-06 -# [Matthew_Thomas] Matthew Thomas mailto:mrthom&essex.ac.uk 2008-01-07 -# [Matthew_Whited] Matthew Whited mailto:matt&thedotnetfactory.com 2008-01-16 -# [Matthew_Williams] Matthew Williams mailto:SPCsd_MWDD&hotmail.com -# [Matthias_Burghardt] Matthias Burghardt mailto:m.burghardt&x-on.de -# [Matthias_Juwan] Matthias Juwan PreSonus Audio mailto:mjuwan&presonus.com 2013-07-12 -# Electronics, Inc -# [Matthias_Riese] Matthias Riese mailto:Matthias.Riese&b-novative.de -# [Matthias_Schroer] Matthias Schroer mailto:matthias.schroer&invision.de -# [Matthias_Trute] Matthias Trute mailto:mtrute&web.de 2007-01 -# [Matthieu_Lachance] Matthieu Lachance mailto:matthieu.lachance&openwave.com -# [Matti_Salmi] Matti Salmi mailto:matti.salmi&nokia.com 2002-08 -# [Maurice_R_Turcotte] Maurice R. Turcotte mailto:mailrus!uflorida!rm1!dnmrt%25rmatl@uunet.uu.net -# [Max_Fudim] Max Fudim mailto:fudim&virtue3d.com -# [Max_Magliaro] Max Magliaro mailto:mmagliaro&bnisolutions.com 2004-11 -# [Max_Masyutin] Max Masyutin mailto:max&ritlabs.com -# [Max_Morris] Max Morris mailto:maxmµsoft.com -# [Maxim_Baklanovsky] Maxim Baklanovsky mailto:m.baklanovsky&spbu.ru 2015-05-20 -# [Maxim_Tseitlin] Maxim Tseitlin mailto:mtseitlin&iname.com -# [Maxime_Belanger] Maxime Belanger mailto:R173&hec.ca -# [Maxime_Deputter] Maxime Deputter mailto:m.deputter&ionixhosting.com 2006-04 -# [Maxine_Yuen] Maxine Yuen mailto:maxine&hq.ncube.com -# [Maya_Zimerman] Maya Zimerman mailto:mayaz&radware.co.il -# [Mayank_Vasa] Mayank Vasa mailto:mayank_vasa&symantec.com 2008-04-03 -# [Maziar_Tamadon] Maziar Tamadon mailto:maziar.tamadon&emulex.com 2007-11-06 -# [Mediatap_GbR] Mediatap GbR mailto:info&audiotapapp.com 2011-10-11 -# [MegaZone] MegaZone mailto:megazone&paycash.us 2005-08 -# [Megan_Woods] Megan Woods mailto:meganwoods&datafast.net.au -# [Meggie_Garica_Woodru] Meggie Garica-Woodruff mailto:ipulse&ericsson.com -# [Mehrdad_Ashtiani] Mehrdad Ashtiani mailto:mashtiani&ieeinc.com 2009-10-19 -# [Meindert_Sprang] Meindert Sprang mailto:ms&customware.nl 2009-02-18 -# [Mel_Oyler] Mel Oyler mailto:mel&novell.com -# [Melanie_Kacerek] Melanie Kacerek mailto:melanie.kacerek&quest.com 2008-12-16 -# [Mele_Associates] Mele Associates mailto:easl&meleassociates.com 2014-11-26 -# [Melinda_Shore] Melinda Shore mailto:mshore&cisco.com 2006-05 -# [Melinda_Tsao] Melinda Tsao mailto:melinda&tpe1.sercomm.com.tw -# [Melinda_Tsao_2] Melinda Tsao mailto:melinda_tsao&mail.sercomm.com.tw -# [Menno_Zweistra] Menno Zweistra mailto:m.zweistra&metatude.com -# [Metod_Celestina] Metod Celestina IMS merilni sistemi mailto:metod.celestina&ims.si 2012-08-24 -# d.o.o. -# [Micha_Ben_Efraim] Micha Ben-Efraim mailto:benmi07&ca.com 2008-01-07 -# [Micha_Ben_Efraim_2] Micha Ben-Efraim mailto:micha&metalix.net 2011-01-31 -# [Micha_Ben_Efraim_3] Micha Ben-Efraim mailto:micha.ben-efraim&ca.com 2010-02-18 -# [Micha_Ben_Efraim_4] Micha Ben-Efraim mailto:micha&metalix.net 2012-11-27 -# [Michael_Agishtein] Michael Agishtein mailto:misha&unx.dec.com -# [Michael_Alyn_Miller] Michael Alyn Miller mailto:iana&aeolon.com -# [Michael_Andre] Michael Andre mailto:mandre>s-tkts.com -# [Michael_Andre_2] Michael Andre mailto:mandre&gatewayticketing.com 2007-10-04 -# [Michael_Battilana] Michael Battilana mailto:mcb-iana&cloanto.net 2010-04-30 -# [Michael_Benz] Michael Benz mailto:michael.benz&lsi.com 2010-08-06 -# [Michael_Berg] Michael Berg mailto:mike&dataapples.com 2005-08 -# [Michael_Bishop] Michael Bishop mailto:mbishop&fishnetsecurity.com -# [Michael_Boyle] Michael Boyle mailto:michaelboyle&smarttech.com -# [Michael_Broadfoot] Michael Broadfoot VirtualHere Pty. Ltd. mailto:mail&virtualhere.com 2015-04-02 -# [Michael_Cahill] Michael Cahill mailto:Michael.Cahill&bullant.net -# [Michael_Cartmel] Michael Cartmel Lumicom mailto:michael.cartmel&lumicom.com.au 2013-02-07 -# [Michael_Chapman] Michael Chapman mailto:mchapman&fortresstech.com 2004-11 -# [Michael_Chirila] Michael Chirila mailto:Michael.Chirila&softwareag.com 2006-01 -# [Michael_Collins] Michael Collins mailto:UBMCollins&aol.com -# [Michael_Coon] Michael Coon mailto:michael&thecube.com -# [Michael_Crawford] Michael Crawford mailto:MichaelC&dev.travsoft.com -# [Michael_Crawford_2] Michael Crawford mailto:michaelc&travsoft.com -# [Michael_Dalpiaz] Michael Dalpiaz mailto:Michael.Dalpiaz&sirona.com -# [Michael_Daniele] Michael Daniele mailto:michael.daniele&syamsoftware.com 2003-11 -# [Michael_Dasenbrock] Michael Dasenbrock mailto:dasenbro&apple.com -# [Michael_DeMoney] Michael DeMoney mailto:demoney&eng.sun.com -# [Michael_Demmer] Michael Demmer mailto:demmer&cs.berkeley.edu 2006-11 -# [Michael_Dodge] Michael Dodge mailto:sarge¢erspan.com -# [Michael_Douglass] Michael Douglass mailto:mikedoug&datafoundry.net -# [Michael_Durrant] Michael Durrant Arcturus Networks mailto:mdurrant&arcturusnetworks.com 2011-10-20 -# Inc. -# [Michael_Elizarov] Michael Elizarov mailto:Michael.Elizarovµsoft.com 2007-01 -# [Michael_Fischer] Michael Fischer mailto:otterley&pass.com -# [Michael_Fischer_2] Michael Fischer tel:+49-531-21-13-0 -# [Michael_Fread] Michael Fread Nexum, Inc. mailto:mfread&nexuminc.com 2012-09-21 -# [Michael_Friedman] Michael Friedman mailto:mfr1&worldnet.att.net -# [Michael_Ginn] Michael Ginn mailto:ginn&tyxar.com -# [Michael_Gleicher] Michael Gleicher mailto:mgleicher&comcast.net -# [Michael_Haeuptle] Michael Haeuptle mailto:Michael_Haeuptle&hp.com -# [Michael_Hunter] Michael Hunter mailto:mphunter&qnx.com -# [Michael_J_Hoy] Michael J Hoy mailto:mhoy&canberra-abq.com -# [Michael_J_Primeaux] Michael J Primeaux mailto:michael.primeaux&renkara.com -# [Michael_Karagosian] Michael Karagosian mailto:michael.karagosian&mkpe.com 2008-09-04 -# [Michael_Khalandovsky] Michael Khalandovsky mailto:mlk&epicon.com -# [Michael_King] Michael King mailto:mike.king&pvxplus.com 2006-07 -# [Michael_Lacher] Michael Lacher HLW Software mailto:michael.lacher&hlw.co.at 2011-10-11 -# Development GmbH -# [Michael_Landwehr] Michael Landwehr mailto:mikel&precisesoft.co.il -# [Michael_Lanzetta] Michael Lanzetta mailto:hagbard&ultimatech.com -# [Michael_Lekias] Michael Lekias mailto:admin&psdesign.com.au -# [Michael_Levy] Michael Levy mailto:ml&nh.ca -# [Michael_Lyle] Michael Lyle mailto:protocols&translattice.com 2009-11-03 -# [Michael_Marking] Michael Marking mailto:marking&tatanka.com -# [Michael_Marks] Michael Marks mailto:marks_michael&emc.com -# [Michael_McDaniels] Michael McDaniels Extreme Networks Inc mailto:mmcdaniels&extremenetworks.com 2008-05-01 -# [Michael_McNabb] Michael McNabb mailto:michael&aquaminds.com 2005-10 -# [Michael_Mealling] Michael Mealling mailto:michaelm&netsol.com -# [Michael_Mealling_2] Michael Mealling mailto:michael&refactored-networks.com 2005-08 -# [Michael_Melio] Michael Melio mailto:meliomd&comcast.net 2003-10 -# [Michael_Mester] Michael Mester mailto:mmester&cymtec.com -# [Michael_Monasterio] Michael Monasterio mailto:michael&wmsoftware.com -# [Michael_Muth] Michael Muth mailto:m.muth&tec5.com 2009-05-11 -# [Michael_O_Brien] Michael O'Brien mailto:mobrien02&comcast.net 2003-03 -# [Michael_O_Connor] Michael O'Connor mailto:moconnor&adobe.com -# [Michael_Paddon] Michael Paddon mailto:michael.paddon&activesky.com 2002-07 -# [Michael_Padrezas] Michael Padrezas mailto:mpaderzas&bluelance.com -# [Michael_Purser] Michael Purser mailto:mrp&mincom.com 2006-06 -# [Michael_R_Pizolato] Michael R. Pizolato mailto:michael&afs.com -# [Michael_R_Young] Michael R. Young mailto:michael.young&tor.sunpub.com -# [Michael_Rathmann] Michael Rathmann mailto:rathmann_ia&milesinfo.com -# [Michael_Richardson] Michael Richardson mailto:mcr&sandelman.ca 2011-02-08 -# [Michael_S_Amirault] Michael S Amirault mailto:ambi&world.std.com -# [Michael_S_Bogovich] Michael S. Bogovich mailto:info&burnthebox.us -# [Michael_S_Greenberg] Michael S. Greenberg mailto:arnoff&ftp.com -# [Michael_Scarito] Michael Scarito mailto:ms&mit.edu 2007-02 -# [Michael_Schmidt] Michael Schmidt mailto:mmaass&us.ibm.com -# [Michael_Schonborn] Michael Schönborn T-Mobile mailto:michael.schoenborn&t-mobile.net 2009-09-11 -# International AG -# [Michael_Settles] Michael Settles mailto:michael.settles&verizon.net 2002-03 -# [Michael_Sharpe] Michael Sharpe mailto:iana-ports&netiq.com 2010-09-14 -# [Michael_Shearson] Michael Shearson mailto:mshearson&peerglobal.com -# [Michael_Shearson_2] Michael Shearson mailto:mikes&softsys-inc.com -# [Michael_Sparks] Michael Sparks mailto:msparks&telequiplabs.com 2002-06 -# [Michael_Spratte] Michael Spratte Hewlett Packard mailto:michael.spratte&hp.com 2014-04-09 -# [Michael_Stapelberg] Michael Stapelberg mailto:michael+iana&stapelberg.ch 2015-01-07 -# [Michael_Stein] Michael Stein mailto:mvs&apple.com -# [Michael_Swan] Michael Swan mailto:swan&neon.com 2004-04 -# [Michael_Sweet] Michael Sweet mailto:msweet&ctr.nawcad.navy.mil -# [Michael_Tennefoss] Michael Tennefoss mailto:mtennefoss&echelon.com -# [Michael_Thesing] Michael Thesing mailto:michael.thesing&acsatlanta.com -# [Michael_Thomason] Michael Thomason mailto:mthomason&gmail.com -# [Michael_Toth] Michael Toth mailto:iana&spiralcraft.com 2002-03 -# [Michael_Ubell] Michael Ubell mailto:michael&montage.com -# [Michael_Walsh] Michael Walsh mailto:mww&warwick.net -# [Michael_Werski] Michael Werski mailto:michael.werski&azeti.net 2010-02-18 -# [Michael_Whiteley] Michael Whiteley mailto:michael&whiteley.com 2003-04 -# [Michael_Wiklund] Michael Wiklund Mictron mailto:iana&wiklunden.se 2013-10-17 -# [Michael_Wood] Michael Wood mailto:wood&althea.hks.com -# [Michael_Yip] Michael Yip mailto:Michael.Yip&alcatel.com -# [Michael_Yun] Michael Yun mailto:cinnanda&gmail.com 2007-10-24 -# [Michael_Zirpel] Michael Zirpel mailto:mbz&rvscom.com -# [Michael_Zunke] Michael Zunke mailto:michael.zunke&ealaddin.com 2010-07-23 -# [Michael_Zunke_2] Michael Zunke mailto:Michael.Zunke&ealaddin.com 2010-07-23 -# [Michael_Zunke_3] Michael Zunke Safenet Inc. mailto:michael.zunke&safenet-inc.com 2014-07-02 -# [Michaela_Vanderveen] Michaela Vanderveen mailto:mvandervn&yahoo.com 2007-02 -# [Michal_Gruchala] MichaÅ‚ GruchaÅ‚a GOG.com mailto:admin&gog.com 2014-07-31 -# [Michel_Bourget] Michel Bourget mailto:michel&sgi.com 2009-01-06 -# [Michel_Stam] Michel Stam HaloteC Instruments mailto:michel.stam&halotec.com 2012-02-07 -# B.V. -# [Michel_Stam_2] Michel Stam mailto:michel.iana&reverze.net 2012-11-20 -# [Michiel_Terpstra] Michiel Terpstra mailto:terpstra.m&interactionnext.nl 2013-11-13 -# [Mick_Conley] Mick Conley Wi-Fi Alliance mailto:mconley&wi-fi.org 2013-12-31 -# [Micromat] Micromat mailto:supportµmat.com -# [Microlite_Corporation] Microlite Corporation mailto:tomµlite.com 2015-11-04 -# [Microsoft_Corporation] Microsoft Corporation mailto:pratsharµsoft.com 2011-08-04 -# [Microsoft_Corporation_2] Microsoft Corporation mailto:stdsreqµsoft.com 2012-03-15 -# [Microsoft_Corporation_3] Microsoft Corporation mailto:sachinsµsoft.com 2012-06-27 -# [Microsoft_Corporation_4] Microsoft Corporation mailto:joeballµsoft.com 2013-06-16 -# [Microtec_Informatique] Microtec Informatique mailto:raphµtec.fr 2012-03-15 -# [MicroTechniX] MicroTechniX mailto:Infoµtechnix.com 2014-10-13 -# [Mictron] Mictron mailto:iana&mictron.se 2013-10-17 -# [MIDI_Manufacturers_Assoc_Inc] MIDI Manufacturers mailto:info&midi.org 2011-11-14 -# Assoc Inc -# [Midnight_Oil_Enterprises_LLC] Midnight Oil mailto:corkill&mn-oil.com 2013-07-09 -# Enterprises, LLC -# [Miele_Cie_KG] Miele & Cie. KG mailto:nils.langhammer&miele.de 2014-03-13 -# [Miguel_Angel_Fernand] Miguel Angel Fernandez mailto:mafg&tid.es -# [Miguel_Angel_Garcia] Miguel Angel Garcia mailto:Miguel.A.Garcia&ericsson.com -# [Mike_Accetta] Mike Accetta mailto:MIKE.ACCETTA&cmu-cs-a.edu -# [Mike_Alexander] Mike Alexander mailto:mta&um.cc.umich.edu -# [Mike_Balch] Mike Balch mailto:mbalch&teltone.com -# [Mike_Barthelemy] Mike Barthelemy mailto:msb&chromagrafx.com -# [Mike_Bello] Mike Bello mailto:mbello&zarak.com -# [Mike_Bernadett] Mike Bernadett mailto:mjbernadett&sbcglobal.net 2010-06-03 -# [Mike_Berrow] Mike Berrow -# [Mike_Bert] Mike Bert mailto:BERG_MIKE&tandem.com -# [Mike_Bombich] Mike Bombich mailto:bombich&apple.com -# [Mike_Brady] Mike Brady mailto:brady&cs.tcd.ie -# [Mike_Bush] Mike Bush mailto:mike.bush&allenvanguard.com -# [Mike_Clise] Mike Clise mailto:mikec&instantservice.com -# [Mike_Colagrosso] Mike Colagrosso mailto:ciao&ciaoapp.com 2011-10-24 -# [Mike_Cooper] Mike Cooper mailto:mcooper&magnicomp.com 2003-03 -# [Mike_Courterier] Mike Courterier Deerfield mailto:mikec&deerfield.net 2015-07-15 -# Communications Inc. -# [Mike_Craft] Mike Craft mailto:mcraft&cerner.com 2008-01-29 -# [Mike_Delgrosso] Mike Delgrosso mailto:mdelgros&tripplite.com 2003-01 -# [Mike_Delgrosso_2] Mike Delgrosso mailto:Mike_Delgrosso&tripplite.com 2007-07-02 -# [Mike_Dolan] Mike Dolan mailto:MDolan&ihcmail.ih.lucent.com -# [Mike_Dyslin] Mike Dyslin mailto:mike.dyslin&hp.com 2006-08 -# [Mike_Flemming] Mike Flemming mailto:mf&xnet.com -# [Mike_Gagle] Mike Gagle mailto:MikeG&inter-intelli.com -# [Mike_Gagle_2] Mike Gagle mailto:mikeg&inin.com 2006-05 -# [Mike_Goddard] Mike Goddard mailto:mike.goddard&ardent.com.au -# [Mike_Gossett] Mike Gossett mailto:mike&omnibond.com 2002-04 -# [Mike_Gregory] Mike Gregory mailto:Gregory_Mike&msmail.iipo.gtegsc.com -# [Mike_Harris] Mike Harris Adobe Systems Inc. mailto:mikeharr&adobe.com 2012-04-17 -# [Mike_Heins] Mike Heins mailto:mike&minivend.com -# [Mike_Horowitz] Mike Horowitz mailto:mah&shiva.com -# [Mike_Hudack] Mike Hudack mailto:mike&mhudack.com -# [Mike_Irani] Mike Irani mailto:irani_mike&bah.com 2002-10 -# [Mike_Irani_2] Mike Irani mailto:irani&spawar.navy.mil 2003-06 -# [Mike_Jackson] Mike Jackson mailto:mhjack&tscnet.com -# [Mike_King] Mike King mailto:mike.king&pvxplus.com 2009-11-09 -# [Mike_Klein] Mike Klein mailto:m.klein&motorla.com 2002-02 -# [Mike_Little] Mike Little mailto:mike.little&gdc4s.com -# [Mike_Marshburn] Mike Marshburn mailto:paul&softarc.com -# [Mike_McCauley] Mike McCauley mailto:mikem&open.com.au 2005-05 -# [Mike_Morgan] Mike Morgan mailto:mmorgan&lucent.com -# [Mike_Morris] Mike Morris mailto:mike.morris&amx.com -# [Mike_Nuss] Mike Nuss mailto:mike&terascala.com -# [Mike_O_Brien] Mike O'Brien mailto:mike&mobrien.com 2004-11 -# [Mike_Pontillo] Mike Pontillo mailto:pontillo&hp.com 2003-08 -# [Mike_Rieker] Mike Rieker mailto:mikea&sp32.com -# [Mike_Rodbell] Mike Rodbell mailto:mrodbell&ciena.com -# [Mike_Sample] Mike Sample Global Relay mailto:Michael.Sample&GlobalRelay.net 2012-11-28 -# Communications Inc -# [Mike_Sherrill] Mike Sherrill mailto:sherrill&commvault.com -# [Mike_Spitzer] Mike Spitzer mailto:mjs&polyserve.com 2005-08 -# [Mike_St_Johns] Mike St. Johns mailto:stjohns&arpa.mil -# [Mike_Turley] Mike Turley mailto:turley&symplex.com -# [Mike_Velten] Mike Velten mailto:Mike_Velten&liebert.com -# [Mike_Velten_2] Mike Velten mailto:mike.Velten&liebert.com 2002-03 -# [Mike_Wray] Mike Wray mailto:mjw&hplb.hpl.hp.com -# [Mike_Wright] Mike Wright DIFUSI, Inc. mailto:mike&adnodes.co 2011-11-07 -# [Mike_Yenco] Mike Yenco mailto:mike¥co.com -# [Mike_Young] Mike Young mailto:myong&netattach.com -# [Mikhail_Belov] Mikhail Belov mailto:mikhail&imrgold.com 2002-02 -# [Mikhail_Fedotov] Mikhail Fedotov mailto:anyremote&mail.ru 2014-12-10 -# [Mikhail_Kruk] Mikhail Kruk mailto:mkruk&biscom.com -# [Milton_E_Sagen] Milton E. Sagen mailto:msagen&extensis.com -# [Milton_Pulis] Milton Pulis mailto:toothpic&fastq.com -# [Milton_Sagen] Milton Sagen mailto:msagen&extensis.com -# [MINDARRAY_SYSTEMS] MINDARRAY SYSTEMS (P) mailto:info&mindarraysystems.com 2011-10-25 -# LTD. -# [Ming_Jen_Chen] Ming-Jen Chen mailto:mjchen&trendchip.com.tw 2002-09 -# [Ming_Poon] Ming Poon mailto:mingp&corel.ca -# [Ming_Xu] Ming Xu mailto:ming&veritas.com -# [Ming_Zhang] Ming Zhang mailto:mzhang&cisco.com 2010-02-04 -# [Minoru_Ozaki] Minoru Ozaki mailto:Minoru.Ozaki&rdmg.mgcs.mei.co.jp -# [Mircea_Neacsu] Mircea Neacsu mailto:mircea&hypack.com 2011-10-27 -# [Miriam_Wohlgelernter] Miriam Wohlgelernter mailto:miriamw&adirtech.com -# [Mitch_Kaufman] Mitch Kaufman mailto:mk&weconnectyou.com -# [Mitchell_Bass] Mitchell Bass mailto:mitch&integrasolv.com 2005-08 -# [MITM] Man In The Middle AB mailto:martin&mitm.se 2011-10-18 -# [Mitra] Mitra mailto:mitra&earth.path.net -# [Mitsuji_Toda] Mitsuji Toda mailto:toda&mmedia.mci.mei.co.jp -# [Mitsuo_Kodama] Mitsuo Kodama mailto:kodama&jbmia.or.jp 2005-06 -# [Miva_Corporation] Miva Corporation mailto:jwoods&miva.com.au -# [MJA_Technology_LLC] MJA Technology LLC mailto:markapp&roadrunner.com 2014-04-23 -# [modbus.org] modbus.org mailto:rbelliardi&modbus.org 2014-06-10 -# [Mogeneti] Mogeneti mailto:serveradmin&mogeneti.com 2012-09-26 -# [Mohsen_Banan] Mohsen Banan mailto:mohsen&rostam.neda.com -# [Mohsen_Banan_2] Mohsen Banan mailto:mohsen&neda.com -# [Moises_E_Hernandez] Moises E. Hernandez mailto:moises&accugraph.com -# [Montgomery_Zukowski] Montgomery Zukowski mailto:monty&nextnorth.acs.ohio-state.edu -# [Monty] Monty mailto:monty&analytikerna.se -# [Moon_Ho_Chung] Moon Ho Chung mailto:mchung&esps.com -# [Morega_System] Morega Systems Inc. mailto:atahir&morega.com 2012-08-20 -# [Morgan_Doyle] Morgan Doyle mailto:morgan&mpt.ie -# [Morgan_Jones] Morgan Jones mailto:mwj&cyasolutions.com -# [Moritz_Schmale] Moritz Schmale mailto:narrow.m&gmail.com 2011-10-07 -# [Morten_Christensen] Morten Christensen mailto:mjc&exbit.dk -# [Morten_Mertner] Morten Mertner mailto:mm&audiojuggler.com 2002-11 -# [Morteza_Kalhour] Morteza Kalhour mailto:Morteza.Kalhour&nokia.com 2002-02 -# [Mosha_Pasumansky] Mosha Pasumansky mailto:moshapµsoft.com -# [Moshe_Beeri] Moshe Beeri mailto:moshe&whale-com.com -# [Moshe_Leibovitch] Moshe Leibovitch mailto:moshe&softlinkusa.com -# [Moshe_Livne] Moshe Livne mailto:moshe&softlinkusa.com -# [Motorola_Solutions_Inc] Motorola Solutions, mailto:jenish&motorolasolutions.com 2012-03-14 -# Inc. -# [MSW_architecture_team] MSW architecture team NetApp mailto:mswarch&netapp.com 2014-07-18 -# [MUNDO_READER_SL] MUNDO READER SL mailto:adan.munoz&bq.com 2014-09-05 -# [Murali_Ranganathan] Murali Ranganathan mailto:murali_ranganathan&quickmail.apple.com -# [Murray_Freeman] Murray Freeman mailto:murray&officedomain.com -# [Murthy_Parthasarathi] Murthy Parthasarathi mailto:pvmurthy&effigent.com -# [Murthy_Srinivas] Murthy Srinivas mailto:murthy&novell.com -# [Muscarella_Fabrizio] Muscarella Fabrizio mailto:fabrizio.muscarella&sap.com 2006-04 -# [Muse_Communications] Muse Communications mailto:howard&muse3d.com -# Corporation -# [Myk_Willis] Myk Willis mailto:myk.willis&citrix.com -# [Myron_Hattig] Myron Hattig mailto:Myron_Hattig&ccm.jf.intel.com -# [NLnet_Labs_Support] NLnet Labs Support NLnet Labs mailto:support&nlnetlabs.nl 2011-07-11 -# [n-Count_Technology_BV] n-Count Technology mailto:ncount&dejongfrz.nl 2013-01-22 -# B.V. -# [Nancy_Davoust] Nancy Davoust mailto:n.davoust&cablelabs.com -# [Nand_Kumar] Nand Kumar mailto:nkumar&triquest-da.com -# [Naoki_Hayashi] Naoki Hayashi mailto:ha&fjh.se.fujitsu.co.jp -# [Narain_Jagathesan] Narain Jagathesan mailto:narain.jagathesan&oracle.com 2003-11 -# [Narasimha_Rao_N] Narasimha Rao N. mailto:nnarasimharao&novell.com -# [Narayanan_Raju] Narayanan Raju mailto:narayanan.raju&hp.com 2009-02-05 -# [Natarajan_Balasundar] Natarajan Balasundara mailto:rajan&ipanoramii.com -# [Nate_Rivard] Nate Rivard mailto:nrivard&cc.gatech.edu -# [Nathan_Hammond] Nathan Hammond mailto:nathan.hammond&stonebranch.com 2005-10 -# [Nathan_Hammond_2] Nathan Hammond Stonebranch, Inc. mailto:nathan.hammond&stonebranch.com 2013-06-25 -# [Nathan_Jeffords] Nathan Jeffords Comtech mailto:njeffords&comtechefdata.com 2014-01-23 -# [Nathan_Karstens] Nathan Karstens Garmin International, mailto:nettel&garmin.com 2015-07-23 -# Inc." -# [Nathan_Sadia] Nathan Sadia mailto:sadia&maincontrol.com -# [National_Instruments] National Instruments mailto:joshua.prewitt&ni.com 2011-10-24 -# National Marine -# [National_Marine_Electronics_Association] Electronics mailto:sspitzer&nmea.org 2011-09-15 -# Association -# [Navtech_Radar_Ltd] Navtech Radar mailto:network.admin&navtechradar.com 2013-02-20 -# [Neal_Taylor] Neal Taylor mailto:ianareg&apani.com -# [Nedap] Nedap mailto:leon.vandervoortvanderkleij&nedap.com 2014-08-28 -# [Nedelcho_Stanev] Nedelcho Stanev mailto:nstanev&csoft.bg -# [Nedelcho_Stanev_2] Nedelcho Stanev mailto:decho&csoft.bg -# [Nedelcho_Stanev_3] Nedelcho Stanev mailto:decho&iname.com -# [Neel_A_Bhatt] Neel A. Bhatt Symantec Corp mailto:neel_bhatt&symantec.com 2012-01-03 -# [Neer_Kleinman] Neer Kleinman mailto:neer&qsr.co.il -# [NEGU_Soft] NEGU Soft mailto:info&negusoft.com 2012-09-10 -# [Neil_Coggins] Neil Coggins mailto:neil.coggins&6thsight.com 2006-07 -# [Neil_Salter] Neil Salter mailto:neil&indigo2.mvel.demon.co.uk -# [Neo_Technology_Inc] Neo Technology, Inc mailto:admins&neotechnology.com 2013-02-08 -# [Nest_Labs_Inc] Nest Labs, Inc. mailto:grant&nestlabs.com 2014-01-16 -# [Nestor_A_Diaz] Nestor A. Diaz mailto:nestor&tiendalinux.com 2009-05-12 -# [NetApp] NetApp, Inc. mailto:mswarch&netapp.com 2014-07-18 -# [NetApp_2] NetApp mailto:pmu&netapp.com. 2014-08-12 -# [NetOp_Technical_Supp] NetOp Technical Support mailto:support&danware.dk -# [netperf.org] netperf.org mailto:netperf-feedback&netperf.org 2013-04-05 -# [Nevil_Brownlee] Nevil Brownlee mailto:n.brownlee&auckland.ac.nz 2006-10 -# [Nexenta] John S. Howard Nexenta mailto:jsh&nexenta.com 2012-12-07 -# [NexStor_India_Limite] NexStor India Limited mailto:next&nda.vsnl.net.in -# [NextDay_Aps] NextDay Aps mailto:nextday&infinite-loop.dk 2012-04-24 -# [Nexum] Nexum, Inc. mailto:mfread&nexuminc.com 2012-09-21 -# [Niall_Hogg] Niall Hogg mailto:niall.hogg&interamics.com 2011-10-25 -# [Niall_Murphy] Niall Murphy mailto:niallm&orca.ucd.ie -# [Nic_Catrambone] Nic Catrambone mailto:ncatramb&us.ibm.com 2003-01 -# [Nicholas_Chua] Nicholas Chua mailto:nick&sendit.se -# [Nicholas_Davies] Nicholas Davies mailto:N.Davies&globalcomm.co.uk -# [Nicholas_J_Howes] Nicholas J Howes mailto:nick&ghostwood.org -# [Nicholas_Stowfis] Nicholas Stowfis mailto:nstowfis&esps.com -# [Nicholas_Young] Nicholas Young mailto:ntchkd&gmail.com 2008-07-10 -# [Nick_Austin] Nick Austin mailto:ogmion&ogmium.com -# [Nick_Barendt] Nick Barendt mailto:nbarendt&vxitech.com 2005-08 -# [Nick_Barendt_2] Nick Barendt mailto:nbarendt&vxitech.com -# [Nick_Barendt_3] Nick Barendt mailto:nbarendt&vxitech.com -# [Nick_Brosnahan] Nick Brosnahan mailto:nbrosnahan&apple.com -# [Nick_Connor] Nick Connor mailto:nickc&assuria.com 2010-06-30 -# [Nick_Emery] Nick Emery mailto:Nick.Emery&altavista.digital.com -# [Nick_Holt] Nick Holt mailto:nickh&purenetworks.com 2005-08 -# [Nick_Plante] Nick Plante mailto:nplante&dmod.com -# [Nick_Shipman] Nick Shipman mailto:Nick.Shipman&mrmog.reo.dec.com -# [Nick_Stephen] Nick Stephen mailto:nick.stephen&sun.com 2005-08 -# [Nick_Straguzzi] Nick Straguzzi mailto:Nick_Straguzzi&akbs.com -# [Nick_Warrington] Nick Warrington mailto:nick.warrington&paconsulting.com 2006-03 -# [Nick_Woronuk] Nick Woronuk mailto:nick.woronuk&megasys.com -# [Nick_de_Smith] Nick de Smith mailto:nick&desmith.net -# [Nicola_J_Howarth] Nicola J. Howarth mailto:njh&ansa.co.uk -# [Nicolas_Bouilleaud] Nicolas Bouilleaud mailto:nbouilleaud&lacie.com -# [Nicolas_Payette] Nicolas Payette mailto:payetten&trivialtechnology.com -# [Nicolas_Pouillon] Nicolas Pouillon Freebox SAS mailto:npouillon&freebox.fr 2012-12-14 -# [Nicolas_Williams] Nicolas Williams mailto:Nicolas.Williams&oracle.com 2010-08-09 -# [Nicole_C_Ouellette] Nicole C. Ouellette mailto:nouellette&connected.com 2004-02 -# [Niels_Castle] Niels Castle mailto:castle&castleandersen.dk -# [Niels_Castle_2] Niels Castle mailto:castle&castleandersen.dk 2014-06-18 -# [Niels_Christiansen] Niels Christiansen mailto:nchris&austin.ibm.com -# [Nigel_Groves] Nigel Groves mailto:nigel.groves&ca.com 2006-06 -# [Nigel_Stephens] Nigel Stephens mailto:nigel&algor.co.uk -# [Nigel_Warren] Nigel Warren mailto:info&flyobjectspace.com 2009-02-12 -# [Niklas_Weiss] Niklas Weiss mailto:n.weiss&d-trust.net 2004-11 -# [Nikolaus_Gerteis] Nikolaus Gerteis mailto:ngerteis&apple.com -# [Nils_Langhammer] Dr. Nils Langhammer Miele & Cie. KG mailto:nils.langhammer&miele.de 2014-03-13 -# [Nimrod_Diamant] Nimrod Diamant mailto:nimrod.diamant&intel.com 2005-02 -# [Nine_Technology_LLC] Nine Technology, LLC mailto:astoev&ninetechnology.com 2011-08-01 -# [Nir_Baroz] Nir Baroz mailto:nbaroz&encore.com -# [Nitin_Gupta] Nitin Gupta mailto:nguptµsoft.com 2008-12-24 -# [Nitza_Steinberg] Nitza Steinberg mailto:nitza&isd.3com.com -# [Nitzan_Daube] Nitzan Daube mailto:nitzan&brm.com -# [Noah_Paul] Noah Paul mailto:noahp&altavista.net -# [Noah_Paul_2] Noah Paul mailto:noahp&ultranet.com -# [Noah_Slater] Noah Slater mailto:nslater&bytesexual.org 2007-11-27 -# [Noam_Rimon] Noam Rimon mailto:noam.rimon&playstation.sony.com 2004-12 -# [Noor_Chowdhury] Noor Chowdhury mailto:noor&hypercom.com -# [Norbert_Kintzler] Norbert Kintzler mailto:NKintzler&easy-soft-dresden.de 2004-11 -# [Norbert_Sendetzky] Norbert Sendetzky mailto:norbert&linuxnetworks.de -# [Norival_Figueira] Norival Figueira mailto:nfigueir&brocade.com 2010-04-07 -# [Norm_Freedman] Norm Freedman mailto:normfree&san.rr.com 2003-08 -# [Norm_Freedman_2] Norm Freedman mailto:normfree&worldnet.att.net -# [Norm_Lunde] Norm Lunde mailto:norm&commvault.com 2004-11 -# [Norman_Brie] Norman Brie mailto:norm_brie&sns.ca -# [Norman_Safeground_AS] Norman Safeground AS mailto:kristian.bognaes&norman.com 2014-01-15 -# [Norman_Wilson] Norman Wilson mailto:nwilson&programmar.com 2010-10-06 -# [Northon_Rodrigues] Northon Rodrigues mailto:northon.rodrigues&thomson.net 2004-02 -# [Notable_Solutions_Inc] Notable Solutions, mailto:dev&nsius.com 2011-09-01 -# Inc. -# [NovaWiz_LTD] NovaWiz LTD mailto:Moshe&novawiz.com -# [Nuance_Communications_Inc] Nuance mailto:Mark.Jackson&nuance.com 2011-10-27 -# Communications, Inc. -# [Nuance_Communications_Inc2] Nuance Communications mailto:NOD_SolutionsArchitecture&nuance.com 2012-10-05 -# [OASIS] OASIS mailto:robin&oasis-open.org 2015-02-10 -# [OASIS_KMIP_Technical_Committee] OASIS KMIP Technical mailto:robin&oasis-open.org 2011-07-25 -# Committee -# [Object_Matrix] Object Matrix mailto:support&object-matrix.com -# [Objective_Decision] Objective Decision mailto:od4contact&objective-decision.com -# [Oblamatik_AG] Oblamatik AG mailto:info&oblamatik.ch 2012-09-05 -# [Observium] Observium mailto:adama&observium.org 2013-05-10 -# [OC] OC mailto:ocs&ocs.cz -# [OCA_Alliance] OCA Alliance mailto:tina.lipscomb&oca-alliance.com 2012-10-11 -# [Odo_Maletzki] Odo Maletzki mailto:Odo.Maletzki&ioag.de -# [ODVA_Inc] ODVA, Inc. mailto:babatke&ra.rockwell.com 2015-05-28 -# [Oishi_Toshiaki] Oishi Toshiaki SEIKO EPSON mailto:Oishi.Toshiaki&exc.epson.co.jp 2002-02 -# Corporation -# [Ola_Sandstrom] Ola Sandstrom mailto:ola.sandstrom&anoto.com 2003-03 -# [Ola_Strandberg] Ola Strandberg mailto:Ola.Strandberg&pharmasoft.se -# [Ole_Hellevik] Ole Hellevik mailto:oleh&interlinq.com -# [Ole_Morten_Duesund] Ole-Morten Duesund mailto:ole-morten.duesund&bbvisuals.no -# [Oleg_Noskov] Oleg Noskov mailto:olegn&corelcomputer.com -# [Oleksandr_Zakharchuk] Oleksandr Zakharchuk mailto:zakharchuk&dialogtech.com -# [Oliver_Anan] Oliver Anan mailto:oliver&ananit.de 2010-09-02 -# [Oliver_Bailey] Oliver Bailey mailto:zzf66jjlm&time-lines.com 2003-01 -# [Oliver_Heinz] Oliver Heinz mailto:heinz&arago.de 2005-08 -# [Oliver_Korfmacher] Oliver Korfmacher mailto:okorf&netcs.com -# [Oliver_Lewis] Oliver Lewis mailto:o.lewis&icerobotics.co.uk 2006-08 -# [Oliver_Thulke] Oliver Thulke mailto:oth&ratio.de -# [Olivier_Delecluse] Olivier Delecluse mailto:odelecluse&intego.com -# [Olivier_Guezenec] Olivier Guezenec mailto:olivier.guezenec&cogilab.com 2006-12 -# [Olivier_Mascia] Olivier Mascia mailto:om&tipgroup.com -# [Olivier_St-Laurent] Olivier St-Laurent Galaxy4D Online Game mailto:admin&galaxy4d.com 2012-06-18 -# Engine -# [Omer_BarNir] Omer BarNir mailto:omer.barnir&oracle.com -# [One_Laptop_per_Child] One Laptop per mailto:devel&lists.laptop.org -# Child/Collabora Ltd. -# [Open_Lighting_Project] Open Lighting Project mailto:simon&nomis52.net 2013-12-09 -# [Open_Mobile_Alliance] Open Mobile Alliance mailto:Technical-Comments&mail.openmobilealliance.org 2011-08-19 -# Open Mobile Alliance -# [Open_Mobile_Alliance_Device_Management_DM_Working_Group] Device Management (DM) mailto:Technical-Comments&mail.openmobilealliance.org 2011-08-19 -# Working Group -# [Open_Networking_Foundation] Open Networking mailto:iana&opennetworking.org 2013-07-18 -# Foundation -# [Open_Source_Virtual_Reality_OSVR.com] Open Source Virtual mailto:iana&sensics.com 2015-07-14 -# Reality (OSVR.com) -# [OpenDOF] OpenDOF mailto:protocol&opendof.org 2015-04-23 -# [OpenJDK] OpenJDK mailto:discuss&openjdk.java.net 2013-03-12 -# [OpenMail_Encyclopedi] OpenMail Encyclopedia mailto:opencyc&hpopd.pwd.hp.com -# [OpenRemote_Inc] OpenRemote, Inc. mailto:juha&openremote.org 2012-12-18 -# [OPNET_Technologies_Inc] OPNET Technologies mailto:tmacomber&opnet.com 2011-09-21 -# Inc -# [Oracle] Oracle Corporation mailto:Devjani.Ray&oracle.com 2012-04-20 -# [Oracle_2] Oracle Corporation mailto:steve.mckinty&oracle.com 2013-08-14 -# [Oracle_3] Oracle Corp. mailto:dan.c.newman&oracle.com 2013-09-20 -# [Oracle_4] Oracle mailto:john.levon&oracle.com 2013-12-24 -# [Oracle_5] Oracle mailto:mark.falco&oracle.com 2014-07-09 -# [Oracle_6] Oracle Corp. mailto:hubert.vijay.arokiasamy&oracle.com 2014-10-28 -# [Oracle_7] Oracle Corp mailto:sowmini.varadhan&oracle.com 2015-04-30 -# [Oracle_8] Oracle Corp mailto:omer.barnir&oracle.com 2015-08-06 -# [Oran_Davis] Oran Davis mailto:oran&8x8.com -# [Orazio_Granato] Orazio Granato mailto:og&wsbgrd01.italy.hp.com -# [Oren_Hurvitz] Oren Hurvitz mailto:oren&omnisky.com -# [Oren_Trutner] Oren Trutner mailto:orentrutµsoft.com 2003-08 -# [Ori_Yosefi] Ori Yosefi mailto:Ori.Yosefiµsoft.com 2009-05-04 -# [Oriol_Ferrer_Mesia] Oriol Ferrer Mesia mailto:tm05788&salleurl.edu -# [Orion_Reblitz_Richar] Orion Reblitz-Richardson mailto:orionr&rakket.com -# [OS_NEXUS] OS NEXUS, Inc. mailto:info&osnexus.com 2012-09-21 -# [Osamu_Masuda] Osamu Masuda -# [Oskar_Persano] Oskar Persano ims Info Management mailto:ope&ims-info.ch 2011-10-20 -# Systems AG -# [Octopus_Deploy_Pty_Ltd] Octopus Deploy Pty. mailto:paul&octopusdeploy.com 2015-01-28 -# Ltd. -# [Owen_Sullivan] Owen Sullivan mailto:owen.sullivan&aldiscon.ie -# [Ozate_Inc] Ozate Inc. mailto:joe&ozate.com 2011-10-12 -# [PACE_Anti-Piracy] PACE Anti-Piracy mailto:allen&paceap.com 2014-04-28 -# [POV_Team_Co_ordinato] POV-Team Co-ordinator mailto:iana-port.remove-spamguard&povray.org -# [PV_Shivkumar] PV Shivkumar mailto:p.shivkumar&oracle.com 2003-10 -# [P_T_K_Farrar] P.T.K. Farrar mailto:farrarp&teccon.co.uk -# [P_V_Shivkumar] P.V.Shivkumar mailto:PSHIVKUM&us.oracle.com -# Panasonic Intranet, -# [Panasonic_Intranet_Panasonic_North_America_PEWLA] Panasonic North mailto:protocols&pewla.us.pewg.panasonic.com 2012-11-12 -# America (PEWLA) -# [Panic_Inc] Panic Inc. mailto:cabel&panic.com 2012-07-19 -# [Panic_Ride] Panic Ride mailto:panicride&hao.org -# [Paolo_Desii] Paolo Desii POWERSOFT S.R.L. mailto:paolo.desii&powersoft.it 2012-01-03 -# [Pat_Calhoun] Pat Calhoun mailto:CALHOUN&admin.eicon.qc.ca -# [Pat_Galvin] Pat Galvin mailto:pgalvin&databeam.com -# [Pat_Mcgowan] Pat Mcgowan mailto:pmcgowan&folio.com -# [Pat_Richard] Pat Richard mailto:patr&xcert.com -# [Pat_Tovo] Pat Tovo mailto:pat.tovo&veritas.com 2004-12 -# [Patrick_Chipman] Patrick Chipman mailto:pchipman&memphis.edu -# [Patrick_Cipiere] Patrick Cipiere mailto:Patrick.Cipiere&udcast.com -# [Patrick_Ferriter] Patrick Ferriter mailto:Patrick.Ferriter&zultys.com 2003-06 -# [Patrick_Fisher] Patrick Fisher mailto:pfisher&hns.com 2004-12 -# [Patrick_Furlong] Patrick Furlong mailto:pfurlong&darkknight.ca 2003-01 -# [Patrick_H_Piper] Patrick H. Piper mailto:ppiper&netlinxinc.com 2009-03-06 -# [Patrick_Kara] Patrick Kara mailto:Patrick&eba.net -# [Patrick_Lee] Patrick Lee mailto:leecotechnologies&comcast.net 2008-03-10 -# [Patrick_M_McNeal] Patrick M McNeal mailto:mcneal&umich.edu 2006-03 -# [Patrick_McNamee] Patrick McNamee -# [Patrick_Moore] Patrick Moore mailto:pcmoore&sandia.gov -# [Patrick_Noffke] Patrick Noffke mailto:patrick.noffke&adpro.com.au -# [Patrick_Robinson] Patrick Robinson mailto:probinson&plosive.com -# [Patrick_Stein] Patrick Stein mailto:Patrick.Stein&jinx.eu 2011-10-24 -# [Patrick_Verbeek] Patrick Verbeek mailto:p.verbeek&scottygroup.com 2007-05 -# [Patrick_Verbeek_2] Patrick Verbeek SCOTTY Group SE mailto:p.verbeek&scottygroup.com 2013-01-14 -# [Patti_Jo_Newsom] Patti Jo Newsom mailto:pjn&mcsdallas.com -# [Patty_Ho] Patty Ho mailto:rimf&core.rose.hp.com 2007-05 -# [Paul_A_Suhler] Paul A. Suhler mailto:paul.suhler&quantum.com 2009-02-06 -# [Paul_Alfille] Paul Alfille mailto:paul.alfille&gmail.com 2007-01 -# [Paul_Amsden] Paul Amsden mailto:amsden@.ctron.com -# [Paul_Anderson] Paul Anderson mailto:paul.anderson&ip-cs.com 2003-04 -# [Paul_Annala] Paul Annala mailto:paa&bull.se -# [Paul_Applegate] Paul Applegate mailto:p.applegate2&genie.geis.com -# [Paul_Austin] Paul Austin mailto:paul.austin&natinst.com -# [Paul_B_Finley] Paul B. Finley mailto:pfinley&us.ibm.com 2003-10 -# [Paul_Ballew] Paul Ballew mailto:ballew&projtech.com -# [Paul_Blacknell] Paul Blacknell mailto:paul&insitu.com -# [Paul_Bohm] Paul Bohm mailto:paul&dropbox.com 2010-01-21 -# [Paul_Breed] Paul Breed mailto:paul&netburner.com 2003-11 -# [Paul_Breslin] Paul Breslin mailto:phb&sidefx.com -# [Paul_Brown] Paul Brown mailto:pbrown&spcontrols.com 2011-04-27 -# [Paul_Bunn] Paul Bunn mailto:iana&ultrabac.com -# [Paul_Burgess] Paul Burgess Bridgeworks mailto:paul.burgess&4bridgeworks.com 2014-09-26 -# [Paul_Cadarette] Paul Cadarette mailto:pcadaret&us.ibm.com 2007-01 -# [Paul_Carmichael] Paul Carmichael mailto:paulcarmichael&indx.net -# [Paul_Chinn] Paul Chinn Apple mailto:pchinn&apple.com 2011-10-20 -# [Paul_Clark] Paul Clark mailto:paul&xmill.com 2006-02 -# [Paul_Cope] Paul Cope mailto:prc&auto-graphics.com 2003-11 -# [Paul_Denning] Paul Denning mailto:pauld&mitre.org -# [Paul_Dietrich] Paul Dietrich mailto:registrar&impinj.com -# [Paul_Dollemore] Paul Dollemore mailto:pauld&anthonydata.com -# [Paul_Fonte] Paul Fonte mailto:paul_fonte&mediastation.com -# [Paul_Ford_Hutchinson] Paul Ford-Hutchinson mailto:paulfordh&uk.ibm.com 2003-01 -# [Paul_Funk] Paul Funk mailto:paul&funk.com -# [Paul_Glaubitz] Paul Glaubitz mailto:Paul.Glaubitz&mt.com -# [Paul_Greenfield] Paul Greenfield mailto:paul.greenfield&unisys.com -# [Paul_Groarke] Paul Groarke mailto:paulg&quay.ie -# [Paul_Guyot] Paul Guyot mailto:pguyot&kallisys.net 2003-01 -# [Paul_H_Alfille] Paul H Alfille mailto:paul.alfille&gmail.com -# [Paul_Harrison] Paul Harrison mailto:paulh&idonix.co.uk -# [Paul_Helter] Paul Helter Teradici mailto:phelter&teradici.com 2014-04-28 -# [Paul_Higgs] Paul Higgs mailto:paul.higgs&ericsson.com -# [Paul_Hodara] Paul Hodara mailto:phodara&netwave.com 2005-11 -# [Paul_Hoffman] Paul Hoffman mailto:phoffman&imc.org -# [Paul_Hoffman_1] Paul Hoffman mailto:paul.hoffman&icann.org -# [Paul_Ignatius] Paul Ignatius mailto:paul.ignatius&scentric.com 2006-03 -# [Paul_Johnson] Paul Johnson mailto:paul.johnson&raima.com 2011-05-02 -# [Paul_K_Peterson] Paul K. Peterson mailto:paul&tribal.com -# [Paul_Kraus] Paul Kraus mailto:paul.kraus&veritas.com 2002-06 -# [Paul_Leach] Paul Leach mailto:paulleµsoft.com -# [Paul_Lesurf] Paul Lesurf mailto:paul.lesurf&vpltd.com -# [Paul_M_Franceus] Paul M Franceus mailto:paul&blueiris.us -# [Paul_McEntire] Paul McEntire mailto:paul.mcentire&columbiasc.ncr.com -# [Paul_McGinnis] Paul McGinnis mailto:pmcginnis&server.stmi.com -# [Paul_McGough] Paul McGough mailto:pmcgough&2factor.com 2007-02 -# [Paul_Mclachlan] Paul Mclachlan mailto:pmclachlan&mercury.com 2005-11 -# [Paul_Mockapetris] Paul Mockapetris mailto:PVM&isi.edu -# [Paul_Moore] Paul Moore mailto:paul.moore¢rify.com 2009-10-28 -# [Paul_Mu] Paul Mu NetApp mailto:pmu&netapp.com 2014-08-07 -# [Paul_Nelson] Paul Nelson mailto:paul&ioc-sea.com -# [Paul_Pyck] Paul Pyck mailto:papy&telindus.be -# [Paul_Reddy] Paul Reddy mailto:preddy&pharos.com -# [Paul_Reddy_2] Paul Reddy mailto:support&igo-incognito.com 2002-02 -# [Paul_Roberts] Paul Roberts mailto:PaulRoberts&engineer.com -# [Paul_Sanders] Paul Sanders mailto:p.sanders&dial.pipex.com -# [Paul_Sanders_2] Paul Sanders mailto:pe77&dial.pipex.com -# [Paul_Santinelli_Jr] Paul Santinelli Jr. mailto:psantinelli&narrative.com -# [Paul_Schilling] Paul Schilling mailto:PaulS&synapsis.com -# [Paul_Snook] Paul Snook mailto:paul.snook&itheon.com -# [Paul_Steane] Paul Steane Alstom Transport, mailto:paul.steane&transport.alstom.com 2012-12-14 -# Preston -# [Paul_Stephen_Borlie] Paul Stephen Borlie mailto:paul&icona.it -# [Paul_Sterk] Paul Sterk mailto:paul.sterk&sun.com 2006-03 -# [Paul_Stovell] Paul Stovell Octopus Deploy Pty. mailto:paul&octopusdeploy.com 2015-01-28 -# Ltd. -# [Paul_Streatch] Paul Streatch mailto:pstreatch&marchnetworks.com 2004-06 -# [Paul_Suhler] Paul Suhler mailto:paul.suhler&quantum.com 2008-02-15 -# [Paul_Tam] Paul Tam mailto:ianaportmaster&onbase.com 2004-12 -# [Paul_Tokarchuk] Paul Tokarchuk mailto:ptokarch&alias.com 2004-11 -# [Paul_Vixie] Paul Vixie mailto:paul&vix.com -# [Paul_W_Nelson] Paul W. Nelson mailto:nelson&thursby.com -# [Paul_Whittemore] Paul Whittemore mailto:paul&softarc.com -# [Paul_Wissenbach] Paul Wissenbach mailto:paulwi&vnd.tek.com -# [Paul_Wissmiller] Paul Wissmiller mailto:Paul.Wissmiller&ca.com -# [Paul_Wren] Paul Wren mailto:Paul.Wren¯o4.com -# [Paul_Zander] Paul Zander Philips CFT mailto:p.j.zander&philips.com 2004-03 -# [Pavel_Hampl] Pavel Hampl LPAR2RRD project mailto:pavel.hampl&lpar2rrd.com 2013-08-14 -# [Pavel_Mendl] Pavel Mendl mailto:pavel_mendl¢rum.cz 2007-03 -# CNS a.s. (IT company -# [Pavel_Mendl_2] Pavel Mendl registered in Czech mailto:Pavel.MENDL&cns.cz 2014-06-12 -# republic) -# [Pavlin_Ivanov_Radosl] Pavlin Ivanov Radoslavov mailto:pavlin&catarina.usc.edu -# [PC_SOFT] PC SOFT mailto:jae&pcsoft.fr 2014-02-02 -# [Pearson] Pearson mailto:chad.smith&pearson.com 2008-01-17 -# [Pedro_A_Rodriguez] Pedro A Rodriguez mailto:pedro.rdz&eaxtechnologies.com.mx 2008-08-06 -# [Pedro_Alpedrinha] Pedro Alpedrinha mailto:pedro.alpedrinha&redevirtual.com 2006-02 -# [Pekka_Riikonen] Pekka Riikonen mailto:priikone&poseidon.pspt.fi -# [Pekka_Takaranta] Pekka Takaranta mailto:pekka.takaranta&tellabs.fi -# [Peng_Dai] Peng Dai Delphix Corp mailto:peng.dai&delphix.com 2012-11-01 -# [Per_Cederqvist] Per Cederqvist mailto:ceder&lysator.liu.se -# [Per_Fahlberg] Per Fahlberg mailto:support&remograph.com 2009-01-21 -# [Per_Hellberg] Per Hellberg mailto:phellberg&isogon.com 2002-02 -# [Per_Sahlqvist] Per Sahlqvist mailto:psahlqvi&sw.seisy.abb.se -# [Per_Schroeder] Per Schroeder mailto:Per.Schroder&mimer.se -# [Performance_Co-Pilot_PCP_Project] Performance Co-Pilot mailto:kenj&internode.on.net 2013-10-09 -# (PCP) Project -# [Pete_Camble] Pete Camble mailto:pete.camble&hp.com 2008-12-24 -# [Pete_Loeffen] Pete Loeffen President at Digital mailto:peterl&digitalrowing.com 2006-10 -# Rowing Inc. -# [Pete_Moscatelli] Pete Moscatelli mailto:moscat&hprdstl0.rose.hp.com -# [Pete_Wong] Pete Wong mailto:petewongµsoft.com -# [Peter_Amstutz] Peter Amstutz mailto:tetron&interreality.org -# [Peter_Anvelt] Peter Anvelt mailto:panvelt&xnai.com -# [Peter_Aronson] Peter Aronson mailto:paronson&esri.com -# [Peter_Beahan] Peter Beahan mailto:peter_beahan&technologyonecorp.com 2004-11 -# [Peter_Berger] Peter Berger mailto:peterb&panasas.com -# [Peter_Boers] Peter Boers mailto:boers&isisglobal.nl 2002-05 -# [Peter_Boucher] Peter Boucher mailto:pboucher&senforce.com -# [Peter_Carlson] Peter Carlson mailto:pcarlson&tier2.com -# [Peter_Caswell] Peter Caswell mailto:pfc&pacvax.pacersoft.com -# [Peter_Ciuffetti] Peter Ciuffetti mailto:petec&silverplatter.com -# [Peter_Dennis_Bartok] Peter Dennis Bartok mailto:peter&novonyx.com -# [Peter_E_Williams] Peter E Williams mailto:peter.williams&smallworld-us.com -# [Peter_Egli] Peter Egli mailto:peter.egli&inalp.com -# [Peter_Egli_2] Peter Egli mailto:peter.egli&mail.inalp.com -# [Peter_Eriksson] Peter Eriksson mailto:pen&lysator.liu.se -# [Peter_Fernandez] Peter Fernandez mailto:fernandez&omnisec.ch 2002-03 -# [Peter_Frankenberg] Peter Frankenberg mailto:pcfberg&ibm.net -# [Peter_G_L_Potgiese] Peter G. L. Potgieser mailto:p.g.l.potgieser&interpay.nl 2003-07 -# [Peter_Gabriel] Peter Gabriel mailto:peter.gabriel&ims.fraunhofer.de 2006-01 -# [Peter_Gad] Peter Gad mailto:peter&bmc.uu.se -# [Peter_Hallenbeck] Peter Hallenbeck mailto:pete&consumertechnologiesgroup.com 2005-08 -# [Peter_Higginson] Peter Higginson mailto:higginson&mail.dec.com -# [Peter_Hombach] Peter Hombach mailto:p.hombach&osorno.ca 2011-03-16 -# [Peter_Hussey] Peter Hussey mailto:peterhusµsoft.com -# [Peter_Hyde] Peter Hyde mailto:peter&spis.co.nz -# [Peter_Ijkhout] Peter Ijkhout mailto:peter&deltasolutions.nl -# [Peter_Jacobs] Peter Jacobs mailto:pjacobs&tullib.com -# [Peter_Johnson] Peter Johnson mailto:peter&commlinx.com.au 2004-11 -# [Peter_Kaever] Peter Kaever mailto:kaever.peter&westfalia.com 2005-08 -# [Peter_King] Peter King mailto:king&uplanet.com -# [Peter_Kollath] Peter Kollath mailto:peter.kollath&canex.sk 2002-08 -# [Peter_Kollath_2] Peter Kollath mailto:root&gopal.home.sk 2014-05-27 -# [Peter_Krueger] Peter Krueger mailto:krueger&appss.de 2003-10 -# [Peter_Laschtowitz] Peter Laschtowitz mailto:pl&pq-computers.de 2009-09-15 -# [Peter_Lepeska] Peter Lepeska mailto:peter.lepeska&viasat.com 2010-09-10 -# [Peter_Lipp] Peter Lipp mailto:Peter.Lipp&iaik.at -# [Peter_Liu] Peter Liu -# [Peter_Loveday] Peter Loveday mailto:peter&eyeonline.com 2006-01 -# [Peter_MacAvock] Peter MacAvock mailto:macavock&dvb.org -# [Peter_Maher] Peter Maher mailto:quest_iana&oz.quest.com 2003-11 -# [Peter_Morrison] Peter Morrison mailto:peter_morrison&sydney.sterling.com -# [Peter_Moylan] Peter Moylan mailto:peter&ee.newcastle.edu.au 2002-08 -# [Peter_Phaal] Peter Phaal mailto:peter.phaal&inmon.com 2003-06 -# [Peter_Povinec] Peter Povinec mailto:peter.povinec&oracle.com 2010-04-13 -# [Peter_Pramberger] Peter Pramberger mailto:peter.pramberger&telering.co.at 2004-11 -# [Peter_Rocca] Peter Rocca mailto:rocca&multiboard.com 2002-10 -# [Peter_Saint_Andre] Peter Saint-Andre mailto:stpeter&stpeter.im 2009-11-25 -# [Peter_Sandstrom] Peter Sandstrom mailto:peter.sandstrom&tassen.fi -# [Peter_Santoro] Peter Santoro mailto:peter&pscomp.com -# [Peter_Schafer] Peter Schäfer mailto:p.schaefer&nospam.atc-systeme.de 2004-02 -# [Peter_Schoenberger] Peter Schoenberger mailto:ps&teles.de -# [Peter_Schow] Peter Schow mailto:Peter.Schow&sun.com 2007-01 -# [Peter_Steiner] Peter Steiner mailto:steiner&telecomsoftware.com 2011-02-22 -# [Peter_Teeuwen] Peter Teeuwen mailto:ptee&oce.nl -# [Peter_Verdon] Peter Verdon mailto:bess&dcs.warwick.ac.uk 2005-08 -# [Peter_Viscarola] Peter Viscarola mailto:PeterGV&osr.com -# [Peter_Waher] Peter Waher Clayster Laboratorios mailto:peter.waher&clayster.com 2014-06-16 -# Chile S.A. -# [Peter_Wenzel] Peter Wenzel mailto:Peter.Wenzel&profibus.com 2004-11 -# [Peter_Weyman] Peter Weyman mailto:pjweyman&noblenet.com -# [Peter_White] Peter White mailto:peter_white&3com.com 2004-11 -# [Peter_Whittaker] Peter Whittaker mailto:pww&entrust.com -# [Peter_Zurich] Peter Zurich mailto:pbz&lowpft.com -# [Peter_de_Laval] Peter de Laval mailto:pdl§ra.se -# [Peter_van_Dijk] Peter van Dijk mailto:peter&xlshosting.nl 2011-01-10 -# [Petr_Chardin] Petr Chardin mailto:petr&mysql.com 2004-12 -# [Petri_Rauhala] Petri Rauhala mailto:petri.rauhala&nokia.com 2005-08 -# [Petronel_Bigioi] Petronel Bigioi mailto:petronel&fotonation.com 2004-11 -# [Phil_Abercrombie] Phil Abercrombie mailto:phil.abercrombie&appiq.com 2005-08 -# [Phil_Barrett] Phil Barrett mailto:support&cambridgeanimation.com -# [Phil_Beecher] Phil Beecher Wi-SUN Alliance mailto:pbeecher&wi-sun.org 2015-06-26 -# [Phil_Braham] Phil Braham mailto:phil&braham.net -# [Phil_Davidson] Phil Davidson mailto:p.davidson&reftek.com -# [Phil_Frisbie] Phil Frisbie mailto:phil&hawksoft.com -# [Phil_Kerr] Phil Kerr mailto:phil&plus24.com 2002-02 -# [Phil_Lapsley] Phil Lapsley mailto:phil&ucbarpa.berkeley.edu -# [Phil_Maker] Phil Maker mailto:pjm&gnu.org 2008-06-18 -# [Phil_May] Phil May mailto:pm&datcon.co.uk -# [Phil_Piwonka] Phil Piwonka mailto:wnka&users.sourceforge.net -# [Phil_Servita] Phil Servita mailto:meister&ftp.com -# [Phil_Tolson] Phil Tolson mailto:philtolson&eaton.com 2010-01-21 -# [Phil_Willis] Phil Willis mailto:phil.willis&prism-uk.com 2003-08 -# [Phil_Willoughby] Phil Willoughby mailto:phil.willoughby&strawberrycat.com -# [Philip_Budne] Philip Budne mailto:budne&auroratech.com -# [Philip_N_Bergstress] Philip N. Bergstresser mailto:phil&bergstresser.org -# [Philip_Stephenson] Philip Stephenson mailto:Philip.stephenson&oracle.com 2005-08 -# [Philipp_Dreiss] Philipp Dreiss mailto:dreiss&isparx.de -# [Philipp_Marcel_Albre] Philipp Marcel Albrecht mailto:phipi&gmx.ch 2009-07-06 -# [Philippe_Binet] Philippe Binet mailto:phbinet&vnet.ibm.com -# [Philippe_Detournay] Philippe Detournay mailto:philippe.detournay&acrosoft.be 2007-11-12 -# [Philippe_Gilbert] Philippe Gilbert mailto:pgilbert&cal.fr -# [Phill_Goeckler] Phill Goeckler mailto:pgoeckler&cequint.com 2007-08-20 -# [Phillip_Dillinger] Phillip Dillinger mailto:Phillip.Dillinger&sealabs.com -# [Phillip_Heil] Phillip Heil mailto:phil.heil&dvtsensors.com 2002-02 -# [Phillip_Magson] Phillip Magson mailto:philm&extro.ucc.su.oz.au -# [Phivos_Aristides] Phivos Aristides mailto:phivos&opendesign.com -# [Photosmith] Photosmith mailto:ckhorne&photosmithapp.com 2011-10-27 -# [Physio-Control_Inc] Physio-Control, Inc. mailto:kevin.c.drew&physio-control.com 2014-02-14 -# [Pierre_Arnaud] Pierre Arnaud mailto:pierre.arnaud&iname.com -# [Pierre_Couderc] Pierre Couderc mailto:pcouderc&tol.fr 2006-03 -# [Pierre_Frisch] Pierre Frisch mailto:Pierre.Frisch&spearway.com -# [Pierre_Frisch_2] Pierre Frisch mailto:pierre.frisch&spearway.com -# [Piers_Scannell] Piers Scannell mailto:iana-form&lot105.com -# [Piers_Scannell_2] Piers Scannell mailto:piers&globecastne.com -# [Pieter_Ditmars] Pieter Ditmars mailto:pditmars&bbn.com -# [Pieter_Hintjens] Pieter Hintjens mailto:ph&imatix.com 2006-01 -# [Pieter_Hintjens2] Pieter Hintjens mailto:ph&imatix.com 2012-11-01 -# [Pieter_Hintjens_3] Pieter Hintjens mailto:ph&imatix.com 2012-12-17 -# [Pim_van_Riezen] Pim van Riezen mailto:registries&panelsix.com 2006-07 -# [Piotr_Parlewicz] Piotr Parlewicz mailto:pparlewicz&queryobject.com -# [Pisharath_Krishnan] Pisharath Krishnan mailto:krishnan&axis-inc.com -# [Pit_Vetterick] Pit Vetterick mailto:pit&3dgo.com 2002-05 -# [PLASA] PLASA mailto:standards.na&plasa.org 2012-06-01 -# [Portnoy_Boxman] Portnoy Boxman mailto:portnoy_boxman&bmc.com 2005-01 -# [Portnoy_Boxman_2] Portnoy Boxman mailto:Portnoy_Boxman&bmc.com 2006-09 -# [PowerSysLab] PowerSysLab mailto:info&powersyslab.com 2015-07-20 -# [POWERSOFT_SRL] POWERSOFT S.R.L. mailto:claudio.lastrucci&powersoft.it 2012-01-03 -# [Prabu_Ambravaneswara] Prabu Ambravaneswaran mailto:prambravµsoft.com 2009-10-29 -# [Pradeep_Bahl] Pradeep Bahl mailto:pradeepbµsoft.com -# [Prakash_Banthia] Prakash Banthia mailto:prakash_banthia&3com.com -# [Prakash_Iyer] Prakash Iyer mailto:prakash.iyer&intel.com 2009-08-10 -# [Pranay_Varma] Pranay Varma mailto:pran&veritas.com -# [Prashant_Dholakia] Prashant Dholakia mailto:prashant&semaphorecom.com -# [Prateek_Sharma] Prateek Sharma mailto:pratsharµsoft.com 2011-08-04 -# [Prathibha_Nagvar] Prathibha Nagvar -# [Pratik_Wadher] Pratik Wadher mailto:pratik&datadomain.com 2007-05 -# [Predrag_Filipovic] Predrag Filipovic mailto:pfilipovic&digital5.com 2002-11 -# [Prem_Tirilok] Prem Tirilok mailto:Prem.Tirilok&tellabs.com -# [PreSonus_Audio_Electronics_Inc] PreSonus Audio mailto:mjuwan&presonus.com 2013-07-12 -# Electronics, Inc -# [Preston_Bannister] Preston Bannister mailto:pbannister&quests.com -# [Prima_Designs_System] Prima Designs Systems mailto:info&prima.com.hk -# Ltd. -# [Primark_Corporation] Primark Corporation mailto:joe.boone&primark.com -# [Pritham_Shetty] Pritham Shetty mailto:pritham¯omedia.com -# [Pritham_Shetty_2] Pritham Shetty mailto:pritham&andromedia.com -# [ProControl_Technolog] ProControl Technology AB mailto:info&pctworld.com 2004-12 -# [Professor_Paul_S_Wa] Professor Paul S. Wang mailto:pwang&cs.kent.edu 2002-07 -# [Puneet_Agarwal] Puneet Agarwal mailto:pagarwal&broadcom.com 2013-07-18 -# [Puppet_Labs] Puppet Labs mailto:opsteam&puppetlabs.com 2014-09-18 -# [Pure_Storage] Pure Storage mailto:standards&purestorage.com 2013-08-13 -# [Qdea] Qdea mailto:support&qdea.com -# [Qentin_Neill] Qentin Neill mailto:quentin&columbiasc.ncr.com -# [Qiang_Zhang] Qiang Zhang mailto:qzhang&iwncomm.com 2006-10 -# [Qiang_Zhang_2] Qiang Zhang mailto:iad&iwncomm.com 2006-10 -# [Qualcomm_Innovation_Center] Qualcomm Innovation mailto:cdowell&quicinc.com 2011-12-21 -# Center, Inc. -# [Quang_Thoi] Quang Thoi mailto:quang_thoi&symantec.com 2006-11 -# [QuantuMatriX_Technologies] QuantuMatriX mailto:admin&qmxtech.com 2014-04-10 -# Technologies -# [Quentin_Brown] Quentin Brown mailto:ndldev&ndl.co.uk 2002-03 -# [Quentin_Glidic] Quentin Glidic mailto:sardemff7&eventd.org 2013-06-05 -# [Quest_Software] Quest Software mailto:iana.quest-disc&quest.com 2012-04-09 -# [Quest_Software_2] Quest Software mailto:Greg.Cottman&quest.com 2013-04-19 -# [Quinton_Tormanen] Quinton Tormanen mailto:quinton&deltacompsys.com -# [Qwizdom_Inc.] Qwizdom, Inc. mailto:matt&qwizdom.com 2015-09-21 -# [R_L_Meyering] R. L. Meyering mailto:RLMEYERING&biivax.dp.beckman.com -# [R_Thirumurthy] R. Thirumurthy mailto:rtm&banyannetworks.com -# [Rackspace_Hosting] Rackspace Hosting mailto:ziad.sawalha&rackspace.com 2011-08-15 -# [Radish_Systems] Radish Systems mailto:rad&radishsystems.com 2013-03-28 -# [Radware_LTD] Radware LTD. mailto:samuelb&radware.com 2011-08-05 -# [Rafael_Zimberoff] Rafael Zimberoff mailto:rafael&zfirmllc.com 2003-11 -# [Raghurama_Bhat] Raghurama Bhat mailto:raghu&quintus.com -# [Rahul_Bahadur] Rahul Bahadur Check Point Software mailto:rbahadur&checkpoint.com 2012-06-28 -# Technologies Ltd. -# [Rahul_Bansal] Rahul Bansal rtCamp Solutions mailto:rahul.bansal&rtcamp.com 2014-03-10 -# Private Limited -# [Raimond_Diederik] Raimond Diederik mailto:rdiederik&descartes.com -# [Rajeev_Verma] Rajeev Verma mailto:rajeev_verma&symantec.com 2006-02 -# [Rajesh_Akkineni] Rajesh Akkineni mailto:rajesh&vimukti.com 2007-01 -# [Rajesh_Batra] Rajesh Batra Western Digital Inc. mailto:rajesh.batra&wdc.com 2012-07-11 -# [Rajesh_D] Rajesh Davé mailto:rajdaveµsoft.com 2009-02-03 -# [Rajesh_Nandyalam] Rajesh Nandyalam mailto:rnandyal&emc.com -# [Rajesh_Srinivasaragh] Rajesh Srinivasaraghavan mailto:srajesh&cup.hp.com -# [Rajiv_Aaron_Manglani] Rajiv Aaron Manglani mailto:rajivmanglani&mmm.com -# [Rakesh_Mahajan] Rakesh Mahajan mailto:rmahajan&netaphor-software.com -# [Ralf_Allrutz] Ralf Allrutz mailto:R.Allrutz&science-computing.de 2002-02 -# [Ralf_Bensmann] Ralf Bensmann mailto:iana&1ci.de -# [Ralf_Doewich] Ralf Doewich mailto:ralf.doewich&optimatele.com -# [Ralf_Muckenhirn] Ralf Muckenhirn tel:+49-7622-3980 -# tel:+49-7622-398200 -# [Ralf_Schwarzer] Ralf Schwarzer mailto:ralf.schwarzer&sevenstax.de 2015-11-05 -# [Ralph_Campbell] Ralph Campbell mailto:ralph.campbell&xasystems.com 2002-11 -# [Ralph_Droms] Ralph Droms mailto:rdroms&nri.reston.va.us -# [Ralph_Kammerlander] Ralph Kammerlander mailto:ralph.kammerlander&khe.siemens.de -# [Ram_Golla] Ram Golla mailto:rgolla&cisco.com -# [Ram_Iyer] Ram Iyer mailto:ram&aaccorp.com -# [Ram_Sudama] Ram Sudama mailto:rsudama&on.com -# [Ramakrishna_Nadendla] Ramakrishna Nadendla mailto:rama_nadendla&agilent.com 2002-08 -# [Ramana_Kovi] Ramana Kovi mailto:ramana&kovi.com -# [Ramesh_Gupta] Ramesh Gupta mailto:ramesh&guptas.net 2012-02-21 -# [Rami_Rubin] Rami Rubin mailto:rami&hybrid.com -# [Ramindur_Singh] Ramindur Singh mailto:Ramindur.Singh&blackcrowsoftware.com 2008-12-04 -# [Ramiro_Sarmiento] Ramiro Sarmiento mailto:ramiro&kabira.com -# [Ramy_Zaarour] Ramy Zaarour mailto:ramy&lumos.com -# [Rancher_Labs_Inc] Rancher Labs, Inc. mailto:engineering&rancher.com 2015-04-14 -# [Ranchero_Software] Ranchero Software mailto:info&ranchero.com -# [Randall_Atkinson] Randall Atkinson mailto:rja&home.net -# [Randall_Atkinson_2] Randall Atkinson mailto:rja&inet.org -# [Randall_Dow] Randall Dow mailto:rand&randix.net -# [Randall_Gellens] Randall Gellens mailto:randy&qualcomm.com -# [Randall_Stewart] Randall Stewart IETF TSVWG mailto:rrs&lakerest.net -# [Randall_Stewart_2] Randall Stewart mailto:rrs&lakerest.net 2011-10-24 -# [Randy_Armstrong] Randy Armstrong mailto:randy.armstrong&opcfoundation.org 2006-09 -# [Randy_Cassidy] Randy Cassidy mailto:randy.cassidy&iracing.com 2007-08-30 -# [Randy_Davenport] Randy Davenport mailto:rdaven69&gmail.com 2014-03-04 -# [Randy_Epstein] Randy Epstein mailto:repstein&hostleasing.net -# [Randy_Hudgens] Randy Hudgens mailto:rhh&nmail.holditch.com -# [Randy_Leonard] Randy Leonard mailto:randy&oceansoft.com -# [Randy_Lomnes] Randy Lomnes mailto:rlomnes&faronics.com 2004-11 -# [Randy_Maas] Randy Maas mailto:randym&xiotech.com -# [Randy_Martin] Randy Martin mailto:exlmoc&clemson.edu -# [Randy_Thompson] Randy Thompson mailto:thompr&earthlink.net 2002-08 -# [Randy_Yates] Randy Yates Digital Signal Labs mailto:yates&digitalsignallabs.com 2014-11-26 -# [Raphael_Neve] Raphael Neve Microtec Informatique mailto:raphµtec.fr 2012-03-15 -# [Ralph_Greenwell] Ralph Greenwell mailto:iana&cognima.com 2012-03-15 -# [Ratnadeep_Bhattachar] Ratnadeep Bhattacharjee mailto:ratnadeep.bhattacharjee&sun.com 2002-11 -# [Ravi_Gokhale] Ravi Gokhale mailto:rgokhale&bindview.com 2002-10 -# [Ravi_Kollipara] Ravi Kollipara mailto:ravi.kollipara&actifio.com 2010-06-18 -# [Ravi_Tavakely] Ravi Tavakely mailto:ravi.tavakley&veritas.com 2002-02 -# [Ray_Caruso] Ray Caruso mailto:ray.caruso&netvion.com 2002-06 -# [Ray_Gwinn] Ray Gwinn mailto:p00321&psilink.com -# [Ray_Jantz] Ray Jantz mailto:ray.jantz&lsil.com -# [Ray_Ozzie] Ray Ozzie mailto:ray&rocks.net -# [Rayan_Zachariassen] Rayan Zachariassen mailto:rayan&ai.toronto.edu -# [Raymarine_UK_Limited] Raymarine UK Limited mailto:Geoff.Beer&raymarine.com 2012-05-24 -# [Raymond_A_Diedrichs] Raymond A. Diedrichs mailto:rayd&slu.tr.unisys.com -# [Raymond_Chaw] Raymond Chaw mailto:Raymond&esecutech.com 2007-05 -# [Raymond_J_Young] Raymond J. Young mailto:Raymond.Young&ca.com 2002-04 -# [Razmik_Abnous] Razmik Abnous mailto:abnous&documentum.com -# [RealNetworks] RealNetworks mailto:macplayer&real.com -# [ReadyTech_Corporation] ReadyTech Corporation mailto:kwoodward&readytech.com 2013-09-13 -# [RecoLive_Sàrl] RecoLive Sàrl mailto:recoinfo&recolive.com 2012-09-07 -# [Red_Lion_Controls] Red Lion Controls mailto:Engineering&RedLion.net 2014-05-21 -# [Redspeed_International_Ltd] Redspeed mailto:simon.griffiths&redspeed-int.com 2015-03-10 -# International Ltd -# [Reed_Copsey_Jr] Reed Copsey Jr. mailto:reedc&ctech.com -# [Reed_Hedges] Reed Hedges mailto:reed&interreality.org -# Regents of the -# [Regents_of_the_University_of_California] University of mailto:jburke&remap.ucla.edu 2013-10-30 -# California -# [Rehan_Mahmood] Rehan Mahmood mailto:rehan&matrixmultimedia.co.uk 2009-03-18 -# [Reid_B_Ligon] Reid B. Ligon mailto:Reid.Ligon&datalogic.com 2014-07-31 -# [Reid_Ligon] Reid Ligon mailto:reid&connectrf.com -# [Reinhard_Doelz] Reinhard Doelz mailto:doelz&comp.bioz.unibas.ch -# [Reinhard_Wolf] Reinhard Wolf Adsoft AG mailto:adsoft&vtxmail.ch 2010-08-19 -# [Reinier_Post_and_Pau] Reinier Post and Paul mailto:freeciv&freeciv.org 2006-01 -# Zastoupil -# [Remi_Lefebvre] Remi Lefebvre mailto:remi&debian.org -# [Rene_Fontaine] Rene Fontaine mailto:fontaine_rene&emc.com -# [Rene_Jager] Rene Jager mailto:renej&frog.nl -# [Rene_Kurt] Rene Kurt mailto:rene.kurt&adasoft.ch 2005-08 -# [Reprise_Software_Inc] Reprise Software, mailto:matt&reprisesoftware.com 2012-11-06 -# Inc. -# [Research_Electronics_International] Research Electronics mailto:software&reiusa.net 2012-12-20 -# International -# [Resource_Allocation] Resource Allocation Team mailto:resources&littlehall.com 2010-09-27 -# [Retrospect_Inc] Retrospect, Inc. mailto:JG.Heithcock&retrospect.com 2012-02-02 -# [Reuven_Harrison] Reuven Harrison mailto:rnd_ana&checkpoint.com -# [Reuven_Harrison_2] Reuven Harrison mailto:rharrison&checkpoint.com 2003-01 -# [Reyk_Floeter] Reyk Floeter mailto:reyk&vantronix.net 2008-02-27 -# [Reza_Bagherian] Reza Bagherian mailto:bagherian_reza&emc.com 2007-07-19 -# [RGB_Spectrum] RGB Spectrum mailto:shershey&rgb.com 2011-10-10 -# [Riaz_Zolfonoon] Riaz Zolfonoon mailto:rzolfonoon&securitydynamics.com -# [Riccardo_Facchetti] Riccardo Facchetti mailto:riccardo&inetcosmos.org 2002-07 -# [Rich_Blomseth] Rich Blomseth mailto:rich&echelon.com -# [Rich_Kilmer] Rich Kilmer mailto:rich&infoether.com -# [Rich_Neswold] Rich Neswold mailto:neswold&fnal.gov 2007-02 -# [Rich_Thompson] Rich Thompson mailto:richt&watson.ibm.com -# [Richard_A_Davis] Richard A. Davis Radish Systems mailto:rad&radishsystems.com 2013-03-28 -# [Richard_Alan_Johnson] Richard Alan Johnson mailto:raj&cisco.com -# [Richard_Bassous] Richard Bassous mailto:rbassous&yahoo.com -# [Richard_Corn] Richard Corn mailto:rac&racc.com -# [Richard_Dickins] Richard Dickins mailto:rad&specview.com 2002-02 -# [Richard_Farnham] Richard Farnham mailto:rfarnham&salient.com -# [Richard_Fife] Richard Fife mailto:richardf&lucasarts.com -# [Richard_Fleming] Richard Fleming mailto:richard&apoapsis.com 2002-08 -# [Richard_Foss] Richard Foss mailto:r.foss&ru.ac.za 2011-02-10 -# [Richard_Frith_Macdon] Richard Frith-Macdonald mailto:richard&brainstorm.co.uk -# [Richard_Harriss] Richard Harriss mailto:richard.harriss&halcyonsoftware.com 2005-05 -# [Richard_Harwell] Richard Harwell mailto:richardcharwell&eaton.com 2006-02 -# [Richard_Hodges] Richard Hodges mailto:rh&matriplex.com -# [Richard_Hodges_2] Richard Hodges mailto:rh&source.net -# [Richard_Hodges_3] Richard Hodges mailto:rhodges&prismiq.com 2003-01 -# [Richard_J_Williams] Richard J. Williams mailto:RJW1&trpo4.tr.unisys.com -# [Richard_Jones] Richard Jones -# [Richard_Jones_2] Richard Jones mailto:richard_jones1&symantec.com 2009-05-26 -# [Richard_Lamb] Richard Lamb mailto:rlambµsoft.com -# [Richard_McDonald] Richard McDonald mailto:ve3nvm&spamcop.net 2006-01 -# [Richard_Mills] Richard Mills mailto:ramills&us.ibm.com 2002-02 -# [Richard_Minner] Richard Minner http://xippix.com -# [Richard_Nabavi] Richard Nabavi mailto:nabaviµapl.co.uk 2006-02 -# [Richard_Offer] Richard Offer HotLink Corporation mailto:roffer&hotlink.com 2014-12-18 -# [Richard_Olsen] Richard Olsen mailto:olsen.richard&yahoo.com -# [Richard_S_Conto] Richard S. Conto mailto:rsc&merit.edu -# [Richard_Snider] Richard Snider mailto:rsnider&sounds.com -# [Richard_Spartz] Richard Spartz mailto:rspartz&alliancetechnical.com -# [Richard_Steiger] Richard Steiger mailto:steiger&ensemblesoft.com -# [Richard_Thompson] Richard Thompson Braemar Consulting mailto:richardt&braemardrive.com 2014-03-05 -# [Richard_Thurman] Richard Thurman mailto:richt&fireking.com 2003-04 -# [Richard_Walters] Richard Walters mailto:walters&cs.ucdavis.edu -# [Richard_Warren] Richard Warren mailto:richard&cambridgepixel.com 2008-09-17 -# [Richard_de_Mornay] Richard de Mornay mailto:rdemornay&norton-lambert.com -# [Rick_Adams] Rick Adams mailto:rick&uunet.uu.net -# [Rick_Carlos] Rick Carlos mailto:rick&ticipa.csc.ti.com -# [rick_jones] Rick Jones mailto:perfgeek&mac.com 2013-04-05 -# [Rick_LaBanca] Rick LaBanca mailto:rel&mesasys.com -# [Rick_Macchio] Rick Macchio mailto:rmacchio&juniper.net 2006-11 -# [Rick_Pugh] Rick Pugh mailto:rick&bilmillennium.com -# [Rick_Russell] Rick Russell mailto:rrussell&accessdata.com -# [Rick_Stefanik] Rick Stefanik mailto:r.stefanik&gatelinx.com 2002-05 -# [Rick_Troth] Rick Troth mailto:troth&rice.edu -# [Rick_Yazwinski] Rick Yazwinski mailto:ricky&solect.com -# [Rickard_Schoultz] Rickard Schoultz mailto:schoultz&sunet.se -# [Ricky_Sharp] Ricky Sharp mailto:rsharp&instantinteractive.com -# [Rieko_Asai] Rieko Asai mailto:asai&isl.mei.co.jp -# [Rik_Ditter] Rik Ditter mailto:managers&generationtechnologies.com 2006-02 -# [Rik_Faith] Rik Faith mailto:faith&cs.unc.edu -# [Rina_Nethaniel] Rina Nethaniel -# [Ripplex_Inc] Ripplex Inc. mailto:gucam&ripplex.com 2013-03-04 -# [Ritsuto_Sako] Ritsuto Sako mailto:sakou.ritsuto&canon.co.jp 2009-05-04 -# [Ritu_Bahl] Ritu Bahl mailto:ritubµsoft.com -# [Rituparna_Agrawal] Rituparna Agrawal mailto:riagrawa&cisco.com 2005-09 -# [Roambotics_Inc] Roambotics, Inc. mailto:iana&roambotics.com 2013-10-18 -# [Rob_Bradford] Rob Bradford mailto:rob&o-hand.com -# [Rob_Chandhok] Rob Chandhok mailto:chandhok&gnome.cs.cmu.edu -# [Rob_Chandhok_2] Rob Chandhok mailto:chandhok&within.com -# [Rob_Cosgrove] Rob Cosgrove mailto:rob&alice.net -# [Rob_Graber] Rob Graber mailto:r.graber&austinlane.com 2006-01 -# [Rob_Griffin] Rob Griffin mailto:quest_iana&oz.quest.com 2002-07 -# [Rob_Griffin_2] Rob Griffin mailto:rob.gri55in&gmail.com 2010-09-13 -# [Rob_Griffin_3] Rob Griffin Dell mailto:rob.gri55in&gmail.com 2013-10-03 -# [Rob_Isaac] Rob Isaac mailto:rob&automagic.org 2003-07 -# [Rob_Janssen] Rob Janssen mailto:rob&sys3.pe1chl.ampr.org -# [Rob_Jonson] Rob Jonson mailto:rob&hobbyistsoftware.com -# [Rob_Juergens] Rob Juergens mailto:robj&vsi.com -# [Rob_Lanphier] Rob Lanphier mailto:robla&prognet.com -# [Rob_Lehew] Rob Lehew mailto:rlehewµsoft.com 2003-06 -# [Rob_Lockhart] Rob Lockhart mailto:rob.lockhart&mot.com -# [Rob_MacGregor] Rob MacGregor mailto:rob.macgregor&sympatico.ca -# [Rob_Minerick] Rob Minerick mailto:rob&vortimac.com 2004-11 -# [Rob_Newberry] Rob Newberry mailto:rnewberry&apple.com -# [Rob_Rix] Rob Rix DEVONtechnologies, mailto:rrix&devontechnologies.com 2011-10-18 -# LLC -# [Rob_Robertson] Rob Robertson mailto:rob&gangrene.berkeley.edu -# [Rob_Scott] Rob Scott mailto:rscott&rs.com 2007-05 -# [Rob_Tao] Rob Tao SafeNet mailto:rtao&safenet-inc.com 2012-07-26 -# [Rob_Versluis] Rob Versluis mailto:r.j.versluis&rocrail.net 2011-05-23 -# [Rob_Ward] Rob Ward mailto:RobWardµsoft.com 2008-05-02 -# [Rob_Williams] Rob Williams mailto:rob.williamsµsoft.com 2009-02-17 -# [Robby_Simpson] Robby Simpson, PhD mailto:rsimpson&gmail.com -# [Robby_Walker] Robby Walker mailto:webmaster&cd-lab.com -# [Robert_A_Kukura] Robert A. Kukura mailto:kukura&apollo.hp.com -# [Robert_Armes] Robert Armes mailto:rarmes&axarte.com -# [Robert_Armington] Robert Armington mailto:rarmington&lipsinc.com -# [Robert_Baldwin] Robert Baldwin mailto:baldwin&plusfive.com 2004-11 -# [Robert_Ball] Robert Ball mailto:rob.ball&ge.com 2008-03-26 -# [Robert_Banfill] Robert Banfill mailto:robert&banfill.net 2003-04 -# [Robert_Bosch_GmbH] Robert Bosch GmbH mailto:Klaus.Warth&bosch.com 2012-07-17 -# [Robert_Boudrie] Robert Boudrie mailto:boudrie_rob&emc.com 2008-06-09 -# [Robert_Byrne] Robert Byrne mailto:robert.byrne&ie.abb.com 2006-09 -# [Robert_C_Henningsga] Robert C. Henningsgard mailto:rhenn_iana&laptwo.com -# [Robert_Ciochon] Robert Ciochon mailto:robert.ciochon&ca.com 2006-08 -# [Robert_D_Vincent] Robert D. Vincent mailto:bert&willowpond.com -# [Robert_Diamond] Robert Diamond mailto:rmd6502&gmail.com 2012-07-06 -# [Robert_Dye] Robert Dye mailto:rob&natinst.com -# [Robert_E_Johnson_II] Robert E. Johnson III mailto:johnson.robert&cimcor.com 2003-04 -# [Robert_E_Minnear] Robert E. Minnear mailto:minnear&ipsilon.com -# [Robert_Eden] Robert Eden mailto:reden&sieglertech.com 2003-03 -# [Robert_Ellman] Robert Ellman mailto:rellman&calicotech.com -# [Robert_Erl] Robert Erl mailto:roerl&web.de 2003-04 -# [Robert_Ford] Robert Ford mailto:robert&intrinsa.com -# [Robert_Frazier] Robert Frazier mailto:BobF&mrp3.com -# [Robert_Friberg] Robert Friberg Devrex Labs mailto:robert.friberg&devrex.se 2013-03-29 -# [Robert_Goodyear] Robert Goodyear mailto:robg&brand-up.com -# [Robert_Gordon] Robert Gordon mailto:rbg&austin.ibm.com -# [Robert_Grant] Robert Grant mailto:rob&grantedsw.com -# [Robert_Harvey] Robert Harvey mailto:robert&officetoolspro.com 2006-01 -# [Robert_Helton] Robert Helton mailto:bob_helton&medimage.com 2003-10 -# [Robert_Hodgson] Robert Hodgson mailto:rrh&gxt.com -# [Robert_Hodgson_2] Robert Hodgson mailto:robert¶tek.co.uk -# [Robert_Hufsky] Robert Hufsky mailto:rhufsky&csesys.co.at -# [Robert_J_Chansler] Robert J. Chansler mailto:robert.chansler&mcdata.com -# [Robert_J_Scott] Robert J. Scott mailto:rob&hpcmo.hpc.mil 2005-08 -# [Robert_John_Churchil] Robert John Churchill mailto:rjc&rjcdb.com 2006-01 -# [Robert_Kevin_Breton] Robert Kevin Breton mailto:BOBBRETON&hotmail.com -# [Robert_M_Mackowiak] Robert M. Mackowiak mailto:rmackowiak&quest.com 2002-02 -# [Robert_M_Moore] Robert M. Moore mailto:robert.moore&tunstall.co.uk -# [Robert_Marinelli] Robert Marinelli mailto:bob&sychron.com 2003-03 -# [Robert_Monat] Robert Monat mailto:jerand&jerand.com -# [Robert_Moore] Robert Moore Tunstall Healthcare mailto:robert.moore&tunstall.com 2014-12-10 -# (UK) Ltd. -# [Robert_Orr] Robert Orr mailto:rorr&teltone.com -# [Robert_Parks] Robert Parks mailto:robert_parks&filemaker.com 2010-05-12 -# [Robert_Porter] Robert Porter mailto:rob&gradecam.com 2009-09-24 -# [Robert_Reimiller] Robert Reimiller mailto:bob&certsoft.com -# [Robert_Ripberger] Robert Ripberger mailto:rip&lan-aces.com -# [Robert_Shaffer] Robert Shaffer mailto:bob.shaffer&micmod.com 2006-02 -# [Robert_Stabl] Robert Stabl mailto:stabl&informatik.uni-muenchen.de -# [Robert_Thomas] Robert Thomas mailto:BThomas&f.bbn.com -# [Robert_Ullmann] Robert Ullmann mailto:ariel&world.std.com -# [Robert_Ullmann_2] Robert Ullmann mailto:Robert_Ullmann/CAM/Lotus.LOTUS@crd.lotus.com -# [Robert_Vincent] Robert Vincent mailto:bert&mck.com -# [Robert_W_Hodges] Robert W Hodges mailto:iana&precdata.com 2005-01 -# [Robert_W_Scheifler] Robert W. Scheifler mailto:RWS&xx.lcs.mit.edu -# [Robert_Waters] Robert Waters mailto:bobtek&hotmail.com -# [Robert_Watson] Robert Watson mailto:robert&cyrus.watson.org -# [Robert_Wetzold] Robert Wetzold mailto:robert.wetzold&fibotrader.com 2006-01 -# [Robert_Wiebe] Robert Wiebe mailto:crw010&email.mot.com -# [Robert_Wright] Robert Wright, Founder Audio Precision Inc. mailto:ianaports&ap.com 2006-05 -# and Principal Engineer -# [Robert_Zuccherato] Robert Zuccherato mailto:robert.zuccherato&entrust.com -# [Roberto_De_Ioris] Roberto De Ioris mailto:info&unbit.it -# [Roberto_Garcia] Roberto Garcia mailto:garcia&apple.com -# [Roberto_Jorge_Dino] Roberto Jorge Dino mailto:roberto.dino&autotrac.com.br -# [Robin_Cover] Robin Cover OASIS KMIP Technical mailto:robin&oasis-open.org 2011-07-25 -# Committee -# [Robin_Felix] Robin Felix mailto:ryfelix&yahoo.com 2014-02-17 -# [Robin_Findley] Robin Findley mailto:rfindley&usa.net 2007-05 -# [Robin_Giese] Robin Giese mailto:rgiese&peddie.org -# [Robin_Johnston] Robin Johnston mailto:robinj&learningtree.com -# [Robin_Kar] Robin Kar mailto:Robin_Kar&ccm.hf.intel.com -# [Robin_Lewis] Robin Lewis mailto:robin.lewis&lanyon.com -# [Robin_Perkins] Robin Perkins mailto:robin.perkins&internode.on.net -# [Robin_Uyeshiro] Robin Uyeshiro mailto:robin_u&adtech-inc.com -# [Rod_Waltermann] Rod Waltermann mailto:walterma&us.lenovo.com 2006-02 -# [Rod_Ward] Rod Ward mailto:RWard&vaccmel1.telstra.com.au -# [Roderick_Mann] Roderick Mann mailto:rmann&latencyzero.com 2011-10-20 -# [Rodney_Iwashina] Rodney Iwashina mailto:rodney&cyclone.rfx.com -# [Rodrigo_Ormonde] Rodrigo Ormonde mailto:ormonde&aker.com.br -# [Rodrigo_Terra] Rodrigo Terra Lumis mailto:rterra&lumis.com.br 2011-10-24 -# [Roel_Harbers] Roel Harbers mailto:r.harbers&ict-control.com 2005-08 -# [Roger_Binns] Roger Binns mailto:rogerb&sco.com -# [Roger_Huebner] Roger Huebner mailto:iana-ports&netiq.com 2010-08-25 -# [Roger_Kay] Roger Kay mailto:r.kay&nz.dialogic.com -# [Roger_Klorese] Roger Klorese mailto:roger&xensource.com 2006-06 -# [Roger_Knobbe] Roger Knobbe mailto:RogerK&wonderware.com -# [Roger_Kumpf] Roger Kumpf mailto:kumpf&cup.hp.com -# [Roger_Lemberg] Roger Lemberg mailto:rlemberg&uswi.com -# [Roger_Matthias] Roger Matthias mailto:rogermatthias&yahoo.co.uk 2009-08-24 -# [Roger_Meli] Roger Meli mailto:rmmeli%25winvmd@vnet.ibm.com -# [Roger_Pantos] Roger Pantos mailto:rpantos&apple.com -# [Roger_Pao] Roger Pao mailto:rpao&corder-eng.com -# [Roger_Ward] Roger Ward mailto:roger.ward&ger911.com 2009-09-25 -# [Rogue_Amoeba] Rogue Amoeba mailto:earphoria&rogueamoeba.com -# [Rogue_Amoeba_2] Rogue Amoeba mailto:nicecast&rogueamoeba.com -# [Rohan_Story] Rohan Story mailto:rohan&aurema.com -# [Rohit_Garg] Rohit Garg mailto:rohit.garg&eng.sun.com -# [Rohit_Garg_2] Rohit Garg mailto:rohit&objectscape.com -# [Rohith_Ramkumar] Rohith Ramkumar Citrix Systems mailto:CloudBridge-PM&citrix.com 2015-04-17 -# [Roland_Hedberg] Roland Hedberg mailto:Roland.Hedberg&umdac.umu.se -# [Roland_Hedberg_2] Roland Hedberg mailto:roland&catalogix.se 2005-08 -# [Roland_Rupp] Roland Rupp mailto:r.rupp&pilz.de 2006-11 -# [Roland_Schneider] Roland Schneider mailto:rsch&nicherms.com 2003-10 -# [Roland_van_der_Veen] Roland van der Veen mailto:rvdveen&aqualectra.nl 2010-06-17 -# [Roman_Kriis] Roman Kriis mailto:roman&previo.ee -# [Roman_Oliynyk] Roman Oliynyk mailto:romano&netinst.com -# [Roman_Oliynyk_2] Roman Oliynyk mailto:roman&netinst.com 2007-08-30 -# [Roman_Å tÄ›pánek] Roman Å tÄ›pánek SODATSW spol. s r.o. mailto:roman.stepanek&sodatsw.cz 2012-05-31 -# [Romeo_Kasanwidjojo] Romeo Kasanwidjojo mailto:romeoµcomgroup.com -# [Ron_Achin] Ron Achin mailto:RAchin&genscan.com -# [Ron_Barber] Ron Barber mailto:ron.barber&amx.com 2003-11 -# [Ron_Capwell] Ron Capwell mailto:ron&artifactsoftware.com 2002-06 -# [Ron_Ehli] Ron Ehli mailto:ron&itinternet.net -# [Ron_Folk] Ron Folk mailto:rfolkes&avl.com -# [Ron_Frederick] Ron Frederick mailto:frederick&parc.xerox.com -# [Ron_Herardian] Ron Herardian mailto:rherardi&gssnet.com 2002-03 -# [Ron_Kuris] Ron Kuris mailto:rk&unify.com 2006-05 -# [Ron_Lawson] Ron Lawson mailto:ronaldl&hpindacx.cup.hp.com -# [Ron_Lussier] Ron Lussier mailto:coyote&likeminds.com -# [Ron_Minnich] Ron Minnich mailto:rminnich&acl.lanl.gov -# [Ron_Minnich_2] Ron Minnich mailto:rminnich&sarnoff.com -# [Ron_Muellerschoen] Ron Muellerschoen mailto:rjm&cobra.jpl.nasa.gov -# [Ron_Passerini] Ron Passerini mailto:rpasserini&vmware.com 2010-04-27 -# [Ron_Steed] Ron Steed mailto:rsteed&cemaphore.com 2003-11 -# [Ron_Thornton] Ron Thornton mailto:thornton&qm7501.genrad.com -# [Ron_Vaughn] Ron Vaughn mailto:rv&intellistor.com -# [Ron_Zalkind] Ron Zalkind mailto:ron&aprigo.com 2010-05-28 -# [Ron_Zuckerman] Ron Zuckerman mailto:ron.zuckerman&lsi.com 2007-08-30 -# [Ronald_Jimmink] Ronald Jimmink mailto:Ronald.Jimmink&chipper.nl -# [Ronald_R_Ohmer] Ronald R. Ohmer mailto:rohmer&aisconsulting.net 2004-02 -# [Ronald_Snyder] Ronald Snyder mailto:pugaroni&sssnet.com 2006-03 -# [Ronen_Shaul] Ronen Shaul mailto:ronen&arnetsystems.com 2003-10 -# [Ronen_Vainish] Ronen Vainish mailto:ronen&digitalfountain.com -# [Ronen_Zoran] Ronen Zoran mailto:ronenz&cyber-ark.com -# [Rong_Yu] Rong Yu mailto:rongyuµsoft.com 2010-08-10 -# [Roni_Even] Roni Even mailto:roni_e&accord.co.il -# [Roni_Moshitzky] Roni Moshitzky mailto:rmosh&checkpoint.com -# [Ronnie_De_Giorgio] Ronnie De Giorgio Silverstring Ltd. mailto:rdegiorgio&silverstring.com 2011-09-15 -# [Ronnie_Sahlberg] Ronnie Sahlberg mailto:ronniesahlberg&gmail.com 2007-07-05 -# [Ronny_Bremer] Ronny Bremer mailto:rbremer&almanid.com -# [Rory_McClure] Rory McClure mailto:mcclurert&hotmail.com -# [Rory_McGuire] Rory McGuire mailto:rlpm&apple.com 2010-09-24 -# [Rory_McGuire_2] Rory McGuire mailto:rlpm&apple.com -# [Ross_Binkley] Ross Binkley Research Electronics mailto:software&reiusa.net 2012-12-20 -# International -# [Ross_E_Greinke] Ross E. Greinke mailto:greinker&execpc.com -# [Ross_Swithenbank] Ross Swithenbank mailto:iana&ncode.co.uk 2006-09 -# [Ross_Williams] Ross Williams mailto:ross&rocksoft.com -# [Roustem_Karimov] Roustem Karimov mailto:roustem&agilewebsolutions.com -# [Rowan_Daniell] Rowan Daniell mailto:rowan&cognito.co.nz -# [Roy_Chastain] Roy Chastain mailto:roy&kmsys.com -# [Roy_Davies] Roy Davies mailto:rdavies&daq.net 2005-08 -# [Roy_Reapor] Roy Reapor mailto:rreapor&wyatt.com -# [Royal_King] Royal King mailto:royal.king&compaq.com 2002-02 -# [rtCamp_Solutions_Private_Limited] rtCamp Solutions mailto:admin&rtcamp.com 2014-03-10 -# Private Limited -# [Ruben_Beltran] Ruben Beltran del Rio www.nsovocal.com mailto:ben&nsovocal.com 2011-10-18 -# [Ruben_Beltran_del_Rio_2] Ruben Beltran del Rio Freshout mailto:ben&freshout.us 2014-04-14 -# [Rudi_Chiarito] Rudi Chiarito mailto:nutello&sweetness.com -# [Rudi_Martin] Rudi Martin mailto:movies::martin%22@movies.enet.dec.com -# [Rudi_Martin_2] Rudi Martin mailto:Rudi.Martin&edo.mts.dec.com -# [Rudi_Visser] Rudi Visser mailto:rudi.visser&ljund.eu 2011-07-07 -# [Rudolf_Cardinal] Rudolf Cardinal mailto:rudolf&pobox.com 2002-02 -# [Rudolph_Balaz] Rudolph Balaz mailto:rudolphbµsoft.com -# [Ruediger_Wald] Ruediger Wald mailto:wald&ez-darmstadt.telekom.de -# [Rumiko_Kikuta] Rumiko Kikuta mailto:kiku&nd.net.fujitsu.co.jp -# [Russ_Allbery] Russ Allbery mailto:rra&stanford.edu 2007-08-30 -# [Russ_Ferriday] Russ Ferriday mailto:russf&topia.com -# [Russ_Olivant] Russ Olivant mailto:russ.olivant&metrica.co.uk -# [Russ_Thrasher] Russ Thrasher mailto:Russell.Thrasher&veritas.com -# [Russell_Crook] Russell Crook mailto:rmc&sni.ca -# [Russell_Kroll] Russell Kroll mailto:nut-iana&exploits.org 2002-05 -# [Russell_M_Taylor_II] Russell M. Taylor II mailto:taylor&cs.unc.edu 2003-10 -# [Russell_P_Holsclaw] Russell P. Holsclaw Fast Data Technology mailto:rholsclaw&fastdatatech.com 2006-03 -# Inc. -# [Russell_Thrasher] Russell Thrasher mailto:rthrashe&veritas.com -# [Ruth_Slater] Ruth Slater mailto:ruth.slater&ideagen.co.uk -# [Ruwan_Linton] Ruwan Linton mailto:ruwan&wso2.com 2008-08-20 -# [Rx_Networks_Inc] Rx Networks Inc. mailto:ddavies&rxnetworks.com 2013-01-24 -# [Rx_Networks_Inc_2] Rx Networks Inc. mailto:ddavies&rxnetworks.com 2013-04-25 -# [Ryan_Bolz] Ryan Bolz mailto:ryanboµsoft.com -# [Ryan_Columbus] Ryan Columbus mailto:IANA_Contact&agilent.com 2002-10 -# [Ryan_Finnie] Ryan Finnie mailto:ryan&finnie.org 2010-10-06 -# [Ryan_Mack] Ryan Mack mailto:rmackµsoft.com 2009-04-29 -# [Ryan_Melville] Ryan Melville mailto:ryan_melville&soniqcast.com 2004-01 -# [Ryan_Rubley] Ryan Rubley mailto:root&ark.dyn.ml.org -# [Ryan_Smith] Ryan Smith mailto:ryans&nstor.com 2006-07 -# [Ryan_Werber] Ryan Werber mailto:ryan&ncxti.com 2006-06 -# [Ryoichi_Shinohara] Ryoichi Shinohara mailto:shinohara&vnet.ibm.com -# [Ryozo_Furutani] Ryozo Furutani mailto:furutani&np.lps.cs.fujitsu.co.jp -# [Ryuichi_Horie] Ryuichi Horie mailto:horie&spad.sysrap.cs.fujitsu.co.jp -# [Ryuichi_Suzuki] Ryuichi Suzuki mailto:SCI00376&niftyserve.or.jp -# [Ryusuke_Okuhara] Ryusuke Okuhara Canon Inc. mailto:okuhara.ryuusuke&canon.co.jp 2012-06-08 -# [Salvatore_Sanfilippo] Salvatore Sanfilippo mailto:antirez&gmail.com 2015-04-23 -# [Samsung] Samsung mailto:rcn95&samsung.com 2013-01-03 -# [Samsung_2] Samsung mailto:young.ki.kim&samsung.com 2013-05-29 -# SEGGER -# [SEGGER] Microcontroller GmbH mailto:info&segger.com 2009-01-16 -# & Co. KG -# [SEIKO_EPSON] SEIKO EPSON mailto:APD.admin&exc.epson.co.jp 2006-06 -# [SEIKO_EPSON_2] SEIKO EPSON mailto:Ishida.Hitoshi&exc.epson.co.jp -# [SEIKO_EPSON_3] SEIKO EPSON mailto:Sato.Minoru3&exc.epson.co.jp 2002-10 -# [SEIKO_EPSON_4] SEIKO EPSON mailto:ProjectorSoft&exc.epson.co.jp 2008-11-17 -# [SGI] SGI mailto:jsygulla&sgi.com 2013-01-07 -# [SMA_Solar_Techology] SMA Solar Techology AG mailto:thomas.weber&sma.de 2011-03-08 -# [SONET_Internetworkin] SONET Internetworking mailto:bwarijsman&lucent.com -# Forum (SIF) -# [SYSTEMS_MANAGER] SYSTEMS MANAGER mailto:systems-manager&scientia.com -# [Saar_Wilf] Saar Wilf mailto:saar&trivnet.com -# [Sabri_Berisha] Sabri Berisha mailto:sabri&cluecentral.net 2003-06 -# [Sabu_Das] Sabu Das mailto:sabud&zicomsecure.com 2003-06 -# [Sachin_Desai] Sachin Desai mailto:sachin&clairmail.com -# [Sachin_Sheth] Sachin Sheth Microsoft Corporation mailto:sachinsµsoft.com 2012-06-27 -# [SafeNet] SafeNet mailto:rtao&safenet-inc.com 2012-07-26 -# [Safenet_Inc.] Safenet Inc. mailto:michael.zunke&safenet-inc.com 2014-07-02 -# [Sagar_Soni] Sagar Soni Cisco Systems mailto:sagsoni&cisco.com 2014-02-20 -# [Sagara_Wijetunga] Sagara Wijetunga Tomahawk Holdings Ltd mailto:sagara&tomahawk.lk 2013-05-01 -# [Sage_Weil] Sage Weil mailto:sage&newdream.net 2015-06-29 -# [Sailalong_Software] Sailalong Software mailto:CustomerService&sailalong.com -# [Salvo_Nassisi] Salvo Nassisi mailto:sdtech&tin.it -# [Sam_Borman] Sam Borman mailto:sam_borman&uk.ibm.com -# [Sam_Bretheim] Sam Bretheim mailto:info&opensigint.org 2009-01-08 -# [Sam_Carleton] Sam Carleton mailto:scarleton&miltonstreet.com -# [Sam_Carleton_2] Sam Carleton AccuMed Services mailto:scarleton&accu-med.com 2011-10-20 -# [Sam_Osa] Sam Osa mailto:pristine&mailcity.com -# [Sam_Vaughan] Sam Vaughan mailto:samv&blackmagic-design.com 2011-03-01 -# [Sameer_Deokule] Sameer Deokule mailto:sameer.deokule&veritas.com 2002-03 -# [Samppa_Lahtinen] Samppa Lahtinen mailto:samppa.lahtinen&motivesys.com 2004-06 -# [Samuel_Bercovici] Samuel Bercovici mailto:samuelb&radware.com 2011-08-05 -# [Samuel_Jero] Samuel Jero mailto:sj323707&ohio.edu 2012-11-14 -# [Samuele_Sequi] Samuele Sequi mailto:samuelesequi&defcom.it 2004-02 -# [Sanchaita_Datta] Sanchaita Datta mailto:sdatta&ragula.com -# [Sancho_Lerena] Sancho Lerena mailto:slerena&artica.es 2009-06-02 -# [Sandeep_K_Singhal] Sandeep K. Singhal mailto:singhal&cs.stanford.edu -# [Sandeep_Singhal] Sandeep Singhal mailto:sandeep&reefedge.com -# [Sandra_Frulloni] Sandra Frulloni mailto:frulloni.amtec&interbusiness.it -# [Sandra_Vargas] Sandra Vargas mailto:Sandramaµsoft.com 2003-03 -# [Sandy_Kronenberg] Sandy Kronenberg mailto:sandy&netarx.com 2008-04-03 -# [Sanford_Selznick] Sanford Selznick mailto:sanford-srvtype&selznick.com -# [Sanjay_Parekh] Sanjay Parekh mailto:spot&digitalenvoy.net -# [Sanjay_Radia] Sanjay Radia mailto:srradia&kasumbi.eng.sun.com -# [Santa_Dasu] Santa Dasu mailto:Santa_Dasu&quickeagle.com -# [Santo_Porpiglia] Santo Porpiglia mailto:sonnyporpiglia&gmail.com 2015-05-28 -# [Santorini_LLC] Santorini, LLC mailto:cameron&santorinillc.com 2011-10-25 -# [Sarah_Allen] Sarah Allen mailto:sallen¯omedia.com -# [Sarah_Thompson] Sarah Thompson mailto:sarah&telergy.com -# [Sarene_Caiazza] Sarene Caiazza mailto:scaiazza&proquesys.com 2010-04-27 -# [Sascha_Kuemmel] Sascha Kuemmel mailto:kuemmel&vidsoft.de -# [Satoshi_Matsumoto] Satoshi Matsumoto mailto:satoshi&artman21.co.jp -# [Saugata_Guha] Saugata Guha mailto:sguha&veritas.com 2004-05 -# [Schindler_Aufzuege_ag] Schindler Aufzuege ag mailto:arno.odermatt&ch.schindler.com 2015-04-30 -# [Scott_A_Kramer] Scott A. Kramer mailto:sk&tleilaxu.sde.hp.com -# [Scott_Anderson] Scott Anderson mailto:sanderso&workingmachines.com -# [Scott_Bellew] Scott Bellew mailto:smb&cs.purdue.edu -# [Scott_Blachowicz] Scott Blachowicz mailto:scott&statsci.com -# [Scott_Dale] Scott Dale mailto:scott&replicase.com -# [Scott_Dale_2] Scott Dale mailto:scott&tioga.com -# [Scott_Dawson] Scott Dawson mailto:sdawson&arbor.net 2011-07-01 -# [Scott_Engel] Scott Engel mailto:ScottX_Engel&ccm.jf.intel.com -# [Scott_Godlew] Scott Godlew mailto:Scott&godlew.com -# [Scott_Grau] Scott Grau mailto:sgrau&stonefalls.com -# [Scott_Griepentrog] Scott Griepentrog mailto:griepentrogs&atlinks.com 2002-10 -# [Scott_Guthery] Scott Guthery mailto:sguthery&mobile-mind.com 2002-05 -# [Scott_Guthery_2] Scott Guthery mailto:sguthery&hidcorp.com 2008-08-25 -# [Scott_Halberg] Scott Halberg mailto:eng&calypsosystems.com 2009-06-02 -# [Scott_Harris] Scott Harris mailto:Scott&xramp.com 2003-02 -# [Scott_Herscher] Scott Herscher mailto:scott&porchdogsoft.com 2005-08 -# [Scott_Herscher_2] Scott Herscher mailto:scott&strixsystems.com -# [Scott_Hollenbeck] Scott Hollenbeck mailto:shollenb&netsol.com -# [Scott_Howard] Scott Howard mailto:scott&byressecurity.com 2009-10-13 -# [Scott_Jann] Scott Jann Tightrope Media mailto:sjann&trms.com 2011-10-17 -# Systems, Inc. -# [Scott_Kramer] Scott Kramer mailto:scottk&truebluesoftware.com -# [Scott_Levin] Scott Levin mailto:scott.levin&hp.com 2009-03-19 -# [Scott_Libert] Scott Libert mailto:scott.libert&thomson.net 2008-01-29 -# [Scott_Mager] Scott Mager mailto:Scott.Mager&cerner.com 2006-10 -# [Scott_Menor] Scott Menor Roambotics, Inc. mailto:scott&roambotics.com 2013-10-18 -# [Scott_Miller] Scott Miller mailto:scott&opentrac.org 2003-08 -# [Scott_Narveson] Scott Narveson mailto:sjn&cray.com -# [Scott_Petrack] Scott Petrack mailto:Scott_Petrack&vocaltec.com -# [Scott_Powell] Scott Powell mailto:spowell&openhorizon.com -# [Scott_Shaffer] Scott Shaffer mailto:scott.shaffer&hp.com -# [Scott_Shattuck] Scott Shattuck Technical Pursuit mailto:ss&technicalpursuit.com 2015-06-16 -# Inc. -# [Scott_Southard] Scott Southard mailto:iana-ports&netiq.com 2010-08-25 -# [Scott_St_Clair] Scott St. Clair mailto:stclair&ntc.adaptec.com -# [Scott_Tarone] Scott Tarone mailto:starone&proactivethought.com 2003-04 -# [Scott_Tooker] Scott Tooker mailto:tooker&apple.com -# [SCOTTY_Group_SE] SCOTTY Group SE mailto:p.verbeek&scottygroup.com 2013-01-14 -# [Sean_Adams] Sean Adams mailto:sean&slimdevices.com 2002-05 -# [Sean_D_Sollé] Sean D. Sollé VSN International mailto:sean&vsni.co.uk 2011-09-28 -# Ltd. -# [Sean_MacGuire] Sean MacGuire mailto:sean&maclawran.ca -# [Sean_Ni] Sean Ni mailto:seanni&digitalinstinct.com.tw 2006-02 -# [Seb_Ibis] Seb Ibis mailto:seb_ibis&pkworld.com -# [Sebastian_Kiesel] Sebastian Kiesel mailto:kiesel&ikr.uni-stuttgart.de 2006-01 -# [Sebastien_Bouchex_Bellomie] Sébastien Bouchex InfoVista mailto:sbouchex&infovista.com 2014-05-23 -# Bellomié -# [Sebastien_Bury] Sebastien Bury WAP Forum mailto:sebastien.bury&art.alcatel.fr -# [Sebastien_Hinderer] Sébastien Hinderer mailto:Sebastien.Hinderer&ens-lyon.org 2006-03 -# [Sebastien_Lambla] Sebastien Lambla mailto:lambla&bouygtel.com -# [Seiko_Epson] Seiko Epson mailto:Ishida.Hitoshi&exc.epson.co.jp -# [Semantix] Semantix mailto:xsSupport&semantix.com -# [Sensics] Sensics mailto:vrpn&sensics.com 2015-05-04 -# [Senthil_Ponnuswamy] Senthil Ponnuswamy mailto:senthil&veritas.com -# [Serge_DE_LUCA] Serge DE LUCA mailto:sdeluca&lacie.com -# [Serge_Vacquier] Serge Vacquier mailto:vacquier&systar.fr 2009-05-20 -# [Sergei_Ivanov] Sergei Ivanov mailto:sergeiµsoft.com 2003-10 -# [Sergei_Zjaikin] Sergei Zjaikin mailto:serge&previo.ee 2002-02 -# [Sergey_Bolshedvorsky] Sergey Bolshedvorsky Smart Apps LTD mailto:info&smartapps.co 2011-10-11 -# [Sergey_Burnevsky] Sergey Burnevsky mailto:sergey.burnevsky&nokia.com 2006-08 -# [Sergey_Zubov] Sergey Zubov General Satellite mailto:zubov&spb.gs.ru 2014-02-25 -# [Sergey_Zubov_2] Sergey Zubov IK SATPROF LLC mailto:sergey.zubov&iksatprof.ru 2014-05-02 -# [Sergio_Heker] Sergio Heker mailto:heker&jvncc.csc.org -# [Sergio_Luis] Sérgio Luís Dias Lima mailto:slgramacho&gmail.com 2012-02-27 -# Gramacho -# [Serguei_Osokine] Serguei Osokine mailto:osokin¶graph.com -# [Serguei_Tevs] Serguei Tevs mailto:STevs&ivecon.com 2002-02 -# [Service_Desk_Product] Service Desk Product mailto:info&hp.com 2006-05 -# Manager -# [SEVENSTAX_GmbH] SEVENSTAX GmbH mailto:info&sevenstax.de 2015-11-05 -# [Shahriar_Pourazin] Shahriar Pourazin mailto:pourazin&sepehrs.com 2008-12-02 -# [Shai_Herzog] Shai Herzog mailto:herzog&iphighway.com -# [Shailesh_S_Bavadeka] Shailesh S. Bavadekar mailto:shailesh.bavadekar&sun.com 2002-04 -# [Shams_Naqi] Shams Naqi mailto:SSNAQVI&aol.com -# [Shane_Dick] Shane Dick mailto:shane.dick&amx.com 2005-08 -# [Shane_McRoberts] Shane McRoberts mailto:mcroberts&miteksys.com -# [Shane_O_Donnell] Shane O'Donnell mailto:shane&opennms.org -# [Shane_Roberts] Shane Roberts mailto:iana&shaneroberts.com 2014-12-18 -# [Shankar_Prasad] Shankar Prasad mailto:Shankar.Prasad&honeywell.com -# [Shankar_Prasad_2] Shankar Prasad mailto:shankar.prasad&honeywell.com -# [Shannon_Yeh] Shannon Yeh mailto:yeh&netix.com -# [Shantonu_Sen] Shantonu Sen mailto:ssen&apple.com -# [Shaper_Automation] Shaper Automation mailto:ports&shaperai.com 2012-06-22 -# Inc. -# [Shaun_Byrne] Shaun Byrne mailto:s_byrne&tunstall.co.uk 2009-08-18 -# [Shaun_Wexler] Shaun Wexler mailto:dev&macfoh.com -# [Shawn_Casey] Shawn Casey mailto:Shawn.Casey&matrixone.com -# [Sheila_Devins] Sheila Devins mailto:sheila_devins&vnet.ibm.com -# [Shekar_Pasumarthi] Shekar Pasumarthi mailto:shekarp&firstfloor.com -# [Shifted_Current] Shifted Current LLC mailto:ask&shiftedcurrent.com 2012-09-11 -# [Shigenaka_Kanemitsu] Shigenaka Kanemitsu mailto:Shigenaka_Kanemitsu&ypd.kyocera.co.jp -# [Shingo_Kimura] Shingo Kimura mailto:Shingo.Kimura&jp.sony.com 2005-08 -# [Shinji_Yamanaka] Shinji Yamanaka mailto:syamanaka&jci.co.jp -# [Shinya_Abe] Shinya Abe mailto:abeabe&pfu.co.jp -# [Shiro_Tamoto] Shiro Tamoto mailto:tamoto.shiro&jp.panasonic.com 2003-10 -# [Shivakumar_S_Govind] Shivakumar S. mailto:shivak&eng.sun.com -# Govindarajapuram -# [Shivaun_Albright] Shivaun Albright mailto:shivaun_albright&hp.com 2002-04 -# [ShofarNexus] ShofarNexus.com mailto:John.Kozlowski&ShofarNexus.com 2012-02-20 -# [Shoichi_Tachibana] Shoichi Tachibana mailto:tatibana&yk.fujitsu.co.jp -# [Shree_Murthy] Shree Murthy mailto:shree&cisco.com 2009-10-29 -# [Shu_Wei_Tan] Shu-Wei Tan mailto:stan&omnicomtech.com 2003-03 -# [Shue_Lin_Kuo] Shue-Lin Kuo mailto:shuelin&mdk.sanjose.vlsi.com -# [Shuji_Okubo] Shuji Okubo mailto:okubo&yk.fujitsu.co.jp -# [Shuvayu_Kanjilal] Shuvayu Kanjilal -# [Si_Becker] Si Becker mailto:71362.22&compuserve.com -# [Sierra_Photonics_Inc] Sierra Photonics, mailto:support&sierraphotonics.com 2011-10-20 -# Inc. -# [Siew_Sim] Siew Sim mailto:ssim&asempra.com 2005-08 -# [Sigfus_Magnusson] Sigfus Magnusson mailto:sigfusm&menandmice.com -# [Sigma_Designs_Inc] Sigma Designs, Inc. mailto:anders_brandt&sigmadesigns.com 2011-10-03 -# [Sigma_Designs_Inc_2] Sigma Designs, Inc. mailto:pr&sdesigns.com 2012-11-08 -# [Sigma_Designs_3] Sigma Designs mailto:anders_brandt&sigmadesigns.com 2015-06-26 -# [Signwave_Networking] Signwave Networking mailto:mail&signwave.co.uk -# Development Team -# [Silvano_Maffeis] Silvano Maffeis mailto:maffeis&softwired.ch -# [Silvano_Maffeis_2] Silvano Maffeis mailto:maffeis&acm.org 2008-01-16 -# [Silverstring_Ltd] Silverstring Ltd. mailto:rdegiorgio&silverstring.com 2011-09-15 -# [SIMB_Tecnologia] SIMB Tecnologia mailto:devel&simb.com.br 2014-11-07 -# [Simon_Baldwin] Simon Baldwin mailto:simonb&sco.com -# [Simon_Barber] Simon Barber mailto:simon.barber&parc.com 2009-09-29 -# [Simon_Butcher] Simon Butcher mailto:simonb&alien.net.au -# [Simon_Chinnick] Simon Chinnick mailto:support&cogsys.co.uk -# [Simon_Edwards] Simon Edwards -# [Simon_Ensslen] Simon Ensslen Oblamatik AG mailto:s.ensslen&oblamatik.ch 2012-09-05 -# [Simon_Griffiths] Simon Griffiths Redspeed mailto:simon.griffiths&redspeed-int.com 2015-03-10 -# International Ltd -# [Simon_Haertel] Simon Haertel mailto:simonhaertel&web.de -# [Simon_Hovell] Simon Hovell mailto:simonh&brandcomms.com -# [Simon_J_Gerraty] Simon J. Gerraty mailto:sjg&quick.com.au -# [Simon_Jolly] Simon Jolly mailto:simon.jolly&origin-data.co.uk 2002-07 -# [Simon_Middleton] Simon Middleton ANT Software Limited mailto:simon.middleton&antplc.com 2012-12-06 -# [Simon_Newton] Simon Newton mailto:simon&nomis52.net 2012-06-01 -# [Simon_Newton_2] Simon Newton mailto:simon&nomis52.net 2013-12-09 -# [Simon_P_Jackson] Simon P Jackson mailto:jacko&kring.co.uk -# [Simon_Parker] Simon Parker mailto:simon.j.parker&philips.com -# [Simon_Perreault] Simon Perreault mailto:simon.perreault@viagenie.ca> 2014-03-12 -# [Simon_Phipps] Simon Phipps mailto:sphipps&vnet.ibm.com -# [Simon_Robillard] Simon Robillard mailto:RobillardS&actresearch.com -# [Simon_Skaria] Simon Skaria mailto:simonskµsoft.com 2006-01 -# [Simon_Tennant] Simon Tennant buddycloud mailto:simon&buddycloud.com 2013-05-20 -# [Simon_Tennant_2] Simon Tennant buddycloud mailto:simon&buddycloud.com 2014-06-19 -# [Simon_Wunderlich] Simon Wunderlich mailto:siwu&hrz.tu-chemnitz.de 2007-08-30 -# [Simone_Molendini] Simone Molendini mailto:simone.molendini&unile.it 2003-11 -# [Simson_L_Garfinkel] Simson L. Garfinkel mailto:simsong&next.cambridge.ma.us -# [Sinnadurai_Dharshan] Sinnadurai Dharshan mailto:sinnadurai.dharshan&ni.com 2002-07 -# [Siva_Poobalasingam] Siva Poobalasingam mailto:siva&towersoft.com.au 2006-03 -# [Siva_Poobalasingam_2] Siva Poobalasingam mailto:Siva.Poobalasingam&towersoft.com.au 2007-02 -# Sixscape -# [Sixscape_Communications_Pte_Ltd] Communications, Pte. mailto:lhughes&sixscape.com 2014-08-26 -# Ltd. -# [Skip_Booth] Skip Booth mailto:sbooth&vnet.ibm.com -# [Skip_Levens] Skip Levens mailto:skip&activestoragelabs.com -# [Sky_Schulz] Sky Schulz mailto:sky&edgeofreality.com 2011-05-09 -# [Slava_Monich] Slava Monich mailto:Slava.Monich&nokia.com 2003-01 -# [Slawomir_Krzesinski] Slawomir Krzesinski mailto:slavek&optiwave.com -# [SmarDTV] SmarDTV mailto:vincent.demortier&smardtv.com 2015-03-04 -# [Smart_Apps_LTD] Smart Apps LTD mailto:info&smartapps.co 2011-10-11 -# [Smith_Micro] Smith Micro mailto:cs&smithmicro.com -# [Smith_Micro_Software_Inc] Smith Micro Software, mailto:dsperling&smithmicro.com 2011-10-10 -# Inc. -# [SODATSW_spol] SODATSW spol. s r.o. mailto:info&sodatsw.cz 2012-05-31 -# [SOFTPRO_GmbH] SOFTPRO GmbH mailto:christoph.hipp&softpro.de 2013-08-02 -# [softthere_com] softthere.com mailto:technical&softthere.com 2011-10-17 -# [Software_Horizons_In] Software Horizons mailto:oi2000&shorizons.com -# Inc. -# [Software_LI-COR_Biosciences] Software LI-COR mailto:kevin.ediger&licor.com 2011-10-18 -# Biosciences -# [SolarWinds] SolarWinds mailto:david.gayler&solarwinds.com 2013-05-29 -# [Song_Jian] Song Jian mailto:info&vatata.com 2008-09-15 -# [Songlin_Ren] Songlin Ren mailto:ren&veritas.com -# [Songwon_Chi] Songwon Chi mailto:swchi&daou.co.kr -# [Sonzea] Sonzea, LLC mailto:support&sonzea.com -# [Sophie_Deng] Sophie Deng mailto:Sophie.Deng&eng.sun.com -# [Sören_Havemester] Sören Havemester mailto:reshave&gmail.com 2013-02-18 -# [Soren_Weber] Soren Weber mailto:sw&ditec-gmbh.de -# [Soumitra_Sarkar] Soumitra Sarkar mailto:sarkar&vnet.ibm.com -# [Sowmini_Varadhan] Sowmini Varadhan Oracle Corp mailto:sowmini.varadhan&oracle.com 2015-04-30 -# [Spencer_Teran] Spencer Teran mailto:steran&dotalot.com 2005-08 -# [Spencer_Teran_2] Spencer Teran mailto:steran&ars.com 2004-11 -# [Sphera_Software] Sphera Software mailto:contact&sphera-soft.com -# [Spider_Electronics] Spider Electronics mailto:kenny&spider-e.com 2014-03-10 -# [Spider_Electron] Spider Electron mailto:kenny&spider-e.com 2015-02-05 -# [SpinetiX_S_A] SpinetiX S.A. mailto:Diego.SantaCruz&spinetix.com 2011-10-18 -# [Squadra_Technologies] Squadra Technologies mailto:anthony&squadratechnologies.com 2012-03-14 -# [Square_Connect_Inc] Square Connect, Inc. mailto:mat&squareconnect.com 2011-10-07 -# [Squee_Application_Development] Squee! Application mailto:tristan&squee.co 2011-07-19 -# Development -# [Srdjan_Holovac] Srdjan Holovac mailto:srdjan&empress.com -# [Sreenivas_Bagalkote] Sreenivas Bagalkote mailto:sreenib&lsil.com 2002-08 -# [Sreeram_Duvvuru] Sreeram Duvvuru mailto:sduv&sfbay.sun.com 2002-04 -# [Sri_Subramaniam] Sri Subramaniam mailto:sri&radiance.com -# [Sridhar_Krishnamurth] Sridhar Krishnamurthy mailto:Sridhar_Krishnamurthy&intuit.com 2008-02-15 -# [Srinivas_N_Mogalapa] Srinivas N. Mogalapalli mailto:srinivas&proxim.com -# [Srinivas_Reddy] Srinivas Reddy mailto:sreddy&vitalsigns.com -# [Srinivasa_Nayudu] Srinivasa Nayudu mailto:sn156n&att.com 2009-07-06 -# [Stacy_Kenworthy] Stacy Kenworthy mailto:skenworthy&applianceware.com -# [Stanislaw_Skowronek] Stanislaw Skowronek mailto:thesis&elementary.pl -# [Stanley_Knutson] Stanley Knutson mailto:Stanley.Knutson&ktiworld.com -# [Stefan_Auweiler] Stefan Auweiler mailto:stefan.auweiler&saitc.de 2009-11-16 -# [Stefan_Daun] Stefan Daun mailto:secretariat&cip4.org -# [Stefan_Ekenberg] Stefan Ekenberg mailto:stefan.ekenberg&stericsson.com -# [Stefan_Eriksson] Stefan Eriksson mailto:contact-iana&axis.com -# [Stefan_Hochuli] Stefan Hochuli mailto:iana.org&dunes.ch 2003-12 -# [Stefan_Pantke] Stefan Pantke mailto:sales&turingart.com -# [Stefan_Siebert] Stefan Siebert mailto:ssiebert&dcs.de -# [Stefan_Winkel] Stefan Winkel mailto:stefan&veritas.com 2004-04 -# [Steffen_Schilke] Steffen Schilke -# [Stein_Roger_Skaflott] Stein Roger Skaflotten mailto:skaflotten&gmail.com 2011-07-06 -# [Sten_H_Danielsen] Sten H. Danielsen mailto:shd&kopek.net 2002-07 -# [Stepan_Riha] Stepan Riha mailto:stepan.riha&hand.com -# [Stepehen_Campbell] Stepehen Campbell mailto:campbell&uniprise.com -# [Stephane_Clavel] Stephane Clavel Atomix Productions mailto:stephane.clavel&atomixproductions.com 2011-10-12 -# [Stephane_Beaulieu] Stephane Beaulieu mailto:stephane&cisco.com 2002-02 -# [Stephane_Bourque] Stephane Bourque mailto:stephb&incognito.com -# [Stephane_Bourque_2] Stephane Bourque mailto:sbourque&arilia.com -# [Stephane_MONS] Stéphane MONS mailto:stephane.mons&free.fr 2005-09 -# [Stephane_Touizer] Stephane Touizer mailto:touizerµcaptrade.com 2006-05 -# [Stephen_Aikins] Stephen Aikins mailto:stephen.aikins&embarcadero.com -# [Stephen_Casner] Stephen Casner mailto:casner&precpt.com -# [Stephen_Casner_2] Stephen Casner mailto:casner&precept.com -# [Stephen_Cipolli] Stephen Cipolli mailto:scipolli&radvision.com -# [Stephen_Dunne] Stephen Dunne mailto:sdun&isma.co.uk -# [Stephen_Egbert] Stephen Egbert mailto:egbert&ra.timeplex.com -# [Stephan_Gatzka] Stephan Gatzka Hottinger Baldwin mailto:stephan.gatzka&hbm.com 2013-03-15 -# Messtechnik GmbH -# [Stephen_Gildea] Stephen Gildea mailto:gildea&lcs.mit.edu -# [Stephen_Hanna] Stephen Hanna mailto:hanna&world.std.com -# [Stephen_Hanna_2] Stephen Hanna mailto:steve.hanna&sun.com -# [Stephen_Harrison] Stephen Harrison mailto:sharrison&nimbusdb.com 2011-01-24 -# [Stephen_Hemminger] Stephen Hemminger mailto:shemminger&passedge.com -# [Stephen_Hull] Stephen Hull JaxMP mailto:shull&jaxmp.com 2014-08-15 -# [Stephen_Johnson] Stephen Johnson mailto:sjohnson&mindspring.com -# [Stephen_kiwin_PALM] Stephen [kiwin] PALM mailto:iana&kiwin.com 2015-06-30 -# [Stephen_LaValley] Stephen LaValley mailto:lavalley&lucent.com -# [Stephen_M_Webb] Stephen M. Webb mailto:stephenw&xandros.com 2007-05 -# [Stephen_McCrea] Stephen McCrea mailto:smccrea&etlelectronique.com 2002-03 -# [Stephen_Misel] Stephen Misel mailto:steve.misel&interpath.net -# [Stephen_Misel_2] Stephen Misel mailto:steve&satelnet.org -# [Stephen_R_Whiteley] Stephen R. Whiteley mailto:stevew&wrcad.com 2010-10-07 -# [Stephen_Reed] Stephen Reed mailto:reed&cyc.com 2003-01 -# [Stephen_Reed_2] Stephen Reed mailto:stephenreed&yahoo.com 2010-06-17 -# [Stephen_Reid] Stephen Reid mailto:sreid&ti.com -# [Stephen_Tsun] Stephen Tsun mailto:stsun&jetstream.com -# [Stephen_Tsun_2] Stephen Tsun mailto:stsun&calient.net 2002-02 -# [Stephan_van_Tienen] Stephan van Tienen OCA Alliance mailto:stephan.vantienen&bosch.com 2012-10-11 -# [Steve_Bannister] Steve Bannister mailto:sbannister&stratacache.com -# [Steve_Barton] Steve Barton mailto:steveb&pacom.com 2002-03 -# [Steve_Beigel] Steve Beigel mailto:ublueb!steve&uunet.uu.net -# [Steve_Benoit] Steve Benoit mailto:benoit&math.colostate.edu 2015-09-07 -# [Steve_Britt] Steve Britt mailto:steve_britt&hp.com -# [Steve_Casner] Steve Casner mailto:Casner&isi.edu -# [Steve_Davis] Steve Davis mailto:sdavis&optum-inc.com -# [Steve_Dekorte] Steve Dekorte mailto:steve&dekorte.com -# [Steve_Dellutri] Steve Dellutri -# [Steve_Dellutri_2] Steve Dellutri mailto:sdellutri&cosmocom.com 2006-07 -# [Steve_Dobson] Steve Dobson mailto:sdobson&allstor.com -# [Steve_Dorner] Steve Dorner mailto:s-dorner&uiuc.edu -# [Steve_Favor] Steve Favor mailto:sfavor&tigger.intecom.com -# [Steve_Glassman] Steve Glassman mailto:steveg&pa.dec.com -# [Steve_Gums] Steve Gums Tenir Software mailto:sgums&tenirsoftware.com 2011-10-27 -# [Steve_Halverson] Steve Halverson mailto:shalver&us.ibm.com -# [Steve_Hay] Steve Hay mailto:SteveHay&planit.com 2008-06-13 -# [Steve_Hershey] Steve Hershey RGB Spectrum mailto:shershey&rgb.com 2011-10-10 -# [Steve_Hodgson] Steve Hodgson Pure Storage mailto:steve&purestorage.com 2013-08-13 -# [Steve_Husak] Steve Husak mailto:portmaster&cruisetech.com -# [Steve_Kellogg] Steve Kellogg mailto:stevekellogg&mezzogmr.com -# [Steve_Kille] Steve Kille mailto:S.Kille&isode.com -# [Steve_Kirsch] Steve Kirsch mailto:stk&infoseek.com -# [Steve_Kneizys] Steve Kneizys mailto:skneizys&erpdata.com 2006-11 -# [Steve_Laitinen] Steve Laitinen mailto:laitinen&brutus.aa.ab.com -# [Steve_McKinty] Steve McKinty Oracle Corporation mailto:steve.mckinty&oracle.com 2013-08-14 -# [Steve_Meyer_Sr] Steve Meyer Sr. mailto:stevem&avanti-tech.com 2007-02 -# [Steve_Olson] Steve Olson mailto:solson&cognex.com -# [Steve_Polishinski] Steve Polishinski mailto:spolishinski&etcconnect.com -# [Steve_Qi] Steve Qi mailto:steve.qi&dyn-site.com 2003-11 -# [Steve_Quintana] Steve Quintana mailto:steve&icgresearch.com -# [Steve_Ravida] Steve Ravida mailto:steve.ravida&nebulaholdings.com -# [Steve_Read] Steve Read mailto:sread&ridgeway-sys.com -# [Steve_Roscio] Steve Roscio Hewlett Packard mailto:Steve.Roscio&hp.com 2014-04-09 -# [Steve_Ryckman] Steve Ryckman mailto:iana&simsware.com -# [Steve_Scherf] Steve Scherf mailto:steve&moonsoft.com -# [Steve_Spataro] Steve Spataro mailto:spataro_steve&emc.com -# National Marine -# [Steve_Spitzer] Steve Spitzer Electronics mailto:sspitzer&nmea.org 2011-09-15 -# Association -# [Steve_Splonskowski] Steve Splonskowski mailto:splons&splons.com -# [Steve_Sweeney] Steve Sweeney mailto:Steven_Sweeney&3mail.3com.com -# [Steve_T_Chiang] Steve T. Chiang mailto:schiang&cisco.com -# [Steve_Tuecke] Steve Tuecke mailto:tuecke&mcs.anl.gov -# [Steve_Van_Duser] Steve Van Duser mailto:steve.vanduser&bestpower.gensig.com -# [Steve_Zellers] Steve Zellers mailto:zellers&apple.com -# [Steven_B_Cliff] Steven B. Cliff mailto:scliff&remotec-andros.com 2003-07 -# The University -# [Steven_Emmerson] Steven Emmerson Corporation for mailto:emmerson&ucar.edu 2012-05-07 -# Atmospheric Research -# The University -# [Steven_Emmerson2] Steven Emmerson Corporation for mailto:support-ldm&unidata.ucar.edu 2012-05-18 -# Atmospheric Research -# [Steven_Fields] Steven Fields mailto:sfields&identix.com 2002-02 -# [Steven_Frare] Steven Frare mailto:stevefr&mosaix.com -# [Steven_G_Loughner] Steven G. Loughner mailto:stevengloughner&eaton.com 2007-03 -# [Steven_Gerhardt] Steven Gerhardt mailto:sgerhardt&ixiononline.com 2004-02 -# [Steven_Grigsby] Steven Grigsby mailto:sgrigsby&austin.eent.com -# [Steven_Holtsberg] Steven Holtsberg mailto:steveh&continuus.com -# [Steven_Kelly] Steven Kelly mailto:stevek&metacase.com 2007-11-12 -# [Steven_Kilby] Steven Kilby mailto:steven.kilby&kofax.com 2011-04-25 -# [Steven_Klein] Steven Klein mailto:stevek&ionetworks.com 2002-02 -# [Steven_Loomis] Steven Loomis mailto:srl&taligent.com -# [Steven_M_Forrester] Steven M. Forrester mailto:StevenF&capsuletech.com -# [Steven_Pelletier] Steven Pelletier mailto:stevep&availant.com -# [Steven_Ritland] Steven Ritland mailto:srr&us.ibm.com -# [Steven_Sawkins] Steven Sawkins mailto:ssawkins&symantec.com -# [Steven_Sweeting] Steven Sweeting mailto:ssweeting&sls-technology.com 2008-01-28 -# [Steven_Umbehocker] Steven Umbehocker OS NEXUS, Inc. mailto:steven.umbehocker&osnexus.com 2012-09-21 -# [Steven_W_Clark] Steven W. Clark mailto:steven.clark&avocent.com -# [Steven_W_Clark_2] Steven W. Clark mailto:sclark&equinox.com -# [Stinky_Kitten_Limited] Stinky Kitten Limited mailto:info&stinkykitten.com 2013-10-03 -# [Stonebranch_Inc] Stonebranch, Inc. mailto:nathan.hammond&stonebranch.com 2013-06-25 -# [Stoneware_Inc] Stoneware Inc. mailto:coby.gurr&stone-ware.com 2012-05-18 -# StorageCraft -# [StorageCraft_Technology_Corporation] Technology mailto:dave.mcconkie&storagecraft.com 2014-12-17 -# Corporation -# [StorMagic_Ltd] StorMagic Ltd mailto:chris_farey&stormagic.com 2011-12-16 -# [Stu_Mark] Stu Mark mailto:fordii&j51.com -# [Stuart_Allen] Stuart Allen mailto:stuart&jacl.animats.net 2002-02 -# [Stuart_Button] Stuart Button mailto:button&promis.com -# [Stuart_Cheshire] Stuart Cheshire mailto:cheshire&apple.com 2007-12-03 -# [Stuart_Cheshire_3] Stuart Cheshire mailto:mdnsresponder-ipc&multicastdns.org 2004-06 -# [Stuart_Cheshire_4] Stuart Cheshire mailto:pdl-datastream&apple.com 2002-09 -# [Stuart_Cheshire_5] Stuart Cheshire mailto:cheshire&apple.com -# [Stuart_J_Kerry] Stuart J. Kerry Chair IEEE 802.11 WG mailto:stuart&ok-brit.com 2002-05 -# [Stuart_Lynne] Stuart Lynne mailto:sl&wimsey.com -# [Stuart_Schaefer] Stuart Schaefer mailto:sschaefer&softricity.com -# [Subroto_Datta] Subroto Datta mailto:subrotod&altera.com -# [Sudhakar_Rajamannar] Sudhakar Rajamannar mailto:mobius1&cerfnet.com -# [Sudhir_Menon] Sudhir Menon mailto:sudhir¢erspan.com -# [Sudhir_Shetty] Sudhir Shetty mailto:Sudhir_Shetty&dell.com -# [Sue_Barnhill] Sue Barnhill mailto:snb&oc.com -# [Sufyan_Almajali] Sufyan Almajali mailto:sufyan.almajali&sdrlive.com 2008-06-27 -# [Sugih_Jamim] Sugih Jamim mailto:jamin&eecs.umich.edu -# [Sukanta_Ganguly] Sukanta Ganguly mailto:sganguly&kineticnetworks.com -# [Sulistio_Muljadi] Sulistio Muljadi -# [Sumit_Arora] Sumit Arora mailto:sumit.arora&sun.com 2007-06 -# [Sumitake_kobayashi] Sumitake kobayashi mailto:kobayashi&np.lps.cs.fujitsu.co.jp -# [Sundar_Srinivasan] Sundar Srinivasan mailto:sundarsµsoft.com 2006-05 -# [Sung_U_Ro] Sung U. Ro mailto:ePortalSupport&unisys.com 2006-01 -# [Support] Support mailto:support&officetime.net -# [Support_Staff] Support Staff Sierra Photonics, mailto:support&sierraphotonics.com 2011-10-20 -# Inc. -# [Support_Team] Support Team mailto:support&eucalyptus.com -# [Surendra_Kumar] Surendra Kumar Cisco mailto:smkumar&cisco.com 2012-06-11 -# [Susan_Hinrichs] Susan Hinrichs mailto:shinrich&cisco.com -# [Susan_Sauter] Susan Sauter mailto:ssauter&cisco.com 2006-07 -# [Sushil_Thomas] Sushil Thomas mailto:iana-comm&3par.com 2008-03-10 -# [Susie_Armstrong] Susie Armstrong mailto:Armstrong.wbst128@xerox -# [Susie_Armstrong_2] Susie Armstrong mailto:Armstrong.wbst128&xerox.com -# [Susie_Snitzer] Susie Snitzer -# [Suzanne_Lorrin] Suzanne Lorrin mailto:suzanne.lorrin&ansys.com -# [Suzanne_Lorrin_2] Suzanne Lorrin mailto:sml&ansyspo.ansys.com -# [Sven_Kopacz] Sven Kopacz mailto:s.kopacz&controllerware.com 2010-09-01 -# [Sven_S_Porst] Sven-S. Porst mailto:ssp-web&earthlingsoft.net -# [Sven_Slezak] Sven Slezak mailto:sunny&mezzo.net -# [Sylvain_Demongeot] Sylvain Demongeot mailto:sylvain.demongeot&wildbits.com 2005-08 -# [Sylvain_Pedneault] Sylvain Pedneault mailto:sylvain&sypecom.qc.ca 2003-03 -# [Sylvain_Robert] Sylvain Robert mailto:sylvain.robert&datadis.com 2008-02-14 -# [Sylvia_Ross] Sylvia Ross mailto:sross&codimatech.com -# [Sylvia_Scheuren] Sylvia Scheuren mailto:schsy02&cai.com -# [Sylvia_Siu] Sylvia Siu mailto:Sylvia_Siu&novell.co -# [Sylvia_Siu_2] Sylvia Siu mailto:ssiu&svnetworks.com -# [Symantec_Corp] Symantec Corp mailto:neel_bhatt&symantec.com 2012-01-03 -# [Symantec_Corp2] Symantec mailto:info&symantec.com 2012-05-07 -# [System_Administrator] System Administrator mailto:sysadmin&silvaco.com 2003-06 -# [Taber_Buhl] Taber Buhl mailto:taber&tb2.com 2015-09-24 -# [TAKEDA_Hiroyuki] TAKEDA Hiroyuki mailto:takeda&atashi.net 2003-01 -# [Taha_Paksu] Taha Paksu mailto:tahapaksu&mavili.com.tr 2009-12-21 -# [Takashi_Aihara] Takashi Aihara mailto:aiharat&sm.sony.co.jp 2003-08 -# [Takashi_Hoshino] Takashi Hoshino mailto:hoshino&miya.fujifilm.co.jp -# [Takashi_Kubota] Takashi Kubota mailto:kubota.takashi&pfu.fugitsu.com 2003-06 -# [Takashi_Okazawa] Takashi Okazawa mailto:okazawa.takashi&canon.co.jp 2003-04 -# [Takashi_Sahara] Takashi Sahara mailto:sahara&jdl.co.jp 2006-09 -# [Takayuki_Ito] Takayuki Ito mailto:yuki&euc.jp -# [Takenori_Miyahara] Takenori Miyahara mailto:miyahara&pfu.co.jp -# [Takeo_Sato] Takeo Sato mailto:ts-iana&cloanto.net 2010-04-30 -# [Takeshi_Nishizawa] Takeshi Nishizawa mailto:takeshi&cp10.es.xerox.com -# [Takeshi_Ohmura] Takeshi Ohmura mailto:ohmura&isl.mei.co.jp -# [Takeshi_Sahara] Takeshi Sahara mailto:sahara&jdl.co.jp -# [Takeshi_Saito] Takeshi Saito mailto:takeshi.saito&toshiba.co.jp 2002-09 -# [Talkative_AB] Talkative AB mailto:support&talkative.se -# [Tamara_Baker] Tamara Baker mailto:tbaker&ecolor.com -# [Tamir_Zegman] Tamir Zegman mailto:zegman&checkpoint.com -# [Tarek_Nabhan] Tarek Nabhan mailto:standards&itworx.com 2003-02 -# [Tatham_Oddie] Tatham Oddie mailto:tatham&e-oddie.com 2002-09 -# [Tatsuhiko_Sakai] Tatsuhiko Sakai Canon Inc. mailto:sakai.tatsuhiko&canon.co.jp 2011-10-03 -# [Tatsuya_Igarashi] Tatsuya Igarashi mailto:Tatsuya.Igarashi&jp.sony.com 2002-07 -# [Tatsuya_Ueda] Tatsuya Ueda mailto:tatsu&ist.fujitsu.com 2003-10 -# [Tatu_Ylonen] Tatu Ylonen mailto:ylo&cs.hut.fi -# [Tav_Espian] Tav Espian mailto:tav&espians.com 2010-08-10 -# [Technical_Pursuit_Inc] Technical Pursuit mailto:ss&technicalpursuit.com 2015-06-16 -# Inc. -# [Ted_Hess] Ted Hess mailto:thess&livevault.com -# [Ted_Hoshi] Ted Hoshi mailto:tetsuo.hoshi&jp.yokogawa.com 2004-06 -# [Ted_J_Socolofsky] Ted J. Socolofsky mailto:Teds&spider.co.uk -# [Ted_McFadden] Ted McFadden mailto:mcfadden&dstc.edu.au -# [Ted_Power] Ted Power mailto:tedp&hpinpcb.cup.hp.com -# [Ted_Ross] Ted Ross mailto:ross&toplayer.com -# [Ted_Ross_2] Ted Ross mailto:tross&redhat.com 2008-03-26 -# [Ted_Schroeder] Ted Schroeder mailto:tschroeder&freehandsystems.com -# [Ted_Schroeder_2] Ted Schroeder Vidder, Inc. mailto:ted&vidder.com 2011-10-24 -# [Ted_Tronson] Ted Tronson mailto:ttronson&novell.com -# [Ted_Woodward] Ted Woodward mailto:ted&metrowerks.com -# [Teijo_Mustonen] Teijo Mustonen mailto:Teijo.Mustonen&f-secure.com 2002-03 -# TeleConsult GmbH, -# [TeleConsult] 76275 Ettlingen, mailto:teleconsult&t-online.de -# Germany -# [Teledyne_BlueView_Inc] Teledyne BlueView, mailto:czimmermann&teledyne.com 2012-09-19 -# Inc. -# [Telepathy_project] Telepathy project mailto:telepathy&lists.freedesktop.org -# [TeleTrusT_Deutschlan] TeleTrusT Deutschland mailto:info&teletrust.de 2006-04 -# e.V. -# [Tenir_Software] Tenir Software mailto:sgums&tenirsoftware.com 2011-10-27 -# [Teradici] Teradici mailto:jdillabough&teradici.com 2012-03-06 -# [Teradici_2] Teradici mailto:phelter&teradici.com 2014-04-28 -# [Terrence_J_Talbot] Terrence J. Talbot mailto:lexcube!tjt&bu.edu -# [Terry_Eldridge] Terry Eldridge mailto:Terry.Eldridge&6pointn.com 2006-08 -# [Terry_Gin] Terry Gin mailto:terry_gin&inter-tel.com 2003-02 -# [Terry_Lim] Terry Lim mailto:tkl&pentek.com -# [Terry_Smyth] Terry Smyth mailto:terry&sgluk.com 2004-11 -# [Terumasa_Yoneda] Terumasa Yoneda mailto:yonedat&pfu.co.jp -# [TEST-OK_BV] TEST-OK B.V. mailto:jeroen.ommering&test-ok.nl 2012-09-05 -# [Tetsuharu_Hanada] Tetsuharu Hanada mailto:hanada&pfu.fujitsu.com -# [Tetsuya_Shioda] Tetsuya Shioda mailto:tetsuya&saint.nm.fujitsu.co.jp -# [Teunis_de_Wit] Teunis de Wit Vestas Wind Systems mailto:tdwi&vestas.com 2013-10-30 -# [Tex_Hull] Tex Hull mailto:tex&spss.com -# [Thaddeus_Perala] Thaddeus Perala mailto:trperala&emaden.com -# [Thaddeus_Ternes] Thaddeus Ternes mailto:thaddeus.ternes&intermec.com -# [TheCodingMonkeys] TheCodingMonkeys mailto:monkeys&codingmonkeys.de -# [The_Omni_Group] The Omni Group mailto:info&omnigroup.com -# [Theo_Nijssen] Theo Nijssen mailto:theon&nijssen.nl -# [Theo_Schlossnagle] Theo Schlossnagle mailto:jesus&omniti.com 2009-05-19 -# [Theodore_Ts_o] Theodore Ts'o mailto:tytso&mit.edu -# [Therese_Hunt] Therese Hunt mailto:hunt&marcam.com -# [Thermo-Calc_Software] Thermo-Calc Software mailto:thomasr&thermocalc.se 2012-06-28 -# AB -# [Thierry_Turletti] Thierry Turletti mailto:Thierry.Turletti&sophia.inria.fr -# [Thom_McGrath] Thom McGrath mailto:thom&thezaz.com -# [Thomas_Boerkel] Thomas Boerkel mailto:tbo&ap-ag.com 2008-06-06 -# [Thomas_Boje] Thomas Boje mailto:thomas.boje&gmx.de 2014-03-27 -# [Thomas_Boutell] Thomas Boutell mailto:boutell&boutell.com -# [Thomas_Clausen] Thomas Clausen mailto:thomas.clausen&inria.fr -# [Thomas_Dannemiller] Thomas Dannemiller mailto:tom.dannemiller&rolls-royce.com 2003-04 -# [Thomas_Driemeyer] Thomas Driemeyer mailto:thomas&bitrot.de -# [Thomas_E_Ludwig] Thomas E. Ludwig mailto:tom.ludwig&zetera.com 2004-02 -# [Thomas_Efer] Thomas Efer mailto:mail&thomasefer.de 2006-03 -# [Thomas_Erskine] Thomas Erskine mailto:erskine&sourceworks.com -# [Thomas_Fiege] Thomas Fiege mailto:tfiege&us.ibm.com 2004-02 -# [Thomas_Fok] Thomas Fok mailto:thomas&melody-soft.com 2004-11 -# [Thomas_G._Obermair] Thomas G. Obermair Inlab Software GmbH mailto:thomas.obermair&inlab.de 2014-05-02 -# [Thomas_Geisel] Thomas Geisel mailto:tgeisel&symax.de 2003-01 -# [Thomas_Guth] Thomas Guth mailto:t.guth&zeiss.de 2006-01 -# [Thomas_Hennessy] Thomas Hennessy mailto:thennessy&manageiq.com 2007-10-04 -# [Thomas_J_Klehr] Thomas J. Klehr mailto:tklehr&telcordia.com -# [Thomas_J_Pinkl] Thomas J. Pinkl mailto:tom&pinkl.com 2003-02 -# [Thomas_K_Fischer] Thomas K. Fischer mailto:thomas.fischer&interservices.de -# [Thomas_Kanngieser] Thomas Kanngieser mailto:thomas.kanngieser&arcor.de 2006-01 -# [Thomas_Keller] Thomas Keller mailto:me&thomaskeller.biz 2010-12-22 -# [Thomas_Kemmer] Thomas Kemmer EFKON AG mailto:t.kemmer&efkon.com 2011-10-20 -# [Thomas_Kerkau] Thomas Kerkau mailto:Thomas.Kerkau&io-software.com -# [Thomas_Kjoernes] Thomas Kjoernes mailto:thomas&ipv.no 2010-06-22 -# [Thomas_Klose] Thomas Klose mailto:thomas.klose&hiperscan.com 2009-12-15 -# [Thomas_Koell] Thomas Koell mailto:info&sf.com -# [Thomas_Kuiper] Thomas Kuiper mailto:tkuiper&inxsoft.net -# [Thomas_L_Johnson] Thomas L. Johnson mailto:tjohnson&broadcom.com -# [Thomas_Lindeman] Thomas Lindeman mailto:tlindeµsoft.com 2002-11 -# [Thomas_M_Smith] Thomas M. Smith mailto:Thomas.M.Smith&lmco.com -# [Thomas_Martin] Thomas Martin mailto:thomas&datus-usa.com -# [Thomas_McCabe] Thomas McCabe mailto:tmcca&westell.com -# [Thomas_Obermair] Thomas Obermair mailto:tommy&inlab.m.eunet.de -# [Thomas_Revesz] Thomas Revesz Thermo-Calc Software mailto:thomasr&thermocalc.se 2012-06-28 -# AB -# [Thomas_Ruchti] Thomas Ruchti mailto:thomasmruchti&eaton.com 2003-06 -# [Thomas_Russell] Thomas Russell mailto:trussell&scte.org 2005-05 -# [Thomas_Sakowski] Thomas Sakowski CA Technologies mailto:sakth01&ca.com 2015-06-02 -# [Thomas_Schleu] Thomas Schleu mailto:tschleu&canto.de -# [Thomas_Schleu_2] Thomas Schleu Canto mailto:tschleu&canto.com 2014-02-26 -# [Thomas_Schmidt] Thomas Schmidt mailto:ts&bintec.de -# [Thomas_Scholl] Thomas Scholl mailto:tscholl&spf.is-is.ca 2006-03 -# [Thomas_Sciorilli] Thomas Sciorilli Wi-Fi Alliance mailto:tsciorilli&wi-fi.org 2012-04-09 -# [Thomas_Soerensen] Thomas Soerensen mailto:thomassoerensen&stofanet.dk 2002-04 -# [Thomas_Soranno] Thomas Soranno mailto:tom_soranno&cipartners.com -# [Thomas_Tempelmann] Thomas Tempelmann mailto:tt&tempel.org 2012-06-19 -# [Thomas_Weise] Thomas Weise mailto:weise&vs.uni-kassel.de 2006-04 -# [Thomas_Zwick] Thomas Zwick mailto:thomas.zwick&tz-software.de 2011-10-12 -# [Thor_Olson] Thor Olson mailto:Thor&terabase.com -# [Thorvald_Natvig] Thorvald Natvig mailto:thorvald&natvig.com -# [Three_Lights_Software_LLC] 3 Lights Software LLC mailto:support&3lightssoftware.com 2014-07-22 -# [ThreeGPP_2] 3GPP2 mailto:lizhiming&huawei.com 2012-01-11 -# [ThreeGPP_3] 3GPP mailto:frederic.firmin&etsi.org 2014-11-14 -# [ThreeGPP_4] 3GPP mailto:kimmo.kymalainen&etsi.org 2015-06-18 -# [Tiago_Bittencourt_Si] Tiago Bittencourt Silva mailto:tiagobs&ufpr.br 2005-08 -# [Tido_de_Vries] Tido de Vries eQ-3 Entwicklung GmbH mailto:tido.devries&entwicklung.eq-3.de 2014-05-09 -# [Tightrope_Media_Systems] Tightrope Media mailto:sjann&trms.com 2011-10-17 -# Systems, Inc. -# [Tim_Addington] Tim Addington mailto:Tim.Addington&sciatl.com -# [Tim_Behne] Tim Behne mailto:timothybµwavenetworks.com 2003-06 -# [Tim_Berners_Lee] Tim Berners-Lee mailto:timbl&w3.org -# [Tim_Boldt] Tim Boldt mailto:timb&vytalnet.com -# [Tim_Boyle] Tim Boyle mailto:tboyle&dataviz.com -# [Tim_Brown] Tim Brown mailto:timb&openvas.org 2008-12-24 -# [Tim_Burgess] Tim Burgess mailto:tim&hotu.com 2002-04 -# [Tim_Coppernoll] Tim Coppernoll mailto:Tim_Coppernoll&ccm.jf.intel.com -# [Tim_Dawson] Tim Dawson mailto:tdawson%25mspboss@uunet.uu.net -# [Tim_DeBaillie] Tim DeBaillie mailto:debaillie&ciholas.com 2006-12 -# [Tim_Farley] Tim Farley mailto:Tim.Farley&xcellenet.com -# [Tim_Farlow] Tim Farlow iRobot Corporation mailto:tfarlow&irobot.com 2013-11-07 -# [Tim_Hahn] Tim Hahn mailto:hahnt&us.ibm.com 2006-03 -# [Tim_Hewett] Tim Hewett Coolatoola.com mailto:helpme&coolatoola.com 2014-01-03 -# [Tim_Howard] Tim Howard mailto:timothygh&hotmail.com -# [Tim_Howes] Tim Howes mailto:Tim.Howes&terminator.cc.umich.edu -# [Tim_Hunnewell] Tim Hunnewell mailto:thunnewell&pinna.com -# [Tim_Jacobs] Tim Jacobs -# [Tim_Jobling] Tim Jobling mailto:tim&cambridgeimaging.co.uk -# [Tim_Jowers] Tim Jowers mailto:Tim.Jowers&columbiasc.ncr.com -# [Tim_Kenyon] Tim Kenyon mailto:Tim_Kenyon&csicontrols.com -# [Tim_Lawrence] Tim Lawrence mailto:lawrence&tao-group.com -# [Tim_Maloney] Tim Maloney mailto:tim.maloney&allianceconsultingllc.com 2005-08 -# [Tim_McGranaghan] Tim McGranaghan mailto:tim_mcgranaghan&mech.disa.mil -# [Tim_Morgan] Tim Morgan mailto:timm&surfcontrol.com 2004-11 -# [Tim_Morgan_2] Tim Morgan mailto:tmorgan&filenet.com 2005-11 -# [Tim_Rance] Tim Rance mailto:trance&lionhead.co.uk -# [Tim_Riker] Tim Riker mailto:tim&rikers.org 2003-07 -# [Tim_Riley] Tim Riley mailto:rileyt&saic.com 2009-07-31 -# [Tim_Schmidt] Tim Schmidt mailto:Tim.Schmidt&veritas.com -# [Tim_Sent] Tim Sent mailto:tim.sent&systemsarchitects.com -# [Tim_Serong] Tim Serong mailto:tserong&novell.com 2010-03-31 -# [Tim_Simms] Tim Simms mailto:tsimms&plethoratech.com 2002-04 -# [Tim_Stevenson] Tim Stevenson mailto:tes&ncd.com -# [Tim_Van_Herck] Tim Van Herck VeloCloud Networks mailto:herckt&velocloud.net 2014-11-13 -# [Tim_Walsh] Tim Walsh mailto:tim&ultrex.com -# [Tim_Wiegand] Tim Wiegand mailto:tim.wiegand&navisworks.com 2003-02 -# [Tim_Wilson] Tim Wilson mailto:tim.wilson&motorola.com 2003-08 -# [Tim_Young] Tim Young mailto:timyoung&elevatesoft.com 2009-05-06 -# [Timo_Sivonen] Timo Sivonen mailto:timo.sivonen&ccmail.dowjones.com -# [Timothy_J_Wood] Timothy J. Wood mailto:tjw&omnigroup.com -# [Timothy_Parry] Timothy Parry mailto:tim&lumenergi.com 2011-02-15 -# [Timothy_Wayper] Timothy Wayper mailto:timmy&wunderbear.com -# [TiVo_Inc] TiVo Inc. mailto:devsupport&tivo.com 2011-10-18 -# [Tobias_Erichsen] Tobias Erichsen mailto:erichsen&te-systems.de -# [Tobias_Hoffmann] Tobias Hoffmann mailto:th55&gmx.de 2012-10-09 -# [Tobias_Sturm] Tobias Sturm mailto:tobias.sturm&student.kit.edu 2013-01-14 -# [Tobias_Wegner] Tobias Wegner mailto:wegner&novagate.de -# [Tobin_Schuster] Tobin Schuster mailto:tobin.j.schuster&jci.com -# [Toby_Hosterman] Toby Hosterman mailto:root&netspeak.com -# [Toby_Smith] Toby Smith mailto:dns&idlehands.net -# [Tod_Landis] Tod Landis mailto:tlandis&inprise.com -# [Todd_Barker] Todd Barker mailto:toddba&attachmate.com -# [Todd_Cooper] Todd Cooper mailto:todd&do11073.com 2003-01 -# [Todd_Glassey] Todd Glassey mailto:todd.glassey&att.net -# [Todd_Guay] Todd Guay mailto:todd.guay&oracle.com 2005-08 -# [Todd_Moyer] Todd Moyer mailto:tsm&unx.dec.com -# [Todd_Pichler] Todd Pichler mailto:todd.pichler&stagesoft.com 2010-03-26 -# [Todd_Picquelle] Todd Picquelle mailto:todd&picquelle.com -# [Todd_Scallan] Todd Scallan mailto:tscallan&interwoven.com 2005-08 -# [Todd_Tannenbaum] Todd Tannenbaum mailto:tannenba&cs.wisc.edu 2008-04-03 -# [Todd_Wichers] Todd Wichers mailto:twichers&csn.org -# [Toerless_Eckert] Toerless Eckert mailto:eckert&cisco.com -# [Toerless_Eckert_2] Toerless Eckert Cisco Systems mailto:eckert&cisco.com 2014-06-06 -# [Tohru_Mori] Tohru Mori mailto:tmori&vnet.ibm.com -# [Tom_Bereiter] Tom Bereiter -# [Tom_Bougan] Tom Bougan mailto:tomb&apptechsys.com -# [Tom_Boyle] Tom Boyle mailto:tboyle&vormetric.com 2005-06 -# [Tom_Emberson] Tom Emberson mailto:tom&lanworks.com -# [Tom_Fay] Tom Fay Agilent Technologies, mailto:tom_fay&agilent.com 2013-01-16 -# Inc. -# [Tom_Findley] Tom Findley mailto:tom.findley&networksciences.net -# [Tom_Friend] Tom Friend mailto:tomfrµsoft.com -# [Tom_Haapanen] Tom Haapanen mailto:tomh&metrics.com -# [Tom_Haapanen_2] Tom Haapanen mailto:tomh&equitrac.com 2007-07-11 -# [Tom_Hawkins] Tom Hawkins mailto:tom1&launchbird.com 2003-04 -# [Tom_Hawkins_2] Tom Hawkins mailto:tomahawkins&gmail.com 2006-02 -# [Tom_Hennessy] Tom Hennessy mailto:thenn&novadigm.com -# [Tom_Herbert] Tom Herbert mailto:therbert&google.com 2015-03-05 -# [Tom_Kee] Tom Kee mailto:t.kee&f5.com -# [Tom_Lake] Tom Lake mailto:tlake&m-ware.com -# [Tom_Lane] Tom Lane mailto:tgl&sss.pgh.pa.us -# [Tom_Lemaire] Tom Lemaire mailto:toml&banyan.com -# [Tom_Liu] Tom Liu mailto:ssc&sc.stk.com.cn -# [Tom_Maaswinkel] Tom Maaswinkel mailto:tom.maaswinkel&publiqare.nl 2011-02-07 -# [Tom_Markson] Tom Markson mailto:markson&osmosys.incog.com -# [Tom_Mayo] Tom Mayo mailto:tmayo1&rochester.rr.com 2003-01 -# [Tom_Nys] Tom Nys mailto:tom.nys.tn&belgium.agfa.com -# [Tom_Quinlan] Tom Quinlan mailto:tquinlan&digitechinc.com -# [Tom_R_Zavisca] Tom R. Zavisca Green Hills Software mailto:iana-contact&ghs.com 2012-02-07 -# [Tom_Snauwaert] Tom Snauwaert mailto:tom.snauwaert&st-electronics.be -# [Tom_Spidell] Tom Spidell mailto:spidell&persoft.com -# [Tom_Strack] Tom Strack mailto:TSTRACK&advnw.com -# [Tom_Talpey] Tom Talpey Microsoft Corporation mailto:ttalpeyµsoft.com 2012-03-15 -# [Tom_Taylor] Tom Taylor mailto:Tom.Taylor&unisys.com -# [Tom_Taylor_2] Tom Taylor mailto:taylor&nortelnetworks.com -# [Tom_Taylor_3] Tom Taylor mailto:taylor&nortel.com 2006-09 -# [Tom_White] Tom White MIDI Manufacturers mailto:info&midi.org 2011-11-14 -# Assoc Inc -# [Tom_Whittaker] Tom Whittaker mailto:tomw&ssec.wisc.edu -# [Tomahawk_Holdings] Tomahawk Holdings Ltd mailto:sagara&tomahawk.lk 2013-05-01 -# [Tomas_Rajcan] Tomas Rajcan mailto:trajcan&ipesoft.sk -# [Tomas_Svoboda] Tomas Svoboda mailto:svoboda&infima.cz 2004-12 -# [Tomasz_Krakowiak] Tomasz Krakowiak ENSTEAM Sp. z o.o. mailto:tomasz.krakowiak&ensteam.com 2015-07-08 -# [Tomer_Shain] Tomer Shain mailto:tshain&precise.com 2002-09 -# [Tommy_van_der_Vorst] Tommy van der Vorst mailto:tommy&pixelspark.nl -# [Tomoji_Koike] Tomoji Koike mailto:koike&ael.fujitsu.co.jp -# [Tomokazu_Asai] Tomokazu Asai mailto:asai.tomokazu&pfu.fujitsu.com 2003-11 -# [Tomoo_Fujita] Tomoo Fujita mailto:tf&arc.bs1.fc.nec.co.jp -# [Tomoyuki_Hansaki] Tomoyuki Hansaki Canon Inc. mailto:hansaki.tomoyuki&canon.co.jp 2014-09-03 -# [Ton_Voon] Ton Voon mailto:ton.voon&opsera.com 2008-09-26 -# [Tong_Ming_Lee] Tong-Ming Lee mailto:tmlee&us.oracle.com -# [Tongji_University] Tongji University mailto:neo.gui&gmail.com -# [Tonio_Pirotta] Tonio Pirotta mailto:tonio&tpis.com.au -# [Tony_Amundson] Tony Amundson mailto:tony&blueatlasbroker.com -# [Tony_Arcieri] Tony Arcieri mailto:bascule&gmail.com 2006-03 -# [Tony_Ballardie] Tony Ballardie mailto:A.Ballardie&cs.ucl.ac.uk -# [Tony_Bushnell] Tony Bushnell mailto:tony_bushnell&four-sight.co.uk -# [Tony_Cleveland] Tony Cleveland mailto:tony.cleveland&jacobus.com -# [Tony_Diodato] Tony Diodato mailto:tdiodato&cyprx.com 2005-08 -# [Tony_Fountain] Tony Fountain mailto:tfountain&ucsd.edu -# [Tony_Gibbs] Tony Gibbs mailto:tony.gibbs&europe.simoco.com -# [Tony_Gulino] Tony Gulino mailto:astaregod&hotmail.com 2003-08 -# [Tony_Hoffman] Tony Hoffman mailto:ajh&unx.dec.com -# [Tony_Lubrano] Tony Lubrano mailto:tlubrano&neonsys.com -# [Tony_Matthews] Tony Matthews mailto:tmatthews&triomotion.com 2002-02 -# [Tony_Sawyer] Tony Sawyer mailto:tonys&gemtech.com -# [Tony_Scamurra] Tony Scamurra mailto:Tony&desktoppaging.com -# [Tony_Sowter] Tony Sowter mailto:ts&datcon.co.uk -# [Tony_Splaver] Tony Splaver mailto:tony&cpdi.com 2002-09 -# [Tony_Walker] Tony Walker mailto:tony&cryptocard.com -# [Tony_de_Rijk] Tony de Rijk mailto:idotechnology&mac.com -# [Tor_Slettnes] Tor Slettnes mailto:slettntn&appliedbiosystems.com -# [Tore_Skaug] Tore Skaug Versile AS mailto:tore.skaug&versile.com 2012-02-01 -# [Torsten_Rendelmann] Torsten Rendelmann mailto:torsten.rendelmann&procos.com -# [Torsten_Scheffler] Torsten Scheffler mailto:pdnetadmin&pdnet.info -# [Toru_Murai] Toru Murai mailto:murai&saint.nm.fujitsu.co.jp -# [Toru_Tachibana] Toru Tachibana mailto:tatibana&exs.ts.fujitsu.co.jp -# [Toshikatsu_Ito] Toshikatsu Ito mailto:ito-t&pfu.co.jp -# [Toshio_Watanabe] Toshio Watanabe mailto:watanabe&godzilla.rsc.spdd.ricoh.co.jp -# [TransAct_Futures_Dev] TransAct Futures mailto:1869info&transactfutures.com -# Development Team -# Transport Protocol -# [Transport_Protocol_for_Time-Sensitive_Networking_TG] for Time-Sensitive mailto:AVBTP&ieee.org 2014-03-07 -# Networking TG -# [Trevor_Bell] Trevor Bell mailto:Trevor&iguana.iosoftware.com -# [Trevor_Perkes] Trevor Perkes mailto:trevor.perkes&landesk.com 2010-02-01 -# [Tri_Tech_Computers_Ltd] Tri Tech Computers mailto:admins&tri-tech.com 2012-11-19 -# Ltd. -# [Tricerat] Tricerat mailto:emusgrave&tricerat.com 2013-12-09 -# [Tristan_Richardson] Tristan Richardson mailto:iana&realvnc.com 2006-03 -# [Tristan_Seifert] Tristan Seifert mailto:admin&247server.net 2011-01-31 -# [Tristan_Seifert_2] Tristan Seifert Squee! Application mailto:tristan&squee.co 2011-07-19 -# Development -# [Trond_Borsting] Trond Børsting mailto:Trond.Borsting&snota.no -# [Trond_Norbye] Trond Norbye mailto:trond.norbye&sun.com 2009-02-09 -# [Troy_Bergstrand] Troy Bergstrand mailto:troy.bergstrand&hp.com -# [Troy_Gau] Troy Gau mailto:troy&zyxel.com -# [Troy_Morrison] Troy Morrison mailto:troy&graphon.com -# [Troy_Rollo] Troy Rollo mailto:troy&kroll.corvu.com.au -# [Trung_Huu_Tran] Trung Huu Tran mailto:trung.tran&navy.mil 2007-03 -# [Tsutomu_Fujinami] Tsutomu Fujinami mailto:tsutomu.fujinami&hp.com 2005-08 -# [Tung_Nguyen] Tung Nguyen mailto:dash&ricochet.net -# [Tunstall_Healthcare_UK_Ltd] Tunstall Healthcare mailto:robert.moore&tunstall.com 2014-12-10 -# (UK) Ltd. -# [Tuomo_Makinen] Tuomo Makinen mailto:tmakinen&pp.htv.fi 2002-02 -# [Ty_Ellis] Ty Ellis mailto:tellis&novell.com 2006-05 -# [Tzvika_Chumash] Tzvika Chumash mailto:tzvikac&netvision.net.il -# [UPnP_Forum] UPnP Forum mailto:upnpadmin&forum.upnp.org -# [Udi_Nir] Udi Nir mailto:udi_nir&ncc.co.il -# [Uffe_Harksen] Uffe Harksen mailto:uh&uhcommunications.com 2005-08 -# [Ulaganathan_Sriramul] Ulaganathan Sriramulu mailto:ulag&effigent.com -# [Ulli_Horlacher] Ulli Horlacher mailto:framstag&rus.uni-stuttgart.de -# [Ulrich_Epple] Ulrich Epple mailto:ks&plt.rwth-aachen.de 2012-08-07 -# [Ulrich_Kortenkamp] Ulrich Kortenkamp mailto:kortenkamp&cinderella.de 2003-06 -# [Ulysses_G_Smith_Jr] Ulysses G. Smith Jr. mailto:ugsmith&cesi.com -# [Umair_Cheema] Umair Cheema mailto:cheema&edumid.com 2013-07-08 -# The University -# [University_Corporation_for_Atmospheric_Research] Corporation for mailto:support&unidata.ucar.edu 2012-05-07 -# Atmospheric Research -# The University -# [University_Corporation_for_Atmospheric_Research2] Corporation for mailto:support-ldm&unidata.ucar.edu 2012-05-18 -# Atmospheric Research -# [UofK] University of mailto:cody&uky.edu 2014-11-21 -# Kentucky -# [UpdateLogic_Inc] UpdateLogic, Inc. mailto:it&updatelogic.com 2014-10-27 -# [Urban_Fosseus] Urban Fosseus mailto:urban.fosseus®in.se 2008-12-24 -# [Urbis_Net_Ltd] Urbis.Net Ltd mailto:postmaster&urbis.net -# [Uri_Blank] Uri Blank mailto:uri&quosa.com 2006-09 -# [Uri_Doron] Uri Doron mailto:uri&il.netect.com -# [Uri_Resnitzky] Uri Resnitzky mailto:info&arx.com -# [Uri_Sarid] Uri Sarid mailto:uri&aptana.com 2008-01-22 -# [Uriy_Makasjuk] Uriy Makasjuk mailto:racer&bfpg.ru -# [Urs_Bertschinger] Urs Bertschinger mailto:urs&netmosphere.com -# [Uwe_Holz] Uwe Holz mailto:uwe.holz&azeti.net 2009-11-09 -# [Uwe_Honermann] Uwe Honermann mailto:u.honermann&windream.com -# [Uwe_Ziegler] Uwe Ziegler Goepel electronic mailto:u.ziegler&goepel.com -# GmbH -# [VR_Satish] VR Satish mailto:vr_satish&symantec.com 2007-08-16 -# [V_A_Brauner] V. A. Brauner mailto:info&datamedia.fr -# [V_Balaji] V. Balaji mailto:balaji&aspec.com -# [Vacquier_Serge] Vacquier Serge mailto:vacquier&systar.fr 2009-02-12 -# [Vadim_Maslov] Vadim Maslov mailto:vm&siber.com 2010-10-06 -# [Vadym_Kargin] Vadym Kargin mailto:vkargin&markem.com 2005-08 -# [Vaibhav_Kumar] Vaibhav Kumar mailto:vakumar&hns.com 2003-07 -# [Valassis] Valassis mailto:eckertj&valassis.com 2015-05-05 -# [Valentino_Giudice] mailto:valentino.giudice&vallauri.edu 2015-08-18 -# [Valery_Fremaux] Valery Fremaux mailto:vf&eisti.fr -# [Van_Jacobson] Van Jacobson mailto:van&ee.lbl.gov -# [Van_Jacobson_2] Van Jacobson mailto:van&parc.com 2009-09-29 -# [Varma_Bhupatiraju] Varma Bhupatiraju mailto:varma&calient.net -# [Varun_Santosh] Varun Santosh mailto:varun.santosh&hughes.com 2010-10-20 -# [Vasu_Murthy] Vasu Murthy mailto:vmurthy&datascaler.com 2010-02-08 -# [Vaughan_Wesson] Vaughan Wesson mailto:vaughanw&rtunet.com 2006-10 -# [Vaughn_Amann] Vaughn Amann mailto:vamann&aol.com -# [Veejansh_Inc] Veejansh Inc mailto:admin&veejansh.com 2014-03-04 -# [Veizades] mailto:veizades&ftp.com -# [Velneo] Velneo mailto:velneo&velneo.com -# [VeloCloud_Networks] VeloCloud Networks mailto:ops&velocloud.net 2014-11-13 -# [Venkat_Rangan] Venkat Rangan mailto:venkatr&vitalsigns.com -# [Venkata_Krishna] Venkata Krishna mailto:VenkataKrishna.Bezawada&ca.com 2010-02-24 -# [Venky_Nagar] Venky Nagar mailto:venky&fafner.stanford.edu -# [Ventureforth_Inc] Ventureforth Inc. mailto:support&ventureforth.com 2011-11-03 -# [Vera_Heinau] Vera Heinau mailto:heinau&fu-berlin.de -# [Verek] Verek mailto:info&verek.com -# [Versile_AS] Versile AS mailto:contact&versile.com 2012-02-01 -# [Vestas_Wind_Systems] Vestas Wind Systems mailto:tdwi&vestas.com 2013-10-30 -# [Vick_Keshishian] Vick Keshishian mailto:vickenK&192.219.82.71 -# [Victor_Galis] Victor Galis mailto:galis&satchmo.virtualprototypes.ca -# [Victor_Griswold] Victor Griswold mailto:vgris&aironet.com -# [Victor_H_Farrace] Victor H. Farrace mailto:vfarrace&eaglept.com 2002-10 -# [Victor_Kirhenshtein] Victor Kirhenshtein mailto:victor&opticom.lv 2006-07 -# [Vidder_Inc] Vidder, Inc. mailto:ted&vidder.com 2011-10-24 -# [Videte_IT] Videte IT mailto:info&videte.com -# [Vikas] Vikas mailto:vikas&graycell.com -# [Vikki_Yin_Wei] Vikki Yin Wei mailto:vikki&ipdynamics.com 2003-01 -# [Ville_Laurikari] Ville Laurikari mailto:vlaurika&ssh.com 2005-08 -# [Ville_Pekka_Vahteala] Ville-Pekka Vahteala mailto:ville-pekka.vahteala&bitcomp.fi 2008-06-05 -# [Vinay_Badami] Vinay Badami mailto:VinayBµsoft.com 2006-05 -# [Vinay_Gupta] Vinay Gupta mailto:vinay.gupta&hp.com 2003-08 -# [Vince_Re] Vince Re mailto:Vincent.Re&cai.com -# [Vincent_Demortier] Vincent Demortier SmarDTV mailto:vincent.demortier&smardtv.com 2015-03-04 -# [Vincent_Fiduccia] Vincent Fiduccia Rancher Labs, Inc. mailto:vincent&rancher.com 2015-04-14 -# [Vincent_Gaudeul] Vincent Gaudeul mailto:technique&auriga.fr 2006-02 -# [Vinh_Nguyn] Vinh Nguyn mailto:vinh&sportvision.com -# [Vipul_Ved_Prakash] Vipul Ved Prakash mailto:mail&vipul.net 2002-07 -# [Virgilio_Lattanzi] Virgilio Lattanzi mailto:virgilio&harpax.com 2002-07 -# [VirtualHere_Pty_Ltd] VirtualHere Pty. Ltd. mailto:mail&virtualhere.com 2015-04-02 -# [Vishal_Dharmadhikari] Vishal Dharmadhikari Hall Research mailto:vishal&hallresearch.com 2011-11-29 -# [Vishnu_Varadaraj] Vishnu Varadaraj mailto:vishnuv¶bay.com -# [Vishwas_Lele] Vishwas Lele mailto:Vishwas_Lele&appliedis.com -# [Vision_Solutions] Vision Solutions, mailto:james.wilkinson&visionsolutions.com 2012-06-06 -# Inc. -# [Vitali_Fomine] Vitali Fomine mailto:info&winpopup-lan-messenger.com 2005-11 -# [Vitaly_Revsin] Vitaly Revsin mailto:vitaly&webmanage.com -# [Vitaly_Revsin_2] Vitaly Revsin mailto:vitaly&netapp.com -# [Vladimir_Bickov] Vladimir Bickov mailto:vbickov&coderebel.com 2007-08-20 -# [Vladimir_Legalov] Vladimir Legalov mailto:legalov&sgi.com -# [Vladimir_Legalov_2] Vladimir Legalov mailto:vlegalov&riverbed.com 2007-09-04 -# [Voiko_Loukanov] Voiko Loukanov mailto:v.loukanov&dvelectronics.com 2003-10 -# [Volker_Wiegand] Volker Wiegand mailto:volker.wiegand&t-online.de 2007-07-10 -# [Von_Welch] Von Welch mailto:vwelch&ncsa.uiuc.edu -# [VoxelStorm] VoxelStorm mailto:slowriot&voxelstorm.com 2012-11-08 -# [VSN_International_Ltd] VSN International mailto:sean&vsni.co.uk 2011-09-28 -# Ltd. -# [WAP_Forum] WAP Forum mailto:wap-feedback&mail.wapforum.org -# mailto:pg&uplanet.com -# [W_Jordan_Fitzhugh] W. Jordan Fitzhugh mailto:jfitz&pcare.com -# [Wade_Richards] Wade Richards mailto:wade.richards&sap.com 2008-05-05 -# [Waiki_Wright] Waiki Wright mailto:waiki&us.ibm.com -# [Wally_Pratt_Jr] Wally Pratt Jr mailto:wallyp&hartcomm.org 2010-03-02 -# [Walt_Modic] Walt Modic mailto:Walt.Modic&dionex.com -# [Walter_G_Giroir] Walter G. Giroir mailto:walt_giroir&bmc.com 2003-07 -# [Walter_Goodwin] Walter Goodwin mailto:wpgoodwin&asna.com -# [Walter_K_Eichelburg] Walter K. Eichelburg mailto:walter.eichelburg&sat-automation.com -# [Walter_Poxon] Walter Poxon mailto:wdp&ironwood.cray.com -# [Walter_Underwood] Walter Underwood mailto:wunder&infoseek.com -# [Warren_Alexander] Warren Alexander mailto:warren&chameleon-creative.co.uk -# [Wason_Technology_LLC] Wason Technology, LLC mailto:wason&wasontech.com 2014-01-27 -# [Wayne_Barlow] Wayne Barlow mailto:web&unx.dec.com -# [Wayne_Morrow] Wayne Morrow mailto:wmorrow&starfieldcorp.com 2003-10 -# [Wayne_Schroeder] Wayne Schroeder mailto:schroeder&sds.sdsc.edu -# [WeFi_Inc] WeFi, Inc. mailto:eranna&wefi.com 2013-07-19 -# [Wei_Gao] Wei Gao mailto:wei&mylex.com -# [Wei_Wang] Wei Wang mailto:Wei_Wang&intuit.com 2005-11 -# [Weibao_Wu] Weibao Wu mailto:weibao_wu&symantec.com 2006-04 -# [Weldon_J_Showalter] Weldon J. Showalter mailto:Gamma&mintaka.dca.mil -# [Weng_Chin_Yung] Weng Chin (Winson) Yung mailto:Winson_Yung&3com.com -# [Werner_Almesberger] Werner Almesberger mailto:Werner.Almesberger&epfl.ch -# [Werner_Guertler] Werner Guertler mailto:werner.guertler&ts.fujitsu.com 2009-05-11 -# [Wes_Doonan] Wes Doonan -# [Wes_Peters] Wes Peters mailto:wes&softweyr.com 2007-04 -# [Wes_Wilson] Wes Wilson mailto:wwilson&iss.net 2003-10 -# [Wesley_Eddy] Wesley Eddy Alanax Technologies, mailto:wesley.eddy&alanax.com 2013-01-14 -# Inc -# [Westell] Westell, Inc. mailto:jronk&westell.com -# [Western_Digital] Western Digital Inc. mailto:rajesh.batra&wdc.com 2012-07-11 -# [Whamb] Whamb mailto:support&whamb.com -# [Widgetschmie_de] Widgetschmie.de -# [Wi-Fi_Alliance] Wi-Fi Alliance mailto:certifications&wi-fi.org 2012-04-09 -# [Wi-Fi_Alliance_2] Wi-Fi Alliance mailto:mconley&wi-fi.org 2013-12-31 -# [Wi-SUN_Alliance] Wi-SUN Alliance mailto:admin&wi-sun.org 2015-06-26 -# [WIBU-SYSTEMS_AG] WIBU-SYSTEMS AG mailto:oliver.winzenried&wibu.com 2013-06-25 -# [Wilken_GmbH] Wilken GmbH mailto:fy&wilken.de -# [Will_Dere] Will Dere mailto:will&wrs.com -# [Will_Golson] Will Golson mailto:golson&fc.hp.com -# [Will_Lahr] Will Lahr mailto:will&disruptivegroup.com -# [Will_MacDonald] Will MacDonald mailto:will&codian.com -# [William_Bain] William Bain mailto:bbainµsoft.com -# [William_Benner] William Benner mailto:William_Benner&msn.com -# [William_Benner_2] William Benner mailto:bill&pangolin.com 2002-03 -# [William_David] William David mailto:william.david&lmco.com -# [William_Dillon] William Dillon mailto:wdillon&coas.oregonstate.edu -# [William_Egge] William Egge mailto:begge&emagisoft.com -# [William_Fernando_Mat] William Fernando Maton mailto:wfms&acm.org 2005-01 -# Sotomayor -# [William_Fisher] William Fisher mailto:william.w.fisher&intermapper.com 2011-05-09 -# [William_Lai] William Lai mailto:wlaiµsoft.com -# [William_LePera] William LePera mailto:lepera&us.ibm.com 2008-06-18 -# [William_McDonald] William McDonald mailto:billmc&atc.boeing.com -# [William_Mullaney] William Mullaney mailto:mullanwi&usa.net -# [William_Oldwin] William Oldwin mailto:william&oldwin.name 2013-06-17 -# [William_Orme] William Orme mailto:bill&repliweb.com -# [William_Phelps] William Phelps mailto:william&meier-phelps.com 2010-03-22 -# [William_Polites] William Polites mailto:wpolites&mitre.org -# [William_R_Bishop] William R Bishop mailto:wrb&world.std.com -# [William_R_Lear] William R. Lear mailto:william.lear&xerox.com 2008-03-06 -# [William_R_Lear_2] William R. Lear mailto:wlear&phlexible.com 2008-10-23 -# [William_Randolph_Roy] William Randolph Royere mailto:william&royere.net -# III -# [William_Scheding] William Scheding mailto:wls&wls.org -# [William_Schmidt] William Schmidt mailto:info&eclipseaviation.com 2006-03 -# [William_Shipley] William Shipley mailto:wjs&me.com -# [William_Stoye] William Stoye mailto:wstoye&atml.co.uk -# [Willie_Jan_Bons] Willie Jan Bons mailto:WillieJan.Bons&nds.eu 2011-03-10 -# [Willie_Wu] Willie Wu mailto:willie&mds.com -# [Wilson_Kwan] Wilson Kwan mailto:wilsonk%25toronto@zip.atm.com -# [Windward_Code_LLC] Windward Code LLC mailto:alex&windwardcode.com 2013-11-27 -# [Winston_Chou] Winston Chou mailto:wichou&cisco.com 2011-02-08 -# [Winston_Hetherington] Winston Hetherington -# [Winzig_LLC] Winzig LLC mailto:aroundsound&winzig.com 2011-10-20 -# [Wire_IANA_Contact] 2Wire IANA Contact mailto:iana&2wire.com 2002-04 -# [Wo_o_Ideafarm] Wo'o Ideafarm mailto:b85f3c23.9ad6f42c&ideafarm.com -# [Wolfgang_Adler] Wolfgang Adler mailto:electronicc_rd&wago.com 2006-04 -# [Wolfgang_Rupprecht] Wolfgang Rupprecht mailto:wolfgang&wsrcc.com -# [Wolfgang_Voelker] Wolfgang Voelker mailto:wolfgang.voelker&wibu.com 2007-06 -# [Wolfgang_Völker_2] Wolfgang Völker WIBU-SYSTEMS AG mailto:wolfgang.voelker&wibu.com 2013-06-25 -# [Wolfgang_Weidner] Wolfgang Weidner mailto:ww&citcom.de 2005-12 -# [Wongyu_Cho] Wongyu Cho mailto:wgcho&dialpad.com -# [World_DAB] World DAB mailto:worlddab_irc&worlddab.org -# [World_Fusion] World Fusion mailto:net&worldfusion.com -# [Wouter_Verhelst] Wouter Verhelst mailto:w&uter.be 2010-08-02 -# [WS_Inc] WS, Inc mailto:Jim.Davis&ws-inc.com 2015-04-24 -# [www_nsovocal_com] www.nsovocal.com mailto:ben&nsovocal.com 2011-10-18 -# [Wyatt_Williams] Wyatt Williams mailto:wyattw&icall.com -# [Xavier_Roques] Xavier Roques mailto:xroques&infovista.fr -# [Xential] Xential mailto:info&xential.nl 2013-11-13 -# [XMI_Systems_SA] XMI Systems SA mailto:cma&xmisystems.com 2013-01-18 -# [XMPP_Registrar] XMPP Registrar mailto:registrar&xmpp.org -# [Xnet_Communications] Xnet Communications mailto:croco&xdsnet.de -# [XuiS_Software_Ltd] XuiS Software Ltd. mailto:100322.2376&compuserve.com -# [XXT_LLC] XXT LLC mailto:xxt.matt&sbcglobal.net 2012-07-12 -# [Y_Ohiwa] Y. Ohiwa mailto:y-ohiwa&ael.fujitsu.co.jp -# [Y_Y_Goland] Y. Y. Goland mailto:yarongµsoft.com -# [Yakov_Rekhter] Yakov Rekhter mailto:Yakov&ibm.com -# [Yanick_Pouffary] Yanick Pouffary mailto:pouffary&taec.enet.dec.com -# [Yann_Kaiser] Yann Kaiser mailto:kaiser.yann&gmail.com 2012-11-02 -# [Yannick_Fortin] Yannick Fortin mailto:fortiny&ca.objectiflune.com 2006-02 -# [Yariv_Kaplan] Yariv Kaplan mailto:yarivk&gilat.com -# [Yasunari_Gon_Yamasit] Yasunari Gon Yamasita mailto:yamasita&omronsoft.co.jp -# [Yasunari_Yamashita] Yasunari Yamashita mailto:yamasita&omronsoft.co.jp 2003-04 -# [Yazsoft] Yazsoft mailto:info&yazsoft.com -# [Yen_Lee] Yen Lee mailto:YenL&bsquare.com -# [Yiftach_Ravid] Yiftach Ravid mailto:yiftach&haifa.vnet.ibm.com -# [Yih_Wu_Wang] Yih-Wu Wang mailto:sstsys&ix.netcom.com -# [Yilei_Jia] Yilei Jia mailto:yjia&navcomtech.com 2009-03-18 -# [Yin_Ki_Lau] Yin Ki Lau mailto:xdt_software&oodot.com -# [Ying_Da_Lee] Ying-Da Lee mailto:ylee&syl.dl.nec.com -# [Yingchun_Xu] Yingchun Xu mailto:Yingchun_Xu&3com.com -# [Yoann_Vandoorselaere] Yoann Vandoorselaere mailto:yoann&prelude-ids.org 2005-08 -# [Yochai_Cohen] Yochai Cohen mailto:yochai&combox.co.il -# [Yogesh_P_Gajjar] Yogesh P. Gajjar mailto:yogesh&cytel.com -# [Yohann_Sulaiman] Yohann Sulaiman mailto:ports&shaperai.com 2012-06-22 -# [Yohei_Yoshihara] Yohei Yoshihara CX5 SOFTWARE mailto:yohei_yoshihara&cx5software.com 2013-02-04 -# [Yoneda_Terumasa] Yoneda Terumasa mailto:yonedat&pfu.co.jp -# [Yong_Cai] Yong Cai mailto:ycai&emc.com -# [YoonSoo_Kim] YoonSoo Kim mailto:ys71.kim&samsung.com 2006-05 -# [Yarochkin_Michail] Yarochkin Michail MicroTechniX mailto:Michail.Yarochkinµtechnix.com 2014-10-13 -# [Yoshiaki_Tokumoto] Yoshiaki Tokumoto mailto:toku&pfu.co.jp -# [Yoshihiro_Yamazaki] Yoshihiro Yamazaki mailto:yamazaki&ael.fujitsu.co.jp -# [Yoshikazu_Watanabe] Yoshikazu Watanabe mailto:nabe&sm.sony.co.jp -# [Yoshinobu_Inoue] Yoshinobu Inoue -# [Yoshinobu_Nakamura] Yoshinobu Nakamura mailto:nakamura&np.lps.cs.fujitsu.co.jp -# [Yoshinori_Nakayama] Yoshinori Nakayama mailto:yoshinori_nakayama&komatsu-trilink.jp -# [Yosi_Mass] Yosi Mass mailto:yosimass&haifa.vnet.ibm.com -# [Yossi_Appleboum] Yossi Appleboum mailto:yossia&magicom.co.il -# [Yossi_Appleboum_2] Yossi Appleboum mailto:yossia&web-silicon.com 2005-08 -# [Yossi_Cohen_Shahar] Yossi Cohen-Shahar mailto:yossi&proxy.co.il -# [Yossi_Gal] Yossi Gal mailto:yossi&gilat.com -# [Young_Ki_Kim] Young Ki Kim Samsung mailto:young.ki.kim&samsung.com 2013-05-29 -# [Yuichi_Ohiwa] Yuichi Ohiwa mailto:y-ohiwa&ael.fujitsu.co.jp -# [Yuji_Kuwabara] Yuji Kuwabara mailto:HHG01200&niftyserve.or.jp -# [Yuji_Sasaki] Yuji Sasaki mailto:sasaki&silex.jp -# [Yukihiko_Sakurai] Yukihiko Sakurai mailto:y-sakurai&ael.fujitsu.co.jp -# [Yunho_Huh] Yunho Huh Beats Electronics mailto:yunho.huh&beatsbydre.com 2014-06-27 -# LLC. -# [Yuri_Machkasov] Yuri Machkasov mailto:yuri&ptc.com -# [Yuri_Machkasov_2] Yuri Machkasov mailto:ymachkasov&servigistics.com 2006-08 -# [Yuri_Myakotin] Yuri Myakotin mailto:yuri&ym-com.net 2014-01-07 -# [Yusuke_Asai] Yusuke Asai mailto:yasai&nw1.file.fc.nec.co.jp -# [Yutaka_Ono] Yutaka Ono mailto:ono&saint.nm.fujitsu.co.jp -# [Yuval_Boger] Yuval Boger Sensics mailto:vrpn&sensics.com 2015-05-04 -# [Yuval_Boger_2] Yuval Boger mailto:iana&sensics.com 2015-07-14 -# [Yuval_Hager] Yuval Hager mailto:yuval&avramzon.net 2006-01 -# [Yuval_Rakavy] Yuval Rakavy mailto:yuval&villarakavy.com 2012-07-10 -# [Yves_Gattegno] Yves Gattegno mailto:iana&qualystem.org 2004-12 -# [Yvon_Marineau] Yvon Marineau mailto:yvon&simware.com -# [Z-Firm_LLC] Z-Firm LLC mailto:rafael&zfirmllc.com 2014-08-22 -# [Zach_Leslie] Zach Leslie Puppet Labs mailto:zach&puppetlabs.com 2014-09-18 -# [Zach_Metzinger] Zach Metzinger mailto:zach.metzinger&maxim-ic.com -# [Zach_Nies] Zach Nies mailto:znies&creo.com 2002-09 -# [Zachary_Gramana] Zachary Gramana mailto:contactus&excitabyte.com -# [Zan_Oliphant] Zan Oliphant mailto:zan&accessone.com -# [Zane_Bitter] Zane Bitter mailto:zbitter&redhat.com 2011-08-31 -# [Zdenek_Kolba] Zdenek Kolba mailto:zdenek.kolba&id-karta.cz -# [Zenon_Fortuna] Zenon Fortuna mailto:zenon&mips.com 2007-02 -# [ZeroMQ.org] ZeroMQ.org mailto:ph&imatix.com 2012-11-01 -# [Zhengli] Zhengli mailto:std&iwncomm.com 2010-06-28 -# [Zhiming_Li] Zhiming Li 3GPP2 mailto:lizhiming&huawei.com 2012-01-11 -# [Zhizhong_Zhuang] Zhizhong Zhuang mailto:ZZhuang&optellios.com 2006-12 -# [Zia_Bhatti] Zia Bhatti mailto:zia&netright.com -# [Ziad_Sawalha] Ziad Sawalha Rackspace Hosting mailto:ziad.sawalha&rackspace.com 2011-08-15 -# ZigBee Alliance's -# [ZigBee_Alliances_Network_Device_working_group] Network Device mailto:ljm&exegin.com 2013-05-28 -# working group -# [Zoom_Control_Panel] Zoom Control Panel mailto:ianaport&zoomcp.com 2014-02-26 -# [Zygmunt_Wiercioch] Zygmunt Wiercioch mailto:zyg&jetform.com -# [admin] admin mailto:iana&sightlinesystems.com -# [base_t_Interactive] 10base-t Interactive mailto:support&10base-t.com -# [brockman] mailto:brockman&ccmail.com -# [ddt] mailto:ddt&idcube.idsoftware.com -# [equinux] equinux mailto:mediacentral&equinux.comdu -# [flanne] flanne@vnet.IBM.COM -# [gary] mailto:gary&airsoft.com -# [gdeinsta] gdeinsta mailto:gdeinsta&jetform.com -# [gilmer] mailto:gilmer&gandalf.ca -# [gunner] mailto:gunner&ibeam.intel.com -# [iOS_Software] iOS Software mailto:ios&free.fr -# [iThink_Software] iThink Software mailto:contact&ithinksw.com -# [mackin] mailto:mackin&us.oracle.com -# [naonao] mailto:naonao&kikaku.mmp.fujitsu.co.jp -# [sn_w_of_renegade_lab] sn0w of renegade labs mailto:sn0w&devious.tsongkie.com 2003-11 -# -# Footnote -# -# [1] It is only appropriate to use these values in explicitly- -# configured experiments; they MUST NOT be shipped as defaults in -# implementations. See RFC 3692 for details. - -# Local NetBSD additions [aliases or missing stuff] -sink 9/tcp null -sink 9/udp null -users 11/tcp -quote 17/tcp -quote 17/udp -ttytst 19/tcp source -ttytst 19/udp source -mail 25/tcp -mail 25/udp -timserver 37/tcp -timserver 37/udp -resource 39/tcp -resource 39/udp -netrjs 77/tcp -netrjs 77/udp -krb5 88/tcp -krb5 88/udp -hostnames 101/tcp -hostnames 101/udp -tsap 102/tcp -tsap 102/udp -cso-ns 105/tcp -cso-ns 105/udp -poppass 106/tcp poppassd -postoffice 109/tcp -rpcbind 111/tcp -rpcbind 111/udp -authentications 113/tcp -readnews 119/tcp untp -imap2 143/tcp imap4 -imap2 143/udp imap4 -z3950 210/tcp wais -z3950 210/udp wais -krcmd 544/tcp -ekshell 545/tcp -whod 513/udp -cmd 514/tcp -spooler 515/tcp -spooler 515/udp -route 520/udp routed -timeserver 525/tcp -timeserver 525/udp -newdate 526/tcp -newdate 526/udp -rpc 530/tcp -rpc 530/udp -chat 531/tcp -chat 531/udp -uucpd 540/tcp -uucpd 540/udp -rdist 541/tcp rdistd -rfs_server 556/tcp rfs # Brunhoff remote filesystem -smtps 465/tcp # smtp protocol over TLS/SSL -smtps 465/udp # smtp protocol over TLS/SSL -kdc 750/tcp kerberos4 -kdc 750/udp kerberos4 -kerberos-master 751/udp # Kerberos admin server udp -kerberos-master 751/tcp # Kerberos admin server tcp -hprop 754/tcp # Heimdal KDC database propagation -krbupdate 760/tcp kreg # BSD Kerberos registration -kpwd 761/tcp # old BSD Kerberos `passwd' -supfilesrv 871/tcp # SUP server -swat 901/tcp # Samba Web Administration Tool -kpop 1109/tcp # Kerberos POP server -supfiledbg 1127/tcp # SUP debugging -radacct 1813/tcp -radacct 1813/udp -lmtp 2003/tcp # Local Mail Transfer Protocol -nfsd 2049/udp # Sun NFS -nfsd 2049/tcp # Sun NFS -eklogin 2105/tcp # Kerberos encrypted `rlogin' -zephyr-hm-srv 2105/udp # Zephyr hm-serv connection -ekshell2 2106/tcp # Encrypted kshell - UColorado, Boulder -iscsi 3260/tcp -fud 4201/udp # Cyrus IMAP finger-like service -X11 6000/tcp # X Window System -ircd 6667/tcp # Often used IRC port (also see 194) -kamanda 10081/udp # Amanda with Kerberos -amandaidx 10082/tcp # Amanda index server -amidxtape 10083/tcp # Amanda dump image server -hunt 26740/udp # multi-player/multi-host maze-wars -# -# Netatalk (in-kernel Appletalk) services -# Note: The running kernel must be configured with "options NETATALK" -# and software not included in NetBSD, such as Netatalk version 1.4b2 -# or later, must be used to take advantage of these services. -# -rtmp 1/ddp # Routing Table Maintenance Protocol -nbp 2/ddp # Name Binding Protocol -echo 4/ddp # AppleTalk Echo Protocol -zip 6/ddp # Zone Information Protocol diff --git a/etc/shells b/etc/shells deleted file mode 100644 index 0803a9076..000000000 --- a/etc/shells +++ /dev/null @@ -1,9 +0,0 @@ -# -# List of acceptable shells for chpass(1). -# Ftpd will not allow users to connect who are not using -# one of these shells. - -/bin/false -/bin/sh -/bin/csh -/bin/ksh diff --git a/etc/shrc b/etc/shrc deleted file mode 100644 index 76a335b00..000000000 --- a/etc/shrc +++ /dev/null @@ -1,19 +0,0 @@ -# -# System-wide .shrc file for sh(1). - -ll(){ ls -l ${1+"$@"}; } - -case "$-" in *i*) - if /bin/test -z "${HOST}"; then - HOST="$(hostname)" - fi - # hostname is set to the ip address by default on MINIX, so - # don't truncate on the first dot. - #PS1="${HOST%%.*}$PS1" - PS1="${HOST}$PS1" - set -o emacs - # This file is used by shells that might not support - # set -o tabcomplete, so check before trying to use it. - ( set -o tabcomplete 2>/dev/null ) && set -o tabcomplete - ;; -esac diff --git a/etc/skel/Makefile b/etc/skel/Makefile deleted file mode 100644 index 56d1c3fd6..000000000 --- a/etc/skel/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.8 2006/09/01 13:01:55 tron Exp $ -# from: @(#)Makefile 8.1 (Berkeley) 6/8/93 - -CONFIGFILES= dot.cshrc dot.login dot.logout dot.profile dot.shrc -FILESDIR= /etc/skel -.for F in ${CONFIGFILES} -FILESNAME_${F}= ${F:S/dot//} -.endfor - -.include diff --git a/etc/skel/dot.cshrc b/etc/skel/dot.cshrc deleted file mode 100644 index a1b69d168..000000000 --- a/etc/skel/dot.cshrc +++ /dev/null @@ -1,57 +0,0 @@ -# $NetBSD: dot.cshrc,v 1.7 2011/10/19 14:42:37 christos Exp $ -# -# This is the default .cshrc file. -# Users are expected to edit it to meet their own needs. -# -# The commands in this file are executed each time a new csh shell -# is started. -# -# See csh(1) for details. -# - -# Set your editor. Default to explicitly setting vi, as otherwise some -# software will run ed and other software will fail. Can be set to -# emacs or nano or whatever other editor you may prefer, but of course -# those editors must be installed before you can use them. -setenv EDITOR vi - -# vi settings: set show-match auto-indent always-redraw shift-width=4 -#setenv EXINIT "se sm ai redraw sw=4" - -# VISUAL sets the "visual" editor, i.e., vi rather than ed, which if -# set will be run by preference to $EDITOR by some software. It is -# mostly historical and usually does not need to be set. -#setenv VISUAL ${EDITOR} - -# Set the pager. This is used by, among other things, man(1) for -# showing man pages. The default is "more". Another reasonable choice -# (included with the system by default) is "less". -#setenv PAGER more - -# Set your default printer, if desired. -#setenv PRINTER change-this-to-a-printer - -# Set the search path for programs. -set path = (~/bin /bin /sbin /usr/{bin,sbin,X11R7/bin,X11R6/bin,pkg/{,s}bin,games} \ - /usr/local/{,s}bin) - -if ($?prompt) then - # An interactive shell -- set some stuff up - - # Filename completion. - set filec - - # Size of the history buffer. - set history = 1000 - - # Do not exit on EOF condition (e.g. ^D typed) - # (disabled by default, not default behavior) - #set ignoreeof - - # Set the location of your incoming email for mail notification. - set mail = (/var/mail/$USER) - - # Set the prompt to include the hostname. - set mch = `hostname -s` - set prompt = "${mch:q}: {\!} " -endif diff --git a/etc/skel/dot.login b/etc/skel/dot.login deleted file mode 100644 index c65b0bec5..000000000 --- a/etc/skel/dot.login +++ /dev/null @@ -1,21 +0,0 @@ -# $NetBSD: dot.login,v 1.3 2003/04/24 01:02:26 perry Exp $ -# -# This is the default .login file. -# Users are expected to edit it to meet their own needs. -# -# The commands in this file are executed when a csh user first -# logs in. This file is processed after .cshrc. -# -# See csh(1) for details. -# - -if ( ! $?SHELL ) then - setenv SHELL /bin/csh -endif - -set noglob -eval `tset -s -m 'network:?xterm'` -unset noglob -stty status '^T' crt -tostop - -if ( -x /usr/games/fortune ) /usr/games/fortune diff --git a/etc/skel/dot.logout b/etc/skel/dot.logout deleted file mode 100644 index 2c8783169..000000000 --- a/etc/skel/dot.logout +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: dot.logout,v 1.1 2003/04/24 01:01:39 perry Exp $ -# -# This is the default .logout file. -# Users are expected to edit it to meet their own needs. -# -# The commands in this file are executed when a csh login shell -# terminates. -# -# See csh(1) for details. -# diff --git a/etc/skel/dot.profile b/etc/skel/dot.profile deleted file mode 100644 index ad8a20e66..000000000 --- a/etc/skel/dot.profile +++ /dev/null @@ -1,41 +0,0 @@ -# $NetBSD: dot.profile,v 1.9 2012/04/10 19:02:30 dholland Exp $ -# -# This is the default .profile file. -# Users are expected to edit it to meet their own needs. -# -# The commands in this file are executed when an sh user first -# logs in. -# -# See sh(1) for details. -# - -# Set your editor. Default to explicitly setting vi, as otherwise some -# software will run ed and other software will fail. Can be set to -# emacs or nano or whatever other editor you may prefer, but of course -# those editors must be installed before you can use them. -export EDITOR=vi - -# vi settings: set show-match auto-indent always-redraw shift-width=4 -#export EXINIT="se sm ai redraw sw=4" - -# VISUAL sets the "visual" editor, i.e., vi rather than ed, which if -# set will be run by preference to $EDITOR by some software. It is -# mostly historical and usually does not need to be set. -#export VISUAL=${EDITOR} - -# Set the pager. This is used by, among other things, man(1) for -# showing man pages. The default is "more". Another reasonable choice -# (included with the system by default) is "less". -#export PAGER=more - -# Set your default printer, if desired. -#export PRINTER=change-this-to-a-printer - -# Set the search path for programs. -PATH=$HOME/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/X11R7/bin:/usr/X11R6/bin:/usr/pkg/bin -PATH=${PATH}:/usr/pkg/sbin:/usr/games:/usr/local/bin:/usr/local/sbin -export PATH - -# Configure the shell to load .shrc at startup time. -# This will happen for every shell started, not just login shells. -export ENV=$HOME/.shrc diff --git a/etc/skel/dot.shrc b/etc/skel/dot.shrc deleted file mode 100644 index 2743f72c3..000000000 --- a/etc/skel/dot.shrc +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: dot.shrc,v 1.3 2007/11/24 11:14:42 pavel Exp $ - -if [ -f /etc/shrc ]; then - . /etc/shrc -fi - -case "$-" in *i*) - # interactive mode settings go here - ;; -esac diff --git a/etc/syslog.conf b/etc/syslog.conf deleted file mode 100644 index e2cf2d5bb..000000000 --- a/etc/syslog.conf +++ /dev/null @@ -1,20 +0,0 @@ -## -## @(#)syslog.conf 1.0 Jan. 18, 2000 -## -## Use kill -HUP `cat /var/run/syslogd.pid` to restart -## the server, forcing it to reread this file. - -## Emergency messages (system may be unusable) -*.emerg * -*.alert /dev/log - -## High severity errors -*.alert /var/log/syslog - -## Every other message (errors/warning and informational) -*.info;mark.info /var/log/messages - -## Debug informations (tracing programs) -#*.debug /var/log/debug - -## end syslog.conf diff --git a/etc/system.conf b/etc/system.conf deleted file mode 100644 index 38c43f24f..000000000 --- a/etc/system.conf +++ /dev/null @@ -1,529 +0,0 @@ -# -# Boot system services in the boot image -# - -service rs -{ - uid 0; - ipc ALL; # ALL ipc targets allowed - system ALL; # ALL kernel calls allowed - vm # Extra VM calls allowed: - RS_SET_PRIV # 37 - RS_UPDATE # 41 - RS_MEMCTL # 42 - PROCCTL # 45 - RS_PREPARE # 48 - ; - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr SELF; # Signal manager is SELF - scheduler KERNEL; # Scheduler is KERNEL - priority 4; # priority queue 4 - quantum 500; # default server quantum -}; - -service ds -{ - uid 0; - ipc ALL_SYS; # All system ipc targets allowed - system ALL; # ALL kernel calls allowed - vm BASIC; # Only basic VM calls allowed - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler KERNEL; # Scheduler is KERNEL - priority 4; # priority queue 4 - quantum 500; # default server quantum -}; - -service vm -{ - uid 0; - ipc ALL; # ALL ipc targets allowed - system ALL; # ALL kernel calls allowed - vm NONE; # No VM calls allowed - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler KERNEL; # Scheduler is KERNEL - priority 2; # priority queue 2 - quantum 500; # default server quantum -}; - -service pm -{ - uid 0; - ipc ALL; # ALL ipc targets allowed - system ALL; # ALL kernel calls allowed - vm # Extra VM calls allowed: - EXIT # 00 - FORK # 01 - EXEC_NEWMEM # 03 - WILLEXIT # 05 - GETRUSAGE # 47 - ; - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler KERNEL; # Scheduler is KERNEL - priority 4; # priority queue 4 - quantum 500; # default server quantum -}; - -service sched -{ - uid 0; - ipc ALL_SYS; # All system ipc targets allowed - system ALL; # ALL kernel calls allowed - vm BASIC; # Only basic VM calls allowed - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler KERNEL; # Scheduler is KERNEL - priority 4; # priority queue 4 - quantum 500; # default server quantum -}; - -service vfs -{ - uid 0; - ipc ALL; # ALL ipc targets allowed - system # Extra kernel calls allowed: - KILL # 06 - UMAP # 14 - VIRCOPY # 15 - MEMSET - ; - vm PROCCTL - VFS_MMAP - VFS_REPLY - ; - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler KERNEL; # Scheduler is KERNEL - priority 5; # priority queue 5 - quantum 500; # default server quantum -}; - -service mfs -{ - ipc ALL_SYS; # All system ipc targets allowed - system BASIC; # Only basic kernel calls allowed - vm MAPCACHEPAGE SETCACHEPAGE FORGETCACHEPAGE CLEARCACHE; - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler sched; # Scheduler is sched - priority 5; # priority queue 5 - quantum 500; # default server quantum -}; - -service ntfs-3g -{ - uid SELF; # Use uid of user starting service - ipc ALL_SYS; # All system ipc targets allowed - system BASIC; # Only basic kernel calls allowed - vm BASIC; # Only basic VM calls allowed - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler sched; # Scheduler is sched - priority 5; # priority queue 5 - quantum 500; # default server quantum -}; - -service ext2 -{ - ipc ALL_SYS; # All system ipc targets allowed - system BASIC; # Only basic kernel calls allowed - vm MAPCACHEPAGE SETCACHEPAGE FORGETCACHEPAGE CLEARCACHE; - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler sched; # Scheduler is sched - priority 5; # priority queue 5 - quantum 500; # default server quantum -}; - -service pfs -{ - ipc ALL_SYS; # All system ipc targets allowed - system BASIC; # Only basic kernel calls allowed - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler sched; # Scheduler is sched - priority 5; # priority queue 5 - quantum 500; # default server quantum -}; - -service tty -{ - uid 0; - ipc ALL_SYS; # All system ipc targets allowed - system # Extra kernel calls allowed: - KILL # 06 - UMAP # 14 - VIRCOPY # 15 - PHYSCOPY # 16 - IRQCTL # 19 - DEVIO # 21 - SDEVIO # 22 - VDEVIO # 23 - ABORT # 27 - IOPENABLE # 28 - READBIOS # 35 - ; - vm BASIC; # Only basic VM calls allowed - io ALL; # ALL I/O ranges allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler KERNEL; # Scheduler is KERNEL (prevents console stalls) - priority 1; # priority queue 1 - quantum 50; # default driver quantum -}; - -service memory -{ - uid 0; - ipc ALL_SYS; # All system ipc targets allowed - system # Extra kernel calls allowed: - UMAP # 14 - VIRCOPY # 15 - PHYSCOPY # 16 - IRQCTL # 19 - DEVIO # 21 - SDEVIO # 22 - VDEVIO # 23 - IOPENABLE # 28 - ; - vm BASIC; # Only basic VM calls allowed - io NONE; # No I/O range allowed - irq NONE; # No IRQ allowed - sigmgr rs; # Signal manager is RS - scheduler KERNEL; # Scheduler is KERNEL - priority 3; # priority queue 3 - quantum 50; # default driver quantum -}; - -service log -{ - ipc SYSTEM vfs rs vm; - priority 2; -}; - -service mib -{ - system - VIRCOPY # 15 - ; - ipc ALL; - uid 0; -}; - -service init -{ - uid 0; - ipc # ipc targets allowed: - pm vfs rs vm - ; - system NONE; # No kernel calls allowed - vm BASIC; # Only basic VM calls allowed - io NONE; # No I/O range allowed - irq NONE; # No IRQs allowed - sigmgr pm; # Signal manager is PM -}; - -# -# Dynamically started system services -# - -service floppy -{ - irq 6; - io 3f0:8 - 0:10 # DMA controller - 81 # Also DMA - ; - system - UMAP # 14 - IRQCTL # 19 - DEVIO # 21 - VDEVIO # 23 - ; -}; - -service readclock.drv -{ - ipc ALL; - io 70:2; - system - PRIVCTL # 4 - UMAP # 14 - VIRCOPY # 15 - DEVIO # 21 - READBIOS # 35 - ; - uid 0; -}; - -service is -{ - vm - INFO - ; - uid 0; -}; - -service acpi -{ - io ALL; - system - PRIVCTL # 4 - DEVIO # 21 - ; - uid 0; -}; - -service pci -{ - io cf8:8 # PCI bus controller - 4d0:2 # PIIX - ; - system - PRIVCTL # 4 - DEVIO # 21 - ; - uid 0; -}; - -service ahci -{ - system - UMAP # 14 - VUMAP # 18 - IRQCTL # 19 - ; - pci class - 1/6/1 # Mass storage / SATA / AHCI - ; -}; - -service virtio_blk -{ - system - UMAP - VUMAP - IRQCTL - DEVIO - ; - - pci device 1af4:1001; -}; - -service at_wini -{ - io 1f0:8 # Controller 0 - 3f6 # Also controller 0 - 170:8 # Controller 1 - 376 # Also controller 1 - ; - irq - 14 # Controller 0 - 15 # Controller 1 - ; - system - UMAP # 14 - IRQCTL # 19 - DEVIO # 21 - SDEVIO # 22 - VDEVIO # 23 - ; - pci class # Match these PCI classes: - 1/1 # Mass storage / IDE - ; - pci device # In addition, match these devices: - 1106:3149 # VIA VT6420 RAID (1/4) - 1095:3512/1095:6512 # Silicon Image SATA RAID (1/4) - 1095:3114/1095:3114 # Silicon Image SATA RAID (1/80) - ; -}; - -service procfs -{ - system - VIRCOPY # 15 - ; - vm - INFO - SETCACHEPAGE - CLEARCACHE - ; - uid 0; -}; - -service isofs -{ - system - UMAP # 14 - ; - vm MAPCACHEPAGE - SETCACHEPAGE - CLEARCACHE - ; - uid 0; -}; - -service hgfs -{ - ipc - SYSTEM pm vfs rs vm - ; - vm - SETCACHEPAGE - CLEARCACHE - ; -}; - -service filter -{ - ipc - SYSTEM pm vfs rs ds vm - at_wini - ; - control - at_wini - ; -}; - -service input -{ - ipc SYSTEM pm vfs rs ds tty vm; - priority 1; -}; - - -service pckbd -{ - system - IRQCTL # 19 - DEVIO # 21 - ; - io 60:8; # Keyboard, keyboard command/status - irq - 1 # Keyboard - 12 # Auxiliary input (mouse) - ; - ipc SYSTEM pm rs ds vm input; - priority 1; -}; - -service devman -{ - uid 0; - vm - SETCACHEPAGE - CLEARCACHE - ; -}; - -service mmc -{ - system - PRIVCTL # 4 - IRQCTL # 19 - ; - # Interrupts allowed - irq - 64 - 83 - ; # IRQs allowed - priority 4; # priority queue 4 -}; - -service fb -{ - system - UMAP # 14 - DEVIO # 21 - PRIVCTL # 4 - ; - ipc - SYSTEM pm rs ds vm vfs cat24c256 tda19988 - ; -}; - -service cat24c256 -{ - ipc SYSTEM RS DS i2c; -}; - -service tda19988 -{ - ipc SYSTEM RS DS i2c; -}; - -service tps65217 -{ - uid 0; # needed for doing reboot() - system IRQCTL PRIVCTL; - irq 7; # NNMI pin on BeagleBone / BeagleBone Black - ipc SYSTEM RS DS PM i2c; -}; - -service tps65950 -{ - ipc SYSTEM RS DS i2c readclock.drv; -}; - -service fbd -{ - ipc - SYSTEM vfs rs ds vm - ahci - at_wini - ; -}; - -service vnd -{ - ipc - SYSTEM vfs rs vm - ; - uid 0; # only for copyfd(2) -}; - -service pty -{ - system - KILL # 06 - ; - ipc - SYSTEM vfs rs vm - ; -}; - -service ptyfs -{ - ipc - SYSTEM pm vfs rs pty ds vm - ; -}; - -service edfictl -{ - ipc ALL; -}; - -service emmc -{ - system - PRIVCTL - IRQCTL - PADCONF - ; - irq - 28 # MMCSD1INT - ; -}; diff --git a/etc/termcap b/etc/termcap deleted file mode 100755 index 311882830..000000000 --- a/etc/termcap +++ /dev/null @@ -1,130 +0,0 @@ -mx|minix|minix console:\ - :am:xn:bs:\ - :co#80:li#25:\ - :cr=^M:nw=^M^J:\ - :bl=^G:\ - :is=\E[0m:\ - :cd=\E[0J:cl=\E[H\E[0J:\ - :so=\E[7m:se=\E[0m:\ - :us=\E[4m:ue=\E[0m:\ - :mb=\E[5m:md=\E[1m:\ - :mr=\E[7m:me=\E[0m:\ - :sr=\EM:sf=^J:\ - :cm=\E[%i%d;%dH:\ - :ho=\E[H:\ - :al=\E[L:AL=\E[%dL:\ - :ce=\E[K:\ - :DC=\E[%dP:dc=\E[P:\ - :DL=\E[%dM:dl=\E[M:\ - :DO=\E[%dB:do=\E[B:\ - :IC=\E[%d@:ic=\E[@:\ - :it#8:ta=^I:\ - :le=^H:LE=\E[%dD:\ - :nd=\E[C:RI=\E[%dC:\ - :up=\E[A:UP=\E[%dA:\ - :ku=\E[A:kd=\E[B:\ - :kl=\E[D:kr=\E[C:\ - :kh=\E[H:kb=^H:\ - :kD=\177:kI=\E[@:\ - :kN=\E[U:kP=\E[V:\ - :@7=\E[Y:\ - :k1=\E[11~:k2=\E[12~:\ - :k3=\E[13~:k4=\E[14~:\ - :k5=\E[15~:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:\ - :k9=\E[20~:k;=\E[21~:\ - :Co#8:pa#64:\ - :AB=\E[4%dm:AF=\E[3%dm: -du|dialup|Dialup line:\ - :bs:co#80:li#24: -db|dumb|Really dumb terminal:\ - :bs:co#80:li#24: -lp|lp|Line Printer:\ - :co#80:li#66: -li|ansi|Ansi standard crt:\ - :am:bs:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:co#80:\ - :dn=\E[B:me=\E[0m:mb=\E[5m:mr=\E[7m:md=\E[1m:ho=\E[H:li#24:\ - :nd=\E[C:ms:pt:so=\E[7m:se=\E[0m:us=\E[4m:ue=\E[0m:up=\E[A:\ - :kb=^h:ku=\E[A:kd=\E[B:kl=\E[D:kr=\E[C: -vs|xterm|xterms|vs100|xterm terminal emulator (X window system):\ - :am:cr=^M:do=^J:nl=^J:bl=^G:le=^H:ho=\E[H:\ - :co#80:li#24:cl=\E[H\E[2J:bs:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\ - :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\ - :md=\E[1m:mr=\E[7m:me=\E[m:\ - :ku=\E[A:kd=\E[B:kr=\E[C:kl=\E[D:kb=^H:kD=\177:\ - :kI=\E[@:kN=\E[U:kP=\E[V:ta=^I:pt:sf=\n:sr=\EM:\ - :al=\E[L:dl=\E[M:ic=\E[@:dc=\E[P:\ - :MT:ks=\E[?1h\E=:ke=\E[?1l\E>:\ - :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:\ - :rs=\E[r\E<\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l:xn:\ - :AL=\E[%dL:DL=\E[%dM:IC=\E[%d@:DC=\E[%dP:\ - :hs:ts=\E]2;:fs=^G:ds=\E]2;^G: -d0|vt100|vt100-am|vt100am|dec-vt100|dec vt100:\ - :do=^J:co#80:li#24:cl=\E[;H\E[2J:sf=\ED:\ - :le=^H:bs:am:cm=\E[%i%d;%dH:nd=\E[C:up=\E[A:\ - :ce=\E[K:cd=\E[J:so=\E[7m:se=\E[m:us=\E[4m:ue=\E[m:\ - :md=\E[1m:mr=\E[7m:mb=\E[5m:me=\E[m:is=\E[1;24r\E[24;1H:\ - :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:ks=\E[?1h\E=:ke=\E[?1l\E>:\ - :ku=\EOA:kd=\EOB:kr=\EOC:kl=\EOD:kb=^H:\ - :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:pt:sr=\EM:vt#3:xn:\ - :sc=\E7:rc=\E8:cs=\E[%i%d;%dr: - -# - copied the following screen* entries from -# http://www.catb.org/terminfo/termtypes.tc.gz -# Version 11.0.1 -# ("This file deliberately has no copyright. It belongs to no one and -# everyone.") -# -# Entries for use by the `screen' program by Juergen Weigert, -# Michael Schroeder, Oliver Laumann. The screen and -# screen-w entries came with version 3.7.1. The screen2 and screen3 entries -# come from University of Wisconsin and may be older. -# (screen: added :ve: on ANSI model -- esr) -# (screen: added -- TD) - -screen|VT 100/ANSI X3.64 virtual terminal:\ - :am:km:mi:ms:xn:\ - :Co#8:co#80:it#8:li#24:pa#64:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:\ - :F2=\E[24~:IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:\ - :ac=++\054\054--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:eA=\E(B\E)0:ei=\E[4l:\ - :ho=\E[H:im=\E[4h:is=\E)0:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ - :k;=\E[21~:kD=\E[3~:kH=\E[4~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:kr=\EOC:\ - :ks=\E[?1h\E=:ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:nw=\EE:r2=\Ec:rc=\E8:sc=\E7:se=\E[23m:\ - :sf=^J:so=\E[3m:sr=\EM:st=\EH:ta=^I:ue=\E[24m:up=\EM:\ - :us=\E[4m:vb=\Eg:ve=\E[34h\E[?25h:vi=\E[?25l:vs=\E[34l:\ - :tc=ecma+color: - -screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols:\ - :co#132:tc=screen: - -screen2|old VT 100/ANSI X3.64 virtual terminal:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bt=\E[Z:cd=\E[J:\ - :ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:\ - :dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ic=:im=\E[4h:k0=\E~:\ - :k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:k6=\EP:k7=\EQ:k8=\ER:\ - :k9=\E0I:kb=^H:kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:le=^H:\ - :me=\E[m:nd=\E[C:nw=^M^J:r1=\Ec:rc=\E8:sc=\E7:se=\E[23m:\ - :sf=^J:so=\E[3m:sr=\EM:st=\EH:ta=^I:ue=\E[24m:up=\E[A:\ - :us=\E[4m: -# (screen3: removed unknown ":xv:LP:G0:" -- esr) -screen3|older VT 100/ANSI X3.64 virtual terminal:\ - :km:mi:ms:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:\ - :ho=\E[H:im=\E[4h:is=\E)0:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :kb=^H:kd=\EOB:ke=\E>:kl=\EOD:kr=\EOC:ks=\E=:ku=\EOA:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nw=\EE:r1=\Ec:\ - :rc=\E8:sc=\E7:se=\E[23m:sf=^J:so=\E[3m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[24m:up=\EM:us=\E[4m: diff --git a/etc/termcap.big b/etc/termcap.big deleted file mode 100644 index c6c628098..000000000 --- a/etc/termcap.big +++ /dev/null @@ -1,16471 +0,0 @@ -######## TERMINAL TYPE DESCRIPTIONS SOURCE FILE -# -# Version 11.0.1 -# termcap syntax -# -# Eric S. Raymond (current maintainer) -# John Kunze, Berkeley -# Craig Leres, Berkeley -# -# Please e-mail changes to terminfo@thyrsus.com; the old termcap@berkeley.edu -# address is no longer valid. The latest version can always be found at -# . -# -# PURPOSE OF THIS FILE: -# -# This file describes the capabilities of various character-cell terminals, -# as needed by software such as screen-oriented editors. -# -# Other terminfo and termcap files exist, supported by various OS vendors -# or as relics of various older versions of UNIX. This one is the longest -# and most comprehensive one in existence. It subsumes not only the entirety -# of the historical 4.4BSD, GNU, System V and SCO termcap files and the BRL -# termcap file, but also large numbers of vendor-maintained termcap and -# terminfo entries more complete and carefully tested than those in historical -# termcap/terminfo versions. -# -# Pointers to related resources (including the ncurses distribution) may -# be found at . -# -# INTERNATIONALIZATION: -# -# This file uses only the US-ASCII character set (no ISO8859 characters). -# -# This file assumes a US-ASCII character set. If you need to fix this, start -# by global-replacing \E(B and \E)B with the appropriate ISO 6429 enablers -# for your character set. \E(A and \E)A enables the British character set -# with the pound sign at position 2/3. -# -# In a Japanese-processing environment using EUC/Japanese or Shift-JIS, -# C1 characters are considered the first-byte set of the Japanese encodings, -# so \E)0 should be avoided in and initialization strings. -# -# FILE FORMAT: -# -# The version you are looking at may be in any of three formats: master -# (terminfo with OT capabilities), stock terminfo, or termcap. You can tell -# which by the format given in the header above. -# -# The master format is accepted and generated by the terminfo tools in the -# ncurses suite; it differs from stock (System V-compatible) terminfo only -# in that it admits a group of capabilities (prefixed `OT') equivalent to -# various obsolete termcap capabilities. You can, thus, convert from master -# to stock terminfo simply by filtering with `sed "/OT[^,]*,/s///"'; but if -# you have ncurses `tic -I' is nicer (among other things, it automatically -# outputs entries in a canonical form). -# -# The termcap version is generated automatically from the master version -# using tic -C. This filtering leaves in the OT capabilities under their -# original termcap names. All translated entries fit within the 1023-byte -# string-table limit of archaic termcap libraries except where explicitly -# noted below. Note that the termcap translation assumes that your termcap -# library can handle multiple tc capabilities in an entry. 4.4BSD has this -# capability. Older versions of GNU termcap, through 1.3, do not. -# -# For details on these formats, see terminfo(5) in the ncurses distribution, -# and termcap(5) in the 4.4BSD Unix Programmer's Manual. Be aware that 4.4BSD -# curses has been declared obsolete by the caretakers of the 4.4BSD sources -# as of June 1995; they are encouraging everyone to migrate to ncurses. -# -# Note: unlike some other distributed terminfo files (Novell Unix & SCO's), -# no entry in this file has embedded comments. This is so source translation -# to termcap only has to carry over leading comments. Also, no name field -# contains embedded whitespace (such whitespace confuses rdist). -# -# Further note: older versions of this file were often installed with an editor -# script (reorder) that moved the most common terminal types to the front of -# the file. This should no longer be necessary, as the file is now ordered -# roughly by type frequency with ANSI/VT100 and other common types up front. -# -# Some information has been merged in from terminfo files distributed by -# USL and SCO (see COPYRIGHTS AND OTHER DELUSIONS below). Much information -# comes from vendors who maintain official terminfos for their hardware -# (notably DEC and Wyse). -# -# A detailed change history is included at the end of this file. -# -# FILE ORGANIZATION: -# -# Comments in this file begin with # - they cannot appear in the middle -# of a terminfo/termcap entry (this feature had to be sacrificed in order -# to allow standard terminfo and termcap syntax to be generated cleanly from -# the master format). Individual capabilities are commented out by -# placing a period between the colon and the capability name. -# -# The file is divided up into major sections (headed by lines beginning with -# the string "########") and minor sections (beginning with "####"); do -# -# grep "^####" | more -# -# to see a listing of section headings. The intent of the divisions is -# (a) to make it easier to find things, and (b) to order the database so -# that important and frequently-encountered terminal types are near the -# front (so that you'll get reasonable search efficiency from a linear -# search of the termcap form even if you don't use reorder). Minor sections -# usually correspond to manufacturers or standard terminal classes. -# Parenthesized words following manufacturer names are type prefixes or -# product line names used by that manufacturers. -# -# HOW TO READ THE ENTRIES: -# -# The first name in an entry is the canonical name for the model or -# type, last entry is a verbose description. Others are mnemonic synonyms for -# the terminal. -# -# Terminal names look like - -# The part to the left of the dash, if a dash is present, describes the -# particular hardware of the terminal. The part to the right may be used -# for flags indicating special ROMs, extra memory, particular terminal modes, -# or user preferences. -# -# All names should be in lower case, for consistency in typing. -# -# The following are conventionally used suffixes: -# -2p Has two pages of memory. Likewise 4p, 8p, etc. -# -am Enable auto-margin. -# -m Monochrome. Suppress color support -# -mc Magic-cookie. Some terminals (notably older Wyses) can -# only support one attribute without magic-cookie lossage. -# Their base entry is usually paired with another that -# uses magic cookies to support multiple attributes. -# -nam No auto-margin - suppress :am: capability -# -nl No labels - suppress soft labels -# -ns No status line - suppress status line -# -rv Terminal in reverse video mode (black on white) -# -s Enable status line. -# -vb Use visible bell (:vb:) rather than :bl:. -# -w Wide - in 132 column mode. -# If a name has multiple suffixes and one is a line height, that one should -# go first. Thus `aaa-30-s-rv' is recommended over `aaa-s-rv-30'. -# -# Entries with embedded plus signs are designed to be included through use/tc -# capabilities, not used as standalone entries. -# -# To avoid search clashes, some older all-numeric names for terminals have -# been removed (i.e., "33" for the Model 33 Teletype, "2621" for the HP2621). -# All primary names of terminals now have alphanumeric prefixes. -# -# Comments marked "esr" are mostly results of applying the termcap-compiler -# code packaged with ncurses and contemplating the resulting error messages. -# In many cases, these indicated obvious fixes to syntax garbled by the -# composers. In a few cases, I was able to deduce corrected forms for garbled -# capabilities by looking at context. All the information in the original -# entries is preserved in the comments. -# -# In the comments, terminfo capability names are bracketed with <> (angle -# brackets). Termcap capability names are bracketed with :: (colons). -# -# INTERPRETATION OF USER CAPABILITIES -# -# The System V Release 4 and XPG4 terminfo format defines ten string -# capabilities for use by applications, .... In this file, we use -# certain of these capabilities to describe functions which are not covered -# by terminfo. The mapping is as follows: -# -# u9 terminal enquire string (equiv. to ANSI/ECMA-48 DA) -# u8 terminal answerback description -# u7 cursor position request (equiv. to VT100/ANSI/ECMA-48 DSR 6) -# u6 cursor position report (equiv. to ANSI/ECMA-48 CPR) -# -# The terminal enquire string should elicit an answerback response -# from the terminal. Common values for will be ^E (on older ASCII -# terminals) or \E[c (on newer VT100/ANSI/ECMA-48-compatible terminals). -# -# The cursor position request () string should elicit a cursor position -# report. A typical value (for VT100 terminals) is \E[6n. -# -# The terminal answerback description (u8) must consist of an expected -# answerback string. The string may contain the following scanf(3)-like -# escapes: -# -# %c Accept any character -# %[...] Accept any number of characters in the given set -# -# The cursor position report () string must contain two scanf(3)-style -# %d format elements. The first of these must correspond to the Y coordinate -# and the second to the %d. If the string contains the sequence %i, it is -# taken as an instruction to decrement each value after reading it (this is -# the inverse sense from the cup string). The typical CPR value is -# \E[%i%d;%dR (on VT100/ANSI/ECMA-48-compatible terminals). -# -# These capabilities are used by tac(1m), the terminfo action checker -# (distributed with ncurses 5.0). -# -# TABSET FILES -# -# All the entries in this file have been edited to assume that the tabset -# files directory is /usr/share/tabset, in conformance with the File Hierarchy -# Standard for Linux and open-source BSD systems. Some vendors (notably Sun) -# use /usr/lib/tabset or (more recently) /usr/share/lib/tabset. -# -# No curses package we know of actually uses these files. If their location -# is an issue, you will have to hand-patch the file locations before compiling -# this file. -# -# REQUEST FOR CONTACT INFORMATION AND HISTORICAL MATERIAL -# -# As the ANSI/ECMA-48 standard and variants take firmer hold, and as -# character-cell terminals are increasingly replaced by X displays, much of -# this file is becoming a historical document (this is part of the reason for -# the new organization, which puts ANSI types, xterm, Unix consoles, -# and vt100 up front in confidence that this will catch 95% of new hardware). -# -# For the terminal types still alive, I'd like to have manufacturer's -# contact data (Internet address and/or snail-mail + phone). -# -# I'm also interested in enriching the comments so that the latter portions of -# the file do in fact become a potted history of VDT technology as seen by -# UNIX hackers. Ideally, I'd like the headers for each manufacturer to -# include its live/dead/out-of-the-business status, and for as many -# terminal types as possible to be tagged with information like years -# of heaviest use, popularity, and interesting features. -# -# I'm especially interested in identifying the obscure entries listed under -# `Miscellaneous obsolete terminals, manufacturers unknown' before the tribal -# wisdom about them gets lost. If you know a lot about obscure old terminals, -# please go to the terminfo resource page, grab the UFO file (ufo.ti), and -# eyeball it for things you can identify and describe. -# -# If you have been around long enough to contribute, please read the file -# with this in mind and send me your annotations. -# -# COPYRIGHTS AND OTHER DELUSIONS -# -# The BSD ancestor of this file had a standard Regents of the University of -# California copyright with dates from 1980 to 1993. -# -# Some information has been merged in from a terminfo file SCO distributes. -# It has an obnoxious boilerplate copyright which I'm ignoring because they -# took so much of the content from the ancestral BSD versions of this file -# and didn't attribute it, thereby violating the BSD Regents' copyright. -# -# Not that anyone should care. However many valid functions copyrights may -# serve, putting one on a termcap/terminfo file with hundreds of anonymous -# contributors makes about as much sense as copyrighting a wall-full of -# graffiti -- it's legally dubious, ethically bogus, and patently ridiculous. -# -# This file deliberately has no copyright. It belongs to no one and everyone. -# If you claim you own it, you will merely succeed in looking like a fool. -# Use it as you like. Use it at your own risk. Copy and redistribute freely. -# There are no guarantees anywhere. Svaha! -# - -######## ANSI, UNIX CONSOLE, AND SPECIAL TYPES -# -# This section describes terminal classes and brands that are still -# quite common. -# - -#### Specials -# -# Special "terminals". These are used to label tty lines when you don't -# know what kind of terminal is on it. The characteristics of an unknown -# terminal are the lowest common denominator - they look about like a ti 700. -# - -dumb|80-column dumb tty:\ - :am:\ - :co#80:\ - :bl=^G:cr=^M:do=^J:sf=^J: -unknown|unknown terminal type:\ - :gn:tc=dumb: -lpr|printer|line printer:\ - :bs:hc:os:\ - :co#132:li#66:\ - :bl=^G:cr=^M:do=^J:ff=^L:le=^H:sf=^J: -glasstty|classic glass tty interpreting ASCII control characters:\ - :am:bs:\ - :co#80:\ - :bl=^G:cl=^L:cr=^M:do=^J:kd=^J:kl=^H:le=^H:nw=^M^J:ta=^I: -vanilla:\ - :bs:\ - :bl=^G:cr=^M:do=^J:sf=^J: - -#### ANSI.SYS/ISO 6429/ECMA-48 Capabilities -# -# See the end-of-file comment for more on these. -# - -# ANSI capabilities are broken up into pieces, so that a terminal -# implementing some ANSI subset can use many of them. -ansi+local1:\ - :do=\E[B:le=\E[D:nd=\E[C:up=\E[A: -ansi+local:\ - :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:tc=ansi+local1: -ansi+tabs:\ - :bt=\E[Z:ct=\E[2g:st=\EH:ta=^I: -ansi+inittabs:\ - :it#8:tc=ansi+tabs: -ansi+erase:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J: -ansi+rca:\ - :ch=\E[%+^AG:cv=\E[%+^Ad: -ansi+cup:\ - :cm=\E[%i%d;%dH:ho=\E[H: -ansi+rep:\ - :..rp=%p1%c\E[%p2%{1}%-%db: -ansi+idl1:\ - :al=\E[L:dl=\E[M: -ansi+idl:\ - :AL=\E[%dL:DL=\E[%dM:tc=ansi+idl1: -ansi+idc:\ - :IC=\E[%d@:dc=\E[P:ei=\E6:ic=\E[@:im=\E6: -ansi+arrows:\ - :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A: -ansi+sgr|ansi graphic renditions:\ - :mb=\E[5m:me=\E[0m:mk=\E[8m:mr=\E[7m: -ansi+sgrso|ansi standout only:\ - :se=\E[m:so=\E[7m: -ansi+sgrul|ansi underline only:\ - :ue=\E[m:us=\E[4m: -ansi+sgrbold|ansi graphic renditions; assuming terminal has bold; not dim:\ - :md=\E[1m:\ - :..sa=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m:tc=ansi+sgr:tc=ansi+sgrso:tc=ansi+sgrul: -ansi+sgrdim|ansi graphic renditions; assuming terminal has dim; not bold:\ - :mh=\E[2m:\ - :..sa=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p5%t2;%;m:tc=ansi+sgr:tc=ansi+sgrso:tc=ansi+sgrul: -ansi+pp|ansi printer port:\ - :pf=\E[4i:po=\E[5i:ps=\E[0i: -ansi+csr|ansi scroll-region plus cursor save & restore:\ - :cs=\E[%i%d;%dr:rc=\E8:sc=\E7: - -# The IBM PC alternate character set. Plug this into any Intel console entry. -# We use \E[11m for rmacs rather than \E[12m so the string can use the -# ROM graphics for control characters such as the diamond, up- and down-arrow. -# This works with the System V, Linux, and BSDI consoles. It's a safe bet this -# will work with any Intel console, they all seem to have inherited \E[11m -# from the ANSI.SYS de-facto standard. -klone+acs|alternate character set for ansi.sys displays:\ - :ac=+\020\054\021-\030.^Y0\333`\004a\261f\370g\361h\260j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376:\ - :ae=\E[10m:as=\E[11m: - -# Highlight controls corresponding to the ANSI.SYS standard. Most -# console drivers for Intel boxes obey these. Makes the same assumption -# about \E[11m as klone+acs. True ANSI/ECMA-48 would have :se=\E[27m:, -# :ue=\E[24m:, but this isn't a documented feature of ANSI.SYS. -klone+sgr|attribute control for ansi.sys displays:\ - :S2=\E[11m:S3=\E[10m:mb=\E[5m:md=\E[1m:me=\E[0;10m:\ - :mk=\E[8m:mr=\E[7m:\ - :..sa=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m:\ - :se=\E[m:so=\E[7m:ue=\E[m:us=\E[4m:\ - :tc=klone+acs: - -# Highlight controls corresponding to the ANSI.SYS standard. *All* -# console drivers for Intel boxes obey these. Does not assume \E[11m will -# work; uses \E[12m instead, which is pretty bulletproof but loses you the ACS -# diamond and arrow characters under curses. -klone+sgr-dumb|attribute control for ansi.sys displays (no ESC [ 11 m):\ - :as=\E[12m:mb=\E[5m:md=\E[1m:me=\E[0;10m:mk=\E[8m:\ - :mr=\E[7m:\ - :..sa=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;12%;m:\ - :se=\E[m:so=\E[7m:ue=\E[m:us=\E[4m:\ - :tc=klone+acs: - -# KOI8-R (RFC1489) acs (alternate character set) -# From: Qing Long , 24 Feb 1996. -klone+koi8acs|alternate character set for ansi.sys displays with KOI8 charset:\ - :ac=+\020\054\021-\036.^_0\215`\004a\237f\234g\232h\222i\220j\205k\203l\202m\204n\212o\213p\216q\0r\217s\214t\206u\207v\210w\211x\201y\230z\231{\267|\274}L~\225:\ - :ae=\E[10m:as=\E[11m: - -# ANSI.SYS color control. The setab/setaf caps depend on the coincidence -# between SVr4/XPG4's color numbers and ANSI.SYS attributes. Here are longer -# but equivalent strings that don't rely on that coincidence: -# setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -# setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, -# The DOS 5 manual asserts that these sequences meet the ISO 6429 standard. -# They match a subset of ECMA-48. -klone+color|color control for ansi.sys and ISO6429-compatible displays:\ - :Co#8:NC#3:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:op=\E[37;40m: - -# This is better than klone+color, it doesn't assume white-on-black as the -# default color pair, but many `ANSI' terminals don't grok the cap. -ecma+color|color control for ECMA-48-compatible terminals:\ - :Co#8:NC#3:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:op=\E[39;49m: - -# Attribute control for ECMA-48-compatible terminals -ecma+sgr|attribute capabilities for true ECMA-48 terminals:\ - :se=\E[27m:ue=\E[24m:\ - :tc=klone+sgr: - -# For comparison, here are all the capabilities implied by the Intel -# Binary Compatibility Standard (level 2) that fit within terminfo. -# For more detail on this rather pathetic standard, see the comments -# near the end of this file. -ibcs2|Intel Binary Compatibility Standard prescriptions:\ - :AL=\E[%dL:DC=\E[%dP:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:\ - :RA=\E[?7l:RI=\E[%dC:S1=\E=%p1%dg:SA=\E[?7h:SF=\E[%dS:\ - :SR=\E[%dT:UP=\E[%dA:bt=\E[Z:ch=\E[%i%dG:cl=\Ec:\ - :cm=\E[%i%d;%dH:ct=\E[g:cv=\E[%i%dd:ec=\E[%dX:ei=:im=:\ - :rc=\E7:sc=\E7:st=\EH: - -#### ANSI/ECMA-48 terminals and terminal emulators -# -# See near the end of this file for details on ANSI conformance. -# Don't mess with these entries! Lots of other entries depend on them! -# -# This section lists entries in a least-capable to most-capable order. -# if you're in doubt about what `ANSI' matches yours, try them in that -# order and back off from the first that breaks. - -# ansi-mr is for ANSI terminals with ONLY relative cursor addressing -# and more than one page of memory. It uses local motions instead of -# direct cursor addressing, and makes almost no assumptions. It does -# assume auto margins, no padding and/or xon/xoff, and a 24x80 screen. -ansi-mr|mem rel cup ansi:\ - :am:xo:\ - :co#80:li#24:tc=vanilla:tc=ansi+erase:tc=ansi+local1: - -# ansi-mini is a bare minimum ANSI terminal. This should work on anything, but -# beware of screen size problems and memory relative cursor addressing. -ansi-mini|minimum ansi standard terminal:\ - :am:xo:\ - :co#80:li#24:tc=vanilla:tc=ansi+cup:tc=ansi+erase: - -# ansi-mtabs adds relative addressing and minimal tab support -ansi-mtabs|any ansi terminal with pessimistic assumptions:\ - :it#8:\ - :ta=^I:tc=ansi+local1:tc=ansi-mini: - -# ANSI X3.64 from emory!mlhhh (Hugh Hansard) via BRL -# -# The following is an entry for the full ANSI 3.64 (1977). It lacks -# padding, but most terminals using the standard are "fast" enough -# not to require any -- even at 9600 bps. If you encounter problems, -# try including the padding specifications. -# -# Note: the :as: and :ae: specifications are not implemented here, for -# the available termcap documentation does not make clear WHICH alternate -# character set to specify. ANSI 3.64 seems to make allowances for several. -# Please make the appropriate adjustments to fit your needs -- that is -# if you will be using alternate character sets. -# -# There are very few terminals running the full ANSI 3.64 standard, -# so I could only test this entry on one verified terminal (Visual 102). -# I would appreciate the results on other terminals sent to me. -# -# Please report comments, changes, and problems to: -# -# U.S. MAIL: Hugh Hansard -# Box: 22830 -# Emory University -# Atlanta, GA. 30322. -# -# USENET {akgua,msdc,sb1,sb6,gatech}!emory!mlhhh. -# -# (Added vt100 :rc:,:sc: to quiet a tic warning --esr) -ansi77|ansi 3.64 standard 1977 version:\ - :am:bs:mi:\ - :co#80:it#8:li#24:\ - :al=5*\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[;H\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:dc=\E[P:dl=5*\E[M:\ - :do=\E[B:ei=\E[4l:ho=\E[H:im=\E[4h:k1=\EOP:k2=\EOR:k4=\EOS:\ - :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :nd=\E[C:nw=^M\ED:rc=\E8:sc=\E7:se=\E[m:sf=\ED:so=\E[7m:\ - :sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: - -# Procomm and some other ANSI emulations don't recognize all of the ANSI- -# standard capabilities. This entry deletes :UP:, :RI:, :DO:, :LE:, and -# / capabilities, forcing curses to use repetitions of :up:, -# :nd:, :do: and :le:. Also deleted :IC: and :ic:, as QModem up to -# 5.03 doesn't recognize these. Finally, we delete :rp: and :sr:, which seem -# to confuse many emulators. On the other hand, we can count on these programs -# doing :ae:/:as:/:sa:. Older versions of this entry featured -# , but now seems to be more common under -# ANSI.SYS influence. -# From: Eric S. Raymond Oct 30 1995 -pcansi-m|pcansi-mono|ibm-pc terminal programs claiming to be ansi (mono mode):\ - :am:bs:mi:ms:\ - :co#80:it#8:li#24:\ - :al=\E[L:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:ct=\E[2g:dc=\E[P:dl=\E[M:do=\E[B:\ - :ho=\E[H:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=\E[D:nd=\E[C:sf=^J:st=\EH:ta=^I:up=\E[A:\ - :tc=klone+sgr-dumb: -pcansi-25-m|pcansi25m|ibm-pc terminal programs with 25 lines (mono mode):\ - :li#25:tc=pcansi-m: -pcansi-33-m|pcansi33m|ibm-pc terminal programs with 33 lines (mono mode):\ - :li#33:tc=pcansi-m: -pcansi-43-m|ansi43m|ibm-pc terminal programs with 43 lines (mono mode):\ - :li#43:tc=pcansi-m: -# The color versions. All PC emulators do color... -pcansi|ibm-pc terminal programs claiming to be ansi:\ - :tc=klone+color:tc=pcansi-m: -pcansi-25|pcansi25|ibm-pc terminal programs with 25 lines:\ - :li#25:tc=pcansi: -pcansi-33|pcansi33|ibm-pc terminal programs with 33 lines:\ - :li#33:tc=pcansi: -pcansi-43|pcansi43|ibm-pc terminal programs with 43 lines:\ - :li#43:tc=pcansi: - -# ansi-m -- full ANSI X3.64 with ANSI.SYS-compatible attributes, no color. -# If you want pound signs rather than dollars, replace `B' with `A' -# in the , , , and capabilities. -# From: Eric S. Raymond Nov 6 1995 -ansi-m|ansi-mono|ANSI X3.64-1979 terminal with ANSI.SYS compatible attributes:\ - :5i:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ - :cb=\E[1K:ch=\E[%i%dG:ct=\E[2g:cv=\E[%i%dd:ec=\E[%dX:ei=:\ - :im=:kB=\E[Z:kI=\E[L:kb=^H:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:\ - :nw=\r\E[S:pf=\E[4i:po=\E[5i:..rp=%p1%c\E[%p2%{1}%-%db:\ - :s0=\E(B:s1=\E)B:s2=\E*B:s3=\E+B:ta=\E[I:\ - :tc=pcansi-m: - -# ansi -- this terminfo expresses the largest subset of X3.64 that will fit in -# standard terminfo. Assumes ANSI.SYS-compatible attributes and color. -# From: Eric S. Raymond Nov 6 1995 -ansi|ansi/pc-term compatible with color:\ - :u6=\E[%i%d;%dR:u7=\E[6n:..u8=\E[?%[;0123456789]c:\ - :u9=\E[c:\ - :tc=ecma+color:tc=klone+sgr:tc=ansi-m: - -# ansi-generic is a vanilla ANSI terminal. This is assumed to implement -# all the normal ANSI stuff with no extensions. It assumes -# insert/delete line/char is there, so it won't work with -# vt100 clones. It assumes video attributes for bold, blink, -# underline, and reverse, which won't matter much if the terminal -# can't do some of those. Padding is assumed to be zero, which -# shouldn't hurt since xon/xoff is assumed. -ansi-generic|generic ansi standard terminal:\ - :am:xo:\ - :co#80:li#24:tc=vanilla:tc=ansi+csr:tc=ansi+cup:\ - :tc=ansi+rca:tc=ansi+erase:tc=ansi+tabs:tc=ansi+local:\ - :tc=ansi+idc:tc=ansi+idl:tc=ansi+rep:tc=ansi+sgrbold:\ - :tc=ansi+arrows: - -#### Linux consoles -# - -# This entry is good for the 1.2.13 or later version of the Linux console. -# -# *************************************************************************** -# * * -# * WARNING: * -# * Linuxes come with a default keyboard mapping kcbt=^I. This entry, in * -# * response to user requests, assumes kcbt=\E[Z, the ANSI/ECMA reverse-tab * -# * character. Here are the keymap replacement lines that will set this up: * -# * * -# keycode 15 = Tab Tab -# alt keycode 15 = Meta_Tab -# shift keycode 15 = F26 -# string F26 ="\033[Z" -# * * -# * This has to use a key slot which is unfortunate (any unused one will * -# * do, F26 is the higher-numbered one). The change ought to be built * -# * into the kernel tables. * -# * * -# *************************************************************************** -# -# The 1.3.x kernels add color-change capabilities; if yours doesn't have this -# and it matters, turn off . The %02x escape used to implement this is -# not back-portable to SV curses and not supported in ncurses versions before -# 1.9.9. All linux kernels since 1.2.13 (at least) set the screen size -# themselves; this entry assumes that capability. -# -# This entry is good for the 1.2.13 or later version of the Linux console. -# -# *************************************************************************** -# * * -# * WARNING: * -# * Linuxes come with a default keyboard mapping kcbt=^I. This entry, in * -# * response to user requests, assumes kcbt=\E[Z, the ANSI/ECMA reverse-tab * -# * character. Here are the keymap replacement lines that will set this up: * -# * * -# keycode 15 = Tab Tab -# alt keycode 15 = Meta_Tab -# shift keycode 15 = F26 -# string F26 ="\033[Z" -# * * -# * This has to use a key slot which is unfortunate (any unused one will * -# * do, F26 is the higher-numbered one). The change ought to be built * -# * into the kernel tables. * -# * * -# *************************************************************************** -# -# The 1.3.x kernels add color-change capabilities; if yours doesn't have this -# and it matters, turn off . The %02x escape used to implement this is -# not back-portable to SV curses and not supported in ncurses versions before -# 1.9.9. All linux kernels since 1.2.13 (at least) set the screen size -# themselves; this entry assumes that capability. -# -# The 2.2.x kernels add a private mode that sets the cursor type; use that to -# get a block cursor for cvvis. -# reported by Frank Heckenbach . -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -linux|linux console:\ - :am:eo:mi:ms:xn:xo:\ - :it#8:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:K2=\E[G:al=\E[L:\ - :bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ec=\E[%dX:\ - :ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:k1=\E[[A:k2=\E[[B:\ - :k3=\E[[C:k4=\E[[D:k5=\E[[E:k6=\E[17~:k7=\E[18~:k8=\E[19~:\ - :k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=\177:\ - :kd=\E[B:kh=\E[1~:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mh=\E[2m:\ - :mr=\E[7m:nd=\E[C:nw=^M^J:rc=\E8:sc=\E7:se=\E[27m:sf=^J:\ - :sr=\EM:st=\EH:ta=^I:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=200\E[?5h\E[?5l:ve=\E[?25h\E[?0c:vi=\E[?25l\E[?1c:\ - :vs=\E[?25h\E[?8c:\ - :tc=klone+sgr:tc=ecma+color: -linux-m|Linux console no color:\ - :Co@:pa@:\ - :AB@:AF@:Sb@:Sf@:tc=linux: -linux-c-nc|linux console 1.3.x hack for ncurses only:\ - :cc:\ - :..Ic=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x:\ - :oc=\E]R:\ - :tc=linux: -# From: Dennis Henriksen , 9 July 1996 -linux-c|linux console 1.3.6+ with private palette for each virtual console:\ - :cc:\ - :Co#8:pa#64:\ - :..Ic=\E]P%?%p1%{9}%>%t%p1%{10}%-%'a'%+%c%e%p1%d%;%p2%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%p3%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%p4%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;:\ - :oc=\E]R:\ - :tc=linux: - -# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file -linux-nic|linux with ich/ich1 suppressed for non-curses programs:\ - :IC@:ei=:ic@:im=:\ - :tc=linux: - -# This assumes you have used setfont(8) to load one of the Linux koi8-r fonts. -# acsc entry from Pavel Roskin" , 29 Sep 1997. -linux-koi8|linux with koi8 alternate character set:\ - :ac=+\020\054\021-\030.^Y0\215`\004a\221f\234g\237h\220i\276j\205k\203l\202m\204n\212o~p\0q\0r\0s_t\206u\207v\211w\210x\201y\230z\231{\267|\274~\224:tc=linux:\ - :tc=klone+koi8acs: - -# Another entry for KOI8-r with Qing Long's acsc. -# (which one better complies with the standard?) -linux-koi8r|linux with koi8-r alternate character set:\ - :tc=linux:tc=klone+koi8acs: - -# Entry for the latin1 and latin2 fonts -linux-lat|linux with latin1 or latin2 alternate character set:\ - :ac=+\020\054\021-\030.^Y0\333`\004a\013f\370g\361h\260i\316j\211k\214l\206m\203n\305o~p\304q\212r\304s_t\207u\215v\301w\302x\205y\363z\362{\343|\330}\234~\376:\ - :tc=linux: - -#### NetBSD consoles -# -# pcvt termcap database entries (corresponding to release 3.31) -# Author's last edit-date: [Fri Sep 15 20:29:10 1995] -# -# (For the terminfo master file, I translated these into terminfo syntax. -# Then I dropped all the pseudo-HP entries. we don't want and can't use -# the :Xs: flag. Then I split :is: into a size-independent :i1: and a -# size-dependent :is:. Finally, I added / -- esr) - -# NOTE: :ic: has been taken out of this entry. for reference, it should -# be . For discussion, see ICH/ICH1 VERSUS RMIR/SMIR below. -# (esr: added :vi: and :ve: to resolve NetBSD Problem Report #4583) -pcvtXX|pcvt vt200 emulator (DEC VT220):\ - :am:km:mi:ms:xn:\ - :it#8:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:SF=\E[%dS:\ - :SR=\E[%dT:UP=\E[%dA:\ - :ac=++\054\054--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz~~:\ - :ae=\E(B:al=\E[L:as=\E(0:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ho=\E[H:\ - :i1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:im=\E[4h:\ - :k1=\E[17~:k2=\E[18~:k3=\E[19~:k4=\E[20~:k5=\E[21~:\ - :k6=\E[23~:k7=\E[24~:k8=\E[25~:kD=\E[3~:kH=\E[4~:kI=\E[2~:\ - :kN=\E[6~:kP=\E[5~:kb=\177:kd=\EOB:ke=\E[?1l\E>:kh=\E[1~:\ - :kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nw=\EE:\ - :r1=\Ec\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :rf=/usr/share/tabset/vt100:sc=\E7:se=\E[27m:sf=\ED:\ - :so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[24m:up=\E[A:us=\E[4m:\ - :ve=\E[?25h:vi=\E[?25l: - -# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) -# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and -# 50 lines entries; 80 columns -pcvt25|dec vt220 emulation with 25 lines:\ - :co#80:li#25:\ - :is=\E[1;25r\E[25;1H:tc=pcvtXX: -pcvt28|dec vt220 emulation with 28 lines:\ - :co#80:li#28:\ - :is=\E[1;28r\E[28;1H:tc=pcvtXX: -pcvt35|dec vt220 emulation with 35 lines:\ - :co#80:li#35:\ - :is=\E[1;35r\E[35;1H:tc=pcvtXX: -pcvt40|dec vt220 emulation with 40 lines:\ - :co#80:li#40:\ - :is=\E[1;40r\E[40;1H:tc=pcvtXX: -pcvt43|dec vt220 emulation with 43 lines:\ - :co#80:li#43:\ - :is=\E[1;43r\E[43;1H:tc=pcvtXX: -pcvt50|dec vt220 emulation with 50 lines:\ - :co#80:li#50:\ - :is=\E[1;50r\E[50;1H:tc=pcvtXX: - -# NetBSD/FreeBSD vt220 terminal emulator console (pc keyboard & monitor) -# termcap entries for pure VT220-Emulation and 25, 28, 35, 40, 43 and -# 50 lines entries; 132 columns -pcvt25w|dec vt220 emulation with 25 lines and 132 cols:\ - :co#132:li#25:\ - :is=\E[1;25r\E[25;1H:tc=pcvtXX: -pcvt28w|dec vt220 emulation with 28 lines and 132 cols:\ - :co#132:li#28:\ - :is=\E[1;28r\E[28;1H:tc=pcvtXX: -pcvt35w|dec vt220 emulation with 35 lines and 132 cols:\ - :co#132:li#35:\ - :is=\E[1;35r\E[35;1H:tc=pcvtXX: -pcvt40w|dec vt220 emulation with 40 lines and 132 cols:\ - :co#132:li#40:\ - :is=\E[1;40r\E[40;1H:tc=pcvtXX: -pcvt43w|dec vt220 emulation with 43 lines and 132 cols:\ - :co#132:li#43:\ - :is=\E[1;43r\E[43;1H:tc=pcvtXX: -pcvt50w|dec vt220 emulation with 50 lines and 132 cols:\ - :co#132:li#50:\ - :is=\E[1;50r\E[50;1H:tc=pcvtXX: - -# Terminfo entries to enable the use of the ncurses library in colour on a -# NetBSD-arm32 console (only tested on a RiscPC). -# Created by Dave Millen 22.07.98 -# modified codes for setf/setb to setaf/setab, then to klone+color, corrected -# typo in invis - TD -arm100|arm100-am|Arm(RiscPC) ncurses compatible (for 640x480):\ - :am:ms:ut:xn:xo:\ - :co#80:it#8:li#30:\ - :@8=\E[M:DO=\E[%dB:K1=\E[q:K2=\E[r:K3=\E[s:K4=\E[p:K5=\E[n:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:as=^N:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:do=^J:\ - :eA=\E(B\E)0:ho=\E[H:k0=\E[y:k1=\E[P:k2=\E[Q:k3=\E[R:\ - :k4=\E[S:k5=\E[t:k6=\E[u:k7=\E[v:k8=\E[l:k9=\E[w:k;=\E[x:\ - :kb=^H:kd=\E[B:ke=\E[?1l\E>:kl=\E[D:kr=\E[C:ks=\E[?1h\E=:\ - :ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m\017:mk=\E[8m:\ - :mr=\E[6m:nd=\E[C:r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ - :rc=\E8:\ - :..sa=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:\ - :up=\E[A:us=\E[4m:\ - :tc=ecma+sgr:tc=klone+color: -arm100-w|arm100-wam|Arm(RiscPC) ncurses compatible (for 1024x768):\ - :co#132:li#50:tc=arm100: - -# NetBSD/x68k console vt200 emulator. This port runs on a 68K machine -# manufactured by Sharp for the Japenese market. -# From Minoura Makoto , 12 May 1996 -x68k|x68k-ite|NetBSD/x68k ITE:\ - :co#96:li#32:\ - :%1=\E[28~:kC=\E[9~:tc=vt220: - -# : -# Entry for the DNARD OpenFirmware console, close to ANSI but not quite. -# -# (still unfinished, but good enough so far.) -ofcons:\ - :bw:\ - :co#80:li#30:\ - :AL=\233%dL:DC=\233%dP:DL=\233%dM:DO=\233%dB:IC=\233%d@:\ - :LE=\233%dD:RI=\233%dC:UP=\233%dA:al=\233L:bl=^G:cd=\233J:\ - :ce=\233K:cl=^L:cm=\233%i%d;%dH:cr=^M:dc=\233P:dl=\233M:\ - :do=\233B:ei=:ic=\233@:im=:k1=\2330P:k2=\2330Q:k3=\2330W:\ - :k4=\2330x:k5=\2330t:k6=\2330u:k7=\2330q:k8=\2330r:\ - :k9=\2330p:k;=\2330M:kD=\233P:kN=\233/:kP=\233?:kb=^H:\ - :kd=\233B:kl=\233D:kr=\233C:ku=\233A:le=\233D:mb=\2337;2m:\ - :md=\2331m:me=\2330m:mh=\2332m:mk=\2338m:mr=\2337m:\ - :nd=\233C:nw=^M^J:se=\2330m:sf=^J:ta=^I:ue=\2330m:up=\233A:\ - :vb=^G: - -# NetBSD "wscons" emulator in vt220 mode -# These are micro-minimal and probably need to be redone for real -# after the manner of the pcvt entries. -wsvt25|NetBSD wscons in 25 line DEC VT220 mode:\ - :co#80:li#25:tc=vt220: - -wsvt25m|NetBSD wscons in 25 line DEC VT220 mode with Meta:\ - :km:\ - :co#80:li#25:tc=vt220: - -# `rasterconsole' provided by 4.4BSD, NetBSD and OpenBSD on SPARC, and -# DECstation/pmax. -rcons|BSD rasterconsole:\ - :tc=sun-il: -# Color version of above. Color currenly only provided by NetBSD. -rcons-color|BSD rasterconsole with ANSI color:\ - :ut:\ - :Co#8:pa#64:\ - :AB=\E[4%dm:AF=\E[3%dm:op=\E[m:tc=rcons: - -#### FreeBSD console entries -# -# From: Andrey Chernov 29 Mar 1996 -# Andrey Chernov maintains the FreeBSD termcap distributions. -# -# Note: Users of FreeBSD 2.1.0 and older versions must either upgrade -# or comment out the :cb: capability in the console entry. -# -# Alexander Lukyanov reports: -# I have seen FreeBSD-2.1.5R... The old el1 bug changed, but it is still there. -# Now el1 clears not only to the line beginning, but also a large chunk -# of previous line. But there is another bug - ech does not work at all. -# - -# for syscons -# common entry without semigraphics -# Bug: The capability resets attributes. -# Bug? The ech and el1 attributes appear to move the cursor in some cases; for -# instance el1 does if the cursor is moved to the right margin first. Removed -# by T.Dickey 97/5/3 (ech=\E[%p1%dX, el1=\E[1K) -# -# Setting colors turns off reverse; we cannot guarantee order, so use ncv. -# Note that this disables standout with color. -cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode):\ - :NP:am:bw:eo:ms:ut:\ - :Co#8:NC#21:co#80:it#8:li#25:pa#64:\ - :@7=\E[F:AB=\E[4%p1%dm:AF=\E[3%p1%dm:AL=\E[%dL:DC=\E[%dP:\ - :DL=\E[%dM:DO=\E[%dB:F1=\E[W:F2=\E[X:IC=\E[%d@:K2=\E[E:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ - :al=\E[L:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:ch=\E[%i%d`:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cv=\E[%i%dd:dc=\E[P:\ - :dl=\E[M:do=\E[B:ei=:ho=\E[H:ic=\E[@:im=:k1=\E[M:k2=\E[N:\ - :k3=\E[O:k4=\E[P:k5=\E[Q:k6=\E[R:k7=\E[S:k8=\E[T:k9=\E[U:\ - :k;=\E[V:kB=\E[Z:kD=\177:kI=\E[L:kN=\E[G:kP=\E[I:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mh=\E[30;1m:mr=\E[7m:nd=\E[C:nw=\E[E:\ - :op=\E[x:r1=\E[x\E[m\Ec:se=\E[m:sf=\E[S:so=\E[7m:sr=\E[T:\ - :ta=^I:up=\E[A:ve=\E[=0C:vs=\E[=1C: -cons25|ansis|ansi80x25|freebsd console (25-line ansi mode):\ - :ac=-\030.^Y0\333`\004a\260f\370g\361h\261i\025j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263y\363z\362~\371:\ - :tc=cons25w: -cons25-m|ansis-mono|ansi80x25-mono|freebsd console (25-line mono ansi mode):\ - :Co@:pa@:\ - :AB@:AF@:md@:mh@:op@:ue=\E[m:us=\E[4m:tc=cons25: -cons30|ansi80x30|freebsd console (30-line ansi mode):\ - :li#30:tc=cons25: -cons30-m|ansi80x30-mono|freebsd console (30-line mono ansi mode):\ - :li#30:tc=cons25-m: -cons43|ansi80x43|freebsd console (43-line ansi mode):\ - :li#43:tc=cons25: -cons43-m|ansi80x43-mono|freebsd console (43-line mono ansi mode):\ - :li#43:tc=cons25-m: -cons50|ansil|ansi80x50|freebsd console (50-line ansi mode):\ - :li#50:tc=cons25: -cons50-m|ansil-mono|ansi80x50-mono|freebsd console (50-line mono ansi mode):\ - :li#50:tc=cons25-m: -cons60|ansi80x60|freebsd console (60-line ansi mode):\ - :li#60:tc=cons25: -cons60-m|ansi80x60-mono|freebsd console (60-line mono ansi mode):\ - :li#60:tc=cons25-m: -cons25r|pc3r|ibmpc3r|cons25-koi8-r|freebsd console w/koi8-r cyrillic:\ - :ac=-\030.^Y0\215`\004a\220f\234h\221i\025j\205k\203l\202m\204n\212q\0t\206u\207v\211w\210x\201y\230z\231~\225:\ - :tc=cons25w: -cons25r-m|pc3r-m|ibmpc3r-mono|cons25-koi8r-m|freebsd console w/koi8-r cyrillic (mono):\ - :Co@:pa@:\ - :AB@:AF@:op@:ue=\E[m:us=\E[4m:tc=cons25r: -cons50r|cons50-koi8r|freebsd console w/koi8-r cyrillic (50 lines):\ - :li#50:tc=cons25r: -cons50r-m|cons50-koi8r-m|freebsd console w/koi8-r cyrillic (50-line mono):\ - :li#50:tc=cons25r-m: -cons60r|cons60-koi8r|freebsd console w/koi8-r cyrillic (60 lines):\ - :li#60:tc=cons25r: -cons60r-m|cons60-koi8r-m|freebsd console w/koi8-r cyrillic (60-line mono):\ - :li#60:tc=cons25r-m: -# ISO 8859-1 FreeBSD console -cons25l1|cons25-iso8859|freebsd console w/iso 8859-1 chars:\ - :ac=+\253\054\273-\030.\031`\201a\202f\207g\210i\247j\213k\214l\215m\216n\217o\220p\221q\222r\223s\224t\225u\226v\227w\230x\231y\232z\233~\237:\ - :tc=cons25w: -cons25l1-m|cons25-iso-m|freebsd console w/iso 8859-1 chars (mono):\ - :Co@:pa@:\ - :AB@:AF@:md@:mh@:op@:ue=\E[m:us=\E[4m:tc=cons25l1: -cons50l1|cons50-iso8859|freebsd console w/iso 8859-1 chars (50 lines):\ - :li#50:tc=cons25l1: -cons50l1-m|cons50-iso-m|freebsd console w/iso 8859-1 chars (50-line mono):\ - :li#50:tc=cons25l1-m: -cons60l1|cons60-iso|freebsd console w/iso 8859-1 chars (60 lines):\ - :li#60:tc=cons25l1: -cons60l1-m|cons60-iso-m|freebsd console w/iso 8859-1 chars (60-line mono):\ - :li#60:tc=cons25l1-m: - -#### 386BSD and BSD/OS Consoles -# - -# This was the original 386BSD console entry (I think). -# Some places it's named oldpc3|oldibmpc3. -# From: Alex R.N. Wetmore -origpc3|origibmpc3|IBM PC 386BSD Console:\ - :am:bw:eo:xo:\ - :co#80:li#25:\ - :ac=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263:\ - :cd=\E[J:ce=\E[K:cl=\Ec:cm=\E[%i%2;%2H:do=\E[B:ho=\E[H:\ - :kd=\E[B:kh=\E[Y:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:md=\E[7m:\ - :me=\E[m\E[1;0x\E[2;7x:nd=\E[C:se=\E[1;0x\E[2;7x:\ - :sf=\E[S:so=\E[1;7x\E[2;0x:sr=\E[T:ue=\E[1;0x\E[2;7x:\ - :up=\E[A:us=\E[1;7x\E[2;0x: - -# description of BSD/386 console emulator in version 1.0 (supplied by BSDI) -oldpc3|oldibmpc3|old IBM PC BSD/386 Console:\ - :km:\ - :li#25:\ - :al=\E[L:bl=^G:cr=^M:dl=\E[M:do=^J:kH=\E[F:kI=\E[L:kN=\E[G:\ - :kP=\E[I:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :md=\E[=15F:me=\E[=R:mh=\E[=8F:nw=^M^J:sf=^J:ta=^I: - -# Description of BSD/OS console emulator in version 1.1, 2.0, 2.1 -# Note, the emulator supports many of the additional console features -# listed in the iBCS2 (e.g. character-set selection) though not all -# are described here. This entry really ought to be upgraded. -# Also note, the console will also work with fewer lines after doing -# "stty rows NN", e.g. to use 24 lines. -# (Color support from Kevin Rosenberg , 2 May 1996) -# Bug: The capability resets attributes. -bsdos-pc-nobold|BSD/OS PC console w/o bold:\ - :am:eo:km:xo:\ - :co#80:it#8:li#25:\ - :AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\ - :UP=\E[%dA:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\Ec:\ - :cm=\E[%i%d;%dH:cr=^M:dl=\E[M:do=^J:ho=\E[H:kH=\E[F:\ - :kI=\E[L:kN=\E[G:kP=\E[I:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=^H:nd=\E[C:nw=^M^J:rc=\E8:\ - :..sa=\E[0;10%?%p1%t;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m%?%p5%t\E[=8F%;:\ - :sc=\E7:sf=^J:ta=^I:up=\E[A:\ - :tc=klone+sgr:tc=klone+color: -bsdos-pc|IBM PC BSD/OS Console:\ - :..sa=\E[0;10%?%p1%t;7%;%?%p2%t;1%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m:tc=bsdos-pc-nobold: - -# Old names for BSD/OS PC console used in releases before 4.1. -pc3|BSD/OS on the PC Console:\ - :tc=bsdos-pc-nobold: -ibmpc3|pc3-bold|BSD/OS on the PC Console with bold instead of underline:\ - :tc=bsdos-pc: - -# BSD/OS on the SPARC -bsdos-sparc|Sun SPARC BSD/OS Console:\ - :tc=sun: - -# BSD/OS on the PowerPC -bsdos-ppc|PowerPC BSD/OS Console:\ - :tc=bsdos-pc: - -#### DEC VT100 and compatibles -# -# DEC terminals from the vt100 forward are collected here. Older DEC terminals -# and micro consoles can be found in the `obsolete' section. More details on -# the relationship between the VT100 and ANSI X3.64/ISO 6429/ECMA-48 may be -# found near the end of this file. -# -# Except where noted, these entries are DEC's official terminfos. -# Contact Bill Hedberg of Terminal Support -# Engineering for more information. Updated terminfos and termcaps -# are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. -# -# In October 1995 DEC sold its terminals business, including the VT and Dorio -# line and trademark, to SunRiver Data Systems. SunRiver has since changed -# its name to Boundless Technologies; see http://www.boundless.com. -# - -# NOTE: Any VT100 emulation, whether in hardware or software, almost -# certainly includes what DEC called the `Level 1 editing extension' codes; -# only the very oldest VT100s lacked these and there probably aren't any of -# those left alive. To capture these, use one of the VT102 entries. -# -# Note that the :xn: glitch in vt100 is not quite the same as on the Concept, -# since the cursor is left in a different position while in the -# weird state (concept at beginning of next line, vt100 at end -# of this line) so all versions of vi before 3.7 don't handle -# :xn: right on vt100. The correct way to handle :xn: is when -# you output the char in column 80, immediately output CR LF -# and then assume you are in column 1 of the next line. If :xn: -# is on, am should be on too. -# -# I assume you have smooth scroll off or are at a slow enough baud -# rate that it doesn't matter (1200? or less). Also this assumes -# that you set auto-nl to "on", if you set it off use vt100-nam -# below. -# -# The padding requirements listed here are guesses. It is strongly -# recommended that xon/xoff be enabled, as this is assumed here. -# -# The vt100 uses and rather than :is:/:ct:/:st: because the -# tab settings are in non-volatile memory and don't need to be -# reset upon login. Also setting the number of columns glitches -# the screen annoyingly. You can type "reset" to get them set. -# -# The VT100 series terminals have cursor ("arrows") keys which can operate -# in two different modes: Cursor Mode and Application Mode. Cursor Mode -# is the reset state, and is assumed to be the normal state. Application -# Mode is the "set" state. In Cursor Mode, the cursor keys transmit -# "Esc [ {code}" sequences, conforming to ANSI standards. In Application -# Mode, the cursor keys transmit "Esc O " sequences. Application Mode -# was provided primarily as an aid to the porting of VT52 applications. It is -# assumed that the cursor keys are normally in Cursor Mode, and expected that -# applications such as vi will always transmit the :ks: string. Therefore, -# the definitions for the cursor keys are made to match what the terminal -# transmits after the :ks: string is transmitted. If the :ks: string -# is a null string or is not defined, then cursor keys are assumed to be in -# "Cursor Mode", and the cursor keys definitions should match that assumption, -# else the appication may fail. It is also expected that applications will -# always transmit the :ke: string to the terminal before they exit. -# -# The VT100 series terminals have an auxilliary keypad, commonly referred to as -# the "Numeric Keypad", because it is a cluster of numeric and function keys. -# The Numeric Keypad which can operate in two different modes: Numeric Mode and -# Application Mode. Numeric Mode is the reset state, and is assumed to be -# the normal state. Application Mode is the "set" state. In Numeric Mode, -# the numeric and punctuation keys transmit ASCII 7-bit characters, and the -# Enter key transmits the same as the Return key (Note: the Return key -# can be configured to send either LF (\015) or CR LF). In Application Mode, -# all the keypad keys transmit "Esc O {code}" sequences. The PF1 - PF4 keys -# always send the same "Esc O {code}" sequences. It is assumed that the keypad -# is normally in Numeric Mode. If an application requires that the keypad be -# in Application Mode then it is expected that the user, or the application, -# will set the TERM environment variable to point to a terminfo entry which has -# defined the :ks: string to include the codes that switch the keypad into -# Application Mode, and the terminfo entry will also define function key -# fields to match the Application Mode control codes. If the :ks: string -# is a null string or is not defined, then the keypad is assumed to be in -# Numeric Mode. If the :ks: string switches the keypad into Application -# Mode, it is expected that the :ke: string will contain the control codes -# necessary to reset the keypad to "Normal" mode, and it is also expected that -# applications which transmit the :ks: string will also always transmit the -# :ke: string to the terminal before they exit. -# -# Here's a diagram of the VT100 keypad keys with their bindings. -# The top line is the name of the key (some DEC keyboards have the keys -# labelled somewhat differently, like GOLD instead of PF1, but this is -# the most "official" name). The second line is the escape sequence it -# generates in Application Keypad mode (where "$" means the ESC -# character). The third line contains two items, first the mapping of -# the key in terminfo, and then in termcap. -# _______________________________________ -# | PF1 | PF2 | PF3 | PF4 | -# | $OP | $OQ | $OR | $OS | -# |_kf1__k1_|_kf2__k2_|_kf3__k3_|_kf4__k4_| -# | 7 8 9 - | -# | $Ow | $Ox | $Oy | $Om | -# |_kf9__k9_|_kf10_k;_|_kf0__k0_|_________| -# | 4 | 5 | 6 | , | -# | $Ot | $Ou | $Ov | $Ol | -# |_kf5__k5_|_kf6__k6_|_kf7__k7_|_kf8__k8_| -# | 1 | 2 | 3 | | -# | $Oq | $Or | $Os | enter | -# |_ka1__K1_|_kb2__K2_|_ka3__K3_| $OM | -# | 0 | . | | -# | $Op | $On | | -# |___kc1_______K4____|_kc3__K5_|_kent_@8_| -# -# And here, for those of you with orphaned VT100s lacking documentation, is -# a description of the soft switches invoked when you do `Set Up'. -# -# Scroll 0-Jump Shifted 3 0-# -# | 1-Smooth | 1-British pound sign -# | Autorepeat 0-Off | Wrap Around 0-Off -# | | 1-On | | 1-On -# | | Screen 0-Dark Bkg | | New Line 0-Off -# | | | 1-Light Bkg | | | 1-On -# | | | Cursor 0-Underline | | | Interlace 0-Off -# | | | | 1-Block | | | | 1-On -# | | | | | | | | -# 1 1 0 1 1 1 1 1 0 1 0 0 0 0 1 0 <--Standard Settings -# | | | | | | | | -# | | | Auto XON/XOFF 0-Off | | | Power 0-60 Hz -# | | | 1-On | | | 1-50 Hz -# | | Ansi/VT52 0-VT52 | | Bits Per Char. 0-7 Bits -# | | 1-ANSI | | 1-8 Bits -# | Keyclick 0-Off | Parity 0-Off -# | 1-On | 1-On -# Margin Bell 0-Off Parity Sense 0-Odd -# 1-On 1-Even -# -# The following SET-UP modes are assumed for normal operation: -# ANSI_MODE AUTO_XON/XOFF_ON NEWLINE_OFF 80_COLUMNS -# WRAP_AROUND_ON JUMP_SCROLL_OFF -# Other SET-UP modes may be set for operator convenience or communication -# requirements; I recommend -# AUTOREPEAT_ON BLOCK_CURSOR MARGIN_BELL_OFF SHIFTED_3_# -# Unless you have a graphics add-on such as Digital Engineering's VT640 -# (and even then, whenever it can be arranged!) you should set -# INTERLACE_OFF -# -# (vt100: I added / based on the init string, also :bs:. -- esr) -vt100|vt100-am|dec vt100 (w/advanced video):\ - :am:bs:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:\ - :@8=\EOM:DO=\E[%dB:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:as=^N:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:do=^J:\ - :eA=\E(B\E)0:ho=\E[H:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:\ - :k4=\EOS:k5=\EOt:k6=\EOu:k7=\EOv:k8=\EOl:k9=\EOw:k;=\EOx:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[m\017:mr=\E[7m:\ - :nd=\E[C:r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :..sa=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:\ - :up=\E[A:us=\E[4m: -vt100nam|vt100-nam|vt100 no automargins:\ - :am@:xn@:tc=vt100-am: -vt100-vb|dec vt100 (w/advanced video) & no beep:\ - :bl@:vb=\E[?5h\E[?5l:tc=vt100: - -# Ordinary vt100 in 132 column ("wide") mode. -vt100-w|vt100-w-am|dec vt100 132 cols (w/advanced video):\ - :co#132:li#24:\ - :r2=\E>\E[?3h\E[?4l\E[?5l\E[?8h:tc=vt100-am: -vt100-w-nam|vt100-nam-w|dec vt100 132 cols (w/advanced video no automargin):\ - :co#132:li#14:vt@:\ - :r2=\E>\E[?3h\E[?4l\E[?5l\E[?8h:tc=vt100-nam: - -# vt100 with no advanced video. -vt100-nav|vt100 without advanced video option:\ - :sg#1:\ - :mb@:md@:me@:mr@:sa@:se=\E[m:so=\E[7m:ue@:us@:tc=vt100: -vt100-nav-w|vt100-w-nav|dec vt100 132 cols 14 lines (no advanced video option):\ - :co#132:li#14:tc=vt100-nav: - -# vt100 with one of the 24 lines used as a status line. -# We put the status line on the top. -vt100-s|vt100-s-top|vt100-top-s|vt100 for use with top sysline:\ - :es:hs:\ - :li#23:\ - :cl=\E[2;1H\E[J:cm=\E[%i%+^A;%dH:cs=\E[%i%i%d;%dr:\ - :ds=\E7\E[1;24r\E8:fs=\E8:ho=\E[2;1H:is=\E7\E[2;24r\E8:\ - :ts=\E7\E[1;%p1%dH\E[1K:\ - :tc=vt100-am: - -# Status line at bottom. -# Clearing the screen will clobber status line. -vt100-s-bot|vt100-bot-s|vt100 for use with bottom sysline:\ - :es:hs:\ - :li#23:\ - :ds=\E7\E[1;24r\E8:fs=\E8:is=\E[1;23r\E[23;1H:\ - :ts=\E7\E[24;%p1%dH\E[1K:\ - :tc=vt100-am: - -# Most of the `vt100' emulators out there actually emulate a vt102 -# This entry (or vt102-nsgr) is probably the right thing to use for -# these. -vt102|dec vt102:\ - :mi:\ - :al=\E[L:dc=\E[P:dl=\E[M:ei=\E[4l:im=\E[4h:tc=vt100: -vt102-w|dec vt102 in wide mode:\ - :co#132:\ - :r3=\E[?3h:tc=vt102: - -# Many brain-dead PC comm programs that pretend to be `vt100-compatible' -# fail to interpret the ^O and ^N escapes properly. Symptom: the :me: -# string in the canonical vt100 entry above leaves the screen littered -# with little snowflake or star characters (IBM PC ROM character \017 = ^O) -# after highlight turnoffs. This entry should fix that, and even leave -# ACS support working, at the cost of making multiple-highlight changes -# slightly more expensive. -# From: Eric S. Raymond July 22 1995 -vt102-nsgr|vt102 no sgr (use if you see snowflakes after highlight changes):\ - :me=\E[m:sa@:\ - :tc=vt102: - -# VT125 Graphics CRT. Clear screen also erases graphics -vt125|vt125 graphics terminal:\ - :cl=\E[H\E[2J\EPpS(E)\E\:tc=vt100: - -# This isn't a DEC entry, it came from University of Wisconsin. -# (vt131: I added / based on the init string, also :bs: -- esr) -vt131|dec vt131:\ - :am:bs:xn:\ - :co#80:it#8:li#24:vt#3:\ - :RA=\E[?7h:SA=\E[?7h:bl=^G:cd=50\E[J:ce=3\E[K:\ - :cl=50\E[;H\E[2J:cm=5\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :do=^J:ho=\E[H:is=\E[1;24r\E[24;1H:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:mb=2\E[5m:md=2\E[1m:\ - :me=2\E[m:mr=2\E[7m:nd=2\E[C:nw=^M^J:\ - :r1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:sc=\E7:\ - :se=2\E[m:so=2\E[7m:sr=5\EM:ta=^I:ue=2\E[m:up=2\E[A:\ - :us=2\E[4m: - -# vt132 - like vt100 but slower and has ins/del line and such. -# I'm told that :im:/:ei: are backwards in the terminal from the -# manual and from the ANSI standard, this describes the actual -# terminal. I've never actually used a vt132 myself, so this -# is untested. -# -vt132|DEC vt132:\ - :xn:\ - :al=\E[L:dc=\E[P:dl=\E[M:ei=\E[4h:im=\E[4l:ip=:sf=\n:tc=vt100: - -# This vt220 description maps F5--F9 to the second block of function keys -# at the top of the keyboard. The "DO" key is used as F10 to avoid conflict -# with the key marked (ESC) on the vt220. See vt220d for an alternate mapping. -# PF1--PF4 are used as F1--F4. -# -vt220-old|vt200-old|DEC VT220 in vt100 emulation mode:\ - :am:bs:mi:pt:xn:xo:\ - :co#80:li#24:vt#3:\ - :@7=\E[4~:RA=\E[?7l:SA=\E[?7h:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\E(B:al=\E[L:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ho=\E[H:\ - :if=/usr/share/tabset/vt100:im=\E[4h:\ - :is=\E[1;24r\E[24;1H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :k5=\E[17~:k6=\E[18~:k7=\E[19~:k8=\E[20~:k9=\E[21~:\ - :k;=\E[29~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:\ - :kd=\E[B:kh=\E[1~:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nl=^J:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :rf=/usr/share/tabset/vt100:\ - :..sa=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;:\ - :sc=\E7:se=\E[27m:sf=20\ED:so=\E[7m:sr=14\EM:ta=^I:\ - :ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: - -# A much better description of the VT200/220; used to be vt220-8 -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -vt220|vt200|dec vt220:\ - :am:bs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ec=\E[%dX:\ - :ei=\E[4l:ho=\E[H:if=/usr/share/tabset/vt100:im=\E[4h:\ - :is=\E[?7h\E[>\E[?1h\E F\E[?4l:k1=\EOP:k2=\EOQ:k3=\EOR:\ - :k4=\EOS:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kI=\E[2~:\ - :kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:\ - :ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :nw=\EE:rc=\E8:sc=\E7:se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:\ - :st=\EH:ta=^I:ue=\E[24m:up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l: -vt220-w|vt200-w|DEC vt220 in wide mode:\ - :co#132:\ - :r3=\E[?3h:tc=vt220: -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -vt220-8bit|vt220-8|vt200-8bit|vt200-8|dec vt220/200 in 8-bit mode:\ - :am:bs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:\ - :AL=\233%dL:DC=\233%dP:DL=\233%dM:DO=\233%dB:IC=\233%d@:\ - :LE=\233%dD:RI=\233%dC:UP=\233%dA:ae=^O:al=\233L:as=^N:\ - :bl=^G:cd=\233J:ce=\233K:cl=\233H\233J:cm=\233%i%d;%dH:\ - :cr=^M:cs=\233%i%d;%dr:ct=\2333g:dc=\233P:dl=\233M:do=^J:\ - :ec=\233%dX:ei=\2334l:ho=\233H:\ - :if=/usr/share/tabset/vt100:im=\2334h:\ - :is=\233?7h\233>\233?1h\E F\233?4l:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:k6=\23317~:k7=\23318~:k8=\23319~:\ - :k9=\23320~:kI=\2332~:kN=\2336~:kP=\2335~:kb=^H:kd=\233B:\ - :kh=\233H:kl=\233D:kr=\233C:ku=\233A:le=^H:mb=\2335m:\ - :md=\2331m:me=\233m:mr=\2337m:nd=\233C:nw=\EE:rc=\E8:\ - :sc=\E7:se=\23327m:sf=\ED:so=\2337m:sr=\EM:st=\EH:ta=^I:\ - :ue=\23324m:up=\233A:us=\2334m:vb=\233?5h\233?5l: - -# -# vt220d: -# This vt220 description regards F6--F10 as the second block of function keys -# at the top of the keyboard. This mapping follows the description given -# in the VT220 Programmer Reference Manual and agrees with the labeling -# on some terminals that emulate the vt220. There is no support for an F5. -# See vt220 for an alternate mapping. -# -vt220d|DEC VT220 in vt100 mode with DEC function key labeling:\ - :F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\ - :F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:k5@:\ - :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\ - :tc=vt220-old: - -vt220-nam|v200-nam|VT220 in vt100 mode with no auto margins:\ - :am@:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h:tc=vt220: - -# vt220 termcap written Tue Oct 25 20:41:10 1988 by Alex Latzko -# (not an official DEC entry!) -# The problem with real vt220 terminals is they don't send escapes when in -# in vt220 mode. This can be gotten around two ways. 1> don't send -# escapes or 2> put the vt220 into vt100 mode and use all the nifty -# features of vt100 advanced video which it then has. -# -# This entry takes the view of putting a vt220 into vt100 mode so -# you can use the escape key in emacs and everything else which needs it. -# -# You probably don't want to use this on a VMS machine since VMS will think -# it has a vt220 and will get fouled up coming out of emacs -# -# From: Alexander Latzko , 30 Dec 1996 -# (Added vt100 :rc:,:sc: to quiet a tic warning -- esr) -vt200-js|vt220-js|dec vt200 series with jump scroll:\ - :am:\ - :co#80:\ - :al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:dm=:do=^J:ed=:\ - :ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\E[61"p\E[H\E[?3l\E[?4l\E[?1l\E[?5l\E[?6l\E[?7h\E[?8h\E[?25h\E>\E[m:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kb=^H:kd=\EOB:\ - :ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:\ - :nw=^M\ED:r1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :rf=/usr/lib/tabset/vt100:sc=\E7:se=5\E[27m:sf=\ED:\ - :so=5\E[7m:sr=\EM:ta=^I:ue=\E[24m:up=\E[A:us=\E[4m: - - -# This was DEC's vt320. Use the purpose-built one below instead -#vt320|DEC VT320 in vt100 emulation mode, -# use=vt220, - -# -# Use v320n for SCO's LYRIX. Otherwise, use Adam Thompson's vt320-nam. -# -vt320nam|v320n|DEC VT320 in vt100 emul. mode with NO AUTO WRAP mode:\ - :am@:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h:tc=vt220: - -# These entries are not DEC's official ones, they were purpose-built for the -# VT320. Here are the designer's notes: -# is end on a PC kbd. Actually 'select' on a VT. Mapped to -# 'Erase to End of Field'... since nothing seems to use 'end' anyways... -# khome is Home on a PC kbd. Actually 'FIND' on a VT. -# Things that use usually use tab anyways... and things that don't use -# tab usually use instead... -# kprv is same as tab - Backtab is useless... -# I left out :sa: because of its RIDICULOUS complexity, -# and the resulting fact that it causes the termcap translation of the entry -# to SMASH the 1k-barrier... -# From: Adam Thompson Sept 10 1995 -# (vt320: uncommented :fs:, comnmmented out to avoid a conflict --esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -vt320|vt300|dec vt320 7 bit terminal:\ - :am:es:hs:mi:ms:xn:\ - :co#80:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=\E(B:al=\E[L:as=\E(0:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ec=\E[%dX:\ - :ei=\E[4l:fs=\E[0$}:ho=\E[H:im=\E[4h:\ - :is=\E>\E[?3l\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=\177:kd=\EOB:ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:kr=\EOC:\ - :ks=\E[?1h\E=:ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:nw=\EE:rc=\E8:sc=\E7:se=\E[m:sf=\ED:\ - :so=\E[7m:sr=\EM:st=\EH:ta=^I:ts=\E[1$}\E[H\E[K:ue=\E[m:\ - :up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: -vt320-nam|vt300-nam|dec vt320 7 bit terminal with no am to make SAS happy:\ - :am@:\ - :is=\E>\E[?3l\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H:\ - :r2=\E>\E[?3l\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H:\ - :tc=vt320: -# We have to init 132-col mode, not 80-col mode. -vt320-w|vt300-w|dec vt320 wide 7 bit terminal:\ - :co#132:ws#132:\ - :is=\E>\E[?3h\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H:\ - :r2=\E>\E[?3h\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H:\ - :tc=vt320: -vt320-w-nam|vt300-w-nam|dec vt320 wide 7 bit terminal with no am:\ - :am@:\ - :is=\E>\E[?3h\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H:\ - :r2=\E>\E[?3h\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H:\ - :tc=vt320-w: - -# VT330 and VT340 -- These are ReGIS and SIXEL graphics terminals -# which are pretty much a superset of the VT320. They have the -# host writable status line, yet another different DRCS matrix size, -# and such, but they add the DEC Technical character set, Multiple text -# pages, selectable length pages, and the like. The difference between -# the vt330 and vt340 is that the latter has only 2 planes and a monochrome -# monitor, the former has 4 planes and a color monitor. These terminals -# support VT131 and ANSI block mode, but as with much of these things, -# termcap/terminfo doesn't deal with these features. -# -# Note that this entry is are set up in what was the standard way for GNU -# Emacs v18 terminal modes to deal with the cursor keys in that the arrow -# keys were switched into application mode at the same time the numeric pad -# is switched into application mode. This changes the definitions of the -# arrow keys. Emacs v19 is smarter and mines its keys directly out of -# your termcap or terminfo entry, -# -# From: Daniel Glasser , 13 Oct 1993 -# (vt340: string capability "sb=\E[M" corrected to "sr"; -# also, added / based on the init string -- esr) -vt340|dec-vt340|vt330|dec-vt330|dec vt340 graphics terminal with 24 line page:\ - :am:es:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[L:as=^N:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\ - :dl=\E[M:do=^J:ds=\E[2$~\r\E[1$}\E[K\E[$}:ei=\E[4l:\ - :fs=\E[$}:ho=\E[H:im=\E[4h:\ - :is=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l1=pf1:l2=pf2:l3=pf3:l4=pf4:\ - :le=^H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nw=^M\ED:\ - :r1=\E[?3l:rc=\E8:rf=/usr/share/tabset/vt300:sc=\E7:\ - :se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[2$~\E[1$}\E[1;%dH:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=200\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h: - -# DEC doesn't supply a vt400 description, so we add Daniel Glasser's -# (originally written with vt420 as its primary name, and usable for it). -# -# VT400/420 -- This terminal is a superset of the vt320. It adds the multiple -# text pages and long text pages with selectable length of the vt340, along -# with left and right margins, rectangular area text copy, fill, and erase -# operations, selected region character attribute change operations, -# page memory and rectangle checksums, insert/delete column, reception -# macros, and other features too numerous to remember right now. TERMCAP -# can only take advantage of a few of these added features. -# -# Note that this entry is are set up in what was the standard way for GNU -# Emacs v18 terminal modes to deal with the cursor keys in that the arrow -# keys were switched into application mode at the same time the numeric pad -# is switched into application mode. This changes the definitions of the -# arrow keys. Emacs v19 is smarter and mines its keys directly out of -# your termcap entry, -# -# From: Daniel Glasser , 13 Oct 1993 -# (vt400: string capability ":sb=\E[M:" corrected to ":sr=\E[M:"; -# also, added / based on the init string -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -vt400|vt400-24|dec-vt400|dec vt400 24x80 column autowrap:\ - :am:es:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:\ - :cd=10\E[J:ce=4\E[K:cl=10\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\ - :ds=\E[2$~\r\E[1$}\E[K\E[$}:ei=\E[4l:fs=\E[$}:ho=\E[H:\ - :ic=\E[@:im=\E[4h:\ - :is=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:\ - :me=\E[m:mr=\E[7m:nd=\E[C:nw=^M\ED:rc=\E8:sc=\E7:se=\E[27m:\ - :sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[2$~\E[1$}\E[1;%dH:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=200\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h: - -# (vt420: I removed :k0:, it collided with . I also restored -# a missing :sc: -- esr) -vt420|DEC VT420:\ - :am:mi:xn:xo:\ - :co#80:li#24:vt#3:\ - :*6=\E[4~:@0=\E[1~:RA=\E[?7l:\ - :S5=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ - :SA=\E[?7h:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\E(B:al=\E[L:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ho=\E[H:\ - :i2=\E[?67h\E[64;1"p:if=/usr/share/tabset/vt300:\ - :im=\E[4h:is=\E[1;24r\E[24;1H:k1=\EOP:k2=\EOQ:k3=\EOR:\ - :k4=\EOS:k5=\E[17~:k6=\E[18~:k7=\E[19~:k8=\E[20~:\ - :k9=\E[21~:k;=\E[29~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\E[B:ke=\E>:kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :r3=\E[?67h\E[64;1"p:rc=\E8:rf=/usr/share/tabset/vt300:\ - :..sa=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;:\ - :sc=\E7:se=\E[m:sf=\ED:so=\E[7m:sr=\EM:ta=^I:ue=\E[m:\ - :up=\E[A:us=\E[4m: - -# -# DEC VT220 and up support DECUDK (user-defined keys). DECUDK (i.e., pfx) -# takes two parameters, the key and the string. Translating the key is -# straightforward (keys 1-5 are not defined on real terminals, though some -# emulators define these): -# -# if (key < 16) then value = key; -# else if (key < 21) then value = key + 1; -# else if (key < 25) then value = key + 2; -# else if (key < 27) then value = key + 3; -# else if (key < 30) then value = key + 4; -# else value = key + 5; -# -# The string must be the hexadecimal equivalent, e.g., "5052494E" for "PRINT". -# There's no provision in terminfo for emitting a string in this format, so the -# application has to know it. -# -vt420pc|DEC VT420 w/PC keyboard:\ - :@7=\E[4~:F1=\E[23~:F2=\E[24~:F3=\E[11;2~:F4=\E[12;2~:\ - :F5=\E[13;2~:F6=\E[14;2~:F7=\E[15;2~:F8=\E[17;2~:\ - :F9=\E[18;2~:FA=\E[19;2~:FB=\E[20;2~:FC=\E[21;2~:\ - :FD=\E[23;2~:FE=\E[24;2~:FF=\E[23~:FG=\E[24~:FH=\E[25~:\ - :FI=\E[26~:FJ=\E[28~:FK=\E[29~:FL=\E[31~:FM=\E[32~:\ - :FN=\E[33~:FO=\E[34~:FP=\E[35~:FQ=\E[36~:FR=\E[23;2~:\ - :FS=\E[24;2~:FT=\E[25;2~:FU=\E[26;2~:FV=\E[28;2~:\ - :FW=\E[29;2~:FX=\E[31;2~:FY=\E[32;2~:FZ=\E[33;2~:\ - :Fa=\E[34;2~:Fb=\E[35;2~:Fc=\E[36;2~:\ - :S6=USR_TERM\072vt420pcdos\072:k1=\E[11~:k2=\E[12~:\ - :k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:k;=\E[21~:kD=\177:kh=\E[H:\ - :..px=\EP1;1|%?%{16}%p1%>%t%{0}%e%{21}%p1%>%t%{1}%e%{25}%p1%>%t%{2}%e%{27}%p1%>%t%{3}%e%{30}%p1%>%t%{4}%e%{5}%;%p1%+%d/%p2%s\E\:tc=vt420: - -vt420pcdos|DEC VT420 w/PC for DOS Merge:\ - :li#25:\ - :S1=%?%p2%{19}%=%t\E\023\021%e%p2%{32}%<%t\E%p2%c%e%p2%{127}%=%t\E\177%e%p2%c%;:\ - :S4=\E[?1;2r\E[34h:\ - :S5=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:S6@:\ - :me=\E[m:sa@:\ - :tc=vt420pc: - -vt420f|DEC VT420 with VT kbd; VT400 mode; F1-F5 used as Fkeys:\ - :F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\ - :F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:\ - :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\ - :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\ - :kD=\177:kh=\E[H:l1=\EOP:l2=\EOQ:l3=\EOR:l4=\EOS:\ - :tc=vt420: - -vt510|DEC VT510:\ - :tc=vt420: -vt510pc|DEC VT510 w/PC keyboard:\ - :tc=vt420pc: -vt510pcdos|DEC VT510 w/PC for DOS Merge:\ - :tc=vt420pcdos: - -# VT520/VT525 -# -# The VT520 is a monochrome text terminal capable of managing up to -# four independent sessions in the terminal. It has multiple ANSI -# emulations (VT520, VT420, VT320, VT220, VT100, VT PCTerm, SCO Console) -# and ASCII emulations (WY160/60, PCTerm, 50/50+, 150/120, TVI 950, -# 925 910+, ADDS A2). This terminfo data is for the ANSI emulations only. -# -# Terminal Set-Up is entered by pressing [F3], [Caps Lock]/[F3] or -# [Alt]/[Print Screen] depending upon which keyboard and which -# terminal mode is being used. If Set-Up has been disabled or -# assigned to an unknown key, Set-Up may be entered by pressing -# [F3] as the first key after power up, regardless of keyboard type. -# (vt520: I added / based on the init string, also :sc: -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -vt520|DEC VT520:\ - :am:mi:xn:xo:\ - :co#80:li#24:vt#3:\ - :*6=\E[4~:@0=\E[1~:RA=\E[?7l:\ - :S5=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ - :SA=\E[?7h:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\E(B:al=\E[L:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ho=\E[H:\ - :i2=\E[?67h\E[64;1"p:if=/usr/share/tabset/vt300:\ - :im=\E[4h:is=\E[1;24r\E[24;1H:k0=\E[29~:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:k5=\E[17~:k6=\E[18~:k7=\E[19~:k8=\E[20~:\ - :k9=\E[21~:k;=\E[29~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:r3=\E[?67h\E[64;1"p:\ - :rc=\E8:rf=/usr/share/tabset/vt300:sc=\E7:se=\E[m:sf=\ED:\ - :so=\E[7m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: - -# (vt525: I added / based on the init string; -# removed :se:=\E[m, :ue:=\E[m, added :sc: -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -vt525|DEC VT525:\ - :am:mi:xn:xo:\ - :co#80:li#24:vt#3:\ - :*6=\E[4~:@0=\E[1~:RA=\E[?7l:\ - :S5=\E[?0;0r\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ - :SA=\E[?7h:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\E(B:al=\E[L:as=\E(0:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ho=\E[H:\ - :i2=\E[?67h\E[64;1"p:if=/usr/share/tabset/vt300:\ - :im=\E[4h:is=\E[1;24r\E[24;1H:k0=\E[29~:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:k5=\E[17~:k6=\E[18~:k7=\E[19~:k8=\E[20~:\ - :k9=\E[21~:k;=\E[29~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:r3=\E[?67h\E[64;1"p:\ - :rc=\E8:rf=/usr/share/tabset/vt300:sc=\E7:se=\E[m:sf=\ED:\ - :so=\E[7m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: - -#### VT100 emulations -# - -# John Hawkinson tells us that the EWAN telnet for Windows -# (the best Windows telnet as of September 1995) presents the name `dec-vt100' -# to telnetd. Michael Deutschmann informs us -# that this works best with a stock vt100 entry. -dec-vt100|EWAN telnet's vt100 emulation:\ - :tc=vt100: - -# From: Adrian Garside <94ajg2@eng.cam.ac.uk>, 19 Nov 1996 -dec-vt220|DOS tnvt200 terminal emulator:\ - :am@:tc=vt220: - -# Zstem340 is an (IMHO) excellent VT emulator for PC's. I recommend it to -# anyone who needs PC VT340 emulation. (or anything below that level, for -# that matter -- DEC's ALL-in-1 seems happy with it, as does INFOPLUS's -# RDBM systems, it includes ReGIS and SiXel support! I'm impressed... -# I can send the address if requested. -# (z340: changed garbled \E[5?l to \E[?5l, DEC smooth scroll off -- esr) -# From: Adam Thompson Sept 10 1995 -z340|zstem vt340 terminal emulator 132col 42line:\ - :li#42:\ - :is=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H:\ - :r2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;42r\E[42;1H:\ - :tc=vt320-w: -z340-nam|zstem vt340 terminal emulator 132col 42line (no automatic margins):\ - :am@:\ - :is=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H:\ - :r2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;42r\E[42;1H:\ - :tc=z340: - -# CRT is shareware. It implements some xterm features, including mouse. -crt|crt-vt220|CRT 2.3 emulating VT220:\ - :ms:ut:\ - :Co#8:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:Sb=\E[4%dm:Sf=\E[3%dm:\ - :op=\E[39;49m:st=\EH:u6=\E[%i%d;%dR:u7=\E[6n:u8=\E[?1;2c:\ - :u9=\E[c:\ - :tc=vt220: - -# This entry is for Tera Term Pro version 2.3, for MS-Windows 95/NT written by -# T. Teranishi dated Mar 10, 1998. It is a free software terminal emulator -# (communication program) which supports: -# -# - Serial port connections. -# - TCP/IP (telnet) connections. -# - VT100 emulation, and selected VT200/300 emulation. -# - TEK4010 emulation. -# - File transfer protocols (Kermit, XMODEM, ZMODEM, B-PLUS and -# Quick-VAN). -# - Scripts using the "Tera Term Language". -# - Japanese and Russian character sets. -# -# The program does not come with terminfo or termcap entries. However, the -# emulation (testing with vttest and ncurses) is reasonably close to vt100 (no -# vt52 or doublesize character support; blinking is done with color). Besides -# the HPA, VPA extensions it also implements CPL and CNL. -# -# All of the function keys can be remapped. This description shows the default -# mapping, as installed. Both vt100 PF1-PF4 keys and quasi-vt220 F1-F4 keys -# are supported. F13-F20 are obtained by shifting F3-F10. The editing keypad -# is laid out like vt220, rather than the face codes on the PC keyboard, i.e, -# kfnd Insert -# kslt Delete -# kich1 Home -# kdch1 PageUp -# kpp End -# knp PageDown -# -# ANSI colors are implemented, but cannot be combined with video attributes -# except for reverse. -# -# No fonts are supplied with the program, so the acsc string is chosen to -# correspond with the default Microsoft terminal font. -# -# Tera Term recognizes some xterm sequences, including those for setting and -# retrieving the window title, and for setting the window size (i.e., using -# "resize -s"), though it does not pass SIGWINCH to the application if the -# user resizes the window with the mouse. -teraterm|Tera Term Pro:\ - :km:xo@:\ - :NC#43:vt@:\ - :*6=\E[4~:@0=\E[1~:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\ - :F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\ - :F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:\ - :ac=+\020\054\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376:\ - :al=\E[L:cb=\E[1K:cd=\E[J:ce=\E[K:ch=\E[%i%dG:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cv=\E[%i%dd:dc=\E[P:dl=\E[M:ec=\E[%dX:\ - :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\ - :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:\ - :kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:mb=\E[5m:md=\E[1m:\ - :me=\E[m:mr=\E[7m:nd=\E[C:op=\E[100m:se=\E[27m:so=\E[7m:\ - :sr=\EM:u6=\E[%i%d;%dR:u7=\E[6n:u8=\E[?1;2c:u9=\E[c:\ - :ue=\E[24m:up=\E[A:us=\E[4m:vb=200\E[?5h\E[?5l:\ - :ve=\E[?25h:vi=\E[?25l:\ - :tc=klone+color:tc=vt100: - -# Tested with WinNT 4.0, the telnet application assumes the screensize is -# 25x80. This entry uses the 'Terminal' font, to get line-drawing characters. -ms-vt100|MS telnet imitating dec vt100:\ - :li#25:\ - :ac=+\020\054\021-\030.^Y0\333`\004a\261f\370g\361h\260i\316j\331k\277l\332m\300n\305o~p\304q\304r\304s_t\303u\264v\301w\302x\263y\363z\362{\343|\330}\234~\376:\ - :ct@:u6=\E[%i%d;%dR:u7=\E[6n:u8=\E[?6c:u9=\E[c:\ - :tc=vt100: - -#### X terminal emulators -# -# You can add the following line to your .Xdefaults to change the terminal type -# set by the xterms you start up to my-xterm: -# -# *termName: my-xterm -# -# System administrators can change the default entry for xterm instances -# by adding a similar line to /usr/X11/lib/X11/app-defaults/XTerm. In either -# case, xterm will detect and reject an invalid terminal type, falling back -# to the default of xterm. -# - -# X10/6.6 11/7/86, minus alternate screen, plus (csr) -# (xterm: ":MT:" changed to ":km:"; added / based on init string; -# removed (hs, eslok, tsl=\E[?E\E[?%i%dT, fsl=\E[?F, dsl=\E[?E) -# as these seem not to work -- esr) -x10term|vs100-x10|xterm terminal emulator (X10 window system):\ - :am:bs:km:mi:ms:xn:xo:\ - :co#80:it#8:li#65:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:RA=\E[?7l:SA=\E[?7h:\ - :al=\E[L:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:\ - :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:\ - :im=\E[4h:is=\E\E[m\E[?7h\E[?1;4l:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:\ - :ue=\E[m:up=\E[A:us=\E[4m: -# Compatible with the R5 xterm -# (from the XFree86 3.2 distribution, removed) -# added khome/kend, rmir/smir, rmul/smul based on the R5 xterm code - TD -# corrected typos in rs2 string - TD -xterm-r5|xterm R5 version:\ - :am:bs:km:ms:xn:\ - :co#80:it#8:li#24:\ - :@7=\E[4~:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:\ - :F1=\E[23~:F2=\E[24~:IC=\E[%d@:Km=\E[M:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:ic=\E[@:\ - :im=\E[4h:k0=\EOq:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:\ - :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ - :k;=\E[21~:kA=\E[30~:kD=\E[3~:kE=\E[8~:kI=\E[2~:kL=\E[31~:\ - :kN=\E[6~:kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kh=\E[1~:\ - :kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:md=\E[1m:\ - :me=\E[m:mr=\E[7m:nd=\E[C:\ - :r2=\E>\E[?1;3;4;5;6l\E[4l\E[?7h\E[m\E[r\E[2J\E[H:\ - :rc=\E8:\ - :..sa=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:\ - :up=\E[A:us=\E[4m: -# Compatible with the R6 xterm -# (from XFree86 3.2 distribution, and :it: added, removed) -# added khome/kend - TD -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -xterm-r6|xterm-old|xterm X11R6 version:\ - :am:bs:km:mi:ms:xn:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:\ - :ho=\E[H:im=\E[4h:\ - :is=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:k1=\EOP:\ - :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[15~:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:rc=\E8:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:\ - :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[m:up=\E[A:\ - :us=\E[4m: -# This is the base xterm entry for the xterm supplied with XFree86 3.2 & up. -# The name has been changed and some aliases have been removed. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -xterm-xf86-v32|xterm terminal emulator (XFree86 3.2 Window System):\ - :am:bs:km:mi:ms:xn:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOy:K3=\EOu:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ec=\E[%dX:\ - :ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:\ - :is=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>:\ - :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\ - :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\177:kI=\E[2~:\ - :kN=\E[6~:kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kh=\EOH:\ - :kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:md=\E[1m:\ - :me=\E[m\017:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[27m:\ - :sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:te=\E[2J\E[?47l\E8:\ - :ti=\E7\E[?47h:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h: - -# This is the stock xterm entry supplied with XFree86 3.3, which uses VT100 -# codes for F1-F4 except while in VT220 mode. -xterm-xf86-v33|xterm terminal emulator (XFree86 3.3 Window System):\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :tc=xterm-xf86-v32: - -# This version was released in XFree86 3.3.3 (November 1998). -# Besides providing printer support, it exploits a new feature that allows -# xterm to use terminfo-based descriptions with the titeInhibit resource. -xterm-xf86-v333|xterm terminal emulator (XFree86 3.3.3 Window System):\ - :5i:\ - :*6@:@0@:@7=\E[4~:ei=:ic@:im=:is=\E[\041p\E[?3;4l\E[4l\E>:\ - :kD=\E[3~:kh=\E[1~:mb=\E[5m:mk=\E[8m:pf=\E[4i:po=\E[5i:\ - :ps=\E[i:r1=\Ec:r2=\E[\041p\E[?3;4l\E[4l\E>:\ - :..sa=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;:\ - :te=\E[?1047l\E[?1048l:ti=\E[?1048h\E[?1047h:\ - :tc=xterm-xf86-v33: - -# This beta version will probably be released in XFree86 4.0. -xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System):\ - :@7=\EOF:K1=\EOH:K2=\EOE:K3=\E[5~:K4=\EOF:K5=\E[6~:kD=\177:\ - :kh=\EOH:te=\E[?1049l:ti=\E[?1049h:\ - :tc=xterm-xf86-v333: - -xterm-xfree86|xterm-new|xterm terminal emulator (XFree86 4.0 Window System):\ - :tc=xterm-xf86-v40: - -# From: David J. MacKenzie , 14 Nov 1997 -xterm-xi|xterm on XI Graphics Accelerated X under BSD/OS 3.1:\ - :se=\E[m:ue=\E[m:\ - :tc=xterm-xf86-v33: - -# This is one of the variants of XFree86 3.3 xterm, updated for 4.0 (T.Dickey) -xterm-16color|xterm with 16 colors like aixterm:\ - :Co#16:NC#32:pa#256:\ - :AB=\E[%?%p1%{8}%<%t%p1%{40}%+%e%p1%{92}%+%;%dm:\ - :AF=\E[%?%p1%{8}%<%t%p1%{30}%+%e%p1%{82}%+%;%dm:\ - :..Sb=%p1%{8}%/%{6}%*%{4}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m:\ - :..Sf=%p1%{8}%/%{6}%*%{3}%+\E[%d%p1%{8}%m%Pa%?%ga%{1}%=%t4%e%ga%{3}%=%t6%e%ga%{4}%=%t1%e%ga%{6}%=%t3%e%ga%d%;m:\ - :tc=xterm-xf86-v40: - -# This is another variant, for XFree86 4.0 xterm (T.Dickey) -# This is an 8-bit version of xterm, which emulates DEC vt220 with ANSI color. -# To use it, your decTerminalID resource must be set to 200 or above. -# -# HTS \E H \210 -# RI \E M \215 -# SS3 \E O \217 -# CSI \E [ \233 -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -xterm-8bit|xterm terminal emulator 8-bit controls (X Window System):\ - :am:bs:km:mi:ms:xn:\ - :co#80:it#8:li#24:\ - :AL=\233%dL:DC=\233%dP:DL=\233%dM:DO=\233%dB:IC=\233%d@:\ - :K1=\217w:K2=\217y:K3=\217u:K4=\217q:K5=\217s:LE=\233%dD:\ - :RI=\233%dC:UP=\233%dA:ae=^O:al=\233L:as=^N:bl=^G:bt=\233Z:\ - :cd=\233J:ce=\233K:cl=\233H\2332J:cm=\233%i%d;%dH:cr=^M:\ - :cs=\233%i%d;%dr:ct=\2333g:dc=\233P:dl=\233M:do=^J:\ - :ec=\233%dX:ei=\2334l:ho=\233H:im=\2334h:\ - :is=\E7\E G\233r\233m\233?7h\233?1;3;4;6l\2334l\E8\E>:\ - :k1=\23311~:k2=\23312~:k3=\23313~:k4=\23314~:k5=\23315~:\ - :k6=\23317~:k7=\23318~:k8=\23319~:k9=\23320~:kD=\2333~:\ - :kI=\2332~:kN=\2336~:kP=\2335~:kb=^H:kd=\217B:\ - :ke=\233?1l\E>:kh=\2331~:kl=\217D:kr=\217C:ks=\233?1h\E=:\ - :ku=\217A:le=^H:mb=\2335m:md=\2331m:me=\233m^O:mr=\2337m:\ - :nd=\233C:rc=\E8:sc=\E7:se=\23327m:sf=^J:so=\2337m:sr=\215:\ - :st=\210:ta=^I:te=\233?1049l:ti=\233?1049h:ue=\23324m:\ - :up=\233A:us=\2334m:vb=\233?5h\233?5l:ve=\233?25h:\ - :vi=\233?25l:vs=\233?25h: - -xterm-24|vs100|xterms|xterm terminal emulator (X Window System):\ - :li#24:tc=xterm: - -# This is xterm for ncurses. -xterm|xterm terminal emulator (X Window System):\ - :Km=\E[M:\ - :ac=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :u6=\E[%i%d;%dR:u7=\E[6n:u8=\E[?1;2c:u9=\E[c:\ - :tc=xterm-r6: - -# These entries allow access to the X titlebar and icon name as a status line. -# Note that twm (and possibly window managers descended from it such as tvtwm, -# ctwm, and vtwm) track windows by icon-name; thus, you don't want to mess -# with it. -xterm+sl|access X title line and icon name:\ - :hs:\ - :ws#40:\ - :ds=\E]0;\007:fs=^G:ts=\E]0;:tc=xterm: -xterm+sl-twm|access X title line (pacify twm-descended window managers):\ - :hs:\ - :ws#40:\ - :ds=\E]2;\007:fs=^G:ts=\E]2;:tc=xterm: - -# -# The following xterm variants don't depend on your base version -# -# xterm with bold instead of underline -xterm-bold|xterm terminal emulator (X11R6 Window System) standout w/bold:\ - :so=\E[7m:us=\E[1m:\ - :tc=xterm: -# (kterm: this had extension capabilities ":KJ:TY=ascii:" -- esr) -# (kterm should not invoke DEC Graphics as the alternate character set -# -- Kenji Rikitake) -kterm|kterm kanji terminal emulator (X window system):\ - :es:hs:\ - :Km=\E[M:ac@:ae@:as@:cs=\E[%i%d;%dr:ds=\E[?H:eA@:fs=\E[?F:\ - :op=\E[39;49m:rc=\E8:sc=\E7:ts=\E[?E\E[?%i%dT:\ - :tc=xterm-r6:tc=klone+color: -# See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file -xterm-nic|xterm with ich/ich1 suppressed for non-curses programs:\ - :IC@:ei=:ic@:im=:\ - :tc=xterm: -# From: Mark Sheppard , 4 May 1996 -xterm1|xterm terminal emulator ignoring the alternate screen buffer:\ - :te@:ti@:\ - :tc=xterm: - -# This describes the capabilities of color_xterm, an xterm variant from -# before ECMA-64 color support was folded into the main-line xterm release. -# This entry is straight from color_xterm's maintainer. -# From: Jacob Mandelson , 09 Nov 1996 -# The README's with the distribution also say that it supports SGR 21, 24, 25 -# and 27, but they are not present in the terminfo or termcap. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -color_xterm|cx|cx100|color_xterm color terminal emulator for X:\ - :am:bs:km:mi:ms:xn:\ - :co#80:it#8:li#65:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:\ - :i1=\E[r\E[m\E[?7h\E[?4;6l\E[4l:im=\E[4h:k1=\E[11~:\ - :k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:k9=\E[20~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\EOB:kh=\E[7~:kl=\EOD:kr=\EOC:ku=\EOA:le=^H:\ - :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[27m:\ - :sf=^J:so=\E[7m:sr=\EM:ta=^I:te=\E>\E[?41;1r:\ - :ti=\E[?1;41s\E[?1;41h\E=:ue=\E[24m:up=\E[A:us=\E[4m: - -# The 'nxterm' distributed with Redhat Linux is a slight rehack of -# xterm-sb_right-ansi-3d, which implements ANSI colors, but does not support -# SGR 39 or 49. SGR 0 does reset colors (along with everything else). This -# description is "compatible" with color_xterm, rxvt and XFree86 xterm, except -# that each of those implements the home, end, delete keys differently. -nxterm|xterm-color|generic color xterm:\ - :NC@:\ - :op=\E[m:tc=xterm-r6:tc=klone+color: - -# From: Thomas Dickey 04 Oct 1997 -# Updated: Oezguer Kesim 02 Nov 1997 -# Notes: -# rxvt 2.21b uses -# smacs=\E(B\E)U^N, rmacs=\E(B\E)0^O, -# but some applications don't work with that. -# It also has an AIX extension -# box2=lqkxjmwuvtn, -# and -# ech=\E[%p1%dX, -# but the latter does not work correctly. -# -# The distributed terminfo says it implements hpa and vpa, but they are not -# implemented correctly, using relative rather than absolute positioning. -# -# rxvt is normally configured to look for "xterm" or "xterm-color" as $TERM. -# Since rxvt is not really compatible with xterm, it should be configured as -# "rxvt" (monochrome) and "rxvt-color". -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -rxvt|rxvt terminal base (X Window System):\ - :am:bs:eo:km:mi:ms:xn:xo:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:\ - :ho=\E[H:i1=\E[?47l\E=\E[?1l:ic=\E[@:im=\E[4h:\ - :is=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l:\ - :k0=\E[21~:k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:\ - :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ - :kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:ke=\E>:\ - :kh=\E[7~:kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[0m\017:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:\ - :se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:ue=\E[24m:up=\E[A:\ - :us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:\ - :vs=\E[?25h: -rxvt-color|rxvt terminal emulator (X Window System):\ - :Co#8:pa#64:\ - :AB=\E[%p1%{40}%+%dm:AF=\E[%p1%{30}%+%dm:me=\E[m\017:\ - :op=\E[39;49m:\ - :tc=rxvt: - -# These (xtermc and xtermm) are distributed with Solaris. They refer to a -# variant of xterm which is apparently no longer supported, but are interesting -# because they illustrate SVr4 curses mouse controls - T.Dickey -# (untranslatable capabilities removed to fit entry within 1023 bytes) -xtermm|xterm terminal emulator (monocrome):\ - :am:bs:km:mi:ms:xn:\ - :BT#3:co#80:it#8:li#24:\ - :@7=\E[Y:@8=\EOM:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:\ - :F1=\EOZ:F2=\EOA:Gm=\E[%p1%dY:IC=\E[%d@:K1=\EOq:K2=\EOr:\ - :K3=\EOs:K4=\EOp:K5=\EOn:Km=\E[^_:LE=\E[%dD:RI=\E[%dC:\ - :RQ=\E[492Z:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[L:as=^N:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:eA=\E(B\E)0:ei=:ho=\E[H:\ - :ic=\E[@:im=:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:k9=\EOX:k;=\EOY:kN=\E[U:\ - :kP=\E[V:kb=^H:kd=\EOB:kh=\E[H:kl=\EOD:kr=\EOC:ku=\EOA:\ - :le=\E[1D:mb=@:md=\E[1m:me=\E[m\017:mr=\E[7m:nd=\E[C:\ - :r1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:sc=\E7:\ - :se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:te=\E@0\E[?4r:\ - :ti=\E@0\E[?4s\E[?4h\E@1:up=\E[A: - -xtermc|xterm terminal emulator (color):\ - :Co#8:NC#7:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:\ - :..Sb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m:\ - :..Sf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m:\ - :op=\E[100m:\ - :tc=xtermm: - -# From: David J. MacKenzie 20 Apr 1995 -# Here's a termcap entry I've been using for xterm_color, which comes -# with BSD/OS 2.0, and the X11R6 contrib tape too I think. Besides the -# color stuff, I also have a status line defined as the window manager -# title bar. [I have translated it to terminfo -- ESR] -xterm-pcolor|xterm with color used for highlights and status line:\ - :md=\E[1m\E[43m:mr=\E[7m\E[34m:so=\E[7m\E[31m:\ - :us=\E[4m\E[42m:\ - :tc=xterm+sl:tc=xterm-r6: - -# HP ships this, except for the pb#9600 which was merged in from BSD termcap. -# (hpterm: added empty , we have no idea what ACS chars look like --esr) -hpterm|X-hpterm|hp X11 terminal emulator:\ - :am:da:db:mi:xs:\ - :Nl#8:co#80:lh#2:li#24:lm#0:lw#8:pb#9600:sg#0:\ - :LF=\E&j@:LO=\E&jB:ac=:ae=^O:al=\EL:as=^N:bl=^G:bt=\Ei:\ - :cd=\EJ:ce=\EK:ch=\E&a%dC:cl=\E&a0y0C\EJ:cm=\E&a%dy%dC:\ - :cr=^M:ct=\E3:cv=\E&a%dY:dc=\EP:dl=\EM:do=\EB:ei=\ER:im=\EQ:\ - :k1=\Ep:k2=\Eq:k3=\Er:k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:\ - :kA=\EL:kC=\EJ:kD=\EP:kE=\EK:kF=\ES:kH=\EF:kI=\EQ:kL=\EM:\ - :kM=\ER:kN=\EU:kP=\EV:kR=\ET:kS=\EJ:kT=\E1:ka=\E3:kb=^H:\ - :kd=\EB:ke=\E&s0A:kh=\Eh:kl=\ED:kr=\EC:ks=\E&s1A:kt=\E2:\ - :ku=\EA:le=^H:md=\E&dB:me=\E&d@:mh=\E&dH:ml=\El:mr=\E&dB:\ - :mu=\Em:nd=\EC:..pk=\E&f%p1%dk%p2%l%dL%p2%s:\ - :..pl=\E&f1a%p1%dk%p2%l%dL%p2%s:\ - :..pn=\E&f%p1%dk%p2%l%dd0L%p2%s:\ - :..px=\E&f2a%p1%dk%p2%l%dL%p2%s:\ - :..sa=\E&d%?%p7%t%{115}%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%{64}%+%c%?%p9%t%'\016'%c%e%'\017'%c%;:\ - :se=\E&d@:sf=^J:so=\E&dJ:sr=\ET:st=\E1:ta=^I:ue=\E&d@:\ - :up=\EA:us=\E&dD: - -# This entry describes an xterm with Sun-style function keys enabled -# via the X resource setting "xterm*sunFunctionKeys:true" -# To understand / note that L1,L2 and F11,F12 are the same. -# The ... keys are L3-L10. We don't set -# because we want it to be seen as . -# The ... keys are R1-R15. We treat some of these in accordance -# with their Sun keyboard labels instead. -# From: Simon J. Gerraty 10 Jan 1996 -xterm-sun|xterm with sunFunctionKeys true:\ - :%1=\E[196z:&8=\E[195z:@0=\E[200z:@5=\E[197z:@7=\E[220z:\ - :F1=\E[192z:F2=\E[193z:F3=\E[194z:F4=\E[195z:F5=\E[196z:\ - :F7=\E[198z:F8=\E[199z:F9=\E[200z:FA=\E[201z:FL=\E[208z:\ - :FM=\E[209z:FN=\E[210z:FO=\E[211z:FP=\E[212z:FQ=\E[213z:\ - :FS=\E[215z:FU=\E[217z:FW=\E[219z:FY=\E[221z:K2=\E[218z:\ - :k1=\E[224z:k2=\E[225z:k3=\E[226z:k4=\E[227z:k5=\E[228z:\ - :k6=\E[229z:k7=\E[230z:k8=\E[231z:k9=\E[232z:k;=\E[233z:\ - :kI=\E[2z:kN=\E[222z:kP=\E[216z:kh=\E[214z:\ - :tc=xterm: -xterms-sun|small (80x24) xterm with sunFunctionKeys true:\ - :co#80:li#24:tc=xterm-sun: - -# This is for the extensible terminal emulator on the X11R6 contrib tape. -emu|emu native mode:\ - :mi:ms:xo:\ - :Co#15:co#80:it#8:li#24:pa#64:vt#200:\ - :*6=\Esel:@0=\Efind:@8=^M:AB=\Es%i%p1%d;:AF=\Er%i%p1%d;:\ - :AL=\EQ%d;:DC=\EI%d;:DL=\ER%d;:DO=\Ep%d;:F1=\EF11:\ - :F2=\EF12:F3=\EF13:F4=\EF14:F5=\EF15:F6=\EF16:F7=\EF17:\ - :F8=\EF18:F9=\EF19:FA=\EF20:LE=\Eq-%d;:RI=\Eq%d;:\ - :UP=\Ep-%d;:\ - :ac=61a\202f\260g2j\213k\214l\215m\216n\217o\220q\222s\224t\225u\226v\227w\230x\231~\244:\ - :ae=\0:al=\EQ1;:as=\0:bl=^G:cb=\EL:cd=\EN:ce=\EK:\ - :cl=\EP\EE0;0;:cm=\EE%d;%d;:cr=^M:cs=\Ek%d;%d;:ct=\Ej:\ - :dc=\EI1;:dl=\ER1;:do=\EB:eA=\0:ec=\Ej%d;:ei=\EX:\ - :ho=\EE0;0;:im=\EY:is=\ES\Er0;\Es0;:k0=\EF00:k1=\EF01:\ - :k2=\EF02:k3=\EF03:k4=\EF04:k5=\EF05:k6=\EF06:k7=\EF07:\ - :k8=\EF08:k9=\EF09:k;=\EF10:kD=\177:kI=\Eins:kN=\Enext:\ - :kP=\Eprior:kb=^H:kd=\EB:kl=\EC:kr=\ED:ku=\EA:le=^H:\ - :mb=\ES\EW:md=\ES\EU:me=\ES:mr=\ES\ET:nd=\ED:\ - :oc=\Es0;\Er0;:r2=\ES\Es0;\Er0;:se=\ES:sf=\EG:so=\ES\ET:\ - :sr=\EF:st=\Eh:ta=^I:ue=\ES:up=\EA:us=\ES\EV:ve=\Ea:vi=\EZ:\ - :vs=\Ea: - -######## COMMERCIAL WORKSTATION CONSOLES -# - -#### Alpha consoles -# - -# This is from the OSF/1 Release 1.0 termcap file -pccons|pcconsole|ANSI (mostly) Alpha PC console terminal emulation:\ - :am:xo:\ - :co#80:li#25:\ - :al=\E[L:bl=^G:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :dc=\E[P:dl=\E[M:do=^J:ei=:ho=\E[H:ic=\E[@:im=:kb=^H:kd=\E[B:\ - :kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:me=\E[m:mr=\E[7m:\ - :nd=\E[C:nw=^M^J:se=\E[m:so=\E[7m:ta=^I:up=\E[A: - -#### AT&T consoles -# - -# This actually describes the generic SVr4 display driver for Intel boxes. -# The :mh=\E[2m: isn't documented and therefore may not be reliable. -# From: Eric Raymond Mon Nov 27 19:00:53 EST 1995 -att6386|at386|386at|AT&T WGS 6386 console:\ - :am:bw:eo:xo:\ - :co#80:it#8:li#25:\ - :@7=\E[Y:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\EOZ:\ - :F2=\EOA:IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:\ - :SR=\E[%dT:UP=\E[%dA:\ - :ac=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~:\ - :ae=\E[10m:al=\E[1L:as=\E[12m:bl=^G:bt=\E[Z:cd=\E[J:\ - :ce=\E[K:ch=\E[%i%dG:cl=\E[2J\E[H:cm=\E[%i%d;%dH:cr=^M:\ - :ct=\E[2g:cv=\E[%i%dd:dc=\E[P:dl=\E[1M:do=\E[B:ec=\E[%dX:\ - :ei=:ho=\E[H:ic=\E[1@:im=:is=\E[0;10;39m:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:k9=\EOX:\ - :k;=\EOY:kB=^]:kD=\E[P:kI=\E[@:kM=\E0:kN=\E[U:kP=\E[V:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=\E[D:mb=\E[5m:\ - :md=\E[1m:me=\E[0;10m:mh=\E[2m:mk=\E[9m:mr=\E[7m:nd=\E[C:\ - :nw=\r\E[S:rc=\E8:\ - :..sa=\E[10m\E[0%?%p1%p3%|%t;7%;%?%p2%t;4%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p9%t;12%e;10%;%?%p7%t;9%;m:\ - :sc=\E7:se=\E[m:sf=\E[S:so=\E[7m:sr=\E[T:st=\EH:ta=^I:\ - :ue=\E[m:up=\E[A:us=\E[4m:ve=\E[=1C:vi=\E[=C:\ - :tc=klone+color: -# (pc6300plus: removed ":KM=/usr/lib/ua/kmap.s5:"; renamed BO/EE/CI/CV -- esr) -pc6300plus|AT&T 6300 plus:\ - :am:bs:xo:\ - :co#80:li#24:\ - :al=\E[1L:bl=^G:cd=\E[0J:ce=\E[0K:cl=\E[2J\E[H:\ - :cm=\E[%i%2;%2H:cr=^M:ct=\E[3g:dc=\E[1P:dl=\E[1M:do=\E[B:\ - :ei=:ho=\E[H:ic=\E[1@:im=:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:\ - :k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:k9=\EOk:k;=\EOu:kb=^H:\ - :kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:\ - :me=\E[m:mh=\E[2m:mk=\E[9m:mr=\E[7m:nd=\E[C:nw=^M^J:\ - :se=\E[m:sf=^J:so=\E[7m:st=\EH:ue=\E[m:up=\E[A:us=\E[4m:\ - :ve=\E[=1C:vi=\E[=C: - -# From: Benjamin C. W. Sittler -# -# I have a UNIX PC which I use as a terminal attached to my Linux PC. -# Unfortunately, the UNIX PC terminfo entry that comes with ncurses -# is broken. All the special key sequences are broken, making it unusable -# with Emacs. The problem stems from the following: -# -# The UNIX PC has a plethora of keys (103 of them, and there's no numeric -# keypad!), loadable fonts, and strange highlighting modes ("dithered" -# half-intensity, "smeared" bold, and real strike-out, for example.) It also -# uses resizable terminal windows, but the bundled terminal program always -# uses an 80x24 window (and doesn't support seem to support a 132-column -# mode.) -# -# HISTORY: The UNIX PC was one of the first machines with a GUI, and used a -# library which was a superset of SVr3.5 curses (called tam, for "terminal -# access method".) tam includes support for real, overlapping windows, -# onscreen function key labels, and bitmap graphics. But since the primary -# user interface on the UNIX PC was a GUI program (ua, for "user -# assistant",) and remote administration was considered important for the -# machine, tam also supported VT100-compatible terminals attached to the -# serial port or used across the StarLan network. To simulate the extra keys -# not present on a VT100, users could press ESC and a two-letter sequence, -# such as u d (Undo) or U D (Shift-Undo.) These two-letter sequences, -# however, were not the same as those sent by the actual Undo key. The -# actual Undo key sends ESC 0 s unshifted, and ESC 0 S shifted, for example. -# (If you're interested in adding some of the tam calls to ncurses, btw, I -# have the full documentation and several programs which use tam. It also -# used an extended terminfo format to describe key sequences, special -# highlighting modes, etc.) -# -# KEYS: This means that ncurses would quite painful on the UNIX PC, since -# there are two sequences for every key-modifier combination (local keyboard -# sequence and remote "VT100" sequence.) But I doubt many people are trying -# to use ncurses on the UNIX PC, since ncurses doesn't properly handle the -# GUI. Unfortunately, the terminfo entry (and the termcap, too, I presume) -# seem to have been built from the manual describing the VT100 sequences. -# This means it doesn't work for a real live UNIX PC. -# -# FONTS: The UNIX PC also has a strange interpretation of "alternate -# character set". Rather than the VT100 graphics you might expect, it allows -# up to 8 custom fonts to be loaded at any given time. This means that -# programs expecting VT100 graphics will usually be disappointed. For this -# reason I have disabled the smacs/rmacs sequences, but they could easily be -# re-enabled. Here are the relevant control sequences (from the ESCAPE(7) -# manpage), should you wish to do so: -# -# SGR10 - Select font 0 - ESC [ 10 m or SO -# SGR11 - Select font 1 - ESC [ 11 m or SI -# SGR12 - Select font 2 - ESC [ 12 m -# ... (etc.) -# SGR17 - Select font 7 - ESC [ 17 m -# -# Graphics for line drawing are not reliably found at *any* character -# location because the UNIX PC has dynamically reloadable fonts. I use font -# 0 for regular text and font 1 for italics, but this is by no means -# universal. So ASCII line drawing is in order if smacs/rmacs are enabled. -# -# MISC: The cursor visible/cursor invisible sequences were swapped in the -# distributed terminfo. -# -# To ameliorate these problems (and fix a few highlighting bugs) I rewrote -# the UNIX PC terminfo entry. The modified version works great with Lynx, -# Emacs, and XEmacs running on my Linux PC and displaying on the UNIX PC -# attached by serial cable. In Emacs, even the Undo key works, and many -# applications can now use the F1-F8 keys. -# -# esr's notes: -# Terminfo entry for the AT&T Unix PC 7300 -# from escape(7) in Unix PC 7300 Manual. -# Somewhat similar to a vt100-am (but different enough -# to redo this from scratch.) -# -# /*************************************************************** -# * -# * FONT LOADING PROGRAM FOR THE UNIX PC -# * -# * This routine loads a font defined in the file ALTFONT -# * into font memory slot #1. Once the font has been loaded, -# * it can be used as an alternative character set. -# * -# * The call to ioctl with the argument WIOCLFONT is the key -# * to this routine. For more information, see window(7) in -# * the PC 7300 documentation. -# ***************************************************************/ -# #include /* needed for strcpy call */ -# #include /* needed for ioctl call */ -# #define FNSIZE 60 /* font name size */ -# #define ALTFONT "/usr/lib/wfont/special.8.ft" /* font file */ -# /* -# * The file /usr/lib/wfont/special.8.ft comes with the -# * standard PC software. It defines a graphics character set -# * similar to that of the Teletype 5425 terminal. To view -# * this or other fonts in /usr/lib/wfont, use the command -# * cfont . For further information on fonts see -# * cfont(1) in the PC 7300 documentation. -# */ -# -# struct altfdata /* structure for alt font data */ -# { -# short altf_slot; /* memory slot number */ -# char altf_name[FNSIZE]; /* font name (file name) */ -# }; -# ldfont() -# { -# int wd; /* window in which altfont will be */ -# struct altfdata altf; -# altf.altf_slot=1; -# strcpy(altf.altf_name,ALTFONT); -# for (wd =1; wd < 12; wd++) { -# ioctl(wd, WIOCLFONT,&altf); -# } -# } -# -# (att7300: added :vi:/:ve:/:ic:/ from the BSDI entry, -# they're confirmed by the man page for the System V display---esr) -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att7300|unixpc|pc7300|3b1|s4|AT&T UNIX PC Model 7300:\ - :am:xo:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\ - :UP=\E[%dA:al=\E[L:bl=^G:bt=\E^I:cd=\E[0J:ce=\E[0K:\ - :cl=\E[2J\E[H:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:\ - :do=\E[B:ei=:ho=\E[H:i1=\017\E[=1w:ic=\E[@:im=:k1=\EOc:\ - :k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:\ - :kD=\ENf:kI=\ENj:kN=\E[U:kP=\E[V:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[9m:md=\E[1m:\ - :me=\E[0;10m:mh=\E[2m:mr=\E[7m:nd=\E[C:nw=\EE:se=\E[m:\ - :sf=^J:so=\E[7m:sr=\EM:ue=\E[m:up=\E[A:us=\E[4m:ve=\E[=0C:\ - :vi=\E[=1C: - -#### Hewlett-Packard consoles -# -# These are descriptions for the HP700 series, the workstations formerly -# known as Apollos. HP terminals are described elsewhere in the file -# - -# From: Victor Duchovni -# (hp700-wy: removed obsolete ":nl=^J:"; -# replaced /usr/share/tabset/hp700-wy with std because :it#8:,:st=\E1: -- esr) -hp700-wy|HP700/41 emulating wyse30:\ - :am:bs:bw:mi:ms:\ - :co#80:it#8:li#24:sg#1:\ - :al=0.7*\EE:bt=\EI:cd=\EY:ce=10\ET:cl=^Z:cm=\E=%+ %+ :\ - :cr=^M:ct=\E0:cv=\E[%+ :dc=\EW:dl=\ER:do=^V:ei=\Er:ho=^^:\ - :i1=\E~"\EC\Er\E(\EG0\003\E`9\E`1:\ - :if=/usr/share/tabset/stdcrt:im=\Eq:kB=\EI:kC=^Z:kE=\ET:\ - :kI=\Eq:kM=\Er:kS=\EY:kT=\EI:kb=\177:kd=^V:kh=^^:kl=^H:kr=^L:\ - :ku=^K:le=^H:ll=^^^K:me=10\EG0:nd=^L:se=10\EG0:so=10\EG4:\ - :sr=\Ej:st=\E1:ta=^I:ue=10\EG0:up=^K:us=10\EG8: -hp70092|hp70092a|hp70092A|HP 700/92:\ - :am:da:db:xs:\ - :Nl#8:co#80:lh#2:li#24:lm#0:lw#8:\ - :LF=\E&j@:LO=\E&jB:ac=0cjgktlrmfn/q\054t5u6v8w7x.:ae=^O:\ - :al=\EL:as=^N:bl=^G:bt=\Ei:ce=\EK:ch=\E&a%dC:\ - :cl=\E&a0y0C\EJ:cm=\E&a%dy%dC:cr=^M:ct=\E3:cv=\E&a%dY:\ - :dc=\EP:dl=\EM:do=\EB:ei=\ER:im=\EQ:k1=\Ep:k2=\Eq:k3=\Er:\ - :k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:kA=\EL:kC=\EJ:kD=\EP:\ - :kE=\EK:kF=\ES:kH=\EF:kI=\EQ:kL=\EM:kM=\ER:kN=\EU:kP=\EV:\ - :kR=\ET:kS=\EJ:kT=\E1:ka=\E3:kb=^H:kd=\EB:ke=\E&s0A:kh=\Eh:\ - :kl=\ED:kr=\EC:ks=\E&s1A:kt=\E2:ku=\EA:le=^H:mb=\E&dA:\ - :md=\E&dB:me=\E&d@:mh=\E&dH:mr=\E&dB:nd=\EC:se=\E&d@:\ - :so=\E&dJ:sr=\ET:st=\E1:ta=^I:ue=\E&d@:up=\EA:us=\E&dD: - -# HP 700/44 Setup parameters: -# Terminal Mode HP-PCterm -# Inhibit Auto Wrap NO -# Status Line Host Writable -# PC Character Set YES -# Twenty-Five Line Mode YES -# XON/XOFF @128 or 64 (sc) -# Keycode Mode NO or YES (sc) -# Backspace Key BS or BS/DEL -# -# :is: sets pcterm; autowrap; 25 lines; pc char set; prog DEL key; -# \E\\? does not turn off keycode mode -# sets alternate start/stop; keycode on -hpansi|hp700|hewlett packard 700/44 in HP-PCterm mode:\ - :am:eo:xn:xo:\ - :co#80:li#25:\ - :@7=\E[4~:RA=\E[?7l:S4=\E[>11h\EPO**x0/65;1/67\E\:\ - :S5=\E[>11l\EP1**x0/11;1/13\E[m\E\:SA=\E[?7h:XF=g:XN=e:\ - :ac=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263:\ - :al=\E[L:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:\ - :cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:do=\E[B:ei=:ho=\E[H:\ - :ic=\E[@:im=:\ - :is=\E[44"p\E[?7h\E[>10h\E[>12h\EP1;1|3/7F\E\:\ - :k1=\E[17~:k2=\E[18~:k3=\E[19~:k4=\E[20~:k5=\E[21~:\ - :k6=\E[23~:k7=\E[24~:k8=\E[25~:k9=\E[26~:k;=\E[28~:\ - :kB=\E[Z:kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:kh=\E[1~:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=\E[D:me=\E[m:nd=\E[C:se=\E[m:sf=^J:\ - :so=\E[7m:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:ve=\E[?25h:\ - :vi=\E[?25l: - -#### Iris consoles -# - -# Sent by Stefan Stapelberg , 24 Feb 1997, this is -# from SGI's terminfo database. SGI's entry shows F9-F12 with the codes -# for the application keypad mode. We have added iris-ansi-ap rather than -# change the original to keypad mode. -# -# (iris-ansi: added rmam/smam based on init string -- esr) -# -# This entry, and those derived from it, is used in xwsh (also known as -# winterm). Some capabilities that do not fit into the terminfo model -# include the shift- and control-functionkeys: -# -# F1-F12 generate different codes when shift or control modifiers are used. -# For example: -# F1 \E[001q -# shift F1 \E[013q -# control-F1 \E[025q -# -# In application keypad mode, F9-F12 generate codes like vt100 PF1-PF4, i.e., -# \EOP to \EOS. The shifted and control modifiers still do the same thing. -# -# The cursor keys also have different codes: -# control-up \E[162q -# control-down \E[165q -# control-left \E[159q -# control-right \E[168q -# -# shift-up \E[161q -# shift-down \E[164q -# shift-left \E[158q -# shift-right \E[167q -# -# control-tab \[072q -# -# iris-ansi-net alias helps with IRIX does when you rsh to a remote system. -iris-ansi|iris-ansi-net|IRIS emulating 40 line ANSI terminal (almost VT100):\ - :am:\ - :co#80:it#8:li#40:\ - :!2=\E[218q:#2=\E[143q:#4=\E[158q:%9=\E[209q:%f=\E[210q:\ - :%i=\E[167q:&7=\E[217q:*4=\E[P:*7=\E[147q:@7=\E[146q:\ - :@8=^M:AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:F1=\E[011q:\ - :F2=\E[012q:LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:\ - :UP=\E[%dA:al=\E[L:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:dl=\E[M:do=^J:\ - :ho=\E[H:is=\E[?1l\E>\E[?7h\E[100g\E[0m\E7\E[r\E8:\ - :k1=\E[001q:k2=\E[002q:k3=\E[003q:k4=\E[004q:k5=\E[005q:\ - :k6=\E[006q:k7=\E[007q:k8=\E[008q:k9=\E[009q:k;=\E[010q:\ - :kB=\E[Z:kD=\177:kI=\E[139q:kM=\E[146q:kN=\E[154q:\ - :kP=\E[150q:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=\E[D:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nw=\EE:\ - :pk=\EP101;%d.y%s\E\:rc=\E8:sc=\E7:se=\E[m:sf=\ED:\ - :so=\E[1;7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:\ - :ve=\E[9/y\E[12/y\E[=6l:vs=\E[10/y\E[=1h\E[=2l\E[=6h: -iris-ansi-ap|IRIS ANSI in application-keypad mode:\ - :@8=\EOM:F1=\E[011q:F2=\E[012q:is=\E[?1l\E=\E[?7h:\ - :k9=\E[009q:k;=\E[010q:\ - :tc=iris-ansi: - -# From the man-page, this is a quasi-vt100 emulator that runs on SGI's IRIX -# (T.Dickey 98/1/24) -iris-color|xwsh|IRIX ANSI with color:\ - :NC#33:\ - :DC=\E[%dP:IC=\E[%d@:ZH=\E[3m:ZR=\E[23m:cs=\E[%i%d;%dr:\ - :ec=\E[%dX:ei=:im=:mh=\E[2m:r1=\Ec:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:sc=\E7:\ - :u6=\E[%i%d;%dR:u7=\E[6n:u8=\E[?1;2c:u9=\E[c:ue=\E[24m:\ - :tc=klone+color:tc=iris-ansi-ap: - -# (wsiris: this had extension capabilities -# :HS=\E7F2:HE=\E7F7:\ -# :CT#2:CZ=*Bblack,red,green,yellow,blue,magenta,cyan,*Fwhite: -# See the note on Iris extensions near the end of this file. -# Finally, removed suboptimal :cl:=\EH\EJ and added :do: & -# :vb: from BRL -- esr) -wsiris|iris40|iris emulating a 40 line visual 50 (approximately):\ - :am:bs:nc:pt:\ - :co#80:it#8:kn#3:li#40:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EK:cl=\Ev:cm=\EY%+ %+ :dl=\EM:\ - :do=\EB:ho=\EH:is=\E7B0\E7F7\E7C2\E7R3:k0=\E0:k1=\E1:\ - :k2=\E2:k3=\E3:k4=\E4:k5=\E5:k6=\E6:k7=\E7:k8=\E8:k9=\E9:\ - :kd=\EB:kl=\ED:kr=\EC:ku=\EA:le=^H:me=\E7F7:mh=\E7F2:nd=\EC:\ - :nl=\EB:se=\E0@:sf=^J:so=\E9P:sr=\EI:ta=^I:ue=\E7R3\E0@:\ - :up=\EA:us=\E7R2\E9P:vb=\E7F4\E7B1\013\E7F7\E7B0:ve=\E>:\ - :vs=\E;: - -#### NeWS consoles -# -# Console terminal windows under the NeWS (Sun's Display Postscript windowing -# environment). Note: these have nothing to do with Sony's News workstation -# line. -# - -# Entry for NeWS's psterm from Eric Messick & Hugh Daniel -# (psterm: unknown ":sl=\EOl:el=\ENl:" removed -- esr) -psterm|psterm-basic|NeWS psterm-80x34:\ - :am:bs:hs:km:ul:\ - :co#80:it#8:li#34:\ - :al=\EA:cd=\EB:ce=\EC:cl=^L:cm=\E%d;%d;:cs=\EE%d;%d;:\ - :dc=\EF:dl=\EK:do=\EP:ei=\ENi:fs=\ENl:ho=\ER:i1=\EN*:\ - :im=\EOi:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=\ET:ll=\EU:\ - :mb=\EOb:md=\EOd:me=\EN*:mr=\EOr:nd=\EV:rc=^\:sc=^]:se=\ENo:\ - :sf=\EW:so=\EOo:sr=\EX:ta=^I:te=\ENt:ti=\EOt:ts=\EOl:\ - :ue=\ENu:up=\EY:us=\EOu:vb=\EZ: -psterm-96x48|NeWS psterm 96x48:\ - :co#96:li#48:tc=psterm: -psterm-90x28|NeWS psterm 90x28:\ - :co#90:li#28:tc=psterm: -psterm-80x24|NeWS psterm 80x24:\ - :co#80:li#24:tc=psterm: -# This is a faster termcap for psterm. Warning: if you use this termcap, -# some control characters you type will do strange things to the screen. -# (psterm-fast: unknown ":sl=^Ol:el=^Nl:" -- esr) -psterm-fast|NeWS psterm fast version (flaky ctrl chars):\ - :am:bs:hs:km:ul:\ - :co#80:it#8:li#34:\ - :al=^A:cd=^B:ce=^C:cl=^L:cm=\004%d;%d;:cs=\005%d;%d;:dc=^F:\ - :dl=^K:do=^P:ei=^Ni:fs=^Nl:ho=^R:i1=^N*:im=^Oi:kd=\E[B:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^T:ll=^U:mb=^Ob:md=^Od:me=^N*:\ - :mr=^Or:nd=^V:rc=^\:sc=^]:se=^No:sf=^W:so=^Oo:sr=^X:ta=^I:\ - :te=^Nt:ti=^Ot:ts=^Ol:ue=^Nu:up=^Y:us=^Ou:vb=^Z: - -#### NeXT consoles -# -# Use `glasstty' for the Workspace application -# - -# From: Dave Wetzel 22 Dec 1995 -next|NeXT console:\ - :am:xt:\ - :co#80:it#8:li#24:\ - :bl=^G:ce=\E[K:cl=^L:cm=\E[%i%d;%dH:cr=^M:do=^J:ho=\E[H:\ - :kb=^H:kd=^J:kl=^H:le=^H:me=\E[m:nd=\E[C:nw=^M^J:se=\E[4;1m:\ - :sf=^J:so=\E[4;2m:ta=^I:up=\E[A: -nextshell|NeXT Shell application:\ - :am:\ - :co#80:\ - :bl=^G:cr=^M:do=^J:kb=^H:kd=^J:kl=^H:le=^H:nw=^M^J:ta=^I: - -#### SCO consoles -# - -# SCO console and SOS-Syscons console for 386bsd -# (scoansi: had unknown capabilities -# :Gc=N:Gd=K:Gh=M:Gl=L:Gu=J:Gv=\072:\ -# :GC=E:GD=B:GH=D:GL=\64:GU=A:GV=\63:GR=C: -# :G1=?:G2=Z:G3=@:G4=Y:G5=;:G6=I:G7=H:G8=<:\ -# :CW=\E[M:NU=\E[N:RF=\E[O:RC=\E[P:\ -# :WL=\E[S:WR=\E[T:CL=\E[U:CR=\E[V:\ -# I renamed GS/GE/HM/EN/PU/PD/RT and added klone+sgr-dumb, based -# on the :as:=\E[12m -- esr) -# SCO function keys and corrected by Thomas Dickey. -# In this description based on SCO's keyboard(HW) manpage list of default function key -# values: -# F13-F24 are shifted F1-F12 -# F25-F36 are control F1-F12 -# F37-F48 are shift+control F1-F12 -# (untranslatable capabilities removed to fit entry within 1023 bytes) -scoansi|SCO Extended ANSI standard crt:\ - :am:eo:xo:\ - :Co#8:co#80:it#8:li#25:pa#64:\ - :@1=\E[E:@7=\E[F:AB=\E[4%p1%dm:AF=\E[3%p1%dm:F1=\E[W:\ - :F2=\E[X:F3=\E[Y:F5=\E[a:F6=\E[b:F7=\E[c:F8=\E[d:F9=\E[e:\ - :FA=\E[f:FB=\E[g:FC=\E[h:FD=\E[i:FE=\E[j:FF=\E[k:FG=\E[l:\ - :FH=\E[m:FI=\E[n:FJ=\E[o:FK=\E[p:FL=\E[q:FM=\E[r:FN=\E[s:\ - :FO=\E[t:FP=\E[u:FQ=\E[v:FR=\E[w:FS=\E[x:FT=\E[y:FU=\E[z:\ - :FV=\E[@:FW=\E[[:FX=\E[\:FY=\E[]:FZ=\E[\136:Fa=\E[_:\ - :Fb=\E[`:Fc=\E[{:\ - :ac=0[5566778899\072\072;;<<==>>FFGGHHIIJJKKLLMMNNOOPPQQRRSSTTUUVVWWXX`ja0fxgqh2jYk?lZm@nEqDtCu4vAwBx3~y:\ - :ae=\E[10m:al=\E[L:as=\E[12m:bt=\E[Z:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:do=\E[B:ei=:\ - :ho=\E[H:ic=\E[@:im=:k1=\E[M:k2=\E[N:k3=\E[O:k4=\E[P:\ - :k5=\E[Q:k6=\E[R:k7=\E[S:k8=\E[T:k9=\E[U:k;=\E[V:kB=\E[Z:\ - :kI=\E[L:kN=\E[G:kP=\E[I:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=\E[D:mb=\E[5m:md=\E[1m:me=\E[0;10m:\ - :mk=\E[8m:mr=\E[7m:nd=\E[C:op=\E[37;40m:se=\E[m:sf=\E[S:\ - :so=\E[7m:sr=\E[T:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: - -#### Sun consoles -# - -# :is1: resets scrolling region in case a previous user had used "tset vt100" -oldsun|Sun Microsystems Workstation console:\ - :am:bs:km:mi:ms:\ - :co#80:it#8:li#34:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:al=\E[L:bl=^G:\ - :cd=\E[J:ce=\E[K:cl=^L:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:\ - :dl=\E[M:do=\E[B:ei=:i1=\E[1r:ic=\E[@:im=:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=^H:me=\E[m:nd=\E[C:se=\E[m:sf=^J:so=\E[7m:ta=^I:up=\E[A: -# From: Alexander Lukyanov , 14 Nov 1995 -# :li: capability later corrected by J.T. Conklin -# SGR 1, 4 aren't supported - removed bold/underline (T.Dickey 17 Jan 1998) -sun-il|Sun Microsystems console with working insert-line:\ - :am:km:ms:\ - :co#80:li#34:\ - :%7=\E[194z:&5=\E[193z:&8=\E[195z:@7=\E[220z:AL=\E[%dL:\ - :DC=\E[%dP:DL=\E[%dM:F1=\E[234z:F2=\E[235z:IC=\E[%d@:\ - :K2=\E[218z:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=^L:\ - :cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:do=^J:ei=:ic=\E[@:im=:\ - :k1=\E[224z:k2=\E[225z:k3=\E[226z:k4=\E[227z:k5=\E[228z:\ - :k6=\E[229z:k7=\E[230z:k8=\E[231z:k9=\E[232z:k;=\E[233z:\ - :kD=\177:kN=\E[222z:kP=\E[216z:kb=^H:kd=\E[B:kh=\E[214z:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:md@:me=\E[m:mr=\E[7m:nd=\E[C:\ - :r2=\E[s:\ - :..sa=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m:\ - :se=\E[m:sf=^J:so=\E[7m:ta=^I:u8=\E[1t:u9=\E[11t:ue@:\ - :up=\E[A:us@: -# On a SparcStation 5, :al:/:AL: flake out on the last line. -# Unfortunately, without them the terminal has no way to scroll. -sun-ss5|Sun SparcStation 5 console:\ - :AL@:al@:tc=sun-il: -# If you are using an SS5, change the sun definition to use sun-ss5. -sun|sun1|sun2|Sun Microsystems Inc. workstation console:\ - :tc=sun-il: - -# From: Tue Sep 24 13:14:44 1985 -sun-s|Sun Microsystems Workstation window with status line:\ - :hs:\ - :ds=\E]l\E\:fs=\E\:ts=\E]l:tc=sun: -sun-e-s|sun-s-e|Sun Microsystems Workstation with status hacked for emacs:\ - :hs:\ - :ds=\E]l\E\:fs=\E\:ts=\E]l:tc=sun-e: -sun-48|Sun 48-line window:\ - :co#80:li#48:tc=sun: -sun-34|Sun 34-line window:\ - :co#80:li#34:tc=sun: -sun-24|Sun 24-line window:\ - :co#80:li#24:tc=sun: -sun-17|Sun 17-line window:\ - :co#80:li#17:tc=sun: -sun-12|Sun 12-line window:\ - :co#80:li#12:tc=sun: -sun-1|Sun 1-line window for sysline:\ - :es:hs:\ - :co#80:li#1:\ - :ds=^L:fs=\E[K:ts=^M:tc=sun: -sun-e|sun-nic|sune|Sun Microsystems Workstation without insert character:\ - :ei@:ic@:im@:\ - :tc=sun: -sun-c|sun-cmd|Sun Microsystems Workstation console with scrollable history:\ - :li#35:\ - :te=\E[>4h:ti=\E[>4l:tc=sun: - -#### Common Desktop Environment -# - -# This ships with Sun's CDE in Solaris 2.5 -# Corrected Sun Aug 9 1998 by Alexander V. Lukyanov -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -dtterm|CDE desktop terminal:\ - :am:mi:ms:xn:xo:\ - :co#80:it#8:li#24:lm#0:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ec=\E[%dX:\ - :ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\E F\E>\E[?1l\E[?7h\E[?45l:k1=\E[11~:k2=\E[12~:\ - :k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:nw=\EE:\ - :rc=\E8:sc=\E7:se=\E[22;27m:sf=\ED:so=\E[2;7m:sr=\EM:\ - :st=\EH:ta=^I:ue=\E[24m:up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:\ - :ve=\E[?25h:vi=\E[?25l: - -#### Mach -# - -# From: Matthew Vernon -mach|Mach Console:\ - :am:km:\ - :co#80:it#8:li#25:\ - :@7=\E[Y:AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\Ec:\ - :cm=\E[%i%d;%dH:cr=^M:dl=\E[M:do=^J:ho=\E[H:k1=\EOP:\ - :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:\ - :k9=\EOX:k;=\EOY:kD=\E[9:kH=\E[F:kI=\E[@:kN=\E[U:kP=\E[V:\ - :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[0m:mr=\E[7m:nd=\E[C:nw=^M^J:\ - :se=\E[0m:sf=^J:so=\E[7m:ta=^I:up=\E[A: -mach-bold|Mach Console with bold instead of underline:\ - :ue=\E[0m:us=\E[1m:\ - :tc=mach: - -#### OSF Unix -# - -# OSF/1 1.1 Snapshot 2 -pmcons|pmconsole|PMAX console:\ - :am:\ - :co#128:li#57:\ - :bl=^G:cl=^L:cr=^M:do=^J:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:sf=^J:ta=^I:up=^K: - -######## UNIX VIRTUAL TERMINALS AND TELNET CLIENTS -# - -#### FSF virtual terminal types -# - -# The codes supported by the term.el terminal emulation in GNU Emacs 19.30 -eterm|gnu emacs term.el terminal emulation:\ - :am:mi:xn:\ - :co#80:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:cb=\E[1K:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:\ - :im=\E[4h:le=^H:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:se=\E[m:\ - :sf=^J:so=\E[7m:ta=^I:te=\E[2J\E[?47l\E8:ti=\E7\E[?47h:\ - :ue=\E[m:up=\E[A:us=\E[4m: - -# Entries for use by the `screen' program by Juergen Weigert, -# Michael Schroeder, Oliver Laumann. The screen and -# screen-w entries came with version 3.7.1. The screen2 and screen3 entries -# come from University of Wisconsin and may be older. -# (screen: added :ve: on ANSI model -- esr) -# (screen: added -- TD) - -screen|VT 100/ANSI X3.64 virtual terminal:\ - :am:km:mi:ms:xn:\ - :Co#8:co#80:it#8:li#24:pa#64:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:\ - :F2=\E[24~:IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:\ - :ac=++\054\054--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:eA=\E(B\E)0:ei=\E[4l:\ - :ho=\E[H:im=\E[4h:is=\E)0:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :k5=\E[15~:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ - :k;=\E[21~:kD=\E[3~:kH=\E[4~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kh=\E[1~:kl=\EOD:kr=\EOC:\ - :ks=\E[?1h\E=:ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:nw=\EE:r2=\Ec:rc=\E8:sc=\E7:se=\E[23m:\ - :sf=^J:so=\E[3m:sr=\EM:st=\EH:ta=^I:ue=\E[24m:up=\EM:\ - :us=\E[4m:vb=\Eg:ve=\E[34h\E[?25h:vi=\E[?25l:vs=\E[34l:\ - :tc=ecma+color: - -screen-w|VT 100/ANSI X3.64 virtual terminal with 132 cols:\ - :co#132:tc=screen: - -screen2|old VT 100/ANSI X3.64 virtual terminal:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bt=\E[Z:cd=\E[J:\ - :ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:\ - :dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ic=:im=\E[4h:k0=\E~:\ - :k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:k6=\EP:k7=\EQ:k8=\ER:\ - :k9=\E0I:kb=^H:kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:le=^H:\ - :me=\E[m:nd=\E[C:nw=^M^J:r1=\Ec:rc=\E8:sc=\E7:se=\E[23m:\ - :sf=^J:so=\E[3m:sr=\EM:st=\EH:ta=^I:ue=\E[24m:up=\E[A:\ - :us=\E[4m: -# (screen3: removed unknown ":xv:LP:G0:" -- esr) -screen3|older VT 100/ANSI X3.64 virtual terminal:\ - :km:mi:ms:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:\ - :ho=\E[H:im=\E[4h:is=\E)0:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :kb=^H:kd=\EOB:ke=\E>:kl=\EOD:kr=\EOC:ks=\E=:ku=\EOA:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nw=\EE:r1=\Ec:\ - :rc=\E8:sc=\E7:se=\E[23m:sf=^J:so=\E[3m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[24m:up=\EM:us=\E[4m: - -# Francesco Potorti : -# NCSA telnet is one of the most used telnet clients for the Macintosh. It has -# been maintained until recently by the National Center for Supercomputer -# Applications, and it is feature rich, stable and free. It can be downloaded -# from www.ncsa.edu. This terminfo description file is based on xterm-vt220, -# xterm+sl, and the docs at NCSA. It works well. -# -# NCSA Telnet 2.6 for Macintosh in vt220 8-bit emulation mode -# The terminal options should be set as follows: -# Xterm sequences ON -# use VT wrap mode ON -# use Emacs arrow keys OFF -# CTRL-COMND is Emacs meta ON -# 8 bit mode ON -# answerback string: "ncsa-vt220-8" -# setup keys: all disabled -# -# Application mode is not used. -# -# Other special mappings: -# Apple VT220 -# HELP Find -# HOME Insert here -# PAGEUP Remove -# DEL Select -# END Prev Screen -# PAGEDOWN Next Screen -# -# Though it supports ANSI color, NCSA Telnet uses color to represent blinking -# text. -# -# The status-line manipulation is a mapping of the xterm-compatible control -# sequences for setting the window-title. So you must use tsl and fsl in -# pairs, since the latter ends the string that is loaded to the window-title. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncsa-m|ncsa-vt220-8|NCSA Telnet 2.6 for Macintosh in vt220-8 mode:\ - :am:hs:km:mi:ms:xn:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\ - :ds=\E]0;\007:ei=\E[4l:fs=^G:ho=\E[H:\ - :if=/usr/share/tabset/vt100:im=\E[4h:\ - :is=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>:k1=\E[17~:\ - :k2=\E[18:k3=\E[19~:k4=\E[20~:k5=\E[21~:k6=\E23~:\ - :k7=\E[24~:k8=\E[25~:k9=\E[26~:kD=\E[4~:kN=\E[6~:kP=\E[3~:\ - :kb=^H:kd=\E[B:kh=\E[2~:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m\017:mr=\E[7m:nd=\E[C:rc=\E8:\ - :sc=\E7:se=\E[27m:sf=\n:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :te=\E[2J\E8:ti=\E7:ts=\E]0;:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l: -ncsa|NCSA Telnet 2.7 for Macintosh in vt220-8 mode:\ - :tc=ncsa-m:tc=klone+color: -ncsa-ns|NCSA Telnet 2.7 for Macintosh in vt220-8 mode:\ - :hs@:\ - :ds@:fs@:ts@:tc=ncsa: -ncsa-m-ns|NCSA Telnet 2.6 for Macintosh in vt220-8 mode:\ - :hs@:\ - :ds@:fs@:ts@:tc=ncsa-m: -# alternate -TD: -# The documented function-key mapping refers to the Apple Extended Keyboard -# (e.g., NCSA Telnet's F1 corresponds to a VT220 F6). We use the VT220-style -# codes, however, since the numeric keypad (VT100) PF1-PF4 are available on -# some keyboards and many applications require these as F1-F4. -# -ncsa-vt220|NCSA Telnet using vt220-compatible function keys:\ - :F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:\ - :F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:FA=\E[34~:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:k;=\E[21~:\ - :tc=ncsa: - -#### Pilot Pro Palm-Top -# - -# From: Jason Downs , 15 Jun 1997 (Top Gun Telnet's author) -pilot|tgtelnet|Top Gun Telnet on the Palm Pilot Professional:\ - :am:xn:\ - :co#39:li#16:\ - :bl=^G:cl=\Ec:cm=\Em%+ %+ :cr=^M:do=^J:ho=\Em :kN=^L:kP=^K:\ - :kb=^H:kd=^J:kl=^H:le=^H:nw=\Em~ :se=\EB:sf=^J:so=\Eb:ta=^I: - -######## NON-UNIX CONSOLES -# - -#### MGR -# -# MGR is a Bell Labs window system lighter-weight than X. -# These entries describe MGR's xterm-equivalent. -# They are courtesy of Vincent Broman 14 Jan 1997 -# - -mgr|Bellcore MGR (non X) window system terminal emulation:\ - :am:km:\ - :AL=\E%da:DC=\E%dE:DL=\E%dd:IC=\E%dA:RA=\E5S:SA=\E5s:\ - :al=\Ea:bl=^G:cd=\EC:ce=\Ec:cl=^L:cm=\E%r%d;%dM:cr=^M:\ - :cs=\E%d;%dt:dc=\EE:dl=\Ed:do=\Ef:ei=:hd=\E1;2f:hu=\E1;2u:\ - :ic=\EA:im=:kb=^H:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :md=\E2n:me=\E0n:mr=\E1n:nd=\Er:nw=^M^J:se=\E0n:sf=^J:\ - :so=\E1n:ta=^I:ue=\E0n:up=\Eu:us=\E4n:ve=\Eh:vi=\E9h:\ - :vs=\E0h: -mgr-sun|Mgr window with Sun keyboard:\ - :%1=\E[207z:%6=\E[198z:&8=\E[195z:@0=\E[200z:@5=\E197z:\ - :@7=\E[220z:@8=\E[250z:F1=\E[234z:F2=\E[235z:K1=\E[214z:\ - :K2=\E[218z:K3=\E[216z:K4=\E[220z:K5=\E[222z:k1=\E[224z:\ - :k2=\E[225z:k3=\E[226z:k4=\E[227z:k5=\E[228z:k6=\E[229z:\ - :k7=\E[230z:k8=\E[231z:k9=\E[232z:k;=\E[233z:kN=\E[222z:\ - :kP=\E[216z:kh=\E[214z:\ - :tc=mgr: -mgr-linux|Mgr window with Linux keyboard:\ - :@7=\E[4~:F1=\E[23~:F2=\E[24~:K1=\E[H:K2=\E[G:K3=\E[5~:\ - :K4=\E[Y:K5=\E[6~:k0=\E[[J:k1=\E[[A:k2=\E[[B:k3=\E[[C:\ - :k4=\E[[D:k5=\E[[E:k6=\E[17~:k7=\E[18~:k8=\E[19~:\ - :k9=\E[20~:k;=\E[21~:kD=\E[3~:kN=\E[6~:kP=\E[5~:kh=\E[1~:tc=mgr: - -#### BeOS -# -# BeOS entry for Terminal program Seems to be almost ANSI -beterm|BeOS Terminal:\ - :am:eo:mi:ms:xn:xo:\ - :Co#8:NC#5:co#80:it#8:li#25:pa#64:\ - :&7=^Z:@7=\E[4~:AB=\E[4%p1%dm:AF=\E[3%p1%dm:AL=\E[%dL:\ - :DC=\E[%dP:DL=\E[%dM:F1=\E[21~:F2=\E[22~:IC=\E[%d@:\ - :Sb=\E[%+(m:Sf=\E[%+^^m:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:\ - :ch=\E[%i%dG:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=^J:\ - :ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:k1=\E[11~:k2=\E[12~:\ - :k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[16~:k7=\E[17~:\ - :k8=\E[18~:k9=\E[19~:k;=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:\ - :kP=\E[5~:kb=^H:kd=\E[B:kh=\E[1~:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=^H:md=\E[1m:me=\E[0;10m:mr=\E[7m:nd=\E[C:nw=^M^J:\ - :op=\E[m:r1=\Ec:rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:\ - :st=\EH:ta=^I:u6=\E[%i%d;%dR:u7=\E[6n:ue=\E[24m:up=\E[A:\ - :us=\E[4m: - -#### QNX -# - -# QNX 4.0 Console -# Michael's original version of this entry had , :ti=\Ei:, -# :te=\Eh\ER:; this was so terminfo applications could write the lower -# right corner without triggering a scroll. The ncurses terminfo library can -# handle this case with the :ic: capability, and prefers :am: for better -# optimization. Bug: The capability resets attributes. -# From: Michael Hunter 30 Jul 1996 -# (removed: :sa=%?%p1%t\E<%;%p2%t\E[%;%p3%t\E(%;%p4%t\E{%;%p6%t\E<%;,:) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -qnx|qnx4|qnx console:\ - :km:mi:ms:xt:\ - :co#80:it#4:li#25:\ - :al=\EE:bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :cr=^M:\ - :dc=\Ef:dl=\EF:do=^J:ei=:ho=\EH:ic=\Ee:im=:k1=\377\201:\ - :k2=\377\202:k3=\377\203:k4=\377\204:k5=\377\205:\ - :k6=\377\206:k7=\377\207:k8=\377\210:k9=\377\211:\ - :kD=\377\254:kI=\377\253:kN=\377\252:kP=\377\242:\ - :kd=\377\251:kh=\377\240:kl=\377\244:kr=\377\246:\ - :ku=\377\241:le=^H:mb=\E{:md=\E<:me=\E}\E]\E>\E):mr=\E(:\ - :nd=\EC:rp=\Eg%r%+ %.:se=\E):sf=^J:so=\E(:sr=\EI:ta=^I:\ - :te=\Eh\ER:ti=\Ei:ue=\E]:up=\EA:us=\E[:ve=\Ey1:vi=\Ey0:\ - :vs=\Ey2: - -# From: Federico Bianchi , 1 Jul 1998 -# (esr: commented out and :te: to avoid warnings.) -# (TD: derive from original qnx4 entry) -qnxt2|qnx 2.15 serial terminal:\ - :am:\ - :!3@:%h@:%j@:&7@:Sb@:Sf@:dc@:ei=:ic@:im=:rp@:se=\E>:so=\E<:te@:ti@:\ - :ve@:vi@:vs@:\ - :tc=qnx4: - -#### DOS ANSI.SYS variants -# -# This completely describes the sequences specified in the DOS 2.1 ANSI.SYS -# documentation (except for the keyboard key reassignment feature, which -# doen't fit the model well). The klone+acs sequences were valid -# though undocumented. The capability is untested but should work for -# keys F1-F10 (%p1 values outside this range will yield unpredictable results). -# From: Eric S. Raymond Nov 7 1995 -ansi.sys-old|ANSI.SYS under PC-DOS 2.1:\ - :am:bs:mi:ms:xo:\ - :co#80:li#25:\ - :RA=\E[?7l:SA=\E[?7h:ce=\E[k:cl=\E[2J:cm=\E[%i%d;%dH:\ - :do=\E[B:ho=\E[H:is=\E[m\E[?7h:kd=^J:kh=^^:kl=^H:kr=^L:\ - :ku=^K:le=^H:nd=\E[C:pk=\E[0;%+:;"%s":rc=\E[u:sc=\E[s:\ - :u6=\E[%i%d;%dR:u7=\E[6n:up=\E[A:\ - :tc=klone+color:tc=klone+sgr: -ansi.sys|ANSI.SYS 3.1 and later versions:\ - :ce=\E[K:tc=ansi.sys-old: - -# -# Define IBM PC keypad keys for vi as per MS-Kermit while using ANSI.SYS. -# This should only be used when the terminal emulator cannot redefine the keys. -# Since redefining keys with ansi.sys also affects PC-DOS programs, the key -# definitions must be restored. If the terminal emulator is quit while in vi -# or others using :ks:/:ke:, the keypad will not be defined as per PC-DOS. -# The PgUp and PgDn are prefixed with ESC so that tn3270 can be used on Unix -# (^U and ^D are already defined for tn3270). The ESC is safe for vi but it -# does "beep". ESC ESC i is used for Ins to avoid tn3270 ESC i for coltab. -# Note that :kl: is always BS, because PC-dos can tolerate this change. -# Caution: vi is limited to 256 string bytes, longer crashes or weirds out vi. -# Consequently the End keypad key could not be set (it is relatively safe and -# actually useful because it sends ^@ O, which beeps and opens a line above). -ansi.sysk|ansisysk|PC-DOS 3.1 ANSI.SYS with keypad redefined for vi:\ - :is=U2 PC-DOS 3.1 ANSI.SYS with keypad redefined for vi 9-29-86\n\E[;75;8p:\ - :ke=\E[;71;0;71p\E[;72;0;72p\E[;73;0;73p\E[;77;0;77p\E[;80;0;80p\E[;81;0;81p\E[;82;0;82p\E[;83;0;83p:\ - :ks=\E[;71;30p\E[;72;11p\E[;73;27;21p\E[;77;12p\E[;80;10p\E[;81;27;4p\E[;82;27;27;105p\E[;83;127p:\ - :tc=ansi.sys: -# -# Adds ins/del line/character, hence vi reverse scrolls/inserts/deletes nicer. -nansi.sys|nansisys|PC-DOS Public Domain NANSI.SYS:\ - :al=\E[1L:dc=\E[1P:dl=\E[1M:ei=:ic=\E[1@:im=:\ - :is=U3 PC-DOS Public Domain NANSI.SYS 9-23-86\n:tc=ansi.sys: -# -# See ansi.sysk and nansi.sys above. -nansi.sysk|nansisysk|PC-DOS Public Domain NANSI.SYS with keypad redefined for vi:\ - :al=\E[1L:dc=\E[1P:dl=\E[1M:ei=:ic=\E[1@:im=:\ - :is=U4 PC-DOS Public Domain NANSI.SYS with keypad redefined for vi 9-29-86\n\E[;75;8p:tc=ansi.sysk: - -#### OS/2 -# - -# Except for the "-emx" suffixes, these are as distributed with EMX 0.9b, -# a Unix-style environment used on OS/2. (Note that the suffix makes some -# names longer than 14 characters, the nominal maximum). -# -# Removed: rmacs=\E[10m, smacs=\E[11m, because OS/2 does not implement acs. -ansi-emx|ANSI.SYS color:\ - :am:eo:mi:ms:ut:xn:xo:\ - :Co#16:co#80:it#8:li#25:pa#64:\ - :&7=^Z:AB=\E[4%p1%dm:AF=\E[3%p1%dm:DC=\E[%dp:IC=\E[%d@:\ - :K2=\E[G:S2=\E[11m:S3=\E[10m:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[1;33;44m\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:\ - :do=^J:ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:k0=\0D:k1=\0;:\ - :k2=\0<:k3=\0=:k4=\0>:k5=\0?:k6=\0@:k7=\0A:k8=\0B:k9=\0C:\ - :kH=\0O:kI=\0R:kN=\0Q:kP=\0I:kb=^H:kd=\0P:kh=\0G:kl=\0K:\ - :kr=\0M:ku=\0H:le=^H:mb=\E[5m:md=\E[1m:\ - :me=\E[0m\E[1;33;44m:mr=\E[5;37;41m:nd=\E[C:nw=^M^J:\ - :r1=\Ec:se=\E[0;44m\E[1;33m:sf=^J:so=\E[0;31;47m:st=\EH:\ - :ta=^I:u8=\E[?6c:u9=\E[c:ue=\E[0;44m\E[1;33m:up=\E[A:\ - :us=\E[1;31;44m:vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l: -ansi-color-2-emx|ANSI.SYS color 2:\ - :am:eo:mi:ms:ut:xn:xo:\ - :Co#16:co#80:it#8:li#25:pa#64:\ - :&7=^Z:AB=\E[4%p1%dm:AF=\E[3%p1%dm:DC=\E[%dp:IC=\E[%d@:\ - :K2=\E[G:S2=\E[11m:S3=\E[10m:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[0;37;44m\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:\ - :do=^J:ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:k0=\0D:k1=\0;:\ - :k2=\0<:k3=\0=:k4=\0>:k5=\0?:k6=\0@:k7=\0A:k8=\0B:k9=\0C:\ - :kH=\0O:kI=\0R:kN=\0Q:kP=\0I:kb=^H:kd=\0P:kh=\0G:kl=\0K:\ - :kr=\0M:ku=\0H:le=^H:mb=\E[5m:md=\E[1m:me=\E[0;37;44m:\ - :mr=\E[1;37;46m:nd=\E[C:nw=^M^J:r1=\Ec:se=\E[0;37;44m:\ - :sf=^J:so=\E[1;37;46m:st=\EH:ta=^I:u8=\E[?6c:u9=\E[c:\ - :ue=\E[0;37;44m:up=\E[A:us=\E[1;36;44m:vb=\E[?5h\E[?5l:\ - :ve=\E[?25h:vi=\E[?25l: -ansi-color-3-emx|ANSI.SYS color 3:\ - :am:eo:mi:ms:ut:xn:xo:\ - :Co#16:co#80:it#8:li#25:pa#64:\ - :&7=^Z:AB=\E[4%p1%dm:AF=\E[3%p1%dm:DC=\E[%dp:IC=\E[%d@:\ - :K2=\E[G:S2=\E[11m:S3=\E[10m:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[0;37;40m\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:\ - :do=^J:ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:k0=\0D:k1=\0;:\ - :k2=\0<:k3=\0=:k4=\0>:k5=\0?:k6=\0@:k7=\0A:k8=\0B:k9=\0C:\ - :kH=\0O:kI=\0R:kN=\0Q:kP=\0I:kb=^H:kd=\0P:kh=\0G:kl=\0K:\ - :kr=\0M:ku=\0H:le=^H:mb=\E[5m:md=\E[1m:me=\E[0;10m:\ - :mr=\E[1;37;46m:nd=\E[C:nw=^M^J:r1=\Ec:se=\E[0;37;40m:\ - :sf=^J:so=\E[1;37;46m:st=\EH:ta=^I:u8=\E[?6c:u9=\E[c:\ - :ue=\E[0;37;40m:up=\E[A:us=\E[0;36;40m:vb=\E[?5h\E[?5l:\ - :ve=\E[?25h:vi=\E[?25l: -mono-emx|stupid monochrome ansi terminal with only one kind of emphasis:\ - :am:\ - :co#80:it#8:li#24:\ - :K2=\E[G:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:do=\E[B:\ - :ho=\E[H:k0=\0D:k1=\0;:k2=\0<:k3=\0=:k4=\0>:k5=\0?:k6=\0@:\ - :k7=\0A:k8=\0B:k9=\0C:kH=\0O:kI=\0R:kN=\0Q:kP=\0I:kb=^H:\ - :kd=\0P:kh=\0G:kl=\0K:kr=\0M:ku=\0H:le=\E[D:me=\E[0m:\ - :mr=\E[7m:nd=\E[C:nw=^M^J:ta=^I:up=\E[A: - -# Use this for cygwin32 (tested with beta 19.1) -# underline is colored bright magenta -# shifted kf1-kf12 are kf11-kf22 -cygwin|ansi emulation for cygwin32:\ - :@7=\E[4~:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:\ - :F5=\E[28~:F6=\E[29~:F7=\E[31~:F8=\E[32~:F9=\E[33~:\ - :FA=\E[34~:RA@:SA@:k1=\E[[A:k2=\E[[B:k3=\E[[C:k4=\E[[D:\ - :k5=\E[[E:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ - :k;=\E[21~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kd=\E[B:\ - :kh=\E[1~:kl=\E[D:kr=\E[C:ku=\E[A:\ - :tc=ansi.sys: - - -#### Windows NT -# -# This entry fits the Windows NT console when the _POSIX_TERM environment -# variable is set to 'on'. While the Windows NT POSIX console is seldom used, -# the Telnet client supplied with both the Windows for WorkGroup 3.11 TCP/IP -# stack and the Win32 (i.e., Windows 95 and Windows NT 3.1 or later) operating -# systems is not, and (surprise!) they match very well. -# -# See: MS Knowledge Base item Q108581, dated 13-MAY-1997, titled "Setting Up -# VI POSIX Editor for Windows NT 3.1". True to Microsoft form, not only -# are the installation instructions a pile of mind-numbing bureaucratese, -# but the termcap entry is actually broken and unusable as given; the :do: -# capability is misspelled "d". -# -# To use this, you need to a bunch of environment variables: -# -# SET _POSIX_TERM=on -# SET TERM=ansi -# SET TERMCAP=location of termcap file in POSIX file format -# which is case-sensitive. -# e.g. SET TERMCAP=//D/RESKIT35/posix/termcap -# SET TMP=//C/TEMP -# -# Important note: setting the TMP environment variable in POSIX style renders -# it incompatible with a lot of other applications, including Visual C++. So -# you should have a separate command window just for vi. All the other -# variables may be permanently set in the Control Panel\System applet. -# -# You can find out more about the restrictions of this facility at -# . -# -# From: Federico Bianchi , 15 Jan 1997 -ansi-nt|psx_ansi|Microsoft Windows NT console POSIX ANSI mode:\ - :am:bw:ms:\ - :co#80:it#8:li#25:\ - :bl=^G:cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%d;%dH:cr=^M:do=^J:\ - :ho=\E[H:kb=^H:kd=\E[V:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :me=\E[0m:mr=\E[7m:nd=\E[C:nw=\r\E[S:rc=\E[u:sc=\E[s:\ - :se=\E[m:sf=\E[S:so=\E[7m:sr=\E[T:ta=^I:up=\E[A: -# From: jew@venus.sunquest.com -# Date: 19 Feb 93 23:41:07 GMT -# Here's a combination of ansi and vt100 termcap -# entries that works nearly perfectly for me -# (Gateway 2000 Handbook and Microsoft Works 3.0): -pcmw|PC running Microsoft Works:\ - :am:xn:\ - :co#80:it#8:li#24:vt#3:\ - :bl=^G:cd=50\E[J:ce=3\E[K:cl=50\E[;H\E[2J:\ - :cm=5\E[%i%d;%dH:cr=^M:ct=2\E[3g:do=^J:ho=\E[H:\ - :is=\E[1;24r\E[24;1H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :kb=^H:kd=\EOB:kl=\EOD:kr=\EOC:ku=\EOA:le=^H:mb=2\E[5m:\ - :md=2\E[1m:me=2\E[m:mr=2\E[7m:nd=2\E[C:nw=5\r\ED:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :rf=/usr/share/lib/tabset/vt100:sc=\E7:se=2\E[m:sf=5\ED:\ - :so=2\E[7m:sr=5\EM:st=2\EH:ta=^I:ue=2\E[m:up=2\E[A:\ - :us=2\E[4m: - -######## COMMON TERMINAL TYPES -# -# This section describes terminal classes and maker brands that are still -# quite common, but have proprietary command sets not blessed by ANSI. -# - -#### Lear-Siegler (adm) -# -# These guys are long since out of the terminals business, but -# in 1995 many current terminals still have an adm type as one of their -# emulations (usually their stupidest, and usually labeled adm3, though -# these `adm3' emulations normally have adm3a+ capabilities). -# -# WARNING: Some early ADM terminals (including the ADM3 and ADM5) had a -# `diagnostic feature' that sending them a ^G while pin 22 (`Ring Indicator') -# was being held to ground would trigger a send of the top line on the screen. -# A quick fix might be to drop back to a cheesy 4-wire cable with pin 22 -# hanging in the air. (Thanks to Eric Fischer, , -# for clearing up this point.) -# - -adm1a|adm1|lsi adm1a:\ - :am:\ - :co#80:li#24:\ - :bl=^G:cl=\E;:cm=\E=%+ %+ :cr=^M:do=^J:ho=^^:le=^H:nd=^L:\ - :sf=^J:up=^K: -adm2|lsi adm2:\ - :am:bs:\ - :co#80:li#24:\ - :al=\EE:bl=^G:cd=\EY:ce=\ET:cl=\E;:cm=\E=%+ %+ :cr=^M:\ - :dc=\EW:dl=\ER:do=^J:ei=:ho=^^:ic=\EQ:im=:kd=^J:kh=^^:kl=^H:\ - :kr=^L:ku=^K:le=^H:nd=^L:sf=^J:up=^K: -# (adm3: removed obsolete ":ma=^K^P:" -- esr) -adm3|lsi adm3:\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cl=^Z:cr=^M:do=^J:le=^H:sf=^J: -# The following ADM-3A switch settings are assumed for normal operation: -# SPACE U/L_DISP CLR_SCRN 24_LINE -# CUR_CTL LC_EN AUTO_NL FDX -# Other switches may be set for operator convenience or communication -# requirements. I recommend -# DISABLE_KB_LOCK LOCAL_OFF 103 202_OFF -# ETX_OFF EOT_OFF -# Most of these terminals required an option ROM to support lower case display. -# Open the case and look at the motherboard; if you see an open 24-pin DIP -# socket, you may be out of luck. -# -# (adm3a: some capabilities merged in from BRl entry -- esr) -adm3a|lsi adm3a:\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cl=1\032:cm=\E=%+ %+ :cr=^M:do=^J:ho=^^:kd=^J:kl=^H:\ - :kr=^L:ku=^K:le=^H:ma=^K^P:nd=^L:nl=^J:r1=^N:rs=^N:sf=^J:\ - :up=^K: -adm3a+|adm3a plus:\ - :kb=^H:tc=adm3a: -# (adm5: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" & duplicate ":do=^J:" -- esr) -adm5|lsi adm5:\ - :sg#1:\ - :bl=^G:cd=\EY:ce=\ET:cr=^M:do=^J:kb=^H:kh=^^:se=\EG:so=\EG:tc=adm3a+: -# A lot of terminals other than adm11s use these. Wherever you see -# use=adm+sgr with some of its capabilities disabled, try the -# disabled ones. They may well work but not have been documented or -# expressed in the using entry. We'd like to cook up an :sa: but the -# :ae:/:as: sequences of the using entries vary too much. -adm+sgr|adm style highlight capabilities:\ - :me=\EG0:mk=\EG1:mr=\EG4:se=\EG0:so=\EG4:ue=\EG0:us=\EG8: -# LSI ADM-11 from George William Hartwig, Jr. via BRL -# Status line additions from Stephen J. Muir -# :kh: from . :cl: could also -# be ^Z, according to his entry. -# (adm11: :us:=\EG4 was obviously erroneous because it also said -# :mr:=\EG4. Looking at other ADMs confirms this -- esr) -adm11|LSI ADM-11:\ - :am:bs:hs:\ - :co#80:kn#8:li#24:\ - :bl=^G:cd=\EY:ce=\ET:cl=\E*:cm=\E=%+ %+ :cr=^M:do=^J:ds=\Eh:\ - :fs=\E(\r:ho=^^:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:\ - :k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:kb=^H:kd=^J:kh=^^:\ - :kl=^H:kr=^L:ku=^K:le=^H:mb=\EG2:nd=^L:nl=^J:nw=^M^J:ta=^I:\ - :ts=\EF\E):up=^K:\ - :tc=adm+sgr: -# From: Andrew Scott Beals -# Corrected by Olaf Siebert , 11 May 1995 -# Supervisor mode info by Ari Wuolle, , 27 Aug 1996 -# (adm12: removed obsolete ":kn:ma=j^Jk^P^K^Pl ^R^L^L :". This formerly had -# :is:=\Eq but that looked wrong; this :is: is from Dave Yost -# via BRL. That entry asserted :sg#1:, but I've left that out because -# neither earlier nor later ADMSs have it -- esr) -# -# You will need to get into the supervisor setup before you can set -# baudrate etc. for your ADM-12+. Press Shift-Ctrl-Setup and you should -# see a lot more setup options. -# -# While in supervisor setup you can also use following codes: -# -# Ctrl-P Personality character selections (configure for example what -# arrow keys send, if I recall correctly) -# Ctrl-T tabs 1-80 use left&right to move and up to set and -# Ctrl-V tabs 81-158 down to clear tab. Shift-Ctrl-M sets right margin at cursor -# Ctrl-B Binary setup (probably not needed. I think that everything can -# be set using normal setup) -# Ctrl-A Answerback mode (enter answerback message) -# Ctrl-U User friendly mode (normal setup) -# Ctrl-D Defaults entire setup and function keys from EPROM tables -# Ctrl-S Save both setup and functions keys. Takes from 6 to 10 seconds. -# Ctrl-R Reads both setup and functions keys from NVM. -# Shift-Ctrl-X Unlock keyboard and cancel received X-OFF status -# -# ADM-12+ supports hardware handshaking, but it is DTR/CTS as opposed to -# RTS/CTS used nowadays with virtually every modem and computer. 19200 -# bps works fine with hardware flow control. -# -# The following null-modem cable should fix this and enable you to use -# RTS/CTS handshaking (which Linux supports, use CRTSCTS setting). Also -# set ADM-12+ for DTR handshaking from supervisor setup. -# -# PC Serial ADM-12+ -# -------- ------- -# 2 - 3 -# 3 - 2 -# 4 - 5 -# 5 - 20 -# 6,8 - 4 -# 7 - 7 -# 20 - 6,8 -# -adm12|lsi adm12:\ - :am:bs:mi:pt:\ - :co#80:it#8:li#24:\ - :al=\EE:bl=^G:cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :cr=^M:ct=\E0:\ - :dc=\EW:dl=\ER:do=^J:ei=\Er:ho=^^:ic=\EQ:im=\Eq:\ - :is=\E0 \E1 \E1 \E1 \E1 \E1 \E1 \E1 \E1:\ - :k0=^A0\r:k1=^A1\r:k2=^A2\r:k3=^A3\r:k4=^A4\r:k5=^A5\r:\ - :k6=^A6\r:k7=^A7\r:k8=^A8\r:k9=^A9\r:kd=^J:kl=^H:kr=^L:\ - :ku=^K:le=^H:nd=^L:st=\E1:up=^K:\ - :tc=adm+sgr: -# (adm20: removed obsolete ":kn#7:" -- esr) -adm20|lear siegler adm20:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :al=\EE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=^Z:\ - :cm=\E=%i%r%+^_%+^_:cr=^M:dc=\EW:dl=\ER:ei=:ho=^^:ic=\EQ:\ - :im=:k1=^A:k2=^B:k3=^W:k4=^D:k5=^E:k6=^X:k7=^Z:le=^H:me=\E(:\ - :nd=^L:se=\E(:so=\E):ta=^I:up=^K: -adm21|lear siegler adm21:\ - :sg#1:\ - :al=30*\EE:bl=^G:cd=\EY:ce=\ET:cr=^M:dc=\EW:dl=30*\ER:do=^J:\ - :ei=:ic=\EQ:im=:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:mk@:sf=^J:\ - :tc=adm+sgr:tc=adm3a: -# (adm22: ":em=:" was an obvious typo for ":ei=:"; also, -# removed obsolete ":kn#7:ma=j^Jk^P^K^Pl ^R^L^L :"; -# removed bogus-looking \200 from before :cm:. -- esr) -adm22|lsi adm22:\ - :am:bs:\ - :co#80:li#24:\ - :al=\EE:bl=^G:bt=\EI:cd=\Ey:ce=\Et:cl=\E+:cm=\E=%+ %+ :\ - :cr=^M:dc=\EW:dl=\ER:do=^J:ei=:ho=^^:ic=\EQ:im=:\ - :is=\E%\014\014\014\016\003\0\003\002\003\002\0\0\0\0\0\0\0\0\0\0\0:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:l1=F1:l2=F2:\ - :l3=F3:l4=F4:l5=F5:l6=F6:l7=F7:le=^H:me=\E(:nd=^L:se=\E(:\ - :so=\E):ta=\Ei:up=^K: -# ADM 31 DIP Switches -# -# This information comes from two versions of the manual for the -# Lear-Siegler ADM 31. -# -# Main board: -# rear of case -# +-||||-------------------------------------+ -# + S1S2 ||S + -# + ||3 + -# + + -# + ||S + -# + ||4 + -# + + -# + + -# + + -# + + -# + + -# +-+ +-+ -# + + -# + S5 S6 S7 + -# + == == == + -# +----------------------------------------------+ -# front of case (keyboard) -# -# S1 - Data Rate - Modem -# S2 - Data Rate - Printer -# ------------------------ -# Data Rate Setting -# ------------------- -# 50 0 0 0 0 -# 75 1 0 0 0 -# 110 0 1 0 0 -# 134.5 1 1 0 0 -# 150 0 0 1 0 -# 300 1 0 1 0 -# 600 0 1 1 0 -# 1200 1 1 1 0 -# 1800 0 0 0 1 -# 2000 1 0 0 1 -# 2400 0 1 0 1 -# 3600 1 1 0 1 -# 4800 0 0 1 1 -# 7200 1 0 1 1 -# 9600 0 1 1 1 -# x 1 1 1 1 -# -# S3 - Interface/Printer/Attributes -# --------------------------------- -# Printer Busy Control -# sw1 sw2 sw3 -# --------------- -# off off off Busy not active, CD disabled -# off off on Busy not active, CD enabled -# off on off Busy active on J5-20, CD disabled -# on off off Busy active on J5-19, CD disabled - Factory Set. -# on off on Busy active on J5-19, CD enabled -# -# sw4 Used in conjuction with S4 for comm interface control - Fact 0 -# -# sw5 Secondary Channel Control (Hardware implementation only) - Fact 0 -# -# sw6 ON enables printer BUSY active LOW - Factory Setting -# OFF enables printer BUSY active HIGH - If set to this, ADM31 senses -# -# sw7 ON - steady cursor - Factory Setting -# OFF - blinking cursor -# -# sw8 ON causes selected attribute character to be displayed -# OFF causes SPACE to be displayed instead - Factory Setting -# -# S4 - Interface -# -------------- -# Modem Interface -# S3 S4 S4 S4 S4 -# sw4 sw1 sw2 sw3 sw4 -# --------------------------- -# OFF ON OFF ON OFF Enable RS-232C interface, Direct Connect and -# Current Loop disabled - Factory Setting -# ON ON OFF ON OFF Enable Current Loop interface, Direct Connect -# disabled -# OFF OFF ON OFF ON Enable Direct Connect interface, RS-232C and -# Current Loop Disabled -# -# sw5 ON disables dot stretching mode - Factory Setting -# OFF enables dot stretching mode -# sw6 ON enables blanking function -# OFF enables underline function - Factory Setting -# sw7 ON causes NULLS to be displayed as NULLS -# OFF causes NULLS to be displayed as SPACES - Factory Setting -# -# S5 - Word Structure -# ------------------- -# sw1 ON enables BREAK key - Factory Setting -# OFF disables BREAK key -# sw2 ON selects 50Hz monitor refresh rate -# OFF selects 60Hz monitor refresh rate - Factory Setting -# -# Modem Port Selection -# sw3 sw4 sw5 -# --------------- -# ON ON ON Selects 7 DATA bits, even parity, 2 STOP bits -# OFF ON ON Selects 7 DATA bits, odd parity, 2 STOP bits -# ON OFF ON Selects 7 DATA bits, even parity, 1 STOP bit - Factory Set. -# OFF OFF ON Selects 7 DATA bits, odd parity, 1 STOP bit -# ON ON OFF Selects 8 DATA bits, no parity, 2 STOP bits -# OFF ON OFF Selects 8 DATA bits, no parity, 1 STOP bit -# ON OFF OFF Selects 8 DATA bits, even parity, 1 STOP bit -# OFF OFF OFF Selects 8 DATA bits, odd parity, 1 STOP bit -# -# sw6 ON sends bit 8 a 1 (mark) -# OFF sends bit 8 as 0 (space) - Factory Setting -# sw7 ON selects Block Mode -# OFF selects Conversation Mode - Factory Setting -# sw8 ON selects Full Duplex operation -# OFF selects Half Duplex operation - Factory Setting -# -# S6 - Printer -# ------------ -# sw1, sw2, sw6, sw7 Reserved - Factory 0 -# -# Printer Port Selection -# same as Modem above, bit 8 (when 8 DATA bits) is always = 0 -# -# sw8 ON enables Printer Port -# OFF disables Printer Port - Factory Setting -# -# S7 - Polling Address -# -------------------- -# sw1-7 Establish ASCII character which designates terminal polling address -# ON = logic 0 -# OFF = logic 1 - Factory Setting -# sw8 ON enables Polling Option -# OFF disables Polling Option - Factory Setting -# -# -# On some older adm31s, S4 does not exist, and S5-sw6 is not defined. -# -# This adm31 entry uses underline as the standout mode. -# If the adm31 gives you trouble with standout mode, check the DIP switch in -# position 6, bank @c11, 25% from back end of the circuit board. Should be -# OFF. If there is no such switch, you have an old adm31 and must use oadm31. -# (adm31: removed obsolete ":ma=j^Jk^P^K^Pl ^R^L^L :" -- esr) -adm31|lsi adm31 with sw6 set for underline mode:\ - :am:bs:mi:\ - :co#80:li#24:\ - :al=\EE:bl=^G:cd=\EY:ce=\ET:cl=\E*:cm=\E=%+ %+ :cr=^M:\ - :dc=\EW:dl=\ER:do=^J:ei=\Er:ho=^^:im=\Eq:is=\Eu\E0:k0=^A0\r:\ - :k1=^A1\r:k2=^A2\r:k3=^A3\r:k4=^A4\r:k5=^A5\r:k6=^A6\r:\ - :k7=^A7\r:k8=^A8\r:k9=^A9\r:kd=^J:kl=^H:kr=^L:ku=^K:le=^H:\ - :me=\EG0:nd=^L:se=\EG0:sf=^J:so=\EG1:ue=\EG0:up=^K:us=\EG1: -adm31-old|o31|old adm31:\ - :so=\EG4:ue@:us@:tc=adm31: -# LSI ADM-36 from Col. George L. Sicherman via BRL -adm36|LSI ADM36:\ - :bs:pt:\ - :kn#4:\ - :if=/usr/lib/tabset/vt100:\ - :is=\E<\E>\E[6;?2;?7;?8h\E[4;20;?1;?3;?4;?5;?6;?18;?19l:tc=vt100: -# (adm42: removed obsolete ":ma=^K^P:" -- esr) -adm42|lsi adm42:\ - :am:bs:\ - :co#80:li#24:\ - :al=\EE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E;:cm=\E=%+ %+ :\ - :cr=^M:dc=\EW:dl=\ER:do=^J:ei=\Er:im=\Eq:ip=:kd=^J:kh=^^:\ - :kl=^H:kr=^L:ku=^K:le=^H:mk@:nd=^L:pc=\177:sf=^J:ta=^I:ue@:\ - :up=^K:us@:vs=\EC\E3 \E3(:\ - :tc=adm+sgr: -# The following termcap for the Lear Siegler ADM-42 leaves the -# "system line" at the bottom of the screen blank (for those who -# find it distracting otherwise) -adm42-ns|lsi adm-42 with no system line:\ - :al=\EE\EF \011:bt=\EI\EF \011:cd=\EY\EF \011:\ - :ce=\ET\EF \011:cl=\E;\EF \011:cm=\E=%+ %+ \EF \011:\ - :dc=\EW\EF \011:dl=\ER\EF \011:ei=\Er\EF \011:\ - :im=\Eq\EF \011:tc=adm42: -# ADM 1178 terminal -- rather like an ADM-42. Manual is dated March 1 1985. -# The insert mode of this terminal is commented out because it's broken for our -# purposes in that it will shift the position of every character on the page, -# not just the cursor line! -# From: Michael Driscoll 10 July 1996 -adm1178|1178|lsi adm1178:\ - :am:\ - :co#80:li#24:sg#1:\ - :al=\EE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:cm=\E=%+ %+ :\ - :cr=^M:dc=\EW:dl=\ER:do=^J:ho=^^:ip=6*:kb=^H:kd=^J:kl=^H:\ - :le=^H:md=\E(:me=\E):mr=\EG4:nd=^L:nw=^M^J:pc=\177:se=\EG0:\ - :sf=^J:so=\EG4:ta=^I:ue=\EG0:up=^K:us=\EG1:vs=\EC\E3 \E3(: - -#### Qume (qvt) -# -# Qume, Inc. -# 3475-A North 1st Street -# San Jose CA 95134 -# Vox: (800)-457-4447 -# Fax: (408)-473-1510 -# Net: josed@techsupp.wyse.com (Jose D'Oliveira) -# -# Qume was bought by Wyse, but still (as of early 1995) has its own support -# group and production division. -# -# Discontinued Qume models: -# -# The qvt101 and qvt102 listed here are long obsolete; so is the qvt101+ -# built to replace them, and a qvt119+ which was a 101+ with available wide -# mode (132 columns). There was a qvt103 which added vt100/vt131 emulations -# and an ANSI-compatible qvt203 that replaced it. Qume started producing -# ANSI-compatible terminals with the qvt323 and qvt61. -# -# Current Qume models (as of February 1995): -# -# All current Qume terminals have ANSI-compatible operation modes. -# Qume is still producing the qvt62, which features emulations for other -# popular lines such as ADDS, and dual-host capabilities. The qvt82 is -# designed for use as a SCO ANSI terminal. The qvt70 is a color terminal -# with many emulations including Wyse370, Wyse 325, etc. Their newest -# model is the qvt520, which is vt420-compatible. -# -# There are some ancient printing Qume terminals under `Daisy Wheel Printers' -# -# If you inherit a Qume without docs, try Ctrl-Shift-Setup to enter its -# setup mode. Shift-s should be a configuration save to NVRAM. - -qvt101|qvt108|qume qvt 101 and QVT 108:\ - :sg#1:tc=qvt101+: - -# This used to have :vs=\E.2: but no :ve: or :vi:. The BSD termcap -# file had :vs=\EM4 \200\200\200:. I've done the safe thing and yanked -# both. The :mr: is from BSD, which also claimed bold=\E( and dim=\E). -# What seems to be going on here is that this entry was designed so that -# the normal highlight is bold and standout is dim plus something else -# (reverse-video maybe? But then, are there two :mr: sequences?) -qvt101+|qvt101p|qume qvt 101 PLUS product:\ - :am:bw:hs:ul:\ - :co#80:li#24:sg#0:\ - :al=\EE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :cr=^M:\ - :ct=\E3:dc=\EW:dl=\ER:do=^J:ds=\Eg\Ef\r:ei=:fs=^M:ho=^^:\ - :ic=\EQ:im=:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:\ - :k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:k;=^AI\r:kA=\EE:\ - :kB=\EI:kE=\ET:kI=\EQ:kL=\ER:kS=\EY:kb=^H:kd=^J:kh=^^:kl=^H:\ - :kr=^L:ku=^K:le=^H:mk@:nd=^L:pf=\EA:po=\E@:se=\E(:sf=^J:\ - :so=\E0P\E):st=\E1:ta=^I:ts=\Eg\Ef:up=^K:vb=\Eb\Ed:ve=\E.4:\ - :tc=adm+sgr: -qvt102|qume qvt 102:\ - :ve=\E.:tc=qvt101: -# (qvt103: added / based on init string -- esr) -qvt103|qume qvt 103:\ - :am:xn:xo:\ - :co#80:it#8:li#24:vt#3:\ - :DO=\E[%dB:LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:\ - :UP=\E[%dA:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:do=^J:\ - :ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kb=^H:kd=\EOB:\ - :ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :..sa=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:\ - :up=\E[A:us=\E[4m: -qvt103-w|qume qvt103 132 cols:\ - :co#132:li#24:\ - :r2=\E>\E[?3h\E[?4l\E[?5l\E[?8h:tc=qvt103: -qvt119+|qvt119p|qvt119|qume qvt 119 and 119PLUS terminals:\ - :am:hs:mi:ms:\ - :co#80:li#24:sg#0:\ - :al=\EE:bl=^G:bt=\EI:cd=\Ey:ce=\Et:cl=\E*1:cm=\E=%+ %+ :\ - :cr=^M:ct=\E3:dc=\EW:dl=\ER:do=^J:ds=\Eg\Ef\r:ei=\Er:fs=^M:\ - :ho=^^:im=\Eq:is=\EDF\EC\EG0\Er\E(\E%EX:k0=^AI\r:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:\ - :ku=^K:le=^H:nd=^L:pf=\EA:po=\E@:sf=^J:sr=\EJ:st=\E1:ta=^I:\ - :ts=\Eg\Ef:up=^K:us=\EG8:vb=\En0\En1:ve=\E.4:vs=\E.2:\ - :tc=adm+sgr: -qvt119+-25|qvt119p-25|QVT 119 PLUS with 25 data lines:\ - :li#25:tc=qvt119+: -qvt119+-w|qvt119p-w|qvt119-w|QVT 119 and 119 PLUS in 132 column mode:\ - :co#132:\ - :is=\EDF\EC\EG0\Er\E(\E%\EX\En4:tc=qvt119+: -qvt119+-25-w|qvt119p-25-w|qvt119-25-w|QVT 119 and 119 PLUS 132 by 25:\ - :li#25:tc=qvt119+: -qvt203|qvt203+|qume qvt 203 Plus:\ - :al=\E[L:dc=\E[P:dl=\E[M:ei=\E[4l:im=\E[4h:ip=:k0=\E[29~:\ - :k1=\E[17~:k2=\E[18~:k3=\E[19~:k4=\E[20~:k5=\E[21~:\ - :k6=\E[23~:k7=\E[24~:k8=\E[25~:k9=\E[28~:sf=\n:\ - :tc=qvt103: -qvt203-w|qvt203-w-am|qume qvt 203 PLUS in 132 cols (w/advanced video):\ - :co#132:li#24:\ - :r2=\E>\E[?3h\E[?4l\E[?5l\E[?8h:tc=qvt203: -# -# Since a command is present for enabling 25 data lines, -# a specific terminfo entry may be generated for the 203. -# If one is desired for the QVT 119 PLUS then 25 lines must -# be selected in the status line (setup line 9). -# -qvt203-25|QVT 203 PLUS with 25 by 80 column mode:\ - :co#80:li#25:\ - :is=\E[=40h\E[?3l:tc=qvt203: -qvt203-25-w|QVT 203 PLUS with 25 by 132 columns:\ - :co#132:li#25:\ - :r2=\E[?3h\E[=40h:tc=qvt203: - -#### Televideo (tvi) -# -# TeleVideo -# 550 East Brokaw Road -# PO Box 49048 95161 -# San Jose CA 95112 -# Vox: (408)-954-8333 -# Fax: (408)-954-0623 -# -# -# There are some tvi terminals that require incredible amounts of padding and -# some that don't. I'm assuming tvi912 and tvi920 are the old slow ones, and -# tvi912b, tvi912c, tvi920b, tvi920c are the new ones that don't need padding. -# -# All of these terminals (912 to 970 and the tvipt) are discontinued. Newer -# Televideo terminals are ANSI and PC-ANSI compatible. - -tvi803|televideo 803:\ - :cl=\E*:tc=tvi950: - -# Vanilla tvi910 -- W. Gish 10/29/86 -# Switch settings are: -# -# S1 1 2 3 4 -# D D D D 9600 -# D D D U 50 -# D D U D 75 -# D D U U 110 -# D U D D 135 -# D U D U 150 -# D U U D 300 -# D U U U 600 -# U D D D 1200 -# U D D U 1800 -# U D U D 2400 -# U D U U 3600 -# U U D D 4800 -# U U D U 7200 -# U U U D 9600 -# U U U U 19200 -# -# S1 5 6 7 8 -# U D X D 7N1 (data bits, parity, stop bits) (X means ignored) -# U D X U 7N2 -# U U D D 7O1 -# U U D U 7O2 -# U U U D 7E1 -# U U U U 7E2 -# D D X D 8N1 -# D D X U 8N2 -# D U D D 8O1 -# D U U U 8E2 -# -# S1 9 Autowrap -# U on -# D off -# -# S1 10 CR/LF -# U do CR/LF when CR received -# D do CR when CR received -# -# S2 1 Mode -# U block -# D conversational -# -# S2 2 Duplex -# U half -# D full -# -# S2 3 Hertz -# U 50 -# D 60 -# -# S2 4 Edit mode -# U local -# D duplex -# -# S2 5 Cursor type -# U underline -# D block -# -# S2 6 Cursor down key -# U send ^J -# D send ^V -# -# S2 7 Screen colour -# U green on black -# D black on green -# -# S2 8 DSR status (pin 6) -# U disconnected -# D connected -# -# S2 9 DCD status (pin 8) -# U disconnected -# D duplex -# -# S2 10 DTR status (pin 20) -# U disconnected -# D duplex -# (tvi910: removed obsolete ":ma=^Kk^Ll^R^L:"; added :kh:, :le:, :do:, -# :sf:, , , :am:, :ms: from SCO entry -- esr) -tvi910|televideo model 910:\ - :am:bs:ms:\ - :co#80:it#8:li#24:sg#1:\ - :bl=^G:bt=\EI:cd=\EY:ce=\ET:ch=\E]%+ :cl=^Z:cm=\E=%+ %+ :\ - :cr=^M:cv=\E[%+ :do=^J:ho=\E=\001\001:\ - :if=/usr/share/tabset/stdcrt:k0=^AI\r:k1=^A@\r:k2=^AA\r:\ - :k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:\ - :k9=^AH\r:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:mk@:nd=^L:\ - :sf=^J:ta=^I:up=^K:\ - :tc=adm+sgr: -# From: Alan R. Rogers -# as subsequently hacked over by someone at SCO -# (tvi910+: removed obsolete ":ma=^K^P^L :" -- esr) -# -# Here are the 910+'s DIP switches (U = up, D = down, X = don't care): -# -# S1 1 2 3 4: -# D D D D 9600 D D D U 50 D D U D 75 D D U U 110 -# D U D D 135 D U D U 150 D U U D 300 D U U U 600 -# U D D D 1200 U D D U 1800 U D U D 2400 U D U U 3600 -# U U D D 4800 U U D U 7200 U U U D 9600 U U U U 19200 -# -# S1 5 6 7 8: -# U D X D 7N1 U D X U 7N2 U U D D 7O1 U U D U 7O2 -# U U U D 7E1 U U U U 7E2 D D X D 8N1 D D X U 8N2 -# D U D D 8O1 D U U U 8E2 -# -# S1 9 Autowrap (U = on, D = off) -# S1 10 CR/LF (U = CR/LF on CR received, D = CR on CR received) -# S2 1 Mode (U = block, D = conversational) -# S2 2 Duplex (U = half, D = full) -# S2 3 Hertz (U = 50, D = 60) -# S2 4 Edit mode (U = local, D = duplex) -# S2 5 Cursor type (U = underline, D = block) -# S2 6 Cursor down key (U = send ^J, D = send ^V) -# S2 7 Screen colour (U = green on black, D = black on green) -# S2 8 DSR status (pin 6) (U = disconnected, D = connected) -# S2 9 DCD status (pin 8) (U = disconnected, D = connected) -# S2 10 DTR status (pin 20) (U = disconnected, D = connected) -# -tvi910+|televideo 910+:\ - :al=\EE:dc=\EW:dl=\ER:ei=:ho=^^:ic=\EQ:im=:k0=^A@\r:k1=^AA\r:\ - :k2=^AB\r:k3=^AC\r:k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:\ - :k8=^AH\r:k9=^AI\r:ll=\E=7 :\ - :tc=tvi910: - -# (tvi912: removed obsolete ":ma=^K^P^L :", added :vb: and -# :kh: from BRL entry -- esr) -tvi912|tvi914|tvi920|old televideo 912/914/920:\ - :am:bs:ms:pt:\ - :co#80:it#8:li#24:sg#1:\ - :al=\EE:bl=^G:cd=\Ey:ce=\ET:cl=^Z:cm=\E=%+ %+ :cr=^M:ct=\E3:\ - :dc=\EW:dl=\ER:do=^J:ei=:ho=^^:ic=\EQ:\ - :if=/usr/share/tabset/stdcrt:im=:k0=^AI\r:k1=^A@\r:\ - :k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\ - :k8=^AG\r:k9=^AH\r:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:\ - :nd=^L:se=\Ek:sf=^J:so=\Ej:st=\E1:ta=^I:ue=\Em:up=^K:us=\El:\ - :vb=\Eb\Ed: -# the 912 has a key that's like shift: 8 xmits "^A8\r". -# The 920 has this plus real function keys that xmit different things. -# Terminfo makes you use the funct key on the 912 but the real keys on the 920. -tvi912c|tvi912b|new televideo 912:\ - :al=\EE:dl=\ER:tc=tvi912: -# set to page 1 when entering curses application (\E-17 ) -# reset to page 0 when exiting curses application (\E-07 ) -tvi912-2p|tvi920-2p|tvi-2p|televideo w/2 pages:\ - :te=\E-07 :ti=\E-17 :tc=tvi912: -# We got some new tvi912c terminals that act really weird on the regular -# termcap, so one of our gurus worked this up. Seems that cursor -# addressing is broken. -tvi912cc|tvi912 at cowell college:\ - :cm@:tc=tvi912c: - -# Here are the switch settings for the tvi920c: -# -# S1 (Line), and S3 (Printer) baud rates -- put one, and only one, switch down: -# 2: 9600 3: 4800 4: 2400 5: 1200 -# 6: 600 7: 300 8: 150 9: 75 -# 10: 110 -# -# S2 UART/Terminal options: -# Up Down -# 1: Not used Not allowed -# 2: Alternate character set Standard character set -# 3: Full duplex Half duplex -# 4: 50 Hz refresh 60 Hz refresh -# 5: No parity Send parity -# 6: 2 stop bits 1 stop bit -# 7: 8 data bits 7 data bits -# 8: Not used Not allowed on Rev E or lower -# 9: Even parity Odd parity -# 10: Steady cursor Blinking cursor -# (On Rev E or lower, use W25 instead of switch 10.) -# -# S5 UART/Terminal options: -# Open Closed -# 1: P3-6 Not connected DSR received on P3-6 -# 2: P3-8 Not connected DCD received on P3-8 -# -# 3 Open, 4 Open: P3-20 Not connected -# 3 Open, 4 Closed: DTR on when terminal is on -# 3 Closed, 4 Open: DTR is connected to RTS -# 3 Closed, 4 Closed: Not allowed -# -# 5 Closed: HDX printer (hardware control) Rev. K with extension port off, -# all data transmitted out of the modem port (P3) will also be -# transmitted out of the printer port (P4). -# -# 6 Open, 7 Open: Not allowed -# 6 Open, 7 Closed: 20ma current loop input -# 6 Closed, 7 Open: RS232 input -# 6 Closed, 7 Closed: Not allowed -# -# Jumper options: -# If the jumper is installed, the effect will occur (the next time the terminal -# is switched on). -# -# S4/W31: Enables automatic LF upon receipt of CR from -# remote or keyboard. -# S4/W32: Enables transmission of EOT at the end of Send. If not -# installed, a carriage return is sent. -# S4/W33: Disables automatic carriage return in column 80. -# S4/W34: Selects Page Print Mode as initial condition. If not -# installed, Extension Mode is selected. -# -tvi920b|tvi920c|new televideo 920:\ - :al=\EE:dl=\ER:k0=^AI\r:k1=^A@\r:k2=^AA\r:k3=^AB\r:\ - :k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:\ - :tc=tvi912: - -# Televideo 921 and variants -# From: Tim Theisen 22 Sept 1995 -# (tvi921: removed :ko=bt: before translation, I see no backtab cap; -# also added empty to suppress tic warning -- esr) -tvi921|televideo model 921 with sysline same as page & real vi function:\ - :am:bs:hs:pt:xn:xs:\ - :co#80:li#24:sg#0:\ - :ac=:ae=\E%:al=\EE:as=\E$:cd=\EY:ce=\ET:cl=^Z:cm=3\E=%+ %+ :\ - :cr=^M:dc=\EW:dl=1*\ER:do=^V:ds=\Ef\r\Eg:ei=:fs=\Eg:ho=^^:\ - :ic=\EQ:if=/usr/share/tabset/stdcrt:im=:\ - :is=\El\E"\EF1\E.3\017\EA\E<:kA=\EE:kC=^Z:kD=\EW:kE=\ET:\ - :kI=\EQ:kL=1*\ER:kS=\EY:kb=^H:kd=^V:kl=^H:kr=^L:ku=^K:le=^H:\ - :mk@:nd=^L:nw=^M^J:sf=^J:ta=^I:ts=\Ef\EG0:up=^K:ve=\E.3:\ - :vs=\E.2:\ - :tc=adm+sgr: -# without the beeper -# (tvi92B: removed :ko=bt: before translation, I see no backtab cap; -# also added empty to suppress tic warning -- esr) -tvi92B|televideo model 921 with sysline same as page & real vi function & no beeper:\ - :am:hs:xn:xs:\ - :co#80:li#24:sg#0:\ - :ac=:ae=\E%:al=\EE:as=\E$:cd=\EY:ce=\ET:cl=^Z:cm=3\E=%+ %+ :\ - :cr=^M:dc=\EW:dl=1*\ER:do=^V:ds=\Ef\r\Eg:ei=:fs=\Eg:ho=^^:\ - :ic=\EQ:if=/usr/share/tabset/stdcrt:im=:\ - :is=\El\E"\EF1\E.3\017\EA\E<:kA=\EE:kC=^Z:kD=\EW:kE=\ET:\ - :kI=\EQ:kL=1*\ER:kS=\EY:kb=^H:kd=^V:kl=^H:kr=^L:ku=^K:le=^H:\ - :mk@:nd=^L:nw=^M^J:sf=^J:ta=^I:ts=\Ef\EG0:up=^K:vb=\Eb\Ed:\ - :ve=\E.3:vs=\E.2:\ - :tc=adm+sgr: -# (tvi92D: removed :ko=bt: before translation, I see no backtab cap -- esr) -tvi92D|tvi92B with DTR instead of XON/XOFF & better padding:\ - :al=2*\EE:dl=2*\ER:is=\El\E"\EF1\E.3\016\EA\E<:kA=2*\EE:\ - :kL=2*\ER:\ - :tc=tvi92B: - -# (tvi924: This used to have :ds=\Es0:, :fs=\031:. I put the new strings -# in from a BSD termcap file because it looks like they do something the -# old ones skip -- esr) -tvi924|televideo tvi924:\ - :am:bw:hs:in:mi:ms:xn:xo:\ - :co#80:it#8:li#24:sg#0:ws#80:\ - :F1=^AK\r:F2=^AL\r:F3=^AM\r:F4=^AN\r:F5=^AO\r:al=\EE:bl=^G:\ - :bt=\EI:cd=\Ey:ce=\Et:cl=\E*0:cm=\E=%+ %+ :cr=^M:\ - :cs=\E_%+ %+ :ct=\E3:dc=\EW:dl=\ER:do=^V:ds=\Es0\Ef\031:\ - :ei=:fs=\031\Es1:ho=^^:\ - :i1=\017\E%\E'\E(\EDF\EC\EG0\EN0\Es0\Ev0:ic=\EQ:\ - :if=/usr/share/tabset/stdcrt:im=:k0=^A@\r:k1=^AA\r:\ - :k2=^AB\r:k3=^AC\r:k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:\ - :k8=^AH\r:k9=^AI\r:k;=^AJ\r:kA=\EE:kC=\E*0:kD=\EW:kE=\Et:\ - :kI=\EQ:kL=\ER:kS=\Ey:kb=^H:kd=^V:kh=^^:kl=^H:kr=^L:ku=^K:\ - :l0=F1:l1=F2:l2=F3:l3=F4:l4=F5:l5=F6:l6=F7:l7=F8:l8=F9:l9=F10:\ - :la=F11:le=^H:mb=\EG2:mk@:nd=^L:pk=\E|%+1%s\031:sf=^J:\ - :sr=\Ej:st=\E1:ta=^I:ts=\Ef:up=^K:vb=\Eb\Ed:ve=\E.3:vi=\E.0:\ - :vs=\E.1:\ - :tc=adm+sgr: - -# TVI925 DIP switches. In each of these, D = Down and U = Up, -# -# Here are the settings for the external (baud) switches (S1): -# -# Position Baud -# 7 8 9 10 [Printer] -# 1 2 3 4 [Main RS232] -# ----------------------------------------------------- -# D D D D 9600 -# D D D U 50 -# D D U D 75 -# D D U U 110 -# D U D D 135 -# D U D U 150 -# D U U D 300 -# D U U U 600 -# U D D D 1200 -# U D D U 1800 -# U D U D 2400 -# U D U U 3600 -# U U D D 4800 -# U U D U 7200 -# U U U D 9600 -# U U U U 19200 -# -# -# Settings for word length and stop-bits (S1) -# -# Position Description -# 5 6 -# --------------------------- -# U - 7-bit word -# D - 8-bit word -# - U 2 stop bits -# - D 1 stop bit -# -# -# S2 (external) settings -# -# Position Up Dn Description -# -------------------------------------------- -# 1 X Local edit -# X Duplex edit (transmit editing keys) -# -------------------------------------------- -# 2 X 912/920 emulation -# X 925 -# -------------------------------------------- -# 3 X -# 4 X No parity -# 5 X -# -------------------------------------------- -# 3 X -# 4 X Odd parity -# 5 X -# -------------------------------------------- -# 3 X -# 4 X Even parity -# 5 X -# -------------------------------------------- -# 3 X -# 4 X Mark parity -# 5 X -# -------------------------------------------- -# 3 X -# 4 X Space parity -# 5 X -# -------------------------------------------- -# 6 X White on black display -# X Black on white display -# -------------------------------------------- -# 7 X Half Duplex -# 8 X -# -------------------------------------------- -# 7 X Full Duplex -# 8 X -# -------------------------------------------- -# 7 X Block mode -# 8 X -# -------------------------------------------- -# 9 X 50 Hz -# X 60 Hz -# -------------------------------------------- -# 10 X CR/LF (Auto LF) -# X CR only -# -# S3 (internal switch) settings: -# -# Position Up Dn Description -# -------------------------------------------- -# 1 X Keyclick off -# X Keyclick on -# -------------------------------------------- -# 2 X English -# 3 X -# -------------------------------------------- -# 2 X German -# 3 X -# -------------------------------------------- -# 2 X French -# 3 X -# -------------------------------------------- -# 2 X Spanish -# 3 X -# -------------------------------------------- -# 4 X Blinking block cursor -# 5 X -# -------------------------------------------- -# 4 X Blinking underline cursor -# 5 X -# -------------------------------------------- -# 4 X Steady block cursor -# 5 X -# -------------------------------------------- -# 4 X Steady underline cursor -# 5 X -# -------------------------------------------- -# 6 X Screen blanking timer (ON) -# X Screen blanking timer (OFF) -# -------------------------------------------- -# 7 X Page attributes -# X Line attributes -# -------------------------------------------- -# 8 X DCD disconnected -# X DCD connected -# -------------------------------------------- -# 9 X DSR disconnected -# X DSR connected -# -------------------------------------------- -# 10 X DTR Disconnected -# X DTR connected -# -------------------------------------------- -# -# (tvi925: BSD has :cl=\E*:. I got :is: and :sr: from there -- esr) -tvi925|televideo 925:\ - :am:bs:bw:hs:ul:\ - :co#80:li#24:sg#1:\ - :al=\EE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :cr=^M:\ - :ct=\E3:dc=\EW:dl=\ER:do=^V:ds=\Eh:ei=:fs=^M\Eg:ho=^^:ic=\EQ:\ - :im=:is=\El\E":k0=^AI\r:k1=^A@\r:k2=^AA\r:k3=^AB\r:\ - :k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:\ - :kA=\EE:kC=^Z:kD=\EW:kE=\ET:kI=\EQ:kL=\ER:kS=\EY:kb=^H:kd=^V:\ - :kh=^^:kl=^H:kr=^L:ku=^K:le=^H:mk@:nd=^L:sf=^J:sr=\Ej:st=\E1:\ - :ta=^I:ts=\Eh\Ef:up=^K:vb=\Eb\Ed:ve=\E.4:vs=\E.2:\ - :tc=adm+sgr: -# TeleVideo 925 from Mitch Bradley via BRL -# to avoid "magic cookie" standout glitch: -tvi925-hi|TeleVideo Model 925 with half intensity standout mode:\ - :sg@:\ - :kb=^H:kd=^J:kl=^H:se=\E(:so=\E):tc=tvi925: - -# From: Todd Litwin 28 May 1993 -# Originally Tim Curry, Univ. of Central Fla., 5/21/82 -# for additional capabilities, -# The following tvi descriptions from B:pjphar and virus!mike -# is for all 950s. It sets the following attributes: -# full duplex (\EDF) write protect off (\E() -# conversation mode (\EC) graphics mode off (\E%) -# white on black (\Ed) auto page flip off (\Ew) -# turn off status line (\Eg) clear status line (\Ef\r) -# normal video (\E0) monitor mode off (\EX or \Eu) -# edit mode (\Er) load blank char to space (\Ee\040) -# line edit mode (\EO) enable buffer control (^O) -# protect mode off (\E\047) duplex edit keys (\El) -# program unshifted send key to send line all (\E016) -# program shifted send key to send line unprotected (\E004) -# set the following to nulls: -# field delimiter (\Ex0\200\200) -# line delimiter (\Ex1\200\200) -# start-protected field delimiter (\Ex2\200\200) -# end-protected field delimiter (\Ex3\200\200) -# set end of text delimiter to carriage return/null (\Ex4\r\200) -# -# TVI 950 Switch Setting Reference Charts -# -# TABLE 1: -# -# S1 1 2 3 4 5 6 7 8 9 10 -# +-----------------------+-----+-----+-----------------------+ -# | Computer Baud Rate |Data |Stop | Printer Baud Rate | -# | |Bits |Bits | | -# +------+-----------------------+-----+-----+-----------------------+ -# | Up | See | 7 | 2 | See | -# +------+-----------------------+-----+-----+-----------------------+ -# | Down | TABLE 2 | 8 | 1 | TABLE 2 | -# +------+-----------------------+-----+-----+-----------------------+ -# -# -# S2 1 2 3 4 5 6 7 8 9 10 -# +-----+-----+-----------------+-----+-----------+-----+-----+ -# |Edit |Cursr| Parity |Video|Transmiss'n| Hz |Click| -# +------+-----+-----+-----------------+-----+-----------+-----+-----+ -# | Up | Dplx|Blink| See |GonBk| See | 60 | Off | -# +------+-----+-----+-----------------+-----+-----------+-----+-----+ -# | Down |Local|St'dy| TABLE 3 |BkonG| CHART | 50 | On | -# +------+-----+-----+-----------------+-----+-----------+-----+-----+ -# -# TABLE 2: -# -# +-----------+-----+-----+-----+-----+-----------+ -# | Display | 1 | 2 | 3 | 4 | Baud | -# +-----------+-----+-----+-----+-----+ | -# | Printer | 7 | 8 | 9 | 10 | Rate | -# +-----------+-----+-----+-----+-----+-----------+ -# | D | D | D | D | 9600 | -# | U | D | D | D | 50 | -# | D | U | D | D | 75 | -# | U | U | D | D | 110 | -# | D | D | U | D | 135 | -# | U | D | U | D | 150 | -# | D | U | U | D | 300 | -# | U | U | U | D | 600 | -# | D | D | D | U | 1200 | -# | U | D | D | U | 1800 | -# | D | U | D | U | 2400 | -# | U | U | D | U | 3600 | -# | D | D | U | U | 4800 | -# | U | D | U | U | 7200 | -# | D | U | U | U | 9600 | -# | U | U | U | U | 19200 | -# +-----+-----+-----+-----+-----------+ -# -# TABLE 3: -# +-----+-----+-----+-----------+ -# | 3 | 4 | 5 | Parity | -# +-----+-----+-----+-----------+ -# | X | X | D | None | -# | D | D | U | Odd | -# | D | U | U | Even | -# | U | D | U | Mark | -# | U | U | U | Space | -# +-----+-----+-----+-----------+ -# X = don't care -# -# CHART: -# +-----+-----+-----------------+ -# | 7 | 8 | Communication | -# +-----+-----+-----------------+ -# | D | D | Half Duplex | -# | D | U | Full Duplex | -# | U | D | Block | -# | U | U | Local | -# +-----+-----+-----------------+ -# -# (tvi950: early versions had obsolete ":ma=^Vj^Kk^Hh^Ll^^H:". -# I also inserted :ic: and :kI:; the :ko: string indicated that :IC: -# should be present and all tvi native modes use the same string for this. -# Finally, note that BSD has cud1=^V. -- esr) -tvi950|televideo 950:\ - :am:bs:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:sg#1:\ - :ac=b\011c\014d\re\ni\013:ae=^X:al=\EE:as=^U:bl=^G:bt=\EI:\ - :cd=\Ey:ce=\Et:cl=\E*:cm=\E=%+ %+ :cr=^M:ct=\E3:dc=\EW:\ - :dl=\ER:do=^J:ds=\Eg\Ef\r:ei=\Er:fs=^M:ho=^^:ic=\EQ:im=\Eq:\ - :is=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\Ef\r:\ - :k0=^A0\r:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:\ - :k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:kA=\EE:kB=\EI:kC=\E*:\ - :kD=\EW:kE=\Et:kI=\EQ:kL=\ER:kS=\Ey:kb=^H:kd=^V:kh=^^:kl=^H:\ - :kr=^L:ku=^K:le=^H:mk@:nd=^L:pf=\Ea:po=\E`:sf=^J:sr=\Ej:\ - :st=\E1:ta=^I:ts=\Eg\Ef:up=^K:vb=\Eb\Ed:\ - :tc=adm+sgr: -# -# is for 950 with two pages adds the following: -# set 48 line page (\E\\2) -# place cursor at page 0, line 24, column 1 (\E-07 ) -# set local (no send) edit keys (\Ek) -# -# two page 950 adds the following: -# when entering ex, set 24 line page (\E\\1) -# when exiting ex, reset 48 line page (\E\\2) -# place cursor at 0,24,1 (\E-07 ) -# set duplex (send) edit keys (\El) when entering vi -# set local (no send) edit keys (\Ek) when exiting vi -# -tvi950-2p|televideo950 w/2 pages:\ - :is=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\2\E-07 \011:\ - :ke=\Ek:ks=\El:te=\E\2\E-07 :ti=\E\1\E-07 :\ - :tc=tvi950: -# -# is for 950 with four pages adds the following: -# set 96 line page (\E\\3) -# place cursor at page 0, line 24, column 1 (\E-07 ) -# -# four page 950 adds the following: -# when entering ex, set 24 line page (\E\\1) -# when exiting ex, reset 96 line page (\E\\3) -# place cursor at 0,24,1 (\E-07 ) -# -tvi950-4p|televideo950 w/4 pages:\ - :is=\EDF\EC\Ed\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\3\E-07 \011:\ - :ke=\Ek:ks=\El:te=\E\3\E-07 :ti=\E\1\E-07 :\ - :tc=tvi950: -# -# :is: for reverse video 950 changes the following: -# set reverse video (\Ed) -# -# set vb accordingly (\Ed ...delay... \Eb) -# -tvi950-rv|televideo950 rev video:\ - :is=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\El\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0:\ - :vb=\Ed\Eb:\ - :tc=tvi950: - -# tvi950-rv-2p uses the appropriate entries from 950-2p and 950-rv -tvi950-rv-2p|televideo950 rev video w/2 pages:\ - :is=\EDF\EC\Eb\EG0\Eg\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\2\E-07 :\ - :ke=\Ek:ks=\El:te=\E\2\E-07 :ti=\E\1\E-07 :vb=\Ed\Eb:\ - :tc=tvi950: - -# tvi950-rv uses the appropriate entries from 950-4p and 950-rv -tvi950-rv-4p|televideo950 rev video w/4 pages:\ - :is=\EDF\EC\Eb\EG0\Er\EO\E'\E(\E%\Ew\EX\Ee \017\011\Ek\E016\E004\Ex0\0\0\Ex1\0\0\Ex2\0\0\011\Ex3\0\0\Ex4\r\0\E\3\E-07 :\ - :ke=\Ek:ks=\El:te=\E\3\E-07 :ti=\E\1\E-07 :vb=\Ed\Eb:\ - :tc=tvi950: -# From: Andreas Stolcke -# (tvi955: removed obsolete ":ma:=^Vj^Kk^Hh^Ll^^H"; -# removed incorrect (and overridden) ":do=^J:"; fixed broken continuations in -# the :rs: string, inserted the :IC: implied by the termcap :ko: string. Note -# the :ko: string had :cl: in it, which means that one of the original -# :cl=\E*:, had to be wrong; set because that's what -# the 950 has. Finally, corrected the string to match the 950 and what -# ko implies -- esr) -# If the BSD termcap file was right, :cm=\E=%p1%{32}%+%c%p2%{32}%+%c: would -# also work. -tvi955|televideo 955:\ - :5i:bs:ms@:\ - :it#8:sg@:\ - :RA=\E[=7l:RX=^N:SA=\E[=7h:SX=^O:\ - :ac=0_`RjHkGlFmEnIoPqKsQtMuLvOwNxJ:ae=\E%:as=\E$:\ - :cm=\E[%i%d;%dH:do=^V:is=\E[=3l\EF1\Ed\EG0\E[=5l\E%\El:\ - :kM=\EQ:kN=\EK:kP=\EJ:kT=\E1:ka=\E3:kt=\E2:mb=\EG2:\ - :me=\EG0\E[=5l:mh=\E[=5h:mk=\EG1:ps=\EP:\ - :r1=\EDF\EC\Eg\Er\EO\E'\E(\Ew\EX\Ee \017\E0P\E6\0\E0p\E4\0\Ef\r:\ - :sf@:ve=\E.2:vi=\E.0:vs=\E.1:\ - :tc=tvi950: -tvi955-w|955-w|televideo955 w/132 cols:\ - :co#132:\ - :is=\E[=3h\EF1\Ed\EG0\E[=5l\E%\El:tc=tvi955: -# use half-intensity as normal mode, full intensity as :md: -tvi955-hb|955-hb|televideo955 half-bright:\ - :is=\E[=3l\EF1\Ed\EG0\E[=5h\E%\El:md=\E[=5l:\ - :me=\EG0\E[=5h:mh@:tc=tvi955: -# From: Humberto Appleton , 880521 UT Austin -# (tvi970: removed ":sg#0:"; removed :se:=\E[m, :ue:=\E[m; -# added :am:/:cs:/:ho:///:ti:/:te: from BRL. -# According to BRL we could have :ke:=\E>, :ks:=\E= but I'm not sure what -# it does to the function keys. I deduced /. -# also added empty to suppress tic warning, -- esr) -tvi970|televideo 970:\ - :am:bs:da:db:mi:ms:pt:\ - :co#80:it#8:li#24:\ - :RA=\E[?7h:SA=\E[?7l:ac=:ae=\E(B:al=\E[L:as=\E(B:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:ch=\E[%i%dG:cl=\E[H\E[2J:cm=\E[%i%d;%df:\ - :cs=\E[%i%d;%dr:cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=\ED:\ - :ds=\Eg\Ef\r:ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\E<\E[?21l\E[19h\E[1Q\E[10l\E[7l\E[H\E[2J:k1=\E?a:\ - :k2=\E?b:k3=\E?c:k4=\E?d:k5=\E?e:k6=\E?f:k7=\E?g:k8=\E?h:\ - :k9=\E?i:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=^H:me=\E[m:nd=\E[C:se=\E[m:so=\E[7m:sr=\EM:ta=^I:te=:\ - :ti=\E[?20l\E[?7h\E[1Q:ue=\E[m:up=\EM:us=\E[4m:\ - :vb=\E[5m\E[m:vs=\E[1Q: -tvi970-vb|televideo 970 with visual bell:\ - :vb=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l:tc=tvi970: -tvi970-2p|televideo 970 with using 2 pages of memory:\ - :te=\E[H\E[J\E[V:ti=\E[U\E[?20l\E[?7h\E[1Q:\ - :tc=tvi970: -# Works with vi and rogue. NOTE: Esc v sets autowrap on, Esc u sets 80 chars -# per line (rather than 40), Esc K chooses the normal character set. Not sure -# padding is needed, but adapted from the tvi920c termcap. The :so: and -# :us: strings are klutzy, but at least use no screen space. -# (tvipt: removed obsolete ":ma=^Kk^Ll^R^L:". I wish we knew , -# its absence means =\Ev isn't safe to use. -- esr) -# From: Gene Rochlin 9/19/84. -# The :cd:/:k0:/:k1:/:kh:/, and caps are from BRL, which says: -# F1 and F2 should be programmed as ^A and ^B; required for UNIFY. -tvipt|televideo personal terminal:\ - :am:bs:\ - :co#80:li#24:\ - :al=\EE:bt=\EI:cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :dl=\ER:\ - :ho=^^:if=/usr/share/tabset/stdcrt:is=\Ev\Eu\EK:k0=^A:\ - :k1=^B:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:nd=^L:pf=^T:\ - :po=^R:se=\EF:so=\EG1@A\EH:ue=\EF:up=^K:us=\EG1B@\EH: -# From: Nathan Peterson , 03 Sep 1996 -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -tvi9065|televideo 9065:\ - :am:bw:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#25:lm#0:ma#4:vt#0:ws#30:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=\E%:\ - :al=\EE:as=\E$:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=^Z:\ - :cm=\E=%+ %+ :cr=^M:cs=\E[%i%d;%dr:ct=\E3:dc=\EW:dl=\ER:\ - :dm=\Er:do=^V:ds=\E_30\r:ec=\E[%d@:ed=\0:ei=\Er:fs=^M:ho=^^:\ - :i1=\E"\E%\E'\E(\EG@\EO\EX\E[=5l\E[=6l\E[=7h\Ed\Er:\ - :i2=\E<\E[=4l\E[=8h:if=/usr/share/tabset/stdcrt:im=\Eq:\ - :ip=:is=\EF2\EG0\E\L:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:\ - :k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kb=^H:\ - :kd=^V:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:ll=\E[25;1H:mb=\EG2:\ - :md=\EG\054:me=\EG0:mh=\EGp:mr=\EG4:nd=^L:nw=^M^J:\ - :rp=\E[%r%db%.:se=\EG0:sf=^J:so=\EGt:sr=\Ej:st=\E1:ta=^I:\ - :te=\E.3\Er\E[1;25r\E[25;0H:ti=\E.2:ts=\E[4;1v\E_30:\ - :uc=\EG8\EG0:ue=\EG0:up=^K:us=\EG8:vb=\Eb\Ed:ve=\E.3:\ - :vi=\E.0:vs=\E.2: - -#### Visual (vi) -# -# In September 1993, Visual Technology of Westboro, Massachusetts, -# merged with White Pine Software of Nashua, New Hampshire. -# -# White Pine Software may be contacted at +1 603/886-9050. -# Or visit White Pine on the World Wide Web at URL http://www.wpine.com. -# - -# Visual 50 from Beau Shekita, BTL-Whippany -# Recently I hacked together the following termcap for Visual -# Technology's Visual 50 terminal. It's a slight modification of -# the vt52 termcap. -# It's intended to run when the Visual 50 is in vt52 emulation mode -# (I know what you're thinking; if it's emulating a vt52, then why -# another termcap? Well, it turns out that the Visual 50 can handle -# :dl: and db(?) among other things, which the vt52 can't) -# The termcap works OK for the most part. The only problem is on -# character inserts. The whole line gets painfully redrawn for each -# character typed. Any suggestions? -# Beau's entry is combined with the vi50 entry from University of Wisconsin. -# Note especially the :al: function. :k4:-:k6: are really l4-l6 in -# disguise; :k7:-:k9: are really l1-l3. -vi50|visual 50:\ - :am:bs:da:db:ms:pt:\ - :co#80:it#8:li#24:\ - :al=\EL:bl=^G:bt=4\Ez:cd=\EJ:ce=16\EK:cl=\EH\EJ:\ - :cm=\EY%+ %+ :cr=^M:dl=3*\EM:do=\EB:ho=\EH:k1=\EP:k2=\EQ:\ - :k3=\ER:k4=\EV:k5=\EE:k6=\E]:k7=\EL:k8=\Ev:k9=\EM:kb=^H:\ - :kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:le=^H:nd=\EC:nl=^J:\ - :nw=^M^J:se=\ET:sf=^J:so=\EU:sr=\EI:ta=^I:ue=\EW:up=\EA:\ - :us=\ES: -# this one was BSD & SCO's vi50 -vi50adm|visual 50 in adm3a mode:\ - :am:ms:\ - :co#80:it#8:li#24:\ - :al=\EL:bl=^G:cd=\Ek:ce=\EK:cl=^Z:cm=\E=%+ %+ :cr=^M:dl=\EM:\ - :do=^J:ho=\EH:kb=^H:kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:le=^H:\ - :nd=^L:se=\ET:sf=^J:so=\EU:ta=^I:up=^K: -# From: Jeff Siegal -vi55|Visual 55:\ - :am:bs:mi:ms:\ - :co#80:it#8:li#24:\ - :al=\EL:cd=\EJ:ce=\EK:cl=\Ev:cm=\EY%+ %+ :cs=\E_%+A%+A:\ - :dc=\Ew:dl=\EM:do=^J:ei=\Eb:ho=\EH:im=\Ea:\ - :is=\Ev\E_AX\Eb\EW\E9P\ET:kb=^H:kd=\EB:kl=\ED:kr=\EC:\ - :ku=\EA:le=^H:nd=\EC:se=\ET:so=\EU:sr=\EI:ta=^I:up=\EA: - -# Visual 200 from BRL -# The following switch settings are assumed for normal operation: -# FULL_DUPLEX SCROLL CR -# AUTO_NEW_LINE_ON VISUAL_200_EMULATION_MODE -# Other switches may be set for operator convenience or communication -# requirements. -# Character insertion is kludged in order to get around the "beep" misfeature. -# (This cap is commented out because :im:/:ei: is more efficient -- esr) -# Supposedly "4*" delays should be used for :al:, :cd:, :cl:, :dc:, -# and :dl: strings, but we seem to get along fine without them. -vi200|visual 200:\ - :am:bs:mi:ms:pt:\ - :co#80:it#8:kn#10:li#24:\ - :ac=:ae=\EG:al=\EL:as=\EF:bl=^G:bt=\Ez:cd=\Ey:ce=\Ex:cl=\Ev:\ - :cm=\EY%+ %+ :cr=^M:ct=\Eg:dc=\EO:dl=\EM:do=^J:ho=\EH:\ - :k0=\E?p:k1=\E?q:k2=\E?r:k3=\E?s:k4=\E?t:k5=\E?u:k6=\E?v:\ - :k7=\E?w:k8=\E?x:k9=\E?y:kA=\EL:kC=\Ev:kD=\EO:kE=\Et:kI=\Ei:\ - :kL=\EM:kM=\Ej:kS=\EJ:kT=\E1:kb=^H:kd=\EB:ke=\E>:kh=\EH:\ - :kl=\ED:kr=\EC:ks=\E=:kt=\E2:ku=\EA:le=^H:me=\E3\Eb:mh=\E4:\ - :mk=\Ea:nd=\EC:pf=\EX:po=\EW:ps=\EH\E]:\ - :r1=\E3\Eb\Ej\E\El\EG\Ec\Ek\EX:se=\E3:sf=^J:so=\E4:\ - :sr=\EI:st=\E1:ta=^I:up=\EA:ve=\Ec:vs=\Ed: -# The older Visuals didn't come with function keys. This entry uses -# :ks: and :ke: so that the keypad keys can be used as function keys. -# If your version of vi doesn't support function keys you may want -# to use vi200-f. -vi200-f|visual 200 no function keys:\ - :is=\E3\Eb\Ej\E\\El\EG\Ed\Ek:k0=\E?p:k1=\E?q:k2=\E?r:\ - :k3=\E?s:k4=\E?t:k5=\E?u:k6=\E?v:k7=\E?w:k8=\E?x:k9=\E?y:\ - :ke=\E>:ks=\E=:se@:so@:\ - :tc=vi200: -vi200-rv|visual 200 reverse video:\ - :se=\E3:so=\E4:sr@:ve@:vs@:tc=vi200: - -# the function keys are programmable but we don't reprogram them to their -# default values with :is: because programming them is very verbose. maybe -# an initialization file should be made for the 300 and they could be stuck -# in it. -# (vi300: added / based on init string -- esr) -vi300|visual 300 ansi x3.64:\ - :am:bw:mi:xn:\ - :co#80:li#24:\ - :RA=\E[?7l:SA=\E[?7h:al=\E[L:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:\ - :do=\E[B:ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[1Q\E[0;1(D\E[8s:\ - :k1=\E_A\E\:k2=\E_B\E\:k3=\E_C\E\:k4=\E_D\E\:k5=\E_E\E\:\ - :k6=\E_F\E\:k7=\E_G\E\:k8=\E_H\E\:k9=\E_I\E\:kd=\E[B:\ - :kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:me=\E[m:nd=\E[C:\ - :se=\E[m:sf=^J:so=\E[1m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:\ - :us=\E[4m: -# some of the vi300s have older firmware that has the command -# sequence for setting editing extent reversed. -vi300-old|visual 300 with old firmware (set edit extent reversed):\ - :is=\E[7s\E[2;3;4;20;?5;?6l\E[12;?7h\E[2Q\E[0;1(D\E[8s:\ - :tc=vi300: - -# Visual 500 prototype entry from University of Wisconsin. -# The best place to look for the escape sequences is page A1-1 of the -# Visual 500 manual. The initialization sequence given here may be -# overkill, but it does leave out some of the initializations which can -# be done with the menus in set-up mode. -# The :xp: line below is so that emacs can understand the padding requirements -# of this slow terminal. :xp: is 10 time the padding factor. -# (vi500: removed unknown :xp#4: termcap; -# also added empty to suppress tic warning -- esr) -vi500|visual 500:\ - :am:mi:ms:\ - :co#80:it#8:li#33:\ - :ac=:ae=^O:al=3*\EL\Ex:as=^N:bt=4\Ez:cd=3*\Ey:ce=16\Ex:\ - :cl=6*\Ev:cm=\EY%+ %+ :cr=^M:cs=\E(%+ %+ :dc=3*\EO:\ - :dl=3*\EM:do=\EB:ei=\Ej:ho=\EH:im=\Ei:\ - :is=\E3\E\001\E\007\E\003\Ek\EG\Ed\EX\El\E>\Eb\E\:\ - :kb=^H:kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:le=^H:nd=\EC:\ - :nw=^M^J:se=\E^G:sf=^J:so=\E^H:ta=8\011:ue=\E^C:up=\EA:\ - :us=\E^D: - -# The visual 550 is a visual 300 with tektronix graphics, -# and with 33 lines. clear screen is modified here to -# also clear the graphics. -vi550|visual 550 ansi x3.64:\ - :li#33:\ - :cl=\030\E[H\E[2J:tc=vi300: - -vi603|visual603|visual 603:\ - :hs:mi:\ - :al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:ds=\EP2;1~\E\:ei=\E[4l:\ - :fs=\E\:i1=\E>\E[?3l\E[?4l\E[?7h\E[?8h\E[1;24r:\ - :im=\E[4h:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:ts=\EP2~:ue=\E[24m:\ - :up=\E[A:us=\E[4m:\ - :tc=vt100: - -#### Wyse (wy) -# -# Wyse Technology -# 3471 North First Street -# San Jose, CA 95134 -# Vox: (408)-473-1200 -# Fax: (408) 473-1222 -# Web: http://www.wyse.com -# -# Wyse sales can be reached by phone at 1-800-GET-WYSE. Tech support is at -# (800)-800-WYSE (option 5 gets you a human). There's a Web page at the -# obvious address, . They keep terminfo entries at -# . -# -# Wyse bought out Link Technology, Inc. in 1990 and closed it down in 1995. -# They now own the Qume and Amdek brands, too. So these are the people to -# talk with about all Link, Qume, and Amdek terminals. -# -# These entries include a few small fixes. -# I canceled the bel capacities in the vb entries. -# I made two trivial syntax fixes in the wyse30 entry. -# I made some entries relative to adm+sgr. -# -# -# Note: The wyse75, wyse85, and wyse99 have been discontinued. - -# Although the Wyse 30 can support more than one attribute -# it requires magic cookies to do so. Many applications do not -# function well with magic cookies. The following terminfo uses -# the protect mode to support one attribute (dim) without cookies. -# If more than one attribute is needed then the wy30-mc terminfo -# should be used. -# -wy30|wyse30|Wyse 30:\ - :5i:am:bw:hs:mi:ms:xo:\ - :Nl#8:co#80:lh#1:li#24:lw#8:ma#1:ws#45:\ - :#2=\E{:&3=\Er:@8=\E7:LF=\EA11:LO=\EA10:\ - :ac=0wa_h[jukslrmqnxqzttuyv]wpxv:ae=\EH^C:al=\EE:\ - :as=\EH^B:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:cm=\E=%+ %+ :\ - :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\EF\r:ei=\Er:fs=^M:\ - :ho=^^:im=\Eq:ip=:is=\E'\E(\E\1363\E`9\016\024:k1=^A@\r:\ - :k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:\ - :k8=^AG\r:kA=\EE:kB=\EI:kD=\EW:kE=\ET:kI=\EQ:kL=\ER:kN=\EK:\ - :kP=\EJ:kS=\EY:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:\ - :ll=^^^K:me=\E(\EH\003:mh=\E`7\E):mp=\E`7\E):nd=^L:\ - :nw=^M^J:pf=^T:pn=\Ez%+/%s\r:po=^X:ps=\EP:px=\Ez%+?%s\177:\ - :..sa=%?%p1%p5%p8%|%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;:\ - :se=\E(:sf=\n:so=\E`7\E):sr=\Ej:st=\E1:ta=\011:ts=\EF:up=^K:\ - :vb=\E`8\E`9:ve=\E`1:vi=\E`0: -# -# This terminal description uses the non-hidden attribute mode -# (with magic cookie). -# -# (wy30-mc: added :ti: to suppress tic warning --esr) -wy30-mc|wyse30-mc|wyse 30 with magic cookies:\ - :ms@:\ - :ma@:sg#1:\ - :ae=\EG0\EH\003:as=\EG0\EH\002:mb=\EG2:\ - :me=\EG0\E(\EH\003:mh=\EGp:mp=\EG0\E):\ - :..sa=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;:\ - :se=\EG0:so=\EG4:te=\EG0:ti=:\ - :tc=wy30:tc=adm+sgr: -# The mandatory pause used by :vb: does not work with -# older versions of terminfo. If you see this effect then -# unset xon and delete the / from the delay. -# i.e. change $<100/> to $<100> -wy30-vb|wyse30-vb|wyse 30 visible bell:\ - :bl@:tc=wy30: -# -# The Wyse 50 can support one attribute (e.g. Dim, Inverse, -# Normal) without magic cookies by using the protect mode. -# The following description uses this feature, but when more -# than one attribute is put on the screen at once, all attributes -# will be changed to be the same as the last attribute given. -# The Wyse 50 can support more attributes when used with magic -# cookies. The wy50-mc terminal description uses magic cookies -# to correctly handle multiple attributes on a screen. -# -wy50|wyse50|Wyse 50:\ - :5i:am:bw:hs:mi:ms:xo:\ - :Nl#8:co#80:lh#1:li#24:lw#8:ma#1:ws#45:\ - :#2=\E{:%9=\EP:&3=\Er:@8=\E7:F1=^AJ\r:F2=^AK\r:F3=^AL\r:\ - :F4=^AM\r:F5=^AN\r:F6=^AO\r:LF=\EA11:LO=\EA10:\ - :ac=0wa_h[jukslrmqnxqzttuyv]wpxv:ae=\EH^C:al=\EE:\ - :as=\EH^B:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:cm=\E=%+ %+ :\ - :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\EF\r:ei=\Er:fs=^M:\ - :ho=^^:i1=\E`\072\E`9:im=\Eq:ip=:is=\016\024\E'\E(:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:k;=^AI\r:kA=\EE:kB=\EI:kD=\EW:\ - :kE=\ET:kI=\EQ:kL=\ER:kN=\EK:kP=\EJ:kS=\EY:kb=^H:kd=^J:kh=^^:\ - :kl=^H:kr=^L:ku=^K:le=^H:ll=^^^K:me=\E(\EH\003:mh=\E`7\E):\ - :mp=\E`7\E):mr=\E`6\E):nd=^L:nw=^M^J:pf=^T:pn=\Ez%+/%s\r:\ - :po=^X:ps=\EP:px=\Ez%+?%s\177:\ - :..sa=%?%p1%p3%|%t\E`6\E)%e%p5%p8%|%t\E`7\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;:\ - :se=\E(:sf=\n:so=\E`6\E):sr=\Ej:st=\E1:ta=^I:ts=\EF:up=^K:\ - :vb=\E`8\E`9:ve=\E`1:vi=\E`0: -# -# This terminal description uses the non-hidden attribute mode -# (with magic cookie). -# -# The mandatory pause used by flash does not work with some -# older versions of terminfo. If you see this effect then -# unset :xo: and delete the / from the delay. -# i.e. change $<100/> to $<100> -# (wy50-mc: added :ti: to suppress tic warning --esr) -wy50-mc|wyse50-mc|wyse 50 with magic cookies:\ - :ms@:\ - :ma@:sg#1:\ - :ae=\EG0\EH\003:as=\EG0\EH\002:mb=\EG2:\ - :me=\EG0\E(\EH\003:mh=\EGp:mp=\EG0\E):mr=\EG4:\ - :..sa=\EG%{48}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{4}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{64}%|%;%?%p7%t%{1}%|%;%c%?%p8%t\E)%e\E(%;%?%p9%t\EH\002%e\EH\003%;:\ - :se=\EG0:so=\EGt:te=\EG0:ti=:\ - :tc=wy50:tc=adm+sgr: -wy50-vb|wyse50-vb|wyse 50 visible bell:\ - :bl@:tc=wy50: -wy50-w|wyse50-w|wyse 50 132-column:\ - :Nl#16:co#132:lw#7:ws#97:\ - :cm=\Ea%i%dR%dC:dc=\EW:i1=\E`;\E`9:tc=wy50: -wy50-wvb|wyse50-wvb|wyse 50 132-column visible bell:\ - :bl@:\ - :tc=wy50-w: -# -# The Wyse 350 is a Wyse 50 with color. -# Unfortunately this means that it has magic cookies. -# The color attributes are designed to overlap the reverse, dim and -# underline attributes. This is nice for monochrome applications -# because you can make underline stuff green (or any other color) -# but for true color applications it's not so hot because you cannot -# mix color with reverse, dim or underline. -# To further complicate things one of the attributes must be -# black (either the foreground or the background). In reverse video -# the background changes color with black letters. In normal video -# the foreground changes colors on a black background. -# This terminfo uses some of the more advanced features of curses -# to display both color and blink. In the final analysis I am not -# sure that the wy350 runs better with this terminfo than it does -# with the wy50 terminfo (with user adjusted colors). -# -# The mandatory pause used by flash does not work with -# older versions of terminfo. If you see this effect then -# unset xon and delete the / from the delay. -# i.e. change $<100/> to $<100> -# -# Bug: The capability resets attributes. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -wy350|wyse350|Wyse 350:\ - :5i:am:bw:hs:mi:xo:\ - :Co#8:NC#55:Nl#8:co#80:lh#1:li#24:lw#8:pa#8:sg#1:ws#45:\ - :#2=\E{:%9=\EP:&3=\Er:@8=\E7:F1=^AJ\r:F2=^AK\r:F3=^AL\r:\ - :F4=^AM\r:F5=^AN\r:F6=^AO\r:LF=\EA11:LO=\EA10:Sb=:\ - :ac=0wa_h[jukslrmqnxqzttuyv]wpxv:ae=\EG0\EH\003:al=\EE:\ - :as=\EG0\EH\002:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\ - :cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\EF\r:\ - :ei=\Er:fs=^M:ho=^^:i1=\E`\072\E`9:i2=\E%?:im=\Eq:ip=:\ - :is=\016\024\E'\E(:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:\ - :k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:k;=^AI\r:\ - :kA=\EE:kB=\EI:kD=\EW:kE=\ET:kI=\EQ:kL=\ER:kN=\EK:kP=\EJ:\ - :kS=\EY:kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:ll=^^^K:\ - :mb=\EG2:me=\EG0\E(\EH\003%{0}%PA%{0}%PC:mh=\EGp:\ - :mp=\EG0\E):nd=^L:nw=^M^J:oc=\E%?:op=\EG0:pf=^T:\ - :pn=\Ez%+/%s\r:po=^X:ps=\EP:px=\Ez%+?%s\177:sf=\n:sr=\Ej:\ - :st=\E1:ta=^I:ts=\EF:up=^K:vb=\E`8\E`9:ve=\E`1:vi=\E`0:\ - :tc=adm+sgr: -wy350-vb|wyse350-vb|wyse 350 visible bell:\ - :bl@:tc=wy350: -wy350-w|wyse350-w|wyse 350 132-column:\ - :Nl#16:co#132:lw#7:ws#97:\ - :cm=\Ea%i%dR%dC:dc=\EW:i1=\E`;\E`9:tc=wy350: -wy350-wvb|wyse350-wvb|wyse 350 132-column visible bell:\ - :bl@:\ - :tc=wy350-w: -# -# This terminfo description is untested. -# The wyse100 emulates an adm31, so the adm31 entry should work. -# -wy100|wyse 100:\ - :hs:mi:\ - :co#80:li#24:sg#1:\ - :al=\EE:bl=^G:cd=\EY:ce=\ET:cl=\E;:cm=\E=%+ %+ :cr=^M:\ - :dc=\EW:dl=\ER:do=^J:ds=\EA31:ei=\Er:fs=^M:im=\Eq:is=\Eu\E0:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:kb=^H:kd=^J:kh=\E{:kl=^H:kr=^L:ku=^K:\ - :le=^H:mk@:nd=^L:sf=^J:ts=\EF:up=^K:\ - :tc=adm+sgr: -# -# The Wyse 120/150 has most of the features of the Wyse 60. -# This terminal does not need padding up to 9600 baud! -# :ms: should be set but the clear screen fails when in -# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear -# then set :ms:. -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy120|wyse120|wy150|wyse150|Wyse 120/150:\ - :am:bw:hs:km:mi:ms:xo:\ - :co#80:it#8:li#24:pb#9601:ws#45:\ - :ae=\EcD:al=\EE:as=\EcE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\ - :cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\EF\r:\ - :ei=\Er:fs=^M:ho=^^:i1=\EcB0\EcC1:i2=\EwJ\Ew1:im=\Eq:ip=:\ - :is=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\EQ:kN=\EK:kP=\EJ:\ - :kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:ll=^^^K:mb=\EG2:\ - :me=\E(\EH\003\EG0\EcD:mh=\EGp:nd=^L:nw=\r\n:sf=\n:\ - :so=\EGt:sr=\Ej:st=\E1:ta=\011:te=\Ew1:ti=\Ew0:ts=\EF:up=^K:\ - :vb=\E`8\E`9:ve=\E`1:vi=\E`0:\ - :tc=adm+sgr: -# -wy120-w|wyse120-w|wy150-w|wyse150-w|wyse 120/150 132-column:\ - :Nl#16:co#132:lw#7:ws#97:\ - :cm=\Ea%i%dR%dC:dc=\EW:ip=:r2=\E`;:tc=wy120: -# -wy120-25|wyse120-25|wy150-25|wyse150-25|wyse 120/150 80-column 25-lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy120: -# -wy120-25-w|wyse120-25-w|wy150-25-w|wyse150-25-w|wyse 120/150 132-column 25-lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy120-w: -# -wy120-vb|wyse120-vb|wy150-vb|wyse150-vb|Wyse 120/150 visible bell:\ - :bl@:\ - :tc=wy120: -# -wy120-w-vb|wy120-wvb|wyse120-wvb|wy150-w-vb|wyse150-w-vb|Wyse 120/150 132-column visible bell:\ - :bl@:\ - :tc=wy120-w: -# -# The Wyse 60 is like the Wyse 50 but with more padding. -# The reset strings are slow and the pad times very depending -# on other parameters such as font loading. I have tried -# to follow the following outline: -# -# -> set personality -# -> set number of columns -# -> set number of lines -# :i1: -> select the proper font -# :is: -> do the initialization -# :i3: -> set up display memory (2 pages) -# -# The Wyse 60's that have vt100 emulation are slower than the -# older Wyse 60's. This change happened mid-1987. -# The capabilities effected are :dc: :dl: :al: :sf: :sr: -# -# The meta key is only half right. This terminal will return the -# high order bit set when you hit CTRL-function_key -# -# It may be useful to assign two function keys with the -# values \E=(\s look at old data in page 1 -# \E=W, look at bottom of page 1 -# where \s is a space ( ). -# -# Note: -# The Wyse 60 runs faster when the XON/XOFF -# handshake is turned off. -# -# (wy60: we use \E{ rather than ^^ for home (both are documented) to avoid -# a bug reported by Robert Dunn, -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy60|wyse60|Wyse 60:\ - :am:bw:hs:km:mi:ms:\ - :co#80:li#24:ws#45:\ - :ae=\EcD:al=\EE:as=\EcE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\ - :cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\EF\r:\ - :ei=\Er:fs=^M:ho=\E{:i1=\EcB0\EcC1:i2=\EwJ\Ew1:im=\Eq:ip=:\ - :is=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\EQ:kN=\EK:kP=\EJ:\ - :kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:ll=\E{^K:mb=\EG2:\ - :me=\E(\EH\003\EG0\EcD:mh=\EGp:nd=^L:nw=\r\n:sf=\n:\ - :so=\EGt:sr=\Ej:st=\E1:ta=\011:te=\Ew1:ti=\Ew0:ts=\EF:up=^K:\ - :vb=\E`8\E`9:ve=\E`1:vi=\E`0:\ - :tc=adm+sgr: -# -wy60-w|wyse60-w|wyse 60 132-column:\ - :Nl#16:co#132:lw#7:ws#97:\ - :cm=\Ea%i%dR%dC:dc=\EW:ip=:r2=\EeF\E`;:tc=wy60: -# -wy60-25|wyse60-25|wyse 60 80-column 25-lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy60: -wy60-25-w|wyse60-25-w|wyse 60 132-column 25-lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy60-w: -# -wy60-42|wyse60-42|wyse 60 80-column 42-lines:\ - :li#42:\ - :al=\EE:cd=\Ey:cl=\E+:cm=\E=%+ %+ :dc=\EW:dl=\ER:\ - :i1=\EcB2\EcC3:ip=:nw=\r\n:r3=\Ee*:sf=\n:sr=\Ej:tc=wy60: -wy60-42-w|wyse60-42-w|wyse 60 132-column 42-lines:\ - :Nl#16:co#132:lw#7:ws#97:\ - :cd=\Ey:cl=\E+:cm=\Ea%i%dR%dC:dc=\EW:ho=\036:ip=:nw=\r\n:\ - :r2=\EeF\E`;:\ - :tc=wy60-42: -# -wy60-43|wyse60-43|wyse 60 80-column 43-lines:\ - :Nl@:lh@:li#43:lw@:\ - :pn@:r3=\Ee+:tc=wy60-42: -wy60-43-w|wyse60-43-w|wyse 60 132-column 43-lines:\ - :Nl@:lh@:li#43:lw@:\ - :pn@:r3=\Ee+:tc=wy60-42-w: -# -wy60-vb|wyse60-vb|Wyse 60 visible bell:\ - :bl@:tc=wy60: -wy60-w-vb|wy60-wvb|wyse60-wvb|Wyse 60 132-column visible bell:\ - :bl@:\ - :tc=wy60-w: - -# The Wyse-99GT looks at lot like the Wyse 60 except that it -# does not have the 42/43 line mode. In the Wyse-60 the "lines" -# setup parameter controls the number of lines on the screen. -# For the Wyse 99GT the "lines" setup parameter controls the -# number of lines in a page. The screen can display 25 lines max. -# The Wyse-99GT also has personalities for the VT220 and -# Tektronix 4014. But this has no bearing on the native mode. -# -# (msgr) should be set but the clear screen fails when in -# alt-charset mode. Try \EcE\s\s\E+\s if the screen is really clear -# then set msgr, else use msgr@. -# -# u0 -> enter Tektronix mode -# u1 -> exit Tektronix mode -# -wy99gt|wyse99gt|Wyse 99gt:\ - :ms@:\ - :al=\EE:cd=\Ey:ce=\Et:cl=\E+:dc=\EW:dl=\ER:i2=\Ew0:ip=:nw@:\ - :r2=\E`\072:sf=\n:sr=\Ej:ta=\011:te=\Ew0:ti=\Ew1:\ - :u0=\E~>\E8:u1=\E[42h:vb=\E`8\E`9:tc=wy60: -# -wy99gt-w|wyse99gt-w|wyse 99gt 132-column:\ - :Nl#16:co#132:lw#7:ws#97:\ - :cd=\Ey:cl=\E+:cm=\Ea%i%dR%dC:dc=\EW:ip=:r2=\E`;:tc=wy99gt: -# -wy99gt-25|wyse99gt-25|wyse 99gt 80-column 25-lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r2=\E`\072:r3=\EwG\Ee):tc=wy99gt: -# -wy99gt-25-w|wyse99gt-25-w|wyse 99gt 132-column 25-lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r2=\E`;:tc=wy99gt-w: -# -wy99gt-vb|wyse99gt-vb|Wyse 99gt visible bell:\ - :bl@:tc=wy99gt: -# -wy99gt-w-vb|wy99gt-wvb|wyse99gt-wvb|Wyse 99gt 132-column visible bell:\ - :bl@:\ - :tc=wy99gt-w: -# -# The Wyse 160 is combination of the WY-60 and the WY-99gt. -# The reset strings are slow and the pad times very depending -# on other parameters such as font loading. I have tried -# to follow the following outline: -# -# -> set personality -# -> set number of columns -# -> set number of lines -# :i1: -> select the proper font -# :is: -> do the initialization -# :i3: -> set up display memory (2 pages) -# -# The display memory may be used for either text or graphics. -# When "Display Memory = Shared" the terminal will have more pages -# but garbage may be left on the screen when you switch from -# graphics to text. If "Display Memory = Unshared" then the -# text area will be only one page long. -# -# (wy160: we use \E{ rather than ^^ for home (both are documented) to avoid -# a bug reported by Robert Dunn, -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy160|wyse160|Wyse 160:\ - :am:bw:hs:km:mi:ms:\ - :co#80:li#24:ws#38:\ - :ae=\EcD:al=\EE:as=\EcE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\ - :cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\EF\r:\ - :ei=\Er:fs=^M:ho=\E{:i1=\EcB0\EcC1:i2=\Ew0:im=\Eq:ip=:\ - :is=\Ed$\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\EQ:kN=\EK:kP=\EJ:\ - :kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:ll=\E{^K:mb=\EG2:\ - :me=\E(\EH\003\EG0\EcD:mh=\EGp:nd=^L:nw=\r\n:sf=\n:\ - :so=\EGt:sr=\Ej:st=\E1:ta=^I:te=\Ew0:ti=\Ew1:ts=\EF:up=^K:\ - :vb=\E`8\E`9:ve=\E`1:vi=\E`0:\ - :tc=adm+sgr: -# -wy160-w|wyse160-w|wyse 160 132-column:\ - :Nl#16:co#132:lw#7:ws#90:\ - :cm=\Ea%i%dR%dC:dc=\EW:r2=\EeF\E`;:tc=wy160: -# -wy160-25|wyse160-25|wyse 160 80-column 25-lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy160: -wy160-25-w|wyse160-25-w|wyse 160 132-column 25-lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy160-w: -# -wy160-42|wyse160-42|wyse 160 80-column 42-lines:\ - :li#42:\ - :al=\EE:cd=\Ey:cl=\E+:dl=\ER:i1=\EcB2\EcC3:nw=\r\n:r3=\Ee*:\ - :sf=\n:sr=\Ej:\ - :tc=wy160: -wy160-42-w|wyse160-42-w|wyse 160 132-column 42-lines:\ - :Nl#16:co#132:lw#7:ws#90:\ - :cm=\Ea%i%dR%dC:dc=\EW:ip=:r2=\EeF\E`;:tc=wy160-42: -# -wy160-43|wyse160-43|wyse 160 80-column 43-lines:\ - :Nl@:lh@:li#43:lw@:\ - :pn@:r3=\Ee+:tc=wy160-42: -wy160-43-w|wyse160-43-w|wyse 160 132-column 43-lines:\ - :Nl@:lh@:li#43:lw@:\ - :pn@:r3=\Ee+:tc=wy160-42-w: -# -wy160-vb|wyse160-vb|Wyse 160 visible bell:\ - :bl@:tc=wy160: -wy160-w-vb|wy160-wvb|wyse160-wvb|Wyse 160 132-column visible bell:\ - :bl@:\ - :tc=wy160-w: -# -# The Wyse 75 is a vt100 lookalike without advanced video. -# -# The Wyse 75 can support one attribute (e.g. Dim, Inverse, -# Underline) without magic cookies. The following description -# uses this capability, but when more than one attribute is -# put on the screen at once, all attributes will be changed -# to be the same as the last attribute given. -# The Wyse 75 can support more attributes when used with magic -# cookies. The wy75-mc terminal description uses magic cookies -# to correctly handle multiple attributes on a screen. -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy75|wyse75|wyse 75:\ - :am:hs:mi:ms:xn:xo:\ - :co#80:li#24:ma#1:pb#1201:ws#78:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\ - :ds=\E[>\054\001\001\E[>-\001\001:ec=\E[%dX:ei=\E[4l:\ - :fs=^A:ho=\E[H:\ - :i1=\E[2;4;20;30l\E[?1;10l\E[12h\E[?7;8;25h:i2=\E[m:\ - :im=\E[4h:ip=:is=\E>\E(B\E)0\017:k1=\E[?5i:k2=\E[?3i:\ - :k3=\E[2i:k4=\E[@:k5=\E[M:k6=\E[17~:k7=\E[18~:k8=\E[19~:\ - :k9=\E[20~:kI=\E[@:kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:ke=\E>:\ - :kh=\E[H:kl=\E[D:kr=\E[C:ks=\E[?1l\E[?7h\E=:ku=\E[A:le=^H:\ - :me=\E[m\017:mh=\E[0t\E[2m:mr=\E[1t\E[7m:nd=\E[C:rc=\E8:\ - :sc=\E7:se=\E[m:sf=\n:so=\E[1t\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[>\054\001:ue=\E[m:up=\E[A:us=\E[2t\E[4m:\ - :vb=\E[30h\E\054\E[30l:ve=\E[?25h:vi=\E[?25l: -# -# This terminal description uses the non-hidden attribute mode -# (with magic cookie). -# -wy75-mc|wyse75-mc|wyse 75 with magic cookies:\ - :ms@:\ - :ma@:sg#1:\ - :ae=\E[0p\017:as=\E[0p\016:i2=\E[m\E[p:mb=\E[2p:\ - :me=\E[0p\017:mh=\E[1p:mk=\E[4p:mr=\E[16p:\ - :..sa=\E[%{0}%?%p2%p6%|%t%{8}%|%;%?%p1%p3%|%p6%|%t%{16}%|%;%?%p4%t%{2}%|%;%?%p1%p5%|%t%{1}%|%;%?%p7%t%{4}%|%;%dp%?%p9%t\016%e\017%;:\ - :se=\E[0p:so=\E[17p:ue=\E[0p:us=\E[8p:\ - :tc=wy75: -wy75-vb|wyse75-vb|wyse 75 with visible bell:\ - :pb@:\ - :bl@:tc=wy75: -wy75-w|wyse75-w|wyse 75 in 132 column mode:\ - :co#132:ws#130:\ - :r2=\E[35h\E[?3h:tc=wy75: -wy75-wvb|wyse75-wvb|wyse 75 with visible bell 132 columns:\ - :pb@:\ - :bl@:tc=wy75-w: -# -# Wyse 85 emulating a vt220 7 bit mode. -# 24 line screen with status line. -# -# The vt220 mode permits more function keys but it wipes out -# the escape key. I strongly recommend that be set to -# escape (esc). -# The terminal may have to be set for 8 data bits and 2 stop -# bits for the arrow keys to work. -# The Wyse 85 runs faster with XON/XOFF enabled. Also the -# :DC: and :IC: work best when XON/XOFF is set. :IC: and -# :DC: leave trash on the screen when used without XON/XOFF. -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy85|wyse85|wyse 85:\ - :am:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ds=\E[40l:\ - :ec=\E[%dX:ei=\E[4l:fs=\E[1;24r\E8:ho=\E[H:\ - :i1=\E[62;1"p\E[?5W:i2=\E>\E(B\E)0\017\E[m:im=\E[4h:ip=:\ - :is=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\E[B:ke=\E>:kh=\E[26~:kl=\E[D:kr=\E[C:\ - :ks=\E[?1l\E=:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m\017:\ - :mh=\E[2m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[m:sf=\n:\ - :so=\E[7m:sr=\EM:st=\EH:ta=\011:\ - :ts=\E[40h\E7\E[25;%i%p1%dH:ue=\E[m:up=\E[A:us=\E[4m:\ - :vb=\E[30h\E\054\E[30l:ve=\E[?25h:vi=\E[?25l: -# -# Wyse 85 with visual bell. -wy85-vb|wyse85-vb|wyse 85 with visible bell:\ - :bl@:vb=\E[30h\E\054\E[30l:tc=wy85: -# -# Wyse 85 in 132-column mode. -wy85-w|wyse85-w|wyse 85 in 132-column mode:\ - :co#132:ws#132:\ - :r2=\E[35h\E[?3h:tc=wy85: -# -# Wyse 85 in 132-column mode with visual bell. -wy85-wvb|wyse85-wvb|wyse 85 with visible bell 132-columns:\ - :bl@:\ - :tc=wy85-w: -# -# Wyse 185 emulating a vt320 7 bit mode. -# -# This terminal always displays 25 lines. These lines may be used -# as 24 data lines and a terminal status line (top or bottom) or -# 25 data lines. The 48 and 50 line modes change the page size -# and not the number of lines on the screen. -# -# The Compose Character key can be used as a meta key if changed -# by set-up. -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy185|wyse185|wyse 185:\ - :am:hs:km:mi:ms:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\ - :ds=\E7\E[99;0H\E[K\E8:ec=\E[%dX:ei=\E[4l:\ - :fs=\E[1;24r\E8:ho=\E[H:i1=\E[?5W:\ - :i2=\E>\E(B\E)0\017\E[m:im=\E[4h:ip=:\ - :is=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\E[B:ke=\E>:kh=\E[26~:kl=\E[D:kr=\E[C:\ - :ks=\E[?1l\E=:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m\017:\ - :mh=\E[2m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[27m:sf=\n:\ - :so=\E[7m:sr=\EM:st=\EH:ta=^I:te=\E[ R:ti=\E[ Q:\ - :ts=\E7\E[99;%i%p1%dH:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=\E[30h\E\054\E[30l:ve=\E[34h\E[?25h:vi=\E[?25l:\ - :vs=\E[?25h\E[34l: -# -# Wyse 185 with 24 data lines and top status (terminal status) -wy185-24|wyse185-24|wyse 185 with 24 data lines:\ - :hs@:\ - :ds@:fs@:r3=\E[?5l\E[47h\E[40l\E[1;24r:ts@:tc=wy185: -# -# Wyse 185 with visual bell. -wy185-vb|wyse185-vb|wyse 185+flash:\ - :bl@:tc=wy185: -# -# Wyse 185 in 132-column mode. -wy185-w|wyse185-w|wyse 185 in 132-column mode:\ - :co#132:ws#132:\ - :DC=\E[%dP:IC=\E[%d@:dc=\E[P:ei=:im=:ip=:r2=\E[35h\E[?3h:tc=wy185: -# -# Wyse 185 in 132-column mode with visual bell. -wy185-wvb|wyse185-wvb|wyse 185+flash+132 cols:\ - :bl@:tc=wy185-w: - -# wy325 terminfo entries -# Done by Joe H. Davis 3-9-92 - -# lines 25 columns 80 -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -wy325|wyse325|Wyse epc:\ - :5i:am:bw:hs:mi:\ - :Nl#8:co#80:lh#1:li#24:lw#8:pb#9601:ws#45:\ - :#2=\E{:%9=\EP:&3=\Er:@8=\E7:F1=^AJ\r:F2=^AK\r:F3=^AL\r:\ - :F4=^AM\r:F5=^AN\r:F6=^AO\r:LF=\EA11:LO=\EA10:RA=\Ed.:\ - :SA=\Ed/:\ - :ac=+/\054.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~:\ - :ae=\EcD:al=\EE:as=\EcE:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E+:\ - :cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\EF\r:\ - :ei=\Er:fs=^M:ho=^^:i1=\EcB0\EcC1:i2=\Ew0:im=\Eq:ip=:\ - :is=\EcD\E'\Er\EH\003\Ed/\EO\Ee1\Ed*\E`@\E`9\E`1\016\024\El:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:k;=^AI\r:kA=\EE:kB=\EI:kD=\EW:\ - :kE=\ET:kI=\Eq:kL=\ER:kN=\EK:kP=\EJ:kS=\EY:kb=^H:kd=^J:kh=^^:\ - :kl=^H:kr=^L:ku=^K:le=^H:ll=^^^K:mb=\EG2:\ - :me=\E(\EH\003\EG0\EcD:mh=\EGp:mp=\E):nd=^L:pf=^T:\ - :pl=\EZ2%+?%s\177:pn=\Ez%+/%s\r:po=\Ed#:ps=\EP:\ - :px=\EZ1%+?%s\177:r1=\E~\041\E~4:r2=\EeF\E`\072:\ - :r3=\EwG\Ee(:sf=\n:so=\EGt:sr=\Ej:st=\E1:ta=^I:te=\Ew0:\ - :ti=\Ew1:ts=\EF:up=^K:vb=\E`8\E`9:ve=\E`1:vi=\E`0:\ - :tc=adm+sgr: - -# -# lines 24 columns 80 vb -# -wy325-vb|wyse325-vb|wyse-325 with visual bell:\ - :bl@:tc=wy325: - -# -# lines 24 columns 132 -# -wy325-w|wyse325-w|wy325w-24|wyse-325 in wide mode:\ - :Nl#16:co#132:lw#7:ws#97:\ - :cm=\Ea%i%dR%dC:dc=\EW:ip=:r2=\E`;:tc=wy325: -# -# lines 25 columns 80 -# -wy325-25|wyse325-25|wy325-80|wyse-325|wyse-325 25 lines:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy325: -# -# lines 25 columns 132 -# -wy325-25w|wyse325-25w|wy325 132 columns:\ - :Nl@:lh@:li#25:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy325-w: -# -# lines 25 columns 132 vb -# -wy325-w-vb|wy325-wvb|wyse325-wvb|wyse-325 wide mode reverse video:\ - :bl@:\ - :tc=wy325-w: - -# -# lines 42 columns 80 -# -wy325-42|wyse325-42|wyse-325 42 lines:\ - :Nl@:lh@:li#42:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy325: -# -# lines 42 columns 132 -# -wy325-42w|wyse325-42w|wyse-325 42 lines wide mode:\ - :Nl@:lh@:li#42:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy325-w: -# -# lines 42 columns 132 vb -# -wy325-42w-vb|wy325-42wvb|wyse-325 42 lines wide mode visual bell:\ - :bl@:\ - :tc=wy325-w: -# -# lines 43 columns 80 -# -wy325-43|wyse325-43|wyse-325 43 lines:\ - :Nl@:lh@:li#43:lw@:\ - :pn@:tc=wy325: -# -# lines 43 columns 132 -# -wy325-43w|wyse325-43w|wyse-325 43 lines wide mode:\ - :Nl@:lh@:li#43:lw@:\ - :pn@:r3=\EwG\Ee):tc=wy325-w: -# -# lines 43 columns 132 vb -# -wy325-43w-vb|wy325-43wvb|wyse-325 43 lines wide mode visual bell:\ - :bl@:\ - :tc=wy325-w: - -# Wyse 370 -- 24 line screen with status line. -# -# The terminal may have to be set for 8 data bits and 2 stop -# bits for the arrow keys to work. -# -# If you change keyboards the terminal will send different -# escape sequences. -# The following definition is for the basic terminal without -# function keys. -# -# -> enter Tektronix 4010/4014 mode -# -> exit Tektronix 4010/4014 mode -# -> enter ASCII mode (from any ANSI mode) -# -> exit ASCII mode (goto native ANSI mode) -# -> enter Tek 4207 ANSI mode (from any ANSI mode) -# -> exit Tek 4207 mode (goto native ANSI mode) -# -# Bug: The capability resets attributes. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy370-nk|wyse 370 without function keys:\ - :am:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:\ - :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ds=\E[40l:\ - :ec=\E[%dX:ei=\E[4l:fs=\E[1;24r\E8:ho=\E[H:\ - :i1=\E[90;1"p\E[?5W:i2=\E>\017\E)0\E(B\E[63;0w\E[m:\ - :im=\E[4h:ip=:\ - :is=\E[2;4;20;30;40l\E[?1;10;16l\E[12h\E[?7;8;25h:\ - :ke=\E>:ks=\E[?1l\E=:le=^H:mb=\E[5m:md=\E[1m:me=\E[m\017:\ - :mh=\E[2m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[27m:sf=\n:\ - :so=\E[7m:sr=\EM:st=\EH:ta=\011:te=\E[ R:ti=\E[ Q:\ - :ts=\E[40l\E[40h\E7\E[99;%i%p1%dH:ue=\E[24m:up=\E[A:\ - :us=\E[4m:vb=\E[30h\E\054\E[30l:ve=\E[34h\E[?25h:\ - :vi=\E[?25l:vs=\E[?25h\E[34l: -# -# Function key set for the ASCII (wy-50 compatible) keyboard -# This is the default 370. -# -wy370|wyse370|wy370-101k|Wyse 370 with 101 key keyboard:\ - :@8=\EOM:F1=\E[23~:F2=\E[24~:F3=\E[25~:F4=\E[26~:\ - :F5=\E[28~:F6=\E[29~:k1=\E[?4i:k2=\E[?3i:k3=\E[2i:k4=\E[@:\ - :k5=\E[M:k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:\ - :k;=\E[21~:kA=\EOP:kB=\E[Z:kD=\EOQ:kI=\EOP:kL=\EOQ:kN=\E[U:\ - :kP=\E[V:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :tc=wy370-nk: -# -# Function key set for the VT-320 (and wy85) compatible keyboard -# -wy370-105k|Wyse 370 with 105 key keyboard:\ - :%1=\E[28~:*6=\E[4~:@0=\E[1~:@8=\EOM:F1=\E[23~:F2=\E[24~:\ - :F3=\E[25~:F4=\E[26~:F5=\E[28~:F6=\E[29~:F7=\E[31~:\ - :F8=\E[32~:F9=\E[33~:FA=\E[34~:K1=\EOw:K2=\EOu:K3=\EOy:\ - :K4=\EOq:K5=\EOs:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kD=\E[3~:\ - :kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\E[B:kh=\E[26~:\ - :kl=\E[D:kr=\E[C:ku=\E[A:l1=PF1:l2=PF2:l3=PF3:l4=PF4:\ - :tc=wy370-nk: -# -# Function key set for the PC compatible keyboard -# -wy370-EPC|Wyse 370 with 102 key keyboard:\ - :@7=\E[1~:@8=\EOM:F1=\E[23~:F2=\E[24~:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:k5=\E[M:k6=\E[17~:k7=\E[18~:k8=\E[19~:\ - :k9=\E[20~:k;=\E[21~:kB=\E[Z:kI=\E[2~:kN=\E[U:kP=\E[V:\ - :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :tc=wy370-nk: -# -# Wyse 370 with visual bell. -wy370-vb|Wyse 370 with visible bell:\ - :bl@:tc=wy370: -# -# Wyse 370 in 132-column mode. -wy370-w|Wyse 370 in 132-column mode:\ - :co#132:ws#132:\ - :r2=\E[35h\E[?3h:tc=wy370: -# -# Wyse 370 in 132-column mode with visual bell. -wy370-wvb|Wyse 370 with visible bell 132-columns:\ - :vb=\E[30h\E\054\E[30l:tc=wy370-w: -wy370-rv|Wyse 370 reverse video:\ - :r3=\E[32h\E[?5h:tc=wy370: -# -# Wyse 99gt Tektronix 4010/4014 emulator, -# -wy99gt-tek|Wyse 99gt Tektronix 4010/4014 emulator:\ - :am:os:\ - :co#74:li#35:\ - :bl=^G:cl=\E^L:\ - :..cm=\035%{3040}%{89}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037:\ - :cr=^M:do=^J:ff=^L:\ - :hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037:\ - :ho=^]7`x @\037:\ - :hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\037:\ - :is=\E8:le=^H:nd= :nw=^M^J:u0=\E~>\E8:u1=\E[42h:up=^K: -# -# Wyse 160 Tektronix 4010/4014 emulator, -# -wy160-tek|Wyse 160 Tektronix 4010/4014 emulator:\ - :..cm=\035%{3103}%{91}%p1%*%-%Py%p2%{55}%*%Px%gy%{128}%/%{31}%&%{32}%+%c%gy%{3}%&%{4}%*%gx%{3}%&%+%{96}%+%c%gy%{004}%/%{31}%&%{96}%+%c%gx%{128}%/%{31}%&%{32}%+%c%gx%{004}%/%{31}%&%{64}%+%c\037:\ - :ho=^]8`g @\037:\ - :tc=wy99gt-tek: -# -# Wyse 370 Tektronix 4010/4014 emulator, -# -wy370-tek|Wyse 370 Tektronix 4010/4014 emulator:\ - :am:os:\ - :co#80:li#36:\ - :bl=^G:cl=\E^L:\ - :..cm=\035%{775}%{108}%p1%*%{5}%/%-%Py%p2%{64}%*%{4}%+%{5}%/%Px%gy%{32}%/%{31}%&%{32}%+%c%gy%{31}%&%{96}%+%c%gx%{32}%/%{31}%&%{32}%+%c%gx%{31}%&%{64}%+%c\037:\ - :cr=^M:do=^J:ff=^L:\ - :hd=\036HHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH\037:\ - :ho=^]8g @\037:\ - :hu=\036DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD\037:\ - :is=\E8:kb=^H:kd=^J:kl=^H:kr=^I:ku=^K:le=^H:nd= :nw=^M^J:\ - :u0=\E[?38h\E8:u1=\E[?38l\E)0:up=^K: - -# Vendor-supplied Wyse entries end here. - -# Can't set tabs! Other bugs (ANSI mode only): -# - can't redefine function keys (anyway, key redefinition in ANSI mode -# is too much complex to be described); -# - meta key can't be described (the terminal forgets it when reset); -# The xon-xoff handshaking can't be disabled while in ansi personality, so -# emacs can't work at speed greater than 9600 baud. No padding is needed at -# this speed. -# dch1 has been commented out because it causes annoying glittering when -# vi deletes one character at the beginning of a line with tabs in it. -# dch makes sysgen(1M) have a horrible behaviour when deleting -# a screen and makes screen(1) behave badly, so it is disabled too. The nice -# thing is that vi goes crazy if smir-rmir are present and both dch-dch1 are -# not, so smir and rmir are commented out as well. -# From: Francesco Potorti` , 24 Aug 1998 -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy99-ansi|Wyse WY-99GT in ansi mode (int'l PC keyboard):\ - :am:km:mi:ms:xn:\ - :co#80:it#8:li#25:vt#3:\ - :AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:dl=\E[M:do=\ED:ec=\E[%dX:ei=\E[4l:ho=\E[H:\ - :im=\E[4h:\ - :is=\E7\E[1r\E8\E[2;3;4;13;20;34;39;36l\E[12;16;34h\E[?1;3;4;5;10;18l\E[?7;8;25h\E>\E[?5W\E(B\017\E[4i:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[M:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:k9=\E[20~:kb=^H:kd=\EOB:ke=\E[?1l:\ - :kl=\EOD:kr=\EOC:ks=\E[?1h:ku=\EOA:le=\010:ll=\E[24E:\ - :mb=\E[5m:md=\E[1m:me=\E[m\017\E["q:mh=\E[2m:mr=\E[7m:\ - :nd=\E[C:nw=\EE:rc=\E8:sc=\E7:se=\E[27m:sf=\n:so=\E[7m:\ - :sr=\EM:ta=^I:ue=\E[24m:up=\EM:us=\E[4m:vb=\E[?5h\E[?5l:\ - :ve=\E[34h\E[?25h:vi=\E[?25l:vs=\E[34l\E[?25h: - -# This is the american terminal. Here tabs work fine. -# From: Francesco Potorti` , 24 Aug 1998 -wy99a-ansi|Wyse WY-99GT in ansi mode (US PC keyboard):\ - :ct=\E[3g:i2=\E[?5l:r3=\E[?5l:st=\EH:\ - :tc=wy99-ansi: - -# This terminal (firmware version 02) has a lot of bugs: -# - can't set tabs; -# - other bugs in ANSI modes (see above). -# This description disables handshaking when using cup. This is because -# GNU emacs doesn't like Xon-Xoff handshaking. This means the terminal -# cannot be used at speeds greater than 9600 baud, because at greater -# speeds handshaking is needed even for character sending. If you use -# DTR handshaking, you can use even greater speeds. -# From: Francesco Potorti` , 24 Aug 1998 -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy99f|wy99fgt|wy-99fgt|Wyse WY-99GT (int'l PC keyboard):\ - :am:bw:hs:km:mi:ms:xo:\ - :co#80:it#8:li#25:ws#46:\ - :K1=^^:K3=\EJ:K4=\ET:K5=\EK:ae=\EcD:al=\EE:as=\EcE:bl=^G:\ - :bt=\EI:cd=\EY:ce=\ET:cl=\E'\E(\032:cm=\E=%+ %+ :cr=^M:\ - :dc=\EW:dl=\ER:do=\Ej:ds=\EF\r:ei=\Er:fs=^M:ho=^^:im=\Eq:\ - :is=\Eu\Ee6\EC\EDF\Ec21\Ec31\Ec62\Ec72\Ee;\016\E'\EeL\E`9\E\1360\E`1\E`4\Ee.\E`\072\Ee1\EG0\E(\Ed/\Ee4\Ed*\EO\E`I\Er\Ee"\EcD\024:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kb=^H:kd=^J:kl=^H:kr=^L:ku=^K:\ - :le=^H:mb=\EG2:me=\E(\EG0:mh=\EGp:mr=\EG4:nd=^L:nw=^_:\ - :se=\EG0:sf=^J:so=\EG4:sr=\Ej:ta=^I:te=\Ec21\Ec31:\ - :ti=\Ec20\Ec30:ts=\EF:up=^K:vb=\E\1361\E\1360:\ - :ve=\E`4\E`1:vi=\E`0:vs=\E`2\E`1: - -# This is the american terminal. Here tabs work. -# From: Francesco Potorti` , 24 Aug 1998 -wy99fa|wy99fgta|wy-99fgta|Wyse WY-99GT (US PC keyboard):\ - :ct=\E0:st=\E1:\ - :tc=wy99f: - -# -#TITLE: TERMINFO ENTRY WY520 -#DATE: 8/5/93 -# The WY520 terminfo is based on the WY285 entry published on the WYSE -# BBS with the addition of more function keys and special keys. -# -# rs1 -> set personality -# rs2 -> set number of columns -# rs3 -> set number of lines -# is1 -> select the proper font -# is2 -> do the initialization -# is3 -> If this string is empty then rs3 gets sent. -# -# Wyse 520 emulating a vt420 7 bit mode with default ANSI keyboard -# - The BS key is programmed to generate BS in smcup since -# is2 doesn't seem to work. -# - Remove and shift/Remove: delete a character -# - Insert : enter insert mode -# - Find : delete to end of file -# - Select : clear a line -# - F11, F12, F13: send default sequences (not ESC, BS, LF) -# - F14 : Home key -# - Bottom status line (host writable line) is used. -# - smkx,rmkx are removed because this would put the numeric -# keypad in Dec application mode which doesn't seem to work -# with SCO applications. -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy520|wyse520|wyse 520:\ - :am:hs:km:mi:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOy:K3=\EOu:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ds=\E[0$~:\ - :ec=\E[%dX:ei=\E[4l:fs=\E[0$}:ho=\E[H:i1=\E[?5W:\ - :i2=\E>\E(B\E)0\017\E[m:im=\E[4h:ip=:\ - :is=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25;67h:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\E[B:kh=\E[26~:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:\ - :rc=\E8:sc=\E7:se=\E[m:sf=\n:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :te=\E[ R:ti=\E[ Q\E[?67;8h:ts=\E[2$~\E[1$}\E[%i%p1%d`:\ - :ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[34h\E[?25h:vi=\E[?25l:\ - :vs=\E[?25h\E[34l: -# -# Wyse 520 with 24 data lines and status (terminal status) -wy520-24|wyse520-24|wyse 520 with 24 data lines:\ - :hs@:\ - :ds@:fs@:r3=\E[?5l\E[47h\E[40l\E[1;24r:ts@:tc=wy520: -# -# Wyse 520 with visual bell. -wy520-vb|wyse520-vb|wyse 520 with visible bell:\ - :vb=\E[30h\E\054\E[30l:tc=wy520: -# -# Wyse 520 in 132-column mode. -wy520-w|wyse520-w|wyse 520 in 132-column mode:\ - :co#132:ws#132:\ - :DC=\E[%dP:IC=\E[%d@:dc=\E[P:ei=:im=:ip=:r2=\E[35h\E[?3h:tc=wy520: -# -# Wyse 520 in 132-column mode with visual bell. -wy520-wvb|wyse520-wvb|wyse 520 with visible bell 132-columns:\ - :vb=\E[30h\E\054\E[30l:\ - :tc=wy520-w: -# -# -# Wyse 520 emulating a vt420 7 bit mode. -# The DEL key is programmed to generate BS in is2. -# With EPC keyboard. -# - 'End' key will clear till end of line on EPC keyboard -# - Shift/End : ignored. -# - Insert : enter insert mode. -# - Delete : delete a character (have to change interrupt character -# to CTRL-C: stty intr '^c') for it to work since the -# Delete key sends 7FH. -wy520-epc|wyse520-epc|wyse 520 with EPC keyboard:\ - :@7=\E[4~:k0=\E[21~:k1=\E[11~:k2=\E[12~:k3=\E[13~:\ - :k4=\E[14~:k5=\E[15~:kD=\177:kE=\E[4~:kh=\E[H:\ - :tc=wy520: -# -# Wyse 520 with 24 data lines and status (terminal status) -# with EPC keyboard. -wy520-epc-24|wyse520-pc-24|wyse 520 with 24 data lines and EPC keyboard:\ - :hs@:\ - :ds@:fs@:r3=\E[?5l\E[47h\E[40l\E[1;24r:ts@:tc=wy520-epc: -# -# Wyse 520 with visual bell. -wy520-epc-vb|wyse520-pc-vb|wyse 520 with visible bell and EPC keyboard:\ - :vb=\E[30h\E\054\E[30l:\ - :tc=wy520-epc: -# -# Wyse 520 in 132-column mode. -wy520-epc-w|wyse520-epc-w|wyse 520 in 132-column mode with EPC keyboard:\ - :co#132:ws#132:\ - :DC=\E[%dP:IC=\E[%d@:dc=\E[P:ei=:im=:ip=:r2=\E[35h\E[?3h:tc=wy520-epc: -# -# Wyse 520 in 132-column mode with visual bell. -wy520-epc-wvb|wyse520-p-wvb|wyse 520 with visible bell 132-columns and EPC keyboard:\ - :vb=\E[30h\E\054\E[30l:\ - :tc=wy520-epc-w: -# -# Wyse 520 in 80-column, 36 lines -wy520-36|wyse520-36|wyse 520 with 36 data lines:\ - :hs@:\ - :li#36:\ - :ds@:fs@:r3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r:ts@:tc=wy520: -# -# Wyse 520 in 80-column, 48 lines -wy520-48|wyse520-48|wyse 520 with 48 data lines:\ - :hs@:\ - :li#48:\ - :ds@:fs@:r3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r:ts@:tc=wy520: -# -# Wyse 520 in 132-column, 36 lines -wy520-36w|wyse520-36w|wyse 520 with 132 columns and 36 data lines:\ - :co#132:ws#132:\ - :r2=\E[?3h:\ - :r3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|:tc=wy520-36: -# -# Wyse 520 in 132-column, 48 lines -wy520-48w|wyse520-48w|wyse 520 with 48 data lines:\ - :co#132:ws#132:\ - :r2=\E[?3h:\ - :r3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|:tc=wy520-48: -# -# -# Wyse 520 in 80-column, 36 lines with EPC keyboard -wy520-36pc|wyse520-36pc|wyse 520 with 36 data lines and EPC keyboard:\ - :hs@:\ - :li#36:\ - :ds@:fs@:r3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r:ts@:tc=wy520-epc: -# -# Wyse 520 in 80-column, 48 lines with EPC keyboard -wy520-48pc|wyse520-48pc|wyse 520 with 48 data lines and EPC keyboard:\ - :hs@:\ - :li#48:\ - :ds@:fs@:r3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r:ts@:tc=wy520-epc: -# -# Wyse 520 in 132-column, 36 lines with EPC keyboard -wy520-36wpc|wyse520-36wpc|wyse 520 with 36 data lines and EPC keyboard:\ - :co#132:ws#132:\ - :r2=\E[?3h:\ - :r3=\E[?5l\E[36*|\E[36t\E[40l\E[1;36r\E[132$|:tc=wy520-36pc: -# -# Wyse 520 in 132-column, 48 lines with EPC keyboard -wy520-48wpc|wyse520-48wpc|wyse 520 with 48 data lines and EPC keyboard:\ - :co#132:ws#132:\ - :r2=\E[?3h:\ - :r3=\E[?5l\E[48*|\E[48t\E[40l\E[1;48r\E[132$|:tc=wy520-48pc: - -# From: John Gilmore -# (wyse-vp: removed :if=/usr/share/tabset/wyse-adds:, there's no such -# file and we don't know what :st: is -- esr) -wyse-vp|Wyse 50 in ADDS Viewpoint emulation mode with "enhance" on:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :al=\EM:bl=^G:cd=\Ek:ce=\EK:cl=^L:cm=\EY%+ %+ :cr=^M:dc=\EW:\ - :dl=\El:do=^J:ei=\Er:ho=^A:im=\Eq:is=\E`\072\E`9\017\Er:\ - :kb=^H:kd=^J:kh=^A:kl=^U:kr=^F:ku=^Z:le=^H:ll=^A^Z:me=^O:\ - :nd=^F:nw=^M^J:r1=\E`\072\E`9\017\Er:se=^O:sf=^J:so=^N:\ - :ta=^I:ue=^O:up=^Z:us=^N: - -wy75ap|wyse75ap|wy-75ap|wyse-75ap|Wyse WY-75 Applications and Cursor keypad:\ - :is=\E[1;24r\E[?10;3l\E[?1;25h\E[4l\E[m\E(B\E=:kb=^H:\ - :kd=\EOB:ke=10\E[?1l\E>:kh=\EOH:kl=\EOD:kr=\EOC:\ - :ks=10\E[?1h\E=:ku=\EOA:tc=wy75: - -# From: Kevin Turner , 12 Jul 1998 -# This copes with an apparent firmware bug in the wy85. He writes: -# "What I did was change leave the terminal cursor keys set to Normal -# (instead of application), and change \E[ to \233 for all the keys in -# terminfo. At one point, I found some reference indicating that this -# terminal bug (not sending \E[) was acknowledged by Wyse (so it's not just -# me), but I can't find that and the server under my bookmark to "Wyse -# Technical" isn't responding. So there's the question of wether the wy85 -# terminfo should reflect the manufactuer's intended behaviour of the terminal -# or the actual." -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -wy85-8bit|wyse85-8bit|wyse 85 in 8-bit mode:\ - :am:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:ds=\E[40l:\ - :ec=\E[%dX:ei=\E[4l:fs=\E[1;24r\E8:ho=\E[H:\ - :i1=\E[62;1"p\E[?5W:i2=\E>\E(B\E)0\017\E[m:im=\E[4h:ip=:\ - :is=\E[2;4;20;30l\E[?1;4;10;16l\E[12h\E[?7;8;25h:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\23317~:k7=\23318~:\ - :k8=\23319~:k9=\23320~:kD=\2333~:kI=\2332~:kN=\2336~:\ - :kP=\2335~:kb=^H:kd=\233B:ke=\E>:kh=\23326~:kl=\233D:\ - :kr=\233C:ks=\E[?1l\E=:ku=\233A:le=^H:mb=\E[5m:md=\E[1m:\ - :me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:\ - :se=\E[m:sf=\n:so=\E[7m:sr=\EM:st=\EH:ta=\011:\ - :ts=\E[40h\E7\E[25;%i%p1%dH:ue=\E[m:up=\E[A:us=\E[4m:\ - :vb=\E[30h\E\054\E[30l:ve=\E[?25h:vi=\E[?25l: - -# From: Eric Freudenthal -wy100q|Wyse 100 for Quotron:\ - :bs:\ - :co#80:li#24:sg#1:\ - :al=\EE:bt=\EI:cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :dc=\EW:\ - :dl=\ER:do=^J:ei=\Er:ho=^^:im=\Eq:\ - :is=\E`\072\0\EC\EDF\E0\E'\E(\EA21:kd=^J:kl=^H:kr=^L:\ - :ku=^K:le=^H:mk@:nd=^L:sr=\Ej:up=^K:\ - :tc=adm+sgr: - -#### Kermit terminal emulations -# -# Obsolete Kermit versions may be listed in the section describing obsolete -# non-ANSI terminal emulators later in the file. -# - -# KERMIT standard all versions. -# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. -# (kermit: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) -# From: greg small 9-25-84 -kermit|standard kermit:\ - :bs:\ - :co#80:li#24:\ - :cd=\EJ:ce=\EK:cl=\EE:cm=\EY%+ %+ :ho=\EH:\ - :is=K0 Standard Kermit 9-25-84\n:kd=^J:kh=^^:kl=^H:\ - :kr=^L:ku=^K:le=^H:nd=\EC:up=\EA: -kermit-am|standard kermit plus auto-margin:\ - :am:\ - :is=K1 Standard Kermit plus Automatic Margins\n:tc=kermit: -# IBMPC Kermit 1.2. -# Bugs: :cd:, :ce:: do not work except at beginning of line! :cl: does -# not work, but fake with :cl=\EH\EJ (since :cd=\EJ: works at beginning of -# line). -# From: greg small 8-30-84 -pckermit|pckermit12|UCB IBMPC Kermit 1.2:\ - :am:\ - :li#25:\ - :cd@:ce@:cl=\EH\EJ:\ - :is=K2 UCB IBMPC Kermit 1.2 8-30-84\n:tc=kermit: -# IBMPC Kermit 1.20 -# Cannot use line 25, now acts funny like ansi special scrolling region. -# Initialization must escape from that region by cursor position to line 24. -# Cannot use character insert because 1.20 goes crazy if insert at col 80. -# Does not use :am: because autowrap is lost when kermit dropped and restarted. -# From: greg small 12-19-84 -pckermit120|UCB IBMPC Kermit 1.20:\ - :it#8:li#24:\ - :al=\EL:dc=\EN:dl=\EM:do=\EB:ei@:im@:\ - :is=\EO\Eq\EJ\EY7 K3 UCB IBMPC Kermit 1.20 12-19-84\n:\ - :se=\Eq:so=\Ep:ta=^I:vs=\EO\Eq\EEK3:\ - :tc=kermit: -# MS-DOS Kermit 2.27 for the IBMPC -# Straight ascii keyboard. :sr=\EI: not avail. many versions + bug prone in vi. -# Cannot use line 25, now acts funny like ansi special scrolling region. -# Initialization must escape from that region by cursor position to line 24. -# Does not use am: because autowrap is lost when kermit dropped and restarted. -# Reverse video for standout like H19. -# (msk227: removed obsolete ":ma=^Hh^Jj^Kk^Ll^^H:" -- esr) -# From: greg small 3-17-85 -msk227|mskermit227|MS-DOS Kermit 2.27 for the IBMPC:\ - :am@:bs:\ - :co#80:it#8:li#24:\ - :al=\EL:cd=\EJ:ce=\EK:cl=\EE:cm=\EY%+ %+ :dc=\EN:dl=\EM:\ - :do=\EB:ei=\EO:ho=\EH:im=\E@:\ - :is=\EO\Eq\EG\Ew\EJ\EY7 K4 MS Kermit 2.27 for the IBMPC 3-17-85\n:\ - :kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:nd=\EC:rc=\Ek:sc=\Ej:\ - :se=\Eq:so=\Ep:ta=^I:up=\EA:vs=\EO\Eq\EG\EwK4: -# MS-DOS Kermit 2.27 with automatic margins -# From: greg small 3-17-85 -msk227am|mskermit227am|UCB MS-DOS Kermit 2.27 with automatic margins:\ - :am:\ - :is=\EO\Eq\EG\Ev\EJ\EY7 K5 MS Kermit 2.27 +automatic margins 3-17-85\n:\ - :vs=\EO\Eq\EG\EvK5:\ - :tc=msk227: -# MS-DOS Kermit 2.27 UCB 227.14 for the IBM PC -# Automatic margins now default. Use ansi :sa: for highlights. -# Define function keys. -# (msk22714: removed obsolete ":kn#10:" -- esr) -# From: greg small 3-17-85 -msk22714|mskermit22714|UCB MS-DOS Kermit 2.27 UCB 227.14 IBM PC:\ - :am:\ - :is=\EO\Eq\EG\Ev\EJ\EY7 K6 MS Kermit 2.27 UCB 227.14 IBM PC 3-17-85\n:\ - :k0=\E0:k1=\E1:k2=\E2:k3=\E3:k4=\E4:k5=\E5:k6=\E6:k7=\E7:\ - :k8=\E8:k9=\E9:md=\E[1m:me=\E[m:mr=\E[7m:se=\E[m:so=\E[1m:\ - :ue=\E[m:us=\E[4m:vs=\EO\Eq\EG\EvK6:\ - :tc=mskermit227: -# This was designed for a VT320 emulator, but it is probably a good start -# at support for the VT320 itself. -# Please send changes with explanations to bug-gnu-emacs@prep.ai.mit.edu. -# (vt320-k3: I added / based on the init string -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -vt320-k3|MS-Kermit 3.00's vt320 emulation:\ - :am:es:hs:km:mi:ms:xn:\ - :co#80:it#8:li#49:pb#9600:vt#3:\ - :AL=\E[%dL:CC=\E:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SR=\E[%dL:UP=\E[%dA:ae=\E(B:al=\E[L:\ - :as=\E(0:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\ - :ds=\E[0$~:ec=\E[%dX:ei=\E[4l:fs=\E[0$}:ho=\E[H:im=\E[4h:\ - :is=\E>\E F\E[?1l\E[?7h\E[r\E[2$~:k0=\E[21~:k1=\EOP:\ - :k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:k8=\E[19~:\ - :k9=\E[20~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:kd=\EOB:\ - :ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nw=^M^J:rc=\E8:\ - :sc=\E7:se=\E[27m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[1$}\r\E[K:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=\E[?5h\E[?5l\E[?5h\E[?5l\E[?5h\E[?5l:ve=\E[?25h:\ - :vi=\E[?25l: -# From: Joseph Gil 13 Dec 1991 -# ACS capabilities from Philippe De Muyter 30 May 1996 -# (I removed a bogus boolean :mo: and added :ms:, , -- esr) -vt320-k311|dec vt320 series as defined by kermit 3.11:\ - :am:es:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=3\E[L:as=^N:bl=^G:cd=\E[J:ce=\E[K:cl=\E[;H\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\ - :dl=\E[M:do=^J:ds=\E[2$~\r\E[1$}\E[K\E[$}:ei=\E[4l:\ - :fs=\E[$}:ho=\E[H:im=\E[4h:\ - :is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l1=pf1:l2=pf2:l3=pf3:l4=pf4:\ - :le=^H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nw=^M\ED:\ - :r1=\E[?3l:rc=\E8:rf=/usr/share/tabset/vt100:sc=\E7:\ - :se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[2$~\E[1$}\E[1;%dH:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h: - -# -######## ---------------- TERMINFO FILE CAN BE SPLIT HERE ------------------- -# This cut mark helps make life less painful for people running ncurses tic -# on machines with relatively little RAM. The file can be broken in half here -# cleanly and compiled in sections -- no `use' references cross this cut -# going forward. -# - -######## OLDER TERMINAL TYPES -# -# This section is devoted to older commercial terminal brands that are now -# discontinued, but known to be still in use or represented by emulations. -# - -#### AT&T (att, tty) -# -# This section also includes Teletype-branded VDTs. -# -# The AT&T/Teletype terminals group was sold to SunRiver Data Systems (now -# Boundless Technologies); for details, see the header comment on the ADDS -# section. -# -# These are AT&T's official terminfo entries. All-caps aliases have been -# removed. -# -att2300|sv80|AT&T 2300 Video Information Terminal 80 column mode:\ - :am:eo:mi:ms:xo:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[11r:\ - :F2=\E[12r:F3=\E[13r:F4=\E[14r:F5=\E[15r:F6=\E[16r:\ - :IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:\ - :cb=\E[1K:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :cr=^M:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:im=\E[4h:\ - :k1=\E[1r:k2=\E[2r:k3=\E[3r:k4=\E[4r:k5=\E[5r:k6=\E[6r:\ - :k7=\E[7r:k8=\E[8r:k9=\E[9r:k;=\E[10r:kA=\E[L:kB=\E[Z:\ - :kC=\E[J:kD=\E[P:kI=\E[@:kL=\E[M:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:me=\E[m:mr=\E[7m:nd=\E[C:\ - :pf=\E[4i:po=\E[5i:ps=\E[0i:se=\E[m:sf=^J:so=\E[7m:ta=^I:\ - :up=\E[A: -att2350|AT&T 2350 Video Information Terminal 80 column mode:\ - :pf@:po@:ps@:\ - :tc=att2300: - -# Must setup RETURN KEY - CR, REC'VD LF - INDEX. -# Seems upward compatible with vt100, plus ins/del line/char. -# On sgr, the protection parameter is ignored. -# No check is made to make sure that only 3 parameters are output. -# standout= reverse + half-intensity = 3 | 5. -# bold= reverse + underline = 2 | 3. -# note that half-bright blinking doesn't look different from normal blinking. -# NOTE:you must program the function keys first, label second! -# (att4410: a BSD entry has been seen with the following capabilities: -# :is=\E[?6l:, :k1=\EOc:, :k2=\EOd:, :k3=\EOe:, :k4=\EOg:, -# :k6=\EOh:, :k7=\EOi:, :k8=\EOj:, -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -att5410v1|att4410v1|tty5410v1|AT&T 4410/5410 80 columns - version 1:\ - :am:hs:mi:ms:xo:\ - :Nl#8:co#80:it#8:lh#2:li#24:lw#8:ws#80:\ - :ac=++\054\054--..00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:\ - :do=\E[B:ei=:fs=\E8:ho=\E[H:i1=\E[?3l\E)0:\ - :i2=\E[1;03q f1 \EOP\E[2;03q f2 \EOQ\E[3;03q f3 \EOR\E[4;03q f4 \EOS\E[5;03q f5 \EOT\E[6;03q f6 \EOU\E[7;03q f7 \EOV\E[8;03q f8 \EOW:\ - :ic=\E[@:im=:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:\ - :k6=\EOU:k7=\EOV:k8=\EOW:kC=\E[2J:kH=\E[24;1H:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:ll=\E[24H:\ - :mb=\E[5m:md=\E[2;7m:me=\E[m\017:mh=\E[2m:mk=\E[8m:\ - :mr=\E[7m:nd=\E[C:nw=^M^J:r2=\Ec\E[?3l\E[2;0y:rc=\E8:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:\ - :ts=\E7\E[25;%p1%{1}%+%dH:ue=\E[m:up=\E[A:us=\E[4m: - -att4410v1-w|att5410v1-w|tty5410v1-w|AT&T 4410/5410 132 columns - version 1:\ - :co#132:ws#132:\ - :i1=\E[?3h\E)0:r2=\Ec\E[?3h\E[2;0y:tc=att5410v1: - -att4410|att5410|tty5410|AT&T 4410/5410 80 columns - version 2:\ - :bs:\ - :..px=\E[%p1%d;%p2%l%02dq f%p1%d %p2%s:tc=att5410v1: - -att5410-w|att4410-w|4410-w|tty5410-w|5410-w|AT&T 4410/5410 in 132 column mode:\ - :co#132:ws#132:\ - :i1=\E[?3h\E)0:r2=\Ec\E[?3h\E[2;0y:tc=att4410: - -# 5410 in terms of a vt100 -# (v5410: added / based on init string -- esr) -v5410|att5410 in terms of a vt100:\ - :am:mi:ms:xo:\ - :co#80:it#8:li#24:vt#3:\ - :@8=\EOM:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:RA=\E[?7l:\ - :SA=\E[?7h:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[L:as=^N:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:eA=\E(B\E)0:ei=:ho=\E[H:\ - :ic=\E[@:im=:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :k5=\EOt:k6=\EOu:k7=\EOv:k8=\EOl:k9=\EOw:k;=\EOx:kb=^H:\ - :kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[m\017:mr=\E[7m:\ - :nd=\E[C:r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :..sa=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[1;7m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[m:up=\E[A:us=\E[4m: - -# -# Teletype Model 5420 -- A souped up 5410, with multiple windows, -# even! the 5420 has three modes: scroll, window or page mode -# this terminfo should work in scroll or window mode, but doesn't -# take advantage of any of the differences between them. -# -# Has memory below (2 lines!) -# 3 pages of memory (plus some spare) -# The 5410 sequences for :cm:, :vs:, :DC:, :DL:, :ec:, :vb:, :ho:, -# , :st: would work for these, but these work in both scroll and window -# mode... Unset insert character so insert mode works -# :i1: sets 80 column mode, -# :is: escape sequence: -# 1) turn off all fonts -# 2) function keys off, keyboard lock off, control display off, -# insert mode off, erasure mode off, -# 3) full duplex, monitor mode off, send graphics off, nl on lf off -# 4) reset origin mode -# 5) set line wraparound -# 6) exit erasure mode, positional attribute mode, and erasure extent mode -# 7) clear margins -# 8) program ENTER to transmit ^J, -# We use \212 to program the ^J because a bare ^J will get translated by -# UNIX into a CR/LF. The enter key is needed for AT&T uOMS. -# 1 2 3 4 5 6 7 8 -# :i3: set screen color to black, -# No representation in terminfo for the delete word key: kdw1=\Ed -# Key capabilities assume the power-up send sequence... -# This :te: is not strictly necessary, but it helps maximize -# memory usefulness: :te=\Ez:, -# Alternate sgr0: :me=\E[m\EW^O:, -# Alternate sgr: :sa=\E[%?%p1%t2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p8%t\EV%;%?%p9%t^N%e^O%;:, -# smkx programs the SYS PF keys to send a set sequence. -# It also sets up labels f1, f2, ..., f8, and sends edit keys. -# This string causes them to send the strings :k1:-:k8: -# when pressed in SYS PF mode. -# (att4415: I added / based on the init string -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -att4415|tty5420|att5420|AT&T 4415/5420 80 cols:\ - :bs:db:mi:xo:\ - :Nl#8:lh#2:lm#78:lw#8:ws#55:\ - :@1=\Et:@7=\Ez:@8=\Eent:AL=\E[%dL:CM=\E[%i%p1%d;%p2%dt:\ - :DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:LF=\E|:\ - :LO=\E~:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:SF=\E[%dE:SR=\E[%dF:\ - :UP=\E[%dA:bt=\E[Z:ch=\E[%+^AG:cl=\E[x\E[J:\ - :cm=\E[%i%d;%dx:ct=\E[3g:cv=\E[%+^Ad:ec=\E[%ds\E[%dD:\ - :ei=\E[4l:ho=\E[x:i1=\E[?3l:i2=\E[?5l:ic@:im=\E[4h:\ - :is=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[21;1j\212:\ - :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:\ - :k8=\EOj:kA=\E[L:kB=\E[Z:kD=\E[P:kE=\E[2K:kF=\E[T:kH=\Eu:\ - :kI=\E[4h:kL=\E[M:kN=\E[U:kP=\E[V:kR=\E[S:\ - :ke=\E[19;0j\E[21;1j\212:ks=\E[19;1j\E[21;4j\Eent:\ - :l1=F1:l2=F2:l3=F3:l4=F4:l5=F5:l6=F6:l7=F7:l8=F8:ll=\Ew:\ - :me=\E[m\017:mp=\EV:pf=\E[?9i:po=\E[?4i:ps=\E[?2i:st=\EH:\ - :ts=\E7\E[25;%p1%{8}%+%dH:vb=\E[?5h\E[?5l:ve=\E[11;0j:\ - :vs=\E[11;1j:\ - :tc=att4410: - -att4415-w|tty5420-w|att5420-w|AT&T 4415/5420 132 cols:\ - :co#132:lm#54:ws#97:\ - :i1=\E[?3h:tc=att4415: - -att4415-rv|tty5420-rv|att5420-rv|AT&T 4415/5420 80 cols/rv:\ - :i2=\E[?5h:vb=\E[?5l\E[?5h:\ - :tc=att4415: - -att4415-w-rv|tty5420-w-rv|att5420-w-rv|AT&T 4415/5420 132 cols/rv:\ - :co#132:lm#54:ws#97:\ - :i1=\E[?3h:i2=\E[?5h:vb=\E[?5l\E[?5h:tc=att4415: - -# Note that this mode permits programming USER PF KEYS and labels -# However, when you program user pf labels you have to reselect -# user pf keys to make them appear! -att4415+nl|tty5420+nl|att5420+nl|generic AT&T 4415/5420 changes for not changing labels:\ - :k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:\ - :..pn=\E[%p1%d;0;0;1q%p2%:-16.16s:\ - :..px=\E[%p1%d;%p2%l%02d;0;1q F%p1%d %p2%s: - -att4415-nl|tty5420-nl|att5420-nl|AT&T 4415/5420 without changing labels:\ - :k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:\ - :tc=att4415+nl:tc=att4415: - -att4415-rv-nl|tty5420-rv-nl|att5420-rv-nl|AT&T 4415/5420 reverse video without changing labels:\ - :k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:\ - :tc=att4415+nl:tc=att4415-rv: - -att4415-w-nl|tty5420-w-nl|att5420-w-nl|AT&T 4415/5420 132 cols without changing labels:\ - :k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:\ - :tc=att4415+nl:tc=att4415-w: - -att4415-w-rv-n|tty5420-w-rv-n|att5420-w-rv-n|AT&T 4415/5420 132 cols reverse without changing labels:\ - :k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:\ - :tc=att4415+nl:tc=att4415-w-rv: - -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att5420_2|AT&T 5420 model 2 80 cols:\ - :am:db:hs:mi:ms:xo:\ - :co#80:it#8:li#24:lm#78:ws#55:\ - :AL=\E[%dL:CM=\E[%i%p1%d;%p2%dt:DC=\E[%dP:DL=\E[%dM:\ - :IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:SF=\E[%dE:SR=\E[%dF:\ - :UP=\E[%dA:ae=^O:al=\E[L:as=^N:bt=\E[1Z:cd=\E[0J:ce=\E[0K:\ - :cl=\EH\EJ:cm=\E[%i%d;%dH:cr=\EG:cs=\E[%i%d;%dr:ct=\E[3g:\ - :dc=\E[P:dl=\E[M:do=\E[1B:ec=\E[%ds\E[%dD:ei=:fs=\E8:\ - :ho=\E[H:\ - :i1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;0j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r:\ - :ic=\E[@:im=:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:\ - :k6=\EOh:k7=\EOi:k8=\EOj:kD=\E[P:kH=\Eu:kI=\E[4h:kN=\E[U:\ - :kP=\E[V:kb=^H:kd=\E[B:ke=\E[19;0j:kh=\E[H:kl=\E[D:kr=\E[C:\ - :ks=\E[19;1j:ku=\E[A:le=^H:ll=\Ew:mb=\E[5m:me=\E[m\017:\ - :mh=\E[2m:mr=\E[7m:nd=\E[1C:nw=^M^J:rc=\E8:sc=\E7:se=\E[m:\ - :sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E7\E[25;%p1%{8}%+%dH:ue=\E[m:us=\E[4m:\ - :vb=\E[?5h\E[?5l:ve=\E[11;0j:vs=\E[11;1j: -att5420_2-w|AT&T 5420 model 2 in 132 column mode:\ - :co#132:\ - :i1=\E[0;23r\Ex\Ey\E[2;0j\E[3;3j\E[4;0j\E[5;1j\E[6;0j\E[7;0j\E[8;0j\E[9;1j\E[10;0j\E[15;0j\E[16;1j\E[19;0j\E[20;1j\E[29;0j\E[1;24r:tc=att5420_2: - -att4418|att5418|AT&T 5418 80 cols:\ - :am:xo:\ - :co#80:li#24:\ - :@8=\E[:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[n:\ - :F2=\E[o:F3=\E[H:F4=\E[I:F5=\E[J:F8=\E[K:F9=\E[L:FA=\E[E:\ - :FB=\E[_:FC=\E[M:FD=\E[N:FE=\E[O:IC=\E[%d@:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[1L:as=^N:bl=^G:cd=\E[0J:ce=\E[0K:cl=\E[H\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:dc=\E[1P:dl=\E[M:do=\E[B:ei=:ho=\E[H:\ - :i1=\E[?3l:ic=\E[1@:im=:is=\E)0\E?6l\E?5l:k1=\E[h:k2=\E[i:\ - :k3=\E[j:k6=\E[k:k7=\E[l:k8=\E[f:k9=\E[w:k;=\E[m:kC=\E[%:\ - :kd=\EU:kh=\Ec:kl=\E@:kr=\EA:ku=\ES:le=\E[D:mb=\E[5m:\ - :me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:\ - :se=\E[m:sf=^J:so=\E[7m:ue=\E[m:up=\E[A:us=\E[4m: -att4418-w|att5418-w|AT&T 5418 132 cols:\ - :co#132:\ - :i1=\E[?3h:tc=att5418: - -att4420|tty4420|teletype 4420:\ - :bs:da:db:eo:ms:ul:xo:\ - :co#80:li#24:lm#72:\ - :al=\EL:bl=^G:cd=\EJ:ce=\Ez:cl=\EH\EJ:cm=\EY%+ %+ :cr=\EG:\ - :dc=\EP:dl=\EM:dm@:do=\EB:ed@:ho=\EH:k0=\EU:k3=\E@:kA=\EL:\ - :kB=\EO:kC=\EJ:kD=\EP:kF=\ES:kI=\E\136:kL=\EM:kR=\ET:kd=\EB:\ - :kh=\EH:kl=^H:kr=\EC:ku=\EA:l0=segment advance:\ - :l3=cursor tab:le=\ED:nd=\EC:se=\E~:sf=\EH\EM\EY7 :so=\E}:\ - :ue=\EZ:up=\EA:us=\E\: - -# The following is a terminfo entry for the Teletype 4424 -# asynchronous keyboard-display terminal. It supports -# the vi editor. The terminal must be set up as follows, -# -# HIGHLIGHT DEFINITION 3-TONE -# DISPLAY FUNCTION GROUP III -# -# The second entry below provides limited (a la adm3a) -# operation under GROUP II. -# -# This must be used with DISPLAY FUNCTION GROUP I or III -# and HIGHLIGHT DEFINITION 3-TONE -# The terminal has either bold or blink, depending on options -# -# (att4424: commented out :ti:=\E[1m, we don't need bright locked on -- esr) -att4424|tty4424|teletype 4424:\ - :am:bs:xo:\ - :co#80:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\E(B:al=\EL:as=\E(0:bl=^G:bt=\EO:cd=\EJ:ce=\Ez:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\EF:\ - :dc=\EP:dl=\EM:do=\EB:ei=:ho=\E[H:ic=\E\136:im=:\ - :is=\E[20l\E[?7h:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kC=\EJ:\ - :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E3:\ - :md=\E3:me=\EX\E~\EZ\E4\E(B:mh=\EW:mr=\E}:nd=\EC:nw=\EE:\ - :..sa=\E[%?%p1%t7%;%?%p2%t;4%;%?%p3%t;7%;%?%p6%t;1%;%?%p6%p4%|%t;5%;%?%p5%t;0%;m:\ - :se=\E~:sf=^J:so=\E}:sr=\ET:st=\EH:ta=^I:ue=\EZ:up=\EA:\ - :us=\E\: - -att4424-1|tty4424-1|teletype 4424 in display function group I:\ - :kC@:kd=\EB:kh@:kl=\ED:kr=\EC:ku=\EA:\ - :tc=att4424: - -# This entry is not one of AT&T's official ones, it was translated from the -# 4.4BSD termcap file. The highlight strings are different from att4424. -# I have no idea why this is -- older firmware version, maybe? -# The following two lines are the comment originally attached to the entry: -# This entry appears to avoid the top line - I have no idea why. -# From: jwb Wed Mar 31 13:25:09 1982 remote from ihuxp -att4424m|tty4424m|teletype 4424M:\ - :am:da:db:mi:\ - :co#80:it#8:li#23:\ - :al=\EL:bl=^G:ce=\E[K:cl=\E[2;H\E[J:cm=\E[%i%2;%2H\E[B:\ - :cr=^M:dc=\EP:dl=\EM:do=^J:ei=:ic=\E\136:im=:ip=2:\ - :is=\E[m\E[2;24r:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:me=\E[m:\ - :nd=\E[C:nw=^M^J:se=\E[m:sf=^J:so=\E[7m:sr=\ET:ta=^I:\ - :ue=\E[m:up=\E[A:us=\E[4m: - -# The Teletype 5425 is really version 2 of the Teletype 5420. It -# is quite similar, except for some minor differences. No page -# mode, for example, so all of the :cm: sequences used above have -# to change back to what's being used for the 5410. Many of the -# option settings have changed their numbering as well. -# -# This has been tested on a preliminary model. -# -# (att5425: added / based on the init string -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att5425|tty5425|att4425|AT&T 4425/5425:\ - :am:da:db:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:lm#78:ws#55:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dE:SR=\E[%dF:UP=\E[%dA:ae=^O:\ - :al=\E[L:as=^N:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\ - :dl=\E[M:do=^J:ec=\E[%ds\E[%dD:ei=\E[4l:fs=\E8:ho=\E[H:\ - :i1=\E<\E[?3l:i2=\E[?5l:im=\E[4h:\ - :is=\E[m\017\E[1;2;3;4;6l\E[12;13;14;20l\E[?6;97;99l\E[?7h\E[4i\Ex\E[25;1j\212:\ - :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:\ - :k8=\EOj:kD=\E[P:kI=\E[4h:kb=^H:kd=\E[B:\ - :ke=\E[21;0j\E[25;1j\212:kh=\E[H:kl=\E[D:kr=\E[C:\ - :ks=\E[21;1j\E[25;4j\Eent\E~:ku=\E[A:le=^H:ll=\E[24H:\ - :mb=\E[5m:md=\E[2;7m:me=\E[m\017:mh=\E[2m:mr=\E[7m:\ - :nd=\E[C:nw=^M^J:rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:\ - :sr=\EM:st=\EH:ta=^I:ts=\E7\E[25;%p1%{8}%+%dH:ue=\E[m:\ - :up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[12;0j:\ - :vs=\E[12;1j: - -att5425-nl|tty5425-nl|att4425-nl|AT&T 4425/5425 80 columns no labels:\ - :ks=\E[21;1j\E[25;4j\Eent:\ - :tc=att4425: - -att5425-w|att4425-w|tty5425-w|teletype 4425/5425 in 132 column mode:\ - :co#132:lm#54:ws#97:\ - :i1=\E[?3h:tc=tty5425: - -# (att4426: his had bogus capabilities: :ri=\EM:, :ri=\E[1U:. -# I also added / -- esr) -att4426|tty4426|teletype 4426S:\ - :am:da:db:xo:\ - :co#80:li#24:lm#48:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:SF=\E[%dS:\ - :SR=\E[%dT:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\E(B:al=\EL:as=\E(0:bl=^G:cd=\E[J:ce=\E[0K:ch=\E[%dG:\ - :cl=\E[H\E[2J\E[1U\E[H\E[2J\E[1V:cm=\E[%i%d;%dH:cr=^M:\ - :ct=\E[3g:cv=\E[%dd:dc=\EP:dl=\E[M:do=\E[B:ei=:ho=\E[H:\ - :i1=\Ec\E[?7h:ic=\E\136:im=:is=\E[m\E[1;24r:k1=\EOP:\ - :k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:\ - :kB=\EO:kC=\E[2J:kH=\E[24;1H:kb=^H:kd=\EB:kh=\E[H:kl=\ED:\ - :kr=\EC:ku=\EA:le=\E[D:ll=\E[24H:md=\E[5m:me=\E[m\E(B:\ - :mr=\E[7m:nd=\E[C:nw=^M^J:r2=\Ec\E[?3l\E[2;0y:rc=\E8:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[5m:sr=\ET:st=\E1:ta=^I:ue=\E[m:\ - :up=\EA:us=\E[4m: - -# Terminfo entry for the AT&T 510 A Personal Terminal -# Function keys 9 - 16 are available only after the -# screen labeled (soft keys/action blocks) are labeled. Function key -# 9 corresponds to the leftmost touch target on the screen, -# function key 16 corresponds to the rightmost. -# -# This entry is based on one done by Ernie Rice at Summit, NJ and -# changed by Anne Gallup, Skokie, IL, ttrdc!anne -# (untranslatable capabilities removed to fit entry within 1023 bytes) -att510a|bct510a|AT&T 510A Personal Terminal:\ - :am:mi:ms:xn:xo:\ - :Nl#8:co#80:lh#2:li#24:lw#7:\ - :#4=\E[u:%i=\E[v:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:\ - :F1=\EOe:F2=\EOf:F3=\EOg:F4=\EOh:F5=\EOi:F6=\EOj:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:\ - :ac=+g\054h-f.e`bhrisjjkkllmmnnqqttuuvvwwxx{{||}}~~:\ - :ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[0J:\ - :ce=\E[0K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:\ - :dc=\E[P:dl=\E[M:do=\E[1B:eA=\E(B\E)1:ff=^L:ho=\E[H:\ - :i1=\E(B\E)1\E[2l:i2=\E[21;1|\212:k1=\EOm:k2=\EOV:\ - :k3=\EOu:k4=\ENj:k5=\ENe:k6=\ENf:k7=\ENh:k8=\E[H:k9=\EOc:\ - :k;=\EOd:kB=\E[Z:kF=\E[S:kR=\E[T:kb=^H:kd=\E[B:ke=\E[19;0|:\ - :kl=\E[D:kr=\E[C:ks=\E[19;1|:ku=\E[A:le=^H:mb=\E[5m:\ - :md=\E[2;7m:me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:nw=\EE:\ - :pf=\E[?8i:po=\E[?4i:ps=\E[0i:rc=\E8:sc=\E7:se=\E[m:sf=^J:\ - :so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:\ - :ve=\E[11;3|:vi=\E[11;0|:vs=\E[11;2|: - -# Terminfo entry for the AT&T 510 D Personal Terminal -# Function keys 9 through 16 are accessed by bringing up the -# system blocks. -# Function key 9 corresponds to the leftmost touch target on the screen, -# function key 16 corresponds to the rightmost. -# -# There are problems with soft key labeling. These are due to -# strangenesses in the native terminal that are impossible to -# describe in a terminfo. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att510d|bct510d|AT&T 510D Personal Terminal:\ - :am:da:db:mi:ms:xn:xo:\ - :co#80:li#24:lm#48:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=^O:\ - :al=\E[L:as=^N:bl=^G:bt=\E[Z:cd=\E[0J:ce=\E[0K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[1B:\ - :ei=\E[4l:ff=^L:ho=\E[H:i1=\E(B\E)1\E[5;0|:\ - :i2=\E[21;1|\212:im=\E[4h:k1=\EOm:k2=\EOV:k3=\EOu:k4=\ENj:\ - :k5=\ENe:k6=\ENf:k7=\ENh:k8=\E[H:k9=\EOc:kb=^H:kd=\E[B:\ - :ke=\E[19;0|:kl=\E[D:kr=\E[C:ks=\E[19;1|:ku=\E[A:le=^H:\ - :ll=\E#2:mb=\E[5m:md=\E[2;7m:me=\E[m\017:mh=\E[2m:\ - :mr=\E[7m:nd=\E[C:nw=\EE:rc=\E8:sc=\E7:se=\E[m:sf=^J:\ - :so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:\ - :ve=\E[11;3|:vs=\E[11;2|: - -# (att500: I merged this with the att513 entry, att500 just used att513 -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att500|att513|AT&T 513 using page mode:\ - :am:mi:ms:xn:xo:\ - :co#80:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dE:SR=\E[%dF:UP=\E[%dA:ae=^O:\ - :al=\E[L:as=^N:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=%i\E[%d;%dr:ct=\E[3g:dc=\E[P:\ - :dl=\E[M:do=^J:ei=\E[4l:ho=\E[H:\ - :i1=\E?\E[3;3|\E[10;0|\E[21;1|\212\E[6;1|\E[1{\E[?99l:\ - :im=\E[4h:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:\ - :k7=\EOi:k8=\EOj:kD=\ENf:kI=\ENj:kN=\E[U:kP=\E[V:kb=^H:\ - :kd=\E[B:ke=\E[19;0|\E[21;1|\212:kh=\E[H:kl=\E[D:kr=\E[C:\ - :ks=\E[19;1|\E[21;4|\Eent:ku=\E[A:le=^H:ll=\E#2:mb=\E[5m:\ - :md=\E[2;7m:me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:nw=\EE:\ - :rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[m:up=\E[A:us=\E[4m:ve=\E[11;0|:vs=\E[11;1|: - -# 01-07-88 -# printer must be set to EMUL ANSI to accept ESC codes -# :up: stops at top margin -# :i1: sets cpi 10,lpi 6,form 66,left 1,right 132,top 1,bottom 66,font -# and alt font ascii,wrap on,tabs cleared -# :is: disables newline on LF,Emphasized off -# The capability sets form length -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att5310|att5320|AT&T Model 53210 or 5320 matrix printer:\ - :co#132:it#8:li#66:\ - :DO=\E[%de:RI=\E[%da:cr=^M:do=^J:ff=^L:i1=\Ec:is=\E[20l\r:\ - :nd= :ta=^I:up=\EM: - -# Teletype 5620, firmware version 1.1 (8;7;3) or earlier from BRL -# The following SET-UP modes are assumed for normal operation: -# CR_DEF=CR NL_DEF=INDEX DUPLEX=FULL -# Other SET-UP modes may be set for operator convenience or communication -# requirements. This termcap description is for the Resident Terminal Mode. -# No delays specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -# The BRL entry also said: UNSAFE :ll=\E[70H: -att5620-1|tty5620-1|dmd1|Teletype 5620 with old ROMs:\ - :am:xo:\ - :co#88:it#8:li#70:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:SF=\E[%dS:\ - :SR=\E[%dT:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:do=^J:ei=:ho=\E[H:\ - :ic=\E[@:im=:kC=\E[2J:kH=\E[70;1H:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:nd=\E[C:nw=^M^J:r1=\Ec:\ - :rc=\E8:sc=\E7:sf=^J:sr=\E[T:ta=^I:up=\E[A: - -# 5620 terminfo (2.0 or later ROMS with char attributes) -# The following SET-UP modes are assumed for normal operation: -# DUPLEX=FULL GEN_FLOW=ON NEWLINE=INDEX RETURN=CR -# Other SET-UP modes may be set for operator convenience or communication -# requirements. This termcap description is for Resident Terminal Mode. No -# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -# assumptions: :sf: (scroll forward one line) is only done at screen bottom -# Be aware that older versions of the dmd have a firmware bug that affects -# parameter defaulting; for this terminal, the 0 in \E[0m is not optional. -# :ms: is from an otherwise inferior BRL for this terminal. That entry -# also has :ll:=\E[70H commented out and marked unsafe. -# For more, see the 5620 FAQ maintained by David Breneman . -att5620|dmd|tty5620|ttydmd|5620|5620 terminal 88 columns:\ - :NL:NP:am:bs:ms:xo:\ - :co#88:it#8:li#70:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:SF=\E[%dS:\ - :SR=\E[%dT:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:do=\E[B:ei=:ho=\E[H:\ - :ic=\E[@:im=:kC=\E[2J:kH=\E[70;1H:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:md=\E[2m:me=\E[0m:mh=\E[2m:\ - :mr=\E[7m:nd=\E[C:nw=^J:..px=\E[%p1%d;%p2%l%dq%p2%s:\ - :r1=\Ec:rc=\E8:sc=\E7:se=\E[0m:sf=\E[S:so=\E[7m:sr=\E[T:\ - :ta=^I:ue=\E[0m:up=\E[A:us=\E[4m: -att5620-24|tty5620-24|dmd-24|teletype dmd 5620 in a 24x80 layer:\ - :li#24:tc=att5620: -att5620-34|tty5620-34|dmd-34|teletype dmd 5620 in a 34x80 layer:\ - :li#34:tc=att5620: -# 5620 layer running the "S" system's downloaded graphics handler: -att5620-s|tty5620-s|layer|vitty|5620 S layer:\ - :am:bs:pt:\ - :co#80:it#8:li#72:\ - :al=\EI:bl=^G:ce=\EK:cl=^L:cm=\EY%r%+ %+ :cr=^M:dl=\ED:\ - :do=^J:kC=\E[2J:kH=\E[70;1H:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=^H:sf=^J:ta=^I:up=^K:vb=\E^G: - -# Entries for thru refer to the shifted system pf keys. -# -# Entries for thru refer to the alternate keypad mode -# keys: = * / + 7 8 9 - 4 5 6 , 1 2 3 0 . ENTER -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att605|AT&T 605 80 column 102key keyboard:\ - :am:eo:xo:\ - :co#80:li#24:ws#80:\ - :DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:ae=^O:al=\E[L:as=\E)0\016:\ - :bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :cr=^M:dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:fs=\E8:\ - :i1=\E[8;0|\E[?\E[13;20l\E[?\E[12h:ic=\E[@:im=\E[4h:\ - :is=\E[m\017:k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:\ - :k6=\EOh:k7=\EOi:k8=\EOj:k9=\ENo:kD=\E[P:kI=\E[@:kN=\E[U:\ - :kP=\E[V:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=^H:ll=\E[24H:mb=\E[5m:md=\E[1m:me=\E[m\017:mh=\E[2m:\ - :mr=\E[7m:nd=\E[C:nw=\EE:rc=\E8:sc=\E7:se=\E[m:sf=^J:\ - :so=\E[7m:ta=^I:ts=\E7\E[25;%i%p1%dx:ue=\E[m:up=\E[A:\ - :us=\E[4m: -att605-pc|ATT 605 in pc term mode:\ - :@7=\E[F:AL=\E[L:S4=250\E[?11l\E[50;1|:S5=400\E[50;0|:\ - :XF=g:XN=e:\ - :ac=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263:\ - :al=\E[L:bt=\E[Z:dc=\E[P:dl=\E[M:do=\E[B:ei=:ic=\E[@:im=:\ - :k1=\E[M:k2=\E[N:k3=\E[O:k4=\E[P:k5=\E[Q:k6=\E[R:k7=\E[S:\ - :k8=\E[T:k9=\E[U:k;=\E[V:kB=\E[Z:kD=\E[P:kI=\E[@:kL=\E[M:\ - :kN=\E[G:kP=\E[I:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=\E[D:nd=\E[C:up=\E[A:\ - :tc=att605: -att605-w|AT&T 605-w 132 column 102 key keyboard:\ - :co#132:ws#132:\ - :i1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h\E(B\E)0:tc=att605: -# (att610: I added / based on the init string. I also -# added :SF: and :SR: because the BSD file says the att615s have them, -# and the 615 is like a 610 with a big keyboard, and most of their other -# smart terminals support the same sequence -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att610|AT&T 610; 80 column; 98key keyboard:\ - :am:es:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ae=^O:\ - :al=\E[L:as=^N:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:\ - :do=\E[B:ei=\E[4l:fs=\E8:ho=\E[H:\ - :i1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0:\ - :i2=\E(B\E)0:im=\E[4h:is=\E[m\017:k1=\EOc:k2=\EOd:k3=\EOe:\ - :k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:k9=\ENo:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:ll=\E[24H:\ - :mb=\E[5m:md=\E[1m:me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:\ - :nw=\EE:rc=\E8:sc=\E7:se=\E[m:sf=\ED:so=\E[7m:sr=\EM:ta=^I:\ - :ts=\E7\E[25;%i%p1%dx:ue=\E[m:up=\E[A:us=\E[4m:\ - :vb=\E[?5h\E[?5l:ve=\E[?25h\E[?12l:vi=\E[?25l:\ - :vs=\E[?12;25h: -att610-w|AT&T 610; 132 column; 98key keyboard:\ - :co#132:ws#132:\ - :i1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h:tc=att610: - -att610-103k|AT&T 610; 80 column; 103key keyboard:\ - :!1=\EOO:!2=\EOP:!3=\EOS:#1=\EOM:%0=\EOt:%1=\EOm:%2=\ENi:\ - :%3=\EOl:%4=\ENc:%5=\ENh:%6=\EOv:%7=\EOr:%8=\ENg:%9=\EOz:\ - :%a=\EOL:%b=\ENC:%c=\ENH:%d=\EOR:%e=\ENG:%f=\EOZ:%g=\EOT:\ - :%h=\EOY:%j=\EOQ:&0=\EOW:&1=\EOb:&2=\ENa:&3=\EOy:&4=\EOB:\ - :&5=\EOq:&6=\EOo:&7=\EOp:&8=\EOs:&9=\ENB:*0=\EOX:*1=\EOU:\ - :*2=\END:*3=\EON:*4=\ENF:*5=\ENE:*6=\ENI:*7=\ENN:*8=\EOA:\ - :*9=\EOK:@0=\EOx:@1=\E9:@2=\EOw:@3=\EOV:@4=\EOu:@5=\ENd:\ - :@6=\EOn:@7=\E0:@8=^M:@9=\EOk:F1@:F2@:F3@:F4@:k9@:k;@:kD=\ENf:\ - :kE=\EOa:kI=\ENj:kL=\ENe:kM=\ENj:kN=\E[U:kP=\E[V:\ - :tc=att610: -att610-103k-w|AT&T 610; 132 column; 103key keyboard:\ - :co#132:ws#132:\ - :i1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h:tc=att610-103k: -att615|AT&T 615; 80 column; 98key keyboard:\ - :#4=\E[ A:%i=\E[ @:F5=\EOC:F6=\EOD:F7=\EOE:F8=\EOF:F9=\EOG:\ - :FA=\EOH:FB=\EOI:FC=\EOJ:FD=\ENO:FE=\ENP:FF=\ENQ:FG=\ENR:\ - :FH=\ENS:FI=\ENT:FJ=\EOP:FK=\EOQ:FL=\EOR:FM=\EOS:FN=\EOw:\ - :FO=\EOx:FP=\EOy:FQ=\EOm:FR=\EOt:FS=\EOu:FT=\EOv:FU=\EOl:\ - :FV=\EOq:FW=\EOr:FX=\EOs:FY=\EOp:FZ=\EOn:Fa=\EOM:\ - :tc=att610: -att615-w|AT&T 615; 132 column; 98key keyboard:\ - :#4=\E[ A:%i=\E[ @:F5=\EOC:F6=\EOD:F7=\EOE:F8=\EOF:F9=\EOG:\ - :FA=\EOH:FB=\EOI:FC=\EOJ:FD=\ENO:FE=\ENP:FF=\ENQ:FG=\ENR:\ - :FH=\ENS:FI=\ENT:FJ=\EOP:FK=\EOQ:FL=\EOR:FM=\EOS:FN=\EOw:\ - :FO=\EOx:FP=\EOy:FQ=\EOm:FR=\EOt:FS=\EOu:FT=\EOv:FU=\EOl:\ - :FV=\EOq:FW=\EOr:FX=\EOs:FY=\EOp:FZ=\EOn:Fa=\EOM:\ - :tc=att610-w: -att615-103k|AT&T 615; 80 column; 103key keyboard:\ - :#4=\E[ A:%i=\E[ @:\ - :tc=att610-103k: -att615-103k-w|AT&T 615; 132 column; 103key keyboard:\ - :#4=\E[ A:%i=\E[ @:\ - :tc=att610-103k-w: -# (att620: I added / based on the init string and -# :SR:/:SF: from a BSD termcap -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att620|AT&T 620; 80 column; 98key keyboard:\ - :am:es:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ - :ae=\E(B\017:al=\E[L:as=\E)0\016:bl=^G:bt=\E[Z:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:fs=\E8:ho=\E[H:\ - :i1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h:\ - :i2=\E(B\E)0:im=\E[4h:is=\E[m\017:k1=\EOc:k2=\EOd:k3=\EOe:\ - :k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:k9=\ENo:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:ll=\E[24H:\ - :mb=\E[5m:md=\E[1m:me=\E[m\E(B\017:mh=\E[2m:mr=\E[7m:\ - :nd=\E[C:nw=\EE:rc=\E8:sc=\E7:se=\E[m:sf=\ED:so=\E[7m:\ - :sr=\EM:ta=^I:ts=\E7\E[25;%i%p1%dx:ue=\E[m:up=\E[A:\ - :us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h\E[?12l:vi=\E[?25l:\ - :vs=\E[?12;25h: -att620-w|AT&T 620; 132 column; 98key keyboard:\ - :co#132:ws#132:\ - :i1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h:tc=att620: -att620-103k|AT&T 620; 80 column; 103key keyboard:\ - :!1=\EOO:!2=\EOP:!3=\EOS:#1=\EOM:%0=\EOt:%1=\EOm:%2=\ENi:\ - :%3=\EOl:%4=\ENc:%5=\ENh:%6=\EOv:%7=\EOr:%8=\ENg:%9=\EOz:\ - :%a=\EOL:%b=\ENC:%c=\ENH:%d=\EOR:%e=\ENG:%f=\EOZ:%g=\EOT:\ - :%h=\EOY:%j=\EOQ:&0=\EOW:&1=\EOb:&2=\ENa:&3=\EOy:&4=\EOB:\ - :&5=\EOq:&6=\EOo:&7=\EOp:&8=\EOs:&9=\ENB:*0=\EOX:*1=\EOU:\ - :*2=\END:*3=\EON:*4=\ENF:*5=\ENE:*6=\ENI:*7=\ENN:*8=\EOA:\ - :*9=\EOK:@0=\EOx:@1=\E9:@2=\EOw:@3=\EOV:@4=\EOu:@5=\ENd:\ - :@6=\EOn:@7=\E0:@8=^M:@9=\EOk:F1@:F2@:F3@:F4@:F5@:F6@:F7@:F8@:\ - :F9@:FA@:FB@:FC@:FD@:FE@:FF@:FG@:FH@:FI@:FJ@:FK@:FL@:FM@:FN@:FO@:FP@:\ - :FQ@:FR@:FS@:FT@:FU@:FV@:FW@:FX@:FY@:FZ@:Fa@:k9@:k;@:kD=\ENf:\ - :kE=\EOa:kI=\ENj:kL=\ENe:kM=\ENj:kN=\E[U:kP=\E[V:\ - :tc=att620: - -att620-103k-w|AT&T 620; 132 column; 103key keyboard:\ - :co#132:ws#132:\ - :i1=\E[8;0|\E[?4;5;13;15l\E[13;20l\E[?3;7h\E[12h:tc=att620-103k: - -# AT&T (formerly Teletype) 630 Multi-Tasking Graphics terminal -# The following SETUP modes are assumed for normal operation: -# Local_Echo=Off Gen_Flow=On Return=CR Received_Newline=LF -# Font_Size=Large Non-Layers_Window_Cols=80 -# Non-Layers_Window_Rows=60 -# Other SETUP modes may be set for operator convenience or communication -# requirements. Some capabilities assume a printer attached to the Aux EIA -# port. This termcap description is for the Fixed Non-Layers Window. No -# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -# (att630: added :ic:, :mb: and :mh: from a BSD termcap file -- esr) -att630|AT&T 630 windowing terminal:\ - :NP:am:bs:da:db:mi:ms:xo:\ - :co#80:it#8:li#60:lm#0:\ - :@8=^M:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\ENq:\ - :F2=\ENr:F3=\ENs:F4=\ENt:F5=\ENu:F6=\ENv:F7=\ENw:F8=\ENx:\ - :F9=\ENy:FA=\ENz:FB=\EN{:FC=\EN|:FD=\EN}:FE=\EN~:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ - :al=\E[L:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:do=\E[B:\ - :ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:is=\E[m:k9=\ENo:k;=\ENp:\ - :kA=\E[L:kB=\E[Z:kC=\E[2J:kD=\E[P:kI=\E[@:kL=\E[M:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:\ - :me=\E[m:mh=\E[2m:mr=\E[7m:nd=\E[C:nw=^M^J:pf=\E[?4i:\ - :po=\E[?5i:..px=\E[%p1%d;%p2%l%dq%p2%s:r2=\Ec:rc=\E8:\ - :..sa=\E[0%?%p2%t;4%;%?%p1%p3%|%p4%|%p5%|%t;7%;m:\ - :sc=\E7:se=\E[m:sf=\ED:so=\E[7m:sr=\EM:ta=^I:ue=\E[m:\ - :up=\E[A:us=\E[4m: -att630-24|5630-24|5630DMD-24|630MTG-24|AT&T 630 windowing terminal 24 lines:\ - :li#24:tc=att630: - -# This is the att700 entry for 700 native emulation of the AT&T 700 -# terminal. Comments are relative to changes from the 605V2 entry and -# att730 on which the entry is based. Comments show the terminfo -# capability name, termcap name, and description. -# -# Here is what's going onm in the init string: -# ESC [ 50;4| set 700 native mode (really is 605) -# x ESC [ 56;ps| set lines to 24: ps=0; 40: ps=1 (plus status line) -# ESC [ 53;0| set GenFlow to Xon/Xoff -# ESC [ 8 ;0| set CR on NL -# x ESC [ ? 3 l/h set workspace: 80 col(l); 132 col(h) -# ESC [ ? 4 l jump scroll -# ESC [ ? 5 l/h video: normal (l); reverse (h) -# ESC [ ?13 l Labels on -# ESC [ ?15 l parity check = no -# ESC [ 13 l monitor mode off -# ESC [ 20 l LF on NL (not CRLF on NL) -# ESC [ ? 7 h autowrap on -# ESC [ 12 h local echo off -# ESC ( B GO = ASCII -# ESC ) 0 G1 = Special Char & Line Drawing -# ESC [ ? 31 l Set 7 bit controls -# -# Note: Most terminals, especially the 600 family use Reverse Video for -# standout mode. DEC also uses reverse video. The VT100 uses bold in addition -# Assume we should stay with reverse video for 70.. However, the 605V2 exits -# standout mode with \E[m (all normal attributes). The 730 entry simply -# exits reverse video which would leave other current attributes intact. It -# was assumed the 730 entry to be more correct so rmso has changed. The -# 605V2 has no sequences to turn individual attributes off, thus its setting -# and the rmso/smso settings from the 730. -# -# Note: For the same reason as above in rmso I changed exit under-score mode -# to specifically turn off underscore, rather than return to all normal -# attributes -# -# Note: The following pkey_xmit is taken from the 605V2 which contained the -# capability as pfxl. It was changed here to pfx since pfxl -# will only compile successfully with Unix 4.0 tic. Also note that pfx only -# allows strings to be parameters and label values must be programmed as -# constant strings. Supposedly the pfxl of Version 4.0 allows both labels -# and strings to be parameters. The 605V2 pfx entry should be examined later -# in this regard. For reference the 730 pfxl entry is shown here for comparison -# 730 pfx entry: -# pfxl=\E[%?%p1%{25}%<%t%p1%e%p1%{24}%-%;%d;%p2%l%02d%?%p1%{25}%<%tq\s\s\s -# SYS\s\s\s\s\sF%p1%:-2d\s\s%e;0;3q%;%p2%s, -# -# (for 4.0 tic) -# pfxl=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, -# -# (for <4.0 tic) -# pfx=\E[%p1%d;%p2%l%02dq%?%p1%{9}%<%t F%p1%1d %;%p2%s, -# -# From the AT&T 705 Multi-tasking terminal user's guide Page 8-8,8-9 -# -# Port1 Interface -# -# modular 10 pin Connector -# Left side Right side -# Pin 1 2 3 4 5 6 7 8 9 10 -# -# Key (notch) at bottom -# -# Pin 1 DSR -# 3 DCD -# 4 DTR -# 5 Sig Ground -# 6 RD -# 7 SD -# 8 CTS -# 9 RTS -# 10 Frame Ground -# -# The manual is 189 pages and is loaded with details about the escape codes, -# etc..... Available from AT&T CIC 800-432-6600... -# ask for Document number 999-300-660.. -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att700|AT&T 700 24x80 column display w/102key keyboard:\ - :am:es:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:\ - :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:\ - :fs=\E8:ho=\E[H:i2=\E(B\E)0:im=\E[4h:\ - :is=\E[50;4|\E[53;0|\E[8;0|\E[?4;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)0\E[?31l\E[0m\017:\ - :k1=\EOc:k2=\EOd:k3=\EOe:k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:\ - :k8=\EOj:k9=\ENo:kD=\E[P:kI=\E[@:kN=\E[U:kP=\E[V:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:ll=\E[24H:\ - :mb=\E[5m:md=\E[1m:me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:\ - :nw=\EE:rc=\E8:sc=\E7:se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:\ - :st=\EH:ta=^I:ts=\E7\E[99;%i%p1%dx:ue=\E[24m:up=\E[A:\ - :us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[?25h\E[?12l:vi=\E[?25l:\ - :vs=\E[?12;25h: - -# This entry was modified 3/13/90 by JWE. -# fixes include additions of , correcting :rp:, and modification -# of . (See comments below) -# att730 has status line of 80 chars -# These were commented out: :SF=\E[%p1%dS:, :SR=\E[%p1%dT:, -# the and up keys are used for shifted system Fkeys -# NOTE: JWE 3/13/90 The 98 key keyboard translation for shift/HOME is -# currently the same as :kh: (unshifted HOME or \E[H). On the 102, 102+1 -# and 122 key keyboards, the 730's translation is \E[2J. For consistency -# has been commented out. The user can uncomment if using the -# 102, 102+1, or 122 key keyboards -# kHOM=\E[2J, -# (att730: I added / based on the init string -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -att730|AT&T 730 windowing terminal:\ - :am:da:db:es:hs:mi:ms:xn:xo:\ - :co#80:it#8:li#60:lm#0:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:\ - :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:fs=\E8:\ - :ho=\E[H:\ - :i1=\E[8;0|\E[?3;4;5;13;15l\E[13;20l\E[?7h\E[12h\E(B\E)B:\ - :i2=\E(B\E)0:im=\E[4h:is=\E[m\017:k1=\EOc:k2=\EOd:k3=\EOe:\ - :k4=\EOf:k5=\EOg:k6=\EOh:k7=\EOi:k8=\EOj:k9=\ENo:kI=\E[@:\ - :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m\017:mh=\E[2m:mr=\E[7m:nd=\E[C:\ - :nw=\EE:rc=\E8:sc=\E7:se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:\ - :ta=^I:ts=\E7\E[;%i%p1%dx:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=\E[?5h\E[?5l:ve=\E[?25h\E[?12l:vi=\E[?25l:\ - :vs=\E[?12;25h: -att730-41|730MTG-41|AT&T 730-41 windowing terminal Version:\ - :li#41:tc=att730: -att730-24|730MTG-24|AT&T 730-24 windowing terminal Version:\ - :li#24:tc=att730: -att730r|730MTGr|AT&T 730 rev video windowing terminal Version:\ - :i1=\E[8;0|\E[?3;4;13;15l\E[?5h\E[13;20l\E[?7h\E[12h\E(B\E)B:\ - :vb=\E[?5l\E[?5h:\ - :tc=att730: -att730r-41|730MTG-41r|AT&T 730r-41 rev video windowing terminal Version:\ - :li#41:tc=att730r: -att730r-24|730MTGr-24|AT&T 730r-24 rev video windowing terminal Version:\ - :li#24:tc=att730r: - -# The following represents the screen layout along with the associated -# bezel buttons for the 5430/pt505 terminal. The "kf" designations do -# not appear on the screen but are shown to reference the bezel buttons. -# The "CMD", "MAIL", and "REDRAW" buttons are shown in their approximate -# position relative to the screen. -# -# -# -# +----------------------------------------------------------------+ -# | | -# XXXX | kf0 kf24 | XXXX -# | | -# | | -# XXXX | kf1 kf23 | XXXX -# | | -# | | -# XXXX | kf2 kf22 | XXXX -# | | -# | | -# XXXX | kf3 kf21 | XXXX -# | | -# | | -# XXXX | kf4 kf20 | XXXX -# | | -# | | -# XXXX | kf5 kf19 | XXXX -# | | -# | | -# XXXX | kf6 kf18 | XXXX -# | | -# | | -# XXXX | | XXXX -# | | -# | | -# +----------------------------------------------------------------+ -# -# XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX XXXX -# -# Note: XXXX represents the screen buttons -# CMD REDRAW -# -# MAIL -# -# version 1 note: -# The character string sent by key 'kf26' may be user programmable -# to send either \E[16s, or \E[26s. -# The character string sent by key 'krfr' may be user programmable -# to send either \E[17s, or \E[27s. -# -# Depression of the "CMD" key sends \E! (kcmd) -# Depression of the "MAIL" key sends \E[26s (kf26) -# "REDRAW" same as "REFRESH" (krfr) -# -# "kf" functions adds carriage return to output string if terminal is in -# 'new line' mode. -# -# The following are functions not covered in the table above: -# -# Set keyboard character (SKC): \EPn1;Pn2w -# Pn1= 0 Back Space key -# Pn1= 1 Break key -# Pn2= Program char (hex) -# -# Screen Definition (SDF): \E[Pn1;Pn2;Pn3;Pn4;Pn5t -# Pn1= Window number (1-39) -# Pn2-Pn5= Y;X;Y;X coordinates -# -# Screen Selection (SSL): \E[Pnu -# Pn= Window number -# -# Set Terminal Modes (SM): \E[Pnh -# Pn= 3 Graphics mode -# Pn= > Cursor blink -# Pn= < Enter new line mode -# Pn= = Enter reverse insert/replace mode -# Pn= ? Enter no scroll mode -# -# Reset Terminal Mode (RM): \E[Pnl -# Pn= 3 Exit graphics mode -# Pn= > Exit cursor blink -# Pn= < Exit new line mode -# Pn= = Exit reverse insert/replace mode -# Pn= ? Exit no scroll mode -# -# Screen Status Report (SSR): \E[Pnp -# Pn= 0 Request current window number -# Pn= 1 Request current window dimensions -# -# Device Status Report (DSR): \E[6n Request cursor position -# -# Call Status Report (CSR): \E[Pnv -# Pn= 0 Call failed -# Pn= 1 Call successful -# -# Transparent Button String (TBS): \E[Pn1;Pn2;Pn3;{string -# Pn1= Button number to be loaded -# Pn2= Character count of "string" -# Pn3= Key mode being loaded: -# 0= Unshifted -# 1= Shifted -# 2= Control -# String= Text string (15 chars max) -# -# Screen Number Report (SNR): \E[Pnp -# Pn= Screen number -# -# Screen Dimension Report (SDR): \E[Pn1;Pn2r -# Pn1= Number of rows available in window -# Pn2= Number of columns available in window -# -# Cursor Position Report (CPR): \E[Pn1;Pn2R -# Pn1= "Y" Position of cursor -# Pn2= "X" Position of cursor -# -# Request Answer Back (RAB): \E[c -# -# Answer Back Response (ABR): \E[?;*;30;VSV -# *= 0 No printer available -# *= 2 Printer available -# V= Software version number -# SV= Software sub version number -# (printer-available field not documented in v1) -# -# Screen Alignment Aid: \En -# -# Bell (lower pitch): \E[x -# -# Dial Phone Number: \EPdstring\ -# string= Phone number to be dialed -# -# Set Phone Labels: \EPpstring\ -# string= Label for phone buttons -# -# Set Clock: \EPchour;minute;second\ -# -# Position Clock: \EPsY;X\ -# Y= "Y" coordinate -# X= "X" coordinate -# -# Delete Clock: \Epr\ -# -# Programming The Function Buttons: \EPfPn;string\ -# Pn= Button number (00-06, 18-24) -# (kf00-kf06, kf18-kf24) -# string= Text to sent on button depression -# -# The following in version 2 only: -# -# Request For Local Directory Data: \EPp12;\ -# -# Local Directory Data to host: \EPp11;LOCAL...DIRECTORY...DATA\ -# -# Request for Local Directory Data in print format: \EPp13;\ -# -# Enable 'Prt on Line' mode: \022 (DC2) -# -# Disable 'Prt on Line' mode: \024 (DC4) -# - -# 05-Aug-86: -# The following Terminfo entry describes functions which are supported by -# the AT&T 5430/pt505 terminal software version 2 and later. -att505|pt505|att5430|gs5430|AT&T Personal Terminal 505 or 5430 GETSET terminal:\ - :am:xo:\ - :co#80:it#8:li#24:\ - :&2=\E[27s:@4=\E\041:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\ - :DO=\E[%dB:F8=\E[18s:F9=\E[19s:FA=\E[20s:FB=\E[21s:\ - :FC=\E[22s:FD=\E[23s:FE=\E24s:FG=\E26s:LE=\E[%dD:\ - :RA=\E[11;1j:RI=\E[%dC:SA=\E[11;0j:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\E[10m:al=\E[L:as=\E[11m:bl=^G:cb=\E2K:cd=\E[0J:\ - :ce=\E[0K:cl=\E[2J\E[H:cm=\E[%d;%dH:cr=^M:dc=\E[P:dl=\E[M:\ - :do=\E[B:ei=\E[4l:ho=\E[H:\ - :i1=\EPr\E[0u\E[2J\E[0;0H\E[m\E[3l\E[l\E[=l\E[?l:\ - :im=\E[4h:k0=\E[00s:k1=\E[01s:k2=\E[02s:k3=\E[03s:\ - :k4=\E[04s:k5=\E[05s:k6=\E[06s:kb=^H:kd=\E[B:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=\E[D:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:pf=\E[4i:po=\E[5i:r1=\Ec:rc=\E8:sc=\E7:\ - :se=\E[m:sf=^J:so=\E[1m:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:\ - :ve=\E[>l:vs=\E[>h: - -# The following Terminfo entry describes functions which are supported by -# the AT&T 5430/pt505 terminal software version 1. -att505-24|pt505-24|gs5430-24|AT&T PT505 or 5430 GETSET version 1 24 lines:\ - :li#24:\ - :RA@:SA@:pf@:po@:rc@:sc@:tc=att505: -tt505-22|pt505-22|gs5430-22|AT&T PT505 or 5430 GETSET version 1 22 lines:\ - :li#22:tc=att505: - -#### Ampex (Dialogue) -# -# Yes, these are the same people who are better-known for making audio- and -# videotape. I'm told they are located in Redwood City, CA. -# - -# From: Fri Sep 11 22:38:32 1981 -# (ampex80: some capabilities merged in from SCO's entry -- esr) -ampex80|a80|d80|dialogue|dialogue80|ampex dialogue 80:\ - :am:bs:bw:ul:\ - :co#80:it#8:li#24:\ - :al=\EE:bl=^G:bt=\EI:cd=\Ey:ce=\Et:cl=\E*:cm=\E=%+ %+ :\ - :cr=^M:ct=\E3:dc=\EW:dl=\ER:do=^J:ei=:ic=\EQ:im=:is=\EA:le=^H:\ - :nd=^L:se=\Ek:sf=^J:so=\Ej:st=\E1:ta=^I:ue=\Em:up=^K:us=\El: -# This entry was from somebody anonymous, Tue Aug 9 20:11:37 1983, who wrote: -ampex175|ampex d175:\ - :am:\ - :co#80:li#24:\ - :al=\EE:bl=^G:cd=\Ey:ce=\Et:cl=\E+:cm=\E=%+ %+ :cr=^M:\ - :dc=\EW:dl=\ER:do=^J:ei=:ho=^^:ic=\EQ:im=:is=\EX\EA\EF:\ - :kA=\EE:kD=\EW:kI=\EQ:kL=\ER:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:\ - :le=^H:ll=^^^K:nd=^L:se=\Ek:sf=^J:so=\Ej:te=\EF:ti=\EN:\ - :ue=\Em:up=^K:us=\El: -# No backspace key in the main QWERTY cluster. Fortunately, it has a -# NEWLINE/PAGE key just above RETURN that sends a strange single-character -# code. Given a suitable Unix (one that lets you set an echo-erase-as-BS-SP-BS -# mode), this key can be used as the erase key; I find I like this. Because -# some people and some systems may not, there is another termcap ("ampex175") -# that suppresses this little eccentricity by omitting the relevant capability. -ampex175-b|ampex d175 using left arrow for erase:\ - :kb=^_:\ - :tc=ampex175: -# From: Richard Bascove -# (ampex210: removed obsolete ":kn#10:" -- esr) -ampex210|a210|ampex a210:\ - :am:bs:hs:xn:\ - :co#80:it#8:li#24:sg#1:\ - :al=\EE:bt=\EI:cd=\Ey:ce=\Et:cl=\E*:cm=\E=%+ %+ :dc=\EW:\ - :dl=\ER:ei=:fs=\E.2:ho=^^:ic=\EQ:if=/usr/share/tabset/std:\ - :im=:is=\EC\Eu\E'\E(\El\EA\E%\E{\E.2\EG0\Ed\En:\ - :k0=^A0\r:k1=^A1\r:k2=^A2\r:k3=^A3\r:k4=^A4\r:k5=^A5\r:\ - :k6=^A6\r:k7=^A7\r:k8=^A8\r:k9=^A9\r:kd=^V:kh=^^:kl=^H:\ - :kr=^L:ku=^K:le=^H:mk@:nd=^L:ta=^I:ts=\E.0\Eg\E}\Ef:up=^K:\ - :vb=\EU\EX\EU\EX\EU\EX\EU\EX:\ - :tc=adm+sgr: -# (ampex219: I added / based on the init string, added :vs: -# from ampex219w, added :ve:=\E[?3l, irresistibly suggested by :vs:, -# and moved the padding to be *after* the caps -- esr) -ampex219|ampex-219|amp219|Ampex with Automargins:\ - :hs:xn:\ - :co#80:it#8:li#24:\ - :RA=\E[?7l:SA=\E[?7h:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=%i\E[%2;%2r:\ - :do=\E[B:ho=\E[H:\ - :is=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:k0=\E[21~:\ - :k1=\E[7~:k2=\E[8~:k3=\E[9~:k4=\E[10~:k5=\E[11~:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:k9=\E[20~:kd=\E[B:ke=\E>:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:\ - :me=\E[m:mh=\E[1m:mr=\E[7m:nd=\E[C:se=\E[m:sf=^J:so=\E[7m:\ - :sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:ve=\E[?3l:vs=\E[?3h: -ampex219w|ampex-219w|amp219w|Ampex 132 cols:\ - :co#132:li#24:\ - :bl=^G:cr=^M:do=^J:is=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h:\ - :sf=^J:\ - :tc=ampex219: -# (ampex232: removed :if=/usr/share/tabset/ampex:, no file and no :st: --esr) -ampex232|ampex-232|Ampex Model 232:\ - :am:\ - :co#80:li#24:sg#1:\ - :al=5*\EE:bt=\EI:cd=\EY:ce=\ET:cl=\E+:cm=\E=%+ %+ :dc=\EW:\ - :dl=5*\ER:do=^V:ei=:ic=\EQ:im=:is=\Eg\El:k0=^A@\r:k1=^AA\r:\ - :k2=^AB\r:k3=^AC\r:k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:\ - :k8=^AH\r:k9=^AI\r:kb=^H:kd=^V:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:\ - :mk@:nd=^L:ta=^I:up=^K:vb=\Eb\Ed:ve=\E.4:vi=\E.0:\ - :tc=adm+sgr: -# (ampex: removed :if=/usr/share/tabset/amp-132:, no file and no :st: -- esr) -ampex232w|Ampex Model 232 / 132 columns:\ - :co#132:li#24:\ - :is=\E\034Eg\El:tc=ampex232: - -#### Ann Arbor (aa) -# -# Ann Arbor made dream terminals for hackers -- large screen sizes and huge -# numbers of function keys. At least some used monitors in portrait mode, -# allowing up to 76-character screen heights! They were reachable at: -# -# Ann Arbor Terminals -# 6175 Jackson Road -# Ann Arbor, MI 48103 -# (313)-663-8000 -# -# But in 1996 the phone number reaches some kitschy retail shop, and Ann Arbor -# can't be found on the Web; I fear they're long dead. R.I.P. -# - - -# Originally from Mike O'Brien@Rand and Howard Katseff at Bell Labs. -# Highly modified 6/22 by Mike O'Brien. -# split out into several for the various screen sizes by dave-yost@rand -# Modifications made 3/82 by Mark Horton -# Modified by Tom Quarles at UCB for greater efficiency and more diversity -# status line moved to top of screen, :vb: removed 5/82 -# Some unknown person at SCO then hacked the init strings to make them more -# efficient. -# -# assumes the following setup: -# A menu: 0000 1010 0001 0000 -# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 -# C menu: 56 66 0 0 9600 0110 1100 -# D menu: 0110 1001 1 0 -# -# Briefly, the settings are for the following modes: -# (values are for bit set/clear with * indicating our preference -# and the value used to test these termcaps) -# Note that many of these settings are irrelevent to the terminfo -# and are just set to the default mode of the terminal as shipped -# by the factory. -# -# A menu: 0000 1010 0001 0000 -# Block/underline cursor* -# blinking/nonblinking cursor* -# key click/no key click* -# bell/no bell at column 72* -# -# key pad is cursor control*/key pad is numeric -# return and line feed/return for :cr: key * -# repeat after .5 sec*/no repeat -# repeat at 25/15 chars per sec. * -# -# hold data until pause pressed/process data unless pause pressed* -# slow scroll/no slow scroll* -# Hold in area/don't hold in area* -# functions keys have default*/function keys disabled on powerup -# -# show/don't show position of cursor during page transmit* -# unused -# unused -# unused -# -# B menu: 9600 0100 1000 0000 0000 1000 0000 17 19 -# Baud rate (9600*) -# -# 2 bits of parity - 00=odd,01=even*,10=space,11=mark -# 1 stop bit*/2 stop bits -# parity error detection off*/on -# -# keyboard local/on line* -# half/full duplex* -# disable/do not disable keyboard after data transmission* -# -# transmit entire page/stop transmission at cursor* -# transfer/do not transfer protected characters* -# transmit all characters/transmit only selected characters* -# transmit all selected areas/transmit only 1 selected area* -# -# transmit/do not transmit line separators to host* -# transmit/do not transmit page tab stops tabs to host* -# transmit/do not transmit column tab stop tabs to host* -# transmit/do not transmit graphics control (underline,inverse..)* -# -# enable*/disable auto XON/XOFF control -# require/do not require receipt of a DC1 from host after each LF* -# pause key acts as a meta key/pause key is pause* -# unused -# -# unused -# unused -# unused -# unused -# -# XON character (17*) -# XOFF character (19*) -# -# C menu: 56 66 0 0 9600 0110 1100 -# number of lines to print data on (printer) (56*) -# -# number of lines on a sheet of paper (printer) (66*) -# -# left margin (printer) (0*) -# -# number of pad chars on new line to printer (0*) -# -# printer baud rate (9600*) -# -# printer parity: 00=odd,01=even*,10=space,11=mark -# printer stop bits: 2*/1 -# print/do not print guarded areas* -# -# new line is: 01=LF,10=CR,11=CRLF* -# unused -# unused -# -# D menu: 0110 1001 1 0 -# LF is newline/LF is down one line, same column* -# wrap to preceding line if move left from col 1*/don't wrap -# wrap to next line if move right from col 80*/don't wrap -# backspace is/is not destructive* -# -# display*/ignore DEL character -# display will not/will scroll* -# page/column tab stops* -# erase everything*/erase unprotected only -# -# editing extent: 0=display,1=line*,2=field,3=area -# -# unused -# - -annarbor4080|aa4080|ann arbor 4080:\ - :am:bs:\ - :co#80:li#40:\ - :bl=^G:cl=\014:\ - :..cm=\017%p2%{10}%/%{16}%*%p2%{10}%m%+%c%p1%?%p1%{19}%>%t%{12}%+%;%{64}%+%c:\ - :cr=^M:ct=^^P^P:do=^J:ho=^K:kb=^^:kd=^J:kh=^K:kl=^H:kr=^_:\ - :ku=^N:le=^H:nd=^_:sf=^J:st=^]^P1:ta=^I:up=^N: - -# Strange Ann Arbor terminal from BRL -aas1901|Ann Arbor K4080 w/S1901 mod:\ - :am:\ - :co#80:li#40:\ - :bl=^G:cl=^L:cr=^M:do=^J:ho=^K:kb=^H:kd=^J:kl=^H:le=^H:\ - :ll=^O\0c:nd=^_:nw=^M^J:sf=^J:ta=^I:up=^N: - -# If you're using the GNU termcap library, add -# :cS=\E[%p1%d;%p2%d;%p3%d;%p4%dp: -# to these capabilities. This is the nonstandard GNU termcap scrolling -# capability, arguments are: -# 1. Total number of lines on the screen. -# 2. Number of lines above desired scroll region. -# 3. Number of lines below (outside of) desired scroll region. -# 4. Total number of lines on the screen, the same as the first parameter. -# The generic Ann Arbor entry is the only one that uses this. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -aaa+unk|aaa-unk|ann arbor ambassador (internal - don't use this directly):\ - :am:bs:km:mi:xo:\ - :co#80:it#8:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :ct=\E[2g:dc=\E[P:dl=\E[M:do=^K:ei=:ho=\E[H:\ - :i1=\E[m\E7\E[H\E9\E8:i2=\E[1Q\E[>20;30l\EP`+x~M\E\:\ - :ic=\E[@:im=:k1=\EOA:k2=\EOB:k3=\EOC:k4=\EOD:k5=\EOE:\ - :k6=\EOF:k7=\EOG:k8=\EOH:k9=\EOI:kD=\E[P:kI=\E[@:kb=^H:\ - :kd=\E[B:\ - :ke=\EP`>y~[[J`8xy~[[A`4xy~[[D`6xy~[[C`2xy~[[B\E\:\ - :kh=\E[H:kl=\E[D:kr=\E[C:\ - :ks=\EP`>z~[[J`8xz~[[A`4xz~[[D`6xz~[[C`2xz~[[B\E\:\ - :ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:mm=\E[>52h:\ - :mo=\E[>52l:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[m:sf=^K:\ - :so=\E[7m:st=\EH:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: - -aaa+rv|ann arbor ambassador in reverse video:\ - :i1=\E[7m\E7\E[H\E9\E8:mb=\E[5;7m:md=\E[1;7m:\ - :me=\E[7m\016:mk=\E[7;8m:mr=\E[m:r1=\E[H\E[7m\E[J:\ - :..sa=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m:\ - :se=\E[7m:so=\E[m:ue=\E[7m:us=\E[4;7m: -# Ambassador with the DEC option, for partial vt100 compatibility. -aaa+dec|ann arbor ambassador in dec vt100 mode:\ - :ac=aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}:\ - :ae=^N:as=^O:cs=\E[%i%d;%dr:eA=\E(0:\ - :..sa=\E[%?%p1%p3%|%!%t7;%;%?%p2%t4;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m%?%p9%t\017%e\016%;: -aaa-18|ann arbor ambassador/18 lines:\ - :li#18:\ - :is=\E7\E[60;0;0;18p\E8:te=\E[60;0;0;18p\E[60;1H\E[K:\ - :ti=\E[18;0;0;18p:\ - :tc=aaa+unk: -aaa-18-rv|ann arbor ambassador/18 lines+reverse video:\ - :tc=aaa+rv:tc=aaa-18: -aaa-20|ann arbor ambassador/20 lines:\ - :li#20:\ - :is=\E7\E[60;0;0;20p\E8:te=\E[60;0;0;20p\E[60;1H\E[K:\ - :ti=\E[20;0;0;20p:\ - :tc=aaa+unk: -aaa-22|ann arbor ambassador/22 lines:\ - :li#22:\ - :is=\E7\E[60;0;0;22p\E8:te=\E[60;0;0;22p\E[60;1H\E[K:\ - :ti=\E[22;0;0;22p:\ - :tc=aaa+unk: -aaa-24|ann arbor ambassador/24 lines:\ - :li#24:\ - :is=\E7\E[60;0;0;24p\E8:te=\E[60;0;0;24p\E[60;1H\E[K:\ - :ti=\E[24;0;0;24p:\ - :tc=aaa+unk: -aaa-24-rv|ann arbor ambassador/24 lines+reverse video:\ - :tc=aaa+rv:tc=aaa-24: -aaa-26|ann arbor ambassador/26 lines:\ - :li#26:\ - :is=\E7\E[60;0;0;26p\E8:te=\E[60;0;0;26p\E[26;1H\E[K:\ - :ti=\E[H\E[J\E[26;0;0;26p:\ - :tc=aaa+unk: -aaa-28|ann arbor ambassador/28 lines:\ - :li#28:\ - :is=\E7\E[60;0;0;28p\E8:te=\E[60;0;0;28p\E[28;1H\E[K:\ - :ti=\E[H\E[J\E[28;0;0;28p:\ - :tc=aaa+unk: -aaa-30-s|aaa-s|ann arbor ambassador/30 lines w/status:\ - :es:hs:\ - :li#29:\ - :ds=\E7\E[60;0;0;30p\E[1;1H\E[K\E[H\E8\r\n\E[K:\ - :fs=\E[>51l:is=\r\n\E[A\E7\E[60;1;0;30p\E8:\ - :te=\E[60;1;0;30p\E[29;1H\E[K:\ - :ti=\E[H\E[J\E[30;1;0;30p\E[30;1H\E[K:\ - :ts=\E[>51h\E[1;%p1%dH\E[2K:tc=aaa+unk: -aaa-30-s-rv|aaa-s-rv|ann arbor ambassador/30 lines+status+reverse video:\ - :tc=aaa+rv:tc=aaa-30-s: -aaa-s-ctxt|aaa-30-s-ctxt|ann arbor ambassador/30 lines+status+save context:\ - :te=\E[60;1;0;30p\E[59;1H\E[K:\ - :ti=\E[30;1H\E[K\E[30;1;0;30p:tc=aaa-30-s: -aaa-s-rv-ctxt|aaa-30-s-rv-ct|ann arbor ambassador/30 lines+status+save context+reverse video:\ - :te=\E[60;1;0;30p\E[59;1H\E[K:\ - :ti=\E[30;1H\E[K\E[30;1;0;30p:tc=aaa-30-s-rv: -aaa|aaa-30|ambas|ambassador|ann arbor ambassador/30 lines:\ - :li#30:\ - :is=\E7\E[60;0;0;30p\E8:te=\E[60;0;0;30p\E[30;1H\E[K:\ - :ti=\E[H\E[J\E[30;0;0;30p:\ - :tc=aaa+unk: -aaa-30-rv|aaa-rv|ann arbor ambassador/30 lines in reverse video:\ - :tc=aaa+rv:tc=aaa-30: -aaa-30-ctxt|aaa-ctxt|ann arbor ambassador/30 lines; saving context:\ - :te=\E[60;0;0;30p\E[60;1H\E[K:ti=\E[30;0;0;30p:\ - :tc=aaa-30: -aaa-30-rv-ctxt|aaa-rv-ctxt|ann arbor ambassador/30 lines reverse video; saving context:\ - :te=\E[60;0;0;30p\E[60;1H\E[K:ti=\E[30;0;0;30p:\ - :tc=aaa+rv:tc=aaa-30: -aaa-36|ann arbor ambassador/36 lines:\ - :li#36:\ - :is=\E7\E[60;0;0;36p\E8:te=\E[60;0;0;36p\E[36;1H\E[K:\ - :ti=\E[H\E[J\E[36;0;0;36p:\ - :tc=aaa+unk: -aaa-36-rv|ann arbor ambassador/36 lines+reverse video:\ - :tc=aaa+rv:tc=aaa-36: -aaa-40|ann arbor ambassador/40 lines:\ - :li#40:\ - :is=\E7\E[60;0;0;40p\E8:te=\E[60;0;0;40p\E[40;1H\E[K:\ - :ti=\E[H\E[J\E[40;0;0;40p:\ - :tc=aaa+unk: -aaa-40-rv|ann arbor ambassador/40 lines+reverse video:\ - :tc=aaa+rv:tc=aaa-40: -aaa-48|ann arbor ambassador/48 lines:\ - :li#48:\ - :is=\E7\E[60;0;0;48p\E8:te=\E[60;0;0;48p\E[48;1H\E[K:\ - :ti=\E[H\E[J\E[48;0;0;48p:\ - :tc=aaa+unk: -aaa-48-rv|ann arbor ambassador/48 lines+reverse video:\ - :tc=aaa+rv:tc=aaa-48: -aaa-60-s|ann arbor ambassador/59 lines+status:\ - :es:hs:\ - :li#59:\ - :ds=\E7\E[60;0;0;60p\E[1;1H\E[K\E[H\E8\r\n\E[K:\ - :fs=\E[>51l:is=\r\n\E[A\E7\E[60;1;0;60p\E8:\ - :ts=\E[>51h\E[1;%p1%dH\E[2K:tc=aaa+unk: -aaa-60-s-rv|ann arbor ambassador/59 lines+status+reverse video:\ - :tc=aaa+rv:tc=aaa-60-s: -aaa-60-dec-rv|ann arbor ambassador/dec mode+59 lines+status+rev video:\ - :tc=aaa+dec:tc=aaa+rv:tc=aaa-60-s: -aaa-60|ann arbor ambassador/60 lines:\ - :li#60:\ - :is=\E7\E[60;0;0;60p\E[1Q\E[m\E[>20;30l\E8:tc=aaa+unk: -aaa-60-rv|ann arbor ambassador/60 lines+reverse video:\ - :tc=aaa+rv:tc=aaa-60: -aaa-db|ann arbor ambassador 30/destructive backspace:\ - :bs@:\ - :i2=\E[1Q\E[m\E[>20l\E[>30h:le=\E[D:tc=aaa-30: - -guru|guru-33|guru+unk|ann arbor guru/33 lines 80 cols:\ - :li#33:\ - :i2=\E[>59l:is=\E7\E[255;0;0;33;80;80p\E8\E[J:\ - :te=\E[255p\E[255;1H\E[K:ti=\E[33p:vb=\E[>59h\E[>59l:\ - :tc=aaa+unk: -guru+rv|guru changes for reverse video:\ - :i2=\E[>59h:vb=\E[>59l\E[>59h: -guru-rv|guru-33-rv|ann arbor guru/33 lines+reverse video:\ - :tc=guru+rv:tc=guru-33: -guru+s|guru status line:\ - :es:hs:\ - :ds=\E7\E[;0p\E[1;1H\E[K\E[H\E8\r\n\E[K:fs=\E[>51l:\ - :te=\E[255;1p\E[255;1H\E[K:ti=:\ - :ts=\E[>51h\E[1;%p1%dH\E[2K: -guru-nctxt|guru with no saved context:\ - :ti=\E[H\E[J\E[33p\E[255;1H\E[K:tc=guru: -guru-s|guru-33-s|ann arbor guru/33 lines+status:\ - :li#32:\ - :is=\r\n\E[A\E7\E[255;1;0;33;80;80p\E8\E[J:\ - :ti=\E[33;1p\E[255;1H\E[K:tc=guru+s:\ - :tc=guru+unk: -guru-24|ann arbor guru 24 lines:\ - :co#80:li#24:\ - :is=\E7\E[255;0;0;24;80;80p\E8\E[J:ti=\E[24p:tc=guru+unk: -guru-44|ann arbor guru 44 lines:\ - :co#97:li#44:\ - :is=\E7\E[255;0;0;44;97;100p\E8\E[J:ti=\E[44p:tc=guru+unk: -guru-44-s|ann arbor guru/44 lines+status:\ - :li#43:\ - :is=\r\n\E[A\E7\E[255;1;0;44;80;80p\E8\E[J:\ - :ti=\E[44;1p\E[255;1H\E[K:tc=guru+s:\ - :tc=guru+unk: -guru-76|guru with 76 lines by 89 cols:\ - :co#89:li#76:\ - :is=\E7\E[255;0;0;76;89;100p\E8\E[J:ti=\E[76p:tc=guru+unk: -guru-76-s|ann arbor guru/76 lines+status:\ - :co#89:li#75:\ - :is=\r\n\E[A\E7\E[255;1;0;76;89;100p\E8\E[J:\ - :ti=\E[76;1p\E[255;1H\E[K:tc=guru+s:\ - :tc=guru+unk: -guru-76-lp|guru-lp|guru with page bigger than line printer:\ - :co#134:li#76:\ - :is=\E7\E[255;0;0;76;134;134p\E8\E[J:ti=\E[76p:tc=guru+unk: -guru-76-w|guru 76 lines by 178 cols:\ - :co#178:li#76:\ - :is=\E7\E[255;0;0;76;178;178p\E8\E[J:ti=\E[76p:tc=guru+unk: -guru-76-w-s|ann arbor guru/76 lines+status+wide:\ - :co#178:li#75:\ - :is=\r\n\E[A\E7\E[255;1;0;76;178;178p\E8\E[J:\ - :ti=\E[76;1p\E[255;1H\E[K:\ - :tc=guru+s:tc=guru+unk: -guru-76-wm|guru 76 lines by 178 cols with 255 cols memory:\ - :co#178:li#76:\ - :is=\E7\E[255;0;0;76;178;255p\E8\E[J:ti=\E[76p:tc=guru+unk: -aaa-rv-unk|ann arbor unknown type:\ - :Nl#0:lh#0:lw#0:\ - :ho=\E[H:i1=\E[7m\E7\E[H\E9\E8:mb=\E[5;7m:md=\E[1;7m:\ - :me=\E[7m:mk=\E[7;8m:mr=\E[m:r1=\E[H\E[7m\E[J:\ - :..sa=\E[%?%p1%!%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;%?%p7%t8;%;m:\ - :se=\E[7m:so=\E[m:ue=\E[7m:us=\E[4;7m: - -#### Applied Digital Data Systems (adds) -# -# ADDS itself is long gone. ADDS was bought by NCR, and the same group made -# ADDS and NCR terminals. When AT&T and NCR merged, the engineering for -# terminals was merged again. Then AT&T sold the terminal business to -# SunRiver, which later changed its name to Boundless Technologies. The -# engineers from Teletype, AT&T terminals, ADDS, and NCR (who are still there -# as of early 1995) are at: -# -# Boundless Technologies -# 100 Marcus Boulevard -# Hauppauge, NY 11788-3762 -# Vox: (800)-231-5445 -# Fax: (516)-342-7378 -# Web: http://boundless.com -# -# Their voice mail used to describe the place as "SunRiver (formerly ADDS)". -# In 1995 Boundless acquired DEC's terminals business. -# - -# Regent: lowest common denominator, works on all regents. -# (regent: renamed ":bc:" to ":le:" -- esr) -regent|Adds Regent Series:\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cl=^L:cr=^M:do=^J:ho=\EY :le=^U:ll=^A:nd=^F:sf=^J:\ - :up=^Z: -# Regent 100 has a bug where if computer sends escape when user is holding -# down shift key it gets confused, so we avoid escape. -regent100|Adds Regent 100:\ - :sg#1:\ - :bl=^G:cm=\013%+ %B\020%.:k0=^B1\r:k1=^B2\r:k2=^B3\r:\ - :k3=^B4\r:k4=^B5\r:k5=^B6\r:k6=^B7\r:k7=^B8\r:l0=F1:l1=F2:\ - :l2=F3:l3=F4:l4=F5:l5=F6:l6=F7:l7=F8:me=\E0@:se=\E0@:so=\E0P:\ - :ue=\E0@:us=\E0`:\ - :tc=regent: -regent20|Adds Regent 20:\ - :bl=^G:cd=\Ek:ce=\EK:cm=\EY%+ %+ :tc=regent: -regent25|Adds Regent 25:\ - :bl=^G:kd=^J:kh=^A:kl=^U:kr=^F:ku=^Z:tc=regent20: -regent40|Adds Regent 40:\ - :sg#1:\ - :al=\EM:bl=^G:dl=\El:k0=^B1\r:k1=^B2\r:k2=^B3\r:k3=^B4\r:\ - :k4=^B5\r:k5=^B6\r:k6=^B7\r:k7=^B8\r:l0=F1:l1=F2:l2=F3:\ - :l3=F4:l4=F5:l5=F6:l6=F7:l7=F8:me=\E0@:se=\E0@:so=\E0P:\ - :ue=\E0@:us=\E0`:\ - :tc=regent25: -regent40+|Adds Regent 40+:\ - :is=\EB:tc=regent40: -regent60|regent200|Adds Regent 60:\ - :dc=\EE:ei=\EF:im=\EF:is=\EV\EB:kD=\EE:kI=\EF:kM=\EF:\ - :se=\ER\E0@\EV:so=\ER\E0P\EV:\ - :tc=regent40+: -# From: Thu Jul 9 09:27:33 1981 -# (viewpoint: added :kr:, function key, and :dl: capabilities -- esr) -viewpoint|addsviewpoint|adds viewpoint:\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cd=\Ek:ce=\EK:cl=^L:cm=\EY%+ %+ :cr=^M:dl=\El:do=^J:\ - :is=\017\E0`:k0=^B1:k2=^B2:k3=^B\041:k4=^B":k5=^B#:kd=^J:\ - :kh=^A:kl=^U:kr=^F:ku=^Z:le=^H:ll=^A:me=^O:nd=^F:se=^O:sf=^J:\ - :so=^N:ue=^O:up=^Z:us=^N:ve=\017\E0`:vs=\017\E0P: -# Some viewpoints have bad ROMs that foo up on ^O -screwpoint|adds viewpoint with ^O bug:\ - :se@:so@:ue@:us@:vs@:tc=viewpoint: - -# From: Jay S. Rouman 5 Jul 92 -# The :vi:/:ve:/:sa:/:me: strings were added by ESR from specs. -# Theory; the vp3a+ wants \E0%c to set highlights, where normal=01000000, -# underline=01100000, rev=01010000, blink=01000010,dim=01000001, -# invis=01000100 and %c is the logical or of desired attributes. -# There is also a `tag bit' enabling attributes, set by \E) and unset by \E(. -vp3a+|viewpoint3a+|adds viewpoint 3a+:\ - :am:bw:\ - :co#80:it#8:li#24:\ - :cd=\EY:ce=\ET:cl=\E*:cm=\E=%+ %+ :cr=^M:do=^J:ho=^^:kb=^H:\ - :kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:me=\E(:nd=^L:nw=^M^J:\ - :..sa=\E0%{64}%?%p1%tQ%|%;%?%p2%t%{96}%|%;%?%p3%tP%|%;%?%p4%t%{2}%|%;%?%p5%t%{1}%|%;%?%p7%tD%|%;%c\E):\ - :se=\E(:sf=^J:so=\E0Q\E):ta=^I:up=^K:ve=^X:vi=^W: -vp60|viewpoint60|addsvp60|adds viewpoint60:\ - :tc=regent40: -# -# adds viewpoint 90 - from cornell -# Note: emacs sends ei occasionally to insure the terminal is out of -# insert mode. This unfortunately puts the viewpoint90 IN insert -# mode. A hack to get around this is :ic=\EF\s\EF^U:. (Also, -# - :ei=:im=: must be present in the termcap translation.) -# - :xs: indicates glitch that attributes stick to location -# - :ms: means it's safe to move in standout mode -# - :cl=\EG\Ek:: clears screen and visual attributes without affecting -# the status line -# Function key and label capabilities merged in from SCO. -vp90|viewpoint90|adds viewpoint 90:\ - :bs:bw:ms:xs:\ - :co#80:li#24:\ - :cd=\Ek:ce=\EK:cl=\EG\Ek:cm=\EY%+ %+ :dc=\EE:dl=\El:do=^J:\ - :ei=:ho=\EY :ic=\EF \EF\025:im=:k0=^B1\r:k1=^B2\r:\ - :k2=^B3\r:k3=^B4\r:k4=^B5\r:k5=^B6\r:k6=^B7\r:k7=^B8\r:\ - :k8=^B9\r:k9=^B\072\r:k;=^B;\r:kb=^H:kd=^J:kh=^A:kl=^U:\ - :kr=^F:ku=^Z:l0=F1:l1=F2:l2=F3:l3=F4:l4=F5:l5=F6:l6=F7:l7=F8:\ - :l8=F9:l9=F10:la=F11:le=^H:ll=^A:me=\ER\E0@\EV:nd=^F:\ - :se=\ER\E0@\EV:sf=^J:so=\ER\E0Q\EV:ta=^I:ue=\ER\E0@\EV:\ - :up=^Z:us=\ER\E0`\EV: -# Note: if return acts weird on a980, check internal switch #2 -# on the top chip on the CONTROL pc board. -adds980|a980|adds consul 980:\ - :am:bs:\ - :co#80:li#24:\ - :al=\E\016:bl=^G:cl=\014\013@:cm=\013%+@\E\005%2:cr=^M:\ - :dl=\E\017:do=^J:k0=\E0:k1=\E1:k2=\E2:k3=\E3:k4=\E4:k5=\E5:\ - :k6=\E6:k7=\E7:k8=\E8:k9=\E9:le=^H:me=^O:nd=\E^E01:se=^O:\ - :sf=^J:so=^Y^^^N: - -# Beehive documentation is undated and marked Preliminary and has no figures -# so we must have early Superbee2 (Model 600, according to phone conversation -# with mfr.). It has proved reliable except for some missing padding -# (notably after \EK and at bottom of screen). -# -# The key idea is that AEP mode is poison for :cm: & that US's in -# the local memory should be avoided like the plague. That means -# that the 2048 character local buffer is used as 25 lines of 80 -# characters, period. No scrolling local memory, folks. It also -# appears that we cannot use naked INS LINE feature since it uses -# US. The sbi fakes :al: with an 80-space insert that may be too -# slow at low speeds; also spaces get converted to \040 which is -# too long for some programs (not vi). DEL LINE is ok but slow. -# -# The string is designed for last line of screen ONLY; cup to -# 25th line corrects the motion inherent in scrolling to Page 1. -# -# There is one understood bug. It is that the screen appears to -# pop to a new (blank) page after a :nw:, or leave a half-line -# ellipsis to a quad that is the extra 48 memory locations. The -# data received is dumped into memory but not displayed. Not to -# worry if :cm: is being used; the lines not displayed will be, -# whenever the cursor is moved up there. Since :cm: is addressed -# relative to MEMORY of window, nothing is lost; but beware of -# relative cursor motion (:up:,:do:,:nd:,:le:). Recommended, -# therefore, is setenv MORE -c . -# -# WARNING: Not all features tested. -# -# Timings are assembled from 3 sources. Some timings may reflect -# SB2/Model 300 that were used if more conservative. -# Tested on a Model 600 at 1200 and 9600 bd. -# -# The BACKSPACEkb option is cute. The NEWLINE key, so cleverly -# placed on the keyboard and useless because of AEP, is made -# into a backspace key. In use ESC must be pressed twice (to send) -# and sending ^C must be prefixed by ESC to avoid that weird -# transmit mode associated with ENTER key. -# -# IF TERMINAL EVER GOES CATATONIC with the cursor buzzing across -# the screen, then it has dropped into ENTER mode; hit -# RESET--ONLINE--!tset. -# -# As delivered this machine has a FATAL feature that will throw -# it into that strange transmit state (SPOW) if the space bar is -# hit after a CR is received, but before receiving a LF (or a -# few others). -# -# The circuits MUST be modified to eliminate the SPOW latch. -# This is done by strapping on chip A46 of the I/O board; cut -# the p.c. connection to Pin 5 and strap Pin 5 to Pin 8 of that -# chip. This mod has been checked out on a Mod 600 of Superbee II. -# With this modification absurdly high timings on cr are -# unnecessary. -# -# NOTE WELL that the rear panel switch should be set to CR/LF, -# not AEP! -# -sb1|beehive superbee:\ - :am:bs:bw:da:db:mi:ul:xb:\ - :co#80:li#25:sg#1:\ - :al=\EN\EL\EQ \EP \EO\ER\EA:\ - :bl=^G:bt=\E`:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EF%r%03%03:cr=\r:\ - :ct=\E3:dc=\EP:dl=\EM:do=^J:ei=\ER:ho=\EH:im=\EQ\EO:\ - :is=\EE\EX\EZ\EO\Eb\Eg\ER:k0=\E2:k1=\Ep:k2=\Eq:k3=\Er:\ - :k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:k9=\E1:kE=\EK:kI=\EQ\EO:\ - :kL=\EM:kM=\ER:kS=\EJ:kb=^_:kd=\EB:kh=\EH:kl=\ED:kr=\EC:\ - :ku=\EA:l0=TAB CLEAR:l9=TAB SET:le=^H:me=\E_3:nd=\EC:\ - :se=\E_3:sf=^J:so=\E_1:st=\E1:ta=^I:te=:ti=\EO:ue=\E_3:\ - :up=\EA:us=\E_0: -sbi|superbee|beehive superbee at Indiana U.:\ - :xb:\ - :al=1\EN\EL\EQ \EP \EO\ER\EA:cr=\r:tc=sb1: -# Alternate (older) description of Superbee - f1=escape, f2=^C. -# Note: there are at least 3 kinds of superbees in the world. The sb1 -# holds onto escapes and botches ^C's. The sb2 is the best of the 3. -# The sb3 puts garbage on the bottom of the screen when you scroll with -# the switch in the back set to CRLF instead of AEP. This description -# is tested on the sb2 but should work on all with either switch setting. -# The f1/f2 business is for the sb1 and the :xb: can be taken out for -# the other two if you want to try to hit that tiny escape key. -# This description is tricky: being able to use cup depends on there being -# 2048 bytes of memory and the hairy string. -superbee-xsb|beehive super bee:\ - :am:da:db:xb:\ - :co#80:it#8:li#25:\ - :cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EF%r%3%3:cr=\r:ct=\E3:dc=\EP:\ - :dl=\EM:do=^J:ho=\EH:is=\EH\EJ:k1=\Ep:k2=\Eq:k3=\Er:k4=\Es:\ - :k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:kd=\EB:kh=\EH:kl=\ED:kr=\EC:\ - :ku=\EA:le=^H:me=\E_3:nd=\EC:se=\E_3:\ - :sf=\n\0\0\0\n\0\0\0\EA\EK\0\0\0\ET\ET:so=\E_1:st=\E1:\ - :ta=^I:up=\EA:ve=^J: -# This loses on lines > 80 chars long, use at your own risk -superbeeic|super bee with insert char:\ - :ei=\ER:ic=:im=\EQ:tc=superbee-xsb: -sb2|sb3|fixed superbee:\ - :xb@:tc=superbee: - -#### Beehive Medical Electronics -# -# Steve Seymour writes (Wed, 03 Feb 1999): -# Regarding your question though; Beehive terminals weren't made by Harris. -# They were made by Beehive Medical Electronics in Utah. They went out of -# business in the early '80s. -# -# (OK, then, I don't know why a couple of these say "harris beehive".) -# - -# Reports are that most of these Beehive entries (except superbee) have not -# been tested and do not work right. :se: is a trouble spot. Be warned. - -# (bee: :ic: was empty, which is obviously bogus -- esr) -beehive|bee|harris beehive:\ - :am:bs:mi:\ - :co#80:li#24:\ - :al=\EL:bt=\E>:cd=\EJ:ce=\EK:cl=\EE:cm=\EF%+ %+ :dc=\EP:\ - :dl=\EM:do=\EB:ei=\E@:ho=\EH:im=\EQ:kA=\EL:kB=\E>:kC=\EE:\ - :kD=\EP:kE=\EK:kI=\EQ:kL=\EM:kM=\E@:kb=^H:kd=\EB:kh=\EH:\ - :kl=\ED:kr=\EC:ku=\EA:le=^H:me=\Ed@:nd=\EC:se=\Ed@:so=\EdP:\ - :ue=\Ed@:up=\EA:us=\Ed`: -# set tab is ^F, clear (one) tab is ^V, no way to clear all tabs. -# good grief - does this entry make :sg:/:ug: when it doesn't have to? -# look at those spaces in :se:/:so:. Seems strange to me... -# (beehive: :if=/usr/share/tabset/beehive: removed, no such file. If you -# really care, cook up one using ^F -- esr) -beehive3|bh3m|beehiveIIIm|harris beehive 3m:\ - :am:bs:\ - :co#80:it#8:li#20:\ - :al=\023:bl=^G:cd=^R:ce=^P:cl=^E^R:cr=^M:dl=\021:do=^J:ho=^E:\ - :le=^H:ll=^E^K:nd=^L:se= ^_:sf=^J:so=^] :st=^F:ta=^I:up=^K: -beehive4|bh4|beehive 4:\ - :am:\ - :co#80:li#24:\ - :bl=^G:cd=\EJ:ce=\EK:cl=\EE:cr=^M:do=^J:ho=\EH:le=\ED:nd=\EC:\ - :sf=^J:up=\EA: -# There was an early Australian kit-built computer called a "Microbee". -# It's not clear whether this is for one of those or for a relative -# of the Beehive. -microb|microbee|micro bee series:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :bl=^G:cd=\EJ:ce=\EK:cl=\EE:cm=\EF%+ %+ :cr=^M:do=^J:k1=\Ep:\ - :k2=\Eq:k3=\Er:k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:k9=\Ex:\ - :kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:le=^H:me=\Ed@:nd=\EC:\ - :se=\Ed@:sf=^J:so= \EdP:ta=^I:ue=\Ed@:up=\EA:us=\Ed`: - -#### C. Itoh Electronics -# -# As of 1995 these people no longer make terminals (they're still in the -# printer business). Their terminals were all clones of the DEC VT series. -# They're located in Orange County, CA. -# - -# CIT 80 - vt-52 emulator, the termcap has been modified to remove -# the delay times and do an auto tab set rather than the indirect -# file used in vt100. -cit80|cit-80|citoh 80:\ - :am:bs:\ - :co#80:li#24:\ - :cd=\EJ:ce=\EK:cl=\E[H\EJ:cm=\E[%i%2;%2H:cr=^M:ff=^L:\ - :is=\E>:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:nd=\E[C:sf=^J:up=\E[A: -# From: Tim Wood Fri Sep 27 09:39:12 PDT 1985 -# (cit101: added / based on init string, merged this with c101 -- esr) -cit101|citc|C.itoh fast vt100:\ - :am:bs:xn:\ - :co#80:li#24:\ - :RA=\E[?7l:SA=\E[?7h:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:ei=:ic=\E[@:\ - :im=:is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[3g\E[>5g:\ - :kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:me=\E[m:nd=\E[C:se=\E[m:so=\E[7m:ue=\E[m:\ - :up=\E[A:us=\E[4m:vb=\E[?5h\E[?5l:ve=\E[V\E8:vs=\E7\E[U: -# CIE Terminals CIT-101e from Geoff Kuenning via BRL -# The following termcap entry was created from the Callan cd100 entry. The -# last two lines (with the capabilities in caps) are used by RM-cobol to allow -# full selection of combinations of reverse video, underline, and blink. -# (cit101e: removed unknown :f0=\EOp:f1=\EOq:f2=\EOr:f3=\EOs:f4=\EOt:f5=\EOu:\ -# f6=\EOv:f7=\EOw:f8=\EOx:f9=\EOy:AB=\E[0;5m:AL=\E[m:AR=\E[0;7m:AS=\E[0;5;7m:\ -# :NB=\E[0;1;5m:NM=\E[0;1m:NR=\E[0;1;7m:NS=\E[0;1;5;7m: -- esr) -cit101e|C. Itoh CIT-101e:\ - :am:bs:mi:ms:pt:\ - :co#80:it#8:li#24:\ - :ac=:ae=^O:al=\E[L:as=^N:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%2;%2H:cs=\E[%i%2;%2r:dc=\E[P:dl=\E[M:do=\E[B:\ - :ei=\E[4l:if=/usr/share/tabset/vt100:im=\E[4h:k0=\EOT:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOm:k6=\EOl:k7=\EOM:\ - :k8=\EOn:kd=\E[B:ke=\E>:kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:\ - :nd=\E[C:rc=\E8:sc=\E7:se=\E[m:so=\E[7m:sr=\EM:ue=\E[m:\ - :up=\E[A:us=\E[4m:ve=:vs=\E[?1l\E[?4l\E[?7h: -# From: David S. Lawyer, June 1997: -# The CIT 101-e was made in Japan in 1983-4 and imported by CIE -# Terminals in Irvine, CA. It was part of CITOH Electronics. In the -# late 1980's CIT Terminals went out of business. -# There is no need to use the initialization string is=... (by invoking -# tset or setterm etc.) provided that the terminal has been manually set -# up (and the setup saved with ^S) to be compatible with this termcap. To be -# compatible it should be in ANSI mode (not VT52). A set-up that -# works is to set all the manually setable stuff to factory defaults -# by pressing ^D in set-up mode. Then increse the brighness with the -# up-arrow key since the factory default will likely be dim on an old -# terminal. Then change any options you want (provided that they are -# compatible with the termcap). For my terminal I set: Screen -# Background: light; Keyclicks: silent; Auto wraparound: on; CRT saver: -# on. I also set up mine for parity (but you may not need it). Then -# save the setup with ^S. -# (cit101e-rv: added empty :te: to suppress a tic warning. --esr) -cit101e-rv|Citoh CIT-101e (sets reverse video):\ - :am:eo:mi:ms:xn:xo:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ - :al=\E[L:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:ch=\E[%i%dG:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:ho=\E[H:ic=\E[@:\ - :im=\E[4h:\ - :is=\E<\E>\E[?1l\E[?3l\E[?4l\E[?5h\E[?7h\E[?8h\E[3g\E[>5g\E(B\E[m\E[20l\E[1;24r\E[24;1H:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kb=\177:kd=\E[B:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:\ - :nd=\E[C:nl=\EM:nw=\EE:r1=\Ec\E[?7h\E[>5g:rc=\E8:sc=\E7:\ - :se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:te=:\ - :ti=\E[>5g\E[?7h\E[?5h:u6=\E[%i%d;%dR:u7=\E[6n:\ - :u8=\E[?6c:u9=\E[c:ue=\E[m:up=\E[A:us=\E[4m:\ - :vb=200\E[?5l\E[?5h:ve=\E[0;3;4v:vi=\E[1v:vs=\E[3;5v: -cit101e-n|CIT-101e w/o am:\ - :am@:\ - :kb=^H:kd=^J:kl=^H:vs=\E[?1l\E[?4l\E[?7l:tc=cit101e: -cit101e-132|CIT-101e with 132 cols:\ - :co#132:\ - :kb=^H:kd=^J:kl=^H:tc=cit101e: -cit101e-n132|CIT-101e with 132 cols w/o am:\ - :am@:\ - :co#132:\ - :kb=^H:kd=^J:kl=^H:vs=\E[?1l\E[?4l\E[?7l:tc=cit101e: -# CIE Terminals CIT-500 from BRL -# The following SET-UP modes are assumed for normal operation: -# GENERATE_XON/XOFF:YES DUPLEX:FULL NEWLINE:OFF -# AUTOWRAP:ON MODE:ANSI SCREEN_LENGTH:64_LINES -# DSPLY_CNTRL_CODES?NO PAGE_WIDTH:80 EDIT_MODE:OFF -# Other SET-UP modes may be set for operator convenience or communication -# requirements. -# Hardware tabs are assumed to be set every 8 columns; they can be set up -# by the "reset", "tset", or "tabs" utilities. No delays are specified; use -# "stty ixon -ixany" to enable DC3/DC1 flow control! -# (cit500: I added / based on the init string -- esr) -cit500|CIE Terminals CIT-500:\ - :bs:mi:ms:pt:xo:\ - :co#80:it#8:kn#10:li#64:vt#3:\ - :AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:RA=\E[?7l:\ - :RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:ac=:ae=^O:al=\E[L:as=^N:\ - :bl=^G:bt=\E[Z:cd=\EJ:ce=\EK:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=^J:\ - :ei=\E[4l:ho=\E[H:im=\E[4h:is=\E<\E)0:k0=\EOP:k1=\EOQ:\ - :k2=\EOR:k3=\EOS:k4=\EOU:k5=\EOV:k6=\EOW:k7=\EOX:k8=\EOY:\ - :k9=\EOZ:kA=\E[L:kB=\E[Z:kD=\E[P:kE=\EK:kI=\E[4h:kL=\E[M:\ - :kM=\E[4l:kS=\EJ:kb=^H:kd=\EOB:ke=\E[?1l\E>:kh=\E[H:\ - :kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l0=PF1:l1=PF2:l2=PF3:\ - :l3=PF4:l4=F15:l5=F16:l6=F17:l7=F18:l8=F19:l9=F20:le=^H:\ - :ll=\E[64H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :nw=\EE:\ - :r1=\E<\E2\E[20l\E[?6l\E[r\E[m\E[q\E(B\017\E)0\E>:\ - :rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[m:up=\EM:us=\E[4m: - -# C. Itoh printers begin here -citoh|ci8510|8510|c.itoh 8510a:\ - :co#80:it#8:\ - :is=\E(009\054017\054025\054033\054041\054049\054057\054065\054073.:\ - :le@:md=\E\041:me=\E"\EY:rp=\ER%r%03%.:sr=\Er:ue=\EY:\ - :us=\EX:\ - :tc=lpr: -citoh-pica|citoh in pica:\ - :i1=\EN:tc=citoh: -citoh-elite|citoh in elite:\ - :co#96:\ - :i1=\EE:\ - :is=\E(009\054017\054025\054033\054041\054049\054057\054065\054073\054081\054089.:tc=citoh: -citoh-comp|citoh in compressed:\ - :co#136:\ - :i1=\EQ:\ - :is=\E(009\054017\054025\054033\054041\054049\054057\054065\054073\054081\054089\054097\054105\054113\054121\054129.:tc=citoh: -# citoh has infinite cols because we don't want lp ever inserting \n\t**. -citoh-prop|citoh-ps|ips|citoh in proportional spacing mode:\ - :co#32767:\ - :i1=\EP:tc=citoh: -citoh-6lpi|citoh in 6 lines per inch mode:\ - :i2=\EA:tc=citoh: -citoh-8lpi|citoh in 8 lines per inch mode:\ - :li#88:\ - :i2=\EB:tc=citoh: - -#### Control Data (cdc) -# - -cdc456|cdc 456 terminal:\ - :am:bs:\ - :co#80:li#24:\ - :al=\EL:bl=^G:cd=^X:ce=^V:cl=^Y^X:cm=\E1%+ %+ :cr=^M:dl=\EJ:\ - :do=^J:ho=^Y:le=^H:nd=^L:sf=^J:up=^Z: - -# Assorted CDC terminals from BRL (improvements by DAG & Ferd Brundick) -cdc721|CDC Viking:\ - :am:bs:\ - :co#80:li#24:\ - :ce=^K:cl=^L:cm=\002%r%+ %+ :ho=^Y:kd=^J:kh=^Y:kl=^H:kr=^I:\ - :ku=^W:nd=^X:up=^W: -cdc721ll|CDC Vikingll:\ - :am:bs:\ - :co#132:li#24:\ - :ce=^K:cl=^L:cm=\002%r%+ %+ :ho=^Y:kd=^J:kh=^Y:kl=^H:kr=^I:\ - :ku=^W:nd=^X:up=^W: -# (cdc752: the BRL entry had :ll=\E1 ^Z: commented out -cdc752|CDC 752:\ - :am:bs:bw:xs:\ - :co#80:li#24:\ - :bl=^G:ce=^V:cl=\030\E1 :cm=\E1%r%+ %+ :cr=^M:do=^J:\ - :ho=\E1 :le=^H:ll=^Y:nd=^U:r1=\E1 \030\002\003\017:\ - :sf=^J:up=^Z: -# CDC 756 -# The following switch/key settings are assumed for normal operation: -# 96 chars SCROLL FULL duplex not BLOCK -# Other switches may be set according to communication requirements. -# Insert/delete-character cannot be used, as the whole display is affected. -# "so" & "se" are commented out until jove handles "sg" correctly. -cdc756|CDC 756:\ - :am:bs:bw:\ - :co#80:kn#10:li#24:\ - :al=6*\EL:bl=^G:cd=^X:ce=^V:cl=^Y^X:cm=\E1%r%+ %+ :cr=^M:\ - :dl=6*\EJ:do=^J:ho=^Y:k0=\EA:k1=\EB:k2=\EC:k3=\ED:k4=\EE:\ - :k5=\EF:k6=\EG:k7=\EH:k8=\Ea:k9=\Eb:kA=\EL:kD=\EI:kE=^V:\ - :kI=\EK:kL=\EL:kS=^X:kT=^O:kb=^H:kd=^J:kh=^Y:kl=^H:kr=^U:\ - :ku=^Z:l0=F1:l1=F2:l2=F3:l3=F4:l4=F5:l5=F6:l6=F7:l7=F8:l8=F9:\ - :l9=F10:le=^H:ll=^Y^Z:nd=^U:r1=\031\030\002\003\017:sf=^J:\ - :up=^Z: -# -# CDC 721 from Robert Viduya, Ga. Tech. via BRL. -# -# Part of the long initialization string defines the "DOWN" key to the left -# of the tab key to send an ESC. The real ESC key is positioned way out -# in right field. -# -# The termcap won't work in 132 column mode due to the way it it moves the -# cursor. Termcap doesn't have the capability (as far as I could tell) to -# handle the 721 in 132 column mode. -# -# (cdc721: changed :ri: to :sr: -- esr) -cdc721-esc|Control Data 721:\ - :am:bs:bw:ms:pt:xo:\ - :co#80:it#8:kn#10:li#30:\ - :al=^^R:bl=^G:bt=^^^K:cd=^^P:ce=^K:cl=^L:cm=\002%r%+ %+ :\ - :ct=^^^RY:dc=^^N:dl=^^Q:do=^Z:ei=:ho=^Y:ic=^^O:im=:\ - :is=\036\022B\003\036\035\017\022\025\035\036E\036\022H\036\022J\036\022L\036\022N\036\022P\036\022Q\036\022\036\022\136\036\022b\036\022i\036W =\036\022Z\036\011C1-` `\041k/o:\ - :k0=^^q:k1=^^r:k2=^^s:k3=^^t:k4=^^u:k5=^^v:k6=^^w:k7=^^x:\ - :k8=^^y:k9=^^z:kb=^H:kd=^Z:ke=^^^Rl:kh=^Y:kl=^H:kr=^X:\ - :ks=^^^Rk:ku=^W:le=^H:ll=^B =:mb=^N:\ - :me=\017\025\035\036E\036\022\:mh=^\:mk=^^^R[:mr=^^D:\ - :nd=^X:se=^^E:sf=\036W =\036U:so=^^D:sr=\036W =\036V:\ - :st=^^^RW:ue=^]:up=^W:us=^\: - -#### Getronics -# -# Getronics is a Dutch electronics company that at one time was called -# `Geveke' and made async terminals; but (according to the company itself!) -# they've lost all their documentation on the command set. The hardware -# documentation suggests the terminals were actually manufactured by a -# Taiwanese electronics company named Cal-Comp. There are known -# to have been at least two models, the 33 and the 50. -# - -# The 50 seems to be a top end vt220 clone, with the addition of a higher -# screen resolution, a larger screen, at least 1 page of memory above and -# below the screen, apparently pages of memory right and left of the screen -# which can be panned, and about 75 function keys (15 function keys x normal, -# shift, control, func A, func B). It also has more setup possibilities than -# the vt220. The monitor case is dated November 1978 and the keyboard case is -# May 1982. -# -# The vt100 emulation works as is. The entry below describes the rather -# non-conformant (but more featureful) ANSI mode. -# -# From: Stephen Peterson , 27 May 1995 -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -visa50|geveke visa 50 terminal in ansi 80 character mode:\ - :bw:mi:ms:\ - :co#80:li#25:\ - :AL=\E[%dL:DC=\E[%dX:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\E[f:K2=\EOP:K3=\EOQ:K4=\EOR:K5=\EOS:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=\E[3l:al=\E[L:as=\E3h:bl=^G:\ - :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[X:dl=\E[M:do=\E[B:\ - :ei=\E[4l:ho=\E[H:ic=\E[@:im=\E[4h:\ - :is=\E0;2m\E[1;25r\E[25;1H\E[?3l\E[?7h\E[?8h:k0=\E010:\ - :k1=\E001:k2=\E002:k3=\E003:k4=\E004:k5=\E005:k6=\E006:\ - :k7=\E007:k8=\E008:k9=\E009:kD=\177:kb=^H:kd=\E[A:ke=\E>:\ - :kh=\E[f:kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:le=\E[D:mb=\E[5m:\ - :md=\E[1m:me=\E[0;2m:mh=\E[2m:mr=\E[7m:nd=\E[C:nw=^M^J:\ - :se=\E[0;2m:sf=^J:so=\E[2;7m:ta=^I:ue=\E[0m:up=\E[A:\ - :us=\E[4m:vb=\E[?5h\E[?5l: - -#### Human Designed Systems (Concept) -# -# Human Designed Systems -# 400 Fehley Drive -# King of Prussia, PA 19406 -# Vox: (610)-277-8300 -# Fax: (610)-275-5739 -# Net: support@hds.com -# -# John Martin is their termcap expert. They're mostly out of -# the character-terminal business now (1995) and making X terminals. In -# particular, the whole `Concept' line described here was discontinued long -# ago. -# - -# From: Sat Jun 27 07:41:20 1981 -# Extensive changes to c108 by arpavax:eric Feb 1982 -# Some unknown person at SCO then translated it to terminfo. -# -# There seem to be a number of different versions of the C108 PROMS -# (with bug fixes in its Z-80 program). -# -# The first one that we had would lock out the keyboard of you -# sent lots of short lines (like /usr/dict/words) at 9600 baud. -# Try that on your C108 and see if it sends a ^S when you type it. -# If so, you have an old version of the PROMs. -# -# You should configure the C108 to send ^S/^Q before running this. -# It is much faster (at 9600 baud) than the c100 because the delays -# are not fixed. -# new status line display entries for c108-8p: -# :i3: - init str #3 - setup term for status display - -# set programmer mode, select window 2, define window at last -# line of memory, set bkgnd stat mesg there, select window 0. -# -# :ts: - to status line - select window 2, home cursor, erase to -# end-of-window, 1/2 bright on, goto(line#0, col#?) -# -# :fs: - from status line - 1/2 bright off, select window 0 -# -# :ds: - disable status display - set bkgnd status mesg with -# illegal window # -# -# There are probably more function keys that should be added but -# I don't know what they are. -# -# No delays needed on c108 because of ^S/^Q handshaking -# -c108|concept108|c108-8p|concept108-8p|concept 108 w/8 pages:\ - :i2=\EU\E z"\Ev\001\177 \041p\E ;"\E z \Ev \001\177p\Ep\n:\ - :te=\Ev \001\177p\Ep\r\n:\ - :tc=c108-4p: -c108-4p|concept108-4p|concept 108 w/4 pages:\ - :bs:es:hs:xo:\ - :pb@:\ - :ac=jEkTl\mMqLxU:ae=\Ej :as=\Ej\041:\ - :..cm=\Ea%p1%?%p1%{95}%>%t\001%{96}%-%;%{32}%+%c%p2%?%p2%{95}%>%t\001%{96}%-%;%{32}%+%c:\ - :cr=^M:dc=\E 1:ds=\E ;\177:fs=\Ee\E z :i1=\EK\E\041\E F:\ - :i2=\EU\E z"\Ev\177 \041p\E ;"\E z \Ev \001 p\Ep\n:\ - :sf=^J:te=\Ev \001 p\Ep\r\n:ti=\EU\Ev 8p\Ep\r\E\025:\ - :ts=\E z"\E?\E\005\EE\Ea %+ :ve=\Ew:vs=\EW:\ - :tc=c100: -c108-rv|c108-rv-8p|concept 108 w/8 pages in reverse video:\ - :te=\Ev \002 p\Ep\r\n:ti=\EU\Ev 8p\Ep\r:\ - :tc=c108-rv-4p: -c108-rv-4p|concept108rv4p|concept 108 w/4 pages in reverse video:\ - :i1=\Ek:se=\Ee:so=\EE:vb=\EK\Ek:\ - :tc=c108-4p: -c108-w|c108-w-8p|concept108-w-8|concept108-w8p|concept 108 w/8 pages in wide mode:\ - :co#132:\ - :i1=\E F\E":te=\Ev ^A0\001D\Ep\r\n:\ - :ti=\EU\Ev 8\001D\Ep\r:tc=c108-8p: - -# Concept 100: -# These have only window relative cursor addressing, not screen -# relative. To get it to work right here, smcup/rmcup (which -# were invented for the concept) lock you into a one page -# window for screen style programs. -# -# To get out of the one page window, we use a clever trick: -# we set the window size to zero ("\Ev " in rmcup) which the -# terminal recognizes as an error and resets the window to all -# of memory. -# -# This trick works on c100 but does not on c108, sigh. -# -# Some tty drivers use cr3 for concept, others use nl3, hence -# the delays on cr and ind below. This padding is only needed at -# 9600 baud and up. One or the other is commented out depending on -# local conventions. -# -# 2 ms padding on :te: isn't always enough. 6 works fine. Maybe -# less than 6 but more than 2 will work. -# -# Note: can't use function keys f7-f10 because they are -# indistinguishable from arrow keys (!), also, del char and -# clear eol use xon/xoff so they probably won't work very well. -# -# Also note that we don't define insrt/del char/delline/eop/send -# because they don't transmit unless we reset them - I figured -# it was a bad idea to clobber their definitions. -# -# The sequence changes the escape character to ^^ so that -# escapes will be passed through to the printer. Only trouble -# is that ^^ won't be - ^^ was chosen to be unlikely. -# Unfortunately, if you're sending raster bits through to be -# plotted, any character you choose will be likely, so we lose. -# -# \EQ"\EY(^W (send anything from printer to host, for xon/xoff) -# cannot be # in is2 because it will hang a c100 with no printer -# if sent twice. -c100|concept100|concept|c104|c100-4p|hds concept 100:\ - :am:bs:eo:mi:ul:xn:\ - :co#80:li#24:pb#9600:vt#8:\ - :al=\E\022:bl=^G:cd=\E\005:ce=\E\025:cl=\E?\E\005:\ - :cm=\Ea%+ %+ :cr=\r:dc=\E\021:dl=\E\002:do=^J:ei=\E :\ - :i1=\EK:i2=\Ev \Ep\n:im=\E^P:ip=:\ - :is=\EU\Ef\E7\E5\E8\El\ENH\E\0\Eo&\0\Eo'\E\Eo\041\0\E\007\041\E\010A@ \E4#\072"\E\072a\E4#;"\E\072b\E4#<"\E\072c:\ - :k1=\E5:k2=\E6:k3=\E7:k4=\E8:k5=\E9:k6=\E\072a:k7=\E\072b:\ - :k8=\E\072c:kA=\E^R:kB=\E':kD=\E^Q:kE=\E^S:kF=\E[:kI=\E^P:\ - :kL=\E^B:kM=\E\0:kN=\E-:kP=\E.:kR=\E\:kS=\E^C:kT=\E]:kb=^H:\ - :kd=\E<:ke=\Ex:kh=\E?:kl=\E>:kr=\E=:ks=\EX:kt=\E_:ku=\E;:\ - :le=^H:mb=\EC:me=\EN@:mh=\EE:mk=\EH:mp=\EI:mr=\ED:nd=\E=:\ - :pf=\036o \E\EQ\041\EYP\027:\ - :po=\EQ"\EY(\027\EYD\Eo \036:rp=\Er%.%+ :se=\Ed:sf=^J:\ - :so=\ED:ta=\011:te=\Ev \Ep\r\n:\ - :ti=\EU\Ev 8p\Ep\r\E\025:ue=\Eg:up=\E;:us=\EG:vb=\Ek\EK: -c100-rv|c100-rv-4p|concept100-rv|c100 rev video:\ - :i1=\Ek:se=\Ee:so=\EE:vb=\EK\Ek:ve@:vs@:tc=c100: -oc100|oconcept|c100-1p|old 1 page concept 100:\ - :in:\ - :i3@:tc=c100: - -# From: Walter Skorski , 16-oct-1996. -# Lots of notes, originally inline, but ncurses doesn't grok that. -# -# am: not available in power on mode, but turned on with \E[=107;207h in -# is2=. Also, \E=124l in is2= could have been used to prevent needing -# to specify xenl:, but that would have rendered the last space on the -# last line useless. -# bw: Not available in power on mode, but turned on with \E[=107;207h in -# is2=. -# clear: Could be done with \E[2J alone, except that vi (and probably most -# other programs) assume that this also homes the cursor. -# dsl: Go to window 2, go to the beginning of the line, use a line feed to -# scroll the window, and go back to window 1. -# is2: the string may cause a warning to be issued by tic that it -# found a very long line and that it suspects that a comma is missing -# somewhere. This warning can be ignored (unless it comes up more than -# once). The initialization string contains the following commands: -# -# [Setup mode items changed from factory defaults:] -# \E)0 set alternate character set to -# graphics -# ^O set character set to default -# [In case it wasn't] -# \E[m turn off all attributes -# [In case they weren't off] -# \E[=107; cursor wrap and -# 207h character wrap on -# \E[90;3u set Fkey definitions to "transmit" -# defaults -# \E[92;3u set cursor key definitions to -# "transmit" defaults -# \E[43;1u set shift F13 to transmit... -# \177\E$P\177 -# \E[44;1u set shift F14 to transmit... -# \177\E$Q\177 -# \E[45;1u set shift F15 to transmit... -# \177\E$R\177 -# \E[46;1u set shift F16 to transmit... -# \177\E$S\177 -# \E[200;1u set shift up to transmit... -# \177\E$A\177 -# \E[201;1u set shift down to transmit... -# \177\E$B\177 -# \E[202;1u set shift right to transmit... -# \177\E$C\177 -# \E[203;1u set shift left to transmit... -# \177\E$D\177 -# \E[204;1u set shift home to transmit... -# \177\E$H\177 -# \E[212;1u set backtab to transmit... -# \177\E$I\177 -# \E[213;1u set shift backspace to transmit... -# \177\E$^H\177 -# \E[214;1u set shift del to transmit... -# "\E$\177" -# [Necessary items not mentioned in setup mode:] -# \E[2!w move to window 2 -# \E[25;25w define window as line 25 of memory -# \E[!w move to window 1 -# \E[2*w show current line of window 2 as -# status line -# \E[2+x set meta key to use high bit -# \E[;3+} move underline to bottom of character -# -# All Fkeys are set to their default transmit definitions with \E[90;3u -# in is2=. IMPORTANT: to use this terminal definition, the "quit" stty -# setting MUST be redefined or deactivated, because the default is -# contained in almost all of this terminal's Fkey strings! If for some -# reason "quit" cannot be altered, the Fkeys can, but it would be -# necessary to change ^| to ^] in all of these definitions, and add -# \E[2;029!t to is2. -# lines: is set to 24 because this terminal refuses to treat the 25th -# line normally. -# ll: Not available in power on mode, but turned on with \E[=107;207h in -# is2=. -# lm: Pointless, given that this definition locks a single screen of -# memory into view, but what the hey... -# rmso: Could use \E[1;7!{ to turn off only bold and reverse (leaving any -# other attributes alone), but some programs expect this to turn off -# everything. -# rmul: Could use \E[4!{ to turn off only underline (leaving any other -# attributes alone), but some programs expect this to turn off -# everything. -# sgr: Attributes are set on this terminal with the string \E[ followed by -# a list of attribute code numbers (in decimal, separated by -# semicolons), followed by the character m. The attribute code -# numbers are: -# 1 for bold; -# 2 for dim (which is ignored in power on mode); -# 4 for underline; -# 5 for blinking; -# 7 for inverse; -# 8 for not displayable; and -# =99 for protected (except that there are strange side -# effects to protected characters which make them inadvisable). -# The mapping of terminfo parameters to attributes is as follows: -# %p1 (standout) = bold and inverse together; -# %p2 (underline) = underline; -# %p3 (reverse) = inverse; -# %p4 (blink) = blinking; -# %p5 (dim) is ignored; -# %p6 (bold) = bold; -# %p7 (invisible) = not displayable; -# %p8 (protected) is ignored; and -# %p9 (alt char set) = alt char set. -# The code to do this is: -# \E[0 OUTPUT \E[0 -# %?%p1%p6%O IF (standout; bold) OR -# %t;1 THEN OUTPUT ;1 -# %; ENDIF -# %?%p2 IF underline -# %t;4 THEN OUTPUT ;4 -# %; ENDIF -# %?%p4 IF blink -# %t;5 THEN OUTPUT ;5 -# %; ENDIF -# %?%p1%p3%O IF (standout; reverse) OR -# %t;7 THEN OUTPUT ;7 -# %; ENDIF -# %?%p7 IF invisible -# %t;8 THEN OUTPUT ;8 -# %; ENDIF -# m OUTPUT m -# %?%p9 IF altcharset -# %t^N THEN OUTPUT ^N -# %e^O ELSE OUTPUT ^O -# %; ENDIF -# sgr0: Everything is turned off (including alternate character set), since -# there is no way of knowing what it is that the program wants turned -# off. -# smul: The "underline" attribute is reconfigurable to an overline or -# strikethru, or (as done with \E[;3+} in is2=), to a line at the true -# bottom of the character cell. This was done to allow for more readable -# underlined characters, and to be able to distinguish between an -# underlined space, an underscore, and an underlined underscore. -# xenl: Terminal can be configured to not need this, but this "glitch" -# behavior is actually preferable with autowrap terminals. -# -# Parameters kf31= thru kf53= actually contain the strings sent by the shifted -# Fkeys. There are no parameters for shifted Fkeys in terminfo. The is2 -# string modifies the 'O' in kf43 to kf46 to a '$'. -# -# kcbt was originally ^I but redefined in is2=. -# kHOM was \E[H originally but redefined in is2=, as were a number of -# other keys. -# kDC was originally \177 but redefined in is2=. -# -# kbs: Shift was also ^H originally but redefined as \E$^H in is2=. -# tsl: Go to window 2, then do an hpa=. -# -#------- flash=\E[8;3!}^G\E[3;3!} -#------- flash=\E[?5h$<100>\E[?5l -# There are two ways to flash the screen, both of which have their drawbacks. -# The first is to set the bell mode to video, transmit a bell character, and -# set the bell mode back - but to what? There is no way of knowing what the -# user's old bell setting was before we messed with it. Worse, the command to -# set the bell mode also sets the key click volume, and there is no way to say -# "leave that alone", or to know what it's set to, either. -# The second way to do a flash is to set the screen to inverse video, pad for a -# tenth of a second, and set it back - but like before, there's no way to know -# that the screen wasn't ALREADY in inverse video, or that the user may prefer -# it that way. The point is moot anyway, since vi (and probably other -# programs) assume that by defining flash=, you want the computer to use it -# INSTEAD of bel=, rather than as a secondary type of signal. -# -#------- cvvis=\E[+{ -# The is the power on setting, which is also as visible as the cursor -# gets. -#------- wind=\E[%i%p1%d;%p2%d;%p3%{1}%+%d;%p4%{1}%+%dw -# Windowing is possible, but not defined here because it is also used to -# emulate status line functions. Allowing a program to set a window could -# clobber the status line or render it unusable. There is additional memory, -# but screen scroll functions are destructive and do not make use of it. -# -#------- dim= Not available in power on mode. -# You have a choice of defining low intensity characters as "half bright" and -# high intensity as "normal", or defining low as "normal" and high as "bold". -# No matter which you choose, only one of either "half bright" or "bold" is -# available at any time, so taking the time to override the default is -# pointless. -# -#------- prot=\E[=0;99m -# Not defined, because it appears to have some strange side effects. -#------- pfkey=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; -#------- pfloc=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%du\177%p2%s\177%; -#------- pfx=%?%p1%{24}%<%p1%{30}%>%p1%{54}%<%A%O%t\E[%p1%d;1u\177%p2%s\177%; -# Available, but making them available to programs is inadvisable. -# The code to do this is: -# %?%p1%{24}%< IF ((key; 24) <; -# %p1%{30}%> ((key; 30) >; -# %p1%{54}%< (key; 54) < -# %A ) AND -# %O ) OR -# [that is, "IF key < 24 OR (key > 30 AND key < 54)",] -# %t\E[ THEN OUTPUT \E[ -# %p1%d OUTPUT (key) as decimal -# [next line applies to pfx only] -# ;1 OUTPUT ;1 -# u OUTPUT u -# \177 OUTPUT \177 -# %p2%s OUTPUT (string) as string -# \177 OUTPUT \177 -# [DEL chosen as delimiter, but could be any character] -# [implied: ELSE do nothing] -# %; ENDIF -# -#------- rs2= -# Not defined since anything it might do could be done faster and easier with -# either Meta-Shift-Reset or the main power switch. -# -#------- smkx=\E[1!z -#------- rmkx=\E[!z -# These sequences apply to the cursor and setup keys only, not to the -# numeric keypad. But it doesn't matter anyway, since making these -# available to programs is inadvisable. -# For the key definitions below, all sequences beginning with \E$ are -# custom and programmed into the terminal via is2. \E$ also has no -# meaning to any other terminal. -# -#------- cmdch=\E[;%p1%d!t -# Available, but making it available to programs is inadvisable. -#------- smxon=\E[1*q -# Available, but making it available to programs is inadvisable. -# Terminal will send XON/XOFF on buffer overflow. -#------- rmxon=\E[*q -# Available, but making it available to programs is inadvisable. -# Terminal will not notify on buffer overflow. -#------- smm=\E[2+x -#------- rmm=\E[+x -# Available, but making them available to programs is inadvisable. -# -# Printing: -# It's not made clear in the manuals, but based on other ansi/vt type -# terminals, it's a good guess that this terminal is capable of both -# "transparent print" (which doesn't copy data to the screen, and -# therefore needs mc5i: specified to say so) and "auxilliary print" -# (which does duplicate printed data on the screen, in which case mc4= -# and mc5= should use the \E[?4i and \E[?5i strings instead). -# -# (esr: I have commented out is2 in order to avoid overflowing termcap's -# 1024-byte limit.) - -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -hds200|Human Designed Systems HDS200:\ - :am:bw:es:hs:km:mi:ms:xn:xo:\ - :co#80:it#8:li#24:lm#0:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:\ - :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[B:\ - :ds=\E[2\041w\r\n\E[\041w:ei=\E[4l:fs=\E[\041w:ho=\E[H:\ - :im=\E[4h:k1=^\001\r:k2=^\002\r:k3=^\003\r:k4=^\004\r:\ - :k5=^\005\r:k6=^\006\r:k7=^\007\r:k8=^\008\r:k9=^\009\r:\ - :kD=\177:kN=\E[U:kP=\E[V:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=\E[D:ll=\E[H\E[A:mb=\E[0;5m:\ - :md=\E[0;1m:me=\E[m\017:mr=\E[0;7m:nd=\E[C:nw=\E[E:rc=\E8:\ - :sc=\E7:se=\E[m\017:sf=\ED:so=\E[0;1;7m:sr=\EM:st=\EH:\ - :ta=^I:ts=\E[2\041w\E[%i%p1%dG:ue=\E[m\017:up=\E[A:\ - :us=\E[0;4m:ve=\E[+{:vi=\E[6+{: - -# :ta: through :ce: included to specify padding needed in raw mode. -# (avt-ns: added empty to suppress a tic warning --esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -avt-ns|concept avt no status line:\ - :am:bs:eo:mi:ul:xn:xo:\ - :co#80:it#8:li#24:lm#192:\ - :AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=\016:al=\E[L:as=\017:bl=^G:bt=\E[Z:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[2g:dc=\E[P:dl=\E[M:do=^J:ei=\E4l:\ - :ho=\E[H:i1=\E[=103l\E[=205l:ic=\E[@:im=\E1:ip=:\ - :is=\E[1*q\E[2\041t\E[7\041t\E[=4;101;119;122l\E[=107;118;207h\E)1\E[1Q\EW\E[\041y\E[\041z\E>\E[0\0720\07232\041r\E[0*w\E[w\E2\r\n\E[2;27\041t:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kD=\E^B\r:kI=\E^A\r:kb=^H:\ - :kd=\E[B:ke=\E[\041z\E[0;2u:kh=\E[H:kl=\E[D:kr=\E[C:\ - :ks=\E[1\041z\E[0;3u:ku=\E[A:le=^H:ll=\E[24H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mh=\E[1\041{:mr=\E[7m:nd=\E[C:rc=\E8:\ - :sc=\E7:se=\E[7\041{:sf=\n:so=\E[7m:sr=\EM:st=\EH:ta=\011:\ - :te=\E[w\E2\r\n:ti=\E[=4l\E[1;24w\E2\r:ue=\E[4\041{:\ - :up=\E[A:us=\E[4m:ve=\E[=119l:vs=\E[=119h: -avt-rv-ns|concept avt in reverse video mode/no status line:\ - :i1=\E[=103l\E[=205h:vb=\E[=205l\E[=205h:\ - :tc=avt-ns: -avt-w-ns|concept avt in 132 column mode/no status line:\ - :i1=\E[=103h\E[=205l:ti=\E[H\E[1;24;1;132w:\ - :tc=avt-ns: -avt-w-rv-ns|concept avt in 132 column mode/no status line/reverse video:\ - :i1=\E[=103h\E[=205h:ti=\E[H\E[1;24;1;132w:\ - :vb=\E[=205l\E[=205h:tc=avt-ns: - -# Concept AVT with status line. We get the status line using the -# "Background status line" feature of the terminal. We swipe the -# first line of memory in window 2 for the status line, keeping -# 191 lines of memory and 24 screen lines for regular use. -# The first line is used instead of the last so that this works -# on both 4 and 8 page AVTs. (Note the lm#191 or 192 - this -# assumes an 8 page AVT but lm isn't currently used anywhere.) -# -avt+s|concept avt status line changes:\ - :es:hs:\ - :lm#191:\ - :ds=\E[0*w:fs=\E[1;1\041w:\ - :i2=\E[2w\E[2\041w\E[1;1;1;80w\E[H\E[2*w\E[1\041w\E2\r\n:\ - :te=\E[2w\E2\r\n:ti=\E[2;25w\E2\r:\ - :ts=\E[2;1\041w\E[;%p1%dH\E[2K: -avt|avt-s|concept-avt|avt w/80 columns:\ - :tc=avt+s:tc=avt-ns: -avt-rv|avt-rv-s|avt reverse video w/sl:\ - :i1=\E[=103l\E[=205h:vb=\E[=205l\E[=205h:tc=avt+s:tc=avt-ns: -avt-w|avt-w-s|concept avt 132 cols+status:\ - :i1=\E[=103h\E[=205l:ti=\E[H\E[1;24;1;132w:tc=avt+s:tc=avt-ns: -avt-w-rv|avt-w-rv-s|avt wide+status+rv:\ - :i1=\E[=103h\E[=205h:ti=\E[H\E[1;24;1;132w:\ - :vb=\E[=205l\E[=205h:tc=avt+s:\ - :tc=avt-ns: - -#### Contel Business Systems. -# - -# Contel c300 and c320 terminals. -contel300|contel320|c300|Contel Business Systems C-300 or C-320:\ - :am:in:xo:\ - :co#80:li#24:sg#1:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EI:cl=\EK:cm=\EX%+ \EY%+ :cr=^M:\ - :ct=\E3:dc=\EO:dl=\EM:do=^J:ei=:ho=\EH:ic=\EN:im=:ip=:k0=\ERJ:\ - :k1=\ERA:k2=\ERB:k3=\ERC:k4=\ERD:k5=\ERE:k6=\ERF:k7=\ERG:\ - :k8=\ERH:k9=\ERI:kb=^H:le=^H:ll=\EH\EA:me=\E\041\0:nd=\EC:\ - :se=\E\041\0:sf=^J:so=\E\041\r:st=\E1:up=\EA:\ - :vb=\020\002\020\003: -# Contel c301 and c321 terminals. -contel301|contel321|c301|c321|Contel Business Systems C-301 or C-321:\ - :ei=:ic@:im=:ip@:se=\E\041\0:so=\E\041\r:vb@:\ - :tc=contel300: - -#### Data General (dg) -# -# According to James Carlson writing in January 1995, -# the terminals group at Data General was shut down in 1991; all these -# terminals have thus been discontinued. -# -# DG terminals have function keys that respond to the SHIFT and CTRL keys, -# e.g., SHIFT-F1 generates a different code from F1. To number the keys -# sequentially, first the unmodified key codes are listed as F1 through F15. -# Then their SHIFT versions are listed as F16 through F30, their CTRL versions -# are listed as F31 through F45, and their CTRL-SHIFT versions are listed as -# F46 through F60. This is done in the private "includes" below whose names -# start with "dgkeys+". -# -# DG terminals generally support 8 bit characters. For each of these terminals -# two descriptions are supplied: -# 1) A default description for 8 bits/character communications, which -# uses the default DG international character set and keyboard codes. -# 2) A description with suffix "-7b" for 7 bits/character communications. -# This description must use the NON-DEFAULT native keyboard language. - -# Unmodified fkeys (kf1-kf11), Shift fkeys (kf12-kf22), Ctrl fkeys (kf23-kf33), -# Ctrl/Shift fdkeys (kf34-kf44). - -# Most of these entries are `official' and came from DG. Others are marked. - -dgkeys+8b|Private entry describing DG terminal 8-bit ANSI mode special keys:\ - :%9=\233i:F1=\233011z:F2=\233012z:F3=\233013z:\ - :F4=\233014z:F5=\233000z:F6=\233101z:F7=\233102z:\ - :F8=\233103z:F9=\233104z:FA=\233105z:FB=\233106z:\ - :FC=\233107z:FD=\233108z:FE=\233109z:FF=\233110z:\ - :FG=\233111z:FH=\233112z:FI=\233113z:FJ=\233114z:\ - :FK=\233100z:FL=\233201z:FM=\233202z:FN=\233203z:\ - :FO=\233204z:FP=\233205z:FQ=\233206z:FR=\233207z:\ - :FS=\233208z:FT=\233209z:FU=\233210z:FV=\233211z:\ - :FW=\233212z:FX=\233213z:FY=\233214z:FZ=\233200z:\ - :Fa=\233301z:Fb=\233302z:Fc=\233303z:Fd=\233304z:\ - :Fe=\233305z:Ff=\233306z:Fg=\233307z:Fh=\233308z:\ - :Fi=\233309z:Fj=\233310z:Fk=\233311z:Fl=\233312z:\ - :Fm=\233313z:Fn=\233314z:Fo=\233300z:K1=\233020z:\ - :K3=\233021z:K4=\233022z:K5=\233023z:k1=\233001z:\ - :k2=\233002z:k3=\233003z:k4=\233004z:k5=\233005z:\ - :k6=\233006z:k7=\233007z:k8=\233008z:k9=\233009z:\ - :k;=\233010z:kC=\2332J:kE=\233K:kd=\233B:kh=\233H:\ - :kl=\233D:kr=\233C:ku=\233A: - -dgkeys+7b|Private entry describing DG terminal 7-bit ANSI mode special keys:\ - :%9=\E[i:F1=\E[011z:F2=\E[012z:F3=\E[013z:F4=\E[014z:\ - :F5=\E[000z:F6=\E[101z:F7=\E[102z:F8=\E[103z:F9=\E[104z:\ - :FA=\E[105z:FB=\E[106z:FC=\E[107z:FD=\E[108z:FE=\E[109z:\ - :FF=\E[110z:FG=\E[111z:FH=\E[112z:FI=\E[113z:FJ=\E[114z:\ - :FK=\E[100z:FL=\E[201z:FM=\E[202z:FN=\E[203z:FO=\E[204z:\ - :FP=\E[205z:FQ=\E[206z:FR=\E[207z:FS=\E[208z:FT=\E[209z:\ - :FU=\E[210z:FV=\E[211z:FW=\E[212z:FX=\E[213z:FY=\E[214z:\ - :FZ=\E[200z:Fa=\E[301z:Fb=\E[302z:Fc=\E[303z:Fd=\E[304z:\ - :Fe=\E[305z:Ff=\E[306z:Fg=\E[307z:Fh=\E[308z:Fi=\E[309z:\ - :Fj=\E[310z:Fk=\E[311z:Fl=\E[312z:Fm=\E[313z:Fn=\E[314z:\ - :Fo=\E[300z:K1=\E[020z:K3=\E[021z:K4=\E[022z:K5=\E[023z:\ - :k1=\E[001z:k2=\E[002z:k3=\E[003z:k4=\E[004z:k5=\E[005z:\ - :k6=\E[006z:k7=\E[007z:k8=\E[008z:k9=\E[009z:k;=\E[010z:\ - :kC=\E[2J:kE=\E[K:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A: - -dgkeys+11|Private entry describing 11 minimal-subset DG mode special keys:\ - :F1=^^{:F2=^^a:F3=^^b:F4=^^c:F5=^^d:F6=^^e:F7=^^f:F8=^^g:\ - :F9=^^h:FA=^^i:FB=^^j:FC=^^k:FD=^^1:FE=^^2:FF=^^3:FG=^^4:\ - :FH=^^5:FI=^^6:FJ=^^7:FK=^^8:FL=^^9:FM=^^\072:FN=^^;:\ - :FO=^^\041:FP=^^":FQ=^^#:FR=^^$:FS=^^%:FT=^^&:FU=^^':FV=^^(:\ - :FW=^^):FX=^^*:FY=^^+:k1=^^q:k2=^^r:k3=^^s:k4=^^t:k5=^^u:\ - :k6=^^v:k7=^^w:k8=^^x:k9=^^y:k;=^^z:kC=^L:kE=^K:kd=^Z:kh=^H:\ - :kl=^Y:kr=^X:ku=^W: - -dgkeys+15|Private entry describing 15 DG mode special keys:\ - :#2=^^^H:#4=^^^Y:%i=^^^X:F1=^^{:F2=^^|:F3=^^}:F4=^^~:F5=^^p:\ - :F6=^^a:F7=^^b:F8=^^c:F9=^^d:FA=^^e:FB=^^f:FC=^^g:FD=^^h:\ - :FE=^^i:FF=^^j:FG=^^k:FH=^^l:FI=^^m:FJ=^^n:FK=^^`:FL=^^1:\ - :FM=^^2:FN=^^3:FO=^^4:FP=^^5:FQ=^^6:FR=^^7:FS=^^8:FT=^^9:\ - :FU=^^\072:FV=^^;:FW=^^<:FX=^^=:FY=^^>:FZ=^^0:Fa=^^\041:\ - :Fb=^^":Fc=^^#:Fd=^^$:Fe=^^%:Ff=^^&:Fg=^^':Fh=^^(:Fi=^^):\ - :Fj=^^*:Fk=^^+:Fl=^^\054:Fm=^^-:Fn=^^.:Fo=^^ :K1=^^\:K3=^^]:\ - :K4=^^\136:K5=^^_:k1=^^q:k2=^^r:k3=^^s:k4=^^t:k5=^^u:k6=^^v:\ - :k7=^^w:k8=^^x:k9=^^y:k;=^^z: - -# Data General color terminals use the "Tektronix" color model. The total -# number of colors varies with the terminal model, as does support for -# attributes used in conjunction with color. - -# Removed u7, u8 definitions since they conflict with tack: -# Preserve user-defined colors in at least some cases. -# u7=^^Fh, -# Default is ACM mode. -# u8=^^F}20^^Fi^^F}21, -# -dgunix+fixed|Fixed color info for DG D430C terminals in DG-UNIX mode:\ - :ut:\ - :Co#16:NC#53:pa#256:\ - :AB=\036B%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c:\ - :AF=\036A%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c:\ - :Sb=\036B%+0:Sf=\036A%+0:op=\036Ad\036Bd: - -dg+fixed|Fixed color info for DG D430C terminals in DG mode:\ - :tc=dgunix+fixed: - -# Video attributes are coordinated using static variables set by "sgr", then -# checked by "op", "seta[bf]", and "set[bf]" to refresh the attribute settings. -# (D=dim, U=underline, B=blink, R=reverse.) -dg+color8|Color info for Data General D220 and D230C terminals in ANSI mode:\ - :ut:\ - :Co#8:NC#16:pa#64:\ - :AB=\E[4%p1%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m:\ - :AF=\E[3%p1%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m:\ - :..Sb=\E[4%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m:\ - :..Sf=\E[3%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m:\ - :op=\E[%?%gD%t2;%;%?%gU%t4;%;%?%gB%t5;%;%?%gR%t7;%;m: - -dg+color|Color info for Data General D470C terminals in ANSI mode:\ - :Co#16:NC#53:pa#256:\ - :AB=\E[%?%p1%{8}%<%t4%p1%e=%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m:\ - :AF=\E[%?%p1%{8}%<%t3%p1%e<%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m:\ - :..Sb=\E[%?%p1%{8}%<%t4%e=%;%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m:\ - :..Sf=\E[%?%p1%{8}%<%t3%e<%;%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%d%?%gD%t;2%;%?%gU%t;4%;%?%gB%t;5%;%?%gR%t;7%;m:\ - :tc=dg+color8: - -dgmode+color8|Color info for Data General D220/D230C terminals in DG mode:\ - :ut:\ - :Co#8:NC#16:pa#64:\ - :AB=\036B%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%{48}%+%c:\ - :AF=\036A%p1%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%{48}%+%c:\ - :Sb=\036B%+0:Sf=\036A%+0:op=\036Ad\036Bd: - -dgmode+color|Color info for Data General D470C terminals in DG mode:\ - :Co#16:pa#256:\ - :AB=\036B%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c:\ - :AF=\036A%p1%?%p1%{8}%<%t%{2}%&%?%p1%{1}%&%t%{4}%|%;%?%p1%{4}%&%t%{1}%|%;%;%{48}%+%c:\ - :tc=dgmode+color8: - -dgunix+ccc|Configurable color info for DG D430C terminals in DG-UNIX mode:\ - :cc:ut:\ - :Co#52:NC#53:pa#26:\ - :..Ip=\036RG0%p1%02X%p2%{256}%*%{1001}%/%02X%p3%{256}%*%{1001}%/%02X%p4%{256}%*%{1001}%/%02X%p5%{256}%*%{1001}%/%02X%p6%{256}%*%{1001}%/%02X%p7%{256}%*%{1001}%/%02X:\ - :oc=\036RG01A00FF00000000\036RG01B00000000FF00\036RG01C007F00000000\036RG01D000000007F00:\ - :op=\036RF4831A\036RF2E31B\036RF1D31C\036RF3F31D:\ - :..sp=\036RG2%p1%02X: - -# Colors are in the order: normal, reverse, dim, dim + reverse. -dg+ccc|Configurable color info for DG D430C terminals in DG mode:\ - :cc:ut:\ - :Co#52:NC#53:pa#26:\ - :..Ip=\036RG0%p1%{16}%/%{48}%+%c%p1%{16}%m%{48}%+%c%p2%{256}%*%{1001}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p3%{256}%*%{1001}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p4%{256}%*%{1001}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p5%{256}%*%{1001}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p6%{256}%*%{1001}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c%p7%{256}%*%{1001}%/%Pa%ga%{16}%/%{48}%+%c%ga%{16}%m%{48}%+%c:\ - :oc=\036RG01\07200??00000000\036RG01;00000000??00\036RG01<007?00000000\036RG01=000000007?00:\ - :op=\036RF4831\072\036RF2>31;\036RF1=31<\036RF3?31=:\ - :sp=\036RG2%+^P%+^P: - -# The generic DG terminal type (an 8-bit-clean subset of the 6053) -# Initialization string 1 sets: -# ^R - vertical scrolling enabled -# ^C - blinking enabled -dg-generic|Generic Data General terminal in DG mode:\ - :NL:am:bw:ms:xo:\ - :co#80:li#24:\ - :bl=^G:ce=^K:cl=^L:cm=\020%r%.%.:cr=^M:do=^Z:i1=^R^C:le=^Y:\ - :mb=^N:me=^O^U^]:mh=^\:nd=^X:nw=^J:ps=^Q:se=^]:sf=^J:so=^\:\ - :ue=^U:up=^W:us=^T:\ - :tc=dgkeys+11: - -# (Some performance can be gained over the generic DG terminal type) -dg6053|6053|6053-dg|dg605x|605x|605x-dg|d2|d2-dg|Data General DASHER 6053:\ - :xo@:\ - :ho=^P\0\0:ll=^P\0^W:tc=dg-generic: - -# Like 6053, but adds reverse video and more keypad and function keys. -d200|d200-dg|Data General DASHER D200:\ - :ho@:ll@:md=^^D^T:me=\017\025\035\036E:mr=^^D:\ - :..sa=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;:\ - :se=^^E^]:so=^^D^\:\ - :tc=dgkeys+15:tc=dg6053: - -# DASHER D210 series terminals in ANSI mode. -# Reverse video, no insert/delete character/line, 7 bits/character only. -# -# Initialization string 1 sets: -# <0 - scrolling enabled -# <1 - blink enabled -# <4 - print characters regardless of attributes -d210|d214|Data General DASHER D210 series:\ - :NL:am:bw:ms:xo:\ - :co#80:li#24:\ - :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bl=^G:cb=\E[1K:\ - :cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%d;%dH:cr=^M:do=\E[B:\ - :ho=\E[H:i1=\E[<0;<1;<4l:le=^H:ll=\E[H\E[A:mb=\E[5m:\ - :md=\E[4;7m:me=\E[m:mh=\E[2m:mr=\E[7m:nd=\E[C:nw=^J:\ - :..sa=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m:\ - :se=\E[m:sf=^J:so=\E[2;7m:ue=\E[m:up=\E[A:us=\E[4m:\ - :tc=dgkeys+7b: - -# DASHER D210 series terminals in DG mode. -# Like D200, but adds clear to end-of-screen and needs XON/XOFF. -d210-dg|d214-dg|Data General DASHER D210 series in DG mode:\ - :xo:\ - :cd=^^FF:tc=d200: - -# DASHER D211 series terminals in ANSI mode. -# Like the D210, but with 8-bit characters and local printer support. -# -# Initialization string 2 sets: -# \E[2;1;1;1v -# 2;1 - 8 bit operations -# 1;1 - 8 bit (international) keyboard language -# \E(B - default primary character set (U.S. ASCII) -# \E)4 - default secondary character set (international) -# ^O - primary character set -# -d211|d215|Data General DASHER D211 series:\ - :km:\ - :is=\E[2;1;1;1v\E(B\E)4\017:ps=\E[i:tc=dgkeys+8b:tc=d210: - -# Initialization string 2 sets: -# \E[2;0;1;0v -# 2;0 - 7 bit operations -# 1;0 - 7 bit (native) keyboard language -# \E(0 - default character set (the keyboard native language) -# ^O - primary character set -d211-7b|d215-7b|Data General DASHER D211 series in 7 bit mode:\ - :km@:\ - :is=\E[2;0;1;0v\E(0\017:tc=dgkeys+7b:tc=d211: - -# Like the D210 series, but adds support for 8-bit characters. -# -# Reset string 2 sets: -# ^^N - secondary character set -# ^^FS0> - 8 bit international character set -# ^^O - primary character set -# ^^FS00 - default character set (matching the native keyboard language) -# -d211-dg|d215-dg|Data General DASHER D211 series in DG mode:\ - :km:\ - :r2=\036N\036FS0>\036O\036FS00:tc=d210-dg: - -d216-dg|d216e-dg|d216+dg|d216e+dg|d217-dg|Data General DASHER D216 series in DG mode:\ - :tc=d211-dg: - -# Enhanced DG mode with changes to be more UNIX compatible. -d216-unix|d216e-unix|d216+|d216e+|Data General DASHER D216+ in DG-UNIX mode:\ - :5i:\ - :it#8:\ - :#2=^^Pf:#4=^^Pd:%9=^^P0:%f=^^P1:%i=^^Pc:\ - :ac=a\177j$k"l\041m#n)q+t'u&v(w%x*:ae=\036FS00:\ - :as=\036FS11:ce=^^PE:ch=\020%.\177:cl=^^PH:cv=\020\177%.:\ - :do=^^PB:ho=^^PF:i1=\022\003\036P@1:i2=\036Fz0:kC=^^PH:\ - :kE=^^PE:kd=^^PB:kh=^^PF:kl=^^PD:kr=^^PC:ku=^^PA:le=^^PD:\ - :mb=^^PI:me=\036PJ\025\035\036E\036FS00:nd=^^PC:pf=^^Fa:\ - :po=^^F`:ps=\036F?9:r2=\036N\036FS0E\036O\036FS00:\ - :..sa=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;\036P%?%p4%tI%eJ%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t11%e00%;:\ - :sf=^J:ta=^I:up=^^PA:\ - :tc=dgkeys+15:tc=d216-dg: -d216-unix-25|d216+25|Data General DASHER D216+ in DG-UNIX mode with 25 lines:\ - :li#25:\ - :i2=\036Fz2:tc=d216+: - -d217-unix|Data General DASHER D217 in DG-UNIX mode:\ - :tc=d216-unix: -d217-unix-25|Data General DASHER D217 in DG-UNIX mode with 25 lines:\ - :tc=d216-unix-25: - -# DASHER D220 color terminal in ANSI mode. -# Like the D470C but with fewer colors and screen editing features. -# -# Initialization string 1 sets: -# \E[<0;<1;<4l -# <0 - scrolling enabled -# <1 - blink enabled -# <4 - print characters regardless of attributes -# \E[m - all attributes off -# Reset string 1 sets: -# \Ec - initial mode defaults (RIS) -# -d220|Data General DASHER D220:\ - :5i@:\ - :AL@:DL@:al@:dl@:i1=\E[<0;<1;<4l\E[m:pf@:po@:r1=\Ec:tc=dg+color8:tc=d470c: - -d220-7b|Data General DASHER D220 in 7 bit mode:\ - :5i@:\ - :AL@:DL@:al@:dl@:i1=\E[<0;<1;<4l\E[m:pf@:po@:r1=\Ec:tc=dg+color8:tc=d470c-7b: - -# Initialization string 3 sets: -# - default cursor (solid rectangle) -# Reset string 2 sets: -# ^^N - secondary character set -# ^^FS0> - 8 bit international character set -# ^^O - primary character set -# ^^FS00 - default character set (matching the native keyboard language) -# -d220-dg|Data General DASHER D220 color terminal in DG mode:\ - :5i@:\ - :al@:dl@:ho@:i2=\036FQ2:is@:ll@:pf@:po@:r1@:\ - :r2=\036N\036FS0>\036O\036FS00:tc=dgmode+color8:\ - :tc=d470c-dg: - -# DASHER D230C color terminal in ANSI mode. -# Like the D220 but with minor ANSI compatibility improvements. -# -d230c|d230|Data General DASHER D230C:\ - :ke=\E[2;1v:ks=\E[2;0v:mb=\E[5;50m:md=\E[4;7;50m:\ - :me=\E[50m\E)4\017:mh=\E[2;50m:mr=\E[7;50m:nw=^M^J:\ - :..sa=\E[50%?%p1%p3%|%p6%|%t;7%{1}%e%{0}%;%PR%?%p4%t;5%{1}%e%{0}%;%PB%?%p2%p6%|%t;4%{1}%e%{0}%;%PU%?%p1%p5%|%t;2%{1}%e%{0}%;%PDm\E)%?%p9%t6\016%e4\017%;:\ - :se=\E[50m:so=\E[2;7;50m:ue=\E[50m:us=\E[4;50m:\ - :tc=dgkeys+7b:tc=d220: - -d230c-dg|d230-dg|Data General DASHER D230C in DG mode:\ - :tc=d220-dg: - -# DASHER D400/D450 series terminals. -# These add intelligent features like insert/delete to the D200 series. -# -# Initialization string 2 sets: -# ^^FQ2 - default cursor (solid rectangle) -# ^^FW - character protection disabled -# ^^FJ - normal (80 column) mode -# ^^F\^ - horizontal scrolling enabled (for alignment) -# ^^FX004? - margins at columns 0 and 79 -# ^^F] - horizontal scrolling disabled -# ^^O - primary character set -# ^^FS00 - default character set (the keyboard native language) -# - (should reset scrolling regions, but that glitches the screen) -# Reset string 1 sets: -# ^^FA - all terminal defaults except scroll rate -# Reset string 2 sets: -# ^^F] - horizontal scrolling disabled -# ^^FT0 - jump scrolling -# -d400|d400-dg|d450|d450-dg|Data General DASHER D400/D450 series:\ - :5i:\ - :ac=j$k"l\041m#n)q+t'u&v(w%x*:ae=^^O:al=^^FH:as=^^N:\ - :ch=\020%.\177:cv=\020\177%.:dc=^^K:dl=^^FI:\ - :eA=\036N\036FS11\036O:ei=:ho=^^FG:ic=^^J:im=:\ - :is=\036FQ2\036FW\036FJ\036F\136\036FX004?\036F]\036O\036FS00:\ - :ll=\036FG\027:me=\017\025\035\036E\036O:pf=^^Fa:\ - :po=^^F`:r1=^^FA:r2=\036F]\036FT0:\ - :..sa=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;\036%?%p9%tN%eO%;:\ - :sr=^^I:ve=\036FQ2:vi=\036FQ0:\ - :tc=d210-dg: - -# DASHER D410/D460 series terminals in ANSI mode. -# These add a large number of intelligent terminal features. -# -# Initialization string 1 sets: -# \E[<0;<1;<2;<4l -# <0 - scrolling enabled -# <1 - blink enabled -# <2 - horizontal scrolling enabled (for alignment) -# <4 - print characters regardless of attributes -# \E[5;0v - normal (80 column) mode -# \E[1;1;80w - margins at columns 1 and 80 -# \E[1;6;<2h -# 1 - print all characters even if protected -# 6 - character protection disabled -# <2 - horizontal scrolling disabled -# - (should reset scrolling regions, but that glitches the screen) -# -# Initialization string 2 sets: -# \E[3;2;2;1;1;1v -# 3;2 - default cursor (solid rectangle) -# 2;1 - 8 bit operations -# 1;1 - international keyboard language -# \E(B - default primary character set (U.S. ASCII) -# \E)4 - default secondary character set (international) -# ^O - primary character set -# -# Reset string 1 sets: -# \Ec - initial mode defaults (RIS) -# \E[<2h - horizontal scrolling disabled -# -# Reset string 2 sets: -# \E[4;0;2;1;1;1v -# 4;0 - jump scrolling -# 2;1 - 8 bit operations -# 1;1 - 8 bit (international) keyboard language -# \E(B - default primary character set (U.S. ASCII) -# \E)4 - default secondary character set (international) -# -d410|d411|d460|d461|Data General DASHER D410/D460 series:\ - :5i:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:\ - :ac=j$k"l\041m#n)q+t'u&v(w%x*:ae=\E)4\017:al=\E[L:\ - :as=\E)6\016:dc=\E[P:dl=\E[M:ei=:\ - :i1=\E[<0;<1;<2;<4l\E[5;0v\E[1;1;80w\E[1;6;<2h:\ - :ic=\E[@:im=:is=\E[3;2;2;1;1;1v\E(B\E)4\017:\ - :me=\E[m\E)4\017:pf=\E[4i:po=\E[5i:r1=\Ec\E[<2h:\ - :r2=\E[4;0;2;1;1;1v\E(B\E)4:\ - :..sa=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m\E)%?%p9%t6\016%e4\017%;:\ - :sr=\EM:ve=\E[3;2v:vi=\E[3;0v:\ - :tc=d211: - -# Initialization string 2 sets: -# \E[3;2;2;0;1;0v -# 3;2 - default cursor (solid rectangle) -# 2;0 - 7 bit operations -# 1;0 - 7 bit (native) keyboard language -# \E(0 - default character set (the keyboard native language) -# ^O - primary character set -# -# Reset string 2 sets: -# \E[4;0;2;0;1;0v -# 4;0 - jump scrolling -# 2;0 - 7 bit operations -# 1;0 - 7 bit (native) keyboard language -# \E(0 - default character set (the keyboard native language) -# -d410-7b|d411-7b|d460-7b|d461-7b|Data General DASHER D410/D460 series in 7 bit mode:\ - :km@:\ - :ae=^O:as=^N:eA=\E)6:is=\E[3;2;2;0;1;0v\E(0\017:\ - :me=\E[m\017:r2=\E[4;0;2;0;1;0v\E(0:\ - :..sa=\E[%?%p1%p3%|%p6%|%t7;%;%?%p4%t5;%;%?%p2%p6%|%t4;%;%?%p1%p5%|%t2;%;m%?%p9%t\016%e\017%;:tc=dgkeys+7b:\ - :tc=d410: - -d410-dg|d460-dg|d411-dg|d461-dg|Data General DASHER D410/D460 series in DG mode:\ - :km:\ - :ae=\036FS00:as=\036FS11:eA@:\ - :me=\017\025\035\036E\036FS00:\ - :..sa=\036%?%p1%p3%|%p6%|%tD%eE%;%?%p2%p6%|%t\024%e\025%;%?%p4%t\016%e\017%;%?%p1%p5%|%t\034%e\035%;\036FS%?%p9%t11%e00%;:tc=d400-dg: - -# DASHER D410/D460 series terminals in wide (126 columns) ANSI mode. -# -# Initialization string 1 sets: -# \E[<0;<1;<2;<4l -# <0 - scrolling enabled -# <1 - blink enabled -# <2 - horizontal scrolling enabled (for alignment) -# <4 - print characters regardless of attributes -# \E[5;1v - compressed (135 column) mode -# \E[1;1;126 - margins at columns 1 and 126 -# \E[1;6;<2h -# 1 - print all characters even if protected -# 6 - character protection disabled -# <2 - horizontal scrolling disabled -# - (should reset scrolling regions, but that glitches the screen) -# -# Reset string 1 sets: -# \Ec - initial mode defaults (RIS) -# \E[5;1v - compressed (135 column) mode -# \E[1;1;126w - margins at columns 1 and 126 -# \E[<2h - horizontal scrolling disabled -# -d410-w|d411-w|d460-w|d461-w|Data General DASHER D410/D460 series in wide mode:\ - :co#126:\ - :i1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h:\ - :r1=\Ec\E[5;1v\E[1;1;126w\E[<2h:\ - :tc=d410: - -d410-7b-w|d411-7b-w|d460-7b-w|d461-7b-w|Data General DASHER D410/D460 series in wide 7 bit mode:\ - :co#126:\ - :i1=\E[<0;<1;<2;<4l\E[5;1v\E[1;1;126w\E[1;6;<2h:\ - :r1=\Ec\E[5;1v\E[1;1;126w\E[<2h:\ - :tc=d410-7b: - -d412-dg|d462-dg|d462e-dg|d412+dg|d462+dg|d413-dg|d463-dg|Data General DASHER D412/D462 series in DG mode:\ - :tc=d410-dg: - -# These add intelligent features like scrolling regions. -d412-unix|d462-unix|d412+|d462+|Data General DASHER D412+/D462+ series in Unix mode:\ - :al=^^FH:ch=\036FP%2.2XFF:cl=^^FE:cm=\036FP%r%2.2X%2.2X:\ - :cv=\036FPFF%2.2X:dc=^^K:dl=^^FI:ei=:ho=^^FG:ic=^^J:im=:\ - :is=\036FQ5\036FW\036FJ\036F\136\036FX004F\036O\036FS00:\ - :ll=\036FG\036PA:ps=^A:r1=\036FA\036FT0:r2=\036P@1:\ - :rc=\036F}11:sc=\036F}10:sr=^^I:ve=\036FQ5:vi=\036FQ0:\ - :..wi=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X:\ - :tc=d216+: -d412-unix-w|d462-unix-w|d412+w|d462+w|Data General DASHER D412+/D462+ series in wide Unix mode:\ - :co#132:\ - :is=\036FQ5\036FW\036FK\036F\136\036FX0083\036O\036FS00:\ - :r2=\036P@1\036FK\036FX0083:\ - :..wi=\036FB%?%p1%t%p1%2.2X1%;%p2%p1%-%{1}%+%2.2X1%?%{23}%p2%>%t001%;\036FX%p3%2.2X%p4%2.2X:tc=d412-unix: -d412-unix-25|d462-unix-25|d412+25|d462+25|Data General DASHER D412+/D462+ series in Unix mode with 25 lines:\ - :li#25:\ - :i2=\036Fz2:\ - :..wi=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{24}%p2%>%t000%;\036FX%p3%2.2X%p4%2.2X:tc=d462+: -d412-unix-s|d462-unix-s|d412+s|d462+s|Data General DASHER D412+/D462+ in Unix mode with status line:\ - :es:hs:\ - :cl=\036FG\036PH:fs=\036F}01\022:\ - :i2=\036Fz2\036F}00\036FB180000\036F}01:ll@:\ - :ts=\036F}00\036FP%p1%2.2X18\036PG:\ - :..wi=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t%{23}%p2%-%2.2X0%;000\036FX%p3%2.2X%p4%2.2X:tc=d462+: - -# Relative cursor motions are confined to the current window, -# which is not what the scrolling region specification expects. -# Thus, relative vertical cursor positioning must be deleted. -d412-unix-sr|d462-unix-sr|d412+sr|d462+sr|Data General DASHER D412+/D462+ in Unix mode with scrolling region:\ - :..cs=\036FB%?%p1%t%p1%2.2X0%;%p2%p1%-%{1}%+%2.2X0%?%{23}%p2%>%t000%;:\ - :do@:ll@:up@:\ - :tc=d462+: - -d413-unix|d463-unix|Data General DASHER D413/D463 series in DG-UNIX mode:\ - :tc=d412-unix: -d413-unix-w|d463-unix-w|Data General DASHER D413/D463 series in wide DG-UNIX mode:\ - :tc=d412-unix-w: -d413-unix-25|d463-unix-25|Data General DASHER D413/D463 series in DG-UNIX mode with 25 lines:\ - :tc=d412-unix-25: -d413-unix-s|d463-unix-s|Data General DASHER D413/D463 in DG-UNIX mode with status line:\ - :tc=d412-unix-s: -d413-unix-sr|d463-unix-sr|Data General DASHER D413/D463 in DG-UNIX mode with scrolling region:\ - :tc=d412-unix-sr: - -d414-unix|d464-unix|Data General D414/D464 in DG-UNIX mode:\ - :tc=d413-unix: -d414-unix-w|d464-unix-w|Data General D414/D464 in wide DG-UNIX mode:\ - :tc=d413-unix-w: -d414-unix-25|d464-unix-25|Data General D414/D464 in DG-UNIX mode with 25 lines:\ - :tc=d413-unix-25: -d414-unix-s|d464-unix-s|Data General D414/D464 in DG-UNIX mode with status line:\ - :tc=d413-unix-s: -d414-unix-sr|d464-unix-sr|Data General D414/D464 in DG-UNIX mode with scrolling region:\ - :tc=d413-unix-sr: - -d430c-dg|d430-dg|Data General D430C in DG mode:\ - :tc=d413-dg:tc=dg+fixed: -d430c-dg-ccc|d430-dg-ccc|Data General D430C in DG mode with configurable colors:\ - :tc=d413-dg:tc=dg+ccc: - -d430c-unix|d430-unix|Data General D430C in DG-UNIX mode:\ - :tc=d413-unix:tc=dgunix+fixed: -d430c-unix-w|d430-unix-w|Data General D430C in wide DG-UNIX mode:\ - :tc=d413-unix-w:tc=dgunix+fixed: -d430c-unix-25|d430-unix-25|Data General D430C in DG-UNIX mode with 25 lines:\ - :tc=d413-unix-25:tc=dgunix+fixed: -d430c-unix-s|d430-unix-s|Data General D430C in DG-UNIX mode with status line:\ - :tc=d413-unix-s:tc=dgunix+fixed: -d430c-unix-sr|d430-unix-sr|Data General D430C in DG-UNIX mode with scrolling region:\ - :tc=d413-unix-sr:tc=dgunix+fixed: -d430c-unix-ccc|d430-unix-ccc|Data General D430C in DG-UNIX mode with configurable colors:\ - :tc=d413-unix:tc=dgunix+ccc: -d430c-unix-w-ccc|d430-unix-w-ccc|Data General D430C in wide DG-UNIX mode with configurable colors:\ - :tc=d413-unix-w:tc=dgunix+ccc: -d430c-unix-25-ccc|d430-unix-25-ccc|Data General D430C in DG-UNIX mode with 25 lines and configurable colors:\ - :tc=d413-unix-25:tc=dgunix+ccc: -d430c-unix-s-ccc|d430-unix-s-ccc|Data General D430C in DG-UNIX mode with status line and configurable colors:\ - :tc=d413-unix-s:tc=dgunix+ccc: -d430c-unix-sr-ccc|d430-unix-sr-ccc|Data General D430C in DG-UNIX mode with scrolling region and configurable colors:\ - :tc=d413-unix-sr:tc=dgunix+ccc: - -# dg450 from Cornell (not official) -dg450|dg6134|data general 6134:\ - :le@:nd=^X:tc=dg200: - -# Not official... -# Note: lesser Dasher terminals will not work with vi because vi insists upon -# having a command to move straight down from any position on the bottom line -# and scroll the screen up, or a direct vertical scroll command. The 460 and -# above have both, the D210/211, for instance, has neither. We must use ANSI -# mode rather than DG mode because standard UNIX tty drivers assume that ^H is -# backspace on all terminals. This is not so in DG mode. -# (dg460-ansi: removed obsolete ":kn#6:"; also removed ":mu=\EW:", on the -# grounds that there is no matching ":ml:" -# fixed garbled ":k9=\E[00\:z:" capability -- esr) -dg460-ansi|Data General Dasher 460 in ANSI-mode:\ - :am:bs:ms:ul:\ - :co#80:it#8:li#24:\ - :al=\E[L:cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%2;%2H:dc=\E[P:\ - :dl=\E[M:do=\E[B:ei=:ho=\E[H:ic=\E[@:im=:is=^^F@:k0=\E[001z:\ - :k1=\E[002z:k2=\E[003z:k3=\E[004z:k4=\E[005z:k5=\E[006z:\ - :k6=\E[007z:k7=\E[008z:k8=\E[009z:k9=\E[010z:kb=\E[D:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:l0=f1:l1=f2:l2=f3:\ - :l3=f4:l4=f5:l5=f6:l6=f7:l7=f8:l9=f10:le=^H:mb=\E[5m:me=\E[m:\ - :mh=\E[2m:mr=\E[7m:nd=\E[C:nl=\ED:se=\E[m:sf=\E[S:so=\E[7m:\ - :sr=\E[T:ta=^I:ue=\E[05:up=\E[A:us=\E[4m: - -# DASHER D470C color terminal in ANSI mode. -# Like the D460 but with 16 colors and without a compressed mode. -# -# Initialization string 1 sets: -# \E[<0;<1;<2;<4l -# <0 - scrolling enabled -# <1 - blink enabled -# <2 - horizontal scrolling enabled (for alignment) -# <4 - print characters regardless of attributes -# \E[1;1;80w - margins at columns 1 and 80 -# \E[1;6;<2h -# 1 - print all characters even if protected -# 6 - character protection disabled -# <2 - horizontal scrolling disabled -# - (should reset scrolling regions, but that glitches the screen) -# -d470c|d470|Data General DASHER D470C:\ - :i1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h:\ - :..sa=\E[%?%p1%p3%|%p6%|%t7;%{1}%e%{0}%;%PR%?%p4%t5;%{1}%e%{0}%;%PB%?%p2%p6%|%t4;%{1}%e%{0}%;%PU%?%p1%p5%|%t2;%{1}%e%{0}%;%PDm\E)%?%p9%t6\016%e4\017%;:tc=dg+color:\ - :tc=d460: - -d470c-7b|d470-7b|Data General DASHER D470C in 7 bit mode:\ - :i1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h:\ - :..sa=\E[%?%p1%p3%|%p6%|%t7;%{1}%e%{0}%;%PR%?%p4%t5;%{1}%e%{0}%;%PB%?%p2%p6%|%t4;%{1}%e%{0}%;%PU%?%p1%p5%|%t2;%{1}%e%{0}%;%PDm%?%p9%t\016%e\017%;:tc=dg+color:\ - :tc=d460-7b: - -# Initialization string 2 sets: -# ^^FQ2 - default cursor (solid rectangle) -# ^^FW - character protection disabled -# ^^F\^ - horizontal scrolling enabled (for alignment) -# ^^FX004? - margins at columns 0 and 79 -# ^^F] - horizontal scrolling disabled -# ^^O - primary character set -# ^^FS00 - default character set (the keyboard native language) -# - (should reset scrolling regions, but that glitches the screen) -# -d470c-dg|d470-dg|Data General DASHER D470C in DG mode:\ - :is=\036FQ2\036FW\036F\136\036FX004?\036F]\036O\036FS00:\ - :tc=dgmode+color:tc=d460-dg: - -# DASHER D555 terminal in ANSI mode. -# Like a D411, but has an integrated phone. -d555|Data General DASHER D555:\ - :tc=d411: -d555-7b|Data General DASHER D555 in 7-bit mode:\ - :tc=d411-7b: -d555-w|Data General DASHER D555 in wide mode:\ - :tc=d411-w: -d555-7b-w|Data General DASHER D555 in wide 7-bit mode:\ - :tc=d411-7b-w: -d555-dg|Data General DASHER D555 series in DG mode:\ - :tc=d411-dg: - -# DASHER D577 terminal in ANSI mode. -# Like a D411, but acts as a keyboard for serial printers ("KSR" modes). -d577|Data General DASHER D577:\ - :tc=d411: -d577-7b|Data General DASHER D577 in 7-bit mode:\ - :tc=d411-7b: -d577-w|Data General DASHER D577 in wide mode:\ - :tc=d411-w: -d577-7b-w|Data General DASHER D577 in wide 7-bit mode:\ - :tc=d411-7b-w: - -d577-dg|d578-dg|Data General DASHER D577/D578 series in DG mode:\ - :tc=d411-dg: - -# DASHER D578 terminal. -# Like a D577, but without compressed mode; like a D470C in this respect. -# -# Initialization string 1 sets: -# \E[<0;<1;<2;<4l -# <0 - scrolling enabled -# <1 - blink enabled -# <2 - horizontal scrolling enabled (for alignment) -# <4 - print characters regardless of attributes -# \E[1;1;80w - margins at columns 1 and 80 -# \E[1;6;<2h -# 1 - print all characters even if protected -# 6 - character protection disabled -# <2 - horizontal scrolling disabled -# - (should reset scrolling regions, but that glitches the screen) -# -d578|Data General DASHER D578:\ - :i1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h:tc=d577: -d578-7b|Data General DASHER D578 in 7-bit mode:\ - :i1=\E[<0;<1;<2;<4l\E[1;1;80w\E[1;6;<2h:tc=d577-7b: - -# Here are some older Dasher entries from the Berkeley termcap file. - -# According to the 4.4BSD termcap file, the dg200 :cm: should be the -# termcap equivalent of \020%p2%{128}%+%c%p1%{128}%+%c (in termcap -# notation that's "^P%r%+\200%+\200"). Those \200s are suspicious, -# maybe they were originally nuls (which would fit). -dg200|data general dasher 200:\ - :NL:am:bs:bw:\ - :co#80:li#24:\ - :bl=^G:ce=^K:cl=^L:cm=\020%r%.%.:cr=^M:do=^Z:ho=^H:k0=^^z:\ - :k1=^^q:k2=^^r:k3=^^s:k4=^^t:k5=^^u:k6=^^v:k7=^^w:k8=^^x:\ - :k9=^^y:kd=^Z:kh=^H:kl=^Y:kr=^X:ku=^W:l0=f10:le=^Y:nd=^X:\ - :nw=^J:se=^^E:sf=^J:so=^^D:ue=^U:up=^W:us=^T: -# Data General 210/211 (and 410?) from Lee Pearson (umich!lp) via BRL -dg210|dg-ansi|Data General 210/211:\ - :am:\ - :co#80:li#24:\ - :cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%d;%dH:do=\E[B:ho=\E[H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:nl=\E[B:\ - :nw=\r\E[H\E[A\n:se=\E[0;m:so=\E[7;m:ue=\E[0;m:up=\E[A:\ - :us=\E[4;m: -# From: Peter N. Wan -# courtesy of Carlos Rucalde of Vantage Software, Inc. -# (dg211: this had :cm=\020%r%.%:., which was an ancient termcap hangover. -# I suspect the d200 function keys actually work on the dg211, check it out.) -dg211|Data General d211:\ - :k0@:k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:k9@:kb=^Y:l0@:nw=^M^Z:\ - :se=\036E\0/>:sf@:so=5\036D:ta=^I:te=^L:ti=^L^R:ve=^L:\ - :vs=^L^R:\ - :tc=dg200: - -# From: Wayne Throop (not official) -# Data General 605x -# Ought to work for a Model 6242, Type D210 as well as a 605x. -# Note that the cursor-down key transmits ^Z. Job control users, beware! -# This also matches a posted description of something called a `Dasher 100' -# so there's a dg100 alias here. -# (dg6053: the 4.4BSD file had :le=^H:, :do=^J:, :nd=^S:. -- esr) -dg6053-old|dg100|data general 6053:\ - :am:bs:bw:ul:\ - :co#80:li#24:\ - :bc=^Y:bl=^G:ce=^K:cl=^L:cm=\020%r%.%.:cr=^M:do=^Z:ho=^H:\ - :is=^R:k0=^^q:k1=^^r:k2=^^s:k3=^^t:k4=^^u:k5=^^v:k6=^^w:\ - :k7=^^x:k8=^^y:k9=^^z:kb=^Y:kd=^Z:kh=^H:kl=^Y:kr=^X:ku=^W:\ - :le=^Y:nd=^X:se=\0^^E:so=\0\0\0\0\0\036D:ta=^I:te=^L:\ - :ti=^L^R:ue=^U:up=^W:us=^T:ve=^L:vs=^L^R: - -#### Datamedia (dm) -# -# Datamedia was headquartered in Nashua, New Hampshire until it went -# out of business in 1993, but the ID plates on the terminals referred -# to the factory in Pennsauken, NJ. The factory was sold to a PCB board -# manufacturer which threw out all information about the terminals. -# - -cs10|colorscan|Datamedia Color Scan 10:\ - :ms:\ - :co#80:li#24:\ - :bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%02;%02H:cr=^M:\ - :do=^J:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kd=\E[B:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=^H:me=\E[m:nd=\E[C:se=\E[m:sf=^J:\ - :so=\E[7m:ue=\E[m:up=\E[A:us=\E[4m: -cs10-w|Datamedia Color Scan 10 with 132 columns:\ - :co#132:\ - :cm=\E[%i%02;%03H:tc=cs10: - -# (dm1520: removed obsolete ":ma=^\ ^_^P^YH:" -- esr) -dm1520|dm1521|datamedia 1520:\ - :am:bs:xn:\ - :co#80:it#8:li#24:\ - :bl=^G:cd=^K:ce=^]:cl=^L:cm=\036%r%+ %+ :cr=^M:do=^J:ho=^Y:\ - :kd=^J:kh=^Y:kl=^H:kr=^\:ku=^_:le=^H:nd=^\:sf=^J:ta=^I:up=^_: -# dm2500: this terminal has both :IC: and :im:. Applications using -# termcap/terminfo directly (rather than through ncurses) might be confused. -dm2500|datamedia2500|datamedia 2500:\ - :bs:nc:\ - :co#80:li#24:\ - :al=\020\n\030\035\030\035:bl=^G:ce=^W:cl=^^^^\177:\ - :cm=\014%r%n%.%.:dc=\020\010\030\035:\ - :dl=\020\032\030\035:dm=^P:do=^J:ed=^X^]:\ - :ei=\377\377\030\035:ho=^B:ic=\020\034\030\035:im=^P:\ - :le=^H:nd=^\:pc=\377:se=^X^]:sf=^J:so=^N:up=^Z: -# dmchat is like DM2500, but DOES need "all that padding" (jcm 1/31/82) -# also, has a meta-key. -# From: -# (dmchat: ":MT:" changed to ":km:" -- esr) -dmchat|dmchat version of datamedia 2500:\ - :km:\ - :al=1*\020\n\030\035\030\035:dl=2\020\032\030\035:tc=dm2500: -# (dm3025: ":MT:" changed to ":km:" -- esr) -dm3025|datamedia 3025a:\ - :bs:km:\ - :co#80:it#8:li#24:\ - :al=\EP\n\EQ:bl=^G:cd=\EJ:ce=\EK:cl=\EM:cm=\EY%r%+ %+ :\ - :cr=^M:dc=\010:dl=\EP\EA\EQ:dm=\EP:do=^J:ed=\EQ:ei=\EQ:\ - :ho=\EH:im=\EP:ip=:is=\EQ\EU\EV:le=^H:nd=\EC:se=\EO0:sf=^J:\ - :so=\EO1:ta=^I:up=\EA: -dm3045|datamedia 3045a:\ - :am:bs:eo:km@:ul:xn:\ - :al@:dc=\EB:dl@:dm@:ed@:ei=\EP:is=\EU\EV:k0=\Ey\r:k1=\Ep\r:\ - :k2=\Eq\r:k3=\Er\r:k4=\Es\r:k5=\Et\r:k6=\Eu\r:k7=\Ev\r:\ - :k8=\Ew\r:k9=\Ex\r:kh=\EH:kr=\EC:ku=\EA:pc=\177:se@:so@:\ - :tc=dm3025: -# Datamedia DT80 soft switches: -# 1 0=Jump 1=Smooth -# Autorepeat 0=off 1=on -# Screen 0=Dark 1=light -# Cursor 0=u/l 1=block -# -# 2 Margin Bell 0=off 1=on -# Keyclick 0=off 1=on -# Ansi/VT52 0=VT52 1=Ansi -# Xon/Xoff 0=Off 1=On -# -# 3 Shift3 0=Hash 1=UK Pound -# Wrap 0=Off 1=On -# Newline 0=Off 1=On -# Interlace 0=Off 1=On -# -# 4 Parity 0=Odd 1=Even -# Parity 0=Off 1=On -# Bits/Char 0=7 1=8 -# Power 0=60Hz 1=50Hz -# -# 5 Line Interface 0=EIA 1=Loop -# Aux Interface 0=EIA 1=Loop -# Local Copy 0=Off 1=On -# Spare -# -# 6 Aux Parity 0=Odd 1=Even -# Aux Parity 0=Off 1=On -# Aux Bits/Char 0=7 1=8 -# CRT Saver 0=Off 1=On -# dm80/1 is a vt100 lookalike, but it doesn't seem to need any padding. -dm80|dmdt80|dt80|datamedia dt80/1:\ - :cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=%i\E[%d;%dH:do=^J:\ - :ho=\E[H:me=\E[m:nd=\E[C:pf=\E[4i:po=\E[5i:ps=\E[0i:\ - :se=\E[m:so=\E[7m:sr=\EM:ue=\E[m:up=\E[A:us=\E[4m:\ - :tc=vt100: -# except in 132 column mode, where it needs a little padding. -# This is still less padding than the vt100, and you can always turn on -# the ^S/^Q handshaking, so you can use vt100 flavors for things like -# reverse video. -dm80w|dmdt80w|dt80w|datamedia dt80/1 in 132 char mode:\ - :co#132:\ - :cd=20\E[0J:ce=20\E[0K:cl=50\E[H\E[2J:cm=5\E[%i%d;%dH:\ - :do=^J:up=5\E[A:\ - :tc=dm80: -# From: Adam Thompson Sept 10 1995 -dt80-sas|Datamedia DT803/DTX for SAS usage:\ - :am:bw:\ - :co#80:li#24:\ - :ac=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~:\ - :ae=\EG:al=\EL:as=\EF:bl=^G:cd=^K:ce=^]:cl=^L:\ - :cm=\E=%r%+ %+ :cr=^M:\ - :..cs=\E=%p1%{32}%+%c%{32}%c\E#1\E=%p2%{32}%+%c%{32}%c\E#2:\ - :ct=\E'0:dl=\EM:do=\EB:ff=^L:ho=^Y:is=\E)0\E<\EP\E'0\E$2:\ - :kC=^L:kE=^]:kS=^K:kd=^J:kh=^Y:kl=^H:kr=^\:ku=^_:le=^H:me=^X:\ - :mr=\E$2\004:nd=^\:pf=^O:po=^N:se=^X:sf=\EB:so=\E$2\004:\ - :sr=\EI:st=\E'1:ta=^I:up=^_: - -# Datamedia Excel 62, 64 from Gould/SEL UTX/32 via BRL -# These aren't end-all Excel termcaps; but do insert/delete char/line -# and name some of the extra function keys. (Mike Feldman ccvaxa!feldman) -# The naming convention has been bent somewhat, with the use of E? (where -# E is for 'Excel') as # a name. This was done to distinguish the entries -# from the other Datamedias in use here, and yet to associate a model of -# the Excel terminals with the regular datamedia terminals that share -# major characteristics. -excel62|excel64|datamedia Excel 62:\ - :dc=\E[P:ei=\E[4l:im=\E[4h:k5=\EOu:k6=\EOv:k7=\EOw:k8=\EOx:\ - :k9=\EOy:kb=^H:kd=^J:kl=^H:\ - :tc=dt80: -excel62-w|excel64-w|datamedia Excel 62 in 132 char mode:\ - :dc=\E[P:ei=\E[4l:im=\E[4h:k5=\EOu:k6=\EOv:k7=\EOw:k8=\EOx:\ - :k9=\EOy:kb=^H:kd=^J:kl=^H:\ - :tc=dt80w: -excel62-rv|excel64-rv|datamedia Excel 62 in reverse video mode:\ - :dc=\E[P:ei=\E[4l:im=\E[4h:k5=\EOu:k6=\EOv:k7=\EOw:k8=\EOx:\ - :k9=\EOy:kb=^H:kd=^J:kl=^H:vb=\E[?5l\E[?5h:\ - :tc=dt80: - -#### Falco -# -# Falco Data Products -# 440 Potrero Avenue -# Sunnyvale, CA 940864-196 -# Vox: (800)-325-2648 -# Fax: (408)-745-7860 -# Net: techsup@charm.sys.falco.com -# -# Current Falco models as of 1995 are generally ANSI-compatible and support -# emulations of DEC VT-series, Wyse, and Televideo types. -# - -# Test version for Falco ts-1. See for info -# This terminal was released around 1983 and was discontinued long ago. -# The standout and underline highlights are the same. -falco|ts1|ts-1|falco ts-1:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :al=\EE:bl=^G:cd=\EY:ce=\ET\EG0\010:cl=\E*:cm=\E=%+ %+ :\ - :cr=^M:dc=\EW:dl=\ER:do=^J:ei=\Er:ho=^^:im=\Eq:is=\Eu\E3:\ - :k0=^A0\r:kd=^J:kl=^H:kr=^L:ku=^K:le=^H:me=\Eg0:nd=^L:\ - :se=\Eg0:sf=^J:so=\Eg1:ta=^I:ue=\Eg0:up=^K:us=\Eg1: -falco-p|ts1p|ts-1p|falco ts-1 with paging option:\ - :am:bs:da:db:mi:ms:ul:\ - :co#80:it#8:li#24:\ - :al=\EE:bl=^G:bt=\EI:cd=\EY:ce=\ET\EG0\010\Eg0:cl=\E*:\ - :cm=\E=%+ %+ :cr=^M:dc=\EW:dl=\ER:do=\E[B:ei=\Er:im=\Eq:\ - :is=\EZ\E3\E_c:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=^H:me=\Eg0:nd=\E[C:se=\Eg0:sf=^J:so=\Eg4:ta=^I:te=\E_b:\ - :ti=\E_d:ue=\Eg0:up=\E[A:us=\Eg1: -# (ts100: I added / based on the init string -- esr) -ts100|ts100-sp|falco ts100-sp:\ - :am:mi:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:\ - :@8=\EOM:DO=\E[%dB:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E~E:as=^N:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E~W:dl=\E~R:do=^J:eA=\E(B\E)0:ei=:ho=\E[H:\ - :i1=\E~)\E~ea:ic=\E~Q:im=:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:\ - :k4=\EOS:k5=\EOt:k6=\EOu:k7=\EOv:k8=\EOl:k9=\EOw:k;=\EOx:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[m\017:mr=\E[7m:\ - :nd=\E[C:r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :..sa=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[1;7m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[m:up=\E[A:us=\E[4m: -ts100-ctxt|falco ts-100 saving context:\ - :te=\E~_b:ti=\E~_d\E[2J:tc=ts100: - -#### Florida Computer Graphics -# - -# Florida Computer Graphics Beacon System, using terminal emulator program -# "host.com", as provided by FCG. This description is for an early release -# of the "host" program. Known bug: :cd: clears the whole screen, so it's -# commented out. - -# From: David Bryant 1/7/83 -beacon|FCG Beacon System:\ - :am:da:db:\ - :co#80:li#32:\ - :al=\EE:bl=\ESTART\r\E37\r\EEND\r:ce=\ET:cl=\EZ:\ - :cm=\E=%+ %+ :cr=^M:dc=\EW:dl=\ER:do=^J:ei=:ho=\EH:ic=\EQ:\ - :im=:le=^H:mb=\ESTART\r\E61\0541\r\EEND\r:\ - :me=\ESTART\r\E78\r\E70\0540\r\EEND\r:\ - :mr=\ESTART\r\E59\0541\r\EEND\r:nd=\EV:\ - :se=\ESTART\r\E70\0540\r\EEND\r:sf=^J:\ - :so=\ESTART\r\E70\0546\r\EEND\r:te=:\ - :ti=\ESTART\r\E2\0540\r\E12\r\EEND\r:\ - :ue=\ESTART\r\E60\0540\r\EEND\r:up=\EU:\ - :us=\ESTART\r\E60\0541\r\EEND\r: - -#### Fluke -# - -# The f1720a differences from ANSI: no auto margin, destructive -# tabs, # of lines, funny highlighting and underlining -f1720|f1720a|fluke 1720A:\ - :xt:\ - :co#80:li#16:sg#1:\ - :bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :do=\E[B:is=\E[H\E[2J:kd=^]:kl=^_:kr=^^:ku=^\:le=^H:me=\E[m:\ - :nd=\E[C:se=\E[m:sf=\ED:so=\E[7m:sr=\EM:ue=\E[m:up=\E[A:\ - :us=\E[4m: - -#### Liberty Electronics (Freedom) -# -# Liberty Electronics -# 48089 Fremont Blvd -# Fremont CA 94538 -# Vox: (510)-623-6000 -# Fax: (510)-623-7021 - -# From: -# (f100: added empty to suppress a tic warning; -# made this relative to adm+sgr -- note that isn't -# known to work for f100 but does on the f110. --esr) -f100|freedom|freedom100|freedom model 100:\ - :am:bs:bw:hs:mi:ms:xo:\ - :co#80:li#24:\ - :ac=:ae=\E$:al=\EE:as=\E%:bl=^G:bt=\EI:cd=\EY:ce=\ET:\ - :ch=\E]%+ :cl=^Z:cm=\E=%+ %+ :cr=^M:ct=\E3:cv=\E[%+ :\ - :dc=\EW:dl=\ER:do=^J:ds=\Eg\Ef\r:ei=\Er:fs=^M:ho=^^:im=\Eq:\ - :ip=:is=\Eg\Ef\r\Ed:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:\ - :k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:k;=^AI\r:\ - :kB=\EI:kb=^H:kd=^V:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:nd=^L:sf=^J:\ - :sr=\Ej:st=\E1:ta=^I:ts=\Eg\Ef:up=^K:vb=\Eb\Ed:\ - :tc=adm+sgr: -f100-rv|freedom-rv|freedom 100 in reverse video:\ - :is=\Eg\Ef\r\Eb:vb=\Ed\Eb:tc=f100: -# The f110 and f200 have problems with vi(1). They use the ^V -# code for the down cursor key. When kcud1 is defined in terminfo -# as ^V, the Control Character Quoting capability (^V in insert mode) -# is lost! It cannot be remapped in vi because it is necessary to enter -# a ^V to to quote the ^V that is being remapped!!! -# -# f110/f200 users will have to decide whether -# to lose the down cursor key or the quoting capability. We will opt -# initially for leaving the quoting capability out, since use of VI -# is not generally applicable to most interactive applications -# (f110: added :ta:, :kh: & from f100 -- esr) -f110|freedom110|Liberty Freedom 110:\ - :bw@:es:\ - :it#8:ws#80:\ - :ae=\E%%:al=\EE:as=\E$:dl=\ER:do=^V:ds=\Ef\r:ei=\Er\EO:\ - :im=\EO\Eq:ip@:is@:k0=^AI\r:k;@:kA=\EE:kC=^^:kD=\EW:kE=\ET:\ - :kI=\EQ:kL=\ER:kS=\EY:mb=\EG2:md=\EG0:mh=\EG@:pf=\Ea:po=\E`:\ - :so=\EG<:sr=\EJ:ts=\Ef:vb=\Eb\Ed:ve=\E.2:vi=\E.1:vs=\E.2:\ - :tc=f100: -f110-14|Liberty Freedom 110 14inch:\ - :dc@:tc=f110: -f110-w|Liberty Freedom 110 - 132 cols:\ - :co#132:tc=f110: -f110-14w|Liberty Freedom 110 14in/132 cols:\ - :co#132:\ - :dc@:tc=f110: -# (f200: added to suppress tic warnings re :as:/:ae: --esr) -f200|freedom200|Liberty Freedom 200:\ - :am:bs:es:hs:mi:ms:xo:\ - :co#80:it#8:li#24:ws#80:\ - :ac=:ae=\E%%:al=\EE:as=\E$:bl=^G:bt=\EI:cd=\EY:ce=\ET:\ - :ch=\E]%+ :cl=^Z:cm=\E=%+ %+ :cr=^M:cs=\Em0%+ %+ :ct=\E3:\ - :cv=\E[%+ :dc=\EW:dl=\ER:do=^V:ds=\Ef\r:ei=\Er:fs=^M:ho=^^:\ - :im=\Eq:k0=^AI\r:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:\ - :k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:kA=\EE:kC=^^:\ - :kD=\EW:kE=\ET:kI=\EQ:kL=\ER:kS=\EY:kb=^H:kd=^V:kl=^H:kr=^L:\ - :ku=^K:le=^H:mb=\EG2:md=\EG0:mh=\EG@:nd=^L:pf=\Ea:po=\E`:\ - :sf=^J:so=\EG<:sr=\EJ:st=\E1:ts=\Ef:up=^K:vb=\Eo\En:ve=\E.1:\ - :vi=\E.0:vs=\E.1:\ - :tc=adm+sgr: -f200-w|Liberty Freedom 200 - 132 cols:\ - :co#132:tc=f200: -# The f200 has the ability to reprogram the down cursor key. The key is -# reprogrammed to ^J (linefeed). This value is remembered in non-volatile RAM, -# so powering the terminal off and on will not cause the change to be lost. -f200vi|Liberty Freedom 200 for vi:\ - :kd=^J:vb=\Eb\Ed:tc=f200: -f200vi-w|Liberty Freedom 200 - 132 cols for vi:\ - :co#132:tc=f200vi: - -#### GraphOn (go) -# -# Graphon Corporation -# 544 Division Street -# Campbell, CA 95008 -# Vox: (408)-370-4080 -# Fax: (408)-370-5047 -# Net: troy@graphon.com (Troy Morrison) -# -# -# The go140 and go225 have been discontinued. GraphOn now makes X terminals, -# including one odd hybrid that starts out life on power-up as a character -# terminal, than can be switched to X graphics mode (driven over the serial -# line) by an escape sequence. No info on this beast yet. -# (go140: I added / based on the init string -- esr) -go140|graphon go-140:\ - :bs:\ - :co#80:it#8:li#24:\ - :RA=\E[?7l:SA=\E[?7h:al=\E[L:cd=10\E[J:ce=\E[K:\ - :cl=10\E[H\E[2J:cm=\E[%i%2;%2H:dc=\E[P:dl=\E[M:ei=\E[4l:\ - :if=/usr/share/tabset/vt100:im=\E[4h:\ - :is=\E<\E=\E[?3l\E[?7l\E(B\E[J\E7\E[;r\E8\E[m\E[q:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kd=\EOB:ke=\E[?1l\E>:\ - :kh=\E[H:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:\ - :me=\E[m:nd=\E[C:se=\E[m:so=\E[7m:sr=\EM:ta=^I:ue=\E[m:\ - :up=\E[A:us=\E[4m: -go140w|graphon go-140 in 132 column mode:\ - :am:\ - :co#132:\ - :is=\E<\E=\E[?3h\E[?7h\E(B\E[J\E7\E[;r\E8\E[m\E[q:tc=go140: -# Hacked up vt200 termcap to handle GO-225/VT220 -# From: -# (go225: I added / based on the init string -- esr) -go225|go-225|Graphon 225:\ - :am:bs:mi:xn:\ - :co#80:it#8:li#25:vt#3:\ - :RA=\E[?7l:SA=\E[?7h:al=\E[L:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=^J:\ - :ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:kb=^H:kd=\E[B:ke=\E>:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ks=\E=:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:r1=\E[\041p\E[?7h\E[2;1;1#w:rc=\E8:\ - :rf=/usr/share/tabset/vt100:sc=\E7:se=\E[27m:sf=\ED:\ - :so=\E[7m:sr=\EM:ta=^I:te=\E[\041p\E[?7h\E[2;1;1#w:\ - :ti=\E[2;0#w\E[1;25r:ue=\E[24m:up=\E[A:us=\E[4m: - -#### Harris -# -# Bletch. These guys shared the Terminal Brain Damage laurels with Hazeltine. -# Their terminal group is ancient history now (1995) though the parent -# company is still in business. -# - -# 8675, 8686, and bee from Cyrus Rahman -# (8675: changed k10, k11...k16 to k;, F1...F6 -- esr) -ha8675|harris 8675:\ - :F1=^W:F2=\ER:F3=\EE:F4=\EI:F5=\Ei:F6=\Eg:\ - :is=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU:k1=^F:k2=^P:k3=^N:\ - :k4=^V:k5=^J:k6=^T:k7=^H:k8=\177:k9=\Ee:k;=\Ed:\ - :tc=bee: -# (8686: changed k10, k11...k16 to k;, F1...F6; fixed broken continuation -# in :is: -- esr) -ha8686|harris 8686:\ - :F1=\EW:F2=\002\E{\003:F3=\002\E|\003:F4=\002\E}\003:\ - :F5=\002\E~\003:F6=\002\E\177\003:\ - :is=\ES\E#\E*\Eh\Em\E?\E1\E9\E@\EX\EU\E"*Z01\E"8F35021B7C83#\E"8F45021B7D83#\E"8F55021B7E83#\E"8F65021B7F83#\E"8F75021B7383#\E"8F851BD7#\E"8F95021B7083#\E"8FA5021B7183#\E"8FB5021B7283#:\ - :k1=\002\Ep\003:k2=\002\Eq\003:k3=\002\Er\003:\ - :k4=\002\Es\003:k5=\E3:k6=\EI:k7=\ER:k8=\EJ:k9=\E(:k;=\Ej:tc=bee: - -#### Hazeltine -# -# Hazeltine appears to be out of the terminal business as of 1995. These -# guys were co-owners of the Terminal Brain Damage Hall Of Fame along with -# Harris. They have a hazeltine.com domain (but no web page there ) and can -# be reached at: -# -# Hazeltine -# 450 East Pulaski Road -# Greenlawn, New York 11740 -# -# As late as 1993, manuals for the terminal product line could still be -# purchased from: -# -# TRW Customer Service Division -# 15 Law Drive -# P.O. Box 2076 -# Fairfield, NJ 07007-2078 -# -# They're now (1998) a subsidiary of General Electric, operating under the -# marque "GEC-Marconi Hazeltine" and doing military avionics. Web page -# at . -# - -# Since :nd: is blank, when you want to erase something you -# are out of luck. You will have to do ^L's a lot to -# redraw the screen. h1000 is untested. It doesn't work in -# vi - this terminal is too dumb for even vi. (The code is -# there but it isn't debugged for this case.) -hz1000|hazeltine 1000:\ - :bs:\ - :co#80:li#12:\ - :bl=^G:cl=^L:cr=^M:do=^J:ho=^K:le=^H:nd= :sf=^J: -# From: Thu Aug 20 09:09:18 1981 -hz1420|hazeltine 1420:\ - :am:bs:\ - :co#80:li#24:\ - :al=\E^Z:bl=^G:cd=\E^X:ce=\E^O:cl=\E^\:cm=\E\021%r%.%+ :\ - :cr=^M:dl=\E^S:do=^J:le=^H:nd=^P:se=\E^Y:sf=^J:so=\E^_:ta=^N:\ - :up=\E^L: -# New "safe" cursor movement (11/87) from . Prevents -# freakout with out-of-range args and tn3270. No hz since it needs to -# receive tildes. -hz1500|hazeltine 1500:\ - :am:bs:hz:\ - :co#80:li#24:\ - :al=~\032:bl=^G:cd=~\030:ce=~^O:cl=~^\:\ - :cm=~\021%r%>^^ %+`%+`:cr=^M:dl=~\023:do=~^K:ho=~^R:kd=^J:\ - :kh=~^R:kl=^H:kr=^P:ku=~^L:le=^H:nd=^P:se=~^Y:sf=^J:so=~^_:\ - :up=~^L: -# h1510 assumed to be in sane escape mode. Else use h1500. -# (h1510: early versions of this entry apparently had ":se=\E^_:, -# :so=\E^Y:, but these caps were commented out in 8.3; also, -# removed incorrect and overridden ":do=^J:" -- esr) -hz1510|hazeltine 1510:\ - :am:bs:\ - :co#80:li#24:\ - :al=\E^Z:bl=^G:cd=\E^X:ce=\E^O:cl=\E^\:cm=\E\021%r%.%.:\ - :cr=^M:dl=\E^S:do=\E^K:le=^H:nd=^P:sf=^J:up=\E^L: -# Hazeltine 1520 -# The following switch settings are assumed for normal operation: -# FULL CR U/L_CASE ESCAPE -# FORMAT_OFF EOM_A_OFF EOM_B_OFF WRAPAROUND_ON -# Other switches may be set for operator convenience or communication -# requirements. -hz1520|Hazeltine 1520:\ - :am:bs:bw:ms:\ - :co#80:li#24:\ - :al=\E^Z:bl=^G:cd=\E^X:ce=\E^O:cl=\E^\:cm=\E\021%r%.%.:\ - :cr=^M:dl=\E^S:do=^J:ho=\E^R:kA=\E^Z:kC=\E^\:kE=\E^O:\ - :kL=\E^S:kS=\E^X:kb=^H:kd=\E^K:kh=\E^R:kl=^H:kr=^P:ku=\E^L:\ - :le=^H:md=\E^_:me=\E^Y:nd=^P:r1=\E$\E\005\E?\E\031:\ - :se=\E^Y:sf=^J:so=\E^_:up=\E^L: -# This version works with the escape switch off -# (h1520: removed incorrect and overridden ":do=^J:" -- esr) -hz1520-noesc|hazeltine 1520:\ - :am:hz:\ - :co#80:li#24:\ - :al=~^Z:bl=^G:cd=~^X:ce=~^O:cl=~^\:cm=~\021%r%.%.:cr=^M:\ - :dl=~^S:do=~^K:ho=~^R:le=^H:nd=^P:se=~^Y:sf=^J:so=~^_:up=~^L: -# Note: the h1552 appears to be the first Hazeltine terminal which -# is not braindamaged. It has tildes and backprimes and everything! -# Be sure the auto lf/cr switch is set to cr. -hz1552|hazeltine 1552:\ - :bs:\ - :al=\EE:dl=\EO:do=^J:k1=\EP:k2=\EQ:k3=\ER:l1=blue:l2=red:\ - :l3=green:\ - :tc=vt52: -hz1552-rv|hazeltine 1552 reverse video:\ - :do=^J:se=\ET:so=\ES:tc=hz1552: -# Note: h2000 won't work well because of a clash between upper case and ~'s. -hz2000|hazeltine 2000:\ - :am:bs:nc:\ - :co#74:li#27:\ - :al=~\032:bl=^G:cl=~\034:cm=~\021%r%.%.:dl=~\023:do=^J:\ - :ho=~^R:le=^H:pc=\177:sf=^J: -# Date: Fri Jul 23 10:27:53 1982. Some unknown person wrote: -# I tested this termcap entry for the Hazeltine Esprit with vi. It seems -# to work ok. There is one problem though if one types a lot of garbage -# characters very fast vi seems not able to keep up and hangs while trying -# to insert. That's in insert mode while trying to insert in the middle of -# a line. It might be because the Esprit doesn't have insert char and delete -# char as a built in function. Vi has to delete to end of line and then -# redraw the rest of the line. -esprit|Hazeltine Esprit I:\ - :am:bs:bw:\ - :co#80:li#24:\ - :al=\E^Z:bl=^G:bt=\E^T:cd=\E^W:ce=\E^O:cl=\E^\:\ - :cm=\E\021%r%.%.:cr=^M:dl=\E^S:do=\E^K:ho=\E^R:is=\E?:\ - :k0=^B0^J:k1=^B1^J:k2=^B2^J:k3=^B3^J:k4=^B4^J:k5=^B5^J:\ - :k6=^B6^J:k7=^B7^J:k8=^B8^J:k9=^B9^J:kb=^H:kd=\E^K:ke=\E>:\ - :kh=\E^R:kl=^H:kr=^P:ks=\E<:ku=\E^L:l0=0:l1=1:l2=2:l3=3:l4=4:\ - :l5=5:l6=6:l7=7:l8=8:l9=9:le=^H:nd=^P:se=\E^Y:sf=^J:so=\E^_:\ - :up=\E^L: -esprit-am|hazeltine esprit auto-margin:\ - :am:tc=esprit: -# Hazeltine Modular-1 from Cliff Shackelton via BRL -# Vi it seems always wants to send a control J for "do" and it turned out -# that the terminal would work somewhat if the auto LF/CR was turned off. -# (hmod1: removed :dn=~^K: -- esr) -hmod1|Hazeltine Modular 1:\ - :am:bs:hz:\ - :co#80:li#24:\ - :al=~^Z:bl=^G:bt=~^T:cl=~^\:cm=~\021%r%.%.:cr=^M:dl=~^S:\ - :do=~^K:ho=~^R:kd=~^K:kh=~^R:kl=^H:kr=^P:ku=~^L:le=^H:me=~^Y:\ - :nd=^P:rc=~^Q:sc=~^E:se=~^Y:sf=^J:so=~^_:up=~^L: -# -# Hazeltine Executive 80 Model 30 (1554?) -# from Will Martin via BRL -# Like VT100, except for different "am" behavior. -hazel|exec80|h80|he80|Hazeltine Executive 80:\ - :am:bs:pt:\ - :co#80:it#8:li#24:vt#3:\ - :bl=^G:cd=50\E[J:ce=3\E[K:cl=50\E[;H\E[2J:\ - :cm=5\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:do=^J:ho=\E[H:\ - :is=\E[1;24r\E[24;1H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:mb=2\E[5m:md=2\E[1m:me=2\E[m:mr=2\E[7m:\ - :nd=2\E[C:nl=^J:r1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ - :rc=\E8:rf=/usr/share/tabset/vt100:sc=\E7:se=2\E[m:\ - :so=2\E[7m:sr=5\EM:ta=^I:ue=2\E[m:up=2\E[A:us=2\E[4m: - -#### Hewlett-Packard (hp) -# -# Hewlett-Packard -# 8000 Foothills Blvd -# Roseville, CA 95747 -# Vox: 1-(916)-785-4363 (Technical response line for VDTs) -# 1-(800)-633-3600 (General customer support) -# -# -# As of March 1998, HP no longer has any terminals in production. -# The 700 series (22, 32, 41, 44, 92, 94, 96, 98) is still being -# supported (they still have parts). So are the 2392a and 2394a. -# See the WORKSTATION CONSOLES section for the 700s. -# - -# Generic HP terminal - this should (hopefully) work on any HP terminal. -hpgeneric|hp|hewlett-packard generic terminal:\ - :am:bs:da:db:mi:pt:xs:\ - :co#80:li#24:lm#0:vt#6:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EK:ch=\E&a%dC:cl=\EH\EJ:\ - :cm=\E&a%r%dc%dY:cr=^M:ct=\E3:cv=\E&a%dY:dc=\EP:dl=\EM:\ - :do=^J:ei=\ER:im=\EQ:kB=\Ei:kb=^H:le=^H:me=\E&d@:nd=\EC:\ - :se=\E&d@:sf=^J:so=\E&dJ:st=\E1:ta=^I:ue=\E&d@:up=\EA:\ - :us=\E&dD: - -hp110|hewlett-packard model 110 portable:\ - :li#16:tc=hpgeneric: - -hp+pfk+cr|hp function keys with CR:\ - :k1=\Ep\r:k2=\Eq\r:k3=\Er\r:k4=\Es\r:k5=\Et\r:k6=\Eu\r:\ - :k7=\Ev\r:k8=\Ew\r: - -hp+pfk-cr|hp function keys w/o CR:\ - :k1=\Ep:k2=\Eq:k3=\Er:k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew: - -# The hp2621s use the same keys for the arrows and function keys, -# but not separate escape sequences. These definitions allow the -# user to use those keys as arrow keys rather than as function -# keys. -hp+pfk+arrows|hp alternate arrow definitions:\ - :k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:kF=\Er\r:kH=\Eq\r:kR=\Es\r:\ - :kd=\Ew\r:kh=\Ep\r:kl=\Eu\r:kr=\Ev\r:ku=\Et\r: - -hp+arrows|hp arrow definitions:\ - :kF=\ES:kH=\EF:kR=\ET:kd=\EB:kh=\Eh:kl=\ED:kr=\EC:ku=\EA: - -# Generic stuff from the HP 262x series -# -hp262x|HP 262x terminals:\ - :xs:\ - :cd=\EJ:dc=\EP:ip=:kA=\EL:kD=\EP:kE=\EK:kF=\ES:kI=\EQ:kL=\EM:\ - :kM=\ER:kN=\EU:kP=\EV:kR=\ET:kS=\EJ:kd=\EB:ke=\E&s0A:kh=\Eh:\ - :kl=\ED:kr=\EC:ks=\E&s1A:ku=\EA:mb=\E&dA:me=\E&d@:mk=\E&dS:\ - :mr=\E&dB:\ - :..sa=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%|%;%?%p4%t%{65}%|%;%c:\ - :se=\E&d@:sf=\ES:so=\E&dB:ta=\011:ue=\E&d@:us=\E&dD: - -# Note: no :ho: on HPs since that homes to top of memory, not screen. -# Due to severe 2621 braindamage, the only way to get the arrow keys to -# transmit anything at all is to turn on the function key labels -# with :ks:, and even then the user has to hold down shift! -# The default 2621 turns off the labels except when it has to to -# enable the function keys. If your installation prefers labels -# on all the time, or off all the time (at the "expense" of the -# function keys), use 2621-nl or 2621-wl. -# -# Note: there are newer ROMs for 2621's that allow you to set -# strap A so the regular arrow keys xmit \EA, etc, as with the -# 2645. However, even with this strap set, the terminal stops -# xmitting if you reset it, until you unset and reset the strap! -# Since there is no way to set/unset the strap with an escape -# sequence, we don't use it in the default. -# If you like, you can use 2621-ba (brain-damaged arrow keys). -hp2621-ba|2621 w/new rom and strap A set:\ - :ke@:ks@:tc=hp+arrows:\ - :tc=hp2621: - -# hp2621 with function labels. Most of the time they are off, -# but inside vi, the function key labels appear. You have to -# hold down shift to get them to xmit. -hp2621|hp2621a|hp2621A|2621|2621a|2621A|hp2621-wl|2621-wl|hp 2621 w/labels:\ - :is=\E&jA\r:ke=\E&jA:\ - :tc=hp2621-fl: -hp2621-fl|hp 2621:\ - :xo:xs@:\ - :pb#19200:\ - :bt=\Ei:cm=\E&a%r%dc%dY:dc=\EP:ip=:is=\E&j@\r:ke=\E&j@:\ - :ks=\E&jB:me=\E&d@:se=\E&d@:so=\E&dD:ta=\011:ue=\E&d@:\ - :us=\E&dD:\ - :tc=hp+pfk+cr:tc=hpgeneric: - -# To use hp2621p printer, setenv TERM=2621p, PRINTER=2612p -hp2621p|hp 2621 with printer:\ - :pf=\E&p13C:po=\E&p11C:tc=hp2621: - -hp2621p-a|hp2621p with fn as arrows:\ - :tc=hp+pfk+arrows:tc=hp2621p: - -# hp2621 with k45 keyboard -hp2621-k45|hp2621k45|k45|hp 2621 with 45 keyboard:\ - :kb=^H:kd=\EB:ke=\E&s0A:kh=\Eh:kl=\ED:kr=\EC:ks=\E&s1A:\ - :ku=\EA:\ - :tc=hp2621: - -# 2621 using all 48 lines of memory, only 24 visible at any time. -hp2621-48|48 line 2621:\ - :li#48:\ - :cm=\E&a%r%dc%dR:cv=\E&a%dR:ho=\EH:tc=hp2621: - -# 2621 with no labels ever. Also prevents vi delays on escape. -hp2621-nl|hp 2621 with no labels:\ - :kd@:ke@:kh@:kl@:kr@:ks@:ku@:tc=hp2621-fl: - -# Needed for UCB ARPAVAX console, since lsi-11 expands tabs -# (wrong). -# -hp2621-nt|hp 2621 w/no tabs:\ - :ta@:tc=hp2621: - -# Hp 2624 B with 4 or 10 pages of memory. -# -# Some assumptions are made with this entry. These settings are -# NOT set up by the initialization strings. -# -# Port Configuration -# RecvPace=Xon/Xoff -# XmitPace=Xon/Xoff -# StripNulDel=Yes -# -# Terminal Configuration -# InhHndShk=Yes -# InhDC2=Yes -# XmitFnctn(A)=No -# InhEolWrp=No -# -# Note: the 2624 DOES have a true :ho:, believe it or not! -# -# The 2624 has an "error line" to which messages can be sent. -# This is CLOSE to what is expected for a "status line". However, -# after a message is sent to the "error line", the next carriage -# return is EATEN and the "error line" is turned back off again! -# So I guess we can't define :hs:, :es:, :ws:, :ds:, :fs:, :ts:. -# -# This entry supports emacs (and any other program that uses raw -# mode) at 4800 baud and less. I couldn't get the padding right -# for 9600. -# -# (hp2624: replaced NUL sequences in flash with mandatory pauses -- esr) -hp2624|hp2624a|hp2624b|hp2624b-4p|Hewlett Packard 2624 B:\ - :da:db:\ - :lm#96:\ - :vb=\E&w13F\E&w12F\E&w13F\E&w12F:tc=hp+labels:tc=scrhp: - -# This hp2626 entry does not use any of the fancy windowing stuff -# of the 2626. -# -# Indeed, terminfo does not yet handle such stuff. Since changing -# any window clears memory, it is probably not possible to use -# this for screen opt. -# -# ed is incredibly slow most of the time - I am guessing at the -# exact padding. Since the terminal uses xoff/xon this is intended -# only for cost computation, so that the terminal will prefer el -# or even dl1 which is probably faster! -# -# \ED\EJ\EC hack for ed from Ed Bradford - apparently ed is only -# extra slow on the last line of the window. -# -# The padding probably should be changed. -# -hp2626|hp2626a|hp2626p|hp 2626:\ - :da:db:\ - :lm#0:pb#19200:\ - :SF=\E&r%dD:SR=\E&r%dU:cd=\ED\EJ\EC:ip=:is=\E&j@\r:tc=hp+pfk+cr:tc=hp+labels:tc=scrhp: - -# This entry is for sysline. It allocates a 23 line window with -# a 115 line workspace for regular use, and a 1 line window for -# the status line. -# -# This assumes port 2 is being used. -# Turn off horizontal line, Create ws #1 with 115 lines, -# Create ws #2 with 1 line, Create window #1 lines 1-23, -# Create window #2 lines 24-24, Attach cursor to workspace #1. -# Note that this clears the tabs so it must be done by tset before -# it sets the tabs. -# -hp2626-s|hp 2626 using only 23 lines:\ - :es:hs:\ - :li#23:\ - :fs=\E&d@\E&w7f2p1I\E&w4f1I:\ - :i1=\E&q3t0{0H \E&w0f115n1I \E&w0f1n2I \E&w2f1i0d0u22l0S \E&w2f2i0d23u23l0S \E&w7f2p1I \r:\ - :ts=\E&w7f2p2I\E&w4f2I\r\EK\E&a%p1%dC:\ - :tc=hp2626: -# Force terminal back to 24 lines after being 23. -hp2626-ns|hp 2626 using all 24 lines:\ - :i1=\E&q3t0{0H \E&w0f118n1I \E&w0f1n2I \E&w2f1i0d0u23l0S \E&w3f2I \E&w7f2p1I \r:tc=hp2626: -# Various entries useful for small windows on 2626. -hp2626-12|hewlett-packard 2626 12 lines:\ - :li#12:tc=hp2626: -hp2626-12x40|hewlett-packard 2626 12 lines 40 columns:\ - :co#40:li#12:tc=hp2626: -hp2626-x40|hewlett-packard 2626 40 columns:\ - :co#40:tc=hp2626: -hp2626-12-s|hewlett-packard 2626 11 lines plus status:\ - :li#11:tc=hp2626-s: - -# -# hp2627 color tubes from University of Wisconsin -# -hp2627a-rev|hp 2627 with reverse video colors:\ - :cr=^M:do=^J:\ - :is=\E&v0m1a0b0c1x1y1z1i0a0b1c1x1y1z0i0S\E&j@\r\E3\r:\ - :kb=^H:kd=^J:kl=^H:nw=^M^J:sf=^J:ta=^I:ue=\E&v0S\E&d@:\ - :us=\E&dD\E&v1S:\ - :tc=hp2621-nl: -hp2627a|hp 2627 color terminal with no labels:\ - :cr=^M:do=^J:\ - :is=\E&v0m1a1b0c1i0a1b1c2i1a0b0c0i0S\E&j@\r\E3\r:\ - :kb=^H:kd=^J:kl=^H:nw=^M^J:se=\E&v0S:sf=^J:so=\E&v2S:ta=^I:\ - :ue=\E&v0S\E&d@:us=\E&dD\E&v1S:\ - :tc=hp2621-nl: -hp2627c|hp 2627 color (cyan) terminal with no labels:\ - :cr=^M:do=^J:\ - :is=\E&v0m1a0b0c2i1a1b0c1i0a1b1c0i0S\E&j@\r\E3\r:\ - :kb=^H:kd=^J:kl=^H:nw=^M^J:sf=^J:ta=^I:\ - :tc=hp2627a: - -# hp2640a doesn't have the Y cursor addressing feature, and C is -# memory relative instead of screen relative, as we need. -# -hp2640a|hp 2640a:\ - :cm@:ke@:ks@:tc=hp2645: - -hp2640b|hp2644a|hp 264x series:\ - :ke@:ks@:tc=hp2645: - -# (hp2641a: removed unknown :gu: -- esr) -hp2641a|hp2645a|hp2647a|HP 264?A series BRL entry:\ - :am:da:db:mi:xs:\ - :co#80:li#24:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EK:ch=\E&a%2C:cl=\EH\EJ:\ - :cm=\E&a%r%2c%2Y:cr=^M:cv=\E&a%2Y:dc=\EP:dl=\EM:do=^J:\ - :ei=\ER:if=/usr/share/tabset/std:im=\EQ:is=500\EE:kb=^H:\ - :kd=^J:kl=^H:le=^H:nd=\EC:nw=^M^J:se=\E&d@:sf=^J:so=\E&dB:\ - :ta=^I:up=\EA: - -# This terminal should be used at 4800 baud or less. It needs padding for -# plain characters at 9600, I guessed at an appropriate cr delay. It really -# wants ^E/^F handshaking, but that doesn't work well even if you write -# software to support it. -hp2645|hp45|HP 2645 series:\ - :pb#9600:\ - :cr=\r:kA=\EL:kD=\EP:kE=\EK:kF=\ES:kI=\EQ:kL=\EM:kM=\ER:\ - :kN=\EU:kP=\EV:kR=\ET:kS=\EJ:kT=\E1:kd=\EB:ke=\E&s0A:kh=\Eh:\ - :kl=\ED:kr=\EC:ks=\E&s1A:kt=\E2:ku=\EA:mb=\E&dA:me=\E&d@:\ - :mh=\E&dH:mr=\E&dB:\ - :..sa=\E&d%{64}%?%p1%t%{66}%|%;%?%p2%t%{68}%|%;%?%p3%t%{66}%|%;%?%p4%t%{65}%|%;%?%p5%t%{72}%|%;%?%p6%t%{66}%|%;%c:\ - :us=\E&dD:\ - :tc=hpgeneric: -# You should use this terminal at 4800 baud or less. -hp2648|hp2648a|HP 2648a graphics terminal:\ - :cl=\EH\EJ:cm=\E&a%r%dc%dY:dc=\EP:ip=:tc=hp2645: - -# The HP 150 terminal is a fairly vanilla HP terminal, with the -# clreol standout problem. It also has graphics capabilities and -# a touch screen, which we don't describe here. -hp150|hewlett packard Model 150:\ - :bs:tc=hp2622: - -# HP 2382a terminals, "the little ones." They don't have any -# alternate character set support and sending out ^N/^O will -# leave the screen blank. -hp2382a|hp2382|hewlett packard 2382a:\ - :da:db:\ - :lh#1:lm#48:\ - :ac@:ae@:as@:me=\E&d@:\ - :..pn=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s:\ - :..sa=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64}%+%e%{64}%;%;%c:\ - :tc=hp+labels:tc=scrhp: - -hp2621-a|hp2621a-a|hp2621 with fn as arrows:\ - :tc=hp+pfk+arrows:tc=hp2621-fl: - -# newer hewlett packard terminals - -newhpkeyboard|generic entry for HP extended keyboard:\ - :kA=\EL:kB=\Ei:kC=\EJ:kD=\EP:kE=\EK:kF=\ET:kH=\EF:kI=\EQ:\ - :kL=\EM:kM=\ER:kN=\EU:kP=\EV:kR=\ES:kS=\EJ:kb=^H:kd=\EB:\ - :ke=\E&s0A:kh=\Eh:kl=\ED:kr=\EC:ks=\E&s1A:ku=\EA:\ - :tc=hp+pfk-cr: - -newhp|generic entry for new hewlett packard terminals:\ - :am:bw:mi:xo:xs:\ - :co#80:li#24:pb#4800:\ - :ac=2[3@4>5I9(\072'JSKWLQMAO#P$Q;R\041S"T1U2V4W3X\072Y+Z*dHjGkTlRmFn/q\054t5u6v8w7x.:\ - :ae=^O:al=\EL:as=^N:bl=^G:bt=\Ei:cd=\EJ:ce=\EK:cr=^M:ct=\E3:\ - :dc=\EP:dl=\EM:do=^J:ei=\ER:i1=\E&jB:im=\EQ:ip=:le=^H:\ - :mb=\E&dA:md=\E&dF:me=\E&d@\017:mh=\E&dH:mk=\E&dS:\ - :mr=\E&dB:nd=\EC:nw=^M^J:\ - :..pk=\E&f0a%p1%dk0d%p2%l%dL%p2%s:\ - :..pl=\E&f1a%p1%dk0d%p2%l%dL%p2%s:\ - :..px=\E&f2a%p1%dk0d%p2%l%dL%p2%s:r1=\Eg:\ - :..sa=\E&d%{0}%Pa%?%p4%t%{1}%ga%+%Pa%;%?%p1%p3%|%p6%|%t%{2}%ga%+%Pa%;%?%p2%p6%|%t%{4}%ga%+%Pa%;%?%p1%p5%|%t%{8}%ga%+%Pa%;%?%p7%t%?%ga%ts%ga%{64}%+%e%{83}%;%e%?%ga%t%ga%{64}%+%e%{64}%;%;%c%?%p9%t\016%e\017%;:\ - :se=\E&d@:sf=^J:so=\E&dJ:sr=\ET:st=\E1:ta=\011:ue=\E&d@:\ - :up=\EA:us=\E&dD:\ - :tc=newhpkeyboard: - -memhp|memory relative addressing for new HP ttys:\ - :vt#6:\ - :CM=\E&a%p1%dr%p2%dC:DO=\E&a+%dR:LE=\E&a-%dC:\ - :RI=\E&a+%dC:UP=\E&a-%dR:ch=\E&a%dC:cl=\EH\EJ:\ - :cm=\E&a%dr%dC:cv=\E&a%dR:ho=\EH:ll=\E&a23R\r:tc=newhp: - -scrhp|screen relative addressing for new HP ttys:\ - :CM=\E&a%p1%dr%p2%dC:DO=\E&a+%dR:LE=\E&a-%dC:\ - :RI=\E&a+%dC:UP=\E&a-%dR:ch=\E&a%dC:cl=\E&a0c0Y\EJ:\ - :cm=\E&a%dy%dC:cv=\E&a%dY:ho=\E&a0y0C:ll=\E&a0y0C\EA:\ - :tc=newhp: - -# (hp+labels: added label values from a BRL termcap -- esr) -hp+labels|"standard" label info for new HP ttys:\ - :Nl#8:lh#2:lw#8:\ - :LF=\E&j@:LO=\E&jB:l0=f1:l1=f2:l2=f3:l3=f4:l4=f5:l5=f6:l6=f7:\ - :l7=f8:\ - :..pn=\E&f2a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d0L%?%ga%!%t %;%p2%s: - -hp+printer|"standard" printer info for HP ttys:\ - :ff=\E&p4u0C:pf=\E&p13C:po=\E&p11C:ps=\EH\E&p4dF: - - -# The new hp2621b is kind of a cross between the old 2621 and the -# new 262x series of machines. It has dip-switched options. -# The firmware has a bug in it such that if you give it a null -# length label, the following character is eaten! -hp2621b|hp 2621b with old style keyboard:\ - :Nl#8:lh#1:lm#48:lw#8:\ - :LO=\E&jB:kF=\ET:kH=\EF:kR=\ES:kd=\EB:kh=\Eh:kl=\ED:kr=\EC:\ - :ku=\EA:\ - :..pn=\E&f0a%p1%dk%p2%l%Pa%?%ga%t%ga%d%e1%;d3L%?%ga%!%t%{32}%c%;%p2%s\E%{111}%p1%+%c\r:tc=hp2621: - -hp2621b-p|hp 2621b with printer:\ - :tc=hp+printer:tc=hp2621b: - -# hp2621b - new 2621b with new extended keyboard -# these are closer to the new 26xx series than the other 2621b -hp2621b-kx|hp 2621b with extended keyboard:\ - :tc=newhpkeyboard:tc=hp2621b: - -hp2621b-kx-p|hp 2621b with new keyboard & printer:\ - :tc=hp+printer:tc=hp2621b-kx: - -# Some assumptions are made in the following entries. -# These settings are NOT set up by the initialization strings. -# -# Port Configuration -# RecvPace=Xon/Xoff XmitPace=Xon/Xoff StripNulDel=Yes -# -# Terminal Configuration -# InhHndShk(G)=Yes InhDC2(H)=Yes -# XmitFnctn(A)=No InhEolWrp=No -# -# -# Hp 2622a & hp2623a display and graphics terminals -# -hp2622|hp2622a|hp 2622:\ - :da:db:\ - :lm#0:pb#19200:\ - :is=\E&dj@\r:tc=hp+pfk+cr:tc=hp+labels:tc=scrhp: - -# The 2623 is a 2622 with extra graphics hardware. -hp2623|hp2623a|hp 2623:\ - :tc=hp2622: - -hp2624b-p|hp2624b-4p-p|hewlett packard 2624 B with printer:\ - :tc=hp+printer:tc=hp2624: - -# The hewlett packard B can have an optional extra 6 pages of memory. -hp2624-10p|hp2624a-10p|hp2624b-10p|hewlett packard 2624 B w/ 10 pages of memory:\ - :lm#240:tc=hp2624: - -hp2624b-10p-p|hewlett packard 2624 B w/ extra memory & printer:\ - :lm#240:tc=hp2624b-p: - -# Color manipulations for HP terminals -hp+color|hp with colors:\ - :cc:\ - :Co#16:NC#17:pa#7:\ - :..Ip=\E&v%?%p2%{1000}%=%t1%e.%p2%d%;a%?%p3%{1000}%=%t1%e.%p3%d%;b%?%p4%{1000}%=%t1%e.%p4%d%;c%?%p5%{1000}%=%t1%e.%p5%d%;x%?%p6%{1000}%=%t1%e.%p6%d%;y%?%p7%{1000}%=%t1%e.%p7%d%;z%p1%dI:\ - :oc=\E&v0m1a1b1c0I\E&v1a1I\E&v1b2I\E&v1a1b3I\E&v1c4I\E&v1a1c5I\E&v1b1c6I\E&v1x1y7I:\ - :op=\E&v0S:sp=\E&v%dS: - -# :is: sets the screen to be 80 columns wide -hp2397a|hp2397|hewlett packard 2397A color terminal:\ - :is=\E&w6f80X:\ - :tc=memhp:tc=hp+labels:tc=hp+color: - -# -# (hp2392: copied :ei: here from hpex -- esr) -hp2392|239x series:\ - :co#80:\ - :bt=\Ei:cm=\E&a%dy%dC:cv=\E&a%dY:ei=\ER:im=\EQ:k1=\Ep\r:\ - :k2=\Eq\r:k3=\Er\r:k4=\Es\r:k5=\Et\r:k6=\Eu\r:k7=\Ev\r:\ - :k8=\Ew\r:kF=\EU:kN=\Eu:kP=\Ev:kR=\EV:kh=\Eh:ue=\E&d@:\ - :us=\E&dD:\ - :tc=hpsub: - -hpsub|hp terminals -- capability subset:\ - :am:da:db:mi:xo:xs:\ - :li#24:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EK:ch=\E&a%dC:cl=\EH\EJ:cr=^M:\ - :dc=\EP:dl=\EM:do=\EB:if=/usr/share/tabset/stdcrt:\ - :is=\E&s1A\E<\E&k0\:kb=^H:kd=\EB:ke=\E&s0A:kh=\Eh:kl=\ED:\ - :kr=\EC:ks=\E&s1A:ku=\EA:le=^H:me=\E&d@:nd=\EC:se=\E&d@:\ - :sf=^J:so=\E&dB:ta=^I:up=\EA: - -# hpex: -# May be used for most 24 x 80 hp terminals, -# but has no padding added, so may allow runover in some terminals at high -# baud rates. Will not work for hp2640a or hp2640b terminals, hp98x6 and -# hp98x5 terminal emulators or hp98x6 consoles. -# Adds xy-cursor addressing, vertical cursor addressing, home, -# last line, and underline capabilities. -# -# (hpex: removed memory-lock capabilities ":ml=\El:mu=\Em:", -# moved :ei: here from hpsub -- esr) -hpex|hp extended capabilites:\ - :cm=\E&a%dy%dC:cr=^M:cv=\E&a%dY:do=^J:ei=\ER:im=\EQ:kb=^H:\ - :kd=^J:kl=^H:nw=^M^J:sf=^J:ta=^I:ue=\E&d@:us=\E&dD:\ - :tc=hpsub: - -# From: Ville Sulko , 05 Aug 1996 -hp2|hpex2|hewlett-packard extended capabilities newer version:\ - :am:da:db:mi:xs:\ - :Nl#8:co#80:lh#2:li#24:lm#0:lw#8:sg#0:\ - :LF=\E&j@:LO=\E&jB:al=\EL:bl=^G:cd=\EJ:ce=\EK:ch=\E&a%dC:\ - :cl=\E&a0y0C\EJ:cm=\E&a%dy%dC:cr=^M:ct=\E3:cv=\E&a%dY:\ - :dc=\EP:dl=\EM:do=\EB:ei=\ER:im=\EQ:k1=\Ep:k2=\Eq:k3=\Er:\ - :k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:kA=\EL:kC=\EJ:kD=\EP:\ - :kE=\EK:kF=\ES:kH=\EF:kI=\EQ:kL=\EM:kM=\ER:kN=\EU:kP=\EV:\ - :kR=\ET:kS=\EJ:kT=\E1:ka=\E3:kb=^H:kd=\EB:ke=\E&s0A:kh=\Eh:\ - :kl=\ED:kr=\EC:ks=\E&s1A:kt=\E2:ku=\EA:le=^H:me=\E&d@:\ - :ml=\El:mu=\Em:nd=\EC:..pk=\E&f%p1%dk%p2%l%dL%p2%s:\ - :..pl=\E&f1a%p1%dk%p2%l%dL%p2%s:\ - :..pn=\E&f%p1%dk%p2%l%dd0L%p2%s:\ - :..px=\E&f2a%p1%dk%p2%l%dL%p2%s:\ - :..sa=\E&d%?%p7%t%{115}%c%;%p1%p3%|%p6%|%{2}%*%p2%{4}%*%+%p4%+%p5%{8}%*%+%{64}%+%c%?%p9%t%'\016'%c%e%'\017'%c%;:\ - :se=\E&d@:sf=^J:so=\E&dB:st=\E1:ta=^I:ue=\E&d@:up=\EA:\ - :us=\E&dD: - -# HP 236 console -# From: -hp236|hp236 internal terminal emulator:\ - :am:bs:\ - :co#80:li#24:\ - :al=\EG:ce=\EK:cl=\EF:cm=\EE%+ %+ :dc=\EJ:dl=\EH:ei=:ic=\EI:\ - :im=:le=^H:me=\ECI:se=\ECI:so=\EBI:up=^K:ve=\EDE:vs=\EDB: - -# This works on a hp300 console running Utah 4.3 BSD -# From: Craig Leres -hp300h|HP Catseye console:\ - :am:bs:da:db:mi:xs:\ - :co#128:li#51:lm#0:sg#0:\ - :al=\EL:bl=^G:bt=\Ei:cd=\EJ:ce=\EK:ch=\E&a%dC:\ - :cl=\E&a0y0C\EJ:cm=\E&a%dy%dC:cr=^M:ct=\E3:cv=\E&a%dY:\ - :dc=\EP:dl=\EM:do=\EB:ei=\ER:if=/usr/share/tabset/stdcrt:\ - :im=\EQ:kb=^H:kd=\EB:ke=\E&s0A:kh=\Eh:kl=\ED:kr=\EC:\ - :ks=\E&s1A:ku=\EA:le=^H:me=\E&d@:nd=\EC:se=\E&d@:sf=^J:\ - :so=\E&dB:ta=^I:ue=\E&d@:up=\EA:us=\E&dD: -# From: Greg Couch -hp9837|hp98720|hp98721|HP 9000/300 workstations:\ - :am:bs:da:db:mi:xs:\ - :co#128:it#8:li#46:lm#0:\ - :al=\EL:bl=^G:bt=\Ei:cd=\EJ:ce=\EK:ch=\E&a%dC:\ - :cl=\E&a0y0C\EJ:cm=\E&a%dy%dC:ct=\E3:cv=\E&a%dY:dc=\EP:\ - :dl=\EM:do=\EB:ei=\ER:im=\EQ:is=\E&v0m1b0i&j@:kA=\EL:\ - :kD=\EP:kE=\EK:kI=\EQ:kL=\EM:kN=\EU:kP=\EV:kS=\EJ:kb=^H:\ - :kd=\EB:ke=\E&s0A:kh=\Eh:kl=\ED:kr=\EC:ks=\E&s1A:ku=\EA:\ - :le=^H:me=\E&d@:nd=\EC:se=\E&v0S:sf=^J:so=\E&v5S:st=\E1:\ - :ta=^I:ue=\E&d@:up=\EA:us=\E&dD: -# HP 9845 desktop computer from BRL -# (hp9845: removed unknown capability :gu: -- esr) -hp9845|HP 9845:\ - :am:bs:da:db:eo:mi:xs:\ - :co#80:li#21:\ - :al=\EL:bc=\ED:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\E&a%r%2c%2Y:\ - :dc=\EP:dl=\EM:ei=\ER:if=/usr/share/tabset/std:im=\EQ:\ - :nd=\EC:se=\E&d@:so=\E&dB:up=\EA: -# From: Charles A. Finnell of MITRE , developed 07SEP90 -# (hp98550: replaced /usr/share/tabset/9837 with std because :it#8:,:st=\E1:; -# added empty to avoid warnings re :as:/:ae: --esr) -hp98550|hp98550a|HP 9000 Series 300 color console:\ - :am:bs:da:db:mi:xs:\ - :co#128:it#8:li#49:lm#0:\ - :ac=:ae=^O:al=\EL:as=^N:bl=^G:bt=\Ei:cd=\EJ:ce=\EK:\ - :ch=\E&a%dC:cl=\EH\EJ:cm=\E&a%dy%dC:cr=^M:ct=\E3:\ - :cv=\E&a%dY:dc=\EP:dl=\EM:do=^J:ei=\ER:\ - :if=/usr/share/tabset/std:im=\EQ:k1=\Ep:k2=\Eq:k3=\Er:\ - :k4=\Es:k5=\Et:k6=\Eu:k7=\Ev:k8=\Ew:kA=\EL:kC=\EJ:kD=\EP:\ - :kE=\EK:kF=\ES:kH=\EF:kI=\EQ:kL=\EM:kM=\ER:kN=\EU:kP=\EV:\ - :kR=\ET:kS=\EJ:kT=\E1:ka=\E3:kb=^H:kd=\EB:ke=\E&s0A:kh=\Eh:\ - :kl=\ED:kr=\EC:ks=\E&s1A:kt=\E2:ku=\EA:le=^H:mb=\E&dA:\ - :md=\E&dJ:me=\E&d@:mh=\E&dH:mk=\E&ds:mr=\E&dJ:nd=\EC:\ - :se=\E&d@:sf=^J:so=\E&dJ:st=\E1:ta=^I:ue=\E&d@:up=\EA:\ - :us=\E&dD:ve=\E*dQ:vi=\E*dR: - -bobcat|sbobcat|HP 9000 model 300 console:\ - :am:da:db:mi:xs:\ - :co#128:it#8:li#47:sg#0:\ - :al=10*\EL:bt=\Ei:cd=\EJ:ce=\EK:ch=6\E&a%dC:cl=\EH\EJ:\ - :cm=6\E&a%dy%dC:cr=^M:cv=6\E&a%dY:dc=\EP:dl=10*\EM:do=\EB:\ - :ei=\ER:im=\EQ:kb=^H:kd=\EB:ke=\E&s0A:kh=\Eh:kl=\ED:kr=\EC:\ - :ks=\E&s1A:ku=\EA:le=^H:me=\E&d@:nd=\EC:nw=^M^J:se=\E&d@:\ - :sf=^J:so=\E&dB:ta=^I:ue=\E&d@:up=\EA:us=\E&dD: -gator-t|HP 9000 model 237 emulating extra-tall AAA:\ - :li#94:tc=gator: -gator|HP 9000 model 237 emulating AAA:\ - :bw:km:mi:ul:\ - :co#128:it#8:li#47:\ - :AL=1*\E[%dL:DC=4\E[%dP:DL=1*\E[%dM:IC=4\E[%d@:al=\E[L:\ - :bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:ch=\E[%i%d`:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:do=^J:ei=:ho=\E[H:\ - :ic=\E[@:im=:kb=^H:kd=^J:kl=^H:le=^H:me=\E[m:mr=\E[7m:\ - :nd=\E[C:nw=^M^J:rp=1*%.\E[%db:se=\E[m:so=\E[7m:ta=^I:\ - :ue=\E[m:up=\EM:us=\E[4m: -gator-52|HP 9000 model 237 emulating VT52:\ - :co#128:li#47:tc=vt52: -gator-52t|HP 9000 model 237 emulating extra-tall VT52:\ - :li#94:tc=gator-52: - -#### Honeywell-Bull -# -# From: Michael Haardt 11 Jan 93 -# - -# Honeywell Bull terminal. Its cursor and function keys send single -# control characters and it has standout/underline glitch. Most programs -# do not like these features/bugs. Visual bell is realized by flashing the -# "keyboard locked" LED. -dku7003-dumb|Honeywell Bull DKU 7003 dumb mode:\ - :co#80:li#25:\ - :cd=^_:ce=\E[K:cl=^]^_:cm=\E[%i%d;%dH:cr=^M:do=^K:ho=^]:\ - :kb=^H:kd=^K:kh=^]:kl=^Y:kr=^X:ku=^Z:le=^Y:nd=^X:nw=^M^J:\ - :sf=^J:ta=^I:up=^Z:vb=\E[2h\E[2l: -dku7003|Honeywell Bull DKU 7003 all features described:\ - :ms:\ - :sg#1:\ - :mb=\E[5m:md=\E[7m:me=\E[m:mh=\E[2m:mr=\E[7m:se=\E[m:\ - :so=\E[7m:ue=\E[m:us=\E[4m:\ - :tc=dku7003-dumb: - -#### IBM -# - -ibm327x|line mode IBM 3270 style:\ - :gn:\ - :ce=^M:cl=^M^J:ho=^M: - -# Beware! The 3101 entry IBM shipped with AIX 3 is *wrong*. Losers... -# From: J.B. Nicholson-Owens 8 Mar 94 -# (ibm3101: :if=/usr/share/tabset/ibm3101: removed, no such file -- esr) -# Some versions of this that have :ct=\EH:; they may ort may not be broken. -ibm3101|i3101|IBM 3101-10:\ - :am:bs:xo:\ - :co#80:li#24:\ - :bl=^G:cd=\EJ:ce=\EI:cl=\EK:cm=\EY%+ %+ :cr=^M:ct=\E1:do=^J:\ - :ho=\EH:kb=^H:kd=\EB:kl=\ED:kr=\EC:ku=\EA:le=^H:nd=\EC:\ - :nw=^M^J:sf=^J:st=\E0:ta=^I:up=\EA: -ibm3151|IBM 3151 display:\ - :ae=\E>B:as=\E>A:is=\E S:me=\E4@\E>B:r2=\E S:s0=\E>B:\ - :..sa=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%;%?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t%{80}%|%;%c%?%p9%t\E>A%e\E>B%;:\ - :te=\E>B:ti=\E>B:\ - :tc=ibm3163: -# From: Mark Easter 29 Oct 1992 -# I've commented out or translated some IBM extensions. -# , :kN:, :kP:, , merged in from AIX 3.2.5 -ibm3161|ibm3163|wy60-316X|wyse60-316X|IBM 3161/3163 display:\ - :am:bs:mi:ms:\ - :co#80:it#8:li#24:\ - :@7=\E2:F1=\Ek\r:F2=\El\r:F3=\E\041a\r:F4=\E\041b\r:\ - :F5=\E\041c\r:F6=\E\041d\r:F7=\E\041e\r:F8=\E\041f\r:\ - :F9=\E\041g\r:FA=\E\041h\r:FB=\E\041i\r:FC=\E\041j\r:\ - :FD=\E\041k\r:FE=\E\041l\r:\ - :ac=j\352k\353l\354m\355n\356q\361t\364u\365v\366w\367x\370:\ - :bl=^G:cd=\EJ:ce=\EI:cl=\EH\EJ:cm=\EY%+ %+ :cr=^M:dc=\EQ:\ - :dl=\EO:do=\EB:ho=\EH:k1=\Ea\r:k2=\Eb\r:k3=\Ec\r:k4=\Ed\r:\ - :k5=\Ee\r:k6=\Ef\r:k7=\Eg\r:k8=\Eh\r:k9=\Ei\r:k;=\Ej\r:\ - :kA=\EN:kB=\E2:kC=\EL\r:kD=\EQ:kE=\EI:kI=\EP \010:kL=\EO:\ - :kN=\EI:kP=\EL:kS=\EJ:kT=\E0:ka=\E 1:kb=^H:kd=\EB:kh=\EH:\ - :kl=\ED:kr=\EC:kt=\E1:ku=\EA:le=\ED:mb=\E4D:md=\E4H:\ - :me=\E4@\E<@:mk=\E4P:mr=\E4A:nd=\EC:pf=^P^T:po=^P^R:\ - :..sa=\E4%{64}%?%p1%t%{65}%|%;%?%p2%t%{66}%|%;%?%p3%t%{65}%|%;%?%p4%t%{68}%|%;%?%p5%t%{64}%|%;%?%p6%t%{72}%|%;%?%p7%t%{80}%|%;%c%?%p9%t\E>A%e\E<@%;:\ - :se=\E4@:sf=^J:so=\E4A:te=\E>A:ti=\E>A:ue=\E4@:up=\EA:\ - :us=\E4B: - -ibm3161-C|IBM 3161-C NLS terminal using cartridge:\ - :s0=\E>B:s1=\E>A:te=\E>B:ti=\E>B:\ - :tc=ibm3161: -ibm3162|IBM 3162 display:\ - :al=\EN:mb=\E4$a:md=\E4(a:me=\E4@:mk=\E40a:mr=\E4\041a:\ - :se=\E4>b:so=\E4\041a:ue=\E4=b:us=\E4"a:\ - :tc=ibm3161-C: - -# How the 3164 sgr string works: -# %{32} # push space for no special video characteristics -# %?%p2%t%{1}%|%; # if p2 set, then OR the 1 bit for reverse -# %?%p3%t%{4}%|%; # if p3 set, then OR the 4 bit for blink -# %?%p4%t%{2}%|%; # if p4 set, then OR the 2 bit for underline -# %c # pop Pa1 -# %{39}%p1%- # calculate 32 + (7 - p1) for foreground -# %c # pop Pa2 -# %{64} # use only black background for now -# %c # pop Pa3 -# (ibm3164: merged :ms:,,,, from AIX 3.2.5 -- esr) -ibm3164|i3164|IBM 3164:\ - :ms:\ - :Co#8:pa#64:\ - :Sb=\E4 %+@:..Sf=\E4%?%p1%t %p1%{32}%+%c%e\041'%;@:\ - :mb=\E4D:md=\E4H:me=\E4@:\ - :..sa=\E4%{32}%?%p2%t%{1}%|%;%?%p3%t%{4}%|%;%?%p4%t%{2}%|%;%c%{39}%p1%-%c%{64}%c:tc=ibm3163: - -# From: -# (ibm5081: merged acsc, s0ds, s1ds, sgr0 into ibm5081 from AIX 3.2.5. -- esr) -ibm5081|ibmmpel|IBM 5081 1024x1024 256/4096 Megapel color display:\ - :es:hs:\ - :li#33:\ - :ac=jjkkllmmnnqqttuuvvwwxx:ds=\Ej\EYA \EI\Ek:fs=\Ek:\ - :me=\E[0m\E(B:s0=\E(B:s1=\E(0:ts=\Ej\EYA%+ \Eo:\ - :tc=ibmmono: -ibm5081-c|ibmmpel-c|IBM 5081 1024x1024 256/4096 Megapel enhanced color display:\ - :es:hs:\ - :li#33:\ - :ds=\Ej\EYA \EI\Ek:fs=\Ek:ts=\Ej\EYA%+ \Eo:tc=ibmega-c: -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ibm5151|wy60-AT|wyse60-AT|IBM 5151 Monochrome display:\ - :am:bw:ms:xo:\ - :co#80:it#8:li#25:\ - :AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\ - :SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:al=\E[L:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:\ - :dl=\E[M:do=^J:ec=\E[%dX:ei=\E[4l:ho=\E[H:im=\E[4h:is=\Ec:\ - :k0=\E[010q:k1=\E[001q:k2=\E[002q:k3=\E[003q:k4=\E[004q:\ - :k5=\E[005q:k6=\E[006q:k7=\E[007q:k8=\E[008q:k9=\E[009q:\ - :kD=\E[P:kI=\E[139q:kN=\E[154q:kP=\E[150q:kb=^H:kd=\E[B:\ - :kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:\ - :me=\E[0m:mr=\E[7m:nd=\E[C:rc=\E[u:sc=\E[s:se=\E[m:sf=\E[S:\ - :so=\E[7m:sr=\E[T:ue=\E[m:up=\E[A:us=\E[4m: -ibm5154|IBM 5154 Color display:\ - :Co#8:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:md@:tc=ibm5151: -ibm6153|IBM 6153 Black & White display:\ - :mb@:md=\E[12m:me=\E[0;10m:s0=\E[10m:s1=\E[11m:s2=\E[12m:\ - :..sa=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m:\ - :tc=ibm5151: -ibm6153-90|IBM 6153 Black & White display:\ - :co#90:li#36:\ - :mb@:md@:tc=ibm5151: -ibm6153-40|IBM 6153 Black & White display:\ - :co#40:li#12:tc=ibm6153-90: -ibm6154|IBM 6154 Color displays:\ - :mb@:md=\E[12m:me=\E[0;10m:s0=\E[10m:s1=\E[11m:s2=\E[12m:\ - :..sa=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;12%;m:\ - :tc=ibm5154: -ibm6155|IBM 6155 Black & White display:\ - :mb@:md@:tc=ibm5151: -ibm8503|ibm8507|ibm8604|IBM 8503 B & W VGA display:\ - :tc=hft-c: -ibm8512|ibm8513|IBM color VGA Terminal:\ - :am:mi:ms:\ - :co#80:it#8:li#25:\ - :AL=\E[%dL:DL=\E[%dM:RA=\E[?7l:SA=\E[?7h:\ - :ac=jjkkllmmnnqqttuuvvwwxx:ae=^O:al=\E[L:as=^N:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:dl=\E[M:dm=\E[4h:\ - :do=^J:ec=\E[%dX:ed=\E[4l:ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\Eb\E[m\017\E[?7h:k0=\E[010q:k1=\E[001q:k2=\E[002q:\ - :k3=\E[003q:k4=\E[004q:k5=\E[005q:k6=\E[006q:k7=\E[007q:\ - :k8=\E[008q:k9=\E[009q:kd=\E[B:kh=\E[H:ku=\E[A:le=\E[D:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :r1=\Eb\E[m\017\E[?7h\E[H\E[J:rc=\E[u:sc=\E[s:se=\E[m:\ - :so=\E[7m:te=\E[20h:ti=\E[20;4l\E[?7h\Eb:ue=\E[m:up=\E[A:\ - :us=\E[4m:\ - :tc=ibm8503: -ibm8514|IBM 8514 color display:\ - :es:hs:\ - :li#41:\ - :cr=^M:do=^J:ds=\Ej\EYI \EI\Ek:fs=\Ek:kb=^H:kd=^J:kl=^H:\ - :nw=^M^J:sf=^J:ta=^I:ts=\Ej\EYI%+ \Eo:\ - :tc=ibmega: -ibm8514-c|IBM 8514 color display with standout and underline:\ - :es:hs:\ - :li#41:\ - :cr=^M:do=^J:ds=\Ej\EYI \EI\Ek:fs=\Ek:kb=^H:kd=^J:kl=^H:\ - :nw=^M^J:sf=^J:ta=^I:ts=\Ej\EYI%+ \Eo:\ - :tc=ibmega-c: - -ibmaed|IBM Experimental display:\ - :am:bs:eo:ms:\ - :co#80:it#8:li#52:\ - :al=\EN:cd=\EJ:ce=\EI:cl=\EH\EK:cm=\EY%+ %+ :dc=\EQ:dl=\EO:\ - :do=\EB:ei=:ho=\EH:ic=\EP:im=:kb=^H:kd=\EB:kl=\ED:kr=\EC:\ - :ku=\EA:le=^H:me=\E0:nd=\EC:se=\E0:so=\E0:ta=^I:up=\EA:\ - :vb=\EG: -ibm-apl|apl|IBM apl terminal simulator:\ - :li#25:tc=dm1520: -# (ibmmono: this had an unknown `sb' boolean, I changed it to `bs'. -# Also it had ":I0=f10:" which pretty obviously should be "l0=f10" -- esr) -ibmmono|IBM workstation monochrome:\ - :es:hs:\ - :al=\EL:dl=\EM:ds=\Ej\EY8 \EI\Ek:fs=\Ek:k0=\E<:k1=\ES:\ - :k2=\ET:k3=\EU:k4=\EV:k5=\EW:k6=\EP:k7=\EQ:k8=\ER:k9=\EY:\ - :kF=\EE:kI=\0:kN=\EE:kP=\Eg:kR=\EG:kb=^H:kh=\EH:l0=f10:\ - :md=\EZ:me=\Ew\Eq\Ez\EB:mk=\EF\Ef0;\Eb0;:mr=\Ep:se=\Ez:\ - :so=\EZ:sr=\EA:ts=\Ej\EY8%+ \Eo:ue=\Ew:us=\EW:\ - :tc=ibm3101: -ibmega|IBM Enhanced Color Display:\ - :cr=^M:do=^J:kb=^H:kd=^J:kl=^H:nw=^M^J:sf=^J:ta=^I:tc=ibmmono: -ibmega-c|ibm5154-c|IBM Enhanced Color Display with standout and underline:\ - :se=\EB:so=\EF\Ef3;:ue=\EB:us=\EF\Ef2;:\ - :tc=ibmmono: -ibmvga-c|IBM VGA display color termcap:\ - :cr=^M:do=^J:kb=^H:kd=^J:kl=^H:nw=^M^J:sf=^J:ta=^I:tc=ibmega-c: -ibmvga|IBM VGA display:\ - :cr=^M:do=^J:kb=^H:kd=^J:kl=^H:nw=^M^J:sf=^J:ta=^I:tc=ibmega: -# ibmapa* and ibmmono entries come from ACIS 4.3 distribution -rtpc|ibmapa16|IBM 6155 Extended Monochrome Graphics Display:\ - :li#32:\ - :ds=\Ej\EY@ \EI\Ek:ts=\Ej\EY@%+ \Eo:tc=ibmmono: -# Advanced Monochrome (6153) and Color (6154) Graphics Display: -ibmapa8c|ibmapa8|IBM 6153/4 Advanced Graphics Display:\ - :li#31:\ - :ds=\Ej\EY? \EI\Ek:ts=\Ej\EY?%+ \Eo:tc=ibmmono: -ibmapa8c-c|ibm6154-c|IBM 6154 Advanced Color Graphics Display:\ - :li#31:\ - :ds=\Ej\EY? \EI\Ek:mh=\EF\Ef7;:ts=\Ej\EY?%+ \Eo:tc=ibmega-c: -hft-c-old|HFT with Color PC850:\ - :Co#8:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:tc=ibm5151: -# From: Marc Pawliger -# also in /usr/lpp/bos/bsdsysadmin. -# (hft-c: this entry had :kb=\E[D:kf=\E[C: on the line with ku/kd/kh; this was -# pretty obviously mislabeled for :le: and :nd:; also ":ul=\E[4m:" was clearly -# a typo for ":us=\E[4m:"; also ":el=\E[K:" was a typo for ":ce=\E[K:". -# I also added / based on the terminal reset string. -# There was an unknown boolean ":ht:" which I assume was meant to set hardware -# tabs, so I have inserted it#8. Finally, :ac=^N: paired with the :ae: looked -# like a typo for :as=^N:; finally, added empty to quiet tic -- esr) -hft-c|IBM High Function Terminal:\ - :am:mi:ms:\ - :co#80:it#8:li#25:\ - :AL=\E[%dL:DL=\E[%dM:RA=\E[?7l:SA=\E[?7h:\ - :ac=jjkkllmmnnqqttuuvvwwxx:ae=^O:al=\E[L:as=^N:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:dl=\E[M:dm=\E[4h:\ - :do=^J:ec=\E[%dX:ed=\E[4l:ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\Eb\E[m\017\E[?7h:k0=\E[010q:k1=\E[001q:k2=\E[002q:\ - :k3=\E[003q:k4=\E[004q:k5=\E[005q:k6=\E[006q:k7=\E[007q:\ - :k8=\E[008q:k9=\E[009q:kd=\E[B:kh=\E[H:ku=\E[A:le=\E[D:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :r1=\Eb\E[m\017\E[?7h\E[H\E[J:rc=\E[u:sc=\E[s:se=\E[m:\ - :so=\E[7m:te=\E[20h:ti=\E[20;4l\E[?7h\Eb:ue=\E[m:up=\E[A:\ - :us=\E[4m: -hft|AIWS High Function Terminal:\ - :am:xo:\ - :co#80:li#25:\ - :al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:do=^J:ei=\E6:ho=\E[H:\ - :ic=\E[@:im=\E6:k1=\E[001q:k2=\E[002q:k3=\E[003q:\ - :k4=\E[004q:k5=\E[005q:k6=\E[006q:k7=\E[007q:k8=\E[008q:\ - :k9=\E[009q:kN=\E[153q:kP=\E[159q:ka=\E[010q:kb=^H:\ - :kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mk=\E[8m:mr=\E[7m:nd=\E[C:se=\E[m:sf=^J:\ - :so=\E[7m:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: -ibm-system1|system1|ibm system/1 computer:\ - :am:xt:\ - :co#80:li#24:\ - :bl=^G:cl=^Z:cm=\005%+ %+ :ho=^K:le=^H:nd=^\:sf=^J:up=^^: -# lft-pc850 : IBM Low Function Terminal Device -# lft "supports" underline, bold, and blink in the sense that the lft code -# sets all the right bits. HOWEVER, depending upon the adapter, these -# attributes may or may not be supported by the device driver. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -lft|lft-pc850|LFT-PC850|IBM LFT PC850 Device:\ - :am:bw:ms:xo:\ - :co#80:it#8:li#25:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:\ - :ae=\E(B:al=\E[L:as=\E(0:bl=^G:bt=\E[Z:cd=\E[2J:ce=\E[0K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:dc=\E[P:\ - :dl=\E[M:do=^J:ec=\E[%dX:ei=\E[4l:ho=\E[H:im=\E[4h:is=\Ec:\ - :k1=\E[001q:k2=\E[002q:k3=\E[003q:k4=\E[004q:k5=\E[005q:\ - :k6=\E[006q:k7=\E[007q:k8=\E[008q:k9=\E[009q:kD=\E[P:\ - :kI=\E[139q:kN=\E[154q:kP=\E[150q:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[0m:\ - :mr=\E[7m:nd=\E[C:se=\E[0m:sf=\ED:so=\E[7m:sr=\EL:ue=\E[0m:\ - :up=\E[A:us=\E[4m: - -# -# AIX entries. IBM ships these with AIX 3.2.5. -# AIX extension caps are commented out, -# except for box1 which has been translated to an string. -# -aixterm|IBM Aixterm Terminal Eemulator:\ - :es:hs:\ - :ac=jjkkllmmnnqqttuuvvwwxx:ds=\E[?E:fs=\E[?F:md=\E[1m:\ - :me=\E[0;10m\E(B:s0=\E(B:s1=\E(0:\ - :..sa=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;%?%p7%t;8%;m:\ - :sr@:ts=\E[?%p1%dT:\ - :tc=ibm6154: -aixterm-m|IBM AIXterm Monochrome Terminal Emulator:\ - :es:hs:\ - :ac=jjkkllmmnnqqttuuvvwwxx:ds=\E[?E:fs=\E[?F:md=\E[1m:\ - :me=\E[0;10m\E(B:s0=\E(B:s1=\E(0:\ - :..sa=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m:\ - :sr@:ts=\E[?%p1%dT:\ - :tc=ibm6153: -aixterm-m-old|old IBM AIXterm Monochrome Terminal Emulator:\ - :es:hs:\ - :ds=\E[?E:fs=\E[?F:md=\E[1m:\ - :..sa=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m:\ - :sr@:ts=\E[?%p1%dT:\ - :tc=ibm6153: -jaixterm|IBM Kanji Aixterm Terminal Eemulator:\ - :ac@:tc=aixterm: -jaixterm-m|IBM Kanji AIXterm Monochrome Terminal Emulator:\ - :ac@:\ - :tc=aixterm-m: - -#### Infoton/General Terminal Corp. -# - -# gt100 sounds like something DEC would come out with. Let's hope they don't. -i100|gt100|gt100a|General Terminal 100A (formerly Infoton 100):\ - :am:bs:\ - :co#80:li#24:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EK:cl=^L:cm=\Ef%r%+ %+ :cr=^M:\ - :dl=\EM:do=^J:ho=\EH:le=^H:nd=\EC:se=\Ea:sf=^J:so=\Eb:up=\EA:\ - :vb=\Eb\Ea: -i400|infoton 400:\ - :am:bs:\ - :co#80:li#25:\ - :al=\E[L:bl=^G:ce=\E[N:cl=\E[2J:cm=%i\E[%3;%3H:cr=^M:\ - :dc=\E[4h\E[2Q\E[P\E[4l\E[0Q:dl=\E[M:do=^J:\ - :ei=\E[4l\E[0Q:im=\E[4h\E[2Q:le=^H:nd=\E[C:sf=^J:up=\E[A: -# (addrinfo: removed obsolete ":bc=^Z:" -- esr) -addrinfo:\ - :am:\ - :co#80:li#24:\ - :bl=^G:cd=^K:cl=^L:..cm=\037%p1%{1}%-%c%p2%{1}%-%c:cr=^M:\ - :do=^J:ho=^H:le=^Z:ll=^H^\:nd=^Y:sf=^J:up=^\: -# (infoton: used to have the no-ops , , -- esr) -infoton:\ - :am:\ - :co#80:li#24:\ - :bl=^G:cd=^K:cl=^L:cr=^M:do=^J:le=^Z:ll=^H^\:nd=^Y:sf=^J:\ - :up=^\: - -# The ICL6402 was actually the Kokusai Display System 6402. -# The 6404 was the KDS7372 (color version of the 6402). -# -# ICL6404 control codes follow: -# -#code function -#~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -#ctrl-A set SOM position at cursor position -#ctrl-G Bell -#ctrl-H Backspace -#ctrl-I Horiz tab -#ctrl-J Linefeed -#ctrl-K Cursor up -#ctrl-L Cursor right -#ctrl-M Carriage return -#ctrl-N Disable xon/xoff to host -#ctrl-O Enable xon/xoff to host -#ctrl-R Enable bidirectional mode -#ctrl-T Disable bidirectional mode -#ctrl-V Cursor down -#ctrl-Z Clear unprotected data to insert char -#ctrl-^ Cursor home -#ctrl-_ Newline -# -#ESC lead-in char for multiple character command -# -#ESC space R execute power on sequence -#ESC ! p1 p2 define scroll region: -# p1 = scroll top line: 20h - 37h -# p1 = scroll bottom line: 20h - 37h -#ESC " unlock keyboard -#ESC # lock keyboard -#ESC $ Semi-graphics mode on -#ESC % Semi-graphics mode off -#ESC & protect mode on -#ESC ' protect mode off -#ESC ( write protect mode off (full intensity) -#ESC ) write protect mode on (half intensity) -# -#ESC * clear screen -#ESC + clear unprotected data to insert char -#ESC , clear unprotected data to half intensity spaces -#ESC - p1 p2 p3 p4 address cursor to page, row, column: -# p1 = page number 0 - 3 -# p2 = row 20h - 7fh -# p3 = column (lo) 20h - 7fh -# p4 = column (hi) 20h - 21h (only 132 col) -#ESC . p1 set cursor style: -# p1 = 0 invisible cursor -# p1 = 1 block blinking cursor -# p1 = 2 block steady cursor -# p1 = 3 underline blinking cursor -# p1 = 4 underline steady cursor -#ESC / transmit cursor location (page, row, column) -#ESC 0 p1 p2 p3 p4 program edit key: -# p1 = edit key code: '@'-'S', '`'-'s' -# p2 p3 p4 = program data (3 bytes) -# -#ESC 1 set tab -#ESC 2 clear tab at cursor -#ESC 3 clear all tabs -#ESC 4 send unprotect line to cursor -#ESC 5 send unprotect page to cursor -#ESC 6 send line to cursor -#ESC 7 send page to cursor -#ESC 8 n set scroll mode: -# n = 0 set jump scroll -# n = 1 set smooth scroll -#ESC 9 n control display: -# n = 0 display off -# n = 1 display on -#ESC : clear unprotected data to null -#ESC ; clear unprotected data to insert char -# -#ESC < keyclick on -#ESC = p1 p2 address cursor to row, column -# p1 = row 20h - 7fh -# p2 = column (lo) 20h - 7fh -# p3 = column (hi) 20h - 21h (only 132 col) -#ESC > keyclick off -#ESC ? transmit cursor location (row, column) -# -#ESC @ copy print mode on -#ESC A copy print mode off -#ESC B block mode on -#ESC C block mode off (conversation mode) -#ESC D F set full duplex -#ESC D H set half duplex -#ESC E line insert -#ESC F p1 p2 set page colour (p1 = f/grnd, p2 = b/grnd) -# 0 = black, 1 = red, 2 = green, 3 = yellow -# 4 = blue, 5 = magenta, 6 = cyan, 7 = white -#ESC G n set serial field attribute (n = 30h - 3Fh) -#ESC H n full graphics mode: -# n = 0 exit full graphics mode -# n = 1 enter full graphics mode -#ESC I back tab -#ESC J back page -#ESC K forward page -# -#ESC L unformatted page print -#ESC M L move window left (132 col mode only) -#ESC M R move window right (132 col mode only) -#ESC N set page edit (clear line edit) -#ESC O set line edit (clear page edit) -#ESC P formatted page print -#ESC Q character insert -#ESC R line delete -#ESC S send message unprotected only -#ESC T erase line to insert char -#ESC U set monitor mode (see ESC X, ESC u) -# -#ESC V n select video attribute mode: -# n = 0 serial field attribute mode -# n = 1 parallel character attribute mode -#ESC V 2 n define line attribute: -# n = 0 single width single height -# n = 1 single width double height -# n = 2 double width single height -# n = 3 double width double height -#ESC V 3 n select character font: -# n = 0 system font -# n = 1 user defined font -#ESC V 4 n select screen mode: -# n = 0 page screen mode -# n = 1 virtual screen mode -#ESC V 5 n control mouse mode: -# n = 0 disable mouse -# n = 1 enable sample mode -# n = 2 send mouse information -# n = 3 enable request mode -#ESC W character delete -#ESC X clear monitor mode (see ESC U, ESC u) -#ESC Y erase page to insert char -# -#ESC Z n send user/status line: -# n = 0 send user line -# n = 1 send status line -# n = 2 send terminal ID -#ESC [ p1 p2 p3 set character attribute (parallel char mode): -# p1: 0 = normal -# 1 = blank -# 2 = blink -# 3 = blink blank (= blank) -# 4 = reverse -# 5 = reverse blank -# 6 = reverse blink -# 7 = reverse blink blank (= reverse blank) -# 8 = underline -# 9 = underline blank -# : = underline blink -# ; = underline blink blank -# < = reverse underline -# = = reverse underline blank -# > = reverse underline blink -# ? = reverse underline blink blank -# p2, p3: f/grnd, b/grnd colour -# (see ESC F for colours) -# use ZZ for mono, eg. -# ESC [ 0 Z Z for normal -# ESC [ 4 Z Z for inverse etc. -# -#ESC \ n set page size: -# n = 1 24 lines/page -# n = 2 48 lines/page -# n = 3 72 lines/page -# n = 4 96 lines/page -#ESC ] n set Wordstar mode: -# n = 0 normal (KDS7372) mode -# n = 1 Wordstar mode -# -#ESC b set foreground colour screen -# -#ESC c n enter self-test mode: -# n = 0 exit self test mode -# n = 1 ROM test -# n = 2 RAM test -# n = 3 NVRAM test -# n = 4 screen display test -# n = 5 main/printer port test -# n = 6 mouse port test -# n = 7 graphics board test -# n = 8 graphics memory test -# n = 9 display all 'E' -# n = : display all 'H' -#ESC d set background colour screen -# -#ESC e n program insert char (n = insert char) -#ESC f text CR load user status line with 'text' -# -#ESC g display user status line on 25th line -#ESC h display system status line on 25th line -#ESC i tab -#ESC j reverse linefeed -#ESC k n duplex/local edit mode: -# n = 0 duplex edit mode -# n = 1 local edit mode -#ESC l n select virtual screen: -# n = 0 screen 1 -# n = 1 screen 2 -#ESC m save current config to NVRAM -#ESC n p1 select display screen: -# p1 = 0 screen 1 -# p1 = 1 screen 2 -# p1 = 2 screen 3 -# p1 = 3 screen 4 -#ESC o p1 p2 set characters/line and attribute: -# p1 = 0 80 chars/line -# -#ESC o p1 p2 set characters/line and attribute: -# p1 = 0 80 chars/line -# p1 = 1 132 chars/line -# p2 = 0 single width single height -# p2 = 1 single width double height -# p2 = 2 double width single height -# p2 = 3 double width double height -# -#ESC q insert mode on -#ESC r edit mode on -#ESC s send message all -#ESC t erase line to null -#ESC u clear monitor mode (see ESC U, ESC X) -#ESC v autopage mode on -#ESC w autopage mode off -#ESC x p1 p2 p3 define delimiter code... -#ESC y erase page to null -# -#ESC z 2 p1 p2 p3 p4 draw quadrangle: -# p1 = starting row -# p2 = starting column -# p3 = end row -# p4 = end column -# -#ESC { p1 p2 p3 p4 configure main port -# (baud, stop bits, parity, word length) -# -#ESC | p1 p2 text Ctrl-Y program function key with 'text': -# p1 = function key code: -# '1' - ';' normal f1- f11 -# '<' - 'F' shifted f1 - f11 -# p2 = program mode: -# 1 = FDX -# 2 = LOC -# 3 = HDX -# Ctrl-Y = terminator -# (use Ctrl-P to escape ^P, ^Y ) -# -#ESC } p1 p2 p3 p4 configure printer port -# (baud, stop bits, parity, word length) -#ESC ~ send system status -# -# Codes and info from Peter Disdale 12 May 1997 -# -# Entry is by esr going solely on above information and is UNTESTED. -# This actually looks a lot like a Televideo 9xx. -# This entry uses page 0 and is monochrome; I'm not brave enough to try -# to make color work without a test terminal. The :am: capability is a guess. -# The initialization string sets conversation mode, blinking underline cursor, -# full duplex, parallel attribute mode, display user status line, white -# foreground, black background, normal highlight. -# -icl6404|kds7372|icl6402|kds6402|ICL 6404 aka Kokusai Display Systems 7372:\ - :am:bs:hs:\ - :co#80:li#24:\ - :DC=\EW:al=\EE:bl=^G:bt=\EI:cl=\E*:cm=\E=%+ %+P%+P:cr=^M:\ - :..cs=\E\041%+%p1%{32}%+%p2%{32} cud1=\026:ct=\E3:\ - :dl=\ER:ei=\Er:ho=^^:i1=\EC\E.3\EDF\EV1\Eg\E[0ZZ:im=\Eq:\ - :mb=\E[2ZZ:me=\E[0ZZ:mk=\E[1ZZ:mr=\E[4ZZ:nd=^L:nw=^_:\ - :r2=\Eo1:\ - :..sa=\E[%{0}%?%p1%t%{4}%|%;%?%p2%t%{8}%|%;%?%p3%t%{4}%|%;%?%p4%t%{2}%|%;%?%p7%t%{1}%|%;ZZ:\ - :se=\E[%gh%{4}%^%Ph%gh%dZZ:so=\E[8ZZ:st=\E1:ta=^I:\ - :ue=\E[%gh%{8}%^%Ph%gh%dZZ:up=^K:us=\E[8ZZ:ve=\E.3:\ - :vi=\E.0:vs=\E.1: -icl6404-w|kds7372-w|ICL 6404 aka Kokusai Display Systems 7372 132 cols:\ - :r2=\Eo1:\ - :tc=icl6404: - -#### Interactive Systems Corp -# -# ISC used to sell OEMed and customized hardware to support ISC UNIX. -# ISC UNIX still exists in 1995, but ISC itself is no more; they got -# bought out by Sun. -# - -# From: Wed Sep 16 08:06:44 1981 -# (intext: removed obsolete ":ma=^K^P^R^L^L ::bc=^_:", also the -# ":le=^_:" later overridden -- esr) -intext|Interactive Systems Corporation modified owl 1200:\ - :am:bs:\ - :co#80:it#8:li#24:sg#1:\ - :al=\020:bl=^G:bt=^Y:cd=\026J:ce=^Kp^R:cl=\014:\ - :cm=\017%+ %+ :cr=^M:dc=\022:dl=\021:do=^J:ei=^V<:im=^V;:\ - :ip=:k0=^VJ\r:k1=^VA\r:k2=^VB\r:k3=^VC\r:k4=^VD\r:k5=^VE\r:\ - :k6=^VF\r:k7=^VG\r:k8=^VH\r:k9=^VI\r:kb=^H:kd=^J:ke=^V9:\ - :kh=^Z:kl=^_:kr=^^:ks=\036\072\264\026%:ku=^\:le=^H:nd=^^:\ - :se=^V# :sf=^J:so=^V$\054:ta=^I:up=^\: -intext2|intextii|INTERACTIVE modified owl 1251:\ - :am:bw:ul:\ - :co#80:li#24:sg#0:\ - :al=\E[L:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:ch=\E[%+^AG:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:\ - :do=\E[B:ei=:ic=\E[@:im=:k0=\E@\r:k1=\EP\r:k2=\EQ\r:\ - :k3=\ES\r:k4=\ET\r:k5=\EU\r:k6=\EV\r:k7=\EW\r:k8=\EX\r:\ - :k9=\EY\r:kb=^H:kd=\EB\r:kh=\ER\r:kl=\ED\r:kr=\EC\r:\ - :ku=\EA\r:l0=REFRSH:l1=DEL CH:l2=TABSET:l3=GOTO:l4=+PAGE:\ - :l5=+SRCH:l6=-PAGE:l7=-SRCH:l8=LEFT:l9=RIGHT:nd=\E[C:\ - :se=\E[2 D:sf=\E[S:so=\E[6 D:sr=\E[T:ta=^I:ue=\E[2 D:\ - :up=\E[A:us=\E[18 D:\ - :vb=\E[;;;;;;;;;2;;u\E[;;;;;;;;;1;;u: - -#### Kimtron (abm, kt) -# -# Kimtron seems to be history, but as March 1998 these people are still -# offering repair services for Kimtron equipment: -# -# Com/Pair Monitor Service -# 1105 N. Cliff Ave. -# Sioux Falls, South Dakota 57103 -# -# WATS voice: 1-800/398-4946 -# POTS fax: +1 605/338-8709 -# POTS voice: +1 605/338-9650 -# Email: -# Internet/Web: -# -# Kimtron entries include (undocumented) codes for: enter dim mode, -# enter bold mode, enter reverse mode, turn off all attributes. -# - -# Kimtron ABM 85 added by Dual Systems -# (abm85: removed duplicated ":kd=^J:" -- esr) -abm85|Kimtron ABM 85:\ - :am:bs:bw:ms:\ - :co#80:it#8:li#24:sg#1:\ - :al=\EE:bt=\EI:cd=\Ey:ce=\Et:cl=\E*:cm=\E=%+ %+ :dc=\EW:\ - :dl=\ER:do=^J:ei=\Er:if=/usr/share/tabset/stdcrt:im=\EQ:\ - :is=\EC\EX\Eg\En\E%\Er\E(\Ek\Em\Eq:kb=^H:kd=^J:kh=^^:\ - :kl=^H:kr=^L:ku=^K:le=^H:nd=^L:se=\Ek:so=\Ej:ta=^I:ue=\Em:\ - :up=^K:us=\El: -# Kimtron ABM 85H added by Dual Systems. -# Some notes about the abm85h entries: -# 1) there are several firmware revs of 85H in the world. Use abm85h-old for -# firmware revs prior to SP51 -# 2) Make sure to use abm85h entry if the terminal is in 85h mode and the -# abm85e entry if it is in tvi920 emulation mode. They are incompatible -# in some places and NOT software settable i.e., :is: can't fix it) -# 3) In 85h mode, the arrow keys and special functions transmit when -# the terminal is in dup-edit, and work only locally in local-edit. -# Vi won't swallow `del char' for instance, but :ti: turns on -# dup-edit anyway so that the arrow keys will work right. If the -# arrow keys don't work the way you like, change :ti:, :te:, and -# :is:. Note that 920E mode does not have software commands to toggle -# between dup and local edit, so you get whatever was set last on the -# terminal. -# 4) :vb: attribute is nice, but seems too slow to work correctly -# (\Eb:pc:\Ed) -# 5) Make sure `hidden' attributes are selected. If `embedded' attributes -# are selected, the entry should be removed. -# 6) auto new-line should be on (selectable from setup mode only) -# -# From: Erik Fair Sun Oct 27 07:21:05 1985 -abm85h|Kimtron ABM 85H native mode:\ - :hs:\ - :sg@:\ - :bl=^G:ds=\Ee:fs=^M:im=\EZ:\ - :is=\EC\EN\EX\024\016\EA\Ea\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\EG0\Ed\E.4\El:\ - :kd=^V:me=\E(\EG0:mh=\E):mk@:ts=\Eg\Ef:vb@:ve=\E.4:vs=\E.2:\ - :tc=adm+sgr:tc=abm85: -abm85e|Kimtron ABM 85H in 920E mode:\ - :sg@:\ - :bl=^G:im=\EZ:\ - :is=\EC\EX\EA\E%\E9\Ee\Er\En\E"\E}\E'\E(\Ef\r\Ek\Eq\Em:\ - :me=\E(\Ek:mh=\E):mr=\Ej:vb@:\ - :tc=abm85: -abm85h-old|oabm85h|o85h|Kimtron ABM 85H with old firmware rev.:\ - :sg@:\ - :bl=^G:im=\EZ:\ - :is=\E}\EC\EX\Ee\En\E%\Er\E(\Ek\Em\Eq\Ed\ET\EC\E9\EF:\ - :me=\E(\Ek:mh=\E):mr=\Ej:\ - :tc=abm85: -# From: -# (kt7: removed obsolete :ma=^V^J^L :" -- esr) -kt7|kimtron model kt-7:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :al=\EE:bt=\EI:cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :dc=\EW:\ - :dl=\ER:do=^V:ei=:fs=\Eg:ho=^^:ic=\EQ:\ - :if=/usr/share/tabset/stdcrt:im=:is=\El\E":k0=^AI\r:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kA=\EE:kB=\EI:kC=^Z:kD=\EW:\ - :kE=\ET:kI=\EQ:kL=\ER:kS=\EY:kb=^H:kd=^V:kh=^^:kl=^H:kr=^L:\ - :ku=^K:le=^H:mk@:nd=^L:ta=^I:ts=\Ef:up=^K:\ - :tc=adm+sgr: -# Renamed TB=^I to :ta:, BE=^G to :bl:, BS=^H to :kb:, N to :kS: (based on the -# other kt7 entry and the adjacent key capabilities). Removed EE which is -# identical to :mh:. Removed :ES=\EGD: which is some kind of highlight -# but we can't figure out what. -kt7ix|kimtron model kt-7 or 70 in IX mode:\ - :am:bw:\ - :co#80:it#8:li#25:\ - :@7=\EY:PU=\EK:ac=jYk?lZm@nEqDt4uCvAwBx3:ae=\E%:al=\EE:\ - :as=\E$:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E*:cm=\E=%+ %+ :\ - :cr=^M:dc=\EW:dl=\ER:do=^V:ds=\Ef\r:ei=:fs=^M:ho=^^:ic=\EQ:\ - :im=:is=\EG0\E s\017\E~:k0=^AI\r:k1=^A@\r:k2=^AA\r:\ - :k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:\ - :k9=^AH\r:kA=\EE:kB=\EI:kC=\E*:kE=\ET:kI=\EQ:kL=\ER:kN=\EJ:\ - :kS=\EY:kb=^H:kd=\E[B:kh=^^:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :mb=\EG2:me=\EG0:mh=\EG@:nd=^L:nw=^M^J:se=\EG0:sf=^J:\ - :so=\EG4:ta=^I:ts=\Ef:ue=\EG0:up=^K:us=\EG8:ve=\E.3:vi=\E.0: - -#### Microdata/MDIS -# -# This was a line of terminals made by McDonnell-Douglas Information Systems. -# These entries come direct from MDIS documentation. I have edited them only -# to move primary names of the form p[0-9] * to aliases, and to comment out -# :ae:/:as: in a couple of entries without strings. I have -# also removed the change history; the last version indicates this is -# version 4.3 by A.Barkus, September 1990 (earliest entry is October 1989). -# - -# McDonnell Information Systems Terminal Family History -# ========================================= -# -# Prism-1, Prism-2 and P99: -# Ancient Microdata and CMC terminals, vaguely like Adds Regent 25. -# -# Prism-4 and Prism-5: -# Slightly less ancient range of Microdata terminals. Follow-on from -# Prism-2, but with many enhancements. P5 has eight display pages. -# -# Prism-6: -# A special terminal for use with library systems, primarily in Germany. -# Limited numbers. Similar functionality to P5 (except attributes?). -# -# Prism-7, Prism-8 and Prism-9: -# More recent range of MDIS terminals, in which P7 and P8 -# replace the P4 & P5, with added functionality, and P9 is the flagship. -# The P9 has two emulation modes - P8 and ANSI - and includes a -# large number of the DEC VT220 control sequences. Both -# P8 and P9 support 80c/24ln/8pg and 132cl/24li/4pg formats. -# -# Prism-12 and Prism-14: -# Latest range, functionally very similar to the P9. The P14 has a -# black-on-white overscanning screen. -# -# The terminfo definitions given here are: -# -# p2 - Prism-2 (or Prism-1 or P99). -# -# p4 - Prism-4 (and older P7s & P8s). -# p5 - Prism-5 (or Prism-6). -# -# p7 - Prism-7. -# p8 - Prism-8 (in national or multinational mode). -# p8-w - 132 column version of p8. -# p9 - Prism-9 in ANSI mode. -# p9-w - 132 column version of p9. -# p9-8 - Prism-9 in Prism-8 emulation mode. -# p9-8-w - As p9-8, but with 132 columns. -# -# p12 - Prism-12 in ANSI mode. -# p12-w - 132 column version of p12. -# p12-m - Prism-12 in MDC emulation mode. -# p12-m-w - As p12-m, but with 132 columns. -# p14 - Prism-14 in ANSI mode. -# p14-w - 132 column version of p14. -# p14-m - Prism-14 in MDC emulation mode. -# p14-m-w - As p14-m, but with 132 columns. -# -# p2: Prism-2 -# ----------- -# -# Includes Prism-1 and basic P99 without SP or MP loaded. -# The simplest form of Prism-type terminal. -# Basic cursor movement and clearing operations only. -# No video attributes. -# Notes: -# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next -# value up, followed by backspace. -# -prism2|MDC Prism-2:\ - :am:bw:ms:\ - :co#80:li#24:\ - :bl=^G:cd=\EJ:ce=\EK:\ - :..ch=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c:\ - :cl=\014:\ - :..cm=\013%p1%{32}%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c:\ - :cr=^M:cv=\013%+ :do=^J:ho=^A:kb=^H:kh=^A:le=^H:nd=^F:sf=^J:\ - :up=^Z: - -# p4: Prism-4 -# ----------- -# -# Includes early versions of P7 & P8. -# Basic family definition for most Prisms (except P2 and P9 ANSI). -# Notes: -# Horizontal cursor qualifiers of NUL, XON and XOFF are mapped to the next -# value up, followed by backspace. -# Cursor key definitions removed because they interfere with vi and csh keys. -# -prism4|p4|P4|MDC Prism-4:\ - :5i:am:bw:hs:ms:\ - :co#80:li#24:sg#1:ws#72:\ - :bl=^G:cd=\EJ:ce=\EK:\ - :..ch=\020%p1%{10}%/%{16}%*%p1%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c:\ - :cl=\014:\ - :..cm=\013%p1%{32}%+%c\020%p2%{10}%/%{16}%*%p2%{10}%m%+%Pc%?%{17}%gc%=%{19}%gc%=%|%gc%!%|%t%{1}%gc%+%c%{8}%e%gc%;%c:\ - :cr=^M:cv=\013%+ :do=^J:ds=\035\343\035\345:fs=^]\345:\ - :ho=^A:kb=^H:kh=^A:le=^H:mb=^CB:me=^C :mh=^CA:mk=^CH:mr=^CD:\ - :nd=^F:pf=\ET:po=\ER:ps=\EU:\ - :..sa=\003%{64}%?%p1%p3%|%t%{4}%+%;%?%p2%t%{16}%+%;%?%p4%t%{2}%+%;%?%p5%t%{1}%+%;%?%p7%t%{8}%+%;%c%?%p9%t\016%e\017%;:\ - :se=^C :sf=^J:so=^CD:ts=^]\343:ue=^C :up=^Z:us=^CP:\ - :ve=^]\342:vi=^]\344: - -# p5: Prism-5 -# ----------- -# -# Same definition as p4. Includes Prism-6 (not tested!). -# Does not use any multi-page features. -# -prism5|p5|P5|MDC Prism-5:\ - :tc=p4: - -# p7: Prism-7 -# ----------- -# -# Similar definition to p4. Uses ANSI cursor motion to avoid network problems. -# Notes: -# Use p4 for very early models of P7. -# Rev-index removed; can't send nulls to terminal in 8-bit modes. -# -prism7|p7|P7|MDC Prism-7:\ - :ch@:cm=\E[%i%d;%dH:cv@:tc=p4: - -# p8: Prism-8 -# ----------- -# -# Similar definition to p7. Uses ANSI cursor motion to avoid network problems. -# Supports national and multinational character sets. -# Notes: -# Alternate char set operations only work in multinational mode. -# Use p4 for very early models of P8. -# Rev-index removed; can't send nulls to terminal in 8-bit modes. -# (esr: commented out :as:/:ae: because there's no ) -# -prism8|p8|P8|MDC Prism-8:\ - :ch=\E[%i%d`:cm=\E[%i%d;%dH:cv=\E[%i%dd:is=\E[<12h:tc=p4: - -# p8-w: Prism-8 in 132 column mode -# -------------------------------- -# -# 'Wide' version of p8. -# Notes: -# Rev-index removed; can't send nulls to terminal in 8-bit modes. -# -prism8-w|p8-w|P8-W|MDC Prism-8 in 132 column mode:\ - :co#132:\ - :is=\E[<12h\E[<14h:tc=p8: - -# p9: Prism-9 in ANSI mode -# ------------------------- -# -# The "flagship" model of this generation of terminals. -# ANSI X3.64 (ISO 6429) standard sequences, plus many DEC VT220 ones. -# Notes: -# Tabs only reset by "reset". Otherwise assumes default (8 cols). -# Fixes to deal with terminal firmware bugs: -# . 'ri' uses insert-line since rev index doesn't always -# . 'sgr0' has extra '0' since esc[m fails -# . 'fsl' & 'dsl' use illegal char since cr is actioned wrong on line 25 -# Not covered in the current definition: -# . Labels -# . Programming Fn keys -# . Graphic characters (defaults correctly to vt100) -# . Padding values (sets xon) -# (esr: commented out :as:/:ae: because there's no ) -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -prism9|p9|P9|MDC Prism-9 in ANSII mode:\ - :5i:am:bw:hs:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:ws#72:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:F1=\E[23~:\ - :F2=\E[24~:F3=\E[25~:F4=\E[26~:F5=\E[28~:F6=\E[29~:\ - :F7=\E[31~:F8=\E[32~:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:\ - :al=\E[L:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:ch=\E[%i%d`:cl=^L:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%d%v:ct=\E[2g:\ - :cv=\E[%i%dd:dc=\E[P:dl=\E[M:do=^J:ds=\E[%}\024:ec=\E[%dX:\ - :ei=\E[4l:fs=^T:ho=\E[H:im=\E[4h:is=\E[&p\E[<12l\E F:\ - :k1=\E[11~:k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:\ - :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kC=^L:\ - :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[0m:mp=\E[32%{:mr=\E[7m:nd=\E[C:\ - :nw=^M^J:pf=\E[4i:po=\E[5i:ps=\E[i:\ - :r2=\E[&p\E[<12l\E F\E[3g\E[9;17;25;33;41;49;57;65;73 N:\ - :rc=\E[%z:rp=\E[%r%db%.:sc=\E[%y:se=\E[27m:sf=^J:so=\E[7m:\ - :sr=\E[L:st=\EH:ta=^I:ts=\E[%i%p1%d%%}:ue=\E[24m:up=\E[A:\ - :us=\E[4m:ve=\E[<4h:vi=\E[<4l: - -# p9-w: Prism-9 in 132 column mode -# -------------------------------- -# -# 'Wide' version of p9. -# -prism9-w|p9-w|P9-W|MDC Prism-9 in 132 column mode:\ - :co#132:\ - :is=\E[&p\E[<12l\E F\E[<14h:\ - :r2=\E[&p\E[<12l\E F\E[<14h:tc=p9: - -# p9-8: Prism-9 in P8 mode -# ------------------------ -# -# P9 terminal in P8 emulation mode. -# Similar to p8 definition. -# Insertion and deletion operations possible. -# -prism9-8|p9-8|P9-8|MDC Prism-9 in P8 mode:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:al=\E[L:dc=\E[P:\ - :dl=\E[M:ei=:ic=\E[@:im=:\ - :tc=p8: - -# p9-8-w: Prism-9 in P8 and 132 column modes -# ------------------------------------------ -# -# P9 terminal in P8 emulation mode and 132 column mode. -# -prism9-8-w|p9-8-w|P9-8-W|MDC Prism-9 in Prism 8 emulation and 132 column mode:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:IC=\E[%d@:al=\E[L:dc=\E[P:\ - :dl=\E[M:ei=:ic=\E[@:im=:\ - :tc=p8-w: - -# p12: Prism-12 in ANSI mode -# --------------------------- -# -# See p9 definition. -# -prism12|p12|P12|MDC Prism-12 in ANSI mode:\ - :tc=p9: - -# p12-w: Prism-12 in 132 column mode -# ---------------------------------- -# -# 'Wide' version of p12. -# -prism12-w|p12-w|P12-W|MDC Prism-12 in 132 column mode:\ - :tc=p9-w: - -# p12-m: Prism-12 in MDC emulation mode -# ------------------------------------- -# -# P12 terminal in MDC emulation mode. -# Similar to p8 definition. -# Insertion and deletion operations possible. -# -prism12-m|p12-m|P12-M|MDC Prism-12 in MDC emulation mode:\ - :tc=p9-8: - -# p12-m-w: Prism-12 in MDC emulation and 132 column modes -# ------------------------------------------------------- -# -# P12 terminal in MDC emulation mode and 132 column mode. -# -prism12-m-w|p12-m-w|P12-M-W|MDC Prism-12 in MDC emulation and 132 column mode:\ - :tc=p9-8-w: - -# p14: Prism-14 in ANSII mode -# --------------------------- -# -# See p9 definition. -# -prism14|p14|P14|MDC Prism-14 in ANSII mode:\ - :tc=p9: - -# p14-w: Prism-14 in 132 column mode -# ---------------------------------- -# -# 'Wide' version of p14. -# -prism14-w|p14-w|P14-W|MDC Prism-14 in 132 column mode:\ - :tc=p9-w: - -# p14-m: Prism-14 in MDC emulation mode -# ------------------------------------- -# -# P14 terminal in MDC emulation mode. -# Similar to p8 definition. -# Insertion and deletion operations possible. -# -prism14-m|p14-m|P14-M|MDC Prism-14 in MDC emulation mode:\ - :tc=p9-8: - -# p14-m-w: Prism-14 in MDC emulation and 132 column modes -# ------------------------------------------------------- -# -# P14 terminal in MDC emulation mode and 132 column mode. -# -prism14-m-w|p14-m-w|P14-M-W|MDC Prism-14 in MDC emulation and 132 column mode:\ - :tc=p9-8-w: - -# End of McDonnell Information Systems Prism definitions - -# These things were popular in the Pick database community at one time -# From: George Land 24 Sep 1996 -p8gl|prism8gl|McDonnell-Douglas Prism-8 alternate definition:\ - :am:bw:hs:mi:\ - :co#80:li#24:ma#1:sg#1:ws#78:\ - :F2=^AJ\r:F3=^AK\r:F4=^AL\r:F5=^AM\r:F6=^AN\r:F7=^AO\r:\ - :bl=^G:cd=\EJ:ce=\EK:cl=^L:cm=\E[%i%d;%dH:cr=^M:dc= ^H:\ - :dl=^P:do=^J:ho=^A:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:\ - :k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:k;=^AI\r:\ - :kD= ^H:kE=\EK:kL=^P:kS=\EJ:kb=^H:kd=^J:kh=^A:kl=^U:kr=^F:\ - :ku=^Z:l1=F1:l2=F2:l3=F3:l4=F4:l5=F5:l6=F6:l7=F7:l8=F8:l9=F9:\ - :la=F10:le=^U:mb=^CB:me=^C :mh=^CA:mk=^CH:mr=^CD:nd=^F:\ - :nw=^J^M:pc=\0:se=^C :sf=^J:so=^CE:ue=^C :up=^Z:us=^C0: - -#### Microterm (act, mime) -# -# The mime1 entries refer to the Microterm Mime I or Mime II. -# The default mime is assumed to be in enhanced act iv mode. -# - -# New "safe" cursor movement (5/87) from . Prevents -# freakout with out-of-range args on Sytek multiplexors. No :so=^N: and -# :se=^N: since it gets confused and it's too dim anyway. No :ic: -# since Sytek insists ^S means xoff. -# (act4: found ":ic=2^S:ei=:im=:ip=.1*^V:" commented out in 8.3 -- esr) -act4|microterm|microterm act iv:\ - :am:bs:\ - :co#80:li#24:\ - :al=2.3*\001<2.3*/>:bl=^G:cd=2.2*\037:ce=.1*\036:\ - :cl=12\014:cm=\024%+^X%>/0%+P:cr=^M:dc=.1*\004:\ - :dl=2.3*\027:do=^K:ho=^]:kd=^K:kl=^H:kr=^X:ku=^Z:le=^H:nd=^X:\ - :sf=^J:up=^Z: -# The padding on :sr: and :ta: for act5 and mime is a guess and not final. -# The act 5 has hardware tabs, but they are in columns 8, 16, 24, 32, 41 (!)... -# (microterm5: removed obsolete ":ma==^Z^P^Xl^Kj:" -- esr) -act5|microterm5|microterm act v:\ - :kd=^K:kl=^H:kr=^X:ku=^Z:sr=\EH:uc=^H\EA:tc=act4: -# Mimes using brightness for standout. Half bright is really dim unless -# you turn up the brightness so far that lines show up on the screen. -mime-fb|full bright mime1:\ - :is=^S\E:se=^S:so=^Y:tc=mime: -mime-hb|half bright mime1:\ - :is=^Y\E:se=^Y:so=^S:tc=mime: -# (mime: removed obsolete ":ma=^X ^K^J^Z^P:"; removed ":do=^K:" that overrode -# the more plausible ":do=^J:" -- esr) -# uc was at one time disabled to get around a curses bug, be wary of it -mime|mime1|mime2|mimei|mimeii|microterm mime1:\ - :am:bs:\ - :co#80:it#8:li#24:vt#9:\ - :al=\001:bl=^G:cd=^_:ce=^^:cl=^]^C:cm=\024%+^X%> 0%+P:\ - :cr=^M:dl=\027:do=^J:ho=^]:is=^S\E^Q:kd=^K:kl=^H:kr=^X:ku=^Z:\ - :le=^H:nd=^X:sf=^J:sr=\022:ta=\011:uc=^U:up=^Z: -# These termcaps (for mime2a) put the terminal in low intensity mode -# since high intensity mode is so obnoxious. -mime2a-s|microterm mime2a (emulating an enhanced soroc iq120):\ - :am:bs:\ - :co#80:li#24:\ - :al=\001:bl=^G:cd=\EJ:ce=\EK:cl=\EL:cm=\E=%+ %+ :cr=^M:\ - :dc=\ED:dl=\027:do=^J:ei=^Z:ho=^^:im=\EE:ip=:is=\E):kd=^J:\ - :kl=^H:kr=^L:ku=^K:le=^H:nd=^L:se=\E;:sf=^J:so=\E\072:sr=\EI:\ - :ue=\E7:up=\EI:us=\E6: -# This is the preferred mode (but ^X can't be used as a kill character) -mime2a|mime2a-v|microterm mime2a (emulating an enhanced vt52):\ - :bs:\ - :co#80:it#8:li#24:\ - :al=\001:bl=^G:cd=\EQ:ce=\EP:cl=\EL:cm=\EY%+ %+ :cr=^M:\ - :dc=^N:dl=\027:do=^J:ei=^Z:ho=\EH:im=^O:ip=:is=^Y:kd=\EB:\ - :kl=\ED:kr=\EC:ku=\EA:le=^H:nd=\EC:se=\E9:sf=^J:so=\E8:\ - :sr=\EA:ta=^I:ue=\E5:up=\EA:us=\E4: -# (mime3a: removed obsolete ":ma=^X ^K^J^Z^P:" -- esr) -mime3a|mime1 emulating 3a:\ - :am@:\ - :kd=^K:kl=^H:kr=^X:ku=^Z:tc=adm3a: -mime3ax|mime-3ax|mime1 emulating enhanced 3a:\ - :it#8:\ - :al=\001:cd=^_:ce=^X:dl=\027:ta=\011:tc=mime3a: -# Wed Mar 9 18:53:21 1983 -# We run our terminals at 2400 baud, so there might be some timing problems at -# higher speeds. The major improvements in this model are the terminal now -# scrolls down and insert mode works without redrawing the rest of the line -# to the right of the cursor. This is done with a bit of a kludge using the -# exit graphics mode to get out of insert, but it does not appear to hurt -# anything when using vi at least. If you have some users using act4s with -# programs that use curses and graphics mode this could be a problem. -mime314|mm314|mime 314:\ - :am:\ - :co#80:li#24:\ - :al=^A:cd=^_:ce=^^:cl=^L:cm=\024%.%.:dc=^D:dl=^W:ei=^V:ho=^]:\ - :im=^S:kd=^K:kl=^H:kr=^X:ku=^Z:le=^H:nd=^X:ta=^I:up=^Z: -# Microterm mime 340 from University of Wisconsin -mm340|mime340|mime 340:\ - :co#80:li#24:\ - :al=46\EU:cd=2*\037:ce=2.1\EL:cl=12\032:cm=\E=%+ %+ :\ - :cr=^M:dc=2.1*\E#:dl=49.6\EV:do=^J:is=\E\054:kb=^H:kd=^J:\ - :kl=^H:ku=^K:le=^H:nd=^L:nw=^M^J:sf=^J:ta=^I:up=^K: -# This came from University of Wisconsin marked "astro termcap for jooss". -# (mt4520-rv: removed obsolete ":kn#4:" and incorrect ":ri=\E[C:"; -# also added / based on the init string -- esr) -mt4520-rv|micro-term 4520 reverse video:\ - :am:hs:ms:xn:xo:\ - :co#80:it#8:li#24:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\ - :al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:ct=\E[g:dc=\E[P:dl=\E[M:do=\E[B:ei=:\ - :fs=\E[?5l\E[?5h:ho=\E[H:ic=\E[@:im=:\ - :is=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[1;24r\E[24;1H\E[H\E[J:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=\E[D:ll=\E[24;1H:me=\E[m:\ - :nd=\E[C:nw=\EE:\ - :r1=\E(B\E[2l\E>\E[20l\E[?3l\E[?5h\E[?7h\E[H\E[J:\ - :rc=\E8:rf=/usr/share/tabset/vt100:sc=\E7:se=\E[0m:\ - :sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:ts=\E[25;1H:ue=\E[24m:\ - :up=\E[A:us=\E[4m:vb=\E[?5l\E[?5h:ve=\E[0V\E8:\ - :vs=\E7\E[0U: - -# Fri Aug 5 08:11:57 1983 -# This entry works for the ergo 4000 with the following setups: -# ansi,wraparound,newline disabled, xon/xoff disabled in both -# setup a & c. -# -# WARNING!!! There are multiple versions of ERGO 4000 microcode -# Be advised that very early versions DO NOT WORK RIGHT !! -# Microterm does have a ROM exchange program- use it or lose big -# (ergo400: added / based on the init string -- esr) -ergo4000|microterm ergo 4000:\ - :da:db:ms:\ - :co#80:li#66:\ - :AL=\E[1L:RA=\E[?7l:SA=\E[?7m:bl=^G:cd=\E[0J:ce=\E[0K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:dc=\E[1P:dl=\E[1M:\ - :do=\E[B:ei=\E[4l:im=\E[4h:\ - :is=\E<\E=\E[?1l\E[?4l\E[?5l\E[?7h\E[?8h:k1=\EOP:\ - :k2=\EOQ:k3=\EOR:k4=\EOS:kd=\E[B:ke=\E=:kl=\E[D:kr=\E[C:\ - :ks=\E=:ku=\E[A:l1=pf1:l2=pf2:l3=pf3:l4=pf4:le=^H:me=\E[m:\ - :nd=\E[C:se=\E[m:sf=\ED:so=\E[7m:sr=\EM:ta=^I:up=\E[A: - -#### NCR -# -# NCR's terminal group was merged with AT&T's when AT&T bought the company. -# For what happened to that group, see the ADDS section. -# -# There is an NCR4103 terminal that's just a re-badged Wyse-50. -# - -# The following vendor-supplied termcaps were captured from the Boundless -# Technologies site, 8 March 1998. I removed all-upper-case names that were -# identical, except for case, to lower-case ones. I also uncommented the acsc -# capabilities.X -# -# The Intecolor emulation of the NCR 2900/260C color terminal is basically a -# DEC vt200/300 with color capabilities added. -ncr260intan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard:\ - :Co#8:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:op=\E[0m:tc=ncr260vt300an: -# The Intecolor emulation of the NCR 2900/260C color terminal is basically a -# DEC vt200/300 with color capabilities added. -ncr260intwan|NCR Intecolor emulation of the 2900_260C with an ANSI keyboard:\ - :Co#8:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:op=\E[0m:tc=ncr260vt300wan: -# The Intecolor emulation of the NCR 2900/260C color terminal is basically a -# DEC vt200/300 with color capabilities added. -ncr260intpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard:\ - :Co#8:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:op=\E[0m:tc=ncr260vt300pp: -# The Intecolor emulation of the NCR 2900/260C color terminal is basicly a -# DEC vt200/300 with color capabilities added. -ncr260intwpp|NCR Intecolor emulation of the 2900_260C with a PC+ keyboard in 132 column mode:\ - :Co#8:pa#64:\ - :AB=\E[4%p1%dm:AF=\E[3%p1%dm:op=\E[0m:tc=ncr260vt300wpp: -# This definition for ViewPoint supports several attributes. This means -# that it has magic cookies (extra spaces where the attributes begin). -# Some applications do not function well with magic cookies. The System -# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. -# If supporting various attributes is not vital, 'xmc#1' and the extra -# attributes can be removed. -# Mapping to ASCII character set ('acsc' capability) can also be -# restored if needed. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncr260vppp|NCR 2900_260 viewpoint:\ - :am:bw:hs:km:mi:ms:xo:\ - :co#80:li#24:sg#1:\ - :CM=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c:K1=^A:\ - :K3=\EJ:K4=\ET:K5=\EJ:ae=\EcB0\EH\003:al=\EM:\ - :as=\EcB1\EH\002:bl=^G:bt=\EI:cd=\Ek:ce=\EK:cl=\014:\ - :cm=\EY%+ %+ :cr=\r:dc=\EW:dl=\El:do=\n:ds=\E`c:ei=\Er:\ - :fs=^M:ho=\036:im=\Eq:\ - :is=\Ee6\E~%\E+\E`\072\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7:\ - :k1=^B1\r:k2=^B2\r:k3=^B3\r:k4=^B4\r:k5=^B5\r:k6=^B6\r:\ - :k7=^B7\r:k8=^B8\r:k9=^B9\r:kD=\EW:kI=\Eq:kN=\EJ:kP=\EJ:\ - :kb=^H:kd=^J:kh=^A:kl=^U:kr=^F:ku=^Z:le=\010:ll=\001:mb=\EG2:\ - :me=\EG0\EH\003:mh=\EGp:mr=\EG4:nd=\006:nw=\037:se=\EG0:\ - :sf=\n:so=\EG4:sr=\Ej:st=\E1:ta=^I:ts=\EF:ue=\EG0:up=\032:\ - :us=\EG8:ve=\E`5:vi=\E`0:vs=\E`5: -ncr260vpwpp|NCR 2900_260 viewpoint wide mode:\ - :co#132:\ - :cm=\Ea%i%dR%dC:\ - :is=\Ee6\E~%\E+\E`;\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7:\ - :r2=\Ee6\E~%\E+\E`;\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7:\ - :tc=ncr260vppp: -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncr260vt100an|NCR 2900_260 vt100 with ansi kybd:\ - :am:hs:mi:ms:xn:xo:\ - :co#80:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOy:K3=\EOu:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:SF=\E[%dE:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:\ - :cd=\E[0J:ce=\E[0K:cl=\E[2J\E[1;1H:cm=\E[%i%d;%dH:cr=\r:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[1P:dl=\E[M:do=\E[B:\ - :ds=\E[0$~\E[1$~:ec=\E[%dX:ei=\E[4l:fs=\E[0$}:ho=\E[H:\ - :im=\E[4h:\ - :is=\E[\041p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kD=\E[3~:kI=\E[2~:\ - :kN=\E[6~:kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=\E[D:mb=\E[5m:md=\E[1m:\ - :me=\E[0m\017:mr=\E[7m:nd=\E[C:nw=\EE:rc=\E8:sc=\E7:\ - :se=\E[0m:sf=\ED:so=\E[1;7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[2$~\E[1$}:ue=\E[0m:up=\E[A:us=\E[4m:ve=\E[?25h:\ - :vi=\E[?25l: -ncr260vt100wan|NCR 2900_260 vt100 wide mode ansi kybd:\ - :co#132:\ - :cm=\E[%i%d;%dH:\ - :is=\E[\041p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :r2=\E[\041p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :tc=ncr260vt100an: -ncr260vt100pp|NCR 2900_260 vt100 with PC+ kybd:\ - :@7=\E[5~:K1=\E[H:K2=\E[V:K3=\EOu:K5=\E[U:\ - :is=\E[\041p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :kD=\E[4~:kI=\E[1~:kN=\E[6~:kP=\E[3~:kd=\E[B:ke=\E>:\ - :kh=\E[2~:kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:l1=pf1:l2=pf2:\ - :l3=pf3:l4=pf4:\ - :r2=\E[\041p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>:tc=ncr260vt100an: -ncr260vt100wpp|NCR 2900_260 vt100 wide mode pc+ kybd:\ - :co#132:\ - :cm=\E[%i%d;%dH:\ - :is=\E[\041p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :r2=\E[\041p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :tc=ncr260vt100pp: -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncr260vt200an|NCR 2900_260 vt200 with ansi kybd:\ - :am:hs:mi:ms:xn:xo:\ - :co#80:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOy:K3=\EOu:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:SF=\E[%dE:UP=\E[%dA:ae=\017:al=\E[L:as=\016:\ - :bl=^G:cd=\E[0J:ce=\E[0K:cl=\E[2J\E[1;1H:cm=\E[%i%d;%dH:\ - :cr=\r:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[1P:dl=\E[M:do=\E[B:\ - :ds=\E[0$~\E[1$~:ec=\E[%dX:ei=\E[4l:fs=\E[0$}:ho=\E[H:\ - :im=\E[4h:\ - :is=\E[\041p\E[?7;19;67h\E[?1;3;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[M:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:\ - :kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:\ - :ks=\E[?1h\E=:ku=\EOA:le=\E[D:mb=\E[5m:md=\E[1m:\ - :me=\E[0m\017:mr=\E[7m:nd=\E[C:nw=\EE:rc=\E8:sc=\E7:\ - :se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[2$~\E[1$}:ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?25h:\ - :vi=\E[?25l: -ncr260vt200wan|NCR 2900_260 vt200 wide mode ansi kybd:\ - :co#132:\ - :cm=\E[%i%d;%dH:\ - :is=\E[\041p\E[?3;7;19;67h\E[?4l\E(B\E)0\017\E[2J\E[1;1H:\ - :r2=\E[\041p\E[?3;7;19;67h\E[?4l\E(B\E)0\017\E[2J\E[1;1H:\ - :tc=ncr260vt200an: -ncr260vt200pp|NCR 2900_260 vt200 with pc+ kybd:\ - :@7=\E[1~:K1=\E[H:K2=\E[V:K3=\EOu:K5=\E[U:kD=\E[4~:\ - :kI=\E[2~:kN=\E[6~:kP=\E[5~:kd=\E[B:ke=\E>:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ks=\E=:ku=\E[A:l1=pf1:l2=pf2:l3=pf3:l4=pf4:\ - :tc=ncr260vt200an: -ncr260vt200wpp|NCR 2900_260 vt200 wide mode pc+ kybd:\ - :co#132:\ - :cm=\E[%i%d;%dH:\ - :is=\E[\041p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :r2=\E[\041p\E[?3;7;19;67h\E[?1;4l\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :tc=ncr260vt200pp: -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncr260vt300an|NCR 2900_260 vt300 with ansi kybd:\ - :am:hs:mi:ms:xn:xo:\ - :co#80:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOy:K3=\EOu:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:SF=\E[%dE:UP=\E[%dA:ae=\017:al=\E[L:as=\016:\ - :bl=^G:cd=\E[0J:ce=\E[0K:cl=\E[2J\E[1;1H:cm=\E[%i%d;%dH:\ - :cr=\r:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[1P:dl=\E[M:do=\E[B:\ - :ds=\E[0$~\E[1$~:ec=\E[%dX:ei=\E[4l:fs=\E[0$}:ho=\E[H:\ - :im=\E[4h:\ - :is=\E[\041p\E[?7;19;67h\E[?1;3;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[M:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:\ - :kP=\E[5~:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:\ - :ks=\E[?1h\E=:ku=\EOA:le=\E[D:mb=\E[5m:md=\E[1m:\ - :me=\E[0m\017:mr=\E[7m:nd=\E[C:nw=\EE:rc=\E8:sc=\E7:\ - :se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[2$~\E[1$}:ue=\E[24m:up=\E[A:us=\E[4m:ve=\E[?25h:\ - :vi=\E[?25l: -ncr260vt300wan|NCR 2900_260 vt300 wide mode ansi kybd:\ - :co#132:\ - :cm=\E[%i%d;%dH:\ - :is=\E[\041p\E[?3;7;19;67h\E[?4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H:\ - :r2=\E[\041p\E[?3;7;19;67h\E[?4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H:\ - :tc=ncr260vt300an: -ncr260vt300pp|NCR 2900_260 vt300 with pc+ kybd:\ - :@7=\E[1~:K1=\E[H:K2=\E[V:K3=\EOu:K5=\E[U:kD=\E[4~:\ - :kI=\E[2~:kN=\E[6~:kP=\E[5~:kd=\E[B:ke=\E>:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ks=\E=:ku=\E[A:l1=pf1:l2=pf2:l3=pf3:l4=pf4:\ - :tc=ncr260vt300an: -NCR260VT300WPP|ncr260vt300wpp|NCR 2900_260 vt300 wide mode pc+ kybd:\ - :co#132:\ - :cm=\E[%i%d;%dH:\ - :is=\E[\041p\E[?3;7;19;67h\E[?1;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :r2=\E[\041p\E[?3;7;19;67h\E[?1;4l\E[1;0%w\E(B\E)0\017\E[2J\E[1;1H\E>:\ - :tc=ncr260vt300pp: -# This terminfo file contains color capabilities for the Wyse325 emulation of -# the NCR 2900/260C color terminal. Because of the structure of the command -# (escape sequence) used to set color attributes, one of the fore/background -# colors must be preset to a given value. I have set the background color to -# black. The user can change this setup by altering the last section of the -# 'setf' definition. The escape sequence to set color attributes is -# ESC d y 1 -# In addition, the background color can be changed through the desk accessories. -# The capablitiy 'op' sets colors to green on black (default combination). -# -# NOTE: The NCR Unix System Administrator's Shell will not function properly -# if the 'pairs' capability is defined. Un-Comment the 'pairs' -# capability and recompile if you wish to have it included. -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncr260wy325pp|NCR 2900_260 wyse 325:\ - :am:bw:hs:km:mi:ms:xo:\ - :co#80:li#24:\ - :CM=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c:K1=^^:\ - :K2=\EJ:K4=\ET:K5=\EK:ae=\EH\003\EcB0:al=\EE:\ - :as=\EH\002\EcB1:bl=^G:bt=\EI:cd=\Ey:ce=\Et:cl=\E*:\ - :cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=\n:ds=\E`c:\ - :ei=\Er:fs=^M:ho=\036:im=\Eq:\ - :is=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\072\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\Eq:kN=\EK:kP=\EJ:\ - :kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=\010:mb=\EG2:\ - :me=\EG0\EcB0\EcD:mr=\EG4:nd=\014:nw=\037:se=\EG0:sf=\n:\ - :so=\EGt:sr=\Ej:st=\E1:ta=^I:ts=\EF:ue=\EG0:up=\013:us=\EG8:\ - :ve=\E`1:vi=\E`0:vs=\E`5: -ncr260wy325wpp|NCR 2900_260 wyse 325 wide mode:\ - :co#132:\ - :cm=\Ea%i%dR%dC:\ - :is=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :r2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :tc=ncr260wy325pp: -# This definition for Wyse 350 supports several attributes. This means -# that it has magic cookies (extra spaces where the attributes begin). -# Some applications do not function well with magic cookies. The System -# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. -# If supporting various attributes is not vital, 'xmc#1' and the extra -# attributes can be removed. -# Mapping to ASCII character set ('acsc' capability) can also be -# restored if needed. -# In addition, color capabilities have been added to this file. The drawback, -# however, is that the background color has to be black. The foreground colors -# are numbered 0 through 15. -# -# NOTE: The NCR Unix System Administrator's Shell does not function properly -# with the 'pairs' capability defined as below. If you wish to -# have it included, Un-comment it and recompile (using 'tic'). -# -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncr260wy350pp|NCR 2900_260 wyse 350:\ - :am:bw:hs:km:mi:ms:xo:\ - :co#80:li#24:sg#1:\ - :CM=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c:K1=^^:\ - :K4=\ET:K5=\EK:ae=\EH\003\EcB0:al=\EE:as=\EH\002\EcB1:\ - :bl=^G:bt=\EI:cd=\Ey:ce=\Et:cl=\E+:cm=\E=%+ %+ :cr=^M:\ - :ct=\E0:dc=\EW:dl=\ER:do=\n:ds=\E`c:ei=\Er:fs=^M:ho=\036:\ - :im=\Eq:\ - :is=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`\072\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\Eq:kN=\EK:kP=\EJ:\ - :kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=\010:mb=\EG2:\ - :me=\EG0\EH\003\EcD:mh=\EGp:mr=\EG4:nd=\014:nw=\037:\ - :se=\EG0:sf=\n:so=\EGt:sr=\Ej:st=\E1:ta=^I:ts=\EF:ue=\EG0:\ - :up=\013:us=\EG8:ve=\E`1:vi=\E`0:vs=\E`5: -ncr260wy350wpp|NCR 2900_260 wyse 350 wide mode:\ - :co#132:\ - :cm=\Ea%i%dR%dC:\ - :is=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :r2=\Ee6\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :tc=ncr260wy350pp: -# This definition for Wyse 50+ supports several attributes. This means -# that it has magic cookies (extra spaces where the attributes begin). -# Some applications do not function well with magic cookies. The System -# Administrator's Shell in NCR Unix SVR4 1.03 is one such application. -# If supporting various attributes is not vital, 'xmc#1' and the extra -# attributes can be removed. -# Mapping to ASCII character set ('acsc' capability) can also be -# restored if needed. -# (ncr260wy50+pp: originally contained commented-out -# , as well as the commented-out one there -- esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncr260wy50+pp|NCR 2900_260 wyse 50+:\ - :am:bw:hs:km:mi:ms:xo:\ - :co#80:li#24:sg#1:\ - :CM=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c:K1=^^:\ - :K4=\ET:K5=\EK:ae=\EH^C:al=\EE:as=\EH^B:bl=^G:bt=\EI:cd=\EY:\ - :ce=\ET:cl=\E+:cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:\ - :do=\n:ds=\E`c:ei=\Er:fs=^M:ho=\036:im=\Eq:\ - :is=\Ee6\E~"\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\072\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\Eq:kN=\EK:kP=\EJ:\ - :kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=\010:mb=\EG2:\ - :me=\EG0\EH\003:mh=\EGp:mr=\EG4:nd=\014:nw=\037:se=\EG0:\ - :sf=\n:so=\EGt:sr=\Ej:st=\E1:ta=\011:ts=\EF:ue=\EG0:up=\013:\ - :us=\EG8:ve=\E`1:vi=\E`0:vs=\E`5: -ncr260wy50+wpp|NCR 2900_260 wyse 50+ wide mode:\ - :co#132:\ - :cm=\Ea%i%dR%dC:\ - :is=\Ee6\E~"\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :r2=\Ee6\E~"\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :tc=ncr260wy50+pp: -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -ncr260wy60pp|NCR 2900_260 wyse 60:\ - :am:bw:hs:km:mi:ms:xo:\ - :co#80:li#24:\ - :CM=\Ew@%p1%{48}%+%c%p2%{32}%+%c%p3%{32}%+%c:K1=^^:\ - :K2=\EJ:K4=\ET:K5=\EK:ae=\EH^C:al=\EE:as=\EH^B:bl=^G:bt=\EI:\ - :cd=\Ey:ce=\Et:cl=\E*:cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:\ - :dl=\ER:do=\n:ds=\E`c:ei=\Er:fs=^M:ho=\036:im=\Eq:\ - :is=\Ee6\E~4\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`\072\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\Eq:kN=\EK:kP=\EJ:\ - :kb=^H:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=\010:mb=\EG2:\ - :me=\EG0\EcB0\EcD:mr=\EG4:nd=\014:nw=\037:se=\EG0:sf=\n:\ - :so=\EGt:sr=\Ej:st=\E1:ta=\011:ts=\EF:ue=\EG0:up=\013:\ - :us=\EG8:ve=\E`1:vi=\E`0:vs=\E`5: -ncr260wy60wpp|NCR 2900_260 wyse 60 wide mode:\ - :co#132:\ - :cm=\Ea%i%dR%dC:\ - :is=\Ee6\E~4\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :r2=\Ee6\E~4\E+\Ed/\Ee1\Ed*\Er\EO\E`1\E`;\E`@\E~\041\E"\Ee4\Ex@\E`9\Ee7:\ - :tc=ncr260wy60pp: -ncr160vppp|NCR 2900_160 viewpoint:\ - :tc=ncr260vppp: -ncr160vpwpp|NCR 2900_160 viewpoint wide mode:\ - :tc=ncr260vpwpp: -ncr160vt100an|NCR 2900_160 vt100 with ansi kybd:\ - :tc=ncr260vt100an: -ncr160vt100pp|NCR 2900_160 vt100 with PC+ kybd:\ - :tc=ncr260vt100pp: -ncr160vt100wan|NCR 2900_160 vt100 wide mode ansi kybd:\ - :tc=ncr260vt100wan: -ncr160vt100wpp|NCR 2900_160 vt100 wide mode pc+ kybd:\ - :tc=ncr260vt100wpp: -ncr160vt200an|NCR 2900_160 vt200 with ansi kybd:\ - :tc=ncr260vt200an: -ncr160vt200pp|NCR 2900_160 vt200 with pc+ kybd:\ - :tc=ncr260vt200pp: -ncr160vt200wan|NCR 2900_160 vt200 wide mode ansi kybd:\ - :tc=ncr260vt200wan: -ncr160vt200wpp|NCR 2900_160 vt200 wide mode pc+ kybd:\ - :tc=ncr260vt200wpp: -ncr160vt300an|NCR 2900_160 vt300 with ansi kybd:\ - :tc=ncr260vt300an: -ncr160vt300pp|NCR 2900_160 vt300 with pc+ kybd:\ - :tc=ncr260vt300pp: -ncr160vt300wan|NCR 2900_160 vt300 wide mode ansi kybd:\ - :tc=ncr260vt300wan: -ncr160vt300wpp|NCR 2900_160 vt300 wide mode pc+ kybd:\ - :tc=ncr260vt300wpp: -ncr160wy50+pp|NCR 2900_160 wyse 50+:\ - :tc=ncr260wy50+pp: -ncr160wy50+wpp|NCR 2900_160 wyse 50+ wide mode:\ - :tc=ncr260wy50+wpp: -ncr160wy60pp|NCR 2900_160 wyse 60:\ - :tc=ncr260wy60pp: -ncr160wy60wpp|NCR 2900_160 wyse 60 wide mode:\ - :tc=ncr260wy60wpp: -ncrvt100an|ncrvt100pp|NCR vt100 for the 2900 terminal:\ - :5i:am:hs:mi:ms:xo:\ - :Nl#32:co#80:it#8:li#24:\ - :#4=\E[D:%i=\E[C:@8=^M:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\ - :DO=\E[%dB:K1=\E[H:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:\ - :ac=``aaffgghhiijjkkllmmnnqqttuuvvwwxxyyzz~~:ae=\017:\ - :al=\E[B\E[L:as=\016:bl=^G:cb=\E[1K:cd=\E[0J:ce=\E[0K:\ - :cl=\E[2J\E[1;1H:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[1P:dl=\E[M:do=\E[B:ds=\E[31l:eA=\E(B\E)0:\ - :ei=\E[4l:fs=1:ho=\E[H:im=\E[4h:\ - :is=\E[12h\E[?10l\E%/0n\E[P\031\E[?3l\E(B\E)0:k1=\EOP:\ - :k2=\EOQ:k3=\EOR:k4=\EOS:kb=^H:kd=\E[B:kl=\E[D:kr=\E[C:\ - :ku=\E[A:le=\E[D:mb=\E[5m:md=\E[1m:me=\017\E[0m:mr=\E[7m:\ - :nd=\E[C:nw=\EE:ps=\E[i:\ - :r2=\Ec\E[12;31h\E[?3;4;5;10l\E[?6;7;19;25h\E[33;34l\E[0m\E(B\E)0\E%/0n\E[P\031:\ - :rc=\E8:\ - :..sa=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<100>:\ - :sc=\E7:se=\E[0m:sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ts=\E[>+1:ue=\E[0m:up=\E[A:us=\E[4m: -ncrvt100wan|NCRVT100WPP|ncrvt100wpp|NCR VT100 emulation of the 2900 terminal:\ - :co#132:\ - :is=\E[12h\E[?10l\E%/0n\E[P\031\E[?3h\E(B\E)0:\ - :r2=\Ec\E[12;31h\E[?4;5;10l\E?3;6;7;19;25h\E[33;34l\E[0m\E(B\E)0\E%/0n\E[P\031:\ - :tc=ncrvt100an: -# -# Vendor-supplied NCR termcaps end here - -# NCR7900 DIP switches: -# -# Switch A: -# 1-4 - Baud Rate -# 5 - Parity (Odd/Even) -# 6 - Don't Send or Do Send Spaces -# 7 - Parity Enable -# 8 - Stop Bits (One/Two) -# -# Switch B: -# 1 - Upper/Lower Shift -# 2 - Typewriter Shift -# 3 - Half Duplex / Full Duplex -# 4 - Light/Dark Background -# 5-6 - Carriage Return Without / With Line Feed -# 7 - Extended Mode -# 8 - Suppress Keyboard Display -# -# Switch C: -# 1 - End of line entry disabled/enabled -# 2 - Conversational mode / (Local?) Mode -# 3 - Control characters displayed / not displayed -# 4 - (2-wire?) / 4-wire communications -# 5 - RTS on and off for each character -# 6 - (50Hz?) / 60 Hz -# 7 - Exit after level zero diagnostics -# 8 - RS-232 interface -# -# Switch D: -# 1 - Reverse Channel (yes / no) -# 2 - Manual answer (no / yes) -# 3-4 - Cursor appearance -# 5 - Communication Rate -# 6 - Enable / Disable EXT turnoff -# 7 - Enable / Disable CR turnoff -# 8 - Enable / Disable backspace -# -# Since each attribute parameter is 0 or 1, we shift each attribute (standout, -# reverse, blink, dim, and underline) the appropriate number of bits (by -# multiplying the 0 or 1 by a correct factor to shift) so the bias character, -# '@' is (effectively) "or"ed with each attribute to generate the proper third -# character in the 0 sequence. The :sa: string implements the following -# equation: -# -# ((((('@' + P5) | (P4 << 1)) | (P3 << 3)) | (P2 << 4)) | (p1 * 17)) => -# ((((('@' + P5) + (P4 << 1)) + (P3 << 3)) + (P2 << 4)) + (p1 * 17)) -# -# Where: P1 <==> Standout attribute parameter -# P2 <==> Underline attribute parameter -# P3 <==> Reverse attribute parameter -# P4 <==> Blink attribute parameter -# P5 <==> Dim attribute parameter -# From , init string hacked by SCO. -ncr7900i|ncr7900|ncr 7900 model 1:\ - :am:bw:ul:\ - :co#80:li#24:sg#1:\ - :bl=^G:cd=\Ek:ce=\EK:cl=^L:cm=\E1%r%.%.:cr=^M:do=^J:\ - :is=\E0@\010\E3\E4\E7:kd=^J:kh=^A:kl=^U:kr=^F:ku=^Z:le=^H:\ - :ll=^A:mb=\E0B:me=\E0@:mh=\E0A:mr=\E0P:nd=^F:pf=^T:po=^R:\ - :..sa=\E0%p5%{64}%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c:\ - :se=\E0@:sf=^J:so=\E0Q:ue=\E0@:up=^Z:us=\E0`: -ncr7900iv|ncr 7900 model 4:\ - :am:bw:es:hs:\ - :co#80:li#24:\ - :al=\E^N:bl=^G:cl=^L:cm=\013%+@\E\005%02:cr=^M:dl=\E^O:\ - :do=^J:ds=\Ey1:fs=\Ek\Ey5:ho=\013@\E^E00:k1=\ES:k2=\ET:\ - :k3=\EU:k4=\EV:k5=\EW:k6=\EP:k7=\EQ:k8=\ER:kb=^H:kd=\EB:\ - :kh=\EH:kl=\ED:kr=\EC:ku=\EA:l6=blue:l7=red:l8=white:le=^H:\ - :nw=^M^J:sf=^J:ts=\Ej\Ex5\Ex1\EY8%p1%{32}%+%c\Eo: -# Warning: This terminal will lock out the keyboard when it receives a CTRL-D. -# The user can enter a CTRL-B to get out of this locked state. -# In , we want to output the character given by the formula: -# ((col / 10) * 16) + (col % 10) where "col" is "p1" -ncr7901|ncr 7901 model:\ - :am:bw:ul:\ - :co#80:li#24:\ - :bl=^G:cd=\Ek:ce=\EK:ch=\020%+^J:cl=^L:cm=\EY%+ %+ :cr=^M:\ - :cv=\013%+@:do=^J:is=\E4^O:kC=^L:kd=^J:kh=^H:kl=^U:kr=^F:\ - :ku=^Z:le=^H:ll=^A:mb=\E0B:me=^O:mh=\E0A:mr=\E0P:nd=^F:pf=^T:\ - :po=^R:\ - :..sa=\E0%p5%{64}%+%p4%{2}%*%+%p3%{16}%*%+%p2%{32}%*%+%p1%{17}%*%+%c\016:\ - :se=^O:sf=^J:so=\E0Q\016:ue=^O:up=^Z:us=\E0`\016:ve=^X:\ - :vi=^W: - -#### Perkin-Elmer (Owl) -# -# These are official terminfo entries from within Perkin-Elmer. -# - -bantam|pe550|pe6100|perkin elmer 550:\ - :bs:\ - :co#80:li#24:\ - :bl=^G:ce=\EI:cl=\EK:cm=\EX%+ \EY%+ :cr=^M:do=^J:ho=\EH:\ - :le=^H:ll=\EH\EA:nd=\EC:sf=^J:up=\EA: -fox|pe1100|perkin elmer 1100:\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cd=\EJ:ce=\EI:cl=\EH\EJ:cm=\EX%+ \EY%+ :cr=^M:\ - :ct=\E3:do=^J:ho=\EH:le=^H:ll=\EH\EA:nd=\EC:sf=^J:st=\E1:\ - :up=\EA:vb=\020\002\020\003: -owl|pe1200|perkin elmer 1200:\ - :am:bs:in:\ - :co#80:li#24:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EI:cl=\EH\EJ:cm=\EX%+ \EY%+ :\ - :cr=^M:ct=\E3:dc=\EO:dl=\EM:do=^J:ei=:ho=\EH:ic=\EN:im=:ip=:\ - :k0=\ERJ:k1=\ERA:k2=\ERB:k3=\ERC:k4=\ERD:k5=\ERE:k6=\ERF:\ - :k7=\ERG:k8=\ERH:k9=\ERI:kb=^H:le=^H:ll=\EH\EA:me=\E\041\0:\ - :nd=\EC:se=\E\041\0:sf=^J:so=\E\041^H:st=\E1:up=\EA:\ - :vb=\020\002\020\003: -pe1251|pe6300|pe6312|perkin elmer 1251:\ - :am:\ - :co#80:it#8:li#24:pb#300:sg#1:vt#8:\ - :bl=^G:cd=\EJ:ce=\EI:cl=\EK:cm=\EX%+ \EY%+ :cr=^M:ct=\E3:\ - :do=\EB:ho=\EH:k0=\ERA:k1=\ERB:k2=\ERC:k3=\ERD:k4=\ERE:\ - :k5=\ERF:k6=\ERG:k7=\ERH:k8=\ERI:k9=\ERJ:k;=\ERK:le=\ED:\ - :nd=\EC:sf=^J:st=\E1:up=\EA: -# (pe7000m: this had -# rmul=\E!\0, smul=\E!\040, -# which is probably wrong, it collides with kf0 -pe7000m|perkin elmer 7000 series monochrome monitor:\ - :am:\ - :co#80:li#24:\ - :bl=^G:bt=\E\041Y:cd=\EJ:ce=\EI:cl=\EK:cm=\ES%+ %+ :cr=^M:\ - :do=\EB:ho=\EH:i1=\E\041\0\EW 7o\Egf\ES7 :k0=\E\041\0:\ - :k1=\E\041^A:k2=\E\041^B:k3=\E\041^C:k4=\E\041^D:\ - :k5=\E\041^E:k6=\E\041^F:k7=\E\041^G:k8=\E\041^H:\ - :k9=\E\041^I:k;=\E\041^J:kb=^H:kd=\E\041U:kh=\E\041S:\ - :kl=\E\041V:kr=\E\041W:ku=\E\041T:le=\ED:ll=\ES7 :nd=\EC:\ - :sf=^J:sr=\ER:up=\EA: -pe7000c|perkin elmer 7000 series colour monitor:\ - :i1=\E\041\0\EW 7o\Egf\Eb0\Ec7\ES7 :se=\Eb0:so=\Eb2:\ - :ue=\E\041\0:us=\E\041 :\ - :tc=pe7000m: - -#### Prime -# -# Yes, Prime made terminals. These entries were posted by Kevin J. Cummings -# on 14 Dec 1992 and lightly edited by esr. -# Prime merged with ComputerVision in the late 1980s; you can reach them at: -# -# ComputerVision Services -# 500 Old Connecticut Path -# Framingham, Mass. -# - -# Standout mode is dim reverse-video. -pt100|pt200|wren|fenix|prime pt100/pt200:\ - :am:bw:mi:ms:\ - :co#80:it#8:li#24:\ - :DC=\E[%dP:DL=\E[M:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\ - :UP=\E[%dA:al=\E[L\E[t:bt=\E[Z:cd=\E[J\E[r:ce=\E[K\E[t:\ - :cl=\E?:cm=\E0%+!%+!:cr=^M:dc=\E[P:do=\ED:ei=\E[4l:ho=\E$B:\ - :im=\E[4h:kb=^H:kd=\E[B:ke=\E[>13l:kh=\E$A:kl=\E[D:kr=\E[C:\ - :ks=\E[>13h:ku=\E[A:le=^H:me=\E[m:mh=\E[2m:nd=\E[C:nw=^M^J:\ - :se=\E[m:sf=^J:so=\E[2;7m:ta=^I:te=:\ - :ti=\E[>1l\E[>2l\E[>16l\E[4l\E[>9l\E[20l\E[>3l\E[>7h\E[>12l\E[1Q:\ - :ue=\E[m:up=\EM:us=\E[4m:vb=\E$\E$P: -pt100w|pt200w|wrenw|fenixw|prime pt100/pt200 in 132-column mode:\ - :co#132:\ - :cm=\E[%i%d;%dH:tc=pt100: -pt250|Prime PT250:\ - :se@:so@:tc=pt100: -pt250w|Prime PT250 in 132-column mode:\ - :se@:so@:tc=pt100w: - -#### Sperry Univac -# -# Sperry Univac has merged with Burroughs to form Unisys. -# - -# This entry is for the Sperry UTS30 terminal running the TTY -# utility under control of CP/M Plus 1R1. The functionality -# provided is comparable to the DEC vt100. -# (uts30: I added / based on the init string -- esr) -uts30|sperry uts30 with cp/m@1R1:\ - :am:bw:hs:\ - :co#80:li#24:ws#40:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7m:SF=\E[%dB:\ - :SR=\E[%dA:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\Ed:al=\EN:as=\EF:bl=^G:cd=\E[J:ce=\E[K:cl=^L:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\EU%+ %+ :dc=\EM:dl=\EL:do=\EB:\ - :ei=:fs=^M:ho=\E[H:ic=\EO:im=:is=\E[U 7\E[24;1H:kb=^H:\ - :kd=\EOB:kh=\E[H:kl=\EOD:kr=\EOC:ku=\EOA:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mr=\E[7m:nd=\EC:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\EX:\ - :rf=/usr/share/tabset/vt100:sc=\EW:se=\E[m:sf=^J:\ - :so=\E[7m:sr=\EI:ta=^I:ts=\E]:uc=\EPB:ue=\E[m:up=\E[A:\ - :us=\E[4m:ve=\ES:vi=\ER: - -#### Tandem -# -# Tandem builds these things for use with its line of fault-tolerant -# transaction-processing computers. They aren't generally available -# on the merchant market, and so are fairly uncommon. -# - -tandem6510|adm3a repackaged by Tandem:\ - :tc=adm3a: - -# A funny series of terminal that TANDEM uses. The actual model numbers -# have a fourth digit after 653 that designates minor variants. These are -# natively block-mode and rather ugly, but they have a character mode which -# this doubtless(?) exploits. There is a 6520 that is slightly dumber. -# (tandem653: had ":sb=\ES:", probably someone's mistake for sf; also, -# removed :if=/usr/share/tabset/tandem653:, no such file -- esr) -tandem653|t653x|Tandem 653x multipage terminal:\ - :am:bs:da:db:hs:\ - :co#80:li#24:sg#1:ws#64:\ - :cd=\EJ:ce=\EK:cl=\EI:cm=\023%+ %+ :do=^J:ds=\Eo\r:fs=^M:\ - :ho=\EH:le=^H:me=\E6 :nd=\EC:se=\E6 :sf=\ES:so=\E6$:sr=\ET:\ - :ts=\Eo:ue=\E6 :up=\EA:us=\E60: - -#### Tandy/Radio Shack -# -# Tandy has a line of VDTs distinct from its microcomputers. -# - -dmterm|deskmate terminal:\ - :am:bw:\ - :co#80:li#24:\ - :al=\EP:bl=^G:cd=\EJ:ce=\EK:cl=\Ej:cm=\EY%+ %+ :cr=^M:\ - :dc=\ES:dl=\ER:do=\EB:ei=:ho=\EH:ic=\EQ:im=:k0=\E1:k1=\E2:\ - :k2=\E3:k3=\E4:k4=\E5:k5=\E6:k6=\E7:k7=\E8:k8=\E9:k9=\E0:\ - :kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:l0=f1:l1=f2:l2=f3:l3=f4:\ - :l4=f5:l5=f6:l6=f7:l7=f8:l8=f9:l9=f10:le=^H:ll=\EE:mk@:nd=\EC:\ - :sf=\EX:ta=^I:ue@:up=\EA:us@:ve=\EG6:vi=\EG5:\ - :tc=adm+sgr: -dt100|dt-100|Tandy DT-100 terminal:\ - :xo:\ - :co#80:li#24:sg#1:\ - :ac=jjkkllmmnnqqttuuvvwwxx:ae=^O:al=\E[L:as=^N:bl=^G:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\010\E[%i%d;%dH:cr=^M:\ - :cs=\E[%2;%2r:dc=\E[P:dl=\E[M:do=\E[B:ei=:ho=\E[H:ic=\E[@:\ - :im=:is=\E[?3l\E)0\E(B:k1=\E[?3i:k2=\E[2i:k3=\E[@:k4=\E[M:\ - :k5=\E[17~:k6=\E[18~:k7=\E[19~:k8=\E[20~:k9=\E[21~:\ - :k;=\E[?5i:kN=\E[29~:kP=\E[28~:kd=\E[B:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ku=\E[A:l1=f1:l2=f2:l3=f3:l4=f4:l5=f5:l6=f6:l7=f7:\ - :l8=f8:le=^H:me=\E[m:nd=\E[C:se=\E[m:sf=^J:so=\E[7m:sr=\EM:\ - :ta=^I:ue=\E[m:up=\E[A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: -dt100w|dt-100w|Tandy DT-100 terminal (wide mode):\ - :co#132:tc=dt100: -dt110|Tandy DT-110 emulating ansi:\ - :xo:\ - :co#80:li#24:\ - :@7=\E[K:ac=jjkkllmmnnqqttuuvvwwxx:ae=^O:al=\E[0L:as=^N:\ - :bl=^G:cd=\E[0J:ce=\E[0K:cl=\E[H\E[2J:cm=\010\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:dc=\E[0P:dl=\E[0M:do=\E[0B:\ - :eA=\E(B\E)0:ei=:ho=\E[H:ic=\E[0@:im=:is=\E[?3l\E)0\E(B:\ - :k1=\E[1~:k2=\E[2~:k3=\E[3~:k4=\E[4~:k5=\E[5~:k6=\E[6~:\ - :k7=\E[7~:k8=\E[8~:k9=\E[9~:k;=\E[10~:kI=\E[@:kN=\E[26~:\ - :kP=\E[25~:kd=\E[B:kh=\E[G:kl=\E[D:kr=\E[C:ku=\E[A:l0=f1:\ - :l1=f2:l2=f3:l3=f4:l4=f5:l5=f6:l6=f7:l7=f8:l8=f9:l9=f10:le=^H:\ - :me=\E[m:nd=\E[C:se=\E[m:sf=^J:so=\E[7m:sr=\EM:ta=^I:\ - :ue=\E[m:up=\E[0A:us=\E[4m:ve=\E[?25h:vi=\E[?25l: -pt210|TRS-80 PT-210 printing terminal:\ - :hc:os:\ - :co#80:\ - :bl=^G:cr=^M:do=^J:sf=^J: - -#### Tektronix (tek) -# -# Tektronix tubes are graphics terminals. Most of them use modified -# oscilloscope technology incorporating a long-persistence green phosphor, -# and support vector graphics on a main screen with an attached "dialogue -# area" for interactive text. -# - -tek|tek4012|tektronix 4012:\ - :bs:os:\ - :co#75:li#35:\ - :bl=^G:cl=\E\014:cr=^M:do=^J:ff=\014:is=\E^O:le=^H: -# (tek4013: added to suppress tic warnings re :as:/:ae: --esr) -tek4013|tektronix 4013:\ - :ac=:ae=\E^O:as=\E^N:tc=tek4012: -tek4014|tektronix 4014:\ - :co#81:li#38:\ - :is=\E\017\E9:tc=tek4012: -# (tek4015: added to suppress tic warnings re :as:/:ae: --esr) -tek4015|tektronix 4015:\ - :ac=:ae=\E^O:as=\E^N:tc=tek4014: -tek4014-sm|tektronix 4014 in small font:\ - :co#121:li#58:\ - :is=\E\017\E\072:tc=tek4014: -# (tek4015-sm: added to suppress tic warnings re :as:/:ae: --esr) -tek4015-sm|tektronix 4015 in small font:\ - :ac=:ae=\E^O:as=\E^N:tc=tek4014-sm: -# Tektronix 4023 from Andrew Klossner -# -# You need to have "stty nl2" in effect. Some versions of tset(1) know -# how to set it for you. -# -# It's got the Magic Cookie problem around stand-out mode. If you can't -# live with Magic Cookie, remove the :so: and :se: fields and do without -# reverse video. If you like reverse video stand-out mode but don't want -# it to flash, change the letter 'H' to 'P' in the :so: field. -tek4023|tektronix 4023:\ - :am:bs:\ - :co#80:dN#4:li#24:sg#1:vt#4:\ - :bl=^G:cl=4\E\014:cm=\034%r%+ %+ :cr=^M:do=^J:kb=^H:le=^H:\ - :nd=^I:nl=^J:se=^_@:so=^_P: -# It is recommended that you run the 4025 at 4800 baud or less; -# various bugs in the terminal appear at 9600. It wedges at the -# bottom of memory (try "cat /usr/dict/words"); ^S and ^Q typed -# on keyboard don't work. You have to hit BREAK twice to get -# one break at any speed - this is a documented feature. -# Can't use cursor motion because it's memory relative, and -# because it only works in the workspace, not the monitor. -# Same for home. Likewise, standout only works in the workspace. -# -# :ce: was commented out since vi and rogue seem to work better -# simulating it with lots of spaces! -# -# :al: and :AL: had 145ms of padding, but that slowed down vi's ^U -# and didn't seem necessary. -# -tek4024|tek4025|tek4027|tektronix 4024/4025/4027:\ - :am:bs:da:db:\ - :co#80:it#8:li#34:lm#0:\ - :AL=\037up\r\037ili %d\r:CC=^_:DL=\037dli %d\r\006:\ - :DO=\037dow %d\r:LE=\037lef %d\r:RI=\037rig %d\r:\ - :UP=\037up %d\r:al=\037up\r\037ili\r:bl=^G:\ - :cd=\037dli 50\r:cl=\037era\r\n\n:cr=^M:dc=\037dch\r:\ - :dl=\037dli\r\006:do=^F^J:ei=:ic=\037ich\r \010:im=:\ - :is=\041com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r:\ - :ke=\037lea p2\r\037lea p4\r\037lea p6\r\037lea p8\r\037lea f5\r:\ - :ks=\037lea p4 /h/\r\037lea p8 /k/\r\037lea p6 / /\r\037lea p2 /j/\r\037lea f5 /H/\r:\ - :le=^H:nd=\037rig\r:sf=^F^J:ta=^I:up=^K: -tek4025-17|tek 4025 17 line window:\ - :li#17:tc=tek4025: -tek4025-17-ws|tek 4025 17 line window in workspace:\ - :is=\041com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r\037wor 17\r\037mon 17\r:\ - :se=\037att s\r:so=\037att e\r:te=\037mon h\r:\ - :ti=\037wor h\r:\ - :tc=tek4025-17: -tek4025-ex|tek4027-ex|tek 4025/4027 w/!:\ - :is=\037com 33\r\n\041sto 9 17 25 33 41 49 57 65 73\r:\ - :te=\037com 33\r:ti=\041com 31\r:\ - :tc=tek4025: -# Tektronix 4025a -# From: Doug Gwyn -# The following status modes are assumed for normal operation (replace the -# initial "!" by whatever the current command character is): -# !COM 29 # NOTE: changes command character to GS (^]) -# ^]DUP -# ^]ECH R -# ^]EOL -# ^]RSS T -# ^]SNO N -# ^]STO 9 17 25 33 41 49 57 65 73 -# Other modes may be set according to communication requirements. -# If the command character is inadvertently changed, termcap can't restore it. -# Insert-character cannot be made to work on both top and bottom rows. -# Clear-to-end-of-display emulation via !DLI 988 is too grotty to use, alas. -# There also seems to be a problem with vertical motion, perhaps involving -# delete/insert-line, following a typed carriage return. This terminal sucks. -# Delays not specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -# (tek4025a: removed obsolete ":xx:". This may mean the tek4025a entry won't -# work any more. -- esr) -tek4025a|Tektronix 4025A:\ - :am:bs:bw:da:db:pt:xo:\ - :co#80:it#8:li#34:\ - :CC=^]:DC=\035dch %d;:DL=\035dli %d;:DO=\035dow %d;:\ - :LE=\035lef %d;:RI=\035rig %d;:SF=\035dow %d;:\ - :UP=\035up %d;:al=\013\035ili;:bl=^G:bt=\035bac;:\ - :ce=\035dch 80;:ch=\r\035rig %d;:cl=\035era;\n\035rup;:\ - :cr=^M:ct=\035sto;:dc=\035dch;:dl=\035dli;:do=^J:le=^H:\ - :nd=\035rig;:\ - :rs=\041com 29\035del 0\035rss t\035buf\035buf n\035cle\035dis\035dup\035ech r\035eol\035era g\035for n\035pad 203\035pad 209\035sno n\035sto 9 17 25 33 41 49 57 65 73\035wor 0;:\ - :sf=^J:ta=^I:up=^K: -# From: cbosg!teklabs!davem Wed Sep 16 21:11:41 1981 -# Here's the command file that I use to get rogue to work on the 4025. -# It should work with any program using the old curses (e.g. it better -# not try to scroll, or cursor addressing won't work. Also, you can't -# see the cursor.) -# (This "learns" the arrow keys for rogue. I have adapted it for termcap - mrh) -tek4025-cr|tek 4025 for curses and rogue:\ - :am:bs:\ - :co#80:it#8:li#33:\ - :cl=\037era;:cm=\037jum%i%d\054%d;:do=^F^J:\ - :is=\041com 31\r\n\037sto 9 17 25 33 41 49 57 65 73\r:\ - :le=^H:nd=\037rig;:sf=^F^J:ta=^I:te=\037wor 0:\ - :ti=\037wor 33h:up=^K: -# next two lines commented out since curses only allows 128 chars, sigh. -# :ti=\037lea p1/b/\037lea p2/j/\037lea p3/n/\037lea p4/h/\037lea p5/ /\037lea p6/l/\037lea p7/y/\037lea p8/k/\037lea p9/u/\037lea p./f/\037lea pt/`era w/13\037lea p0/s/\037wor 33h:\ -# :te=\037lea p1\037lea p2\037lea p3\037lea p4\037lea pt\037lea p5\037lea p6\037lea p7\037lea p8\037lea p9/la/13\037lea p.\037lea p0\037wor 0: -tek4025ex|4025ex|4027ex|tek 4025 w/!:\ - :is=\037com 33\r\n\041sto 9\05417\05425\05433\05441\05449\05457\05465\05473\r:\ - :te=\037com 33\r:ti=\041com 31\r:\ - :tc=tek4025: -tek4105|tektronix 4105:\ - :am:bs:mi:ms:ul:xn:xt:\ - :co#79:it#8:li#29:\ - :ac=:ae=\E[m:al=\E[1L:as=\E[1m:bl=^G:bt=\E[Z:cd=\E[J:\ - :ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%2;%2H:cr=^M:ct=\E[1g:\ - :dc=\E[1P:dl=\E[1M:do=\E[1B:ei=\E[4l:ho=\E[H:i1=\E%!1\E[m:\ - :im=\E[4h:is=\E%!1\E[?6141\E[m:kb=^H:kd=\E[1B:kl=\E[1D:\ - :kr=\E[1C:ku=\E[1A:mb=\E[=3;<7m:md=\E[=7;<4m:\ - :me=\E[=0;<1m:mh=\E[=1;<6m:mk=\E[=6;<5:mr=\E[=1;<3m:\ - :nd=\E[1C:se=\E[=0;<1m:sf=\E[S:so=\E[=2;<3m:sr=\E[T:ta=^I:\ - :te=:ti=\E%!1\E[?6l\E[2J:ue=\E[=0;<1m:up=\E[1A:\ - :us=\E[=5;<2m: - -# (tek4105-30: I added / based on the init string -- esr) -tek4105-30|4015 emulating 30 line vt100:\ - :am:mi:ms:xn:xo:\ - :co#80:it#8:li#30:vt#3:\ - :@8=\EOM:DO=\E[%dB:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:as=^N:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:do=^J:\ - :eA=\E(B\E)0:ho=\E[H:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:\ - :k4=\EOS:k5=\EOt:k6=\EOu:k7=\EOv:k8=\EOl:k9=\EOw:k;=\EOx:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[m\017:mr=\E[7m:\ - :nd=\E[C:r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :..sa=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[1;7m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[m:up=\E[A:us=\E[4m: - -# Tektronix 4105 from BRL -# The following setup modes are assumed for normal operation: -# CODE ansi CRLF no DABUFFER 141 -# DAENABLE yes DALINES 30 DAMODE replace -# DAVISIBILITY yes ECHO no EDITMARGINS 1 30 -# FLAGGING input INSERTREPLACE replace LFCR no -# ORIGINMODE relative PROMPTMODE no SELECTCHARSET G0 B -# SELECTCHARSET G1 0 TABS -2 -# Other setup modes may be set for operator convenience or communication -# requirements; I recommend -# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes -# BYPASSCANCEL CURSORKEYMODE no DAINDEX 1 0 0 -# EOFSTRING '' EOLSTRING EOMCHARS -# GAMODE overstrike GCURSOR 0 100 0 GSPEED 10 1 -# IGNOREDEL no KEYEXCHAR
NVDEFINE -53 "" -# PROMPTSTRING '' QUEUESIZE 2460 WINDOW 0 0 4095 3132 -# XMTDELAY 0 -# and factory color maps. After setting these modes, save them with NVSAVE. No -# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -# "IC" cannot be used in combination with "im" & "ei". -# "tek4105a" is just a guess: -tek4105a|Tektronix 4105:\ - :bs:ms:pt:xo:\ - :co#80:it#8:kn#8:li#30:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:\ - :RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ac=:ae=^O:al=\E[L:\ - :as=^N:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\ - :dl=\E[M:do=^J:ec=\E[%dX:ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\E%!1:k0=\EOA:k1=\EOB:k2=\EOC:k3=\EOD:k4=\EOP:k5=\EOQ:\ - :k6=\EOR:k7=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l0=F1:l1=F2:l2=F3:l3=F4:l4=F5:\ - :l5=F6:l6=F8:le=^H:ll=\E[30;H:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:nw=\EE:rc=\E8:\ - :rs=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40\ELI100\ELLA>\ELM0\EKE0\ENF1\EKS0\END0\E%!1\Ec\E[?3;5l\E[?7;8h\E[r\E[m\E>:\ - :sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :te=\E%!0\ELBH=\E%!1:ti=\E[?6l:ue=\E[m:up=\EM:us=\E[4m:\ - :ve=\E%!0\ETD10\E%!1:vi=\E%!0\ETD00\E%!1:\ - :vs=\E%!0\ETD70\E%!1: - -# -# Tektronix 4106/4107/4109 from BRL -# The following setup modes are assumed for normal operation: -# CODE ansi COLUMNMODE 80 CRLF no -# DABUFFER 141 DAENABLE yes DALINES 32 -# DAMODE replace DAVISIBILITY yes ECHO no -# EDITMARGINS 1 32 FLAGGING input INSERTREPLACE replace -# LFCR no LOCKKEYBOARD no ORIGINMODE relative -# PROMPTMODE no SELECTCHARSET G0 B SELECTCHARSET G1 0 -# TABS -2 -# Other setup modes may be set for operator convenience or communication -# requirements; I recommend -# ACURSOR 1 0 AUTOREPEAT yes AUTOWRAP yes -# BYPASSCANCEL CURSORKEYMODE no DAINDEX 1 0 0 -# EOFSTRING '' EOLSTRING EOMCHARS -# GAMODE overstrike GCURSOR 0 100 0 GSPEED 9 3 -# IGNOREDEL no KEYEXCHAR
NVDEFINE -53 "" -# PROMPTSTRING '' QUEUESIZE 2620 WINDOW 0 0 4095 3132 -# XMTDELAY 0 -# and factory color maps. After setting these modes, save them with NVSAVE. No -# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -# "IC" cannot be used in combination with "im" & "ei". -tek4106brl|tek4107brl|tek4109brl|Tektronix 4106 4107 or 4109:\ - :ms:xo:\ - :co#80:it#8:li#32:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:\ - :RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ac=:ae=^O:al=\E[L:\ - :as=^N:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[P:\ - :dl=\E[M:do=^J:ec=\E[%dX:ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\E%!1:k0=\EOA:k1=\EOB:k2=\EOC:k3=\EOD:k4=\EOP:k5=\EOQ:\ - :k6=\EOR:k7=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l0=F1:l1=F2:l2=F3:l3=F4:l4=F5:\ - :l5=F6:l6=F8:le=^H:ll=\E[32;H:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:nw=\EE:\ - :r1=\030\E%!0\EKC\E\014\EKR0\EKF0\ENM0\ELBH=\ETF8000010F40\ELI100\ELLB0\ELM0\EKE0\ENF1\EKS0\END0\ERE0\E%!1\Ec\E[?3;5l\E[?7;8h\E[r\E[m\E>:\ - :rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7;42m:sr=\EM:st=\EH:\ - :ta=^I:te=\E%!0\ELBH=\E%!1:ti=\E[?6l:ue=\E[m:up=\EM:\ - :us=\E[4m:ve=\E%!0\ETD10\E%!1:vi=\E%!0\ETD00\E%!1:\ - :vs=\E%!0\ETD70\E%!1: - -tek4107|tek4109|tektronix terminals 4107 4109:\ - :am:bs:mi:ms:ul:xn:xt:\ - :co#79:it#8:li#29:\ - :bl=^G:cd=\EJ:ce=\EK:cl=\ELZ:cm=\EY%+ %+ :cr=^M:do=^J:kb=^H:\ - :kd=\EB:kl=\ED:kr=\EC:ku=\EA:le=^H:mb=\E%!1\E[5m\E%!0:\ - :md=\E%!1\E[1m\E%!0:me=\E%!1\E[m\E%!0:\ - :mh=\E%!1\E[<0m\E%!0:mr=\E%!1\E[7m\E%0:nd=\EC:\ - :..sa=\E%%\0411\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m\E%%\0410:\ - :se=\E%!1\E[m\E%!0:sf=^J:so=\E%!1\E[7;5m\E%!0:sr=\EI:\ - :ta=^I:ue=\E%!1\E[m\E%!0:up=\EA:us=\E%!1\E[4m\E%!0:\ - :ve=\E%!0:vs=\E%!3: -# Tektronix 4207 with sysline. In the ancestral termcap file this was 4107-s; -# see the note attached to tek4207. -tek4207-s|Tektronix 4207 with sysline but no memory:\ - :es:hs:\ - :ds=\E7\E[?6l\E[2K\E[?6h\E8:fs=\E[?6h\E8:\ - :i1=\E%!1\E[2;32r\E[132D\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J:\ - :is=\E7\E[?6l\E[2K\E[?6h\E8:\ - :ts=\E7\E[?6l\E[2K\E[;%i%df:tc=tek4107: - -# The 4110 series may be a wonderful graphics series, but they make the 4025 -# look good for screen editing. In the dialog area, you can't move the cursor -# off the bottom line. Out of the dialog area, ^K moves it up, but there -# is no way to scroll. -# -# Note that there is a floppy for free from Tek that makes the -# 4112 emulate the vt52 (use the vt52 termcap). There is also -# an expected enhancement that will use ANSI standard sequences. -# -# 4112 in non-dialog area pretending to scroll. It really wraps -# but vi is said to work (more or less) in this mode. -# -# 'vi' works reasonably well with this entry. -# -otek4112|o4112-nd|otek4113|otek4114|old tektronix 4110 series:\ - :am:\ - :co#80:li#34:\ - :bl=^G:cl=\E^L:cr=^M:do=^J:le=^H:sf=^J:te=\EKA1\ELV1:\ - :ti=\EKA0\ELV0\EMG0:up=^K: -# The 4112 with the ANSI compatibility enhancement -tek4112|tek4114|tektronix 4110 series:\ - :am:bs:db:\ - :co#80:li#34:\ - :al=\E[L:bt=\E[Z:cd=\E[0J:ce=\E[0K:cl=\E[2J\E[0;0H:\ - :cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:ei=:ic=\E[@:im=:\ - :is=\E3\0411:le=^H:me=\E[m:nd=\E[C:se=\E[m:\ - :sf=\E7\E[0;0H\E[M\E8:so=\E[7m:sr=\E7\E[0;0H\E[L\E8:\ - :ue=\E[m:up=\EM:us=\E[4m: -tek4112-nd|4112 not in dialog area:\ - :ns:\ - :up=^K:tc=tek4112: -tek4112-5|4112 in 5 line dialog area:\ - :li#5:tc=tek4112: -# (tek4113: this used to have ":nd=\LM1\s\LM0:", someone's mistake; -# removed ":as=\E^N:, :ae=\E^O:", which had been commented out in 8.3. -# Note, the !0 and !1 sequences in :te:/:ti:/:ve:/:vi: were -# previously \0410 and \0411 sequences...I don't *think* they were supposed -# to be 4-digit octal -- esr) -tek4113|tektronix 4113 color graphics with 5 line dialog area:\ - :am:bs:da:eo:\ - :co#80:li#5:\ - :cl=\ELZ:do=^J:is=\EKA1\ELL5\ELV0\ELV1:le=^H:\ - :nd=\ELM1 \ELM0:uc=\010\ELM1_\ELM0:\ - :vb=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0: -tek4113-34|tektronix 4113 color graphics with 34 line dialog area:\ - :li#34:\ - :is=\EKA1\ELLB2\ELV0\ELV1:tc=tek4113: -# :ns: left off to allow vi visual mode. APL font (:as=\E^N:/:ae=\E^O:) not -# supported here. :uc: is slow, but looks nice. Suggest setenv MORE -up . -# :vb: needs enough delay to let you see the background color being toggled. -tek4113-nd|tektronix 4113 color graphics with no dialog area:\ - :am:bs:eo:\ - :co#80:it#8:li#34:\ - :cl=\E^L:do=^J:ho=\ELF7l\177 @:is=\ELZ\EKA0\ELF7l\177 @:\ - :le=^H:ll=\ELF hl @:nd=^I:se=\EMT1:so=\EMT2:ta=^I:\ - :uc=\010\EMG1_\EMG0:up=^K:\ - :vb=\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERBA4\ERB0:\ - :vs=\ELZ\EKA0: -# This entry is from Tek. Inc. (Brian Biehl) -# (tek4115: :bc: renamed to :le:, / added based on init string -- esr) -otek4115|Tektronix 4115:\ - :am:bs:da:db:eo:\ - :co#80:it#8:li#34:\ - :RA=\E[?7l:SA=\E[?7h:al=\E[L:bt=\E[Z:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:do=\E[B:\ - :ei=\E[4l:ho=\E[H:if=/usr/share/tabset/vt100:im=\E[4h:\ - :is=\E%!0\E%\014\ELV0\EKA1\ELBB2\ENU@=\ELLB2\ELM0\ELV1\EKYA?\E%!1\E[<1l\E[?7h\E[?8h\E[34;1H\E[34B\E[m:\ - :kb=^H:ke=\E>:ks=\E=:le=\E[D:me=\E[m:nd=\E[C:se=\E[m:\ - :so=\E[7m:sr=\EM:ta=^I:te=\E%!0\ELBG8\E%!1\E[34;1H\E[J:\ - :ti=\E%!0\ELBB2\E%!1:ue=\E[m:up=\E[A:us=\E[4m:\ - :ve=\E%!0\ELBG8\E%!1\E[34;1H:vs=\E%!0\ELBB2\E%!1: -tek4115|newer tektronix 4115 entry with more ANSI capabilities:\ - :am:xo:\ - :co#80:li#34:\ - :AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:\ - :RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:al=\E[L:bl=^G:\ - :bt=\E[Z:cd=\E[J:ce=\E[K:ch=\E[%+^AG:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:cr=^M:ct=\E[2g:cv=\E[%+^Ad:dc=\E[P:\ - :dl=\E[M:do=^J:ei=:ho=\E[H:ic=\E[@:im=:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mk=\E[8m:mr=\E[7m:nd=\E[C:..rp=%p1%c\E[%p2%{1}%-%db:\ - :..sa=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m:\ - :se=\E[m:sf=^J:so=\E[7m:st=\EH:ta=^I:ue=\E[m:up=\E[A:\ - :us=\E[4m: -# The tek4125 emulates a vt100 incorrectly - the scrolling region -# command is ignored. The following entry replaces :cs: with the needed -# :AL:, :AL:, and :im:; removes some cursor pad commands that the tek4125 -# chokes on; and adds a lot of initialization for the tek dialog area. -# Note that this entry uses all 34 lines and sets the cursor color to green. -# Steve Jacobson 8/85 -# (tek4125: there were two "\!"s in the is that I replaced with "\E!"; -# commented out, :im:=\E1 because there's no :ei: -- esr) -tek4125|tektronix 4125:\ - :li#34:\ - :al=\E[1L:cs@:dl=\E[1M:\ - :is=\E%\E\0410\EQD1\EUX03\EKA\ELBB2\ELCE0\ELI100\ELJ2\ELLB2\ELM0\ELS1\ELX00\ELV1\E%\E\0411\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ - :ks=\E=:rc@:sc@:\ - :tc=vt100: - -# From: -# (tek4207: This was the termcap file's entry for the 4107/4207, but SCO -# supplied another, less capable 4107 entry. So we'll use that for 4107 and -# note that if jcoker wasn't confused you may be able to use this one. -# I merged in :ms:,:sf:,:sr:,,:ct: from a BRL entry -- esr) -tek4207|Tektronix 4207 graphics terminal with memory:\ - :am:bw:mi:ms:ul:xn:\ - :co#80:it#8:li#32:\ - :al=3\E[L:bt=\E[Z:cd=\E[J:ce=5\E[K:cl=156\E[H\E[J:\ - :cm=\E[%i%d;%dH:ct=\E[1g:dc=4\E[P:dl=3\E[M:do=^J:ei=:\ - :ho=\E[H:ic=4\E[@:im=:\ - :is=\E%!0\ELBP0\E%!1\E[H\E[2g\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[8C\EH\E[J:\ - :kd=\ED:kh=\E[H:kl=\E[D:kr=\E[C:ku=\EM:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mk=\E[=6;<5:mr=\E[7m:nd=\E[C:se=\E[m:\ - :sf=\E[S:so=\E[7m:sr=\E[T:ta=^I:\ - :te=\E[?6h\E%!0\ELBP0\E%!1\E[32;1f:ti=\E[?6l\E[H\E[J:\ - :ue=\E[m:up=\EM:us=\E[4m: - -# From: Thu Oct 31 12:54:27 1985 -# (tek4404: There was a "\!" in :ti: that I replaced with "\E!". -# Tab had been given as \E2I,that must be the tab-set capability -- esr) -tek4404|tektronix 4404:\ - :bs:\ - :co#80:it#8:li#32:\ - :al=\E[1L:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:\ - :cs=\E[%i%d;%dr:dc=\E[P:dl=\E[1M:do=^J:ei=\E[4l:ho=\E[H:\ - :im=\E[4h:kd=\E[B:ke=\E[?1h:kl=\E[D:kr=\E[C:ks=\E[?1l:\ - :ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:nd=\E[C:rc=\E8:\ - :sc=\E7:se=\E[27m:so=\E[7m:st=\E[2I:ta=^I:\ - :te=\E[1;1H\E[0J\E[?6h\E[?1l:\ - :ti=\E%\E\0411\E[1;32r\E[?6l\E>:ue=\E[m:up=\E[A:\ - :us=\E[4m: -# Some unknown person wrote: -# I added the is string - straight Unix has ESC ; in the login -# string which sets a ct8500 into monitor mode (aka 4025 snoopy -# mode). The is string here cleans up a few things (but not -# everything). -ct8500|tektronix ct8500:\ - :am:bw:da:db:\ - :co#80:li#25:\ - :al=\E^L:bl=^G:bt=\E^I:cd=\E^U:ce=\E^T:cl=\E^E:\ - :cm=\E|%+ %+ :cr=^M:dc=\E^]:dl=\E^M:do=^J:ei=:ic=\E^\:im=:\ - :is=\037\EZ\Ek:le=^H:me=\E :nd=\ES:se=\E :sf=^J:so=\E$:\ - :sr=\E^A:ta=^I:ue=\E :up=\ER:us=\E\041: - -# Tektronix 4205 terminal. -# -# am is not defined because the wrap around occurs not when the char. -# is placed in the 80'th column, but when we are attempting to type -# the 81'st character on the line. (esr: hmm, this is like the vt100 -# version of xenl, perhaps am + xenl would work!) -# -# Bold, dim, and standout are simulated by colors and thus not allowed -# with colors. The tektronix color table is mapped into the RGB color -# table by setf/setb. All colors are reset to factory specifications by oc. -# The cap uses RGB notation to define colors. for arguments 1-3 the -# interval (0-1000) is broken into 8 smaller sub-intervals (125). Each sub- -# interval then maps into pre-defined value. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -tek4205|tektronix 4205:\ - :cc:mi:ms:\ - :Co#8:NC#49:co#80:it#8:li#30:pa#63:\ - :AL=\E[%dL:DO=\E[%dB:IC=\E[%d@:LE=\E[%dD:RI=\E[%dC:\ - :UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[1L:as=^N:bl=^G:bt=\E[Z:cb=\E[1K:cd=\E[J:\ - :ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:cr=^M:ct=\E[1g:\ - :dc=\E[1P:dl=\E[1M:do=\E[B:eA=\E)0:ec=\E%dX:ei=\E[4l:\ - :ho=\E[H:i1=\E%!0\ETM1\E%!1\E[m:im=\E[4h:k0=\EOA:k1=\EOB:\ - :k2=\EOC:k3=\EOD:k4=\EP:k5=\EQ:k6=\ER:k7=\ES:kb=^H:kd=\E[B:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=\E[D:mb=\E[5m:md=\E[=7;<4m:\ - :me=\E[=0;<1m\E[24;25;27m\017:mh=\E[=1;<6m:mk=\E[=6;<5:\ - :mr=\E[7m:nd=\E[C:\ - :oc=\E%!0\ETFB000001F4F4F42F40030F404A4C because of a bug in old vi (if stty says you have -# a "newline" style terminal (-crmode) vi figures all it needs is nl -# to get crlf, even if :cr: is not ^M.) -# (tty40: removed obsolete ":nl=\EG\EB:", it's just do+cr -- esr) -tty40|ds40|ds40-2|dataspeed40|teletype dataspeed 40/2:\ - :bs:xo:\ - :co#80:li#24:\ - :al=\EL:cd=\EJ:cl=\EH\EJ:cr=\EG:ct=\EH\E2:dc=\EP:dl=\EM:\ - :do=\EB:ei=:ho=\EH:ic=\E\136:im=:kb=^]:kl=^H:le=^H:nd=\EC:\ - :pf=^T:po=\022:r2=\023\ER:se=\E4:sf=\ES:so=\E3:sr=\ET:\ - :st=\E1:ta=\E@:up=\E7: -tty43|model 43 teletype:\ - :am:bs:hc:os:xo:\ - :co#132:\ - :bl=^G:cr=^M:do=^J:kb=^H:le=^H:sf=^J: - -#### Tymshare -# - -# You can add :is=\E<: to put this 40-column mode, though I can't -# for the life of me think why anyone would want to. -scanset|sc410|sc415|Tymshare Scan Set:\ - :am:bw:ms:\ - :co#80:li#24:\ - :ac=j%k4l:\ - :rc=^C:sc=^B:sf=^J:up=^K: - -#### Volker-Craig (vc) -# -# If you saw a Byte Magazine cover with a terminal on it during the early -# 1980s, it was probably one of these. Carl Helmers liked them because -# they could crank 19.2 and were cheap (that is, he liked them until he tried -# to program one...) -# - -# Missing in vc303a and vc303 descriptions: they scroll 2 lines at a time -# every other linefeed. -vc303|vc103|vc203|volker-craig 303:\ - :am:bs:ns:\ - :co#80:li#24:\ - :bl=^G:cl=\014:cr=^M:do=^J:ho=\013:kd=^J:kl=^H:kr=^I:ku=^N:\ - :le=^H:ll=\017W:nd=^I:up=^N: -vc303a|vc403a|volker-craig 303a:\ - :ce=\026:cl=\030:ho=\031:kr=^U:ku=^Z:ll=^P:nd=^U:up=^Z:tc=vc303: -# (vc404: removed obsolete ":ma=^Z^P^U :" -- esr) -vc404|volker-craig 404:\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cd=\027:ce=\026:cl=\030:cm=\020%+ %+ :cr=^M:do=^J:\ - :ho=\031:kd=^J:kl=^H:kr=^U:ku=^Z:le=^H:nd=^U:sf=^J:up=^Z: -vc404-s|volker-craig 404 w/standout mode:\ - :do=^J:se=^O:so=^N:tc=vc404: -# From: -# (vc414: merged in cup/dl1/home from an old vc414h-noxon) -vc414|vc414h|Volker-Craig 414H in sane escape mode.:\ - :am:bs:\ - :co#80:li#24:\ - :al=\E\032:cd=\E^X:ce=10\E\017:cl=\E\034:cm=\E\021%r%.%.:\ - :dc=\E3:dl=\E\023:do=\E^K:ei=:ho=\E^R:ic=\E\072:im=:k0=\EA:\ - :k1=\EB:k2=\EC:k3=\ED:k4=\EE:k5=\EF:k6=\EG:k7=\EH:kd=\E^K:\ - :kh=\E^R:kl=^H:kr=^P:ku=\E^L:l0=PF1:l1=PF2:l2=PF3:l3=PF4:\ - :l4=PF5:l5=PF6:l6=PF7:l7=PF8:nd=^P:se=\E^_:so=\E^Y:up=\E^L: -vc415|volker-craig 415:\ - :cl=^L:tc=vc404: - -######## OBSOLETE PERSONAL-MICRO CONSOLES AND EMULATIONS -# - -#### IBM PC and clones -# - -# The pcplot IBM-PC terminal emulation program is really messed up. It is -# supposed to emulate a vt-100, but emulates the wraparound bug incorrectly, -# doesn't support scrolling regions, ignores add line commands, and ignores -# delete line commands. Consequently, the resulting behavior looks like a -# crude adm3a-type terminal. -# Steve Jacobson 8/85 -pcplot|pc-plot terminal emulation program:\ - :xn@:\ - :AL@:DL@:al@:cs@:dl@:rc@:sc@:tc=vt100: -# KayPro II from Richard G Turner -# I've found that my KayPro II, running MDM730, continues to emulate an -# ADM-3A terminal, just like I was running TERM.COM. On our 4.2 UNIX -# system the following termcap entry works well: -# I have noticed a couple of minor glitches, but nothing I can't work -# around. (I added two capabilities from the BRL entry -- esr) -kaypro|kaypro2|kaypro II:\ - :am:bs:\ - :co#80:li#24:\ - :al=\EE:bl=^G:cd=^W:ce=^X:cl=1\032:cm=\E=%+ %+ :cr=^M:\ - :dl=\ER:do=^J:ho=^^:kd=^J:kr=^L:ku=^K:nd=^L:sf=^J:up=^K: - -# From IBM, Thu May 5 19:35:27 1983 -# (ibmpc: commented out :im:=\200R because we don't know :ei: -- esr) -ibm-pc|ibm5051|5051|IBM Personal Computer (no ANSI.SYS):\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cl=^L^K:cr=^M^^:do=^J:ho=^K:kd=^_:le=^]:nd=^\:sf=\n:\ - :up=^^: - -ibmpc|wy60-PC|wyse60-PC|IBM PC/XT running PC/IX:\ - :am:bw:eo:hs:km:ms:ul:\ - :co#80:it#8:li#24:\ - :@7=\E[Y:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:SF=\E[%dS\E[%dB:\ - :SR=\E[%dT\E[%dA:UP=\E[%dA:\ - :ac=j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263:\ - :bl=^G:cd=\E[J:ce=\E[K:ch=\E[%i%dG:cl=\Ec:cm=\E[%i%d;%dH:\ - :cr=^M:do=\E[B:ec=\E[%dX:ho=\E[H:k1=\240:k2=\241:k3=\242:\ - :k4=\243:k5=\244:k6=\245:k7=\246:k8=\247:k9=\250:k;=\251:\ - :kB=^]:kD=\177:kI=\E[^H:kN=\E[U:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=\E[D:ll=\E[24;1H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mk=\E[30;40m:mr=\E[7m:nd=\E[C:nw=^M:\ - :..sa=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m:\ - :se=\E[m:sf=\E[S\E[B:so=\E[7m:sr=\E[T\E[A:ue=\E[m:up=\E[A:\ - :us=\E[4m: - -#### Apple II -# -# Apple II firmware console first, then various 80-column cards and -# terminal emulators. For two cents I'd toss all these in the UFO file -# along with the 40-column apple entries. -# - -# From: brsmith@umn-cs.cs.umn.edu (Brian R. Smith) via BRL -# 'it#8' tells UNIX that you have tabs every 8 columns. This is a -# function of TIC, not the firmware. -# The clear key on a IIgs will do something like clear-screen, -# depending on what you're in. -appleIIgs|appleIIe|appleIIc|Apple 80 column firmware interface:\ - :am:bs:bw:eo:ms:\ - :co#80:it#8:li#24:\ - :bl=^G:cd=^K:ce=^]:cl=^L:cm=\036%r%+ %+ :cr=^M:do=^J:ho=^Y:\ - :kC=^X:kD=\177:kb=^H:kd=^J:kl=^H:kr=^U:ku=^K:le=^H:nd=^\:\ - :nw=^M^W:se=^N:sf=^W:so=^O:sr=^V:ta=^I:up=^_: -# Apple //e with 80-column card, entry from BRL -# The modem interface is permitted to discard LF (maybe DC1), otherwise -# passing characters to the 80-column firmware via COUT (PR#3 assumed). -# Auto-wrap does not work right due to newline scrolling delay, which also -# requires that you set "stty cr2". -# Note: Cursor addressing is only available via the Pascal V1.1 entry, -# not via the BASIC PR#3 hook. All this nonsense can be avoided only by -# using a terminal emulation program instead of the built-in firmware. -apple2e|Apple //e:\ - :bw:ms:\ - :co#80:li#24:\ - :bl=^G:cd=4*\013:ce=4\035:cl=100\014:do=^J:ho=^Y:is=^R^N:\ - :kb=^H:kd=^J:kl=^H:kr=^U:ku=^K:le=^H:me=^N:mr=^O:nw=100\r:\ - :r1=^R^N:se=^N:sf=^W:so=^O:sr=^V:ta=^I:up=^_: -# mcvax!vu44!vu45!wilcke uses the "ap" entry together with Ascii Express Pro -# 4.20, with incoming and outgoing terminals both on 0, emulation On. -apple2e-p|Apple //e via Pascal:\ - :cm=\036%r%+ %+ :kb=^H:kd=^J:kl=^H:tc=apple2e: -# (ASCII Express) MouseTalk "Standard Apple //" emulation from BRL -# Enable DC3/DC1 flow control with "stty ixon -ixany". -apple-ae|ASCII Express:\ - :am:bs:bw:ms:nx:xo:\ - :co#80:it#8:li#24:\ - :bl=500\007:cd=^K:ce=^]:cl=^L:cm=\036%r%+ %+ :cr=^M:do=^J:\ - :ho=^Y:is=^R^N:kC=^X:kd=^J:kl=^H:kr=^U:ku=^K:le=^H:me=^N:\ - :mr=^O:nd=^U:r1=^R^N:se=^N:sf=^W:so=^O:sr=^V:up=^_: -appleII|apple ii plus:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :cd=^K:ce=^]:cl=^L:cm=\036%r%+ %+ :do=^J:ho=\E^Y:\ - :is=\024T1\016:kd=^J:kr=^U:le=^H:me=^N:nd=^\:se=^N:so=^O:\ - :ta=^I:up=^_:vb=\024G1\024T1:ve=^TC2:vs=^TC6: -# Originally by Gary Ford 21NOV83 -# From: Fri Oct 11 21:27:00 1985 -apple-80|apple II with smarterm 80 col:\ - :am:bs:bw:\ - :co#80:li#24:\ - :bt=^R:cd=10*\013:ce=10\035:cl=10*\014:cm=\036%r%+ %+ :\ - :cr=10*\r:do=^J:ho=^Y:le=^H:nd=^\:up=^_: -apple-soroc|apple emulating soroc 120:\ - :am:\ - :co#80:li#24:\ - :bl=^G:cd=\EY:ce=\ET:cl=\E*:cm=\E=%+ %+ :cr=^M:do=^J:ho=^^:\ - :kd=^J:kl=^H:kr=^L:ku=^K:le=^H:nd=^L:sf=^J:up=^K: -# From Peter Harrison, Computer Graphics Lab, San Francisco -# ucbvax!ucsfmis!harrison .....uucp -# ucbvax!ucsfmis!harrison@BERKELEY .......ARPA -# "These two work. If you don't have the inverse video chip for the -# Apple with videx then remove the :so: and :se: fields." -# (apple-videx: this used to be called DaleApple -- esr) -apple-videx|Apple with videx videoterm 80 column board with inverse video:\ - :am:bs:xn:\ - :co#80:it#8:li#24:\ - :cd=^K:ce=^]:cl=300\014:cm=\036%r%+ %+ :do=^J:ho=^Y:kd=^J:\ - :kh=^Y:kl=^H:kr=^U:le=^H:me=^Z2:nd=^\:se=^Z2:so=^Z3:ta=^I:\ - :up=^_: -# My system [for reference] : Apple ][+, 64K, Ultraterm display card, -# Apple Cat ][ 212 modem, + more all -# controlled by ASCII Express: Pro. -# From Dave Shaver -apple-uterm-vb|Videx Ultraterm for Apple micros with Visible Bell:\ - :am:bs:eo:xt:\ - :co#80:li#24:\ - :ac=:cd=^K:ce=^]:cl=^L:cm=\036%r%+ %+ :ho=^Y:\ - :is=^V4^W06\017\rVisible Bell Installed.\016\r\n:\ - :nd=^\:se=^N:so=^O:up=^_:vb=^W35^W06: -apple-uterm|Ultraterm for Apple micros:\ - :am:bs:eo:xt:\ - :co#80:li#24:\ - :ac=:cd=^K:ce=^]:cl=^L:cm=\036%r%+ %+ :ho=^Y:\ - :is=^V4^W06\016:nd=^\:se=^N:so=^O:up=^_: -# from trwrba!bwong (Bradley W. Wong): -# -# This entry assumes that you are using an apple with the UCSD Pascal -# language card. SYSTEM.MISCINFO is assumed to be the same as that -# supplied with the standard apple except that screenwidth should be set -# using SETUP to 80 columns. Note that the right arrow in not mapped in -# this termcap entry. This is because that key, on the Apple, transmits -# a ^U and would thus preempt the more useful "up" function of vi. -# -# HMH 2/23/81 -apple80p|80-column apple with Pascal card:\ - :am:bw:\ - :co#80:li#24:\ - :cd=^K:ce=^]:cl=^Y^L:cm=\036%r%+ %+ :ho=^Y:kl=^H:nd=^\\072:\ - :up=^_: -# -# Apple II+ equipped with Videx 80 column card -# -# Terminfo from ihnp4!ihu1g!djc1 (Dave Christensen) via BRL; -# manually converted by D A Gwyn -# -# DO NOT use any terminal emulation with this data base, it works directly -# with the Videx card. This has been tested with vi 1200 baud and works fine. -# -# This works great for vi, except I've noticed in pre-R2, ^U will scroll back -# 1 screen, while in R2 ^U doesn't. -# For inverse alternate character set add: -# :as:=^O::ae:=^N: -# (apple-v: added it#8 -- esr) -apple-videx2|Apple II+ w/ Videx card (similar to Datamedia h1520):\ - :am:xn:\ - :co#80:it#8:li#24:\ - :bl=100\007:cd=16*\013:ce=^]:cl=16*\014:cm=\036%r%+ %+ :\ - :cr=^M:do=^J:ho=^Y:kb=^H:kd=^J:kh=^Y:kl=^H:kr=^\:ku=^_:le=^H:\ - :nd=^\:se=^Z2:sf=^J:so=^Z3:ta=8\011:up=^_: -apple-videx3|vapple|Apple II with 80 col card:\ - :am:bs:\ - :co#80:li#24:\ - :ce=\Ex:cl=\Ev:cm=\EY%+ %+ :ho=\EH:k0=\EP:k1=\EQ:k2=\ER:\ - :k3=\E :k4=\E\041:k5=\E":k6=\E#:k7=\E$:k8=\E%:k9=\E&:kd=\EB:\ - :kh=\EH:kl=\ED:kr=\EC:ku=\EA:nd=\EC:up=\EA: -#From: decvax!cbosgd!cbdkc1!mww Mike Warren via BRL -aepro|Apple II+ running ASCII Express Pro--vt52:\ - :bs:\ - :co#80:li#24:\ - :cd=\EJ:ce=\EK:cl=300\014:cm=\EY%+ %+ :ho=\EH:nd=\EC:\ - :up=\EA: -# UCSD addition: Yet another termcap from Brian Kantor's Micro Munger Factory -apple-vm80|ap-vm80|apple with viewmax-80:\ - :bs:\ - :co#80:li#24:\ - :cd=300\013:ce=^]:cl=300\014:cm=100\036%+ %+ :ho=200\031:\ - :nd=^\\072:up=^_: - -#### Apple Lisa & Macintosh -# - -# (lisa: changed :vs: to :ve: -- esr) -lisa|apple lisa console display (black on white):\ - :am:bs:eo:ms:\ - :co#88:it#8:li#32:\ - :ac=jdkclfmenbqattuvvuwsx`:ae=\E[10m:al=\E[L:as=\E[11m:\ - :cd=\E[J:ce=\E[K:cl=^L:cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:\ - :do=\E[B:ei=:ho=\E[H:ic=\E[@:im=:is=\E>\E[m\014:kb=^H:\ - :kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:me=\E[m:nd=\E[C:\ - :se=\E[m:so=\E[7m:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:ve=\E[5l:\ - :vi=\E[5h: -liswb|apple lisa console display (white on black):\ - :is=\E>\E[0;7m\014:se=\E[0;7m:so=\E[m:ue=\E[0;7m:\ - :us=\E[4m:tc=lisa: - -# lisaterm from ulysses!gamma!epsilon!mb2c!jed (John E. Duncan III) via BRL; -# :is: revised by Ferd Brundick -# -# These entries assume that the 'Auto Wraparound' is enabled. -# Xon-Xoff flow control should also be enabled. -# -# The vt100 uses :rs2: and :rf: rather than :is2:/:tbc:/:hts: because the tab -# settings are in non-volatile memory and don't need to be reset upon login. -# Also setting the number of columns glitches the screen annoyingly. -# You can type "reset" to get them set. -# -lisaterm|Apple Lisa or Lisa/2 running LisaTerm vt100 emulation:\ - :am:bs:pt:xn:xo:\ - :co#80:it#8:kn#4:li#24:vt#3:\ - :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:do=^J:ho=\E[H:k0=\EOP:k1=\EOQ:\ - :k2=\EOR:k3=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l0=F1:l1=F2:l2=F3:l3=F4:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :r1=\E>\E[?1l\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r:\ - :rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[m:up=\E[A:us=\E[4m: -# Lisaterm in 132 column ("wide") mode. -lisaterm-w|Apple Lisa with Lisaterm in 132 column mode:\ - :co#132:\ - :kb=^H:kd=^J:kl=^H:tc=lisaterm: -# Although MacTerminal has insert/delete line, it is commented out here -# since it is much faster and cleaner to use the "lock scrolling region" -# method of inserting and deleting lines due to the MacTerminal implementation. -# Also, the "Insert/delete ch" strings have an extra character appended to them -# due to a bug in MacTerminal V1.1. Blink is disabled since it is not -# supported by MacTerminal. -mac|macintosh|Macintosh with MacTerminal:\ - :xn:\ - :dN#30:\ - :dc=7\E[P:ei=:ic=9\E[@:im=:ip=7:mb@:tc=lisa: -# Lisaterm in 132 column ("wide") mode. -mac-w|macterminal-w|Apple Macintosh with Macterminal in 132 column mode:\ - :co#132:tc=mac: - -#### Radio Shack/Tandy -# - -# (coco3: This had "ta" used incorrectly as a boolean and bl given as "bl#7". -# I read these as mistakes for ":it#8:" and ":bl=\007:" respectively -- esr) -# From: <{pbrown,ctl}@ocf.berkeley.edu> 12 Mar 90 -coco3|os9LII|Tandy CoCo3 24*80 OS9 Level II:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :al=^_0:bl=^G:cd=^K:ce=^D:cl=5*\014:cm=2\002%r%+ %+ :\ - :dl=^_1:do=^J:ho=^A:kd=^J:kl=^H:kr=^I:ku=^L:le=^H:mb=^_":\ - :md=\E\072^A:me=\037\041\E\072\0:mr=^_ :nd=^F:se=^_\041:\ - :so=^_ :ue=^_#:up=^I:us=^_":ve=^E\041:vi=^E : -# (trs2: removed obsolete ":nl=^_:" -- esr) -trs2|trsII|trs80II|Radio Shack Model II using P&T CP/M:\ - :am:bs:ms:\ - :co#80:it#8:li#24:\ - :al=^D:bl=^G:cd=^B:ce=^A:cl=^L:cm=\EY%+ %+ :cr=^M:dl=^K:\ - :do=^_:ho=^F:kb=^H:kd=^_:kl=^\:kr=^]:ku=^^:le=^H:me=^O:nd=^]:\ - :se=^O:sf=^J:so=^N:ta=^I:up=^^: -# From: Kevin Braunsdorf -# (This had extension capabilities -# :BN=\E[?33h:BF=\E[?33l:UC=\E[_ q:BC=\E[\177 q:\ -# :CN=\ERC:CF=\ERc:NR=\ERD:NM=\ER@: -# I also deleted the unnecessary ":kn#2:", ":sg#0:" -- esr) -trs16|trs-80 model 16 console:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :ac=jak`l_mbquvewcxs:ae=\ERg:al=\EL:as=\ERG:bl=^G:cd=\EJ:\ - :ce=\EK:cl=^L:cm=\EY%+ %+ :cr=^M:dc=\EQ:dl=\EM:do=\EB:ei=:\ - :ho=\EH:ic=\EP:im=:k0=^A:k1=^B:k2=^D:k3=^L:k4=^U:k5=^P:k6=^N:\ - :k7=^S:kb=^H:kd=\EB:kh=^W:kl=\ED:kr=\EC:ku=\EA:l0=f1:l1=f2:\ - :l2=f3:l3=f4:l4=f5:l5=f6:l6=f7:l7=f8:le=^H:me=\ER@:nd=\EC:\ - :pf=\E]+:po=\E]=:se=\ER@:sf=^J:so=\ERD:ta=^I:up=\EA:ve=\ERC:\ - :vi=\ERc: - -#### Atari ST -# - -# From: Simson L. Garfinkel -atari|atari st:\ - :am:bs:\ - :co#80:it#8:li#25:\ - :al=\EL:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :dl=\EM:do=\EB:\ - :kd=\EB:kl=\ED:kr=\EC:ku=\EA:le=\ED:me=\Eq:nd=\EC:se=\Eq:\ - :so=\Ep:sr=\EI:ta=^I:up=\EA: -# UniTerm terminal program for the Atari ST: 49-line VT220 emulation mode -# From: Paul M. Aoki -uniterm|uniterm49|UniTerm VT220 emulator with 49 lines:\ - :li#49:\ - :is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;49r\E[49;1H:tc=vt220: -# MiNT VT52 emulation. 80 columns, 25 rows. -# MiNT is Now TOS, the operating system which comes with all Ataris now -# (mainly Atari Falcon). This termcap is for the VT52 emulation you get -# under tcsh/zsh/bash/sh/ksh/ash/csh when you run MiNT in `console' mode -# From: Per Persson , 27 Feb 1996 -st52|Atari ST with VT52 emulation:\ - :am:km:\ - :co#80:li#25:\ - :K1=\E#7:K2=\E#9:K3=\E#5:K4=\E#1:K5=\E#3:al=\EL:bl=^G:\ - :cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :cr=^M:dl=\EM:do=\EB:\ - :ho=\EH:k0=\E#D:k1=\E#;:k2=\E#<:k3=\E#=:k4=\E#>:k5=\E#?:\ - :k6=\E#@:k7=\E#A:k8=\E#B:k9=\E#C:kA=\E#R:kC=\E#7:kF=\E#2:\ - :kR=\E#8:kb=^H:kd=\E#P:kh=\E#G:kl=\E#K:kr=\E#M:ku=\E#H:\ - :l0=f10:le=\ED:me=\Eq:nd=\EC:nw=^M^J:r1=\Ez_\Eb@\EcA:\ - :rc=\Ek:sc=\Ej:se=\Eq:sf=^J:so=\Ep:sr=\EI:ta=^I:te=:ti=\Ee:\ - :up=\EA:ve=\Ee:vi=\Ef: - -#### Commodore Business Machines -# -# Formerly located in West Chester, PA; went spectacularly bust in 1994 -# after years of shaky engineering and egregious mismanagement. Made one -# really nice machine (the Amiga) and boatloads of nasty ones (PET, C-64, -# C-128, VIC-20). The C-64 is said to have been the most popular machine -# ever (most units sold); they can still be found gathering dust in closets -# everywhere. -# - -# From: Kent Polk , 30 May 90 -# Added a few more entries, converted caret-type control sequence (^x) entries -# to '\0xx' entries since a couple of people mentioned losing '^x' sequences. -# Corrections by Ty Sarna , Sat Feb 28 18:55:15 1998 -# -# :as:, :ae: Support for alternate character sets. -# :ve=\E[\040p:vi=\E[\060\040p: cursor visible/invisible. -# :xn: vt100 kludginess at column 80/NEWLINE ignore after 80 cols(Concept) -# This one appears to fix a problem I always had with a line ending -# at 'width+1' (I think) followed by a blank line in vi. The blank -# line tended to disappear and reappear depending on how the screen -# was refreshed. Note that this is probably needed only if you use -# something like a Dnet Fterm with the window sized to some peculiar -# dimension larger than 80 columns. -# :k0=\E9~: map F10 to k0 - could have F0-9 -> k0-9, but ... F10 was 'k;' -# (amiga: removed obsolete :kn#10:, -# also added empty to suppress a warning --esr) -amiga|Amiga ANSI:\ - :am:bs:bw:xn:\ - :co#80:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:SF=\E[%dS:SR=\E[%dT:UP=\E[%dA:ac=:\ - :ae=^O:al=\E[L:as=^N:bl=^G:bt=\E[Z:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:do=\E[B:ei=:\ - :ho=\E[H:ic=\E[@:im=:is=\E[20l:k0=\E[9~:k1=\E[0~:k2=\E[1~:\ - :k3=\E[2~:k4=\E[3~:k5=\E[4~:k6=\E[5~:k7=\E[6~:k8=\E[7~:\ - :k9=\E[8~:kb=^H:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=\E[D:\ - :mb=\E[7;2m:md=\E[1m:me=\E[m:mh=\E[2m:mk=\E[8m:mr=\E[7m:\ - :nd=\E[C:r1=\Ec:se=\E[m:sf=\E[S:so=\E[7m:sr=\E[T:ue=\E[m:\ - :up=\E[A:us=\E[4m:ve=\E[ p:vi=\E[0 p: - -# From: Hans Verkuil , 4 Dec 1995 -# (amiga: added empty to suppress a warning. -# I'm told this entry screws up badly with AS225, the Amiga -# TCP/IP package once from Commodore, and now sold by InterWorks.--esr) -amiga-h|Hans Verkuil's Amiga ANSI:\ - :bs:bw:ms:\ - :co#80:li#24:\ - :DC=\233%dP:DO=\233%dB:IC=\233%d@:LE=\233%dD:RI=\233%dC:\ - :SF=\233%dS:SR=\233%dT:UP=\233%dA:ac=:ae=^O:as=^N:bl=^G:\ - :bt=\233Z:cd=\233J:ce=\233K:cl=\233H\233J:\ - :cm=\233%i%d;%dH:cr=^M:dc=\233P:do=\233B:ec=\233%dP:ei=:\ - :ho=\233H:ic=\233@:im=:is=\23320l:k0=\2339~:k1=\2330~:\ - :k2=\2331~:k3=\2332~:k4=\2333~:k5=\2334~:k6=\2335~:\ - :k7=\2336~:k8=\2337~:k9=\2338~:kD=\177:kb=^H:kd=\233B:\ - :kl=\233D:kr=\233C:ku=\233A:le=\233D:mb=\2337;2m:\ - :md=\2331m:me=\2330m:mh=\2332m:mk=\2338m:mr=\2337m:\ - :nd=\233C:nw=\233B\r:r1=\Ec:se=\2330m:sf=\233S:so=\2337m:\ - :sr=\233T:ta=^I:te=\233?7h:ti=\233?7l:ue=\2330m:up=\233A:\ - :us=\2334m:vb=^G:ve=\233 p:vi=\2330 p: - -# From: Henning 'Faroul' Peters , 25 Sep 1999 -amiga-8bit|Amiga ANSI using 8-bit controls:\ - :AL=\233%dL:DL=\233%dM:SF@:SR@:ac=:al=\233L:dl=\233M:\ - :sf=\204:sr=\215:\ - :tc=amiga-h: - -# Commodore B-128 microcomputer from Doug Tyrol -# I'm trying to write a termcap for a commodore b-128, and I'm -# having a little trouble. I've had to map most of my control characters -# to something that unix will accept (my delete-char is a ctrl-t, etc), -# and create some functions (like cm), but thats life. -# The problem is with the arrow keys - right, and up work fine, but -# left deletes the previous character and down I just can't figure out. -# Jove knows what I want, but I don't know what it's sending to me (it -# isn't thats bound to next-line in jove). -# Anybody got any ideas? Here's my termcap. -# DAG -- I changed his "^n" entries to "\n"; see if that works. -# -commodore|b-128|Commodore B-128 micro:\ - :am:bw:\ - :co#80:dN#20:li#24:pb#150:\ - :al=10\Ei:bc=^H:ce=10\Eq:cl=10\E\006:\ - :cm=20\E\013%2\054%2\054:cr=^M:dc=10*\177:dl=10*\Ed:\ - :do=^J:ei=:ho=\E^E:ic=5\E\n:im=:kd=^J:kh=\E^E:kl=^B:kr=^F:\ - :ku=^P:nd=^F:nl=^M:ta=5\011:up=^P: - -#### North Star -# -# North Star Advantage from Lt. Fickie via BRL -northstar|North Star Advantage:\ - :bs:\ - :co#80:li#24:\ - :cd=200\017:ce=200\016:cl=200\004:cm=1\E=%+ %+ :\ - :ho=200\034\032: - -#### Osborne -# -# Thu Jul 7 03:55:16 1983 -# -# As an aside, be careful; it may sound like an anomaly on the -# Osborne, but with the 80-column upgrade, it's too easy to -# enter lines >80 columns! -# -# I've already had several comments... -# The Osborne-1 with the 80-col option is capable of being -# 52, 80, or 104 characters wide; default to 80 for compatibility -# with most systems. -# -# The tab is destructive on the Ozzie; make sure to 'stty -tabs'. -osborne-w|osborne1-w|osborne I in 104-column mode:\ - :ms:ul:xt:\ - :co#104:li#24:\ - :al=\EE:bl=^G:ce=\ET:cl=^Z:cm=\E=%+ %+ :cr=^M:dc=\EW:dl=\ER:\ - :do=^J:ei=:ic=\EQ:im=:kd=^J:kl=^H:kr=^L:ku=^K:le=^H:nd=^L:\ - :se=\E(:sf=^J:so=\E):ue=\Em:up=^K:us=\El: -# Osborne I from ptsfa!rhc (Robert Cohen) via BRL -osborne|osborne1|osborne I in 80-column mode:\ - :am:bs:mi:ms:ul:xs:\ - :co#80:dB#4:li#24:\ - :al=\EE:ce=\ET:cl=^Z:cm=\E=%+ %+ :dc=4\EW:dl=\ER:do=^J:ei=:\ - :im=\EQ:is=^Z:kb=^H:kd=^J:kl=^H:kr=^L:ku=^K:le=\010:nd=^L:\ - :se=\E):so=\E(:ue=\Em:up=^K:us=\El: -# -# Osborne Executive definition from BRL -# Similar to tvi920 -# Added by David Milligan and Tom Smith (SMU) -osexec|Osborne executive:\ - :am:bs:\ - :co#80:li#24:sg#1:\ - :al=\EE:bl=^G:cd=\EY:ce=\ET:cl=^Z:cm=\E=%+ %+ :cr=^M:ct=\E3:\ - :dc=\EW:dl=\ER:do=^J:ei=:ho=^^:ic=\EQ:im=:\ - :is=\Eq\Ek\Em\EA\Ex0:k0=^A@\r:k1=^AA\r:k2=^AB\r:k3=^AC\r:\ - :k4=^AD\r:k5=^AE\r:k6=^AF\r:k7=^AG\r:k8=^AH\r:k9=^AI\r:\ - :kb=^H:kd=^J:kl=^H:kr=^L:ku=^K:le=^H:nd=^L:nl=^J:se=\Ek:\ - :so=\Ej:st=\E1:ue=\Em:up=^K:us=\El: - -#### Console types for obsolete and not-so-obsolete UNIX clones -# -# Coherent, Minix, Venix, and several lesser-known kin were OSs for 8088 -# machines that tried to emulate the UNIX look'n'feel. Coherent and Venix -# were commercial, Minix an educational tool sold in conjunction with a book. -# Memory-segmentation limits and a strong tendency to look like V7 long after -# it was obsolete made all three pretty lame. Venix croaked early. Coherent -# and Minix were ported to 32-bit Intel boxes, only to be run over by a -# steamroller named `Linux' (which, to be fair, traces some lineage to Minix). -# Coherent's vendor, the Mark Williams Company, went belly-up in 1994. There -# are also, I'm told, Minix ports that ran on Amiga and Atari machines and -# even as single processes under SunOS and the Macintosh OS. -# - -# This is the entry provided with MINIX 3.1.6. -minix|minix console:\ - :am:xn:bs:\ - :co#80:it#8:li#25:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:cd=\E[0J:\ - :ce=\E[K:cl=\E[H\E[0J:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:\ - :dl=\E[M:do=\E[B:ho=\E[H:ic=\E[@:is=\E[0m:k1=\E[11~:\ - :k2=\E[12~:k3=\E[13~:k4=\E[14~:k5=\E[15~:k6=\E[17~:\ - :k7=\E[18~:k8=\E[19~:k9=\E[20~:k;=\E[21~:kD=\177:\ - :kI=\E[@:kN=\E[U:kP=\E[V:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[0m:\ - :mr=\E[7m:nd=\E[C:nw=^M^J:se=\E[0m:sf=^J:so=\E[7m:\ - :sr=\EM:ta=^I:ue=\E[0m:up=\E[A:us=\E[4m:@7=\E[Y:\ - :Co#8:pa#64:AB=\E[4%dm:AF=\E[3%dm: -# Corrected Jan 14, 1997 by Vincent Broman -minix-old|minix console (v1.5):\ - :xo:\ - :co#80:it#8:li#25:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:al=\E[L:bl=^G:cd=\E[0J:\ - :ce=\E[K:cl=\E[H\E[0J:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:\ - :dl=\E[M:do=\E[B:ei=:ho=\E[H:ic=\E[@:im=:k0=\E[Y:k1=\E[V:\ - :k2=\E[U:k3=\E[T:k4=\E[S:k5=\E[G:kb=^H:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\E[5m:md=\E[1m:me=\E[0m:\ - :mr=\E[7m:nd=\E[C:nw=^M^J:se=\E[0m:sf=^J:so=\E[7m:sr=\EM:\ - :ta=^I:ue=\E[0m:up=\E[A:us=\E[4m: -# The linewrap option can be specified by editing /usr/include/minix/config.h -# before recompiling the minix 1.5 kernel. -minix-old-am|minix console with linewrap:\ - :am:tc=minix-old: - -pc-minix|minix console on an Intel box:\ - :tc=klone+acs:tc=minix: - -# According to the Coherent 2.3 manual, the PC console is similar -# to a z19. The differences seem to be (1) 25 lines, (2) no status -# line, (3) standout is broken, (4) ins/del line is broken, (5) -# has blinking and bold. -pc-coherent|pcz19|coherent|IBM PC console running Coherent:\ - :am:mi:\ - :co#80:it#8:li#25:\ - :bl=^G:cd=\EJ:ce=\EK:cl=\EE:cm=\EY%+ %+ :cr=^M:dc=\EN:\ - :do=\EB:ei=\EO:ho=\EH:im=\E@:kb=^H:kd=\EB:kh=\EH:kl=\ED:\ - :kr=\EC:ku=\EA:le=^H:me=\Eq:nd=\EC:se=\Eq:sf=^J:so=\Ep:\ - :sr=\EI:ta=^I:up=\EA: - -# According to the Venix 1.1 manual, the PC console is similar -# to a DEC vt52. Differences seem to be (1) arrow keys send -# different strings, (2) enhanced standout, (3) added insert/delete line. -# Note in particular that it doesn't have automatic margins. -# There are other keys (f1-f10, kpp, knp, kcbt, kich1, kdch1) but they -# not described here because this derives from an old termcap entry. -pc-venix|venix|IBM PC console running Venix:\ - :co#80:it#8:li#25:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :cr=^M:\ - :dl=\EM:do=^J:kb=^H:kd=\EP:kh=\EG:kl=\EK:kr=\EM:ku=\EH:le=^H:\ - :nd=\EC:sf=^J:sr=\EI:ta=^I:up=\EA: - -#### Miscellaneous microcomputer consoles -# -# If you know anything more about any of these, please tell me. -# - -# The MAI Basic Four computer was obsolete at the end of the 1980s. -# It may be used as a terminal by putting it in "line" mode as seen on -# one of the status lines. -# Initialization is similar to CIT80. :is: will set ANSI mode for you. -# Hardware tabs set by :if: at 8-spacing. Auto line wrap causes glitches so -# wrap mode is reset by :vs:. Using :sf:=\E[S caused errors so I -# used \ED instead. -# From: bf347@lafn.org (David Lawyer), 28 Jun 1997 -mai|basic4|MAI Basic Four in ansi mode:\ - :am:da:db:mi:ms:\ - :co#82:it#8:li#25:\ - :al=\E[L:bl=^G:cd=^_:ce=^^:cl=^]^_:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:dc=\E[1P:dl=\E[M:do=^J:ei=\E[4l:ho=^]:\ - :if=/usr/lib/tabset/vt100:im=\E[4h:\ - :is=\E>\E[?1h\E[?7h\E[?5l\017\E(B\E[m\E[20l\E[1;24r\E[24;1H:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:\ - :k8=\EOW:kb=^H:kd=\EOB:kl=\EOD:kr=\EOC:ku=\EOA:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=^X:nw=^M\ED:rc=\E8:\ - :sc=\E7:se=\E[m:sf=\ED:so=\E[7m:sr=\E[T:ta=^I:ue=\E[m:up=^Z:\ - :us=\E[4m:ve=\E[?7h:vs=\E[?7l: -# basis from Peter Harrison, Computer Graphics Lab, San Francisco -# ucbvax!ucsfmis!harrison ...uucp / ucbvax!ucsfmis!harrison@BERKELEY ...ARPA -# -# On Sat, 7 Aug 1999, Torsten Jerzembeck wrote: -# The Basis 108 was a Apple II clone, manufactured by the "Basis -# Mikrocomputer GmbH" in Munster, Germany (the company still exists today, -# about 1,5 km from where I live, but doesn't build own computers any -# more). A Basis 108 featured a really heavy (cast aluminium?) case, was -# equipped with one or two 5.25" disk drives, had a monochrome and colour -# video output for a TV set or a dedicated monitor and several slots for -# Apple II cards. Basis 108 were quite popular at german schools before -# the advent of the IBM PC. They run, for example, the UCSD Pascal -# development system (which I used even in 1993 to program the steering -# and data recording for our school's experimental solar panel :), Apple DOS -# or CP/M. -# (basis: removed obsolete ":ma=^K^P^R^L^L :nl=5000*^J:" -- esr) -basis|BASIS108 computer with terminal translation table active:\ - :cd=\EY:ce=\ET:cl=300\E*:do=5000\n:kb=^H:kd=^J:kl=^H:kr=^L:\ - :ku=^K:me=\E):se=\E):so=\E(:\ - :tc=adm3a: -# luna's BMC terminal emulator -luna|luna68k|LUNA68K Bitmap console:\ - :co#88:li#46:tc=ansi-mini: -megatek|pegasus workstation terminal emulator:\ - :am:os:\ - :co#83:li#60: -# The Xerox 820 was a Z80 micro with a snazzy XEROX PARC-derived -# interface (pre-Macintosh by several years) that went nowhere. -xerox820|x820|Xerox 820:\ - :am:\ - :co#80:li#24:\ - :bl=^G:cd=^Q:ce=^X:cl=1^Z:cm=\E=%+ %+ :cr=^M:do=^J:ho=^^:\ - :le=^H:nd=^L:sf=^J:up=^K: - -#### Videotex and teletext -# - -# From: Alexandre Montaron , 18 Jun 1998 -# -minitel1|minitel 1:\ - :am:bw:es:hs:hz:ms:\ - :Co#8:co#40:li#24:pa#8:\ - :..Sf=\E%?%p1%{1}%=%tD%e%p1%{3}%=%tF%e%p1%{4}%=%tA%e%p1%{6}%=%tC%e%p1%{64}%+%c%;:\ - :ac=+.\054\054./f0g1:bl=^G:ce=^X:cl=^L:cm=\037%+A%+A:\ - :cr=^M:do=^J:eA=^Y:fs=^J:ho=^^:\ - :is=\E;`ZQ\E\072iC\E\072iE\021:le=^H:mb=\EH:me=\EI\E\:\ - :mr=\E]:nd=^I:nw=^M^J:op=\EG:rp=%.\022%+?:\ - :..sa=%?%p1%t\E]%;%?%p3%t\E]%;%?%p4%t\EH%;:se=\E\:\ - :sf=^J:so=\E]:sr=^K:ts=\037@%p1%{65}%+%c:up=^K:ve=^Q:vi=^T: -# is2=Fnct TE, Fnct MR, Fnct CM et pour finir: curseur ON. -minitel1b|minitel 1-bistandard (in 40cols mode):\ - :mi:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:al=\E[L:cb=\E[1K:cd=\E[J:dc=\E[P:\ - :dl=\E[M:ei=\E[4l:i1=\E;iYA\E;jYC:im=\E[4h:kA=\E[L:\ - :kC=\E[2J:kD=\E[P:kE=^X:kI=\E[4h:kL=\E[M:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ks=\E;iYA\E;jYC:kt=^I:ku=\E[A:\ - :tc=minitel1: -# :ke: posait des problemes (logout en sortant de vi). -minitel1b-80|minitel 1-bistandard (standard teleinformatique):\ - :am@:bw@:hz@:\ - :Co@:co#80:it#8:pa@:\ - :@8=\EOM:Sf@:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:ho=\E[H:\ - :i1@:is@:k0=\EOp:k1=\EOq:k2=\EOr:k3=\EOs:k4=\EOt:k5=\EOu:\ - :k6=\EOv:k7=\EOw:k8=\EOx:k9=\EOy:ke@:ks@:mb=\E[5m:md=\E[1m:\ - :me=\E[m:mr=\E[7m:nd=\E[C:nw=\EE:op@:rc=\E8:rp@:\ - :..sa=\E[%?%p1%t7;%;%?%p2%t4;%;%?%p3%t7;%;%?%p4%t5;%;%?%p6%t1;%;m:\ - :sc=\E7:se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:ta=^I:ue=\E[24m:\ - :up=\E[A:us=\E[4m:ve=\037@A\021\n:vi=\037@A\024\n:\ - :tc=minitel1b: -# \E\:1} switch to te'le'informatique mode (ascii terminal/ISO 6429) -# \E[?3l 80 columns -# \E[?4l scrolling on -# \E[12h local echo off -# \Ec reset: G0 U.S. charset (to get #,@,{,},...), 80 cols, clear screen -# \E)0 G1 DEC set (line graphics) -# -# From: Igor Tamitegama , 18 Jan 1997 -m2-nam|minitel|minitel-2|minitel-2-nam|France Telecom Minitel 2 mode te'le'informatique:\ - :bs:es:hs:xn:\ - :co#80:it#8:li#24:sg#0:ws#72:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:\ - :RI=\E[%dC:SF=^J:SR=\EM:UP=\E[%dA:\ - :ac=aaffggjjkkllmmnnooqqssttuuvvwwxx:ae=^O:al=\E[L:\ - :as=^N:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:\ - :fs=^J:ho=\E[H:i1=\E\0721}\Ec\E[?4l\E[12h:\ - :i2=\E[?3l kbs=\010:im=\E[4h:ip=7:is=\Ec\E[12h\E)0:\ - :k0=\EOp:k1=\EOq:k2=\EOr:k3=\EOs:k4=\EOt:k5=\EOu:k6=\EOv:\ - :k7=\EOw:k8=\EOx:k9=\EOy:k;=\EOp:kA=\E[4l:kC=\E[2J:kD=\E[P:\ - :kI=\E[4h:kL=\E[M:kN=\EOn:kP=\EOR:kd=\E[B:kh=\E[H:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=\E[D:ll=\E[24;80H:mb=\E[5m:md=\E[1m:\ - :me=\E[m:mr=\E[7m:nd=\E[C:nw=^M^J:ps=\E[i:\ - :r1=\Ec\E[?4l\E[12h:r2=\Ec\E)0:rc=\E8:sc=\E7:se=\E[27m:\ - :sf=^J:so=\E[7m:sr=\EM:ta=^I:ts=^_@A:u6=\E[%i%d;%dR:\ - :u7=\E[6n:ue=\E[24m:up=\E[A:us=\E[4m:vb=^G:ve=\E[<1l:\ - :vi=\E[<1h: - -######## OBSOLETE VDT TYPES -# -# These terminals are *long* dead -- these entries are retained for -# historical interest only. - -#### Amtek Business Machines -# - -# (abm80: early versions of this entry apparently had ":se=\E^_:so=\E^Y", -# but these caps were commented out in 8.3; also, removed overridden -# ":do=^J:" -- esr) -abm80|amtek business machines 80:\ - :am:bs:bw:\ - :co#80:li#24:\ - :al=\E^Z:bt=^T:cd=\E^X:ce=\E^O:cl=\E^\:cm=\E\021%r%+ %+ :\ - :dl=\E^S:do=\E^K:ho=\E^R:le=^H:nd=^P:up=\E^L: - -#### Bell Labs blit terminals -# -# These were AT&T's official entries. The 5620 FAQ maintained by -# David Breneman has this to say: -# -# Actually, in the beginning was the Jerq, and the Jerq was white with a -# green face, and Locanthi and Pike looked upon the Jerq and said the Jerq -# was good. But lo, upon the horizon loomed a mighty management-type person -# (known now only by the initials VP) who said, the mighty Jerq must stay -# alone, and could not go forth into the world. So Locanthi and Pike put the -# Jerq to sleep, cloned its parts, and the Blit was brought forth unto the -# world. And the Jerq lived the rest of its days in research, but never -# strayed from those paths. -# -# In all seriousness, the Blit was originally known as the Jerq, but when -# it started to be shown outside of the halls of the Bell Labs Research -# organization, the management powers that be decided that the name could -# not remain. So it was renamed to be Blit. This was in late 1981. -# -# (The AT&T 5620 was the commercialized Blit. Its successors were the 630, -# 730, and 730+.) -# - -blit|jerq|blit running teletype rom:\ - :am:eo:ul:xo:\ - :co#87:it#8:li#72:\ - :AL=\EF%+ :DC=\Ee%+ :DL=\EE%+ :IC=\Ef%+ :al=\EF\041:bl=^G:\ - :ce=\EK:cl=^L:cm=\EY%r%+ %+ :cr=^M:dc=\Ee\041:dl=\EE\041:\ - :do=^J:ei=:ic=\Ef\041:im=:k1=\Ex:k2=\Ey:k3=\Ez:kb=^H:kd=\EB:\ - :kl=\ED:kr=\EC:ku=\EA:le=\ED:nd=\EC:sf=^J:ta=^I:up=\EA: - -# (cbblit: here's a BSD termcap that says :do=\EG: -- esr) -cbblit|fixterm|blit running columbus code:\ - :co#88:\ - :cd=\EJ:ei=\ER:ic@:im=\EQ:pO=\EP%03:pf=^T:po=^R:se=\EV\041:\ - :so=\EU\041:ue=\EV":us=\EU":vb=\E^G:\ - :tc=blit: - -oblit|ojerq|first version of blit rom:\ - :am:da:db:eo:mi:ul:xo:\ - :co#88:it#8:li#72:\ - :AL=\Ef%+ :DL=\Ee%+ :al=\EF:bl=^G:cd=\EJ:ce=\EK:cl=^L:\ - :cm=\EY%r%+ %+ :cr=^M:dc=\EO:dl=\EE:do=^J:ei=\ER:im=\EQ:\ - :kb=^H:le=\ED:nd=\EC:sf=^J:ta=^I:up=\EA:vb=\E^G: - -#### Bolt, Beranek & Newman (bbn) -# -# The BitGraph was a product of the now-defunct BBN Computer Corporation. -# The parent company, best known as the architects of the Internet, is -# still around. -# -# Jeff DelPapa writes: -# The bitgraph was a large white box that contained a monochrome bitmap -# display, and a 68000 to run it. You could download code and run it on -# the cpu, it had 128kb (I think) of memory. I used one in the late -# 70's, sure beat a vt100. It had one strange feature tho -- it used -# the cpu to bitblt pixels to scroll, it took longer than the refresh -# rate, and looked like a rubber sheet stretching, then snapping -# upwards. It had everything the early mac had, except a floppy drive a -# small screen (it had a 17" crisp beauty) and a real OS. They (Bolt -# Beranek and Neuman) sold at most a few hundred of them to the real -# world. DOD may have bought more... -# - -# Entries for the BitGraph terminals. The problem -# with scrolling in vi can only be fixed by getting BBN to put -# smarter scroll logic in the terminal or changing vi or padding -# scrolls with about 500 ms delay. -# -# I always thought the problem was related to the terminal -# counting newlines in its input buffer before scrolling and -# then moving the screen that much. Then vi comes along and -# paints lines in on the bottom line of the screen, so you get -# this big white gap. - -bitgraph|bg2.0nv|bg3.10nv|bbn bitgraph 2.0 or later (normal video):\ - :is=\E>\E[?5l\E[?7h:vb=\E[?5h\E[?5l:\ - :tc=bg2.0: -bg2.0rv|bg3.10rv|bbn bitgraph 2.0 (reverse video):\ - :is=\E>\E[?5h\E[?7h:vb=\E[?5l\E[?5h:tc=bg2.0: -bg2.0|bg3.10|bbn bitgraph 2.0 or later (no init):\ - :bs:xn:\ - :co#85:li#64:\ - :al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[J:cm=%i\E[%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:dl=\E[M:do=\E[B:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:kd=\E[B:ke=\E>:kl=\E[D:kr=\E[C:ks=\E=:\ - :ku=\E[A:l1=PF1:l2=PF2:l3=PF3:l4=PF4:le=^H:me=\E[m:nd=\E[C:\ - :rc=\E8:sc=\E7:se=\E[m:sf=\n:so=\E[7m:ta=^I:up=\E[A: - -bg1.25rv|bbn bitgraph 1.25 (reverse video):\ - :is=\E>\E[?5h\E[?7h:vb=\E[?5l\E[?5h:tc=bg1.25: -bg1.25nv|bbn bitgraph 1.25 (normal video):\ - :is=\E>\E[?5l\E[?7h:vb=\E[?5h\E[?5l:tc=bg1.25: -# (bg1.25: I added / based on the init string -- esr) -bg1.25|bbn bitgraph 1.25:\ - :co#85:li#64:\ - :RA=\E[?7l:SA=\E[?7h:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=%i\E[%d;%dH:cr=^M:dl=\E[M:do=\E[B:k1=\EP:\ - :k2=\EQ:k3=\ER:k4=\ES:kd=\EB:ke=\E>:kl=\ED:kr=\EC:ks=\E=:\ - :ku=\EA:l1=PF1:l2=PF2:l3=PF3:l4=PF4:le=^H:ll=\E[64;1H:\ - :me=\E[m:nd=\E[C:se=\E[m:sf=\n:so=\E[7m:ta=^I:up=\E[A: - -#### Bull (bq, dku, vip) -# -# (Adapted for terminfo; AIX extension capabilities translated -- esr) - -#============================================# -# BULL QUESTAR 210 `SDP' terminals emulation # -#============================================# -# -# Description written by R.K.Saunders (Bull Transac) -# -# Modifications written by F. Girard (Bull MTS) -# 19-05-87 V02.00.01 -# 17-12-87 V02.00.02 -# 15-09-89 V02.00.05 -# -# Typical technical selections F1 (modes SDP/ROLL): -# ------------------------------------------------------- -# | 01 02 03 04 05 06 07 08 09 10 | -# | 1010 0011 1010 0110 0110 0001 0100 0000 0000 0000 | -# | | -# | 11 12 13 14 15 16 17 18 19 20 | -# | 0000 0110 100? 0000 0000 0000 0001 0000 0000 0001 | -# | | -# | 21 22 23 24 25 26 27 28 29 30 | -# | 0011 0000 0001 1000 0000 0000 0000 0000 0000 0000 | -# | | -# | 31 32 33 34 35 36 37 38 39 40 | -# | 1010 0011 0000 0000 0000 0000 0000 0000 0000 0000 | -# ------------------------------------------------------- -# Typical firmware identification F5 "etat 6": -# P287.02.04b (AZERTY) -# P297.11.04 (24-pin: 2732) or P798.11.04 (28-pin: 2764) -# P298.03.03 (monochrome) or P374.03.02 (colour) -# -# SM SDP mode (VIP command): ^[[?=h -# RIS (erases screen): ^[c -# DMI disable keyboard: ^[` -# SM double rendition mode: ^[[?>h -# RM solicited status mode: ^[[5l -# RM character mode: ^[[>l -# RM echoplex mode: ^[[12l -# RM column tab mode: ^[[18l -# RM forbid SS2 keyboard mode: ^[[?h\EPY99\07298\E\:\ - :i2=\Eb\E[?;12;18;?h\EPY99\07298\E\:\ - :ts=\EPY99\07298\E\\E[0;98v\E[2;7m:ue=\E[m:up=\E[A:\ - :us=\E[0;4m:ve=\E[r:vi=\E[1r: -tws2102-sna|dku7102-sna|BULL Questar tws2102 for SNA:\ - :ds=\E[0;98v\E[2J\E[v:fs=\E[v:i2=\Eb:ts=\E[0;98v:\ - :tc=tws-generic: -tws2103|xdku|BULL Questar tws2103:\ - :ta=^I:tc=tws-generic: -tws2103-sna|dku7103-sna|BULL Questar tws2103 for SNA:\ - :ta=^I:\ - :tc=tws2102-sna: -dku7102-old|BULL Questar 200 DKU7102 (microcode version < 6):\ - :AL@:DL@:al@:ce=\E[K\E[m:cl=\E[2J\E[H:cm@:dl@:\ - :ds=\EPY99\07298\E\\E[0;98v\E[2J\E[H\E[v:\ - :ts=\EPY99\07298\E\\E[0;98v\E[H\E[2;7m:\ - :tc=tws-generic: -dku7202|BULL Questar 200 DKU7202 (colour/character attributes):\ - :i2=\E[?3h\Eb:mb=\E[0;2;4m:mh=\E[0;5m:so=\E[0;4;5;7m:\ - :ta=^I:us=\E[0;2m:\ - :tc=tws-generic: - -#=========================================================# -# BULL QUESTAR 303 & 310 `DEC VT 320' terminals emulation # -#=========================================================# -# -# Description written by J. Staerck (BULL SA) -# Copyright (c) 1989 BULL SA -#--------------------------------------------------------------------------- -# This entry is used for terminals with vt320 emulation mode -# and following set-up : -# 8 bit ISO Latin Character Set (ISO 8859-1), -# 7 bit Control Characters, -# 80 columns screen. -# Hereafter are some DEC vt terminals' commands. (valid on vt200 and 300) -# They are used in string capabilities with vt220-320 emulation mode. -# In the following DEC definitions, two kinds of terminfo databases are -# provided : -# 1. the first with Command Sequence Introducer starting with escape -# sequence in 7 bits characters ex. ESC [ : 2 chars. in 7-bit mode. -# 2. the second with Command Sequence Introducer starting with escape -# sequence in 8 bits characters ex. ESC [ : 1 char. 'CSI' =x9B. -# Soft Terminal Reset esc [ ! p -# RIS (erases screen): esc c -# DECKPNM numeric keypad mode: esc > -# DECKPAM applic. keypad mode: esc = -# DECSTBM Scrolling region: esc [ r -# SCS select G0 = US: esc ( B -# SCS select G1 = line-graphic: esc ) 0 -# Select 7-bit C1 controls: esc sp F -# Select 8-bit C1 controls: esc sp G -# Select cursor home: esc [ H -# Select erase screen: esc [ J -# SM KAM lock keyboard: esc [ 2 h -# RM KAM unlock keyboard: esc [ 2 l -# SM SRM local echo off: esc [ 1 2 h -# RM SRM local echo on: esc [ 1 2 l -# SM LNM New line : esc [ 2 0 h -# RM LNM return = CR only: esc [ 2 0 l -# SM DECCKM cursor keys mode: esc [ ? 1 h -# RM DECCKM appli. keys mode: esc [ ? 1 l -# SM DECANM ANSI mode on: esc [ ? 2 h -# RM DECANM ANSI mode off: esc [ ? 2 l -# SM DECCOLM 132-column screen: esc [ ? 3 h -# RM DECCOLM 80-column screen: esc [ ? 3 l -# SM DECSCLM Smooth scroll: esc [ ? 4 h -# RM DECSCLM Jump scroll: esc [ ? 4 l -# SM DECSCNM screen light backgr. esc [ ? 5 h -# RM DECSCNM screen dark backgr. esc [ ? 5 l -# SM DECOM move within margins: esc [ ? 6 h -# RM DECOM move outside margins: esc [ ? 6 l -# SM DECAWM auto right margin: esc [ ? 7 h -# RM DECAWM auto right margin: esc [ ? 7 l -# SM DECARM auto repeat: esc [ ? 8 h -# RM DECARM auto repeat: esc [ ? 8 l -# DECSASD Select active main: esc [ 0 $ } -# DECSASD Select active status: esc [ 1 $ } -# DECSSDT Select status none: esc [ 0 $ ~ -# DECSSDT Select status indic.: esc [ 1 $ ~ -# DECSSDT Select status host-wr: esc [ 2 $ ~ -# SM DECTCEM Visible cursor: esc [ ? 2 5 h -# RM DECTCEM Invisible cursor: esc [ ? 2 5 l -# SM DECNCRM 7 bits NCR set: esc [ ? 4 2 h -# RM DECNCRM Multi or ISO latin: esc [ ? 4 2 l -# SM DECNKM numeric keypad mode: esc [ ? 6 6 h -# RM DECNKM numeric keypad appl.: esc [ ? 6 6 l -# SM DECKBUM clavier informatique esc [ ? 6 8 h -# RM DECKBUM clavier bureautique: esc [ ? 6 8 l -# DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 " p -# or DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 ; 0 " p -# or DECSCL vt300 mode 8-bit ctrl: esc [ 6 3 ; 2 " p -# DECSCL vt300 mode 7-bit ctrl: esc [ 6 3 ; 1 " p -# Char. and Line attributes: esc [ Ps ... Ps m -# with: 0 All off, 1 Bold, 4 Underline, 5 Blinking, 7 Reverse -# and : 22 Bold off, 24 Underline off, 25 Blinking off, 27 Reverse off -# - -# This entry covers BQ303, BQ306, BQ310, Q303, Q306, Q310 -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -bq300|Bull vt320 ISO Latin 1 80 columns terminal:\ - :am:eo:es:hs:km:mi:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:ws#80:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :K1=\EOw:K2=\EOu:K3=\EOy:K4=\EOq:K5=\EOs:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :ct=\E[3g:dc=\E[P:dl=\E[M:do=\E[B:\ - :ds=\E[1$}\E[2$~\n\E[0$}:ec=\E[%dX:ei=\E[4l:fs=\E[0$}:\ - :ho=\E[H:i1=\E[63;1"p\E[2h:\ - :i2=\E[0$}\E[?25h\E[2l\E[H\E[J:im=\E[4h:\ - :is=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k6=\E[17~:k7=\E[18~:\ - :k8=\E[19~:k9=\E[20~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:\ - :kb=^H:kd=\E[B:ke=\E[?1l\E>:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=\E[D:mb=\E[5m:md=\E[1m:me=\E[0m\E(B:mr=\E[7m:nd=\E[C:\ - :nw=\EE:rc=\E8:sc=\E7:se=\E[27m:sf=\ED:so=\E[7m:sr=\EM:\ - :st=\EH:ta=^I:te=\E[?7h:ti=\E[?7l\E[?1l\E(B:\ - :ts=\E[1$}\E[2$~:ue=\E[24m:up=\E[A:us=\E[4m:\ - :vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h: -bg300-rv|Bull vt320 reverse 80 columns:\ - :is=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l:\ - :vb=\E[?5l\E[?5h:\ - :tc=bq300: -bq300-w|Bull vt320 132 columns:\ - :co#132:ws#132:\ - :is=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l:\ - :r2=\E[?3h:\ - :tc=bq300: -bq300-w-rv|Bull vt320 reverse mode 132 columns:\ - :co#132:ws#132:\ - :is=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l:\ - :r2=\E[?3h:vb=\E[?5l\E[?5h:\ - :tc=bq300: - -# This entry is used for terminals with vt320 emulation mode -# and following set-up : -# 8 bit ISO Latin Character Set (ISO 8859-1), -# 8 bit Control Characters, (CSI coded as x9B for ESC [) -# 80 columns screen. -# Soft Terminal Reset csi ! p -# RIS (erases screen): esc c -# DECKPNM numeric keypad mode: esc > -# DECKPAM applic. keypad mode: esc = -# DECSTBM Scrolling region: esc [ r -# SCS select G0 = US: esc ( B -# SCS select G1 = line-graphic: esc ) 0 -# Select 7-bit C1 controls: esc sp F -# Select 8-bit C1 controls: esc sp G -# Select cursor home: csi H -# Select erase screen: csi J -# SM KAM lock keyboard: csi 2 h -# RM KAM unlock keyboard: csi 2 l -# SM SRM local echo off: csi 1 2 h -# RM SRM local echo on: csi 1 2 l -# SM LNM New line : csi 2 0 h -# RM LNM return = CR only: csi 2 0 l -# SM DECCKM cursor keys mode: csi ? 1 h -# RM DECCKM appli. keys mode: csi ? 1 l -# SM DECANM ANSI mode on: csi ? 2 h -# RM DECANM ANSI mode off: csi ? 2 l -# SM DECCOLM 132-column screen: csi ? 3 h -# RM DECCOLM 80-column screen: csi ? 3 l -# SM DECSCLM Smooth scroll: csi ? 4 h -# RM DECSCLM Jump scroll: csi ? 4 l -# SM DECSCNM screen light backgr. csi ? 5 h -# RM DECSCNM screen dark backgr. csi ? 5 l -# SM DECOM move within margins: csi ? 6 h -# RM DECOM move outside margins: csi ? 6 l -# SM DECAWM auto right margin: csi ? 7 h -# RM DECAWM auto right margin: csi ? 7 l -# SM DECARM auto repeat: csi ? 8 h -# RM DECARM auto repeat: csi ? 8 l -# DECSASD Select active main: csi 0 $ } -# DECSASD Select active status: csi 1 $ } -# DECSSDT Select status none: csi 0 $ ~ -# DECSSDT Select status indic.: csi 1 $ ~ -# DECSSDT Select status host-wr: csi 2 $ ~ -# SM DECTCEM Visible cursor: csi ? 2 5 h -# RM DECTCEM Invisible cursor: csi ? 2 5 l -# SM DECNCRM 7 bits NCR set: csi ? 4 2 h -# RM DECNCRM Multi or ISO latin: csi ? 4 2 l -# DECSCL vt300 mode 8-bit ctrl: csi 6 3 " p -# or DECSCL vt300 mode 8-bit ctrl: csi 6 3 ; 0 " p -# DECSCL vt300 mode 7-bit ctrl: csi 6 3 ; 1 " p -# Char. and Line attributes: csi Ps ... Ps m -# with: 0 All off, 1 Bold, 4 Underline, 5 Blinking, 7 Reverse -# and : 22 Bold off, 24 Underline off, 25 Blinking off, 27 Reverse off -# (bq300-8: :le:,:nd:,:up:,:do:,:dl:,:al: to get under 1024 --esr) -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -bq300-8|Bull vt320 full 8 bits 80 columns:\ - :am:eo:es:hs:km:mi:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:ws#80:\ - :AL=\233%dL:DC=\233%dP:DL=\233%dM:DO=\233%dB:IC=\233%d@:\ - :K1=\217w:K2=\217u:K3=\217y:K4=\217q:K5=\217s:LE=\233%dD:\ - :RI=\233%dC:UP=\233%dA:ae=^O:as=^N:bl=^G:cd=\233J:ce=\233K:\ - :cl=\233H\233J:cm=\233%i%d;%dH:cr=^M:cs=\233%i%d;%dr:\ - :ct=\2333g:dc=\233P:ds=\2331$}\2332$~\n\2330$}:\ - :ec=\233%dX:ei=\2334l:fs=\2330$}:ho=\233H:\ - :i1=\E[63;2"p\E[2h:i2=\2330$}\233?25h\2332l\233H\233J:\ - :im=\2334h:\ - :is=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l:\ - :k1=\217P:k2=\217Q:k3=\217R:k4=\217S:k6=\23317~:\ - :k7=\23318~:k8=\23319~:k9=\23320~:kD=\2333~:kI=\2332~:\ - :kN=\2336~:kP=\2335~:kb=^H:kd=\233B:ke=\233?1l\E>:\ - :kl=\233D:kr=\233C:ku=\233A:mb=\2335m:md=\2331m:\ - :me=\2330m\E(B:mr=\2337m:nw=\EE:rc=\E8:sc=\E7:se=\23327m:\ - :sf=\ED:so=\2337m:sr=\EM:st=\EH:ta=^I:te=\233?7h:\ - :ti=\233?7l\233?1l\E(B:ts=\2331$}\2332$~:ue=\23324m:\ - :us=\2334m:vb=\233?5h\233?5l:ve=\233?25h:vi=\233?25l:\ - :vs=\233?25h: -bq300-8rv|Bull vt320 8-bit reverse mode 80 columns:\ - :is=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l:\ - :vb=\233?5l\233?5h:\ - :tc=bq300-8: -bq300-8w|Bull vt320 8-bit 132 columns:\ - :co#132:ws#132:\ - :is=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l:\ - :r2=\233?3h:\ - :tc=bq300-8: -bq300-w-8rv|Bull vt320 8-bit reverse mode 132 columns:\ - :co#132:ws#132:\ - :is=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l:\ - :r2=\233?3h:vb=\233?5l\233?5h:\ - :tc=bq300-8: - -# This entry is used for terminals with vt320 emulation mode -# a 102 keys keyboard (PC scancode !) and following set-up : -# 8 bit ISO Latin Character Set (ISO 8859-1), -# 7 bit Control Characters, -# 80 columns screen. -bq300-pc|Questar 303 with PC keyboard ISO Latin 1 80 columns:\ - :%0@:%1@:*6@:@0@:@7=\E[4~:F1=\E[29~:F2=\E[31~:F3@:F4@:F5@:F6@:\ - :F7@:F8@:F9@:FA@:k1=\E[17~:k2=\E[18~:k3=\E[19~:k4=\E[20~:\ - :k5=\E[21~:k6=\E[23~:k7=\E[24~:k8=\E[25~:k9=\E[26~:\ - :k;=\E[28~:kD=\E[3~:kI=\E[2~:kN=\E[6~:kP=\E[5~:kb=^H:\ - :kh=\E[1~:l1@:l2@:l3@:l4@:\ - :tc=bq300: -bq300-pc-rv|Questar 303 with PC keyboard reverse mode 80 columns:\ - :is=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l:\ - :vb=\E[?5l\E[?5h:\ - :tc=bq300-pc: -bq300-pc-w|Questar 303 with PC keyboard 132 columns terminal:\ - :co#132:ws#132:\ - :is=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l:\ - :r2=\E[?3h:\ - :tc=bq300-pc: -bq300-pc-w-rv|Questar 303 with PC keyboard reverse mode 132 columns:\ - :co#132:ws#132:\ - :is=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E F\E[?42l\E[?4l:\ - :r2=\E[?3h:vb=\E[?5l\E[?5h:\ - :tc=bq300-pc: -# 8 bit ISO Latin Character Set (ISO 8859-1), -# 8 bit Control Characters, -# 80 columns screen. -bq300-8-pc|Q306-8-pc|Questar 303 with PC keyboard in full 8 bits 80 columns:\ - :%0@:%1@:*6@:@0@:@7=\2334~:F1=\23329~:F2=\23331~:F3@:F4@:F5@:\ - :F6@:F7@:F8@:F9@:FA@:k1=\23317~:k2=\23318~:k3=\23319~:\ - :k4=\23320~:k5=\23321~:k6=\23323~:k7=\23324~:k8=\23325~:\ - :k9=\23326~:k;=\23328~:kD=\2333~:kI=\2332~:kN=\2336~:\ - :kP=\2335~:kb=^H:kh=\2331~:l1@:l2@:l3@:l4@:\ - :tc=bq300-8: -bq300-8-pc-rv|Questar 303 with PC keyboard full 8 bits reverse mode 80 columns:\ - :is=\E[?2h\E[?3l\E[?5h\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l:\ - :vb=\E[?5l\E[?5h:\ - :tc=bq300-8-pc: -bq300-8-pc-w|Questar 303 with PC keyboard full 8 bits 132 columns:\ - :co#132:ws#132:\ - :is=\E[?2h\E[?3h\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l:\ - :r2=\E[?3h:\ - :tc=bq300-8-pc: -bq300-8-pc-w-rv|Questar 303 with PC keyboard full 8 bits reverse 132 columns:\ - :co#132:ws#132:\ - :is=\E[?2h\E[?3h\E[?5h\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l:\ - :r2=\E[?3h:vb=\E[?5l\E[?5h:\ - :tc=bq300-8-pc: - -#======================================================# -# BULL QUESTAR 310 `VIP 7800/8800' terminals emulation # -#======================================================# - -# normal mode, 8 bits, 80 columns terminal. -# RES reset : ^[e -# RIS reset initial state: ^[c -# BLE bell enable ^[h -# BLD bell disable ^[g -# CAMS char. attr. mode set ^[[D -# CAMR char. attr. mode reset ^[[G -# CLR clear ^[` -# KBU keyboard unlock (set) ^[[W -# KBL keyboard lock (reset) ^[[X -# CM character mode (async.) ^[k -# NEP non echoplex mode (by host) ^[l -# EP echoplex mode (by host) ^[m -# IM insert mode set ^[[I -# IM insert mode reset ^[[J -# RMS roll mode set ^[r -# RMR roll mode reset ^[q -# SM78 set mode vip7800 ^[[1q -# SD scroll up (72 lines) ^[[0s -# SD scroll down (72 lines) ^[[1s -# RBM block mode reset ^[[E -# SLS status line set ^[w -# SLR status line reset ^[v -# SLL status line lock ^[O -# LGS Line-graphic mode set ^[G -# LGR Line-graphic mode reset ^[F -# TBC tab clear (at cursor pos.) ^[[g -# TBI tab initialize ^[[N -# TBS tab set (at cursor pos.) ^[p -# PDS print data space ^[[0p -# PHD print host data ^[[3p -# PDT print data terminator ^[[

u -# SSP0 partition 0 set ^[[00u -# SSP1 partition n format 1 ^[[PnPnSTRINGu -# SSP2 partition n format 2 ^[[PnPnSTRINGu -# SSP3 partition n format 3 ^[[PnPnu -# ATR attribute (visual) -# blink : ^[sB -# dim : ^[sL -# hide (blank) : ^[sH -# restore : ^[sR -# inverse video : ^[sI -# prot. : ^[sP -# underline : ^[s_ -# reset : ^{ -# -# This covers the vip7800 and BQ3155-vip7800 -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -vip|Bull Questar 3155-7800:\ - :am:es:hs:km:ms:xn:xo:\ - :co#80:it#8:li#24:vt#3:ws#80:\ - :ae=\EF:as=\EG:bl=^G:bt=\E[Z:cd=\EJ:ce=\EK:cl=\E`:\ - :cm=\E[%i%03%03f:cr=^M:ct=\E[N:dc=\E[P:dl=\E[M:do=^J:\ - :ds=\Ev:ei=\E[J:fs=\EO:ho=\EH:i2=\Er\E[W\E`:ic=\E[I:\ - :im=\E[I:is=\E[00u\E[<>001001024080024080u\E[01u:\ - :k1=\E0:k2=\E2:k3=\E6:k4=\E8:k5=\E\072:k6=\E<:k7=\E>:k8=\EP:\ - :k9=\ER:kD=\E[P:kH=\EH\EA:kI=\E[I:kb=^H:kd=\EB:kh=\EH:\ - :kl=\ED:kr=\EC:ku=\EA:le=^H:ll=\EH\EA:mb=\EsB:\ - :me=\EsR\EsU\EF:mh=\EsL:mr=\EsI:nd=\EC:nw=^M:se=\EsR:sf=^J:\ - :so=\EsI:sr=\EA\EJ\EH\E[L:st=\Ep:ta=^I:ts=\Ew:ue=\EsR:\ - :up=\EA:us=\Es_:vb=\007\007\007: -# normal screen, 8 bits, 132 columns terminal. -vip-w|vip7800-w|Q310-vip-w|Q310-vip-w-am|Questar 3155-vip7800 wide:\ - :co#132:ws#132:\ - :is=\E[00u\E[<>001001024132024132u\E[01u:tc=vip: -vip-H|vip7800-H|Q310-vip-H|Q310-vip-H-am|Questar 3155-vip7800 72 lines:\ - :li#72:\ - :is=\E[00u\E[<>001001024080072080u\E[01u:tc=vip: -vip-Hw|vip7800-Hw|Q310-vip-Hw|Questar 3155-vip7800 wide 72 lines:\ - :co#132:li#72:ws#132:\ - :is=\E[00u\E[<>001001024132072132u\E[01u:tc=vip: -#### Chromatics -# - -# I have put the long strings in :ti:/:te:. Ti sets up a window -# that is smaller than the screen, and puts up a warning message -# outside the window. Te erases the warning message, puts the -# window back to be the whole screen, and puts the cursor at just -# below the small window. I defined :ve: and :vi: to really turn -# the cursor on and off, but I have taken this out since I don't -# like the cursor being turned off when vi exits. -cg7900|chromatics|chromatics 7900:\ - :am:\ - :co#80:li#40:\ - :al=^A>2:bl=^G:cd=^Al:ce=^A`:cl=^L:cm=\001M%r%d\054%d\054:\ - :cr=^M:dc=^A<1:dl=^A<2:do=^J:ei=:ho=^\:ic=^A>1:im=:le=^H:\ - :ll=^A|:nd=^]:se=\001C1\054\001c2\054:sf=^J:\ - :so=\001C4\054\001c7\054:\ - :te=\001W0\05440\05485\05448\054\014\001W0\0540\05485\05448\054\001M0\05440\054:\ - :ti=\001P0\001O1\001R1\001C4\054\001c0\054\014\001M0\05442\054WARNING DOUBLE ENTER ESCAPE and \025\001C1\054\001c2\054\001W0\0540\05479\05439\054:\ - :uc=\001\001_\001\0:up=^K: - -#### Computer Automation -# - -ca22851|computer automation 22851:\ - :am:\ - :co#80:li#24:\ - :bl=^G:cd=^\:ce=^]:cl=\014:cm=\002%i%.%.:cr=^M:do=^J:ho=^^:\ - :kd=^W:kh=^^:kl=^U:ku=^V:le=^U:nd=^I:sf=^J:up=^V: - -#### Cybernex -# - -# This entry has correct padding and the undocumented "ri" capability -cyb83|xl83|cybernex xl-83:\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cd=\020:ce=\017:cl=\014:cm=\027%+ %+ :cr=^M:do=^J:\ - :ho=^K:kd=^J:kl=^H:kr=^I:ku=^N:le=^H:nd=^I:sf=^J:sr=^N:up=^N: -# (mdl110: removed obsolete ":ma=^Z^P:" and overridden ":cd=145^NA^W:" -- esr) -cyb110|mdl110|cybernex mdl-110:\ - :am:bs:\ - :co#80:li#24:\ - :al=\016A\016\035:bl=^G:cd=\016@\026:ce=\016@\026:\ - :cl=\030:cm=\020%+ %+ :cr=^M:dc=\016A\036:\ - :dl=\016A\016\036:do=^J:ei=:ho=^Y:ic=\016A\035:im=:le=^H:\ - :nd=^U:se=^NG:sf=^J:so=^NF:ta=\011:up=^Z: - -#### Datapoint -# -# Datapoint is gone. They used to be headquartered in Texas. -# They created ARCnet, an Ethernet competitor that flourished for a while -# in the early 1980s before 3COM got wise and cut its prices. The service -# side of Datapoint still lives (1995) in the form of Intelogic Trace. -# - -dp3360|datapoint|datapoint 3360:\ - :am:bs:\ - :co#82:li#25:\ - :bl=^G:cd=^_:ce=^^:cl=^]^_:cr=^M:do=^J:ho=^]:le=^H:nd=^X:\ - :sf=^J:up=^Z: - -# From: Jan Willem Stumpel , 11 May 1997 -# The Datapoint 8242 Workstation was sold at least between 1985 -# and 1989. To make the terminal work with this entry, press -# CONTROL-INT-INT to take the terminal off-line, and type (opt). -# Set the options AUTO ROLL, ROLL DN, and ESC KBD on, and AUTO -# CR/LF off. Use control-shift-[] as escape key, control-I as tab, -# shift-F1 to shift-F5 as F6 to F10 (unshifted F1 to F5 are in -# fact unusable because the strings sent by the terminal conflict -# with other keys). -# The terminal is capable of displaying "box draw" characters. -# For each graphic character you must send 2 ESC's (\E\E) followed -# by a control character as follows: -# character meaning -# ========= ======= -# ctrl-E top tee -# ctrl-F right tee -# ctrl-G bottom tee -# ctrl-H left tee -# ctrl-I cross -# ctrl-J top left corner -# ctrl-K top right corner -# ctrl-L bottom left corner -# ctrl-M bottom right corner -# ctrl-N horizontal line -# ctrl-O vertical line -# Unfortunately this cannot be fitted into the termcap/terminfo -# description scheme. -dp8242|datapoint 8242:\ - :ms:\ - :co#80:li#25:\ - :al=\E^T:bl=^G:cd=^W:ce=^V:cl=\025\E\004\027\030:\ - :cm=\011%r%+\%+\:cr=^M:dl=\E^Z:do=^J:ho=^U:\ - :i1=\E\014\E\016\0\230\0\317\025\027\030\E\004:\ - :k1=^G\Ee:k2=^I\Ed:k3=^J\Ec:k4=^J\Eb:k5=^S\Ea:k6=\EO\Ee:\ - :k7=\EN\Ed:k8=\EM\Ec:k9=\EL\Eb:k;=\EK\Ea:kb=^H:kd=^B:kl=^D:\ - :kr=^F:ku=^E:le=^H:nw=^M^J:\ - :r1=\E\014\E\016\0\230\0\317\025\027\030\E\004:\ - :rp=\E\023%.%.:se=\E^D:sf=^C:so=\E^E:sr=^K:ta=^I:ue=\E^D:\ - :us=\E^F:ve=^X:vi=^Y:\ - :..wi=\E\014\E\016%p1%'\0'%+%c%p2%'\0'%+%c%p3%'\0'%+%c%p4%'\0'%+%c\025: - -#### DEC terminals (Obsolete types: DECwriter and vt40/42/50) -# -# These entries are DEC's official terminfos for its older terminals. -# Contact Bill Hedberg of Terminal Support -# Engineering for more information. Updated terminfos and termcaps -# are kept available at ftp://gatekeeper.dec.com/pub/DEC/termcaps. -# - -gt40|dec gt40:\ - :bs:os:\ - :co#72:li#30:\ - :bl=^G:cr=^M:do=^J:le=^H: -gt42|dec gt42:\ - :bs:os:\ - :co#72:li#40:\ - :bl=^G:cr=^M:do=^J:le=^H: - -vt50|dec vt50:\ - :bs:\ - :co#80:li#12:\ - :bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cr=^M:do=^J:le=^H:nd=\EC:\ - :sf=^J:ta=^I:up=\EA: -vt50h|dec vt50h:\ - :bs:\ - :co#80:li#12:\ - :bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :cr=^M:do=^J:\ - :le=^H:nd=\EC:sf=^J:sr=\EI:ta=^I:up=\EA: -# (/:ae:/:as: capabilities aren't in DEC's official entry -- esr) -vt52|dec vt52:\ - :bs:\ - :co#80:it#8:li#24:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\EG:as=\EF:bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :\ - :cr=^M:do=\EB:ho=\EH:kb=^H:kd=\EB:kl=\ED:kr=\EC:ku=\EA:\ - :le=\ED:nd=\EC:nw=^M^J:sf=^J:sr=\EI:ta=^I:up=\EA: - -# (vt61: there's a BSD termcap that claims :dl=\EPd:, :al=\EPf.: :kb=^H:) -vt61|vt-61|vt61.5|dec vt61:\ - :co#80:li#24:\ - :bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :cr=\r:do=^J:\ - :kd=\EB:kl=\ED:kr=\EC:ku=\EA:le=^H:nd=\EC:sf=\n:sr=\EI:ta=^I:\ - :up=\EA: - -# The gigi does standout with red! -# (gigi: I added / based on the init string, corrected cub1 -- esr) -gigi|vk100|dec gigi graphics terminal:\ - :am:bs:xn:\ - :co#84:li#24:\ - :DO=\E[%dB:LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:\ - :UP=\E[%dA:bl=^G:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:do=^J:\ - :is=\E>\E[?3l\E[?4l\E[?5l\E[?20l\E[?7h\E[?8h:k1=\EOP:\ - :k2=\EOQ:k3=\EOR:k4=\EOS:kd=\EOB:ke=\E[?1l\E>:kh=\E[H:\ - :kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:me=\E[m:\ - :nd=\E[C:se=\E[m:sf=^J:so=\E[7;31m:sr=\EM:ta=^I:ue=\E[m:\ - :up=\E[A:us=\E[4m: - -# DEC PRO-350 console (VT220-style). The 350 was DEC's attempt to produce -# a PC differentiated from the IBM clones. It was a total, ludicrous, -# grossly-overpriced failure (among other things, DEC's OS didn't include -# a format program, so you had to buy pre-formatted floppies from DEC at -# a hefty premium!). -pro350|decpro|dec pro console:\ - :bs:\ - :co#80:it#8:li#24:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\EG:as=\EF:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :do=\EB:\ - :ho=\EH:k0=\EE:k1=\EF:k2=\EG:k3=\EH:k4=\EI:k5=\EJ:k6=\Ei:\ - :k7=\Ej:kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:le=^H:nd=\EC:\ - :se=\E^N:so=\E^H:sr=\EI:ta=^I:ue=\E^C:up=\EA:us=\E^D: - -dw1|decwriter I:\ - :bs:hc:os:\ - :co#72:\ - :bl=^G:cr=^M:do=^J:le=^H:sf=^J: -dw2|decwriter|dw|decwriter II:\ - :bs:hc:os:\ - :co#132:\ - :bl=^G:cr=^M:do=^J:kb=^H:le=^H:sf=^J: -# \E(B Use U.S. character set (otherwise # => british pound !) -# \E[20l Disable "linefeed newline" mode (else puts \r after \n,\f,\v) -# \E[w 10 char/in pitch -# \E[1;132 full width horizontal margins -# \E[2g clear all tab stops -# \E[z 6 lines/in -# \E[66t 66 lines/page (for \f) -# \E[1;66r full vertical page can be printed -# \E[4g clear vertical tab stops -# \E> disable alternate keypad mode (so it transmits numbers!) -# \E[%i%p1%du set tab stop at column %d (origin == 1) -# (Full syntax is \E[n;n;n;n;n;...;nu where each 'n' is -# a tab stop) -# -# The dw3 does standout with wide characters. -# -dw3|la120|decwriter III:\ - :bs:hc:os:\ - :co#132:\ - :bl=^G:cr=^M:do=^J:\ - :i1=\E(B\E[20l\E[w\E[0;132s\E[2g\E[z\E[66t\E[1;66r\E[4g\E>:\ - :is=\E[9;17;25;33;41;49;57;65;73;81;89;97;105;113;121;129u\r:\ - :kb=^H:le=^H:me=\E[w:se=\E[w:sf=^J:so=\E[6w:ta=^I: -dw4|decwriter IV:\ - :am:bs:hc:os:\ - :co#132:\ - :bl=^G:cr=^M:do=^J:is=\Ec:k0=\EOP:k1=\EOQ:k2=\EOR:k3=\EOS:\ - :kb=^H:le=^H:sf=^J:ta=^I: - -# These aren't official -ln03|dec ln03 laser printer:\ - :hc:\ - :co#80:li#66:\ - :bl=^G:cr=^M:do=^J:hd=\EK:hu=\EL:me=\E[m:nw=^M^J:se=\E[22m:\ - :sf=^J:so=\E[1m:ta=^I:ue=\E[24m:us=\E[4m: -ln03-w|dec ln03 laser printer 132 cols:\ - :co#132:\ - :bl=^G:cr=^M:do=^J:kb=^H:kd=^J:kl=^H:nw=^M^J:sf=^J:ta=^I:tc=ln03: - -#### Delta Data (dd) -# - -# Untested. The cup sequence is hairy enough that it probably needs work. -# The idea is ctrl(O), dd(row), dd(col), where dd(x) is x - 2*(x%16) + '9'. -# There are BSD-derived termcap entries floating around for this puppy -# that are *certainly* wrong. -delta|dd5000|delta data 5000:\ - :am:bs:\ - :co#80:li#27:\ - :bl=^G:ce=^NU:cl=^NR:cm=\017%+^P%+^P:dc=^NV:do=^J:ho=^NQ:\ - :le=^H:nd=^Y:sf=^J:up=^Z: - -#### Digital Data Research (ddr) -# - -# (ddr: I added / based on the init string -- esr) -ddr|rebus3180|ddr3180|Rebus/DDR 3180 vt100 emulator:\ - :am:bs:xn:\ - :co#80:it#8:li#24:vt#3:\ - :RA=\E[7l:SA=\E[7l:cd=50\E[J:ce=3\E[K:cl=50\E[H\E[2J:\ - :cm=5\E[%i%d;%dH:cs=\E[%i%d;%dr:do=^J:ho=\E[H:\ - :is=\E[1;24r\E[24;1H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :kb=^H:kd=\E[B:ke=\E[?1l\E>:kl=\E[D:kr=\E[C:ks=\E[?1h\E=:\ - :ku=\E[A:le=^H:mb=2\E[5m:md=2\E[1m:me=2\E[m:mr=2\E[7m:\ - :nd=2\E[C:r1=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:rc=\E8:\ - :rf=/usr/share/tabset/vt100:sc=\E7:se=\E[m:sf=5\ED:\ - :so=\E[7m:sr=5\EM:ta=^I:ue=2\E[m:up=2\E[A:us=2\E[4m: - -#### Evans & Sutherland -# - -# Jon Leech tells us: -# The ps300 was the Evans & Sutherland Picture System 300, a high -# performance 3D vector graphics system with a bunch of specialized hardware. -# Approximate date of release was 1982 (early 80s, anyway), and it had several -# evolutions including (limited) color versions such as the PS330C. PS300s -# were effectively obsolete by the late 80s, replaced by raster graphics -# systems, although specialized applications like molecular modelling -# hung onto them for a while longer. AFAIK all E&S vector graphics systems -# are out of production, though of course E&S is very much alive (in 1996). -# (ps300: changed ":pt@:" to "it@" -- esr) -# -ps300|Picture System 300:\ - :xt:\ - :it@:\ - :se@:so@:ue@:us@:tc=vt100: - -#### General Electric (ge) -# - -terminet1200|terminet300|tn1200|tn300|terminet|GE terminet 1200:\ - :bs:hc:os:\ - :co#120:\ - :bl=^G:cr=^M:do=^J:sf=^J: - -#### Heathkit/Zenith -# - -# Here is a description of the H19 DIP switches: -# -# S401 -# 0-3 = baud rate as follows: -# -# 3 2 1 0 -# --- --- --- --- -# 0 0 1 1 300 baud -# 0 1 0 1 1200 baud -# 1 0 0 0 2400 baud -# 1 0 1 0 4800 baud -# 1 1 0 0 9600 baud -# 1 1 0 1 19.2K baud -# -# 4 = parity (0 = no parity) -# 5 = even parity (0 = odd parity) -# 6 = stick parity (0 = normal parity) -# 7 = full duplex (0 = half duplex) -# -# S402 -# 0 = block cursor (0 = underscore cursor) -# 1 = no key click (0 = keyclick) -# 2 = wrap at end of line (0 = no wrap) -# 3 = auto LF on CR (0 = no LF on CR) -# 4 = auto CR on LF (0 = no CR on LF) -# 5 = ANSI mode (0 = VT52 mode) -# 6 = keypad shifted (0 = keypad unshifted) -# 7 = 50Hz refresh (1 = 60Hz refresh) -# -# Factory Default settings are as follows: -# 7 6 5 4 3 2 1 0 -# S401 1 0 0 0 1 1 0 0 -# S402 0 0 0 0 0 0 0 0 -# (h19: I added / based on the init string; -# also added empty to suppress a tic warning -- esr) -h19-a|h19a|heath-ansi|heathkit-a|heathkit h19 ansi mode:\ - :am:bs:mi:ms:\ - :co#80:it#8:li#24:\ - :RA=\E[?7l:SA=\E[?7h:ac=:ae=\E[11m:al=\E[1L:as=\E[10m:\ - :bl=^G:cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :dc=\E[1P:dl=\E[1M:do=\E[1B:ei=\E[4l:ho=\E[H:im=\E[4h:\ - :is=\E<\E[>1;2;3;4;5;6;7;8;9l\E[m\E[11m\E[?7h:k1=\EOS:\ - :k2=\EOT:k3=\EOU:k4=\EOV:k5=\EOW:k6=\EOP:k7=\EOQ:k8=\EOR:\ - :kb=^H:kd=\E[1B:kh=\E[H:kl=\E[1D:kr=\E[1C:ku=\E[1A:l6=blue:\ - :l7=red:l8=white:le=^H:nd=\E[1C:se=\E[m:sf=^J:so=\E[7m:\ - :sr=\EM:ta=^I:up=\E[1A:ve=\E[>4l:vs=\E[>4h: -h19-bs|heathkit w/keypad shifted:\ - :ke=\Eu:ks=\Et:tc=h19-b: -h19-us|h19us|h19-smul|heathkit w/keypad shifted/underscore cursor:\ - :ke=\Eu:ks=\Et:\ - :tc=h19-u: -# (h19: merged in :ip: from BSDI hp19-e entry>; -# also added empty to suppress a tic warning --esr) -# From: Tim Pierce , 23 Feb 1998 -# Tim tells us that: -# I have an old Zenith-19 terminal at home that still gets a lot of use. -# This terminal suffers from the same famous insert-mode padding lossage -# that has been acknowledged for the Z29 terminal. Emacs is nearly -# unusable on this box, since even a half-scroll up or down the window -# causes flaming terminal death. -# -# On the Z19, the only way I have found around this problem is to remove -# the :al: and :dl: entries entirely. No amount of extra padding will -# help (I have tried up to 20000). Removing :al=\EL$: and :dl=\EM$: -# makes Emacs a little slower, but it remains in the land of the living. -# Big win. -h19|heath|h19-b|heathkit|heath-19|z19|zenith|heathkit h19:\ - :am:bs:es:hs:mi:ms:\ - :co#80:it#8:li#24:\ - :ac=:ae=\EG:as=\EF:bl=^G:cd=\EJ:ce=\EK:cl=\EE:cm=\EY%+ %+ :\ - :cr=^M:dc=\EN:do=\EB:ei=\EO:fs=\Ek\Ey5:ho=\EH:im=\E@:\ - :ip=1.5<1.5/>:k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:k6=\EP:\ - :k7=\EQ:k8=\ER:kb=^H:kd=\EB:kh=\EH:kl=\ED:kr=\EC:ku=\EA:\ - :l6=blue:l7=red:l8=white:le=^H:nd=\EC:se=\Eq:sf=^J:so=\Ep:\ - :sr=\EI:ta=^I:ts=\Ej\Ex5\EY8%p1%{32}%+%c\Eo\Eo:up=\EA:\ - :ve=\Ey4:vs=\Ex4: -h19-u|heathkit with underscore cursor:\ - :ve@:vs@:tc=h19-b: -h19-g|h19g|heathkit w/block cursor:\ - :ve=\Ex4:tc=h19-b: -alto-h19|altoh19|altoheath|alto-heath|alto emulating heathkit h19:\ - :li#60:\ - :al=\EL:dl=\EM:tc=h19: - -# The major problem with the Z29 is that it requires more padding than the Z19. -# -# The problem with declaring an H19 to be synonymous with a Z29 is that -# it needs more padding. It especially loses if a program attempts -# to put the Z29 into insert mode and insert text at 9600 baud. It -# even loses worse if the program attempts to insert tabs at 9600 -# baud. Adding padding to text that is inserted loses because in -# order to make the Z29 not die, one must add so much padding that -# whenever the program tries to use insert mode, the effective -# rate is about 110 baud. -# -# What program would want to put the terminal into insert mode -# and shove stuff at it at 9600 baud you ask? -# -# Emacs. Emacs seems to want to do the mathematically optimal -# thing in doing a redisplay rather than the practical thing. -# When it is about to output a line on top of a line that is -# already on the screen, instead of just killing to the end of -# the line and outputting the new line, it compares the old line -# and the new line and if there are any similarities, it -# constructs the new line by deleting the text on the old line -# on the terminal that is already there and then inserting new -# text into the line to transform it into the new line that is -# to be displayed. The Z29 does not react kindly to this. -# -# But don't cry for too long.... There is a solution. You can make -# a termcap entry for the Z29 that says the Z29 has no insert mode. -# Then Emacs cannot use it. "Oh, no, but now inserting into a -# line will be really slow", you say. Well there is a sort of a -# solution to that too. There is an insert character option on -# the Z29 that will insert one character. Unfortunately, it -# involves putting the terminal into ansi mode, inserting the -# character, and changing it back to H19 mode. All this takes 12 -# characters. Pretty expensive to insert one character, but it -# works. Either Emacs doesn't try to use its inserting hack when -# it's only given an insert character ability or the Z29 doesn't -# require padding with this (the former is probably more likely, -# but I haven't checked it out). -# (z29: added empty to suppress a tic warning, merged in -# status line capabilities from BRL entry --esr) -z29|zenith29|z29b|zenith z29b:\ - :am:bs:es:hs:mi:ms:pt:\ - :co#80:kn#10:li#24:\ - :ac=:ae=\EF:al=1\EL:as=\EG:bc=\ED:bl=^G:bt=\E-:cd=\EJ:ce=\EK:\ - :cl=\EE:cm=\EY%+ %+ :cr=^M:dc=\EN:dl=1\EM:do=\EB:ds=\Ey1:\ - :ei=\EO:fs=\Ek\Ey5:ho=\EH:ic=\E<\E[1@\E[?2h:im=\E@:\ - :is=\E<\E[?2h\Ev:k0=\E~:k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:\ - :k6=\EP:k7=\EQ:k8=\ER:k9=\E0I:kb=^H:kd=\EB:kh=\EH:kl=\ED:\ - :kr=\EC:ku=\EA:l0=home:le=^H:nd=\EC:se=\Eq:sf=\n:so=\Ep:\ - :sr=2\EI:ta=^I:ts=\Ej\Ex5\Ex1\EY8%+ \Eo:ue=\Es0:up=\EA:\ - :us=\Es8:ve=\Ey4:vs=\Ex4: -# z29 in ansi mode. Assumes that the cursor is in the correct state, and that -# the world is stable. causes the terminal to be reset to the state -# indicated by the name. kc -> key click, nkc -> no key click, uc -> underscore -# cursor, bc -> block cursor. -# From: Mike Meyers -# (z29a: replaced nonexistent :if=/usr/share/tabset/zenith29: befause :st: -# looks vt100-compatible -- esr) -z29a|z29a-kc-bc|h29a-kc-bc|heath/zenith 29 in ansi mode:\ - :am:bs:es:hs:mi:ms:pt:\ - :co#80:it#8:kn#10:li#24:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:bc=\ED:bl=^G:cd=\E[J:ce=\E[K:cl=\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[1P:\ - :do=^J:ds=\E[>1l:fs=\E[u\E[>5l:ho=\E[H:\ - :if=/usr/share/tabset/vt100:k0=\E[~:k1=\EOS:k2=\EOT:\ - :k3=\EOU:k4=\EOV:k5=\EOW:k6=\EOP:k7=\EOQ:k8=\EOR:k9=\EOX:\ - :kC=\E[J:kS=\E[J:kb=^H:kd=\EOB:kh=\E[H:kl=\EOD:kr=\EOC:\ - :ku=\EOA:l0=help:le=^H:mb=\E[5m:md=\E[2m:me=\E[m:mh=\E[2m:\ - :mr=\E[7m:nd=\E[C:nw=^M\ED:ps=\E#7:\ - :r1=\E<\E[1;24r\E[24;1H\E[?7h\E[>4h\E[>1;2;3;5;6;7;8;9l\E[m\E[11m:\ - :rc=\E[r:sc=\E[s:se=\E[m:sf=\ED:so=\E[7;2m:sr=\EM:st=\EH:\ - :ta=^I:te=\E[?7h:ti=\E[?7l:\ - :ts=\E[s\E[>5;1h\E[25;%i%dH\E[1K:ue=\E[m:up=\E[A:\ - :us=\E[4m: -z29a-kc-uc|h29a-kc-uc|z29 ansi mode with keyckick and underscore cursor:\ - :r1=\E<\E[1;24r\E[24;1H\E[?7h\E[>1;2;3;4;5;6;7;8;9l\E[m\E[11m:\ - :tc=z29a: -z29a-nkc-bc|h29a-nkc-bc|z29 ansi mode with block cursor and no keyclick:\ - :r1=\E<\E[1;24r\E[24;1H\E[?7h\E[>2;4h\E[>1;3;5;6;7;8;9l\E[m\E[11m:\ - :tc=z29a: -z29a-nkc-uc|h29a-nkc-uc|z29 ansi mode with underscore cursor and no keyclick:\ - :r1=\E<\E[1;24r\E[24;1H\E[?7h\E[>2h\E[>1;3;4;5;6;7;8;9l\E[m\E[11m:\ - :tc=z29a: -# From: Jeff Bartig 31 Mar 1995 -z39-a|z39a|zenith39-a|zenith39-ansi|Zenith 39 in ANSI mode:\ - :5i:am:es:hs:mi:ms:xo:\ - :co#80:li#24:\ - :%1=\E[~:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:K1=\EOw:\ - :K2=\EOy:K3=\EOu:K4=\EOq:K5=\EOs:LE=\E[%dD:RI=\E[%dC:\ - :UP=\E[%dA:ac=0a``aaffggjjkkllmmnnooqqssttuuvvwwxx~~:\ - :ae=\E(B:al=\E[1L:as=\E(0:bl=^G:bt=\E[1Z:cb=\E[1K:cd=\E[0J:\ - :ce=\E[0K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:ct=\E[3g:dc=\E[1P:dl=\E[1M:do=\E[B:\ - :ds=\E[>1l:ei=\E[4l:fs=\E[u:ho=\E[H:im=\E[4h:\ - :is=\E<\E[>1;3;5;6;7l\E[0m\E[2J:k1=\EOS:k2=\EOT:k3=\EOU:\ - :k4=\EOV:k5=\EOW:k6=\EOP:k7=\EOQ:k8=\EOR:k9=\EOX:kS=\E[J:\ - :kb=^H:kd=\E[B:ke=\E[>7l:kh=\E[H:kl=\E[D:kr=\E[C:ks=\E[>7h:\ - :ku=\E[A:le=^H:ll=\E[24;1H:mb=\E[5m:md=\E[1m:me=\E[0m:\ - :mh=\E[2m:mr=\E[7m:nd=\E[C:pf=\E[4i:po=\E[5i:\ - :ps=\E[?19h\E[i:r2=\E<\Ec\0:rc=\E[u:sc=\E[s:se=\E[0m:\ - :sf=^J:so=\E[7m:st=\EH:ta=^I:ts=\E[s\E[>1h\E[25;%i%p1%dH:\ - :ue=\E[0m:up=\E[A:us=\E[4m:ve=\E[>5l:vi=\E[>5h: - -# From: Brad Brahms -z100|h100|z110|z-100|h-100|heath/zenith z-100 pc with color monitor:\ - :ve=\Ey4\Em70:vs=\Ex4\Em71:\ - :tc=z100bw: -# (z100bw: removed obsolete ":kn#10:", added empty -- esr) -z100bw|h100bw|z110bw|z-100bw|h-100bw|heath/zenith z-100 pc:\ - :bs:mi:ms:pt:\ - :co#80:it#8:kn#10:li#24:\ - :ac=:ae=\EG:al=5*\EL:as=\EF:cd=\EJ:ce=\EK:cl=5*\EE:\ - :cm=1*\EY%+ %+ :dc=1*\EN:dl=5*\EM:do=\EB:ei=\EO:ho=\EH:\ - :im=\E@:k0=\EJ:k1=\ES:k2=\ET:k3=\EU:k4=\EV:k5=\EW:k6=\EP:\ - :k7=\EQ:k8=\ER:k9=\EOI:kb=^H:kd=\EB:kh=\EH:kl=\ED:kr=\EC:\ - :ku=\EA:le=^H:nd=\EC:se=\Eq:so=\Ep:sr=\EI:ta=^I:up=\EA:\ - :ve=\Ey4:vs=\Ex4: -p19|h19-b with il1/dl1:\ - :al=2*\EL:dl=2*\EM:tc=h19-b: -# From: -# (ztx: removed duplicate :sr: -- esr) -ztx|ztx11|zt-1|htx11|ztx-1-a|ztx-10 or 11:\ - :am:bs:es:hs:\ - :co#80:it#8:li#24:\ - :al=\EL:cd=\EJ:ce=\EK:cl=\EE:cm=\EY%+ %+ :dl=\EM:do=^J:\ - :ds=\Ey1:fs=\Ek\Ey5:ho=\EH:\ - :is=\Ej\EH\Eq\Ek\Ev\Ey1\Ey5\EG\Ey8\Ey9\Ey>:k0=\ES:\ - :k1=\EB:k2=\EU:k3=\EV:k4=\EW:k5=\EP:k6=\EQ:k7=\ER:kb=^H:\ - :kd=\EB:kl=\ED:kr=\EC:ku=\EA:le=^H:nd=\EC:se=\Eq:so=\Es5:\ - :sr=\EI:ta=^I:ts=\Ej\Ex5\Ex1\EY8%+ \Eo:ue=\Eq:up=\EA:\ - :us=\Es2: - -#### IMS International (ims) -# -# There was a company called IMS International located in Carson City, -# Nevada, that flourished from the mid-70s to mid-80s. They made S-100 -# bus/Z80 hardware and a line of terminals called Ultimas. -# - -# From: Erik Fair Sun Oct 27 07:21:05 1985 -ims950-b|bare ims950 no init string:\ - :is@:tc=ims950: -# (ims950: removed obsolete ":ko@:" -- esr) -ims950|ims televideo 950 emulation:\ - :xn@:\ - :k0@:k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:k9@:kb@:kd@:kh@:kl@:kr@:ku@:vb@:tc=tvi950: -# (ims950-rv: removed obsolete ":ko@:" -- esr) -ims950-rv|ims tvi950 rev video:\ - :xn@:\ - :k0@:k1@:k2@:k3@:k4@:k5@:k6@:k7@:k8@:k9@:kb@:kd@:kh@:kl@:kr@:ku@:vb@:tc=tvi950-rv: -ims-ansi|ultima2|ultimaII|IMS Ultima II:\ - :am:bs:\ - :co#80:it#8:li#24:\ - :cd=\E[0J:ce=\E[0K:cl=\E[H\E[2J:cm=\E[%i%2;%2H:do=\ED:\ - :if=/usr/share/tabset/vt100:\ - :is=\E[m\E[>14l\E[?1;?5;20l\E>\E[1m\r:kd=\E[B:kh=\E[H:\ - :kl=\E[D:kr=\E[C:ku=\E[A:le=^H:me=\E[m:se=\E[m\E[1m:\ - :so=\E[7m:sr=\EM:ta=^I:ue=\E[m\E[1m:up=\EM:us=\E[4m: - -#### Intertec Data Systems -# -# I think this company is long dead as of 1995. They made an early CP/M -# micro called the "Intertec Superbrain" that was moderately popular, -# then sank out of sight. -# - -superbrain|intertec superbrain:\ - :am:bs:bw:\ - :co#80:li#24:\ - :bc=^U:bl=^G:cd=\E~k<10*>:ce=\E~K:cl=\014:cm=\EY%+ %+ :\ - :cr=^M:do=^J:kd=^J:kl=^U:kr=^F:ku=^K:le=^H:nd=^F:sf=^J:ta=^I:\ - :te=^L:ti=^L:up=^K: -# (intertube: a Gould entry via BRL asserted smul=\E0@$<200/>, -# rmul=\E0A$<200/>; my guess is the highlight letter is bit-coded like an ADM, -# and the reverse is actually true. Try it. -- esr) -intertube|intertec|Intertec InterTube:\ - :am:bs:\ - :co#80:li#25:\ - :bl=^G:cl=^L:cm=\EY%+ %+ :cr=^M:do=^J:ho=^A:le=^H:nd=^F:\ - :se=\E0@:sf=^J:so=\E0P:up=^Z: -# The intertube 2 has the "full duplex" problem like the tek 4025: if you -# are typing and a command comes in, the keystrokes you type get interspersed -# with the command and it messes up -intertube2|intertec data systems intertube 2:\ - :bs:\ - :ce=\EK:ch=\020%+^J:cm=\016%.\020%+^J:cv=\013%.:\ - :ll=^K^X\r:\ - :tc=intertube: - -#### Ithaca Intersystems -# -# This company made S100-bus personal computers long ago in the pre-IBM-PC -# past. They used to be reachable at: -# -# Ithaca Intersystems -# 1650 Hanshaw Road -# Ithaca, New York 14850 -# -# However, the outfit went bankrupt years ago. -# - -# The Graphos III was a color graphics terminal from Ithaca Intersystems. -# These entries were written (originally in termcap syntax) by Brian Yandell -# and Mike Meyer at the -# University of Wisconsin. - -# (graphos: removed obsolete and syntactically incorrect :kn=4:, -# removed :if=/usr/share/tabset/init.graphos: and -# no such file & no :st: -- esr) -graphos|graphos III:\ - :am:mi:\ - :co#80:it#8:li#24:\ - :AL=\E[%dL:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:\ - :UP=\E[%dA:al=\E[L:cd=\E[J:ce=\E[K:cl=\E[H\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:dm=\E[4h:do=\E[B:\ - :ed=\E[4l:ei=\E[4l:ho=\E[H:im=\E[4h:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:\ - :ku=\E[A:le=^H:me=\E[m:nd=\E[C:nw=^M\ED:rc=\E8:sc=\E7:\ - :se=\E[m:sf=\ED:so=\E[7m:sr=\EM:ta=^I:up=\E[A:\ - :ve=\Ez56;2;0;0z\Ez73z\Ez4;1;1z:\ - :vs=\Ez4;2;1z\Ez56;2;80;24z: -graphos-30|graphos III with 30 lines:\ - :li#30:\ - :vs=\Ez4;2;1z\Ez56;2;80;30z:tc=graphos: - -#### Modgraph -# -# These people used to be reachable at: -# -# Modgraph, Inc -# 1393 Main Street, -# Waltham, MA 02154 -# Vox: (617)-890-5796. -# -# However, if you call that number today you'll get an insurance company. -# I have mail from "Michael Berman, V.P. Sales, Modgraph" dated -# 26 Feb 1997 that says: -# -# Modgraph GX-1000, replaced by GX-2000. Both are out of production, have been -# for ~7 years. Modgraph still in business. Products are rugged laptop and -# portable PC's and specialized CRT and LCD monitors (rugged, rack-mount -# panel-mount etc). I can be emailed at sonfour@aol.com -# -# Peter D. Smith notes that his modgraph manual was -# dated 1984. According to the manual, it featured Tek 4010/4014 -# graphics and DEC VT100/VT52 + ADM-3A emulation with a VT220-style keyboard. -# - -modgraph|mod24|modgraph terminal emulating vt100:\ - :xn@:\ - :co#80:li#24:\ - :is=\E\1369;0s\E\1367;1s\E[3g\E\13611;9s\E\13611;17s\E\13611;25s\E\13611;33s\E\13611;41s\E\13611;49s\E\13611;57s\E\13611;65s\E\13611;73s\E\13611;81s\E\13611;89s:\ - :rf@:sr=5\EM\E[K:vs=\E\1369;0s\E\1367;1s:\ - :tc=vt100: -# The GX-1000 manual is dated 1984. This looks rather like a VT-52. -modgraph2|modgraph gx-1000 80x24 with keypad not enabled:\ - :am:da:db:\ - :co#80:it#8:li#24:\ - :cd=50\EJ:ce=3\EK:cl=50\EH\EJ:cm=5\EY%+ %+ :\ - :is=\E<\E\1365;2s\E\1367;1s\E[3g\E\13611;9s\E\13611;17s\E\13611;25s\E\13611;33s\E\13611;41s\E\13611;49s\E\13611;57s\E\13611;65s\E\13611;73s\E\13611;81s\E\13611;89s\E\13612;0s\E\13614;2s\E\13615;9s\E\13625;1s\E\1369;1s\E\13627;1:\ - :le=^H:nd=2\EC:sr=5\EI:ta=^I:up=2\EA: -# -# Modgraph from Nancy L. Cider -# BUG NOTE from Barbara E. Ringers : -# If we set TERM=vt100, and set the Modgraph screen to 24 lines, setting a -# mark and using delete-to-killbuffer work correctly. However, we would -# like normal mode of operation to be using a Modgraph with 48 line setting. -# If we set TERM=mod (which is a valid entry in termcap with 48 lines) -# the setting mark and delete-to-killbuffer results in the deletion of only -# the line the mark is set on. -# We've discovered that the delete-to-killbuffer works correctly -# with TERM=mod and screen set to 80x48 but it's not obvious. Only -# the first line disappears but a ctrl-l shows that it did work -# correctly. -modgraph48|mod|Modgraph w/48 lines:\ - :am:bs:pt:xn:\ - :co#80:it#8:li#48:vt#3:\ - :bl=^G:cd=\E[J:ce=\E[K:cl=\E[;H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:do=^J:ho=\E[H:\ - :is=\E<\E[1;48r\E[0q\E[3;4q\E=\E[?1h:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:\ - :me=\E[m:mr=\E[7m:nd=\E[C:nl=^J:r1=\E=\E[0q\E>:rc=\E8:\ - :sc=\E7:se=\E[m:so=\E[7m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:\ - :us=\E[4m:vb=\E[?5h\E[0q\E[1;2q\E[?5l\E[0q\E[4;3q: - -#### Morrow Designs -# -# This was George Morrow's company. They started in the late 1970s making -# S100-bus machines. They used to be reachable at: -# -# Morrow -# 600 McCormick St. -# San Leandro, CA 94577 -# -# but they're long gone now (1995). -# - -# The mt70 terminal was shipped with the Morrow MD-3 microcomputer. -# Jeff's specimen was dated June 1984. -# From: Jeff Wieland 24 Feb 1995 -mt70|mt-70|Morrow MD-70; native Morrow mode:\ - :am:mi:ms:xo:\ - :co#80:it#8:li#24:\ - :%1=^AO\r:F1=^A`\r:F2=^Aa\r:F3=^Ab\r:F4=^Ac\r:F5=^Ad\r:\ - :F6=^Ae\r:F7=^Af\r:F8=^Ag\r:F9=^Ah\r:FA=^Ai\r:\ - :ac=+z\054{-x.yOi`|jGkFlEmDnHqJtLuKvNwMxI:ae=\E%:\ - :al=\EE:as=\E$:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=^Z:\ - :cm=\E=%+ %+ :cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ei=:ho=^^:\ - :i1=\E"2\EG0\E]:ic=\EQ:im=:k1=^A@\r:k2=^AA\r:k3=^AB\r:\ - :k4=^AC\r:k5=^AD\r:k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:\ - :k;=^AI\r:kB=^A^Z\r:kC=^An\r:kD=\177:kb=^H:kd=^AK\r:\ - :kh=^AN\r:kl=^AL\r:kr=^AM\r:ku=^AJ\r:le=^H:mh=\EG2:mk@:\ - :nd=^L:nw=^_:sf=^J:ta=^I:te=:ti=\E"2\EG0\E]:up=^K:us=\EG1:\ - :vb=\EK1\EK0:ve=\E"2:vi=\E"0:\ - :tc=adm+sgr: - -#### Motorola -# - -# Motorola EXORterm 155 from {decvax, ihnp4}!philabs!sbcs!megad!seth via BRL -# (Seth H Zirin) -ex155|Motorola Exorterm 155:\ - :am:bs:bw:\ - :co#80:kn#5:li#24:\ - :bt=\E[:cd=\ET:ce=\EU:cl=\EX:cm=\EE%+ %+ :do=\EB:ho=\E@:\ - :kB=\E[:kC=\EX:kE=\EU:kS=\ET:kb=^H:kd=^J:kh=\E@:kl=^H:kr=^L:\ - :ku=^K:nd=\ED:se=\Ec\ED:so=\Eb\ED:ta=\EZ:ue=\Eg\ED:\ - :us=\Ef\ED: - -#### Omron -# -# This company is still around in 1995, manufacturing point-of-sale systems. - -omron|Omron 8025AG:\ - :am:bs:da:db:\ - :co#80:li#24:\ - :al=\EL:bl=^G:cd=\ER:ce=\EK:cl=\EJ:cr=^M:dc=\EP:dl=\EM:do=^J:\ - :ho=\EH:le=^H:nd=\EC:se=\E4:sf=\ES:so=\Ef:sr=\ET:up=\EA:\ - :vs=\EN: - -#### Ramtek -# -# Ramtek was a vendor of high-end graphics terminals around 1979-1983; they -# were competition for things like the Tektronics 4025. -# - -# Ramtek 6221 from BRL, probably by Doug Gwyn -# The following SET-UP modes are assumed for normal operation: -# UNDERLINE_CURSOR ANSI_MODE AUTO_XON/XOFF_ON -# NEWLINE_OFF 80_COLUMNS -# Other SET-UP modes may be set for operator convenience or communication -# requirements; I recommend -# SMOOTH_SCROLL AUTO_REPEAT_ON 3_#_SHIFTED WRAP_AROUND_ON -# Hardware tabs are assumed to be every 8 columns; they can be set up by the -# "reset", "tset", or "tabs" utilities (use rt6221-w, 160 columns, for this). -# Note that the Control-E key is useless on this brain-damaged terminal. No -# delays are specified; use "stty ixon -ixany" to enable DC3/DC1 flow control! -rt6221|Ramtek 6221 80x24:\ - :bs:ms:pt:xo:\ - :co#80:it#8:kn#4:li#24:vt#3:\ - :DO=\E[%dB:LE=\E[%dD:RI=\E[%dC:UP=\E[%dA:ac=:ae=^O:as=^N:\ - :bl=^G:cd=\E[J:ce=\E[K:cl=\E[1;1H\E[J:cm=\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:ct=\E[3g:do=^K:ho=\E[1;1H:is=\E)0:\ - :k0=\EOP:k1=\EOQ:k2=\EOR:k3=\EOS:kb=^H:kd=\E[B:ke=\E>:\ - :kl=\E[D:kr=\E[C:ks=\E=:ku=\E[A:l0=PF1:l1=PF2:l2=PF3:l3=PF4:\ - :le=^H:ll=\E[24;1H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:\ - :nd=\E[C:nw=\EE:\ - :r1=\E[1w\E[>37m\E[>39m\E[1v\E[20l\E[?3l\E[?6l\E[>5h\E[>6h\E[>7h\E[>8l\E[>9h\E[>10l\E[1;24r\E[m\E[q\E(B\017\E)0\E#5\E>:\ - :rc=\E8:sc=\E7:se=\E[m:sf=^J:so=\E[7m:sr=\EM:st=\EH:ta=^I:\ - :ue=\E[m:up=\EM:us=\E[4m:ve=\E[>5h\E[>9h:vi=\E[>5l:\ - :vs=\E[>7h\E[>9l: -# [TO DO: Check out: short forms of ho/cl and ll; reset (\Ec)]. -rt6221-w|Ramtek 6221 160x48:\ - :co#160:li#48:\ - :ll=\E[48;1H:tc=rt6221: - -#### RCA -# - -# RCA VP3301 or VP3501 -rca|rca vp3301/vp3501:\ - :bs:\ - :co#40:li#24:\ - :cl=^L:cm=\EY%+ %+ :ho=^Z:nd=^U:se=\E\ES0:so=\E\ES1:up=^K: - - -#### Selanar -# - -# Selanar HiREZ-100 from BRL, probably by Doug Gwyn -# The following SET-UP modes are assumed for normal operation: -# SET_DEFAULT_TABS 48_LINES 80_COLUMNS -# ONLINE ANSI CURSOR_VISIBLE -# VT102_AUTO_WRAP_ON VT102_NEWLINE_OFF VT102_MONITOR_MODE_OFF -# LOCAL_ECHO_OFF US_CHAR_SET WPS_TERMINAL_DISABLED -# CPU_AUTO_XON/XOFF_ENABLED PRINT_FULL_SCREEN -# For use with graphics software, all graphics modes should be set to factory -# default. Other SET-UP modes may be set for operator convenience or -# communication requirements. No delays are specified; use "stty ixon -ixany" -# to enable DC3/DC1 flow control! -# I commented out the scrolling capabilities since they are too slow. -hirez100|Selanar HiREZ-100:\ - :bs:mi:ms:pt:xo:\ - :co#80:it#8:kn#4:li#48:vt#3:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ac=:ae=^O:al=\E[L:as=^N:bl=^G:cd=\E[J:\ - :ce=\E[K:cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:\ - :dc=\E[P:dl=\E[M:do=^J:ho=\E[H:is=\E<\E)0:k0=\EOP:k1=\EOQ:\ - :k2=\EOR:k3=\EOS:kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:\ - :kr=\EOC:ks=\E[?1h\E=:ku=\EOA:l0=PF1:l1=PF2:l2=PF3:l3=PF4:\ - :le=^H:ll=\E[48H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:\ - :nd=\E[C:nw=\EE:pf=\E[4i\E[?4i:po=\E[?5i\E[5i:ps=\E[i:\ - :r1=\030\E2\E<\E[4i\E[?4i\E[12h\E[2;4;20l\E[?0;7h\E[?1;3;6;19l\E[r\E[m\E(B\017\E)0\E>:\ - :rc=\E8:sc=\E7:se=\E[m:so=\E[7m:st=\EH:ta=^I:ue=\E[m:up=\EM:\ - :us=\E[4m: -hirez100-w|Selanar HiREZ-100 in 132-column mode:\ - :co#132:tc=hirez100: - -#### Signetics -# - -# From University of Wisconsin -vsc|Signetics Vsc Video driver by RMC:\ - :am:ms:\ - :co#80:it#8:li#26:\ - :ce=\E[K:cl=50\E[;H\E[2J:cm=\E[%i%d;%dH:cr=^M:do=^J:\ - :ho=\E[H:kb=^H:kd=^J:kl=^H:le=^H:me=^_\041:mr=^_ :nd=\E[C:\ - :nw=^M^J:se=^_\041:sf=^J:so=^_ :ta=^I:ue=^_#:up=\E[A:us=^_": - -#### Soroc -# -# Alan Frisbie writes: -# -# As you may recall, the Soroc logo consisted of their name, -# with the letter "S" superimposed over an odd design. This -# consisted of a circle with a slightly smaller 15 degree (approx.) -# wedge with rounded corners inside it. The color was sort of -# a metallic gold/yellow. -# -# If I had been more of a beer drinker it might have been obvious -# to me, but it took a clue from their service department to make -# me exclaim, "Of course!" The circular object was the top of -# a beer can (the old removable pop-top style) and "Soroc" was an -# anagram for "Coors". -# -# I can just imagine the founders of the company sitting around -# one evening, tossing back a few and trying to decide what to -# call their new company and what to use for a logo. -# - -# (soroc120: removed obsolete ":ma=^K^P^R^L^L :" -- esr) -soroc120|iq120|soroc|soroc iq120:\ - :cd=\EY:ce=\ET:cl=\E*:do=^J:kd=^J:kl=^H:kr=^L:ku=^K:tc=adm3a: -soroc140|iq140|soroc iq140:\ - :am:bs:mi:\ - :co#80:li#24:\ - :al=\Ee:bl=^G:bt=\EI:cd=\Ey:ce=\Et:cl=\E+:cm=\E=%+ %+ :\ - :cr=^M:dc=\Ew:dl=\Er:do=^J:ei=\E8:ho=^^:im=\E9:k0=^A0\r:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kb=^H:kh=^^:kr=^L:ku=^K:le=^H:\ - :ll=^^^K:nd=^L:se=\E\177:sf=^J:so=\E\177:ue=\E^A:up=^K:\ - :us=\E^A: - -#### Synertek -# -# Bob Manson writes (28 Apr 1995): -# -# Synertek used to make ICs, various 6502-based single-board process -# control and hobbyist computers, and assorted peripherals including a -# series of small inexpensive terminals (I think they were one of the -# first to have a "terminal-on-a-keyboard", where the terminal itself -# was only slightly larger than the keyboard). -# -# They apparently had a KTM-1 model, which I've never seen. The KTM-2/40 -# was a 40x24 terminal that could connect to a standard TV through a -# video modulator. The KTM-2/80 was the 80-column version (the 2/40 -# could be upgraded to the 2/80 by adding 2 2114 SRAMs and a new ROM). -# I have a KTM-2/80 still in working order. The KTM-2s had fully -# socketed parts, used 2 6507s, a 6532 as keyboard scanner, a program -# ROM and 2 ROMs as character generators. They were incredibly simple, -# and I've never had any problems with mine (witness the fact that mine -# was made in 1981 and is still working great... I've blown the video -# output transistor a couple of times, but it's a 2N2222 :-) -# -# The KTM-3 (which is what is listed in the terminfo file) was their -# attempt at putting a KTM-2 in a box (and some models came with a -# CRT). It wasn't much different from the KTM-2 hardware-wise, but the -# control and escape sequences are very different. The KTM-3 was always -# real broken, at least according to the folks I've talked to about it. -# -# The padding in the entry is probably off--these terminals were very -# slow (it takes like 100ms for the KTM-2 to clear the screen...) And -# anyone with any sanity replaced the ROMs with something that provided -# a reasonable subset of VT100 functionality, since the usual ROMs were -# obviously very primitive... oh, you could get an upgraded ROM from -# Synertek for some incredible amount of money, but what hacker with an -# EPROM burner would do that? :) -# -# Sorry I don't have any contact info; I believe they were located in -# Sunnyvale, and I'm fairly sure they are still manufacturing ICs -# (they've gone to ASICs and FPGAs), but I doubt they're in the computer -# business these days. -# - -# Tested, seems to work fine with vi. -synertek|ktm|synertek380|synertek ktm 3/80 tubeless terminal:\ - :am:\ - :co#80:li#24:\ - :cd=\EJ:ce=\EK:cl=^Z:cm=\E=%+ %+ :le=^H:nd=^L:up=^K: - -#### Tab Office Products -# -# TAB Products Co. - Palo Alto, California -# Electronic Office Products, -# 1451 California Avenue 94304 -# -# I think they're out of business. -# - -# The tab 132 uses xon/xoff, so no padding needed. -# :ks:/:ke: have nothing to do with arrow keys. -# :is: sets 80 col mode, normal video, autowrap on (for :am:). -# Seems to be no way to get rid of status line. -# The manual for this puppy was dated June 1981. It claims to be VT52- -# compatible but looks more vt100-like. -tab132|tab|tab132-15|tab 132/15:\ - :da:db:\ - :co#80:dN@:li#24:lm#96:\ - :al=\E[L:cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:do=^J:ei=\E[4l:\ - :im=\E[4h:is=\E[?7h\E[?3l\E[?5l:kd=\E[B:ke@:kl=\E[D:ks@:\ - :ku=\E[A:\ - :tc=vt100: -tab132-w|tab132 in wide mode:\ - :co#132:\ - :is=\E[?7h\E[?3h\E[?5l:tc=tab132: -tab132-rv|tab132 in reverse-video mode:\ - :is=\E[?7h\E[?3l\E[?5h:tc=tab132: -tab132-w-rv|tab132 in reverse-video/wide mode:\ - :is=\E[?7h\E[?3h\E[?5h:tc=tab132-w: - - -#### Teleray -# -# Research Incorporated -# 6425 Flying Cloud Drive -# Eden Prairie, MN 55344 -# Vox: (612)-941-3300 -# -# The Teleray terminals were all discontinued in 1992-93. RI still services -# and repairs these beasts, but no longer manufactures them. The Teleray -# people believe that all the types listed below are very rare now (1995). -# There was a newer line of Telerays (Model 7, Model 20, Model 30, and -# Model 100) that were ANSI-compatible. -# -# Note two things called "teleray". Reorder should move the common one -# to the front if you have either. A dumb teleray with the cursor stuck -# on the bottom and no obvious model number is probably a 3700. -# - -t3700|dumb teleray 3700:\ - :bs:\ - :co#80:li#24:\ - :bl=^G:cl=^L:cr=^M:do=^J:le=^H:sf=^J: -t3800|teleray 3800 series:\ - :bs:\ - :co#80:it#8:li#24:\ - :bl=^G:cd=\EJ:ce=\EK:cl=^L:cm=\EY%+ %+ :cr=^M:do=^J:ho=\EH:\ - :le=^H:ll=\EY7 :nd=\EC:sf=^J:ta=^I:up=^K: -t1061|teleray|teleray 1061:\ - :am:bs:km:xs:xt:\ - :co#80:it#8:li#24:sg#1:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EK:cl=\014:cm=\EY%+ %+ :cr=^M:\ - :ct=\EG:dc=\EQ:dl=\EM:do=^J:ei=:ho=\EH:ic=\EP:im=:ip=:\ - :is=\Ee\EU01^Z1\EV\EU02^Z2\EV\EU03^Z3\EV\EU04^Z4\EV\EU05^Z5\EV\EU06^Z6\EV\EU07^Z7\EV\EU08^Z8\EV\Ef:\ - :k1=^Z1:k2=^Z2:k3=^Z3:k4=^Z4:k5=^Z5:k6=^Z6:k7=^Z7:k8=^Z8:\ - :le=^H:nd=\EC:se=\ER@:sf=^J:so= \ERD:st=\EF:ta=^I:ue=\ER@:\ - :up=\EA:us=\ERH: -t1061f|teleray 1061 with fast PROMs:\ - :al=\EL:dl=\EM:ip@:tc=t1061: -# "Teleray Arpa Special", officially designated as -# "Teleray Arpa network model 10" with "Special feature 720". -# This is the new (1981) fast microcode updating the older "arpa" proms -# (which gave meta-key and programmable-fxn keys). 720 is much much faster, -# converts the keypad to programmable function keys, and has other goodies. -# Standout mode is still broken (magic cookie, etc) so is suppressed as no -# programs handle such lossage properly. -# Note: this is NOT the old termcap's "t1061f with fast proms." -# From: J. Lepreau Tue Feb 1 06:39:37 1983, Univ of Utah -# (t10: removed overridden ":so@:se@:us@:ue@:" -- esr) -t10|teleray 10 special:\ - :bs:km:xs:xt:\ - :co#80:it#8:li#24:sg#2:\ - :al=\EL:cd=\EJ:ce=\EK:cl=30\Ej:cm=\EY%+ %+ :dc=\EQ:dl=\EM:\ - :ei=:ho=\EH:ic=\EP:im=:le=^H:nd=\EC:pc=\0:se=\ER@:sf=\Eq:\ - :so=\ERD:sr=\Ep:ta=^I:ue=\ER@:up=\EA:us=\ERH: -# teleray 16 - map the arrow keys for vi/rogue, shifted to up/down page, and -# back/forth words. Put the function keys (f1-f10) where they can be -# found, and turn off the other magic keys along the top row, except -# for line/local. Do the magic appropriate to make the page shifts work. -# Also toggle ^S/^Q for those of us who use Emacs. -t16|teleray 16:\ - :am:da:db:mi:xs:xt:\ - :co#80:li#24:\ - :al=\E[L:bl=^G:cd=\E[0J:ce=\E[0K:cl=\E[H\E[2J:\ - :cm=%i\E[%d;%df:cr=^M:dc=\E[P:dl=\E[M:do=\E[B:ei=\E[4l:\ - :ho=\E[H:im=\E[4h:k1=^Z1:k2=^Z2:k3=^Z3:k4=^Z4:k5=^Z5:k6=^Z6:\ - :k7=^Z7:k8=^Z8:k9=^Z9:k;=^Z0:le=^H:me=\E[m:nd=\E[C:se=\E[m:\ - :sf=^J:so=\E[7m:sr=\E[T:ta=^I:te=\E[V\E[24;1f\E[?38h:\ - :ti=\E[U\E[?38l:ue=\E[m:up=\E[A:us=\E[4m: - -#### Texas Instruments (ti) -# - -# The Silent 700 was so called because it was built around a quiet thermal -# printer. It was portable, equipped with an acoustic coupler, and pretty -# neat for its day. -ti700|ti733|ti735|ti745|ti800|ti silent 700/733/735/745 or omni 800:\ - :bs:hc:os:\ - :co#80:\ - :bl=^G:cr=\r:do=^J:le=^H:sf=^J: - -# -# Texas Instruments 916 VDT 7 bit control mode -# -ti916|ti916-220-7|Texas Instruments 916 VDT 8859/1 vt220 mode 7 bit CTRL:\ - :da:db:in:ms:\ - :%9=^X:@4=\E[29~:@8=^J:AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:\ - :DO=\E[%dB:F1=\E[29~:F2=\E[31~:IC=\E[%d@:LE=\E[%dD:\ - :RI=\E[%dC:UP=\E[%dA:ae=\017:as=\016:bt=\E[Z:cb=\E[1K:\ - :cd=\E[J:ce=\E[0K:ch=\E[%+^AG:cl=\E[H\E[2J:\ - :cm=\E[%i%d;%dH:ct=\E[3g:cv=\E[%+^Ad:dc=\E[P:eA=\E(B\E)0:\ - :ec=\E[%dX:ei=:ff=^L:im=:ip=:is=\E[1;24r\E[24;1H:k1=\E[17~:\ - :k2=\E[18~:k3=\E[19~:k4=\E[20~:k5=\E[21~:k6=\E[23~:\ - :k7=\E[24~:k8=\E[25~:k9=\E[26~:k;=\E[28~:kD=\E[P:kI=\E[@:\ - :kN=\E[S:kP=\E[T:kh=\E[H:mp=\E&:r2=\E[\041p:st=\E[0W:\ - :vb=\E[?5h\E[?5l:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h:\ - :tc=vt220: -# -# Texas Instruments 916 VDT 8 bit control mode -# -ti916-8|ti916-220-8|Texas Instruments 916 VDT 8859/1 8 vt220 mode bit CTRL:\ - :%9=^X:@4=\23329~:@8=^J:F1=\23329~:F2=\23331~:k1=\23317~:\ - :k2=\23318~:k3=\23319~:k4=\23320~:k5=\23321~:k6=\23323~:\ - :k7=\23324~:k8=\23325~:k9=\23326~:k;=\23328~:kD=\233P:\ - :kI=\233@:kN=\233S:kP=\233T:kd=\233B:kh=\233H:kl=\233D:\ - :kr=\233C:ku=\233A:\ - :tc=ti916: -# -# Texas Instruments 916 VDT 8859/1 7 bit control 132 column mode -# -ti916-132|Texas Instruments 916 VDT vt220 132 column:\ - :co#132:tc=ti916: -# -# Texas Instruments 916 VDT 8859/1 8 bit control 132 column mode -# -ti916-8-132|Texas Instruments 916 VDT 8-bit vt220 132 column:\ - :co#132:tc=ti916-8: -ti924|Texas Instruments 924 VDT 8859/1 7 bit CTRL:\ - :am:bs:xo:\ - :co#80:it#8:li#24:\ - :al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:\ - :cm=%i\E[%d;%dH:cr=^M:cs=%i\E[%d;%dr:ct=\E[3g:dl=\E[M:\ - :do=\E[B:ho=\E[H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\E[16~:\ - :k6=\E[17~:k7=\E[18~:k8=\E[19~:k9=\E[20~:kD=\E[P:kI=\E[@:\ - :kb=^H:kd=\E[B:kl=\E[D:kr=\E[C:ku=\E[A:le=\E[D:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[m:\ - :sf=\ED:so=\E[7m:sr=\EM:st=\EH:ta=^I:ue=\E[m:up=\E[A:\ - :us=\E[4m:ve=\E[?25h:vi=\E[?25l:vs=\E[?31h: -ti924-8|Texas Instruments 924 VDT 8859/1 8 bit CTRL:\ - :am:xo:\ - :co#80:it#8:li#24:\ - :al=\E[L:bl=^G:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:\ - :cm=%i\E[%d;%dH:cr=^M:cs=%i\E[%d;%dr:ct=\E[3g:dl=\E[M:\ - :do=\E[B:ho=\E[H:k1=P\217>:k2=Q\217>:k3=R\217>:k4=S\217>:\ - :k5=~\23316>:k6=~\23317>:k7=~\23318>:k8=~\23319>:\ - :k9=~\23320>:kD=P\233>:kI=@\233>:kb=^H:kd=\E[B:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=\E[D:mb=\E[5m:md=\E[1m:me=\E[m:\ - :mr=\E[7m:nd=\E[C:rc=\E8:sc=\E7:se=\E[m:sf=\ED:so=\E[7m:\ - :sr=\EM:st=\EH:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:ve=\E[?25h:\ - :vi=\E[?25l:vs=\E[?31h: -ti924w|Texas Instruments 924 VDT 7 bit - 132 column mode:\ - :co#132:tc=ti924: -ti924-8w|Texas Instruments 924 VDT 8 bit - 132 column mode:\ - :co#132:tc=ti924-8: -ti931|Texas Instruments 931 VDT:\ - :am:bs:xo:\ - :co#80:li#24:\ - :al=\EN:bl=^G:cd=\EJ:ce=\EI:cl=\EL:cm=\EY%+ %+ :cr=^M:\ - :dc=\EQ:dl=\EO:do=\EB:ei=:ho=\EH:ic=\ER\EP\EM:im=:\ - :is=\EGB\E(@B@@\E):k1=\Ei1:k2=\Ei2:k3=\Ei3:k4=\Ei4:\ - :k5=\Ei5:k6=\Ei6:k7=\Ei7:k8=\Ei8:k9=\Ei9:kA=\EN:kD=\EQ:\ - :kI=\EP:kL=\EO:kd=\EB:kl=\ED:kr=\EC:ku=\EA:le=\ED:mb=\E4P:\ - :me=\E4@:mk=\E4H:mr=\E4B:nd=\EC:se=\E4@:sf=\Ea:so=\E4A:\ - :sr=\Eb:ue=\E4@:up=\EA:us=\E4D:ve=\E4@: -ti926|Texas Instruments 926 VDT 8859/1 7 bit CTRL:\ - :cs@:sf=\E[1S:sr=\E[1T:tc=ti924: -# (ti926-8: I corrected this from the broken SCO entry -- esr) -ti926-8|Texas Instruments 926 VDT 8859/1 8 bit CTRL:\ - :cs@:sf=\2331S:sr=\2331T:\ - :tc=ti924-8: -ti_ansi|basic entry for ti928:\ - :am:eo:ut:xn:xo:\ - :Co#8:co#80:it#8:li#25:pa#64:\ - :@7=\E[F:AB=\E[4%p1%dm:AF=\E[3%p1%dm:al=\E[L:bl=^G:\ - :bt=\E[Z:cd=\E[J:ce=\E[K:cl=\E[2J\E[H:cm=\E[%i%d;%dH:\ - :cr=^M:cs=\E[%i%d;%dr:dc=\E[P:dl=\E[M:do=\E[B:ei=:ho=\E[H:\ - :ic=\E[@:im=:k0=\E[V:k1=\E[M:k2=\E[N:k3=\E[O:k4=\E[P:\ - :k5=\E[Q:k6=\E[R:k7=\E[S:k8=\E[T:k9=\E[U:kN=\E[G:kP=\E[I:\ - :kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:nd=\E[C:op=\E[37;40m:se=\E[m:\ - :sf=\E[S:so=\E[7m:sr=\E[T:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: -# -# 928 VDT 7 bit control mode -# -ti928|Texas Instruments 928 VDT 8859/1 7 bit CTRL:\ - :%9=\E[35~:@7=\E_1\E\:@8=\E[8~:F1=\E[29~:F2=\E[31~:\ - :F3=\E[32~:F5=\E[34~:k1=\E[17~:k2=\E[18~:k3=\E[19~:\ - :k4=\E[20~:k5=\E[21~:k6=\E[23~:k7=\E[24~:k8=\E[25~:\ - :k9=\E[26~:k;=\E[28~:kD=\E[P:kI=\E[@:kN=\E[S:kP=\E[T:\ - :tc=ti_ansi: -# -# 928 VDT 8 bit control mode -# -ti928-8|Texas Instruments 928 VDT 8859/1 8 bit CTRL:\ - :%9=\23335~:@7=\2371\234:@8=\2338~:F1=\23329~:F2=\23331~:\ - :F3=\23332~:F5=\23334~:k1=\23317~:k2=\23318~:k3=\23319~:\ - :k4=\23320~:k5=\23321~:k6=\23323~:k7=\23324~:k8=\23325~:\ - :k9=\23326~:k;=\23328~:kD=\233P:kI=\233@:kN=\233S:\ - :kP=\233T:kh=\233H:\ - :tc=ti_ansi: - -#### Zentec (zen) -# - -# (zen30: removed obsolete :ma=^L ^R^L^K^P:. This entry originally -# had just :so:=\EG6 which I think means standout was supposed to be -# dim-reverse using ADM12-style attributes. ADM12 :us:/:ue: and -# might work-- esr) -zen30|z30|zentec 30:\ - :am:bs:mi:ul:\ - :co#80:li#24:\ - :al=\EE:bl=^G:cd=\EY:ce=\ET:cl=\E*:cm=\E=%+ %+ :cr=^M:\ - :dc=\EW:dl=\ER:do=^J:ei=\Er:ho=^^:im=\Eq:le=^H:mh=\EG2:nd=^L:\ - :sf=^J:so=\EG6:ue@:up=^K:us@:\ - :tc=adm+sgr: -# (zen50: this had extension capabilities -# :BS=^U:CL=^V:CR=^B: -# UK/DK/RK/LK/HM were someone's aliases for ku/kd/kl/kr/kh, -# which were also in the original entry -- esr) -# (zen50: removed obsolete ":ma=^Hh^Ll^Jj^Kk:" -- esr) -zen50|z50|zentec zephyr:\ - :am:bs:\ - :co#80:li#24:sg#1:\ - :al=\EE:cd=\EY:ce=\ET:cl=\E+:cm=\E=%+ %+ :dc=\EW:dl=\ER:ei=:\ - :ic=\EQ:im=:kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:mk@:ue@:up=^K:\ - :us@:\ - :tc=adm+sgr: - -# CCI 4574 (Office Power) from Will Martin via BRL -cci|cci1|z8001|zen8001|CCI Custom Zentec 8001:\ - :am:bs:bw:\ - :co#80:li#24:\ - :cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :cs=\ER%+ %+ :do=^J:\ - :ho=\EH:is=\EM \EF\ET\EP\ER 7:kb=^H:kd=\EB:kh=\EH:kl=\ED:\ - :kr=\EC:ku=\EA:le=^H:mb=\EM":me=\EM :mh=\EM\041:mk=\EM(:\ - :mr=\EM$:nd=\EC:pf=^T:po=^R:se=\EM :so=\EM$:sr=\EI:ue=\EM :\ - :up=\EA:us=\EM0:ve=\EP:vs=\EF\EQ\EM \ER 7: - -######## OBSOLETE UNIX CONSOLES -# - -#### Altos -# -# Altos made a moderately successful line of UNIX boxes. In 1990 they were -# bought out by Acer, a major Taiwanese manufacturer of PC-clones. -# Acer has a web site at http://www.acer.com. -# -# Altos descriptions from Ted Mittelstaedt 4 Sep 1993 -# His comments suggest they were shipped with the system. -# - -# (altos2: had extension capabilities -# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ -# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ -# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ -# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: -# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ -# :YU=^AQ\r:YD=^AR\r:YR=^AS\r:YL=^AT\r:\ -# :HL=^AP\r:SP=\E[i:\ -# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ -# :LO=\E[0q:LC=\E[5q:LL=\E[6q:\ -# Comparison with the k* capabilities makes it obvious that the c* things are -# shift keys. I have renamed them to keys 32 and up accordingly. Also, -# :sr: was given as a boolean-- esr) -altos2|alt2|altos-2|altos II:\ - :co#80:it#8:li#24:sg#0:\ - :*5=^Am\r:*8=^An\r:DL=\E[M:FM=^A`\r:FN=^Aa\r:FO=^Ab\r:\ - :FP=^Ac\r:FQ=^Ad\r:FR=^Ae\r:FS=^Af\r:FT=^Ag\r:FU=^Ah\r:\ - :FV=^Ai\r:FW=^Aj\r:FX=^Ak\r:RA=\E[?7l:SA=\E[?7h:al=\E[L:\ - :cd=\E[J:ce=\E[K:cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :dc=\E[P:do=\E[1B:ei=:ho=\E[H:ic=\E[@:\ - :if=/usr/share/tabset/vt100:im=:\ - :is=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:k0=^AI\r:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kA=^AJ\r:kB=^AK\r:kC=^AL\r:\ - :kD=^AM\r:kE=^AN\r:kF=^AO\r:kb=^H:kd=\E[B:kh=\E[f:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=^H:me=\E[m:nd=\E[1C:nw=^M^J:se=\E[m:\ - :sf=^J:so=\E[7m:ta=^I:ue=\E[m:up=\E[1A:us=\E[4m: -# (altos3: had extension capabilities -# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ -# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ -# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ -# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: -# :XU=^Aq\r:XD=^Ar\r:XR=^As\r:XL=^At\r:\ -# :HL=^AP\r:SP=\E[i:\ -# :IS=\E[@:DE=\E[P:IL=\E[L:NS=\E[S:PS=\E[T:\ -altos3|altos5|alt3|alt5|altos-3|altos-5|altos III or V:\ - :mb=\E[5p:me=\E[p:sr=\EM:\ - :tc=altos2: -altos4|alt4|altos-4|altos IV:\ - :tc=wy50: -# (altos7: had extension capabilities: -# :GG#0:GI=\EH8:GF=\EH7:\ -# :c0=^A`\r:c1=^Aa\r:c2=^Ab\r:c3=^Ac\r:\ -# :c4=^Ad\r:c5=^Ae\r:c6=^Af\r:c7=^Ag\r:\ -# :c8=^Ah\r:c9=^Ai\r:cA=^Aj\r:cB=^Ak\r:\ -# :cC=^Al\r:cD=^Am\r:cE=^An\r:cF=^Ao\r: -# Comparison with the k* capabilities makes it obvious that the c* things are -# shift keys. I have renamed them to keys 32 and up accordingly. I have -# also made this entry relative to adm12 in order to give it an :sa:. The -# imported by use=adm+sgr may work, let me know. -- esr) -altos7|alt7|altos VII:\ - :am:mi:\ - :co#80:li#24:sg#0:\ - :*5=^Am\r:*8=^An\r:DL=\ER:FM=^A`\r:FN=^Aa\r:FO=^Ab\r:\ - :FP=^Ac\r:FQ=^Ad\r:FR=^Ae\r:FS=^Af\r:FT=^Ag\r:FU=^Ah\r:\ - :FV=^Ai\r:FW=^Aj\r:FX=^Ak\r:\ - :ac=j5k3l2m1n8q\072t4u9v=w0x6:al=\EE:cd=\EY:ce=\ET:\ - :cl=\E+^^:cm=\E=%+ %+ :cr=^M:dc=\EW:do=^J:ei=\Er:ho=^^:\ - :im=\Eq:is=\E`\072\Ee(\EO\Ee6\Ec41\E~4\Ec21\Eu\E~2:\ - :k0=^AI\r:k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:\ - :k6=^AE\r:k7=^AF\r:k8=^AG\r:k9=^AH\r:kA=^AJ\r:kB=^AK\r:\ - :kC=^AL\r:kD=^AM\r:kE=^AN\r:kF=^AO\r:kN=\EK:kP=\EJ:kb=^H:\ - :kd=^J:kh=^^:kl=^H:kr=^L:ku=^K:le=^H:mb=\EG2:md=\EGt:mh=\EGp:\ - :mk=\EG1:nd=^L:nw=^M^J:pf=\EJ:po=\Ed#:sf=^J:sr=\Ej:ta=^I:\ - :up=^K:\ - :tc=adm+sgr: -altos7pc|alt7pc|altos PC VII:\ - :@7=\ET:tc=altos7: - -#### Apollo consoles -# -# Apollo got bought by Hewlett-Packard. The Apollo workstations are -# labeled HP700s now. -# - -# From: Gary Darland -apollo|apollo console:\ - :am:bs:mi:\ - :co#88:li#53:\ - :al=\EI:cd=\EJ:ce=\EK:ch=\EN%d:cl=^L:cm=\EM%+ %d):cv=\EO+ :\ - :dc=\EP:dl=\EL:do=\EB:ei=\ER:im=\EQ:le=^H:nd=\EC:se=\ET:\ - :sf=\EE:so=\ES:sr=\ED:te=\EX:ti=\EW:ue=\EV:up=\EA:us=\EU: - -# We don't know whether or not the apollo guys replicated DEC's firmware bug -# in the VT132 that reversed :ei:/:im:. To be on the safe side, disable -# both these capabilities. -apollo_15P|apollo 15 inch display:\ - :ei@:im@:tc=vt132: -apollo_19L|apollo 19 inch display:\ - :ei@:im@:tc=vt132: -apollo_color|apollo color display:\ - :ei@:im@:tc=vt132: - -#### Convergent Technology -# -# Burroughs bought Convergent shortly before it merged with Univac. -# CTOS is (I believe) dead. Probably the aws is too (this entry dates -# from 1991 or earlier). -# - -# Convergent AWS workstation from Gould/SEL UTX/32 via BRL -# (aws: removed unknown :dn=^K: -- esr) -aws|Convergent Technologies AWS workstation under UTX and Xenix:\ - :am:\ - :co#80:li#28:sg#0:\ - :ac=:ae=\EAAF:al=\EIL:as=\EAAN:bc=^H:cd=\EEF:ce=\EEL:\ - :ch=\EH%.:cl=^L:cm=\EC%r%.%.:cv=\EV%.:dc=\EDC:dl=\EDL:\ - :do=^K:ei=:ic=\EIC:im=:kb=^H:kd=^K:kl=^N:kr=^R:ku=^A:\ - :ma=\016h\013j\001k\022l\002m:nd=^R:nl=^J:se=\EARF:\ - :sf=\ESU:so=\EARN:sr=\ESD:ue=\EAUF:up=^A:us=\EAUN: -awsc|Convergent Technologies AWS workstation under CTOS:\ - :am:\ - :co#80:li#24:sg#0:\ - :ac=:ae=\EAAF:as=\EAAN:bc=^N:cd=\EEF:ce=\EEL:cl=^L:\ - :cm=\EC%r%.%.:do=^K:kb=^H:kd=^K:kl=^N:kr=^R:ku=^A:\ - :ma=\016h\013j\001k\022l\002m:nd=^R:se=\EAA:so=\EAE:\ - :ue=\EAA:up=^A:us=\EAC: - -#### DEC consoles -# - -# The MicroVax console. Tim Theisen writes: -# The digital uVax II's had a graphic display called a qdss. It was -# supposed to be a high performance graphic accelerator, but it was -# late to market and barely appeared before faster dumb frame buffers -# appeared. I have only used this display while running X11. However, -# during bootup, it was in text mode, and probably had a terminal emulator -# within it. And that is what your termcap entry is for. In graphics -# mode the screen size is 1024x864 pixels. -qdss|qdcons|qdss glass tty:\ - :am:bs:\ - :co#128:li#57:\ - :cl=1\032:cm=\E=%.%.:do=^J:le=^H:nd=^L:up=^K: - -#### Fortune Systems consoles -# -# Fortune made a line of 68K-based UNIX boxes that were pretty nifty -# in their day; I (esr) used one myself for a year or so around 1984. -# They had no graphics, though, and couldn't compete against Suns and -# the like. R.I.P. -# - -# From: Robert Nathanson via tut Wed Oct 5, 1983 -# (This had extension capabilities -# :rv=\EH:re=\EI:rg=0:GG=0:\ -# :CO=\E\\:WL=^Aa\r:WR=^Ab\r:CL=^Ac\r:CR=^Ad\r:DL=^Ae\r:RF=^Af\r:\ -# :RC=^Ag\r:CW=^Ah\r:NU=^Aj\r:EN=^Ak\r:HM=^Al:PL=^Am\r:\ -# :PU=^An\r:PD=^Ao\r:PR=^Ap\r:HP=^A@\r:RT=^Aq\r:TB=\r:CN=\177:MP=\E+F: -# It had both ":bs:" and ":bs=^H:"; I removed the latter. Also, it had -# ":sg=0:" and ":ug=0:"; evidently the composer was trying (unnecessarily) -# to force both magic cookie glitches off. Once upon a time, I -# used a Fortune myself, so I know the capabilities of the form ^A[a-z]\r are -# function keys; thus the "Al" value for HM was certainly an error. I renamed -# EN/PD/PU/CO/CF/RT according to the XENIX/TC mappings, but not HM/DL/RF/RC. -# I think :rv: and :re: are start/end reverse video and :rg: is a nonexistent -# "reverse-video-glitch" capability; I have put :rv: and :re: in with standard -# names below. I've removed obsolete ":nl=5^J:" as there is a :do: -- esr) -fos|fortune|Fortune system:\ - :am:bs:bw:\ - :co#80:li#25:\ - :@7=^Ak\r:@8=^Aq:ac=j*k(l m"q&v%w#x-:ae=^O:al=\034E:\ - :as=\Eo:bl=^G:cd=\034Y:ce=^\Z:cl=\014:cm=\034C%+ %+ :cr=^M:\ - :dc=\034W:dl=\034R:do=\n:ei=:ho=\036:ic=\034Q:im=:is=^_..:\ - :k1=^Aa\r:k2=^Ab\r:k3=^Ac\r:k4=^Ad\r:k5=^Ae\r:k6=^Af\r:\ - :k7=^Ag\r:k8=^Ah\r:kN=^Ao\r:kP=^An\r:kb=^H:kd=^Ay\r:\ - :kh=^A?\r:kl=^Aw\r:kr=^Az\r:ku=^Ax\r:le=^H:mb=\EN:me=\EI:\ - :mr=\EH:nw=^M^J:se=^\I`:sf=^J:so=^\H`:ta=^Z:ue=^\IP:up=\013:\ - :us=^\HP:ve=\E\:vi=\E]:vs=\E\072: - -#### IBM Unix consoles -# - -# The following is a version of the ibm-pc entry distributed with PC/IX, -# (Interactive Systems' System 3 for the Big Blue), modified by Richard -# McIntosh at UCB/CSM. The :pt: and :uc: have been removed from the original, -# (the former is untrue, and the latter failed under UCB/man); standout and -# underline modes have been added. Note: this entry describes the "native" -# capabilities of the PC monochrome display, without ANY emulation; most -# communications packages (but NOT PC/IX connect) do some kind of emulation. -pcix|PC/IX console:\ - :am:bw:eo:\ - :co#80:li#24:\ - :cd=\E[J:ce=\E[K:cl=\Ec:cm=\E[%i%2;%2H:do=\E[B:ho=\E[H:\ - :le=^H:me=\E[m:nd=\E[C:se=\E[m:so=\E[7m:ue=\E[m:up=\E[A:\ - :us=\E[4m: - -# (ibmpcx: this entry used to be known as ibmx. -# It formerly included the following extension capabilities: -# :GC=b:GL=v:GR=t:RT=^J:\ -# :GH=\E[196g:GV=\E[179g:\ -# :GU=\E[193g:GD=\E[194g:\ -# :G1=\E[191g:G2=\E[218g:G3=\E[192g:G4=\E[217g:\ -# :CW=\E[E:NU=\E[F:RF=\E[G:RC=\E[H:\ -# :WL=\E[K:WR=\E[L:CL=\E[M:CR=\E[N:\ -# I renamed GS/GE/WL/WR/CL/CR/PU/PD/HM/EN; also, removed a duplicate -# ":kh=\E[Y:". Added IBM-PC forms characters and highlights, they match -# what was there before. -- esr) -ibmpcx|xenix|ibmx|IBM PC xenix console display:\ - :am:bs:ms:\ - :co#80:li#25:\ - :@7=\E[d:al=\E[L:cd=\E[J:ce=\E[K:cl=^L:cm=\E[%d;%dH:\ - :dc=\E[P:dl=\E[M:do=\E[B:ei=:ho=\E[H:ic=\E[@:im=:k1=\E[K:\ - :k2=\E[L:k3=\E[M:k4=\E[N:kN=\E[e:kP=\E[Z:kb=^H:kd=\E[B:\ - :kh=\E[Y:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:nd=\E[C:up=\E[A:\ - :tc=klone+acs:tc=klone+sgr: - - -#### Masscomp consoles -# -# Masscomp has gone out of business. Their product line was purchased by -# comany in Georgia (US) called "XS International", parts and service may -# still be available through them. -# - -# (masscomp: ":MT:" changed to ":km:"; -- esr) -masscomp|masscomp workstation console:\ - :bs:km:mi:\ - :co#80:it#8:li#24:\ - :al=\E[L:cd=\E[J:ce=\E[K:cl=\E[2J:cm=\E[%i%d;%dH:dc=\E[P:\ - :dl=\E[M:do=\E[B:ei=\E[4l:im=\E[4h:is=\EGc\EGb\EGw:kb=^H:\ - :kd=\EOB:kl=\EOD:kr=\EOC:ku=\EOA:le=^H:nd=\E[C:se=\E[m:\ - :so=\E[7m:ta=^I:ue=\EGau:up=\E[A:us=\EGu: -masscomp1|masscomp large screen version 1:\ - :co#104:li#36:tc=masscomp: -masscomp2|masscomp large screen version 2:\ - :co#64:li#21:tc=masscomp: - -#### Sony NEWS workstations -# - -# (news-unk: this had :KB=news: -- esr) -news-unk|SONY NEWS vt100 emulator old common entry:\ - :am:bs:pt:xn:\ - :co#80:\ - :AL=\E[%dL:DL=\E[%dM:al=\E[L:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[2J:cm=\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:\ - :dl=\E[M:do=^J:ho=\E[H:if=/usr/lib/tabset/vt100:\ - :is=\E[?7h\E[?1l\E[?3l\E7\E8:k0=\EOY:k1=\EOP:k2=\EOQ:\ - :k3=\EOR:k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:k9=\EOX:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:\ - :nl=^J:rc=\E8:rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[r:\ - :sc=\E7:se=\E[m:so=\E[7m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:\ - :us=\E[4m: -# -# (news-29: this had :TY=ascii: --esr) -news-29:\ - :li#29:tc=news-unk: -# (news-29-euc: this had :TY=euc: --esr) -news-29-euc:\ - :tc=news-29: -# (news-29-sjis: this had :TY=sjis: --esr) -news-29-sjis:\ - :tc=news-29: -# -# (news-33: this had :TY=ascii: --esr) -news-33:\ - :li#33:tc=news-unk: -# (news-33-euc: this had :TY=euc: --esr) -news-33-euc:\ - :tc=news-33: -# (news-33-sjis: this had :TY=sjis: --esr) -news-33-sjis:\ - :tc=news-33: -# -# (news-42: this had :TY=ascii: --esr) -news-42:\ - :li#42:tc=news-unk: -# (news-42-euc: this had :TY=euc: --esr) -news-42-euc:\ - :tc=news-42: -# (news-42-sjis: this had :TY=sjis: --esr) -news-42-sjis:\ - :tc=news-42: -# -# NEWS-OS old termcap entry -# -# (news-old-unk: this had :KB=news:TY=sjis: --esr) -news-old-unk|SONY NEWS vt100 emulator common entry:\ - :am:bs:pt:xn:\ - :co#80:vt#3:\ - :bl=^G:cd=\E[J:ce=\E[K:cl=\E[;H\E[2J:cm=\E[%i%d;%dH:cr=^M:\ - :cs=\E[%i%d;%dr:do=^J:ho=\E[H:if=/usr/lib/tabset/vt100:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:kb=^H:kd=\EOB:\ - :ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:ku=\EOA:le=^H:\ - :mb=\E[5m:md=\E[1m:me=\E[m:mr=\E[7m:nd=\E[C:nl=^J:rc=\E8:\ - :rs=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:sc=\E7:se=\E[m:\ - :so=\E[7m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: -# -# (nwp512: this had :DE=^H:, which I think means :bs: --esr) -nwp512|news|nwp514|news40|vt100-bm|old sony vt100 emulator 40 lines:\ - :bs:\ - :li#40:\ - :is=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8:tc=news-old-unk: -# -# (nwp512-a: this had :TY=ascii: and the alias vt100-bm --esr) -nwp512-a|nwp514-a|news-a|news42|news40-a|sony vt100 emulator 42 line:\ - :li#42:\ - :is=\E[?7h\E[?1l\E[?3l\E7\E[1;42r\E8:tc=news-old-unk: -# -# (nwp-512-o: this had :KB=nwp410:DE=^H: I interpret the latter as :bs:. --esr) -nwp512-o|nwp514-o|news-o|news40-o|vt100-bm-o|sony vt100 emulator 40 lines:\ - :bs:\ - :li#40:\ - :is=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;40r\E8:tc=news-old-unk: -# -# (nwp513: this had :DE=^H: and the alias vt100-bm --esr) -nwp513|nwp518|nwe501|newscbm|news31|sony vt100 emulator 33 lines:\ - :bs:\ - :li#31:\ - :is=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8:tc=news-old-unk: -# -# (nwp513-a: this had :TY=ascii: and :DE=^H:, which I interpret as :bs:; --esr) -# also the alias vt100-bm. -nwp513-a|nwp518-a|nwe501-a|nwp251-a|newscbm-a|news31-a|newscbm33|news33|old sony vt100 emulator 33 lines:\ - :bs:\ - :li#33:\ - :is=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;33r\E8:tc=news-old-unk: -# -# (nwp513-o: had :DE=^H:, I think that's :bs:; also the alias vt100-bm --esr) -nwp513-o|nwp518-o|nwe501-o|nwp251-o|newscbm-o|news31-o|old sony vt100 emulator 33 lines:\ - :bs:\ - :li#31:\ - :is=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;31r\E8:tc=news-old-unk: -# -# (news28: this had :DE=^H:, I think that's :bs:, and :KB=nws1200: --esr) -news28|sony vt100 emulator 28 lines:\ - :bs:\ - :li#28:\ - :is=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;28r\E8:tc=news-old-unk: -# -# (news29: this had :TY=ascii:KB=nws1200:\ --esr) -news29|news28-a|sony vt100 emulator 29 lines:\ - :li#29:\ - :is=\E7\E[r\E8\EE\EE\EE\EM\EM\EM\E[?7h\E[?1l\E[?3l\E7\E[1;29r\E8:tc=news-old-unk: -# -# (news511: this had :TY=sjis: --esr) -nwp511|nwp-511|nwp-511 vt100:\ - :am:bs:pt:xn:\ - :co#80:li#24:\ - :al=\E[L:cd=30\E[J:ce=3\E[K:cl=20\E[;H\E[2J:\ - :cm=\E[%i%d;%dH:dl=\E[M:is=\E[?5l\E[?1l\E>\E[?7h\E[?8h:\ - :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:k5=\EOT:k6=\E#W:kd=\E[B:\ - :kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:nd=\E[C:\ - :rs=\E7\E[r\E8\E[?5l\E[?1l\E>\E[?7h\E[?8h:se=2\E[m:\ - :so=2\E[7m:sr=5\EM:ue=2\E[m:up=2\E[A:us=2\E[4m:\ - :vb=\E[?5h\0\0\0\0\0\0\0\0\0\0\0\0\0\E[?5l: -# (news517: this had :TY=sjis:. --esr) -nwp517|nwp-517|nwp-517 vt200 80 cols 30 rows:\ - :es:hs:\ - :co#80:li#30:\ - :ds=\E[1$~:fs=\E[0$}:i2=\E[2$~\n:\ - :is=\E7\E[r\E8\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:\ - :ts=\E[1$}\E[;%df:\ - :tc=vt200: -# (news517-w: this had :TY=sjis:. --esr) -nwp517-w|nwp-517-w|nwp-517 vt200 132 cols 50 rows:\ - :es:hs:\ - :co#132:li#50:\ - :ds=\E[1$~:fs=\E[0$}:i2=\E[2$~\n:\ - :is=\E7\E[r\E8\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h:\ - :rs=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h:\ - :ts=\E[1$}\E[;%df:tc=vt200: - -#### Obsolete virtual-terminal types. -# - -# Columbus UNIX virtual terminal. This terminal also appears in -# UNIX 4.0 and successors as line discipline 1 (?), but is -# undocumented and does not really work quite right. -cbunix|cb unix virtual terminal:\ - :am:bs:da:db:\ - :co#80:li#24:lm#0:\ - :al=\EP:bl=^G:cd=\EL:ce=\EK:cl=\EL:cm=\EG%r%.%.:cr=^M:\ - :dc=\EM:dl=\EN:do=^J:ei=:ic=\EO:im=:kd=\EB:kh=\EE:kl=\ED:\ - :kr=\EC:ku=\EA:le=^H:nd=\EC:se=\Eb^D:sf=^J:so=\Ea^D:\ - :ue=\Eb^A:up=\EA:us=\Ea^A: -# (vremote: removed obsolete ":nl@:" -- esr) -vremote|virtual remote terminal:\ - :am@:\ - :co#79:tc=cbunix: - -pty|4bsd pseudo teletype:\ - :cm=\EG%+ %+ :se=\Eb$:so=\Ea$:ue=\Eb\041:us=\Ea\041:tc=cbunix: - -######## OTHER OBSOLETE TYPES -# -# These terminals are *long* dead -- these entries are retained for -# historical interest only. -# - -#### Obsolete non-ANSI software emulations -# - -#### Avatar -# -# These entries attempt to describe Avatar, a terminal emulation used with -# MS-DOS bulletin-board systems. It was designed to give ANSI-like -# capabilities, but with cheaper (shorter) control sequences. Messy design, -# excessively dependent on PC idiosyncracies, but apparently rather popular -# in the BBS world. -# -# No color support. Avatar doesn't fit either of the Tektronix or HP color -# models that terminfo knows about. An Avatar color attribute is the -# low 7 bits of the IBM-PC display-memory attribute. Bletch. -# -# I wrote these entries while looking at the Avatar spec. I don't have -# the facilities to test them. Let me know if they work, or don't. -# -# Avatar escapes not used by these entries (because maybe you're smarter -# and more motivated than I am and can figure out how to wrap terminfo -# around some of them, and because they are weird enough to be funny): -# level 0: -# ^L -- clear window/reset current attribute to default -# ^V^A%p1%c -- set current color attribute, parameter decodes as follows: -# -# bit: 6 5 4 3 2 1 0 -# | | | | | -# +---+---+ | +---+---+ -# | | | -# | | foreground color -# | foreground intensity -# background color -# level 0+: -# ^V^J%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) up by p1 lines -# ^V^K%p1%c%p2%c%p3%c%p4%c%p5%c -- scroll (p2,p3) to (p4,p5) down by p1 lines -# ^V^L%p1%c%p2%c%p3%c -- clear p2 lines and p3 cols w/attr %p1 -# ^V^M%p1%c%p2%c%p3%c%p4%c -- fill p3 lines & p4 cols w/char p2+attr %p1 -# (^V^L and ^V^M set the current attribute as a side-effect.) -# ^V ^Y [...] -- repeat pattern. specifies the number of bytes -# in the pattern, the number of times the pattern -# should be repeated. If either value is 0, no-op. -# The pattern can contain Avatar console codes, -# including other ^V ^Y patterns. -# level 1: -# ^V^O -- clockwise mode on; turn print direction right each time you -# hit a window edge (yes, really). Turned off by CR -# ^V^P -- no-op -# ^V^Q%c -- query the driver -# ^V^R -- driver reset -# ^V^S -- Sound tone (PC-specific) -# ^V^T -- change highlight at current cursor poition to %c -# ^V^U%p1%c%p2%c -- highlight window with attribute -# ^V^V%p1%c%p2%c%p3%c%p4%c%p5%c -# -- define window -# -# From: Eric S. Raymond 1 Nov 1995 -# (The :mb:/:md:/:mr:/:as:/:us:/:so: capabilities exist only to -# tell ncurses that the corresponding highlights exist; it should use :sa:, -# which is the only method that will actually work for multiple highlights.) -avatar0|avatar terminal emulator level 0:\ - :am:ms:ut:\ - :co#80:it#8:li#25:\ - :as=:ce=^V^G:cm=\026\010%.%.:cr=^M:do=^V^D:le=^V^E:\ - :mb=^A^V\177:md=^V^A^P:me=^V^A^G:mk=^V^A\0:mr=^A^Vp:\ - :nd=^V^F:r2=^L:rp=\031%.%d:\ - :..sa=\026\001%{0}%?%p1%t%{112}%|%;%?%p2%t%{1}%|%;%?%p3%t%{112}%|%;%?%p4%t{128}%|%;%?%p6%t%{16}%|%;:\ - :sf=^J:so=^A^Vp:up=^V^C:us=^V^A:\ - :tc=klone+acs: -# From: Eric S. Raymond 1 Nov 1995 -avatar0+|avatar terminal emulator level 0+:\ - :dc=^V^N:ei=\026\n\0\0\0\0:im=^V^I:tc=avatar0: -# From: Eric S. Raymond 1 Nov 1995 -avatar|avatar1|avatar terminal emulator level 1:\ - :RA=^V":SA=^V$:al=^V+:dl=^V-:ei=^V^P:ve=^V'^A:vi=^V'^B:\ - :vs=^V^C:\ - :tc=avatar0+: - -#### RBcomm -# -# RBComm is a lean and mean terminal emulator written by the Interrupt List -# maintainer, Ralf Brown. It was fairly popular in the late DOS years (early -# '90s), especially in the BBS world, and still has some loyal users due to -# its very small memory footprint and to a cute macro language. -rbcomm|IBM PC with RBcomm and EMACS keybindings:\ - :am:bw:mi:ms:xn:\ - :co#80:it#8:li#25:\ - :AL=\E[%dL:DL=\E[%dM:al=^K:bl=^G:bt=\E[Z:cd=^F5:ce=^P^P:\ - :cl=^L:cm=\037%r%+ %+ :cr=^M:cs=\E[%i%d;%dr:dc=^W:dl=^Z:\ - :dm=:do=^C:ec=\E[%dX:ed=:ei=^]:im=^\:\ - :is=\017\035\E(B\E)0\E[?7h\E[?3l\E[>8g:kb=^H:kd=^N:\ - :ke=\E>:kh=^A:kl=^B:kr=^F:ks=\E=:ku=^P:le=^H:mb=\E[5m:\ - :md=\E[1m:me=\E[m:mk=\E[8m:mr=^R:nd=^B:nw=^M\ED:\ - :r1=\017\E(B\E)0\025\E[?3l\E[>8g:rc=\E8:rp=\030%.%.:\ - :sc=\E7:se=^U:sf=\ED:so=^R:sr=\EM:ta=^I:te=:ti=:ue=^U:up=^^:\ - :us=^T:ve=\E[?25h:vi=\E[?25l:vs=\E[?25h: -rbcomm-nam|IBM PC with RBcomm without autowrap:\ - :am@:\ - :bl=^G:cr=^M:do=^J:\ - :is=\017\035\E(B\E)0\E[?7l\E[?3l\E[>8g:kb=^H:kd=^J:\ - :kl=^H:nw=^M^J:sf=^J:ta=^I:\ - :tc=rbcomm: -rbcomm-w|IBM PC with RBcomm in 132 column mode:\ - :co#132:\ - :bl=^G:cr=^M:do=^J:\ - :is=\017\035\E(B\E)0\E[?7h\E[?3h\E[>8g:kb=^H:kd=^J:\ - :kl=^H:nw=^M^J:sf=^J:ta=^I:\ - :tc=rbcomm: - -# CTRM terminal emulator -# 1. underlining is not allowed with colors: first, is is simulated by -# black on white, second, it disables background color manipulations. -# 2. BLINKING, REVERSE and BOLD are allowed with colors, -# so we have to save their status in the static registers A, B and H -# respectively, to be able to restore them when color changes -# (because any color change turns off ALL attributes) -# 3. :md: and :mr: sequences alternate modes, -# rather then simply entering them. Thus we have to check the -# static register B and H to determine the status, before sending the -# escape sequence. -# 4. :me: now must set the status of all 3 register (A,B,H) to zero -# and then reset colors -# 5. implementation of the protect mode would badly penalize the performance. -# we would have to use \E&bn sequence to turn off colors (as well as all -# other attributes), and keep the status of protect mode in yet another -# static variable. If someone really needs this mode, they would have to -# create another terminfo entry. -# 6. original color-pair is white on black. -# store the information about colors into static registers -# 7. set foreground color. it performs the following steps. -# 1) turn off all attributes -# 2) turn on the background and video attributes that have been turned -# on before (this information is stored in static registers X,Y,Z,A,B,H,D). -# 3) turn on foreground attributes -# 4) store information about foreground into U,V,W static registers -# 8. turn on background: similar to turn on foreground above -# (untranslatable capabilities removed to fit entry within 1023 bytes) -ctrm|C terminal emulator:\ - :am:ut:xo:\ - :Co#8:NC#2:Nl#0:co#80:lh#0:li#24:lm#0:lw#0:pa#63:pb#19200:vt#6:\ - :al=\EL:bl=^G:bt=\Ei:cd=\EJ:ce=\EK:ch=\E&a%dC:cl=\EH\EJ:\ - :cm=\E&a%r%dc%dY:cr=^M:ct=\E3:cv=\E&a%dY:dc=\EP:dl=\EM:\ - :do=^J:ei=\ER:im=\EQ:ip=:is=\E&jA\r:k1=\Ep\r:k2=\Eq\r:\ - :k3=\Er\r:k4=\Es\r:k5=\Et\r:k6=\Eu\r:k7=\Ev\r:k8=\Ew\r:\ - :kb=^H:kd=\Ew\r:ke=\E&jA:kh=\Ep\r:kl=\Eu\r:kr=\Ev\r:\ - :ks=\E&jB:ku=\Et\r:le=^H:mb=\E&dA%{1}%PA:\ - :md=%?%gH%{0}%=%t\E&dH%{1}%PH%;:\ - :me=\E&d@%{0}%PA%{0}%PB%{0}%PH:\ - :mr=%?%gB%{0}%=%t\E&dB%{1}%PB%;:nd=\EC:\ - :op=\E&bn\E&bB\E&bG\E&bR%{0}%PX%{0}%PY%{0}%PZ%{1}%PW%{1}%PV%{1}%PU:\ - :sf=^J:so=\E&dD:st=\E1:ta=\011:up=\EA:us=\E&dD: - -# gs6300 - can't use blue foreground, it clashes with underline; -# it's simulated with cyan -# Bug: The capability probably resets attributes. -# (gs6300: commented out (no ) --esr) -gs6300|emots|AT&T PC6300 with EMOTS terminal emulator:\ - :am:ms:ut:xo:\ - :Co#8:co#80:it#8:li#24:pa#63:\ - :AL=\E[%dL:DC=\E[%dP:DL=\E[%dM:DO=\E[%dB:IC=\E[%d@:\ - :LE=\E[%dD:RI=\E[%dC:Sb=\E[?;%dm:\ - :..Sf=\E[?%?%p1%{0}%=%t0%e%p1%{1}%=%t2%e%p1%{1}%-%d%;m:\ - :UP=\E[%dA:\ - :ac=++\054\054--..``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=\E[10m:al=\E[L:as=\E[11m:bl=^G:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:dc=\E[P:dl=\E[M:do=^J:\ - :ei=:ho=\E[H:ic=\E[@:im=:is=\E[m:k1=\E[0s:k2=\E[24s:\ - :k3=\E[1s:k4=\E[23s:k5=\E[2s:k6=\E[22s:k7=\E[3s:k8=\E[21s:\ - :kB=^R^I:kb=^H:kd=\E[B:kh=\E[H:kl=\E[D:kr=\E[C:ku=\E[A:\ - :le=^H:mb=\E[5m:md=\E[1m:me=\E[m\E[10m:mr=\E[7m:nd=\E[C:\ - :op=\E[?;m:pf=\E[4i:po=\E[5i:r1=\Ec:sf=^J:so=\E[1m:sr=\E[L:\ - :ta=^I:up=\E[A:us=\E[4m: - -# From: 29 Oct 85 05:40:18 GMT -# MS-Kermit with Heath-19 emulation mode enabled -# (h19k: changed ":pt@:" to ":it@" -h19k|h19kermit|heathkit emulation provided by Kermit (no auto margin):\ - :am@:da:db:xt:\ - :it@:\ - :ta@:tc=h19-u: - -# Apple Macintosh with Versaterm, a terminal emulator distributed by Synergy -# Software (formerly Peripherals Computers & Supplies, Inc) of -# 2457 Perkiomen Ave., Reading, PA 19606, 1-800-876-8376. They can -# also be reached at support@synergy.com. -versaterm|versaterm vt100 emulator for the macintosh:\ - :am:xn:\ - :co#80:it#8:li#24:\ - :al=9\E[1L:bl=^G:cd=50\E[J:ce=3\E[K:cl=50\E[;H\E[2J:\ - :cm=5\E[%i%d;%dH:cr=^M:cs=\E[%i%d;%dr:dc=7\E[1P:\ - :dl=9\E[1M:do=^J:ei=:ho=\E[H:ic=7\E[1@:im=:\ - :is=\E[1;24r\E[24;1H:k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ - :kb=^H:kd=\EOB:ke=\E>\E[?1l:kl=\EOD:kr=\EOC:ks=\E=\E[?1h:\ - :ku=\EOA:le=^H:mb=2\E[5m:md=2\E[1m:me=2\E[m:mr=2\E[7m:\ - :nd=2\E[C:nw=^M^J:r1=\E>:rc=\E8:\ - :rf=/usr/share/tabset/vt100:sc=\E7:se=2\E[m:so=2\E[7m:\ - :sr=5\EM:ta=^I:ue=2\E[m:up=2\E[A:us=2\E[4m: - -# From: Rick Thomas -# (xtalk: I added / based on the init string. -xtalk|IBM PC with xtalk communication program (versions up to 3.4):\ - :am:mi:ms:xo:\ - :co#80:it#8:li#24:sg#1:vt#3:\ - :@8=\EOM:DO=\E[%dB:K1=\EOq:K2=\EOr:K3=\EOs:K4=\EOp:K5=\EOn:\ - :LE=\E[%dD:RA=\E[?7l:RI=\E[%dC:SA=\E[?7h:UP=\E[%dA:\ - :ac=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~:\ - :ae=^O:al=\E[L:as=^N:bl=^G:cb=\E[1K:cd=\E[J:ce=\E[K:\ - :cl=\E[H\E[J:cm=\E[%i%d;%dH:cr=^M:ct=\E[3g:dl=\E[M:do=^J:\ - :eA=\E(B\E)0:ho=\E[H:k0=\EOy:k1=\EOP:k2=\EOQ:k3=\EOR:\ - :k4=\EOS:k5=\EOt:k6=\EOu:k7=\EOv:k8=\EOl:k9=\EOw:k;=\EOx:\ - :kb=^H:kd=\EOB:ke=\E[?1l\E>:kl=\EOD:kr=\EOC:ks=\E[?1h\E=:\ - :ku=\EOA:le=^H:me=\E[m:nd=\E[C:\ - :r2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h:se=\E[m :sf=^J:\ - :so=\E[7m :sr=\EM:st=\EH:ta=^I:up=\E[A: - -# The official PC terminal emulator program of the AT&T Product Centers. -# Note - insert mode commented out - doesn't seem to work on AT&T PC. -simterm|attpc running simterm:\ - :am:\ - :co#80:li#24:\ - :al=\EL:bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\E=%+ %+ :cr=^M:\ - :dc=\ER:dl=\EM:do=\EB:ho=\EH:le=^H:me=\E&d@:nd=\EC:se=\E&d@:\ - :sf=^J:so=\E&dB:te=\EVE:ti=\EVS:up=\EA: - -#### Miscellaneous obsolete terminals, manufacturers unknown -# -# If you have any information about these (like, a manufacturer's name, -# and a date on the serial-number plate) please send it! - -cad68-3|cgc3|cad68 basic monitor transparent mode size 3 chars:\ - :am:bs:\ - :co#73:li#36:\ - :cl=^Z:ho=^^:le=^H:nd=^L:up=^K: -cad68-2|cgc2|cad68 basic monitor transparent mode size 2 chars:\ - :am:bs:\ - :co#85:li#39:\ - :cl=^Z:ho=^^:k1=\E5:k2=\E6:k3=\E7:k4=\E8:kd=\E2:kl=\E3:\ - :kr=\E4:ku=\E1:le=^H:nd=^L:se=\Em^C:so=\Em^L:up=^K: -cops10|cops|cops-10|cops 10:\ - :am:bw:\ - :co#80:li#24:\ - :bl=^G:cd=^W:ce=^V:cl=30\030:cm=\020%+ %+ :cr=^M:do=^J:\ - :kb=^H:kd=^J:kh=^Y:kl=^H:kr=^L:ku=^K:le=^H:nd=^L:sf=^J:up=^K: -# (d132: removed duplicate :ic=\E5:, -# merged in capabilities from a BRL entry -- esr) -d132|datagraphix|datagraphix 132a:\ - :da:db:in:\ - :co#80:li#30:\ - :al=\E3:bl=^G:cl=^L:cm=\E8%i%3%3:cr=^M:dc=\E6:do=^J:ei=:\ - :ho=\ET:ic=\E5:im=:kb=^H:kd=^J:kl=^H:le=^H:nd=\EL:nw=^M^J:\ - :sf=^J:sr=\Ew:ta=^I:up=\EK:ve=\Em\En:vs=\Ex: -# The d800 was an early portable terminal from c.1984-85 that looked a lot -# like the original Compaq `lunchbox' portable (but no handle). It had a vt220 -# mode (which is what this entry looks like) and several other lesser-known -# emulations. -d800|Direct 800/A:\ - :am:bs:da:db:ms:xs:\ - :co#80:it#8:li#24:\ - :ac=``a1fxgqh0jYk?lZm@nEooppqDrrsstCu4vAwBx3yyzz{{||}}~~:\ - :ae=\E[m:as=\E[1m:bl=^G:cd=\E[J:ce=\E[K:cl=\E[1;1H\E[2J:\ - :cm=\E[%i%d;%dH:cr=^M:do=^J:k1=\EOP:k2=\EOQ:k3=\EOR:\ - :k4=\EOS:k5=\EOT:k6=\EOU:k7=\EOV:k8=\EOW:kd=\E[B:kl=\E[D:\ - :kr=\E[C:ku=\E[A:le=^H:me=\E[m:nd=\E[C:se=\E[m:sf=\ED:\ - :so=\E[7m:sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m:ve=\E[>12h:\ - :vs=\E[>12l: -digilog|digilog 333:\ - :bs:\ - :co#80:li#16:\ - :bl=^G:ce=^X:cr=^M:do=^J:ho=^N:le=^H:nd=^I:sf=^J:up=^O: -# The DWK was a terminal manufactured in the Soviet Union c.1986 -dwk|dwk-vt|dwk terminal:\ - :am:\ - :co#80:it#8:li#24:\ - :ac=+\136\054Q-S.M0\177`+a\072f'g#h#i#jXkClJmFnNo~qUs_tEuPv\wKxW~_:\ - :ae=\EG:as=\EF:bl=^G:cd=\EJ:ce=\EK:cl=\EH\EJ:cm=\EY%+ %+ :\ - :cr=^M:dc=\EP:do=^J:ei=:ho=\EH:ic=\EQ:im=:k1=\Ef1:k2=\Ef2:\ - :k3=\Ef3:k4=\Ef4:k5=\Ef5:k6=\Ef6:k7=\Ef7:k8=\Ef8:k9=\Ef9:\ - :k;=\Ef0:kD=\Ee:kI=\Ed:kN=\Eh:kP=\Eg:kb=\177:kd=\EB:kl=\ED:\ - :kr=\EC:ku=\EA:le=^H:me=\EX:mr=\ET:nd=\EC:nw=^M^J:se=\EX:\ - :sf=^J:so=\ET:sr=\ES:ta=^I:up=\EA: -env230|envision230|envision 230 graphics terminal:\ - :xn@:\ - :pf=\E[4i:po=\E[5i:ps=\E[0i:\ - :..sa=\E[%?%p1%t;1%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m:tc=vt100: -# These execuports were impact-printer ttys with a 30- or maybe 15-cps acoustic -# coupler attached, the whole rig fitting in a suitcase and more or less -# portable. Hot stuff for c.1977 :-) -- esr -ep48|ep4080|execuport 4080:\ - :am:bs:os:\ - :co#80:\ - :bl=^G:cr=^M:do=^J:hd=^\:hu=^^:le=^H:sf=^J: -ep40|ep4000|execuport 4000:\ - :co#136:tc=ep4080: -# Adam Thompson tells us: -# Informer series - these are all portable units, resembling older -# automatic bread-baking machines. The terminal looks like a `clamshell' -# design, but isn't. The structure is similar to the Direct terminals, -# but only half the width. The entire unit is only about 10" wide. -# It features an 8" screen (6" or 7" if you have color!), and an 9"x6" -# keyboard. All the keys are crammed together, much like some laptop -# PCs today, but perhaps less well organized...all these units have a -# bewildering array of plugs on the back, including a built-in modem. -# The 305 was a color version of the 304; the 306 and 307 were mono and -# color terminals built for IBM bisync protocols. -# From: Paul Leondis -ifmr|Informer D304:\ - :am:bs:\ - :co#80:li#24:\ - :cd=\E/:ce=\EQ:cl=\EZ:cm=\EY%r%+ %+ :dc=\E\:do=^J:ei=:\ - :ho=\EH:ic=\E[:im=:le=^H:me=\EK:nd=\EC:se=\EK:so=\EJ:sr=\En:\ - :up=\EA: -# Entry largely based on wy60 and has the features of wy60ak. -# (untranslatable capabilities removed to fit entry within 1023 bytes) -# (sgr removed to fit entry within 1023 bytes) -# (terminfo-only capabilities suppressed to fit entry within 1023 bytes) -opus3n1+|Esprit Opus3n1+ in wy60 mode with ANSI arrow keys:\ - :am:bw:hs:km:mi:ms:ul:xo:\ - :co#80:li#24:ws#80:\ - :ae=\EH^C:al=\EE:as=\EH^B:bl=^G:bt=\EI:cd=\EY:ce=\ET:cl=\E*:\ - :cm=\Ea%i%dR%dC:cr=^M:ct=\E0:dc=\EW:dl=\ER:do=^J:ds=\Ez(\r:\ - :ei=\Er:fs=^M:ho=\036:if=/usr/share/tabset/std:im=\Eq:ip=:\ - :is=\E`\072\Ee(\EO\Ee6\Ec41\E~4\Ec21\Ed/\Ezz&\E[A\177\Ezz'\E[B\177\Ezz(\E[D\177\Ezz)\E[C\177\Ezz<\E[Q\177\Ezz`\E[F\177\EA1*\EZH12:\ - :k1=^A@\r:k2=^AA\r:k3=^AB\r:k4=^AC\r:k5=^AD\r:k6=^AE\r:\ - :k7=^AF\r:k8=^AG\r:k9=^AH\r:kD=\EW:kI=\EQ:kN=\EK:kP=\EJ:\ - :kb=^H:kd=\E[B:kh=^^:kl=\E[D:kr=\E[C:ku=\E[A:le=^H:mb=\EG2:\ - :me=\E(\EH\003\EG0\EcD:mh=\EGp:nd=^L:nw=\r\n:sf=^J:sr=\Ej:\ - :st=\E1:ta=\011:te=:\ - :ti=\Ezz&\E[A\177\Ezz'\E[B\177\Ezz(\E[D\177\Ezz)\E[C\177\Ezz<\E[Q\177:\ - :ts=\Ez(:uc=\EG8%p1%c\EG0:up=^K:ve=\E`1:vi=\E`0:\ - :tc=adm+sgr: -teletec|Teletec Datascreen:\ - :am:bs:\ - :co#80:li#24:\ - :bl=^G:cl=^L:cr=^M:do=^J:ho=^^:le=^H:nd=^_:sf=^J:up=^K: -# From: Mark Dornfeld -# This description is for the LANPAR Technologies VISION 3220 -# terminal from 1984/85. The function key definitions k0-k5 represent the -# edit keypad: FIND, INSERT HERE, REMOVE, SELECT, PREV SCREEN, -# NEXT SCREEN. The key definitions k6-k9 represent the PF1 to PF4 keys. -# -# Kenneth Randell writes on 31 Dec 1998: -# I had a couple of scopes (3221) like this once where I used to work, around -# the 1987 time frame if memory serves me correctly. These scopes were made -# by an outfit called LANPAR Technologies, and were meant to me DEC VT 220 -# compatible. The 3220 was a plain text terminal like the VT-220, the 3221 -# was a like the VT-240 (monochrome with Regis + Sixel graphics), and the 3222 -# was like the VT-241 (color with Regis + Sixel Graphics). These terminals -# (3221) cost about $1500 each, and one was always broken -- had to be sent -# back to the shop for repairs. -# The only real advantage these scopes had over the VT-240's were: -# 1) They were faster in the Regis display, or at least the ones I did -# 2) They had a handy debugging feature where you could split-screen the -# scope, the graphics would appear on the top, and the REGIS commands would -# appear on the bottom. I don't remember the VT-240s being able to do that. -# I would swear that LANPAR Technologies was in MA someplace, but since I -# don't work at the same place anymore, and those terminals and manuals were -# long since junked, I cannot be any more sure than that. -# -# (v3220: removed obsolete ":kn#10:", -# I added / based on the init string -- esr) -v3220|LANPAR Vision II model 3220/3221/3222:\ - :am:bs:mi:xn:\ - :co#80:it#8:li#24:\ - :RA=\E[?7l:SA=\E[?7h:al=\E[L:cd=\E[J:ce=\E[K:cl=\E[H\E[J:\ - :cm=\E[%i%d;%dH:dc=\E[P:dl=\E[M:ei=\E[4l:im=\E[4h:\ - :is=\E>\E[?3l\E[?7h\E[?8h\E[p:k0=\E[1~:k1=\E[2~:\ - :k2=\E[3~:k3=\E[4~:k4=\E[5~:k5=\E[6~:k6=\E[OP:k7=\E[OQ:\ - :k8=\E[OR:k9=\E[OS:kd=\E[B:ke=\E>:kh=\E[H:kl=\E[D:kr=\E[C:\ - :ks=\E=:ku=\E[A:le=^H:me=\E[m:nd=\E[C:se=\E[m:so=\E[7m:\ - :sr=\EM:ta=^I:ue=\E[m:up=\E[A:us=\E[4m: -######## ICH/ICH1 VERSUS RMIR/SMIR -# -# Some non-curses applications get confused if both ich/ich1 and rmir/smir -# are present; the symptom is doubled characters in an update using insert. -# These applications are technically correct; in both 4.3BSD termcap and -# terminfo, you're not actually supposed to specify both ich/ich1 and rmir/smir -# unless the terminal needs both. To my knowledge, no terminal still in this -# file requires both other than the very obsolete dm2500. -# -# For ncurses-based applications this is not a problem, as ncurses uses -# one or the other as appropriate but never mixes the two. Therefore we -# have not corrected entries like `linux' and `xterm' that specify both. -# If you see doubled characters from these, use the linux-nic and xterm-nic -# entries that suppress ich/ich1. And upgrade to ncurses! -# - -######## VT100/ANSI/ISO 6429/ECMA-48/PC-TERM TERMINAL STANDARDS -# -# ANSI X3.64 has been withdrawn and replaced by ECMA-48. The ISO 6429 and -# ECMA-48 standards are said to be almost identical, but are not the same -# as X3.64 (though for practical purposes they are close supersets of it). -# -# You can obtain ECMA-48 for free by sending email to helpdesk@ecma.ch -# requesting the standard(s) you want (i.e. ECMA-48, "Control Functions for -# Coded Character Sets"), include your snail-mail address, and you should -# receive the document in due course. Don't expect an email acknowledgement. -# -# Related standards include "X3.4-1977: American National Standard Code for -# Information Interchange" (the ASCII standard) and "X3.41.1974: -# Code-Extension Techniques for Use with the 7-Bit Coded Character Set of -# American National Standard for Information Interchange." I believe (but -# am not certain) that these are effectively identical to ECMA-6 and ECMA-35 -# respectively. -# - -#### VT100/ANSI/ECMA-48 -# -# ANSI Standard (X3.64) Control Sequences for Video Terminals and Peripherals -# and ECMA-48 Control Functions for Coded Character Sets. -# -# Much of the content of this comment is adapted from a table prepared by -# Richard Shuford, based on a 1984 Byte article. Terminfo correspondences, -# discussion of some terminfo-related issues, and updates to capture ECMA-48 -# have been added. Control functions described in ECMA-48 only are tagged -# with * after their names. -# -# The table is a complete list of the defined ANSI X3.64/ECMA-48 control -# sequences. In the main table, \E stands for an escape (\033) character, -# SPC for space. Pn stands for a single numeric parameter to be inserted -# in decimal ASCII. Ps stands for a list of such parameters separated by -# semicolons. Parameter meanings for most parametrized sequences are -# decribed in the notes. -# -# Sequence Sequence Parameter or -# Mnemonic Name Sequence Value Mode terminfo -# ----------------------------------------------------------------------------- -# APC Applicatn Program Command \E _ - Delim - -# BEL Bell * ^G - - bel -# BPH Break Permitted Here * \E B - * - -# BS Backpace * ^H - EF - -# CAN Cancel * ^X - - - (A) -# CBT Cursor Backward Tab \E [ Pn Z 1 eF cbt -# CCH Cancel Previous Character \E T - - - -# CHA Cursor Horizntal Absolute \E [ Pn G 1 eF hpa (B) -# CHT Cursor Horizontal Tab \E [ Pn I 1 eF tab (C) -# CMD Coding Method Delimiter * \E -# CNL Cursor Next Line \E [ Pn E 1 eF nel (D) -# CPL Cursor Preceding Line \E [ Pn F 1 eF - -# CPR Cursor Position Report \E [ Pn ; Pn R 1, 1 - - (E) -# CSI Control Sequence Intro \E [ - Intro - -# CTC Cursor Tabulation Control \E [ Ps W 0 eF - (F) -# CUB Cursor Backward \E [ Pn D 1 eF cub -# CUD Cursor Down \E [ Pn B 1 eF cud -# CUF Cursor Forward \E [ Pn C 1 eF cuf -# CUP Cursor Position \E [ Pn ; Pn H 1, 1 eF cup (G) -# CUU Cursor Up \E [ Pn A 1 eF cuu -# CVT Cursor Vertical Tab \E [ Pn Y - eF - (H) -# DA Device Attributes \E [ Pn c 0 - - -# DAQ Define Area Qualification \E [ Ps o 0 - - -# DCH Delete Character \E [ Pn P 1 eF dch -# DCS Device Control String \E P - Delim - -# DL Delete Line \E [ Pn M 1 eF dl -# DLE Data Link Escape * ^P - - - -# DMI Disable Manual Input \E \ - Fs - -# DSR Device Status Report \E [ Ps n 0 - - (I) -# DTA Dimension Text Area * \E [ Pn ; Pn SPC T - PC - -# EA Erase in Area \E [ Ps O 0 eF - (J) -# ECH Erase Character \E [ Pn X 1 eF ech -# ED Erase in Display \E [ Ps J 0 eF ed (J) -# EF Erase in Field \E [ Ps N 0 eF - -# EL Erase in Line \E [ Ps K 0 eF el (J) -# EM End of Medium * ^Y - - - -# EMI Enable Manual Input \E b Fs - -# ENQ Enquire ^E - - - -# EOT End Of Transmission ^D - * - -# EPA End of Protected Area \E W - - - (K) -# ESA End of Selected Area \E G - - - -# ESC Escape ^[ - - - -# ETB End Transmission Block ^W - - - -# ETX End of Text ^C - - - -# FF Form Feed ^L - - - -# FNK Function Key * \E [ Pn SPC W - - - -# GCC Graphic Char Combination* \E [ Pn ; Pn SPC B - - - -# FNT Font Selection \E [ Pn ; Pn SPC D 0, 0 FE - -# GSM Graphic Size Modify \E [ Pn ; Pn SPC B 100, 100 FE - (L) -# GSS Graphic Size Selection \E [ Pn SPC C none FE - -# HPA Horz Position Absolute \E [ Pn ` 1 FE - (B) -# HPB Char Position Backward \E [ j 1 FE - -# HPR Horz Position Relative \E [ Pn a 1 FE - (M) -# HT Horizontal Tab * ^I - FE - (N) -# HTJ Horz Tab w/Justification \E I - FE - -# HTS Horizontal Tab Set \E H - FE hts -# HVP Horz & Vertical Position \E [ Pn ; Pn f 1, 1 FE - (G) -# ICH Insert Character \E [ Pn @ 1 eF ich -# IDCS ID Device Control String \E [ SPC O - * - -# IGS ID Graphic Subrepertoire \E [ SPC M - * - -# IL Insert Line \E [ Pn L 1 eF il -# IND Index \E D - FE - -# INT Interrupt \E a - Fs - -# JFY Justify \E [ Ps SPC F 0 FE - -# IS1 Info Separator #1 * ^_ - * - -# IS2 Info Separator #1 * ^^ - * - -# IS3 Info Separator #1 * ^] - * - -# IS4 Info Separator #1 * ^\ - * - -# LF Line Feed ^J - - - -# LS1R Locking Shift Right 1 * \E ~ - - - -# LS2 Locking Shift 2 * \E n - - - -# LS2R Locking Shift Right 2 * \E } - - - -# LS3 Locking Shift 3 * \E o - - - -# LS3R Locking Shift Right 3 * \E | - - - -# MC Media Copy \E [ Ps i 0 - - (S) -# MW Message Waiting \E U - - - -# NAK Negative Acknowledge * ^U - * - -# NBH No Break Here * \E C - - - -# NEL Next Line \E E - FE nel (D) -# NP Next Page \E [ Pn U 1 eF - -# NUL Null * ^@ - - - -# OSC Operating System Command \E ] - Delim - -# PEC Pres. Expand/Contract * \E Pn SPC Z 0 - - -# PFS Page Format Selection * \E Pn SPC J 0 - - -# PLD Partial Line Down \E K - FE - (T) -# PLU Partial Line Up \E L - FE - (U) -# PM Privacy Message \E ^ - Delim - -# PP Preceding Page \E [ Pn V 1 eF - -# PPA Page Position Absolute * \E [ Pn SPC P 1 FE - -# PPB Page Position Backward * \E [ Pn SPC R 1 FE - -# PPR Page Position Forward * \E [ Pn SPC Q 1 FE - -# PTX Parallel Texts * \E [ \ - - - -# PU1 Private Use 1 \E Q - - - -# PU2 Private Use 2 \E R - - - -# QUAD Typographic Quadding \E [ Ps SPC H 0 FE - -# REP Repeat Char or Control \E [ Pn b 1 - rep -# RI Reverse Index \E M - FE - (V) -# RIS Reset to Initial State \E c - Fs - -# RM Reset Mode * \E [ Ps l - - - (W) -# SACS Set Add. Char. Sep. * \E [ Pn SPC / 0 - - -# SAPV Sel. Alt. Present. Var. * \E [ Ps SPC ] 0 - - (X) -# SCI Single-Char Introducer \E Z - - - -# SCO Sel. Char. Orientation * \E [ Pn ; Pn SPC k - - - -# SCS Set Char. Spacing * \E [ Pn SPC g - - - -# SD Scroll Down \E [ Pn T 1 eF rin -# SDS Start Directed String * \E [ Pn ] 1 - - -# SEE Select Editing Extent \E [ Ps Q 0 - - (Y) -# SEF Sheet Eject & Feed * \E [ Ps ; Ps SPC Y 0,0 - - -# SGR Select Graphic Rendition \E [ Ps m 0 FE sgr (O) -# SHS Select Char. Spacing * \E [ Ps SPC K 0 - - -# SI Shift In ^O - - - (P) -# SIMD Sel. Imp. Move Direct. * \E [ Ps ^ - - - -# SL Scroll Left \E [ Pn SPC @ 1 eF - -# SLH Set Line Home * \E [ Pn SPC U - - - -# SLL Set Line Limit * \E [ Pn SPC V - - - -# SLS Set Line Spacing * \E [ Pn SPC h - - - -# SM Select Mode \E [ Ps h none - - (W) -# SO Shift Out ^N - - - (Q) -# SOH Start Of Heading * ^A - - - -# SOS Start of String * \E X - - - -# SPA Start of Protected Area \E V - - - (Z) -# SPD Select Pres. Direction * \E [ Ps ; Ps SPC S 0,0 - - -# SPH Set Page Home * \E [ Ps SPC G - - - -# SPI Spacing Increment \E [ Pn ; Pn SPC G none FE - -# SPL Set Page Limit * \E [ Ps SPC j - - - -# SPQR Set Pr. Qual. & Rapid. * \E [ Ps SPC X 0 - - -# SR Scroll Right \E [ Pn SPC A 1 eF - -# SRCS Set Reduced Char. Sep. * \E [ Pn SPC f 0 - - -# SRS Start Reversed String * \E [ Ps [ 0 - - -# SSA Start of Selected Area \E F - - - -# SSU Select Size Unit * \E [ Pn SPC I 0 - - -# SSW Set Space Width * \E [ Pn SPC [ none - - -# SS2 Single Shift 2 (G2 set) \E N - Intro - -# SS3 Single Shift 3 (G3 set) \E O - Intro - -# ST String Terminator \E \ - Delim - -# STAB Selective Tabulation * \E [ Pn SPC ^ - - - -# STS Set Transmit State \E S - - - -# STX Start pf Text * ^B - - - -# SU Scroll Up \E [ Pn S 1 eF indn -# SUB Substitute * ^Z - - - -# SVS Select Line Spacing * \E [ Pn SPC \ 1 - - -# SYN Synchronous Idle * ^F - - - -# TAC Tabul. Aligned Centered * \E [ Pn SPC b - - - -# TALE Tabul. Al. Leading Edge * \E [ Pn SPC a - - - -# TATE Tabul. Al. Trailing Edge* \E [ Pn SPC ` - - - -# TBC Tab Clear \E [ Ps g 0 FE tbc -# TCC Tabul. Centered on Char * \E [ Pn SPC c - - - -# TSR Tabulation Stop Remove * \E [ Pn SPC d - FE - -# TSS Thin Space Specification \E [ Pn SC E none FE - -# VPA Vert. Position Absolute \E [ Pn d 1 FE vpa -# VPB Line Position Backward * \E [ Pn k 1 FE - -# VPR Vert. Position Relative \E [ Pn e 1 FE - (R) -# VT Vertical Tabulation * ^K - FE - -# VTS Vertical Tabulation Set \E J - FE - -# -# --------------------------------------------------------------------------- -# -# Notes: -# -# Some control characters are listed in the ECMA-48 standard without -# being assigned functions relevant to terminal control there (they -# referred to other standards such as ISO 1745 or ECMA-35). They are listed -# here anyway for completeness. -# -# (A) ECMA-48 calls this "CancelCharacter" but retains the CCH abbreviation. -# -# (B) There seems to be some confusion abroad between CHA and HPA. Most -# `ANSI' terminals accept the CHA sequence, not the HPA. but terminfo calls -# the capability (hpa). ECMA-48 calls this "Cursor Character Absolute" but -# preserved the CHA abbreviation. -# -# (C) CHT corresponds to terminfo (tab). Usually it has the value ^I. -# Occasionally (as on, for example, certain HP terminals) this has the HTJ -# value. ECMA-48 calls this "Cursor Forward Tabulation" but preserved the -# CHT abbreviation. -# -# (D) terminfo (nel) is usually \r\n rather than ANSI \EE. -# -# (E) ECMA-48 calls this "Active Position Report" but preserves the CPR -# abbreviation. -# -# (F) CTC parameter values: 0 = set char tab, 1 = set line tab, 2 = clear -# char tab, 3 = clear line tab, 4 = clear all char tabs on current line, -# 5 = clear all char tabs, 6 = clear all line tabs. -# -# (G) CUP and HVP are identical in effect. Some ANSI.SYS versions accept -# HVP, but always allow CUP as an alternate. ECMA-48 calls HVP "Character -# Position Absolute" but retains the HVP abbreviation. -# -# (H) ECMA calls this "Cursor Line Tabulation" but preserves the CVT -# abbreviation. -# -# (I) DSR parameter values: 0 = ready, 1 = busy, 2 = busy, will send DSR -# later, 3 = malfunction, 4 = malfunction, will send DSR later, 5 = request -# DSR, 6 = request CPR response. -# -# (J) ECMA calls ED "Erase In Page". EA/ED/EL parameters: 0 = clear to end, -# 1 = clear from beginning, 2 = clear. -# -# (K) ECMA calls this "End of Guarded Area" but preserves the EPA abbreviation. -# -# (L) The GSM parameters are vertical and horizontal parameters to scale by. -# -# (M) Some ANSI.SYS versions accept HPR, but more commonly `ANSI' terminals -# use CUF for this function and ignore HPR. ECMA-48 calls this "Character -# Position Relative" but retains the HPR abbreviation. -# -# (N) ECMA-48 calls this "Character Tabulation" but retains the HT -# abbreviation. -# -# (O) SGR parameter values: 0 = default mode (attributes off), 1 = bold, -# 2 = dim, 3 = italicized, 4 = underlined, 5 = slow blink, 6 = fast blink, -# 7 = reverse video, 8 = invisible, 9 = crossed-out (marked for deletion), -# 10 = primary font, 10 + n (n in 1..9) = nth alternative font, 20 = Fraktur, -# 21 = double underline, 22 = turn off 2, 23 = turn off 3, 24 = turn off 4, -# 25 = turn off 5, 26 = proportional spacing, 27 = turn off 7, 28 = turn off -# 8, 29 = turn off 9, 30 = black fg, 31 = red fg, 32 = green fg, 33 = yellow -# fg, 34 = blue fg, 35 = magenta fg, 36 = cyan fg, 37 = white fg, 38 = set -# fg color as in CCIT T.416, 39 = set default fg color, 40 = black bg -# 41 = red bg, 42 = green bg, 43 = yellow bg, 44 = blue bg, 45 = magenta bg, -# 46 = cyan bg, 47 = white bg, 48 = set bg color as in CCIT T.416, 39 = set -# default bg color, 50 = turn off 26, 51 = framed, 52 = encircled, 53 = -# overlined, 54 = turn off 51 & 52, 55 = not overlined, 56-59 = reserved, -# 61-65 = variable highlights for ideograms. -# -# (P) SI is also called LSO, Locking Shift Zero. -# -# (Q) SI is also called LS1, Locking Shift One. -# -# (R) Some ANSI.SYS versions accept VPR, but more commonly `ANSI' terminals -# use CUD for this function and ignore VPR. ECMA calls it `Line Position -# Absolute' but retains the VPA abbreviation. -# -# (S) MC parameters: 0 = start xfer to primary aux device, 1 = start xfer from -# primary aux device, 2 = start xfer to secondary aux device, 3 = start xfer -# from secondary aux device, 4 = stop relay to primary aux device, 5 = -# start relay to primary aux device, 6 = stop relay to secondary aux device, -# 7 = start relay to secondary aux device. -# -# (T) ECMA-48 calls this "Partial Line Forward" but retains the PLD -# abbreviation. -# -# (U) ECMA-48 calls this "Partial Line Backward" but retains the PLD -# abbreviation. -# -# (V) ECMA-48 calls this "Reverse Line Feed" but retains the RI abbreviation. -# -# (W) RM/SM modes are as follows: 1 = Guarder Area Transfer Mode (GATM), -# 2 = Keyboard Action Mode (KAM), 3 = Control Representation Mode (CRM), -# 4 = Insertion Replacement Mode, 5 = Status Report Transfer Mode (SRTM), -# 6 = Erasure Mode (ERM), 7 = Line Editing Mode (LEM), 8 = Bi-Directional -# Support Mode (BDSM), 9 = Device Component Select Mode (DCSM), -# 10 = Character Editing Mode (HEM), 11 = Positioning Unit Mode (PUM), -# 12 = Send/Receive Mode, 13 = Format Effector Action Mode (FEAM), -# 14 = Format Effector Transfer Mode (FETM), 15 = Multiple Area Transfer -# Mode (MATM), 16 = Transfer Termination Mode, 17 = Selected Area Transfer -# Mode, 18 = Tabulation Stop Mode, 19 = Editing Boundary Mode, 20 = Line Feed -# New Line Mode (LF/NL), Graphic Rendition Combination Mode (GRCM), 22 = -# Zero Default Mode (ZDM). The EBM and LF/NL modes have actually been removed -# from ECMA-48's 5th edition but are listed here for reference. -# -# (X) Select Alternate Presentation Variants is used only for non-Latin -# alphabets. -# -# (Y) "Select Editing Extent" (SEE) was ANSI "Select Edit Extent Mode" (SEM). -# -# (Z) ECMA-48 calls this "Start of Guarded Area" but retains the SPA -# abbreviation. -# -# --------------------------------------------------------------------------- -# -# Abbreviations: -# -# Intro an Introducer of some kind of defined sequence; the normal 7-bit -# X3.64 Control Sequence Introducer is the two characters "Escape [" -# -# Delim a Delimiter -# -# x/y identifies a character by position in the ASCII table (column/row) -# -# eF editor function (see explanation) -# -# FE format effector (see explanation) -# -# F is a Final character in -# an Escape sequence (F from 3/0 to 7/14 in the ASCII table) -# a control sequence (F from 4/0 to 7/14) -# -# Gs is a graphic character appearing in strings (Gs ranges from -# 2/0 to 7/14) in the ASCII table -# -# Ce is a control represented as a single bit combination in the C1 set -# of controls in an 8-bit character set -# -# C0 the familiar set of 7-bit ASCII control characters -# -# C1 roughly, the set of control chars available only in 8-bit systems. -# This is too complicated to explain fully here, so read Jim Fleming's -# article in the February 1983 BYTE, especially pages 214 through 224. -# -# Fe is a Final character of a 2-character Escape sequence that has an -# equivalent representation in an 8-bit environment as a Ce-type -# (Fe ranges from 4/0 to 5/15) -# -# Fs is a Final character of a 2-character Escape sequence that is -# standardized internationally with identical representation in 7-bit -# and 8-bit environments and is independent of the currently -# designated C0 and C1 control sets (Fs ranges from 6/0 to 7/14) -# -# I is an Intermediate character from 2/0 to 2/15 (inclusive) in the -# ASCII table -# -# P is a parameter character from 3/0 to 3/15 (inclusive) in the ASCII -# table -# -# Pn is a numeric parameter in a control sequence, a string of zero or -# more characters ranging from 3/0 to 3/9 in the ASCII table -# -# Ps is a variable number of selective parameters in a control sequence -# with each selective parameter separated from the other by the code -# 3/11 (which usually represents a semicolon); Ps ranges from -# 3/0 to 3/9 and includes 3/11 -# -# * Not relevant to terminal control, listed for completeness only. -# -# Format Effectors versus Editor Functions -# -# A format effector specifies how following output is to be displayed. -# An editor function allows you to modify the display. Informally -# format effectors may be destructive; format effectors should not be. -# -# For instance, a format effector that moves the "active position" (the -# cursor or equivalent) one space to the left would be useful when you want to -# create an overstrike, a compound character made of two standard characters -# overlaid. Control-H, the Backspace character, is actually supposed to be a -# format effector, so you can do this. But many systems use it in a -# nonstandard fashion, as an editor function, deleting the character to the -# left of the cursor and moving the cursor left. When Control-H is assumed to -# be an editor function, you cannot predict whether its use will create an -# overstrike unless you also know whether the output device is in an "insert -# mode" or an "overwrite mode". When Control-H is used as a format effector, -# its effect can always be predicted. The familiar characters carriage -# return, linefeed, formfeed, etc., are defined as format effectors. -# -# NOTES ON THE DEC VT100 IMPLEMENTATION -# -# Control sequences implemented in the VT100 are as follows: -# -# CPR, CUB, CUD, CUF, CUP, CUU, DA, DSR, ED, EL, HTS, HVP, IND, -# LNM, NEL, RI, RIS, RM, SGR, SM, TBC -# -# plus several private DEC commands. -# -# Erasing parts of the display (EL and ED) in the VT100 is performed thus: -# -# Erase from cursor to end of line Esc [ 0 K or Esc [ K -# Erase from beginning of line to cursor Esc [ 1 K -# Erase line containing cursor Esc [ 2 K -# Erase from cursor to end of screen Esc [ 0 J or Esc [ J -# Erase from beginning of screen to cursor Esc [ 1 J -# Erase entire screen Esc [ 2 J -# -# Some brain-damaged terminal/emulators respond to Esc [ J as if it were -# Esc [ 2 J, but this is wrong; the default is 0. -# -# The VT100 responds to receiving the DA (Device Attributes) control -# -# Esc [ c (or Esc [ 0 c) -# -# by transmitting the sequence -# -# Esc [ ? l ; Ps c -# -# where Ps is a character that describes installed options. -# -# The VT100's cursor location can be read with the DSR (Device Status -# Report) control -# -# Esc [ 6 n -# -# The VT100 reports by transmitting the CPR sequence -# -# Esc [ Pl ; Pc R -# -# where Pl is the line number and Pc is the column number (in decimal). -# -# The specification for the DEC VT100 is document EK-VT100-UG-003. - -#### ANSI.SYS -# -# Here is a description of the color and attribute controls supported in the -# the ANSI.SYS driver under MS-DOS. Most console drivers and ANSI -# terminal emulators for Intel boxes obey these. They are a proper subset -# of the ECMA-48 escapes. -# -# 0 all attributes off -# 1 foreground bright -# 4 underscore on -# 5 blink on/background bright (not reliable with brown) -# 7 reverse-video -# 8 set blank (non-display) -# 10 set primary font -# 11 set first alternate font (on PCs, display ROM characters 1-31) -# 12 set second alternate font (on PCs, display IBM high-half chars) -# -# Color attribute sets -# 3n set foreground color / 0=black, 1=red, 2=green, 3=brown, -# 4n set background color \ 4=blue, 5=magenta, 6=cyan, 7=white -# Bright black becomes gray. Bright brown becomes yellow, -# These coincide with the prescriptions of the ISO 6429/ECMA-48 standard. -# -# * If the 5 attribute is on and you set a background color (40-47) it is -# supposed to enable bright background. -# -# * Many VGA cards (such as the Paradise and compatibles) do the wrong thing -# when you try to set a "bright brown" (yellow) background with attribute -# 5 (you get a blinking yellow foreground instead). A few displays -# (including the System V console) support an attribute 6 that undoes this -# braindamage (this is required by iBCS2). -# -# * Some older versions of ANSI.SYS have a bug that causes thems to require -# ESC [ Pn k as EL rather than the ANSI ESC [ Pn K. (This is not ECMA-48 -# compatible.) - -#### Intel Binary Compatibility Standard -# -# For comparison, here are the capabilities implied by the Intel Binary -# Compatibility Standard for UNIX systems (Intel order number 468366-001). -# These recommendations are optional. IBCS2 allows the leading escape to -# be either the 7-bit \E[ or 8-bit \0233 introducer, in accordance with -# the ANSI X.364/ISO 6429/ECMA-48 standard. Here are the iBCS2 capabilities -# (as described in figure 9-3 of the standard). Those expressed in the ibcs2 -# terminfo entry are followed with the corresponding capability in parens: -# -# CSI k disable (n=0) or enable (n=1) keyclick -# CSI 2h lock keyboard -# CSI 2i send screen as input -# CSI 2l unlock keyboard -# CSI 6m enable background color intensity -# CSI <0-2>c reserved -# CSI <0-59>m select graphic rendition -# CSI ;H (cup) cursor to line n and column m -# CSI ;f cursor to line n and column m -# CSI @ (ich) insert characters -# CSI A (cuu) cursor up n lines -# CSI B (cud) cursor down n lines -# CSI C (cuu) cursor right n characters -# CSI D (cud) cursor left n characters -# CSI E cursor down n lines and in first column -# CSI F cursor up n lines and in first column -# CSI G (hpa) position cursor at column n-1 -# CSI J (ed) erase in display -# CSI K (el) erase in line -# CSI L (il) insert line(s) -# CSI P (dch) delete characters -# CSI S (indn) scroll up n lines -# CSI T (rin) scroll down n lines -# CSI X (ech) erase characters -# CSI Z (cbt) back up n tab stops -# CSI ` cursor to column n on line -# CSI a (cuu) cursor right n characters -# CSI d (vpa) cursor to line n -# CSI e cursor down n lines and in first column -# CSI g (cbt) clear all tabs -# CSI z make virtual terminal n active -# CSI ?7h (smam) turn automargin on -# CSI ?7l (rmam) turn automargin off -# CSI s save cursor position -# CSI u restore cursor position to saved value -# CSI =A set overscan color -# CSI =F set normal foreground color -# CSI =G set normal background color -# CSI =H set reverse foreground color -# CSI =I set reverse foreground color -# CSI =J set graphic foreground color -# CSI =K set graphic foreground color -# CSI =g (dispc) display n from alternate graphics character set -# CSI =

;B set bell parameters -# CSI =;C set cursor parameters -# CSI =D enable/disable intensity of background color -# CSI =E set/clear blink vs. bold background -# CSI 7 (sc) (sc) save cursor position -# CSI 8 (rc) (rc) restore cursor position to saved value -# CSI H (hts) (hts) set tab stop -# CSI Q define function key string -# (string must begin and end with delimiter char) -# CSI c (clear) clear screen -# -# The lack of any specification for attributes in SGR (among other things) -# makes this a wretchedly weak standard. The table above is literally -# everything iBSC2 has to say about terminal escape sequences; there is -# no further discussion of their meaning or how to set the parameters -# in these sequences at all. -# - -######## NONSTANDARD CAPABILITY TRANSLATIONS USED IN THIS FILE -# -# The historical termcap file entries were written primarily in 4.4BSD termcap. -# The 4.4BSD termcap set was substantially larger than the original 4.1BSD set, -# with the extension names chosen for compatibility with the termcap names -# assigned in System V terminfo. There are some variant extension sets out -# there. We try to describe them here. -# -# XENIX extensions: -# -# The XENIX extensions include a set of function-key capabilities as follows: -# -# code XENIX variable name terminfo name name clashes? -# ---- ------------------- ------------- ----------------------- -# CL key_char_left -# CR key_char_right -# CW key_change_window create_window -# EN key_end kend -# HM key_home khome -# HP ?? -# LD key_delete_line kdl1 -# LF key_linefeed label_off -# NU key_next_unlocked_cell -# PD key_page_down knp -# PL ?? -# PN start_print mc5 -# PR ?? -# PS stop_print mc4 -# PU key_page_up kpp pulse -# RC key_recalc remove_clock -# RF key_toggle_ref req_for_input -# RT key_return kent -# UP key_up_arrow kcuu1 parm_up_cursor -# WL key_word_left -# WR key_word_right -# -# The XENIX extensions also include the following character-set and highlight -# capabilities: -# -# XENIX terminfo function -# ----- -------- ------------------------------ -# GS smacs start alternate character set -# GE rmacs end alternate character set -# GG :as:/:ae: glitch (analogous to :sg:/:ug:) -# bo blink begin blink (not used in /etc/termcap) -# be end blink (not used in /etc/termcap) -# bb blink glitch (not used in /etc/termcap) -# it dim begin dim (not used in /etc/termcap) -# ie end dim (not used in /etc/termcap) -# ig dim glitch (not used in /etc/termcap) -# -# Finally, XENIX also used the following forms-drawing capabilities: -# -# single double type ASCII approximation -# ------ ------ ------------- ------------------- -# GV Gv vertical line | -# GH Gv horizontal line - _ -# G1 G5 top right corner _ | -# G2 G6 top left corner | -# G3 G7 bottom left corner |_ -# G4 G8 bottom right corner _| -# GD Gd down-tick character T -# GL Gl left-tick character -| -# GR Gr right-tick character |- -# GC Gc middle intersection -|- -# GU Gu up-tick character _|_ -# -# These were invented to take advantage of the IBM PC ROM character set. One -# can compose an acsc string from the single-width characters as follows -# "j{G4}k{G1}l{G2}m{G3}q{GH}x{GV}t{GR}u{GL}v{GU}w{GD}n{GC}" -# When translating a termcap file, ncurses tic will do this automatically. -# The double forms characters don't fit the SVr4 terminfo model. -# -# AT&T Extensions: -# -# The old AT&T 5410, 5420, 5425, pc6300plus, 610, and s4 entries used a set of -# nonstandard capabilities. Its signature is the KM capability, used to name -# some sort of keymap file. EE, BO, CI, CV, XS, DS, FL and FE are in this -# set. Comments in the original, and a little cross-checking with other AT&T -# documentation, seem to establish that BO=:mr: (start reverse video), DS=:mh: -# (start dim), XS=:mk: (secure/invisible mode), EE=:me: (end highlights), -# FL=:LO: (enable soft labels), FE=:LF: (disable soft labels), CI=:vi: (make -# cursor invisible), and CV=:ve: (make cursor normal). -# -# HP Extensions -# -# The HP library (as of mid-1995, their term.h file version 70.1) appears to -# have the System V capabilities up to SVr1 level. After that, it supports -# two nonstandard caps meml and memu corresponding to the old termcap :ml:, -# :mu: capabilities. After that, it supports caps plab_norm, label_on, -# label_off, and key_f11..key_f63 capabilities like SVr4's. This makes the -# HP binary format incompatible with SVr4's. -# -# IBM Extensions -# -# There is a set of nonstandard terminfos used by IBM's AIX operating system. -# The AIX terminfo library diverged from SVr1 terminfo, and replaces all -# capabilities following prtr_non with the following special capabilties: -# box[12], batt[12], colb[0123456789], colf[0123456789], f[01234567], kbtab, -# kdo, kcmd, kcpn, kend, khlp, knl, knpn, kppn, kppn, kquit, ksel, kscl, kscr, -# ktab, kmpf[123456789], apstr, ksf1..ksf10, kf11...kf63, kact, topl, btml, -# rvert, lvert. Some of these are identical to XPG4/SVr4 equivalents: -# kcmd, kend, khlp, and kf11...kf63. Two others (kbtab and ksel) can be -# renamed (to kcbt and kslt). The places in the box[12] capabilities -# correspond to acsc chars, here is the mapping: -# -# box1[0] = ACS_ULCORNER -# box1[1] = ACS_HLINE -# box1[2] = ACS_URCORNER -# box1[3] = ACS_VLINE -# box1[4] = ACS_LRCORNER -# box1[5] = ACS_LLCORNER -# box1[6] = ACS_TTEE -# box1[7] = ACS_RTEE -# box1[8] = ACS_BTEE -# box1[9] = ACS_LTEE -# box1[10] = ACS_PLUS -# -# The box2 characters are the double-line versions of these forms graphics. -# The AIX binary terminfo format is incompatible with SVr4's. -# -# Iris console extensions: -# -# HS is half-intensity start; HE is half-intensity end -# CT is color terminal type (for Curses & rogue) -# CP is color change escape sequence -# CZ are color names (for Curses & rogue) -# -# The ncurses tic utility recognizes HS as an alias for mh . -# -# TC Extensions: -# -# There is a set of extended termcaps associated with something -# called the "Terminal Control" or TC package created by MainStream Systems, -# Winfield Kansas. This one also uses GS/GE for as/ae, and also uses -# CF for civis and CO for cvvis. Finally, they define a boolean :ct: -# that flags color terminals. -# -######## CHANGE HISTORY -# -# The last /etc/termcap version maintained by John Kunze was 8.3, dated 8/5/94. -# Releases 9 and up are maintained by Eric S. Raymond as part of the ncurses -# project. -# -# This file contains all the capability information present in John Kunze's -# last version of the termcap master file, except as noted in the change -# comments at end of file. Some information about very ancient obsolete -# capabilities has been moved to comments. Some all-numeric names of older -# terminals have been retired. -# -# I changed :MT: to :km: (the 4.4BSD name) everywhere. I commented out some -# capabilities (EP, dF, dT, dV, kn, ma, ml, mu, xr, xx) that are no longer -# used by BSD curses. -# -# The 9.1.0 version of this file was translated from my lightly-edited copy of -# 8.3, then mechanically checked against 8.3 using Emacs Lisp code written for -# the purpose. Unless the ncurses tic implementation and the Lisp code were -# making perfectly synchronized mistakes which I then failed to catch by -# eyeball, the translation was correct and perfectly information-preserving. -# -# Major version number bumps correspond to major version changes in ncurses. -# -# Here is a log of the changes since then: -# -# 9.1.0 (Wed Feb 1 04:50:32 EST 1995): -# * First terminfo master translated from 8.3. -# 9.2.0 (Wed Feb 1 12:21:45 EST 1995): -# * Replaced Wyse entries with updated entries supplied by vendor. -# -# 9.3.0 (Mon Feb 6 19:14:40 EST 1995): -# * Added contact & status info from G. Clark Brown . -# 9.3.1 (Tue Feb 7 12:00:24 EST 1995): -# * Better XENIX keycap translation. Describe TC termcaps. -# * Contact and history info supplied by Qume. -# 9.3.2 (Sat Feb 11 23:40:02 EST 1995): -# * Raided the Shuford FTP site for recent termcaps/terminfos. -# * Added information on X3.64 and VT100 standard escape sequences. -# 9.3.3 (Mon Feb 13 12:26:15 EST 1995): -# * Added a correct X11R6 xterm entry. -# * Fixed terminfo translations of padding. -# 9.3.4 (Wed Feb 22 19:27:34 EST 1995): -# * Added correct acsc/smacs/rmacs strings for vt100 and xterm. -# * Added u6/u7/u8/u9 capabilities. -# * Added PCVT entry. -# 9.3.5 (Thu Feb 23 09:37:12 EST 1995): -# * Emacs uses :so:, not :mr:, for its mode line. Fix linux entry -# to use reverse-video standout so Emacs will look right. -# * Added el1 capability to ansi. -# * Added smacs/rmacs to ansi.sys. -# -# 9.4.0 (Sat Feb 25 16:43:25 EST 1995): -# * New mt70 entry. -# * Added COPYRIGHTS AND OTHER DELUSIONS. -# * Added AT&T 23xx & 500/513, vt220 and vt420, opus3n1+, netronics -# smartvid & smarterm, ampex 175 & 219 & 232, -# env230, falco ts100, fluke, intertube, superbrain, ncr7901, vic20, -# ozzie, trs200, tr600, Tandy & Texas Instruments VDTs, intext2, -# screwpoint, fviewpoint, Contel Business Systems, Datamedia Colorscan, -# adm36, mime314, ergo4000, ca22851. Replaced att7300, esprit, dd5500. -# * Replaced the Perkin-Elmer entries with vendor's official ones. -# * Restored the old minimal-ansi entry, luna needs it. -# * Fixed some incorrect ip and proportional-padding translations. -# 9.4.1 (Mon Feb 27 14:18:33 EST 1995): -# * Fix linux & AT386 sgr strings to do A_ALTCHARSET turnoff correctly. -# * Make the xterm entry 65 lines again; create xterm25 and xterm24 -# to force a particular height. -# * Added beehive4 and reorganized other Harris entries. -# 9.4.2 (Thu Mar 9 01:45:44 EST 1995): -# * Merged in DEC's official entries for its terminals. The only old -# entry I kept was Doug Gwyn's alternate vt100 (as vt100-avo). -# * Replaced the translated BBN Bitgraph entries with purpose-built -# ones from AT&T's SVr3. -# * Replaced the AT&T entries with AT&T's official terminfos. -# * Added teleray 16, vc415, cops10. -# * Merged in many individual capabilities from SCO terminfo files. -# 9.4.3 (Mon Mar 13 02:37:53 EST 1995): -# * Typo fixes. -# * Change linux entry so A_PROTECT enables IBM-PC ROM characters. -# 9.4.4 (Mon Mar 27 12:32:35 EST 1995): -# * Added tty35, Ann Arbor Guru series. vi300 and 550, cg7900, tvi803, -# pt210, ibm3164, IBM System 1, ctrm, Tymshare scanset, dt200, adm21, -# simterm, citoh and variants. -# * Replaced sol entry with sol1 and sol2. -# * Replaced Qume QVT and Freedom-series entries with purpose-built -# terminfo entries. -# * Enhanced vt220, tvi910, tvi924, hpterm, hp2645, adm42, tek -# and dg200 entries using caps from from SCO. -# * Added the usual set of function-key mappings to ANSI entry. -# * Corrected xterm's function-key capabilities. -# 9.4.5 (Tue Mar 28 14:27:49 EST 1995): -# * Fix in xterm entry, cub and cud are not reliable under X11R6. -# 9.4.6 (Thu Mar 30 14:52:15 EST 1995): -# * Fix in xterm entry, get the arrow keys right. -# * Change some \0 escapes to \200. -# 9.4.7 (Tue Apr 4 11:27:11 EDT 1995) -# * Added apple (Videx card), adm1a, oadm31. -# * Fixed malformed ampex csr. -# * Fixed act4, cyb110; they had old-style prefix padding left in. -# * Changed mandatory to advisory padding in many entries. -# * Replaced HP entries up to hpsub with purpose-built ones. -# * Blank rmir/smir/rmdc/smdc capabilities removed. -# * Small fixes merged in from SCO entries for lpr, fos, tvi910+, tvi924. -# 9.4.8 (Fri Apr 7 09:36:34 EDT 199): -# * Replaced the Ann Arbor entries with SCO's, the init strings are -# more efficient (but the entries otherwise identical). -# * Added dg211 from Shuford archive. -# * Added synertek, apple-soroc, ibmpc, pc-venix, pc-coherent, xtalk, -# adm42-nl, pc52, gs6300, xerox820, uts30. -# * Pull SCO's padding into vi200 entry. -# * Improved capabilities for tvi4107 and other Televideo and Viewpoint -# entries merged in from SCO's descriptions. -# * Fixed old-style prefix padding on zen50, h1500. -# * Moved old superbee entry to superbee-xsb, pulled in new superbee -# entry from SCO's description. -# * Reorganized the special entries. -# * Added lm#0 to cbunix and virtual entries. -# -# 9.5.0 (Mon Apr 10 11:30:00 EDT 1995): -# * Restored cdc456tst. -# * Fixed sb1 entry, SCO erroneously left out the xsb glitch. -# * Added megatek, beacon, microkit. -# * Freeze for ncurses-1.9 release. -# 9.5.1 (Fri Apr 21 12:46:42 EDT 1995): -# * Added historical data for TAB. -# * Comment fixes from David MacKenzie. -# * Added the new BSDI pc3 entry. -# 9.5.2 (Tue Apr 25 17:27:52 EDT 1995) -# * A change in the tic -C logic now ensures that all entries in -# the termcap translation will fit in < 1024 bytes. -# * Added `bobcat' and `gator' HP consoles and the Nu machine entries -# from GNU termcap file. This merges in all their local information. -# 9.5.3 (Tue Apr 25 22:28:13 EDT 1995) -# * Changed tic -C logic to dump all capabilities used by GNU termcap. -# * Added warnings about entries with long translations (restoring -# all the GNU termcaps pushes a few over the edge). -# 9.5.4 (Wed Apr 26 15:35:09 EDT 1995) -# * Yet another tic change, and a couple of entry tweaks, to reduce the -# number of long (> 1024) termcap translations back to 0. -# -# 9.6.0 (Mon May 1 10:35:54 EDT 1995) -# * Added kf13-kf20 to Linux entry. -# * Regularize Prime terminal names. -# * Historical data on Synertek. -# * Freeze for ncurses-1.9.1. -# 9.6.1 (Sat May 6 02:00:52 EDT 1995): -# * Added true xterm-color entry, renamed djm's pseudo-color entry. -# * Eliminate whitespace in short name fields, this tanks some scripts. -# * Name field changes to shorten some long entries. -# * Termcap translation now automatically generates empty rmir/smir -# when ich1/ich is present (copes with an ancient vi bug). -# * Added `screen' entries from FSF's screen-3.6.2. -# * Added linux-nic and xterm-nic entries. -# 9.6.2 (Sat May 6 17:00:55 EDT 1995): -# * Change linux entry to use smacs=\E[11m and have an explicit acsc, -# eliminating some special-case code in ncurses. -# -# 9.7.0 (Tue May 9 18:03:12 EDT 1995): -# * Added vt320-k3, rsvidtx from the Emacs termcap.dat file. I think -# that captures everything unique from it. -# * Added reorder script generator. -# * Freeze for ncurses 1.9.2 release. -# 9.7.1 (Thu Jun 29 09:35:22 EDT 1995): -# * Added Sean Farley's kspd, flash, rs1 capabilities for linux. -# * Added Olaf Siebert's corrections for adm12. -# * ansi-pc-color now includes the colors and pairs caps, so that -# entries which use it will inherit them automatically. -# * The linux entry can now recognize the center (keypad 5) key. -# * Removed some junk that found its way into Linux acsc. -# -# 9.8.0 (Fri Jul 7 04:46:57 EDT 1995): -# * Add 50% cut mark as a desperate hack to reduce tic's core usage. -# * xterm doesn't try to use application keypad mode any more. -# * Freeze for ncurses-1.9.3 release. -# 9.8.1 (Thu Jul 19 17:02:12 EDT 1995): -# * Added corrected sun entry from vendor. -# * Added csr capability to linux entry. -# * Peter Wemm says the at386 hpa should be \E[%i%p1%dG, not \E[%p1%dG. -# * Added vt102-nsgr to cope with stupid IBM PC `VT100' emulators. -# * Some commented-out caps in long entries come back in, my code -# for computing string-table lengths had a bug in it. -# * pcansi series modified to fit comm-program reality better. -# 9.8.2 (Sat Sep 9 23:35:00 EDT 1995): -# * BSD/OS actually ships the ibmpc3 bold entry as its console. -# * Correct some bad aliases in the pcansi series -# * Added entry for QNX console. -# * Clean up duplicate long names for use with 4.4 library. -# * Change vt100 standout to be normal reverse vide, not bright reverse; -# this makes the Emacs status line look better. -# 9.8.3 (Sun Sep 10 13:07:34 EDT 1995): -# * Added Adam Thompson's VT320 entries, also his dtx-sas and z340. -# * Minor surgery, mostly on name strings, to shorten termcap version. -# -# 9.9.0 (Sat Sep 16 23:03:48 EDT 1995): -# * Added dec-vt100 for use with the EWAN emulator. -# * Added kmous to xterm for use with xterm's mouse-tracking facility. -# * Freeze for 1.9.5 alpha release. -# 9.9.1 (Wed Sep 20 13:46:09 EDT 1995): -# * Changed xterm lines to 24, the X11R6 default. -# 9.9.2 (Sat Sep 23 21:29:21 EDT 1995): -# * Added 7 newly discovered, undocumented acsc characters to linux -# entry (the pryz{|} characters). -# * ncurses no longer steals A_PROTECT. Simplify linux sgr accordingly. -# * Correct two typos in the xterm entries introduced in 9.9.1. -# * I finally figured out how to translate ko capabilities. Done. -# * Added tvi921 entries from Tim Theisen. -# * Cleanup: dgd211 -> dg211, adm42-nl -> adm42-nsl. -# * Removed mystery tec entry, it was neither interesting nor useful. -# * shortened altos3, qvt203, tvi910+, tvi92D, tvi921-g, tvi955, vi200-f, -# vi300-ss, att505-24, contel301, dm3045, f200vi, pe7000c, vc303a, -# trs200, wind26, wind40, wind50, cdc456tst, dku7003, f110, dg211, -# by making them relative to use capabilities -# * Added cuf1=^L to tvi925 from deleted variant tvi925a. -# * fixed cup in adm22 entry and parametrized strings in vt320-k3. -# * added it#8 to entries that used to have :pt: -- tvi912, vi200, -# ampex80, -# * Translate all home=\E[;H capabilities to home=\E[H, they're -# equivalent. -# * Translate \E[0m -> \E[m in [rs]mso, [rs]mul, and init strings of -# vt100 and ANSI-like terminals. -# 9.9.3 (Tue Sep 26 20:11:15 EDT 1995): -# * Added it#8 and ht=\t to *all* entries with :pt:; the ncurses tic -# does this now, too. -# * fviewpoint is gone, it duplicated screwpoint. -# * Added hp2627, graphos, graphos-30, hpex, ibmega, ibm8514, ibm8514-c, -# ibmvga, ibmvga-c, minix, mm340, mt4520-rv, screen2, screen3, -# versaterm, vi500, vsc, vt131, vt340, vt400 entries from UW. -# The UW vi50 replaces the old one, which becomes vi50adm, -# * No more embedded commas in name fields. -# -# 9.10.0 (Wed Oct 4 15:39:37 EDT 1995): -# * XENIX forms characters in fos, trs16, scoansi become acsc strings, -# * Introduced klone+* entries for describing Intel-console behavior. -# * Linux kbs is default-mapped to delete for some brain-dead reason. -# * -nsl -> -ns. The -pp syntax is obsolete. -# * Eliminate [A-Z]* primaries in accordance with SVr4 terminfo docs. -# * Make xterm entry do application-keypad mode again. I got complaints -# that it was messing up someone's 3270 emulator. -# * Added some longname fields in order to avoid warning messages from -# older tic implementations. -# * According to ctrlseqs.ms, xterm has a full vt100 graphics set. Use -# it! (This gives us pi, greater than, less than, and a few more.) -# * Freeze for ncurses-1.9.6 release. -# 9.10.1 (Sat Oct 21 22:18:09 EDT 1995): -# * Add xon to a number of console entries, they're memory-mapped and -# don't need padding. -# * Correct the use dependencies in the ansi series. -# * Hand-translate more XENIX capabilities. -# * Added hpterm entry for HP's X terminal emulator. -# * Added aixterm entries. -# * Shortened four names so everything fits in 14 chars. -# -# 9.11.0 (Thu Nov 2 17:29:35 EST 1995): -# * Added ibcs2 entry and info on iBCS2 standard. -# * Corrected hpa/vpa in linux entry. They still fail the worm test. -# * We can handle the HP meml/memu capability now. -# * Added smacs to klone entries, just as documentation. -# * Carrected ansi.sys and cit-500 entries. -# * Added z39, vt320-k311, v220c, and avatar entries. -# * Make pcansi use the ansi.sys invis capability. -# * Added DIP switch descriptions for vt100, adm31, tvi910, tvi920c, -# tvi925, tvi950, dt80, ncr7900i, h19. -# * X3.64 has been withdrawn, change some references. -# * Removed function keys from ansi-m entry. -# * Corrected ansi.sys entry. -# * Freeze for ncurses-1.9.7 release. -# 9.11.1 (Tue Nov 6 18:18:38 EST 1995): -# * Added rmam/smam capabilities to many entries based on init strings. -# * Added correct hpa/vpa to linux. -# * Reduced several entries relative to vt52. -# 9.11.2 (Tue Nov 7 00:21:06 EST 1995): -# * Exiled some utterly unidentifiable custom and homebrew types to the -# UFO file; also, obsolete small-screen hardware; also, entries which -# look flat-out incorrect, garbled, or redundant. These include the -# following entries: carlock, cdc456tst, microkit, qdss, ramtek, tec, -# tec400, tec500, ubell, wind, wind16, wind40, wind50, plasma, agile, -# apple, bch, daleblit, nucterm, ttywilliams, nuterminal, nu24, bnu, -# fnu, nunix-30, nunix-61, exidy, ex3000, sexidy, pc52, sanyo55, -# yterm10, yterm11, yterm10nat, aed, aed-ucb, compucolor, compucolor2, -# vic20, dg1, act5s, netx, smartvid, smarterm, sol, sol2, dt200, -# trs80, trs100, trs200, trs600, xitex, rsvidtx, vid, att2300-x40, -# att2350-x40, att4410-nfk, att5410-ns, otty5410, att5425-nl-w, -# tty5425-fk, tty5425-w-fk, cita, c108-na, c108-rv-na, c100-rv-na, -# c108-na-acs, c108-rv-na-acs, ims950-ns, infotonKAS, ncr7900i-na, -# regent60na, scanset-n, tvi921-g, tvi925n, tvi925vbn, tvi925vb, -# vc404-na, vc404-s-na, vt420nam, vt420f-nam, vt420pc-nam, vt510nam, -# vt510pc-nam, vt520nam, vt525nam, xterm25, xterm50, xterm65, xterms. -# * Corrected pcvt25h as suggested by Brian C. Grayson -# . -# 9.11.3 (Thu Nov 9 12:14:40 EST 1995): -# * Added kspd=\E[P, kcbt=\E[Z, to linux entry, changed kbs back to ^H. -# * Added kent=\EOM to xterm entry. -# -# 9.11.4 (Fri Nov 10 08:31:35 EST 1995): -# * Corrected gigi entry. -# * Restored cuf/cud1 to xterm, their apparent bugginess was due to -# bad hpa/vpa capabilities. -# * Corrected flash strings to have a uniform delay of .2 sec. No -# more speed-dependent NUL-padding! -# * terminfo capabilities in comments bracketed with <>. -# 9.11.5 (Fri Nov 10 15:35:02 EST 1995): -# * Replaced pcvt with the 3.31 pcvt entries. -# * Freeze for 1.9.7a. -# 9.11.6 (Mon Nov 13 10:20:24 EST 1995): -# * Added emu entry from the X11R6 contrib tape sources. -# -# 9.12.0 (Wed Nov 29 04:22:25 EST 1995): -# * Improved iris-ansi and sun entries. -# * More flash string improvements. -# * Corrected wy160 & wy160 as suggested by Robert Dunn -# * Added dim to at386. -# * Reconciled pc3 and ibmpc3 with the BSDI termcap file. Keith says -# he's ready to start using the termcap generated from this one. -# * Added vt102-w, vt220-w, xterm-bold, wyse-vp, wy75ap, att4424m, -# ln03, lno3-w, h19-g, z29a*, qdss. Made vt200 an alias of vt220. -# * Improved hpterm, apollo consoles, fos, qvt101, tvi924. tvi925, -# att610, att620, att630, -# * Changed hazeltine name prefix from h to hz. -# * Sent t500 to the UFI file. -# * I think we've sucked all the juice out of BSDI's termcap file now. -# * Freeze for ncurses 1.9.8 release -# 9.12.1 (Thu Nov 30 03:14:06 EST 1995) -# * Unfreeze, linux kbs needed to be fixed. -# * Tim Theisen pinned down a bug in the DMD firmware. -# 9.12.2 (Thu Nov 30 19:08:55 EST 1995): -# * Fixes to ansi and klone capabilities (thank you, Aaron Ucko). -# (The broken ones had been shadowed by sgr.) -# 9.12.3 (Thu Dec 7 17:47:22 EST 1995): -# * Added documentation on ECMA-48 standard. -# * New Amiga entry. -# 9.12.4 (Thu Dec 14 04:16:39 EST 1995): -# * More ECMA-48 stuff -# * Corrected typo in minix entry, added pc-minix. -# * Corrected khome/kend in xterm (thank you again, Aaron Ucko). -# * Added rxvt entry. -# * Added 1.3.x color-change capabilities to linux entry. -# 9.12.5 (Tue Dec 19 00:22:10 EST 1995): -# * Corrected rxvt entry khome/kend. -# * Corrected linux color change capabilities. -# * NeXT entries from Dave Wetzel. -# * Cleaned up if and rf file names (all in /usr/share now). -# * Changed linux op capability to avoid screwing up a background color -# pair set by setterm. -# 9.12.6 (Wed Feb 7 16:14:35 EST 1996): -# * Added xterm-sun. -# 9.12.7 (Fri Feb 9 13:27:35 EST 1996): -# * Added visa50. -# -# 9.13.0 (Sun Mar 10 00:13:08 EST 1996): -# * Another sweep through the Shuford archive looking for new info. -# * Added dg100 alias to dg6053 based on a comp.terminals posting. -# * Added st52 from Per Persson. -# * Added eterm from the GNU Emacs 19.30 distribution. -# * Freeze for 1.9.9. -# 9.13.1 (Fri Mar 29 14:06:46 EST 1996): -# * FreeBSD console entries from Andrew Chernov. -# * Removed duplicate Atari st52 name. -# 9.13.2 (Tue May 7 16:10:06 EDT 1996) -# * xterm doesn't actually have ACS_BLOCK. -# * Change klone+color setf/setb to simpler forms that can be -# translated into termcap. -# * Added xterm1. -# * Removed mechanically-generated junk capabilities from cons* entries. -# * Added color support to bsdos. -# 9.13.3 (Thu May 9 10:35:51 EDT 1996): -# * Added Wyse 520 entries from Wm. Randolph Franklin . -# * Created ecma+color, linux can use it. Also added ech to linux. -# * Teach xterm about more keys. Add Thomas Dickey's 3.1.2E updates. -# * Add descriptions to FreeBSD console entries. Also shorten -# some aliases to <= 14 chars for portability. -# * Added x68k console -# * Added OTbs to several VT-series entries. -# 9.13.4 (Wed May 22 10:54:09 EDT 1996): -# * screen entry update for 3.7.1 from Michael Alan Dorfman. -# 9.13.5 (Wed Jun 5 11:22:41 EDT 1996): -# * kterm correction due to Kenji Rikitake. -# * ACS correction in vt320-kll due to Phillippe De Muyter. -# 9.13.6 (Sun Jun 16 15:01:07 EDT 1996): -# * Sun console entry correction from J.T. Conklin. -# * Changed all DEC VT300 and up terminals to use VT300 tab set -# 9.13.7 (Mon Jul 8 20:14:32 EDT 1996): -# * Added smul to linux entry (we never noticed it was missing -# because of sgr!). -# * Added rmln to hp+labels (deduced from other HP entries). -# * Added vt100 acsc capability to vt220, vt340, vt400, d800, dt80-sas, -# pro350, att7300, 5420_2, att4418, att4424, att4426, att505, vt320-k3. -# * Corrected vt220 acsc. -# * The klone+sgr and klone+sgr-dumb entries now use klone+acs; -# this corresponds to reality and helps prevent some tic warnings. -# * Added sgr0 to c101, pcix, vt100-nav, screen2, oldsun, next, altos2, -# hpgeneric, hpansi, hpsub, hp236, hp700-wy, bobcat, dku7003, adm11, -# adm12, adm20, adm21, adm22, adm31, adm36, adm42, pt100, pt200, -# qvt101, tvi910, tvi921, tvi92B, tvi925, tvi950, tvi970, wy30-mc, -# wy50-mc, wy100, wyse-vp, ampex232, regent100, viewpoint, vp90, -# adds980, cit101, cit500, contel300, cs10, dm80, falco, falco-p, -# f1720a, go140, sb1, superbeeic, microb, ibm8512, kt7, ergo4000, -# owl, uts30, dmterm, dt100, dt100, dt110, appleII, apple-videx, -# lisa, trsII, atari, st52, pc-coherent, basis, m2-man, bg2.0, bg1.25, -# dw3, ln03, ims-ansi, graphos, t16, zen30, xtalk, simterm, d800, -# ifmr, v3220, wy100q, tandem653, ibmaed. -# * Added DWK terminal description. -# 9.13.8 (Wed Jul 10 11:45:21 EDT 1996): -# * Many entries now have highlights inherited from adm+sgr. -# * xterm entry now corresponds to XFree86 3.1.2E, with color. -# * xtitle and xtitle-twm enable access to the X status line. -# * Added linux-1.3.6 color palette caps in conventional format. -# * Added adm1178 terminal. -# * Move fos and apollo terminals to obsolete category. -# * Aha! The BRL terminals file told us what the Iris extensions mean. -# * Added, from the BRL termcap file: rt6221, rt6221-w, northstar, -# commodore, cdc721-esc, excel62, osexec. Replaced from the BRL file: -# cit500, adm11. -# 9.13.9 (Mon Jul 15 00:32:51 EDT 1996): -# * Added, from the BRL termcap file: cdc721, cdc721l, cdc752, cdc756, -# aws, awsc, zentec8001, modgraph48, rca vp3301/vp3501, ex155. -# * Corrected, from BRL termcap file: vi50. -# * Better rxvt entry & corrected xterm entries from Thomas Dickey. -# 9.13.10 (Mon Jul 15 12:20:13 EDT 1996): -# * Added from BRL: cit101e & variants, hmod1, vi200, ansi77, att5620-1, -# att5620-s, att5620-s, dg210, aas1901, hz1520, hp9845, osborne -# (old osborne moved to osborne-w), tvi970-vb, tvi970-2p, tvi925-hi, -# tek4105brl, tek4106brl, tek4107brl,tek4109brl, hazel, aepro, -# apple40p, apple80p, appleIIgs, apple2e, apple2e-p, apple-ae. -# * Paired-attribute fixes to various terminals. -# * Sun entry corrections from A. Lukyanov & Gert-Jan Vons. -# * xterm entry corrections from Thomas Dickey. -# 9.13.11 (Tue Jul 30 16:42:58 EDT 1996): -# * Added t916 entry, translated from a termcap in SCO's support area. -# * New qnx entry from Michael Hunter. -# 9.13.12 (Mon Aug 5 14:31:11 EDT 1996): -# * Added hpex2 from Ville Sulko. -# * Fixed a bug that ran the qnx and pcvtXX together. -# 9.13.13 (Fri Aug 9 01:16:17 EDT 1996): -# * Added dtterm entry from Solaris CDE. -# 9.13.14 (Tue Sep 10 15:31:56 EDT 1996): -# * corrected pairs#8 typo in dtterm entry. -# * added tvi9065. -# 9.13.15 (Sun Sep 15 02:47:05 EDT 1996): -# * updated xterm entry to cover 3.1.2E's new features. -# 9.13.16 (Tue Sep 24 12:47:43 EDT 1996): -# * Added new minix entry -# * Removed aliases of the form ^[0-9]* for obsolete terminals. -# * Commented out linux-old, nobody's using pre-1.2 kernels now. -# 9.13.17 (Fri Sep 27 13:25:38 EDT 1996): -# * Added Prism entries and kt7ix. -# * Caution notes about EWAN and tabset files. -# * Changed /usr/lib/tabset -> /usr/share/tabset. -# * Added acsc/rmacs/smacs to vt52. -# 9.13.18 (Mon Oct 28 13:24:59 EST 1996): -# * Merged in Thomas Dickey's reorganization of the xterm entries; -# added technical corrections to avoid warning messages. -# 9.13.19 (Sat Nov 16 16:05:49 EST 1996): -# * Added rmso=\E[27m in Linux entry. -# * Added koi8-r support for Linux console. -# * Replace xterm entries with canonical ones from XFree86 3.2. -# 9.13.20 (Sun Nov 17 23:02:51 EST 1996): -# * Added color_xterm from Jacob Mandelson -# 9.13.21 (Mon Nov 18 12:43:42 EST 1996): -# * Back off the xterm entry to use r6 as a base. -# 9.13.22 (Sat Nov 30 11:51:31 EST 1996): -# * Added dec-vt220 at Adrian Garside's request. -# 9.13.23 (Fri Feb 21 16:36:06 EST 1997): -# * Replaced minitel-2 entry. -# * Added MGR, ansi-nt. -# * Minor corrections to xterm entries. -# * Replaced EWAN telnet entry. -# * Dropped the reorder script generator. It was a fossil. -# 9.13.24 (Sun Feb 23 20:55:23 EST 1997): -# * Thorsten Lockert added termcap `bs' to a lot of types, working from -# the 4.4BSD Lite2 file. -# 9.13.25 (Fri Jun 20 12:33:36 EDT 1997): -# * Added Datapoint 8242, pilot, ansi_psx, rbcomm, vt220js. -# * Updated iris-ansi; corrected vt102-w. -# * Switch base xterm entry to 3.3 level. -# 9.13.26 (Mon Jun 30 22:45:45 EDT 1997) -# * Added basic4. -# * Removed rmir/smir from tv92B. -# -# 10.2.0 (Sat Feb 28 12:47:36 EST 1998): -# * add hds200 description (Walter Skorski) -# * add beterm entry (Fred Fish) -# * add Thomas Dickey's xterm-xf86-v40, xterm-8bit, xterm-16color, -# iris-color entries. -# * add emx entries. -# * Replaced unixpc entry with Benjamin Sittler's corrected version. -# * Replaced xterm/rxvt/emu/syscons entries with Thomas Dickey's -# versions. -# * remove sgr string from qnx based on report by Xiaodan Tang -# * Added u8/u9, removed rmul/smul from sun-il. -# * 4.2 tic displays \0 rather than \200. -# * add linux-koi8r to replace linux-koi8 (which uses a corrupt acsc, -# apparently based on cp-866). -# * Merged in Pavel Roskin's acsc for linux-koi8 -# * Corrected some erroneous \\\s to \. -# * 4.2 ncurses has been changed to use setaf/setab, consistent w/SysV. -# * II -> ii in pcvtXX, screen, xterm. -# * Removed \n chars following ANSI escapes in sgr & friends. -# * Updated Wyse entries. -# * h19 corrections from Tim Pierce. -# * Noted that the dm2500 has both ich and smir. -# * added pccons for the Alpha under OSF/1. -# * Added Sony NEWS workstation entries and cit101e-rv. -# * Reverted `amiga'; to Kent Polk's version, as I'm told -# the Verkuil entry messes up with Amiga Telnet. -# 10.2.1 (Sun Mar 8 18:32:04 EST 1998): -# * Corrected attributions in 10.2.0 release notes. -# * Scanned the Shuford archive for new terminfos and information. -# * Removed sgr from qnx entry (Thomas Dickey). -# * Added entries for ICL and Kokusai Data Systems terminals. -# * Incorporated NCR terminfos from the Boundless Technology FTP site. -# * Incorporated att700 from the Boundless Technology FTP site. -# * Miscellaneous contact-address and Web-page updates. -# 10.2.2 (Thu May 7 12:18:04 EDT 1998): -# * Moved Altos to OBSOLETE UNIX CONSOLES -# * Moved Hewlett-Packard terminals to OLDER TERMINAL TYPES, except for -# the 700s which go to WORKSTATION CONSOLES. -# * Major reorganization of ANSI/console/VT types. Moved vt52 to the -# obsolete section. -# * Daisy-wheel printers moved to UFO file. -# 10.2.3 (Tue May 12 22:59:11 EDT 1998): -# * Commented out hds200 is2 to avoid overflowing terminfo length limit. -# * Restored OT capabilities to UFO file. -# * add nxterm and xterm-color terminfo description (request by Cristian -# Gafton ). -# * Modify rxvt terminfo description to clear alternate screen before -# switching back to normal screen, for compatibility with applications -# which use xterm (reported by Manoj Kasichainula ). -# * Modify linux terminfo description to reset color palette (reported -# by Telford Tendys ). -# 10.2.4 (Thu Jul 2 18:13:26 EDT 1998): -# * Added minitel1 entries from Alexander Montaron. -# * Added qnxt2 from Federico Bianchi. -# 10.2.5: (Mon Aug 24 07:32:34 EDT 1998): -# * Resolve NetBSD Problem Report #4583 by adding civis/cnorm to pcvtXX. -# * dtterm enacs correction from Alexander V. Lukyanov. -# * Added ncsa-telnet, resolving Debian bug report 25341. -# * Added Francesco Potorti's tuned Wyse 99 entries. -# 10.2.6: (Mon Dec 21 00:49:43 EST 1998): -# * Home site has changed. -# 10.2.7: (Wed Mar 3 15:53:04 EST 1999): -# * Documentation fixes, mainly from David J. Mackenzie. -# -# 11.0.0: (Wed Mar 1 22:02:03 EST 2000) -# * BSD/OS console fixes from Jeffrey Honig at BSDI. -# ** TD's branch changes up to his 1999/10/23 version begin here -# * Added arm100 terminfo entries from Dave Millen. -# * Added Data General entries from Hasufin. -# * NCSA telnet entry from Francesco Potorti as modified by TD. -# * Added teraterm, crt, ms-vt100, mach, mach-bold, linux-lat, -# ofcons, wsvt25, wsvt25m, rcons, rcons-color, cygwin, amiga-8bit, -# ibm3161-C, ibm3162. -# * Updated xterm entries, BSD/OS entries, AIX entries. -# * Updated linux, iris-ansi, screen, beterm entries. -# * Added full function keys for scoansi. -# * Typo fixes for icl6404, osborne, eterm. att6386 -# * Corrected hp70092 acsc. -# * Added ibmpc from AIX 3.2.5; ibm-pc is no longer a synonym. -# * Added ibm5151 from AIX 3.2.5; ibmmono is no longer a synonym. -# * Added ibm5154 from AIX 3.2.5; ibmega is no longer a synonym. -# * Merged acsc, s0ds, s1ds, sgr0 into ibm5081 from AIX 3.2.5. -# * Merged kend, knp, kpp, mc4, mc5 into ibm3161 in from AIX 3.2.5. -# * Merged acsc into hft-c from AIX 3.2.5. -# * Updated ibm3151 from AIX 3.2.5. -# * Errors in TD's branch not accepted: ibm3101, ibm3151, ibm8514 -# * Merged msgr,colors,pairs,setb,setf into ibm3164 from AIX 3.2.5. -# ** TD's branch changes end here -# * Address updates from various contributors. -# * Historical info on basis console. -# * Ty Sarna's corrections to the amiga entry. -# * Add Kevin Turner's entry for the Wyse 85 in 8-bit mode. -# * Added 22 Bull-Questar terminal variants from AIX 4.1.5 -# * Added OSF/1 console and lft from AIX 4.1.5. -# * Move vt2220 to vt220-old, vt220-8 to vt220, introduce vt220-8bit -# from AIX 4.1.5. -# * swtp moved to UFO file (only 20 lines). -# * Added pcmw. -# 11.0.1: (Thu Mar 2 10:49:21 EST 2000): -# * Disabled hpa, vpa, in rxvt. -# * Incorporated ansi components and generic-ansi. -# -# The following sets edit modes for GNU EMACS. -# Local Variables: -# fill-prefix:"\t" -# fill-column:75 -# comment-column:0 -# comment-start-skip:"^#+" -# comment-start:"# " -# compile-command:"tic -c termtypes.master" -# End: -######## SHANTIH! SHANTIH! SHANTIH! diff --git a/etc/ttys b/etc/ttys deleted file mode 100755 index 7f6c86a15..000000000 --- a/etc/ttys +++ /dev/null @@ -1,44 +0,0 @@ -# -# from: @(#)ttys 5.1 (Berkeley) 4/17/89 -# -# name getty type status comments -# -console "/usr/libexec/getty default" minix on secure -ttyc1 "/usr/libexec/getty default" minix on secure -ttyc2 "/usr/libexec/getty default" minix on secure -ttyc3 "/usr/libexec/getty default" minix on secure -tty00 "" unknown off secure -tty01 "" unknown off secure - -ttyp0 "" network off -ttyp1 "" network off -ttyp2 "" network off -ttyp3 "" network off -ttyp4 "" network off -ttyp5 "" network off -ttyp6 "" network off -ttyp7 "" network off -ttyp8 "" network off -ttyp9 "" network off -ttypa "" network off -ttypb "" network off -ttypc "" network off -ttypd "" network off -ttype "" network off -ttypf "" network off -ttyq0 "" network off -ttyq1 "" network off -ttyq2 "" network off -ttyq3 "" network off -ttyq4 "" network off -ttyq5 "" network off -ttyq6 "" network off -ttyq7 "" network off -ttyq8 "" network off -ttyq9 "" network off -ttyqa "" network off -ttyqb "" network off -ttyqc "" network off -ttyqd "" network off -ttyqe "" network off -ttyqf "" network off diff --git a/etc/usr/Makefile b/etc/usr/Makefile deleted file mode 100644 index bb70a4d77..000000000 --- a/etc/usr/Makefile +++ /dev/null @@ -1,152 +0,0 @@ -# Makefile - installed as /usr/Makefile -# -# Provides simple targets to download and maintain /usr/pkgsrc and /usr/src. - -######################################################################## -# Entry point -######################################################################## -all help: usage - -MINIX_RELEASE!= uname -r - -######################################################################## -# PKGSRC -######################################################################## -PKGSRC_REPO_DIR:= ${.CURDIR}/pkgsrc -PKGSRC_REPO_URL:= git://git.minix3.org/pkgsrc-ng.git -PKGSRC_BRANCH:= ${MINIX_RELEASE} -MSG_RENAMED_BRANCH:= "\ -\n======================================================================== \ -\nWarning: \ -\n Renaming $$$${current_name} to $$$${new_name}. \ -\n======================================================================== \ -" -MSG_RESET_PKGSRC:= "\ -\n======================================================================== \ -\nNote: \ -\n If problems occur you may have to rm -rf ${PKGSRC_REPO_DIR} \ -\n and try again. \ -\n======================================================================== \ -" - -.if exists(${PKGSRC_REPO_DIR}/.git) -# We can only update the repository if it *does* exist -pkgsrc-update: git - # If we can fast-forward, just do it, otherwise rename current branch - # and checkout the official branch (also warn the user). - @cd ${PKGSRC_REPO_DIR} && git pull --ff-only || \ - ( current_name=$$(git rev-parse --abbrev-ref HEAD); \ - new_name=$${current_name}-$$(git rev-parse --short HEAD); \ - echo -e ${MSG_RENAMED_BRANCH}; \ - echo -n "Do you want to continue [Y/n]? "; \ - read ok; \ - if [ "$${ok}" = "" -o "$${ok}" = "y" -o "$${ok}" = "Y" ]; then \ - git branch -m $${new_name}; \ - git checkout -t origin/${PKGSRC_BRANCH}; \ - else \ - exit 1; \ - fi; \ - ) - @cd ${PKGSRC_REPO_DIR}/minix && sh minibootstrap.sh - -.if !exists(${PKGSRC_REPO_DIR}/Makefile) -# If the .git directory is available, but not yet checked out, then -pkgsrc-checkout: git - @cd ${PKGSRC_REPO_DIR} && git checkout ${PKGSRC_BRANCH} - @cd ${PKGSRC_REPO_DIR}/minix && sh minibootstrap.sh - -.endif # !exists(${PKGSRC_REPO_DIR}/Makefile) -.else -# We can only create the repository if it does *not* exist -pkgsrc: git - @echo -e ${MSG_RESET_PKGSRC} - @git clone -b ${PKGSRC_BRANCH} ${PKGSRC_REPO_URL} ${PKGSRC_REPO_DIR} - @cd ${PKGSRC_REPO_DIR}/minix && sh minibootstrap.sh - -.endif # exists(${PKGSRC_REPO_DIR}/.git) - -######################################################################## -# MINIX SRC -######################################################################## -SRC_REPO_DIR:= ${.CURDIR}/src -SRC_REPO_URL:= git://git.minix3.org/minix.git -SRC_BRANCH:= master -MSG_WRONG_BRANCH_SRC:= "\ -\n======================================================================== \ -\nERROR: \ -\n An unknown branch is presently checked out, please checkout \ -\n first the following branch: ${SRC_BRANCH} \ -\n======================================================================== \ -" -MSG_RESET_SRC:= "\ -\n======================================================================== \ -\nNote: \ -\n If problems occur you may have to rm -rf ${SRC_REPO_DIR} \ -\n and try again. \ -\n======================================================================== \ -" -.if exists(${SRC_REPO_DIR}/.git) -# We can only update the repository if it *does* exist -src-update: git - @cd ${SRC_REPO_DIR} && \ - [ "$$(git rev-parse --abbrev-ref HEAD)" = "${SRC_BRANCH}" ] || \ - ( echo -e ${MSG_WRONG_BRANCH_SRC}; exit 1 ) - @cd ${SRC_REPO_DIR} && git pull - -.if !exists(${SRC_REPO_DIR}/Makefile) -src-checkout: git - @cd ${SRC_REPO_DIR} && git checkout ${SRC_BRANCH} -.endif # !exists(${SRC_REPO_DIR}/Makefile) -.else -# We can only create the repository if it does not exist -src: git - @echo -e ${MSG_RESET_SRC} - @git clone ${SRC_REPO_URL} ${SRC_REPO_DIR} - -.endif # exists(${SRC_REPO_DIR}/.git) - -######################################################################## -# Support rules -######################################################################## -git: - @pkgin -y update 2>&1 > /dev/null - @pkgin -y install git-base 2>&1 > /dev/null - -usage: - @echo "Usage: make [target]" - @echo "" - @echo " Where target is one of:" - @echo " help, all, usage - print this help" - @echo "" - -.if exists(${SRC_REPO_DIR}/.git) - @echo " make src-update - update the src repo from the net" -.if !exists(${SRC_REPO_DIR}/Makefile) - @echo " make src-checkout - initial checkout of your pre-packaged" - @echo " pkgsrc repo." -.endif # !exists(${SRC_REPO_DIR}/Makefile) -.else - @echo " make src - fetch initial src repo from the net" -.endif # exists(${SRC_REPO_DIR}/.git) - @echo "" - -.if exists(${PKGSRC_REPO_DIR}/.git) -.if !exists(${PKGSRC_REPO_DIR}/Makefile) - @echo " make pkgsrc-checkout - initial checkout of your pre-packaged" - @echo " pkgsrc repo." -.endif # !exists(${PKGSRC_REPO_DIR}/Makefile) - @echo " make pkgsrc-update - update your pkgsrc repo from the net" -.else - @echo " make pkgsrc - fetch initial pkgsrc repo from the net" -.endif # exists(${PKGSRC_REPO_DIR}/.git) - @echo "" - -_debug: - @echo "Settings:" -.for var in MINIX_RELEASE \ - SRC_REPO_DIR SRC_REPO_URL SRC_BRANCH \ - PKGSRC_REPO_DIR PKGSRC_REPO_URL PKGSRC_BRANCH - @echo " ${var} = ${${var}}" - -.endfor - diff --git a/etc/usr/daily b/etc/usr/daily deleted file mode 100755 index 21e45c2ba..000000000 --- a/etc/usr/daily +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/sh -# -# daily - daily cleanup of the system. - -# Doesn't make sense when running from CD -if [ ! -z $(sysenv bootcd) ] -then exit -fi - -case "$#:$1" in -1:cron|1:boot) - caller=$1 - ;; -*) echo >&2 "Usage: $0 cron|boot" - exit 1 -esac - -test -d /usr/adm || exit -cd /usr/adm || exit - -# Last run must have been on a previous day. -timestamp=daily.lasttime -if test -f $timestamp -then - set -- `ls -lT $timestamp` - test "$6 $7 $9" = "$(date '+%b %d %Y')" && exit -fi - -# Update last-run time -echo >$timestamp - -# Remove three day old files from various tmp dirs. -cleantmp -3 /tmp /usr/tmp /usr/preserve /usr/spool/lpd /usr/spool/at/past - -# Truncate log files in /usr/adm. -test -d old || mkdir old || exit - -cycle() -{ - # Cycle a log file if larger than a size in kilobytes. - local size="`expr "$1" + "$1"`" - local log="$2" - - if test -f "$log" && test -n "$(find "$log" -size +"$size")" - then - test -f "old/$log.2" && cp -p "old/$log.2" "old/$log.3" - test -f "old/$log.1" && cp -p "old/$log.1" "old/$log.2" - cp -p "$log" "old/$log.1" - : > "$log" - fi -} - -cycle 100 wtmp -cycle 100 log -cycle 20 ftplog -cycle 200 aftplog - -# Make copies of /etc/passwd and /etc/shadow if they have been changed. -for file in passwd shadow -do - if cmp -s /etc/$file old/$file.1 - then - # Fine. - else - test -f old/$file.2 && cp -p old/$file.2 old/$file.3 - test -f old/$file.1 && cp -p old/$file.1 old/$file.2 - test -f /etc/$file && cp -p /etc/$file old/$file.1 - fi -done - -# Update manpage index but don't warn about nonexistant dirs -/usr/libexec/makewhatis -f 2>/dev/null - -# Continue with a local script if present. -test -f /usr/local/etc/daily && sh /usr/local/etc/daily $caller -exit 0 diff --git a/etc/usr/rc b/etc/usr/rc deleted file mode 100644 index d444adaf3..000000000 --- a/etc/usr/rc +++ /dev/null @@ -1,467 +0,0 @@ -# /usr/etc/rc - continued system initialization. - -RANDOM_FILE=/usr/adm/random.dat -TCPISN_FILE=/usr/adm/tcpisn.dat -LOCAL_FILE=/usr/etc/rc.local - -ARCH="`sysenv arch`" - -if [ ! "$ARCH" ] -then # Older kernels do not provide an arch sysenv variable. - # We assume we are on x86 then, as existing systems with - # kernel and userland (i.e. this script) unsynchronized - # will be x86. - ARCH=i386 -fi - -# Get $SERVICES_DIRS -. /etc/rc.conf - -# Directories to find services in -if [ ! "$SERVICES_DIRS" ] -then SERVICES_DIRS=/service -fi - -# Booting from cd? -bootcd="`/bin/sysenv bootcd`" - -case "$#:$1" in -1:start|1:stop) - action=$1 - ;; -*) echo >&2 "Usage: $0 [start|stop]" - exit 1 -esac - -if [ -f "$LOCAL_FILE" ] -then . "$LOCAL_FILE" $1 -fi - -disabled() -{ - ifs="$IFS"; IFS=, - for skip in `sysenv disable` - do - if [ "$skip" = "$1" ] - then - IFS="$ifs"; unset ifs - return 0 - fi - done - IFS="$ifs"; unset ifs - return 1 -} - -daemonize() -{ - # Function to start a daemon, if it exists. - local IFS=':' - local name="$1" - - for dir in $PATH - do - if [ -f "$dir/$1" ] - then - - # check if this service is disabled at the boot monitor. - if disabled $name; then return; fi - - echo -n " $name" - "$@" & - return - fi - done -} - -up() -{ - # Function to dynamically start a system service - opt="" - prefix=$(expr "$1 " : '\(-\)') - if [ "$prefix" = "-" ]; - then - opt=$1 - shift - fi - service=$1 - shift - - # First check if this service is disabled at the boot monitor. - if disabled $service; then return; fi - - # Service is not disabled. Try to bring it up. - found="" - for dir in $SERVICES_DIRS - do bin=$dir/$service - if [ -x $bin -a -z "$found" ] - then minix-service $opt up $bin "$@" - echo -n " $service" - found=yes - fi - done - if [ -z "$found" ] - then echo " ($service not found in $SERVICES_DIRS)" - fi -} - -# Print a list of labels of detected PCI ethernet hardware devices. -get_pci_eth_labels() -{ - # We need to match all PCI ethernet hardware devices against all - # drivers. For performance reasons, we construct a lookup table on the - # fly here. In order to do that, we need to give both a list of all - # available network drivers with PCI device IDs (part 1 of the code - # below) and a list of all actually present ethernet hardware devices - # (part 2) to an awk script (part 3). The awk script can tell the - # difference between the list entries based on whether there is a - # leading space on the line. For part 2, we grab only devices that are - # in PCI class 2 (network controller) subclass 0 (ethernet controller). - - # Part 1: collect all network drivers with supported PCI IDs - (for dir in $SYSTEM_CONF_DIRS; do - for f in $dir/$SYSTEM_CONF_SUBDIR/*; do - if [ -f $f ]; then - printconfig $f | grep ',type net.*,pci device' - fi - done - done | sed 's/^service \([^,]*\),.*,pci device/ \1/g'; - # Part 2: grab all PCI IDs of ethernet hardware devices (class 2/0) - cat /proc/pci | grep '^[^ ]* 2/0/' | cut -d' ' -f3) | awk ' - # Part 3: first construct a PCI-ID-to-driver table based on the lines - # produced by part 1 (with leading space), which each contain one - # driver name followed by one or more PCI IDs; then, go through all - # the ethernet hardware devices found in part 2 (no leading space) and - # if if there is a hit in the table, print the driver label to use. - /^ / { for (i=2;i<=NF;i++) drivers[$(i)]=$1 } - /^[^ ]/ { - # There is a bit of a discrepancy between output formats of - # /proc/pci and printconfig: the former uses - # "vid:did:sub_vid:sub_did" whereas the latter uses - # "vid:did/sub_vid:sub_did". No problem; in the common case - # (= no sub IDs used) we need to split the PCI ID anyway. - if (split($1,id,":") >= 4) { - # Try a full "vid:did:sub_vid:sub_did" match. - name=drivers[id[1]":"id[2]"/"id[3]":"id[4]] - } - # No sub IDs or no match found? Try a "vid:did" match. - if (!name) name=drivers[id[1]":"id[2]] - # If found, print the resulting label (_) - if (name) { - print name"_"(instance[name]+0) - instance[name]++ - } - } - ' -} - -# Print a list of labels of ethernet hardware devices that have been detected -# to be present on the system. Each label has the format '_' -# where is the file name of the driver (in /service) and is -# a zero-based, per-driver instance number of the device. -get_eth_labels() { - # For now, do autodetection only on platforms with (x86) PCI support. - # For (x86) ISA drivers, a custom network setting script is required; - # see below. For ARM platforms, the driver (if any) is started based - # on the board; there is no device autodetection. - if [ -f /proc/pci ]; then - get_pci_eth_labels - fi - - # Add any network drivers manually configured in /usr/etc/rc.local by - # the netconf(8) utility. - if [ -n "$netdriver" ]; then - echo "${netdriver}_0" - fi -} - -# Detect expansion boards on the BeagleBone and load the proper drivers. -capemgr() { - - # Probe each possible cape EEPROM slave address for a BeagleBone cape. - for slave_addr in 54 55 56 57 - do - - # See if there is a readable EEPROM with address ${slave_addr}. - eepromread -f /dev/i2c-3 -a 0x${slave_addr} > /dev/null 2>&1 - RESULT=$? - if [ $RESULT -eq 0 ] - then - - # Found an alive EEPROM. Try reading the cape name. - CAPE=`eepromread -i -f /dev/i2c-3 -a 0x${slave_addr} | \ - sed -n 's/^PART_NUMBER : \(.*\)$/\1/p' | \ - sed -e 's/\.*$//g'` # Strip trailing periods. - - # Look for a cape specific RC script. - if [ -x /etc/rc.capes/${CAPE} ] - then - - # CAT24C256 EEPROM -- all capes have this chip. - test -e /dev/eepromb3s${slave_addr} || \ - (cd /dev && MAKEDEV eepromb3s${slave_addr}) - up cat24c256 -dev /dev/eepromb3s${slave_addr} \ - -label cat24c256.3.${slave_addr} \ - -args "bus=3 address=0x${slave_addr}" - - # Load the drivers for the cape and do any other configuration. - . "/etc/rc.capes/${CAPE}" - - else - - echo "" - echo "** UNSUPPORTED CAPE: ${CAPE}" - echo "" - - fi - fi - done -} - -case $action in -start) - # Select console font. - test -f /etc/font && loadfont /etc/font /dev/random - # overwrite $RANDOM_FILE. We don't want to use this data again - dd if=/dev/random of=$RANDOM_FILE bs=1024 count=1 2> /dev/null - else - # We couldn't find the old state to restart from, so use a binary - # file and the current date instead, even if this is less than ideal. - cat /bin/sh >> /dev/urandom - date >> /dev/urandom - fi - - # start network driver instances for all detected ethernet devices - for label in $(get_eth_labels); do - driver=$(echo $label | sed 's/\(.*\)_.*/\1/') - instance=$(echo $label | sed 's/.*_//') - eval arg=\$${driver}_arg - if [ ! -z "$arg" ]; then arg=" $arg"; fi - arg="-args \"instance=$instance$arg\"" - eval up $driver -label $label $arg -period 5HZ - done - - # pty needs to know the "tty" group ID - up pty -dev /dev/ptmx -args "gid=`stat -f '%g' /dev/ptmx`" - - # Start the LWIP service. - up lwip -dev /dev/bpf -script /etc/rs.lwip - - # Load stable seed for TCP Initial Sequence Number generation (RFC 6528). - # The idea here is that (especially) after a system crash, the seed stays - # the same, so as to make it unlikely that incoming packets for connections - # from before the crash are accepted on connections after the crash. - TCPISN_LEN=$(sysctl -n net.inet.tcp.isn_secret | awk '{print length/2}') - if [ ! -f $TCPISN_FILE ]; then - # If the /usr file system is read-only, we cannot create the file. In - # that case, we draw a temporary secret from the random service. - if grep ' \/usr .*rw.*' /etc/mtab >/dev/null; then - dd if=/dev/random of=$TCPISN_FILE bs=$TCPISN_LEN count=1 2>/dev/null - else - TCPISN_FILE=/dev/random - fi - fi - sysctl -qw net.inet.tcp.isn_secret=`dd if=$TCPISN_FILE bs=$TCPISN_LEN \ - count=1 2>/dev/null | hexdump -v -e '/1 "%02x"'` 2>/dev/null - - # LWIP does not block until all network drivers have fully initialized and - # reported back to LWIP. That may prevent proper configuration of the - # corresponding interfaces a bit later. Sleep up to five seconds waiting - # for all registered network drivers to initialize and report to LWIP. - for i in 1 2 3 4 5; do - [ $(sysctl -n minix.lwip.drivers.pending) -gt 0 ] && sleep 1 - done - - up uds - - up -n ipc - - up log -dev /dev/klog - - if [ $ARCH = i386 ] - then - up -n printer -dev /dev/lp -period 10HZ - # start VirtualBox time sync driver if the device is there - if grep '^[^ ]* [^ ]* 80EE:CAFE[^ ]* ' /proc/pci >/dev/null; then - up -n vbox -period 10HZ - fi - fi - - echo . - - echo -n "Starting daemons:" - daemonize update - - # Ugly error message when starting cron from CD. - # (and cron unnecessary then so..) - if [ ! -f /CD ] - then daemonize cron - else mkdir /tmp/log - rm -f /var/log || true - ln -s /tmp/log /var/log || true - . /etc/rc.cd - fi - - echo . - - # i2c only supported on ARM at the moment - if [ $ARCH = earm ] - then - echo -n "Starting i2c subsystem: " - for bus in 1 2 3 - do - test -e /dev/i2c-${bus} || (cd /dev && MAKEDEV i2c-${bus}) - up i2c -dev /dev/i2c-${bus} -label i2c.${bus} \ - -args instance=${bus} - done - echo . - - BOARD_NAME=`sysenv board` - case "${BOARD_NAME}" in - - ARM-ARMV7-TI-BB-WHITE) - echo "Running on a BeagleBone" - echo -n "Starting i2c device drivers: " - - # start EEPROM driver for reading board info - test -e /dev/eepromb1s50 || \ - (cd /dev && MAKEDEV eepromb1s50) - up cat24c256 -dev /dev/eepromb1s50 \ - -label cat24c256.1.50 \ - -args 'bus=1 address=0x50' - - # Start TPS65217 driver for power management. - up tps65217 -label tps65217.1.24 \ - -args 'bus=1 address=0x24' - - # Start ethernet driver. - up lan8710a -label lan8710a_0 -args 'instance=0' - - # check for the presence of a display - eepromread -f /dev/i2c-2 -n > /dev/null 2>&1 - RESULT=$? - if [ $RESULT -eq 0 ] - then - # start eeprom driver for reading EDID. - test -e /dev/eepromb2s50 || \ - (cd /dev && MAKEDEV eepromb2s50) - up cat24c256 -dev /dev/eepromb2s50 \ - -label cat24c256.2.50 \ - -args 'bus=2 address=0x50' - - # start frame buffer - #up fb -dev /dev/fb0 -args edid.0=cat24c256.2.50 - # fb hasn't been ported to AM335X yet. - fi - - if [ -e /service/usbd ] - then - echo "Starting USBD" - up usbd - fi - # Detect expansion boards and start drivers. - capemgr - - ;; - - ARM-ARMV7-TI-BB-BLACK) - echo "Running on a BeagleBone Black" - echo -n "Starting i2c device drivers: " - - # start EEPROM driver for reading board info - test -e /dev/eepromb1s50 || \ - (cd /dev && MAKEDEV eepromb1s50) - up cat24c256 -dev /dev/eepromb1s50 \ - -label cat24c256.1.50 \ - -args 'bus=1 address=0x50' - - # Start TPS65217 driver for power management. - up tps65217 -label tps65217.1.24 \ - -args 'bus=1 address=0x24' - - # Start TDA19988 driver for reading EDID. - up tda19988 -label tda19988.1.3470 -args \ - 'cec_bus=1 cec_address=0x34 hdmi_bus=1 hdmi_address=0x70' - - # Start ethernet driver. - up lan8710a -label lan8710a_0 -args 'instance=0' - - # start frame buffer - #up fb -dev /dev/fb0 -args edid.0=tda19988.1.3470 - # fb hasn't been ported to AM335X yet. - - if [ -e /service/usbd ] - then - echo "Starting USBD" - up usbd - fi - # Detect expansion boards and start drivers. - capemgr - - ;; - - ARM-ARMV7-TI-BBXM-GENERIC) - echo "Running on a BeagleBoard-xM" - echo -n "Starting i2c device drivers: " - - # Start TPS65950 driver for power management. - up tps65950 -label tps65950.1.48 \ - -args 'bus=1 address=0x48' - - # Set the system time to the time in the TPS65950's RTC - readclock - - # check for the presence of a display - eepromread -f /dev/i2c-3 -n > /dev/null 2>&1 - RESULT=$? - if [ $RESULT -eq 0 ] - then - # start eeprom driver for reading edid - test -e /dev/eepromb3s50 || \ - (cd /dev && MAKEDEV eepromb3s50) - up cat24c256 -dev /dev/eepromb3s50 \ - -label cat24c256.3.50 \ - -args 'bus=3 address=0x50' - - # start frame buffer - up fb -dev /dev/fb0 -args edid.0=cat24c256.3.50 - fi - - ;; - esac - - echo . - fi - - # Load the stored hostname into the sysctl database. - test -r /etc/hostname.file && hostname $(cat /etc/hostname.file) - - # Recover files being edited when the system crashed. - test -f /usr/bin/elvprsv && elvprsv /usr/tmp/elv* - - # Run the daily cleanup on systems that are not on at night. - test -f /usr/etc/daily && sh /usr/etc/daily boot & -;; -stop) - # Save random data, if /usr is mounted rw. - if grep ' \/usr .*rw.*' /etc/mtab >/dev/null - then - if dd if=/dev/random of=$RANDOM_FILE.new bs=1024 count=1 2>/dev/null - then - mv $RANDOM_FILE.new $RANDOM_FILE - else - echo 'Failed to save random data.' - fi - fi -esac diff --git a/etc/utmp b/etc/utmp deleted file mode 100755 index e69de29bb..000000000 diff --git a/etc/xorg.conf b/etc/xorg.conf deleted file mode 100644 index c6af3cdf2..000000000 --- a/etc/xorg.conf +++ /dev/null @@ -1,16 +0,0 @@ -Section "Module" - Load "dbe" - Load "dri" - Load "dri2" - Load "extmod" - Load "glx" - Load "record" - Load "shadow" - Load "exa" - Load "fb" - Load "int10" - Load "shadowfb" - Load "vbe" - Load "vgahw" - Load "xaa" -EndSection diff --git a/external/Makefile b/external/Makefile deleted file mode 100644 index bec35b509..000000000 --- a/external/Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# $NetBSD: Makefile,v 1.18 2012/06/14 04:14:36 riz Exp $ -#MINIX -SUBDIR+= bsd gpl3 historical -SUBDIR+= mit public-domain - -.include diff --git a/external/mit/Makefile b/external/mit/Makefile deleted file mode 100644 index 02d6a5df2..000000000 --- a/external/mit/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2015/09/03 22:24:02 youri Exp $ - -.include - -SUBDIR+= expat lua - -.if ${MKX11} != "no" -SUBDIR+= xorg -SUBDIR+= .WAIT ctwm -.endif - -.include diff --git a/external/mit/ctwm/Makefile b/external/mit/ctwm/Makefile deleted file mode 100644 index 52a7901c6..000000000 --- a/external/mit/ctwm/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/09/03 22:24:02 youri Exp $ - -# Top level Makefile to cross build xorg inside the NetBSD tree. - -.include - -SUBDIR= bin - -.if ${MKUPDATE} == "no" && !defined(NOCLEANDIR) -BUILDTARGETS+= cleandir -.endif -.if ${MKOBJDIRS} != "no" -BUILDTARGETS+= obj -.endif -BUILDTARGETS+= do-build - -.ORDER: ${BUILDTARGETS} - -do-build: -.for targ in dependall install - ${MAKEDIRTARGET} . ${targ} -.endfor - -.for dir in tools lib -do-${dir:S/\//-/g}: -. for targ in dependall install - ${MAKEDIRTARGET} ${dir} ${targ} -. endfor -.endfor - - -DISTRIBTARGETS= \ - bin/ctwm - -.include diff --git a/external/mit/ctwm/bin/Makefile b/external/mit/ctwm/bin/Makefile deleted file mode 100644 index 0aee95925..000000000 --- a/external/mit/ctwm/bin/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/09/03 22:24:02 youri Exp $ - -SUBDIR= ctwm - -.include diff --git a/external/mit/ctwm/bin/ctwm/Makefile b/external/mit/ctwm/bin/ctwm/Makefile deleted file mode 100644 index deb711a8f..000000000 --- a/external/mit/ctwm/bin/ctwm/Makefile +++ /dev/null @@ -1,60 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/09/03 22:24:02 youri Exp $ - -.include - -PROG= ctwm -SRCS= add_window.c deftwmrc.c events.c gram.tab.c gc.c \ - list.c util.c ctwm.c lex.c parse.c menus.c resize.c \ - version.c iconmgr.c cursor.c icons.c workmgr.c windowbox.c \ - clicktofocus.c vscreen.c session.c mwmhints.c gnome.c - -YHEADER=1 - -CTWMCONFIGDIR= ${X11ETCDIR}/ctwm - -CTWMDIR= ${X11SRCDIR}/external/mit/ctwm/dist -XPMDIR= ${X11INCDIR}/X11/pixmaps/ctwm - -CPPFLAGS+= -I. -I${CTWMDIR}/src \ - -DNO_ALLOCA -DCSRG_BASED -DUSEM4 -DGNOME -DXPM \ - -CPPFLAGS.parse.c= -DSYSTEM_INIT_FILE=\"${CTWMCONFIGDIR}/system.twmrc\" \ - -DM4CMD=\"m4\" \ - -DPIXMAP_DIRECTORY=\"${XPMDIR}\" - -FILESDIR= ${XPMDIR} - -FILES= 3D_Expand15.xpm 3D_Iconify15.xpm 3D_Lightning15.xpm \ - 3D_Menu15.xpm 3D_Resize15.xpm 3D_Zoom15.xpm 3dcircle.xpm \ - 3ddimple.xpm 3ddot.xpm 3dfeet.xpm 3dleopard.xpm 3dpie.xpm \ - 3dpyramid.xpm 3dslant.xpm IslandD.xpm IslandW.xpm LRom.xpm\ - LRom1.xpm arthur.xpm audio_editor.xpm background1.xpm \ - background2.xpm background3.xpm background4.xpm \ - background5.xpm background6.xpm background7.xpm \ - background8.xpm background9.xpm ball1.xpm ball10.xpm \ - ball11.xpm ball12.xpm ball2.xpm ball3.xpm ball4.xpm \ - ball5.xpm ball6.xpm ball7.xpm ball8.xpm ball9.xpm \ - cdrom1.xpm claude.xpm clipboard.xpm datebook.xpm \ - emacs.xpm ghostview.xpm hpterm.xpm mail0.xpm mail1.xpm \ - nothing.xpm nt1.xpm nt2.xpm pixmap.xpm postit.xpm \ - skull.xpm spider.xpm term.xpm unknown.xpm unknown1.xpm \ - unread.xpm welcome.xpm xarchie.xpm xcalc.xpm xcalc2.xpm \ - xedit.xpm xftp.xpm xgopher.xpm xgrab.xpm xhpcalc.xpm \ - xirc.xpm xmail.xpm xman.xpm xmosaic.xpm xnomail.xpm \ - xrn-compose.xpm xrn.goodnews.xpm xrn.nonews.xpm xrn.xpm \ - xterm.xpm system.ctwmrc - -FILESDIR_system.ctwmrc = ${CTWMCONFIGDIR} - -.if defined(__MINIX) -LDSTATIC:= -dynamic -.endif # defined(__MINIX) - -LDADD+= -lXpm -lXmu -lXt -lSM -lICE -lXext -lX11 -DPADD+= ${LIBXPM} ${LIBXMU} ${LIBXT} ${LIBSM} ${LIBICE} ${LIBXEXT} ${LIBX11} - -.PATH: ${CTWMDIR} ${CTWMDIR}/xpm - -.include -.include -.include diff --git a/external/mit/expat/Makefile b/external/mit/expat/Makefile deleted file mode 100644 index e7edb8da0..000000000 --- a/external/mit/expat/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2012/02/29 20:07:56 tron Exp $ - -SUBDIR+= lib .WAIT bin - -.include diff --git a/external/mit/expat/Makefile.inc b/external/mit/expat/Makefile.inc deleted file mode 100644 index d09543b95..000000000 --- a/external/mit/expat/Makefile.inc +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.1 2012/02/29 20:07:56 tron Exp $ - -.include - -EXPATDIR= ${NETBSDSRCDIR}/external/mit/expat -EXPATSRCDIR= ${NETBSDSRCDIR}/external/mit/expat/dist - -.for _LIB in expat -.if !defined(EXPATOBJDIR.${_LIB}) -EXPATOBJDIR.${_LIB}!= cd ${EXPATDIR}/lib/lib${_LIB} && ${PRINTOBJDIR} -.MAKEOVERRIDES+= EXPATOBJDIR.${_LIB} -.endif -EXPATLIB.${_LIB}= ${EXPATOBJDIR.${_LIB}}/lib${_LIB}.a -.endfor diff --git a/external/mit/expat/bin/Makefile b/external/mit/expat/bin/Makefile deleted file mode 100644 index a5cc2ed25..000000000 --- a/external/mit/expat/bin/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2012/02/29 20:07:56 tron Exp $ - -SUBDIR+= xmlwf - -.include diff --git a/external/mit/expat/bin/Makefile.inc b/external/mit/expat/bin/Makefile.inc deleted file mode 100644 index 9561d699e..000000000 --- a/external/mit/expat/bin/Makefile.inc +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.1 2012/02/29 20:07:56 tron Exp $ - -BINDIR?= /usr/bin - -CPPFLAGS+= -I${EXPATSRCDIR}/lib - -LDADD+= -L${EXPATOBJDIR.expat} -lexpat -DPADD+= ${EXPATLIB.expat} - -.include "../Makefile.inc" diff --git a/external/mit/expat/bin/xmlwf/Makefile b/external/mit/expat/bin/xmlwf/Makefile deleted file mode 100644 index 5c771a5ca..000000000 --- a/external/mit/expat/bin/xmlwf/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2012/02/29 20:07:56 tron Exp $ - -.include - -PROG= xmlwf - -.PATH: ${EXPATSRCDIR}/xmlwf ${EXPATSRCDIR}/doc - -SRCS= codepage.c unixfilemap.c xmlfile.c xmlwf.c -CPPFLAGS+=-DHAVE_UNISTD_H - -.include diff --git a/external/mit/expat/dist/CMake.README b/external/mit/expat/dist/CMake.README deleted file mode 100755 index 4db6399c1..000000000 --- a/external/mit/expat/dist/CMake.README +++ /dev/null @@ -1,42 +0,0 @@ -== How to build expat with cmake (experimental) == - -The cmake based buildsystem for expat works on Windows (cygwin, mingw, Visual -Studio) and should work on all other platform cmake supports. - -Assuming ~/expat-2.1.0 is the source directory of expat, add a subdirectory -build and change into that directory: -~/expat-2.1.0$ mkdir build && cd build -~/expat-2.1.0/build$ - -From that directory, call cmake first, then call make, make test and -make install in the usual way: -~/expat-2.1.0/build$ cmake .. --- The C compiler identification is GNU --- The CXX compiler identification is GNU -.... --- Configuring done --- Generating done --- Build files have been written to: /home/patrick/expat-2.1.0/build - -If you want to specify the install location for your files, append --DCMAKE_INSTALL_PREFIX=/your/install/path to the cmake call. - -~/expat-2.1.0/build$ make && make test && make install -Scanning dependencies of target expat -[ 5%] Building C object CMakeFiles/expat.dir/lib/xmlparse.c.o -[ 11%] Building C object CMakeFiles/expat.dir/lib/xmlrole.c.o -.... --- Installing: /usr/local/lib/pkgconfig/expat.pc --- Installing: /usr/local/bin/xmlwf --- Installing: /usr/local/share/man/man1/xmlwf.1 - -For Windows builds, you must make sure to call cmake from an environment where -your compiler is reachable, that means either you call it from the -Visual Studio Command Prompt or when using mingw, you must open a cmd.exe and -make sure that gcc can be called. On Windows, you also might want to specify a -special Generator for CMake: -for Visual Studio builds do: -cmake .. -G "Visual Studio 10" && vcexpress expat.sln -for mingw builds do: -cmake .. -G "MinGW Makefiles" -DCMAKE_INSTALL_PREFIX=D:\expat-install - && gmake && gmake install diff --git a/external/mit/expat/dist/CMakeLists.txt b/external/mit/expat/dist/CMakeLists.txt deleted file mode 100755 index 0c923baa5..000000000 --- a/external/mit/expat/dist/CMakeLists.txt +++ /dev/null @@ -1,111 +0,0 @@ -# This file is copyrighted under the BSD-license for buildsystem files of KDE -# copyright 2010, Patrick Spendrin - -project(expat) - -cmake_minimum_required(VERSION 2.6) -set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org") -set(PACKAGE_NAME "expat") -set(PACKAGE_VERSION "2.1.0") -set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}") -set(PACKAGE_TARNAME "${PACKAGE_NAME}") - -option(BUILD_tools "build the xmlwf tool for expat library" ON) -option(BUILD_examples "build the examples for expat library" ON) -option(BUILD_tests "build the tests for expat library" ON) -option(BUILD_shared "build a shared expat library" ON) - -# configuration options -set(XML_CONTEXT_BYTES 1024 CACHE STRING "Define to specify how much context to retain around the current parse point") -option(XML_DTD "Define to make parameter entity parsing functionality available" ON) -option(XML_NS "Define to make XML Namespaces functionality available" ON) - -if(XML_DTD) - set(XML_DTD 1) -else(XML_DTD) - set(XML_DTD 0) -endif(XML_DTD) -if(XML_NS) - set(XML_NS 1) -else(XML_NS) - set(XML_NS 0) -endif(XML_NS) - -if(BUILD_tests) - enable_testing() -endif(BUILD_tests) - -include(ConfigureChecks.cmake) - -include_directories(${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/lib) -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -wd4996) -endif(MSVC) - -set(expat_SRCS - lib/xmlparse.c - lib/xmlrole.c - lib/xmltok.c - lib/xmltok_impl.c - lib/xmltok_ns.c -) - -if(WIN32 AND BUILD_shared) - set(expat_SRCS ${expat_SRCS} lib/libexpat.def) -endif(WIN32 AND BUILD_shared) - -if(BUILD_shared) - set(_SHARED SHARED) -else(BUILD_shared) - set(_SHARED STATIC) -endif(BUILD_shared) - -add_library(expat ${_SHARED} ${expat_SRCS}) - -install(TARGETS expat RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - -set(prefix ${CMAKE_INSTALL_PREFIX}) -set(exec_prefix "\${prefix}/bin") -set(libdir "\${prefix}/lib") -set(includedir "\${prefix}/include") -configure_file(expat.pc.in ${CMAKE_CURRENT_BINARY_DIR}/expat.pc) - -install(FILES lib/expat.h lib/expat_external.h DESTINATION include) -install(FILES ${CMAKE_CURRENT_BINARY_DIR}/expat.pc DESTINATION lib/pkgconfig) - - - -if(BUILD_tools AND NOT WINCE) - set(xmlwf_SRCS - xmlwf/xmlwf.c - xmlwf/xmlfile.c - xmlwf/codepage.c - xmlwf/readfilemap.c - ) - - add_executable(xmlwf ${xmlwf_SRCS}) - target_link_libraries(xmlwf expat) - install(TARGETS xmlwf DESTINATION bin) - install(FILES doc/xmlwf.1 DESTINATION share/man/man1) -endif(BUILD_tools AND NOT WINCE) - -if(BUILD_examples) - add_executable(elements examples/elements.c) - target_link_libraries(elements expat) - - add_executable(outline examples/outline.c) - target_link_libraries(outline expat) -endif(BUILD_examples) - -if(BUILD_tests) - ## these are unittests that can be run on any platform - add_executable(runtests tests/runtests.c tests/chardata.c tests/minicheck.c) - target_link_libraries(runtests expat) - add_test(runtests runtests) - - add_executable(runtestspp tests/runtestspp.cpp tests/chardata.c tests/minicheck.c) - target_link_libraries(runtestspp expat) - add_test(runtestspp runtestspp) -endif(BUILD_tests) diff --git a/external/mit/expat/dist/COPYING b/external/mit/expat/dist/COPYING deleted file mode 100755 index dcb450642..000000000 --- a/external/mit/expat/dist/COPYING +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - and Clark Cooper -Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006 Expat maintainers. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/external/mit/expat/dist/Changes b/external/mit/expat/dist/Changes deleted file mode 100755 index 08897b9f9..000000000 --- a/external/mit/expat/dist/Changes +++ /dev/null @@ -1,205 +0,0 @@ -Release 2.1.0 Sat March 24 2012 - - Bug Fixes: - #1742315: Harmful XML_ParserCreateNS suggestion. - #2895533: CVE-2012-1147 - Resource leak in readfilemap.c. - #1785430: Expat build fails on linux-amd64 with gcc version>=4.1 -O3. - #1983953, 2517952, 2517962, 2649838: - Build modifications using autoreconf instead of buildconf.sh. - #2815947, #2884086: OBJEXT and EXEEXT support while building. - #1990430: CVE-2009-3720 - Parser crash with special UTF-8 sequences. - #2517938: xmlwf should return non-zero exit status if not well-formed. - #2517946: Wrong statement about XMLDecl in xmlwf.1 and xmlwf.sgml. - #2855609: Dangling positionPtr after error. - #2894085: CVE-2009-3560 - Buffer over-read and crash in big2_toUtf8(). - #2958794: CVE-2012-1148 - Memory leak in poolGrow. - #2990652: CMake support. - #3010819: UNEXPECTED_STATE with a trailing "%" in entity value. - #3206497: Unitialized memory returned from XML_Parse. - #3287849: make check fails on mingw-w64. - #3496608: CVE-2012-0876 - Hash DOS attack. - - Patches: - #1749198: pkg-config support. - #3010222: Fix for bug #3010819. - #3312568: CMake support. - #3446384: Report byte offsets for attr names and values. - - New Features / API changes: - Added new API member XML_SetHashSalt() that allows setting an intial - value (salt) for hash calculations. This is part of the fix for - bug #3496608 to randomize hash parameters. - When compiled with XML_ATTR_INFO defined, adds new API member - XML_GetAttributeInfo() that allows retrieving the byte - offsets for attribute names and values (patch #3446384). - Added CMake build system. - See bug #2990652 and patch #3312568. - Added run-benchmark target to Makefile.in - relies on testdata module - present in the same relative location as in the repository. - -Release 2.0.1 Tue June 5 2007 - - Fixed bugs #1515266, #1515600: The character data handler's calling - of XML_StopParser() was not handled properly; if the parser was - stopped and the handler set to NULL, the parser would segfault. - - Fixed bug #1690883: Expat failed on EBCDIC systems as it assumed - some character constants to be ASCII encoded. - - Minor cleanups of the test harness. - - Fixed xmlwf bug #1513566: "out of memory" error on file size zero. - - Fixed outline.c bug #1543233: missing a final XML_ParserFree() call. - - Fixes and improvements for Windows platform: - bugs #1409451, #1476160, #1548182, #1602769, #1717322. - - Build fixes for various platforms: - HP-UX, Tru64, Solaris 9: patch #1437840, bug #1196180. - All Unix: #1554618 (refreshed config.sub/config.guess). - #1490371, #1613457: support both, DESTDIR and INSTALL_ROOT, - without relying on GNU-Make specific features. - #1647805: Patched configure.in to work better with Intel compiler. - - Fixes to Makefile.in to have make check work correctly: - bugs #1408143, #1535603, #1536684. - - Added Open Watcom support: patch #1523242. - -Release 2.0.0 Wed Jan 11 2006 - - We no longer use the "check" library for C unit testing; we - always use the (partial) internal implementation of the API. - - Report XML_NS setting via XML_GetFeatureList(). - - Fixed headers for use from C++. - - XML_GetCurrentLineNumber() and XML_GetCurrentColumnNumber() - now return unsigned integers. - - Added XML_LARGE_SIZE switch to enable 64-bit integers for - byte indexes and line/column numbers. - - Updated to use libtool 1.5.22 (the most recent). - - Added support for AmigaOS. - - Some mostly minor bug fixes. SF issues include: #1006708, - #1021776, #1023646, #1114960, #1156398, #1221160, #1271642. - -Release 1.95.8 Fri Jul 23 2004 - - Major new feature: suspend/resume. Handlers can now request - that a parse be suspended for later resumption or aborted - altogether. See "Temporarily Stopping Parsing" in the - documentation for more details. - - Some mostly minor bug fixes, but compilation should no - longer generate warnings on most platforms. SF issues - include: #827319, #840173, #846309, #888329, #896188, #923913, - #928113, #961698, #985192. - -Release 1.95.7 Mon Oct 20 2003 - - Fixed enum XML_Status issue (reported on SourceForge many - times), so compilers that are properly picky will be happy. - - Introduced an XMLCALL macro to control the calling - convention used by the Expat API; this macro should be used - to annotate prototypes and definitions of callback - implementations in code compiled with a calling convention - other than the default convention for the host platform. - - Improved ability to build without the configure-generated - expat_config.h header. This is useful for applications - which embed Expat rather than linking in the library. - - Fixed a variety of bugs: see SF issues #458907, #609603, - #676844, #679754, #692878, #692964, #695401, #699323, #699487, - #820946. - - Improved hash table lookups. - - Added more regression tests and improved documentation. - -Release 1.95.6 Tue Jan 28 2003 - - Added XML_FreeContentModel(). - - Added XML_MemMalloc(), XML_MemRealloc(), XML_MemFree(). - - Fixed a variety of bugs: see SF issues #615606, #616863, - #618199, #653180, #673791. - - Enhanced the regression test suite. - - Man page improvements: includes SF issue #632146. - -Release 1.95.5 Fri Sep 6 2002 - - Added XML_UseForeignDTD() for improved SAX2 support. - - Added XML_GetFeatureList(). - - Defined XML_Bool type and the values XML_TRUE and XML_FALSE. - - Use an incomplete struct instead of a void* for the parser - (may not retain). - - Fixed UTF-8 decoding bug that caused legal UTF-8 to be rejected. - - Finally fixed bug where default handler would report DTD - events that were already handled by another handler. - Initial patch contributed by Darryl Miles. - - Removed unnecessary DllMain() function that caused static - linking into a DLL to be difficult. - - Added VC++ projects for building static libraries. - - Reduced line-length for all source code and headers to be - no longer than 80 characters, to help with AS/400 support. - - Reduced memory copying during parsing (SF patch #600964). - - Fixed a variety of bugs: see SF issues #580793, #434664, - #483514, #580503, #581069, #584041, #584183, #584832, #585537, - #596555, #596678, #598352, #598944, #599715, #600479, #600971. - -Release 1.95.4 Fri Jul 12 2002 - - Added support for VMS, contributed by Craig Berry. See - vms/README.vms for more information. - - Added Mac OS (classic) support, with a makefile for MPW, - contributed by Thomas Wegner and Daryle Walker. - - Added Borland C++ Builder 5 / BCC 5.5 support, contributed - by Patrick McConnell (SF patch #538032). - - Fixed a variety of bugs: see SF issues #441449, #563184, - #564342, #566334, #566901, #569461, #570263, #575168, #579196. - - Made skippedEntityHandler conform to SAX2 (see source comment) - - Re-implemented WFC: Entity Declared from XML 1.0 spec and - added a new error "entity declared in parameter entity": - see SF bug report #569461 and SF patch #578161 - - Re-implemented section 5.1 from XML 1.0 spec: - see SF bug report #570263 and SF patch #578161 - -Release 1.95.3 Mon Jun 3 2002 - - Added a project to the MSVC workspace to create a wchar_t - version of the library; the DLLs are named libexpatw.dll. - - Changed the name of the Windows DLLs from expat.dll to - libexpat.dll; this fixes SF bug #432456. - - Added the XML_ParserReset() API function. - - Fixed XML_SetReturnNSTriplet() to work for element names. - - Made the XML_UNICODE builds usable (thanks, Karl!). - - Allow xmlwf to read from standard input. - - Install a man page for xmlwf on Unix systems. - - Fixed many bugs; see SF bug reports #231864, #461380, #464837, - #466885, #469226, #477667, #484419, #487840, #494749, #496505, - #547350. Other bugs which we can't test as easily may also - have been fixed, especially in the area of build support. - -Release 1.95.2 Fri Jul 27 2001 - - More changes to make MSVC happy with the build; add a single - workspace to support both the library and xmlwf application. - - Added a Windows installer for Windows users; includes - xmlwf.exe. - - Added compile-time constants that can be used to determine the - Expat version - - Removed a lot of GNU-specific dependencies to aide portability - among the various Unix flavors. - - Fix the UTF-8 BOM bug. - - Cleaned up warning messages for several compilers. - - Added the -Wall, -Wstrict-prototypes options for GCC. - -Release 1.95.1 Sun Oct 22 15:11:36 EDT 2000 - - Changes to get expat to build under Microsoft compiler - - Removed all aborts and instead return an UNEXPECTED_STATE error. - - Fixed a bug where a stray '%' in an entity value would cause an - abort. - - Defined XML_SetEndNamespaceDeclHandler. Thanks to Darryl Miles for - finding this oversight. - - Changed default patterns in lib/Makefile.in to fit non-GNU makes - Thanks to robin@unrated.net for reporting and providing an - account to test on. - - The reference had the wrong label for XML_SetStartNamespaceDecl. - Reported by an anonymous user. - -Release 1.95.0 Fri Sep 29 2000 - - XML_ParserCreate_MM - Allows you to set a memory management suite to replace the - standard malloc,realloc, and free. - - XML_SetReturnNSTriplet - If you turn this feature on when namespace processing is in - effect, then qualified, prefixed element and attribute names - are returned as "uri|name|prefix" where '|' is whatever - separator character is used in namespace processing. - - Merged in features from perl-expat - o XML_SetElementDeclHandler - o XML_SetAttlistDeclHandler - o XML_SetXmlDeclHandler - o XML_SetEntityDeclHandler - o StartDoctypeDeclHandler takes 3 additional parameters: - sysid, pubid, has_internal_subset - o Many paired handler setters (like XML_SetElementHandler) - now have corresponding individual handler setters - o XML_GetInputContext for getting the input context of - the current parse position. - - Added reference material - - Packaged into a distribution that builds a sharable library diff --git a/external/mit/expat/dist/ConfigureChecks.cmake b/external/mit/expat/dist/ConfigureChecks.cmake deleted file mode 100755 index 5cdf01e8d..000000000 --- a/external/mit/expat/dist/ConfigureChecks.cmake +++ /dev/null @@ -1,44 +0,0 @@ -include(CheckIncludeFile) -include(CheckIncludeFiles) -include(CheckFunctionExists) -include(CheckSymbolExists) -include(TestBigEndian) - -check_include_file("dlfcn.h" HAVE_DLFCN_H) -check_include_file("fcntl.h" HAVE_FCNTL_H) -check_include_file("inttypes.h" HAVE_INTTYPES_H) -check_include_file("memory.h" HAVE_MEMORY_H) -check_include_file("stdint.h" HAVE_STDINT_H) -check_include_file("stdlib.h" HAVE_STDLIB_H) -check_include_file("strings.h" HAVE_STRINGS_H) -check_include_file("string.h" HAVE_STRING_H) -check_include_file("sys/stat.h" HAVE_SYS_STAT_H) -check_include_file("sys/types.h" HAVE_SYS_TYPES_H) -check_include_file("unistd.h" HAVE_UNISTD_H) - -check_function_exists("getpagesize" HAVE_GETPAGESIZE) -check_function_exists("bcopy" HAVE_BCOPY) -check_symbol_exists("memmove" "string.h" HAVE_MEMMOVE) -check_function_exists("mmap" HAVE_MMAP) - -#/* Define to 1 if you have the ANSI C header files. */ -check_include_files("stdlib.h;stdarg.h;string.h;float.h" STDC_HEADERS) - -test_big_endian(WORDS_BIGENDIAN) -#/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -if(WORDS_BIGENDIAN) - set(BYTEORDER 4321) -else(WORDS_BIGENDIAN) - set(BYTEORDER 1234) -endif(WORDS_BIGENDIAN) - -if(HAVE_SYS_TYPES_H) - check_symbol_exists("off_t" "sys/types.h" OFF_T) - check_symbol_exists("size_t" "sys/types.h" SIZE_T) -else(HAVE_SYS_TYPES_H) - set(OFF_T "long") - set(SIZE_T "unsigned") -endif(HAVE_SYS_TYPES_H) - -configure_file(expat_config.h.cmake expat_config.h) -add_definitions(-DHAVE_EXPAT_CONFIG_H) diff --git a/external/mit/expat/dist/MANIFEST b/external/mit/expat/dist/MANIFEST deleted file mode 100755 index 7a020dc05..000000000 --- a/external/mit/expat/dist/MANIFEST +++ /dev/null @@ -1,141 +0,0 @@ -amiga/launch.c -amiga/expat_68k.c -amiga/expat_68k.h -amiga/expat_68k_handler_stubs.c -amiga/expat_base.h -amiga/expat_vectors.c -amiga/expat_lib.c -amiga/expat.xml -amiga/README.txt -amiga/Makefile -amiga/include/proto/expat.h -amiga/include/libraries/expat.h -amiga/include/interfaces/expat.h -amiga/include/inline4/expat.h -bcb5/README.txt -bcb5/all_projects.bpg -bcb5/elements.bpf -bcb5/elements.bpr -bcb5/elements.mak -bcb5/expat.bpf -bcb5/expat.bpr -bcb5/expat.mak -bcb5/expat_static.bpf -bcb5/expat_static.bpr -bcb5/expat_static.mak -bcb5/expatw.bpf -bcb5/expatw.bpr -bcb5/expatw.mak -bcb5/expatw_static.bpf -bcb5/expatw_static.bpr -bcb5/expatw_static.mak -bcb5/libexpat_mtd.def -bcb5/libexpatw_mtd.def -bcb5/makefile.mak -bcb5/outline.bpf -bcb5/outline.bpr -bcb5/outline.mak -bcb5/setup.bat -bcb5/xmlwf.bpf -bcb5/xmlwf.bpr -bcb5/xmlwf.mak -doc/expat.png -doc/reference.html -doc/style.css -doc/valid-xhtml10.png -doc/xmlwf.1 -doc/xmlwf.sgml -CMakeLists.txt -CMake.README -COPYING -Changes -ConfigureChecks.cmake -MANIFEST -Makefile.in -README -configure -configure.in -expat_config.h.in -expat_config.h.cmake -expat.pc.in -expat.dsw -aclocal.m4 -conftools/PrintPath -conftools/ac_c_bigendian_cross.m4 -conftools/expat.m4 -conftools/get-version.sh -conftools/mkinstalldirs -conftools/config.guess -conftools/config.sub -conftools/install-sh -conftools/ltmain.sh -m4/libtool.m4 -m4/ltversion.m4 -m4/ltoptions.m4 -m4/ltsugar.m4 -m4/lt~obsolete.m4 -examples/elements.c -examples/elements.dsp -examples/outline.c -examples/outline.dsp -lib/Makefile.MPW -lib/amigaconfig.h -lib/ascii.h -lib/asciitab.h -lib/expat.dsp -lib/expat.h -lib/expat_external.h -lib/expat_static.dsp -lib/expatw.dsp -lib/expatw_static.dsp -lib/iasciitab.h -lib/internal.h -lib/latin1tab.h -lib/libexpat.def -lib/libexpatw.def -lib/macconfig.h -lib/nametab.h -lib/utf8tab.h -lib/winconfig.h -lib/xmlparse.c -lib/xmlrole.c -lib/xmlrole.h -lib/xmltok.c -lib/xmltok.h -lib/xmltok_impl.c -lib/xmltok_impl.h -lib/xmltok_ns.c -tests/benchmark/README.txt -tests/benchmark/benchmark.c -tests/benchmark/benchmark.dsp -tests/benchmark/benchmark.dsw -tests/README.txt -tests/chardata.c -tests/chardata.h -tests/minicheck.c -tests/minicheck.h -tests/runtests.c -tests/runtestspp.cpp -tests/xmltest.sh -vms/README.vms -vms/descrip.mms -vms/expat_config.h -win32/MANIFEST.txt -win32/README.txt -win32/expat.iss -xmlwf/codepage.c -xmlwf/codepage.h -xmlwf/ct.c -xmlwf/filemap.h -xmlwf/readfilemap.c -xmlwf/unixfilemap.c -xmlwf/win32filemap.c -xmlwf/xmlfile.c -xmlwf/xmlfile.h -xmlwf/xmlmime.c -xmlwf/xmlmime.h -xmlwf/xmltchar.h -xmlwf/xmlurl.h -xmlwf/xmlwf.c -xmlwf/xmlwf.dsp -xmlwf/xmlwin32url.cxx diff --git a/external/mit/expat/dist/Makefile.in b/external/mit/expat/dist/Makefile.in deleted file mode 100755 index 9c0f5d49f..000000000 --- a/external/mit/expat/dist/Makefile.in +++ /dev/null @@ -1,201 +0,0 @@ -################################################################ -# Process this file with top-level configure script to produce Makefile -# -# Copyright 2000 Clark Cooper -# -# This file is part of EXPAT. -# -# EXPAT is free software; you can redistribute it and/or modify it -# under the terms of the License (based on the MIT/X license) contained -# in the file COPYING that comes with this distribution. -# -# EXPAT IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# SOFTWARE OR THE USE OR OTHER DEALINGS IN EXPAT. -# - -SHELL = @SHELL@ - -srcdir = @srcdir@ -top_srcdir = @top_srcdir@ -VPATH = @srcdir@ - -prefix = @prefix@ -exec_prefix = @exec_prefix@ - -bindir = @bindir@ -libdir = @libdir@ -includedir = @includedir@ -man1dir = @mandir@/man1 -pkgconfigdir = $(libdir)/pkgconfig - -top_builddir = . - - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -mkinstalldirs = $(SHELL) $(top_srcdir)/conftools/mkinstalldirs - -MANFILE = $(srcdir)/doc/xmlwf.1 -APIHEADER = $(srcdir)/lib/expat.h $(srcdir)/lib/expat_external.h -LIBRARY = libexpat.la - -DESTDIR = $(INSTALL_ROOT) - -default: buildlib xmlwf/xmlwf@EXEEXT@ - -buildlib: $(LIBRARY) expat.pc - -all: $(LIBRARY) expat.pc xmlwf/xmlwf@EXEEXT@ examples/elements examples/outline - -clean: - cd lib && rm -f $(LIBRARY) *.@OBJEXT@ *.lo && rm -rf .libs _libs - cd xmlwf && rm -f xmlwf *.@OBJEXT@ *.lo && rm -rf .libs _libs - cd examples && rm -f elements outline *.@OBJEXT@ *.lo && rm -rf .libs _libs - cd tests && rm -rf .libs runtests runtests.@OBJEXT@ runtestspp runtestspp.@OBJEXT@ - cd tests && rm -f chardata.@OBJEXT@ minicheck.@OBJEXT@ - rm -rf .libs libexpat.la - rm -f examples/core tests/core xmlwf/core - -clobber: clean - -distclean: clean - rm -f expat_config.h config.status config.log config.cache libtool - rm -f Makefile expat.pc - -extraclean: distclean - rm -f expat_config.h.in configure - rm -f aclocal.m4 m4/* - rm -f conftools/ltmain.sh conftools/install-sh conftools/config.guess conftools/config.sub - -check: tests/runtests tests/runtestspp - tests/runtests - tests/runtestspp - -install: xmlwf/xmlwf@EXEEXT@ installlib - $(mkinstalldirs) $(DESTDIR)$(bindir) $(DESTDIR)$(man1dir) - $(LIBTOOL) --mode=install $(INSTALL_PROGRAM) xmlwf/xmlwf@EXEEXT@ $(DESTDIR)$(bindir)/xmlwf - $(INSTALL_DATA) $(MANFILE) $(DESTDIR)$(man1dir) - -installlib: $(LIBRARY) $(APIHEADER) expat.pc - $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir) $(DESTDIR)$(pkgconfigdir) - $(LIBTOOL) --mode=install $(INSTALL) $(LIBRARY) $(DESTDIR)$(libdir)/$(LIBRARY) - for FN in $(APIHEADER) ; do $(INSTALL_DATA) $$FN $(DESTDIR)$(includedir) ; done - $(INSTALL_DATA) expat.pc $(DESTDIR)$(pkgconfigdir)/expat.pc - -uninstall: uninstalllib - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(bindir)/xmlwf@EXEEXT@ - rm -f $(DESTDIR)$(man1dir)/xmlwf.1 - -uninstalllib: - $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$(LIBRARY) - rm -f $(DESTDIR)$(includedir)/expat.h - rm -f $(DESTDIR)$(includedir)/expat_external.h - rm -f $(DESTDIR)$(pkgconfigdir)/expat.pc - -# for VPATH builds (invoked by configure) -mkdir-init: - @for d in lib xmlwf examples tests ; do \ - (mkdir $$d 2> /dev/null || test 1) ; \ - done - -CC = @CC@ -CXX = @CXX@ -LIBTOOL = @LIBTOOL@ - -INCLUDES = -I$(srcdir)/lib -I. -LDFLAGS = @LDFLAGS@ -CPPFLAGS = @CPPFLAGS@ -DHAVE_EXPAT_CONFIG_H -CFLAGS = @CFLAGS@ -CXXFLAGS = @CXXFLAGS@ -VSNFLAG = -version-info @LIBCURRENT@:@LIBREVISION@:@LIBAGE@ - -### autoconf this? -LTFLAGS = --silent - -COMPILE = $(CC) $(INCLUDES) $(CFLAGS) $(DEFS) $(CPPFLAGS) -CXXCOMPILE = $(CXX) $(INCLUDES) $(CXXFLAGS) $(DEFS) $(CPPFLAGS) -LTCOMPILE = $(LIBTOOL) $(LTFLAGS) --mode=compile $(COMPILE) -LINK_LIB = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) -no-undefined $(VSNFLAG) -rpath $(libdir) $(LDFLAGS) -o $@ -LINK_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(COMPILE) $(LDFLAGS) -o $@ -LINK_CXX_EXE = $(LIBTOOL) $(LTFLAGS) --mode=link $(CXXCOMPILE) $(LDFLAGS) -o $@ - -LIB_OBJS = lib/xmlparse.lo lib/xmltok.lo lib/xmlrole.lo -$(LIBRARY): $(LIB_OBJS) - $(LINK_LIB) $(LIB_OBJS) - -expat.pc: $(top_builddir)/config.status - cd $(top_builddir) && $(SHELL) ./config.status $@ - -lib/xmlparse.lo: lib/xmlparse.c lib/expat.h lib/xmlrole.h lib/xmltok.h \ - $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h - -lib/xmlrole.lo: lib/xmlrole.c lib/ascii.h lib/xmlrole.h \ - $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h - -lib/xmltok.lo: lib/xmltok.c lib/xmltok_impl.c lib/xmltok_ns.c \ - lib/ascii.h lib/asciitab.h lib/iasciitab.h lib/latin1tab.h \ - lib/nametab.h lib/utf8tab.h lib/xmltok.h lib/xmltok_impl.h \ - $(top_builddir)/expat_config.h lib/expat_external.h lib/internal.h - - -XMLWF_OBJS = xmlwf/xmlwf.@OBJEXT@ xmlwf/xmlfile.@OBJEXT@ xmlwf/codepage.@OBJEXT@ xmlwf/@FILEMAP@.@OBJEXT@ -xmlwf/xmlwf.@OBJEXT@: xmlwf/xmlwf.c -xmlwf/xmlfile.@OBJEXT@: xmlwf/xmlfile.c -xmlwf/codepage.@OBJEXT@: xmlwf/codepage.c -xmlwf/@FILEMAP@.@OBJEXT@: xmlwf/@FILEMAP@.c -xmlwf/xmlwf@EXEEXT@: $(XMLWF_OBJS) $(LIBRARY) - $(LINK_EXE) $(XMLWF_OBJS) $(LIBRARY) - -examples/elements.@OBJEXT@: examples/elements.c -examples/elements: examples/elements.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) $< $(LIBRARY) - -examples/outline.@OBJEXT@: examples/outline.c -examples/outline: examples/outline.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) $< $(LIBRARY) - -tests/chardata.@OBJEXT@: tests/chardata.c tests/chardata.h -tests/minicheck.@OBJEXT@: tests/minicheck.c tests/minicheck.h -tests/runtests.@OBJEXT@: tests/runtests.c tests/chardata.h -tests/runtests: tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) tests/runtests.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) -tests/runtestspp.@OBJEXT@: tests/runtestspp.cpp tests/runtests.c tests/chardata.h -tests/runtestspp: tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) - $(LINK_CXX_EXE) tests/runtestspp.@OBJEXT@ tests/chardata.@OBJEXT@ tests/minicheck.@OBJEXT@ $(LIBRARY) - -tests/benchmark/benchmark.@OBJEXT@: tests/benchmark/benchmark.c -tests/benchmark/benchmark: tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) - $(LINK_EXE) tests/benchmark/benchmark.@OBJEXT@ $(LIBRARY) - -run-benchmark: tests/benchmark/benchmark - tests/benchmark/benchmark@EXEEXT@ -n $(top_srcdir)/../testdata/largefiles/recset.xml 65535 3 - -tests/xmlts.zip: - wget --output-document=tests/xmlts.zip \ - http://www.w3.org/XML/Test/xmlts20080827.zip - -tests/XML-Test-Suite: tests/xmlts.zip - cd tests && unzip -q xmlts.zip - -run-xmltest: xmlwf/xmlwf@EXEEXT@ tests/XML-Test-Suite - tests/xmltest.sh - -.SUFFIXES: .c .cpp .lo .@OBJEXT@ - -.cpp.@OBJEXT@: - $(CXXCOMPILE) -o $@ -c $< -.c.@OBJEXT@: - $(COMPILE) -o $@ -c $< -.c.lo: - $(LTCOMPILE) -o $@ -c $< - -.PHONY: buildlib all \ - clean distclean extraclean maintainer-clean \ - dist distdir \ - install uninstall diff --git a/external/mit/expat/dist/README b/external/mit/expat/dist/README deleted file mode 100755 index 1f88467d1..000000000 --- a/external/mit/expat/dist/README +++ /dev/null @@ -1,139 +0,0 @@ - - Expat, Release 2.1.0 - -This is Expat, a C library for parsing XML, written by James Clark. -Expat is a stream-oriented XML parser. This means that you register -handlers with the parser before starting the parse. These handlers -are called when the parser discovers the associated structures in the -document being parsed. A start tag is an example of the kind of -structures for which you may register handlers. - -Windows users should use the expat_win32bin package, which includes -both precompiled libraries and executables, and source code for -developers. - -Expat is free software. You may copy, distribute, and modify it under -the terms of the License contained in the file COPYING distributed -with this package. This license is the same as the MIT/X Consortium -license. - -Versions of Expat that have an odd minor version (the middle number in -the release above), are development releases and should be considered -as beta software. Releases with even minor version numbers are -intended to be production grade software. - -If you are building Expat from a check-out from the CVS repository, -you need to run a script that generates the configure script using the -GNU autoconf and libtool tools. To do this, you need to have -autoconf 2.58 or newer. Run the script like this: - - ./buildconf.sh - -Once this has been done, follow the same instructions as for building -from a source distribution. - -To build Expat from a source distribution, you first run the -configuration shell script in the top level distribution directory: - - ./configure - -There are many options which you may provide to configure (which you -can discover by running configure with the --help option). But the -one of most interest is the one that sets the installation directory. -By default, the configure script will set things up to install -libexpat into /usr/local/lib, expat.h into /usr/local/include, and -xmlwf into /usr/local/bin. If, for example, you'd prefer to install -into /home/me/mystuff/lib, /home/me/mystuff/include, and -/home/me/mystuff/bin, you can tell configure about that with: - - ./configure --prefix=/home/me/mystuff - -Another interesting option is to enable 64-bit integer support for -line and column numbers and the over-all byte index: - - ./configure CPPFLAGS=-DXML_LARGE_SIZE - -However, such a modification would be a breaking change to the ABI -and is therefore not recommended for general use - e.g. as part of -a Linux distribution - but rather for builds with special requirements. - -After running the configure script, the "make" command will build -things and "make install" will install things into their proper -location. Have a look at the "Makefile" to learn about additional -"make" options. Note that you need to have write permission into -the directories into which things will be installed. - -If you are interested in building Expat to provide document -information in UTF-16 encoding rather than the default UTF-8, follow -these instructions (after having run "make distclean"): - - 1. For UTF-16 output as unsigned short (and version/error - strings as char), run: - - ./configure CPPFLAGS=-DXML_UNICODE - - For UTF-16 output as wchar_t (incl. version/error strings), - run: - - ./configure CFLAGS="-g -O2 -fshort-wchar" \ - CPPFLAGS=-DXML_UNICODE_WCHAR_T - - 2. Edit the MakeFile, changing: - - LIBRARY = libexpat.la - - to: - - LIBRARY = libexpatw.la - - (Note the additional "w" in the library name.) - - 3. Run "make buildlib" (which builds the library only). - Or, to save step 2, run "make buildlib LIBRARY=libexpatw.la". - - 4. Run "make installlib" (which installs the library only). - Or, if step 2 was omitted, run "make installlib LIBRARY=libexpatw.la". - -Using DESTDIR or INSTALL_ROOT is enabled, with INSTALL_ROOT being the default -value for DESTDIR, and the rest of the make file using only DESTDIR. -It works as follows: - $ make install DESTDIR=/path/to/image -overrides the in-makefile set DESTDIR, while both - $ INSTALL_ROOT=/path/to/image make install - $ make install INSTALL_ROOT=/path/to/image -use DESTDIR=$(INSTALL_ROOT), even if DESTDIR eventually is defined in the -environment, because variable-setting priority is -1) commandline -2) in-makefile -3) environment - -Note: This only applies to the Expat library itself, building UTF-16 versions -of xmlwf and the tests is currently not supported. - -Note for Solaris users: The "ar" command is usually located in -"/usr/ccs/bin", which is not in the default PATH. You will need to -add this to your path for the "make" command, and probably also switch -to GNU make (the "make" found in /usr/ccs/bin does not seem to work -properly -- appearantly it does not understand .PHONY directives). If -you're using ksh or bash, use this command to build: - - PATH=/usr/ccs/bin:$PATH make - -When using Expat with a project using autoconf for configuration, you -can use the probing macro in conftools/expat.m4 to determine how to -include Expat. See the comments at the top of that file for more -information. - -A reference manual is available in the file doc/reference.html in this -distribution. - -The homepage for this project is http://www.libexpat.org/. There -are links there to connect you to the bug reports page. If you need -to report a bug when you don't have access to a browser, you may also -send a bug report by email to expat-bugs@mail.libexpat.org. - -Discussion related to the direction of future expat development takes -place on expat-discuss@mail.libexpat.org. Archives of this list and -other Expat-related lists may be found at: - - http://mail.libexpat.org/mailman/listinfo/ diff --git a/external/mit/expat/dist/aclocal.m4 b/external/mit/expat/dist/aclocal.m4 deleted file mode 100644 index 6fe5ffd2a..000000000 --- a/external/mit/expat/dist/aclocal.m4 +++ /dev/null @@ -1,8460 +0,0 @@ -# generated automatically by aclocal 1.11.1 -*- Autoconf -*- - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, -# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. -# This file is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 57 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_WITH_SYSROOT])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_REPLACE_SHELLFNS - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) -# ---------------------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -# Store the results from the different compilers for each TAGNAME. -# Allow to override them for all tags through lt_cv_aix_libpath. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], - [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ - lt_aix_libpath_sed='[ - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }]' - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi],[]) - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" - fi - ]) - aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) -fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -case "$ECHO" in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_WITH_SYSROOT -# ---------------- -AC_DEFUN([_LT_WITH_SYSROOT], -[AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[ --with-sysroot[=DIR] Search for dependent libraries within DIR - (or the compiler's sysroot if not specified).], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([${with_sysroot}]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac - - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and in which our libraries should be installed.])]) - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_PROG_AR -# ----------- -m4_defun([_LT_PROG_AR], -[AC_CHECK_TOOLS(AR, [ar], false) -: ${AR=ar} -: ${AR_FLAGS=cru} -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) - -AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], - [lt_cv_ar_at_file=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - ]) - ]) - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi -_LT_DECL([], [archiver_list_spec], [1], - [How to feed a file listing to the archiver]) -])# _LT_PROG_AR - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[_LT_PROG_AR - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[[3-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method = "file_magic"]) -_LT_DECL([], [file_magic_glob], [1], - [How to find potential files when deplibs_check_method = "file_magic"]) -_LT_DECL([], [want_nocaseglob], [1], - [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - -# _LT_CHECK_SHAREDLIB_FROM_LINKLIB -# -------------------------------- -# how to determine the name of the shared library -# associated with a specific link library. -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -m4_require([_LT_DECL_DLLTOOL]) -AC_CACHE_CHECK([how to associate runtime and link libraries], -lt_cv_sharedlib_from_linklib_cmd, -[lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac -]) -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - -_LT_DECL([], [sharedlib_from_linklib_cmd], [1], - [Command to associate shared and link libraries]) -])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB - - -# _LT_PATH_MANIFEST_TOOL -# ---------------------- -# locate the manifest tool -m4_defun([_LT_PATH_MANIFEST_TOOL], -[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&AS_MESSAGE_LOG_FD - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest*]) -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi -_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl -])# _LT_PATH_MANIFEST_TOOL - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT@&t@_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT@&t@_DLSYM_CONST -#else -# define LT@&t@_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT@&t@_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([], [nm_file_list_spec], [1], - [Specify filename containing input files for $NM]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac - -AC_CACHE_CHECK([for $compiler option to produce PIC], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - esac - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], - [lt_cv_irix_exported_symbol], - [save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], - [C++], [[int foo (void) { return 0; }]], - [Fortran 77], [[ - subroutine foo - end]], - [Fortran], [[ - subroutine foo - end]])])], - [lt_cv_irix_exported_symbol=yes], - [lt_cv_irix_exported_symbol=no]) - LDFLAGS="$save_LDFLAGS"]) - if test "$lt_cv_irix_exported_symbol" = yes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [postlink_cmds], [2], - [Commands necessary for finishing linking programs]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_FUNC_STRIPNAME_CNF -# ---------------------- -# func_stripname_cnf prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# -# This function is identical to the (non-XSI) version of func_stripname, -# except this one can be used by m4 code that may be executed by configure, -# rather than the libtool script. -m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl -AC_REQUIRE([_LT_DECL_SED]) -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf -])# _LT_FUNC_STRIPNAME_CNF - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -]) - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -esac - -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${F77-"f77"} - CFLAGS=$FFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" - CFLAGS="$lt_save_CFLAGS" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${FC-"f95"} - CFLAGS=$FCFLAGS - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -CFLAGS=$GCJFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -CFLAGS= -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - -# _LT_DECL_DLLTOOL -# ---------------- -# Ensure DLLTOOL variable is set. -m4_defun([_LT_DECL_DLLTOOL], -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) -AC_SUBST([DLLTOOL]) -]) - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------------ -# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and -# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_FUNCTION_REPLACE], -[dnl { -sed -e '/^$1 ()$/,/^} # $1 /c\ -$1 ()\ -{\ -m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: -]) - - -# _LT_PROG_REPLACE_SHELLFNS -# ------------------------- -# Replace existing portable implementations of several shell functions with -# equivalent extended shell implementations where those features are available.. -m4_defun([_LT_PROG_REPLACE_SHELLFNS], -[if test x"$xsi_shell" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) - - _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) - - _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) - - _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) -fi - -if test x"$lt_shell_append" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) - - _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl - func_quote_for_eval "${2}" -dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ - eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) -fi -]) - -# _LT_PATH_CONVERSION_FUNCTIONS -# ----------------------------- -# Determine which file name conversion functions should be used by -# func_to_host_file (and, implicitly, by func_to_host_path). These are needed -# for certain cross-compile configurations and native mingw. -m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_MSG_CHECKING([how to convert $build file names to $host format]) -AC_CACHE_VAL(lt_cv_to_host_file_cmd, -[case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac -]) -to_host_file_cmd=$lt_cv_to_host_file_cmd -AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) -_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], - [0], [convert $build file names to $host format])dnl - -AC_MSG_CHECKING([how to convert $build file names to toolchain format]) -AC_CACHE_VAL(lt_cv_to_tool_file_cmd, -[#assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac -]) -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) -_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], - [0], [convert $build files to toolchain format])dnl -])# _LT_PATH_CONVERSION_FUNCTIONS - -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 7 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) - -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) - -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# @configure_input@ - -# serial 3293 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.4]) -m4_define([LT_PACKAGE_REVISION], [1.3293]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4' -macro_revision='1.3293' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) - -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) - diff --git a/external/mit/expat/dist/amiga/Makefile b/external/mit/expat/dist/amiga/Makefile deleted file mode 100755 index c6d126199..000000000 --- a/external/mit/expat/dist/amiga/Makefile +++ /dev/null @@ -1,336 +0,0 @@ -# -# Makefile for AmigaOS -# - -.PHONY: help all check clean package -.PHONY: clib2 newlib library so - -vpath %.c ../lib ../examples ../xmlwf ../tests ../tests/benchmark -vpath %.h ../lib ../tests - -############################################################################# - -help: - @echo "Requires:" - @echo " AmigaOS 4.x" - @echo " SDK 53.13" - @echo "" - @echo "Targets:" - @echo " all - make libraries, xmlwf, examples and runs tests" - @echo " install - install expat libraries and tools into SDK" - @echo " clean - clean object files" - @echo " check - run all the tests" - @echo " package - prepare distribution archive" - -all: clib2 newlib library so check - -clib2: clib2/libexpat.a clib2/xmlwf clib2/elements clib2/outline clib2/runtests clib2/benchmark - -newlib: newlib/libexpat.a newlib/xmlwf newlib/elements newlib/outline newlib/runtests newlib/benchmark - -library: libs/expat.library libs/xmlwf libs/elements libs/outline libs/runtests libs/benchmark - -so: so/libexpat.so so/xmlwf so/elements so/outline so/runtests so/benchmark - -check: clib2/runtests newlib/runtests libs/runtests so/runtests - clib2/runtests - newlib/runtests - libs/runtests - so/runtests - -clean: - -delete clib2/#?.o quiet - -delete newlib/#?.o quiet - -delete libs/#?.o quiet - -delete so/#?.o quiet - -package: - $(MAKE) all - -delete T:expat all force quiet - makedir all T:expat/Workbench/Libs - copy clone libs/expat.library T:expat/Workbench/Libs - makedir all T:expat/Workbench/SObjs - copy clone so/libexpat.so T:expat/Workbench/SObjs - makedir all T:expat/SDK/Local/C - copy clone libs/xmlwf T:expat/SDK/Local/C - makedir all T:expat/SDK/Local/clib2/lib - copy clone clib2/libexpat.a T:expat/SDK/Local/clib2/lib - makedir all T:expat/SDK/Local/newlib/lib - copy clone newlib/libexpat.a T:expat/SDK/Local/newlib/lib - makedir all T:expat/SDK/Local/common/include - copy clone /lib/expat.h /lib/expat_external.h T:expat/SDK/Local/common/include - makedir all T:expat/SDK/Include/include_h/inline4 - copy clone include/inline4/expat.h T:expat/SDK/Include/include_h/inline4 - makedir all T:expat/SDK/Include/include_h/interfaces - copy clone include/interfaces/expat.h T:expat/SDK/Include/include_h/interfaces - makedir all T:expat/SDK/Include/include_h/libraries - copy clone include/libraries/expat.h T:expat/SDK/Include/include_h/libraries - makedir all T:expat/SDK/Include/include_h/proto - copy clone include/proto/expat.h T:expat/SDK/Include/include_h/proto - makedir all T:expat/SDK/Documentation/Libs/Expat - copy clone /COPYING T:expat/SDK/Documentation/Libs/Expat - copy clone /README T:expat/SDK/Documentation/Libs/Expat - copy clone README.txt T:expat/SDK/Documentation/Libs/Expat/README.AmigaOS - -delete expat.lha - lha -r a expat.lha T:expat - -############################################################################# - -CC := gcc -LIBTOOL := ar -STRIP := strip - -CFLAGS := -DNDEBUG -O3 -LTFLAGS := -crs -STRIPFLAGS := -R.comment - -############################################################################# - -clib2/libexpat.a: clib2/xmlparse.o clib2/xmltok.o clib2/xmlrole.o - $(LIBTOOL) $(LTFLAGS) $@ $^ - protect $@ -e - -clib2/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ - expat_external.h internal.h amigaconfig.h - -clib2/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ - internal.h amigaconfig.h - -clib2/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ - iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ - expat_external.h internal.h amigaconfig.h - -############################################################################# - -clib2/xmlwf: clib2/xmlwf.o clib2/xmlfile.o clib2/codepage.o clib2/readfilemap.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -clib2/xmlwf.o: xmlwf.c - -clib2/xmlfile.o: xmlfile.c - -clib2/codepage.o: codepage.c - -clib2/readfilemap.o: readfilemap.c - -############################################################################# - -clib2/elements: clib2/elements.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -clib2/elements.o: elements.c - -############################################################################# - -clib2/outline: clib2/outline.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -clib2/outline.o: outline.c - -############################################################################# - -clib2/runtests: clib2/runtests.o clib2/chardata.o clib2/minicheck.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a - -clib2/chardata.o: chardata.c chardata.h - -clib2/minicheck.o: minicheck.c minicheck.h - -clib2/runtests.o: runtests.c chardata.h - -############################################################################# - -clib2/benchmark: clib2/benchmark.o - $(CC) -mcrt=clib2 $^ -o $@ clib2/libexpat.a -lm - -clib2/benchmark.o: benchmark.c - -############################################################################# - -newlib/libexpat.a: newlib/xmlparse.o newlib/xmltok.o newlib/xmlrole.o - $(LIBTOOL) $(LTFLAGS) $@ $^ - protect $@ -e - -newlib/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ - expat_external.h internal.h amigaconfig.h - -newlib/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ - internal.h amigaconfig.h - -newlib/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ - iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ - expat_external.h internal.h amigaconfig.h - -############################################################################# - -newlib/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -newlib/xmlwf.o: xmlwf.c - -newlib/xmlfile.o: xmlfile.c - -newlib/codepage.o: codepage.c - -newlib/readfilemap.o: readfilemap.c - -############################################################################# - -newlib/elements: newlib/elements.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -newlib/elements.o: elements.c - -############################################################################# - -newlib/outline: newlib/outline.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - $(STRIP) $(STRIPFLAGS) $@ - -newlib/outline.o: outline.c - -############################################################################# - -newlib/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - -newlib/chardata.o: chardata.c chardata.h - -newlib/minicheck.o: minicheck.c minicheck.h - -newlib/runtests.o: runtests.c chardata.h - -############################################################################# - -newlib/benchmark: newlib/benchmark.o - $(CC) -mcrt=newlib $^ -o $@ newlib/libexpat.a - -newlib/benchmark.o: benchmark.c - -############################################################################# - -libs/expat.library: libs/expat_lib.o libs/expat_68k.o libs/expat_68k_handler_stubs.o libs/expat_vectors.o newlib/libexpat.a - $(CC) -mcrt=newlib -nostartfiles $^ -o $@ newlib/libexpat.a -Wl,--cref,-M,-Map=$@.map - protect $@ -e - $(STRIP) $(STRIPFLAGS) $@ - -libs/expat_lib.o: expat_lib.c expat_base.h - -libs/expat_68k.o: expat_68k.c expat_68k.h expat_base.h - -libs/expat_68k_handler_stubs.o: expat_68k_handler_stubs.c expat_68k.h - -libs/expat_vectors.o: expat_vectors.c - -libs/launch.o: launch.c - -############################################################################# - -libs/xmlwf: libs/xmlwf.o libs/xmlfile.o libs/codepage.o libs/readfilemap.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - $(STRIP) $(STRIPFLAGS) $@ - -libs/xmlwf.o: xmlwf.c - -libs/xmlfile.o: xmlfile.c - -libs/codepage.o: codepage.c - -libs/readfilemap.o: readfilemap.c - -############################################################################# - -libs/elements: libs/elements.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - $(STRIP) $(STRIPFLAGS) $@ - -libs/elements.o: elements.c - -############################################################################# - -libs/outline: libs/outline.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - $(STRIP) $(STRIPFLAGS) $@ - -libs/outline.o: outline.c - -############################################################################# - -libs/runtests: libs/runtests.o libs/chardata.o libs/minicheck.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - -libs/chardata.o: chardata.c chardata.h - -libs/minicheck.o: minicheck.c minicheck.h - -libs/runtests.o: runtests.c chardata.h - -############################################################################# - -libs/benchmark: libs/benchmark.o libs/launch.o - $(CC) -mcrt=newlib $^ -o $@ - -libs/benchmark.o: benchmark.c - -############################################################################# - -so/libexpat.so: so/xmlparse.o so/xmltok.o so/xmlrole.o - $(CC) -mcrt=newlib -shared -o $@ $^ - protect $@ -e - -so/xmlparse.o: xmlparse.c expat.h xmlrole.h xmltok.h \ - expat_external.h internal.h amigaconfig.h - -so/xmlrole.o: xmlrole.c ascii.h xmlrole.h expat_external.h \ - internal.h amigaconfig.h - -so/xmltok.o: xmltok.c xmltok_impl.c xmltok_ns.c ascii.h asciitab.h \ - iasciitab.h latin1tab.h nametab.h utf8tab.h xmltok.h xmltok_impl.h \ - expat_external.h internal.h amigaconfig.h - -############################################################################# - -so/xmlwf: newlib/xmlwf.o newlib/xmlfile.o newlib/codepage.o newlib/readfilemap.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - $(STRIP) $(STRIPFLAGS) $@ - -############################################################################# - -so/elements: newlib/elements.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - $(STRIP) $(STRIPFLAGS) $@ - -############################################################################# - -so/outline: newlib/outline.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - $(STRIP) $(STRIPFLAGS) $@ - -############################################################################# - -so/runtests: newlib/runtests.o newlib/chardata.o newlib/minicheck.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - -############################################################################# - -so/benchmark: newlib/benchmark.o - $(CC) -mcrt=newlib -use-dynld $^ -o $@ -Lso -lexpat - -############################################################################# - -clib2/%.o: %.c - $(CC) -mcrt=clib2 $(CFLAGS) -I../lib -c $< -o $@ - -newlib/%.o: %.c - $(CC) -mcrt=newlib $(CFLAGS) -I../lib -c $< -o $@ - -libs/%.o: %.c - $(CC) -mcrt=newlib $(CFLAGS) -D__USE_INLINE__ -I. -Iinclude -Iinclude/libraries -I../lib -c $< -o $@ - -so/%.o: %.c - $(CC) -mcrt=newlib $(CFLAGS) -fPIC -I../lib -c $< -o $@ diff --git a/external/mit/expat/dist/amiga/README.txt b/external/mit/expat/dist/amiga/README.txt deleted file mode 100755 index 3ba9267ef..000000000 --- a/external/mit/expat/dist/amiga/README.txt +++ /dev/null @@ -1,98 +0,0 @@ -SUMMARY -======= -This is a port of expat for AmigaOS 4.x which includes the -SDK, some XML tools and the libraries. - -Four library flavours are supported: -1. static clib2 (libexpat.a) -2. static newlib (libexpat.a) -3. AmigaOS library (expat.library) -4. AmigaOS shared object library (libexpat.so) - -The AmigaOS library version is based on the work of Fredrik Wikstrom. - - -BUILDING -======== -To build all the library flavours, all the tools, examples and run the -test suite, simply type 'make all' in the amiga subdirectory. - - -INSTALLATION -============ -To install expat into the standard AmigaOS SDK type 'make install' -in the amiga subdirectory. - - -CONFIGURATION -============= -You may want to edit the lib/amigaconfig.h file to remove -DTD and/or XML namespace support if they are not required by your -specific application for a smaller and faster implementation. - - -SOURCE CODE -=========== -The source code is actively maintained and merged with the official -Expat repository available at http://expat.sourceforge.net/ - - -HISTORY -======= -53.1 - bumped version to match AmigaOS streaming - - modified to remove all global variables (except INewLib) - - removed replacements for malloc(), etc. which are now - handled by the respective C library - - compiled with the latest binutils which bumps the - AMIGAOS_DYNVERSION to 2 for the libexpat.so target - - now strips the expat.library binary - -5.2 - fixed XML_Parse 68k stub which enables xmlviewer to work - without crashing - - added some new functions to the 68k jump table available - in the latest expat.library for AmigaOS 3.x - - patches provided by Fredrik Wikstrom - -5.1 - fixed package archive which was missing libexpat.so - - fixed library protection bits - - fixed up copyright notices - -5.0 - integrated 68k patches from Fredrik Wikstrom which means - expat.library is now callable from 68k code - - bumped version for the addition of the 68k interface so - executables can explicitly ask for version 5 and know - it includes the 68k interface - - refactored Makefile to avoid recursive make calls and - build all the library flavours - - added static newlib version - - added shared objects version - - added package target to Makefile - - compiled with SDK 53.13 (GCC 4.2.4) at -O3 - -4.2 - updated to correspond to Expat 2.0.1 release - - bumped copyright banners and versions - - simplified amigaconfig.h - - updated include/libraries/expat.h file - - modified launch.c to use contructor/deconstructor - - removed need for amiga_main() from expat utilities - -4.1 - fixed memory freeing bug in shared library version - - now allocates shared memory - -4.0 - updated for corresponding Expat 2.0 release - - some minor CVS related changes - -3.1 - removed obsolete sfd file - - added library description xml file - - refactored Makefile - - removed extraneous VARARGS68K keywords - - reworked default memory handling functions in shared lib - - updated amigaconfig.h - -3.0 - initial release - - based on expat 1.95.8 - - -TO DO -===== -- wide character support (UTF-16) diff --git a/external/mit/expat/dist/amiga/expat.xml b/external/mit/expat/dist/amiga/expat.xml deleted file mode 100755 index d6aeae2e3..000000000 --- a/external/mit/expat/dist/amiga/expat.xml +++ /dev/null @@ -1,264 +0,0 @@ - - - - - libraries/expat.h - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/external/mit/expat/dist/amiga/expat_68k.c b/external/mit/expat/dist/amiga/expat_68k.c deleted file mode 100644 index aa4c6e270..000000000 --- a/external/mit/expat/dist/amiga/expat_68k.c +++ /dev/null @@ -1,939 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -/* -** Note: This file was originally automatically generated by fdtrans. -*/ - -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#include -#include -#include -#include -#include -#include "expat_68k.h" -#include "expat_base.h" - - -STATIC ULONG stub_OpenPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary; - - return (ULONG) Self->Open(0); -} -struct EmuTrap stub_Open = { TRAPINST, TRAPTYPE, stub_OpenPPC }; - -STATIC ULONG stub_ClosePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct LibraryManagerInterface *Self = (struct LibraryManagerInterface *) ExtLib->ILibrary; - - return (ULONG) Self->Close(); -} -struct EmuTrap stub_Close = { TRAPINST, TRAPTYPE, stub_ClosePPC }; - -STATIC ULONG stub_ExpungePPC(ULONG *regarray) -{ - return 0UL; -} -struct EmuTrap stub_Expunge = { TRAPINST, TRAPTYPE, stub_ExpungePPC }; - -STATIC ULONG stub_ReservedPPC(ULONG *regarray) -{ - return 0UL; -} -struct EmuTrap stub_Reserved = { TRAPINST, TRAPTYPE, stub_ReservedPPC }; - -static M68kXML_Parser stub_XML_ParserCreatePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p; - p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); - if (p) { - p->p = Self->XML_ParserCreate((const XML_Char *)regarray[8]); - if (p->p) { - p->IExec = IExec; - Self->XML_SetUserData(p->p, p); - return p; - } - IExec->FreeVec(p); - } - return NULL; -} -struct EmuTrap stub_XML_ParserCreate = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreatePPC }; - -static M68kXML_Parser stub_XML_ParserCreateNSPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p; - p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); - if (p) { - p->p = Self->XML_ParserCreateNS((const XML_Char *)regarray[8], (XML_Char)regarray[0]); - if (p->p) { - p->IExec = IExec; - Self->XML_SetUserData(p->p, p); - return p; - } - IExec->FreeVec(p); - } - return NULL; -} -struct EmuTrap stub_XML_ParserCreateNS = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreateNSPPC }; - -static M68kXML_Parser stub_XML_ParserCreate_MMPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p; - p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); - if (p) { - p->p = Self->XML_ParserCreate_MM((const XML_Char *)regarray[8], - (const XML_Memory_Handling_Suite *)regarray[9], - (const XML_Char *)regarray[10]); - if (p->p) { - p->IExec = IExec; - Self->XML_SetUserData(p->p, p); - return p; - } - IExec->FreeVec(p); - } - return NULL; -} -struct EmuTrap stub_XML_ParserCreate_MM = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserCreate_MMPPC }; - -static M68kXML_Parser stub_XML_ExternalEntityParserCreatePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p; - p = IExec->AllocVec(sizeof(*p), MEMF_SHARED|MEMF_CLEAR); - if (p) { - p->p = Self->XML_ExternalEntityParserCreate((XML_Parser)regarray[8], - (const XML_Char *)regarray[9], (const XML_Char *)regarray[10]); - if (p->p) { - p->IExec = IExec; - Self->XML_SetUserData(p->p, p); - return p; - } - IExec->FreeVec(p); - } - return NULL; -} -struct EmuTrap stub_XML_ExternalEntityParserCreate = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExternalEntityParserCreatePPC }; - -static void stub_XML_ParserFreePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - struct ExecIFace *IExec = ((struct ExpatBase *)Self->Data.LibBase)->IExec; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - if (p) { - Self->XML_ParserFree(p->p); - IExec->FreeVec(p); - } -} -struct EmuTrap stub_XML_ParserFree = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserFreePPC }; - -static int stub_XML_ParsePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_SetUserData(p->p, p); - return Self->XML_Parse(p->p, (const char *)regarray[9], (int)regarray[0], (int)regarray[1]); -} -struct EmuTrap stub_XML_Parse = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParsePPC }; - -static int stub_XML_ParseBufferPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_ParseBuffer(p->p, (int)regarray[0], (int)regarray[1]); -} -struct EmuTrap stub_XML_ParseBuffer = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParseBufferPPC }; - -static void * stub_XML_GetBufferPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetBuffer(p->p, (int)regarray[0]); -} -struct EmuTrap stub_XML_GetBuffer = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetBufferPPC }; - -static void stub_XML_SetStartElementHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startelementhandler = (void *)regarray[9]; - Self->XML_SetStartElementHandler(p->p, _68k_startelementhandler); -} -struct EmuTrap stub_XML_SetStartElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartElementHandlerPPC }; - -static void stub_XML_SetEndElementHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->endelementhandler = (void *)regarray[9]; - Self->XML_SetEndElementHandler(p->p, _68k_endelementhandler); -} -struct EmuTrap stub_XML_SetEndElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndElementHandlerPPC }; - -static void stub_XML_SetElementHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startelementhandler = (void *)regarray[9]; - p->endelementhandler = (void *)regarray[10]; - Self->XML_SetElementHandler(p->p, _68k_startelementhandler, _68k_endelementhandler); -} -struct EmuTrap stub_XML_SetElementHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetElementHandlerPPC }; - -static void stub_XML_SetCharacterDataHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->chardatahandler = (void *)regarray[9]; - Self->XML_SetCharacterDataHandler(p->p, _68k_chardatahandler); -} -struct EmuTrap stub_XML_SetCharacterDataHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCharacterDataHandlerPPC }; - -static void stub_XML_SetProcessingInstructionHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->procinsthandler = (void *)regarray[9]; - Self->XML_SetProcessingInstructionHandler(p->p, _68k_procinsthandler); -} -struct EmuTrap stub_XML_SetProcessingInstructionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetProcessingInstructionHandlerPPC }; - -static void stub_XML_SetCommentHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->commenthandler = (void *)regarray[9]; - Self->XML_SetCommentHandler(p->p, _68k_commenthandler); -} -struct EmuTrap stub_XML_SetCommentHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCommentHandlerPPC }; - -static void stub_XML_SetStartCdataSectionHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startcdatahandler = (void *)regarray[9]; - Self->XML_SetStartCdataSectionHandler(p->p, _68k_startcdatahandler); -} -struct EmuTrap stub_XML_SetStartCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartCdataSectionHandlerPPC }; - -static void stub_XML_SetEndCdataSectionHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->endcdatahandler = (void *)regarray[9]; - Self->XML_SetEndCdataSectionHandler(p->p, _68k_endcdatahandler); -} -struct EmuTrap stub_XML_SetEndCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndCdataSectionHandlerPPC }; - -static void stub_XML_SetCdataSectionHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startcdatahandler = (void *)regarray[9]; - p->endcdatahandler = (void *)regarray[10]; - Self->XML_SetCdataSectionHandler(p->p, _68k_startcdatahandler, _68k_endcdatahandler); -} -struct EmuTrap stub_XML_SetCdataSectionHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetCdataSectionHandlerPPC }; - -static void stub_XML_SetDefaultHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->defaulthandler = (void *)regarray[9]; - Self->XML_SetDefaultHandler(p->p, _68k_defaulthandler); -} -struct EmuTrap stub_XML_SetDefaultHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDefaultHandlerPPC }; - -static void stub_XML_SetDefaultHandlerExpandPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->defaulthandlerexp = (void *)regarray[9]; - Self->XML_SetDefaultHandlerExpand(p->p, _68k_defaulthandlerexp); -} -struct EmuTrap stub_XML_SetDefaultHandlerExpand = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDefaultHandlerExpandPPC }; - -static void stub_XML_SetExternalEntityRefHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->extentrefhandler = (void *)regarray[9]; - Self->XML_SetExternalEntityRefHandler(p->p, _68k_extentrefhandler); -} -struct EmuTrap stub_XML_SetExternalEntityRefHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetExternalEntityRefHandlerPPC }; - -static void stub_XML_SetExternalEntityRefHandlerArgPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->extenthandlerarg = (void *)regarray[9]; -} -struct EmuTrap stub_XML_SetExternalEntityRefHandlerArg = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetExternalEntityRefHandlerArgPPC }; - -static void stub_XML_SetUnknownEncodingHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->unknownenchandler = (void *)regarray[9]; - p->enchandlerarg = (void *)regarray[10]; - Self->XML_SetUnknownEncodingHandler(p->p, _68k_unknownenchandler, p); -} -struct EmuTrap stub_XML_SetUnknownEncodingHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUnknownEncodingHandlerPPC }; - -static void stub_XML_SetStartNamespaceDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startnamespacehandler = (void *)regarray[9]; - Self->XML_SetStartNamespaceDeclHandler(p->p, _68k_startnamespacehandler); -} -struct EmuTrap stub_XML_SetStartNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartNamespaceDeclHandlerPPC }; - -static void stub_XML_SetEndNamespaceDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->endnamespacehandler = (void *)regarray[9]; - Self->XML_SetEndNamespaceDeclHandler(p->p, _68k_endnamespacehandler); -} -struct EmuTrap stub_XML_SetEndNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndNamespaceDeclHandlerPPC }; - -static void stub_XML_SetNamespaceDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startnamespacehandler = (void *)regarray[9]; - p->endnamespacehandler = (void *)regarray[10]; - Self->XML_SetNamespaceDeclHandler(p->p, _68k_startnamespacehandler, _68k_endnamespacehandler); -} -struct EmuTrap stub_XML_SetNamespaceDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNamespaceDeclHandlerPPC }; - -static void stub_XML_SetXmlDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->xmldeclhandler = (void *)regarray[9]; - Self->XML_SetXmlDeclHandler(p->p, _68k_xmldeclhandler); -} -struct EmuTrap stub_XML_SetXmlDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetXmlDeclHandlerPPC }; - -static void stub_XML_SetStartDoctypeDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startdoctypehandler = (void *)regarray[9]; - Self->XML_SetStartDoctypeDeclHandler(p->p, _68k_startdoctypehandler); -} -struct EmuTrap stub_XML_SetStartDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetStartDoctypeDeclHandlerPPC }; - -static void stub_XML_SetEndDoctypeDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->enddoctypehandler = (void *)regarray[9]; - Self->XML_SetEndDoctypeDeclHandler(p->p, _68k_enddoctypehandler); -} -struct EmuTrap stub_XML_SetEndDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEndDoctypeDeclHandlerPPC }; - -static void stub_XML_SetDoctypeDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->startdoctypehandler = (void *)regarray[9]; - p->enddoctypehandler = (void *)regarray[10]; - Self->XML_SetDoctypeDeclHandler(p->p, _68k_startdoctypehandler, _68k_enddoctypehandler); -} -struct EmuTrap stub_XML_SetDoctypeDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetDoctypeDeclHandlerPPC }; - -static void stub_XML_SetElementDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->elementdeclhandler = (void *)regarray[9]; - Self->XML_SetElementDeclHandler(p->p, _68k_elementdeclhandler); -} -struct EmuTrap stub_XML_SetElementDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetElementDeclHandlerPPC }; - -static void stub_XML_SetAttlistDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->attlistdeclhandler = (void *)regarray[9]; - Self->XML_SetAttlistDeclHandler(p->p, _68k_attlistdeclhandler); -} -struct EmuTrap stub_XML_SetAttlistDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetAttlistDeclHandlerPPC }; - -static void stub_XML_SetEntityDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->entitydeclhandler = (void *)regarray[9]; - Self->XML_SetEntityDeclHandler(p->p, _68k_entitydeclhandler); -} -struct EmuTrap stub_XML_SetEntityDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEntityDeclHandlerPPC }; - -static void stub_XML_SetUnparsedEntityDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->unparseddeclhandler = (void *)regarray[9]; - Self->XML_SetUnparsedEntityDeclHandler(p->p, _68k_unparseddeclhandler); -} -struct EmuTrap stub_XML_SetUnparsedEntityDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUnparsedEntityDeclHandlerPPC }; - -static void stub_XML_SetNotationDeclHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->notationdeclhandler = (void *)regarray[9]; - Self->XML_SetNotationDeclHandler(p->p, _68k_notationdeclhandler); -} -struct EmuTrap stub_XML_SetNotationDeclHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNotationDeclHandlerPPC }; - -static void stub_XML_SetNotStandaloneHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->notstandalonehandler = (void *)regarray[9]; - Self->XML_SetNotStandaloneHandler(p->p, _68k_notstandalonehandler); -} -struct EmuTrap stub_XML_SetNotStandaloneHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetNotStandaloneHandlerPPC }; - -static int stub_XML_GetErrorCodePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetErrorCode(p->p); -} -struct EmuTrap stub_XML_GetErrorCode = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetErrorCodePPC }; - -static const XML_LChar * stub_XML_ErrorStringPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - return Self->XML_ErrorString((int)regarray[0]); -} -struct EmuTrap stub_XML_ErrorString = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ErrorStringPPC }; - -static long stub_XML_GetCurrentByteIndexPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetCurrentByteIndex(p->p); -} -struct EmuTrap stub_XML_GetCurrentByteIndex = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentByteIndexPPC }; - -static int stub_XML_GetCurrentLineNumberPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetCurrentLineNumber(p->p); -} -struct EmuTrap stub_XML_GetCurrentLineNumber = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentLineNumberPPC }; - -static int stub_XML_GetCurrentColumnNumberPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetCurrentColumnNumber(p->p); -} -struct EmuTrap stub_XML_GetCurrentColumnNumber = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentColumnNumberPPC }; - -static int stub_XML_GetCurrentByteCountPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetCurrentByteCount(p->p); -} -struct EmuTrap stub_XML_GetCurrentByteCount = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetCurrentByteCountPPC }; - -static const char * stub_XML_GetInputContextPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetInputContext(p->p, (int *)regarray[9], (int *)regarray[10]); -} -struct EmuTrap stub_XML_GetInputContext = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetInputContextPPC }; - -static void stub_XML_SetUserDataPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->handlerarg = (void *)regarray[9]; -} -struct EmuTrap stub_XML_SetUserData = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetUserDataPPC }; - -static void stub_XML_DefaultCurrentPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_DefaultCurrent(p->p); -} -struct EmuTrap stub_XML_DefaultCurrent = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_DefaultCurrentPPC }; - -static void stub_XML_UseParserAsHandlerArgPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->handlerarg = p; -} -struct EmuTrap stub_XML_UseParserAsHandlerArg = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_UseParserAsHandlerArgPPC }; - -static int stub_XML_SetBasePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_SetBase(p->p, (const XML_Char *)regarray[9]); -} -struct EmuTrap stub_XML_SetBase = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetBasePPC }; - -static const XML_Char * stub_XML_GetBasePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetBase(p->p); -} -struct EmuTrap stub_XML_GetBase = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetBasePPC }; - -static int stub_XML_GetSpecifiedAttributeCountPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetSpecifiedAttributeCount(p->p); -} -struct EmuTrap stub_XML_GetSpecifiedAttributeCount = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetSpecifiedAttributeCountPPC }; - -static int stub_XML_GetIdAttributeIndexPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_GetIdAttributeIndex(p->p); -} -struct EmuTrap stub_XML_GetIdAttributeIndex = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetIdAttributeIndexPPC }; - -static int stub_XML_SetEncodingPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_SetEncoding(p->p, (const XML_Char *)regarray[9]); -} -struct EmuTrap stub_XML_SetEncoding = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetEncodingPPC }; - -static int stub_XML_SetParamEntityParsingPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_SetParamEntityParsing(p->p, (enum XML_ParamEntityParsing)regarray[9]); -} -struct EmuTrap stub_XML_SetParamEntityParsing = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetParamEntityParsingPPC }; - -static void stub_XML_SetReturnNSTripletPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_SetReturnNSTriplet(p->p, (int)regarray[0]); -} -struct EmuTrap stub_XML_SetReturnNSTriplet = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetReturnNSTripletPPC }; - -static const XML_LChar * stub_XML_ExpatVersionPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - return Self->XML_ExpatVersion(); -} -struct EmuTrap stub_XML_ExpatVersion = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExpatVersionPPC }; - -static XML_Expat_Version stub_XML_ExpatVersionInfoPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - return Self->XML_ExpatVersionInfo(); -} -struct EmuTrap stub_XML_ExpatVersionInfo = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ExpatVersionInfoPPC }; - -static int stub_XML_ParserResetPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_ParserReset(p->p, (const XML_Char *)regarray[9]); -} -struct EmuTrap stub_XML_ParserReset = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ParserResetPPC }; - -static void stub_XML_SetSkippedEntityHandlerPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - p->skippedentityhandler = (void *)regarray[9]; - Self->XML_SetSkippedEntityHandler(p->p, _68k_skippedentityhandler); -} -struct EmuTrap stub_XML_SetSkippedEntityHandler = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_SetSkippedEntityHandlerPPC }; - -static int stub_XML_UseForeignDTDPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_UseForeignDTD(p->p, (XML_Bool)regarray[0]); -} -struct EmuTrap stub_XML_UseForeignDTD = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_UseForeignDTDPPC }; - -static const XML_Feature * stub_XML_GetFeatureListPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - return Self->XML_GetFeatureList(); -} -struct EmuTrap stub_XML_GetFeatureList = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetFeatureListPPC }; - -static int stub_XML_StopParserPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_StopParser(p->p, (XML_Bool)regarray[0]); -} -struct EmuTrap stub_XML_StopParser = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_StopParserPPC }; - -static int stub_XML_ResumeParserPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_ResumeParser(p->p); -} -struct EmuTrap stub_XML_ResumeParser = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_ResumeParserPPC }; - -static void stub_XML_GetParsingStatusPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_GetParsingStatus(p->p, (XML_ParsingStatus *)regarray[9]); -} -struct EmuTrap stub_XML_GetParsingStatus = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_GetParsingStatusPPC }; - -static void stub_XML_FreeContentModelPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_FreeContentModel(p->p, (XML_Content *)regarray[9]); -} -struct EmuTrap stub_XML_FreeContentModel = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_FreeContentModelPPC }; - -static void *stub_XML_MemMallocPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_MemMalloc(p->p, (size_t)regarray[0]); -} -struct EmuTrap stub_XML_MemMalloc = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemMallocPPC }; - -static void *stub_XML_MemReallocPPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - return Self->XML_MemRealloc(p->p, (void *)regarray[9], (size_t)regarray[0]); -} -struct EmuTrap stub_XML_MemRealloc = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemReallocPPC }; - -static void stub_XML_MemFreePPC(ULONG *regarray) -{ - struct Library *Base = (struct Library *) regarray[REG68K_A6/4]; - struct ExtendedLibrary *ExtLib = (struct ExtendedLibrary *) ((ULONG)Base + Base->lib_PosSize); - struct ExpatIFace *Self = (struct ExpatIFace *) ExtLib->MainIFace; - - M68kXML_Parser p = (M68kXML_Parser)regarray[8]; - Self->XML_MemFree(p->p, (void *)regarray[9]); -} -struct EmuTrap stub_XML_MemFree = { TRAPINST, TRAPTYPE, (ULONG (*)(ULONG *))stub_XML_MemFreePPC }; - -ULONG VecTable68K[] = { - (ULONG)&stub_Open, - (ULONG)&stub_Close, - (ULONG)&stub_Expunge, - (ULONG)&stub_Reserved, - (ULONG)&stub_XML_ParserCreate, - (ULONG)&stub_XML_ParserCreateNS, - (ULONG)&stub_XML_ParserCreate_MM, - (ULONG)&stub_XML_ExternalEntityParserCreate, - (ULONG)&stub_XML_ParserFree, - (ULONG)&stub_XML_Parse, - (ULONG)&stub_XML_ParseBuffer, - (ULONG)&stub_XML_GetBuffer, - (ULONG)&stub_XML_SetStartElementHandler, - (ULONG)&stub_XML_SetEndElementHandler, - (ULONG)&stub_XML_SetElementHandler, - (ULONG)&stub_XML_SetCharacterDataHandler, - (ULONG)&stub_XML_SetProcessingInstructionHandler, - (ULONG)&stub_XML_SetCommentHandler, - (ULONG)&stub_XML_SetStartCdataSectionHandler, - (ULONG)&stub_XML_SetEndCdataSectionHandler, - (ULONG)&stub_XML_SetCdataSectionHandler, - (ULONG)&stub_XML_SetDefaultHandler, - (ULONG)&stub_XML_SetDefaultHandlerExpand, - (ULONG)&stub_XML_SetExternalEntityRefHandler, - (ULONG)&stub_XML_SetExternalEntityRefHandlerArg, - (ULONG)&stub_XML_SetUnknownEncodingHandler, - (ULONG)&stub_XML_SetStartNamespaceDeclHandler, - (ULONG)&stub_XML_SetEndNamespaceDeclHandler, - (ULONG)&stub_XML_SetNamespaceDeclHandler, - (ULONG)&stub_XML_SetXmlDeclHandler, - (ULONG)&stub_XML_SetStartDoctypeDeclHandler, - (ULONG)&stub_XML_SetEndDoctypeDeclHandler, - (ULONG)&stub_XML_SetDoctypeDeclHandler, - (ULONG)&stub_XML_SetElementDeclHandler, - (ULONG)&stub_XML_SetAttlistDeclHandler, - (ULONG)&stub_XML_SetEntityDeclHandler, - (ULONG)&stub_XML_SetUnparsedEntityDeclHandler, - (ULONG)&stub_XML_SetNotationDeclHandler, - (ULONG)&stub_XML_SetNotStandaloneHandler, - (ULONG)&stub_XML_GetErrorCode, - (ULONG)&stub_XML_ErrorString, - (ULONG)&stub_XML_GetCurrentByteIndex, - (ULONG)&stub_XML_GetCurrentLineNumber, - (ULONG)&stub_XML_GetCurrentColumnNumber, - (ULONG)&stub_XML_GetCurrentByteCount, - (ULONG)&stub_XML_GetInputContext, - (ULONG)&stub_XML_SetUserData, - (ULONG)&stub_XML_DefaultCurrent, - (ULONG)&stub_XML_UseParserAsHandlerArg, - (ULONG)&stub_XML_SetBase, - (ULONG)&stub_XML_GetBase, - (ULONG)&stub_XML_GetSpecifiedAttributeCount, - (ULONG)&stub_XML_GetIdAttributeIndex, - (ULONG)&stub_XML_SetEncoding, - (ULONG)&stub_XML_SetParamEntityParsing, - (ULONG)&stub_XML_SetReturnNSTriplet, - (ULONG)&stub_XML_ExpatVersion, - (ULONG)&stub_XML_ExpatVersionInfo, - (ULONG)&stub_XML_ParserReset, - (ULONG)&stub_XML_SetSkippedEntityHandler, - (ULONG)&stub_XML_UseForeignDTD, - (ULONG)&stub_XML_GetFeatureList, - (ULONG)&stub_XML_StopParser, - (ULONG)&stub_XML_ResumeParser, - (ULONG)&stub_XML_GetParsingStatus, - (ULONG)&stub_XML_FreeContentModel, - (ULONG)&stub_XML_MemMalloc, - (ULONG)&stub_XML_MemRealloc, - (ULONG)&stub_XML_MemFree, - (ULONG)-1 -}; diff --git a/external/mit/expat/dist/amiga/expat_68k.h b/external/mit/expat/dist/amiga/expat_68k.h deleted file mode 100755 index 6f1aac59b..000000000 --- a/external/mit/expat/dist/amiga/expat_68k.h +++ /dev/null @@ -1,94 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef EXPAT_68K_H -#define EXPAT_68K_H - -#ifndef LIBRARIES_EXPAT_H -#include -#endif - -typedef struct M68kXML_ParserStruct { - XML_Parser p; - struct ExecIFace *IExec; - void *handlerarg; - void *extenthandlerarg; - void *enchandlerarg; - void *startelementhandler; - void *endelementhandler; - void *chardatahandler; - void *procinsthandler; - void *commenthandler; - void *startcdatahandler; - void *endcdatahandler; - void *defaulthandler; - void *defaulthandlerexp; - void *extentrefhandler; - void *unknownenchandler; - void *startnamespacehandler; - void *endnamespacehandler; - void *xmldeclhandler; - void *startdoctypehandler; - void *enddoctypehandler; - void *elementdeclhandler; - void *attlistdeclhandler; - void *entitydeclhandler; - void *unparseddeclhandler; - void *notationdeclhandler; - void *notstandalonehandler; - void *skippedentityhandler; -} *M68kXML_Parser; - -/* expat_68k_handler_stubs.c */ -void _68k_startelementhandler(void *userdata, const char *name, const char **attrs); -void _68k_endelementhandler(void *userdata, const char *name); -void _68k_chardatahandler(void *userdata, const char *s, int len); -void _68k_procinsthandler(void *userdata, const char *target, const char *data); -void _68k_commenthandler(void *userdata, const char *data); -void _68k_startcdatahandler(void *userdata); -void _68k_endcdatahandler(void *userdata); -void _68k_defaulthandler(void *userdata, const char *s, int len); -void _68k_defaulthandlerexp(void *userdata, const char *s, int len); -int _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base, - const char *sysid, const char *pubid); -int _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info); -void _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri); -void _68k_endnamespacehandler(void *userdata, const char *prefix); -void _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone); -void _68k_startdoctypehandler(void *userdata, const char *doctypename, - const char *sysid, const char *pubid, int has_internal_subset); -void _68k_enddoctypehandler(void *userdata); -void _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model); -void _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname, - const char *att_type, const char *dflt, int isrequired); -void _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity, - const char *value, int value_length, const char *base, const char *sysid, const char *pubid, - const char *notationname); -void _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base, - const char *sysid, const char *pubid, const char *notationname); -void _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base, - const char *sysid, const char *pubid); -int _68k_notstandalonehandler(void *userdata); -void _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity); - -#endif diff --git a/external/mit/expat/dist/amiga/expat_68k_handler_stubs.c b/external/mit/expat/dist/amiga/expat_68k_handler_stubs.c deleted file mode 100755 index aca33c6ec..000000000 --- a/external/mit/expat/dist/amiga/expat_68k_handler_stubs.c +++ /dev/null @@ -1,185 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#include "expat_68k.h" -#include -#include -#include - -static uint32 VARARGS68K call_68k_code (struct ExecIFace *IExec, void *code, int num_args, ...) { - uint32 res = 0; - - va_list vargs; - va_startlinear(vargs, num_args); - uint32 *args = va_getlinearva(vargs, uint32 *); - - uint8 *stack = IExec->AllocVec(4096, MEMF_SHARED); - if (stack) { - uint32 *sp = (uint32 *)(stack + 4096); - args += num_args; - while (num_args--) { - *--sp = *--args; - } - - res = IExec->EmulateTags(code, ET_StackPtr, sp, TAG_END); - IExec->FreeVec(stack); - } - - va_end(vargs); - - return res; -} - -void _68k_startelementhandler(void *userdata, const char *name, const char **attrs) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->startelementhandler, 3, p->handlerarg, name, attrs); -} - -void _68k_endelementhandler(void *userdata, const char *name) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->endelementhandler, 2, p->handlerarg, name); -} - -void _68k_chardatahandler(void *userdata, const char *s, int len) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->chardatahandler, 3, p->handlerarg, s, len); -} - -void _68k_procinsthandler(void *userdata, const char *target, const char *data) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->procinsthandler, 3, p->handlerarg, target, data); -} - -void _68k_commenthandler(void *userdata, const char *data) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->commenthandler, 2, p->handlerarg, data); -} - -void _68k_startcdatahandler(void *userdata) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->startcdatahandler, 1, p->handlerarg); -} - -void _68k_endcdatahandler(void *userdata) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->endcdatahandler, 1, p->handlerarg); -} - -void _68k_defaulthandler(void *userdata, const char *s, int len) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->defaulthandler, 3, p->handlerarg, s, len); -} - -void _68k_defaulthandlerexp(void *userdata, const char *s, int len) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->defaulthandlerexp, 3, p->handlerarg, s, len); -} - -int _68k_extentrefhandler(XML_Parser parser, const char *context, const char *base, - const char *sysid, const char *pubid) -{ - M68kXML_Parser p = XML_GetUserData(parser); - void *arg = p->extenthandlerarg; - return (int)call_68k_code(p->IExec, p->extentrefhandler, 5, arg ? arg : p, context, base, sysid, pubid); -} - -int _68k_unknownenchandler(void *enchandlerdata, const char *name, XML_Encoding *info) { - M68kXML_Parser p = enchandlerdata; - return (int)call_68k_code(p->IExec, p->unknownenchandler, 3, p->enchandlerarg, name, info); -} - -void _68k_startnamespacehandler(void *userdata, const char *prefix, const char *uri) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->startnamespacehandler, 3, p->handlerarg, prefix, uri); -} - -void _68k_endnamespacehandler(void *userdata, const char *prefix) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->endnamespacehandler, 2, p->handlerarg, prefix); -} - -void _68k_xmldeclhandler(void *userdata, const char *version, const char *encoding, int standalone) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->xmldeclhandler, 4, p->handlerarg, version, encoding, standalone); -} - -void _68k_startdoctypehandler(void *userdata, const char *doctypename, - const char *sysid, const char *pubid, int has_internal_subset) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->startdoctypehandler, 5, p->handlerarg, doctypename, sysid, pubid, has_internal_subset); -} - -void _68k_enddoctypehandler(void *userdata) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->enddoctypehandler, 1, p->handlerarg); -} - -void _68k_elementdeclhandler(void *userdata, const char *name, XML_Content *model) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->elementdeclhandler, 3, p->handlerarg, name, model); -} - -void _68k_attlistdeclhandler(void *userdata, const char *elname, const char *attname, - const char *att_type, const char *dflt, int isrequired) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->attlistdeclhandler, 6, p->handlerarg, elname, attname, att_type, dflt, isrequired); -} - -void _68k_entitydeclhandler(void *userdata, const char *entityname, int is_param_entity, - const char *value, int value_length, const char *base, const char *sysid, const char *pubid, - const char *notationname) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->entitydeclhandler, 9, p->handlerarg, entityname, is_param_entity, - value, value_length, base, sysid, pubid, notationname); -} - -void _68k_unparseddeclhandler(void *userdata, const char *entityname, const char *base, - const char *sysid, const char *pubid, const char *notationname) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->unparseddeclhandler, 6, p->handlerarg, entityname, base, sysid, pubid, notationname); -} - -void _68k_notationdeclhandler(void *userdata, const char *notationname, const char *base, - const char *sysid, const char *pubid) -{ - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->notationdeclhandler, 5, p->handlerarg, notationname, base, sysid, pubid); -} - -int _68k_notstandalonehandler(void *userdata) { - M68kXML_Parser p = userdata; - return (int)call_68k_code(p->IExec, p->notstandalonehandler, 1, p->handlerarg); -} - -void _68k_skippedentityhandler(void *userdata, const char *entityname, int is_param_entity) { - M68kXML_Parser p = userdata; - call_68k_code(p->IExec, p->skippedentityhandler, 3, p->handlerarg, entityname, is_param_entity); -} diff --git a/external/mit/expat/dist/amiga/expat_base.h b/external/mit/expat/dist/amiga/expat_base.h deleted file mode 100644 index 266363985..000000000 --- a/external/mit/expat/dist/amiga/expat_base.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifndef EXPAT_BASE_H -#define EXPAT_BASE_H - -#include -#include -#include -#include - - -struct ExpatBase { - struct Library libNode; - uint16 pad; - BPTR SegList; - struct ExecIFace *IExec; -}; - -#endif diff --git a/external/mit/expat/dist/amiga/expat_lib.c b/external/mit/expat/dist/amiga/expat_lib.c deleted file mode 100755 index 70e91b101..000000000 --- a/external/mit/expat/dist/amiga/expat_lib.c +++ /dev/null @@ -1,247 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#define __NOLIBBASE__ -#define __NOGLOBALIFACE__ - -#include -#include - -#include "expat_base.h" - - -#define LIBNAME "expat.library" -#define LIBPRI 0 -#define VERSION 53 -#define REVISION 1 -#define VSTRING "expat.library 53.1 (7.8.2009)" /* dd.mm.yyyy */ - - -static const char* __attribute__((used)) verstag = "\0$VER: " VSTRING; - - -struct Interface *INewlib = 0; - - -struct ExpatBase * libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *ISys); -uint32 libObtain (struct LibraryManagerInterface *Self); -uint32 libRelease (struct LibraryManagerInterface *Self); -struct ExpatBase *libOpen (struct LibraryManagerInterface *Self, uint32 version); -BPTR libClose (struct LibraryManagerInterface *Self); -BPTR libExpunge (struct LibraryManagerInterface *Self); -struct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer); -void closeInterface(struct ExecIFace *IExec, struct Interface *iface); - - -static APTR lib_manager_vectors[] = { - libObtain, - libRelease, - NULL, - NULL, - libOpen, - libClose, - libExpunge, - NULL, - (APTR)-1, -}; - - -static struct TagItem lib_managerTags[] = { - { MIT_Name, (uint32)"__library" }, - { MIT_VectorTable, (uint32)lib_manager_vectors }, - { MIT_Version, 1 }, - { TAG_END, 0 } -}; - - -extern void *main_vectors[]; - -static struct TagItem lib_mainTags[] = { - { MIT_Name, (uint32)"main" }, - { MIT_VectorTable, (uint32)main_vectors }, - { MIT_Version, 1 }, - { TAG_END, 0 } -}; - - -static APTR libInterfaces[] = { - lib_managerTags, - lib_mainTags, - NULL -}; - - -extern void *VecTable68K[]; - -static struct TagItem libCreateTags[] = { - { CLT_DataSize, sizeof(struct ExpatBase) }, - { CLT_InitFunc, (uint32)libInit }, - { CLT_Interfaces, (uint32)libInterfaces }, - { CLT_Vector68K, (uint32)VecTable68K }, - { TAG_END, 0 } -}; - - -static struct Resident __attribute__((used)) lib_res = { - RTC_MATCHWORD, // rt_MatchWord - &lib_res, // rt_MatchTag - &lib_res+1, // rt_EndSkip - RTF_NATIVE | RTF_AUTOINIT, // rt_Flags - VERSION, // rt_Version - NT_LIBRARY, // rt_Type - LIBPRI, // rt_Pri - LIBNAME, // rt_Name - VSTRING, // rt_IdString - libCreateTags // rt_Init -}; - - -int32 _start() -{ - return RETURN_FAIL; -} - - -struct ExpatBase *libInit(struct ExpatBase *libBase, BPTR seglist, struct ExecIFace *iexec) -{ - libBase->libNode.lib_Node.ln_Type = NT_LIBRARY; - libBase->libNode.lib_Node.ln_Pri = LIBPRI; - libBase->libNode.lib_Node.ln_Name = LIBNAME; - libBase->libNode.lib_Flags = LIBF_SUMUSED|LIBF_CHANGED; - libBase->libNode.lib_Version = VERSION; - libBase->libNode.lib_Revision = REVISION; - libBase->libNode.lib_IdString = VSTRING; - - libBase->SegList = seglist; - - libBase->IExec = iexec; - INewlib = openInterface(iexec, "newlib.library", 0); - - if ( INewlib != 0 ) { - return libBase; - } - - closeInterface(iexec, INewlib); - INewlib = 0; - - iexec->DeleteLibrary(&libBase->libNode); - - return NULL; -} - - -uint32 libObtain( struct LibraryManagerInterface *Self ) -{ - ++Self->Data.RefCount; - return Self->Data.RefCount; -} - - -uint32 libRelease( struct LibraryManagerInterface *Self ) -{ - --Self->Data.RefCount; - return Self->Data.RefCount; -} - - -struct ExpatBase *libOpen( struct LibraryManagerInterface *Self, uint32 version ) -{ - struct ExpatBase *libBase; - - libBase = (struct ExpatBase *)Self->Data.LibBase; - - ++libBase->libNode.lib_OpenCnt; - libBase->libNode.lib_Flags &= ~LIBF_DELEXP; - - return libBase; -} - - -BPTR libClose( struct LibraryManagerInterface *Self ) -{ - struct ExpatBase *libBase; - - libBase = (struct ExpatBase *)Self->Data.LibBase; - - --libBase->libNode.lib_OpenCnt; - if ( libBase->libNode.lib_OpenCnt ) { - return 0; - } - - if ( libBase->libNode.lib_Flags & LIBF_DELEXP ) { - return (BPTR)Self->LibExpunge(); - } - else { - return ZERO; - } -} - - -BPTR libExpunge( struct LibraryManagerInterface *Self ) -{ - struct ExpatBase *libBase = (struct ExpatBase *)Self->Data.LibBase; - BPTR result = ZERO; - - if (libBase->libNode.lib_OpenCnt == 0) { - libBase->IExec->Remove(&libBase->libNode.lib_Node); - - result = libBase->SegList; - - closeInterface(libBase->IExec, INewlib); - INewlib = 0; - - libBase->IExec->DeleteLibrary(&libBase->libNode); - } - else { - libBase->libNode.lib_Flags |= LIBF_DELEXP; - } - - return result; -} - - -struct Interface *openInterface(struct ExecIFace *IExec, CONST_STRPTR libName, uint32 libVer) -{ - struct Library *base = IExec->OpenLibrary(libName, libVer); - struct Interface *iface = IExec->GetInterface(base, "main", 1, 0); - if (iface == 0) { - IExec->CloseLibrary(base); - } - - return iface; -} - - -void closeInterface(struct ExecIFace *IExec, struct Interface *iface) -{ - if (iface != 0) - { - struct Library *base = iface->Data.LibBase; - IExec->DropInterface(iface); - IExec->CloseLibrary(base); - } -} diff --git a/external/mit/expat/dist/amiga/expat_vectors.c b/external/mit/expat/dist/amiga/expat_vectors.c deleted file mode 100755 index cf489509c..000000000 --- a/external/mit/expat/dist/amiga/expat_vectors.c +++ /dev/null @@ -1,505 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#include -#include -#include -#include - -extern uint32 _Expat_Obtain(struct ExpatIFace *); -extern uint32 _Expat_Release(struct ExpatIFace *); -extern XML_Parser _Expat_XML_ParserCreate(struct ExpatIFace *, const XML_Char * encodingName); -extern XML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace *, const XML_Char * encodingName, XML_Char nsSep); -extern XML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace *, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator); -extern XML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace *, XML_Parser parser, const XML_Char * context, const XML_Char * encoding); -extern void _Expat_XML_ParserFree(struct ExpatIFace *, XML_Parser parser); -extern enum XML_Status _Expat_XML_Parse(struct ExpatIFace *, XML_Parser parser, const char * s, int len, int isFinal); -extern enum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace *, XML_Parser parser, int len, int isFinal); -extern void * _Expat_XML_GetBuffer(struct ExpatIFace *, XML_Parser parser, int len); -extern void _Expat_XML_SetStartElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start); -extern void _Expat_XML_SetEndElementHandler(struct ExpatIFace *, XML_Parser parser, XML_EndElementHandler end); -extern void _Expat_XML_SetElementHandler(struct ExpatIFace *, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); -extern void _Expat_XML_SetCharacterDataHandler(struct ExpatIFace *, XML_Parser parser, XML_CharacterDataHandler handler); -extern void _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace *, XML_Parser parser, XML_ProcessingInstructionHandler handler); -extern void _Expat_XML_SetCommentHandler(struct ExpatIFace *, XML_Parser parser, XML_CommentHandler handler); -extern void _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start); -extern void _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_EndCdataSectionHandler end); -extern void _Expat_XML_SetCdataSectionHandler(struct ExpatIFace *, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); -extern void _Expat_XML_SetDefaultHandler(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler); -extern void _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace *, XML_Parser parser, XML_DefaultHandler handler); -extern void _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace *, XML_Parser parser, XML_ExternalEntityRefHandler handler); -extern void _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace *, XML_Parser parser, void * arg); -extern void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace *, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data); -extern void _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start); -extern void _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndNamespaceDeclHandler end); -extern void _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); -extern void _Expat_XML_SetXmlDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_XmlDeclHandler handler); -extern void _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start); -extern void _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EndDoctypeDeclHandler end); -extern void _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); -extern void _Expat_XML_SetElementDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_ElementDeclHandler eldecl); -extern void _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_AttlistDeclHandler attdecl); -extern void _Expat_XML_SetEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_EntityDeclHandler handler); -extern void _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_UnparsedEntityDeclHandler handler); -extern void _Expat_XML_SetNotationDeclHandler(struct ExpatIFace *, XML_Parser parser, XML_NotationDeclHandler handler); -extern void _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace *, XML_Parser parser, XML_NotStandaloneHandler handler); -extern enum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace *, XML_Parser parser); -extern const XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace *, enum XML_Error code); -extern long _Expat_XML_GetCurrentByteIndex(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetCurrentLineNumber(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetCurrentByteCount(struct ExpatIFace *, XML_Parser parser); -extern const char * _Expat_XML_GetInputContext(struct ExpatIFace *, XML_Parser parser, int * offset, int * size); -extern void _Expat_XML_SetUserData(struct ExpatIFace *, XML_Parser parser, void * userData); -extern void _Expat_XML_DefaultCurrent(struct ExpatIFace *, XML_Parser parser); -extern void _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace *, XML_Parser parser); -extern enum XML_Status _Expat_XML_SetBase(struct ExpatIFace *, XML_Parser parser, const XML_Char * base); -extern const XML_Char * _Expat_XML_GetBase(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace *, XML_Parser parser); -extern int _Expat_XML_GetIdAttributeIndex(struct ExpatIFace *, XML_Parser parser); -extern enum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding); -extern int _Expat_XML_SetParamEntityParsing(struct ExpatIFace *, XML_Parser parser, enum XML_ParamEntityParsing parsing); -extern void _Expat_XML_SetReturnNSTriplet(struct ExpatIFace *, XML_Parser parser, int do_nst); -extern const XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace *); -extern XML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace *); -extern XML_Bool _Expat_XML_ParserReset(struct ExpatIFace *, XML_Parser parser, const XML_Char * encoding); -extern void _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace *, XML_Parser parser, XML_SkippedEntityHandler handler); -extern enum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace *, XML_Parser parser, XML_Bool useDTD); -extern const XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace *); -extern enum XML_Status _Expat_XML_StopParser(struct ExpatIFace *, XML_Parser parser, XML_Bool resumable); -extern enum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace *, XML_Parser parser); -extern void _Expat_XML_GetParsingStatus(struct ExpatIFace *, XML_Parser parser, XML_ParsingStatus * status); -extern void _Expat_XML_FreeContentModel(struct ExpatIFace *, XML_Parser parser, XML_Content * model); -extern void * _Expat_XML_MemMalloc(struct ExpatIFace *, XML_Parser parser, size_t size); -extern void * _Expat_XML_MemRealloc(struct ExpatIFace *, XML_Parser parser, void * ptr, size_t size); -extern void _Expat_XML_MemFree(struct ExpatIFace *, XML_Parser parser, void * ptr); - - -CONST APTR main_vectors[] = -{ - _Expat_Obtain, - _Expat_Release, - NULL, - NULL, - _Expat_XML_ParserCreate, - _Expat_XML_ParserCreateNS, - _Expat_XML_ParserCreate_MM, - _Expat_XML_ExternalEntityParserCreate, - _Expat_XML_ParserFree, - _Expat_XML_Parse, - _Expat_XML_ParseBuffer, - _Expat_XML_GetBuffer, - _Expat_XML_SetStartElementHandler, - _Expat_XML_SetEndElementHandler, - _Expat_XML_SetElementHandler, - _Expat_XML_SetCharacterDataHandler, - _Expat_XML_SetProcessingInstructionHandler, - _Expat_XML_SetCommentHandler, - _Expat_XML_SetStartCdataSectionHandler, - _Expat_XML_SetEndCdataSectionHandler, - _Expat_XML_SetCdataSectionHandler, - _Expat_XML_SetDefaultHandler, - _Expat_XML_SetDefaultHandlerExpand, - _Expat_XML_SetExternalEntityRefHandler, - _Expat_XML_SetExternalEntityRefHandlerArg, - _Expat_XML_SetUnknownEncodingHandler, - _Expat_XML_SetStartNamespaceDeclHandler, - _Expat_XML_SetEndNamespaceDeclHandler, - _Expat_XML_SetNamespaceDeclHandler, - _Expat_XML_SetXmlDeclHandler, - _Expat_XML_SetStartDoctypeDeclHandler, - _Expat_XML_SetEndDoctypeDeclHandler, - _Expat_XML_SetDoctypeDeclHandler, - _Expat_XML_SetElementDeclHandler, - _Expat_XML_SetAttlistDeclHandler, - _Expat_XML_SetEntityDeclHandler, - _Expat_XML_SetUnparsedEntityDeclHandler, - _Expat_XML_SetNotationDeclHandler, - _Expat_XML_SetNotStandaloneHandler, - _Expat_XML_GetErrorCode, - _Expat_XML_ErrorString, - _Expat_XML_GetCurrentByteIndex, - _Expat_XML_GetCurrentLineNumber, - _Expat_XML_GetCurrentColumnNumber, - _Expat_XML_GetCurrentByteCount, - _Expat_XML_GetInputContext, - _Expat_XML_SetUserData, - _Expat_XML_DefaultCurrent, - _Expat_XML_UseParserAsHandlerArg, - _Expat_XML_SetBase, - _Expat_XML_GetBase, - _Expat_XML_GetSpecifiedAttributeCount, - _Expat_XML_GetIdAttributeIndex, - _Expat_XML_SetEncoding, - _Expat_XML_SetParamEntityParsing, - _Expat_XML_SetReturnNSTriplet, - _Expat_XML_ExpatVersion, - _Expat_XML_ExpatVersionInfo, - _Expat_XML_ParserReset, - _Expat_XML_SetSkippedEntityHandler, - _Expat_XML_UseForeignDTD, - _Expat_XML_GetFeatureList, - _Expat_XML_StopParser, - _Expat_XML_ResumeParser, - _Expat_XML_GetParsingStatus, - _Expat_XML_FreeContentModel, - _Expat_XML_MemMalloc, - _Expat_XML_MemRealloc, - _Expat_XML_MemFree, - (APTR)-1 -}; - -uint32 _Expat_Obtain(struct ExpatIFace *Self) -{ - return ++Self->Data.RefCount; -} - -uint32 _Expat_Release(struct ExpatIFace *Self) -{ - return --Self->Data.RefCount; -} - -XML_Parser _Expat_XML_ParserCreate(struct ExpatIFace * Self, const XML_Char *encoding) -{ - return XML_ParserCreate(encoding); -} - -XML_Parser _Expat_XML_ParserCreateNS(struct ExpatIFace * Self, const XML_Char *encoding, XML_Char nsSep) -{ - return XML_ParserCreateNS(encoding, nsSep); -} - -XML_Parser _Expat_XML_ParserCreate_MM(struct ExpatIFace * Self, const XML_Char *encoding, const XML_Memory_Handling_Suite *memsuite, const XML_Char *namespaceSeparator) -{ - return XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator); -} - -XML_Parser _Expat_XML_ExternalEntityParserCreate(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *context, const XML_Char *encoding) -{ - return XML_ExternalEntityParserCreate(parser, context, encoding); -} - -void _Expat_XML_ParserFree(struct ExpatIFace *Self, XML_Parser parser) -{ - XML_ParserFree(parser); -} - -enum XML_Status _Expat_XML_Parse(struct ExpatIFace * Self, XML_Parser parser, const char * s, int len, int isFinal) -{ - return XML_Parse(parser, s, len, isFinal); -} - -enum XML_Status _Expat_XML_ParseBuffer(struct ExpatIFace * Self, XML_Parser parser, int len, int isFinal) -{ - return XML_ParseBuffer(parser, len, isFinal); -} - -void * _Expat_XML_GetBuffer(struct ExpatIFace * Self, XML_Parser parser, int len) -{ - return XML_GetBuffer(parser, len); -} - -void _Expat_XML_SetStartElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start) -{ - XML_SetStartElementHandler(parser, start); -} - -void _Expat_XML_SetEndElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndElementHandler end) -{ - XML_SetEndElementHandler(parser, end); -} - -void _Expat_XML_SetElementHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) -{ - XML_SetElementHandler(parser, start, end); -} - -void _Expat_XML_SetCharacterDataHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CharacterDataHandler handler) -{ - XML_SetCharacterDataHandler(parser, handler); -} - -void _Expat_XML_SetProcessingInstructionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ProcessingInstructionHandler handler) -{ - XML_SetProcessingInstructionHandler(parser, handler); -} - -void _Expat_XML_SetCommentHandler(struct ExpatIFace * Self, XML_Parser parser, XML_CommentHandler handler) -{ - XML_SetCommentHandler(parser, handler); -} - -void _Expat_XML_SetStartCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start) -{ - XML_SetStartCdataSectionHandler(parser, start); -} - -void _Expat_XML_SetEndCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndCdataSectionHandler end) -{ - XML_SetEndCdataSectionHandler(parser, end); -} - -void _Expat_XML_SetCdataSectionHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end) -{ - XML_SetCdataSectionHandler(parser, start, end); -} - -void _Expat_XML_SetDefaultHandler(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler) -{ - XML_SetDefaultHandler(parser, handler); -} - -void _Expat_XML_SetDefaultHandlerExpand(struct ExpatIFace * Self, XML_Parser parser, XML_DefaultHandler handler) -{ - XML_SetDefaultHandlerExpand(parser, handler); -} - -void _Expat_XML_SetExternalEntityRefHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ExternalEntityRefHandler handler) -{ - XML_SetExternalEntityRefHandler(parser, handler); -} - -void _Expat_XML_SetExternalEntityRefHandlerArg(struct ExpatIFace * Self, XML_Parser parser, void * arg) -{ - XML_SetExternalEntityRefHandlerArg(parser, arg); -} - -void _Expat_XML_SetUnknownEncodingHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data) -{ - XML_SetUnknownEncodingHandler(parser, handler, data); -} - -void _Expat_XML_SetStartNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start) -{ - XML_SetStartNamespaceDeclHandler(parser, start); -} - -void _Expat_XML_SetEndNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndNamespaceDeclHandler end) -{ - XML_SetEndNamespaceDeclHandler(parser, end); -} - -void _Expat_XML_SetNamespaceDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end) -{ - XML_SetNamespaceDeclHandler(parser, start, end); -} - -void _Expat_XML_SetXmlDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_XmlDeclHandler handler) -{ - XML_SetXmlDeclHandler(parser, handler); -} - -void _Expat_XML_SetStartDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start) -{ - XML_SetStartDoctypeDeclHandler(parser, start); -} - -void _Expat_XML_SetEndDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EndDoctypeDeclHandler end) -{ - XML_SetEndDoctypeDeclHandler(parser, end); -} - -void _Expat_XML_SetDoctypeDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end) -{ - XML_SetDoctypeDeclHandler(parser, start, end); -} - -void _Expat_XML_SetElementDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_ElementDeclHandler eldecl) -{ - XML_SetElementDeclHandler(parser, eldecl); -} - -void _Expat_XML_SetAttlistDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_AttlistDeclHandler attdecl) -{ - XML_SetAttlistDeclHandler(parser, attdecl); -} - -void _Expat_XML_SetEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_EntityDeclHandler handler) -{ - XML_SetEntityDeclHandler(parser, handler); -} - -void _Expat_XML_SetUnparsedEntityDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler) -{ - XML_SetUnparsedEntityDeclHandler(parser, handler); -} - -void _Expat_XML_SetNotationDeclHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotationDeclHandler handler) -{ - XML_SetNotationDeclHandler(parser, handler); -} - -void _Expat_XML_SetNotStandaloneHandler(struct ExpatIFace * Self, XML_Parser parser, XML_NotStandaloneHandler handler) -{ - XML_SetNotStandaloneHandler(parser, handler); -} - -enum XML_Error _Expat_XML_GetErrorCode(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetErrorCode(parser); -} - -const XML_LChar * _Expat_XML_ErrorString(struct ExpatIFace * Self, enum XML_Error code) -{ - return XML_ErrorString(code); -} - -long _Expat_XML_GetCurrentByteIndex(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetCurrentByteIndex(parser); -} - -int _Expat_XML_GetCurrentLineNumber(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetCurrentLineNumber(parser); -} - -int _Expat_XML_GetCurrentColumnNumber(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetCurrentColumnNumber(parser); -} - -int _Expat_XML_GetCurrentByteCount(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetCurrentByteCount(parser); -} - -const char * _Expat_XML_GetInputContext(struct ExpatIFace * Self, XML_Parser parser, int * offset, int * size) -{ - return XML_GetInputContext(parser, offset, size); -} - -void _Expat_XML_SetUserData(struct ExpatIFace * Self, XML_Parser parser, void * userData) -{ - XML_SetUserData(parser, userData); -} - -void _Expat_XML_DefaultCurrent(struct ExpatIFace * Self, XML_Parser parser) -{ - XML_DefaultCurrent(parser); -} - -void _Expat_XML_UseParserAsHandlerArg(struct ExpatIFace * Self, XML_Parser parser) -{ - XML_UseParserAsHandlerArg(parser); -} - -enum XML_Status _Expat_XML_SetBase(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *p) -{ - return XML_SetBase(parser, p); -} - -const XML_Char * _Expat_XML_GetBase(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetBase(parser); -} - -int _Expat_XML_GetSpecifiedAttributeCount(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetSpecifiedAttributeCount(parser); -} - -int _Expat_XML_GetIdAttributeIndex(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_GetIdAttributeIndex(parser); -} - -enum XML_Status _Expat_XML_SetEncoding(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding) -{ - return XML_SetEncoding(parser, encoding); -} - -int _Expat_XML_SetParamEntityParsing(struct ExpatIFace * Self, XML_Parser parser, enum XML_ParamEntityParsing parsing) -{ - return XML_SetParamEntityParsing(parser, parsing); -} - -void _Expat_XML_SetReturnNSTriplet(struct ExpatIFace * Self, XML_Parser parser, int do_nst) -{ - XML_SetReturnNSTriplet(parser, do_nst); -} - -const XML_LChar * _Expat_XML_ExpatVersion(struct ExpatIFace * Self) -{ - return XML_ExpatVersion(); -} - -XML_Expat_Version _Expat_XML_ExpatVersionInfo(struct ExpatIFace * Self) -{ - return XML_ExpatVersionInfo(); -} - -XML_Bool _Expat_XML_ParserReset(struct ExpatIFace * Self, XML_Parser parser, const XML_Char *encoding) -{ - return XML_ParserReset(parser, encoding); -} - -void _Expat_XML_SetSkippedEntityHandler(struct ExpatIFace * Self, XML_Parser parser, XML_SkippedEntityHandler handler) -{ - XML_SetSkippedEntityHandler(parser, handler); -} - -enum XML_Error _Expat_XML_UseForeignDTD(struct ExpatIFace * Self, XML_Parser parser, XML_Bool useDTD) -{ - return XML_UseForeignDTD(parser, useDTD); -} - -const XML_Feature * _Expat_XML_GetFeatureList(struct ExpatIFace * Self) -{ - return XML_GetFeatureList(); -} - -enum XML_Status _Expat_XML_StopParser(struct ExpatIFace * Self, XML_Parser parser, XML_Bool resumable) -{ - return XML_StopParser(parser, resumable); -} - -enum XML_Status _Expat_XML_ResumeParser(struct ExpatIFace * Self, XML_Parser parser) -{ - return XML_ResumeParser(parser); -} - -void _Expat_XML_GetParsingStatus(struct ExpatIFace * Self, XML_Parser parser, XML_ParsingStatus * status) -{ - XML_GetParsingStatus(parser, status); -} - -void _Expat_XML_FreeContentModel(struct ExpatIFace * Self, XML_Parser parser, XML_Content * model) -{ - XML_FreeContentModel(parser, model); -} - -void * _Expat_XML_MemMalloc(struct ExpatIFace * Self, XML_Parser parser, size_t size) -{ - return XML_MemMalloc(parser, size); -} - -void * _Expat_XML_MemRealloc(struct ExpatIFace * Self, XML_Parser parser, void * ptr, size_t size) -{ - XML_MemRealloc(parser, ptr, size); -} - -void _Expat_XML_MemFree(struct ExpatIFace * Self, XML_Parser parser, void * ptr) -{ - XML_MemFree(parser, ptr); -} diff --git a/external/mit/expat/dist/amiga/include/inline4/expat.h b/external/mit/expat/dist/amiga/include/inline4/expat.h deleted file mode 100755 index 1e3105d94..000000000 --- a/external/mit/expat/dist/amiga/include/inline4/expat.h +++ /dev/null @@ -1,94 +0,0 @@ -#ifndef INLINE4_EXPAT_H -#define INLINE4_EXPAT_H - -/* -** This file was auto generated by idltool 51.6. -** -** It provides compatibility to OS3 style library -** calls by substituting functions. -** -** Do not edit manually. -*/ - -#ifndef EXEC_TYPES_H -#include -#endif -#ifndef EXEC_EXEC_H -#include -#endif -#ifndef EXEC_INTERFACES_H -#include -#endif - -#ifndef LIBRARIES_EXPAT_H -#include -#endif - -/* Inline macros for Interface "main" */ -#define XML_ParserCreate(encodingName) IExpat->XML_ParserCreate(encodingName) -#define XML_ParserCreateNS(encodingName, nsSep) IExpat->XML_ParserCreateNS(encodingName, nsSep) -#define XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) IExpat->XML_ParserCreate_MM(encoding, memsuite, namespaceSeparator) -#define XML_ExternalEntityParserCreate(parser, context, encoding) IExpat->XML_ExternalEntityParserCreate(parser, context, encoding) -#define XML_ParserFree(parser) IExpat->XML_ParserFree(parser) -#define XML_Parse(parser, s, len, isFinal) IExpat->XML_Parse(parser, s, len, isFinal) -#define XML_ParseBuffer(parser, len, isFinal) IExpat->XML_ParseBuffer(parser, len, isFinal) -#define XML_GetBuffer(parser, len) IExpat->XML_GetBuffer(parser, len) -#define XML_SetStartElementHandler(parser, start) IExpat->XML_SetStartElementHandler(parser, start) -#define XML_SetEndElementHandler(parser, end) IExpat->XML_SetEndElementHandler(parser, end) -#define XML_SetElementHandler(parser, start, end) IExpat->XML_SetElementHandler(parser, start, end) -#define XML_SetCharacterDataHandler(parser, handler) IExpat->XML_SetCharacterDataHandler(parser, handler) -#define XML_SetProcessingInstructionHandler(parser, handler) IExpat->XML_SetProcessingInstructionHandler(parser, handler) -#define XML_SetCommentHandler(parser, handler) IExpat->XML_SetCommentHandler(parser, handler) -#define XML_SetStartCdataSectionHandler(parser, start) IExpat->XML_SetStartCdataSectionHandler(parser, start) -#define XML_SetEndCdataSectionHandler(parser, end) IExpat->XML_SetEndCdataSectionHandler(parser, end) -#define XML_SetCdataSectionHandler(parser, start, end) IExpat->XML_SetCdataSectionHandler(parser, start, end) -#define XML_SetDefaultHandler(parser, handler) IExpat->XML_SetDefaultHandler(parser, handler) -#define XML_SetDefaultHandlerExpand(parser, handler) IExpat->XML_SetDefaultHandlerExpand(parser, handler) -#define XML_SetExternalEntityRefHandler(parser, handler) IExpat->XML_SetExternalEntityRefHandler(parser, handler) -#define XML_SetExternalEntityRefHandlerArg(parser, arg) IExpat->XML_SetExternalEntityRefHandlerArg(parser, arg) -#define XML_SetUnknownEncodingHandler(parser, handler, data) IExpat->XML_SetUnknownEncodingHandler(parser, handler, data) -#define XML_SetStartNamespaceDeclHandler(parser, start) IExpat->XML_SetStartNamespaceDeclHandler(parser, start) -#define XML_SetEndNamespaceDeclHandler(parser, end) IExpat->XML_SetEndNamespaceDeclHandler(parser, end) -#define XML_SetNamespaceDeclHandler(parser, start, end) IExpat->XML_SetNamespaceDeclHandler(parser, start, end) -#define XML_SetXmlDeclHandler(parser, handler) IExpat->XML_SetXmlDeclHandler(parser, handler) -#define XML_SetStartDoctypeDeclHandler(parser, start) IExpat->XML_SetStartDoctypeDeclHandler(parser, start) -#define XML_SetEndDoctypeDeclHandler(parser, end) IExpat->XML_SetEndDoctypeDeclHandler(parser, end) -#define XML_SetDoctypeDeclHandler(parser, start, end) IExpat->XML_SetDoctypeDeclHandler(parser, start, end) -#define XML_SetElementDeclHandler(parser, eldecl) IExpat->XML_SetElementDeclHandler(parser, eldecl) -#define XML_SetAttlistDeclHandler(parser, attdecl) IExpat->XML_SetAttlistDeclHandler(parser, attdecl) -#define XML_SetEntityDeclHandler(parser, handler) IExpat->XML_SetEntityDeclHandler(parser, handler) -#define XML_SetUnparsedEntityDeclHandler(parser, handler) IExpat->XML_SetUnparsedEntityDeclHandler(parser, handler) -#define XML_SetNotationDeclHandler(parser, handler) IExpat->XML_SetNotationDeclHandler(parser, handler) -#define XML_SetNotStandaloneHandler(parser, handler) IExpat->XML_SetNotStandaloneHandler(parser, handler) -#define XML_GetErrorCode(parser) IExpat->XML_GetErrorCode(parser) -#define XML_ErrorString(code) IExpat->XML_ErrorString(code) -#define XML_GetCurrentByteIndex(parser) IExpat->XML_GetCurrentByteIndex(parser) -#define XML_GetCurrentLineNumber(parser) IExpat->XML_GetCurrentLineNumber(parser) -#define XML_GetCurrentColumnNumber(parser) IExpat->XML_GetCurrentColumnNumber(parser) -#define XML_GetCurrentByteCount(parser) IExpat->XML_GetCurrentByteCount(parser) -#define XML_GetInputContext(parser, offset, size) IExpat->XML_GetInputContext(parser, offset, size) -#define XML_SetUserData(parser, userData) IExpat->XML_SetUserData(parser, userData) -#define XML_DefaultCurrent(parser) IExpat->XML_DefaultCurrent(parser) -#define XML_UseParserAsHandlerArg(parser) IExpat->XML_UseParserAsHandlerArg(parser) -#define XML_SetBase(parser, base) IExpat->XML_SetBase(parser, base) -#define XML_GetBase(parser) IExpat->XML_GetBase(parser) -#define XML_GetSpecifiedAttributeCount(parser) IExpat->XML_GetSpecifiedAttributeCount(parser) -#define XML_GetIdAttributeIndex(parser) IExpat->XML_GetIdAttributeIndex(parser) -#define XML_SetEncoding(parser, encoding) IExpat->XML_SetEncoding(parser, encoding) -#define XML_SetParamEntityParsing(parser, parsing) IExpat->XML_SetParamEntityParsing(parser, parsing) -#define XML_SetReturnNSTriplet(parser, do_nst) IExpat->XML_SetReturnNSTriplet(parser, do_nst) -#define XML_ExpatVersion() IExpat->XML_ExpatVersion() -#define XML_ExpatVersionInfo() IExpat->XML_ExpatVersionInfo() -#define XML_ParserReset(parser, encoding) IExpat->XML_ParserReset(parser, encoding) -#define XML_SetSkippedEntityHandler(parser, handler) IExpat->XML_SetSkippedEntityHandler(parser, handler) -#define XML_UseForeignDTD(parser, useDTD) IExpat->XML_UseForeignDTD(parser, useDTD) -#define XML_GetFeatureList() IExpat->XML_GetFeatureList() -#define XML_StopParser(parser, resumable) IExpat->XML_StopParser(parser, resumable) -#define XML_ResumeParser(parser) IExpat->XML_ResumeParser(parser) -#define XML_GetParsingStatus(parser, status) IExpat->XML_GetParsingStatus(parser, status) -#define XML_FreeContentModel(parser, model) IExpat->XML_FreeContentModel(parser, model) -#define XML_MemMalloc(parser, size) IExpat->XML_MemMalloc(parser, size) -#define XML_MemRealloc(parser, ptr, size) IExpat->XML_MemRealloc(parser, ptr, size) -#define XML_MemFree(parser, ptr) IExpat->XML_MemFree(parser, ptr) - -#endif /* INLINE4_EXPAT_H */ diff --git a/external/mit/expat/dist/amiga/include/interfaces/expat.h b/external/mit/expat/dist/amiga/include/interfaces/expat.h deleted file mode 100755 index e9bdf4aa1..000000000 --- a/external/mit/expat/dist/amiga/include/interfaces/expat.h +++ /dev/null @@ -1,98 +0,0 @@ -#ifndef EXPAT_INTERFACE_DEF_H -#define EXPAT_INTERFACE_DEF_H - -/* -** This file was machine generated by idltool 51.6. -** Do not edit -*/ - -#ifndef EXEC_TYPES_H -#include -#endif -#ifndef EXEC_EXEC_H -#include -#endif -#ifndef EXEC_INTERFACES_H -#include -#endif - -#ifndef LIBRARIES_EXPAT_H -#include -#endif - -struct ExpatIFace -{ - struct InterfaceData Data; - - uint32 APICALL (*Obtain)(struct ExpatIFace *Self); - uint32 APICALL (*Release)(struct ExpatIFace *Self); - void APICALL (*Expunge)(struct ExpatIFace *Self); - struct Interface * APICALL (*Clone)(struct ExpatIFace *Self); - XML_Parser APICALL (*XML_ParserCreate)(struct ExpatIFace *Self, const XML_Char * encodingName); - XML_Parser APICALL (*XML_ParserCreateNS)(struct ExpatIFace *Self, const XML_Char * encodingName, XML_Char nsSep); - XML_Parser APICALL (*XML_ParserCreate_MM)(struct ExpatIFace *Self, const XML_Char * encoding, const XML_Memory_Handling_Suite * memsuite, const XML_Char * namespaceSeparator); - XML_Parser APICALL (*XML_ExternalEntityParserCreate)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * context, const XML_Char * encoding); - void APICALL (*XML_ParserFree)(struct ExpatIFace *Self, XML_Parser parser); - enum XML_Status APICALL (*XML_Parse)(struct ExpatIFace *Self, XML_Parser parser, const char * s, int len, int isFinal); - enum XML_Status APICALL (*XML_ParseBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len, int isFinal); - void * APICALL (*XML_GetBuffer)(struct ExpatIFace *Self, XML_Parser parser, int len); - void APICALL (*XML_SetStartElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start); - void APICALL (*XML_SetEndElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndElementHandler end); - void APICALL (*XML_SetElementHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end); - void APICALL (*XML_SetCharacterDataHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CharacterDataHandler handler); - void APICALL (*XML_SetProcessingInstructionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ProcessingInstructionHandler handler); - void APICALL (*XML_SetCommentHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_CommentHandler handler); - void APICALL (*XML_SetStartCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start); - void APICALL (*XML_SetEndCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndCdataSectionHandler end); - void APICALL (*XML_SetCdataSectionHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartCdataSectionHandler start, XML_EndCdataSectionHandler end); - void APICALL (*XML_SetDefaultHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler); - void APICALL (*XML_SetDefaultHandlerExpand)(struct ExpatIFace *Self, XML_Parser parser, XML_DefaultHandler handler); - void APICALL (*XML_SetExternalEntityRefHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ExternalEntityRefHandler handler); - void APICALL (*XML_SetExternalEntityRefHandlerArg)(struct ExpatIFace *Self, XML_Parser parser, void * arg); - void APICALL (*XML_SetUnknownEncodingHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnknownEncodingHandler handler, void * data); - void APICALL (*XML_SetStartNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start); - void APICALL (*XML_SetEndNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndNamespaceDeclHandler end); - void APICALL (*XML_SetNamespaceDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartNamespaceDeclHandler start, XML_EndNamespaceDeclHandler end); - void APICALL (*XML_SetXmlDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_XmlDeclHandler handler); - void APICALL (*XML_SetStartDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start); - void APICALL (*XML_SetEndDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EndDoctypeDeclHandler end); - void APICALL (*XML_SetDoctypeDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end); - void APICALL (*XML_SetElementDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_ElementDeclHandler eldecl); - void APICALL (*XML_SetAttlistDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_AttlistDeclHandler attdecl); - void APICALL (*XML_SetEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_EntityDeclHandler handler); - void APICALL (*XML_SetUnparsedEntityDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_UnparsedEntityDeclHandler handler); - void APICALL (*XML_SetNotationDeclHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotationDeclHandler handler); - void APICALL (*XML_SetNotStandaloneHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_NotStandaloneHandler handler); - enum XML_Error APICALL (*XML_GetErrorCode)(struct ExpatIFace *Self, XML_Parser parser); - const XML_LChar * APICALL (*XML_ErrorString)(struct ExpatIFace *Self, enum XML_Error code); - long APICALL (*XML_GetCurrentByteIndex)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetCurrentLineNumber)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetCurrentColumnNumber)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetCurrentByteCount)(struct ExpatIFace *Self, XML_Parser parser); - const char * APICALL (*XML_GetInputContext)(struct ExpatIFace *Self, XML_Parser parser, int * offset, int * size); - void APICALL (*XML_SetUserData)(struct ExpatIFace *Self, XML_Parser parser, void * userData); - void APICALL (*XML_DefaultCurrent)(struct ExpatIFace *Self, XML_Parser parser); - void APICALL (*XML_UseParserAsHandlerArg)(struct ExpatIFace *Self, XML_Parser parser); - enum XML_Status APICALL (*XML_SetBase)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * base); - const XML_Char * APICALL (*XML_GetBase)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetSpecifiedAttributeCount)(struct ExpatIFace *Self, XML_Parser parser); - int APICALL (*XML_GetIdAttributeIndex)(struct ExpatIFace *Self, XML_Parser parser); - enum XML_Status APICALL (*XML_SetEncoding)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding); - int APICALL (*XML_SetParamEntityParsing)(struct ExpatIFace *Self, XML_Parser parser, enum XML_ParamEntityParsing parsing); - void APICALL (*XML_SetReturnNSTriplet)(struct ExpatIFace *Self, XML_Parser parser, int do_nst); - const XML_LChar * APICALL (*XML_ExpatVersion)(struct ExpatIFace *Self); - XML_Expat_Version APICALL (*XML_ExpatVersionInfo)(struct ExpatIFace *Self); - XML_Bool APICALL (*XML_ParserReset)(struct ExpatIFace *Self, XML_Parser parser, const XML_Char * encoding); - void APICALL (*XML_SetSkippedEntityHandler)(struct ExpatIFace *Self, XML_Parser parser, XML_SkippedEntityHandler handler); - enum XML_Error APICALL (*XML_UseForeignDTD)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool useDTD); - const XML_Feature * APICALL (*XML_GetFeatureList)(struct ExpatIFace *Self); - enum XML_Status APICALL (*XML_StopParser)(struct ExpatIFace *Self, XML_Parser parser, XML_Bool resumable); - enum XML_Status APICALL (*XML_ResumeParser)(struct ExpatIFace *Self, XML_Parser parser); - void APICALL (*XML_GetParsingStatus)(struct ExpatIFace *Self, XML_Parser parser, XML_ParsingStatus * status); - void APICALL (*XML_FreeContentModel)(struct ExpatIFace *Self, XML_Parser parser, XML_Content * model); - void * APICALL (*XML_MemMalloc)(struct ExpatIFace *Self, XML_Parser parser, size_t size); - void * APICALL (*XML_MemRealloc)(struct ExpatIFace *Self, XML_Parser parser, void * ptr, size_t size); - void APICALL (*XML_MemFree)(struct ExpatIFace *Self, XML_Parser parser, void * ptr); -}; - -#endif /* EXPAT_INTERFACE_DEF_H */ diff --git a/external/mit/expat/dist/amiga/include/libraries/expat.h b/external/mit/expat/dist/amiga/include/libraries/expat.h deleted file mode 100755 index 1b57387c7..000000000 --- a/external/mit/expat/dist/amiga/include/libraries/expat.h +++ /dev/null @@ -1,566 +0,0 @@ -#ifndef LIBRARIES_EXPAT_H -#define LIBRARIES_EXPAT_H - -/* -** Copyright (c) 2001-2007 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - - -/****************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef __GNUC__ - #ifdef __PPC__ - #pragma pack(2) - #endif -#elif defined(__VBCC__) - #pragma amiga-align -#endif - -/****************************************************************************/ - - -#include - -#ifndef XMLCALL -#define XMLCALL -#endif - -typedef char XML_Char; -typedef char XML_LChar; -typedef long XML_Index; -typedef unsigned long XML_Size; - -struct XML_ParserStruct; -typedef struct XML_ParserStruct *XML_Parser; - -typedef unsigned char XML_Bool; -#define XML_TRUE ((XML_Bool) 1) -#define XML_FALSE ((XML_Bool) 0) - -enum XML_Status { - XML_STATUS_ERROR = 0, -#define XML_STATUS_ERROR XML_STATUS_ERROR - XML_STATUS_OK = 1, -#define XML_STATUS_OK XML_STATUS_OK - XML_STATUS_SUSPENDED = 2, -#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED -}; - -enum XML_Error { - XML_ERROR_NONE, - XML_ERROR_NO_MEMORY, - XML_ERROR_SYNTAX, - XML_ERROR_NO_ELEMENTS, - XML_ERROR_INVALID_TOKEN, - XML_ERROR_UNCLOSED_TOKEN, - XML_ERROR_PARTIAL_CHAR, - XML_ERROR_TAG_MISMATCH, - XML_ERROR_DUPLICATE_ATTRIBUTE, - XML_ERROR_JUNK_AFTER_DOC_ELEMENT, - XML_ERROR_PARAM_ENTITY_REF, - XML_ERROR_UNDEFINED_ENTITY, - XML_ERROR_RECURSIVE_ENTITY_REF, - XML_ERROR_ASYNC_ENTITY, - XML_ERROR_BAD_CHAR_REF, - XML_ERROR_BINARY_ENTITY_REF, - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, - XML_ERROR_MISPLACED_XML_PI, - XML_ERROR_UNKNOWN_ENCODING, - XML_ERROR_INCORRECT_ENCODING, - XML_ERROR_UNCLOSED_CDATA_SECTION, - XML_ERROR_EXTERNAL_ENTITY_HANDLING, - XML_ERROR_NOT_STANDALONE, - XML_ERROR_UNEXPECTED_STATE, - XML_ERROR_ENTITY_DECLARED_IN_PE, - XML_ERROR_FEATURE_REQUIRES_XML_DTD, - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, - XML_ERROR_UNBOUND_PREFIX, - XML_ERROR_UNDECLARING_PREFIX, - XML_ERROR_INCOMPLETE_PE, - XML_ERROR_XML_DECL, - XML_ERROR_TEXT_DECL, - XML_ERROR_PUBLICID, - XML_ERROR_SUSPENDED, - XML_ERROR_NOT_SUSPENDED, - XML_ERROR_ABORTED, - XML_ERROR_FINISHED, - XML_ERROR_SUSPEND_PE, - XML_ERROR_RESERVED_PREFIX_XML, - XML_ERROR_RESERVED_PREFIX_XMLNS, - XML_ERROR_RESERVED_NAMESPACE_URI -}; - -enum XML_Content_Type { - XML_CTYPE_EMPTY = 1, - XML_CTYPE_ANY, - XML_CTYPE_MIXED, - XML_CTYPE_NAME, - XML_CTYPE_CHOICE, - XML_CTYPE_SEQ -}; - -enum XML_Content_Quant { - XML_CQUANT_NONE, - XML_CQUANT_OPT, - XML_CQUANT_REP, - XML_CQUANT_PLUS -}; - -typedef struct XML_cp XML_Content; - -struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - XML_Char * name; - unsigned int numchildren; - XML_Content * children; -}; - - -typedef void (*XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); - -void -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); - -typedef void (*XML_AttlistDeclHandler) ( - void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); - -void -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); - -typedef void (*XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); - -void -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); - - -typedef struct { - void *(*malloc_fcn)(size_t size); - void *(*realloc_fcn)(void *ptr, size_t size); - void (*free_fcn)(void *ptr); -} XML_Memory_Handling_Suite; - -XML_Parser -XML_ParserCreate(const XML_Char *encoding); - -XML_Parser -XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); - - -XML_Parser -XML_ParserCreate_MM(const XML_Char *encoding, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); - -XML_Bool -XML_ParserReset(XML_Parser parser, const XML_Char *encoding); - -typedef void (*XML_StartElementHandler) (void *userData, - const XML_Char *name, - const XML_Char **atts); - -typedef void (*XML_EndElementHandler) (void *userData, - const XML_Char *name); - - -typedef void (*XML_CharacterDataHandler) (void *userData, - const XML_Char *s, - int len); - -typedef void (*XML_ProcessingInstructionHandler) ( - void *userData, - const XML_Char *target, - const XML_Char *data); - -typedef void (*XML_CommentHandler) (void *userData, - const XML_Char *data); - -typedef void (*XML_StartCdataSectionHandler) (void *userData); -typedef void (*XML_EndCdataSectionHandler) (void *userData); - -typedef void (*XML_DefaultHandler) (void *userData, - const XML_Char *s, - int len); - -typedef void (*XML_StartDoctypeDeclHandler) ( - void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset); - -typedef void (*XML_EndDoctypeDeclHandler)(void *userData); - -typedef void (*XML_EntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -void -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); - -typedef void (*XML_UnparsedEntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -typedef void (*XML_NotationDeclHandler) ( - void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -typedef void (*XML_StartNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix, - const XML_Char *uri); - -typedef void (*XML_EndNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix); - -typedef int (*XML_NotStandaloneHandler) (void *userData); - -typedef int (*XML_ExternalEntityRefHandler) ( - XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -typedef void (*XML_SkippedEntityHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity); - -typedef struct { - int map[256]; - void *data; - int (*convert)(void *data, const char *s); - void (*release)(void *data); -} XML_Encoding; - -typedef int (*XML_UnknownEncodingHandler) ( - void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); - -void -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end); - -void -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler handler); - -void -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler handler); - -void -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler); - -void -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler); -void -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); - -void -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end); - -void -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start); - -void -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end); - -void -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); - -void -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); - -void -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end); - -void -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start); - -void -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); - -void -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler); - -void -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); - -void -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); - -void -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start); - -void -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end); - -void -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler); - -void -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler); - -void -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, - void *arg); - -void -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler); - -void -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *encodingHandlerData); - -void -XML_DefaultCurrent(XML_Parser parser); - -void -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); - -void -XML_SetUserData(XML_Parser parser, void *userData); - -#define XML_GetUserData(parser) (*(void **)(parser)) - -enum XML_Status -XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); - -void -XML_UseParserAsHandlerArg(XML_Parser parser); - -enum XML_Error -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); - - -enum XML_Status -XML_SetBase(XML_Parser parser, const XML_Char *base); - -const XML_Char * -XML_GetBase(XML_Parser parser); - -int -XML_GetSpecifiedAttributeCount(XML_Parser parser); - -int -XML_GetIdAttributeIndex(XML_Parser parser); - -enum XML_Status -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); - -void * -XML_GetBuffer(XML_Parser parser, int len); - -enum XML_Status -XML_ParseBuffer(XML_Parser parser, int len, int isFinal); - -enum XML_Status -XML_StopParser(XML_Parser parser, XML_Bool resumable); - -enum XML_Status -XML_ResumeParser(XML_Parser parser); - -enum XML_Parsing { - XML_INITIALIZED, - XML_PARSING, - XML_FINISHED, - XML_SUSPENDED -}; - -typedef struct { - enum XML_Parsing parsing; - XML_Bool finalBuffer; -} XML_ParsingStatus; - -void -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); - -XML_Parser -XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, - const XML_Char *encoding); - -enum XML_ParamEntityParsing { - XML_PARAM_ENTITY_PARSING_NEVER, - XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, - XML_PARAM_ENTITY_PARSING_ALWAYS -}; - -int -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing); - -enum XML_Error -XML_GetErrorCode(XML_Parser parser); - -int XML_GetCurrentLineNumber(XML_Parser parser); -int XML_GetCurrentColumnNumber(XML_Parser parser); -long XML_GetCurrentByteIndex(XML_Parser parser); - -int -XML_GetCurrentByteCount(XML_Parser parser); - -const char * -XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); - -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber -#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex - -void -XML_FreeContentModel(XML_Parser parser, XML_Content *model); - -void * -XML_MemMalloc(XML_Parser parser, size_t size); - -void * -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); - -void -XML_MemFree(XML_Parser parser, void *ptr); - -void -XML_ParserFree(XML_Parser parser); - -const XML_LChar * -XML_ErrorString(enum XML_Error code); - -const XML_LChar * -XML_ExpatVersion(void); - -typedef struct { - int major; - int minor; - int micro; -} XML_Expat_Version; - -XML_Expat_Version -XML_ExpatVersionInfo(void); - -enum XML_FeatureEnum { - XML_FEATURE_END = 0, - XML_FEATURE_UNICODE, - XML_FEATURE_UNICODE_WCHAR_T, - XML_FEATURE_DTD, - XML_FEATURE_CONTEXT_BYTES, - XML_FEATURE_MIN_SIZE, - XML_FEATURE_SIZEOF_XML_CHAR, - XML_FEATURE_SIZEOF_XML_LCHAR, - XML_FEATURE_NS, - XML_FEATURE_LARGE_SIZE -}; - -typedef struct { - enum XML_FeatureEnum feature; - const XML_LChar *name; - long int value; -} XML_Feature; - -const XML_Feature * -XML_GetFeatureList(void); - - -#define XML_MAJOR_VERSION 2 -#define XML_MINOR_VERSION 0 -#define XML_MICRO_VERSION 1 - - -/****************************************************************************/ - -#ifdef __GNUC__ - #ifdef __PPC__ - #pragma pack() - #endif -#elif defined(__VBCC__) - #pragma default-align -#endif - -#ifdef __cplusplus -} -#endif - -/****************************************************************************/ - -#endif /* EXPAT_EXPAT_H */ diff --git a/external/mit/expat/dist/amiga/include/proto/expat.h b/external/mit/expat/dist/amiga/include/proto/expat.h deleted file mode 100755 index 90bf62c46..000000000 --- a/external/mit/expat/dist/amiga/include/proto/expat.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef PROTO_EXPAT_H -#define PROTO_EXPAT_H - -#ifndef LIBRARIES_EXPAT_H -#include -#endif - -/****************************************************************************/ - -#ifndef __NOLIBBASE__ - #ifndef __USE_BASETYPE__ - extern struct Library * ExpatBase; - #else - extern struct Library * ExpatBase; - #endif /* __USE_BASETYPE__ */ -#endif /* __NOLIBBASE__ */ - -/****************************************************************************/ - -#ifdef __amigaos4__ - #include - #ifdef __USE_INLINE__ - #include - #endif /* __USE_INLINE__ */ - #ifndef CLIB_EXPAT_PROTOS_H - #define CLIB_EXPAT_PROTOS_H 1 - #endif /* CLIB_EXPAT_PROTOS_H */ - #ifndef __NOGLOBALIFACE__ - extern struct ExpatIFace *IExpat; - #endif /* __NOGLOBALIFACE__ */ -#else /* __amigaos4__ */ - #ifndef CLIB_EXPAT_PROTOS_H - #include - #endif /* CLIB_EXPAT_PROTOS_H */ - #if defined(__GNUC__) - #ifndef __PPC__ - #include - #else - #include - #endif /* __PPC__ */ - #elif defined(__VBCC__) - #ifndef __PPC__ - #include - #endif /* __PPC__ */ - #else - #include - #endif /* __GNUC__ */ -#endif /* __amigaos4__ */ - -/****************************************************************************/ - -#endif /* PROTO_EXPAT_H */ diff --git a/external/mit/expat/dist/amiga/launch.c b/external/mit/expat/dist/amiga/launch.c deleted file mode 100755 index 20b069c3f..000000000 --- a/external/mit/expat/dist/amiga/launch.c +++ /dev/null @@ -1,57 +0,0 @@ -/* -** Copyright (c) 2001-2009 Expat maintainers. -** -** Permission is hereby granted, free of charge, to any person obtaining -** a copy of this software and associated documentation files (the -** "Software"), to deal in the Software without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Software, and to -** permit persons to whom the Software is furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Software. -** -** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -*/ - -#ifdef __USE_INLINE__ -#undef __USE_INLINE__ -#endif - -#include -#include - -struct Library* ExpatBase = 0; -struct ExpatIFace* IExpat = 0; - - -void setup() __attribute__((constructor)); -void cleanup() __attribute__((destructor)); - - -void setup() -{ - ExpatBase = IExec->OpenLibrary("expat.library", 53); - IExpat = (struct ExpatIFace*)IExec->GetInterface(ExpatBase, "main", 1, NULL); - - if ( IExpat == 0 ) { - IExec->DebugPrintF("Can't open expat.library\n"); - } -} - - -void cleanup() -{ - IExec->DropInterface((struct Interface*)IExpat); - IExpat = 0; - - IExec->CloseLibrary(ExpatBase); - ExpatBase = 0; -} diff --git a/external/mit/expat/dist/bcb5/README.txt b/external/mit/expat/dist/bcb5/README.txt deleted file mode 100755 index 486f1ca85..000000000 --- a/external/mit/expat/dist/bcb5/README.txt +++ /dev/null @@ -1,87 +0,0 @@ - - Using a Borland compiler product - -The files in this directory support using both the free Borland command-line -compiler tools and the Borland C++ Builder IDE. The project files have been -tested with both versions 5 and 6 of the C++ Builder product. - - Using the free BCC32 command line compiler - -After downloading and installing the free C++ Builder commandline version, -perform the following steps (assuming it was installed under C:\Borland\BCC55): - -1) Add "C:\Borland\BCC55\BIN" to your path -2) Set the environment variable BCB to "C:\Borland\BCC55". -3) edit makefile.mak: enable or comment out the appropriate commands under - clean & distclean, depending on whether your OS can use deltree /y or - del /s/f/q. - -After that, you should simply cd to the bcb5 directory in your Expat directory -tree (same structure as CVS) and run "make all" or just "make". - - Naming - -The libraries have the base name "libexpat" followed optionally by an "s" -(static) or a "w" (unicode version), then an underscore and optionally -"mt" (multi-threaded) and "d" (dynamic RTL). - -To change the name of the library a project file produces, edit the project -option source (see step 1 under Unicode below) and change the name contained in -the PROJECT tag. In a make file, change the value assigned to the PROJECT -variable. Also, the LIBRARY entry in the .def file has to be changed to -correspond to the new executable name. - - - Unicode Considerations - -There are no facilities in the BCB 5 GUI to create a unicode-enabled -application. Fortunately, it is not hard to do by hand. - -1. The startup .obj system file must be changed to the unicode version. - Go to Project|Edit Option Source, and scroll down to the ALLOBJ tag. Change - c0x32.obj to c0x32w.obj. Editing this file can be quirky, but usually the - following kludge will make the change stick. Close and save the file - (CTRL-F4) then open the options dialog (CTRL-Shift-F11), then click OK on - the dialog immediately without changing anything in it. If this doesn't work, - you will have to close the project completely and edit the .bpr file by hand. - - If you are using a make file, just change the startup .obj file assigned - to the ALLOBJ variable. - -2. Add the macro define XML_UNICODE_WCHAR_T. In the GUI that goes in the options - dialog, Directories/Conditionals tab, in the Conditional define box. In a - make file, put it in the USERDEFINES variable. - -3. Of course, your code has to be written for unicode. As a start, the "main" - function is called "wmain". The tchar macros are an interesting way to - write code that can easily switch between unicode and utf-8. If these macros - are used, then simply adding the conditional define _UNICODE as well as - XML_UNICODE_WCHAR_T will bring in the unicode versions of the tchar macros. - Otherwise the utf-8 versions are used. xmlwf uses its own versions of the - tchar macros which are switched on and off by the XML_UNICODE macro, which - itself is set by the XML_UNICODE_WCHAR_T define. - - Threading - -The libexpat libraries are all built to link with the multi-threaded dynamic RTL's. -That means they require CC32xxMT.DLL present on the installation target. -To create single-threaded libs, do the following: - -1. The compiler option for multi-threading must be turned off. Following the - instructions above to edit the option source, remove the -tWM option from - the CFLAG1 tag. In a make file, remove it from the CFLAG1 variable. - -2. The single threaded RTL must be called. change the RTL in the ALLLIB tag or - variable (GUI or makefile repectively) to the version without the "mt" in the - name. For example, change cw32mti.lib to cw32i.lib. - - Static RTL's - -To build the libs with static RTL's do the following, - -1. For the static expatlibs, in the Tlib tab on the options dialog, uncheck the - "Use dynamic RTL" box. For the dynamic expatlibs, in the Linker tab on the - options dialog, uncheck "Use dynamic RTL". If you are using a make file, - remove the _RTLDLL assignment to the SYSDEFINES variable, and change the RTL - to the version without an "i" in the ALLLIB variable. For example, - cw32mti.lib would become cw32mt.lib. diff --git a/external/mit/expat/dist/bcb5/all_projects.bpg b/external/mit/expat/dist/bcb5/all_projects.bpg deleted file mode 100755 index 27c9a1cba..000000000 --- a/external/mit/expat/dist/bcb5/all_projects.bpg +++ /dev/null @@ -1,49 +0,0 @@ -#------------------------------------------------------------------------------ -VERSION = BWS.01 -#------------------------------------------------------------------------------ -!ifndef ROOT -ROOT = $(MAKEDIR)\.. -!endif -#------------------------------------------------------------------------------ -MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$** -DCC = $(ROOT)\bin\dcc32.exe $** -BRCC = $(ROOT)\bin\brcc32.exe $** -#------------------------------------------------------------------------------ -PROJECTS = setup libexpat_mtd.dll libexpats_mtd.lib libexpatw_mtd.dll \ - libexpatws_mtd.lib elements.exe outline.exe xmlwf.exe -#------------------------------------------------------------------------------ -default: $(PROJECTS) -#------------------------------------------------------------------------------ - -libexpat_mtd.dll: expat.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -libexpats_mtd.lib: expat_static.bpr - $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -libexpatw_mtd.dll: expatw.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -libexpatws_mtd.lib: expatw_static.bpr - $(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -elements.exe: elements.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -outline.exe: outline.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -xmlwf.exe: xmlwf.bpr - $(ROOT)\bin\bpr2mak $** - $(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak - -setup: setup.bat - call $** - - diff --git a/external/mit/expat/dist/bcb5/elements.bpf b/external/mit/expat/dist/bcb5/elements.bpf deleted file mode 100755 index 5c1e878d6..000000000 --- a/external/mit/expat/dist/bcb5/elements.bpf +++ /dev/null @@ -1,4 +0,0 @@ -USEUNIT("..\examples\elements.c"); -USELIB("Release\libexpats_mtd.lib"); -//--------------------------------------------------------------------------- -main diff --git a/external/mit/expat/dist/bcb5/elements.bpr b/external/mit/expat/dist/bcb5/elements.bpr deleted file mode 100755 index c21c0f59f..000000000 --- a/external/mit/expat/dist/bcb5/elements.bpr +++ /dev/null @@ -1,149 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\examples;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=8 -Item0=..\examples;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\examples;$(BCB)\lib;..\examples\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);..\lib\Release-w_static -Item4=$(BCB)\lib;$(RELEASELIBPATH);..\lib\Release_static -Item5=$(BCB)\lib;$(RELEASELIBPATH);C:\src\expat\lib\Release_static -Item6=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item7=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=17 -Item0=WIN32;NDEBUG;_CONSOLE;XML_STATIC -Item1=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_STATIC -Item2=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE;XML_STATIC -Item3=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE -Item4=WIN32;NDEBUG;_CONSOLE;_DEBUG -Item5=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG -Item6=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG;_UNICODE -Item7=WIN32;NDEBUG;_CONSOLE;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T -Item8=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T -Item9=WIN32;NDEBUG;_CONSOLE;_UNICODE;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T -Item10=WIN32;NDEBUG;_CONSOLE;_UNICODE;XML_STATIC;_DEBUG;XML_UNICODE -Item11=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T;__WCHAR_T -Item12=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE -Item13=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE;_UNICODE -Item14=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG;XML_UNICODE -Item15=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC;_DEBUG -Item16=WIN32;NDEBUG;_CONSOLE;_MBCS;XML_STATIC - -[HistoryLists\hlIntOutputDir] -Count=5 -Item0=Release\obj\examples -Item1=Release\obj\elements -Item2=Release\obj\mts -Item3=..\examples\Release -Item4=Release - -[HistoryLists\hlFinalOutputDir] -Count=1 -Item0=Release\ - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - - \ No newline at end of file diff --git a/external/mit/expat/dist/bcb5/elements.mak b/external/mit/expat/dist/bcb5/elements.mak deleted file mode 100755 index d4427fd51..000000000 --- a/external/mit/expat/dist/bcb5/elements.mak +++ /dev/null @@ -1,186 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\elements.exe -OBJFILES = Release\obj\examples\elements.obj -RESFILES = -MAINSOURCE = elements.bpf -RESDEPEN = $(RESFILES) -LIBFILES = Release\libexpats_mtd.lib -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\examples -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = WIN32;NDEBUG;_CONSOLE;XML_STATIC -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\examples;$(BCB)\include -LIBPATH = ..\examples;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-par -w-8027 -w-8026 -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -I..\lib -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\examples -N0Release\obj\examples -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\examples -D"" -ap -Tpe -x -Gn -q -L..\LIB\RELEASE_STATIC -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/external/mit/expat/dist/bcb5/expat.bpf b/external/mit/expat/dist/bcb5/expat.bpf deleted file mode 100755 index 2c423283f..000000000 --- a/external/mit/expat/dist/bcb5/expat.bpf +++ /dev/null @@ -1,6 +0,0 @@ -USEUNIT("..\lib\xmlparse.c"); -USEUNIT("..\lib\xmlrole.c"); -USEUNIT("..\lib\xmltok.c"); -USEDEF("libexpat_mtd.def"); -//--------------------------------------------------------------------------- -#define DllEntryPoint diff --git a/external/mit/expat/dist/bcb5/expat.bpr b/external/mit/expat/dist/bcb5/expat.bpr deleted file mode 100755 index 291b8cafc..000000000 --- a/external/mit/expat/dist/bcb5/expat.bpr +++ /dev/null @@ -1,140 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\lib;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=8 -Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS -Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS -Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS -Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP -Item4=NDEBUG;WIN32;_WINDOWS;_USRDLL;_DEBUG;EXPAT_EXPORTS;COMPILED_FROM_DSP -Item5=NDEBUG;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG -Item6=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;_DEBUG -Item7=NDEBUG;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP - -[HistoryLists\hlIntOutputDir] -Count=7 -Item0=Release\obj\libexpat -Item1=Release\obj\libexpat_static -Item2=Release\obj\mtd -Item3=Release\obj\mt -Item4=Release\obj -Item5=Release -Item6=..\lib\Release - -[HistoryLists\hlFinalOutputDir] -Count=1 -Item0=Release\ - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - - \ No newline at end of file diff --git a/external/mit/expat/dist/bcb5/expat.mak b/external/mit/expat/dist/bcb5/expat.mak deleted file mode 100755 index 7c9c23f52..000000000 --- a/external/mit/expat/dist/bcb5/expat.mak +++ /dev/null @@ -1,187 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\libexpat_mtd.dll -OBJFILES = Release\obj\libexpat\xmlparse.obj Release\obj\libexpat\xmlrole.obj \ - Release\obj\libexpat\xmltok.obj -RESFILES = -MAINSOURCE = expat.bpf -RESDEPEN = $(RESFILES) -LIBFILES = -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = libexpat_mtd.def -# --------------------------------------------------------------------------- -PATHCPP = .;..\lib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\lib;$(BCB)\include -LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc -# --------------------------------------------------------------------------- -CFLAG1 = -WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\libexpat -N0Release\obj\libexpat -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\libexpat -D"" -aa -Tpd -x -Gn -Gi -q -# --------------------------------------------------------------------------- -ALLOBJ = c0d32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/external/mit/expat/dist/bcb5/expat_static.bpf b/external/mit/expat/dist/bcb5/expat_static.bpf deleted file mode 100755 index 5ca458edc..000000000 --- a/external/mit/expat/dist/bcb5/expat_static.bpf +++ /dev/null @@ -1,5 +0,0 @@ -USEUNIT("..\lib\xmlparse.c"); -USEUNIT("..\lib\xmlrole.c"); -USEUNIT("..\lib\xmltok.c"); -//--------------------------------------------------------------------------- -#define Library diff --git a/external/mit/expat/dist/bcb5/expat_static.bpr b/external/mit/expat/dist/bcb5/expat_static.bpr deleted file mode 100755 index 2f6ec4d3b..000000000 --- a/external/mit/expat/dist/bcb5/expat_static.bpr +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\lib;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=7 -Item0=_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC -Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC -Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC -Item3=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_DEBUG -Item4=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP -Item5=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_MBCS -Item6=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP - -[HistoryLists\hlIntOutputDir] -Count=6 -Item0=Release\obj\libexpat_static -Item1=Release\obj\mts -Item2=Release\obj\mt -Item3=Release -Item4=..\lib\Release_static -Item5=Release_static - -[HistoryLists\hlFinalOutputDir] -Count=3 -Item0=Release\ -Item1=Release -Item2=Release_static\ - -[HistoryLists\hlTlibPageSize] -Count=1 -Item0=0x0010 - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - - \ No newline at end of file diff --git a/external/mit/expat/dist/bcb5/expat_static.mak b/external/mit/expat/dist/bcb5/expat_static.mak deleted file mode 100755 index 9137d3b53..000000000 --- a/external/mit/expat/dist/bcb5/expat_static.mak +++ /dev/null @@ -1,189 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\libexpats_mtd.lib -OBJFILES = Release\obj\libexpat_static\xmlparse.obj \ - Release\obj\libexpat_static\xmlrole.obj \ - Release\obj\libexpat_static\xmltok.obj -RESFILES = -MAINSOURCE = expat_static.bpf -RESDEPEN = $(RESFILES) -LIBFILES = -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\lib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -LINKER = TLib -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\lib;$(BCB)\include -LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc -LISTFILE = -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\libexpat_static -N0Release\obj\libexpat_static -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = TLib -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -!if "$(LISTFILE)" == "" -COMMA = -!else -COMMA = , -!endif - -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) /u $@ @&&! - $(LFLAGS) $? $(COMMA) $(LISTFILE) - -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/external/mit/expat/dist/bcb5/expatw.bpf b/external/mit/expat/dist/bcb5/expatw.bpf deleted file mode 100755 index 188a6d54e..000000000 --- a/external/mit/expat/dist/bcb5/expatw.bpf +++ /dev/null @@ -1,6 +0,0 @@ -USEUNIT("..\lib\xmlparse.c"); -USEUNIT("..\lib\xmlrole.c"); -USEUNIT("..\lib\xmltok.c"); -USEDEF("libexpatw_mtd.def"); -//--------------------------------------------------------------------------- -#define DllEntryPoint diff --git a/external/mit/expat/dist/bcb5/expatw.bpr b/external/mit/expat/dist/bcb5/expatw.bpr deleted file mode 100755 index 9ec50010b..000000000 --- a/external/mit/expat/dist/bcb5/expatw.bpr +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\lib;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=9 -Item0=_WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T -Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;COMPILED_FROM_DSP;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T -Item2=_WINDOWS;WIN32;NDEBUG;_DEBUG;_USRDLL;EXPAT_EXPORTS;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T -Item3=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;_DEBUG;XML_UNICODE_WCHAR_T -Item4=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG -Item5=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;_DEBUG -Item6=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_UNICODE;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T -Item7=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T;XML_UNICODE -Item8=NDEBUG;COMPILED_FROM_DSP;WIN32;_WINDOWS;_MBCS;_USRDLL;EXPAT_EXPORTS;XML_UNICODE_WCHAR_T - -[HistoryLists\hlIntOutputDir] -Count=8 -Item0=Release\obj\libexpatw -Item1=Release\obj\libexpat -Item2=Release\obj\mtd -Item3=Release\obj\mt -Item4=Release_w\obj -Item5=Release-w\obj -Item6=Release-w -Item7=..\lib\Release-w - -[HistoryLists\hlFinalOutputDir] -Count=5 -Item0=Release\ -Item1=Release -Item2=Release_w\ -Item3=Release-w\ -Item4=Release-w - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - - \ No newline at end of file diff --git a/external/mit/expat/dist/bcb5/expatw.mak b/external/mit/expat/dist/bcb5/expatw.mak deleted file mode 100755 index 08e17d003..000000000 --- a/external/mit/expat/dist/bcb5/expatw.mak +++ /dev/null @@ -1,187 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\libexpatw_mtd.dll -OBJFILES = Release\obj\libexpatw\xmlparse.obj Release\obj\libexpatw\xmlrole.obj \ - Release\obj\libexpatw\xmltok.obj -RESFILES = -MAINSOURCE = expatw.bpf -RESDEPEN = $(RESFILES) -LIBFILES = -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = libexpatw_mtd.def -# --------------------------------------------------------------------------- -PATHCPP = .;..\lib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = _WINDOWS;WIN32;NDEBUG;_USRDLL;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\lib;$(BCB)\include -LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-rch -w-par -w-8027 -w-8026 -w-ccc -# --------------------------------------------------------------------------- -CFLAG1 = -WD -O2 -X- -a8 -b -k- -vi -q -tWM -c -tWD -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\libexpatw -N0Release\obj\libexpatw -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\libexpatw -D"" -aa -Tpd -x -Gn -Gi -w -q -# --------------------------------------------------------------------------- -ALLOBJ = c0d32w.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/external/mit/expat/dist/bcb5/expatw_static.bpf b/external/mit/expat/dist/bcb5/expatw_static.bpf deleted file mode 100755 index 5ca458edc..000000000 --- a/external/mit/expat/dist/bcb5/expatw_static.bpf +++ /dev/null @@ -1,5 +0,0 @@ -USEUNIT("..\lib\xmlparse.c"); -USEUNIT("..\lib\xmlrole.c"); -USEUNIT("..\lib\xmltok.c"); -//--------------------------------------------------------------------------- -#define Library diff --git a/external/mit/expat/dist/bcb5/expatw_static.bpr b/external/mit/expat/dist/bcb5/expatw_static.bpr deleted file mode 100755 index 3f12644b6..000000000 --- a/external/mit/expat/dist/bcb5/expatw_static.bpr +++ /dev/null @@ -1,152 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\lib;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\lib;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\lib;$(BCB)\lib;..\lib\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=15 -Item0=_WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T -Item1=_WINDOWS;WIN32;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T -Item2=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T -Item3=WIN32;_WINDOWS;NDEBUG;_DEBUG;_LIB;XML_STATIC;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T -Item4=WIN32;_WINDOWS;NDEBUG;_LIB;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T -Item5=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG -Item6=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;__cplusplus -Item7=WIN32;_WINDOWS;NDEBUG;_UNICODE;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG -Item8=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG -Item9=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;__WCHAR_T -Item10=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG;_UNICODE -Item11=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE;_DEBUG;_UNICODE -Item12=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;_DEBUG -Item13=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T -Item14=WIN32;_WINDOWS;NDEBUG;_MBCS;_LIB;COMPILED_FROM_DSP;XML_UNICODE_WCHAR_T;XML_UNICODE - -[HistoryLists\hlIntOutputDir] -Count=6 -Item0=Release\obj\libexpatw_static -Item1=Release\obj\libexpat_static -Item2=Release\obj\mts -Item3=Release\obj\mt -Item4=..\lib\Release-w_static -Item5=Release-w_static - -[HistoryLists\hlFinalOutputDir] -Count=3 -Item0=Release\ -Item1=Release -Item2=Release-w_static\ - -[HistoryLists\hlTlibPageSize] -Count=1 -Item0=0x0010 - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - - \ No newline at end of file diff --git a/external/mit/expat/dist/bcb5/expatw_static.mak b/external/mit/expat/dist/bcb5/expatw_static.mak deleted file mode 100755 index 16b7e5b90..000000000 --- a/external/mit/expat/dist/bcb5/expatw_static.mak +++ /dev/null @@ -1,190 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\libexpatws_mtd.lib -OBJFILES = Release\obj\libexpatw_static\xmlparse.obj \ - Release\obj\libexpatw_static\xmlrole.obj \ - Release\obj\libexpatw_static\xmltok.obj -RESFILES = -MAINSOURCE = expatw_static.bpf -RESDEPEN = $(RESFILES) -LIBFILES = -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\lib -PATHASM = .; -PATHPAS = .; -PATHRC = .; -LINKER = TLib -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = _WINDOWS;WIN32;NDEBUG;_LIB;COMPILED_FROM_DSP;XML_STATIC;XML_UNICODE_WCHAR_T -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\lib;$(BCB)\include -LIBPATH = ..\lib;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS = -w-rch -w-par -w-8027 -w-8026 -w-ccc -LISTFILE = -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\libexpatw_static -N0Release\obj\libexpatw_static -$Y- -$L- \ - -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -# --------------------------------------------------------------------------- -ALLOBJ = $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = TLib -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -!if "$(LISTFILE)" == "" -COMMA = -!else -COMMA = , -!endif - -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) /u $@ @&&! - $(LFLAGS) $? $(COMMA) $(LISTFILE) - -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/external/mit/expat/dist/bcb5/libexpat_mtd.def b/external/mit/expat/dist/bcb5/libexpat_mtd.def deleted file mode 100755 index fc1cb9554..000000000 --- a/external/mit/expat/dist/bcb5/libexpat_mtd.def +++ /dev/null @@ -1,141 +0,0 @@ -; DEF file for BCB5 -LIBRARY LIBEXPAT_MTD -DESCRIPTION "Implements an XML parser." -EXPORTS - _XML_DefaultCurrent @1 - _XML_ErrorString @2 - _XML_ExpatVersion @3 - _XML_ExpatVersionInfo @4 - _XML_ExternalEntityParserCreate @5 - _XML_GetBase @6 - _XML_GetBuffer @7 - _XML_GetCurrentByteCount @8 - _XML_GetCurrentByteIndex @9 - _XML_GetCurrentColumnNumber @10 - _XML_GetCurrentLineNumber @11 - _XML_GetErrorCode @12 - _XML_GetIdAttributeIndex @13 - _XML_GetInputContext @14 - _XML_GetSpecifiedAttributeCount @15 - _XML_Parse @16 - _XML_ParseBuffer @17 - _XML_ParserCreate @18 - _XML_ParserCreateNS @19 - _XML_ParserCreate_MM @20 - _XML_ParserFree @21 - _XML_SetAttlistDeclHandler @22 - _XML_SetBase @23 - _XML_SetCdataSectionHandler @24 - _XML_SetCharacterDataHandler @25 - _XML_SetCommentHandler @26 - _XML_SetDefaultHandler @27 - _XML_SetDefaultHandlerExpand @28 - _XML_SetDoctypeDeclHandler @29 - _XML_SetElementDeclHandler @30 - _XML_SetElementHandler @31 - _XML_SetEncoding @32 - _XML_SetEndCdataSectionHandler @33 - _XML_SetEndDoctypeDeclHandler @34 - _XML_SetEndElementHandler @35 - _XML_SetEndNamespaceDeclHandler @36 - _XML_SetEntityDeclHandler @37 - _XML_SetExternalEntityRefHandler @38 - _XML_SetExternalEntityRefHandlerArg @39 - _XML_SetNamespaceDeclHandler @40 - _XML_SetNotStandaloneHandler @41 - _XML_SetNotationDeclHandler @42 - _XML_SetParamEntityParsing @43 - _XML_SetProcessingInstructionHandler @44 - _XML_SetReturnNSTriplet @45 - _XML_SetStartCdataSectionHandler @46 - _XML_SetStartDoctypeDeclHandler @47 - _XML_SetStartElementHandler @48 - _XML_SetStartNamespaceDeclHandler @49 - _XML_SetUnknownEncodingHandler @50 - _XML_SetUnparsedEntityDeclHandler @51 - _XML_SetUserData @52 - _XML_SetXmlDeclHandler @53 - _XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - _XML_ParserReset @55 - _XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - _XML_GetFeatureList @57 - _XML_UseForeignDTD @58 -; added with version 1.95.6 - _XML_FreeContentModel @59 - _XML_MemMalloc @60 - _XML_MemRealloc @61 - _XML_MemFree @62 -; added with version 1.95.8 - _XML_StopParser @63 - _XML_ResumeParser @64 - _XML_GetParsingStatus @65 - -; Aliases for MS compatible names - XML_DefaultCurrent = _XML_DefaultCurrent - XML_ErrorString = _XML_ErrorString - XML_ExpatVersion = _XML_ExpatVersion - XML_ExpatVersionInfo = _XML_ExpatVersionInfo - XML_ExternalEntityParserCreate = _XML_ExternalEntityParserCreate - XML_GetBase = _XML_GetBase - XML_GetBuffer = _XML_GetBuffer - XML_GetCurrentByteCount = _XML_GetCurrentByteCount - XML_GetCurrentByteIndex = _XML_GetCurrentByteIndex - XML_GetCurrentColumnNumber = _XML_GetCurrentColumnNumber - XML_GetCurrentLineNumber = _XML_GetCurrentLineNumber - XML_GetErrorCode = _XML_GetErrorCode - XML_GetIdAttributeIndex = _XML_GetIdAttributeIndex - XML_GetInputContext = _XML_GetInputContext - XML_GetSpecifiedAttributeCount = _XML_GetSpecifiedAttributeCount - XML_Parse = _XML_Parse - XML_ParseBuffer = _XML_ParseBuffer - XML_ParserCreate = _XML_ParserCreate - XML_ParserCreateNS = _XML_ParserCreateNS - XML_ParserCreate_MM = _XML_ParserCreate_MM - XML_ParserFree = _XML_ParserFree - XML_SetAttlistDeclHandler = _XML_SetAttlistDeclHandler - XML_SetBase = _XML_SetBase - XML_SetCdataSectionHandler = _XML_SetCdataSectionHandler - XML_SetCharacterDataHandler = _XML_SetCharacterDataHandler - XML_SetCommentHandler = _XML_SetCommentHandler - XML_SetDefaultHandler = _XML_SetDefaultHandler - XML_SetDefaultHandlerExpand = _XML_SetDefaultHandlerExpand - XML_SetDoctypeDeclHandler = _XML_SetDoctypeDeclHandler - XML_SetElementDeclHandler = _XML_SetElementDeclHandler - XML_SetElementHandler = _XML_SetElementHandler - XML_SetEncoding = _XML_SetEncoding - XML_SetEndCdataSectionHandler = _XML_SetEndCdataSectionHandler - XML_SetEndDoctypeDeclHandler = _XML_SetEndDoctypeDeclHandler - XML_SetEndElementHandler = _XML_SetEndElementHandler - XML_SetEndNamespaceDeclHandler = _XML_SetEndNamespaceDeclHandler - XML_SetEntityDeclHandler = _XML_SetEntityDeclHandler - XML_SetExternalEntityRefHandler = _XML_SetExternalEntityRefHandler - XML_SetExternalEntityRefHandlerArg = _XML_SetExternalEntityRefHandlerArg - XML_SetNamespaceDeclHandler = _XML_SetNamespaceDeclHandler - XML_SetNotStandaloneHandler = _XML_SetNotStandaloneHandler - XML_SetNotationDeclHandler = _XML_SetNotationDeclHandler - XML_SetParamEntityParsing = _XML_SetParamEntityParsing - XML_SetProcessingInstructionHandler = _XML_SetProcessingInstructionHandler - XML_SetReturnNSTriplet = _XML_SetReturnNSTriplet - XML_SetStartCdataSectionHandler = _XML_SetStartCdataSectionHandler - XML_SetStartDoctypeDeclHandler = _XML_SetStartDoctypeDeclHandler - XML_SetStartElementHandler = _XML_SetStartElementHandler - XML_SetStartNamespaceDeclHandler = _XML_SetStartNamespaceDeclHandler - XML_SetUnknownEncodingHandler = _XML_SetUnknownEncodingHandler - XML_SetUnparsedEntityDeclHandler = _XML_SetUnparsedEntityDeclHandler - XML_SetUserData = _XML_SetUserData - XML_SetXmlDeclHandler = _XML_SetXmlDeclHandler - XML_UseParserAsHandlerArg = _XML_UseParserAsHandlerArg - XML_ParserReset = _XML_ParserReset - XML_SetSkippedEntityHandler = _XML_SetSkippedEntityHandler - XML_GetFeatureList = _XML_GetFeatureList - XML_UseForeignDTD = _XML_UseForeignDTD - XML_FreeContentModel = _XML_FreeContentModel - XML_MemMalloc = _XML_MemMalloc - XML_MemRealloc = _XML_MemRealloc - XML_MemFree = _XML_MemFree - XML_StopParser = _XML_StopParser - XML_ResumeParser = _XML_ResumeParser - XML_GetParsingStatus = _XML_GetParsingStatus - diff --git a/external/mit/expat/dist/bcb5/libexpatw_mtd.def b/external/mit/expat/dist/bcb5/libexpatw_mtd.def deleted file mode 100755 index 418462df5..000000000 --- a/external/mit/expat/dist/bcb5/libexpatw_mtd.def +++ /dev/null @@ -1,140 +0,0 @@ -; DEF file for BCB5 -LIBRARY LIBEXPATW_MTD -DESCRIPTION "Implements an XML parser." -EXPORTS - _XML_DefaultCurrent @1 - _XML_ErrorString @2 - _XML_ExpatVersion @3 - _XML_ExpatVersionInfo @4 - _XML_ExternalEntityParserCreate @5 - _XML_GetBase @6 - _XML_GetBuffer @7 - _XML_GetCurrentByteCount @8 - _XML_GetCurrentByteIndex @9 - _XML_GetCurrentColumnNumber @10 - _XML_GetCurrentLineNumber @11 - _XML_GetErrorCode @12 - _XML_GetIdAttributeIndex @13 - _XML_GetInputContext @14 - _XML_GetSpecifiedAttributeCount @15 - _XML_Parse @16 - _XML_ParseBuffer @17 - _XML_ParserCreate @18 - _XML_ParserCreateNS @19 - _XML_ParserCreate_MM @20 - _XML_ParserFree @21 - _XML_SetAttlistDeclHandler @22 - _XML_SetBase @23 - _XML_SetCdataSectionHandler @24 - _XML_SetCharacterDataHandler @25 - _XML_SetCommentHandler @26 - _XML_SetDefaultHandler @27 - _XML_SetDefaultHandlerExpand @28 - _XML_SetDoctypeDeclHandler @29 - _XML_SetElementDeclHandler @30 - _XML_SetElementHandler @31 - _XML_SetEncoding @32 - _XML_SetEndCdataSectionHandler @33 - _XML_SetEndDoctypeDeclHandler @34 - _XML_SetEndElementHandler @35 - _XML_SetEndNamespaceDeclHandler @36 - _XML_SetEntityDeclHandler @37 - _XML_SetExternalEntityRefHandler @38 - _XML_SetExternalEntityRefHandlerArg @39 - _XML_SetNamespaceDeclHandler @40 - _XML_SetNotStandaloneHandler @41 - _XML_SetNotationDeclHandler @42 - _XML_SetParamEntityParsing @43 - _XML_SetProcessingInstructionHandler @44 - _XML_SetReturnNSTriplet @45 - _XML_SetStartCdataSectionHandler @46 - _XML_SetStartDoctypeDeclHandler @47 - _XML_SetStartElementHandler @48 - _XML_SetStartNamespaceDeclHandler @49 - _XML_SetUnknownEncodingHandler @50 - _XML_SetUnparsedEntityDeclHandler @51 - _XML_SetUserData @52 - _XML_SetXmlDeclHandler @53 - _XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - _XML_ParserReset @55 - _XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - _XML_GetFeatureList @57 - _XML_UseForeignDTD @58 -; added with version 1.95.6 - _XML_FreeContentModel @59 - _XML_MemMalloc @60 - _XML_MemRealloc @61 - _XML_MemFree @62 -; added with version 1.95.8 - _XML_StopParser @63 - _XML_ResumeParser @64 - _XML_GetParsingStatus @65 - -; Aliases for MS compatible names - XML_DefaultCurrent = _XML_DefaultCurrent - XML_ErrorString = _XML_ErrorString - XML_ExpatVersion = _XML_ExpatVersion - XML_ExpatVersionInfo = _XML_ExpatVersionInfo - XML_ExternalEntityParserCreate = _XML_ExternalEntityParserCreate - XML_GetBase = _XML_GetBase - XML_GetBuffer = _XML_GetBuffer - XML_GetCurrentByteCount = _XML_GetCurrentByteCount - XML_GetCurrentByteIndex = _XML_GetCurrentByteIndex - XML_GetCurrentColumnNumber = _XML_GetCurrentColumnNumber - XML_GetCurrentLineNumber = _XML_GetCurrentLineNumber - XML_GetErrorCode = _XML_GetErrorCode - XML_GetIdAttributeIndex = _XML_GetIdAttributeIndex - XML_GetInputContext = _XML_GetInputContext - XML_GetSpecifiedAttributeCount = _XML_GetSpecifiedAttributeCount - XML_Parse = _XML_Parse - XML_ParseBuffer = _XML_ParseBuffer - XML_ParserCreate = _XML_ParserCreate - XML_ParserCreateNS = _XML_ParserCreateNS - XML_ParserCreate_MM = _XML_ParserCreate_MM - XML_ParserFree = _XML_ParserFree - XML_SetAttlistDeclHandler = _XML_SetAttlistDeclHandler - XML_SetBase = _XML_SetBase - XML_SetCdataSectionHandler = _XML_SetCdataSectionHandler - XML_SetCharacterDataHandler = _XML_SetCharacterDataHandler - XML_SetCommentHandler = _XML_SetCommentHandler - XML_SetDefaultHandler = _XML_SetDefaultHandler - XML_SetDefaultHandlerExpand = _XML_SetDefaultHandlerExpand - XML_SetDoctypeDeclHandler = _XML_SetDoctypeDeclHandler - XML_SetElementDeclHandler = _XML_SetElementDeclHandler - XML_SetElementHandler = _XML_SetElementHandler - XML_SetEncoding = _XML_SetEncoding - XML_SetEndCdataSectionHandler = _XML_SetEndCdataSectionHandler - XML_SetEndDoctypeDeclHandler = _XML_SetEndDoctypeDeclHandler - XML_SetEndElementHandler = _XML_SetEndElementHandler - XML_SetEndNamespaceDeclHandler = _XML_SetEndNamespaceDeclHandler - XML_SetEntityDeclHandler = _XML_SetEntityDeclHandler - XML_SetExternalEntityRefHandler = _XML_SetExternalEntityRefHandler - XML_SetExternalEntityRefHandlerArg = _XML_SetExternalEntityRefHandlerArg - XML_SetNamespaceDeclHandler = _XML_SetNamespaceDeclHandler - XML_SetNotStandaloneHandler = _XML_SetNotStandaloneHandler - XML_SetNotationDeclHandler = _XML_SetNotationDeclHandler - XML_SetParamEntityParsing = _XML_SetParamEntityParsing - XML_SetProcessingInstructionHandler = _XML_SetProcessingInstructionHandler - XML_SetReturnNSTriplet = _XML_SetReturnNSTriplet - XML_SetStartCdataSectionHandler = _XML_SetStartCdataSectionHandler - XML_SetStartDoctypeDeclHandler = _XML_SetStartDoctypeDeclHandler - XML_SetStartElementHandler = _XML_SetStartElementHandler - XML_SetStartNamespaceDeclHandler = _XML_SetStartNamespaceDeclHandler - XML_SetUnknownEncodingHandler = _XML_SetUnknownEncodingHandler - XML_SetUnparsedEntityDeclHandler = _XML_SetUnparsedEntityDeclHandler - XML_SetUserData = _XML_SetUserData - XML_SetXmlDeclHandler = _XML_SetXmlDeclHandler - XML_UseParserAsHandlerArg = _XML_UseParserAsHandlerArg - XML_ParserReset = _XML_ParserReset - XML_SetSkippedEntityHandler = _XML_SetSkippedEntityHandler - XML_GetFeatureList = _XML_GetFeatureList - XML_UseForeignDTD = _XML_UseForeignDTD - XML_FreeContentModel = _XML_FreeContentModel - XML_MemMalloc = _XML_MemMalloc - XML_MemRealloc = _XML_MemRealloc - XML_MemFree = _XML_MemFree - XML_StopParser = _XML_StopParser - XML_ResumeParser = _XML_ResumeParser - XML_GetParsingStatus = _XML_GetParsingStatus diff --git a/external/mit/expat/dist/bcb5/makefile.mak b/external/mit/expat/dist/bcb5/makefile.mak deleted file mode 100755 index 548815eaf..000000000 --- a/external/mit/expat/dist/bcb5/makefile.mak +++ /dev/null @@ -1,37 +0,0 @@ -all: setup expat expatw expat_static expatw_static elements outline xmlwf - -setup: - setup - -expat: - make -l -fexpat.mak - -expatw: - make -l -fexpatw.mak - -expat_static: - make -l -fexpat_static.mak - -expatw_static: - make -l -fexpatw_static.mak - -elements: - make -l -felements.mak - -outline: - make -l -foutline.mak - -xmlwf: - make -l -fxmlwf.mak - -clean: -# works on Win98/ME -# deltree /y release\obj -# works on WinNT/2000 - del /s/f/q release\obj - -distclean: -# works on Win98/ME -# deltree /y release\*.* -# works on WinNT/2000 - del /s/f/q release\* diff --git a/external/mit/expat/dist/bcb5/outline.bpf b/external/mit/expat/dist/bcb5/outline.bpf deleted file mode 100755 index 52dce8301..000000000 --- a/external/mit/expat/dist/bcb5/outline.bpf +++ /dev/null @@ -1,4 +0,0 @@ -USEUNIT("..\examples\outline.c"); -USELIB("Release\libexpat_mtd.lib"); -//--------------------------------------------------------------------------- -main diff --git a/external/mit/expat/dist/bcb5/outline.bpr b/external/mit/expat/dist/bcb5/outline.bpr deleted file mode 100755 index e0ae5cdee..000000000 --- a/external/mit/expat/dist/bcb5/outline.bpr +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=3 -Item0=..\examples;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=4 -Item0=..\examples;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\examples;$(BCB)\lib;..\examples\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=6 -Item0=WIN32;NDEBUG;_CONSOLE -Item1=WIN32;NDEBUG;_CONSOLE;XML_STATIC -Item2=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_STATIC -Item3=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE;XML_STATIC -Item4=WIN32;NDEBUG;_CONSOLE;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE -Item5=WIN32;NDEBUG;_CONSOLE;_DEBUG - -[HistoryLists\hlIntOutputDir] -Count=4 -Item0=Release\obj\examples -Item1=Release\obj\outline -Item2=..\examples\Release -Item3=Release - -[HistoryLists\hlFinalOutputDir] -Count=1 -Item0=Release\ - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams= -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - - \ No newline at end of file diff --git a/external/mit/expat/dist/bcb5/outline.mak b/external/mit/expat/dist/bcb5/outline.mak deleted file mode 100755 index 510b541f6..000000000 --- a/external/mit/expat/dist/bcb5/outline.mak +++ /dev/null @@ -1,186 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\outline.exe -OBJFILES = Release\obj\examples\outline.obj -RESFILES = -MAINSOURCE = outline.bpf -RESDEPEN = $(RESFILES) -LIBFILES = Release\libexpat_mtd.lib -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\examples -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = WIN32;NDEBUG;_CONSOLE -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\examples;$(BCB)\include -LIBPATH = ..\examples;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-par -w-8027 -w-8026 -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -I..\lib -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\examples -N0Release\obj\examples -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\examples -D"" -ap -Tpe -x -Gn -q -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/external/mit/expat/dist/bcb5/setup.bat b/external/mit/expat/dist/bcb5/setup.bat deleted file mode 100755 index 6f4b57317..000000000 --- a/external/mit/expat/dist/bcb5/setup.bat +++ /dev/null @@ -1,9 +0,0 @@ -REM CommandInterpreter: $(COMSPEC) -if not exist .\release\nul mkdir release -if not exist .\release\obj\nul mkdir release\obj -if not exist .\release\obj\libexpat\nul mkdir release\obj\libexpat -if not exist .\release\obj\libexpatw\nul mkdir release\obj\libexpatw -if not exist .\release\obj\libexpat_static\nul mkdir release\obj\libexpat_static -if not exist .\release\obj\libexpatw_static\nul mkdir release\obj\libexpatw_static -if not exist .\release\obj\examples\nul mkdir release\obj\examples -if not exist .\release\obj\xmlwf\nul mkdir release\obj\xmlwf diff --git a/external/mit/expat/dist/bcb5/xmlwf.bpf b/external/mit/expat/dist/bcb5/xmlwf.bpf deleted file mode 100755 index d06208e81..000000000 --- a/external/mit/expat/dist/bcb5/xmlwf.bpf +++ /dev/null @@ -1,7 +0,0 @@ -USEUNIT("..\xmlwf\codepage.c"); -USEUNIT("..\xmlwf\win32filemap.c"); -USEUNIT("..\xmlwf\xmlfile.c"); -USEUNIT("..\xmlwf\xmlwf.c"); -USELIB("Release\libexpat_mtd.lib"); -//--------------------------------------------------------------------------- -main diff --git a/external/mit/expat/dist/bcb5/xmlwf.bpr b/external/mit/expat/dist/bcb5/xmlwf.bpr deleted file mode 100755 index d33a15387..000000000 --- a/external/mit/expat/dist/bcb5/xmlwf.bpr +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 -Locale=1033 -CodePage=1252 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[HistoryLists\hlIncludePath] -Count=4 -Item0=..\xmlwf;$(BCB)\include -Item1=$(BCB)\include -Item2=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl -Item3=$(BCB)\include;$(BCB)\include\mfc;$(BCB)\include\atl; - -[HistoryLists\hlLibraryPath] -Count=5 -Item0=..\xmlwf;$(BCB)\lib;$(RELEASELIBPATH) -Item1=..\xmlwf;$(BCB)\lib;..\xmlwf\$(RELEASELIBPATH) -Item2=$(BCB)\lib;$(RELEASELIBPATH) -Item3=$(BCB)\lib;$(RELEASELIBPATH);$(BCB)\lib\psdk -Item4=$(BCB)\lib;$(RELEASELIBPATH);;$(BCB)\lib\psdk; - -[HistoryLists\hlDebugSourcePath] -Count=1 -Item0=$(BCB)\source\vcl - -[HistoryLists\hlConditionals] -Count=6 -Item0=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP -Item1=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T;_UNICODE -Item2=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;XML_UNICODE_WCHAR_T -Item3=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG -Item4=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;_UNICODE;XML_UNICODE_WCHAR_T -Item5=NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP;_DEBUG;_UNICODE - -[HistoryLists\hlIntOutputDir] -Count=3 -Item0=Release\obj\xmlwf -Item1=..\xmlwf\Release -Item2=Release - -[HistoryLists\hlFinalOutputDir] -Count=3 -Item0=Release\ -Item1=Release -Item2=.\Release\ - -[Debugging] -DebugSourceDirs= - -[Parameters] -RunParams=sample.xml -HostApplication= -RemoteHost= -RemotePath= -RemoteDebug=0 - -[Compiler] -ShowInfoMsgs=0 -LinkDebugVcl=0 -LinkCGLIB=0 - -[Language] -ActiveLang= -ProjectLang= -RootDir= - - \ No newline at end of file diff --git a/external/mit/expat/dist/bcb5/xmlwf.mak b/external/mit/expat/dist/bcb5/xmlwf.mak deleted file mode 100755 index f74126e45..000000000 --- a/external/mit/expat/dist/bcb5/xmlwf.mak +++ /dev/null @@ -1,187 +0,0 @@ -# --------------------------------------------------------------------------- -!if !$d(BCB) -BCB = $(MAKEDIR)\.. -!endif - -# --------------------------------------------------------------------------- -# IDE SECTION -# --------------------------------------------------------------------------- -# The following section of the project makefile is managed by the BCB IDE. -# It is recommended to use the IDE to change any of the values in this -# section. -# --------------------------------------------------------------------------- - -VERSION = BCB.05.03 -# --------------------------------------------------------------------------- -PROJECT = Release\xmlwf.exe -OBJFILES = Release\obj\xmlwf\codepage.obj Release\obj\xmlwf\win32filemap.obj \ - Release\obj\xmlwf\xmlfile.obj Release\obj\xmlwf\xmlwf.obj -RESFILES = -MAINSOURCE = xmlwf.bpf -RESDEPEN = $(RESFILES) -LIBFILES = Release\libexpat_mtd.lib -IDLFILES = -IDLGENFILES = -LIBRARIES = -PACKAGES = VCL50.bpi VCLX50.bpi bcbsmp50.bpi QRPT50.bpi VCLDB50.bpi VCLBDE50.bpi \ - ibsmp50.bpi VCLDBX50.bpi TEEUI50.bpi TEEDB50.bpi TEE50.bpi TEEQR50.bpi \ - VCLIB50.bpi bcbie50.bpi VCLIE50.bpi INETDB50.bpi INET50.bpi NMFAST50.bpi \ - dclocx50.bpi bcb2kaxserver50.bpi dclusr50.bpi -SPARELIBS = -DEFFILE = -# --------------------------------------------------------------------------- -PATHCPP = .;..\xmlwf -PATHASM = .; -PATHPAS = .; -PATHRC = .; -DEBUGLIBPATH = $(BCB)\lib\debug -RELEASELIBPATH = $(BCB)\lib\release -USERDEFINES = NDEBUG;WIN32;_CONSOLE;COMPILED_FROM_DSP -SYSDEFINES = _NO_VCL;_ASSERTE;NO_STRICT;_RTLDLL -INCLUDEPATH = ..\xmlwf;$(BCB)\include -LIBPATH = ..\xmlwf;$(BCB)\lib;$(RELEASELIBPATH) -WARNINGS= -w-8065 -w-par -w-8027 -w-8026 -# --------------------------------------------------------------------------- -CFLAG1 = -O2 -X- -a8 -b -k- -vi -q -tWM -I..\lib -c -IDLCFLAGS = -I$(BCB)\include -PFLAGS = -N2Release\obj\xmlwf -N0Release\obj\xmlwf -$Y- -$L- -$D- -RFLAGS = /l 0x409 /d "NDEBUG" /i$(BCB)\include -AFLAGS = /mx /w2 /zn -LFLAGS = -IRelease\obj\xmlwf -D"" -ap -Tpe -x -Gn -q -# --------------------------------------------------------------------------- -ALLOBJ = c0x32.obj $(OBJFILES) -ALLRES = $(RESFILES) -ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib -# --------------------------------------------------------------------------- -!ifdef IDEOPTIONS - -[Version Info] -IncludeVerInfo=0 -AutoIncBuild=0 -MajorVer=1 -MinorVer=0 -Release=0 -Build=0 -Debug=0 -PreRelease=0 -Special=0 -Private=0 -DLL=0 - -[Version Info Keys] -CompanyName= -FileDescription= -FileVersion=1.0.0.0 -InternalName= -LegalCopyright= -LegalTrademarks= -OriginalFilename= -ProductName= -ProductVersion=1.0.0.0 -Comments= - -[Debugging] -DebugSourceDirs=$(BCB)\source\vcl - -!endif - - - - - -# --------------------------------------------------------------------------- -# MAKE SECTION -# --------------------------------------------------------------------------- -# This section of the project file is not used by the BCB IDE. It is for -# the benefit of building from the command-line using the MAKE utility. -# --------------------------------------------------------------------------- - -.autodepend -# --------------------------------------------------------------------------- -!if "$(USERDEFINES)" != "" -AUSERDEFINES = -d$(USERDEFINES:;= -d) -!else -AUSERDEFINES = -!endif - -!if !$d(BCC32) -BCC32 = bcc32 -!endif - -!if !$d(CPP32) -CPP32 = cpp32 -!endif - -!if !$d(DCC32) -DCC32 = dcc32 -!endif - -!if !$d(TASM32) -TASM32 = tasm32 -!endif - -!if !$d(LINKER) -LINKER = ilink32 -!endif - -!if !$d(BRCC32) -BRCC32 = brcc32 -!endif - - -# --------------------------------------------------------------------------- -!if $d(PATHCPP) -.PATH.CPP = $(PATHCPP) -.PATH.C = $(PATHCPP) -!endif - -!if $d(PATHPAS) -.PATH.PAS = $(PATHPAS) -!endif - -!if $d(PATHASM) -.PATH.ASM = $(PATHASM) -!endif - -!if $d(PATHRC) -.PATH.RC = $(PATHRC) -!endif -# --------------------------------------------------------------------------- -$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE) - $(BCB)\BIN\$(LINKER) @&&! - $(LFLAGS) -L$(LIBPATH) + - $(ALLOBJ), + - $(PROJECT),, + - $(ALLLIB), + - $(DEFFILE), + - $(ALLRES) -! -# --------------------------------------------------------------------------- -.pas.hpp: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.pas.obj: - $(BCB)\BIN\$(DCC32) $(PFLAGS) -U$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -O$(INCLUDEPATH) --BCB {$< } - -.cpp.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.obj: - $(BCB)\BIN\$(BCC32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n$(@D) {$< } - -.c.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.cpp.i: - $(BCB)\BIN\$(CPP32) $(CFLAG1) $(WARNINGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -n. {$< } - -.asm.obj: - $(BCB)\BIN\$(TASM32) $(AFLAGS) -i$(INCLUDEPATH:;= -i) $(AUSERDEFINES) -d$(SYSDEFINES:;= -d) $<, $@ - -.rc.res: - $(BCB)\BIN\$(BRCC32) $(RFLAGS) -I$(INCLUDEPATH) -D$(USERDEFINES);$(SYSDEFINES) -fo$@ $< -# --------------------------------------------------------------------------- - - - - diff --git a/external/mit/expat/dist/configure b/external/mit/expat/dist/configure deleted file mode 100755 index 247d0ef27..000000000 --- a/external/mit/expat/dist/configure +++ /dev/null @@ -1,18632 +0,0 @@ -#! /bin/sh -# Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for expat 2.1.0. -# -# Report bugs to . -# -# -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, -# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software -# Foundation, Inc. -# -# -# This configure script is free software; the Free Software Foundation -# gives unlimited permission to copy, distribute and modify it. -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -if test "x$CONFIG_SHELL" = x; then - as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi -" - as_required="as_fn_return () { (exit \$1); } -as_fn_success () { as_fn_return 0; } -as_fn_failure () { as_fn_return 1; } -as_fn_ret_success () { return 0; } -as_fn_ret_failure () { return 1; } - -exitcode=0 -as_fn_success || { exitcode=1; echo as_fn_success failed.; } -as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } -as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } -as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } -if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : - -else - exitcode=1; echo positional parameters were not saved. -fi -test x\$exitcode = x0 || exit 1" - as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO - as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO - eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && - test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 - - test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ - || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 -test \$(( 1 + 1 )) = 2 || exit 1" - if (eval "$as_required") 2>/dev/null; then : - as_have_required=yes -else - as_have_required=no -fi - if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : - -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -as_found=false -for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - as_found=: - case $as_dir in #( - /*) - for as_base in sh bash ksh sh5; do - # Try only shells that exist, to save several forks. - as_shell=$as_dir/$as_base - if { test -f "$as_shell" || test -f "$as_shell.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : - CONFIG_SHELL=$as_shell as_have_required=yes - if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : - break 2 -fi -fi - done;; - esac - as_found=false -done -$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && - { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : - CONFIG_SHELL=$SHELL as_have_required=yes -fi; } -IFS=$as_save_IFS - - - if test "x$CONFIG_SHELL" != x; then : - # We cannot yet assume a decent shell, so we have to provide a - # neutralization value for shells without unset; and this also - # works around shells that cannot unset nonexistent variables. - # Preserve -v and -x to the replacement shell. - BASH_ENV=/dev/null - ENV=/dev/null - (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV - export CONFIG_SHELL - case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; - esac - exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} -fi - - if test x$as_have_required = xno; then : - $as_echo "$0: This script requires a shell more modern than all" - $as_echo "$0: the shells that I found on your system." - if test x${ZSH_VERSION+set} = xset ; then - $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" - $as_echo "$0: be upgraded to zsh 4.3.4 or later." - else - $as_echo "$0: Please tell bug-autoconf@gnu.org and -$0: expat-bugs@libexpat.org about your system, including -$0: any error possibly output before this message. Then -$0: install a modern shell, or manually run the script -$0: under such a shell if you do have one." - fi - exit 1 -fi -fi -fi -SHELL=${CONFIG_SHELL-/bin/sh} -export SHELL -# Unset more variables known to interfere with behavior of common tools. -CLICOLOR_FORCE= GREP_OPTIONS= -unset CLICOLOR_FORCE GREP_OPTIONS - -## --------------------- ## -## M4sh Shell Functions. ## -## --------------------- ## -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - - - as_lineno_1=$LINENO as_lineno_1a=$LINENO - as_lineno_2=$LINENO as_lineno_2a=$LINENO - eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && - test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { - # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) - sed -n ' - p - /[$]LINENO/= - ' <$as_myself | - sed ' - s/[$]LINENO.*/&-/ - t lineno - b - :lineno - N - :loop - s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ - t loop - s/-\n.*// - ' >$as_me.lineno && - chmod +x "$as_me.lineno" || - { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - - # Don't try to exec as it changes $[0], causing all sort of problems - # (the dirname of $[0] is not the place where we might find the - # original and so on. Autoconf is especially sensitive to this). - . "./$as_me.lineno" - # Exit status is that of the last command. - exit -} - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - -SHELL=${CONFIG_SHELL-/bin/sh} - - -test -n "$DJDIR" || exec 7<&0 &1 - -# Name of the host. -# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, -# so uname gets run too. -ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` - -# -# Initializations. -# -ac_default_prefix=/usr/local -ac_clean_files= -ac_config_libobj_dir=. -LIBOBJS= -cross_compiling=no -subdirs= -MFLAGS= -MAKEFLAGS= - -# Identity of this package. -PACKAGE_NAME='expat' -PACKAGE_TARNAME='expat' -PACKAGE_VERSION='2.1.0' -PACKAGE_STRING='expat 2.1.0' -PACKAGE_BUGREPORT='expat-bugs@libexpat.org' -PACKAGE_URL='' - -ac_unique_file="Makefile.in" -# Factoring default headers for most tests. -ac_includes_default="\ -#include -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#ifdef HAVE_SYS_STAT_H -# include -#endif -#ifdef STDC_HEADERS -# include -# include -#else -# ifdef HAVE_STDLIB_H -# include -# endif -#endif -#ifdef HAVE_STRING_H -# if !defined STDC_HEADERS && defined HAVE_MEMORY_H -# include -# endif -# include -#endif -#ifdef HAVE_STRINGS_H -# include -#endif -#ifdef HAVE_INTTYPES_H -# include -#endif -#ifdef HAVE_STDINT_H -# include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif" - -ac_header_list= -ac_subst_vars='LTLIBOBJS -LIBOBJS -FILEMAP -INSTALL_DATA -INSTALL_SCRIPT -INSTALL_PROGRAM -CXXCPP -ac_ct_CXX -CXXFLAGS -CXX -LIBAGE -LIBREVISION -LIBCURRENT -CPP -OTOOL64 -OTOOL -LIPO -NMEDIT -DSYMUTIL -MANIFEST_TOOL -AWK -RANLIB -STRIP -ac_ct_AR -AR -LN_S -NM -ac_ct_DUMPBIN -DUMPBIN -LD -FGREP -EGREP -GREP -SED -OBJEXT -EXEEXT -ac_ct_CC -CPPFLAGS -LDFLAGS -CFLAGS -CC -LIBTOOL -OBJDUMP -DLLTOOL -AS -host_os -host_vendor -host_cpu -host -build_os -build_vendor -build_cpu -build -target_alias -host_alias -build_alias -LIBS -ECHO_T -ECHO_N -ECHO_C -DEFS -mandir -localedir -libdir -psdir -pdfdir -dvidir -htmldir -infodir -docdir -oldincludedir -includedir -localstatedir -sharedstatedir -sysconfdir -datadir -datarootdir -libexecdir -sbindir -bindir -program_transform_name -prefix -exec_prefix -PACKAGE_URL -PACKAGE_BUGREPORT -PACKAGE_STRING -PACKAGE_VERSION -PACKAGE_TARNAME -PACKAGE_NAME -PATH_SEPARATOR -SHELL' -ac_subst_files='' -ac_user_opts=' -enable_option_checking -enable_shared -enable_static -with_pic -enable_fast_install -with_gnu_ld -with_sysroot -enable_libtool_lock -' - ac_precious_vars='build_alias -host_alias -target_alias -CC -CFLAGS -LDFLAGS -LIBS -CPPFLAGS -CPP -CXX -CXXFLAGS -CCC -CXXCPP' - - -# Initialize some variables set by options. -ac_init_help= -ac_init_version=false -ac_unrecognized_opts= -ac_unrecognized_sep= -# The variables have the same names as the options, with -# dashes changed to underlines. -cache_file=/dev/null -exec_prefix=NONE -no_create= -no_recursion= -prefix=NONE -program_prefix=NONE -program_suffix=NONE -program_transform_name=s,x,x, -silent= -site= -srcdir= -verbose= -x_includes=NONE -x_libraries=NONE - -# Installation directory options. -# These are left unexpanded so users can "make install exec_prefix=/foo" -# and all the variables that are supposed to be based on exec_prefix -# by default will actually change. -# Use braces instead of parens because sh, perl, etc. also accept them. -# (The list follows the same order as the GNU Coding Standards.) -bindir='${exec_prefix}/bin' -sbindir='${exec_prefix}/sbin' -libexecdir='${exec_prefix}/libexec' -datarootdir='${prefix}/share' -datadir='${datarootdir}' -sysconfdir='${prefix}/etc' -sharedstatedir='${prefix}/com' -localstatedir='${prefix}/var' -includedir='${prefix}/include' -oldincludedir='/usr/include' -docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' -infodir='${datarootdir}/info' -htmldir='${docdir}' -dvidir='${docdir}' -pdfdir='${docdir}' -psdir='${docdir}' -libdir='${exec_prefix}/lib' -localedir='${datarootdir}/locale' -mandir='${datarootdir}/man' - -ac_prev= -ac_dashdash= -for ac_option -do - # If the previous option needs an argument, assign it. - if test -n "$ac_prev"; then - eval $ac_prev=\$ac_option - ac_prev= - continue - fi - - case $ac_option in - *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; - *=) ac_optarg= ;; - *) ac_optarg=yes ;; - esac - - # Accept the important Cygnus configure options, so we can diagnose typos. - - case $ac_dashdash$ac_option in - --) - ac_dashdash=yes ;; - - -bindir | --bindir | --bindi | --bind | --bin | --bi) - ac_prev=bindir ;; - -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) - bindir=$ac_optarg ;; - - -build | --build | --buil | --bui | --bu) - ac_prev=build_alias ;; - -build=* | --build=* | --buil=* | --bui=* | --bu=*) - build_alias=$ac_optarg ;; - - -cache-file | --cache-file | --cache-fil | --cache-fi \ - | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) - ac_prev=cache_file ;; - -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ - | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) - cache_file=$ac_optarg ;; - - --config-cache | -C) - cache_file=config.cache ;; - - -datadir | --datadir | --datadi | --datad) - ac_prev=datadir ;; - -datadir=* | --datadir=* | --datadi=* | --datad=*) - datadir=$ac_optarg ;; - - -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ - | --dataroo | --dataro | --datar) - ac_prev=datarootdir ;; - -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ - | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) - datarootdir=$ac_optarg ;; - - -disable-* | --disable-*) - ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=no ;; - - -docdir | --docdir | --docdi | --doc | --do) - ac_prev=docdir ;; - -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) - docdir=$ac_optarg ;; - - -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) - ac_prev=dvidir ;; - -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) - dvidir=$ac_optarg ;; - - -enable-* | --enable-*) - ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid feature name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"enable_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval enable_$ac_useropt=\$ac_optarg ;; - - -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ - | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ - | --exec | --exe | --ex) - ac_prev=exec_prefix ;; - -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ - | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ - | --exec=* | --exe=* | --ex=*) - exec_prefix=$ac_optarg ;; - - -gas | --gas | --ga | --g) - # Obsolete; use --with-gas. - with_gas=yes ;; - - -help | --help | --hel | --he | -h) - ac_init_help=long ;; - -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) - ac_init_help=recursive ;; - -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) - ac_init_help=short ;; - - -host | --host | --hos | --ho) - ac_prev=host_alias ;; - -host=* | --host=* | --hos=* | --ho=*) - host_alias=$ac_optarg ;; - - -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) - ac_prev=htmldir ;; - -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ - | --ht=*) - htmldir=$ac_optarg ;; - - -includedir | --includedir | --includedi | --included | --include \ - | --includ | --inclu | --incl | --inc) - ac_prev=includedir ;; - -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ - | --includ=* | --inclu=* | --incl=* | --inc=*) - includedir=$ac_optarg ;; - - -infodir | --infodir | --infodi | --infod | --info | --inf) - ac_prev=infodir ;; - -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) - infodir=$ac_optarg ;; - - -libdir | --libdir | --libdi | --libd) - ac_prev=libdir ;; - -libdir=* | --libdir=* | --libdi=* | --libd=*) - libdir=$ac_optarg ;; - - -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ - | --libexe | --libex | --libe) - ac_prev=libexecdir ;; - -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ - | --libexe=* | --libex=* | --libe=*) - libexecdir=$ac_optarg ;; - - -localedir | --localedir | --localedi | --localed | --locale) - ac_prev=localedir ;; - -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) - localedir=$ac_optarg ;; - - -localstatedir | --localstatedir | --localstatedi | --localstated \ - | --localstate | --localstat | --localsta | --localst | --locals) - ac_prev=localstatedir ;; - -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ - | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) - localstatedir=$ac_optarg ;; - - -mandir | --mandir | --mandi | --mand | --man | --ma | --m) - ac_prev=mandir ;; - -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) - mandir=$ac_optarg ;; - - -nfp | --nfp | --nf) - # Obsolete; use --without-fp. - with_fp=no ;; - - -no-create | --no-create | --no-creat | --no-crea | --no-cre \ - | --no-cr | --no-c | -n) - no_create=yes ;; - - -no-recursion | --no-recursion | --no-recursio | --no-recursi \ - | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) - no_recursion=yes ;; - - -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ - | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ - | --oldin | --oldi | --old | --ol | --o) - ac_prev=oldincludedir ;; - -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ - | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ - | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) - oldincludedir=$ac_optarg ;; - - -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) - ac_prev=prefix ;; - -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) - prefix=$ac_optarg ;; - - -program-prefix | --program-prefix | --program-prefi | --program-pref \ - | --program-pre | --program-pr | --program-p) - ac_prev=program_prefix ;; - -program-prefix=* | --program-prefix=* | --program-prefi=* \ - | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) - program_prefix=$ac_optarg ;; - - -program-suffix | --program-suffix | --program-suffi | --program-suff \ - | --program-suf | --program-su | --program-s) - ac_prev=program_suffix ;; - -program-suffix=* | --program-suffix=* | --program-suffi=* \ - | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) - program_suffix=$ac_optarg ;; - - -program-transform-name | --program-transform-name \ - | --program-transform-nam | --program-transform-na \ - | --program-transform-n | --program-transform- \ - | --program-transform | --program-transfor \ - | --program-transfo | --program-transf \ - | --program-trans | --program-tran \ - | --progr-tra | --program-tr | --program-t) - ac_prev=program_transform_name ;; - -program-transform-name=* | --program-transform-name=* \ - | --program-transform-nam=* | --program-transform-na=* \ - | --program-transform-n=* | --program-transform-=* \ - | --program-transform=* | --program-transfor=* \ - | --program-transfo=* | --program-transf=* \ - | --program-trans=* | --program-tran=* \ - | --progr-tra=* | --program-tr=* | --program-t=*) - program_transform_name=$ac_optarg ;; - - -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) - ac_prev=pdfdir ;; - -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) - pdfdir=$ac_optarg ;; - - -psdir | --psdir | --psdi | --psd | --ps) - ac_prev=psdir ;; - -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) - psdir=$ac_optarg ;; - - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - silent=yes ;; - - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) - ac_prev=sbindir ;; - -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ - | --sbi=* | --sb=*) - sbindir=$ac_optarg ;; - - -sharedstatedir | --sharedstatedir | --sharedstatedi \ - | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ - | --sharedst | --shareds | --shared | --share | --shar \ - | --sha | --sh) - ac_prev=sharedstatedir ;; - -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ - | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ - | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ - | --sha=* | --sh=*) - sharedstatedir=$ac_optarg ;; - - -site | --site | --sit) - ac_prev=site ;; - -site=* | --site=* | --sit=*) - site=$ac_optarg ;; - - -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) - ac_prev=srcdir ;; - -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) - srcdir=$ac_optarg ;; - - -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ - | --syscon | --sysco | --sysc | --sys | --sy) - ac_prev=sysconfdir ;; - -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ - | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) - sysconfdir=$ac_optarg ;; - - -target | --target | --targe | --targ | --tar | --ta | --t) - ac_prev=target_alias ;; - -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) - target_alias=$ac_optarg ;; - - -v | -verbose | --verbose | --verbos | --verbo | --verb) - verbose=yes ;; - - -version | --version | --versio | --versi | --vers | -V) - ac_init_version=: ;; - - -with-* | --with-*) - ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=\$ac_optarg ;; - - -without-* | --without-*) - ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` - # Reject names that are not valid shell variable names. - expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && - as_fn_error $? "invalid package name: $ac_useropt" - ac_useropt_orig=$ac_useropt - ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` - case $ac_user_opts in - *" -"with_$ac_useropt" -"*) ;; - *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" - ac_unrecognized_sep=', ';; - esac - eval with_$ac_useropt=no ;; - - --x) - # Obsolete; use --with-x. - with_x=yes ;; - - -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ - | --x-incl | --x-inc | --x-in | --x-i) - ac_prev=x_includes ;; - -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ - | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) - x_includes=$ac_optarg ;; - - -x-libraries | --x-libraries | --x-librarie | --x-librari \ - | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) - ac_prev=x_libraries ;; - -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ - | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) - x_libraries=$ac_optarg ;; - - -*) as_fn_error $? "unrecognized option: \`$ac_option' -Try \`$0 --help' for more information" - ;; - - *=*) - ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` - # Reject names that are not valid shell variable names. - case $ac_envvar in #( - '' | [0-9]* | *[!_$as_cr_alnum]* ) - as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; - esac - eval $ac_envvar=\$ac_optarg - export $ac_envvar ;; - - *) - # FIXME: should be removed in autoconf 3.0. - $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 - expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && - $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 - : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" - ;; - - esac -done - -if test -n "$ac_prev"; then - ac_option=--`echo $ac_prev | sed 's/_/-/g'` - as_fn_error $? "missing argument to $ac_option" -fi - -if test -n "$ac_unrecognized_opts"; then - case $enable_option_checking in - no) ;; - fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; - *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; - esac -fi - -# Check all directory arguments for consistency. -for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ - datadir sysconfdir sharedstatedir localstatedir includedir \ - oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir -do - eval ac_val=\$$ac_var - # Remove trailing slashes. - case $ac_val in - */ ) - ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` - eval $ac_var=\$ac_val;; - esac - # Be sure to have absolute directory names. - case $ac_val in - [\\/$]* | ?:[\\/]* ) continue;; - NONE | '' ) case $ac_var in *prefix ) continue;; esac;; - esac - as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" -done - -# There might be people who depend on the old broken behavior: `$host' -# used to hold the argument of --host etc. -# FIXME: To remove some day. -build=$build_alias -host=$host_alias -target=$target_alias - -# FIXME: To remove some day. -if test "x$host_alias" != x; then - if test "x$build_alias" = x; then - cross_compiling=maybe - $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. - If a cross compiler is detected then cross compile mode will be used" >&2 - elif test "x$build_alias" != "x$host_alias"; then - cross_compiling=yes - fi -fi - -ac_tool_prefix= -test -n "$host_alias" && ac_tool_prefix=$host_alias- - -test "$silent" = yes && exec 6>/dev/null - - -ac_pwd=`pwd` && test -n "$ac_pwd" && -ac_ls_di=`ls -di .` && -ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || - as_fn_error $? "working directory cannot be determined" -test "X$ac_ls_di" = "X$ac_pwd_ls_di" || - as_fn_error $? "pwd does not report name of working directory" - - -# Find the source files, if location was not specified. -if test -z "$srcdir"; then - ac_srcdir_defaulted=yes - # Try the directory containing this script, then the parent directory. - ac_confdir=`$as_dirname -- "$as_myself" || -$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_myself" : 'X\(//\)[^/]' \| \ - X"$as_myself" : 'X\(//\)$' \| \ - X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_myself" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - srcdir=$ac_confdir - if test ! -r "$srcdir/$ac_unique_file"; then - srcdir=.. - fi -else - ac_srcdir_defaulted=no -fi -if test ! -r "$srcdir/$ac_unique_file"; then - test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." - as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" -fi -ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" -ac_abs_confdir=`( - cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" - pwd)` -# When building in place, set srcdir=. -if test "$ac_abs_confdir" = "$ac_pwd"; then - srcdir=. -fi -# Remove unnecessary trailing slashes from srcdir. -# Double slashes in file names in object file debugging info -# mess up M-x gdb in Emacs. -case $srcdir in -*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; -esac -for ac_var in $ac_precious_vars; do - eval ac_env_${ac_var}_set=\${${ac_var}+set} - eval ac_env_${ac_var}_value=\$${ac_var} - eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} - eval ac_cv_env_${ac_var}_value=\$${ac_var} -done - -# -# Report the --help message. -# -if test "$ac_init_help" = "long"; then - # Omit some internal or obsolete options to make the list less imposing. - # This message is too long to be a string in the A/UX 3.1 sh. - cat <<_ACEOF -\`configure' configures expat 2.1.0 to adapt to many kinds of systems. - -Usage: $0 [OPTION]... [VAR=VALUE]... - -To assign environment variables (e.g., CC, CFLAGS...), specify them as -VAR=VALUE. See below for descriptions of some of the useful variables. - -Defaults for the options are specified in brackets. - -Configuration: - -h, --help display this help and exit - --help=short display options specific to this package - --help=recursive display the short help of all the included packages - -V, --version display version information and exit - -q, --quiet, --silent do not print \`checking ...' messages - --cache-file=FILE cache test results in FILE [disabled] - -C, --config-cache alias for \`--cache-file=config.cache' - -n, --no-create do not create output files - --srcdir=DIR find the sources in DIR [configure dir or \`..'] - -Installation directories: - --prefix=PREFIX install architecture-independent files in PREFIX - [$ac_default_prefix] - --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX - [PREFIX] - -By default, \`make install' will install all the files in -\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify -an installation prefix other than \`$ac_default_prefix' using \`--prefix', -for instance \`--prefix=\$HOME'. - -For better control, use the options below. - -Fine tuning of the installation directories: - --bindir=DIR user executables [EPREFIX/bin] - --sbindir=DIR system admin executables [EPREFIX/sbin] - --libexecdir=DIR program executables [EPREFIX/libexec] - --sysconfdir=DIR read-only single-machine data [PREFIX/etc] - --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] - --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --libdir=DIR object code libraries [EPREFIX/lib] - --includedir=DIR C header files [PREFIX/include] - --oldincludedir=DIR C header files for non-gcc [/usr/include] - --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] - --datadir=DIR read-only architecture-independent data [DATAROOTDIR] - --infodir=DIR info documentation [DATAROOTDIR/info] - --localedir=DIR locale-dependent data [DATAROOTDIR/locale] - --mandir=DIR man documentation [DATAROOTDIR/man] - --docdir=DIR documentation root [DATAROOTDIR/doc/expat] - --htmldir=DIR html documentation [DOCDIR] - --dvidir=DIR dvi documentation [DOCDIR] - --pdfdir=DIR pdf documentation [DOCDIR] - --psdir=DIR ps documentation [DOCDIR] -_ACEOF - - cat <<\_ACEOF - -System types: - --build=BUILD configure for building on BUILD [guessed] - --host=HOST cross-compile to build programs to run on HOST [BUILD] -_ACEOF -fi - -if test -n "$ac_init_help"; then - case $ac_init_help in - short | recursive ) echo "Configuration of expat 2.1.0:";; - esac - cat <<\_ACEOF - -Optional Features: - --disable-option-checking ignore unrecognized --enable/--with options - --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) - --enable-FEATURE[=ARG] include FEATURE [ARG=yes] - --enable-shared[=PKGS] build shared libraries [default=yes] - --enable-static[=PKGS] build static libraries [default=yes] - --enable-fast-install[=PKGS] - optimize for fast installation [default=yes] - --disable-libtool-lock avoid locking (might break parallel builds) - -Optional Packages: - --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] - --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) - --with-pic try to use only PIC/non-PIC objects [default=use - both] - --with-gnu-ld assume the C compiler uses GNU ld [default=no] - --with-sysroot=DIR Search for dependent libraries within DIR - (or the compiler's sysroot if not specified). - -Some influential environment variables: - CC C compiler command - CFLAGS C compiler flags - LDFLAGS linker flags, e.g. -L if you have libraries in a - nonstandard directory - LIBS libraries to pass to the linker, e.g. -l - CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if - you have headers in a nonstandard directory - CPP C preprocessor - CXX C++ compiler command - CXXFLAGS C++ compiler flags - CXXCPP C++ preprocessor - -Use these variables to override the choices made by `configure' or to help -it to find libraries and programs with nonstandard names/locations. - -Report bugs to . -_ACEOF -ac_status=$? -fi - -if test "$ac_init_help" = "recursive"; then - # If there are subdirs, report their specific --help. - for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue - test -d "$ac_dir" || - { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || - continue - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - cd "$ac_dir" || { ac_status=$?; continue; } - # Check for guested configure. - if test -f "$ac_srcdir/configure.gnu"; then - echo && - $SHELL "$ac_srcdir/configure.gnu" --help=recursive - elif test -f "$ac_srcdir/configure"; then - echo && - $SHELL "$ac_srcdir/configure" --help=recursive - else - $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 - fi || ac_status=$? - cd "$ac_pwd" || { ac_status=$?; break; } - done -fi - -test -n "$ac_init_help" && exit $ac_status -if $ac_init_version; then - cat <<\_ACEOF -expat configure 2.1.0 -generated by GNU Autoconf 2.68 - -Copyright (C) 2010 Free Software Foundation, Inc. -This configure script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it. -_ACEOF - exit -fi - -## ------------------------ ## -## Autoconf initialization. ## -## ------------------------ ## - -# ac_fn_c_try_compile LINENO -# -------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_compile - -# ac_fn_c_try_link LINENO -# ----------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_link - -# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists and can be compiled using the include files in -# INCLUDES, setting the cache variable VAR accordingly. -ac_fn_c_check_header_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_compile - -# ac_fn_c_try_cpp LINENO -# ---------------------- -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_c_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_cpp - -# ac_fn_c_try_run LINENO -# ---------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes -# that executables *can* be run. -ac_fn_c_try_run () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then : - ac_retval=0 -else - $as_echo "$as_me: program exited with status $ac_status" >&5 - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=$ac_status -fi - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_c_try_run - -# ac_fn_c_check_func LINENO FUNC VAR -# ---------------------------------- -# Tests whether FUNC exists, setting the cache variable VAR accordingly -ac_fn_c_check_func () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Define $2 to an innocuous variant, in case declares $2. - For example, HP-UX 11i declares gettimeofday. */ -#define $2 innocuous_$2 - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $2 (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $2 - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char $2 (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined __stub_$2 || defined __stub___$2 -choke me -#endif - -int -main () -{ -return $2 (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - eval "$3=yes" -else - eval "$3=no" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_func - -# ac_fn_cxx_try_compile LINENO -# ---------------------------- -# Try to compile conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_compile () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext - if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_compile - -# ac_fn_cxx_try_cpp LINENO -# ------------------------ -# Try to preprocess conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_cpp () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if { { ac_try="$ac_cpp conftest.$ac_ext" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } > conftest.i && { - test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" || - test ! -s conftest.err - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_cpp - -# ac_fn_cxx_try_link LINENO -# ------------------------- -# Try to link conftest.$ac_ext, and return whether this succeeded. -ac_fn_cxx_try_link () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - rm -f conftest.$ac_objext conftest$ac_exeext - if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - grep -v '^ *+' conftest.err >conftest.er1 - cat conftest.er1 >&5 - mv -f conftest.er1 conftest.err - fi - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && { - test -z "$ac_cxx_werror_flag" || - test ! -s conftest.err - } && test -s conftest$ac_exeext && { - test "$cross_compiling" = yes || - $as_test_x conftest$ac_exeext - }; then : - ac_retval=0 -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_retval=1 -fi - # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information - # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would - # interfere with the next link command; also delete a directory that is - # left behind by Apple's compiler. We do this before executing the actions. - rm -rf conftest.dSYM conftest_ipa8_conftest.oo - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - as_fn_set_status $ac_retval - -} # ac_fn_cxx_try_link - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_type - -# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES -# ------------------------------------------------------- -# Tests whether HEADER exists, giving a warning if it cannot be compiled using -# the include files in INCLUDES and setting the cache variable VAR -# accordingly. -ac_fn_c_check_header_mongrel () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - if eval \${$3+:} false; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -else - # Is the header compilable? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 -$as_echo_n "checking $2 usability... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -#include <$2> -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_header_compiler=yes -else - ac_header_compiler=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 -$as_echo "$ac_header_compiler" >&6; } - -# Is the header present? -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 -$as_echo_n "checking $2 presence... " >&6; } -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include <$2> -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - ac_header_preproc=yes -else - ac_header_preproc=no -fi -rm -f conftest.err conftest.i conftest.$ac_ext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 -$as_echo "$ac_header_preproc" >&6; } - -# So? What about this header? -case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( - yes:no: ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 -$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} - ;; - no:yes:* ) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 -$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 -$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 -$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 -$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 -$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} -( $as_echo "## -------------------------------------- ## -## Report this to expat-bugs@libexpat.org ## -## -------------------------------------- ##" - ) | sed "s/^/$as_me: WARNING: /" >&2 - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if eval \${$3+:} false; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=\$ac_header_compiler" -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } -fi - eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno - -} # ac_fn_c_check_header_mongrel -cat >config.log <<_ACEOF -This file contains any messages produced by compilers while -running configure, to aid debugging if configure makes a mistake. - -It was created by expat $as_me 2.1.0, which was -generated by GNU Autoconf 2.68. Invocation command line was - - $ $0 $@ - -_ACEOF -exec 5>>config.log -{ -cat <<_ASUNAME -## --------- ## -## Platform. ## -## --------- ## - -hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` - -/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` -/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` -/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` -/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` - -_ASUNAME - -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - $as_echo "PATH: $as_dir" - done -IFS=$as_save_IFS - -} >&5 - -cat >&5 <<_ACEOF - - -## ----------- ## -## Core tests. ## -## ----------- ## - -_ACEOF - - -# Keep a trace of the command line. -# Strip out --no-create and --no-recursion so they do not pile up. -# Strip out --silent because we don't want to record it for future runs. -# Also quote any args containing shell meta-characters. -# Make two passes to allow for proper duplicate-argument suppression. -ac_configure_args= -ac_configure_args0= -ac_configure_args1= -ac_must_keep_next=false -for ac_pass in 1 2 -do - for ac_arg - do - case $ac_arg in - -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil) - continue ;; - *\'*) - ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - case $ac_pass in - 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; - 2) - as_fn_append ac_configure_args1 " '$ac_arg'" - if test $ac_must_keep_next = true; then - ac_must_keep_next=false # Got value, back to normal. - else - case $ac_arg in - *=* | --config-cache | -C | -disable-* | --disable-* \ - | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ - | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ - | -with-* | --with-* | -without-* | --without-* | --x) - case "$ac_configure_args0 " in - "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; - esac - ;; - -* ) ac_must_keep_next=true ;; - esac - fi - as_fn_append ac_configure_args " '$ac_arg'" - ;; - esac - done -done -{ ac_configure_args0=; unset ac_configure_args0;} -{ ac_configure_args1=; unset ac_configure_args1;} - -# When interrupted or exit'd, cleanup temporary files, and complete -# config.log. We remove comments because anyway the quotes in there -# would cause problems or look ugly. -# WARNING: Use '\'' to represent an apostrophe within the trap. -# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. -trap 'exit_status=$? - # Save into config.log some information that might help in debugging. - { - echo - - $as_echo "## ---------------- ## -## Cache variables. ## -## ---------------- ##" - echo - # The following way of writing the cache mishandles newlines in values, -( - for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - (set) 2>&1 | - case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - sed -n \ - "s/'\''/'\''\\\\'\'''\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" - ;; #( - *) - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) - echo - - $as_echo "## ----------------- ## -## Output variables. ## -## ----------------- ##" - echo - for ac_var in $ac_subst_vars - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - - if test -n "$ac_subst_files"; then - $as_echo "## ------------------- ## -## File substitutions. ## -## ------------------- ##" - echo - for ac_var in $ac_subst_files - do - eval ac_val=\$$ac_var - case $ac_val in - *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; - esac - $as_echo "$ac_var='\''$ac_val'\''" - done | sort - echo - fi - - if test -s confdefs.h; then - $as_echo "## ----------- ## -## confdefs.h. ## -## ----------- ##" - echo - cat confdefs.h - echo - fi - test "$ac_signal" != 0 && - $as_echo "$as_me: caught signal $ac_signal" - $as_echo "$as_me: exit $exit_status" - } >&5 - rm -f core *.core core.conftest.* && - rm -f -r conftest* confdefs* conf$$* $ac_clean_files && - exit $exit_status -' 0 -for ac_signal in 1 2 13 15; do - trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal -done -ac_signal=0 - -# confdefs.h avoids OS command line length limits that DEFS can exceed. -rm -f -r conftest* confdefs.h - -$as_echo "/* confdefs.h */" > confdefs.h - -# Predefined preprocessor variables. - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_NAME "$PACKAGE_NAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_TARNAME "$PACKAGE_TARNAME" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_VERSION "$PACKAGE_VERSION" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_STRING "$PACKAGE_STRING" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" -_ACEOF - -cat >>confdefs.h <<_ACEOF -#define PACKAGE_URL "$PACKAGE_URL" -_ACEOF - - -# Let the site file select an alternate cache file if it wants to. -# Prefer an explicitly selected file to automatically selected ones. -ac_site_file1=NONE -ac_site_file2=NONE -if test -n "$CONFIG_SITE"; then - # We do not want a PATH search for config.site. - case $CONFIG_SITE in #(( - -*) ac_site_file1=./$CONFIG_SITE;; - */*) ac_site_file1=$CONFIG_SITE;; - *) ac_site_file1=./$CONFIG_SITE;; - esac -elif test "x$prefix" != xNONE; then - ac_site_file1=$prefix/share/config.site - ac_site_file2=$prefix/etc/config.site -else - ac_site_file1=$ac_default_prefix/share/config.site - ac_site_file2=$ac_default_prefix/etc/config.site -fi -for ac_site_file in "$ac_site_file1" "$ac_site_file2" -do - test "x$ac_site_file" = xNONE && continue - if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 -$as_echo "$as_me: loading site script $ac_site_file" >&6;} - sed 's/^/| /' "$ac_site_file" >&5 - . "$ac_site_file" \ - || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "failed to load site script $ac_site_file -See \`config.log' for more details" "$LINENO" 5; } - fi -done - -if test -r "$cache_file"; then - # Some versions of bash will fail to source /dev/null (special files - # actually), so we avoid doing that. DJGPP emulates it as a regular file. - if test /dev/null != "$cache_file" && test -f "$cache_file"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 -$as_echo "$as_me: loading cache $cache_file" >&6;} - case $cache_file in - [\\/]* | ?:[\\/]* ) . "$cache_file";; - *) . "./$cache_file";; - esac - fi -else - { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 -$as_echo "$as_me: creating cache $cache_file" >&6;} - >$cache_file -fi - -as_fn_append ac_header_list " stdlib.h" -as_fn_append ac_header_list " unistd.h" -as_fn_append ac_header_list " sys/param.h" -# Check that the precious variables saved in the cache have kept the same -# value. -ac_cache_corrupted=false -for ac_var in $ac_precious_vars; do - eval ac_old_set=\$ac_cv_env_${ac_var}_set - eval ac_new_set=\$ac_env_${ac_var}_set - eval ac_old_val=\$ac_cv_env_${ac_var}_value - eval ac_new_val=\$ac_env_${ac_var}_value - case $ac_old_set,$ac_new_set in - set,) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,set) - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 -$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} - ac_cache_corrupted=: ;; - ,);; - *) - if test "x$ac_old_val" != "x$ac_new_val"; then - # differences in whitespace do not lead to failure. - ac_old_val_w=`echo x $ac_old_val` - ac_new_val_w=`echo x $ac_new_val` - if test "$ac_old_val_w" != "$ac_new_val_w"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 -$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - ac_cache_corrupted=: - else - { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 -$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} - eval $ac_var=\$ac_old_val - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 -$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 -$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} - fi;; - esac - # Pass precious variables to config.status. - if test "$ac_new_set" = set; then - case $ac_new_val in - *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; - *) ac_arg=$ac_var=$ac_new_val ;; - esac - case " $ac_configure_args " in - *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. - *) as_fn_append ac_configure_args " '$ac_arg'" ;; - esac - fi -done -if $ac_cache_corrupted; then - { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} - { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 -$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} - as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 -fi -## -------------------- ## -## Main body of script. ## -## -------------------- ## - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - - - -ac_aux_dir= -for ac_dir in conftools "$srcdir"/conftools; do - if test -f "$ac_dir/install-sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install-sh -c" - break - elif test -f "$ac_dir/install.sh"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/install.sh -c" - break - elif test -f "$ac_dir/shtool"; then - ac_aux_dir=$ac_dir - ac_install_sh="$ac_aux_dir/shtool install -c" - break - fi -done -if test -z "$ac_aux_dir"; then - as_fn_error $? "cannot find install-sh, install.sh, or shtool in conftools \"$srcdir\"/conftools" "$LINENO" 5 -fi - -# These three variables are undocumented and unsupported, -# and are intended to be withdrawn in a future Autoconf release. -# They can cause serious problems if a builder's source tree is in a directory -# whose full name contains unusual characters. -ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. -ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. -ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. - - - - - - -LIBCURRENT=7 -LIBREVISION=0 -LIBAGE=6 - -ac_config_headers="$ac_config_headers expat_config.h" - - - - - -# Make sure we can run config.sub. -$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || - as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 -$as_echo_n "checking build system type... " >&6; } -if ${ac_cv_build+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_build_alias=$build_alias -test "x$ac_build_alias" = x && - ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` -test "x$ac_build_alias" = x && - as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 -ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 -$as_echo "$ac_cv_build" >&6; } -case $ac_cv_build in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; -esac -build=$ac_cv_build -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_build -shift -build_cpu=$1 -build_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -build_os=$* -IFS=$ac_save_IFS -case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 -$as_echo_n "checking host system type... " >&6; } -if ${ac_cv_host+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "x$host_alias" = x; then - ac_cv_host=$ac_cv_build -else - ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || - as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 -$as_echo "$ac_cv_host" >&6; } -case $ac_cv_host in -*-*-*) ;; -*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; -esac -host=$ac_cv_host -ac_save_IFS=$IFS; IFS='-' -set x $ac_cv_host -shift -host_cpu=$1 -host_vendor=$2 -shift; shift -# Remember, the first character of IFS is used to create $*, -# except with old shells: -host_os=$* -IFS=$ac_save_IFS -case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac - - -enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args. -set dummy ${ac_tool_prefix}as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AS"; then - ac_cv_prog_AS="$AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AS="${ac_tool_prefix}as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AS=$ac_cv_prog_AS -if test -n "$AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5 -$as_echo "$AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_AS"; then - ac_ct_AS=$AS - # Extract the first word of "as", so it can be a program name with args. -set dummy as; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AS+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AS"; then - ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AS="as" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AS=$ac_cv_prog_ac_ct_AS -if test -n "$ac_ct_AS"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5 -$as_echo "$ac_ct_AS" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_AS" = x; then - AS="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AS=$ac_ct_AS - fi -else - AS="$ac_cv_prog_AS" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - - ;; -esac - -test -z "$AS" && AS=as - - - - - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - - -case `pwd` in - *\ * | *\ *) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 -$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; -esac - - - -macro_version='2.4' -macro_revision='1.3293' - - - - - - - - - - - - - -ltmain="$ac_aux_dir/ltmain.sh" - -# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\(["`$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' - -ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 -$as_echo_n "checking how to print strings... " >&6; } -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "" -} - -case "$ECHO" in - printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 -$as_echo "printf" >&6; } ;; - print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 -$as_echo "print -r" >&6; } ;; - *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 -$as_echo "cat" >&6; } ;; -esac - - - - - - - - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" -# Try to create an executable without -o first, disregard a.out. -# It will help us diagnose broken compilers, and finding out an intuition -# of exeext. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 -$as_echo_n "checking whether the C compiler works... " >&6; } -ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` - -# The possible output files: -ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" - -ac_rmfiles= -for ac_file in $ac_files -do - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - * ) ac_rmfiles="$ac_rmfiles $ac_file";; - esac -done -rm -f $ac_rmfiles - -if { { ac_try="$ac_link_default" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link_default") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. -# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' -# in a Makefile. We should not override ac_cv_exeext if it was cached, -# so that the user can short-circuit this test for compilers unknown to -# Autoconf. -for ac_file in $ac_files '' -do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) - ;; - [ab].out ) - # We found the default executable, but exeext='' is most - # certainly right. - break;; - *.* ) - if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; - then :; else - ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - fi - # We set ac_cv_exeext here because the later test for it is not - # safe: cross compilers may not add the suffix if given an `-o' - # argument, so we may need to know it at that point already. - # Even if this section looks crufty: it has the advantage of - # actually working. - break;; - * ) - break;; - esac -done -test "$ac_cv_exeext" = no && ac_cv_exeext= - -else - ac_file='' -fi -if test -z "$ac_file"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -$as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error 77 "C compiler cannot create executables -See \`config.log' for more details" "$LINENO" 5; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 -$as_echo_n "checking for C compiler default output file name... " >&6; } -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 -$as_echo "$ac_file" >&6; } -ac_exeext=$ac_cv_exeext - -rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 -$as_echo_n "checking for suffix of executables... " >&6; } -if { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - # If both `conftest.exe' and `conftest' are `present' (well, observable) -# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will -# work properly (i.e., refer to `conftest.exe'), while it won't with -# `rm'. -for ac_file in conftest.exe conftest conftest.*; do - test -f "$ac_file" || continue - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; - *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` - break;; - * ) break;; - esac -done -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of executables: cannot compile and link -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest conftest$ac_cv_exeext -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 -$as_echo "$ac_cv_exeext" >&6; } - -rm -f conftest.$ac_ext -EXEEXT=$ac_cv_exeext -ac_exeext=$EXEEXT -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -FILE *f = fopen ("conftest.out", "w"); - return ferror (f) || fclose (f) != 0; - - ; - return 0; -} -_ACEOF -ac_clean_files="$ac_clean_files conftest.out" -# Check that the compiler produces executables we can run. If not, either -# the compiler is broken, or we cross compile. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 -$as_echo_n "checking whether we are cross compiling... " >&6; } -if test "$cross_compiling" != yes; then - { { ac_try="$ac_link" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_link") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if { ac_try='./conftest$ac_cv_exeext' - { { case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_try") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; }; then - cross_compiling=no - else - if test "$cross_compiling" = maybe; then - cross_compiling=yes - else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot run C compiled programs. -If you meant to cross compile, use \`--host'. -See \`config.log' for more details" "$LINENO" 5; } - fi - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 -$as_echo "$cross_compiling" >&6; } - -rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out -ac_clean_files=$ac_clean_files_save -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 -$as_echo_n "checking for suffix of object files... " >&6; } -if ${ac_cv_objext+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -rm -f conftest.o conftest.obj -if { { ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compile") 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then : - for ac_file in conftest.o conftest.obj conftest.*; do - test -f "$ac_file" || continue; - case $ac_file in - *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; - *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` - break;; - esac -done -else - $as_echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "cannot compute suffix of object files: cannot compile -See \`config.log' for more details" "$LINENO" 5; } -fi -rm -f conftest.$ac_cv_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 -$as_echo "$ac_cv_objext" >&6; } -OBJEXT=$ac_cv_objext -ac_objext=$OBJEXT -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 -$as_echo_n "checking for a sed that does not truncate output... " >&6; } -if ${ac_cv_path_SED+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ - for ac_i in 1 2 3 4 5 6 7; do - ac_script="$ac_script$as_nl$ac_script" - done - echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed - { ac_script=; unset ac_script;} - if test -z "$SED"; then - ac_path_SED_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue -# Check for GNU ac_path_SED and select it if it is found. - # Check for GNU $ac_path_SED -case `"$ac_path_SED" --version 2>&1` in -*GNU*) - ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo '' >> "conftest.nl" - "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_SED_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_SED="$ac_path_SED" - ac_path_SED_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_SED_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_SED"; then - as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 - fi -else - ac_cv_path_SED=$SED -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 -$as_echo "$ac_cv_path_SED" >&6; } - SED="$ac_cv_path_SED" - rm -f conftest.sed - -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 -$as_echo_n "checking for grep that handles long lines and -e... " >&6; } -if ${ac_cv_path_GREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$GREP"; then - ac_path_GREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in grep ggrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue -# Check for GNU ac_path_GREP and select it if it is found. - # Check for GNU $ac_path_GREP -case `"$ac_path_GREP" --version 2>&1` in -*GNU*) - ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'GREP' >> "conftest.nl" - "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_GREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_GREP="$ac_path_GREP" - ac_path_GREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_GREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_GREP"; then - as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_GREP=$GREP -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 -$as_echo "$ac_cv_path_GREP" >&6; } - GREP="$ac_cv_path_GREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 -$as_echo_n "checking for egrep... " >&6; } -if ${ac_cv_path_EGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 - then ac_cv_path_EGREP="$GREP -E" - else - if test -z "$EGREP"; then - ac_path_EGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in egrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue -# Check for GNU ac_path_EGREP and select it if it is found. - # Check for GNU $ac_path_EGREP -case `"$ac_path_EGREP" --version 2>&1` in -*GNU*) - ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'EGREP' >> "conftest.nl" - "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_EGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_EGREP="$ac_path_EGREP" - ac_path_EGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_EGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_EGREP"; then - as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_EGREP=$EGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 -$as_echo "$ac_cv_path_EGREP" >&6; } - EGREP="$ac_cv_path_EGREP" - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 -$as_echo_n "checking for fgrep... " >&6; } -if ${ac_cv_path_FGREP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 - then ac_cv_path_FGREP="$GREP -F" - else - if test -z "$FGREP"; then - ac_path_FGREP_found=false - # Loop through the user's path and test for each of PROGNAME-LIST - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_prog in fgrep; do - for ac_exec_ext in '' $ac_executable_extensions; do - ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" - { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue -# Check for GNU ac_path_FGREP and select it if it is found. - # Check for GNU $ac_path_FGREP -case `"$ac_path_FGREP" --version 2>&1` in -*GNU*) - ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; -*) - ac_count=0 - $as_echo_n 0123456789 >"conftest.in" - while : - do - cat "conftest.in" "conftest.in" >"conftest.tmp" - mv "conftest.tmp" "conftest.in" - cp "conftest.in" "conftest.nl" - $as_echo 'FGREP' >> "conftest.nl" - "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break - diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break - as_fn_arith $ac_count + 1 && ac_count=$as_val - if test $ac_count -gt ${ac_path_FGREP_max-0}; then - # Best one so far, save it but keep looking for a better one - ac_cv_path_FGREP="$ac_path_FGREP" - ac_path_FGREP_max=$ac_count - fi - # 10*(2^10) chars as input seems more than enough - test $ac_count -gt 10 && break - done - rm -f conftest.in conftest.tmp conftest.nl conftest.out;; -esac - - $ac_path_FGREP_found && break 3 - done - done - done -IFS=$as_save_IFS - if test -z "$ac_cv_path_FGREP"; then - as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 - fi -else - ac_cv_path_FGREP=$FGREP -fi - - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 -$as_echo "$ac_cv_path_FGREP" >&6; } - FGREP="$ac_cv_path_FGREP" - - -test -z "$GREP" && GREP=grep - - - - - - - - - - - - - - - - - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 -$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } -if ${lt_cv_path_NM+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 -$as_echo "$lt_cv_path_NM" >&6; } -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - if test -n "$ac_tool_prefix"; then - for ac_prog in dumpbin "link -dump" - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DUMPBIN"; then - ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DUMPBIN=$ac_cv_prog_DUMPBIN -if test -n "$DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 -$as_echo "$DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$DUMPBIN" && break - done -fi -if test -z "$DUMPBIN"; then - ac_ct_DUMPBIN=$DUMPBIN - for ac_prog in dumpbin "link -dump" -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DUMPBIN"; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN -if test -n "$ac_ct_DUMPBIN"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 -$as_echo "$ac_ct_DUMPBIN" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_DUMPBIN" && break -done - - if test "x$ac_ct_DUMPBIN" = x; then - DUMPBIN=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DUMPBIN=$ac_ct_DUMPBIN - fi -fi - - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 -$as_echo_n "checking the name lister ($NM) interface... " >&6; } -if ${lt_cv_nm_interface+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&5 - (eval echo "\"\$as_me:$LINENO: output\"" >&5) - cat conftest.out >&5 - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 -$as_echo "$lt_cv_nm_interface" >&6; } - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 -$as_echo_n "checking whether ln -s works... " >&6; } -LN_S=$as_ln_s -if test "$LN_S" = "ln -s"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 -$as_echo "no, using $LN_S" >&6; } -fi - -# find the maximum length of command line arguments -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 -$as_echo_n "checking the maximum length of command line arguments... " >&6; } -if ${lt_cv_sys_max_cmd_len+:} false; then : - $as_echo_n "(cached) " >&6 -else - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac - -fi - -if test -n $lt_cv_sys_max_cmd_len ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 -$as_echo "$lt_cv_sys_max_cmd_len" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 -$as_echo "none" >&6; } -fi -max_cmd_len=$lt_cv_sys_max_cmd_len - - - - - - -: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 -$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 -$as_echo "$xsi_shell" >&6; } - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 -$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } -lt_shell_append=no -( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 -$as_echo "$lt_shell_append" >&6; } - - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi - - - - - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 -$as_echo_n "checking how to convert $build file names to $host format... " >&6; } -if ${lt_cv_to_host_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac - -fi - -to_host_file_cmd=$lt_cv_to_host_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 -$as_echo "$lt_cv_to_host_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 -$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } -if ${lt_cv_to_tool_file_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - #assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac - -fi - -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 -$as_echo "$lt_cv_to_tool_file_cmd" >&6; } - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 -$as_echo_n "checking for $LD option to reload object files... " >&6; } -if ${lt_cv_ld_reload_flag+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_reload_flag='-r' -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 -$as_echo "$lt_cv_ld_reload_flag" >&6; } -reload_flag=$lt_cv_ld_reload_flag -case $reload_flag in -"" | " "*) ;; -*) reload_flag=" $reload_flag" ;; -esac -reload_cmds='$LD$reload_flag -o $output$reload_objs' -case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - if test "$GCC" != yes; then - reload_cmds=false - fi - ;; - darwin*) - if test "$GCC" = yes; then - reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' - else - reload_cmds='$LD$reload_flag -o $output$reload_objs' - fi - ;; -esac - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. -set dummy ${ac_tool_prefix}objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OBJDUMP"; then - ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OBJDUMP=$ac_cv_prog_OBJDUMP -if test -n "$OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 -$as_echo "$OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OBJDUMP"; then - ac_ct_OBJDUMP=$OBJDUMP - # Extract the first word of "objdump", so it can be a program name with args. -set dummy objdump; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OBJDUMP"; then - ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OBJDUMP="objdump" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP -if test -n "$ac_ct_OBJDUMP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 -$as_echo "$ac_ct_OBJDUMP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OBJDUMP" = x; then - OBJDUMP="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OBJDUMP=$ac_ct_OBJDUMP - fi -else - OBJDUMP="$ac_cv_prog_OBJDUMP" -fi - -test -z "$OBJDUMP" && OBJDUMP=objdump - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 -$as_echo_n "checking how to recognize dependent libraries... " >&6; } -if ${lt_cv_deplibs_check_method+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_file_magic_cmd='$MAGIC_CMD' -lt_cv_file_magic_test_file= -lt_cv_deplibs_check_method='unknown' -# Need to set the preceding variable on all platforms that support -# interlibrary dependencies. -# 'none' -- dependencies not supported. -# `unknown' -- same as none, but documents that we really don't know. -# 'pass_all' -- all dependencies passed with no checks. -# 'test_compile' -- check by making test program. -# 'file_magic [[regex]]' -- check by looking for files in library path -# which responds to the $file_magic_cmd with a given extended regex. -# If you have `file' or equivalent on your system and you're not sure -# whether `pass_all' will *always* work, you probably want this one. - -case $host_os in -aix[4-9]*) - lt_cv_deplibs_check_method=pass_all - ;; - -beos*) - lt_cv_deplibs_check_method=pass_all - ;; - -bsdi[45]*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' - lt_cv_file_magic_cmd='/usr/bin/file -L' - lt_cv_file_magic_test_file=/shlib/libc.so - ;; - -cygwin*) - # func_win32_libid is a shell function defined in ltmain.sh - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - ;; - -mingw* | pw32*) - # Base MSYS/MinGW do not provide the 'file' command needed by - # func_win32_libid shell function, so use a weaker test based on 'objdump', - # unless we find 'file', for example because we are cross-compiling. - # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. - if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[3-9]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 -$as_echo "$lt_cv_deplibs_check_method" >&6; } - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - - - - - - - - - - - - - - - - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. -set dummy ${ac_tool_prefix}dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DLLTOOL"; then - ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DLLTOOL=$ac_cv_prog_DLLTOOL -if test -n "$DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 -$as_echo "$DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DLLTOOL"; then - ac_ct_DLLTOOL=$DLLTOOL - # Extract the first word of "dlltool", so it can be a program name with args. -set dummy dlltool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DLLTOOL"; then - ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DLLTOOL="dlltool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL -if test -n "$ac_ct_DLLTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 -$as_echo "$ac_ct_DLLTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DLLTOOL" = x; then - DLLTOOL="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DLLTOOL=$ac_ct_DLLTOOL - fi -else - DLLTOOL="$ac_cv_prog_DLLTOOL" -fi - -test -z "$DLLTOOL" && DLLTOOL=dlltool - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 -$as_echo_n "checking how to associate runtime and link libraries... " >&6; } -if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 -$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - - - - - - - - -if test -n "$ac_tool_prefix"; then - for ac_prog in ar - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AR"; then - ac_cv_prog_AR="$AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AR="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AR=$ac_cv_prog_AR -if test -n "$AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 -$as_echo "$AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AR" && break - done -fi -if test -z "$AR"; then - ac_ct_AR=$AR - for ac_prog in ar -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_AR+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_AR"; then - ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_AR="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_AR=$ac_cv_prog_ac_ct_AR -if test -n "$ac_ct_AR"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 -$as_echo "$ac_ct_AR" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_AR" && break -done - - if test "x$ac_ct_AR" = x; then - AR="false" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - AR=$ac_ct_AR - fi -fi - -: ${AR=ar} -: ${AR_FLAGS=cru} - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 -$as_echo_n "checking for archiver @FILE support... " >&6; } -if ${lt_cv_ar_at_file+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ar_at_file=no - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 - (eval $lt_ar_try) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 -$as_echo "$lt_cv_ar_at_file" >&6; } - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi - - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. -set dummy ${ac_tool_prefix}strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$STRIP"; then - ac_cv_prog_STRIP="$STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_STRIP="${ac_tool_prefix}strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -STRIP=$ac_cv_prog_STRIP -if test -n "$STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 -$as_echo "$STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_STRIP"; then - ac_ct_STRIP=$STRIP - # Extract the first word of "strip", so it can be a program name with args. -set dummy strip; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_STRIP+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_STRIP"; then - ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_STRIP="strip" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP -if test -n "$ac_ct_STRIP"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 -$as_echo "$ac_ct_STRIP" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_STRIP" = x; then - STRIP=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - STRIP=$ac_ct_STRIP - fi -else - STRIP="$ac_cv_prog_STRIP" -fi - -test -z "$STRIP" && STRIP=: - - - - - - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. -set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$RANLIB"; then - ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -RANLIB=$ac_cv_prog_RANLIB -if test -n "$RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 -$as_echo "$RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_RANLIB"; then - ac_ct_RANLIB=$RANLIB - # Extract the first word of "ranlib", so it can be a program name with args. -set dummy ranlib; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_RANLIB"; then - ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_RANLIB="ranlib" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB -if test -n "$ac_ct_RANLIB"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 -$as_echo "$ac_ct_RANLIB" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_RANLIB" = x; then - RANLIB=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - RANLIB=$ac_ct_RANLIB - fi -else - RANLIB="$ac_cv_prog_RANLIB" -fi - -test -z "$RANLIB" && RANLIB=: - - - - - - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac - - - - - - - - - - - - - - - - - - - - - -for ac_prog in gawk mawk nawk awk -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_AWK+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$AWK"; then - ac_cv_prog_AWK="$AWK" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_AWK="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -AWK=$ac_cv_prog_AWK -if test -n "$AWK"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 -$as_echo "$AWK" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$AWK" && break -done - - - - - - - - - - - - - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - -# Check for command to grab the raw symbol name followed by C symbol from nm. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 -$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } -if ${lt_cv_sys_global_symbol_pipe+:} false; then : - $as_echo_n "(cached) " >&6 -else - -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[BCDEGRST]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([_A-Za-z][_A-Za-z0-9]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[BCDT]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[ABCDGISTW]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[ABCDEGRST]' - fi - ;; -irix* | nonstopux*) - symcode='[BCDEGRST]' - ;; -osf*) - symcode='[BCDEGQRST]' - ;; -solaris*) - symcode='[BDRT]' - ;; -sco3.2v5*) - symcode='[DT]' - ;; -sysv4.2uw2*) - symcode='[DT]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[ABDT]' - ;; -sysv4) - symcode='[DFNSTU]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[ABCDGIRSTW]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK '"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Now try to grab the symbols. - nlist=conftest.nm - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 - (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&5 - fi - else - echo "cannot find nm_test_var in $nlist" >&5 - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 - fi - else - echo "$progname: failed program was:" >&5 - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done - -fi - -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 -$as_echo "failed" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 -$as_echo "ok" >&6; } -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 -$as_echo_n "checking for sysroot... " >&6; } - -# Check whether --with-sysroot was given. -if test "${with_sysroot+set}" = set; then : - withval=$with_sysroot; -else - with_sysroot=no -fi - - -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 -$as_echo "${with_sysroot}" >&6; } - as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 - ;; -esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 -$as_echo "${lt_sysroot:-no}" >&6; } - - - - - -# Check whether --enable-libtool-lock was given. -if test "${enable_libtool_lock+set}" = set; then : - enableval=$enable_libtool_lock; -fi - -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '#line '$LINENO' "configure"' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 -$as_echo_n "checking whether the C compiler needs -belf... " >&6; } -if ${lt_cv_cc_needs_belf+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_cc_needs_belf=yes -else - lt_cv_cc_needs_belf=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 -$as_echo "$lt_cv_cc_needs_belf" >&6; } - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" - -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. -set dummy ${ac_tool_prefix}mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$MANIFEST_TOOL"; then - ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL -if test -n "$MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 -$as_echo "$MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_MANIFEST_TOOL"; then - ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL - # Extract the first word of "mt", so it can be a program name with args. -set dummy mt; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_MANIFEST_TOOL"; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL -if test -n "$ac_ct_MANIFEST_TOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 -$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_MANIFEST_TOOL" = x; then - MANIFEST_TOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL - fi -else - MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" -fi - -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 -$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } -if ${lt_cv_path_mainfest_tool+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&5 - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest* -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 -$as_echo "$lt_cv_path_mainfest_tool" >&6; } -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi - - - - - - - case $host_os in - rhapsody* | darwin*) - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. -set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$DSYMUTIL"; then - ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -DSYMUTIL=$ac_cv_prog_DSYMUTIL -if test -n "$DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 -$as_echo "$DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_DSYMUTIL"; then - ac_ct_DSYMUTIL=$DSYMUTIL - # Extract the first word of "dsymutil", so it can be a program name with args. -set dummy dsymutil; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_DSYMUTIL"; then - ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL -if test -n "$ac_ct_DSYMUTIL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 -$as_echo "$ac_ct_DSYMUTIL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_DSYMUTIL" = x; then - DSYMUTIL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - DSYMUTIL=$ac_ct_DSYMUTIL - fi -else - DSYMUTIL="$ac_cv_prog_DSYMUTIL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. -set dummy ${ac_tool_prefix}nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$NMEDIT"; then - ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -NMEDIT=$ac_cv_prog_NMEDIT -if test -n "$NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 -$as_echo "$NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_NMEDIT"; then - ac_ct_NMEDIT=$NMEDIT - # Extract the first word of "nmedit", so it can be a program name with args. -set dummy nmedit; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_NMEDIT"; then - ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_NMEDIT="nmedit" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT -if test -n "$ac_ct_NMEDIT"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 -$as_echo "$ac_ct_NMEDIT" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_NMEDIT" = x; then - NMEDIT=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - NMEDIT=$ac_ct_NMEDIT - fi -else - NMEDIT="$ac_cv_prog_NMEDIT" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. -set dummy ${ac_tool_prefix}lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$LIPO"; then - ac_cv_prog_LIPO="$LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_LIPO="${ac_tool_prefix}lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -LIPO=$ac_cv_prog_LIPO -if test -n "$LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 -$as_echo "$LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_LIPO"; then - ac_ct_LIPO=$LIPO - # Extract the first word of "lipo", so it can be a program name with args. -set dummy lipo; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_LIPO+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_LIPO"; then - ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_LIPO="lipo" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO -if test -n "$ac_ct_LIPO"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 -$as_echo "$ac_ct_LIPO" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_LIPO" = x; then - LIPO=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - LIPO=$ac_ct_LIPO - fi -else - LIPO="$ac_cv_prog_LIPO" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL"; then - ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL="${ac_tool_prefix}otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL=$ac_cv_prog_OTOOL -if test -n "$OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 -$as_echo "$OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL"; then - ac_ct_OTOOL=$OTOOL - # Extract the first word of "otool", so it can be a program name with args. -set dummy otool; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL"; then - ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL="otool" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL -if test -n "$ac_ct_OTOOL"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 -$as_echo "$ac_ct_OTOOL" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL" = x; then - OTOOL=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL=$ac_ct_OTOOL - fi -else - OTOOL="$ac_cv_prog_OTOOL" -fi - - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. -set dummy ${ac_tool_prefix}otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$OTOOL64"; then - ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -OTOOL64=$ac_cv_prog_OTOOL64 -if test -n "$OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 -$as_echo "$OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_OTOOL64"; then - ac_ct_OTOOL64=$OTOOL64 - # Extract the first word of "otool64", so it can be a program name with args. -set dummy otool64; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_OTOOL64"; then - ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_OTOOL64="otool64" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 -if test -n "$ac_ct_OTOOL64"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 -$as_echo "$ac_ct_OTOOL64" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_OTOOL64" = x; then - OTOOL64=":" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - OTOOL64=$ac_ct_OTOOL64 - fi -else - OTOOL64="$ac_cv_prog_OTOOL64" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 -$as_echo_n "checking for -single_module linker flag... " >&6; } -if ${lt_cv_apple_cc_single_mod+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&5 - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 -$as_echo "$lt_cv_apple_cc_single_mod" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 -$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } -if ${lt_cv_ld_exported_symbols_list+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_ld_exported_symbols_list=yes -else - lt_cv_ld_exported_symbols_list=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 -$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 -$as_echo_n "checking for -force_load linker flag... " >&6; } -if ${lt_cv_ld_force_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 - echo "$AR cru libconftest.a conftest.o" >&5 - $AR cru libconftest.a conftest.o 2>&5 - echo "$RANLIB libconftest.a" >&5 - $RANLIB libconftest.a 2>&5 - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&5 - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 -$as_echo "$lt_cv_ld_force_load" >&6; } - case $host_os in - rhapsody* | darwin1.[012]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[91]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[012]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 -$as_echo_n "checking how to run the C preprocessor... " >&6; } -# On Suns, sometimes $CPP names a directory. -if test -n "$CPP" && test -d "$CPP"; then - CPP= -fi -if test -z "$CPP"; then - if ${ac_cv_prog_CPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CPP needs to be expanded - for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" - do - ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CPP=$CPP - -fi - CPP=$ac_cv_prog_CPP -else - ac_cv_prog_CPP=$CPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 -$as_echo "$CPP" >&6; } -ac_preproc_ok=false -for ac_c_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_c_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C preprocessor \"$CPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - -# On IRIX 5.3, sys/types and inttypes.h are conflicting. -for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ - inttypes.h stdint.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - -for ac_header in dlfcn.h -do : - ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default -" -if test "x$ac_cv_header_dlfcn_h" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DLFCN_H 1 -_ACEOF - -fi - -done - - - - - -# Set options - - - - enable_dlopen=no - - - - # Check whether --enable-shared was given. -if test "${enable_shared+set}" = set; then : - enableval=$enable_shared; p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_shared=yes -fi - - - - - - - - - - # Check whether --enable-static was given. -if test "${enable_static+set}" = set; then : - enableval=$enable_static; p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_static=yes -fi - - - - - - - - - - -# Check whether --with-pic was given. -if test "${with_pic+set}" = set; then : - withval=$with_pic; pic_mode="$withval" -else - pic_mode=default -fi - - -test -z "$pic_mode" && pic_mode=default - - - - - - - - # Check whether --enable-fast-install was given. -if test "${enable_fast_install+set}" = set; then : - enableval=$enable_fast_install; p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac -else - enable_fast_install=yes -fi - - - - - - - - - - - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' - - - - - - - - - - - - - - - - - - - - - - - - - - -test -z "$LN_S" && LN_S="ln -s" - - - - - - - - - - - - - - -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 -$as_echo_n "checking for objdir... " >&6; } -if ${lt_cv_objdir+:} false; then : - $as_echo_n "(cached) " >&6 -else - rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 -$as_echo "$lt_cv_objdir" >&6; } -objdir=$lt_cv_objdir - - - - - -cat >>confdefs.h <<_ACEOF -#define LT_OBJDIR "$lt_cv_objdir/" -_ACEOF - - - - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 -$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/${ac_tool_prefix}file; then - lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - - - -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 -$as_echo_n "checking for file... " >&6; } -if ${lt_cv_path_MAGIC_CMD+:} false; then : - $as_echo_n "(cached) " >&6 -else - case $MAGIC_CMD in -[\\/*] | ?:[\\/]*) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/file; then - lt_cv_path_MAGIC_CMD="$ac_dir/file" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac -fi - -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 -$as_echo "$MAGIC_CMD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - else - MAGIC_CMD=: - fi -fi - - fi - ;; -esac - -# Use C for the default configuration in the libtool script - -lt_save_CC="$CC" -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -objext=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - -if test -n "$compiler"; then - -lt_prog_compiler_no_builtin_flag= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; - *) - lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 -$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } -if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_rtti_exceptions=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="-fno-rtti -fno-exceptions" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_rtti_exceptions=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 -$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } - -if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then - lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" -else - : -fi - -fi - - - - - - - lt_prog_compiler_wl= -lt_prog_compiler_pic= -lt_prog_compiler_static= - - - if test "$GCC" = yes; then - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_static='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - ;; - - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - lt_prog_compiler_can_build_shared=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic=-Kconform_pic - fi - ;; - - *) - lt_prog_compiler_pic='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - lt_prog_compiler_wl='-Xlinker ' - lt_prog_compiler_pic='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - lt_prog_compiler_wl='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static='-Bstatic' - else - lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic='-DDLL_EXPORT' - ;; - - hpux9* | hpux10* | hpux11*) - lt_prog_compiler_wl='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - lt_prog_compiler_static='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - lt_prog_compiler_wl='-Wl,' - # PIC (with -KPIC) is the default. - lt_prog_compiler_static='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fPIC' - lt_prog_compiler_static='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='--shared' - lt_prog_compiler_static='--static' - ;; - nagfor*) - # NAG Fortran compiler - lt_prog_compiler_wl='-Wl,-Wl,,' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-fpic' - lt_prog_compiler_static='-Bstatic' - ;; - ccc*) - lt_prog_compiler_wl='-Wl,' - # All Alpha code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-qpic' - lt_prog_compiler_static='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='' - ;; - *Sun\ C*) - # Sun C 5.9 - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - lt_prog_compiler_wl='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - lt_prog_compiler_wl='-Wl,' - # All OSF/1 code is PIC. - lt_prog_compiler_static='-non_shared' - ;; - - rdos*) - lt_prog_compiler_static='-non_shared' - ;; - - solaris*) - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - lt_prog_compiler_wl='-Qoption ld ';; - *) - lt_prog_compiler_wl='-Wl,';; - esac - ;; - - sunos4*) - lt_prog_compiler_wl='-Qoption ld ' - lt_prog_compiler_pic='-PIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - lt_prog_compiler_pic='-Kconform_pic' - lt_prog_compiler_static='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_pic='-KPIC' - lt_prog_compiler_static='-Bstatic' - ;; - - unicos*) - lt_prog_compiler_wl='-Wl,' - lt_prog_compiler_can_build_shared=no - ;; - - uts4*) - lt_prog_compiler_pic='-pic' - lt_prog_compiler_static='-Bstatic' - ;; - - *) - lt_prog_compiler_can_build_shared=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic= - ;; - *) - lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic=$lt_prog_compiler_pic -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 -$as_echo "$lt_cv_prog_compiler_pic" >&6; } -lt_prog_compiler_pic=$lt_cv_prog_compiler_pic - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } -if ${lt_cv_prog_compiler_pic_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works" = xyes; then - case $lt_prog_compiler_pic in - "" | " "*) ;; - *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; - esac -else - lt_prog_compiler_pic= - lt_prog_compiler_can_build_shared=no -fi - -fi - - - - - - - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works=yes - fi - else - lt_cv_prog_compiler_static_works=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 -$as_echo "$lt_cv_prog_compiler_static_works" >&6; } - -if test x"$lt_cv_prog_compiler_static_works" = xyes; then - : -else - lt_prog_compiler_static= -fi - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 -$as_echo "$lt_cv_prog_compiler_c_o" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - runpath_var= - allow_undefined_flag= - always_export_symbols=no - archive_cmds= - archive_expsym_cmds= - compiler_needs_object=no - enable_shared_with_static_runtimes=no - export_dynamic_flag_spec= - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - hardcode_automatic=no - hardcode_direct=no - hardcode_direct_absolute=no - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld= - hardcode_libdir_separator= - hardcode_minus_L=no - hardcode_shlibpath_var=unsupported - inherit_rpath=no - link_all_deplibs=unknown - module_cmds= - module_expsym_cmds= - old_archive_from_new_cmds= - old_archive_from_expsyms_cmds= - thread_safe_flag_spec= - whole_archive_flag_spec= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - include_expsyms= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs=no - ;; - esac - - ld_shlibs=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; - *\ \(GNU\ Binutils\)\ [3-9]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[3-9]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec='-L$libdir' - export_dynamic_flag_spec='${wl}--export-all-symbols' - allow_undefined_flag=unsupported - always_export_symbols=no - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs=no - fi - ;; - - haiku*) - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs=yes - ;; - - interix[3-9]*) - hardcode_direct=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - whole_archive_flag_spec= - tmp_sharedflag='--shared' ;; - xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' - hardcode_libdir_flag_spec= - hardcode_libdir_flag_spec_ld='-rpath $libdir' - archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - ld_shlibs=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) - ld_shlibs=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - ;; - - sunos4*) - archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - ld_shlibs=no - fi - ;; - esac - - if test "$ld_shlibs" = no; then - runpath_var= - hardcode_libdir_flag_spec= - export_dynamic_flag_spec= - whole_archive_flag_spec= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - allow_undefined_flag=unsupported - always_export_symbols=yes - archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - hardcode_minus_L=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - hardcode_direct=unsupported - fi - ;; - - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds='' - hardcode_direct=yes - hardcode_direct_absolute=yes - hardcode_libdir_separator=':' - link_all_deplibs=yes - file_list_spec='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L=yes - hardcode_libdir_flag_spec='-L$libdir' - hardcode_libdir_separator= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - link_all_deplibs=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - always_export_symbols=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag="-z nodefs" - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath_+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath_"; then - lt_cv_aix_libpath_="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath_ -fi - - hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag=' ${wl}-bernotok' - allow_undefined_flag=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec='$convenience' - fi - archive_cmds_need_lc=yes - # This is similar to how AIX traditionally builds its shared libraries. - archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds='' - ;; - m68k) - archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - ;; - esac - ;; - - bsdi[45]*) - export_dynamic_flag_spec=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - always_export_symbols=yes - file_list_spec='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, )='true' - enable_shared_with_static_runtimes=yes - export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - old_postinstall_cmds='chmod 644 $oldlib' - postlink_cmds='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - hardcode_libdir_flag_spec=' ' - allow_undefined_flag=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - old_archive_from_new_cmds='true' - # FIXME: Should let the user specify the lib program. - old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' - enable_shared_with_static_runtimes=yes - ;; - esac - ;; - - darwin* | rhapsody*) - - - archive_cmds_need_lc=no - hardcode_direct=no - hardcode_automatic=yes - hardcode_shlibpath_var=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - whole_archive_flag_spec='' - fi - link_all_deplibs=yes - allow_undefined_flag="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - - else - ld_shlibs=no - fi - - ;; - - dgux*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - freebsd1*) - ld_shlibs=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - hpux9*) - if test "$GCC" = yes; then - archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - export_dynamic_flag_spec='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_flag_spec_ld='+b $libdir' - hardcode_libdir_separator=: - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 -$as_echo_n "checking if $CC understands -b... " >&6; } -if ${lt_cv_prog_compiler__b+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler__b=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -b" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler__b=yes - fi - else - lt_cv_prog_compiler__b=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 -$as_echo "$lt_cv_prog_compiler__b" >&6; } - -if test x"$lt_cv_prog_compiler__b" = xyes; then - archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' -else - archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' -fi - - ;; - esac - fi - if test "$with_gnu_ld" = no; then - hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' - hardcode_libdir_separator=: - - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct=no - hardcode_shlibpath_var=no - ;; - *) - hardcode_direct=yes - hardcode_direct_absolute=yes - export_dynamic_flag_spec='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - hardcode_minus_L=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 -$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } -if ${lt_cv_irix_exported_symbol+:} false; then : - $as_echo_n "(cached) " >&6 -else - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -int foo (void) { return 0; } -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - lt_cv_irix_exported_symbol=yes -else - lt_cv_irix_exported_symbol=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS="$save_LDFLAGS" -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 -$as_echo "$lt_cv_irix_exported_symbol" >&6; } - if test "$lt_cv_irix_exported_symbol" = yes; then - archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - inherit_rpath=yes - link_all_deplibs=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_direct=yes - hardcode_shlibpath_var=no - ;; - - newsos6) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - hardcode_shlibpath_var=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct=yes - hardcode_shlibpath_var=no - hardcode_direct_absolute=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - export_dynamic_flag_spec='${wl}-E' - else - case $host_os in - openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) - archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-R$libdir' - ;; - *) - archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - hardcode_libdir_flag_spec='${wl}-rpath,$libdir' - ;; - esac - fi - else - ld_shlibs=no - fi - ;; - - os2*) - hardcode_libdir_flag_spec='-L$libdir' - hardcode_minus_L=yes - allow_undefined_flag=unsupported - archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - archive_cmds_need_lc='no' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' - else - allow_undefined_flag=' -expect_unresolved \*' - archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - hardcode_libdir_flag_spec='-rpath $libdir' - fi - archive_cmds_need_lc='no' - hardcode_libdir_separator=: - ;; - - solaris*) - no_undefined_flag=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - hardcode_libdir_flag_spec='-R$libdir' - hardcode_shlibpath_var=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - whole_archive_flag_spec='-z allextract$convenience -z defaultextract' - fi - ;; - esac - link_all_deplibs=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - hardcode_libdir_flag_spec='-L$libdir' - hardcode_direct=yes - hardcode_minus_L=yes - hardcode_shlibpath_var=no - ;; - - sysv4) - case $host_vendor in - sni) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' - reload_cmds='$CC -r -o $output$reload_objs' - hardcode_direct=no - ;; - motorola) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_direct=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - hardcode_shlibpath_var=no - ;; - - sysv4.3*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - export_dynamic_flag_spec='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_shlibpath_var=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - ld_shlibs=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag='${wl}-z,text' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag='${wl}-z,text' - allow_undefined_flag='${wl}-z,nodefs' - archive_cmds_need_lc=no - hardcode_shlibpath_var=no - hardcode_libdir_flag_spec='${wl}-R,$libdir' - hardcode_libdir_separator=':' - link_all_deplibs=yes - export_dynamic_flag_spec='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - hardcode_libdir_flag_spec='-L$libdir' - hardcode_shlibpath_var=no - ;; - - *) - ld_shlibs=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - export_dynamic_flag_spec='${wl}-Blargedynsym' - ;; - esac - fi - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 -$as_echo "$ld_shlibs" >&6; } -test "$ld_shlibs" = no && can_build_shared=no - -with_gnu_ld=$with_gnu_ld - - - - - - - - - - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl - pic_flag=$lt_prog_compiler_pic - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag - allow_undefined_flag= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc=no - else - lt_cv_archive_cmds_need_lc=yes - fi - allow_undefined_flag=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } - archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[lt_foo]++; } - if (lt_freq[lt_foo] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([A-Za-z]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action= -if test -n "$hardcode_libdir_flag_spec" || - test -n "$runpath_var" || - test "X$hardcode_automatic" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && - test "$hardcode_minus_L" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 -$as_echo "$hardcode_action" >&6; } - -if test "$hardcode_action" = relink || - test "$inherit_rpath" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - -fi - - ;; - - *) - ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" -if test "x$ac_cv_func_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 -$as_echo_n "checking for shl_load in -ldld... " >&6; } -if ${ac_cv_lib_dld_shl_load+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char shl_load (); -int -main () -{ -return shl_load (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_shl_load=yes -else - ac_cv_lib_dld_shl_load=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 -$as_echo "$ac_cv_lib_dld_shl_load" >&6; } -if test "x$ac_cv_lib_dld_shl_load" = xyes; then : - lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" -else - ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" -if test "x$ac_cv_func_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 -$as_echo_n "checking for dlopen in -ldl... " >&6; } -if ${ac_cv_lib_dl_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dl_dlopen=yes -else - ac_cv_lib_dl_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 -$as_echo "$ac_cv_lib_dl_dlopen" >&6; } -if test "x$ac_cv_lib_dl_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 -$as_echo_n "checking for dlopen in -lsvld... " >&6; } -if ${ac_cv_lib_svld_dlopen+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lsvld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dlopen (); -int -main () -{ -return dlopen (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_svld_dlopen=yes -else - ac_cv_lib_svld_dlopen=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 -$as_echo "$ac_cv_lib_svld_dlopen" >&6; } -if test "x$ac_cv_lib_svld_dlopen" = xyes; then : - lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 -$as_echo_n "checking for dld_link in -ldld... " >&6; } -if ${ac_cv_lib_dld_dld_link+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldld $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dld_link (); -int -main () -{ -return dld_link (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_dld_dld_link=yes -else - ac_cv_lib_dld_dld_link=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 -$as_echo "$ac_cv_lib_dld_dld_link" >&6; } -if test "x$ac_cv_lib_dld_dld_link" = xyes; then : - lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" -fi - - -fi - - -fi - - -fi - - -fi - - -fi - - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 -$as_echo_n "checking whether a program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 -$as_echo "$lt_cv_dlopen_self" >&6; } - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 -$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } -if ${lt_cv_dlopen_self_static+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - lt_cv_dlopen_self_static=cross -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -} -_LT_EOF - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 - (eval $ac_link) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&5 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; - x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; - esac - else : - # compilation failed - lt_cv_dlopen_self_static=no - fi -fi -rm -fr conftest* - - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 -$as_echo "$lt_cv_dlopen_self_static" >&6; } - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi - - - - - - - - - - - - - - - - - -striplib= -old_striplib= -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 -$as_echo_n "checking whether stripping libraries is possible... " >&6; } -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - fi - ;; - *) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } - ;; - esac -fi - - - - - - - - - - - - - # Report which library types will actually be built - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 -$as_echo_n "checking if libtool supports shared libraries... " >&6; } - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 -$as_echo "$can_build_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 -$as_echo_n "checking whether to build shared libraries... " >&6; } - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[4-9]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 -$as_echo "$enable_shared" >&6; } - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 -$as_echo_n "checking whether to build static libraries... " >&6; } - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 -$as_echo "$enable_static" >&6; } - - - - -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -CC="$lt_save_CC" - - - - - - - - - - - - - - ac_config_commands="$ac_config_commands libtool" - - - - -# Only expand once: - - - - - - - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu -if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. -set dummy ${ac_tool_prefix}gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$ac_cv_prog_CC"; then - ac_ct_CC=$CC - # Extract the first word of "gcc", so it can be a program name with args. -set dummy gcc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="gcc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -else - CC="$ac_cv_prog_CC" -fi - -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. -set dummy ${ac_tool_prefix}cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="${ac_tool_prefix}cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - fi -fi -if test -z "$CC"; then - # Extract the first word of "cc", so it can be a program name with args. -set dummy cc; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else - ac_prog_rejected=no -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then - ac_prog_rejected=yes - continue - fi - ac_cv_prog_CC="cc" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -if test $ac_prog_rejected = yes; then - # We found a bogon in the path, so make sure we never use it. - set dummy $ac_cv_prog_CC - shift - if test $# != 0; then - # We chose a different compiler from the bogus one. - # However, it has the same basename, so the bogon will be chosen - # first if we set CC to just the basename; use the full file name. - shift - ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" - fi -fi -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - -fi -if test -z "$CC"; then - if test -n "$ac_tool_prefix"; then - for ac_prog in cl.exe - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CC"; then - ac_cv_prog_CC="$CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CC="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CC=$ac_cv_prog_CC -if test -n "$CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 -$as_echo "$CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CC" && break - done -fi -if test -z "$CC"; then - ac_ct_CC=$CC - for ac_prog in cl.exe -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CC+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CC"; then - ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CC="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CC=$ac_cv_prog_ac_ct_CC -if test -n "$ac_ct_CC"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 -$as_echo "$ac_ct_CC" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CC" && break -done - - if test "x$ac_ct_CC" = x; then - CC="" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CC=$ac_ct_CC - fi -fi - -fi - - -test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "no acceptable C compiler found in \$PATH -See \`config.log' for more details" "$LINENO" 5; } - -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 -$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } -if ${ac_cv_c_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_c_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 -$as_echo "$ac_cv_c_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GCC=yes -else - GCC= -fi -ac_test_CFLAGS=${CFLAGS+set} -ac_save_CFLAGS=$CFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 -$as_echo_n "checking whether $CC accepts -g... " >&6; } -if ${ac_cv_prog_cc_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_c_werror_flag=$ac_c_werror_flag - ac_c_werror_flag=yes - ac_cv_prog_cc_g=no - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -else - CFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - ac_c_werror_flag=$ac_save_c_werror_flag - CFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_c_werror_flag=$ac_save_c_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 -$as_echo "$ac_cv_prog_cc_g" >&6; } -if test "$ac_test_CFLAGS" = set; then - CFLAGS=$ac_save_CFLAGS -elif test $ac_cv_prog_cc_g = yes; then - if test "$GCC" = yes; then - CFLAGS="-g -O2" - else - CFLAGS="-g" - fi -else - if test "$GCC" = yes; then - CFLAGS="-O2" - else - CFLAGS= - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -if test -z "$CXX"; then - if test -n "$CCC"; then - CXX=$CCC - else - if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC - do - # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. -set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$CXX"; then - ac_cv_prog_CXX="$CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -CXX=$ac_cv_prog_CXX -if test -n "$CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5 -$as_echo "$CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$CXX" && break - done -fi -if test -z "$CXX"; then - ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC -do - # Extract the first word of "$ac_prog", so it can be a program name with args. -set dummy $ac_prog; ac_word=$2 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 -$as_echo_n "checking for $ac_word... " >&6; } -if ${ac_cv_prog_ac_ct_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -n "$ac_ct_CXX"; then - ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. -else -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then - ac_cv_prog_ac_ct_CXX="$ac_prog" - $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 - break 2 - fi -done - done -IFS=$as_save_IFS - -fi -fi -ac_ct_CXX=$ac_cv_prog_ac_ct_CXX -if test -n "$ac_ct_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5 -$as_echo "$ac_ct_CXX" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - - - test -n "$ac_ct_CXX" && break -done - - if test "x$ac_ct_CXX" = x; then - CXX="g++" - else - case $cross_compiling:$ac_tool_warned in -yes:) -{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 -$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} -ac_tool_warned=yes ;; -esac - CXX=$ac_ct_CXX - fi -fi - - fi -fi -# Provide some information about the compiler. -$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5 -set X $ac_compile -ac_compiler=$2 -for ac_option in --version -v -V -qversion; do - { { ac_try="$ac_compiler $ac_option >&5" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" -$as_echo "$ac_try_echo"; } >&5 - (eval "$ac_compiler $ac_option >&5") 2>conftest.err - ac_status=$? - if test -s conftest.err; then - sed '10a\ -... rest of stderr output deleted ... - 10q' conftest.err >conftest.er1 - cat conftest.er1 >&5 - fi - rm -f conftest.er1 conftest.err - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5 -$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; } -if ${ac_cv_cxx_compiler_gnu+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -#ifndef __GNUC__ - choke me -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_compiler_gnu=yes -else - ac_compiler_gnu=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -ac_cv_cxx_compiler_gnu=$ac_compiler_gnu - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5 -$as_echo "$ac_cv_cxx_compiler_gnu" >&6; } -if test $ac_compiler_gnu = yes; then - GXX=yes -else - GXX= -fi -ac_test_CXXFLAGS=${CXXFLAGS+set} -ac_save_CXXFLAGS=$CXXFLAGS -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5 -$as_echo_n "checking whether $CXX accepts -g... " >&6; } -if ${ac_cv_prog_cxx_g+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_save_cxx_werror_flag=$ac_cxx_werror_flag - ac_cxx_werror_flag=yes - ac_cv_prog_cxx_g=no - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -else - CXXFLAGS="" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - -else - ac_cxx_werror_flag=$ac_save_cxx_werror_flag - CXXFLAGS="-g" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_compile "$LINENO"; then : - ac_cv_prog_cxx_g=yes -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - ac_cxx_werror_flag=$ac_save_cxx_werror_flag -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5 -$as_echo "$ac_cv_prog_cxx_g" >&6; } -if test "$ac_test_CXXFLAGS" = set; then - CXXFLAGS=$ac_save_CXXFLAGS -elif test $ac_cv_prog_cxx_g = yes; then - if test "$GXX" = yes; then - CXXFLAGS="-g -O2" - else - CXXFLAGS="-g" - fi -else - if test "$GXX" = yes; then - CXXFLAGS="-O2" - else - CXXFLAGS= - fi -fi -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - - -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf - - if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5 -$as_echo_n "checking how to run the C++ preprocessor... " >&6; } -if test -z "$CXXCPP"; then - if ${ac_cv_prog_CXXCPP+:} false; then : - $as_echo_n "(cached) " >&6 -else - # Double quotes because CXXCPP needs to be expanded - for CXXCPP in "$CXX -E" "/lib/cpp" - do - ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - break -fi - - done - ac_cv_prog_CXXCPP=$CXXCPP - -fi - CXXCPP=$ac_cv_prog_CXXCPP -else - ac_cv_prog_CXXCPP=$CXXCPP -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5 -$as_echo "$CXXCPP" >&6; } -ac_preproc_ok=false -for ac_cxx_preproc_warn_flag in '' yes -do - # Use a header file that comes with gcc, so configuring glibc - # with a fresh cross-compiler works. - # Prefer to if __STDC__ is defined, since - # exists even on freestanding compilers. - # On the NeXT, cc -E runs the code through the compiler's parser, - # not just through cpp. "Syntax error" is here to catch this case. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef __STDC__ -# include -#else -# include -#endif - Syntax error -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - -else - # Broken: fails on valid input. -continue -fi -rm -f conftest.err conftest.i conftest.$ac_ext - - # OK, works on sane cases. Now check whether nonexistent headers - # can be detected and how. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -_ACEOF -if ac_fn_cxx_try_cpp "$LINENO"; then : - # Broken: success on invalid input. -continue -else - # Passes both tests. -ac_preproc_ok=: -break -fi -rm -f conftest.err conftest.i conftest.$ac_ext - -done -# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. -rm -f conftest.i conftest.err conftest.$ac_ext -if $ac_preproc_ok; then : - -else - { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 -$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} -as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check -See \`config.log' for more details" "$LINENO" 5; } -fi - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - -else - _lt_caught_CXX_error=yes -fi - -ac_ext=cpp -ac_cpp='$CXXCPP $CPPFLAGS' -ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_cxx_compiler_gnu - -archive_cmds_need_lc_CXX=no -allow_undefined_flag_CXX= -always_export_symbols_CXX=no -archive_expsym_cmds_CXX= -compiler_needs_object_CXX=no -export_dynamic_flag_spec_CXX= -hardcode_direct_CXX=no -hardcode_direct_absolute_CXX=no -hardcode_libdir_flag_spec_CXX= -hardcode_libdir_flag_spec_ld_CXX= -hardcode_libdir_separator_CXX= -hardcode_minus_L_CXX=no -hardcode_shlibpath_var_CXX=unsupported -hardcode_automatic_CXX=no -inherit_rpath_CXX=no -module_cmds_CXX= -module_expsym_cmds_CXX= -link_all_deplibs_CXX=unknown -old_archive_cmds_CXX=$old_archive_cmds -reload_flag_CXX=$reload_flag -reload_cmds_CXX=$reload_cmds -no_undefined_flag_CXX= -whole_archive_flag_spec_CXX= -enable_shared_with_static_runtimes_CXX=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -objext_CXX=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - - - - - - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC - - - # save warnings/boilerplate of simple test code - ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* - - ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* - - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - compiler_CXX=$CC - for cc_temp in $compiler""; do - case $cc_temp in - compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; - distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` - - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin' - else - lt_prog_compiler_no_builtin_flag_CXX= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - - -# Check whether --with-gnu-ld was given. -if test "${with_gnu_ld+set}" = set; then : - withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes -else - with_gnu_ld=no -fi - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 -$as_echo_n "checking for ld used by $CC... " >&6; } - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [\\/]* | ?:[\\/]*) - re_direlt='/[^/][^/]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 -$as_echo_n "checking for GNU ld... " >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 -$as_echo_n "checking for non-GNU ld... " >&6; } -fi -if ${lt_cv_path_LD+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &5 -$as_echo "$LD" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi -test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 -$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } -if ${lt_cv_prog_gnu_ld+:} false; then : - $as_echo_n "(cached) " >&6 -else - # I'd rather use --version here, but apparently some GNU lds only accept -v. -case `$LD -v 2>&1 &5 -$as_echo "$lt_cv_prog_gnu_ld" >&6; } -with_gnu_ld=$lt_cv_prog_gnu_ld - - - - - - - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - whole_archive_flag_spec_CXX= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - ld_shlibs_CXX=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aix[4-9]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - archive_cmds_CXX='' - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - file_list_spec_CXX='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[012]|aix4.[012].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - hardcode_direct_CXX=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - hardcode_minus_L_CXX=yes - hardcode_libdir_flag_spec_CXX='-L$libdir' - hardcode_libdir_separator_CXX= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - export_dynamic_flag_spec_CXX='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - always_export_symbols_CXX=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - allow_undefined_flag_CXX='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath__CXX -fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - - archive_expsym_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - hardcode_libdir_flag_spec_CXX='${wl}-R $libdir:/usr/lib:/lib' - allow_undefined_flag_CXX="-z nodefs" - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - if ${lt_cv_aix_libpath__CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - - lt_aix_libpath_sed=' - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }' - lt_cv_aix_libpath__CXX=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - if test -z "$lt_cv_aix_libpath__CXX"; then - lt_cv_aix_libpath__CXX="/usr/lib:/lib" - fi - -fi - - aix_libpath=$lt_cv_aix_libpath__CXX -fi - - hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - no_undefined_flag_CXX=' ${wl}-bernotok' - allow_undefined_flag_CXX=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - whole_archive_flag_spec_CXX='$convenience' - fi - archive_cmds_need_lc_CXX=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - allow_undefined_flag_CXX=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - ld_shlibs_CXX=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - hardcode_libdir_flag_spec_CXX=' ' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=yes - file_list_spec_CXX='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - archive_cmds_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, CXX)='true' - enable_shared_with_static_runtimes_CXX=yes - # Don't use ranlib - old_postinstall_cmds_CXX='chmod 644 $oldlib' - postlink_cmds_CXX='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless, - # as there is no search path for DLLs. - hardcode_libdir_flag_spec_CXX='-L$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-all-symbols' - allow_undefined_flag_CXX=unsupported - always_export_symbols_CXX=no - enable_shared_with_static_runtimes_CXX=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - archive_expsym_cmds_CXX='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - ld_shlibs_CXX=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - - - archive_cmds_need_lc_CXX=no - hardcode_direct_CXX=no - hardcode_automatic_CXX=yes - hardcode_shlibpath_var_CXX=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - whole_archive_flag_spec_CXX='' - fi - link_all_deplibs_CXX=yes - allow_undefined_flag_CXX="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - if test "$lt_cv_apple_cc_single_mod" != "yes"; then - archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi - - else - ld_shlibs_CXX=no - fi - - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - freebsd[12]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - ld_shlibs_CXX=no - ;; - - freebsd-elf*) - archive_cmds_need_lc_CXX=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - ld_shlibs_CXX=yes - ;; - - gnu*) - ;; - - haiku*) - archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - link_all_deplibs_CXX=yes - ;; - - hpux9*) - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - export_dynamic_flag_spec_CXX='${wl}-E' - hardcode_direct_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - export_dynamic_flag_spec_CXX='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - ;; - *) - hardcode_direct_CXX=yes - hardcode_direct_absolute_CXX=yes - hardcode_minus_L_CXX=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - interix[3-9]*) - hardcode_direct_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - link_all_deplibs_CXX=yes - ;; - esac - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - inherit_rpath_CXX=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - archive_cmds_need_lc_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [1-5].* | *pgcpp\ [1-5].*) - prelink_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - old_archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - archive_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - export_dynamic_flag_spec_CXX='${wl}--export-dynamic' - archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - hardcode_libdir_flag_spec_CXX='-R$libdir' - whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - compiler_needs_object_CXX=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - ld_shlibs_CXX=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - ld_shlibs_CXX=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - hardcode_direct_CXX=yes - hardcode_shlibpath_var_CXX=no - hardcode_direct_absolute_CXX=yes - archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - export_dynamic_flag_spec_CXX='${wl}-E' - whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - ld_shlibs_CXX=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir' - hardcode_libdir_separator_CXX=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - cxx*) - case $host in - osf3*) - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - ;; - *) - allow_undefined_flag_CXX=' -expect_unresolved \*' - archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - hardcode_libdir_flag_spec_CXX='-rpath $libdir' - ;; - esac - - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir' - hardcode_libdir_separator_CXX=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - archive_cmds_need_lc_CXX=yes - no_undefined_flag_CXX=' -zdefs' - archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - hardcode_libdir_flag_spec_CXX='-R$libdir' - hardcode_shlibpath_var_CXX=no - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract' - ;; - esac - link_all_deplibs_CXX=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - no_undefined_flag_CXX=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir' - case $host_os in - solaris2.[0-5] | solaris2.[0-5].*) ;; - *) - whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) - no_undefined_flag_CXX='${wl}-z,text' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - no_undefined_flag_CXX='${wl}-z,text' - allow_undefined_flag_CXX='${wl}-z,nodefs' - archive_cmds_need_lc_CXX=no - hardcode_shlibpath_var_CXX=no - hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir' - hardcode_libdir_separator_CXX=':' - link_all_deplibs_CXX=yes - export_dynamic_flag_spec_CXX='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~ - '"$old_archive_cmds_CXX" - reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~ - '"$reload_cmds_CXX" - ;; - *) - archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - - *) - # FIXME: insert proper C++ library support - ld_shlibs_CXX=no - ;; - esac - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } - test "$ld_shlibs_CXX" = no && can_build_shared=no - - GCC_CXX="$GXX" - LD_CXX="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - # Dependencies to place before and after the object being linked: -predep_objects_CXX= -postdep_objects_CXX= -predeps_CXX= -postdeps_CXX= -compiler_lib_search_path_CXX= - -cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF - - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -esac - -if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; }; then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$compiler_lib_search_path_CXX"; then - compiler_lib_search_path_CXX="${prev}${p}" - else - compiler_lib_search_path_CXX="${compiler_lib_search_path_CXX} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$postdeps_CXX"; then - postdeps_CXX="${prev}${p}" - else - postdeps_CXX="${postdeps_CXX} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$predep_objects_CXX"; then - predep_objects_CXX="$p" - else - predep_objects_CXX="$predep_objects_CXX $p" - fi - else - if test -z "$postdep_objects_CXX"; then - postdep_objects_CXX="$p" - else - postdep_objects_CXX="$postdep_objects_CXX $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling CXX test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -case $host_os in -interix[3-9]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - predep_objects_CXX= - postdep_objects_CXX= - postdeps_CXX= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - postdeps_CXX='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac - - -case " $postdeps_CXX " in -*" -lc "*) archive_cmds_need_lc_CXX=no ;; -esac - compiler_lib_search_dirs_CXX= -if test -n "${compiler_lib_search_path_CXX}"; then - compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - lt_prog_compiler_wl_CXX= -lt_prog_compiler_pic_CXX= -lt_prog_compiler_static_CXX= - - - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - lt_prog_compiler_pic_CXX='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - lt_prog_compiler_pic_CXX='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - lt_prog_compiler_pic_CXX='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - lt_prog_compiler_pic_CXX= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - lt_prog_compiler_static_CXX= - ;; - interix[3-9]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - lt_prog_compiler_pic_CXX=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - *) - lt_prog_compiler_pic_CXX='-fPIC' - ;; - esac - else - case $host_os in - aix[4-9]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - lt_prog_compiler_static_CXX='-Bstatic' - else - lt_prog_compiler_static_CXX='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - lt_prog_compiler_pic_CXX='-DDLL_EXPORT' - ;; - dgux*) - case $cc_basename in - ec++*) - lt_prog_compiler_pic_CXX='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - lt_prog_compiler_pic_CXX='+Z' - fi - ;; - aCC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - lt_prog_compiler_pic_CXX='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_static_CXX='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - lt_prog_compiler_wl_CXX='--backend -Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fPIC' - lt_prog_compiler_static_CXX='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-fpic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - xlc* | xlC* | bgxl[cC]* | mpixl[cC]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-qpic' - lt_prog_compiler_static_CXX='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - lt_prog_compiler_pic_CXX='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - lt_prog_compiler_pic_CXX='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - lt_prog_compiler_wl_CXX='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - lt_prog_compiler_pic_CXX='-pic' - ;; - cxx*) - # Digital/Compaq C++ - lt_prog_compiler_wl_CXX='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - lt_prog_compiler_pic_CXX= - lt_prog_compiler_static_CXX='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - lt_prog_compiler_wl_CXX='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - lt_prog_compiler_pic_CXX='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - lt_prog_compiler_pic_CXX='-pic' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - lcc*) - # Lucid - lt_prog_compiler_pic_CXX='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - lt_prog_compiler_wl_CXX='-Wl,' - lt_prog_compiler_pic_CXX='-KPIC' - lt_prog_compiler_static_CXX='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - lt_prog_compiler_pic_CXX='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - lt_prog_compiler_can_build_shared_CXX=no - ;; - esac - fi - -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - lt_prog_compiler_pic_CXX= - ;; - *) - lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC" - ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 -$as_echo_n "checking for $compiler option to produce PIC... " >&6; } -if ${lt_cv_prog_compiler_pic_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; } -lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$lt_prog_compiler_pic_CXX"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5 -$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; } -if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_pic_works_CXX=no - ac_outfile=conftest.$ac_objext - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_pic_works_CXX=yes - fi - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; } - -if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then - case $lt_prog_compiler_pic_CXX in - "" | " "*) ;; - *) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;; - esac -else - lt_prog_compiler_pic_CXX= - lt_prog_compiler_can_build_shared_CXX=no -fi - -fi - - - - - -# -# Check to make sure the static flag actually works. -# -wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\" -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 -$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } -if ${lt_cv_prog_compiler_static_works_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_static_works_CXX=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $lt_tmp_static_flag" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&5 - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - lt_cv_prog_compiler_static_works_CXX=yes - fi - else - lt_cv_prog_compiler_static_works_CXX=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; } - -if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then - : -else - lt_prog_compiler_static_CXX= -fi - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 -$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } -if ${lt_cv_prog_compiler_c_o_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_prog_compiler_c_o_CXX=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - lt_cv_prog_compiler_c_o_CXX=yes - fi - fi - chmod u+w . 2>&5 - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5 -$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; } - - - - -hard_links="nottested" -if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 -$as_echo_n "checking if we can lock with hard links... " >&6; } - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 -$as_echo "$hard_links" >&6; } - if test "$hard_links" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 -$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} - need_locks=warn - fi -else - need_locks=no -fi - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 -$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } - - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' - case $host_os in - aix[4-9]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - export_symbols_cmds_CXX="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' - exclude_expsyms_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - link_all_deplibs_CXX=no - ;; - *) - export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5 -$as_echo "$ld_shlibs_CXX" >&6; } -test "$ld_shlibs_CXX" = no && can_build_shared=no - -with_gnu_ld_CXX=$with_gnu_ld - - - - - - -# -# Do we need to explicitly link libc? -# -case "x$archive_cmds_need_lc_CXX" in -x|xyes) - # Assume -lc should be added - archive_cmds_need_lc_CXX=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $archive_cmds_CXX in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 -$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } -if ${lt_cv_archive_cmds_need_lc_CXX+:} false; then : - $as_echo_n "(cached) " >&6 -else - $RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$lt_prog_compiler_wl_CXX - pic_flag=$lt_prog_compiler_pic_CXX - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$allow_undefined_flag_CXX - allow_undefined_flag_CXX= - if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 - (eval $archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 - ac_status=$? - $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 - test $ac_status = 0; } - then - lt_cv_archive_cmds_need_lc_CXX=no - else - lt_cv_archive_cmds_need_lc_CXX=yes - fi - allow_undefined_flag_CXX=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5 -$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; } - archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX - ;; - esac - fi - ;; -esac - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 -$as_echo_n "checking dynamic linker characteristics... " >&6; } - -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[4-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[01] | aix4.[01].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[45]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' - - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[123]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[01]* | freebsdelf3.[01]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ - freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[3-9]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - if ${lt_cv_shlibpath_overrides_runpath+:} false; then : - $as_echo_n "(cached) " >&6 -else - lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$lt_prog_compiler_wl_CXX\"; \ - LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\"" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_cxx_try_link "$LINENO"; then : - if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : - lt_cv_shlibpath_overrides_runpath=yes -fi -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - -fi - - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[89] | openbsd2.[89].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 -$as_echo "$dynamic_linker" >&6; } -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 -$as_echo_n "checking how to hardcode library paths into programs... " >&6; } -hardcode_action_CXX= -if test -n "$hardcode_libdir_flag_spec_CXX" || - test -n "$runpath_var_CXX" || - test "X$hardcode_automatic_CXX" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$hardcode_direct_CXX" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, CXX)" != no && - test "$hardcode_minus_L_CXX" != no; then - # Linking always hardcodes the temporary library directory. - hardcode_action_CXX=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - hardcode_action_CXX=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - hardcode_action_CXX=unsupported -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5 -$as_echo "$hardcode_action_CXX" >&6; } - -if test "$hardcode_action_CXX" = relink || - test "$inherit_rpath_CXX" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi - - - - - - - - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -ac_ext=c -ac_cpp='$CPP $CPPFLAGS' -ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' -ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' -ac_compiler_gnu=$ac_cv_c_compiler_gnu - - -# Find a good install program. We prefer a C program (faster), -# so one script is as good as another. But avoid the broken or -# incompatible versions: -# SysV /etc/install, /usr/sbin/install -# SunOS /usr/etc/install -# IRIX /sbin/install -# AIX /bin/install -# AmigaOS /C/install, which installs bootblocks on floppy discs -# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag -# AFS /usr/afsws/bin/install, which mishandles nonexistent args -# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" -# OS/2's system install, which has a completely different semantic -# ./install, which can be erroneously created by make from ./install.sh. -# Reject install programs that cannot install multiple files. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 -$as_echo_n "checking for a BSD-compatible install... " >&6; } -if test -z "$INSTALL"; then -if ${ac_cv_path_install+:} false; then : - $as_echo_n "(cached) " >&6 -else - as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - # Account for people who put trailing slashes in PATH elements. -case $as_dir/ in #(( - ./ | .// | /[cC]/* | \ - /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ - ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ - /usr/ucb/* ) ;; - *) - # OSF1 and SCO ODT 3.0 have their own names for install. - # Don't use installbsd from OSF since it installs stuff as root - # by default. - for ac_prog in ginstall scoinst install; do - for ac_exec_ext in '' $ac_executable_extensions; do - if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then - if test $ac_prog = install && - grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # AIX install. It has an incompatible calling convention. - : - elif test $ac_prog = install && - grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then - # program-specific install script used by HP pwplus--don't use. - : - else - rm -rf conftest.one conftest.two conftest.dir - echo one > conftest.one - echo two > conftest.two - mkdir conftest.dir - if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && - test -s conftest.one && test -s conftest.two && - test -s conftest.dir/conftest.one && - test -s conftest.dir/conftest.two - then - ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" - break 3 - fi - fi - fi - done - done - ;; -esac - - done -IFS=$as_save_IFS - -rm -rf conftest.one conftest.two conftest.dir - -fi - if test "${ac_cv_path_install+set}" = set; then - INSTALL=$ac_cv_path_install - else - # As a last resort, use the slow shell script. Don't cache a - # value for INSTALL within a source directory, because that will - # break other packages using the cache if that directory is - # removed, or if the value is a relative name. - INSTALL=$ac_install_sh - fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 -$as_echo "$INSTALL" >&6; } - -# Use test -z because SunOS4 sh mishandles braces in ${var-val}. -# It thinks the first close brace ends the variable substitution. -test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' - -test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' - -test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' - - -if test "$GCC" = yes ; then - OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" - CFLAGS="$OLDCFLAGS -fexceptions" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -fexceptions" >&5 -$as_echo_n "checking whether $CC accepts -fexceptions... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; }; CFLAGS="$OLDCFLAGS" -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'` -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 -$as_echo_n "checking for ANSI C header files... " >&6; } -if ${ac_cv_header_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include - -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_header_stdc=yes -else - ac_cv_header_stdc=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - -if test $ac_cv_header_stdc = yes; then - # SunOS 4.x string.h does not declare mem*, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "memchr" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF -if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | - $EGREP "free" >/dev/null 2>&1; then : - -else - ac_cv_header_stdc=no -fi -rm -f conftest* - -fi - -if test $ac_cv_header_stdc = yes; then - # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. - if test "$cross_compiling" = yes; then : - : -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#if ((' ' & 0x0FF) == 0x020) -# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') -# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) -#else -# define ISLOWER(c) \ - (('a' <= (c) && (c) <= 'i') \ - || ('j' <= (c) && (c) <= 'r') \ - || ('s' <= (c) && (c) <= 'z')) -# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) -#endif - -#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) -int -main () -{ - int i; - for (i = 0; i < 256; i++) - if (XOR (islower (i), ISLOWER (i)) - || toupper (i) != TOUPPER (i)) - return 2; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - -else - ac_cv_header_stdc=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 -$as_echo "$ac_cv_header_stdc" >&6; } -if test $ac_cv_header_stdc = yes; then - -$as_echo "#define STDC_HEADERS 1" >>confdefs.h - -fi - - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 -$as_echo_n "checking whether byte ordering is bigendian... " >&6; } -if ${ac_cv_c_bigendian+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_bigendian=unknown -# See if sys/param.h defines the BYTE_ORDER macro. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ - -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - # It does; now see whether it defined to BIG_ENDIAN or not. -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -int -main () -{ - -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_bigendian=yes -else - ac_cv_c_bigendian=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -if test $ac_cv_c_bigendian = unknown; then -if test "$cross_compiling" = yes; then : - echo $ac_n "cross-compiling... " 2>&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_c_bigendian=no -else - ac_cv_c_bigendian=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } -if test $ac_cv_c_bigendian = unknown; then -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking to probe for byte ordering" >&5 -$as_echo_n "checking to probe for byte ordering... " >&6; } - -cat >conftest.c <&6 - ac_cv_c_bigendian=yes - fi - if test `grep -l LiTTleEnDian conftest.o` ; then - echo $ac_n ' little endian probe OK, ' 1>&6 - if test $ac_cv_c_bigendian = yes ; then - ac_cv_c_bigendian=unknown; - else - ac_cv_c_bigendian=no - fi - fi - echo $ac_n 'guessing bigendian ... ' >&6 - fi - fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 -$as_echo "$ac_cv_c_bigendian" >&6; } -fi -if test $ac_cv_c_bigendian = yes; then - -$as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h - - BYTEORDER=4321 -else - BYTEORDER=1234 -fi - -cat >>confdefs.h <<_ACEOF -#define BYTEORDER $BYTEORDER -_ACEOF - -if test $ac_cv_c_bigendian = unknown; then - as_fn_error please pre-set ac_cv_c_bigendian "unknown endianess - sorry" "$LINENO" 5 -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 -$as_echo_n "checking for an ANSI C-conforming const... " >&6; } -if ${ac_cv_c_const+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -/* FIXME: Include the comments suggested by Paul. */ -#ifndef __cplusplus - /* Ultrix mips cc rejects this. */ - typedef int charset[2]; - const charset cs; - /* SunOS 4.1.1 cc rejects this. */ - char const *const *pcpcc; - char **ppc; - /* NEC SVR4.0.2 mips cc rejects this. */ - struct point {int x, y;}; - static struct point const zero = {0,0}; - /* AIX XL C 1.02.0.0 rejects this. - It does not let you subtract one const X* pointer from another in - an arm of an if-expression whose if-part is not a constant - expression */ - const char *g = "string"; - pcpcc = &g + (g ? g-g : 0); - /* HPUX 7.0 cc rejects these. */ - ++pcpcc; - ppc = (char**) pcpcc; - pcpcc = (char const *const *) ppc; - { /* SCO 3.2v4 cc rejects this. */ - char *t; - char const *s = 0 ? (char *) 0 : (char const *) 0; - - *t++ = 0; - if (s) return 0; - } - { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ - int x[] = {25, 17}; - const int *foo = &x[0]; - ++foo; - } - { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ - typedef const int *iptr; - iptr p = 0; - ++p; - } - { /* AIX XL C 1.02.0.0 rejects this saying - "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ - struct s { int j; const int *ap[3]; }; - struct s *b; b->j = 5; - } - { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ - const int foo = 10; - if (!foo) return 0; - } - return !cs[0] && !zero.x; -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_const=yes -else - ac_cv_c_const=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 -$as_echo "$ac_cv_c_const" >&6; } -if test $ac_cv_c_const = no; then - -$as_echo "#define const /**/" >>confdefs.h - -fi - -ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" -if test "x$ac_cv_type_size_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define size_t unsigned int -_ACEOF - -fi - -for ac_func in memmove bcopy -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -if eval test \"x\$"$as_ac_var"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - -for ac_header in fcntl.h unistd.h -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - -ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" -if test "x$ac_cv_type_off_t" = xyes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define off_t long int -_ACEOF - -fi - - - - - for ac_header in $ac_header_list -do : - as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` -ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default -" -if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - - - - - - -for ac_func in getpagesize -do : - ac_fn_c_check_func "$LINENO" "getpagesize" "ac_cv_func_getpagesize" -if test "x$ac_cv_func_getpagesize" = xyes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETPAGESIZE 1 -_ACEOF - -fi -done - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mmap" >&5 -$as_echo_n "checking for working mmap... " >&6; } -if ${ac_cv_func_mmap_fixed_mapped+:} false; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_mmap_fixed_mapped=no -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -/* malloc might have been renamed as rpl_malloc. */ -#undef malloc - -/* Thanks to Mike Haertel and Jim Avera for this test. - Here is a matrix of mmap possibilities: - mmap private not fixed - mmap private fixed at somewhere currently unmapped - mmap private fixed at somewhere already mapped - mmap shared not fixed - mmap shared fixed at somewhere currently unmapped - mmap shared fixed at somewhere already mapped - For private mappings, we should verify that changes cannot be read() - back from the file, nor mmap's back from the file at a different - address. (There have been systems where private was not correctly - implemented like the infamous i386 svr4.0, and systems where the - VM page cache was not coherent with the file system buffer cache - like early versions of FreeBSD and possibly contemporary NetBSD.) - For shared mappings, we should conversely verify that changes get - propagated back to all the places they're supposed to be. - - Grep wants private fixed already mapped. - The main things grep needs to know about mmap are: - * does it exist and is it safe to write into the mmap'd area - * how to use it (BSD variants) */ - -#include -#include - -#if !defined STDC_HEADERS && !defined HAVE_STDLIB_H -char *malloc (); -#endif - -/* This mess was copied from the GNU getpagesize.h. */ -#ifndef HAVE_GETPAGESIZE -# ifdef _SC_PAGESIZE -# define getpagesize() sysconf(_SC_PAGESIZE) -# else /* no _SC_PAGESIZE */ -# ifdef HAVE_SYS_PARAM_H -# include -# ifdef EXEC_PAGESIZE -# define getpagesize() EXEC_PAGESIZE -# else /* no EXEC_PAGESIZE */ -# ifdef NBPG -# define getpagesize() NBPG * CLSIZE -# ifndef CLSIZE -# define CLSIZE 1 -# endif /* no CLSIZE */ -# else /* no NBPG */ -# ifdef NBPC -# define getpagesize() NBPC -# else /* no NBPC */ -# ifdef PAGESIZE -# define getpagesize() PAGESIZE -# endif /* PAGESIZE */ -# endif /* no NBPC */ -# endif /* no NBPG */ -# endif /* no EXEC_PAGESIZE */ -# else /* no HAVE_SYS_PARAM_H */ -# define getpagesize() 8192 /* punt totally */ -# endif /* no HAVE_SYS_PARAM_H */ -# endif /* no _SC_PAGESIZE */ - -#endif /* no HAVE_GETPAGESIZE */ - -int -main () -{ - char *data, *data2, *data3; - const char *cdata2; - int i, pagesize; - int fd, fd2; - - pagesize = getpagesize (); - - /* First, make a file with some known garbage in it. */ - data = (char *) malloc (pagesize); - if (!data) - return 1; - for (i = 0; i < pagesize; ++i) - *(data + i) = rand (); - umask (0); - fd = creat ("conftest.mmap", 0600); - if (fd < 0) - return 2; - if (write (fd, data, pagesize) != pagesize) - return 3; - close (fd); - - /* Next, check that the tail of a page is zero-filled. File must have - non-zero length, otherwise we risk SIGBUS for entire page. */ - fd2 = open ("conftest.txt", O_RDWR | O_CREAT | O_TRUNC, 0600); - if (fd2 < 0) - return 4; - cdata2 = ""; - if (write (fd2, cdata2, 1) != 1) - return 5; - data2 = (char *) mmap (0, pagesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd2, 0L); - if (data2 == MAP_FAILED) - return 6; - for (i = 0; i < pagesize; ++i) - if (*(data2 + i)) - return 7; - close (fd2); - if (munmap (data2, pagesize)) - return 8; - - /* Next, try to mmap the file at a fixed address which already has - something else allocated at it. If we can, also make sure that - we see the same garbage. */ - fd = open ("conftest.mmap", O_RDWR); - if (fd < 0) - return 9; - if (data2 != mmap (data2, pagesize, PROT_READ | PROT_WRITE, - MAP_PRIVATE | MAP_FIXED, fd, 0L)) - return 10; - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data2 + i)) - return 11; - - /* Finally, make sure that changes to the mapped area do not - percolate back to the file as seen by read(). (This is a bug on - some variants of i386 svr4.0.) */ - for (i = 0; i < pagesize; ++i) - *(data2 + i) = *(data2 + i) + 1; - data3 = (char *) malloc (pagesize); - if (!data3) - return 12; - if (read (fd, data3, pagesize) != pagesize) - return 13; - for (i = 0; i < pagesize; ++i) - if (*(data + i) != *(data3 + i)) - return 14; - close (fd); - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_mmap_fixed_mapped=yes -else - ac_cv_func_mmap_fixed_mapped=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_fixed_mapped" >&5 -$as_echo "$ac_cv_func_mmap_fixed_mapped" >&6; } -if test $ac_cv_func_mmap_fixed_mapped = yes; then - -$as_echo "#define HAVE_MMAP 1" >>confdefs.h - -fi -rm -f conftest.mmap conftest.txt - - -if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then - FILEMAP=unixfilemap -else - FILEMAP=readfilemap -fi - - - -# AC_CPP_FUNC -# ------------------ # -# Checks to see if ANSI C99 CPP variable __func__ works. -# If not, perhaps __FUNCTION__ works instead. -# If not, we'll just define __func__ to "". -# AC_CPP_FUNC - - case $ac_cv_prog_cc_stdc in #( - no) : - ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5 -$as_echo_n "checking for $CC option to accept ISO C99... " >&6; } -if ${ac_cv_prog_cc_c99+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c99=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -#include - -// Check varargs macros. These examples are taken from C99 6.10.3.5. -#define debug(...) fprintf (stderr, __VA_ARGS__) -#define showlist(...) puts (#__VA_ARGS__) -#define report(test,...) ((test) ? puts (#test) : printf (__VA_ARGS__)) -static void -test_varargs_macros (void) -{ - int x = 1234; - int y = 5678; - debug ("Flag"); - debug ("X = %d\n", x); - showlist (The first, second, and third items.); - report (x>y, "x is %d but y is %d", x, y); -} - -// Check long long types. -#define BIG64 18446744073709551615ull -#define BIG32 4294967295ul -#define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0) -#if !BIG_OK - your preprocessor is broken; -#endif -#if BIG_OK -#else - your preprocessor is broken; -#endif -static long long int bignum = -9223372036854775807LL; -static unsigned long long int ubignum = BIG64; - -struct incomplete_array -{ - int datasize; - double data[]; -}; - -struct named_init { - int number; - const wchar_t *name; - double average; -}; - -typedef const char *ccp; - -static inline int -test_restrict (ccp restrict text) -{ - // See if C++-style comments work. - // Iterate through items via the restricted pointer. - // Also check for declarations in for loops. - for (unsigned int i = 0; *(text+i) != '\0'; ++i) - continue; - return 0; -} - -// Check varargs and va_copy. -static void -test_varargs (const char *format, ...) -{ - va_list args; - va_start (args, format); - va_list args_copy; - va_copy (args_copy, args); - - const char *str; - int number; - float fnumber; - - while (*format) - { - switch (*format++) - { - case 's': // string - str = va_arg (args_copy, const char *); - break; - case 'd': // int - number = va_arg (args_copy, int); - break; - case 'f': // float - fnumber = va_arg (args_copy, double); - break; - default: - break; - } - } - va_end (args_copy); - va_end (args); -} - -int -main () -{ - - // Check bool. - _Bool success = false; - - // Check restrict. - if (test_restrict ("String literal") == 0) - success = true; - char *restrict newvar = "Another string"; - - // Check varargs. - test_varargs ("s, d' f .", "string", 65, 34.234); - test_varargs_macros (); - - // Check flexible array members. - struct incomplete_array *ia = - malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10)); - ia->datasize = 10; - for (int i = 0; i < ia->datasize; ++i) - ia->data[i] = i * 1.234; - - // Check named initializers. - struct named_init ni = { - .number = 34, - .name = L"Test wide string", - .average = 543.34343, - }; - - ni.number = 58; - - int dynamic_array[ni.number]; - dynamic_array[ni.number - 1] = 543; - - // work around unused variable warnings - return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x' - || dynamic_array[ni.number - 1] != 543); - - ; - return 0; -} -_ACEOF -for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -xc99=all -qlanglvl=extc99 -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c99=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c99" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c99" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c99" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5 -$as_echo "$ac_cv_prog_cc_c99" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c99" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99 -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 -$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } -if ${ac_cv_prog_cc_c89+:} false; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_prog_cc_c89=no -ac_save_CC=$CC -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -#include -/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ -struct buf { int x; }; -FILE * (*rcsopen) (struct buf *, struct stat *, int); -static char *e (p, i) - char **p; - int i; -{ - return p[i]; -} -static char *f (char * (*g) (char **, int), char **p, ...) -{ - char *s; - va_list v; - va_start (v,p); - s = g (p, va_arg (v,int)); - va_end (v); - return s; -} - -/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has - function prototypes and stuff, but not '\xHH' hex character constants. - These don't provoke an error unfortunately, instead are silently treated - as 'x'. The following induces an error, until -std is added to get - proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an - array size at least. It's necessary to write '\x00'==0 to get something - that's true only with -std. */ -int osf4_cc_array ['\x00' == 0 ? 1 : -1]; - -/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters - inside strings and character constants. */ -#define FOO(x) 'x' -int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; - -int test (int i, double x); -struct s1 {int (*f) (int a);}; -struct s2 {int (*f) (double a);}; -int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); -int argc; -char **argv; -int -main () -{ -return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; - ; - return 0; -} -_ACEOF -for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ - -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" -do - CC="$ac_save_CC $ac_arg" - if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_prog_cc_c89=$ac_arg -fi -rm -f core conftest.err conftest.$ac_objext - test "x$ac_cv_prog_cc_c89" != "xno" && break -done -rm -f conftest.$ac_ext -CC=$ac_save_CC - -fi -# AC_CACHE_VAL -case "x$ac_cv_prog_cc_c89" in - x) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; - xno) - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; - *) - CC="$CC $ac_cv_prog_cc_c89" - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 -$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; -esac -if test "x$ac_cv_prog_cc_c89" != xno; then : - ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89 -else - ac_cv_prog_cc_stdc=no -fi - -fi - ;; -esac - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5 -$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; } - if ${ac_cv_prog_cc_stdc+:} false; then : - $as_echo_n "(cached) " >&6 -fi - - case $ac_cv_prog_cc_stdc in #( - no) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 -$as_echo "unsupported" >&6; } ;; #( - '') : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 -$as_echo "none needed" >&6; } ;; #( - *) : - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5 -$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;; -esac - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C99-conforming __func__" >&5 -$as_echo_n "checking for an ANSI C99-conforming __func__... " >&6; } -if ${ac_cv_cpp_func+:} false; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -char *foo = __func__; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_cpp_func=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -int -main () -{ -char *foo = __FUNCTION__; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_cpp_func=__FUNCTION__ -else - ac_cv_cpp_func=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cpp_func" >&5 -$as_echo "$ac_cv_cpp_func" >&6; } -if test $ac_cv_cpp_func = __FUNCTION__; then - -$as_echo "#define __func__ __FUNCTION__" >>confdefs.h - -elif test $ac_cv_cpp_func = no; then - -$as_echo "#define __func__ \"\"" >>confdefs.h - -fi - - - - -$as_echo "#define XML_NS 1" >>confdefs.h - - -$as_echo "#define XML_DTD 1" >>confdefs.h - - -$as_echo "#define XML_CONTEXT_BYTES 1024" >>confdefs.h - - -ac_config_files="$ac_config_files Makefile expat.pc" - -cat >confcache <<\_ACEOF -# This file is a shell script that caches the results of configure -# tests run on this system so they can be shared between configure -# scripts and configure runs, see configure's option --config-cache. -# It is not useful on other systems. If it contains results you don't -# want to keep, you may remove or edit it. -# -# config.status only pays attention to the cache file if you give it -# the --recheck option to rerun configure. -# -# `ac_cv_env_foo' variables (set or unset) will be overridden when -# loading this file, other *unset* `ac_cv_foo' will be assigned the -# following values. - -_ACEOF - -# The following way of writing the cache mishandles newlines in values, -# but we know of no workaround that is simple, portable, and efficient. -# So, we kill variables containing newlines. -# Ultrix sh set writes to stderr and can't be redirected directly, -# and sets the high bit in the cache file unless we assign to the vars. -( - for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do - eval ac_val=\$$ac_var - case $ac_val in #( - *${as_nl}*) - case $ac_var in #( - *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 -$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; - esac - case $ac_var in #( - _ | IFS | as_nl) ;; #( - BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( - *) { eval $ac_var=; unset $ac_var;} ;; - esac ;; - esac - done - - (set) 2>&1 | - case $as_nl`(ac_space=' '; set) 2>&1` in #( - *${as_nl}ac_space=\ *) - # `set' does not quote correctly, so add quotes: double-quote - # substitution turns \\\\ into \\, and sed turns \\ into \. - sed -n \ - "s/'/'\\\\''/g; - s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" - ;; #( - *) - # `set' quotes correctly as required by POSIX, so do not add quotes. - sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" - ;; - esac | - sort -) | - sed ' - /^ac_cv_env_/b end - t clear - :clear - s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ - t end - s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ - :end' >>confcache -if diff "$cache_file" confcache >/dev/null 2>&1; then :; else - if test -w "$cache_file"; then - if test "x$cache_file" != "x/dev/null"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 -$as_echo "$as_me: updating cache $cache_file" >&6;} - if test ! -f "$cache_file" || test -h "$cache_file"; then - cat confcache >"$cache_file" - else - case $cache_file in #( - */* | ?:*) - mv -f confcache "$cache_file"$$ && - mv -f "$cache_file"$$ "$cache_file" ;; #( - *) - mv -f confcache "$cache_file" ;; - esac - fi - fi - else - { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 -$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} - fi -fi -rm -f confcache - -test "x$prefix" = xNONE && prefix=$ac_default_prefix -# Let make expand exec_prefix. -test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' - -DEFS=-DHAVE_CONFIG_H - -ac_libobjs= -ac_ltlibobjs= -U= -for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue - # 1. Remove the extension, and $U if already installed. - ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' - ac_i=`$as_echo "$ac_i" | sed "$ac_script"` - # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR - # will be set to the directory where LIBOBJS objects are built. - as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" - as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' -done -LIBOBJS=$ac_libobjs - -LTLIBOBJS=$ac_ltlibobjs - - - -: "${CONFIG_STATUS=./config.status}" -ac_write_fail=0 -ac_clean_files_save=$ac_clean_files -ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 -$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} -as_write_fail=0 -cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 -#! $SHELL -# Generated by $as_me. -# Run this file to recreate the current configuration. -# Compiler output produced by configure, useful for debugging -# configure, is in config.log if it exists. - -debug=false -ac_cs_recheck=false -ac_cs_silent=false - -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 -## -------------------- ## -## M4sh Initialization. ## -## -------------------- ## - -# Be more Bourne compatible -DUALCASE=1; export DUALCASE # for MKS sh -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : - emulate sh - NULLCMD=: - # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in #( - *posix*) : - set -o posix ;; #( - *) : - ;; -esac -fi - - -as_nl=' -' -export as_nl -# Printing a long string crashes Solaris 7 /usr/bin/printf. -as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo -as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo -# Prefer a ksh shell builtin over an external printf program on Solaris, -# but without wasting forks for bash or zsh. -if test -z "$BASH_VERSION$ZSH_VERSION" \ - && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='print -r --' - as_echo_n='print -rn --' -elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then - as_echo='printf %s\n' - as_echo_n='printf %s' -else - if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then - as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' - as_echo_n='/usr/ucb/echo -n' - else - as_echo_body='eval expr "X$1" : "X\\(.*\\)"' - as_echo_n_body='eval - arg=$1; - case $arg in #( - *"$as_nl"*) - expr "X$arg" : "X\\(.*\\)$as_nl"; - arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; - esac; - expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" - ' - export as_echo_n_body - as_echo_n='sh -c $as_echo_n_body as_echo' - fi - export as_echo_body - as_echo='sh -c $as_echo_body as_echo' -fi - -# The user is always right. -if test "${PATH_SEPARATOR+set}" != set; then - PATH_SEPARATOR=: - (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { - (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || - PATH_SEPARATOR=';' - } -fi - - -# IFS -# We need space, tab and new line, in precisely that order. Quoting is -# there to prevent editors from complaining about space-tab. -# (If _AS_PATH_WALK were called with IFS unset, it would disable word -# splitting by setting IFS to empty value.) -IFS=" "" $as_nl" - -# Find who we are. Look in the path if we contain no directory separator. -as_myself= -case $0 in #(( - *[\\/]* ) as_myself=$0 ;; - *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break - done -IFS=$as_save_IFS - - ;; -esac -# We did not find ourselves, most probably we were run as `sh COMMAND' -# in which case we are not to be found in the path. -if test "x$as_myself" = x; then - as_myself=$0 -fi -if test ! -f "$as_myself"; then - $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 - exit 1 -fi - -# Unset variables that we do not need and which cause bugs (e.g. in -# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" -# suppresses any "Segmentation fault" message there. '((' could -# trigger a bug in pdksh 5.2.14. -for as_var in BASH_ENV ENV MAIL MAILPATH -do eval test x\${$as_var+set} = xset \ - && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : -done -PS1='$ ' -PS2='> ' -PS4='+ ' - -# NLS nuisances. -LC_ALL=C -export LC_ALL -LANGUAGE=C -export LANGUAGE - -# CDPATH. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - - -# as_fn_error STATUS ERROR [LINENO LOG_FD] -# ---------------------------------------- -# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are -# provided, also output the error to LOG_FD, referencing LINENO. Then exit the -# script with STATUS, using 1 if that was 0. -as_fn_error () -{ - as_status=$1; test $as_status -eq 0 && as_status=1 - if test "$4"; then - as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 - fi - $as_echo "$as_me: error: $2" >&2 - as_fn_exit $as_status -} # as_fn_error - - -# as_fn_set_status STATUS -# ----------------------- -# Set $? to STATUS, without forking. -as_fn_set_status () -{ - return $1 -} # as_fn_set_status - -# as_fn_exit STATUS -# ----------------- -# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. -as_fn_exit () -{ - set +e - as_fn_set_status $1 - exit $1 -} # as_fn_exit - -# as_fn_unset VAR -# --------------- -# Portably unset VAR. -as_fn_unset () -{ - { eval $1=; unset $1;} -} -as_unset=as_fn_unset -# as_fn_append VAR VALUE -# ---------------------- -# Append the text in VALUE to the end of the definition contained in VAR. Take -# advantage of any shell optimizations that allow amortized linear growth over -# repeated appends, instead of the typical quadratic growth present in naive -# implementations. -if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : - eval 'as_fn_append () - { - eval $1+=\$2 - }' -else - as_fn_append () - { - eval $1=\$$1\$2 - } -fi # as_fn_append - -# as_fn_arith ARG... -# ------------------ -# Perform arithmetic evaluation on the ARGs, and store the result in the -# global $as_val. Take advantage of shells that can avoid forks. The arguments -# must be portable across $(()) and expr. -if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : - eval 'as_fn_arith () - { - as_val=$(( $* )) - }' -else - as_fn_arith () - { - as_val=`expr "$@" || test $? -eq 1` - } -fi # as_fn_arith - - -if expr a : '\(a\)' >/dev/null 2>&1 && - test "X`expr 00001 : '.*\(...\)'`" = X001; then - as_expr=expr -else - as_expr=false -fi - -if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then - as_basename=basename -else - as_basename=false -fi - -if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then - as_dirname=dirname -else - as_dirname=false -fi - -as_me=`$as_basename -- "$0" || -$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ - X"$0" : 'X\(//\)$' \| \ - X"$0" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X/"$0" | - sed '/^.*\/\([^/][^/]*\)\/*$/{ - s//\1/ - q - } - /^X\/\(\/\/\)$/{ - s//\1/ - q - } - /^X\/\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - -# Avoid depending upon Character Ranges. -as_cr_letters='abcdefghijklmnopqrstuvwxyz' -as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' -as_cr_Letters=$as_cr_letters$as_cr_LETTERS -as_cr_digits='0123456789' -as_cr_alnum=$as_cr_Letters$as_cr_digits - -ECHO_C= ECHO_N= ECHO_T= -case `echo -n x` in #((((( --n*) - case `echo 'xy\c'` in - *c*) ECHO_T=' ';; # ECHO_T is single tab character. - xy) ECHO_C='\c';; - *) echo `echo ksh88 bug on AIX 6.1` > /dev/null - ECHO_T=' ';; - esac;; -*) - ECHO_N='-n';; -esac - -rm -f conf$$ conf$$.exe conf$$.file -if test -d conf$$.dir; then - rm -f conf$$.dir/conf$$.file -else - rm -f conf$$.dir - mkdir conf$$.dir 2>/dev/null -fi -if (echo >conf$$.file) 2>/dev/null; then - if ln -s conf$$.file conf$$ 2>/dev/null; then - as_ln_s='ln -s' - # ... but there are two gotchas: - # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. - # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -p'. - ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -p' - elif ln conf$$.file conf$$ 2>/dev/null; then - as_ln_s=ln - else - as_ln_s='cp -p' - fi -else - as_ln_s='cp -p' -fi -rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file -rmdir conf$$.dir 2>/dev/null - - -# as_fn_mkdir_p -# ------------- -# Create "$as_dir" as a directory, including parents if necessary. -as_fn_mkdir_p () -{ - - case $as_dir in #( - -*) as_dir=./$as_dir;; - esac - test -d "$as_dir" || eval $as_mkdir_p || { - as_dirs= - while :; do - case $as_dir in #( - *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( - *) as_qdir=$as_dir;; - esac - as_dirs="'$as_qdir' $as_dirs" - as_dir=`$as_dirname -- "$as_dir" || -$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$as_dir" : 'X\(//\)[^/]' \| \ - X"$as_dir" : 'X\(//\)$' \| \ - X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$as_dir" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - test -d "$as_dir" && break - done - test -z "$as_dirs" || eval "mkdir $as_dirs" - } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" - - -} # as_fn_mkdir_p -if mkdir -p . 2>/dev/null; then - as_mkdir_p='mkdir -p "$as_dir"' -else - test -d ./-p && rmdir ./-p - as_mkdir_p=false -fi - -if test -x / >/dev/null 2>&1; then - as_test_x='test -x' -else - if ls -dL / >/dev/null 2>&1; then - as_ls_L_option=L - else - as_ls_L_option= - fi - as_test_x=' - eval sh -c '\'' - if test -d "$1"; then - test -d "$1/."; - else - case $1 in #( - -*)set "./$1";; - esac; - case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( - ???[sx]*):;;*)false;;esac;fi - '\'' sh - ' -fi -as_executable_p=$as_test_x - -# Sed expression to map a string onto a valid CPP name. -as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" - -# Sed expression to map a string onto a valid variable name. -as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" - - -exec 6>&1 -## ----------------------------------- ## -## Main body of $CONFIG_STATUS script. ## -## ----------------------------------- ## -_ASEOF -test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# Save the log message, to keep $0 and so on meaningful, and to -# report actual input values of CONFIG_FILES etc. instead of their -# values after options handling. -ac_log=" -This file was extended by expat $as_me 2.1.0, which was -generated by GNU Autoconf 2.68. Invocation command line was - - CONFIG_FILES = $CONFIG_FILES - CONFIG_HEADERS = $CONFIG_HEADERS - CONFIG_LINKS = $CONFIG_LINKS - CONFIG_COMMANDS = $CONFIG_COMMANDS - $ $0 $@ - -on `(hostname || uname -n) 2>/dev/null | sed 1q` -" - -_ACEOF - -case $ac_config_files in *" -"*) set x $ac_config_files; shift; ac_config_files=$*;; -esac - -case $ac_config_headers in *" -"*) set x $ac_config_headers; shift; ac_config_headers=$*;; -esac - - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# Files that config.status was made for. -config_files="$ac_config_files" -config_headers="$ac_config_headers" -config_commands="$ac_config_commands" - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -ac_cs_usage="\ -\`$as_me' instantiates files and other configuration actions -from templates according to the current configuration. Unless the files -and actions are specified as TAGs, all are instantiated by default. - -Usage: $0 [OPTION]... [TAG]... - - -h, --help print this help, then exit - -V, --version print version number and configuration settings, then exit - --config print configuration, then exit - -q, --quiet, --silent - do not print progress messages - -d, --debug don't remove temporary files - --recheck update $as_me by reconfiguring in the same conditions - --file=FILE[:TEMPLATE] - instantiate the configuration file FILE - --header=FILE[:TEMPLATE] - instantiate the configuration header FILE - -Configuration files: -$config_files - -Configuration headers: -$config_headers - -Configuration commands: -$config_commands - -Report bugs to ." - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" -ac_cs_version="\\ -expat config.status 2.1.0 -configured by $0, generated by GNU Autoconf 2.68, - with options \\"\$ac_cs_config\\" - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.status script is free software; the Free Software Foundation -gives unlimited permission to copy, distribute and modify it." - -ac_pwd='$ac_pwd' -srcdir='$srcdir' -INSTALL='$INSTALL' -AWK='$AWK' -test -n "\$AWK" || AWK=awk -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# The default lists apply if the user does not specify any file. -ac_need_defaults=: -while test $# != 0 -do - case $1 in - --*=?*) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` - ac_shift=: - ;; - --*=) - ac_option=`expr "X$1" : 'X\([^=]*\)='` - ac_optarg= - ac_shift=: - ;; - *) - ac_option=$1 - ac_optarg=$2 - ac_shift=shift - ;; - esac - - case $ac_option in - # Handling of the options. - -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) - ac_cs_recheck=: ;; - --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) - $as_echo "$ac_cs_version"; exit ;; - --config | --confi | --conf | --con | --co | --c ) - $as_echo "$ac_cs_config"; exit ;; - --debug | --debu | --deb | --de | --d | -d ) - debug=: ;; - --file | --fil | --fi | --f ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - '') as_fn_error $? "missing file argument" ;; - esac - as_fn_append CONFIG_FILES " '$ac_optarg'" - ac_need_defaults=false;; - --header | --heade | --head | --hea ) - $ac_shift - case $ac_optarg in - *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; - esac - as_fn_append CONFIG_HEADERS " '$ac_optarg'" - ac_need_defaults=false;; - --he | --h) - # Conflict between --help and --header - as_fn_error $? "ambiguous option: \`$1' -Try \`$0 --help' for more information.";; - --help | --hel | -h ) - $as_echo "$ac_cs_usage"; exit ;; - -q | -quiet | --quiet | --quie | --qui | --qu | --q \ - | -silent | --silent | --silen | --sile | --sil | --si | --s) - ac_cs_silent=: ;; - - # This is an error. - -*) as_fn_error $? "unrecognized option: \`$1' -Try \`$0 --help' for more information." ;; - - *) as_fn_append ac_config_targets " $1" - ac_need_defaults=false ;; - - esac - shift -done - -ac_configure_extra_args= - -if $ac_cs_silent; then - exec 6>/dev/null - ac_configure_extra_args="$ac_configure_extra_args --silent" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -if \$ac_cs_recheck; then - set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion - shift - \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 - CONFIG_SHELL='$SHELL' - export CONFIG_SHELL - exec "\$@" -fi - -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -exec 5>>config.log -{ - echo - sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX -## Running $as_me. ## -_ASBOX - $as_echo "$ac_log" -} >&5 - -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -# -# INIT-COMMANDS -# - - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`' -DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' -OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' -macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' -macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' -enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' -enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' -pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' -enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' -SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' -ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' -host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' -host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' -host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' -build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' -build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' -build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' -SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' -Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' -GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' -EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' -FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' -LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' -NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' -LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' -max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' -ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' -exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' -lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' -lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' -lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' -lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' -lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' -reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' -reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' -deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' -file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' -file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' -want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' -sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' -AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' -AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' -archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' -STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' -RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' -old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' -old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' -lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' -CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' -CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' -compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' -GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' -nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' -lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' -objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' -MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' -need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' -MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' -DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' -NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' -LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' -OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' -OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' -libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' -shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' -extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' -compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' -archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' -module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' -with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' -no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' -hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' -hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' -inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' -link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' -always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' -exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' -include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' -prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' -postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' -file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' -variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' -need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' -need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' -version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' -runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' -shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' -libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' -library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' -soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' -install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' -postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' -postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' -finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' -finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' -hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' -sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' -sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' -hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' -enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' -enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' -old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' -striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`' -predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`' -postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`' -predeps='`$ECHO "$predeps" | $SED "$delay_single_quote_subst"`' -postdeps='`$ECHO "$postdeps" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_path='`$ECHO "$compiler_lib_search_path" | $SED "$delay_single_quote_subst"`' -LD_CXX='`$ECHO "$LD_CXX" | $SED "$delay_single_quote_subst"`' -reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`' -reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' -compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`' -GCC_CXX='`$ECHO "$GCC_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_no_builtin_flag_CXX='`$ECHO "$lt_prog_compiler_no_builtin_flag_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`' -lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $SED "$delay_single_quote_subst"`' -lt_cv_prog_compiler_c_o_CXX='`$ECHO "$lt_cv_prog_compiler_c_o_CXX" | $SED "$delay_single_quote_subst"`' -archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`' -enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`' -export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_from_new_cmds_CXX='`$ECHO "$old_archive_from_new_cmds_CXX" | $SED "$delay_single_quote_subst"`' -old_archive_from_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`' -archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`' -archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' -module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`' -module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`' -with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`' -allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' -no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_flag_spec_ld_CXX='`$ECHO "$hardcode_libdir_flag_spec_ld_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`' -inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`' -link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`' -always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`' -export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`' -exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`' -include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`' -prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`' -postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`' -file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`' -hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`' -predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`' -postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`' -predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`' -postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`' -compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`' - -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in AS \ -DLLTOOL \ -OBJDUMP \ -SHELL \ -ECHO \ -SED \ -GREP \ -EGREP \ -FGREP \ -LD \ -NM \ -LN_S \ -lt_SP2NL \ -lt_NL2SP \ -reload_flag \ -deplibs_check_method \ -file_magic_cmd \ -file_magic_glob \ -want_nocaseglob \ -sharedlib_from_linklib_cmd \ -AR \ -AR_FLAGS \ -archiver_list_spec \ -STRIP \ -RANLIB \ -CC \ -CFLAGS \ -compiler \ -lt_cv_sys_global_symbol_pipe \ -lt_cv_sys_global_symbol_to_cdecl \ -lt_cv_sys_global_symbol_to_c_name_address \ -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ -nm_file_list_spec \ -lt_prog_compiler_no_builtin_flag \ -lt_prog_compiler_pic \ -lt_prog_compiler_wl \ -lt_prog_compiler_static \ -lt_cv_prog_compiler_c_o \ -need_locks \ -MANIFEST_TOOL \ -DSYMUTIL \ -NMEDIT \ -LIPO \ -OTOOL \ -OTOOL64 \ -shrext_cmds \ -export_dynamic_flag_spec \ -whole_archive_flag_spec \ -compiler_needs_object \ -with_gnu_ld \ -allow_undefined_flag \ -no_undefined_flag \ -hardcode_libdir_flag_spec \ -hardcode_libdir_flag_spec_ld \ -hardcode_libdir_separator \ -exclude_expsyms \ -include_expsyms \ -file_list_spec \ -variables_saved_for_relink \ -libname_spec \ -library_names_spec \ -soname_spec \ -install_override_mode \ -finish_eval \ -old_striplib \ -striplib \ -compiler_lib_search_dirs \ -predep_objects \ -postdep_objects \ -predeps \ -postdeps \ -compiler_lib_search_path \ -LD_CXX \ -reload_flag_CXX \ -compiler_CXX \ -lt_prog_compiler_no_builtin_flag_CXX \ -lt_prog_compiler_pic_CXX \ -lt_prog_compiler_wl_CXX \ -lt_prog_compiler_static_CXX \ -lt_cv_prog_compiler_c_o_CXX \ -export_dynamic_flag_spec_CXX \ -whole_archive_flag_spec_CXX \ -compiler_needs_object_CXX \ -with_gnu_ld_CXX \ -allow_undefined_flag_CXX \ -no_undefined_flag_CXX \ -hardcode_libdir_flag_spec_CXX \ -hardcode_libdir_flag_spec_ld_CXX \ -hardcode_libdir_separator_CXX \ -exclude_expsyms_CXX \ -include_expsyms_CXX \ -file_list_spec_CXX \ -compiler_lib_search_dirs_CXX \ -predep_objects_CXX \ -postdep_objects_CXX \ -predeps_CXX \ -postdeps_CXX \ -compiler_lib_search_path_CXX; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in reload_cmds \ -old_postinstall_cmds \ -old_postuninstall_cmds \ -old_archive_cmds \ -extract_expsyms_cmds \ -old_archive_from_new_cmds \ -old_archive_from_expsyms_cmds \ -archive_cmds \ -archive_expsym_cmds \ -module_cmds \ -module_expsym_cmds \ -export_symbols_cmds \ -prelink_cmds \ -postlink_cmds \ -postinstall_cmds \ -postuninstall_cmds \ -finish_cmds \ -sys_lib_search_path_spec \ -sys_lib_dlsearch_path_spec \ -reload_cmds_CXX \ -old_archive_cmds_CXX \ -old_archive_from_new_cmds_CXX \ -old_archive_from_expsyms_cmds_CXX \ -archive_cmds_CXX \ -archive_expsym_cmds_CXX \ -module_cmds_CXX \ -module_expsym_cmds_CXX \ -export_symbols_cmds_CXX \ -prelink_cmds_CXX \ -postlink_cmds_CXX; do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[\\\\\\\`\\"\\\$]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -ac_aux_dir='$ac_aux_dir' -xsi_shell='$xsi_shell' -lt_shell_append='$lt_shell_append' - -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - - - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile' - - - - - - -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - -# Handling of arguments. -for ac_config_target in $ac_config_targets -do - case $ac_config_target in - "expat_config.h") CONFIG_HEADERS="$CONFIG_HEADERS expat_config.h" ;; - "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; - "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; - "expat.pc") CONFIG_FILES="$CONFIG_FILES expat.pc" ;; - - *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; - esac -done - - -# If the user did not use the arguments to specify the items to instantiate, -# then the envvar interface is used. Set only those that are not. -# We use the long form for the default assignment because of an extremely -# bizarre bug on SunOS 4.1.3. -if $ac_need_defaults; then - test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files - test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers - test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands -fi - -# Have a temporary directory for convenience. Make it in the build tree -# simply because there is no reason against having it here, and in addition, -# creating and moving files from /tmp can sometimes cause problems. -# Hook for its removal unless debugging. -# Note that there is a small window in which the directory will not be cleaned: -# after its creation but before its name has been assigned to `$tmp'. -$debug || -{ - tmp= ac_tmp= - trap 'exit_status=$? - : "${ac_tmp:=$tmp}" - { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status -' 0 - trap 'as_fn_exit 1' 1 2 13 15 -} -# Create a (secure) tmp directory for tmp files. - -{ - tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && - test -d "$tmp" -} || -{ - tmp=./conf$$-$RANDOM - (umask 077 && mkdir "$tmp") -} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 -ac_tmp=$tmp - -# Set up the scripts for CONFIG_FILES section. -# No need to generate them if there are no CONFIG_FILES. -# This happens for instance with `./config.status config.h'. -if test -n "$CONFIG_FILES"; then - - -ac_cr=`echo X | tr X '\015'` -# On cygwin, bash can eat \r inside `` if the user requested igncr. -# But we know of no other shell where ac_cr would be empty at this -# point, so we can use a bashism as a fallback. -if test "x$ac_cr" = x; then - eval ac_cr=\$\'\\r\' -fi -ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` -if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then - ac_cs_awk_cr='\\r' -else - ac_cs_awk_cr=$ac_cr -fi - -echo 'BEGIN {' >"$ac_tmp/subs1.awk" && -_ACEOF - - -{ - echo "cat >conf$$subs.awk <<_ACEOF" && - echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && - echo "_ACEOF" -} >conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 -ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` -ac_delim='%!_!# ' -for ac_last_try in false false false false false :; do - . ./conf$$subs.sh || - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - - ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` - if test $ac_delim_n = $ac_delim_num; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done -rm -f conf$$subs.sh - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && -_ACEOF -sed -n ' -h -s/^/S["/; s/!.*/"]=/ -p -g -s/^[^!]*!// -:repl -t repl -s/'"$ac_delim"'$// -t delim -:nl -h -s/\(.\{148\}\)..*/\1/ -t more1 -s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ -p -n -b repl -:more1 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t nl -:delim -h -s/\(.\{148\}\)..*/\1/ -t more2 -s/["\\]/\\&/g; s/^/"/; s/$/"/ -p -b -:more2 -s/["\\]/\\&/g; s/^/"/; s/$/"\\/ -p -g -s/.\{148\}// -t delim -' >$CONFIG_STATUS || ac_write_fail=1 -rm -f conf$$subs.awk -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -_ACAWK -cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && - for (key in S) S_is_set[key] = 1 - FS = "" - -} -{ - line = $ 0 - nfields = split(line, field, "@") - substed = 0 - len = length(field[1]) - for (i = 2; i < nfields; i++) { - key = field[i] - keylen = length(key) - if (S_is_set[key]) { - value = S[key] - line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) - len += length(value) + length(field[++i]) - substed = 1 - } else - len += 1 + keylen - } - - print line -} - -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then - sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" -else - cat -fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ - || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 -_ACEOF - -# VPATH may cause trouble with some makes, so we remove sole $(srcdir), -# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and -# trailing colons and then remove the whole line if VPATH becomes empty -# (actually we leave an empty line to preserve line numbers). -if test "x$srcdir" = x.; then - ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ -h -s/// -s/^/:/ -s/[ ]*$/:/ -s/:\$(srcdir):/:/g -s/:\${srcdir}:/:/g -s/:@srcdir@:/:/g -s/^:*// -s/:*$// -x -s/\(=[ ]*\).*/\1/ -G -s/\n// -s/^[^=]*=[ ]*$// -}' -fi - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -fi # test -n "$CONFIG_FILES" - -# Set up the scripts for CONFIG_HEADERS section. -# No need to generate them if there are no CONFIG_HEADERS. -# This happens for instance with `./config.status Makefile'. -if test -n "$CONFIG_HEADERS"; then -cat >"$ac_tmp/defines.awk" <<\_ACAWK || -BEGIN { -_ACEOF - -# Transform confdefs.h into an awk script `defines.awk', embedded as -# here-document in config.status, that substitutes the proper values into -# config.h.in to produce config.h. - -# Create a delimiter string that does not exist in confdefs.h, to ease -# handling of long lines. -ac_delim='%!_!# ' -for ac_last_try in false false :; do - ac_tt=`sed -n "/$ac_delim/p" confdefs.h` - if test -z "$ac_tt"; then - break - elif $ac_last_try; then - as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 - else - ac_delim="$ac_delim!$ac_delim _$ac_delim!! " - fi -done - -# For the awk script, D is an array of macro values keyed by name, -# likewise P contains macro parameters if any. Preserve backslash -# newline sequences. - -ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* -sed -n ' -s/.\{148\}/&'"$ac_delim"'/g -t rset -:rset -s/^[ ]*#[ ]*define[ ][ ]*/ / -t def -d -:def -s/\\$// -t bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3"/p -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p -d -:bsnl -s/["\\]/\\&/g -s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ -D["\1"]=" \3\\\\\\n"\\/p -t cont -s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p -t cont -d -:cont -n -s/.\{148\}/&'"$ac_delim"'/g -t clear -:clear -s/\\$// -t bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/"/p -d -:bsnlc -s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p -b cont -' >$CONFIG_STATUS || ac_write_fail=1 - -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - for (key in D) D_is_set[key] = 1 - FS = "" -} -/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { - line = \$ 0 - split(line, arg, " ") - if (arg[1] == "#") { - defundef = arg[2] - mac1 = arg[3] - } else { - defundef = substr(arg[1], 2) - mac1 = arg[2] - } - split(mac1, mac2, "(") #) - macro = mac2[1] - prefix = substr(line, 1, index(line, defundef) - 1) - if (D_is_set[macro]) { - # Preserve the white space surrounding the "#". - print prefix "define", macro P[macro] D[macro] - next - } else { - # Replace #undef with comments. This is necessary, for example, - # in the case of _POSIX_SOURCE, which is predefined and required - # on some systems where configure will not decide to define it. - if (defundef == "undef") { - print "/*", prefix defundef, macro, "*/" - next - } - } -} -{ print } -_ACAWK -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 - as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 -fi # test -n "$CONFIG_HEADERS" - - -eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" -shift -for ac_tag -do - case $ac_tag in - :[FHLC]) ac_mode=$ac_tag; continue;; - esac - case $ac_mode$ac_tag in - :[FHL]*:*);; - :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; - :[FH]-) ac_tag=-:-;; - :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; - esac - ac_save_IFS=$IFS - IFS=: - set x $ac_tag - IFS=$ac_save_IFS - shift - ac_file=$1 - shift - - case $ac_mode in - :L) ac_source=$1;; - :[FH]) - ac_file_inputs= - for ac_f - do - case $ac_f in - -) ac_f="$ac_tmp/stdin";; - *) # Look for the file first in the build tree, then in the source tree - # (if the path is not absolute). The absolute path cannot be DOS-style, - # because $ac_f cannot contain `:'. - test -f "$ac_f" || - case $ac_f in - [\\/$]*) false;; - *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; - esac || - as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; - esac - case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac - as_fn_append ac_file_inputs " '$ac_f'" - done - - # Let's still pretend it is `configure' which instantiates (i.e., don't - # use $as_me), people would be surprised to read: - # /* config.h. Generated by config.status. */ - configure_input='Generated from '` - $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' - `' by configure.' - if test x"$ac_file" != x-; then - configure_input="$ac_file. $configure_input" - { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 -$as_echo "$as_me: creating $ac_file" >&6;} - fi - # Neutralize special characters interpreted by sed in replacement strings. - case $configure_input in #( - *\&* | *\|* | *\\* ) - ac_sed_conf_input=`$as_echo "$configure_input" | - sed 's/[\\\\&|]/\\\\&/g'`;; #( - *) ac_sed_conf_input=$configure_input;; - esac - - case $ac_tag in - *:-:* | *:-) cat >"$ac_tmp/stdin" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; - esac - ;; - esac - - ac_dir=`$as_dirname -- "$ac_file" || -$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$ac_file" : 'X\(//\)[^/]' \| \ - X"$ac_file" : 'X\(//\)$' \| \ - X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$ac_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - as_dir="$ac_dir"; as_fn_mkdir_p - ac_builddir=. - -case "$ac_dir" in -.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; -*) - ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` - # A ".." for each directory in $ac_dir_suffix. - ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` - case $ac_top_builddir_sub in - "") ac_top_builddir_sub=. ac_top_build_prefix= ;; - *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; - esac ;; -esac -ac_abs_top_builddir=$ac_pwd -ac_abs_builddir=$ac_pwd$ac_dir_suffix -# for backward compatibility: -ac_top_builddir=$ac_top_build_prefix - -case $srcdir in - .) # We are building in place. - ac_srcdir=. - ac_top_srcdir=$ac_top_builddir_sub - ac_abs_top_srcdir=$ac_pwd ;; - [\\/]* | ?:[\\/]* ) # Absolute name. - ac_srcdir=$srcdir$ac_dir_suffix; - ac_top_srcdir=$srcdir - ac_abs_top_srcdir=$srcdir ;; - *) # Relative name. - ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix - ac_top_srcdir=$ac_top_build_prefix$srcdir - ac_abs_top_srcdir=$ac_pwd/$srcdir ;; -esac -ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix - - - case $ac_mode in - :F) - # - # CONFIG_FILE - # - - case $INSTALL in - [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; - *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; - esac -_ACEOF - -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -# If the template does not know about datarootdir, expand it. -# FIXME: This hack should be removed a few years after 2.60. -ac_datarootdir_hack=; ac_datarootdir_seen= -ac_sed_dataroot=' -/datarootdir/ { - p - q -} -/@datadir@/p -/@docdir@/p -/@infodir@/p -/@localedir@/p -/@mandir@/p' -case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in -*datarootdir*) ac_datarootdir_seen=yes;; -*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 -$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} -_ACEOF -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 - ac_datarootdir_hack=' - s&@datadir@&$datadir&g - s&@docdir@&$docdir&g - s&@infodir@&$infodir&g - s&@localedir@&$localedir&g - s&@mandir@&$mandir&g - s&\\\${datarootdir}&$datarootdir&g' ;; -esac -_ACEOF - -# Neutralize VPATH when `$srcdir' = `.'. -# Shell code in configure.ac might set extrasub. -# FIXME: do we really want to maintain this feature? -cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 -ac_sed_extra="$ac_vpsub -$extrasub -_ACEOF -cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 -:t -/@[a-zA-Z_][a-zA-Z_0-9]*@/!b -s|@configure_input@|$ac_sed_conf_input|;t t -s&@top_builddir@&$ac_top_builddir_sub&;t t -s&@top_build_prefix@&$ac_top_build_prefix&;t t -s&@srcdir@&$ac_srcdir&;t t -s&@abs_srcdir@&$ac_abs_srcdir&;t t -s&@top_srcdir@&$ac_top_srcdir&;t t -s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t -s&@builddir@&$ac_builddir&;t t -s&@abs_builddir@&$ac_abs_builddir&;t t -s&@abs_top_builddir@&$ac_abs_top_builddir&;t t -s&@INSTALL@&$ac_INSTALL&;t t -$ac_datarootdir_hack -" -eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ - >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - -test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && - { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && - { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ - "$ac_tmp/out"`; test -z "$ac_out"; } && - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&5 -$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' -which seems to be undefined. Please make sure it is defined" >&2;} - - rm -f "$ac_tmp/stdin" - case $ac_file in - -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; - *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; - esac \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - ;; - :H) - # - # CONFIG_HEADER - # - if test x"$ac_file" != x-; then - { - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" - } >"$ac_tmp/config.h" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then - { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 -$as_echo "$as_me: $ac_file is unchanged" >&6;} - else - rm -f "$ac_file" - mv "$ac_tmp/config.h" "$ac_file" \ - || as_fn_error $? "could not create $ac_file" "$LINENO" 5 - fi - else - $as_echo "/* $configure_input */" \ - && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ - || as_fn_error $? "could not create -" "$LINENO" 5 - fi - ;; - - :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 -$as_echo "$as_me: executing $ac_file commands" >&6;} - ;; - esac - - - case $ac_file$ac_mode in - "libtool":C) - - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - - -# The names of the tagged configurations supported by this script. -available_tags="CXX " - -# ### BEGIN LIBTOOL CONFIG - -# Assembler program. -AS=$lt_AS - -# DLL creation program. -DLLTOOL=$lt_DLLTOOL - -# Object dumper program. -OBJDUMP=$lt_OBJDUMP - -# Which release of libtool.m4 was used? -macro_version=$macro_version -macro_revision=$macro_revision - -# Whether or not to build shared libraries. -build_libtool_libs=$enable_shared - -# Whether or not to build static libraries. -build_old_libs=$enable_static - -# What type of objects to build. -pic_mode=$pic_mode - -# Whether or not to optimize for fast installation. -fast_install=$enable_fast_install - -# Shell to use when invoking shell scripts. -SHELL=$lt_SHELL - -# An echo program that protects backslashes. -ECHO=$lt_ECHO - -# The host system. -host_alias=$host_alias -host=$host -host_os=$host_os - -# The build system. -build_alias=$build_alias -build=$build -build_os=$build_os - -# A sed program that does not truncate output. -SED=$lt_SED - -# Sed that helps us avoid accidentally triggering echo(1) options like -n. -Xsed="\$SED -e 1s/^X//" - -# A grep program that handles long lines. -GREP=$lt_GREP - -# An ERE matcher. -EGREP=$lt_EGREP - -# A literal string matcher. -FGREP=$lt_FGREP - -# A BSD- or MS-compatible name lister. -NM=$lt_NM - -# Whether we need soft or hard links. -LN_S=$lt_LN_S - -# What is the maximum length of a command? -max_cmd_len=$max_cmd_len - -# Object file suffix (normally "o"). -objext=$ac_objext - -# Executable file suffix (normally ""). -exeext=$exeext - -# whether the shell understands "unset". -lt_unset=$lt_unset - -# turn spaces into newlines. -SP2NL=$lt_lt_SP2NL - -# turn newlines into spaces. -NL2SP=$lt_lt_NL2SP - -# convert \$build file names to \$host format. -to_host_file_cmd=$lt_cv_to_host_file_cmd - -# convert \$build files to toolchain format. -to_tool_file_cmd=$lt_cv_to_tool_file_cmd - -# Method to check whether dependent libraries are shared objects. -deplibs_check_method=$lt_deplibs_check_method - -# Command to use when deplibs_check_method = "file_magic". -file_magic_cmd=$lt_file_magic_cmd - -# How to find potential files when deplibs_check_method = "file_magic". -file_magic_glob=$lt_file_magic_glob - -# Find potential files using nocaseglob when deplibs_check_method = "file_magic". -want_nocaseglob=$lt_want_nocaseglob - -# Command to associate shared and link libraries. -sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd - -# The archiver. -AR=$lt_AR - -# Flags to create an archive. -AR_FLAGS=$lt_AR_FLAGS - -# How to feed a file listing to the archiver. -archiver_list_spec=$lt_archiver_list_spec - -# A symbol stripping program. -STRIP=$lt_STRIP - -# Commands used to install an old-style archive. -RANLIB=$lt_RANLIB -old_postinstall_cmds=$lt_old_postinstall_cmds -old_postuninstall_cmds=$lt_old_postuninstall_cmds - -# Whether to use a lock for old archive extraction. -lock_old_archive_extraction=$lock_old_archive_extraction - -# A C compiler. -LTCC=$lt_CC - -# LTCC compiler flags. -LTCFLAGS=$lt_CFLAGS - -# Take the output of nm and produce a listing of raw symbols and C names. -global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe - -# Transform the output of nm in a proper C declaration. -global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl - -# Transform the output of nm in a C name address pair. -global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address - -# Transform the output of nm in a C name address pair when lib prefix is needed. -global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix - -# Specify filename containing input files for \$NM. -nm_file_list_spec=$lt_nm_file_list_spec - -# The root where to search for dependent libraries,and in which our libraries should be installed. -lt_sysroot=$lt_sysroot - -# The name of the directory that contains temporary libtool files. -objdir=$objdir - -# Used to examine libraries when file_magic_cmd begins with "file". -MAGIC_CMD=$MAGIC_CMD - -# Must we lock files when doing compilation? -need_locks=$lt_need_locks - -# Manifest tool. -MANIFEST_TOOL=$lt_MANIFEST_TOOL - -# Tool to manipulate archived DWARF debug symbol files on Mac OS X. -DSYMUTIL=$lt_DSYMUTIL - -# Tool to change global to local symbols on Mac OS X. -NMEDIT=$lt_NMEDIT - -# Tool to manipulate fat objects and archives on Mac OS X. -LIPO=$lt_LIPO - -# ldd/readelf like tool for Mach-O binaries on Mac OS X. -OTOOL=$lt_OTOOL - -# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. -OTOOL64=$lt_OTOOL64 - -# Old archive suffix (normally "a"). -libext=$libext - -# Shared library suffix (normally ".so"). -shrext_cmds=$lt_shrext_cmds - -# The commands to extract the exported symbol list from a shared archive. -extract_expsyms_cmds=$lt_extract_expsyms_cmds - -# Variables whose values should be saved in libtool wrapper scripts and -# restored at link time. -variables_saved_for_relink=$lt_variables_saved_for_relink - -# Do we need the "lib" prefix for modules? -need_lib_prefix=$need_lib_prefix - -# Do we need a version for libraries? -need_version=$need_version - -# Library versioning type. -version_type=$version_type - -# Shared library runtime path variable. -runpath_var=$runpath_var - -# Shared library path variable. -shlibpath_var=$shlibpath_var - -# Is shlibpath searched before the hard-coded library search path? -shlibpath_overrides_runpath=$shlibpath_overrides_runpath - -# Format of library name prefix. -libname_spec=$lt_libname_spec - -# List of archive names. First name is the real one, the rest are links. -# The last name is the one that the linker finds with -lNAME -library_names_spec=$lt_library_names_spec - -# The coded name of the library, if different from the real name. -soname_spec=$lt_soname_spec - -# Permission mode override for installation of shared libraries. -install_override_mode=$lt_install_override_mode - -# Command to use after installation of a shared archive. -postinstall_cmds=$lt_postinstall_cmds - -# Command to use after uninstallation of a shared archive. -postuninstall_cmds=$lt_postuninstall_cmds - -# Commands used to finish a libtool library installation in a directory. -finish_cmds=$lt_finish_cmds - -# As "finish_cmds", except a single script fragment to be evaled but -# not shown. -finish_eval=$lt_finish_eval - -# Whether we should hardcode library paths into libraries. -hardcode_into_libs=$hardcode_into_libs - -# Compile-time system search path for libraries. -sys_lib_search_path_spec=$lt_sys_lib_search_path_spec - -# Run-time system search path for libraries. -sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec - -# Whether dlopen is supported. -dlopen_support=$enable_dlopen - -# Whether dlopen of programs is supported. -dlopen_self=$enable_dlopen_self - -# Whether dlopen of statically linked programs is supported. -dlopen_self_static=$enable_dlopen_self_static - -# Commands to strip libraries. -old_striplib=$lt_old_striplib -striplib=$lt_striplib - - -# The linker used to build libraries. -LD=$lt_LD - -# How to create reloadable object files. -reload_flag=$lt_reload_flag -reload_cmds=$lt_reload_cmds - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds - -# A language specific compiler. -CC=$lt_compiler - -# Is the compiler the GNU compiler? -with_gcc=$GCC - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds -archive_expsym_cmds=$lt_archive_expsym_cmds - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds -module_expsym_cmds=$lt_module_expsym_cmds - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects -postdep_objects=$lt_postdep_objects -predeps=$lt_predeps -postdeps=$lt_postdeps - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path - -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - -ltmain="$ac_aux_dir/ltmain.sh" - - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - if test x"$xsi_shell" = xyes; then - sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ -func_dirname ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_basename ()$/,/^} # func_basename /c\ -func_basename ()\ -{\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ -func_dirname_and_basename ()\ -{\ -\ case ${1} in\ -\ */*) func_dirname_result="${1%/*}${2}" ;;\ -\ * ) func_dirname_result="${3}" ;;\ -\ esac\ -\ func_basename_result="${1##*/}"\ -} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ -func_stripname ()\ -{\ -\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ -\ # positional parameters, so assign one to ordinary parameter first.\ -\ func_stripname_result=${3}\ -\ func_stripname_result=${func_stripname_result#"${1}"}\ -\ func_stripname_result=${func_stripname_result%"${2}"}\ -} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ -func_split_long_opt ()\ -{\ -\ func_split_long_opt_name=${1%%=*}\ -\ func_split_long_opt_arg=${1#*=}\ -} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ -func_split_short_opt ()\ -{\ -\ func_split_short_opt_arg=${1#??}\ -\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ -} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ -func_lo2o ()\ -{\ -\ case ${1} in\ -\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ -\ *) func_lo2o_result=${1} ;;\ -\ esac\ -} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_xform ()$/,/^} # func_xform /c\ -func_xform ()\ -{\ - func_xform_result=${1%.*}.lo\ -} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_arith ()$/,/^} # func_arith /c\ -func_arith ()\ -{\ - func_arith_result=$(( $* ))\ -} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_len ()$/,/^} # func_len /c\ -func_len ()\ -{\ - func_len_result=${#1}\ -} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - -fi - -if test x"$lt_shell_append" = xyes; then - sed -e '/^func_append ()$/,/^} # func_append /c\ -func_append ()\ -{\ - eval "${1}+=\\${2}"\ -} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ -func_append_quoted ()\ -{\ -\ func_quote_for_eval "${2}"\ -\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ -} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: - - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 -$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} -fi - - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" - - - cat <<_LT_EOF >> "$ofile" - -# ### BEGIN LIBTOOL TAG CONFIG: CXX - -# The linker used to build libraries. -LD=$lt_LD_CXX - -# How to create reloadable object files. -reload_flag=$lt_reload_flag_CXX -reload_cmds=$lt_reload_cmds_CXX - -# Commands used to build an old-style archive. -old_archive_cmds=$lt_old_archive_cmds_CXX - -# A language specific compiler. -CC=$lt_compiler_CXX - -# Is the compiler the GNU compiler? -with_gcc=$GCC_CXX - -# Compiler flag to turn off builtin functions. -no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX - -# Additional compiler flags for building library objects. -pic_flag=$lt_lt_prog_compiler_pic_CXX - -# How to pass a linker flag through the compiler. -wl=$lt_lt_prog_compiler_wl_CXX - -# Compiler flag to prevent dynamic linking. -link_static_flag=$lt_lt_prog_compiler_static_CXX - -# Does compiler simultaneously support -c and -o options? -compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX - -# Whether or not to add -lc for building shared libraries. -build_libtool_need_lc=$archive_cmds_need_lc_CXX - -# Whether or not to disallow shared libs when runtime libs are static. -allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX - -# Compiler flag to allow reflexive dlopens. -export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX - -# Compiler flag to generate shared objects directly from archives. -whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX - -# Whether the compiler copes with passing no objects directly. -compiler_needs_object=$lt_compiler_needs_object_CXX - -# Create an old-style archive from a shared archive. -old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX - -# Create a temporary old-style archive to link instead of a shared archive. -old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX - -# Commands used to build a shared archive. -archive_cmds=$lt_archive_cmds_CXX -archive_expsym_cmds=$lt_archive_expsym_cmds_CXX - -# Commands used to build a loadable module if different from building -# a shared archive. -module_cmds=$lt_module_cmds_CXX -module_expsym_cmds=$lt_module_expsym_cmds_CXX - -# Whether we are building with GNU ld or not. -with_gnu_ld=$lt_with_gnu_ld_CXX - -# Flag that allows shared libraries with undefined symbols to be built. -allow_undefined_flag=$lt_allow_undefined_flag_CXX - -# Flag that enforces no undefined symbols. -no_undefined_flag=$lt_no_undefined_flag_CXX - -# Flag to hardcode \$libdir into a binary during linking. -# This must work even if \$libdir does not exist -hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec_CXX - -# If ld is used when linking, flag to hardcode \$libdir into a binary -# during linking. This must work even if \$libdir does not exist. -hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX - -# Whether we need a single "-rpath" flag with a separated argument. -hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary. -hardcode_direct=$hardcode_direct_CXX - -# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes -# DIR into the resulting binary and the resulting library dependency is -# "absolute",i.e impossible to change by setting \${shlibpath_var} if the -# library is relocated. -hardcode_direct_absolute=$hardcode_direct_absolute_CXX - -# Set to "yes" if using the -LDIR flag during linking hardcodes DIR -# into the resulting binary. -hardcode_minus_L=$hardcode_minus_L_CXX - -# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR -# into the resulting binary. -hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX - -# Set to "yes" if building a shared library automatically hardcodes DIR -# into the library and all subsequent libraries and executables linked -# against it. -hardcode_automatic=$hardcode_automatic_CXX - -# Set to yes if linker adds runtime paths of dependent libraries -# to runtime path list. -inherit_rpath=$inherit_rpath_CXX - -# Whether libtool must link a program against all its dependency libraries. -link_all_deplibs=$link_all_deplibs_CXX - -# Set to "yes" if exported symbols are required. -always_export_symbols=$always_export_symbols_CXX - -# The commands to list exported symbols. -export_symbols_cmds=$lt_export_symbols_cmds_CXX - -# Symbols that should not be listed in the preloaded symbols. -exclude_expsyms=$lt_exclude_expsyms_CXX - -# Symbols that must always be exported. -include_expsyms=$lt_include_expsyms_CXX - -# Commands necessary for linking programs (against libraries) with templates. -prelink_cmds=$lt_prelink_cmds_CXX - -# Commands necessary for finishing linking programs. -postlink_cmds=$lt_postlink_cmds_CXX - -# Specify filename containing input files. -file_list_spec=$lt_file_list_spec_CXX - -# How to hardcode a shared library path into an executable. -hardcode_action=$hardcode_action_CXX - -# The directories searched by this compiler when creating a shared library. -compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX - -# Dependencies to place before and after the objects being linked to -# create a shared library. -predep_objects=$lt_predep_objects_CXX -postdep_objects=$lt_postdep_objects_CXX -predeps=$lt_predeps_CXX -postdeps=$lt_postdeps_CXX - -# The library search path used internally by the compiler when linking -# a shared library. -compiler_lib_search_path=$lt_compiler_lib_search_path_CXX - -# ### END LIBTOOL TAG CONFIG: CXX -_LT_EOF - - ;; - - esac -done # for ac_tag - - -as_fn_exit 0 -_ACEOF -ac_clean_files=$ac_clean_files_save - -test $ac_write_fail = 0 || - as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 - - -# configure is writing to config.log, and then calls config.status. -# config.status does its own redirection, appending to config.log. -# Unfortunately, on DOS this fails, as config.log is still kept open -# by configure, so config.status won't be able to write to it; its -# output is simply discarded. So we exec the FD to /dev/null, -# effectively closing config.log, so it can be properly (re)opened and -# appended to by config.status. When coming back to configure, we -# need to make the FD available again. -if test "$no_create" != yes; then - ac_cs_success=: - ac_config_status_args= - test "$silent" = yes && - ac_config_status_args="$ac_config_status_args --quiet" - exec 5>/dev/null - $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false - exec 5>>config.log - # Use ||, not &&, to avoid exiting from the if with $? = 1, which - # would make configure fail if this is the last instruction. - $ac_cs_success || as_fn_exit 1 -fi -if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 -$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} -fi - - -abs_srcdir="`cd $srcdir && pwd`" -abs_builddir="`pwd`" -if test "$abs_srcdir" != "$abs_builddir"; then - make mkdir-init -fi diff --git a/external/mit/expat/dist/configure.in b/external/mit/expat/dist/configure.in deleted file mode 100755 index 7e968c46d..000000000 --- a/external/mit/expat/dist/configure.in +++ /dev/null @@ -1,155 +0,0 @@ -dnl configuration script for expat -dnl Process this file with autoconf to produce a configure script. -dnl -dnl Copyright 2000 Clark Cooper -dnl -dnl This file is part of EXPAT. -dnl -dnl EXPAT is free software; you can redistribute it and/or modify it -dnl under the terms of the License (based on the MIT/X license) contained -dnl in the file COPYING that comes with this distribution. -dnl - -dnl Ensure that Expat is configured with autoconf 2.58 or newer -AC_PREREQ(2.58) - -dnl Get the version number of Expat, using m4's esyscmd() command to run -dnl the command at m4-generation time. This allows us to create an m4 -dnl symbol holding the correct version number. AC_INIT() requires the -dnl version number at m4-time, rather than when ./configure is run, so -dnl all this must happen as part of m4, not as part of the shell code -dnl contained in ./configure. -dnl -dnl NOTE: esyscmd() is a GNU M4 extension. Thus, we wrap it in an appropriate -dnl test. I believe this test will work, but I don't have a place with non- -dnl GNU M4 to test it right now. -define([expat_version], ifdef([__gnu__], - [esyscmd(conftools/get-version.sh lib/expat.h)], - [2.1.x])) -AC_INIT(expat, expat_version, expat-bugs@libexpat.org) -undefine([expat_version]) - -AC_CONFIG_SRCDIR(Makefile.in) -AC_CONFIG_AUX_DIR(conftools) -AC_CONFIG_MACRO_DIR([m4]) - - -dnl -dnl Increment LIBREVISION if source code has changed at all -dnl -dnl If the API has changed, increment LIBCURRENT and set LIBREVISION to 0 -dnl -dnl If the API changes compatibly (i.e. simply adding a new function -dnl without changing or removing earlier interfaces), then increment LIBAGE. -dnl -dnl If the API changes incompatibly set LIBAGE back to 0 -dnl - -LIBCURRENT=7 -LIBREVISION=0 -LIBAGE=6 - -AC_CONFIG_HEADER(expat_config.h) - -sinclude(conftools/ac_c_bigendian_cross.m4) - -AC_LIBTOOL_WIN32_DLL -AC_PROG_LIBTOOL - -AC_SUBST(LIBCURRENT) -AC_SUBST(LIBREVISION) -AC_SUBST(LIBAGE) - -dnl Checks for programs. -AC_PROG_CC -AC_PROG_CXX -AC_PROG_INSTALL - -if test "$GCC" = yes ; then - dnl - dnl Be careful about adding the -fexceptions option; some versions of - dnl GCC don't support it and it causes extra warnings that are only - dnl distracting; avoid. - dnl - OLDCFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wstrict-prototypes" - CFLAGS="$OLDCFLAGS -fexceptions" - AC_MSG_CHECKING(whether $CC accepts -fexceptions) - AC_TRY_LINK( , , - AC_MSG_RESULT(yes), - AC_MSG_RESULT(no); CFLAGS="$OLDCFLAGS") - CXXFLAGS=`echo "$CFLAGS" | sed 's/ -Wmissing-prototypes -Wstrict-prototypes//'` -fi - -dnl Checks for header files. -AC_HEADER_STDC - -dnl Checks for typedefs, structures, and compiler characteristics. - -dnl Note: Avoid using AC_C_BIGENDIAN because it does not -dnl work in a cross compile. -AC_C_BIGENDIAN_CROSS - -AC_C_CONST -AC_TYPE_SIZE_T -AC_CHECK_FUNCS(memmove bcopy) - -dnl Only needed for xmlwf: -AC_CHECK_HEADERS(fcntl.h unistd.h) -AC_TYPE_OFF_T -AC_FUNC_MMAP - -if test "$ac_cv_func_mmap_fixed_mapped" = "yes"; then - FILEMAP=unixfilemap -else - FILEMAP=readfilemap -fi -AC_SUBST(FILEMAP) - -dnl Needed for the test support code; this was found at -dnl http://lists.gnu.org/archive/html/bug-autoconf/2002-07/msg00028.html - -# AC_CPP_FUNC -# ------------------ # -# Checks to see if ANSI C99 CPP variable __func__ works. -# If not, perhaps __FUNCTION__ works instead. -# If not, we'll just define __func__ to "". -AC_DEFUN([AC_CPP_FUNC], -[AC_REQUIRE([AC_PROG_CC_STDC])dnl -AC_CACHE_CHECK([for an ANSI C99-conforming __func__], ac_cv_cpp_func, -[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], -[[char *foo = __func__;]])], - [ac_cv_cpp_func=yes], - [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], -[[char *foo = __FUNCTION__;]])], - [ac_cv_cpp_func=__FUNCTION__], - [ac_cv_cpp_func=no])])]) -if test $ac_cv_cpp_func = __FUNCTION__; then - AC_DEFINE(__func__,__FUNCTION__, - [Define to __FUNCTION__ or "" if `__func__' does not conform to -ANSI C.]) -elif test $ac_cv_cpp_func = no; then - AC_DEFINE(__func__,"", - [Define to __FUNCTION__ or "" if `__func__' does not conform to -ANSI C.]) -fi -])# AC_CPP_FUNC - -AC_CPP_FUNC - - -dnl Some basic configuration: -AC_DEFINE([XML_NS], 1, - [Define to make XML Namespaces functionality available.]) -AC_DEFINE([XML_DTD], 1, - [Define to make parameter entity parsing functionality available.]) -AC_DEFINE([XML_CONTEXT_BYTES], 1024, - [Define to specify how much context to retain around the current parse point.]) - -AC_CONFIG_FILES([Makefile expat.pc]) -AC_OUTPUT - -abs_srcdir="`cd $srcdir && pwd`" -abs_builddir="`pwd`" -if test "$abs_srcdir" != "$abs_builddir"; then - make mkdir-init -fi diff --git a/external/mit/expat/dist/conftools/PrintPath b/external/mit/expat/dist/conftools/PrintPath deleted file mode 100755 index e8559a3d6..000000000 --- a/external/mit/expat/dist/conftools/PrintPath +++ /dev/null @@ -1,116 +0,0 @@ -#!/bin/sh -# Look for program[s] somewhere in $PATH. -# -# Options: -# -s -# Do not print out full pathname. (silent) -# -pPATHNAME -# Look in PATHNAME instead of $PATH -# -# Usage: -# PrintPath [-s] [-pPATHNAME] program [program ...] -# -# Initially written by Jim Jagielski for the Apache configuration mechanism -# (with kudos to Kernighan/Pike) -# -# This script falls under the Apache License. -# See http://www.apache.org/licenses/LICENSE - -## -# Some "constants" -## -pathname=$PATH -echo="yes" - -## -# Find out what OS we are running for later on -## -os=`(uname) 2>/dev/null` - -## -# Parse command line -## -for args in $* -do - case $args in - -s ) echo="no" ;; - -p* ) pathname="`echo $args | sed 's/^..//'`" ;; - * ) programs="$programs $args" ;; - esac -done - -## -# Now we make the adjustments required for OS/2 and everyone -# else :) -# -# First of all, all OS/2 programs have the '.exe' extension. -# Next, we adjust PATH (or what was given to us as PATH) to -# be whitespace separated directories. -# Finally, we try to determine the best flag to use for -# test/[] to look for an executable file. OS/2 just has '-r' -# but with other OSs, we do some funny stuff to check to see -# if test/[] knows about -x, which is the preferred flag. -## - -if [ "x$os" = "xOS/2" ] -then - ext=".exe" - pathname=`echo -E $pathname | - sed 's/^;/.;/ - s/;;/;.;/g - s/;$/;./ - s/;/ /g - s/\\\\/\\//g' ` - test_exec_flag="-r" -else - ext="" # No default extensions - pathname=`echo $pathname | - sed 's/^:/.:/ - s/::/:.:/g - s/:$/:./ - s/:/ /g' ` - # Here is how we test to see if test/[] can handle -x - testfile="pp.t.$$" - - cat > $testfile </dev/null`; then - test_exec_flag="-x" - else - test_exec_flag="-r" - fi - rm -f $testfile -fi - -for program in $programs -do - for path in $pathname - do - if [ $test_exec_flag $path/${program}${ext} ] && \ - [ ! -d $path/${program}${ext} ]; then - if [ "x$echo" = "xyes" ]; then - echo $path/${program}${ext} - fi - exit 0 - fi - -# Next try without extension (if one was used above) - if [ "x$ext" != "x" ]; then - if [ $test_exec_flag $path/${program} ] && \ - [ ! -d $path/${program} ]; then - if [ "x$echo" = "xyes" ]; then - echo $path/${program} - fi - exit 0 - fi - fi - done -done -exit 1 - diff --git a/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4 b/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4 deleted file mode 100755 index 460af943e..000000000 --- a/external/mit/expat/dist/conftools/ac_c_bigendian_cross.m4 +++ /dev/null @@ -1,81 +0,0 @@ -dnl @synopsis AC_C_BIGENDIAN_CROSS -dnl -dnl Check endianess even when crosscompiling -dnl (partially based on the original AC_C_BIGENDIAN). -dnl -dnl The implementation will create a binary, and instead of running -dnl the binary it will be grep'ed for some symbols that will look -dnl different for different endianess of the binary. -dnl -dnl @version Id: ac_c_bigendian_cross.m4,v 1.2 2001/10/01 20:03:13 fdrake Exp -dnl @author Guido Draheim -dnl -AC_DEFUN([AC_C_BIGENDIAN_CROSS], -[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian, -[ac_cv_c_bigendian=unknown -# See if sys/param.h defines the BYTE_ORDER macro. -AC_TRY_COMPILE([#include -#include ], [ -#if !BYTE_ORDER || !BIG_ENDIAN || !LITTLE_ENDIAN - bogus endian macros -#endif], [# It does; now see whether it defined to BIG_ENDIAN or not. -AC_TRY_COMPILE([#include -#include ], [ -#if BYTE_ORDER != BIG_ENDIAN - not big endian -#endif], ac_cv_c_bigendian=yes, ac_cv_c_bigendian=no)]) -if test $ac_cv_c_bigendian = unknown; then -AC_TRY_RUN([main () { - /* Are we little or big endian? From Harbison&Steele. */ - union - { - long l; - char c[sizeof (long)]; - } u; - u.l = 1; - exit (u.c[sizeof (long) - 1] == 1); -}], ac_cv_c_bigendian=no, ac_cv_c_bigendian=yes, -[ echo $ac_n "cross-compiling... " 2>&AC_FD_MSG ]) -fi]) -if test $ac_cv_c_bigendian = unknown; then -AC_MSG_CHECKING(to probe for byte ordering) -[ -cat >conftest.c <&AC_FD_MSG - ac_cv_c_bigendian=yes - fi - if test `grep -l LiTTleEnDian conftest.o` ; then - echo $ac_n ' little endian probe OK, ' 1>&AC_FD_MSG - if test $ac_cv_c_bigendian = yes ; then - ac_cv_c_bigendian=unknown; - else - ac_cv_c_bigendian=no - fi - fi - echo $ac_n 'guessing bigendian ... ' >&AC_FD_MSG - fi - fi -AC_MSG_RESULT($ac_cv_c_bigendian) -fi -if test $ac_cv_c_bigendian = yes; then - AC_DEFINE(WORDS_BIGENDIAN, 1, [whether byteorder is bigendian]) - BYTEORDER=4321 -else - BYTEORDER=1234 -fi -AC_DEFINE_UNQUOTED(BYTEORDER, $BYTEORDER, [1234 = LIL_ENDIAN, 4321 = BIGENDIAN]) -if test $ac_cv_c_bigendian = unknown; then - AC_MSG_ERROR(unknown endianess - sorry, please pre-set ac_cv_c_bigendian) -fi -]) diff --git a/external/mit/expat/dist/conftools/config.guess b/external/mit/expat/dist/conftools/config.guess deleted file mode 100755 index 40eaed482..000000000 --- a/external/mit/expat/dist/conftools/config.guess +++ /dev/null @@ -1,1517 +0,0 @@ -#! /bin/sh -# Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-05-11' - -# This file is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Originally written by Per Bothner. Please send patches (context -# diff format) to and include a ChangeLog -# entry. -# -# This script attempts to guess a canonical system name similar to -# config.sub. If it succeeds, it prints the system name on stdout, and -# exits with 0. Otherwise, it exits with 1. -# -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] - -Output the configuration name of the system \`$me' is run on. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.guess ($timestamp) - -Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" >&2 - exit 1 ;; - * ) - break ;; - esac -done - -if test $# != 0; then - echo "$me: too many arguments$help" >&2 - exit 1 -fi - -trap 'exit 1' 1 2 15 - -# CC_FOR_BUILD -- compiler used by this script. Note that the use of a -# compiler to aid in system detection is discouraged as it requires -# temporary files to be created and, as you can see below, it is a -# headache to deal with in a portable fashion. - -# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still -# use `HOST_CC' if defined, but it is deprecated. - -# Portable tmp directory creation inspired by the Autoconf team. - -set_cc_for_build=' -trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; -trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; -: ${TMPDIR=/tmp} ; - { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || - { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || - { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || - { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; -dummy=$tmp/dummy ; -tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; -case $CC_FOR_BUILD,$HOST_CC,$CC in - ,,) echo "int x;" > $dummy.c ; - for c in cc gcc c89 c99 ; do - if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then - CC_FOR_BUILD="$c"; break ; - fi ; - done ; - if test x"$CC_FOR_BUILD" = x ; then - CC_FOR_BUILD=no_compiler_found ; - fi - ;; - ,,*) CC_FOR_BUILD=$CC ;; - ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ; set_cc_for_build= ;' - -# This is needed to find uname on a Pyramid OSx when run in the BSD universe. -# (ghazi@noc.rutgers.edu 1994-08-24) -if (test -f /.attbin/uname) >/dev/null 2>&1 ; then - PATH=$PATH:/.attbin ; export PATH -fi - -UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown -UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown -UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown - -# Note: order is significant - the case branches are not exclusive. - -case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - *:NetBSD:*:*) - # NetBSD (nbsd) targets should (where applicable) match one or - # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, - # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently - # switched to ELF, *-*-netbsd* would select the old - # object file format. This provides both forward - # compatibility and a consistent mechanism for selecting the - # object file format. - # - # Note: NetBSD doesn't particularly care about the vendor - # portion of the name. We always set it to "unknown". - sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` - case "${UNAME_MACHINE_ARCH}" in - armeb) machine=armeb-unknown ;; - arm*) machine=arm-unknown ;; - sh3el) machine=shl-unknown ;; - sh3eb) machine=sh-unknown ;; - sh5el) machine=sh5le-unknown ;; - *) machine=${UNAME_MACHINE_ARCH}-unknown ;; - esac - # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. - case "${UNAME_MACHINE_ARCH}" in - arm*|i386|m68k|ns32k|sh3*|sparc|vax) - eval $set_cc_for_build - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ELF__ - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi - ;; - *) - os=netbsd - ;; - esac - # The OS release - # Debian GNU/NetBSD machines have a different userland, and - # thus, need a distinct triplet. However, they do not need - # kernel version information, so it can be replaced with a - # suitable tag, in the style of linux-gnu. - case "${UNAME_VERSION}" in - Debian*) - release='-gnu' - ;; - *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` - ;; - esac - # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: - # contains redundant information, the shorter form: - # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" - exit ;; - *:OpenBSD:*:*) - UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` - echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} - exit ;; - *:ekkoBSD:*:*) - echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} - exit ;; - *:SolidBSD:*:*) - echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} - exit ;; - macppc:MirBSD:*:*) - echo powerpc-unknown-mirbsd${UNAME_RELEASE} - exit ;; - *:MirBSD:*:*) - echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} - exit ;; - alpha:OSF1:*:*) - case $UNAME_RELEASE in - *4.0) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - ;; - *5.*) - UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` - ;; - esac - # According to Compaq, /usr/sbin/psrinfo has been available on - # OSF/1 and Tru64 systems produced since 1995. I hope that - # covers most systems running today. This code pipes the CPU - # types through head -n 1, so we only detect the type of CPU 0. - ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` - case "$ALPHA_CPU_TYPE" in - "EV4 (21064)") - UNAME_MACHINE="alpha" ;; - "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; - "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; - "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; - "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; - "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; - "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; - "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; - "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; - "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; - "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; - "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; - "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; - "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; - esac - # A Pn.n version is a patched version. - # A Vn.n version is a released version. - # A Tn.n version is a released field test version. - # A Xn.n version is an unreleased experimental baselevel. - # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - # Reset EXIT trap before exiting to avoid spurious non-zero exit code. - exitcode=$? - trap '' 0 - exit $exitcode ;; - Alpha\ *:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # Should we change UNAME_MACHINE based on the output of uname instead - # of the specific Alpha model? - echo alpha-pc-interix - exit ;; - 21064:Windows_NT:50:3) - echo alpha-dec-winnt3.5 - exit ;; - Amiga*:UNIX_System_V:4.0:*) - echo m68k-unknown-sysv4 - exit ;; - *:[Aa]miga[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-amigaos - exit ;; - *:[Mm]orph[Oo][Ss]:*:*) - echo ${UNAME_MACHINE}-unknown-morphos - exit ;; - *:OS/390:*:*) - echo i370-ibm-openedition - exit ;; - *:z/VM:*:*) - echo s390-ibm-zvmoe - exit ;; - *:OS400:*:*) - echo powerpc-ibm-os400 - exit ;; - arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) - echo arm-acorn-riscix${UNAME_RELEASE} - exit ;; - arm:riscos:*:*|arm:RISCOS:*:*) - echo arm-unknown-riscos - exit ;; - SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) - echo hppa1.1-hitachi-hiuxmpp - exit ;; - Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) - # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. - if test "`(/bin/universe) 2>/dev/null`" = att ; then - echo pyramid-pyramid-sysv3 - else - echo pyramid-pyramid-bsd - fi - exit ;; - NILE*:*:*:dcosx) - echo pyramid-pyramid-svr4 - exit ;; - DRS?6000:unix:4.0:6*) - echo sparc-icl-nx6 - exit ;; - DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) - case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7; exit ;; - esac ;; - s390x:SunOS:*:*) - echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4H:SunOS:5.*:*) - echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) - echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) - echo i386-pc-auroraux${UNAME_RELEASE} - exit ;; - i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) - eval $set_cc_for_build - SUN_ARCH="i386" - # If there is a compiler, see if it is configured for 64-bit objects. - # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. - # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - SUN_ARCH="x86_64" - fi - fi - echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:6*:*) - # According to config.sub, this is the proper way to canonicalize - # SunOS6. Hard to guess exactly what SunOS6 will be like, but - # it's likely to be more like Solaris than SunOS4. - echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - sun4*:SunOS:*:*) - case "`/usr/bin/arch -k`" in - Series*|S4*) - UNAME_RELEASE=`uname -v` - ;; - esac - # Japanese Language versions have a version number like `4.1.3-JL'. - echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit ;; - sun3*:SunOS:*:*) - echo m68k-sun-sunos${UNAME_RELEASE} - exit ;; - sun*:*:4.2BSD:*) - UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 - case "`/bin/arch`" in - sun3) - echo m68k-sun-sunos${UNAME_RELEASE} - ;; - sun4) - echo sparc-sun-sunos${UNAME_RELEASE} - ;; - esac - exit ;; - aushp:SunOS:*:*) - echo sparc-auspex-sunos${UNAME_RELEASE} - exit ;; - # The situation for MiNT is a little confusing. The machine name - # can be virtually everything (everything which is not - # "atarist" or "atariste" at least should have a processor - # > m68000). The system name ranges from "MiNT" over "FreeMiNT" - # to the lowercase version "mint" (or "freemint"). Finally - # the system name "TOS" denotes a system which is actually not - # MiNT. But MiNT is downward compatible to TOS, so this should - # be no problem. - atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) - echo m68k-atari-mint${UNAME_RELEASE} - exit ;; - milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) - echo m68k-milan-mint${UNAME_RELEASE} - exit ;; - hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) - echo m68k-hades-mint${UNAME_RELEASE} - exit ;; - *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) - echo m68k-unknown-mint${UNAME_RELEASE} - exit ;; - m68k:machten:*:*) - echo m68k-apple-machten${UNAME_RELEASE} - exit ;; - powerpc:machten:*:*) - echo powerpc-apple-machten${UNAME_RELEASE} - exit ;; - RISC*:Mach:*:*) - echo mips-dec-mach_bsd4.3 - exit ;; - RISC*:ULTRIX:*:*) - echo mips-dec-ultrix${UNAME_RELEASE} - exit ;; - VAX*:ULTRIX*:*:*) - echo vax-dec-ultrix${UNAME_RELEASE} - exit ;; - 2020:CLIX:*:* | 2430:CLIX:*:*) - echo clipper-intergraph-clix${UNAME_RELEASE} - exit ;; - mips:*:*:UMIPS | mips:*:*:RISCos) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c -#ifdef __cplusplus -#include /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif - #if defined (host_mips) && defined (MIPSEB) - #if defined (SYSTYPE_SYSV) - printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_SVR4) - printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); - #endif - #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) - printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); - #endif - #endif - exit (-1); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && - dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && - SYSTEM_NAME=`$dummy $dummyarg` && - { echo "$SYSTEM_NAME"; exit; } - echo mips-mips-riscos${UNAME_RELEASE} - exit ;; - Motorola:PowerMAX_OS:*:*) - echo powerpc-motorola-powermax - exit ;; - Motorola:*:4.3:PL8-*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) - echo powerpc-harris-powermax - exit ;; - Night_Hawk:Power_UNIX:*:*) - echo powerpc-harris-powerunix - exit ;; - m88k:CX/UX:7*:*) - echo m88k-harris-cxux7 - exit ;; - m88k:*:4*:R4*) - echo m88k-motorola-sysv4 - exit ;; - m88k:*:3*:R3*) - echo m88k-motorola-sysv3 - exit ;; - AViiON:dgux:*:*) - # DG/UX returns AViiON for all architectures - UNAME_PROCESSOR=`/usr/bin/uname -p` - if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] - then - if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ - [ ${TARGET_BINARY_INTERFACE}x = x ] - then - echo m88k-dg-dgux${UNAME_RELEASE} - else - echo m88k-dg-dguxbcs${UNAME_RELEASE} - fi - else - echo i586-dg-dgux${UNAME_RELEASE} - fi - exit ;; - M88*:DolphinOS:*:*) # DolphinOS (SVR3) - echo m88k-dolphin-sysv3 - exit ;; - M88*:*:R3*:*) - # Delta 88k system running SVR3 - echo m88k-motorola-sysv3 - exit ;; - XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) - echo m88k-tektronix-sysv3 - exit ;; - Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) - echo m68k-tektronix-bsd - exit ;; - *:IRIX*:*:*) - echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit ;; - ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' - i*86:AIX:*:*) - echo i386-ibm-aix - exit ;; - ia64:AIX:*:*) - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit ;; - *:AIX:2:3) - if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - - main() - { - if (!__power_pc()) - exit(1); - puts("powerpc-ibm-aix3.2.5"); - exit(0); - } -EOF - if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` - then - echo "$SYSTEM_NAME" - else - echo rs6000-ibm-aix3.2.5 - fi - elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then - echo rs6000-ibm-aix3.2.4 - else - echo rs6000-ibm-aix3.2 - fi - exit ;; - *:AIX:*:[4567]) - IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` - if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then - IBM_ARCH=rs6000 - else - IBM_ARCH=powerpc - fi - if [ -x /usr/bin/oslevel ] ; then - IBM_REV=`/usr/bin/oslevel` - else - IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} - fi - echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit ;; - *:AIX:*:*) - echo rs6000-ibm-aix - exit ;; - ibmrt:4.4BSD:*|romp-ibm:BSD:*) - echo romp-ibm-bsd4.4 - exit ;; - ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and - echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit ;; # report: romp-ibm BSD 4.3 - *:BOSX:*:*) - echo rs6000-bull-bosx - exit ;; - DPX/2?00:B.O.S.:*:*) - echo m68k-bull-sysv3 - exit ;; - 9000/[34]??:4.3bsd:1.*:*) - echo m68k-hp-bsd - exit ;; - hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) - echo m68k-hp-bsd4.4 - exit ;; - 9000/[34678]??:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - case "${UNAME_MACHINE}" in - 9000/31? ) HP_ARCH=m68000 ;; - 9000/[34]?? ) HP_ARCH=m68k ;; - 9000/[678][0-9][0-9]) - if [ -x /usr/bin/getconf ]; then - sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` - sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` - case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 - 532) # CPU_PA_RISC2_0 - case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 - esac ;; - esac - fi - if [ "${HP_ARCH}" = "" ]; then - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - - #define _HPUX_SOURCE - #include - #include - - int main () - { - #if defined(_SC_KERNEL_BITS) - long bits = sysconf(_SC_KERNEL_BITS); - #endif - long cpu = sysconf (_SC_CPU_VERSION); - - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1"); break; - case CPU_PA_RISC2_0: - #if defined(_SC_KERNEL_BITS) - switch (bits) - { - case 64: puts ("hppa2.0w"); break; - case 32: puts ("hppa2.0n"); break; - default: puts ("hppa2.0"); break; - } break; - #else /* !defined(_SC_KERNEL_BITS) */ - puts ("hppa2.0"); break; - #endif - default: puts ("hppa1.0"); break; - } - exit (0); - } -EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` - test -z "$HP_ARCH" && HP_ARCH=hppa - fi ;; - esac - if [ ${HP_ARCH} = "hppa2.0w" ] - then - eval $set_cc_for_build - - # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating - # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler - # generating 64-bit code. GNU and HP use different nomenclature: - # - # $ CC_FOR_BUILD=cc ./config.guess - # => hppa2.0w-hp-hpux11.23 - # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess - # => hppa64-hp-hpux11.23 - - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | - grep -q __LP64__ - then - HP_ARCH="hppa2.0w" - else - HP_ARCH="hppa64" - fi - fi - echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit ;; - ia64:HP-UX:*:*) - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` - echo ia64-hp-hpux${HPUX_REV} - exit ;; - 3050*:HI-UX:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - int - main () - { - long cpu = sysconf (_SC_CPU_VERSION); - /* The order matters, because CPU_IS_HP_MC68K erroneously returns - true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct - results, however. */ - if (CPU_IS_PA_RISC (cpu)) - { - switch (cpu) - { - case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; - case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; - case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; - default: puts ("hppa-hitachi-hiuxwe2"); break; - } - } - else if (CPU_IS_HP_MC68K (cpu)) - puts ("m68k-hitachi-hiuxwe2"); - else puts ("unknown-hitachi-hiuxwe2"); - exit (0); - } -EOF - $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - echo unknown-hitachi-hiuxwe2 - exit ;; - 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) - echo hppa1.1-hp-bsd - exit ;; - 9000/8??:4.3bsd:*:*) - echo hppa1.0-hp-bsd - exit ;; - *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) - echo hppa1.0-hp-mpeix - exit ;; - hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) - echo hppa1.1-hp-osf - exit ;; - hp8??:OSF1:*:*) - echo hppa1.0-hp-osf - exit ;; - i*86:OSF1:*:*) - if [ -x /usr/sbin/sysversion ] ; then - echo ${UNAME_MACHINE}-unknown-osf1mk - else - echo ${UNAME_MACHINE}-unknown-osf1 - fi - exit ;; - parisc*:Lites*:*:*) - echo hppa1.1-hp-lites - exit ;; - C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) - echo c1-convex-bsd - exit ;; - C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) - echo c34-convex-bsd - exit ;; - C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) - echo c38-convex-bsd - exit ;; - C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) - echo c4-convex-bsd - exit ;; - CRAY*Y-MP:*:*:*) - echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*[A-Z]90:*:*:*) - echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ - | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ - -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ - -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*TS:*:*:*) - echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*T3E:*:*:*) - echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - CRAY*SV1:*:*:*) - echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - *:UNICOS/mp:*:*) - echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit ;; - F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit ;; - i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) - echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit ;; - sparc*:BSD/OS:*:*) - echo sparc-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:BSD/OS:*:*) - echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit ;; - *:FreeBSD:*:*) - case ${UNAME_MACHINE} in - pc98) - echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - amd64) - echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - *) - echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; - esac - exit ;; - i*:CYGWIN*:*) - echo ${UNAME_MACHINE}-pc-cygwin - exit ;; - *:MINGW*:*) - echo ${UNAME_MACHINE}-pc-mingw32 - exit ;; - i*:windows32*:*) - # uname -m includes "-pc" on this system. - echo ${UNAME_MACHINE}-mingw32 - exit ;; - i*:PW*:*) - echo ${UNAME_MACHINE}-pc-pw32 - exit ;; - *:Interix*:*) - case ${UNAME_MACHINE} in - x86) - echo i586-pc-interix${UNAME_RELEASE} - exit ;; - authenticamd | genuineintel | EM64T) - echo x86_64-unknown-interix${UNAME_RELEASE} - exit ;; - IA64) - echo ia64-unknown-interix${UNAME_RELEASE} - exit ;; - esac ;; - [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) - echo i${UNAME_MACHINE}-pc-mks - exit ;; - 8664:Windows_NT:*) - echo x86_64-pc-mks - exit ;; - i*:Windows_NT*:* | Pentium*:Windows_NT*:*) - # How do we know it's Interix rather than the generic POSIX subsystem? - # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we - # UNAME_MACHINE based on the output of uname instead of i386? - echo i586-pc-interix - exit ;; - i*:UWIN*:*) - echo ${UNAME_MACHINE}-pc-uwin - exit ;; - amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) - echo x86_64-unknown-cygwin - exit ;; - p*:CYGWIN*:*) - echo powerpcle-unknown-cygwin - exit ;; - prep*:SunOS:5.*:*) - echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit ;; - *:GNU:*:*) - # the GNU system - echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit ;; - *:GNU/*:*:*) - # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit ;; - i*86:Minix:*:*) - echo ${UNAME_MACHINE}-pc-minix - exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; - EV56) UNAME_MACHINE=alphaev56 ;; - PCA56) UNAME_MACHINE=alphapca56 ;; - PCA57) UNAME_MACHINE=alphapca56 ;; - EV6) UNAME_MACHINE=alphaev6 ;; - EV67) UNAME_MACHINE=alphaev67 ;; - EV68*) UNAME_MACHINE=alphaev68 ;; - esac - objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi - echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit ;; - arm*:Linux:*:*) - eval $set_cc_for_build - if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_EABI__ - then - echo ${UNAME_MACHINE}-unknown-linux-gnu - else - if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep -q __ARM_PCS_VFP - then - echo ${UNAME_MACHINE}-unknown-linux-gnueabi - else - echo ${UNAME_MACHINE}-unknown-linux-gnueabihf - fi - fi - exit ;; - avr32*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - cris:Linux:*:*) - echo cris-axis-linux-gnu - exit ;; - crisv32:Linux:*:*) - echo crisv32-axis-linux-gnu - exit ;; - frv:Linux:*:*) - echo frv-unknown-linux-gnu - exit ;; - i*86:Linux:*:*) - LIBC=gnu - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #ifdef __dietlibc__ - LIBC=dietlibc - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` - echo "${UNAME_MACHINE}-pc-linux-${LIBC}" - exit ;; - ia64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m32r*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - m68*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - mips:Linux:*:* | mips64:Linux:*:*) - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #undef CPU - #undef ${UNAME_MACHINE} - #undef ${UNAME_MACHINE}el - #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) - CPU=${UNAME_MACHINE}el - #else - #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) - CPU=${UNAME_MACHINE} - #else - CPU= - #endif - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` - test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } - ;; - or32:Linux:*:*) - echo or32-unknown-linux-gnu - exit ;; - padre:Linux:*:*) - echo sparc-unknown-linux-gnu - exit ;; - parisc64:Linux:*:* | hppa64:Linux:*:*) - echo hppa64-unknown-linux-gnu - exit ;; - parisc:Linux:*:* | hppa:Linux:*:*) - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) echo hppa1.1-unknown-linux-gnu ;; - PA8*) echo hppa2.0-unknown-linux-gnu ;; - *) echo hppa-unknown-linux-gnu ;; - esac - exit ;; - ppc64:Linux:*:*) - echo powerpc64-unknown-linux-gnu - exit ;; - ppc:Linux:*:*) - echo powerpc-unknown-linux-gnu - exit ;; - s390:Linux:*:* | s390x:Linux:*:*) - echo ${UNAME_MACHINE}-ibm-linux - exit ;; - sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sh*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - sparc:Linux:*:* | sparc64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - tile*:Linux:*:*) - echo ${UNAME_MACHINE}-tilera-linux-gnu - exit ;; - vax:Linux:*:*) - echo ${UNAME_MACHINE}-dec-linux-gnu - exit ;; - x86_64:Linux:*:*) - echo x86_64-unknown-linux-gnu - exit ;; - xtensa*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit ;; - i*86:DYNIX/ptx:4*:*) - # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. - # earlier versions are messed up and put the nodename in both - # sysname and nodename. - echo i386-sequent-sysv4 - exit ;; - i*86:UNIX_SV:4.2MP:2.*) - # Unixware is an offshoot of SVR4, but it has its own version - # number series starting with 2... - # I am not positive that other SVR4 systems won't match this, - # I just have to hope. -- rms. - # Use sysv4.2uw... so that sysv4* matches it. - echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit ;; - i*86:OS/2:*:*) - # If we were able to find `uname', then EMX Unix compatibility - # is probably installed. - echo ${UNAME_MACHINE}-pc-os2-emx - exit ;; - i*86:XTS-300:*:STOP) - echo ${UNAME_MACHINE}-unknown-stop - exit ;; - i*86:atheos:*:*) - echo ${UNAME_MACHINE}-unknown-atheos - exit ;; - i*86:syllable:*:*) - echo ${UNAME_MACHINE}-pc-syllable - exit ;; - i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) - echo i386-unknown-lynxos${UNAME_RELEASE} - exit ;; - i*86:*DOS:*:*) - echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit ;; - i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) - UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` - if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then - echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} - else - echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} - fi - exit ;; - i*86:*:5:[678]*) - # UnixWare 7.x, OpenUNIX and OpenServer 6. - case `/bin/uname -X | grep "^Machine"` in - *486*) UNAME_MACHINE=i486 ;; - *Pentium) UNAME_MACHINE=i586 ;; - *Pent*|*Celeron) UNAME_MACHINE=i686 ;; - esac - echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit ;; - i*86:*:3.2:*) - if test -f /usr/options/cb.name; then - UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then - UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` - (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 - (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ - && UNAME_MACHINE=i586 - (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ - && UNAME_MACHINE=i686 - (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ - && UNAME_MACHINE=i686 - echo ${UNAME_MACHINE}-pc-sco$UNAME_REL - else - echo ${UNAME_MACHINE}-pc-sysv32 - fi - exit ;; - pc:*:*:*) - # Left here for compatibility: - # uname -m prints for DJGPP always 'pc', but it prints nothing about - # the processor, so we play safe by assuming i586. - # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that - # this is a cross-build. - echo i586-pc-msdosdjgpp - exit ;; - Intel:Mach:3*:*) - echo i386-pc-mach3 - exit ;; - paragon:*:*:*) - echo i860-intel-osf1 - exit ;; - i860:*:4.*:*) # i860-SVR4 - if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then - echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 - else # Add other i860-SVR4 vendors below as they are discovered. - echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 - fi - exit ;; - mini*:CTIX:SYS*5:*) - # "miniframe" - echo m68010-convergent-sysv - exit ;; - mc68k:UNIX:SYSTEM5:3.51m) - echo m68k-convergent-sysv - exit ;; - M680?0:D-NIX:5.3:*) - echo m68k-diab-dnix - exit ;; - M68*:*:R3V[5678]*:*) - test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) - OS_REL='' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4; exit; } ;; - NCR*:*:4.2:* | MPRAS*:*:4.2:*) - OS_REL='.3' - test -r /etc/.relid \ - && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` - /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && { echo i486-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } - /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ - && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; - m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) - echo m68k-unknown-lynxos${UNAME_RELEASE} - exit ;; - mc68030:UNIX_System_V:4.*:*) - echo m68k-atari-sysv4 - exit ;; - TSUNAMI:LynxOS:2.*:*) - echo sparc-unknown-lynxos${UNAME_RELEASE} - exit ;; - rs6000:LynxOS:2.*:*) - echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit ;; - PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) - echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit ;; - SM[BE]S:UNIX_SV:*:*) - echo mips-dde-sysv${UNAME_RELEASE} - exit ;; - RM*:ReliantUNIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - RM*:SINIX-*:*:*) - echo mips-sni-sysv4 - exit ;; - *:SINIX-*:*:*) - if uname -p 2>/dev/null >/dev/null ; then - UNAME_MACHINE=`(uname -p) 2>/dev/null` - echo ${UNAME_MACHINE}-sni-sysv4 - else - echo ns32k-sni-sysv - fi - exit ;; - PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort - # says - echo i586-unisys-sysv4 - exit ;; - *:UNIX_System_V:4*:FTX*) - # From Gerald Hewes . - # How about differentiating between stratus architectures? -djm - echo hppa1.1-stratus-sysv4 - exit ;; - *:*:*:FTX*) - # From seanf@swdc.stratus.com. - echo i860-stratus-sysv4 - exit ;; - i*86:VOS:*:*) - # From Paul.Green@stratus.com. - echo ${UNAME_MACHINE}-stratus-vos - exit ;; - *:VOS:*:*) - # From Paul.Green@stratus.com. - echo hppa1.1-stratus-vos - exit ;; - mc68*:A/UX:*:*) - echo m68k-apple-aux${UNAME_RELEASE} - exit ;; - news*:NEWS-OS:6*:*) - echo mips-sony-newsos6 - exit ;; - R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) - if [ -d /usr/nec ]; then - echo mips-nec-sysv${UNAME_RELEASE} - else - echo mips-unknown-sysv${UNAME_RELEASE} - fi - exit ;; - BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. - echo powerpc-be-beos - exit ;; - BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. - echo powerpc-apple-beos - exit ;; - BePC:BeOS:*:*) # BeOS running on Intel PC compatible. - echo i586-pc-beos - exit ;; - BePC:Haiku:*:*) # Haiku running on Intel PC compatible. - echo i586-pc-haiku - exit ;; - SX-4:SUPER-UX:*:*) - echo sx4-nec-superux${UNAME_RELEASE} - exit ;; - SX-5:SUPER-UX:*:*) - echo sx5-nec-superux${UNAME_RELEASE} - exit ;; - SX-6:SUPER-UX:*:*) - echo sx6-nec-superux${UNAME_RELEASE} - exit ;; - SX-7:SUPER-UX:*:*) - echo sx7-nec-superux${UNAME_RELEASE} - exit ;; - SX-8:SUPER-UX:*:*) - echo sx8-nec-superux${UNAME_RELEASE} - exit ;; - SX-8R:SUPER-UX:*:*) - echo sx8r-nec-superux${UNAME_RELEASE} - exit ;; - Power*:Rhapsody:*:*) - echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Rhapsody:*:*) - echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit ;; - *:Darwin:*:*) - UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown - case $UNAME_PROCESSOR in - i386) - eval $set_cc_for_build - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then - if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ - grep IS_64BIT_ARCH >/dev/null - then - UNAME_PROCESSOR="x86_64" - fi - fi ;; - unknown) UNAME_PROCESSOR=powerpc ;; - esac - echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit ;; - *:procnto*:*:* | *:QNX:[0123456789]*:*) - UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then - UNAME_PROCESSOR=i386 - UNAME_MACHINE=pc - fi - echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit ;; - *:QNX:*:4*) - echo i386-pc-qnx - exit ;; - NEO-?:NONSTOP_KERNEL:*:*) - echo neo-tandem-nsk${UNAME_RELEASE} - exit ;; - NSE-?:NONSTOP_KERNEL:*:*) - echo nse-tandem-nsk${UNAME_RELEASE} - exit ;; - NSR-?:NONSTOP_KERNEL:*:*) - echo nsr-tandem-nsk${UNAME_RELEASE} - exit ;; - *:NonStop-UX:*:*) - echo mips-compaq-nonstopux - exit ;; - BS2000:POSIX*:*:*) - echo bs2000-siemens-sysv - exit ;; - DS/*:UNIX_System_V:*:*) - echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit ;; - *:Plan9:*:*) - # "uname -m" is not consistent, so use $cputype instead. 386 - # is converted to i386 for consistency with other x86 - # operating systems. - if test "$cputype" = "386"; then - UNAME_MACHINE=i386 - else - UNAME_MACHINE="$cputype" - fi - echo ${UNAME_MACHINE}-unknown-plan9 - exit ;; - *:TOPS-10:*:*) - echo pdp10-unknown-tops10 - exit ;; - *:TENEX:*:*) - echo pdp10-unknown-tenex - exit ;; - KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) - echo pdp10-dec-tops20 - exit ;; - XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) - echo pdp10-xkl-tops20 - exit ;; - *:TOPS-20:*:*) - echo pdp10-unknown-tops20 - exit ;; - *:ITS:*:*) - echo pdp10-unknown-its - exit ;; - SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit ;; - *:DragonFly:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` - exit ;; - *:*VMS:*:*) - UNAME_MACHINE=`(uname -p) 2>/dev/null` - case "${UNAME_MACHINE}" in - A*) echo alpha-dec-vms ; exit ;; - I*) echo ia64-dec-vms ; exit ;; - V*) echo vax-dec-vms ; exit ;; - esac ;; - *:XENIX:*:SysV) - echo i386-pc-xenix - exit ;; - i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' - exit ;; - i*86:rdos:*:*) - echo ${UNAME_MACHINE}-pc-rdos - exit ;; - i*86:AROS:*:*) - echo ${UNAME_MACHINE}-pc-aros - exit ;; -esac - -#echo '(No uname command or uname output not recognized.)' 1>&2 -#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 - -eval $set_cc_for_build -cat >$dummy.c < -# include -#endif -main () -{ -#if defined (sony) -#if defined (MIPSEB) - /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, - I don't know.... */ - printf ("mips-sony-bsd\n"); exit (0); -#else -#include - printf ("m68k-sony-newsos%s\n", -#ifdef NEWSOS4 - "4" -#else - "" -#endif - ); exit (0); -#endif -#endif - -#if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix\n"); exit (0); -#endif - -#if defined (hp300) && !defined (hpux) - printf ("m68k-hp-bsd\n"); exit (0); -#endif - -#if defined (NeXT) -#if !defined (__ARCHITECTURE__) -#define __ARCHITECTURE__ "m68k" -#endif - int version; - version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; - if (version < 4) - printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); - else - printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); - exit (0); -#endif - -#if defined (MULTIMAX) || defined (n16) -#if defined (UMAXV) - printf ("ns32k-encore-sysv\n"); exit (0); -#else -#if defined (CMU) - printf ("ns32k-encore-mach\n"); exit (0); -#else - printf ("ns32k-encore-bsd\n"); exit (0); -#endif -#endif -#endif - -#if defined (__386BSD__) - printf ("i386-pc-bsd\n"); exit (0); -#endif - -#if defined (sequent) -#if defined (i386) - printf ("i386-sequent-dynix\n"); exit (0); -#endif -#if defined (ns32000) - printf ("ns32k-sequent-dynix\n"); exit (0); -#endif -#endif - -#if defined (_SEQUENT_) - struct utsname un; - - uname(&un); - - if (strncmp(un.version, "V2", 2) == 0) { - printf ("i386-sequent-ptx2\n"); exit (0); - } - if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ - printf ("i386-sequent-ptx1\n"); exit (0); - } - printf ("i386-sequent-ptx\n"); exit (0); - -#endif - -#if defined (vax) -# if !defined (ultrix) -# include -# if defined (BSD) -# if BSD == 43 - printf ("vax-dec-bsd4.3\n"); exit (0); -# else -# if BSD == 199006 - printf ("vax-dec-bsd4.3reno\n"); exit (0); -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# endif -# else - printf ("vax-dec-bsd\n"); exit (0); -# endif -# else - printf ("vax-dec-ultrix\n"); exit (0); -# endif -#endif - -#if defined (alliant) && defined (i860) - printf ("i860-alliant-bsd\n"); exit (0); -#endif - - exit (1); -} -EOF - -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && - { echo "$SYSTEM_NAME"; exit; } - -# Apollos put the system type in the environment. - -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } - -# Convex versions that predate uname can use getsysinfo(1) - -if [ -x /usr/convex/getsysinfo ] -then - case `getsysinfo -f cpu_type` in - c1*) - echo c1-convex-bsd - exit ;; - c2*) - if getsysinfo -f scalar_acc - then echo c32-convex-bsd - else echo c2-convex-bsd - fi - exit ;; - c34*) - echo c34-convex-bsd - exit ;; - c38*) - echo c38-convex-bsd - exit ;; - c4*) - echo c4-convex-bsd - exit ;; - esac -fi - -cat >&2 < in order to provide the needed -information to handle your system. - -config.guess timestamp = $timestamp - -uname -m = `(uname -m) 2>/dev/null || echo unknown` -uname -r = `(uname -r) 2>/dev/null || echo unknown` -uname -s = `(uname -s) 2>/dev/null || echo unknown` -uname -v = `(uname -v) 2>/dev/null || echo unknown` - -/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` -/bin/uname -X = `(/bin/uname -X) 2>/dev/null` - -hostinfo = `(hostinfo) 2>/dev/null` -/bin/universe = `(/bin/universe) 2>/dev/null` -/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` -/bin/arch = `(/bin/arch) 2>/dev/null` -/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` -/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` - -UNAME_MACHINE = ${UNAME_MACHINE} -UNAME_RELEASE = ${UNAME_RELEASE} -UNAME_SYSTEM = ${UNAME_SYSTEM} -UNAME_VERSION = ${UNAME_VERSION} -EOF - -exit 1 - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/external/mit/expat/dist/conftools/config.sub b/external/mit/expat/dist/conftools/config.sub deleted file mode 100755 index 30fdca812..000000000 --- a/external/mit/expat/dist/conftools/config.sub +++ /dev/null @@ -1,1760 +0,0 @@ -#! /bin/sh -# Configuration validation subroutine script. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, -# 2011 Free Software Foundation, Inc. - -timestamp='2011-03-23' - -# This file is (in principle) common to ALL GNU software. -# The presence of a machine in this file suggests that SOME GNU software -# can handle that machine. It does not imply ALL GNU software can. -# -# This file is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA -# 02110-1301, USA. -# -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - - -# Please send patches to . Submit a context -# diff and a properly formatted GNU ChangeLog entry. -# -# Configuration subroutine to validate and canonicalize a configuration type. -# Supply the specified configuration type as an argument. -# If it is invalid, we print an error message on stderr and exit with code 1. -# Otherwise, we print the canonical config type on stdout and succeed. - -# You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD - -# This file is supposed to be the same for all GNU packages -# and recognize all the CPU types, system types and aliases -# that are meaningful with *any* GNU software. -# Each package is responsible for reporting which valid configurations -# it does not support. The user should be able to distinguish -# a failure to support a valid configuration from a meaningless -# configuration. - -# The goal of this file is to map all the various variations of a given -# machine specification into a single specification in the form: -# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM -# or in some cases, the newer four-part form: -# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM -# It is wrong to echo any other type of specification. - -me=`echo "$0" | sed -e 's,.*/,,'` - -usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS - -Canonicalize a configuration name. - -Operation modes: - -h, --help print this help, then exit - -t, --time-stamp print date of last modification, then exit - -v, --version print version number, then exit - -Report bugs and patches to ." - -version="\ -GNU config.sub ($timestamp) - -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, -2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free -Software Foundation, Inc. - -This is free software; see the source for copying conditions. There is NO -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." - -help=" -Try \`$me --help' for more information." - -# Parse command line -while test $# -gt 0 ; do - case $1 in - --time-stamp | --time* | -t ) - echo "$timestamp" ; exit ;; - --version | -v ) - echo "$version" ; exit ;; - --help | --h* | -h ) - echo "$usage"; exit ;; - -- ) # Stop option processing - shift; break ;; - - ) # Use stdin as input. - break ;; - -* ) - echo "$me: invalid option $1$help" - exit 1 ;; - - *local*) - # First pass through any local machine types. - echo $1 - exit ;; - - * ) - break ;; - esac -done - -case $# in - 0) echo "$me: missing argument$help" >&2 - exit 1;; - 1) ;; - *) echo "$me: too many arguments$help" >&2 - exit 1;; -esac - -# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). -# Here we must recognize all the valid KERNEL-OS combinations. -maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` -case $maybe_os in - nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ - linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ - kopensolaris*-gnu* | \ - storm-chaos* | os2-emx* | rtmk-nova*) - os=-$maybe_os - basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` - ;; - *) - basic_machine=`echo $1 | sed 's/-[^-]*$//'` - if [ $basic_machine != $1 ] - then os=`echo $1 | sed 's/.*-/-/'` - else os=; fi - ;; -esac - -### Let's recognize common machines as not being operating systems so -### that things like config.sub decstation-3100 work. We also -### recognize some manufacturers as not being operating systems, so we -### can provide default operating systems below. -case $os in - -sun*os*) - # Prevent following clause from handling this invalid input. - ;; - -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ - -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ - -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ - -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ - -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ - -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis | -knuth | -cray | -microblaze) - os= - basic_machine=$1 - ;; - -bluegene*) - os=-cnk - ;; - -sim | -cisco | -oki | -wec | -winbond) - os= - basic_machine=$1 - ;; - -scout) - ;; - -wrs) - os=-vxworks - basic_machine=$1 - ;; - -chorusos*) - os=-chorusos - basic_machine=$1 - ;; - -chorusrdb) - os=-chorusrdb - basic_machine=$1 - ;; - -hiux*) - os=-hiuxwe2 - ;; - -sco6) - os=-sco5v6 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5) - os=-sco3.2v5 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco4) - os=-sco3.2v4 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2.[4-9]*) - os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco3.2v[4-9]*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco5v6*) - # Don't forget version if it is 3.2v4 or newer. - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -sco*) - os=-sco3.2v2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -udk*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -isc) - os=-isc2.2 - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -clix*) - basic_machine=clipper-intergraph - ;; - -isc*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` - ;; - -lynx*) - os=-lynxos - ;; - -ptx*) - basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` - ;; - -windowsnt*) - os=`echo $os | sed -e 's/windowsnt/winnt/'` - ;; - -psos*) - os=-psos - ;; - -mint | -mint[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; -esac - -# Decode aliases for certain CPU-COMPANY combinations. -case $basic_machine in - # Recognize the basic CPU types without company name. - # Some are omitted here because they have special meanings below. - 1750a | 580 \ - | a29k \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ - | am33_2.0 \ - | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ - | bfin \ - | c4x | clipper \ - | d10v | d30v | dlx | dsp16xx \ - | fido | fr30 | frv \ - | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ - | i370 | i860 | i960 | ia64 \ - | ip2k | iq2000 \ - | lm32 \ - | m32c | m32r | m32rle | m68000 | m68k | m88k \ - | maxq | mb | microblaze | mcore | mep | metag \ - | mips | mipsbe | mipseb | mipsel | mipsle \ - | mips16 \ - | mips64 | mips64el \ - | mips64octeon | mips64octeonel \ - | mips64orion | mips64orionel \ - | mips64r5900 | mips64r5900el \ - | mips64vr | mips64vrel \ - | mips64vr4100 | mips64vr4100el \ - | mips64vr4300 | mips64vr4300el \ - | mips64vr5000 | mips64vr5000el \ - | mips64vr5900 | mips64vr5900el \ - | mipsisa32 | mipsisa32el \ - | mipsisa32r2 | mipsisa32r2el \ - | mipsisa64 | mipsisa64el \ - | mipsisa64r2 | mipsisa64r2el \ - | mipsisa64sb1 | mipsisa64sb1el \ - | mipsisa64sr71k | mipsisa64sr71kel \ - | mipstx39 | mipstx39el \ - | mn10200 | mn10300 \ - | moxie \ - | mt \ - | msp430 \ - | nds32 | nds32le | nds32be \ - | nios | nios2 \ - | ns16k | ns32k \ - | open8 \ - | or32 \ - | pdp10 | pdp11 | pj | pjl \ - | powerpc | powerpc64 | powerpc64le | powerpcle \ - | pyramid \ - | rx \ - | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ - | sh64 | sh64le \ - | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ - | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ - | spu \ - | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ - | ubicom32 \ - | v850 | v850e \ - | we32k \ - | x86 | xc16x | xstormy16 | xtensa \ - | z8k | z80) - basic_machine=$basic_machine-unknown - ;; - c54x) - basic_machine=tic54x-unknown - ;; - c55x) - basic_machine=tic55x-unknown - ;; - c6x) - basic_machine=tic6x-unknown - ;; - m6811 | m68hc11 | m6812 | m68hc12 | picochip) - # Motorola 68HC11/12. - basic_machine=$basic_machine-unknown - os=-none - ;; - m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) - ;; - ms1) - basic_machine=mt-unknown - ;; - - strongarm | thumb | xscale) - basic_machine=arm-unknown - ;; - - xscaleeb) - basic_machine=armeb-unknown - ;; - - xscaleel) - basic_machine=armel-unknown - ;; - - # We use `pc' rather than `unknown' - # because (1) that's what they normally are, and - # (2) the word "unknown" tends to confuse beginning users. - i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; - # Object if more than one company name word. - *-*-*) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; - # Recognize the basic CPU types with company name. - 580-* \ - | a29k-* \ - | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ - | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ - | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ - | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ - | avr-* | avr32-* \ - | bfin-* | bs2000-* \ - | c[123]* | c30-* | [cjt]90-* | c4x-* \ - | clipper-* | craynv-* | cydra-* \ - | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ - | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ - | h8300-* | h8500-* \ - | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ - | i*86-* | i860-* | i960-* | ia64-* \ - | ip2k-* | iq2000-* \ - | lm32-* \ - | m32c-* | m32r-* | m32rle-* \ - | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ - | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ - | mips16-* \ - | mips64-* | mips64el-* \ - | mips64octeon-* | mips64octeonel-* \ - | mips64orion-* | mips64orionel-* \ - | mips64r5900-* | mips64r5900el-* \ - | mips64vr-* | mips64vrel-* \ - | mips64vr4100-* | mips64vr4100el-* \ - | mips64vr4300-* | mips64vr4300el-* \ - | mips64vr5000-* | mips64vr5000el-* \ - | mips64vr5900-* | mips64vr5900el-* \ - | mipsisa32-* | mipsisa32el-* \ - | mipsisa32r2-* | mipsisa32r2el-* \ - | mipsisa64-* | mipsisa64el-* \ - | mipsisa64r2-* | mipsisa64r2el-* \ - | mipsisa64sb1-* | mipsisa64sb1el-* \ - | mipsisa64sr71k-* | mipsisa64sr71kel-* \ - | mipstx39-* | mipstx39el-* \ - | mmix-* \ - | mt-* \ - | msp430-* \ - | nds32-* | nds32le-* | nds32be-* \ - | nios-* | nios2-* \ - | none-* | np1-* | ns16k-* | ns32k-* \ - | open8-* \ - | orion-* \ - | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ - | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ - | pyramid-* \ - | romp-* | rs6000-* | rx-* \ - | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ - | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ - | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ - | tahoe-* \ - | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ - | tile-* | tilegx-* \ - | tron-* \ - | ubicom32-* \ - | v850-* | v850e-* | vax-* \ - | we32k-* \ - | x86-* | x86_64-* | xc16x-* | xps100-* \ - | xstormy16-* | xtensa*-* \ - | ymp-* \ - | z8k-* | z80-*) - ;; - # Recognize the basic CPU types without company name, with glob match. - xtensa*) - basic_machine=$basic_machine-unknown - ;; - # Recognize the various machine names and aliases which stand - # for a CPU type and a company and sometimes even an OS. - 386bsd) - basic_machine=i386-unknown - os=-bsd - ;; - 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) - basic_machine=m68000-att - ;; - 3b*) - basic_machine=we32k-att - ;; - a29khif) - basic_machine=a29k-amd - os=-udi - ;; - abacus) - basic_machine=abacus-unknown - ;; - adobe68k) - basic_machine=m68010-adobe - os=-scout - ;; - alliant | fx80) - basic_machine=fx80-alliant - ;; - altos | altos3068) - basic_machine=m68k-altos - ;; - am29k) - basic_machine=a29k-none - os=-bsd - ;; - amd64) - basic_machine=x86_64-pc - ;; - amd64-*) - basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - amdahl) - basic_machine=580-amdahl - os=-sysv - ;; - amiga | amiga-*) - basic_machine=m68k-unknown - ;; - amigaos | amigados) - basic_machine=m68k-unknown - os=-amigaos - ;; - amigaunix | amix) - basic_machine=m68k-unknown - os=-sysv4 - ;; - apollo68) - basic_machine=m68k-apollo - os=-sysv - ;; - apollo68bsd) - basic_machine=m68k-apollo - os=-bsd - ;; - aros) - basic_machine=i386-pc - os=-aros - ;; - aux) - basic_machine=m68k-apple - os=-aux - ;; - balance) - basic_machine=ns32k-sequent - os=-dynix - ;; - blackfin) - basic_machine=bfin-unknown - os=-linux - ;; - blackfin-*) - basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - bluegene*) - basic_machine=powerpc-ibm - os=-cnk - ;; - c54x-*) - basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c55x-*) - basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c6x-*) - basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - c90) - basic_machine=c90-cray - os=-unicos - ;; - cegcc) - basic_machine=arm-unknown - os=-cegcc - ;; - convex-c1) - basic_machine=c1-convex - os=-bsd - ;; - convex-c2) - basic_machine=c2-convex - os=-bsd - ;; - convex-c32) - basic_machine=c32-convex - os=-bsd - ;; - convex-c34) - basic_machine=c34-convex - os=-bsd - ;; - convex-c38) - basic_machine=c38-convex - os=-bsd - ;; - cray | j90) - basic_machine=j90-cray - os=-unicos - ;; - craynv) - basic_machine=craynv-cray - os=-unicosmp - ;; - cr16 | cr16-*) - basic_machine=cr16-unknown - os=-elf - ;; - crds | unos) - basic_machine=m68k-crds - ;; - crisv32 | crisv32-* | etraxfs*) - basic_machine=crisv32-axis - ;; - cris | cris-* | etrax*) - basic_machine=cris-axis - ;; - crx) - basic_machine=crx-unknown - os=-elf - ;; - da30 | da30-*) - basic_machine=m68k-da30 - ;; - decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) - basic_machine=mips-dec - ;; - decsystem10* | dec10*) - basic_machine=pdp10-dec - os=-tops10 - ;; - decsystem20* | dec20*) - basic_machine=pdp10-dec - os=-tops20 - ;; - delta | 3300 | motorola-3300 | motorola-delta \ - | 3300-motorola | delta-motorola) - basic_machine=m68k-motorola - ;; - delta88) - basic_machine=m88k-motorola - os=-sysv3 - ;; - dicos) - basic_machine=i686-pc - os=-dicos - ;; - djgpp) - basic_machine=i586-pc - os=-msdosdjgpp - ;; - dpx20 | dpx20-*) - basic_machine=rs6000-bull - os=-bosx - ;; - dpx2* | dpx2*-bull) - basic_machine=m68k-bull - os=-sysv3 - ;; - ebmon29k) - basic_machine=a29k-amd - os=-ebmon - ;; - elxsi) - basic_machine=elxsi-elxsi - os=-bsd - ;; - encore | umax | mmax) - basic_machine=ns32k-encore - ;; - es1800 | OSE68k | ose68k | ose | OSE) - basic_machine=m68k-ericsson - os=-ose - ;; - fx2800) - basic_machine=i860-alliant - ;; - genix) - basic_machine=ns32k-ns - ;; - gmicro) - basic_machine=tron-gmicro - os=-sysv - ;; - go32) - basic_machine=i386-pc - os=-go32 - ;; - h3050r* | hiux*) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - h8300hms) - basic_machine=h8300-hitachi - os=-hms - ;; - h8300xray) - basic_machine=h8300-hitachi - os=-xray - ;; - h8500hms) - basic_machine=h8500-hitachi - os=-hms - ;; - harris) - basic_machine=m88k-harris - os=-sysv3 - ;; - hp300-*) - basic_machine=m68k-hp - ;; - hp300bsd) - basic_machine=m68k-hp - os=-bsd - ;; - hp300hpux) - basic_machine=m68k-hp - os=-hpux - ;; - hp3k9[0-9][0-9] | hp9[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k2[0-9][0-9] | hp9k31[0-9]) - basic_machine=m68000-hp - ;; - hp9k3[2-9][0-9]) - basic_machine=m68k-hp - ;; - hp9k6[0-9][0-9] | hp6[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hp9k7[0-79][0-9] | hp7[0-79][0-9]) - basic_machine=hppa1.1-hp - ;; - hp9k78[0-9] | hp78[0-9]) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) - # FIXME: really hppa2.0-hp - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][13679] | hp8[0-9][13679]) - basic_machine=hppa1.1-hp - ;; - hp9k8[0-9][0-9] | hp8[0-9][0-9]) - basic_machine=hppa1.0-hp - ;; - hppa-next) - os=-nextstep3 - ;; - hppaosf) - basic_machine=hppa1.1-hp - os=-osf - ;; - hppro) - basic_machine=hppa1.1-hp - os=-proelf - ;; - i370-ibm* | ibm*) - basic_machine=i370-ibm - ;; -# I'm not sure what "Sysv32" means. Should this be sysv3.2? - i*86v32) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv32 - ;; - i*86v4*) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv4 - ;; - i*86v) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-sysv - ;; - i*86sol2) - basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` - os=-solaris2 - ;; - i386mach) - basic_machine=i386-mach - os=-mach - ;; - i386-vsta | vsta) - basic_machine=i386-unknown - os=-vsta - ;; - iris | iris4d) - basic_machine=mips-sgi - case $os in - -irix*) - ;; - *) - os=-irix4 - ;; - esac - ;; - isi68 | isi) - basic_machine=m68k-isi - os=-sysv - ;; - m68knommu) - basic_machine=m68k-unknown - os=-linux - ;; - m68knommu-*) - basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - m88k-omron*) - basic_machine=m88k-omron - ;; - magnum | m3230) - basic_machine=mips-mips - os=-sysv - ;; - merlin) - basic_machine=ns32k-utek - os=-sysv - ;; - microblaze) - basic_machine=microblaze-xilinx - ;; - mingw32) - basic_machine=i386-pc - os=-mingw32 - ;; - mingw32ce) - basic_machine=arm-unknown - os=-mingw32ce - ;; - miniframe) - basic_machine=m68000-convergent - ;; - *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) - basic_machine=m68k-atari - os=-mint - ;; - mips3*-*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` - ;; - mips3*) - basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown - ;; - monitor) - basic_machine=m68k-rom68k - os=-coff - ;; - morphos) - basic_machine=powerpc-unknown - os=-morphos - ;; - msdos) - basic_machine=i386-pc - os=-msdos - ;; - ms1-*) - basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` - ;; - mvs) - basic_machine=i370-ibm - os=-mvs - ;; - ncr3000) - basic_machine=i486-ncr - os=-sysv4 - ;; - netbsd386) - basic_machine=i386-unknown - os=-netbsd - ;; - netwinder) - basic_machine=armv4l-rebel - os=-linux - ;; - news | news700 | news800 | news900) - basic_machine=m68k-sony - os=-newsos - ;; - news1000) - basic_machine=m68030-sony - os=-newsos - ;; - news-3600 | risc-news) - basic_machine=mips-sony - os=-newsos - ;; - necv70) - basic_machine=v70-nec - os=-sysv - ;; - next | m*-next ) - basic_machine=m68k-next - case $os in - -nextstep* ) - ;; - -ns2*) - os=-nextstep2 - ;; - *) - os=-nextstep3 - ;; - esac - ;; - nh3000) - basic_machine=m68k-harris - os=-cxux - ;; - nh[45]000) - basic_machine=m88k-harris - os=-cxux - ;; - nindy960) - basic_machine=i960-intel - os=-nindy - ;; - mon960) - basic_machine=i960-intel - os=-mon960 - ;; - nonstopux) - basic_machine=mips-compaq - os=-nonstopux - ;; - np1) - basic_machine=np1-gould - ;; - neo-tandem) - basic_machine=neo-tandem - ;; - nse-tandem) - basic_machine=nse-tandem - ;; - nsr-tandem) - basic_machine=nsr-tandem - ;; - op50n-* | op60c-*) - basic_machine=hppa1.1-oki - os=-proelf - ;; - openrisc | openrisc-*) - basic_machine=or32-unknown - ;; - os400) - basic_machine=powerpc-ibm - os=-os400 - ;; - OSE68000 | ose68000) - basic_machine=m68000-ericsson - os=-ose - ;; - os68k) - basic_machine=m68k-none - os=-os68k - ;; - pa-hitachi) - basic_machine=hppa1.1-hitachi - os=-hiuxwe2 - ;; - paragon) - basic_machine=i860-intel - os=-osf - ;; - parisc) - basic_machine=hppa-unknown - os=-linux - ;; - parisc-*) - basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` - os=-linux - ;; - pbd) - basic_machine=sparc-tti - ;; - pbb) - basic_machine=m68k-tti - ;; - pc532 | pc532-*) - basic_machine=ns32k-pc532 - ;; - pc98) - basic_machine=i386-pc - ;; - pc98-*) - basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium | p5 | k5 | k6 | nexgen | viac3) - basic_machine=i586-pc - ;; - pentiumpro | p6 | 6x86 | athlon | athlon_*) - basic_machine=i686-pc - ;; - pentiumii | pentium2 | pentiumiii | pentium3) - basic_machine=i686-pc - ;; - pentium4) - basic_machine=i786-pc - ;; - pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) - basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumpro-* | p6-* | 6x86-* | athlon-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) - basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pentium4-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - pn) - basic_machine=pn-gould - ;; - power) basic_machine=power-ibm - ;; - ppc | ppcbe) basic_machine=powerpc-unknown - ;; - ppc-* | ppcbe-*) - basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppcle | powerpclittle | ppc-le | powerpc-little) - basic_machine=powerpcle-unknown - ;; - ppcle-* | powerpclittle-*) - basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64) basic_machine=powerpc64-unknown - ;; - ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ppc64le | powerpc64little | ppc64-le | powerpc64-little) - basic_machine=powerpc64le-unknown - ;; - ppc64le-* | powerpc64little-*) - basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - ps2) - basic_machine=i386-ibm - ;; - pw32) - basic_machine=i586-unknown - os=-pw32 - ;; - rdos) - basic_machine=i386-pc - os=-rdos - ;; - rom68k) - basic_machine=m68k-rom68k - os=-coff - ;; - rm[46]00) - basic_machine=mips-siemens - ;; - rtpc | rtpc-*) - basic_machine=romp-ibm - ;; - s390 | s390-*) - basic_machine=s390-ibm - ;; - s390x | s390x-*) - basic_machine=s390x-ibm - ;; - sa29200) - basic_machine=a29k-amd - os=-udi - ;; - sb1) - basic_machine=mipsisa64sb1-unknown - ;; - sb1el) - basic_machine=mipsisa64sb1el-unknown - ;; - sde) - basic_machine=mipsisa32-sde - os=-elf - ;; - sei) - basic_machine=mips-sei - os=-seiux - ;; - sequent) - basic_machine=i386-sequent - ;; - sh) - basic_machine=sh-hitachi - os=-hms - ;; - sh5el) - basic_machine=sh5le-unknown - ;; - sh64) - basic_machine=sh64-unknown - ;; - sparclite-wrs | simso-wrs) - basic_machine=sparclite-wrs - os=-vxworks - ;; - sps7) - basic_machine=m68k-bull - os=-sysv2 - ;; - spur) - basic_machine=spur-unknown - ;; - st2000) - basic_machine=m68k-tandem - ;; - stratus) - basic_machine=i860-stratus - os=-sysv4 - ;; - strongarm-* | thumb-*) - basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` - ;; - sun2) - basic_machine=m68000-sun - ;; - sun2os3) - basic_machine=m68000-sun - os=-sunos3 - ;; - sun2os4) - basic_machine=m68000-sun - os=-sunos4 - ;; - sun3os3) - basic_machine=m68k-sun - os=-sunos3 - ;; - sun3os4) - basic_machine=m68k-sun - os=-sunos4 - ;; - sun4os3) - basic_machine=sparc-sun - os=-sunos3 - ;; - sun4os4) - basic_machine=sparc-sun - os=-sunos4 - ;; - sun4sol2) - basic_machine=sparc-sun - os=-solaris2 - ;; - sun3 | sun3-*) - basic_machine=m68k-sun - ;; - sun4) - basic_machine=sparc-sun - ;; - sun386 | sun386i | roadrunner) - basic_machine=i386-sun - ;; - sv1) - basic_machine=sv1-cray - os=-unicos - ;; - symmetry) - basic_machine=i386-sequent - os=-dynix - ;; - t3e) - basic_machine=alphaev5-cray - os=-unicos - ;; - t90) - basic_machine=t90-cray - os=-unicos - ;; - # This must be matched before tile*. - tilegx*) - basic_machine=tilegx-unknown - os=-linux-gnu - ;; - tile*) - basic_machine=tile-unknown - os=-linux-gnu - ;; - tx39) - basic_machine=mipstx39-unknown - ;; - tx39el) - basic_machine=mipstx39el-unknown - ;; - toad1) - basic_machine=pdp10-xkl - os=-tops20 - ;; - tower | tower-32) - basic_machine=m68k-ncr - ;; - tpf) - basic_machine=s390x-ibm - os=-tpf - ;; - udi29k) - basic_machine=a29k-amd - os=-udi - ;; - ultra3) - basic_machine=a29k-nyu - os=-sym1 - ;; - v810 | necv810) - basic_machine=v810-nec - os=-none - ;; - vaxv) - basic_machine=vax-dec - os=-sysv - ;; - vms) - basic_machine=vax-dec - os=-vms - ;; - vpp*|vx|vx-*) - basic_machine=f301-fujitsu - ;; - vxworks960) - basic_machine=i960-wrs - os=-vxworks - ;; - vxworks68) - basic_machine=m68k-wrs - os=-vxworks - ;; - vxworks29k) - basic_machine=a29k-wrs - os=-vxworks - ;; - w65*) - basic_machine=w65-wdc - os=-none - ;; - w89k-*) - basic_machine=hppa1.1-winbond - os=-proelf - ;; - xbox) - basic_machine=i686-pc - os=-mingw32 - ;; - xps | xps100) - basic_machine=xps100-honeywell - ;; - xscale-* | xscalee[bl]-*) - basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` - ;; - ymp) - basic_machine=ymp-cray - os=-unicos - ;; - z8k-*-coff) - basic_machine=z8k-unknown - os=-sim - ;; - z80-*-coff) - basic_machine=z80-unknown - os=-sim - ;; - none) - basic_machine=none-none - os=-none - ;; - -# Here we handle the default manufacturer of certain CPU types. It is in -# some cases the only manufacturer, in others, it is the most popular. - w89k) - basic_machine=hppa1.1-winbond - ;; - op50n) - basic_machine=hppa1.1-oki - ;; - op60c) - basic_machine=hppa1.1-oki - ;; - romp) - basic_machine=romp-ibm - ;; - mmix) - basic_machine=mmix-knuth - ;; - rs6000) - basic_machine=rs6000-ibm - ;; - vax) - basic_machine=vax-dec - ;; - pdp10) - # there are many clones, so DEC is not a safe bet - basic_machine=pdp10-unknown - ;; - pdp11) - basic_machine=pdp11-dec - ;; - we32k) - basic_machine=we32k-att - ;; - sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) - basic_machine=sh-unknown - ;; - sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) - basic_machine=sparc-sun - ;; - cydra) - basic_machine=cydra-cydrome - ;; - orion) - basic_machine=orion-highlevel - ;; - orion105) - basic_machine=clipper-highlevel - ;; - mac | mpw | mac-mpw) - basic_machine=m68k-apple - ;; - pmac | pmac-mpw) - basic_machine=powerpc-apple - ;; - *-unknown) - # Make sure to match an already-canonicalized machine name. - ;; - *) - echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 - exit 1 - ;; -esac - -# Here we canonicalize certain aliases for manufacturers. -case $basic_machine in - *-digital*) - basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` - ;; - *-commodore*) - basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` - ;; - *) - ;; -esac - -# Decode manufacturer-specific aliases for certain operating systems. - -if [ x"$os" != x"" ] -then -case $os in - # First match some system type aliases - # that might get confused with valid system types. - # -solaris* is a basic system type, with this one exception. - -auroraux) - os=-auroraux - ;; - -solaris1 | -solaris1.*) - os=`echo $os | sed -e 's|solaris1|sunos4|'` - ;; - -solaris) - os=-solaris2 - ;; - -svr4*) - os=-sysv4 - ;; - -unixware*) - os=-sysv4.2uw - ;; - -gnu/linux*) - os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` - ;; - # First accept the basic system types. - # The portable systems comes first. - # Each alternative MUST END IN A *, to match a version number. - # -sysv* is not here because it comes later, after sysvr4. - -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ - | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ - | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ - | -sym* | -kopensolaris* \ - | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ - | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ - | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -openbsd* | -solidbsd* \ - | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ - | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ - | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ - | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ - | -chorusos* | -chorusrdb* | -cegcc* \ - | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -linux-gnu* | -linux-android* \ - | -linux-newlib* | -linux-uclibc* \ - | -uxpv* | -beos* | -mpeix* | -udk* \ - | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ - | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ - | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ - | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) - # Remember, each alternative MUST END IN *, to match a version number. - ;; - -qnx*) - case $basic_machine in - x86-* | i*86-*) - ;; - *) - os=-nto$os - ;; - esac - ;; - -nto-qnx*) - ;; - -nto*) - os=`echo $os | sed -e 's|nto|nto-qnx|'` - ;; - -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ - | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) - ;; - -mac*) - os=`echo $os | sed -e 's|mac|macos|'` - ;; - -linux-dietlibc) - os=-linux-dietlibc - ;; - -linux*) - os=`echo $os | sed -e 's|linux|linux-gnu|'` - ;; - -sunos5*) - os=`echo $os | sed -e 's|sunos5|solaris2|'` - ;; - -sunos6*) - os=`echo $os | sed -e 's|sunos6|solaris3|'` - ;; - -opened*) - os=-openedition - ;; - -os400*) - os=-os400 - ;; - -wince*) - os=-wince - ;; - -osfrose*) - os=-osfrose - ;; - -osf*) - os=-osf - ;; - -utek*) - os=-bsd - ;; - -dynix*) - os=-bsd - ;; - -acis*) - os=-aos - ;; - -atheos*) - os=-atheos - ;; - -syllable*) - os=-syllable - ;; - -386bsd) - os=-bsd - ;; - -ctix* | -uts*) - os=-sysv - ;; - -nova*) - os=-rtmk-nova - ;; - -ns2 ) - os=-nextstep2 - ;; - -nsk*) - os=-nsk - ;; - # Preserve the version number of sinix5. - -sinix5.*) - os=`echo $os | sed -e 's|sinix|sysv|'` - ;; - -sinix*) - os=-sysv4 - ;; - -tpf*) - os=-tpf - ;; - -triton*) - os=-sysv3 - ;; - -oss*) - os=-sysv3 - ;; - -svr4) - os=-sysv4 - ;; - -svr3) - os=-sysv3 - ;; - -sysvr4) - os=-sysv4 - ;; - # This must come after -sysvr4. - -sysv*) - ;; - -ose*) - os=-ose - ;; - -es1800*) - os=-ose - ;; - -xenix) - os=-xenix - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - os=-mint - ;; - -aros*) - os=-aros - ;; - -kaos*) - os=-kaos - ;; - -zvmoe) - os=-zvmoe - ;; - -dicos*) - os=-dicos - ;; - -nacl*) - ;; - -none) - ;; - *) - # Get rid of the `-' at the beginning of $os. - os=`echo $os | sed 's/[^-]*-//'` - echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 - exit 1 - ;; -esac -else - -# Here we handle the default operating systems that come with various machines. -# The value should be what the vendor currently ships out the door with their -# machine or put another way, the most popular os provided with the machine. - -# Note that if you're going to try to match "-MANUFACTURER" here (say, -# "-sun"), then you have to tell the case statement up towards the top -# that MANUFACTURER isn't an operating system. Otherwise, code above -# will signal an error saying that MANUFACTURER isn't an operating -# system, and we'll never get to this point. - -case $basic_machine in - score-*) - os=-elf - ;; - spu-*) - os=-elf - ;; - *-acorn) - os=-riscix1.2 - ;; - arm*-rebel) - os=-linux - ;; - arm*-semi) - os=-aout - ;; - c4x-* | tic4x-*) - os=-coff - ;; - tic54x-*) - os=-coff - ;; - tic55x-*) - os=-coff - ;; - tic6x-*) - os=-coff - ;; - # This must come before the *-dec entry. - pdp10-*) - os=-tops20 - ;; - pdp11-*) - os=-none - ;; - *-dec | vax-*) - os=-ultrix4.2 - ;; - m68*-apollo) - os=-domain - ;; - i386-sun) - os=-sunos4.0.2 - ;; - m68000-sun) - os=-sunos3 - # This also exists in the configure program, but was not the - # default. - # os=-sunos4 - ;; - m68*-cisco) - os=-aout - ;; - mep-*) - os=-elf - ;; - mips*-cisco) - os=-elf - ;; - mips*-*) - os=-elf - ;; - or32-*) - os=-coff - ;; - *-tti) # must be before sparc entry or we get the wrong os. - os=-sysv3 - ;; - sparc-* | *-sun) - os=-sunos4.1.1 - ;; - *-be) - os=-beos - ;; - *-haiku) - os=-haiku - ;; - *-ibm) - os=-aix - ;; - *-knuth) - os=-mmixware - ;; - *-wec) - os=-proelf - ;; - *-winbond) - os=-proelf - ;; - *-oki) - os=-proelf - ;; - *-hp) - os=-hpux - ;; - *-hitachi) - os=-hiux - ;; - i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) - os=-sysv - ;; - *-cbm) - os=-amigaos - ;; - *-dg) - os=-dgux - ;; - *-dolphin) - os=-sysv3 - ;; - m68k-ccur) - os=-rtu - ;; - m88k-omron*) - os=-luna - ;; - *-next ) - os=-nextstep - ;; - *-sequent) - os=-ptx - ;; - *-crds) - os=-unos - ;; - *-ns) - os=-genix - ;; - i370-*) - os=-mvs - ;; - *-next) - os=-nextstep3 - ;; - *-gould) - os=-sysv - ;; - *-highlevel) - os=-bsd - ;; - *-encore) - os=-bsd - ;; - *-sgi) - os=-irix - ;; - *-siemens) - os=-sysv4 - ;; - *-masscomp) - os=-rtu - ;; - f30[01]-fujitsu | f700-fujitsu) - os=-uxpv - ;; - *-rom68k) - os=-coff - ;; - *-*bug) - os=-coff - ;; - *-apple) - os=-macos - ;; - *-atari*) - os=-mint - ;; - *) - os=-none - ;; -esac -fi - -# Here we handle the case where we know the os, and the CPU type, but not the -# manufacturer. We pick the logical manufacturer. -vendor=unknown -case $basic_machine in - *-unknown) - case $os in - -riscix*) - vendor=acorn - ;; - -sunos*) - vendor=sun - ;; - -cnk*|-aix*) - vendor=ibm - ;; - -beos*) - vendor=be - ;; - -hpux*) - vendor=hp - ;; - -mpeix*) - vendor=hp - ;; - -hiux*) - vendor=hitachi - ;; - -unos*) - vendor=crds - ;; - -dgux*) - vendor=dg - ;; - -luna*) - vendor=omron - ;; - -genix*) - vendor=ns - ;; - -mvs* | -opened*) - vendor=ibm - ;; - -os400*) - vendor=ibm - ;; - -ptx*) - vendor=sequent - ;; - -tpf*) - vendor=ibm - ;; - -vxsim* | -vxworks* | -windiss*) - vendor=wrs - ;; - -aux*) - vendor=apple - ;; - -hms*) - vendor=hitachi - ;; - -mpw* | -macos*) - vendor=apple - ;; - -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) - vendor=atari - ;; - -vos*) - vendor=stratus - ;; - esac - basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` - ;; -esac - -echo $basic_machine$os -exit - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "timestamp='" -# time-stamp-format: "%:y-%02m-%02d" -# time-stamp-end: "'" -# End: diff --git a/external/mit/expat/dist/conftools/expat.m4 b/external/mit/expat/dist/conftools/expat.m4 deleted file mode 100755 index 57e579b30..000000000 --- a/external/mit/expat/dist/conftools/expat.m4 +++ /dev/null @@ -1,43 +0,0 @@ -dnl Check if --with-expat[=PREFIX] is specified and -dnl Expat >= 1.95.0 is installed in the system. -dnl If yes, substitute EXPAT_CFLAGS, EXPAT_LIBS with regard to -dnl the specified PREFIX and set with_expat to PREFIX, or 'yes' if PREFIX -dnl has not been specified. Also HAVE_LIBEXPAT, HAVE_EXPAT_H are defined. -dnl If --with-expat has not been specified, set with_expat to 'no'. -dnl In addition, an Automake conditional EXPAT_INSTALLED is set accordingly. -dnl This is necessary to adapt a whole lot of packages that have expat -dnl bundled as a static library. -AC_DEFUN([AM_WITH_EXPAT], -[ AC_ARG_WITH(expat, - [ --with-expat=PREFIX Use system Expat library], - , with_expat=no) - - AM_CONDITIONAL(EXPAT_INSTALLED, test $with_expat != no) - - EXPAT_CFLAGS= - EXPAT_LIBS= - if test $with_expat != no; then - if test $with_expat != yes; then - EXPAT_CFLAGS="-I$with_expat/include" - EXPAT_LIBS="-L$with_expat/lib" - fi - AC_CHECK_LIB(expat, XML_ParserCreate, - [ EXPAT_LIBS="$EXPAT_LIBS -lexpat" - expat_found=yes ], - [ expat_found=no ], - "$EXPAT_LIBS") - if test $expat_found = no; then - AC_MSG_ERROR([Could not find the Expat library]) - fi - expat_save_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS $EXPAT_CFLAGS" - AC_CHECK_HEADERS(expat.h, , expat_found=no) - if test $expat_found = no; then - AC_MSG_ERROR([Could not find expat.h]) - fi - CFLAGS="$expat_save_CFLAGS" - fi - - AC_SUBST(EXPAT_CFLAGS) - AC_SUBST(EXPAT_LIBS) -]) diff --git a/external/mit/expat/dist/conftools/get-version.sh b/external/mit/expat/dist/conftools/get-version.sh deleted file mode 100755 index a70e0fb47..000000000 --- a/external/mit/expat/dist/conftools/get-version.sh +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/sh -# -# USAGE: get-version.sh path/to/expat.h -# -# This script will print Expat's version number on stdout. For example: -# -# $ ./conftools/get-version.sh ./lib/expat.h -# 1.95.3 -# $ -# - -if test $# = 0; then - echo "ERROR: pathname for expat.h was not provided." - echo "" - echo "USAGE: $0 path/to/expat.h" - exit 1 -fi -if test $# != 1; then - echo "ERROR: too many arguments were provided." - echo "" - echo "USAGE: $0 path/to/expat.h" - exit 1 -fi - -hdr="$1" -if test ! -r "$hdr"; then - echo "ERROR: '$hdr' does not exist, or is not readable." - exit 1 -fi - -MAJOR_VERSION="`sed -n -e '/MAJOR_VERSION/s/[^0-9]*//gp' $hdr`" -MINOR_VERSION="`sed -n -e '/MINOR_VERSION/s/[^0-9]*//gp' $hdr`" -MICRO_VERSION="`sed -n -e '/MICRO_VERSION/s/[^0-9]*//gp' $hdr`" - -# Determine how to tell echo not to print the trailing \n. This is -# similar to Autoconf's @ECHO_C@ and @ECHO_N@; however, we don't -# generate this file via autoconf (in fact, get-version.sh is used -# to *create* ./configure), so we just do something similar inline. -case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in - *c*,-n*) ECHO_N= ECHO_C=' -' ;; - *c*,* ) ECHO_N=-n ECHO_C= ;; - *) ECHO_N= ECHO_C='\c' ;; -esac - -echo $ECHO_N "$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$ECHO_C" diff --git a/external/mit/expat/dist/conftools/install-sh b/external/mit/expat/dist/conftools/install-sh deleted file mode 100755 index 6781b987b..000000000 --- a/external/mit/expat/dist/conftools/install-sh +++ /dev/null @@ -1,520 +0,0 @@ -#!/bin/sh -# install - install a program, script, or datafile - -scriptversion=2009-04-28.21; # UTC - -# This originates from X11R5 (mit/util/scripts/install.sh), which was -# later released in X11R6 (xc/config/util/install.sh) with the -# following copyright and license. -# -# Copyright (C) 1994 X Consortium -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to -# deal in the Software without restriction, including without limitation the -# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -# sell copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- -# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# -# Except as contained in this notice, the name of the X Consortium shall not -# be used in advertising or otherwise to promote the sale, use or other deal- -# ings in this Software without prior written authorization from the X Consor- -# tium. -# -# -# FSF changes to this file are in the public domain. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. - -nl=' -' -IFS=" "" $nl" - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit=${DOITPROG-} -if test -z "$doit"; then - doit_exec=exec -else - doit_exec=$doit -fi - -# Put in absolute file names if you don't have them in your path; -# or use environment vars. - -chgrpprog=${CHGRPPROG-chgrp} -chmodprog=${CHMODPROG-chmod} -chownprog=${CHOWNPROG-chown} -cmpprog=${CMPPROG-cmp} -cpprog=${CPPROG-cp} -mkdirprog=${MKDIRPROG-mkdir} -mvprog=${MVPROG-mv} -rmprog=${RMPROG-rm} -stripprog=${STRIPPROG-strip} - -posix_glob='?' -initialize_posix_glob=' - test "$posix_glob" != "?" || { - if (set -f) 2>/dev/null; then - posix_glob= - else - posix_glob=: - fi - } -' - -posix_mkdir= - -# Desired mode of installed file. -mode=0755 - -chgrpcmd= -chmodcmd=$chmodprog -chowncmd= -mvcmd=$mvprog -rmcmd="$rmprog -f" -stripcmd= - -src= -dst= -dir_arg= -dst_arg= - -copy_on_change=false -no_target_directory= - -usage="\ -Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE - or: $0 [OPTION]... SRCFILES... DIRECTORY - or: $0 [OPTION]... -t DIRECTORY SRCFILES... - or: $0 [OPTION]... -d DIRECTORIES... - -In the 1st form, copy SRCFILE to DSTFILE. -In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. -In the 4th, create DIRECTORIES. - -Options: - --help display this help and exit. - --version display version info and exit. - - -c (ignored) - -C install only if different (preserve the last data modification time) - -d create directories instead of installing files. - -g GROUP $chgrpprog installed files to GROUP. - -m MODE $chmodprog installed files to MODE. - -o USER $chownprog installed files to USER. - -s $stripprog installed files. - -t DIRECTORY install into DIRECTORY. - -T report an error if DSTFILE is a directory. - -Environment variables override the default commands: - CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG - RMPROG STRIPPROG -" - -while test $# -ne 0; do - case $1 in - -c) ;; - - -C) copy_on_change=true;; - - -d) dir_arg=true;; - - -g) chgrpcmd="$chgrpprog $2" - shift;; - - --help) echo "$usage"; exit $?;; - - -m) mode=$2 - case $mode in - *' '* | *' '* | *' -'* | *'*'* | *'?'* | *'['*) - echo "$0: invalid mode: $mode" >&2 - exit 1;; - esac - shift;; - - -o) chowncmd="$chownprog $2" - shift;; - - -s) stripcmd=$stripprog;; - - -t) dst_arg=$2 - shift;; - - -T) no_target_directory=true;; - - --version) echo "$0 $scriptversion"; exit $?;; - - --) shift - break;; - - -*) echo "$0: invalid option: $1" >&2 - exit 1;; - - *) break;; - esac - shift -done - -if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then - # When -d is used, all remaining arguments are directories to create. - # When -t is used, the destination is already specified. - # Otherwise, the last argument is the destination. Remove it from $@. - for arg - do - if test -n "$dst_arg"; then - # $@ is not empty: it contains at least $arg. - set fnord "$@" "$dst_arg" - shift # fnord - fi - shift # arg - dst_arg=$arg - done -fi - -if test $# -eq 0; then - if test -z "$dir_arg"; then - echo "$0: no input file specified." >&2 - exit 1 - fi - # It's OK to call `install-sh -d' without argument. - # This can happen when creating conditional directories. - exit 0 -fi - -if test -z "$dir_arg"; then - trap '(exit $?); exit' 1 2 13 15 - - # Set umask so as not to create temps with too-generous modes. - # However, 'strip' requires both read and write access to temps. - case $mode in - # Optimize common cases. - *644) cp_umask=133;; - *755) cp_umask=22;; - - *[0-7]) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw='% 200' - fi - cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; - *) - if test -z "$stripcmd"; then - u_plus_rw= - else - u_plus_rw=,u+rw - fi - cp_umask=$mode$u_plus_rw;; - esac -fi - -for src -do - # Protect names starting with `-'. - case $src in - -*) src=./$src;; - esac - - if test -n "$dir_arg"; then - dst=$src - dstdir=$dst - test -d "$dstdir" - dstdir_status=$? - else - - # Waiting for this to be detected by the "$cpprog $src $dsttmp" command - # might cause directories to be created, which would be especially bad - # if $src (and thus $dsttmp) contains '*'. - if test ! -f "$src" && test ! -d "$src"; then - echo "$0: $src does not exist." >&2 - exit 1 - fi - - if test -z "$dst_arg"; then - echo "$0: no destination specified." >&2 - exit 1 - fi - - dst=$dst_arg - # Protect names starting with `-'. - case $dst in - -*) dst=./$dst;; - esac - - # If destination is a directory, append the input filename; won't work - # if double slashes aren't ignored. - if test -d "$dst"; then - if test -n "$no_target_directory"; then - echo "$0: $dst_arg: Is a directory" >&2 - exit 1 - fi - dstdir=$dst - dst=$dstdir/`basename "$src"` - dstdir_status=0 - else - # Prefer dirname, but fall back on a substitute if dirname fails. - dstdir=` - (dirname "$dst") 2>/dev/null || - expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$dst" : 'X\(//\)[^/]' \| \ - X"$dst" : 'X\(//\)$' \| \ - X"$dst" : 'X\(/\)' \| . 2>/dev/null || - echo X"$dst" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q' - ` - - test -d "$dstdir" - dstdir_status=$? - fi - fi - - obsolete_mkdir_used=false - - if test $dstdir_status != 0; then - case $posix_mkdir in - '') - # Create intermediate dirs using mode 755 as modified by the umask. - # This is like FreeBSD 'install' as of 1997-10-28. - umask=`umask` - case $stripcmd.$umask in - # Optimize common cases. - *[2367][2367]) mkdir_umask=$umask;; - .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; - - *[0-7]) - mkdir_umask=`expr $umask + 22 \ - - $umask % 100 % 40 + $umask % 20 \ - - $umask % 10 % 4 + $umask % 2 - `;; - *) mkdir_umask=$umask,go-w;; - esac - - # With -d, create the new directory with the user-specified mode. - # Otherwise, rely on $mkdir_umask. - if test -n "$dir_arg"; then - mkdir_mode=-m$mode - else - mkdir_mode= - fi - - posix_mkdir=false - case $umask in - *[123567][0-7][0-7]) - # POSIX mkdir -p sets u+wx bits regardless of umask, which - # is incompatible with FreeBSD 'install' when (umask & 300) != 0. - ;; - *) - tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ - trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 - - if (umask $mkdir_umask && - exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 - then - if test -z "$dir_arg" || { - # Check for POSIX incompatibilities with -m. - # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or - # other-writeable bit of parent directory when it shouldn't. - # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. - ls_ld_tmpdir=`ls -ld "$tmpdir"` - case $ls_ld_tmpdir in - d????-?r-*) different_mode=700;; - d????-?--*) different_mode=755;; - *) false;; - esac && - $mkdirprog -m$different_mode -p -- "$tmpdir" && { - ls_ld_tmpdir_1=`ls -ld "$tmpdir"` - test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" - } - } - then posix_mkdir=: - fi - rmdir "$tmpdir/d" "$tmpdir" - else - # Remove any dirs left behind by ancient mkdir implementations. - rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null - fi - trap '' 0;; - esac;; - esac - - if - $posix_mkdir && ( - umask $mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" - ) - then : - else - - # The umask is ridiculous, or mkdir does not conform to POSIX, - # or it failed possibly due to a race condition. Create the - # directory the slow way, step by step, checking for races as we go. - - case $dstdir in - /*) prefix='/';; - -*) prefix='./';; - *) prefix='';; - esac - - eval "$initialize_posix_glob" - - oIFS=$IFS - IFS=/ - $posix_glob set -f - set fnord $dstdir - shift - $posix_glob set +f - IFS=$oIFS - - prefixes= - - for d - do - test -z "$d" && continue - - prefix=$prefix$d - if test -d "$prefix"; then - prefixes= - else - if $posix_mkdir; then - (umask=$mkdir_umask && - $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break - # Don't fail if two instances are running concurrently. - test -d "$prefix" || exit 1 - else - case $prefix in - *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; - *) qprefix=$prefix;; - esac - prefixes="$prefixes '$qprefix'" - fi - fi - prefix=$prefix/ - done - - if test -n "$prefixes"; then - # Don't fail if two instances are running concurrently. - (umask $mkdir_umask && - eval "\$doit_exec \$mkdirprog $prefixes") || - test -d "$dstdir" || exit 1 - obsolete_mkdir_used=true - fi - fi - fi - - if test -n "$dir_arg"; then - { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && - { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || - test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 - else - - # Make a couple of temp file names in the proper directory. - dsttmp=$dstdir/_inst.$$_ - rmtmp=$dstdir/_rm.$$_ - - # Trap to clean up those temp files at exit. - trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 - - # Copy the file name to the temp name. - (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && - - # and set any options; do chmod last to preserve setuid bits. - # - # If any of these fail, we abort the whole thing. If we want to - # ignore errors from any of these, just make sure not to ignore - # errors from the above "$doit $cpprog $src $dsttmp" command. - # - { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && - { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && - { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && - { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && - - # If -C, don't bother to copy if it wouldn't change the file. - if $copy_on_change && - old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && - new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && - - eval "$initialize_posix_glob" && - $posix_glob set -f && - set X $old && old=:$2:$4:$5:$6 && - set X $new && new=:$2:$4:$5:$6 && - $posix_glob set +f && - - test "$old" = "$new" && - $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 - then - rm -f "$dsttmp" - else - # Rename the file to the real destination. - $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || - - # The rename failed, perhaps because mv can't rename something else - # to itself, or perhaps because mv is so ancient that it does not - # support -f. - { - # Now remove or move aside any old file at destination location. - # We try this two ways since rm can't unlink itself on some - # systems and the destination file might be busy for other - # reasons. In this case, the final cleanup might fail but the new - # file should still install successfully. - { - test ! -f "$dst" || - $doit $rmcmd -f "$dst" 2>/dev/null || - { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && - { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } - } || - { echo "$0: cannot unlink or rename $dst" >&2 - (exit 1); exit 1 - } - } && - - # Now rename the file to the real destination. - $doit $mvcmd "$dsttmp" "$dst" - } - fi || exit 1 - - trap '' 0 - fi -done - -# Local variables: -# eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC" -# time-stamp-end: "; # UTC" -# End: diff --git a/external/mit/expat/dist/conftools/ltmain.sh b/external/mit/expat/dist/conftools/ltmain.sh deleted file mode 100755 index b4a3231ca..000000000 --- a/external/mit/expat/dist/conftools/ltmain.sh +++ /dev/null @@ -1,9642 +0,0 @@ - -# libtool (GNU libtool) 2.4 -# Written by Gordon Matzigkeit , 1996 - -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, -# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. -# This is free software; see the source for copying conditions. There is NO -# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -# GNU Libtool is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, -# or obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - -# Usage: $progname [OPTION]... [MODE-ARG]... -# -# Provide generalized library-building support services. -# -# --config show all configuration variables -# --debug enable verbose shell tracing -# -n, --dry-run display commands without modifying any files -# --features display basic configuration information and exit -# --mode=MODE use operation mode MODE -# --preserve-dup-deps don't remove duplicate dependency libraries -# --quiet, --silent don't print informational messages -# --no-quiet, --no-silent -# print informational messages (default) -# --tag=TAG use configuration variables from tag TAG -# -v, --verbose print more informational messages than default -# --no-verbose don't print the extra informational messages -# --version print version information -# -h, --help, --help-all print short, long, or detailed help message -# -# MODE must be one of the following: -# -# clean remove files from the build directory -# compile compile a source file into a libtool object -# execute automatically set library path, then run a program -# finish complete the installation of libtool libraries -# install install libraries or executables -# link create a library or an executable -# uninstall remove libraries from an installed directory -# -# MODE-ARGS vary depending on the MODE. When passed as first option, -# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. -# Try `$progname --help --mode=MODE' for a more detailed description of MODE. -# -# When reporting a bug, please describe a test case to reproduce it and -# include the following information: -# -# host-triplet: $host -# shell: $SHELL -# compiler: $LTCC -# compiler flags: $LTCFLAGS -# linker: $LD (gnu? $with_gnu_ld) -# $progname: (GNU libtool) 2.4 Debian-2.4-2ubuntu1 -# automake: $automake_version -# autoconf: $autoconf_version -# -# Report bugs to . -# GNU libtool home page: . -# General help using GNU software: . - -PROGRAM=libtool -PACKAGE=libtool -VERSION="2.4 Debian-2.4-2ubuntu1" -TIMESTAMP="" -package_revision=1.3293 - -# Be Bourne compatible -if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which - # is contrary to our usage. Disable this feature. - alias -g '${1+"$@"}'='"$@"' - setopt NO_GLOB_SUBST -else - case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -$1 -_LTECHO_EOF' -} - -# NLS nuisances: We save the old values to restore during execute mode. -lt_user_locale= -lt_safe_locale= -for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES -do - eval "if test \"\${$lt_var+set}\" = set; then - save_$lt_var=\$$lt_var - $lt_var=C - export $lt_var - lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" - lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" - fi" -done -LC_ALL=C -LANGUAGE=C -export LANGUAGE LC_ALL - -$lt_unset CDPATH - - -# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh -# is ksh but when the shell is invoked as "sh" and the current value of -# the _XPG environment variable is not equal to 1 (one), the special -# positional parameter $0, within a function call, is the name of the -# function. -progpath="$0" - - - -: ${CP="cp -f"} -test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} -: ${EGREP="/bin/grep -E"} -: ${FGREP="/bin/grep -F"} -: ${GREP="/bin/grep"} -: ${LN_S="ln -s"} -: ${MAKE="make"} -: ${MKDIR="mkdir"} -: ${MV="mv -f"} -: ${RM="rm -f"} -: ${SED="/bin/sed"} -: ${SHELL="${CONFIG_SHELL-/bin/sh}"} -: ${Xsed="$SED -e 1s/^X//"} - -# Global variables: -EXIT_SUCCESS=0 -EXIT_FAILURE=1 -EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. -EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. - -exit_status=$EXIT_SUCCESS - -# Make sure IFS has a sensible default -lt_nl=' -' -IFS=" $lt_nl" - -dirname="s,/[^/]*$,," -basename="s,^.*/,," - -# func_dirname file append nondir_replacement -# Compute the dirname of FILE. If nonempty, add APPEND to the result, -# otherwise set result to NONDIR_REPLACEMENT. -func_dirname () -{ - func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi -} # func_dirname may be replaced by extended shell implementation - - -# func_basename file -func_basename () -{ - func_basename_result=`$ECHO "${1}" | $SED "$basename"` -} # func_basename may be replaced by extended shell implementation - - -# func_dirname_and_basename file append nondir_replacement -# perform func_basename and func_dirname in a single function -# call: -# dirname: Compute the dirname of FILE. If nonempty, -# add APPEND to the result, otherwise set result -# to NONDIR_REPLACEMENT. -# value returned in "$func_dirname_result" -# basename: Compute filename of FILE. -# value retuned in "$func_basename_result" -# Implementation must be kept synchronized with func_dirname -# and func_basename. For efficiency, we do not delegate to -# those functions but instead duplicate the functionality here. -func_dirname_and_basename () -{ - # Extract subdirectory from the argument. - func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` - if test "X$func_dirname_result" = "X${1}"; then - func_dirname_result="${3}" - else - func_dirname_result="$func_dirname_result${2}" - fi - func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` -} # func_dirname_and_basename may be replaced by extended shell implementation - - -# func_stripname prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# func_strip_suffix prefix name -func_stripname () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname may be replaced by extended shell implementation - - -# These SED scripts presuppose an absolute path with a trailing slash. -pathcar='s,^/\([^/]*\).*$,\1,' -pathcdr='s,^/[^/]*,,' -removedotparts=':dotsl - s@/\./@/@g - t dotsl - s,/\.$,/,' -collapseslashes='s@/\{1,\}@/@g' -finalslash='s,/*$,/,' - -# func_normal_abspath PATH -# Remove doubled-up and trailing slashes, "." path components, -# and cancel out any ".." path components in PATH after making -# it an absolute path. -# value returned in "$func_normal_abspath_result" -func_normal_abspath () -{ - # Start from root dir and reassemble the path. - func_normal_abspath_result= - func_normal_abspath_tpath=$1 - func_normal_abspath_altnamespace= - case $func_normal_abspath_tpath in - "") - # Empty path, that just means $cwd. - func_stripname '' '/' "`pwd`" - func_normal_abspath_result=$func_stripname_result - return - ;; - # The next three entries are used to spot a run of precisely - # two leading slashes without using negated character classes; - # we take advantage of case's first-match behaviour. - ///*) - # Unusual form of absolute path, do nothing. - ;; - //*) - # Not necessarily an ordinary path; POSIX reserves leading '//' - # and for example Cygwin uses it to access remote file shares - # over CIFS/SMB, so we conserve a leading double slash if found. - func_normal_abspath_altnamespace=/ - ;; - /*) - # Absolute path, do nothing. - ;; - *) - # Relative path, prepend $cwd. - func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath - ;; - esac - # Cancel out all the simple stuff to save iterations. We also want - # the path to end with a slash for ease of parsing, so make sure - # there is one (and only one) here. - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` - while :; do - # Processed it all yet? - if test "$func_normal_abspath_tpath" = / ; then - # If we ascended to the root using ".." the result may be empty now. - if test -z "$func_normal_abspath_result" ; then - func_normal_abspath_result=/ - fi - break - fi - func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcar"` - func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ - -e "$pathcdr"` - # Figure out what to do with it - case $func_normal_abspath_tcomponent in - "") - # Trailing empty path component, ignore it. - ;; - ..) - # Parent dir; strip last assembled component from result. - func_dirname "$func_normal_abspath_result" - func_normal_abspath_result=$func_dirname_result - ;; - *) - # Actual path component, append it. - func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent - ;; - esac - done - # Restore leading double-slash if one was found on entry. - func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result -} - -# func_relative_path SRCDIR DSTDIR -# generates a relative path from SRCDIR to DSTDIR, with a trailing -# slash if non-empty, suitable for immediately appending a filename -# without needing to append a separator. -# value returned in "$func_relative_path_result" -func_relative_path () -{ - func_relative_path_result= - func_normal_abspath "$1" - func_relative_path_tlibdir=$func_normal_abspath_result - func_normal_abspath "$2" - func_relative_path_tbindir=$func_normal_abspath_result - - # Ascend the tree starting from libdir - while :; do - # check if we have found a prefix of bindir - case $func_relative_path_tbindir in - $func_relative_path_tlibdir) - # found an exact match - func_relative_path_tcancelled= - break - ;; - $func_relative_path_tlibdir*) - # found a matching prefix - func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" - func_relative_path_tcancelled=$func_stripname_result - if test -z "$func_relative_path_result"; then - func_relative_path_result=. - fi - break - ;; - *) - func_dirname $func_relative_path_tlibdir - func_relative_path_tlibdir=${func_dirname_result} - if test "x$func_relative_path_tlibdir" = x ; then - # Have to descend all the way to the root! - func_relative_path_result=../$func_relative_path_result - func_relative_path_tcancelled=$func_relative_path_tbindir - break - fi - func_relative_path_result=../$func_relative_path_result - ;; - esac - done - - # Now calculate path; take care to avoid doubling-up slashes. - func_stripname '' '/' "$func_relative_path_result" - func_relative_path_result=$func_stripname_result - func_stripname '/' '/' "$func_relative_path_tcancelled" - if test "x$func_stripname_result" != x ; then - func_relative_path_result=${func_relative_path_result}/${func_stripname_result} - fi - - # Normalisation. If bindir is libdir, return empty string, - # else relative path ending with a slash; either way, target - # file name can be directly appended. - if test ! -z "$func_relative_path_result"; then - func_stripname './' '' "$func_relative_path_result/" - func_relative_path_result=$func_stripname_result - fi -} - -# The name of this program: -func_dirname_and_basename "$progpath" -progname=$func_basename_result - -# Make sure we have an absolute path for reexecution: -case $progpath in - [\\/]*|[A-Za-z]:\\*) ;; - *[\\/]*) - progdir=$func_dirname_result - progdir=`cd "$progdir" && pwd` - progpath="$progdir/$progname" - ;; - *) - save_IFS="$IFS" - IFS=: - for progdir in $PATH; do - IFS="$save_IFS" - test -x "$progdir/$progname" && break - done - IFS="$save_IFS" - test -n "$progdir" || progdir=`pwd` - progpath="$progdir/$progname" - ;; -esac - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -Xsed="${SED}"' -e 1s/^X//' -sed_quote_subst='s/\([`"$\\]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\(["`\\]\)/\\\1/g' - -# Sed substitution that turns a string into a regex matching for the -# string literally. -sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' - -# Sed substitution that converts a w32 file name or path -# which contains forward slashes, into one that contains -# (escaped) backslashes. A very naive implementation. -lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' - -# Re-`\' parameter expansions in output of double_quote_subst that were -# `\'-ed in input to the same. If an odd number of `\' preceded a '$' -# in input to double_quote_subst, that '$' was protected from expansion. -# Since each input `\' is now two `\'s, look for any number of runs of -# four `\'s followed by two `\'s and then a '$'. `\' that '$'. -bs='\\' -bs2='\\\\' -bs4='\\\\\\\\' -dollar='\$' -sed_double_backslash="\ - s/$bs4/&\\ -/g - s/^$bs2$dollar/$bs&/ - s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g - s/\n//g" - -# Standard options: -opt_dry_run=false -opt_help=false -opt_quiet=false -opt_verbose=false -opt_warning=: - -# func_echo arg... -# Echo program name prefixed message, along with the current mode -# name if it has been set yet. -func_echo () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }$*" -} - -# func_verbose arg... -# Echo program name prefixed message in verbose mode only. -func_verbose () -{ - $opt_verbose && func_echo ${1+"$@"} - - # A bug in bash halts the script if the last line of a function - # fails when set -e is in force, so we need another command to - # work around that: - : -} - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -# func_error arg... -# Echo program name prefixed message to standard error. -func_error () -{ - $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 -} - -# func_warning arg... -# Echo program name prefixed warning message to standard error. -func_warning () -{ - $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 - - # bash bug again: - : -} - -# func_fatal_error arg... -# Echo program name prefixed message to standard error, and exit. -func_fatal_error () -{ - func_error ${1+"$@"} - exit $EXIT_FAILURE -} - -# func_fatal_help arg... -# Echo program name prefixed message to standard error, followed by -# a help hint, and exit. -func_fatal_help () -{ - func_error ${1+"$@"} - func_fatal_error "$help" -} -help="Try \`$progname --help' for more information." ## default - - -# func_grep expression filename -# Check whether EXPRESSION matches any line of FILENAME, without output. -func_grep () -{ - $GREP "$1" "$2" >/dev/null 2>&1 -} - - -# func_mkdir_p directory-path -# Make sure the entire path to DIRECTORY-PATH is available. -func_mkdir_p () -{ - my_directory_path="$1" - my_dir_list= - - if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then - - # Protect directory names starting with `-' - case $my_directory_path in - -*) my_directory_path="./$my_directory_path" ;; - esac - - # While some portion of DIR does not yet exist... - while test ! -d "$my_directory_path"; do - # ...make a list in topmost first order. Use a colon delimited - # list incase some portion of path contains whitespace. - my_dir_list="$my_directory_path:$my_dir_list" - - # If the last portion added has no slash in it, the list is done - case $my_directory_path in */*) ;; *) break ;; esac - - # ...otherwise throw away the child directory and loop - my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` - done - my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` - - save_mkdir_p_IFS="$IFS"; IFS=':' - for my_dir in $my_dir_list; do - IFS="$save_mkdir_p_IFS" - # mkdir can fail with a `File exist' error if two processes - # try to create one of the directories concurrently. Don't - # stop in that case! - $MKDIR "$my_dir" 2>/dev/null || : - done - IFS="$save_mkdir_p_IFS" - - # Bail out if we (or some other process) failed to create a directory. - test -d "$my_directory_path" || \ - func_fatal_error "Failed to create \`$1'" - fi -} - - -# func_mktempdir [string] -# Make a temporary directory that won't clash with other running -# libtool processes, and avoids race conditions if possible. If -# given, STRING is the basename for that directory. -func_mktempdir () -{ - my_template="${TMPDIR-/tmp}/${1-$progname}" - - if test "$opt_dry_run" = ":"; then - # Return a directory name, but don't create it in dry-run mode - my_tmpdir="${my_template}-$$" - else - - # If mktemp works, use that first and foremost - my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` - - if test ! -d "$my_tmpdir"; then - # Failing that, at least try and use $RANDOM to avoid a race - my_tmpdir="${my_template}-${RANDOM-0}$$" - - save_mktempdir_umask=`umask` - umask 0077 - $MKDIR "$my_tmpdir" - umask $save_mktempdir_umask - fi - - # If we're not in dry-run mode, bomb out on failure - test -d "$my_tmpdir" || \ - func_fatal_error "cannot create temporary directory \`$my_tmpdir'" - fi - - $ECHO "$my_tmpdir" -} - - -# func_quote_for_eval arg -# Aesthetically quote ARG to be evaled later. -# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT -# is double-quoted, suitable for a subsequent eval, whereas -# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters -# which are still active within double quotes backslashified. -func_quote_for_eval () -{ - case $1 in - *[\\\`\"\$]*) - func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; - *) - func_quote_for_eval_unquoted_result="$1" ;; - esac - - case $func_quote_for_eval_unquoted_result in - # Double-quote args containing shell metacharacters to delay - # word splitting, command substitution and and variable - # expansion for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" - ;; - *) - func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" - esac -} - - -# func_quote_for_expand arg -# Aesthetically quote ARG to be evaled later; same as above, -# but do not quote variable references. -func_quote_for_expand () -{ - case $1 in - *[\\\`\"]*) - my_arg=`$ECHO "$1" | $SED \ - -e "$double_quote_subst" -e "$sed_double_backslash"` ;; - *) - my_arg="$1" ;; - esac - - case $my_arg in - # Double-quote args containing shell metacharacters to delay - # word splitting and command substitution for a subsequent eval. - # Many Bourne shells cannot handle close brackets correctly - # in scan sets, so we specify it separately. - *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") - my_arg="\"$my_arg\"" - ;; - esac - - func_quote_for_expand_result="$my_arg" -} - - -# func_show_eval cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. -func_show_eval () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$my_cmd" - my_status=$? - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - - -# func_show_eval_locale cmd [fail_exp] -# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is -# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP -# is given, then evaluate it. Use the saved locale for evaluation. -func_show_eval_locale () -{ - my_cmd="$1" - my_fail_exp="${2-:}" - - ${opt_silent-false} || { - func_quote_for_expand "$my_cmd" - eval "func_echo $func_quote_for_expand_result" - } - - if ${opt_dry_run-false}; then :; else - eval "$lt_user_locale - $my_cmd" - my_status=$? - eval "$lt_safe_locale" - if test "$my_status" -eq 0; then :; else - eval "(exit $my_status); $my_fail_exp" - fi - fi -} - -# func_tr_sh -# Turn $1 into a string suitable for a shell variable name. -# Result is stored in $func_tr_sh_result. All characters -# not in the set a-zA-Z0-9_ are replaced with '_'. Further, -# if $1 begins with a digit, a '_' is prepended as well. -func_tr_sh () -{ - case $1 in - [0-9]* | *[!a-zA-Z0-9_]*) - func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` - ;; - * ) - func_tr_sh_result=$1 - ;; - esac -} - - -# func_version -# Echo version message to standard output and exit. -func_version () -{ - $opt_debug - - $SED -n '/(C)/!b go - :more - /\./!{ - N - s/\n# / / - b more - } - :go - /^# '$PROGRAM' (GNU /,/# warranty; / { - s/^# // - s/^# *$// - s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ - p - }' < "$progpath" - exit $? -} - -# func_usage -# Echo short help message to standard output and exit. -func_usage () -{ - $opt_debug - - $SED -n '/^# Usage:/,/^# *.*--help/ { - s/^# // - s/^# *$// - s/\$progname/'$progname'/ - p - }' < "$progpath" - echo - $ECHO "run \`$progname --help | more' for full usage" - exit $? -} - -# func_help [NOEXIT] -# Echo long help message to standard output and exit, -# unless 'noexit' is passed as argument. -func_help () -{ - $opt_debug - - $SED -n '/^# Usage:/,/# Report bugs to/ { - :print - s/^# // - s/^# *$// - s*\$progname*'$progname'* - s*\$host*'"$host"'* - s*\$SHELL*'"$SHELL"'* - s*\$LTCC*'"$LTCC"'* - s*\$LTCFLAGS*'"$LTCFLAGS"'* - s*\$LD*'"$LD"'* - s/\$with_gnu_ld/'"$with_gnu_ld"'/ - s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ - s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ - p - d - } - /^# .* home page:/b print - /^# General help using/b print - ' < "$progpath" - ret=$? - if test -z "$1"; then - exit $ret - fi -} - -# func_missing_arg argname -# Echo program name prefixed message to standard error and set global -# exit_cmd. -func_missing_arg () -{ - $opt_debug - - func_error "missing argument for $1." - exit_cmd=exit -} - - -# func_split_short_opt shortopt -# Set func_split_short_opt_name and func_split_short_opt_arg shell -# variables after splitting SHORTOPT after the 2nd character. -func_split_short_opt () -{ - my_sed_short_opt='1s/^\(..\).*$/\1/;q' - my_sed_short_rest='1s/^..\(.*\)$/\1/;q' - - func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` - func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` -} # func_split_short_opt may be replaced by extended shell implementation - - -# func_split_long_opt longopt -# Set func_split_long_opt_name and func_split_long_opt_arg shell -# variables after splitting LONGOPT at the `=' sign. -func_split_long_opt () -{ - my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' - my_sed_long_arg='1s/^--[^=]*=//' - - func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` - func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` -} # func_split_long_opt may be replaced by extended shell implementation - -exit_cmd=: - - - - - -magic="%%%MAGIC variable%%%" -magic_exe="%%%MAGIC EXE variable%%%" - -# Global variables. -nonopt= -preserve_args= -lo2o="s/\\.lo\$/.${objext}/" -o2lo="s/\\.${objext}\$/.lo/" -extracted_archives= -extracted_serial=0 - -# If this variable is set in any of the actions, the command in it -# will be execed at the end. This prevents here-documents from being -# left over by shells. -exec_cmd= - -# func_append var value -# Append VALUE to the end of shell variable VAR. -func_append () -{ - eval "${1}=\$${1}\${2}" -} # func_append may be replaced by extended shell implementation - -# func_append_quoted var value -# Quote VALUE and append to the end of shell variable VAR, separated -# by a space. -func_append_quoted () -{ - func_quote_for_eval "${2}" - eval "${1}=\$${1}\\ \$func_quote_for_eval_result" -} # func_append_quoted may be replaced by extended shell implementation - - -# func_arith arithmetic-term... -func_arith () -{ - func_arith_result=`expr "${@}"` -} # func_arith may be replaced by extended shell implementation - - -# func_len string -# STRING may not start with a hyphen. -func_len () -{ - func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` -} # func_len may be replaced by extended shell implementation - - -# func_lo2o object -func_lo2o () -{ - func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` -} # func_lo2o may be replaced by extended shell implementation - - -# func_xform libobj-or-source -func_xform () -{ - func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` -} # func_xform may be replaced by extended shell implementation - - -# func_fatal_configuration arg... -# Echo program name prefixed message to standard error, followed by -# a configuration failure hint, and exit. -func_fatal_configuration () -{ - func_error ${1+"$@"} - func_error "See the $PACKAGE documentation for more information." - func_fatal_error "Fatal configuration error." -} - - -# func_config -# Display the configuration for all the tags in this script. -func_config () -{ - re_begincf='^# ### BEGIN LIBTOOL' - re_endcf='^# ### END LIBTOOL' - - # Default configuration. - $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" - - # Now print the configurations for the tags. - for tagname in $taglist; do - $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" - done - - exit $? -} - -# func_features -# Display the features supported by this script. -func_features () -{ - echo "host: $host" - if test "$build_libtool_libs" = yes; then - echo "enable shared libraries" - else - echo "disable shared libraries" - fi - if test "$build_old_libs" = yes; then - echo "enable static libraries" - else - echo "disable static libraries" - fi - - exit $? -} - -# func_enable_tag tagname -# Verify that TAGNAME is valid, and either flag an error and exit, or -# enable the TAGNAME tag. We also add TAGNAME to the global $taglist -# variable here. -func_enable_tag () -{ - # Global variable: - tagname="$1" - - re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" - re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" - sed_extractcf="/$re_begincf/,/$re_endcf/p" - - # Validate tagname. - case $tagname in - *[!-_A-Za-z0-9,/]*) - func_fatal_error "invalid tag name: $tagname" - ;; - esac - - # Don't test for the "default" C tag, as we know it's - # there but not specially marked. - case $tagname in - CC) ;; - *) - if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then - taglist="$taglist $tagname" - - # Evaluate the configuration. Be careful to quote the path - # and the sed script, to avoid splitting on whitespace, but - # also don't use non-portable quotes within backquotes within - # quotes we have to do it in 2 steps: - extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` - eval "$extractedcf" - else - func_error "ignoring unknown tag $tagname" - fi - ;; - esac -} - -# func_check_version_match -# Ensure that we are using m4 macros, and libtool script from the same -# release of libtool. -func_check_version_match () -{ - if test "$package_revision" != "$macro_revision"; then - if test "$VERSION" != "$macro_version"; then - if test -z "$macro_version"; then - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from an older release. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, but the -$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. -$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION -$progname: and run autoconf again. -_LT_EOF - fi - else - cat >&2 <<_LT_EOF -$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, -$progname: but the definition of this LT_INIT comes from revision $macro_revision. -$progname: You should recreate aclocal.m4 with macros from revision $package_revision -$progname: of $PACKAGE $VERSION and run autoconf again. -_LT_EOF - fi - - exit $EXIT_MISMATCH - fi -} - - -# Shorthand for --mode=foo, only valid as the first argument -case $1 in -clean|clea|cle|cl) - shift; set dummy --mode clean ${1+"$@"}; shift - ;; -compile|compil|compi|comp|com|co|c) - shift; set dummy --mode compile ${1+"$@"}; shift - ;; -execute|execut|execu|exec|exe|ex|e) - shift; set dummy --mode execute ${1+"$@"}; shift - ;; -finish|finis|fini|fin|fi|f) - shift; set dummy --mode finish ${1+"$@"}; shift - ;; -install|instal|insta|inst|ins|in|i) - shift; set dummy --mode install ${1+"$@"}; shift - ;; -link|lin|li|l) - shift; set dummy --mode link ${1+"$@"}; shift - ;; -uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) - shift; set dummy --mode uninstall ${1+"$@"}; shift - ;; -esac - - - -# Option defaults: -opt_debug=: -opt_dry_run=false -opt_config=false -opt_preserve_dup_deps=false -opt_features=false -opt_finish=false -opt_help=false -opt_help_all=false -opt_silent=: -opt_verbose=: -opt_silent=false -opt_verbose=false - - -# Parse options once, thoroughly. This comes as soon as possible in the -# script to make things like `--version' happen as quickly as we can. -{ - # this just eases exit handling - while test $# -gt 0; do - opt="$1" - shift - case $opt in - --debug|-x) opt_debug='set -x' - func_echo "enabling shell trace mode" - $opt_debug - ;; - --dry-run|--dryrun|-n) - opt_dry_run=: - ;; - --config) - opt_config=: -func_config - ;; - --dlopen|-dlopen) - optarg="$1" - opt_dlopen="${opt_dlopen+$opt_dlopen -}$optarg" - shift - ;; - --preserve-dup-deps) - opt_preserve_dup_deps=: - ;; - --features) - opt_features=: -func_features - ;; - --finish) - opt_finish=: -set dummy --mode finish ${1+"$@"}; shift - ;; - --help) - opt_help=: - ;; - --help-all) - opt_help_all=: -opt_help=': help-all' - ;; - --mode) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_mode="$optarg" -case $optarg in - # Valid mode arguments: - clean|compile|execute|finish|install|link|relink|uninstall) ;; - - # Catch anything else as an error - *) func_error "invalid argument for $opt" - exit_cmd=exit - break - ;; -esac - shift - ;; - --no-silent|--no-quiet) - opt_silent=false -func_append preserve_args " $opt" - ;; - --no-verbose) - opt_verbose=false -func_append preserve_args " $opt" - ;; - --silent|--quiet) - opt_silent=: -func_append preserve_args " $opt" - opt_verbose=false - ;; - --verbose|-v) - opt_verbose=: -func_append preserve_args " $opt" -opt_silent=false - ;; - --tag) - test $# = 0 && func_missing_arg $opt && break - optarg="$1" - opt_tag="$optarg" -func_append preserve_args " $opt $optarg" -func_enable_tag "$optarg" - shift - ;; - - -\?|-h) func_usage ;; - --help) func_help ;; - --version) func_version ;; - - # Separate optargs to long options: - --*=*) - func_split_long_opt "$opt" - set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} - shift - ;; - - # Separate non-argument short options: - -\?*|-h*|-n*|-v*) - func_split_short_opt "$opt" - set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} - shift - ;; - - --) break ;; - -*) func_fatal_help "unrecognized option \`$opt'" ;; - *) set dummy "$opt" ${1+"$@"}; shift; break ;; - esac - done - - # Validate options: - - # save first non-option argument - if test "$#" -gt 0; then - nonopt="$opt" - shift - fi - - # preserve --debug - test "$opt_debug" = : || func_append preserve_args " --debug" - - case $host in - *cygwin* | *mingw* | *pw32* | *cegcc*) - # don't eliminate duplications in $postdeps and $predeps - opt_duplicate_compiler_generated_deps=: - ;; - *) - opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps - ;; - esac - - $opt_help || { - # Sanity checks first: - func_check_version_match - - if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then - func_fatal_configuration "not configured to build any kind of library" - fi - - # Darwin sucks - eval std_shrext=\"$shrext_cmds\" - - # Only execute mode is allowed to have -dlopen flags. - if test -n "$opt_dlopen" && test "$opt_mode" != execute; then - func_error "unrecognized option \`-dlopen'" - $ECHO "$help" 1>&2 - exit $EXIT_FAILURE - fi - - # Change the help message to a mode-specific one. - generic_help="$help" - help="Try \`$progname --help --mode=$opt_mode' for more information." - } - - - # Bail if the options were screwed - $exit_cmd $EXIT_FAILURE -} - - - - -## ----------- ## -## Main. ## -## ----------- ## - -# func_lalib_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_lalib_p () -{ - test -f "$1" && - $SED -e 4q "$1" 2>/dev/null \ - | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 -} - -# func_lalib_unsafe_p file -# True iff FILE is a libtool `.la' library or `.lo' object file. -# This function implements the same check as func_lalib_p without -# resorting to external programs. To this end, it redirects stdin and -# closes it afterwards, without saving the original file descriptor. -# As a safety measure, use it only where a negative result would be -# fatal anyway. Works if `file' does not exist. -func_lalib_unsafe_p () -{ - lalib_p=no - if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then - for lalib_p_l in 1 2 3 4 - do - read lalib_p_line - case "$lalib_p_line" in - \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; - esac - done - exec 0<&5 5<&- - fi - test "$lalib_p" = yes -} - -# func_ltwrapper_script_p file -# True iff FILE is a libtool wrapper script -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_script_p () -{ - func_lalib_p "$1" -} - -# func_ltwrapper_executable_p file -# True iff FILE is a libtool wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_executable_p () -{ - func_ltwrapper_exec_suffix= - case $1 in - *.exe) ;; - *) func_ltwrapper_exec_suffix=.exe ;; - esac - $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 -} - -# func_ltwrapper_scriptname file -# Assumes file is an ltwrapper_executable -# uses $file to determine the appropriate filename for a -# temporary ltwrapper_script. -func_ltwrapper_scriptname () -{ - func_dirname_and_basename "$1" "" "." - func_stripname '' '.exe' "$func_basename_result" - func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" -} - -# func_ltwrapper_p file -# True iff FILE is a libtool wrapper script or wrapper executable -# This function is only a basic sanity check; it will hardly flush out -# determined imposters. -func_ltwrapper_p () -{ - func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" -} - - -# func_execute_cmds commands fail_cmd -# Execute tilde-delimited COMMANDS. -# If FAIL_CMD is given, eval that upon failure. -# FAIL_CMD may read-access the current command in variable CMD! -func_execute_cmds () -{ - $opt_debug - save_ifs=$IFS; IFS='~' - for cmd in $1; do - IFS=$save_ifs - eval cmd=\"$cmd\" - func_show_eval "$cmd" "${2-:}" - done - IFS=$save_ifs -} - - -# func_source file -# Source FILE, adding directory component if necessary. -# Note that it is not necessary on cygwin/mingw to append a dot to -# FILE even if both FILE and FILE.exe exist: automatic-append-.exe -# behavior happens only for exec(3), not for open(2)! Also, sourcing -# `FILE.' does not work on cygwin managed mounts. -func_source () -{ - $opt_debug - case $1 in - */* | *\\*) . "$1" ;; - *) . "./$1" ;; - esac -} - - -# func_resolve_sysroot PATH -# Replace a leading = in PATH with a sysroot. Store the result into -# func_resolve_sysroot_result -func_resolve_sysroot () -{ - func_resolve_sysroot_result=$1 - case $func_resolve_sysroot_result in - =*) - func_stripname '=' '' "$func_resolve_sysroot_result" - func_resolve_sysroot_result=$lt_sysroot$func_stripname_result - ;; - esac -} - -# func_replace_sysroot PATH -# If PATH begins with the sysroot, replace it with = and -# store the result into func_replace_sysroot_result. -func_replace_sysroot () -{ - case "$lt_sysroot:$1" in - ?*:"$lt_sysroot"*) - func_stripname "$lt_sysroot" '' "$1" - func_replace_sysroot_result="=$func_stripname_result" - ;; - *) - # Including no sysroot. - func_replace_sysroot_result=$1 - ;; - esac -} - -# func_infer_tag arg -# Infer tagged configuration to use if any are available and -# if one wasn't chosen via the "--tag" command line option. -# Only attempt this if the compiler in the base compile -# command doesn't match the default compiler. -# arg is usually of the form 'gcc ...' -func_infer_tag () -{ - $opt_debug - if test -n "$available_tags" && test -z "$tagname"; then - CC_quoted= - for arg in $CC; do - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case $@ in - # Blanks in the command may have been stripped by the calling shell, - # but not from the CC environment variable when configure was run. - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; - # Blanks at the start of $base_compile will cause this to fail - # if we don't check for them as well. - *) - for z in $available_tags; do - if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then - # Evaluate the configuration. - eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" - CC_quoted= - for arg in $CC; do - # Double-quote args containing other shell metacharacters. - func_append_quoted CC_quoted "$arg" - done - CC_expanded=`func_echo_all $CC` - CC_quoted_expanded=`func_echo_all $CC_quoted` - case "$@ " in - " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ - " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) - # The compiler in the base compile command matches - # the one in the tagged configuration. - # Assume this is the tagged configuration we want. - tagname=$z - break - ;; - esac - fi - done - # If $tagname still isn't set, then no tagged configuration - # was found and let the user know that the "--tag" command - # line option must be used. - if test -z "$tagname"; then - func_echo "unable to infer tagged configuration" - func_fatal_error "specify a tag with \`--tag'" -# else -# func_verbose "using $tagname tagged configuration" - fi - ;; - esac - fi -} - - - -# func_write_libtool_object output_name pic_name nonpic_name -# Create a libtool object file (analogous to a ".la" file), -# but don't create it if we're doing a dry run. -func_write_libtool_object () -{ - write_libobj=${1} - if test "$build_libtool_libs" = yes; then - write_lobj=\'${2}\' - else - write_lobj=none - fi - - if test "$build_old_libs" = yes; then - write_oldobj=\'${3}\' - else - write_oldobj=none - fi - - $opt_dry_run || { - cat >${write_libobj}T </dev/null` - if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then - func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | - $SED -e "$lt_sed_naive_backslashify"` - else - func_convert_core_file_wine_to_w32_result= - fi - fi -} -# end: func_convert_core_file_wine_to_w32 - - -# func_convert_core_path_wine_to_w32 ARG -# Helper function used by path conversion functions when $build is *nix, and -# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly -# configured wine environment available, with the winepath program in $build's -# $PATH. Assumes ARG has no leading or trailing path separator characters. -# -# ARG is path to be converted from $build format to win32. -# Result is available in $func_convert_core_path_wine_to_w32_result. -# Unconvertible file (directory) names in ARG are skipped; if no directory names -# are convertible, then the result may be empty. -func_convert_core_path_wine_to_w32 () -{ - $opt_debug - # unfortunately, winepath doesn't convert paths, only file names - func_convert_core_path_wine_to_w32_result="" - if test -n "$1"; then - oldIFS=$IFS - IFS=: - for func_convert_core_path_wine_to_w32_f in $1; do - IFS=$oldIFS - func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" - if test -n "$func_convert_core_file_wine_to_w32_result" ; then - if test -z "$func_convert_core_path_wine_to_w32_result"; then - func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" - else - func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" - fi - fi - done - IFS=$oldIFS - fi -} -# end: func_convert_core_path_wine_to_w32 - - -# func_cygpath ARGS... -# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when -# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) -# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or -# (2), returns the Cygwin file name or path in func_cygpath_result (input -# file name or path is assumed to be in w32 format, as previously converted -# from $build's *nix or MSYS format). In case (3), returns the w32 file name -# or path in func_cygpath_result (input file name or path is assumed to be in -# Cygwin format). Returns an empty string on error. -# -# ARGS are passed to cygpath, with the last one being the file name or path to -# be converted. -# -# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH -# environment variable; do not put it in $PATH. -func_cygpath () -{ - $opt_debug - if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then - func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` - if test "$?" -ne 0; then - # on failure, ensure result is empty - func_cygpath_result= - fi - else - func_cygpath_result= - func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" - fi -} -#end: func_cygpath - - -# func_convert_core_msys_to_w32 ARG -# Convert file name or path ARG from MSYS format to w32 format. Return -# result in func_convert_core_msys_to_w32_result. -func_convert_core_msys_to_w32 () -{ - $opt_debug - # awkward: cmd appends spaces to result - func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | - $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` -} -#end: func_convert_core_msys_to_w32 - - -# func_convert_file_check ARG1 ARG2 -# Verify that ARG1 (a file name in $build format) was converted to $host -# format in ARG2. Otherwise, emit an error message, but continue (resetting -# func_to_host_file_result to ARG1). -func_convert_file_check () -{ - $opt_debug - if test -z "$2" && test -n "$1" ; then - func_error "Could not determine host file name corresponding to" - func_error " \`$1'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback: - func_to_host_file_result="$1" - fi -} -# end func_convert_file_check - - -# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH -# Verify that FROM_PATH (a path in $build format) was converted to $host -# format in TO_PATH. Otherwise, emit an error message, but continue, resetting -# func_to_host_file_result to a simplistic fallback value (see below). -func_convert_path_check () -{ - $opt_debug - if test -z "$4" && test -n "$3"; then - func_error "Could not determine the host path corresponding to" - func_error " \`$3'" - func_error "Continuing, but uninstalled executables may not work." - # Fallback. This is a deliberately simplistic "conversion" and - # should not be "improved". See libtool.info. - if test "x$1" != "x$2"; then - lt_replace_pathsep_chars="s|$1|$2|g" - func_to_host_path_result=`echo "$3" | - $SED -e "$lt_replace_pathsep_chars"` - else - func_to_host_path_result="$3" - fi - fi -} -# end func_convert_path_check - - -# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG -# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT -# and appending REPL if ORIG matches BACKPAT. -func_convert_path_front_back_pathsep () -{ - $opt_debug - case $4 in - $1 ) func_to_host_path_result="$3$func_to_host_path_result" - ;; - esac - case $4 in - $2 ) func_append func_to_host_path_result "$3" - ;; - esac -} -# end func_convert_path_front_back_pathsep - - -################################################## -# $build to $host FILE NAME CONVERSION FUNCTIONS # -################################################## -# invoked via `$to_host_file_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# Result will be available in $func_to_host_file_result. - - -# func_to_host_file ARG -# Converts the file name ARG from $build format to $host format. Return result -# in func_to_host_file_result. -func_to_host_file () -{ - $opt_debug - $to_host_file_cmd "$1" -} -# end func_to_host_file - - -# func_to_tool_file ARG LAZY -# converts the file name ARG from $build format to toolchain format. Return -# result in func_to_tool_file_result. If the conversion in use is listed -# in (the comma separated) LAZY, no conversion takes place. -func_to_tool_file () -{ - $opt_debug - case ,$2, in - *,"$to_tool_file_cmd",*) - func_to_tool_file_result=$1 - ;; - *) - $to_tool_file_cmd "$1" - func_to_tool_file_result=$func_to_host_file_result - ;; - esac -} -# end func_to_tool_file - - -# func_convert_file_noop ARG -# Copy ARG to func_to_host_file_result. -func_convert_file_noop () -{ - func_to_host_file_result="$1" -} -# end func_convert_file_noop - - -# func_convert_file_msys_to_w32 ARG -# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_file_result. -func_convert_file_msys_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_to_host_file_result="$func_convert_core_msys_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_w32 - - -# func_convert_file_cygwin_to_w32 ARG -# Convert file name ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_file_cygwin_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # because $build is cygwin, we call "the" cygpath in $PATH; no need to use - # LT_CYGPATH in this case. - func_to_host_file_result=`cygpath -m "$1"` - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_cygwin_to_w32 - - -# func_convert_file_nix_to_w32 ARG -# Convert file name ARG from *nix to w32 format. Requires a wine environment -# and a working winepath. Returns result in func_to_host_file_result. -func_convert_file_nix_to_w32 () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_file_wine_to_w32 "$1" - func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_w32 - - -# func_convert_file_msys_to_cygwin ARG -# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_file_msys_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - func_convert_core_msys_to_w32 "$1" - func_cygpath -u "$func_convert_core_msys_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_msys_to_cygwin - - -# func_convert_file_nix_to_cygwin ARG -# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed -# in a wine environment, working winepath, and LT_CYGPATH set. Returns result -# in func_to_host_file_result. -func_convert_file_nix_to_cygwin () -{ - $opt_debug - func_to_host_file_result="$1" - if test -n "$1"; then - # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. - func_convert_core_file_wine_to_w32 "$1" - func_cygpath -u "$func_convert_core_file_wine_to_w32_result" - func_to_host_file_result="$func_cygpath_result" - fi - func_convert_file_check "$1" "$func_to_host_file_result" -} -# end func_convert_file_nix_to_cygwin - - -############################################# -# $build to $host PATH CONVERSION FUNCTIONS # -############################################# -# invoked via `$to_host_path_cmd ARG' -# -# In each case, ARG is the path to be converted from $build to $host format. -# The result will be available in $func_to_host_path_result. -# -# Path separators are also converted from $build format to $host format. If -# ARG begins or ends with a path separator character, it is preserved (but -# converted to $host format) on output. -# -# All path conversion functions are named using the following convention: -# file name conversion function : func_convert_file_X_to_Y () -# path conversion function : func_convert_path_X_to_Y () -# where, for any given $build/$host combination the 'X_to_Y' value is the -# same. If conversion functions are added for new $build/$host combinations, -# the two new functions must follow this pattern, or func_init_to_host_path_cmd -# will break. - - -# func_init_to_host_path_cmd -# Ensures that function "pointer" variable $to_host_path_cmd is set to the -# appropriate value, based on the value of $to_host_file_cmd. -to_host_path_cmd= -func_init_to_host_path_cmd () -{ - $opt_debug - if test -z "$to_host_path_cmd"; then - func_stripname 'func_convert_file_' '' "$to_host_file_cmd" - to_host_path_cmd="func_convert_path_${func_stripname_result}" - fi -} - - -# func_to_host_path ARG -# Converts the path ARG from $build format to $host format. Return result -# in func_to_host_path_result. -func_to_host_path () -{ - $opt_debug - func_init_to_host_path_cmd - $to_host_path_cmd "$1" -} -# end func_to_host_path - - -# func_convert_path_noop ARG -# Copy ARG to func_to_host_path_result. -func_convert_path_noop () -{ - func_to_host_path_result="$1" -} -# end func_convert_path_noop - - -# func_convert_path_msys_to_w32 ARG -# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic -# conversion to w32 is not available inside the cwrapper. Returns result in -# func_to_host_path_result. -func_convert_path_msys_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from ARG. MSYS - # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; - # and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_msys_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_msys_to_w32 - - -# func_convert_path_cygwin_to_w32 ARG -# Convert path ARG from Cygwin to w32 format. Returns result in -# func_to_host_file_result. -func_convert_path_cygwin_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_cygwin_to_w32 - - -# func_convert_path_nix_to_w32 ARG -# Convert path ARG from *nix to w32 format. Requires a wine environment and -# a working winepath. Returns result in func_to_host_file_result. -func_convert_path_nix_to_w32 () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" - func_convert_path_check : ";" \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" - fi -} -# end func_convert_path_nix_to_w32 - - -# func_convert_path_msys_to_cygwin ARG -# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. -# Returns result in func_to_host_file_result. -func_convert_path_msys_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # See func_convert_path_msys_to_w32: - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_msys_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_msys_to_cygwin - - -# func_convert_path_nix_to_cygwin ARG -# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a -# a wine environment, working winepath, and LT_CYGPATH set. Returns result in -# func_to_host_file_result. -func_convert_path_nix_to_cygwin () -{ - $opt_debug - func_to_host_path_result="$1" - if test -n "$1"; then - # Remove leading and trailing path separator characters from - # ARG. msys behavior is inconsistent here, cygpath turns them - # into '.;' and ';.', and winepath ignores them completely. - func_stripname : : "$1" - func_to_host_path_tmp1=$func_stripname_result - func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" - func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" - func_to_host_path_result="$func_cygpath_result" - func_convert_path_check : : \ - "$func_to_host_path_tmp1" "$func_to_host_path_result" - func_convert_path_front_back_pathsep ":*" "*:" : "$1" - fi -} -# end func_convert_path_nix_to_cygwin - - -# func_mode_compile arg... -func_mode_compile () -{ - $opt_debug - # Get the compilation command and the source file. - base_compile= - srcfile="$nonopt" # always keep a non-empty value in "srcfile" - suppress_opt=yes - suppress_output= - arg_mode=normal - libobj= - later= - pie_flag= - - for arg - do - case $arg_mode in - arg ) - # do not "continue". Instead, add this to base_compile - lastarg="$arg" - arg_mode=normal - ;; - - target ) - libobj="$arg" - arg_mode=normal - continue - ;; - - normal ) - # Accept any command-line options. - case $arg in - -o) - test -n "$libobj" && \ - func_fatal_error "you cannot specify \`-o' more than once" - arg_mode=target - continue - ;; - - -pie | -fpie | -fPIE) - func_append pie_flag " $arg" - continue - ;; - - -shared | -static | -prefer-pic | -prefer-non-pic) - func_append later " $arg" - continue - ;; - - -no-suppress) - suppress_opt=no - continue - ;; - - -Xcompiler) - arg_mode=arg # the next one goes into the "base_compile" arg list - continue # The current "srcfile" will either be retained or - ;; # replaced later. I would guess that would be a bug. - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - lastarg= - save_ifs="$IFS"; IFS=',' - for arg in $args; do - IFS="$save_ifs" - func_append_quoted lastarg "$arg" - done - IFS="$save_ifs" - func_stripname ' ' '' "$lastarg" - lastarg=$func_stripname_result - - # Add the arguments to base_compile. - func_append base_compile " $lastarg" - continue - ;; - - *) - # Accept the current argument as the source file. - # The previous "srcfile" becomes the current argument. - # - lastarg="$srcfile" - srcfile="$arg" - ;; - esac # case $arg - ;; - esac # case $arg_mode - - # Aesthetically quote the previous argument. - func_append_quoted base_compile "$lastarg" - done # for arg - - case $arg_mode in - arg) - func_fatal_error "you must specify an argument for -Xcompile" - ;; - target) - func_fatal_error "you must specify a target with \`-o'" - ;; - *) - # Get the name of the library object. - test -z "$libobj" && { - func_basename "$srcfile" - libobj="$func_basename_result" - } - ;; - esac - - # Recognize several different file suffixes. - # If the user specifies -o file.o, it is replaced with file.lo - case $libobj in - *.[cCFSifmso] | \ - *.ada | *.adb | *.ads | *.asm | \ - *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ - *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) - func_xform "$libobj" - libobj=$func_xform_result - ;; - esac - - case $libobj in - *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; - *) - func_fatal_error "cannot determine name of library object from \`$libobj'" - ;; - esac - - func_infer_tag $base_compile - - for arg in $later; do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - continue - ;; - - -static) - build_libtool_libs=no - build_old_libs=yes - continue - ;; - - -prefer-pic) - pic_mode=yes - continue - ;; - - -prefer-non-pic) - pic_mode=no - continue - ;; - esac - done - - func_quote_for_eval "$libobj" - test "X$libobj" != "X$func_quote_for_eval_result" \ - && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ - && func_warning "libobj name \`$libobj' may not contain shell special characters." - func_dirname_and_basename "$obj" "/" "" - objname="$func_basename_result" - xdir="$func_dirname_result" - lobj=${xdir}$objdir/$objname - - test -z "$base_compile" && \ - func_fatal_help "you must specify a compilation command" - - # Delete any leftover library objects. - if test "$build_old_libs" = yes; then - removelist="$obj $lobj $libobj ${libobj}T" - else - removelist="$lobj $libobj ${libobj}T" - fi - - # On Cygwin there's no "real" PIC flag so we must build both object types - case $host_os in - cygwin* | mingw* | pw32* | os2* | cegcc*) - pic_mode=default - ;; - esac - if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then - # non-PIC code in shared libraries is not supported - pic_mode=default - fi - - # Calculate the filename of the output object if compiler does - # not support -o with -c - if test "$compiler_c_o" = no; then - output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} - lockfile="$output_obj.lock" - else - output_obj= - need_locks=no - lockfile= - fi - - # Lock this critical section if it is needed - # We use this script file to make the link, it avoids creating a new file - if test "$need_locks" = yes; then - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - elif test "$need_locks" = warn; then - if test -f "$lockfile"; then - $ECHO "\ -*** ERROR, $lockfile exists and contains: -`cat $lockfile 2>/dev/null` - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - func_append removelist " $output_obj" - $ECHO "$srcfile" > "$lockfile" - fi - - $opt_dry_run || $RM $removelist - func_append removelist " $lockfile" - trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 - - func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 - srcfile=$func_to_tool_file_result - func_quote_for_eval "$srcfile" - qsrcfile=$func_quote_for_eval_result - - # Only build a PIC object if we are building libtool libraries. - if test "$build_libtool_libs" = yes; then - # Without this assignment, base_compile gets emptied. - fbsd_hideous_sh_bug=$base_compile - - if test "$pic_mode" != no; then - command="$base_compile $qsrcfile $pic_flag" - else - # Don't build PIC code - command="$base_compile $qsrcfile" - fi - - func_mkdir_p "$xdir$objdir" - - if test -z "$output_obj"; then - # Place PIC objects in $objdir - func_append command " -o $lobj" - fi - - func_show_eval_locale "$command" \ - 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed, then go on to compile the next one - if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then - func_show_eval '$MV "$output_obj" "$lobj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - - # Allow error messages only from the first compilation. - if test "$suppress_opt" = yes; then - suppress_output=' >/dev/null 2>&1' - fi - fi - - # Only build a position-dependent object if we build old libraries. - if test "$build_old_libs" = yes; then - if test "$pic_mode" != yes; then - # Don't build PIC code - command="$base_compile $qsrcfile$pie_flag" - else - command="$base_compile $qsrcfile $pic_flag" - fi - if test "$compiler_c_o" = yes; then - func_append command " -o $obj" - fi - - # Suppress compiler output if we already did a PIC compilation. - func_append command "$suppress_output" - func_show_eval_locale "$command" \ - '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' - - if test "$need_locks" = warn && - test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then - $ECHO "\ -*** ERROR, $lockfile contains: -`cat $lockfile 2>/dev/null` - -but it should contain: -$srcfile - -This indicates that another process is trying to use the same -temporary object file, and libtool could not work around it because -your compiler does not support \`-c' and \`-o' together. If you -repeat this compilation, it may succeed, by chance, but you had better -avoid parallel builds (make -j) in this platform, or get a better -compiler." - - $opt_dry_run || $RM $removelist - exit $EXIT_FAILURE - fi - - # Just move the object if needed - if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then - func_show_eval '$MV "$output_obj" "$obj"' \ - 'error=$?; $opt_dry_run || $RM $removelist; exit $error' - fi - fi - - $opt_dry_run || { - func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" - - # Unlock the critical section if it was locked - if test "$need_locks" != no; then - removelist=$lockfile - $RM "$lockfile" - fi - } - - exit $EXIT_SUCCESS -} - -$opt_help || { - test "$opt_mode" = compile && func_mode_compile ${1+"$@"} -} - -func_mode_help () -{ - # We need to display help for each of the modes. - case $opt_mode in - "") - # Generic help is extracted from the usage comments - # at the start of this file. - func_help - ;; - - clean) - $ECHO \ -"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... - -Remove files from the build directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, object or program, all the files associated -with it are deleted. Otherwise, only FILE itself is deleted using RM." - ;; - - compile) - $ECHO \ -"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE - -Compile a source file into a libtool library object. - -This mode accepts the following additional options: - - -o OUTPUT-FILE set the output file name to OUTPUT-FILE - -no-suppress do not suppress compiler output for multiple passes - -prefer-pic try to build PIC objects only - -prefer-non-pic try to build non-PIC objects only - -shared do not build a \`.o' file suitable for static linking - -static only build a \`.o' file suitable for static linking - -Wc,FLAG pass FLAG directly to the compiler - -COMPILE-COMMAND is a command to be used in creating a \`standard' object file -from the given SOURCEFILE. - -The output file name is determined by removing the directory component from -SOURCEFILE, then substituting the C source code suffix \`.c' with the -library object suffix, \`.lo'." - ;; - - execute) - $ECHO \ -"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... - -Automatically set library path, then run a program. - -This mode accepts the following additional options: - - -dlopen FILE add the directory containing FILE to the library path - -This mode sets the library path environment variable according to \`-dlopen' -flags. - -If any of the ARGS are libtool executable wrappers, then they are translated -into their corresponding uninstalled binary, and any of their required library -directories are added to the library path. - -Then, COMMAND is executed, with ARGS as arguments." - ;; - - finish) - $ECHO \ -"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... - -Complete the installation of libtool libraries. - -Each LIBDIR is a directory that contains libtool libraries. - -The commands that this mode executes may require superuser privileges. Use -the \`--dry-run' option if you just want to see what would be executed." - ;; - - install) - $ECHO \ -"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... - -Install executables or libraries. - -INSTALL-COMMAND is the installation command. The first component should be -either the \`install' or \`cp' program. - -The following components of INSTALL-COMMAND are treated specially: - - -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation - -The rest of the components are interpreted as arguments to that command (only -BSD-compatible install options are recognized)." - ;; - - link) - $ECHO \ -"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... - -Link object files or libraries together to form another library, or to -create an executable program. - -LINK-COMMAND is a command using the C compiler that you would use to create -a program from several object files. - -The following components of LINK-COMMAND are treated specially: - - -all-static do not do any dynamic linking at all - -avoid-version do not add a version suffix if possible - -bindir BINDIR specify path to binaries directory (for systems where - libraries must be found in the PATH setting at runtime) - -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime - -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols - -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) - -export-symbols SYMFILE - try to export only the symbols listed in SYMFILE - -export-symbols-regex REGEX - try to export only the symbols matching REGEX - -LLIBDIR search LIBDIR for required installed libraries - -lNAME OUTPUT-FILE requires the installed library libNAME - -module build a library that can dlopened - -no-fast-install disable the fast-install mode - -no-install link a not-installable executable - -no-undefined declare that a library does not refer to external symbols - -o OUTPUT-FILE create OUTPUT-FILE from the specified objects - -objectlist FILE Use a list of object files found in FILE to specify objects - -precious-files-regex REGEX - don't remove output files matching REGEX - -release RELEASE specify package release information - -rpath LIBDIR the created library will eventually be installed in LIBDIR - -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries - -shared only do dynamic linking of libtool libraries - -shrext SUFFIX override the standard shared library file extension - -static do not do any dynamic linking of uninstalled libtool libraries - -static-libtool-libs - do not do any dynamic linking of libtool libraries - -version-info CURRENT[:REVISION[:AGE]] - specify library version info [each variable defaults to 0] - -weak LIBNAME declare that the target provides the LIBNAME interface - -Wc,FLAG - -Xcompiler FLAG pass linker-specific FLAG directly to the compiler - -Wl,FLAG - -Xlinker FLAG pass linker-specific FLAG directly to the linker - -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) - -All other options (arguments beginning with \`-') are ignored. - -Every other argument is treated as a filename. Files ending in \`.la' are -treated as uninstalled libtool libraries, other files are standard or library -object files. - -If the OUTPUT-FILE ends in \`.la', then a libtool library is created, -only library objects (\`.lo' files) may be specified, and \`-rpath' is -required, except when creating a convenience library. - -If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created -using \`ar' and \`ranlib', or on Windows using \`lib'. - -If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file -is created, otherwise an executable program is created." - ;; - - uninstall) - $ECHO \ -"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... - -Remove libraries from an installation directory. - -RM is the name of the program to use to delete files associated with each FILE -(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed -to RM. - -If FILE is a libtool library, all the files associated with it are deleted. -Otherwise, only FILE itself is deleted using RM." - ;; - - *) - func_fatal_help "invalid operation mode \`$opt_mode'" - ;; - esac - - echo - $ECHO "Try \`$progname --help' for more information about other modes." -} - -# Now that we've collected a possible --mode arg, show help if necessary -if $opt_help; then - if test "$opt_help" = :; then - func_mode_help - else - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - func_mode_help - done - } | sed -n '1p; 2,$s/^Usage:/ or: /p' - { - func_help noexit - for opt_mode in compile link execute install finish uninstall clean; do - echo - func_mode_help - done - } | - sed '1d - /^When reporting/,/^Report/{ - H - d - } - $x - /information about other modes/d - /more detailed .*MODE/d - s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' - fi - exit $? -fi - - -# func_mode_execute arg... -func_mode_execute () -{ - $opt_debug - # The first argument is the command name. - cmd="$nonopt" - test -z "$cmd" && \ - func_fatal_help "you must specify a COMMAND" - - # Handle -dlopen flags immediately. - for file in $opt_dlopen; do - test -f "$file" \ - || func_fatal_help "\`$file' is not a file" - - dir= - case $file in - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$lib' is not a valid libtool archive" - - # Read the libtool library. - dlname= - library_names= - func_source "$file" - - # Skip this library if it cannot be dlopened. - if test -z "$dlname"; then - # Warn if it was a shared library. - test -n "$library_names" && \ - func_warning "\`$file' was not linked with \`-export-dynamic'" - continue - fi - - func_dirname "$file" "" "." - dir="$func_dirname_result" - - if test -f "$dir/$objdir/$dlname"; then - func_append dir "/$objdir" - else - if test ! -f "$dir/$dlname"; then - func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" - fi - fi - ;; - - *.lo) - # Just add the directory containing the .lo file. - func_dirname "$file" "" "." - dir="$func_dirname_result" - ;; - - *) - func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" - continue - ;; - esac - - # Get the absolute pathname. - absdir=`cd "$dir" && pwd` - test -n "$absdir" && dir="$absdir" - - # Now add the directory to shlibpath_var. - if eval "test -z \"\$$shlibpath_var\""; then - eval "$shlibpath_var=\"\$dir\"" - else - eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" - fi - done - - # This variable tells wrapper scripts just to set shlibpath_var - # rather than running their programs. - libtool_execute_magic="$magic" - - # Check if any of the arguments is a wrapper script. - args= - for file - do - case $file in - -* | *.la | *.lo ) ;; - *) - # Do a test to see if this is really a libtool program. - if func_ltwrapper_script_p "$file"; then - func_source "$file" - # Transform arg to wrapped name. - file="$progdir/$program" - elif func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - func_source "$func_ltwrapper_scriptname_result" - # Transform arg to wrapped name. - file="$progdir/$program" - fi - ;; - esac - # Quote arguments (to preserve shell metacharacters). - func_append_quoted args "$file" - done - - if test "X$opt_dry_run" = Xfalse; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi - - # Restore saved environment variables - for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES - do - eval "if test \"\${save_$lt_var+set}\" = set; then - $lt_var=\$save_$lt_var; export $lt_var - else - $lt_unset $lt_var - fi" - done - - # Now prepare to actually exec the command. - exec_cmd="\$cmd$args" - else - # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" - echo "export $shlibpath_var" - fi - $ECHO "$cmd$args" - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = execute && func_mode_execute ${1+"$@"} - - -# func_mode_finish arg... -func_mode_finish () -{ - $opt_debug - libs= - libdirs= - admincmds= - - for opt in "$nonopt" ${1+"$@"} - do - if test -d "$opt"; then - func_append libdirs " $opt" - - elif test -f "$opt"; then - if func_lalib_unsafe_p "$opt"; then - func_append libs " $opt" - else - func_warning "\`$opt' is not a valid libtool archive" - fi - - else - func_fatal_error "invalid argument \`$opt'" - fi - done - - if test -n "$libs"; then - if test -n "$lt_sysroot"; then - sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` - sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" - else - sysroot_cmd= - fi - - # Remove sysroot references - if $opt_dry_run; then - for lib in $libs; do - echo "removing references to $lt_sysroot and \`=' prefixes from $lib" - done - else - tmpdir=`func_mktempdir` - for lib in $libs; do - sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ - > $tmpdir/tmp-la - mv -f $tmpdir/tmp-la $lib - done - ${RM}r "$tmpdir" - fi - fi - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - for libdir in $libdirs; do - if test -n "$finish_cmds"; then - # Do each command in the finish commands. - func_execute_cmds "$finish_cmds" 'admincmds="$admincmds -'"$cmd"'"' - fi - if test -n "$finish_eval"; then - # Do the single finish_eval. - eval cmds=\"$finish_eval\" - $opt_dry_run || eval "$cmds" || func_append admincmds " - $cmds" - fi - done - fi - - # Exit here if they wanted silent mode. - $opt_silent && exit $EXIT_SUCCESS - - if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then - echo "----------------------------------------------------------------------" - echo "Libraries have been installed in:" - for libdir in $libdirs; do - $ECHO " $libdir" - done - echo - echo "If you ever happen to want to link against installed libraries" - echo "in a given directory, LIBDIR, you must either use libtool, and" - echo "specify the full pathname of the library, or use the \`-LLIBDIR'" - echo "flag during linking and do at least one of the following:" - if test -n "$shlibpath_var"; then - echo " - add LIBDIR to the \`$shlibpath_var' environment variable" - echo " during execution" - fi - if test -n "$runpath_var"; then - echo " - add LIBDIR to the \`$runpath_var' environment variable" - echo " during linking" - fi - if test -n "$hardcode_libdir_flag_spec"; then - libdir=LIBDIR - eval flag=\"$hardcode_libdir_flag_spec\" - - $ECHO " - use the \`$flag' linker flag" - fi - if test -n "$admincmds"; then - $ECHO " - have your system administrator run these commands:$admincmds" - fi - if test -f /etc/ld.so.conf; then - echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" - fi - echo - - echo "See any operating system documentation about shared libraries for" - case $host in - solaris2.[6789]|solaris2.1[0-9]) - echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" - echo "pages." - ;; - *) - echo "more information, such as the ld(1) and ld.so(8) manual pages." - ;; - esac - echo "----------------------------------------------------------------------" - fi - exit $EXIT_SUCCESS -} - -test "$opt_mode" = finish && func_mode_finish ${1+"$@"} - - -# func_mode_install arg... -func_mode_install () -{ - $opt_debug - # There may be an optional sh(1) argument at the beginning of - # install_prog (especially on Windows NT). - if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || - # Allow the use of GNU shtool's install command. - case $nonopt in *shtool*) :;; *) false;; esac; then - # Aesthetically quote it. - func_quote_for_eval "$nonopt" - install_prog="$func_quote_for_eval_result " - arg=$1 - shift - else - install_prog= - arg=$nonopt - fi - - # The real first argument should be the name of the installation program. - # Aesthetically quote it. - func_quote_for_eval "$arg" - func_append install_prog "$func_quote_for_eval_result" - install_shared_prog=$install_prog - case " $install_prog " in - *[\\\ /]cp\ *) install_cp=: ;; - *) install_cp=false ;; - esac - - # We need to accept at least all the BSD install flags. - dest= - files= - opts= - prev= - install_type= - isdir=no - stripme= - no_mode=: - for arg - do - arg2= - if test -n "$dest"; then - func_append files " $dest" - dest=$arg - continue - fi - - case $arg in - -d) isdir=yes ;; - -f) - if $install_cp; then :; else - prev=$arg - fi - ;; - -g | -m | -o) - prev=$arg - ;; - -s) - stripme=" -s" - continue - ;; - -*) - ;; - *) - # If the previous option needed an argument, then skip it. - if test -n "$prev"; then - if test "x$prev" = x-m && test -n "$install_override_mode"; then - arg2=$install_override_mode - no_mode=false - fi - prev= - else - dest=$arg - continue - fi - ;; - esac - - # Aesthetically quote the argument. - func_quote_for_eval "$arg" - func_append install_prog " $func_quote_for_eval_result" - if test -n "$arg2"; then - func_quote_for_eval "$arg2" - fi - func_append install_shared_prog " $func_quote_for_eval_result" - done - - test -z "$install_prog" && \ - func_fatal_help "you must specify an install program" - - test -n "$prev" && \ - func_fatal_help "the \`$prev' option requires an argument" - - if test -n "$install_override_mode" && $no_mode; then - if $install_cp; then :; else - func_quote_for_eval "$install_override_mode" - func_append install_shared_prog " -m $func_quote_for_eval_result" - fi - fi - - if test -z "$files"; then - if test -z "$dest"; then - func_fatal_help "no file or destination specified" - else - func_fatal_help "you must specify a destination" - fi - fi - - # Strip any trailing slash from the destination. - func_stripname '' '/' "$dest" - dest=$func_stripname_result - - # Check to see that the destination is a directory. - test -d "$dest" && isdir=yes - if test "$isdir" = yes; then - destdir="$dest" - destname= - else - func_dirname_and_basename "$dest" "" "." - destdir="$func_dirname_result" - destname="$func_basename_result" - - # Not a directory, so check to see that there is only one file specified. - set dummy $files; shift - test "$#" -gt 1 && \ - func_fatal_help "\`$dest' is not a directory" - fi - case $destdir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - for file in $files; do - case $file in - *.lo) ;; - *) - func_fatal_help "\`$destdir' must be an absolute directory name" - ;; - esac - done - ;; - esac - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - staticlibs= - future_libdirs= - current_libdirs= - for file in $files; do - - # Do each installation. - case $file in - *.$libext) - # Do the static libraries later. - func_append staticlibs " $file" - ;; - - *.la) - func_resolve_sysroot "$file" - file=$func_resolve_sysroot_result - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$file" \ - || func_fatal_help "\`$file' is not a valid libtool archive" - - library_names= - old_library= - relink_command= - func_source "$file" - - # Add the libdir to current_libdirs if it is the destination. - if test "X$destdir" = "X$libdir"; then - case "$current_libdirs " in - *" $libdir "*) ;; - *) func_append current_libdirs " $libdir" ;; - esac - else - # Note the libdir as a future libdir. - case "$future_libdirs " in - *" $libdir "*) ;; - *) func_append future_libdirs " $libdir" ;; - esac - fi - - func_dirname "$file" "/" "" - dir="$func_dirname_result" - func_append dir "$objdir" - - if test -n "$relink_command"; then - # Determine the prefix the user has applied to our future dir. - inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` - - # Don't allow the user to place us outside of our expected - # location b/c this prevents finding dependent libraries that - # are installed to the same prefix. - # At present, this check doesn't affect windows .dll's that - # are installed into $libdir/../bin (currently, that works fine) - # but it's something to keep an eye on. - test "$inst_prefix_dir" = "$destdir" && \ - func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" - - if test -n "$inst_prefix_dir"; then - # Stick the inst_prefix_dir data into the link command. - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` - else - relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` - fi - - func_warning "relinking \`$file'" - func_show_eval "$relink_command" \ - 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' - fi - - # See the names of the shared library. - set dummy $library_names; shift - if test -n "$1"; then - realname="$1" - shift - - srcname="$realname" - test -n "$relink_command" && srcname="$realname"T - - # Install the shared library and build the symlinks. - func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ - 'exit $?' - tstripme="$stripme" - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - case $realname in - *.dll.a) - tstripme="" - ;; - esac - ;; - esac - if test -n "$tstripme" && test -n "$striplib"; then - func_show_eval "$striplib $destdir/$realname" 'exit $?' - fi - - if test "$#" -gt 0; then - # Delete the old symlinks, and create new ones. - # Try `ln -sf' first, because the `ln' binary might depend on - # the symlink we replace! Solaris /bin/ln does not understand -f, - # so we also need to try rm && ln -s. - for linkname - do - test "$linkname" != "$realname" \ - && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" - done - fi - - # Do each command in the postinstall commands. - lib="$destdir/$realname" - func_execute_cmds "$postinstall_cmds" 'exit $?' - fi - - # Install the pseudo-library for information purposes. - func_basename "$file" - name="$func_basename_result" - instname="$dir/$name"i - func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' - - # Maybe install the static library, too. - test -n "$old_library" && func_append staticlibs " $dir/$old_library" - ;; - - *.lo) - # Install (i.e. copy) a libtool object. - - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # Deduce the name of the destination old-style object file. - case $destfile in - *.lo) - func_lo2o "$destfile" - staticdest=$func_lo2o_result - ;; - *.$objext) - staticdest="$destfile" - destfile= - ;; - *) - func_fatal_help "cannot copy a libtool object to \`$destfile'" - ;; - esac - - # Install the libtool object if requested. - test -n "$destfile" && \ - func_show_eval "$install_prog $file $destfile" 'exit $?' - - # Install the old object if enabled. - if test "$build_old_libs" = yes; then - # Deduce the name of the old-style object file. - func_lo2o "$file" - staticobj=$func_lo2o_result - func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' - fi - exit $EXIT_SUCCESS - ;; - - *) - # Figure out destination file name, if it wasn't already specified. - if test -n "$destname"; then - destfile="$destdir/$destname" - else - func_basename "$file" - destfile="$func_basename_result" - destfile="$destdir/$destfile" - fi - - # If the file is missing, and there is a .exe on the end, strip it - # because it is most likely a libtool script we actually want to - # install - stripped_ext="" - case $file in - *.exe) - if test ! -f "$file"; then - func_stripname '' '.exe' "$file" - file=$func_stripname_result - stripped_ext=".exe" - fi - ;; - esac - - # Do a test to see if this is really a libtool program. - case $host in - *cygwin* | *mingw*) - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - wrapper=$func_ltwrapper_scriptname_result - else - func_stripname '' '.exe' "$file" - wrapper=$func_stripname_result - fi - ;; - *) - wrapper=$file - ;; - esac - if func_ltwrapper_script_p "$wrapper"; then - notinst_deplibs= - relink_command= - - func_source "$wrapper" - - # Check the variables that should have been set. - test -z "$generated_by_libtool_version" && \ - func_fatal_error "invalid libtool wrapper script \`$wrapper'" - - finalize=yes - for lib in $notinst_deplibs; do - # Check to see that each library is installed. - libdir= - if test -f "$lib"; then - func_source "$lib" - fi - libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test - if test -n "$libdir" && test ! -f "$libfile"; then - func_warning "\`$lib' has not been installed in \`$libdir'" - finalize=no - fi - done - - relink_command= - func_source "$wrapper" - - outputname= - if test "$fast_install" = no && test -n "$relink_command"; then - $opt_dry_run || { - if test "$finalize" = yes; then - tmpdir=`func_mktempdir` - func_basename "$file$stripped_ext" - file="$func_basename_result" - outputname="$tmpdir/$file" - # Replace the output file specification. - relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` - - $opt_silent || { - func_quote_for_expand "$relink_command" - eval "func_echo $func_quote_for_expand_result" - } - if eval "$relink_command"; then : - else - func_error "error: relink \`$file' with the above command before installing it" - $opt_dry_run || ${RM}r "$tmpdir" - continue - fi - file="$outputname" - else - func_warning "cannot relink \`$file'" - fi - } - else - # Install the binary that we compiled earlier. - file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` - fi - fi - - # remove .exe since cygwin /usr/bin/install will append another - # one anyway - case $install_prog,$host in - */usr/bin/install*,*cygwin*) - case $file:$destfile in - *.exe:*.exe) - # this is ok - ;; - *.exe:*) - destfile=$destfile.exe - ;; - *:*.exe) - func_stripname '' '.exe' "$destfile" - destfile=$func_stripname_result - ;; - esac - ;; - esac - func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' - $opt_dry_run || if test -n "$outputname"; then - ${RM}r "$tmpdir" - fi - ;; - esac - done - - for file in $staticlibs; do - func_basename "$file" - name="$func_basename_result" - - # Set up the ranlib parameters. - oldlib="$destdir/$name" - - func_show_eval "$install_prog \$file \$oldlib" 'exit $?' - - if test -n "$stripme" && test -n "$old_striplib"; then - func_show_eval "$old_striplib $oldlib" 'exit $?' - fi - - # Do each command in the postinstall commands. - func_execute_cmds "$old_postinstall_cmds" 'exit $?' - done - - test -n "$future_libdirs" && \ - func_warning "remember to run \`$progname --finish$future_libdirs'" - - if test -n "$current_libdirs"; then - # Maybe just do a dry run. - $opt_dry_run && current_libdirs=" -n$current_libdirs" - exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' - else - exit $EXIT_SUCCESS - fi -} - -test "$opt_mode" = install && func_mode_install ${1+"$@"} - - -# func_generate_dlsyms outputname originator pic_p -# Extract symbols from dlprefiles and create ${outputname}S.o with -# a dlpreopen symbol table. -func_generate_dlsyms () -{ - $opt_debug - my_outputname="$1" - my_originator="$2" - my_pic_p="${3-no}" - my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` - my_dlsyms= - - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - if test -n "$NM" && test -n "$global_symbol_pipe"; then - my_dlsyms="${my_outputname}S.c" - else - func_error "not configured to extract global symbols from dlpreopened files" - fi - fi - - if test -n "$my_dlsyms"; then - case $my_dlsyms in - "") ;; - *.c) - # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${my_outputname}.nm" - - func_show_eval "$RM $nlist ${nlist}S ${nlist}T" - - # Parse the name list into a source file. - func_verbose "creating $output_objdir/$my_dlsyms" - - $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ -/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ -/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ - -#ifdef __cplusplus -extern \"C\" { -#endif - -#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) -#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" -#endif - -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT_DLSYM_CONST -#else -# define LT_DLSYM_CONST const -#endif - -/* External symbol declarations for the compiler. */\ -" - - if test "$dlself" = yes; then - func_verbose "generating symbol list for \`$output'" - - $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" - - # Add our own program objects to the symbol list. - progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` - for progfile in $progfiles; do - func_to_tool_file "$progfile" func_convert_file_msys_to_w32 - func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" - $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" - done - - if test -n "$exclude_expsyms"; then - $opt_dry_run || { - eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - if test -n "$export_symbols_regex"; then - $opt_dry_run || { - eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - } - fi - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - export_symbols="$output_objdir/$outputname.exp" - $opt_dry_run || { - $RM $export_symbols - eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' - ;; - esac - } - else - $opt_dry_run || { - eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' - eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' - eval '$MV "$nlist"T "$nlist"' - case $host in - *cygwin* | *mingw* | *cegcc* ) - eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' - eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' - ;; - esac - } - fi - fi - - for dlprefile in $dlprefiles; do - func_verbose "extracting global C symbols from \`$dlprefile'" - func_basename "$dlprefile" - name="$func_basename_result" - case $host in - *cygwin* | *mingw* | *cegcc* ) - # if an import library, we need to obtain dlname - if func_win32_import_lib_p "$dlprefile"; then - func_tr_sh "$dlprefile" - eval "curr_lafile=\$libfile_$func_tr_sh_result" - dlprefile_dlbasename="" - if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then - # Use subshell, to avoid clobbering current variable values - dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` - if test -n "$dlprefile_dlname" ; then - func_basename "$dlprefile_dlname" - dlprefile_dlbasename="$func_basename_result" - else - # no lafile. user explicitly requested -dlpreopen . - $sharedlib_from_linklib_cmd "$dlprefile" - dlprefile_dlbasename=$sharedlib_from_linklib_result - fi - fi - $opt_dry_run || { - if test -n "$dlprefile_dlbasename" ; then - eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' - else - func_warning "Could not compute DLL name from $name" - eval '$ECHO ": $name " >> "$nlist"' - fi - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | - $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" - } - else # not an import lib - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - fi - ;; - *) - $opt_dry_run || { - eval '$ECHO ": $name " >> "$nlist"' - func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 - eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" - } - ;; - esac - done - - $opt_dry_run || { - # Make sure we have at least an empty file. - test -f "$nlist" || : > "$nlist" - - if test -n "$exclude_expsyms"; then - $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T - $MV "$nlist"T "$nlist" - fi - - # Try sorting and uniquifying the output. - if $GREP -v "^: " < "$nlist" | - if sort -k 3 /dev/null 2>&1; then - sort -k 3 - else - sort +2 - fi | - uniq > "$nlist"S; then - : - else - $GREP -v "^: " < "$nlist" > "$nlist"S - fi - - if test -f "$nlist"S; then - eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' - else - echo '/* NONE */' >> "$output_objdir/$my_dlsyms" - fi - - echo >> "$output_objdir/$my_dlsyms" "\ - -/* The mapping between symbol names and symbols. */ -typedef struct { - const char *name; - void *address; -} lt_dlsymlist; -extern LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[]; -LT_DLSYM_CONST lt_dlsymlist -lt_${my_prefix}_LTX_preloaded_symbols[] = -{\ - { \"$my_originator\", (void *) 0 }," - - case $need_lib_prefix in - no) - eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - *) - eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" - ;; - esac - echo >> "$output_objdir/$my_dlsyms" "\ - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt_${my_prefix}_LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif\ -" - } # !$opt_dry_run - - pic_flag_for_symtable= - case "$compile_command " in - *" -static "*) ;; - *) - case $host in - # compiling the symbol table file with pic_flag works around - # a FreeBSD bug that causes programs to crash when -lm is - # linked before any other PIC object. But we must not use - # pic_flag when linking with -static. The problem exists in - # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) - pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; - *-*-hpux*) - pic_flag_for_symtable=" $pic_flag" ;; - *) - if test "X$my_pic_p" != Xno; then - pic_flag_for_symtable=" $pic_flag" - fi - ;; - esac - ;; - esac - symtab_cflags= - for arg in $LTCFLAGS; do - case $arg in - -pie | -fpie | -fPIE) ;; - *) func_append symtab_cflags " $arg" ;; - esac - done - - # Now compile the dynamic symbol file. - func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' - - # Clean up the generated files. - func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' - - # Transform the symbol file into the correct name. - symfileobj="$output_objdir/${my_outputname}S.$objext" - case $host in - *cygwin* | *mingw* | *cegcc* ) - if test -f "$output_objdir/$my_outputname.def"; then - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` - else - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - fi - ;; - *) - compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` - ;; - esac - ;; - *) - func_fatal_error "unknown suffix for \`$my_dlsyms'" - ;; - esac - else - # We keep going just in case the user didn't refer to - # lt_preloaded_symbols. The linker will fail if global_symbol_pipe - # really was required. - - # Nullify the symbol file. - compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` - finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` - fi -} - -# func_win32_libid arg -# return the library type of file 'arg' -# -# Need a lot of goo to handle *both* DLLs and import libs -# Has to be a shell function in order to 'eat' the argument -# that is supplied when $file_magic_command is called. -# Despite the name, also deal with 64 bit binaries. -func_win32_libid () -{ - $opt_debug - win32_libid_type="unknown" - win32_fileres=`file -L $1 2>/dev/null` - case $win32_fileres in - *ar\ archive\ import\ library*) # definitely import - win32_libid_type="x86 archive import" - ;; - *ar\ archive*) # could be an import, or static - # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. - if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | - $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then - func_to_tool_file "$1" func_convert_file_msys_to_w32 - win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | - $SED -n -e ' - 1,100{ - / I /{ - s,.*,import, - p - q - } - }'` - case $win32_nmres in - import*) win32_libid_type="x86 archive import";; - *) win32_libid_type="x86 archive static";; - esac - fi - ;; - *DLL*) - win32_libid_type="x86 DLL" - ;; - *executable*) # but shell scripts are "executable" too... - case $win32_fileres in - *MS\ Windows\ PE\ Intel*) - win32_libid_type="x86 DLL" - ;; - esac - ;; - esac - $ECHO "$win32_libid_type" -} - -# func_cygming_dll_for_implib ARG -# -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib () -{ - $opt_debug - sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` -} - -# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs -# -# The is the core of a fallback implementation of a -# platform-specific function to extract the name of the -# DLL associated with the specified import library LIBNAME. -# -# SECTION_NAME is either .idata$6 or .idata$7, depending -# on the platform and compiler that created the implib. -# -# Echos the name of the DLL associated with the -# specified import library. -func_cygming_dll_for_implib_fallback_core () -{ - $opt_debug - match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` - $OBJDUMP -s --section "$1" "$2" 2>/dev/null | - $SED '/^Contents of section '"$match_literal"':/{ - # Place marker at beginning of archive member dllname section - s/.*/====MARK====/ - p - d - } - # These lines can sometimes be longer than 43 characters, but - # are always uninteresting - /:[ ]*file format pe[i]\{,1\}-/d - /^In archive [^:]*:/d - # Ensure marker is printed - /^====MARK====/p - # Remove all lines with less than 43 characters - /^.\{43\}/!d - # From remaining lines, remove first 43 characters - s/^.\{43\}//' | - $SED -n ' - # Join marker and all lines until next marker into a single line - /^====MARK====/ b para - H - $ b para - b - :para - x - s/\n//g - # Remove the marker - s/^====MARK====// - # Remove trailing dots and whitespace - s/[\. \t]*$// - # Print - /./p' | - # we now have a list, one entry per line, of the stringified - # contents of the appropriate section of all members of the - # archive which possess that section. Heuristic: eliminate - # all those which have a first or second character that is - # a '.' (that is, objdump's representation of an unprintable - # character.) This should work for all archives with less than - # 0x302f exports -- but will fail for DLLs whose name actually - # begins with a literal '.' or a single character followed by - # a '.'. - # - # Of those that remain, print the first one. - $SED -e '/^\./d;/^.\./d;q' -} - -# func_cygming_gnu_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is a GNU/binutils-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_gnu_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` - test -n "$func_cygming_gnu_implib_tmp" -} - -# func_cygming_ms_implib_p ARG -# This predicate returns with zero status (TRUE) if -# ARG is an MS-style import library. Returns -# with nonzero status (FALSE) otherwise. -func_cygming_ms_implib_p () -{ - $opt_debug - func_to_tool_file "$1" func_convert_file_msys_to_w32 - func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` - test -n "$func_cygming_ms_implib_tmp" -} - -# func_cygming_dll_for_implib_fallback ARG -# Platform-specific function to extract the -# name of the DLL associated with the specified -# import library ARG. -# -# This fallback implementation is for use when $DLLTOOL -# does not support the --identify-strict option. -# Invoked by eval'ing the libtool variable -# $sharedlib_from_linklib_cmd -# Result is available in the variable -# $sharedlib_from_linklib_result -func_cygming_dll_for_implib_fallback () -{ - $opt_debug - if func_cygming_gnu_implib_p "$1" ; then - # binutils import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` - elif func_cygming_ms_implib_p "$1" ; then - # ms-generated import library - sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` - else - # unknown - sharedlib_from_linklib_result="" - fi -} - - -# func_extract_an_archive dir oldlib -func_extract_an_archive () -{ - $opt_debug - f_ex_an_ar_dir="$1"; shift - f_ex_an_ar_oldlib="$1" - if test "$lock_old_archive_extraction" = yes; then - lockfile=$f_ex_an_ar_oldlib.lock - until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do - func_echo "Waiting for $lockfile to be removed" - sleep 2 - done - fi - func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ - 'stat=$?; rm -f "$lockfile"; exit $stat' - if test "$lock_old_archive_extraction" = yes; then - $opt_dry_run || rm -f "$lockfile" - fi - if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then - : - else - func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" - fi -} - - -# func_extract_archives gentop oldlib ... -func_extract_archives () -{ - $opt_debug - my_gentop="$1"; shift - my_oldlibs=${1+"$@"} - my_oldobjs="" - my_xlib="" - my_xabs="" - my_xdir="" - - for my_xlib in $my_oldlibs; do - # Extract the objects. - case $my_xlib in - [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; - *) my_xabs=`pwd`"/$my_xlib" ;; - esac - func_basename "$my_xlib" - my_xlib="$func_basename_result" - my_xlib_u=$my_xlib - while :; do - case " $extracted_archives " in - *" $my_xlib_u "*) - func_arith $extracted_serial + 1 - extracted_serial=$func_arith_result - my_xlib_u=lt$extracted_serial-$my_xlib ;; - *) break ;; - esac - done - extracted_archives="$extracted_archives $my_xlib_u" - my_xdir="$my_gentop/$my_xlib_u" - - func_mkdir_p "$my_xdir" - - case $host in - *-darwin*) - func_verbose "Extracting $my_xabs" - # Do not bother doing anything if just a dry run - $opt_dry_run || { - darwin_orig_dir=`pwd` - cd $my_xdir || exit $? - darwin_archive=$my_xabs - darwin_curdir=`pwd` - darwin_base_archive=`basename "$darwin_archive"` - darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` - if test -n "$darwin_arches"; then - darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` - darwin_arch= - func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" - for darwin_arch in $darwin_arches ; do - func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" - $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" - cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" - func_extract_an_archive "`pwd`" "${darwin_base_archive}" - cd "$darwin_curdir" - $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" - done # $darwin_arches - ## Okay now we've a bunch of thin objects, gotta fatten them up :) - darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` - darwin_file= - darwin_files= - for darwin_file in $darwin_filelist; do - darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` - $LIPO -create -output "$darwin_file" $darwin_files - done # $darwin_filelist - $RM -rf unfat-$$ - cd "$darwin_orig_dir" - else - cd $darwin_orig_dir - func_extract_an_archive "$my_xdir" "$my_xabs" - fi # $darwin_arches - } # !$opt_dry_run - ;; - *) - func_extract_an_archive "$my_xdir" "$my_xabs" - ;; - esac - my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` - done - - func_extract_archives_result="$my_oldobjs" -} - - -# func_emit_wrapper [arg=no] -# -# Emit a libtool wrapper script on stdout. -# Don't directly open a file because we may want to -# incorporate the script contents within a cygwin/mingw -# wrapper executable. Must ONLY be called from within -# func_mode_link because it depends on a number of variables -# set therein. -# -# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR -# variable will take. If 'yes', then the emitted script -# will assume that the directory in which it is stored is -# the $objdir directory. This is a cygwin/mingw-specific -# behavior. -func_emit_wrapper () -{ - func_emit_wrapper_arg1=${1-no} - - $ECHO "\ -#! $SHELL - -# $output - temporary wrapper script for $objdir/$outputname -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# The $output program cannot be directly executed until all the libtool -# libraries that it depends on are installed. -# -# This wrapper script should never be moved out of the build directory. -# If it is, it will not operate correctly. - -# Sed substitution that helps us do robust quoting. It backslashifies -# metacharacters that are still active within double-quoted strings. -sed_quote_subst='$sed_quote_subst' - -# Be Bourne compatible -if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then - emulate sh - NULLCMD=: - # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which - # is contrary to our usage. Disable this feature. - alias -g '\${1+\"\$@\"}'='\"\$@\"' - setopt NO_GLOB_SUBST -else - case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac -fi -BIN_SH=xpg4; export BIN_SH # for Tru64 -DUALCASE=1; export DUALCASE # for MKS sh - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -relink_command=\"$relink_command\" - -# This environment variable determines our operation mode. -if test \"\$libtool_install_magic\" = \"$magic\"; then - # install mode needs the following variables: - generated_by_libtool_version='$macro_version' - notinst_deplibs='$notinst_deplibs' -else - # When we are sourced in execute mode, \$file and \$ECHO are already set. - if test \"\$libtool_execute_magic\" != \"$magic\"; then - file=\"\$0\"" - - qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` - $ECHO "\ - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$1 -_LTECHO_EOF' -} - ECHO=\"$qECHO\" - fi - -# Very basic option parsing. These options are (a) specific to -# the libtool wrapper, (b) are identical between the wrapper -# /script/ and the wrapper /executable/ which is used only on -# windows platforms, and (c) all begin with the string "--lt-" -# (application programs are unlikely to have options which match -# this pattern). -# -# There are only two supported options: --lt-debug and -# --lt-dump-script. There is, deliberately, no --lt-help. -# -# The first argument to this parsing function should be the -# script's $0 value, followed by "$@". -lt_option_debug= -func_parse_lt_options () -{ - lt_script_arg0=\$0 - shift - for lt_opt - do - case \"\$lt_opt\" in - --lt-debug) lt_option_debug=1 ;; - --lt-dump-script) - lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` - test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. - lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` - cat \"\$lt_dump_D/\$lt_dump_F\" - exit 0 - ;; - --lt-*) - \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 - exit 1 - ;; - esac - done - - # Print the debug banner immediately: - if test -n \"\$lt_option_debug\"; then - echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 - fi -} - -# Used when --lt-debug. Prints its arguments to stdout -# (redirection is the responsibility of the caller) -func_lt_dump_args () -{ - lt_dump_args_N=1; - for lt_arg - do - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" - lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` - done -} - -# Core function for launching the target application -func_exec_program_core () -{ -" - case $host in - # Backslashes separate directories on plain windows - *-*-mingw | *-*-os2* | *-cegcc*) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} -" - ;; - - *) - $ECHO "\ - if test -n \"\$lt_option_debug\"; then - \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 - func_lt_dump_args \${1+\"\$@\"} 1>&2 - fi - exec \"\$progdir/\$program\" \${1+\"\$@\"} -" - ;; - esac - $ECHO "\ - \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 - exit 1 -} - -# A function to encapsulate launching the target application -# Strips options in the --lt-* namespace from \$@ and -# launches target application with the remaining arguments. -func_exec_program () -{ - for lt_wr_arg - do - case \$lt_wr_arg in - --lt-*) ;; - *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; - esac - shift - done - func_exec_program_core \${1+\"\$@\"} -} - - # Parse options - func_parse_lt_options \"\$0\" \${1+\"\$@\"} - - # Find the directory that this script lives in. - thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` - test \"x\$thisdir\" = \"x\$file\" && thisdir=. - - # Follow symbolic links until we get to the real thisdir. - file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` - while test -n \"\$file\"; do - destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` - - # If there was a directory component, then change thisdir. - if test \"x\$destdir\" != \"x\$file\"; then - case \"\$destdir\" in - [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; - *) thisdir=\"\$thisdir/\$destdir\" ;; - esac - fi - - file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` - file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` - done - - # Usually 'no', except on cygwin/mingw when embedded into - # the cwrapper. - WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 - if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then - # special case for '.' - if test \"\$thisdir\" = \".\"; then - thisdir=\`pwd\` - fi - # remove .libs from thisdir - case \"\$thisdir\" in - *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; - $objdir ) thisdir=. ;; - esac - fi - - # Try to get the absolute directory name. - absdir=\`cd \"\$thisdir\" && pwd\` - test -n \"\$absdir\" && thisdir=\"\$absdir\" -" - - if test "$fast_install" = yes; then - $ECHO "\ - program=lt-'$outputname'$exeext - progdir=\"\$thisdir/$objdir\" - - if test ! -f \"\$progdir/\$program\" || - { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ - test \"X\$file\" != \"X\$progdir/\$program\"; }; then - - file=\"\$\$-\$program\" - - if test ! -d \"\$progdir\"; then - $MKDIR \"\$progdir\" - else - $RM \"\$progdir/\$file\" - fi" - - $ECHO "\ - - # relink executable if necessary - if test -n \"\$relink_command\"; then - if relink_command_output=\`eval \$relink_command 2>&1\`; then : - else - $ECHO \"\$relink_command_output\" >&2 - $RM \"\$progdir/\$file\" - exit 1 - fi - fi - - $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || - { $RM \"\$progdir/\$program\"; - $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } - $RM \"\$progdir/\$file\" - fi" - else - $ECHO "\ - program='$outputname' - progdir=\"\$thisdir/$objdir\" -" - fi - - $ECHO "\ - - if test -f \"\$progdir/\$program\"; then" - - # fixup the dll searchpath if we need to. - # - # Fix the DLL searchpath if we need to. Do this before prepending - # to shlibpath, because on Windows, both are PATH and uninstalled - # libraries must come first. - if test -n "$dllsearchpath"; then - $ECHO "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - - # Export our shlibpath_var if we have one. - if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then - $ECHO "\ - # Add our own library path to $shlibpath_var - $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" - - # Some systems cannot cope with colon-terminated $shlibpath_var - # The second colon is a workaround for a bug in BeOS R4 sed - $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` - - export $shlibpath_var -" - fi - - $ECHO "\ - if test \"\$libtool_execute_magic\" != \"$magic\"; then - # Run the actual program with our arguments. - func_exec_program \${1+\"\$@\"} - fi - else - # The program doesn't exist. - \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 - \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 - \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 - exit 1 - fi -fi\ -" -} - - -# func_emit_cwrapperexe_src -# emit the source code for a wrapper executable on stdout -# Must ONLY be called from within func_mode_link because -# it depends on a number of variable set therein. -func_emit_cwrapperexe_src () -{ - cat < -#include -#ifdef _MSC_VER -# include -# include -# include -#else -# include -# include -# ifdef __CYGWIN__ -# include -# endif -#endif -#include -#include -#include -#include -#include -#include -#include -#include - -/* declarations of non-ANSI functions */ -#if defined(__MINGW32__) -# ifdef __STRICT_ANSI__ -int _putenv (const char *); -# endif -#elif defined(__CYGWIN__) -# ifdef __STRICT_ANSI__ -char *realpath (const char *, char *); -int putenv (char *); -int setenv (const char *, const char *, int); -# endif -/* #elif defined (other platforms) ... */ -#endif - -/* portability defines, excluding path handling macros */ -#if defined(_MSC_VER) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -# define S_IXUSR _S_IEXEC -# ifndef _INTPTR_T_DEFINED -# define _INTPTR_T_DEFINED -# define intptr_t int -# endif -#elif defined(__MINGW32__) -# define setmode _setmode -# define stat _stat -# define chmod _chmod -# define getcwd _getcwd -# define putenv _putenv -#elif defined(__CYGWIN__) -# define HAVE_SETENV -# define FOPEN_WB "wb" -/* #elif defined (other platforms) ... */ -#endif - -#if defined(PATH_MAX) -# define LT_PATHMAX PATH_MAX -#elif defined(MAXPATHLEN) -# define LT_PATHMAX MAXPATHLEN -#else -# define LT_PATHMAX 1024 -#endif - -#ifndef S_IXOTH -# define S_IXOTH 0 -#endif -#ifndef S_IXGRP -# define S_IXGRP 0 -#endif - -/* path handling portability macros */ -#ifndef DIR_SEPARATOR -# define DIR_SEPARATOR '/' -# define PATH_SEPARATOR ':' -#endif - -#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ - defined (__OS2__) -# define HAVE_DOS_BASED_FILE_SYSTEM -# define FOPEN_WB "wb" -# ifndef DIR_SEPARATOR_2 -# define DIR_SEPARATOR_2 '\\' -# endif -# ifndef PATH_SEPARATOR_2 -# define PATH_SEPARATOR_2 ';' -# endif -#endif - -#ifndef DIR_SEPARATOR_2 -# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) -#else /* DIR_SEPARATOR_2 */ -# define IS_DIR_SEPARATOR(ch) \ - (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) -#endif /* DIR_SEPARATOR_2 */ - -#ifndef PATH_SEPARATOR_2 -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) -#else /* PATH_SEPARATOR_2 */ -# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) -#endif /* PATH_SEPARATOR_2 */ - -#ifndef FOPEN_WB -# define FOPEN_WB "w" -#endif -#ifndef _O_BINARY -# define _O_BINARY 0 -#endif - -#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) -#define XFREE(stale) do { \ - if (stale) { free ((void *) stale); stale = 0; } \ -} while (0) - -#if defined(LT_DEBUGWRAPPER) -static int lt_debug = 1; -#else -static int lt_debug = 0; -#endif - -const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ - -void *xmalloc (size_t num); -char *xstrdup (const char *string); -const char *base_name (const char *name); -char *find_executable (const char *wrapper); -char *chase_symlinks (const char *pathspec); -int make_executable (const char *path); -int check_executable (const char *path); -char *strendzap (char *str, const char *pat); -void lt_debugprintf (const char *file, int line, const char *fmt, ...); -void lt_fatal (const char *file, int line, const char *message, ...); -static const char *nonnull (const char *s); -static const char *nonempty (const char *s); -void lt_setenv (const char *name, const char *value); -char *lt_extend_str (const char *orig_value, const char *add, int to_end); -void lt_update_exe_path (const char *name, const char *value); -void lt_update_lib_path (const char *name, const char *value); -char **prepare_spawn (char **argv); -void lt_dump_script (FILE *f); -EOF - - cat <= 0) - && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) - return 1; - else - return 0; -} - -int -make_executable (const char *path) -{ - int rval = 0; - struct stat st; - - lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", - nonempty (path)); - if ((!path) || (!*path)) - return 0; - - if (stat (path, &st) >= 0) - { - rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); - } - return rval; -} - -/* Searches for the full path of the wrapper. Returns - newly allocated full path name if found, NULL otherwise - Does not chase symlinks, even on platforms that support them. -*/ -char * -find_executable (const char *wrapper) -{ - int has_slash = 0; - const char *p; - const char *p_next; - /* static buffer for getcwd */ - char tmp[LT_PATHMAX + 1]; - int tmp_len; - char *concat_name; - - lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", - nonempty (wrapper)); - - if ((wrapper == NULL) || (*wrapper == '\0')) - return NULL; - - /* Absolute path? */ -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - else - { -#endif - if (IS_DIR_SEPARATOR (wrapper[0])) - { - concat_name = xstrdup (wrapper); - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } -#if defined (HAVE_DOS_BASED_FILE_SYSTEM) - } -#endif - - for (p = wrapper; *p; p++) - if (*p == '/') - { - has_slash = 1; - break; - } - if (!has_slash) - { - /* no slashes; search PATH */ - const char *path = getenv ("PATH"); - if (path != NULL) - { - for (p = path; *p; p = p_next) - { - const char *q; - size_t p_len; - for (q = p; *q; q++) - if (IS_PATH_SEPARATOR (*q)) - break; - p_len = q - p; - p_next = (*q == '\0' ? q : q + 1); - if (p_len == 0) - { - /* empty path: current directory */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = - XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - } - else - { - concat_name = - XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, p, p_len); - concat_name[p_len] = '/'; - strcpy (concat_name + p_len + 1, wrapper); - } - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - } - } - /* not found in PATH; assume curdir */ - } - /* Relative path | not found in path: prepend cwd */ - if (getcwd (tmp, LT_PATHMAX) == NULL) - lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", - nonnull (strerror (errno))); - tmp_len = strlen (tmp); - concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); - memcpy (concat_name, tmp, tmp_len); - concat_name[tmp_len] = '/'; - strcpy (concat_name + tmp_len + 1, wrapper); - - if (check_executable (concat_name)) - return concat_name; - XFREE (concat_name); - return NULL; -} - -char * -chase_symlinks (const char *pathspec) -{ -#ifndef S_ISLNK - return xstrdup (pathspec); -#else - char buf[LT_PATHMAX]; - struct stat s; - char *tmp_pathspec = xstrdup (pathspec); - char *p; - int has_symlinks = 0; - while (strlen (tmp_pathspec) && !has_symlinks) - { - lt_debugprintf (__FILE__, __LINE__, - "checking path component for symlinks: %s\n", - tmp_pathspec); - if (lstat (tmp_pathspec, &s) == 0) - { - if (S_ISLNK (s.st_mode) != 0) - { - has_symlinks = 1; - break; - } - - /* search backwards for last DIR_SEPARATOR */ - p = tmp_pathspec + strlen (tmp_pathspec) - 1; - while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - p--; - if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) - { - /* no more DIR_SEPARATORS left */ - break; - } - *p = '\0'; - } - else - { - lt_fatal (__FILE__, __LINE__, - "error accessing file \"%s\": %s", - tmp_pathspec, nonnull (strerror (errno))); - } - } - XFREE (tmp_pathspec); - - if (!has_symlinks) - { - return xstrdup (pathspec); - } - - tmp_pathspec = realpath (pathspec, buf); - if (tmp_pathspec == 0) - { - lt_fatal (__FILE__, __LINE__, - "could not follow symlinks for %s", pathspec); - } - return xstrdup (tmp_pathspec); -#endif -} - -char * -strendzap (char *str, const char *pat) -{ - size_t len, patlen; - - assert (str != NULL); - assert (pat != NULL); - - len = strlen (str); - patlen = strlen (pat); - - if (patlen <= len) - { - str += len - patlen; - if (strcmp (str, pat) == 0) - *str = '\0'; - } - return str; -} - -void -lt_debugprintf (const char *file, int line, const char *fmt, ...) -{ - va_list args; - if (lt_debug) - { - (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); - va_start (args, fmt); - (void) vfprintf (stderr, fmt, args); - va_end (args); - } -} - -static void -lt_error_core (int exit_status, const char *file, - int line, const char *mode, - const char *message, va_list ap) -{ - fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); - vfprintf (stderr, message, ap); - fprintf (stderr, ".\n"); - - if (exit_status >= 0) - exit (exit_status); -} - -void -lt_fatal (const char *file, int line, const char *message, ...) -{ - va_list ap; - va_start (ap, message); - lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); - va_end (ap); -} - -static const char * -nonnull (const char *s) -{ - return s ? s : "(null)"; -} - -static const char * -nonempty (const char *s) -{ - return (s && !*s) ? "(empty)" : nonnull (s); -} - -void -lt_setenv (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_setenv) setting '%s' to '%s'\n", - nonnull (name), nonnull (value)); - { -#ifdef HAVE_SETENV - /* always make a copy, for consistency with !HAVE_SETENV */ - char *str = xstrdup (value); - setenv (name, str, 1); -#else - int len = strlen (name) + 1 + strlen (value) + 1; - char *str = XMALLOC (char, len); - sprintf (str, "%s=%s", name, value); - if (putenv (str) != EXIT_SUCCESS) - { - XFREE (str); - } -#endif - } -} - -char * -lt_extend_str (const char *orig_value, const char *add, int to_end) -{ - char *new_value; - if (orig_value && *orig_value) - { - int orig_value_len = strlen (orig_value); - int add_len = strlen (add); - new_value = XMALLOC (char, add_len + orig_value_len + 1); - if (to_end) - { - strcpy (new_value, orig_value); - strcpy (new_value + orig_value_len, add); - } - else - { - strcpy (new_value, add); - strcpy (new_value + add_len, orig_value); - } - } - else - { - new_value = xstrdup (add); - } - return new_value; -} - -void -lt_update_exe_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - /* some systems can't cope with a ':'-terminated path #' */ - int len = strlen (new_value); - while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) - { - new_value[len-1] = '\0'; - } - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -void -lt_update_lib_path (const char *name, const char *value) -{ - lt_debugprintf (__FILE__, __LINE__, - "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", - nonnull (name), nonnull (value)); - - if (name && *name && value && *value) - { - char *new_value = lt_extend_str (getenv (name), value, 0); - lt_setenv (name, new_value); - XFREE (new_value); - } -} - -EOF - case $host_os in - mingw*) - cat <<"EOF" - -/* Prepares an argument vector before calling spawn(). - Note that spawn() does not by itself call the command interpreter - (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : - ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&v); - v.dwPlatformId == VER_PLATFORM_WIN32_NT; - }) ? "cmd.exe" : "command.com"). - Instead it simply concatenates the arguments, separated by ' ', and calls - CreateProcess(). We must quote the arguments since Win32 CreateProcess() - interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a - special way: - - Space and tab are interpreted as delimiters. They are not treated as - delimiters if they are surrounded by double quotes: "...". - - Unescaped double quotes are removed from the input. Their only effect is - that within double quotes, space and tab are treated like normal - characters. - - Backslashes not followed by double quotes are not special. - - But 2*n+1 backslashes followed by a double quote become - n backslashes followed by a double quote (n >= 0): - \" -> " - \\\" -> \" - \\\\\" -> \\" - */ -#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" -char ** -prepare_spawn (char **argv) -{ - size_t argc; - char **new_argv; - size_t i; - - /* Count number of arguments. */ - for (argc = 0; argv[argc] != NULL; argc++) - ; - - /* Allocate new argument vector. */ - new_argv = XMALLOC (char *, argc + 1); - - /* Put quoted arguments into the new argument vector. */ - for (i = 0; i < argc; i++) - { - const char *string = argv[i]; - - if (string[0] == '\0') - new_argv[i] = xstrdup ("\"\""); - else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) - { - int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); - size_t length; - unsigned int backslashes; - const char *s; - char *quoted_string; - char *p; - - length = 0; - backslashes = 0; - if (quote_around) - length++; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - length += backslashes + 1; - length++; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - length += backslashes + 1; - - quoted_string = XMALLOC (char, length + 1); - - p = quoted_string; - backslashes = 0; - if (quote_around) - *p++ = '"'; - for (s = string; *s != '\0'; s++) - { - char c = *s; - if (c == '"') - { - unsigned int j; - for (j = backslashes + 1; j > 0; j--) - *p++ = '\\'; - } - *p++ = c; - if (c == '\\') - backslashes++; - else - backslashes = 0; - } - if (quote_around) - { - unsigned int j; - for (j = backslashes; j > 0; j--) - *p++ = '\\'; - *p++ = '"'; - } - *p = '\0'; - - new_argv[i] = quoted_string; - } - else - new_argv[i] = (char *) string; - } - new_argv[argc] = NULL; - - return new_argv; -} -EOF - ;; - esac - - cat <<"EOF" -void lt_dump_script (FILE* f) -{ -EOF - func_emit_wrapper yes | - $SED -e 's/\([\\"]\)/\\\1/g' \ - -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' - - cat <<"EOF" -} -EOF -} -# end: func_emit_cwrapperexe_src - -# func_win32_import_lib_p ARG -# True if ARG is an import lib, as indicated by $file_magic_cmd -func_win32_import_lib_p () -{ - $opt_debug - case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in - *import*) : ;; - *) false ;; - esac -} - -# func_mode_link arg... -func_mode_link () -{ - $opt_debug - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - # It is impossible to link a dll without this setting, and - # we shouldn't force the makefile maintainer to figure out - # which system we are compiling for in order to pass an extra - # flag for every libtool invocation. - # allow_undefined=no - - # FIXME: Unfortunately, there are problems with the above when trying - # to make a dll which has undefined symbols, in which case not - # even a static library is built. For now, we need to specify - # -no-undefined on the libtool link line when we can be certain - # that all symbols are satisfied, otherwise we get a static library. - allow_undefined=yes - ;; - *) - allow_undefined=yes - ;; - esac - libtool_args=$nonopt - base_compile="$nonopt $@" - compile_command=$nonopt - finalize_command=$nonopt - - compile_rpath= - finalize_rpath= - compile_shlibpath= - finalize_shlibpath= - convenience= - old_convenience= - deplibs= - old_deplibs= - compiler_flags= - linker_flags= - dllsearchpath= - lib_search_path=`pwd` - inst_prefix_dir= - new_inherited_linker_flags= - - avoid_version=no - bindir= - dlfiles= - dlprefiles= - dlself=no - export_dynamic=no - export_symbols= - export_symbols_regex= - generated= - libobjs= - ltlibs= - module=no - no_install=no - objs= - non_pic_objects= - precious_files_regex= - prefer_static_libs=no - preload=no - prev= - prevarg= - release= - rpath= - xrpath= - perm_rpath= - temp_rpath= - thread_safe=no - vinfo= - vinfo_number=no - weak_libs= - single_module="${wl}-single_module" - func_infer_tag $base_compile - - # We need to know -static, to get the right output filenames. - for arg - do - case $arg in - -shared) - test "$build_libtool_libs" != yes && \ - func_fatal_configuration "can not build a shared library" - build_old_libs=no - break - ;; - -all-static | -static | -static-libtool-libs) - case $arg in - -all-static) - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then - func_warning "complete static linking is impossible in this configuration" - fi - if test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - -static) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=built - ;; - -static-libtool-libs) - if test -z "$pic_flag" && test -n "$link_static_flag"; then - dlopen_self=$dlopen_self_static - fi - prefer_static_libs=yes - ;; - esac - build_libtool_libs=no - build_old_libs=yes - break - ;; - esac - done - - # See if our shared archives depend on static archives. - test -n "$old_archive_from_new_cmds" && build_old_libs=yes - - # Go through the arguments, transforming them on the way. - while test "$#" -gt 0; do - arg="$1" - shift - func_quote_for_eval "$arg" - qarg=$func_quote_for_eval_unquoted_result - func_append libtool_args " $func_quote_for_eval_result" - - # If the previous option needs an argument, assign it. - if test -n "$prev"; then - case $prev in - output) - func_append compile_command " @OUTPUT@" - func_append finalize_command " @OUTPUT@" - ;; - esac - - case $prev in - bindir) - bindir="$arg" - prev= - continue - ;; - dlfiles|dlprefiles) - if test "$preload" = no; then - # Add the symbol object into the linking commands. - func_append compile_command " @SYMFILE@" - func_append finalize_command " @SYMFILE@" - preload=yes - fi - case $arg in - *.la | *.lo) ;; # We handle these cases below. - force) - if test "$dlself" = no; then - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - self) - if test "$prev" = dlprefiles; then - dlself=yes - elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then - dlself=yes - else - dlself=needless - export_dynamic=yes - fi - prev= - continue - ;; - *) - if test "$prev" = dlfiles; then - func_append dlfiles " $arg" - else - func_append dlprefiles " $arg" - fi - prev= - continue - ;; - esac - ;; - expsyms) - export_symbols="$arg" - test -f "$arg" \ - || func_fatal_error "symbol file \`$arg' does not exist" - prev= - continue - ;; - expsyms_regex) - export_symbols_regex="$arg" - prev= - continue - ;; - framework) - case $host in - *-*-darwin*) - case "$deplibs " in - *" $qarg.ltframework "*) ;; - *) func_append deplibs " $qarg.ltframework" # this is fixed later - ;; - esac - ;; - esac - prev= - continue - ;; - inst_prefix) - inst_prefix_dir="$arg" - prev= - continue - ;; - objectlist) - if test -f "$arg"; then - save_arg=$arg - moreargs= - for fil in `cat "$save_arg"` - do -# func_append moreargs " $fil" - arg=$fil - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - done - else - func_fatal_error "link input file \`$arg' does not exist" - fi - arg=$save_arg - prev= - continue - ;; - precious_regex) - precious_files_regex="$arg" - prev= - continue - ;; - release) - release="-$arg" - prev= - continue - ;; - rpath | xrpath) - # We need an absolute path. - case $arg in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - if test "$prev" = rpath; then - case "$rpath " in - *" $arg "*) ;; - *) func_append rpath " $arg" ;; - esac - else - case "$xrpath " in - *" $arg "*) ;; - *) func_append xrpath " $arg" ;; - esac - fi - prev= - continue - ;; - shrext) - shrext_cmds="$arg" - prev= - continue - ;; - weak) - func_append weak_libs " $arg" - prev= - continue - ;; - xcclinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xcompiler) - func_append compiler_flags " $qarg" - prev= - func_append compile_command " $qarg" - func_append finalize_command " $qarg" - continue - ;; - xlinker) - func_append linker_flags " $qarg" - func_append compiler_flags " $wl$qarg" - prev= - func_append compile_command " $wl$qarg" - func_append finalize_command " $wl$qarg" - continue - ;; - *) - eval "$prev=\"\$arg\"" - prev= - continue - ;; - esac - fi # test -n "$prev" - - prevarg="$arg" - - case $arg in - -all-static) - if test -n "$link_static_flag"; then - # See comment for -static flag below, for more details. - func_append compile_command " $link_static_flag" - func_append finalize_command " $link_static_flag" - fi - continue - ;; - - -allow-undefined) - # FIXME: remove this flag sometime in the future. - func_fatal_error "\`-allow-undefined' must not be used because it is the default" - ;; - - -avoid-version) - avoid_version=yes - continue - ;; - - -bindir) - prev=bindir - continue - ;; - - -dlopen) - prev=dlfiles - continue - ;; - - -dlpreopen) - prev=dlprefiles - continue - ;; - - -export-dynamic) - export_dynamic=yes - continue - ;; - - -export-symbols | -export-symbols-regex) - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - func_fatal_error "more than one -exported-symbols argument is not allowed" - fi - if test "X$arg" = "X-export-symbols"; then - prev=expsyms - else - prev=expsyms_regex - fi - continue - ;; - - -framework) - prev=framework - continue - ;; - - -inst-prefix-dir) - prev=inst_prefix - continue - ;; - - # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* - # so, if we see these flags be careful not to treat them like -L - -L[A-Z][A-Z]*:*) - case $with_gcc/$host in - no/*-*-irix* | /*-*-irix*) - func_append compile_command " $arg" - func_append finalize_command " $arg" - ;; - esac - continue - ;; - - -L*) - func_stripname "-L" '' "$arg" - if test -z "$func_stripname_result"; then - if test "$#" -gt 0; then - func_fatal_error "require no space between \`-L' and \`$1'" - else - func_fatal_error "need path for \`-L' option" - fi - fi - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - *) - absdir=`cd "$dir" && pwd` - test -z "$absdir" && \ - func_fatal_error "cannot determine absolute directory name of \`$dir'" - dir="$absdir" - ;; - esac - case "$deplibs " in - *" -L$dir "* | *" $arg "*) - # Will only happen for absolute or sysroot arguments - ;; - *) - # Preserve sysroot, but never include relative directories - case $dir in - [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; - *) func_append deplibs " -L$dir" ;; - esac - func_append lib_search_path " $dir" - ;; - esac - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$dir:"*) ;; - ::) dllsearchpath=$dir;; - *) func_append dllsearchpath ":$dir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - continue - ;; - - -l*) - if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) - # These systems don't actually have a C or math library (as such) - continue - ;; - *-*-os2*) - # These systems don't actually have a C library (as such) - test "X$arg" = "X-lc" && continue - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - test "X$arg" = "X-lc" && continue - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C and math libraries are in the System framework - func_append deplibs " System.ltframework" - continue - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - test "X$arg" = "X-lc" && continue - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - test "X$arg" = "X-lc" && continue - ;; - esac - elif test "X$arg" = "X-lc_r"; then - case $host in - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc_r directly, use -pthread flag. - continue - ;; - esac - fi - func_append deplibs " $arg" - continue - ;; - - -module) - module=yes - continue - ;; - - # Tru64 UNIX uses -model [arg] to determine the layout of C++ - # classes, name mangling, and exception handling. - # Darwin uses the -arch flag to determine output architecture. - -model|-arch|-isysroot|--sysroot) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - prev=xcompiler - continue - ;; - - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - func_append compiler_flags " $arg" - func_append compile_command " $arg" - func_append finalize_command " $arg" - case "$new_inherited_linker_flags " in - *" $arg "*) ;; - * ) func_append new_inherited_linker_flags " $arg" ;; - esac - continue - ;; - - -multi_module) - single_module="${wl}-multi_module" - continue - ;; - - -no-fast-install) - fast_install=no - continue - ;; - - -no-install) - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) - # The PATH hackery in wrapper scripts is required on Windows - # and Darwin in order for the loader to find any dlls it needs. - func_warning "\`-no-install' is ignored for $host" - func_warning "assuming \`-no-fast-install' instead" - fast_install=no - ;; - *) no_install=yes ;; - esac - continue - ;; - - -no-undefined) - allow_undefined=no - continue - ;; - - -objectlist) - prev=objectlist - continue - ;; - - -o) prev=output ;; - - -precious-files-regex) - prev=precious_regex - continue - ;; - - -release) - prev=release - continue - ;; - - -rpath) - prev=rpath - continue - ;; - - -R) - prev=xrpath - continue - ;; - - -R*) - func_stripname '-R' '' "$arg" - dir=$func_stripname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) ;; - =*) - func_stripname '=' '' "$dir" - dir=$lt_sysroot$func_stripname_result - ;; - *) - func_fatal_error "only absolute run-paths are allowed" - ;; - esac - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - continue - ;; - - -shared) - # The effects of -shared are defined in a previous loop. - continue - ;; - - -shrext) - prev=shrext - continue - ;; - - -static | -static-libtool-libs) - # The effects of -static are defined in a previous loop. - # We used to do the same as -all-static on platforms that - # didn't have a PIC flag, but the assumption that the effects - # would be equivalent was wrong. It would break on at least - # Digital Unix and AIX. - continue - ;; - - -thread-safe) - thread_safe=yes - continue - ;; - - -version-info) - prev=vinfo - continue - ;; - - -version-number) - prev=vinfo - vinfo_number=yes - continue - ;; - - -weak) - prev=weak - continue - ;; - - -Wc,*) - func_stripname '-Wc,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $func_quote_for_eval_result" - func_append compiler_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Wl,*) - func_stripname '-Wl,' '' "$arg" - args=$func_stripname_result - arg= - save_ifs="$IFS"; IFS=',' - for flag in $args; do - IFS="$save_ifs" - func_quote_for_eval "$flag" - func_append arg " $wl$func_quote_for_eval_result" - func_append compiler_flags " $wl$func_quote_for_eval_result" - func_append linker_flags " $func_quote_for_eval_result" - done - IFS="$save_ifs" - func_stripname ' ' '' "$arg" - arg=$func_stripname_result - ;; - - -Xcompiler) - prev=xcompiler - continue - ;; - - -Xlinker) - prev=xlinker - continue - ;; - - -XCClinker) - prev=xcclinker - continue - ;; - - # -msg_* for osf cc - -msg_*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - # Flags to be passed through unchanged, with rationale: - # -64, -mips[0-9] enable 64-bit mode for the SGI compiler - # -r[0-9][0-9]* specify processor for the SGI compiler - # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler - # +DA*, +DD* enable 64-bit mode for the HP compiler - # -q* compiler args for the IBM compiler - # -m*, -t[45]*, -txscale* architecture-specific flags for GCC - # -F/path path to uninstalled frameworks, gcc on darwin - # -p, -pg, --coverage, -fprofile-* profiling flags for GCC - # @file GCC response files - # -tp=* Portland pgcc target processor selection - # --sysroot=* for sysroot support - # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization - -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ - -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ - -O*|-flto*|-fwhopr*|-fuse-linker-plugin) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - func_append compile_command " $arg" - func_append finalize_command " $arg" - func_append compiler_flags " $arg" - continue - ;; - - # Some other compiler flag. - -* | +*) - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - - *.$objext) - # A standard object. - func_append objs " $arg" - ;; - - *.lo) - # A libtool-controlled object. - - # Check to see that this really is a libtool object. - if func_lalib_unsafe_p "$arg"; then - pic_object= - non_pic_object= - - # Read the .lo file - func_source "$arg" - - if test -z "$pic_object" || - test -z "$non_pic_object" || - test "$pic_object" = none && - test "$non_pic_object" = none; then - func_fatal_error "cannot find name of object for \`$arg'" - fi - - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - if test "$pic_object" != none; then - # Prepend the subdirectory the object is found in. - pic_object="$xdir$pic_object" - - if test "$prev" = dlfiles; then - if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then - func_append dlfiles " $pic_object" - prev= - continue - else - # If libtool objects are unsupported, then we need to preload. - prev=dlprefiles - fi - fi - - # CHECK ME: I think I busted this. -Ossama - if test "$prev" = dlprefiles; then - # Preload the old-style object. - func_append dlprefiles " $pic_object" - prev= - fi - - # A PIC object. - func_append libobjs " $pic_object" - arg="$pic_object" - fi - - # Non-PIC object. - if test "$non_pic_object" != none; then - # Prepend the subdirectory the object is found in. - non_pic_object="$xdir$non_pic_object" - - # A standard non-PIC object - func_append non_pic_objects " $non_pic_object" - if test -z "$pic_object" || test "$pic_object" = none ; then - arg="$non_pic_object" - fi - else - # If the PIC object exists, use it instead. - # $xdir was prepended to $pic_object above. - non_pic_object="$pic_object" - func_append non_pic_objects " $non_pic_object" - fi - else - # Only an error if not doing a dry-run. - if $opt_dry_run; then - # Extract subdirectory from the argument. - func_dirname "$arg" "/" "" - xdir="$func_dirname_result" - - func_lo2o "$arg" - pic_object=$xdir$objdir/$func_lo2o_result - non_pic_object=$xdir$func_lo2o_result - func_append libobjs " $pic_object" - func_append non_pic_objects " $non_pic_object" - else - func_fatal_error "\`$arg' is not a valid libtool object" - fi - fi - ;; - - *.$libext) - # An archive. - func_append deplibs " $arg" - func_append old_deplibs " $arg" - continue - ;; - - *.la) - # A libtool-controlled library. - - func_resolve_sysroot "$arg" - if test "$prev" = dlfiles; then - # This library was specified with -dlopen. - func_append dlfiles " $func_resolve_sysroot_result" - prev= - elif test "$prev" = dlprefiles; then - # The library was specified with -dlpreopen. - func_append dlprefiles " $func_resolve_sysroot_result" - prev= - else - func_append deplibs " $func_resolve_sysroot_result" - fi - continue - ;; - - # Some other compiler argument. - *) - # Unknown arguments in both finalize_command and compile_command need - # to be aesthetically quoted because they are evaled later. - func_quote_for_eval "$arg" - arg="$func_quote_for_eval_result" - ;; - esac # arg - - # Now actually substitute the argument into the commands. - if test -n "$arg"; then - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - done # argument parsing loop - - test -n "$prev" && \ - func_fatal_help "the \`$prevarg' option requires an argument" - - if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - func_append compile_command " $arg" - func_append finalize_command " $arg" - fi - - oldlibs= - # calculate the name of the file, without its directory - func_basename "$output" - outputname="$func_basename_result" - libobjs_save="$libobjs" - - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` - else - shlib_search_path= - fi - eval sys_lib_search_path=\"$sys_lib_search_path_spec\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - - func_dirname "$output" "/" "" - output_objdir="$func_dirname_result$objdir" - func_to_tool_file "$output_objdir/" - tool_output_objdir=$func_to_tool_file_result - # Create the object directory. - func_mkdir_p "$output_objdir" - - # Determine the type of output - case $output in - "") - func_fatal_help "you must specify an output file" - ;; - *.$libext) linkmode=oldlib ;; - *.lo | *.$objext) linkmode=obj ;; - *.la) linkmode=lib ;; - *) linkmode=prog ;; # Anything else should be a program. - esac - - specialdeplibs= - - libs= - # Find all interdependent deplibs by searching for libraries - # that are linked more than once (e.g. -la -lb -la) - for deplib in $deplibs; do - if $opt_preserve_dup_deps ; then - case "$libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append libs " $deplib" - done - - if test "$linkmode" = lib; then - libs="$predeps $libs $compiler_lib_search_path $postdeps" - - # Compute libraries that are listed more than once in $predeps - # $postdeps and mark them as special (i.e., whose duplicates are - # not to be eliminated). - pre_post_deps= - if $opt_duplicate_compiler_generated_deps; then - for pre_post_dep in $predeps $postdeps; do - case "$pre_post_deps " in - *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; - esac - func_append pre_post_deps " $pre_post_dep" - done - fi - pre_post_deps= - fi - - deplibs= - newdependency_libs= - newlib_search_path= - need_relink=no # whether we're linking any uninstalled libtool libraries - notinst_deplibs= # not-installed libtool libraries - notinst_path= # paths that contain not-installed libtool libraries - - case $linkmode in - lib) - passes="conv dlpreopen link" - for file in $dlfiles $dlprefiles; do - case $file in - *.la) ;; - *) - func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" - ;; - esac - done - ;; - prog) - compile_deplibs= - finalize_deplibs= - alldeplibs=no - newdlfiles= - newdlprefiles= - passes="conv scan dlopen dlpreopen link" - ;; - *) passes="conv" - ;; - esac - - for pass in $passes; do - # The preopen pass in lib mode reverses $deplibs; put it back here - # so that -L comes before libs that need it for instance... - if test "$linkmode,$pass" = "lib,link"; then - ## FIXME: Find the place where the list is rebuilt in the wrong - ## order, and fix it there properly - tmp_deplibs= - for deplib in $deplibs; do - tmp_deplibs="$deplib $tmp_deplibs" - done - deplibs="$tmp_deplibs" - fi - - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan"; then - libs="$deplibs" - deplibs= - fi - if test "$linkmode" = prog; then - case $pass in - dlopen) libs="$dlfiles" ;; - dlpreopen) libs="$dlprefiles" ;; - link) - libs="$deplibs %DEPLIBS%" - test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" - ;; - esac - fi - if test "$linkmode,$pass" = "lib,dlpreopen"; then - # Collect and forward deplibs of preopened libtool libs - for lib in $dlprefiles; do - # Ignore non-libtool-libs - dependency_libs= - func_resolve_sysroot "$lib" - case $lib in - *.la) func_source "$func_resolve_sysroot_result" ;; - esac - - # Collect preopened libtool deplibs, except any this library - # has declared as weak libs - for deplib in $dependency_libs; do - func_basename "$deplib" - deplib_base=$func_basename_result - case " $weak_libs " in - *" $deplib_base "*) ;; - *) func_append deplibs " $deplib" ;; - esac - done - done - libs="$dlprefiles" - fi - if test "$pass" = dlopen; then - # Collect dlpreopened libraries - save_deplibs="$deplibs" - deplibs= - fi - - for deplib in $libs; do - lib= - found=no - case $deplib in - -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append compiler_flags " $deplib" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -l*) - if test "$linkmode" != lib && test "$linkmode" != prog; then - func_warning "\`-l' is ignored for archives/objects" - continue - fi - func_stripname '-l' '' "$deplib" - name=$func_stripname_result - if test "$linkmode" = lib; then - searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" - else - searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" - fi - for searchdir in $searchdirs; do - for search_ext in .la $std_shrext .so .a; do - # Search the libtool library - lib="$searchdir/lib${name}${search_ext}" - if test -f "$lib"; then - if test "$search_ext" = ".la"; then - found=yes - else - found=no - fi - break 2 - fi - done - done - if test "$found" != yes; then - # deplib doesn't seem to be a libtool library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - else # deplib is a libtool library - # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, - # We need to do some special things here, and not later. - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $deplib "*) - if func_lalib_p "$lib"; then - library_names= - old_library= - func_source "$lib" - for l in $old_library $library_names; do - ll="$l" - done - if test "X$ll" = "X$old_library" ; then # only static version available - found=no - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - lib=$ladir/$old_library - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" - fi - continue - fi - fi - ;; - *) ;; - esac - fi - fi - ;; # -l - *.ltframework) - if test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - deplibs="$deplib $deplibs" - if test "$linkmode" = lib ; then - case "$new_inherited_linker_flags " in - *" $deplib "*) ;; - * ) func_append new_inherited_linker_flags " $deplib" ;; - esac - fi - fi - continue - ;; - -L*) - case $linkmode in - lib) - deplibs="$deplib $deplibs" - test "$pass" = conv && continue - newdependency_libs="$deplib $newdependency_libs" - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - prog) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - if test "$pass" = scan; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - *) - func_warning "\`-L' is ignored for archives/objects" - ;; - esac # linkmode - continue - ;; # -L - -R*) - if test "$pass" = link; then - func_stripname '-R' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - dir=$func_resolve_sysroot_result - # Make sure the xrpath contains only unique directories. - case "$xrpath " in - *" $dir "*) ;; - *) func_append xrpath " $dir" ;; - esac - fi - deplibs="$deplib $deplibs" - continue - ;; - *.la) - func_resolve_sysroot "$deplib" - lib=$func_resolve_sysroot_result - ;; - *.$libext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - continue - fi - case $linkmode in - lib) - # Linking convenience modules into shared libraries is allowed, - # but linking other static libraries is non-portable. - case " $dlpreconveniencelibs " in - *" $deplib "*) ;; - *) - valid_a_lib=no - case $deplibs_check_method in - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ - | $EGREP "$match_pattern_regex" > /dev/null; then - valid_a_lib=yes - fi - ;; - pass_all) - valid_a_lib=yes - ;; - esac - if test "$valid_a_lib" != yes; then - echo - $ECHO "*** Warning: Trying to link with static lib archive $deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because the file extensions .$libext of this argument makes me believe" - echo "*** that it is just a static archive that I should not use here." - else - echo - $ECHO "*** Warning: Linking the shared library $output against the" - $ECHO "*** static library $deplib is not portable!" - deplibs="$deplib $deplibs" - fi - ;; - esac - continue - ;; - prog) - if test "$pass" != link; then - deplibs="$deplib $deplibs" - else - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - fi - continue - ;; - esac # linkmode - ;; # *.$libext - *.lo | *.$objext) - if test "$pass" = conv; then - deplibs="$deplib $deplibs" - elif test "$linkmode" = prog; then - if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then - # If there is no dlopen support or we're linking statically, - # we need to preload. - func_append newdlprefiles " $deplib" - compile_deplibs="$deplib $compile_deplibs" - finalize_deplibs="$deplib $finalize_deplibs" - else - func_append newdlfiles " $deplib" - fi - fi - continue - ;; - %DEPLIBS%) - alldeplibs=yes - continue - ;; - esac # case $deplib - - if test "$found" = yes || test -f "$lib"; then : - else - func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" - fi - - # Check to see that this really is a libtool archive. - func_lalib_unsafe_p "$lib" \ - || func_fatal_error "\`$lib' is not a valid libtool archive" - - func_dirname "$lib" "" "." - ladir="$func_dirname_result" - - dlname= - dlopen= - dlpreopen= - libdir= - library_names= - old_library= - inherited_linker_flags= - # If the library was installed with an old release of libtool, - # it will not redefine variables installed, or shouldnotlink - installed=yes - shouldnotlink=no - avoidtemprpath= - - - # Read the .la file - func_source "$lib" - - # Convert "-framework foo" to "foo.ltframework" - if test -n "$inherited_linker_flags"; then - tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` - for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do - case " $new_inherited_linker_flags " in - *" $tmp_inherited_linker_flag "*) ;; - *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; - esac - done - fi - dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - if test "$linkmode,$pass" = "lib,link" || - test "$linkmode,$pass" = "prog,scan" || - { test "$linkmode" != prog && test "$linkmode" != lib; }; then - test -n "$dlopen" && func_append dlfiles " $dlopen" - test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" - fi - - if test "$pass" = conv; then - # Only check for convenience libraries - deplibs="$lib $deplibs" - if test -z "$libdir"; then - if test -z "$old_library"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - # It is a libtool convenience library, so add in its objects. - func_append convenience " $ladir/$objdir/$old_library" - func_append old_convenience " $ladir/$objdir/$old_library" - tmp_libs= - for deplib in $dependency_libs; do - deplibs="$deplib $deplibs" - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done - elif test "$linkmode" != prog && test "$linkmode" != lib; then - func_fatal_error "\`$lib' is not a convenience library" - fi - continue - fi # $pass = conv - - - # Get the name of the library we link against. - linklib= - if test -n "$old_library" && - { test "$prefer_static_libs" = yes || - test "$prefer_static_libs,$installed" = "built,no"; }; then - linklib=$old_library - else - for l in $old_library $library_names; do - linklib="$l" - done - fi - if test -z "$linklib"; then - func_fatal_error "cannot find name of link library for \`$lib'" - fi - - # This library was specified with -dlopen. - if test "$pass" = dlopen; then - if test -z "$libdir"; then - func_fatal_error "cannot -dlopen a convenience library: \`$lib'" - fi - if test -z "$dlname" || - test "$dlopen_support" != yes || - test "$build_libtool_libs" = no; then - # If there is no dlname, no dlopen support or we're linking - # statically, we need to preload. We also need to preload any - # dependent libraries so libltdl's deplib preloader doesn't - # bomb out in the load deplibs phase. - func_append dlprefiles " $lib $dependency_libs" - else - func_append newdlfiles " $lib" - fi - continue - fi # $pass = dlopen - - # We need an absolute path. - case $ladir in - [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; - *) - abs_ladir=`cd "$ladir" && pwd` - if test -z "$abs_ladir"; then - func_warning "cannot determine absolute directory name of \`$ladir'" - func_warning "passing it literally to the linker, although it might fail" - abs_ladir="$ladir" - fi - ;; - esac - func_basename "$lib" - laname="$func_basename_result" - - # Find the relevant object directory and library name. - if test "X$installed" = Xyes; then - if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then - func_warning "library \`$lib' was moved." - dir="$ladir" - absdir="$abs_ladir" - libdir="$abs_ladir" - else - dir="$lt_sysroot$libdir" - absdir="$lt_sysroot$libdir" - fi - test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes - else - if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then - dir="$ladir" - absdir="$abs_ladir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - else - dir="$ladir/$objdir" - absdir="$abs_ladir/$objdir" - # Remove this search path later - func_append notinst_path " $abs_ladir" - fi - fi # $installed = yes - func_stripname 'lib' '.la' "$laname" - name=$func_stripname_result - - # This library was specified with -dlpreopen. - if test "$pass" = dlpreopen; then - if test -z "$libdir" && test "$linkmode" = prog; then - func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" - fi - case "$host" in - # special handling for platforms with PE-DLLs. - *cygwin* | *mingw* | *cegcc* ) - # Linker will automatically link against shared library if both - # static and shared are present. Therefore, ensure we extract - # symbols from the import library if a shared library is present - # (otherwise, the dlopen module name will be incorrect). We do - # this by putting the import library name into $newdlprefiles. - # We recover the dlopen module name by 'saving' the la file - # name in a special purpose variable, and (later) extracting the - # dlname from the la file. - if test -n "$dlname"; then - func_tr_sh "$dir/$linklib" - eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" - func_append newdlprefiles " $dir/$linklib" - else - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - fi - ;; - * ) - # Prefer using a static library (so that no silly _DYNAMIC symbols - # are required to link). - if test -n "$old_library"; then - func_append newdlprefiles " $dir/$old_library" - # Keep a list of preopened convenience libraries to check - # that they are being used correctly in the link pass. - test -z "$libdir" && \ - func_append dlpreconveniencelibs " $dir/$old_library" - # Otherwise, use the dlname, so that lt_dlopen finds it. - elif test -n "$dlname"; then - func_append newdlprefiles " $dir/$dlname" - else - func_append newdlprefiles " $dir/$linklib" - fi - ;; - esac - fi # $pass = dlpreopen - - if test -z "$libdir"; then - # Link the convenience library - if test "$linkmode" = lib; then - deplibs="$dir/$old_library $deplibs" - elif test "$linkmode,$pass" = "prog,link"; then - compile_deplibs="$dir/$old_library $compile_deplibs" - finalize_deplibs="$dir/$old_library $finalize_deplibs" - else - deplibs="$lib $deplibs" # used for prog,scan pass - fi - continue - fi - - - if test "$linkmode" = prog && test "$pass" != link; then - func_append newlib_search_path " $ladir" - deplibs="$lib $deplibs" - - linkalldeplibs=no - if test "$link_all_deplibs" != no || test -z "$library_names" || - test "$build_libtool_libs" = no; then - linkalldeplibs=yes - fi - - tmp_libs= - for deplib in $dependency_libs; do - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result" - func_append newlib_search_path " $func_resolve_sysroot_result" - ;; - esac - # Need to link against all dependency_libs? - if test "$linkalldeplibs" = yes; then - deplibs="$deplib $deplibs" - else - # Need to hardcode shared library paths - # or/and link against static libraries - newdependency_libs="$deplib $newdependency_libs" - fi - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $deplib "*) func_append specialdeplibs " $deplib" ;; - esac - fi - func_append tmp_libs " $deplib" - done # for deplib - continue - fi # $linkmode = prog... - - if test "$linkmode,$pass" = "prog,link"; then - if test -n "$library_names" && - { { test "$prefer_static_libs" = no || - test "$prefer_static_libs,$installed" = "built,yes"; } || - test -z "$old_library"; }; then - # We need to hardcode the library path - if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath:" in - *"$absdir:"*) ;; - *) func_append temp_rpath "$absdir:" ;; - esac - fi - - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi # $linkmode,$pass = prog,link... - - if test "$alldeplibs" = yes && - { test "$deplibs_check_method" = pass_all || - { test "$build_libtool_libs" = yes && - test -n "$library_names"; }; }; then - # We only need to search for static libraries - continue - fi - fi - - link_static=no # Whether the deplib will be linked statically - use_static_libs=$prefer_static_libs - if test "$use_static_libs" = built && test "$installed" = yes; then - use_static_libs=no - fi - if test -n "$library_names" && - { test "$use_static_libs" = no || test -z "$old_library"; }; then - case $host in - *cygwin* | *mingw* | *cegcc*) - # No point in relinking DLLs because paths are not encoded - func_append notinst_deplibs " $lib" - need_relink=no - ;; - *) - if test "$installed" = no; then - func_append notinst_deplibs " $lib" - need_relink=yes - fi - ;; - esac - # This is a shared library - - # Warn about portability, can't link against -module's on some - # systems (darwin). Don't bleat about dlopened modules though! - dlopenmodule="" - for dlpremoduletest in $dlprefiles; do - if test "X$dlpremoduletest" = "X$lib"; then - dlopenmodule="$dlpremoduletest" - break - fi - done - if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then - echo - if test "$linkmode" = prog; then - $ECHO "*** Warning: Linking the executable $output against the loadable module" - else - $ECHO "*** Warning: Linking the shared library $output against the loadable module" - fi - $ECHO "*** $linklib is not portable!" - fi - if test "$linkmode" = lib && - test "$hardcode_into_libs" = yes; then - # Hardcode the library path. - # Skip directories that are in the system default run-time - # search path. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) func_append compile_rpath " $absdir" ;; - esac - ;; - esac - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - ;; - esac - fi - - if test -n "$old_archive_from_expsyms_cmds"; then - # figure out the soname - set dummy $library_names - shift - realname="$1" - shift - libname=`eval "\\$ECHO \"$libname_spec\""` - # use dlname if we got it. it's perfectly good, no? - if test -n "$dlname"; then - soname="$dlname" - elif test -n "$soname_spec"; then - # bleh windows - case $host in - *cygwin* | mingw* | *cegcc*) - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - esac - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - - # Make a new name for the extract_expsyms_cmds to use - soroot="$soname" - func_basename "$soroot" - soname="$func_basename_result" - func_stripname 'lib' '.dll' "$soname" - newlib=libimp-$func_stripname_result.a - - # If the library has no export list, then create one now - if test -f "$output_objdir/$soname-def"; then : - else - func_verbose "extracting exported symbol list from \`$soname'" - func_execute_cmds "$extract_expsyms_cmds" 'exit $?' - fi - - # Create $newlib - if test -f "$output_objdir/$newlib"; then :; else - func_verbose "generating import library for \`$soname'" - func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' - fi - # make sure the library variables are pointing to the new library - dir=$output_objdir - linklib=$newlib - fi # test -n "$old_archive_from_expsyms_cmds" - - if test "$linkmode" = prog || test "$opt_mode" != relink; then - add_shlibpath= - add_dir= - add= - lib_linked=yes - case $hardcode_action in - immediate | unsupported) - if test "$hardcode_direct" = no; then - add="$dir/$linklib" - case $host in - *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; - *-*-sysv4*uw2*) add_dir="-L$dir" ;; - *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ - *-*-unixware7*) add_dir="-L$dir" ;; - *-*-darwin* ) - # if the lib is a (non-dlopened) module then we can not - # link against it, someone is ignoring the earlier warnings - if /usr/bin/file -L $add 2> /dev/null | - $GREP ": [^:]* bundle" >/dev/null ; then - if test "X$dlopenmodule" != "X$lib"; then - $ECHO "*** Warning: lib $linklib is a module, not a shared library" - if test -z "$old_library" ; then - echo - echo "*** And there doesn't seem to be a static archive available" - echo "*** The link will probably fail, sorry" - else - add="$dir/$old_library" - fi - elif test -n "$old_library"; then - add="$dir/$old_library" - fi - fi - esac - elif test "$hardcode_minus_L" = no; then - case $host in - *-*-sunos*) add_shlibpath="$dir" ;; - esac - add_dir="-L$dir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = no; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - relink) - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$dir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$dir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - add_shlibpath="$dir" - add="-l$name" - else - lib_linked=no - fi - ;; - *) lib_linked=no ;; - esac - - if test "$lib_linked" != yes; then - func_fatal_configuration "unsupported hardcode properties" - fi - - if test -n "$add_shlibpath"; then - case :$compile_shlibpath: in - *":$add_shlibpath:"*) ;; - *) func_append compile_shlibpath "$add_shlibpath:" ;; - esac - fi - if test "$linkmode" = prog; then - test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" - test -n "$add" && compile_deplibs="$add $compile_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - if test "$hardcode_direct" != yes && - test "$hardcode_minus_L" != yes && - test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - fi - fi - fi - - if test "$linkmode" = prog || test "$opt_mode" = relink; then - add_shlibpath= - add_dir= - add= - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes && - test "$hardcode_direct_absolute" = no; then - add="$libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - add_dir="-L$libdir" - add="-l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case :$finalize_shlibpath: in - *":$libdir:"*) ;; - *) func_append finalize_shlibpath "$libdir:" ;; - esac - add="-l$name" - elif test "$hardcode_automatic" = yes; then - if test -n "$inst_prefix_dir" && - test -f "$inst_prefix_dir$libdir/$linklib" ; then - add="$inst_prefix_dir$libdir/$linklib" - else - add="$libdir/$linklib" - fi - else - # We cannot seem to hardcode it, guess we'll fake it. - add_dir="-L$libdir" - # Try looking first in the location we're being installed to. - if test -n "$inst_prefix_dir"; then - case $libdir in - [\\/]*) - func_append add_dir " -L$inst_prefix_dir$libdir" - ;; - esac - fi - add="-l$name" - fi - - if test "$linkmode" = prog; then - test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" - test -n "$add" && finalize_deplibs="$add $finalize_deplibs" - else - test -n "$add_dir" && deplibs="$add_dir $deplibs" - test -n "$add" && deplibs="$add $deplibs" - fi - fi - elif test "$linkmode" = prog; then - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_deplibs="$dir/$linklib $compile_deplibs" - finalize_deplibs="$dir/$linklib $finalize_deplibs" - else - compile_deplibs="-l$name -L$dir $compile_deplibs" - finalize_deplibs="-l$name -L$dir $finalize_deplibs" - fi - elif test "$build_libtool_libs" = yes; then - # Not a shared library - if test "$deplibs_check_method" != pass_all; then - # We're trying link a shared library against a static one - # but the system doesn't support it. - - # Just print a warning and add the library to dependency_libs so - # that the program can be linked against the static library. - echo - $ECHO "*** Warning: This system can not link to static lib archive $lib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have." - if test "$module" = yes; then - echo "*** But as you try to build a module library, libtool will still create " - echo "*** a static module, that should work as long as the dlopening application" - echo "*** is linked with the -dlopen flag to resolve symbols at runtime." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - else - deplibs="$dir/$old_library $deplibs" - link_static=yes - fi - fi # link shared/static library? - - if test "$linkmode" = lib; then - if test -n "$dependency_libs" && - { test "$hardcode_into_libs" != yes || - test "$build_old_libs" = yes || - test "$link_static" = yes; }; then - # Extract -R from dependency_libs - temp_deplibs= - for libdir in $dependency_libs; do - case $libdir in - -R*) func_stripname '-R' '' "$libdir" - temp_xrpath=$func_stripname_result - case " $xrpath " in - *" $temp_xrpath "*) ;; - *) func_append xrpath " $temp_xrpath";; - esac;; - *) func_append temp_deplibs " $libdir";; - esac - done - dependency_libs="$temp_deplibs" - fi - - func_append newlib_search_path " $absdir" - # Link against this library - test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" - # ... and its dependency_libs - tmp_libs= - for deplib in $dependency_libs; do - newdependency_libs="$deplib $newdependency_libs" - case $deplib in - -L*) func_stripname '-L' '' "$deplib" - func_resolve_sysroot "$func_stripname_result";; - *) func_resolve_sysroot "$deplib" ;; - esac - if $opt_preserve_dup_deps ; then - case "$tmp_libs " in - *" $func_resolve_sysroot_result "*) - func_append specialdeplibs " $func_resolve_sysroot_result" ;; - esac - fi - func_append tmp_libs " $func_resolve_sysroot_result" - done - - if test "$link_all_deplibs" != no; then - # Add the search paths of all dependency libraries - for deplib in $dependency_libs; do - path= - case $deplib in - -L*) path="$deplib" ;; - *.la) - func_resolve_sysroot "$deplib" - deplib=$func_resolve_sysroot_result - func_dirname "$deplib" "" "." - dir=$func_dirname_result - # We need an absolute path. - case $dir in - [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - func_warning "cannot determine absolute directory name of \`$dir'" - absdir="$dir" - fi - ;; - esac - if $GREP "^installed=no" $deplib > /dev/null; then - case $host in - *-*-darwin*) - depdepl= - eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` - if test -n "$deplibrary_names" ; then - for tmp in $deplibrary_names ; do - depdepl=$tmp - done - if test -f "$absdir/$objdir/$depdepl" ; then - depdepl="$absdir/$objdir/$depdepl" - darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - if test -z "$darwin_install_name"; then - darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` - fi - func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" - func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" - path= - fi - fi - ;; - *) - path="-L$absdir/$objdir" - ;; - esac - else - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - test "$absdir" != "$libdir" && \ - func_warning "\`$deplib' seems to be moved" - - path="-L$absdir" - fi - ;; - esac - case " $deplibs " in - *" $path "*) ;; - *) deplibs="$path $deplibs" ;; - esac - done - fi # link_all_deplibs != no - fi # linkmode = lib - done # for deplib in $libs - if test "$pass" = link; then - if test "$linkmode" = "prog"; then - compile_deplibs="$new_inherited_linker_flags $compile_deplibs" - finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" - else - compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - fi - fi - dependency_libs="$newdependency_libs" - if test "$pass" = dlpreopen; then - # Link the dlpreopened libraries before other libraries - for deplib in $save_deplibs; do - deplibs="$deplib $deplibs" - done - fi - if test "$pass" != dlopen; then - if test "$pass" != conv; then - # Make sure lib_search_path contains only unique directories. - lib_search_path= - for dir in $newlib_search_path; do - case "$lib_search_path " in - *" $dir "*) ;; - *) func_append lib_search_path " $dir" ;; - esac - done - newlib_search_path= - fi - - if test "$linkmode,$pass" != "prog,link"; then - vars="deplibs" - else - vars="compile_deplibs finalize_deplibs" - fi - for var in $vars dependency_libs; do - # Add libraries to $var in reverse order - eval tmp_libs=\"\$$var\" - new_libs= - for deplib in $tmp_libs; do - # FIXME: Pedantically, this is the right thing to do, so - # that some nasty dependency loop isn't accidentally - # broken: - #new_libs="$deplib $new_libs" - # Pragmatically, this seems to cause very few problems in - # practice: - case $deplib in - -L*) new_libs="$deplib $new_libs" ;; - -R*) ;; - *) - # And here is the reason: when a library appears more - # than once as an explicit dependence of a library, or - # is implicitly linked in more than once by the - # compiler, it is considered special, and multiple - # occurrences thereof are not removed. Compare this - # with having the same library being listed as a - # dependency of multiple other libraries: in this case, - # we know (pedantically, we assume) the library does not - # need to be listed more than once, so we keep only the - # last copy. This is not always right, but it is rare - # enough that we require users that really mean to play - # such unportable linking tricks to link the library - # using -Wl,-lname, so that libtool does not consider it - # for duplicate removal. - case " $specialdeplibs " in - *" $deplib "*) new_libs="$deplib $new_libs" ;; - *) - case " $new_libs " in - *" $deplib "*) ;; - *) new_libs="$deplib $new_libs" ;; - esac - ;; - esac - ;; - esac - done - tmp_libs= - for deplib in $new_libs; do - case $deplib in - -L*) - case " $tmp_libs " in - *" $deplib "*) ;; - *) func_append tmp_libs " $deplib" ;; - esac - ;; - *) func_append tmp_libs " $deplib" ;; - esac - done - eval $var=\"$tmp_libs\" - done # for var - fi - # Last step: remove runtime libs from dependency_libs - # (they stay in deplibs) - tmp_libs= - for i in $dependency_libs ; do - case " $predeps $postdeps $compiler_lib_search_path " in - *" $i "*) - i="" - ;; - esac - if test -n "$i" ; then - func_append tmp_libs " $i" - fi - done - dependency_libs=$tmp_libs - done # for pass - if test "$linkmode" = prog; then - dlfiles="$newdlfiles" - fi - if test "$linkmode" = prog || test "$linkmode" = lib; then - dlprefiles="$newdlprefiles" - fi - - case $linkmode in - oldlib) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for archives" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for archives" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for archives" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for archives" - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for archives" - - test -n "$release" && \ - func_warning "\`-release' is ignored for archives" - - test -n "$export_symbols$export_symbols_regex" && \ - func_warning "\`-export-symbols' is ignored for archives" - - # Now set the variables for building old libraries. - build_libtool_libs=no - oldlibs="$output" - func_append objs "$old_deplibs" - ;; - - lib) - # Make sure we only generate libraries of the form `libNAME.la'. - case $outputname in - lib*) - func_stripname 'lib' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - ;; - *) - test "$module" = no && \ - func_fatal_help "libtool library \`$output' must begin with \`lib'" - - if test "$need_lib_prefix" != no; then - # Add the "lib" prefix for modules if required - func_stripname '' '.la' "$outputname" - name=$func_stripname_result - eval shared_ext=\"$shrext_cmds\" - eval libname=\"$libname_spec\" - else - func_stripname '' '.la' "$outputname" - libname=$func_stripname_result - fi - ;; - esac - - if test -n "$objs"; then - if test "$deplibs_check_method" != pass_all; then - func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" - else - echo - $ECHO "*** Warning: Linking the shared library $output against the non-libtool" - $ECHO "*** objects $objs is not portable!" - func_append libobjs " $objs" - fi - fi - - test "$dlself" != no && \ - func_warning "\`-dlopen self' is ignored for libtool libraries" - - set dummy $rpath - shift - test "$#" -gt 1 && \ - func_warning "ignoring multiple \`-rpath's for a libtool library" - - install_libdir="$1" - - oldlibs= - if test -z "$rpath"; then - if test "$build_libtool_libs" = yes; then - # Building a libtool convenience library. - # Some compilers have problems with a `.al' extension so - # convenience libraries should have the same extension an - # archive normally would. - oldlibs="$output_objdir/$libname.$libext $oldlibs" - build_libtool_libs=convenience - build_old_libs=yes - fi - - test -n "$vinfo" && \ - func_warning "\`-version-info/-version-number' is ignored for convenience libraries" - - test -n "$release" && \ - func_warning "\`-release' is ignored for convenience libraries" - else - - # Parse the version information argument. - save_ifs="$IFS"; IFS=':' - set dummy $vinfo 0 0 0 - shift - IFS="$save_ifs" - - test -n "$7" && \ - func_fatal_help "too many parameters to \`-version-info'" - - # convert absolute version numbers to libtool ages - # this retains compatibility with .la files and attempts - # to make the code below a bit more comprehensible - - case $vinfo_number in - yes) - number_major="$1" - number_minor="$2" - number_revision="$3" - # - # There are really only two kinds -- those that - # use the current revision as the major version - # and those that subtract age and use age as - # a minor version. But, then there is irix - # which has an extra 1 added just for fun - # - case $version_type in - darwin|linux|osf|windows|none) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_revision" - ;; - freebsd-aout|freebsd-elf|qnx|sunos) - current="$number_major" - revision="$number_minor" - age="0" - ;; - irix|nonstopux) - func_arith $number_major + $number_minor - current=$func_arith_result - age="$number_minor" - revision="$number_minor" - lt_irix_increment=no - ;; - *) - func_fatal_configuration "$modename: unknown library version type \`$version_type'" - ;; - esac - ;; - no) - current="$1" - revision="$2" - age="$3" - ;; - esac - - # Check that each of the things are valid numbers. - case $current in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "CURRENT \`$current' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $revision in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "REVISION \`$revision' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - case $age in - 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; - *) - func_error "AGE \`$age' must be a nonnegative integer" - func_fatal_error "\`$vinfo' is not valid version information" - ;; - esac - - if test "$age" -gt "$current"; then - func_error "AGE \`$age' is greater than the current interface number \`$current'" - func_fatal_error "\`$vinfo' is not valid version information" - fi - - # Calculate the version variables. - major= - versuffix= - verstring= - case $version_type in - none) ;; - - darwin) - # Like Linux, but with the current version available in - # verstring for coding it into the library header - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - # Darwin ld doesn't like 0 for these options... - func_arith $current + 1 - minor_current=$func_arith_result - xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" - verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" - ;; - - freebsd-aout) - major=".$current" - versuffix=".$current.$revision"; - ;; - - freebsd-elf) - major=".$current" - versuffix=".$current" - ;; - - irix | nonstopux) - if test "X$lt_irix_increment" = "Xno"; then - func_arith $current - $age - else - func_arith $current - $age + 1 - fi - major=$func_arith_result - - case $version_type in - nonstopux) verstring_prefix=nonstopux ;; - *) verstring_prefix=sgi ;; - esac - verstring="$verstring_prefix$major.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$revision - while test "$loop" -ne 0; do - func_arith $revision - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring_prefix$major.$iface:$verstring" - done - - # Before this point, $major must not contain `.'. - major=.$major - versuffix="$major.$revision" - ;; - - linux) - func_arith $current - $age - major=.$func_arith_result - versuffix="$major.$age.$revision" - ;; - - osf) - func_arith $current - $age - major=.$func_arith_result - versuffix=".$current.$age.$revision" - verstring="$current.$age.$revision" - - # Add in all the interfaces that we are compatible with. - loop=$age - while test "$loop" -ne 0; do - func_arith $current - $loop - iface=$func_arith_result - func_arith $loop - 1 - loop=$func_arith_result - verstring="$verstring:${iface}.0" - done - - # Make executables depend on our current version. - func_append verstring ":${current}.0" - ;; - - qnx) - major=".$current" - versuffix=".$current" - ;; - - sunos) - major=".$current" - versuffix=".$current.$revision" - ;; - - windows) - # Use '-' rather than '.', since we only want one - # extension on DOS 8.3 filesystems. - func_arith $current - $age - major=$func_arith_result - versuffix="-$major" - ;; - - *) - func_fatal_configuration "unknown library version type \`$version_type'" - ;; - esac - - # Clear the version info if we defaulted, and they specified a release. - if test -z "$vinfo" && test -n "$release"; then - major= - case $version_type in - darwin) - # we can't check for "0.0" in archive_cmds due to quoting - # problems, so we reset it completely - verstring= - ;; - *) - verstring="0.0" - ;; - esac - if test "$need_version" = no; then - versuffix= - else - versuffix=".0.0" - fi - fi - - # Remove version info from name if versioning should be avoided - if test "$avoid_version" = yes && test "$need_version" = no; then - major= - versuffix= - verstring="" - fi - - # Check to see if the archive will have undefined symbols. - if test "$allow_undefined" = yes; then - if test "$allow_undefined_flag" = unsupported; then - func_warning "undefined symbols not allowed in $host shared libraries" - build_libtool_libs=no - build_old_libs=yes - fi - else - # Don't allow undefined symbols. - allow_undefined_flag="$no_undefined_flag" - fi - - fi - - func_generate_dlsyms "$libname" "$libname" "yes" - func_append libobjs " $symfileobj" - test "X$libobjs" = "X " && libobjs= - - if test "$opt_mode" != relink; then - # Remove our outputs, but don't remove object files since they - # may have been created when compiling PIC objects. - removelist= - tempremovelist=`$ECHO "$output_objdir/*"` - for p in $tempremovelist; do - case $p in - *.$objext | *.gcno) - ;; - $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) - if test "X$precious_files_regex" != "X"; then - if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 - then - continue - fi - fi - func_append removelist " $p" - ;; - *) ;; - esac - done - test -n "$removelist" && \ - func_show_eval "${RM}r \$removelist" - fi - - # Now set the variables for building old libraries. - if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then - func_append oldlibs " $output_objdir/$libname.$libext" - - # Transform .lo files to .o files. - oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` - fi - - # Eliminate all temporary directories. - #for path in $notinst_path; do - # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` - # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` - # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` - #done - - if test -n "$xrpath"; then - # If the user specified any rpath flags, then add them. - temp_xrpath= - for libdir in $xrpath; do - func_replace_sysroot "$libdir" - func_append temp_xrpath " -R$func_replace_sysroot_result" - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then - dependency_libs="$temp_xrpath $dependency_libs" - fi - fi - - # Make sure dlfiles contains only unique files that won't be dlpreopened - old_dlfiles="$dlfiles" - dlfiles= - for lib in $old_dlfiles; do - case " $dlprefiles $dlfiles " in - *" $lib "*) ;; - *) func_append dlfiles " $lib" ;; - esac - done - - # Make sure dlprefiles contains only unique files - old_dlprefiles="$dlprefiles" - dlprefiles= - for lib in $old_dlprefiles; do - case "$dlprefiles " in - *" $lib "*) ;; - *) func_append dlprefiles " $lib" ;; - esac - done - - if test "$build_libtool_libs" = yes; then - if test -n "$rpath"; then - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) - # these systems don't actually have a c library (as such)! - ;; - *-*-rhapsody* | *-*-darwin1.[012]) - # Rhapsody C library is in the System framework - func_append deplibs " System.ltframework" - ;; - *-*-netbsd*) - # Don't link with libc until the a.out ld.so is fixed. - ;; - *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) - # Do not include libc due to us having libc/libc_r. - ;; - *-*-sco3.2v5* | *-*-sco5v6*) - # Causes problems with __ctype - ;; - *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) - # Compiler inserts libc in the correct place for threads to work - ;; - *) - # Add libc to deplibs on all other systems if necessary. - if test "$build_libtool_need_lc" = "yes"; then - func_append deplibs " -lc" - fi - ;; - esac - fi - - # Transform deplibs into only deplibs that can be linked in shared. - name_save=$name - libname_save=$libname - release_save=$release - versuffix_save=$versuffix - major_save=$major - # I'm not sure if I'm treating the release correctly. I think - # release should show up in the -l (ie -lgmp5) so we don't want to - # add it in twice. Is that correct? - release="" - versuffix="" - major="" - newdeplibs= - droppeddeps=no - case $deplibs_check_method in - pass_all) - # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behavior. - newdeplibs=$deplibs - ;; - test_compile) - # This code stresses the "libraries are programs" paradigm to its - # limits. Maybe even breaks it. We compile a program, linking it - # against the deplibs as a proxy for the library. Then we can check - # whether they linked in statically or dynamically with ldd. - $opt_dry_run || $RM conftest.c - cat > conftest.c </dev/null` - $nocaseglob - else - potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` - fi - for potent_lib in $potential_libs; do - # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null | - $GREP " -> " >/dev/null; then - continue - fi - # The statement above tries to avoid entering an - # endless loop below, in case of cyclic links. - # We might still enter an endless loop, since a link - # loop can be closed while we follow links, - # but so what? - potlib="$potent_lib" - while test -h "$potlib" 2>/dev/null; do - potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` - case $potliblink in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; - *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; - esac - done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | - $SED -e 10q | - $EGREP "$file_magic_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for file magic test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a file magic. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - match_pattern*) - set dummy $deplibs_check_method; shift - match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` - for a_deplib in $deplibs; do - case $a_deplib in - -l*) - func_stripname -l '' "$a_deplib" - name=$func_stripname_result - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - case " $predeps $postdeps " in - *" $a_deplib "*) - func_append newdeplibs " $a_deplib" - a_deplib="" - ;; - esac - fi - if test -n "$a_deplib" ; then - libname=`eval "\\$ECHO \"$libname_spec\""` - for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do - potential_libs=`ls $i/$libname[.-]* 2>/dev/null` - for potent_lib in $potential_libs; do - potlib="$potent_lib" # see symlink-check above in file_magic test - if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ - $EGREP "$match_pattern_regex" > /dev/null; then - func_append newdeplibs " $a_deplib" - a_deplib="" - break 2 - fi - done - done - fi - if test -n "$a_deplib" ; then - droppeddeps=yes - echo - $ECHO "*** Warning: linker path does not have real file for library $a_deplib." - echo "*** I have the capability to make that library automatically link in when" - echo "*** you link to this library. But I can only do this if you have a" - echo "*** shared version of the library, which you do not appear to have" - echo "*** because I did check the linker path looking for a file starting" - if test -z "$potlib" ; then - $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" - else - $ECHO "*** with $libname and none of the candidates passed a file format test" - $ECHO "*** using a regex pattern. Last file checked: $potlib" - fi - fi - ;; - *) - # Add a -L argument. - func_append newdeplibs " $a_deplib" - ;; - esac - done # Gone through all deplibs. - ;; - none | unknown | *) - newdeplibs="" - tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` - if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then - for i in $predeps $postdeps ; do - # can't use Xsed below, because $i might contain '/' - tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` - done - fi - case $tmp_deplibs in - *[!\ \ ]*) - echo - if test "X$deplibs_check_method" = "Xnone"; then - echo "*** Warning: inter-library dependencies are not supported in this platform." - else - echo "*** Warning: inter-library dependencies are not known to be supported." - fi - echo "*** All declared inter-library dependencies are being dropped." - droppeddeps=yes - ;; - esac - ;; - esac - versuffix=$versuffix_save - major=$major_save - release=$release_save - libname=$libname_save - name=$name_save - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library with the System framework - newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - if test "$droppeddeps" = yes; then - if test "$module" = yes; then - echo - echo "*** Warning: libtool could not satisfy all declared inter-library" - $ECHO "*** dependencies of module $libname. Therefore, libtool will create" - echo "*** a static module, that should work as long as the dlopening" - echo "*** application is linked with the -dlopen flag." - if test -z "$global_symbol_pipe"; then - echo - echo "*** However, this would only work if libtool was able to extract symbol" - echo "*** lists from a program, using \`nm' or equivalent, but libtool could" - echo "*** not find such a program. So, this module is probably useless." - echo "*** \`nm' from GNU binutils and a full rebuild may help." - fi - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - else - echo "*** The inter-library dependencies that have been dropped here will be" - echo "*** automatically added whenever a program is linked with this library" - echo "*** or is declared to -dlopen it." - - if test "$allow_undefined" = no; then - echo - echo "*** Since this library must not contain undefined symbols," - echo "*** because either the platform does not support them or" - echo "*** it was explicitly requested with -no-undefined," - echo "*** libtool will only create a static version of it." - if test "$build_old_libs" = no; then - oldlibs="$output_objdir/$libname.$libext" - build_libtool_libs=module - build_old_libs=yes - else - build_libtool_libs=no - fi - fi - fi - fi - # Done checking deplibs! - deplibs=$newdeplibs - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - case $host in - *-*-darwin*) - newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - deplibs="$new_libs" - - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - - # Test again, we may have decided not to build it any more - if test "$build_libtool_libs" = yes; then - if test "$hardcode_into_libs" = yes; then - # Hardcode the library paths - hardcode_libdirs= - dep_rpath= - rpath="$finalize_rpath" - test "$opt_mode" != relink && rpath="$compile_rpath$rpath" - for libdir in $rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - func_replace_sysroot "$libdir" - libdir=$func_replace_sysroot_result - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append dep_rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_apped perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - if test -n "$hardcode_libdir_flag_spec_ld"; then - eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" - else - eval dep_rpath=\"$hardcode_libdir_flag_spec\" - fi - fi - if test -n "$runpath_var" && test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" - fi - test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" - fi - - shlibpath="$finalize_shlibpath" - test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" - if test -n "$shlibpath"; then - eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" - fi - - # Get the real and link names of the library. - eval shared_ext=\"$shrext_cmds\" - eval library_names=\"$library_names_spec\" - set dummy $library_names - shift - realname="$1" - shift - - if test -n "$soname_spec"; then - eval soname=\"$soname_spec\" - else - soname="$realname" - fi - if test -z "$dlname"; then - dlname=$soname - fi - - lib="$output_objdir/$realname" - linknames= - for link - do - func_append linknames " $link" - done - - # Use standard objects if they are pic - test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` - test "X$libobjs" = "X " && libobjs= - - delfiles= - if test -n "$export_symbols" && test -n "$include_expsyms"; then - $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" - export_symbols="$output_objdir/$libname.uexp" - func_append delfiles " $export_symbols" - fi - - orig_export_symbols= - case $host_os in - cygwin* | mingw* | cegcc*) - if test -n "$export_symbols" && test -z "$export_symbols_regex"; then - # exporting using user supplied symfile - if test "x`$SED 1q $export_symbols`" != xEXPORTS; then - # and it's NOT already a .def file. Must figure out - # which of the given symbols are data symbols and tag - # them as such. So, trigger use of export_symbols_cmds. - # export_symbols gets reassigned inside the "prepare - # the list of exported symbols" if statement, so the - # include_expsyms logic still works. - orig_export_symbols="$export_symbols" - export_symbols= - always_export_symbols=yes - fi - fi - ;; - esac - - # Prepare the list of exported symbols - if test -z "$export_symbols"; then - if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - cmds=$export_symbols_cmds - save_ifs="$IFS"; IFS='~' - for cmd1 in $cmds; do - IFS="$save_ifs" - # Take the normal branch if the nm_file_list_spec branch - # doesn't work or if tool conversion is not needed. - case $nm_file_list_spec~$to_tool_file_cmd in - *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) - try_normal_branch=yes - eval cmd=\"$cmd1\" - func_len " $cmd" - len=$func_len_result - ;; - *) - try_normal_branch=no - ;; - esac - if test "$try_normal_branch" = yes \ - && { test "$len" -lt "$max_cmd_len" \ - || test "$max_cmd_len" -le -1; } - then - func_show_eval "$cmd" 'exit $?' - skipped_export=false - elif test -n "$nm_file_list_spec"; then - func_basename "$output" - output_la=$func_basename_result - save_libobjs=$libobjs - save_output=$output - output=${output_objdir}/${output_la}.nm - func_to_tool_file "$output" - libobjs=$nm_file_list_spec$func_to_tool_file_result - func_append delfiles " $output" - func_verbose "creating $NM input file list: $output" - for obj in $save_libobjs; do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > "$output" - eval cmd=\"$cmd1\" - func_show_eval "$cmd" 'exit $?' - output=$save_output - libobjs=$save_libobjs - skipped_export=false - else - # The command line is too long to execute in one step. - func_verbose "using reloadable object file for export list..." - skipped_export=: - # Break out early, otherwise skipped_export may be - # set to false by a later but shorter cmd. - break - fi - done - IFS="$save_ifs" - if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - fi - - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - - tmp_deplibs= - for test_deplib in $deplibs; do - case " $convenience " in - *" $test_deplib "*) ;; - *) - func_append tmp_deplibs " $test_deplib" - ;; - esac - done - deplibs="$tmp_deplibs" - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec" && - test "$compiler_needs_object" = yes && - test -z "$libobjs"; then - # extract the archives, so we have objects to list. - # TODO: could optimize this to just extract one archive. - whole_archive_flag_spec= - fi - if test -n "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - else - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - func_append linker_flags " $flag" - fi - - # Make a backup of the uninstalled library when relinking - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? - fi - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - eval test_cmds=\"$module_expsym_cmds\" - cmds=$module_expsym_cmds - else - eval test_cmds=\"$module_cmds\" - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - eval test_cmds=\"$archive_expsym_cmds\" - cmds=$archive_expsym_cmds - else - eval test_cmds=\"$archive_cmds\" - cmds=$archive_cmds - fi - fi - - if test "X$skipped_export" != "X:" && - func_len " $test_cmds" && - len=$func_len_result && - test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - : - else - # The command line is too long to link in one step, link piecewise - # or, if using GNU ld and skipped_export is not :, use a linker - # script. - - # Save the value of $output and $libobjs because we want to - # use them later. If we have whole_archive_flag_spec, we - # want to use save_libobjs as it was before - # whole_archive_flag_spec was expanded, because we can't - # assume the linker understands whole_archive_flag_spec. - # This may have to be revisited, in case too many - # convenience libraries get linked in and end up exceeding - # the spec. - if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then - save_libobjs=$libobjs - fi - save_output=$output - func_basename "$output" - output_la=$func_basename_result - - # Clear the reloadable object creation command queue and - # initialize k to one. - test_cmds= - concat_cmds= - objlist= - last_robj= - k=1 - - if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then - output=${output_objdir}/${output_la}.lnkscript - func_verbose "creating GNU ld script: $output" - echo 'INPUT (' > $output - for obj in $save_libobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - echo ')' >> $output - func_append delfiles " $output" - func_to_tool_file "$output" - output=$func_to_tool_file_result - elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then - output=${output_objdir}/${output_la}.lnk - func_verbose "creating linker input file list: $output" - : > $output - set x $save_libobjs - shift - firstobj= - if test "$compiler_needs_object" = yes; then - firstobj="$1 " - shift - fi - for obj - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" >> $output - done - func_append delfiles " $output" - func_to_tool_file "$output" - output=$firstobj\"$file_list_spec$func_to_tool_file_result\" - else - if test -n "$save_libobjs"; then - func_verbose "creating reloadable object files..." - output=$output_objdir/$output_la-${k}.$objext - eval test_cmds=\"$reload_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - - # Loop over the list of objects to be linked. - for obj in $save_libobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - if test "X$objlist" = X || - test "$len" -lt "$max_cmd_len"; then - func_append objlist " $obj" - else - # The command $test_cmds is almost too long, add a - # command to the queue. - if test "$k" -eq 1 ; then - # The first file doesn't have a previous command to add. - reload_objs=$objlist - eval concat_cmds=\"$reload_cmds\" - else - # All subsequent reloadable object files will link in - # the last one created. - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" - fi - last_robj=$output_objdir/$output_la-${k}.$objext - func_arith $k + 1 - k=$func_arith_result - output=$output_objdir/$output_la-${k}.$objext - objlist=" $obj" - func_len " $last_robj" - func_arith $len0 + $func_len_result - len=$func_arith_result - fi - done - # Handle the remaining objects by creating one last - # reloadable object file. All subsequent reloadable object - # files will link in the last one created. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - reload_objs="$objlist $last_robj" - eval concat_cmds=\"\${concat_cmds}$reload_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" - fi - func_append delfiles " $output" - - else - output= - fi - - if ${skipped_export-false}; then - func_verbose "generating symbol list for \`$libname.la'" - export_symbols="$output_objdir/$libname.exp" - $opt_dry_run || $RM $export_symbols - libobjs=$output - # Append the command to create the export file. - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" - if test -n "$last_robj"; then - eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" - fi - fi - - test -n "$save_libobjs" && - func_verbose "creating a temporary reloadable object file: $output" - - # Loop through the commands generated above and execute them. - save_ifs="$IFS"; IFS='~' - for cmd in $concat_cmds; do - IFS="$save_ifs" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - if test -n "$export_symbols_regex" && ${skipped_export-false}; then - func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' - func_show_eval '$MV "${export_symbols}T" "$export_symbols"' - fi - fi - - if ${skipped_export-false}; then - if test -n "$export_symbols" && test -n "$include_expsyms"; then - tmp_export_symbols="$export_symbols" - test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" - $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' - fi - - if test -n "$orig_export_symbols"; then - # The given exports_symbols file has to be filtered, so filter it. - func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" - # FIXME: $output_objdir/$libname.filter potentially contains lots of - # 's' commands which not all seds can handle. GNU sed should be fine - # though. Also, the filter scales superlinearly with the number of - # global variables. join(1) would be nice here, but unfortunately - # isn't a blessed tool. - $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter - func_append delfiles " $export_symbols $output_objdir/$libname.filter" - export_symbols=$output_objdir/$libname.def - $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols - fi - fi - - libobjs=$output - # Restore the value of output. - output=$save_output - - if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - test "X$libobjs" = "X " && libobjs= - fi - # Expand the library linking commands again to reset the - # value of $libobjs for piecewise linking. - - # Do each of the archive commands. - if test "$module" = yes && test -n "$module_cmds" ; then - if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then - cmds=$module_expsym_cmds - else - cmds=$module_cmds - fi - else - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then - cmds=$archive_expsym_cmds - else - cmds=$archive_cmds - fi - fi - fi - - if test -n "$delfiles"; then - # Append the command to remove temporary files to $cmds. - eval cmds=\"\$cmds~\$RM $delfiles\" - fi - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append libobjs " $func_extract_archives_result" - test "X$libobjs" = "X " && libobjs= - fi - - save_ifs="$IFS"; IFS='~' - for cmd in $cmds; do - IFS="$save_ifs" - eval cmd=\"$cmd\" - $opt_silent || { - func_quote_for_expand "$cmd" - eval "func_echo $func_quote_for_expand_result" - } - $opt_dry_run || eval "$cmd" || { - lt_exit=$? - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - ( cd "$output_objdir" && \ - $RM "${realname}T" && \ - $MV "${realname}U" "$realname" ) - fi - - exit $lt_exit - } - done - IFS="$save_ifs" - - # Restore the uninstalled library and exit - if test "$opt_mode" = relink; then - $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? - - if test -n "$convenience"; then - if test -z "$whole_archive_flag_spec"; then - func_show_eval '${RM}r "$gentop"' - fi - fi - - exit $EXIT_SUCCESS - fi - - # Create links to the real library. - for linkname in $linknames; do - if test "$realname" != "$linkname"; then - func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' - fi - done - - # If -module or -export-dynamic was specified, set the dlname. - if test "$module" = yes || test "$export_dynamic" = yes; then - # On all known operating systems, these are identical. - dlname="$soname" - fi - fi - ;; - - obj) - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then - func_warning "\`-dlopen' is ignored for objects" - fi - - case " $deplibs" in - *\ -l* | *\ -L*) - func_warning "\`-l' and \`-L' are ignored for objects" ;; - esac - - test -n "$rpath" && \ - func_warning "\`-rpath' is ignored for objects" - - test -n "$xrpath" && \ - func_warning "\`-R' is ignored for objects" - - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for objects" - - test -n "$release" && \ - func_warning "\`-release' is ignored for objects" - - case $output in - *.lo) - test -n "$objs$old_deplibs" && \ - func_fatal_error "cannot build library object \`$output' from non-libtool objects" - - libobj=$output - func_lo2o "$libobj" - obj=$func_lo2o_result - ;; - *) - libobj= - obj="$output" - ;; - esac - - # Delete the old objects. - $opt_dry_run || $RM $obj $libobj - - # Objects from convenience libraries. This assumes - # single-version convenience libraries. Whenever we create - # different ones for PIC/non-PIC, this we'll have to duplicate - # the extraction. - reload_conv_objs= - gentop= - # reload_cmds runs $LD directly, so let us get rid of - # -Wl from whole_archive_flag_spec and hope we can get by with - # turning comma into space.. - wl= - - if test -n "$convenience"; then - if test -n "$whole_archive_flag_spec"; then - eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" - reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` - else - gentop="$output_objdir/${obj}x" - func_append generated " $gentop" - - func_extract_archives $gentop $convenience - reload_conv_objs="$reload_objs $func_extract_archives_result" - fi - fi - - # If we're not building shared, we need to use non_pic_objs - test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" - - # Create the old-style object. - reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test - - output="$obj" - func_execute_cmds "$reload_cmds" 'exit $?' - - # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - fi - - if test "$build_libtool_libs" != yes; then - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - # Create an invalid libtool object if no PIC, so that we don't - # accidentally link it into a program. - # $show "echo timestamp > $libobj" - # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? - exit $EXIT_SUCCESS - fi - - if test -n "$pic_flag" || test "$pic_mode" != default; then - # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" - output="$libobj" - func_execute_cmds "$reload_cmds" 'exit $?' - fi - - if test -n "$gentop"; then - func_show_eval '${RM}r "$gentop"' - fi - - exit $EXIT_SUCCESS - ;; - - prog) - case $host in - *cygwin*) func_stripname '' '.exe' "$output" - output=$func_stripname_result.exe;; - esac - test -n "$vinfo" && \ - func_warning "\`-version-info' is ignored for programs" - - test -n "$release" && \ - func_warning "\`-release' is ignored for programs" - - test "$preload" = yes \ - && test "$dlopen_support" = unknown \ - && test "$dlopen_self" = unknown \ - && test "$dlopen_self_static" = unknown && \ - func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." - - case $host in - *-*-rhapsody* | *-*-darwin1.[012]) - # On Rhapsody replace the C library is the System framework - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` - ;; - esac - - case $host in - *-*-darwin*) - # Don't allow lazy linking, it breaks C++ global constructors - # But is supposedly fixed on 10.4 or later (yay!). - if test "$tagname" = CXX ; then - case ${MACOSX_DEPLOYMENT_TARGET-10.0} in - 10.[0123]) - func_append compile_command " ${wl}-bind_at_load" - func_append finalize_command " ${wl}-bind_at_load" - ;; - esac - fi - # Time to change all our "foo.ltframework" stuff back to "-framework foo" - compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` - ;; - esac - - - # move library search paths that coincide with paths to not yet - # installed libraries to the beginning of the library search list - new_libs= - for path in $notinst_path; do - case " $new_libs " in - *" -L$path/$objdir "*) ;; - *) - case " $compile_deplibs " in - *" -L$path/$objdir "*) - func_append new_libs " -L$path/$objdir" ;; - esac - ;; - esac - done - for deplib in $compile_deplibs; do - case $deplib in - -L*) - case " $new_libs " in - *" $deplib "*) ;; - *) func_append new_libs " $deplib" ;; - esac - ;; - *) func_append new_libs " $deplib" ;; - esac - done - compile_deplibs="$new_libs" - - - func_append compile_command " $compile_deplibs" - func_append finalize_command " $finalize_deplibs" - - if test -n "$rpath$xrpath"; then - # If the user specified any rpath flags, then add them. - for libdir in $rpath $xrpath; do - # This is the magic to use -rpath. - case "$finalize_rpath " in - *" $libdir "*) ;; - *) func_append finalize_rpath " $libdir" ;; - esac - done - fi - - # Now hardcode the library paths - rpath= - hardcode_libdirs= - for libdir in $compile_rpath $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$perm_rpath " in - *" $libdir "*) ;; - *) func_append perm_rpath " $libdir" ;; - esac - fi - case $host in - *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) - testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` - case :$dllsearchpath: in - *":$libdir:"*) ;; - ::) dllsearchpath=$libdir;; - *) func_append dllsearchpath ":$libdir";; - esac - case :$dllsearchpath: in - *":$testbindir:"*) ;; - ::) dllsearchpath=$testbindir;; - *) func_append dllsearchpath ":$testbindir";; - esac - ;; - esac - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - compile_rpath="$rpath" - - rpath= - hardcode_libdirs= - for libdir in $finalize_rpath; do - if test -n "$hardcode_libdir_flag_spec"; then - if test -n "$hardcode_libdir_separator"; then - if test -z "$hardcode_libdirs"; then - hardcode_libdirs="$libdir" - else - # Just accumulate the unique libdirs. - case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in - *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) - ;; - *) - func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" - ;; - esac - fi - else - eval flag=\"$hardcode_libdir_flag_spec\" - func_append rpath " $flag" - fi - elif test -n "$runpath_var"; then - case "$finalize_perm_rpath " in - *" $libdir "*) ;; - *) func_append finalize_perm_rpath " $libdir" ;; - esac - fi - done - # Substitute the hardcoded libdirs into the rpath. - if test -n "$hardcode_libdir_separator" && - test -n "$hardcode_libdirs"; then - libdir="$hardcode_libdirs" - eval rpath=\" $hardcode_libdir_flag_spec\" - fi - finalize_rpath="$rpath" - - if test -n "$libobjs" && test "$build_old_libs" = yes; then - # Transform all the library objects into standard objects. - compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` - fi - - func_generate_dlsyms "$outputname" "@PROGRAM@" "no" - - # template prelinking step - if test -n "$prelink_cmds"; then - func_execute_cmds "$prelink_cmds" 'exit $?' - fi - - wrappers_required=yes - case $host in - *cegcc* | *mingw32ce*) - # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. - wrappers_required=no - ;; - *cygwin* | *mingw* ) - if test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - *) - if test "$need_relink" = no || test "$build_libtool_libs" != yes; then - wrappers_required=no - fi - ;; - esac - if test "$wrappers_required" = no; then - # Replace the output file specification. - compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - link_command="$compile_command$compile_rpath" - - # We have no uninstalled library dependencies, so finalize right now. - exit_status=0 - func_show_eval "$link_command" 'exit_status=$?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Delete the generated files. - if test -f "$output_objdir/${outputname}S.${objext}"; then - func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' - fi - - exit $exit_status - fi - - if test -n "$compile_shlibpath$finalize_shlibpath"; then - compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" - fi - if test -n "$finalize_shlibpath"; then - finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" - fi - - compile_var= - finalize_var= - if test -n "$runpath_var"; then - if test -n "$perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $perm_rpath; do - func_append rpath "$dir:" - done - compile_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - if test -n "$finalize_perm_rpath"; then - # We should set the runpath_var. - rpath= - for dir in $finalize_perm_rpath; do - func_append rpath "$dir:" - done - finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " - fi - fi - - if test "$no_install" = yes; then - # We don't need to create a wrapper script. - link_command="$compile_var$compile_command$compile_rpath" - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` - # Delete the old output file. - $opt_dry_run || $RM $output - # Link the executable and exit - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - exit $EXIT_SUCCESS - fi - - if test "$hardcode_action" = relink; then - # Fast installation is not supported - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - - func_warning "this platform does not like uninstalled shared libraries" - func_warning "\`$output' will be relinked during installation" - else - if test "$fast_install" != no; then - link_command="$finalize_var$compile_command$finalize_rpath" - if test "$fast_install" = yes; then - relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` - else - # fast_install is set to needless - relink_command= - fi - else - link_command="$compile_var$compile_command$compile_rpath" - relink_command="$finalize_var$finalize_command$finalize_rpath" - fi - fi - - # Replace the output file specification. - link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - - # Delete the old output files. - $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname - - func_show_eval "$link_command" 'exit $?' - - if test -n "$postlink_cmds"; then - func_to_tool_file "$output_objdir/$outputname" - postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` - func_execute_cmds "$postlink_cmds" 'exit $?' - fi - - # Now create the wrapper script. - func_verbose "creating $output" - - # Quote the relink command for shipping. - if test -n "$relink_command"; then - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - relink_command="(cd `pwd`; $relink_command)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - fi - - # Only actually do things if not in dry run mode. - $opt_dry_run || { - # win32 will think the script is a binary if it has - # a .exe suffix, so we strip it off here. - case $output in - *.exe) func_stripname '' '.exe' "$output" - output=$func_stripname_result ;; - esac - # test for cygwin because mv fails w/o .exe extensions - case $host in - *cygwin*) - exeext=.exe - func_stripname '' '.exe' "$outputname" - outputname=$func_stripname_result ;; - *) exeext= ;; - esac - case $host in - *cygwin* | *mingw* ) - func_dirname_and_basename "$output" "" "." - output_name=$func_basename_result - output_path=$func_dirname_result - cwrappersource="$output_path/$objdir/lt-$output_name.c" - cwrapper="$output_path/$output_name.exe" - $RM $cwrappersource $cwrapper - trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 - - func_emit_cwrapperexe_src > $cwrappersource - - # The wrapper executable is built using the $host compiler, - # because it contains $host paths and files. If cross- - # compiling, it, like the target executable, must be - # executed on the $host or under an emulation environment. - $opt_dry_run || { - $LTCC $LTCFLAGS -o $cwrapper $cwrappersource - $STRIP $cwrapper - } - - # Now, create the wrapper script for func_source use: - func_ltwrapper_scriptname $cwrapper - $RM $func_ltwrapper_scriptname_result - trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 - $opt_dry_run || { - # note: this script will not be executed, so do not chmod. - if test "x$build" = "x$host" ; then - $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result - else - func_emit_wrapper no > $func_ltwrapper_scriptname_result - fi - } - ;; - * ) - $RM $output - trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 - - func_emit_wrapper no > $output - chmod +x $output - ;; - esac - } - exit $EXIT_SUCCESS - ;; - esac - - # See if we need to build an old-fashioned archive. - for oldlib in $oldlibs; do - - if test "$build_libtool_libs" = convenience; then - oldobjs="$libobjs_save $symfileobj" - addlibs="$convenience" - build_libtool_libs=no - else - if test "$build_libtool_libs" = module; then - oldobjs="$libobjs_save" - build_libtool_libs=no - else - oldobjs="$old_deplibs $non_pic_objects" - if test "$preload" = yes && test -f "$symfileobj"; then - func_append oldobjs " $symfileobj" - fi - fi - addlibs="$old_convenience" - fi - - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $addlibs - func_append oldobjs " $func_extract_archives_result" - fi - - # Do each command in the archive commands. - if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then - cmds=$old_archive_from_new_cmds - else - - # Add any objects from preloaded convenience libraries - if test -n "$dlprefiles"; then - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - - func_extract_archives $gentop $dlprefiles - func_append oldobjs " $func_extract_archives_result" - fi - - # POSIX demands no paths to be encoded in archives. We have - # to avoid creating archives with duplicate basenames if we - # might have to extract them afterwards, e.g., when creating a - # static archive out of a convenience library, or when linking - # the entirety of a libtool archive into another (currently - # not supported by libtool). - if (for obj in $oldobjs - do - func_basename "$obj" - $ECHO "$func_basename_result" - done | sort | sort -uc >/dev/null 2>&1); then - : - else - echo "copying selected object files to avoid basename conflicts..." - gentop="$output_objdir/${outputname}x" - func_append generated " $gentop" - func_mkdir_p "$gentop" - save_oldobjs=$oldobjs - oldobjs= - counter=1 - for obj in $save_oldobjs - do - func_basename "$obj" - objbase="$func_basename_result" - case " $oldobjs " in - " ") oldobjs=$obj ;; - *[\ /]"$objbase "*) - while :; do - # Make sure we don't pick an alternate name that also - # overlaps. - newobj=lt$counter-$objbase - func_arith $counter + 1 - counter=$func_arith_result - case " $oldobjs " in - *[\ /]"$newobj "*) ;; - *) if test ! -f "$gentop/$newobj"; then break; fi ;; - esac - done - func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" - func_append oldobjs " $gentop/$newobj" - ;; - *) func_append oldobjs " $obj" ;; - esac - done - fi - eval cmds=\"$old_archive_cmds\" - - func_len " $cmds" - len=$func_len_result - if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then - cmds=$old_archive_cmds - elif test -n "$archiver_list_spec"; then - func_verbose "using command file archive linking..." - for obj in $oldobjs - do - func_to_tool_file "$obj" - $ECHO "$func_to_tool_file_result" - done > $output_objdir/$libname.libcmd - func_to_tool_file "$output_objdir/$libname.libcmd" - oldobjs=" $archiver_list_spec$func_to_tool_file_result" - cmds=$old_archive_cmds - else - # the command line is too long to link in one step, link in parts - func_verbose "using piecewise archive linking..." - save_RANLIB=$RANLIB - RANLIB=: - objlist= - concat_cmds= - save_oldobjs=$oldobjs - oldobjs= - # Is there a better way of finding the last object in the list? - for obj in $save_oldobjs - do - last_oldobj=$obj - done - eval test_cmds=\"$old_archive_cmds\" - func_len " $test_cmds" - len0=$func_len_result - len=$len0 - for obj in $save_oldobjs - do - func_len " $obj" - func_arith $len + $func_len_result - len=$func_arith_result - func_append objlist " $obj" - if test "$len" -lt "$max_cmd_len"; then - : - else - # the above command should be used before it gets too long - oldobjs=$objlist - if test "$obj" = "$last_oldobj" ; then - RANLIB=$save_RANLIB - fi - test -z "$concat_cmds" || concat_cmds=$concat_cmds~ - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" - objlist= - len=$len0 - fi - done - RANLIB=$save_RANLIB - oldobjs=$objlist - if test "X$oldobjs" = "X" ; then - eval cmds=\"\$concat_cmds\" - else - eval cmds=\"\$concat_cmds~\$old_archive_cmds\" - fi - fi - fi - func_execute_cmds "$cmds" 'exit $?' - done - - test -n "$generated" && \ - func_show_eval "${RM}r$generated" - - # Now create the libtool archive. - case $output in - *.la) - old_library= - test "$build_old_libs" = yes && old_library="$libname.$libext" - func_verbose "creating $output" - - # Preserve any variables that may affect compiler behavior - for var in $variables_saved_for_relink; do - if eval test -z \"\${$var+set}\"; then - relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" - elif eval var_value=\$$var; test -z "$var_value"; then - relink_command="$var=; export $var; $relink_command" - else - func_quote_for_eval "$var_value" - relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" - fi - done - # Quote the link command for shipping. - relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" - relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` - if test "$hardcode_automatic" = yes ; then - relink_command= - fi - - # Only create the output if not a dry run. - $opt_dry_run || { - for installed in no yes; do - if test "$installed" = yes; then - if test -z "$install_libdir"; then - break - fi - output="$output_objdir/$outputname"i - # Replace all uninstalled libtool libraries with the installed ones - newdependency_libs= - for deplib in $dependency_libs; do - case $deplib in - *.la) - func_basename "$deplib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` - test -z "$libdir" && \ - func_fatal_error "\`$deplib' is not a valid libtool archive" - func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" - ;; - -L*) - func_stripname -L '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -L$func_replace_sysroot_result" - ;; - -R*) - func_stripname -R '' "$deplib" - func_replace_sysroot "$func_stripname_result" - func_append newdependency_libs " -R$func_replace_sysroot_result" - ;; - *) func_append newdependency_libs " $deplib" ;; - esac - done - dependency_libs="$newdependency_libs" - newdlfiles= - - for lib in $dlfiles; do - case $lib in - *.la) - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" - ;; - *) func_append newdlfiles " $lib" ;; - esac - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - *.la) - # Only pass preopened files to the pseudo-archive (for - # eventual linking with the app. that links it) if we - # didn't already link the preopened objects directly into - # the library: - func_basename "$lib" - name="$func_basename_result" - eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` - test -z "$libdir" && \ - func_fatal_error "\`$lib' is not a valid libtool archive" - func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" - ;; - esac - done - dlprefiles="$newdlprefiles" - else - newdlfiles= - for lib in $dlfiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlfiles " $abs" - done - dlfiles="$newdlfiles" - newdlprefiles= - for lib in $dlprefiles; do - case $lib in - [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; - *) abs=`pwd`"/$lib" ;; - esac - func_append newdlprefiles " $abs" - done - dlprefiles="$newdlprefiles" - fi - $RM $output - # place dlname in correct position for cygwin - # In fact, it would be nice if we could use this code for all target - # systems that can't hard-code library paths into their executables - # and that have no shared library path variable independent of PATH, - # but it turns out we can't easily determine that from inspecting - # libtool variables, so we have to hard-code the OSs to which it - # applies here; at the moment, that means platforms that use the PE - # object format with DLL files. See the long comment at the top of - # tests/bindir.at for full details. - tdlname=$dlname - case $host,$output,$installed,$module,$dlname in - *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) - # If a -bindir argument was supplied, place the dll there. - if test "x$bindir" != x ; - then - func_relative_path "$install_libdir" "$bindir" - tdlname=$func_relative_path_result$dlname - else - # Otherwise fall back on heuristic. - tdlname=../bin/$dlname - fi - ;; - esac - $ECHO > $output "\ -# $outputname - a libtool library file -# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION -# -# Please DO NOT delete this file! -# It is necessary for linking the library. - -# The name that we can dlopen(3). -dlname='$tdlname' - -# Names of this library. -library_names='$library_names' - -# The name of the static archive. -old_library='$old_library' - -# Linker flags that can not go in dependency_libs. -inherited_linker_flags='$new_inherited_linker_flags' - -# Libraries that this one depends upon. -dependency_libs='$dependency_libs' - -# Names of additional weak libraries provided by this library -weak_library_names='$weak_libs' - -# Version information for $libname. -current=$current -age=$age -revision=$revision - -# Is this an already installed library? -installed=$installed - -# Should we warn about portability when linking against -modules? -shouldnotlink=$module - -# Files to dlopen/dlpreopen -dlopen='$dlfiles' -dlpreopen='$dlprefiles' - -# Directory that this library needs to be installed in: -libdir='$install_libdir'" - if test "$installed" = no && test "$need_relink" = yes; then - $ECHO >> $output "\ -relink_command=\"$relink_command\"" - fi - done - } - - # Do a symbolic link so that the libtool archive can be found in - # LD_LIBRARY_PATH before the program is installed. - func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' - ;; - esac - exit $EXIT_SUCCESS -} - -{ test "$opt_mode" = link || test "$opt_mode" = relink; } && - func_mode_link ${1+"$@"} - - -# func_mode_uninstall arg... -func_mode_uninstall () -{ - $opt_debug - RM="$nonopt" - files= - rmforce= - exit_status=0 - - # This variable tells wrapper scripts just to set variables rather - # than running their programs. - libtool_install_magic="$magic" - - for arg - do - case $arg in - -f) func_append RM " $arg"; rmforce=yes ;; - -*) func_append RM " $arg" ;; - *) func_append files " $arg" ;; - esac - done - - test -z "$RM" && \ - func_fatal_help "you must specify an RM program" - - rmdirs= - - for file in $files; do - func_dirname "$file" "" "." - dir="$func_dirname_result" - if test "X$dir" = X.; then - odir="$objdir" - else - odir="$dir/$objdir" - fi - func_basename "$file" - name="$func_basename_result" - test "$opt_mode" = uninstall && odir="$dir" - - # Remember odir for removal later, being careful to avoid duplicates - if test "$opt_mode" = clean; then - case " $rmdirs " in - *" $odir "*) ;; - *) func_append rmdirs " $odir" ;; - esac - fi - - # Don't error if the file doesn't exist and rm -f was used. - if { test -L "$file"; } >/dev/null 2>&1 || - { test -h "$file"; } >/dev/null 2>&1 || - test -f "$file"; then - : - elif test -d "$file"; then - exit_status=1 - continue - elif test "$rmforce" = yes; then - continue - fi - - rmfiles="$file" - - case $name in - *.la) - # Possibly a libtool archive, so verify it. - if func_lalib_p "$file"; then - func_source $dir/$name - - # Delete the libtool libraries and symlinks. - for n in $library_names; do - func_append rmfiles " $odir/$n" - done - test -n "$old_library" && func_append rmfiles " $odir/$old_library" - - case "$opt_mode" in - clean) - case " $library_names " in - *" $dlname "*) ;; - *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; - esac - test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" - ;; - uninstall) - if test -n "$library_names"; then - # Do each command in the postuninstall commands. - func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - - if test -n "$old_library"; then - # Do each command in the old_postuninstall commands. - func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' - fi - # FIXME: should reinstall the best remaining shared library. - ;; - esac - fi - ;; - - *.lo) - # Possibly a libtool object, so verify it. - if func_lalib_p "$file"; then - - # Read the .lo file - func_source $dir/$name - - # Add PIC object to the list of files to remove. - if test -n "$pic_object" && - test "$pic_object" != none; then - func_append rmfiles " $dir/$pic_object" - fi - - # Add non-PIC object to the list of files to remove. - if test -n "$non_pic_object" && - test "$non_pic_object" != none; then - func_append rmfiles " $dir/$non_pic_object" - fi - fi - ;; - - *) - if test "$opt_mode" = clean ; then - noexename=$name - case $file in - *.exe) - func_stripname '' '.exe' "$file" - file=$func_stripname_result - func_stripname '' '.exe' "$name" - noexename=$func_stripname_result - # $file with .exe has already been added to rmfiles, - # add $file without .exe - func_append rmfiles " $file" - ;; - esac - # Do a test to see if this is a libtool program. - if func_ltwrapper_p "$file"; then - if func_ltwrapper_executable_p "$file"; then - func_ltwrapper_scriptname "$file" - relink_command= - func_source $func_ltwrapper_scriptname_result - func_append rmfiles " $func_ltwrapper_scriptname_result" - else - relink_command= - func_source $dir/$noexename - fi - - # note $name still contains .exe if it was in $file originally - # as does the version of $file that was added into $rmfiles - func_append rmfiles " $odir/$name $odir/${name}S.${objext}" - if test "$fast_install" = yes && test -n "$relink_command"; then - func_append rmfiles " $odir/lt-$name" - fi - if test "X$noexename" != "X$name" ; then - func_append rmfiles " $odir/lt-${noexename}.c" - fi - fi - fi - ;; - esac - func_show_eval "$RM $rmfiles" 'exit_status=1' - done - - # Try to remove the ${objdir}s in the directories where we deleted files - for dir in $rmdirs; do - if test -d "$dir"; then - func_show_eval "rmdir $dir >/dev/null 2>&1" - fi - done - - exit $exit_status -} - -{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && - func_mode_uninstall ${1+"$@"} - -test -z "$opt_mode" && { - help="$generic_help" - func_fatal_help "you must specify a MODE" -} - -test -z "$exec_cmd" && \ - func_fatal_help "invalid operation mode \`$opt_mode'" - -if test -n "$exec_cmd"; then - eval exec "$exec_cmd" - exit $EXIT_FAILURE -fi - -exit $exit_status - - -# The TAGs below are defined such that we never get into a situation -# in which we disable both kinds of libraries. Given conflicting -# choices, we go for a static library, that is the most portable, -# since we can't tell whether shared libraries were disabled because -# the user asked for that or because the platform doesn't support -# them. This is particularly important on AIX, because we don't -# support having both static and shared libraries enabled at the same -# time on that platform, so we default to a shared-only configuration. -# If a disable-shared tag is given, we'll fallback to a static-only -# configuration. But we'll never go from static-only to shared-only. - -# ### BEGIN LIBTOOL TAG CONFIG: disable-shared -build_libtool_libs=no -build_old_libs=yes -# ### END LIBTOOL TAG CONFIG: disable-shared - -# ### BEGIN LIBTOOL TAG CONFIG: disable-static -build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` -# ### END LIBTOOL TAG CONFIG: disable-static - -# Local Variables: -# mode:shell-script -# sh-indentation:2 -# End: -# vi:sw=2 - diff --git a/external/mit/expat/dist/conftools/mkinstalldirs b/external/mit/expat/dist/conftools/mkinstalldirs deleted file mode 100755 index a77092c06..000000000 --- a/external/mit/expat/dist/conftools/mkinstalldirs +++ /dev/null @@ -1,40 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Public domain - -# Id: mkinstalldirs,v 1.1 2000/09/18 16:26:21 coopercc Exp - -errstatus=0 - -for file -do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d - do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" - - mkdir "$pathcomp" || lasterr=$? - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus - -# mkinstalldirs ends here diff --git a/external/mit/expat/dist/doc/expat.png b/external/mit/expat/dist/doc/expat.png deleted file mode 100755 index 5bc0726cfd8508d0aa53cf53486b0330780b5f21..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1027 zcmV+e1pNDnP)=T+4e4Js00002VoOIv z0RM-N%)bBt1B6LLK~!ko?U>t@>mUq8)d+=9h#H{~3Q;2}M1^oacv#|LJI>6kWL^9- zPA0}%;&3E@^wk$^{EffyH~z-o_#1!YZ~TqF@i+dTUID;=F}?$c-;2)xAis?t0001j zNt%-%z{k7Vc?VxI{*k8u0Q6v>*t5c2?Yt$PXw%PjDsGSBpo5^>+Idg=&ZOT1xQ8it zs-5@nP5R^goLSTX|Gswa;GZ!0BmMHiOV9CN(9ShJdpvizl70_>=|}LJc3hA*@uO2z zLWqbY!`nd;DbHjK5iuo30Ps=$p3nn;LpsB6(+B{8pW{n(01aP?QUJX4<{6R$U_JW) zX;SU{%D(ckm??#nEW+ z3XW&yX|=z!mNR^r^i4H@$tv#fdGSjnZ?aNtwTnA^*7%yJESEWc9BQ!gKqH75e#shWuW7Wm8RR|3FG{7K8MEuu4uR_# zIO{m=qZz|-nH=gjrMh+%n?(}|gI&XArp#V9+VyqWuwC@~LFu(Nx`=H{PAXZfYFBIY zQ3qA-5y2@Xwk09?Ct)b{@%e5`!m-=JzG#W*bQEdEk6k^Jw%aL2m93!;i=%cfH!C;x zy3t|V1A - - - - - Expat XML Parser - - - - - - - - - - - - - - -
(Expat logo)
Release 2.0.1
-

- -

Expat is a library, written in C, for parsing XML documents. It's -the underlying XML parser for the open source Mozilla project, Perl's -XML::Parser, Python's xml.parsers.expat, and -other open-source XML parsers.

- -

This library is the creation of James Clark, who's also given us -groff (an nroff look-alike), Jade (an implemention of ISO's DSSSL -stylesheet language for SGML), XP (a Java XML parser package), XT (a -Java XSL engine). James was also the technical lead on the XML -Working Group at W3C that produced the XML specification.

- -

This is free software, licensed under the MIT/X Consortium license. You may download it -from the Expat home page. -

- -

The bulk of this document was originally commissioned as an article -by XML.com. They graciously allowed -Clark Cooper to retain copyright and to distribute it with Expat. -This version has been substantially extended to include documentation -on features which have been added since the original article was -published, and additional information on using the original -interface.

- -
-

Table of Contents

- - -
-

Overview

- -

Expat is a stream-oriented parser. You register callback (or -handler) functions with the parser and then start feeding it the -document. As the parser recognizes parts of the document, it will -call the appropriate handler for that part (if you've registered one.) -The document is fed to the parser in pieces, so you can start parsing -before you have all the document. This also allows you to parse really -huge documents that won't fit into memory.

- -

Expat can be intimidating due to the many kinds of handlers and -options you can set. But you only need to learn four functions in -order to do 90% of what you'll want to do with it:

- -
- -
XML_ParserCreate
-
Create a new parser object.
- -
XML_SetElementHandler
-
Set handlers for start and end tags.
- -
XML_SetCharacterDataHandler
-
Set handler for text.
- -
XML_Parse
-
Pass a buffer full of document to the parser
-
- -

These functions and others are described in the reference part of this document. The reference -section also describes in detail the parameters passed to the -different types of handlers.

- -

Let's look at a very simple example program that only uses 3 of the -above functions (it doesn't need to set a character handler.) The -program outline.c prints an -element outline, indenting child elements to distinguish them from the -parent element that contains them. The start handler does all the -work. It prints two indenting spaces for every level of ancestor -elements, then it prints the element and attribute -information. Finally it increments the global Depth -variable.

- -
-int Depth;
-
-void XMLCALL
-start(void *data, const char *el, const char **attr) {
-  int i;
-
-  for (i = 0; i < Depth; i++)
-    printf("  ");
-
-  printf("%s", el);
-
-  for (i = 0; attr[i]; i += 2) {
-    printf(" %s='%s'", attr[i], attr[i + 1]);
-  }
-
-  printf("\n");
-  Depth++;
-}  /* End of start handler */
-
- -

The end tag simply does the bookkeeping work of decrementing -Depth.

-
-void XMLCALL
-end(void *data, const char *el) {
-  Depth--;
-}  /* End of end handler */
-
- -

Note the XMLCALL annotation used for the callbacks. -This is used to ensure that the Expat and the callbacks are using the -same calling convention in case the compiler options used for Expat -itself and the client code are different. Expat tries not to care -what the default calling convention is, though it may require that it -be compiled with a default convention of "cdecl" on some platforms. -For code which uses Expat, however, the calling convention is -specified by the XMLCALL annotation on most platforms; -callbacks should be defined using this annotation.

- -

The XMLCALL annotation was added in Expat 1.95.7, but -existing working Expat applications don't need to add it (since they -are already using the "cdecl" calling convention, or they wouldn't be -working). The annotation is only needed if the default calling -convention may be something other than "cdecl". To use the annotation -safely with older versions of Expat, you can conditionally define it -after including Expat's header file:

- -
-#include <expat.h>
-
-#ifndef XMLCALL
-#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__)
-#define XMLCALL __cdecl
-#elif defined(__GNUC__)
-#define XMLCALL __attribute__((cdecl))
-#else
-#define XMLCALL
-#endif
-#endif
-
- -

After creating the parser, the main program just has the job of -shoveling the document to the parser so that it can do its work.

- -
-

Building and Installing Expat

- -

The Expat distribution comes as a compressed (with GNU gzip) tar -file. You may download the latest version from Source Forge. After -unpacking this, cd into the directory. Then follow either the Win32 -directions or Unix directions below.

- -

Building under Win32

- -

If you're using the GNU compiler under cygwin, follow the Unix -directions in the next section. Otherwise if you have Microsoft's -Developer Studio installed, then from Windows Explorer double-click on -"expat.dsp" in the lib directory and build and install in the usual -manner.

- -

Alternatively, you may download the Win32 binary package that -contains the "expat.h" include file and a pre-built DLL.

- -

Building under Unix (or GNU)

- -

First you'll need to run the configure shell script in order to -configure the Makefiles and headers for your system.

- -

If you're happy with all the defaults that configure picks for you, -and you have permission on your system to install into /usr/local, you -can install Expat with this sequence of commands:

- -
-./configure
-make
-make install
-
- -

There are some options that you can provide to this script, but the -only one we'll mention here is the --prefix option. You -can find out all the options available by running configure with just -the --help option.

- -

By default, the configure script sets things up so that the library -gets installed in /usr/local/lib and the associated -header file in /usr/local/include. But if you were to -give the option, --prefix=/home/me/mystuff, then the -library and header would get installed in -/home/me/mystuff/lib and -/home/me/mystuff/include respectively.

- -

Configuring Expat Using the Pre-Processor

- -

Expat's feature set can be configured using a small number of -pre-processor definitions. The definition of this symbols does not -affect the set of entry points for Expat, only the behavior of the API -and the definition of character types in the case of -XML_UNICODE_WCHAR_T. The symbols are:

- -
-
XML_DTD
-
Include support for using and reporting DTD-based content. If -this is defined, default attribute values from an external DTD subset -are reported and attribute value normalization occurs based on the -type of attributes defined in the external subset. Without -this, Expat has a smaller memory footprint and can be faster, but will -not load external entities or process conditional sections. This does -not affect the set of functions available in the API.
- -
XML_NS
-
When defined, support for the Namespaces in XML -specification is included.
- -
XML_UNICODE
-
When defined, character data reported to the application is -encoded in UTF-16 using wide characters of the type -XML_Char. This is implied if -XML_UNICODE_WCHAR_T is defined.
- -
XML_UNICODE_WCHAR_T
-
If defined, causes the XML_Char character type to be -defined using the wchar_t type; otherwise, unsigned -short is used. Defining this implies -XML_UNICODE.
- -
XML_LARGE_SIZE
-
If defined, causes the XML_Size and XML_Index -integer types to be at least 64 bits in size. This is intended to support -processing of very large input streams, where the return values of -XML_GetCurrentByteIndex, -XML_GetCurrentLineNumber and -XML_GetCurrentColumnNumber -could overflow. It may not be supported by all compilers, and is turned -off by default.
- -
XML_CONTEXT_BYTES
-
The number of input bytes of markup context which the parser will -ensure are available for reporting via XML_GetInputContext. This is -normally set to 1024, and must be set to a positive interger. If this -is not defined, the input context will not be available and XML_GetInputContext will -always report NULL. Without this, Expat has a smaller memory -footprint and can be faster.
- -
XML_STATIC
-
On Windows, this should be set if Expat is going to be linked -statically with the code that calls it; this is required to get all -the right MSVC magic annotations correct. This is ignored on other -platforms.
- -
XML_ATTR_INFO
-
If defined, makes the the additional function XML_GetAttributeInfo available -for reporting attribute byte offsets.
-
- -
-

Using Expat

- -

Compiling and Linking Against Expat

- -

Unless you installed Expat in a location not expected by your -compiler and linker, all you have to do to use Expat in your programs -is to include the Expat header (#include <expat.h>) -in your files that make calls to it and to tell the linker that it -needs to link against the Expat library. On Unix systems, this would -usually be done with the -lexpat argument. Otherwise, -you'll need to tell the compiler where to look for the Expat header -and the linker where to find the Expat library. You may also need to -take steps to tell the operating system where to find this library at -run time.

- -

On a Unix-based system, here's what a Makefile might look like when -Expat is installed in a standard location:

- -
-CC=cc
-LDFLAGS=
-LIBS= -lexpat
-xmlapp: xmlapp.o
-        $(CC) $(LDFLAGS) -o xmlapp xmlapp.o $(LIBS)
-
- -

If you installed Expat in, say, /home/me/mystuff, then -the Makefile would look like this:

- -
-CC=cc
-CFLAGS= -I/home/me/mystuff/include
-LDFLAGS=
-LIBS= -L/home/me/mystuff/lib -lexpat
-xmlapp: xmlapp.o
-        $(CC) $(LDFLAGS) -o xmlapp xmlapp.o $(LIBS)
-
- -

You'd also have to set the environment variable -LD_LIBRARY_PATH to /home/me/mystuff/lib (or -to ${LD_LIBRARY_PATH}:/home/me/mystuff/lib if -LD_LIBRARY_PATH already has some directories in it) in order to run -your application.

- -

Expat Basics

- -

As we saw in the example in the overview, the first step in parsing -an XML document with Expat is to create a parser object. There are three functions in the Expat API for creating a -parser object. However, only two of these (XML_ParserCreate and XML_ParserCreateNS) can be used for -constructing a parser for a top-level document. The object returned -by these functions is an opaque pointer (i.e. "expat.h" declares it as -void *) to data with further internal structure. In order to free the -memory associated with this object you must call XML_ParserFree. Note that if you have -provided any user data that gets stored in the -parser, then your application is responsible for freeing it prior to -calling XML_ParserFree.

- -

The objects returned by the parser creation functions are good for -parsing only one XML document or external parsed entity. If your -application needs to parse many XML documents, then it needs to create -a parser object for each one. The best way to deal with this is to -create a higher level object that contains all the default -initialization you want for your parser objects.

- -

Walking through a document hierarchy with a stream oriented parser -will require a good stack mechanism in order to keep track of current -context. For instance, to answer the simple question, "What element -does this text belong to?" requires a stack, since the parser may have -descended into other elements that are children of the current one and -has encountered this text on the way out.

- -

The things you're likely to want to keep on a stack are the -currently opened element and it's attributes. You push this -information onto the stack in the start handler and you pop it off in -the end handler.

- -

For some tasks, it is sufficient to just keep information on what -the depth of the stack is (or would be if you had one.) The outline -program shown above presents one example. Another such task would be -skipping over a complete element. When you see the start tag for the -element you want to skip, you set a skip flag and record the depth at -which the element started. When the end tag handler encounters the -same depth, the skipped element has ended and the flag may be -cleared. If you follow the convention that the root element starts at -1, then you can use the same variable for skip flag and skip -depth.

- -
-void
-init_info(Parseinfo *info) {
-  info->skip = 0;
-  info->depth = 1;
-  /* Other initializations here */
-}  /* End of init_info */
-
-void XMLCALL
-rawstart(void *data, const char *el, const char **attr) {
-  Parseinfo *inf = (Parseinfo *) data;
-
-  if (! inf->skip) {
-    if (should_skip(inf, el, attr)) {
-      inf->skip = inf->depth;
-    }
-    else
-      start(inf, el, attr);     /* This does rest of start handling */
-  }
-
-  inf->depth++;
-}  /* End of rawstart */
-
-void XMLCALL
-rawend(void *data, const char *el) {
-  Parseinfo *inf = (Parseinfo *) data;
-
-  inf->depth--;
-
-  if (! inf->skip)
-    end(inf, el);              /* This does rest of end handling */
-
-  if (inf->skip == inf->depth)
-    inf->skip = 0;
-}  /* End rawend */
-
- -

Notice in the above example the difference in how depth is -manipulated in the start and end handlers. The end tag handler should -be the mirror image of the start tag handler. This is necessary to -properly model containment. Since, in the start tag handler, we -incremented depth after the main body of start tag code, then -in the end handler, we need to manipulate it before the main -body. If we'd decided to increment it first thing in the start -handler, then we'd have had to decrement it last thing in the end -handler.

- -

Communicating between handlers

- -

In order to be able to pass information between different handlers -without using globals, you'll need to define a data structure to hold -the shared variables. You can then tell Expat (with the XML_SetUserData function) to pass a -pointer to this structure to the handlers. This is the first -argument received by most handlers. In the reference section, an argument to a callback function is named -userData and have type void * if the user -data is passed; it will have the type XML_Parser if the -parser itself is passed. When the parser is passed, the user data may -be retrieved using XML_GetUserData.

- -

One common case where multiple calls to a single handler may need -to communicate using an application data structure is the case when -content passed to the character data handler (set by XML_SetCharacterDataHandler) needs to be accumulated. A -common first-time mistake with any of the event-oriented interfaces to -an XML parser is to expect all the text contained in an element to be -reported by a single call to the character data handler. Expat, like -many other XML parsers, reports such data as a sequence of calls; -there's no way to know when the end of the sequence is reached until a -different callback is made. A buffer referenced by the user data -structure proves both an effective and convenient place to accumulate -character data.

- - - - -

XML Version

- -

Expat is an XML 1.0 parser, and as such never complains based on -the value of the version pseudo-attribute in the XML -declaration, if present.

- -

If an application needs to check the version number (to support -alternate processing), it should use the XML_SetXmlDeclHandler function to -set a handler that uses the information in the XML declaration to -determine what to do. This example shows how to check that only a -version number of "1.0" is accepted:

- -
-static int wrong_version;
-static XML_Parser parser;
-
-static void XMLCALL
-xmldecl_handler(void            *userData,
-                const XML_Char  *version,
-                const XML_Char  *encoding,
-                int              standalone)
-{
-  static const XML_Char Version_1_0[] = {'1', '.', '0', 0};
-
-  int i;
-
-  for (i = 0; i < (sizeof(Version_1_0) / sizeof(Version_1_0[0])); ++i) {
-    if (version[i] != Version_1_0[i]) {
-      wrong_version = 1;
-      /* also clear all other handlers: */
-      XML_SetCharacterDataHandler(parser, NULL);
-      ...
-      return;
-    }
-  }
-  ...
-}
-
- -

Namespace Processing

- -

When the parser is created using the XML_ParserCreateNS, function, Expat -performs namespace processing. Under namespace processing, Expat -consumes xmlns and xmlns:... attributes, -which declare namespaces for the scope of the element in which they -occur. This means that your start handler will not see these -attributes. Your application can still be informed of these -declarations by setting namespace declaration handlers with XML_SetNamespaceDeclHandler.

- -

Element type and attribute names that belong to a given namespace -are passed to the appropriate handler in expanded form. By default -this expanded form is a concatenation of the namespace URI, the -separator character (which is the 2nd argument to XML_ParserCreateNS), and the local -name (i.e. the part after the colon). Names with undeclared prefixes -are not well-formed when namespace processing is enabled, and will -trigger an error. Unprefixed attribute names are never expanded, -and unprefixed element names are only expanded when they are in the -scope of a default namespace.

- -

However if XML_SetReturnNSTriplet has been called with a non-zero -do_nst parameter, then the expanded form for names with -an explicit prefix is a concatenation of: URI, separator, local name, -separator, prefix.

- -

You can set handlers for the start of a namespace declaration and -for the end of a scope of a declaration with the XML_SetNamespaceDeclHandler -function. The StartNamespaceDeclHandler is called prior to the start -tag handler and the EndNamespaceDeclHandler is called after the -corresponding end tag that ends the namespace's scope. The namespace -start handler gets passed the prefix and URI for the namespace. For a -default namespace declaration (xmlns='...'), the prefix will be null. -The URI will be null for the case where the default namespace is being -unset. The namespace end handler just gets the prefix for the closing -scope.

- -

These handlers are called for each declaration. So if, for -instance, a start tag had three namespace declarations, then the -StartNamespaceDeclHandler would be called three times before the start -tag handler is called, once for each declaration.

- -

Character Encodings

- -

While XML is based on Unicode, and every XML processor is required -to recognized UTF-8 and UTF-16 (1 and 2 byte encodings of Unicode), -other encodings may be declared in XML documents or entities. For the -main document, an XML declaration may contain an encoding -declaration:

-
-<?xml version="1.0" encoding="ISO-8859-2"?>
-
- -

External parsed entities may begin with a text declaration, which -looks like an XML declaration with just an encoding declaration:

-
-<?xml encoding="Big5"?>
-
- -

With Expat, you may also specify an encoding at the time of -creating a parser. This is useful when the encoding information may -come from a source outside the document itself (like a higher level -protocol.)

- -

There are four built-in encodings -in Expat:

-
    -
  • UTF-8
  • -
  • UTF-16
  • -
  • ISO-8859-1
  • -
  • US-ASCII
  • -
- -

Anything else discovered in an encoding declaration or in the -protocol encoding specified in the parser constructor, triggers a call -to the UnknownEncodingHandler. This handler gets passed -the encoding name and a pointer to an XML_Encoding data -structure. Your handler must fill in this structure and return -XML_STATUS_OK if it knows how to deal with the -encoding. Otherwise the handler should return -XML_STATUS_ERROR. The handler also gets passed a pointer -to an optional application data structure that you may indicate when -you set the handler.

- -

Expat places restrictions on character encodings that it can -support by filling in the XML_Encoding structure. -include file:

-
    -
  1. Every ASCII character that can appear in a well-formed XML document -must be represented by a single byte, and that byte must correspond to -it's ASCII encoding (except for the characters $@\^'{}~)
  2. -
  3. Characters must be encoded in 4 bytes or less.
  4. -
  5. All characters encoded must have Unicode scalar values less than or -equal to 65535 (0xFFFF)This does not apply to the built-in support -for UTF-16 and UTF-8
  6. -
  7. No character may be encoded by more that one distinct sequence of -bytes
  8. -
- -

XML_Encoding contains an array of integers that -correspond to the 1st byte of an encoding sequence. If the value in -the array for a byte is zero or positive, then the byte is a single -byte encoding that encodes the Unicode scalar value contained in the -array. A -1 in this array indicates a malformed byte. If the value is --2, -3, or -4, then the byte is the beginning of a 2, 3, or 4 byte -sequence respectively. Multi-byte sequences are sent to the convert -function pointed at in the XML_Encoding structure. This -function should return the Unicode scalar value for the sequence or -1 -if the sequence is malformed.

- -

One pitfall that novice Expat users are likely to fall into is that -although Expat may accept input in various encodings, the strings that -it passes to the handlers are always encoded in UTF-8 or UTF-16 -(depending on how Expat was compiled). Your application is responsible -for any translation of these strings into other encodings.

- -

Handling External Entity References

- -

Expat does not read or parse external entities directly. Note that -any external DTD is a special case of an external entity. If you've -set no ExternalEntityRefHandler, then external entity -references are silently ignored. Otherwise, it calls your handler with -the information needed to read and parse the external entity.

- -

Your handler isn't actually responsible for parsing the entity, but -it is responsible for creating a subsidiary parser with XML_ExternalEntityParserCreate that will do the job. This -returns an instance of XML_Parser that has handlers and -other data structures initialized from the parent parser. You may then -use XML_Parse or XML_ParseBuffer calls against this -parser. Since external entities my refer to other external entities, -your handler should be prepared to be called recursively.

- -

Parsing DTDs

- -

In order to parse parameter entities, before starting the parse, -you must call XML_SetParamEntityParsing with one of the following -arguments:

-
-
XML_PARAM_ENTITY_PARSING_NEVER
-
Don't parse parameter entities or the external subset
-
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
-
Parse parameter entites and the external subset unless -standalone was set to "yes" in the XML declaration.
-
XML_PARAM_ENTITY_PARSING_ALWAYS
-
Always parse parameter entities and the external subset
-
- -

In order to read an external DTD, you also have to set an external -entity reference handler as described above.

- -

Temporarily Stopping Parsing

- -

Expat 1.95.8 introduces a new feature: its now possible to stop -parsing temporarily from within a handler function, even if more data -has already been passed into the parser. Applications for this -include

- -
    -
  • Supporting the XInclude specification.
  • - -
  • Delaying further processing until additional information is - available from some other source.
  • - -
  • Adjusting processor load as task priorities shift within an - application.
  • - -
  • Stopping parsing completely (simply free or reset the parser - instead of resuming in the outer parsing loop). This can be useful - if a application-domain error is found in the XML being parsed or if - the result of the parse is determined not to be useful after - all.
  • -
- -

To take advantage of this feature, the main parsing loop of an -application needs to support this specifically. It cannot be -supported with a parsing loop compatible with Expat 1.95.7 or -earlier (though existing loops will continue to work without -supporting the stop/resume feature).

- -

An application that uses this feature for a single parser will have -the rough structure (in pseudo-code):

- -
-fd = open_input()
-p = create_parser()
-
-if parse_xml(p, fd) {
-  /* suspended */
-
-  int suspended = 1;
-
-  while (suspended) {
-    do_something_else()
-    if ready_to_resume() {
-      suspended = continue_parsing(p, fd);
-    }
-  }
-}
-
- -

An application that may resume any of several parsers based on -input (either from the XML being parsed or some other source) will -certainly have more interesting control structures.

- -

This C function could be used for the parse_xml -function mentioned in the pseudo-code above:

- -
-#define BUFF_SIZE 10240
-
-/* Parse a document from the open file descriptor 'fd' until the parse
-   is complete (the document has been completely parsed, or there's
-   been an error), or the parse is stopped.  Return non-zero when
-   the parse is merely suspended.
-*/
-int
-parse_xml(XML_Parser p, int fd)
-{
-  for (;;) {
-    int last_chunk;
-    int bytes_read;
-    enum XML_Status status;
-
-    void *buff = XML_GetBuffer(p, BUFF_SIZE);
-    if (buff == NULL) {
-      /* handle error... */
-      return 0;
-    }
-    bytes_read = read(fd, buff, BUFF_SIZE);
-    if (bytes_read < 0) {
-      /* handle error... */
-      return 0;
-    }
-    status = XML_ParseBuffer(p, bytes_read, bytes_read == 0);
-    switch (status) {
-      case XML_STATUS_ERROR:
-        /* handle error... */
-        return 0;
-      case XML_STATUS_SUSPENDED:
-        return 1;
-    }
-    if (bytes_read == 0)
-      return 0;
-  }
-}
-
- -

The corresponding continue_parsing function is -somewhat simpler, since it only need deal with the return code from -XML_ResumeParser; it can -delegate the input handling to the parse_xml -function:

- -
-/* Continue parsing a document which had been suspended.  The 'p' and
-   'fd' arguments are the same as passed to parse_xml().  Return
-   non-zero when the parse is suspended.
-*/
-int
-continue_parsing(XML_Parser p, int fd)
-{
-  enum XML_Status status = XML_ResumeParser(p);
-  switch (status) {
-    case XML_STATUS_ERROR:
-      /* handle error... */
-      return 0;
-    case XML_ERROR_NOT_SUSPENDED:
-      /* handle error... */
-      return 0;.
-    case XML_STATUS_SUSPENDED:
-      return 1;
-  }
-  return parse_xml(p, fd);
-}
-
- -

Now that we've seen what a mess the top-level parsing loop can -become, what have we gained? Very simply, we can now use the XML_StopParser function to stop -parsing, without having to go to great lengths to avoid additional -processing that we're expecting to ignore. As a bonus, we get to stop -parsing temporarily, and come back to it when we're -ready.

- -

To stop parsing from a handler function, use the XML_StopParser function. This function -takes two arguments; the parser being stopped and a flag indicating -whether the parse can be resumed in the future.

- - - - -
- - -

Expat Reference

- -

Parser Creation

- -
-XML_Parser XMLCALL
-XML_ParserCreate(const XML_Char *encoding);
-
-
-Construct a new parser. If encoding is non-null, it specifies a -character encoding to use for the document. This overrides the document -encoding declaration. There are four built-in encodings: -
    -
  • US-ASCII
  • -
  • UTF-8
  • -
  • UTF-16
  • -
  • ISO-8859-1
  • -
-Any other value will invoke a call to the UnknownEncodingHandler. -
- -
-XML_Parser XMLCALL
-XML_ParserCreateNS(const XML_Char *encoding,
-                   XML_Char sep);
-
-
-Constructs a new parser that has namespace processing in effect. Namespace -expanded element names and attribute names are returned as a concatenation -of the namespace URI, sep, and the local part of the name. This -means that you should pick a character for sep that can't be part -of an URI. Since Expat does not check namespace URIs for conformance, the -only safe choice for a namespace separator is a character that is illegal -in XML. For instance, '\xFF' is not legal in UTF-8, and -'\xFFFF' is not legal in UTF-16. There is a special case when -sep is the null character '\0': the namespace URI and -the local part will be concatenated without any separator - this is intended -to support RDF processors. It is a programming error to use the null separator -with namespace triplets.
- -
-XML_Parser XMLCALL
-XML_ParserCreate_MM(const XML_Char *encoding,
-                    const XML_Memory_Handling_Suite *ms,
-		    const XML_Char *sep);
-
-
-typedef struct {
-  void *(XMLCALL *malloc_fcn)(size_t size);
-  void *(XMLCALL *realloc_fcn)(void *ptr, size_t size);
-  void (XMLCALL *free_fcn)(void *ptr);
-} XML_Memory_Handling_Suite;
-
-
-

Construct a new parser using the suite of memory handling functions -specified in ms. If ms is NULL, then use the -standard set of memory management functions. If sep is -non NULL, then namespace processing is enabled in the created parser -and the character pointed at by sep is used as the separator between -the namespace URI and the local part of the name.

-
- -
-XML_Parser XMLCALL
-XML_ExternalEntityParserCreate(XML_Parser p,
-                               const XML_Char *context,
-                               const XML_Char *encoding);
-
-
-Construct a new XML_Parser object for parsing an external -general entity. Context is the context argument passed in a call to a -ExternalEntityRefHandler. Other state information such as handlers, -user data, namespace processing is inherited from the parser passed as -the 1st argument. So you shouldn't need to call any of the behavior -changing functions on this parser (unless you want it to act -differently than the parent parser). -
- -
-void XMLCALL
-XML_ParserFree(XML_Parser p);
-
-
-Free memory used by the parser. Your application is responsible for -freeing any memory associated with user data. -
- -
-XML_Bool XMLCALL
-XML_ParserReset(XML_Parser p,
-                const XML_Char *encoding);
-
-
-Clean up the memory structures maintained by the parser so that it may -be used again. After this has been called, parser is -ready to start parsing a new document. All handlers are cleared from -the parser, except for the unknownEncodingHandler. The parser's external -state is re-initialized except for the values of ns and ns_triplets. -This function may not be used on a parser created using XML_ExternalEntityParserCreate; it will return XML_FALSE in that case. Returns -XML_TRUE on success. Your application is responsible for -dealing with any memory associated with user data. -
- -

Parsing

- -

To state the obvious: the three parsing functions XML_Parse, -XML_ParseBuffer and -XML_GetBuffer must not be called from within a handler -unless they operate on a separate parser instance, that is, one that -did not call the handler. For example, it is OK to call the parsing -functions from within an XML_ExternalEntityRefHandler, -if they apply to the parser created by -XML_ExternalEntityParserCreate.

- -

Note: the len argument passed to these functions -should be considerably less than the maximum value for an integer, -as it could create an integer overflow situation if the added -lengths of a buffer and the unprocessed portion of the previous buffer -exceed the maximum integer value. Input data at the end of a buffer -will remain unprocessed if it is part of an XML token for which the -end is not part of that buffer.

- -
-enum XML_Status XMLCALL
-XML_Parse(XML_Parser p,
-          const char *s,
-          int len,
-          int isFinal);
-
-
-enum XML_Status {
-  XML_STATUS_ERROR = 0,
-  XML_STATUS_OK = 1
-};
-
-
-Parse some more of the document. The string s is a buffer -containing part (or perhaps all) of the document. The number of bytes of s -that are part of the document is indicated by len. This means -that s doesn't have to be null terminated. It also means that -if len is larger than the number of bytes in the block of -memory that s points at, then a memory fault is likely. The -isFinal parameter informs the parser that this is the last -piece of the document. Frequently, the last piece is empty (i.e. -len is zero.) -If a parse error occurred, it returns XML_STATUS_ERROR. -Otherwise it returns XML_STATUS_OK value. -
- -
-enum XML_Status XMLCALL
-XML_ParseBuffer(XML_Parser p,
-                int len,
-                int isFinal);
-
-
-This is just like XML_Parse, -except in this case Expat provides the buffer. By obtaining the -buffer from Expat with the XML_GetBuffer function, the application can avoid double -copying of the input. -
- -
-void * XMLCALL
-XML_GetBuffer(XML_Parser p,
-              int len);
-
-
-Obtain a buffer of size len to read a piece of the document -into. A NULL value is returned if Expat can't allocate enough memory for -this buffer. This has to be called prior to every call to -XML_ParseBuffer. A -typical use would look like this: - -
-for (;;) {
-  int bytes_read;
-  void *buff = XML_GetBuffer(p, BUFF_SIZE);
-  if (buff == NULL) {
-    /* handle error */
-  }
-
-  bytes_read = read(docfd, buff, BUFF_SIZE);
-  if (bytes_read < 0) {
-    /* handle error */
-  }
-
-  if (! XML_ParseBuffer(p, bytes_read, bytes_read == 0)) {
-    /* handle parse error */
-  }
-
-  if (bytes_read == 0)
-    break;
-}
-
-
- -
-enum XML_Status XMLCALL
-XML_StopParser(XML_Parser p,
-               XML_Bool resumable);
-
-
- -

Stops parsing, causing XML_Parse or XML_ParseBuffer to return. Must be called from within a -call-back handler, except when aborting (when resumable -is XML_FALSE) an already suspended parser. Some -call-backs may still follow because they would otherwise get -lost, including -

    -
  • the end element handler for empty elements when stopped in the - start element handler,
  • -
  • the end namespace declaration handler when stopped in the end - element handler,
  • -
  • the character data handler when stopped in the character data handler - while making multiple call-backs on a contiguous chunk of characters,
  • -
-and possibly others.

- -

This can be called from most handlers, including DTD related -call-backs, except when parsing an external parameter entity and -resumable is XML_TRUE. Returns -XML_STATUS_OK when successful, -XML_STATUS_ERROR otherwise. The possible error codes -are:

-
-
XML_ERROR_SUSPENDED
-
when suspending an already suspended parser.
-
XML_ERROR_FINISHED
-
when the parser has already finished.
-
XML_ERROR_SUSPEND_PE
-
when suspending while parsing an external PE.
-
- -

Since the stop/resume feature requires application support in the -outer parsing loop, it is an error to call this function for a parser -not being handled appropriately; see Temporarily Stopping Parsing for more information.

- -

When resumable is XML_TRUE then parsing -is suspended, that is, XML_Parse and XML_ParseBuffer return XML_STATUS_SUSPENDED. -Otherwise, parsing is aborted, that is, XML_Parse and XML_ParseBuffer return -XML_STATUS_ERROR with error code -XML_ERROR_ABORTED.

- -

Note: -This will be applied to the current parser instance only, that is, if -there is a parent parser then it will continue parsing when the -external entity reference handler returns. It is up to the -implementation of that handler to call XML_StopParser on the parent parser -(recursively), if one wants to stop parsing altogether.

- -

When suspended, parsing can be resumed by calling XML_ResumeParser.

- -

New in Expat 1.95.8.

-
- -
-enum XML_Status XMLCALL
-XML_ResumeParser(XML_Parser p);
-
-
-

Resumes parsing after it has been suspended with XML_StopParser. Must not be called from -within a handler call-back. Returns same status codes as XML_Parse or XML_ParseBuffer. An additional error -code, XML_ERROR_NOT_SUSPENDED, will be returned if the -parser was not currently suspended.

- -

Note: -This must be called on the most deeply nested child parser instance -first, and on its parent parser only after the child parser has -finished, to be applied recursively until the document entity's parser -is restarted. That is, the parent parser will not resume by itself -and it is up to the application to call XML_ResumeParser on it at the -appropriate moment.

- -

New in Expat 1.95.8.

-
- -
-void XMLCALL
-XML_GetParsingStatus(XML_Parser p,
-                     XML_ParsingStatus *status);
-
-
-enum XML_Parsing {
-  XML_INITIALIZED,
-  XML_PARSING,
-  XML_FINISHED,
-  XML_SUSPENDED
-};
-
-typedef struct {
-  enum XML_Parsing parsing;
-  XML_Bool finalBuffer;
-} XML_ParsingStatus;
-
-
-

Returns status of parser with respect to being initialized, -parsing, finished, or suspended, and whether the final buffer is being -processed. The status parameter must not be -NULL.

- -

New in Expat 1.95.8.

-
- - -

Handler Setting

- -

Although handlers are typically set prior to parsing and left alone, an -application may choose to set or change the handler for a parsing event -while the parse is in progress. For instance, your application may choose -to ignore all text not descended from a para element. One -way it could do this is to set the character handler when a para start tag -is seen, and unset it for the corresponding end tag.

- -

A handler may be unset by providing a NULL pointer to the -appropriate handler setter. None of the handler setting functions have -a return value.

- -

Your handlers will be receiving strings in arrays of type -XML_Char. This type is conditionally defined in expat.h as -either char, wchar_t or unsigned short. -The former implies UTF-8 encoding, the latter two imply UTF-16 encoding. -Note that you'll receive them in this form independent of the original -encoding of the document.

- -
-
-void XMLCALL
-XML_SetStartElementHandler(XML_Parser p,
-                           XML_StartElementHandler start);
-
-
-typedef void
-(XMLCALL *XML_StartElementHandler)(void *userData,
-                                   const XML_Char *name,
-                                   const XML_Char **atts);
-
-

Set handler for start (and empty) tags. Attributes are passed to the start -handler as a pointer to a vector of char pointers. Each attribute seen in -a start (or empty) tag occupies 2 consecutive places in this vector: the -attribute name followed by the attribute value. These pairs are terminated -by a null pointer.

-

Note that an empty tag generates a call to both start and end handlers -(in that order).

-
- -
-
-void XMLCALL
-XML_SetEndElementHandler(XML_Parser p,
-                         XML_EndElementHandler);
-
-
-typedef void
-(XMLCALL *XML_EndElementHandler)(void *userData,
-                                 const XML_Char *name);
-
-

Set handler for end (and empty) tags. As noted above, an empty tag -generates a call to both start and end handlers.

-
- -
-
-void XMLCALL
-XML_SetElementHandler(XML_Parser p,
-                      XML_StartElementHandler start,
-                      XML_EndElementHandler end);
-
-

Set handlers for start and end tags with one call.

-
- -
-
-void XMLCALL
-XML_SetCharacterDataHandler(XML_Parser p,
-                            XML_CharacterDataHandler charhndl)
-
-
-typedef void
-(XMLCALL *XML_CharacterDataHandler)(void *userData,
-                                    const XML_Char *s,
-                                    int len);
-
-

Set a text handler. The string your handler receives -is NOT nul-terminated. You have to use the length argument -to deal with the end of the string. A single block of contiguous text -free of markup may still result in a sequence of calls to this handler. -In other words, if you're searching for a pattern in the text, it may -be split across calls to this handler. Note: Setting this handler to NULL -may NOT immediately terminate call-backs if the parser is currently -processing such a single block of contiguous markup-free text, as the parser -will continue calling back until the end of the block is reached.

-
- -
-
-void XMLCALL
-XML_SetProcessingInstructionHandler(XML_Parser p,
-                                    XML_ProcessingInstructionHandler proc)
-
-
-typedef void
-(XMLCALL *XML_ProcessingInstructionHandler)(void *userData,
-                                            const XML_Char *target,
-                                            const XML_Char *data);
-
-
-

Set a handler for processing instructions. The target is the first word -in the processing instruction. The data is the rest of the characters in -it after skipping all whitespace after the initial word.

-
- -
-
-void XMLCALL
-XML_SetCommentHandler(XML_Parser p,
-                      XML_CommentHandler cmnt)
-
-
-typedef void
-(XMLCALL *XML_CommentHandler)(void *userData,
-                              const XML_Char *data);
-
-

Set a handler for comments. The data is all text inside the comment -delimiters.

-
- -
-
-void XMLCALL
-XML_SetStartCdataSectionHandler(XML_Parser p,
-                                XML_StartCdataSectionHandler start);
-
-
-typedef void
-(XMLCALL *XML_StartCdataSectionHandler)(void *userData);
-
-

Set a handler that gets called at the beginning of a CDATA section.

-
- -
-
-void XMLCALL
-XML_SetEndCdataSectionHandler(XML_Parser p,
-                              XML_EndCdataSectionHandler end);
-
-
-typedef void
-(XMLCALL *XML_EndCdataSectionHandler)(void *userData);
-
-

Set a handler that gets called at the end of a CDATA section.

-
- -
-
-void XMLCALL
-XML_SetCdataSectionHandler(XML_Parser p,
-                           XML_StartCdataSectionHandler start,
-                           XML_EndCdataSectionHandler end)
-
-

Sets both CDATA section handlers with one call.

-
- -
-
-void XMLCALL
-XML_SetDefaultHandler(XML_Parser p,
-                      XML_DefaultHandler hndl)
-
-
-typedef void
-(XMLCALL *XML_DefaultHandler)(void *userData,
-                              const XML_Char *s,
-                              int len);
-
- -

Sets a handler for any characters in the document which wouldn't -otherwise be handled. This includes both data for which no handlers -can be set (like some kinds of DTD declarations) and data which could -be reported but which currently has no handler set. The characters -are passed exactly as they were present in the XML document except -that they will be encoded in UTF-8 or UTF-16. Line boundaries are not -normalized. Note that a byte order mark character is not passed to the -default handler. There are no guarantees about how characters are -divided between calls to the default handler: for example, a comment -might be split between multiple calls. Setting the handler with -this call has the side effect of turning off expansion of references -to internally defined general entities. Instead these references are -passed to the default handler.

- -

See also XML_DefaultCurrent.

-
- -
-
-void XMLCALL
-XML_SetDefaultHandlerExpand(XML_Parser p,
-                            XML_DefaultHandler hndl)
-
-
-typedef void
-(XMLCALL *XML_DefaultHandler)(void *userData,
-                              const XML_Char *s,
-                              int len);
-
-

This sets a default handler, but doesn't inhibit the expansion of -internal entity references. The entity reference will not be passed -to the default handler.

- -

See also XML_DefaultCurrent.

-
- -
-
-void XMLCALL
-XML_SetExternalEntityRefHandler(XML_Parser p,
-                                XML_ExternalEntityRefHandler hndl)
-
-
-typedef int
-(XMLCALL *XML_ExternalEntityRefHandler)(XML_Parser p,
-                                        const XML_Char *context,
-                                        const XML_Char *base,
-                                        const XML_Char *systemId,
-                                        const XML_Char *publicId);
-
-

Set an external entity reference handler. This handler is also -called for processing an external DTD subset if parameter entity parsing -is in effect. (See -XML_SetParamEntityParsing.)

- -

The context parameter specifies the parsing context in -the format expected by the context argument to XML_ExternalEntityParserCreate. code is -valid only until the handler returns, so if the referenced entity is -to be parsed later, it must be copied. context is NULL -only when the entity is a parameter entity, which is how one can -differentiate between general and parameter entities.

- -

The base parameter is the base to use for relative -system identifiers. It is set by XML_SetBase and may be NULL. The -publicId parameter is the public id given in the entity -declaration and may be NULL. systemId is the system -identifier specified in the entity declaration and is never NULL.

- -

There are a couple of ways in which this handler differs from -others. First, this handler returns a status indicator (an -integer). XML_STATUS_OK should be returned for successful -handling of the external entity reference. Returning -XML_STATUS_ERROR indicates failure, and causes the -calling parser to return an -XML_ERROR_EXTERNAL_ENTITY_HANDLING error.

- -

Second, instead of having the user data as its first argument, it -receives the parser that encountered the entity reference. This, along -with the context parameter, may be used as arguments to a call to -XML_ExternalEntityParserCreate. Using the returned -parser, the body of the external entity can be recursively parsed.

- -

Since this handler may be called recursively, it should not be saving -information into global or static variables.

-
- -
-void XMLCALL
-XML_SetExternalEntityRefHandlerArg(XML_Parser p,
-                                   void *arg)
-
-
-

Set the argument passed to the ExternalEntityRefHandler. If -arg is not NULL, it is the new value passed to the -handler set using XML_SetExternalEntityRefHandler; if arg is -NULL, the argument passed to the handler function will be the parser -object itself.

- -

Note: -The type of arg and the type of the first argument to the -ExternalEntityRefHandler do not match. This function takes a -void * to be passed to the handler, while the handler -accepts an XML_Parser. This is a historical accident, -but will not be corrected before Expat 2.0 (at the earliest) to avoid -causing compiler warnings for code that's known to work with this -API. It is the responsibility of the application code to know the -actual type of the argument passed to the handler and to manage it -properly.

-
- -
-
-void XMLCALL
-XML_SetSkippedEntityHandler(XML_Parser p,
-                            XML_SkippedEntityHandler handler)
-
-
-typedef void
-(XMLCALL *XML_SkippedEntityHandler)(void *userData,
-                                    const XML_Char *entityName,
-                                    int is_parameter_entity);
-
-

Set a skipped entity handler. This is called in two situations:

-
    -
  1. An entity reference is encountered for which no declaration - has been read and this is not an error.
  2. -
  3. An internal entity reference is read, but not expanded, because - XML_SetDefaultHandler - has been called.
  4. -
-

The is_parameter_entity argument will be non-zero for -a parameter entity and zero for a general entity.

Note: skipped -parameter entities in declarations and skipped general entities in -attribute values cannot be reported, because the event would be out of -sync with the reporting of the declarations or attribute values

-
- -
-
-void XMLCALL
-XML_SetUnknownEncodingHandler(XML_Parser p,
-                              XML_UnknownEncodingHandler enchandler,
-			      void *encodingHandlerData)
-
-
-typedef int
-(XMLCALL *XML_UnknownEncodingHandler)(void *encodingHandlerData,
-                                      const XML_Char *name,
-                                      XML_Encoding *info);
-
-typedef struct {
-  int map[256];
-  void *data;
-  int (XMLCALL *convert)(void *data, const char *s);
-  void (XMLCALL *release)(void *data);
-} XML_Encoding;
-
-

Set a handler to deal with encodings other than the built in set. This should be done before -XML_Parse or XML_ParseBuffer have been called on the -given parser.

If the handler knows how to deal with an encoding -with the given name, it should fill in the info data -structure and return XML_STATUS_OK. Otherwise it -should return XML_STATUS_ERROR. The handler will be called -at most once per parsed (external) entity. The optional application -data pointer encodingHandlerData will be passed back to -the handler.

- -

The map array contains information for every possible possible leading -byte in a byte sequence. If the corresponding value is >= 0, then it's -a single byte sequence and the byte encodes that Unicode value. If the -value is -1, then that byte is invalid as the initial byte in a sequence. -If the value is -n, where n is an integer > 1, then n is the number of -bytes in the sequence and the actual conversion is accomplished by a -call to the function pointed at by convert. This function may return -1 -if the sequence itself is invalid. The convert pointer may be null if -there are only single byte codes. The data parameter passed to the convert -function is the data pointer from XML_Encoding. The -string s is NOT nul-terminated and points at the sequence of -bytes to be converted.

- -

The function pointed at by release is called by the -parser when it is finished with the encoding. It may be NULL.

-
- -
-
-void XMLCALL
-XML_SetStartNamespaceDeclHandler(XML_Parser p,
-			         XML_StartNamespaceDeclHandler start);
-
-
-typedef void
-(XMLCALL *XML_StartNamespaceDeclHandler)(void *userData,
-                                         const XML_Char *prefix,
-                                         const XML_Char *uri);
-
-

Set a handler to be called when a namespace is declared. Namespace -declarations occur inside start tags. But the namespace declaration start -handler is called before the start tag handler for each namespace declared -in that start tag.

-
- -
-
-void XMLCALL
-XML_SetEndNamespaceDeclHandler(XML_Parser p,
-			       XML_EndNamespaceDeclHandler end);
-
-
-typedef void
-(XMLCALL *XML_EndNamespaceDeclHandler)(void *userData,
-                                       const XML_Char *prefix);
-
-

Set a handler to be called when leaving the scope of a namespace -declaration. This will be called, for each namespace declaration, -after the handler for the end tag of the element in which the -namespace was declared.

-
- -
-
-void XMLCALL
-XML_SetNamespaceDeclHandler(XML_Parser p,
-                            XML_StartNamespaceDeclHandler start,
-                            XML_EndNamespaceDeclHandler end)
-
-

Sets both namespace declaration handlers with a single call.

-
- -
-
-void XMLCALL
-XML_SetXmlDeclHandler(XML_Parser p,
-		      XML_XmlDeclHandler xmldecl);
-
-
-typedef void
-(XMLCALL *XML_XmlDeclHandler)(void            *userData,
-                              const XML_Char  *version,
-                              const XML_Char  *encoding,
-                              int             standalone);
-
-

Sets a handler that is called for XML declarations and also for -text declarations discovered in external entities. The way to -distinguish is that the version parameter will be NULL -for text declarations. The encoding parameter may be NULL -for an XML declaration. The standalone argument will -contain -1, 0, or 1 indicating respectively that there was no -standalone parameter in the declaration, that it was given as no, or -that it was given as yes.

-
- -
-
-void XMLCALL
-XML_SetStartDoctypeDeclHandler(XML_Parser p,
-			       XML_StartDoctypeDeclHandler start);
-
-
-typedef void
-(XMLCALL *XML_StartDoctypeDeclHandler)(void           *userData,
-                                       const XML_Char *doctypeName,
-                                       const XML_Char *sysid,
-                                       const XML_Char *pubid,
-                                       int            has_internal_subset);
-
-

Set a handler that is called at the start of a DOCTYPE declaration, -before any external or internal subset is parsed. Both sysid -and pubid may be NULL. The has_internal_subset -will be non-zero if the DOCTYPE declaration has an internal subset.

-
- -
-
-void XMLCALL
-XML_SetEndDoctypeDeclHandler(XML_Parser p,
-			     XML_EndDoctypeDeclHandler end);
-
-
-typedef void
-(XMLCALL *XML_EndDoctypeDeclHandler)(void *userData);
-
-

Set a handler that is called at the end of a DOCTYPE declaration, -after parsing any external subset.

-
- -
-
-void XMLCALL
-XML_SetDoctypeDeclHandler(XML_Parser p,
-			  XML_StartDoctypeDeclHandler start,
-			  XML_EndDoctypeDeclHandler end);
-
-

Set both doctype handlers with one call.

-
- -
-
-void XMLCALL
-XML_SetElementDeclHandler(XML_Parser p,
-			  XML_ElementDeclHandler eldecl);
-
-
-typedef void
-(XMLCALL *XML_ElementDeclHandler)(void *userData,
-                                  const XML_Char *name,
-                                  XML_Content *model);
-
-
-enum XML_Content_Type {
-  XML_CTYPE_EMPTY = 1,
-  XML_CTYPE_ANY,
-  XML_CTYPE_MIXED,
-  XML_CTYPE_NAME,
-  XML_CTYPE_CHOICE,
-  XML_CTYPE_SEQ
-};
-
-enum XML_Content_Quant {
-  XML_CQUANT_NONE,
-  XML_CQUANT_OPT,
-  XML_CQUANT_REP,
-  XML_CQUANT_PLUS
-};
-
-typedef struct XML_cp XML_Content;
-
-struct XML_cp {
-  enum XML_Content_Type		type;
-  enum XML_Content_Quant	quant;
-  const XML_Char *		name;
-  unsigned int			numchildren;
-  XML_Content *			children;
-};
-
-

Sets a handler for element declarations in a DTD. The handler gets -called with the name of the element in the declaration and a pointer -to a structure that contains the element model. It is the -application's responsibility to free this data structure using -XML_FreeContentModel.

- -

The model argument is the root of a tree of -XML_Content nodes. If type equals -XML_CTYPE_EMPTY or XML_CTYPE_ANY, then -quant will be XML_CQUANT_NONE, and the other -fields will be zero or NULL. If type is -XML_CTYPE_MIXED, then quant will be -XML_CQUANT_NONE or XML_CQUANT_REP and -numchildren will contain the number of elements that are -allowed to be mixed in and children points to an array of -XML_Content structures that will all have type -XML_CTYPE_NAME with no quantification. Only the root node can be type -XML_CTYPE_EMPTY, XML_CTYPE_ANY, or -XML_CTYPE_MIXED.

- -

For type XML_CTYPE_NAME, the name field -points to the name and the numchildren and -children fields will be zero and NULL. The -quant field will indicate any quantifiers placed on the -name.

- -

Types XML_CTYPE_CHOICE and XML_CTYPE_SEQ -indicate a choice or sequence respectively. The -numchildren field indicates how many nodes in the choice -or sequence and children points to the nodes.

-
- -
-
-void XMLCALL
-XML_SetAttlistDeclHandler(XML_Parser p,
-                          XML_AttlistDeclHandler attdecl);
-
-
-typedef void
-(XMLCALL *XML_AttlistDeclHandler)(void           *userData,
-                                  const XML_Char *elname,
-                                  const XML_Char *attname,
-                                  const XML_Char *att_type,
-                                  const XML_Char *dflt,
-                                  int            isrequired);
-
-

Set a handler for attlist declarations in the DTD. This handler is -called for each attribute. So a single attlist declaration -with multiple attributes declared will generate multiple calls to this -handler. The elname parameter returns the name of the -element for which the attribute is being declared. The attribute name -is in the attname parameter. The attribute type is in the -att_type parameter. It is the string representing the -type in the declaration with whitespace removed.

- -

The dflt parameter holds the default value. It will be -NULL in the case of "#IMPLIED" or "#REQUIRED" attributes. You can -distinguish these two cases by checking the isrequired -parameter, which will be true in the case of "#REQUIRED" attributes. -Attributes which are "#FIXED" will have also have a true -isrequired, but they will have the non-NULL fixed value -in the dflt parameter.

-
- -
-
-void XMLCALL
-XML_SetEntityDeclHandler(XML_Parser p,
-			 XML_EntityDeclHandler handler);
-
-
-typedef void
-(XMLCALL *XML_EntityDeclHandler)(void           *userData,
-                                 const XML_Char *entityName,
-                                 int            is_parameter_entity,
-                                 const XML_Char *value,
-                                 int            value_length, 
-                                 const XML_Char *base,
-                                 const XML_Char *systemId,
-                                 const XML_Char *publicId,
-                                 const XML_Char *notationName);
-
-

Sets a handler that will be called for all entity declarations. -The is_parameter_entity argument will be non-zero in the -case of parameter entities and zero otherwise.

- -

For internal entities (<!ENTITY foo "bar">), -value will be non-NULL and systemId, -publicId, and notationName will all be NULL. -The value string is not NULL terminated; the length is -provided in the value_length parameter. Do not use -value_length to test for internal entities, since it is -legal to have zero-length values. Instead check for whether or not -value is NULL.

The notationName -argument will have a non-NULL value only for unparsed entity -declarations.

-
- -
-
-void XMLCALL
-XML_SetUnparsedEntityDeclHandler(XML_Parser p,
-                                 XML_UnparsedEntityDeclHandler h)
-
-
-typedef void
-(XMLCALL *XML_UnparsedEntityDeclHandler)(void *userData,
-                                         const XML_Char *entityName, 
-                                         const XML_Char *base,
-                                         const XML_Char *systemId,
-                                         const XML_Char *publicId,
-                                         const XML_Char *notationName);
-
-

Set a handler that receives declarations of unparsed entities. These -are entity declarations that have a notation (NDATA) field:

- -
-<!ENTITY logo SYSTEM "images/logo.gif" NDATA gif>
-
-

This handler is obsolete and is provided for backwards -compatibility. Use instead XML_SetEntityDeclHandler.

-
- -
-
-void XMLCALL
-XML_SetNotationDeclHandler(XML_Parser p,
-                           XML_NotationDeclHandler h)
-
-
-typedef void
-(XMLCALL *XML_NotationDeclHandler)(void *userData, 
-                                   const XML_Char *notationName,
-                                   const XML_Char *base,
-                                   const XML_Char *systemId,
-                                   const XML_Char *publicId);
-
-

Set a handler that receives notation declarations.

-
- -
-
-void XMLCALL
-XML_SetNotStandaloneHandler(XML_Parser p,
-                            XML_NotStandaloneHandler h)
-
-
-typedef int 
-(XMLCALL *XML_NotStandaloneHandler)(void *userData);
-
-

Set a handler that is called if the document is not "standalone". -This happens when there is an external subset or a reference to a -parameter entity, but does not have standalone set to "yes" in an XML -declaration. If this handler returns XML_STATUS_ERROR, -then the parser will throw an XML_ERROR_NOT_STANDALONE -error.

-
- -

Parse position and error reporting functions

- -

These are the functions you'll want to call when the parse -functions return XML_STATUS_ERROR (a parse error has -occurred), although the position reporting functions are useful outside -of errors. The position reported is the byte position (in the original -document or entity encoding) of the first of the sequence of -characters that generated the current event (or the error that caused -the parse functions to return XML_STATUS_ERROR.) The -exceptions are callbacks trigged by declarations in the document -prologue, in which case they exact position reported is somewhere in the -relevant markup, but not necessarily as meaningful as for other -events.

- -

The position reporting functions are accurate only outside of the -DTD. In other words, they usually return bogus information when -called from within a DTD declaration handler.

- -
-enum XML_Error XMLCALL
-XML_GetErrorCode(XML_Parser p);
-
-
-Return what type of error has occurred. -
- -
-const XML_LChar * XMLCALL
-XML_ErrorString(enum XML_Error code);
-
-
-Return a string describing the error corresponding to code. -The code should be one of the enums that can be returned from -XML_GetErrorCode. -
- -
-XML_Index XMLCALL
-XML_GetCurrentByteIndex(XML_Parser p);
-
-
-Return the byte offset of the position. This always corresponds to -the values returned by XML_GetCurrentLineNumber and XML_GetCurrentColumnNumber. -
- -
-XML_Size XMLCALL
-XML_GetCurrentLineNumber(XML_Parser p);
-
-
-Return the line number of the position. The first line is reported as -1. -
- -
-XML_Size XMLCALL
-XML_GetCurrentColumnNumber(XML_Parser p);
-
-
-Return the offset, from the beginning of the current line, of -the position. -
- -
-int XMLCALL
-XML_GetCurrentByteCount(XML_Parser p);
-
-
-Return the number of bytes in the current event. Returns -0 if the event is inside a reference to an internal -entity and for the end-tag event for empty element tags (the later can -be used to distinguish empty-element tags from empty elements using -separate start and end tags). -
- -
-const char * XMLCALL
-XML_GetInputContext(XML_Parser p,
-                    int *offset,
-                    int *size);
-
-
- -

Returns the parser's input buffer, sets the integer pointed at by -offset to the offset within this buffer of the current -parse position, and set the integer pointed at by size to -the size of the returned buffer.

- -

This should only be called from within a handler during an active -parse and the returned buffer should only be referred to from within -the handler that made the call. This input buffer contains the -untranslated bytes of the input.

- -

Only a limited amount of context is kept, so if the event -triggering a call spans over a very large amount of input, the actual -parse position may be before the beginning of the buffer.

- -

If XML_CONTEXT_BYTES is not defined, this will always -return NULL.

-
- -

Miscellaneous functions

- -

The functions in this section either obtain state information from -the parser or can be used to dynamicly set parser options.

- -
-void XMLCALL
-XML_SetUserData(XML_Parser p,
-                void *userData);
-
-
-This sets the user data pointer that gets passed to handlers. It -overwrites any previous value for this pointer. Note that the -application is responsible for freeing the memory associated with -userData when it is finished with the parser. So if you -call this when there's already a pointer there, and you haven't freed -the memory associated with it, then you've probably just leaked -memory. -
- -
-void * XMLCALL
-XML_GetUserData(XML_Parser p);
-
-
-This returns the user data pointer that gets passed to handlers. -It is actually implemented as a macro. -
- -
-void XMLCALL
-XML_UseParserAsHandlerArg(XML_Parser p);
-
-
-After this is called, handlers receive the parser in their -userData arguments. The user data can still be obtained -using the XML_GetUserData function. -
- -
-enum XML_Status XMLCALL
-XML_SetBase(XML_Parser p,
-            const XML_Char *base);
-
-
-Set the base to be used for resolving relative URIs in system -identifiers. The return value is XML_STATUS_ERROR if -there's no memory to store base, otherwise it's -XML_STATUS_OK. -
- -
-const XML_Char * XMLCALL
-XML_GetBase(XML_Parser p);
-
-
-Return the base for resolving relative URIs. -
- -
-int XMLCALL
-XML_GetSpecifiedAttributeCount(XML_Parser p);
-
-
-When attributes are reported to the start handler in the atts vector, -attributes that were explicitly set in the element occur before any -attributes that receive their value from default information in an -ATTLIST declaration. This function returns the number of attributes -that were explicitly set times two, thus giving the offset in the -atts array passed to the start tag handler of the first -attribute set due to defaults. It supplies information for the last -call to a start handler. If called inside a start handler, then that -means the current call. -
- -
-int XMLCALL
-XML_GetIdAttributeIndex(XML_Parser p);
-
-
-Returns the index of the ID attribute passed in the atts array in the -last call to XML_StartElementHandler, or -1 if there is no ID -attribute. If called inside a start handler, then that means the -current call. -
- -
-const XML_AttrInfo * XMLCALL
-XML_GetAttributeInfo(XML_Parser parser);
-
-
-typedef struct {
-  XML_Index  nameStart;  /* Offset to beginning of the attribute name. */
-  XML_Index  nameEnd;    /* Offset after the attribute name's last byte. */
-  XML_Index  valueStart; /* Offset to beginning of the attribute value. */
-  XML_Index  valueEnd;   /* Offset after the attribute value's last byte. */
-} XML_AttrInfo;
-
-
-Returns an array of XML_AttrInfo structures for the -attribute/value pairs passed in the last call to the -XML_StartElementHandler that were specified -in the start-tag rather than defaulted. Each attribute/value pair counts -as 1; thus the number of entries in the array is -XML_GetSpecifiedAttributeCount(parser) / 2. -
- -
-enum XML_Status XMLCALL
-XML_SetEncoding(XML_Parser p,
-                const XML_Char *encoding);
-
-
-Set the encoding to be used by the parser. It is equivalent to -passing a non-null encoding argument to the parser creation functions. -It must not be called after XML_Parse or XML_ParseBuffer have been called on the given parser. -Returns XML_STATUS_OK on success or -XML_STATUS_ERROR on error. -
- -
-int XMLCALL
-XML_SetParamEntityParsing(XML_Parser p,
-                          enum XML_ParamEntityParsing code);
-
-
-This enables parsing of parameter entities, including the external -parameter entity that is the external DTD subset, according to -code. -The choices for code are: -
    -
  • XML_PARAM_ENTITY_PARSING_NEVER
  • -
  • XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE
  • -
  • XML_PARAM_ENTITY_PARSING_ALWAYS
  • -
-Note: If XML_SetParamEntityParsing is called after -XML_Parse or XML_ParseBuffer, then it has -no effect and will always return 0. -
- -
-int XMLCALL
-XML_SetHashSalt(XML_Parser p,
-                unsigned long hash_salt);
-
-
-Sets the hash salt to use for internal hash calculations. -Helps in preventing DoS attacks based on predicting hash -function behavior. In order to have an effect this must be called -before parsing has started. Returns 1 if successful, 0 when called -after XML_Parse or XML_ParseBuffer. -

Note: This call is optional, as the parser will auto-generate a new -random salt value if no value has been set at the start of parsing.

-
- -
-enum XML_Error XMLCALL
-XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD);
-
-
-

This function allows an application to provide an external subset -for the document type declaration for documents which do not specify -an external subset of their own. For documents which specify an -external subset in their DOCTYPE declaration, the application-provided -subset will be ignored. If the document does not contain a DOCTYPE -declaration at all and useDTD is true, the -application-provided subset will be parsed, but the -startDoctypeDeclHandler and -endDoctypeDeclHandler functions, if set, will not be -called. The setting of parameter entity parsing, controlled using -XML_SetParamEntityParsing, will be honored.

- -

The application-provided external subset is read by calling the -external entity reference handler set via XML_SetExternalEntityRefHandler with both -publicId and systemId set to NULL.

- -

If this function is called after parsing has begun, it returns -XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING and ignores -useDTD. If called when Expat has been compiled without -DTD support, it returns -XML_ERROR_FEATURE_REQUIRES_XML_DTD. Otherwise, it -returns XML_ERROR_NONE.

- -

Note: For the purpose of checking WFC: Entity Declared, passing -useDTD == XML_TRUE will make the parser behave as if -the document had a DTD with an external subset. This holds true even if -the external entity reference handler returns without action.

-
- -
-void XMLCALL
-XML_SetReturnNSTriplet(XML_Parser parser,
-                       int        do_nst);
-
-
-

-This function only has an effect when using a parser created with -XML_ParserCreateNS, -i.e. when namespace processing is in effect. The do_nst -sets whether or not prefixes are returned with names qualified with a -namespace prefix. If this function is called with do_nst -non-zero, then afterwards namespace qualified names (that is qualified -with a prefix as opposed to belonging to a default namespace) are -returned as a triplet with the three parts separated by the namespace -separator specified when the parser was created. The order of -returned parts is URI, local name, and prefix.

If -do_nst is zero, then namespaces are reported in the -default manner, URI then local_name separated by the namespace -separator.

-
- -
-void XMLCALL
-XML_DefaultCurrent(XML_Parser parser);
-
-
-This can be called within a handler for a start element, end element, -processing instruction or character data. It causes the corresponding -markup to be passed to the default handler set by XML_SetDefaultHandler or -XML_SetDefaultHandlerExpand. It does nothing if there is -not a default handler. -
- -
-XML_LChar * XMLCALL
-XML_ExpatVersion();
-
-
-Return the library version as a string (e.g. "expat_1.95.1"). -
- -
-struct XML_Expat_Version XMLCALL
-XML_ExpatVersionInfo();
-
-
-typedef struct {
-  int major;
-  int minor;
-  int micro;
-} XML_Expat_Version;
-
-
-Return the library version information as a structure. -Some macros are also defined that support compile-time tests of the -library version: -
    -
  • XML_MAJOR_VERSION
  • -
  • XML_MINOR_VERSION
  • -
  • XML_MICRO_VERSION
  • -
-Testing these constants is currently the best way to determine if -particular parts of the Expat API are available. -
- -
-const XML_Feature * XMLCALL
-XML_GetFeatureList();
-
-
-enum XML_FeatureEnum {
-  XML_FEATURE_END = 0,
-  XML_FEATURE_UNICODE,
-  XML_FEATURE_UNICODE_WCHAR_T,
-  XML_FEATURE_DTD,
-  XML_FEATURE_CONTEXT_BYTES,
-  XML_FEATURE_MIN_SIZE,
-  XML_FEATURE_SIZEOF_XML_CHAR,
-  XML_FEATURE_SIZEOF_XML_LCHAR,
-  XML_FEATURE_NS,
-  XML_FEATURE_LARGE_SIZE
-};
-
-typedef struct {
-  enum XML_FeatureEnum  feature;
-  XML_LChar            *name;
-  long int              value;
-} XML_Feature;
-
-
-

Returns a list of "feature" records, providing details on how -Expat was configured at compile time. Most applications should not -need to worry about this, but this information is otherwise not -available from Expat. This function allows code that does need to -check these features to do so at runtime.

- -

The return value is an array of XML_Feature, -terminated by a record with a feature of -XML_FEATURE_END and name of NULL, -identifying the feature-test macros Expat was compiled with. Since an -application that requires this kind of information needs to determine -the type of character the name points to, records for the -XML_FEATURE_SIZEOF_XML_CHAR and -XML_FEATURE_SIZEOF_XML_LCHAR will be located at the -beginning of the list, followed by XML_FEATURE_UNICODE -and XML_FEATURE_UNICODE_WCHAR_T, if they are present at -all.

- -

Some features have an associated value. If there isn't an -associated value, the value field is set to 0. At this -time, the following features have been defined to have values:

- -
-
XML_FEATURE_SIZEOF_XML_CHAR
-
The number of bytes occupied by one XML_Char - character.
-
XML_FEATURE_SIZEOF_XML_LCHAR
-
The number of bytes occupied by one XML_LChar - character.
-
XML_FEATURE_CONTEXT_BYTES
-
The maximum number of characters of context which can be - reported by XML_GetInputContext.
-
-
- -
-void XMLCALL
-XML_FreeContentModel(XML_Parser parser, XML_Content *model);
-
-
-Function to deallocate the model argument passed to the -XML_ElementDeclHandler callback set using XML_ElementDeclHandler. -This function should not be used for any other purpose. -
- -

The following functions allow external code to share the memory -allocator an XML_Parser has been configured to use. This -is especially useful for third-party libraries that interact with a -parser object created by application code, or heavily layered -applications. This can be essential when using dynamically loaded -libraries which use different C standard libraries (this can happen on -Windows, at least).

- -
-void * XMLCALL
-XML_MemMalloc(XML_Parser parser, size_t size);
-
-
-Allocate size bytes of memory using the allocator the -parser object has been configured to use. Returns a -pointer to the memory or NULL on failure. Memory allocated in this -way must be freed using XML_MemFree. -
- -
-void * XMLCALL
-XML_MemRealloc(XML_Parser parser, void *ptr, size_t size);
-
-
-Allocate size bytes of memory using the allocator the -parser object has been configured to use. -ptr must point to a block of memory allocated by XML_MemMalloc or -XML_MemRealloc, or be NULL. This function tries to -expand the block pointed to by ptr if possible. Returns -a pointer to the memory or NULL on failure. On success, the original -block has either been expanded or freed. On failure, the original -block has not been freed; the caller is responsible for freeing the -original block. Memory allocated in this way must be freed using -XML_MemFree. -
- -
-void XMLCALL
-XML_MemFree(XML_Parser parser, void *ptr);
-
-
-Free a block of memory pointed to by ptr. The block must -have been allocated by XML_MemMalloc or XML_MemRealloc, or be NULL. -
- -
-

Valid XHTML 1.0!

-
- - diff --git a/external/mit/expat/dist/doc/style.css b/external/mit/expat/dist/doc/style.css deleted file mode 100755 index 69df30bce..000000000 --- a/external/mit/expat/dist/doc/style.css +++ /dev/null @@ -1,101 +0,0 @@ -body { - background-color: white; - border: 0px; - margin: 0px; - padding: 0px; -} - -.corner { - width: 200px; - height: 80px; - text-align: center; -} - -.banner { - background-color: rgb(110,139,61); - color: rgb(255,236,176); - padding-left: 2em; -} - -.banner h1 { - font-size: 200%; -} - -.content { - padding: 0em 2em 1em 2em; -} - -.releaseno { - background-color: rgb(110,139,61); - color: rgb(255,236,176); - padding-bottom: 0.3em; - padding-top: 0.5em; - text-align: center; - font-weight: bold; -} - -.noborder { - border-width: 0px; -} - -.eg { - padding-left: 1em; - padding-top: .5em; - padding-bottom: .5em; - border: solid thin; - margin: 1em 0; - background-color: tan; - margin-left: 2em; - margin-right: 10%; -} - -.pseudocode { - padding-left: 1em; - padding-top: .5em; - padding-bottom: .5em; - border: solid thin; - margin: 1em 0; - background-color: rgb(250,220,180); - margin-left: 2em; - margin-right: 10%; -} - -.handler { - width: 100%; - border-top-width: thin; - margin-bottom: 1em; -} - -.handler p { - margin-left: 2em; -} - -.setter { - font-weight: bold; -} - -.signature { - color: navy; -} - -.fcndec { - width: 100%; - border-top-width: thin; - font-weight: bold; -} - -.fcndef { - margin-left: 2em; - margin-bottom: 2em; -} - -dd { - margin-bottom: 2em; -} - -.cpp-symbols dt { - font-family: monospace; -} -.cpp-symbols dd { - margin-bottom: 1em; -} diff --git a/external/mit/expat/dist/doc/valid-xhtml10.png b/external/mit/expat/dist/doc/valid-xhtml10.png deleted file mode 100755 index 4c23f48fe02a58fbb3d1088e6a7d372568830b53..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2368 zcmbVNX;2f{7H-8QAWIODU~n{oVqipj2Gj;zXrn-jfGsLCqYzsnPDF&p1zT|;Y|_rS zG$U$6T%rydH;kg#qJRP9(E@6_VH9x;sL%+GanDQ5do}fb&5w6(-TKbG-???Zuj*9Y zyvXoiJDXuP007v9hR9G0MqBm>ffWGsad*5W1AxA{kzr9YEtdwPktHFmR%@VOjSA)& zoWU@I3T8>tpwXyl(x5~21YyvkYJtGSU^GS0B#P4v2q8Gd&;Y=2MoP=_T2#YuoPk$q z^sK?iaz>G*Rw`f+2}zO|h6sfMihzU&g`o&R5IPzW2mqB5l!z<{sBloJRB9=hBOtvR zG4ni*7aZszoQI$?fGZ2KRb(~rN=#@$}0O&Ostz&hN2!bFDDiw(YGzpP7C=v>2 z0s=vhQ6pN3&|okCAj!~(PykR$5Rj5msZ>K@9LMP>m}OZbZ_?}aj0RIdQYo$`)C{9j zV=5i1!OSMk(%j5*I4Z>vDFCT>Jq~~>H3_Lz7)^j$8Y2mdY>cL9t=?cVn@uJ&Oln~S zVf1=Jt>=t9OlT>Jf?=WC}BuMC{d|INMN9uQ^KH#u(V^9Mg~J+ z39CUZq)~^NSX@P*COwW}m_-@{BYI4#qcH(OqbRCl4H8TZAe8y90F@eADFt8(A+-pC zkQNO(++gH!3^n}~oEC>+*r3%K8Jy>N2oxDD1v-ln6qE{SnnWNGsYF4Ekfulsk#Jgz zLIHtEdCO$L5;KQ$8k8a}I&rfeSE3S?mKBLaW}dLP6=Jm6NHA(lh|)SlA`}W4*1#|f zL}&yEg`x4lr}-7+3wMlqyF={n!T4V9EeMwS$Ii;hQ-5s#b|B-& z^0k*l@0<7rwu{X$l~;V6qOf-+-Z)Obd4U}D_8z_2@7au-G3OHKvyQVoL<7(6Uzppk z&GDM}&q#-oZcXiiH?z__HO>^+cSHCYkr=Oj&KaDoWCQW3U`x!sK~)9g$gdf2c4&Ni z?6=WkP3)S+*n-#grETtop`{*2LPpDF8)Qz_c*KyCEn~xuQKh&4dZx!4%?5Owj^wrHZNb`-KoZWZr0n-NbZyfPpZP1Pz?!j)p zA#oS|y0+~LvYk?~u6l_hboP3aXoT0Hw7?UOS4@4m` zla;1?MUFD#{O8zftHeEci3}{h+c~lNmhggf`n3v&y@|`E=jTjwLd9e9YqP9EV)CU) zn@SJ+9>=t`+i@5$X& zOBeezmLz^$vA#foB1=_E@Ao0R%F|+I8Gov(yZ3Q&SW#lM(4RXnpD#9yYOsxaJxM$y z!78@1s^M0))$*){Wwl6sfVzb#J$3rbsg#S$j!*Irnj5h`wOj1E^@G#F_+K+86-CPL z%Uc~9oW5ksb3cT&ZZGOL?COAJw|(2MPM^B7%KG!lfXg}Od>zV$*0=3@{poe$n^>oZ zH7nwKpNQl2p5eCpI?G<#NJPyiteboLKe@fVcwt0+AknetuD;JtT+6%#w>HfU{m$*$7tbeM1BWUc?BhDKavT?o_Xm$VDzO{fhUl-g4+v}5J?CesCp7o}6bHRC@XBLld<~&;{ zY{J|{xm6nB^Wdszc1HftOZyrR(@Pf>h7I=V*!!$-#`B8rd*^lCZw{ypv>cHaiN!w>szMg{>z%h_f_Id>mx^<^GRN#Xz zCqC>xeER9jv|qL-R{9b4JLfIx#IJOt(M<|J`QG|Uz9BR{&|p2tcDuvG#-?KT)_rZa zgRl!rLYIhNJ)ip0)hqc{Q&z$L;7##mN4{QF@IUf40qL1fh9Zpi|Xcd6q+U5hJ@_A^g(aNKfk|iGsv=R1`YZs oi4;OEvV%bfcgjD_ar)+RxUQtjXTTPP<@*6bXNJp8!|_}H4I+HVz5oCK diff --git a/external/mit/expat/dist/doc/xmlwf.1 b/external/mit/expat/dist/doc/xmlwf.1 deleted file mode 100755 index 174719a70..000000000 --- a/external/mit/expat/dist/doc/xmlwf.1 +++ /dev/null @@ -1,251 +0,0 @@ -.\" This manpage has been automatically generated by docbook2man -.\" from a DocBook document. This tool can be found at: -.\" -.\" Please send any bug reports, improvements, comments, patches, -.\" etc. to Steve Cheng . -.TH "XMLWF" "1" "24 January 2003" "" "" -.SH NAME -xmlwf \- Determines if an XML document is well-formed -.SH SYNOPSIS - -\fBxmlwf\fR [ \fB-s\fR] [ \fB-n\fR] [ \fB-p\fR] [ \fB-x\fR] [ \fB-e \fIencoding\fB\fR] [ \fB-w\fR] [ \fB-d \fIoutput-dir\fB\fR] [ \fB-c\fR] [ \fB-m\fR] [ \fB-r\fR] [ \fB-t\fR] [ \fB-v\fR] [ \fBfile ...\fR] - -.SH "DESCRIPTION" -.PP -\fBxmlwf\fR uses the Expat library to -determine if an XML document is well-formed. It is -non-validating. -.PP -If you do not specify any files on the command-line, and you -have a recent version of \fBxmlwf\fR, the -input file will be read from standard input. -.SH "WELL-FORMED DOCUMENTS" -.PP -A well-formed document must adhere to the -following rules: -.TP 0.2i -\(bu -The file begins with an XML declaration. For instance, -. -\fBNOTE:\fR -\fBxmlwf\fR does not currently -check for a valid XML declaration. -.TP 0.2i -\(bu -Every start tag is either empty () -or has a corresponding end tag. -.TP 0.2i -\(bu -There is exactly one root element. This element must contain -all other elements in the document. Only comments, white -space, and processing instructions may come after the close -of the root element. -.TP 0.2i -\(bu -All elements nest properly. -.TP 0.2i -\(bu -All attribute values are enclosed in quotes (either single -or double). -.PP -If the document has a DTD, and it strictly complies with that -DTD, then the document is also considered \fBvalid\fR. -\fBxmlwf\fR is a non-validating parser -- -it does not check the DTD. However, it does support -external entities (see the \fB-x\fR option). -.SH "OPTIONS" -.PP -When an option includes an argument, you may specify the argument either -separately ("\fB-d\fR output") or concatenated with the -option ("\fB-d\fRoutput"). \fBxmlwf\fR -supports both. -.TP -\fB-c\fR -If the input file is well-formed and \fBxmlwf\fR -doesn't encounter any errors, the input file is simply copied to -the output directory unchanged. -This implies no namespaces (turns off \fB-n\fR) and -requires \fB-d\fR to specify an output file. -.TP -\fB-d output-dir\fR -Specifies a directory to contain transformed -representations of the input files. -By default, \fB-d\fR outputs a canonical representation -(described below). -You can select different output formats using \fB-c\fR -and \fB-m\fR. - -The output filenames will -be exactly the same as the input filenames or "STDIN" if the input is -coming from standard input. Therefore, you must be careful that the -output file does not go into the same directory as the input -file. Otherwise, \fBxmlwf\fR will delete the -input file before it generates the output file (just like running -cat < file > file in most shells). - -Two structurally equivalent XML documents have a byte-for-byte -identical canonical XML representation. -Note that ignorable white space is considered significant and -is treated equivalently to data. -More on canonical XML can be found at -http://www.jclark.com/xml/canonxml.html . -.TP -\fB-e encoding\fR -Specifies the character encoding for the document, overriding -any document encoding declaration. \fBxmlwf\fR -supports four built-in encodings: -US-ASCII, -UTF-8, -UTF-16, and -ISO-8859-1. -Also see the \fB-w\fR option. -.TP -\fB-m\fR -Outputs some strange sort of XML file that completely -describes the input file, including character positions. -Requires \fB-d\fR to specify an output file. -.TP -\fB-n\fR -Turns on namespace processing. (describe namespaces) -\fB-c\fR disables namespaces. -.TP -\fB-p\fR -Tells xmlwf to process external DTDs and parameter -entities. - -Normally \fBxmlwf\fR never parses parameter -entities. \fB-p\fR tells it to always parse them. -\fB-p\fR implies \fB-x\fR. -.TP -\fB-r\fR -Normally \fBxmlwf\fR memory-maps the XML file -before parsing; this can result in faster parsing on many -platforms. -\fB-r\fR turns off memory-mapping and uses normal file -IO calls instead. -Of course, memory-mapping is automatically turned off -when reading from standard input. - -Use of memory-mapping can cause some platforms to report -substantially higher memory usage for -\fBxmlwf\fR, but this appears to be a matter of -the operating system reporting memory in a strange way; there is -not a leak in \fBxmlwf\fR. -.TP -\fB-s\fR -Prints an error if the document is not standalone. -A document is standalone if it has no external subset and no -references to parameter entities. -.TP -\fB-t\fR -Turns on timings. This tells Expat to parse the entire file, -but not perform any processing. -This gives a fairly accurate idea of the raw speed of Expat itself -without client overhead. -\fB-t\fR turns off most of the output options -(\fB-d\fR, \fB-m\fR, \fB-c\fR, -\&...). -.TP -\fB-v\fR -Prints the version of the Expat library being used, including some -information on the compile-time configuration of the library, and -then exits. -.TP -\fB-w\fR -Enables support for Windows code pages. -Normally, \fBxmlwf\fR will throw an error if it -runs across an encoding that it is not equipped to handle itself. With -\fB-w\fR, xmlwf will try to use a Windows code -page. See also \fB-e\fR. -.TP -\fB-x\fR -Turns on parsing external entities. - -Non-validating parsers are not required to resolve external -entities, or even expand entities at all. -Expat always expands internal entities (?), -but external entity parsing must be enabled explicitly. - -External entities are simply entities that obtain their -data from outside the XML file currently being parsed. - -This is an example of an internal entity: - -.nf - -.fi - -And here are some examples of external entities: - -.nf - (parsed) - (unparsed) -.fi -.TP -\fB--\fR -(Two hyphens.) -Terminates the list of options. This is only needed if a filename -starts with a hyphen. For example: - -.nf -xmlwf -- -myfile.xml -.fi - -will run \fBxmlwf\fR on the file -\fI-myfile.xml\fR. -.PP -Older versions of \fBxmlwf\fR do not support -reading from standard input. -.SH "OUTPUT" -.PP -If an input file is not well-formed, -\fBxmlwf\fR prints a single line describing -the problem to standard output. If a file is well formed, -\fBxmlwf\fR outputs nothing. -Note that the result code is \fBnot\fR set. -.SH "BUGS" -.PP -According to the W3C standard, an XML file without a -declaration at the beginning is not considered well-formed. -However, \fBxmlwf\fR allows this to pass. -.PP -\fBxmlwf\fR returns a 0 - noerr result, -even if the file is not well-formed. There is no good way for -a program to use \fBxmlwf\fR to quickly -check a file -- it must parse \fBxmlwf\fR's -standard output. -.PP -The errors should go to standard error, not standard output. -.PP -There should be a way to get \fB-d\fR to send its -output to standard output rather than forcing the user to send -it to a file. -.PP -I have no idea why anyone would want to use the -\fB-d\fR, \fB-c\fR, and -\fB-m\fR options. If someone could explain it to -me, I'd like to add this information to this manpage. -.SH "ALTERNATIVES" -.PP -Here are some XML validators on the web: - -.nf -http://www.hcrc.ed.ac.uk/~richard/xml-check.html -http://www.stg.brown.edu/service/xmlvalid/ -http://www.scripting.com/frontier5/xml/code/xmlValidator.html -http://www.xml.com/pub/a/tools/ruwf/check.html -.fi -.SH "SEE ALSO" -.PP - -.nf -The Expat home page: http://www.libexpat.org/ -The W3 XML specification: http://www.w3.org/TR/REC-xml -.fi -.SH "AUTHOR" -.PP -This manual page was written by Scott Bronson for -the Debian GNU/Linux system (but may be used by others). Permission is -granted to copy, distribute and/or modify this document under -the terms of the GNU Free Documentation -License, Version 1.1. diff --git a/external/mit/expat/dist/doc/xmlwf.sgml b/external/mit/expat/dist/doc/xmlwf.sgml deleted file mode 100755 index 313cfbcb2..000000000 --- a/external/mit/expat/dist/doc/xmlwf.sgml +++ /dev/null @@ -1,468 +0,0 @@ - manpage.1'. You may view - the manual page with: `docbook-to-man manpage.sgml | nroff -man | - less'. A typical entry in a Makefile or Makefile.am is: - -manpage.1: manpage.sgml - docbook-to-man $< > $@ - --> - - - Scott"> - Bronson"> - - December 5, 2001"> - - 1"> - bronson@rinspin.com"> - - XMLWF"> - - - Debian GNU/Linux"> - GNU"> -]> - - - -
- &dhemail; -
- - &dhfirstname; - &dhsurname; - - - 2001 - &dhusername; - - &dhdate; -
- - &dhucpackage; - - &dhsection; - - - &dhpackage; - - Determines if an XML document is well-formed - - - - &dhpackage; - - - - - - - - - - - - - - - - - - file ... - - - - - DESCRIPTION - - - &dhpackage; uses the Expat library to - determine if an XML document is well-formed. It is - non-validating. - - - - If you do not specify any files on the command-line, and you - have a recent version of &dhpackage;, the - input file will be read from standard input. - - - - - - WELL-FORMED DOCUMENTS - - - A well-formed document must adhere to the - following rules: - - - - - The file begins with an XML declaration. For instance, - <?xml version="1.0" standalone="yes"?>. - NOTE: - &dhpackage; does not currently - check for a valid XML declaration. - - - Every start tag is either empty (<tag/>) - or has a corresponding end tag. - - - There is exactly one root element. This element must contain - all other elements in the document. Only comments, white - space, and processing instructions may come after the close - of the root element. - - - All elements nest properly. - - - All attribute values are enclosed in quotes (either single - or double). - - - - - If the document has a DTD, and it strictly complies with that - DTD, then the document is also considered valid. - &dhpackage; is a non-validating parser -- - it does not check the DTD. However, it does support - external entities (see the option). - - - - - OPTIONS - - -When an option includes an argument, you may specify the argument either -separately (" output") or concatenated with the -option ("output"). &dhpackage; -supports both. - - - - - - - - - If the input file is well-formed and &dhpackage; - doesn't encounter any errors, the input file is simply copied to - the output directory unchanged. - This implies no namespaces (turns off ) and - requires to specify an output file. - - - - - - - - - Specifies a directory to contain transformed - representations of the input files. - By default, outputs a canonical representation - (described below). - You can select different output formats using - and . - - - The output filenames will - be exactly the same as the input filenames or "STDIN" if the input is - coming from standard input. Therefore, you must be careful that the - output file does not go into the same directory as the input - file. Otherwise, &dhpackage; will delete the - input file before it generates the output file (just like running - cat < file > file in most shells). - - - Two structurally equivalent XML documents have a byte-for-byte - identical canonical XML representation. - Note that ignorable white space is considered significant and - is treated equivalently to data. - More on canonical XML can be found at - http://www.jclark.com/xml/canonxml.html . - - - - - - - - - Specifies the character encoding for the document, overriding - any document encoding declaration. &dhpackage; - supports four built-in encodings: - US-ASCII, - UTF-8, - UTF-16, and - ISO-8859-1. - Also see the option. - - - - - - - - - Outputs some strange sort of XML file that completely - describes the the input file, including character postitions. - Requires to specify an output file. - - - - - - - - - Turns on namespace processing. (describe namespaces) - disables namespaces. - - - - - - - - - Tells xmlwf to process external DTDs and parameter - entities. - - - Normally &dhpackage; never parses parameter - entities. tells it to always parse them. - implies . - - - - - - - - - Normally &dhpackage; memory-maps the XML file - before parsing; this can result in faster parsing on many - platforms. - turns off memory-mapping and uses normal file - IO calls instead. - Of course, memory-mapping is automatically turned off - when reading from standard input. - - - Use of memory-mapping can cause some platforms to report - substantially higher memory usage for - &dhpackage;, but this appears to be a matter of - the operating system reporting memory in a strange way; there is - not a leak in &dhpackage;. - - - - - - - - - Prints an error if the document is not standalone. - A document is standalone if it has no external subset and no - references to parameter entities. - - - - - - - - - Turns on timings. This tells Expat to parse the entire file, - but not perform any processing. - This gives a fairly accurate idea of the raw speed of Expat itself - without client overhead. - turns off most of the output options - (, , , - ...). - - - - - - - - - Prints the version of the Expat library being used, including some - information on the compile-time configuration of the library, and - then exits. - - - - - - - - - Enables support for Windows code pages. - Normally, &dhpackage; will throw an error if it - runs across an encoding that it is not equipped to handle itself. With - , &dhpackage; will try to use a Windows code - page. See also . - - - - - - - - - Turns on parsing external entities. - - - Non-validating parsers are not required to resolve external - entities, or even expand entities at all. - Expat always expands internal entities (?), - but external entity parsing must be enabled explicitly. - - - External entities are simply entities that obtain their - data from outside the XML file currently being parsed. - - - This is an example of an internal entity: - -<!ENTITY vers '1.0.2'> - - - - And here are some examples of external entities: - - -<!ENTITY header SYSTEM "header-&vers;.xml"> (parsed) -<!ENTITY logo SYSTEM "logo.png" PNG> (unparsed) - - - - - - - - - - - (Two hyphens.) - Terminates the list of options. This is only needed if a filename - starts with a hyphen. For example: - - -&dhpackage; -- -myfile.xml - - - will run &dhpackage; on the file - -myfile.xml. - - - - - - - Older versions of &dhpackage; do not support - reading from standard input. - - - - - OUTPUT - - If an input file is not well-formed, - &dhpackage; prints a single line describing - the problem to standard output. If a file is well formed, - &dhpackage; outputs nothing. - Note that the result code is not set. - - - - - BUGS - - &dhpackage; returns a 0 - noerr result, - even if the file is not well-formed. There is no good way for - a program to use &dhpackage; to quickly - check a file -- it must parse &dhpackage;'s - standard output. - - - The errors should go to standard error, not standard output. - - - There should be a way to get to send its - output to standard output rather than forcing the user to send - it to a file. - - - I have no idea why anyone would want to use the - , , and - options. If someone could explain it to - me, I'd like to add this information to this manpage. - - - - - ALTERNATIVES - - Here are some XML validators on the web: - - -http://www.hcrc.ed.ac.uk/~richard/xml-check.html -http://www.stg.brown.edu/service/xmlvalid/ -http://www.scripting.com/frontier5/xml/code/xmlValidator.html -http://www.xml.com/pub/a/tools/ruwf/check.html - - - - - - - SEE ALSO - - - -The Expat home page: http://www.libexpat.org/ -The W3 XML specification: http://www.w3.org/TR/REC-xml - - - - - - - AUTHOR - - This manual page was written by &dhusername; &dhemail; for - the &debian; system (but may be used by others). Permission is - granted to copy, distribute and/or modify this document under - the terms of the GNU Free Documentation - License, Version 1.1. - - -
- - diff --git a/external/mit/expat/dist/examples/elements.c b/external/mit/expat/dist/examples/elements.c deleted file mode 100755 index 6b8f85501..000000000 --- a/external/mit/expat/dist/examples/elements.c +++ /dev/null @@ -1,65 +0,0 @@ -/* This is simple demonstration of how to use expat. This program - reads an XML document from standard input and writes a line with - the name of each element to standard output indenting child - elements by one tab stop more than their parent element. - It must be used with Expat compiled for UTF-8 output. -*/ - -#include -#include "expat.h" - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - -#ifdef XML_LARGE_SIZE -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -#define XML_FMT_INT_MOD "I64" -#else -#define XML_FMT_INT_MOD "ll" -#endif -#else -#define XML_FMT_INT_MOD "l" -#endif - -static void XMLCALL -startElement(void *userData, const char *name, const char **atts) -{ - int i; - int *depthPtr = (int *)userData; - for (i = 0; i < *depthPtr; i++) - putchar('\t'); - puts(name); - *depthPtr += 1; -} - -static void XMLCALL -endElement(void *userData, const char *name) -{ - int *depthPtr = (int *)userData; - *depthPtr -= 1; -} - -int -main(int argc, char *argv[]) -{ - char buf[BUFSIZ]; - XML_Parser parser = XML_ParserCreate(NULL); - int done; - int depth = 0; - XML_SetUserData(parser, &depth); - XML_SetElementHandler(parser, startElement, endElement); - do { - int len = (int)fread(buf, 1, sizeof(buf), stdin); - done = len < sizeof(buf); - if (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) { - fprintf(stderr, - "%s at line %" XML_FMT_INT_MOD "u\n", - XML_ErrorString(XML_GetErrorCode(parser)), - XML_GetCurrentLineNumber(parser)); - return 1; - } - } while (!done); - XML_ParserFree(parser); - return 0; -} diff --git a/external/mit/expat/dist/examples/elements.dsp b/external/mit/expat/dist/examples/elements.dsp deleted file mode 100755 index d3fa3682c..000000000 --- a/external/mit/expat/dist/examples/elements.dsp +++ /dev/null @@ -1,103 +0,0 @@ -# Microsoft Developer Studio Project File - Name="elements" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=elements - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "elements.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "elements.mak" CFG="elements - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "elements - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "elements - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "elements - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release-elements" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /D "XML_STATIC" /FD /c -# SUBTRACT CPP /X /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 -# ADD LINK32 libexpatMT.lib /nologo /subsystem:console /pdb:none /machine:I386 /libpath:"..\win32\bin\Release" /out:"..\win32\bin\Release\elements.exe" - -!ELSEIF "$(CFG)" == "elements - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug-elements" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\lib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /D "XML_STATIC" /FR /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libexpatMT.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:"..\win32\bin\Debug" /out:"..\win32\bin\Debug\elements.exe" - -!ENDIF - -# Begin Target - -# Name "elements - Win32 Release" -# Name "elements - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\elements.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/external/mit/expat/dist/examples/outline.c b/external/mit/expat/dist/examples/outline.c deleted file mode 100755 index 3a3c83855..000000000 --- a/external/mit/expat/dist/examples/outline.c +++ /dev/null @@ -1,106 +0,0 @@ -/***************************************************************** - * outline.c - * - * Copyright 1999, Clark Cooper - * All rights reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the license contained in the - * COPYING file that comes with the expat distribution. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Read an XML document from standard input and print an element - * outline on standard output. - * Must be used with Expat compiled for UTF-8 output. - */ - - -#include -#include - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - -#ifdef XML_LARGE_SIZE -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -#define XML_FMT_INT_MOD "I64" -#else -#define XML_FMT_INT_MOD "ll" -#endif -#else -#define XML_FMT_INT_MOD "l" -#endif - -#define BUFFSIZE 8192 - -char Buff[BUFFSIZE]; - -int Depth; - -static void XMLCALL -start(void *data, const char *el, const char **attr) -{ - int i; - - for (i = 0; i < Depth; i++) - printf(" "); - - printf("%s", el); - - for (i = 0; attr[i]; i += 2) { - printf(" %s='%s'", attr[i], attr[i + 1]); - } - - printf("\n"); - Depth++; -} - -static void XMLCALL -end(void *data, const char *el) -{ - Depth--; -} - -int -main(int argc, char *argv[]) -{ - XML_Parser p = XML_ParserCreate(NULL); - if (! p) { - fprintf(stderr, "Couldn't allocate memory for parser\n"); - exit(-1); - } - - XML_SetElementHandler(p, start, end); - - for (;;) { - int done; - int len; - - len = (int)fread(Buff, 1, BUFFSIZE, stdin); - if (ferror(stdin)) { - fprintf(stderr, "Read error\n"); - exit(-1); - } - done = feof(stdin); - - if (XML_Parse(p, Buff, len, done) == XML_STATUS_ERROR) { - fprintf(stderr, "Parse error at line %" XML_FMT_INT_MOD "u:\n%s\n", - XML_GetCurrentLineNumber(p), - XML_ErrorString(XML_GetErrorCode(p))); - exit(-1); - } - - if (done) - break; - } - XML_ParserFree(p); - return 0; -} diff --git a/external/mit/expat/dist/examples/outline.dsp b/external/mit/expat/dist/examples/outline.dsp deleted file mode 100755 index 0c063fd4e..000000000 --- a/external/mit/expat/dist/examples/outline.dsp +++ /dev/null @@ -1,103 +0,0 @@ -# Microsoft Developer Studio Project File - Name="outline" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=outline - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "outline.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "outline.mak" CFG="outline - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "outline - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "outline - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "outline - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release-outline" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /FD /c -# SUBTRACT CPP /X /YX -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 -# ADD LINK32 libexpat.lib /nologo /subsystem:console /pdb:none /machine:I386 /libpath:"..\win32\bin\Release" /out:"..\win32\bin\Release\outline.exe" - -!ELSEIF "$(CFG)" == "outline - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug-outline" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /I "..\lib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FD /GZ /c -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libexpat.lib /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:"..\win32\bin\Debug" /out:"..\win32\bin\Debug\outline.exe" - -!ENDIF - -# Begin Target - -# Name "outline - Win32 Release" -# Name "outline - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\outline.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/external/mit/expat/dist/expat.dsw b/external/mit/expat/dist/expat.dsw deleted file mode 100755 index 9282da5a7..000000000 --- a/external/mit/expat/dist/expat.dsw +++ /dev/null @@ -1,110 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "elements"=.\examples\elements.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat_static - End Project Dependency -}}} - -############################################################################### - -Project: "expat"=.\lib\expat.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expat_static"=.\lib\expat_static.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expatw"=.\lib\expatw.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "expatw_static"=.\lib\expatw_static.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Project: "outline"=.\examples\outline.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat - End Project Dependency -}}} - -############################################################################### - -Project: "xmlwf"=.\xmlwf\xmlwf.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat - End Project Dependency -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/external/mit/expat/dist/expat.pc.in b/external/mit/expat/dist/expat.pc.in deleted file mode 100644 index 5207e3e1b..000000000 --- a/external/mit/expat/dist/expat.pc.in +++ /dev/null @@ -1,11 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: expat -Version: @PACKAGE_VERSION@ -Description: expat XML parser -URL: http://www.libexpat.org -Libs: -L${libdir} -lexpat -Cflags: -I${includedir} diff --git a/external/mit/expat/dist/expat_config.h.cmake b/external/mit/expat/dist/expat_config.h.cmake deleted file mode 100755 index e5147915b..000000000 --- a/external/mit/expat/dist/expat_config.h.cmake +++ /dev/null @@ -1,91 +0,0 @@ -/* expat_config.h.in. Generated from configure.in by autoheader. */ - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#cmakedefine BYTEORDER @BYTEORDER@ - -/* Define to 1 if you have the `bcopy' function. */ -#cmakedefine HAVE_BCOPY - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_FCNTL_H - -/* Define to 1 if you have the `getpagesize' function. */ -#cmakedefine HAVE_GETPAGESIZE - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_INTTYPES_H - -/* Define to 1 if you have the `memmove' function. */ -#cmakedefine HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_MEMORY_H - -/* Define to 1 if you have a working `mmap' system call. */ -#cmakedefine HAVE_MMAP - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#cmakedefine HAVE_UNISTD_H - -/* Define to the address where bug reports for this package should be sent. */ -#cmakedefine PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#cmakedefine PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#cmakedefine PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#cmakedefine PACKAGE_TARNAME - -/* Define to the version of this package. */ -#cmakedefine PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#cmakedefine STDC_HEADERS - -/* whether byteorder is bigendian */ -#cmakedefine WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#cmakedefine XML_CONTEXT_BYTES @XML_CONTEXT_BYTES@ - -/* Define to make parameter entity parsing functionality available. */ -#cmakedefine XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#cmakedefine XML_NS - -/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ -#ifdef _MSC_VER -# define __func__ __FUNCTION__ -#endif - -/* Define to `long' if does not define. */ -#cmakedefine off_t @OFF_T@ - -/* Define to `unsigned' if does not define. */ -#cmakedefine size_t @SIZE_T@ diff --git a/external/mit/expat/dist/expat_config.h.in b/external/mit/expat/dist/expat_config.h.in deleted file mode 100755 index 8c6e51409..000000000 --- a/external/mit/expat/dist/expat_config.h.in +++ /dev/null @@ -1,102 +0,0 @@ -/* expat_config.h.in. Generated from configure.in by autoheader. */ - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#undef BYTEORDER - -/* Define to 1 if you have the `bcopy' function. */ -#undef HAVE_BCOPY - -/* Define to 1 if you have the header file. */ -#undef HAVE_DLFCN_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_FCNTL_H - -/* Define to 1 if you have the `getpagesize' function. */ -#undef HAVE_GETPAGESIZE - -/* Define to 1 if you have the header file. */ -#undef HAVE_INTTYPES_H - -/* Define to 1 if you have the `memmove' function. */ -#undef HAVE_MEMMOVE - -/* Define to 1 if you have the header file. */ -#undef HAVE_MEMORY_H - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDINT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STDLIB_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRINGS_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_STRING_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_PARAM_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_STAT_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_SYS_TYPES_H - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#undef LT_OBJDIR - -/* Define to the address where bug reports for this package should be sent. */ -#undef PACKAGE_BUGREPORT - -/* Define to the full name of this package. */ -#undef PACKAGE_NAME - -/* Define to the full name and version of this package. */ -#undef PACKAGE_STRING - -/* Define to the one symbol short name of this package. */ -#undef PACKAGE_TARNAME - -/* Define to the home page for this package. */ -#undef PACKAGE_URL - -/* Define to the version of this package. */ -#undef PACKAGE_VERSION - -/* Define to 1 if you have the ANSI C header files. */ -#undef STDC_HEADERS - -/* whether byteorder is bigendian */ -#undef WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#undef XML_CONTEXT_BYTES - -/* Define to make parameter entity parsing functionality available. */ -#undef XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#undef XML_NS - -/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ -#undef __func__ - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `long int' if does not define. */ -#undef off_t - -/* Define to `unsigned int' if does not define. */ -#undef size_t diff --git a/external/mit/expat/dist/lib/Makefile.MPW b/external/mit/expat/dist/lib/Makefile.MPW deleted file mode 100755 index 046af0051..000000000 --- a/external/mit/expat/dist/lib/Makefile.MPW +++ /dev/null @@ -1,206 +0,0 @@ -# File: Makefile.MPW -# Targets: All, Dynamic, Static (and Clean, Clean-All) -# Created: Tuesday, July 02, 2002 -# -# MPW Makefile for building expat under the "classic" (i.e. pre-X) Mac OS -# Copyright © 2002 Daryle Walker -# Portions Copyright © 2002 Thomas Wegner -# See the COPYING file for distribution information -# -# Description: -# This Makefile lets you build static, dynamic (i.e. shared) and stub -# versions of the expat library as well as the elements.c and outline.c -# examples (built as tools for MPW). This is for PPC only; it should be -# no problem to build a 68K version of the expat library, though. -# -# Usage: -# Buildprogram All -# or Buildprogram Dynamic -# or Buildprogram Static -# -# Note: You first have to rename this file to "Makefile", or the Buildprogram -# commando will not recognize it. -# - -MAKEFILE = Makefile -¥MondoBuild¥ = {MAKEFILE} # Make blank to avoid rebuilds when makefile is modified - -ObjDir = : -SrcDir = : -HdrDir = : - -ToolDir = ::examples: - -Includes = -i {HdrDir} - -Sym-PPC = -sym off - -Defines = -d MACOS_CLASSIC - -PPCCOptions = {Includes} {Sym-PPC} -w 35 {Defines} - -FragName = libexpat - - -### Source Files ### - -SrcFiles = ¶ - "{SrcDir}xmlparse.c" ¶ - "{SrcDir}xmlrole.c" ¶ - "{SrcDir}xmltok.c" - -ToolSrcFiles = ¶ - "{ToolDir}elements.c" ¶ - "{ToolDir}outline.c" - - -### Object Files ### - -ObjFiles-PPC = ¶ - "{ObjDir}xmlparse.c.o" ¶ - "{ObjDir}xmlrole.c.o" ¶ - "{ObjDir}xmltok.c.o" - -ElementToolObjFile = "{ObjDir}elements.c.o" - -OutlineToolObjFile = "{ObjDir}outline.c.o" - - -### Libraries ### - -StLibFiles-PPC = ¶ - "{PPCLibraries}StdCRuntime.o" ¶ - "{PPCLibraries}PPCCRuntime.o" ¶ - "{PPCLibraries}PPCToolLibs.o" - -ShLibFiles-PPC = ¶ - "{SharedLibraries}InterfaceLib" ¶ - "{SharedLibraries}StdCLib" ¶ - "{SharedLibraries}MathLib" - -LibFiles-PPC = ¶ - {StLibFiles-PPC} ¶ - {ShLibFiles-PPC} - - -### Special Files ### - -ExportFile = "{ObjDir}{FragName}.exp" - -StLibFile = "{ObjDir}{FragName}.MrC.o" - -ShLibFile = "{ObjDir}{FragName}" - -StubFile = "{ObjDir}{FragName}.stub" - -ElementsTool = "{ToolDir}elements" - -OutlineTool = "{ToolDir}outline" - - -### Default Rules ### - -.c.o Ä .c {¥MondoBuild¥} - {PPCC} {depDir}{default}.c -o {targDir}{default}.c.o {PPCCOptions} - - -### Build Rules ### - -All Ä Dynamic {ElementsTool} {OutlineTool} - -Static Ä {StLibFile} - -Dynamic Ä Static {ShLibFile} {StubFile} - -{StLibFile} ÄÄ {ObjFiles-PPC} {StLibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {ObjFiles-PPC} ¶ - {StLibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'XCOF' ¶ - -c 'MPS ' ¶ - -xm l - -{ShLibFile} ÄÄ {StLibFile} {ShLibFiles-PPC} {ExportFile} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {StLibFile} ¶ - {ShLibFiles-PPC} ¶ - {Sym-PPC} ¶ - -@export {ExportFile} ¶ - -fragname {FragName} ¶ - -mf -d ¶ - -t 'shlb' ¶ - -c '????' ¶ - -xm s - -{StubFile} ÄÄ {ShLibFile} {¥MondoBuild¥} - shlb2stub -o {Targ} {ShLibFile} - -{ElementsTool} ÄÄ {ElementToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {ElementToolObjFile} ¶ - {StLibFile} ¶ - {LibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'MPST' ¶ - -c 'MPS ' - -{OutlineTool} ÄÄ {OutlineToolObjFile} {StubFile} {LibFiles-PPC} {¥MondoBuild¥} - PPCLink ¶ - -o {Targ} ¶ - {OutlineToolObjFile} ¶ - {StLibFile} ¶ - {LibFiles-PPC} ¶ - {Sym-PPC} ¶ - -mf -d ¶ - -t 'MPST' ¶ - -c 'MPS ' - - -### Special Rules ### - -{ExportFile} ÄÄ "{HdrDir}expat.h" {¥MondoBuild¥} - StreamEdit -d ¶ - -e "/¥('XMLPARSEAPI('Å') ')Ç0,1È'XML_'([A-Za-z0-9_]+)¨1'('/ Print 'XML_' ¨1" ¶ - "{HdrDir}expat.h" > {Targ} - - -### Required Dependencies ### - -"{ObjDir}xmlparse.c.o" Ä "{SrcDir}xmlparse.c" -"{ObjDir}xmlrole.c.o" Ä "{SrcDir}xmlrole.c" -"{ObjDir}xmltok.c.o" Ä "{SrcDir}xmltok.c" - -"{ObjDir}elements.c.o" Ä "{ToolDir}elements.c" -"{ObjDir}outline.c.o" Ä "{ToolDir}outline.c" - - -### Optional Dependencies ### -### Build this target to clean out generated intermediate files. ### - -Clean Ä - Delete {ObjFiles-PPC} {ExportFile} {ElementToolObjFile} {OutlineToolObjFile} - -### Build this target to clean out all generated files. ### - -Clean-All Ä Clean - Delete {StLibFile} {ShLibFile} {StubFile} {ElementsTool} {OutlineTool} - -### Build this target to generate "include file" dependencies. ### - -Dependencies Ä $OutOfDate - MakeDepend ¶ - -append {MAKEFILE} ¶ - -ignore "{CIncludes}" ¶ - -objdir "{ObjDir}" ¶ - -objext .o ¶ - {Defines} ¶ - {Includes} ¶ - {SrcFiles} - - diff --git a/external/mit/expat/dist/lib/amigaconfig.h b/external/mit/expat/dist/lib/amigaconfig.h deleted file mode 100755 index 86c611504..000000000 --- a/external/mit/expat/dist/lib/amigaconfig.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef AMIGACONFIG_H -#define AMIGACONFIG_H - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 4321 - -/* Define to 1 if you have the `bcopy' function. */ -#define HAVE_BCOPY 1 - -/* Define to 1 if you have the header file. */ -#undef HAVE_CHECK_H - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* whether byteorder is bigendian */ -#define WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#define XML_CONTEXT_BYTES 1024 - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS - -#endif /* AMIGACONFIG_H */ diff --git a/external/mit/expat/dist/lib/ascii.h b/external/mit/expat/dist/lib/ascii.h deleted file mode 100755 index d10530b09..000000000 --- a/external/mit/expat/dist/lib/ascii.h +++ /dev/null @@ -1,92 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#define ASCII_A 0x41 -#define ASCII_B 0x42 -#define ASCII_C 0x43 -#define ASCII_D 0x44 -#define ASCII_E 0x45 -#define ASCII_F 0x46 -#define ASCII_G 0x47 -#define ASCII_H 0x48 -#define ASCII_I 0x49 -#define ASCII_J 0x4A -#define ASCII_K 0x4B -#define ASCII_L 0x4C -#define ASCII_M 0x4D -#define ASCII_N 0x4E -#define ASCII_O 0x4F -#define ASCII_P 0x50 -#define ASCII_Q 0x51 -#define ASCII_R 0x52 -#define ASCII_S 0x53 -#define ASCII_T 0x54 -#define ASCII_U 0x55 -#define ASCII_V 0x56 -#define ASCII_W 0x57 -#define ASCII_X 0x58 -#define ASCII_Y 0x59 -#define ASCII_Z 0x5A - -#define ASCII_a 0x61 -#define ASCII_b 0x62 -#define ASCII_c 0x63 -#define ASCII_d 0x64 -#define ASCII_e 0x65 -#define ASCII_f 0x66 -#define ASCII_g 0x67 -#define ASCII_h 0x68 -#define ASCII_i 0x69 -#define ASCII_j 0x6A -#define ASCII_k 0x6B -#define ASCII_l 0x6C -#define ASCII_m 0x6D -#define ASCII_n 0x6E -#define ASCII_o 0x6F -#define ASCII_p 0x70 -#define ASCII_q 0x71 -#define ASCII_r 0x72 -#define ASCII_s 0x73 -#define ASCII_t 0x74 -#define ASCII_u 0x75 -#define ASCII_v 0x76 -#define ASCII_w 0x77 -#define ASCII_x 0x78 -#define ASCII_y 0x79 -#define ASCII_z 0x7A - -#define ASCII_0 0x30 -#define ASCII_1 0x31 -#define ASCII_2 0x32 -#define ASCII_3 0x33 -#define ASCII_4 0x34 -#define ASCII_5 0x35 -#define ASCII_6 0x36 -#define ASCII_7 0x37 -#define ASCII_8 0x38 -#define ASCII_9 0x39 - -#define ASCII_TAB 0x09 -#define ASCII_SPACE 0x20 -#define ASCII_EXCL 0x21 -#define ASCII_QUOT 0x22 -#define ASCII_AMP 0x26 -#define ASCII_APOS 0x27 -#define ASCII_MINUS 0x2D -#define ASCII_PERIOD 0x2E -#define ASCII_COLON 0x3A -#define ASCII_SEMI 0x3B -#define ASCII_LT 0x3C -#define ASCII_EQUALS 0x3D -#define ASCII_GT 0x3E -#define ASCII_LSQB 0x5B -#define ASCII_RSQB 0x5D -#define ASCII_UNDERSCORE 0x5F -#define ASCII_LPAREN 0x28 -#define ASCII_RPAREN 0x29 -#define ASCII_FF 0x0C -#define ASCII_SLASH 0x2F -#define ASCII_HASH 0x23 -#define ASCII_PIPE 0x7C -#define ASCII_COMMA 0x2C diff --git a/external/mit/expat/dist/lib/asciitab.h b/external/mit/expat/dist/lib/asciitab.h deleted file mode 100755 index 79a15c28c..000000000 --- a/external/mit/expat/dist/lib/asciitab.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/external/mit/expat/dist/lib/expat.dsp b/external/mit/expat/dist/lib/expat.dsp deleted file mode 100755 index 6440d37f5..000000000 --- a/external/mit/expat/dist/lib/expat.dsp +++ /dev/null @@ -1,185 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expat" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=expat - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expat.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expat.mak" CFG="expat - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expat - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "expat - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expat - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "COMPILED_FROM_DSP" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /pdb:none /machine:I386 /out:"..\win32\bin\Release\libexpat.dll" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /FR /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /pdb:none /debug /machine:I386 /out:"..\win32\bin\Debug\libexpat.dll" - -!ENDIF - -# Begin Target - -# Name "expat - Win32 Release" -# Name "expat - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\libexpat.def -# End Source File -# Begin Source File - -SOURCE=.\xmlparse.c - -!IF "$(CFG)" == "expat - Win32 Release" - -!ELSEIF "$(CFG)" == "expat - Win32 Debug" - -# ADD CPP /GX- /Od - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_ns.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\expat_external.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/external/mit/expat/dist/lib/expat.h b/external/mit/expat/dist/lib/expat.h deleted file mode 100755 index 9a21680be..000000000 --- a/external/mit/expat/dist/lib/expat.h +++ /dev/null @@ -1,1047 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef Expat_INCLUDED -#define Expat_INCLUDED 1 - -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XML_SetProcessingInstructionHandler XML_SetProcessingInstrHandler -#define XML_SetUnparsedEntityDeclHandler XML_SetUnparsedEntDeclHandler -#define XML_SetStartNamespaceDeclHandler XML_SetStartNamespcDeclHandler -#define XML_SetExternalEntityRefHandlerArg XML_SetExternalEntRefHandlerArg -#endif - -#include -#include "expat_external.h" - -#ifdef __cplusplus -extern "C" { -#endif - -struct XML_ParserStruct; -typedef struct XML_ParserStruct *XML_Parser; - -/* Should this be defined using stdbool.h when C99 is available? */ -typedef unsigned char XML_Bool; -#define XML_TRUE ((XML_Bool) 1) -#define XML_FALSE ((XML_Bool) 0) - -/* The XML_Status enum gives the possible return values for several - API functions. The preprocessor #defines are included so this - stanza can be added to code that still needs to support older - versions of Expat 1.95.x: - - #ifndef XML_STATUS_OK - #define XML_STATUS_OK 1 - #define XML_STATUS_ERROR 0 - #endif - - Otherwise, the #define hackery is quite ugly and would have been - dropped. -*/ -enum XML_Status { - XML_STATUS_ERROR = 0, -#define XML_STATUS_ERROR XML_STATUS_ERROR - XML_STATUS_OK = 1, -#define XML_STATUS_OK XML_STATUS_OK - XML_STATUS_SUSPENDED = 2 -#define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED -}; - -enum XML_Error { - XML_ERROR_NONE, - XML_ERROR_NO_MEMORY, - XML_ERROR_SYNTAX, - XML_ERROR_NO_ELEMENTS, - XML_ERROR_INVALID_TOKEN, - XML_ERROR_UNCLOSED_TOKEN, - XML_ERROR_PARTIAL_CHAR, - XML_ERROR_TAG_MISMATCH, - XML_ERROR_DUPLICATE_ATTRIBUTE, - XML_ERROR_JUNK_AFTER_DOC_ELEMENT, - XML_ERROR_PARAM_ENTITY_REF, - XML_ERROR_UNDEFINED_ENTITY, - XML_ERROR_RECURSIVE_ENTITY_REF, - XML_ERROR_ASYNC_ENTITY, - XML_ERROR_BAD_CHAR_REF, - XML_ERROR_BINARY_ENTITY_REF, - XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF, - XML_ERROR_MISPLACED_XML_PI, - XML_ERROR_UNKNOWN_ENCODING, - XML_ERROR_INCORRECT_ENCODING, - XML_ERROR_UNCLOSED_CDATA_SECTION, - XML_ERROR_EXTERNAL_ENTITY_HANDLING, - XML_ERROR_NOT_STANDALONE, - XML_ERROR_UNEXPECTED_STATE, - XML_ERROR_ENTITY_DECLARED_IN_PE, - XML_ERROR_FEATURE_REQUIRES_XML_DTD, - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING, - /* Added in 1.95.7. */ - XML_ERROR_UNBOUND_PREFIX, - /* Added in 1.95.8. */ - XML_ERROR_UNDECLARING_PREFIX, - XML_ERROR_INCOMPLETE_PE, - XML_ERROR_XML_DECL, - XML_ERROR_TEXT_DECL, - XML_ERROR_PUBLICID, - XML_ERROR_SUSPENDED, - XML_ERROR_NOT_SUSPENDED, - XML_ERROR_ABORTED, - XML_ERROR_FINISHED, - XML_ERROR_SUSPEND_PE, - /* Added in 2.0. */ - XML_ERROR_RESERVED_PREFIX_XML, - XML_ERROR_RESERVED_PREFIX_XMLNS, - XML_ERROR_RESERVED_NAMESPACE_URI -}; - -enum XML_Content_Type { - XML_CTYPE_EMPTY = 1, - XML_CTYPE_ANY, - XML_CTYPE_MIXED, - XML_CTYPE_NAME, - XML_CTYPE_CHOICE, - XML_CTYPE_SEQ -}; - -enum XML_Content_Quant { - XML_CQUANT_NONE, - XML_CQUANT_OPT, - XML_CQUANT_REP, - XML_CQUANT_PLUS -}; - -/* If type == XML_CTYPE_EMPTY or XML_CTYPE_ANY, then quant will be - XML_CQUANT_NONE, and the other fields will be zero or NULL. - If type == XML_CTYPE_MIXED, then quant will be NONE or REP and - numchildren will contain number of elements that may be mixed in - and children point to an array of XML_Content cells that will be - all of XML_CTYPE_NAME type with no quantification. - - If type == XML_CTYPE_NAME, then the name points to the name, and - the numchildren field will be zero and children will be NULL. The - quant fields indicates any quantifiers placed on the name. - - CHOICE and SEQ will have name NULL, the number of children in - numchildren and children will point, recursively, to an array - of XML_Content cells. - - The EMPTY, ANY, and MIXED types will only occur at top level. -*/ - -typedef struct XML_cp XML_Content; - -struct XML_cp { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - XML_Char * name; - unsigned int numchildren; - XML_Content * children; -}; - - -/* This is called for an element declaration. See above for - description of the model argument. It's the caller's responsibility - to free model when finished with it. -*/ -typedef void (XMLCALL *XML_ElementDeclHandler) (void *userData, - const XML_Char *name, - XML_Content *model); - -XMLPARSEAPI(void) -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl); - -/* The Attlist declaration handler is called for *each* attribute. So - a single Attlist declaration with multiple attributes declared will - generate multiple calls to this handler. The "default" parameter - may be NULL in the case of the "#IMPLIED" or "#REQUIRED" - keyword. The "isrequired" parameter will be true and the default - value will be NULL in the case of "#REQUIRED". If "isrequired" is - true and default is non-NULL, then this is a "#FIXED" default. -*/ -typedef void (XMLCALL *XML_AttlistDeclHandler) ( - void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired); - -XMLPARSEAPI(void) -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl); - -/* The XML declaration handler is called for *both* XML declarations - and text declarations. The way to distinguish is that the version - parameter will be NULL for text declarations. The encoding - parameter may be NULL for XML declarations. The standalone - parameter will be -1, 0, or 1 indicating respectively that there - was no standalone parameter in the declaration, that it was given - as no, or that it was given as yes. -*/ -typedef void (XMLCALL *XML_XmlDeclHandler) (void *userData, - const XML_Char *version, - const XML_Char *encoding, - int standalone); - -XMLPARSEAPI(void) -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler xmldecl); - - -typedef struct { - void *(*malloc_fcn)(size_t size); - void *(*realloc_fcn)(void *ptr, size_t size); - void (*free_fcn)(void *ptr); -} XML_Memory_Handling_Suite; - -/* Constructs a new parser; encoding is the encoding specified by the - external protocol or NULL if there is none specified. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreate(const XML_Char *encoding); - -/* Constructs a new parser and namespace processor. Element type - names and attribute names that belong to a namespace will be - expanded; unprefixed attribute names are never expanded; unprefixed - element type names are expanded only if there is a default - namespace. The expanded name is the concatenation of the namespace - URI, the namespace separator character, and the local part of the - name. If the namespace separator is '\0' then the namespace URI - and the local part will be concatenated without any separator. - It is a programming error to use the separator '\0' with namespace - triplets (see XML_SetReturnNSTriplet). -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator); - - -/* Constructs a new parser using the memory management suite referred to - by memsuite. If memsuite is NULL, then use the standard library memory - suite. If namespaceSeparator is non-NULL it creates a parser with - namespace processing as described above. The character pointed at - will serve as the namespace separator. - - All further memory operations used for the created parser will come from - the given suite. -*/ -XMLPARSEAPI(XML_Parser) -XML_ParserCreate_MM(const XML_Char *encoding, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *namespaceSeparator); - -/* Prepare a parser object to be re-used. This is particularly - valuable when memory allocation overhead is disproportionatly high, - such as when a large number of small documnents need to be parsed. - All handlers are cleared from the parser, except for the - unknownEncodingHandler. The parser's external state is re-initialized - except for the values of ns and ns_triplets. - - Added in Expat 1.95.3. -*/ -XMLPARSEAPI(XML_Bool) -XML_ParserReset(XML_Parser parser, const XML_Char *encoding); - -/* atts is array of name/value pairs, terminated by 0; - names and values are 0 terminated. -*/ -typedef void (XMLCALL *XML_StartElementHandler) (void *userData, - const XML_Char *name, - const XML_Char **atts); - -typedef void (XMLCALL *XML_EndElementHandler) (void *userData, - const XML_Char *name); - - -/* s is not 0 terminated. */ -typedef void (XMLCALL *XML_CharacterDataHandler) (void *userData, - const XML_Char *s, - int len); - -/* target and data are 0 terminated */ -typedef void (XMLCALL *XML_ProcessingInstructionHandler) ( - void *userData, - const XML_Char *target, - const XML_Char *data); - -/* data is 0 terminated */ -typedef void (XMLCALL *XML_CommentHandler) (void *userData, - const XML_Char *data); - -typedef void (XMLCALL *XML_StartCdataSectionHandler) (void *userData); -typedef void (XMLCALL *XML_EndCdataSectionHandler) (void *userData); - -/* This is called for any characters in the XML document for which - there is no applicable handler. This includes both characters that - are part of markup which is of a kind that is not reported - (comments, markup declarations), or characters that are part of a - construct which could be reported but for which no handler has been - supplied. The characters are passed exactly as they were in the XML - document except that they will be encoded in UTF-8 or UTF-16. - Line boundaries are not normalized. Note that a byte order mark - character is not passed to the default handler. There are no - guarantees about how characters are divided between calls to the - default handler: for example, a comment might be split between - multiple calls. -*/ -typedef void (XMLCALL *XML_DefaultHandler) (void *userData, - const XML_Char *s, - int len); - -/* This is called for the start of the DOCTYPE declaration, before - any DTD or internal subset is parsed. -*/ -typedef void (XMLCALL *XML_StartDoctypeDeclHandler) ( - void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset); - -/* This is called for the start of the DOCTYPE declaration when the - closing > is encountered, but after processing any external - subset. -*/ -typedef void (XMLCALL *XML_EndDoctypeDeclHandler)(void *userData); - -/* This is called for entity declarations. The is_parameter_entity - argument will be non-zero if the entity is a parameter entity, zero - otherwise. - - For internal entities (), value will - be non-NULL and systemId, publicID, and notationName will be NULL. - The value string is NOT nul-terminated; the length is provided in - the value_length argument. Since it is legal to have zero-length - values, do not use this argument to test for internal entities. - - For external entities, value will be NULL and systemId will be - non-NULL. The publicId argument will be NULL unless a public - identifier was provided. The notationName argument will have a - non-NULL value only for unparsed entity declarations. - - Note that is_parameter_entity can't be changed to XML_Bool, since - that would break binary compatibility. -*/ -typedef void (XMLCALL *XML_EntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -XMLPARSEAPI(void) -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler); - -/* OBSOLETE -- OBSOLETE -- OBSOLETE - This handler has been superceded by the EntityDeclHandler above. - It is provided here for backward compatibility. - - This is called for a declaration of an unparsed (NDATA) entity. - The base argument is whatever was set by XML_SetBase. The - entityName, systemId and notationName arguments will never be - NULL. The other arguments may be. -*/ -typedef void (XMLCALL *XML_UnparsedEntityDeclHandler) ( - void *userData, - const XML_Char *entityName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName); - -/* This is called for a declaration of notation. The base argument is - whatever was set by XML_SetBase. The notationName will never be - NULL. The other arguments can be. -*/ -typedef void (XMLCALL *XML_NotationDeclHandler) ( - void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* When namespace processing is enabled, these are called once for - each namespace declaration. The call to the start and end element - handlers occur between the calls to the start and end namespace - declaration handlers. For an xmlns attribute, prefix will be - NULL. For an xmlns="" attribute, uri will be NULL. -*/ -typedef void (XMLCALL *XML_StartNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix, - const XML_Char *uri); - -typedef void (XMLCALL *XML_EndNamespaceDeclHandler) ( - void *userData, - const XML_Char *prefix); - -/* This is called if the document is not standalone, that is, it has an - external subset or a reference to a parameter entity, but does not - have standalone="yes". If this handler returns XML_STATUS_ERROR, - then processing will not continue, and the parser will return a - XML_ERROR_NOT_STANDALONE error. - If parameter entity parsing is enabled, then in addition to the - conditions above this handler will only be called if the referenced - entity was actually read. -*/ -typedef int (XMLCALL *XML_NotStandaloneHandler) (void *userData); - -/* This is called for a reference to an external parsed general - entity. The referenced entity is not automatically parsed. The - application can parse it immediately or later using - XML_ExternalEntityParserCreate. - - The parser argument is the parser parsing the entity containing the - reference; it can be passed as the parser argument to - XML_ExternalEntityParserCreate. The systemId argument is the - system identifier as specified in the entity declaration; it will - not be NULL. - - The base argument is the system identifier that should be used as - the base for resolving systemId if systemId was relative; this is - set by XML_SetBase; it may be NULL. - - The publicId argument is the public identifier as specified in the - entity declaration, or NULL if none was specified; the whitespace - in the public identifier will have been normalized as required by - the XML spec. - - The context argument specifies the parsing context in the format - expected by the context argument to XML_ExternalEntityParserCreate; - context is valid only until the handler returns, so if the - referenced entity is to be parsed later, it must be copied. - context is NULL only when the entity is a parameter entity. - - The handler should return XML_STATUS_ERROR if processing should not - continue because of a fatal error in the handling of the external - entity. In this case the calling parser will return an - XML_ERROR_EXTERNAL_ENTITY_HANDLING error. - - Note that unlike other handlers the first argument is the parser, - not userData. -*/ -typedef int (XMLCALL *XML_ExternalEntityRefHandler) ( - XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId); - -/* This is called in two situations: - 1) An entity reference is encountered for which no declaration - has been read *and* this is not an error. - 2) An internal entity reference is read, but not expanded, because - XML_SetDefaultHandler has been called. - Note: skipped parameter entities in declarations and skipped general - entities in attribute values cannot be reported, because - the event would be out of sync with the reporting of the - declarations or attribute values -*/ -typedef void (XMLCALL *XML_SkippedEntityHandler) ( - void *userData, - const XML_Char *entityName, - int is_parameter_entity); - -/* This structure is filled in by the XML_UnknownEncodingHandler to - provide information to the parser about encodings that are unknown - to the parser. - - The map[b] member gives information about byte sequences whose - first byte is b. - - If map[b] is c where c is >= 0, then b by itself encodes the - Unicode scalar value c. - - If map[b] is -1, then the byte sequence is malformed. - - If map[b] is -n, where n >= 2, then b is the first byte of an - n-byte sequence that encodes a single Unicode scalar value. - - The data member will be passed as the first argument to the convert - function. - - The convert function is used to convert multibyte sequences; s will - point to a n-byte sequence where map[(unsigned char)*s] == -n. The - convert function must return the Unicode scalar value represented - by this byte sequence or -1 if the byte sequence is malformed. - - The convert function may be NULL if the encoding is a single-byte - encoding, that is if map[b] >= -1 for all bytes b. - - When the parser is finished with the encoding, then if release is - not NULL, it will call release passing it the data member; once - release has been called, the convert function will not be called - again. - - Expat places certain restrictions on the encodings that are supported - using this mechanism. - - 1. Every ASCII character that can appear in a well-formed XML document, - other than the characters - - $@\^`{}~ - - must be represented by a single byte, and that byte must be the - same byte that represents that character in ASCII. - - 2. No character may require more than 4 bytes to encode. - - 3. All characters encoded must have Unicode scalar values <= - 0xFFFF, (i.e., characters that would be encoded by surrogates in - UTF-16 are not allowed). Note that this restriction doesn't - apply to the built-in support for UTF-8 and UTF-16. - - 4. No Unicode character may be encoded by more than one distinct - sequence of bytes. -*/ -typedef struct { - int map[256]; - void *data; - int (XMLCALL *convert)(void *data, const char *s); - void (XMLCALL *release)(void *data); -} XML_Encoding; - -/* This is called for an encoding that is unknown to the parser. - - The encodingHandlerData argument is that which was passed as the - second argument to XML_SetUnknownEncodingHandler. - - The name argument gives the name of the encoding as specified in - the encoding declaration. - - If the callback can provide information about the encoding, it must - fill in the XML_Encoding structure, and return XML_STATUS_OK. - Otherwise it must return XML_STATUS_ERROR. - - If info does not describe a suitable encoding, then the parser will - return an XML_UNKNOWN_ENCODING error. -*/ -typedef int (XMLCALL *XML_UnknownEncodingHandler) ( - void *encodingHandlerData, - const XML_Char *name, - XML_Encoding *info); - -XMLPARSEAPI(void) -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end); - -XMLPARSEAPI(void) -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler handler); - -XMLPARSEAPI(void) -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler handler); - -XMLPARSEAPI(void) -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler); - -XMLPARSEAPI(void) -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler); -XMLPARSEAPI(void) -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler); - -XMLPARSEAPI(void) -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end); - -XMLPARSEAPI(void) -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start); - -XMLPARSEAPI(void) -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end); - -/* This sets the default handler and also inhibits expansion of - internal entities. These entity references will be passed to the - default handler, or to the skipped entity handler, if one is set. -*/ -XMLPARSEAPI(void) -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler); - -/* This sets the default handler but does not inhibit expansion of - internal entities. The entity reference will not be passed to the - default handler. -*/ -XMLPARSEAPI(void) -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler); - -XMLPARSEAPI(void) -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end); - -XMLPARSEAPI(void) -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start); - -XMLPARSEAPI(void) -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end); - -XMLPARSEAPI(void) -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler); - -XMLPARSEAPI(void) -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler); - -XMLPARSEAPI(void) -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end); - -XMLPARSEAPI(void) -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start); - -XMLPARSEAPI(void) -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end); - -XMLPARSEAPI(void) -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler); - -XMLPARSEAPI(void) -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler); - -/* If a non-NULL value for arg is specified here, then it will be - passed as the first argument to the external entity ref handler - instead of the parser object. -*/ -XMLPARSEAPI(void) -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, - void *arg); - -XMLPARSEAPI(void) -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler); - -XMLPARSEAPI(void) -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *encodingHandlerData); - -/* This can be called within a handler for a start element, end - element, processing instruction or character data. It causes the - corresponding markup to be passed to the default handler. -*/ -XMLPARSEAPI(void) -XML_DefaultCurrent(XML_Parser parser); - -/* If do_nst is non-zero, and namespace processing is in effect, and - a name has a prefix (i.e. an explicit namespace qualifier) then - that name is returned as a triplet in a single string separated by - the separator character specified when the parser was created: URI - + sep + local_name + sep + prefix. - - If do_nst is zero, then namespace information is returned in the - default manner (URI + sep + local_name) whether or not the name - has a prefix. - - Note: Calling XML_SetReturnNSTriplet after XML_Parse or - XML_ParseBuffer has no effect. -*/ - -XMLPARSEAPI(void) -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst); - -/* This value is passed as the userData argument to callbacks. */ -XMLPARSEAPI(void) -XML_SetUserData(XML_Parser parser, void *userData); - -/* Returns the last value set by XML_SetUserData or NULL. */ -#define XML_GetUserData(parser) (*(void **)(parser)) - -/* This is equivalent to supplying an encoding argument to - XML_ParserCreate. On success XML_SetEncoding returns non-zero, - zero otherwise. - Note: Calling XML_SetEncoding after XML_Parse or XML_ParseBuffer - has no effect and returns XML_STATUS_ERROR. -*/ -XMLPARSEAPI(enum XML_Status) -XML_SetEncoding(XML_Parser parser, const XML_Char *encoding); - -/* If this function is called, then the parser will be passed as the - first argument to callbacks instead of userData. The userData will - still be accessible using XML_GetUserData. -*/ -XMLPARSEAPI(void) -XML_UseParserAsHandlerArg(XML_Parser parser); - -/* If useDTD == XML_TRUE is passed to this function, then the parser - will assume that there is an external subset, even if none is - specified in the document. In such a case the parser will call the - externalEntityRefHandler with a value of NULL for the systemId - argument (the publicId and context arguments will be NULL as well). - Note: For the purpose of checking WFC: Entity Declared, passing - useDTD == XML_TRUE will make the parser behave as if the document - had a DTD with an external subset. - Note: If this function is called, then this must be done before - the first call to XML_Parse or XML_ParseBuffer, since it will - have no effect after that. Returns - XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING. - Note: If the document does not have a DOCTYPE declaration at all, - then startDoctypeDeclHandler and endDoctypeDeclHandler will not - be called, despite an external subset being parsed. - Note: If XML_DTD is not defined when Expat is compiled, returns - XML_ERROR_FEATURE_REQUIRES_XML_DTD. -*/ -XMLPARSEAPI(enum XML_Error) -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD); - - -/* Sets the base to be used for resolving relative URIs in system - identifiers in declarations. Resolving relative identifiers is - left to the application: this value will be passed through as the - base argument to the XML_ExternalEntityRefHandler, - XML_NotationDeclHandler and XML_UnparsedEntityDeclHandler. The base - argument will be copied. Returns XML_STATUS_ERROR if out of memory, - XML_STATUS_OK otherwise. -*/ -XMLPARSEAPI(enum XML_Status) -XML_SetBase(XML_Parser parser, const XML_Char *base); - -XMLPARSEAPI(const XML_Char *) -XML_GetBase(XML_Parser parser); - -/* Returns the number of the attribute/value pairs passed in last call - to the XML_StartElementHandler that were specified in the start-tag - rather than defaulted. Each attribute/value pair counts as 2; thus - this correspondds to an index into the atts array passed to the - XML_StartElementHandler. -*/ -XMLPARSEAPI(int) -XML_GetSpecifiedAttributeCount(XML_Parser parser); - -/* Returns the index of the ID attribute passed in the last call to - XML_StartElementHandler, or -1 if there is no ID attribute. Each - attribute/value pair counts as 2; thus this correspondds to an - index into the atts array passed to the XML_StartElementHandler. -*/ -XMLPARSEAPI(int) -XML_GetIdAttributeIndex(XML_Parser parser); - -#ifdef XML_ATTR_INFO -/* Source file byte offsets for the start and end of attribute names and values. - The value indices are exclusive of surrounding quotes; thus in a UTF-8 source - file an attribute value of "blah" will yield: - info->valueEnd - info->valueStart = 4 bytes. -*/ -typedef struct { - XML_Index nameStart; /* Offset to beginning of the attribute name. */ - XML_Index nameEnd; /* Offset after the attribute name's last byte. */ - XML_Index valueStart; /* Offset to beginning of the attribute value. */ - XML_Index valueEnd; /* Offset after the attribute value's last byte. */ -} XML_AttrInfo; - -/* Returns an array of XML_AttrInfo structures for the attribute/value pairs - passed in last call to the XML_StartElementHandler that were specified - in the start-tag rather than defaulted. Each attribute/value pair counts - as 1; thus the number of entries in the array is - XML_GetSpecifiedAttributeCount(parser) / 2. -*/ -XMLPARSEAPI(const XML_AttrInfo *) -XML_GetAttributeInfo(XML_Parser parser); -#endif - -/* Parses some input. Returns XML_STATUS_ERROR if a fatal error is - detected. The last call to XML_Parse must have isFinal true; len - may be zero for this call (or any other). - - Though the return values for these functions has always been - described as a Boolean value, the implementation, at least for the - 1.95.x series, has always returned exactly one of the XML_Status - values. -*/ -XMLPARSEAPI(enum XML_Status) -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal); - -XMLPARSEAPI(void *) -XML_GetBuffer(XML_Parser parser, int len); - -XMLPARSEAPI(enum XML_Status) -XML_ParseBuffer(XML_Parser parser, int len, int isFinal); - -/* Stops parsing, causing XML_Parse() or XML_ParseBuffer() to return. - Must be called from within a call-back handler, except when aborting - (resumable = 0) an already suspended parser. Some call-backs may - still follow because they would otherwise get lost. Examples: - - endElementHandler() for empty elements when stopped in - startElementHandler(), - - endNameSpaceDeclHandler() when stopped in endElementHandler(), - and possibly others. - - Can be called from most handlers, including DTD related call-backs, - except when parsing an external parameter entity and resumable != 0. - Returns XML_STATUS_OK when successful, XML_STATUS_ERROR otherwise. - Possible error codes: - - XML_ERROR_SUSPENDED: when suspending an already suspended parser. - - XML_ERROR_FINISHED: when the parser has already finished. - - XML_ERROR_SUSPEND_PE: when suspending while parsing an external PE. - - When resumable != 0 (true) then parsing is suspended, that is, - XML_Parse() and XML_ParseBuffer() return XML_STATUS_SUSPENDED. - Otherwise, parsing is aborted, that is, XML_Parse() and XML_ParseBuffer() - return XML_STATUS_ERROR with error code XML_ERROR_ABORTED. - - *Note*: - This will be applied to the current parser instance only, that is, if - there is a parent parser then it will continue parsing when the - externalEntityRefHandler() returns. It is up to the implementation of - the externalEntityRefHandler() to call XML_StopParser() on the parent - parser (recursively), if one wants to stop parsing altogether. - - When suspended, parsing can be resumed by calling XML_ResumeParser(). -*/ -XMLPARSEAPI(enum XML_Status) -XML_StopParser(XML_Parser parser, XML_Bool resumable); - -/* Resumes parsing after it has been suspended with XML_StopParser(). - Must not be called from within a handler call-back. Returns same - status codes as XML_Parse() or XML_ParseBuffer(). - Additional error code XML_ERROR_NOT_SUSPENDED possible. - - *Note*: - This must be called on the most deeply nested child parser instance - first, and on its parent parser only after the child parser has finished, - to be applied recursively until the document entity's parser is restarted. - That is, the parent parser will not resume by itself and it is up to the - application to call XML_ResumeParser() on it at the appropriate moment. -*/ -XMLPARSEAPI(enum XML_Status) -XML_ResumeParser(XML_Parser parser); - -enum XML_Parsing { - XML_INITIALIZED, - XML_PARSING, - XML_FINISHED, - XML_SUSPENDED -}; - -typedef struct { - enum XML_Parsing parsing; - XML_Bool finalBuffer; -} XML_ParsingStatus; - -/* Returns status of parser with respect to being initialized, parsing, - finished, or suspended and processing the final buffer. - XXX XML_Parse() and XML_ParseBuffer() should return XML_ParsingStatus, - XXX with XML_FINISHED_OK or XML_FINISHED_ERROR replacing XML_FINISHED -*/ -XMLPARSEAPI(void) -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status); - -/* Creates an XML_Parser object that can parse an external general - entity; context is a '\0'-terminated string specifying the parse - context; encoding is a '\0'-terminated string giving the name of - the externally specified encoding, or NULL if there is no - externally specified encoding. The context string consists of a - sequence of tokens separated by formfeeds (\f); a token consisting - of a name specifies that the general entity of the name is open; a - token of the form prefix=uri specifies the namespace for a - particular prefix; a token of the form =uri specifies the default - namespace. This can be called at any point after the first call to - an ExternalEntityRefHandler so longer as the parser has not yet - been freed. The new parser is completely independent and may - safely be used in a separate thread. The handlers and userData are - initialized from the parser argument. Returns NULL if out of memory. - Otherwise returns a new XML_Parser object. -*/ -XMLPARSEAPI(XML_Parser) -XML_ExternalEntityParserCreate(XML_Parser parser, - const XML_Char *context, - const XML_Char *encoding); - -enum XML_ParamEntityParsing { - XML_PARAM_ENTITY_PARSING_NEVER, - XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE, - XML_PARAM_ENTITY_PARSING_ALWAYS -}; - -/* Controls parsing of parameter entities (including the external DTD - subset). If parsing of parameter entities is enabled, then - references to external parameter entities (including the external - DTD subset) will be passed to the handler set with - XML_SetExternalEntityRefHandler. The context passed will be 0. - - Unlike external general entities, external parameter entities can - only be parsed synchronously. If the external parameter entity is - to be parsed, it must be parsed during the call to the external - entity ref handler: the complete sequence of - XML_ExternalEntityParserCreate, XML_Parse/XML_ParseBuffer and - XML_ParserFree calls must be made during this call. After - XML_ExternalEntityParserCreate has been called to create the parser - for the external parameter entity (context must be 0 for this - call), it is illegal to make any calls on the old parser until - XML_ParserFree has been called on the newly created parser. - If the library has been compiled without support for parameter - entity parsing (ie without XML_DTD being defined), then - XML_SetParamEntityParsing will return 0 if parsing of parameter - entities is requested; otherwise it will return non-zero. - Note: If XML_SetParamEntityParsing is called after XML_Parse or - XML_ParseBuffer, then it has no effect and will always return 0. -*/ -XMLPARSEAPI(int) -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing parsing); - -/* Sets the hash salt to use for internal hash calculations. - Helps in preventing DoS attacks based on predicting hash - function behavior. This must be called before parsing is started. - Returns 1 if successful, 0 when called after parsing has started. -*/ -XMLPARSEAPI(int) -XML_SetHashSalt(XML_Parser parser, - unsigned long hash_salt); - -/* If XML_Parse or XML_ParseBuffer have returned XML_STATUS_ERROR, then - XML_GetErrorCode returns information about the error. -*/ -XMLPARSEAPI(enum XML_Error) -XML_GetErrorCode(XML_Parser parser); - -/* These functions return information about the current parse - location. They may be called from any callback called to report - some parse event; in this case the location is the location of the - first of the sequence of characters that generated the event. When - called from callbacks generated by declarations in the document - prologue, the location identified isn't as neatly defined, but will - be within the relevant markup. When called outside of the callback - functions, the position indicated will be just past the last parse - event (regardless of whether there was an associated callback). - - They may also be called after returning from a call to XML_Parse - or XML_ParseBuffer. If the return value is XML_STATUS_ERROR then - the location is the location of the character at which the error - was detected; otherwise the location is the location of the last - parse event, as described above. -*/ -XMLPARSEAPI(XML_Size) XML_GetCurrentLineNumber(XML_Parser parser); -XMLPARSEAPI(XML_Size) XML_GetCurrentColumnNumber(XML_Parser parser); -XMLPARSEAPI(XML_Index) XML_GetCurrentByteIndex(XML_Parser parser); - -/* Return the number of bytes in the current event. - Returns 0 if the event is in an internal entity. -*/ -XMLPARSEAPI(int) -XML_GetCurrentByteCount(XML_Parser parser); - -/* If XML_CONTEXT_BYTES is defined, returns the input buffer, sets - the integer pointed to by offset to the offset within this buffer - of the current parse position, and sets the integer pointed to by size - to the size of this buffer (the number of input bytes). Otherwise - returns a NULL pointer. Also returns a NULL pointer if a parse isn't - active. - - NOTE: The character pointer returned should not be used outside - the handler that makes the call. -*/ -XMLPARSEAPI(const char *) -XML_GetInputContext(XML_Parser parser, - int *offset, - int *size); - -/* For backwards compatibility with previous versions. */ -#define XML_GetErrorLineNumber XML_GetCurrentLineNumber -#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber -#define XML_GetErrorByteIndex XML_GetCurrentByteIndex - -/* Frees the content model passed to the element declaration handler */ -XMLPARSEAPI(void) -XML_FreeContentModel(XML_Parser parser, XML_Content *model); - -/* Exposing the memory handling functions used in Expat */ -XMLPARSEAPI(void *) -XML_MemMalloc(XML_Parser parser, size_t size); - -XMLPARSEAPI(void *) -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size); - -XMLPARSEAPI(void) -XML_MemFree(XML_Parser parser, void *ptr); - -/* Frees memory used by the parser. */ -XMLPARSEAPI(void) -XML_ParserFree(XML_Parser parser); - -/* Returns a string describing the error. */ -XMLPARSEAPI(const XML_LChar *) -XML_ErrorString(enum XML_Error code); - -/* Return a string containing the version number of this expat */ -XMLPARSEAPI(const XML_LChar *) -XML_ExpatVersion(void); - -typedef struct { - int major; - int minor; - int micro; -} XML_Expat_Version; - -/* Return an XML_Expat_Version structure containing numeric version - number information for this version of expat. -*/ -XMLPARSEAPI(XML_Expat_Version) -XML_ExpatVersionInfo(void); - -/* Added in Expat 1.95.5. */ -enum XML_FeatureEnum { - XML_FEATURE_END = 0, - XML_FEATURE_UNICODE, - XML_FEATURE_UNICODE_WCHAR_T, - XML_FEATURE_DTD, - XML_FEATURE_CONTEXT_BYTES, - XML_FEATURE_MIN_SIZE, - XML_FEATURE_SIZEOF_XML_CHAR, - XML_FEATURE_SIZEOF_XML_LCHAR, - XML_FEATURE_NS, - XML_FEATURE_LARGE_SIZE, - XML_FEATURE_ATTR_INFO - /* Additional features must be added to the end of this enum. */ -}; - -typedef struct { - enum XML_FeatureEnum feature; - const XML_LChar *name; - long int value; -} XML_Feature; - -XMLPARSEAPI(const XML_Feature *) -XML_GetFeatureList(void); - - -/* Expat follows the GNU/Linux convention of odd number minor version for - beta/development releases and even number minor version for stable - releases. Micro is bumped with each release, and set to 0 with each - change to major or minor version. -*/ -#define XML_MAJOR_VERSION 2 -#define XML_MINOR_VERSION 1 -#define XML_MICRO_VERSION 0 - -#ifdef __cplusplus -} -#endif - -#endif /* not Expat_INCLUDED */ diff --git a/external/mit/expat/dist/lib/expat_external.h b/external/mit/expat/dist/lib/expat_external.h deleted file mode 100755 index 2c03284ea..000000000 --- a/external/mit/expat/dist/lib/expat_external.h +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef Expat_External_INCLUDED -#define Expat_External_INCLUDED 1 - -/* External API definitions */ - -#if defined(_MSC_EXTENSIONS) && !defined(__BEOS__) && !defined(__CYGWIN__) -#define XML_USE_MSC_EXTENSIONS 1 -#endif - -/* Expat tries very hard to make the API boundary very specifically - defined. There are two macros defined to control this boundary; - each of these can be defined before including this header to - achieve some different behavior, but doing so it not recommended or - tested frequently. - - XMLCALL - The calling convention to use for all calls across the - "library boundary." This will default to cdecl, and - try really hard to tell the compiler that's what we - want. - - XMLIMPORT - Whatever magic is needed to note that a function is - to be imported from a dynamically loaded library - (.dll, .so, or .sl, depending on your platform). - - The XMLCALL macro was added in Expat 1.95.7. The only one which is - expected to be directly useful in client code is XMLCALL. - - Note that on at least some Unix versions, the Expat library must be - compiled with the cdecl calling convention as the default since - system headers may assume the cdecl convention. -*/ -#ifndef XMLCALL -#if defined(_MSC_VER) -#define XMLCALL __cdecl -#elif defined(__GNUC__) && defined(__i386) && !defined(__INTEL_COMPILER) -#define XMLCALL __attribute__((cdecl)) -#else -/* For any platform which uses this definition and supports more than - one calling convention, we need to extend this definition to - declare the convention used on that platform, if it's possible to - do so. - - If this is the case for your platform, please file a bug report - with information on how to identify your platform via the C - pre-processor and how to specify the same calling convention as the - platform's malloc() implementation. -*/ -#define XMLCALL -#endif -#endif /* not defined XMLCALL */ - - -#if !defined(XML_STATIC) && !defined(XMLIMPORT) -#ifndef XML_BUILDING_EXPAT -/* using Expat from an application */ - -#ifdef XML_USE_MSC_EXTENSIONS -#define XMLIMPORT __declspec(dllimport) -#endif - -#endif -#endif /* not defined XML_STATIC */ - - -/* If we didn't define it above, define it away: */ -#ifndef XMLIMPORT -#define XMLIMPORT -#endif - - -#define XMLPARSEAPI(type) XMLIMPORT type XMLCALL - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef XML_UNICODE_WCHAR_T -#define XML_UNICODE -#endif - -#ifdef XML_UNICODE /* Information is UTF-16 encoded. */ -#ifdef XML_UNICODE_WCHAR_T -typedef wchar_t XML_Char; -typedef wchar_t XML_LChar; -#else -typedef unsigned short XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE_WCHAR_T */ -#else /* Information is UTF-8 encoded. */ -typedef char XML_Char; -typedef char XML_LChar; -#endif /* XML_UNICODE */ - -#ifdef XML_LARGE_SIZE /* Use large integers for file/stream positions. */ -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -typedef __int64 XML_Index; -typedef unsigned __int64 XML_Size; -#else -typedef long long XML_Index; -typedef unsigned long long XML_Size; -#endif -#else -typedef long XML_Index; -typedef unsigned long XML_Size; -#endif /* XML_LARGE_SIZE */ - -#ifdef __cplusplus -} -#endif - -#endif /* not Expat_External_INCLUDED */ diff --git a/external/mit/expat/dist/lib/expat_static.dsp b/external/mit/expat/dist/lib/expat_static.dsp deleted file mode 100755 index ca39bc073..000000000 --- a/external/mit/expat/dist/lib/expat_static.dsp +++ /dev/null @@ -1,162 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expat_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=expat_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expat_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expat_static.mak" CFG="expat_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expat_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "expat_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expat_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "expat_static___Win32_Release" -# PROP BASE Intermediate_Dir "expat_static___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x1009 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\win32\bin\Release\libexpatMT.lib" - -!ELSEIF "$(CFG)" == "expat_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "expat_static___Win32_Debug" -# PROP BASE Intermediate_Dir "expat_static___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "COMPILED_FROM_DSP" /D "_MBCS" /D "_LIB" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x1009 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\win32\bin\Debug\libexpatMT.lib" - -!ENDIF - -# Begin Target - -# Name "expat_static - Win32 Release" -# Name "expat_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\xmlparse.c -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_ns.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\expat_external.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# End Target -# End Project diff --git a/external/mit/expat/dist/lib/expatw.dsp b/external/mit/expat/dist/lib/expatw.dsp deleted file mode 100755 index 77497b58d..000000000 --- a/external/mit/expat/dist/lib/expatw.dsp +++ /dev/null @@ -1,185 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expatw" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 - -CFG=expatw - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expatw.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expatw.mak" CFG="expatw - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expatw - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE "expatw - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -MTL=midl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expatw - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release-w" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "NDEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /dll /machine:I386 -# ADD LINK32 /nologo /dll /pdb:none /machine:I386 /out:"..\win32\bin\Release\libexpatw.dll" - -!ELSEIF "$(CFG)" == "expatw - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug-w" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "" -# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "EXPAT_EXPORTS" /Yu"stdafx.h" /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "_DEBUG" /D "COMPILED_FROM_DSP" /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c -# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 -# ADD BASE RSC /l 0x409 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept -# ADD LINK32 /nologo /dll /pdb:none /debug /machine:I386 /out:"..\win32\bin\Debug\libexpatw.dll" - -!ENDIF - -# Begin Target - -# Name "expatw - Win32 Release" -# Name "expatw - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\libexpatw.def -# End Source File -# Begin Source File - -SOURCE=.\xmlparse.c - -!IF "$(CFG)" == "expatw - Win32 Release" - -!ELSEIF "$(CFG)" == "expatw - Win32 Debug" - -# ADD CPP /GX- /Od - -!ENDIF - -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_ns.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\expat_external.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/external/mit/expat/dist/lib/expatw_static.dsp b/external/mit/expat/dist/lib/expatw_static.dsp deleted file mode 100755 index f13dd7297..000000000 --- a/external/mit/expat/dist/lib/expatw_static.dsp +++ /dev/null @@ -1,162 +0,0 @@ -# Microsoft Developer Studio Project File - Name="expatw_static" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Static Library" 0x0104 - -CFG=expatw_static - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "expatw_static.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "expatw_static.mak" CFG="expatw_static - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "expatw_static - Win32 Release" (based on "Win32 (x86) Static Library") -!MESSAGE "expatw_static - Win32 Debug" (based on "Win32 (x86) Static Library") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "expatw_static - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "expatw_static___Win32_Release" -# PROP BASE Intermediate_Dir "expatw_static___Win32_Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release-w_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c -# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "_WINDOWS" /D "NDEBUG" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /D "XML_UNICODE_WCHAR_T" /FD /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x1009 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\win32\bin\Release\libexpatwMT.lib" - -!ELSEIF "$(CFG)" == "expatw_static - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "expatw_static___Win32_Debug" -# PROP BASE Intermediate_Dir "expatw_static___Win32_Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug-w_static" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_LIB" /D "COMPILED_FROM_DSP" /D "XML_UNICODE_WCHAR_T" /FR /FD /GZ /c -# SUBTRACT CPP /YX -# ADD BASE RSC /l 0x1009 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LIB32=link.exe -lib -# ADD BASE LIB32 /nologo -# ADD LIB32 /nologo /out:"..\win32\bin\Debug\libexpatwMT.lib" - -!ENDIF - -# Begin Target - -# Name "expatw_static - Win32 Release" -# Name "expatw_static - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" -# Begin Source File - -SOURCE=.\xmlparse.c -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.c -# End Source File -# Begin Source File - -SOURCE=.\xmltok_ns.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl" -# Begin Source File - -SOURCE=.\ascii.h -# End Source File -# Begin Source File - -SOURCE=.\asciitab.h -# End Source File -# Begin Source File - -SOURCE=.\expat.h -# End Source File -# Begin Source File - -SOURCE=.\expat_external.h -# End Source File -# Begin Source File - -SOURCE=.\iasciitab.h -# End Source File -# Begin Source File - -SOURCE=.\internal.h -# End Source File -# Begin Source File - -SOURCE=.\latin1tab.h -# End Source File -# Begin Source File - -SOURCE=.\nametab.h -# End Source File -# Begin Source File - -SOURCE=.\utf8tab.h -# End Source File -# Begin Source File - -SOURCE=.\xmlrole.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok.h -# End Source File -# Begin Source File - -SOURCE=.\xmltok_impl.h -# End Source File -# End Group -# End Target -# End Project diff --git a/external/mit/expat/dist/lib/iasciitab.h b/external/mit/expat/dist/lib/iasciitab.h deleted file mode 100755 index 24a1d5ccc..000000000 --- a/external/mit/expat/dist/lib/iasciitab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ -/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML, -/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML, -/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM, -/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS, -/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS, -/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL, -/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT, -/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI, -/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST, -/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB, -/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT, -/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX, -/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT, -/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/external/mit/expat/dist/lib/internal.h b/external/mit/expat/dist/lib/internal.h deleted file mode 100755 index dd5454831..000000000 --- a/external/mit/expat/dist/lib/internal.h +++ /dev/null @@ -1,73 +0,0 @@ -/* internal.h - - Internal definitions used by Expat. This is not needed to compile - client code. - - The following calling convention macros are defined for frequently - called functions: - - FASTCALL - Used for those internal functions that have a simple - body and a low number of arguments and local variables. - - PTRCALL - Used for functions called though function pointers. - - PTRFASTCALL - Like PTRCALL, but for low number of arguments. - - inline - Used for selected internal functions for which inlining - may improve performance on some platforms. - - Note: Use of these macros is based on judgement, not hard rules, - and therefore subject to change. -*/ - -#if defined(__GNUC__) && defined(__i386__) && !defined(__MINGW32__) -/* We'll use this version by default only where we know it helps. - - regparm() generates warnings on Solaris boxes. See SF bug #692878. - - Instability reported with egcs on a RedHat Linux 7.3. - Let's comment out: - #define FASTCALL __attribute__((stdcall, regparm(3))) - and let's try this: -*/ -#define FASTCALL __attribute__((regparm(3))) -#define PTRFASTCALL __attribute__((regparm(3))) -#endif - -/* Using __fastcall seems to have an unexpected negative effect under - MS VC++, especially for function pointers, so we won't use it for - now on that platform. It may be reconsidered for a future release - if it can be made more effective. - Likely reason: __fastcall on Windows is like stdcall, therefore - the compiler cannot perform stack optimizations for call clusters. -*/ - -/* Make sure all of these are defined if they aren't already. */ - -#ifndef FASTCALL -#define FASTCALL -#endif - -#ifndef PTRCALL -#define PTRCALL -#endif - -#ifndef PTRFASTCALL -#define PTRFASTCALL -#endif - -#ifndef XML_MIN_SIZE -#if !defined(__cplusplus) && !defined(inline) -#ifdef __GNUC__ -#define inline __inline -#endif /* __GNUC__ */ -#endif -#endif /* XML_MIN_SIZE */ - -#ifdef __cplusplus -#define inline inline -#else -#ifndef inline -#define inline -#endif -#endif diff --git a/external/mit/expat/dist/lib/latin1tab.h b/external/mit/expat/dist/lib/latin1tab.h deleted file mode 100755 index 53c25d76b..000000000 --- a/external/mit/expat/dist/lib/latin1tab.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME, -/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER, -/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, -/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER, -/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, -/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, diff --git a/external/mit/expat/dist/lib/libexpat.def b/external/mit/expat/dist/lib/libexpat.def deleted file mode 100755 index 3920bbcf9..000000000 --- a/external/mit/expat/dist/lib/libexpat.def +++ /dev/null @@ -1,73 +0,0 @@ -; DEF file for MS VC++ - -LIBRARY -EXPORTS - XML_DefaultCurrent @1 - XML_ErrorString @2 - XML_ExpatVersion @3 - XML_ExpatVersionInfo @4 - XML_ExternalEntityParserCreate @5 - XML_GetBase @6 - XML_GetBuffer @7 - XML_GetCurrentByteCount @8 - XML_GetCurrentByteIndex @9 - XML_GetCurrentColumnNumber @10 - XML_GetCurrentLineNumber @11 - XML_GetErrorCode @12 - XML_GetIdAttributeIndex @13 - XML_GetInputContext @14 - XML_GetSpecifiedAttributeCount @15 - XML_Parse @16 - XML_ParseBuffer @17 - XML_ParserCreate @18 - XML_ParserCreateNS @19 - XML_ParserCreate_MM @20 - XML_ParserFree @21 - XML_SetAttlistDeclHandler @22 - XML_SetBase @23 - XML_SetCdataSectionHandler @24 - XML_SetCharacterDataHandler @25 - XML_SetCommentHandler @26 - XML_SetDefaultHandler @27 - XML_SetDefaultHandlerExpand @28 - XML_SetDoctypeDeclHandler @29 - XML_SetElementDeclHandler @30 - XML_SetElementHandler @31 - XML_SetEncoding @32 - XML_SetEndCdataSectionHandler @33 - XML_SetEndDoctypeDeclHandler @34 - XML_SetEndElementHandler @35 - XML_SetEndNamespaceDeclHandler @36 - XML_SetEntityDeclHandler @37 - XML_SetExternalEntityRefHandler @38 - XML_SetExternalEntityRefHandlerArg @39 - XML_SetNamespaceDeclHandler @40 - XML_SetNotStandaloneHandler @41 - XML_SetNotationDeclHandler @42 - XML_SetParamEntityParsing @43 - XML_SetProcessingInstructionHandler @44 - XML_SetReturnNSTriplet @45 - XML_SetStartCdataSectionHandler @46 - XML_SetStartDoctypeDeclHandler @47 - XML_SetStartElementHandler @48 - XML_SetStartNamespaceDeclHandler @49 - XML_SetUnknownEncodingHandler @50 - XML_SetUnparsedEntityDeclHandler @51 - XML_SetUserData @52 - XML_SetXmlDeclHandler @53 - XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - XML_ParserReset @55 - XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - XML_GetFeatureList @57 - XML_UseForeignDTD @58 -; added with version 1.95.6 - XML_FreeContentModel @59 - XML_MemMalloc @60 - XML_MemRealloc @61 - XML_MemFree @62 -; added with version 1.95.8 - XML_StopParser @63 - XML_ResumeParser @64 - XML_GetParsingStatus @65 diff --git a/external/mit/expat/dist/lib/libexpatw.def b/external/mit/expat/dist/lib/libexpatw.def deleted file mode 100755 index 3920bbcf9..000000000 --- a/external/mit/expat/dist/lib/libexpatw.def +++ /dev/null @@ -1,73 +0,0 @@ -; DEF file for MS VC++ - -LIBRARY -EXPORTS - XML_DefaultCurrent @1 - XML_ErrorString @2 - XML_ExpatVersion @3 - XML_ExpatVersionInfo @4 - XML_ExternalEntityParserCreate @5 - XML_GetBase @6 - XML_GetBuffer @7 - XML_GetCurrentByteCount @8 - XML_GetCurrentByteIndex @9 - XML_GetCurrentColumnNumber @10 - XML_GetCurrentLineNumber @11 - XML_GetErrorCode @12 - XML_GetIdAttributeIndex @13 - XML_GetInputContext @14 - XML_GetSpecifiedAttributeCount @15 - XML_Parse @16 - XML_ParseBuffer @17 - XML_ParserCreate @18 - XML_ParserCreateNS @19 - XML_ParserCreate_MM @20 - XML_ParserFree @21 - XML_SetAttlistDeclHandler @22 - XML_SetBase @23 - XML_SetCdataSectionHandler @24 - XML_SetCharacterDataHandler @25 - XML_SetCommentHandler @26 - XML_SetDefaultHandler @27 - XML_SetDefaultHandlerExpand @28 - XML_SetDoctypeDeclHandler @29 - XML_SetElementDeclHandler @30 - XML_SetElementHandler @31 - XML_SetEncoding @32 - XML_SetEndCdataSectionHandler @33 - XML_SetEndDoctypeDeclHandler @34 - XML_SetEndElementHandler @35 - XML_SetEndNamespaceDeclHandler @36 - XML_SetEntityDeclHandler @37 - XML_SetExternalEntityRefHandler @38 - XML_SetExternalEntityRefHandlerArg @39 - XML_SetNamespaceDeclHandler @40 - XML_SetNotStandaloneHandler @41 - XML_SetNotationDeclHandler @42 - XML_SetParamEntityParsing @43 - XML_SetProcessingInstructionHandler @44 - XML_SetReturnNSTriplet @45 - XML_SetStartCdataSectionHandler @46 - XML_SetStartDoctypeDeclHandler @47 - XML_SetStartElementHandler @48 - XML_SetStartNamespaceDeclHandler @49 - XML_SetUnknownEncodingHandler @50 - XML_SetUnparsedEntityDeclHandler @51 - XML_SetUserData @52 - XML_SetXmlDeclHandler @53 - XML_UseParserAsHandlerArg @54 -; added with version 1.95.3 - XML_ParserReset @55 - XML_SetSkippedEntityHandler @56 -; added with version 1.95.5 - XML_GetFeatureList @57 - XML_UseForeignDTD @58 -; added with version 1.95.6 - XML_FreeContentModel @59 - XML_MemMalloc @60 - XML_MemRealloc @61 - XML_MemFree @62 -; added with version 1.95.8 - XML_StopParser @63 - XML_ResumeParser @64 - XML_GetParsingStatus @65 diff --git a/external/mit/expat/dist/lib/macconfig.h b/external/mit/expat/dist/lib/macconfig.h deleted file mode 100755 index 2725caaf5..000000000 --- a/external/mit/expat/dist/lib/macconfig.h +++ /dev/null @@ -1,53 +0,0 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) -** -*/ - -#ifndef MACCONFIG_H -#define MACCONFIG_H - - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER 4321 - -/* Define to 1 if you have the `bcopy' function. */ -#undef HAVE_BCOPY - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE - -/* Define to 1 if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to 1 if you have the header file. */ -#undef HAVE_UNISTD_H - -/* whether byteorder is bigendian */ -#define WORDS_BIGENDIAN - -/* Define to specify how much context to retain around the current parse - point. */ -#undef XML_CONTEXT_BYTES - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS - -/* Define to empty if `const' does not conform to ANSI C. */ -#undef const - -/* Define to `long' if does not define. */ -#define off_t long - -/* Define to `unsigned' if does not define. */ -#undef size_t - - -#endif /* ifndef MACCONFIG_H */ diff --git a/external/mit/expat/dist/lib/nametab.h b/external/mit/expat/dist/lib/nametab.h deleted file mode 100755 index b05e62c77..000000000 --- a/external/mit/expat/dist/lib/nametab.h +++ /dev/null @@ -1,150 +0,0 @@ -static const unsigned namingBitmap[] = { -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF, -0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000, -0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060, -0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003, -0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003, -0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000, -0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001, -0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003, -0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000, -0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003, -0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003, -0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000, -0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000, -0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF, -0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB, -0x40000000, 0xF580C900, 0x00000007, 0x02010800, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF, -0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF, -0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF, -0x00000000, 0x00004C40, 0x00000000, 0x00000000, -0x00000007, 0x00000000, 0x00000000, 0x00000000, -0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF, -0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF, -0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, -0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000, -0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE, -0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF, -0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF, -0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000, -0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003, -0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD, -0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF, -0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF, -0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE, -0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF, -0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF, -0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF, -0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF, -0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF, -0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0, -0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1, -0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3, -0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80, -0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3, -0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000, -0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000, -0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF, -0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x00000000, 0x00000000, -0x00000000, 0x00000000, 0x1FFF0000, 0x00000002, -0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF, -0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF, -}; -static const unsigned char nmstrtPages[] = { -0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00, -0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; -static const unsigned char namePages[] = { -0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00, -0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25, -0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13, -0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, -0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; diff --git a/external/mit/expat/dist/lib/utf8tab.h b/external/mit/expat/dist/lib/utf8tab.h deleted file mode 100755 index 7bb3e7760..000000000 --- a/external/mit/expat/dist/lib/utf8tab.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - - -/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL, -/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2, -/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3, -/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4, -/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, -/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM, diff --git a/external/mit/expat/dist/lib/winconfig.h b/external/mit/expat/dist/lib/winconfig.h deleted file mode 100755 index c1b791d62..000000000 --- a/external/mit/expat/dist/lib/winconfig.h +++ /dev/null @@ -1,30 +0,0 @@ -/*================================================================ -** Copyright 2000, Clark Cooper -** All rights reserved. -** -** This is free software. You are permitted to copy, distribute, or modify -** it under the terms of the MIT/X license (contained in the COPYING file -** with this distribution.) -*/ - -#ifndef WINCONFIG_H -#define WINCONFIG_H - -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN - -#include -#include - -#define XML_NS 1 -#define XML_DTD 1 -#define XML_CONTEXT_BYTES 1024 - -/* we will assume all Windows platforms are little endian */ -#define BYTEORDER 1234 - -/* Windows has memmove() available. */ -#define HAVE_MEMMOVE - -#endif /* ndef WINCONFIG_H */ diff --git a/external/mit/expat/dist/lib/xmlparse.c b/external/mit/expat/dist/lib/xmlparse.c deleted file mode 100755 index f35aa36ba..000000000 --- a/external/mit/expat/dist/lib/xmlparse.c +++ /dev/null @@ -1,6403 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include /* memset(), memcpy() */ -#include -#include /* UINT_MAX */ -#include /* time() */ - -#define XML_BUILDING_EXPAT 1 - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#elif defined(HAVE_EXPAT_CONFIG_H) -#include -#endif /* ndef COMPILED_FROM_DSP */ - -#include "ascii.h" -#include "expat.h" - -#ifdef XML_UNICODE -#define XML_ENCODE_MAX XML_UTF16_ENCODE_MAX -#define XmlConvert XmlUtf16Convert -#define XmlGetInternalEncoding XmlGetUtf16InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf16InternalEncodingNS -#define XmlEncode XmlUtf16Encode -/* Using pointer subtraction to convert to integer type. */ -#define MUST_CONVERT(enc, s) (!(enc)->isUtf16 || (((char *)(s) - (char *)NULL) & 1)) -typedef unsigned short ICHAR; -#else -#define XML_ENCODE_MAX XML_UTF8_ENCODE_MAX -#define XmlConvert XmlUtf8Convert -#define XmlGetInternalEncoding XmlGetUtf8InternalEncoding -#define XmlGetInternalEncodingNS XmlGetUtf8InternalEncodingNS -#define XmlEncode XmlUtf8Encode -#define MUST_CONVERT(enc, s) (!(enc)->isUtf8) -typedef char ICHAR; -#endif - - -#ifndef XML_NS - -#define XmlInitEncodingNS XmlInitEncoding -#define XmlInitUnknownEncodingNS XmlInitUnknownEncoding -#undef XmlGetInternalEncodingNS -#define XmlGetInternalEncodingNS XmlGetInternalEncoding -#define XmlParseXmlDeclNS XmlParseXmlDecl - -#endif - -#ifdef XML_UNICODE - -#ifdef XML_UNICODE_WCHAR_T -#define XML_T(x) (const wchar_t)x -#define XML_L(x) L ## x -#else -#define XML_T(x) (const unsigned short)x -#define XML_L(x) x -#endif - -#else - -#define XML_T(x) x -#define XML_L(x) x - -#endif - -/* Round up n to be a multiple of sz, where sz is a power of 2. */ -#define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) - -/* Handle the case where memmove() doesn't exist. */ -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#error memmove does not exist on this platform, nor is a substitute available -#endif /* HAVE_BCOPY */ -#endif /* HAVE_MEMMOVE */ - -#include "internal.h" -#include "xmltok.h" -#include "xmlrole.h" - -typedef const XML_Char *KEY; - -typedef struct { - KEY name; -} NAMED; - -typedef struct { - NAMED **v; - unsigned char power; - size_t size; - size_t used; - const XML_Memory_Handling_Suite *mem; -} HASH_TABLE; - -/* Basic character hash algorithm, taken from Python's string hash: - h = h * 1000003 ^ character, the constant being a prime number. - -*/ -#ifdef XML_UNICODE -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned short)(c)) -#else -#define CHAR_HASH(h, c) \ - (((h) * 0xF4243) ^ (unsigned char)(c)) -#endif - -/* For probing (after a collision) we need a step size relative prime - to the hash table size, which is a power of 2. We use double-hashing, - since we can calculate a second hash value cheaply by taking those bits - of the first hash value that were discarded (masked out) when the table - index was calculated: index = hash & mask, where mask = table->size - 1. - We limit the maximum step size to table->size / 4 (mask >> 2) and make - it odd, since odd numbers are always relative prime to a power of 2. -*/ -#define SECOND_HASH(hash, mask, power) \ - ((((hash) & ~(mask)) >> ((power) - 1)) & ((mask) >> 2)) -#define PROBE_STEP(hash, mask, power) \ - ((unsigned char)((SECOND_HASH(hash, mask, power)) | 1)) - -typedef struct { - NAMED **p; - NAMED **end; -} HASH_TABLE_ITER; - -#define INIT_TAG_BUF_SIZE 32 /* must be a multiple of sizeof(XML_Char) */ -#define INIT_DATA_BUF_SIZE 1024 -#define INIT_ATTS_SIZE 16 -#define INIT_ATTS_VERSION 0xFFFFFFFF -#define INIT_BLOCK_SIZE 1024 -#define INIT_BUFFER_SIZE 1024 - -#define EXPAND_SPARE 24 - -typedef struct binding { - struct prefix *prefix; - struct binding *nextTagBinding; - struct binding *prevPrefixBinding; - const struct attribute_id *attId; - XML_Char *uri; - int uriLen; - int uriAlloc; -} BINDING; - -typedef struct prefix { - const XML_Char *name; - BINDING *binding; -} PREFIX; - -typedef struct { - const XML_Char *str; - const XML_Char *localPart; - const XML_Char *prefix; - int strLen; - int uriLen; - int prefixLen; -} TAG_NAME; - -/* TAG represents an open element. - The name of the element is stored in both the document and API - encodings. The memory buffer 'buf' is a separately-allocated - memory area which stores the name. During the XML_Parse()/ - XMLParseBuffer() when the element is open, the memory for the 'raw' - version of the name (in the document encoding) is shared with the - document buffer. If the element is open across calls to - XML_Parse()/XML_ParseBuffer(), the buffer is re-allocated to - contain the 'raw' name as well. - - A parser re-uses these structures, maintaining a list of allocated - TAG objects in a free list. -*/ -typedef struct tag { - struct tag *parent; /* parent of this element */ - const char *rawName; /* tagName in the original encoding */ - int rawNameLength; - TAG_NAME name; /* tagName in the API encoding */ - char *buf; /* buffer for name components */ - char *bufEnd; /* end of the buffer */ - BINDING *bindings; -} TAG; - -typedef struct { - const XML_Char *name; - const XML_Char *textPtr; - int textLen; /* length in XML_Chars */ - int processed; /* # of processed bytes - when suspended */ - const XML_Char *systemId; - const XML_Char *base; - const XML_Char *publicId; - const XML_Char *notation; - XML_Bool open; - XML_Bool is_param; - XML_Bool is_internal; /* true if declared in internal subset outside PE */ -} ENTITY; - -typedef struct { - enum XML_Content_Type type; - enum XML_Content_Quant quant; - const XML_Char * name; - int firstchild; - int lastchild; - int childcnt; - int nextsib; -} CONTENT_SCAFFOLD; - -#define INIT_SCAFFOLD_ELEMENTS 32 - -typedef struct block { - struct block *next; - int size; - XML_Char s[1]; -} BLOCK; - -typedef struct { - BLOCK *blocks; - BLOCK *freeBlocks; - const XML_Char *end; - XML_Char *ptr; - XML_Char *start; - const XML_Memory_Handling_Suite *mem; -} STRING_POOL; - -/* The XML_Char before the name is used to determine whether - an attribute has been specified. */ -typedef struct attribute_id { - XML_Char *name; - PREFIX *prefix; - XML_Bool maybeTokenized; - XML_Bool xmlns; -} ATTRIBUTE_ID; - -typedef struct { - const ATTRIBUTE_ID *id; - XML_Bool isCdata; - const XML_Char *value; -} DEFAULT_ATTRIBUTE; - -typedef struct { - unsigned long version; - unsigned long hash; - const XML_Char *uriName; -} NS_ATT; - -typedef struct { - const XML_Char *name; - PREFIX *prefix; - const ATTRIBUTE_ID *idAtt; - int nDefaultAtts; - int allocDefaultAtts; - DEFAULT_ATTRIBUTE *defaultAtts; -} ELEMENT_TYPE; - -typedef struct { - HASH_TABLE generalEntities; - HASH_TABLE elementTypes; - HASH_TABLE attributeIds; - HASH_TABLE prefixes; - STRING_POOL pool; - STRING_POOL entityValuePool; - /* false once a parameter entity reference has been skipped */ - XML_Bool keepProcessing; - /* true once an internal or external PE reference has been encountered; - this includes the reference to an external subset */ - XML_Bool hasParamEntityRefs; - XML_Bool standalone; -#ifdef XML_DTD - /* indicates if external PE has been read */ - XML_Bool paramEntityRead; - HASH_TABLE paramEntities; -#endif /* XML_DTD */ - PREFIX defaultPrefix; - /* === scaffolding for building content model === */ - XML_Bool in_eldecl; - CONTENT_SCAFFOLD *scaffold; - unsigned contentStringLen; - unsigned scaffSize; - unsigned scaffCount; - int scaffLevel; - int *scaffIndex; -} DTD; - -typedef struct open_internal_entity { - const char *internalEventPtr; - const char *internalEventEndPtr; - struct open_internal_entity *next; - ENTITY *entity; - int startTagLevel; - XML_Bool betweenDecl; /* WFC: PE Between Declarations */ -} OPEN_INTERNAL_ENTITY; - -typedef enum XML_Error PTRCALL Processor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr); - -static Processor prologProcessor; -static Processor prologInitProcessor; -static Processor contentProcessor; -static Processor cdataSectionProcessor; -#ifdef XML_DTD -static Processor ignoreSectionProcessor; -static Processor externalParEntProcessor; -static Processor externalParEntInitProcessor; -static Processor entityValueProcessor; -static Processor entityValueInitProcessor; -#endif /* XML_DTD */ -static Processor epilogProcessor; -static Processor errorProcessor; -static Processor externalEntityInitProcessor; -static Processor externalEntityInitProcessor2; -static Processor externalEntityInitProcessor3; -static Processor externalEntityContentProcessor; -static Processor internalEntityProcessor; - -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName); -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next); -static enum XML_Error -initializeEncoding(XML_Parser parser); -static enum XML_Error -doProlog(XML_Parser parser, const ENCODING *enc, const char *s, - const char *end, int tok, const char *next, const char **nextPtr, - XML_Bool haveMore); -static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, - XML_Bool betweenDecl); -static enum XML_Error -doContent(XML_Parser parser, int startTagLevel, const ENCODING *enc, - const char *start, const char *end, const char **endPtr, - XML_Bool haveMore); -static enum XML_Error -doCdataSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr, XML_Bool haveMore); -#ifdef XML_DTD -static enum XML_Error -doIgnoreSection(XML_Parser parser, const ENCODING *, const char **startPtr, - const char *end, const char **nextPtr, XML_Bool haveMore); -#endif /* XML_DTD */ - -static enum XML_Error -storeAtts(XML_Parser parser, const ENCODING *, const char *s, - TAG_NAME *tagNamePtr, BINDING **bindingsPtr); -static enum XML_Error -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr); -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *, XML_Bool isCdata, - XML_Bool isId, const XML_Char *dfltValue, XML_Parser parser); -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *, XML_Bool isCdata, - const char *, const char *, STRING_POOL *); -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *); -static enum XML_Error -storeEntityValue(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end); -static int -reportComment(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); -static void -reportDefault(XML_Parser parser, const ENCODING *enc, const char *start, - const char *end); - -static const XML_Char * getContext(XML_Parser parser); -static XML_Bool -setContext(XML_Parser parser, const XML_Char *context); - -static void FASTCALL normalizePublicId(XML_Char *s); - -static DTD * dtdCreate(const XML_Memory_Handling_Suite *ms); -/* do not call if parentParser != NULL */ -static void dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms); -static void -dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms); -static int -dtdCopy(XML_Parser oldParser, - DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms); -static int -copyEntityTable(XML_Parser oldParser, - HASH_TABLE *, STRING_POOL *, const HASH_TABLE *); -static NAMED * -lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize); -static void FASTCALL -hashTableInit(HASH_TABLE *, const XML_Memory_Handling_Suite *ms); -static void FASTCALL hashTableClear(HASH_TABLE *); -static void FASTCALL hashTableDestroy(HASH_TABLE *); -static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *, const HASH_TABLE *); -static NAMED * FASTCALL hashTableIterNext(HASH_TABLE_ITER *); - -static void FASTCALL -poolInit(STRING_POOL *, const XML_Memory_Handling_Suite *ms); -static void FASTCALL poolClear(STRING_POOL *); -static void FASTCALL poolDestroy(STRING_POOL *); -static XML_Char * -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Char * -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end); -static XML_Bool FASTCALL poolGrow(STRING_POOL *pool); -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s); -static const XML_Char * -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n); -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s); - -static int FASTCALL nextScaffoldPart(XML_Parser parser); -static XML_Content * build_model(XML_Parser parser); -static ELEMENT_TYPE * -getElementType(XML_Parser parser, const ENCODING *enc, - const char *ptr, const char *end); - -static unsigned long generate_hash_secret_salt(void); -static XML_Bool startParsing(XML_Parser parser); - -static XML_Parser -parserCreate(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep, - DTD *dtd); - -static void -parserInit(XML_Parser parser, const XML_Char *encodingName); - -#define poolStart(pool) ((pool)->start) -#define poolEnd(pool) ((pool)->ptr) -#define poolLength(pool) ((pool)->ptr - (pool)->start) -#define poolChop(pool) ((void)--(pool->ptr)) -#define poolLastChar(pool) (((pool)->ptr)[-1]) -#define poolDiscard(pool) ((pool)->ptr = (pool)->start) -#define poolFinish(pool) ((pool)->start = (pool)->ptr) -#define poolAppendChar(pool, c) \ - (((pool)->ptr == (pool)->end && !poolGrow(pool)) \ - ? 0 \ - : ((*((pool)->ptr)++ = c), 1)) - -struct XML_ParserStruct { - /* The first member must be userData so that the XML_GetUserData - macro works. */ - void *m_userData; - void *m_handlerArg; - char *m_buffer; - const XML_Memory_Handling_Suite m_mem; - /* first character to be parsed */ - const char *m_bufferPtr; - /* past last character to be parsed */ - char *m_bufferEnd; - /* allocated end of buffer */ - const char *m_bufferLim; - XML_Index m_parseEndByteIndex; - const char *m_parseEndPtr; - XML_Char *m_dataBuf; - XML_Char *m_dataBufEnd; - XML_StartElementHandler m_startElementHandler; - XML_EndElementHandler m_endElementHandler; - XML_CharacterDataHandler m_characterDataHandler; - XML_ProcessingInstructionHandler m_processingInstructionHandler; - XML_CommentHandler m_commentHandler; - XML_StartCdataSectionHandler m_startCdataSectionHandler; - XML_EndCdataSectionHandler m_endCdataSectionHandler; - XML_DefaultHandler m_defaultHandler; - XML_StartDoctypeDeclHandler m_startDoctypeDeclHandler; - XML_EndDoctypeDeclHandler m_endDoctypeDeclHandler; - XML_UnparsedEntityDeclHandler m_unparsedEntityDeclHandler; - XML_NotationDeclHandler m_notationDeclHandler; - XML_StartNamespaceDeclHandler m_startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler m_endNamespaceDeclHandler; - XML_NotStandaloneHandler m_notStandaloneHandler; - XML_ExternalEntityRefHandler m_externalEntityRefHandler; - XML_Parser m_externalEntityRefHandlerArg; - XML_SkippedEntityHandler m_skippedEntityHandler; - XML_UnknownEncodingHandler m_unknownEncodingHandler; - XML_ElementDeclHandler m_elementDeclHandler; - XML_AttlistDeclHandler m_attlistDeclHandler; - XML_EntityDeclHandler m_entityDeclHandler; - XML_XmlDeclHandler m_xmlDeclHandler; - const ENCODING *m_encoding; - INIT_ENCODING m_initEncoding; - const ENCODING *m_internalEncoding; - const XML_Char *m_protocolEncodingName; - XML_Bool m_ns; - XML_Bool m_ns_triplets; - void *m_unknownEncodingMem; - void *m_unknownEncodingData; - void *m_unknownEncodingHandlerData; - void (XMLCALL *m_unknownEncodingRelease)(void *); - PROLOG_STATE m_prologState; - Processor *m_processor; - enum XML_Error m_errorCode; - const char *m_eventPtr; - const char *m_eventEndPtr; - const char *m_positionPtr; - OPEN_INTERNAL_ENTITY *m_openInternalEntities; - OPEN_INTERNAL_ENTITY *m_freeInternalEntities; - XML_Bool m_defaultExpandInternalEntities; - int m_tagLevel; - ENTITY *m_declEntity; - const XML_Char *m_doctypeName; - const XML_Char *m_doctypeSysid; - const XML_Char *m_doctypePubid; - const XML_Char *m_declAttributeType; - const XML_Char *m_declNotationName; - const XML_Char *m_declNotationPublicId; - ELEMENT_TYPE *m_declElementType; - ATTRIBUTE_ID *m_declAttributeId; - XML_Bool m_declAttributeIsCdata; - XML_Bool m_declAttributeIsId; - DTD *m_dtd; - const XML_Char *m_curBase; - TAG *m_tagStack; - TAG *m_freeTagList; - BINDING *m_inheritedBindings; - BINDING *m_freeBindingList; - int m_attsSize; - int m_nSpecifiedAtts; - int m_idAttIndex; - ATTRIBUTE *m_atts; - NS_ATT *m_nsAtts; - unsigned long m_nsAttsVersion; - unsigned char m_nsAttsPower; -#ifdef XML_ATTR_INFO - XML_AttrInfo *m_attInfo; -#endif - POSITION m_position; - STRING_POOL m_tempPool; - STRING_POOL m_temp2Pool; - char *m_groupConnector; - unsigned int m_groupSize; - XML_Char m_namespaceSeparator; - XML_Parser m_parentParser; - XML_ParsingStatus m_parsingStatus; -#ifdef XML_DTD - XML_Bool m_isParamEntity; - XML_Bool m_useForeignDTD; - enum XML_ParamEntityParsing m_paramEntityParsing; -#endif - unsigned long m_hash_secret_salt; -}; - -#define MALLOC(s) (parser->m_mem.malloc_fcn((s))) -#define REALLOC(p,s) (parser->m_mem.realloc_fcn((p),(s))) -#define FREE(p) (parser->m_mem.free_fcn((p))) - -#define userData (parser->m_userData) -#define handlerArg (parser->m_handlerArg) -#define startElementHandler (parser->m_startElementHandler) -#define endElementHandler (parser->m_endElementHandler) -#define characterDataHandler (parser->m_characterDataHandler) -#define processingInstructionHandler \ - (parser->m_processingInstructionHandler) -#define commentHandler (parser->m_commentHandler) -#define startCdataSectionHandler \ - (parser->m_startCdataSectionHandler) -#define endCdataSectionHandler (parser->m_endCdataSectionHandler) -#define defaultHandler (parser->m_defaultHandler) -#define startDoctypeDeclHandler (parser->m_startDoctypeDeclHandler) -#define endDoctypeDeclHandler (parser->m_endDoctypeDeclHandler) -#define unparsedEntityDeclHandler \ - (parser->m_unparsedEntityDeclHandler) -#define notationDeclHandler (parser->m_notationDeclHandler) -#define startNamespaceDeclHandler \ - (parser->m_startNamespaceDeclHandler) -#define endNamespaceDeclHandler (parser->m_endNamespaceDeclHandler) -#define notStandaloneHandler (parser->m_notStandaloneHandler) -#define externalEntityRefHandler \ - (parser->m_externalEntityRefHandler) -#define externalEntityRefHandlerArg \ - (parser->m_externalEntityRefHandlerArg) -#define internalEntityRefHandler \ - (parser->m_internalEntityRefHandler) -#define skippedEntityHandler (parser->m_skippedEntityHandler) -#define unknownEncodingHandler (parser->m_unknownEncodingHandler) -#define elementDeclHandler (parser->m_elementDeclHandler) -#define attlistDeclHandler (parser->m_attlistDeclHandler) -#define entityDeclHandler (parser->m_entityDeclHandler) -#define xmlDeclHandler (parser->m_xmlDeclHandler) -#define encoding (parser->m_encoding) -#define initEncoding (parser->m_initEncoding) -#define internalEncoding (parser->m_internalEncoding) -#define unknownEncodingMem (parser->m_unknownEncodingMem) -#define unknownEncodingData (parser->m_unknownEncodingData) -#define unknownEncodingHandlerData \ - (parser->m_unknownEncodingHandlerData) -#define unknownEncodingRelease (parser->m_unknownEncodingRelease) -#define protocolEncodingName (parser->m_protocolEncodingName) -#define ns (parser->m_ns) -#define ns_triplets (parser->m_ns_triplets) -#define prologState (parser->m_prologState) -#define processor (parser->m_processor) -#define errorCode (parser->m_errorCode) -#define eventPtr (parser->m_eventPtr) -#define eventEndPtr (parser->m_eventEndPtr) -#define positionPtr (parser->m_positionPtr) -#define position (parser->m_position) -#define openInternalEntities (parser->m_openInternalEntities) -#define freeInternalEntities (parser->m_freeInternalEntities) -#define defaultExpandInternalEntities \ - (parser->m_defaultExpandInternalEntities) -#define tagLevel (parser->m_tagLevel) -#define buffer (parser->m_buffer) -#define bufferPtr (parser->m_bufferPtr) -#define bufferEnd (parser->m_bufferEnd) -#define parseEndByteIndex (parser->m_parseEndByteIndex) -#define parseEndPtr (parser->m_parseEndPtr) -#define bufferLim (parser->m_bufferLim) -#define dataBuf (parser->m_dataBuf) -#define dataBufEnd (parser->m_dataBufEnd) -#define _dtd (parser->m_dtd) -#define curBase (parser->m_curBase) -#define declEntity (parser->m_declEntity) -#define doctypeName (parser->m_doctypeName) -#define doctypeSysid (parser->m_doctypeSysid) -#define doctypePubid (parser->m_doctypePubid) -#define declAttributeType (parser->m_declAttributeType) -#define declNotationName (parser->m_declNotationName) -#define declNotationPublicId (parser->m_declNotationPublicId) -#define declElementType (parser->m_declElementType) -#define declAttributeId (parser->m_declAttributeId) -#define declAttributeIsCdata (parser->m_declAttributeIsCdata) -#define declAttributeIsId (parser->m_declAttributeIsId) -#define freeTagList (parser->m_freeTagList) -#define freeBindingList (parser->m_freeBindingList) -#define inheritedBindings (parser->m_inheritedBindings) -#define tagStack (parser->m_tagStack) -#define atts (parser->m_atts) -#define attsSize (parser->m_attsSize) -#define nSpecifiedAtts (parser->m_nSpecifiedAtts) -#define idAttIndex (parser->m_idAttIndex) -#define nsAtts (parser->m_nsAtts) -#define nsAttsVersion (parser->m_nsAttsVersion) -#define nsAttsPower (parser->m_nsAttsPower) -#define attInfo (parser->m_attInfo) -#define tempPool (parser->m_tempPool) -#define temp2Pool (parser->m_temp2Pool) -#define groupConnector (parser->m_groupConnector) -#define groupSize (parser->m_groupSize) -#define namespaceSeparator (parser->m_namespaceSeparator) -#define parentParser (parser->m_parentParser) -#define ps_parsing (parser->m_parsingStatus.parsing) -#define ps_finalBuffer (parser->m_parsingStatus.finalBuffer) -#ifdef XML_DTD -#define isParamEntity (parser->m_isParamEntity) -#define useForeignDTD (parser->m_useForeignDTD) -#define paramEntityParsing (parser->m_paramEntityParsing) -#endif /* XML_DTD */ -#define hash_secret_salt (parser->m_hash_secret_salt) - -XML_Parser XMLCALL -XML_ParserCreate(const XML_Char *encodingName) -{ - return XML_ParserCreate_MM(encodingName, NULL, NULL); -} - -XML_Parser XMLCALL -XML_ParserCreateNS(const XML_Char *encodingName, XML_Char nsSep) -{ - XML_Char tmp[2]; - *tmp = nsSep; - return XML_ParserCreate_MM(encodingName, NULL, tmp); -} - -static const XML_Char implicitContext[] = { - ASCII_x, ASCII_m, ASCII_l, ASCII_EQUALS, ASCII_h, ASCII_t, ASCII_t, ASCII_p, - ASCII_COLON, ASCII_SLASH, ASCII_SLASH, ASCII_w, ASCII_w, ASCII_w, - ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, ASCII_o, ASCII_r, ASCII_g, - ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, ASCII_SLASH, ASCII_1, ASCII_9, - ASCII_9, ASCII_8, ASCII_SLASH, ASCII_n, ASCII_a, ASCII_m, ASCII_e, - ASCII_s, ASCII_p, ASCII_a, ASCII_c, ASCII_e, '\0' -}; - -static unsigned long -generate_hash_secret_salt(void) -{ - unsigned int seed = time(NULL) % UINT_MAX; - srand(seed); - return rand(); -} - -static XML_Bool /* only valid for root parser */ -startParsing(XML_Parser parser) -{ - /* hash functions must be initialized before setContext() is called */ - if (hash_secret_salt == 0) - hash_secret_salt = generate_hash_secret_salt(); - if (ns) { - /* implicit context only set for root parser, since child - parsers (i.e. external entity parsers) will inherit it - */ - return setContext(parser, implicitContext); - } - return XML_TRUE; -} - -XML_Parser XMLCALL -XML_ParserCreate_MM(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep) -{ - return parserCreate(encodingName, memsuite, nameSep, NULL); -} - -static XML_Parser -parserCreate(const XML_Char *encodingName, - const XML_Memory_Handling_Suite *memsuite, - const XML_Char *nameSep, - DTD *dtd) -{ - XML_Parser parser; - - if (memsuite) { - XML_Memory_Handling_Suite *mtemp; - parser = (XML_Parser) - memsuite->malloc_fcn(sizeof(struct XML_ParserStruct)); - if (parser != NULL) { - mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); - mtemp->malloc_fcn = memsuite->malloc_fcn; - mtemp->realloc_fcn = memsuite->realloc_fcn; - mtemp->free_fcn = memsuite->free_fcn; - } - } - else { - XML_Memory_Handling_Suite *mtemp; - parser = (XML_Parser)malloc(sizeof(struct XML_ParserStruct)); - if (parser != NULL) { - mtemp = (XML_Memory_Handling_Suite *)&(parser->m_mem); - mtemp->malloc_fcn = malloc; - mtemp->realloc_fcn = realloc; - mtemp->free_fcn = free; - } - } - - if (!parser) - return parser; - - buffer = NULL; - bufferLim = NULL; - - attsSize = INIT_ATTS_SIZE; - atts = (ATTRIBUTE *)MALLOC(attsSize * sizeof(ATTRIBUTE)); - if (atts == NULL) { - FREE(parser); - return NULL; - } -#ifdef XML_ATTR_INFO - attInfo = (XML_AttrInfo*)MALLOC(attsSize * sizeof(XML_AttrInfo)); - if (attInfo == NULL) { - FREE(atts); - FREE(parser); - return NULL; - } -#endif - dataBuf = (XML_Char *)MALLOC(INIT_DATA_BUF_SIZE * sizeof(XML_Char)); - if (dataBuf == NULL) { - FREE(atts); -#ifdef XML_ATTR_INFO - FREE(attInfo); -#endif - FREE(parser); - return NULL; - } - dataBufEnd = dataBuf + INIT_DATA_BUF_SIZE; - - if (dtd) - _dtd = dtd; - else { - _dtd = dtdCreate(&parser->m_mem); - if (_dtd == NULL) { - FREE(dataBuf); - FREE(atts); -#ifdef XML_ATTR_INFO - FREE(attInfo); -#endif - FREE(parser); - return NULL; - } - } - - freeBindingList = NULL; - freeTagList = NULL; - freeInternalEntities = NULL; - - groupSize = 0; - groupConnector = NULL; - - unknownEncodingHandler = NULL; - unknownEncodingHandlerData = NULL; - - namespaceSeparator = ASCII_EXCL; - ns = XML_FALSE; - ns_triplets = XML_FALSE; - - nsAtts = NULL; - nsAttsVersion = 0; - nsAttsPower = 0; - - poolInit(&tempPool, &(parser->m_mem)); - poolInit(&temp2Pool, &(parser->m_mem)); - parserInit(parser, encodingName); - - if (encodingName && !protocolEncodingName) { - XML_ParserFree(parser); - return NULL; - } - - if (nameSep) { - ns = XML_TRUE; - internalEncoding = XmlGetInternalEncodingNS(); - namespaceSeparator = *nameSep; - } - else { - internalEncoding = XmlGetInternalEncoding(); - } - - return parser; -} - -static void -parserInit(XML_Parser parser, const XML_Char *encodingName) -{ - processor = prologInitProcessor; - XmlPrologStateInit(&prologState); - protocolEncodingName = (encodingName != NULL - ? poolCopyString(&tempPool, encodingName) - : NULL); - curBase = NULL; - XmlInitEncoding(&initEncoding, &encoding, 0); - userData = NULL; - handlerArg = NULL; - startElementHandler = NULL; - endElementHandler = NULL; - characterDataHandler = NULL; - processingInstructionHandler = NULL; - commentHandler = NULL; - startCdataSectionHandler = NULL; - endCdataSectionHandler = NULL; - defaultHandler = NULL; - startDoctypeDeclHandler = NULL; - endDoctypeDeclHandler = NULL; - unparsedEntityDeclHandler = NULL; - notationDeclHandler = NULL; - startNamespaceDeclHandler = NULL; - endNamespaceDeclHandler = NULL; - notStandaloneHandler = NULL; - externalEntityRefHandler = NULL; - externalEntityRefHandlerArg = parser; - skippedEntityHandler = NULL; - elementDeclHandler = NULL; - attlistDeclHandler = NULL; - entityDeclHandler = NULL; - xmlDeclHandler = NULL; - bufferPtr = buffer; - bufferEnd = buffer; - parseEndByteIndex = 0; - parseEndPtr = NULL; - declElementType = NULL; - declAttributeId = NULL; - declEntity = NULL; - doctypeName = NULL; - doctypeSysid = NULL; - doctypePubid = NULL; - declAttributeType = NULL; - declNotationName = NULL; - declNotationPublicId = NULL; - declAttributeIsCdata = XML_FALSE; - declAttributeIsId = XML_FALSE; - memset(&position, 0, sizeof(POSITION)); - errorCode = XML_ERROR_NONE; - eventPtr = NULL; - eventEndPtr = NULL; - positionPtr = NULL; - openInternalEntities = NULL; - defaultExpandInternalEntities = XML_TRUE; - tagLevel = 0; - tagStack = NULL; - inheritedBindings = NULL; - nSpecifiedAtts = 0; - unknownEncodingMem = NULL; - unknownEncodingRelease = NULL; - unknownEncodingData = NULL; - parentParser = NULL; - ps_parsing = XML_INITIALIZED; -#ifdef XML_DTD - isParamEntity = XML_FALSE; - useForeignDTD = XML_FALSE; - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif - hash_secret_salt = 0; -} - -/* moves list of bindings to freeBindingList */ -static void FASTCALL -moveToFreeBindingList(XML_Parser parser, BINDING *bindings) -{ - while (bindings) { - BINDING *b = bindings; - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - } -} - -XML_Bool XMLCALL -XML_ParserReset(XML_Parser parser, const XML_Char *encodingName) -{ - TAG *tStk; - OPEN_INTERNAL_ENTITY *openEntityList; - if (parentParser) - return XML_FALSE; - /* move tagStack to freeTagList */ - tStk = tagStack; - while (tStk) { - TAG *tag = tStk; - tStk = tStk->parent; - tag->parent = freeTagList; - moveToFreeBindingList(parser, tag->bindings); - tag->bindings = NULL; - freeTagList = tag; - } - /* move openInternalEntities to freeInternalEntities */ - openEntityList = openInternalEntities; - while (openEntityList) { - OPEN_INTERNAL_ENTITY *openEntity = openEntityList; - openEntityList = openEntity->next; - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - moveToFreeBindingList(parser, inheritedBindings); - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - poolClear(&tempPool); - poolClear(&temp2Pool); - parserInit(parser, encodingName); - dtdReset(_dtd, &parser->m_mem); - return XML_TRUE; -} - -enum XML_Status XMLCALL -XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - /* Block after XML_Parse()/XML_ParseBuffer() has been called. - XXX There's no way for the caller to determine which of the - XXX possible error cases caused the XML_STATUS_ERROR return. - */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return XML_STATUS_ERROR; - if (encodingName == NULL) - protocolEncodingName = NULL; - else { - protocolEncodingName = poolCopyString(&tempPool, encodingName); - if (!protocolEncodingName) - return XML_STATUS_ERROR; - } - return XML_STATUS_OK; -} - -XML_Parser XMLCALL -XML_ExternalEntityParserCreate(XML_Parser oldParser, - const XML_Char *context, - const XML_Char *encodingName) -{ - XML_Parser parser = oldParser; - DTD *newDtd = NULL; - DTD *oldDtd = _dtd; - XML_StartElementHandler oldStartElementHandler = startElementHandler; - XML_EndElementHandler oldEndElementHandler = endElementHandler; - XML_CharacterDataHandler oldCharacterDataHandler = characterDataHandler; - XML_ProcessingInstructionHandler oldProcessingInstructionHandler - = processingInstructionHandler; - XML_CommentHandler oldCommentHandler = commentHandler; - XML_StartCdataSectionHandler oldStartCdataSectionHandler - = startCdataSectionHandler; - XML_EndCdataSectionHandler oldEndCdataSectionHandler - = endCdataSectionHandler; - XML_DefaultHandler oldDefaultHandler = defaultHandler; - XML_UnparsedEntityDeclHandler oldUnparsedEntityDeclHandler - = unparsedEntityDeclHandler; - XML_NotationDeclHandler oldNotationDeclHandler = notationDeclHandler; - XML_StartNamespaceDeclHandler oldStartNamespaceDeclHandler - = startNamespaceDeclHandler; - XML_EndNamespaceDeclHandler oldEndNamespaceDeclHandler - = endNamespaceDeclHandler; - XML_NotStandaloneHandler oldNotStandaloneHandler = notStandaloneHandler; - XML_ExternalEntityRefHandler oldExternalEntityRefHandler - = externalEntityRefHandler; - XML_SkippedEntityHandler oldSkippedEntityHandler = skippedEntityHandler; - XML_UnknownEncodingHandler oldUnknownEncodingHandler - = unknownEncodingHandler; - XML_ElementDeclHandler oldElementDeclHandler = elementDeclHandler; - XML_AttlistDeclHandler oldAttlistDeclHandler = attlistDeclHandler; - XML_EntityDeclHandler oldEntityDeclHandler = entityDeclHandler; - XML_XmlDeclHandler oldXmlDeclHandler = xmlDeclHandler; - ELEMENT_TYPE * oldDeclElementType = declElementType; - - void *oldUserData = userData; - void *oldHandlerArg = handlerArg; - XML_Bool oldDefaultExpandInternalEntities = defaultExpandInternalEntities; - XML_Parser oldExternalEntityRefHandlerArg = externalEntityRefHandlerArg; -#ifdef XML_DTD - enum XML_ParamEntityParsing oldParamEntityParsing = paramEntityParsing; - int oldInEntityValue = prologState.inEntityValue; -#endif - XML_Bool oldns_triplets = ns_triplets; - /* Note that the new parser shares the same hash secret as the old - parser, so that dtdCopy and copyEntityTable can lookup values - from hash tables associated with either parser without us having - to worry which hash secrets each table has. - */ - unsigned long oldhash_secret_salt = hash_secret_salt; - -#ifdef XML_DTD - if (!context) - newDtd = oldDtd; -#endif /* XML_DTD */ - - /* Note that the magical uses of the pre-processor to make field - access look more like C++ require that `parser' be overwritten - here. This makes this function more painful to follow than it - would be otherwise. - */ - if (ns) { - XML_Char tmp[2]; - *tmp = namespaceSeparator; - parser = parserCreate(encodingName, &parser->m_mem, tmp, newDtd); - } - else { - parser = parserCreate(encodingName, &parser->m_mem, NULL, newDtd); - } - - if (!parser) - return NULL; - - startElementHandler = oldStartElementHandler; - endElementHandler = oldEndElementHandler; - characterDataHandler = oldCharacterDataHandler; - processingInstructionHandler = oldProcessingInstructionHandler; - commentHandler = oldCommentHandler; - startCdataSectionHandler = oldStartCdataSectionHandler; - endCdataSectionHandler = oldEndCdataSectionHandler; - defaultHandler = oldDefaultHandler; - unparsedEntityDeclHandler = oldUnparsedEntityDeclHandler; - notationDeclHandler = oldNotationDeclHandler; - startNamespaceDeclHandler = oldStartNamespaceDeclHandler; - endNamespaceDeclHandler = oldEndNamespaceDeclHandler; - notStandaloneHandler = oldNotStandaloneHandler; - externalEntityRefHandler = oldExternalEntityRefHandler; - skippedEntityHandler = oldSkippedEntityHandler; - unknownEncodingHandler = oldUnknownEncodingHandler; - elementDeclHandler = oldElementDeclHandler; - attlistDeclHandler = oldAttlistDeclHandler; - entityDeclHandler = oldEntityDeclHandler; - xmlDeclHandler = oldXmlDeclHandler; - declElementType = oldDeclElementType; - userData = oldUserData; - if (oldUserData == oldHandlerArg) - handlerArg = userData; - else - handlerArg = parser; - if (oldExternalEntityRefHandlerArg != oldParser) - externalEntityRefHandlerArg = oldExternalEntityRefHandlerArg; - defaultExpandInternalEntities = oldDefaultExpandInternalEntities; - ns_triplets = oldns_triplets; - hash_secret_salt = oldhash_secret_salt; - parentParser = oldParser; -#ifdef XML_DTD - paramEntityParsing = oldParamEntityParsing; - prologState.inEntityValue = oldInEntityValue; - if (context) { -#endif /* XML_DTD */ - if (!dtdCopy(oldParser, _dtd, oldDtd, &parser->m_mem) - || !setContext(parser, context)) { - XML_ParserFree(parser); - return NULL; - } - processor = externalEntityInitProcessor; -#ifdef XML_DTD - } - else { - /* The DTD instance referenced by _dtd is shared between the document's - root parser and external PE parsers, therefore one does not need to - call setContext. In addition, one also *must* not call setContext, - because this would overwrite existing prefix->binding pointers in - _dtd with ones that get destroyed with the external PE parser. - This would leave those prefixes with dangling pointers. - */ - isParamEntity = XML_TRUE; - XmlPrologStateInitExternalEntity(&prologState); - processor = externalParEntInitProcessor; - } -#endif /* XML_DTD */ - return parser; -} - -static void FASTCALL -destroyBindings(BINDING *bindings, XML_Parser parser) -{ - for (;;) { - BINDING *b = bindings; - if (!b) - break; - bindings = b->nextTagBinding; - FREE(b->uri); - FREE(b); - } -} - -void XMLCALL -XML_ParserFree(XML_Parser parser) -{ - TAG *tagList; - OPEN_INTERNAL_ENTITY *entityList; - if (parser == NULL) - return; - /* free tagStack and freeTagList */ - tagList = tagStack; - for (;;) { - TAG *p; - if (tagList == NULL) { - if (freeTagList == NULL) - break; - tagList = freeTagList; - freeTagList = NULL; - } - p = tagList; - tagList = tagList->parent; - FREE(p->buf); - destroyBindings(p->bindings, parser); - FREE(p); - } - /* free openInternalEntities and freeInternalEntities */ - entityList = openInternalEntities; - for (;;) { - OPEN_INTERNAL_ENTITY *openEntity; - if (entityList == NULL) { - if (freeInternalEntities == NULL) - break; - entityList = freeInternalEntities; - freeInternalEntities = NULL; - } - openEntity = entityList; - entityList = entityList->next; - FREE(openEntity); - } - - destroyBindings(freeBindingList, parser); - destroyBindings(inheritedBindings, parser); - poolDestroy(&tempPool); - poolDestroy(&temp2Pool); -#ifdef XML_DTD - /* external parameter entity parsers share the DTD structure - parser->m_dtd with the root parser, so we must not destroy it - */ - if (!isParamEntity && _dtd) -#else - if (_dtd) -#endif /* XML_DTD */ - dtdDestroy(_dtd, (XML_Bool)!parentParser, &parser->m_mem); - FREE((void *)atts); -#ifdef XML_ATTR_INFO - FREE((void *)attInfo); -#endif - FREE(groupConnector); - FREE(buffer); - FREE(dataBuf); - FREE(nsAtts); - FREE(unknownEncodingMem); - if (unknownEncodingRelease) - unknownEncodingRelease(unknownEncodingData); - FREE(parser); -} - -void XMLCALL -XML_UseParserAsHandlerArg(XML_Parser parser) -{ - handlerArg = parser; -} - -enum XML_Error XMLCALL -XML_UseForeignDTD(XML_Parser parser, XML_Bool useDTD) -{ -#ifdef XML_DTD - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return XML_ERROR_CANT_CHANGE_FEATURE_ONCE_PARSING; - useForeignDTD = useDTD; - return XML_ERROR_NONE; -#else - return XML_ERROR_FEATURE_REQUIRES_XML_DTD; -#endif -} - -void XMLCALL -XML_SetReturnNSTriplet(XML_Parser parser, int do_nst) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return; - ns_triplets = do_nst ? XML_TRUE : XML_FALSE; -} - -void XMLCALL -XML_SetUserData(XML_Parser parser, void *p) -{ - if (handlerArg == userData) - handlerArg = userData = p; - else - userData = p; -} - -enum XML_Status XMLCALL -XML_SetBase(XML_Parser parser, const XML_Char *p) -{ - if (p) { - p = poolCopyString(&_dtd->pool, p); - if (!p) - return XML_STATUS_ERROR; - curBase = p; - } - else - curBase = NULL; - return XML_STATUS_OK; -} - -const XML_Char * XMLCALL -XML_GetBase(XML_Parser parser) -{ - return curBase; -} - -int XMLCALL -XML_GetSpecifiedAttributeCount(XML_Parser parser) -{ - return nSpecifiedAtts; -} - -int XMLCALL -XML_GetIdAttributeIndex(XML_Parser parser) -{ - return idAttIndex; -} - -#ifdef XML_ATTR_INFO -const XML_AttrInfo * XMLCALL -XML_GetAttributeInfo(XML_Parser parser) -{ - return attInfo; -} -#endif - -void XMLCALL -XML_SetElementHandler(XML_Parser parser, - XML_StartElementHandler start, - XML_EndElementHandler end) -{ - startElementHandler = start; - endElementHandler = end; -} - -void XMLCALL -XML_SetStartElementHandler(XML_Parser parser, - XML_StartElementHandler start) { - startElementHandler = start; -} - -void XMLCALL -XML_SetEndElementHandler(XML_Parser parser, - XML_EndElementHandler end) { - endElementHandler = end; -} - -void XMLCALL -XML_SetCharacterDataHandler(XML_Parser parser, - XML_CharacterDataHandler handler) -{ - characterDataHandler = handler; -} - -void XMLCALL -XML_SetProcessingInstructionHandler(XML_Parser parser, - XML_ProcessingInstructionHandler handler) -{ - processingInstructionHandler = handler; -} - -void XMLCALL -XML_SetCommentHandler(XML_Parser parser, - XML_CommentHandler handler) -{ - commentHandler = handler; -} - -void XMLCALL -XML_SetCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start, - XML_EndCdataSectionHandler end) -{ - startCdataSectionHandler = start; - endCdataSectionHandler = end; -} - -void XMLCALL -XML_SetStartCdataSectionHandler(XML_Parser parser, - XML_StartCdataSectionHandler start) { - startCdataSectionHandler = start; -} - -void XMLCALL -XML_SetEndCdataSectionHandler(XML_Parser parser, - XML_EndCdataSectionHandler end) { - endCdataSectionHandler = end; -} - -void XMLCALL -XML_SetDefaultHandler(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_FALSE; -} - -void XMLCALL -XML_SetDefaultHandlerExpand(XML_Parser parser, - XML_DefaultHandler handler) -{ - defaultHandler = handler; - defaultExpandInternalEntities = XML_TRUE; -} - -void XMLCALL -XML_SetDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start, - XML_EndDoctypeDeclHandler end) -{ - startDoctypeDeclHandler = start; - endDoctypeDeclHandler = end; -} - -void XMLCALL -XML_SetStartDoctypeDeclHandler(XML_Parser parser, - XML_StartDoctypeDeclHandler start) { - startDoctypeDeclHandler = start; -} - -void XMLCALL -XML_SetEndDoctypeDeclHandler(XML_Parser parser, - XML_EndDoctypeDeclHandler end) { - endDoctypeDeclHandler = end; -} - -void XMLCALL -XML_SetUnparsedEntityDeclHandler(XML_Parser parser, - XML_UnparsedEntityDeclHandler handler) -{ - unparsedEntityDeclHandler = handler; -} - -void XMLCALL -XML_SetNotationDeclHandler(XML_Parser parser, - XML_NotationDeclHandler handler) -{ - notationDeclHandler = handler; -} - -void XMLCALL -XML_SetNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start, - XML_EndNamespaceDeclHandler end) -{ - startNamespaceDeclHandler = start; - endNamespaceDeclHandler = end; -} - -void XMLCALL -XML_SetStartNamespaceDeclHandler(XML_Parser parser, - XML_StartNamespaceDeclHandler start) { - startNamespaceDeclHandler = start; -} - -void XMLCALL -XML_SetEndNamespaceDeclHandler(XML_Parser parser, - XML_EndNamespaceDeclHandler end) { - endNamespaceDeclHandler = end; -} - -void XMLCALL -XML_SetNotStandaloneHandler(XML_Parser parser, - XML_NotStandaloneHandler handler) -{ - notStandaloneHandler = handler; -} - -void XMLCALL -XML_SetExternalEntityRefHandler(XML_Parser parser, - XML_ExternalEntityRefHandler handler) -{ - externalEntityRefHandler = handler; -} - -void XMLCALL -XML_SetExternalEntityRefHandlerArg(XML_Parser parser, void *arg) -{ - if (arg) - externalEntityRefHandlerArg = (XML_Parser)arg; - else - externalEntityRefHandlerArg = parser; -} - -void XMLCALL -XML_SetSkippedEntityHandler(XML_Parser parser, - XML_SkippedEntityHandler handler) -{ - skippedEntityHandler = handler; -} - -void XMLCALL -XML_SetUnknownEncodingHandler(XML_Parser parser, - XML_UnknownEncodingHandler handler, - void *data) -{ - unknownEncodingHandler = handler; - unknownEncodingHandlerData = data; -} - -void XMLCALL -XML_SetElementDeclHandler(XML_Parser parser, - XML_ElementDeclHandler eldecl) -{ - elementDeclHandler = eldecl; -} - -void XMLCALL -XML_SetAttlistDeclHandler(XML_Parser parser, - XML_AttlistDeclHandler attdecl) -{ - attlistDeclHandler = attdecl; -} - -void XMLCALL -XML_SetEntityDeclHandler(XML_Parser parser, - XML_EntityDeclHandler handler) -{ - entityDeclHandler = handler; -} - -void XMLCALL -XML_SetXmlDeclHandler(XML_Parser parser, - XML_XmlDeclHandler handler) { - xmlDeclHandler = handler; -} - -int XMLCALL -XML_SetParamEntityParsing(XML_Parser parser, - enum XML_ParamEntityParsing peParsing) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return 0; -#ifdef XML_DTD - paramEntityParsing = peParsing; - return 1; -#else - return peParsing == XML_PARAM_ENTITY_PARSING_NEVER; -#endif -} - -int XMLCALL -XML_SetHashSalt(XML_Parser parser, - unsigned long hash_salt) -{ - /* block after XML_Parse()/XML_ParseBuffer() has been called */ - if (ps_parsing == XML_PARSING || ps_parsing == XML_SUSPENDED) - return 0; - hash_secret_salt = hash_salt; - return 1; -} - -enum XML_Status XMLCALL -XML_Parse(XML_Parser parser, const char *s, int len, int isFinal) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - case XML_INITIALIZED: - if (parentParser == NULL && !startParsing(parser)) { - errorCode = XML_ERROR_NO_MEMORY; - return XML_STATUS_ERROR; - } - default: - ps_parsing = XML_PARSING; - } - - if (len == 0) { - ps_finalBuffer = (XML_Bool)isFinal; - if (!isFinal) - return XML_STATUS_OK; - positionPtr = bufferPtr; - parseEndPtr = bufferEnd; - - /* If data are left over from last buffer, and we now know that these - data are the final chunk of input, then we have to check them again - to detect errors based on that fact. - */ - errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); - - if (errorCode == XML_ERROR_NONE) { - switch (ps_parsing) { - case XML_SUSPENDED: - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return XML_STATUS_SUSPENDED; - case XML_INITIALIZED: - case XML_PARSING: - ps_parsing = XML_FINISHED; - /* fall through */ - default: - return XML_STATUS_OK; - } - } - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } -#ifndef XML_CONTEXT_BYTES - else if (bufferPtr == bufferEnd) { - const char *end; - int nLeftOver; - enum XML_Error result; - parseEndByteIndex += len; - positionPtr = s; - ps_finalBuffer = (XML_Bool)isFinal; - - errorCode = processor(parser, s, parseEndPtr = s + len, &end); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (isFinal) { - ps_parsing = XML_FINISHED; - return XML_STATUS_OK; - } - /* fall through */ - default: - result = XML_STATUS_OK; - } - } - - XmlUpdatePosition(encoding, positionPtr, end, &position); - nLeftOver = s + len - end; - if (nLeftOver) { - if (buffer == NULL || nLeftOver > bufferLim - buffer) { - /* FIXME avoid integer overflow */ - char *temp; - temp = (buffer == NULL - ? (char *)MALLOC(len * 2) - : (char *)REALLOC(buffer, len * 2)); - if (temp == NULL) { - errorCode = XML_ERROR_NO_MEMORY; - eventPtr = eventEndPtr = NULL; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - buffer = temp; - bufferLim = buffer + len * 2; - } - memcpy(buffer, end, nLeftOver); - } - bufferPtr = buffer; - bufferEnd = buffer + nLeftOver; - positionPtr = bufferPtr; - parseEndPtr = bufferEnd; - eventPtr = bufferPtr; - eventEndPtr = bufferPtr; - return result; - } -#endif /* not defined XML_CONTEXT_BYTES */ - else { - void *buff = XML_GetBuffer(parser, len); - if (buff == NULL) - return XML_STATUS_ERROR; - else { - memcpy(buff, s, len); - return XML_ParseBuffer(parser, len, isFinal); - } - } -} - -enum XML_Status XMLCALL -XML_ParseBuffer(XML_Parser parser, int len, int isFinal) -{ - const char *start; - enum XML_Status result = XML_STATUS_OK; - - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - case XML_INITIALIZED: - if (parentParser == NULL && !startParsing(parser)) { - errorCode = XML_ERROR_NO_MEMORY; - return XML_STATUS_ERROR; - } - default: - ps_parsing = XML_PARSING; - } - - start = bufferPtr; - positionPtr = start; - bufferEnd += len; - parseEndPtr = bufferEnd; - parseEndByteIndex += len; - ps_finalBuffer = (XML_Bool)isFinal; - - errorCode = processor(parser, start, parseEndPtr, &bufferPtr); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (isFinal) { - ps_parsing = XML_FINISHED; - return result; - } - default: ; /* should not happen */ - } - } - - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return result; -} - -void * XMLCALL -XML_GetBuffer(XML_Parser parser, int len) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - errorCode = XML_ERROR_SUSPENDED; - return NULL; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return NULL; - default: ; - } - - if (len > bufferLim - bufferEnd) { - /* FIXME avoid integer overflow */ - int neededSize = len + (int)(bufferEnd - bufferPtr); -#ifdef XML_CONTEXT_BYTES - int keep = (int)(bufferPtr - buffer); - - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - neededSize += keep; -#endif /* defined XML_CONTEXT_BYTES */ - if (neededSize <= bufferLim - buffer) { -#ifdef XML_CONTEXT_BYTES - if (keep < bufferPtr - buffer) { - int offset = (int)(bufferPtr - buffer) - keep; - memmove(buffer, &buffer[offset], bufferEnd - bufferPtr + keep); - bufferEnd -= offset; - bufferPtr -= offset; - } -#else - memmove(buffer, bufferPtr, bufferEnd - bufferPtr); - bufferEnd = buffer + (bufferEnd - bufferPtr); - bufferPtr = buffer; -#endif /* not defined XML_CONTEXT_BYTES */ - } - else { - char *newBuf; - int bufferSize = (int)(bufferLim - bufferPtr); - if (bufferSize == 0) - bufferSize = INIT_BUFFER_SIZE; - do { - bufferSize *= 2; - } while (bufferSize < neededSize); - newBuf = (char *)MALLOC(bufferSize); - if (newBuf == 0) { - errorCode = XML_ERROR_NO_MEMORY; - return NULL; - } - bufferLim = newBuf + bufferSize; -#ifdef XML_CONTEXT_BYTES - if (bufferPtr) { - int keep = (int)(bufferPtr - buffer); - if (keep > XML_CONTEXT_BYTES) - keep = XML_CONTEXT_BYTES; - memcpy(newBuf, &bufferPtr[-keep], bufferEnd - bufferPtr + keep); - FREE(buffer); - buffer = newBuf; - bufferEnd = buffer + (bufferEnd - bufferPtr) + keep; - bufferPtr = buffer + keep; - } - else { - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; - } -#else - if (bufferPtr) { - memcpy(newBuf, bufferPtr, bufferEnd - bufferPtr); - FREE(buffer); - } - bufferEnd = newBuf + (bufferEnd - bufferPtr); - bufferPtr = buffer = newBuf; -#endif /* not defined XML_CONTEXT_BYTES */ - } - eventPtr = eventEndPtr = NULL; - positionPtr = NULL; - } - return bufferEnd; -} - -enum XML_Status XMLCALL -XML_StopParser(XML_Parser parser, XML_Bool resumable) -{ - switch (ps_parsing) { - case XML_SUSPENDED: - if (resumable) { - errorCode = XML_ERROR_SUSPENDED; - return XML_STATUS_ERROR; - } - ps_parsing = XML_FINISHED; - break; - case XML_FINISHED: - errorCode = XML_ERROR_FINISHED; - return XML_STATUS_ERROR; - default: - if (resumable) { -#ifdef XML_DTD - if (isParamEntity) { - errorCode = XML_ERROR_SUSPEND_PE; - return XML_STATUS_ERROR; - } -#endif - ps_parsing = XML_SUSPENDED; - } - else - ps_parsing = XML_FINISHED; - } - return XML_STATUS_OK; -} - -enum XML_Status XMLCALL -XML_ResumeParser(XML_Parser parser) -{ - enum XML_Status result = XML_STATUS_OK; - - if (ps_parsing != XML_SUSPENDED) { - errorCode = XML_ERROR_NOT_SUSPENDED; - return XML_STATUS_ERROR; - } - ps_parsing = XML_PARSING; - - errorCode = processor(parser, bufferPtr, parseEndPtr, &bufferPtr); - - if (errorCode != XML_ERROR_NONE) { - eventEndPtr = eventPtr; - processor = errorProcessor; - return XML_STATUS_ERROR; - } - else { - switch (ps_parsing) { - case XML_SUSPENDED: - result = XML_STATUS_SUSPENDED; - break; - case XML_INITIALIZED: - case XML_PARSING: - if (ps_finalBuffer) { - ps_parsing = XML_FINISHED; - return result; - } - default: ; - } - } - - XmlUpdatePosition(encoding, positionPtr, bufferPtr, &position); - positionPtr = bufferPtr; - return result; -} - -void XMLCALL -XML_GetParsingStatus(XML_Parser parser, XML_ParsingStatus *status) -{ - assert(status != NULL); - *status = parser->m_parsingStatus; -} - -enum XML_Error XMLCALL -XML_GetErrorCode(XML_Parser parser) -{ - return errorCode; -} - -XML_Index XMLCALL -XML_GetCurrentByteIndex(XML_Parser parser) -{ - if (eventPtr) - return parseEndByteIndex - (parseEndPtr - eventPtr); - return -1; -} - -int XMLCALL -XML_GetCurrentByteCount(XML_Parser parser) -{ - if (eventEndPtr && eventPtr) - return (int)(eventEndPtr - eventPtr); - return 0; -} - -const char * XMLCALL -XML_GetInputContext(XML_Parser parser, int *offset, int *size) -{ -#ifdef XML_CONTEXT_BYTES - if (eventPtr && buffer) { - *offset = (int)(eventPtr - buffer); - *size = (int)(bufferEnd - buffer); - return buffer; - } -#endif /* defined XML_CONTEXT_BYTES */ - return (char *) 0; -} - -XML_Size XMLCALL -XML_GetCurrentLineNumber(XML_Parser parser) -{ - if (eventPtr && eventPtr >= positionPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.lineNumber + 1; -} - -XML_Size XMLCALL -XML_GetCurrentColumnNumber(XML_Parser parser) -{ - if (eventPtr && eventPtr >= positionPtr) { - XmlUpdatePosition(encoding, positionPtr, eventPtr, &position); - positionPtr = eventPtr; - } - return position.columnNumber; -} - -void XMLCALL -XML_FreeContentModel(XML_Parser parser, XML_Content *model) -{ - FREE(model); -} - -void * XMLCALL -XML_MemMalloc(XML_Parser parser, size_t size) -{ - return MALLOC(size); -} - -void * XMLCALL -XML_MemRealloc(XML_Parser parser, void *ptr, size_t size) -{ - return REALLOC(ptr, size); -} - -void XMLCALL -XML_MemFree(XML_Parser parser, void *ptr) -{ - FREE(ptr); -} - -void XMLCALL -XML_DefaultCurrent(XML_Parser parser) -{ - if (defaultHandler) { - if (openInternalEntities) - reportDefault(parser, - internalEncoding, - openInternalEntities->internalEventPtr, - openInternalEntities->internalEventEndPtr); - else - reportDefault(parser, encoding, eventPtr, eventEndPtr); - } -} - -const XML_LChar * XMLCALL -XML_ErrorString(enum XML_Error code) -{ - static const XML_LChar* const message[] = { - 0, - XML_L("out of memory"), - XML_L("syntax error"), - XML_L("no element found"), - XML_L("not well-formed (invalid token)"), - XML_L("unclosed token"), - XML_L("partial character"), - XML_L("mismatched tag"), - XML_L("duplicate attribute"), - XML_L("junk after document element"), - XML_L("illegal parameter entity reference"), - XML_L("undefined entity"), - XML_L("recursive entity reference"), - XML_L("asynchronous entity"), - XML_L("reference to invalid character number"), - XML_L("reference to binary entity"), - XML_L("reference to external entity in attribute"), - XML_L("XML or text declaration not at start of entity"), - XML_L("unknown encoding"), - XML_L("encoding specified in XML declaration is incorrect"), - XML_L("unclosed CDATA section"), - XML_L("error in processing external entity reference"), - XML_L("document is not standalone"), - XML_L("unexpected parser state - please send a bug report"), - XML_L("entity declared in parameter entity"), - XML_L("requested feature requires XML_DTD support in Expat"), - XML_L("cannot change setting once parsing has begun"), - XML_L("unbound prefix"), - XML_L("must not undeclare prefix"), - XML_L("incomplete markup in parameter entity"), - XML_L("XML declaration not well-formed"), - XML_L("text declaration not well-formed"), - XML_L("illegal character(s) in public id"), - XML_L("parser suspended"), - XML_L("parser not suspended"), - XML_L("parsing aborted"), - XML_L("parsing finished"), - XML_L("cannot suspend in external parameter entity"), - XML_L("reserved prefix (xml) must not be undeclared or bound to another namespace name"), - XML_L("reserved prefix (xmlns) must not be declared or undeclared"), - XML_L("prefix must not be bound to one of the reserved namespace names") - }; - if (code > 0 && code < sizeof(message)/sizeof(message[0])) - return message[code]; - return NULL; -} - -const XML_LChar * XMLCALL -XML_ExpatVersion(void) { - - /* V1 is used to string-ize the version number. However, it would - string-ize the actual version macro *names* unless we get them - substituted before being passed to V1. CPP is defined to expand - a macro, then rescan for more expansions. Thus, we use V2 to expand - the version macros, then CPP will expand the resulting V1() macro - with the correct numerals. */ - /* ### I'm assuming cpp is portable in this respect... */ - -#define V1(a,b,c) XML_L(#a)XML_L(".")XML_L(#b)XML_L(".")XML_L(#c) -#define V2(a,b,c) XML_L("expat_")V1(a,b,c) - - return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); - -#undef V1 -#undef V2 -} - -XML_Expat_Version XMLCALL -XML_ExpatVersionInfo(void) -{ - XML_Expat_Version version; - - version.major = XML_MAJOR_VERSION; - version.minor = XML_MINOR_VERSION; - version.micro = XML_MICRO_VERSION; - - return version; -} - -const XML_Feature * XMLCALL -XML_GetFeatureList(void) -{ - static const XML_Feature features[] = { - {XML_FEATURE_SIZEOF_XML_CHAR, XML_L("sizeof(XML_Char)"), - sizeof(XML_Char)}, - {XML_FEATURE_SIZEOF_XML_LCHAR, XML_L("sizeof(XML_LChar)"), - sizeof(XML_LChar)}, -#ifdef XML_UNICODE - {XML_FEATURE_UNICODE, XML_L("XML_UNICODE"), 0}, -#endif -#ifdef XML_UNICODE_WCHAR_T - {XML_FEATURE_UNICODE_WCHAR_T, XML_L("XML_UNICODE_WCHAR_T"), 0}, -#endif -#ifdef XML_DTD - {XML_FEATURE_DTD, XML_L("XML_DTD"), 0}, -#endif -#ifdef XML_CONTEXT_BYTES - {XML_FEATURE_CONTEXT_BYTES, XML_L("XML_CONTEXT_BYTES"), - XML_CONTEXT_BYTES}, -#endif -#ifdef XML_MIN_SIZE - {XML_FEATURE_MIN_SIZE, XML_L("XML_MIN_SIZE"), 0}, -#endif -#ifdef XML_NS - {XML_FEATURE_NS, XML_L("XML_NS"), 0}, -#endif -#ifdef XML_LARGE_SIZE - {XML_FEATURE_LARGE_SIZE, XML_L("XML_LARGE_SIZE"), 0}, -#endif -#ifdef XML_ATTR_INFO - {XML_FEATURE_ATTR_INFO, XML_L("XML_ATTR_INFO"), 0}, -#endif - {XML_FEATURE_END, NULL, 0} - }; - - return features; -} - -/* Initially tag->rawName always points into the parse buffer; - for those TAG instances opened while the current parse buffer was - processed, and not yet closed, we need to store tag->rawName in a more - permanent location, since the parse buffer is about to be discarded. -*/ -static XML_Bool -storeRawNames(XML_Parser parser) -{ - TAG *tag = tagStack; - while (tag) { - int bufSize; - int nameLen = sizeof(XML_Char) * (tag->name.strLen + 1); - char *rawNameBuf = tag->buf + nameLen; - /* Stop if already stored. Since tagStack is a stack, we can stop - at the first entry that has already been copied; everything - below it in the stack is already been accounted for in a - previous call to this function. - */ - if (tag->rawName == rawNameBuf) - break; - /* For re-use purposes we need to ensure that the - size of tag->buf is a multiple of sizeof(XML_Char). - */ - bufSize = nameLen + ROUND_UP(tag->rawNameLength, sizeof(XML_Char)); - if (bufSize > tag->bufEnd - tag->buf) { - char *temp = (char *)REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_FALSE; - /* if tag->name.str points to tag->buf (only when namespace - processing is off) then we have to update it - */ - if (tag->name.str == (XML_Char *)tag->buf) - tag->name.str = (XML_Char *)temp; - /* if tag->name.localPart is set (when namespace processing is on) - then update it as well, since it will always point into tag->buf - */ - if (tag->name.localPart) - tag->name.localPart = (XML_Char *)temp + (tag->name.localPart - - (XML_Char *)tag->buf); - tag->buf = temp; - tag->bufEnd = temp + bufSize; - rawNameBuf = temp + nameLen; - } - memcpy(rawNameBuf, tag->rawName, tag->rawNameLength); - tag->rawName = rawNameBuf; - tag = tag->parent; - } - return XML_TRUE; -} - -static enum XML_Error PTRCALL -contentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doContent(parser, 0, encoding, start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result == XML_ERROR_NONE) { - if (!storeRawNames(parser)) - return XML_ERROR_NO_MEMORY; - } - return result; -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = externalEntityInitProcessor2; - return externalEntityInitProcessor2(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor2(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - const char *next = start; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(encoding, start, end, &next); - switch (tok) { - case XML_TOK_BOM: - /* If we are at the end of the buffer, this would cause the next stage, - i.e. externalEntityInitProcessor3, to pass control directly to - doContent (by detecting XML_TOK_NONE) without processing any xml text - declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. - */ - if (next == end && !ps_finalBuffer) { - *endPtr = next; - return XML_ERROR_NONE; - } - start = next; - break; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - eventPtr = start; - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityInitProcessor3; - return externalEntityInitProcessor3(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityInitProcessor3(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - int tok; - const char *next = start; /* XmlContentTok doesn't always set the last arg */ - eventPtr = start; - tok = XmlContentTok(encoding, start, end, &next); - eventEndPtr = next; - - switch (tok) { - case XML_TOK_XML_DECL: - { - enum XML_Error result; - result = processXmlDecl(parser, 1, start, next); - if (result != XML_ERROR_NONE) - return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *endPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - start = next; - } - } - break; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *endPtr = start; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - } - processor = externalEntityContentProcessor; - tagLevel = 1; - return externalEntityContentProcessor(parser, start, end, endPtr); -} - -static enum XML_Error PTRCALL -externalEntityContentProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doContent(parser, 1, encoding, start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result == XML_ERROR_NONE) { - if (!storeRawNames(parser)) - return XML_ERROR_NO_MEMORY; - } - return result; -} - -static enum XML_Error -doContent(XML_Parser parser, - int startTagLevel, - const ENCODING *enc, - const char *s, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - /* save one level of indirection */ - DTD * const dtd = _dtd; - - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - - for (;;) { - const char *next = s; /* XmlContentTok doesn't always set the last arg */ - int tok = XmlContentTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_TRAILING_CR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - *eventEndPP = end; - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - /* We are at the end of the final buffer, should we check for - XML_SUSPENDED, XML_FINISHED? - */ - if (startTagLevel == 0) - return XML_ERROR_NO_ELEMENTS; - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - *nextPtr = end; - return XML_ERROR_NONE; - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (startTagLevel > 0) { - if (tagLevel != startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_NO_ELEMENTS; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (characterDataHandler) - characterDataHandler(handlerArg, &ch, 1); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - name = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); - poolDiscard(&dtd->pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity or default handler. - */ - if (!dtd->hasParamEntityRefs || dtd->standalone) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->notation) - return XML_ERROR_BINARY_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - if (!defaultExpandInternalEntities) { - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, entity->name, 0); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - result = processInternalEntity(parser, entity, XML_FALSE); - if (result != XML_ERROR_NONE) - return result; - } - else if (externalEntityRefHandler) { - const XML_Char *context; - entity->open = XML_TRUE; - context = getContext(parser); - entity->open = XML_FALSE; - if (!context) - return XML_ERROR_NO_MEMORY; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - context, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - poolDiscard(&tempPool); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - case XML_TOK_START_TAG_NO_ATTS: - /* fall through */ - case XML_TOK_START_TAG_WITH_ATTS: - { - TAG *tag; - enum XML_Error result; - XML_Char *toPtr; - if (freeTagList) { - tag = freeTagList; - freeTagList = freeTagList->parent; - } - else { - tag = (TAG *)MALLOC(sizeof(TAG)); - if (!tag) - return XML_ERROR_NO_MEMORY; - tag->buf = (char *)MALLOC(INIT_TAG_BUF_SIZE); - if (!tag->buf) { - FREE(tag); - return XML_ERROR_NO_MEMORY; - } - tag->bufEnd = tag->buf + INIT_TAG_BUF_SIZE; - } - tag->bindings = NULL; - tag->parent = tagStack; - tagStack = tag; - tag->name.localPart = NULL; - tag->name.prefix = NULL; - tag->rawName = s + enc->minBytesPerChar; - tag->rawNameLength = XmlNameLength(enc, tag->rawName); - ++tagLevel; - { - const char *rawNameEnd = tag->rawName + tag->rawNameLength; - const char *fromPtr = tag->rawName; - toPtr = (XML_Char *)tag->buf; - for (;;) { - int bufSize; - int convLen; - XmlConvert(enc, - &fromPtr, rawNameEnd, - (ICHAR **)&toPtr, (ICHAR *)tag->bufEnd - 1); - convLen = (int)(toPtr - (XML_Char *)tag->buf); - if (fromPtr == rawNameEnd) { - tag->name.strLen = convLen; - break; - } - bufSize = (int)(tag->bufEnd - tag->buf) << 1; - { - char *temp = (char *)REALLOC(tag->buf, bufSize); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - tag->buf = temp; - tag->bufEnd = temp + bufSize; - toPtr = (XML_Char *)temp + convLen; - } - } - } - tag->name.str = (XML_Char *)tag->buf; - *toPtr = XML_T('\0'); - result = storeAtts(parser, enc, s, &(tag->name), &(tag->bindings)); - if (result) - return result; - if (startElementHandler) - startElementHandler(handlerArg, tag->name.str, - (const XML_Char **)atts); - else if (defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - break; - } - case XML_TOK_EMPTY_ELEMENT_NO_ATTS: - /* fall through */ - case XML_TOK_EMPTY_ELEMENT_WITH_ATTS: - { - const char *rawName = s + enc->minBytesPerChar; - enum XML_Error result; - BINDING *bindings = NULL; - XML_Bool noElmHandlers = XML_TRUE; - TAG_NAME name; - name.str = poolStoreString(&tempPool, enc, rawName, - rawName + XmlNameLength(enc, rawName)); - if (!name.str) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - result = storeAtts(parser, enc, s, &name, &bindings); - if (result) - return result; - poolFinish(&tempPool); - if (startElementHandler) { - startElementHandler(handlerArg, name.str, (const XML_Char **)atts); - noElmHandlers = XML_FALSE; - } - if (endElementHandler) { - if (startElementHandler) - *eventPP = *eventEndPP; - endElementHandler(handlerArg, name.str); - noElmHandlers = XML_FALSE; - } - if (noElmHandlers && defaultHandler) - reportDefault(parser, enc, s, next); - poolClear(&tempPool); - while (bindings) { - BINDING *b = bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - bindings = bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - break; - case XML_TOK_END_TAG: - if (tagLevel == startTagLevel) - return XML_ERROR_ASYNC_ENTITY; - else { - int len; - const char *rawName; - TAG *tag = tagStack; - tagStack = tag->parent; - tag->parent = freeTagList; - freeTagList = tag; - rawName = s + enc->minBytesPerChar*2; - len = XmlNameLength(enc, rawName); - if (len != tag->rawNameLength - || memcmp(tag->rawName, rawName, len) != 0) { - *eventPP = rawName; - return XML_ERROR_TAG_MISMATCH; - } - --tagLevel; - if (endElementHandler) { - const XML_Char *localPart; - const XML_Char *prefix; - XML_Char *uri; - localPart = tag->name.localPart; - if (ns && localPart) { - /* localPart and prefix may have been overwritten in - tag->name.str, since this points to the binding->uri - buffer which gets re-used; so we have to add them again - */ - uri = (XML_Char *)tag->name.str + tag->name.uriLen; - /* don't need to check for space - already done in storeAtts() */ - while (*localPart) *uri++ = *localPart++; - prefix = (XML_Char *)tag->name.prefix; - if (ns_triplets && prefix) { - *uri++ = namespaceSeparator; - while (*prefix) *uri++ = *prefix++; - } - *uri = XML_T('\0'); - } - endElementHandler(handlerArg, tag->name.str); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - while (tag->bindings) { - BINDING *b = tag->bindings; - if (endNamespaceDeclHandler) - endNamespaceDeclHandler(handlerArg, b->prefix->name); - tag->bindings = tag->bindings->nextTagBinding; - b->nextTagBinding = freeBindingList; - freeBindingList = b; - b->prefix->binding = b->prevPrefixBinding; - } - if (tagLevel == 0) - return epilogProcessor(parser, next, end, nextPtr); - } - break; - case XML_TOK_CHAR_REF: - { - int n = XmlCharRefNumber(enc, s); - if (n < 0) - return XML_ERROR_BAD_CHAR_REF; - if (characterDataHandler) { - XML_Char buf[XML_ENCODE_MAX]; - characterDataHandler(handlerArg, buf, XmlEncode(n, (ICHAR *)buf)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_CDATA_SECT_OPEN: - { - enum XML_Error result; - if (startCdataSectionHandler) - startCdataSectionHandler(handlerArg); -#if 0 - /* Suppose you doing a transformation on a document that involves - changing only the character data. You set up a defaultHandler - and a characterDataHandler. The defaultHandler simply copies - characters through. The characterDataHandler does the - transformation and writes the characters out escaping them as - necessary. This case will fail to work if we leave out the - following two lines (because & and < inside CDATA sections will - be incorrectly escaped). - - However, now we have a start/endCdataSectionHandler, so it seems - easier to let the user deal with this. - */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - result = doCdataSection(parser, enc, &next, end, nextPtr, haveMore); - if (result != XML_ERROR_NONE) - return result; - else if (!next) { - processor = cdataSectionProcessor; - return result; - } - } - break; - case XML_TOK_TRAILING_RSQB: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - if (characterDataHandler) { - if (MUST_CONVERT(enc, s)) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - characterDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - } - else - characterDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)end - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, end); - /* We are at the end of the final buffer, should we check for - XML_SUSPENDED, XML_FINISHED? - */ - if (startTagLevel == 0) { - *eventPP = end; - return XML_ERROR_NO_ELEMENTS; - } - if (tagLevel != startTagLevel) { - *eventPP = end; - return XML_ERROR_ASYNC_ENTITY; - } - *nextPtr = end; - return XML_ERROR_NONE; - case XML_TOK_DATA_CHARS: - { - XML_CharacterDataHandler charDataHandler = characterDataHandler; - if (charDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - charDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) - break; - *eventPP = s; - } - } - else - charDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - break; - default: - if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - } - *eventPP = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } - /* not reached */ -} - -/* Precondition: all arguments must be non-NULL; - Purpose: - - normalize attributes - - check attributes for well-formedness - - generate namespace aware attribute names (URI, prefix) - - build list of attributes for startElementHandler - - default attributes - - process namespace declarations (check and report them) - - generate namespace aware element name (URI, prefix) -*/ -static enum XML_Error -storeAtts(XML_Parser parser, const ENCODING *enc, - const char *attStr, TAG_NAME *tagNamePtr, - BINDING **bindingsPtr) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - ELEMENT_TYPE *elementType; - int nDefaultAtts; - const XML_Char **appAtts; /* the attribute list for the application */ - int attIndex = 0; - int prefixLen; - int i; - int n; - XML_Char *uri; - int nPrefixes = 0; - BINDING *binding; - const XML_Char *localPart; - - /* lookup the element type name */ - elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, tagNamePtr->str,0); - if (!elementType) { - const XML_Char *name = poolCopyString(&dtd->pool, tagNamePtr->str); - if (!name) - return XML_ERROR_NO_MEMORY; - elementType = (ELEMENT_TYPE *)lookup(parser, &dtd->elementTypes, name, - sizeof(ELEMENT_TYPE)); - if (!elementType) - return XML_ERROR_NO_MEMORY; - if (ns && !setElementTypePrefix(parser, elementType)) - return XML_ERROR_NO_MEMORY; - } - nDefaultAtts = elementType->nDefaultAtts; - - /* get the attributes from the tokenizer */ - n = XmlGetAttributes(enc, attStr, attsSize, atts); - if (n + nDefaultAtts > attsSize) { - int oldAttsSize = attsSize; - ATTRIBUTE *temp; -#ifdef XML_ATTR_INFO - XML_AttrInfo *temp2; -#endif - attsSize = n + nDefaultAtts + INIT_ATTS_SIZE; - temp = (ATTRIBUTE *)REALLOC((void *)atts, attsSize * sizeof(ATTRIBUTE)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - atts = temp; -#ifdef XML_ATTR_INFO - temp2 = (XML_AttrInfo *)REALLOC((void *)attInfo, attsSize * sizeof(XML_AttrInfo)); - if (temp2 == NULL) - return XML_ERROR_NO_MEMORY; - attInfo = temp2; -#endif - if (n > oldAttsSize) - XmlGetAttributes(enc, attStr, n, atts); - } - - appAtts = (const XML_Char **)atts; - for (i = 0; i < n; i++) { - ATTRIBUTE *currAtt = &atts[i]; -#ifdef XML_ATTR_INFO - XML_AttrInfo *currAttInfo = &attInfo[i]; -#endif - /* add the name and value to the attribute list */ - ATTRIBUTE_ID *attId = getAttributeId(parser, enc, currAtt->name, - currAtt->name - + XmlNameLength(enc, currAtt->name)); - if (!attId) - return XML_ERROR_NO_MEMORY; -#ifdef XML_ATTR_INFO - currAttInfo->nameStart = parseEndByteIndex - (parseEndPtr - currAtt->name); - currAttInfo->nameEnd = currAttInfo->nameStart + - XmlNameLength(enc, currAtt->name); - currAttInfo->valueStart = parseEndByteIndex - - (parseEndPtr - currAtt->valuePtr); - currAttInfo->valueEnd = parseEndByteIndex - (parseEndPtr - currAtt->valueEnd); -#endif - /* Detect duplicate attributes by their QNames. This does not work when - namespace processing is turned on and different prefixes for the same - namespace are used. For this case we have a check further down. - */ - if ((attId->name)[-1]) { - if (enc == encoding) - eventPtr = atts[i].name; - return XML_ERROR_DUPLICATE_ATTRIBUTE; - } - (attId->name)[-1] = 1; - appAtts[attIndex++] = attId->name; - if (!atts[i].normalized) { - enum XML_Error result; - XML_Bool isCdata = XML_TRUE; - - /* figure out whether declared as other than CDATA */ - if (attId->maybeTokenized) { - int j; - for (j = 0; j < nDefaultAtts; j++) { - if (attId == elementType->defaultAtts[j].id) { - isCdata = elementType->defaultAtts[j].isCdata; - break; - } - } - } - - /* normalize the attribute value */ - result = storeAttributeValue(parser, enc, isCdata, - atts[i].valuePtr, atts[i].valueEnd, - &tempPool); - if (result) - return result; - appAtts[attIndex] = poolStart(&tempPool); - poolFinish(&tempPool); - } - else { - /* the value did not need normalizing */ - appAtts[attIndex] = poolStoreString(&tempPool, enc, atts[i].valuePtr, - atts[i].valueEnd); - if (appAtts[attIndex] == 0) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - } - /* handle prefixed attribute names */ - if (attId->prefix) { - if (attId->xmlns) { - /* deal with namespace declarations here */ - enum XML_Error result = addBinding(parser, attId->prefix, attId, - appAtts[attIndex], bindingsPtr); - if (result) - return result; - --attIndex; - } - else { - /* deal with other prefixed names later */ - attIndex++; - nPrefixes++; - (attId->name)[-1] = 2; - } - } - else - attIndex++; - } - - /* set-up for XML_GetSpecifiedAttributeCount and XML_GetIdAttributeIndex */ - nSpecifiedAtts = attIndex; - if (elementType->idAtt && (elementType->idAtt->name)[-1]) { - for (i = 0; i < attIndex; i += 2) - if (appAtts[i] == elementType->idAtt->name) { - idAttIndex = i; - break; - } - } - else - idAttIndex = -1; - - /* do attribute defaulting */ - for (i = 0; i < nDefaultAtts; i++) { - const DEFAULT_ATTRIBUTE *da = elementType->defaultAtts + i; - if (!(da->id->name)[-1] && da->value) { - if (da->id->prefix) { - if (da->id->xmlns) { - enum XML_Error result = addBinding(parser, da->id->prefix, da->id, - da->value, bindingsPtr); - if (result) - return result; - } - else { - (da->id->name)[-1] = 2; - nPrefixes++; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - else { - (da->id->name)[-1] = 1; - appAtts[attIndex++] = da->id->name; - appAtts[attIndex++] = da->value; - } - } - } - appAtts[attIndex] = 0; - - /* expand prefixed attribute names, check for duplicates, - and clear flags that say whether attributes were specified */ - i = 0; - if (nPrefixes) { - int j; /* hash table index */ - unsigned long version = nsAttsVersion; - int nsAttsSize = (int)1 << nsAttsPower; - /* size of hash table must be at least 2 * (# of prefixed attributes) */ - if ((nPrefixes << 1) >> nsAttsPower) { /* true for nsAttsPower = 0 */ - NS_ATT *temp; - /* hash table size must also be a power of 2 and >= 8 */ - while (nPrefixes >> nsAttsPower++); - if (nsAttsPower < 3) - nsAttsPower = 3; - nsAttsSize = (int)1 << nsAttsPower; - temp = (NS_ATT *)REALLOC(nsAtts, nsAttsSize * sizeof(NS_ATT)); - if (!temp) - return XML_ERROR_NO_MEMORY; - nsAtts = temp; - version = 0; /* force re-initialization of nsAtts hash table */ - } - /* using a version flag saves us from initializing nsAtts every time */ - if (!version) { /* initialize version flags when version wraps around */ - version = INIT_ATTS_VERSION; - for (j = nsAttsSize; j != 0; ) - nsAtts[--j].version = version; - } - nsAttsVersion = --version; - - /* expand prefixed names and check for duplicates */ - for (; i < attIndex; i += 2) { - const XML_Char *s = appAtts[i]; - if (s[-1] == 2) { /* prefixed */ - ATTRIBUTE_ID *id; - const BINDING *b; - unsigned long uriHash = hash_secret_salt; - ((XML_Char *)s)[-1] = 0; /* clear flag */ - id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, s, 0); - b = id->prefix->binding; - if (!b) - return XML_ERROR_UNBOUND_PREFIX; - - /* as we expand the name we also calculate its hash value */ - for (j = 0; j < b->uriLen; j++) { - const XML_Char c = b->uri[j]; - if (!poolAppendChar(&tempPool, c)) - return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); - } - while (*s++ != XML_T(ASCII_COLON)) - ; - do { /* copies null terminator */ - const XML_Char c = *s; - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - uriHash = CHAR_HASH(uriHash, c); - } while (*s++); - - { /* Check hash table for duplicate of expanded name (uriName). - Derived from code in lookup(parser, HASH_TABLE *table, ...). - */ - unsigned char step = 0; - unsigned long mask = nsAttsSize - 1; - j = uriHash & mask; /* index into hash table */ - while (nsAtts[j].version == version) { - /* for speed we compare stored hash values first */ - if (uriHash == nsAtts[j].hash) { - const XML_Char *s1 = poolStart(&tempPool); - const XML_Char *s2 = nsAtts[j].uriName; - /* s1 is null terminated, but not s2 */ - for (; *s1 == *s2 && *s1 != 0; s1++, s2++); - if (*s1 == 0) - return XML_ERROR_DUPLICATE_ATTRIBUTE; - } - if (!step) - step = PROBE_STEP(uriHash, mask, nsAttsPower); - j < step ? (j += nsAttsSize - step) : (j -= step); - } - } - - if (ns_triplets) { /* append namespace separator and prefix */ - tempPool.ptr[-1] = namespaceSeparator; - s = b->prefix->name; - do { - if (!poolAppendChar(&tempPool, *s)) - return XML_ERROR_NO_MEMORY; - } while (*s++); - } - - /* store expanded name in attribute list */ - s = poolStart(&tempPool); - poolFinish(&tempPool); - appAtts[i] = s; - - /* fill empty slot with new version, uriName and hash value */ - nsAtts[j].version = version; - nsAtts[j].hash = uriHash; - nsAtts[j].uriName = s; - - if (!--nPrefixes) { - i += 2; - break; - } - } - else /* not prefixed */ - ((XML_Char *)s)[-1] = 0; /* clear flag */ - } - } - /* clear flags for the remaining attributes */ - for (; i < attIndex; i += 2) - ((XML_Char *)(appAtts[i]))[-1] = 0; - for (binding = *bindingsPtr; binding; binding = binding->nextTagBinding) - binding->attId->name[-1] = 0; - - if (!ns) - return XML_ERROR_NONE; - - /* expand the element type name */ - if (elementType->prefix) { - binding = elementType->prefix->binding; - if (!binding) - return XML_ERROR_UNBOUND_PREFIX; - localPart = tagNamePtr->str; - while (*localPart++ != XML_T(ASCII_COLON)) - ; - } - else if (dtd->defaultPrefix.binding) { - binding = dtd->defaultPrefix.binding; - localPart = tagNamePtr->str; - } - else - return XML_ERROR_NONE; - prefixLen = 0; - if (ns_triplets && binding->prefix->name) { - for (; binding->prefix->name[prefixLen++];) - ; /* prefixLen includes null terminator */ - } - tagNamePtr->localPart = localPart; - tagNamePtr->uriLen = binding->uriLen; - tagNamePtr->prefix = binding->prefix->name; - tagNamePtr->prefixLen = prefixLen; - for (i = 0; localPart[i++];) - ; /* i includes null terminator */ - n = i + binding->uriLen + prefixLen; - if (n > binding->uriAlloc) { - TAG *p; - uri = (XML_Char *)MALLOC((n + EXPAND_SPARE) * sizeof(XML_Char)); - if (!uri) - return XML_ERROR_NO_MEMORY; - binding->uriAlloc = n + EXPAND_SPARE; - memcpy(uri, binding->uri, binding->uriLen * sizeof(XML_Char)); - for (p = tagStack; p; p = p->parent) - if (p->name.str == binding->uri) - p->name.str = uri; - FREE(binding->uri); - binding->uri = uri; - } - /* if namespaceSeparator != '\0' then uri includes it already */ - uri = binding->uri + binding->uriLen; - memcpy(uri, localPart, i * sizeof(XML_Char)); - /* we always have a namespace separator between localPart and prefix */ - if (prefixLen) { - uri += i - 1; - *uri = namespaceSeparator; /* replace null terminator */ - memcpy(uri + 1, binding->prefix->name, prefixLen * sizeof(XML_Char)); - } - tagNamePtr->str = binding->uri; - return XML_ERROR_NONE; -} - -/* addBinding() overwrites the value of prefix->binding without checking. - Therefore one must keep track of the old value outside of addBinding(). -*/ -static enum XML_Error -addBinding(XML_Parser parser, PREFIX *prefix, const ATTRIBUTE_ID *attId, - const XML_Char *uri, BINDING **bindingsPtr) -{ - static const XML_Char xmlNamespace[] = { - ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, - ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, - ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_X, ASCII_M, ASCII_L, - ASCII_SLASH, ASCII_1, ASCII_9, ASCII_9, ASCII_8, ASCII_SLASH, - ASCII_n, ASCII_a, ASCII_m, ASCII_e, ASCII_s, ASCII_p, ASCII_a, ASCII_c, - ASCII_e, '\0' - }; - static const int xmlLen = - (int)sizeof(xmlNamespace)/sizeof(XML_Char) - 1; - static const XML_Char xmlnsNamespace[] = { - ASCII_h, ASCII_t, ASCII_t, ASCII_p, ASCII_COLON, ASCII_SLASH, ASCII_SLASH, - ASCII_w, ASCII_w, ASCII_w, ASCII_PERIOD, ASCII_w, ASCII_3, ASCII_PERIOD, - ASCII_o, ASCII_r, ASCII_g, ASCII_SLASH, ASCII_2, ASCII_0, ASCII_0, - ASCII_0, ASCII_SLASH, ASCII_x, ASCII_m, ASCII_l, ASCII_n, ASCII_s, - ASCII_SLASH, '\0' - }; - static const int xmlnsLen = - (int)sizeof(xmlnsNamespace)/sizeof(XML_Char) - 1; - - XML_Bool mustBeXML = XML_FALSE; - XML_Bool isXML = XML_TRUE; - XML_Bool isXMLNS = XML_TRUE; - - BINDING *b; - int len; - - /* empty URI is only valid for default namespace per XML NS 1.0 (not 1.1) */ - if (*uri == XML_T('\0') && prefix->name) - return XML_ERROR_UNDECLARING_PREFIX; - - if (prefix->name - && prefix->name[0] == XML_T(ASCII_x) - && prefix->name[1] == XML_T(ASCII_m) - && prefix->name[2] == XML_T(ASCII_l)) { - - /* Not allowed to bind xmlns */ - if (prefix->name[3] == XML_T(ASCII_n) - && prefix->name[4] == XML_T(ASCII_s) - && prefix->name[5] == XML_T('\0')) - return XML_ERROR_RESERVED_PREFIX_XMLNS; - - if (prefix->name[3] == XML_T('\0')) - mustBeXML = XML_TRUE; - } - - for (len = 0; uri[len]; len++) { - if (isXML && (len > xmlLen || uri[len] != xmlNamespace[len])) - isXML = XML_FALSE; - - if (!mustBeXML && isXMLNS - && (len > xmlnsLen || uri[len] != xmlnsNamespace[len])) - isXMLNS = XML_FALSE; - } - isXML = isXML && len == xmlLen; - isXMLNS = isXMLNS && len == xmlnsLen; - - if (mustBeXML != isXML) - return mustBeXML ? XML_ERROR_RESERVED_PREFIX_XML - : XML_ERROR_RESERVED_NAMESPACE_URI; - - if (isXMLNS) - return XML_ERROR_RESERVED_NAMESPACE_URI; - - if (namespaceSeparator) - len++; - if (freeBindingList) { - b = freeBindingList; - if (len > b->uriAlloc) { - XML_Char *temp = (XML_Char *)REALLOC(b->uri, - sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - b->uri = temp; - b->uriAlloc = len + EXPAND_SPARE; - } - freeBindingList = b->nextTagBinding; - } - else { - b = (BINDING *)MALLOC(sizeof(BINDING)); - if (!b) - return XML_ERROR_NO_MEMORY; - b->uri = (XML_Char *)MALLOC(sizeof(XML_Char) * (len + EXPAND_SPARE)); - if (!b->uri) { - FREE(b); - return XML_ERROR_NO_MEMORY; - } - b->uriAlloc = len + EXPAND_SPARE; - } - b->uriLen = len; - memcpy(b->uri, uri, len * sizeof(XML_Char)); - if (namespaceSeparator) - b->uri[len - 1] = namespaceSeparator; - b->prefix = prefix; - b->attId = attId; - b->prevPrefixBinding = prefix->binding; - /* NULL binding when default namespace undeclared */ - if (*uri == XML_T('\0') && prefix == &_dtd->defaultPrefix) - prefix->binding = NULL; - else - prefix->binding = b; - b->nextTagBinding = *bindingsPtr; - *bindingsPtr = b; - /* if attId == NULL then we are not starting a namespace scope */ - if (attId && startNamespaceDeclHandler) - startNamespaceDeclHandler(handlerArg, prefix->name, - prefix->binding ? uri : 0); - return XML_ERROR_NONE; -} - -/* The idea here is to avoid using stack for each CDATA section when - the whole file is parsed with one call. -*/ -static enum XML_Error PTRCALL -cdataSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doCdataSection(parser, encoding, &start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result != XML_ERROR_NONE) - return result; - if (start) { - if (parentParser) { /* we are parsing an external entity */ - processor = externalEntityContentProcessor; - return externalEntityContentProcessor(parser, start, end, endPtr); - } - else { - processor = contentProcessor; - return contentProcessor(parser, start, end, endPtr); - } - } - return result; -} - -/* startPtr gets set to non-null if the section is closed, and to null if - the section is not yet closed. -*/ -static enum XML_Error -doCdataSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = NULL; - - for (;;) { - const char *next; - int tok = XmlCdataSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_CDATA_SECT_CLOSE: - if (endCdataSectionHandler) - endCdataSectionHandler(handlerArg); -#if 0 - /* see comment under XML_TOK_CDATA_SECT_OPEN */ - else if (characterDataHandler) - characterDataHandler(handlerArg, dataBuf, 0); -#endif - else if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - *nextPtr = next; - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - else - return XML_ERROR_NONE; - case XML_TOK_DATA_NEWLINE: - if (characterDataHandler) { - XML_Char c = 0xA; - characterDataHandler(handlerArg, &c, 1); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - break; - case XML_TOK_DATA_CHARS: - { - XML_CharacterDataHandler charDataHandler = characterDataHandler; - if (charDataHandler) { - if (MUST_CONVERT(enc, s)) { - for (;;) { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, next, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = next; - charDataHandler(handlerArg, dataBuf, - (int)(dataPtr - (ICHAR *)dataBuf)); - if (s == next) - break; - *eventPP = s; - } - } - else - charDataHandler(handlerArg, - (XML_Char *)s, - (int)((XML_Char *)next - (XML_Char *)s)); - } - else if (defaultHandler) - reportDefault(parser, enc, s, next); - } - break; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_CDATA_SECTION; - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - - *eventPP = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } - /* not reached */ -} - -#ifdef XML_DTD - -/* The idea here is to avoid using stack for each IGNORE section when - the whole file is parsed with one call. -*/ -static enum XML_Error PTRCALL -ignoreSectionProcessor(XML_Parser parser, - const char *start, - const char *end, - const char **endPtr) -{ - enum XML_Error result = doIgnoreSection(parser, encoding, &start, end, - endPtr, (XML_Bool)!ps_finalBuffer); - if (result != XML_ERROR_NONE) - return result; - if (start) { - processor = prologProcessor; - return prologProcessor(parser, start, end, endPtr); - } - return result; -} - -/* startPtr gets set to non-null is the section is closed, and to null - if the section is not yet closed. -*/ -static enum XML_Error -doIgnoreSection(XML_Parser parser, - const ENCODING *enc, - const char **startPtr, - const char *end, - const char **nextPtr, - XML_Bool haveMore) -{ - const char *next; - int tok; - const char *s = *startPtr; - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - *eventPP = s; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - *eventPP = s; - *startPtr = NULL; - tok = XmlIgnoreSectionTok(enc, s, end, &next); - *eventEndPP = next; - switch (tok) { - case XML_TOK_IGNORE_SECT: - if (defaultHandler) - reportDefault(parser, enc, s, next); - *startPtr = next; - *nextPtr = next; - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - else - return XML_ERROR_NONE; - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_PARTIAL: - case XML_TOK_NONE: - if (haveMore) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_SYNTAX; /* XML_ERROR_UNCLOSED_IGNORE_SECTION */ - default: - *eventPP = next; - return XML_ERROR_UNEXPECTED_STATE; - } - /* not reached */ -} - -#endif /* XML_DTD */ - -static enum XML_Error -initializeEncoding(XML_Parser parser) -{ - const char *s; -#ifdef XML_UNICODE - char encodingBuf[128]; - if (!protocolEncodingName) - s = NULL; - else { - int i; - for (i = 0; protocolEncodingName[i]; i++) { - if (i == sizeof(encodingBuf) - 1 - || (protocolEncodingName[i] & ~0x7f) != 0) { - encodingBuf[0] = '\0'; - break; - } - encodingBuf[i] = (char)protocolEncodingName[i]; - } - encodingBuf[i] = '\0'; - s = encodingBuf; - } -#else - s = protocolEncodingName; -#endif - if ((ns ? XmlInitEncodingNS : XmlInitEncoding)(&initEncoding, &encoding, s)) - return XML_ERROR_NONE; - return handleUnknownEncoding(parser, protocolEncodingName); -} - -static enum XML_Error -processXmlDecl(XML_Parser parser, int isGeneralTextEntity, - const char *s, const char *next) -{ - const char *encodingName = NULL; - const XML_Char *storedEncName = NULL; - const ENCODING *newEncoding = NULL; - const char *version = NULL; - const char *versionend; - const XML_Char *storedversion = NULL; - int standalone = -1; - if (!(ns - ? XmlParseXmlDeclNS - : XmlParseXmlDecl)(isGeneralTextEntity, - encoding, - s, - next, - &eventPtr, - &version, - &versionend, - &encodingName, - &newEncoding, - &standalone)) { - if (isGeneralTextEntity) - return XML_ERROR_TEXT_DECL; - else - return XML_ERROR_XML_DECL; - } - if (!isGeneralTextEntity && standalone == 1) { - _dtd->standalone = XML_TRUE; -#ifdef XML_DTD - if (paramEntityParsing == XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE) - paramEntityParsing = XML_PARAM_ENTITY_PARSING_NEVER; -#endif /* XML_DTD */ - } - if (xmlDeclHandler) { - if (encodingName != NULL) { - storedEncName = poolStoreString(&temp2Pool, - encoding, - encodingName, - encodingName - + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - poolFinish(&temp2Pool); - } - if (version) { - storedversion = poolStoreString(&temp2Pool, - encoding, - version, - versionend - encoding->minBytesPerChar); - if (!storedversion) - return XML_ERROR_NO_MEMORY; - } - xmlDeclHandler(handlerArg, storedversion, storedEncName, standalone); - } - else if (defaultHandler) - reportDefault(parser, encoding, s, next); - if (protocolEncodingName == NULL) { - if (newEncoding) { - if (newEncoding->minBytesPerChar != encoding->minBytesPerChar) { - eventPtr = encodingName; - return XML_ERROR_INCORRECT_ENCODING; - } - encoding = newEncoding; - } - else if (encodingName) { - enum XML_Error result; - if (!storedEncName) { - storedEncName = poolStoreString( - &temp2Pool, encoding, encodingName, - encodingName + XmlNameLength(encoding, encodingName)); - if (!storedEncName) - return XML_ERROR_NO_MEMORY; - } - result = handleUnknownEncoding(parser, storedEncName); - poolClear(&temp2Pool); - if (result == XML_ERROR_UNKNOWN_ENCODING) - eventPtr = encodingName; - return result; - } - } - - if (storedEncName || storedversion) - poolClear(&temp2Pool); - - return XML_ERROR_NONE; -} - -static enum XML_Error -handleUnknownEncoding(XML_Parser parser, const XML_Char *encodingName) -{ - if (unknownEncodingHandler) { - XML_Encoding info; - int i; - for (i = 0; i < 256; i++) - info.map[i] = -1; - info.convert = NULL; - info.data = NULL; - info.release = NULL; - if (unknownEncodingHandler(unknownEncodingHandlerData, encodingName, - &info)) { - ENCODING *enc; - unknownEncodingMem = MALLOC(XmlSizeOfUnknownEncoding()); - if (!unknownEncodingMem) { - if (info.release) - info.release(info.data); - return XML_ERROR_NO_MEMORY; - } - enc = (ns - ? XmlInitUnknownEncodingNS - : XmlInitUnknownEncoding)(unknownEncodingMem, - info.map, - info.convert, - info.data); - if (enc) { - unknownEncodingData = info.data; - unknownEncodingRelease = info.release; - encoding = enc; - return XML_ERROR_NONE; - } - } - if (info.release != NULL) - info.release(info.data); - } - return XML_ERROR_UNKNOWN_ENCODING; -} - -static enum XML_Error PTRCALL -prologInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - processor = prologProcessor; - return prologProcessor(parser, s, end, nextPtr); -} - -#ifdef XML_DTD - -static enum XML_Error PTRCALL -externalParEntInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - enum XML_Error result = initializeEncoding(parser); - if (result != XML_ERROR_NONE) - return result; - - /* we know now that XML_Parse(Buffer) has been called, - so we consider the external parameter entity read */ - _dtd->paramEntityRead = XML_TRUE; - - if (prologState.inEntityValue) { - processor = entityValueInitProcessor; - return entityValueInitProcessor(parser, s, end, nextPtr); - } - else { - processor = externalParEntProcessor; - return externalParEntProcessor(parser, s, end, nextPtr); - } -} - -static enum XML_Error PTRCALL -entityValueInitProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - int tok; - const char *start = s; - const char *next = start; - eventPtr = start; - - for (;;) { - tok = XmlPrologTok(encoding, start, end, &next); - eventEndPtr = next; - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - /* found end of entity value - can store it now */ - return storeEntityValue(parser, encoding, s, end); - } - else if (tok == XML_TOK_XML_DECL) { - enum XML_Error result; - result = processXmlDecl(parser, 0, start, next); - if (result != XML_ERROR_NONE) - return result; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - *nextPtr = next; - } - /* stop scanning for text declaration - we found one */ - processor = entityValueProcessor; - return entityValueProcessor(parser, next, end, nextPtr); - } - /* If we are at the end of the buffer, this would cause XmlPrologTok to - return XML_TOK_NONE on the next call, which would then cause the - function to exit with *nextPtr set to s - that is what we want for other - tokens, but not for the BOM - we would rather like to skip it; - then, when this routine is entered the next time, XmlPrologTok will - return XML_TOK_INVALID, since the BOM is still in the buffer - */ - else if (tok == XML_TOK_BOM && next == end && !ps_finalBuffer) { - *nextPtr = next; - return XML_ERROR_NONE; - } - start = next; - eventPtr = start; - } -} - -static enum XML_Error PTRCALL -externalParEntProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *next = s; - int tok; - - tok = XmlPrologTok(encoding, s, end, &next); - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - } - /* This would cause the next stage, i.e. doProlog to be passed XML_TOK_BOM. - However, when parsing an external subset, doProlog will not accept a BOM - as valid, and report a syntax error, so we have to skip the BOM - */ - else if (tok == XML_TOK_BOM) { - s = next; - tok = XmlPrologTok(encoding, s, end, &next); - } - - processor = prologProcessor; - return doProlog(parser, encoding, s, end, tok, next, - nextPtr, (XML_Bool)!ps_finalBuffer); -} - -static enum XML_Error PTRCALL -entityValueProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *start = s; - const char *next = s; - const ENCODING *enc = encoding; - int tok; - - for (;;) { - tok = XmlPrologTok(enc, start, end, &next); - if (tok <= 0) { - if (!ps_finalBuffer && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case XML_TOK_NONE: /* start == end */ - default: - break; - } - /* found end of entity value - can store it now */ - return storeEntityValue(parser, enc, s, end); - } - start = next; - } -} - -#endif /* XML_DTD */ - -static enum XML_Error PTRCALL -prologProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - const char *next = s; - int tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, - nextPtr, (XML_Bool)!ps_finalBuffer); -} - -static enum XML_Error -doProlog(XML_Parser parser, - const ENCODING *enc, - const char *s, - const char *end, - int tok, - const char *next, - const char **nextPtr, - XML_Bool haveMore) -{ -#ifdef XML_DTD - static const XML_Char externalSubsetName[] = { ASCII_HASH , '\0' }; -#endif /* XML_DTD */ - static const XML_Char atypeCDATA[] = - { ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; - static const XML_Char atypeID[] = { ASCII_I, ASCII_D, '\0' }; - static const XML_Char atypeIDREF[] = - { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; - static const XML_Char atypeIDREFS[] = - { ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; - static const XML_Char atypeENTITY[] = - { ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; - static const XML_Char atypeENTITIES[] = { ASCII_E, ASCII_N, - ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, '\0' }; - static const XML_Char atypeNMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; - static const XML_Char atypeNMTOKENS[] = { ASCII_N, ASCII_M, ASCII_T, - ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, '\0' }; - static const XML_Char notationPrefix[] = { ASCII_N, ASCII_O, ASCII_T, - ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, ASCII_LPAREN, '\0' }; - static const XML_Char enumValueSep[] = { ASCII_PIPE, '\0' }; - static const XML_Char enumValueStart[] = { ASCII_LPAREN, '\0' }; - - /* save one level of indirection */ - DTD * const dtd = _dtd; - - const char **eventPP; - const char **eventEndPP; - enum XML_Content_Quant quant; - - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - - for (;;) { - int role; - XML_Bool handleDefault = XML_TRUE; - *eventPP = s; - *eventEndPP = next; - if (tok <= 0) { - if (haveMore && tok != XML_TOK_INVALID) { - *nextPtr = s; - return XML_ERROR_NONE; - } - switch (tok) { - case XML_TOK_INVALID: - *eventPP = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - return XML_ERROR_PARTIAL_CHAR; - case -XML_TOK_PROLOG_S: - tok = -tok; - break; - case XML_TOK_NONE: -#ifdef XML_DTD - /* for internal PE NOT referenced between declarations */ - if (enc != encoding && !openInternalEntities->betweenDecl) { - *nextPtr = s; - return XML_ERROR_NONE; - } - /* WFC: PE Between Declarations - must check that PE contains - complete markup, not only for external PEs, but also for - internal PEs if the reference occurs between declarations. - */ - if (isParamEntity || enc != encoding) { - if (XmlTokenRole(&prologState, XML_TOK_NONE, end, end, enc) - == XML_ROLE_ERROR) - return XML_ERROR_INCOMPLETE_PE; - *nextPtr = s; - return XML_ERROR_NONE; - } -#endif /* XML_DTD */ - return XML_ERROR_NO_ELEMENTS; - default: - tok = -tok; - next = end; - break; - } - } - role = XmlTokenRole(&prologState, tok, s, next, enc); - switch (role) { - case XML_ROLE_XML_DECL: - { - enum XML_Error result = processXmlDecl(parser, 0, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_DOCTYPE_NAME: - if (startDoctypeDeclHandler) { - doctypeName = poolStoreString(&tempPool, enc, s, next); - if (!doctypeName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - doctypePubid = NULL; - handleDefault = XML_FALSE; - } - doctypeSysid = NULL; /* always initialize to NULL */ - break; - case XML_ROLE_DOCTYPE_INTERNAL_SUBSET: - if (startDoctypeDeclHandler) { - startDoctypeDeclHandler(handlerArg, doctypeName, doctypeSysid, - doctypePubid, 1); - doctypeName = NULL; - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - break; -#ifdef XML_DTD - case XML_ROLE_TEXT_DECL: - { - enum XML_Error result = processXmlDecl(parser, 1, s, next); - if (result != XML_ERROR_NONE) - return result; - enc = encoding; - handleDefault = XML_FALSE; - } - break; -#endif /* XML_DTD */ - case XML_ROLE_DOCTYPE_PUBLIC_ID: -#ifdef XML_DTD - useForeignDTD = XML_FALSE; - declEntity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; -#endif /* XML_DTD */ - dtd->hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - XML_Char *pubId; - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - pubId = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!pubId) - return XML_ERROR_NO_MEMORY; - normalizePublicId(pubId); - poolFinish(&tempPool); - doctypePubid = pubId; - handleDefault = XML_FALSE; - goto alreadyChecked; - } - /* fall through */ - case XML_ROLE_ENTITY_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - alreadyChecked: - if (dtd->keepProcessing && declEntity) { - XML_Char *tem = poolStoreString(&dtd->pool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declEntity->publicId = tem; - poolFinish(&dtd->pool); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_DOCTYPE_CLOSE: - if (doctypeName) { - startDoctypeDeclHandler(handlerArg, doctypeName, - doctypeSysid, doctypePubid, 0); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - /* doctypeSysid will be non-NULL in the case of a previous - XML_ROLE_DOCTYPE_SYSTEM_ID, even if startDoctypeDeclHandler - was not set, indicating an external subset - */ -#ifdef XML_DTD - if (doctypeSysid || useForeignDTD) { - XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; - dtd->hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - if (useForeignDTD) - entity->base = curBase; - dtd->paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - if (dtd->paramEntityRead) { - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - } - /* if we didn't read the foreign DTD then this means that there - is no external subset and we must reset dtd->hasParamEntityRefs - */ - else if (!doctypeSysid) - dtd->hasParamEntityRefs = hadParamEntityRefs; - /* end of DTD - no need to update dtd->keepProcessing */ - } - useForeignDTD = XML_FALSE; - } -#endif /* XML_DTD */ - if (endDoctypeDeclHandler) { - endDoctypeDeclHandler(handlerArg); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_INSTANCE_START: -#ifdef XML_DTD - /* if there is no DOCTYPE declaration then now is the - last chance to read the foreign DTD - */ - if (useForeignDTD) { - XML_Bool hadParamEntityRefs = dtd->hasParamEntityRefs; - dtd->hasParamEntityRefs = XML_TRUE; - if (paramEntityParsing && externalEntityRefHandler) { - ENTITY *entity = (ENTITY *)lookup(parser, &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!entity) - return XML_ERROR_NO_MEMORY; - entity->base = curBase; - dtd->paramEntityRead = XML_FALSE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - if (dtd->paramEntityRead) { - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - } - /* if we didn't read the foreign DTD then this means that there - is no external subset and we must reset dtd->hasParamEntityRefs - */ - else - dtd->hasParamEntityRefs = hadParamEntityRefs; - /* end of DTD - no need to update dtd->keepProcessing */ - } - } -#endif /* XML_DTD */ - processor = contentProcessor; - return contentProcessor(parser, s, end, nextPtr); - case XML_ROLE_ATTLIST_ELEMENT_NAME: - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_NAME: - declAttributeId = getAttributeId(parser, enc, s, next); - if (!declAttributeId) - return XML_ERROR_NO_MEMORY; - declAttributeIsCdata = XML_FALSE; - declAttributeType = NULL; - declAttributeIsId = XML_FALSE; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_CDATA: - declAttributeIsCdata = XML_TRUE; - declAttributeType = atypeCDATA; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ID: - declAttributeIsId = XML_TRUE; - declAttributeType = atypeID; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_IDREF: - declAttributeType = atypeIDREF; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_IDREFS: - declAttributeType = atypeIDREFS; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITY: - declAttributeType = atypeENTITY; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_ENTITIES: - declAttributeType = atypeENTITIES; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN: - declAttributeType = atypeNMTOKEN; - goto checkAttListDeclHandler; - case XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS: - declAttributeType = atypeNMTOKENS; - checkAttListDeclHandler: - if (dtd->keepProcessing && attlistDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ATTRIBUTE_ENUM_VALUE: - case XML_ROLE_ATTRIBUTE_NOTATION_VALUE: - if (dtd->keepProcessing && attlistDeclHandler) { - const XML_Char *prefix; - if (declAttributeType) { - prefix = enumValueSep; - } - else { - prefix = (role == XML_ROLE_ATTRIBUTE_NOTATION_VALUE - ? notationPrefix - : enumValueStart); - } - if (!poolAppendString(&tempPool, prefix)) - return XML_ERROR_NO_MEMORY; - if (!poolAppend(&tempPool, enc, s, next)) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_IMPLIED_ATTRIBUTE_VALUE: - case XML_ROLE_REQUIRED_ATTRIBUTE_VALUE: - if (dtd->keepProcessing) { - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, declAttributeIsId, - 0, parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T(ASCII_LPAREN) - || (*declAttributeType == XML_T(ASCII_N) - && declAttributeType[1] == XML_T(ASCII_O))) { - /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) - || !poolAppendChar(&tempPool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - 0, role == XML_ROLE_REQUIRED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_DEFAULT_ATTRIBUTE_VALUE: - case XML_ROLE_FIXED_ATTRIBUTE_VALUE: - if (dtd->keepProcessing) { - const XML_Char *attVal; - enum XML_Error result = - storeAttributeValue(parser, enc, declAttributeIsCdata, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar, - &dtd->pool); - if (result) - return result; - attVal = poolStart(&dtd->pool); - poolFinish(&dtd->pool); - /* ID attributes aren't allowed to have a default */ - if (!defineAttribute(declElementType, declAttributeId, - declAttributeIsCdata, XML_FALSE, attVal, parser)) - return XML_ERROR_NO_MEMORY; - if (attlistDeclHandler && declAttributeType) { - if (*declAttributeType == XML_T(ASCII_LPAREN) - || (*declAttributeType == XML_T(ASCII_N) - && declAttributeType[1] == XML_T(ASCII_O))) { - /* Enumerated or Notation type */ - if (!poolAppendChar(&tempPool, XML_T(ASCII_RPAREN)) - || !poolAppendChar(&tempPool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - declAttributeType = tempPool.start; - poolFinish(&tempPool); - } - *eventEndPP = s; - attlistDeclHandler(handlerArg, declElementType->name, - declAttributeId->name, declAttributeType, - attVal, - role == XML_ROLE_FIXED_ATTRIBUTE_VALUE); - poolClear(&tempPool); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_ENTITY_VALUE: - if (dtd->keepProcessing) { - enum XML_Error result = storeEntityValue(parser, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (declEntity) { - declEntity->textPtr = poolStart(&dtd->entityValuePool); - declEntity->textLen = (int)(poolLength(&dtd->entityValuePool)); - poolFinish(&dtd->entityValuePool); - if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - declEntity->textPtr, - declEntity->textLen, - curBase, 0, 0, 0); - handleDefault = XML_FALSE; - } - } - else - poolDiscard(&dtd->entityValuePool); - if (result != XML_ERROR_NONE) - return result; - } - break; - case XML_ROLE_DOCTYPE_SYSTEM_ID: -#ifdef XML_DTD - useForeignDTD = XML_FALSE; -#endif /* XML_DTD */ - dtd->hasParamEntityRefs = XML_TRUE; - if (startDoctypeDeclHandler) { - doctypeSysid = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (doctypeSysid == NULL) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } -#ifdef XML_DTD - else - /* use externalSubsetName to make doctypeSysid non-NULL - for the case where no startDoctypeDeclHandler is set */ - doctypeSysid = externalSubsetName; -#endif /* XML_DTD */ - if (!dtd->standalone -#ifdef XML_DTD - && !paramEntityParsing -#endif /* XML_DTD */ - && notStandaloneHandler - && !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; -#ifndef XML_DTD - break; -#else /* XML_DTD */ - if (!declEntity) { - declEntity = (ENTITY *)lookup(parser, - &dtd->paramEntities, - externalSubsetName, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - declEntity->publicId = NULL; - } - /* fall through */ -#endif /* XML_DTD */ - case XML_ROLE_ENTITY_SYSTEM_ID: - if (dtd->keepProcessing && declEntity) { - declEntity->systemId = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!declEntity->systemId) - return XML_ERROR_NO_MEMORY; - declEntity->base = curBase; - poolFinish(&dtd->pool); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_ENTITY_COMPLETE: - if (dtd->keepProcessing && declEntity && entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - declEntity->is_param, - 0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - 0); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_ENTITY_NOTATION_NAME: - if (dtd->keepProcessing && declEntity) { - declEntity->notation = poolStoreString(&dtd->pool, enc, s, next); - if (!declEntity->notation) - return XML_ERROR_NO_MEMORY; - poolFinish(&dtd->pool); - if (unparsedEntityDeclHandler) { - *eventEndPP = s; - unparsedEntityDeclHandler(handlerArg, - declEntity->name, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - handleDefault = XML_FALSE; - } - else if (entityDeclHandler) { - *eventEndPP = s; - entityDeclHandler(handlerArg, - declEntity->name, - 0,0,0, - declEntity->base, - declEntity->systemId, - declEntity->publicId, - declEntity->notation); - handleDefault = XML_FALSE; - } - } - break; - case XML_ROLE_GENERAL_ENTITY_NAME: - { - if (XmlPredefinedEntityName(enc, s, next)) { - declEntity = NULL; - break; - } - if (dtd->keepProcessing) { - const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, - sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - else { - poolFinish(&dtd->pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_FALSE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - } - break; - case XML_ROLE_PARAM_ENTITY_NAME: -#ifdef XML_DTD - if (dtd->keepProcessing) { - const XML_Char *name = poolStoreString(&dtd->pool, enc, s, next); - if (!name) - return XML_ERROR_NO_MEMORY; - declEntity = (ENTITY *)lookup(parser, &dtd->paramEntities, - name, sizeof(ENTITY)); - if (!declEntity) - return XML_ERROR_NO_MEMORY; - if (declEntity->name != name) { - poolDiscard(&dtd->pool); - declEntity = NULL; - } - else { - poolFinish(&dtd->pool); - declEntity->publicId = NULL; - declEntity->is_param = XML_TRUE; - /* if we have a parent parser or are reading an internal parameter - entity, then the entity declaration is not considered "internal" - */ - declEntity->is_internal = !(parentParser || openInternalEntities); - if (entityDeclHandler) - handleDefault = XML_FALSE; - } - } - else { - poolDiscard(&dtd->pool); - declEntity = NULL; - } -#else /* not XML_DTD */ - declEntity = NULL; -#endif /* XML_DTD */ - break; - case XML_ROLE_NOTATION_NAME: - declNotationPublicId = NULL; - declNotationName = NULL; - if (notationDeclHandler) { - declNotationName = poolStoreString(&tempPool, enc, s, next); - if (!declNotationName) - return XML_ERROR_NO_MEMORY; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_NOTATION_PUBLIC_ID: - if (!XmlIsPublicId(enc, s, next, eventPP)) - return XML_ERROR_PUBLICID; - if (declNotationName) { /* means notationDeclHandler != NULL */ - XML_Char *tem = poolStoreString(&tempPool, - enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!tem) - return XML_ERROR_NO_MEMORY; - normalizePublicId(tem); - declNotationPublicId = tem; - poolFinish(&tempPool); - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_NOTATION_SYSTEM_ID: - if (declNotationName && notationDeclHandler) { - const XML_Char *systemId - = poolStoreString(&tempPool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!systemId) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - systemId, - declNotationPublicId); - handleDefault = XML_FALSE; - } - poolClear(&tempPool); - break; - case XML_ROLE_NOTATION_NO_SYSTEM_ID: - if (declNotationPublicId && notationDeclHandler) { - *eventEndPP = s; - notationDeclHandler(handlerArg, - declNotationName, - curBase, - 0, - declNotationPublicId); - handleDefault = XML_FALSE; - } - poolClear(&tempPool); - break; - case XML_ROLE_ERROR: - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: - /* PE references in internal subset are - not allowed within declarations. */ - return XML_ERROR_PARAM_ENTITY_REF; - case XML_TOK_XML_DECL: - return XML_ERROR_MISPLACED_XML_PI; - default: - return XML_ERROR_SYNTAX; - } -#ifdef XML_DTD - case XML_ROLE_IGNORE_SECT: - { - enum XML_Error result; - if (defaultHandler) - reportDefault(parser, enc, s, next); - handleDefault = XML_FALSE; - result = doIgnoreSection(parser, enc, &next, end, nextPtr, haveMore); - if (result != XML_ERROR_NONE) - return result; - else if (!next) { - processor = ignoreSectionProcessor; - return result; - } - } - break; -#endif /* XML_DTD */ - case XML_ROLE_GROUP_OPEN: - if (prologState.level >= groupSize) { - if (groupSize) { - char *temp = (char *)REALLOC(groupConnector, groupSize *= 2); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - groupConnector = temp; - if (dtd->scaffIndex) { - int *temp = (int *)REALLOC(dtd->scaffIndex, - groupSize * sizeof(int)); - if (temp == NULL) - return XML_ERROR_NO_MEMORY; - dtd->scaffIndex = temp; - } - } - else { - groupConnector = (char *)MALLOC(groupSize = 32); - if (!groupConnector) - return XML_ERROR_NO_MEMORY; - } - } - groupConnector[prologState.level] = 0; - if (dtd->in_eldecl) { - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd->scaffIndex[dtd->scaffLevel] = myindex; - dtd->scaffLevel++; - dtd->scaffold[myindex].type = XML_CTYPE_SEQ; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - case XML_ROLE_GROUP_SEQUENCE: - if (groupConnector[prologState.level] == ASCII_PIPE) - return XML_ERROR_SYNTAX; - groupConnector[prologState.level] = ASCII_COMMA; - if (dtd->in_eldecl && elementDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_GROUP_CHOICE: - if (groupConnector[prologState.level] == ASCII_COMMA) - return XML_ERROR_SYNTAX; - if (dtd->in_eldecl - && !groupConnector[prologState.level] - && (dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - != XML_CTYPE_MIXED) - ) { - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - = XML_CTYPE_CHOICE; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - groupConnector[prologState.level] = ASCII_PIPE; - break; - case XML_ROLE_PARAM_ENTITY_REF: -#ifdef XML_DTD - case XML_ROLE_INNER_PARAM_ENTITY_REF: - dtd->hasParamEntityRefs = XML_TRUE; - if (!paramEntityParsing) - dtd->keepProcessing = dtd->standalone; - else { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&dtd->pool, enc, - s + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); - poolDiscard(&dtd->pool); - /* first, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal, - otherwise call the skipped entity handler - */ - if (prologState.documentEntity && - (dtd->standalone - ? !openInternalEntities - : !dtd->hasParamEntityRefs)) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - dtd->keepProcessing = dtd->standalone; - /* cannot report skipped entities in declarations */ - if ((role == XML_ROLE_PARAM_ENTITY_REF) && skippedEntityHandler) { - skippedEntityHandler(handlerArg, name, 1); - handleDefault = XML_FALSE; - } - break; - } - if (entity->open) - return XML_ERROR_RECURSIVE_ENTITY_REF; - if (entity->textPtr) { - enum XML_Error result; - XML_Bool betweenDecl = - (role == XML_ROLE_PARAM_ENTITY_REF ? XML_TRUE : XML_FALSE); - result = processInternalEntity(parser, entity, betweenDecl); - if (result != XML_ERROR_NONE) - return result; - handleDefault = XML_FALSE; - break; - } - if (externalEntityRefHandler) { - dtd->paramEntityRead = XML_FALSE; - entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = XML_FALSE; - return XML_ERROR_EXTERNAL_ENTITY_HANDLING; - } - entity->open = XML_FALSE; - handleDefault = XML_FALSE; - if (!dtd->paramEntityRead) { - dtd->keepProcessing = dtd->standalone; - break; - } - } - else { - dtd->keepProcessing = dtd->standalone; - break; - } - } -#endif /* XML_DTD */ - if (!dtd->standalone && - notStandaloneHandler && - !notStandaloneHandler(handlerArg)) - return XML_ERROR_NOT_STANDALONE; - break; - - /* Element declaration stuff */ - - case XML_ROLE_ELEMENT_NAME: - if (elementDeclHandler) { - declElementType = getElementType(parser, enc, s, next); - if (!declElementType) - return XML_ERROR_NO_MEMORY; - dtd->scaffLevel = 0; - dtd->scaffCount = 0; - dtd->in_eldecl = XML_TRUE; - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_ANY: - case XML_ROLE_CONTENT_EMPTY: - if (dtd->in_eldecl) { - if (elementDeclHandler) { - XML_Content * content = (XML_Content *) MALLOC(sizeof(XML_Content)); - if (!content) - return XML_ERROR_NO_MEMORY; - content->quant = XML_CQUANT_NONE; - content->name = NULL; - content->numchildren = 0; - content->children = NULL; - content->type = ((role == XML_ROLE_CONTENT_ANY) ? - XML_CTYPE_ANY : - XML_CTYPE_EMPTY); - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, content); - handleDefault = XML_FALSE; - } - dtd->in_eldecl = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_PCDATA: - if (dtd->in_eldecl) { - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel - 1]].type - = XML_CTYPE_MIXED; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_CONTENT_ELEMENT: - quant = XML_CQUANT_NONE; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_OPT: - quant = XML_CQUANT_OPT; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_REP: - quant = XML_CQUANT_REP; - goto elementContent; - case XML_ROLE_CONTENT_ELEMENT_PLUS: - quant = XML_CQUANT_PLUS; - elementContent: - if (dtd->in_eldecl) { - ELEMENT_TYPE *el; - const XML_Char *name; - int nameLen; - const char *nxt = (quant == XML_CQUANT_NONE - ? next - : next - enc->minBytesPerChar); - int myindex = nextScaffoldPart(parser); - if (myindex < 0) - return XML_ERROR_NO_MEMORY; - dtd->scaffold[myindex].type = XML_CTYPE_NAME; - dtd->scaffold[myindex].quant = quant; - el = getElementType(parser, enc, s, nxt); - if (!el) - return XML_ERROR_NO_MEMORY; - name = el->name; - dtd->scaffold[myindex].name = name; - nameLen = 0; - for (; name[nameLen++]; ); - dtd->contentStringLen += nameLen; - if (elementDeclHandler) - handleDefault = XML_FALSE; - } - break; - - case XML_ROLE_GROUP_CLOSE: - quant = XML_CQUANT_NONE; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_OPT: - quant = XML_CQUANT_OPT; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_REP: - quant = XML_CQUANT_REP; - goto closeGroup; - case XML_ROLE_GROUP_CLOSE_PLUS: - quant = XML_CQUANT_PLUS; - closeGroup: - if (dtd->in_eldecl) { - if (elementDeclHandler) - handleDefault = XML_FALSE; - dtd->scaffLevel--; - dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel]].quant = quant; - if (dtd->scaffLevel == 0) { - if (!handleDefault) { - XML_Content *model = build_model(parser); - if (!model) - return XML_ERROR_NO_MEMORY; - *eventEndPP = s; - elementDeclHandler(handlerArg, declElementType->name, model); - } - dtd->in_eldecl = XML_FALSE; - dtd->contentStringLen = 0; - } - } - break; - /* End element declaration stuff */ - - case XML_ROLE_PI: - if (!reportProcessingInstruction(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - handleDefault = XML_FALSE; - break; - case XML_ROLE_COMMENT: - if (!reportComment(parser, enc, s, next)) - return XML_ERROR_NO_MEMORY; - handleDefault = XML_FALSE; - break; - case XML_ROLE_NONE: - switch (tok) { - case XML_TOK_BOM: - handleDefault = XML_FALSE; - break; - } - break; - case XML_ROLE_DOCTYPE_NONE: - if (startDoctypeDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ENTITY_NONE: - if (dtd->keepProcessing && entityDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_NOTATION_NONE: - if (notationDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ATTLIST_NONE: - if (dtd->keepProcessing && attlistDeclHandler) - handleDefault = XML_FALSE; - break; - case XML_ROLE_ELEMENT_NONE: - if (elementDeclHandler) - handleDefault = XML_FALSE; - break; - } /* end of big switch */ - - if (handleDefault && defaultHandler) - reportDefault(parser, enc, s, next); - - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: - s = next; - tok = XmlPrologTok(enc, s, end, &next); - } - } - /* not reached */ -} - -static enum XML_Error PTRCALL -epilogProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - processor = epilogProcessor; - eventPtr = s; - for (;;) { - const char *next = NULL; - int tok = XmlPrologTok(encoding, s, end, &next); - eventEndPtr = next; - switch (tok) { - /* report partial linebreak - it might be the last token */ - case -XML_TOK_PROLOG_S: - if (defaultHandler) { - reportDefault(parser, encoding, s, next); - if (ps_parsing == XML_FINISHED) - return XML_ERROR_ABORTED; - } - *nextPtr = next; - return XML_ERROR_NONE; - case XML_TOK_NONE: - *nextPtr = s; - return XML_ERROR_NONE; - case XML_TOK_PROLOG_S: - if (defaultHandler) - reportDefault(parser, encoding, s, next); - break; - case XML_TOK_PI: - if (!reportProcessingInstruction(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_COMMENT: - if (!reportComment(parser, encoding, s, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_INVALID: - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (!ps_finalBuffer) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_UNCLOSED_TOKEN; - case XML_TOK_PARTIAL_CHAR: - if (!ps_finalBuffer) { - *nextPtr = s; - return XML_ERROR_NONE; - } - return XML_ERROR_PARTIAL_CHAR; - default: - return XML_ERROR_JUNK_AFTER_DOC_ELEMENT; - } - eventPtr = s = next; - switch (ps_parsing) { - case XML_SUSPENDED: - *nextPtr = next; - return XML_ERROR_NONE; - case XML_FINISHED: - return XML_ERROR_ABORTED; - default: ; - } - } -} - -static enum XML_Error -processInternalEntity(XML_Parser parser, ENTITY *entity, - XML_Bool betweenDecl) -{ - const char *textStart, *textEnd; - const char *next; - enum XML_Error result; - OPEN_INTERNAL_ENTITY *openEntity; - - if (freeInternalEntities) { - openEntity = freeInternalEntities; - freeInternalEntities = openEntity->next; - } - else { - openEntity = (OPEN_INTERNAL_ENTITY *)MALLOC(sizeof(OPEN_INTERNAL_ENTITY)); - if (!openEntity) - return XML_ERROR_NO_MEMORY; - } - entity->open = XML_TRUE; - entity->processed = 0; - openEntity->next = openInternalEntities; - openInternalEntities = openEntity; - openEntity->entity = entity; - openEntity->startTagLevel = tagLevel; - openEntity->betweenDecl = betweenDecl; - openEntity->internalEventPtr = NULL; - openEntity->internalEventEndPtr = NULL; - textStart = (char *)entity->textPtr; - textEnd = (char *)(entity->textPtr + entity->textLen); - -#ifdef XML_DTD - if (entity->is_param) { - int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); - result = doProlog(parser, internalEncoding, textStart, textEnd, tok, - next, &next, XML_FALSE); - } - else -#endif /* XML_DTD */ - result = doContent(parser, tagLevel, internalEncoding, textStart, - textEnd, &next, XML_FALSE); - - if (result == XML_ERROR_NONE) { - if (textEnd != next && ps_parsing == XML_SUSPENDED) { - entity->processed = (int)(next - textStart); - processor = internalEntityProcessor; - } - else { - entity->open = XML_FALSE; - openInternalEntities = openEntity->next; - /* put openEntity back in list of free instances */ - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - } - return result; -} - -static enum XML_Error PTRCALL -internalEntityProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - ENTITY *entity; - const char *textStart, *textEnd; - const char *next; - enum XML_Error result; - OPEN_INTERNAL_ENTITY *openEntity = openInternalEntities; - if (!openEntity) - return XML_ERROR_UNEXPECTED_STATE; - - entity = openEntity->entity; - textStart = ((char *)entity->textPtr) + entity->processed; - textEnd = (char *)(entity->textPtr + entity->textLen); - -#ifdef XML_DTD - if (entity->is_param) { - int tok = XmlPrologTok(internalEncoding, textStart, textEnd, &next); - result = doProlog(parser, internalEncoding, textStart, textEnd, tok, - next, &next, XML_FALSE); - } - else -#endif /* XML_DTD */ - result = doContent(parser, openEntity->startTagLevel, internalEncoding, - textStart, textEnd, &next, XML_FALSE); - - if (result != XML_ERROR_NONE) - return result; - else if (textEnd != next && ps_parsing == XML_SUSPENDED) { - entity->processed = (int)(next - (char *)entity->textPtr); - return result; - } - else { - entity->open = XML_FALSE; - openInternalEntities = openEntity->next; - /* put openEntity back in list of free instances */ - openEntity->next = freeInternalEntities; - freeInternalEntities = openEntity; - } - -#ifdef XML_DTD - if (entity->is_param) { - int tok; - processor = prologProcessor; - tok = XmlPrologTok(encoding, s, end, &next); - return doProlog(parser, encoding, s, end, tok, next, nextPtr, - (XML_Bool)!ps_finalBuffer); - } - else -#endif /* XML_DTD */ - { - processor = contentProcessor; - /* see externalEntityContentProcessor vs contentProcessor */ - return doContent(parser, parentParser ? 1 : 0, encoding, s, end, - nextPtr, (XML_Bool)!ps_finalBuffer); - } -} - -static enum XML_Error PTRCALL -errorProcessor(XML_Parser parser, - const char *s, - const char *end, - const char **nextPtr) -{ - return errorCode; -} - -static enum XML_Error -storeAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - enum XML_Error result = appendAttributeValue(parser, enc, isCdata, ptr, - end, pool); - if (result) - return result; - if (!isCdata && poolLength(pool) && poolLastChar(pool) == 0x20) - poolChop(pool); - if (!poolAppendChar(pool, XML_T('\0'))) - return XML_ERROR_NO_MEMORY; - return XML_ERROR_NONE; -} - -static enum XML_Error -appendAttributeValue(XML_Parser parser, const ENCODING *enc, XML_Bool isCdata, - const char *ptr, const char *end, - STRING_POOL *pool) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - for (;;) { - const char *next; - int tok = XmlAttributeValueTok(enc, ptr, end, &next); - switch (tok) { - case XML_TOK_NONE: - return XML_ERROR_NONE; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_INVALID_TOKEN; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, ptr); - if (n < 0) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - if (!isCdata - && n == 0x20 /* space */ - && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BAD_CHAR_REF; - } - for (i = 0; i < n; i++) { - if (!poolAppendChar(pool, buf[i])) - return XML_ERROR_NO_MEMORY; - } - } - break; - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, ptr, next)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_TRAILING_CR: - next = ptr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_ATTRIBUTE_VALUE_S: - case XML_TOK_DATA_NEWLINE: - if (!isCdata && (poolLength(pool) == 0 || poolLastChar(pool) == 0x20)) - break; - if (!poolAppendChar(pool, 0x20)) - return XML_ERROR_NO_MEMORY; - break; - case XML_TOK_ENTITY_REF: - { - const XML_Char *name; - ENTITY *entity; - char checkEntityDecl; - XML_Char ch = (XML_Char) XmlPredefinedEntityName(enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (ch) { - if (!poolAppendChar(pool, ch)) - return XML_ERROR_NO_MEMORY; - break; - } - name = poolStoreString(&temp2Pool, enc, - ptr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) - return XML_ERROR_NO_MEMORY; - entity = (ENTITY *)lookup(parser, &dtd->generalEntities, name, 0); - poolDiscard(&temp2Pool); - /* First, determine if a check for an existing declaration is needed; - if yes, check that the entity exists, and that it is internal. - */ - if (pool == &dtd->pool) /* are we called from prolog? */ - checkEntityDecl = -#ifdef XML_DTD - prologState.documentEntity && -#endif /* XML_DTD */ - (dtd->standalone - ? !openInternalEntities - : !dtd->hasParamEntityRefs); - else /* if (pool == &tempPool): we are called from content */ - checkEntityDecl = !dtd->hasParamEntityRefs || dtd->standalone; - if (checkEntityDecl) { - if (!entity) - return XML_ERROR_UNDEFINED_ENTITY; - else if (!entity->is_internal) - return XML_ERROR_ENTITY_DECLARED_IN_PE; - } - else if (!entity) { - /* Cannot report skipped entity here - see comments on - skippedEntityHandler. - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - /* Cannot call the default handler because this would be - out of sync with the call to the startElementHandler. - if ((pool == &tempPool) && defaultHandler) - reportDefault(parser, enc, ptr, next); - */ - break; - } - if (entity->open) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_RECURSIVE_ENTITY_REF; - } - if (entity->notation) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_BINARY_ENTITY_REF; - } - if (!entity->textPtr) { - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF; - } - else { - enum XML_Error result; - const XML_Char *textEnd = entity->textPtr + entity->textLen; - entity->open = XML_TRUE; - result = appendAttributeValue(parser, internalEncoding, isCdata, - (char *)entity->textPtr, - (char *)textEnd, pool); - entity->open = XML_FALSE; - if (result) - return result; - } - } - break; - default: - if (enc == encoding) - eventPtr = ptr; - return XML_ERROR_UNEXPECTED_STATE; - } - ptr = next; - } - /* not reached */ -} - -static enum XML_Error -storeEntityValue(XML_Parser parser, - const ENCODING *enc, - const char *entityTextPtr, - const char *entityTextEnd) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - STRING_POOL *pool = &(dtd->entityValuePool); - enum XML_Error result = XML_ERROR_NONE; -#ifdef XML_DTD - int oldInEntityValue = prologState.inEntityValue; - prologState.inEntityValue = 1; -#endif /* XML_DTD */ - /* never return Null for the value argument in EntityDeclHandler, - since this would indicate an external entity; therefore we - have to make sure that entityValuePool.start is not null */ - if (!pool->blocks) { - if (!poolGrow(pool)) - return XML_ERROR_NO_MEMORY; - } - - for (;;) { - const char *next; - int tok = XmlEntityValueTok(enc, entityTextPtr, entityTextEnd, &next); - switch (tok) { - case XML_TOK_PARAM_ENTITY_REF: -#ifdef XML_DTD - if (isParamEntity || enc != encoding) { - const XML_Char *name; - ENTITY *entity; - name = poolStoreString(&tempPool, enc, - entityTextPtr + enc->minBytesPerChar, - next - enc->minBytesPerChar); - if (!name) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - entity = (ENTITY *)lookup(parser, &dtd->paramEntities, name, 0); - poolDiscard(&tempPool); - if (!entity) { - /* not a well-formedness error - see XML 1.0: WFC Entity Declared */ - /* cannot report skipped entity here - see comments on - skippedEntityHandler - if (skippedEntityHandler) - skippedEntityHandler(handlerArg, name, 0); - */ - dtd->keepProcessing = dtd->standalone; - goto endEntityValue; - } - if (entity->open) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_RECURSIVE_ENTITY_REF; - goto endEntityValue; - } - if (entity->systemId) { - if (externalEntityRefHandler) { - dtd->paramEntityRead = XML_FALSE; - entity->open = XML_TRUE; - if (!externalEntityRefHandler(externalEntityRefHandlerArg, - 0, - entity->base, - entity->systemId, - entity->publicId)) { - entity->open = XML_FALSE; - result = XML_ERROR_EXTERNAL_ENTITY_HANDLING; - goto endEntityValue; - } - entity->open = XML_FALSE; - if (!dtd->paramEntityRead) - dtd->keepProcessing = dtd->standalone; - } - else - dtd->keepProcessing = dtd->standalone; - } - else { - entity->open = XML_TRUE; - result = storeEntityValue(parser, - internalEncoding, - (char *)entity->textPtr, - (char *)(entity->textPtr - + entity->textLen)); - entity->open = XML_FALSE; - if (result) - goto endEntityValue; - } - break; - } -#endif /* XML_DTD */ - /* In the internal subset, PE references are not legal - within markup declarations, e.g entity values in this case. */ - eventPtr = entityTextPtr; - result = XML_ERROR_PARAM_ENTITY_REF; - goto endEntityValue; - case XML_TOK_NONE: - result = XML_ERROR_NONE; - goto endEntityValue; - case XML_TOK_ENTITY_REF: - case XML_TOK_DATA_CHARS: - if (!poolAppend(pool, enc, entityTextPtr, next)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - break; - case XML_TOK_TRAILING_CR: - next = entityTextPtr + enc->minBytesPerChar; - /* fall through */ - case XML_TOK_DATA_NEWLINE: - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = 0xA; - break; - case XML_TOK_CHAR_REF: - { - XML_Char buf[XML_ENCODE_MAX]; - int i; - int n = XmlCharRefNumber(enc, entityTextPtr); - if (n < 0) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - n = XmlEncode(n, (ICHAR *)buf); - if (!n) { - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_BAD_CHAR_REF; - goto endEntityValue; - } - for (i = 0; i < n; i++) { - if (pool->end == pool->ptr && !poolGrow(pool)) { - result = XML_ERROR_NO_MEMORY; - goto endEntityValue; - } - *(pool->ptr)++ = buf[i]; - } - } - break; - case XML_TOK_PARTIAL: - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_INVALID_TOKEN; - goto endEntityValue; - case XML_TOK_INVALID: - if (enc == encoding) - eventPtr = next; - result = XML_ERROR_INVALID_TOKEN; - goto endEntityValue; - default: - if (enc == encoding) - eventPtr = entityTextPtr; - result = XML_ERROR_UNEXPECTED_STATE; - goto endEntityValue; - } - entityTextPtr = next; - } -endEntityValue: -#ifdef XML_DTD - prologState.inEntityValue = oldInEntityValue; -#endif /* XML_DTD */ - return result; -} - -static void FASTCALL -normalizeLines(XML_Char *s) -{ - XML_Char *p; - for (;; s++) { - if (*s == XML_T('\0')) - return; - if (*s == 0xD) - break; - } - p = s; - do { - if (*s == 0xD) { - *p++ = 0xA; - if (*++s == 0xA) - s++; - } - else - *p++ = *s++; - } while (*s); - *p = XML_T('\0'); -} - -static int -reportProcessingInstruction(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - const XML_Char *target; - XML_Char *data; - const char *tem; - if (!processingInstructionHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - start += enc->minBytesPerChar * 2; - tem = start + XmlNameLength(enc, start); - target = poolStoreString(&tempPool, enc, start, tem); - if (!target) - return 0; - poolFinish(&tempPool); - data = poolStoreString(&tempPool, enc, - XmlSkipS(enc, tem), - end - enc->minBytesPerChar*2); - if (!data) - return 0; - normalizeLines(data); - processingInstructionHandler(handlerArg, target, data); - poolClear(&tempPool); - return 1; -} - -static int -reportComment(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - XML_Char *data; - if (!commentHandler) { - if (defaultHandler) - reportDefault(parser, enc, start, end); - return 1; - } - data = poolStoreString(&tempPool, - enc, - start + enc->minBytesPerChar * 4, - end - enc->minBytesPerChar * 3); - if (!data) - return 0; - normalizeLines(data); - commentHandler(handlerArg, data); - poolClear(&tempPool); - return 1; -} - -static void -reportDefault(XML_Parser parser, const ENCODING *enc, - const char *s, const char *end) -{ - if (MUST_CONVERT(enc, s)) { - const char **eventPP; - const char **eventEndPP; - if (enc == encoding) { - eventPP = &eventPtr; - eventEndPP = &eventEndPtr; - } - else { - eventPP = &(openInternalEntities->internalEventPtr); - eventEndPP = &(openInternalEntities->internalEventEndPtr); - } - do { - ICHAR *dataPtr = (ICHAR *)dataBuf; - XmlConvert(enc, &s, end, &dataPtr, (ICHAR *)dataBufEnd); - *eventEndPP = s; - defaultHandler(handlerArg, dataBuf, (int)(dataPtr - (ICHAR *)dataBuf)); - *eventPP = s; - } while (s != end); - } - else - defaultHandler(handlerArg, (XML_Char *)s, (int)((XML_Char *)end - (XML_Char *)s)); -} - - -static int -defineAttribute(ELEMENT_TYPE *type, ATTRIBUTE_ID *attId, XML_Bool isCdata, - XML_Bool isId, const XML_Char *value, XML_Parser parser) -{ - DEFAULT_ATTRIBUTE *att; - if (value || isId) { - /* The handling of default attributes gets messed up if we have - a default which duplicates a non-default. */ - int i; - for (i = 0; i < type->nDefaultAtts; i++) - if (attId == type->defaultAtts[i].id) - return 1; - if (isId && !type->idAtt && !attId->xmlns) - type->idAtt = attId; - } - if (type->nDefaultAtts == type->allocDefaultAtts) { - if (type->allocDefaultAtts == 0) { - type->allocDefaultAtts = 8; - type->defaultAtts = (DEFAULT_ATTRIBUTE *)MALLOC(type->allocDefaultAtts - * sizeof(DEFAULT_ATTRIBUTE)); - if (!type->defaultAtts) - return 0; - } - else { - DEFAULT_ATTRIBUTE *temp; - int count = type->allocDefaultAtts * 2; - temp = (DEFAULT_ATTRIBUTE *) - REALLOC(type->defaultAtts, (count * sizeof(DEFAULT_ATTRIBUTE))); - if (temp == NULL) - return 0; - type->allocDefaultAtts = count; - type->defaultAtts = temp; - } - } - att = type->defaultAtts + type->nDefaultAtts; - att->id = attId; - att->value = value; - att->isCdata = isCdata; - if (!isCdata) - attId->maybeTokenized = XML_TRUE; - type->nDefaultAtts += 1; - return 1; -} - -static int -setElementTypePrefix(XML_Parser parser, ELEMENT_TYPE *elementType) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *name; - for (name = elementType->name; *name; name++) { - if (*name == XML_T(ASCII_COLON)) { - PREFIX *prefix; - const XML_Char *s; - for (s = elementType->name; s != name; s++) { - if (!poolAppendChar(&dtd->pool, *s)) - return 0; - } - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return 0; - prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), - sizeof(PREFIX)); - if (!prefix) - return 0; - if (prefix->name == poolStart(&dtd->pool)) - poolFinish(&dtd->pool); - else - poolDiscard(&dtd->pool); - elementType->prefix = prefix; - - } - } - return 1; -} - -static ATTRIBUTE_ID * -getAttributeId(XML_Parser parser, const ENCODING *enc, - const char *start, const char *end) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - ATTRIBUTE_ID *id; - const XML_Char *name; - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return NULL; - name = poolStoreString(&dtd->pool, enc, start, end); - if (!name) - return NULL; - /* skip quotation mark - its storage will be re-used (like in name[-1]) */ - ++name; - id = (ATTRIBUTE_ID *)lookup(parser, &dtd->attributeIds, name, sizeof(ATTRIBUTE_ID)); - if (!id) - return NULL; - if (id->name != name) - poolDiscard(&dtd->pool); - else { - poolFinish(&dtd->pool); - if (!ns) - ; - else if (name[0] == XML_T(ASCII_x) - && name[1] == XML_T(ASCII_m) - && name[2] == XML_T(ASCII_l) - && name[3] == XML_T(ASCII_n) - && name[4] == XML_T(ASCII_s) - && (name[5] == XML_T('\0') || name[5] == XML_T(ASCII_COLON))) { - if (name[5] == XML_T('\0')) - id->prefix = &dtd->defaultPrefix; - else - id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, name + 6, sizeof(PREFIX)); - id->xmlns = XML_TRUE; - } - else { - int i; - for (i = 0; name[i]; i++) { - /* attributes without prefix are *not* in the default namespace */ - if (name[i] == XML_T(ASCII_COLON)) { - int j; - for (j = 0; j < i; j++) { - if (!poolAppendChar(&dtd->pool, name[j])) - return NULL; - } - if (!poolAppendChar(&dtd->pool, XML_T('\0'))) - return NULL; - id->prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&dtd->pool), - sizeof(PREFIX)); - if (id->prefix->name == poolStart(&dtd->pool)) - poolFinish(&dtd->pool); - else - poolDiscard(&dtd->pool); - break; - } - } - } - } - return id; -} - -#define CONTEXT_SEP XML_T(ASCII_FF) - -static const XML_Char * -getContext(XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - HASH_TABLE_ITER iter; - XML_Bool needSep = XML_FALSE; - - if (dtd->defaultPrefix.binding) { - int i; - int len; - if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) - return NULL; - len = dtd->defaultPrefix.binding->uriLen; - if (namespaceSeparator) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, dtd->defaultPrefix.binding->uri[i])) - return NULL; - needSep = XML_TRUE; - } - - hashTableIterInit(&iter, &(dtd->prefixes)); - for (;;) { - int i; - int len; - const XML_Char *s; - PREFIX *prefix = (PREFIX *)hashTableIterNext(&iter); - if (!prefix) - break; - if (!prefix->binding) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return NULL; - for (s = prefix->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return NULL; - if (!poolAppendChar(&tempPool, XML_T(ASCII_EQUALS))) - return NULL; - len = prefix->binding->uriLen; - if (namespaceSeparator) - len--; - for (i = 0; i < len; i++) - if (!poolAppendChar(&tempPool, prefix->binding->uri[i])) - return NULL; - needSep = XML_TRUE; - } - - - hashTableIterInit(&iter, &(dtd->generalEntities)); - for (;;) { - const XML_Char *s; - ENTITY *e = (ENTITY *)hashTableIterNext(&iter); - if (!e) - break; - if (!e->open) - continue; - if (needSep && !poolAppendChar(&tempPool, CONTEXT_SEP)) - return NULL; - for (s = e->name; *s; s++) - if (!poolAppendChar(&tempPool, *s)) - return 0; - needSep = XML_TRUE; - } - - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return NULL; - return tempPool.start; -} - -static XML_Bool -setContext(XML_Parser parser, const XML_Char *context) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *s = context; - - while (*context != XML_T('\0')) { - if (*s == CONTEXT_SEP || *s == XML_T('\0')) { - ENTITY *e; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - e = (ENTITY *)lookup(parser, &dtd->generalEntities, poolStart(&tempPool), 0); - if (e) - e->open = XML_TRUE; - if (*s != XML_T('\0')) - s++; - context = s; - poolDiscard(&tempPool); - } - else if (*s == XML_T(ASCII_EQUALS)) { - PREFIX *prefix; - if (poolLength(&tempPool) == 0) - prefix = &dtd->defaultPrefix; - else { - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - prefix = (PREFIX *)lookup(parser, &dtd->prefixes, poolStart(&tempPool), - sizeof(PREFIX)); - if (!prefix) - return XML_FALSE; - if (prefix->name == poolStart(&tempPool)) { - prefix->name = poolCopyString(&dtd->pool, prefix->name); - if (!prefix->name) - return XML_FALSE; - } - poolDiscard(&tempPool); - } - for (context = s + 1; - *context != CONTEXT_SEP && *context != XML_T('\0'); - context++) - if (!poolAppendChar(&tempPool, *context)) - return XML_FALSE; - if (!poolAppendChar(&tempPool, XML_T('\0'))) - return XML_FALSE; - if (addBinding(parser, prefix, NULL, poolStart(&tempPool), - &inheritedBindings) != XML_ERROR_NONE) - return XML_FALSE; - poolDiscard(&tempPool); - if (*context != XML_T('\0')) - ++context; - s = context; - } - else { - if (!poolAppendChar(&tempPool, *s)) - return XML_FALSE; - s++; - } - } - return XML_TRUE; -} - -static void FASTCALL -normalizePublicId(XML_Char *publicId) -{ - XML_Char *p = publicId; - XML_Char *s; - for (s = publicId; *s; s++) { - switch (*s) { - case 0x20: - case 0xD: - case 0xA: - if (p != publicId && p[-1] != 0x20) - *p++ = 0x20; - break; - default: - *p++ = *s; - } - } - if (p != publicId && p[-1] == 0x20) - --p; - *p = XML_T('\0'); -} - -static DTD * -dtdCreate(const XML_Memory_Handling_Suite *ms) -{ - DTD *p = (DTD *)ms->malloc_fcn(sizeof(DTD)); - if (p == NULL) - return p; - poolInit(&(p->pool), ms); - poolInit(&(p->entityValuePool), ms); - hashTableInit(&(p->generalEntities), ms); - hashTableInit(&(p->elementTypes), ms); - hashTableInit(&(p->attributeIds), ms); - hashTableInit(&(p->prefixes), ms); -#ifdef XML_DTD - p->paramEntityRead = XML_FALSE; - hashTableInit(&(p->paramEntities), ms); -#endif /* XML_DTD */ - p->defaultPrefix.name = NULL; - p->defaultPrefix.binding = NULL; - - p->in_eldecl = XML_FALSE; - p->scaffIndex = NULL; - p->scaffold = NULL; - p->scaffLevel = 0; - p->scaffSize = 0; - p->scaffCount = 0; - p->contentStringLen = 0; - - p->keepProcessing = XML_TRUE; - p->hasParamEntityRefs = XML_FALSE; - p->standalone = XML_FALSE; - return p; -} - -static void -dtdReset(DTD *p, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - ms->free_fcn(e->defaultAtts); - } - hashTableClear(&(p->generalEntities)); -#ifdef XML_DTD - p->paramEntityRead = XML_FALSE; - hashTableClear(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableClear(&(p->elementTypes)); - hashTableClear(&(p->attributeIds)); - hashTableClear(&(p->prefixes)); - poolClear(&(p->pool)); - poolClear(&(p->entityValuePool)); - p->defaultPrefix.name = NULL; - p->defaultPrefix.binding = NULL; - - p->in_eldecl = XML_FALSE; - - ms->free_fcn(p->scaffIndex); - p->scaffIndex = NULL; - ms->free_fcn(p->scaffold); - p->scaffold = NULL; - - p->scaffLevel = 0; - p->scaffSize = 0; - p->scaffCount = 0; - p->contentStringLen = 0; - - p->keepProcessing = XML_TRUE; - p->hasParamEntityRefs = XML_FALSE; - p->standalone = XML_FALSE; -} - -static void -dtdDestroy(DTD *p, XML_Bool isDocEntity, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - hashTableIterInit(&iter, &(p->elementTypes)); - for (;;) { - ELEMENT_TYPE *e = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!e) - break; - if (e->allocDefaultAtts != 0) - ms->free_fcn(e->defaultAtts); - } - hashTableDestroy(&(p->generalEntities)); -#ifdef XML_DTD - hashTableDestroy(&(p->paramEntities)); -#endif /* XML_DTD */ - hashTableDestroy(&(p->elementTypes)); - hashTableDestroy(&(p->attributeIds)); - hashTableDestroy(&(p->prefixes)); - poolDestroy(&(p->pool)); - poolDestroy(&(p->entityValuePool)); - if (isDocEntity) { - ms->free_fcn(p->scaffIndex); - ms->free_fcn(p->scaffold); - } - ms->free_fcn(p); -} - -/* Do a deep copy of the DTD. Return 0 for out of memory, non-zero otherwise. - The new DTD has already been initialized. -*/ -static int -dtdCopy(XML_Parser oldParser, DTD *newDtd, const DTD *oldDtd, const XML_Memory_Handling_Suite *ms) -{ - HASH_TABLE_ITER iter; - - /* Copy the prefix table. */ - - hashTableIterInit(&iter, &(oldDtd->prefixes)); - for (;;) { - const XML_Char *name; - const PREFIX *oldP = (PREFIX *)hashTableIterNext(&iter); - if (!oldP) - break; - name = poolCopyString(&(newDtd->pool), oldP->name); - if (!name) - return 0; - if (!lookup(oldParser, &(newDtd->prefixes), name, sizeof(PREFIX))) - return 0; - } - - hashTableIterInit(&iter, &(oldDtd->attributeIds)); - - /* Copy the attribute id table. */ - - for (;;) { - ATTRIBUTE_ID *newA; - const XML_Char *name; - const ATTRIBUTE_ID *oldA = (ATTRIBUTE_ID *)hashTableIterNext(&iter); - - if (!oldA) - break; - /* Remember to allocate the scratch byte before the name. */ - if (!poolAppendChar(&(newDtd->pool), XML_T('\0'))) - return 0; - name = poolCopyString(&(newDtd->pool), oldA->name); - if (!name) - return 0; - ++name; - newA = (ATTRIBUTE_ID *)lookup(oldParser, &(newDtd->attributeIds), name, - sizeof(ATTRIBUTE_ID)); - if (!newA) - return 0; - newA->maybeTokenized = oldA->maybeTokenized; - if (oldA->prefix) { - newA->xmlns = oldA->xmlns; - if (oldA->prefix == &oldDtd->defaultPrefix) - newA->prefix = &newDtd->defaultPrefix; - else - newA->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), - oldA->prefix->name, 0); - } - } - - /* Copy the element type table. */ - - hashTableIterInit(&iter, &(oldDtd->elementTypes)); - - for (;;) { - int i; - ELEMENT_TYPE *newE; - const XML_Char *name; - const ELEMENT_TYPE *oldE = (ELEMENT_TYPE *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(&(newDtd->pool), oldE->name); - if (!name) - return 0; - newE = (ELEMENT_TYPE *)lookup(oldParser, &(newDtd->elementTypes), name, - sizeof(ELEMENT_TYPE)); - if (!newE) - return 0; - if (oldE->nDefaultAtts) { - newE->defaultAtts = (DEFAULT_ATTRIBUTE *) - ms->malloc_fcn(oldE->nDefaultAtts * sizeof(DEFAULT_ATTRIBUTE)); - if (!newE->defaultAtts) { - ms->free_fcn(newE); - return 0; - } - } - if (oldE->idAtt) - newE->idAtt = (ATTRIBUTE_ID *) - lookup(oldParser, &(newDtd->attributeIds), oldE->idAtt->name, 0); - newE->allocDefaultAtts = newE->nDefaultAtts = oldE->nDefaultAtts; - if (oldE->prefix) - newE->prefix = (PREFIX *)lookup(oldParser, &(newDtd->prefixes), - oldE->prefix->name, 0); - for (i = 0; i < newE->nDefaultAtts; i++) { - newE->defaultAtts[i].id = (ATTRIBUTE_ID *) - lookup(oldParser, &(newDtd->attributeIds), oldE->defaultAtts[i].id->name, 0); - newE->defaultAtts[i].isCdata = oldE->defaultAtts[i].isCdata; - if (oldE->defaultAtts[i].value) { - newE->defaultAtts[i].value - = poolCopyString(&(newDtd->pool), oldE->defaultAtts[i].value); - if (!newE->defaultAtts[i].value) - return 0; - } - else - newE->defaultAtts[i].value = NULL; - } - } - - /* Copy the entity tables. */ - if (!copyEntityTable(oldParser, - &(newDtd->generalEntities), - &(newDtd->pool), - &(oldDtd->generalEntities))) - return 0; - -#ifdef XML_DTD - if (!copyEntityTable(oldParser, - &(newDtd->paramEntities), - &(newDtd->pool), - &(oldDtd->paramEntities))) - return 0; - newDtd->paramEntityRead = oldDtd->paramEntityRead; -#endif /* XML_DTD */ - - newDtd->keepProcessing = oldDtd->keepProcessing; - newDtd->hasParamEntityRefs = oldDtd->hasParamEntityRefs; - newDtd->standalone = oldDtd->standalone; - - /* Don't want deep copying for scaffolding */ - newDtd->in_eldecl = oldDtd->in_eldecl; - newDtd->scaffold = oldDtd->scaffold; - newDtd->contentStringLen = oldDtd->contentStringLen; - newDtd->scaffSize = oldDtd->scaffSize; - newDtd->scaffLevel = oldDtd->scaffLevel; - newDtd->scaffIndex = oldDtd->scaffIndex; - - return 1; -} /* End dtdCopy */ - -static int -copyEntityTable(XML_Parser oldParser, - HASH_TABLE *newTable, - STRING_POOL *newPool, - const HASH_TABLE *oldTable) -{ - HASH_TABLE_ITER iter; - const XML_Char *cachedOldBase = NULL; - const XML_Char *cachedNewBase = NULL; - - hashTableIterInit(&iter, oldTable); - - for (;;) { - ENTITY *newE; - const XML_Char *name; - const ENTITY *oldE = (ENTITY *)hashTableIterNext(&iter); - if (!oldE) - break; - name = poolCopyString(newPool, oldE->name); - if (!name) - return 0; - newE = (ENTITY *)lookup(oldParser, newTable, name, sizeof(ENTITY)); - if (!newE) - return 0; - if (oldE->systemId) { - const XML_Char *tem = poolCopyString(newPool, oldE->systemId); - if (!tem) - return 0; - newE->systemId = tem; - if (oldE->base) { - if (oldE->base == cachedOldBase) - newE->base = cachedNewBase; - else { - cachedOldBase = oldE->base; - tem = poolCopyString(newPool, cachedOldBase); - if (!tem) - return 0; - cachedNewBase = newE->base = tem; - } - } - if (oldE->publicId) { - tem = poolCopyString(newPool, oldE->publicId); - if (!tem) - return 0; - newE->publicId = tem; - } - } - else { - const XML_Char *tem = poolCopyStringN(newPool, oldE->textPtr, - oldE->textLen); - if (!tem) - return 0; - newE->textPtr = tem; - newE->textLen = oldE->textLen; - } - if (oldE->notation) { - const XML_Char *tem = poolCopyString(newPool, oldE->notation); - if (!tem) - return 0; - newE->notation = tem; - } - newE->is_param = oldE->is_param; - newE->is_internal = oldE->is_internal; - } - return 1; -} - -#define INIT_POWER 6 - -static XML_Bool FASTCALL -keyeq(KEY s1, KEY s2) -{ - for (; *s1 == *s2; s1++, s2++) - if (*s1 == 0) - return XML_TRUE; - return XML_FALSE; -} - -static unsigned long FASTCALL -hash(XML_Parser parser, KEY s) -{ - unsigned long h = hash_secret_salt; - while (*s) - h = CHAR_HASH(h, *s++); - return h; -} - -static NAMED * -lookup(XML_Parser parser, HASH_TABLE *table, KEY name, size_t createSize) -{ - size_t i; - if (table->size == 0) { - size_t tsize; - if (!createSize) - return NULL; - table->power = INIT_POWER; - /* table->size is a power of 2 */ - table->size = (size_t)1 << INIT_POWER; - tsize = table->size * sizeof(NAMED *); - table->v = (NAMED **)table->mem->malloc_fcn(tsize); - if (!table->v) { - table->size = 0; - return NULL; - } - memset(table->v, 0, tsize); - i = hash(parser, name) & ((unsigned long)table->size - 1); - } - else { - unsigned long h = hash(parser, name); - unsigned long mask = (unsigned long)table->size - 1; - unsigned char step = 0; - i = h & mask; - while (table->v[i]) { - if (keyeq(name, table->v[i]->name)) - return table->v[i]; - if (!step) - step = PROBE_STEP(h, mask, table->power); - i < step ? (i += table->size - step) : (i -= step); - } - if (!createSize) - return NULL; - - /* check for overflow (table is half full) */ - if (table->used >> (table->power - 1)) { - unsigned char newPower = table->power + 1; - size_t newSize = (size_t)1 << newPower; - unsigned long newMask = (unsigned long)newSize - 1; - size_t tsize = newSize * sizeof(NAMED *); - NAMED **newV = (NAMED **)table->mem->malloc_fcn(tsize); - if (!newV) - return NULL; - memset(newV, 0, tsize); - for (i = 0; i < table->size; i++) - if (table->v[i]) { - unsigned long newHash = hash(parser, table->v[i]->name); - size_t j = newHash & newMask; - step = 0; - while (newV[j]) { - if (!step) - step = PROBE_STEP(newHash, newMask, newPower); - j < step ? (j += newSize - step) : (j -= step); - } - newV[j] = table->v[i]; - } - table->mem->free_fcn(table->v); - table->v = newV; - table->power = newPower; - table->size = newSize; - i = h & newMask; - step = 0; - while (table->v[i]) { - if (!step) - step = PROBE_STEP(h, newMask, newPower); - i < step ? (i += newSize - step) : (i -= step); - } - } - } - table->v[i] = (NAMED *)table->mem->malloc_fcn(createSize); - if (!table->v[i]) - return NULL; - memset(table->v[i], 0, createSize); - table->v[i]->name = name; - (table->used)++; - return table->v[i]; -} - -static void FASTCALL -hashTableClear(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) { - table->mem->free_fcn(table->v[i]); - table->v[i] = NULL; - } - table->used = 0; -} - -static void FASTCALL -hashTableDestroy(HASH_TABLE *table) -{ - size_t i; - for (i = 0; i < table->size; i++) - table->mem->free_fcn(table->v[i]); - table->mem->free_fcn(table->v); -} - -static void FASTCALL -hashTableInit(HASH_TABLE *p, const XML_Memory_Handling_Suite *ms) -{ - p->power = 0; - p->size = 0; - p->used = 0; - p->v = NULL; - p->mem = ms; -} - -static void FASTCALL -hashTableIterInit(HASH_TABLE_ITER *iter, const HASH_TABLE *table) -{ - iter->p = table->v; - iter->end = iter->p + table->size; -} - -static NAMED * FASTCALL -hashTableIterNext(HASH_TABLE_ITER *iter) -{ - while (iter->p != iter->end) { - NAMED *tem = *(iter->p)++; - if (tem) - return tem; - } - return NULL; -} - -static void FASTCALL -poolInit(STRING_POOL *pool, const XML_Memory_Handling_Suite *ms) -{ - pool->blocks = NULL; - pool->freeBlocks = NULL; - pool->start = NULL; - pool->ptr = NULL; - pool->end = NULL; - pool->mem = ms; -} - -static void FASTCALL -poolClear(STRING_POOL *pool) -{ - if (!pool->freeBlocks) - pool->freeBlocks = pool->blocks; - else { - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - p->next = pool->freeBlocks; - pool->freeBlocks = p; - p = tem; - } - } - pool->blocks = NULL; - pool->start = NULL; - pool->ptr = NULL; - pool->end = NULL; -} - -static void FASTCALL -poolDestroy(STRING_POOL *pool) -{ - BLOCK *p = pool->blocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } - p = pool->freeBlocks; - while (p) { - BLOCK *tem = p->next; - pool->mem->free_fcn(p); - p = tem; - } -} - -static XML_Char * -poolAppend(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; - for (;;) { - XmlConvert(enc, &ptr, end, (ICHAR **)&(pool->ptr), (ICHAR *)pool->end); - if (ptr == end) - break; - if (!poolGrow(pool)) - return NULL; - } - return pool->start; -} - -static const XML_Char * FASTCALL -poolCopyString(STRING_POOL *pool, const XML_Char *s) -{ - do { - if (!poolAppendChar(pool, *s)) - return NULL; - } while (*s++); - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char * -poolCopyStringN(STRING_POOL *pool, const XML_Char *s, int n) -{ - if (!pool->ptr && !poolGrow(pool)) - return NULL; - for (; n > 0; --n, s++) { - if (!poolAppendChar(pool, *s)) - return NULL; - } - s = pool->start; - poolFinish(pool); - return s; -} - -static const XML_Char * FASTCALL -poolAppendString(STRING_POOL *pool, const XML_Char *s) -{ - while (*s) { - if (!poolAppendChar(pool, *s)) - return NULL; - s++; - } - return pool->start; -} - -static XML_Char * -poolStoreString(STRING_POOL *pool, const ENCODING *enc, - const char *ptr, const char *end) -{ - if (!poolAppend(pool, enc, ptr, end)) - return NULL; - if (pool->ptr == pool->end && !poolGrow(pool)) - return NULL; - *(pool->ptr)++ = 0; - return pool->start; -} - -static XML_Bool FASTCALL -poolGrow(STRING_POOL *pool) -{ - if (pool->freeBlocks) { - if (pool->start == 0) { - pool->blocks = pool->freeBlocks; - pool->freeBlocks = pool->freeBlocks->next; - pool->blocks->next = NULL; - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - pool->ptr = pool->start; - return XML_TRUE; - } - if (pool->end - pool->start < pool->freeBlocks->size) { - BLOCK *tem = pool->freeBlocks->next; - pool->freeBlocks->next = pool->blocks; - pool->blocks = pool->freeBlocks; - pool->freeBlocks = tem; - memcpy(pool->blocks->s, pool->start, - (pool->end - pool->start) * sizeof(XML_Char)); - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + pool->blocks->size; - return XML_TRUE; - } - } - if (pool->blocks && pool->start == pool->blocks->s) { - int blockSize = (int)(pool->end - pool->start)*2; - BLOCK *temp = (BLOCK *) - pool->mem->realloc_fcn(pool->blocks, - (offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char))); - if (temp == NULL) - return XML_FALSE; - pool->blocks = temp; - pool->blocks->size = blockSize; - pool->ptr = pool->blocks->s + (pool->ptr - pool->start); - pool->start = pool->blocks->s; - pool->end = pool->start + blockSize; - } - else { - BLOCK *tem; - int blockSize = (int)(pool->end - pool->start); - if (blockSize < INIT_BLOCK_SIZE) - blockSize = INIT_BLOCK_SIZE; - else - blockSize *= 2; - tem = (BLOCK *)pool->mem->malloc_fcn(offsetof(BLOCK, s) - + blockSize * sizeof(XML_Char)); - if (!tem) - return XML_FALSE; - tem->size = blockSize; - tem->next = pool->blocks; - pool->blocks = tem; - if (pool->ptr != pool->start) - memcpy(tem->s, pool->start, - (pool->ptr - pool->start) * sizeof(XML_Char)); - pool->ptr = tem->s + (pool->ptr - pool->start); - pool->start = tem->s; - pool->end = tem->s + blockSize; - } - return XML_TRUE; -} - -static int FASTCALL -nextScaffoldPart(XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - CONTENT_SCAFFOLD * me; - int next; - - if (!dtd->scaffIndex) { - dtd->scaffIndex = (int *)MALLOC(groupSize * sizeof(int)); - if (!dtd->scaffIndex) - return -1; - dtd->scaffIndex[0] = 0; - } - - if (dtd->scaffCount >= dtd->scaffSize) { - CONTENT_SCAFFOLD *temp; - if (dtd->scaffold) { - temp = (CONTENT_SCAFFOLD *) - REALLOC(dtd->scaffold, dtd->scaffSize * 2 * sizeof(CONTENT_SCAFFOLD)); - if (temp == NULL) - return -1; - dtd->scaffSize *= 2; - } - else { - temp = (CONTENT_SCAFFOLD *)MALLOC(INIT_SCAFFOLD_ELEMENTS - * sizeof(CONTENT_SCAFFOLD)); - if (temp == NULL) - return -1; - dtd->scaffSize = INIT_SCAFFOLD_ELEMENTS; - } - dtd->scaffold = temp; - } - next = dtd->scaffCount++; - me = &dtd->scaffold[next]; - if (dtd->scaffLevel) { - CONTENT_SCAFFOLD *parent = &dtd->scaffold[dtd->scaffIndex[dtd->scaffLevel-1]]; - if (parent->lastchild) { - dtd->scaffold[parent->lastchild].nextsib = next; - } - if (!parent->childcnt) - parent->firstchild = next; - parent->lastchild = next; - parent->childcnt++; - } - me->firstchild = me->lastchild = me->childcnt = me->nextsib = 0; - return next; -} - -static void -build_node(XML_Parser parser, - int src_node, - XML_Content *dest, - XML_Content **contpos, - XML_Char **strpos) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - dest->type = dtd->scaffold[src_node].type; - dest->quant = dtd->scaffold[src_node].quant; - if (dest->type == XML_CTYPE_NAME) { - const XML_Char *src; - dest->name = *strpos; - src = dtd->scaffold[src_node].name; - for (;;) { - *(*strpos)++ = *src; - if (!*src) - break; - src++; - } - dest->numchildren = 0; - dest->children = NULL; - } - else { - unsigned int i; - int cn; - dest->numchildren = dtd->scaffold[src_node].childcnt; - dest->children = *contpos; - *contpos += dest->numchildren; - for (i = 0, cn = dtd->scaffold[src_node].firstchild; - i < dest->numchildren; - i++, cn = dtd->scaffold[cn].nextsib) { - build_node(parser, cn, &(dest->children[i]), contpos, strpos); - } - dest->name = NULL; - } -} - -static XML_Content * -build_model (XML_Parser parser) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - XML_Content *ret; - XML_Content *cpos; - XML_Char * str; - int allocsize = (dtd->scaffCount * sizeof(XML_Content) - + (dtd->contentStringLen * sizeof(XML_Char))); - - ret = (XML_Content *)MALLOC(allocsize); - if (!ret) - return NULL; - - str = (XML_Char *) (&ret[dtd->scaffCount]); - cpos = &ret[1]; - - build_node(parser, 0, ret, &cpos, &str); - return ret; -} - -static ELEMENT_TYPE * -getElementType(XML_Parser parser, - const ENCODING *enc, - const char *ptr, - const char *end) -{ - DTD * const dtd = _dtd; /* save one level of indirection */ - const XML_Char *name = poolStoreString(&dtd->pool, enc, ptr, end); - ELEMENT_TYPE *ret; - - if (!name) - return NULL; - ret = (ELEMENT_TYPE *) lookup(parser, &dtd->elementTypes, name, sizeof(ELEMENT_TYPE)); - if (!ret) - return NULL; - if (ret->name != name) - poolDiscard(&dtd->pool); - else { - poolFinish(&dtd->pool); - if (!setElementTypePrefix(parser, ret)) - return NULL; - } - return ret; -} diff --git a/external/mit/expat/dist/lib/xmlrole.c b/external/mit/expat/dist/lib/xmlrole.c deleted file mode 100755 index 44772e21d..000000000 --- a/external/mit/expat/dist/lib/xmlrole.c +++ /dev/null @@ -1,1336 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#else -#ifdef HAVE_EXPAT_CONFIG_H -#include -#endif -#endif /* ndef COMPILED_FROM_DSP */ - -#include "expat_external.h" -#include "internal.h" -#include "xmlrole.h" -#include "ascii.h" - -/* Doesn't check: - - that ,| are not mixed in a model group - content of literals - -*/ - -static const char KW_ANY[] = { - ASCII_A, ASCII_N, ASCII_Y, '\0' }; -static const char KW_ATTLIST[] = { - ASCII_A, ASCII_T, ASCII_T, ASCII_L, ASCII_I, ASCII_S, ASCII_T, '\0' }; -static const char KW_CDATA[] = { - ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_DOCTYPE[] = { - ASCII_D, ASCII_O, ASCII_C, ASCII_T, ASCII_Y, ASCII_P, ASCII_E, '\0' }; -static const char KW_ELEMENT[] = { - ASCII_E, ASCII_L, ASCII_E, ASCII_M, ASCII_E, ASCII_N, ASCII_T, '\0' }; -static const char KW_EMPTY[] = { - ASCII_E, ASCII_M, ASCII_P, ASCII_T, ASCII_Y, '\0' }; -static const char KW_ENTITIES[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_I, ASCII_E, ASCII_S, - '\0' }; -static const char KW_ENTITY[] = { - ASCII_E, ASCII_N, ASCII_T, ASCII_I, ASCII_T, ASCII_Y, '\0' }; -static const char KW_FIXED[] = { - ASCII_F, ASCII_I, ASCII_X, ASCII_E, ASCII_D, '\0' }; -static const char KW_ID[] = { - ASCII_I, ASCII_D, '\0' }; -static const char KW_IDREF[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, '\0' }; -static const char KW_IDREFS[] = { - ASCII_I, ASCII_D, ASCII_R, ASCII_E, ASCII_F, ASCII_S, '\0' }; -#ifdef XML_DTD -static const char KW_IGNORE[] = { - ASCII_I, ASCII_G, ASCII_N, ASCII_O, ASCII_R, ASCII_E, '\0' }; -#endif -static const char KW_IMPLIED[] = { - ASCII_I, ASCII_M, ASCII_P, ASCII_L, ASCII_I, ASCII_E, ASCII_D, '\0' }; -#ifdef XML_DTD -static const char KW_INCLUDE[] = { - ASCII_I, ASCII_N, ASCII_C, ASCII_L, ASCII_U, ASCII_D, ASCII_E, '\0' }; -#endif -static const char KW_NDATA[] = { - ASCII_N, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_NMTOKEN[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, '\0' }; -static const char KW_NMTOKENS[] = { - ASCII_N, ASCII_M, ASCII_T, ASCII_O, ASCII_K, ASCII_E, ASCII_N, ASCII_S, - '\0' }; -static const char KW_NOTATION[] = - { ASCII_N, ASCII_O, ASCII_T, ASCII_A, ASCII_T, ASCII_I, ASCII_O, ASCII_N, - '\0' }; -static const char KW_PCDATA[] = { - ASCII_P, ASCII_C, ASCII_D, ASCII_A, ASCII_T, ASCII_A, '\0' }; -static const char KW_PUBLIC[] = { - ASCII_P, ASCII_U, ASCII_B, ASCII_L, ASCII_I, ASCII_C, '\0' }; -static const char KW_REQUIRED[] = { - ASCII_R, ASCII_E, ASCII_Q, ASCII_U, ASCII_I, ASCII_R, ASCII_E, ASCII_D, - '\0' }; -static const char KW_SYSTEM[] = { - ASCII_S, ASCII_Y, ASCII_S, ASCII_T, ASCII_E, ASCII_M, '\0' }; - -#ifndef MIN_BYTES_PER_CHAR -#define MIN_BYTES_PER_CHAR(enc) ((enc)->minBytesPerChar) -#endif - -#ifdef XML_DTD -#define setTopLevel(state) \ - ((state)->handler = ((state)->documentEntity \ - ? internalSubset \ - : externalSubset1)) -#else /* not XML_DTD */ -#define setTopLevel(state) ((state)->handler = internalSubset) -#endif /* not XML_DTD */ - -typedef int PTRCALL PROLOG_HANDLER(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - -static PROLOG_HANDLER - prolog0, prolog1, prolog2, - doctype0, doctype1, doctype2, doctype3, doctype4, doctype5, - internalSubset, - entity0, entity1, entity2, entity3, entity4, entity5, entity6, - entity7, entity8, entity9, entity10, - notation0, notation1, notation2, notation3, notation4, - attlist0, attlist1, attlist2, attlist3, attlist4, attlist5, attlist6, - attlist7, attlist8, attlist9, - element0, element1, element2, element3, element4, element5, element6, - element7, -#ifdef XML_DTD - externalSubset0, externalSubset1, - condSect0, condSect1, condSect2, -#endif /* XML_DTD */ - declClose, - error; - -static int FASTCALL common(PROLOG_STATE *state, int tok); - -static int PTRCALL -prolog0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - state->handler = prolog1; - return XML_ROLE_NONE; - case XML_TOK_XML_DECL: - state->handler = prolog1; - return XML_ROLE_XML_DECL; - case XML_TOK_PI: - state->handler = prolog1; - return XML_ROLE_PI; - case XML_TOK_COMMENT: - state->handler = prolog1; - return XML_ROLE_COMMENT; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -prolog1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_BOM: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (!XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_DOCTYPE)) - break; - state->handler = doctype0; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -prolog2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_INSTANCE_START: - state->handler = error; - return XML_ROLE_INSTANCE_START; - } - return common(state, tok); -} - -static int PTRCALL -doctype0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = doctype1; - return XML_ROLE_DOCTYPE_NAME; - } - return common(state, tok); -} - -static int PTRCALL -doctype1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = doctype3; - return XML_ROLE_DOCTYPE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = doctype2; - return XML_ROLE_DOCTYPE_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -doctype2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype3; - return XML_ROLE_DOCTYPE_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -doctype3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_LITERAL: - state->handler = doctype4; - return XML_ROLE_DOCTYPE_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -doctype4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = internalSubset; - return XML_ROLE_DOCTYPE_INTERNAL_SUBSET; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static int PTRCALL -doctype5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_DECL_CLOSE: - state->handler = prolog2; - return XML_ROLE_DOCTYPE_CLOSE; - } - return common(state, tok); -} - -static int PTRCALL -internalSubset(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_DECL_OPEN: - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ENTITY)) { - state->handler = entity0; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ATTLIST)) { - state->handler = attlist0; - return XML_ROLE_ATTLIST_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_ELEMENT)) { - state->handler = element0; - return XML_ROLE_ELEMENT_NONE; - } - if (XmlNameMatchesAscii(enc, - ptr + 2 * MIN_BYTES_PER_CHAR(enc), - end, - KW_NOTATION)) { - state->handler = notation0; - return XML_ROLE_NOTATION_NONE; - } - break; - case XML_TOK_PI: - return XML_ROLE_PI; - case XML_TOK_COMMENT: - return XML_ROLE_COMMENT; - case XML_TOK_PARAM_ENTITY_REF: - return XML_ROLE_PARAM_ENTITY_REF; - case XML_TOK_CLOSE_BRACKET: - state->handler = doctype5; - return XML_ROLE_DOCTYPE_NONE; - case XML_TOK_NONE: - return XML_ROLE_NONE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static int PTRCALL -externalSubset0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - state->handler = externalSubset1; - if (tok == XML_TOK_XML_DECL) - return XML_ROLE_TEXT_DECL; - return externalSubset1(state, tok, ptr, end, enc); -} - -static int PTRCALL -externalSubset1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_COND_SECT_OPEN: - state->handler = condSect0; - return XML_ROLE_NONE; - case XML_TOK_COND_SECT_CLOSE: - if (state->includeLevel == 0) - break; - state->includeLevel -= 1; - return XML_ROLE_NONE; - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_CLOSE_BRACKET: - break; - case XML_TOK_NONE: - if (state->includeLevel) - break; - return XML_ROLE_NONE; - default: - return internalSubset(state, tok, ptr, end, enc); - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static int PTRCALL -entity0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_PERCENT: - state->handler = entity1; - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = entity2; - return XML_ROLE_GENERAL_ENTITY_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = entity7; - return XML_ROLE_PARAM_ENTITY_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity4; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity3; - return XML_ROLE_ENTITY_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -entity3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity4; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity5; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_NDATA)) { - state->handler = entity6; - return XML_ROLE_ENTITY_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -entity6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_NOTATION_NAME; - } - return common(state, tok); -} - -static int PTRCALL -entity7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = entity9; - return XML_ROLE_ENTITY_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = entity8; - return XML_ROLE_ENTITY_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_ENTITY_NONE; - return XML_ROLE_ENTITY_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -entity8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity9; - return XML_ROLE_ENTITY_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_LITERAL: - state->handler = entity10; - return XML_ROLE_ENTITY_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -entity10(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ENTITY_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ENTITY_COMPLETE; - } - return common(state, tok); -} - -static int PTRCALL -notation0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_NAME: - state->handler = notation1; - return XML_ROLE_NOTATION_NAME; - } - return common(state, tok); -} - -static int PTRCALL -notation1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_SYSTEM)) { - state->handler = notation3; - return XML_ROLE_NOTATION_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_PUBLIC)) { - state->handler = notation2; - return XML_ROLE_NOTATION_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -notation2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = notation4; - return XML_ROLE_NOTATION_PUBLIC_ID; - } - return common(state, tok); -} - -static int PTRCALL -notation3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_NOTATION_NONE; - return XML_ROLE_NOTATION_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -notation4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NOTATION_NONE; - case XML_TOK_LITERAL: - state->handler = declClose; - state->role_none = XML_ROLE_NOTATION_NONE; - return XML_ROLE_NOTATION_SYSTEM_ID; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_NOTATION_NO_SYSTEM_ID; - } - return common(state, tok); -} - -static int PTRCALL -attlist0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist1; - return XML_ROLE_ATTLIST_ELEMENT_NAME; - } - return common(state, tok); -} - -static int PTRCALL -attlist1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist2; - return XML_ROLE_ATTRIBUTE_NAME; - } - return common(state, tok); -} - -static int PTRCALL -attlist2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - { - static const char * const types[] = { - KW_CDATA, - KW_ID, - KW_IDREF, - KW_IDREFS, - KW_ENTITY, - KW_ENTITIES, - KW_NMTOKEN, - KW_NMTOKENS, - }; - int i; - for (i = 0; i < (int)(sizeof(types)/sizeof(types[0])); i++) - if (XmlNameMatchesAscii(enc, ptr, end, types[i])) { - state->handler = attlist8; - return XML_ROLE_ATTRIBUTE_TYPE_CDATA + i; - } - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_NOTATION)) { - state->handler = attlist5; - return XML_ROLE_ATTLIST_NONE; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = attlist3; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NMTOKEN: - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = attlist4; - return XML_ROLE_ATTRIBUTE_ENUM_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OR: - state->handler = attlist3; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OPEN_PAREN: - state->handler = attlist6; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -static int PTRCALL -attlist6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_NAME: - state->handler = attlist7; - return XML_ROLE_ATTRIBUTE_NOTATION_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = attlist8; - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_OR: - state->handler = attlist6; - return XML_ROLE_ATTLIST_NONE; - } - return common(state, tok); -} - -/* default value */ -static int PTRCALL -attlist8(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_IMPLIED)) { - state->handler = attlist1; - return XML_ROLE_IMPLIED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_REQUIRED)) { - state->handler = attlist1; - return XML_ROLE_REQUIRED_ATTRIBUTE_VALUE; - } - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_FIXED)) { - state->handler = attlist9; - return XML_ROLE_ATTLIST_NONE; - } - break; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_DEFAULT_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -attlist9(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ATTLIST_NONE; - case XML_TOK_LITERAL: - state->handler = attlist1; - return XML_ROLE_FIXED_ATTRIBUTE_VALUE; - } - return common(state, tok); -} - -static int PTRCALL -element0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element1; - return XML_ROLE_ELEMENT_NAME; - } - return common(state, tok); -} - -static int PTRCALL -element1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_EMPTY)) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_CONTENT_EMPTY; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_ANY)) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_CONTENT_ANY; - } - break; - case XML_TOK_OPEN_PAREN: - state->handler = element2; - state->level = 1; - return XML_ROLE_GROUP_OPEN; - } - return common(state, tok); -} - -static int PTRCALL -element2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_POUND_NAME: - if (XmlNameMatchesAscii(enc, - ptr + MIN_BYTES_PER_CHAR(enc), - end, - KW_PCDATA)) { - state->handler = element3; - return XML_ROLE_CONTENT_PCDATA; - } - break; - case XML_TOK_OPEN_PAREN: - state->level = 2; - state->handler = element6; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static int PTRCALL -element3(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_ELEMENT_NONE; - } - return common(state, tok); -} - -static int PTRCALL -element4(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element5; - return XML_ROLE_CONTENT_ELEMENT; - } - return common(state, tok); -} - -static int PTRCALL -element5(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_OR: - state->handler = element4; - return XML_ROLE_ELEMENT_NONE; - } - return common(state, tok); -} - -static int PTRCALL -element6(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_OPEN_PAREN: - state->level += 1; - return XML_ROLE_GROUP_OPEN; - case XML_TOK_NAME: - case XML_TOK_PREFIXED_NAME: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT; - case XML_TOK_NAME_QUESTION: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_OPT; - case XML_TOK_NAME_ASTERISK: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_REP; - case XML_TOK_NAME_PLUS: - state->handler = element7; - return XML_ROLE_CONTENT_ELEMENT_PLUS; - } - return common(state, tok); -} - -static int PTRCALL -element7(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_ELEMENT_NONE; - case XML_TOK_CLOSE_PAREN: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE; - case XML_TOK_CLOSE_PAREN_ASTERISK: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_REP; - case XML_TOK_CLOSE_PAREN_QUESTION: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_OPT; - case XML_TOK_CLOSE_PAREN_PLUS: - state->level -= 1; - if (state->level == 0) { - state->handler = declClose; - state->role_none = XML_ROLE_ELEMENT_NONE; - } - return XML_ROLE_GROUP_CLOSE_PLUS; - case XML_TOK_COMMA: - state->handler = element6; - return XML_ROLE_GROUP_SEQUENCE; - case XML_TOK_OR: - state->handler = element6; - return XML_ROLE_GROUP_CHOICE; - } - return common(state, tok); -} - -#ifdef XML_DTD - -static int PTRCALL -condSect0(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_NAME: - if (XmlNameMatchesAscii(enc, ptr, end, KW_INCLUDE)) { - state->handler = condSect1; - return XML_ROLE_NONE; - } - if (XmlNameMatchesAscii(enc, ptr, end, KW_IGNORE)) { - state->handler = condSect2; - return XML_ROLE_NONE; - } - break; - } - return common(state, tok); -} - -static int PTRCALL -condSect1(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - state->includeLevel += 1; - return XML_ROLE_NONE; - } - return common(state, tok); -} - -static int PTRCALL -condSect2(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return XML_ROLE_NONE; - case XML_TOK_OPEN_BRACKET: - state->handler = externalSubset1; - return XML_ROLE_IGNORE_SECT; - } - return common(state, tok); -} - -#endif /* XML_DTD */ - -static int PTRCALL -declClose(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - switch (tok) { - case XML_TOK_PROLOG_S: - return state->role_none; - case XML_TOK_DECL_CLOSE: - setTopLevel(state); - return state->role_none; - } - return common(state, tok); -} - -static int PTRCALL -error(PROLOG_STATE *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc) -{ - return XML_ROLE_NONE; -} - -static int FASTCALL -common(PROLOG_STATE *state, int tok) -{ -#ifdef XML_DTD - if (!state->documentEntity && tok == XML_TOK_PARAM_ENTITY_REF) - return XML_ROLE_INNER_PARAM_ENTITY_REF; -#endif - state->handler = error; - return XML_ROLE_ERROR; -} - -void -XmlPrologStateInit(PROLOG_STATE *state) -{ - state->handler = prolog0; -#ifdef XML_DTD - state->documentEntity = 1; - state->includeLevel = 0; - state->inEntityValue = 0; -#endif /* XML_DTD */ -} - -#ifdef XML_DTD - -void -XmlPrologStateInitExternalEntity(PROLOG_STATE *state) -{ - state->handler = externalSubset0; - state->documentEntity = 0; - state->includeLevel = 0; -} - -#endif /* XML_DTD */ diff --git a/external/mit/expat/dist/lib/xmlrole.h b/external/mit/expat/dist/lib/xmlrole.h deleted file mode 100755 index 4dd9f06f9..000000000 --- a/external/mit/expat/dist/lib/xmlrole.h +++ /dev/null @@ -1,114 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlRole_INCLUDED -#define XmlRole_INCLUDED 1 - -#ifdef __VMS -/* 0 1 2 3 0 1 2 3 - 1234567890123456789012345678901 1234567890123456789012345678901 */ -#define XmlPrologStateInitExternalEntity XmlPrologStateInitExternalEnt -#endif - -#include "xmltok.h" - -#ifdef __cplusplus -extern "C" { -#endif - -enum { - XML_ROLE_ERROR = -1, - XML_ROLE_NONE = 0, - XML_ROLE_XML_DECL, - XML_ROLE_INSTANCE_START, - XML_ROLE_DOCTYPE_NONE, - XML_ROLE_DOCTYPE_NAME, - XML_ROLE_DOCTYPE_SYSTEM_ID, - XML_ROLE_DOCTYPE_PUBLIC_ID, - XML_ROLE_DOCTYPE_INTERNAL_SUBSET, - XML_ROLE_DOCTYPE_CLOSE, - XML_ROLE_GENERAL_ENTITY_NAME, - XML_ROLE_PARAM_ENTITY_NAME, - XML_ROLE_ENTITY_NONE, - XML_ROLE_ENTITY_VALUE, - XML_ROLE_ENTITY_SYSTEM_ID, - XML_ROLE_ENTITY_PUBLIC_ID, - XML_ROLE_ENTITY_COMPLETE, - XML_ROLE_ENTITY_NOTATION_NAME, - XML_ROLE_NOTATION_NONE, - XML_ROLE_NOTATION_NAME, - XML_ROLE_NOTATION_SYSTEM_ID, - XML_ROLE_NOTATION_NO_SYSTEM_ID, - XML_ROLE_NOTATION_PUBLIC_ID, - XML_ROLE_ATTRIBUTE_NAME, - XML_ROLE_ATTRIBUTE_TYPE_CDATA, - XML_ROLE_ATTRIBUTE_TYPE_ID, - XML_ROLE_ATTRIBUTE_TYPE_IDREF, - XML_ROLE_ATTRIBUTE_TYPE_IDREFS, - XML_ROLE_ATTRIBUTE_TYPE_ENTITY, - XML_ROLE_ATTRIBUTE_TYPE_ENTITIES, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN, - XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS, - XML_ROLE_ATTRIBUTE_ENUM_VALUE, - XML_ROLE_ATTRIBUTE_NOTATION_VALUE, - XML_ROLE_ATTLIST_NONE, - XML_ROLE_ATTLIST_ELEMENT_NAME, - XML_ROLE_IMPLIED_ATTRIBUTE_VALUE, - XML_ROLE_REQUIRED_ATTRIBUTE_VALUE, - XML_ROLE_DEFAULT_ATTRIBUTE_VALUE, - XML_ROLE_FIXED_ATTRIBUTE_VALUE, - XML_ROLE_ELEMENT_NONE, - XML_ROLE_ELEMENT_NAME, - XML_ROLE_CONTENT_ANY, - XML_ROLE_CONTENT_EMPTY, - XML_ROLE_CONTENT_PCDATA, - XML_ROLE_GROUP_OPEN, - XML_ROLE_GROUP_CLOSE, - XML_ROLE_GROUP_CLOSE_REP, - XML_ROLE_GROUP_CLOSE_OPT, - XML_ROLE_GROUP_CLOSE_PLUS, - XML_ROLE_GROUP_CHOICE, - XML_ROLE_GROUP_SEQUENCE, - XML_ROLE_CONTENT_ELEMENT, - XML_ROLE_CONTENT_ELEMENT_REP, - XML_ROLE_CONTENT_ELEMENT_OPT, - XML_ROLE_CONTENT_ELEMENT_PLUS, - XML_ROLE_PI, - XML_ROLE_COMMENT, -#ifdef XML_DTD - XML_ROLE_TEXT_DECL, - XML_ROLE_IGNORE_SECT, - XML_ROLE_INNER_PARAM_ENTITY_REF, -#endif /* XML_DTD */ - XML_ROLE_PARAM_ENTITY_REF -}; - -typedef struct prolog_state { - int (PTRCALL *handler) (struct prolog_state *state, - int tok, - const char *ptr, - const char *end, - const ENCODING *enc); - unsigned level; - int role_none; -#ifdef XML_DTD - unsigned includeLevel; - int documentEntity; - int inEntityValue; -#endif /* XML_DTD */ -} PROLOG_STATE; - -void XmlPrologStateInit(PROLOG_STATE *); -#ifdef XML_DTD -void XmlPrologStateInitExternalEntity(PROLOG_STATE *); -#endif /* XML_DTD */ - -#define XmlTokenRole(state, tok, ptr, end, enc) \ - (((state)->handler)(state, tok, ptr, end, enc)) - -#ifdef __cplusplus -} -#endif - -#endif /* not XmlRole_INCLUDED */ diff --git a/external/mit/expat/dist/lib/xmltok.c b/external/mit/expat/dist/lib/xmltok.c deleted file mode 100755 index bf09dfc72..000000000 --- a/external/mit/expat/dist/lib/xmltok.c +++ /dev/null @@ -1,1651 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#else -#ifdef HAVE_EXPAT_CONFIG_H -#include -#endif -#endif /* ndef COMPILED_FROM_DSP */ - -#include "expat_external.h" -#include "internal.h" -#include "xmltok.h" -#include "nametab.h" - -#ifdef XML_DTD -#define IGNORE_SECTION_TOK_VTABLE , PREFIX(ignoreSectionTok) -#else -#define IGNORE_SECTION_TOK_VTABLE /* as nothing */ -#endif - -#define VTABLE1 \ - { PREFIX(prologTok), PREFIX(contentTok), \ - PREFIX(cdataSectionTok) IGNORE_SECTION_TOK_VTABLE }, \ - { PREFIX(attributeValueTok), PREFIX(entityValueTok) }, \ - PREFIX(sameName), \ - PREFIX(nameMatchesAscii), \ - PREFIX(nameLength), \ - PREFIX(skipS), \ - PREFIX(getAtts), \ - PREFIX(charRefNumber), \ - PREFIX(predefinedEntityName), \ - PREFIX(updatePosition), \ - PREFIX(isPublicId) - -#define VTABLE VTABLE1, PREFIX(toUtf8), PREFIX(toUtf16) - -#define UCS2_GET_NAMING(pages, hi, lo) \ - (namingBitmap[(pages[hi] << 3) + ((lo) >> 5)] & (1 << ((lo) & 0x1F))) - -/* A 2 byte UTF-8 representation splits the characters 11 bits between - the bottom 5 and 6 bits of the bytes. We need 8 bits to index into - pages, 3 bits to add to that index and 5 bits to generate the mask. -*/ -#define UTF8_GET_NAMING2(pages, byte) \ - (namingBitmap[((pages)[(((byte)[0]) >> 2) & 7] << 3) \ - + ((((byte)[0]) & 3) << 1) \ - + ((((byte)[1]) >> 5) & 1)] \ - & (1 << (((byte)[1]) & 0x1F))) - -/* A 3 byte UTF-8 representation splits the characters 16 bits between - the bottom 4, 6 and 6 bits of the bytes. We need 8 bits to index - into pages, 3 bits to add to that index and 5 bits to generate the - mask. -*/ -#define UTF8_GET_NAMING3(pages, byte) \ - (namingBitmap[((pages)[((((byte)[0]) & 0xF) << 4) \ - + ((((byte)[1]) >> 2) & 0xF)] \ - << 3) \ - + ((((byte)[1]) & 3) << 1) \ - + ((((byte)[2]) >> 5) & 1)] \ - & (1 << (((byte)[2]) & 0x1F))) - -#define UTF8_GET_NAMING(pages, p, n) \ - ((n) == 2 \ - ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \ - : ((n) == 3 \ - ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \ - : 0)) - -/* Detection of invalid UTF-8 sequences is based on Table 3.1B - of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/ - with the additional restriction of not allowing the Unicode - code points 0xFFFF and 0xFFFE (sequences EF,BF,BF and EF,BF,BE). - Implementation details: - (A & 0x80) == 0 means A < 0x80 - and - (A & 0xC0) == 0xC0 means A > 0xBF -*/ - -#define UTF8_INVALID2(p) \ - ((*p) < 0xC2 || ((p)[1] & 0x80) == 0 || ((p)[1] & 0xC0) == 0xC0) - -#define UTF8_INVALID3(p) \ - (((p)[2] & 0x80) == 0 \ - || \ - ((*p) == 0xEF && (p)[1] == 0xBF \ - ? \ - (p)[2] > 0xBD \ - : \ - ((p)[2] & 0xC0) == 0xC0) \ - || \ - ((*p) == 0xE0 \ - ? \ - (p)[1] < 0xA0 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xED ? (p)[1] > 0x9F : ((p)[1] & 0xC0) == 0xC0))) - -#define UTF8_INVALID4(p) \ - (((p)[3] & 0x80) == 0 || ((p)[3] & 0xC0) == 0xC0 \ - || \ - ((p)[2] & 0x80) == 0 || ((p)[2] & 0xC0) == 0xC0 \ - || \ - ((*p) == 0xF0 \ - ? \ - (p)[1] < 0x90 || ((p)[1] & 0xC0) == 0xC0 \ - : \ - ((p)[1] & 0x80) == 0 \ - || \ - ((*p) == 0xF4 ? (p)[1] > 0x8F : ((p)[1] & 0xC0) == 0xC0))) - -static int PTRFASTCALL -isNever(const ENCODING *enc, const char *p) -{ - return 0; -} - -static int PTRFASTCALL -utf8_isName2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(namePages, (const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isName3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(namePages, (const unsigned char *)p); -} - -#define utf8_isName4 isNever - -static int PTRFASTCALL -utf8_isNmstrt2(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING2(nmstrtPages, (const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isNmstrt3(const ENCODING *enc, const char *p) -{ - return UTF8_GET_NAMING3(nmstrtPages, (const unsigned char *)p); -} - -#define utf8_isNmstrt4 isNever - -static int PTRFASTCALL -utf8_isInvalid2(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID2((const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isInvalid3(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID3((const unsigned char *)p); -} - -static int PTRFASTCALL -utf8_isInvalid4(const ENCODING *enc, const char *p) -{ - return UTF8_INVALID4((const unsigned char *)p); -} - -struct normal_encoding { - ENCODING enc; - unsigned char type[256]; -#ifdef XML_MIN_SIZE - int (PTRFASTCALL *byteType)(const ENCODING *, const char *); - int (PTRFASTCALL *isNameMin)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrtMin)(const ENCODING *, const char *); - int (PTRFASTCALL *byteToAscii)(const ENCODING *, const char *); - int (PTRCALL *charMatches)(const ENCODING *, const char *, int); -#endif /* XML_MIN_SIZE */ - int (PTRFASTCALL *isName2)(const ENCODING *, const char *); - int (PTRFASTCALL *isName3)(const ENCODING *, const char *); - int (PTRFASTCALL *isName4)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt2)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt3)(const ENCODING *, const char *); - int (PTRFASTCALL *isNmstrt4)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid2)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid3)(const ENCODING *, const char *); - int (PTRFASTCALL *isInvalid4)(const ENCODING *, const char *); -}; - -#define AS_NORMAL_ENCODING(enc) ((const struct normal_encoding *) (enc)) - -#ifdef XML_MIN_SIZE - -#define STANDARD_VTABLE(E) \ - E ## byteType, \ - E ## isNameMin, \ - E ## isNmstrtMin, \ - E ## byteToAscii, \ - E ## charMatches, - -#else - -#define STANDARD_VTABLE(E) /* as nothing */ - -#endif - -#define NORMAL_VTABLE(E) \ - E ## isName2, \ - E ## isName3, \ - E ## isName4, \ - E ## isNmstrt2, \ - E ## isNmstrt3, \ - E ## isNmstrt4, \ - E ## isInvalid2, \ - E ## isInvalid3, \ - E ## isInvalid4 - -static int FASTCALL checkCharRefNumber(int); - -#include "xmltok_impl.h" -#include "ascii.h" - -#ifdef XML_MIN_SIZE -#define sb_isNameMin isNever -#define sb_isNmstrtMin isNever -#endif - -#ifdef XML_MIN_SIZE -#define MINBPC(enc) ((enc)->minBytesPerChar) -#else -/* minimum bytes per character */ -#define MINBPC(enc) 1 -#endif - -#define SB_BYTE_TYPE(enc, p) \ - (((struct normal_encoding *)(enc))->type[(unsigned char)*(p)]) - -#ifdef XML_MIN_SIZE -static int PTRFASTCALL -sb_byteType(const ENCODING *enc, const char *p) -{ - return SB_BYTE_TYPE(enc, p); -} -#define BYTE_TYPE(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteType(enc, p)) -#else -#define BYTE_TYPE(enc, p) SB_BYTE_TYPE(enc, p) -#endif - -#ifdef XML_MIN_SIZE -#define BYTE_TO_ASCII(enc, p) \ - (AS_NORMAL_ENCODING(enc)->byteToAscii(enc, p)) -static int PTRFASTCALL -sb_byteToAscii(const ENCODING *enc, const char *p) -{ - return *p; -} -#else -#define BYTE_TO_ASCII(enc, p) (*(p)) -#endif - -#define IS_NAME_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isName ## n(enc, p)) -#define IS_NMSTRT_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isNmstrt ## n(enc, p)) -#define IS_INVALID_CHAR(enc, p, n) \ - (AS_NORMAL_ENCODING(enc)->isInvalid ## n(enc, p)) - -#ifdef XML_MIN_SIZE -#define IS_NAME_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNameMin(enc, p)) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) \ - (AS_NORMAL_ENCODING(enc)->isNmstrtMin(enc, p)) -#else -#define IS_NAME_CHAR_MINBPC(enc, p) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) (0) -#endif - -#ifdef XML_MIN_SIZE -#define CHAR_MATCHES(enc, p, c) \ - (AS_NORMAL_ENCODING(enc)->charMatches(enc, p, c)) -static int PTRCALL -sb_charMatches(const ENCODING *enc, const char *p, int c) -{ - return *p == c; -} -#else -/* c is an ASCII character */ -#define CHAR_MATCHES(enc, p, c) (*(p) == c) -#endif - -#define PREFIX(ident) normal_ ## ident -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -enum { /* UTF8_cvalN is value of masked first byte of N byte sequence */ - UTF8_cval1 = 0x00, - UTF8_cval2 = 0xc0, - UTF8_cval3 = 0xe0, - UTF8_cval4 = 0xf0 -}; - -static void PTRCALL -utf8_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - char *to; - const char *from; - if (fromLim - *fromP > toLim - *toP) { - /* Avoid copying partial characters. */ - for (fromLim = *fromP + (toLim - *toP); fromLim > *fromP; fromLim--) - if (((unsigned char)fromLim[-1] & 0xc0) != 0x80) - break; - } - for (to = *toP, from = *fromP; from != fromLim; from++, to++) - *to = *from; - *fromP = from; - *toP = to; -} - -static void PTRCALL -utf8_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - unsigned short *to = *toP; - const char *from = *fromP; - while (from != fromLim && to != toLim) { - switch (((struct normal_encoding *)enc)->type[(unsigned char)*from]) { - case BT_LEAD2: - *to++ = (unsigned short)(((from[0] & 0x1f) << 6) | (from[1] & 0x3f)); - from += 2; - break; - case BT_LEAD3: - *to++ = (unsigned short)(((from[0] & 0xf) << 12) - | ((from[1] & 0x3f) << 6) | (from[2] & 0x3f)); - from += 3; - break; - case BT_LEAD4: - { - unsigned long n; - if (to + 1 == toLim) - goto after; - n = ((from[0] & 0x7) << 18) | ((from[1] & 0x3f) << 12) - | ((from[2] & 0x3f) << 6) | (from[3] & 0x3f); - n -= 0x10000; - to[0] = (unsigned short)((n >> 10) | 0xD800); - to[1] = (unsigned short)((n & 0x3FF) | 0xDC00); - to += 2; - from += 4; - } - break; - default: - *to++ = *from++; - break; - } - } -after: - *fromP = from; - *toP = to; -} - -#ifdef XML_NS -static const struct normal_encoding utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; -#endif - -static const struct normal_encoding utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#ifdef XML_NS - -static const struct normal_encoding internal_utf8_encoding_ns = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#include "iasciitab.h" -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -#endif - -static const struct normal_encoding internal_utf8_encoding = { - { VTABLE1, utf8_toUtf8, utf8_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "utf8tab.h" - }, - STANDARD_VTABLE(sb_) NORMAL_VTABLE(utf8_) -}; - -static void PTRCALL -latin1_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - for (;;) { - unsigned char c; - if (*fromP == fromLim) - break; - c = (unsigned char)**fromP; - if (c & 0x80) { - if (toLim - *toP < 2) - break; - *(*toP)++ = (char)((c >> 6) | UTF8_cval2); - *(*toP)++ = (char)((c & 0x3f) | 0x80); - (*fromP)++; - } - else { - if (*toP == toLim) - break; - *(*toP)++ = *(*fromP)++; - } - } -} - -static void PTRCALL -latin1_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = (unsigned char)*(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding latin1_encoding_ns = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding latin1_encoding = { - { VTABLE1, latin1_toUtf8, latin1_toUtf16, 1, 0, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(sb_) -}; - -static void PTRCALL -ascii_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - while (*fromP != fromLim && *toP != toLim) - *(*toP)++ = *(*fromP)++; -} - -#ifdef XML_NS - -static const struct normal_encoding ascii_encoding_ns = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#include "asciitab.h" -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -#endif - -static const struct normal_encoding ascii_encoding = { - { VTABLE1, ascii_toUtf8, latin1_toUtf16, 1, 1, 0 }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -/* BT_NONXML == 0 */ - }, - STANDARD_VTABLE(sb_) -}; - -static int PTRFASTCALL -unicode_byte_type(char hi, char lo) -{ - switch ((unsigned char)hi) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - return BT_LEAD4; - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return BT_TRAIL; - case 0xFF: - switch ((unsigned char)lo) { - case 0xFF: - case 0xFE: - return BT_NONXML; - } - break; - } - return BT_NONASCII; -} - -#define DEFINE_UTF16_TO_UTF8(E) \ -static void PTRCALL \ -E ## toUtf8(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - char **toP, const char *toLim) \ -{ \ - const char *from; \ - for (from = *fromP; from != fromLim; from += 2) { \ - int plane; \ - unsigned char lo2; \ - unsigned char lo = GET_LO(from); \ - unsigned char hi = GET_HI(from); \ - switch (hi) { \ - case 0: \ - if (lo < 0x80) { \ - if (*toP == toLim) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = lo; \ - break; \ - } \ - /* fall through */ \ - case 0x1: case 0x2: case 0x3: \ - case 0x4: case 0x5: case 0x6: case 0x7: \ - if (toLim - *toP < 2) { \ - *fromP = from; \ - return; \ - } \ - *(*toP)++ = ((lo >> 6) | (hi << 2) | UTF8_cval2); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - default: \ - if (toLim - *toP < 3) { \ - *fromP = from; \ - return; \ - } \ - /* 16 bits divided 4, 6, 6 amongst 3 bytes */ \ - *(*toP)++ = ((hi >> 4) | UTF8_cval3); \ - *(*toP)++ = (((hi & 0xf) << 2) | (lo >> 6) | 0x80); \ - *(*toP)++ = ((lo & 0x3f) | 0x80); \ - break; \ - case 0xD8: case 0xD9: case 0xDA: case 0xDB: \ - if (toLim - *toP < 4) { \ - *fromP = from; \ - return; \ - } \ - plane = (((hi & 0x3) << 2) | ((lo >> 6) & 0x3)) + 1; \ - *(*toP)++ = ((plane >> 2) | UTF8_cval4); \ - *(*toP)++ = (((lo >> 2) & 0xF) | ((plane & 0x3) << 4) | 0x80); \ - from += 2; \ - lo2 = GET_LO(from); \ - *(*toP)++ = (((lo & 0x3) << 4) \ - | ((GET_HI(from) & 0x3) << 2) \ - | (lo2 >> 6) \ - | 0x80); \ - *(*toP)++ = ((lo2 & 0x3f) | 0x80); \ - break; \ - } \ - } \ - *fromP = from; \ -} - -#define DEFINE_UTF16_TO_UTF16(E) \ -static void PTRCALL \ -E ## toUtf16(const ENCODING *enc, \ - const char **fromP, const char *fromLim, \ - unsigned short **toP, const unsigned short *toLim) \ -{ \ - /* Avoid copying first half only of surrogate */ \ - if (fromLim - *fromP > ((toLim - *toP) << 1) \ - && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) \ - fromLim -= 2; \ - for (; *fromP != fromLim && *toP != toLim; *fromP += 2) \ - *(*toP)++ = (GET_HI(*fromP) << 8) | GET_LO(*fromP); \ -} - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) & 0xff)), ((ptr)[1] = ((ch) >> 8))) -#define GET_LO(ptr) ((unsigned char)(ptr)[0]) -#define GET_HI(ptr) ((unsigned char)(ptr)[1]) - -DEFINE_UTF16_TO_UTF8(little2_) -DEFINE_UTF16_TO_UTF16(little2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define SET2(ptr, ch) \ - (((ptr)[0] = ((ch) >> 8)), ((ptr)[1] = ((ch) & 0xFF))) -#define GET_LO(ptr) ((unsigned char)(ptr)[1]) -#define GET_HI(ptr) ((unsigned char)(ptr)[0]) - -DEFINE_UTF16_TO_UTF8(big2_) -DEFINE_UTF16_TO_UTF16(big2_) - -#undef SET2 -#undef GET_LO -#undef GET_HI - -#define LITTLE2_BYTE_TYPE(enc, p) \ - ((p)[1] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)*(p)] \ - : unicode_byte_type((p)[1], (p)[0])) -#define LITTLE2_BYTE_TO_ASCII(enc, p) ((p)[1] == 0 ? (p)[0] : -1) -#define LITTLE2_CHAR_MATCHES(enc, p, c) ((p)[1] == 0 && (p)[0] == c) -#define LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[1], (unsigned char)p[0]) -#define LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[1], (unsigned char)p[0]) - -#ifdef XML_MIN_SIZE - -static int PTRFASTCALL -little2_byteType(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TYPE(enc, p); -} - -static int PTRFASTCALL -little2_byteToAscii(const ENCODING *enc, const char *p) -{ - return LITTLE2_BYTE_TO_ASCII(enc, p); -} - -static int PTRCALL -little2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return LITTLE2_CHAR_MATCHES(enc, p, c); -} - -static int PTRFASTCALL -little2_isNameMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static int PTRFASTCALL -little2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, little2_toUtf8, little2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) little2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) LITTLE2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) LITTLE2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) LITTLE2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) LITTLE2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) LITTLE2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding little2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding little2_encoding = { - { VTABLE, 2, 0, -#if BYTEORDER == 1234 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#if BYTEORDER != 4321 - -#ifdef XML_NS - -static const struct normal_encoding internal_little2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - -static const struct normal_encoding internal_little2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(little2_) -}; - -#endif - - -#define BIG2_BYTE_TYPE(enc, p) \ - ((p)[0] == 0 \ - ? ((struct normal_encoding *)(enc))->type[(unsigned char)(p)[1]] \ - : unicode_byte_type((p)[0], (p)[1])) -#define BIG2_BYTE_TO_ASCII(enc, p) ((p)[0] == 0 ? (p)[1] : -1) -#define BIG2_CHAR_MATCHES(enc, p, c) ((p)[0] == 0 && (p)[1] == c) -#define BIG2_IS_NAME_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(namePages, (unsigned char)p[0], (unsigned char)p[1]) -#define BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) \ - UCS2_GET_NAMING(nmstrtPages, (unsigned char)p[0], (unsigned char)p[1]) - -#ifdef XML_MIN_SIZE - -static int PTRFASTCALL -big2_byteType(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TYPE(enc, p); -} - -static int PTRFASTCALL -big2_byteToAscii(const ENCODING *enc, const char *p) -{ - return BIG2_BYTE_TO_ASCII(enc, p); -} - -static int PTRCALL -big2_charMatches(const ENCODING *enc, const char *p, int c) -{ - return BIG2_CHAR_MATCHES(enc, p, c); -} - -static int PTRFASTCALL -big2_isNameMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NAME_CHAR_MINBPC(enc, p); -} - -static int PTRFASTCALL -big2_isNmstrtMin(const ENCODING *enc, const char *p) -{ - return BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p); -} - -#undef VTABLE -#define VTABLE VTABLE1, big2_toUtf8, big2_toUtf16 - -#else /* not XML_MIN_SIZE */ - -#undef PREFIX -#define PREFIX(ident) big2_ ## ident -#define MINBPC(enc) 2 -/* CHAR_MATCHES is guaranteed to have MINBPC bytes available. */ -#define BYTE_TYPE(enc, p) BIG2_BYTE_TYPE(enc, p) -#define BYTE_TO_ASCII(enc, p) BIG2_BYTE_TO_ASCII(enc, p) -#define CHAR_MATCHES(enc, p, c) BIG2_CHAR_MATCHES(enc, p, c) -#define IS_NAME_CHAR(enc, p, n) 0 -#define IS_NAME_CHAR_MINBPC(enc, p) BIG2_IS_NAME_CHAR_MINBPC(enc, p) -#define IS_NMSTRT_CHAR(enc, p, n) (0) -#define IS_NMSTRT_CHAR_MINBPC(enc, p) BIG2_IS_NMSTRT_CHAR_MINBPC(enc, p) - -#define XML_TOK_IMPL_C -#include "xmltok_impl.c" -#undef XML_TOK_IMPL_C - -#undef MINBPC -#undef BYTE_TYPE -#undef BYTE_TO_ASCII -#undef CHAR_MATCHES -#undef IS_NAME_CHAR -#undef IS_NAME_CHAR_MINBPC -#undef IS_NMSTRT_CHAR -#undef IS_NMSTRT_CHAR_MINBPC -#undef IS_INVALID_CHAR - -#endif /* not XML_MIN_SIZE */ - -#ifdef XML_NS - -static const struct normal_encoding big2_encoding_ns = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#include "asciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding big2_encoding = { - { VTABLE, 2, 0, -#if BYTEORDER == 4321 - 1 -#else - 0 -#endif - }, - { -#define BT_COLON BT_NMSTRT -#include "asciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#if BYTEORDER != 1234 - -#ifdef XML_NS - -static const struct normal_encoding internal_big2_encoding_ns = { - { VTABLE, 2, 0, 1 }, - { -#include "iasciitab.h" -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -static const struct normal_encoding internal_big2_encoding = { - { VTABLE, 2, 0, 1 }, - { -#define BT_COLON BT_NMSTRT -#include "iasciitab.h" -#undef BT_COLON -#include "latin1tab.h" - }, - STANDARD_VTABLE(big2_) -}; - -#endif - -#undef PREFIX - -static int FASTCALL -streqci(const char *s1, const char *s2) -{ - for (;;) { - char c1 = *s1++; - char c2 = *s2++; - if (ASCII_a <= c1 && c1 <= ASCII_z) - c1 += ASCII_A - ASCII_a; - if (ASCII_a <= c2 && c2 <= ASCII_z) - c2 += ASCII_A - ASCII_a; - if (c1 != c2) - return 0; - if (!c1) - break; - } - return 1; -} - -static void PTRCALL -initUpdatePosition(const ENCODING *enc, const char *ptr, - const char *end, POSITION *pos) -{ - normal_updatePosition(&utf8_encoding.enc, ptr, end, pos); -} - -static int -toAscii(const ENCODING *enc, const char *ptr, const char *end) -{ - char buf[1]; - char *p = buf; - XmlUtf8Convert(enc, &ptr, end, &p, p + 1); - if (p == buf) - return -1; - else - return buf[0]; -} - -static int FASTCALL -isSpace(int c) -{ - switch (c) { - case 0x20: - case 0xD: - case 0xA: - case 0x9: - return 1; - } - return 0; -} - -/* Return 1 if there's just optional white space or there's an S - followed by name=val. -*/ -static int -parsePseudoAttribute(const ENCODING *enc, - const char *ptr, - const char *end, - const char **namePtr, - const char **nameEndPtr, - const char **valPtr, - const char **nextTokPtr) -{ - int c; - char open; - if (ptr == end) { - *namePtr = NULL; - return 1; - } - if (!isSpace(toAscii(enc, ptr, end))) { - *nextTokPtr = ptr; - return 0; - } - do { - ptr += enc->minBytesPerChar; - } while (isSpace(toAscii(enc, ptr, end))); - if (ptr == end) { - *namePtr = NULL; - return 1; - } - *namePtr = ptr; - for (;;) { - c = toAscii(enc, ptr, end); - if (c == -1) { - *nextTokPtr = ptr; - return 0; - } - if (c == ASCII_EQUALS) { - *nameEndPtr = ptr; - break; - } - if (isSpace(c)) { - *nameEndPtr = ptr; - do { - ptr += enc->minBytesPerChar; - } while (isSpace(c = toAscii(enc, ptr, end))); - if (c != ASCII_EQUALS) { - *nextTokPtr = ptr; - return 0; - } - break; - } - ptr += enc->minBytesPerChar; - } - if (ptr == *namePtr) { - *nextTokPtr = ptr; - return 0; - } - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - while (isSpace(c)) { - ptr += enc->minBytesPerChar; - c = toAscii(enc, ptr, end); - } - if (c != ASCII_QUOT && c != ASCII_APOS) { - *nextTokPtr = ptr; - return 0; - } - open = (char)c; - ptr += enc->minBytesPerChar; - *valPtr = ptr; - for (;; ptr += enc->minBytesPerChar) { - c = toAscii(enc, ptr, end); - if (c == open) - break; - if (!(ASCII_a <= c && c <= ASCII_z) - && !(ASCII_A <= c && c <= ASCII_Z) - && !(ASCII_0 <= c && c <= ASCII_9) - && c != ASCII_PERIOD - && c != ASCII_MINUS - && c != ASCII_UNDERSCORE) { - *nextTokPtr = ptr; - return 0; - } - } - *nextTokPtr = ptr + enc->minBytesPerChar; - return 1; -} - -static const char KW_version[] = { - ASCII_v, ASCII_e, ASCII_r, ASCII_s, ASCII_i, ASCII_o, ASCII_n, '\0' -}; - -static const char KW_encoding[] = { - ASCII_e, ASCII_n, ASCII_c, ASCII_o, ASCII_d, ASCII_i, ASCII_n, ASCII_g, '\0' -}; - -static const char KW_standalone[] = { - ASCII_s, ASCII_t, ASCII_a, ASCII_n, ASCII_d, ASCII_a, ASCII_l, ASCII_o, - ASCII_n, ASCII_e, '\0' -}; - -static const char KW_yes[] = { - ASCII_y, ASCII_e, ASCII_s, '\0' -}; - -static const char KW_no[] = { - ASCII_n, ASCII_o, '\0' -}; - -static int -doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, - const char *, - const char *), - int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - const char *val = NULL; - const char *name = NULL; - const char *nameEnd = NULL; - ptr += 5 * enc->minBytesPerChar; - end -= 2 * enc->minBytesPerChar; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr) - || !name) { - *badPtr = ptr; - return 0; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_version)) { - if (!isGeneralTextEntity) { - *badPtr = name; - return 0; - } - } - else { - if (versionPtr) - *versionPtr = val; - if (versionEndPtr) - *versionEndPtr = ptr; - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) { - if (isGeneralTextEntity) { - /* a TextDecl must have an EncodingDecl */ - *badPtr = ptr; - return 0; - } - return 1; - } - } - if (XmlNameMatchesAscii(enc, name, nameEnd, KW_encoding)) { - int c = toAscii(enc, val, end); - if (!(ASCII_a <= c && c <= ASCII_z) && !(ASCII_A <= c && c <= ASCII_Z)) { - *badPtr = val; - return 0; - } - if (encodingName) - *encodingName = val; - if (encoding) - *encoding = encodingFinder(enc, val, ptr - enc->minBytesPerChar); - if (!parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { - *badPtr = ptr; - return 0; - } - if (!name) - return 1; - } - if (!XmlNameMatchesAscii(enc, name, nameEnd, KW_standalone) - || isGeneralTextEntity) { - *badPtr = name; - return 0; - } - if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_yes)) { - if (standalone) - *standalone = 1; - } - else if (XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_no)) { - if (standalone) - *standalone = 0; - } - else { - *badPtr = val; - return 0; - } - while (isSpace(toAscii(enc, ptr, end))) - ptr += enc->minBytesPerChar; - if (ptr != end) { - *badPtr = ptr; - return 0; - } - return 1; -} - -static int FASTCALL -checkCharRefNumber(int result) -{ - switch (result >> 8) { - case 0xD8: case 0xD9: case 0xDA: case 0xDB: - case 0xDC: case 0xDD: case 0xDE: case 0xDF: - return -1; - case 0: - if (latin1_encoding.type[result] == BT_NONXML) - return -1; - break; - case 0xFF: - if (result == 0xFFFE || result == 0xFFFF) - return -1; - break; - } - return result; -} - -int FASTCALL -XmlUtf8Encode(int c, char *buf) -{ - enum { - /* minN is minimum legal resulting value for N byte sequence */ - min2 = 0x80, - min3 = 0x800, - min4 = 0x10000 - }; - - if (c < 0) - return 0; - if (c < min2) { - buf[0] = (char)(c | UTF8_cval1); - return 1; - } - if (c < min3) { - buf[0] = (char)((c >> 6) | UTF8_cval2); - buf[1] = (char)((c & 0x3f) | 0x80); - return 2; - } - if (c < min4) { - buf[0] = (char)((c >> 12) | UTF8_cval3); - buf[1] = (char)(((c >> 6) & 0x3f) | 0x80); - buf[2] = (char)((c & 0x3f) | 0x80); - return 3; - } - if (c < 0x110000) { - buf[0] = (char)((c >> 18) | UTF8_cval4); - buf[1] = (char)(((c >> 12) & 0x3f) | 0x80); - buf[2] = (char)(((c >> 6) & 0x3f) | 0x80); - buf[3] = (char)((c & 0x3f) | 0x80); - return 4; - } - return 0; -} - -int FASTCALL -XmlUtf16Encode(int charNum, unsigned short *buf) -{ - if (charNum < 0) - return 0; - if (charNum < 0x10000) { - buf[0] = (unsigned short)charNum; - return 1; - } - if (charNum < 0x110000) { - charNum -= 0x10000; - buf[0] = (unsigned short)((charNum >> 10) + 0xD800); - buf[1] = (unsigned short)((charNum & 0x3FF) + 0xDC00); - return 2; - } - return 0; -} - -struct unknown_encoding { - struct normal_encoding normal; - CONVERTER convert; - void *userData; - unsigned short utf16[256]; - char utf8[256][4]; -}; - -#define AS_UNKNOWN_ENCODING(enc) ((const struct unknown_encoding *) (enc)) - -int -XmlSizeOfUnknownEncoding(void) -{ - return sizeof(struct unknown_encoding); -} - -static int PTRFASTCALL -unknown_isName(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(namePages, c >> 8, c & 0xFF); -} - -static int PTRFASTCALL -unknown_isNmstrt(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - if (c & ~0xFFFF) - return 0; - return UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xFF); -} - -static int PTRFASTCALL -unknown_isInvalid(const ENCODING *enc, const char *p) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - int c = uenc->convert(uenc->userData, p); - return (c & ~0xFFFF) || checkCharRefNumber(c) < 0; -} - -static void PTRCALL -unknown_toUtf8(const ENCODING *enc, - const char **fromP, const char *fromLim, - char **toP, const char *toLim) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - char buf[XML_UTF8_ENCODE_MAX]; - for (;;) { - const char *utf8; - int n; - if (*fromP == fromLim) - break; - utf8 = uenc->utf8[(unsigned char)**fromP]; - n = *utf8++; - if (n == 0) { - int c = uenc->convert(uenc->userData, *fromP); - n = XmlUtf8Encode(c, buf); - if (n > toLim - *toP) - break; - utf8 = buf; - *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2)); - } - else { - if (n > toLim - *toP) - break; - (*fromP)++; - } - do { - *(*toP)++ = *utf8++; - } while (--n != 0); - } -} - -static void PTRCALL -unknown_toUtf16(const ENCODING *enc, - const char **fromP, const char *fromLim, - unsigned short **toP, const unsigned short *toLim) -{ - const struct unknown_encoding *uenc = AS_UNKNOWN_ENCODING(enc); - while (*fromP != fromLim && *toP != toLim) { - unsigned short c = uenc->utf16[(unsigned char)**fromP]; - if (c == 0) { - c = (unsigned short) - uenc->convert(uenc->userData, *fromP); - *fromP += (AS_NORMAL_ENCODING(enc)->type[(unsigned char)**fromP] - - (BT_LEAD2 - 2)); - } - else - (*fromP)++; - *(*toP)++ = c; - } -} - -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - CONVERTER convert, - void *userData) -{ - int i; - struct unknown_encoding *e = (struct unknown_encoding *)mem; - for (i = 0; i < (int)sizeof(struct normal_encoding); i++) - ((char *)mem)[i] = ((char *)&latin1_encoding)[i]; - for (i = 0; i < 128; i++) - if (latin1_encoding.type[i] != BT_OTHER - && latin1_encoding.type[i] != BT_NONXML - && table[i] != i) - return 0; - for (i = 0; i < 256; i++) { - int c = table[i]; - if (c == -1) { - e->normal.type[i] = BT_MALFORM; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else if (c < 0) { - if (c < -4) - return 0; - e->normal.type[i] = (unsigned char)(BT_LEAD2 - (c + 2)); - e->utf8[i][0] = 0; - e->utf16[i] = 0; - } - else if (c < 0x80) { - if (latin1_encoding.type[c] != BT_OTHER - && latin1_encoding.type[c] != BT_NONXML - && c != i) - return 0; - e->normal.type[i] = latin1_encoding.type[c]; - e->utf8[i][0] = 1; - e->utf8[i][1] = (char)c; - e->utf16[i] = (unsigned short)(c == 0 ? 0xFFFF : c); - } - else if (checkCharRefNumber(c) < 0) { - e->normal.type[i] = BT_NONXML; - /* This shouldn't really get used. */ - e->utf16[i] = 0xFFFF; - e->utf8[i][0] = 1; - e->utf8[i][1] = 0; - } - else { - if (c > 0xFFFF) - return 0; - if (UCS2_GET_NAMING(nmstrtPages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NMSTRT; - else if (UCS2_GET_NAMING(namePages, c >> 8, c & 0xff)) - e->normal.type[i] = BT_NAME; - else - e->normal.type[i] = BT_OTHER; - e->utf8[i][0] = (char)XmlUtf8Encode(c, e->utf8[i] + 1); - e->utf16[i] = (unsigned short)c; - } - } - e->userData = userData; - e->convert = convert; - if (convert) { - e->normal.isName2 = unknown_isName; - e->normal.isName3 = unknown_isName; - e->normal.isName4 = unknown_isName; - e->normal.isNmstrt2 = unknown_isNmstrt; - e->normal.isNmstrt3 = unknown_isNmstrt; - e->normal.isNmstrt4 = unknown_isNmstrt; - e->normal.isInvalid2 = unknown_isInvalid; - e->normal.isInvalid3 = unknown_isInvalid; - e->normal.isInvalid4 = unknown_isInvalid; - } - e->normal.enc.utf8Convert = unknown_toUtf8; - e->normal.enc.utf16Convert = unknown_toUtf16; - return &(e->normal.enc); -} - -/* If this enumeration is changed, getEncodingIndex and encodings -must also be changed. */ -enum { - UNKNOWN_ENC = -1, - ISO_8859_1_ENC = 0, - US_ASCII_ENC, - UTF_8_ENC, - UTF_16_ENC, - UTF_16BE_ENC, - UTF_16LE_ENC, - /* must match encodingNames up to here */ - NO_ENC -}; - -static const char KW_ISO_8859_1[] = { - ASCII_I, ASCII_S, ASCII_O, ASCII_MINUS, ASCII_8, ASCII_8, ASCII_5, ASCII_9, - ASCII_MINUS, ASCII_1, '\0' -}; -static const char KW_US_ASCII[] = { - ASCII_U, ASCII_S, ASCII_MINUS, ASCII_A, ASCII_S, ASCII_C, ASCII_I, ASCII_I, - '\0' -}; -static const char KW_UTF_8[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_8, '\0' -}; -static const char KW_UTF_16[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, '\0' -}; -static const char KW_UTF_16BE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_B, ASCII_E, - '\0' -}; -static const char KW_UTF_16LE[] = { - ASCII_U, ASCII_T, ASCII_F, ASCII_MINUS, ASCII_1, ASCII_6, ASCII_L, ASCII_E, - '\0' -}; - -static int FASTCALL -getEncodingIndex(const char *name) -{ - static const char * const encodingNames[] = { - KW_ISO_8859_1, - KW_US_ASCII, - KW_UTF_8, - KW_UTF_16, - KW_UTF_16BE, - KW_UTF_16LE, - }; - int i; - if (name == NULL) - return NO_ENC; - for (i = 0; i < (int)(sizeof(encodingNames)/sizeof(encodingNames[0])); i++) - if (streqci(name, encodingNames[i])) - return i; - return UNKNOWN_ENC; -} - -/* For binary compatibility, we store the index of the encoding - specified at initialization in the isUtf16 member. -*/ - -#define INIT_ENC_INDEX(enc) ((int)(enc)->initEnc.isUtf16) -#define SET_INIT_ENC_INDEX(enc, i) ((enc)->initEnc.isUtf16 = (char)i) - -/* This is what detects the encoding. encodingTable maps from - encoding indices to encodings; INIT_ENC_INDEX(enc) is the index of - the external (protocol) specified encoding; state is - XML_CONTENT_STATE if we're parsing an external text entity, and - XML_PROLOG_STATE otherwise. -*/ - - -static int -initScan(const ENCODING * const *encodingTable, - const INIT_ENCODING *enc, - int state, - const char *ptr, - const char *end, - const char **nextTokPtr) -{ - const ENCODING **encPtr; - - if (ptr == end) - return XML_TOK_NONE; - encPtr = enc->encPtr; - if (ptr + 1 == end) { - /* only a single byte available for auto-detection */ -#ifndef XML_DTD /* FIXME */ - /* a well-formed document entity must have more than one byte */ - if (state != XML_CONTENT_STATE) - return XML_TOK_PARTIAL; -#endif - /* so we're parsing an external text entity... */ - /* if UTF-16 was externally specified, then we need at least 2 bytes */ - switch (INIT_ENC_INDEX(enc)) { - case UTF_16_ENC: - case UTF_16LE_ENC: - case UTF_16BE_ENC: - return XML_TOK_PARTIAL; - } - switch ((unsigned char)*ptr) { - case 0xFE: - case 0xFF: - case 0xEF: /* possibly first byte of UTF-8 BOM */ - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - /* fall through */ - case 0x00: - case 0x3C: - return XML_TOK_PARTIAL; - } - } - else { - switch (((unsigned char)ptr[0] << 8) | (unsigned char)ptr[1]) { - case 0xFEFF: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XML_TOK_BOM; - /* 00 3C is handled in the default case */ - case 0x3C00: - if ((INIT_ENC_INDEX(enc) == UTF_16BE_ENC - || INIT_ENC_INDEX(enc) == UTF_16_ENC) - && state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - case 0xFFFE: - if (INIT_ENC_INDEX(enc) == ISO_8859_1_ENC - && state == XML_CONTENT_STATE) - break; - *nextTokPtr = ptr + 2; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XML_TOK_BOM; - case 0xEFBB: - /* Maybe a UTF-8 BOM (EF BB BF) */ - /* If there's an explicitly specified (external) encoding - of ISO-8859-1 or some flavour of UTF-16 - and this is an external text entity, - don't look for the BOM, - because it might be a legal data. - */ - if (state == XML_CONTENT_STATE) { - int e = INIT_ENC_INDEX(enc); - if (e == ISO_8859_1_ENC || e == UTF_16BE_ENC - || e == UTF_16LE_ENC || e == UTF_16_ENC) - break; - } - if (ptr + 2 == end) - return XML_TOK_PARTIAL; - if ((unsigned char)ptr[2] == 0xBF) { - *nextTokPtr = ptr + 3; - *encPtr = encodingTable[UTF_8_ENC]; - return XML_TOK_BOM; - } - break; - default: - if (ptr[0] == '\0') { - /* 0 isn't a legal data character. Furthermore a document - entity can only start with ASCII characters. So the only - way this can fail to be big-endian UTF-16 if it it's an - external parsed general entity that's labelled as - UTF-16LE. - */ - if (state == XML_CONTENT_STATE && INIT_ENC_INDEX(enc) == UTF_16LE_ENC) - break; - *encPtr = encodingTable[UTF_16BE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - else if (ptr[1] == '\0') { - /* We could recover here in the case: - - parsing an external entity - - second byte is 0 - - no externally specified encoding - - no encoding declaration - by assuming UTF-16LE. But we don't, because this would mean when - presented just with a single byte, we couldn't reliably determine - whether we needed further bytes. - */ - if (state == XML_CONTENT_STATE) - break; - *encPtr = encodingTable[UTF_16LE_ENC]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); - } - break; - } - } - *encPtr = encodingTable[INIT_ENC_INDEX(enc)]; - return XmlTok(*encPtr, state, ptr, end, nextTokPtr); -} - - -#define NS(x) x -#define ns(x) x -#define XML_TOK_NS_C -#include "xmltok_ns.c" -#undef XML_TOK_NS_C -#undef NS -#undef ns - -#ifdef XML_NS - -#define NS(x) x ## NS -#define ns(x) x ## _ns - -#define XML_TOK_NS_C -#include "xmltok_ns.c" -#undef XML_TOK_NS_C - -#undef NS -#undef ns - -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - CONVERTER convert, - void *userData) -{ - ENCODING *enc = XmlInitUnknownEncoding(mem, table, convert, userData); - if (enc) - ((struct normal_encoding *)enc)->type[ASCII_COLON] = BT_COLON; - return enc; -} - -#endif /* XML_NS */ diff --git a/external/mit/expat/dist/lib/xmltok.h b/external/mit/expat/dist/lib/xmltok.h deleted file mode 100755 index ca867aa6b..000000000 --- a/external/mit/expat/dist/lib/xmltok.h +++ /dev/null @@ -1,316 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#ifndef XmlTok_INCLUDED -#define XmlTok_INCLUDED 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* The following token may be returned by XmlContentTok */ -#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be - start of illegal ]]> sequence */ -/* The following tokens may be returned by both XmlPrologTok and - XmlContentTok. -*/ -#define XML_TOK_NONE -4 /* The string to be scanned is empty */ -#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan; - might be part of CRLF sequence */ -#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */ -#define XML_TOK_PARTIAL -1 /* only part of a token */ -#define XML_TOK_INVALID 0 - -/* The following tokens are returned by XmlContentTok; some are also - returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok. -*/ -#define XML_TOK_START_TAG_WITH_ATTS 1 -#define XML_TOK_START_TAG_NO_ATTS 2 -#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag */ -#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4 -#define XML_TOK_END_TAG 5 -#define XML_TOK_DATA_CHARS 6 -#define XML_TOK_DATA_NEWLINE 7 -#define XML_TOK_CDATA_SECT_OPEN 8 -#define XML_TOK_ENTITY_REF 9 -#define XML_TOK_CHAR_REF 10 /* numeric character reference */ - -/* The following tokens may be returned by both XmlPrologTok and - XmlContentTok. -*/ -#define XML_TOK_PI 11 /* processing instruction */ -#define XML_TOK_XML_DECL 12 /* XML decl or text decl */ -#define XML_TOK_COMMENT 13 -#define XML_TOK_BOM 14 /* Byte order mark */ - -/* The following tokens are returned only by XmlPrologTok */ -#define XML_TOK_PROLOG_S 15 -#define XML_TOK_DECL_OPEN 16 /* */ -#define XML_TOK_NAME 18 -#define XML_TOK_NMTOKEN 19 -#define XML_TOK_POUND_NAME 20 /* #name */ -#define XML_TOK_OR 21 /* | */ -#define XML_TOK_PERCENT 22 -#define XML_TOK_OPEN_PAREN 23 -#define XML_TOK_CLOSE_PAREN 24 -#define XML_TOK_OPEN_BRACKET 25 -#define XML_TOK_CLOSE_BRACKET 26 -#define XML_TOK_LITERAL 27 -#define XML_TOK_PARAM_ENTITY_REF 28 -#define XML_TOK_INSTANCE_START 29 - -/* The following occur only in element type declarations */ -#define XML_TOK_NAME_QUESTION 30 /* name? */ -#define XML_TOK_NAME_ASTERISK 31 /* name* */ -#define XML_TOK_NAME_PLUS 32 /* name+ */ -#define XML_TOK_COND_SECT_OPEN 33 /* */ -#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */ -#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */ -#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */ -#define XML_TOK_COMMA 38 - -/* The following token is returned only by XmlAttributeValueTok */ -#define XML_TOK_ATTRIBUTE_VALUE_S 39 - -/* The following token is returned only by XmlCdataSectionTok */ -#define XML_TOK_CDATA_SECT_CLOSE 40 - -/* With namespace processing this is returned by XmlPrologTok for a - name with a colon. -*/ -#define XML_TOK_PREFIXED_NAME 41 - -#ifdef XML_DTD -#define XML_TOK_IGNORE_SECT 42 -#endif /* XML_DTD */ - -#ifdef XML_DTD -#define XML_N_STATES 4 -#else /* not XML_DTD */ -#define XML_N_STATES 3 -#endif /* not XML_DTD */ - -#define XML_PROLOG_STATE 0 -#define XML_CONTENT_STATE 1 -#define XML_CDATA_SECTION_STATE 2 -#ifdef XML_DTD -#define XML_IGNORE_SECTION_STATE 3 -#endif /* XML_DTD */ - -#define XML_N_LITERAL_TYPES 2 -#define XML_ATTRIBUTE_VALUE_LITERAL 0 -#define XML_ENTITY_VALUE_LITERAL 1 - -/* The size of the buffer passed to XmlUtf8Encode must be at least this. */ -#define XML_UTF8_ENCODE_MAX 4 -/* The size of the buffer passed to XmlUtf16Encode must be at least this. */ -#define XML_UTF16_ENCODE_MAX 2 - -typedef struct position { - /* first line and first column are 0 not 1 */ - XML_Size lineNumber; - XML_Size columnNumber; -} POSITION; - -typedef struct { - const char *name; - const char *valuePtr; - const char *valueEnd; - char normalized; -} ATTRIBUTE; - -struct encoding; -typedef struct encoding ENCODING; - -typedef int (PTRCALL *SCANNER)(const ENCODING *, - const char *, - const char *, - const char **); - -struct encoding { - SCANNER scanners[XML_N_STATES]; - SCANNER literalScanners[XML_N_LITERAL_TYPES]; - int (PTRCALL *sameName)(const ENCODING *, - const char *, - const char *); - int (PTRCALL *nameMatchesAscii)(const ENCODING *, - const char *, - const char *, - const char *); - int (PTRFASTCALL *nameLength)(const ENCODING *, const char *); - const char *(PTRFASTCALL *skipS)(const ENCODING *, const char *); - int (PTRCALL *getAtts)(const ENCODING *enc, - const char *ptr, - int attsMax, - ATTRIBUTE *atts); - int (PTRFASTCALL *charRefNumber)(const ENCODING *enc, const char *ptr); - int (PTRCALL *predefinedEntityName)(const ENCODING *, - const char *, - const char *); - void (PTRCALL *updatePosition)(const ENCODING *, - const char *ptr, - const char *end, - POSITION *); - int (PTRCALL *isPublicId)(const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr); - void (PTRCALL *utf8Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - char **toP, - const char *toLim); - void (PTRCALL *utf16Convert)(const ENCODING *enc, - const char **fromP, - const char *fromLim, - unsigned short **toP, - const unsigned short *toLim); - int minBytesPerChar; - char isUtf8; - char isUtf16; -}; - -/* Scan the string starting at ptr until the end of the next complete - token, but do not scan past eptr. Return an integer giving the - type of token. - - Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set. - - Return XML_TOK_PARTIAL when the string does not contain a complete - token; nextTokPtr will not be set. - - Return XML_TOK_INVALID when the string does not start a valid - token; nextTokPtr will be set to point to the character which made - the token invalid. - - Otherwise the string starts with a valid token; nextTokPtr will be - set to point to the character following the end of that token. - - Each data character counts as a single token, but adjacent data - characters may be returned together. Similarly for characters in - the prolog outside literals, comments and processing instructions. -*/ - - -#define XmlTok(enc, state, ptr, end, nextTokPtr) \ - (((enc)->scanners[state])(enc, ptr, end, nextTokPtr)) - -#define XmlPrologTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr) - -#define XmlContentTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr) - -#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr) - -#ifdef XML_DTD - -#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \ - XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr) - -#endif /* XML_DTD */ - -/* This is used for performing a 2nd-level tokenization on the content - of a literal that has already been returned by XmlTok. -*/ -#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \ - (((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr)) - -#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \ - XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr) - -#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2)) - -#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \ - (((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2)) - -#define XmlNameLength(enc, ptr) \ - (((enc)->nameLength)(enc, ptr)) - -#define XmlSkipS(enc, ptr) \ - (((enc)->skipS)(enc, ptr)) - -#define XmlGetAttributes(enc, ptr, attsMax, atts) \ - (((enc)->getAtts)(enc, ptr, attsMax, atts)) - -#define XmlCharRefNumber(enc, ptr) \ - (((enc)->charRefNumber)(enc, ptr)) - -#define XmlPredefinedEntityName(enc, ptr, end) \ - (((enc)->predefinedEntityName)(enc, ptr, end)) - -#define XmlUpdatePosition(enc, ptr, end, pos) \ - (((enc)->updatePosition)(enc, ptr, end, pos)) - -#define XmlIsPublicId(enc, ptr, end, badPtr) \ - (((enc)->isPublicId)(enc, ptr, end, badPtr)) - -#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim)) - -#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \ - (((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim)) - -typedef struct { - ENCODING initEnc; - const ENCODING **encPtr; -} INIT_ENCODING; - -int XmlParseXmlDecl(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); - -int XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncoding(void); -const ENCODING *XmlGetUtf16InternalEncoding(void); -int FASTCALL XmlUtf8Encode(int charNumber, char *buf); -int FASTCALL XmlUtf16Encode(int charNumber, unsigned short *buf); -int XmlSizeOfUnknownEncoding(void); - - -typedef int (XMLCALL *CONVERTER) (void *userData, const char *p); - -ENCODING * -XmlInitUnknownEncoding(void *mem, - int *table, - CONVERTER convert, - void *userData); - -int XmlParseXmlDeclNS(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingNamePtr, - const ENCODING **namedEncodingPtr, - int *standalonePtr); - -int XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name); -const ENCODING *XmlGetUtf8InternalEncodingNS(void); -const ENCODING *XmlGetUtf16InternalEncodingNS(void); -ENCODING * -XmlInitUnknownEncodingNS(void *mem, - int *table, - CONVERTER convert, - void *userData); -#ifdef __cplusplus -} -#endif - -#endif /* not XmlTok_INCLUDED */ diff --git a/external/mit/expat/dist/lib/xmltok_impl.c b/external/mit/expat/dist/lib/xmltok_impl.c deleted file mode 100755 index 9c2895b87..000000000 --- a/external/mit/expat/dist/lib/xmltok_impl.c +++ /dev/null @@ -1,1783 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* This file is included! */ -#ifdef XML_TOK_IMPL_C - -#ifndef IS_INVALID_CHAR -#define IS_INVALID_CHAR(enc, ptr, n) (0) -#endif - -#define INVALID_LEAD_CASE(n, ptr, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_INVALID_CHAR(enc, ptr, n)) { \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define INVALID_CASES(ptr, nextTokPtr) \ - INVALID_LEAD_CASE(2, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(3, ptr, nextTokPtr) \ - INVALID_LEAD_CASE(4, ptr, nextTokPtr) \ - case BT_NONXML: \ - case BT_MALFORM: \ - case BT_TRAIL: \ - *(nextTokPtr) = (ptr); \ - return XML_TOK_INVALID; - -#define CHECK_NAME_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NAME_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NAME_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - case BT_DIGIT: \ - case BT_NAME: \ - case BT_MINUS: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NAME_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NAME_CASE(4, enc, ptr, end, nextTokPtr) - -#define CHECK_NMSTRT_CASE(n, enc, ptr, end, nextTokPtr) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - ptr += n; \ - break; - -#define CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) \ - case BT_NONASCII: \ - if (!IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; \ - } \ - case BT_NMSTRT: \ - case BT_HEX: \ - ptr += MINBPC(enc); \ - break; \ - CHECK_NMSTRT_CASE(2, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(3, enc, ptr, end, nextTokPtr) \ - CHECK_NMSTRT_CASE(4, enc, ptr, end, nextTokPtr) - -#ifndef PREFIX -#define PREFIX(ident) ident -#endif - -/* ptr points to character following " */ - switch (BYTE_TYPE(enc, ptr + MINBPC(enc))) { - case BT_S: case BT_CR: case BT_LF: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - /* fall through */ - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DECL_OPEN; - case BT_NMSTRT: - case BT_HEX: - ptr += MINBPC(enc); - break; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(checkPiTarget)(const ENCODING *enc, const char *ptr, - const char *end, int *tokPtr) -{ - int upper = 0; - *tokPtr = XML_TOK_PI; - if (end - ptr != MINBPC(enc)*3) - return 1; - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_x: - break; - case ASCII_X: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_m: - break; - case ASCII_M: - upper = 1; - break; - default: - return 1; - } - ptr += MINBPC(enc); - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - break; - case ASCII_L: - upper = 1; - break; - default: - return 1; - } - if (upper) - return 0; - *tokPtr = XML_TOK_XML_DECL; - return 1; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CDATA_SECT_CLOSE; - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - case BT_RSQB: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following " 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_LT: - return PREFIX(scanLt)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_AMP: - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_CR: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - case BT_LF: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_RSQB)) - break; - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_RSQB; - if (!CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr -= MINBPC(enc); - break; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - INVALID_CASES(ptr, nextTokPtr) - default: - ptr += MINBPC(enc); - break; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n || IS_INVALID_CHAR(enc, ptr, n)) { \ - *nextTokPtr = ptr; \ - return XML_TOK_DATA_CHARS; \ - } \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_RSQB: - if (ptr + MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_RSQB)) { - ptr += MINBPC(enc); - break; - } - if (ptr + 2*MINBPC(enc) != end) { - if (!CHAR_MATCHES(enc, ptr + 2*MINBPC(enc), ASCII_GT)) { - ptr += MINBPC(enc); - break; - } - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_INVALID; - } - } - /* fall through */ - case BT_AMP: - case BT_LT: - case BT_NONXML: - case BT_MALFORM: - case BT_TRAIL: - case BT_CR: - case BT_LF: - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -/* ptr points to character following "%" */ - -static int PTRCALL -PREFIX(scanPercent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - case BT_S: case BT_LF: case BT_CR: case BT_PERCNT: - *nextTokPtr = ptr; - return XML_TOK_PERCENT; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_SEMI: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_PARAM_ENTITY_REF; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(scanPoundName)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NMSTRT_CASES(enc, ptr, end, nextTokPtr) - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_CR: case BT_LF: case BT_S: - case BT_RPAR: case BT_GT: case BT_PERCNT: case BT_VERBAR: - *nextTokPtr = ptr; - return XML_TOK_POUND_NAME; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -XML_TOK_POUND_NAME; -} - -static int PTRCALL -PREFIX(scanLit)(int open, const ENCODING *enc, - const char *ptr, const char *end, - const char **nextTokPtr) -{ - while (ptr != end) { - int t = BYTE_TYPE(enc, ptr); - switch (t) { - INVALID_CASES(ptr, nextTokPtr) - case BT_QUOT: - case BT_APOS: - ptr += MINBPC(enc); - if (t != open) - break; - if (ptr == end) - return -XML_TOK_LITERAL; - *nextTokPtr = ptr; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_CR: case BT_LF: - case BT_GT: case BT_PERCNT: case BT_LSQB: - return XML_TOK_LITERAL; - default: - return XML_TOK_INVALID; - } - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -static int PTRCALL -PREFIX(prologTok)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - int tok; - if (ptr == end) - return XML_TOK_NONE; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - if (n == 0) - return XML_TOK_PARTIAL; - end = ptr + n; - } - } - switch (BYTE_TYPE(enc, ptr)) { - case BT_QUOT: - return PREFIX(scanLit)(BT_QUOT, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_APOS: - return PREFIX(scanLit)(BT_APOS, enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_LT: - { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_PARTIAL; - switch (BYTE_TYPE(enc, ptr)) { - case BT_EXCL: - return PREFIX(scanDecl)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_QUEST: - return PREFIX(scanPi)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_NMSTRT: - case BT_HEX: - case BT_NONASCII: - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - *nextTokPtr = ptr - MINBPC(enc); - return XML_TOK_INSTANCE_START; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - case BT_CR: - if (ptr + MINBPC(enc) == end) { - *nextTokPtr = end; - /* indicate that this might be part of a CR/LF pair */ - return -XML_TOK_PROLOG_S; - } - /* fall through */ - case BT_S: case BT_LF: - for (;;) { - ptr += MINBPC(enc); - if (ptr == end) - break; - switch (BYTE_TYPE(enc, ptr)) { - case BT_S: case BT_LF: - break; - case BT_CR: - /* don't split CR/LF pair */ - if (ptr + MINBPC(enc) != end) - break; - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - } - } - *nextTokPtr = ptr; - return XML_TOK_PROLOG_S; - case BT_PERCNT: - return PREFIX(scanPercent)(enc, ptr + MINBPC(enc), end, nextTokPtr); - case BT_COMMA: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_COMMA; - case BT_LSQB: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_BRACKET; - case BT_RSQB: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_BRACKET; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if (ptr + MINBPC(enc) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_GT)) { - *nextTokPtr = ptr + 2*MINBPC(enc); - return XML_TOK_COND_SECT_CLOSE; - } - } - *nextTokPtr = ptr; - return XML_TOK_CLOSE_BRACKET; - case BT_LPAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OPEN_PAREN; - case BT_RPAR: - ptr += MINBPC(enc); - if (ptr == end) - return -XML_TOK_CLOSE_PAREN; - switch (BYTE_TYPE(enc, ptr)) { - case BT_AST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_ASTERISK; - case BT_QUEST: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_QUESTION; - case BT_PLUS: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_CLOSE_PAREN_PLUS; - case BT_CR: case BT_LF: case BT_S: - case BT_GT: case BT_COMMA: case BT_VERBAR: - case BT_RPAR: - *nextTokPtr = ptr; - return XML_TOK_CLOSE_PAREN; - } - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_VERBAR: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_OR; - case BT_GT: - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DECL_CLOSE; - case BT_NUM: - return PREFIX(scanPoundName)(enc, ptr + MINBPC(enc), end, nextTokPtr); -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (end - ptr < n) \ - return XML_TOK_PARTIAL_CHAR; \ - if (IS_NMSTRT_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NAME; \ - break; \ - } \ - if (IS_NAME_CHAR(enc, ptr, n)) { \ - ptr += n; \ - tok = XML_TOK_NMTOKEN; \ - break; \ - } \ - *nextTokPtr = ptr; \ - return XML_TOK_INVALID; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NMSTRT: - case BT_HEX: - tok = XML_TOK_NAME; - ptr += MINBPC(enc); - break; - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: -#ifdef XML_NS - case BT_COLON: -#endif - tok = XML_TOK_NMTOKEN; - ptr += MINBPC(enc); - break; - case BT_NONASCII: - if (IS_NMSTRT_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NAME; - break; - } - if (IS_NAME_CHAR_MINBPC(enc, ptr)) { - ptr += MINBPC(enc); - tok = XML_TOK_NMTOKEN; - break; - } - /* fall through */ - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - case BT_GT: case BT_RPAR: case BT_COMMA: - case BT_VERBAR: case BT_LSQB: case BT_PERCNT: - case BT_S: case BT_CR: case BT_LF: - *nextTokPtr = ptr; - return tok; -#ifdef XML_NS - case BT_COLON: - ptr += MINBPC(enc); - switch (tok) { - case XML_TOK_NAME: - if (ptr == end) - return XML_TOK_PARTIAL; - tok = XML_TOK_PREFIXED_NAME; - switch (BYTE_TYPE(enc, ptr)) { - CHECK_NAME_CASES(enc, ptr, end, nextTokPtr) - default: - tok = XML_TOK_NMTOKEN; - break; - } - break; - case XML_TOK_PREFIXED_NAME: - tok = XML_TOK_NMTOKEN; - break; - } - break; -#endif - case BT_PLUS: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_PLUS; - case BT_AST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_ASTERISK; - case BT_QUEST: - if (tok == XML_TOK_NMTOKEN) { - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_NAME_QUESTION; - default: - *nextTokPtr = ptr; - return XML_TOK_INVALID; - } - } - return -tok; -} - -static int PTRCALL -PREFIX(attributeValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LT: - /* this is for inside entity references */ - *nextTokPtr = ptr; - return XML_TOK_INVALID; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_S: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_ATTRIBUTE_VALUE_S; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -static int PTRCALL -PREFIX(entityValueTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - const char *start; - if (ptr == end) - return XML_TOK_NONE; - start = ptr; - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_AMP: - if (ptr == start) - return PREFIX(scanRef)(enc, ptr + MINBPC(enc), end, nextTokPtr); - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_PERCNT: - if (ptr == start) { - int tok = PREFIX(scanPercent)(enc, ptr + MINBPC(enc), - end, nextTokPtr); - return (tok == XML_TOK_PERCENT) ? XML_TOK_INVALID : tok; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_LF: - if (ptr == start) { - *nextTokPtr = ptr + MINBPC(enc); - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - case BT_CR: - if (ptr == start) { - ptr += MINBPC(enc); - if (ptr == end) - return XML_TOK_TRAILING_CR; - if (BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - *nextTokPtr = ptr; - return XML_TOK_DATA_NEWLINE; - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; - default: - ptr += MINBPC(enc); - break; - } - } - *nextTokPtr = ptr; - return XML_TOK_DATA_CHARS; -} - -#ifdef XML_DTD - -static int PTRCALL -PREFIX(ignoreSectionTok)(const ENCODING *enc, const char *ptr, - const char *end, const char **nextTokPtr) -{ - int level = 0; - if (MINBPC(enc) > 1) { - size_t n = end - ptr; - if (n & (MINBPC(enc) - 1)) { - n &= ~(MINBPC(enc) - 1); - end = ptr + n; - } - } - while (ptr != end) { - switch (BYTE_TYPE(enc, ptr)) { - INVALID_CASES(ptr, nextTokPtr) - case BT_LT: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_EXCL)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_LSQB)) { - ++level; - ptr += MINBPC(enc); - } - } - break; - case BT_RSQB: - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_RSQB)) { - if ((ptr += MINBPC(enc)) == end) - return XML_TOK_PARTIAL; - if (CHAR_MATCHES(enc, ptr, ASCII_GT)) { - ptr += MINBPC(enc); - if (level == 0) { - *nextTokPtr = ptr; - return XML_TOK_IGNORE_SECT; - } - --level; - } - } - break; - default: - ptr += MINBPC(enc); - break; - } - } - return XML_TOK_PARTIAL; -} - -#endif /* XML_DTD */ - -static int PTRCALL -PREFIX(isPublicId)(const ENCODING *enc, const char *ptr, const char *end, - const char **badPtr) -{ - ptr += MINBPC(enc); - end -= MINBPC(enc); - for (; ptr != end; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_DIGIT: - case BT_HEX: - case BT_MINUS: - case BT_APOS: - case BT_LPAR: - case BT_RPAR: - case BT_PLUS: - case BT_COMMA: - case BT_SOL: - case BT_EQUALS: - case BT_QUEST: - case BT_CR: - case BT_LF: - case BT_SEMI: - case BT_EXCL: - case BT_AST: - case BT_PERCNT: - case BT_NUM: -#ifdef XML_NS - case BT_COLON: -#endif - break; - case BT_S: - if (CHAR_MATCHES(enc, ptr, ASCII_TAB)) { - *badPtr = ptr; - return 0; - } - break; - case BT_NAME: - case BT_NMSTRT: - if (!(BYTE_TO_ASCII(enc, ptr) & ~0x7f)) - break; - default: - switch (BYTE_TO_ASCII(enc, ptr)) { - case 0x24: /* $ */ - case 0x40: /* @ */ - break; - default: - *badPtr = ptr; - return 0; - } - break; - } - } - return 1; -} - -/* This must only be called for a well-formed start-tag or empty - element tag. Returns the number of attributes. Pointers to the - first attsMax attributes are stored in atts. -*/ - -static int PTRCALL -PREFIX(getAtts)(const ENCODING *enc, const char *ptr, - int attsMax, ATTRIBUTE *atts) -{ - enum { other, inName, inValue } state = inName; - int nAtts = 0; - int open = 0; /* defined when state == inValue; - initialization just to shut up compilers */ - - for (ptr += MINBPC(enc);; ptr += MINBPC(enc)) { - switch (BYTE_TYPE(enc, ptr)) { -#define START_NAME \ - if (state == other) { \ - if (nAtts < attsMax) { \ - atts[nAtts].name = ptr; \ - atts[nAtts].normalized = 1; \ - } \ - state = inName; \ - } -#define LEAD_CASE(n) \ - case BT_LEAD ## n: START_NAME ptr += (n - MINBPC(enc)); break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: - case BT_HEX: - START_NAME - break; -#undef START_NAME - case BT_QUOT: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_QUOT; - } - else if (open == BT_QUOT) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_APOS: - if (state != inValue) { - if (nAtts < attsMax) - atts[nAtts].valuePtr = ptr + MINBPC(enc); - state = inValue; - open = BT_APOS; - } - else if (open == BT_APOS) { - state = other; - if (nAtts < attsMax) - atts[nAtts].valueEnd = ptr; - nAtts++; - } - break; - case BT_AMP: - if (nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_S: - if (state == inName) - state = other; - else if (state == inValue - && nAtts < attsMax - && atts[nAtts].normalized - && (ptr == atts[nAtts].valuePtr - || BYTE_TO_ASCII(enc, ptr) != ASCII_SPACE - || BYTE_TO_ASCII(enc, ptr + MINBPC(enc)) == ASCII_SPACE - || BYTE_TYPE(enc, ptr + MINBPC(enc)) == open)) - atts[nAtts].normalized = 0; - break; - case BT_CR: case BT_LF: - /* This case ensures that the first attribute name is counted - Apart from that we could just change state on the quote. */ - if (state == inName) - state = other; - else if (state == inValue && nAtts < attsMax) - atts[nAtts].normalized = 0; - break; - case BT_GT: - case BT_SOL: - if (state != inValue) - return nAtts; - break; - default: - break; - } - } - /* not reached */ -} - -static int PTRFASTCALL -PREFIX(charRefNumber)(const ENCODING *enc, const char *ptr) -{ - int result = 0; - /* skip &# */ - ptr += 2*MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_x)) { - for (ptr += MINBPC(enc); - !CHAR_MATCHES(enc, ptr, ASCII_SEMI); - ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - switch (c) { - case ASCII_0: case ASCII_1: case ASCII_2: case ASCII_3: case ASCII_4: - case ASCII_5: case ASCII_6: case ASCII_7: case ASCII_8: case ASCII_9: - result <<= 4; - result |= (c - ASCII_0); - break; - case ASCII_A: case ASCII_B: case ASCII_C: - case ASCII_D: case ASCII_E: case ASCII_F: - result <<= 4; - result += 10 + (c - ASCII_A); - break; - case ASCII_a: case ASCII_b: case ASCII_c: - case ASCII_d: case ASCII_e: case ASCII_f: - result <<= 4; - result += 10 + (c - ASCII_a); - break; - } - if (result >= 0x110000) - return -1; - } - } - else { - for (; !CHAR_MATCHES(enc, ptr, ASCII_SEMI); ptr += MINBPC(enc)) { - int c = BYTE_TO_ASCII(enc, ptr); - result *= 10; - result += (c - ASCII_0); - if (result >= 0x110000) - return -1; - } - } - return checkCharRefNumber(result); -} - -static int PTRCALL -PREFIX(predefinedEntityName)(const ENCODING *enc, const char *ptr, - const char *end) -{ - switch ((end - ptr)/MINBPC(enc)) { - case 2: - if (CHAR_MATCHES(enc, ptr + MINBPC(enc), ASCII_t)) { - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_l: - return ASCII_LT; - case ASCII_g: - return ASCII_GT; - } - } - break; - case 3: - if (CHAR_MATCHES(enc, ptr, ASCII_a)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_m)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) - return ASCII_AMP; - } - } - break; - case 4: - switch (BYTE_TO_ASCII(enc, ptr)) { - case ASCII_q: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_u)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_t)) - return ASCII_QUOT; - } - } - break; - case ASCII_a: - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_p)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_o)) { - ptr += MINBPC(enc); - if (CHAR_MATCHES(enc, ptr, ASCII_s)) - return ASCII_APOS; - } - } - break; - } - } - return 0; -} - -static int PTRCALL -PREFIX(sameName)(const ENCODING *enc, const char *ptr1, const char *ptr2) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr1)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - if (*ptr1++ != *ptr2++) \ - return 0; - LEAD_CASE(4) LEAD_CASE(3) LEAD_CASE(2) -#undef LEAD_CASE - /* fall through */ - if (*ptr1++ != *ptr2++) - return 0; - break; - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 1) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 2) { - if (*ptr2++ != *ptr1++) - return 0; - if (MINBPC(enc) > 3) { - if (*ptr2++ != *ptr1++) - return 0; - } - } - } - break; - default: - if (MINBPC(enc) == 1 && *ptr1 == *ptr2) - return 1; - switch (BYTE_TYPE(enc, ptr2)) { - case BT_LEAD2: - case BT_LEAD3: - case BT_LEAD4: - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - return 0; - default: - return 1; - } - } - } - /* not reached */ -} - -static int PTRCALL -PREFIX(nameMatchesAscii)(const ENCODING *enc, const char *ptr1, - const char *end1, const char *ptr2) -{ - for (; *ptr2; ptr1 += MINBPC(enc), ptr2++) { - if (ptr1 == end1) - return 0; - if (!CHAR_MATCHES(enc, ptr1, *ptr2)) - return 0; - } - return ptr1 == end1; -} - -static int PTRFASTCALL -PREFIX(nameLength)(const ENCODING *enc, const char *ptr) -{ - const char *start = ptr; - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: ptr += n; break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_NONASCII: - case BT_NMSTRT: -#ifdef XML_NS - case BT_COLON: -#endif - case BT_HEX: - case BT_DIGIT: - case BT_NAME: - case BT_MINUS: - ptr += MINBPC(enc); - break; - default: - return (int)(ptr - start); - } - } -} - -static const char * PTRFASTCALL -PREFIX(skipS)(const ENCODING *enc, const char *ptr) -{ - for (;;) { - switch (BYTE_TYPE(enc, ptr)) { - case BT_LF: - case BT_CR: - case BT_S: - ptr += MINBPC(enc); - break; - default: - return ptr; - } - } -} - -static void PTRCALL -PREFIX(updatePosition)(const ENCODING *enc, - const char *ptr, - const char *end, - POSITION *pos) -{ - while (ptr < end) { - switch (BYTE_TYPE(enc, ptr)) { -#define LEAD_CASE(n) \ - case BT_LEAD ## n: \ - ptr += n; \ - break; - LEAD_CASE(2) LEAD_CASE(3) LEAD_CASE(4) -#undef LEAD_CASE - case BT_LF: - pos->columnNumber = (XML_Size)-1; - pos->lineNumber++; - ptr += MINBPC(enc); - break; - case BT_CR: - pos->lineNumber++; - ptr += MINBPC(enc); - if (ptr != end && BYTE_TYPE(enc, ptr) == BT_LF) - ptr += MINBPC(enc); - pos->columnNumber = (XML_Size)-1; - break; - default: - ptr += MINBPC(enc); - break; - } - pos->columnNumber++; - } -} - -#undef DO_LEAD_CASE -#undef MULTIBYTE_CASES -#undef INVALID_CASES -#undef CHECK_NAME_CASE -#undef CHECK_NAME_CASES -#undef CHECK_NMSTRT_CASE -#undef CHECK_NMSTRT_CASES - -#endif /* XML_TOK_IMPL_C */ diff --git a/external/mit/expat/dist/lib/xmltok_impl.h b/external/mit/expat/dist/lib/xmltok_impl.h deleted file mode 100755 index da0ea60a6..000000000 --- a/external/mit/expat/dist/lib/xmltok_impl.h +++ /dev/null @@ -1,46 +0,0 @@ -/* -Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd -See the file COPYING for copying permission. -*/ - -enum { - BT_NONXML, - BT_MALFORM, - BT_LT, - BT_AMP, - BT_RSQB, - BT_LEAD2, - BT_LEAD3, - BT_LEAD4, - BT_TRAIL, - BT_CR, - BT_LF, - BT_GT, - BT_QUOT, - BT_APOS, - BT_EQUALS, - BT_QUEST, - BT_EXCL, - BT_SOL, - BT_SEMI, - BT_NUM, - BT_LSQB, - BT_S, - BT_NMSTRT, - BT_COLON, - BT_HEX, - BT_DIGIT, - BT_NAME, - BT_MINUS, - BT_OTHER, /* known not to be a name or name start character */ - BT_NONASCII, /* might be a name or name start character */ - BT_PERCNT, - BT_LPAR, - BT_RPAR, - BT_AST, - BT_PLUS, - BT_COMMA, - BT_VERBAR -}; - -#include diff --git a/external/mit/expat/dist/lib/xmltok_ns.c b/external/mit/expat/dist/lib/xmltok_ns.c deleted file mode 100755 index c3b88fdf4..000000000 --- a/external/mit/expat/dist/lib/xmltok_ns.c +++ /dev/null @@ -1,115 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -/* This file is included! */ -#ifdef XML_TOK_NS_C - -const ENCODING * -NS(XmlGetUtf8InternalEncoding)(void) -{ - return &ns(internal_utf8_encoding).enc; -} - -const ENCODING * -NS(XmlGetUtf16InternalEncoding)(void) -{ -#if BYTEORDER == 1234 - return &ns(internal_little2_encoding).enc; -#elif BYTEORDER == 4321 - return &ns(internal_big2_encoding).enc; -#else - const short n = 1; - return (*(const char *)&n - ? &ns(internal_little2_encoding).enc - : &ns(internal_big2_encoding).enc); -#endif -} - -static const ENCODING * const NS(encodings)[] = { - &ns(latin1_encoding).enc, - &ns(ascii_encoding).enc, - &ns(utf8_encoding).enc, - &ns(big2_encoding).enc, - &ns(big2_encoding).enc, - &ns(little2_encoding).enc, - &ns(utf8_encoding).enc /* NO_ENC */ -}; - -static int PTRCALL -NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_PROLOG_STATE, ptr, end, nextTokPtr); -} - -static int PTRCALL -NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end, - const char **nextTokPtr) -{ - return initScan(NS(encodings), (const INIT_ENCODING *)enc, - XML_CONTENT_STATE, ptr, end, nextTokPtr); -} - -int -NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, - const char *name) -{ - int i = getEncodingIndex(name); - if (i == UNKNOWN_ENC) - return 0; - SET_INIT_ENC_INDEX(p, i); - p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog); - p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent); - p->initEnc.updatePosition = initUpdatePosition; - p->encPtr = encPtr; - *encPtr = &(p->initEnc); - return 1; -} - -static const ENCODING * -NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end) -{ -#define ENCODING_MAX 128 - char buf[ENCODING_MAX]; - char *p = buf; - int i; - XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1); - if (ptr != end) - return 0; - *p = 0; - if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2) - return enc; - i = getEncodingIndex(buf); - if (i == UNKNOWN_ENC) - return 0; - return NS(encodings)[i]; -} - -int -NS(XmlParseXmlDecl)(int isGeneralTextEntity, - const ENCODING *enc, - const char *ptr, - const char *end, - const char **badPtr, - const char **versionPtr, - const char **versionEndPtr, - const char **encodingName, - const ENCODING **encoding, - int *standalone) -{ - return doParseXmlDecl(NS(findEncoding), - isGeneralTextEntity, - enc, - ptr, - end, - badPtr, - versionPtr, - versionEndPtr, - encodingName, - encoding, - standalone); -} - -#endif /* XML_TOK_NS_C */ diff --git a/external/mit/expat/dist/m4/libtool.m4 b/external/mit/expat/dist/m4/libtool.m4 deleted file mode 100644 index 8ff3c76f8..000000000 --- a/external/mit/expat/dist/m4/libtool.m4 +++ /dev/null @@ -1,7851 +0,0 @@ -# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- -# -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -m4_define([_LT_COPYING], [dnl -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, -# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, -# Inc. -# Written by Gordon Matzigkeit, 1996 -# -# This file is part of GNU Libtool. -# -# GNU Libtool is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# As a special exception to the GNU General Public License, -# if you distribute this file as part of a program or library that -# is built using GNU Libtool, you may include this file under the -# same distribution terms that you use for the rest of that program. -# -# GNU Libtool is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or -# obtained by writing to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -]) - -# serial 57 LT_INIT - - -# LT_PREREQ(VERSION) -# ------------------ -# Complain and exit if this libtool version is less that VERSION. -m4_defun([LT_PREREQ], -[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, - [m4_default([$3], - [m4_fatal([Libtool version $1 or higher is required], - 63)])], - [$2])]) - - -# _LT_CHECK_BUILDDIR -# ------------------ -# Complain if the absolute build directory name contains unusual characters -m4_defun([_LT_CHECK_BUILDDIR], -[case `pwd` in - *\ * | *\ *) - AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; -esac -]) - - -# LT_INIT([OPTIONS]) -# ------------------ -AC_DEFUN([LT_INIT], -[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT -AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl -AC_BEFORE([$0], [LT_LANG])dnl -AC_BEFORE([$0], [LT_OUTPUT])dnl -AC_BEFORE([$0], [LTDL_INIT])dnl -m4_require([_LT_CHECK_BUILDDIR])dnl - -dnl Autoconf doesn't catch unexpanded LT_ macros by default: -m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl -m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl -dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 -dnl unless we require an AC_DEFUNed macro: -AC_REQUIRE([LTOPTIONS_VERSION])dnl -AC_REQUIRE([LTSUGAR_VERSION])dnl -AC_REQUIRE([LTVERSION_VERSION])dnl -AC_REQUIRE([LTOBSOLETE_VERSION])dnl -m4_require([_LT_PROG_LTMAIN])dnl - -_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) - -dnl Parse OPTIONS -_LT_SET_OPTIONS([$0], [$1]) - -# This can be used to rebuild libtool when needed -LIBTOOL_DEPS="$ltmain" - -# Always use our own libtool. -LIBTOOL='$(SHELL) $(top_builddir)/libtool' -AC_SUBST(LIBTOOL)dnl - -_LT_SETUP - -# Only expand once: -m4_define([LT_INIT]) -])# LT_INIT - -# Old names: -AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) -AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PROG_LIBTOOL], []) -dnl AC_DEFUN([AM_PROG_LIBTOOL], []) - - -# _LT_CC_BASENAME(CC) -# ------------------- -# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. -m4_defun([_LT_CC_BASENAME], -[for cc_temp in $1""; do - case $cc_temp in - compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; - distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; - \-*) ;; - *) break;; - esac -done -cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` -]) - - -# _LT_FILEUTILS_DEFAULTS -# ---------------------- -# It is okay to use these file commands and assume they have been set -# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. -m4_defun([_LT_FILEUTILS_DEFAULTS], -[: ${CP="cp -f"} -: ${MV="mv -f"} -: ${RM="rm -f"} -])# _LT_FILEUTILS_DEFAULTS - - -# _LT_SETUP -# --------- -m4_defun([_LT_SETUP], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl - -_LT_DECL([], [host_alias], [0], [The host system])dnl -_LT_DECL([], [host], [0])dnl -_LT_DECL([], [host_os], [0])dnl -dnl -_LT_DECL([], [build_alias], [0], [The build system])dnl -_LT_DECL([], [build], [0])dnl -_LT_DECL([], [build_os], [0])dnl -dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -dnl -AC_REQUIRE([AC_PROG_LN_S])dnl -test -z "$LN_S" && LN_S="ln -s" -_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl -dnl -AC_REQUIRE([LT_CMD_MAX_LEN])dnl -_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl -_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl -dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl -m4_require([_LT_CMD_RELOAD])dnl -m4_require([_LT_CHECK_MAGIC_METHOD])dnl -m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl -m4_require([_LT_CMD_OLD_ARCHIVE])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_WITH_SYSROOT])dnl - -_LT_CONFIG_LIBTOOL_INIT([ -# See if we are running on zsh, and set the options which allow our -# commands through without removal of \ escapes INIT. -if test -n "\${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi -]) -if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST -fi - -_LT_CHECK_OBJDIR - -m4_require([_LT_TAG_COMPILER])dnl - -case $host_os in -aix3*) - # AIX sometimes has problems with the GCC collect2 program. For some - # reason, if we set the COLLECT_NAMES environment variable, the problems - # vanish in a puff of smoke. - if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES - fi - ;; -esac - -# Global variables: -ofile=libtool -can_build_shared=yes - -# All known linkers require a `.a' archive for static linking (except MSVC, -# which needs '.lib'). -libext=a - -with_gnu_ld="$lt_cv_prog_gnu_ld" - -old_CC="$CC" -old_CFLAGS="$CFLAGS" - -# Set sane defaults for various variables -test -z "$CC" && CC=cc -test -z "$LTCC" && LTCC=$CC -test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS -test -z "$LD" && LD=ld -test -z "$ac_objext" && ac_objext=o - -_LT_CC_BASENAME([$compiler]) - -# Only perform the check for file, if the check method requires it -test -z "$MAGIC_CMD" && MAGIC_CMD=file -case $deplibs_check_method in -file_magic*) - if test "$file_magic_cmd" = '$MAGIC_CMD'; then - _LT_PATH_MAGIC - fi - ;; -esac - -# Use C for the default configuration in the libtool script -LT_SUPPORTED_TAG([CC]) -_LT_LANG_C_CONFIG -_LT_LANG_DEFAULT_CONFIG -_LT_CONFIG_COMMANDS -])# _LT_SETUP - - -# _LT_PREPARE_SED_QUOTE_VARS -# -------------------------- -# Define a few sed substitution that help us do robust quoting. -m4_defun([_LT_PREPARE_SED_QUOTE_VARS], -[# Backslashify metacharacters that are still active within -# double-quoted strings. -sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' - -# Same as above, but do not quote variable references. -double_quote_subst='s/\([["`\\]]\)/\\\1/g' - -# Sed substitution to delay expansion of an escaped shell variable in a -# double_quote_subst'ed string. -delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' - -# Sed substitution to delay expansion of an escaped single quote. -delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' - -# Sed substitution to avoid accidental globbing in evaled expressions -no_glob_subst='s/\*/\\\*/g' -]) - -# _LT_PROG_LTMAIN -# --------------- -# Note that this code is called both from `configure', and `config.status' -# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, -# `config.status' has no value for ac_aux_dir unless we are using Automake, -# so we pass a copy along to make sure it has a sensible value anyway. -m4_defun([_LT_PROG_LTMAIN], -[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl -_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) -ltmain="$ac_aux_dir/ltmain.sh" -])# _LT_PROG_LTMAIN - - -## ------------------------------------- ## -## Accumulate code for creating libtool. ## -## ------------------------------------- ## - -# So that we can recreate a full libtool script including additional -# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS -# in macros and then make a single call at the end using the `libtool' -# label. - - -# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) -# ---------------------------------------- -# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL_INIT], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_INIT], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_INIT]) - - -# _LT_CONFIG_LIBTOOL([COMMANDS]) -# ------------------------------ -# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. -m4_define([_LT_CONFIG_LIBTOOL], -[m4_ifval([$1], - [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], - [$1 -])])]) - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) - - -# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) -# ----------------------------------------------------- -m4_defun([_LT_CONFIG_SAVE_COMMANDS], -[_LT_CONFIG_LIBTOOL([$1]) -_LT_CONFIG_LIBTOOL_INIT([$2]) -]) - - -# _LT_FORMAT_COMMENT([COMMENT]) -# ----------------------------- -# Add leading comment marks to the start of each line, and a trailing -# full-stop to the whole comment if one is not present already. -m4_define([_LT_FORMAT_COMMENT], -[m4_ifval([$1], [ -m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], - [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) -)]) - - - -## ------------------------ ## -## FIXME: Eliminate VARNAME ## -## ------------------------ ## - - -# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) -# ------------------------------------------------------------------- -# CONFIGNAME is the name given to the value in the libtool script. -# VARNAME is the (base) name used in the configure script. -# VALUE may be 0, 1 or 2 for a computed quote escaped value based on -# VARNAME. Any other value will be used directly. -m4_define([_LT_DECL], -[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], - [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], - [m4_ifval([$1], [$1], [$2])]) - lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) - m4_ifval([$4], - [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) - lt_dict_add_subkey([lt_decl_dict], [$2], - [tagged?], [m4_ifval([$5], [yes], [no])])]) -]) - - -# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) -# -------------------------------------------------------- -m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) - - -# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_tag_varnames], -[_lt_decl_filter([tagged?], [yes], $@)]) - - -# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) -# --------------------------------------------------------- -m4_define([_lt_decl_filter], -[m4_case([$#], - [0], [m4_fatal([$0: too few arguments: $#])], - [1], [m4_fatal([$0: too few arguments: $#: $1])], - [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], - [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], - [lt_dict_filter([lt_decl_dict], $@)])[]dnl -]) - - -# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) -# -------------------------------------------------- -m4_define([lt_decl_quote_varnames], -[_lt_decl_filter([value], [1], $@)]) - - -# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_dquote_varnames], -[_lt_decl_filter([value], [2], $@)]) - - -# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) -# --------------------------------------------------- -m4_define([lt_decl_varnames_tagged], -[m4_assert([$# <= 2])dnl -_$0(m4_quote(m4_default([$1], [[, ]])), - m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), - m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) -m4_define([_lt_decl_varnames_tagged], -[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) - - -# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) -# ------------------------------------------------ -m4_define([lt_decl_all_varnames], -[_$0(m4_quote(m4_default([$1], [[, ]])), - m4_if([$2], [], - m4_quote(lt_decl_varnames), - m4_quote(m4_shift($@))))[]dnl -]) -m4_define([_lt_decl_all_varnames], -[lt_join($@, lt_decl_varnames_tagged([$1], - lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl -]) - - -# _LT_CONFIG_STATUS_DECLARE([VARNAME]) -# ------------------------------------ -# Quote a variable value, and forward it to `config.status' so that its -# declaration there will have the same value as in `configure'. VARNAME -# must have a single quote delimited value for this to work. -m4_define([_LT_CONFIG_STATUS_DECLARE], -[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) - - -# _LT_CONFIG_STATUS_DECLARATIONS -# ------------------------------ -# We delimit libtool config variables with single quotes, so when -# we write them to config.status, we have to be sure to quote all -# embedded single quotes properly. In configure, this macro expands -# each variable declared with _LT_DECL (and _LT_TAGDECL) into: -# -# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' -m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], -[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), - [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAGS -# ---------------- -# Output comment and list of tags supported by the script -m4_defun([_LT_LIBTOOL_TAGS], -[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl -available_tags="_LT_TAGS"dnl -]) - - -# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) -# ----------------------------------- -# Extract the dictionary values for VARNAME (optionally with TAG) and -# expand to a commented shell variable setting: -# -# # Some comment about what VAR is for. -# visible_name=$lt_internal_name -m4_define([_LT_LIBTOOL_DECLARE], -[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], - [description])))[]dnl -m4_pushdef([_libtool_name], - m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl -m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), - [0], [_libtool_name=[$]$1], - [1], [_libtool_name=$lt_[]$1], - [2], [_libtool_name=$lt_[]$1], - [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl -m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl -]) - - -# _LT_LIBTOOL_CONFIG_VARS -# ----------------------- -# Produce commented declarations of non-tagged libtool config variables -# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' -# script. Tagged libtool config variables (even for the LIBTOOL CONFIG -# section) are produced by _LT_LIBTOOL_TAG_VARS. -m4_defun([_LT_LIBTOOL_CONFIG_VARS], -[m4_foreach([_lt_var], - m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) - - -# _LT_LIBTOOL_TAG_VARS(TAG) -# ------------------------- -m4_define([_LT_LIBTOOL_TAG_VARS], -[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), - [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) - - -# _LT_TAGVAR(VARNAME, [TAGNAME]) -# ------------------------------ -m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) - - -# _LT_CONFIG_COMMANDS -# ------------------- -# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of -# variables for single and double quote escaping we saved from calls -# to _LT_DECL, we can put quote escaped variables declarations -# into `config.status', and then the shell code to quote escape them in -# for loops in `config.status'. Finally, any additional code accumulated -# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. -m4_defun([_LT_CONFIG_COMMANDS], -[AC_PROVIDE_IFELSE([LT_OUTPUT], - dnl If the libtool generation code has been placed in $CONFIG_LT, - dnl instead of duplicating it all over again into config.status, - dnl then we will have config.status run $CONFIG_LT later, so it - dnl needs to know what name is stored there: - [AC_CONFIG_COMMANDS([libtool], - [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], - dnl If the libtool generation code is destined for config.status, - dnl expand the accumulated commands and init code now: - [AC_CONFIG_COMMANDS([libtool], - [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) -])#_LT_CONFIG_COMMANDS - - -# Initialize. -m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], -[ - -# The HP-UX ksh and POSIX shell print the target directory to stdout -# if CDPATH is set. -(unset CDPATH) >/dev/null 2>&1 && unset CDPATH - -sed_quote_subst='$sed_quote_subst' -double_quote_subst='$double_quote_subst' -delay_variable_subst='$delay_variable_subst' -_LT_CONFIG_STATUS_DECLARATIONS -LTCC='$LTCC' -LTCFLAGS='$LTCFLAGS' -compiler='$compiler_DEFAULT' - -# A function that is used when there is no print builtin or printf. -func_fallback_echo () -{ - eval 'cat <<_LTECHO_EOF -\$[]1 -_LTECHO_EOF' -} - -# Quote evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_quote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -# Double-quote double-evaled strings. -for var in lt_decl_all_varnames([[ \ -]], lt_decl_dquote_varnames); do - case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in - *[[\\\\\\\`\\"\\\$]]*) - eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" - ;; - *) - eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" - ;; - esac -done - -_LT_OUTPUT_LIBTOOL_INIT -]) - -# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) -# ------------------------------------ -# Generate a child script FILE with all initialization necessary to -# reuse the environment learned by the parent script, and make the -# file executable. If COMMENT is supplied, it is inserted after the -# `#!' sequence but before initialization text begins. After this -# macro, additional text can be appended to FILE to form the body of -# the child script. The macro ends with non-zero status if the -# file could not be fully written (such as if the disk is full). -m4_ifdef([AS_INIT_GENERATED], -[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], -[m4_defun([_LT_GENERATED_FILE_INIT], -[m4_require([AS_PREPARE])]dnl -[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl -[lt_write_fail=0 -cat >$1 <<_ASEOF || lt_write_fail=1 -#! $SHELL -# Generated by $as_me. -$2 -SHELL=\${CONFIG_SHELL-$SHELL} -export SHELL -_ASEOF -cat >>$1 <<\_ASEOF || lt_write_fail=1 -AS_SHELL_SANITIZE -_AS_PREPARE -exec AS_MESSAGE_FD>&1 -_ASEOF -test $lt_write_fail = 0 && chmod +x $1[]dnl -m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT - -# LT_OUTPUT -# --------- -# This macro allows early generation of the libtool script (before -# AC_OUTPUT is called), incase it is used in configure for compilation -# tests. -AC_DEFUN([LT_OUTPUT], -[: ${CONFIG_LT=./config.lt} -AC_MSG_NOTICE([creating $CONFIG_LT]) -_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], -[# Run this file to recreate a libtool stub with the current configuration.]) - -cat >>"$CONFIG_LT" <<\_LTEOF -lt_cl_silent=false -exec AS_MESSAGE_LOG_FD>>config.log -{ - echo - AS_BOX([Running $as_me.]) -} >&AS_MESSAGE_LOG_FD - -lt_cl_help="\ -\`$as_me' creates a local libtool stub from the current configuration, -for use in further configure time tests before the real libtool is -generated. - -Usage: $[0] [[OPTIONS]] - - -h, --help print this help, then exit - -V, --version print version number, then exit - -q, --quiet do not print progress messages - -d, --debug don't remove temporary files - -Report bugs to ." - -lt_cl_version="\ -m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl -m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) -configured by $[0], generated by m4_PACKAGE_STRING. - -Copyright (C) 2010 Free Software Foundation, Inc. -This config.lt script is free software; the Free Software Foundation -gives unlimited permision to copy, distribute and modify it." - -while test $[#] != 0 -do - case $[1] in - --version | --v* | -V ) - echo "$lt_cl_version"; exit 0 ;; - --help | --h* | -h ) - echo "$lt_cl_help"; exit 0 ;; - --debug | --d* | -d ) - debug=: ;; - --quiet | --q* | --silent | --s* | -q ) - lt_cl_silent=: ;; - - -*) AC_MSG_ERROR([unrecognized option: $[1] -Try \`$[0] --help' for more information.]) ;; - - *) AC_MSG_ERROR([unrecognized argument: $[1] -Try \`$[0] --help' for more information.]) ;; - esac - shift -done - -if $lt_cl_silent; then - exec AS_MESSAGE_FD>/dev/null -fi -_LTEOF - -cat >>"$CONFIG_LT" <<_LTEOF -_LT_OUTPUT_LIBTOOL_COMMANDS_INIT -_LTEOF - -cat >>"$CONFIG_LT" <<\_LTEOF -AC_MSG_NOTICE([creating $ofile]) -_LT_OUTPUT_LIBTOOL_COMMANDS -AS_EXIT(0) -_LTEOF -chmod +x "$CONFIG_LT" - -# configure is writing to config.log, but config.lt does its own redirection, -# appending to config.log, which fails on DOS, as config.log is still kept -# open by configure. Here we exec the FD to /dev/null, effectively closing -# config.log, so it can be properly (re)opened and appended to by config.lt. -lt_cl_success=: -test "$silent" = yes && - lt_config_lt_args="$lt_config_lt_args --quiet" -exec AS_MESSAGE_LOG_FD>/dev/null -$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false -exec AS_MESSAGE_LOG_FD>>config.log -$lt_cl_success || AS_EXIT(1) -])# LT_OUTPUT - - -# _LT_CONFIG(TAG) -# --------------- -# If TAG is the built-in tag, create an initial libtool script with a -# default configuration from the untagged config vars. Otherwise add code -# to config.status for appending the configuration named by TAG from the -# matching tagged config vars. -m4_defun([_LT_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_CONFIG_SAVE_COMMANDS([ - m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl - m4_if(_LT_TAG, [C], [ - # See if we are running on zsh, and set the options which allow our - # commands through without removal of \ escapes. - if test -n "${ZSH_VERSION+set}" ; then - setopt NO_GLOB_SUBST - fi - - cfgfile="${ofile}T" - trap "$RM \"$cfgfile\"; exit 1" 1 2 15 - $RM "$cfgfile" - - cat <<_LT_EOF >> "$cfgfile" -#! $SHELL - -# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. -# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION -# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: -# NOTE: Changes made to this file will be lost: look at ltmain.sh. -# -_LT_COPYING -_LT_LIBTOOL_TAGS - -# ### BEGIN LIBTOOL CONFIG -_LT_LIBTOOL_CONFIG_VARS -_LT_LIBTOOL_TAG_VARS -# ### END LIBTOOL CONFIG - -_LT_EOF - - case $host_os in - aix3*) - cat <<\_LT_EOF >> "$cfgfile" -# AIX sometimes has problems with the GCC collect2 program. For some -# reason, if we set the COLLECT_NAMES environment variable, the problems -# vanish in a puff of smoke. -if test "X${COLLECT_NAMES+set}" != Xset; then - COLLECT_NAMES= - export COLLECT_NAMES -fi -_LT_EOF - ;; - esac - - _LT_PROG_LTMAIN - - # We use sed instead of cat because bash on DJGPP gets confused if - # if finds mixed CR/LF and LF-only lines. Since sed operates in - # text mode, it properly converts lines to CR/LF. This bash problem - # is reportedly fixed, but why not run on old versions too? - sed '$q' "$ltmain" >> "$cfgfile" \ - || (rm -f "$cfgfile"; exit 1) - - _LT_PROG_REPLACE_SHELLFNS - - mv -f "$cfgfile" "$ofile" || - (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") - chmod +x "$ofile" -], -[cat <<_LT_EOF >> "$ofile" - -dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded -dnl in a comment (ie after a #). -# ### BEGIN LIBTOOL TAG CONFIG: $1 -_LT_LIBTOOL_TAG_VARS(_LT_TAG) -# ### END LIBTOOL TAG CONFIG: $1 -_LT_EOF -])dnl /m4_if -], -[m4_if([$1], [], [ - PACKAGE='$PACKAGE' - VERSION='$VERSION' - TIMESTAMP='$TIMESTAMP' - RM='$RM' - ofile='$ofile'], []) -])dnl /_LT_CONFIG_SAVE_COMMANDS -])# _LT_CONFIG - - -# LT_SUPPORTED_TAG(TAG) -# --------------------- -# Trace this macro to discover what tags are supported by the libtool -# --tag option, using: -# autoconf --trace 'LT_SUPPORTED_TAG:$1' -AC_DEFUN([LT_SUPPORTED_TAG], []) - - -# C support is built-in for now -m4_define([_LT_LANG_C_enabled], []) -m4_define([_LT_TAGS], []) - - -# LT_LANG(LANG) -# ------------- -# Enable libtool support for the given language if not already enabled. -AC_DEFUN([LT_LANG], -[AC_BEFORE([$0], [LT_OUTPUT])dnl -m4_case([$1], - [C], [_LT_LANG(C)], - [C++], [_LT_LANG(CXX)], - [Java], [_LT_LANG(GCJ)], - [Fortran 77], [_LT_LANG(F77)], - [Fortran], [_LT_LANG(FC)], - [Windows Resource], [_LT_LANG(RC)], - [m4_ifdef([_LT_LANG_]$1[_CONFIG], - [_LT_LANG($1)], - [m4_fatal([$0: unsupported language: "$1"])])])dnl -])# LT_LANG - - -# _LT_LANG(LANGNAME) -# ------------------ -m4_defun([_LT_LANG], -[m4_ifdef([_LT_LANG_]$1[_enabled], [], - [LT_SUPPORTED_TAG([$1])dnl - m4_append([_LT_TAGS], [$1 ])dnl - m4_define([_LT_LANG_]$1[_enabled], [])dnl - _LT_LANG_$1_CONFIG($1)])dnl -])# _LT_LANG - - -# _LT_LANG_DEFAULT_CONFIG -# ----------------------- -m4_defun([_LT_LANG_DEFAULT_CONFIG], -[AC_PROVIDE_IFELSE([AC_PROG_CXX], - [LT_LANG(CXX)], - [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) - -AC_PROVIDE_IFELSE([AC_PROG_F77], - [LT_LANG(F77)], - [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) - -AC_PROVIDE_IFELSE([AC_PROG_FC], - [LT_LANG(FC)], - [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) - -dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal -dnl pulling things in needlessly. -AC_PROVIDE_IFELSE([AC_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], - [LT_LANG(GCJ)], - [AC_PROVIDE_IFELSE([LT_PROG_GCJ], - [LT_LANG(GCJ)], - [m4_ifdef([AC_PROG_GCJ], - [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([A][M_PROG_GCJ], - [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) - m4_ifdef([LT_PROG_GCJ], - [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) - -AC_PROVIDE_IFELSE([LT_PROG_RC], - [LT_LANG(RC)], - [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) -])# _LT_LANG_DEFAULT_CONFIG - -# Obsolete macros: -AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) -AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) -AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) -AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) -AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_CXX], []) -dnl AC_DEFUN([AC_LIBTOOL_F77], []) -dnl AC_DEFUN([AC_LIBTOOL_FC], []) -dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) -dnl AC_DEFUN([AC_LIBTOOL_RC], []) - - -# _LT_TAG_COMPILER -# ---------------- -m4_defun([_LT_TAG_COMPILER], -[AC_REQUIRE([AC_PROG_CC])dnl - -_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl -_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl -_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl -_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl - -# If no C compiler was specified, use CC. -LTCC=${LTCC-"$CC"} - -# If no C compiler flags were specified, use CFLAGS. -LTCFLAGS=${LTCFLAGS-"$CFLAGS"} - -# Allow CC to be a program name with arguments. -compiler=$CC -])# _LT_TAG_COMPILER - - -# _LT_COMPILER_BOILERPLATE -# ------------------------ -# Check for compiler boilerplate output or warnings with -# the simple compiler test code. -m4_defun([_LT_COMPILER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_compile_test_code" >conftest.$ac_ext -eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_compiler_boilerplate=`cat conftest.err` -$RM conftest* -])# _LT_COMPILER_BOILERPLATE - - -# _LT_LINKER_BOILERPLATE -# ---------------------- -# Check for linker boilerplate output or warnings with -# the simple link test code. -m4_defun([_LT_LINKER_BOILERPLATE], -[m4_require([_LT_DECL_SED])dnl -ac_outfile=conftest.$ac_objext -echo "$lt_simple_link_test_code" >conftest.$ac_ext -eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err -_lt_linker_boilerplate=`cat conftest.err` -$RM -r conftest* -])# _LT_LINKER_BOILERPLATE - -# _LT_REQUIRED_DARWIN_CHECKS -# ------------------------- -m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ - case $host_os in - rhapsody* | darwin*) - AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) - AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) - AC_CHECK_TOOL([LIPO], [lipo], [:]) - AC_CHECK_TOOL([OTOOL], [otool], [:]) - AC_CHECK_TOOL([OTOOL64], [otool64], [:]) - _LT_DECL([], [DSYMUTIL], [1], - [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) - _LT_DECL([], [NMEDIT], [1], - [Tool to change global to local symbols on Mac OS X]) - _LT_DECL([], [LIPO], [1], - [Tool to manipulate fat objects and archives on Mac OS X]) - _LT_DECL([], [OTOOL], [1], - [ldd/readelf like tool for Mach-O binaries on Mac OS X]) - _LT_DECL([], [OTOOL64], [1], - [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) - - AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], - [lt_cv_apple_cc_single_mod=no - if test -z "${LT_MULTI_MODULE}"; then - # By default we will add the -single_module flag. You can override - # by either setting the environment variable LT_MULTI_MODULE - # non-empty at configure time, or by adding -multi_module to the - # link flags. - rm -rf libconftest.dylib* - echo "int foo(void){return 1;}" > conftest.c - echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ --dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ - -dynamiclib -Wl,-single_module conftest.c 2>conftest.err - _lt_result=$? - if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then - lt_cv_apple_cc_single_mod=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -rf libconftest.dylib* - rm -f conftest.* - fi]) - AC_CACHE_CHECK([for -exported_symbols_list linker flag], - [lt_cv_ld_exported_symbols_list], - [lt_cv_ld_exported_symbols_list=no - save_LDFLAGS=$LDFLAGS - echo "_main" > conftest.sym - LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [lt_cv_ld_exported_symbols_list=yes], - [lt_cv_ld_exported_symbols_list=no]) - LDFLAGS="$save_LDFLAGS" - ]) - AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], - [lt_cv_ld_force_load=no - cat > conftest.c << _LT_EOF -int forced_loaded() { return 2;} -_LT_EOF - echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD - echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD - $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD - echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD - $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD - cat > conftest.c << _LT_EOF -int main() { return 0;} -_LT_EOF - echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD - $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err - _lt_result=$? - if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then - lt_cv_ld_force_load=yes - else - cat conftest.err >&AS_MESSAGE_LOG_FD - fi - rm -f conftest.err libconftest.a conftest conftest.c - rm -rf conftest.dSYM - ]) - case $host_os in - rhapsody* | darwin1.[[012]]) - _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; - darwin1.*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - darwin*) # darwin 5.x on - # if running on 10.5 or later, the deployment target defaults - # to the OS version, if on x86, and 10.4, the deployment - # target defaults to 10.4. Don't you love it? - case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in - 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - 10.[[012]]*) - _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; - 10.*) - _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; - esac - ;; - esac - if test "$lt_cv_apple_cc_single_mod" = "yes"; then - _lt_dar_single_mod='$single_module' - fi - if test "$lt_cv_ld_exported_symbols_list" = "yes"; then - _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' - else - _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' - fi - if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then - _lt_dsymutil='~$DSYMUTIL $lib || :' - else - _lt_dsymutil= - fi - ;; - esac -]) - - -# _LT_DARWIN_LINKER_FEATURES -# -------------------------- -# Checks for linker and compiler features on darwin -m4_defun([_LT_DARWIN_LINKER_FEATURES], -[ - m4_require([_LT_REQUIRED_DARWIN_CHECKS]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_automatic, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - if test "$lt_cv_ld_force_load" = "yes"; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='' - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" - case $cc_basename in - ifort*) _lt_dar_can_shared=yes ;; - *) _lt_dar_can_shared=$GCC ;; - esac - if test "$_lt_dar_can_shared" = "yes"; then - output_verbose_link_cmd=func_echo_all - _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" - _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" - _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" - m4_if([$1], [CXX], -[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then - _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" - _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" - fi -],[]) - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi -]) - -# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) -# ---------------------------------- -# Links a minimal program and checks the executable -# for the system default hardcoded library path. In most cases, -# this is /usr/lib:/lib, but when the MPI compilers are used -# the location of the communication and MPI libs are included too. -# If we don't find anything, use the default library path according -# to the aix ld manual. -# Store the results from the different compilers for each TAGNAME. -# Allow to override them for all tags through lt_cv_aix_libpath. -m4_defun([_LT_SYS_MODULE_PATH_AIX], -[m4_require([_LT_DECL_SED])dnl -if test "${lt_cv_aix_libpath+set}" = set; then - aix_libpath=$lt_cv_aix_libpath -else - AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], - [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ - lt_aix_libpath_sed='[ - /Import File Strings/,/^$/ { - /^0/ { - s/^0 *\([^ ]*\) *$/\1/ - p - } - }]' - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - # Check for a 64-bit object if we didn't find anything. - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` - fi],[]) - if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then - _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" - fi - ]) - aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) -fi -])# _LT_SYS_MODULE_PATH_AIX - - -# _LT_SHELL_INIT(ARG) -# ------------------- -m4_define([_LT_SHELL_INIT], -[m4_divert_text([M4SH-INIT], [$1 -])])# _LT_SHELL_INIT - - - -# _LT_PROG_ECHO_BACKSLASH -# ----------------------- -# Find how we can fake an echo command that does not interpret backslash. -# In particular, with Autoconf 2.60 or later we add some code to the start -# of the generated configure script which will find a shell with a builtin -# printf (which we can use as an echo command). -m4_defun([_LT_PROG_ECHO_BACKSLASH], -[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO -ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - -AC_MSG_CHECKING([how to print strings]) -# Test print first, because it will be a builtin if present. -if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ - test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='print -r --' -elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then - ECHO='printf %s\n' -else - # Use this function as a fallback that always works. - func_fallback_echo () - { - eval 'cat <<_LTECHO_EOF -$[]1 -_LTECHO_EOF' - } - ECHO='func_fallback_echo' -fi - -# func_echo_all arg... -# Invoke $ECHO with all args, space-separated. -func_echo_all () -{ - $ECHO "$*" -} - -case "$ECHO" in - printf*) AC_MSG_RESULT([printf]) ;; - print*) AC_MSG_RESULT([print -r]) ;; - *) AC_MSG_RESULT([cat]) ;; -esac - -m4_ifdef([_AS_DETECT_SUGGESTED], -[_AS_DETECT_SUGGESTED([ - test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( - ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO - ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO - PATH=/empty FPATH=/empty; export PATH FPATH - test "X`printf %s $ECHO`" = "X$ECHO" \ - || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) - -_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) -_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) -])# _LT_PROG_ECHO_BACKSLASH - - -# _LT_WITH_SYSROOT -# ---------------- -AC_DEFUN([_LT_WITH_SYSROOT], -[AC_MSG_CHECKING([for sysroot]) -AC_ARG_WITH([sysroot], -[ --with-sysroot[=DIR] Search for dependent libraries within DIR - (or the compiler's sysroot if not specified).], -[], [with_sysroot=no]) - -dnl lt_sysroot will always be passed unquoted. We quote it here -dnl in case the user passed a directory name. -lt_sysroot= -case ${with_sysroot} in #( - yes) - if test "$GCC" = yes; then - lt_sysroot=`$CC --print-sysroot 2>/dev/null` - fi - ;; #( - /*) - lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` - ;; #( - no|'') - ;; #( - *) - AC_MSG_RESULT([${with_sysroot}]) - AC_MSG_ERROR([The sysroot must be an absolute path.]) - ;; -esac - - AC_MSG_RESULT([${lt_sysroot:-no}]) -_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl -[dependent libraries, and in which our libraries should be installed.])]) - -# _LT_ENABLE_LOCK -# --------------- -m4_defun([_LT_ENABLE_LOCK], -[AC_ARG_ENABLE([libtool-lock], - [AS_HELP_STRING([--disable-libtool-lock], - [avoid locking (might break parallel builds)])]) -test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes - -# Some flags need to be propagated to the compiler or linker for good -# libtool support. -case $host in -ia64-*-hpux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.$ac_objext` in - *ELF-32*) - HPUX_IA64_MODE="32" - ;; - *ELF-64*) - HPUX_IA64_MODE="64" - ;; - esac - fi - rm -rf conftest* - ;; -*-*-irix6*) - # Find out which ABI we are using. - echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - if test "$lt_cv_prog_gnu_ld" = yes; then - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -melf32bsmip" - ;; - *N32*) - LD="${LD-ld} -melf32bmipn32" - ;; - *64-bit*) - LD="${LD-ld} -melf64bmip" - ;; - esac - else - case `/usr/bin/file conftest.$ac_objext` in - *32-bit*) - LD="${LD-ld} -32" - ;; - *N32*) - LD="${LD-ld} -n32" - ;; - *64-bit*) - LD="${LD-ld} -64" - ;; - esac - fi - fi - rm -rf conftest* - ;; - -x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ -s390*-*linux*|s390*-*tpf*|sparc*-*linux*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *32-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_i386_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_i386" - ;; - ppc64-*linux*|powerpc64-*linux*) - LD="${LD-ld} -m elf32ppclinux" - ;; - s390x-*linux*) - LD="${LD-ld} -m elf_s390" - ;; - sparc64-*linux*) - LD="${LD-ld} -m elf32_sparc" - ;; - esac - ;; - *64-bit*) - case $host in - x86_64-*kfreebsd*-gnu) - LD="${LD-ld} -m elf_x86_64_fbsd" - ;; - x86_64-*linux*) - LD="${LD-ld} -m elf_x86_64" - ;; - ppc*-*linux*|powerpc*-*linux*) - LD="${LD-ld} -m elf64ppc" - ;; - s390*-*linux*|s390*-*tpf*) - LD="${LD-ld} -m elf64_s390" - ;; - sparc*-*linux*) - LD="${LD-ld} -m elf64_sparc" - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; - -*-*-sco3.2v5*) - # On SCO OpenServer 5, we need -belf to get full-featured binaries. - SAVE_CFLAGS="$CFLAGS" - CFLAGS="$CFLAGS -belf" - AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, - [AC_LANG_PUSH(C) - AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) - AC_LANG_POP]) - if test x"$lt_cv_cc_needs_belf" != x"yes"; then - # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf - CFLAGS="$SAVE_CFLAGS" - fi - ;; -sparc*-*solaris*) - # Find out which ABI we are using. - echo 'int i;' > conftest.$ac_ext - if AC_TRY_EVAL(ac_compile); then - case `/usr/bin/file conftest.o` in - *64-bit*) - case $lt_cv_prog_gnu_ld in - yes*) LD="${LD-ld} -m elf64_sparc" ;; - *) - if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then - LD="${LD-ld} -64" - fi - ;; - esac - ;; - esac - fi - rm -rf conftest* - ;; -esac - -need_locks="$enable_libtool_lock" -])# _LT_ENABLE_LOCK - - -# _LT_PROG_AR -# ----------- -m4_defun([_LT_PROG_AR], -[AC_CHECK_TOOLS(AR, [ar], false) -: ${AR=ar} -: ${AR_FLAGS=cru} -_LT_DECL([], [AR], [1], [The archiver]) -_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) - -AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], - [lt_cv_ar_at_file=no - AC_COMPILE_IFELSE([AC_LANG_PROGRAM], - [echo conftest.$ac_objext > conftest.lst - lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -eq 0; then - # Ensure the archiver fails upon bogus file names. - rm -f conftest.$ac_objext libconftest.a - AC_TRY_EVAL([lt_ar_try]) - if test "$ac_status" -ne 0; then - lt_cv_ar_at_file=@ - fi - fi - rm -f conftest.* libconftest.a - ]) - ]) - -if test "x$lt_cv_ar_at_file" = xno; then - archiver_list_spec= -else - archiver_list_spec=$lt_cv_ar_at_file -fi -_LT_DECL([], [archiver_list_spec], [1], - [How to feed a file listing to the archiver]) -])# _LT_PROG_AR - - -# _LT_CMD_OLD_ARCHIVE -# ------------------- -m4_defun([_LT_CMD_OLD_ARCHIVE], -[_LT_PROG_AR - -AC_CHECK_TOOL(STRIP, strip, :) -test -z "$STRIP" && STRIP=: -_LT_DECL([], [STRIP], [1], [A symbol stripping program]) - -AC_CHECK_TOOL(RANLIB, ranlib, :) -test -z "$RANLIB" && RANLIB=: -_LT_DECL([], [RANLIB], [1], - [Commands used to install an old-style archive]) - -# Determine commands to create old-style static archives. -old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' -old_postinstall_cmds='chmod 644 $oldlib' -old_postuninstall_cmds= - -if test -n "$RANLIB"; then - case $host_os in - openbsd*) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" - ;; - *) - old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" - ;; - esac - old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" -fi - -case $host_os in - darwin*) - lock_old_archive_extraction=yes ;; - *) - lock_old_archive_extraction=no ;; -esac -_LT_DECL([], [old_postinstall_cmds], [2]) -_LT_DECL([], [old_postuninstall_cmds], [2]) -_LT_TAGDECL([], [old_archive_cmds], [2], - [Commands used to build an old-style archive]) -_LT_DECL([], [lock_old_archive_extraction], [0], - [Whether to use a lock for old archive extraction]) -])# _LT_CMD_OLD_ARCHIVE - - -# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------------------- -# Check whether the given compiler option works -AC_DEFUN([_LT_COMPILER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - lt_compiler_flag="$3" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - # The option is referenced via a variable to avoid confusing sed. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>conftest.err) - ac_status=$? - cat conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s "$ac_outfile"; then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings other than the usual output. - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - fi - $RM conftest* -]) - -if test x"[$]$2" = xyes; then - m4_if([$5], , :, [$5]) -else - m4_if([$6], , :, [$6]) -fi -])# _LT_COMPILER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) - - -# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, -# [ACTION-SUCCESS], [ACTION-FAILURE]) -# ---------------------------------------------------- -# Check whether the given linker option works -AC_DEFUN([_LT_LINKER_OPTION], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_SED])dnl -AC_CACHE_CHECK([$1], [$2], - [$2=no - save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS $3" - echo "$lt_simple_link_test_code" > conftest.$ac_ext - if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then - # The linker can only warn and ignore the option if not recognized - # So say no if there are warnings - if test -s conftest.err; then - # Append any errors to the config.log. - cat conftest.err 1>&AS_MESSAGE_LOG_FD - $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp - $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 - if diff conftest.exp conftest.er2 >/dev/null; then - $2=yes - fi - else - $2=yes - fi - fi - $RM -r conftest* - LDFLAGS="$save_LDFLAGS" -]) - -if test x"[$]$2" = xyes; then - m4_if([$4], , :, [$4]) -else - m4_if([$5], , :, [$5]) -fi -])# _LT_LINKER_OPTION - -# Old name: -AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) - - -# LT_CMD_MAX_LEN -#--------------- -AC_DEFUN([LT_CMD_MAX_LEN], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -# find the maximum length of command line arguments -AC_MSG_CHECKING([the maximum length of command line arguments]) -AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl - i=0 - teststring="ABCD" - - case $build_os in - msdosdjgpp*) - # On DJGPP, this test can blow up pretty badly due to problems in libc - # (any single argument exceeding 2000 bytes causes a buffer overrun - # during glob expansion). Even if it were fixed, the result of this - # check would be larger than it should be. - lt_cv_sys_max_cmd_len=12288; # 12K is about right - ;; - - gnu*) - # Under GNU Hurd, this test is not required because there is - # no limit to the length of command line arguments. - # Libtool will interpret -1 as no limit whatsoever - lt_cv_sys_max_cmd_len=-1; - ;; - - cygwin* | mingw* | cegcc*) - # On Win9x/ME, this test blows up -- it succeeds, but takes - # about 5 minutes as the teststring grows exponentially. - # Worse, since 9x/ME are not pre-emptively multitasking, - # you end up with a "frozen" computer, even though with patience - # the test eventually succeeds (with a max line length of 256k). - # Instead, let's just punt: use the minimum linelength reported by - # all of the supported platforms: 8192 (on NT/2K/XP). - lt_cv_sys_max_cmd_len=8192; - ;; - - mint*) - # On MiNT this can take a long time and run out of memory. - lt_cv_sys_max_cmd_len=8192; - ;; - - amigaos*) - # On AmigaOS with pdksh, this test takes hours, literally. - # So we just punt and use a minimum line length of 8192. - lt_cv_sys_max_cmd_len=8192; - ;; - - netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) - # This has been around since 386BSD, at least. Likely further. - if test -x /sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` - elif test -x /usr/sbin/sysctl; then - lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` - else - lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs - fi - # And add a safety zone - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - ;; - - interix*) - # We know the value 262144 and hardcode it with a safety zone (like BSD) - lt_cv_sys_max_cmd_len=196608 - ;; - - osf*) - # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure - # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not - # nice to cause kernel panics so lets avoid the loop below. - # First set a reasonable default. - lt_cv_sys_max_cmd_len=16384 - # - if test -x /sbin/sysconfig; then - case `/sbin/sysconfig -q proc exec_disable_arg_limit` in - *1*) lt_cv_sys_max_cmd_len=-1 ;; - esac - fi - ;; - sco3.2v5*) - lt_cv_sys_max_cmd_len=102400 - ;; - sysv5* | sco5v6* | sysv4.2uw2*) - kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` - if test -n "$kargmax"; then - lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` - else - lt_cv_sys_max_cmd_len=32768 - fi - ;; - *) - lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` - if test -n "$lt_cv_sys_max_cmd_len"; then - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` - else - # Make teststring a little bigger before we do anything with it. - # a 1K string should be a reasonable start. - for i in 1 2 3 4 5 6 7 8 ; do - teststring=$teststring$teststring - done - SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} - # If test is not a shell built-in, we'll probably end up computing a - # maximum length that is only half of the actual maximum length, but - # we can't tell. - while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ - = "X$teststring$teststring"; } >/dev/null 2>&1 && - test $i != 17 # 1/2 MB should be enough - do - i=`expr $i + 1` - teststring=$teststring$teststring - done - # Only check the string length outside the loop. - lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` - teststring= - # Add a significant safety factor because C++ compilers can tack on - # massive amounts of additional arguments before passing them to the - # linker. It appears as though 1/2 is a usable value. - lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` - fi - ;; - esac -]) -if test -n $lt_cv_sys_max_cmd_len ; then - AC_MSG_RESULT($lt_cv_sys_max_cmd_len) -else - AC_MSG_RESULT(none) -fi -max_cmd_len=$lt_cv_sys_max_cmd_len -_LT_DECL([], [max_cmd_len], [0], - [What is the maximum length of a command?]) -])# LT_CMD_MAX_LEN - -# Old name: -AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) - - -# _LT_HEADER_DLFCN -# ---------------- -m4_defun([_LT_HEADER_DLFCN], -[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl -])# _LT_HEADER_DLFCN - - -# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, -# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) -# ---------------------------------------------------------------- -m4_defun([_LT_TRY_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "$cross_compiling" = yes; then : - [$4] -else - lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 - lt_status=$lt_dlunknown - cat > conftest.$ac_ext <<_LT_EOF -[#line $LINENO "configure" -#include "confdefs.h" - -#if HAVE_DLFCN_H -#include -#endif - -#include - -#ifdef RTLD_GLOBAL -# define LT_DLGLOBAL RTLD_GLOBAL -#else -# ifdef DL_GLOBAL -# define LT_DLGLOBAL DL_GLOBAL -# else -# define LT_DLGLOBAL 0 -# endif -#endif - -/* We may have to define LT_DLLAZY_OR_NOW in the command line if we - find out it does not work in some platform. */ -#ifndef LT_DLLAZY_OR_NOW -# ifdef RTLD_LAZY -# define LT_DLLAZY_OR_NOW RTLD_LAZY -# else -# ifdef DL_LAZY -# define LT_DLLAZY_OR_NOW DL_LAZY -# else -# ifdef RTLD_NOW -# define LT_DLLAZY_OR_NOW RTLD_NOW -# else -# ifdef DL_NOW -# define LT_DLLAZY_OR_NOW DL_NOW -# else -# define LT_DLLAZY_OR_NOW 0 -# endif -# endif -# endif -# endif -#endif - -/* When -fvisbility=hidden is used, assume the code has been annotated - correspondingly for the symbols needed. */ -#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) -int fnord () __attribute__((visibility("default"))); -#endif - -int fnord () { return 42; } -int main () -{ - void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); - int status = $lt_dlunknown; - - if (self) - { - if (dlsym (self,"fnord")) status = $lt_dlno_uscore; - else - { - if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; - else puts (dlerror ()); - } - /* dlclose (self); */ - } - else - puts (dlerror ()); - - return status; -}] -_LT_EOF - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then - (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null - lt_status=$? - case x$lt_status in - x$lt_dlno_uscore) $1 ;; - x$lt_dlneed_uscore) $2 ;; - x$lt_dlunknown|x*) $3 ;; - esac - else : - # compilation failed - $3 - fi -fi -rm -fr conftest* -])# _LT_TRY_DLOPEN_SELF - - -# LT_SYS_DLOPEN_SELF -# ------------------ -AC_DEFUN([LT_SYS_DLOPEN_SELF], -[m4_require([_LT_HEADER_DLFCN])dnl -if test "x$enable_dlopen" != xyes; then - enable_dlopen=unknown - enable_dlopen_self=unknown - enable_dlopen_self_static=unknown -else - lt_cv_dlopen=no - lt_cv_dlopen_libs= - - case $host_os in - beos*) - lt_cv_dlopen="load_add_on" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ;; - - mingw* | pw32* | cegcc*) - lt_cv_dlopen="LoadLibrary" - lt_cv_dlopen_libs= - ;; - - cygwin*) - lt_cv_dlopen="dlopen" - lt_cv_dlopen_libs= - ;; - - darwin*) - # if libdl is installed we need to link against it - AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ - lt_cv_dlopen="dyld" - lt_cv_dlopen_libs= - lt_cv_dlopen_self=yes - ]) - ;; - - *) - AC_CHECK_FUNC([shl_load], - [lt_cv_dlopen="shl_load"], - [AC_CHECK_LIB([dld], [shl_load], - [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], - [AC_CHECK_FUNC([dlopen], - [lt_cv_dlopen="dlopen"], - [AC_CHECK_LIB([dl], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], - [AC_CHECK_LIB([svld], [dlopen], - [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], - [AC_CHECK_LIB([dld], [dld_link], - [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) - ]) - ]) - ]) - ]) - ]) - ;; - esac - - if test "x$lt_cv_dlopen" != xno; then - enable_dlopen=yes - else - enable_dlopen=no - fi - - case $lt_cv_dlopen in - dlopen) - save_CPPFLAGS="$CPPFLAGS" - test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" - - save_LDFLAGS="$LDFLAGS" - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" - - save_LIBS="$LIBS" - LIBS="$lt_cv_dlopen_libs $LIBS" - - AC_CACHE_CHECK([whether a program can dlopen itself], - lt_cv_dlopen_self, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, - lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) - ]) - - if test "x$lt_cv_dlopen_self" = xyes; then - wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" - AC_CACHE_CHECK([whether a statically linked program can dlopen itself], - lt_cv_dlopen_self_static, [dnl - _LT_TRY_DLOPEN_SELF( - lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, - lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) - ]) - fi - - CPPFLAGS="$save_CPPFLAGS" - LDFLAGS="$save_LDFLAGS" - LIBS="$save_LIBS" - ;; - esac - - case $lt_cv_dlopen_self in - yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; - *) enable_dlopen_self=unknown ;; - esac - - case $lt_cv_dlopen_self_static in - yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; - *) enable_dlopen_self_static=unknown ;; - esac -fi -_LT_DECL([dlopen_support], [enable_dlopen], [0], - [Whether dlopen is supported]) -_LT_DECL([dlopen_self], [enable_dlopen_self], [0], - [Whether dlopen of programs is supported]) -_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], - [Whether dlopen of statically linked programs is supported]) -])# LT_SYS_DLOPEN_SELF - -# Old name: -AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) - - -# _LT_COMPILER_C_O([TAGNAME]) -# --------------------------- -# Check to see if options -c and -o are simultaneously supported by compiler. -# This macro does not hard code the compiler like AC_PROG_CC_C_O. -m4_defun([_LT_COMPILER_C_O], -[m4_require([_LT_DECL_SED])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no - $RM -r conftest 2>/dev/null - mkdir conftest - cd conftest - mkdir out - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - lt_compiler_flag="-o out/conftest2.$ac_objext" - # Insert the option either (1) after the last *FLAGS variable, or - # (2) before a word containing "conftest.", or (3) at the end. - # Note that $ac_compile itself does not contain backslashes and begins - # with a dollar sign (not a hyphen), so the echo should work correctly. - lt_compile=`echo "$ac_compile" | $SED \ - -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ - -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ - -e 's:$: $lt_compiler_flag:'` - (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$lt_compile" 2>out/conftest.err) - ac_status=$? - cat out/conftest.err >&AS_MESSAGE_LOG_FD - echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD - if (exit $ac_status) && test -s out/conftest2.$ac_objext - then - # The compiler can only warn and ignore the option if not recognized - # So say no if there are warnings - $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp - $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 - if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then - _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - fi - fi - chmod u+w . 2>&AS_MESSAGE_LOG_FD - $RM conftest* - # SGI C++ compiler will create directory out/ii_files/ for - # template instantiation - test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files - $RM out/* && rmdir out - cd .. - $RM -r conftest - $RM conftest* -]) -_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], - [Does compiler simultaneously support -c and -o options?]) -])# _LT_COMPILER_C_O - - -# _LT_COMPILER_FILE_LOCKS([TAGNAME]) -# ---------------------------------- -# Check to see if we can do hard links to lock some files if needed -m4_defun([_LT_COMPILER_FILE_LOCKS], -[m4_require([_LT_ENABLE_LOCK])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -_LT_COMPILER_C_O([$1]) - -hard_links="nottested" -if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then - # do not overwrite the value of need_locks provided by the user - AC_MSG_CHECKING([if we can lock with hard links]) - hard_links=yes - $RM conftest* - ln conftest.a conftest.b 2>/dev/null && hard_links=no - touch conftest.a - ln conftest.a conftest.b 2>&5 || hard_links=no - ln conftest.a conftest.b 2>/dev/null && hard_links=no - AC_MSG_RESULT([$hard_links]) - if test "$hard_links" = no; then - AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) - need_locks=warn - fi -else - need_locks=no -fi -_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) -])# _LT_COMPILER_FILE_LOCKS - - -# _LT_CHECK_OBJDIR -# ---------------- -m4_defun([_LT_CHECK_OBJDIR], -[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], -[rm -f .libs 2>/dev/null -mkdir .libs 2>/dev/null -if test -d .libs; then - lt_cv_objdir=.libs -else - # MS-DOS does not allow filenames that begin with a dot. - lt_cv_objdir=_libs -fi -rmdir .libs 2>/dev/null]) -objdir=$lt_cv_objdir -_LT_DECL([], [objdir], [0], - [The name of the directory that contains temporary libtool files])dnl -m4_pattern_allow([LT_OBJDIR])dnl -AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", - [Define to the sub-directory in which libtool stores uninstalled libraries.]) -])# _LT_CHECK_OBJDIR - - -# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) -# -------------------------------------- -# Check hardcoding attributes. -m4_defun([_LT_LINKER_HARDCODE_LIBPATH], -[AC_MSG_CHECKING([how to hardcode library paths into programs]) -_LT_TAGVAR(hardcode_action, $1)= -if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || - test -n "$_LT_TAGVAR(runpath_var, $1)" || - test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then - - # We can hardcode non-existent directories. - if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && - # If the only mechanism to avoid hardcoding is shlibpath_var, we - # have to relink, otherwise we might link with an installed library - # when we should be linking with a yet-to-be-installed one - ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && - test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then - # Linking always hardcodes the temporary library directory. - _LT_TAGVAR(hardcode_action, $1)=relink - else - # We can link without hardcoding, and we can hardcode nonexisting dirs. - _LT_TAGVAR(hardcode_action, $1)=immediate - fi -else - # We cannot hardcode anything, or else we can only hardcode existing - # directories. - _LT_TAGVAR(hardcode_action, $1)=unsupported -fi -AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) - -if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || - test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then - # Fast installation is not supported - enable_fast_install=no -elif test "$shlibpath_overrides_runpath" = yes || - test "$enable_shared" = no; then - # Fast installation is not necessary - enable_fast_install=needless -fi -_LT_TAGDECL([], [hardcode_action], [0], - [How to hardcode a shared library path into an executable]) -])# _LT_LINKER_HARDCODE_LIBPATH - - -# _LT_CMD_STRIPLIB -# ---------------- -m4_defun([_LT_CMD_STRIPLIB], -[m4_require([_LT_DECL_EGREP]) -striplib= -old_striplib= -AC_MSG_CHECKING([whether stripping libraries is possible]) -if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then - test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" - test -z "$striplib" && striplib="$STRIP --strip-unneeded" - AC_MSG_RESULT([yes]) -else -# FIXME - insert some real tests, host_os isn't really good enough - case $host_os in - darwin*) - if test -n "$STRIP" ; then - striplib="$STRIP -x" - old_striplib="$STRIP -S" - AC_MSG_RESULT([yes]) - else - AC_MSG_RESULT([no]) - fi - ;; - *) - AC_MSG_RESULT([no]) - ;; - esac -fi -_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) -_LT_DECL([], [striplib], [1]) -])# _LT_CMD_STRIPLIB - - -# _LT_SYS_DYNAMIC_LINKER([TAG]) -# ----------------------------- -# PORTME Fill in your ld.so characteristics -m4_defun([_LT_SYS_DYNAMIC_LINKER], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_OBJDUMP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CHECK_SHELL_FEATURES])dnl -AC_MSG_CHECKING([dynamic linker characteristics]) -m4_if([$1], - [], [ -if test "$GCC" = yes; then - case $host_os in - darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; - *) lt_awk_arg="/^libraries:/" ;; - esac - case $host_os in - mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; - *) lt_sed_strip_eq="s,=/,/,g" ;; - esac - lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` - case $lt_search_path_spec in - *\;*) - # if the path contains ";" then we assume it to be the separator - # otherwise default to the standard path separator (i.e. ":") - it is - # assumed that no part of a normal pathname contains ";" but that should - # okay in the real world where ";" in dirpaths is itself problematic. - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` - ;; - *) - lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` - ;; - esac - # Ok, now we have the path, separated by spaces, we can step through it - # and add multilib dir if necessary. - lt_tmp_lt_search_path_spec= - lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` - for lt_sys_path in $lt_search_path_spec; do - if test -d "$lt_sys_path/$lt_multi_os_dir"; then - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" - else - test -d "$lt_sys_path" && \ - lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" - fi - done - lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' -BEGIN {RS=" "; FS="/|\n";} { - lt_foo=""; - lt_count=0; - for (lt_i = NF; lt_i > 0; lt_i--) { - if ($lt_i != "" && $lt_i != ".") { - if ($lt_i == "..") { - lt_count++; - } else { - if (lt_count == 0) { - lt_foo="/" $lt_i lt_foo; - } else { - lt_count--; - } - } - } - } - if (lt_foo != "") { lt_freq[[lt_foo]]++; } - if (lt_freq[[lt_foo]] == 1) { print lt_foo; } -}'` - # AWK program above erroneously prepends '/' to C:/dos/paths - # for these hosts. - case $host_os in - mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ - $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; - esac - sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` -else - sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" -fi]) -library_names_spec= -libname_spec='lib$name' -soname_spec= -shrext_cmds=".so" -postinstall_cmds= -postuninstall_cmds= -finish_cmds= -finish_eval= -shlibpath_var= -shlibpath_overrides_runpath=unknown -version_type=none -dynamic_linker="$host_os ld.so" -sys_lib_dlsearch_path_spec="/lib /usr/lib" -need_lib_prefix=unknown -hardcode_into_libs=no - -# when you set need_version to no, make sure it does not cause -set_version -# flags to be left without arguments -need_version=unknown - -case $host_os in -aix3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' - shlibpath_var=LIBPATH - - # AIX 3 has no versioning support, so we append a major version to the name. - soname_spec='${libname}${release}${shared_ext}$major' - ;; - -aix[[4-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - hardcode_into_libs=yes - if test "$host_cpu" = ia64; then - # AIX 5 supports IA64 - library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - else - # With GCC up to 2.95.x, collect2 would create an import file - # for dependence libraries. The import file would start with - # the line `#! .'. This would cause the generated library to - # depend on `.', always an invalid library. This was fixed in - # development snapshots of GCC prior to 3.0. - case $host_os in - aix4 | aix4.[[01]] | aix4.[[01]].*) - if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' - echo ' yes ' - echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then - : - else - can_build_shared=no - fi - ;; - esac - # AIX (on Power*) has no versioning support, so currently we can not hardcode correct - # soname into executable. Probably we can add versioning support to - # collect2, so additional links can be useful in future. - if test "$aix_use_runtimelinking" = yes; then - # If using run time linking (on AIX 4.2 or later) use lib.so - # instead of lib.a to let people know that these are not - # typical AIX shared libraries. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - else - # We preserve .a as extension for shared libraries through AIX4.2 - # and later when we are not doing run time linking. - library_names_spec='${libname}${release}.a $libname.a' - soname_spec='${libname}${release}${shared_ext}$major' - fi - shlibpath_var=LIBPATH - fi - ;; - -amigaos*) - case $host_cpu in - powerpc) - # Since July 2007 AmigaOS4 officially supports .so libraries. - # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - ;; - m68k) - library_names_spec='$libname.ixlibrary $libname.a' - # Create ${libname}_ixlibrary.a entries in /sys/libs. - finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' - ;; - esac - ;; - -beos*) - library_names_spec='${libname}${shared_ext}' - dynamic_linker="$host_os ld.so" - shlibpath_var=LIBRARY_PATH - ;; - -bsdi[[45]]*) - version_type=linux - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" - sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" - # the default ld.so.conf also contains /usr/contrib/lib and - # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow - # libtool to hard-code these into programs - ;; - -cygwin* | mingw* | pw32* | cegcc*) - version_type=windows - shrext_cmds=".dll" - need_version=no - need_lib_prefix=no - - case $GCC,$cc_basename in - yes,*) - # gcc - library_names_spec='$libname.dll.a' - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname~ - chmod a+x \$dldir/$dlname~ - if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then - eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; - fi' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - - case $host_os in - cygwin*) - # Cygwin DLLs use 'cyg' prefix rather than 'lib' - soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) - ;; - mingw* | cegcc*) - # MinGW DLLs use traditional 'lib' prefix - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - pw32*) - # pw32 DLLs use 'pw' prefix rather than 'lib' - library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - ;; - esac - dynamic_linker='Win32 ld.exe' - ;; - - *,cl*) - # Native MSVC - libname_spec='$name' - soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' - library_names_spec='${libname}.dll.lib' - - case $build_os in - mingw*) - sys_lib_search_path_spec= - lt_save_ifs=$IFS - IFS=';' - for lt_path in $LIB - do - IFS=$lt_save_ifs - # Let DOS variable expansion print the short 8.3 style file name. - lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` - sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" - done - IFS=$lt_save_ifs - # Convert to MSYS style. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` - ;; - cygwin*) - # Convert to unix form, then to dos form, then back to unix form - # but this time dos style (no spaces!) so that the unix form looks - # like /cygdrive/c/PROGRA~1:/cygdr... - sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` - sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` - sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - ;; - *) - sys_lib_search_path_spec="$LIB" - if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then - # It is most probably a Windows format PATH. - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` - else - sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` - fi - # FIXME: find the short name or the path components, as spaces are - # common. (e.g. "Program Files" -> "PROGRA~1") - ;; - esac - - # DLL is installed to $(libdir)/../bin by postinstall_cmds - postinstall_cmds='base_file=`basename \${file}`~ - dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ - dldir=$destdir/`dirname \$dlpath`~ - test -d \$dldir || mkdir -p \$dldir~ - $install_prog $dir/$dlname \$dldir/$dlname' - postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ - dlpath=$dir/\$dldll~ - $RM \$dlpath' - shlibpath_overrides_runpath=yes - dynamic_linker='Win32 link.exe' - ;; - - *) - # Assume MSVC wrapper - library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' - dynamic_linker='Win32 ld.exe' - ;; - esac - # FIXME: first we should search . and the directory the executable is in - shlibpath_var=PATH - ;; - -darwin* | rhapsody*) - dynamic_linker="$host_os dyld" - version_type=darwin - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' - soname_spec='${libname}${release}${major}$shared_ext' - shlibpath_overrides_runpath=yes - shlibpath_var=DYLD_LIBRARY_PATH - shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' -m4_if([$1], [],[ - sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) - sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' - ;; - -dgux*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -freebsd1*) - dynamic_linker=no - ;; - -freebsd* | dragonfly*) - # DragonFly does not have aout. When/if they implement a new - # versioning mechanism, adjust this. - if test -x /usr/bin/objformat; then - objformat=`/usr/bin/objformat` - else - case $host_os in - freebsd[[123]]*) objformat=aout ;; - *) objformat=elf ;; - esac - fi - version_type=freebsd-$objformat - case $version_type in - freebsd-elf*) - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - need_version=no - need_lib_prefix=no - ;; - freebsd-*) - library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' - need_version=yes - ;; - esac - shlibpath_var=LD_LIBRARY_PATH - case $host_os in - freebsd2*) - shlibpath_overrides_runpath=yes - ;; - freebsd3.[[01]]* | freebsdelf3.[[01]]*) - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ - freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - *) # from 4.6 on, and DragonFly - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - esac - ;; - -gnu*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -haiku*) - version_type=linux - need_lib_prefix=no - need_version=no - dynamic_linker="$host_os runtime_loader" - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LIBRARY_PATH - shlibpath_overrides_runpath=yes - sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' - hardcode_into_libs=yes - ;; - -hpux9* | hpux10* | hpux11*) - # Give a soname corresponding to the major version so that dld.sl refuses to - # link against other versions. - version_type=sunos - need_lib_prefix=no - need_version=no - case $host_cpu in - ia64*) - shrext_cmds='.so' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.so" - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - if test "X$HPUX_IA64_MODE" = X32; then - sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" - else - sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" - fi - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - hppa*64*) - shrext_cmds='.sl' - hardcode_into_libs=yes - dynamic_linker="$host_os dld.sl" - shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH - shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" - sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec - ;; - *) - shrext_cmds='.sl' - dynamic_linker="$host_os dld.sl" - shlibpath_var=SHLIB_PATH - shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - ;; - esac - # HP-UX runs *really* slowly unless shared libraries are mode 555, ... - postinstall_cmds='chmod 555 $lib' - # or fails outright, so override atomically: - install_override_mode=555 - ;; - -interix[[3-9]]*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -irix5* | irix6* | nonstopux*) - case $host_os in - nonstopux*) version_type=nonstopux ;; - *) - if test "$lt_cv_prog_gnu_ld" = yes; then - version_type=linux - else - version_type=irix - fi ;; - esac - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' - case $host_os in - irix5* | nonstopux*) - libsuff= shlibsuff= - ;; - *) - case $LD in # libtool.m4 will add one of these switches to LD - *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") - libsuff= shlibsuff= libmagic=32-bit;; - *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") - libsuff=32 shlibsuff=N32 libmagic=N32;; - *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") - libsuff=64 shlibsuff=64 libmagic=64-bit;; - *) libsuff= shlibsuff= libmagic=never-match;; - esac - ;; - esac - shlibpath_var=LD_LIBRARY${shlibsuff}_PATH - shlibpath_overrides_runpath=no - sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" - sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" - hardcode_into_libs=yes - ;; - -# No shared lib support for Linux oldld, aout, or coff. -linux*oldld* | linux*aout* | linux*coff*) - dynamic_linker=no - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - - # Some binutils ld are patched to set DT_RUNPATH - AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], - [lt_cv_shlibpath_overrides_runpath=no - save_LDFLAGS=$LDFLAGS - save_libdir=$libdir - eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ - LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" - AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], - [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], - [lt_cv_shlibpath_overrides_runpath=yes])]) - LDFLAGS=$save_LDFLAGS - libdir=$save_libdir - ]) - shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath - - # This implies no fast_install, which is unacceptable. - # Some rework will be needed to allow for fast_install - # before this can be enabled. - hardcode_into_libs=yes - - # Append ld.so.conf contents to the search path - if test -f /etc/ld.so.conf; then - lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` - sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" - fi - - # We used to test for /lib/ld.so.1 and disable shared libraries on - # powerpc, because MkLinux only supported shared libraries with the - # GNU dynamic linker. Since this was broken with cross compilers, - # most powerpc-linux boxes support dynamic linking these days and - # people can always --disable-shared, the test was removed, and we - # assume the GNU/Linux dynamic linker is in use. - dynamic_linker='GNU/Linux ld.so' - ;; - -netbsdelf*-gnu) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='NetBSD ld.elf_so' - ;; - -netbsd*) - version_type=sunos - need_lib_prefix=no - need_version=no - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - dynamic_linker='NetBSD (a.out) ld.so' - else - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - dynamic_linker='NetBSD ld.elf_so' - fi - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - ;; - -newsos6) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - ;; - -*nto* | *qnx*) - version_type=qnx - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - dynamic_linker='ldqnx.so' - ;; - -openbsd*) - version_type=sunos - sys_lib_dlsearch_path_spec="/usr/lib" - need_lib_prefix=no - # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. - case $host_os in - openbsd3.3 | openbsd3.3.*) need_version=yes ;; - *) need_version=no ;; - esac - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' - shlibpath_var=LD_LIBRARY_PATH - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - case $host_os in - openbsd2.[[89]] | openbsd2.[[89]].*) - shlibpath_overrides_runpath=no - ;; - *) - shlibpath_overrides_runpath=yes - ;; - esac - else - shlibpath_overrides_runpath=yes - fi - ;; - -os2*) - libname_spec='$name' - shrext_cmds=".dll" - need_lib_prefix=no - library_names_spec='$libname${shared_ext} $libname.a' - dynamic_linker='OS/2 ld.exe' - shlibpath_var=LIBPATH - ;; - -osf3* | osf4* | osf5*) - version_type=osf - need_lib_prefix=no - need_version=no - soname_spec='${libname}${release}${shared_ext}$major' - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" - sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" - ;; - -rdos*) - dynamic_linker=no - ;; - -solaris*) - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - # ldd complains unless libraries are executable - postinstall_cmds='chmod +x $lib' - ;; - -sunos4*) - version_type=sunos - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' - finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - if test "$with_gnu_ld" = yes; then - need_lib_prefix=no - fi - need_version=yes - ;; - -sysv4 | sysv4.3*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - case $host_vendor in - sni) - shlibpath_overrides_runpath=no - need_lib_prefix=no - runpath_var=LD_RUN_PATH - ;; - siemens) - need_lib_prefix=no - ;; - motorola) - need_lib_prefix=no - need_version=no - shlibpath_overrides_runpath=no - sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' - ;; - esac - ;; - -sysv4*MP*) - if test -d /usr/nec ;then - version_type=linux - library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' - soname_spec='$libname${shared_ext}.$major' - shlibpath_var=LD_LIBRARY_PATH - fi - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - version_type=freebsd-elf - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=yes - hardcode_into_libs=yes - if test "$with_gnu_ld" = yes; then - sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' - else - sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' - case $host_os in - sco3.2v5*) - sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" - ;; - esac - fi - sys_lib_dlsearch_path_spec='/usr/lib' - ;; - -tpf*) - # TPF is a cross-target only. Preferred cross-host = GNU/Linux. - version_type=linux - need_lib_prefix=no - need_version=no - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - shlibpath_var=LD_LIBRARY_PATH - shlibpath_overrides_runpath=no - hardcode_into_libs=yes - ;; - -uts4*) - version_type=linux - library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' - soname_spec='${libname}${release}${shared_ext}$major' - shlibpath_var=LD_LIBRARY_PATH - ;; - -*) - dynamic_linker=no - ;; -esac -AC_MSG_RESULT([$dynamic_linker]) -test "$dynamic_linker" = no && can_build_shared=no - -variables_saved_for_relink="PATH $shlibpath_var $runpath_var" -if test "$GCC" = yes; then - variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" -fi - -if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then - sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" -fi -if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then - sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" -fi - -_LT_DECL([], [variables_saved_for_relink], [1], - [Variables whose values should be saved in libtool wrapper scripts and - restored at link time]) -_LT_DECL([], [need_lib_prefix], [0], - [Do we need the "lib" prefix for modules?]) -_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) -_LT_DECL([], [version_type], [0], [Library versioning type]) -_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) -_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) -_LT_DECL([], [shlibpath_overrides_runpath], [0], - [Is shlibpath searched before the hard-coded library search path?]) -_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) -_LT_DECL([], [library_names_spec], [1], - [[List of archive names. First name is the real one, the rest are links. - The last name is the one that the linker finds with -lNAME]]) -_LT_DECL([], [soname_spec], [1], - [[The coded name of the library, if different from the real name]]) -_LT_DECL([], [install_override_mode], [1], - [Permission mode override for installation of shared libraries]) -_LT_DECL([], [postinstall_cmds], [2], - [Command to use after installation of a shared archive]) -_LT_DECL([], [postuninstall_cmds], [2], - [Command to use after uninstallation of a shared archive]) -_LT_DECL([], [finish_cmds], [2], - [Commands used to finish a libtool library installation in a directory]) -_LT_DECL([], [finish_eval], [1], - [[As "finish_cmds", except a single script fragment to be evaled but - not shown]]) -_LT_DECL([], [hardcode_into_libs], [0], - [Whether we should hardcode library paths into libraries]) -_LT_DECL([], [sys_lib_search_path_spec], [2], - [Compile-time system search path for libraries]) -_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], - [Run-time system search path for libraries]) -])# _LT_SYS_DYNAMIC_LINKER - - -# _LT_PATH_TOOL_PREFIX(TOOL) -# -------------------------- -# find a file program which can recognize shared library -AC_DEFUN([_LT_PATH_TOOL_PREFIX], -[m4_require([_LT_DECL_EGREP])dnl -AC_MSG_CHECKING([for $1]) -AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, -[case $MAGIC_CMD in -[[\\/*] | ?:[\\/]*]) - lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. - ;; -*) - lt_save_MAGIC_CMD="$MAGIC_CMD" - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR -dnl $ac_dummy forces splitting on constant user-supplied paths. -dnl POSIX.2 word splitting is done only on the output of word expansions, -dnl not every word. This closes a longstanding sh security hole. - ac_dummy="m4_if([$2], , $PATH, [$2])" - for ac_dir in $ac_dummy; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f $ac_dir/$1; then - lt_cv_path_MAGIC_CMD="$ac_dir/$1" - if test -n "$file_magic_test_file"; then - case $deplibs_check_method in - "file_magic "*) - file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` - MAGIC_CMD="$lt_cv_path_MAGIC_CMD" - if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | - $EGREP "$file_magic_regex" > /dev/null; then - : - else - cat <<_LT_EOF 1>&2 - -*** Warning: the command libtool uses to detect shared libraries, -*** $file_magic_cmd, produces output that libtool cannot recognize. -*** The result is that libtool may fail to recognize shared libraries -*** as such. This will affect the creation of libtool libraries that -*** depend on shared libraries, but programs linked with such libtool -*** libraries will work regardless of this problem. Nevertheless, you -*** may want to report the problem to your system manager and/or to -*** bug-libtool@gnu.org - -_LT_EOF - fi ;; - esac - fi - break - fi - done - IFS="$lt_save_ifs" - MAGIC_CMD="$lt_save_MAGIC_CMD" - ;; -esac]) -MAGIC_CMD="$lt_cv_path_MAGIC_CMD" -if test -n "$MAGIC_CMD"; then - AC_MSG_RESULT($MAGIC_CMD) -else - AC_MSG_RESULT(no) -fi -_LT_DECL([], [MAGIC_CMD], [0], - [Used to examine libraries when file_magic_cmd begins with "file"])dnl -])# _LT_PATH_TOOL_PREFIX - -# Old name: -AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) - - -# _LT_PATH_MAGIC -# -------------- -# find a file program which can recognize a shared library -m4_defun([_LT_PATH_MAGIC], -[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) -if test -z "$lt_cv_path_MAGIC_CMD"; then - if test -n "$ac_tool_prefix"; then - _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) - else - MAGIC_CMD=: - fi -fi -])# _LT_PATH_MAGIC - - -# LT_PATH_LD -# ---------- -# find the pathname to the GNU or non-GNU linker -AC_DEFUN([LT_PATH_LD], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PROG_ECHO_BACKSLASH])dnl - -AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], - [assume the C compiler uses GNU ld @<:@default=no@:>@])], - [test "$withval" = no || with_gnu_ld=yes], - [with_gnu_ld=no])dnl - -ac_prog=ld -if test "$GCC" = yes; then - # Check if gcc -print-prog-name=ld gives a path. - AC_MSG_CHECKING([for ld used by $CC]) - case $host in - *-*-mingw*) - # gcc leaves a trailing carriage return which upsets mingw - ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; - *) - ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; - esac - case $ac_prog in - # Accept absolute paths. - [[\\/]]* | ?:[[\\/]]*) - re_direlt='/[[^/]][[^/]]*/\.\./' - # Canonicalize the pathname of ld - ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` - while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do - ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` - done - test -z "$LD" && LD="$ac_prog" - ;; - "") - # If it fails, then pretend we aren't using GCC. - ac_prog=ld - ;; - *) - # If it is relative, then search for the first ld in PATH. - with_gnu_ld=unknown - ;; - esac -elif test "$with_gnu_ld" = yes; then - AC_MSG_CHECKING([for GNU ld]) -else - AC_MSG_CHECKING([for non-GNU ld]) -fi -AC_CACHE_VAL(lt_cv_path_LD, -[if test -z "$LD"; then - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then - lt_cv_path_LD="$ac_dir/$ac_prog" - # Check to see if the program is GNU ld. I'd rather use --version, - # but apparently some variants of GNU ld only accept -v. - # Break only if it was the GNU/non-GNU ld that we prefer. - case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then - lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' - lt_cv_file_magic_cmd='func_win32_libid' - else - # Keep this pattern in sync with the one in func_win32_libid. - lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' - lt_cv_file_magic_cmd='$OBJDUMP -f' - fi - ;; - -cegcc*) - # use the weaker test based on 'objdump'. See mingw*. - lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' - lt_cv_file_magic_cmd='$OBJDUMP -f' - ;; - -darwin* | rhapsody*) - lt_cv_deplibs_check_method=pass_all - ;; - -freebsd* | dragonfly*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - case $host_cpu in - i*86 ) - # Not sure whether the presence of OpenBSD here was a mistake. - # Let's accept both of them until this is cleared up. - lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` - ;; - esac - else - lt_cv_deplibs_check_method=pass_all - fi - ;; - -gnu*) - lt_cv_deplibs_check_method=pass_all - ;; - -haiku*) - lt_cv_deplibs_check_method=pass_all - ;; - -hpux10.20* | hpux11*) - lt_cv_file_magic_cmd=/usr/bin/file - case $host_cpu in - ia64*) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' - lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so - ;; - hppa*64*) - [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] - lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl - ;; - *) - lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' - lt_cv_file_magic_test_file=/usr/lib/libc.sl - ;; - esac - ;; - -interix[[3-9]]*) - # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' - ;; - -irix5* | irix6* | nonstopux*) - case $LD in - *-32|*"-32 ") libmagic=32-bit;; - *-n32|*"-n32 ") libmagic=N32;; - *-64|*"-64 ") libmagic=64-bit;; - *) libmagic=never-match;; - esac - lt_cv_deplibs_check_method=pass_all - ;; - -# This must be Linux ELF. -linux* | k*bsd*-gnu | kopensolaris*-gnu) - lt_cv_deplibs_check_method=pass_all - ;; - -netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' - fi - ;; - -newos6*) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' - lt_cv_file_magic_cmd=/usr/bin/file - lt_cv_file_magic_test_file=/usr/lib/libnls.so - ;; - -*nto* | *qnx*) - lt_cv_deplibs_check_method=pass_all - ;; - -openbsd*) - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' - else - lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' - fi - ;; - -osf3* | osf4* | osf5*) - lt_cv_deplibs_check_method=pass_all - ;; - -rdos*) - lt_cv_deplibs_check_method=pass_all - ;; - -solaris*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) - lt_cv_deplibs_check_method=pass_all - ;; - -sysv4 | sysv4.3*) - case $host_vendor in - motorola) - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' - lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` - ;; - ncr) - lt_cv_deplibs_check_method=pass_all - ;; - sequent) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' - ;; - sni) - lt_cv_file_magic_cmd='/bin/file' - lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" - lt_cv_file_magic_test_file=/lib/libc.so - ;; - siemens) - lt_cv_deplibs_check_method=pass_all - ;; - pc) - lt_cv_deplibs_check_method=pass_all - ;; - esac - ;; - -tpf*) - lt_cv_deplibs_check_method=pass_all - ;; -esac -]) - -file_magic_glob= -want_nocaseglob=no -if test "$build" = "$host"; then - case $host_os in - mingw* | pw32*) - if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then - want_nocaseglob=yes - else - file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` - fi - ;; - esac -fi - -file_magic_cmd=$lt_cv_file_magic_cmd -deplibs_check_method=$lt_cv_deplibs_check_method -test -z "$deplibs_check_method" && deplibs_check_method=unknown - -_LT_DECL([], [deplibs_check_method], [1], - [Method to check whether dependent libraries are shared objects]) -_LT_DECL([], [file_magic_cmd], [1], - [Command to use when deplibs_check_method = "file_magic"]) -_LT_DECL([], [file_magic_glob], [1], - [How to find potential files when deplibs_check_method = "file_magic"]) -_LT_DECL([], [want_nocaseglob], [1], - [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) -])# _LT_CHECK_MAGIC_METHOD - - -# LT_PATH_NM -# ---------- -# find the pathname to a BSD- or MS-compatible name lister -AC_DEFUN([LT_PATH_NM], -[AC_REQUIRE([AC_PROG_CC])dnl -AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, -[if test -n "$NM"; then - # Let the user override the test. - lt_cv_path_NM="$NM" -else - lt_nm_to_check="${ac_tool_prefix}nm" - if test -n "$ac_tool_prefix" && test "$build" = "$host"; then - lt_nm_to_check="$lt_nm_to_check nm" - fi - for lt_tmp_nm in $lt_nm_to_check; do - lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR - for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do - IFS="$lt_save_ifs" - test -z "$ac_dir" && ac_dir=. - tmp_nm="$ac_dir/$lt_tmp_nm" - if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then - # Check to see if the nm accepts a BSD-compat flag. - # Adding the `sed 1q' prevents false positives on HP-UX, which says: - # nm: unknown option "B" ignored - # Tru64's nm complains that /dev/null is an invalid object file - case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in - */dev/null* | *'Invalid file or object type'*) - lt_cv_path_NM="$tmp_nm -B" - break - ;; - *) - case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in - */dev/null*) - lt_cv_path_NM="$tmp_nm -p" - break - ;; - *) - lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but - continue # so that we can try to find one that supports BSD flags - ;; - esac - ;; - esac - fi - done - IFS="$lt_save_ifs" - done - : ${lt_cv_path_NM=no} -fi]) -if test "$lt_cv_path_NM" != "no"; then - NM="$lt_cv_path_NM" -else - # Didn't find any BSD compatible name lister, look for dumpbin. - if test -n "$DUMPBIN"; then : - # Let the user override the test. - else - AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) - case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in - *COFF*) - DUMPBIN="$DUMPBIN -symbols" - ;; - *) - DUMPBIN=: - ;; - esac - fi - AC_SUBST([DUMPBIN]) - if test "$DUMPBIN" != ":"; then - NM="$DUMPBIN" - fi -fi -test -z "$NM" && NM=nm -AC_SUBST([NM]) -_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl - -AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], - [lt_cv_nm_interface="BSD nm" - echo "int some_variable = 0;" > conftest.$ac_ext - (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) - (eval "$ac_compile" 2>conftest.err) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) - (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) - cat conftest.err >&AS_MESSAGE_LOG_FD - (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) - cat conftest.out >&AS_MESSAGE_LOG_FD - if $GREP 'External.*some_variable' conftest.out > /dev/null; then - lt_cv_nm_interface="MS dumpbin" - fi - rm -f conftest*]) -])# LT_PATH_NM - -# Old names: -AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) -AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_PROG_NM], []) -dnl AC_DEFUN([AC_PROG_NM], []) - -# _LT_CHECK_SHAREDLIB_FROM_LINKLIB -# -------------------------------- -# how to determine the name of the shared library -# associated with a specific link library. -# -- PORTME fill in with the dynamic library characteristics -m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], -[m4_require([_LT_DECL_EGREP]) -m4_require([_LT_DECL_OBJDUMP]) -m4_require([_LT_DECL_DLLTOOL]) -AC_CACHE_CHECK([how to associate runtime and link libraries], -lt_cv_sharedlib_from_linklib_cmd, -[lt_cv_sharedlib_from_linklib_cmd='unknown' - -case $host_os in -cygwin* | mingw* | pw32* | cegcc*) - # two different shell functions defined in ltmain.sh - # decide which to use based on capabilities of $DLLTOOL - case `$DLLTOOL --help 2>&1` in - *--identify-strict*) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib - ;; - *) - lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback - ;; - esac - ;; -*) - # fallback: assume linklib IS sharedlib - lt_cv_sharedlib_from_linklib_cmd="$ECHO" - ;; -esac -]) -sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd -test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO - -_LT_DECL([], [sharedlib_from_linklib_cmd], [1], - [Command to associate shared and link libraries]) -])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB - - -# _LT_PATH_MANIFEST_TOOL -# ---------------------- -# locate the manifest tool -m4_defun([_LT_PATH_MANIFEST_TOOL], -[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) -test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt -AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], - [lt_cv_path_mainfest_tool=no - echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD - $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out - cat conftest.err >&AS_MESSAGE_LOG_FD - if $GREP 'Manifest Tool' conftest.out > /dev/null; then - lt_cv_path_mainfest_tool=yes - fi - rm -f conftest*]) -if test "x$lt_cv_path_mainfest_tool" != xyes; then - MANIFEST_TOOL=: -fi -_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl -])# _LT_PATH_MANIFEST_TOOL - - -# LT_LIB_M -# -------- -# check for math library -AC_DEFUN([LT_LIB_M], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -LIBM= -case $host in -*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) - # These system don't have libm, or don't need it - ;; -*-ncr-sysv4.3*) - AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") - AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") - ;; -*) - AC_CHECK_LIB(m, cos, LIBM="-lm") - ;; -esac -AC_SUBST([LIBM]) -])# LT_LIB_M - -# Old name: -AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_CHECK_LIBM], []) - - -# _LT_COMPILER_NO_RTTI([TAGNAME]) -# ------------------------------- -m4_defun([_LT_COMPILER_NO_RTTI], -[m4_require([_LT_TAG_COMPILER])dnl - -_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - -if test "$GCC" = yes; then - case $cc_basename in - nvcc*) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; - *) - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; - esac - - _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], - lt_cv_prog_compiler_rtti_exceptions, - [-fno-rtti -fno-exceptions], [], - [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) -fi -_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], - [Compiler flag to turn off builtin functions]) -])# _LT_COMPILER_NO_RTTI - - -# _LT_CMD_GLOBAL_SYMBOLS -# ---------------------- -m4_defun([_LT_CMD_GLOBAL_SYMBOLS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_PROG_CC])dnl -AC_REQUIRE([AC_PROG_AWK])dnl -AC_REQUIRE([LT_PATH_NM])dnl -AC_REQUIRE([LT_PATH_LD])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_TAG_COMPILER])dnl - -# Check for command to grab the raw symbol name followed by C symbol from nm. -AC_MSG_CHECKING([command to parse $NM output from $compiler object]) -AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], -[ -# These are sane defaults that work on at least a few old systems. -# [They come from Ultrix. What could be older than Ultrix?!! ;)] - -# Character class describing NM global symbol codes. -symcode='[[BCDEGRST]]' - -# Regexp to match symbols that can be accessed directly from C. -sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' - -# Define system-specific variables. -case $host_os in -aix*) - symcode='[[BCDT]]' - ;; -cygwin* | mingw* | pw32* | cegcc*) - symcode='[[ABCDGISTW]]' - ;; -hpux*) - if test "$host_cpu" = ia64; then - symcode='[[ABCDEGRST]]' - fi - ;; -irix* | nonstopux*) - symcode='[[BCDEGRST]]' - ;; -osf*) - symcode='[[BCDEGQRST]]' - ;; -solaris*) - symcode='[[BDRT]]' - ;; -sco3.2v5*) - symcode='[[DT]]' - ;; -sysv4.2uw2*) - symcode='[[DT]]' - ;; -sysv5* | sco5v6* | unixware* | OpenUNIX*) - symcode='[[ABDT]]' - ;; -sysv4) - symcode='[[DFNSTU]]' - ;; -esac - -# If we're using GNU nm, then use its standard symbol codes. -case `$NM -V 2>&1` in -*GNU* | *'with BFD'*) - symcode='[[ABCDGIRSTW]]' ;; -esac - -# Transform an extracted symbol line into a proper C declaration. -# Some systems (esp. on ia64) link data and code symbols differently, -# so use this general approach. -lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" - -# Transform an extracted symbol line into symbol name and symbol address -lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" -lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" - -# Handle CRLF in mingw tool chain -opt_cr= -case $build_os in -mingw*) - opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp - ;; -esac - -# Try without a prefix underscore, then with it. -for ac_symprfx in "" "_"; do - - # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. - symxfrm="\\1 $ac_symprfx\\2 \\2" - - # Write the raw and C identifiers. - if test "$lt_cv_nm_interface" = "MS dumpbin"; then - # Fake it for dumpbin and say T for any non-static function - # and D for any global variable. - # Also find C++ and __fastcall symbols from MSVC++, - # which start with @ or ?. - lt_cv_sys_global_symbol_pipe="$AWK ['"\ -" {last_section=section; section=\$ 3};"\ -" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ -" \$ 0!~/External *\|/{next};"\ -" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ -" {if(hide[section]) next};"\ -" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ -" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ -" s[1]~/^[@?]/{print s[1], s[1]; next};"\ -" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ -" ' prfx=^$ac_symprfx]" - else - lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" - fi - lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" - - # Check to see that the pipe works correctly. - pipe_works=no - - rm -f conftest* - cat > conftest.$ac_ext <<_LT_EOF -#ifdef __cplusplus -extern "C" { -#endif -char nm_test_var; -void nm_test_func(void); -void nm_test_func(void){} -#ifdef __cplusplus -} -#endif -int main(){nm_test_var='a';nm_test_func();return(0);} -_LT_EOF - - if AC_TRY_EVAL(ac_compile); then - # Now try to grab the symbols. - nlist=conftest.nm - if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then - # Try sorting and uniquifying the output. - if sort "$nlist" | uniq > "$nlist"T; then - mv -f "$nlist"T "$nlist" - else - rm -f "$nlist"T - fi - - # Make sure that we snagged all the symbols we need. - if $GREP ' nm_test_var$' "$nlist" >/dev/null; then - if $GREP ' nm_test_func$' "$nlist" >/dev/null; then - cat <<_LT_EOF > conftest.$ac_ext -/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ -#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) -/* DATA imports from DLLs on WIN32 con't be const, because runtime - relocations are performed -- see ld's documentation on pseudo-relocs. */ -# define LT@&t@_DLSYM_CONST -#elif defined(__osf__) -/* This system does not cope well with relocations in const data. */ -# define LT@&t@_DLSYM_CONST -#else -# define LT@&t@_DLSYM_CONST const -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -_LT_EOF - # Now generate the symbol file. - eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' - - cat <<_LT_EOF >> conftest.$ac_ext - -/* The mapping between symbol names and symbols. */ -LT@&t@_DLSYM_CONST struct { - const char *name; - void *address; -} -lt__PROGRAM__LTX_preloaded_symbols[[]] = -{ - { "@PROGRAM@", (void *) 0 }, -_LT_EOF - $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext - cat <<\_LT_EOF >> conftest.$ac_ext - {0, (void *) 0} -}; - -/* This works around a problem in FreeBSD linker */ -#ifdef FREEBSD_WORKAROUND -static const void *lt_preloaded_setup() { - return lt__PROGRAM__LTX_preloaded_symbols; -} -#endif - -#ifdef __cplusplus -} -#endif -_LT_EOF - # Now try linking the two files. - mv conftest.$ac_objext conftstm.$ac_objext - lt_globsym_save_LIBS=$LIBS - lt_globsym_save_CFLAGS=$CFLAGS - LIBS="conftstm.$ac_objext" - CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" - if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then - pipe_works=yes - fi - LIBS=$lt_globsym_save_LIBS - CFLAGS=$lt_globsym_save_CFLAGS - else - echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD - fi - else - echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD - fi - else - echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD - cat conftest.$ac_ext >&5 - fi - rm -rf conftest* conftst* - - # Do not use the global_symbol_pipe unless it works. - if test "$pipe_works" = yes; then - break - else - lt_cv_sys_global_symbol_pipe= - fi -done -]) -if test -z "$lt_cv_sys_global_symbol_pipe"; then - lt_cv_sys_global_symbol_to_cdecl= -fi -if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then - AC_MSG_RESULT(failed) -else - AC_MSG_RESULT(ok) -fi - -# Response file support. -if test "$lt_cv_nm_interface" = "MS dumpbin"; then - nm_file_list_spec='@' -elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then - nm_file_list_spec='@' -fi - -_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], - [Take the output of nm and produce a listing of raw symbols and C names]) -_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], - [Transform the output of nm in a proper C declaration]) -_LT_DECL([global_symbol_to_c_name_address], - [lt_cv_sys_global_symbol_to_c_name_address], [1], - [Transform the output of nm in a C name address pair]) -_LT_DECL([global_symbol_to_c_name_address_lib_prefix], - [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], - [Transform the output of nm in a C name address pair when lib prefix is needed]) -_LT_DECL([], [nm_file_list_spec], [1], - [Specify filename containing input files for $NM]) -]) # _LT_CMD_GLOBAL_SYMBOLS - - -# _LT_COMPILER_PIC([TAGNAME]) -# --------------------------- -m4_defun([_LT_COMPILER_PIC], -[m4_require([_LT_TAG_COMPILER])dnl -_LT_TAGVAR(lt_prog_compiler_wl, $1)= -_LT_TAGVAR(lt_prog_compiler_pic, $1)= -_LT_TAGVAR(lt_prog_compiler_static, $1)= - -m4_if([$1], [CXX], [ - # C++ specific cases for pic, static, wl, etc. - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - *djgpp*) - # DJGPP does not support shared libraries at all - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - else - case $host_os in - aix[[4-9]]*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - chorus*) - case $cc_basename in - cxch68*) - # Green Hills C++ Compiler - # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" - ;; - esac - ;; - mingw* | cygwin* | os2* | pw32* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - dgux*) - case $cc_basename in - ec++*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - ghcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - freebsd* | dragonfly*) - # FreeBSD uses GNU C++ - ;; - hpux9* | hpux10* | hpux11*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - if test "$host_cpu" != ia64; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - fi - ;; - aCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - ;; - *) - ;; - esac - ;; - interix*) - # This is c89, which is MS Visual C++ (no shared libs) - # Anyone wants to do a port? - ;; - irix5* | irix6* | nonstopux*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - # CC pic flag -KPIC is the default. - ;; - *) - ;; - esac - ;; - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # KAI C++ Compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - ecpc* ) - # old Intel C++ for x86_64 which still supported -KPIC. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - icpc* ) - # Intel C++, used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - cxx*) - # Compaq C++ - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) - # IBM XL 8.0, 9.0 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - esac - ;; - esac - ;; - lynxos*) - ;; - m88k*) - ;; - mvs*) - case $cc_basename in - cxx*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' - ;; - *) - ;; - esac - ;; - netbsd* | netbsdelf*-gnu) - ;; - *qnx* | *nto*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' - ;; - RCC*) - # Rational C++ 2.4.1 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - cxx*) - # Digital/Compaq C++ - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # Make sure the PIC flag is empty. It appears that all Alpha - # Linux and Compaq Tru64 Unix objects are PIC. - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - *) - ;; - esac - ;; - psos*) - ;; - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - ;; - *) - ;; - esac - ;; - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - lcc*) - # Lucid - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - ;; - *) - ;; - esac - ;; - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - case $cc_basename in - CC*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - esac - ;; - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - ;; - *) - ;; - esac - ;; - vxworks*) - ;; - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -], -[ - if test "$GCC" = yes; then - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - - case $host_os in - aix*) - # All AIX code is PIC. - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - m68k) - # FIXME: we need at least 68020 code to build shared libraries, but - # adding the `-m68020' flag to GCC prevents building anything better, - # like `-m68040'. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' - ;; - esac - ;; - - beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) - # PIC is the default for these OSes. - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - # Although the cygwin gcc ignores -fPIC, still need this for old-style - # (--disable-auto-import) libraries - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - darwin* | rhapsody*) - # PIC is the default on this platform - # Common symbols not allowed in MH_DYLIB files - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' - ;; - - haiku*) - # PIC is the default for Haiku. - # The "-static" flag exists, but is broken. - _LT_TAGVAR(lt_prog_compiler_static, $1)= - ;; - - hpux*) - # PIC is the default for 64-bit PA HP-UX, but not for 32-bit - # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag - # sets the default TLS model and affects inlining. - case $host_cpu in - hppa*64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - ;; - - interix[[3-9]]*) - # Interix 3.x gcc -fpic/-fPIC options generate broken code. - # Instead, we relocate shared libraries at runtime. - ;; - - msdosdjgpp*) - # Just because we use GCC doesn't mean we suddenly get shared libraries - # on systems that don't support them. - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - enable_shared=no - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic - fi - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - ;; - esac - - case $cc_basename in - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' - ;; - esac - else - # PORTME Check for flag to pass linker flags through the system compiler. - case $host_os in - aix*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - if test "$host_cpu" = ia64; then - # AIX 5 now supports IA64 processor - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - else - _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' - fi - ;; - - mingw* | cygwin* | pw32* | os2* | cegcc*) - # This hack is so that the source file can tell whether it is being - # built for inclusion in a dll (and should export symbols for example). - m4_if([$1], [GCJ], [], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) - ;; - - hpux9* | hpux10* | hpux11*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but - # not for PA HP-UX. - case $host_cpu in - hppa*64*|ia64*) - # +Z the default - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' - ;; - esac - # Is there a better lt_prog_compiler_static that works with the bundled CC? - _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' - ;; - - irix5* | irix6* | nonstopux*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # PIC (with -KPIC) is the default. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - # old Intel for x86_64 which still supported -KPIC. - ecc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # icc used to be incompatible with GCC. - # ICC 10 doesn't accept -KPIC any more. - icc* | ifort*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' - ;; - # Lahey Fortran 8.1. - lf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' - _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' - ;; - nagfor*) - # NAG Fortran compiler - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group compilers (*not* the Pentium gcc compiler, - # which looks to be a dead project) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - ccc*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All Alpha code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - xl* | bgxl* | bgf* | mpixl*) - # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ F* | *Sun*Fortran*) - # Sun Fortran 8.3 passes all unrecognized flags to the linker - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='' - ;; - *Sun\ C*) - # Sun C 5.9 - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - ;; - esac - ;; - esac - ;; - - newsos6) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *nto* | *qnx*) - # QNX uses GNU C++, but need to define -shared option too, otherwise - # it will coredump. - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' - ;; - - osf3* | osf4* | osf5*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - # All OSF/1 code is PIC. - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - rdos*) - _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' - ;; - - solaris*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - case $cc_basename in - f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; - *) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; - esac - ;; - - sunos4*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4 | sysv4.2uw2* | sysv4.3*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - sysv4*MP*) - if test -d /usr/nec ;then - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - fi - ;; - - sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - unicos*) - _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - - uts4*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' - _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' - ;; - - *) - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no - ;; - esac - fi -]) -case $host_os in - # For platforms which do not support PIC, -DPIC is meaningless: - *djgpp*) - _LT_TAGVAR(lt_prog_compiler_pic, $1)= - ;; - *) - _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" - ;; -esac - -AC_CACHE_CHECK([for $compiler option to produce PIC], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], - [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) -_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) - -# -# Check to make sure the PIC flag actually works. -# -if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then - _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], - [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], - [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], - [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in - "" | " "*) ;; - *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; - esac], - [_LT_TAGVAR(lt_prog_compiler_pic, $1)= - _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) -fi -_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], - [Additional compiler flags for building library objects]) - -_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], - [How to pass a linker flag through the compiler]) -# -# Check to make sure the static flag actually works. -# -wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" -_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], - _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), - $lt_tmp_static_flag, - [], - [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) -_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], - [Compiler flag to prevent dynamic linking]) -])# _LT_COMPILER_PIC - - -# _LT_LINKER_SHLIBS([TAGNAME]) -# ---------------------------- -# See if the linker supports building shared libraries. -m4_defun([_LT_LINKER_SHLIBS], -[AC_REQUIRE([LT_PATH_LD])dnl -AC_REQUIRE([LT_PATH_NM])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_DECL_SED])dnl -m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl -m4_require([_LT_TAG_COMPILER])dnl -AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) -m4_if([$1], [CXX], [ - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - case $host_os in - aix[[4-9]]*) - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global defined - # symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - ;; - pw32*) - _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" - ;; - cygwin* | mingw* | cegcc*) - case $cc_basename in - cl*) ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - ;; - esac - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - *) - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - ;; - esac -], [ - runpath_var= - _LT_TAGVAR(allow_undefined_flag, $1)= - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(archive_cmds, $1)= - _LT_TAGVAR(archive_expsym_cmds, $1)= - _LT_TAGVAR(compiler_needs_object, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(hardcode_automatic, $1)=no - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= - _LT_TAGVAR(hardcode_libdir_separator, $1)= - _LT_TAGVAR(hardcode_minus_L, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported - _LT_TAGVAR(inherit_rpath, $1)=no - _LT_TAGVAR(link_all_deplibs, $1)=unknown - _LT_TAGVAR(module_cmds, $1)= - _LT_TAGVAR(module_expsym_cmds, $1)= - _LT_TAGVAR(old_archive_from_new_cmds, $1)= - _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= - _LT_TAGVAR(thread_safe_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - # include_expsyms should be a list of space-separated symbols to be *always* - # included in the symbol list - _LT_TAGVAR(include_expsyms, $1)= - # exclude_expsyms can be an extended regexp of symbols to exclude - # it will be wrapped by ` (' and `)$', so one must not match beginning or - # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', - # as well as any symbol that contains `d'. - _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] - # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out - # platforms (ab)use it in PIC code, but their linkers get confused if - # the symbol is explicitly referenced. Since portable code cannot - # rely on this symbol name, it's probably fine to never include it in - # preloaded symbol tables. - # Exclude shared library initialization/finalization symbols. -dnl Note also adjust exclude_expsyms for C++ above. - extract_expsyms_cmds= - - case $host_os in - cygwin* | mingw* | pw32* | cegcc*) - # FIXME: the MSVC++ port hasn't been tested in a loooong time - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - if test "$GCC" != yes; then - with_gnu_ld=no - fi - ;; - interix*) - # we just hope/assume this is gcc and not c89 (= MSVC++) - with_gnu_ld=yes - ;; - openbsd*) - with_gnu_ld=no - ;; - linux* | k*bsd*-gnu | gnu*) - _LT_TAGVAR(link_all_deplibs, $1)=no - ;; - esac - - _LT_TAGVAR(ld_shlibs, $1)=yes - - # On some targets, GNU ld is compatible enough with the native linker - # that we're better off using the native interface for both. - lt_use_gnu_ld_interface=no - if test "$with_gnu_ld" = yes; then - case $host_os in - aix*) - # The AIX port of GNU ld has always aspired to compatibility - # with the native linker. However, as the warning in the GNU ld - # block says, versions before 2.19.5* couldn't really create working - # shared libraries, regardless of the interface used. - case `$LD -v 2>&1` in - *\ \(GNU\ Binutils\)\ 2.19.5*) ;; - *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; - *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - ;; - *) - lt_use_gnu_ld_interface=yes - ;; - esac - fi - - if test "$lt_use_gnu_ld_interface" = yes; then - # If archive_cmds runs LD, not CC, wlarc should be empty - wlarc='${wl}' - - # Set some defaults for GNU ld with shared library support. These - # are reset later if shared libraries are not supported. Putting them - # here allows them to be overridden if necessary. - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - # ancient GNU ld didn't support --whole-archive et. al. - if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - supports_anon_versioning=no - case `$LD -v 2>&1` in - *GNU\ gold*) supports_anon_versioning=yes ;; - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 - *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... - *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... - *\ 2.11.*) ;; # other 2.11 versions - *) supports_anon_versioning=yes ;; - esac - - # See if GNU ld supports shared libraries. - case $host_os in - aix[[3-9]]*) - # On AIX/PPC, the GNU linker is very broken - if test "$host_cpu" != ia64; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: the GNU linker, at least up to release 2.19, is reported -*** to be unable to reliably create shared libraries on AIX. -*** Therefore, libtool is disabling shared libraries support. If you -*** really care for shared libraries, you may want to install binutils -*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. -*** You will then need to restart the configuration process. - -_LT_EOF - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' - _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - - gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) - tmp_diet=no - if test "$host_os" = linux-dietlibc; then - case $cc_basename in - diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) - esac - fi - if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ - && test "$tmp_diet" = no - then - tmp_addflag=' $pic_flag' - tmp_sharedflag='-shared' - case $cc_basename,$host_cpu in - pgcc*) # Portland Group C compiler - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag' - ;; - pgf77* | pgf90* | pgf95* | pgfortran*) - # Portland Group f77 and f90 compilers - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - tmp_addflag=' $pic_flag -Mnomain' ;; - ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 - tmp_addflag=' -i_dynamic' ;; - efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 - tmp_addflag=' -i_dynamic -nofor_main' ;; - ifc* | ifort*) # Intel Fortran compiler - tmp_addflag=' -nofor_main' ;; - lf95*) # Lahey Fortran 8.1 - _LT_TAGVAR(whole_archive_flag_spec, $1)= - tmp_sharedflag='--shared' ;; - xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) - tmp_sharedflag='-qmkshrobj' - tmp_addflag= ;; - nvcc*) # Cuda Compiler Driver 2.2 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - ;; - esac - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) # Sun C 5.9 - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - tmp_sharedflag='-G' ;; - *Sun\ F*) # Sun Fortran 8.3 - tmp_sharedflag='-G' ;; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - - case $cc_basename in - xlf* | bgf* | bgxlf* | mpixlf*) - # IBM XL Fortran 10.1 on PPC cannot create shared libs itself - _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' - _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' - fi - ;; - esac - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' - wlarc= - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - fi - ;; - - solaris*) - if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: The releases 2.8.* of the GNU linker cannot reliably -*** create shared libraries on Solaris systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.9.1 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) - case `$LD -v 2>&1` in - *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) - _LT_TAGVAR(ld_shlibs, $1)=no - cat <<_LT_EOF 1>&2 - -*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not -*** reliably create shared libraries on SCO systems. Therefore, libtool -*** is disabling shared libraries support. We urge you to upgrade GNU -*** binutils to release 2.16.91.0.3 or newer. Another option is to modify -*** your PATH or compiler configuration so that the native linker is -*** used, and then restart. - -_LT_EOF - ;; - *) - # For security reasons, it is highly recommended that you always - # use absolute paths for naming shared libraries, and exclude the - # DT_RUNPATH tag from executables and libraries. But doing so - # requires that you compile everything twice, which is a pain. - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - sunos4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - - if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then - runpath_var= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= - _LT_TAGVAR(export_dynamic_flag_spec, $1)= - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - # PORTME fill in a description of your system's linker (not GNU ld) - case $host_os in - aix3*) - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' - # Note: this linker hardcodes the directories in LIBPATH if there - # are no directories specified by -L. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then - # Neither direct hardcoding nor static linking is supported with a - # broken collect2. - _LT_TAGVAR(hardcode_direct, $1)=unsupported - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - # If we're using GNU nm, then we don't want the "-C" option. - # -C means demangle to AIX nm, but means don't demangle with GNU nm - # Also, AIX nm treats weak defined symbols like other global - # defined symbols, whereas GNU nm marks them as "W". - if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - else - _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' - fi - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then - aix_use_runtimelinking=yes - break - fi - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GCC" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - ;; - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - _LT_TAGVAR(link_all_deplibs, $1)=no - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - amigaos*) - case $host_cpu in - powerpc) - # see comment about AmigaOS4 .so support - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='' - ;; - m68k) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - ;; - - bsdi[[45]]*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic - ;; - - cygwin* | mingw* | pw32* | cegcc*) - # When not using gcc, we currently assume that we are using - # Microsoft Visual C++. - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - case $cc_basename in - cl*) - # Native MSVC - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # Assume MSVC wrapper - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' - # The linker will automatically build a .lib file if we build a DLL. - _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - # FIXME: Should let the user specify the lib program. - _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - ;; - esac - ;; - - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - freebsd1*) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor - # support. Future versions do this automatically, but an explicit c++rt0.o - # does not break anything, and helps significantly (at the cost of a little - # extra space). - freebsd2.2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # Unfortunately, older versions of FreeBSD 2 do not have this feature. - freebsd2*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - # FreeBSD 3 and greater uses gcc -shared to do shared libraries. - freebsd* | dragonfly*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - hpux9*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - - hpux10*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - fi - ;; - - hpux11*) - if test "$GCC" = yes && test "$with_gnu_ld" = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - else - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - m4_if($1, [], [ - # Older versions of the 11.00 compiler do not understand -b yet - # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) - _LT_LINKER_OPTION([if $CC understands -b], - _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], - [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], - [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) - ;; - esac - fi - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - - # hardcode_minus_L: Not really in the search PATH, - # but as the default location of the library. - _LT_TAGVAR(hardcode_minus_L, $1)=yes - ;; - esac - fi - ;; - - irix5* | irix6* | nonstopux*) - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - # Try to use the -exported_symbol ld option, if it does not - # work, assume that -exports_file does not work either and - # implicitly export all symbols. - # This should be the same for all languages, so no per-tag cache variable. - AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], - [lt_cv_irix_exported_symbol], - [save_LDFLAGS="$LDFLAGS" - LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" - AC_LINK_IFELSE( - [AC_LANG_SOURCE( - [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], - [C++], [[int foo (void) { return 0; }]], - [Fortran 77], [[ - subroutine foo - end]], - [Fortran], [[ - subroutine foo - end]])])], - [lt_cv_irix_exported_symbol=yes], - [lt_cv_irix_exported_symbol=no]) - LDFLAGS="$save_LDFLAGS"]) - if test "$lt_cv_irix_exported_symbol" = yes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' - fi - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - netbsd* | netbsdelf*-gnu) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out - else - _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - newsos6) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *nto* | *qnx*) - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - else - case $host_os in - openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - ;; - esac - fi - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - os2*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' - _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' - ;; - - osf3*) - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - osf4* | osf5*) # as osf3* with the addition of -msym flag - if test "$GCC" = yes; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - else - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ - $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' - - # Both c and cxx compiler support -rpath directly - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)='no' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - ;; - - solaris*) - _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' - if test "$GCC" = yes; then - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - else - case `$CC -V 2>&1` in - *"Compilers 5.0"*) - wlarc='' - _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' - ;; - *) - wlarc='${wl}' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' - ;; - esac - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. GCC discards it without `$wl', - # but is careful enough not to reorder. - # Supported since Solaris 2.6 (maybe 2.5.1?) - if test "$GCC" = yes; then - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - fi - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - sunos4*) - if test "x$host_vendor" = xsequent; then - # Use $CC to link under sequent, because it throws in some extra .o - # files that make .init and .fini sections work. - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' - fi - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4) - case $host_vendor in - sni) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? - ;; - siemens) - ## LD is ld it makes a PLAMLIB - ## CC just makes a GrossModule. - _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' - _LT_TAGVAR(hardcode_direct, $1)=no - ;; - motorola) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie - ;; - esac - runpath_var='LD_RUN_PATH' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - sysv4.3*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' - ;; - - sysv4*MP*) - if test -d /usr/nec; then - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var=LD_RUN_PATH - hardcode_runpath_var=yes - _LT_TAGVAR(ld_shlibs, $1)=yes - fi - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - if test "$GCC" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - fi - ;; - - uts4*) - _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - - *) - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - if test x$host_vendor = xsni; then - case $host in - sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' - ;; - esac - fi - fi -]) -AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) -test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - -_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld - -_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl -_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl -_LT_DECL([], [extract_expsyms_cmds], [2], - [The commands to extract the exported symbol list from a shared archive]) - -# -# Do we need to explicitly link libc? -# -case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in -x|xyes) - # Assume -lc should be added - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - - if test "$enable_shared" = yes && test "$GCC" = yes; then - case $_LT_TAGVAR(archive_cmds, $1) in - *'~'*) - # FIXME: we may have to deal with multi-command sequences. - ;; - '$CC '*) - # Test whether the compiler implicitly links with -lc since on some - # systems, -lgcc has to come before -lc. If gcc already passes -lc - # to ld, don't add -lc before -lgcc. - AC_CACHE_CHECK([whether -lc should be explicitly linked in], - [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), - [$RM conftest* - echo "$lt_simple_compile_test_code" > conftest.$ac_ext - - if AC_TRY_EVAL(ac_compile) 2>conftest.err; then - soname=conftest - lib=conftest - libobjs=conftest.$ac_objext - deplibs= - wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) - pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) - compiler_flags=-v - linker_flags=-v - verstring= - output_objdir=. - libname=conftest - lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) - _LT_TAGVAR(allow_undefined_flag, $1)= - if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) - then - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no - else - lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes - fi - _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag - else - cat conftest.err 1>&5 - fi - $RM conftest* - ]) - _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) - ;; - esac - fi - ;; -esac - -_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], - [Whether or not to add -lc for building shared libraries]) -_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], - [enable_shared_with_static_runtimes], [0], - [Whether or not to disallow shared libs when runtime libs are static]) -_LT_TAGDECL([], [export_dynamic_flag_spec], [1], - [Compiler flag to allow reflexive dlopens]) -_LT_TAGDECL([], [whole_archive_flag_spec], [1], - [Compiler flag to generate shared objects directly from archives]) -_LT_TAGDECL([], [compiler_needs_object], [1], - [Whether the compiler copes with passing no objects directly]) -_LT_TAGDECL([], [old_archive_from_new_cmds], [2], - [Create an old-style archive from a shared archive]) -_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], - [Create a temporary old-style archive to link instead of a shared archive]) -_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) -_LT_TAGDECL([], [archive_expsym_cmds], [2]) -_LT_TAGDECL([], [module_cmds], [2], - [Commands used to build a loadable module if different from building - a shared archive.]) -_LT_TAGDECL([], [module_expsym_cmds], [2]) -_LT_TAGDECL([], [with_gnu_ld], [1], - [Whether we are building with GNU ld or not]) -_LT_TAGDECL([], [allow_undefined_flag], [1], - [Flag that allows shared libraries with undefined symbols to be built]) -_LT_TAGDECL([], [no_undefined_flag], [1], - [Flag that enforces no undefined symbols]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], - [Flag to hardcode $libdir into a binary during linking. - This must work even if $libdir does not exist]) -_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], - [[If ld is used when linking, flag to hardcode $libdir into a binary - during linking. This must work even if $libdir does not exist]]) -_LT_TAGDECL([], [hardcode_libdir_separator], [1], - [Whether we need a single "-rpath" flag with a separated argument]) -_LT_TAGDECL([], [hardcode_direct], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary]) -_LT_TAGDECL([], [hardcode_direct_absolute], [0], - [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes - DIR into the resulting binary and the resulting library dependency is - "absolute", i.e impossible to change by setting ${shlibpath_var} if the - library is relocated]) -_LT_TAGDECL([], [hardcode_minus_L], [0], - [Set to "yes" if using the -LDIR flag during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_shlibpath_var], [0], - [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR - into the resulting binary]) -_LT_TAGDECL([], [hardcode_automatic], [0], - [Set to "yes" if building a shared library automatically hardcodes DIR - into the library and all subsequent libraries and executables linked - against it]) -_LT_TAGDECL([], [inherit_rpath], [0], - [Set to yes if linker adds runtime paths of dependent libraries - to runtime path list]) -_LT_TAGDECL([], [link_all_deplibs], [0], - [Whether libtool must link a program against all its dependency libraries]) -_LT_TAGDECL([], [always_export_symbols], [0], - [Set to "yes" if exported symbols are required]) -_LT_TAGDECL([], [export_symbols_cmds], [2], - [The commands to list exported symbols]) -_LT_TAGDECL([], [exclude_expsyms], [1], - [Symbols that should not be listed in the preloaded symbols]) -_LT_TAGDECL([], [include_expsyms], [1], - [Symbols that must always be exported]) -_LT_TAGDECL([], [prelink_cmds], [2], - [Commands necessary for linking programs (against libraries) with templates]) -_LT_TAGDECL([], [postlink_cmds], [2], - [Commands necessary for finishing linking programs]) -_LT_TAGDECL([], [file_list_spec], [1], - [Specify filename containing input files]) -dnl FIXME: Not yet implemented -dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], -dnl [Compiler flag to generate thread safe objects]) -])# _LT_LINKER_SHLIBS - - -# _LT_LANG_C_CONFIG([TAG]) -# ------------------------ -# Ensure that the configuration variables for a C compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_C_CONFIG], -[m4_require([_LT_DECL_EGREP])dnl -lt_save_CC="$CC" -AC_LANG_PUSH(C) - -# Source file extension for C test sources. -ac_ext=c - -# Object file extension for compiled C test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="int some_variable = 0;" - -# Code to be used in simple link tests -lt_simple_link_test_code='int main(){return(0);}' - -_LT_TAG_COMPILER -# Save the default compiler, since it gets overwritten when the other -# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. -compiler_DEFAULT=$CC - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - LT_SYS_DLOPEN_SELF - _LT_CMD_STRIPLIB - - # Report which library types will actually be built - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_CONFIG($1) -fi -AC_LANG_POP -CC="$lt_save_CC" -])# _LT_LANG_C_CONFIG - - -# _LT_LANG_CXX_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a C++ compiler are suitably -# defined. These variables are subsequently used by _LT_CONFIG to write -# the compiler configuration to `libtool'. -m4_defun([_LT_LANG_CXX_CONFIG], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -m4_require([_LT_DECL_EGREP])dnl -m4_require([_LT_PATH_MANIFEST_TOOL])dnl -if test -n "$CXX" && ( test "X$CXX" != "Xno" && - ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || - (test "X$CXX" != "Xg++"))) ; then - AC_PROG_CXXCPP -else - _lt_caught_CXX_error=yes -fi - -AC_LANG_PUSH(C++) -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(compiler_needs_object, $1)=no -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for C++ test sources. -ac_ext=cpp - -# Object file extension for compiled C++ test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the CXX compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_caught_CXX_error" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="int some_variable = 0;" - - # Code to be used in simple link tests - lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC=$CC - lt_save_CFLAGS=$CFLAGS - lt_save_LD=$LD - lt_save_GCC=$GCC - GCC=$GXX - lt_save_with_gnu_ld=$with_gnu_ld - lt_save_path_LD=$lt_cv_path_LD - if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then - lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx - else - $as_unset lt_cv_prog_gnu_ld - fi - if test -n "${lt_cv_path_LDCXX+set}"; then - lt_cv_path_LD=$lt_cv_path_LDCXX - else - $as_unset lt_cv_path_LD - fi - test -z "${LDCXX+set}" || LD=$LDCXX - CC=${CXX-"c++"} - CFLAGS=$CXXFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - # We don't want -fno-exception when compiling C++ code, so set the - # no_builtin_flag separately - if test "$GXX" = yes; then - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' - else - _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= - fi - - if test "$GXX" = yes; then - # Set up default GNU C++ configuration - - LT_PATH_LD - - # Check if GNU C++ uses GNU ld as the underlying linker, since the - # archiving commands below assume that GNU ld is being used. - if test "$with_gnu_ld" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # If archive_cmds runs LD, not CC, wlarc should be empty - # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to - # investigate it a little bit more. (MM) - wlarc='${wl}' - - # ancient GNU ld didn't support --whole-archive et. al. - if eval "`$CC -print-prog-name=ld` --help 2>&1" | - $GREP 'no-whole-archive' > /dev/null; then - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - else - _LT_TAGVAR(whole_archive_flag_spec, $1)= - fi - else - with_gnu_ld=no - wlarc= - - # A generic and very simple default shared library creation - # command for GNU C++ for the case where it uses the native - # linker, instead of GNU ld. If possible, this setting should - # overridden to take advantage of the native linker features on - # the platform it is being used on. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - fi - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - GXX=no - with_gnu_ld=no - wlarc= - fi - - # PORTME: fill in a description of your system's C++ link characteristics - AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) - _LT_TAGVAR(ld_shlibs, $1)=yes - case $host_os in - aix3*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aix[[4-9]]*) - if test "$host_cpu" = ia64; then - # On IA64, the linker does run time linking by default, so we don't - # have to do anything special. - aix_use_runtimelinking=no - exp_sym_flag='-Bexport' - no_entry_flag="" - else - aix_use_runtimelinking=no - - # Test if we are trying to use run time linking or normal - # AIX style linking. If -brtl is somewhere in LDFLAGS, we - # need to do runtime linking. - case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) - for ld_flag in $LDFLAGS; do - case $ld_flag in - *-brtl*) - aix_use_runtimelinking=yes - break - ;; - esac - done - ;; - esac - - exp_sym_flag='-bexport' - no_entry_flag='-bnoentry' - fi - - # When large executables or shared objects are built, AIX ld can - # have problems creating the table of contents. If linking a library - # or program results in "error TOC overflow" add -mminimal-toc to - # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not - # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. - - _LT_TAGVAR(archive_cmds, $1)='' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' - - if test "$GXX" = yes; then - case $host_os in aix4.[[012]]|aix4.[[012]].*) - # We only want to do this on AIX 4.2 and lower, the check - # below for broken collect2 doesn't work under 4.3+ - collect2name=`${CC} -print-prog-name=collect2` - if test -f "$collect2name" && - strings "$collect2name" | $GREP resolve_lib_name >/dev/null - then - # We have reworked collect2 - : - else - # We have old collect2 - _LT_TAGVAR(hardcode_direct, $1)=unsupported - # It fails to find uninstalled libraries when the uninstalled - # path is not listed in the libpath. Setting hardcode_minus_L - # to unsupported forces relinking - _LT_TAGVAR(hardcode_minus_L, $1)=yes - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)= - fi - esac - shared_flag='-shared' - if test "$aix_use_runtimelinking" = yes; then - shared_flag="$shared_flag "'${wl}-G' - fi - else - # not using gcc - if test "$host_cpu" = ia64; then - # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release - # chokes on -Wl,-G. The following line is correct: - shared_flag='-G' - else - if test "$aix_use_runtimelinking" = yes; then - shared_flag='${wl}-G' - else - shared_flag='${wl}-bM:SRE' - fi - fi - fi - - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' - # It seems that -bexpall does not export symbols beginning with - # underscore (_), so it is better to generate a list of symbols to - # export. - _LT_TAGVAR(always_export_symbols, $1)=yes - if test "$aix_use_runtimelinking" = yes; then - # Warning - without using the other runtime loading flags (-brtl), - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(allow_undefined_flag, $1)='-berok' - # Determine the default libpath from the value encoded in an empty - # executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" - else - if test "$host_cpu" = ia64; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' - _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" - else - # Determine the default libpath from the value encoded in an - # empty executable. - _LT_SYS_MODULE_PATH_AIX([$1]) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" - # Warning - without using the other run time loading flags, - # -berok will link without error, but may produce a broken library. - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' - if test "$with_gnu_ld" = yes; then - # We only use this code for GNU lds that support --whole-archive. - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - else - # Exported symbols can be pulled into shared objects from archives - _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' - fi - _LT_TAGVAR(archive_cmds_need_lc, $1)=yes - # This is similar to how AIX traditionally builds its shared - # libraries. - _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' - fi - fi - ;; - - beos*) - if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - # Joseph Beckenbach says some releases of gcc - # support --undefined. This deserves some investigation. FIXME - _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - chorus*) - case $cc_basename in - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - cygwin* | mingw* | pw32* | cegcc*) - case $GXX,$cc_basename in - ,cl* | no,cl*) - # Native MSVC - # hardcode_libdir_flag_spec is actually meaningless, as there is - # no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=yes - _LT_TAGVAR(file_list_spec, $1)='@' - # Tell ltmain to make .lib files, not .a files. - libext=lib - # Tell ltmain to make .dll files, not .so files. - shrext_cmds=".dll" - # FIXME: Setting linknames here is a bad hack. - _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; - else - $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; - fi~ - $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ - linknames=' - # The linker will not automatically build a static lib if we build a DLL. - # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - # Don't use ranlib - _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' - _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ - lt_tool_outputfile="@TOOL_OUTPUT@"~ - case $lt_outputfile in - *.exe|*.EXE) ;; - *) - lt_outputfile="$lt_outputfile.exe" - lt_tool_outputfile="$lt_tool_outputfile.exe" - ;; - esac~ - func_to_tool_file "$lt_outputfile"~ - if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then - $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; - $RM "$lt_outputfile.manifest"; - fi' - ;; - *) - # g++ - # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, - # as there is no search path for DLLs. - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' - _LT_TAGVAR(allow_undefined_flag, $1)=unsupported - _LT_TAGVAR(always_export_symbols, $1)=no - _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes - - if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - # If the export-symbols file already is a .def file (1st line - # is EXPORTS), use it as is; otherwise, prepend... - _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then - cp $export_symbols $output_objdir/$soname.def; - else - echo EXPORTS > $output_objdir/$soname.def; - cat $export_symbols >> $output_objdir/$soname.def; - fi~ - $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - darwin* | rhapsody*) - _LT_DARWIN_LINKER_FEATURES($1) - ;; - - dgux*) - case $cc_basename in - ec++*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - ghcx*) - # Green Hills C++ Compiler - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - freebsd[[12]]*) - # C++ shared libraries reported to be fairly broken before - # switch to ELF - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - freebsd-elf*) - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - ;; - - freebsd* | dragonfly*) - # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF - # conventions - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - gnu*) - ;; - - haiku*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - - hpux9*) - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - hpux10*|hpux11*) - if test $with_gnu_ld = no; then - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - case $host_cpu in - hppa*64*|ia64*) - ;; - *) - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - ;; - esac - fi - case $host_cpu in - hppa*64*|ia64*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - ;; - *) - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, - # but as the default - # location of the library. - ;; - esac - - case $cc_basename in - CC*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - aCC*) - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes; then - if test $with_gnu_ld = no; then - case $host_cpu in - hppa*64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - ia64*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - ;; - esac - fi - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - interix[[3-9]]*) - _LT_TAGVAR(hardcode_direct, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. - # Instead, shared libraries are loaded at an image base (0x10000000 by - # default) and relocated if they conflict, which is a slow very memory - # consuming and fragmenting process. To avoid this, we pick a random, - # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link - # time. Moving up from 0x10000000 also allows more sbrk(2) space. - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' - ;; - irix5* | irix6*) - case $cc_basename in - CC*) - # SGI C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - - # Archives containing C++ object files must be created using - # "CC -ar", where "CC" is the IRIX C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' - ;; - *) - if test "$GXX" = yes; then - if test "$with_gnu_ld" = no; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - else - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' - fi - fi - _LT_TAGVAR(link_all_deplibs, $1)=yes - ;; - esac - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - _LT_TAGVAR(inherit_rpath, $1)=yes - ;; - - linux* | k*bsd*-gnu | kopensolaris*-gnu) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - - # Archives containing C++ object files must be created using - # "CC -Bstatic", where "CC" is the KAI C++ compiler. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' - ;; - icpc* | ecpc* ) - # Intel C++ - with_gnu_ld=yes - # version 8.0 and above of icpc choke on multiply defined symbols - # if we add $predep_objects and $postdep_objects, however 7.1 and - # earlier do not add the objects themselves. - case `$CC -V 2>&1` in - *"Version 7."*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - *) # Version 8.0 or newer - tmp_idyn= - case $host_cpu in - ia64*) tmp_idyn=' -i_dynamic';; - esac - _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' - ;; - esac - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' - ;; - pgCC* | pgcpp*) - # Portland Group C++ compiler - case `$CC -V` in - *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) - _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ - compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' - _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ - $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ - $RANLIB $oldlib' - _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ - rm -rf $tpldir~ - $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ - $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - *) # Version 6 and above use weak symbols - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - ;; - cxx*) - # Compaq C++ - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' - - runpath_var=LD_RUN_PATH - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' - ;; - xl* | mpixl* | bgxl*) - # IBM XL 8.0 on PPC, with GNU ld - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' - _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' - if test "x$supports_anon_versioning" = xyes; then - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ - cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ - echo "local: *; };" >> $output_objdir/$libname.ver~ - $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' - fi - ;; - *) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' - _LT_TAGVAR(compiler_needs_object, $1)=yes - - # Not sure whether something based on - # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 - # would be better. - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - esac - ;; - esac - ;; - - lynxos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - m88k*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - mvs*) - case $cc_basename in - cxx*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - netbsd*) - if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' - wlarc= - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - fi - # Workaround some broken pre-1.5 toolchains - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' - ;; - - *nto* | *qnx*) - _LT_TAGVAR(ld_shlibs, $1)=yes - ;; - - openbsd2*) - # C++ shared libraries are fairly broken - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - openbsd*) - if test -f /usr/libexec/ld.so; then - _LT_TAGVAR(hardcode_direct, $1)=yes - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_direct_absolute, $1)=yes - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' - _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' - fi - output_verbose_link_cmd=func_echo_all - else - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - - osf3* | osf4* | osf5*) - case $cc_basename in - KCC*) - # Kuck and Associates, Inc. (KAI) C++ Compiler - - # KCC will only create a shared library if the output file - # ends with ".so" (or ".sl" for HP-UX), so rename the library - # to its proper name (with version) after linking. - _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Archives containing C++ object files must be created using - # the KAI C++ compiler. - case $host in - osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; - *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; - esac - ;; - RCC*) - # Rational C++ 2.4.1 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - cxx*) - case $host in - osf3*) - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - ;; - *) - _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' - _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ - echo "-hidden">> $lib.exp~ - $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ - $RM $lib.exp' - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - # - # There doesn't appear to be a way to prevent this compiler from - # explicitly linking system object files so we need to strip them - # from the output so that they don't get included in the library - # dependencies. - output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' - ;; - *) - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' - case $host in - osf3*) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' - ;; - esac - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=: - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - - else - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - fi - ;; - esac - ;; - - psos*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - sunos4*) - case $cc_basename in - CC*) - # Sun C++ 4.x - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - lcc*) - # Lucid - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - solaris*) - case $cc_basename in - CC* | sunCC*) - # Sun C++ 4.2, 5.x and Centerline C++ - _LT_TAGVAR(archive_cmds_need_lc,$1)=yes - _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' - _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - # The compiler driver will combine and reorder linker options, - # but understands `-z linker_flag'. - # Supported since Solaris 2.6 (maybe 2.5.1?) - _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' - ;; - esac - _LT_TAGVAR(link_all_deplibs, $1)=yes - - output_verbose_link_cmd='func_echo_all' - - # Archives containing C++ object files must be created using - # "CC -xar", where "CC" is the Sun C++ compiler. This is - # necessary to make sure instantiated templates are included - # in the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' - ;; - gcx*) - # Green Hills C++ Compiler - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - - # The C++ compiler must be used to create the archive. - _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' - ;; - *) - # GNU C++ compiler with Solaris linker - if test "$GXX" = yes && test "$with_gnu_ld" = no; then - _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' - if $CC --version | $GREP -v '^2\.7' > /dev/null; then - _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - else - # g++ 2.7 appears to require `-G' NOT `-shared' on this - # platform. - _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' - _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ - $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' - - # Commands to make compiler produce verbose output that lists - # what "hidden" libraries, object files and flags are used when - # linking a shared library. - output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' - fi - - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' - case $host_os in - solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; - *) - _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' - ;; - esac - fi - ;; - esac - ;; - - sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - sysv5* | sco3.2v5* | sco5v6*) - # Note: We can NOT use -z defs as we might desire, because we do not - # link with -lc, and that would cause any symbols used from libc to - # always be unresolved, which means just about no library would - # ever link correctly. If we're not using GNU ld we use -z text - # though, which does catch some bad symbols but isn't as heavy-handed - # as -z defs. - _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' - _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' - _LT_TAGVAR(archive_cmds_need_lc, $1)=no - _LT_TAGVAR(hardcode_shlibpath_var, $1)=no - _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' - _LT_TAGVAR(hardcode_libdir_separator, $1)=':' - _LT_TAGVAR(link_all_deplibs, $1)=yes - _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' - runpath_var='LD_RUN_PATH' - - case $cc_basename in - CC*) - _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ - '"$_LT_TAGVAR(old_archive_cmds, $1)" - _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ - '"$_LT_TAGVAR(reload_cmds, $1)" - ;; - *) - _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' - ;; - esac - ;; - - tandem*) - case $cc_basename in - NCC*) - # NonStop-UX NCC 3.20 - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - ;; - - vxworks*) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - - *) - # FIXME: insert proper C++ library support - _LT_TAGVAR(ld_shlibs, $1)=no - ;; - esac - - AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) - test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no - - _LT_TAGVAR(GCC, $1)="$GXX" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS - LDCXX=$LD - LD=$lt_save_LD - GCC=$lt_save_GCC - with_gnu_ld=$lt_save_with_gnu_ld - lt_cv_path_LDCXX=$lt_cv_path_LD - lt_cv_path_LD=$lt_save_path_LD - lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld - lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld -fi # test "$_lt_caught_CXX_error" != yes - -AC_LANG_POP -])# _LT_LANG_CXX_CONFIG - - -# _LT_FUNC_STRIPNAME_CNF -# ---------------------- -# func_stripname_cnf prefix suffix name -# strip PREFIX and SUFFIX off of NAME. -# PREFIX and SUFFIX must not contain globbing or regex special -# characters, hashes, percent signs, but SUFFIX may contain a leading -# dot (in which case that matches only a dot). -# -# This function is identical to the (non-XSI) version of func_stripname, -# except this one can be used by m4 code that may be executed by configure, -# rather than the libtool script. -m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl -AC_REQUIRE([_LT_DECL_SED]) -AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) -func_stripname_cnf () -{ - case ${2} in - .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; - *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; - esac -} # func_stripname_cnf -])# _LT_FUNC_STRIPNAME_CNF - -# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) -# --------------------------------- -# Figure out "hidden" library dependencies from verbose -# compiler output when linking a shared library. -# Parse the compiler output and extract the necessary -# objects, libraries and library flags. -m4_defun([_LT_SYS_HIDDEN_LIBDEPS], -[m4_require([_LT_FILEUTILS_DEFAULTS])dnl -AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl -# Dependencies to place before and after the object being linked: -_LT_TAGVAR(predep_objects, $1)= -_LT_TAGVAR(postdep_objects, $1)= -_LT_TAGVAR(predeps, $1)= -_LT_TAGVAR(postdeps, $1)= -_LT_TAGVAR(compiler_lib_search_path, $1)= - -dnl we can't use the lt_simple_compile_test_code here, -dnl because it contains code intended for an executable, -dnl not a library. It's possible we should let each -dnl tag define a new lt_????_link_test_code variable, -dnl but it's only used here... -m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF -int a; -void foo (void) { a = 0; } -_LT_EOF -], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF -class Foo -{ -public: - Foo (void) { a = 0; } -private: - int a; -}; -_LT_EOF -], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer*4 a - a=0 - return - end -_LT_EOF -], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF - subroutine foo - implicit none - integer a - a=0 - return - end -_LT_EOF -], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF -public class foo { - private int a; - public void bar (void) { - a = 0; - } -}; -_LT_EOF -]) - -_lt_libdeps_save_CFLAGS=$CFLAGS -case "$CC $CFLAGS " in #( -*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; -*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; -esac - -dnl Parse the compiler output and extract the necessary -dnl objects, libraries and library flags. -if AC_TRY_EVAL(ac_compile); then - # Parse the compiler output and extract the necessary - # objects, libraries and library flags. - - # Sentinel used to keep track of whether or not we are before - # the conftest object file. - pre_test_object_deps_done=no - - for p in `eval "$output_verbose_link_cmd"`; do - case ${prev}${p} in - - -L* | -R* | -l*) - # Some compilers place space between "-{L,R}" and the path. - # Remove the space. - if test $p = "-L" || - test $p = "-R"; then - prev=$p - continue - fi - - # Expand the sysroot to ease extracting the directories later. - if test -z "$prev"; then - case $p in - -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; - -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; - -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; - esac - fi - case $p in - =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; - esac - if test "$pre_test_object_deps_done" = no; then - case ${prev} in - -L | -R) - # Internal compiler library paths should come after those - # provided the user. The postdeps already come after the - # user supplied libs so there is no need to process them. - if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then - _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" - else - _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" - fi - ;; - # The "-l" case would never come before the object being - # linked, so don't bother handling this case. - esac - else - if test -z "$_LT_TAGVAR(postdeps, $1)"; then - _LT_TAGVAR(postdeps, $1)="${prev}${p}" - else - _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" - fi - fi - prev= - ;; - - *.lto.$objext) ;; # Ignore GCC LTO objects - *.$objext) - # This assumes that the test object file only shows up - # once in the compiler output. - if test "$p" = "conftest.$objext"; then - pre_test_object_deps_done=yes - continue - fi - - if test "$pre_test_object_deps_done" = no; then - if test -z "$_LT_TAGVAR(predep_objects, $1)"; then - _LT_TAGVAR(predep_objects, $1)="$p" - else - _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" - fi - else - if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then - _LT_TAGVAR(postdep_objects, $1)="$p" - else - _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" - fi - fi - ;; - - *) ;; # Ignore the rest. - - esac - done - - # Clean up. - rm -f a.out a.exe -else - echo "libtool.m4: error: problem compiling $1 test program" -fi - -$RM -f confest.$objext -CFLAGS=$_lt_libdeps_save_CFLAGS - -# PORTME: override above test on systems where it is broken -m4_if([$1], [CXX], -[case $host_os in -interix[[3-9]]*) - # Interix 3.5 installs completely hosed .la files for C++, so rather than - # hack all around it, let's just trust "g++" to DTRT. - _LT_TAGVAR(predep_objects,$1)= - _LT_TAGVAR(postdep_objects,$1)= - _LT_TAGVAR(postdeps,$1)= - ;; - -linux*) - case `$CC -V 2>&1 | sed 5q` in - *Sun\ C*) - # Sun C++ 5.9 - - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; - -solaris*) - case $cc_basename in - CC* | sunCC*) - # The more standards-conforming stlport4 library is - # incompatible with the Cstd library. Avoid specifying - # it if it's in CXXFLAGS. Ignore libCrun as - # -library=stlport4 depends on it. - case " $CXX $CXXFLAGS " in - *" -library=stlport4 "*) - solaris_use_stlport4=yes - ;; - esac - - # Adding this requires a known-good setup of shared libraries for - # Sun compiler versions before 5.6, else PIC objects from an old - # archive will be linked into the output, leading to subtle bugs. - if test "$solaris_use_stlport4" != yes; then - _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' - fi - ;; - esac - ;; -esac -]) - -case " $_LT_TAGVAR(postdeps, $1) " in -*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; -esac - _LT_TAGVAR(compiler_lib_search_dirs, $1)= -if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then - _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` -fi -_LT_TAGDECL([], [compiler_lib_search_dirs], [1], - [The directories searched by this compiler when creating a shared library]) -_LT_TAGDECL([], [predep_objects], [1], - [Dependencies to place before and after the objects being linked to - create a shared library]) -_LT_TAGDECL([], [postdep_objects], [1]) -_LT_TAGDECL([], [predeps], [1]) -_LT_TAGDECL([], [postdeps], [1]) -_LT_TAGDECL([], [compiler_lib_search_path], [1], - [The library search path used internally by the compiler when linking - a shared library]) -])# _LT_SYS_HIDDEN_LIBDEPS - - -# _LT_LANG_F77_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for a Fortran 77 compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_F77_CONFIG], -[AC_LANG_PUSH(Fortran 77) -if test -z "$F77" || test "X$F77" = "Xno"; then - _lt_disable_F77=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for f77 test sources. -ac_ext=f - -# Object file extension for compiled f77 test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the F77 compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_F77" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${F77-"f77"} - CFLAGS=$FFLAGS - compiler=$CC - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - GCC=$G77 - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$G77" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC="$lt_save_CC" - CFLAGS="$lt_save_CFLAGS" -fi # test "$_lt_disable_F77" != yes - -AC_LANG_POP -])# _LT_LANG_F77_CONFIG - - -# _LT_LANG_FC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for a Fortran compiler are -# suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_FC_CONFIG], -[AC_LANG_PUSH(Fortran) - -if test -z "$FC" || test "X$FC" = "Xno"; then - _lt_disable_FC=yes -fi - -_LT_TAGVAR(archive_cmds_need_lc, $1)=no -_LT_TAGVAR(allow_undefined_flag, $1)= -_LT_TAGVAR(always_export_symbols, $1)=no -_LT_TAGVAR(archive_expsym_cmds, $1)= -_LT_TAGVAR(export_dynamic_flag_spec, $1)= -_LT_TAGVAR(hardcode_direct, $1)=no -_LT_TAGVAR(hardcode_direct_absolute, $1)=no -_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= -_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= -_LT_TAGVAR(hardcode_libdir_separator, $1)= -_LT_TAGVAR(hardcode_minus_L, $1)=no -_LT_TAGVAR(hardcode_automatic, $1)=no -_LT_TAGVAR(inherit_rpath, $1)=no -_LT_TAGVAR(module_cmds, $1)= -_LT_TAGVAR(module_expsym_cmds, $1)= -_LT_TAGVAR(link_all_deplibs, $1)=unknown -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds -_LT_TAGVAR(no_undefined_flag, $1)= -_LT_TAGVAR(whole_archive_flag_spec, $1)= -_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no - -# Source file extension for fc test sources. -ac_ext=${ac_fc_srcext-f} - -# Object file extension for compiled fc test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# No sense in running all these tests if we already determined that -# the FC compiler isn't working. Some variables (like enable_shared) -# are currently assumed to apply to all compilers on this platform, -# and will be corrupted by setting them based on a non-working compiler. -if test "$_lt_disable_FC" != yes; then - # Code to be used in simple compile tests - lt_simple_compile_test_code="\ - subroutine t - return - end -" - - # Code to be used in simple link tests - lt_simple_link_test_code="\ - program t - end -" - - # ltmain only uses $CC for tagged configurations so make sure $CC is set. - _LT_TAG_COMPILER - - # save warnings/boilerplate of simple test code - _LT_COMPILER_BOILERPLATE - _LT_LINKER_BOILERPLATE - - # Allow CC to be a program name with arguments. - lt_save_CC="$CC" - lt_save_GCC=$GCC - lt_save_CFLAGS=$CFLAGS - CC=${FC-"f95"} - CFLAGS=$FCFLAGS - compiler=$CC - GCC=$ac_cv_fc_compiler_gnu - - _LT_TAGVAR(compiler, $1)=$CC - _LT_CC_BASENAME([$compiler]) - - if test -n "$compiler"; then - AC_MSG_CHECKING([if libtool supports shared libraries]) - AC_MSG_RESULT([$can_build_shared]) - - AC_MSG_CHECKING([whether to build shared libraries]) - test "$can_build_shared" = "no" && enable_shared=no - - # On AIX, shared libraries and static libraries use the same namespace, and - # are all built from PIC. - case $host_os in - aix3*) - test "$enable_shared" = yes && enable_static=no - if test -n "$RANLIB"; then - archive_cmds="$archive_cmds~\$RANLIB \$lib" - postinstall_cmds='$RANLIB $lib' - fi - ;; - aix[[4-9]]*) - if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then - test "$enable_shared" = yes && enable_static=no - fi - ;; - esac - AC_MSG_RESULT([$enable_shared]) - - AC_MSG_CHECKING([whether to build static libraries]) - # Make sure either enable_shared or enable_static is yes. - test "$enable_shared" = yes || enable_static=yes - AC_MSG_RESULT([$enable_static]) - - _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" - _LT_TAGVAR(LD, $1)="$LD" - - ## CAVEAT EMPTOR: - ## There is no encapsulation within the following macros, do not change - ## the running order or otherwise move them around unless you know exactly - ## what you are doing... - _LT_SYS_HIDDEN_LIBDEPS($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_SYS_DYNAMIC_LINKER($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) - fi # test -n "$compiler" - - GCC=$lt_save_GCC - CC=$lt_save_CC - CFLAGS=$lt_save_CFLAGS -fi # test "$_lt_disable_FC" != yes - -AC_LANG_POP -])# _LT_LANG_FC_CONFIG - - -# _LT_LANG_GCJ_CONFIG([TAG]) -# -------------------------- -# Ensure that the configuration variables for the GNU Java Compiler compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_GCJ_CONFIG], -[AC_REQUIRE([LT_PROG_GCJ])dnl -AC_LANG_SAVE - -# Source file extension for Java test sources. -ac_ext=java - -# Object file extension for compiled Java test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code="class foo {}" - -# Code to be used in simple link tests -lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC=$CC -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC=yes -CC=${GCJ-"gcj"} -CFLAGS=$GCJFLAGS -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_TAGVAR(LD, $1)="$LD" -_LT_CC_BASENAME([$compiler]) - -# GCJ did not exist at the time GCC didn't implicitly link libc in. -_LT_TAGVAR(archive_cmds_need_lc, $1)=no - -_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds -_LT_TAGVAR(reload_flag, $1)=$reload_flag -_LT_TAGVAR(reload_cmds, $1)=$reload_cmds - -## CAVEAT EMPTOR: -## There is no encapsulation within the following macros, do not change -## the running order or otherwise move them around unless you know exactly -## what you are doing... -if test -n "$compiler"; then - _LT_COMPILER_NO_RTTI($1) - _LT_COMPILER_PIC($1) - _LT_COMPILER_C_O($1) - _LT_COMPILER_FILE_LOCKS($1) - _LT_LINKER_SHLIBS($1) - _LT_LINKER_HARDCODE_LIBPATH($1) - - _LT_CONFIG($1) -fi - -AC_LANG_RESTORE - -GCC=$lt_save_GCC -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_GCJ_CONFIG - - -# _LT_LANG_RC_CONFIG([TAG]) -# ------------------------- -# Ensure that the configuration variables for the Windows resource compiler -# are suitably defined. These variables are subsequently used by _LT_CONFIG -# to write the compiler configuration to `libtool'. -m4_defun([_LT_LANG_RC_CONFIG], -[AC_REQUIRE([LT_PROG_RC])dnl -AC_LANG_SAVE - -# Source file extension for RC test sources. -ac_ext=rc - -# Object file extension for compiled RC test sources. -objext=o -_LT_TAGVAR(objext, $1)=$objext - -# Code to be used in simple compile tests -lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' - -# Code to be used in simple link tests -lt_simple_link_test_code="$lt_simple_compile_test_code" - -# ltmain only uses $CC for tagged configurations so make sure $CC is set. -_LT_TAG_COMPILER - -# save warnings/boilerplate of simple test code -_LT_COMPILER_BOILERPLATE -_LT_LINKER_BOILERPLATE - -# Allow CC to be a program name with arguments. -lt_save_CC="$CC" -lt_save_CFLAGS=$CFLAGS -lt_save_GCC=$GCC -GCC= -CC=${RC-"windres"} -CFLAGS= -compiler=$CC -_LT_TAGVAR(compiler, $1)=$CC -_LT_CC_BASENAME([$compiler]) -_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes - -if test -n "$compiler"; then - : - _LT_CONFIG($1) -fi - -GCC=$lt_save_GCC -AC_LANG_RESTORE -CC=$lt_save_CC -CFLAGS=$lt_save_CFLAGS -])# _LT_LANG_RC_CONFIG - - -# LT_PROG_GCJ -# ----------- -AC_DEFUN([LT_PROG_GCJ], -[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], - [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], - [AC_CHECK_TOOL(GCJ, gcj,) - test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" - AC_SUBST(GCJFLAGS)])])[]dnl -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_GCJ], []) - - -# LT_PROG_RC -# ---------- -AC_DEFUN([LT_PROG_RC], -[AC_CHECK_TOOL(RC, windres,) -]) - -# Old name: -AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_RC], []) - - -# _LT_DECL_EGREP -# -------------- -# If we don't have a new enough Autoconf to choose the best grep -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_EGREP], -[AC_REQUIRE([AC_PROG_EGREP])dnl -AC_REQUIRE([AC_PROG_FGREP])dnl -test -z "$GREP" && GREP=grep -_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) -_LT_DECL([], [EGREP], [1], [An ERE matcher]) -_LT_DECL([], [FGREP], [1], [A literal string matcher]) -dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too -AC_SUBST([GREP]) -]) - - -# _LT_DECL_OBJDUMP -# -------------- -# If we don't have a new enough Autoconf to choose the best objdump -# available, choose the one first in the user's PATH. -m4_defun([_LT_DECL_OBJDUMP], -[AC_CHECK_TOOL(OBJDUMP, objdump, false) -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) -AC_SUBST([OBJDUMP]) -]) - -# _LT_DECL_DLLTOOL -# ---------------- -# Ensure DLLTOOL variable is set. -m4_defun([_LT_DECL_DLLTOOL], -[AC_CHECK_TOOL(DLLTOOL, dlltool, false) -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) -AC_SUBST([DLLTOOL]) -]) - -# _LT_DECL_SED -# ------------ -# Check for a fully-functional sed program, that truncates -# as few characters as possible. Prefer GNU sed if found. -m4_defun([_LT_DECL_SED], -[AC_PROG_SED -test -z "$SED" && SED=sed -Xsed="$SED -e 1s/^X//" -_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) -_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], - [Sed that helps us avoid accidentally triggering echo(1) options like -n]) -])# _LT_DECL_SED - -m4_ifndef([AC_PROG_SED], [ -############################################################ -# NOTE: This macro has been submitted for inclusion into # -# GNU Autoconf as AC_PROG_SED. When it is available in # -# a released version of Autoconf we should remove this # -# macro and use it instead. # -############################################################ - -m4_defun([AC_PROG_SED], -[AC_MSG_CHECKING([for a sed that does not truncate output]) -AC_CACHE_VAL(lt_cv_path_SED, -[# Loop through the user's path and test for sed and gsed. -# Then use that list of sed's as ones to test for truncation. -as_save_IFS=$IFS; IFS=$PATH_SEPARATOR -for as_dir in $PATH -do - IFS=$as_save_IFS - test -z "$as_dir" && as_dir=. - for lt_ac_prog in sed gsed; do - for ac_exec_ext in '' $ac_executable_extensions; do - if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then - lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" - fi - done - done -done -IFS=$as_save_IFS -lt_ac_max=0 -lt_ac_count=0 -# Add /usr/xpg4/bin/sed as it is typically found on Solaris -# along with /bin/sed that truncates output. -for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do - test ! -f $lt_ac_sed && continue - cat /dev/null > conftest.in - lt_ac_count=0 - echo $ECHO_N "0123456789$ECHO_C" >conftest.in - # Check for GNU sed and select it if it is found. - if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then - lt_cv_path_SED=$lt_ac_sed - break - fi - while true; do - cat conftest.in conftest.in >conftest.tmp - mv conftest.tmp conftest.in - cp conftest.in conftest.nl - echo >>conftest.nl - $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break - cmp -s conftest.out conftest.nl || break - # 10000 chars as input seems more than enough - test $lt_ac_count -gt 10 && break - lt_ac_count=`expr $lt_ac_count + 1` - if test $lt_ac_count -gt $lt_ac_max; then - lt_ac_max=$lt_ac_count - lt_cv_path_SED=$lt_ac_sed - fi - done -done -]) -SED=$lt_cv_path_SED -AC_SUBST([SED]) -AC_MSG_RESULT([$SED]) -])#AC_PROG_SED -])#m4_ifndef - -# Old name: -AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([LT_AC_PROG_SED], []) - - -# _LT_CHECK_SHELL_FEATURES -# ------------------------ -# Find out whether the shell is Bourne or XSI compatible, -# or has some other useful features. -m4_defun([_LT_CHECK_SHELL_FEATURES], -[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) -# Try some XSI features -xsi_shell=no -( _lt_dummy="a/b/c" - test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ - = c,a/b,b/c, \ - && eval 'test $(( 1 + 1 )) -eq 2 \ - && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ - && xsi_shell=yes -AC_MSG_RESULT([$xsi_shell]) -_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) - -AC_MSG_CHECKING([whether the shell understands "+="]) -lt_shell_append=no -( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ - >/dev/null 2>&1 \ - && lt_shell_append=yes -AC_MSG_RESULT([$lt_shell_append]) -_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) - -if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then - lt_unset=unset -else - lt_unset=false -fi -_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl - -# test EBCDIC or ASCII -case `echo X|tr X '\101'` in - A) # ASCII based system - # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr - lt_SP2NL='tr \040 \012' - lt_NL2SP='tr \015\012 \040\040' - ;; - *) # EBCDIC based system - lt_SP2NL='tr \100 \n' - lt_NL2SP='tr \r\n \100\100' - ;; -esac -_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl -_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl -])# _LT_CHECK_SHELL_FEATURES - - -# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) -# ------------------------------------------------------ -# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and -# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. -m4_defun([_LT_PROG_FUNCTION_REPLACE], -[dnl { -sed -e '/^$1 ()$/,/^} # $1 /c\ -$1 ()\ -{\ -m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) -} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") -test 0 -eq $? || _lt_function_replace_fail=: -]) - - -# _LT_PROG_REPLACE_SHELLFNS -# ------------------------- -# Replace existing portable implementations of several shell functions with -# equivalent extended shell implementations where those features are available.. -m4_defun([_LT_PROG_REPLACE_SHELLFNS], -[if test x"$xsi_shell" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl - case ${1} in - */*) func_dirname_result="${1%/*}${2}" ;; - * ) func_dirname_result="${3}" ;; - esac - func_basename_result="${1##*/}"]) - - _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl - # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are - # positional parameters, so assign one to ordinary parameter first. - func_stripname_result=${3} - func_stripname_result=${func_stripname_result#"${1}"} - func_stripname_result=${func_stripname_result%"${2}"}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl - func_split_long_opt_name=${1%%=*} - func_split_long_opt_arg=${1#*=}]) - - _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl - func_split_short_opt_arg=${1#??} - func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) - - _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl - case ${1} in - *.lo) func_lo2o_result=${1%.lo}.${objext} ;; - *) func_lo2o_result=${1} ;; - esac]) - - _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) - - _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) - - _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) -fi - -if test x"$lt_shell_append" = xyes; then - _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) - - _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl - func_quote_for_eval "${2}" -dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ - eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) - - # Save a `func_append' function call where possible by direct use of '+=' - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -else - # Save a `func_append' function call even when '+=' is not available - sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ - && mv -f "$cfgfile.tmp" "$cfgfile" \ - || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") - test 0 -eq $? || _lt_function_replace_fail=: -fi - -if test x"$_lt_function_replace_fail" = x":"; then - AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) -fi -]) - -# _LT_PATH_CONVERSION_FUNCTIONS -# ----------------------------- -# Determine which file name conversion functions should be used by -# func_to_host_file (and, implicitly, by func_to_host_path). These are needed -# for certain cross-compile configurations and native mingw. -m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -AC_REQUIRE([AC_CANONICAL_BUILD])dnl -AC_MSG_CHECKING([how to convert $build file names to $host format]) -AC_CACHE_VAL(lt_cv_to_host_file_cmd, -[case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 - ;; - esac - ;; - *-*-cygwin* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin - ;; - *-*-cygwin* ) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; - * ) # otherwise, assume *nix - lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin - ;; - esac - ;; - * ) # unhandled hosts (and "normal" native builds) - lt_cv_to_host_file_cmd=func_convert_file_noop - ;; -esac -]) -to_host_file_cmd=$lt_cv_to_host_file_cmd -AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) -_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], - [0], [convert $build file names to $host format])dnl - -AC_MSG_CHECKING([how to convert $build file names to toolchain format]) -AC_CACHE_VAL(lt_cv_to_tool_file_cmd, -[#assume ordinary cross tools, or native build. -lt_cv_to_tool_file_cmd=func_convert_file_noop -case $host in - *-*-mingw* ) - case $build in - *-*-mingw* ) # actually msys - lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 - ;; - esac - ;; -esac -]) -to_tool_file_cmd=$lt_cv_to_tool_file_cmd -AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) -_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], - [0], [convert $build files to toolchain format])dnl -])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/external/mit/expat/dist/m4/ltoptions.m4 b/external/mit/expat/dist/m4/ltoptions.m4 deleted file mode 100644 index 17cfd51c0..000000000 --- a/external/mit/expat/dist/m4/ltoptions.m4 +++ /dev/null @@ -1,369 +0,0 @@ -# Helper functions for option handling. -*- Autoconf -*- -# -# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, -# Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 7 ltoptions.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) - - -# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) -# ------------------------------------------ -m4_define([_LT_MANGLE_OPTION], -[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) - - -# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) -# --------------------------------------- -# Set option OPTION-NAME for macro MACRO-NAME, and if there is a -# matching handler defined, dispatch to it. Other OPTION-NAMEs are -# saved as a flag. -m4_define([_LT_SET_OPTION], -[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl -m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), - _LT_MANGLE_DEFUN([$1], [$2]), - [m4_warning([Unknown $1 option `$2'])])[]dnl -]) - - -# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) -# ------------------------------------------------------------ -# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. -m4_define([_LT_IF_OPTION], -[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) - - -# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) -# ------------------------------------------------------- -# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME -# are set. -m4_define([_LT_UNLESS_OPTIONS], -[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), - [m4_define([$0_found])])])[]dnl -m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 -])[]dnl -]) - - -# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) -# ---------------------------------------- -# OPTION-LIST is a space-separated list of Libtool options associated -# with MACRO-NAME. If any OPTION has a matching handler declared with -# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about -# the unknown option and exit. -m4_defun([_LT_SET_OPTIONS], -[# Set options -m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), - [_LT_SET_OPTION([$1], _LT_Option)]) - -m4_if([$1],[LT_INIT],[ - dnl - dnl Simply set some default values (i.e off) if boolean options were not - dnl specified: - _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no - ]) - _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no - ]) - dnl - dnl If no reference was made to various pairs of opposing options, then - dnl we run the default mode handler for the pair. For example, if neither - dnl `shared' nor `disable-shared' was passed, we enable building of shared - dnl archives by default: - _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) - _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) - _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], - [_LT_ENABLE_FAST_INSTALL]) - ]) -])# _LT_SET_OPTIONS - - -## --------------------------------- ## -## Macros to handle LT_INIT options. ## -## --------------------------------- ## - -# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) -# ----------------------------------------- -m4_define([_LT_MANGLE_DEFUN], -[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) - - -# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) -# ----------------------------------------------- -m4_define([LT_OPTION_DEFINE], -[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl -])# LT_OPTION_DEFINE - - -# dlopen -# ------ -LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes -]) - -AU_DEFUN([AC_LIBTOOL_DLOPEN], -[_LT_SET_OPTION([LT_INIT], [dlopen]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `dlopen' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) - - -# win32-dll -# --------- -# Declare package support for building win32 dll's. -LT_OPTION_DEFINE([LT_INIT], [win32-dll], -[enable_win32_dll=yes - -case $host in -*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) - AC_CHECK_TOOL(AS, as, false) - AC_CHECK_TOOL(DLLTOOL, dlltool, false) - AC_CHECK_TOOL(OBJDUMP, objdump, false) - ;; -esac - -test -z "$AS" && AS=as -_LT_DECL([], [AS], [1], [Assembler program])dnl - -test -z "$DLLTOOL" && DLLTOOL=dlltool -_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl - -test -z "$OBJDUMP" && OBJDUMP=objdump -_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl -])# win32-dll - -AU_DEFUN([AC_LIBTOOL_WIN32_DLL], -[AC_REQUIRE([AC_CANONICAL_HOST])dnl -_LT_SET_OPTION([LT_INIT], [win32-dll]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `win32-dll' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) - - -# _LT_ENABLE_SHARED([DEFAULT]) -# ---------------------------- -# implement the --enable-shared flag, and supports the `shared' and -# `disable-shared' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_SHARED], -[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([shared], - [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], - [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_shared=yes ;; - no) enable_shared=no ;; - *) - enable_shared=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_shared=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) - - _LT_DECL([build_libtool_libs], [enable_shared], [0], - [Whether or not to build shared libraries]) -])# _LT_ENABLE_SHARED - -LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) -]) - -AC_DEFUN([AC_DISABLE_SHARED], -[_LT_SET_OPTION([LT_INIT], [disable-shared]) -]) - -AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) -AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_SHARED], []) -dnl AC_DEFUN([AM_DISABLE_SHARED], []) - - - -# _LT_ENABLE_STATIC([DEFAULT]) -# ---------------------------- -# implement the --enable-static flag, and support the `static' and -# `disable-static' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_STATIC], -[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([static], - [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], - [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_static=yes ;; - no) enable_static=no ;; - *) - enable_static=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_static=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_static=]_LT_ENABLE_STATIC_DEFAULT) - - _LT_DECL([build_old_libs], [enable_static], [0], - [Whether or not to build static libraries]) -])# _LT_ENABLE_STATIC - -LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) - -# Old names: -AC_DEFUN([AC_ENABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) -]) - -AC_DEFUN([AC_DISABLE_STATIC], -[_LT_SET_OPTION([LT_INIT], [disable-static]) -]) - -AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) -AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AM_ENABLE_STATIC], []) -dnl AC_DEFUN([AM_DISABLE_STATIC], []) - - - -# _LT_ENABLE_FAST_INSTALL([DEFAULT]) -# ---------------------------------- -# implement the --enable-fast-install flag, and support the `fast-install' -# and `disable-fast-install' LT_INIT options. -# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. -m4_define([_LT_ENABLE_FAST_INSTALL], -[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl -AC_ARG_ENABLE([fast-install], - [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], - [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], - [p=${PACKAGE-default} - case $enableval in - yes) enable_fast_install=yes ;; - no) enable_fast_install=no ;; - *) - enable_fast_install=no - # Look at the argument we got. We use all the common list separators. - lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," - for pkg in $enableval; do - IFS="$lt_save_ifs" - if test "X$pkg" = "X$p"; then - enable_fast_install=yes - fi - done - IFS="$lt_save_ifs" - ;; - esac], - [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) - -_LT_DECL([fast_install], [enable_fast_install], [0], - [Whether or not to optimize for fast installation])dnl -])# _LT_ENABLE_FAST_INSTALL - -LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) -LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) - -# Old names: -AU_DEFUN([AC_ENABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `fast-install' option into LT_INIT's first parameter.]) -]) - -AU_DEFUN([AC_DISABLE_FAST_INSTALL], -[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you put -the `disable-fast-install' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) -dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) - - -# _LT_WITH_PIC([MODE]) -# -------------------- -# implement the --with-pic flag, and support the `pic-only' and `no-pic' -# LT_INIT options. -# MODE is either `yes' or `no'. If omitted, it defaults to `both'. -m4_define([_LT_WITH_PIC], -[AC_ARG_WITH([pic], - [AS_HELP_STRING([--with-pic], - [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], - [pic_mode="$withval"], - [pic_mode=default]) - -test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) - -_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl -])# _LT_WITH_PIC - -LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) -LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) - -# Old name: -AU_DEFUN([AC_LIBTOOL_PICMODE], -[_LT_SET_OPTION([LT_INIT], [pic-only]) -AC_DIAGNOSE([obsolete], -[$0: Remove this warning and the call to _LT_SET_OPTION when you -put the `pic-only' option into LT_INIT's first parameter.]) -]) - -dnl aclocal-1.4 backwards compatibility: -dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) - -## ----------------- ## -## LTDL_INIT Options ## -## ----------------- ## - -m4_define([_LTDL_MODE], []) -LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], - [m4_define([_LTDL_MODE], [nonrecursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [recursive], - [m4_define([_LTDL_MODE], [recursive])]) -LT_OPTION_DEFINE([LTDL_INIT], [subproject], - [m4_define([_LTDL_MODE], [subproject])]) - -m4_define([_LTDL_TYPE], []) -LT_OPTION_DEFINE([LTDL_INIT], [installable], - [m4_define([_LTDL_TYPE], [installable])]) -LT_OPTION_DEFINE([LTDL_INIT], [convenience], - [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/external/mit/expat/dist/m4/ltsugar.m4 b/external/mit/expat/dist/m4/ltsugar.m4 deleted file mode 100644 index 9000a057d..000000000 --- a/external/mit/expat/dist/m4/ltsugar.m4 +++ /dev/null @@ -1,123 +0,0 @@ -# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. -# Written by Gary V. Vaughan, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 6 ltsugar.m4 - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) - - -# lt_join(SEP, ARG1, [ARG2...]) -# ----------------------------- -# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their -# associated separator. -# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier -# versions in m4sugar had bugs. -m4_define([lt_join], -[m4_if([$#], [1], [], - [$#], [2], [[$2]], - [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) -m4_define([_lt_join], -[m4_if([$#$2], [2], [], - [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) - - -# lt_car(LIST) -# lt_cdr(LIST) -# ------------ -# Manipulate m4 lists. -# These macros are necessary as long as will still need to support -# Autoconf-2.59 which quotes differently. -m4_define([lt_car], [[$1]]) -m4_define([lt_cdr], -[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], - [$#], 1, [], - [m4_dquote(m4_shift($@))])]) -m4_define([lt_unquote], $1) - - -# lt_append(MACRO-NAME, STRING, [SEPARATOR]) -# ------------------------------------------ -# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. -# Note that neither SEPARATOR nor STRING are expanded; they are appended -# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). -# No SEPARATOR is output if MACRO-NAME was previously undefined (different -# than defined and empty). -# -# This macro is needed until we can rely on Autoconf 2.62, since earlier -# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. -m4_define([lt_append], -[m4_define([$1], - m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) - - - -# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) -# ---------------------------------------------------------- -# Produce a SEP delimited list of all paired combinations of elements of -# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list -# has the form PREFIXmINFIXSUFFIXn. -# Needed until we can rely on m4_combine added in Autoconf 2.62. -m4_define([lt_combine], -[m4_if(m4_eval([$# > 3]), [1], - [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl -[[m4_foreach([_Lt_prefix], [$2], - [m4_foreach([_Lt_suffix], - ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, - [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) - - -# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) -# ----------------------------------------------------------------------- -# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited -# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. -m4_define([lt_if_append_uniq], -[m4_ifdef([$1], - [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], - [lt_append([$1], [$2], [$3])$4], - [$5])], - [lt_append([$1], [$2], [$3])$4])]) - - -# lt_dict_add(DICT, KEY, VALUE) -# ----------------------------- -m4_define([lt_dict_add], -[m4_define([$1($2)], [$3])]) - - -# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) -# -------------------------------------------- -m4_define([lt_dict_add_subkey], -[m4_define([$1($2:$3)], [$4])]) - - -# lt_dict_fetch(DICT, KEY, [SUBKEY]) -# ---------------------------------- -m4_define([lt_dict_fetch], -[m4_ifval([$3], - m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), - m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) - - -# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) -# ----------------------------------------------------------------- -m4_define([lt_if_dict_fetch], -[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], - [$5], - [$6])]) - - -# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) -# -------------------------------------------------------------- -m4_define([lt_dict_filter], -[m4_if([$5], [], [], - [lt_join(m4_quote(m4_default([$4], [[, ]])), - lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), - [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl -]) diff --git a/external/mit/expat/dist/m4/ltversion.m4 b/external/mit/expat/dist/m4/ltversion.m4 deleted file mode 100644 index 9c7b5d411..000000000 --- a/external/mit/expat/dist/m4/ltversion.m4 +++ /dev/null @@ -1,23 +0,0 @@ -# ltversion.m4 -- version numbers -*- Autoconf -*- -# -# Copyright (C) 2004 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004 -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# @configure_input@ - -# serial 3293 ltversion.m4 -# This file is part of GNU Libtool - -m4_define([LT_PACKAGE_VERSION], [2.4]) -m4_define([LT_PACKAGE_REVISION], [1.3293]) - -AC_DEFUN([LTVERSION_VERSION], -[macro_version='2.4' -macro_revision='1.3293' -_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) -_LT_DECL(, macro_revision, 0) -]) diff --git a/external/mit/expat/dist/m4/lt~obsolete.m4 b/external/mit/expat/dist/m4/lt~obsolete.m4 deleted file mode 100644 index c573da90c..000000000 --- a/external/mit/expat/dist/m4/lt~obsolete.m4 +++ /dev/null @@ -1,98 +0,0 @@ -# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- -# -# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. -# Written by Scott James Remnant, 2004. -# -# This file is free software; the Free Software Foundation gives -# unlimited permission to copy and/or distribute it, with or without -# modifications, as long as this notice is preserved. - -# serial 5 lt~obsolete.m4 - -# These exist entirely to fool aclocal when bootstrapping libtool. -# -# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) -# which have later been changed to m4_define as they aren't part of the -# exported API, or moved to Autoconf or Automake where they belong. -# -# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN -# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us -# using a macro with the same name in our local m4/libtool.m4 it'll -# pull the old libtool.m4 in (it doesn't see our shiny new m4_define -# and doesn't know about Autoconf macros at all.) -# -# So we provide this file, which has a silly filename so it's always -# included after everything else. This provides aclocal with the -# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything -# because those macros already exist, or will be overwritten later. -# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. -# -# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. -# Yes, that means every name once taken will need to remain here until -# we give up compatibility with versions before 1.7, at which point -# we need to keep only those names which we still refer to. - -# This is to help aclocal find these macros, as it can't see m4_define. -AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) - -m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) -m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) -m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) -m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) -m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) -m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) -m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) -m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) -m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) -m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) -m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) -m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) -m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) -m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) -m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) -m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) -m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) -m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) -m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) -m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) -m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) -m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) -m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) -m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) -m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) -m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) -m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) -m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) -m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) -m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) -m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) -m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) -m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) -m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) -m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) -m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) -m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) -m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) -m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) -m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) -m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) -m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) -m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) -m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) -m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) -m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) -m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) -m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) -m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) -m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) -m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) -m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) -m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) -m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) -m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/external/mit/expat/dist/tests/README.txt b/external/mit/expat/dist/tests/README.txt deleted file mode 100755 index 30e1d4dab..000000000 --- a/external/mit/expat/dist/tests/README.txt +++ /dev/null @@ -1,13 +0,0 @@ -This directory contains the (fledgling) test suite for Expat. The -tests provide general unit testing and regression coverage. The tests -are not expected to be useful examples of Expat usage; see the -examples/ directory for that. - -The Expat tests use a partial internal implementation of the "Check" -unit testing framework for C. More information on Check can be found at: - - http://check.sourceforge.net/ - -Expat must be built and, depending on platform, must be installed, before "make check" can be executed. - -This test suite can all change in a later version. diff --git a/external/mit/expat/dist/tests/benchmark/README.txt b/external/mit/expat/dist/tests/benchmark/README.txt deleted file mode 100755 index 7f9cca037..000000000 --- a/external/mit/expat/dist/tests/benchmark/README.txt +++ /dev/null @@ -1,16 +0,0 @@ -Use this benchmark command line utility as follows: - - benchmark [-n] <# iterations> - -The command line arguments are: - - -n ... optional; if supplied, namespace processing is turned on - ... name/path of test xml file - ... size of processing buffer; - the file is parsed in chunks of this size - <# iterations> ... how often will the file be parsed - -Returns: - - The time (in seconds) it takes to parse the test file, - averaged over the number of iterations. \ No newline at end of file diff --git a/external/mit/expat/dist/tests/benchmark/benchmark.c b/external/mit/expat/dist/tests/benchmark/benchmark.c deleted file mode 100755 index 0f0fd18c1..000000000 --- a/external/mit/expat/dist/tests/benchmark/benchmark.c +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include -#include -#include -#include "expat.h" - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - -#ifdef XML_LARGE_SIZE -#define XML_FMT_INT_MOD "ll" -#else -#define XML_FMT_INT_MOD "l" -#endif - -static void -usage(const char *prog, int rc) -{ - fprintf(stderr, - "usage: %s [-n] filename bufferSize nr_of_loops\n", prog); - exit(rc); -} - -int main (int argc, char *argv[]) -{ - XML_Parser parser; - char *XMLBuf, *XMLBufEnd, *XMLBufPtr; - FILE *fd; - struct stat fileAttr; - int nrOfLoops, bufferSize, fileSize, i, isFinal; - int j = 0, ns = 0; - clock_t tstart, tend; - double cpuTime = 0.0; - - if (argc > 1) { - if (argv[1][0] == '-') { - if (argv[1][1] == 'n' && argv[1][2] == '\0') { - ns = 1; - j = 1; - } - else - usage(argv[0], 1); - } - } - - if (argc != j + 4) - usage(argv[0], 1); - - if (stat (argv[j + 1], &fileAttr) != 0) { - fprintf (stderr, "could not access file '%s'\n", argv[j + 1]); - return 2; - } - - fd = fopen (argv[j + 1], "r"); - if (!fd) { - fprintf (stderr, "could not open file '%s'\n", argv[j + 1]); - exit(2); - } - - bufferSize = atoi (argv[j + 2]); - nrOfLoops = atoi (argv[j + 3]); - if (bufferSize <= 0 || nrOfLoops <= 0) { - fprintf (stderr, - "buffer size and nr of loops must be greater than zero.\n"); - exit(3); - } - - XMLBuf = malloc (fileAttr.st_size); - fileSize = fread (XMLBuf, sizeof (char), fileAttr.st_size, fd); - fclose (fd); - - if (ns) - parser = XML_ParserCreateNS(NULL, '!'); - else - parser = XML_ParserCreate(NULL); - - i = 0; - XMLBufEnd = XMLBuf + fileSize; - while (i < nrOfLoops) { - XMLBufPtr = XMLBuf; - isFinal = 0; - tstart = clock(); - do { - int parseBufferSize = XMLBufEnd - XMLBufPtr; - if (parseBufferSize <= bufferSize) - isFinal = 1; - else - parseBufferSize = bufferSize; - if (!XML_Parse (parser, XMLBufPtr, parseBufferSize, isFinal)) { - fprintf (stderr, "error '%s' at line %" XML_FMT_INT_MOD \ - "u character %" XML_FMT_INT_MOD "u\n", - XML_ErrorString (XML_GetErrorCode (parser)), - XML_GetCurrentLineNumber (parser), - XML_GetCurrentColumnNumber (parser)); - free (XMLBuf); - XML_ParserFree (parser); - exit (4); - } - XMLBufPtr += bufferSize; - } while (!isFinal); - tend = clock(); - cpuTime += ((double) (tend - tstart)) / CLOCKS_PER_SEC; - XML_ParserReset(parser, NULL); - i++; - } - - XML_ParserFree (parser); - free (XMLBuf); - - printf ("%d loops, with buffer size %d. Average time per loop: %f\n", - nrOfLoops, bufferSize, cpuTime / (double) nrOfLoops); - return 0; -} diff --git a/external/mit/expat/dist/tests/benchmark/benchmark.dsp b/external/mit/expat/dist/tests/benchmark/benchmark.dsp deleted file mode 100755 index a3fd9786d..000000000 --- a/external/mit/expat/dist/tests/benchmark/benchmark.dsp +++ /dev/null @@ -1,88 +0,0 @@ -# Microsoft Developer Studio Project File - Name="benchmark" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=benchmark - Win32 Debug -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "benchmark.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "benchmark.mak" CFG="benchmark - Win32 Debug" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "benchmark - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "benchmark - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "benchmark - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir "Release" -# PROP BASE Intermediate_Dir "Release" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "Release" -# PROP Intermediate_Dir "Release" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD CPP /nologo /W3 /GX /O2 /I "..\..\lib" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c -# ADD BASE RSC /l 0x1009 /d "NDEBUG" -# ADD RSC /l 0x1009 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 -# ADD LINK32 libexpat.lib /nologo /subsystem:console /machine:I386 /libpath:"..\..\win32\bin\Release" - -!ELSEIF "$(CFG)" == "benchmark - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir "Debug" -# PROP BASE Intermediate_Dir "Debug" -# PROP BASE Target_Dir "" -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "Debug" -# PROP Intermediate_Dir "Debug" -# PROP Target_Dir "" -# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "..\..\lib" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c -# ADD BASE RSC /l 0x1009 /d "_DEBUG" -# ADD RSC /l 0x1009 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -# ADD LINK32 libexpat.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\win32\bin\Debug" - -!ENDIF - -# Begin Target - -# Name "benchmark - Win32 Release" -# Name "benchmark - Win32 Debug" -# Begin Source File - -SOURCE=.\benchmark.c -# End Source File -# End Target -# End Project diff --git a/external/mit/expat/dist/tests/benchmark/benchmark.dsw b/external/mit/expat/dist/tests/benchmark/benchmark.dsw deleted file mode 100755 index 3346a9ad9..000000000 --- a/external/mit/expat/dist/tests/benchmark/benchmark.dsw +++ /dev/null @@ -1,44 +0,0 @@ -Microsoft Developer Studio Workspace File, Format Version 6.00 -# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! - -############################################################################### - -Project: "benchmark"=.\benchmark.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ - Begin Project Dependency - Project_Dep_Name expat - End Project Dependency -}}} - -############################################################################### - -Project: "expat"=..\..\lib\expat.dsp - Package Owner=<4> - -Package=<5> -{{{ -}}} - -Package=<4> -{{{ -}}} - -############################################################################### - -Global: - -Package=<5> -{{{ -}}} - -Package=<3> -{{{ -}}} - -############################################################################### - diff --git a/external/mit/expat/dist/tests/chardata.c b/external/mit/expat/dist/tests/chardata.c deleted file mode 100755 index 5fb0299d8..000000000 --- a/external/mit/expat/dist/tests/chardata.c +++ /dev/null @@ -1,131 +0,0 @@ -/* Copyright (c) 1998-2003 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. - - chardata.c -*/ - -#ifdef HAVE_EXPAT_CONFIG_H -#include -#endif -#ifdef HAVE_CHECK_H -#include -#else -#include "minicheck.h" -#endif - -#include -#include -#include - -#include "chardata.h" - - -static int -xmlstrlen(const XML_Char *s) -{ - int len = 0; - assert(s != NULL); - while (s[len] != 0) - ++len; - return len; -} - - -void -CharData_Init(CharData *storage) -{ - assert(storage != NULL); - storage->count = -1; -} - -void -CharData_AppendString(CharData *storage, const char *s) -{ - int maxchars = sizeof(storage->data) / sizeof(storage->data[0]); - int len; - - assert(s != NULL); - len = strlen(s); - if (storage->count < 0) - storage->count = 0; - if ((len + storage->count) > maxchars) { - len = (maxchars - storage->count); - } - if (len + storage->count < sizeof(storage->data)) { - memcpy(storage->data + storage->count, s, len); - storage->count += len; - } -} - -void -CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len) -{ - int maxchars; - - assert(storage != NULL); - assert(s != NULL); - maxchars = sizeof(storage->data) / sizeof(storage->data[0]); - if (storage->count < 0) - storage->count = 0; - if (len < 0) - len = xmlstrlen(s); - if ((len + storage->count) > maxchars) { - len = (maxchars - storage->count); - } - if (len + storage->count < sizeof(storage->data)) { - memcpy(storage->data + storage->count, s, - len * sizeof(storage->data[0])); - storage->count += len; - } -} - -int -CharData_CheckString(CharData *storage, const char *expected) -{ - char buffer[1280]; - int len; - int count; - - assert(storage != NULL); - assert(expected != NULL); - count = (storage->count < 0) ? 0 : storage->count; - len = strlen(expected); - if (len != count) { - if (sizeof(XML_Char) == 1) - sprintf(buffer, "wrong number of data characters:" - " got %d, expected %d:\n%s", count, len, storage->data); - else - sprintf(buffer, - "wrong number of data characters: got %d, expected %d", - count, len); - fail(buffer); - return 0; - } - if (memcmp(expected, storage->data, len) != 0) { - fail("got bad data bytes"); - return 0; - } - return 1; -} - -int -CharData_CheckXMLChars(CharData *storage, const XML_Char *expected) -{ - char buffer[1024]; - int len = xmlstrlen(expected); - int count; - - assert(storage != NULL); - count = (storage->count < 0) ? 0 : storage->count; - if (len != count) { - sprintf(buffer, "wrong number of data characters: got %d, expected %d", - count, len); - fail(buffer); - return 0; - } - if (memcmp(expected, storage->data, len * sizeof(storage->data[0])) != 0) { - fail("got bad data bytes"); - return 0; - } - return 1; -} diff --git a/external/mit/expat/dist/tests/chardata.h b/external/mit/expat/dist/tests/chardata.h deleted file mode 100755 index e8dc4ce22..000000000 --- a/external/mit/expat/dist/tests/chardata.h +++ /dev/null @@ -1,40 +0,0 @@ -/* chardata.h - - Interface to some helper routines used to accumulate and check text - and attribute content. -*/ - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef XML_CHARDATA_H -#define XML_CHARDATA_H 1 - -#ifndef XML_VERSION -#include "expat.h" /* need XML_Char */ -#endif - - -typedef struct { - int count; /* # of chars, < 0 if not set */ - XML_Char data[1024]; -} CharData; - - -void CharData_Init(CharData *storage); - -void CharData_AppendString(CharData *storage, const char *s); - -void CharData_AppendXMLChars(CharData *storage, const XML_Char *s, int len); - -int CharData_CheckString(CharData *storage, const char *s); - -int CharData_CheckXMLChars(CharData *storage, const XML_Char *s); - - -#endif /* XML_CHARDATA_H */ - -#ifdef __cplusplus -} -#endif diff --git a/external/mit/expat/dist/tests/minicheck.c b/external/mit/expat/dist/tests/minicheck.c deleted file mode 100755 index d2f4295ff..000000000 --- a/external/mit/expat/dist/tests/minicheck.c +++ /dev/null @@ -1,182 +0,0 @@ -/* Miniature re-implementation of the "check" library. - * - * This is intended to support just enough of check to run the Expat - * tests. This interface is based entirely on the portion of the - * check library being used. - */ - -#include -#include -#include -#include - -#include "minicheck.h" - -Suite * -suite_create(char *name) -{ - Suite *suite = (Suite *) calloc(1, sizeof(Suite)); - if (suite != NULL) { - suite->name = name; - } - return suite; -} - -TCase * -tcase_create(char *name) -{ - TCase *tc = (TCase *) calloc(1, sizeof(TCase)); - if (tc != NULL) { - tc->name = name; - } - return tc; -} - -void -suite_add_tcase(Suite *suite, TCase *tc) -{ - assert(suite != NULL); - assert(tc != NULL); - assert(tc->next_tcase == NULL); - - tc->next_tcase = suite->tests; - suite->tests = tc; -} - -void -tcase_add_checked_fixture(TCase *tc, - tcase_setup_function setup, - tcase_teardown_function teardown) -{ - assert(tc != NULL); - tc->setup = setup; - tc->teardown = teardown; -} - -void -tcase_add_test(TCase *tc, tcase_test_function test) -{ - assert(tc != NULL); - if (tc->allocated == tc->ntests) { - int nalloc = tc->allocated + 100; - size_t new_size = sizeof(tcase_test_function) * nalloc; - tcase_test_function *new_tests = realloc(tc->tests, new_size); - assert(new_tests != NULL); - if (new_tests != tc->tests) { - free(tc->tests); - tc->tests = new_tests; - } - tc->allocated = nalloc; - } - tc->tests[tc->ntests] = test; - tc->ntests++; -} - -SRunner * -srunner_create(Suite *suite) -{ - SRunner *runner = calloc(1, sizeof(SRunner)); - if (runner != NULL) { - runner->suite = suite; - } - return runner; -} - -static jmp_buf env; - -static char const *_check_current_function = NULL; -static int _check_current_lineno = -1; -static char const *_check_current_filename = NULL; - -void -_check_set_test_info(char const *function, char const *filename, int lineno) -{ - _check_current_function = function; - _check_current_lineno = lineno; - _check_current_filename = filename; -} - - -static void -add_failure(SRunner *runner, int verbosity) -{ - runner->nfailures++; - if (verbosity >= CK_VERBOSE) { - printf("%s:%d: %s\n", _check_current_filename, - _check_current_lineno, _check_current_function); - } -} - -void -srunner_run_all(SRunner *runner, int verbosity) -{ - Suite *suite; - TCase *tc; - assert(runner != NULL); - suite = runner->suite; - tc = suite->tests; - while (tc != NULL) { - int i; - for (i = 0; i < tc->ntests; ++i) { - runner->nchecks++; - - if (tc->setup != NULL) { - /* setup */ - if (setjmp(env)) { - add_failure(runner, verbosity); - continue; - } - tc->setup(); - } - /* test */ - if (setjmp(env)) { - add_failure(runner, verbosity); - continue; - } - (tc->tests[i])(); - - /* teardown */ - if (tc->teardown != NULL) { - if (setjmp(env)) { - add_failure(runner, verbosity); - continue; - } - tc->teardown(); - } - } - tc = tc->next_tcase; - } - if (verbosity) { - int passed = runner->nchecks - runner->nfailures; - double percentage = ((double) passed) / runner->nchecks; - int display = (int) (percentage * 100); - printf("%d%%: Checks: %d, Failed: %d\n", - display, runner->nchecks, runner->nfailures); - } -} - -void -_fail_unless(int condition, const char *file, int line, char *msg) -{ - /* Always print the error message so it isn't lost. In this case, - we have a failure, so there's no reason to be quiet about what - it is. - */ - if (msg != NULL) - printf("%s", msg); - longjmp(env, 1); -} - -int -srunner_ntests_failed(SRunner *runner) -{ - assert(runner != NULL); - return runner->nfailures; -} - -void -srunner_free(SRunner *runner) -{ - free(runner->suite); - free(runner); -} diff --git a/external/mit/expat/dist/tests/minicheck.h b/external/mit/expat/dist/tests/minicheck.h deleted file mode 100755 index c917c0269..000000000 --- a/external/mit/expat/dist/tests/minicheck.h +++ /dev/null @@ -1,90 +0,0 @@ -/* Miniature re-implementation of the "check" library. - * - * This is intended to support just enough of check to run the Expat - * tests. This interface is based entirely on the portion of the - * check library being used. - * - * This is *source* compatible, but not necessary *link* compatible. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -#define CK_NOFORK 0 -#define CK_FORK 1 - -#define CK_SILENT 0 -#define CK_NORMAL 1 -#define CK_VERBOSE 2 - -/* Workaround for Microsoft's compiler and Tru64 Unix systems where the - C compiler has a working __func__, but the C++ compiler only has a - working __FUNCTION__. This could be fixed in configure.in, but it's - not worth it right now. */ -#if defined (_MSC_VER) || (defined(__osf__) && defined(__cplusplus)) -#define __func__ __FUNCTION__ -#endif - -#define START_TEST(testname) static void testname(void) { \ - _check_set_test_info(__func__, __FILE__, __LINE__); \ - { -#define END_TEST } } - -#define fail(msg) _fail_unless(0, __FILE__, __LINE__, msg) - -typedef void (*tcase_setup_function)(void); -typedef void (*tcase_teardown_function)(void); -typedef void (*tcase_test_function)(void); - -typedef struct SRunner SRunner; -typedef struct Suite Suite; -typedef struct TCase TCase; - -struct SRunner { - Suite *suite; - int nchecks; - int nfailures; -}; - -struct Suite { - char *name; - TCase *tests; -}; - -struct TCase { - char *name; - tcase_setup_function setup; - tcase_teardown_function teardown; - tcase_test_function *tests; - int ntests; - int allocated; - TCase *next_tcase; -}; - - -/* Internal helper. */ -void _check_set_test_info(char const *function, - char const *filename, int lineno); - - -/* - * Prototypes for the actual implementation. - */ - -void _fail_unless(int condition, const char *file, int line, char *msg); -Suite *suite_create(char *name); -TCase *tcase_create(char *name); -void suite_add_tcase(Suite *suite, TCase *tc); -void tcase_add_checked_fixture(TCase *, - tcase_setup_function, - tcase_teardown_function); -void tcase_add_test(TCase *tc, tcase_test_function test); -SRunner *srunner_create(Suite *suite); -void srunner_run_all(SRunner *runner, int verbosity); -int srunner_ntests_failed(SRunner *runner); -void srunner_free(SRunner *runner); - -#ifdef __cplusplus -} -#endif diff --git a/external/mit/expat/dist/tests/runtests.c b/external/mit/expat/dist/tests/runtests.c deleted file mode 100755 index 614d6b248..000000000 --- a/external/mit/expat/dist/tests/runtests.c +++ /dev/null @@ -1,1515 +0,0 @@ -/* Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. - - runtest.c : run the Expat test suite -*/ - -#ifdef HAVE_EXPAT_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include - -#include "expat.h" -#include "chardata.h" -#include "minicheck.h" - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - -#ifdef XML_LARGE_SIZE -#define XML_FMT_INT_MOD "ll" -#else -#define XML_FMT_INT_MOD "l" -#endif - -static XML_Parser parser; - - -static void -basic_setup(void) -{ - parser = XML_ParserCreate(NULL); - if (parser == NULL) - fail("Parser not created."); -} - -static void -basic_teardown(void) -{ - if (parser != NULL) - XML_ParserFree(parser); -} - -/* Generate a failure using the parser state to create an error message; - this should be used when the parser reports an error we weren't - expecting. -*/ -static void -_xml_failure(XML_Parser parser, const char *file, int line) -{ - char buffer[1024]; - enum XML_Error err = XML_GetErrorCode(parser); - sprintf(buffer, - " %d: %s (line %" XML_FMT_INT_MOD "u, offset %"\ - XML_FMT_INT_MOD "u)\n reported from %s, line %d\n", - err, - XML_ErrorString(err), - XML_GetCurrentLineNumber(parser), - XML_GetCurrentColumnNumber(parser), - file, line); - _fail_unless(0, file, line, buffer); -} - -#define xml_failure(parser) _xml_failure((parser), __FILE__, __LINE__) - -static void -_expect_failure(char *text, enum XML_Error errorCode, char *errorMessage, - char *file, int lineno) -{ - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) - /* Hackish use of _fail_unless() macro, but let's us report - the right filename and line number. */ - _fail_unless(0, file, lineno, errorMessage); - if (XML_GetErrorCode(parser) != errorCode) - _xml_failure(parser, file, lineno); -} - -#define expect_failure(text, errorCode, errorMessage) \ - _expect_failure((text), (errorCode), (errorMessage), \ - __FILE__, __LINE__) - -/* Dummy handlers for when we need to set a handler to tickle a bug, - but it doesn't need to do anything. -*/ - -static void XMLCALL -dummy_start_doctype_handler(void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset) -{} - -static void XMLCALL -dummy_end_doctype_handler(void *userData) -{} - -static void XMLCALL -dummy_entity_decl_handler(void *userData, - const XML_Char *entityName, - int is_parameter_entity, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName) -{} - -static void XMLCALL -dummy_notation_decl_handler(void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{} - -static void XMLCALL -dummy_element_decl_handler(void *userData, - const XML_Char *name, - XML_Content *model) -{} - -static void XMLCALL -dummy_attlist_decl_handler(void *userData, - const XML_Char *elname, - const XML_Char *attname, - const XML_Char *att_type, - const XML_Char *dflt, - int isrequired) -{} - -static void XMLCALL -dummy_comment_handler(void *userData, const XML_Char *data) -{} - -static void XMLCALL -dummy_pi_handler(void *userData, const XML_Char *target, const XML_Char *data) -{} - -static void XMLCALL -dummy_start_element(void *userData, - const XML_Char *name, const XML_Char **atts) -{} - - -/* - * Character & encoding tests. - */ - -START_TEST(test_nul_byte) -{ - char text[] = "\0"; - - /* test that a NUL byte (in US-ASCII data) is an error */ - if (XML_Parse(parser, text, sizeof(text) - 1, XML_TRUE) == XML_STATUS_OK) - fail("Parser did not report error on NUL-byte."); - if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN) - xml_failure(parser); -} -END_TEST - - -START_TEST(test_u0000_char) -{ - /* test that a NUL byte (in US-ASCII data) is an error */ - expect_failure("", - XML_ERROR_BAD_CHAR_REF, - "Parser did not report error on NUL-byte."); -} -END_TEST - -START_TEST(test_bom_utf8) -{ - /* This test is really just making sure we don't core on a UTF-8 BOM. */ - char *text = "\357\273\277"; - - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -START_TEST(test_bom_utf16_be) -{ - char text[] = "\376\377\0<\0e\0/\0>"; - - if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -START_TEST(test_bom_utf16_le) -{ - char text[] = "\377\376<\0e\0/\0>\0"; - - if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -static void XMLCALL -accumulate_characters(void *userData, const XML_Char *s, int len) -{ - CharData_AppendXMLChars((CharData *)userData, s, len); -} - -static void XMLCALL -accumulate_attribute(void *userData, const XML_Char *name, - const XML_Char **atts) -{ - CharData *storage = (CharData *)userData; - if (storage->count < 0 && atts != NULL && atts[0] != NULL) { - /* "accumulate" the value of the first attribute we see */ - CharData_AppendXMLChars(storage, atts[1], -1); - } -} - - -static void -_run_character_check(XML_Char *text, XML_Char *expected, - const char *file, int line) -{ - CharData storage; - - CharData_Init(&storage); - XML_SetUserData(parser, &storage); - XML_SetCharacterDataHandler(parser, accumulate_characters); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - _xml_failure(parser, file, line); - CharData_CheckXMLChars(&storage, expected); -} - -#define run_character_check(text, expected) \ - _run_character_check(text, expected, __FILE__, __LINE__) - -static void -_run_attribute_check(XML_Char *text, XML_Char *expected, - const char *file, int line) -{ - CharData storage; - - CharData_Init(&storage); - XML_SetUserData(parser, &storage); - XML_SetStartElementHandler(parser, accumulate_attribute); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - _xml_failure(parser, file, line); - CharData_CheckXMLChars(&storage, expected); -} - -#define run_attribute_check(text, expected) \ - _run_attribute_check(text, expected, __FILE__, __LINE__) - -/* Regression test for SF bug #491986. */ -START_TEST(test_danish_latin1) -{ - char *text = - "\n" - "J\xF8rgen \xE6\xF8\xE5\xC6\xD8\xC5"; - run_character_check(text, - "J\xC3\xB8rgen \xC3\xA6\xC3\xB8\xC3\xA5\xC3\x86\xC3\x98\xC3\x85"); -} -END_TEST - - -/* Regression test for SF bug #514281. */ -START_TEST(test_french_charref_hexidecimal) -{ - char *text = - "\n" - "éèàçêÈ"; - run_character_check(text, - "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); -} -END_TEST - -START_TEST(test_french_charref_decimal) -{ - char *text = - "\n" - "éèàçêÈ"; - run_character_check(text, - "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); -} -END_TEST - -START_TEST(test_french_latin1) -{ - char *text = - "\n" - "\xE9\xE8\xE0\xE7\xEa\xC8"; - run_character_check(text, - "\xC3\xA9\xC3\xA8\xC3\xA0\xC3\xA7\xC3\xAA\xC3\x88"); -} -END_TEST - -START_TEST(test_french_utf8) -{ - char *text = - "\n" - "\xC3\xA9"; - run_character_check(text, "\xC3\xA9"); -} -END_TEST - -/* Regression test for SF bug #600479. - XXX There should be a test that exercises all legal XML Unicode - characters as PCDATA and attribute value content, and XML Name - characters as part of element and attribute names. -*/ -START_TEST(test_utf8_false_rejection) -{ - char *text = "\xEF\xBA\xBF"; - run_character_check(text, "\xEF\xBA\xBF"); -} -END_TEST - -/* Regression test for SF bug #477667. - This test assures that any 8-bit character followed by a 7-bit - character will not be mistakenly interpreted as a valid UTF-8 - sequence. -*/ -START_TEST(test_illegal_utf8) -{ - char text[100]; - int i; - - for (i = 128; i <= 255; ++i) { - sprintf(text, "%ccd", i); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_OK) { - sprintf(text, - "expected token error for '%c' (ordinal %d) in UTF-8 text", - i, i); - fail(text); - } - else if (XML_GetErrorCode(parser) != XML_ERROR_INVALID_TOKEN) - xml_failure(parser); - /* Reset the parser since we use the same parser repeatedly. */ - XML_ParserReset(parser, NULL); - } -} -END_TEST - -START_TEST(test_utf16) -{ - /* - some text - */ - char text[] = - "\000<\000?\000x\000m\000\154\000 \000v\000e\000r\000s\000i\000o" - "\000n\000=\000'\0001\000.\000\060\000'\000 \000e\000n\000c\000o" - "\000d\000i\000n\000g\000=\000'\000U\000T\000F\000-\0001\000\066" - "\000'\000?\000>\000\n" - "\000<\000d\000o\000c\000 \000a\000=\000'\0001\0002\0003\000'" - "\000>\000s\000o\000m\000e\000 \000t\000e\000x\000t\000<\000/" - "\000d\000o\000c\000>"; - if (XML_Parse(parser, text, sizeof(text)-1, XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -START_TEST(test_utf16_le_epilog_newline) -{ - unsigned int first_chunk_bytes = 17; - char text[] = - "\xFF\xFE" /* BOM */ - "<\000e\000/\000>\000" /* document element */ - "\r\000\n\000\r\000\n\000"; /* epilog */ - - if (first_chunk_bytes >= sizeof(text) - 1) - fail("bad value of first_chunk_bytes"); - if ( XML_Parse(parser, text, first_chunk_bytes, XML_FALSE) - == XML_STATUS_ERROR) - xml_failure(parser); - else { - enum XML_Status rc; - rc = XML_Parse(parser, text + first_chunk_bytes, - sizeof(text) - first_chunk_bytes - 1, XML_TRUE); - if (rc == XML_STATUS_ERROR) - xml_failure(parser); - } -} -END_TEST - -/* Regression test for SF bug #481609, #774028. */ -START_TEST(test_latin1_umlauts) -{ - char *text = - "\n" - "\xE4 \xF6 \xFC ä ö ü ä ö ü >"; - char *utf8 = - "\xC3\xA4 \xC3\xB6 \xC3\xBC " - "\xC3\xA4 \xC3\xB6 \xC3\xBC " - "\xC3\xA4 \xC3\xB6 \xC3\xBC >"; - run_character_check(text, utf8); - XML_ParserReset(parser, NULL); - run_attribute_check(text, utf8); -} -END_TEST - -/* Regression test #1 for SF bug #653180. */ -START_TEST(test_line_number_after_parse) -{ - char *text = - "\n" - "\n" - "\n"; - XML_Size lineno; - - if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) - xml_failure(parser); - lineno = XML_GetCurrentLineNumber(parser); - if (lineno != 4) { - char buffer[100]; - sprintf(buffer, - "expected 4 lines, saw %" XML_FMT_INT_MOD "u", lineno); - fail(buffer); - } -} -END_TEST - -/* Regression test #2 for SF bug #653180. */ -START_TEST(test_column_number_after_parse) -{ - char *text = ""; - XML_Size colno; - - if (XML_Parse(parser, text, strlen(text), XML_FALSE) == XML_STATUS_ERROR) - xml_failure(parser); - colno = XML_GetCurrentColumnNumber(parser); - if (colno != 11) { - char buffer[100]; - sprintf(buffer, - "expected 11 columns, saw %" XML_FMT_INT_MOD "u", colno); - fail(buffer); - } -} -END_TEST - -static void XMLCALL -start_element_event_handler2(void *userData, const XML_Char *name, - const XML_Char **attr) -{ - CharData *storage = (CharData *) userData; - char buffer[100]; - - sprintf(buffer, - "<%s> at col:%" XML_FMT_INT_MOD "u line:%"\ - XML_FMT_INT_MOD "u\n", name, - XML_GetCurrentColumnNumber(parser), - XML_GetCurrentLineNumber(parser)); - CharData_AppendString(storage, buffer); -} - -static void XMLCALL -end_element_event_handler2(void *userData, const XML_Char *name) -{ - CharData *storage = (CharData *) userData; - char buffer[100]; - - sprintf(buffer, - " at col:%" XML_FMT_INT_MOD "u line:%"\ - XML_FMT_INT_MOD "u\n", name, - XML_GetCurrentColumnNumber(parser), - XML_GetCurrentLineNumber(parser)); - CharData_AppendString(storage, buffer); -} - -/* Regression test #3 for SF bug #653180. */ -START_TEST(test_line_and_column_numbers_inside_handlers) -{ - char *text = - "\n" /* Unix end-of-line */ - " \r\n" /* Windows end-of-line */ - " \r" /* Mac OS end-of-line */ - " \n" - " \n" - " \n" - " \n" - ""; - char *expected = - " at col:0 line:1\n" - " at col:2 line:2\n" - " at col:4 line:3\n" - " at col:8 line:3\n" - " at col:2 line:4\n" - " at col:2 line:5\n" - " at col:4 line:6\n" - " at col:8 line:6\n" - " at col:2 line:7\n" - " at col:0 line:8\n"; - CharData storage; - - CharData_Init(&storage); - XML_SetUserData(parser, &storage); - XML_SetStartElementHandler(parser, start_element_event_handler2); - XML_SetEndElementHandler(parser, end_element_event_handler2); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); - - CharData_CheckString(&storage, expected); -} -END_TEST - -/* Regression test #4 for SF bug #653180. */ -START_TEST(test_line_number_after_error) -{ - char *text = - "\n" - " \n" - " "; /* missing */ - XML_Size lineno; - if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR) - fail("Expected a parse error"); - - lineno = XML_GetCurrentLineNumber(parser); - if (lineno != 3) { - char buffer[100]; - sprintf(buffer, "expected 3 lines, saw %" XML_FMT_INT_MOD "u", lineno); - fail(buffer); - } -} -END_TEST - -/* Regression test #5 for SF bug #653180. */ -START_TEST(test_column_number_after_error) -{ - char *text = - "\n" - " \n" - " "; /* missing */ - XML_Size colno; - if (XML_Parse(parser, text, strlen(text), XML_FALSE) != XML_STATUS_ERROR) - fail("Expected a parse error"); - - colno = XML_GetCurrentColumnNumber(parser); - if (colno != 4) { - char buffer[100]; - sprintf(buffer, - "expected 4 columns, saw %" XML_FMT_INT_MOD "u", colno); - fail(buffer); - } -} -END_TEST - -/* Regression test for SF bug #478332. */ -START_TEST(test_really_long_lines) -{ - /* This parses an input line longer than INIT_DATA_BUF_SIZE - characters long (defined to be 1024 in xmlparse.c). We take a - really cheesy approach to building the input buffer, because - this avoids writing bugs in buffer-filling code. - */ - char *text = - "" - /* 64 chars */ - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - /* until we have at least 1024 characters on the line: */ - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-+" - ""; - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - - -/* - * Element event tests. - */ - -static void XMLCALL -end_element_event_handler(void *userData, const XML_Char *name) -{ - CharData *storage = (CharData *) userData; - CharData_AppendString(storage, "/"); - CharData_AppendXMLChars(storage, name, -1); -} - -START_TEST(test_end_element_events) -{ - char *text = ""; - char *expected = "/c/b/f/d/a"; - CharData storage; - - CharData_Init(&storage); - XML_SetUserData(parser, &storage); - XML_SetEndElementHandler(parser, end_element_event_handler); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); - CharData_CheckString(&storage, expected); -} -END_TEST - - -/* - * Attribute tests. - */ - -/* Helpers used by the following test; this checks any "attr" and "refs" - attributes to make sure whitespace has been normalized. - - Return true if whitespace has been normalized in a string, using - the rules for attribute value normalization. The 'is_cdata' flag - is needed since CDATA attributes don't need to have multiple - whitespace characters collapsed to a single space, while other - attribute data types do. (Section 3.3.3 of the recommendation.) -*/ -static int -is_whitespace_normalized(const XML_Char *s, int is_cdata) -{ - int blanks = 0; - int at_start = 1; - while (*s) { - if (*s == ' ') - ++blanks; - else if (*s == '\t' || *s == '\n' || *s == '\r') - return 0; - else { - if (at_start) { - at_start = 0; - if (blanks && !is_cdata) - /* illegal leading blanks */ - return 0; - } - else if (blanks > 1 && !is_cdata) - return 0; - blanks = 0; - } - ++s; - } - if (blanks && !is_cdata) - return 0; - return 1; -} - -/* Check the attribute whitespace checker: */ -static void -testhelper_is_whitespace_normalized(void) -{ - assert(is_whitespace_normalized("abc", 0)); - assert(is_whitespace_normalized("abc", 1)); - assert(is_whitespace_normalized("abc def ghi", 0)); - assert(is_whitespace_normalized("abc def ghi", 1)); - assert(!is_whitespace_normalized(" abc def ghi", 0)); - assert(is_whitespace_normalized(" abc def ghi", 1)); - assert(!is_whitespace_normalized("abc def ghi", 0)); - assert(is_whitespace_normalized("abc def ghi", 1)); - assert(!is_whitespace_normalized("abc def ghi ", 0)); - assert(is_whitespace_normalized("abc def ghi ", 1)); - assert(!is_whitespace_normalized(" ", 0)); - assert(is_whitespace_normalized(" ", 1)); - assert(!is_whitespace_normalized("\t", 0)); - assert(!is_whitespace_normalized("\t", 1)); - assert(!is_whitespace_normalized("\n", 0)); - assert(!is_whitespace_normalized("\n", 1)); - assert(!is_whitespace_normalized("\r", 0)); - assert(!is_whitespace_normalized("\r", 1)); - assert(!is_whitespace_normalized("abc\t def", 1)); -} - -static void XMLCALL -check_attr_contains_normalized_whitespace(void *userData, - const XML_Char *name, - const XML_Char **atts) -{ - int i; - for (i = 0; atts[i] != NULL; i += 2) { - const XML_Char *attrname = atts[i]; - const XML_Char *value = atts[i + 1]; - if (strcmp("attr", attrname) == 0 - || strcmp("ents", attrname) == 0 - || strcmp("refs", attrname) == 0) { - if (!is_whitespace_normalized(value, 0)) { - char buffer[256]; - sprintf(buffer, "attribute value not normalized: %s='%s'", - attrname, value); - fail(buffer); - } - } - } -} - -START_TEST(test_attr_whitespace_normalization) -{ - char *text = - "\n" - "]>\n" - "\n" - " \n" - " \n" - ""; - - XML_SetStartElementHandler(parser, - check_attr_contains_normalized_whitespace); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - - -/* - * XML declaration tests. - */ - -START_TEST(test_xmldecl_misplaced) -{ - expect_failure("\n" - "\n" - "", - XML_ERROR_MISPLACED_XML_PI, - "failed to report misplaced XML declaration"); -} -END_TEST - -/* Regression test for SF bug #584832. */ -static int XMLCALL -UnknownEncodingHandler(void *data,const XML_Char *encoding,XML_Encoding *info) -{ - if (strcmp(encoding,"unsupported-encoding") == 0) { - int i; - for (i = 0; i < 256; ++i) - info->map[i] = i; - info->data = NULL; - info->convert = NULL; - info->release = NULL; - return XML_STATUS_OK; - } - return XML_STATUS_ERROR; -} - -START_TEST(test_unknown_encoding_internal_entity) -{ - char *text = - "\n" - "]>\n" - ""; - - XML_SetUnknownEncodingHandler(parser, UnknownEncodingHandler, NULL); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -/* Regression test for SF bug #620106. */ -static int XMLCALL -external_entity_loader_set_encoding(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - /* This text says it's an unsupported encoding, but it's really - UTF-8, which we tell Expat using XML_SetEncoding(). - */ - char *text = - "" - "\xC3\xA9"; - XML_Parser extparser; - - extparser = XML_ExternalEntityParserCreate(parser, context, NULL); - if (extparser == NULL) - fail("Could not create external entity parser."); - if (!XML_SetEncoding(extparser, "utf-8")) - fail("XML_SetEncoding() ignored for external entity"); - if ( XML_Parse(extparser, text, strlen(text), XML_TRUE) - == XML_STATUS_ERROR) { - xml_failure(parser); - return 0; - } - return 1; -} - -START_TEST(test_ext_entity_set_encoding) -{ - char *text = - "\n" - "]>\n" - "&en;"; - - XML_SetExternalEntityRefHandler(parser, - external_entity_loader_set_encoding); - run_character_check(text, "\xC3\xA9"); -} -END_TEST - -/* Test that no error is reported for unknown entities if we don't - read an external subset. This was fixed in Expat 1.95.5. -*/ -START_TEST(test_wfc_undeclared_entity_unread_external_subset) { - char *text = - "\n" - "&entity;"; - - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -/* Test that an error is reported for unknown entities if we don't - have an external subset. -*/ -START_TEST(test_wfc_undeclared_entity_no_external_subset) { - expect_failure("&entity;", - XML_ERROR_UNDEFINED_ENTITY, - "Parser did not report undefined entity w/out a DTD."); -} -END_TEST - -/* Test that an error is reported for unknown entities if we don't - read an external subset, but have been declared standalone. -*/ -START_TEST(test_wfc_undeclared_entity_standalone) { - char *text = - "\n" - "\n" - "&entity;"; - - expect_failure(text, - XML_ERROR_UNDEFINED_ENTITY, - "Parser did not report undefined entity (standalone)."); -} -END_TEST - -static int XMLCALL -external_entity_loader(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - char *text = (char *)XML_GetUserData(parser); - XML_Parser extparser; - - extparser = XML_ExternalEntityParserCreate(parser, context, NULL); - if (extparser == NULL) - fail("Could not create external entity parser."); - if ( XML_Parse(extparser, text, strlen(text), XML_TRUE) - == XML_STATUS_ERROR) { - xml_failure(parser); - return XML_STATUS_ERROR; - } - return XML_STATUS_OK; -} - -/* Test that an error is reported for unknown entities if we have read - an external subset, and standalone is true. -*/ -START_TEST(test_wfc_undeclared_entity_with_external_subset_standalone) { - char *text = - "\n" - "\n" - "&entity;"; - char *foo_text = - ""; - - XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); - XML_SetUserData(parser, foo_text); - XML_SetExternalEntityRefHandler(parser, external_entity_loader); - expect_failure(text, - XML_ERROR_UNDEFINED_ENTITY, - "Parser did not report undefined entity (external DTD)."); -} -END_TEST - -/* Test that no error is reported for unknown entities if we have read - an external subset, and standalone is false. -*/ -START_TEST(test_wfc_undeclared_entity_with_external_subset) { - char *text = - "\n" - "\n" - "&entity;"; - char *foo_text = - ""; - - XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); - XML_SetUserData(parser, foo_text); - XML_SetExternalEntityRefHandler(parser, external_entity_loader); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -START_TEST(test_wfc_no_recursive_entity_refs) -{ - char *text = - "\n" - "]>\n" - "&entity;"; - - expect_failure(text, - XML_ERROR_RECURSIVE_ENTITY_REF, - "Parser did not report recursive entity reference."); -} -END_TEST - -/* Regression test for SF bug #483514. */ -START_TEST(test_dtd_default_handling) -{ - char *text = - "\n" - "\n" - "\n" - "\n" - "\n" - "\n" - "]>"; - - XML_SetDefaultHandler(parser, accumulate_characters); - XML_SetDoctypeDeclHandler(parser, - dummy_start_doctype_handler, - dummy_end_doctype_handler); - XML_SetEntityDeclHandler(parser, dummy_entity_decl_handler); - XML_SetNotationDeclHandler(parser, dummy_notation_decl_handler); - XML_SetElementDeclHandler(parser, dummy_element_decl_handler); - XML_SetAttlistDeclHandler(parser, dummy_attlist_decl_handler); - XML_SetProcessingInstructionHandler(parser, dummy_pi_handler); - XML_SetCommentHandler(parser, dummy_comment_handler); - run_character_check(text, "\n\n\n\n\n\n\n"); -} -END_TEST - -/* See related SF bug #673791. - When namespace processing is enabled, setting the namespace URI for - a prefix is not allowed; this test ensures that it *is* allowed - when namespace processing is not enabled. - (See Namespaces in XML, section 2.) -*/ -START_TEST(test_empty_ns_without_namespaces) -{ - char *text = - "\n" - " \n" - ""; - - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -/* Regression test for SF bug #824420. - Checks that an xmlns:prefix attribute set in an attribute's default - value isn't misinterpreted. -*/ -START_TEST(test_ns_in_attribute_default_without_namespaces) -{ - char *text = - "\n" - " ]>\n" - ""; - - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -static char *long_character_data_text = - "" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - "012345678901234567890123456789012345678901234567890123456789" - ""; - -static XML_Bool resumable = XML_FALSE; - -static void -clearing_aborting_character_handler(void *userData, - const XML_Char *s, int len) -{ - XML_StopParser(parser, resumable); - XML_SetCharacterDataHandler(parser, NULL); -} - -/* Regression test for SF bug #1515266: missing check of stopped - parser in doContext() 'for' loop. */ -START_TEST(test_stop_parser_between_char_data_calls) -{ - /* The sample data must be big enough that there are two calls to - the character data handler from within the inner "for" loop of - the XML_TOK_DATA_CHARS case in doContent(), and the character - handler must stop the parser and clear the character data - handler. - */ - char *text = long_character_data_text; - - XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); - resumable = XML_FALSE; - if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_ERROR) - xml_failure(parser); - if (XML_GetErrorCode(parser) != XML_ERROR_ABORTED) - xml_failure(parser); -} -END_TEST - -/* Regression test for SF bug #1515266: missing check of stopped - parser in doContext() 'for' loop. */ -START_TEST(test_suspend_parser_between_char_data_calls) -{ - /* The sample data must be big enough that there are two calls to - the character data handler from within the inner "for" loop of - the XML_TOK_DATA_CHARS case in doContent(), and the character - handler must stop the parser and clear the character data - handler. - */ - char *text = long_character_data_text; - - XML_SetCharacterDataHandler(parser, clearing_aborting_character_handler); - resumable = XML_TRUE; - if (XML_Parse(parser, text, strlen(text), XML_TRUE) != XML_STATUS_SUSPENDED) - xml_failure(parser); - if (XML_GetErrorCode(parser) != XML_ERROR_NONE) - xml_failure(parser); -} -END_TEST - - -/* - * Namespaces tests. - */ - -static void -namespace_setup(void) -{ - parser = XML_ParserCreateNS(NULL, ' '); - if (parser == NULL) - fail("Parser not created."); -} - -static void -namespace_teardown(void) -{ - basic_teardown(); -} - -/* Check that an element name and attribute name match the expected values. - The expected values are passed as an array reference of string pointers - provided as the userData argument; the first is the expected - element name, and the second is the expected attribute name. -*/ -static void XMLCALL -triplet_start_checker(void *userData, const XML_Char *name, - const XML_Char **atts) -{ - char **elemstr = (char **)userData; - char buffer[1024]; - if (strcmp(elemstr[0], name) != 0) { - sprintf(buffer, "unexpected start string: '%s'", name); - fail(buffer); - } - if (strcmp(elemstr[1], atts[0]) != 0) { - sprintf(buffer, "unexpected attribute string: '%s'", atts[0]); - fail(buffer); - } -} - -/* Check that the element name passed to the end-element handler matches - the expected value. The expected value is passed as the first element - in an array of strings passed as the userData argument. -*/ -static void XMLCALL -triplet_end_checker(void *userData, const XML_Char *name) -{ - char **elemstr = (char **)userData; - if (strcmp(elemstr[0], name) != 0) { - char buffer[1024]; - sprintf(buffer, "unexpected end string: '%s'", name); - fail(buffer); - } -} - -START_TEST(test_return_ns_triplet) -{ - char *text = - ""; - char *elemstr[] = { - "http://expat.sf.net/ e foo", - "http://expat.sf.net/ a bar" - }; - XML_SetReturnNSTriplet(parser, XML_TRUE); - XML_SetUserData(parser, elemstr); - XML_SetElementHandler(parser, triplet_start_checker, triplet_end_checker); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -static void XMLCALL -overwrite_start_checker(void *userData, const XML_Char *name, - const XML_Char **atts) -{ - CharData *storage = (CharData *) userData; - CharData_AppendString(storage, "start "); - CharData_AppendXMLChars(storage, name, -1); - while (*atts != NULL) { - CharData_AppendString(storage, "\nattribute "); - CharData_AppendXMLChars(storage, *atts, -1); - atts += 2; - } - CharData_AppendString(storage, "\n"); -} - -static void XMLCALL -overwrite_end_checker(void *userData, const XML_Char *name) -{ - CharData *storage = (CharData *) userData; - CharData_AppendString(storage, "end "); - CharData_AppendXMLChars(storage, name, -1); - CharData_AppendString(storage, "\n"); -} - -static void -run_ns_tagname_overwrite_test(char *text, char *result) -{ - CharData storage; - CharData_Init(&storage); - XML_SetUserData(parser, &storage); - XML_SetElementHandler(parser, - overwrite_start_checker, overwrite_end_checker); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); - CharData_CheckString(&storage, result); -} - -/* Regression test for SF bug #566334. */ -START_TEST(test_ns_tagname_overwrite) -{ - char *text = - "\n" - " \n" - " \n" - ""; - char *result = - "start http://xml.libexpat.org/ e\n" - "start http://xml.libexpat.org/ f\n" - "attribute http://xml.libexpat.org/ attr\n" - "end http://xml.libexpat.org/ f\n" - "start http://xml.libexpat.org/ g\n" - "attribute http://xml.libexpat.org/ attr2\n" - "end http://xml.libexpat.org/ g\n" - "end http://xml.libexpat.org/ e\n"; - run_ns_tagname_overwrite_test(text, result); -} -END_TEST - -/* Regression test for SF bug #566334. */ -START_TEST(test_ns_tagname_overwrite_triplet) -{ - char *text = - "\n" - " \n" - " \n" - ""; - char *result = - "start http://xml.libexpat.org/ e n\n" - "start http://xml.libexpat.org/ f n\n" - "attribute http://xml.libexpat.org/ attr n\n" - "end http://xml.libexpat.org/ f n\n" - "start http://xml.libexpat.org/ g n\n" - "attribute http://xml.libexpat.org/ attr2 n\n" - "end http://xml.libexpat.org/ g n\n" - "end http://xml.libexpat.org/ e n\n"; - XML_SetReturnNSTriplet(parser, XML_TRUE); - run_ns_tagname_overwrite_test(text, result); -} -END_TEST - - -/* Regression test for SF bug #620343. */ -static void XMLCALL -start_element_fail(void *userData, - const XML_Char *name, const XML_Char **atts) -{ - /* We should never get here. */ - fail("should never reach start_element_fail()"); -} - -static void XMLCALL -start_ns_clearing_start_element(void *userData, - const XML_Char *prefix, - const XML_Char *uri) -{ - XML_SetStartElementHandler((XML_Parser) userData, NULL); -} - -START_TEST(test_start_ns_clears_start_element) -{ - /* This needs to use separate start/end tags; using the empty tag - syntax doesn't cause the problematic path through Expat to be - taken. - */ - char *text = ""; - - XML_SetStartElementHandler(parser, start_element_fail); - XML_SetStartNamespaceDeclHandler(parser, start_ns_clearing_start_element); - XML_UseParserAsHandlerArg(parser); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -/* Regression test for SF bug #616863. */ -static int XMLCALL -external_entity_handler(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - intptr_t callno = 1 + (intptr_t)XML_GetUserData(parser); - char *text; - XML_Parser p2; - - if (callno == 1) - text = ("\n" - "\n" - "\n"); - else - text = ("" - ""); - - XML_SetUserData(parser, (void *) callno); - p2 = XML_ExternalEntityParserCreate(parser, context, NULL); - if (XML_Parse(p2, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) { - xml_failure(p2); - return 0; - } - XML_ParserFree(p2); - return 1; -} - -START_TEST(test_default_ns_from_ext_subset_and_ext_ge) -{ - char *text = - "\n" - "\n" - "]>\n" - "\n" - "&en;\n" - ""; - - XML_SetParamEntityParsing(parser, XML_PARAM_ENTITY_PARSING_ALWAYS); - XML_SetExternalEntityRefHandler(parser, external_entity_handler); - /* We actually need to set this handler to tickle this bug. */ - XML_SetStartElementHandler(parser, dummy_start_element); - XML_SetUserData(parser, NULL); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -/* Regression test #1 for SF bug #673791. */ -START_TEST(test_ns_prefix_with_empty_uri_1) -{ - char *text = - "\n" - " \n" - ""; - - expect_failure(text, - XML_ERROR_UNDECLARING_PREFIX, - "Did not report re-setting namespace" - " URI with prefix to ''."); -} -END_TEST - -/* Regression test #2 for SF bug #673791. */ -START_TEST(test_ns_prefix_with_empty_uri_2) -{ - char *text = - "\n" - ""; - - expect_failure(text, - XML_ERROR_UNDECLARING_PREFIX, - "Did not report setting namespace URI with prefix to ''."); -} -END_TEST - -/* Regression test #3 for SF bug #673791. */ -START_TEST(test_ns_prefix_with_empty_uri_3) -{ - char *text = - "\n" - " \n" - "]>\n" - ""; - - expect_failure(text, - XML_ERROR_UNDECLARING_PREFIX, - "Didn't report attr default setting NS w/ prefix to ''."); -} -END_TEST - -/* Regression test #4 for SF bug #673791. */ -START_TEST(test_ns_prefix_with_empty_uri_4) -{ - char *text = - "\n" - " \n" - "]>\n" - ""; - /* Packaged info expected by the end element handler; - the weird structuring lets us re-use the triplet_end_checker() - function also used for another test. */ - char *elemstr[] = { - "http://xml.libexpat.org/ doc prefix" - }; - XML_SetReturnNSTriplet(parser, XML_TRUE); - XML_SetUserData(parser, elemstr); - XML_SetEndElementHandler(parser, triplet_end_checker); - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -START_TEST(test_ns_default_with_empty_uri) -{ - char *text = - "\n" - " \n" - ""; - if (XML_Parse(parser, text, strlen(text), XML_TRUE) == XML_STATUS_ERROR) - xml_failure(parser); -} -END_TEST - -/* Regression test for SF bug #692964: two prefixes for one namespace. */ -START_TEST(test_ns_duplicate_attrs_diff_prefixes) -{ - char *text = - ""; - expect_failure(text, - XML_ERROR_DUPLICATE_ATTRIBUTE, - "did not report multiple attributes with same URI+name"); -} -END_TEST - -/* Regression test for SF bug #695401: unbound prefix. */ -START_TEST(test_ns_unbound_prefix_on_attribute) -{ - char *text = ""; - expect_failure(text, - XML_ERROR_UNBOUND_PREFIX, - "did not report unbound prefix on attribute"); -} -END_TEST - -/* Regression test for SF bug #695401: unbound prefix. */ -START_TEST(test_ns_unbound_prefix_on_element) -{ - char *text = ""; - expect_failure(text, - XML_ERROR_UNBOUND_PREFIX, - "did not report unbound prefix on element"); -} -END_TEST - -static Suite * -make_suite(void) -{ - Suite *s = suite_create("basic"); - TCase *tc_basic = tcase_create("basic tests"); - TCase *tc_namespace = tcase_create("XML namespaces"); - - suite_add_tcase(s, tc_basic); - tcase_add_checked_fixture(tc_basic, basic_setup, basic_teardown); - tcase_add_test(tc_basic, test_nul_byte); - tcase_add_test(tc_basic, test_u0000_char); - tcase_add_test(tc_basic, test_bom_utf8); - tcase_add_test(tc_basic, test_bom_utf16_be); - tcase_add_test(tc_basic, test_bom_utf16_le); - tcase_add_test(tc_basic, test_illegal_utf8); - tcase_add_test(tc_basic, test_utf16); - tcase_add_test(tc_basic, test_utf16_le_epilog_newline); - tcase_add_test(tc_basic, test_latin1_umlauts); - /* Regression test for SF bug #491986. */ - tcase_add_test(tc_basic, test_danish_latin1); - /* Regression test for SF bug #514281. */ - tcase_add_test(tc_basic, test_french_charref_hexidecimal); - tcase_add_test(tc_basic, test_french_charref_decimal); - tcase_add_test(tc_basic, test_french_latin1); - tcase_add_test(tc_basic, test_french_utf8); - tcase_add_test(tc_basic, test_utf8_false_rejection); - tcase_add_test(tc_basic, test_line_number_after_parse); - tcase_add_test(tc_basic, test_column_number_after_parse); - tcase_add_test(tc_basic, test_line_and_column_numbers_inside_handlers); - tcase_add_test(tc_basic, test_line_number_after_error); - tcase_add_test(tc_basic, test_column_number_after_error); - tcase_add_test(tc_basic, test_really_long_lines); - tcase_add_test(tc_basic, test_end_element_events); - tcase_add_test(tc_basic, test_attr_whitespace_normalization); - tcase_add_test(tc_basic, test_xmldecl_misplaced); - tcase_add_test(tc_basic, test_unknown_encoding_internal_entity); - tcase_add_test(tc_basic, - test_wfc_undeclared_entity_unread_external_subset); - tcase_add_test(tc_basic, test_wfc_undeclared_entity_no_external_subset); - tcase_add_test(tc_basic, test_wfc_undeclared_entity_standalone); - tcase_add_test(tc_basic, test_wfc_undeclared_entity_with_external_subset); - tcase_add_test(tc_basic, - test_wfc_undeclared_entity_with_external_subset_standalone); - tcase_add_test(tc_basic, test_wfc_no_recursive_entity_refs); - tcase_add_test(tc_basic, test_ext_entity_set_encoding); - tcase_add_test(tc_basic, test_dtd_default_handling); - tcase_add_test(tc_basic, test_empty_ns_without_namespaces); - tcase_add_test(tc_basic, test_ns_in_attribute_default_without_namespaces); - tcase_add_test(tc_basic, test_stop_parser_between_char_data_calls); - tcase_add_test(tc_basic, test_suspend_parser_between_char_data_calls); - - suite_add_tcase(s, tc_namespace); - tcase_add_checked_fixture(tc_namespace, - namespace_setup, namespace_teardown); - tcase_add_test(tc_namespace, test_return_ns_triplet); - tcase_add_test(tc_namespace, test_ns_tagname_overwrite); - tcase_add_test(tc_namespace, test_ns_tagname_overwrite_triplet); - tcase_add_test(tc_namespace, test_start_ns_clears_start_element); - tcase_add_test(tc_namespace, test_default_ns_from_ext_subset_and_ext_ge); - tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_1); - tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_2); - tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_3); - tcase_add_test(tc_namespace, test_ns_prefix_with_empty_uri_4); - tcase_add_test(tc_namespace, test_ns_default_with_empty_uri); - tcase_add_test(tc_namespace, test_ns_duplicate_attrs_diff_prefixes); - tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_attribute); - tcase_add_test(tc_namespace, test_ns_unbound_prefix_on_element); - - return s; -} - - -int -main(int argc, char *argv[]) -{ - int i, nf; - int verbosity = CK_NORMAL; - Suite *s = make_suite(); - SRunner *sr = srunner_create(s); - - /* run the tests for internal helper functions */ - testhelper_is_whitespace_normalized(); - - for (i = 1; i < argc; ++i) { - char *opt = argv[i]; - if (strcmp(opt, "-v") == 0 || strcmp(opt, "--verbose") == 0) - verbosity = CK_VERBOSE; - else if (strcmp(opt, "-q") == 0 || strcmp(opt, "--quiet") == 0) - verbosity = CK_SILENT; - else { - fprintf(stderr, "runtests: unknown option '%s'\n", opt); - return 2; - } - } - if (verbosity != CK_SILENT) - printf("Expat version: %s\n", XML_ExpatVersion()); - srunner_run_all(sr, verbosity); - nf = srunner_ntests_failed(sr); - srunner_free(sr); - - return (nf == 0) ? EXIT_SUCCESS : EXIT_FAILURE; -} diff --git a/external/mit/expat/dist/tests/runtestspp.cpp b/external/mit/expat/dist/tests/runtestspp.cpp deleted file mode 100755 index c35dc583d..000000000 --- a/external/mit/expat/dist/tests/runtestspp.cpp +++ /dev/null @@ -1,6 +0,0 @@ -// C++ compilation harness for the test suite. -// -// This is used to ensure the Expat headers can be included from C++ -// and have everything work as expected. -// -#include "runtests.c" diff --git a/external/mit/expat/dist/tests/xmltest.sh b/external/mit/expat/dist/tests/xmltest.sh deleted file mode 100755 index 793a5cc28..000000000 --- a/external/mit/expat/dist/tests/xmltest.sh +++ /dev/null @@ -1,142 +0,0 @@ -#! /bin/sh - -# EXPAT TEST SCRIPT FOR W3C XML TEST SUITE - -# This script can be used to exercise Expat against the -# w3c.org xml test suite, available from -# http://www.w3.org/XML/Test/xmlts20020606.zip. - -# To run this script, first set XMLWF below so that xmlwf can be -# found, then set the output directory with OUTPUT. - -# The script lists all test cases where Expat shows a discrepancy -# from the expected result. Test cases where only the canonical -# output differs are prefixed with "Output differs:", and a diff file -# is generated in the appropriate subdirectory under $OUTPUT. - -# If there are output files provided, the script will use -# output from xmlwf and compare the desired output against it. -# However, one has to take into account that the canonical output -# produced by xmlwf conforms to an older definition of canonical XML -# and does not generate notation declarations. - -MYDIR="`dirname \"$0\"`" -cd "$MYDIR" -MYDIR="`pwd`" -XMLWF="`dirname \"$MYDIR\"`/xmlwf/xmlwf" -# XMLWF=/usr/local/bin/xmlwf -TS="$MYDIR/XML-Test-Suite" -# OUTPUT must terminate with the directory separator. -OUTPUT="$TS/out/" -# OUTPUT=/home/tmp/xml-testsuite-out/ - - -# RunXmlwfNotWF file reldir -# reldir includes trailing slash -RunXmlwfNotWF() { - file="$1" - reldir="$2" - $XMLWF -p "$file" > outfile || return $? - read outdata < outfile - if test "$outdata" = "" ; then - echo "Expected not well-formed: $reldir$file" - return 1 - else - return 0 - fi -} - -# RunXmlwfWF file reldir -# reldir includes trailing slash -RunXmlwfWF() { - file="$1" - reldir="$2" - $XMLWF -p -d "$OUTPUT$reldir" "$file" > outfile || return $? - read outdata < outfile - if test "$outdata" = "" ; then - if [ -f "out/$file" ] ; then - diff -u "$OUTPUT$reldir$file" "out/$file" > outfile - if [ -s outfile ] ; then - cp outfile "$OUTPUT$reldir$file.diff" - echo "Output differs: $reldir$file" - return 1 - fi - fi - return 0 - else - echo "In $reldir: $outdata" - return 1 - fi -} - -SUCCESS=0 -ERROR=0 - -UpdateStatus() { - if [ "$1" -eq 0 ] ; then - SUCCESS=`expr $SUCCESS + 1` - else - ERROR=`expr $ERROR + 1` - fi -} - -########################## -# well-formed test cases # -########################## - -cd "$TS/xmlconf" -for xmldir in ibm/valid/P* \ - ibm/invalid/P* \ - xmltest/valid/ext-sa \ - xmltest/valid/not-sa \ - xmltest/invalid \ - xmltest/invalid/not-sa \ - xmltest/valid/sa \ - sun/valid \ - sun/invalid ; do - cd "$TS/xmlconf/$xmldir" - mkdir -p "$OUTPUT$xmldir" - for xmlfile in *.xml ; do - RunXmlwfWF "$xmlfile" "$xmldir/" - UpdateStatus $? - done - rm outfile -done - -cd "$TS/xmlconf/oasis" -mkdir -p "$OUTPUT"oasis -for xmlfile in *pass*.xml ; do - RunXmlwfWF "$xmlfile" "oasis/" - UpdateStatus $? -done -rm outfile - -############################## -# not well-formed test cases # -############################## - -cd "$TS/xmlconf" -for xmldir in ibm/not-wf/P* \ - ibm/not-wf/p28a \ - ibm/not-wf/misc \ - xmltest/not-wf/ext-sa \ - xmltest/not-wf/not-sa \ - xmltest/not-wf/sa \ - sun/not-wf ; do - cd "$TS/xmlconf/$xmldir" - for xmlfile in *.xml ; do - RunXmlwfNotWF "$xmlfile" "$xmldir/" - UpdateStatus $? - done - rm outfile -done - -cd "$TS/xmlconf/oasis" -for xmlfile in *fail*.xml ; do - RunXmlwfNotWF "$xmlfile" "oasis/" - UpdateStatus $? -done -rm outfile - -echo "Passed: $SUCCESS" -echo "Failed: $ERROR" diff --git a/external/mit/expat/dist/vms/README.vms b/external/mit/expat/dist/vms/README.vms deleted file mode 100755 index 3dd2ca73f..000000000 --- a/external/mit/expat/dist/vms/README.vms +++ /dev/null @@ -1,23 +0,0 @@ -4-jun-2002 Craig A. Berry - Added rudimentary build procedures for - OpenVMS based on work by Martin Vorlaender. - - -You'll need MMS or its freeware equivalent MMK. Just go to the -top-level directory and type - -$ MMS/DESCRIPTION=[.vms] - - or - -$ MMK/DESCRIPTION=[.vms] - -You'll end up with the object library expat.olb. For now, installation -consists merely of copying the object library, include files, and -documentation to a suitable location. - -To-do list: - - -- create a shareable image - -- build and run the tests and build the xmlwf utility - -- create an install target diff --git a/external/mit/expat/dist/vms/descrip.mms b/external/mit/expat/dist/vms/descrip.mms deleted file mode 100755 index d9ee3d98e..000000000 --- a/external/mit/expat/dist/vms/descrip.mms +++ /dev/null @@ -1,70 +0,0 @@ -# Bare bones description file (Makefile) for OpenVMS - -PACKAGE = expat -VERSION = 1.95.8 -EXPAT_MAJOR_VERSION=1 -EXPAT_MINOR_VERSION=95 -EXPAT_EDIT=8 - -O = .obj -OLB = .olb - -LIBRARY = expat$(OLB) -LIBDIR = [.lib] -SOURCES = $(LIBDIR)xmlparse.c $(LIBDIR)xmltok.c $(LIBDIR)xmlrole.c -OBJECTS = xmlparse$(O) xmltok$(O) xmlrole$(O) - -TEMPLATES = xmltok_impl.c xmltok_ns.c -APIHEADER = $(LIBDIR)expat.h -HEADERS = $(LIBDIR)ascii.h $(LIBDIR)iasciitab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h \ - $(LIBDIR)asciitab.h $(LIBDIR)latin1tab.h \ - $(LIBDIR)nametab.h $(LIBDIR)xmldef.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok_impl.h - -CONFIG_HEADER = expat_config.h -INCLUDES = /INCLUDE=([],[.lib]) -DEFS = /DEFINE=(PACKAGE="""$(PACKAGE)""",VERSION="""$(PACKAGE)_$(VERSION)""",HAVE_EXPAT_CONFIG_H) -LIBREVISION = 0 -LIBCURRENT = 1 -LIBAGE = 0 -# -COMPILE = $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -# -# DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEMPLATES) $(APIHEADER) $(HEADERS) -# -# TAR = gtar -# GZIP_ENV = --best -# -.FIRST : - IF F$SEARCH("$(LIBRARY)") .EQS. "" THEN $(LIBR) /CREATE /OBJECT $(LIBRARY) - -all : $(LIBRARY) - @ write sys$output "All made." - -.SUFFIXES : -.SUFFIXES : $(OLB) $(O) .C .H - -.c$(O) : - $(COMPILE) $(MMS$SOURCE) - -$(O)$(OLB) : - @ IF F$SEARCH("$(MMS$TARGET)") .EQS. "" - - THEN LIBRARY/CREATE/LOG $(MMS$TARGET) - @ LIBRARY /REPLACE /LOG $(MMS$TARGET) $(MMS$SOURCE) - -clean : - DELETE $(LIBRARY);*,*$(O);* - -$(LIBRARY) : $(LIBRARY)( $(OBJECTS) ) - $(LIBR) /COMPRESS $(MMS$TARGET) - -$(CONFIG_HEADER) : [.vms]expat_config.h - COPY/LOG $(MMS$SOURCE) $(MMS$TARGET) - -xmlparse$(O) : $(LIBDIR)xmlparse.c $(LIBDIR)expat.h $(LIBDIR)xmlrole.h $(LIBDIR)xmltok.h $(CONFIG_HEADER) - -xmlrole$(O) : $(LIBDIR)xmlrole.c $(LIBDIR)ascii.h $(LIBDIR)xmlrole.h $(CONFIG_HEADER) - -xmltok$(O) : $(LIBDIR)xmltok.c $(LIBDIR)xmltok_impl.c $(LIBDIR)xmltok_ns.c \ - $(LIBDIR)ascii.h $(LIBDIR)asciitab.h $(LIBDIR)iasciitab.h $(LIBDIR)latin1tab.h \ - $(LIBDIR)nametab.h $(LIBDIR)utf8tab.h $(LIBDIR)xmltok.h $(LIBDIR)xmltok_impl.h $(CONFIG_HEADER) - diff --git a/external/mit/expat/dist/vms/expat_config.h b/external/mit/expat/dist/vms/expat_config.h deleted file mode 100755 index d5db89e56..000000000 --- a/external/mit/expat/dist/vms/expat_config.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2000, Clark Cooper - All rights reserved. - - This is free software. You are permitted to copy, distribute, or modify - it under the terms of the MIT/X license (contained in the COPYING file - with this distribution.) -*/ - -/* Define to empty if the keyword does not work. */ -#undef const - -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP - -/* Define to `long' if doesn't define. */ -#undef off_t - -/* Define to `unsigned' if doesn't define. */ -#undef size_t - -/* Define if your processor stores words with the most significant - byte first (like Motorola and SPARC, unlike Intel and VAX). */ -#undef WORDS_BIGENDIAN - -/* Define if you have the bcopy function. */ -#undef HAVE_BCOPY - -/* Define if you have the memmove function. */ -#define HAVE_MEMMOVE 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -#define XML_NS -#define XML_DTD - -#ifdef WORDS_BIGENDIAN -#define XML_BYTE_ORDER 21 -#else -#define XML_BYTE_ORDER 12 -#endif - -#define XML_CONTEXT_BYTES 1024 - -#ifndef HAVE_MEMMOVE -#ifdef HAVE_BCOPY -#define memmove(d,s,l) bcopy((s),(d),(l)) -#else -#define memmove(d,s,l) ;punting on memmove; -#endif - -#endif diff --git a/external/mit/expat/dist/win32/MANIFEST.txt b/external/mit/expat/dist/win32/MANIFEST.txt deleted file mode 100755 index b7cd39543..000000000 --- a/external/mit/expat/dist/win32/MANIFEST.txt +++ /dev/null @@ -1,27 +0,0 @@ - Overview of the Expat distribution - -The Expat distribution creates several subdirectories on your system. -Some of these directories contain components of interest to all Expat -users, and some contain material of interest to developers who wish to -use Expat in their applications. In the list below, is the -directory you specified to the installer. - - Directory Contents - --------------------------------------------------------------------- - \ Some general information files. - - \Doc\ API documentation for developers. - - \Bin\ Pre-compiled dynamic libraries for developers. - Pre-compiled static libraries for developers (*MT.lib). - The XML well-formedness checker xmlwf. - - \Source\ Source code, which may interest some developers, - including a workspace for Microsft Visual C++. - The source code includes the parser, the well- - formedness checker, and a couple of small sample - applications. - - \Source\bcb5\ Project files for Borland C++ Builder 5 and BCC 5.5. - - diff --git a/external/mit/expat/dist/win32/README.txt b/external/mit/expat/dist/win32/README.txt deleted file mode 100755 index e3702ae62..000000000 --- a/external/mit/expat/dist/win32/README.txt +++ /dev/null @@ -1,80 +0,0 @@ - -Expat can be built on Windows in three ways: - using MS Visual C++ (6.0 or .NET), Borland C++ Builder 5 or Cygwin. - -* Cygwin: - This follows the Unix build procedures. - -* C++ Builder 5: - Possible with make files in the BCB5 subdirectory. - Details can be found in the ReadMe file located there. - -* MS Visual C++ 6: - Based on the workspace file expat.dsw. The related project - files (.dsp) are located in the lib subdirectory. - -* MS Visual Studio .NET 2002, 2003, 2005, 2008, 2010: - The VC++ 6 workspace file (expat.dsw) and project files (.dsp) - can be opened and imported in VS.NET without problems. - -* All MS C/C++ compilers: - The output for all projects will be generated in the win32\bin - directory, intermediate files will be located in project-specific - subdirectories of win32\tmp. - -* Creating MinGW dynamic libraries from MS VC++ DLLs: - - On the command line, execute these steps: - pexports libexpat.dll > expat.def - pexports libexpatw.dll > expatw.def - dlltool -d expat.def -l libexpat.a - dlltool -d expatw.def -l libexpatw.a - - The *.a files are mingw libraries. - -* Special note about MS VC++ and runtime libraries: - - There are three possible configurations: using the - single threaded or multithreaded run-time library, - or using the multi-threaded run-time Dll. That is, - one can build three different Expat libraries depending - on the needs of the application. - - Dynamic Linking: - - By default the Expat Dlls are built to link statically - with the multi-threaded run-time library. - The libraries are named - - libexpat(w).dll - - libexpat(w).lib (import library) - The "w" indicates the UTF-16 version of the library. - - One rarely uses other versions of the Dll, but they can - be built easily by specifying a different RTL linkage in - the IDE on the C/C++ tab under the category Code Generation. - - Static Linking: - - The libraries should be named like this: - Single-theaded: libexpat(w)ML.lib - Multi-threaded: libexpat(w)MT.lib - Multi-threaded Dll: libexpat(w)MD.lib - The suffixes conform to the compiler switch settings - /ML, /MT and /MD for MS VC++. - - Note: In Visual Studio 2005 (Visual C++ 8.0) and later, the - single-threaded runtime library is not supported anymore. - - By default, the expat-static and expatw-static projects are set up - to link statically against the multithreaded run-time library, - so they will build libexpatMT.lib or libexpatwMT.lib files. - - To build the other versions of the static library, - go to Project - Settings: - - specify a different RTL linkage on the C/C++ tab - under the category Code Generation. - - then, on the Library tab, change the output file name - accordingly, as described above - - An application linking to the static libraries must - have the global macro XML_STATIC defined. diff --git a/external/mit/expat/dist/win32/expat.iss b/external/mit/expat/dist/win32/expat.iss deleted file mode 100755 index de5b6efdd..000000000 --- a/external/mit/expat/dist/win32/expat.iss +++ /dev/null @@ -1,69 +0,0 @@ -; Basic setup script for the Inno Setup installer builder. For more -; information on the free installer builder, see www.jrsoftware.org. -; -; This script was contributed by Tim Peters. -; It was designed for Inno Setup 2.0.19 but works with later versions as well. - -[Setup] -AppName=Expat -AppId=expat -AppVersion=2.1.0 -AppVerName=Expat 2.1.0 -AppCopyright=Copyright © 1998-2012 Thai Open Source Software Center, Clark Cooper, and the Expat maintainers -AppPublisher=The Expat Developers -AppPublisherURL=http://www.libexpat.org/ -AppSupportURL=http://www.libexpat.org/ -AppUpdatesURL=http://www.libexpat.org/ -UninstallDisplayName=Expat XML Parser 2.1.0 -VersionInfoVersion=2.1.0 - -DefaultDirName={pf}\Expat 2.1.0 -UninstallFilesDir={app}\Uninstall - -Compression=lzma -SolidCompression=yes -SourceDir=.. -OutputDir=win32 -DisableStartupPrompt=yes -AllowNoIcons=yes -DisableProgramGroupPage=yes -DisableReadyPage=yes - -[Files] -Flags: ignoreversion; Source: win32\bin\Release\xmlwf.exe; DestDir: "{app}\Bin" -Flags: ignoreversion; Source: win32\MANIFEST.txt; DestDir: "{app}" -Flags: ignoreversion; Source: Changes; DestDir: "{app}"; DestName: Changes.txt -Flags: ignoreversion; Source: COPYING; DestDir: "{app}"; DestName: COPYING.txt -Flags: ignoreversion; Source: README; DestDir: "{app}"; DestName: README.txt -Flags: ignoreversion; Source: doc\*.html; DestDir: "{app}\Doc" -Flags: ignoreversion; Source: doc\*.css; DestDir: "{app}\Doc" -Flags: ignoreversion; Source: doc\*.png; DestDir: "{app}\Doc" -Flags: ignoreversion; Source: win32\bin\Release\*.dll; DestDir: "{app}\Bin" -Flags: ignoreversion; Source: win32\bin\Release\*.lib; DestDir: "{app}\Bin" -Flags: ignoreversion; Source: expat.dsw; DestDir: "{app}\Source" -Flags: ignoreversion; Source: win32\README.txt; DestDir: "{app}\Source" -Flags: ignoreversion; Source: bcb5\*.bp*; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: bcb5\*.mak; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: bcb5\*.def; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: bcb5\*.txt; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: bcb5\*.bat; DestDir: "{app}\Source\bcb5" -Flags: ignoreversion; Source: lib\*.c; DestDir: "{app}\Source\lib" -Flags: ignoreversion; Source: lib\*.h; DestDir: "{app}\Source\lib" -Flags: ignoreversion; Source: lib\*.def; DestDir: "{app}\Source\lib" -Flags: ignoreversion; Source: lib\*.dsp; DestDir: "{app}\Source\lib" -Flags: ignoreversion; Source: examples\*.c; DestDir: "{app}\Source\examples" -Flags: ignoreversion; Source: examples\*.dsp; DestDir: "{app}\Source\examples" -Flags: ignoreversion; Source: tests\*.c; DestDir: "{app}\Source\tests" -Flags: ignoreversion; Source: tests\*.cpp; DestDir: "{app}\Source\tests" -Flags: ignoreversion; Source: tests\*.h; DestDir: "{app}\Source\tests" -Flags: ignoreversion; Source: tests\README.txt; DestDir: "{app}\Source\tests" -Flags: ignoreversion; Source: tests\benchmark\*.c; DestDir: "{app}\Source\tests\benchmark" -Flags: ignoreversion; Source: tests\benchmark\*.ds*; DestDir: "{app}\Source\tests\benchmark" -Flags: ignoreversion; Source: tests\benchmark\README.txt; DestDir: "{app}\Source\tests\benchmark" -Flags: ignoreversion; Source: xmlwf\*.c*; DestDir: "{app}\Source\xmlwf" -Flags: ignoreversion; Source: xmlwf\*.h; DestDir: "{app}\Source\xmlwf" -Flags: ignoreversion; Source: xmlwf\*.dsp; DestDir: "{app}\Source\xmlwf" - -[Messages] -WelcomeLabel1=Welcome to the Expat XML Parser Setup Wizard -WelcomeLabel2=This will install [name/ver] on your computer.%n%nExpat is an XML parser with a C-language API, and is primarily made available to allow developers to build applications which use XML using a portable API and fast implementation.%n%nIt is strongly recommended that you close all other applications you have running before continuing. This will help prevent any conflicts during the installation process. diff --git a/external/mit/expat/dist/xmlwf/codepage.c b/external/mit/expat/dist/xmlwf/codepage.c deleted file mode 100755 index 57e48ff2d..000000000 --- a/external/mit/expat/dist/xmlwf/codepage.c +++ /dev/null @@ -1,68 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include "codepage.h" - -#if (defined(WIN32) || (defined(__WATCOMC__) && defined(__NT__))) -#define STRICT 1 -#define WIN32_LEAN_AND_MEAN 1 - -#include - -int -codepageMap(int cp, int *map) -{ - int i; - CPINFO info; - if (!GetCPInfo(cp, &info) || info.MaxCharSize > 2) - return 0; - for (i = 0; i < 256; i++) - map[i] = -1; - if (info.MaxCharSize > 1) { - for (i = 0; i < MAX_LEADBYTES; i+=2) { - int j, lim; - if (info.LeadByte[i] == 0 && info.LeadByte[i + 1] == 0) - break; - lim = info.LeadByte[i + 1]; - for (j = info.LeadByte[i]; j <= lim; j++) - map[j] = -2; - } - } - for (i = 0; i < 256; i++) { - if (map[i] == -1) { - char c = (char)i; - unsigned short n; - if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, - &c, 1, &n, 1) == 1) - map[i] = n; - } - } - return 1; -} - -int -codepageConvert(int cp, const char *p) -{ - unsigned short c; - if (MultiByteToWideChar(cp, MB_PRECOMPOSED|MB_ERR_INVALID_CHARS, - p, 2, &c, 1) == 1) - return c; - return -1; -} - -#else /* not WIN32 */ - -int -codepageMap(int cp, int *map) -{ - return 0; -} - -int -codepageConvert(int cp, const char *p) -{ - return -1; -} - -#endif /* not WIN32 */ diff --git a/external/mit/expat/dist/xmlwf/codepage.h b/external/mit/expat/dist/xmlwf/codepage.h deleted file mode 100755 index 6a4df6888..000000000 --- a/external/mit/expat/dist/xmlwf/codepage.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -int codepageMap(int cp, int *map); -int codepageConvert(int cp, const char *p); diff --git a/external/mit/expat/dist/xmlwf/ct.c b/external/mit/expat/dist/xmlwf/ct.c deleted file mode 100755 index 95903a345..000000000 --- a/external/mit/expat/dist/xmlwf/ct.c +++ /dev/null @@ -1,147 +0,0 @@ -#define CHARSET_MAX 41 - -static const char * -getTok(const char **pp) -{ - enum { inAtom, inString, init, inComment }; - int state = init; - const char *tokStart = 0; - for (;;) { - switch (**pp) { - case '\0': - return 0; - case ' ': - case '\r': - case '\t': - case '\n': - if (state == inAtom) - return tokStart; - break; - case '(': - if (state == inAtom) - return tokStart; - if (state != inString) - state++; - break; - case ')': - if (state > init) - --state; - else if (state != inString) - return 0; - break; - case ';': - case '/': - case '=': - if (state == inAtom) - return tokStart; - if (state == init) - return (*pp)++; - break; - case '\\': - ++*pp; - if (**pp == '\0') - return 0; - break; - case '"': - switch (state) { - case inString: - ++*pp; - return tokStart; - case inAtom: - return tokStart; - case init: - tokStart = *pp; - state = inString; - break; - } - break; - default: - if (state == init) { - tokStart = *pp; - state = inAtom; - } - break; - } - ++*pp; - } - /* not reached */ -} - -/* key must be lowercase ASCII */ - -static int -matchkey(const char *start, const char *end, const char *key) -{ - if (!start) - return 0; - for (; start != end; start++, key++) - if (*start != *key && *start != 'A' + (*key - 'a')) - return 0; - return *key == '\0'; -} - -void -getXMLCharset(const char *buf, char *charset) -{ - const char *next, *p; - - charset[0] = '\0'; - next = buf; - p = getTok(&next); - if (matchkey(p, next, "text")) - strcpy(charset, "us-ascii"); - else if (!matchkey(p, next, "application")) - return; - p = getTok(&next); - if (!p || *p != '/') - return; - p = getTok(&next); - if (matchkey(p, next, "xml")) - isXml = 1; - p = getTok(&next); - while (p) { - if (*p == ';') { - p = getTok(&next); - if (matchkey(p, next, "charset")) { - p = getTok(&next); - if (p && *p == '=') { - p = getTok(&next); - if (p) { - char *s = charset; - if (*p == '"') { - while (++p != next - 1) { - if (*p == '\\') - ++p; - if (s == charset + CHARSET_MAX - 1) { - charset[0] = '\0'; - break; - } - *s++ = *p; - } - *s++ = '\0'; - } - else { - if (next - p > CHARSET_MAX - 1) - break; - while (p != next) - *s++ = *p++; - *s = 0; - break; - } - } - } - } - } - else - p = getTok(&next); - } -} - -int -main(int argc, char **argv) -{ - char buf[CHARSET_MAX]; - getXMLCharset(argv[1], buf); - printf("charset = \"%s\"\n", buf); - return 0; -} diff --git a/external/mit/expat/dist/xmlwf/filemap.h b/external/mit/expat/dist/xmlwf/filemap.h deleted file mode 100755 index 814edec25..000000000 --- a/external/mit/expat/dist/xmlwf/filemap.h +++ /dev/null @@ -1,17 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include - -#ifdef XML_UNICODE -int filemap(const wchar_t *name, - void (*processor)(const void *, size_t, - const wchar_t *, void *arg), - void *arg); -#else -int filemap(const char *name, - void (*processor)(const void *, size_t, - const char *, void *arg), - void *arg); -#endif diff --git a/external/mit/expat/dist/xmlwf/readfilemap.c b/external/mit/expat/dist/xmlwf/readfilemap.c deleted file mode 100755 index bd32b9341..000000000 --- a/external/mit/expat/dist/xmlwf/readfilemap.c +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include -#include -#include -#include - -#ifdef __WATCOMC__ -#ifndef __LINUX__ -#include -#else -#include -#endif -#endif - -#ifdef __BEOS__ -#include -#endif - -#ifndef S_ISREG -#ifndef S_IFREG -#define S_IFREG _S_IFREG -#endif -#ifndef S_IFMT -#define S_IFMT _S_IFMT -#endif -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) -#endif /* not S_ISREG */ - -#ifndef O_BINARY -#ifdef _O_BINARY -#define O_BINARY _O_BINARY -#else -#define O_BINARY 0 -#endif -#endif - -#include "filemap.h" - -int -filemap(const char *name, - void (*processor)(const void *, size_t, const char *, void *arg), - void *arg) -{ - size_t nbytes; - int fd; - int n; - struct stat sb; - void *p; - - fd = open(name, O_RDONLY|O_BINARY); - if (fd < 0) { - perror(name); - return 0; - } - if (fstat(fd, &sb) < 0) { - perror(name); - close(fd); - return 0; - } - if (!S_ISREG(sb.st_mode)) { - fprintf(stderr, "%s: not a regular file\n", name); - close(fd); - return 0; - } - nbytes = sb.st_size; - /* malloc will return NULL with nbytes == 0, handle files with size 0 */ - if (nbytes == 0) { - static const char c = '\0'; - processor(&c, 0, name, arg); - close(fd); - return 1; - } - p = malloc(nbytes); - if (!p) { - fprintf(stderr, "%s: out of memory\n", name); - close(fd); - return 0; - } - n = read(fd, p, nbytes); - if (n < 0) { - perror(name); - free(p); - close(fd); - return 0; - } - if (n != nbytes) { - fprintf(stderr, "%s: read unexpected number of bytes\n", name); - free(p); - close(fd); - return 0; - } - processor(p, nbytes, name, arg); - free(p); - close(fd); - return 1; -} diff --git a/external/mit/expat/dist/xmlwf/unixfilemap.c b/external/mit/expat/dist/xmlwf/unixfilemap.c deleted file mode 100755 index 93adce32e..000000000 --- a/external/mit/expat/dist/xmlwf/unixfilemap.c +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include -#include -#include -#include -#include -#include -#include - -#ifndef MAP_FILE -#define MAP_FILE 0 -#endif - -#include "filemap.h" - -int -filemap(const char *name, - void (*processor)(const void *, size_t, const char *, void *arg), - void *arg) -{ - int fd; - size_t nbytes; - struct stat sb; - void *p; - - fd = open(name, O_RDONLY); - if (fd < 0) { - perror(name); - return 0; - } - if (fstat(fd, &sb) < 0) { - perror(name); - close(fd); - return 0; - } - if (!S_ISREG(sb.st_mode)) { - close(fd); - fprintf(stderr, "%s: not a regular file\n", name); - return 0; - } - - nbytes = sb.st_size; - /* mmap fails for zero length files */ - if (nbytes == 0) { - static const char c = '\0'; - processor(&c, 0, name, arg); - close(fd); - return 1; - } - p = (void *)mmap((caddr_t)0, (size_t)nbytes, PROT_READ, - MAP_FILE|MAP_PRIVATE, fd, (off_t)0); - if (p == (void *)-1) { - perror(name); - close(fd); - return 0; - } - processor(p, nbytes, name, arg); - munmap((caddr_t)p, nbytes); - close(fd); - return 1; -} diff --git a/external/mit/expat/dist/xmlwf/win32filemap.c b/external/mit/expat/dist/xmlwf/win32filemap.c deleted file mode 100755 index 41dc35b61..000000000 --- a/external/mit/expat/dist/xmlwf/win32filemap.c +++ /dev/null @@ -1,96 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#define STRICT 1 -#define WIN32_LEAN_AND_MEAN 1 - -#ifdef XML_UNICODE_WCHAR_T -#ifndef XML_UNICODE -#define XML_UNICODE -#endif -#endif - -#ifdef XML_UNICODE -#define UNICODE -#define _UNICODE -#endif /* XML_UNICODE */ -#include -#include -#include -#include "filemap.h" - -static void win32perror(const TCHAR *); - -int -filemap(const TCHAR *name, - void (*processor)(const void *, size_t, const TCHAR *, void *arg), - void *arg) -{ - HANDLE f; - HANDLE m; - DWORD size; - DWORD sizeHi; - void *p; - - f = CreateFile(name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, - FILE_FLAG_SEQUENTIAL_SCAN, NULL); - if (f == INVALID_HANDLE_VALUE) { - win32perror(name); - return 0; - } - size = GetFileSize(f, &sizeHi); - if (size == (DWORD)-1) { - win32perror(name); - return 0; - } - if (sizeHi) { - _ftprintf(stderr, _T("%s: bigger than 2Gb\n"), name); - return 0; - } - /* CreateFileMapping barfs on zero length files */ - if (size == 0) { - static const char c = '\0'; - processor(&c, 0, name, arg); - CloseHandle(f); - return 1; - } - m = CreateFileMapping(f, NULL, PAGE_READONLY, 0, 0, NULL); - if (m == NULL) { - win32perror(name); - CloseHandle(f); - return 0; - } - p = MapViewOfFile(m, FILE_MAP_READ, 0, 0, 0); - if (p == NULL) { - win32perror(name); - CloseHandle(m); - CloseHandle(f); - return 0; - } - processor(p, size, name, arg); - UnmapViewOfFile(p); - CloseHandle(m); - CloseHandle(f); - return 1; -} - -static void -win32perror(const TCHAR *s) -{ - LPVOID buf; - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - GetLastError(), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buf, - 0, - NULL)) { - _ftprintf(stderr, _T("%s: %s"), s, buf); - fflush(stderr); - LocalFree(buf); - } - else - _ftprintf(stderr, _T("%s: unknown Windows error\n"), s); -} diff --git a/external/mit/expat/dist/xmlwf/xmlfile.c b/external/mit/expat/dist/xmlwf/xmlfile.c deleted file mode 100755 index 99eeeaaef..000000000 --- a/external/mit/expat/dist/xmlwf/xmlfile.c +++ /dev/null @@ -1,244 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include -#include -#include -#include - -#ifdef COMPILED_FROM_DSP -#include "winconfig.h" -#elif defined(MACOS_CLASSIC) -#include "macconfig.h" -#elif defined(__amigaos__) -#include "amigaconfig.h" -#elif defined(__WATCOMC__) -#include "watcomconfig.h" -#elif defined(HAVE_EXPAT_CONFIG_H) -#include -#endif /* ndef COMPILED_FROM_DSP */ - -#include "expat.h" -#include "xmlfile.h" -#include "xmltchar.h" -#include "filemap.h" - -#if (defined(_MSC_VER) || (defined(__WATCOMC__) && !defined(__LINUX__))) -#include -#endif - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - -#ifdef HAVE_UNISTD_H -#include -#endif - -#ifndef O_BINARY -#ifdef _O_BINARY -#define O_BINARY _O_BINARY -#else -#define O_BINARY 0 -#endif -#endif - -#ifdef _DEBUG -#define READ_SIZE 16 -#else -#define READ_SIZE (1024*8) -#endif - - -typedef struct { - XML_Parser parser; - int *retPtr; -} PROCESS_ARGS; - -static void -reportError(XML_Parser parser, const XML_Char *filename) -{ - enum XML_Error code = XML_GetErrorCode(parser); - const XML_Char *message = XML_ErrorString(code); - if (message) - ftprintf(stdout, T("%s:%" XML_FMT_INT_MOD "u:%" XML_FMT_INT_MOD "u: %s\n"), - filename, - XML_GetErrorLineNumber(parser), - XML_GetErrorColumnNumber(parser), - message); - else - ftprintf(stderr, T("%s: (unknown message %d)\n"), filename, code); -} - -/* This implementation will give problems on files larger than INT_MAX. */ -static void -processFile(const void *data, size_t size, - const XML_Char *filename, void *args) -{ - XML_Parser parser = ((PROCESS_ARGS *)args)->parser; - int *retPtr = ((PROCESS_ARGS *)args)->retPtr; - if (XML_Parse(parser, (const char *)data, (int)size, 1) == XML_STATUS_ERROR) { - reportError(parser, filename); - *retPtr = 0; - } - else - *retPtr = 1; -} - -#if (defined(WIN32) || defined(__WATCOMC__)) - -static int -isAsciiLetter(XML_Char c) -{ - return (T('a') <= c && c <= T('z')) || (T('A') <= c && c <= T('Z')); -} - -#endif /* WIN32 */ - -static const XML_Char * -resolveSystemId(const XML_Char *base, const XML_Char *systemId, - XML_Char **toFree) -{ - XML_Char *s; - *toFree = 0; - if (!base - || *systemId == T('/') -#if (defined(WIN32) || defined(__WATCOMC__)) - || *systemId == T('\\') - || (isAsciiLetter(systemId[0]) && systemId[1] == T(':')) -#endif - ) - return systemId; - *toFree = (XML_Char *)malloc((tcslen(base) + tcslen(systemId) + 2) - * sizeof(XML_Char)); - if (!*toFree) - return systemId; - tcscpy(*toFree, base); - s = *toFree; - if (tcsrchr(s, T('/'))) - s = tcsrchr(s, T('/')) + 1; -#if (defined(WIN32) || defined(__WATCOMC__)) - if (tcsrchr(s, T('\\'))) - s = tcsrchr(s, T('\\')) + 1; -#endif - tcscpy(s, systemId); - return *toFree; -} - -static int -externalEntityRefFilemap(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - int result; - XML_Char *s; - const XML_Char *filename; - XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); - PROCESS_ARGS args; - args.retPtr = &result; - args.parser = entParser; - filename = resolveSystemId(base, systemId, &s); - XML_SetBase(entParser, filename); - if (!filemap(filename, processFile, &args)) - result = 0; - free(s); - XML_ParserFree(entParser); - return result; -} - -static int -processStream(const XML_Char *filename, XML_Parser parser) -{ - /* passing NULL for filename means read intput from stdin */ - int fd = 0; /* 0 is the fileno for stdin */ - - if (filename != NULL) { - fd = topen(filename, O_BINARY|O_RDONLY); - if (fd < 0) { - tperror(filename); - return 0; - } - } - for (;;) { - int nread; - char *buf = (char *)XML_GetBuffer(parser, READ_SIZE); - if (!buf) { - if (filename != NULL) - close(fd); - ftprintf(stderr, T("%s: out of memory\n"), - filename != NULL ? filename : "xmlwf"); - return 0; - } - nread = read(fd, buf, READ_SIZE); - if (nread < 0) { - tperror(filename != NULL ? filename : "STDIN"); - if (filename != NULL) - close(fd); - return 0; - } - if (XML_ParseBuffer(parser, nread, nread == 0) == XML_STATUS_ERROR) { - reportError(parser, filename != NULL ? filename : "STDIN"); - if (filename != NULL) - close(fd); - return 0; - } - if (nread == 0) { - if (filename != NULL) - close(fd); - break;; - } - } - return 1; -} - -static int -externalEntityRefStream(XML_Parser parser, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - XML_Char *s; - const XML_Char *filename; - int ret; - XML_Parser entParser = XML_ExternalEntityParserCreate(parser, context, 0); - filename = resolveSystemId(base, systemId, &s); - XML_SetBase(entParser, filename); - ret = processStream(filename, entParser); - free(s); - XML_ParserFree(entParser); - return ret; -} - -int -XML_ProcessFile(XML_Parser parser, - const XML_Char *filename, - unsigned flags) -{ - int result; - - if (!XML_SetBase(parser, filename)) { - ftprintf(stderr, T("%s: out of memory"), filename); - exit(1); - } - - if (flags & XML_EXTERNAL_ENTITIES) - XML_SetExternalEntityRefHandler(parser, - (flags & XML_MAP_FILE) - ? externalEntityRefFilemap - : externalEntityRefStream); - if (flags & XML_MAP_FILE) { - PROCESS_ARGS args; - args.retPtr = &result; - args.parser = parser; - if (!filemap(filename, processFile, &args)) - result = 0; - } - else - result = processStream(filename, parser); - return result; -} diff --git a/external/mit/expat/dist/xmlwf/xmlfile.h b/external/mit/expat/dist/xmlwf/xmlfile.h deleted file mode 100755 index d093ecc06..000000000 --- a/external/mit/expat/dist/xmlwf/xmlfile.h +++ /dev/null @@ -1,20 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#define XML_MAP_FILE 01 -#define XML_EXTERNAL_ENTITIES 02 - -#ifdef XML_LARGE_SIZE -#if defined(XML_USE_MSC_EXTENSIONS) && _MSC_VER < 1400 -#define XML_FMT_INT_MOD "I64" -#else -#define XML_FMT_INT_MOD "ll" -#endif -#else -#define XML_FMT_INT_MOD "l" -#endif - -extern int XML_ProcessFile(XML_Parser parser, - const XML_Char *filename, - unsigned flags); diff --git a/external/mit/expat/dist/xmlwf/xmlmime.c b/external/mit/expat/dist/xmlwf/xmlmime.c deleted file mode 100755 index 56a0e7f40..000000000 --- a/external/mit/expat/dist/xmlwf/xmlmime.c +++ /dev/null @@ -1,163 +0,0 @@ -#include -#include "xmlmime.h" - -static const char * -getTok(const char **pp) -{ - /* inComment means one level of nesting; inComment+1 means two levels etc */ - enum { inAtom, inString, init, inComment }; - int state = init; - const char *tokStart = 0; - for (;;) { - switch (**pp) { - case '\0': - if (state == inAtom) - return tokStart; - return 0; - case ' ': - case '\r': - case '\t': - case '\n': - if (state == inAtom) - return tokStart; - break; - case '(': - if (state == inAtom) - return tokStart; - if (state != inString) - state++; - break; - case ')': - if (state > init) - --state; - else if (state != inString) - return 0; - break; - case ';': - case '/': - case '=': - if (state == inAtom) - return tokStart; - if (state == init) - return (*pp)++; - break; - case '\\': - ++*pp; - if (**pp == '\0') - return 0; - break; - case '"': - switch (state) { - case inString: - ++*pp; - return tokStart; - case inAtom: - return tokStart; - case init: - tokStart = *pp; - state = inString; - break; - } - break; - default: - if (state == init) { - tokStart = *pp; - state = inAtom; - } - break; - } - ++*pp; - } - /* not reached */ -} - -/* key must be lowercase ASCII */ - -static int -matchkey(const char *start, const char *end, const char *key) -{ - if (!start) - return 0; - for (; start != end; start++, key++) - if (*start != *key && *start != 'A' + (*key - 'a')) - return 0; - return *key == '\0'; -} - -void -getXMLCharset(const char *buf, char *charset) -{ - const char *next, *p; - - charset[0] = '\0'; - next = buf; - p = getTok(&next); - if (matchkey(p, next, "text")) - strcpy(charset, "us-ascii"); - else if (!matchkey(p, next, "application")) - return; - p = getTok(&next); - if (!p || *p != '/') - return; - p = getTok(&next); -#if 0 - if (!matchkey(p, next, "xml") && charset[0] == '\0') - return; -#endif - p = getTok(&next); - while (p) { - if (*p == ';') { - p = getTok(&next); - if (matchkey(p, next, "charset")) { - p = getTok(&next); - if (p && *p == '=') { - p = getTok(&next); - if (p) { - char *s = charset; - if (*p == '"') { - while (++p != next - 1) { - if (*p == '\\') - ++p; - if (s == charset + CHARSET_MAX - 1) { - charset[0] = '\0'; - break; - } - *s++ = *p; - } - *s++ = '\0'; - } - else { - if (next - p > CHARSET_MAX - 1) - break; - while (p != next) - *s++ = *p++; - *s = 0; - break; - } - } - } - break; - } - } - else - p = getTok(&next); - } -} - -#ifdef TEST - -#include - -int -main(int argc, char *argv[]) -{ - char buf[CHARSET_MAX]; - if (argc <= 1) - return 1; - printf("%s\n", argv[1]); - getXMLCharset(argv[1], buf); - printf("charset=\"%s\"\n", buf); - return 0; -} - -#endif /* TEST */ diff --git a/external/mit/expat/dist/xmlwf/xmlmime.h b/external/mit/expat/dist/xmlwf/xmlmime.h deleted file mode 100755 index bf0356df0..000000000 --- a/external/mit/expat/dist/xmlwf/xmlmime.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -/* Registered charset names are at most 40 characters long. */ - -#define CHARSET_MAX 41 - -/* Figure out the charset to use from the ContentType. - buf contains the body of the header field (the part after "Content-Type:"). - charset gets the charset to use. It must be at least CHARSET_MAX chars - long. charset will be empty if the default charset should be used. -*/ - -void getXMLCharset(const char *buf, char *charset); - -#ifdef __cplusplus -} -#endif diff --git a/external/mit/expat/dist/xmlwf/xmltchar.h b/external/mit/expat/dist/xmlwf/xmltchar.h deleted file mode 100755 index 108857551..000000000 --- a/external/mit/expat/dist/xmlwf/xmltchar.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifdef XML_UNICODE -#ifndef XML_UNICODE_WCHAR_T -#error xmlwf requires a 16-bit Unicode-compatible wchar_t -#endif -#define T(x) L ## x -#define ftprintf fwprintf -#define tfopen _wfopen -#define fputts fputws -#define puttc putwc -#define tcscmp wcscmp -#define tcscpy wcscpy -#define tcscat wcscat -#define tcschr wcschr -#define tcsrchr wcsrchr -#define tcslen wcslen -#define tperror _wperror -#define topen _wopen -#define tmain wmain -#define tremove _wremove -#else /* not XML_UNICODE */ -#define T(x) x -#define ftprintf fprintf -#define tfopen fopen -#define fputts fputs -#define puttc putc -#define tcscmp strcmp -#define tcscpy strcpy -#define tcscat strcat -#define tcschr strchr -#define tcsrchr strrchr -#define tcslen strlen -#define tperror perror -#define topen open -#define tmain main -#define tremove remove -#endif /* not XML_UNICODE */ diff --git a/external/mit/expat/dist/xmlwf/xmlurl.h b/external/mit/expat/dist/xmlwf/xmlurl.h deleted file mode 100755 index d329913ac..000000000 --- a/external/mit/expat/dist/xmlwf/xmlurl.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef __cplusplus -extern "C" { -#endif - -int XML_URLInit(); -void XML_URLUninit(); -int XML_ProcessURL(XML_Parser parser, - const XML_Char *url, - unsigned flags); - -#ifdef __cplusplus -} -#endif diff --git a/external/mit/expat/dist/xmlwf/xmlwf.c b/external/mit/expat/dist/xmlwf/xmlwf.c deleted file mode 100755 index 4fc77da94..000000000 --- a/external/mit/expat/dist/xmlwf/xmlwf.c +++ /dev/null @@ -1,861 +0,0 @@ -/* Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd - See the file COPYING for copying permission. -*/ - -#include -#include -#include -#include - -#include "expat.h" -#include "codepage.h" -#include "xmlfile.h" -#include "xmltchar.h" - -#ifdef _MSC_VER -#include -#endif - -#if defined(__amigaos__) && defined(__USE_INLINE__) -#include -#endif - -/* This ensures proper sorting. */ - -#define NSSEP T('\001') - -static void XMLCALL -characterData(void *userData, const XML_Char *s, int len) -{ - FILE *fp = (FILE *)userData; - for (; len > 0; --len, ++s) { - switch (*s) { - case T('&'): - fputts(T("&"), fp); - break; - case T('<'): - fputts(T("<"), fp); - break; - case T('>'): - fputts(T(">"), fp); - break; -#ifdef W3C14N - case 13: - fputts(T(" "), fp); - break; -#else - case T('"'): - fputts(T("""), fp); - break; - case 9: - case 10: - case 13: - ftprintf(fp, T("&#%d;"), *s); - break; -#endif - default: - puttc(*s, fp); - break; - } - } -} - -static void -attributeValue(FILE *fp, const XML_Char *s) -{ - puttc(T('='), fp); - puttc(T('"'), fp); - for (;;) { - switch (*s) { - case 0: - case NSSEP: - puttc(T('"'), fp); - return; - case T('&'): - fputts(T("&"), fp); - break; - case T('<'): - fputts(T("<"), fp); - break; - case T('"'): - fputts(T("""), fp); - break; -#ifdef W3C14N - case 9: - fputts(T(" "), fp); - break; - case 10: - fputts(T(" "), fp); - break; - case 13: - fputts(T(" "), fp); - break; -#else - case T('>'): - fputts(T(">"), fp); - break; - case 9: - case 10: - case 13: - ftprintf(fp, T("&#%d;"), *s); - break; -#endif - default: - puttc(*s, fp); - break; - } - s++; - } -} - -/* Lexicographically comparing UTF-8 encoded attribute values, -is equivalent to lexicographically comparing based on the character number. */ - -static int -attcmp(const void *att1, const void *att2) -{ - return tcscmp(*(const XML_Char **)att1, *(const XML_Char **)att2); -} - -static void XMLCALL -startElement(void *userData, const XML_Char *name, const XML_Char **atts) -{ - int nAtts; - const XML_Char **p; - FILE *fp = (FILE *)userData; - puttc(T('<'), fp); - fputts(name, fp); - - p = atts; - while (*p) - ++p; - nAtts = (int)((p - atts) >> 1); - if (nAtts > 1) - qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, attcmp); - while (*atts) { - puttc(T(' '), fp); - fputts(*atts++, fp); - attributeValue(fp, *atts); - atts++; - } - puttc(T('>'), fp); -} - -static void XMLCALL -endElement(void *userData, const XML_Char *name) -{ - FILE *fp = (FILE *)userData; - puttc(T('<'), fp); - puttc(T('/'), fp); - fputts(name, fp); - puttc(T('>'), fp); -} - -static int -nsattcmp(const void *p1, const void *p2) -{ - const XML_Char *att1 = *(const XML_Char **)p1; - const XML_Char *att2 = *(const XML_Char **)p2; - int sep1 = (tcsrchr(att1, NSSEP) != 0); - int sep2 = (tcsrchr(att1, NSSEP) != 0); - if (sep1 != sep2) - return sep1 - sep2; - return tcscmp(att1, att2); -} - -static void XMLCALL -startElementNS(void *userData, const XML_Char *name, const XML_Char **atts) -{ - int nAtts; - int nsi; - const XML_Char **p; - FILE *fp = (FILE *)userData; - const XML_Char *sep; - puttc(T('<'), fp); - - sep = tcsrchr(name, NSSEP); - if (sep) { - fputts(T("n1:"), fp); - fputts(sep + 1, fp); - fputts(T(" xmlns:n1"), fp); - attributeValue(fp, name); - nsi = 2; - } - else { - fputts(name, fp); - nsi = 1; - } - - p = atts; - while (*p) - ++p; - nAtts = (int)((p - atts) >> 1); - if (nAtts > 1) - qsort((void *)atts, nAtts, sizeof(XML_Char *) * 2, nsattcmp); - while (*atts) { - name = *atts++; - sep = tcsrchr(name, NSSEP); - puttc(T(' '), fp); - if (sep) { - ftprintf(fp, T("n%d:"), nsi); - fputts(sep + 1, fp); - } - else - fputts(name, fp); - attributeValue(fp, *atts); - if (sep) { - ftprintf(fp, T(" xmlns:n%d"), nsi++); - attributeValue(fp, name); - } - atts++; - } - puttc(T('>'), fp); -} - -static void XMLCALL -endElementNS(void *userData, const XML_Char *name) -{ - FILE *fp = (FILE *)userData; - const XML_Char *sep; - puttc(T('<'), fp); - puttc(T('/'), fp); - sep = tcsrchr(name, NSSEP); - if (sep) { - fputts(T("n1:"), fp); - fputts(sep + 1, fp); - } - else - fputts(name, fp); - puttc(T('>'), fp); -} - -#ifndef W3C14N - -static void XMLCALL -processingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ - FILE *fp = (FILE *)userData; - puttc(T('<'), fp); - puttc(T('?'), fp); - fputts(target, fp); - puttc(T(' '), fp); - fputts(data, fp); - puttc(T('?'), fp); - puttc(T('>'), fp); -} - -#endif /* not W3C14N */ - -static void XMLCALL -defaultCharacterData(void *userData, const XML_Char *s, int len) -{ - XML_DefaultCurrent((XML_Parser) userData); -} - -static void XMLCALL -defaultStartElement(void *userData, const XML_Char *name, - const XML_Char **atts) -{ - XML_DefaultCurrent((XML_Parser) userData); -} - -static void XMLCALL -defaultEndElement(void *userData, const XML_Char *name) -{ - XML_DefaultCurrent((XML_Parser) userData); -} - -static void XMLCALL -defaultProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ - XML_DefaultCurrent((XML_Parser) userData); -} - -static void XMLCALL -nopCharacterData(void *userData, const XML_Char *s, int len) -{ -} - -static void XMLCALL -nopStartElement(void *userData, const XML_Char *name, const XML_Char **atts) -{ -} - -static void XMLCALL -nopEndElement(void *userData, const XML_Char *name) -{ -} - -static void XMLCALL -nopProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ -} - -static void XMLCALL -markup(void *userData, const XML_Char *s, int len) -{ - FILE *fp = (FILE *)XML_GetUserData((XML_Parser) userData); - for (; len > 0; --len, ++s) - puttc(*s, fp); -} - -static void -metaLocation(XML_Parser parser) -{ - const XML_Char *uri = XML_GetBase(parser); - if (uri) - ftprintf((FILE *)XML_GetUserData(parser), T(" uri=\"%s\""), uri); - ftprintf((FILE *)XML_GetUserData(parser), - T(" byte=\"%" XML_FMT_INT_MOD "d\" nbytes=\"%d\" \ - line=\"%" XML_FMT_INT_MOD "u\" col=\"%" XML_FMT_INT_MOD "u\""), - XML_GetCurrentByteIndex(parser), - XML_GetCurrentByteCount(parser), - XML_GetCurrentLineNumber(parser), - XML_GetCurrentColumnNumber(parser)); -} - -static void -metaStartDocument(void *userData) -{ - fputts(T("\n"), (FILE *)XML_GetUserData((XML_Parser) userData)); -} - -static void -metaEndDocument(void *userData) -{ - fputts(T("\n"), (FILE *)XML_GetUserData((XML_Parser) userData)); -} - -static void XMLCALL -metaStartElement(void *userData, const XML_Char *name, - const XML_Char **atts) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - const XML_Char **specifiedAttsEnd - = atts + XML_GetSpecifiedAttributeCount(parser); - const XML_Char **idAttPtr; - int idAttIndex = XML_GetIdAttributeIndex(parser); - if (idAttIndex < 0) - idAttPtr = 0; - else - idAttPtr = atts + idAttIndex; - - ftprintf(fp, T("\n"), fp); - do { - ftprintf(fp, T("= specifiedAttsEnd) - fputts(T("\" defaulted=\"yes\"/>\n"), fp); - else if (atts == idAttPtr) - fputts(T("\" id=\"yes\"/>\n"), fp); - else - fputts(T("\"/>\n"), fp); - } while (*(atts += 2)); - fputts(T("\n"), fp); - } - else - fputts(T("/>\n"), fp); -} - -static void XMLCALL -metaEndElement(void *userData, const XML_Char *name) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - ftprintf(fp, T("\n"), fp); -} - -static void XMLCALL -metaProcessingInstruction(void *userData, const XML_Char *target, - const XML_Char *data) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - ftprintf(fp, T("\n"), fp); -} - -static void XMLCALL -metaComment(void *userData, const XML_Char *data) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaStartCdataSection(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaEndCdataSection(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaCharacterData(void *userData, const XML_Char *s, int len) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaStartDoctypeDecl(void *userData, - const XML_Char *doctypeName, - const XML_Char *sysid, - const XML_Char *pubid, - int has_internal_subset) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - ftprintf(fp, T("\n"), fp); -} - -static void XMLCALL -metaEndDoctypeDecl(void *userData) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); -} - -static void XMLCALL -metaNotationDecl(void *userData, - const XML_Char *notationName, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - ftprintf(fp, T("\n"), fp); -} - - -static void XMLCALL -metaEntityDecl(void *userData, - const XML_Char *entityName, - int is_param, - const XML_Char *value, - int value_length, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId, - const XML_Char *notationName) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - - if (value) { - ftprintf(fp, T("'), fp); - characterData(fp, value, value_length); - fputts(T("\n"), fp); - } - else if (notationName) { - ftprintf(fp, T("\n"), fp); - } - else { - ftprintf(fp, T("\n"), fp); - } -} - -static void XMLCALL -metaStartNamespaceDecl(void *userData, - const XML_Char *prefix, - const XML_Char *uri) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - fputts(T("\n"), fp); - } - else - fputts(T("/>\n"), fp); -} - -static void XMLCALL -metaEndNamespaceDecl(void *userData, const XML_Char *prefix) -{ - XML_Parser parser = (XML_Parser) userData; - FILE *fp = (FILE *)XML_GetUserData(parser); - if (!prefix) - fputts(T("\n"), fp); - else - ftprintf(fp, T("\n"), prefix); -} - -static int XMLCALL -unknownEncodingConvert(void *data, const char *p) -{ - return codepageConvert(*(int *)data, p); -} - -static int XMLCALL -unknownEncoding(void *userData, const XML_Char *name, XML_Encoding *info) -{ - int cp; - static const XML_Char prefixL[] = T("windows-"); - static const XML_Char prefixU[] = T("WINDOWS-"); - int i; - - for (i = 0; prefixU[i]; i++) - if (name[i] != prefixU[i] && name[i] != prefixL[i]) - return 0; - - cp = 0; - for (; name[i]; i++) { - static const XML_Char digits[] = T("0123456789"); - const XML_Char *s = tcschr(digits, name[i]); - if (!s) - return 0; - cp *= 10; - cp += (int)(s - digits); - if (cp >= 0x10000) - return 0; - } - if (!codepageMap(cp, info->map)) - return 0; - info->convert = unknownEncodingConvert; - /* We could just cast the code page integer to a void *, - and avoid the use of release. */ - info->release = free; - info->data = malloc(sizeof(int)); - if (!info->data) - return 0; - *(int *)info->data = cp; - return 1; -} - -static int XMLCALL -notStandalone(void *userData) -{ - return 0; -} - -static void -showVersion(XML_Char *prog) -{ - XML_Char *s = prog; - XML_Char ch; - const XML_Feature *features = XML_GetFeatureList(); - while ((ch = *s) != 0) { - if (ch == '/' -#if (defined(WIN32) || defined(__WATCOMC__)) - || ch == '\\' -#endif - ) - prog = s + 1; - ++s; - } - ftprintf(stdout, T("%s using %s\n"), prog, XML_ExpatVersion()); - if (features != NULL && features[0].feature != XML_FEATURE_END) { - int i = 1; - ftprintf(stdout, T("%s"), features[0].name); - if (features[0].value) - ftprintf(stdout, T("=%ld"), features[0].value); - while (features[i].feature != XML_FEATURE_END) { - ftprintf(stdout, T(", %s"), features[i].name); - if (features[i].value) - ftprintf(stdout, T("=%ld"), features[i].value); - ++i; - } - ftprintf(stdout, T("\n")); - } -} - -static void -usage(const XML_Char *prog, int rc) -{ - ftprintf(stderr, - T("usage: %s [-n] [-p] [-r] [-s] [-w] [-x] [-d output-dir] " - "[-e encoding] file ...\n"), prog); - exit(rc); -} - -int -tmain(int argc, XML_Char **argv) -{ - int i, j; - const XML_Char *outputDir = NULL; - const XML_Char *encoding = NULL; - unsigned processFlags = XML_MAP_FILE; - int windowsCodePages = 0; - int outputType = 0; - int useNamespaces = 0; - int requireStandalone = 0; - enum XML_ParamEntityParsing paramEntityParsing = - XML_PARAM_ENTITY_PARSING_NEVER; - int useStdin = 0; - -#ifdef _MSC_VER - _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF); -#endif - - i = 1; - j = 0; - while (i < argc) { - if (j == 0) { - if (argv[i][0] != T('-')) - break; - if (argv[i][1] == T('-') && argv[i][2] == T('\0')) { - i++; - break; - } - j++; - } - switch (argv[i][j]) { - case T('r'): - processFlags &= ~XML_MAP_FILE; - j++; - break; - case T('s'): - requireStandalone = 1; - j++; - break; - case T('n'): - useNamespaces = 1; - j++; - break; - case T('p'): - paramEntityParsing = XML_PARAM_ENTITY_PARSING_ALWAYS; - /* fall through */ - case T('x'): - processFlags |= XML_EXTERNAL_ENTITIES; - j++; - break; - case T('w'): - windowsCodePages = 1; - j++; - break; - case T('m'): - outputType = 'm'; - j++; - break; - case T('c'): - outputType = 'c'; - useNamespaces = 0; - j++; - break; - case T('t'): - outputType = 't'; - j++; - break; - case T('d'): - if (argv[i][j + 1] == T('\0')) { - if (++i == argc) - usage(argv[0], 2); - outputDir = argv[i]; - } - else - outputDir = argv[i] + j + 1; - i++; - j = 0; - break; - case T('e'): - if (argv[i][j + 1] == T('\0')) { - if (++i == argc) - usage(argv[0], 2); - encoding = argv[i]; - } - else - encoding = argv[i] + j + 1; - i++; - j = 0; - break; - case T('h'): - usage(argv[0], 0); - return 0; - case T('v'): - showVersion(argv[0]); - return 0; - case T('\0'): - if (j > 1) { - i++; - j = 0; - break; - } - /* fall through */ - default: - usage(argv[0], 2); - } - } - if (i == argc) { - useStdin = 1; - processFlags &= ~XML_MAP_FILE; - i--; - } - for (; i < argc; i++) { - FILE *fp = 0; - XML_Char *outName = 0; - int result; - XML_Parser parser; - if (useNamespaces) - parser = XML_ParserCreateNS(encoding, NSSEP); - else - parser = XML_ParserCreate(encoding); - if (requireStandalone) - XML_SetNotStandaloneHandler(parser, notStandalone); - XML_SetParamEntityParsing(parser, paramEntityParsing); - if (outputType == 't') { - /* This is for doing timings; this gives a more realistic estimate of - the parsing time. */ - outputDir = 0; - XML_SetElementHandler(parser, nopStartElement, nopEndElement); - XML_SetCharacterDataHandler(parser, nopCharacterData); - XML_SetProcessingInstructionHandler(parser, nopProcessingInstruction); - } - else if (outputDir) { - const XML_Char * delim = T("/"); - const XML_Char *file = useStdin ? T("STDIN") : argv[i]; - if (!useStdin) { - /* Jump after last (back)slash */ - const XML_Char * lastDelim = tcsrchr(file, delim[0]); - if (lastDelim) - file = lastDelim + 1; -#if (defined(WIN32) || defined(__WATCOMC__)) - else { - const XML_Char * winDelim = T("\\"); - lastDelim = tcsrchr(file, winDelim[0]); - if (lastDelim) { - file = lastDelim + 1; - delim = winDelim; - } - } -#endif - } - outName = (XML_Char *)malloc((tcslen(outputDir) + tcslen(file) + 2) - * sizeof(XML_Char)); - tcscpy(outName, outputDir); - tcscat(outName, delim); - tcscat(outName, file); - fp = tfopen(outName, T("wb")); - if (!fp) { - tperror(outName); - exit(1); - } - setvbuf(fp, NULL, _IOFBF, 16384); -#ifdef XML_UNICODE - puttc(0xFEFF, fp); -#endif - XML_SetUserData(parser, fp); - switch (outputType) { - case 'm': - XML_UseParserAsHandlerArg(parser); - XML_SetElementHandler(parser, metaStartElement, metaEndElement); - XML_SetProcessingInstructionHandler(parser, metaProcessingInstruction); - XML_SetCommentHandler(parser, metaComment); - XML_SetCdataSectionHandler(parser, metaStartCdataSection, - metaEndCdataSection); - XML_SetCharacterDataHandler(parser, metaCharacterData); - XML_SetDoctypeDeclHandler(parser, metaStartDoctypeDecl, - metaEndDoctypeDecl); - XML_SetEntityDeclHandler(parser, metaEntityDecl); - XML_SetNotationDeclHandler(parser, metaNotationDecl); - XML_SetNamespaceDeclHandler(parser, metaStartNamespaceDecl, - metaEndNamespaceDecl); - metaStartDocument(parser); - break; - case 'c': - XML_UseParserAsHandlerArg(parser); - XML_SetDefaultHandler(parser, markup); - XML_SetElementHandler(parser, defaultStartElement, defaultEndElement); - XML_SetCharacterDataHandler(parser, defaultCharacterData); - XML_SetProcessingInstructionHandler(parser, - defaultProcessingInstruction); - break; - default: - if (useNamespaces) - XML_SetElementHandler(parser, startElementNS, endElementNS); - else - XML_SetElementHandler(parser, startElement, endElement); - XML_SetCharacterDataHandler(parser, characterData); -#ifndef W3C14N - XML_SetProcessingInstructionHandler(parser, processingInstruction); -#endif /* not W3C14N */ - break; - } - } - if (windowsCodePages) - XML_SetUnknownEncodingHandler(parser, unknownEncoding, 0); - result = XML_ProcessFile(parser, useStdin ? NULL : argv[i], processFlags); - if (outputDir) { - if (outputType == 'm') - metaEndDocument(parser); - fclose(fp); - if (!result) { - tremove(outName); - exit(2); - } - free(outName); - } - XML_ParserFree(parser); - } - return 0; -} diff --git a/external/mit/expat/dist/xmlwf/xmlwf.dsp b/external/mit/expat/dist/xmlwf/xmlwf.dsp deleted file mode 100755 index 52f4eec71..000000000 --- a/external/mit/expat/dist/xmlwf/xmlwf.dsp +++ /dev/null @@ -1,139 +0,0 @@ -# Microsoft Developer Studio Project File - Name="xmlwf" - Package Owner=<4> -# Microsoft Developer Studio Generated Build File, Format Version 6.00 -# ** DO NOT EDIT ** - -# TARGTYPE "Win32 (x86) Console Application" 0x0103 - -CFG=xmlwf - Win32 Release -!MESSAGE This is not a valid makefile. To build this project using NMAKE, -!MESSAGE use the Export Makefile command and run -!MESSAGE -!MESSAGE NMAKE /f "xmlwf.mak". -!MESSAGE -!MESSAGE You can specify a configuration when running NMAKE -!MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE -!MESSAGE NMAKE /f "xmlwf.mak" CFG="xmlwf - Win32 Release" -!MESSAGE -!MESSAGE Possible choices for configuration are: -!MESSAGE -!MESSAGE "xmlwf - Win32 Release" (based on "Win32 (x86) Console Application") -!MESSAGE "xmlwf - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE - -# Begin Project -# PROP AllowPerConfigDependencies 0 -# PROP Scc_ProjName "" -# PROP Scc_LocalPath "" -CPP=cl.exe -RSC=rc.exe - -!IF "$(CFG)" == "xmlwf - Win32 Release" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 0 -# PROP BASE Output_Dir ".\Release" -# PROP BASE Intermediate_Dir ".\Release" -# PROP BASE Target_Dir "." -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 0 -# PROP Output_Dir "..\win32\bin\Release" -# PROP Intermediate_Dir "..\win32\tmp\Release-xmlwf" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "." -# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\lib" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c -# SUBTRACT CPP /YX /Yc /Yu -# ADD BASE RSC /l 0x809 /d "NDEBUG" -# ADD RSC /l 0x409 /d "NDEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /machine:I386 -# ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /machine:I386 /libpath:"..\win32\bin\Release" /out:"..\win32\bin\Release\xmlwf.exe" -# SUBTRACT LINK32 /nodefaultlib - -!ELSEIF "$(CFG)" == "xmlwf - Win32 Debug" - -# PROP BASE Use_MFC 0 -# PROP BASE Use_Debug_Libraries 1 -# PROP BASE Output_Dir ".\Debug" -# PROP BASE Intermediate_Dir ".\Debug" -# PROP BASE Target_Dir "." -# PROP Use_MFC 0 -# PROP Use_Debug_Libraries 1 -# PROP Output_Dir "..\win32\bin\Debug" -# PROP Intermediate_Dir "..\win32\tmp\Debug-xmlwf" -# PROP Ignore_Export_Lib 0 -# PROP Target_Dir "." -# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c -# ADD CPP /nologo /MTd /W3 /GX /ZI /Od /I "..\lib" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "COMPILED_FROM_DSP" /FD /c -# SUBTRACT CPP /Fr /YX -# ADD BASE RSC /l 0x809 /d "_DEBUG" -# ADD RSC /l 0x409 /d "_DEBUG" -BSC32=bscmake.exe -# ADD BASE BSC32 /nologo -# ADD BSC32 /nologo -LINK32=link.exe -# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 -# ADD LINK32 libexpat.lib setargv.obj /nologo /subsystem:console /pdb:none /debug /machine:I386 /libpath:"..\win32\bin\Debug" /out:"..\win32\bin\Debug\xmlwf.exe" - -!ENDIF - -# Begin Target - -# Name "xmlwf - Win32 Release" -# Name "xmlwf - Win32 Debug" -# Begin Group "Source Files" - -# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat;for;f90" -# Begin Source File - -SOURCE=.\codepage.c -# End Source File -# Begin Source File - -SOURCE=.\readfilemap.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\unixfilemap.c -# PROP Exclude_From_Build 1 -# End Source File -# Begin Source File - -SOURCE=.\win32filemap.c -# End Source File -# Begin Source File - -SOURCE=.\xmlfile.c -# End Source File -# Begin Source File - -SOURCE=.\xmlwf.c -# End Source File -# End Group -# Begin Group "Header Files" - -# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd" -# Begin Source File - -SOURCE=.\codepage.h -# End Source File -# Begin Source File - -SOURCE=.\xmlfile.h -# End Source File -# Begin Source File - -SOURCE=.\xmltchar.h -# End Source File -# End Group -# Begin Group "Resource Files" - -# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe" -# End Group -# End Target -# End Project diff --git a/external/mit/expat/dist/xmlwf/xmlwin32url.cxx b/external/mit/expat/dist/xmlwf/xmlwin32url.cxx deleted file mode 100755 index bbfcce22c..000000000 --- a/external/mit/expat/dist/xmlwf/xmlwin32url.cxx +++ /dev/null @@ -1,395 +0,0 @@ -#include "expat.h" -#ifdef XML_UNICODE -#define UNICODE -#endif -#include -#include -#include -#include -#include -#include "xmlurl.h" -#include "xmlmime.h" - -static int -processURL(XML_Parser parser, IMoniker *baseMoniker, const XML_Char *url); - -typedef void (*StopHandler)(void *, HRESULT); - -class Callback : public IBindStatusCallback { -public: - // IUnknown methods - STDMETHODIMP QueryInterface(REFIID,void **); - STDMETHODIMP_(ULONG) AddRef(); - STDMETHODIMP_(ULONG) Release(); - // IBindStatusCallback methods - STDMETHODIMP OnStartBinding(DWORD, IBinding *); - STDMETHODIMP GetPriority(LONG *); - STDMETHODIMP OnLowResource(DWORD); - STDMETHODIMP OnProgress(ULONG, ULONG, ULONG, LPCWSTR); - STDMETHODIMP OnStopBinding(HRESULT, LPCWSTR); - STDMETHODIMP GetBindInfo(DWORD *, BINDINFO *); - STDMETHODIMP OnDataAvailable(DWORD, DWORD, FORMATETC *, STGMEDIUM *); - STDMETHODIMP OnObjectAvailable(REFIID, IUnknown *); - Callback(XML_Parser, IMoniker *, StopHandler, void *); - ~Callback(); - int externalEntityRef(const XML_Char *context, - const XML_Char *systemId, const XML_Char *publicId); -private: - XML_Parser parser_; - IMoniker *baseMoniker_; - DWORD totalRead_; - ULONG ref_; - IBinding *pBinding_; - StopHandler stopHandler_; - void *stopArg_; -}; - -STDMETHODIMP_(ULONG) -Callback::AddRef() -{ - return ref_++; -} - -STDMETHODIMP_(ULONG) -Callback::Release() -{ - if (--ref_ == 0) { - delete this; - return 0; - } - return ref_; -} - -STDMETHODIMP -Callback::QueryInterface(REFIID riid, void** ppv) -{ - if (IsEqualGUID(riid, IID_IUnknown)) - *ppv = (IUnknown *)this; - else if (IsEqualGUID(riid, IID_IBindStatusCallback)) - *ppv = (IBindStatusCallback *)this; - else - return E_NOINTERFACE; - ((LPUNKNOWN)*ppv)->AddRef(); - return S_OK; -} - -STDMETHODIMP -Callback::OnStartBinding(DWORD, IBinding* pBinding) -{ - pBinding_ = pBinding; - pBinding->AddRef(); - return S_OK; -} - -STDMETHODIMP -Callback::GetPriority(LONG *) -{ - return E_NOTIMPL; -} - -STDMETHODIMP -Callback::OnLowResource(DWORD) -{ - return E_NOTIMPL; -} - -STDMETHODIMP -Callback::OnProgress(ULONG, ULONG, ULONG, LPCWSTR) -{ - return S_OK; -} - -STDMETHODIMP -Callback::OnStopBinding(HRESULT hr, LPCWSTR szError) -{ - if (pBinding_) { - pBinding_->Release(); - pBinding_ = 0; - } - if (baseMoniker_) { - baseMoniker_->Release(); - baseMoniker_ = 0; - } - stopHandler_(stopArg_, hr); - return S_OK; -} - -STDMETHODIMP -Callback::GetBindInfo(DWORD* pgrfBINDF, BINDINFO* pbindinfo) -{ - *pgrfBINDF = BINDF_ASYNCHRONOUS; - return S_OK; -} - -static void -reportError(XML_Parser parser) -{ - int code = XML_GetErrorCode(parser); - const XML_Char *message = XML_ErrorString(code); - if (message) - _ftprintf(stderr, _T("%s:%d:%ld: %s\n"), - XML_GetBase(parser), - XML_GetErrorLineNumber(parser), - XML_GetErrorColumnNumber(parser), - message); - else - _ftprintf(stderr, _T("%s: (unknown message %d)\n"), - XML_GetBase(parser), code); -} - -STDMETHODIMP -Callback::OnDataAvailable(DWORD grfBSCF, - DWORD dwSize, - FORMATETC *pfmtetc, - STGMEDIUM* pstgmed) -{ - if (grfBSCF & BSCF_FIRSTDATANOTIFICATION) { - IWinInetHttpInfo *hp; - HRESULT hr = pBinding_->QueryInterface(IID_IWinInetHttpInfo, - (void **)&hp); - if (SUCCEEDED(hr)) { - char contentType[1024]; - DWORD bufSize = sizeof(contentType); - DWORD flags = 0; - contentType[0] = 0; - hr = hp->QueryInfo(HTTP_QUERY_CONTENT_TYPE, contentType, - &bufSize, 0, NULL); - if (SUCCEEDED(hr)) { - char charset[CHARSET_MAX]; - getXMLCharset(contentType, charset); - if (charset[0]) { -#ifdef XML_UNICODE - XML_Char wcharset[CHARSET_MAX]; - XML_Char *p1 = wcharset; - const char *p2 = charset; - while ((*p1++ = (unsigned char)*p2++) != 0) - ; - XML_SetEncoding(parser_, wcharset); -#else - XML_SetEncoding(parser_, charset); -#endif - } - } - hp->Release(); - } - } - if (!parser_) - return E_ABORT; - if (pstgmed->tymed == TYMED_ISTREAM) { - while (totalRead_ < dwSize) { -#define READ_MAX (64*1024) - DWORD nToRead = dwSize - totalRead_; - if (nToRead > READ_MAX) - nToRead = READ_MAX; - void *buf = XML_GetBuffer(parser_, nToRead); - if (!buf) { - _ftprintf(stderr, _T("out of memory\n")); - return E_ABORT; - } - DWORD nRead; - HRESULT hr = pstgmed->pstm->Read(buf, nToRead, &nRead); - if (SUCCEEDED(hr)) { - totalRead_ += nRead; - if (!XML_ParseBuffer(parser_, - nRead, - (grfBSCF & BSCF_LASTDATANOTIFICATION) != 0 - && totalRead_ == dwSize)) { - reportError(parser_); - return E_ABORT; - } - } - } - } - return S_OK; -} - -STDMETHODIMP -Callback::OnObjectAvailable(REFIID, IUnknown *) -{ - return S_OK; -} - -int -Callback::externalEntityRef(const XML_Char *context, - const XML_Char *systemId, - const XML_Char *publicId) -{ - XML_Parser entParser = XML_ExternalEntityParserCreate(parser_, context, 0); - XML_SetBase(entParser, systemId); - int ret = processURL(entParser, baseMoniker_, systemId); - XML_ParserFree(entParser); - return ret; -} - -Callback::Callback(XML_Parser parser, IMoniker *baseMoniker, - StopHandler stopHandler, void *stopArg) -: parser_(parser), - baseMoniker_(baseMoniker), - ref_(0), - pBinding_(0), - totalRead_(0), - stopHandler_(stopHandler), - stopArg_(stopArg) -{ - if (baseMoniker_) - baseMoniker_->AddRef(); -} - -Callback::~Callback() -{ - if (pBinding_) - pBinding_->Release(); - if (baseMoniker_) - baseMoniker_->Release(); -} - -static int -externalEntityRef(void *arg, - const XML_Char *context, - const XML_Char *base, - const XML_Char *systemId, - const XML_Char *publicId) -{ - return ((Callback *)arg)->externalEntityRef(context, systemId, publicId); -} - - -static HRESULT -openStream(XML_Parser parser, - IMoniker *baseMoniker, - const XML_Char *uri, - StopHandler stopHandler, void *stopArg) -{ - if (!XML_SetBase(parser, uri)) - return E_OUTOFMEMORY; - HRESULT hr; - IMoniker *m; -#ifdef XML_UNICODE - hr = CreateURLMoniker(0, uri, &m); -#else - LPWSTR uriw = new wchar_t[strlen(uri) + 1]; - for (int i = 0;; i++) { - uriw[i] = uri[i]; - if (uriw[i] == 0) - break; - } - hr = CreateURLMoniker(baseMoniker, uriw, &m); - delete [] uriw; -#endif - if (FAILED(hr)) - return hr; - IBindStatusCallback *cb = new Callback(parser, m, stopHandler, stopArg); - XML_SetExternalEntityRefHandler(parser, externalEntityRef); - XML_SetExternalEntityRefHandlerArg(parser, cb); - cb->AddRef(); - IBindCtx *b; - if (FAILED(hr = CreateAsyncBindCtx(0, cb, 0, &b))) { - cb->Release(); - m->Release(); - return hr; - } - cb->Release(); - IStream *pStream; - hr = m->BindToStorage(b, 0, IID_IStream, (void **)&pStream); - if (SUCCEEDED(hr)) { - if (pStream) - pStream->Release(); - } - if (hr == MK_S_ASYNCHRONOUS) - hr = S_OK; - m->Release(); - b->Release(); - return hr; -} - -struct QuitInfo { - const XML_Char *url; - HRESULT hr; - int stop; -}; - -static void -winPerror(const XML_Char *url, HRESULT hr) -{ - LPVOID buf; - if (FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_HMODULE, - GetModuleHandleA("urlmon.dll"), - hr, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buf, - 0, - NULL) - || FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER - | FORMAT_MESSAGE_FROM_SYSTEM, - 0, - hr, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &buf, - 0, - NULL)) { - /* The system error messages seem to end with a newline. */ - _ftprintf(stderr, _T("%s: %s"), url, buf); - fflush(stderr); - LocalFree(buf); - } - else - _ftprintf(stderr, _T("%s: error %x\n"), url, hr); -} - -static void -threadQuit(void *p, HRESULT hr) -{ - QuitInfo *qi = (QuitInfo *)p; - qi->hr = hr; - qi->stop = 1; -} - -extern "C" -int -XML_URLInit(void) -{ - return SUCCEEDED(CoInitialize(0)); -} - -extern "C" -void -XML_URLUninit(void) -{ - CoUninitialize(); -} - -static int -processURL(XML_Parser parser, IMoniker *baseMoniker, - const XML_Char *url) -{ - QuitInfo qi; - qi.stop = 0; - qi.url = url; - - XML_SetBase(parser, url); - HRESULT hr = openStream(parser, baseMoniker, url, threadQuit, &qi); - if (FAILED(hr)) { - winPerror(url, hr); - return 0; - } - else if (FAILED(qi.hr)) { - winPerror(url, qi.hr); - return 0; - } - MSG msg; - while (!qi.stop && GetMessage (&msg, NULL, 0, 0)) { - TranslateMessage (&msg); - DispatchMessage (&msg); - } - return 1; -} - -extern "C" -int -XML_ProcessURL(XML_Parser parser, - const XML_Char *url, - unsigned flags) -{ - return processURL(parser, 0, url); -} diff --git a/external/mit/expat/lib/Makefile b/external/mit/expat/lib/Makefile deleted file mode 100644 index c55918f34..000000000 --- a/external/mit/expat/lib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2012/02/29 20:07:56 tron Exp $ - -SUBDIR+= libexpat - -.include diff --git a/external/mit/expat/lib/Makefile.inc b/external/mit/expat/lib/Makefile.inc deleted file mode 100644 index 3161ff0a2..000000000 --- a/external/mit/expat/lib/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.1 2012/02/29 20:07:56 tron Exp $ - -.include "../Makefile.inc" diff --git a/external/mit/expat/lib/libexpat/Makefile b/external/mit/expat/lib/libexpat/Makefile deleted file mode 100644 index 7f68bc886..000000000 --- a/external/mit/expat/lib/libexpat/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2012/02/29 20:07:56 tron Exp $ - -.include - -LIB= expat - -.PATH: ${EXPATSRCDIR}/lib -SRCS= xmlparse.c xmlrole.c xmltok.c - -INCS= expat.h expat_external.h -INCSDIR= /usr/include - -CPPFLAGS+= -I${EXPATSRCDIR} -I${.CURDIR} -CPPFLAGS+= -DHAVE_EXPAT_CONFIG_H -COPTS.xmlparse.c= -Wno-error # macppc -COPTS.xmlrole.c= -Wno-error # macppc -COPTS.xmltok.c= -Wno-error # macppc - -.include - -gaga: - @echo MKLINT=${MKLINT} - @echo LSRCS=${LSRCS} - @echo LOBJS=${LOBJS} diff --git a/external/mit/expat/lib/libexpat/expat_config.h b/external/mit/expat/lib/libexpat/expat_config.h deleted file mode 100644 index f13b74b86..000000000 --- a/external/mit/expat/lib/libexpat/expat_config.h +++ /dev/null @@ -1,103 +0,0 @@ -/* expat_config.h. Generated from expat_config.h.in by configure. */ -/* expat_config.h.in. Generated from configure.in by autoheader. */ - -/* 1234 = LIL_ENDIAN, 4321 = BIGENDIAN */ -#define BYTEORDER BYTE_ORDER - -/* Define to 1 if you have the `bcopy' function. */ -#define HAVE_BCOPY 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_DLFCN_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define to 1 if you have the `getpagesize' function. */ -#define HAVE_GETPAGESIZE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_INTTYPES_H 1 - -/* Define to 1 if you have the `memmove' function. */ -#define HAVE_MEMMOVE 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_MEMORY_H 1 - -/* Define to 1 if you have a working `mmap' system call. */ -#define HAVE_MMAP 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDINT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STDLIB_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define to 1 if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define to the sub-directory in which libtool stores uninstalled libraries. - */ -#define LT_OBJDIR ".libs/" - -/* Define to the address where bug reports for this package should be sent. */ -#define PACKAGE_BUGREPORT "expat-bugs@libexpat.org" - -/* Define to the full name of this package. */ -#define PACKAGE_NAME "expat" - -/* Define to the full name and version of this package. */ -#define PACKAGE_STRING "expat 2.1.0" - -/* Define to the one symbol short name of this package. */ -#define PACKAGE_TARNAME "expat" - -/* Define to the home page for this package. */ -#define PACKAGE_URL "" - -/* Define to the version of this package. */ -#define PACKAGE_VERSION "2.1.0" - -/* Define to 1 if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* whether byteorder is bigendian */ -/* #undef WORDS_BIGENDIAN */ - -/* Define to specify how much context to retain around the current parse - point. */ -#define XML_CONTEXT_BYTES 1024 - -/* Define to make parameter entity parsing functionality available. */ -#define XML_DTD 1 - -/* Define to make XML Namespaces functionality available. */ -#define XML_NS 1 - -/* Define to __FUNCTION__ or "" if `__func__' does not conform to ANSI C. */ -/* #undef __func__ */ - -/* Define to empty if `const' does not conform to ANSI C. */ -/* #undef const */ - -/* Define to `long int' if does not define. */ -/* #undef off_t */ - -/* Define to `unsigned int' if does not define. */ -/* #undef size_t */ diff --git a/external/mit/expat/lib/libexpat/shlib_version b/external/mit/expat/lib/libexpat/shlib_version deleted file mode 100644 index 8cfcd2dbf..000000000 --- a/external/mit/expat/lib/libexpat/shlib_version +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: shlib_version,v 1.2 2012/04/06 10:49:27 spz Exp $ -# -# XXX netbsd xsrc had major=4 -major=2 -minor=1 diff --git a/external/mit/lua/Makefile b/external/mit/lua/Makefile deleted file mode 100644 index f3d61c38d..000000000 --- a/external/mit/lua/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2015/02/09 16:44:53 christos Exp $ - -SUBDIR+= lib .WAIT usr.bin - -.include diff --git a/external/mit/lua/dist/Makefile b/external/mit/lua/dist/Makefile deleted file mode 100644 index 5ee560112..000000000 --- a/external/mit/lua/dist/Makefile +++ /dev/null @@ -1,114 +0,0 @@ -# Makefile for installing Lua -# See doc/readme.html for installation and customization instructions. - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -# Where to install. The installation starts in the src and doc directories, -# so take care if INSTALL_TOP is not an absolute path. See the local target. -# You may want to make INSTALL_LMOD and INSTALL_CMOD consistent with -# LUA_ROOT, LUA_LDIR, and LUA_CDIR in luaconf.h. -INSTALL_TOP= /usr/local -INSTALL_BIN= $(INSTALL_TOP)/bin -INSTALL_INC= $(INSTALL_TOP)/include -INSTALL_LIB= $(INSTALL_TOP)/lib -INSTALL_MAN= $(INSTALL_TOP)/man/man1 -INSTALL_LMOD= $(INSTALL_TOP)/share/lua/$V -INSTALL_CMOD= $(INSTALL_TOP)/lib/lua/$V - -# How to install. If your install program does not support "-p", then -# you may have to run ranlib on the installed liblua.a. -INSTALL= install -p -INSTALL_EXEC= $(INSTALL) -m 0755 -INSTALL_DATA= $(INSTALL) -m 0644 -# -# If you don't have "install" you can use "cp" instead. -# INSTALL= cp -p -# INSTALL_EXEC= $(INSTALL) -# INSTALL_DATA= $(INSTALL) - -# Other utilities. -MKDIR= mkdir -p -RM= rm -f - -# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= - -# Convenience platforms targets. -PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris - -# What to install. -TO_BIN= lua luac -TO_INC= lua.h luaconf.h lualib.h lauxlib.h lua.hpp -TO_LIB= liblua.a -TO_MAN= lua.1 luac.1 - -# Lua version and release. -V= 5.3 -R= $V.1 - -# Targets start here. -all: $(PLAT) - -$(PLATS) clean: - cd src && $(MAKE) $@ - -test: dummy - src/lua -v - -install: dummy - cd src && $(MKDIR) $(INSTALL_BIN) $(INSTALL_INC) $(INSTALL_LIB) $(INSTALL_MAN) $(INSTALL_LMOD) $(INSTALL_CMOD) - cd src && $(INSTALL_EXEC) $(TO_BIN) $(INSTALL_BIN) - cd src && $(INSTALL_DATA) $(TO_INC) $(INSTALL_INC) - cd src && $(INSTALL_DATA) $(TO_LIB) $(INSTALL_LIB) - cd doc && $(INSTALL_DATA) $(TO_MAN) $(INSTALL_MAN) - -uninstall: - cd src && cd $(INSTALL_BIN) && $(RM) $(TO_BIN) - cd src && cd $(INSTALL_INC) && $(RM) $(TO_INC) - cd src && cd $(INSTALL_LIB) && $(RM) $(TO_LIB) - cd doc && cd $(INSTALL_MAN) && $(RM) $(TO_MAN) - -local: - $(MAKE) install INSTALL_TOP=../install - -none: - @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" - @echo " $(PLATS)" - @echo "See doc/readme.html for complete instructions." - -# make may get confused with test/ and install/ -dummy: - -# echo config parameters -echo: - @cd src && $(MAKE) -s echo - @echo "PLAT= $(PLAT)" - @echo "V= $V" - @echo "R= $R" - @echo "TO_BIN= $(TO_BIN)" - @echo "TO_INC= $(TO_INC)" - @echo "TO_LIB= $(TO_LIB)" - @echo "TO_MAN= $(TO_MAN)" - @echo "INSTALL_TOP= $(INSTALL_TOP)" - @echo "INSTALL_BIN= $(INSTALL_BIN)" - @echo "INSTALL_INC= $(INSTALL_INC)" - @echo "INSTALL_LIB= $(INSTALL_LIB)" - @echo "INSTALL_MAN= $(INSTALL_MAN)" - @echo "INSTALL_LMOD= $(INSTALL_LMOD)" - @echo "INSTALL_CMOD= $(INSTALL_CMOD)" - @echo "INSTALL_EXEC= $(INSTALL_EXEC)" - @echo "INSTALL_DATA= $(INSTALL_DATA)" - -# echo pkg-config data -pc: - @echo "version=$R" - @echo "prefix=$(INSTALL_TOP)" - @echo "libdir=$(INSTALL_LIB)" - @echo "includedir=$(INSTALL_INC)" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) clean test install local none dummy echo pecho lecho - -# (end of Makefile) diff --git a/external/mit/lua/dist/README b/external/mit/lua/dist/README deleted file mode 100644 index d6ae6607e..000000000 --- a/external/mit/lua/dist/README +++ /dev/null @@ -1,6 +0,0 @@ - -This is Lua 5.3.1, released on 10 Jun 2015. - -For installation instructions, license details, and -further information about Lua, see doc/readme.html. - diff --git a/external/mit/lua/dist/doc/contents.html b/external/mit/lua/dist/doc/contents.html deleted file mode 100644 index 1272c59cd..000000000 --- a/external/mit/lua/dist/doc/contents.html +++ /dev/null @@ -1,618 +0,0 @@ - - - -Lua 5.3 Reference Manual - contents - - - - - - - -

-Lua -Lua 5.3 Reference Manual -

- -

-The reference manual is the official definition of the Lua language. -
-For a complete introduction to Lua programming, see the book -Programming in Lua. - -

- -

- -Copyright © 2015 Lua.org, PUC-Rio. -Freely available under the terms of the -Lua license. - - -

Contents

- - -

Index

- - - - - - - - - - - - - - diff --git a/external/mit/lua/dist/doc/index.css b/external/mit/lua/dist/doc/index.css deleted file mode 100644 index c96183573..000000000 --- a/external/mit/lua/dist/doc/index.css +++ /dev/null @@ -1,21 +0,0 @@ -ul { - list-style-type: none ; -} - -ul.contents { - padding: 0 ; -} - -table { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; -} - -td { - vertical-align: top ; - padding: 0 ; - text-align: left ; - line-height: 1.25 ; - width: 15% ; -} diff --git a/external/mit/lua/dist/doc/logo.gif b/external/mit/lua/dist/doc/logo.gif deleted file mode 100644 index 2f5e4ac2e742fbb7675e739879211553758aea9c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4232 zcmeH``9G8i;K!fm@ywWE@XWZzZ5SF?A>^uN#>^O6HI%DVL*tw8h1>$H%uPC0$QQ=txe!o}PX)Ev+jn>*nFZ-TC=<^76WcLZL(=DJm)| zEiIKwrInSHXU?3duCC_u@5try#>U2`rlw1mF15F}U%!66tE;QKyIUmcDJ<+QF77*W zFJd#&)VAl)kJ6K zi<>tmZ{3>g>+2gB7#JQNe(>OdLh;A=`1q42PbMZNCMPF*dXxhLZw3aYhlZwyhu@Bj z%#4n{d-Q1b$&i4QMce4L#8^!oMdw{PDnm4D66&3*dxX=-YIX6DQL_g`jbzkd4k zZDCoLf=%jL&vIeE zO=XcZ9fxt`f}-DQ^%H*PHMUs(JN%UWkI|Y8h9#6~I$Cw@{RqzO4&P-x;jHCPJ6Ks2 zoU%foi)nXd_sdkiuJa@@5J4RrreKfWSnz5>eMa5yTP=)16uu)TIdx~Fhho))6jZl) z($*i>QrIX4u}u3>m{WSn_ehkUGQ& zs})aUlTH1Cj1g3ZE3=MPXsSniEwJ{e6C3N#HjD=B4`8rWIsz!a7ecYpec?WuH+y?Wsm18^$cS4WmHhH3_=r zh*ILlm*X1dB^E5($KVl&zT524%l}vpHg%;Y+LezV_&TAJCmH`idhuj-n$4FZ)UE|jXLayXa-&O3Q z?Iyo!x*$5hD_HfFnDfGYj-RD|eIb7I?%>Y_kf%}Nbd`BXb4l1(Pc+}zoUR|9%_!7f zum2T;wbx&pohtI+&@~wm3nH9xLbOYkg*`phY~TK5iC#3tZNXo9s`cahx+8j2)rh5C zQgZh6D7Ekgib|hpdhxYf{r!PTJc z!vsYG@{hA}l5kL)g)0N_)(nC<*L0qdUi*3fD5<0sn58>zklX@6Tyv3*X^}m=Cqc40 zQ6GfjG@kd1mFIm`qaubWunm_?P>WUZ`9|f_z%gGHi{n|uu(N8!L=aw5(qAcDj$-QK zu;D#j6e42OXTQD>)i zlvM$LX`$n9EEjxM$_QDF&a z7cme_rat}aXmiN&7`6Q98}dh4Z@8L_uAb#nK&GQiZOOUnA9kAEVb-csuN1AWL=sXt z{z9GCN%%l0N9QvJM;tl1nf?rrhT{*sE%4WqR?{0~aIrfCcCPxf4eh_*jjQ=`$p53Y z@_|Rsx2i}|3dNFetMQQ5y8agTK-E0D&7;@3-LUxfvZ7 z7~!p@&mFe^oca2^F|CBt+4Ly?^ViUVSAhAH>JH1GN{^TQb3QnM*x0ZiZgDyNI@_c3 z@{}(WH4*e3T~}n_^0}da4ElIxAf9B!IaL7z9X0Icvj@cIkE*~W--17&WN`Ea5)Gn> z#gpfRb#44;jVTOS{FuaZgd(-ZD848=fQzgST2MxR>wSLc1P=2HDvByz$B$IsNCC6L zCM?nK*OHj6JA9gz4|b<~2%RqelN^1Y)jIqnRs!mDKV^BQTfo@hOtz7*Ug}Ee^cbsj zNNlumRgAmt`1$b5MO;&X#5-EP<}AaY;52ihIpem&MTea$?3!DrwbYa?V`NjEfWF3z zUq5JY8Ch;L{kx&J<1K&Fe_Vn;8gk{%c;n?nA2(%(f%DCRHko3uT~VI7RE^JWEqaCq z)i|%nfj(*4|V*XhY3W%M# z*yn6SN4eUOHFxAD7B&9E_PO`G5bqgs^@J{9bk>&;PlUAiqo`j3rjQDgD!}mqLUtb` zCB}ZD@m@s#pf7bV4jreOC*JVfHZ|hyHkX!rauVdd_I9FL45d{gWH!DNYu;i(|8wVx z!)eLY6YXxZ2{Coae0xuTnxo1ACb5wtED?VJAz&@114$Ao6uG9YSy*!K;m5_mj=0^j zw%?b%AOs}ql@$TGC-!^^*_#RT5+y_kTzQG9?LPPZNAtt6cJ%d2$q(I)ws21*?xF%p zN+NeGnWRQ<5w70Rc(bl|S0Xr&5@WrmdurS|IgPB|EyuZO#=tf!35)G!HJ`E1jh^lH zTBu~rL#DhQO*XAWtBt}JHH$lc>3%r0yD|maW_(W=B_J+y164F>O4dO|@&@N3Z3p=B zmVl{|^Z&#atHY|9n&la)SBo}=3AFIF=_~LDJk6MTlA73CXtX+4bnn+c!}N}IPa5pp zwyqbqIkN|I3j_3vD6$zlu{Ps(N-J|*qzEt<$5Soh;s^AuKv_ z-Tz+O1_~6*9CJh4r}`}mbUtjbf#fX58RIIkP6&@*y9kI|5fK*_eZ%jv3U$5*x<>D_ za2M(TV8?XY+9xy>0En#Te<6X4$0&dbyd(go$~eq4u(u)EA2msyF<5ssLZ zDP|I}=~Bi_q)whWv=Ri~L1TYaNrR;5cMB@s78HF1{w&r(6GJ;_2@bD?#1p&P4n_?n0#9Vx~$qjMX=Lk?*!@aKo8m&$iPO7S{g3sFUwr`*<53(68xx7?z`2xf# zGSicy_zI(PJ|%qc2VxT+6bOE--a{k&aq7$<<= zFt)C<@|TPs`+eycPGoGL1Wn9|Ed&a2JyAmjnkm3DQBECX&`bt~odH9cUPq4M{#$-q?G3!)qO-it*&YHw+j-O* zYy78V*`4Q=kQ@^Yz*b6Tal4(Me7BGeS^;phWAW8+L^5A(=D)t?k!rLIwVAKtq=f7h z&^n&VX1-T$ScvN~639QLZ^d@niMaS{C-Q)8oHHBhwD*r~-1Ze#Q)GFOFptW32a-uF z;M@ux%i%a25NwIgXt*=GHX$3~aZfwovGL!}sf?j9TsVo^cn(%&a<--0mIXYqGe>c PWz_J}_#7St0k8iB@FZjZ diff --git a/external/mit/lua/dist/doc/lua.1 b/external/mit/lua/dist/doc/lua.1 deleted file mode 100644 index c38d3a313..000000000 --- a/external/mit/lua/dist/doc/lua.1 +++ /dev/null @@ -1,113 +0,0 @@ -.\" $NetBSD: lua.1,v 1.3 2015/02/02 14:03:05 lneto Exp $ -.\" -.TH LUA 1 "Date: 2014/12/10 15:55:45 " -.SH NAME -lua \- Lua interpreter -.SH SYNOPSIS -.B lua -[ -.I options -] -[ -.I script -[ -.I args -] -] -.SH DESCRIPTION -.B lua -is the standalone Lua interpreter. -It loads and executes Lua programs, -either in textual source form or -in precompiled binary form. -(Precompiled binaries are output by -.BR luac , -the Lua compiler.) -.B lua -can be used as a batch interpreter and also interactively. -.LP -The given -.I options -are handled in order and then -the Lua program in file -.I script -is loaded and executed. -The given -.I args -are available to -.I script -as strings in a global table named -.BR arg . -If no options or arguments are given, -then -.B "\-v \-i" -is assumed when the standard input is a terminal; -otherwise, -.B "\-" -is assumed. -.LP -In interactive mode, -.B lua -prompts the user, -reads lines from the standard input, -and executes them as they are read. -If the line contains an expression or list of expressions, -then the line is evaluated and the results are printed. -If a line does not contain a complete statement, -then a secondary prompt is displayed and -lines are read until a complete statement is formed or -a syntax error is found. -.LP -At the very start, -before even handling the command line, -.B lua -checks the contents of the environment variables -.B LUA_INIT_5_3 -or -.BR LUA_INIT , -in that order. -If the contents is of the form -.RI '@ filename ', -then -.I filename -is executed. -Otherwise, the string is assumed to be a Lua statement and is executed. -.SH OPTIONS -.TP -.BI \-e " stat" -execute statement -.IR stat . -.TP -.B \-i -enter interactive mode after executing -.IR script . -.TP -.BI \-l " name" -execute the equivalent of -.IB name =require(' name ') -before executing -.IR script . -.TP -.B \-v -show version information. -.TP -.B \-E -ignore environment variables. -.TP -.B \-\- -stop handling options. -.TP -.B \- -stop handling options and execute the standard input as a file. -.SH "SEE ALSO" -.BR luac (1) -.br -The documentation at lua.org, -especially section 7 of the reference manual. -.SH DIAGNOSTICS -Error messages should be self explanatory. -.SH AUTHORS -R. Ierusalimschy, -L. H. de Figueiredo, -W. Celes -.\" EOF diff --git a/external/mit/lua/dist/doc/lua.css b/external/mit/lua/dist/doc/lua.css deleted file mode 100644 index b614f3c08..000000000 --- a/external/mit/lua/dist/doc/lua.css +++ /dev/null @@ -1,133 +0,0 @@ -html { - background-color: #F8F8F8 ; -} - -body { - background-color: #FFFFFF ; - color: #000000 ; - font-family: Helvetica, Arial, sans-serif ; - text-align: justify ; - line-height: 1.25 ; - margin: 16px auto ; - padding: 32px ; - border: solid #a0a0a0 1px ; - border-radius: 20px ; - max-width: 70em ; - width: 90% ; -} - -h1, h2, h3, h4 { - color: #000080 ; - font-family: Verdana, Geneva, sans-serif ; - font-weight: normal ; - font-style: normal ; - text-align: left ; -} - -h1 { - font-size: 28pt ; -} - -h1 img { - vertical-align: text-bottom ; -} - -h2:before { - content: "\2756" ; - padding-right: 0.5em ; -} - -a { - text-decoration: none ; -} - -a:link { - color: #000080 ; -} - -a:link:hover, a:visited:hover { - background-color: #D0D0FF ; - color: #000080 ; - border-radius: 4px ; -} - -a:link:active, a:visited:active { - color: #FF0000 ; -} - -div.menubar { - padding-bottom: 0.5em ; -} - -p.menubar { - margin-left: 2.5em ; -} - -.menubar a:hover { - margin: -3px -3px -3px -3px ; - padding: 3px 3px 3px 3px ; - border-radius: 4px ; -} - -:target { - background-color: #F0F0F0 ; - margin: -8px ; - padding: 8px ; - border-radius: 8px ; - outline: none ; -} - -hr { - display: none ; -} - -table hr { - background-color: #a0a0a0 ; - color: #a0a0a0 ; - border: 0 ; - height: 1px ; - display: block ; -} - -.footer { - color: gray ; - font-size: x-small ; -} - -input[type=text] { - border: solid #a0a0a0 2px ; - border-radius: 2em ; - background-image: url('images/search.png') ; - background-repeat: no-repeat ; - background-position: 4px center ; - padding-left: 20px ; - height: 2em ; -} - -pre.session { - background-color: #F8F8F8 ; - padding: 1em ; - border-radius: 8px ; -} - -td.gutter { - width: 4% ; -} - -table.columns { - border: none ; - border-spacing: 0 ; - border-collapse: collapse ; -} - -table.columns td { - vertical-align: top ; - padding: 0 ; - padding-bottom: 1em ; - text-align: justify ; - line-height: 1.25 ; -} - -p.logos a:link:hover, p.logos a:visited:hover { - background-color: inherit ; -} diff --git a/external/mit/lua/dist/doc/luac.1 b/external/mit/lua/dist/doc/luac.1 deleted file mode 100644 index 31207f185..000000000 --- a/external/mit/lua/dist/doc/luac.1 +++ /dev/null @@ -1,120 +0,0 @@ -.\" $NetBSD: luac.1,v 1.2 2014/07/19 18:38:33 lneto Exp $ -.\" -.\" $Id: luac.1,v 1.2 2014/07/19 18:38:33 lneto Exp $ -.TH LUAC 1 "$Date: 2014/07/19 18:38:33 $" -.SH NAME -luac \- Lua compiler -.SH SYNOPSIS -.B luac -[ -.I options -] [ -.I filenames -] -.SH DESCRIPTION -.B luac -is the Lua compiler. -It translates programs written in the Lua programming language -into binary files containing precompiled chunks -that can be later loaded and executed. -.LP -The main advantages of precompiling chunks are: -faster loading, -protecting source code from accidental user changes, -and -off-line syntax checking. -Precompiling does not imply faster execution -because in Lua chunks are always compiled into bytecodes before being executed. -.B luac -simply allows those bytecodes to be saved in a file for later execution. -Precompiled chunks are not necessarily smaller than the corresponding source. -The main goal in precompiling is faster loading. -.LP -In the command line, -you can mix -text files containing Lua source and -binary files containing precompiled chunks. -.B luac -produces a single output file containing the combined bytecodes -for all files given. -Executing the combined file is equivalent to executing the given files. -By default, -the output file is named -.BR luac.out , -but you can change this with the -.B \-o -option. -.LP -Precompiled chunks are -.I not -portable across different architectures. -Moreover, -the internal format of precompiled chunks -is likely to change when a new version of Lua is released. -Make sure you save the source files of all Lua programs that you precompile. -.LP -.SH OPTIONS -.TP -.B \-l -produce a listing of the compiled bytecode for Lua's virtual machine. -Listing bytecodes is useful to learn about Lua's virtual machine. -If no files are given, then -.B luac -loads -.B luac.out -and lists its contents. -Use -.B \-l \-l -for a full listing. -.TP -.BI \-o " file" -output to -.IR file , -instead of the default -.BR luac.out . -(You can use -.B "'\-'" -for standard output, -but not on platforms that open standard output in text mode.) -The output file may be one of the given files because -all files are loaded before the output file is written. -Be careful not to overwrite precious files. -.TP -.B \-p -load files but do not generate any output file. -Used mainly for syntax checking and for testing precompiled chunks: -corrupted files will probably generate errors when loaded. -If no files are given, then -.B luac -loads -.B luac.out -and tests its contents. -No messages are displayed if the file loads without errors. -.TP -.B \-s -strip debug information before writing the output file. -This saves some space in very large chunks, -but if errors occur when running a stripped chunk, -then the error messages may not contain the full information they usually do. -In particular, -line numbers and names of local variables are lost. -.TP -.B \-v -show version information. -.TP -.B \-\- -stop handling options. -.TP -.B \- -stop handling options and process standard input. -.SH "SEE ALSO" -.BR lua (1) -.br -The documentation at lua.org. -.SH DIAGNOSTICS -Error messages should be self explanatory. -.SH AUTHORS -R. Ierusalimschy, -L. H. de Figueiredo, -W. Celes -.\" EOF diff --git a/external/mit/lua/dist/doc/manual.css b/external/mit/lua/dist/doc/manual.css deleted file mode 100644 index aa0e677dd..000000000 --- a/external/mit/lua/dist/doc/manual.css +++ /dev/null @@ -1,21 +0,0 @@ -h3 code { - font-family: inherit ; - font-size: inherit ; -} - -pre, code { - font-size: 12pt ; -} - -span.apii { - color: gray ; - float: right ; - font-family: inherit ; - font-style: normal ; - font-size: small ; -} - -h2:before { - content: "" ; - padding-right: 0em ; -} diff --git a/external/mit/lua/dist/doc/manual.html b/external/mit/lua/dist/doc/manual.html deleted file mode 100644 index 63d28ae0c..000000000 --- a/external/mit/lua/dist/doc/manual.html +++ /dev/null @@ -1,10807 +0,0 @@ - - - -Lua 5.3 Reference Manual - - - - - - - -

-Lua -Lua 5.3 Reference Manual -

- -

-by Roberto Ierusalimschy, Luiz Henrique de Figueiredo, Waldemar Celes - -

- -Copyright © 2015 Lua.org, PUC-Rio. -Freely available under the terms of the -Lua license. - - -

- - -

- - - - - - -

1 – Introduction

- -

-Lua is an extension programming language designed to support -general procedural programming with data description -facilities. -Lua also offers good support for object-oriented programming, -functional programming, and data-driven programming. -Lua is intended to be used as a powerful, lightweight, -embeddable scripting language for any program that needs one. -Lua is implemented as a library, written in clean C, -the common subset of Standard C and C++. - - -

-As an extension language, Lua has no notion of a "main" program: -it only works embedded in a host client, -called the embedding program or simply the host. -The host program can invoke functions to execute a piece of Lua code, -can write and read Lua variables, -and can register C functions to be called by Lua code. -Through the use of C functions, Lua can be augmented to cope with -a wide range of different domains, -thus creating customized programming languages sharing a syntactical framework. -The Lua distribution includes a sample host program called lua, -which uses the Lua library to offer a complete, standalone Lua interpreter, -for interactive or batch use. - - -

-Lua is free software, -and is provided as usual with no guarantees, -as stated in its license. -The implementation described in this manual is available -at Lua's official web site, www.lua.org. - - -

-Like any other reference manual, -this document is dry in places. -For a discussion of the decisions behind the design of Lua, -see the technical papers available at Lua's web site. -For a detailed introduction to programming in Lua, -see Roberto's book, Programming in Lua. - - - -

2 – Basic Concepts

- -

-This section describes the basic concepts of the language. - - - -

2.1 – Values and Types

- -

-Lua is a dynamically typed language. -This means that -variables do not have types; only values do. -There are no type definitions in the language. -All values carry their own type. - - -

-All values in Lua are first-class values. -This means that all values can be stored in variables, -passed as arguments to other functions, and returned as results. - - -

-There are eight basic types in Lua: -nil, boolean, number, -string, function, userdata, -thread, and table. -The type nil has one single value, nil, -whose main property is to be different from any other value; -it usually represents the absence of a useful value. -The type boolean has two values, false and true. -Both nil and false make a condition false; -any other value makes it true. -The type number represents both -integer numbers and real (floating-point) numbers. -The type string represents immutable sequences of bytes. - -Lua is 8-bit clean: -strings can contain any 8-bit value, -including embedded zeros ('\0'). -Lua is also encoding-agnostic; -it makes no assumptions about the contents of a string. - - -

-The type number uses two internal representations, -or two subtypes, -one called integer and the other called float. -Lua has explicit rules about when each representation is used, -but it also converts between them automatically as needed (see §3.4.3). -Therefore, -the programmer may choose to mostly ignore the difference -between integers and floats -or to assume complete control over the representation of each number. -Standard Lua uses 64-bit integers and double-precision (64-bit) floats, -but you can also compile Lua so that it -uses 32-bit integers and/or single-precision (32-bit) floats. -The option with 32 bits for both integers and floats -is particularly attractive -for small machines and embedded systems. -(See macro LUA_32BITS in file luaconf.h.) - - -

-Lua can call (and manipulate) functions written in Lua and -functions written in C (see §3.4.10). -Both are represented by the type function. - - -

-The type userdata is provided to allow arbitrary C data to -be stored in Lua variables. -A userdata value represents a block of raw memory. -There are two kinds of userdata: -full userdata, -which is an object with a block of memory managed by Lua, -and light userdata, -which is simply a C pointer value. -Userdata has no predefined operations in Lua, -except assignment and identity test. -By using metatables, -the programmer can define operations for full userdata values -(see §2.4). -Userdata values cannot be created or modified in Lua, -only through the C API. -This guarantees the integrity of data owned by the host program. - - -

-The type thread represents independent threads of execution -and it is used to implement coroutines (see §2.6). -Lua threads are not related to operating-system threads. -Lua supports coroutines on all systems, -even those that do not support threads natively. - - -

-The type table implements associative arrays, -that is, arrays that can be indexed not only with numbers, -but with any Lua value except nil and NaN. -(Not a Number is a special value used to represent -undefined or unrepresentable numerical results, such as 0/0.) -Tables can be heterogeneous; -that is, they can contain values of all types (except nil). -Any key with value nil is not considered part of the table. -Conversely, any key that is not part of a table has -an associated value nil. - - -

-Tables are the sole data-structuring mechanism in Lua; -they can be used to represent ordinary arrays, sequences, -symbol tables, sets, records, graphs, trees, etc. -To represent records, Lua uses the field name as an index. -The language supports this representation by -providing a.name as syntactic sugar for a["name"]. -There are several convenient ways to create tables in Lua -(see §3.4.9). - - -

-We use the term sequence to denote a table where -the set of all positive numeric keys is equal to {1..n} -for some non-negative integer n, -which is called the length of the sequence (see §3.4.7). - - -

-Like indices, -the values of table fields can be of any type. -In particular, -because functions are first-class values, -table fields can contain functions. -Thus tables can also carry methods (see §3.4.11). - - -

-The indexing of tables follows -the definition of raw equality in the language. -The expressions a[i] and a[j] -denote the same table element -if and only if i and j are raw equal -(that is, equal without metamethods). -In particular, floats with integral values -are equal to their respective integers -(e.g., 1.0 == 1). -To avoid ambiguities, -any float with integral value used as a key -is converted to its respective integer. -For instance, if you write a[2.0] = true, -the actual key inserted into the table will be the -integer 2. -(On the other hand, -2 and "2" are different Lua values and therefore -denote different table entries.) - - -

-Tables, functions, threads, and (full) userdata values are objects: -variables do not actually contain these values, -only references to them. -Assignment, parameter passing, and function returns -always manipulate references to such values; -these operations do not imply any kind of copy. - - -

-The library function type returns a string describing the type -of a given value (see §6.1). - - - - - -

2.2 – Environments and the Global Environment

- -

-As will be discussed in §3.2 and §3.3.3, -any reference to a free name -(that is, a name not bound to any declaration) var -is syntactically translated to _ENV.var. -Moreover, every chunk is compiled in the scope of -an external local variable named _ENV (see §3.3.2), -so _ENV itself is never a free name in a chunk. - - -

-Despite the existence of this external _ENV variable and -the translation of free names, -_ENV is a completely regular name. -In particular, -you can define new variables and parameters with that name. -Each reference to a free name uses the _ENV that is -visible at that point in the program, -following the usual visibility rules of Lua (see §3.5). - - -

-Any table used as the value of _ENV is called an environment. - - -

-Lua keeps a distinguished environment called the global environment. -This value is kept at a special index in the C registry (see §4.5). -In Lua, the global variable _G is initialized with this same value. -(_G is never used internally.) - - -

-When Lua loads a chunk, -the default value for its _ENV upvalue -is the global environment (see load). -Therefore, by default, -free names in Lua code refer to entries in the global environment -(and, therefore, they are also called global variables). -Moreover, all standard libraries are loaded in the global environment -and some functions there operate on that environment. -You can use load (or loadfile) -to load a chunk with a different environment. -(In C, you have to load the chunk and then change the value -of its first upvalue.) - - - - - -

2.3 – Error Handling

- -

-Because Lua is an embedded extension language, -all Lua actions start from C code in the host program -calling a function from the Lua library. -(When you use Lua standalone, -the lua application is the host program.) -Whenever an error occurs during -the compilation or execution of a Lua chunk, -control returns to the host, -which can take appropriate measures -(such as printing an error message). - - -

-Lua code can explicitly generate an error by calling the -error function. -If you need to catch errors in Lua, -you can use pcall or xpcall -to call a given function in protected mode. - - -

-Whenever there is an error, -an error object (also called an error message) -is propagated with information about the error. -Lua itself only generates errors whose error object is a string, -but programs may generate errors with -any value as the error object. -It is up to the Lua program or its host to handle such error objects. - - -

-When you use xpcall or lua_pcall, -you may give a message handler -to be called in case of errors. -This function is called with the original error message -and returns a new error message. -It is called before the error unwinds the stack, -so that it can gather more information about the error, -for instance by inspecting the stack and creating a stack traceback. -This message handler is still protected by the protected call; -so, an error inside the message handler -will call the message handler again. -If this loop goes on for too long, -Lua breaks it and returns an appropriate message. - - - - - -

2.4 – Metatables and Metamethods

- -

-Every value in Lua can have a metatable. -This metatable is an ordinary Lua table -that defines the behavior of the original value -under certain special operations. -You can change several aspects of the behavior -of operations over a value by setting specific fields in its metatable. -For instance, when a non-numeric value is the operand of an addition, -Lua checks for a function in the field "__add" of the value's metatable. -If it finds one, -Lua calls this function to perform the addition. - - -

-The keys in a metatable are derived from the event names; -the corresponding values are called metamethods. -In the previous example, the event is "add" -and the metamethod is the function that performs the addition. - - -

-You can query the metatable of any value -using the getmetatable function. - - -

-You can replace the metatable of tables -using the setmetatable function. -You cannot change the metatable of other types from Lua code -(except by using the debug library (§6.10)); -you must use the C API for that. - - -

-Tables and full userdata have individual metatables -(although multiple tables and userdata can share their metatables). -Values of all other types share one single metatable per type; -that is, there is one single metatable for all numbers, -one for all strings, etc. -By default, a value has no metatable, -but the string library sets a metatable for the string type (see §6.4). - - -

-A metatable controls how an object behaves in -arithmetic operations, bitwise operations, -order comparisons, concatenation, length operation, calls, and indexing. -A metatable also can define a function to be called -when a userdata or a table is garbage collected (§2.5). - - -

-A detailed list of events controlled by metatables is given next. -Each operation is identified by its corresponding event name. -The key for each event is a string with its name prefixed by -two underscores, '__'; -for instance, the key for operation "add" is the -string "__add". -Note that queries for metamethods are always raw; -the access to a metamethod does not invoke other metamethods. - - -

-For the unary operators (negation, length, and bitwise not), -the metamethod is computed and called with a dummy second operand, -equal to the first one. -This extra operand is only to simplify Lua's internals -(by making these operators behave like a binary operation) -and may be removed in future versions. -(For most uses this extra operand is irrelevant.) - - - -

    - -
  • "add": -the + operation. - -If any operand for an addition is not a number -(nor a string coercible to a number), -Lua will try to call a metamethod. -First, Lua will check the first operand (even if it is valid). -If that operand does not define a metamethod for the "__add" event, -then Lua will check the second operand. -If Lua can find a metamethod, -it calls the metamethod with the two operands as arguments, -and the result of the call -(adjusted to one value) -is the result of the operation. -Otherwise, -it raises an error. -
  • - -
  • "sub": -the - operation. - -Behavior similar to the "add" operation. -
  • - -
  • "mul": -the * operation. - -Behavior similar to the "add" operation. -
  • - -
  • "div": -the / operation. - -Behavior similar to the "add" operation. -
  • - -
  • "mod": -the % operation. - -Behavior similar to the "add" operation. -
  • - -
  • "pow": -the ^ (exponentiation) operation. - -Behavior similar to the "add" operation. -
  • - -
  • "unm": -the - (unary minus) operation. - -Behavior similar to the "add" operation. -
  • - -
  • "idiv": -the // (floor division) operation. - -Behavior similar to the "add" operation. -
  • - -
  • "band": -the & (bitwise and) operation. - -Behavior similar to the "add" operation, -except that Lua will try a metamethod -if any operand is neither an integer -nor a value coercible to an integer (see §3.4.3). -
  • - -
  • "bor": -the | (bitwise or) operation. - -Behavior similar to the "band" operation. -
  • - -
  • "bxor": -the ~ (bitwise exclusive or) operation. - -Behavior similar to the "band" operation. -
  • - -
  • "bnot": -the ~ (bitwise unary not) operation. - -Behavior similar to the "band" operation. -
  • - -
  • "shl": -the << (bitwise left shift) operation. - -Behavior similar to the "band" operation. -
  • - -
  • "shr": -the >> (bitwise right shift) operation. - -Behavior similar to the "band" operation. -
  • - -
  • "concat": -the .. (concatenation) operation. - -Behavior similar to the "add" operation, -except that Lua will try a metamethod -if any operand is neither a string nor a number -(which is always coercible to a string). -
  • - -
  • "len": -the # (length) operation. - -If the object is not a string, -Lua will try its metamethod. -If there is a metamethod, -Lua calls it with the object as argument, -and the result of the call -(always adjusted to one value) -is the result of the operation. -If there is no metamethod but the object is a table, -then Lua uses the table length operation (see §3.4.7). -Otherwise, Lua raises an error. -
  • - -
  • "eq": -the == (equal) operation. - -Behavior similar to the "add" operation, -except that Lua will try a metamethod only when the values -being compared are either both tables or both full userdata -and they are not primitively equal. -The result of the call is always converted to a boolean. -
  • - -
  • "lt": -the < (less than) operation. - -Behavior similar to the "add" operation, -except that Lua will try a metamethod only when the values -being compared are neither both numbers nor both strings. -The result of the call is always converted to a boolean. -
  • - -
  • "le": -the <= (less equal) operation. - -Unlike other operations, -The less-equal operation can use two different events. -First, Lua looks for the "__le" metamethod in both operands, -like in the "lt" operation. -If it cannot find such a metamethod, -then it will try the "__lt" event, -assuming that a <= b is equivalent to not (b < a). -As with the other comparison operators, -the result is always a boolean. -(This use of the "__lt" event can be removed in future versions; -it is also slower than a real "__le" metamethod.) -
  • - -
  • "index": -The indexing access table[key]. - -This event happens when table is not a table or -when key is not present in table. -The metamethod is looked up in table. - - -

    -Despite the name, -the metamethod for this event can be either a function or a table. -If it is a function, -it is called with table and key as arguments. -If it is a table, -the final result is the result of indexing this table with key. -(This indexing is regular, not raw, -and therefore can trigger another metamethod.) -

  • - -
  • "newindex": -The indexing assignment table[key] = value. - -Like the index event, -this event happens when table is not a table or -when key is not present in table. -The metamethod is looked up in table. - - -

    -Like with indexing, -the metamethod for this event can be either a function or a table. -If it is a function, -it is called with table, key, and value as arguments. -If it is a table, -Lua does an indexing assignment to this table with the same key and value. -(This assignment is regular, not raw, -and therefore can trigger another metamethod.) - - -

    -Whenever there is a "newindex" metamethod, -Lua does not perform the primitive assignment. -(If necessary, -the metamethod itself can call rawset -to do the assignment.) -

  • - -
  • "call": -The call operation func(args). - -This event happens when Lua tries to call a non-function value -(that is, func is not a function). -The metamethod is looked up in func. -If present, -the metamethod is called with func as its first argument, -followed by the arguments of the original call (args). -
  • - -
- -

-It is a good practice to add all needed metamethods to a table -before setting it as a metatable of some object. -In particular, the "__gc" metamethod works only when this order -is followed (see §2.5.1). - - - - - -

2.5 – Garbage Collection

- -

-Lua performs automatic memory management. -This means that -you do not have to worry about allocating memory for new objects -or freeing it when the objects are no longer needed. -Lua manages memory automatically by running -a garbage collector to collect all dead objects -(that is, objects that are no longer accessible from Lua). -All memory used by Lua is subject to automatic management: -strings, tables, userdata, functions, threads, internal structures, etc. - - -

-Lua implements an incremental mark-and-sweep collector. -It uses two numbers to control its garbage-collection cycles: -the garbage-collector pause and -the garbage-collector step multiplier. -Both use percentage points as units -(e.g., a value of 100 means an internal value of 1). - - -

-The garbage-collector pause -controls how long the collector waits before starting a new cycle. -Larger values make the collector less aggressive. -Values smaller than 100 mean the collector will not wait to -start a new cycle. -A value of 200 means that the collector waits for the total memory in use -to double before starting a new cycle. - - -

-The garbage-collector step multiplier -controls the relative speed of the collector relative to -memory allocation. -Larger values make the collector more aggressive but also increase -the size of each incremental step. -You should not use values smaller than 100, -because they make the collector too slow and -can result in the collector never finishing a cycle. -The default is 200, -which means that the collector runs at "twice" -the speed of memory allocation. - - -

-If you set the step multiplier to a very large number -(larger than 10% of the maximum number of -bytes that the program may use), -the collector behaves like a stop-the-world collector. -If you then set the pause to 200, -the collector behaves as in old Lua versions, -doing a complete collection every time Lua doubles its -memory usage. - - -

-You can change these numbers by calling lua_gc in C -or collectgarbage in Lua. -You can also use these functions to control -the collector directly (e.g., stop and restart it). - - - -

2.5.1 – Garbage-Collection Metamethods

- -

-You can set garbage-collector metamethods for tables -and, using the C API, -for full userdata (see §2.4). -These metamethods are also called finalizers. -Finalizers allow you to coordinate Lua's garbage collection -with external resource management -(such as closing files, network or database connections, -or freeing your own memory). - - -

-For an object (table or userdata) to be finalized when collected, -you must mark it for finalization. - -You mark an object for finalization when you set its metatable -and the metatable has a field indexed by the string "__gc". -Note that if you set a metatable without a __gc field -and later create that field in the metatable, -the object will not be marked for finalization. - - -

-When a marked object becomes garbage, -it is not collected immediately by the garbage collector. -Instead, Lua puts it in a list. -After the collection, -Lua goes through that list. -For each object in the list, -it checks the object's __gc metamethod: -If it is a function, -Lua calls it with the object as its single argument; -if the metamethod is not a function, -Lua simply ignores it. - - -

-At the end of each garbage-collection cycle, -the finalizers for objects are called in -the reverse order that the objects were marked for finalization, -among those collected in that cycle; -that is, the first finalizer to be called is the one associated -with the object marked last in the program. -The execution of each finalizer may occur at any point during -the execution of the regular code. - - -

-Because the object being collected must still be used by the finalizer, -that object (and other objects accessible only through it) -must be resurrected by Lua. -Usually, this resurrection is transient, -and the object memory is freed in the next garbage-collection cycle. -However, if the finalizer stores the object in some global place -(e.g., a global variable), -then the resurrection is permanent. -Moreover, if the finalizer marks a finalizing object for finalization again, -its finalizer will be called again in the next cycle where the -object is unreachable. -In any case, -the object memory is freed only in a GC cycle where -the object is unreachable and not marked for finalization. - - -

-When you close a state (see lua_close), -Lua calls the finalizers of all objects marked for finalization, -following the reverse order that they were marked. -If any finalizer marks objects for collection during that phase, -these marks have no effect. - - - - - -

2.5.2 – Weak Tables

- -

-A weak table is a table whose elements are -weak references. -A weak reference is ignored by the garbage collector. -In other words, -if the only references to an object are weak references, -then the garbage collector will collect that object. - - -

-A weak table can have weak keys, weak values, or both. -A table with weak values allows the collection of its values, -but prevents the collection of its keys. -A table with both weak keys and weak values allows the collection of -both keys and values. -In any case, if either the key or the value is collected, -the whole pair is removed from the table. -The weakness of a table is controlled by the -__mode field of its metatable. -If the __mode field is a string containing the character 'k', -the keys in the table are weak. -If __mode contains 'v', -the values in the table are weak. - - -

-A table with weak keys and strong values -is also called an ephemeron table. -In an ephemeron table, -a value is considered reachable only if its key is reachable. -In particular, -if the only reference to a key comes through its value, -the pair is removed. - - -

-Any change in the weakness of a table may take effect only -at the next collect cycle. -In particular, if you change the weakness to a stronger mode, -Lua may still collect some items from that table -before the change takes effect. - - -

-Only objects that have an explicit construction -are removed from weak tables. -Values, such as numbers and light C functions, -are not subject to garbage collection, -and therefore are not removed from weak tables -(unless their associated values are collected). -Although strings are subject to garbage collection, -they do not have an explicit construction, -and therefore are not removed from weak tables. - - -

-Resurrected objects -(that is, objects being finalized -and objects accessible only through objects being finalized) -have a special behavior in weak tables. -They are removed from weak values before running their finalizers, -but are removed from weak keys only in the next collection -after running their finalizers, when such objects are actually freed. -This behavior allows the finalizer to access properties -associated with the object through weak tables. - - -

-If a weak table is among the resurrected objects in a collection cycle, -it may not be properly cleared until the next cycle. - - - - - - - -

2.6 – Coroutines

- -

-Lua supports coroutines, -also called collaborative multithreading. -A coroutine in Lua represents an independent thread of execution. -Unlike threads in multithread systems, however, -a coroutine only suspends its execution by explicitly calling -a yield function. - - -

-You create a coroutine by calling coroutine.create. -Its sole argument is a function -that is the main function of the coroutine. -The create function only creates a new coroutine and -returns a handle to it (an object of type thread); -it does not start the coroutine. - - -

-You execute a coroutine by calling coroutine.resume. -When you first call coroutine.resume, -passing as its first argument -a thread returned by coroutine.create, -the coroutine starts its execution by -calling its main function. -Extra arguments passed to coroutine.resume are passed -as arguments to that function. -After the coroutine starts running, -it runs until it terminates or yields. - - -

-A coroutine can terminate its execution in two ways: -normally, when its main function returns -(explicitly or implicitly, after the last instruction); -and abnormally, if there is an unprotected error. -In case of normal termination, -coroutine.resume returns true, -plus any values returned by the coroutine main function. -In case of errors, coroutine.resume returns false -plus an error message. - - -

-A coroutine yields by calling coroutine.yield. -When a coroutine yields, -the corresponding coroutine.resume returns immediately, -even if the yield happens inside nested function calls -(that is, not in the main function, -but in a function directly or indirectly called by the main function). -In the case of a yield, coroutine.resume also returns true, -plus any values passed to coroutine.yield. -The next time you resume the same coroutine, -it continues its execution from the point where it yielded, -with the call to coroutine.yield returning any extra -arguments passed to coroutine.resume. - - -

-Like coroutine.create, -the coroutine.wrap function also creates a coroutine, -but instead of returning the coroutine itself, -it returns a function that, when called, resumes the coroutine. -Any arguments passed to this function -go as extra arguments to coroutine.resume. -coroutine.wrap returns all the values returned by coroutine.resume, -except the first one (the boolean error code). -Unlike coroutine.resume, -coroutine.wrap does not catch errors; -any error is propagated to the caller. - - -

-As an example of how coroutines work, -consider the following code: - -

-     function foo (a)
-       print("foo", a)
-       return coroutine.yield(2*a)
-     end
-     
-     co = coroutine.create(function (a,b)
-           print("co-body", a, b)
-           local r = foo(a+1)
-           print("co-body", r)
-           local r, s = coroutine.yield(a+b, a-b)
-           print("co-body", r, s)
-           return b, "end"
-     end)
-     
-     print("main", coroutine.resume(co, 1, 10))
-     print("main", coroutine.resume(co, "r"))
-     print("main", coroutine.resume(co, "x", "y"))
-     print("main", coroutine.resume(co, "x", "y"))
-

-When you run it, it produces the following output: - -

-     co-body 1       10
-     foo     2
-     main    true    4
-     co-body r
-     main    true    11      -9
-     co-body x       y
-     main    true    10      end
-     main    false   cannot resume dead coroutine
-
- -

-You can also create and manipulate coroutines through the C API: -see functions lua_newthread, lua_resume, -and lua_yield. - - - - - -

3 – The Language

- -

-This section describes the lexis, the syntax, and the semantics of Lua. -In other words, -this section describes -which tokens are valid, -how they can be combined, -and what their combinations mean. - - -

-Language constructs will be explained using the usual extended BNF notation, -in which -{a} means 0 or more a's, and -[a] means an optional a. -Non-terminals are shown like non-terminal, -keywords are shown like kword, -and other terminal symbols are shown like ‘=’. -The complete syntax of Lua can be found in §9 -at the end of this manual. - - - -

3.1 – Lexical Conventions

- -

-Lua is a free-form language. -It ignores spaces (including new lines) and comments -between lexical elements (tokens), -except as delimiters between names and keywords. - - -

-Names -(also called identifiers) -in Lua can be any string of letters, -digits, and underscores, -not beginning with a digit. -Identifiers are used to name variables, table fields, and labels. - - -

-The following keywords are reserved -and cannot be used as names: - - -

-     and       break     do        else      elseif    end
-     false     for       function  goto      if        in
-     local     nil       not       or        repeat    return
-     then      true      until     while
-
- -

-Lua is a case-sensitive language: -and is a reserved word, but And and AND -are two different, valid names. -As a convention, -programs should avoid creating -names that start with an underscore followed by -one or more uppercase letters (such as _VERSION). - - -

-The following strings denote other tokens: - -

-     +     -     *     /     %     ^     #
-     &     ~     |     <<    >>    //
-     ==    ~=    <=    >=    <     >     =
-     (     )     {     }     [     ]     ::
-     ;     :     ,     .     ..    ...
-
- -

-Literal strings -can be delimited by matching single or double quotes, -and can contain the following C-like escape sequences: -'\a' (bell), -'\b' (backspace), -'\f' (form feed), -'\n' (newline), -'\r' (carriage return), -'\t' (horizontal tab), -'\v' (vertical tab), -'\\' (backslash), -'\"' (quotation mark [double quote]), -and '\'' (apostrophe [single quote]). -A backslash followed by a real newline -results in a newline in the string. -The escape sequence '\z' skips the following span -of white-space characters, -including line breaks; -it is particularly useful to break and indent a long literal string -into multiple lines without adding the newlines and spaces -into the string contents. - - -

-Strings in Lua can contain any 8-bit value, including embedded zeros, -which can be specified as '\0'. -More generally, -we can specify any byte in a literal string by its numeric value. -This can be done -with the escape sequence \xXX, -where XX is a sequence of exactly two hexadecimal digits, -or with the escape sequence \ddd, -where ddd is a sequence of up to three decimal digits. -(Note that if a decimal escape sequence is to be followed by a digit, -it must be expressed using exactly three digits.) - - -

-The UTF-8 encoding of a Unicode character -can be inserted in a literal string with -the escape sequence \u{XXX} -(note the mandatory enclosing brackets), -where XXX is a sequence of one or more hexadecimal digits -representing the character code point. - - -

-Literal strings can also be defined using a long format -enclosed by long brackets. -We define an opening long bracket of level n as an opening -square bracket followed by n equal signs followed by another -opening square bracket. -So, an opening long bracket of level 0 is written as [[, -an opening long bracket of level 1 is written as [=[, -and so on. -A closing long bracket is defined similarly; -for instance, -a closing long bracket of level 4 is written as ]====]. -A long literal starts with an opening long bracket of any level and -ends at the first closing long bracket of the same level. -It can contain any text except a closing bracket of the same level. -Literals in this bracketed form can run for several lines, -do not interpret any escape sequences, -and ignore long brackets of any other level. -Any kind of end-of-line sequence -(carriage return, newline, carriage return followed by newline, -or newline followed by carriage return) -is converted to a simple newline. - - -

-Any byte in a literal string not -explicitly affected by the previous rules represents itself. -However, Lua opens files for parsing in text mode, -and the system file functions may have problems with -some control characters. -So, it is safer to represent -non-text data as a quoted literal with -explicit escape sequences for non-text characters. - - -

-For convenience, -when the opening long bracket is immediately followed by a newline, -the newline is not included in the string. -As an example, in a system using ASCII -(in which 'a' is coded as 97, -newline is coded as 10, and '1' is coded as 49), -the five literal strings below denote the same string: - -

-     a = 'alo\n123"'
-     a = "alo\n123\""
-     a = '\97lo\10\04923"'
-     a = [[alo
-     123"]]
-     a = [==[
-     alo
-     123"]==]
-
- -

-A numeric constant (or numeral) -can be written with an optional fractional part -and an optional decimal exponent, -marked by a letter 'e' or 'E'. -Lua also accepts hexadecimal constants, -which start with 0x or 0X. -Hexadecimal constants also accept an optional fractional part -plus an optional binary exponent, -marked by a letter 'p' or 'P'. -A numeric constant with a fractional dot or an exponent -denotes a float; -otherwise it denotes an integer. -Examples of valid integer constants are - -

-     3   345   0xff   0xBEBADA
-

-Examples of valid float constants are - -

-     3.0     3.1416     314.16e-2     0.31416E1     34e1
-     0x0.1E  0xA23p-4   0X1.921FB54442D18P+1
-
- -

-A comment starts with a double hyphen (--) -anywhere outside a string. -If the text immediately after -- is not an opening long bracket, -the comment is a short comment, -which runs until the end of the line. -Otherwise, it is a long comment, -which runs until the corresponding closing long bracket. -Long comments are frequently used to disable code temporarily. - - - - - -

3.2 – Variables

- -

-Variables are places that store values. -There are three kinds of variables in Lua: -global variables, local variables, and table fields. - - -

-A single name can denote a global variable or a local variable -(or a function's formal parameter, -which is a particular kind of local variable): - -

-	var ::= Name
-

-Name denotes identifiers, as defined in §3.1. - - -

-Any variable name is assumed to be global unless explicitly declared -as a local (see §3.3.7). -Local variables are lexically scoped: -local variables can be freely accessed by functions -defined inside their scope (see §3.5). - - -

-Before the first assignment to a variable, its value is nil. - - -

-Square brackets are used to index a table: - -

-	var ::= prefixexp ‘[’ exp ‘]’
-

-The meaning of accesses to table fields can be changed via metatables. -An access to an indexed variable t[i] is equivalent to -a call gettable_event(t,i). -(See §2.4 for a complete description of the -gettable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) - - -

-The syntax var.Name is just syntactic sugar for -var["Name"]: - -

-	var ::= prefixexp ‘.’ Name
-
- -

-An access to a global variable x -is equivalent to _ENV.x. -Due to the way that chunks are compiled, -_ENV is never a global name (see §2.2). - - - - - -

3.3 – Statements

- -

-Lua supports an almost conventional set of statements, -similar to those in Pascal or C. -This set includes -assignments, control structures, function calls, -and variable declarations. - - - -

3.3.1 – Blocks

- -

-A block is a list of statements, -which are executed sequentially: - -

-	block ::= {stat}
-

-Lua has empty statements -that allow you to separate statements with semicolons, -start a block with a semicolon -or write two semicolons in sequence: - -

-	stat ::= ‘;’
-
- -

-Function calls and assignments -can start with an open parenthesis. -This possibility leads to an ambiguity in Lua's grammar. -Consider the following fragment: - -

-     a = b + c
-     (print or io.write)('done')
-

-The grammar could see it in two ways: - -

-     a = b + c(print or io.write)('done')
-     
-     a = b + c; (print or io.write)('done')
-

-The current parser always sees such constructions -in the first way, -interpreting the open parenthesis -as the start of the arguments to a call. -To avoid this ambiguity, -it is a good practice to always precede with a semicolon -statements that start with a parenthesis: - -

-     ;(print or io.write)('done')
-
- -

-A block can be explicitly delimited to produce a single statement: - -

-	stat ::= do block end
-

-Explicit blocks are useful -to control the scope of variable declarations. -Explicit blocks are also sometimes used to -add a return statement in the middle -of another block (see §3.3.4). - - - - - -

3.3.2 – Chunks

- -

-The unit of compilation of Lua is called a chunk. -Syntactically, -a chunk is simply a block: - -

-	chunk ::= block
-
- -

-Lua handles a chunk as the body of an anonymous function -with a variable number of arguments -(see §3.4.11). -As such, chunks can define local variables, -receive arguments, and return values. -Moreover, such anonymous function is compiled as in the -scope of an external local variable called _ENV (see §2.2). -The resulting function always has _ENV as its only upvalue, -even if it does not use that variable. - - -

-A chunk can be stored in a file or in a string inside the host program. -To execute a chunk, -Lua first loads it, -precompiling the chunk's code into instructions for a virtual machine, -and then Lua executes the compiled code -with an interpreter for the virtual machine. - - -

-Chunks can also be precompiled into binary form; -see program luac and function string.dump for details. -Programs in source and compiled forms are interchangeable; -Lua automatically detects the file type and acts accordingly (see load). - - - - - -

3.3.3 – Assignment

- -

-Lua allows multiple assignments. -Therefore, the syntax for assignment -defines a list of variables on the left side -and a list of expressions on the right side. -The elements in both lists are separated by commas: - -

-	stat ::= varlist ‘=’ explist
-	varlist ::= var {‘,’ var}
-	explist ::= exp {‘,’ exp}
-

-Expressions are discussed in §3.4. - - -

-Before the assignment, -the list of values is adjusted to the length of -the list of variables. -If there are more values than needed, -the excess values are thrown away. -If there are fewer values than needed, -the list is extended with as many nil's as needed. -If the list of expressions ends with a function call, -then all values returned by that call enter the list of values, -before the adjustment -(except when the call is enclosed in parentheses; see §3.4). - - -

-The assignment statement first evaluates all its expressions -and only then the assignments are performed. -Thus the code - -

-     i = 3
-     i, a[i] = i+1, 20
-

-sets a[3] to 20, without affecting a[4] -because the i in a[i] is evaluated (to 3) -before it is assigned 4. -Similarly, the line - -

-     x, y = y, x
-

-exchanges the values of x and y, -and - -

-     x, y, z = y, z, x
-

-cyclically permutes the values of x, y, and z. - - -

-The meaning of assignments to global variables -and table fields can be changed via metatables. -An assignment to an indexed variable t[i] = val is equivalent to -settable_event(t,i,val). -(See §2.4 for a complete description of the -settable_event function. -This function is not defined or callable in Lua. -We use it here only for explanatory purposes.) - - -

-An assignment to a global name x = val -is equivalent to the assignment -_ENV.x = val (see §2.2). - - - - - -

3.3.4 – Control Structures

-The control structures -if, while, and repeat have the usual meaning and -familiar syntax: - - - - -

-	stat ::= while exp do block end
-	stat ::= repeat block until exp
-	stat ::= if exp then block {elseif exp then block} [else block] end
-

-Lua also has a for statement, in two flavors (see §3.3.5). - - -

-The condition expression of a -control structure can return any value. -Both false and nil are considered false. -All values different from nil and false are considered true -(in particular, the number 0 and the empty string are also true). - - -

-In the repeatuntil loop, -the inner block does not end at the until keyword, -but only after the condition. -So, the condition can refer to local variables -declared inside the loop block. - - -

-The goto statement transfers the program control to a label. -For syntactical reasons, -labels in Lua are considered statements too: - - - -

-	stat ::= goto Name
-	stat ::= label
-	label ::= ‘::’ Name ‘::’
-
- -

-A label is visible in the entire block where it is defined, -except -inside nested blocks where a label with the same name is defined and -inside nested functions. -A goto may jump to any visible label as long as it does not -enter into the scope of a local variable. - - -

-Labels and empty statements are called void statements, -as they perform no actions. - - -

-The break statement terminates the execution of a -while, repeat, or for loop, -skipping to the next statement after the loop: - - -

-	stat ::= break
-

-A break ends the innermost enclosing loop. - - -

-The return statement is used to return values -from a function or a chunk -(which is an anonymous function). - -Functions can return more than one value, -so the syntax for the return statement is - -

-	stat ::= return [explist] [‘;’]
-
- -

-The return statement can only be written -as the last statement of a block. -If it is really necessary to return in the middle of a block, -then an explicit inner block can be used, -as in the idiom do return end, -because now return is the last statement in its (inner) block. - - - - - -

3.3.5 – For Statement

- -

- -The for statement has two forms: -one numerical and one generic. - - -

-The numerical for loop repeats a block of code while a -control variable runs through an arithmetic progression. -It has the following syntax: - -

-	stat ::= for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end
-

-The block is repeated for name starting at the value of -the first exp, until it passes the second exp by steps of the -third exp. -More precisely, a for statement like - -

-     for v = e1, e2, e3 do block end
-

-is equivalent to the code: - -

-     do
-       local var, limit, step = tonumber(e1), tonumber(e2), tonumber(e3)
-       if not (var and limit and step) then error() end
-       var = var - step
-       while true do
-         var = var + step
-         if (step >= 0 and var > limit) or (step < 0 and var < limit) then
-           break
-         end
-         local v = var
-         block
-       end
-     end
-
- -

-Note the following: - -

    - -
  • -All three control expressions are evaluated only once, -before the loop starts. -They must all result in numbers. -
  • - -
  • -var, limit, and step are invisible variables. -The names shown here are for explanatory purposes only. -
  • - -
  • -If the third expression (the step) is absent, -then a step of 1 is used. -
  • - -
  • -You can use break and goto to exit a for loop. -
  • - -
  • -The loop variable v is local to the loop body. -If you need its value after the loop, -assign it to another variable before exiting the loop. -
  • - -
- -

-The generic for statement works over functions, -called iterators. -On each iteration, the iterator function is called to produce a new value, -stopping when this new value is nil. -The generic for loop has the following syntax: - -

-	stat ::= for namelist in explist do block end
-	namelist ::= Name {‘,’ Name}
-

-A for statement like - -

-     for var_1, ···, var_n in explist do block end
-

-is equivalent to the code: - -

-     do
-       local f, s, var = explist
-       while true do
-         local var_1, ···, var_n = f(s, var)
-         if var_1 == nil then break end
-         var = var_1
-         block
-       end
-     end
-

-Note the following: - -

    - -
  • -explist is evaluated only once. -Its results are an iterator function, -a state, -and an initial value for the first iterator variable. -
  • - -
  • -f, s, and var are invisible variables. -The names are here for explanatory purposes only. -
  • - -
  • -You can use break to exit a for loop. -
  • - -
  • -The loop variables var_i are local to the loop; -you cannot use their values after the for ends. -If you need these values, -then assign them to other variables before breaking or exiting the loop. -
  • - -
- - - - -

3.3.6 – Function Calls as Statements

-To allow possible side-effects, -function calls can be executed as statements: - -

-	stat ::= functioncall
-

-In this case, all returned values are thrown away. -Function calls are explained in §3.4.10. - - - - - -

3.3.7 – Local Declarations

-Local variables can be declared anywhere inside a block. -The declaration can include an initial assignment: - -

-	stat ::= local namelist [‘=’ explist]
-

-If present, an initial assignment has the same semantics -of a multiple assignment (see §3.3.3). -Otherwise, all variables are initialized with nil. - - -

-A chunk is also a block (see §3.3.2), -and so local variables can be declared in a chunk outside any explicit block. - - -

-The visibility rules for local variables are explained in §3.5. - - - - - - - -

3.4 – Expressions

- -

-The basic expressions in Lua are the following: - -

-	exp ::= prefixexp
-	exp ::= nil | false | true
-	exp ::= Numeral
-	exp ::= LiteralString
-	exp ::= functiondef
-	exp ::= tableconstructor
-	exp ::= ‘...’
-	exp ::= exp binop exp
-	exp ::= unop exp
-	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
-
- -

-Numerals and literal strings are explained in §3.1; -variables are explained in §3.2; -function definitions are explained in §3.4.11; -function calls are explained in §3.4.10; -table constructors are explained in §3.4.9. -Vararg expressions, -denoted by three dots ('...'), can only be used when -directly inside a vararg function; -they are explained in §3.4.11. - - -

-Binary operators comprise arithmetic operators (see §3.4.1), -bitwise operators (see §3.4.2), -relational operators (see §3.4.4), logical operators (see §3.4.5), -and the concatenation operator (see §3.4.6). -Unary operators comprise the unary minus (see §3.4.1), -the unary bitwise not (see §3.4.2), -the unary logical not (see §3.4.5), -and the unary length operator (see §3.4.7). - - -

-Both function calls and vararg expressions can result in multiple values. -If a function call is used as a statement (see §3.3.6), -then its return list is adjusted to zero elements, -thus discarding all returned values. -If an expression is used as the last (or the only) element -of a list of expressions, -then no adjustment is made -(unless the expression is enclosed in parentheses). -In all other contexts, -Lua adjusts the result list to one element, -either discarding all values except the first one -or adding a single nil if there are no values. - - -

-Here are some examples: - -

-     f()                -- adjusted to 0 results
-     g(f(), x)          -- f() is adjusted to 1 result
-     g(x, f())          -- g gets x plus all results from f()
-     a,b,c = f(), x     -- f() is adjusted to 1 result (c gets nil)
-     a,b = ...          -- a gets the first vararg parameter, b gets
-                        -- the second (both a and b can get nil if there
-                        -- is no corresponding vararg parameter)
-     
-     a,b,c = x, f()     -- f() is adjusted to 2 results
-     a,b,c = f()        -- f() is adjusted to 3 results
-     return f()         -- returns all results from f()
-     return ...         -- returns all received vararg parameters
-     return x,y,f()     -- returns x, y, and all results from f()
-     {f()}              -- creates a list with all results from f()
-     {...}              -- creates a list with all vararg parameters
-     {f(), nil}         -- f() is adjusted to 1 result
-
- -

-Any expression enclosed in parentheses always results in only one value. -Thus, -(f(x,y,z)) is always a single value, -even if f returns several values. -(The value of (f(x,y,z)) is the first value returned by f -or nil if f does not return any values.) - - - -

3.4.1 – Arithmetic Operators

-Lua supports the following arithmetic operators: - -

    -
  • +: addition
  • -
  • -: subtraction
  • -
  • *: multiplication
  • -
  • /: float division
  • -
  • //: floor division
  • -
  • %: modulo
  • -
  • ^: exponentiation
  • -
  • -: unary minus
  • -
- -

-With the exception of exponentiation and float division, -the arithmetic operators work as follows: -If both operands are integers, -the operation is performed over integers and the result is an integer. -Otherwise, if both operands are numbers -or strings that can be converted to -numbers (see §3.4.3), -then they are converted to floats, -the operation is performed following the usual rules -for floating-point arithmetic -(usually the IEEE 754 standard), -and the result is a float. - - -

-Exponentiation and float division (/) -always convert their operands to floats -and the result is always a float. -Exponentiation uses the ISO C function pow, -so that it works for non-integer exponents too. - - -

-Floor division (//) is a division -that rounds the quotient towards minus infinity, -that is, the floor of the division of its operands. - - -

-Modulo is defined as the remainder of a division -that rounds the quotient towards minus infinity (floor division). - - -

-In case of overflows in integer arithmetic, -all operations wrap around, -according to the usual rules of two-complement arithmetic. -(In other words, -they return the unique representable integer -that is equal modulo 264 to the mathematical result.) - - - -

3.4.2 – Bitwise Operators

-Lua supports the following bitwise operators: - -

    -
  • &: bitwise and
  • -
  • |: bitwise or
  • -
  • ~: bitwise exclusive or
  • -
  • >>: right shift
  • -
  • <<: left shift
  • -
  • ~: unary bitwise not
  • -
- -

-All bitwise operations convert its operands to integers -(see §3.4.3), -operate on all bits of those integers, -and result in an integer. - - -

-Both right and left shifts fill the vacant bits with zeros. -Negative displacements shift to the other direction; -displacements with absolute values equal to or higher than -the number of bits in an integer -result in zero (as all bits are shifted out). - - - - - -

3.4.3 – Coercions and Conversions

-Lua provides some automatic conversions between some -types and representations at run time. -Bitwise operators always convert float operands to integers. -Exponentiation and float division -always convert integer operands to floats. -All other arithmetic operations applied to mixed numbers -(integers and floats) convert the integer operand to a float; -this is called the usual rule. -The C API also converts both integers to floats and -floats to integers, as needed. -Moreover, string concatenation accepts numbers as arguments, -besides strings. - - -

-Lua also converts strings to numbers, -whenever a number is expected. - - -

-In a conversion from integer to float, -if the integer value has an exact representation as a float, -that is the result. -Otherwise, -the conversion gets the nearest higher or -the nearest lower representable value. -This kind of conversion never fails. - - -

-The conversion from float to integer -checks whether the float has an exact representation as an integer -(that is, the float has an integral value and -it is in the range of integer representation). -If it does, that representation is the result. -Otherwise, the conversion fails. - - -

-The conversion from strings to numbers goes as follows: -First, the string is converted to an integer or a float, -following its syntax and the rules of the Lua lexer. -(The string may have also leading and trailing spaces and a sign.) -Then, the resulting number (float or integer) -is converted to the type (float or integer) required by the context -(e.g., the operation that forced the conversion). - - -

-The conversion from numbers to strings uses a -non-specified human-readable format. -For complete control over how numbers are converted to strings, -use the format function from the string library -(see string.format). - - - - - -

3.4.4 – Relational Operators

-Lua supports the following relational operators: - -

    -
  • ==: equality
  • -
  • ~=: inequality
  • -
  • <: less than
  • -
  • >: greater than
  • -
  • <=: less or equal
  • -
  • >=: greater or equal
  • -

-These operators always result in false or true. - - -

-Equality (==) first compares the type of its operands. -If the types are different, then the result is false. -Otherwise, the values of the operands are compared. -Strings are compared in the obvious way. -Numbers are equal if they denote the same mathematical value. - - -

-Tables, userdata, and threads -are compared by reference: -two objects are considered equal only if they are the same object. -Every time you create a new object -(a table, userdata, or thread), -this new object is different from any previously existing object. -Closures with the same reference are always equal. -Closures with any detectable difference -(different behavior, different definition) are always different. - - -

-You can change the way that Lua compares tables and userdata -by using the "eq" metamethod (see §2.4). - - -

-Equality comparisons do not convert strings to numbers -or vice versa. -Thus, "0"==0 evaluates to false, -and t[0] and t["0"] denote different -entries in a table. - - -

-The operator ~= is exactly the negation of equality (==). - - -

-The order operators work as follows. -If both arguments are numbers, -then they are compared according to their mathematical values -(regardless of their subtypes). -Otherwise, if both arguments are strings, -then their values are compared according to the current locale. -Otherwise, Lua tries to call the "lt" or the "le" -metamethod (see §2.4). -A comparison a > b is translated to b < a -and a >= b is translated to b <= a. - - -

-Following the IEEE 754 standard, -NaN is considered neither smaller than, -nor equal to, nor greater than any value (including itself). - - - - - -

3.4.5 – Logical Operators

-The logical operators in Lua are -and, or, and not. -Like the control structures (see §3.3.4), -all logical operators consider both false and nil as false -and anything else as true. - - -

-The negation operator not always returns false or true. -The conjunction operator and returns its first argument -if this value is false or nil; -otherwise, and returns its second argument. -The disjunction operator or returns its first argument -if this value is different from nil and false; -otherwise, or returns its second argument. -Both and and or use short-circuit evaluation; -that is, -the second operand is evaluated only if necessary. -Here are some examples: - -

-     10 or 20            --> 10
-     10 or error()       --> 10
-     nil or "a"          --> "a"
-     nil and 10          --> nil
-     false and error()   --> false
-     false and nil       --> false
-     false or nil        --> nil
-     10 and 20           --> 20
-

-(In this manual, ---> indicates the result of the preceding expression.) - - - - - -

3.4.6 – Concatenation

-The string concatenation operator in Lua is -denoted by two dots ('..'). -If both operands are strings or numbers, then they are converted to -strings according to the rules described in §3.4.3. -Otherwise, the __concat metamethod is called (see §2.4). - - - - - -

3.4.7 – The Length Operator

- -

-The length operator is denoted by the unary prefix operator #. -The length of a string is its number of bytes -(that is, the usual meaning of string length when each -character is one byte). - - -

-A program can modify the behavior of the length operator for -any value but strings through the __len metamethod (see §2.4). - - -

-Unless a __len metamethod is given, -the length of a table t is only defined if the -table is a sequence, -that is, -the set of its positive numeric keys is equal to {1..n} -for some non-negative integer n. -In that case, n is its length. -Note that a table like - -

-     {10, 20, nil, 40}
-

-is not a sequence, because it has the key 4 -but does not have the key 3. -(So, there is no n such that the set {1..n} is equal -to the set of positive numeric keys of that table.) -Note, however, that non-numeric keys do not interfere -with whether a table is a sequence. - - - - - -

3.4.8 – Precedence

-Operator precedence in Lua follows the table below, -from lower to higher priority: - -

-     or
-     and
-     <     >     <=    >=    ~=    ==
-     |
-     ~
-     &
-     <<    >>
-     ..
-     +     -
-     *     /     //    %
-     unary operators (not   #     -     ~)
-     ^
-

-As usual, -you can use parentheses to change the precedences of an expression. -The concatenation ('..') and exponentiation ('^') -operators are right associative. -All other binary operators are left associative. - - - - - -

3.4.9 – Table Constructors

-Table constructors are expressions that create tables. -Every time a constructor is evaluated, a new table is created. -A constructor can be used to create an empty table -or to create a table and initialize some of its fields. -The general syntax for constructors is - -

-	tableconstructor ::= ‘{’ [fieldlist] ‘}’
-	fieldlist ::= field {fieldsep field} [fieldsep]
-	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
-	fieldsep ::= ‘,’ | ‘;’
-
- -

-Each field of the form [exp1] = exp2 adds to the new table an entry -with key exp1 and value exp2. -A field of the form name = exp is equivalent to -["name"] = exp. -Finally, fields of the form exp are equivalent to -[i] = exp, where i are consecutive integers -starting with 1. -Fields in the other formats do not affect this counting. -For example, - -

-     a = { [f(1)] = g; "x", "y"; x = 1, f(x), [30] = 23; 45 }
-

-is equivalent to - -

-     do
-       local t = {}
-       t[f(1)] = g
-       t[1] = "x"         -- 1st exp
-       t[2] = "y"         -- 2nd exp
-       t.x = 1            -- t["x"] = 1
-       t[3] = f(x)        -- 3rd exp
-       t[30] = 23
-       t[4] = 45          -- 4th exp
-       a = t
-     end
-
- -

-The order of the assignments in a constructor is undefined. -(This order would be relevant only when there are repeated keys.) - - -

-If the last field in the list has the form exp -and the expression is a function call or a vararg expression, -then all values returned by this expression enter the list consecutively -(see §3.4.10). - - -

-The field list can have an optional trailing separator, -as a convenience for machine-generated code. - - - - - -

3.4.10 – Function Calls

-A function call in Lua has the following syntax: - -

-	functioncall ::= prefixexp args
-

-In a function call, -first prefixexp and args are evaluated. -If the value of prefixexp has type function, -then this function is called -with the given arguments. -Otherwise, the prefixexp "call" metamethod is called, -having as first parameter the value of prefixexp, -followed by the original call arguments -(see §2.4). - - -

-The form - -

-	functioncall ::= prefixexp ‘:’ Name args
-

-can be used to call "methods". -A call v:name(args) -is syntactic sugar for v.name(v,args), -except that v is evaluated only once. - - -

-Arguments have the following syntax: - -

-	args ::= ‘(’ [explist] ‘)’
-	args ::= tableconstructor
-	args ::= LiteralString
-

-All argument expressions are evaluated before the call. -A call of the form f{fields} is -syntactic sugar for f({fields}); -that is, the argument list is a single new table. -A call of the form f'string' -(or f"string" or f[[string]]) -is syntactic sugar for f('string'); -that is, the argument list is a single literal string. - - -

-A call of the form return functioncall is called -a tail call. -Lua implements proper tail calls -(or proper tail recursion): -in a tail call, -the called function reuses the stack entry of the calling function. -Therefore, there is no limit on the number of nested tail calls that -a program can execute. -However, a tail call erases any debug information about the -calling function. -Note that a tail call only happens with a particular syntax, -where the return has one single function call as argument; -this syntax makes the calling function return exactly -the returns of the called function. -So, none of the following examples are tail calls: - -

-     return (f(x))        -- results adjusted to 1
-     return 2 * f(x)
-     return x, f(x)       -- additional results
-     f(x); return         -- results discarded
-     return x or f(x)     -- results adjusted to 1
-
- - - - -

3.4.11 – Function Definitions

- -

-The syntax for function definition is - -

-	functiondef ::= function funcbody
-	funcbody ::= ‘(’ [parlist] ‘)’ block end
-
- -

-The following syntactic sugar simplifies function definitions: - -

-	stat ::= function funcname funcbody
-	stat ::= local function Name funcbody
-	funcname ::= Name {‘.’ Name} [‘:’ Name]
-

-The statement - -

-     function f () body end
-

-translates to - -

-     f = function () body end
-

-The statement - -

-     function t.a.b.c.f () body end
-

-translates to - -

-     t.a.b.c.f = function () body end
-

-The statement - -

-     local function f () body end
-

-translates to - -

-     local f; f = function () body end
-

-not to - -

-     local f = function () body end
-

-(This only makes a difference when the body of the function -contains references to f.) - - -

-A function definition is an executable expression, -whose value has type function. -When Lua precompiles a chunk, -all its function bodies are precompiled too. -Then, whenever Lua executes the function definition, -the function is instantiated (or closed). -This function instance (or closure) -is the final value of the expression. - - -

-Parameters act as local variables that are -initialized with the argument values: - -

-	parlist ::= namelist [‘,’ ‘...’] | ‘...’
-

-When a function is called, -the list of arguments is adjusted to -the length of the list of parameters, -unless the function is a vararg function, -which is indicated by three dots ('...') -at the end of its parameter list. -A vararg function does not adjust its argument list; -instead, it collects all extra arguments and supplies them -to the function through a vararg expression, -which is also written as three dots. -The value of this expression is a list of all actual extra arguments, -similar to a function with multiple results. -If a vararg expression is used inside another expression -or in the middle of a list of expressions, -then its return list is adjusted to one element. -If the expression is used as the last element of a list of expressions, -then no adjustment is made -(unless that last expression is enclosed in parentheses). - - -

-As an example, consider the following definitions: - -

-     function f(a, b) end
-     function g(a, b, ...) end
-     function r() return 1,2,3 end
-

-Then, we have the following mapping from arguments to parameters and -to the vararg expression: - -

-     CALL            PARAMETERS
-     
-     f(3)             a=3, b=nil
-     f(3, 4)          a=3, b=4
-     f(3, 4, 5)       a=3, b=4
-     f(r(), 10)       a=1, b=10
-     f(r())           a=1, b=2
-     
-     g(3)             a=3, b=nil, ... -->  (nothing)
-     g(3, 4)          a=3, b=4,   ... -->  (nothing)
-     g(3, 4, 5, 8)    a=3, b=4,   ... -->  5  8
-     g(5, r())        a=5, b=1,   ... -->  2  3
-
- -

-Results are returned using the return statement (see §3.3.4). -If control reaches the end of a function -without encountering a return statement, -then the function returns with no results. - - -

- -There is a system-dependent limit on the number of values -that a function may return. -This limit is guaranteed to be larger than 1000. - - -

-The colon syntax -is used for defining methods, -that is, functions that have an implicit extra parameter self. -Thus, the statement - -

-     function t.a.b.c:f (params) body end
-

-is syntactic sugar for - -

-     t.a.b.c.f = function (self, params) body end
-
- - - - - - -

3.5 – Visibility Rules

- -

- -Lua is a lexically scoped language. -The scope of a local variable begins at the first statement after -its declaration and lasts until the last non-void statement -of the innermost block that includes the declaration. -Consider the following example: - -

-     x = 10                -- global variable
-     do                    -- new block
-       local x = x         -- new 'x', with value 10
-       print(x)            --> 10
-       x = x+1
-       do                  -- another block
-         local x = x+1     -- another 'x'
-         print(x)          --> 12
-       end
-       print(x)            --> 11
-     end
-     print(x)              --> 10  (the global one)
-
- -

-Notice that, in a declaration like local x = x, -the new x being declared is not in scope yet, -and so the second x refers to the outside variable. - - -

-Because of the lexical scoping rules, -local variables can be freely accessed by functions -defined inside their scope. -A local variable used by an inner function is called -an upvalue, or external local variable, -inside the inner function. - - -

-Notice that each execution of a local statement -defines new local variables. -Consider the following example: - -

-     a = {}
-     local x = 20
-     for i=1,10 do
-       local y = 0
-       a[i] = function () y=y+1; return x+y end
-     end
-

-The loop creates ten closures -(that is, ten instances of the anonymous function). -Each of these closures uses a different y variable, -while all of them share the same x. - - - - - -

4 – The Application Program Interface

- -

- -This section describes the C API for Lua, that is, -the set of C functions available to the host program to communicate -with Lua. -All API functions and related types and constants -are declared in the header file lua.h. - - -

-Even when we use the term "function", -any facility in the API may be provided as a macro instead. -Except where stated otherwise, -all such macros use each of their arguments exactly once -(except for the first argument, which is always a Lua state), -and so do not generate any hidden side-effects. - - -

-As in most C libraries, -the Lua API functions do not check their arguments for validity or consistency. -However, you can change this behavior by compiling Lua -with the macro LUA_USE_APICHECK defined. - - - -

4.1 – The Stack

- -

-Lua uses a virtual stack to pass values to and from C. -Each element in this stack represents a Lua value -(nil, number, string, etc.). - - -

-Whenever Lua calls C, the called function gets a new stack, -which is independent of previous stacks and of stacks of -C functions that are still active. -This stack initially contains any arguments to the C function -and it is where the C function pushes its results -to be returned to the caller (see lua_CFunction). - - -

-For convenience, -most query operations in the API do not follow a strict stack discipline. -Instead, they can refer to any element in the stack -by using an index: -A positive index represents an absolute stack position -(starting at 1); -a negative index represents an offset relative to the top of the stack. -More specifically, if the stack has n elements, -then index 1 represents the first element -(that is, the element that was pushed onto the stack first) -and -index n represents the last element; -index -1 also represents the last element -(that is, the element at the top) -and index -n represents the first element. - - - - - -

4.2 – Stack Size

- -

-When you interact with the Lua API, -you are responsible for ensuring consistency. -In particular, -you are responsible for controlling stack overflow. -You can use the function lua_checkstack -to ensure that the stack has enough space for pushing new elements. - - -

-Whenever Lua calls C, -it ensures that the stack has space for -at least LUA_MINSTACK extra slots. -LUA_MINSTACK is defined as 20, -so that usually you do not have to worry about stack space -unless your code has loops pushing elements onto the stack. - - -

-When you call a Lua function -without a fixed number of results (see lua_call), -Lua ensures that the stack has enough space for all results, -but it does not ensure any extra space. -So, before pushing anything in the stack after such a call -you should use lua_checkstack. - - - - - -

4.3 – Valid and Acceptable Indices

- -

-Any function in the API that receives stack indices -works only with valid indices or acceptable indices. - - -

-A valid index is an index that refers to a -position that stores a modifiable Lua value. -It comprises stack indices between 1 and the stack top -(1 ≤ abs(index) ≤ top) - -plus pseudo-indices, -which represent some positions that are accessible to C code -but that are not in the stack. -Pseudo-indices are used to access the registry (see §4.5) -and the upvalues of a C function (see §4.4). - - -

-Functions that do not need a specific mutable position, -but only a value (e.g., query functions), -can be called with acceptable indices. -An acceptable index can be any valid index, -but it also can be any positive index after the stack top -within the space allocated for the stack, -that is, indices up to the stack size. -(Note that 0 is never an acceptable index.) -Except when noted otherwise, -functions in the API work with acceptable indices. - - -

-Acceptable indices serve to avoid extra tests -against the stack top when querying the stack. -For instance, a C function can query its third argument -without the need to first check whether there is a third argument, -that is, without the need to check whether 3 is a valid index. - - -

-For functions that can be called with acceptable indices, -any non-valid index is treated as if it -contains a value of a virtual type LUA_TNONE, -which behaves like a nil value. - - - - - -

4.4 – C Closures

- -

-When a C function is created, -it is possible to associate some values with it, -thus creating a C closure -(see lua_pushcclosure); -these values are called upvalues and are -accessible to the function whenever it is called. - - -

-Whenever a C function is called, -its upvalues are located at specific pseudo-indices. -These pseudo-indices are produced by the macro -lua_upvalueindex. -The first upvalue associated with a function is at index -lua_upvalueindex(1), and so on. -Any access to lua_upvalueindex(n), -where n is greater than the number of upvalues of the -current function (but not greater than 256), -produces an acceptable but invalid index. - - - - - -

4.5 – Registry

- -

-Lua provides a registry, -a predefined table that can be used by any C code to -store whatever Lua values it needs to store. -The registry table is always located at pseudo-index -LUA_REGISTRYINDEX. -Any C library can store data into this table, -but it must take care to choose keys -that are different from those used -by other libraries, to avoid collisions. -Typically, you should use as key a string containing your library name, -or a light userdata with the address of a C object in your code, -or any Lua object created by your code. -As with variable names, -string keys starting with an underscore followed by -uppercase letters are reserved for Lua. - - -

-The integer keys in the registry are used -by the reference mechanism (see luaL_ref) -and by some predefined values. -Therefore, integer keys must not be used for other purposes. - - -

-When you create a new Lua state, -its registry comes with some predefined values. -These predefined values are indexed with integer keys -defined as constants in lua.h. -The following constants are defined: - -

    -
  • LUA_RIDX_MAINTHREAD: At this index the registry has -the main thread of the state. -(The main thread is the one created together with the state.) -
  • - -
  • LUA_RIDX_GLOBALS: At this index the registry has -the global environment. -
  • -
- - - - -

4.6 – Error Handling in C

- -

-Internally, Lua uses the C longjmp facility to handle errors. -(Lua will use exceptions if you compile it as C++; -search for LUAI_THROW in the source code for details.) -When Lua faces any error -(such as a memory allocation error, type errors, syntax errors, -and runtime errors) -it raises an error; -that is, it does a long jump. -A protected environment uses setjmp -to set a recovery point; -any error jumps to the most recent active recovery point. - - -

-If an error happens outside any protected environment, -Lua calls a panic function (see lua_atpanic) -and then calls abort, -thus exiting the host application. -Your panic function can avoid this exit by -never returning -(e.g., doing a long jump to your own recovery point outside Lua). - - -

-The panic function runs as if it were a message handler (see §2.3); -in particular, the error message is at the top of the stack. -However, there is no guarantee about stack space. -To push anything on the stack, -the panic function must first check the available space (see §4.2). - - -

-Most functions in the API can raise an error, -for instance due to a memory allocation error. -The documentation for each function indicates whether -it can raise errors. - - -

-Inside a C function you can raise an error by calling lua_error. - - - - - -

4.7 – Handling Yields in C

- -

-Internally, Lua uses the C longjmp facility to yield a coroutine. -Therefore, if a C function foo calls an API function -and this API function yields -(directly or indirectly by calling another function that yields), -Lua cannot return to foo any more, -because the longjmp removes its frame from the C stack. - - -

-To avoid this kind of problem, -Lua raises an error whenever it tries to yield across an API call, -except for three functions: -lua_yieldk, lua_callk, and lua_pcallk. -All those functions receive a continuation function -(as a parameter named k) to continue execution after a yield. - - -

-We need to set some terminology to explain continuations. -We have a C function called from Lua which we will call -the original function. -This original function then calls one of those three functions in the C API, -which we will call the callee function, -that then yields the current thread. -(This can happen when the callee function is lua_yieldk, -or when the callee function is either lua_callk or lua_pcallk -and the function called by them yields.) - - -

-Suppose the running thread yields while executing the callee function. -After the thread resumes, -it eventually will finish running the callee function. -However, -the callee function cannot return to the original function, -because its frame in the C stack was destroyed by the yield. -Instead, Lua calls a continuation function, -which was given as an argument to the callee function. -As the name implies, -the continuation function should continue the task -of the original function. - - -

-As an illustration, consider the following function: - -

-     int original_function (lua_State *L) {
-       ...     /* code 1 */
-       status = lua_pcall(L, n, m, h);  /* calls Lua */
-       ...     /* code 2 */
-     }
-

-Now we want to allow -the Lua code being run by lua_pcall to yield. -First, we can rewrite our function like here: - -

-     int k (lua_State *L, int status, lua_KContext ctx) {
-       ...  /* code 2 */
-     }
-     
-     int original_function (lua_State *L) {
-       ...     /* code 1 */
-       return k(L, lua_pcall(L, n, m, h), ctx);
-     }
-

-In the above code, -the new function k is a -continuation function (with type lua_KFunction), -which should do all the work that the original function -was doing after calling lua_pcall. -Now, we must inform Lua that it must call k if the Lua code -being executed by lua_pcall gets interrupted in some way -(errors or yielding), -so we rewrite the code as here, -replacing lua_pcall by lua_pcallk: - -

-     int original_function (lua_State *L) {
-       ...     /* code 1 */
-       return k(L, lua_pcallk(L, n, m, h, ctx2, k), ctx1);
-     }
-

-Note the external, explicit call to the continuation: -Lua will call the continuation only if needed, that is, -in case of errors or resuming after a yield. -If the called function returns normally without ever yielding, -lua_pcallk (and lua_callk) will also return normally. -(Of course, instead of calling the continuation in that case, -you can do the equivalent work directly inside the original function.) - - -

-Besides the Lua state, -the continuation function has two other parameters: -the final status of the call plus the context value (ctx) that -was passed originally to lua_pcallk. -(Lua does not use this context value; -it only passes this value from the original function to the -continuation function.) -For lua_pcallk, -the status is the same value that would be returned by lua_pcallk, -except that it is LUA_YIELD when being executed after a yield -(instead of LUA_OK). -For lua_yieldk and lua_callk, -the status is always LUA_YIELD when Lua calls the continuation. -(For these two functions, -Lua will not call the continuation in case of errors, -because they do not handle errors.) -Similarly, when using lua_callk, -you should call the continuation function -with LUA_OK as the status. -(For lua_yieldk, there is not much point in calling -directly the continuation function, -because lua_yieldk usually does not return.) - - -

-Lua treats the continuation function as if it were the original function. -The continuation function receives the same Lua stack -from the original function, -in the same state it would be if the callee function had returned. -(For instance, -after a lua_callk the function and its arguments are -removed from the stack and replaced by the results from the call.) -It also has the same upvalues. -Whatever it returns is handled by Lua as if it were the return -of the original function. - - - - - -

4.8 – Functions and Types

- -

-Here we list all functions and types from the C API in -alphabetical order. -Each function has an indicator like this: -[-o, +p, x] - - -

-The first field, o, -is how many elements the function pops from the stack. -The second field, p, -is how many elements the function pushes onto the stack. -(Any function always pushes its results after popping its arguments.) -A field in the form x|y means the function can push (or pop) -x or y elements, -depending on the situation; -an interrogation mark '?' means that -we cannot know how many elements the function pops/pushes -by looking only at its arguments -(e.g., they may depend on what is on the stack). -The third field, x, -tells whether the function may raise errors: -'-' means the function never raises any error; -'e' means the function may raise errors; -'v' means the function may raise an error on purpose. - - - -


lua_absindex

-[-0, +0, –] -

int lua_absindex (lua_State *L, int idx);
- -

-Converts the acceptable index idx -into an equivalent absolute index -(that is, one that does not depend on the stack top). - - - - - -


lua_Alloc

-
typedef void * (*lua_Alloc) (void *ud,
-                             void *ptr,
-                             size_t osize,
-                             size_t nsize);
- -

-The type of the memory-allocation function used by Lua states. -The allocator function must provide a -functionality similar to realloc, -but not exactly the same. -Its arguments are -ud, an opaque pointer passed to lua_newstate; -ptr, a pointer to the block being allocated/reallocated/freed; -osize, the original size of the block or some code about what -is being allocated; -and nsize, the new size of the block. - - -

-When ptr is not NULL, -osize is the size of the block pointed by ptr, -that is, the size given when it was allocated or reallocated. - - -

-When ptr is NULL, -osize encodes the kind of object that Lua is allocating. -osize is any of -LUA_TSTRING, LUA_TTABLE, LUA_TFUNCTION, -LUA_TUSERDATA, or LUA_TTHREAD when (and only when) -Lua is creating a new object of that type. -When osize is some other value, -Lua is allocating memory for something else. - - -

-Lua assumes the following behavior from the allocator function: - - -

-When nsize is zero, -the allocator must behave like free -and return NULL. - - -

-When nsize is not zero, -the allocator must behave like realloc. -The allocator returns NULL -if and only if it cannot fulfill the request. -Lua assumes that the allocator never fails when -osize >= nsize. - - -

-Here is a simple implementation for the allocator function. -It is used in the auxiliary library by luaL_newstate. - -

-     static void *l_alloc (void *ud, void *ptr, size_t osize,
-                                                size_t nsize) {
-       (void)ud;  (void)osize;  /* not used */
-       if (nsize == 0) {
-         free(ptr);
-         return NULL;
-       }
-       else
-         return realloc(ptr, nsize);
-     }
-

-Note that Standard C ensures -that free(NULL) has no effect and that -realloc(NULL,size) is equivalent to malloc(size). -This code assumes that realloc does not fail when shrinking a block. -(Although Standard C does not ensure this behavior, -it seems to be a safe assumption.) - - - - - -


lua_arith

-[-(2|1), +1, e] -

void lua_arith (lua_State *L, int op);
- -

-Performs an arithmetic or bitwise operation over the two values -(or one, in the case of negations) -at the top of the stack, -with the value at the top being the second operand, -pops these values, and pushes the result of the operation. -The function follows the semantics of the corresponding Lua operator -(that is, it may call metamethods). - - -

-The value of op must be one of the following constants: - -

- - - - -

lua_atpanic

-[-0, +0, –] -

lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf);
- -

-Sets a new panic function and returns the old one (see §4.6). - - - - - -


lua_call

-[-(nargs+1), +nresults, e] -

void lua_call (lua_State *L, int nargs, int nresults);
- -

-Calls a function. - - -

-To call a function you must use the following protocol: -first, the function to be called is pushed onto the stack; -then, the arguments to the function are pushed -in direct order; -that is, the first argument is pushed first. -Finally you call lua_call; -nargs is the number of arguments that you pushed onto the stack. -All arguments and the function value are popped from the stack -when the function is called. -The function results are pushed onto the stack when the function returns. -The number of results is adjusted to nresults, -unless nresults is LUA_MULTRET. -In this case, all results from the function are pushed. -Lua takes care that the returned values fit into the stack space. -The function results are pushed onto the stack in direct order -(the first result is pushed first), -so that after the call the last result is on the top of the stack. - - -

-Any error inside the called function is propagated upwards -(with a longjmp). - - -

-The following example shows how the host program can do the -equivalent to this Lua code: - -

-     a = f("how", t.x, 14)
-

-Here it is in C: - -

-     lua_getglobal(L, "f");                  /* function to be called */
-     lua_pushliteral(L, "how");                       /* 1st argument */
-     lua_getglobal(L, "t");                    /* table to be indexed */
-     lua_getfield(L, -1, "x");        /* push result of t.x (2nd arg) */
-     lua_remove(L, -2);                  /* remove 't' from the stack */
-     lua_pushinteger(L, 14);                          /* 3rd argument */
-     lua_call(L, 3, 1);     /* call 'f' with 3 arguments and 1 result */
-     lua_setglobal(L, "a");                         /* set global 'a' */
-

-Note that the code above is balanced: -at its end, the stack is back to its original configuration. -This is considered good programming practice. - - - - - -


lua_callk

-[-(nargs + 1), +nresults, e] -

void lua_callk (lua_State *L,
-                int nargs,
-                int nresults,
-                lua_KContext ctx,
-                lua_KFunction k);
- -

-This function behaves exactly like lua_call, -but allows the called function to yield (see §4.7). - - - - - -


lua_CFunction

-
typedef int (*lua_CFunction) (lua_State *L);
- -

-Type for C functions. - - -

-In order to communicate properly with Lua, -a C function must use the following protocol, -which defines the way parameters and results are passed: -a C function receives its arguments from Lua in its stack -in direct order (the first argument is pushed first). -So, when the function starts, -lua_gettop(L) returns the number of arguments received by the function. -The first argument (if any) is at index 1 -and its last argument is at index lua_gettop(L). -To return values to Lua, a C function just pushes them onto the stack, -in direct order (the first result is pushed first), -and returns the number of results. -Any other value in the stack below the results will be properly -discarded by Lua. -Like a Lua function, a C function called by Lua can also return -many results. - - -

-As an example, the following function receives a variable number -of numeric arguments and returns their average and their sum: - -

-     static int foo (lua_State *L) {
-       int n = lua_gettop(L);    /* number of arguments */
-       lua_Number sum = 0.0;
-       int i;
-       for (i = 1; i <= n; i++) {
-         if (!lua_isnumber(L, i)) {
-           lua_pushliteral(L, "incorrect argument");
-           lua_error(L);
-         }
-         sum += lua_tonumber(L, i);
-       }
-       lua_pushnumber(L, sum/n);        /* first result */
-       lua_pushnumber(L, sum);         /* second result */
-       return 2;                   /* number of results */
-     }
-
- - - - -

lua_checkstack

-[-0, +0, –] -

int lua_checkstack (lua_State *L, int n);
- -

-Ensures that the stack has space for at least n extra slots. -It returns false if it cannot fulfill the request, -either because it would cause the stack -to be larger than a fixed maximum size -(typically at least several thousand elements) or -because it cannot allocate memory for the extra space. -This function never shrinks the stack; -if the stack is already larger than the new size, -it is left unchanged. - - - - - -


lua_close

-[-0, +0, –] -

void lua_close (lua_State *L);
- -

-Destroys all objects in the given Lua state -(calling the corresponding garbage-collection metamethods, if any) -and frees all dynamic memory used by this state. -On several platforms, you may not need to call this function, -because all resources are naturally released when the host program ends. -On the other hand, long-running programs that create multiple states, -such as daemons or web servers, -will probably need to close states as soon as they are not needed. - - - - - -


lua_compare

-[-0, +0, e] -

int lua_compare (lua_State *L, int index1, int index2, int op);
- -

-Compares two Lua values. -Returns 1 if the value at index index1 satisfies op -when compared with the value at index index2, -following the semantics of the corresponding Lua operator -(that is, it may call metamethods). -Otherwise returns 0. -Also returns 0 if any of the indices is not valid. - - -

-The value of op must be one of the following constants: - -

    - -
  • LUA_OPEQ: compares for equality (==)
  • -
  • LUA_OPLT: compares for less than (<)
  • -
  • LUA_OPLE: compares for less or equal (<=)
  • - -
- - - - -

lua_concat

-[-n, +1, e] -

void lua_concat (lua_State *L, int n);
- -

-Concatenates the n values at the top of the stack, -pops them, and leaves the result at the top. -If n is 1, the result is the single value on the stack -(that is, the function does nothing); -if n is 0, the result is the empty string. -Concatenation is performed following the usual semantics of Lua -(see §3.4.6). - - - - - -


lua_copy

-[-0, +0, –] -

void lua_copy (lua_State *L, int fromidx, int toidx);
- -

-Copies the element at index fromidx -into the valid index toidx, -replacing the value at that position. -Values at other positions are not affected. - - - - - -


lua_createtable

-[-0, +1, e] -

void lua_createtable (lua_State *L, int narr, int nrec);
- -

-Creates a new empty table and pushes it onto the stack. -Parameter narr is a hint for how many elements the table -will have as a sequence; -parameter nrec is a hint for how many other elements -the table will have. -Lua may use these hints to preallocate memory for the new table. -This pre-allocation is useful for performance when you know in advance -how many elements the table will have. -Otherwise you can use the function lua_newtable. - - - - - -


lua_dump

-[-0, +0, e] -

int lua_dump (lua_State *L,
-                        lua_Writer writer,
-                        void *data,
-                        int strip);
- -

-Dumps a function as a binary chunk. -Receives a Lua function on the top of the stack -and produces a binary chunk that, -if loaded again, -results in a function equivalent to the one dumped. -As it produces parts of the chunk, -lua_dump calls function writer (see lua_Writer) -with the given data -to write them. - - -

-If strip is true, -the binary representation may not include all debug information -about the function, -to save space. - - -

-The value returned is the error code returned by the last -call to the writer; -0 means no errors. - - -

-This function does not pop the Lua function from the stack. - - - - - -


lua_error

-[-1, +0, v] -

int lua_error (lua_State *L);
- -

-Generates a Lua error, -using the value at the top of the stack as the error object. -This function does a long jump, -and therefore never returns -(see luaL_error). - - - - - -


lua_gc

-[-0, +0, e] -

int lua_gc (lua_State *L, int what, int data);
- -

-Controls the garbage collector. - - -

-This function performs several tasks, -according to the value of the parameter what: - -

    - -
  • LUA_GCSTOP: -stops the garbage collector. -
  • - -
  • LUA_GCRESTART: -restarts the garbage collector. -
  • - -
  • LUA_GCCOLLECT: -performs a full garbage-collection cycle. -
  • - -
  • LUA_GCCOUNT: -returns the current amount of memory (in Kbytes) in use by Lua. -
  • - -
  • LUA_GCCOUNTB: -returns the remainder of dividing the current amount of bytes of -memory in use by Lua by 1024. -
  • - -
  • LUA_GCSTEP: -performs an incremental step of garbage collection. -
  • - -
  • LUA_GCSETPAUSE: -sets data as the new value -for the pause of the collector (see §2.5) -and returns the previous value of the pause. -
  • - -
  • LUA_GCSETSTEPMUL: -sets data as the new value for the step multiplier of -the collector (see §2.5) -and returns the previous value of the step multiplier. -
  • - -
  • LUA_GCISRUNNING: -returns a boolean that tells whether the collector is running -(i.e., not stopped). -
  • - -
- -

-For more details about these options, -see collectgarbage. - - - - - -


lua_getallocf

-[-0, +0, –] -

lua_Alloc lua_getallocf (lua_State *L, void **ud);
- -

-Returns the memory-allocation function of a given state. -If ud is not NULL, Lua stores in *ud the -opaque pointer given when the memory-allocator function was set. - - - - - -


lua_getfield

-[-0, +1, e] -

int lua_getfield (lua_State *L, int index, const char *k);
- -

-Pushes onto the stack the value t[k], -where t is the value at the given index. -As in Lua, this function may trigger a metamethod -for the "index" event (see §2.4). - - -

-Returns the type of the pushed value. - - - - - -


lua_getextraspace

-[-0, +0, –] -

void *lua_getextraspace (lua_State *L);
- -

-Returns a pointer to a raw memory area associated with the -given Lua state. -The application can use this area for any purpose; -Lua does not use it for anything. - - -

-Each new thread has this area initialized with a copy -of the area of the main thread. - - -

-By default, this area has the size of a pointer to void, -but you can recompile Lua with a different size for this area. -(See LUA_EXTRASPACE in luaconf.h.) - - - - - -


lua_getglobal

-[-0, +1, e] -

int lua_getglobal (lua_State *L, const char *name);
- -

-Pushes onto the stack the value of the global name. -Returns the type of that value. - - - - - -


lua_geti

-[-0, +1, e] -

int lua_geti (lua_State *L, int index, lua_Integer i);
- -

-Pushes onto the stack the value t[i], -where t is the value at the given index. -As in Lua, this function may trigger a metamethod -for the "index" event (see §2.4). - - -

-Returns the type of the pushed value. - - - - - -


lua_getmetatable

-[-0, +(0|1), –] -

int lua_getmetatable (lua_State *L, int index);
- -

-If the value at the given index has a metatable, -the function pushes that metatable onto the stack and returns 1. -Otherwise, -the function returns 0 and pushes nothing on the stack. - - - - - -


lua_gettable

-[-1, +1, e] -

int lua_gettable (lua_State *L, int index);
- -

-Pushes onto the stack the value t[k], -where t is the value at the given index -and k is the value at the top of the stack. - - -

-This function pops the key from the stack, -pushing the resulting value in its place. -As in Lua, this function may trigger a metamethod -for the "index" event (see §2.4). - - -

-Returns the type of the pushed value. - - - - - -


lua_gettop

-[-0, +0, –] -

int lua_gettop (lua_State *L);
- -

-Returns the index of the top element in the stack. -Because indices start at 1, -this result is equal to the number of elements in the stack; -in particular, 0 means an empty stack. - - - - - -


lua_getuservalue

-[-0, +1, –] -

int lua_getuservalue (lua_State *L, int index);
- -

-Pushes onto the stack the Lua value associated with the userdata -at the given index. - - -

-Returns the type of the pushed value. - - - - - -


lua_insert

-[-1, +1, –] -

void lua_insert (lua_State *L, int index);
- -

-Moves the top element into the given valid index, -shifting up the elements above this index to open space. -This function cannot be called with a pseudo-index, -because a pseudo-index is not an actual stack position. - - - - - -


lua_Integer

-
typedef ... lua_Integer;
- -

-The type of integers in Lua. - - -

-By default this type is long long, -(usually a 64-bit two-complement integer), -but that can be changed to long or int -(usually a 32-bit two-complement integer). -(See LUA_INT_TYPE in luaconf.h.) - - -

-Lua also defines the constants -LUA_MININTEGER and LUA_MAXINTEGER, -with the minimum and the maximum values that fit in this type. - - - - - -


lua_isboolean

-[-0, +0, –] -

int lua_isboolean (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a boolean, -and 0 otherwise. - - - - - -


lua_iscfunction

-[-0, +0, –] -

int lua_iscfunction (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a C function, -and 0 otherwise. - - - - - -


lua_isfunction

-[-0, +0, –] -

int lua_isfunction (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a function -(either C or Lua), and 0 otherwise. - - - - - -


lua_isinteger

-[-0, +0, –] -

int lua_isinteger (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is an integer -(that is, the value is a number and is represented as an integer), -and 0 otherwise. - - - - - -


lua_islightuserdata

-[-0, +0, –] -

int lua_islightuserdata (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a light userdata, -and 0 otherwise. - - - - - -


lua_isnil

-[-0, +0, –] -

int lua_isnil (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is nil, -and 0 otherwise. - - - - - -


lua_isnone

-[-0, +0, –] -

int lua_isnone (lua_State *L, int index);
- -

-Returns 1 if the given index is not valid, -and 0 otherwise. - - - - - -


lua_isnoneornil

-[-0, +0, –] -

int lua_isnoneornil (lua_State *L, int index);
- -

-Returns 1 if the given index is not valid -or if the value at this index is nil, -and 0 otherwise. - - - - - -


lua_isnumber

-[-0, +0, –] -

int lua_isnumber (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a number -or a string convertible to a number, -and 0 otherwise. - - - - - -


lua_isstring

-[-0, +0, –] -

int lua_isstring (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a string -or a number (which is always convertible to a string), -and 0 otherwise. - - - - - -


lua_istable

-[-0, +0, –] -

int lua_istable (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a table, -and 0 otherwise. - - - - - -


lua_isthread

-[-0, +0, –] -

int lua_isthread (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a thread, -and 0 otherwise. - - - - - -


lua_isuserdata

-[-0, +0, –] -

int lua_isuserdata (lua_State *L, int index);
- -

-Returns 1 if the value at the given index is a userdata -(either full or light), and 0 otherwise. - - - - - -


lua_isyieldable

-[-0, +0, –] -

int lua_isyieldable (lua_State *L);
- -

-Returns 1 if the given coroutine can yield, -and 0 otherwise. - - - - - -


lua_KContext

-
typedef ... lua_KContext;
- -

-The type for continuation-function contexts. -It must be a numeric type. -This type is defined as intptr_t -when intptr_t is available, -so that it can store pointers too. -Otherwise, it is defined as ptrdiff_t. - - - - - -


lua_KFunction

-
typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx);
- -

-Type for continuation functions (see §4.7). - - - - - -


lua_len

-[-0, +1, e] -

void lua_len (lua_State *L, int index);
- -

-Returns the length of the value at the given index. -It is equivalent to the '#' operator in Lua (see §3.4.7) and -may trigger a metamethod for the "length" event (see §2.4). -The result is pushed on the stack. - - - - - -


lua_load

-[-0, +1, –] -

int lua_load (lua_State *L,
-              lua_Reader reader,
-              void *data,
-              const char *chunkname,
-              const char *mode);
- -

-Loads a Lua chunk without running it. -If there are no errors, -lua_load pushes the compiled chunk as a Lua -function on top of the stack. -Otherwise, it pushes an error message. - - -

-The return values of lua_load are: - -

    - -
  • LUA_OK: no errors;
  • - -
  • LUA_ERRSYNTAX: -syntax error during precompilation;
  • - -
  • LUA_ERRMEM: -memory allocation error;
  • - -
  • LUA_ERRGCMM: -error while running a __gc metamethod. -(This error has no relation with the chunk being loaded. -It is generated by the garbage collector.) -
  • - -
- -

-The lua_load function uses a user-supplied reader function -to read the chunk (see lua_Reader). -The data argument is an opaque value passed to the reader function. - - -

-The chunkname argument gives a name to the chunk, -which is used for error messages and in debug information (see §4.9). - - -

-lua_load automatically detects whether the chunk is text or binary -and loads it accordingly (see program luac). -The string mode works as in function load, -with the addition that -a NULL value is equivalent to the string "bt". - - -

-lua_load uses the stack internally, -so the reader function must always leave the stack -unmodified when returning. - - -

-If the resulting function has upvalues, -its first upvalue is set to the value of the global environment -stored at index LUA_RIDX_GLOBALS in the registry (see §4.5). -When loading main chunks, -this upvalue will be the _ENV variable (see §2.2). -Other upvalues are initialized with nil. - - - - - -


lua_newstate

-[-0, +0, –] -

lua_State *lua_newstate (lua_Alloc f, void *ud);
- -

-Creates a new thread running in a new, independent state. -Returns NULL if it cannot create the thread or the state -(due to lack of memory). -The argument f is the allocator function; -Lua does all memory allocation for this state through this function. -The second argument, ud, is an opaque pointer that Lua -passes to the allocator in every call. - - - - - -


lua_newtable

-[-0, +1, e] -

void lua_newtable (lua_State *L);
- -

-Creates a new empty table and pushes it onto the stack. -It is equivalent to lua_createtable(L, 0, 0). - - - - - -


lua_newthread

-[-0, +1, e] -

lua_State *lua_newthread (lua_State *L);
- -

-Creates a new thread, pushes it on the stack, -and returns a pointer to a lua_State that represents this new thread. -The new thread returned by this function shares with the original thread -its global environment, -but has an independent execution stack. - - -

-There is no explicit function to close or to destroy a thread. -Threads are subject to garbage collection, -like any Lua object. - - - - - -


lua_newuserdata

-[-0, +1, e] -

void *lua_newuserdata (lua_State *L, size_t size);
- -

-This function allocates a new block of memory with the given size, -pushes onto the stack a new full userdata with the block address, -and returns this address. -The host program can freely use this memory. - - - - - -


lua_next

-[-1, +(2|0), e] -

int lua_next (lua_State *L, int index);
- -

-Pops a key from the stack, -and pushes a key–value pair from the table at the given index -(the "next" pair after the given key). -If there are no more elements in the table, -then lua_next returns 0 (and pushes nothing). - - -

-A typical traversal looks like this: - -

-     /* table is in the stack at index 't' */
-     lua_pushnil(L);  /* first key */
-     while (lua_next(L, t) != 0) {
-       /* uses 'key' (at index -2) and 'value' (at index -1) */
-       printf("%s - %s\n",
-              lua_typename(L, lua_type(L, -2)),
-              lua_typename(L, lua_type(L, -1)));
-       /* removes 'value'; keeps 'key' for next iteration */
-       lua_pop(L, 1);
-     }
-
- -

-While traversing a table, -do not call lua_tolstring directly on a key, -unless you know that the key is actually a string. -Recall that lua_tolstring may change -the value at the given index; -this confuses the next call to lua_next. - - -

-See function next for the caveats of modifying -the table during its traversal. - - - - - -


lua_Number

-
typedef ... lua_Number;
- -

-The type of floats in Lua. - - -

-By default this type is double, -but that can be changed to a single float or a long double. -(See LUA_FLOAT_TYPE in luaconf.h.) - - - - - -


lua_numbertointeger

-
int lua_numbertointeger (lua_Number n, lua_Integer *p);
- -

-Converts a Lua float to a Lua integer. -This macro assumes that n has an integral value. -If that value is within the range of Lua integers, -it is converted to an integer and assigned to *p. -The macro results in a boolean indicating whether the -conversion was successful. -(Note that this range test can be tricky to do -correctly without this macro, -due to roundings.) - - -

-This macro may evaluate its arguments more than once. - - - - - -


lua_pcall

-[-(nargs + 1), +(nresults|1), –] -

int lua_pcall (lua_State *L, int nargs, int nresults, int msgh);
- -

-Calls a function in protected mode. - - -

-Both nargs and nresults have the same meaning as -in lua_call. -If there are no errors during the call, -lua_pcall behaves exactly like lua_call. -However, if there is any error, -lua_pcall catches it, -pushes a single value on the stack (the error message), -and returns an error code. -Like lua_call, -lua_pcall always removes the function -and its arguments from the stack. - - -

-If msgh is 0, -then the error message returned on the stack -is exactly the original error message. -Otherwise, msgh is the stack index of a -message handler. -(This index cannot be a pseudo-index.) -In case of runtime errors, -this function will be called with the error message -and its return value will be the message -returned on the stack by lua_pcall. - - -

-Typically, the message handler is used to add more debug -information to the error message, such as a stack traceback. -Such information cannot be gathered after the return of lua_pcall, -since by then the stack has unwound. - - -

-The lua_pcall function returns one of the following constants -(defined in lua.h): - -

    - -
  • LUA_OK (0): -success.
  • - -
  • LUA_ERRRUN: -a runtime error. -
  • - -
  • LUA_ERRMEM: -memory allocation error. -For such errors, Lua does not call the message handler. -
  • - -
  • LUA_ERRERR: -error while running the message handler. -
  • - -
  • LUA_ERRGCMM: -error while running a __gc metamethod. -(This error typically has no relation with the function being called.) -
  • - -
- - - - -

lua_pcallk

-[-(nargs + 1), +(nresults|1), –] -

int lua_pcallk (lua_State *L,
-                int nargs,
-                int nresults,
-                int msgh,
-                lua_KContext ctx,
-                lua_KFunction k);
- -

-This function behaves exactly like lua_pcall, -but allows the called function to yield (see §4.7). - - - - - -


lua_pop

-[-n, +0, –] -

void lua_pop (lua_State *L, int n);
- -

-Pops n elements from the stack. - - - - - -


lua_pushboolean

-[-0, +1, –] -

void lua_pushboolean (lua_State *L, int b);
- -

-Pushes a boolean value with value b onto the stack. - - - - - -


lua_pushcclosure

-[-n, +1, e] -

void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n);
- -

-Pushes a new C closure onto the stack. - - -

-When a C function is created, -it is possible to associate some values with it, -thus creating a C closure (see §4.4); -these values are then accessible to the function whenever it is called. -To associate values with a C function, -first these values must be pushed onto the stack -(when there are multiple values, the first value is pushed first). -Then lua_pushcclosure -is called to create and push the C function onto the stack, -with the argument n telling how many values will be -associated with the function. -lua_pushcclosure also pops these values from the stack. - - -

-The maximum value for n is 255. - - -

-When n is zero, -this function creates a light C function, -which is just a pointer to the C function. -In that case, it never raises a memory error. - - - - - -


lua_pushcfunction

-[-0, +1, –] -

void lua_pushcfunction (lua_State *L, lua_CFunction f);
- -

-Pushes a C function onto the stack. -This function receives a pointer to a C function -and pushes onto the stack a Lua value of type function that, -when called, invokes the corresponding C function. - - -

-Any function to be callable by Lua must -follow the correct protocol to receive its parameters -and return its results (see lua_CFunction). - - - - - -


lua_pushfstring

-[-0, +1, e] -

const char *lua_pushfstring (lua_State *L, const char *fmt, ...);
- -

-Pushes onto the stack a formatted string -and returns a pointer to this string. -It is similar to the ISO C function sprintf, -but has some important differences: - -

    - -
  • -You do not have to allocate space for the result: -the result is a Lua string and Lua takes care of memory allocation -(and deallocation, through garbage collection). -
  • - -
  • -The conversion specifiers are quite restricted. -There are no flags, widths, or precisions. -The conversion specifiers can only be -'%%' (inserts the character '%'), -'%s' (inserts a zero-terminated string, with no size restrictions), -'%f' (inserts a lua_Number), -'%I' (inserts a lua_Integer), -'%p' (inserts a pointer as a hexadecimal numeral), -'%d' (inserts an int), -'%c' (inserts an int as a one-byte character), and -'%U' (inserts a long int as a UTF-8 byte sequence). -
  • - -
- - - - -

lua_pushglobaltable

-[-0, +1, –] -

void lua_pushglobaltable (lua_State *L);
- -

-Pushes the global environment onto the stack. - - - - - -


lua_pushinteger

-[-0, +1, –] -

void lua_pushinteger (lua_State *L, lua_Integer n);
- -

-Pushes an integer with value n onto the stack. - - - - - -


lua_pushlightuserdata

-[-0, +1, –] -

void lua_pushlightuserdata (lua_State *L, void *p);
- -

-Pushes a light userdata onto the stack. - - -

-Userdata represent C values in Lua. -A light userdata represents a pointer, a void*. -It is a value (like a number): -you do not create it, it has no individual metatable, -and it is not collected (as it was never created). -A light userdata is equal to "any" -light userdata with the same C address. - - - - - -


lua_pushliteral

-[-0, +1, e] -

const char *lua_pushliteral (lua_State *L, const char *s);
- -

-This macro is equivalent to lua_pushstring, -but should be used only when s is a literal string. - - - - - -


lua_pushlstring

-[-0, +1, e] -

const char *lua_pushlstring (lua_State *L, const char *s, size_t len);
- -

-Pushes the string pointed to by s with size len -onto the stack. -Lua makes (or reuses) an internal copy of the given string, -so the memory at s can be freed or reused immediately after -the function returns. -The string can contain any binary data, -including embedded zeros. - - -

-Returns a pointer to the internal copy of the string. - - - - - -


lua_pushnil

-[-0, +1, –] -

void lua_pushnil (lua_State *L);
- -

-Pushes a nil value onto the stack. - - - - - -


lua_pushnumber

-[-0, +1, –] -

void lua_pushnumber (lua_State *L, lua_Number n);
- -

-Pushes a float with value n onto the stack. - - - - - -


lua_pushstring

-[-0, +1, e] -

const char *lua_pushstring (lua_State *L, const char *s);
- -

-Pushes the zero-terminated string pointed to by s -onto the stack. -Lua makes (or reuses) an internal copy of the given string, -so the memory at s can be freed or reused immediately after -the function returns. - - -

-Returns a pointer to the internal copy of the string. - - -

-If s is NULL, pushes nil and returns NULL. - - - - - -


lua_pushthread

-[-0, +1, –] -

int lua_pushthread (lua_State *L);
- -

-Pushes the thread represented by L onto the stack. -Returns 1 if this thread is the main thread of its state. - - - - - -


lua_pushvalue

-[-0, +1, –] -

void lua_pushvalue (lua_State *L, int index);
- -

-Pushes a copy of the element at the given index -onto the stack. - - - - - -


lua_pushvfstring

-[-0, +1, e] -

const char *lua_pushvfstring (lua_State *L,
-                              const char *fmt,
-                              va_list argp);
- -

-Equivalent to lua_pushfstring, except that it receives a va_list -instead of a variable number of arguments. - - - - - -


lua_rawequal

-[-0, +0, –] -

int lua_rawequal (lua_State *L, int index1, int index2);
- -

-Returns 1 if the two values in indices index1 and -index2 are primitively equal -(that is, without calling metamethods). -Otherwise returns 0. -Also returns 0 if any of the indices are not valid. - - - - - -


lua_rawget

-[-1, +1, –] -

int lua_rawget (lua_State *L, int index);
- -

-Similar to lua_gettable, but does a raw access -(i.e., without metamethods). - - - - - -


lua_rawgeti

-[-0, +1, –] -

int lua_rawgeti (lua_State *L, int index, lua_Integer n);
- -

-Pushes onto the stack the value t[n], -where t is the table at the given index. -The access is raw; -that is, it does not invoke metamethods. - - -

-Returns the type of the pushed value. - - - - - -


lua_rawgetp

-[-0, +1, –] -

int lua_rawgetp (lua_State *L, int index, const void *p);
- -

-Pushes onto the stack the value t[k], -where t is the table at the given index and -k is the pointer p represented as a light userdata. -The access is raw; -that is, it does not invoke metamethods. - - -

-Returns the type of the pushed value. - - - - - -


lua_rawlen

-[-0, +0, –] -

size_t lua_rawlen (lua_State *L, int index);
- -

-Returns the raw "length" of the value at the given index: -for strings, this is the string length; -for tables, this is the result of the length operator ('#') -with no metamethods; -for userdata, this is the size of the block of memory allocated -for the userdata; -for other values, it is 0. - - - - - -


lua_rawset

-[-2, +0, e] -

void lua_rawset (lua_State *L, int index);
- -

-Similar to lua_settable, but does a raw assignment -(i.e., without metamethods). - - - - - -


lua_rawseti

-[-1, +0, e] -

void lua_rawseti (lua_State *L, int index, lua_Integer i);
- -

-Does the equivalent of t[i] = v, -where t is the table at the given index -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -The assignment is raw; -that is, it does not invoke metamethods. - - - - - -


lua_rawsetp

-[-1, +0, e] -

void lua_rawsetp (lua_State *L, int index, const void *p);
- -

-Does the equivalent of t[p] = v, -where t is the table at the given index, -p is encoded as a light userdata, -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -The assignment is raw; -that is, it does not invoke metamethods. - - - - - -


lua_Reader

-
typedef const char * (*lua_Reader) (lua_State *L,
-                                    void *data,
-                                    size_t *size);
- -

-The reader function used by lua_load. -Every time it needs another piece of the chunk, -lua_load calls the reader, -passing along its data parameter. -The reader must return a pointer to a block of memory -with a new piece of the chunk -and set size to the block size. -The block must exist until the reader function is called again. -To signal the end of the chunk, -the reader must return NULL or set size to zero. -The reader function may return pieces of any size greater than zero. - - - - - -


lua_register

-[-0, +0, e] -

void lua_register (lua_State *L, const char *name, lua_CFunction f);
- -

-Sets the C function f as the new value of global name. -It is defined as a macro: - -

-     #define lua_register(L,n,f) \
-            (lua_pushcfunction(L, f), lua_setglobal(L, n))
-
- - - - -

lua_remove

-[-1, +0, –] -

void lua_remove (lua_State *L, int index);
- -

-Removes the element at the given valid index, -shifting down the elements above this index to fill the gap. -This function cannot be called with a pseudo-index, -because a pseudo-index is not an actual stack position. - - - - - -


lua_replace

-[-1, +0, –] -

void lua_replace (lua_State *L, int index);
- -

-Moves the top element into the given valid index -without shifting any element -(therefore replacing the value at that given index), -and then pops the top element. - - - - - -


lua_resume

-[-?, +?, –] -

int lua_resume (lua_State *L, lua_State *from, int nargs);
- -

-Starts and resumes a coroutine in the given thread L. - - -

-To start a coroutine, -you push onto the thread stack the main function plus any arguments; -then you call lua_resume, -with nargs being the number of arguments. -This call returns when the coroutine suspends or finishes its execution. -When it returns, the stack contains all values passed to lua_yield, -or all values returned by the body function. -lua_resume returns -LUA_YIELD if the coroutine yields, -LUA_OK if the coroutine finishes its execution -without errors, -or an error code in case of errors (see lua_pcall). - - -

-In case of errors, -the stack is not unwound, -so you can use the debug API over it. -The error message is on the top of the stack. - - -

-To resume a coroutine, -you remove any results from the last lua_yield, -put on its stack only the values to -be passed as results from yield, -and then call lua_resume. - - -

-The parameter from represents the coroutine that is resuming L. -If there is no such coroutine, -this parameter can be NULL. - - - - - -


lua_rotate

-[-0, +0, –] -

void lua_rotate (lua_State *L, int idx, int n);
- -

-Rotates the stack elements between the valid index idx -and the top of the stack. -The elements are rotated n positions in the direction of the top, -for a positive n, -or -n positions in the direction of the bottom, -for a negative n. -The absolute value of n must not be greater than the size -of the slice being rotated. -This function cannot be called with a pseudo-index, -because a pseudo-index is not an actual stack position. - - - - - -


lua_setallocf

-[-0, +0, –] -

void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
- -

-Changes the allocator function of a given state to f -with user data ud. - - - - - -


lua_setfield

-[-1, +0, e] -

void lua_setfield (lua_State *L, int index, const char *k);
- -

-Does the equivalent to t[k] = v, -where t is the value at the given index -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -As in Lua, this function may trigger a metamethod -for the "newindex" event (see §2.4). - - - - - -


lua_setglobal

-[-1, +0, e] -

void lua_setglobal (lua_State *L, const char *name);
- -

-Pops a value from the stack and -sets it as the new value of global name. - - - - - -


lua_seti

-[-1, +0, e] -

void lua_seti (lua_State *L, int index, lua_Integer n);
- -

-Does the equivalent to t[n] = v, -where t is the value at the given index -and v is the value at the top of the stack. - - -

-This function pops the value from the stack. -As in Lua, this function may trigger a metamethod -for the "newindex" event (see §2.4). - - - - - -


lua_setmetatable

-[-1, +0, –] -

void lua_setmetatable (lua_State *L, int index);
- -

-Pops a table from the stack and -sets it as the new metatable for the value at the given index. - - - - - -


lua_settable

-[-2, +0, e] -

void lua_settable (lua_State *L, int index);
- -

-Does the equivalent to t[k] = v, -where t is the value at the given index, -v is the value at the top of the stack, -and k is the value just below the top. - - -

-This function pops both the key and the value from the stack. -As in Lua, this function may trigger a metamethod -for the "newindex" event (see §2.4). - - - - - -


lua_settop

-[-?, +?, –] -

void lua_settop (lua_State *L, int index);
- -

-Accepts any index, or 0, -and sets the stack top to this index. -If the new top is larger than the old one, -then the new elements are filled with nil. -If index is 0, then all stack elements are removed. - - - - - -


lua_setuservalue

-[-1, +0, –] -

void lua_setuservalue (lua_State *L, int index);
- -

-Pops a value from the stack and sets it as -the new value associated to the userdata at the given index. - - - - - -


lua_State

-
typedef struct lua_State lua_State;
- -

-An opaque structure that points to a thread and indirectly -(through the thread) to the whole state of a Lua interpreter. -The Lua library is fully reentrant: -it has no global variables. -All information about a state is accessible through this structure. - - -

-A pointer to this structure must be passed as the first argument to -every function in the library, except to lua_newstate, -which creates a Lua state from scratch. - - - - - -


lua_status

-[-0, +0, –] -

int lua_status (lua_State *L);
- -

-Returns the status of the thread L. - - -

-The status can be 0 (LUA_OK) for a normal thread, -an error code if the thread finished the execution -of a lua_resume with an error, -or LUA_YIELD if the thread is suspended. - - -

-You can only call functions in threads with status LUA_OK. -You can resume threads with status LUA_OK -(to start a new coroutine) or LUA_YIELD -(to resume a coroutine). - - - - - -


lua_stringtonumber

-[-0, +1, –] -

size_t lua_stringtonumber (lua_State *L, const char *s);
- -

-Converts the zero-terminated string s to a number, -pushes that number into the stack, -and returns the total size of the string, -that is, its length plus one. -The conversion can result in an integer or a float, -according to the lexical conventions of Lua (see §3.1). -The string may have leading and trailing spaces and a sign. -If the string is not a valid numeral, -returns 0 and pushes nothing. -(Note that the result can be used as a boolean, -true if the conversion succeeds.) - - - - - -


lua_toboolean

-[-0, +0, –] -

int lua_toboolean (lua_State *L, int index);
- -

-Converts the Lua value at the given index to a C boolean -value (0 or 1). -Like all tests in Lua, -lua_toboolean returns true for any Lua value -different from false and nil; -otherwise it returns false. -(If you want to accept only actual boolean values, -use lua_isboolean to test the value's type.) - - - - - -


lua_tocfunction

-[-0, +0, –] -

lua_CFunction lua_tocfunction (lua_State *L, int index);
- -

-Converts a value at the given index to a C function. -That value must be a C function; -otherwise, returns NULL. - - - - - -


lua_tointeger

-[-0, +0, –] -

lua_Integer lua_tointeger (lua_State *L, int index);
- -

-Equivalent to lua_tointegerx with isnum equal to NULL. - - - - - -


lua_tointegerx

-[-0, +0, –] -

lua_Integer lua_tointegerx (lua_State *L, int index, int *isnum);
- -

-Converts the Lua value at the given index -to the signed integral type lua_Integer. -The Lua value must be an integer, -or a number or string convertible to an integer (see §3.4.3); -otherwise, lua_tointegerx returns 0. - - -

-If isnum is not NULL, -its referent is assigned a boolean value that -indicates whether the operation succeeded. - - - - - -


lua_tolstring

-[-0, +0, e] -

const char *lua_tolstring (lua_State *L, int index, size_t *len);
- -

-Converts the Lua value at the given index to a C string. -If len is not NULL, -it also sets *len with the string length. -The Lua value must be a string or a number; -otherwise, the function returns NULL. -If the value is a number, -then lua_tolstring also -changes the actual value in the stack to a string. -(This change confuses lua_next -when lua_tolstring is applied to keys during a table traversal.) - - -

-lua_tolstring returns a fully aligned pointer -to a string inside the Lua state. -This string always has a zero ('\0') -after its last character (as in C), -but can contain other zeros in its body. - - -

-Because Lua has garbage collection, -there is no guarantee that the pointer returned by lua_tolstring -will be valid after the corresponding Lua value is removed from the stack. - - - - - -


lua_tonumber

-[-0, +0, –] -

lua_Number lua_tonumber (lua_State *L, int index);
- -

-Equivalent to lua_tonumberx with isnum equal to NULL. - - - - - -


lua_tonumberx

-[-0, +0, –] -

lua_Number lua_tonumberx (lua_State *L, int index, int *isnum);
- -

-Converts the Lua value at the given index -to the C type lua_Number (see lua_Number). -The Lua value must be a number or a string convertible to a number -(see §3.4.3); -otherwise, lua_tonumberx returns 0. - - -

-If isnum is not NULL, -its referent is assigned a boolean value that -indicates whether the operation succeeded. - - - - - -


lua_topointer

-[-0, +0, –] -

const void *lua_topointer (lua_State *L, int index);
- -

-Converts the value at the given index to a generic -C pointer (void*). -The value can be a userdata, a table, a thread, or a function; -otherwise, lua_topointer returns NULL. -Different objects will give different pointers. -There is no way to convert the pointer back to its original value. - - -

-Typically this function is used only for hashing and debug information. - - - - - -


lua_tostring

-[-0, +0, e] -

const char *lua_tostring (lua_State *L, int index);
- -

-Equivalent to lua_tolstring with len equal to NULL. - - - - - -


lua_tothread

-[-0, +0, –] -

lua_State *lua_tothread (lua_State *L, int index);
- -

-Converts the value at the given index to a Lua thread -(represented as lua_State*). -This value must be a thread; -otherwise, the function returns NULL. - - - - - -


lua_touserdata

-[-0, +0, –] -

void *lua_touserdata (lua_State *L, int index);
- -

-If the value at the given index is a full userdata, -returns its block address. -If the value is a light userdata, -returns its pointer. -Otherwise, returns NULL. - - - - - -


lua_type

-[-0, +0, –] -

int lua_type (lua_State *L, int index);
- -

-Returns the type of the value in the given valid index, -or LUA_TNONE for a non-valid (but acceptable) index. -The types returned by lua_type are coded by the following constants -defined in lua.h: -LUA_TNIL (0), -LUA_TNUMBER, -LUA_TBOOLEAN, -LUA_TSTRING, -LUA_TTABLE, -LUA_TFUNCTION, -LUA_TUSERDATA, -LUA_TTHREAD, -and -LUA_TLIGHTUSERDATA. - - - - - -


lua_typename

-[-0, +0, –] -

const char *lua_typename (lua_State *L, int tp);
- -

-Returns the name of the type encoded by the value tp, -which must be one the values returned by lua_type. - - - - - -


lua_Unsigned

-
typedef ... lua_Unsigned;
- -

-The unsigned version of lua_Integer. - - - - - -


lua_upvalueindex

-[-0, +0, –] -

int lua_upvalueindex (int i);
- -

-Returns the pseudo-index that represents the i-th upvalue of -the running function (see §4.4). - - - - - -


lua_version

-[-0, +0, v] -

const lua_Number *lua_version (lua_State *L);
- -

-Returns the address of the version number stored in the Lua core. -When called with a valid lua_State, -returns the address of the version used to create that state. -When called with NULL, -returns the address of the version running the call. - - - - - -


lua_Writer

-
typedef int (*lua_Writer) (lua_State *L,
-                           const void* p,
-                           size_t sz,
-                           void* ud);
- -

-The type of the writer function used by lua_dump. -Every time it produces another piece of chunk, -lua_dump calls the writer, -passing along the buffer to be written (p), -its size (sz), -and the data parameter supplied to lua_dump. - - -

-The writer returns an error code: -0 means no errors; -any other value means an error and stops lua_dump from -calling the writer again. - - - - - -


lua_xmove

-[-?, +?, –] -

void lua_xmove (lua_State *from, lua_State *to, int n);
- -

-Exchange values between different threads of the same state. - - -

-This function pops n values from the stack from, -and pushes them onto the stack to. - - - - - -


lua_yield

-[-?, +?, e] -

int lua_yield (lua_State *L, int nresults);
- -

-This function is equivalent to lua_yieldk, -but it has no continuation (see §4.7). -Therefore, when the thread resumes, -it continues the function that called -the function calling lua_yield. - - - - - -


lua_yieldk

-[-?, +?, e] -

int lua_yieldk (lua_State *L,
-                int nresults,
-                lua_KContext ctx,
-                lua_KFunction k);
- -

-Yields a coroutine (thread). - - -

-When a C function calls lua_yieldk, -the running coroutine suspends its execution, -and the call to lua_resume that started this coroutine returns. -The parameter nresults is the number of values from the stack -that will be passed as results to lua_resume. - - -

-When the coroutine is resumed again, -Lua calls the given continuation function k to continue -the execution of the C function that yielded (see §4.7). -This continuation function receives the same stack -from the previous function, -with the n results removed and -replaced by the arguments passed to lua_resume. -Moreover, -the continuation function receives the value ctx -that was passed to lua_yieldk. - - -

-Usually, this function does not return; -when the coroutine eventually resumes, -it continues executing the continuation function. -However, there is one special case, -which is when this function is called -from inside a line hook (see §4.9). -In that case, lua_yieldk should be called with no continuation -(probably in the form of lua_yield), -and the hook should return immediately after the call. -Lua will yield and, -when the coroutine resumes again, -it will continue the normal execution -of the (Lua) function that triggered the hook. - - -

-This function can raise an error if it is called from a thread -with a pending C call with no continuation function, -or it is called from a thread that is not running inside a resume -(e.g., the main thread). - - - - - - - -

4.9 – The Debug Interface

- -

-Lua has no built-in debugging facilities. -Instead, it offers a special interface -by means of functions and hooks. -This interface allows the construction of different -kinds of debuggers, profilers, and other tools -that need "inside information" from the interpreter. - - - -


lua_Debug

-
typedef struct lua_Debug {
-  int event;
-  const char *name;           /* (n) */
-  const char *namewhat;       /* (n) */
-  const char *what;           /* (S) */
-  const char *source;         /* (S) */
-  int currentline;            /* (l) */
-  int linedefined;            /* (S) */
-  int lastlinedefined;        /* (S) */
-  unsigned char nups;         /* (u) number of upvalues */
-  unsigned char nparams;      /* (u) number of parameters */
-  char isvararg;              /* (u) */
-  char istailcall;            /* (t) */
-  char short_src[LUA_IDSIZE]; /* (S) */
-  /* private part */
-  other fields
-} lua_Debug;
- -

-A structure used to carry different pieces of -information about a function or an activation record. -lua_getstack fills only the private part -of this structure, for later use. -To fill the other fields of lua_Debug with useful information, -call lua_getinfo. - - -

-The fields of lua_Debug have the following meaning: - -

    - -
  • source: -the name of the chunk that created the function. -If source starts with a '@', -it means that the function was defined in a file where -the file name follows the '@'. -If source starts with a '=', -the remainder of its contents describe the source in a user-dependent manner. -Otherwise, -the function was defined in a string where -source is that string. -
  • - -
  • short_src: -a "printable" version of source, to be used in error messages. -
  • - -
  • linedefined: -the line number where the definition of the function starts. -
  • - -
  • lastlinedefined: -the line number where the definition of the function ends. -
  • - -
  • what: -the string "Lua" if the function is a Lua function, -"C" if it is a C function, -"main" if it is the main part of a chunk. -
  • - -
  • currentline: -the current line where the given function is executing. -When no line information is available, -currentline is set to -1. -
  • - -
  • name: -a reasonable name for the given function. -Because functions in Lua are first-class values, -they do not have a fixed name: -some functions can be the value of multiple global variables, -while others can be stored only in a table field. -The lua_getinfo function checks how the function was -called to find a suitable name. -If it cannot find a name, -then name is set to NULL. -
  • - -
  • namewhat: -explains the name field. -The value of namewhat can be -"global", "local", "method", -"field", "upvalue", or "" (the empty string), -according to how the function was called. -(Lua uses the empty string when no other option seems to apply.) -
  • - -
  • istailcall: -true if this function invocation was called by a tail call. -In this case, the caller of this level is not in the stack. -
  • - -
  • nups: -the number of upvalues of the function. -
  • - -
  • nparams: -the number of fixed parameters of the function -(always 0 for C functions). -
  • - -
  • isvararg: -true if the function is a vararg function -(always true for C functions). -
  • - -
- - - - -

lua_gethook

-[-0, +0, –] -

lua_Hook lua_gethook (lua_State *L);
- -

-Returns the current hook function. - - - - - -


lua_gethookcount

-[-0, +0, –] -

int lua_gethookcount (lua_State *L);
- -

-Returns the current hook count. - - - - - -


lua_gethookmask

-[-0, +0, –] -

int lua_gethookmask (lua_State *L);
- -

-Returns the current hook mask. - - - - - -


lua_getinfo

-[-(0|1), +(0|1|2), e] -

int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
- -

-Gets information about a specific function or function invocation. - - -

-To get information about a function invocation, -the parameter ar must be a valid activation record that was -filled by a previous call to lua_getstack or -given as argument to a hook (see lua_Hook). - - -

-To get information about a function you push it onto the stack -and start the what string with the character '>'. -(In that case, -lua_getinfo pops the function from the top of the stack.) -For instance, to know in which line a function f was defined, -you can write the following code: - -

-     lua_Debug ar;
-     lua_getglobal(L, "f");  /* get global 'f' */
-     lua_getinfo(L, ">S", &ar);
-     printf("%d\n", ar.linedefined);
-
- -

-Each character in the string what -selects some fields of the structure ar to be filled or -a value to be pushed on the stack: - -

    - -
  • 'n': fills in the field name and namewhat; -
  • - -
  • 'S': -fills in the fields source, short_src, -linedefined, lastlinedefined, and what; -
  • - -
  • 'l': fills in the field currentline; -
  • - -
  • 't': fills in the field istailcall; -
  • - -
  • 'u': fills in the fields -nups, nparams, and isvararg; -
  • - -
  • 'f': -pushes onto the stack the function that is -running at the given level; -
  • - -
  • 'L': -pushes onto the stack a table whose indices are the -numbers of the lines that are valid on the function. -(A valid line is a line with some associated code, -that is, a line where you can put a break point. -Non-valid lines include empty lines and comments.) - - -

    -If this option is given together with option 'f', -its table is pushed after the function. -

  • - -
- -

-This function returns 0 on error -(for instance, an invalid option in what). - - - - - -


lua_getlocal

-[-0, +(0|1), –] -

const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
- -

-Gets information about a local variable of -a given activation record or a given function. - - -

-In the first case, -the parameter ar must be a valid activation record that was -filled by a previous call to lua_getstack or -given as argument to a hook (see lua_Hook). -The index n selects which local variable to inspect; -see debug.getlocal for details about variable indices -and names. - - -

-lua_getlocal pushes the variable's value onto the stack -and returns its name. - - -

-In the second case, ar must be NULL and the function -to be inspected must be at the top of the stack. -In this case, only parameters of Lua functions are visible -(as there is no information about what variables are active) -and no values are pushed onto the stack. - - -

-Returns NULL (and pushes nothing) -when the index is greater than -the number of active local variables. - - - - - -


lua_getstack

-[-0, +0, –] -

int lua_getstack (lua_State *L, int level, lua_Debug *ar);
- -

-Gets information about the interpreter runtime stack. - - -

-This function fills parts of a lua_Debug structure with -an identification of the activation record -of the function executing at a given level. -Level 0 is the current running function, -whereas level n+1 is the function that has called level n -(except for tail calls, which do not count on the stack). -When there are no errors, lua_getstack returns 1; -when called with a level greater than the stack depth, -it returns 0. - - - - - -


lua_getupvalue

-[-0, +(0|1), –] -

const char *lua_getupvalue (lua_State *L, int funcindex, int n);
- -

-Gets information about the n-th upvalue -of the closure at index funcindex. -It pushes the upvalue's value onto the stack -and returns its name. -Returns NULL (and pushes nothing) -when the index n is greater than the number of upvalues. - - -

-For C functions, this function uses the empty string "" -as a name for all upvalues. -(For Lua functions, -upvalues are the external local variables that the function uses, -and that are consequently included in its closure.) - - -

-Upvalues have no particular order, -as they are active through the whole function. -They are numbered in an arbitrary order. - - - - - -


lua_Hook

-
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
- -

-Type for debugging hook functions. - - -

-Whenever a hook is called, its ar argument has its field -event set to the specific event that triggered the hook. -Lua identifies these events with the following constants: -LUA_HOOKCALL, LUA_HOOKRET, -LUA_HOOKTAILCALL, LUA_HOOKLINE, -and LUA_HOOKCOUNT. -Moreover, for line events, the field currentline is also set. -To get the value of any other field in ar, -the hook must call lua_getinfo. - - -

-For call events, event can be LUA_HOOKCALL, -the normal value, or LUA_HOOKTAILCALL, for a tail call; -in this case, there will be no corresponding return event. - - -

-While Lua is running a hook, it disables other calls to hooks. -Therefore, if a hook calls back Lua to execute a function or a chunk, -this execution occurs without any calls to hooks. - - -

-Hook functions cannot have continuations, -that is, they cannot call lua_yieldk, -lua_pcallk, or lua_callk with a non-null k. - - -

-Hook functions can yield under the following conditions: -Only count and line events can yield; -to yield, a hook function must finish its execution -calling lua_yield with nresults equal to zero -(that is, with no values). - - - - - -


lua_sethook

-[-0, +0, –] -

void lua_sethook (lua_State *L, lua_Hook f, int mask, int count);
- -

-Sets the debugging hook function. - - -

-Argument f is the hook function. -mask specifies on which events the hook will be called: -it is formed by a bitwise or of the constants -LUA_MASKCALL, -LUA_MASKRET, -LUA_MASKLINE, -and LUA_MASKCOUNT. -The count argument is only meaningful when the mask -includes LUA_MASKCOUNT. -For each event, the hook is called as explained below: - -

    - -
  • The call hook: is called when the interpreter calls a function. -The hook is called just after Lua enters the new function, -before the function gets its arguments. -
  • - -
  • The return hook: is called when the interpreter returns from a function. -The hook is called just before Lua leaves the function. -There is no standard way to access the values -to be returned by the function. -
  • - -
  • The line hook: is called when the interpreter is about to -start the execution of a new line of code, -or when it jumps back in the code (even to the same line). -(This event only happens while Lua is executing a Lua function.) -
  • - -
  • The count hook: is called after the interpreter executes every -count instructions. -(This event only happens while Lua is executing a Lua function.) -
  • - -
- -

-A hook is disabled by setting mask to zero. - - - - - -


lua_setlocal

-[-(0|1), +0, –] -

const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
- -

-Sets the value of a local variable of a given activation record. -It assigns the value at the top of the stack -to the variable and returns its name. -It also pops the value from the stack. - - -

-Returns NULL (and pops nothing) -when the index is greater than -the number of active local variables. - - -

-Parameters ar and n are as in function lua_getlocal. - - - - - -


lua_setupvalue

-[-(0|1), +0, –] -

const char *lua_setupvalue (lua_State *L, int funcindex, int n);
- -

-Sets the value of a closure's upvalue. -It assigns the value at the top of the stack -to the upvalue and returns its name. -It also pops the value from the stack. - - -

-Returns NULL (and pops nothing) -when the index n is greater than the number of upvalues. - - -

-Parameters funcindex and n are as in function lua_getupvalue. - - - - - -


lua_upvalueid

-[-0, +0, –] -

void *lua_upvalueid (lua_State *L, int funcindex, int n);
- -

-Returns a unique identifier for the upvalue numbered n -from the closure at index funcindex. - - -

-These unique identifiers allow a program to check whether different -closures share upvalues. -Lua closures that share an upvalue -(that is, that access a same external local variable) -will return identical ids for those upvalue indices. - - -

-Parameters funcindex and n are as in function lua_getupvalue, -but n cannot be greater than the number of upvalues. - - - - - -


lua_upvaluejoin

-[-0, +0, –] -

void lua_upvaluejoin (lua_State *L, int funcindex1, int n1,
-                                    int funcindex2, int n2);
- -

-Make the n1-th upvalue of the Lua closure at index funcindex1 -refer to the n2-th upvalue of the Lua closure at index funcindex2. - - - - - - - -

5 – The Auxiliary Library

- -

- -The auxiliary library provides several convenient functions -to interface C with Lua. -While the basic API provides the primitive functions for all -interactions between C and Lua, -the auxiliary library provides higher-level functions for some -common tasks. - - -

-All functions and types from the auxiliary library -are defined in header file lauxlib.h and -have a prefix luaL_. - - -

-All functions in the auxiliary library are built on -top of the basic API, -and so they provide nothing that cannot be done with that API. -Nevertheless, the use of the auxiliary library ensures -more consistency to your code. - - -

-Several functions in the auxiliary library use internally some -extra stack slots. -When a function in the auxiliary library uses less than five slots, -it does not check the stack size; -it simply assumes that there are enough slots. - - -

-Several functions in the auxiliary library are used to -check C function arguments. -Because the error message is formatted for arguments -(e.g., "bad argument #1"), -you should not use these functions for other stack values. - - -

-Functions called luaL_check* -always raise an error if the check is not satisfied. - - - -

5.1 – Functions and Types

- -

-Here we list all functions and types from the auxiliary library -in alphabetical order. - - - -


luaL_addchar

-[-?, +?, e] -

void luaL_addchar (luaL_Buffer *B, char c);
- -

-Adds the byte c to the buffer B -(see luaL_Buffer). - - - - - -


luaL_addlstring

-[-?, +?, e] -

void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l);
- -

-Adds the string pointed to by s with length l to -the buffer B -(see luaL_Buffer). -The string can contain embedded zeros. - - - - - -


luaL_addsize

-[-?, +?, e] -

void luaL_addsize (luaL_Buffer *B, size_t n);
- -

-Adds to the buffer B (see luaL_Buffer) -a string of length n previously copied to the -buffer area (see luaL_prepbuffer). - - - - - -


luaL_addstring

-[-?, +?, e] -

void luaL_addstring (luaL_Buffer *B, const char *s);
- -

-Adds the zero-terminated string pointed to by s -to the buffer B -(see luaL_Buffer). - - - - - -


luaL_addvalue

-[-1, +?, e] -

void luaL_addvalue (luaL_Buffer *B);
- -

-Adds the value at the top of the stack -to the buffer B -(see luaL_Buffer). -Pops the value. - - -

-This is the only function on string buffers that can (and must) -be called with an extra element on the stack, -which is the value to be added to the buffer. - - - - - -


luaL_argcheck

-[-0, +0, v] -

void luaL_argcheck (lua_State *L,
-                    int cond,
-                    int arg,
-                    const char *extramsg);
- -

-Checks whether cond is true. -If it is not, raises an error with a standard message (see luaL_argerror). - - - - - -


luaL_argerror

-[-0, +0, v] -

int luaL_argerror (lua_State *L, int arg, const char *extramsg);
- -

-Raises an error reporting a problem with argument arg -of the C function that called it, -using a standard message -that includes extramsg as a comment: - -

-     bad argument #arg to 'funcname' (extramsg)
-

-This function never returns. - - - - - -


luaL_Buffer

-
typedef struct luaL_Buffer luaL_Buffer;
- -

-Type for a string buffer. - - -

-A string buffer allows C code to build Lua strings piecemeal. -Its pattern of use is as follows: - -

    - -
  • First declare a variable b of type luaL_Buffer.
  • - -
  • Then initialize it with a call luaL_buffinit(L, &b).
  • - -
  • -Then add string pieces to the buffer calling any of -the luaL_add* functions. -
  • - -
  • -Finish by calling luaL_pushresult(&b). -This call leaves the final string on the top of the stack. -
  • - -
- -

-If you know beforehand the total size of the resulting string, -you can use the buffer like this: - -

    - -
  • First declare a variable b of type luaL_Buffer.
  • - -
  • Then initialize it and preallocate a space of -size sz with a call luaL_buffinitsize(L, &b, sz).
  • - -
  • Then copy the string into that space.
  • - -
  • -Finish by calling luaL_pushresultsize(&b, sz), -where sz is the total size of the resulting string -copied into that space. -
  • - -
- -

-During its normal operation, -a string buffer uses a variable number of stack slots. -So, while using a buffer, you cannot assume that you know where -the top of the stack is. -You can use the stack between successive calls to buffer operations -as long as that use is balanced; -that is, -when you call a buffer operation, -the stack is at the same level -it was immediately after the previous buffer operation. -(The only exception to this rule is luaL_addvalue.) -After calling luaL_pushresult the stack is back to its -level when the buffer was initialized, -plus the final string on its top. - - - - - -


luaL_buffinit

-[-0, +0, –] -

void luaL_buffinit (lua_State *L, luaL_Buffer *B);
- -

-Initializes a buffer B. -This function does not allocate any space; -the buffer must be declared as a variable -(see luaL_Buffer). - - - - - -


luaL_buffinitsize

-[-?, +?, e] -

char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz);
- -

-Equivalent to the sequence -luaL_buffinit, luaL_prepbuffsize. - - - - - -


luaL_callmeta

-[-0, +(0|1), e] -

int luaL_callmeta (lua_State *L, int obj, const char *e);
- -

-Calls a metamethod. - - -

-If the object at index obj has a metatable and this -metatable has a field e, -this function calls this field passing the object as its only argument. -In this case this function returns true and pushes onto the -stack the value returned by the call. -If there is no metatable or no metamethod, -this function returns false (without pushing any value on the stack). - - - - - -


luaL_checkany

-[-0, +0, v] -

void luaL_checkany (lua_State *L, int arg);
- -

-Checks whether the function has an argument -of any type (including nil) at position arg. - - - - - -


luaL_checkinteger

-[-0, +0, v] -

lua_Integer luaL_checkinteger (lua_State *L, int arg);
- -

-Checks whether the function argument arg is an integer -(or can be converted to an integer) -and returns this integer cast to a lua_Integer. - - - - - -


luaL_checklstring

-[-0, +0, v] -

const char *luaL_checklstring (lua_State *L, int arg, size_t *l);
- -

-Checks whether the function argument arg is a string -and returns this string; -if l is not NULL fills *l -with the string's length. - - -

-This function uses lua_tolstring to get its result, -so all conversions and caveats of that function apply here. - - - - - -


luaL_checknumber

-[-0, +0, v] -

lua_Number luaL_checknumber (lua_State *L, int arg);
- -

-Checks whether the function argument arg is a number -and returns this number. - - - - - -


luaL_checkoption

-[-0, +0, v] -

int luaL_checkoption (lua_State *L,
-                      int arg,
-                      const char *def,
-                      const char *const lst[]);
- -

-Checks whether the function argument arg is a string and -searches for this string in the array lst -(which must be NULL-terminated). -Returns the index in the array where the string was found. -Raises an error if the argument is not a string or -if the string cannot be found. - - -

-If def is not NULL, -the function uses def as a default value when -there is no argument arg or when this argument is nil. - - -

-This is a useful function for mapping strings to C enums. -(The usual convention in Lua libraries is -to use strings instead of numbers to select options.) - - - - - -


luaL_checkstack

-[-0, +0, v] -

void luaL_checkstack (lua_State *L, int sz, const char *msg);
- -

-Grows the stack size to top + sz elements, -raising an error if the stack cannot grow to that size. -msg is an additional text to go into the error message -(or NULL for no additional text). - - - - - -


luaL_checkstring

-[-0, +0, v] -

const char *luaL_checkstring (lua_State *L, int arg);
- -

-Checks whether the function argument arg is a string -and returns this string. - - -

-This function uses lua_tolstring to get its result, -so all conversions and caveats of that function apply here. - - - - - -


luaL_checktype

-[-0, +0, v] -

void luaL_checktype (lua_State *L, int arg, int t);
- -

-Checks whether the function argument arg has type t. -See lua_type for the encoding of types for t. - - - - - -


luaL_checkudata

-[-0, +0, v] -

void *luaL_checkudata (lua_State *L, int arg, const char *tname);
- -

-Checks whether the function argument arg is a userdata -of the type tname (see luaL_newmetatable) and -returns the userdata address (see lua_touserdata). - - - - - -


luaL_checkversion

-[-0, +0, –] -

void luaL_checkversion (lua_State *L);
- -

-Checks whether the core running the call, -the core that created the Lua state, -and the code making the call are all using the same version of Lua. -Also checks whether the core running the call -and the core that created the Lua state -are using the same address space. - - - - - -


luaL_dofile

-[-0, +?, e] -

int luaL_dofile (lua_State *L, const char *filename);
- -

-Loads and runs the given file. -It is defined as the following macro: - -

-     (luaL_loadfile(L, filename) || lua_pcall(L, 0, LUA_MULTRET, 0))
-

-It returns false if there are no errors -or true in case of errors. - - - - - -


luaL_dostring

-[-0, +?, –] -

int luaL_dostring (lua_State *L, const char *str);
- -

-Loads and runs the given string. -It is defined as the following macro: - -

-     (luaL_loadstring(L, str) || lua_pcall(L, 0, LUA_MULTRET, 0))
-

-It returns false if there are no errors -or true in case of errors. - - - - - -


luaL_error

-[-0, +0, v] -

int luaL_error (lua_State *L, const char *fmt, ...);
- -

-Raises an error. -The error message format is given by fmt -plus any extra arguments, -following the same rules of lua_pushfstring. -It also adds at the beginning of the message the file name and -the line number where the error occurred, -if this information is available. - - -

-This function never returns, -but it is an idiom to use it in C functions -as return luaL_error(args). - - - - - -


luaL_execresult

-[-0, +3, e] -

int luaL_execresult (lua_State *L, int stat);
- -

-This function produces the return values for -process-related functions in the standard library -(os.execute and io.close). - - - - - -


luaL_fileresult

-[-0, +(1|3), e] -

int luaL_fileresult (lua_State *L, int stat, const char *fname);
- -

-This function produces the return values for -file-related functions in the standard library -(io.open, os.rename, file:seek, etc.). - - - - - -


luaL_getmetafield

-[-0, +(0|1), e] -

int luaL_getmetafield (lua_State *L, int obj, const char *e);
- -

-Pushes onto the stack the field e from the metatable -of the object at index obj and returns the type of pushed value. -If the object does not have a metatable, -or if the metatable does not have this field, -pushes nothing and returns LUA_TNIL. - - - - - -


luaL_getmetatable

-[-0, +1, –] -

int luaL_getmetatable (lua_State *L, const char *tname);
- -

-Pushes onto the stack the metatable associated with name tname -in the registry (see luaL_newmetatable) -(nil if there is no metatable associated with that name). -Returns the type of the pushed value. - - - - - -


luaL_getsubtable

-[-0, +1, e] -

int luaL_getsubtable (lua_State *L, int idx, const char *fname);
- -

-Ensures that the value t[fname], -where t is the value at index idx, -is a table, -and pushes that table onto the stack. -Returns true if it finds a previous table there -and false if it creates a new table. - - - - - -


luaL_gsub

-[-0, +1, e] -

const char *luaL_gsub (lua_State *L,
-                       const char *s,
-                       const char *p,
-                       const char *r);
- -

-Creates a copy of string s by replacing -any occurrence of the string p -with the string r. -Pushes the resulting string on the stack and returns it. - - - - - -


luaL_len

-[-0, +0, e] -

lua_Integer luaL_len (lua_State *L, int index);
- -

-Returns the "length" of the value at the given index -as a number; -it is equivalent to the '#' operator in Lua (see §3.4.7). -Raises an error if the result of the operation is not an integer. -(This case only can happen through metamethods.) - - - - - -


luaL_loadbuffer

-[-0, +1, –] -

int luaL_loadbuffer (lua_State *L,
-                     const char *buff,
-                     size_t sz,
-                     const char *name);
- -

-Equivalent to luaL_loadbufferx with mode equal to NULL. - - - - - -


luaL_loadbufferx

-[-0, +1, –] -

int luaL_loadbufferx (lua_State *L,
-                      const char *buff,
-                      size_t sz,
-                      const char *name,
-                      const char *mode);
- -

-Loads a buffer as a Lua chunk. -This function uses lua_load to load the chunk in the -buffer pointed to by buff with size sz. - - -

-This function returns the same results as lua_load. -name is the chunk name, -used for debug information and error messages. -The string mode works as in function lua_load. - - - - - -


luaL_loadfile

-[-0, +1, e] -

int luaL_loadfile (lua_State *L, const char *filename);
- -

-Equivalent to luaL_loadfilex with mode equal to NULL. - - - - - -


luaL_loadfilex

-[-0, +1, e] -

int luaL_loadfilex (lua_State *L, const char *filename,
-                                            const char *mode);
- -

-Loads a file as a Lua chunk. -This function uses lua_load to load the chunk in the file -named filename. -If filename is NULL, -then it loads from the standard input. -The first line in the file is ignored if it starts with a #. - - -

-The string mode works as in function lua_load. - - -

-This function returns the same results as lua_load, -but it has an extra error code LUA_ERRFILE -if it cannot open/read the file or the file has a wrong mode. - - -

-As lua_load, this function only loads the chunk; -it does not run it. - - - - - -


luaL_loadstring

-[-0, +1, –] -

int luaL_loadstring (lua_State *L, const char *s);
- -

-Loads a string as a Lua chunk. -This function uses lua_load to load the chunk in -the zero-terminated string s. - - -

-This function returns the same results as lua_load. - - -

-Also as lua_load, this function only loads the chunk; -it does not run it. - - - - - -


luaL_newlib

-[-0, +1, e] -

void luaL_newlib (lua_State *L, const luaL_Reg l[]);
- -

-Creates a new table and registers there -the functions in list l. - - -

-It is implemented as the following macro: - -

-     (luaL_newlibtable(L,l), luaL_setfuncs(L,l,0))
-

-The array l must be the actual array, -not a pointer to it. - - - - - -


luaL_newlibtable

-[-0, +1, e] -

void luaL_newlibtable (lua_State *L, const luaL_Reg l[]);
- -

-Creates a new table with a size optimized -to store all entries in the array l -(but does not actually store them). -It is intended to be used in conjunction with luaL_setfuncs -(see luaL_newlib). - - -

-It is implemented as a macro. -The array l must be the actual array, -not a pointer to it. - - - - - -


luaL_newmetatable

-[-0, +1, e] -

int luaL_newmetatable (lua_State *L, const char *tname);
- -

-If the registry already has the key tname, -returns 0. -Otherwise, -creates a new table to be used as a metatable for userdata, -adds to this new table the pair __name = tname, -adds to the registry the pair [tname] = new table, -and returns 1. -(The entry __name is used by some error-reporting functions.) - - -

-In both cases pushes onto the stack the final value associated -with tname in the registry. - - - - - -


luaL_newstate

-[-0, +0, –] -

lua_State *luaL_newstate (void);
- -

-Creates a new Lua state. -It calls lua_newstate with an -allocator based on the standard C realloc function -and then sets a panic function (see §4.6) that prints -an error message to the standard error output in case of fatal -errors. - - -

-Returns the new state, -or NULL if there is a memory allocation error. - - - - - -


luaL_openlibs

-[-0, +0, e] -

void luaL_openlibs (lua_State *L);
- -

-Opens all standard Lua libraries into the given state. - - - - - -


luaL_optinteger

-[-0, +0, v] -

lua_Integer luaL_optinteger (lua_State *L,
-                             int arg,
-                             lua_Integer d);
- -

-If the function argument arg is an integer -(or convertible to an integer), -returns this integer. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_optlstring

-[-0, +0, v] -

const char *luaL_optlstring (lua_State *L,
-                             int arg,
-                             const char *d,
-                             size_t *l);
- -

-If the function argument arg is a string, -returns this string. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - -

-If l is not NULL, -fills the position *l with the result's length. - - - - - -


luaL_optnumber

-[-0, +0, v] -

lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number d);
- -

-If the function argument arg is a number, -returns this number. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_optstring

-[-0, +0, v] -

const char *luaL_optstring (lua_State *L,
-                            int arg,
-                            const char *d);
- -

-If the function argument arg is a string, -returns this string. -If this argument is absent or is nil, -returns d. -Otherwise, raises an error. - - - - - -


luaL_prepbuffer

-[-?, +?, e] -

char *luaL_prepbuffer (luaL_Buffer *B);
- -

-Equivalent to luaL_prepbuffsize -with the predefined size LUAL_BUFFERSIZE. - - - - - -


luaL_prepbuffsize

-[-?, +?, e] -

char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz);
- -

-Returns an address to a space of size sz -where you can copy a string to be added to buffer B -(see luaL_Buffer). -After copying the string into this space you must call -luaL_addsize with the size of the string to actually add -it to the buffer. - - - - - -


luaL_pushresult

-[-?, +1, e] -

void luaL_pushresult (luaL_Buffer *B);
- -

-Finishes the use of buffer B leaving the final string on -the top of the stack. - - - - - -


luaL_pushresultsize

-[-?, +1, e] -

void luaL_pushresultsize (luaL_Buffer *B, size_t sz);
- -

-Equivalent to the sequence luaL_addsize, luaL_pushresult. - - - - - -


luaL_ref

-[-1, +0, e] -

int luaL_ref (lua_State *L, int t);
- -

-Creates and returns a reference, -in the table at index t, -for the object at the top of the stack (and pops the object). - - -

-A reference is a unique integer key. -As long as you do not manually add integer keys into table t, -luaL_ref ensures the uniqueness of the key it returns. -You can retrieve an object referred by reference r -by calling lua_rawgeti(L, t, r). -Function luaL_unref frees a reference and its associated object. - - -

-If the object at the top of the stack is nil, -luaL_ref returns the constant LUA_REFNIL. -The constant LUA_NOREF is guaranteed to be different -from any reference returned by luaL_ref. - - - - - -


luaL_Reg

-
typedef struct luaL_Reg {
-  const char *name;
-  lua_CFunction func;
-} luaL_Reg;
- -

-Type for arrays of functions to be registered by -luaL_setfuncs. -name is the function name and func is a pointer to -the function. -Any array of luaL_Reg must end with a sentinel entry -in which both name and func are NULL. - - - - - -


luaL_requiref

-[-0, +1, e] -

void luaL_requiref (lua_State *L, const char *modname,
-                    lua_CFunction openf, int glb);
- -

-If modname is not already present in package.loaded, -calls function openf with string modname as an argument -and sets the call result in package.loaded[modname], -as if that function has been called through require. - - -

-If glb is true, -also stores the module into global modname. - - -

-Leaves a copy of the module on the stack. - - - - - -


luaL_setfuncs

-[-nup, +0, e] -

void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
- -

-Registers all functions in the array l -(see luaL_Reg) into the table on the top of the stack -(below optional upvalues, see next). - - -

-When nup is not zero, -all functions are created sharing nup upvalues, -which must be previously pushed on the stack -on top of the library table. -These values are popped from the stack after the registration. - - - - - -


luaL_setmetatable

-[-0, +0, –] -

void luaL_setmetatable (lua_State *L, const char *tname);
- -

-Sets the metatable of the object at the top of the stack -as the metatable associated with name tname -in the registry (see luaL_newmetatable). - - - - - -


luaL_Stream

-
typedef struct luaL_Stream {
-  FILE *f;
-  lua_CFunction closef;
-} luaL_Stream;
- -

-The standard representation for file handles, -which is used by the standard I/O library. - - -

-A file handle is implemented as a full userdata, -with a metatable called LUA_FILEHANDLE -(where LUA_FILEHANDLE is a macro with the actual metatable's name). -The metatable is created by the I/O library -(see luaL_newmetatable). - - -

-This userdata must start with the structure luaL_Stream; -it can contain other data after this initial structure. -Field f points to the corresponding C stream -(or it can be NULL to indicate an incompletely created handle). -Field closef points to a Lua function -that will be called to close the stream -when the handle is closed or collected; -this function receives the file handle as its sole argument and -must return either true (in case of success) -or nil plus an error message (in case of error). -Once Lua calls this field, -the field value is changed to NULL -to signal that the handle is closed. - - - - - -


luaL_testudata

-[-0, +0, e] -

void *luaL_testudata (lua_State *L, int arg, const char *tname);
- -

-This function works like luaL_checkudata, -except that, when the test fails, -it returns NULL instead of raising an error. - - - - - -


luaL_tolstring

-[-0, +1, e] -

const char *luaL_tolstring (lua_State *L, int idx, size_t *len);
- -

-Converts any Lua value at the given index to a C string -in a reasonable format. -The resulting string is pushed onto the stack and also -returned by the function. -If len is not NULL, -the function also sets *len with the string length. - - -

-If the value has a metatable with a "__tostring" field, -then luaL_tolstring calls the corresponding metamethod -with the value as argument, -and uses the result of the call as its result. - - - - - -


luaL_traceback

-[-0, +1, e] -

void luaL_traceback (lua_State *L, lua_State *L1, const char *msg,
-                     int level);
- -

-Creates and pushes a traceback of the stack L1. -If msg is not NULL it is appended -at the beginning of the traceback. -The level parameter tells at which level -to start the traceback. - - - - - -


luaL_typename

-[-0, +0, –] -

const char *luaL_typename (lua_State *L, int index);
- -

-Returns the name of the type of the value at the given index. - - - - - -


luaL_unref

-[-0, +0, –] -

void luaL_unref (lua_State *L, int t, int ref);
- -

-Releases reference ref from the table at index t -(see luaL_ref). -The entry is removed from the table, -so that the referred object can be collected. -The reference ref is also freed to be used again. - - -

-If ref is LUA_NOREF or LUA_REFNIL, -luaL_unref does nothing. - - - - - -


luaL_where

-[-0, +1, e] -

void luaL_where (lua_State *L, int lvl);
- -

-Pushes onto the stack a string identifying the current position -of the control at level lvl in the call stack. -Typically this string has the following format: - -

-     chunkname:currentline:
-

-Level 0 is the running function, -level 1 is the function that called the running function, -etc. - - -

-This function is used to build a prefix for error messages. - - - - - - - -

6 – Standard Libraries

- -

-The standard Lua libraries provide useful functions -that are implemented directly through the C API. -Some of these functions provide essential services to the language -(e.g., type and getmetatable); -others provide access to "outside" services (e.g., I/O); -and others could be implemented in Lua itself, -but are quite useful or have critical performance requirements that -deserve an implementation in C (e.g., table.sort). - - -

-All libraries are implemented through the official C API -and are provided as separate C modules. -Currently, Lua has the following standard libraries: - -

    - -
  • basic library (§6.1);
  • - -
  • coroutine library (§6.2);
  • - -
  • package library (§6.3);
  • - -
  • string manipulation (§6.4);
  • - -
  • basic UTF-8 support (§6.5);
  • - -
  • table manipulation (§6.6);
  • - -
  • mathematical functions (§6.7) (sin, log, etc.);
  • - -
  • input and output (§6.8);
  • - -
  • operating system facilities (§6.9);
  • - -
  • debug facilities (§6.10).
  • - -

-Except for the basic and the package libraries, -each library provides all its functions as fields of a global table -or as methods of its objects. - - -

-To have access to these libraries, -the C host program should call the luaL_openlibs function, -which opens all standard libraries. -Alternatively, -the host program can open them individually by using -luaL_requiref to call -luaopen_base (for the basic library), -luaopen_package (for the package library), -luaopen_coroutine (for the coroutine library), -luaopen_string (for the string library), -luaopen_utf8 (for the UTF8 library), -luaopen_table (for the table library), -luaopen_math (for the mathematical library), -luaopen_io (for the I/O library), -luaopen_os (for the operating system library), -and luaopen_debug (for the debug library). -These functions are declared in lualib.h. - - - -

6.1 – Basic Functions

- -

-The basic library provides core functions to Lua. -If you do not include this library in your application, -you should check carefully whether you need to provide -implementations for some of its facilities. - - -

-


assert (v [, message])

- - -

-Calls error if -the value of its argument v is false (i.e., nil or false); -otherwise, returns all its arguments. -In case of error, -message is the error object; -when absent, it defaults to "assertion failed!" - - - - -

-


collectgarbage ([opt [, arg]])

- - -

-This function is a generic interface to the garbage collector. -It performs different functions according to its first argument, opt: - -

    - -
  • "collect": -performs a full garbage-collection cycle. -This is the default option. -
  • - -
  • "stop": -stops automatic execution of the garbage collector. -The collector will run only when explicitly invoked, -until a call to restart it. -
  • - -
  • "restart": -restarts automatic execution of the garbage collector. -
  • - -
  • "count": -returns the total memory in use by Lua in Kbytes. -The value has a fractional part, -so that it multiplied by 1024 -gives the exact number of bytes in use by Lua -(except for overflows). -
  • - -
  • "step": -performs a garbage-collection step. -The step "size" is controlled by arg. -With a zero value, -the collector will perform one basic (indivisible) step. -For non-zero values, -the collector will perform as if that amount of memory -(in KBytes) had been allocated by Lua. -Returns true if the step finished a collection cycle. -
  • - -
  • "setpause": -sets arg as the new value for the pause of -the collector (see §2.5). -Returns the previous value for pause. -
  • - -
  • "setstepmul": -sets arg as the new value for the step multiplier of -the collector (see §2.5). -Returns the previous value for step. -
  • - -
  • "isrunning": -returns a boolean that tells whether the collector is running -(i.e., not stopped). -
  • - -
- - - -

-


dofile ([filename])

-Opens the named file and executes its contents as a Lua chunk. -When called without arguments, -dofile executes the contents of the standard input (stdin). -Returns all values returned by the chunk. -In case of errors, dofile propagates the error -to its caller (that is, dofile does not run in protected mode). - - - - -

-


error (message [, level])

-Terminates the last protected function called -and returns message as the error object. -Function error never returns. - - -

-Usually, error adds some information about the error position -at the beginning of the message, if the message is a string. -The level argument specifies how to get the error position. -With level 1 (the default), the error position is where the -error function was called. -Level 2 points the error to where the function -that called error was called; and so on. -Passing a level 0 avoids the addition of error position information -to the message. - - - - -

-


_G

-A global variable (not a function) that -holds the global environment (see §2.2). -Lua itself does not use this variable; -changing its value does not affect any environment, -nor vice versa. - - - - -

-


getmetatable (object)

- - -

-If object does not have a metatable, returns nil. -Otherwise, -if the object's metatable has a "__metatable" field, -returns the associated value. -Otherwise, returns the metatable of the given object. - - - - -

-


ipairs (t)

- - -

-Returns three values (an iterator function, the table t, and 0) -so that the construction - -

-     for i,v in ipairs(t) do body end
-

-will iterate over the key–value pairs -(1,t[1]), (2,t[2]), ..., -up to the first nil value. - - - - -

-


load (chunk [, chunkname [, mode [, env]]])

- - -

-Loads a chunk. - - -

-If chunk is a string, the chunk is this string. -If chunk is a function, -load calls it repeatedly to get the chunk pieces. -Each call to chunk must return a string that concatenates -with previous results. -A return of an empty string, nil, or no value signals the end of the chunk. - - -

-If there are no syntactic errors, -returns the compiled chunk as a function; -otherwise, returns nil plus the error message. - - -

-If the resulting function has upvalues, -the first upvalue is set to the value of env, -if that parameter is given, -or to the value of the global environment. -Other upvalues are initialized with nil. -(When you load a main chunk, -the resulting function will always have exactly one upvalue, -the _ENV variable (see §2.2). -However, -when you load a binary chunk created from a function (see string.dump), -the resulting function can have an arbitrary number of upvalues.) -All upvalues are fresh, that is, -they are not shared with any other function. - - -

-chunkname is used as the name of the chunk for error messages -and debug information (see §4.9). -When absent, -it defaults to chunk, if chunk is a string, -or to "=(load)" otherwise. - - -

-The string mode controls whether the chunk can be text or binary -(that is, a precompiled chunk). -It may be the string "b" (only binary chunks), -"t" (only text chunks), -or "bt" (both binary and text). -The default is "bt". - - -

-Lua does not check the consistency of binary chunks. -Maliciously crafted binary chunks can crash -the interpreter. - - - - -

-


loadfile ([filename [, mode [, env]]])

- - -

-Similar to load, -but gets the chunk from file filename -or from the standard input, -if no file name is given. - - - - -

-


next (table [, index])

- - -

-Allows a program to traverse all fields of a table. -Its first argument is a table and its second argument -is an index in this table. -next returns the next index of the table -and its associated value. -When called with nil as its second argument, -next returns an initial index -and its associated value. -When called with the last index, -or with nil in an empty table, -next returns nil. -If the second argument is absent, then it is interpreted as nil. -In particular, -you can use next(t) to check whether a table is empty. - - -

-The order in which the indices are enumerated is not specified, -even for numeric indices. -(To traverse a table in numerical order, -use a numerical for.) - - -

-The behavior of next is undefined if, -during the traversal, -you assign any value to a non-existent field in the table. -You may however modify existing fields. -In particular, you may clear existing fields. - - - - -

-


pairs (t)

- - -

-If t has a metamethod __pairs, -calls it with t as argument and returns the first three -results from the call. - - -

-Otherwise, -returns three values: the next function, the table t, and nil, -so that the construction - -

-     for k,v in pairs(t) do body end
-

-will iterate over all key–value pairs of table t. - - -

-See function next for the caveats of modifying -the table during its traversal. - - - - -

-


pcall (f [, arg1, ···])

- - -

-Calls function f with -the given arguments in protected mode. -This means that any error inside f is not propagated; -instead, pcall catches the error -and returns a status code. -Its first result is the status code (a boolean), -which is true if the call succeeds without errors. -In such case, pcall also returns all results from the call, -after this first result. -In case of any error, pcall returns false plus the error message. - - - - -

-


print (···)

-Receives any number of arguments -and prints their values to stdout, -using the tostring function to convert each argument to a string. -print is not intended for formatted output, -but only as a quick way to show a value, -for instance for debugging. -For complete control over the output, -use string.format and io.write. - - - - -

-


rawequal (v1, v2)

-Checks whether v1 is equal to v2, -without invoking any metamethod. -Returns a boolean. - - - - -

-


rawget (table, index)

-Gets the real value of table[index], -without invoking any metamethod. -table must be a table; -index may be any value. - - - - -

-


rawlen (v)

-Returns the length of the object v, -which must be a table or a string, -without invoking any metamethod. -Returns an integer. - - - - -

-


rawset (table, index, value)

-Sets the real value of table[index] to value, -without invoking any metamethod. -table must be a table, -index any value different from nil and NaN, -and value any Lua value. - - -

-This function returns table. - - - - -

-


select (index, ···)

- - -

-If index is a number, -returns all arguments after argument number index; -a negative number indexes from the end (-1 is the last argument). -Otherwise, index must be the string "#", -and select returns the total number of extra arguments it received. - - - - -

-


setmetatable (table, metatable)

- - -

-Sets the metatable for the given table. -(You cannot change the metatable of other types from Lua, only from C.) -If metatable is nil, -removes the metatable of the given table. -If the original metatable has a "__metatable" field, -raises an error. - - -

-This function returns table. - - - - -

-


tonumber (e [, base])

- - -

-When called with no base, -tonumber tries to convert its argument to a number. -If the argument is already a number or -a string convertible to a number, -then tonumber returns this number; -otherwise, it returns nil. - - -

-The conversion of strings can result in integers or floats, -according to the lexical conventions of Lua (see §3.1). -(The string may have leading and trailing spaces and a sign.) - - -

-When called with base, -then e must be a string to be interpreted as -an integer numeral in that base. -The base may be any integer between 2 and 36, inclusive. -In bases above 10, the letter 'A' (in either upper or lower case) -represents 10, 'B' represents 11, and so forth, -with 'Z' representing 35. -If the string e is not a valid numeral in the given base, -the function returns nil. - - - - -

-


tostring (v)

-Receives a value of any type and -converts it to a string in a human-readable format. -(For complete control of how numbers are converted, -use string.format.) - - -

-If the metatable of v has a "__tostring" field, -then tostring calls the corresponding value -with v as argument, -and uses the result of the call as its result. - - - - -

-


type (v)

-Returns the type of its only argument, coded as a string. -The possible results of this function are -"nil" (a string, not the value nil), -"number", -"string", -"boolean", -"table", -"function", -"thread", -and "userdata". - - - - -

-


_VERSION

-A global variable (not a function) that -holds a string containing the current interpreter version. -The current value of this variable is "Lua 5.3". - - - - -

-


xpcall (f, msgh [, arg1, ···])

- - -

-This function is similar to pcall, -except that it sets a new message handler msgh. - - - - - - - -

6.2 – Coroutine Manipulation

- -

-This library comprises the operations to manipulate coroutines, -which come inside the table coroutine. -See §2.6 for a general description of coroutines. - - -

-


coroutine.create (f)

- - -

-Creates a new coroutine, with body f. -f must be a function. -Returns this new coroutine, -an object with type "thread". - - - - -

-


coroutine.isyieldable ()

- - -

-Returns true when the running coroutine can yield. - - -

-A running coroutine is yieldable if it is not the main thread and -it is not inside a non-yieldable C function. - - - - -

-


coroutine.resume (co [, val1, ···])

- - -

-Starts or continues the execution of coroutine co. -The first time you resume a coroutine, -it starts running its body. -The values val1, ... are passed -as the arguments to the body function. -If the coroutine has yielded, -resume restarts it; -the values val1, ... are passed -as the results from the yield. - - -

-If the coroutine runs without any errors, -resume returns true plus any values passed to yield -(when the coroutine yields) or any values returned by the body function -(when the coroutine terminates). -If there is any error, -resume returns false plus the error message. - - - - -

-


coroutine.running ()

- - -

-Returns the running coroutine plus a boolean, -true when the running coroutine is the main one. - - - - -

-


coroutine.status (co)

- - -

-Returns the status of coroutine co, as a string: -"running", -if the coroutine is running (that is, it called status); -"suspended", if the coroutine is suspended in a call to yield, -or if it has not started running yet; -"normal" if the coroutine is active but not running -(that is, it has resumed another coroutine); -and "dead" if the coroutine has finished its body function, -or if it has stopped with an error. - - - - -

-


coroutine.wrap (f)

- - -

-Creates a new coroutine, with body f. -f must be a function. -Returns a function that resumes the coroutine each time it is called. -Any arguments passed to the function behave as the -extra arguments to resume. -Returns the same values returned by resume, -except the first boolean. -In case of error, propagates the error. - - - - -

-


coroutine.yield (···)

- - -

-Suspends the execution of the calling coroutine. -Any arguments to yield are passed as extra results to resume. - - - - - - - -

6.3 – Modules

- -

-The package library provides basic -facilities for loading modules in Lua. -It exports one function directly in the global environment: -require. -Everything else is exported in a table package. - - -

-


require (modname)

- - -

-Loads the given module. -The function starts by looking into the package.loaded table -to determine whether modname is already loaded. -If it is, then require returns the value stored -at package.loaded[modname]. -Otherwise, it tries to find a loader for the module. - - -

-To find a loader, -require is guided by the package.searchers sequence. -By changing this sequence, -we can change how require looks for a module. -The following explanation is based on the default configuration -for package.searchers. - - -

-First require queries package.preload[modname]. -If it has a value, -this value (which must be a function) is the loader. -Otherwise require searches for a Lua loader using the -path stored in package.path. -If that also fails, it searches for a C loader using the -path stored in package.cpath. -If that also fails, -it tries an all-in-one loader (see package.searchers). - - -

-Once a loader is found, -require calls the loader with two arguments: -modname and an extra value dependent on how it got the loader. -(If the loader came from a file, -this extra value is the file name.) -If the loader returns any non-nil value, -require assigns the returned value to package.loaded[modname]. -If the loader does not return a non-nil value and -has not assigned any value to package.loaded[modname], -then require assigns true to this entry. -In any case, require returns the -final value of package.loaded[modname]. - - -

-If there is any error loading or running the module, -or if it cannot find any loader for the module, -then require raises an error. - - - - -

-


package.config

- - -

-A string describing some compile-time configurations for packages. -This string is a sequence of lines: - -

    - -
  • The first line is the directory separator string. -Default is '\' for Windows and '/' for all other systems.
  • - -
  • The second line is the character that separates templates in a path. -Default is ';'.
  • - -
  • The third line is the string that marks the -substitution points in a template. -Default is '?'.
  • - -
  • The fourth line is a string that, in a path in Windows, -is replaced by the executable's directory. -Default is '!'.
  • - -
  • The fifth line is a mark to ignore all text after it -when building the luaopen_ function name. -Default is '-'.
  • - -
- - - -

-


package.cpath

- - -

-The path used by require to search for a C loader. - - -

-Lua initializes the C path package.cpath in the same way -it initializes the Lua path package.path, -using the environment variable LUA_CPATH_5_3 -or the environment variable LUA_CPATH -or a default path defined in luaconf.h. - - - - -

-


package.loaded

- - -

-A table used by require to control which -modules are already loaded. -When you require a module modname and -package.loaded[modname] is not false, -require simply returns the value stored there. - - -

-This variable is only a reference to the real table; -assignments to this variable do not change the -table used by require. - - - - -

-


package.loadlib (libname, funcname)

- - -

-Dynamically links the host program with the C library libname. - - -

-If funcname is "*", -then it only links with the library, -making the symbols exported by the library -available to other dynamically linked libraries. -Otherwise, -it looks for a function funcname inside the library -and returns this function as a C function. -So, funcname must follow the lua_CFunction prototype -(see lua_CFunction). - - -

-This is a low-level function. -It completely bypasses the package and module system. -Unlike require, -it does not perform any path searching and -does not automatically adds extensions. -libname must be the complete file name of the C library, -including if necessary a path and an extension. -funcname must be the exact name exported by the C library -(which may depend on the C compiler and linker used). - - -

-This function is not supported by Standard C. -As such, it is only available on some platforms -(Windows, Linux, Mac OS X, Solaris, BSD, -plus other Unix systems that support the dlfcn standard). - - - - -

-


package.path

- - -

-The path used by require to search for a Lua loader. - - -

-At start-up, Lua initializes this variable with -the value of the environment variable LUA_PATH_5_3 or -the environment variable LUA_PATH or -with a default path defined in luaconf.h, -if those environment variables are not defined. -Any ";;" in the value of the environment variable -is replaced by the default path. - - - - -

-


package.preload

- - -

-A table to store loaders for specific modules -(see require). - - -

-This variable is only a reference to the real table; -assignments to this variable do not change the -table used by require. - - - - -

-


package.searchers

- - -

-A table used by require to control how to load modules. - - -

-Each entry in this table is a searcher function. -When looking for a module, -require calls each of these searchers in ascending order, -with the module name (the argument given to require) as its -sole parameter. -The function can return another function (the module loader) -plus an extra value that will be passed to that loader, -or a string explaining why it did not find that module -(or nil if it has nothing to say). - - -

-Lua initializes this table with four searcher functions. - - -

-The first searcher simply looks for a loader in the -package.preload table. - - -

-The second searcher looks for a loader as a Lua library, -using the path stored at package.path. -The search is done as described in function package.searchpath. - - -

-The third searcher looks for a loader as a C library, -using the path given by the variable package.cpath. -Again, -the search is done as described in function package.searchpath. -For instance, -if the C path is the string - -

-     "./?.so;./?.dll;/usr/local/?/init.so"
-

-the searcher for module foo -will try to open the files ./foo.so, ./foo.dll, -and /usr/local/foo/init.so, in that order. -Once it finds a C library, -this searcher first uses a dynamic link facility to link the -application with the library. -Then it tries to find a C function inside the library to -be used as the loader. -The name of this C function is the string "luaopen_" -concatenated with a copy of the module name where each dot -is replaced by an underscore. -Moreover, if the module name has a hyphen, -its suffix after (and including) the first hyphen is removed. -For instance, if the module name is a.b.c-v2.1, -the function name will be luaopen_a_b_c. - - -

-The fourth searcher tries an all-in-one loader. -It searches the C path for a library for -the root name of the given module. -For instance, when requiring a.b.c, -it will search for a C library for a. -If found, it looks into it for an open function for -the submodule; -in our example, that would be luaopen_a_b_c. -With this facility, a package can pack several C submodules -into one single library, -with each submodule keeping its original open function. - - -

-All searchers except the first one (preload) return as the extra value -the file name where the module was found, -as returned by package.searchpath. -The first searcher returns no extra value. - - - - -

-


package.searchpath (name, path [, sep [, rep]])

- - -

-Searches for the given name in the given path. - - -

-A path is a string containing a sequence of -templates separated by semicolons. -For each template, -the function replaces each interrogation mark (if any) -in the template with a copy of name -wherein all occurrences of sep -(a dot, by default) -were replaced by rep -(the system's directory separator, by default), -and then tries to open the resulting file name. - - -

-For instance, if the path is the string - -

-     "./?.lua;./?.lc;/usr/local/?/init.lua"
-

-the search for the name foo.a -will try to open the files -./foo/a.lua, ./foo/a.lc, and -/usr/local/foo/a/init.lua, in that order. - - -

-Returns the resulting name of the first file that it can -open in read mode (after closing the file), -or nil plus an error message if none succeeds. -(This error message lists all file names it tried to open.) - - - - - - - -

6.4 – String Manipulation

- -

-This library provides generic functions for string manipulation, -such as finding and extracting substrings, and pattern matching. -When indexing a string in Lua, the first character is at position 1 -(not at 0, as in C). -Indices are allowed to be negative and are interpreted as indexing backwards, -from the end of the string. -Thus, the last character is at position -1, and so on. - - -

-The string library provides all its functions inside the table -string. -It also sets a metatable for strings -where the __index field points to the string table. -Therefore, you can use the string functions in object-oriented style. -For instance, string.byte(s,i) -can be written as s:byte(i). - - -

-The string library assumes one-byte character encodings. - - -

-


string.byte (s [, i [, j]])

-Returns the internal numeric codes of the characters s[i], -s[i+1], ..., s[j]. -The default value for i is 1; -the default value for j is i. -These indices are corrected -following the same rules of function string.sub. - - -

-Numeric codes are not necessarily portable across platforms. - - - - -

-


string.char (···)

-Receives zero or more integers. -Returns a string with length equal to the number of arguments, -in which each character has the internal numeric code equal -to its corresponding argument. - - -

-Numeric codes are not necessarily portable across platforms. - - - - -

-


string.dump (function [, strip])

- - -

-Returns a string containing a binary representation -(a binary chunk) -of the given function, -so that a later load on this string returns -a copy of the function (but with new upvalues). -If strip is a true value, -the binary representation may not include all debug information -about the function, -to save space. - - -

-Functions with upvalues have only their number of upvalues saved. -When (re)loaded, -those upvalues receive fresh instances containing nil. -(You can use the debug library to serialize -and reload the upvalues of a function -in a way adequate to your needs.) - - - - -

-


string.find (s, pattern [, init [, plain]])

- - -

-Looks for the first match of -pattern (see §6.4.1) in the string s. -If it finds a match, then find returns the indices of s -where this occurrence starts and ends; -otherwise, it returns nil. -A third, optional numeric argument init specifies -where to start the search; -its default value is 1 and can be negative. -A value of true as a fourth, optional argument plain -turns off the pattern matching facilities, -so the function does a plain "find substring" operation, -with no characters in pattern being considered magic. -Note that if plain is given, then init must be given as well. - - -

-If the pattern has captures, -then in a successful match -the captured values are also returned, -after the two indices. - - - - -

-


string.format (formatstring, ···)

- - -

-Returns a formatted version of its variable number of arguments -following the description given in its first argument (which must be a string). -The format string follows the same rules as the ISO C function sprintf. -The only differences are that the options/modifiers -*, h, L, l, n, -and p are not supported -and that there is an extra option, q. -The q option formats a string between double quotes, -using escape sequences when necessary to ensure that -it can safely be read back by the Lua interpreter. -For instance, the call - -

-     string.format('%q', 'a string with "quotes" and \n new line')
-

-may produce the string: - -

-     "a string with \"quotes\" and \
-      new line"
-
- -

-Options -A, a, E, e, f, -G, and g all expect a number as argument. -Options c, d, -i, o, u, X, and x -expect an integer. -Option q expects a string. -Option s expects a string without embedded zeros; -if its argument is not a string, -it is converted to one following the same rules of tostring. - - -

-When Lua is compiled with a non-C99 compiler, -options A and a (hexadecimal floats) -do not support any modifier (flags, width, length). - - - - -

-


string.gmatch (s, pattern)

-Returns an iterator function that, -each time it is called, -returns the next captures from pattern (see §6.4.1) -over the string s. -If pattern specifies no captures, -then the whole match is produced in each call. - - -

-As an example, the following loop -will iterate over all the words from string s, -printing one per line: - -

-     s = "hello world from Lua"
-     for w in string.gmatch(s, "%a+") do
-       print(w)
-     end
-

-The next example collects all pairs key=value from the -given string into a table: - -

-     t = {}
-     s = "from=world, to=Lua"
-     for k, v in string.gmatch(s, "(%w+)=(%w+)") do
-       t[k] = v
-     end
-
- -

-For this function, a caret '^' at the start of a pattern does not -work as an anchor, as this would prevent the iteration. - - - - -

-


string.gsub (s, pattern, repl [, n])

-Returns a copy of s -in which all (or the first n, if given) -occurrences of the pattern (see §6.4.1) have been -replaced by a replacement string specified by repl, -which can be a string, a table, or a function. -gsub also returns, as its second value, -the total number of matches that occurred. -The name gsub comes from Global SUBstitution. - - -

-If repl is a string, then its value is used for replacement. -The character % works as an escape character: -any sequence in repl of the form %d, -with d between 1 and 9, -stands for the value of the d-th captured substring. -The sequence %0 stands for the whole match. -The sequence %% stands for a single %. - - -

-If repl is a table, then the table is queried for every match, -using the first capture as the key. - - -

-If repl is a function, then this function is called every time a -match occurs, with all captured substrings passed as arguments, -in order. - - -

-In any case, -if the pattern specifies no captures, -then it behaves as if the whole pattern was inside a capture. - - -

-If the value returned by the table query or by the function call -is a string or a number, -then it is used as the replacement string; -otherwise, if it is false or nil, -then there is no replacement -(that is, the original match is kept in the string). - - -

-Here are some examples: - -

-     x = string.gsub("hello world", "(%w+)", "%1 %1")
-     --> x="hello hello world world"
-     
-     x = string.gsub("hello world", "%w+", "%0 %0", 1)
-     --> x="hello hello world"
-     
-     x = string.gsub("hello world from Lua", "(%w+)%s*(%w+)", "%2 %1")
-     --> x="world hello Lua from"
-     
-     x = string.gsub("home = $HOME, user = $USER", "%$(%w+)", os.getenv)
-     --> x="home = /home/roberto, user = roberto"
-     
-     x = string.gsub("4+5 = $return 4+5$", "%$(.-)%$", function (s)
-           return load(s)()
-         end)
-     --> x="4+5 = 9"
-     
-     local t = {name="lua", version="5.3"}
-     x = string.gsub("$name-$version.tar.gz", "%$(%w+)", t)
-     --> x="lua-5.3.tar.gz"
-
- - - -

-


string.len (s)

-Receives a string and returns its length. -The empty string "" has length 0. -Embedded zeros are counted, -so "a\000bc\000" has length 5. - - - - -

-


string.lower (s)

-Receives a string and returns a copy of this string with all -uppercase letters changed to lowercase. -All other characters are left unchanged. -The definition of what an uppercase letter is depends on the current locale. - - - - -

-


string.match (s, pattern [, init])

-Looks for the first match of -pattern (see §6.4.1) in the string s. -If it finds one, then match returns -the captures from the pattern; -otherwise it returns nil. -If pattern specifies no captures, -then the whole match is returned. -A third, optional numeric argument init specifies -where to start the search; -its default value is 1 and can be negative. - - - - -

-


string.pack (fmt, v1, v2, ···)

- - -

-Returns a binary string containing the values v1, v2, etc. -packed (that is, serialized in binary form) -according to the format string fmt (see §6.4.2). - - - - -

-


string.packsize (fmt)

- - -

-Returns the size of a string resulting from string.pack -with the given format. -The format string cannot have the variable-length options -'s' or 'z' (see §6.4.2). - - - - -

-


string.rep (s, n [, sep])

-Returns a string that is the concatenation of n copies of -the string s separated by the string sep. -The default value for sep is the empty string -(that is, no separator). -Returns the empty string if n is not positive. - - - - -

-


string.reverse (s)

-Returns a string that is the string s reversed. - - - - -

-


string.sub (s, i [, j])

-Returns the substring of s that -starts at i and continues until j; -i and j can be negative. -If j is absent, then it is assumed to be equal to -1 -(which is the same as the string length). -In particular, -the call string.sub(s,1,j) returns a prefix of s -with length j, -and string.sub(s, -i) returns a suffix of s -with length i. - - -

-If, after the translation of negative indices, -i is less than 1, -it is corrected to 1. -If j is greater than the string length, -it is corrected to that length. -If, after these corrections, -i is greater than j, -the function returns the empty string. - - - - -

-


string.unpack (fmt, s [, pos])

- - -

-Returns the values packed in string s (see string.pack) -according to the format string fmt (see §6.4.2). -An optional pos marks where -to start reading in s (default is 1). -After the read values, -this function also returns the index of the first unread byte in s. - - - - -

-


string.upper (s)

-Receives a string and returns a copy of this string with all -lowercase letters changed to uppercase. -All other characters are left unchanged. -The definition of what a lowercase letter is depends on the current locale. - - - - - -

6.4.1 – Patterns

- -

-Patterns in Lua are described by regular strings, -which are interpreted as patterns by the pattern-matching functions -string.find, -string.gmatch, -string.gsub, -and string.match. -This section describes the syntax and the meaning -(that is, what they match) of these strings. - - - -

Character Class:

-A character class is used to represent a set of characters. -The following combinations are allowed in describing a character class: - -

    - -
  • x: -(where x is not one of the magic characters -^$()%.[]*+-?) -represents the character x itself. -
  • - -
  • .: (a dot) represents all characters.
  • - -
  • %a: represents all letters.
  • - -
  • %c: represents all control characters.
  • - -
  • %d: represents all digits.
  • - -
  • %g: represents all printable characters except space.
  • - -
  • %l: represents all lowercase letters.
  • - -
  • %p: represents all punctuation characters.
  • - -
  • %s: represents all space characters.
  • - -
  • %u: represents all uppercase letters.
  • - -
  • %w: represents all alphanumeric characters.
  • - -
  • %x: represents all hexadecimal digits.
  • - -
  • %x: (where x is any non-alphanumeric character) -represents the character x. -This is the standard way to escape the magic characters. -Any non-alphanumeric character -(including all punctuation characters, even the non-magical) -can be preceded by a '%' -when used to represent itself in a pattern. -
  • - -
  • [set]: -represents the class which is the union of all -characters in set. -A range of characters can be specified by -separating the end characters of the range, -in ascending order, with a '-'. -All classes %x described above can also be used as -components in set. -All other characters in set represent themselves. -For example, [%w_] (or [_%w]) -represents all alphanumeric characters plus the underscore, -[0-7] represents the octal digits, -and [0-7%l%-] represents the octal digits plus -the lowercase letters plus the '-' character. - - -

    -The interaction between ranges and classes is not defined. -Therefore, patterns like [%a-z] or [a-%%] -have no meaning. -

  • - -
  • [^set]: -represents the complement of set, -where set is interpreted as above. -
  • - -

-For all classes represented by single letters (%a, %c, etc.), -the corresponding uppercase letter represents the complement of the class. -For instance, %S represents all non-space characters. - - -

-The definitions of letter, space, and other character groups -depend on the current locale. -In particular, the class [a-z] may not be equivalent to %l. - - - - - -

Pattern Item:

-A pattern item can be - -

    - -
  • -a single character class, -which matches any single character in the class; -
  • - -
  • -a single character class followed by '*', -which matches zero or more repetitions of characters in the class. -These repetition items will always match the longest possible sequence; -
  • - -
  • -a single character class followed by '+', -which matches one or more repetitions of characters in the class. -These repetition items will always match the longest possible sequence; -
  • - -
  • -a single character class followed by '-', -which also matches zero or more repetitions of characters in the class. -Unlike '*', -these repetition items will always match the shortest possible sequence; -
  • - -
  • -a single character class followed by '?', -which matches zero or one occurrence of a character in the class. -It always matches one occurrence if possible; -
  • - -
  • -%n, for n between 1 and 9; -such item matches a substring equal to the n-th captured string -(see below); -
  • - -
  • -%bxy, where x and y are two distinct characters; -such item matches strings that start with x, end with y, -and where the x and y are balanced. -This means that, if one reads the string from left to right, -counting +1 for an x and -1 for a y, -the ending y is the first y where the count reaches 0. -For instance, the item %b() matches expressions with -balanced parentheses. -
  • - -
  • -%f[set], a frontier pattern; -such item matches an empty string at any position such that -the next character belongs to set -and the previous character does not belong to set. -The set set is interpreted as previously described. -The beginning and the end of the subject are handled as if -they were the character '\0'. -
  • - -
- - - - -

Pattern:

-A pattern is a sequence of pattern items. -A caret '^' at the beginning of a pattern anchors the match at the -beginning of the subject string. -A '$' at the end of a pattern anchors the match at the -end of the subject string. -At other positions, -'^' and '$' have no special meaning and represent themselves. - - - - - -

Captures:

-A pattern can contain sub-patterns enclosed in parentheses; -they describe captures. -When a match succeeds, the substrings of the subject string -that match captures are stored (captured) for future use. -Captures are numbered according to their left parentheses. -For instance, in the pattern "(a*(.)%w(%s*))", -the part of the string matching "a*(.)%w(%s*)" is -stored as the first capture (and therefore has number 1); -the character matching "." is captured with number 2, -and the part matching "%s*" has number 3. - - -

-As a special case, the empty capture () captures -the current string position (a number). -For instance, if we apply the pattern "()aa()" on the -string "flaaap", there will be two captures: 3 and 5. - - - - - - - -

6.4.2 – Format Strings for Pack and Unpack

- -

-The first argument to string.pack, -string.packsize, and string.unpack -is a format string, -which describes the layout of the structure being created or read. - - -

-A format string is a sequence of conversion options. -The conversion options are as follows: - -

    -
  • <: sets little endian
  • -
  • >: sets big endian
  • -
  • =: sets native endian
  • -
  • ![n]: sets maximum alignment to n -(default is native alignment)
  • -
  • b: a signed byte (char)
  • -
  • B: an unsigned byte (char)
  • -
  • h: a signed short (native size)
  • -
  • H: an unsigned short (native size)
  • -
  • l: a signed long (native size)
  • -
  • L: an unsigned long (native size)
  • -
  • j: a lua_Integer
  • -
  • J: a lua_Unsigned
  • -
  • T: a size_t (native size)
  • -
  • i[n]: a signed int with n bytes -(default is native size)
  • -
  • I[n]: an unsigned int with n bytes -(default is native size)
  • -
  • f: a float (native size)
  • -
  • d: a double (native size)
  • -
  • n: a lua_Number
  • -
  • cn: a fixed-sized string with n bytes
  • -
  • z: a zero-terminated string
  • -
  • s[n]: a string preceded by its length -coded as an unsigned integer with n bytes -(default is a size_t)
  • -
  • x: one byte of padding
  • -
  • Xop: an empty item that aligns -according to option op -(which is otherwise ignored)
  • -
  • ' ': (empty space) ignored
  • -

-(A "[n]" means an optional integral numeral.) -Except for padding, spaces, and configurations -(options "xX <=>!"), -each option corresponds to an argument (in string.pack) -or a result (in string.unpack). - - -

-For options "!n", "sn", "in", and "In", -n can be any integer between 1 and 16. -All integral options check overflows; -string.pack checks whether the given value fits in the given size; -string.unpack checks whether the read value fits in a Lua integer. - - -

-Any format string starts as if prefixed by "!1=", -that is, -with maximum alignment of 1 (no alignment) -and native endianness. - - -

-Alignment works as follows: -For each option, -the format gets extra padding until the data starts -at an offset that is a multiple of the minimum between the -option size and the maximum alignment; -this minimum must be a power of 2. -Options "c" and "z" are not aligned; -option "s" follows the alignment of its starting integer. - - -

-All padding is filled with zeros by string.pack -(and ignored by string.unpack). - - - - - - - -

6.5 – UTF-8 Support

- -

-This library provides basic support for UTF-8 encoding. -It provides all its functions inside the table utf8. -This library does not provide any support for Unicode other -than the handling of the encoding. -Any operation that needs the meaning of a character, -such as character classification, is outside its scope. - - -

-Unless stated otherwise, -all functions that expect a byte position as a parameter -assume that the given position is either the start of a byte sequence -or one plus the length of the subject string. -As in the string library, -negative indices count from the end of the string. - - -

-


utf8.char (···)

-Receives zero or more integers, -converts each one to its corresponding UTF-8 byte sequence -and returns a string with the concatenation of all these sequences. - - - - -

-


utf8.charpattern

-The pattern (a string, not a function) "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" -(see §6.4.1), -which matches exactly one UTF-8 byte sequence, -assuming that the subject is a valid UTF-8 string. - - - - -

-


utf8.codes (s)

- - -

-Returns values so that the construction - -

-     for p, c in utf8.codes(s) do body end
-

-will iterate over all characters in string s, -with p being the position (in bytes) and c the code point -of each character. -It raises an error if it meets any invalid byte sequence. - - - - -

-


utf8.codepoint (s [, i [, j]])

-Returns the codepoints (as integers) from all characters in s -that start between byte position i and j (both included). -The default for i is 1 and for j is i. -It raises an error if it meets any invalid byte sequence. - - - - -

-


utf8.len (s [, i [, j]])

-Returns the number of UTF-8 characters in string s -that start between positions i and j (both inclusive). -The default for i is 1 and for j is -1. -If it finds any invalid byte sequence, -returns a false value plus the position of the first invalid byte. - - - - -

-


utf8.offset (s, n [, i])

-Returns the position (in bytes) where the encoding of the -n-th character of s -(counting from position i) starts. -A negative n gets characters before position i. -The default for i is 1 when n is non-negative -and #s + 1 otherwise, -so that utf8.offset(s, -n) gets the offset of the -n-th character from the end of the string. -If the specified character is neither in the subject -nor right after its end, -the function returns nil. - - -

-As a special case, -when n is 0 the function returns the start of the encoding -of the character that contains the i-th byte of s. - - -

-This function assumes that s is a valid UTF-8 string. - - - - - - - -

6.6 – Table Manipulation

- -

-This library provides generic functions for table manipulation. -It provides all its functions inside the table table. - - -

-Remember that, whenever an operation needs the length of a table, -the table must be a proper sequence -or have a __len metamethod (see §3.4.7). -All functions ignore non-numeric keys -in the tables given as arguments. - - -

-


table.concat (list [, sep [, i [, j]]])

- - -

-Given a list where all elements are strings or numbers, -returns the string list[i]..sep..list[i+1] ··· sep..list[j]. -The default value for sep is the empty string, -the default for i is 1, -and the default for j is #list. -If i is greater than j, returns the empty string. - - - - -

-


table.insert (list, [pos,] value)

- - -

-Inserts element value at position pos in list, -shifting up the elements -list[pos], list[pos+1], ···, list[#list]. -The default value for pos is #list+1, -so that a call table.insert(t,x) inserts x at the end -of list t. - - - - -

-


table.move (a1, f, e, t [,a2])

- - -

-Moves elements from table a1 to table a2. -This function performs the equivalent to the following -multiple assignment: -a2[t],··· = a1[f],···,a1[e]. -The default for a2 is a1. -The destination range can overlap with the source range. -The number of elements to be moved must fit in a Lua integer. - - - - -

-


table.pack (···)

- - -

-Returns a new table with all parameters stored into keys 1, 2, etc. -and with a field "n" with the total number of parameters. -Note that the resulting table may not be a sequence. - - - - -

-


table.remove (list [, pos])

- - -

-Removes from list the element at position pos, -returning the value of the removed element. -When pos is an integer between 1 and #list, -it shifts down the elements -list[pos+1], list[pos+2], ···, list[#list] -and erases element list[#list]; -The index pos can also be 0 when #list is 0, -or #list + 1; -in those cases, the function erases the element list[pos]. - - -

-The default value for pos is #list, -so that a call table.remove(l) removes the last element -of list l. - - - - -

-


table.sort (list [, comp])

- - -

-Sorts list elements in a given order, in-place, -from list[1] to list[#list]. -If comp is given, -then it must be a function that receives two list elements -and returns true when the first element must come -before the second in the final order -(so that not comp(list[i+1],list[i]) will be true after the sort). -If comp is not given, -then the standard Lua operator < is used instead. - - -

-The sort algorithm is not stable; -that is, elements considered equal by the given order -may have their relative positions changed by the sort. - - - - -

-


table.unpack (list [, i [, j]])

- - -

-Returns the elements from the given list. -This function is equivalent to - -

-     return list[i], list[i+1], ···, list[j]
-

-By default, i is 1 and j is #list. - - - - - - - -

6.7 – Mathematical Functions

- -

-This library provides basic mathematical functions. -It provides all its functions and constants inside the table math. -Functions with the annotation "integer/float" give -integer results for integer arguments -and float results for float (or mixed) arguments. -Rounding functions -(math.ceil, math.floor, and math.modf) -return an integer when the result fits in the range of an integer, -or a float otherwise. - - -

-


math.abs (x)

- - -

-Returns the absolute value of x. (integer/float) - - - - -

-


math.acos (x)

- - -

-Returns the arc cosine of x (in radians). - - - - -

-


math.asin (x)

- - -

-Returns the arc sine of x (in radians). - - - - -

-


math.atan (y [, x])

- - -

- -Returns the arc tangent of y/x (in radians), -but uses the signs of both parameters to find the -quadrant of the result. -(It also handles correctly the case of x being zero.) - - -

-The default value for x is 1, -so that the call math.atan(y) -returns the arc tangent of y. - - - - -

-


math.ceil (x)

- - -

-Returns the smallest integral value larger than or equal to x. - - - - -

-


math.cos (x)

- - -

-Returns the cosine of x (assumed to be in radians). - - - - -

-


math.deg (x)

- - -

-Converts the angle x from radians to degrees. - - - - -

-


math.exp (x)

- - -

-Returns the value ex -(where e is the base of natural logarithms). - - - - -

-


math.floor (x)

- - -

-Returns the largest integral value smaller than or equal to x. - - - - -

-


math.fmod (x, y)

- - -

-Returns the remainder of the division of x by y -that rounds the quotient towards zero. (integer/float) - - - - -

-


math.huge

- - -

-The float value HUGE_VAL, -a value larger than any other numeric value. - - - - -

-


math.log (x [, base])

- - -

-Returns the logarithm of x in the given base. -The default for base is e -(so that the function returns the natural logarithm of x). - - - - -

-


math.max (x, ···)

- - -

-Returns the argument with the maximum value, -according to the Lua operator <. (integer/float) - - - - -

-


math.maxinteger

-An integer with the maximum value for an integer. - - - - -

-


math.min (x, ···)

- - -

-Returns the argument with the minimum value, -according to the Lua operator <. (integer/float) - - - - -

-


math.mininteger

-An integer with the minimum value for an integer. - - - - -

-


math.modf (x)

- - -

-Returns the integral part of x and the fractional part of x. -Its second result is always a float. - - - - -

-


math.pi

- - -

-The value of π. - - - - -

-


math.rad (x)

- - -

-Converts the angle x from degrees to radians. - - - - -

-


math.random ([m [, n]])

- - -

-When called without arguments, -returns a pseudo-random float with uniform distribution -in the range [0,1). -When called with two integers m and n, -math.random returns a pseudo-random integer -with uniform distribution in the range [m, n]. -(The value m-n cannot be negative and must fit in a Lua integer.) -The call math.random(n) is equivalent to math.random(1,n). - - -

-This function is an interface to the underling -pseudo-random generator function provided by C. -No guarantees can be given for its statistical properties. - - - - -

-


math.randomseed (x)

- - -

-Sets x as the "seed" -for the pseudo-random generator: -equal seeds produce equal sequences of numbers. - - - - -

-


math.sin (x)

- - -

-Returns the sine of x (assumed to be in radians). - - - - -

-


math.sqrt (x)

- - -

-Returns the square root of x. -(You can also use the expression x^0.5 to compute this value.) - - - - -

-


math.tan (x)

- - -

-Returns the tangent of x (assumed to be in radians). - - - - -

-


math.tointeger (x)

- - -

-If the value x is convertible to an integer, -returns that integer. -Otherwise, returns nil. - - - - -

-


math.type (x)

- - -

-Returns "integer" if x is an integer, -"float" if it is a float, -or nil if x is not a number. - - - - -

-


math.ult (m, n)

- - -

-Returns a boolean, -true if integer m is below integer n when -they are compared as unsigned integers. - - - - - - - -

6.8 – Input and Output Facilities

- -

-The I/O library provides two different styles for file manipulation. -The first one uses implicit file handles; -that is, there are operations to set a default input file and a -default output file, -and all input/output operations are over these default files. -The second style uses explicit file handles. - - -

-When using implicit file handles, -all operations are supplied by table io. -When using explicit file handles, -the operation io.open returns a file handle -and then all operations are supplied as methods of the file handle. - - -

-The table io also provides -three predefined file handles with their usual meanings from C: -io.stdin, io.stdout, and io.stderr. -The I/O library never closes these files. - - -

-Unless otherwise stated, -all I/O functions return nil on failure -(plus an error message as a second result and -a system-dependent error code as a third result) -and some value different from nil on success. -On non-POSIX systems, -the computation of the error message and error code -in case of errors -may be not thread safe, -because they rely on the global C variable errno. - - -

-


io.close ([file])

- - -

-Equivalent to file:close(). -Without a file, closes the default output file. - - - - -

-


io.flush ()

- - -

-Equivalent to io.output():flush(). - - - - -

-


io.input ([file])

- - -

-When called with a file name, it opens the named file (in text mode), -and sets its handle as the default input file. -When called with a file handle, -it simply sets this file handle as the default input file. -When called without parameters, -it returns the current default input file. - - -

-In case of errors this function raises the error, -instead of returning an error code. - - - - -

-


io.lines ([filename ···])

- - -

-Opens the given file name in read mode -and returns an iterator function that -works like file:lines(···) over the opened file. -When the iterator function detects the end of file, -it returns no values (to finish the loop) and automatically closes the file. - - -

-The call io.lines() (with no file name) is equivalent -to io.input():lines("*l"); -that is, it iterates over the lines of the default input file. -In this case it does not close the file when the loop ends. - - -

-In case of errors this function raises the error, -instead of returning an error code. - - - - -

-


io.open (filename [, mode])

- - -

-This function opens a file, -in the mode specified in the string mode. -It returns a new file handle, -or, in case of errors, nil plus an error message. - - -

-The mode string can be any of the following: - -

    -
  • "r": read mode (the default);
  • -
  • "w": write mode;
  • -
  • "a": append mode;
  • -
  • "r+": update mode, all previous data is preserved;
  • -
  • "w+": update mode, all previous data is erased;
  • -
  • "a+": append update mode, previous data is preserved, - writing is only allowed at the end of file.
  • -

-The mode string can also have a 'b' at the end, -which is needed in some systems to open the file in binary mode. - - - - -

-


io.output ([file])

- - -

-Similar to io.input, but operates over the default output file. - - - - -

-


io.popen (prog [, mode])

- - -

-This function is system dependent and is not available -on all platforms. - - -

-Starts program prog in a separated process and returns -a file handle that you can use to read data from this program -(if mode is "r", the default) -or to write data to this program -(if mode is "w"). - - - - -

-


io.read (···)

- - -

-Equivalent to io.input():read(···). - - - - -

-


io.tmpfile ()

- - -

-Returns a handle for a temporary file. -This file is opened in update mode -and it is automatically removed when the program ends. - - - - -

-


io.type (obj)

- - -

-Checks whether obj is a valid file handle. -Returns the string "file" if obj is an open file handle, -"closed file" if obj is a closed file handle, -or nil if obj is not a file handle. - - - - -

-


io.write (···)

- - -

-Equivalent to io.output():write(···). - - - - -

-


file:close ()

- - -

-Closes file. -Note that files are automatically closed when -their handles are garbage collected, -but that takes an unpredictable amount of time to happen. - - -

-When closing a file handle created with io.popen, -file:close returns the same values -returned by os.execute. - - - - -

-


file:flush ()

- - -

-Saves any written data to file. - - - - -

-


file:lines (···)

- - -

-Returns an iterator function that, -each time it is called, -reads the file according to the given formats. -When no format is given, -uses "l" as a default. -As an example, the construction - -

-     for c in file:lines(1) do body end
-

-will iterate over all characters of the file, -starting at the current position. -Unlike io.lines, this function does not close the file -when the loop ends. - - -

-In case of errors this function raises the error, -instead of returning an error code. - - - - -

-


file:read (···)

- - -

-Reads the file file, -according to the given formats, which specify what to read. -For each format, -the function returns a string or a number with the characters read, -or nil if it cannot read data with the specified format. -(In this latter case, -the function does not read subsequent formats.) -When called without formats, -it uses a default format that reads the next line -(see below). - - -

-The available formats are - -

    - -
  • "n": -reads a numeral and returns it as a float or an integer, -following the lexical conventions of Lua. -(The numeral may have leading spaces and a sign.) -This format always reads the longest input sequence that -is a valid prefix for a numeral; -if that prefix does not form a valid numeral -(e.g., an empty string, "0x", or "3.4e-"), -it is discarded and the function returns nil. -
  • - -
  • "a": -reads the whole file, starting at the current position. -On end of file, it returns the empty string. -
  • - -
  • "l": -reads the next line skipping the end of line, -returning nil on end of file. -This is the default format. -
  • - -
  • "L": -reads the next line keeping the end-of-line character (if present), -returning nil on end of file. -
  • - -
  • number: -reads a string with up to this number of bytes, -returning nil on end of file. -If number is zero, -it reads nothing and returns an empty string, -or nil on end of file. -
  • - -

-The formats "l" and "L" should be used only for text files. - - - - -

-


file:seek ([whence [, offset]])

- - -

-Sets and gets the file position, -measured from the beginning of the file, -to the position given by offset plus a base -specified by the string whence, as follows: - -

    -
  • "set": base is position 0 (beginning of the file);
  • -
  • "cur": base is current position;
  • -
  • "end": base is end of file;
  • -

-In case of success, seek returns the final file position, -measured in bytes from the beginning of the file. -If seek fails, it returns nil, -plus a string describing the error. - - -

-The default value for whence is "cur", -and for offset is 0. -Therefore, the call file:seek() returns the current -file position, without changing it; -the call file:seek("set") sets the position to the -beginning of the file (and returns 0); -and the call file:seek("end") sets the position to the -end of the file, and returns its size. - - - - -

-


file:setvbuf (mode [, size])

- - -

-Sets the buffering mode for an output file. -There are three available modes: - -

    - -
  • "no": -no buffering; the result of any output operation appears immediately. -
  • - -
  • "full": -full buffering; output operation is performed only -when the buffer is full or when -you explicitly flush the file (see io.flush). -
  • - -
  • "line": -line buffering; output is buffered until a newline is output -or there is any input from some special files -(such as a terminal device). -
  • - -

-For the last two cases, size -specifies the size of the buffer, in bytes. -The default is an appropriate size. - - - - -

-


file:write (···)

- - -

-Writes the value of each of its arguments to file. -The arguments must be strings or numbers. - - -

-In case of success, this function returns file. -Otherwise it returns nil plus a string describing the error. - - - - - - - -

6.9 – Operating System Facilities

- -

-This library is implemented through table os. - - -

-


os.clock ()

- - -

-Returns an approximation of the amount in seconds of CPU time -used by the program. - - - - -

-


os.date ([format [, time]])

- - -

-Returns a string or a table containing date and time, -formatted according to the given string format. - - -

-If the time argument is present, -this is the time to be formatted -(see the os.time function for a description of this value). -Otherwise, date formats the current time. - - -

-If format starts with '!', -then the date is formatted in Coordinated Universal Time. -After this optional character, -if format is the string "*t", -then date returns a table with the following fields: -year (four digits), month (1–12), day (1–31), -hour (0–23), min (0–59), sec (0–61), -wday (weekday, Sunday is 1), -yday (day of the year), -and isdst (daylight saving flag, a boolean). -This last field may be absent -if the information is not available. - - -

-If format is not "*t", -then date returns the date as a string, -formatted according to the same rules as the ISO C function strftime. - - -

-When called without arguments, -date returns a reasonable date and time representation that depends on -the host system and on the current locale -(that is, os.date() is equivalent to os.date("%c")). - - -

-On non-POSIX systems, -this function may be not thread safe -because of its reliance on C function gmtime and C function localtime. - - - - -

-


os.difftime (t2, t1)

- - -

-Returns the difference, in seconds, -from time t1 to time t2 -(where the times are values returned by os.time). -In POSIX, Windows, and some other systems, -this value is exactly t2-t1. - - - - -

-


os.execute ([command])

- - -

-This function is equivalent to the ISO C function system. -It passes command to be executed by an operating system shell. -Its first result is true -if the command terminated successfully, -or nil otherwise. -After this first result -the function returns a string plus a number, -as follows: - -

    - -
  • "exit": -the command terminated normally; -the following number is the exit status of the command. -
  • - -
  • "signal": -the command was terminated by a signal; -the following number is the signal that terminated the command. -
  • - -
- -

-When called without a command, -os.execute returns a boolean that is true if a shell is available. - - - - -

-


os.exit ([code [, close]])

- - -

-Calls the ISO C function exit to terminate the host program. -If code is true, -the returned status is EXIT_SUCCESS; -if code is false, -the returned status is EXIT_FAILURE; -if code is a number, -the returned status is this number. -The default value for code is true. - - -

-If the optional second argument close is true, -closes the Lua state before exiting. - - - - -

-


os.getenv (varname)

- - -

-Returns the value of the process environment variable varname, -or nil if the variable is not defined. - - - - -

-


os.remove (filename)

- - -

-Deletes the file (or empty directory, on POSIX systems) -with the given name. -If this function fails, it returns nil, -plus a string describing the error and the error code. - - - - -

-


os.rename (oldname, newname)

- - -

-Renames file or directory named oldname to newname. -If this function fails, it returns nil, -plus a string describing the error and the error code. - - - - -

-


os.setlocale (locale [, category])

- - -

-Sets the current locale of the program. -locale is a system-dependent string specifying a locale; -category is an optional string describing which category to change: -"all", "collate", "ctype", -"monetary", "numeric", or "time"; -the default category is "all". -The function returns the name of the new locale, -or nil if the request cannot be honored. - - -

-If locale is the empty string, -the current locale is set to an implementation-defined native locale. -If locale is the string "C", -the current locale is set to the standard C locale. - - -

-When called with nil as the first argument, -this function only returns the name of the current locale -for the given category. - - -

-This function may be not thread safe -because of its reliance on C function setlocale. - - - - -

-


os.time ([table])

- - -

-Returns the current time when called without arguments, -or a time representing the local date and time specified by the given table. -This table must have fields year, month, and day, -and may have fields -hour (default is 12), -min (default is 0), -sec (default is 0), -and isdst (default is nil). -Other fields are ignored. -For a description of these fields, see the os.date function. - - -

-The values in these fields do not need to be inside their valid ranges. -For instance, if sec is -10, -it means -10 seconds from the time specified by the other fields; -if hour is 1000, -it means +1000 hours from the time specified by the other fields. - - -

-The returned value is a number, whose meaning depends on your system. -In POSIX, Windows, and some other systems, -this number counts the number -of seconds since some given start time (the "epoch"). -In other systems, the meaning is not specified, -and the number returned by time can be used only as an argument to -os.date and os.difftime. - - - - -

-


os.tmpname ()

- - -

-Returns a string with a file name that can -be used for a temporary file. -The file must be explicitly opened before its use -and explicitly removed when no longer needed. - - -

-On POSIX systems, -this function also creates a file with that name, -to avoid security risks. -(Someone else might create the file with wrong permissions -in the time between getting the name and creating the file.) -You still have to open the file to use it -and to remove it (even if you do not use it). - - -

-When possible, -you may prefer to use io.tmpfile, -which automatically removes the file when the program ends. - - - - - - - -

6.10 – The Debug Library

- -

-This library provides -the functionality of the debug interface (§4.9) to Lua programs. -You should exert care when using this library. -Several of its functions -violate basic assumptions about Lua code -(e.g., that variables local to a function -cannot be accessed from outside; -that userdata metatables cannot be changed by Lua code; -that Lua programs do not crash) -and therefore can compromise otherwise secure code. -Moreover, some functions in this library may be slow. - - -

-All functions in this library are provided -inside the debug table. -All functions that operate over a thread -have an optional first argument which is the -thread to operate over. -The default is always the current thread. - - -

-


debug.debug ()

- - -

-Enters an interactive mode with the user, -running each string that the user enters. -Using simple commands and other debug facilities, -the user can inspect global and local variables, -change their values, evaluate expressions, and so on. -A line containing only the word cont finishes this function, -so that the caller continues its execution. - - -

-Note that commands for debug.debug are not lexically nested -within any function and so have no direct access to local variables. - - - - -

-


debug.gethook ([thread])

- - -

-Returns the current hook settings of the thread, as three values: -the current hook function, the current hook mask, -and the current hook count -(as set by the debug.sethook function). - - - - -

-


debug.getinfo ([thread,] f [, what])

- - -

-Returns a table with information about a function. -You can give the function directly -or you can give a number as the value of f, -which means the function running at level f of the call stack -of the given thread: -level 0 is the current function (getinfo itself); -level 1 is the function that called getinfo -(except for tail calls, which do not count on the stack); -and so on. -If f is a number larger than the number of active functions, -then getinfo returns nil. - - -

-The returned table can contain all the fields returned by lua_getinfo, -with the string what describing which fields to fill in. -The default for what is to get all information available, -except the table of valid lines. -If present, -the option 'f' -adds a field named func with the function itself. -If present, -the option 'L' -adds a field named activelines with the table of -valid lines. - - -

-For instance, the expression debug.getinfo(1,"n").name returns -a name for the current function, -if a reasonable name can be found, -and the expression debug.getinfo(print) -returns a table with all available information -about the print function. - - - - -

-


debug.getlocal ([thread,] f, local)

- - -

-This function returns the name and the value of the local variable -with index local of the function at level f of the stack. -This function accesses not only explicit local variables, -but also parameters, temporaries, etc. - - -

-The first parameter or local variable has index 1, and so on, -following the order that they are declared in the code, -counting only the variables that are active -in the current scope of the function. -Negative indices refer to vararg parameters; --1 is the first vararg parameter. -The function returns nil if there is no variable with the given index, -and raises an error when called with a level out of range. -(You can call debug.getinfo to check whether the level is valid.) - - -

-Variable names starting with '(' (open parenthesis) -represent variables with no known names -(internal variables such as loop control variables, -and variables from chunks saved without debug information). - - -

-The parameter f may also be a function. -In that case, getlocal returns only the name of function parameters. - - - - -

-


debug.getmetatable (value)

- - -

-Returns the metatable of the given value -or nil if it does not have a metatable. - - - - -

-


debug.getregistry ()

- - -

-Returns the registry table (see §4.5). - - - - -

-


debug.getupvalue (f, up)

- - -

-This function returns the name and the value of the upvalue -with index up of the function f. -The function returns nil if there is no upvalue with the given index. - - -

-Variable names starting with '(' (open parenthesis) -represent variables with no known names -(variables from chunks saved without debug information). - - - - -

-


debug.getuservalue (u)

- - -

-Returns the Lua value associated to u. -If u is not a userdata, -returns nil. - - - - -

-


debug.sethook ([thread,] hook, mask [, count])

- - -

-Sets the given function as a hook. -The string mask and the number count describe -when the hook will be called. -The string mask may have any combination of the following characters, -with the given meaning: - -

    -
  • 'c': the hook is called every time Lua calls a function;
  • -
  • 'r': the hook is called every time Lua returns from a function;
  • -
  • 'l': the hook is called every time Lua enters a new line of code.
  • -

-Moreover, -with a count different from zero, -the hook is called also after every count instructions. - - -

-When called without arguments, -debug.sethook turns off the hook. - - -

-When the hook is called, its first parameter is a string -describing the event that has triggered its call: -"call" (or "tail call"), -"return", -"line", and "count". -For line events, -the hook also gets the new line number as its second parameter. -Inside a hook, -you can call getinfo with level 2 to get more information about -the running function -(level 0 is the getinfo function, -and level 1 is the hook function). - - - - -

-


debug.setlocal ([thread,] level, local, value)

- - -

-This function assigns the value value to the local variable -with index local of the function at level level of the stack. -The function returns nil if there is no local -variable with the given index, -and raises an error when called with a level out of range. -(You can call getinfo to check whether the level is valid.) -Otherwise, it returns the name of the local variable. - - -

-See debug.getlocal for more information about -variable indices and names. - - - - -

-


debug.setmetatable (value, table)

- - -

-Sets the metatable for the given value to the given table -(which can be nil). -Returns value. - - - - -

-


debug.setupvalue (f, up, value)

- - -

-This function assigns the value value to the upvalue -with index up of the function f. -The function returns nil if there is no upvalue -with the given index. -Otherwise, it returns the name of the upvalue. - - - - -

-


debug.setuservalue (udata, value)

- - -

-Sets the given value as -the Lua value associated to the given udata. -udata must be a full userdata. - - -

-Returns udata. - - - - -

-


debug.traceback ([thread,] [message [, level]])

- - -

-If message is present but is neither a string nor nil, -this function returns message without further processing. -Otherwise, -it returns a string with a traceback of the call stack. -The optional message string is appended -at the beginning of the traceback. -An optional level number tells at which level -to start the traceback -(default is 1, the function calling traceback). - - - - -

-


debug.upvalueid (f, n)

- - -

-Returns a unique identifier (as a light userdata) -for the upvalue numbered n -from the given function. - - -

-These unique identifiers allow a program to check whether different -closures share upvalues. -Lua closures that share an upvalue -(that is, that access a same external local variable) -will return identical ids for those upvalue indices. - - - - -

-


debug.upvaluejoin (f1, n1, f2, n2)

- - -

-Make the n1-th upvalue of the Lua closure f1 -refer to the n2-th upvalue of the Lua closure f2. - - - - - - - -

7 – Lua Standalone

- -

-Although Lua has been designed as an extension language, -to be embedded in a host C program, -it is also frequently used as a standalone language. -An interpreter for Lua as a standalone language, -called simply lua, -is provided with the standard distribution. -The standalone interpreter includes -all standard libraries, including the debug library. -Its usage is: - -

-     lua [options] [script [args]]
-

-The options are: - -

    -
  • -e stat: executes string stat;
  • -
  • -l mod: "requires" mod;
  • -
  • -i: enters interactive mode after running script;
  • -
  • -v: prints version information;
  • -
  • -E: ignores environment variables;
  • -
  • --: stops handling options;
  • -
  • -: executes stdin as a file and stops handling options.
  • -

-After handling its options, lua runs the given script. -When called without arguments, -lua behaves as lua -v -i -when the standard input (stdin) is a terminal, -and as lua - otherwise. - - -

-When called without option -E, -the interpreter checks for an environment variable LUA_INIT_5_3 -(or LUA_INIT if the versioned name is not defined) -before running any argument. -If the variable content has the format @filename, -then lua executes the file. -Otherwise, lua executes the string itself. - - -

-When called with option -E, -besides ignoring LUA_INIT, -Lua also ignores -the values of LUA_PATH and LUA_CPATH, -setting the values of -package.path and package.cpath -with the default paths defined in luaconf.h. - - -

-All options are handled in order, except -i and -E. -For instance, an invocation like - -

-     $ lua -e'a=1' -e 'print(a)' script.lua
-

-will first set a to 1, then print the value of a, -and finally run the file script.lua with no arguments. -(Here $ is the shell prompt. Your prompt may be different.) - - -

-Before running any code, -lua collects all command-line arguments -in a global table called arg. -The script name goes to index 0, -the first argument after the script name goes to index 1, -and so on. -Any arguments before the script name -(that is, the interpreter name plus its options) -go to negative indices. -For instance, in the call - -

-     $ lua -la b.lua t1 t2
-

-the table is like this: - -

-     arg = { [-2] = "lua", [-1] = "-la",
-             [0] = "b.lua",
-             [1] = "t1", [2] = "t2" }
-

-If there is no script in the call, -the interpreter name goes to index 0, -followed by the other arguments. -For instance, the call - -

-     $ lua -e "print(arg[1])"
-

-will print "-e". -If there is a script, -the script is called with parameters -arg[1], ···, arg[#arg]. -(Like all chunks in Lua, -the script is compiled as a vararg function.) - - -

-In interactive mode, -Lua repeatedly prompts and waits for a line. -After reading a line, -Lua first try to interpret the line as an expression. -If it succeeds, it prints its value. -Otherwise, it interprets the line as a statement. -If you write an incomplete statement, -the interpreter waits for its completion -by issuing a different prompt. - - -

-In case of unprotected errors in the script, -the interpreter reports the error to the standard error stream. -If the error object is not a string but -has a metamethod __tostring, -the interpreter calls this metamethod to produce the final message. -Otherwise, the interpreter converts the error object to a string -and adds a stack traceback to it. - - -

-When finishing normally, -the interpreter closes its main Lua state -(see lua_close). -The script can avoid this step by -calling os.exit to terminate. - - -

-To allow the use of Lua as a -script interpreter in Unix systems, -the standalone interpreter skips -the first line of a chunk if it starts with #. -Therefore, Lua scripts can be made into executable programs -by using chmod +x and the #! form, -as in - -

-     #!/usr/local/bin/lua
-

-(Of course, -the location of the Lua interpreter may be different in your machine. -If lua is in your PATH, -then - -

-     #!/usr/bin/env lua
-

-is a more portable solution.) - - - -

8 – Incompatibilities with the Previous Version

- -

-Here we list the incompatibilities that you may find when moving a program -from Lua 5.2 to Lua 5.3. -You can avoid some incompatibilities by compiling Lua with -appropriate options (see file luaconf.h). -However, -all these compatibility options will be removed in the future. - - -

-Lua versions can always change the C API in ways that -do not imply source-code changes in a program, -such as the numeric values for constants -or the implementation of functions as macros. -Therefore, -you should not assume that binaries are compatible between -different Lua versions. -Always recompile clients of the Lua API when -using a new version. - - -

-Similarly, Lua versions can always change the internal representation -of precompiled chunks; -precompiled chunks are not compatible between different Lua versions. - - -

-The standard paths in the official distribution may -change between versions. - - - -

8.1 – Changes in the Language

-
    - -
  • -The main difference between Lua 5.2 and Lua 5.3 is the -introduction of an integer subtype for numbers. -Although this change should not affect "normal" computations, -some computations -(mainly those that involve some kind of overflow) -can give different results. - - -

    -You can fix these differences by forcing a number to be a float -(in Lua 5.2 all numbers were float), -in particular writing constants with an ending .0 -or using x = x + 0.0 to convert a variable. -(This recommendation is only for a quick fix -for an occasional incompatibility; -it is not a general guideline for good programming. -For good programming, -use floats where you need floats -and integers where you need integers.) -

  • - -
  • -The conversion of a float to a string now adds a .0 suffix -to the result if it looks like an integer. -(For instance, the float 2.0 will be printed as 2.0, -not as 2.) -You should always use an explicit format -when you need a specific format for numbers. - - -

    -(Formally this is not an incompatibility, -because Lua does not specify how numbers are formatted as strings, -but some programs assumed a specific format.) -

  • - -
  • -The generational mode for the garbage collector was removed. -(It was an experimental feature in Lua 5.2.) -
  • - -
- - - - -

8.2 – Changes in the Libraries

-
    - -
  • -The bit32 library has been deprecated. -It is easy to require a compatible external library or, -better yet, to replace its functions with appropriate bitwise operations. -(Keep in mind that bit32 operates on 32-bit integers, -while the bitwise operators in Lua 5.3 operate on Lua integers, -which by default have 64 bits.) -
  • - -
  • -The Table library now respects metamethods -for setting and getting elements. -
  • - -
  • -The ipairs iterator now respects metamethods and -its __ipairs metamethod has been deprecated. -
  • - -
  • -Option names in io.read do not have a starting '*' anymore. -For compatibility, Lua will continue to accept (and ignore) this character. -
  • - -
  • -The following functions were deprecated in the mathematical library: -atan2, cosh, sinh, tanh, pow, -frexp, and ldexp. -You can replace math.pow(x,y) with x^y; -you can replace math.atan2 with math.atan, -which now accepts one or two parameters; -you can replace math.ldexp(x,exp) with x * 2.0^exp. -For the other operations, -you can either use an external library or -implement them in Lua. -
  • - -
  • -The searcher for C loaders used by require -changed the way it handles versioned names. -Now, the version should come after the module name -(as is usual in most other tools). -For compatibility, that searcher still tries the old format -if it cannot find an open function according to the new style. -(Lua 5.2 already worked that way, -but it did not document the change.) -
  • - -
  • -The call collectgarbage("count") now returns only one result. -(You can compute that second result from the fractional part -of the first result.) -
  • - -
- - - - -

8.3 – Changes in the API

- - -
    - -
  • -Continuation functions now receive as parameters what they needed -to get through lua_getctx, -so lua_getctx has been removed. -Adapt your code accordingly. -
  • - -
  • -Function lua_dump has an extra parameter, strip. -Use 0 as the value of this parameter to get the old behavior. -
  • - -
  • -Functions to inject/project unsigned integers -(lua_pushunsigned, lua_tounsigned, lua_tounsignedx, -luaL_checkunsigned, luaL_optunsigned) -were deprecated. -Use their signed equivalents with a type cast. -
  • - -
  • -Macros to project non-default integer types -(luaL_checkint, luaL_optint, luaL_checklong, luaL_optlong) -were deprecated. -Use their equivalent over lua_Integer with a type cast -(or, when possible, use lua_Integer in your code). -
  • - -
- - - - -

9 – The Complete Syntax of Lua

- -

-Here is the complete syntax of Lua in extended BNF. -As usual in extended BNF, -{A} means 0 or more As, -and [A] means an optional A. -(For operator precedences, see §3.4.8; -for a description of the terminals -Name, Numeral, -and LiteralString, see §3.1.) - - - - -

-
-	chunk ::= block
-
-	block ::= {stat} [retstat]
-
-	stat ::=  ‘;’ | 
-		 varlist ‘=’ explist | 
-		 functioncall | 
-		 label | 
-		 break | 
-		 goto Name | 
-		 do block end | 
-		 while exp do block end | 
-		 repeat block until exp | 
-		 if exp then block {elseif exp then block} [else block] end | 
-		 for Name ‘=’ exp ‘,’ exp [‘,’ exp] do block end | 
-		 for namelist in explist do block end | 
-		 function funcname funcbody | 
-		 local function Name funcbody | 
-		 local namelist [‘=’ explist] 
-
-	retstat ::= return [explist] [‘;’]
-
-	label ::= ‘::’ Name ‘::’
-
-	funcname ::= Name {‘.’ Name} [‘:’ Name]
-
-	varlist ::= var {‘,’ var}
-
-	var ::=  Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name 
-
-	namelist ::= Name {‘,’ Name}
-
-	explist ::= exp {‘,’ exp}
-
-	exp ::=  nil | false | true | Numeral | LiteralString | ‘...’ | functiondef | 
-		 prefixexp | tableconstructor | exp binop exp | unop exp 
-
-	prefixexp ::= var | functioncall | ‘(’ exp ‘)’
-
-	functioncall ::=  prefixexp args | prefixexp ‘:’ Name args 
-
-	args ::=  ‘(’ [explist] ‘)’ | tableconstructor | LiteralString 
-
-	functiondef ::= function funcbody
-
-	funcbody ::= ‘(’ [parlist] ‘)’ block end
-
-	parlist ::= namelist [‘,’ ‘...’] | ‘...’
-
-	tableconstructor ::= ‘{’ [fieldlist] ‘}’
-
-	fieldlist ::= field {fieldsep field} [fieldsep]
-
-	field ::= ‘[’ exp ‘]’ ‘=’ exp | Name ‘=’ exp | exp
-
-	fieldsep ::= ‘,’ | ‘;’
-
-	binop ::=  ‘+’ | ‘-’ | ‘*’ | ‘/’ | ‘//’ | ‘^’ | ‘%’ | 
-		 ‘&’ | ‘~’ | ‘|’ | ‘>>’ | ‘<<’ | ‘..’ | 
-		 ‘<’ | ‘<=’ | ‘>’ | ‘>=’ | ‘==’ | ‘~=’ | 
-		 and | or
-
-	unop ::= ‘-’ | not | ‘#’ | ‘~’
-
-
- -

- - - - - - - - -

- - - - diff --git a/external/mit/lua/dist/doc/osi-certified-72x60.png b/external/mit/lua/dist/doc/osi-certified-72x60.png deleted file mode 100644 index 07df5f6ee7a7a8b2108025dcd815f73f145a83af..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3774 zcmV;v4ngsWP)$kl5 zqcT7g&?zu8?ezWYz4zUB-|zR9d+&Qy2xAN{qY(ew0A7^*gV^7jytKqPFV3{hZfovn zs%x!l>(m&Gdb8C+5XeR7>h0kj=o=X3A39;2KLYfEMt>p1YMW~dt`rpAC{lN~P>5pq zH1L4nAdCT17}*hN=LnEsvMl=5Ij^QArAa&_V~zoht-Ei~)E~(Ivhe0#jik{t$isEK znCH$TxCB8EKmcF>3@pRaHpbR%Gqm*dsZA4H{j(NjZFp^iNFW+RBx6R*X19J*`0XG5 z^Y>cR=^Hi9#ovYGlbFSr#Q*^PgCGC^gb*SC5TcBfzQLe-r2m!Quik&_g9XzTj0qSR zD`FkG_RYWDa^+#UUxL&t+!K+&(ion@Fd`5l5p7{Qsva9vegC|4^NzJUMvn)^gqWsF zvu^j=%FfCVg^cgbXDRl1DE$lsfe;BjjmFmRHER~E-MeWoNsyyNHCpG%Y}igd_(Md;&9La8_B075NDRX9gTD zIHY`}9E~aGi9Kk1@P~rmPna=*=gz~UTdTpsQmjX)J23%v9NliQS)8`xJh6Qz_nE~e z&tP|!dcJdo;JMNa3>afSx$lko8>fp-I}OiCVz(dOF1u6e8$IrsSP?=5mp~lkaFqm? zAUMxRq%ecIu3WE)Uf=%p8g z+RSY?G=VO%wAfdICj?Uzb+5jr{8m|)i#{M}JjaDIoXf#1=DYLwX;1EW&sijPvm6EkBGuOx6r~lKv`g`yH?)|&PRUr$5Ibw2HBM7C74XvE@gaPjN+@;j$J)AgYhnT-U5m+wj|Wz8K630AfO8PUoGD^^Mcq zY9C<~%wUm^u%ox5P21)KNN0$(v^OI$A~?iwsS_fRu1+`EH|CRdpA4zsk8Z#|?x@^vVEAL+2JxH%&^{JUU%B=?EU7`Ar*Q|JvqPofcBt765(*f5JI$>=3{<%K)4ei zogo$)5XP}_X$y^pIYyWTt}EAnhTq}u4sAdBvC(WC{I#x4^>$vCvQ0UDs^18sAQG9o zEaP0qjrSSv1W0FyO%9&y$@em~n@8}}EXBG6x%ew49J_q%l@As_XnNpi|MTTPr~ca_ zW%uon6dBKL*pvzYFvf<~p6K8hK9BDNNN0$7xp^hWC3n^7FoQ?P(=m(6!Pj&S2f1fqH=`(w)KcPl5aEi2}~4hF*f*g}vaS-=c7v>N8c z{yNM*%+azq=@prWtgpi~^3?^AsJqS(>=pb=6PrGH#=O{Hcho$_F#MtsK$$3e2fZvg zy}!-V%`+uFMOW87LIgu3vKuMgqwY0}*Sd;aokQp(F#-{}Ss(Iy1iekY1ZQX?1WEL? z7=zq`lH-#Hw=bHRio3yPun%`c5rI1Hb|wTSWTs|12Mg#QkkwTmy zAYul0H*_b(BnkP#!R_&p@d54uz0JKthGv3C^fdKS%~alookE`QX@%#MQN2=SFWrOha7Ij7ImStNaWsy~? zsylUeT02_-z-G4s0L!v=+Wx|cxr$tmY&$a1by8z#6HBp!*9{@mU9XQ0h@L%V_R}4g z&s#2{MCOj4`5ux-SUautC5@{U895o-biKMWWoQ09{|jx8wz}@_(ep%Yk4{90C#s6-sa}fU5{}m>#>VtE_b#5bn8O+3k{&6GoEkB;yGie;A_5Uy zqPN*tU()pE+_&~``5XX({el-xT_}%`%fsc>_0@m5{+FhXru>rpyLESe31R>cK^FFrCm+#WL$-D{Z3*9>Lg{wi}xEYn_`@Hy`-d z1N}kIY%@Eu&Bpe|Rr6N;%Yk>6&RI$lgpIO26BYT%C!dU-o4bqqQpGY?p6lPru6Hzc z@WuSDI^BYaDH*>R)~)$V1J0Edn4r(9vo>E<2XjOJr2*G124;t^U+p{iUnZN5oapCpCk(F}}<#3ZZli!Nk z^UWT;Q9qm-i`i$kJS}5P%puBJ<&krTO;*#$Y7d$o96EbQ{aF1XFpTj}wf}eI|IOba z%w}_CWu?JjkV>U-ad9L$@Mu$CU;pUQBZgt5QmI@n=W@9K(A(SF-rnxzy|_!5ekKqCQTad`sa|&&Q6jfy}iAEst?|mH*emIjg9SB zRVWlHl?r3bvh2qnf6V6(+>4TulB%kzFveeh{k1?K*t&J=m>dk9P8SjqQdn4sF;*&- z(b3VFnVH$y*$Rb%rs zefJ#z#KpyZ_0?C$jvY%)O?7a?7#}%u1OT>d*)keF*REZ=c=4j6tkr5MilS*cB_$;< zFArmEv)Oby-7}4>TD9uE_ulKT4s6Bp@^Y0*rBEo&o;?cy8#Zi^%jH+DTv4f1SFc_L zfc5LwXJ=;vKt@K!?%liR&!6Almmq$2R@G|tg$oyGnpP+jQBhF<(9qCOR8%AuiBtJCSc zyu1LQw6wIQre^Zw$^E0N)#}R1%J}$rkw`Qc#z0A{)dIkjDN`I(PfyS2=x9f~R4N64 zPe1*1=gytQ#l=RWao4V0bLY-=?Bpl*dQDA@LZMJ9l{Gar$;rvzfB$`Tb#+==T0=ua zSy@?1N{UXWyL9Q&#*G`Zv$GE#JXljxBauj2T3VD!rO9N<%F3#*uP-Sn(P%W=w{Jgx z{(NC!VNOmC0OaN6ZQHg@tJQw^;fGtdZUulVSFX&NGv~~iGoO9-nNq0~2n78w23E{L zmth7T3|W>10ISuSm6cUgRCMXmr5!tV0D!x@`?6)rcI?<8lgZ#IIehqVOiYYpi@x#3 z8xau^+1c4ER;th&( zVHk--A`l3|!os9dsYatANm8TH96x@%qM{-&FmUtc&2qVX-MV%A_U(J~%{TY#*<&ym zX3Ur|c$No?u%e>k#EBDaZEY7XUVLH`0zh|n zw_~XRz;RH!y1MS)zn_X$Km70mNs@ZKo~G$z$BuD09F}FpVzEY}F&d2ug#rLPJUpgPpKh}a^y$-i zJl@%}XHT6vRaaNHckf=MQYn>6Fk&*D<+ja0B z5C{a#&CQN-V`HPyXe3EeAP~gH#>U3RayT5ZSd1}tbaaSNDAZ^)j%n&QHMoE=7KubA zlWEeVNpiV7Dk=&gzM|0Dz(>0HA5Q-_F}_znz(xxqbU~E|+`a#EH|V zPjA|^DJLg~rs?+f_6rv-T)upnAP7fChoq;cFJHcV=gyt)zWXjs(+gZ<%kMDTlOd1+TFW%&z(D`)oKF*0@Bmd zLqkIy?RvewprGK+ojWv5%Ve?@D^>&r1p$CcrMhuv}x1&joiO~|IC>)G) - - -Lua 5.3 readme - - - - - - - -

-Lua -Welcome to Lua 5.3 -

- - - -

About Lua

-

-Lua is a powerful, fast, lightweight, embeddable scripting language -developed by a -team -at -PUC-Rio, -the Pontifical Catholic University of Rio de Janeiro in Brazil. -Lua is -free software -used in many products and projects around the world. - -

-Lua's -official web site -provides complete information -about Lua, -including -an -executive summary -and -updated -documentation, -especially the -reference manual, -which may differ slightly from the -local copy -distributed in this package. - -

Installing Lua

-

-Lua is distributed in -source -form. -You need to build it before using it. -Building Lua should be straightforward -because -Lua is implemented in pure ANSI C and compiles unmodified in all known -platforms that have an ANSI C compiler. -Lua also compiles unmodified as C++. -The instructions given below for building Lua are for Unix-like platforms. -See also -instructions for other systems -and -customization options. - -

-If you don't have the time or the inclination to compile Lua yourself, -get a binary from -LuaBinaries. -Try also -LuaDist, -a multi-platform distribution of Lua that includes batteries. - -

Building Lua

-

-In most Unix-like platforms, simply do "make" with a suitable target. -Here are the details. - -

    -
  1. -Open a terminal window and move to -the top-level directory, which is named lua-5.3.x. -The Makefile there controls both the build process and the installation process. -

    -

  2. - Do "make" and see if your platform is listed. - The platforms currently supported are: -

    -

    - aix bsd c89 freebsd generic linux macosx mingw posix solaris -

    -

    - If your platform is listed, just do "make xxx", where xxx - is your platform name. -

    - If your platform is not listed, try the closest one or posix, generic, - c89, in this order. -

    -

  3. -The compilation takes only a few moments -and produces three files in the src directory: -lua (the interpreter), -luac (the compiler), -and liblua.a (the library). -

    -

  4. - To check that Lua has been built correctly, do "make test" - after building Lua. This will run the interpreter and print its version. -
-

-If you're running Linux and get compilation errors, -make sure you have installed the readline development package -(which is probably named libreadline-dev or readline-devel). -If you get link errors after that, -then try "make linux MYLIBS=-ltermcap". - -

Installing Lua

-

- Once you have built Lua, you may want to install it in an official - place in your system. In this case, do "make install". The official - place and the way to install files are defined in the Makefile. You'll - probably need the right permissions to install files. - -

- To build and install Lua in one step, do "make xxx install", - where xxx is your platform name. - -

- To install Lua locally, do "make local". - This will create a directory install with subdirectories - bin, include, lib, man, share, - and install Lua as listed below. - - To install Lua locally, but in some other directory, do - "make install INSTALL_TOP=xxx", where xxx is your chosen directory. - The installation starts in the src and doc directories, - so take care if INSTALL_TOP is not an absolute path. - -

-
- bin: -
- lua luac -
- include: -
- lua.h luaconf.h lualib.h lauxlib.h lua.hpp -
- lib: -
- liblua.a -
- man/man1: -
- lua.1 luac.1 -
- -

- These are the only directories you need for development. - If you only want to run Lua programs, - you only need the files in bin and man. - The files in include and lib are needed for - embedding Lua in C or C++ programs. - -

Customization

-

- Three kinds of things can be customized by editing a file: -

    -
  • Where and how to install Lua — edit Makefile. -
  • How to build Lua — edit src/Makefile. -
  • Lua features — edit src/luaconf.h. -
- -

- You don't actually need to edit the Makefiles because you may set the - relevant variables in the command line when invoking make. - Nevertheless, it's probably best to edit and save the Makefiles to - record the changes you've made. - -

- On the other hand, if you need to customize some Lua features, you'll need - to edit src/luaconf.h before building and installing Lua. - The edited file will be the one installed, and - it will be used by any Lua clients that you build, to ensure consistency. - Further customization is available to experts by editing the Lua sources. - -

Building Lua on other systems

-

- If you're not using the usual Unix tools, then the instructions for - building Lua depend on the compiler you use. You'll need to create - projects (or whatever your compiler uses) for building the library, - the interpreter, and the compiler, as follows: - -

-
-library: -
-lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c llex.c -lmem.c lobject.c lopcodes.c lparser.c lstate.c lstring.c ltable.c -ltm.c lundump.c lvm.c lzio.c -lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c -lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c linit.c -
-interpreter: -
- library, lua.c -
-compiler: -
- library, luac.c -
- -

- To use Lua as a library in your own programs you'll need to know how to - create and use libraries with your compiler. Moreover, to dynamically load - C libraries for Lua you'll need to know how to create dynamic libraries - and you'll need to make sure that the Lua API functions are accessible to - those dynamic libraries — but don't link the Lua library - into each dynamic library. For Unix, we recommend that the Lua library - be linked statically into the host program and its symbols exported for - dynamic linking; src/Makefile does this for the Lua interpreter. - For Windows, we recommend that the Lua library be a DLL. - In all cases, the compiler luac should be linked statically. - -

- As mentioned above, you may edit src/luaconf.h to customize - some features before building Lua. - -

Changes since Lua 5.2

-

-Here are the main changes introduced in Lua 5.3. -The -reference manual -lists the -incompatibilities that had to be introduced. - -

Main changes

-
    -
  • integers (64-bit by default) -
  • official support for 32-bit numbers -
  • bitwise operators -
  • basic utf-8 support -
  • functions for packing and unpacking values - -
- -Here are the other changes introduced in Lua 5.3: -

Language

-
    -
  • userdata can have any Lua value as uservalue -
  • integer division -
  • more flexible rules for some metamethods -
- -

Libraries

-
    -
  • ipairs and the table library respect metamethods -
  • strip option in string.dump -
  • table library respects metamethods -
  • new function table.move -
  • new function string.pack -
  • new function string.unpack -
  • new function string.packsize -
- -

C API

-
    -
  • simpler API for continuation functions in C -
  • lua_gettable and similar functions return type of resulted value -
  • strip option in lua_dump -
  • new function: lua_geti -
  • new function: lua_seti -
  • new function: lua_isyieldable -
  • new function: lua_numbertointeger -
  • new function: lua_rotate -
  • new function: lua_stringtonumber -
- -

Lua standalone interpreter

-
    -
  • can be used as calculator; no need to prefix with '=' -
  • arg table available to all code -
- -

License

-

- -[osi certified] - -Lua is free software distributed under the terms of the -MIT license -reproduced below; -it may be used for any purpose, including commercial purposes, -at absolutely no cost without having to ask us. - -The only requirement is that if you do use Lua, -then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation. - -For details, see -this. - -

-Copyright © 1994–2015 Lua.org, PUC-Rio. - -

-Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -

-The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -

-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. -

-

- -

- - - - diff --git a/external/mit/lua/dist/src/Makefile b/external/mit/lua/dist/src/Makefile deleted file mode 100644 index d71c75c87..000000000 --- a/external/mit/lua/dist/src/Makefile +++ /dev/null @@ -1,197 +0,0 @@ -# Makefile for building Lua -# See ../doc/readme.html for installation and customization instructions. - -# == CHANGE THE SETTINGS BELOW TO SUIT YOUR ENVIRONMENT ======================= - -# Your platform. See PLATS for possible values. -PLAT= none - -CC= gcc -std=gnu99 -CFLAGS= -O2 -Wall -Wextra -DLUA_COMPAT_5_2 $(SYSCFLAGS) $(MYCFLAGS) -LDFLAGS= $(SYSLDFLAGS) $(MYLDFLAGS) -LIBS= -lm $(SYSLIBS) $(MYLIBS) - -AR= ar rcu -RANLIB= ranlib -RM= rm -f - -SYSCFLAGS= -SYSLDFLAGS= -SYSLIBS= - -MYCFLAGS= -MYLDFLAGS= -MYLIBS= -MYOBJS= - -# == END OF USER SETTINGS -- NO NEED TO CHANGE ANYTHING BELOW THIS LINE ======= - -PLATS= aix bsd c89 freebsd generic linux macosx mingw posix solaris - -LUA_A= liblua.a -CORE_O= lapi.o lcode.o lctype.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o \ - lmem.o lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o \ - ltm.o lundump.o lvm.o lzio.o -LIB_O= lauxlib.o lbaselib.o lbitlib.o lcorolib.o ldblib.o liolib.o \ - lmathlib.o loslib.o lstrlib.o ltablib.o lutf8lib.o loadlib.o linit.o -BASE_O= $(CORE_O) $(LIB_O) $(MYOBJS) - -LUA_T= lua -LUA_O= lua.o - -LUAC_T= luac -LUAC_O= luac.o - -ALL_O= $(BASE_O) $(LUA_O) $(LUAC_O) -ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T) -ALL_A= $(LUA_A) - -# Targets start here. -default: $(PLAT) - -all: $(ALL_T) - -o: $(ALL_O) - -a: $(ALL_A) - -$(LUA_A): $(BASE_O) - $(AR) $@ $(BASE_O) - $(RANLIB) $@ - -$(LUA_T): $(LUA_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUA_O) $(LUA_A) $(LIBS) - -$(LUAC_T): $(LUAC_O) $(LUA_A) - $(CC) -o $@ $(LDFLAGS) $(LUAC_O) $(LUA_A) $(LIBS) - -clean: - $(RM) $(ALL_T) $(ALL_O) - -depend: - @$(CC) $(CFLAGS) -MM l*.c - -echo: - @echo "PLAT= $(PLAT)" - @echo "CC= $(CC)" - @echo "CFLAGS= $(CFLAGS)" - @echo "LDFLAGS= $(SYSLDFLAGS)" - @echo "LIBS= $(LIBS)" - @echo "AR= $(AR)" - @echo "RANLIB= $(RANLIB)" - @echo "RM= $(RM)" - -# Convenience targets for popular platforms -ALL= all - -none: - @echo "Please do 'make PLATFORM' where PLATFORM is one of these:" - @echo " $(PLATS)" - -aix: - $(MAKE) $(ALL) CC="xlc" CFLAGS="-O2 -DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-ldl" SYSLDFLAGS="-brtl -bexpall" - -bsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN" SYSLIBS="-Wl,-E" - -c89: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_C89" CC="gcc -std=c89" - @echo '' - @echo '*** C89 does not guarantee 64-bit integers for Lua.' - @echo '' - - -freebsd: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -lreadline" - -generic: $(ALL) - -linux: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_LINUX" SYSLIBS="-Wl,-E -ldl -lreadline" - -macosx: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_MACOSX" SYSLIBS="-lreadline" CC=cc - -mingw: - $(MAKE) "LUA_A=lua53.dll" "LUA_T=lua.exe" \ - "AR=$(CC) -shared -o" "RANLIB=strip --strip-unneeded" \ - "SYSCFLAGS=-DLUA_BUILD_AS_DLL" "SYSLIBS=" "SYSLDFLAGS=-s" lua.exe - $(MAKE) "LUAC_T=luac.exe" luac.exe - -posix: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX" - -solaris: - $(MAKE) $(ALL) SYSCFLAGS="-DLUA_USE_POSIX -DLUA_USE_DLOPEN -D_REENTRANT" SYSLIBS="-ldl" - -# list targets that do not create files (but not all makes understand .PHONY) -.PHONY: all $(PLATS) default o a clean depend echo none - -# DO NOT DELETE - -lapi.o: lapi.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lstring.h \ - ltable.h lundump.h lvm.h -lauxlib.o: lauxlib.c lprefix.h lua.h luaconf.h lauxlib.h -lbaselib.o: lbaselib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lbitlib.o: lbitlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lcode.o: lcode.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ - llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ - ldo.h lgc.h lstring.h ltable.h lvm.h -lcorolib.o: lcorolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lctype.o: lctype.c lprefix.h lctype.h lua.h luaconf.h llimits.h -ldblib.o: ldblib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ldebug.o: ldebug.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h lcode.h llex.h lopcodes.h lparser.h \ - ldebug.h ldo.h lfunc.h lstring.h lgc.h ltable.h lvm.h -ldo.o: ldo.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h lopcodes.h \ - lparser.h lstring.h ltable.h lundump.h lvm.h -ldump.o: ldump.c lprefix.h lua.h luaconf.h lobject.h llimits.h lstate.h \ - ltm.h lzio.h lmem.h lundump.h -lfunc.o: lfunc.c lprefix.h lua.h luaconf.h lfunc.h lobject.h llimits.h \ - lgc.h lstate.h ltm.h lzio.h lmem.h -lgc.o: lgc.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lstring.h ltable.h -linit.o: linit.c lprefix.h lua.h luaconf.h lualib.h lauxlib.h -liolib.o: liolib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -llex.o: llex.c lprefix.h lua.h luaconf.h lctype.h llimits.h ldebug.h \ - lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lgc.h llex.h lparser.h \ - lstring.h ltable.h -lmathlib.o: lmathlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lmem.o: lmem.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h -loadlib.o: loadlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lobject.o: lobject.c lprefix.h lua.h luaconf.h lctype.h llimits.h \ - ldebug.h lstate.h lobject.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h \ - lvm.h -lopcodes.o: lopcodes.c lprefix.h lopcodes.h llimits.h lua.h luaconf.h -loslib.o: loslib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lparser.o: lparser.c lprefix.h lua.h luaconf.h lcode.h llex.h lobject.h \ - llimits.h lzio.h lmem.h lopcodes.h lparser.h ldebug.h lstate.h ltm.h \ - ldo.h lfunc.h lstring.h lgc.h ltable.h -lstate.o: lstate.c lprefix.h lua.h luaconf.h lapi.h llimits.h lstate.h \ - lobject.h ltm.h lzio.h lmem.h ldebug.h ldo.h lfunc.h lgc.h llex.h \ - lstring.h ltable.h -lstring.o: lstring.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ - lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h -lstrlib.o: lstrlib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ltable.o: ltable.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lgc.h lstring.h ltable.h lvm.h -ltablib.o: ltablib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -ltm.o: ltm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lstring.h lgc.h ltable.h lvm.h -lua.o: lua.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -luac.o: luac.c lprefix.h lua.h luaconf.h lauxlib.h lobject.h llimits.h \ - lstate.h ltm.h lzio.h lmem.h lundump.h ldebug.h lopcodes.h -lundump.o: lundump.c lprefix.h lua.h luaconf.h ldebug.h lstate.h \ - lobject.h llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lstring.h lgc.h \ - lundump.h -lutf8lib.o: lutf8lib.c lprefix.h lua.h luaconf.h lauxlib.h lualib.h -lvm.o: lvm.c lprefix.h lua.h luaconf.h ldebug.h lstate.h lobject.h \ - llimits.h ltm.h lzio.h lmem.h ldo.h lfunc.h lgc.h lopcodes.h lstring.h \ - ltable.h lvm.h -lzio.o: lzio.c lprefix.h lua.h luaconf.h llimits.h lmem.h lstate.h \ - lobject.h ltm.h lzio.h - -# (end of Makefile) diff --git a/external/mit/lua/dist/src/lapi.c b/external/mit/lua/dist/src/lapi.c deleted file mode 100644 index bb078d70c..000000000 --- a/external/mit/lua/dist/src/lapi.c +++ /dev/null @@ -1,1283 +0,0 @@ -/* $NetBSD: lapi.c,v 1.5 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lapi.c,v 2.249 2015/04/06 12:23:48 roberto Exp -** Lua API -** See Copyright Notice in lua.h -*/ - -#define lapi_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lundump.h" -#include "lvm.h" - - - -const char lua_ident[] = - "$LuaVersion: " LUA_COPYRIGHT " $" - "$LuaAuthors: " LUA_AUTHORS " $"; - - -/* value at a non-valid index */ -#define NONVALIDVALUE cast(TValue *, luaO_nilobject) - -/* corresponding test */ -#define isvalid(o) ((o) != luaO_nilobject) - -/* test for pseudo index */ -#define ispseudo(i) ((i) <= LUA_REGISTRYINDEX) - -/* test for upvalue */ -#define isupvalue(i) ((i) < LUA_REGISTRYINDEX) - -/* test for valid but not pseudo index */ -#define isstackindex(i, o) (isvalid(o) && !ispseudo(i)) - -#define api_checkvalidindex(l,o) api_check(l, isvalid(o), "invalid index") - -#define api_checkstackindex(l, i, o) \ - api_check(l, isstackindex(i, o), "index not in the stack") - - -static TValue *index2addr (lua_State *L, int idx) { - CallInfo *ci = L->ci; - if (idx > 0) { - TValue *o = ci->func + idx; - api_check(L, idx <= ci->top - (ci->func + 1), "unacceptable index"); - if (o >= L->top) return NONVALIDVALUE; - else return o; - } - else if (!ispseudo(idx)) { /* negative index */ - api_check(L, idx != 0 && -idx <= L->top - (ci->func + 1), "invalid index"); - return L->top + idx; - } - else if (idx == LUA_REGISTRYINDEX) - return &G(L)->l_registry; - else { /* upvalues */ - idx = LUA_REGISTRYINDEX - idx; - api_check(L, idx <= MAXUPVAL + 1, "upvalue index too large"); - if (ttislcf(ci->func)) /* light C function? */ - return NONVALIDVALUE; /* it has no upvalues */ - else { - CClosure *func = clCvalue(ci->func); - return (idx <= func->nupvalues) ? &func->upvalue[idx-1] : NONVALIDVALUE; - } - } -} - - -/* -** to be called by 'lua_checkstack' in protected mode, to grow stack -** capturing memory errors -*/ -static void growstack (lua_State *L, void *ud) { - int size = *(int *)ud; - luaD_growstack(L, size); -} - - -LUA_API int lua_checkstack (lua_State *L, int n) { - int res; - CallInfo *ci = L->ci; - lua_lock(L); - api_check(L, n >= 0, "negative 'n'"); - if (L->stack_last - L->top > n) /* stack large enough? */ - res = 1; /* yes; check is OK */ - else { /* no; need to grow stack */ - int inuse = cast_int(L->top - L->stack) + EXTRA_STACK; - if (inuse > LUAI_MAXSTACK - n) /* can grow without overflow? */ - res = 0; /* no */ - else /* try to grow stack */ - res = (luaD_rawrunprotected(L, &growstack, &n) == LUA_OK); - } - if (res && ci->top < L->top + n) - ci->top = L->top + n; /* adjust frame top */ - lua_unlock(L); - return res; -} - - -LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { - int i; - if (from == to) return; - lua_lock(to); - api_checknelems(from, n); - api_check(from, G(from) == G(to), "moving among independent states"); - api_check(from, to->ci->top - to->top >= n, "not enough elements to move"); - from->top -= n; - for (i = 0; i < n; i++) { - setobj2s(to, to->top, from->top + i); - api_incr_top(to); - } - lua_unlock(to); -} - - -LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { - lua_CFunction old; - lua_lock(L); - old = G(L)->panic; - G(L)->panic = panicf; - lua_unlock(L); - return old; -} - - -LUA_API const lua_Number *lua_version (lua_State *L) { - static const lua_Number version = LUA_VERSION_NUM; - if (L == NULL) return &version; - else return G(L)->version; -} - - - -/* -** basic stack manipulation -*/ - - -/* -** convert an acceptable stack index into an absolute index -*/ -LUA_API int lua_absindex (lua_State *L, int idx) { - return (idx > 0 || ispseudo(idx)) - ? idx - : cast_int(L->top - L->ci->func) + idx; -} - - -LUA_API int lua_gettop (lua_State *L) { - return cast_int(L->top - (L->ci->func + 1)); -} - - -LUA_API void lua_settop (lua_State *L, int idx) { - StkId func = L->ci->func; - lua_lock(L); - if (idx >= 0) { - api_check(L, idx <= L->stack_last - (func + 1), "new top too large"); - while (L->top < (func + 1) + idx) - setnilvalue(L->top++); - L->top = (func + 1) + idx; - } - else { - api_check(L, -(idx+1) <= (L->top - (func + 1)), "invalid new top"); - L->top += idx+1; /* 'subtract' index (index is negative) */ - } - lua_unlock(L); -} - - -/* -** Reverse the stack segment from 'from' to 'to' -** (auxiliary to 'lua_rotate') -*/ -static void reverse (lua_State *L, StkId from, StkId to) { - for (; from < to; from++, to--) { - TValue temp; - setobj(L, &temp, from); - setobjs2s(L, from, to); - setobj2s(L, to, &temp); - } -} - - -/* -** Let x = AB, where A is a prefix of length 'n'. Then, -** rotate x n == BA. But BA == (A^r . B^r)^r. -*/ -LUA_API void lua_rotate (lua_State *L, int idx, int n) { - StkId p, t, m; - lua_lock(L); - t = L->top - 1; /* end of stack segment being rotated */ - p = index2addr(L, idx); /* start of segment */ - api_checkstackindex(L, idx, p); - api_check(L, (n >= 0 ? n : -n) <= (t - p + 1), "invalid 'n'"); - m = (n >= 0 ? t - n : p - n - 1); /* end of prefix */ - reverse(L, p, m); /* reverse the prefix with length 'n' */ - reverse(L, m + 1, t); /* reverse the suffix */ - reverse(L, p, t); /* reverse the entire segment */ - lua_unlock(L); -} - - -LUA_API void lua_copy (lua_State *L, int fromidx, int toidx) { - TValue *fr, *to; - lua_lock(L); - fr = index2addr(L, fromidx); - to = index2addr(L, toidx); - api_checkvalidindex(L, to); - setobj(L, to, fr); - if (isupvalue(toidx)) /* function upvalue? */ - luaC_barrier(L, clCvalue(L->ci->func), fr); - /* LUA_REGISTRYINDEX does not need gc barrier - (collector revisits it before finishing collection) */ - lua_unlock(L); -} - - -LUA_API void lua_pushvalue (lua_State *L, int idx) { - lua_lock(L); - setobj2s(L, L->top, index2addr(L, idx)); - api_incr_top(L); - lua_unlock(L); -} - - - -/* -** access functions (stack -> C) -*/ - - -LUA_API int lua_type (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (isvalid(o) ? ttnov(o) : LUA_TNONE); -} - - -LUA_API const char *lua_typename (lua_State *L, int t) { - UNUSED(L); - api_check(L, LUA_TNONE <= t && t < LUA_NUMTAGS, "invalid tag"); - return ttypename(t); -} - - -LUA_API int lua_iscfunction (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (ttislcf(o) || (ttisCclosure(o))); -} - - -LUA_API int lua_isinteger (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return ttisinteger(o); -} - - -LUA_API int lua_isnumber (lua_State *L, int idx) { - lua_Number n; - const TValue *o = index2addr(L, idx); - return tonumber(o, &n); -} - - -LUA_API int lua_isstring (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return (ttisstring(o) || cvt2str(o)); -} - - -LUA_API int lua_isuserdata (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return (ttisfulluserdata(o) || ttislightuserdata(o)); -} - - -LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { - StkId o1 = index2addr(L, index1); - StkId o2 = index2addr(L, index2); - return (isvalid(o1) && isvalid(o2)) ? luaV_rawequalobj(o1, o2) : 0; -} - - -LUA_API void lua_arith (lua_State *L, int op) { - lua_lock(L); - if (op != LUA_OPUNM && op != LUA_OPBNOT) - api_checknelems(L, 2); /* all other operations expect two operands */ - else { /* for unary operations, add fake 2nd operand */ - api_checknelems(L, 1); - setobjs2s(L, L->top, L->top - 1); - api_incr_top(L); - } - /* first operand at top - 2, second at top - 1; result go to top - 2 */ - luaO_arith(L, op, L->top - 2, L->top - 1, L->top - 2); - L->top--; /* remove second operand */ - lua_unlock(L); -} - - -LUA_API int lua_compare (lua_State *L, int index1, int index2, int op) { - StkId o1, o2; - int i = 0; - lua_lock(L); /* may call tag method */ - o1 = index2addr(L, index1); - o2 = index2addr(L, index2); - if (isvalid(o1) && isvalid(o2)) { - switch (op) { - case LUA_OPEQ: i = luaV_equalobj(L, o1, o2); break; - case LUA_OPLT: i = luaV_lessthan(L, o1, o2); break; - case LUA_OPLE: i = luaV_lessequal(L, o1, o2); break; - default: api_check(L, 0, "invalid option"); - } - } - lua_unlock(L); - return i; -} - - -LUA_API size_t lua_stringtonumber (lua_State *L, const char *s) { - size_t sz = luaO_str2num(s, L->top); - if (sz != 0) - api_incr_top(L); - return sz; -} - - -#ifndef _KERNEL -LUA_API lua_Number lua_tonumberx (lua_State *L, int idx, int *pisnum) { - lua_Number n; - const TValue *o = index2addr(L, idx); - int isnum = tonumber(o, &n); - if (!isnum) - n = 0; /* call to 'tonumber' may change 'n' even if it fails */ - if (pisnum) *pisnum = isnum; - return n; -} -#endif - - -LUA_API lua_Integer lua_tointegerx (lua_State *L, int idx, int *pisnum) { - lua_Integer res; - const TValue *o = index2addr(L, idx); - int isnum = tointeger(o, &res); - if (!isnum) - res = 0; /* call to 'tointeger' may change 'n' even if it fails */ - if (pisnum) *pisnum = isnum; - return res; -} - - -LUA_API int lua_toboolean (lua_State *L, int idx) { - const TValue *o = index2addr(L, idx); - return !l_isfalse(o); -} - - -LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { - StkId o = index2addr(L, idx); - if (!ttisstring(o)) { - if (!cvt2str(o)) { /* not convertible? */ - if (len != NULL) *len = 0; - return NULL; - } - lua_lock(L); /* 'luaO_tostring' may create a new string */ - luaC_checkGC(L); - o = index2addr(L, idx); /* previous call may reallocate the stack */ - luaO_tostring(L, o); - lua_unlock(L); - } - if (len != NULL) - *len = vslen(o); - return svalue(o); -} - - -LUA_API size_t lua_rawlen (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttype(o)) { - case LUA_TSHRSTR: return tsvalue(o)->shrlen; - case LUA_TLNGSTR: return tsvalue(o)->u.lnglen; - case LUA_TUSERDATA: return uvalue(o)->len; - case LUA_TTABLE: return luaH_getn(hvalue(o)); - default: return 0; - } -} - - -LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - if (ttislcf(o)) return fvalue(o); - else if (ttisCclosure(o)) - return clCvalue(o)->f; - else return NULL; /* not a C function */ -} - - -LUA_API void *lua_touserdata (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttnov(o)) { - case LUA_TUSERDATA: return getudatamem(uvalue(o)); - case LUA_TLIGHTUSERDATA: return pvalue(o); - default: return NULL; - } -} - - -LUA_API lua_State *lua_tothread (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - return (!ttisthread(o)) ? NULL : thvalue(o); -} - - -LUA_API const void *lua_topointer (lua_State *L, int idx) { - StkId o = index2addr(L, idx); - switch (ttype(o)) { - case LUA_TTABLE: return hvalue(o); - case LUA_TLCL: return clLvalue(o); - case LUA_TCCL: return clCvalue(o); - case LUA_TLCF: return cast(void *, cast(size_t, fvalue(o))); - case LUA_TTHREAD: return thvalue(o); - case LUA_TUSERDATA: return getudatamem(uvalue(o)); - case LUA_TLIGHTUSERDATA: return pvalue(o); - default: return NULL; - } -} - - - -/* -** push functions (C -> stack) -*/ - - -LUA_API void lua_pushnil (lua_State *L) { - lua_lock(L); - setnilvalue(L->top); - api_incr_top(L); - lua_unlock(L); -} - - -#ifndef _KERNEL -LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { - lua_lock(L); - setfltvalue(L->top, n); - api_incr_top(L); - lua_unlock(L); -} -#endif - - -LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { - lua_lock(L); - setivalue(L->top, n); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API const char *lua_pushlstring (lua_State *L, const char *s, size_t len) { - TString *ts; - lua_lock(L); - luaC_checkGC(L); - ts = luaS_newlstr(L, s, len); - setsvalue2s(L, L->top, ts); - api_incr_top(L); - lua_unlock(L); - return getstr(ts); -} - - -LUA_API const char *lua_pushstring (lua_State *L, const char *s) { - lua_lock(L); - if (s == NULL) - setnilvalue(L->top); - else { - TString *ts; - luaC_checkGC(L); - ts = luaS_new(L, s); - setsvalue2s(L, L->top, ts); - s = getstr(ts); /* internal copy's address */ - } - api_incr_top(L); - lua_unlock(L); - return s; -} - - -LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, - va_list argp) { - const char *ret; - lua_lock(L); - luaC_checkGC(L); - ret = luaO_pushvfstring(L, fmt, argp); - lua_unlock(L); - return ret; -} - - -LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { - const char *ret; - va_list argp; - lua_lock(L); - luaC_checkGC(L); - va_start(argp, fmt); - ret = luaO_pushvfstring(L, fmt, argp); - va_end(argp); - lua_unlock(L); - return ret; -} - - -LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { - lua_lock(L); - if (n == 0) { - setfvalue(L->top, fn); - } - else { - CClosure *cl; - api_checknelems(L, n); - api_check(L, n <= MAXUPVAL, "upvalue index too large"); - luaC_checkGC(L); - cl = luaF_newCclosure(L, n); - cl->f = fn; - L->top -= n; - while (n--) { - setobj2n(L, &cl->upvalue[n], L->top + n); - /* does not need barrier because closure is white */ - } - setclCvalue(L, L->top, cl); - } - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushboolean (lua_State *L, int b) { - lua_lock(L); - setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { - lua_lock(L); - setpvalue(L->top, p); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API int lua_pushthread (lua_State *L) { - lua_lock(L); - setthvalue(L, L->top, L); - api_incr_top(L); - lua_unlock(L); - return (G(L)->mainthread == L); -} - - - -/* -** get functions (Lua -> stack) -*/ - - -LUA_API int lua_getglobal (lua_State *L, const char *name) { - Table *reg = hvalue(&G(L)->l_registry); - const TValue *gt; /* global table */ - lua_lock(L); - gt = luaH_getint(reg, LUA_RIDX_GLOBALS); - setsvalue2s(L, L->top, luaS_new(L, name)); - api_incr_top(L); - luaV_gettable(L, gt, L->top - 1, L->top - 1); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_gettable (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - luaV_gettable(L, t, L->top - 1, L->top - 1); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_getfield (lua_State *L, int idx, const char *k) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - setsvalue2s(L, L->top, luaS_new(L, k)); - api_incr_top(L); - luaV_gettable(L, t, L->top - 1, L->top - 1); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_geti (lua_State *L, int idx, lua_Integer n) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - setivalue(L->top, n); - api_incr_top(L); - luaV_gettable(L, t, L->top - 1, L->top - 1); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawget (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setobj2s(L, L->top - 1, luaH_get(hvalue(t), L->top - 1)); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawgeti (lua_State *L, int idx, lua_Integer n) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setobj2s(L, L->top, luaH_getint(hvalue(t), n)); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API int lua_rawgetp (lua_State *L, int idx, const void *p) { - StkId t; - TValue k; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - setpvalue(&k, cast(void *, p)); - setobj2s(L, L->top, luaH_get(hvalue(t), &k)); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { - Table *t; - lua_lock(L); - luaC_checkGC(L); - t = luaH_new(L); - sethvalue(L, L->top, t); - api_incr_top(L); - if (narray > 0 || nrec > 0) - luaH_resize(L, t, narray, nrec); - lua_unlock(L); -} - - -LUA_API int lua_getmetatable (lua_State *L, int objindex) { - const TValue *obj; - Table *mt; - int res = 0; - lua_lock(L); - obj = index2addr(L, objindex); - switch (ttnov(obj)) { - case LUA_TTABLE: - mt = hvalue(obj)->metatable; - break; - case LUA_TUSERDATA: - mt = uvalue(obj)->metatable; - break; - default: - mt = G(L)->mt[ttnov(obj)]; - break; - } - if (mt != NULL) { - sethvalue(L, L->top, mt); - api_incr_top(L); - res = 1; - } - lua_unlock(L); - return res; -} - - -LUA_API int lua_getuservalue (lua_State *L, int idx) { - StkId o; - lua_lock(L); - o = index2addr(L, idx); - api_check(L, ttisfulluserdata(o), "full userdata expected"); - getuservalue(L, uvalue(o), L->top); - api_incr_top(L); - lua_unlock(L); - return ttnov(L->top - 1); -} - - -/* -** set functions (stack -> Lua) -*/ - - -LUA_API void lua_setglobal (lua_State *L, const char *name) { - Table *reg = hvalue(&G(L)->l_registry); - const TValue *gt; /* global table */ - lua_lock(L); - api_checknelems(L, 1); - gt = luaH_getint(reg, LUA_RIDX_GLOBALS); - setsvalue2s(L, L->top, luaS_new(L, name)); - api_incr_top(L); - luaV_settable(L, gt, L->top - 1, L->top - 2); - L->top -= 2; /* pop value and key */ - lua_unlock(L); -} - - -LUA_API void lua_settable (lua_State *L, int idx) { - StkId t; - lua_lock(L); - api_checknelems(L, 2); - t = index2addr(L, idx); - luaV_settable(L, t, L->top - 2, L->top - 1); - L->top -= 2; /* pop index and value */ - lua_unlock(L); -} - - -LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { - StkId t; - lua_lock(L); - api_checknelems(L, 1); - t = index2addr(L, idx); - setsvalue2s(L, L->top, luaS_new(L, k)); - api_incr_top(L); - luaV_settable(L, t, L->top - 1, L->top - 2); - L->top -= 2; /* pop value and key */ - lua_unlock(L); -} - - -LUA_API void lua_seti (lua_State *L, int idx, lua_Integer n) { - StkId t; - lua_lock(L); - api_checknelems(L, 1); - t = index2addr(L, idx); - setivalue(L->top, n); - api_incr_top(L); - luaV_settable(L, t, L->top - 1, L->top - 2); - L->top -= 2; /* pop value and key */ - lua_unlock(L); -} - - -LUA_API void lua_rawset (lua_State *L, int idx) { - StkId o; - Table *t; - lua_lock(L); - api_checknelems(L, 2); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - t = hvalue(o); - setobj2t(L, luaH_set(L, t, L->top-2), L->top-1); - invalidateTMcache(t); - luaC_barrierback(L, t, L->top-1); - L->top -= 2; - lua_unlock(L); -} - - -LUA_API void lua_rawseti (lua_State *L, int idx, lua_Integer n) { - StkId o; - Table *t; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - t = hvalue(o); - luaH_setint(L, t, n, L->top - 1); - luaC_barrierback(L, t, L->top-1); - L->top--; - lua_unlock(L); -} - - -LUA_API void lua_rawsetp (lua_State *L, int idx, const void *p) { - StkId o; - Table *t; - TValue k; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttistable(o), "table expected"); - t = hvalue(o); - setpvalue(&k, cast(void *, p)); - setobj2t(L, luaH_set(L, t, &k), L->top - 1); - luaC_barrierback(L, t, L->top - 1); - L->top--; - lua_unlock(L); -} - - -LUA_API int lua_setmetatable (lua_State *L, int objindex) { - TValue *obj; - Table *mt; - lua_lock(L); - api_checknelems(L, 1); - obj = index2addr(L, objindex); - if (ttisnil(L->top - 1)) - mt = NULL; - else { - api_check(L, ttistable(L->top - 1), "table expected"); - mt = hvalue(L->top - 1); - } - switch (ttnov(obj)) { - case LUA_TTABLE: { - hvalue(obj)->metatable = mt; - if (mt) { - luaC_objbarrier(L, gcvalue(obj), mt); - luaC_checkfinalizer(L, gcvalue(obj), mt); - } - break; - } - case LUA_TUSERDATA: { - uvalue(obj)->metatable = mt; - if (mt) { - luaC_objbarrier(L, uvalue(obj), mt); - luaC_checkfinalizer(L, gcvalue(obj), mt); - } - break; - } - default: { - G(L)->mt[ttnov(obj)] = mt; - break; - } - } - L->top--; - lua_unlock(L); - return 1; -} - - -LUA_API void lua_setuservalue (lua_State *L, int idx) { - StkId o; - lua_lock(L); - api_checknelems(L, 1); - o = index2addr(L, idx); - api_check(L, ttisfulluserdata(o), "full userdata expected"); - setuservalue(L, uvalue(o), L->top - 1); - luaC_barrier(L, gcvalue(o), L->top - 1); - L->top--; - lua_unlock(L); -} - - -/* -** 'load' and 'call' functions (run Lua code) -*/ - - -#define checkresults(L,na,nr) \ - api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na)), \ - "results from function overflow current stack size") - - -LUA_API void lua_callk (lua_State *L, int nargs, int nresults, - lua_KContext ctx, lua_KFunction k) { - StkId func; - lua_lock(L); - api_check(L, k == NULL || !isLua(L->ci), - "cannot use continuations inside hooks"); - api_checknelems(L, nargs+1); - api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); - checkresults(L, nargs, nresults); - func = L->top - (nargs+1); - if (k != NULL && L->nny == 0) { /* need to prepare continuation? */ - L->ci->u.c.k = k; /* save continuation */ - L->ci->u.c.ctx = ctx; /* save context */ - luaD_call(L, func, nresults, 1); /* do the call */ - } - else /* no continuation or no yieldable */ - luaD_call(L, func, nresults, 0); /* just do the call */ - adjustresults(L, nresults); - lua_unlock(L); -} - - - -/* -** Execute a protected call. -*/ -struct CallS { /* data to 'f_call' */ - StkId func; - int nresults; -}; - - -static void f_call (lua_State *L, void *ud) { - struct CallS *c = cast(struct CallS *, ud); - luaD_call(L, c->func, c->nresults, 0); -} - - - -LUA_API int lua_pcallk (lua_State *L, int nargs, int nresults, int errfunc, - lua_KContext ctx, lua_KFunction k) { - struct CallS c; - int status; - ptrdiff_t func; - lua_lock(L); - api_check(L, k == NULL || !isLua(L->ci), - "cannot use continuations inside hooks"); - api_checknelems(L, nargs+1); - api_check(L, L->status == LUA_OK, "cannot do calls on non-normal thread"); - checkresults(L, nargs, nresults); - if (errfunc == 0) - func = 0; - else { - StkId o = index2addr(L, errfunc); - api_checkstackindex(L, errfunc, o); - func = savestack(L, o); - } - c.func = L->top - (nargs+1); /* function to be called */ - if (k == NULL || L->nny > 0) { /* no continuation or no yieldable? */ - c.nresults = nresults; /* do a 'conventional' protected call */ - status = luaD_pcall(L, f_call, &c, savestack(L, c.func), func); - } - else { /* prepare continuation (call is already protected by 'resume') */ - CallInfo *ci = L->ci; - ci->u.c.k = k; /* save continuation */ - ci->u.c.ctx = ctx; /* save context */ - /* save information for error recovery */ - ci->extra = savestack(L, c.func); - ci->u.c.old_errfunc = L->errfunc; - L->errfunc = func; - setoah(ci->callstatus, L->allowhook); /* save value of 'allowhook' */ - ci->callstatus |= CIST_YPCALL; /* function can do error recovery */ - luaD_call(L, c.func, nresults, 1); /* do the call */ - ci->callstatus &= ~CIST_YPCALL; - L->errfunc = ci->u.c.old_errfunc; - status = LUA_OK; /* if it is here, there were no errors */ - } - adjustresults(L, nresults); - lua_unlock(L); - return status; -} - - -LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, - const char *chunkname, const char *mode) { - ZIO z; - int status; - lua_lock(L); - if (!chunkname) chunkname = "?"; - luaZ_init(L, &z, reader, data); - status = luaD_protectedparser(L, &z, chunkname, mode); - if (status == LUA_OK) { /* no errors? */ - LClosure *f = clLvalue(L->top - 1); /* get newly created function */ - if (f->nupvalues >= 1) { /* does it have an upvalue? */ - /* get global table from registry */ - Table *reg = hvalue(&G(L)->l_registry); - const TValue *gt = luaH_getint(reg, LUA_RIDX_GLOBALS); - /* set global table as 1st upvalue of 'f' (may be LUA_ENV) */ - setobj(L, f->upvals[0]->v, gt); - luaC_upvalbarrier(L, f->upvals[0]); - } - } - lua_unlock(L); - return status; -} - - -LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data, int strip) { - int status; - TValue *o; - lua_lock(L); - api_checknelems(L, 1); - o = L->top - 1; - if (isLfunction(o)) - status = luaU_dump(L, getproto(o), writer, data, strip); - else - status = 1; - lua_unlock(L); - return status; -} - - -LUA_API int lua_status (lua_State *L) { - return L->status; -} - - -/* -** Garbage-collection function -*/ - -LUA_API int lua_gc (lua_State *L, int what, int data) { - int res = 0; - global_State *g; - lua_lock(L); - g = G(L); - switch (what) { - case LUA_GCSTOP: { - g->gcrunning = 0; - break; - } - case LUA_GCRESTART: { - luaE_setdebt(g, 0); - g->gcrunning = 1; - break; - } - case LUA_GCCOLLECT: { - luaC_fullgc(L, 0); - break; - } - case LUA_GCCOUNT: { - /* GC values are expressed in Kbytes: #bytes/2^10 */ - res = cast_int(gettotalbytes(g) >> 10); - break; - } - case LUA_GCCOUNTB: { - res = cast_int(gettotalbytes(g) & 0x3ff); - break; - } - case LUA_GCSTEP: { - l_mem debt = 1; /* =1 to signal that it did an actual step */ - int oldrunning = g->gcrunning; - g->gcrunning = 1; /* allow GC to run */ - if (data == 0) { - luaE_setdebt(g, -GCSTEPSIZE); /* to do a "small" step */ - luaC_step(L); - } - else { /* add 'data' to total debt */ - debt = cast(l_mem, data) * 1024 + g->GCdebt; - luaE_setdebt(g, debt); - luaC_checkGC(L); - } - g->gcrunning = oldrunning; /* restore previous state */ - if (debt > 0 && g->gcstate == GCSpause) /* end of cycle? */ - res = 1; /* signal it */ - break; - } - case LUA_GCSETPAUSE: { - res = g->gcpause; - g->gcpause = data; - break; - } - case LUA_GCSETSTEPMUL: { - res = g->gcstepmul; - if (data < 40) data = 40; /* avoid ridiculous low values (and 0) */ - g->gcstepmul = data; - break; - } - case LUA_GCISRUNNING: { - res = g->gcrunning; - break; - } - default: res = -1; /* invalid option */ - } - lua_unlock(L); - return res; -} - - - -/* -** miscellaneous functions -*/ - - -LUA_API int lua_error (lua_State *L) { - lua_lock(L); - api_checknelems(L, 1); - luaG_errormsg(L); - /* code unreachable; will unlock when control actually leaves the kernel */ - return 0; /* to avoid warnings */ -} - - -LUA_API int lua_next (lua_State *L, int idx) { - StkId t; - int more; - lua_lock(L); - t = index2addr(L, idx); - api_check(L, ttistable(t), "table expected"); - more = luaH_next(L, hvalue(t), L->top - 1); - if (more) { - api_incr_top(L); - } - else /* no more elements */ - L->top -= 1; /* remove key */ - lua_unlock(L); - return more; -} - - -LUA_API void lua_concat (lua_State *L, int n) { - lua_lock(L); - api_checknelems(L, n); - if (n >= 2) { - luaC_checkGC(L); - luaV_concat(L, n); - } - else if (n == 0) { /* push empty string */ - setsvalue2s(L, L->top, luaS_newlstr(L, "", 0)); - api_incr_top(L); - } - /* else n == 1; nothing to do */ - lua_unlock(L); -} - - -LUA_API void lua_len (lua_State *L, int idx) { - StkId t; - lua_lock(L); - t = index2addr(L, idx); - luaV_objlen(L, L->top, t); - api_incr_top(L); - lua_unlock(L); -} - - -LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { - lua_Alloc f; - lua_lock(L); - if (ud) *ud = G(L)->ud; - f = G(L)->frealloc; - lua_unlock(L); - return f; -} - - -LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { - lua_lock(L); - G(L)->ud = ud; - G(L)->frealloc = f; - lua_unlock(L); -} - - -LUA_API void *lua_newuserdata (lua_State *L, size_t size) { - Udata *u; - lua_lock(L); - luaC_checkGC(L); - u = luaS_newudata(L, size); - setuvalue(L, L->top, u); - api_incr_top(L); - lua_unlock(L); - return getudatamem(u); -} - - - -static const char *aux_upvalue (StkId fi, int n, TValue **val, - CClosure **owner, UpVal **uv) { - switch (ttype(fi)) { - case LUA_TCCL: { /* C closure */ - CClosure *f = clCvalue(fi); - if (!(1 <= n && n <= f->nupvalues)) return NULL; - *val = &f->upvalue[n-1]; - if (owner) *owner = f; - return ""; - } - case LUA_TLCL: { /* Lua closure */ - LClosure *f = clLvalue(fi); - TString *name; - Proto *p = f->p; - if (!(1 <= n && n <= p->sizeupvalues)) return NULL; - *val = f->upvals[n-1]->v; - if (uv) *uv = f->upvals[n - 1]; - name = p->upvalues[n-1].name; - return (name == NULL) ? "(*no name)" : getstr(name); - } - default: return NULL; /* not a closure */ - } -} - - -LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { - const char *name; - TValue *val = NULL; /* to avoid warnings */ - lua_lock(L); - name = aux_upvalue(index2addr(L, funcindex), n, &val, NULL, NULL); - if (name) { - setobj2s(L, L->top, val); - api_incr_top(L); - } - lua_unlock(L); - return name; -} - - -LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { - const char *name; - TValue *val = NULL; /* to avoid warnings */ - CClosure *owner = NULL; - UpVal *uv = NULL; - StkId fi; - lua_lock(L); - fi = index2addr(L, funcindex); - api_checknelems(L, 1); - name = aux_upvalue(fi, n, &val, &owner, &uv); - if (name) { - L->top--; - setobj(L, val, L->top); - if (owner) { luaC_barrier(L, owner, L->top); } - else if (uv) { luaC_upvalbarrier(L, uv); } - } - lua_unlock(L); - return name; -} - - -static UpVal **getupvalref (lua_State *L, int fidx, int n, LClosure **pf) { - LClosure *f; - StkId fi = index2addr(L, fidx); - api_check(L, ttisLclosure(fi), "Lua function expected"); - f = clLvalue(fi); - api_check(L, (1 <= n && n <= f->p->sizeupvalues), "invalid upvalue index"); - if (pf) *pf = f; - return &f->upvals[n - 1]; /* get its upvalue pointer */ -} - - -LUA_API void *lua_upvalueid (lua_State *L, int fidx, int n) { - StkId fi = index2addr(L, fidx); - switch (ttype(fi)) { - case LUA_TLCL: { /* lua closure */ - return *getupvalref(L, fidx, n, NULL); - } - case LUA_TCCL: { /* C closure */ - CClosure *f = clCvalue(fi); - api_check(L, 1 <= n && n <= f->nupvalues, "invalid upvalue index"); - return &f->upvalue[n - 1]; - } - default: { - api_check(L, 0, "closure expected"); - return NULL; - } - } -} - - -LUA_API void lua_upvaluejoin (lua_State *L, int fidx1, int n1, - int fidx2, int n2) { - LClosure *f1; - UpVal **up1 = getupvalref(L, fidx1, n1, &f1); - UpVal **up2 = getupvalref(L, fidx2, n2, NULL); - luaC_upvdeccount(L, *up1); - *up1 = *up2; - (*up1)->refcount++; - if (upisopen(*up1)) (*up1)->u.open.touched = 1; - luaC_upvalbarrier(L, *up1); -} - - diff --git a/external/mit/lua/dist/src/lapi.h b/external/mit/lua/dist/src/lapi.h deleted file mode 100644 index e1b31c6fb..000000000 --- a/external/mit/lua/dist/src/lapi.h +++ /dev/null @@ -1,26 +0,0 @@ -/* $NetBSD: lapi.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lapi.h,v 2.9 2015/03/06 19:49:50 roberto Exp -** Auxiliary functions from Lua API -** See Copyright Notice in lua.h -*/ - -#ifndef lapi_h -#define lapi_h - - -#include "llimits.h" -#include "lstate.h" - -#define api_incr_top(L) {L->top++; api_check(L, L->top <= L->ci->top, \ - "stack overflow");} - -#define adjustresults(L,nres) \ - { if ((nres) == LUA_MULTRET && L->ci->top < L->top) L->ci->top = L->top; } - -#define api_checknelems(L,n) api_check(L, (n) < (L->top - L->ci->func), \ - "not enough elements in the stack") - - -#endif diff --git a/external/mit/lua/dist/src/lauxlib.c b/external/mit/lua/dist/src/lauxlib.c deleted file mode 100644 index aa1d00a3a..000000000 --- a/external/mit/lua/dist/src/lauxlib.c +++ /dev/null @@ -1,988 +0,0 @@ -/* $NetBSD: lauxlib.c,v 1.5 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lauxlib.c,v 1.280 2015/02/03 17:38:24 roberto Exp -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - -#define lauxlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif -#include -#ifndef _KERNEL -#include -#include -#include -#endif - - -/* This file uses only the official API of Lua. -** Any function declared here could be written as an application function. -*/ - -#include "lua.h" - -#include "lauxlib.h" - - -/* -** {====================================================== -** Traceback -** ======================================================= -*/ - - -#define LEVELS1 12 /* size of the first part of the stack */ -#define LEVELS2 10 /* size of the second part of the stack */ - - - -/* -** search for 'objidx' in table at index -1. -** return 1 + string at top if find a good name. -*/ -static int findfield (lua_State *L, int objidx, int level) { - if (level == 0 || !lua_istable(L, -1)) - return 0; /* not found */ - lua_pushnil(L); /* start 'next' loop */ - while (lua_next(L, -2)) { /* for each pair in table */ - if (lua_type(L, -2) == LUA_TSTRING) { /* ignore non-string keys */ - if (lua_rawequal(L, objidx, -1)) { /* found object? */ - lua_pop(L, 1); /* remove value (but keep name) */ - return 1; - } - else if (findfield(L, objidx, level - 1)) { /* try recursively */ - lua_remove(L, -2); /* remove table (but keep name) */ - lua_pushliteral(L, "."); - lua_insert(L, -2); /* place '.' between the two names */ - lua_concat(L, 3); - return 1; - } - } - lua_pop(L, 1); /* remove value */ - } - return 0; /* not found */ -} - - -/* -** Search for a name for a function in all loaded modules -** (registry._LOADED). -*/ -static int pushglobalfuncname (lua_State *L, lua_Debug *ar) { - int top = lua_gettop(L); - lua_getinfo(L, "f", ar); /* push function */ - lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); - if (findfield(L, top + 1, 2)) { - const char *name = lua_tostring(L, -1); - if (strncmp(name, "_G.", 3) == 0) { /* name start with '_G.'? */ - lua_pushstring(L, name + 3); /* push name without prefix */ - lua_remove(L, -2); /* remove original name */ - } - lua_copy(L, -1, top + 1); /* move name to proper place */ - lua_pop(L, 2); /* remove pushed values */ - return 1; - } - else { - lua_settop(L, top); /* remove function and global table */ - return 0; - } -} - - -static void pushfuncname (lua_State *L, lua_Debug *ar) { - if (pushglobalfuncname(L, ar)) { /* try first a global name */ - lua_pushfstring(L, "function '%s'", lua_tostring(L, -1)); - lua_remove(L, -2); /* remove name */ - } - else if (*ar->namewhat != '\0') /* is there a name from code? */ - lua_pushfstring(L, "%s '%s'", ar->namewhat, ar->name); /* use it */ - else if (*ar->what == 'm') /* main? */ - lua_pushliteral(L, "main chunk"); - else if (*ar->what != 'C') /* for Lua functions, use */ - lua_pushfstring(L, "function <%s:%d>", ar->short_src, ar->linedefined); - else /* nothing left... */ - lua_pushliteral(L, "?"); -} - - -static int countlevels (lua_State *L) { - lua_Debug ar; - int li = 1, le = 1; - /* find an upper bound */ - while (lua_getstack(L, le, &ar)) { li = le; le *= 2; } - /* do a binary search */ - while (li < le) { - int m = (li + le)/2; - if (lua_getstack(L, m, &ar)) li = m + 1; - else le = m; - } - return le - 1; -} - - -LUALIB_API void luaL_traceback (lua_State *L, lua_State *L1, - const char *msg, int level) { - lua_Debug ar; - int top = lua_gettop(L); - int numlevels = countlevels(L1); - int mark = (numlevels > LEVELS1 + LEVELS2) ? LEVELS1 : 0; - if (msg) lua_pushfstring(L, "%s\n", msg); - lua_pushliteral(L, "stack traceback:"); - while (lua_getstack(L1, level++, &ar)) { - if (level == mark) { /* too many levels? */ - lua_pushliteral(L, "\n\t..."); /* add a '...' */ - level = numlevels - LEVELS2; /* and skip to last ones */ - } - else { - lua_getinfo(L1, "Slnt", &ar); - lua_pushfstring(L, "\n\t%s:", ar.short_src); - if (ar.currentline > 0) - lua_pushfstring(L, "%d:", ar.currentline); - lua_pushliteral(L, " in "); - pushfuncname(L, &ar); - if (ar.istailcall) - lua_pushliteral(L, "\n\t(...tail calls...)"); - lua_concat(L, lua_gettop(L) - top); - } - } - lua_concat(L, lua_gettop(L) - top); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Error-report functions -** ======================================================= -*/ - -LUALIB_API int luaL_argerror (lua_State *L, int arg, const char *extramsg) { - lua_Debug ar; - if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ - return luaL_error(L, "bad argument #%d (%s)", arg, extramsg); - lua_getinfo(L, "n", &ar); - if (strcmp(ar.namewhat, "method") == 0) { - arg--; /* do not count 'self' */ - if (arg == 0) /* error is in the self argument itself? */ - return luaL_error(L, "calling '%s' on bad self (%s)", - ar.name, extramsg); - } - if (ar.name == NULL) - ar.name = (pushglobalfuncname(L, &ar)) ? lua_tostring(L, -1) : "?"; - return luaL_error(L, "bad argument #%d to '%s' (%s)", - arg, ar.name, extramsg); -} - - -static int typeerror (lua_State *L, int arg, const char *tname) { - const char *msg; - const char *typearg; /* name for the type of the actual argument */ - if (luaL_getmetafield(L, arg, "__name") == LUA_TSTRING) - typearg = lua_tostring(L, -1); /* use the given type name */ - else if (lua_type(L, arg) == LUA_TLIGHTUSERDATA) - typearg = "light userdata"; /* special name for messages */ - else - typearg = luaL_typename(L, arg); /* standard name */ - msg = lua_pushfstring(L, "%s expected, got %s", tname, typearg); - return luaL_argerror(L, arg, msg); -} - - -static void tag_error (lua_State *L, int arg, int tag) { - typeerror(L, arg, lua_typename(L, tag)); -} - - -LUALIB_API void luaL_where (lua_State *L, int level) { - lua_Debug ar; - if (lua_getstack(L, level, &ar)) { /* check function at level */ - lua_getinfo(L, "Sl", &ar); /* get info about it */ - if (ar.currentline > 0) { /* is there info? */ - lua_pushfstring(L, "%s:%d: ", ar.short_src, ar.currentline); - return; - } - } - lua_pushliteral(L, ""); /* else, no information available... */ -} - - -LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { - va_list argp; - va_start(argp, fmt); - luaL_where(L, 1); - lua_pushvfstring(L, fmt, argp); - va_end(argp); - lua_concat(L, 2); - return lua_error(L); -} - - -#ifndef _KERNEL -LUALIB_API int luaL_fileresult (lua_State *L, int stat, const char *fname) { - int en = errno; /* calls to Lua API may change this value */ - if (stat) { - lua_pushboolean(L, 1); - return 1; - } - else { - lua_pushnil(L); - if (fname) - lua_pushfstring(L, "%s: %s", fname, strerror(en)); - else - lua_pushstring(L, strerror(en)); - lua_pushinteger(L, en); - return 3; - } -} -#endif - - -#if !defined(l_inspectstat) /* { */ - -#if defined(LUA_USE_POSIX) - -#include - -/* -** use appropriate macros to interpret 'pclose' return status -*/ -#define l_inspectstat(stat,what) \ - if (WIFEXITED(stat)) { stat = WEXITSTATUS(stat); } \ - else if (WIFSIGNALED(stat)) { stat = WTERMSIG(stat); what = "signal"; } - -#else - -#define l_inspectstat(stat,what) /* no op */ - -#endif - -#endif /* } */ - - -#ifndef _KERNEL -LUALIB_API int luaL_execresult (lua_State *L, int stat) { - const char *what = "exit"; /* type of termination */ - if (stat == -1) /* error? */ - return luaL_fileresult(L, 0, NULL); - else { - l_inspectstat(stat, what); /* interpret result */ - if (*what == 'e' && stat == 0) /* successful termination? */ - lua_pushboolean(L, 1); - else - lua_pushnil(L); - lua_pushstring(L, what); - lua_pushinteger(L, stat); - return 3; /* return true/nil,what,code */ - } -} -#endif - -/* }====================================================== */ - - -/* -** {====================================================== -** Userdata's metatable manipulation -** ======================================================= -*/ - -LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { - if (luaL_getmetatable(L, tname) != LUA_TNIL) /* name already in use? */ - return 0; /* leave previous value on top, but return 0 */ - lua_pop(L, 1); - lua_newtable(L); /* create metatable */ - lua_pushstring(L, tname); - lua_setfield(L, -2, "__name"); /* metatable.__name = tname */ - lua_pushvalue(L, -1); - lua_setfield(L, LUA_REGISTRYINDEX, tname); /* registry.name = metatable */ - return 1; -} - - -LUALIB_API void luaL_setmetatable (lua_State *L, const char *tname) { - luaL_getmetatable(L, tname); - lua_setmetatable(L, -2); -} - - -LUALIB_API void *luaL_testudata (lua_State *L, int ud, const char *tname) { - void *p = lua_touserdata(L, ud); - if (p != NULL) { /* value is a userdata? */ - if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ - luaL_getmetatable(L, tname); /* get correct metatable */ - if (!lua_rawequal(L, -1, -2)) /* not the same? */ - p = NULL; /* value is a userdata with wrong metatable */ - lua_pop(L, 2); /* remove both metatables */ - return p; - } - } - return NULL; /* value is not a userdata with a metatable */ -} - - -LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { - void *p = luaL_testudata(L, ud, tname); - if (p == NULL) typeerror(L, ud, tname); - return p; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Argument check functions -** ======================================================= -*/ - -LUALIB_API int luaL_checkoption (lua_State *L, int arg, const char *def, - const char *const lst[]) { - const char *name = (def) ? luaL_optstring(L, arg, def) : - luaL_checkstring(L, arg); - int i; - for (i=0; lst[i]; i++) - if (strcmp(lst[i], name) == 0) - return i; - return luaL_argerror(L, arg, - lua_pushfstring(L, "invalid option '%s'", name)); -} - - -LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *msg) { - /* keep some extra space to run error routines, if needed */ - const int extra = LUA_MINSTACK; - if (!lua_checkstack(L, space + extra)) { - if (msg) - luaL_error(L, "stack overflow (%s)", msg); - else - luaL_error(L, "stack overflow"); - } -} - - -LUALIB_API void luaL_checktype (lua_State *L, int arg, int t) { - if (lua_type(L, arg) != t) - tag_error(L, arg, t); -} - - -LUALIB_API void luaL_checkany (lua_State *L, int arg) { - if (lua_type(L, arg) == LUA_TNONE) - luaL_argerror(L, arg, "value expected"); -} - - -LUALIB_API const char *luaL_checklstring (lua_State *L, int arg, size_t *len) { - const char *s = lua_tolstring(L, arg, len); - if (!s) tag_error(L, arg, LUA_TSTRING); - return s; -} - - -LUALIB_API const char *luaL_optlstring (lua_State *L, int arg, - const char *def, size_t *len) { - if (lua_isnoneornil(L, arg)) { - if (len) - *len = (def ? strlen(def) : 0); - return def; - } - else return luaL_checklstring(L, arg, len); -} - - -LUALIB_API lua_Number luaL_checknumber (lua_State *L, int arg) { - int isnum; - lua_Number d = lua_tonumberx(L, arg, &isnum); - if (!isnum) - tag_error(L, arg, LUA_TNUMBER); - return d; -} - - -LUALIB_API lua_Number luaL_optnumber (lua_State *L, int arg, lua_Number def) { - return luaL_opt(L, luaL_checknumber, arg, def); -} - - -#ifndef _KERNEL -static void interror (lua_State *L, int arg) { - if (lua_isnumber(L, arg)) - luaL_argerror(L, arg, "number has no integer representation"); - else - tag_error(L, arg, LUA_TNUMBER); -} - - -LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int arg) { - int isnum; - lua_Integer d = lua_tointegerx(L, arg, &isnum); - if (!isnum) { - interror(L, arg); - } - return d; -} - - -LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int arg, - lua_Integer def) { - return luaL_opt(L, luaL_checkinteger, arg, def); -} -#endif - -/* }====================================================== */ - - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - -/* -** check whether buffer is using a userdata on the stack as a temporary -** buffer -*/ -#define buffonstack(B) ((B)->b != (B)->initb) - - -/* -** returns a pointer to a free area with at least 'sz' bytes -*/ -LUALIB_API char *luaL_prepbuffsize (luaL_Buffer *B, size_t sz) { - lua_State *L = B->L; - if (B->size - B->n < sz) { /* not enough space? */ - char *newbuff; - size_t newsize = B->size * 2; /* double buffer size */ - if (newsize - B->n < sz) /* not big enough? */ - newsize = B->n + sz; - if (newsize < B->n || newsize - B->n < sz) - luaL_error(L, "buffer too large"); - /* create larger buffer */ - newbuff = (char *)lua_newuserdata(L, newsize * sizeof(char)); - /* move content to new buffer */ - memcpy(newbuff, B->b, B->n * sizeof(char)); - if (buffonstack(B)) - lua_remove(L, -2); /* remove old buffer */ - B->b = newbuff; - B->size = newsize; - } - return &B->b[B->n]; -} - - -LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { - char *b = luaL_prepbuffsize(B, l); - memcpy(b, s, l * sizeof(char)); - luaL_addsize(B, l); -} - - -LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { - luaL_addlstring(B, s, strlen(s)); -} - - -LUALIB_API void luaL_pushresult (luaL_Buffer *B) { - lua_State *L = B->L; - lua_pushlstring(L, B->b, B->n); - if (buffonstack(B)) - lua_remove(L, -2); /* remove old buffer */ -} - - -LUALIB_API void luaL_pushresultsize (luaL_Buffer *B, size_t sz) { - luaL_addsize(B, sz); - luaL_pushresult(B); -} - - -LUALIB_API void luaL_addvalue (luaL_Buffer *B) { - lua_State *L = B->L; - size_t l; - const char *s = lua_tolstring(L, -1, &l); - if (buffonstack(B)) - lua_insert(L, -2); /* put value below buffer */ - luaL_addlstring(B, s, l); - lua_remove(L, (buffonstack(B)) ? -2 : -1); /* remove value */ -} - - -LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { - B->L = L; - B->b = B->initb; - B->n = 0; - B->size = LUAL_BUFFERSIZE; -} - - -LUALIB_API char *luaL_buffinitsize (lua_State *L, luaL_Buffer *B, size_t sz) { - luaL_buffinit(L, B); - return luaL_prepbuffsize(B, sz); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Reference system -** ======================================================= -*/ - -/* index of free-list header */ -#define freelist 0 - - -LUALIB_API int luaL_ref (lua_State *L, int t) { - int ref; - if (lua_isnil(L, -1)) { - lua_pop(L, 1); /* remove from stack */ - return LUA_REFNIL; /* 'nil' has a unique fixed reference */ - } - t = lua_absindex(L, t); - lua_rawgeti(L, t, freelist); /* get first free element */ - ref = (int)lua_tointeger(L, -1); /* ref = t[freelist] */ - lua_pop(L, 1); /* remove it from stack */ - if (ref != 0) { /* any free element? */ - lua_rawgeti(L, t, ref); /* remove it from list */ - lua_rawseti(L, t, freelist); /* (t[freelist] = t[ref]) */ - } - else /* no free elements */ - ref = (int)lua_rawlen(L, t) + 1; /* get a new reference */ - lua_rawseti(L, t, ref); - return ref; -} - - -LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { - if (ref >= 0) { - t = lua_absindex(L, t); - lua_rawgeti(L, t, freelist); - lua_rawseti(L, t, ref); /* t[ref] = t[freelist] */ - lua_pushinteger(L, ref); - lua_rawseti(L, t, freelist); /* t[freelist] = ref */ - } -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Load functions -** ======================================================= -*/ - -#ifndef _KERNEL -typedef struct LoadF { - int n; /* number of pre-read characters */ - FILE *f; /* file being read */ - char buff[BUFSIZ]; /* area for reading file */ -} LoadF; - - -static const char *getF (lua_State *L, void *ud, size_t *size) { - LoadF *lf = (LoadF *)ud; - (void)L; /* not used */ - if (lf->n > 0) { /* are there pre-read characters to be read? */ - *size = lf->n; /* return them (chars already in buffer) */ - lf->n = 0; /* no more pre-read characters */ - } - else { /* read a block from file */ - /* 'fread' can return > 0 *and* set the EOF flag. If next call to - 'getF' called 'fread', it might still wait for user input. - The next check avoids this problem. */ - if (feof(lf->f)) return NULL; - *size = fread(lf->buff, 1, sizeof(lf->buff), lf->f); /* read block */ - } - return lf->buff; -} - - -static int errfile (lua_State *L, const char *what, int fnameindex) { - const char *serr = strerror(errno); - const char *filename = lua_tostring(L, fnameindex) + 1; - lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); - lua_remove(L, fnameindex); - return LUA_ERRFILE; -} - - -static int skipBOM (LoadF *lf) { - const char *p = "\xEF\xBB\xBF"; /* Utf8 BOM mark */ - int c; - lf->n = 0; - do { - c = getc(lf->f); - if (c == EOF || c != *(const unsigned char *)p++) return c; - lf->buff[lf->n++] = c; /* to be read by the parser */ - } while (*p != '\0'); - lf->n = 0; /* prefix matched; discard it */ - return getc(lf->f); /* return next character */ -} - - -/* -** reads the first character of file 'f' and skips an optional BOM mark -** in its beginning plus its first line if it starts with '#'. Returns -** true if it skipped the first line. In any case, '*cp' has the -** first "valid" character of the file (after the optional BOM and -** a first-line comment). -*/ -static int skipcomment (LoadF *lf, int *cp) { - int c = *cp = skipBOM(lf); - if (c == '#') { /* first line is a comment (Unix exec. file)? */ - do { /* skip first line */ - c = getc(lf->f); - } while (c != EOF && c != '\n') ; - *cp = getc(lf->f); /* skip end-of-line, if present */ - return 1; /* there was a comment */ - } - else return 0; /* no comment */ -} - - -LUALIB_API int luaL_loadfilex (lua_State *L, const char *filename, - const char *mode) { - LoadF lf; - int status, readstatus; - int c; - int fnameindex = lua_gettop(L) + 1; /* index of filename on the stack */ - if (filename == NULL) { - lua_pushliteral(L, "=stdin"); - lf.f = stdin; - } - else { - lua_pushfstring(L, "@%s", filename); - lf.f = fopen(filename, "r"); - if (lf.f == NULL) return errfile(L, "open", fnameindex); - } - if (skipcomment(&lf, &c)) /* read initial portion */ - lf.buff[lf.n++] = '\n'; /* add line to correct line numbers */ - if (c == LUA_SIGNATURE[0] && filename) { /* binary file? */ - lf.f = freopen(filename, "rb", lf.f); /* reopen in binary mode */ - if (lf.f == NULL) return errfile(L, "reopen", fnameindex); - skipcomment(&lf, &c); /* re-read initial portion */ - } - if (c != EOF) - lf.buff[lf.n++] = c; /* 'c' is the first character of the stream */ - status = lua_load(L, getF, &lf, lua_tostring(L, -1), mode); - readstatus = ferror(lf.f); - if (filename) fclose(lf.f); /* close file (even in case of errors) */ - if (readstatus) { - lua_settop(L, fnameindex); /* ignore results from 'lua_load' */ - return errfile(L, "read", fnameindex); - } - lua_remove(L, fnameindex); - return status; -} -#endif - - -typedef struct LoadS { - const char *s; - size_t size; -} LoadS; - - -static const char *getS (lua_State *L, void *ud, size_t *size) { - LoadS *ls = (LoadS *)ud; - (void)L; /* not used */ - if (ls->size == 0) return NULL; - *size = ls->size; - ls->size = 0; - return ls->s; -} - - -LUALIB_API int luaL_loadbufferx (lua_State *L, const char *buff, size_t size, - const char *name, const char *mode) { - LoadS ls; - ls.s = buff; - ls.size = size; - return lua_load(L, getS, &ls, name, mode); -} - - -LUALIB_API int luaL_loadstring (lua_State *L, const char *s) { - return luaL_loadbuffer(L, s, strlen(s), s); -} - -/* }====================================================== */ - - - -LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { - if (!lua_getmetatable(L, obj)) /* no metatable? */ - return LUA_TNIL; - else { - int tt; - lua_pushstring(L, event); - tt = lua_rawget(L, -2); - if (tt == LUA_TNIL) /* is metafield nil? */ - lua_pop(L, 2); /* remove metatable and metafield */ - else - lua_remove(L, -2); /* remove only metatable */ - return tt; /* return metafield type */ - } -} - - -LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { - obj = lua_absindex(L, obj); - if (luaL_getmetafield(L, obj, event) == LUA_TNIL) /* no metafield? */ - return 0; - lua_pushvalue(L, obj); - lua_call(L, 1, 1); - return 1; -} - - -LUALIB_API lua_Integer luaL_len (lua_State *L, int idx) { - lua_Integer l; - int isnum; - lua_len(L, idx); - l = lua_tointegerx(L, -1, &isnum); - if (!isnum) - luaL_error(L, "object length is not an integer"); - lua_pop(L, 1); /* remove object */ - return l; -} - - -LUALIB_API const char *luaL_tolstring (lua_State *L, int idx, size_t *len) { - if (!luaL_callmeta(L, idx, "__tostring")) { /* no metafield? */ - switch (lua_type(L, idx)) { - case LUA_TNUMBER: { - if (lua_isinteger(L, idx)) - lua_pushfstring(L, "%I", lua_tointeger(L, idx)); - else - lua_pushfstring(L, "%f", lua_tonumber(L, idx)); - break; - } - case LUA_TSTRING: - lua_pushvalue(L, idx); - break; - case LUA_TBOOLEAN: - lua_pushstring(L, (lua_toboolean(L, idx) ? "true" : "false")); - break; - case LUA_TNIL: - lua_pushliteral(L, "nil"); - break; - default: - lua_pushfstring(L, "%s: %p", luaL_typename(L, idx), - lua_topointer(L, idx)); - break; - } - } - return lua_tolstring(L, -1, len); -} - - -/* -** {====================================================== -** Compatibility with 5.1 module functions -** ======================================================= -*/ -#if defined(LUA_COMPAT_MODULE) - -static const char *luaL_findtable (lua_State *L, int idx, - const char *fname, int szhint) { - const char *e; - if (idx) lua_pushvalue(L, idx); - do { - e = strchr(fname, '.'); - if (e == NULL) e = fname + strlen(fname); - lua_pushlstring(L, fname, e - fname); - if (lua_rawget(L, -2) == LUA_TNIL) { /* no such field? */ - lua_pop(L, 1); /* remove this nil */ - lua_createtable(L, 0, (*e == '.' ? 1 : szhint)); /* new table for field */ - lua_pushlstring(L, fname, e - fname); - lua_pushvalue(L, -2); - lua_settable(L, -4); /* set new table into field */ - } - else if (!lua_istable(L, -1)) { /* field has a non-table value? */ - lua_pop(L, 2); /* remove table and value */ - return fname; /* return problematic part of the name */ - } - lua_remove(L, -2); /* remove previous table */ - fname = e + 1; - } while (*e == '.'); - return NULL; -} - - -/* -** Count number of elements in a luaL_Reg list. -*/ -static int libsize (const luaL_Reg *l) { - int size = 0; - for (; l && l->name; l++) size++; - return size; -} - - -/* -** Find or create a module table with a given name. The function -** first looks at the _LOADED table and, if that fails, try a -** global variable with that name. In any case, leaves on the stack -** the module table. -*/ -LUALIB_API void luaL_pushmodule (lua_State *L, const char *modname, - int sizehint) { - luaL_findtable(L, LUA_REGISTRYINDEX, "_LOADED", 1); /* get _LOADED table */ - if (lua_getfield(L, -1, modname) != LUA_TTABLE) { /* no _LOADED[modname]? */ - lua_pop(L, 1); /* remove previous result */ - /* try global variable (and create one if it does not exist) */ - lua_pushglobaltable(L); - if (luaL_findtable(L, 0, modname, sizehint) != NULL) - luaL_error(L, "name conflict for module '%s'", modname); - lua_pushvalue(L, -1); - lua_setfield(L, -3, modname); /* _LOADED[modname] = new table */ - } - lua_remove(L, -2); /* remove _LOADED table */ -} - - -LUALIB_API void luaL_openlib (lua_State *L, const char *libname, - const luaL_Reg *l, int nup) { - luaL_checkversion(L); - if (libname) { - luaL_pushmodule(L, libname, libsize(l)); /* get/create library table */ - lua_insert(L, -(nup + 1)); /* move library table to below upvalues */ - } - if (l) - luaL_setfuncs(L, l, nup); - else - lua_pop(L, nup); /* remove upvalues */ -} - -#endif -/* }====================================================== */ - -/* -** set functions from list 'l' into table at top - 'nup'; each -** function gets the 'nup' elements at the top as upvalues. -** Returns with only the table at the stack. -*/ -LUALIB_API void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { - luaL_checkstack(L, nup, "too many upvalues"); - for (; l->name != NULL; l++) { /* fill the table with given functions */ - int i; - for (i = 0; i < nup; i++) /* copy upvalues to the top */ - lua_pushvalue(L, -nup); - lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ - lua_setfield(L, -(nup + 2), l->name); - } - lua_pop(L, nup); /* remove upvalues */ -} - - -/* -** ensure that stack[idx][fname] has a table and push that table -** into the stack -*/ -LUALIB_API int luaL_getsubtable (lua_State *L, int idx, const char *fname) { - if (lua_getfield(L, idx, fname) == LUA_TTABLE) - return 1; /* table already there */ - else { - lua_pop(L, 1); /* remove previous result */ - idx = lua_absindex(L, idx); - lua_newtable(L); - lua_pushvalue(L, -1); /* copy to be left at top */ - lua_setfield(L, idx, fname); /* assign new table to field */ - return 0; /* false, because did not find table there */ - } -} - - -/* -** Stripped-down 'require': After checking "loaded" table, calls 'openf' -** to open a module, registers the result in 'package.loaded' table and, -** if 'glb' is true, also registers the result in the global table. -** Leaves resulting module on the top. -*/ -LUALIB_API void luaL_requiref (lua_State *L, const char *modname, - lua_CFunction openf, int glb) { - luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); - lua_getfield(L, -1, modname); /* _LOADED[modname] */ - if (!lua_toboolean(L, -1)) { /* package not already loaded? */ - lua_pop(L, 1); /* remove field */ - lua_pushcfunction(L, openf); - lua_pushstring(L, modname); /* argument to open function */ - lua_call(L, 1, 1); /* call 'openf' to open module */ - lua_pushvalue(L, -1); /* make copy of module (call result) */ - lua_setfield(L, -3, modname); /* _LOADED[modname] = module */ - } - lua_remove(L, -2); /* remove _LOADED table */ - if (glb) { - lua_pushvalue(L, -1); /* copy of module */ - lua_setglobal(L, modname); /* _G[modname] = module */ - } -} - - -LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, - const char *r) { - const char *wild; - size_t l = strlen(p); - luaL_Buffer b; - luaL_buffinit(L, &b); - while ((wild = strstr(s, p)) != NULL) { - luaL_addlstring(&b, s, wild - s); /* push prefix */ - luaL_addstring(&b, r); /* push replacement in place of pattern */ - s = wild + l; /* continue after 'p' */ - } - luaL_addstring(&b, s); /* push last suffix */ - luaL_pushresult(&b); - return lua_tostring(L, -1); -} - - -#ifndef _KERNEL -static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { - (void)ud; (void)osize; /* not used */ - if (nsize == 0) { - free(ptr); - return NULL; - } - else - return realloc(ptr, nsize); -} - - -static int panic (lua_State *L) { - lua_writestringerror("PANIC: unprotected error in call to Lua API (%s)\n", - lua_tostring(L, -1)); - return 0; /* return to Lua to abort */ -} - - -LUALIB_API lua_State *luaL_newstate (void) { - lua_State *L = lua_newstate(l_alloc, NULL); - if (L) lua_atpanic(L, &panic); - return L; -} -#endif - - -LUALIB_API void luaL_checkversion_ (lua_State *L, lua_Number ver, size_t sz) { - const lua_Number *v = lua_version(L); - if (sz != LUAL_NUMSIZES) /* check numeric types */ - luaL_error(L, "core and library have incompatible numeric types"); - if (v != lua_version(NULL)) - luaL_error(L, "multiple Lua VMs detected"); - else if (*v != ver) - luaL_error(L, "version mismatch: app. needs %f, Lua core provides %f", - ver, *v); -} - diff --git a/external/mit/lua/dist/src/lauxlib.h b/external/mit/lua/dist/src/lauxlib.h deleted file mode 100644 index ae1244fe4..000000000 --- a/external/mit/lua/dist/src/lauxlib.h +++ /dev/null @@ -1,275 +0,0 @@ -/* $NetBSD: lauxlib.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lauxlib.h,v 1.128 2014/10/29 16:11:17 roberto Exp -** Auxiliary functions for building Lua libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lauxlib_h -#define lauxlib_h - - -#ifndef _KERNEL -#include -#include -#endif - -#include "lua.h" - - - -/* extra error code for 'luaL_load' */ -#define LUA_ERRFILE (LUA_ERRERR+1) - - -typedef struct luaL_Reg { - const char *name; - lua_CFunction func; -} luaL_Reg; - - -#define LUAL_NUMSIZES (sizeof(lua_Integer)*16 + sizeof(lua_Number)) - -LUALIB_API void (luaL_checkversion_) (lua_State *L, lua_Number ver, size_t sz); -#define luaL_checkversion(L) \ - luaL_checkversion_(L, LUA_VERSION_NUM, LUAL_NUMSIZES) - -LUALIB_API int (luaL_getmetafield) (lua_State *L, int obj, const char *e); -LUALIB_API int (luaL_callmeta) (lua_State *L, int obj, const char *e); -LUALIB_API const char *(luaL_tolstring) (lua_State *L, int idx, size_t *len); -LUALIB_API int (luaL_argerror) (lua_State *L, int arg, const char *extramsg); -LUALIB_API const char *(luaL_checklstring) (lua_State *L, int arg, - size_t *l); -LUALIB_API const char *(luaL_optlstring) (lua_State *L, int arg, - const char *def, size_t *l); -LUALIB_API lua_Number (luaL_checknumber) (lua_State *L, int arg); -LUALIB_API lua_Number (luaL_optnumber) (lua_State *L, int arg, lua_Number def); - -#ifndef _KERNEL -LUALIB_API lua_Integer (luaL_checkinteger) (lua_State *L, int arg); -LUALIB_API lua_Integer (luaL_optinteger) (lua_State *L, int arg, - lua_Integer def); -#else /* _KERNEL */ -#define luaL_checkinteger luaL_checknumber -#define luaL_optinteger(L,a,d) luaL_optnumber(L, (a), (lua_Number)(d)) -#endif - -LUALIB_API void (luaL_checkstack) (lua_State *L, int sz, const char *msg); -LUALIB_API void (luaL_checktype) (lua_State *L, int arg, int t); -LUALIB_API void (luaL_checkany) (lua_State *L, int arg); - -LUALIB_API int (luaL_newmetatable) (lua_State *L, const char *tname); -LUALIB_API void (luaL_setmetatable) (lua_State *L, const char *tname); -LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname); -LUALIB_API void *(luaL_checkudata) (lua_State *L, int ud, const char *tname); - -LUALIB_API void (luaL_where) (lua_State *L, int lvl); -LUALIB_API int (luaL_error) (lua_State *L, const char *fmt, ...); - -LUALIB_API int (luaL_checkoption) (lua_State *L, int arg, const char *def, - const char *const lst[]); - -#ifndef _KERNEL -LUALIB_API int (luaL_fileresult) (lua_State *L, int stat, const char *fname); -LUALIB_API int (luaL_execresult) (lua_State *L, int stat); -#endif - -/* pre-defined references */ -#define LUA_NOREF (-2) -#define LUA_REFNIL (-1) - -LUALIB_API int (luaL_ref) (lua_State *L, int t); -LUALIB_API void (luaL_unref) (lua_State *L, int t, int ref); - -#ifndef _KERNEL -LUALIB_API int (luaL_loadfilex) (lua_State *L, const char *filename, - const char *mode); - -#define luaL_loadfile(L,f) luaL_loadfilex(L,f,NULL) -#endif - -LUALIB_API int (luaL_loadbufferx) (lua_State *L, const char *buff, size_t sz, - const char *name, const char *mode); -LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s); - -LUALIB_API lua_State *(luaL_newstate) (void); - -LUALIB_API lua_Integer (luaL_len) (lua_State *L, int idx); - -LUALIB_API const char *(luaL_gsub) (lua_State *L, const char *s, const char *p, - const char *r); - -LUALIB_API void (luaL_setfuncs) (lua_State *L, const luaL_Reg *l, int nup); - -LUALIB_API int (luaL_getsubtable) (lua_State *L, int idx, const char *fname); - -LUALIB_API void (luaL_traceback) (lua_State *L, lua_State *L1, - const char *msg, int level); - -LUALIB_API void (luaL_requiref) (lua_State *L, const char *modname, - lua_CFunction openf, int glb); - -/* -** =============================================================== -** some useful macros -** =============================================================== -*/ - - -#define luaL_newlibtable(L,l) \ - lua_createtable(L, 0, sizeof(l)/sizeof((l)[0]) - 1) - -#define luaL_newlib(L,l) \ - (luaL_checkversion(L), luaL_newlibtable(L,l), luaL_setfuncs(L,l,0)) - -#define luaL_argcheck(L, cond,arg,extramsg) \ - ((void)((cond) || luaL_argerror(L, (arg), (extramsg)))) -#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL)) -#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL)) - -#define luaL_typename(L,i) lua_typename(L, lua_type(L,(i))) - -#ifndef _KERNEL -#define luaL_dofile(L, fn) \ - (luaL_loadfile(L, fn) || lua_pcall(L, 0, LUA_MULTRET, 0)) -#endif - -#define luaL_dostring(L, s) \ - (luaL_loadstring(L, s) || lua_pcall(L, 0, LUA_MULTRET, 0)) - -#define luaL_getmetatable(L,n) (lua_getfield(L, LUA_REGISTRYINDEX, (n))) - -#define luaL_opt(L,f,n,d) (lua_isnoneornil(L,(n)) ? (d) : f(L,(n))) - -#define luaL_loadbuffer(L,s,sz,n) luaL_loadbufferx(L,s,sz,n,NULL) - - -/* -** {====================================================== -** Generic Buffer manipulation -** ======================================================= -*/ - -typedef struct luaL_Buffer { - char *b; /* buffer address */ - size_t size; /* buffer size */ - size_t n; /* number of characters in buffer */ - lua_State *L; - char initb[LUAL_BUFFERSIZE]; /* initial buffer */ -} luaL_Buffer; - - -#define luaL_addchar(B,c) \ - ((void)((B)->n < (B)->size || luaL_prepbuffsize((B), 1)), \ - ((B)->b[(B)->n++] = (c))) - -#define luaL_addsize(B,s) ((B)->n += (s)) - -LUALIB_API void (luaL_buffinit) (lua_State *L, luaL_Buffer *B); -LUALIB_API char *(luaL_prepbuffsize) (luaL_Buffer *B, size_t sz); -LUALIB_API void (luaL_addlstring) (luaL_Buffer *B, const char *s, size_t l); -LUALIB_API void (luaL_addstring) (luaL_Buffer *B, const char *s); -LUALIB_API void (luaL_addvalue) (luaL_Buffer *B); -LUALIB_API void (luaL_pushresult) (luaL_Buffer *B); -LUALIB_API void (luaL_pushresultsize) (luaL_Buffer *B, size_t sz); -LUALIB_API char *(luaL_buffinitsize) (lua_State *L, luaL_Buffer *B, size_t sz); - -#define luaL_prepbuffer(B) luaL_prepbuffsize(B, LUAL_BUFFERSIZE) - -/* }====================================================== */ - - - -#ifndef _KERNEL -/* -** {====================================================== -** File handles for IO library -** ======================================================= -*/ - -/* -** A file handle is a userdata with metatable 'LUA_FILEHANDLE' and -** initial structure 'luaL_Stream' (it may contain other fields -** after that initial structure). -*/ - -#define LUA_FILEHANDLE "FILE*" - - -typedef struct luaL_Stream { - FILE *f; /* stream (NULL for incompletely created streams) */ - lua_CFunction closef; /* to close stream (NULL for closed streams) */ -} luaL_Stream; - -/* }====================================================== */ -#endif - - - -/* compatibility with old module system */ -#if defined(LUA_COMPAT_MODULE) - -LUALIB_API void (luaL_pushmodule) (lua_State *L, const char *modname, - int sizehint); -LUALIB_API void (luaL_openlib) (lua_State *L, const char *libname, - const luaL_Reg *l, int nup); - -#define luaL_register(L,n,l) (luaL_openlib(L,(n),(l),0)) - -#endif - - -#ifndef _KERNEL -/* -** {================================================================== -** "Abstraction Layer" for basic report of messages and errors -** =================================================================== -*/ - -/* print a string */ -#if !defined(lua_writestring) -#define lua_writestring(s,l) fwrite((s), sizeof(char), (l), stdout) -#endif - -/* print a newline and flush the output */ -#if !defined(lua_writeline) -#define lua_writeline() (lua_writestring("\n", 1), fflush(stdout)) -#endif - -/* print an error message */ -#if !defined(lua_writestringerror) -#define lua_writestringerror(s,p) \ - (fprintf(stderr, (s), (p)), fflush(stderr)) -#endif - -/* }================================================================== */ -#endif - - -/* -** {============================================================ -** Compatibility with deprecated conversions -** ============================================================= -*/ -#if defined(LUA_COMPAT_APIINTCASTS) - -#define luaL_checkunsigned(L,a) ((lua_Unsigned)luaL_checkinteger(L,a)) -#define luaL_optunsigned(L,a,d) \ - ((lua_Unsigned)luaL_optinteger(L,a,(lua_Integer)(d))) - -#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n))) -#define luaL_optint(L,n,d) ((int)luaL_optinteger(L, (n), (d))) - -#define luaL_checklong(L,n) ((long)luaL_checkinteger(L, (n))) -#define luaL_optlong(L,n,d) ((long)luaL_optinteger(L, (n), (d))) - -#endif -/* }============================================================ */ - - - -#endif - - diff --git a/external/mit/lua/dist/src/lbaselib.c b/external/mit/lua/dist/src/lbaselib.c deleted file mode 100644 index 5363309c3..000000000 --- a/external/mit/lua/dist/src/lbaselib.c +++ /dev/null @@ -1,532 +0,0 @@ -/* $NetBSD: lbaselib.c,v 1.5 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lbaselib.c,v 1.310 2015/03/28 19:14:47 roberto Exp -** Basic library -** See Copyright Notice in lua.h -*/ - -#define lbaselib_c -#define LUA_LIB - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#include -#include -#endif - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -static int luaB_print (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int i; - lua_getglobal(L, "tostring"); - for (i=1; i<=n; i++) { - const char *s; - size_t l; - lua_pushvalue(L, -1); /* function to be called */ - lua_pushvalue(L, i); /* value to print */ - lua_call(L, 1, 1); - s = lua_tolstring(L, -1, &l); /* get result */ - if (s == NULL) - return luaL_error(L, "'tostring' must return a string to 'print'"); - if (i>1) lua_writestring("\t", 1); - lua_writestring(s, l); - lua_pop(L, 1); /* pop result */ - } - lua_writeline(); - return 0; -} - - -#define SPACECHARS " \f\n\r\t\v" - -static const char *b_str2int (const char *s, int base, lua_Integer *pn) { - lua_Unsigned n = 0; - int neg = 0; - s += strspn(s, SPACECHARS); /* skip initial spaces */ - if (*s == '-') { s++; neg = 1; } /* handle signal */ - else if (*s == '+') s++; - if (!isalnum((unsigned char)*s)) /* no digit? */ - return NULL; - do { - int digit = (isdigit((unsigned char)*s)) ? *s - '0' - : (toupper((unsigned char)*s) - 'A') + 10; - if (digit >= base) return NULL; /* invalid numeral */ - n = n * base + digit; - s++; - } while (isalnum((unsigned char)*s)); - s += strspn(s, SPACECHARS); /* skip trailing spaces */ - *pn = (lua_Integer)((neg) ? (0u - n) : n); - return s; -} - - -static int luaB_tonumber (lua_State *L) { - if (lua_isnoneornil(L, 2)) { /* standard conversion? */ - luaL_checkany(L, 1); - if (lua_type(L, 1) == LUA_TNUMBER) { /* already a number? */ - lua_settop(L, 1); /* yes; return it */ - return 1; - } - else { - size_t l; - const char *s = lua_tolstring(L, 1, &l); - if (s != NULL && lua_stringtonumber(L, s) == l + 1) - return 1; /* successful conversion to number */ - /* else not a number */ - } - } - else { - size_t l; - const char *s; - lua_Integer n = 0; /* to avoid warnings */ - lua_Integer base = luaL_checkinteger(L, 2); - luaL_checktype(L, 1, LUA_TSTRING); /* before 'luaL_checklstring'! */ - s = luaL_checklstring(L, 1, &l); - luaL_argcheck(L, 2 <= base && base <= 36, 2, "base out of range"); - if (b_str2int(s, (int)base, &n) == s + l) { - lua_pushinteger(L, n); - return 1; - } /* else not a number */ - } /* else not a number */ - lua_pushnil(L); /* not a number */ - return 1; -} - - -static int luaB_error (lua_State *L) { - int level = (int)luaL_optinteger(L, 2, 1); - lua_settop(L, 1); - if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ - luaL_where(L, level); - lua_pushvalue(L, 1); - lua_concat(L, 2); - } - return lua_error(L); -} - - -static int luaB_getmetatable (lua_State *L) { - luaL_checkany(L, 1); - if (!lua_getmetatable(L, 1)) { - lua_pushnil(L); - return 1; /* no metatable */ - } - luaL_getmetafield(L, 1, "__metatable"); - return 1; /* returns either __metatable field (if present) or metatable */ -} - - -static int luaB_setmetatable (lua_State *L) { - int t = lua_type(L, 2); - luaL_checktype(L, 1, LUA_TTABLE); - luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, - "nil or table expected"); - if (luaL_getmetafield(L, 1, "__metatable") != LUA_TNIL) - return luaL_error(L, "cannot change a protected metatable"); - lua_settop(L, 2); - lua_setmetatable(L, 1); - return 1; -} - - -static int luaB_rawequal (lua_State *L) { - luaL_checkany(L, 1); - luaL_checkany(L, 2); - lua_pushboolean(L, lua_rawequal(L, 1, 2)); - return 1; -} - - -static int luaB_rawlen (lua_State *L) { - int t = lua_type(L, 1); - luaL_argcheck(L, t == LUA_TTABLE || t == LUA_TSTRING, 1, - "table or string expected"); - lua_pushinteger(L, lua_rawlen(L, 1)); - return 1; -} - - -static int luaB_rawget (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checkany(L, 2); - lua_settop(L, 2); - lua_rawget(L, 1); - return 1; -} - -static int luaB_rawset (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - luaL_checkany(L, 2); - luaL_checkany(L, 3); - lua_settop(L, 3); - lua_rawset(L, 1); - return 1; -} - - -static int luaB_collectgarbage (lua_State *L) { - static const char *const opts[] = {"stop", "restart", "collect", - "count", "step", "setpause", "setstepmul", - "isrunning", NULL}; - static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, - LUA_GCCOUNT, LUA_GCSTEP, LUA_GCSETPAUSE, LUA_GCSETSTEPMUL, - LUA_GCISRUNNING}; - int o = optsnum[luaL_checkoption(L, 1, "collect", opts)]; - int ex = (int)luaL_optinteger(L, 2, 0); - int res = lua_gc(L, o, ex); - switch (o) { - case LUA_GCCOUNT: { - int b = lua_gc(L, LUA_GCCOUNTB, 0); - lua_pushnumber(L, (lua_Number)res + ((lua_Number)b/1024)); - return 1; - } - case LUA_GCSTEP: case LUA_GCISRUNNING: { - lua_pushboolean(L, res); - return 1; - } - default: { - lua_pushinteger(L, res); - return 1; - } - } -} - - -/* -** This function has all type names as upvalues, to maximize performance. -*/ -static int luaB_type (lua_State *L) { - luaL_checkany(L, 1); - lua_pushvalue(L, lua_upvalueindex(lua_type(L, 1) + 1)); - return 1; -} - - -static int pairsmeta (lua_State *L, const char *method, int iszero, - lua_CFunction iter) { - if (luaL_getmetafield(L, 1, method) == LUA_TNIL) { /* no metamethod? */ - luaL_checktype(L, 1, LUA_TTABLE); /* argument must be a table */ - lua_pushcfunction(L, iter); /* will return generator, */ - lua_pushvalue(L, 1); /* state, */ - if (iszero) lua_pushinteger(L, 0); /* and initial value */ - else lua_pushnil(L); - } - else { - lua_pushvalue(L, 1); /* argument 'self' to metamethod */ - lua_call(L, 1, 3); /* get 3 values from metamethod */ - } - return 3; -} - - -static int luaB_next (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - lua_settop(L, 2); /* create a 2nd argument if there isn't one */ - if (lua_next(L, 1)) - return 2; - else { - lua_pushnil(L); - return 1; - } -} - - -static int luaB_pairs (lua_State *L) { - return pairsmeta(L, "__pairs", 0, luaB_next); -} - - -/* -** Traversal function for 'ipairs' for raw tables -*/ -static int ipairsaux_raw (lua_State *L) { - lua_Integer i = luaL_checkinteger(L, 2) + 1; - luaL_checktype(L, 1, LUA_TTABLE); - lua_pushinteger(L, i); - return (lua_rawgeti(L, 1, i) == LUA_TNIL) ? 1 : 2; -} - - -/* -** Traversal function for 'ipairs' for tables with metamethods -*/ -static int ipairsaux (lua_State *L) { - lua_Integer i = luaL_checkinteger(L, 2) + 1; - lua_pushinteger(L, i); - return (lua_geti(L, 1, i) == LUA_TNIL) ? 1 : 2; -} - - -/* -** This function will use either 'ipairsaux' or 'ipairsaux_raw' to -** traverse a table, depending on whether the table has metamethods -** that can affect the traversal. -*/ -static int luaB_ipairs (lua_State *L) { - lua_CFunction iter = (luaL_getmetafield(L, 1, "__index") != LUA_TNIL) - ? ipairsaux : ipairsaux_raw; -#if defined(LUA_COMPAT_IPAIRS) - return pairsmeta(L, "__ipairs", 1, iter); -#else - luaL_checkany(L, 1); - lua_pushcfunction(L, iter); /* iteration function */ - lua_pushvalue(L, 1); /* state */ - lua_pushinteger(L, 0); /* initial value */ - return 3; -#endif -} - - -static int load_aux (lua_State *L, int status, int envidx) { - if (status == LUA_OK) { - if (envidx != 0) { /* 'env' parameter? */ - lua_pushvalue(L, envidx); /* environment for loaded function */ - if (!lua_setupvalue(L, -2, 1)) /* set it as 1st upvalue */ - lua_pop(L, 1); /* remove 'env' if not used by previous call */ - } - return 1; - } - else { /* error (message is on top of the stack) */ - lua_pushnil(L); - lua_insert(L, -2); /* put before error message */ - return 2; /* return nil plus error message */ - } -} - - -#ifndef _KERNEL -static int luaB_loadfile (lua_State *L) { - const char *fname = luaL_optstring(L, 1, NULL); - const char *mode = luaL_optstring(L, 2, NULL); - int env = (!lua_isnone(L, 3) ? 3 : 0); /* 'env' index or 0 if no 'env' */ - int status = luaL_loadfilex(L, fname, mode); - return load_aux(L, status, env); -} -#endif - - -/* -** {====================================================== -** Generic Read function -** ======================================================= -*/ - - -/* -** reserved slot, above all arguments, to hold a copy of the returned -** string to avoid it being collected while parsed. 'load' has four -** optional arguments (chunk, source name, mode, and environment). -*/ -#define RESERVEDSLOT 5 - - -/* -** Reader for generic 'load' function: 'lua_load' uses the -** stack for internal stuff, so the reader cannot change the -** stack top. Instead, it keeps its resulting string in a -** reserved slot inside the stack. -*/ -static const char *generic_reader (lua_State *L, void *ud, size_t *size) { - (void)(ud); /* not used */ - luaL_checkstack(L, 2, "too many nested functions"); - lua_pushvalue(L, 1); /* get function */ - lua_call(L, 0, 1); /* call it */ - if (lua_isnil(L, -1)) { - lua_pop(L, 1); /* pop result */ - *size = 0; - return NULL; - } - else if (!lua_isstring(L, -1)) - luaL_error(L, "reader function must return a string"); - lua_replace(L, RESERVEDSLOT); /* save string in reserved slot */ - return lua_tolstring(L, RESERVEDSLOT, size); -} - - -static int luaB_load (lua_State *L) { - int status; - size_t l; - const char *s = lua_tolstring(L, 1, &l); - const char *mode = luaL_optstring(L, 3, "bt"); - int env = (!lua_isnone(L, 4) ? 4 : 0); /* 'env' index or 0 if no 'env' */ - if (s != NULL) { /* loading a string? */ - const char *chunkname = luaL_optstring(L, 2, s); - status = luaL_loadbufferx(L, s, l, chunkname, mode); - } - else { /* loading from a reader function */ - const char *chunkname = luaL_optstring(L, 2, "=(load)"); - luaL_checktype(L, 1, LUA_TFUNCTION); - lua_settop(L, RESERVEDSLOT); /* create reserved slot */ - status = lua_load(L, generic_reader, NULL, chunkname, mode); - } - return load_aux(L, status, env); -} - -/* }====================================================== */ - - -#ifndef _KERNEL -static int dofilecont (lua_State *L, int d1, lua_KContext d2) { - (void)d1; (void)d2; /* only to match 'lua_Kfunction' prototype */ - return lua_gettop(L) - 1; -} - - -static int luaB_dofile (lua_State *L) { - const char *fname = luaL_optstring(L, 1, NULL); - lua_settop(L, 1); - if (luaL_loadfile(L, fname) != LUA_OK) - return lua_error(L); - lua_callk(L, 0, LUA_MULTRET, 0, dofilecont); - return dofilecont(L, 0, 0); -} -#endif - - -static int luaB_assert (lua_State *L) { - if (lua_toboolean(L, 1)) /* condition is true? */ - return lua_gettop(L); /* return all arguments */ - else { /* error */ - luaL_checkany(L, 1); /* there must be a condition */ - lua_remove(L, 1); /* remove it */ - lua_pushliteral(L, "assertion failed!"); /* default message */ - lua_settop(L, 1); /* leave only message (default if no other one) */ - return luaB_error(L); /* call 'error' */ - } -} - - -static int luaB_select (lua_State *L) { - int n = lua_gettop(L); - if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { - lua_pushinteger(L, n-1); - return 1; - } - else { - lua_Integer i = luaL_checkinteger(L, 1); - if (i < 0) i = n + i; - else if (i > n) i = n; - luaL_argcheck(L, 1 <= i, 1, "index out of range"); - return n - (int)i; - } -} - - -/* -** Continuation function for 'pcall' and 'xpcall'. Both functions -** already pushed a 'true' before doing the call, so in case of success -** 'finishpcall' only has to return everything in the stack minus -** 'extra' values (where 'extra' is exactly the number of items to be -** ignored). -*/ -static int finishpcall (lua_State *L, int status, lua_KContext extra) { - if (status != LUA_OK && status != LUA_YIELD) { /* error? */ - lua_pushboolean(L, 0); /* first result (false) */ - lua_pushvalue(L, -2); /* error message */ - return 2; /* return false, msg */ - } - else - return lua_gettop(L) - (int)extra; /* return all results */ -} - - -static int luaB_pcall (lua_State *L) { - int status; - luaL_checkany(L, 1); - lua_pushboolean(L, 1); /* first result if no errors */ - lua_insert(L, 1); /* put it in place */ - status = lua_pcallk(L, lua_gettop(L) - 2, LUA_MULTRET, 0, 0, finishpcall); - return finishpcall(L, status, 0); -} - - -/* -** Do a protected call with error handling. After 'lua_rotate', the -** stack will have ; so, the function passes -** 2 to 'finishpcall' to skip the 2 first values when returning results. -*/ -static int luaB_xpcall (lua_State *L) { - int status; - int n = lua_gettop(L); - luaL_checktype(L, 2, LUA_TFUNCTION); /* check error function */ - lua_pushboolean(L, 1); /* first result */ - lua_pushvalue(L, 1); /* function */ - lua_rotate(L, 3, 2); /* move them below function's arguments */ - status = lua_pcallk(L, n - 2, LUA_MULTRET, 2, 2, finishpcall); - return finishpcall(L, status, 2); -} - - -static int luaB_tostring (lua_State *L) { - luaL_checkany(L, 1); - luaL_tolstring(L, 1, NULL); - return 1; -} - - -static const luaL_Reg base_funcs[] = { - {"assert", luaB_assert}, - {"collectgarbage", luaB_collectgarbage}, -#ifndef _KERNEL - {"dofile", luaB_dofile}, -#endif - {"error", luaB_error}, - {"getmetatable", luaB_getmetatable}, - {"ipairs", luaB_ipairs}, -#ifndef _KERNEL - {"loadfile", luaB_loadfile}, -#endif - {"load", luaB_load}, -#if defined(LUA_COMPAT_LOADSTRING) - {"loadstring", luaB_load}, -#endif - {"next", luaB_next}, - {"pairs", luaB_pairs}, - {"pcall", luaB_pcall}, - {"print", luaB_print}, - {"rawequal", luaB_rawequal}, - {"rawlen", luaB_rawlen}, - {"rawget", luaB_rawget}, - {"rawset", luaB_rawset}, - {"select", luaB_select}, - {"setmetatable", luaB_setmetatable}, - {"tonumber", luaB_tonumber}, - {"tostring", luaB_tostring}, - {"xpcall", luaB_xpcall}, - /* placeholders */ - {"type", NULL}, - {"_G", NULL}, - {"_VERSION", NULL}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_base (lua_State *L) { - int i; - /* open lib into global table */ - lua_pushglobaltable(L); - luaL_setfuncs(L, base_funcs, 0); - /* set global _G */ - lua_pushvalue(L, -1); - lua_setfield(L, -2, "_G"); - /* set global _VERSION */ - lua_pushliteral(L, LUA_VERSION); - lua_setfield(L, -2, "_VERSION"); - /* set function 'type' with proper upvalues */ - for (i = 0; i < LUA_NUMTAGS; i++) /* push all type names as upvalues */ - lua_pushstring(L, lua_typename(L, i)); - lua_pushcclosure(L, luaB_type, LUA_NUMTAGS); - lua_setfield(L, -2, "type"); - return 1; -} - diff --git a/external/mit/lua/dist/src/lbitlib.c b/external/mit/lua/dist/src/lbitlib.c deleted file mode 100644 index 37b50b9ad..000000000 --- a/external/mit/lua/dist/src/lbitlib.c +++ /dev/null @@ -1,230 +0,0 @@ -/* -** $Id: lbitlib.c,v 1.2 2015/02/02 14:03:05 lneto Exp $ -** Standard library for bitwise operations -** See Copyright Notice in lua.h -*/ - -#define lbitlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#if defined(LUA_COMPAT_BITLIB) /* { */ - - -/* number of bits to consider in a number */ -#if !defined(LUA_NBITS) -#define LUA_NBITS 32 -#endif - - -/* -** a lua_Unsigned with its first LUA_NBITS bits equal to 1. (Shift must -** be made in two parts to avoid problems when LUA_NBITS is equal to the -** number of bits in a lua_Unsigned.) -*/ -#define ALLONES (~(((~(lua_Unsigned)0) << (LUA_NBITS - 1)) << 1)) - - -/* macro to trim extra bits */ -#define trim(x) ((x) & ALLONES) - - -/* builds a number with 'n' ones (1 <= n <= LUA_NBITS) */ -#define mask(n) (~((ALLONES << 1) << ((n) - 1))) - - - -static lua_Unsigned andaux (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = ~(lua_Unsigned)0; - for (i = 1; i <= n; i++) - r &= luaL_checkunsigned(L, i); - return trim(r); -} - - -static int b_and (lua_State *L) { - lua_Unsigned r = andaux(L); - lua_pushunsigned(L, r); - return 1; -} - - -static int b_test (lua_State *L) { - lua_Unsigned r = andaux(L); - lua_pushboolean(L, r != 0); - return 1; -} - - -static int b_or (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = 0; - for (i = 1; i <= n; i++) - r |= luaL_checkunsigned(L, i); - lua_pushunsigned(L, trim(r)); - return 1; -} - - -static int b_xor (lua_State *L) { - int i, n = lua_gettop(L); - lua_Unsigned r = 0; - for (i = 1; i <= n; i++) - r ^= luaL_checkunsigned(L, i); - lua_pushunsigned(L, trim(r)); - return 1; -} - - -static int b_not (lua_State *L) { - lua_Unsigned r = ~luaL_checkunsigned(L, 1); - lua_pushunsigned(L, trim(r)); - return 1; -} - - -static int b_shift (lua_State *L, lua_Unsigned r, lua_Integer i) { - if (i < 0) { /* shift right? */ - i = -i; - r = trim(r); - if (i >= LUA_NBITS) r = 0; - else r >>= i; - } - else { /* shift left */ - if (i >= LUA_NBITS) r = 0; - else r <<= i; - r = trim(r); - } - lua_pushunsigned(L, r); - return 1; -} - - -static int b_lshift (lua_State *L) { - return b_shift(L, luaL_checkunsigned(L, 1), luaL_checkinteger(L, 2)); -} - - -static int b_rshift (lua_State *L) { - return b_shift(L, luaL_checkunsigned(L, 1), -luaL_checkinteger(L, 2)); -} - - -static int b_arshift (lua_State *L) { - lua_Unsigned r = luaL_checkunsigned(L, 1); - lua_Integer i = luaL_checkinteger(L, 2); - if (i < 0 || !(r & ((lua_Unsigned)1 << (LUA_NBITS - 1)))) - return b_shift(L, r, -i); - else { /* arithmetic shift for 'negative' number */ - if (i >= LUA_NBITS) r = ALLONES; - else - r = trim((r >> i) | ~(trim(~(lua_Unsigned)0) >> i)); /* add signal bit */ - lua_pushunsigned(L, r); - return 1; - } -} - - -static int b_rot (lua_State *L, lua_Integer d) { - lua_Unsigned r = luaL_checkunsigned(L, 1); - int i = d & (LUA_NBITS - 1); /* i = d % NBITS */ - r = trim(r); - if (i != 0) /* avoid undefined shift of LUA_NBITS when i == 0 */ - r = (r << i) | (r >> (LUA_NBITS - i)); - lua_pushunsigned(L, trim(r)); - return 1; -} - - -static int b_lrot (lua_State *L) { - return b_rot(L, luaL_checkinteger(L, 2)); -} - - -static int b_rrot (lua_State *L) { - return b_rot(L, -luaL_checkinteger(L, 2)); -} - - -/* -** get field and width arguments for field-manipulation functions, -** checking whether they are valid. -** ('luaL_error' called without 'return' to avoid later warnings about -** 'width' being used uninitialized.) -*/ -static int fieldargs (lua_State *L, int farg, int *width) { - lua_Integer f = luaL_checkinteger(L, farg); - lua_Integer w = luaL_optinteger(L, farg + 1, 1); - luaL_argcheck(L, 0 <= f, farg, "field cannot be negative"); - luaL_argcheck(L, 0 < w, farg + 1, "width must be positive"); - if (f + w > LUA_NBITS) - luaL_error(L, "trying to access non-existent bits"); - *width = (int)w; - return (int)f; -} - - -static int b_extract (lua_State *L) { - int w; - lua_Unsigned r = trim(luaL_checkunsigned(L, 1)); - int f = fieldargs(L, 2, &w); - r = (r >> f) & mask(w); - lua_pushunsigned(L, r); - return 1; -} - - -static int b_replace (lua_State *L) { - int w; - lua_Unsigned r = trim(luaL_checkunsigned(L, 1)); - lua_Unsigned v = luaL_checkunsigned(L, 2); - int f = fieldargs(L, 3, &w); - int m = mask(w); - v &= m; /* erase bits outside given width */ - r = (r & ~(m << f)) | (v << f); - lua_pushunsigned(L, r); - return 1; -} - - -static const luaL_Reg bitlib[] = { - {"arshift", b_arshift}, - {"band", b_and}, - {"bnot", b_not}, - {"bor", b_or}, - {"bxor", b_xor}, - {"btest", b_test}, - {"extract", b_extract}, - {"lrotate", b_lrot}, - {"lshift", b_lshift}, - {"replace", b_replace}, - {"rrotate", b_rrot}, - {"rshift", b_rshift}, - {NULL, NULL} -}; - - - -LUAMOD_API int luaopen_bit32 (lua_State *L) { - luaL_newlib(L, bitlib); - return 1; -} - - -#else /* }{ */ - - -LUAMOD_API int luaopen_bit32 (lua_State *L) { - return luaL_error(L, "library 'bit32' has been deprecated"); -} - -#endif /* } */ diff --git a/external/mit/lua/dist/src/lcode.c b/external/mit/lua/dist/src/lcode.c deleted file mode 100644 index 06a014ac9..000000000 --- a/external/mit/lua/dist/src/lcode.c +++ /dev/null @@ -1,993 +0,0 @@ -/* $NetBSD: lcode.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lcode.c,v 2.101 2015/04/29 18:24:11 roberto Exp -** Code generator for Lua -** See Copyright Notice in lua.h -*/ - -#define lcode_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#endif - -#include "lua.h" - -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "llex.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstring.h" -#include "ltable.h" -#include "lvm.h" - - -/* Maximum number of registers in a Lua function (must fit in 8 bits) */ -#define MAXREGS 255 - - -#define hasjumps(e) ((e)->t != (e)->f) - - -static int tonumeral(expdesc *e, TValue *v) { - if (e->t != NO_JUMP || e->f != NO_JUMP) - return 0; /* not a numeral */ - switch (e->k) { - case VKINT: - if (v) setivalue(v, e->u.ival); - return 1; -#ifndef _KERNEL - case VKFLT: - if (v) setfltvalue(v, e->u.nval); - return 1; -#endif - default: return 0; - } -} - - -void luaK_nil (FuncState *fs, int from, int n) { - Instruction *previous; - int l = from + n - 1; /* last register to set nil */ - if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ - previous = &fs->f->code[fs->pc-1]; - if (GET_OPCODE(*previous) == OP_LOADNIL) { - int pfrom = GETARG_A(*previous); - int pl = pfrom + GETARG_B(*previous); - if ((pfrom <= from && from <= pl + 1) || - (from <= pfrom && pfrom <= l + 1)) { /* can connect both? */ - if (pfrom < from) from = pfrom; /* from = min(from, pfrom) */ - if (pl > l) l = pl; /* l = max(l, pl) */ - SETARG_A(*previous, from); - SETARG_B(*previous, l - from); - return; - } - } /* else go through */ - } - luaK_codeABC(fs, OP_LOADNIL, from, n - 1, 0); /* else no optimization */ -} - - -int luaK_jump (FuncState *fs) { - int jpc = fs->jpc; /* save list of jumps to here */ - int j; - fs->jpc = NO_JUMP; - j = luaK_codeAsBx(fs, OP_JMP, 0, NO_JUMP); - luaK_concat(fs, &j, jpc); /* keep them on hold */ - return j; -} - - -void luaK_ret (FuncState *fs, int first, int nret) { - luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); -} - - -static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { - luaK_codeABC(fs, op, A, B, C); - return luaK_jump(fs); -} - - -static void fixjump (FuncState *fs, int pc, int dest) { - Instruction *jmp = &fs->f->code[pc]; - int offset = dest-(pc+1); - lua_assert(dest != NO_JUMP); - if (abs(offset) > MAXARG_sBx) - luaX_syntaxerror(fs->ls, "control structure too long"); - SETARG_sBx(*jmp, offset); -} - - -/* -** returns current 'pc' and marks it as a jump target (to avoid wrong -** optimizations with consecutive instructions not in the same basic block). -*/ -int luaK_getlabel (FuncState *fs) { - fs->lasttarget = fs->pc; - return fs->pc; -} - - -static int getjump (FuncState *fs, int pc) { - int offset = GETARG_sBx(fs->f->code[pc]); - if (offset == NO_JUMP) /* point to itself represents end of list */ - return NO_JUMP; /* end of list */ - else - return (pc+1)+offset; /* turn offset into absolute position */ -} - - -static Instruction *getjumpcontrol (FuncState *fs, int pc) { - Instruction *pi = &fs->f->code[pc]; - if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) - return pi-1; - else - return pi; -} - - -/* -** check whether list has any jump that do not produce a value -** (or produce an inverted value) -*/ -static int need_value (FuncState *fs, int list) { - for (; list != NO_JUMP; list = getjump(fs, list)) { - Instruction i = *getjumpcontrol(fs, list); - if (GET_OPCODE(i) != OP_TESTSET) return 1; - } - return 0; /* not found */ -} - - -static int patchtestreg (FuncState *fs, int node, int reg) { - Instruction *i = getjumpcontrol(fs, node); - if (GET_OPCODE(*i) != OP_TESTSET) - return 0; /* cannot patch other instructions */ - if (reg != NO_REG && reg != GETARG_B(*i)) - SETARG_A(*i, reg); - else /* no register to put value or register already has the value */ - *i = CREATE_ABC(OP_TEST, GETARG_B(*i), 0, GETARG_C(*i)); - - return 1; -} - - -static void removevalues (FuncState *fs, int list) { - for (; list != NO_JUMP; list = getjump(fs, list)) - patchtestreg(fs, list, NO_REG); -} - - -static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, - int dtarget) { - while (list != NO_JUMP) { - int next = getjump(fs, list); - if (patchtestreg(fs, list, reg)) - fixjump(fs, list, vtarget); - else - fixjump(fs, list, dtarget); /* jump to default target */ - list = next; - } -} - - -static void dischargejpc (FuncState *fs) { - patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); - fs->jpc = NO_JUMP; -} - - -void luaK_patchlist (FuncState *fs, int list, int target) { - if (target == fs->pc) - luaK_patchtohere(fs, list); - else { - lua_assert(target < fs->pc); - patchlistaux(fs, list, target, NO_REG, target); - } -} - - -void luaK_patchclose (FuncState *fs, int list, int level) { - level++; /* argument is +1 to reserve 0 as non-op */ - while (list != NO_JUMP) { - int next = getjump(fs, list); - lua_assert(GET_OPCODE(fs->f->code[list]) == OP_JMP && - (GETARG_A(fs->f->code[list]) == 0 || - GETARG_A(fs->f->code[list]) >= level)); - SETARG_A(fs->f->code[list], level); - list = next; - } -} - - -void luaK_patchtohere (FuncState *fs, int list) { - luaK_getlabel(fs); - luaK_concat(fs, &fs->jpc, list); -} - - -void luaK_concat (FuncState *fs, int *l1, int l2) { - if (l2 == NO_JUMP) return; - else if (*l1 == NO_JUMP) - *l1 = l2; - else { - int list = *l1; - int next; - while ((next = getjump(fs, list)) != NO_JUMP) /* find last element */ - list = next; - fixjump(fs, list, l2); - } -} - - -static int luaK_code (FuncState *fs, Instruction i) { - Proto *f = fs->f; - dischargejpc(fs); /* 'pc' will change */ - /* put new instruction in code array */ - luaM_growvector(fs->ls->L, f->code, fs->pc, f->sizecode, Instruction, - MAX_INT, "opcodes"); - f->code[fs->pc] = i; - /* save corresponding line information */ - luaM_growvector(fs->ls->L, f->lineinfo, fs->pc, f->sizelineinfo, int, - MAX_INT, "opcodes"); - f->lineinfo[fs->pc] = fs->ls->lastline; - return fs->pc++; -} - - -int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { - lua_assert(getOpMode(o) == iABC); - lua_assert(getBMode(o) != OpArgN || b == 0); - lua_assert(getCMode(o) != OpArgN || c == 0); - lua_assert(a <= MAXARG_A && b <= MAXARG_B && c <= MAXARG_C); - return luaK_code(fs, CREATE_ABC(o, a, b, c)); -} - - -int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { - lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); - lua_assert(getCMode(o) == OpArgN); - lua_assert(a <= MAXARG_A && bc <= MAXARG_Bx); - return luaK_code(fs, CREATE_ABx(o, a, bc)); -} - - -static int codeextraarg (FuncState *fs, int a) { - lua_assert(a <= MAXARG_Ax); - return luaK_code(fs, CREATE_Ax(OP_EXTRAARG, a)); -} - - -int luaK_codek (FuncState *fs, int reg, int k) { - if (k <= MAXARG_Bx) - return luaK_codeABx(fs, OP_LOADK, reg, k); - else { - int p = luaK_codeABx(fs, OP_LOADKX, reg, 0); - codeextraarg(fs, k); - return p; - } -} - - -void luaK_checkstack (FuncState *fs, int n) { - int newstack = fs->freereg + n; - if (newstack > fs->f->maxstacksize) { - if (newstack >= MAXREGS) - luaX_syntaxerror(fs->ls, - "function or expression needs too many registers"); - fs->f->maxstacksize = cast_byte(newstack); - } -} - - -void luaK_reserveregs (FuncState *fs, int n) { - luaK_checkstack(fs, n); - fs->freereg += n; -} - - -static void freereg (FuncState *fs, int reg) { - if (!ISK(reg) && reg >= fs->nactvar) { - fs->freereg--; - lua_assert(reg == fs->freereg); - } -} - - -static void freeexp (FuncState *fs, expdesc *e) { - if (e->k == VNONRELOC) - freereg(fs, e->u.info); -} - - -/* -** Use scanner's table to cache position of constants in constant list -** and try to reuse constants -*/ -static int addk (FuncState *fs, TValue *key, TValue *v) { - lua_State *L = fs->ls->L; - Proto *f = fs->f; - TValue *idx = luaH_set(L, fs->ls->h, key); /* index scanner table */ - int k, oldsize; - if (ttisinteger(idx)) { /* is there an index there? */ - k = cast_int(ivalue(idx)); - /* correct value? (warning: must distinguish floats from integers!) */ - if (k < fs->nk && ttype(&f->k[k]) == ttype(v) && - luaV_rawequalobj(&f->k[k], v)) - return k; /* reuse index */ - } - /* constant not found; create a new entry */ - oldsize = f->sizek; - k = fs->nk; - /* numerical value does not need GC barrier; - table has no metatable, so it does not need to invalidate cache */ - setivalue(idx, k); - luaM_growvector(L, f->k, k, f->sizek, TValue, MAXARG_Ax, "constants"); - while (oldsize < f->sizek) setnilvalue(&f->k[oldsize++]); - setobj(L, &f->k[k], v); - fs->nk++; - luaC_barrier(L, f, v); - return k; -} - - -int luaK_stringK (FuncState *fs, TString *s) { - TValue o; - setsvalue(fs->ls->L, &o, s); - return addk(fs, &o, &o); -} - - -/* -** Integers use userdata as keys to avoid collision with floats with same -** value; conversion to 'void*' used only for hashing, no "precision" -** problems -*/ -int luaK_intK (FuncState *fs, lua_Integer n) { - TValue k, o; - setpvalue(&k, cast(void*, cast(size_t, n))); - setivalue(&o, n); - return addk(fs, &k, &o); -} - - -#ifndef _KERNEL -static int luaK_numberK (FuncState *fs, lua_Number r) { - TValue o; - setfltvalue(&o, r); - return addk(fs, &o, &o); -} -#endif - - -static int boolK (FuncState *fs, int b) { - TValue o; - setbvalue(&o, b); - return addk(fs, &o, &o); -} - - -static int nilK (FuncState *fs) { - TValue k, v; - setnilvalue(&v); - /* cannot use nil as key; instead use table itself to represent nil */ - sethvalue(fs->ls->L, &k, fs->ls->h); - return addk(fs, &k, &v); -} - - -void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { - if (e->k == VCALL) { /* expression is an open function call? */ - SETARG_C(getcode(fs, e), nresults+1); - } - else if (e->k == VVARARG) { - SETARG_B(getcode(fs, e), nresults+1); - SETARG_A(getcode(fs, e), fs->freereg); - luaK_reserveregs(fs, 1); - } -} - - -void luaK_setoneret (FuncState *fs, expdesc *e) { - if (e->k == VCALL) { /* expression is an open function call? */ - e->k = VNONRELOC; - e->u.info = GETARG_A(getcode(fs, e)); - } - else if (e->k == VVARARG) { - SETARG_B(getcode(fs, e), 2); - e->k = VRELOCABLE; /* can relocate its simple result */ - } -} - - -void luaK_dischargevars (FuncState *fs, expdesc *e) { - switch (e->k) { - case VLOCAL: { - e->k = VNONRELOC; - break; - } - case VUPVAL: { - e->u.info = luaK_codeABC(fs, OP_GETUPVAL, 0, e->u.info, 0); - e->k = VRELOCABLE; - break; - } - case VINDEXED: { - OpCode op = OP_GETTABUP; /* assume 't' is in an upvalue */ - freereg(fs, e->u.ind.idx); - if (e->u.ind.vt == VLOCAL) { /* 't' is in a register? */ - freereg(fs, e->u.ind.t); - op = OP_GETTABLE; - } - e->u.info = luaK_codeABC(fs, op, 0, e->u.ind.t, e->u.ind.idx); - e->k = VRELOCABLE; - break; - } - case VVARARG: - case VCALL: { - luaK_setoneret(fs, e); - break; - } - default: break; /* there is one value available (somewhere) */ - } -} - - -static int code_label (FuncState *fs, int A, int b, int jump) { - luaK_getlabel(fs); /* those instructions may be jump targets */ - return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); -} - - -static void discharge2reg (FuncState *fs, expdesc *e, int reg) { - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: { - luaK_nil(fs, reg, 1); - break; - } - case VFALSE: case VTRUE: { - luaK_codeABC(fs, OP_LOADBOOL, reg, e->k == VTRUE, 0); - break; - } - case VK: { - luaK_codek(fs, reg, e->u.info); - break; - } -#ifndef _KERNEL - case VKFLT: { - luaK_codek(fs, reg, luaK_numberK(fs, e->u.nval)); - break; - } -#endif - case VKINT: { - luaK_codek(fs, reg, luaK_intK(fs, e->u.ival)); - break; - } - case VRELOCABLE: { - Instruction *pc = &getcode(fs, e); - SETARG_A(*pc, reg); - break; - } - case VNONRELOC: { - if (reg != e->u.info) - luaK_codeABC(fs, OP_MOVE, reg, e->u.info, 0); - break; - } - default: { - lua_assert(e->k == VVOID || e->k == VJMP); - return; /* nothing to do... */ - } - } - e->u.info = reg; - e->k = VNONRELOC; -} - - -static void discharge2anyreg (FuncState *fs, expdesc *e) { - if (e->k != VNONRELOC) { - luaK_reserveregs(fs, 1); - discharge2reg(fs, e, fs->freereg-1); - } -} - - -static void exp2reg (FuncState *fs, expdesc *e, int reg) { - discharge2reg(fs, e, reg); - if (e->k == VJMP) - luaK_concat(fs, &e->t, e->u.info); /* put this jump in 't' list */ - if (hasjumps(e)) { - int final; /* position after whole expression */ - int p_f = NO_JUMP; /* position of an eventual LOAD false */ - int p_t = NO_JUMP; /* position of an eventual LOAD true */ - if (need_value(fs, e->t) || need_value(fs, e->f)) { - int fj = (e->k == VJMP) ? NO_JUMP : luaK_jump(fs); - p_f = code_label(fs, reg, 0, 1); - p_t = code_label(fs, reg, 1, 0); - luaK_patchtohere(fs, fj); - } - final = luaK_getlabel(fs); - patchlistaux(fs, e->f, final, reg, p_f); - patchlistaux(fs, e->t, final, reg, p_t); - } - e->f = e->t = NO_JUMP; - e->u.info = reg; - e->k = VNONRELOC; -} - - -void luaK_exp2nextreg (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - freeexp(fs, e); - luaK_reserveregs(fs, 1); - exp2reg(fs, e, fs->freereg - 1); -} - - -int luaK_exp2anyreg (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - if (e->k == VNONRELOC) { - if (!hasjumps(e)) return e->u.info; /* exp is already in a register */ - if (e->u.info >= fs->nactvar) { /* reg. is not a local? */ - exp2reg(fs, e, e->u.info); /* put value on it */ - return e->u.info; - } - } - luaK_exp2nextreg(fs, e); /* default */ - return e->u.info; -} - - -void luaK_exp2anyregup (FuncState *fs, expdesc *e) { - if (e->k != VUPVAL || hasjumps(e)) - luaK_exp2anyreg(fs, e); -} - - -void luaK_exp2val (FuncState *fs, expdesc *e) { - if (hasjumps(e)) - luaK_exp2anyreg(fs, e); - else - luaK_dischargevars(fs, e); -} - - -int luaK_exp2RK (FuncState *fs, expdesc *e) { - luaK_exp2val(fs, e); - switch (e->k) { - case VTRUE: - case VFALSE: - case VNIL: { - if (fs->nk <= MAXINDEXRK) { /* constant fits in RK operand? */ - e->u.info = (e->k == VNIL) ? nilK(fs) : boolK(fs, (e->k == VTRUE)); - e->k = VK; - return RKASK(e->u.info); - } - else break; - } - case VKINT: { - e->u.info = luaK_intK(fs, e->u.ival); - e->k = VK; - goto vk; - } -#ifndef _KERNEL - case VKFLT: { - e->u.info = luaK_numberK(fs, e->u.nval); - e->k = VK; - } -#endif - /* FALLTHROUGH */ - case VK: { - vk: - if (e->u.info <= MAXINDEXRK) /* constant fits in 'argC'? */ - return RKASK(e->u.info); - else break; - } - default: break; - } - /* not a constant in the right range: put it in a register */ - return luaK_exp2anyreg(fs, e); -} - - -void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { - switch (var->k) { - case VLOCAL: { - freeexp(fs, ex); - exp2reg(fs, ex, var->u.info); - return; - } - case VUPVAL: { - int e = luaK_exp2anyreg(fs, ex); - luaK_codeABC(fs, OP_SETUPVAL, e, var->u.info, 0); - break; - } - case VINDEXED: { - OpCode op = (var->u.ind.vt == VLOCAL) ? OP_SETTABLE : OP_SETTABUP; - int e = luaK_exp2RK(fs, ex); - luaK_codeABC(fs, op, var->u.ind.t, var->u.ind.idx, e); - break; - } - default: { - lua_assert(0); /* invalid var kind to store */ - break; - } - } - freeexp(fs, ex); -} - - -void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { - int ereg; - luaK_exp2anyreg(fs, e); - ereg = e->u.info; /* register where 'e' was placed */ - freeexp(fs, e); - e->u.info = fs->freereg; /* base register for op_self */ - e->k = VNONRELOC; - luaK_reserveregs(fs, 2); /* function and 'self' produced by op_self */ - luaK_codeABC(fs, OP_SELF, e->u.info, ereg, luaK_exp2RK(fs, key)); - freeexp(fs, key); -} - - -static void invertjump (FuncState *fs, expdesc *e) { - Instruction *pc = getjumpcontrol(fs, e->u.info); - lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && - GET_OPCODE(*pc) != OP_TEST); - SETARG_A(*pc, !(GETARG_A(*pc))); -} - - -static int jumponcond (FuncState *fs, expdesc *e, int cond) { - if (e->k == VRELOCABLE) { - Instruction ie = getcode(fs, e); - if (GET_OPCODE(ie) == OP_NOT) { - fs->pc--; /* remove previous OP_NOT */ - return condjump(fs, OP_TEST, GETARG_B(ie), 0, !cond); - } - /* else go through */ - } - discharge2anyreg(fs, e); - freeexp(fs, e); - return condjump(fs, OP_TESTSET, NO_REG, e->u.info, cond); -} - - -void luaK_goiftrue (FuncState *fs, expdesc *e) { - int pc; /* pc of last jump */ - luaK_dischargevars(fs, e); - switch (e->k) { - case VJMP: { - invertjump(fs, e); - pc = e->u.info; - break; - } -#ifndef _KERNEL - case VK: case VKFLT: case VKINT: case VTRUE: { -#else - case VK: case VKINT: case VTRUE: { -#endif - pc = NO_JUMP; /* always true; do nothing */ - break; - } - default: { - pc = jumponcond(fs, e, 0); - break; - } - } - luaK_concat(fs, &e->f, pc); /* insert last jump in 'f' list */ - luaK_patchtohere(fs, e->t); - e->t = NO_JUMP; -} - - -void luaK_goiffalse (FuncState *fs, expdesc *e) { - int pc; /* pc of last jump */ - luaK_dischargevars(fs, e); - switch (e->k) { - case VJMP: { - pc = e->u.info; - break; - } - case VNIL: case VFALSE: { - pc = NO_JUMP; /* always false; do nothing */ - break; - } - default: { - pc = jumponcond(fs, e, 1); - break; - } - } - luaK_concat(fs, &e->t, pc); /* insert last jump in 't' list */ - luaK_patchtohere(fs, e->f); - e->f = NO_JUMP; -} - - -static void codenot (FuncState *fs, expdesc *e) { - luaK_dischargevars(fs, e); - switch (e->k) { - case VNIL: case VFALSE: { - e->k = VTRUE; - break; - } -#ifndef _KERNEL - case VK: case VKFLT: case VKINT: case VTRUE: { -#else - case VK: case VKINT: case VTRUE: { -#endif - e->k = VFALSE; - break; - } - case VJMP: { - invertjump(fs, e); - break; - } - case VRELOCABLE: - case VNONRELOC: { - discharge2anyreg(fs, e); - freeexp(fs, e); - e->u.info = luaK_codeABC(fs, OP_NOT, 0, e->u.info, 0); - e->k = VRELOCABLE; - break; - } - default: { - lua_assert(0); /* cannot happen */ - break; - } - } - /* interchange true and false lists */ - { int temp = e->f; e->f = e->t; e->t = temp; } - removevalues(fs, e->f); - removevalues(fs, e->t); -} - - -void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { - lua_assert(!hasjumps(t)); - t->u.ind.t = t->u.info; - t->u.ind.idx = luaK_exp2RK(fs, k); - t->u.ind.vt = (t->k == VUPVAL) ? VUPVAL - : check_exp(vkisinreg(t->k), VLOCAL); - t->k = VINDEXED; -} - - -/* -** return false if folding can raise an error -*/ -static int validop (int op, TValue *v1, TValue *v2) { - switch (op) { - case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: - case LUA_OPSHL: case LUA_OPSHR: case LUA_OPBNOT: { /* conversion errors */ - lua_Integer i; - return (tointeger(v1, &i) && tointeger(v2, &i)); - } -#ifndef _KERNEL - case LUA_OPDIV: case LUA_OPIDIV: case LUA_OPMOD: /* division by 0 */ -#else /* _KERNEL */ - case LUA_OPIDIV: case LUA_OPMOD: /* division by 0 */ -#endif - return (nvalue(v2) != 0); - default: return 1; /* everything else is valid */ - } -} - - -/* -** Try to "constant-fold" an operation; return 1 iff successful -*/ -static int constfolding (FuncState *fs, int op, expdesc *e1, expdesc *e2) { - TValue v1, v2, res; - if (!tonumeral(e1, &v1) || !tonumeral(e2, &v2) || !validop(op, &v1, &v2)) - return 0; /* non-numeric operands or not safe to fold */ - luaO_arith(fs->ls->L, op, &v1, &v2, &res); /* does operation */ - if (ttisinteger(&res)) { - e1->k = VKINT; - e1->u.ival = ivalue(&res); - } - else { /* folds neither NaN nor 0.0 (to avoid collapsing with -0.0) */ -#ifndef _KERNEL - lua_Number n = fltvalue(&res); - if (luai_numisnan(n) || n == 0) - return 0; - e1->k = VKFLT; - e1->u.nval = n; -#else /* _KERNEL */ - return 0; /* if it is not integer, we must fail */ -#endif - } - return 1; -} - - -/* -** Code for binary and unary expressions that "produce values" -** (arithmetic operations, bitwise operations, concat, length). First -** try to do constant folding (only for numeric [arithmetic and -** bitwise] operations, which is what 'lua_arith' accepts). -** Expression to produce final result will be encoded in 'e1'. -*/ -static void codeexpval (FuncState *fs, OpCode op, - expdesc *e1, expdesc *e2, int line) { - lua_assert(op >= OP_ADD); - if (op <= OP_BNOT && constfolding(fs, (op - OP_ADD) + LUA_OPADD, e1, e2)) - return; /* result has been folded */ - else { - int o1, o2; - /* move operands to registers (if needed) */ - if (op == OP_UNM || op == OP_BNOT || op == OP_LEN) { /* unary op? */ - o2 = 0; /* no second expression */ - o1 = luaK_exp2anyreg(fs, e1); /* cannot operate on constants */ - } - else { /* regular case (binary operators) */ - o2 = luaK_exp2RK(fs, e2); /* both operands are "RK" */ - o1 = luaK_exp2RK(fs, e1); - } - if (o1 > o2) { /* free registers in proper order */ - freeexp(fs, e1); - freeexp(fs, e2); - } - else { - freeexp(fs, e2); - freeexp(fs, e1); - } - e1->u.info = luaK_codeABC(fs, op, 0, o1, o2); /* generate opcode */ - e1->k = VRELOCABLE; /* all those operations are relocable */ - luaK_fixline(fs, line); - } -} - - -static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, - expdesc *e2) { - int o1 = luaK_exp2RK(fs, e1); - int o2 = luaK_exp2RK(fs, e2); - freeexp(fs, e2); - freeexp(fs, e1); - if (cond == 0 && op != OP_EQ) { - int temp; /* exchange args to replace by '<' or '<=' */ - temp = o1; o1 = o2; o2 = temp; /* o1 <==> o2 */ - cond = 1; - } - e1->u.info = condjump(fs, op, cond, o1, o2); - e1->k = VJMP; -} - - -void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e, int line) { - expdesc e2; - e2.t = e2.f = NO_JUMP; e2.k = VKINT; e2.u.ival = 0; - switch (op) { - case OPR_MINUS: case OPR_BNOT: case OPR_LEN: { - codeexpval(fs, cast(OpCode, (op - OPR_MINUS) + OP_UNM), e, &e2, line); - break; - } - case OPR_NOT: codenot(fs, e); break; - default: lua_assert(0); - } -} - - -void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { - switch (op) { - case OPR_AND: { - luaK_goiftrue(fs, v); - break; - } - case OPR_OR: { - luaK_goiffalse(fs, v); - break; - } - case OPR_CONCAT: { - luaK_exp2nextreg(fs, v); /* operand must be on the 'stack' */ - break; - } - case OPR_ADD: case OPR_SUB: -#ifndef _KERNEL - case OPR_MUL: case OPR_DIV: case OPR_IDIV: - case OPR_MOD: case OPR_POW: -#else - case OPR_MUL: case OPR_IDIV: - case OPR_MOD: -#endif - case OPR_BAND: case OPR_BOR: case OPR_BXOR: - case OPR_SHL: case OPR_SHR: { - if (!tonumeral(v, NULL)) luaK_exp2RK(fs, v); - break; - } - default: { - luaK_exp2RK(fs, v); - break; - } - } -} - - -void luaK_posfix (FuncState *fs, BinOpr op, - expdesc *e1, expdesc *e2, int line) { - switch (op) { - case OPR_AND: { - lua_assert(e1->t == NO_JUMP); /* list must be closed */ - luaK_dischargevars(fs, e2); - luaK_concat(fs, &e2->f, e1->f); - *e1 = *e2; - break; - } - case OPR_OR: { - lua_assert(e1->f == NO_JUMP); /* list must be closed */ - luaK_dischargevars(fs, e2); - luaK_concat(fs, &e2->t, e1->t); - *e1 = *e2; - break; - } - case OPR_CONCAT: { - luaK_exp2val(fs, e2); - if (e2->k == VRELOCABLE && GET_OPCODE(getcode(fs, e2)) == OP_CONCAT) { - lua_assert(e1->u.info == GETARG_B(getcode(fs, e2))-1); - freeexp(fs, e1); - SETARG_B(getcode(fs, e2), e1->u.info); - e1->k = VRELOCABLE; e1->u.info = e2->u.info; - } - else { - luaK_exp2nextreg(fs, e2); /* operand must be on the 'stack' */ - codeexpval(fs, OP_CONCAT, e1, e2, line); - } - break; - } -#ifndef _KERNEL - case OPR_ADD: case OPR_SUB: case OPR_MUL: case OPR_DIV: - case OPR_IDIV: case OPR_MOD: case OPR_POW: -#else - case OPR_ADD: case OPR_SUB: case OPR_MUL: - case OPR_IDIV: case OPR_MOD: -#endif - case OPR_BAND: case OPR_BOR: case OPR_BXOR: - case OPR_SHL: case OPR_SHR: { - codeexpval(fs, cast(OpCode, (op - OPR_ADD) + OP_ADD), e1, e2, line); - break; - } - case OPR_EQ: case OPR_LT: case OPR_LE: { - codecomp(fs, cast(OpCode, (op - OPR_EQ) + OP_EQ), 1, e1, e2); - break; - } - case OPR_NE: case OPR_GT: case OPR_GE: { - codecomp(fs, cast(OpCode, (op - OPR_NE) + OP_EQ), 0, e1, e2); - break; - } - default: lua_assert(0); - } -} - - -void luaK_fixline (FuncState *fs, int line) { - fs->f->lineinfo[fs->pc - 1] = line; -} - - -void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { - int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; - int b = (tostore == LUA_MULTRET) ? 0 : tostore; - lua_assert(tostore != 0); - if (c <= MAXARG_C) - luaK_codeABC(fs, OP_SETLIST, base, b, c); - else if (c <= MAXARG_Ax) { - luaK_codeABC(fs, OP_SETLIST, base, b, 0); - codeextraarg(fs, c); - } - else - luaX_syntaxerror(fs->ls, "constructor too long"); - fs->freereg = base + 1; /* free registers with list values */ -} - diff --git a/external/mit/lua/dist/src/lcode.h b/external/mit/lua/dist/src/lcode.h deleted file mode 100644 index 32db0daa3..000000000 --- a/external/mit/lua/dist/src/lcode.h +++ /dev/null @@ -1,93 +0,0 @@ -/* $NetBSD: lcode.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lcode.h,v 1.63 2013/12/30 20:47:58 roberto Exp -** Code generator for Lua -** See Copyright Notice in lua.h -*/ - -#ifndef lcode_h -#define lcode_h - -#include "llex.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" - - -/* -** Marks the end of a patch list. It is an invalid value both as an absolute -** address, and as a list link (would link an element to itself). -*/ -#define NO_JUMP (-1) - - -/* -** grep "ORDER OPR" if you change these enums (ORDER OP) -*/ -typedef enum BinOpr { -#ifndef _KERNEL - OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, OPR_POW, - OPR_DIV, -#else /* _KERNEL */ - OPR_ADD, OPR_SUB, OPR_MUL, OPR_MOD, -#endif - OPR_IDIV, - OPR_BAND, OPR_BOR, OPR_BXOR, - OPR_SHL, OPR_SHR, - OPR_CONCAT, - OPR_EQ, OPR_LT, OPR_LE, - OPR_NE, OPR_GT, OPR_GE, - OPR_AND, OPR_OR, - OPR_NOBINOPR -} BinOpr; - - -typedef enum UnOpr { OPR_MINUS, OPR_BNOT, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr; - - -#define getcode(fs,e) ((fs)->f->code[(e)->u.info]) - -#define luaK_codeAsBx(fs,o,A,sBx) luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx) - -#define luaK_setmultret(fs,e) luaK_setreturns(fs, e, LUA_MULTRET) - -#define luaK_jumpto(fs,t) luaK_patchlist(fs, luaK_jump(fs), t) - -LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx); -LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C); -LUAI_FUNC int luaK_codek (FuncState *fs, int reg, int k); -LUAI_FUNC void luaK_fixline (FuncState *fs, int line); -LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n); -LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n); -LUAI_FUNC void luaK_checkstack (FuncState *fs, int n); -LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s); -LUAI_FUNC int luaK_intK (FuncState *fs, lua_Integer n); -LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_exp2anyregup (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key); -LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k); -LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_goiffalse (FuncState *fs, expdesc *e); -LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e); -LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults); -LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e); -LUAI_FUNC int luaK_jump (FuncState *fs); -LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret); -LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target); -LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list); -LUAI_FUNC void luaK_patchclose (FuncState *fs, int list, int level); -LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2); -LUAI_FUNC int luaK_getlabel (FuncState *fs); -LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v, int line); -LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v); -LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, - expdesc *v2, int line); -LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore); - - -#endif diff --git a/external/mit/lua/dist/src/lcorolib.c b/external/mit/lua/dist/src/lcorolib.c deleted file mode 100644 index b984c5709..000000000 --- a/external/mit/lua/dist/src/lcorolib.c +++ /dev/null @@ -1,172 +0,0 @@ -/* $NetBSD: lcorolib.c,v 1.2 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lcorolib.c,v 1.9 2014/11/02 19:19:04 roberto Exp -** Coroutine Library -** See Copyright Notice in lua.h -*/ - -#define lcorolib_c -#define LUA_LIB - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -static lua_State *getco (lua_State *L) { - lua_State *co = lua_tothread(L, 1); - luaL_argcheck(L, co, 1, "thread expected"); - return co; -} - - -static int auxresume (lua_State *L, lua_State *co, int narg) { - int status; - if (!lua_checkstack(co, narg)) { - lua_pushliteral(L, "too many arguments to resume"); - return -1; /* error flag */ - } - if (lua_status(co) == LUA_OK && lua_gettop(co) == 0) { - lua_pushliteral(L, "cannot resume dead coroutine"); - return -1; /* error flag */ - } - lua_xmove(L, co, narg); - status = lua_resume(co, L, narg); - if (status == LUA_OK || status == LUA_YIELD) { - int nres = lua_gettop(co); - if (!lua_checkstack(L, nres + 1)) { - lua_pop(co, nres); /* remove results anyway */ - lua_pushliteral(L, "too many results to resume"); - return -1; /* error flag */ - } - lua_xmove(co, L, nres); /* move yielded values */ - return nres; - } - else { - lua_xmove(co, L, 1); /* move error message */ - return -1; /* error flag */ - } -} - - -static int luaB_coresume (lua_State *L) { - lua_State *co = getco(L); - int r; - r = auxresume(L, co, lua_gettop(L) - 1); - if (r < 0) { - lua_pushboolean(L, 0); - lua_insert(L, -2); - return 2; /* return false + error message */ - } - else { - lua_pushboolean(L, 1); - lua_insert(L, -(r + 1)); - return r + 1; /* return true + 'resume' returns */ - } -} - - -static int luaB_auxwrap (lua_State *L) { - lua_State *co = lua_tothread(L, lua_upvalueindex(1)); - int r = auxresume(L, co, lua_gettop(L)); - if (r < 0) { - if (lua_isstring(L, -1)) { /* error object is a string? */ - luaL_where(L, 1); /* add extra info */ - lua_insert(L, -2); - lua_concat(L, 2); - } - return lua_error(L); /* propagate error */ - } - return r; -} - - -static int luaB_cocreate (lua_State *L) { - lua_State *NL; - luaL_checktype(L, 1, LUA_TFUNCTION); - NL = lua_newthread(L); - lua_pushvalue(L, 1); /* move function to top */ - lua_xmove(L, NL, 1); /* move function from L to NL */ - return 1; -} - - -static int luaB_cowrap (lua_State *L) { - luaB_cocreate(L); - lua_pushcclosure(L, luaB_auxwrap, 1); - return 1; -} - - -static int luaB_yield (lua_State *L) { - return lua_yield(L, lua_gettop(L)); -} - - -static int luaB_costatus (lua_State *L) { - lua_State *co = getco(L); - if (L == co) lua_pushliteral(L, "running"); - else { - switch (lua_status(co)) { - case LUA_YIELD: - lua_pushliteral(L, "suspended"); - break; - case LUA_OK: { - lua_Debug ar; - if (lua_getstack(co, 0, &ar) > 0) /* does it have frames? */ - lua_pushliteral(L, "normal"); /* it is running */ - else if (lua_gettop(co) == 0) - lua_pushliteral(L, "dead"); - else - lua_pushliteral(L, "suspended"); /* initial state */ - break; - } - default: /* some error occurred */ - lua_pushliteral(L, "dead"); - break; - } - } - return 1; -} - - -static int luaB_yieldable (lua_State *L) { - lua_pushboolean(L, lua_isyieldable(L)); - return 1; -} - - -static int luaB_corunning (lua_State *L) { - int ismain = lua_pushthread(L); - lua_pushboolean(L, ismain); - return 2; -} - - -static const luaL_Reg co_funcs[] = { - {"create", luaB_cocreate}, - {"resume", luaB_coresume}, - {"running", luaB_corunning}, - {"status", luaB_costatus}, - {"wrap", luaB_cowrap}, - {"yield", luaB_yield}, - {"isyieldable", luaB_yieldable}, - {NULL, NULL} -}; - - - -LUAMOD_API int luaopen_coroutine (lua_State *L) { - luaL_newlib(L, co_funcs); - return 1; -} - diff --git a/external/mit/lua/dist/src/lctype.c b/external/mit/lua/dist/src/lctype.c deleted file mode 100644 index 24860424c..000000000 --- a/external/mit/lua/dist/src/lctype.c +++ /dev/null @@ -1,59 +0,0 @@ -/* $NetBSD: lctype.c,v 1.2 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lctype.c,v 1.12 2014/11/02 19:19:04 roberto Exp -** 'ctype' functions for Lua -** See Copyright Notice in lua.h -*/ - -#define lctype_c -#define LUA_CORE - -#include "lprefix.h" - - -#include "lctype.h" - -#if !LUA_USE_CTYPE /* { */ - -#ifndef _KERNEL -#include -#endif - -LUAI_DDEF const lu_byte luai_ctype_[UCHAR_MAX + 2] = { - 0x00, /* EOZ */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0. */ - 0x00, 0x08, 0x08, 0x08, 0x08, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 1. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, /* 2. */ - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, 0x16, /* 3. */ - 0x16, 0x16, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 4. */ - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 5. */ - 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x05, - 0x04, 0x15, 0x15, 0x15, 0x15, 0x15, 0x15, 0x05, /* 6. */ - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, /* 7. */ - 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 8. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 9. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* a. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* b. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* c. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* d. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* e. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* f. */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -}; - -#endif /* } */ diff --git a/external/mit/lua/dist/src/lctype.h b/external/mit/lua/dist/src/lctype.h deleted file mode 100644 index 1538c5e80..000000000 --- a/external/mit/lua/dist/src/lctype.h +++ /dev/null @@ -1,99 +0,0 @@ -/* $NetBSD: lctype.h,v 1.2 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lctype.h,v 1.12 2011/07/15 12:50:29 roberto Exp -** 'ctype' functions for Lua -** See Copyright Notice in lua.h -*/ - -#ifndef lctype_h -#define lctype_h - -#include "lua.h" - - -/* -** WARNING: the functions defined here do not necessarily correspond -** to the similar functions in the standard C ctype.h. They are -** optimized for the specific needs of Lua -*/ - -#if !defined(LUA_USE_CTYPE) - -#if 'A' == 65 && '0' == 48 -/* ASCII case: can use its own tables; faster and fixed */ -#define LUA_USE_CTYPE 0 -#else -/* must use standard C ctype */ -#define LUA_USE_CTYPE 1 -#endif - -#endif - - -#if !LUA_USE_CTYPE /* { */ - -#ifndef _KERNEL -#include -#endif - -#include "llimits.h" - - -#define ALPHABIT 0 -#define DIGITBIT 1 -#define PRINTBIT 2 -#define SPACEBIT 3 -#define XDIGITBIT 4 - - -#define MASK(B) (1 << (B)) - - -/* -** add 1 to char to allow index -1 (EOZ) -*/ -#define testprop(c,p) (luai_ctype_[(c)+1] & (p)) - -/* -** 'lalpha' (Lua alphabetic) and 'lalnum' (Lua alphanumeric) both include '_' -*/ -#define lislalpha(c) testprop(c, MASK(ALPHABIT)) -#define lislalnum(c) testprop(c, (MASK(ALPHABIT) | MASK(DIGITBIT))) -#define lisdigit(c) testprop(c, MASK(DIGITBIT)) -#define lisspace(c) testprop(c, MASK(SPACEBIT)) -#define lisprint(c) testprop(c, MASK(PRINTBIT)) -#define lisxdigit(c) testprop(c, MASK(XDIGITBIT)) - -/* -** this 'ltolower' only works for alphabetic characters -*/ -#define ltolower(c) ((c) | ('A' ^ 'a')) - - -/* two more entries for 0 and -1 (EOZ) */ -LUAI_DDEC const lu_byte luai_ctype_[UCHAR_MAX + 2]; - - -#else /* }{ */ - -/* -** use standard C ctypes -*/ - -#include - - -#define lislalpha(c) (isalpha(c) || (c) == '_') -#define lislalnum(c) (isalnum(c) || (c) == '_') -#define lisdigit(c) (isdigit(c)) -#define lisspace(c) (isspace(c)) -#define lisprint(c) (isprint(c)) -#define lisxdigit(c) (isxdigit(c)) - -#define ltolower(c) (tolower(c)) - -#endif /* } */ - -#endif - diff --git a/external/mit/lua/dist/src/ldblib.c b/external/mit/lua/dist/src/ldblib.c deleted file mode 100644 index 4506d1613..000000000 --- a/external/mit/lua/dist/src/ldblib.c +++ /dev/null @@ -1,464 +0,0 @@ -/* $NetBSD: ldblib.c,v 1.6 2015/10/08 12:40:05 mbalmer Exp $ */ - -/* -** Id: ldblib.c,v 1.149 2015/02/19 17:06:21 roberto Exp -** Interface from Lua to its debug API -** See Copyright Notice in lua.h -*/ - -#define ldblib_c -#define LUA_LIB - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#include -#endif - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** The hook table at registry[&HOOKKEY] maps threads to their current -** hook function. (We only need the unique address of 'HOOKKEY'.) -*/ -static const int HOOKKEY = 0; - - -/* -** If L1 != L, L1 can be in any state, and therefore there is no -** garanties about its stack space; any push in L1 must be -** checked. -*/ -static void checkstack (lua_State *L, lua_State *L1, int n) { - if (L != L1 && !lua_checkstack(L1, n)) - luaL_error(L, "stack overflow"); -} - - -static int db_getregistry (lua_State *L) { - lua_pushvalue(L, LUA_REGISTRYINDEX); - return 1; -} - - -static int db_getmetatable (lua_State *L) { - luaL_checkany(L, 1); - if (!lua_getmetatable(L, 1)) { - lua_pushnil(L); /* no metatable */ - } - return 1; -} - - -static int db_setmetatable (lua_State *L) { - int t = lua_type(L, 2); - luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, - "nil or table expected"); - lua_settop(L, 2); - lua_setmetatable(L, 1); - return 1; /* return 1st argument */ -} - - -static int db_getuservalue (lua_State *L) { - if (lua_type(L, 1) != LUA_TUSERDATA) - lua_pushnil(L); - else - lua_getuservalue(L, 1); - return 1; -} - - -static int db_setuservalue (lua_State *L) { - luaL_checktype(L, 1, LUA_TUSERDATA); - luaL_checkany(L, 2); - lua_settop(L, 2); - lua_setuservalue(L, 1); - return 1; -} - - -/* -** Auxiliary function used by several library functions: check for -** an optional thread as function's first argument and set 'arg' with -** 1 if this argument is present (so that functions can skip it to -** access their other arguments) -*/ -static lua_State *getthread (lua_State *L, int *arg) { - if (lua_isthread(L, 1)) { - *arg = 1; - return lua_tothread(L, 1); - } - else { - *arg = 0; - return L; /* function will operate over current thread */ - } -} - - -/* -** Variations of 'lua_settable', used by 'db_getinfo' to put results -** from 'lua_getinfo' into result table. Key is always a string; -** value can be a string, an int, or a boolean. -*/ -static void settabss (lua_State *L, const char *k, const char *v) { - lua_pushstring(L, v); - lua_setfield(L, -2, k); -} - -static void settabsi (lua_State *L, const char *k, int v) { - lua_pushinteger(L, v); - lua_setfield(L, -2, k); -} - -static void settabsb (lua_State *L, const char *k, int v) { - lua_pushboolean(L, v); - lua_setfield(L, -2, k); -} - - -/* -** In function 'db_getinfo', the call to 'lua_getinfo' may push -** results on the stack; later it creates the result table to put -** these objects. Function 'treatstackoption' puts the result from -** 'lua_getinfo' on top of the result table so that it can call -** 'lua_setfield'. -*/ -static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { - if (L == L1) - lua_rotate(L, -2, 1); /* exchange object and table */ - else - lua_xmove(L1, L, 1); /* move object to the "main" stack */ - lua_setfield(L, -2, fname); /* put object into table */ -} - - -/* -** Calls 'lua_getinfo' and collects all results in a new table. -** L1 needs stack space for an optional input (function) plus -** two optional outputs (function and line table) from function -** 'lua_getinfo'. -*/ -static int db_getinfo (lua_State *L) { - lua_Debug ar; - int arg; - lua_State *L1 = getthread(L, &arg); - const char *options = luaL_optstring(L, arg+2, "flnStu"); - checkstack(L, L1, 3); - if (lua_isfunction(L, arg + 1)) { /* info about a function? */ - options = lua_pushfstring(L, ">%s", options); /* add '>' to 'options' */ - lua_pushvalue(L, arg + 1); /* move function to 'L1' stack */ - lua_xmove(L, L1, 1); - } - else { /* stack level */ - if (!lua_getstack(L1, (int)luaL_checkinteger(L, arg + 1), &ar)) { - lua_pushnil(L); /* level out of range */ - return 1; - } - } - if (!lua_getinfo(L1, options, &ar)) - return luaL_argerror(L, arg+2, "invalid option"); - lua_newtable(L); /* table to collect results */ - if (strchr(options, 'S')) { - settabss(L, "source", ar.source); - settabss(L, "short_src", ar.short_src); - settabsi(L, "linedefined", ar.linedefined); - settabsi(L, "lastlinedefined", ar.lastlinedefined); - settabss(L, "what", ar.what); - } - if (strchr(options, 'l')) - settabsi(L, "currentline", ar.currentline); - if (strchr(options, 'u')) { - settabsi(L, "nups", ar.nups); - settabsi(L, "nparams", ar.nparams); - settabsb(L, "isvararg", ar.isvararg); - } - if (strchr(options, 'n')) { - settabss(L, "name", ar.name); - settabss(L, "namewhat", ar.namewhat); - } - if (strchr(options, 't')) - settabsb(L, "istailcall", ar.istailcall); - if (strchr(options, 'L')) - treatstackoption(L, L1, "activelines"); - if (strchr(options, 'f')) - treatstackoption(L, L1, "func"); - return 1; /* return table */ -} - - -static int db_getlocal (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - lua_Debug ar; - const char *name; - int nvar = (int)luaL_checkinteger(L, arg + 2); /* local-variable index */ - if (lua_isfunction(L, arg + 1)) { /* function argument? */ - lua_pushvalue(L, arg + 1); /* push function */ - lua_pushstring(L, lua_getlocal(L, NULL, nvar)); /* push local name */ - return 1; /* return only name (there is no value) */ - } - else { /* stack-level argument */ - int level = (int)luaL_checkinteger(L, arg + 1); - if (!lua_getstack(L1, level, &ar)) /* out of range? */ - return luaL_argerror(L, arg+1, "level out of range"); - checkstack(L, L1, 1); - name = lua_getlocal(L1, &ar, nvar); - if (name) { - lua_xmove(L1, L, 1); /* move local value */ - lua_pushstring(L, name); /* push name */ - lua_rotate(L, -2, 1); /* re-order */ - return 2; - } - else { - lua_pushnil(L); /* no name (nor value) */ - return 1; - } - } -} - - -static int db_setlocal (lua_State *L) { - int arg; - const char *name; - lua_State *L1 = getthread(L, &arg); - lua_Debug ar; - int level = (int)luaL_checkinteger(L, arg + 1); - int nvar = (int)luaL_checkinteger(L, arg + 2); - if (!lua_getstack(L1, level, &ar)) /* out of range? */ - return luaL_argerror(L, arg+1, "level out of range"); - luaL_checkany(L, arg+3); - lua_settop(L, arg+3); - checkstack(L, L1, 1); - lua_xmove(L, L1, 1); - name = lua_setlocal(L1, &ar, nvar); - if (name == NULL) - lua_pop(L1, 1); /* pop value (if not popped by 'lua_setlocal') */ - lua_pushstring(L, name); - return 1; -} - - -/* -** get (if 'get' is true) or set an upvalue from a closure -*/ -static int auxupvalue (lua_State *L, int get) { - const char *name; - int n = (int)luaL_checkinteger(L, 2); /* upvalue index */ - luaL_checktype(L, 1, LUA_TFUNCTION); /* closure */ - name = get ? lua_getupvalue(L, 1, n) : lua_setupvalue(L, 1, n); - if (name == NULL) return 0; - lua_pushstring(L, name); - lua_insert(L, -(get+1)); /* no-op if get is false */ - return get + 1; -} - - -static int db_getupvalue (lua_State *L) { - return auxupvalue(L, 1); -} - - -static int db_setupvalue (lua_State *L) { - luaL_checkany(L, 3); - return auxupvalue(L, 0); -} - - -/* -** Check whether a given upvalue from a given closure exists and -** returns its index -*/ -static int checkupval (lua_State *L, int argf, int argnup) { - int nup = (int)luaL_checkinteger(L, argnup); /* upvalue index */ - luaL_checktype(L, argf, LUA_TFUNCTION); /* closure */ - luaL_argcheck(L, (lua_getupvalue(L, argf, nup) != NULL), argnup, - "invalid upvalue index"); - return nup; -} - - -static int db_upvalueid (lua_State *L) { - int n = checkupval(L, 1, 2); - lua_pushlightuserdata(L, lua_upvalueid(L, 1, n)); - return 1; -} - - -static int db_upvaluejoin (lua_State *L) { - int n1 = checkupval(L, 1, 2); - int n2 = checkupval(L, 3, 4); - luaL_argcheck(L, !lua_iscfunction(L, 1), 1, "Lua function expected"); - luaL_argcheck(L, !lua_iscfunction(L, 3), 3, "Lua function expected"); - lua_upvaluejoin(L, 1, n1, 3, n2); - return 0; -} - - -/* -** Call hook function registered at hook table for the current -** thread (if there is one) -*/ -static void hookf (lua_State *L, lua_Debug *ar) { - static const char *const hooknames[] = - {"call", "return", "line", "count", "tail call"}; - lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); - lua_pushthread(L); - if (lua_rawget(L, -2) == LUA_TFUNCTION) { /* is there a hook function? */ - lua_pushstring(L, hooknames[(int)ar->event]); /* push event name */ - if (ar->currentline >= 0) - lua_pushinteger(L, ar->currentline); /* push current line */ - else lua_pushnil(L); - lua_assert(lua_getinfo(L, "lS", ar)); - lua_call(L, 2, 0); /* call hook function */ - } -} - - -/* -** Convert a string mask (for 'sethook') into a bit mask -*/ -static int makemask (const char *smask, int count) { - int mask = 0; - if (strchr(smask, 'c')) mask |= LUA_MASKCALL; - if (strchr(smask, 'r')) mask |= LUA_MASKRET; - if (strchr(smask, 'l')) mask |= LUA_MASKLINE; - if (count > 0) mask |= LUA_MASKCOUNT; - return mask; -} - - -/* -** Convert a bit mask (for 'gethook') into a string mask -*/ -static char *unmakemask (int mask, char *smask) { - int i = 0; - if (mask & LUA_MASKCALL) smask[i++] = 'c'; - if (mask & LUA_MASKRET) smask[i++] = 'r'; - if (mask & LUA_MASKLINE) smask[i++] = 'l'; - smask[i] = '\0'; - return smask; -} - - -static int db_sethook (lua_State *L) { - int arg, mask, count; - lua_Hook func; - lua_State *L1 = getthread(L, &arg); - if (lua_isnoneornil(L, arg+1)) { /* no hook? */ - lua_settop(L, arg+1); - func = NULL; mask = 0; count = 0; /* turn off hooks */ - } - else { - const char *smask = luaL_checkstring(L, arg+2); - luaL_checktype(L, arg+1, LUA_TFUNCTION); - count = (int)luaL_optinteger(L, arg + 3, 0); - func = hookf; mask = makemask(smask, count); - } - if (lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY) == LUA_TNIL) { - lua_createtable(L, 0, 2); /* create a hook table */ - lua_pushvalue(L, -1); - lua_rawsetp(L, LUA_REGISTRYINDEX, &HOOKKEY); /* set it in position */ - lua_pushstring(L, "k"); - lua_setfield(L, -2, "__mode"); /** hooktable.__mode = "k" */ - lua_pushvalue(L, -1); - lua_setmetatable(L, -2); /* setmetatable(hooktable) = hooktable */ - } - checkstack(L, L1, 1); - lua_pushthread(L1); lua_xmove(L1, L, 1); /* key (thread) */ - lua_pushvalue(L, arg + 1); /* value (hook function) */ - lua_rawset(L, -3); /* hooktable[L1] = new Lua hook */ - lua_sethook(L1, func, mask, count); - return 0; -} - - -static int db_gethook (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - char buff[5]; - int mask = lua_gethookmask(L1); - lua_Hook hook = lua_gethook(L1); - if (hook == NULL) /* no hook? */ - lua_pushnil(L); - else if (hook != hookf) /* external hook? */ - lua_pushliteral(L, "external hook"); - else { /* hook table must exist */ - lua_rawgetp(L, LUA_REGISTRYINDEX, &HOOKKEY); - checkstack(L, L1, 1); - lua_pushthread(L1); lua_xmove(L1, L, 1); - lua_rawget(L, -2); /* 1st result = hooktable[L1] */ - lua_remove(L, -2); /* remove hook table */ - } - lua_pushstring(L, unmakemask(mask, buff)); /* 2nd result = mask */ - lua_pushinteger(L, lua_gethookcount(L1)); /* 3rd result = count */ - return 3; -} - - -#ifndef _KERNEL -static int db_debug (lua_State *L) { - for (;;) { - char buffer[250]; - lua_writestringerror("%s", "lua_debug> "); - if (fgets(buffer, sizeof(buffer), stdin) == 0 || - strcmp(buffer, "cont\n") == 0) - return 0; - if (luaL_loadbuffer(L, buffer, strlen(buffer), "=(debug command)") || - lua_pcall(L, 0, 0, 0)) - lua_writestringerror("%s\n", lua_tostring(L, -1)); - lua_settop(L, 0); /* remove eventual returns */ - } -} -#endif - - -static int db_traceback (lua_State *L) { - int arg; - lua_State *L1 = getthread(L, &arg); - const char *msg = lua_tostring(L, arg + 1); - if (msg == NULL && !lua_isnoneornil(L, arg + 1)) /* non-string 'msg'? */ - lua_pushvalue(L, arg + 1); /* return it untouched */ - else { - int level = (int)luaL_optinteger(L, arg + 2, (L == L1) ? 1 : 0); - luaL_traceback(L, L1, msg, level); - } - return 1; -} - - -static const luaL_Reg dblib[] = { -#ifndef _KERNEL - {"debug", db_debug}, -#endif - {"getuservalue", db_getuservalue}, - {"gethook", db_gethook}, - {"getinfo", db_getinfo}, - {"getlocal", db_getlocal}, - {"getregistry", db_getregistry}, - {"getmetatable", db_getmetatable}, - {"getupvalue", db_getupvalue}, - {"upvaluejoin", db_upvaluejoin}, - {"upvalueid", db_upvalueid}, - {"setuservalue", db_setuservalue}, - {"sethook", db_sethook}, - {"setlocal", db_setlocal}, - {"setmetatable", db_setmetatable}, - {"setupvalue", db_setupvalue}, - {"traceback", db_traceback}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_debug (lua_State *L) { - luaL_newlib(L, dblib); - return 1; -} - diff --git a/external/mit/lua/dist/src/ldebug.c b/external/mit/lua/dist/src/ldebug.c deleted file mode 100644 index 610bc525f..000000000 --- a/external/mit/lua/dist/src/ldebug.c +++ /dev/null @@ -1,679 +0,0 @@ -/* $NetBSD: ldebug.c,v 1.5 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: ldebug.c,v 2.115 2015/05/22 17:45:56 roberto Exp -** Debug Interface -** See Copyright Notice in lua.h -*/ - -#define ldebug_c -#define LUA_CORE - -#include "lprefix.h" - - -#include -#ifndef _KERNEL -#include -#include -#endif - -#include "lua.h" - -#include "lapi.h" -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - - -#define noLuaClosure(f) ((f) == NULL || (f)->c.tt == LUA_TCCL) - - -/* Active Lua function (given call info) */ -#define ci_func(ci) (clLvalue((ci)->func)) - - -static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); - - -static int currentpc (CallInfo *ci) { - lua_assert(isLua(ci)); - return pcRel(ci->u.l.savedpc, ci_func(ci)->p); -} - - -static int currentline (CallInfo *ci) { - return getfuncline(ci_func(ci)->p, currentpc(ci)); -} - - -/* -** If function yielded, its 'func' can be in the 'extra' field. The -** next function restores 'func' to its correct value for debugging -** purposes. (It exchanges 'func' and 'extra'; so, when called again, -** after debugging, it also "re-restores" ** 'func' to its altered value. -*/ -static void swapextra (lua_State *L) { - if (L->status == LUA_YIELD) { - CallInfo *ci = L->ci; /* get function that yielded */ - StkId temp = ci->func; /* exchange its 'func' and 'extra' values */ - ci->func = restorestack(L, ci->extra); - ci->extra = savestack(L, temp); - } -} - - -/* -** this function can be called asynchronous (e.g. during a signal) -*/ -LUA_API void lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { - if (func == NULL || mask == 0) { /* turn off hooks? */ - mask = 0; - func = NULL; - } - if (isLua(L->ci)) - L->oldpc = L->ci->u.l.savedpc; - L->hook = func; - L->basehookcount = count; - resethookcount(L); - L->hookmask = cast_byte(mask); -} - - -LUA_API lua_Hook lua_gethook (lua_State *L) { - return L->hook; -} - - -LUA_API int lua_gethookmask (lua_State *L) { - return L->hookmask; -} - - -LUA_API int lua_gethookcount (lua_State *L) { - return L->basehookcount; -} - - -LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { - int status; - CallInfo *ci; - if (level < 0) return 0; /* invalid (negative) level */ - lua_lock(L); - for (ci = L->ci; level > 0 && ci != &L->base_ci; ci = ci->previous) - level--; - if (level == 0 && ci != &L->base_ci) { /* level found? */ - status = 1; - ar->i_ci = ci; - } - else status = 0; /* no such level */ - lua_unlock(L); - return status; -} - - -static const char *upvalname (Proto *p, int uv) { - TString *s = check_exp(uv < p->sizeupvalues, p->upvalues[uv].name); - if (s == NULL) return "?"; - else return getstr(s); -} - - -static const char *findvararg (CallInfo *ci, int n, StkId *pos) { - int nparams = clLvalue(ci->func)->p->numparams; - if (n >= cast_int(ci->u.l.base - ci->func) - nparams) - return NULL; /* no such vararg */ - else { - *pos = ci->func + nparams + n; - return "(*vararg)"; /* generic name for any vararg */ - } -} - - -static const char *findlocal (lua_State *L, CallInfo *ci, int n, - StkId *pos) { - const char *name = NULL; - StkId base; - if (isLua(ci)) { - if (n < 0) /* access to vararg values? */ - return findvararg(ci, -n, pos); - else { - base = ci->u.l.base; - name = luaF_getlocalname(ci_func(ci)->p, n, currentpc(ci)); - } - } - else - base = ci->func + 1; - if (name == NULL) { /* no 'standard' name? */ - StkId limit = (ci == L->ci) ? L->top : ci->next->func; - if (limit - base >= n && n > 0) /* is 'n' inside 'ci' stack? */ - name = "(*temporary)"; /* generic name for any valid slot */ - else - return NULL; /* no name */ - } - *pos = base + (n - 1); - return name; -} - - -LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { - const char *name; - lua_lock(L); - swapextra(L); - if (ar == NULL) { /* information about non-active function? */ - if (!isLfunction(L->top - 1)) /* not a Lua function? */ - name = NULL; - else /* consider live variables at function start (parameters) */ - name = luaF_getlocalname(clLvalue(L->top - 1)->p, n, 0); - } - else { /* active function; get information through 'ar' */ - StkId pos = NULL; /* to avoid warnings */ - name = findlocal(L, ar->i_ci, n, &pos); - if (name) { - setobj2s(L, L->top, pos); - api_incr_top(L); - } - } - swapextra(L); - lua_unlock(L); - return name; -} - - -LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { - StkId pos = NULL; /* to avoid warnings */ - const char *name; - lua_lock(L); - swapextra(L); - name = findlocal(L, ar->i_ci, n, &pos); - if (name) { - setobjs2s(L, pos, L->top - 1); - L->top--; /* pop value */ - } - swapextra(L); - lua_unlock(L); - return name; -} - - -static void funcinfo (lua_Debug *ar, Closure *cl) { - if (noLuaClosure(cl)) { - ar->source = "=[C]"; - ar->linedefined = -1; - ar->lastlinedefined = -1; - ar->what = "C"; - } - else { - Proto *p = cl->l.p; - ar->source = p->source ? getstr(p->source) : "=?"; - ar->linedefined = p->linedefined; - ar->lastlinedefined = p->lastlinedefined; - ar->what = (ar->linedefined == 0) ? "main" : "Lua"; - } - luaO_chunkid(ar->short_src, ar->source, LUA_IDSIZE); -} - - -static void collectvalidlines (lua_State *L, Closure *f) { - if (noLuaClosure(f)) { - setnilvalue(L->top); - api_incr_top(L); - } - else { - int i; - TValue v; - int *lineinfo = f->l.p->lineinfo; - Table *t = luaH_new(L); /* new table to store active lines */ - sethvalue(L, L->top, t); /* push it on stack */ - api_incr_top(L); - setbvalue(&v, 1); /* boolean 'true' to be the value of all indices */ - for (i = 0; i < f->l.p->sizelineinfo; i++) /* for all lines with code */ - luaH_setint(L, t, lineinfo[i], &v); /* table[line] = true */ - } -} - - -static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, - Closure *f, CallInfo *ci) { - int status = 1; - for (; *what; what++) { - switch (*what) { - case 'S': { - funcinfo(ar, f); - break; - } - case 'l': { - ar->currentline = (ci && isLua(ci)) ? currentline(ci) : -1; - break; - } - case 'u': { - ar->nups = (f == NULL) ? 0 : f->c.nupvalues; - if (noLuaClosure(f)) { - ar->isvararg = 1; - ar->nparams = 0; - } - else { - ar->isvararg = f->l.p->is_vararg; - ar->nparams = f->l.p->numparams; - } - break; - } - case 't': { - ar->istailcall = (ci) ? ci->callstatus & CIST_TAIL : 0; - break; - } - case 'n': { - /* calling function is a known Lua function? */ - if (ci && !(ci->callstatus & CIST_TAIL) && isLua(ci->previous)) - ar->namewhat = getfuncname(L, ci->previous, &ar->name); - else - ar->namewhat = NULL; - if (ar->namewhat == NULL) { - ar->namewhat = ""; /* not found */ - ar->name = NULL; - } - break; - } - case 'L': - case 'f': /* handled by lua_getinfo */ - break; - default: status = 0; /* invalid option */ - } - } - return status; -} - - -LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { - int status; - Closure *cl; - CallInfo *ci; - StkId func; - lua_lock(L); - swapextra(L); - if (*what == '>') { - ci = NULL; - func = L->top - 1; - api_check(L, ttisfunction(func), "function expected"); - what++; /* skip the '>' */ - L->top--; /* pop function */ - } - else { - ci = ar->i_ci; - func = ci->func; - lua_assert(ttisfunction(ci->func)); - } - cl = ttisclosure(func) ? clvalue(func) : NULL; - status = auxgetinfo(L, what, ar, cl, ci); - if (strchr(what, 'f')) { - setobjs2s(L, L->top, func); - api_incr_top(L); - } - swapextra(L); /* correct before option 'L', which can raise a mem. error */ - if (strchr(what, 'L')) - collectvalidlines(L, cl); - lua_unlock(L); - return status; -} - - -/* -** {====================================================== -** Symbolic Execution -** ======================================================= -*/ - -static const char *getobjname (Proto *p, int lastpc, int reg, - const char **name); - - -/* -** find a "name" for the RK value 'c' -*/ -static void kname (Proto *p, int pc, int c, const char **name) { - if (ISK(c)) { /* is 'c' a constant? */ - TValue *kvalue = &p->k[INDEXK(c)]; - if (ttisstring(kvalue)) { /* literal constant? */ - *name = svalue(kvalue); /* it is its own name */ - return; - } - /* else no reasonable name found */ - } - else { /* 'c' is a register */ - const char *what = getobjname(p, pc, c, name); /* search for 'c' */ - if (what && *what == 'c') { /* found a constant name? */ - return; /* 'name' already filled */ - } - /* else no reasonable name found */ - } - *name = "?"; /* no reasonable name found */ -} - - -static int filterpc (int pc, int jmptarget) { - if (pc < jmptarget) /* is code conditional (inside a jump)? */ - return -1; /* cannot know who sets that register */ - else return pc; /* current position sets that register */ -} - - -/* -** try to find last instruction before 'lastpc' that modified register 'reg' -*/ -static int findsetreg (Proto *p, int lastpc, int reg) { - int pc; - int setreg = -1; /* keep last instruction that changed 'reg' */ - int jmptarget = 0; /* any code before this address is conditional */ - for (pc = 0; pc < lastpc; pc++) { - Instruction i = p->code[pc]; - OpCode op = GET_OPCODE(i); - int a = GETARG_A(i); - switch (op) { - case OP_LOADNIL: { - int b = GETARG_B(i); - if (a <= reg && reg <= a + b) /* set registers from 'a' to 'a+b' */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_TFORCALL: { - if (reg >= a + 2) /* affect all regs above its base */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_CALL: - case OP_TAILCALL: { - if (reg >= a) /* affect all registers above base */ - setreg = filterpc(pc, jmptarget); - break; - } - case OP_JMP: { - int b = GETARG_sBx(i); - int dest = pc + 1 + b; - /* jump is forward and do not skip 'lastpc'? */ - if (pc < dest && dest <= lastpc) { - if (dest > jmptarget) - jmptarget = dest; /* update 'jmptarget' */ - } - break; - } - default: - if (testAMode(op) && reg == a) /* any instruction that set A */ - setreg = filterpc(pc, jmptarget); - break; - } - } - return setreg; -} - - -static const char *getobjname (Proto *p, int lastpc, int reg, - const char **name) { - int pc; - *name = luaF_getlocalname(p, reg + 1, lastpc); - if (*name) /* is a local? */ - return "local"; - /* else try symbolic execution */ - pc = findsetreg(p, lastpc, reg); - if (pc != -1) { /* could find instruction? */ - Instruction i = p->code[pc]; - OpCode op = GET_OPCODE(i); - switch (op) { - case OP_MOVE: { - int b = GETARG_B(i); /* move from 'b' to 'a' */ - if (b < GETARG_A(i)) - return getobjname(p, pc, b, name); /* get name for 'b' */ - break; - } - case OP_GETTABUP: - case OP_GETTABLE: { - int k = GETARG_C(i); /* key index */ - int t = GETARG_B(i); /* table index */ - const char *vn = (op == OP_GETTABLE) /* name of indexed variable */ - ? luaF_getlocalname(p, t + 1, pc) - : upvalname(p, t); - kname(p, pc, k, name); - return (vn && strcmp(vn, LUA_ENV) == 0) ? "global" : "field"; - } - case OP_GETUPVAL: { - *name = upvalname(p, GETARG_B(i)); - return "upvalue"; - } - case OP_LOADK: - case OP_LOADKX: { - int b = (op == OP_LOADK) ? GETARG_Bx(i) - : GETARG_Ax(p->code[pc + 1]); - if (ttisstring(&p->k[b])) { - *name = svalue(&p->k[b]); - return "constant"; - } - break; - } - case OP_SELF: { - int k = GETARG_C(i); /* key index */ - kname(p, pc, k, name); - return "method"; - } - default: break; /* go through to return NULL */ - } - } - return NULL; /* could not find reasonable name */ -} - - -static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { - TMS tm = (TMS)0; /* to avoid warnings */ - Proto *p = ci_func(ci)->p; /* calling function */ - int pc = currentpc(ci); /* calling instruction index */ - Instruction i = p->code[pc]; /* calling instruction */ - if (ci->callstatus & CIST_HOOKED) { /* was it called inside a hook? */ - *name = "?"; - return "hook"; - } - switch (GET_OPCODE(i)) { - case OP_CALL: - case OP_TAILCALL: /* get function name */ - return getobjname(p, pc, GETARG_A(i), name); - case OP_TFORCALL: { /* for iterator */ - *name = "for iterator"; - return "for iterator"; - } - /* all other instructions can call only through metamethods */ - case OP_SELF: case OP_GETTABUP: case OP_GETTABLE: - tm = TM_INDEX; - break; - case OP_SETTABUP: case OP_SETTABLE: - tm = TM_NEWINDEX; - break; - case OP_ADD: case OP_SUB: case OP_MUL: case OP_MOD: -#ifndef _KERNEL - case OP_POW: case OP_DIV: case OP_IDIV: case OP_BAND: -#else /* _KERNEL */ - case OP_IDIV: case OP_BAND: -#endif - case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: { - int offset = cast_int(GET_OPCODE(i)) - cast_int(OP_ADD); /* ORDER OP */ - tm = cast(TMS, offset + cast_int(TM_ADD)); /* ORDER TM */ - break; - } - case OP_UNM: tm = TM_UNM; break; - case OP_BNOT: tm = TM_BNOT; break; - case OP_LEN: tm = TM_LEN; break; - case OP_CONCAT: tm = TM_CONCAT; break; - case OP_EQ: tm = TM_EQ; break; - case OP_LT: tm = TM_LT; break; - case OP_LE: tm = TM_LE; break; - default: lua_assert(0); /* other instructions cannot call a function */ - } - *name = getstr(G(L)->tmname[tm]); - return "metamethod"; -} - -/* }====================================================== */ - - - -/* -** The subtraction of two potentially unrelated pointers is -** not ISO C, but it should not crash a program; the subsequent -** checks are ISO C and ensure a correct result. -*/ -static int isinstack (CallInfo *ci, const TValue *o) { - ptrdiff_t i = o - ci->u.l.base; - return (0 <= i && i < (ci->top - ci->u.l.base) && ci->u.l.base + i == o); -} - - -/* -** Checks whether value 'o' came from an upvalue. (That can only happen -** with instructions OP_GETTABUP/OP_SETTABUP, which operate directly on -** upvalues.) -*/ -static const char *getupvalname (CallInfo *ci, const TValue *o, - const char **name) { - LClosure *c = ci_func(ci); - int i; - for (i = 0; i < c->nupvalues; i++) { - if (c->upvals[i]->v == o) { - *name = upvalname(c->p, i); - return "upvalue"; - } - } - return NULL; -} - - -static const char *varinfo (lua_State *L, const TValue *o) { - const char *name = NULL; /* to avoid warnings */ - CallInfo *ci = L->ci; - const char *kind = NULL; - if (isLua(ci)) { - kind = getupvalname(ci, o, &name); /* check whether 'o' is an upvalue */ - if (!kind && isinstack(ci, o)) /* no? try a register */ - kind = getobjname(ci_func(ci)->p, currentpc(ci), - cast_int(o - ci->u.l.base), &name); - } - return (kind) ? luaO_pushfstring(L, " (%s '%s')", kind, name) : ""; -} - - -l_noret luaG_typeerror (lua_State *L, const TValue *o, const char *op) { - const char *t = objtypename(o); - luaG_runerror(L, "attempt to %s a %s value%s", op, t, varinfo(L, o)); -} - - -l_noret luaG_concaterror (lua_State *L, const TValue *p1, const TValue *p2) { - if (ttisstring(p1) || cvt2str(p1)) p1 = p2; - luaG_typeerror(L, p1, "concatenate"); -} - - -l_noret luaG_opinterror (lua_State *L, const TValue *p1, - const TValue *p2, const char *msg) { - lua_Number temp; - if (!tonumber(p1, &temp)) /* first operand is wrong? */ - p2 = p1; /* now second is wrong */ - luaG_typeerror(L, p2, msg); -} - - -/* -** Error when both values are convertible to numbers, but not to integers -*/ -l_noret luaG_tointerror (lua_State *L, const TValue *p1, const TValue *p2) { - lua_Integer temp; - if (!tointeger(p1, &temp)) - p2 = p1; - luaG_runerror(L, "number%s has no integer representation", varinfo(L, p2)); -} - - -l_noret luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { - const char *t1 = objtypename(p1); - const char *t2 = objtypename(p2); - if (t1 == t2) - luaG_runerror(L, "attempt to compare two %s values", t1); - else - luaG_runerror(L, "attempt to compare %s with %s", t1, t2); -} - - -/* add src:line information to 'msg' */ -const char *luaG_addinfo (lua_State *L, const char *msg, TString *src, - int line) { - char buff[LUA_IDSIZE]; - if (src) - luaO_chunkid(buff, getstr(src), LUA_IDSIZE); - else { /* no source available; use "?" instead */ - buff[0] = '?'; buff[1] = '\0'; - } - return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg); -} - - -l_noret luaG_errormsg (lua_State *L) { - if (L->errfunc != 0) { /* is there an error handling function? */ - StkId errfunc = restorestack(L, L->errfunc); - setobjs2s(L, L->top, L->top - 1); /* move argument */ - setobjs2s(L, L->top - 1, errfunc); /* push function */ - L->top++; /* assume EXTRA_STACK */ - luaD_call(L, L->top - 2, 1, 0); /* call it */ - } - luaD_throw(L, LUA_ERRRUN); -} - - -l_noret luaG_runerror (lua_State *L, const char *fmt, ...) { - CallInfo *ci = L->ci; - const char *msg; - va_list argp; - va_start(argp, fmt); - msg = luaO_pushvfstring(L, fmt, argp); /* format message */ - va_end(argp); - if (isLua(ci)) /* if Lua function, add source:line information */ - luaG_addinfo(L, msg, ci_func(ci)->p->source, currentline(ci)); - luaG_errormsg(L); -} - - -void luaG_traceexec (lua_State *L) { - CallInfo *ci = L->ci; - lu_byte mask = L->hookmask; - int counthook = ((mask & LUA_MASKCOUNT) && L->hookcount == 0); - if (counthook) - resethookcount(L); /* reset count */ - if (ci->callstatus & CIST_HOOKYIELD) { /* called hook last time? */ - ci->callstatus &= ~CIST_HOOKYIELD; /* erase mark */ - return; /* do not call hook again (VM yielded, so it did not move) */ - } - if (counthook) - luaD_hook(L, LUA_HOOKCOUNT, -1); /* call count hook */ - if (mask & LUA_MASKLINE) { - Proto *p = ci_func(ci)->p; - int npc = pcRel(ci->u.l.savedpc, p); - int newline = getfuncline(p, npc); - if (npc == 0 || /* call linehook when enter a new function, */ - ci->u.l.savedpc <= L->oldpc || /* when jump back (loop), or when */ - newline != getfuncline(p, pcRel(L->oldpc, p))) /* enter a new line */ - luaD_hook(L, LUA_HOOKLINE, newline); /* call line hook */ - } - L->oldpc = ci->u.l.savedpc; - if (L->status == LUA_YIELD) { /* did hook yield? */ - if (counthook) - L->hookcount = 1; /* undo decrement to zero */ - ci->u.l.savedpc--; /* undo increment (resume will increment it again) */ - ci->callstatus |= CIST_HOOKYIELD; /* mark that it yielded */ - ci->func = L->top - 1; /* protect stack below results */ - luaD_throw(L, LUA_YIELD); - } -} - diff --git a/external/mit/lua/dist/src/ldebug.h b/external/mit/lua/dist/src/ldebug.h deleted file mode 100644 index 50bac5ad6..000000000 --- a/external/mit/lua/dist/src/ldebug.h +++ /dev/null @@ -1,41 +0,0 @@ -/* $NetBSD: ldebug.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: ldebug.h,v 2.14 2015/05/22 17:45:56 roberto Exp -** Auxiliary functions from Debug Interface module -** See Copyright Notice in lua.h -*/ - -#ifndef ldebug_h -#define ldebug_h - - -#include "lstate.h" - - -#define pcRel(pc, p) (cast(int, (pc) - (p)->code) - 1) - -#define getfuncline(f,pc) (((f)->lineinfo) ? (f)->lineinfo[pc] : -1) - -#define resethookcount(L) (L->hookcount = L->basehookcount) - - -LUAI_FUNC l_noret luaG_typeerror (lua_State *L, const TValue *o, - const char *opname); -LUAI_FUNC l_noret luaG_concaterror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_opinterror (lua_State *L, const TValue *p1, - const TValue *p2, - const char *msg); -LUAI_FUNC l_noret luaG_tointerror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_ordererror (lua_State *L, const TValue *p1, - const TValue *p2); -LUAI_FUNC l_noret luaG_runerror (lua_State *L, const char *fmt, ...); -LUAI_FUNC const char *luaG_addinfo (lua_State *L, const char *msg, - TString *src, int line); -LUAI_FUNC l_noret luaG_errormsg (lua_State *L); -LUAI_FUNC void luaG_traceexec (lua_State *L); - - -#endif diff --git a/external/mit/lua/dist/src/ldo.c b/external/mit/lua/dist/src/ldo.c deleted file mode 100644 index 4d4d28c67..000000000 --- a/external/mit/lua/dist/src/ldo.c +++ /dev/null @@ -1,721 +0,0 @@ -/* $NetBSD: ldo.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: ldo.c,v 2.138 2015/05/22 17:48:19 roberto Exp -** Stack and Call structure of Lua -** See Copyright Notice in lua.h -*/ - -#define ldo_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#include -#endif - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lundump.h" -#include "lvm.h" -#include "lzio.h" - - - -#define errorstatus(s) ((s) > LUA_YIELD) - - -/* -** {====================================================== -** Error-recovery functions -** ======================================================= -*/ - -/* -** LUAI_THROW/LUAI_TRY define how Lua does exception handling. By -** default, Lua handles errors with exceptions when compiling as -** C++ code, with _longjmp/_setjmp when asked to use them, and with -** longjmp/setjmp otherwise. -*/ -#if !defined(LUAI_THROW) /* { */ - -#if defined(__cplusplus) && !defined(LUA_USE_LONGJMP) /* { */ - -/* C++ exceptions */ -#define LUAI_THROW(L,c) throw(c) -#define LUAI_TRY(L,c,a) \ - try { a } catch(...) { if ((c)->status == 0) (c)->status = -1; } -#define luai_jmpbuf int /* dummy variable */ - -#elif defined(LUA_USE_POSIX) /* }{ */ - -/* in POSIX, try _longjmp/_setjmp (more efficient) */ -#define LUAI_THROW(L,c) _longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (_setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#else /* }{ */ - -/* ISO C handling with long jumps */ -#define LUAI_THROW(L,c) longjmp((c)->b, 1) -#define LUAI_TRY(L,c,a) if (setjmp((c)->b) == 0) { a } -#define luai_jmpbuf jmp_buf - -#endif /* } */ - -#endif /* } */ - - - -/* chain list of long jump buffers */ -struct lua_longjmp { - struct lua_longjmp *previous; - luai_jmpbuf b; - volatile int status; /* error code */ -}; - - -static void seterrorobj (lua_State *L, int errcode, StkId oldtop) { - switch (errcode) { - case LUA_ERRMEM: { /* memory error? */ - setsvalue2s(L, oldtop, G(L)->memerrmsg); /* reuse preregistered msg. */ - break; - } - case LUA_ERRERR: { - setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); - break; - } - default: { - setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ - break; - } - } - L->top = oldtop + 1; -} - - -l_noret luaD_throw (lua_State *L, int errcode) { - if (L->errorJmp) { /* thread has an error handler? */ - L->errorJmp->status = errcode; /* set status */ - LUAI_THROW(L, L->errorJmp); /* jump to it */ - } - else { /* thread has no error handler */ - global_State *g = G(L); - L->status = cast_byte(errcode); /* mark it as dead */ - if (g->mainthread->errorJmp) { /* main thread has a handler? */ - setobjs2s(L, g->mainthread->top++, L->top - 1); /* copy error obj. */ - luaD_throw(g->mainthread, errcode); /* re-throw in main thread */ - } - else { /* no handler at all; abort */ - if (g->panic) { /* panic function? */ - seterrorobj(L, errcode, L->top); /* assume EXTRA_STACK */ - if (L->ci->top < L->top) - L->ci->top = L->top; /* pushing msg. can break this invariant */ - lua_unlock(L); - g->panic(L); /* call panic function (last chance to jump out) */ - } - abort(); - } - } -} - - -int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { - unsigned short oldnCcalls = L->nCcalls; - struct lua_longjmp lj; - lj.status = LUA_OK; - lj.previous = L->errorJmp; /* chain new error handler */ - L->errorJmp = &lj; - LUAI_TRY(L, &lj, - (*f)(L, ud); - ); - L->errorJmp = lj.previous; /* restore old error handler */ - L->nCcalls = oldnCcalls; - return lj.status; -} - -/* }====================================================== */ - - -static void correctstack (lua_State *L, TValue *oldstack) { - CallInfo *ci; - UpVal *up; - L->top = (L->top - oldstack) + L->stack; - for (up = L->openupval; up != NULL; up = up->u.open.next) - up->v = (up->v - oldstack) + L->stack; - for (ci = L->ci; ci != NULL; ci = ci->previous) { - ci->top = (ci->top - oldstack) + L->stack; - ci->func = (ci->func - oldstack) + L->stack; - if (isLua(ci)) - ci->u.l.base = (ci->u.l.base - oldstack) + L->stack; - } -} - - -/* some space for error handling */ -#define ERRORSTACKSIZE (LUAI_MAXSTACK + 200) - - -void luaD_reallocstack (lua_State *L, int newsize) { - TValue *oldstack = L->stack; - int lim = L->stacksize; - lua_assert(newsize <= LUAI_MAXSTACK || newsize == ERRORSTACKSIZE); - lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK); - luaM_reallocvector(L, L->stack, L->stacksize, newsize, TValue); - for (; lim < newsize; lim++) - setnilvalue(L->stack + lim); /* erase new segment */ - L->stacksize = newsize; - L->stack_last = L->stack + newsize - EXTRA_STACK; - correctstack(L, oldstack); -} - - -void luaD_growstack (lua_State *L, int n) { - int size = L->stacksize; - if (size > LUAI_MAXSTACK) /* error after extra size? */ - luaD_throw(L, LUA_ERRERR); - else { - int needed = cast_int(L->top - L->stack) + n + EXTRA_STACK; - int newsize = 2 * size; - if (newsize > LUAI_MAXSTACK) newsize = LUAI_MAXSTACK; - if (newsize < needed) newsize = needed; - if (newsize > LUAI_MAXSTACK) { /* stack overflow? */ - luaD_reallocstack(L, ERRORSTACKSIZE); - luaG_runerror(L, "stack overflow"); - } - else - luaD_reallocstack(L, newsize); - } -} - - -static int stackinuse (lua_State *L) { - CallInfo *ci; - StkId lim = L->top; - for (ci = L->ci; ci != NULL; ci = ci->previous) { - lua_assert(ci->top <= L->stack_last); - if (lim < ci->top) lim = ci->top; - } - return cast_int(lim - L->stack) + 1; /* part of stack in use */ -} - - -void luaD_shrinkstack (lua_State *L) { - int inuse = stackinuse(L); - int goodsize = inuse + (inuse / 8) + 2*EXTRA_STACK; - if (goodsize > LUAI_MAXSTACK) goodsize = LUAI_MAXSTACK; - if (L->stacksize > LUAI_MAXSTACK) /* was handling stack overflow? */ - luaE_freeCI(L); /* free all CIs (list grew because of an error) */ - else - luaE_shrinkCI(L); /* shrink list */ - if (inuse > LUAI_MAXSTACK || /* still handling stack overflow? */ - goodsize >= L->stacksize) /* would grow instead of shrink? */ - condmovestack(L); /* don't change stack (change only for debugging) */ - else - luaD_reallocstack(L, goodsize); /* shrink it */ -} - - -void luaD_hook (lua_State *L, int event, int line) { - lua_Hook hook = L->hook; - if (hook && L->allowhook) { - CallInfo *ci = L->ci; - ptrdiff_t top = savestack(L, L->top); - ptrdiff_t ci_top = savestack(L, ci->top); - lua_Debug ar; - ar.event = event; - ar.currentline = line; - ar.i_ci = ci; - luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ - ci->top = L->top + LUA_MINSTACK; - lua_assert(ci->top <= L->stack_last); - L->allowhook = 0; /* cannot call hooks inside a hook */ - ci->callstatus |= CIST_HOOKED; - lua_unlock(L); - (*hook)(L, &ar); - lua_lock(L); - lua_assert(!L->allowhook); - L->allowhook = 1; - ci->top = restorestack(L, ci_top); - L->top = restorestack(L, top); - ci->callstatus &= ~CIST_HOOKED; - } -} - - -static void callhook (lua_State *L, CallInfo *ci) { - int hook = LUA_HOOKCALL; - ci->u.l.savedpc++; /* hooks assume 'pc' is already incremented */ - if (isLua(ci->previous) && - GET_OPCODE(*(ci->previous->u.l.savedpc - 1)) == OP_TAILCALL) { - ci->callstatus |= CIST_TAIL; - hook = LUA_HOOKTAILCALL; - } - luaD_hook(L, hook, -1); - ci->u.l.savedpc--; /* correct 'pc' */ -} - - -static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { - int i; - int nfixargs = p->numparams; - StkId base, fixed; - lua_assert(actual >= nfixargs); - /* move fixed parameters to final position */ - luaD_checkstack(L, p->maxstacksize); /* check again for new 'base' */ - fixed = L->top - actual; /* first fixed argument */ - base = L->top; /* final position of first argument */ - for (i=0; itop++, fixed + i); - setnilvalue(fixed + i); - } - return base; -} - - -/* -** Check whether __call metafield of 'func' is a function. If so, put -** it in stack below original 'func' so that 'luaD_precall' can call -** it. Raise an error if __call metafield is not a function. -*/ -static void tryfuncTM (lua_State *L, StkId func) { - const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); - StkId p; - if (!ttisfunction(tm)) - luaG_typeerror(L, func, "call"); - /* Open a hole inside the stack at 'func' */ - for (p = L->top; p > func; p--) - setobjs2s(L, p, p-1); - L->top++; /* slot ensured by caller */ - setobj2s(L, func, tm); /* tag method is the new function to be called */ -} - - - -#define next_ci(L) (L->ci = (L->ci->next ? L->ci->next : luaE_extendCI(L))) - - -/* -** returns true if function has been executed (C function) -*/ -int luaD_precall (lua_State *L, StkId func, int nresults) { - lua_CFunction f; - CallInfo *ci; - int n; /* number of arguments (Lua) or returns (C) */ - ptrdiff_t funcr = savestack(L, func); - switch (ttype(func)) { - case LUA_TLCF: /* light C function */ - f = fvalue(func); - goto Cfunc; - case LUA_TCCL: { /* C closure */ - f = clCvalue(func)->f; - Cfunc: - luaC_checkGC(L); /* stack grow uses memory */ - luaD_checkstack(L, LUA_MINSTACK); /* ensure minimum stack size */ - ci = next_ci(L); /* now 'enter' new function */ - ci->nresults = nresults; - ci->func = restorestack(L, funcr); - ci->top = L->top + LUA_MINSTACK; - lua_assert(ci->top <= L->stack_last); - ci->callstatus = 0; - if (L->hookmask & LUA_MASKCALL) - luaD_hook(L, LUA_HOOKCALL, -1); - lua_unlock(L); - n = (*f)(L); /* do the actual call */ - lua_lock(L); - api_checknelems(L, n); - luaD_poscall(L, L->top - n, n); - return 1; - } - case LUA_TLCL: { /* Lua function: prepare its call */ - StkId base; - Proto *p = clLvalue(func)->p; - n = cast_int(L->top - func) - 1; /* number of real arguments */ - luaC_checkGC(L); /* stack grow uses memory */ - luaD_checkstack(L, p->maxstacksize); - for (; n < p->numparams; n++) - setnilvalue(L->top++); /* complete missing arguments */ - if (!p->is_vararg) { - func = restorestack(L, funcr); - base = func + 1; - } - else { - base = adjust_varargs(L, p, n); - func = restorestack(L, funcr); /* previous call can change stack */ - } - ci = next_ci(L); /* now 'enter' new function */ - ci->nresults = nresults; - ci->func = func; - ci->u.l.base = base; - ci->top = base + p->maxstacksize; - lua_assert(ci->top <= L->stack_last); - ci->u.l.savedpc = p->code; /* starting point */ - ci->callstatus = CIST_LUA; - L->top = ci->top; - if (L->hookmask & LUA_MASKCALL) - callhook(L, ci); - return 0; - } - default: { /* not a function */ - luaD_checkstack(L, 1); /* ensure space for metamethod */ - func = restorestack(L, funcr); /* previous call may change stack */ - tryfuncTM(L, func); /* try to get '__call' metamethod */ - return luaD_precall(L, func, nresults); /* now it must be a function */ - } - } -} - - -int luaD_poscall (lua_State *L, StkId firstResult, int nres) { - StkId res; - int wanted, i; - CallInfo *ci = L->ci; - if (L->hookmask & (LUA_MASKRET | LUA_MASKLINE)) { - if (L->hookmask & LUA_MASKRET) { - ptrdiff_t fr = savestack(L, firstResult); /* hook may change stack */ - luaD_hook(L, LUA_HOOKRET, -1); - firstResult = restorestack(L, fr); - } - L->oldpc = ci->previous->u.l.savedpc; /* 'oldpc' for caller function */ - } - res = ci->func; /* res == final position of 1st result */ - wanted = ci->nresults; - L->ci = ci->previous; /* back to caller */ - /* move results to correct place */ - for (i = wanted; i != 0 && nres-- > 0; i--) - setobjs2s(L, res++, firstResult++); - while (i-- > 0) - setnilvalue(res++); - L->top = res; - return (wanted - LUA_MULTRET); /* 0 iff wanted == LUA_MULTRET */ -} - - -/* -** Call a function (C or Lua). The function to be called is at *func. -** The arguments are on the stack, right after the function. -** When returns, all the results are on the stack, starting at the original -** function position. -*/ -void luaD_call (lua_State *L, StkId func, int nResults, int allowyield) { - if (++L->nCcalls >= LUAI_MAXCCALLS) { - if (L->nCcalls == LUAI_MAXCCALLS) - luaG_runerror(L, "C stack overflow"); - else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) - luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ - } - if (!allowyield) L->nny++; - if (!luaD_precall(L, func, nResults)) /* is a Lua function? */ - luaV_execute(L); /* call it */ - if (!allowyield) L->nny--; - L->nCcalls--; -} - - -/* -** Completes the execution of an interrupted C function, calling its -** continuation function. -*/ -static void finishCcall (lua_State *L, int status) { - CallInfo *ci = L->ci; - int n; - /* must have a continuation and must be able to call it */ - lua_assert(ci->u.c.k != NULL && L->nny == 0); - /* error status can only happen in a protected call */ - lua_assert((ci->callstatus & CIST_YPCALL) || status == LUA_YIELD); - if (ci->callstatus & CIST_YPCALL) { /* was inside a pcall? */ - ci->callstatus &= ~CIST_YPCALL; /* finish 'lua_pcall' */ - L->errfunc = ci->u.c.old_errfunc; - } - /* finish 'lua_callk'/'lua_pcall'; CIST_YPCALL and 'errfunc' already - handled */ - adjustresults(L, ci->nresults); - /* call continuation function */ - lua_unlock(L); - n = (*ci->u.c.k)(L, status, ci->u.c.ctx); - lua_lock(L); - api_checknelems(L, n); - /* finish 'luaD_precall' */ - luaD_poscall(L, L->top - n, n); -} - - -/* -** Executes "full continuation" (everything in the stack) of a -** previously interrupted coroutine until the stack is empty (or another -** interruption long-jumps out of the loop). If the coroutine is -** recovering from an error, 'ud' points to the error status, which must -** be passed to the first continuation function (otherwise the default -** status is LUA_YIELD). -*/ -static void unroll (lua_State *L, void *ud) { - if (ud != NULL) /* error status? */ - finishCcall(L, *(int *)ud); /* finish 'lua_pcallk' callee */ - while (L->ci != &L->base_ci) { /* something in the stack */ - if (!isLua(L->ci)) /* C function? */ - finishCcall(L, LUA_YIELD); /* complete its execution */ - else { /* Lua function */ - luaV_finishOp(L); /* finish interrupted instruction */ - luaV_execute(L); /* execute down to higher C 'boundary' */ - } - } -} - - -/* -** Try to find a suspended protected call (a "recover point") for the -** given thread. -*/ -static CallInfo *findpcall (lua_State *L) { - CallInfo *ci; - for (ci = L->ci; ci != NULL; ci = ci->previous) { /* search for a pcall */ - if (ci->callstatus & CIST_YPCALL) - return ci; - } - return NULL; /* no pending pcall */ -} - - -/* -** Recovers from an error in a coroutine. Finds a recover point (if -** there is one) and completes the execution of the interrupted -** 'luaD_pcall'. If there is no recover point, returns zero. -*/ -static int recover (lua_State *L, int status) { - StkId oldtop; - CallInfo *ci = findpcall(L); - if (ci == NULL) return 0; /* no recovery point */ - /* "finish" luaD_pcall */ - oldtop = restorestack(L, ci->extra); - luaF_close(L, oldtop); - seterrorobj(L, status, oldtop); - L->ci = ci; - L->allowhook = getoah(ci->callstatus); /* restore original 'allowhook' */ - L->nny = 0; /* should be zero to be yieldable */ - luaD_shrinkstack(L); - L->errfunc = ci->u.c.old_errfunc; - return 1; /* continue running the coroutine */ -} - - -/* -** signal an error in the call to 'resume', not in the execution of the -** coroutine itself. (Such errors should not be handled by any coroutine -** error handler and should not kill the coroutine.) -*/ -static l_noret resume_error (lua_State *L, const char *msg, StkId firstArg) { - L->top = firstArg; /* remove args from the stack */ - setsvalue2s(L, L->top, luaS_new(L, msg)); /* push error message */ - api_incr_top(L); - luaD_throw(L, -1); /* jump back to 'lua_resume' */ -} - - -/* -** Do the work for 'lua_resume' in protected mode. Most of the work -** depends on the status of the coroutine: initial state, suspended -** inside a hook, or regularly suspended (optionally with a continuation -** function), plus erroneous cases: non-suspended coroutine or dead -** coroutine. -*/ -static void resume (lua_State *L, void *ud) { - int nCcalls = L->nCcalls; - int n = *(cast(int*, ud)); /* number of arguments */ - StkId firstArg = L->top - n; /* first argument */ - CallInfo *ci = L->ci; - if (nCcalls >= LUAI_MAXCCALLS) - resume_error(L, "C stack overflow", firstArg); - if (L->status == LUA_OK) { /* may be starting a coroutine */ - if (ci != &L->base_ci) /* not in base level? */ - resume_error(L, "cannot resume non-suspended coroutine", firstArg); - /* coroutine is in base level; start running it */ - if (!luaD_precall(L, firstArg - 1, LUA_MULTRET)) /* Lua function? */ - luaV_execute(L); /* call it */ - } - else if (L->status != LUA_YIELD) - resume_error(L, "cannot resume dead coroutine", firstArg); - else { /* resuming from previous yield */ - L->status = LUA_OK; /* mark that it is running (again) */ - ci->func = restorestack(L, ci->extra); - if (isLua(ci)) /* yielded inside a hook? */ - luaV_execute(L); /* just continue running Lua code */ - else { /* 'common' yield */ - if (ci->u.c.k != NULL) { /* does it have a continuation function? */ - lua_unlock(L); - n = (*ci->u.c.k)(L, LUA_YIELD, ci->u.c.ctx); /* call continuation */ - lua_lock(L); - api_checknelems(L, n); - firstArg = L->top - n; /* yield results come from continuation */ - } - luaD_poscall(L, firstArg, n); /* finish 'luaD_precall' */ - } - unroll(L, NULL); /* run continuation */ - } - lua_assert(nCcalls == L->nCcalls); -} - - -LUA_API int lua_resume (lua_State *L, lua_State *from, int nargs) { - int status; - int oldnny = L->nny; /* save "number of non-yieldable" calls */ - lua_lock(L); - luai_userstateresume(L, nargs); - L->nCcalls = (from) ? from->nCcalls + 1 : 1; - L->nny = 0; /* allow yields */ - api_checknelems(L, (L->status == LUA_OK) ? nargs + 1 : nargs); - status = luaD_rawrunprotected(L, resume, &nargs); - if (status == -1) /* error calling 'lua_resume'? */ - status = LUA_ERRRUN; - else { /* continue running after recoverable errors */ - while (errorstatus(status) && recover(L, status)) { - /* unroll continuation */ - status = luaD_rawrunprotected(L, unroll, &status); - } - if (errorstatus(status)) { /* unrecoverable error? */ - L->status = cast_byte(status); /* mark thread as 'dead' */ - seterrorobj(L, status, L->top); /* push error message */ - L->ci->top = L->top; - } - else lua_assert(status == L->status); /* normal end or yield */ - } - L->nny = oldnny; /* restore 'nny' */ - L->nCcalls--; - lua_assert(L->nCcalls == ((from) ? from->nCcalls : 0)); - lua_unlock(L); - return status; -} - - -LUA_API int lua_isyieldable (lua_State *L) { - return (L->nny == 0); -} - - -LUA_API int lua_yieldk (lua_State *L, int nresults, lua_KContext ctx, - lua_KFunction k) { - CallInfo *ci = L->ci; - luai_userstateyield(L, nresults); - lua_lock(L); - api_checknelems(L, nresults); - if (L->nny > 0) { - if (L != G(L)->mainthread) - luaG_runerror(L, "attempt to yield across a C-call boundary"); - else - luaG_runerror(L, "attempt to yield from outside a coroutine"); - } - L->status = LUA_YIELD; - ci->extra = savestack(L, ci->func); /* save current 'func' */ - if (isLua(ci)) { /* inside a hook? */ - api_check(L, k == NULL, "hooks cannot continue after yielding"); - } - else { - if ((ci->u.c.k = k) != NULL) /* is there a continuation? */ - ci->u.c.ctx = ctx; /* save context */ - ci->func = L->top - nresults - 1; /* protect stack below results */ - luaD_throw(L, LUA_YIELD); - } - lua_assert(ci->callstatus & CIST_HOOKED); /* must be inside a hook */ - lua_unlock(L); - return 0; /* return to 'luaD_hook' */ -} - - -int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t old_top, ptrdiff_t ef) { - int status; - CallInfo *old_ci = L->ci; - lu_byte old_allowhooks = L->allowhook; - unsigned short old_nny = L->nny; - ptrdiff_t old_errfunc = L->errfunc; - L->errfunc = ef; - status = luaD_rawrunprotected(L, func, u); - if (status != LUA_OK) { /* an error occurred? */ - StkId oldtop = restorestack(L, old_top); - luaF_close(L, oldtop); /* close possible pending closures */ - seterrorobj(L, status, oldtop); - L->ci = old_ci; - L->allowhook = old_allowhooks; - L->nny = old_nny; - luaD_shrinkstack(L); - } - L->errfunc = old_errfunc; - return status; -} - - - -/* -** Execute a protected parser. -*/ -struct SParser { /* data to 'f_parser' */ - ZIO *z; - Mbuffer buff; /* dynamic structure used by the scanner */ - Dyndata dyd; /* dynamic structures used by the parser */ - const char *mode; - const char *name; -}; - - -static void checkmode (lua_State *L, const char *mode, const char *x) { - if (mode && strchr(mode, x[0]) == NULL) { - luaO_pushfstring(L, - "attempt to load a %s chunk (mode is '%s')", x, mode); - luaD_throw(L, LUA_ERRSYNTAX); - } -} - - -static void f_parser (lua_State *L, void *ud) { - LClosure *cl; - struct SParser *p = cast(struct SParser *, ud); - int c = zgetc(p->z); /* read first character */ - if (c == LUA_SIGNATURE[0]) { - checkmode(L, p->mode, "binary"); - cl = luaU_undump(L, p->z, &p->buff, p->name); - } - else { - checkmode(L, p->mode, "text"); - cl = luaY_parser(L, p->z, &p->buff, &p->dyd, p->name, c); - } - lua_assert(cl->nupvalues == cl->p->sizeupvalues); - luaF_initupvals(L, cl); -} - - -int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, - const char *mode) { - struct SParser p; - int status; - L->nny++; /* cannot yield during parsing */ - p.z = z; p.name = name; p.mode = mode; - p.dyd.actvar.arr = NULL; p.dyd.actvar.size = 0; - p.dyd.gt.arr = NULL; p.dyd.gt.size = 0; - p.dyd.label.arr = NULL; p.dyd.label.size = 0; - luaZ_initbuffer(L, &p.buff); - status = luaD_pcall(L, f_parser, &p, savestack(L, L->top), L->errfunc); - luaZ_freebuffer(L, &p.buff); - luaM_freearray(L, p.dyd.actvar.arr, p.dyd.actvar.size); - luaM_freearray(L, p.dyd.gt.arr, p.dyd.gt.size); - luaM_freearray(L, p.dyd.label.arr, p.dyd.label.size); - L->nny--; - return status; -} - - diff --git a/external/mit/lua/dist/src/ldo.h b/external/mit/lua/dist/src/ldo.h deleted file mode 100644 index f0823bd63..000000000 --- a/external/mit/lua/dist/src/ldo.h +++ /dev/null @@ -1,48 +0,0 @@ -/* $NetBSD: ldo.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: ldo.h,v 2.22 2015/05/22 17:48:19 roberto Exp -** Stack and Call structure of Lua -** See Copyright Notice in lua.h -*/ - -#ifndef ldo_h -#define ldo_h - - -#include "lobject.h" -#include "lstate.h" -#include "lzio.h" - - -#define luaD_checkstack(L,n) if (L->stack_last - L->top <= (n)) \ - luaD_growstack(L, n); else condmovestack(L); - - -#define incr_top(L) {L->top++; luaD_checkstack(L,0);} - -#define savestack(L,p) ((char *)(p) - (char *)L->stack) -#define restorestack(L,n) ((TValue *)((char *)L->stack + (n))) - - -/* type of protected functions, to be ran by 'runprotected' */ -typedef void (*Pfunc) (lua_State *L, void *ud); - -LUAI_FUNC int luaD_protectedparser (lua_State *L, ZIO *z, const char *name, - const char *mode); -LUAI_FUNC void luaD_hook (lua_State *L, int event, int line); -LUAI_FUNC int luaD_precall (lua_State *L, StkId func, int nresults); -LUAI_FUNC void luaD_call (lua_State *L, StkId func, int nResults, - int allowyield); -LUAI_FUNC int luaD_pcall (lua_State *L, Pfunc func, void *u, - ptrdiff_t oldtop, ptrdiff_t ef); -LUAI_FUNC int luaD_poscall (lua_State *L, StkId firstResult, int nres); -LUAI_FUNC void luaD_reallocstack (lua_State *L, int newsize); -LUAI_FUNC void luaD_growstack (lua_State *L, int n); -LUAI_FUNC void luaD_shrinkstack (lua_State *L); - -LUAI_FUNC l_noret luaD_throw (lua_State *L, int errcode); -LUAI_FUNC int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud); - -#endif - diff --git a/external/mit/lua/dist/src/ldump.c b/external/mit/lua/dist/src/ldump.c deleted file mode 100644 index 931ab2296..000000000 --- a/external/mit/lua/dist/src/ldump.c +++ /dev/null @@ -1,221 +0,0 @@ -/* $NetBSD: ldump.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: ldump.c,v 2.36 2015/03/30 15:43:51 roberto Exp -** save precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#define ldump_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "lobject.h" -#include "lstate.h" -#include "lundump.h" - - -typedef struct { - lua_State *L; - lua_Writer writer; - void *data; - int strip; - int status; -} DumpState; - - -/* -** All high-level dumps go through DumpVector; you can change it to -** change the endianness of the result -*/ -#define DumpVector(v,n,D) DumpBlock(v,(n)*sizeof((v)[0]),D) - -#define DumpLiteral(s,D) DumpBlock(s, sizeof(s) - sizeof(char), D) - - -static void DumpBlock (const void *b, size_t size, DumpState *D) { - if (D->status == 0) { - lua_unlock(D->L); - D->status = (*D->writer)(D->L, b, size, D->data); - lua_lock(D->L); - } -} - - -#define DumpVar(x,D) DumpVector(&x,1,D) - - -static void DumpByte (int y, DumpState *D) { - lu_byte x = (lu_byte)y; - DumpVar(x, D); -} - - -static void DumpInt (int x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpNumber (lua_Number x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpInteger (lua_Integer x, DumpState *D) { - DumpVar(x, D); -} - - -static void DumpString (const TString *s, DumpState *D) { - if (s == NULL) - DumpByte(0, D); - else { - size_t size = tsslen(s) + 1; /* include trailing '\0' */ - const char *str = getstr(s); - if (size < 0xFF) - DumpByte(cast_int(size), D); - else { - DumpByte(0xFF, D); - DumpVar(size, D); - } - DumpVector(str, size - 1, D); /* no need to save '\0' */ - } -} - - -static void DumpCode (const Proto *f, DumpState *D) { - DumpInt(f->sizecode, D); - DumpVector(f->code, f->sizecode, D); -} - - -static void DumpFunction(const Proto *f, TString *psource, DumpState *D); - -static void DumpConstants (const Proto *f, DumpState *D) { - int i; - int n = f->sizek; - DumpInt(n, D); - for (i = 0; i < n; i++) { - const TValue *o = &f->k[i]; - DumpByte(ttype(o), D); - switch (ttype(o)) { - case LUA_TNIL: - break; - case LUA_TBOOLEAN: - DumpByte(bvalue(o), D); - break; -#ifndef _KERNEL - case LUA_TNUMFLT: - DumpNumber(fltvalue(o), D); - break; -#endif - case LUA_TNUMINT: - DumpInteger(ivalue(o), D); - break; - case LUA_TSHRSTR: - case LUA_TLNGSTR: - DumpString(tsvalue(o), D); - break; - default: - lua_assert(0); - } - } -} - - -static void DumpProtos (const Proto *f, DumpState *D) { - int i; - int n = f->sizep; - DumpInt(n, D); - for (i = 0; i < n; i++) - DumpFunction(f->p[i], f->source, D); -} - - -static void DumpUpvalues (const Proto *f, DumpState *D) { - int i, n = f->sizeupvalues; - DumpInt(n, D); - for (i = 0; i < n; i++) { - DumpByte(f->upvalues[i].instack, D); - DumpByte(f->upvalues[i].idx, D); - } -} - - -static void DumpDebug (const Proto *f, DumpState *D) { - int i, n; - n = (D->strip) ? 0 : f->sizelineinfo; - DumpInt(n, D); - DumpVector(f->lineinfo, n, D); - n = (D->strip) ? 0 : f->sizelocvars; - DumpInt(n, D); - for (i = 0; i < n; i++) { - DumpString(f->locvars[i].varname, D); - DumpInt(f->locvars[i].startpc, D); - DumpInt(f->locvars[i].endpc, D); - } - n = (D->strip) ? 0 : f->sizeupvalues; - DumpInt(n, D); - for (i = 0; i < n; i++) - DumpString(f->upvalues[i].name, D); -} - - -static void DumpFunction (const Proto *f, TString *psource, DumpState *D) { - if (D->strip || f->source == psource) - DumpString(NULL, D); /* no debug info or same source as its parent */ - else - DumpString(f->source, D); - DumpInt(f->linedefined, D); - DumpInt(f->lastlinedefined, D); - DumpByte(f->numparams, D); - DumpByte(f->is_vararg, D); - DumpByte(f->maxstacksize, D); - DumpCode(f, D); - DumpConstants(f, D); - DumpUpvalues(f, D); - DumpProtos(f, D); - DumpDebug(f, D); -} - - -static void DumpHeader (DumpState *D) { - DumpLiteral(LUA_SIGNATURE, D); - DumpByte(LUAC_VERSION, D); - DumpByte(LUAC_FORMAT, D); - DumpLiteral(LUAC_DATA, D); - DumpByte(sizeof(int), D); - DumpByte(sizeof(size_t), D); - DumpByte(sizeof(Instruction), D); - DumpByte(sizeof(lua_Integer), D); - DumpByte(sizeof(lua_Number), D); - DumpInteger(LUAC_INT, D); - DumpNumber(LUAC_NUM, D); -} - - -/* -** dump Lua function as precompiled chunk -*/ -int luaU_dump(lua_State *L, const Proto *f, lua_Writer w, void *data, - int strip) { - DumpState D; - D.L = L; - D.writer = w; - D.data = data; - D.strip = strip; - D.status = 0; - DumpHeader(&D); - DumpByte(f->sizeupvalues, &D); - DumpFunction(f, NULL, &D); - return D.status; -} - diff --git a/external/mit/lua/dist/src/lfunc.c b/external/mit/lua/dist/src/lfunc.c deleted file mode 100644 index e56d1d49d..000000000 --- a/external/mit/lua/dist/src/lfunc.c +++ /dev/null @@ -1,155 +0,0 @@ -/* $NetBSD: lfunc.c,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lfunc.c,v 2.45 2014/11/02 19:19:04 roberto Exp -** Auxiliary functions to manipulate prototypes and closures -** See Copyright Notice in lua.h -*/ - -#define lfunc_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" - - - -CClosure *luaF_newCclosure (lua_State *L, int n) { - GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n)); - CClosure *c = gco2ccl(o); - c->nupvalues = cast_byte(n); - return c; -} - - -LClosure *luaF_newLclosure (lua_State *L, int n) { - GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n)); - LClosure *c = gco2lcl(o); - c->p = NULL; - c->nupvalues = cast_byte(n); - while (n--) c->upvals[n] = NULL; - return c; -} - -/* -** fill a closure with new closed upvalues -*/ -void luaF_initupvals (lua_State *L, LClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) { - UpVal *uv = luaM_new(L, UpVal); - uv->refcount = 1; - uv->v = &uv->u.value; /* make it closed */ - setnilvalue(uv->v); - cl->upvals[i] = uv; - } -} - - -UpVal *luaF_findupval (lua_State *L, StkId level) { - UpVal **pp = &L->openupval; - UpVal *p; - UpVal *uv; - lua_assert(isintwups(L) || L->openupval == NULL); - while (*pp != NULL && (p = *pp)->v >= level) { - lua_assert(upisopen(p)); - if (p->v == level) /* found a corresponding upvalue? */ - return p; /* return it */ - pp = &p->u.open.next; - } - /* not found: create a new upvalue */ - uv = luaM_new(L, UpVal); - uv->refcount = 0; - uv->u.open.next = *pp; /* link it to list of open upvalues */ - uv->u.open.touched = 1; - *pp = uv; - uv->v = level; /* current value lives in the stack */ - if (!isintwups(L)) { /* thread not in list of threads with upvalues? */ - L->twups = G(L)->twups; /* link it to the list */ - G(L)->twups = L; - } - return uv; -} - - -void luaF_close (lua_State *L, StkId level) { - UpVal *uv; - while (L->openupval != NULL && (uv = L->openupval)->v >= level) { - lua_assert(upisopen(uv)); - L->openupval = uv->u.open.next; /* remove from 'open' list */ - if (uv->refcount == 0) /* no references? */ - luaM_free(L, uv); /* free upvalue */ - else { - setobj(L, &uv->u.value, uv->v); /* move value to upvalue slot */ - uv->v = &uv->u.value; /* now current value lives here */ - luaC_upvalbarrier(L, uv); - } - } -} - - -Proto *luaF_newproto (lua_State *L) { - GCObject *o = luaC_newobj(L, LUA_TPROTO, sizeof(Proto)); - Proto *f = gco2p(o); - f->k = NULL; - f->sizek = 0; - f->p = NULL; - f->sizep = 0; - f->code = NULL; - f->cache = NULL; - f->sizecode = 0; - f->lineinfo = NULL; - f->sizelineinfo = 0; - f->upvalues = NULL; - f->sizeupvalues = 0; - f->numparams = 0; - f->is_vararg = 0; - f->maxstacksize = 0; - f->locvars = NULL; - f->sizelocvars = 0; - f->linedefined = 0; - f->lastlinedefined = 0; - f->source = NULL; - return f; -} - - -void luaF_freeproto (lua_State *L, Proto *f) { - luaM_freearray(L, f->code, f->sizecode); - luaM_freearray(L, f->p, f->sizep); - luaM_freearray(L, f->k, f->sizek); - luaM_freearray(L, f->lineinfo, f->sizelineinfo); - luaM_freearray(L, f->locvars, f->sizelocvars); - luaM_freearray(L, f->upvalues, f->sizeupvalues); - luaM_free(L, f); -} - - -/* -** Look for n-th local variable at line 'line' in function 'func'. -** Returns NULL if not found. -*/ -const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { - int i; - for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { - if (pc < f->locvars[i].endpc) { /* is variable active? */ - local_number--; - if (local_number == 0) - return getstr(f->locvars[i].varname); - } - } - return NULL; /* not found */ -} - diff --git a/external/mit/lua/dist/src/lfunc.h b/external/mit/lua/dist/src/lfunc.h deleted file mode 100644 index 042704e48..000000000 --- a/external/mit/lua/dist/src/lfunc.h +++ /dev/null @@ -1,63 +0,0 @@ -/* $NetBSD: lfunc.h,v 1.3 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp -** Auxiliary functions to manipulate prototypes and closures -** See Copyright Notice in lua.h -*/ - -#ifndef lfunc_h -#define lfunc_h - - -#include "lobject.h" - - -#define sizeCclosure(n) (cast(int, sizeof(CClosure)) + \ - cast(int, sizeof(TValue)*((n)-1))) - -#define sizeLclosure(n) (cast(int, sizeof(LClosure)) + \ - cast(int, sizeof(TValue *)*((n)-1))) - - -/* test whether thread is in 'twups' list */ -#define isintwups(L) (L->twups != L) - - -/* -** maximum number of upvalues in a closure (both C and Lua). (Value -** must fit in a VM register.) -*/ -#define MAXUPVAL 255 - - -/* -** Upvalues for Lua closures -*/ -struct UpVal { - TValue *v; /* points to stack or to its own value */ - lu_mem refcount; /* reference counter */ - union { - struct { /* (when open) */ - UpVal *next; /* linked list */ - int touched; /* mark to avoid cycles with dead threads */ - } open; - TValue value; /* the value (when closed) */ - } u; -}; - -#define upisopen(up) ((up)->v != &(up)->u.value) - - -LUAI_FUNC Proto *luaF_newproto (lua_State *L); -LUAI_FUNC CClosure *luaF_newCclosure (lua_State *L, int nelems); -LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems); -LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); -LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); -LUAI_FUNC void luaF_close (lua_State *L, StkId level); -LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); -LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, - int pc); - - -#endif diff --git a/external/mit/lua/dist/src/lgc.c b/external/mit/lua/dist/src/lgc.c deleted file mode 100644 index a95132022..000000000 --- a/external/mit/lua/dist/src/lgc.c +++ /dev/null @@ -1,1179 +0,0 @@ -/* $NetBSD: lgc.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lgc.c,v 2.205 2015/03/25 13:42:19 roberto Exp -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#define lgc_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - -/* -** internal state for collector while inside the atomic phase. The -** collector should never be in this state while running regular code. -*/ -#define GCSinsideatomic (GCSpause + 1) - -/* -** cost of sweeping one element (the size of a small object divided -** by some adjust for the sweep speed) -*/ -#define GCSWEEPCOST ((sizeof(TString) + 4) / 4) - -/* maximum number of elements to sweep in each single step */ -#define GCSWEEPMAX (cast_int((GCSTEPSIZE / GCSWEEPCOST) / 4)) - -/* cost of calling one finalizer */ -#define GCFINALIZECOST GCSWEEPCOST - - -/* -** macro to adjust 'stepmul': 'stepmul' is actually used like -** 'stepmul / STEPMULADJ' (value chosen by tests) -*/ -#define STEPMULADJ 200 - - -/* -** macro to adjust 'pause': 'pause' is actually used like -** 'pause / PAUSEADJ' (value chosen by tests) -*/ -#define PAUSEADJ 100 - - -/* -** 'makewhite' erases all color bits then sets only the current white -** bit -*/ -#define maskcolors (~(bitmask(BLACKBIT) | WHITEBITS)) -#define makewhite(g,x) \ - (x->marked = cast_byte((x->marked & maskcolors) | luaC_white(g))) - -#define white2gray(x) resetbits(x->marked, WHITEBITS) -#define black2gray(x) resetbit(x->marked, BLACKBIT) - - -#define valiswhite(x) (iscollectable(x) && iswhite(gcvalue(x))) - -#define checkdeadkey(n) lua_assert(!ttisdeadkey(gkey(n)) || ttisnil(gval(n))) - - -#define checkconsistency(obj) \ - lua_longassert(!iscollectable(obj) || righttt(obj)) - - -#define markvalue(g,o) { checkconsistency(o); \ - if (valiswhite(o)) reallymarkobject(g,gcvalue(o)); } - -#define markobject(g,t) { if (iswhite(t)) reallymarkobject(g, obj2gco(t)); } - -/* -** mark an object that can be NULL (either because it is really optional, -** or it was stripped as debug info, or inside an uncompleted structure) -*/ -#define markobjectN(g,t) { if (t) markobject(g,t); } - -static void reallymarkobject (global_State *g, GCObject *o); - - -/* -** {====================================================== -** Generic functions -** ======================================================= -*/ - - -/* -** one after last element in a hash array -*/ -#define gnodelast(h) gnode(h, cast(size_t, sizenode(h))) - - -/* -** link collectable object 'o' into list pointed by 'p' -*/ -#define linkgclist(o,p) ((o)->gclist = (p), (p) = obj2gco(o)) - - -/* -** if key is not marked, mark its entry as dead (therefore removing it -** from the table) -*/ -static void removeentry (Node *n) { - lua_assert(ttisnil(gval(n))); - if (valiswhite(gkey(n))) - setdeadvalue(wgkey(n)); /* unused and unmarked key; remove it */ -} - - -/* -** tells whether a key or value can be cleared from a weak -** table. Non-collectable objects are never removed from weak -** tables. Strings behave as 'values', so are never removed too. for -** other objects: if really collected, cannot keep them; for objects -** being finalized, keep them in keys, but not in values -*/ -static int iscleared (global_State *g, const TValue *o) { - if (!iscollectable(o)) return 0; - else if (ttisstring(o)) { - markobject(g, tsvalue(o)); /* strings are 'values', so are never weak */ - return 0; - } - else return iswhite(gcvalue(o)); -} - - -/* -** barrier that moves collector forward, that is, mark the white object -** being pointed by a black object. (If in sweep phase, clear the black -** object to white [sweep it] to avoid other barrier calls for this -** same object.) -*/ -void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v) { - global_State *g = G(L); - lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); - if (keepinvariant(g)) /* must keep invariant? */ - reallymarkobject(g, v); /* restore invariant */ - else { /* sweep phase */ - lua_assert(issweepphase(g)); - makewhite(g, o); /* mark main obj. as white to avoid other barriers */ - } -} - - -/* -** barrier that moves collector backward, that is, mark the black object -** pointing to a white object as gray again. -*/ -void luaC_barrierback_ (lua_State *L, Table *t) { - global_State *g = G(L); - lua_assert(isblack(t) && !isdead(g, t)); - black2gray(t); /* make table gray (again) */ - linkgclist(t, g->grayagain); -} - - -/* -** barrier for assignments to closed upvalues. Because upvalues are -** shared among closures, it is impossible to know the color of all -** closures pointing to it. So, we assume that the object being assigned -** must be marked. -*/ -void luaC_upvalbarrier_ (lua_State *L, UpVal *uv) { - global_State *g = G(L); - GCObject *o = gcvalue(uv->v); - lua_assert(!upisopen(uv)); /* ensured by macro luaC_upvalbarrier */ - if (keepinvariant(g)) - markobject(g, o); -} - - -void luaC_fix (lua_State *L, GCObject *o) { - global_State *g = G(L); - lua_assert(g->allgc == o); /* object must be 1st in 'allgc' list! */ - white2gray(o); /* they will be gray forever */ - g->allgc = o->next; /* remove object from 'allgc' list */ - o->next = g->fixedgc; /* link it to 'fixedgc' list */ - g->fixedgc = o; -} - - -/* -** create a new collectable object (with given type and size) and link -** it to 'allgc' list. -*/ -GCObject *luaC_newobj (lua_State *L, int tt, size_t sz) { - global_State *g = G(L); - GCObject *o = cast(GCObject *, luaM_newobject(L, novariant(tt), sz)); - o->marked = luaC_white(g); - o->tt = tt; - o->next = g->allgc; - g->allgc = o; - return o; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** Mark functions -** ======================================================= -*/ - - -/* -** mark an object. Userdata, strings, and closed upvalues are visited -** and turned black here. Other objects are marked gray and added -** to appropriate list to be visited (and turned black) later. (Open -** upvalues are already linked in 'headuv' list.) -*/ -static void reallymarkobject (global_State *g, GCObject *o) { - reentry: - white2gray(o); - switch (o->tt) { - case LUA_TSHRSTR: { - gray2black(o); - g->GCmemtrav += sizelstring(gco2ts(o)->shrlen); - break; - } - case LUA_TLNGSTR: { - gray2black(o); - g->GCmemtrav += sizelstring(gco2ts(o)->u.lnglen); - break; - } - case LUA_TUSERDATA: { - TValue uvalue; - markobjectN(g, gco2u(o)->metatable); /* mark its metatable */ - gray2black(o); - g->GCmemtrav += sizeudata(gco2u(o)); - getuservalue(g->mainthread, gco2u(o), &uvalue); - if (valiswhite(&uvalue)) { /* markvalue(g, &uvalue); */ - o = gcvalue(&uvalue); - goto reentry; - } - break; - } - case LUA_TLCL: { - linkgclist(gco2lcl(o), g->gray); - break; - } - case LUA_TCCL: { - linkgclist(gco2ccl(o), g->gray); - break; - } - case LUA_TTABLE: { - linkgclist(gco2t(o), g->gray); - break; - } - case LUA_TTHREAD: { - linkgclist(gco2th(o), g->gray); - break; - } - case LUA_TPROTO: { - linkgclist(gco2p(o), g->gray); - break; - } - default: lua_assert(0); break; - } -} - - -/* -** mark metamethods for basic types -*/ -static void markmt (global_State *g) { - int i; - for (i=0; i < LUA_NUMTAGS; i++) - markobjectN(g, g->mt[i]); -} - - -/* -** mark all objects in list of being-finalized -*/ -static void markbeingfnz (global_State *g) { - GCObject *o; - for (o = g->tobefnz; o != NULL; o = o->next) - markobject(g, o); -} - - -/* -** Mark all values stored in marked open upvalues from non-marked threads. -** (Values from marked threads were already marked when traversing the -** thread.) Remove from the list threads that no longer have upvalues and -** not-marked threads. -*/ -static void remarkupvals (global_State *g) { - lua_State *thread; - lua_State **p = &g->twups; - while ((thread = *p) != NULL) { - lua_assert(!isblack(thread)); /* threads are never black */ - if (isgray(thread) && thread->openupval != NULL) - p = &thread->twups; /* keep marked thread with upvalues in the list */ - else { /* thread is not marked or without upvalues */ - UpVal *uv; - *p = thread->twups; /* remove thread from the list */ - thread->twups = thread; /* mark that it is out of list */ - for (uv = thread->openupval; uv != NULL; uv = uv->u.open.next) { - if (uv->u.open.touched) { - markvalue(g, uv->v); /* remark upvalue's value */ - uv->u.open.touched = 0; - } - } - } - } -} - - -/* -** mark root set and reset all gray lists, to start a new collection -*/ -static void restartcollection (global_State *g) { - g->gray = g->grayagain = NULL; - g->weak = g->allweak = g->ephemeron = NULL; - markobject(g, g->mainthread); - markvalue(g, &g->l_registry); - markmt(g); - markbeingfnz(g); /* mark any finalizing object left from previous cycle */ -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Traverse functions -** ======================================================= -*/ - -/* -** Traverse a table with weak values and link it to proper list. During -** propagate phase, keep it in 'grayagain' list, to be revisited in the -** atomic phase. In the atomic phase, if table has any white value, -** put it in 'weak' list, to be cleared. -*/ -static void traverseweakvalue (global_State *g, Table *h) { - Node *n, *limit = gnodelast(h); - /* if there is array part, assume it may have white values (it is not - worth traversing it now just to check) */ - int hasclears = (h->sizearray > 0); - for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else { - lua_assert(!ttisnil(gkey(n))); - markvalue(g, gkey(n)); /* mark key */ - if (!hasclears && iscleared(g, gval(n))) /* is there a white value? */ - hasclears = 1; /* table will have to be cleared */ - } - } - if (g->gcstate == GCSpropagate) - linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ - else if (hasclears) - linkgclist(h, g->weak); /* has to be cleared later */ -} - - -/* -** Traverse an ephemeron table and link it to proper list. Returns true -** iff any object was marked during this traversal (which implies that -** convergence has to continue). During propagation phase, keep table -** in 'grayagain' list, to be visited again in the atomic phase. In -** the atomic phase, if table has any white->white entry, it has to -** be revisited during ephemeron convergence (as that key may turn -** black). Otherwise, if it has any white key, table has to be cleared -** (in the atomic phase). -*/ -static int traverseephemeron (global_State *g, Table *h) { - int marked = 0; /* true if an object is marked in this traversal */ - int hasclears = 0; /* true if table has white keys */ - int hasww = 0; /* true if table has entry "white-key -> white-value" */ - Node *n, *limit = gnodelast(h); - unsigned int i; - /* traverse array part */ - for (i = 0; i < h->sizearray; i++) { - if (valiswhite(&h->array[i])) { - marked = 1; - reallymarkobject(g, gcvalue(&h->array[i])); - } - } - /* traverse hash part */ - for (n = gnode(h, 0); n < limit; n++) { - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else if (iscleared(g, gkey(n))) { /* key is not marked (yet)? */ - hasclears = 1; /* table must be cleared */ - if (valiswhite(gval(n))) /* value not marked yet? */ - hasww = 1; /* white-white entry */ - } - else if (valiswhite(gval(n))) { /* value not marked yet? */ - marked = 1; - reallymarkobject(g, gcvalue(gval(n))); /* mark it now */ - } - } - /* link table into proper list */ - if (g->gcstate == GCSpropagate) - linkgclist(h, g->grayagain); /* must retraverse it in atomic phase */ - else if (hasww) /* table has white->white entries? */ - linkgclist(h, g->ephemeron); /* have to propagate again */ - else if (hasclears) /* table has white keys? */ - linkgclist(h, g->allweak); /* may have to clean white keys */ - return marked; -} - - -static void traversestrongtable (global_State *g, Table *h) { - Node *n, *limit = gnodelast(h); - unsigned int i; - for (i = 0; i < h->sizearray; i++) /* traverse array part */ - markvalue(g, &h->array[i]); - for (n = gnode(h, 0); n < limit; n++) { /* traverse hash part */ - checkdeadkey(n); - if (ttisnil(gval(n))) /* entry is empty? */ - removeentry(n); /* remove it */ - else { - lua_assert(!ttisnil(gkey(n))); - markvalue(g, gkey(n)); /* mark key */ - markvalue(g, gval(n)); /* mark value */ - } - } -} - - -static lu_mem traversetable (global_State *g, Table *h) { - const char *weakkey, *weakvalue; - const TValue *mode = gfasttm(g, h->metatable, TM_MODE); - markobjectN(g, h->metatable); - if (mode && ttisstring(mode) && /* is there a weak mode? */ - ((weakkey = strchr(svalue(mode), 'k')), - (weakvalue = strchr(svalue(mode), 'v')), - (weakkey || weakvalue))) { /* is really weak? */ - black2gray(h); /* keep table gray */ - if (!weakkey) /* strong keys? */ - traverseweakvalue(g, h); - else if (!weakvalue) /* strong values? */ - traverseephemeron(g, h); - else /* all weak */ - linkgclist(h, g->allweak); /* nothing to traverse now */ - } - else /* not weak */ - traversestrongtable(g, h); - return sizeof(Table) + sizeof(TValue) * h->sizearray + - sizeof(Node) * cast(size_t, sizenode(h)); -} - - -/* -** Traverse a prototype. (While a prototype is being build, its -** arrays can be larger than needed; the extra slots are filled with -** NULL, so the use of 'markobjectN') -*/ -static int traverseproto (global_State *g, Proto *f) { - int i; - if (f->cache && iswhite(f->cache)) - f->cache = NULL; /* allow cache to be collected */ - markobjectN(g, f->source); - for (i = 0; i < f->sizek; i++) /* mark literals */ - markvalue(g, &f->k[i]); - for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */ - markobjectN(g, f->upvalues[i].name); - for (i = 0; i < f->sizep; i++) /* mark nested protos */ - markobjectN(g, f->p[i]); - for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */ - markobjectN(g, f->locvars[i].varname); - return sizeof(Proto) + sizeof(Instruction) * f->sizecode + - sizeof(Proto *) * f->sizep + - sizeof(TValue) * f->sizek + - sizeof(int) * f->sizelineinfo + - sizeof(LocVar) * f->sizelocvars + - sizeof(Upvaldesc) * f->sizeupvalues; -} - - -static lu_mem traverseCclosure (global_State *g, CClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) /* mark its upvalues */ - markvalue(g, &cl->upvalue[i]); - return sizeCclosure(cl->nupvalues); -} - -/* -** open upvalues point to values in a thread, so those values should -** be marked when the thread is traversed except in the atomic phase -** (because then the value cannot be changed by the thread and the -** thread may not be traversed again) -*/ -static lu_mem traverseLclosure (global_State *g, LClosure *cl) { - int i; - markobjectN(g, cl->p); /* mark its prototype */ - for (i = 0; i < cl->nupvalues; i++) { /* mark its upvalues */ - UpVal *uv = cl->upvals[i]; - if (uv != NULL) { - if (upisopen(uv) && g->gcstate != GCSinsideatomic) - uv->u.open.touched = 1; /* can be marked in 'remarkupvals' */ - else - markvalue(g, uv->v); - } - } - return sizeLclosure(cl->nupvalues); -} - - -static lu_mem traversethread (global_State *g, lua_State *th) { - StkId o = th->stack; - if (o == NULL) - return 1; /* stack not completely built yet */ - lua_assert(g->gcstate == GCSinsideatomic || - th->openupval == NULL || isintwups(th)); - for (; o < th->top; o++) /* mark live elements in the stack */ - markvalue(g, o); - if (g->gcstate == GCSinsideatomic) { /* final traversal? */ - StkId lim = th->stack + th->stacksize; /* real end of stack */ - for (; o < lim; o++) /* clear not-marked stack slice */ - setnilvalue(o); - /* 'remarkupvals' may have removed thread from 'twups' list */ - if (!isintwups(th) && th->openupval != NULL) { - th->twups = g->twups; /* link it back to the list */ - g->twups = th; - } - } - else if (g->gckind != KGC_EMERGENCY) - luaD_shrinkstack(th); /* do not change stack in emergency cycle */ - return (sizeof(lua_State) + sizeof(TValue) * th->stacksize); -} - - -/* -** traverse one gray object, turning it to black (except for threads, -** which are always gray). -*/ -static void propagatemark (global_State *g) { - lu_mem size; - GCObject *o = g->gray; - lua_assert(isgray(o)); - gray2black(o); - switch (o->tt) { - case LUA_TTABLE: { - Table *h = gco2t(o); - g->gray = h->gclist; /* remove from 'gray' list */ - size = traversetable(g, h); - break; - } - case LUA_TLCL: { - LClosure *cl = gco2lcl(o); - g->gray = cl->gclist; /* remove from 'gray' list */ - size = traverseLclosure(g, cl); - break; - } - case LUA_TCCL: { - CClosure *cl = gco2ccl(o); - g->gray = cl->gclist; /* remove from 'gray' list */ - size = traverseCclosure(g, cl); - break; - } - case LUA_TTHREAD: { - lua_State *th = gco2th(o); - g->gray = th->gclist; /* remove from 'gray' list */ - linkgclist(th, g->grayagain); /* insert into 'grayagain' list */ - black2gray(o); - size = traversethread(g, th); - break; - } - case LUA_TPROTO: { - Proto *p = gco2p(o); - g->gray = p->gclist; /* remove from 'gray' list */ - size = traverseproto(g, p); - break; - } - default: lua_assert(0); return; - } - g->GCmemtrav += size; -} - - -static void propagateall (global_State *g) { - while (g->gray) propagatemark(g); -} - - -static void convergeephemerons (global_State *g) { - int changed; - do { - GCObject *w; - GCObject *next = g->ephemeron; /* get ephemeron list */ - g->ephemeron = NULL; /* tables may return to this list when traversed */ - changed = 0; - while ((w = next) != NULL) { - next = gco2t(w)->gclist; - if (traverseephemeron(g, gco2t(w))) { /* traverse marked some value? */ - propagateall(g); /* propagate changes */ - changed = 1; /* will have to revisit all ephemeron tables */ - } - } - } while (changed); -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Sweep Functions -** ======================================================= -*/ - - -/* -** clear entries with unmarked keys from all weaktables in list 'l' up -** to element 'f' -*/ -static void clearkeys (global_State *g, GCObject *l, GCObject *f) { - for (; l != f; l = gco2t(l)->gclist) { - Table *h = gco2t(l); - Node *n, *limit = gnodelast(h); - for (n = gnode(h, 0); n < limit; n++) { - if (!ttisnil(gval(n)) && (iscleared(g, gkey(n)))) { - setnilvalue(gval(n)); /* remove value ... */ - removeentry(n); /* and remove entry from table */ - } - } - } -} - - -/* -** clear entries with unmarked values from all weaktables in list 'l' up -** to element 'f' -*/ -static void clearvalues (global_State *g, GCObject *l, GCObject *f) { - for (; l != f; l = gco2t(l)->gclist) { - Table *h = gco2t(l); - Node *n, *limit = gnodelast(h); - unsigned int i; - for (i = 0; i < h->sizearray; i++) { - TValue *o = &h->array[i]; - if (iscleared(g, o)) /* value was collected? */ - setnilvalue(o); /* remove value */ - } - for (n = gnode(h, 0); n < limit; n++) { - if (!ttisnil(gval(n)) && iscleared(g, gval(n))) { - setnilvalue(gval(n)); /* remove value ... */ - removeentry(n); /* and remove entry from table */ - } - } - } -} - - -void luaC_upvdeccount (lua_State *L, UpVal *uv) { - lua_assert(uv->refcount > 0); - uv->refcount--; - if (uv->refcount == 0 && !upisopen(uv)) - luaM_free(L, uv); -} - - -static void freeLclosure (lua_State *L, LClosure *cl) { - int i; - for (i = 0; i < cl->nupvalues; i++) { - UpVal *uv = cl->upvals[i]; - if (uv) - luaC_upvdeccount(L, uv); - } - luaM_freemem(L, cl, sizeLclosure(cl->nupvalues)); -} - - -static void freeobj (lua_State *L, GCObject *o) { - switch (o->tt) { - case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; - case LUA_TLCL: { - freeLclosure(L, gco2lcl(o)); - break; - } - case LUA_TCCL: { - luaM_freemem(L, o, sizeCclosure(gco2ccl(o)->nupvalues)); - break; - } - case LUA_TTABLE: luaH_free(L, gco2t(o)); break; - case LUA_TTHREAD: luaE_freethread(L, gco2th(o)); break; - case LUA_TUSERDATA: luaM_freemem(L, o, sizeudata(gco2u(o))); break; - case LUA_TSHRSTR: - luaS_remove(L, gco2ts(o)); /* remove it from hash table */ - luaM_freemem(L, o, sizelstring(gco2ts(o)->shrlen)); - break; - case LUA_TLNGSTR: { - luaM_freemem(L, o, sizelstring(gco2ts(o)->u.lnglen)); - break; - } - default: lua_assert(0); - } -} - - -#define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) -static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count); - - -/* -** sweep at most 'count' elements from a list of GCObjects erasing dead -** objects, where a dead object is one marked with the old (non current) -** white; change all non-dead objects back to white, preparing for next -** collection cycle. Return where to continue the traversal or NULL if -** list is finished. -*/ -static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { - global_State *g = G(L); - int ow = otherwhite(g); - int white = luaC_white(g); /* current white */ - while (*p != NULL && count-- > 0) { - GCObject *curr = *p; - int marked = curr->marked; - if (isdeadm(ow, marked)) { /* is 'curr' dead? */ - *p = curr->next; /* remove 'curr' from list */ - freeobj(L, curr); /* erase 'curr' */ - } - else { /* change mark to 'white' */ - curr->marked = cast_byte((marked & maskcolors) | white); - p = &curr->next; /* go to next element */ - } - } - return (*p == NULL) ? NULL : p; -} - - -/* -** sweep a list until a live object (or end of list) -*/ -static GCObject **sweeptolive (lua_State *L, GCObject **p, int *n) { - GCObject **old = p; - int i = 0; - do { - i++; - p = sweeplist(L, p, 1); - } while (p == old); - if (n) *n += i; - return p; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** Finalization -** ======================================================= -*/ - -/* -** If possible, free concatenation buffer and shrink string table -*/ -static void checkSizes (lua_State *L, global_State *g) { - if (g->gckind != KGC_EMERGENCY) { - l_mem olddebt = g->GCdebt; - luaZ_freebuffer(L, &g->buff); /* free concatenation buffer */ - if (g->strt.nuse < g->strt.size / 4) /* string table too big? */ - luaS_resize(L, g->strt.size / 2); /* shrink it a little */ - g->GCestimate += g->GCdebt - olddebt; /* update estimate */ - } -} - - -static GCObject *udata2finalize (global_State *g) { - GCObject *o = g->tobefnz; /* get first element */ - lua_assert(tofinalize(o)); - g->tobefnz = o->next; /* remove it from 'tobefnz' list */ - o->next = g->allgc; /* return it to 'allgc' list */ - g->allgc = o; - resetbit(o->marked, FINALIZEDBIT); /* object is "normal" again */ - if (issweepphase(g)) - makewhite(g, o); /* "sweep" object */ - return o; -} - - -static void dothecall (lua_State *L, void *ud) { - UNUSED(ud); - luaD_call(L, L->top - 2, 0, 0); -} - - -static void GCTM (lua_State *L, int propagateerrors) { - global_State *g = G(L); - const TValue *tm; - TValue v; - setgcovalue(L, &v, udata2finalize(g)); - tm = luaT_gettmbyobj(L, &v, TM_GC); - if (tm != NULL && ttisfunction(tm)) { /* is there a finalizer? */ - int status; - lu_byte oldah = L->allowhook; - int running = g->gcrunning; - L->allowhook = 0; /* stop debug hooks during GC metamethod */ - g->gcrunning = 0; /* avoid GC steps */ - setobj2s(L, L->top, tm); /* push finalizer... */ - setobj2s(L, L->top + 1, &v); /* ... and its argument */ - L->top += 2; /* and (next line) call the finalizer */ - status = luaD_pcall(L, dothecall, NULL, savestack(L, L->top - 2), 0); - L->allowhook = oldah; /* restore hooks */ - g->gcrunning = running; /* restore state */ - if (status != LUA_OK && propagateerrors) { /* error while running __gc? */ - if (status == LUA_ERRRUN) { /* is there an error object? */ - const char *msg = (ttisstring(L->top - 1)) - ? svalue(L->top - 1) - : "no message"; - luaO_pushfstring(L, "error in __gc metamethod (%s)", msg); - status = LUA_ERRGCMM; /* error in __gc metamethod */ - } - luaD_throw(L, status); /* re-throw error */ - } - } -} - - -/* -** call a few (up to 'g->gcfinnum') finalizers -*/ -static int runafewfinalizers (lua_State *L) { - global_State *g = G(L); - unsigned int i; - lua_assert(!g->tobefnz || g->gcfinnum > 0); - for (i = 0; g->tobefnz && i < g->gcfinnum; i++) - GCTM(L, 1); /* call one finalizer */ - g->gcfinnum = (!g->tobefnz) ? 0 /* nothing more to finalize? */ - : g->gcfinnum * 2; /* else call a few more next time */ - return i; -} - - -/* -** call all pending finalizers -*/ -static void callallpendingfinalizers (lua_State *L, int propagateerrors) { - global_State *g = G(L); - while (g->tobefnz) - GCTM(L, propagateerrors); -} - - -/* -** find last 'next' field in list 'p' list (to add elements in its end) -*/ -static GCObject **findlast (GCObject **p) { - while (*p != NULL) - p = &(*p)->next; - return p; -} - - -/* -** move all unreachable objects (or 'all' objects) that need -** finalization from list 'finobj' to list 'tobefnz' (to be finalized) -*/ -static void separatetobefnz (global_State *g, int all) { - GCObject *curr; - GCObject **p = &g->finobj; - GCObject **lastnext = findlast(&g->tobefnz); - while ((curr = *p) != NULL) { /* traverse all finalizable objects */ - lua_assert(tofinalize(curr)); - if (!(iswhite(curr) || all)) /* not being collected? */ - p = &curr->next; /* don't bother with it */ - else { - *p = curr->next; /* remove 'curr' from 'finobj' list */ - curr->next = *lastnext; /* link at the end of 'tobefnz' list */ - *lastnext = curr; - lastnext = &curr->next; - } - } -} - - -/* -** if object 'o' has a finalizer, remove it from 'allgc' list (must -** search the list to find it) and link it in 'finobj' list. -*/ -void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { - global_State *g = G(L); - if (tofinalize(o) || /* obj. is already marked... */ - gfasttm(g, mt, TM_GC) == NULL) /* or has no finalizer? */ - return; /* nothing to be done */ - else { /* move 'o' to 'finobj' list */ - GCObject **p; - if (issweepphase(g)) { - makewhite(g, o); /* "sweep" object 'o' */ - if (g->sweepgc == &o->next) /* should not remove 'sweepgc' object */ - g->sweepgc = sweeptolive(L, g->sweepgc, NULL); /* change 'sweepgc' */ - } - /* search for pointer pointing to 'o' */ - for (p = &g->allgc; *p != o; p = &(*p)->next) { /* empty */ } - *p = o->next; /* remove 'o' from 'allgc' list */ - o->next = g->finobj; /* link it in 'finobj' list */ - g->finobj = o; - l_setbit(o->marked, FINALIZEDBIT); /* mark it as such */ - } -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** GC control -** ======================================================= -*/ - - -/* -** Set a reasonable "time" to wait before starting a new GC cycle; cycle -** will start when memory use hits threshold. (Division by 'estimate' -** should be OK: it cannot be zero (because Lua cannot even start with -** less than PAUSEADJ bytes). -*/ -static void setpause (global_State *g) { - l_mem threshold, debt; - l_mem estimate = g->GCestimate / PAUSEADJ; /* adjust 'estimate' */ - lua_assert(estimate > 0); - threshold = (g->gcpause < MAX_LMEM / estimate) /* overflow? */ - ? estimate * g->gcpause /* no overflow */ - : MAX_LMEM; /* overflow; truncate to maximum */ - debt = gettotalbytes(g) - threshold; - luaE_setdebt(g, debt); -} - - -/* -** Enter first sweep phase. -** The call to 'sweeptolive' makes pointer point to an object inside -** the list (instead of to the header), so that the real sweep do not -** need to skip objects created between "now" and the start of the real -** sweep. -** Returns how many objects it swept. -*/ -static int entersweep (lua_State *L) { - global_State *g = G(L); - int n = 0; - g->gcstate = GCSswpallgc; - lua_assert(g->sweepgc == NULL); - g->sweepgc = sweeptolive(L, &g->allgc, &n); - return n; -} - - -void luaC_freeallobjects (lua_State *L) { - global_State *g = G(L); - separatetobefnz(g, 1); /* separate all objects with finalizers */ - lua_assert(g->finobj == NULL); - callallpendingfinalizers(L, 0); - lua_assert(g->tobefnz == NULL); - g->currentwhite = WHITEBITS; /* this "white" makes all objects look dead */ - g->gckind = KGC_NORMAL; - sweepwholelist(L, &g->finobj); - sweepwholelist(L, &g->allgc); - sweepwholelist(L, &g->fixedgc); /* collect fixed objects */ - lua_assert(g->strt.nuse == 0); -} - - -static l_mem atomic (lua_State *L) { - global_State *g = G(L); - l_mem work; - GCObject *origweak, *origall; - GCObject *grayagain = g->grayagain; /* save original list */ - lua_assert(g->ephemeron == NULL && g->weak == NULL); - lua_assert(!iswhite(g->mainthread)); - g->gcstate = GCSinsideatomic; - g->GCmemtrav = 0; /* start counting work */ - markobject(g, L); /* mark running thread */ - /* registry and global metatables may be changed by API */ - markvalue(g, &g->l_registry); - markmt(g); /* mark global metatables */ - /* remark occasional upvalues of (maybe) dead threads */ - remarkupvals(g); - propagateall(g); /* propagate changes */ - work = g->GCmemtrav; /* stop counting (do not recount 'grayagain') */ - g->gray = grayagain; - propagateall(g); /* traverse 'grayagain' list */ - g->GCmemtrav = 0; /* restart counting */ - convergeephemerons(g); - /* at this point, all strongly accessible objects are marked. */ - /* Clear values from weak tables, before checking finalizers */ - clearvalues(g, g->weak, NULL); - clearvalues(g, g->allweak, NULL); - origweak = g->weak; origall = g->allweak; - work += g->GCmemtrav; /* stop counting (objects being finalized) */ - separatetobefnz(g, 0); /* separate objects to be finalized */ - g->gcfinnum = 1; /* there may be objects to be finalized */ - markbeingfnz(g); /* mark objects that will be finalized */ - propagateall(g); /* remark, to propagate 'resurrection' */ - g->GCmemtrav = 0; /* restart counting */ - convergeephemerons(g); - /* at this point, all resurrected objects are marked. */ - /* remove dead objects from weak tables */ - clearkeys(g, g->ephemeron, NULL); /* clear keys from all ephemeron tables */ - clearkeys(g, g->allweak, NULL); /* clear keys from all 'allweak' tables */ - /* clear values from resurrected weak tables */ - clearvalues(g, g->weak, origweak); - clearvalues(g, g->allweak, origall); - luaS_clearcache(g); - g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */ - work += g->GCmemtrav; /* complete counting */ - return work; /* estimate of memory marked by 'atomic' */ -} - - -static lu_mem sweepstep (lua_State *L, global_State *g, - int nextstate, GCObject **nextlist) { - if (g->sweepgc) { - l_mem olddebt = g->GCdebt; - g->sweepgc = sweeplist(L, g->sweepgc, GCSWEEPMAX); - g->GCestimate += g->GCdebt - olddebt; /* update estimate */ - if (g->sweepgc) /* is there still something to sweep? */ - return (GCSWEEPMAX * GCSWEEPCOST); - } - /* else enter next state */ - g->gcstate = nextstate; - g->sweepgc = nextlist; - return 0; -} - - -static lu_mem singlestep (lua_State *L) { - global_State *g = G(L); - switch (g->gcstate) { - case GCSpause: { - g->GCmemtrav = g->strt.size * sizeof(GCObject*); - restartcollection(g); - g->gcstate = GCSpropagate; - return g->GCmemtrav; - } - case GCSpropagate: { - g->GCmemtrav = 0; - lua_assert(g->gray); - propagatemark(g); - if (g->gray == NULL) /* no more gray objects? */ - g->gcstate = GCSatomic; /* finish propagate phase */ - return g->GCmemtrav; /* memory traversed in this step */ - } - case GCSatomic: { - lu_mem work; - int sw; - propagateall(g); /* make sure gray list is empty */ - work = atomic(L); /* work is what was traversed by 'atomic' */ - sw = entersweep(L); - g->GCestimate = gettotalbytes(g); /* first estimate */; - return work + sw * GCSWEEPCOST; - } - case GCSswpallgc: { /* sweep "regular" objects */ - return sweepstep(L, g, GCSswpfinobj, &g->finobj); - } - case GCSswpfinobj: { /* sweep objects with finalizers */ - return sweepstep(L, g, GCSswptobefnz, &g->tobefnz); - } - case GCSswptobefnz: { /* sweep objects to be finalized */ - return sweepstep(L, g, GCSswpend, NULL); - } - case GCSswpend: { /* finish sweeps */ - makewhite(g, g->mainthread); /* sweep main thread */ - checkSizes(L, g); - g->gcstate = GCScallfin; - return 0; - } - case GCScallfin: { /* call remaining finalizers */ - if (g->tobefnz && g->gckind != KGC_EMERGENCY) { - int n = runafewfinalizers(L); - return (n * GCFINALIZECOST); - } - else { /* emergency mode or no more finalizers */ - g->gcstate = GCSpause; /* finish collection */ - return 0; - } - } - default: lua_assert(0); return 0; - } -} - - -/* -** advances the garbage collector until it reaches a state allowed -** by 'statemask' -*/ -void luaC_runtilstate (lua_State *L, int statesmask) { - global_State *g = G(L); - while (!testbit(statesmask, g->gcstate)) - singlestep(L); -} - - -/* -** get GC debt and convert it from Kb to 'work units' (avoid zero debt -** and overflows) -*/ -static l_mem getdebt (global_State *g) { - l_mem debt = g->GCdebt; - int stepmul = g->gcstepmul; - debt = (debt / STEPMULADJ) + 1; - debt = (debt < MAX_LMEM / stepmul) ? debt * stepmul : MAX_LMEM; - return debt; -} - -/* -** performs a basic GC step when collector is running -*/ -void luaC_step (lua_State *L) { - global_State *g = G(L); - l_mem debt = getdebt(g); /* GC deficit (be paid now) */ - if (!g->gcrunning) { /* not running? */ - luaE_setdebt(g, -GCSTEPSIZE * 10); /* avoid being called too often */ - return; - } - do { /* repeat until pause or enough "credit" (negative debt) */ - lu_mem work = singlestep(L); /* perform one single step */ - debt -= work; - } while (debt > -GCSTEPSIZE && g->gcstate != GCSpause); - if (g->gcstate == GCSpause) - setpause(g); /* pause until next cycle */ - else { - debt = (debt / g->gcstepmul) * STEPMULADJ; /* convert 'work units' to Kb */ - luaE_setdebt(g, debt); - runafewfinalizers(L); - } -} - - -/* -** Performs a full GC cycle; if 'isemergency', set a flag to avoid -** some operations which could change the interpreter state in some -** unexpected ways (running finalizers and shrinking some structures). -** Before running the collection, check 'keepinvariant'; if it is true, -** there may be some objects marked as black, so the collector has -** to sweep all objects to turn them back to white (as white has not -** changed, nothing will be collected). -*/ -void luaC_fullgc (lua_State *L, int isemergency) { - global_State *g = G(L); - lua_assert(g->gckind == KGC_NORMAL); - if (isemergency) g->gckind = KGC_EMERGENCY; /* set flag */ - if (keepinvariant(g)) { /* black objects? */ - entersweep(L); /* sweep everything to turn them back to white */ - } - /* finish any pending sweep phase to start a new cycle */ - luaC_runtilstate(L, bitmask(GCSpause)); - luaC_runtilstate(L, ~bitmask(GCSpause)); /* start new collection */ - luaC_runtilstate(L, bitmask(GCScallfin)); /* run up to finalizers */ - /* estimate must be correct after a full GC cycle */ - lua_assert(g->GCestimate == gettotalbytes(g)); - luaC_runtilstate(L, bitmask(GCSpause)); /* finish collection */ - g->gckind = KGC_NORMAL; - setpause(g); -} - -/* }====================================================== */ - - diff --git a/external/mit/lua/dist/src/lgc.h b/external/mit/lua/dist/src/lgc.h deleted file mode 100644 index ea07a045b..000000000 --- a/external/mit/lua/dist/src/lgc.h +++ /dev/null @@ -1,138 +0,0 @@ -/* -** $Id: lgc.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ -** Garbage Collector -** See Copyright Notice in lua.h -*/ - -#ifndef lgc_h -#define lgc_h - - -#include "lobject.h" -#include "lstate.h" - -/* -** Collectable objects may have one of three colors: white, which -** means the object is not marked; gray, which means the -** object is marked, but its references may be not marked; and -** black, which means that the object and all its references are marked. -** The main invariant of the garbage collector, while marking objects, -** is that a black object can never point to a white one. Moreover, -** any gray object must be in a "gray list" (gray, grayagain, weak, -** allweak, ephemeron) so that it can be visited again before finishing -** the collection cycle. These lists have no meaning when the invariant -** is not being enforced (e.g., sweep phase). -*/ - - - -/* how much to allocate before next GC step */ -#if !defined(GCSTEPSIZE) -/* ~100 small strings */ -#define GCSTEPSIZE (cast_int(100 * sizeof(TString))) -#endif - - -/* -** Possible states of the Garbage Collector -*/ -#define GCSpropagate 0 -#define GCSatomic 1 -#define GCSswpallgc 2 -#define GCSswpfinobj 3 -#define GCSswptobefnz 4 -#define GCSswpend 5 -#define GCScallfin 6 -#define GCSpause 7 - - -#define issweepphase(g) \ - (GCSswpallgc <= (g)->gcstate && (g)->gcstate <= GCSswpend) - - -/* -** macro to tell when main invariant (white objects cannot point to black -** ones) must be kept. During a collection, the sweep -** phase may break the invariant, as objects turned white may point to -** still-black objects. The invariant is restored when sweep ends and -** all objects are white again. -*/ - -#define keepinvariant(g) ((g)->gcstate <= GCSatomic) - - -/* -** some useful bit tricks -*/ -#define resetbits(x,m) ((x) &= cast(lu_byte, ~(m))) -#define setbits(x,m) ((x) |= (m)) -#define testbits(x,m) ((x) & (m)) -#define bitmask(b) (1<<(b)) -#define bit2mask(b1,b2) (bitmask(b1) | bitmask(b2)) -#define l_setbit(x,b) setbits(x, bitmask(b)) -#define resetbit(x,b) resetbits(x, bitmask(b)) -#define testbit(x,b) testbits(x, bitmask(b)) - - -/* Layout for bit use in 'marked' field: */ -#define WHITE0BIT 0 /* object is white (type 0) */ -#define WHITE1BIT 1 /* object is white (type 1) */ -#define BLACKBIT 2 /* object is black */ -#define FINALIZEDBIT 3 /* object has been marked for finalization */ -/* bit 7 is currently used by tests (luaL_checkmemory) */ - -#define WHITEBITS bit2mask(WHITE0BIT, WHITE1BIT) - - -#define iswhite(x) testbits((x)->marked, WHITEBITS) -#define isblack(x) testbit((x)->marked, BLACKBIT) -#define isgray(x) /* neither white nor black */ \ - (!testbits((x)->marked, WHITEBITS | bitmask(BLACKBIT))) - -#define tofinalize(x) testbit((x)->marked, FINALIZEDBIT) - -#define otherwhite(g) ((g)->currentwhite ^ WHITEBITS) -#define isdeadm(ow,m) (!(((m) ^ WHITEBITS) & (ow))) -#define isdead(g,v) isdeadm(otherwhite(g), (v)->marked) - -#define changewhite(x) ((x)->marked ^= WHITEBITS) -#define gray2black(x) l_setbit((x)->marked, BLACKBIT) - -#define luaC_white(g) cast(lu_byte, (g)->currentwhite & WHITEBITS) - - -#define luaC_condGC(L,c) \ - {if (G(L)->GCdebt > 0) {c;}; condchangemem(L);} -#define luaC_checkGC(L) luaC_condGC(L, luaC_step(L);) - - -#define luaC_barrier(L,p,v) { \ - if (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) \ - luaC_barrier_(L,obj2gco(p),gcvalue(v)); } - -#define luaC_barrierback(L,p,v) { \ - if (iscollectable(v) && isblack(p) && iswhite(gcvalue(v))) \ - luaC_barrierback_(L,p); } - -#define luaC_objbarrier(L,p,o) { \ - if (isblack(p) && iswhite(o)) \ - luaC_barrier_(L,obj2gco(p),obj2gco(o)); } - -#define luaC_upvalbarrier(L,uv) \ - { if (iscollectable((uv)->v) && !upisopen(uv)) \ - luaC_upvalbarrier_(L,uv); } - -LUAI_FUNC void luaC_fix (lua_State *L, GCObject *o); -LUAI_FUNC void luaC_freeallobjects (lua_State *L); -LUAI_FUNC void luaC_step (lua_State *L); -LUAI_FUNC void luaC_runtilstate (lua_State *L, int statesmask); -LUAI_FUNC void luaC_fullgc (lua_State *L, int isemergency); -LUAI_FUNC GCObject *luaC_newobj (lua_State *L, int tt, size_t sz); -LUAI_FUNC void luaC_barrier_ (lua_State *L, GCObject *o, GCObject *v); -LUAI_FUNC void luaC_barrierback_ (lua_State *L, Table *o); -LUAI_FUNC void luaC_upvalbarrier_ (lua_State *L, UpVal *uv); -LUAI_FUNC void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt); -LUAI_FUNC void luaC_upvdeccount (lua_State *L, UpVal *uv); - - -#endif diff --git a/external/mit/lua/dist/src/linit.c b/external/mit/lua/dist/src/linit.c deleted file mode 100644 index eb5b2f477..000000000 --- a/external/mit/lua/dist/src/linit.c +++ /dev/null @@ -1,78 +0,0 @@ -/* $NetBSD: linit.c,v 1.4 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: linit.c,v 1.38 2015/01/05 13:48:33 roberto Exp -** Initialization of libraries for lua.c and other clients -** See Copyright Notice in lua.h -*/ - - -#define linit_c -#define LUA_LIB - -/* -** If you embed Lua in your program and need to open the standard -** libraries, call luaL_openlibs in your program. If you need a -** different set of libraries, copy this file to your project and edit -** it to suit your needs. -** -** You can also *preload* libraries, so that a later 'require' can -** open the library, which is already linked to the application. -** For that, do the following code: -** -** luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); -** lua_pushcfunction(L, luaopen_modname); -** lua_setfield(L, -2, modname); -** lua_pop(L, 1); // remove _PRELOAD table -*/ - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "lualib.h" -#include "lauxlib.h" - - -/* -** these libs are loaded by lua.c and are readily available to any Lua -** program -*/ -static const luaL_Reg loadedlibs[] = { - {"_G", luaopen_base}, -#ifndef _KERNEL - {LUA_LOADLIBNAME, luaopen_package}, -#endif - {LUA_COLIBNAME, luaopen_coroutine}, - {LUA_TABLIBNAME, luaopen_table}, -#ifndef _KERNEL - {LUA_IOLIBNAME, luaopen_io}, - {LUA_OSLIBNAME, luaopen_os}, -#endif - {LUA_STRLIBNAME, luaopen_string}, -#ifndef _KERNEL - {LUA_MATHLIBNAME, luaopen_math}, -#endif - {LUA_UTF8LIBNAME, luaopen_utf8}, - {LUA_DBLIBNAME, luaopen_debug}, -#if defined(LUA_COMPAT_BITLIB) - {LUA_BITLIBNAME, luaopen_bit32}, -#endif - {NULL, NULL} -}; - - -LUALIB_API void luaL_openlibs (lua_State *L) { - const luaL_Reg *lib; - /* "require" functions from 'loadedlibs' and set results to global table */ - for (lib = loadedlibs; lib->func; lib++) { - luaL_requiref(L, lib->name, lib->func, 1); - lua_pop(L, 1); /* remove lib */ - } -} - diff --git a/external/mit/lua/dist/src/liolib.c b/external/mit/lua/dist/src/liolib.c deleted file mode 100644 index a92f4e8ed..000000000 --- a/external/mit/lua/dist/src/liolib.c +++ /dev/null @@ -1,754 +0,0 @@ -/* $NetBSD: liolib.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: liolib.c,v 2.144 2015/04/03 18:41:57 roberto Exp -** Standard I/O (and system) library -** See Copyright Notice in lua.h -*/ - -#define liolib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#if !defined(l_checkmode) - -/* -** Check whether 'mode' matches '[rwa]%+?b?'. -** Change this macro to accept other modes for 'fopen' besides -** the standard ones. -*/ -#define l_checkmode(mode) \ - (*mode != '\0' && strchr("rwa", *(mode++)) != NULL && \ - (*mode != '+' || ++mode) && /* skip if char is '+' */ \ - (*mode != 'b' || ++mode) && /* skip if char is 'b' */ \ - (*mode == '\0')) - -#endif - -/* -** {====================================================== -** l_popen spawns a new process connected to the current -** one through the file streams. -** ======================================================= -*/ - -#if !defined(l_popen) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#define l_popen(L,c,m) (fflush(NULL), popen(c,m)) -#define l_pclose(L,file) (pclose(file)) - -#elif defined(LUA_USE_WINDOWS) /* }{ */ - -#define l_popen(L,c,m) (_popen(c,m)) -#define l_pclose(L,file) (_pclose(file)) - -#else /* }{ */ - -/* ISO C definitions */ -#define l_popen(L,c,m) \ - ((void)((void)c, m), \ - luaL_error(L, "'popen' not supported"), \ - (FILE*)0) -#define l_pclose(L,file) ((void)L, (void)file, -1) - -#endif /* } */ - -#endif /* } */ - -/* }====================================================== */ - - -#if !defined(l_getc) /* { */ - -#if defined(LUA_USE_POSIX) -#define l_getc(f) getc_unlocked(f) -#define l_lockfile(f) flockfile(f) -#define l_unlockfile(f) funlockfile(f) -#else -#define l_getc(f) getc(f) -#define l_lockfile(f) ((void)0) -#define l_unlockfile(f) ((void)0) -#endif - -#endif /* } */ - - -/* -** {====================================================== -** l_fseek: configuration for longer offsets -** ======================================================= -*/ - -#if !defined(l_fseek) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#include - -#define l_fseek(f,o,w) fseeko(f,o,w) -#define l_ftell(f) ftello(f) -#define l_seeknum off_t - -#elif defined(LUA_USE_WINDOWS) && !defined(_CRTIMP_TYPEINFO) \ - && defined(_MSC_VER) && (_MSC_VER >= 1400) /* }{ */ - -/* Windows (but not DDK) and Visual C++ 2005 or higher */ -#define l_fseek(f,o,w) _fseeki64(f,o,w) -#define l_ftell(f) _ftelli64(f) -#define l_seeknum __int64 - -#else /* }{ */ - -/* ISO C definitions */ -#define l_fseek(f,o,w) fseek(f,o,w) -#define l_ftell(f) ftell(f) -#define l_seeknum long - -#endif /* } */ - -#endif /* } */ - -/* }====================================================== */ - - -#define IO_PREFIX "_IO_" -#define IOPREF_LEN (sizeof(IO_PREFIX)/sizeof(char) - 1) -#define IO_INPUT (IO_PREFIX "input") -#define IO_OUTPUT (IO_PREFIX "output") - - -typedef luaL_Stream LStream; - - -#define tolstream(L) ((LStream *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) - -#define isclosed(p) ((p)->closef == NULL) - - -static int io_type (lua_State *L) { - LStream *p; - luaL_checkany(L, 1); - p = (LStream *)luaL_testudata(L, 1, LUA_FILEHANDLE); - if (p == NULL) - lua_pushnil(L); /* not a file */ - else if (isclosed(p)) - lua_pushliteral(L, "closed file"); - else - lua_pushliteral(L, "file"); - return 1; -} - - -static int f_tostring (lua_State *L) { - LStream *p = tolstream(L); - if (isclosed(p)) - lua_pushliteral(L, "file (closed)"); - else - lua_pushfstring(L, "file (%p)", p->f); - return 1; -} - - -static FILE *tofile (lua_State *L) { - LStream *p = tolstream(L); - if (isclosed(p)) - luaL_error(L, "attempt to use a closed file"); - lua_assert(p->f); - return p->f; -} - - -/* -** When creating file handles, always creates a 'closed' file handle -** before opening the actual file; so, if there is a memory error, the -** file is not left opened. -*/ -static LStream *newprefile (lua_State *L) { - LStream *p = (LStream *)lua_newuserdata(L, sizeof(LStream)); - p->closef = NULL; /* mark file handle as 'closed' */ - luaL_setmetatable(L, LUA_FILEHANDLE); - return p; -} - - -/* -** Calls the 'close' function from a file handle. The 'volatile' avoids -** a bug in some versions of the Clang compiler (e.g., clang 3.0 for -** 32 bits). -*/ -static int aux_close (lua_State *L) { - LStream *p = tolstream(L); - volatile lua_CFunction cf = p->closef; - p->closef = NULL; /* mark stream as closed */ - return (*cf)(L); /* close it */ -} - - -static int io_close (lua_State *L) { - if (lua_isnone(L, 1)) /* no argument? */ - lua_getfield(L, LUA_REGISTRYINDEX, IO_OUTPUT); /* use standard output */ - tofile(L); /* make sure argument is an open stream */ - return aux_close(L); -} - - -static int f_gc (lua_State *L) { - LStream *p = tolstream(L); - if (!isclosed(p) && p->f != NULL) - aux_close(L); /* ignore closed and incompletely open files */ - return 0; -} - - -/* -** function to close regular files -*/ -static int io_fclose (lua_State *L) { - LStream *p = tolstream(L); - int res = fclose(p->f); - return luaL_fileresult(L, (res == 0), NULL); -} - - -static LStream *newfile (lua_State *L) { - LStream *p = newprefile(L); - p->f = NULL; - p->closef = &io_fclose; - return p; -} - - -static void opencheck (lua_State *L, const char *fname, const char *mode) { - LStream *p = newfile(L); - p->f = fopen(fname, mode); - if (p->f == NULL) - luaL_error(L, "cannot open file '%s' (%s)", fname, strerror(errno)); -} - - -static int io_open (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); - LStream *p = newfile(L); - const char *md = mode; /* to traverse/check mode */ - luaL_argcheck(L, l_checkmode(md), 2, "invalid mode"); - p->f = fopen(filename, mode); - return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; -} - - -/* -** function to close 'popen' files -*/ -static int io_pclose (lua_State *L) { - LStream *p = tolstream(L); - return luaL_execresult(L, l_pclose(L, p->f)); -} - - -static int io_popen (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - const char *mode = luaL_optstring(L, 2, "r"); - LStream *p = newprefile(L); - p->f = l_popen(L, filename, mode); - p->closef = &io_pclose; - return (p->f == NULL) ? luaL_fileresult(L, 0, filename) : 1; -} - - -static int io_tmpfile (lua_State *L) { - LStream *p = newfile(L); - p->f = tmpfile(); - return (p->f == NULL) ? luaL_fileresult(L, 0, NULL) : 1; -} - - -static FILE *getiofile (lua_State *L, const char *findex) { - LStream *p; - lua_getfield(L, LUA_REGISTRYINDEX, findex); - p = (LStream *)lua_touserdata(L, -1); - if (isclosed(p)) - luaL_error(L, "standard %s file is closed", findex + IOPREF_LEN); - return p->f; -} - - -static int g_iofile (lua_State *L, const char *f, const char *mode) { - if (!lua_isnoneornil(L, 1)) { - const char *filename = lua_tostring(L, 1); - if (filename) - opencheck(L, filename, mode); - else { - tofile(L); /* check that it's a valid file handle */ - lua_pushvalue(L, 1); - } - lua_setfield(L, LUA_REGISTRYINDEX, f); - } - /* return current value */ - lua_getfield(L, LUA_REGISTRYINDEX, f); - return 1; -} - - -static int io_input (lua_State *L) { - return g_iofile(L, IO_INPUT, "r"); -} - - -static int io_output (lua_State *L) { - return g_iofile(L, IO_OUTPUT, "w"); -} - - -static int io_readline (lua_State *L); - - -static void aux_lines (lua_State *L, int toclose) { - int n = lua_gettop(L) - 1; /* number of arguments to read */ - lua_pushinteger(L, n); /* number of arguments to read */ - lua_pushboolean(L, toclose); /* close/not close file when finished */ - lua_rotate(L, 2, 2); /* move 'n' and 'toclose' to their positions */ - lua_pushcclosure(L, io_readline, 3 + n); -} - - -static int f_lines (lua_State *L) { - tofile(L); /* check that it's a valid file handle */ - aux_lines(L, 0); - return 1; -} - - -static int io_lines (lua_State *L) { - int toclose; - if (lua_isnone(L, 1)) lua_pushnil(L); /* at least one argument */ - if (lua_isnil(L, 1)) { /* no file name? */ - lua_getfield(L, LUA_REGISTRYINDEX, IO_INPUT); /* get default input */ - lua_replace(L, 1); /* put it at index 1 */ - tofile(L); /* check that it's a valid file handle */ - toclose = 0; /* do not close it after iteration */ - } - else { /* open a new file */ - const char *filename = luaL_checkstring(L, 1); - opencheck(L, filename, "r"); - lua_replace(L, 1); /* put file at index 1 */ - toclose = 1; /* close it after iteration */ - } - aux_lines(L, toclose); - return 1; -} - - -/* -** {====================================================== -** READ -** ======================================================= -*/ - - -/* maximum length of a numeral */ -#define MAXRN 200 - -/* auxiliary structure used by 'read_number' */ -typedef struct { - FILE *f; /* file being read */ - int c; /* current character (look ahead) */ - int n; /* number of elements in buffer 'buff' */ - char buff[MAXRN + 1]; /* +1 for ending '\0' */ -} RN; - - -/* -** Add current char to buffer (if not out of space) and read next one -*/ -static int nextc (RN *rn) { - if (rn->n >= MAXRN) { /* buffer overflow? */ - rn->buff[0] = '\0'; /* invalidate result */ - return 0; /* fail */ - } - else { - rn->buff[rn->n++] = rn->c; /* save current char */ - rn->c = l_getc(rn->f); /* read next one */ - return 1; - } -} - - -/* -** Accept current char if it is in 'set' (of size 1 or 2) -*/ -static int test2 (RN *rn, const char *set) { - if (rn->c == set[0] || (rn->c == set[1] && rn->c != '\0')) - return nextc(rn); - else return 0; -} - - -/* -** Read a sequence of (hex)digits -*/ -static int readdigits (RN *rn, int hex) { - int count = 0; - while ((hex ? isxdigit(rn->c) : isdigit(rn->c)) && nextc(rn)) - count++; - return count; -} - - -/* -** Read a number: first reads a valid prefix of a numeral into a buffer. -** Then it calls 'lua_stringtonumber' to check whether the format is -** correct and to convert it to a Lua number -*/ -static int read_number (lua_State *L, FILE *f) { - RN rn; - int count = 0; - int hex = 0; - char decp[2]; - rn.f = f; rn.n = 0; - decp[0] = lua_getlocaledecpoint(); /* get decimal point from locale */ - decp[1] = '\0'; - l_lockfile(rn.f); - do { rn.c = l_getc(rn.f); } while (isspace(rn.c)); /* skip spaces */ - test2(&rn, "-+"); /* optional signal */ - if (test2(&rn, "0")) { - if (test2(&rn, "xX")) hex = 1; /* numeral is hexadecimal */ - else count = 1; /* count initial '0' as a valid digit */ - } - count += readdigits(&rn, hex); /* integral part */ - if (test2(&rn, decp)) /* decimal point? */ - count += readdigits(&rn, hex); /* fractional part */ - if (count > 0 && test2(&rn, (hex ? "pP" : "eE"))) { /* exponent mark? */ - test2(&rn, "-+"); /* exponent signal */ - readdigits(&rn, 0); /* exponent digits */ - } - ungetc(rn.c, rn.f); /* unread look-ahead char */ - l_unlockfile(rn.f); - rn.buff[rn.n] = '\0'; /* finish string */ - if (lua_stringtonumber(L, rn.buff)) /* is this a valid number? */ - return 1; /* ok */ - else { /* invalid format */ - lua_pushnil(L); /* "result" to be removed */ - return 0; /* read fails */ - } -} - - -static int test_eof (lua_State *L, FILE *f) { - int c = getc(f); - ungetc(c, f); /* no-op when c == EOF */ - lua_pushliteral(L, ""); - return (c != EOF); -} - - -static int read_line (lua_State *L, FILE *f, int chop) { - luaL_Buffer b; - int c = '\0'; - luaL_buffinit(L, &b); - while (c != EOF && c != '\n') { /* repeat until end of line */ - char *buff = luaL_prepbuffer(&b); /* pre-allocate buffer */ - int i = 0; - l_lockfile(f); /* no memory errors can happen inside the lock */ - while (i < LUAL_BUFFERSIZE && (c = l_getc(f)) != EOF && c != '\n') - buff[i++] = c; - l_unlockfile(f); - luaL_addsize(&b, i); - } - if (!chop && c == '\n') /* want a newline and have one? */ - luaL_addchar(&b, c); /* add ending newline to result */ - luaL_pushresult(&b); /* close buffer */ - /* return ok if read something (either a newline or something else) */ - return (c == '\n' || lua_rawlen(L, -1) > 0); -} - - -static void read_all (lua_State *L, FILE *f) { - size_t nr; - luaL_Buffer b; - luaL_buffinit(L, &b); - do { /* read file in chunks of LUAL_BUFFERSIZE bytes */ - char *p = luaL_prepbuffsize(&b, LUAL_BUFFERSIZE); - nr = fread(p, sizeof(char), LUAL_BUFFERSIZE, f); - luaL_addsize(&b, nr); - } while (nr == LUAL_BUFFERSIZE); - luaL_pushresult(&b); /* close buffer */ -} - - -static int read_chars (lua_State *L, FILE *f, size_t n) { - size_t nr; /* number of chars actually read */ - char *p; - luaL_Buffer b; - luaL_buffinit(L, &b); - p = luaL_prepbuffsize(&b, n); /* prepare buffer to read whole block */ - nr = fread(p, sizeof(char), n, f); /* try to read 'n' chars */ - luaL_addsize(&b, nr); - luaL_pushresult(&b); /* close buffer */ - return (nr > 0); /* true iff read something */ -} - - -static int g_read (lua_State *L, FILE *f, int first) { - int nargs = lua_gettop(L) - 1; - int success; - int n; - clearerr(f); - if (nargs == 0) { /* no arguments? */ - success = read_line(L, f, 1); - n = first+1; /* to return 1 result */ - } - else { /* ensure stack space for all results and for auxlib's buffer */ - luaL_checkstack(L, nargs+LUA_MINSTACK, "too many arguments"); - success = 1; - for (n = first; nargs-- && success; n++) { - if (lua_type(L, n) == LUA_TNUMBER) { - size_t l = (size_t)luaL_checkinteger(L, n); - success = (l == 0) ? test_eof(L, f) : read_chars(L, f, l); - } - else { - const char *p = luaL_checkstring(L, n); - if (*p == '*') p++; /* skip optional '*' (for compatibility) */ - switch (*p) { - case 'n': /* number */ - success = read_number(L, f); - break; - case 'l': /* line */ - success = read_line(L, f, 1); - break; - case 'L': /* line with end-of-line */ - success = read_line(L, f, 0); - break; - case 'a': /* file */ - read_all(L, f); /* read entire file */ - success = 1; /* always success */ - break; - default: - return luaL_argerror(L, n, "invalid format"); - } - } - } - } - if (ferror(f)) - return luaL_fileresult(L, 0, NULL); - if (!success) { - lua_pop(L, 1); /* remove last result */ - lua_pushnil(L); /* push nil instead */ - } - return n - first; -} - - -static int io_read (lua_State *L) { - return g_read(L, getiofile(L, IO_INPUT), 1); -} - - -static int f_read (lua_State *L) { - return g_read(L, tofile(L), 2); -} - - -static int io_readline (lua_State *L) { - LStream *p = (LStream *)lua_touserdata(L, lua_upvalueindex(1)); - int i; - int n = (int)lua_tointeger(L, lua_upvalueindex(2)); - if (isclosed(p)) /* file is already closed? */ - return luaL_error(L, "file is already closed"); - lua_settop(L , 1); - luaL_checkstack(L, n, "too many arguments"); - for (i = 1; i <= n; i++) /* push arguments to 'g_read' */ - lua_pushvalue(L, lua_upvalueindex(3 + i)); - n = g_read(L, p->f, 2); /* 'n' is number of results */ - lua_assert(n > 0); /* should return at least a nil */ - if (lua_toboolean(L, -n)) /* read at least one value? */ - return n; /* return them */ - else { /* first result is nil: EOF or error */ - if (n > 1) { /* is there error information? */ - /* 2nd result is error message */ - return luaL_error(L, "%s", lua_tostring(L, -n + 1)); - } - if (lua_toboolean(L, lua_upvalueindex(3))) { /* generator created file? */ - lua_settop(L, 0); - lua_pushvalue(L, lua_upvalueindex(1)); - aux_close(L); /* close it */ - } - return 0; - } -} - -/* }====================================================== */ - - -static int g_write (lua_State *L, FILE *f, int arg) { - int nargs = lua_gettop(L) - arg; - int status = 1; - for (; nargs--; arg++) { - if (lua_type(L, arg) == LUA_TNUMBER) { - /* optimization: could be done exactly as for strings */ - int len = lua_isinteger(L, arg) - ? fprintf(f, LUA_INTEGER_FMT, lua_tointeger(L, arg)) - : fprintf(f, LUA_NUMBER_FMT, lua_tonumber(L, arg)); - status = status && (len > 0); - } - else { - size_t l; - const char *s = luaL_checklstring(L, arg, &l); - status = status && (fwrite(s, sizeof(char), l, f) == l); - } - } - if (status) return 1; /* file handle already on stack top */ - else return luaL_fileresult(L, status, NULL); -} - - -static int io_write (lua_State *L) { - return g_write(L, getiofile(L, IO_OUTPUT), 1); -} - - -static int f_write (lua_State *L) { - FILE *f = tofile(L); - lua_pushvalue(L, 1); /* push file at the stack top (to be returned) */ - return g_write(L, f, 2); -} - - -static int f_seek (lua_State *L) { - static const int mode[] = {SEEK_SET, SEEK_CUR, SEEK_END}; - static const char *const modenames[] = {"set", "cur", "end", NULL}; - FILE *f = tofile(L); - int op = luaL_checkoption(L, 2, "cur", modenames); - lua_Integer p3 = luaL_optinteger(L, 3, 0); - l_seeknum offset = (l_seeknum)p3; - luaL_argcheck(L, (lua_Integer)offset == p3, 3, - "not an integer in proper range"); - op = l_fseek(f, offset, mode[op]); - if (op) - return luaL_fileresult(L, 0, NULL); /* error */ - else { - lua_pushinteger(L, (lua_Integer)l_ftell(f)); - return 1; - } -} - - -static int f_setvbuf (lua_State *L) { - static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; - static const char *const modenames[] = {"no", "full", "line", NULL}; - FILE *f = tofile(L); - int op = luaL_checkoption(L, 2, NULL, modenames); - lua_Integer sz = luaL_optinteger(L, 3, LUAL_BUFFERSIZE); - int res = setvbuf(f, NULL, mode[op], (size_t)sz); - return luaL_fileresult(L, res == 0, NULL); -} - - - -static int io_flush (lua_State *L) { - return luaL_fileresult(L, fflush(getiofile(L, IO_OUTPUT)) == 0, NULL); -} - - -static int f_flush (lua_State *L) { - return luaL_fileresult(L, fflush(tofile(L)) == 0, NULL); -} - - -/* -** functions for 'io' library -*/ -static const luaL_Reg iolib[] = { - {"close", io_close}, - {"flush", io_flush}, - {"input", io_input}, - {"lines", io_lines}, - {"open", io_open}, - {"output", io_output}, - {"popen", io_popen}, - {"read", io_read}, - {"tmpfile", io_tmpfile}, - {"type", io_type}, - {"write", io_write}, - {NULL, NULL} -}; - - -/* -** methods for file handles -*/ -static const luaL_Reg flib[] = { - {"close", io_close}, - {"flush", f_flush}, - {"lines", f_lines}, - {"read", f_read}, - {"seek", f_seek}, - {"setvbuf", f_setvbuf}, - {"write", f_write}, - {"__gc", f_gc}, - {"__tostring", f_tostring}, - {NULL, NULL} -}; - - -static void createmeta (lua_State *L) { - luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ - lua_pushvalue(L, -1); /* push metatable */ - lua_setfield(L, -2, "__index"); /* metatable.__index = metatable */ - luaL_setfuncs(L, flib, 0); /* add file methods to new metatable */ - lua_pop(L, 1); /* pop new metatable */ -} - - -/* -** function to (not) close the standard files stdin, stdout, and stderr -*/ -static int io_noclose (lua_State *L) { - LStream *p = tolstream(L); - p->closef = &io_noclose; /* keep file opened */ - lua_pushnil(L); - lua_pushliteral(L, "cannot close standard file"); - return 2; -} - - -static void createstdfile (lua_State *L, FILE *f, const char *k, - const char *fname) { - LStream *p = newprefile(L); - p->f = f; - p->closef = &io_noclose; - if (k != NULL) { - lua_pushvalue(L, -1); - lua_setfield(L, LUA_REGISTRYINDEX, k); /* add file to registry */ - } - lua_setfield(L, -2, fname); /* add file to module */ -} - - -LUAMOD_API int luaopen_io (lua_State *L) { - luaL_newlib(L, iolib); /* new module */ - createmeta(L); - /* create (and set) default files */ - createstdfile(L, stdin, IO_INPUT, "stdin"); - createstdfile(L, stdout, IO_OUTPUT, "stdout"); - createstdfile(L, stderr, NULL, "stderr"); - return 1; -} - diff --git a/external/mit/lua/dist/src/llex.c b/external/mit/lua/dist/src/llex.c deleted file mode 100644 index 6891d80df..000000000 --- a/external/mit/lua/dist/src/llex.c +++ /dev/null @@ -1,634 +0,0 @@ -/* $NetBSD: llex.c,v 1.6 2015/10/08 13:40:16 mbalmer Exp $ */ - -/* -** Id: llex.c,v 2.93 2015/05/22 17:45:56 roberto Exp -** Lexical Analyzer -** See Copyright Notice in lua.h -*/ - -#define llex_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#endif - -#include "lua.h" - -#include "lctype.h" -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "llex.h" -#include "lobject.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "lzio.h" - - - -#define next(ls) (ls->current = zgetc(ls->z)) - - - -#define currIsNewline(ls) (ls->current == '\n' || ls->current == '\r') - - -/* ORDER RESERVED */ -static const char *const luaX_tokens [] = { - "and", "break", "do", "else", "elseif", - "end", "false", "for", "function", "goto", "if", - "in", "local", "nil", "not", "or", "repeat", - "return", "then", "true", "until", "while", - "//", "..", "...", "==", ">=", "<=", "~=", - "<<", ">>", "::", "", - "", "", "", "" -}; - - -#define save_and_next(ls) (save(ls, ls->current), next(ls)) - - -static l_noret lexerror (LexState *ls, const char *msg, int token); - - -static void save (LexState *ls, int c) { - Mbuffer *b = ls->buff; - if (luaZ_bufflen(b) + 1 > luaZ_sizebuffer(b)) { - size_t newsize; - if (luaZ_sizebuffer(b) >= MAX_SIZE/2) - lexerror(ls, "lexical element too long", 0); - newsize = luaZ_sizebuffer(b) * 2; - luaZ_resizebuffer(ls->L, b, newsize); - } - b->buffer[luaZ_bufflen(b)++] = cast(char, c); -} - - -void luaX_init (lua_State *L) { - int i; - TString *e = luaS_newliteral(L, LUA_ENV); /* create env name */ - luaC_fix(L, obj2gco(e)); /* never collect this name */ - for (i=0; iextra = cast_byte(i+1); /* reserved word */ - } -} - - -const char *luaX_token2str (LexState *ls, int token) { - if (token < FIRST_RESERVED) { /* single-byte symbols? */ - lua_assert(token == cast_uchar(token)); - return luaO_pushfstring(ls->L, "'%c'", token); - } - else { - const char *s = luaX_tokens[token - FIRST_RESERVED]; - if (token < TK_EOS) /* fixed format (symbols and reserved words)? */ - return luaO_pushfstring(ls->L, "'%s'", s); - else /* names, strings, and numerals */ - return s; - } -} - - -static const char *txtToken (LexState *ls, int token) { - switch (token) { - case TK_NAME: case TK_STRING: -#ifndef _KERNEL - case TK_FLT: case TK_INT: -#else - case TK_INT: -#endif - save(ls, '\0'); - return luaO_pushfstring(ls->L, "'%s'", luaZ_buffer(ls->buff)); - default: - return luaX_token2str(ls, token); - } -} - - -static l_noret lexerror (LexState *ls, const char *msg, int token) { - msg = luaG_addinfo(ls->L, msg, ls->source, ls->linenumber); - if (token) - luaO_pushfstring(ls->L, "%s near %s", msg, txtToken(ls, token)); - luaD_throw(ls->L, LUA_ERRSYNTAX); -} - - -l_noret luaX_syntaxerror (LexState *ls, const char *msg) { - lexerror(ls, msg, ls->t.token); -} - - -/* -** creates a new string and anchors it in scanner's table so that -** it will not be collected until the end of the compilation -** (by that time it should be anchored somewhere) -*/ -TString *luaX_newstring (LexState *ls, const char *str, size_t l) { - lua_State *L = ls->L; - TValue *o; /* entry for 'str' */ - TString *ts = luaS_newlstr(L, str, l); /* create new string */ - setsvalue2s(L, L->top++, ts); /* temporarily anchor it in stack */ - o = luaH_set(L, ls->h, L->top - 1); - if (ttisnil(o)) { /* not in use yet? */ - /* boolean value does not need GC barrier; - table has no metatable, so it does not need to invalidate cache */ - setbvalue(o, 1); /* t[string] = true */ - luaC_checkGC(L); - } - else { /* string already present */ - ts = tsvalue(keyfromval(o)); /* re-use value previously stored */ - } - L->top--; /* remove string from stack */ - return ts; -} - - -/* -** increment line number and skips newline sequence (any of -** \n, \r, \n\r, or \r\n) -*/ -static void inclinenumber (LexState *ls) { - int old = ls->current; - lua_assert(currIsNewline(ls)); - next(ls); /* skip '\n' or '\r' */ - if (currIsNewline(ls) && ls->current != old) - next(ls); /* skip '\n\r' or '\r\n' */ - if (++ls->linenumber >= MAX_INT) - lexerror(ls, "chunk has too many lines", 0); -} - - -void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source, - int firstchar) { - ls->t.token = 0; - ls->decpoint = '.'; - ls->L = L; - ls->current = firstchar; - ls->lookahead.token = TK_EOS; /* no look-ahead token */ - ls->z = z; - ls->fs = NULL; - ls->linenumber = 1; - ls->lastline = 1; - ls->source = source; - ls->envn = luaS_newliteral(L, LUA_ENV); /* get env name */ - luaZ_resizebuffer(ls->L, ls->buff, LUA_MINBUFFER); /* initialize buffer */ -} - - - -/* -** ======================================================= -** LEXICAL ANALYZER -** ======================================================= -*/ - - -static int check_next1 (LexState *ls, int c) { - if (ls->current == c) { - next(ls); - return 1; - } - else return 0; -} - - -/* -** Check whether current char is in set 'set' (with two chars) and -** saves it -*/ -static int check_next2 (LexState *ls, const char *set) { - lua_assert(set[2] == '\0'); - if (ls->current == set[0] || ls->current == set[1]) { - save_and_next(ls); - return 1; - } - else return 0; -} - - -#ifndef _KERNEL -/* -** change all characters 'from' in buffer to 'to' -*/ -static void buffreplace (LexState *ls, char from, char to) { - if (from != to) { - size_t n = luaZ_bufflen(ls->buff); - char *p = luaZ_buffer(ls->buff); - while (n--) - if (p[n] == from) p[n] = to; - } -} -#endif - -#define buff2num(b,o) (luaO_str2num(luaZ_buffer(b), o) != 0) - -#ifndef _KERNEL -/* -** in case of format error, try to change decimal point separator to -** the one defined in the current locale and check again -*/ -static void trydecpoint (LexState *ls, TValue *o) { - char old = ls->decpoint; - ls->decpoint = lua_getlocaledecpoint(); - buffreplace(ls, old, ls->decpoint); /* try new decimal separator */ - if (!buff2num(ls->buff, o)) { - /* format error with correct decimal point: no more options */ - buffreplace(ls, ls->decpoint, '.'); /* undo change (for error message) */ - lexerror(ls, "malformed number", TK_FLT); - } -} - - -/* LUA_NUMBER */ -/* -** this function is quite liberal in what it accepts, as 'luaO_str2num' -** will reject ill-formed numerals. -*/ -static int read_numeral (LexState *ls, SemInfo *seminfo) { - TValue obj; - const char *expo = "Ee"; - int first = ls->current; - lua_assert(lisdigit(ls->current)); - save_and_next(ls); - if (first == '0' && check_next2(ls, "xX")) /* hexadecimal? */ - expo = "Pp"; - for (;;) { - if (check_next2(ls, expo)) /* exponent part? */ - check_next2(ls, "-+"); /* optional exponent sign */ - if (lisxdigit(ls->current)) - save_and_next(ls); - else if (ls->current == '.') - save_and_next(ls); - else break; - } - save(ls, '\0'); - buffreplace(ls, '.', ls->decpoint); /* follow locale for decimal point */ - if (!buff2num(ls->buff, &obj)) /* format error? */ - trydecpoint(ls, &obj); /* try to update decimal point separator */ - if (ttisinteger(&obj)) { - seminfo->i = ivalue(&obj); - return TK_INT; - } - else { - lua_assert(ttisfloat(&obj)); - seminfo->r = fltvalue(&obj); - return TK_FLT; - } -} - -#else /* _KERNEL */ - -static int read_numeral (LexState *ls, SemInfo *seminfo) { - TValue obj; - int first = ls->current; - lua_assert(lisdigit(ls->current)); - save_and_next(ls); - if (first == '0') - check_next2(ls, "xX"); /* hexadecimal? */ - for (;;) { - if (lisxdigit(ls->current)) - save_and_next(ls); - else break; - } - save(ls, '\0'); - if (!buff2num(ls->buff, &obj)) /* format error? */ - lexerror(ls, "malformed number", TK_INT); - lua_assert(ttisinteger(&obj)); - seminfo->i = ivalue(&obj); - return TK_INT; -} -#endif - -/* -** skip a sequence '[=*[' or ']=*]'; if sequence is wellformed, return -** its number of '='s; otherwise, return a negative number (-1 iff there -** are no '='s after initial bracket) -*/ -static int skip_sep (LexState *ls) { - int count = 0; - int s = ls->current; - lua_assert(s == '[' || s == ']'); - save_and_next(ls); - while (ls->current == '=') { - save_and_next(ls); - count++; - } - return (ls->current == s) ? count : (-count) - 1; -} - - -static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { - int line = ls->linenumber; /* initial line (for error message) */ - save_and_next(ls); /* skip 2nd '[' */ - if (currIsNewline(ls)) /* string starts with a newline? */ - inclinenumber(ls); /* skip it */ - for (;;) { - switch (ls->current) { - case EOZ: { /* error */ - const char *what = (seminfo ? "string" : "comment"); - const char *msg = luaO_pushfstring(ls->L, - "unfinished long %s (starting at line %d)", what, line); - lexerror(ls, msg, TK_EOS); - break; /* to avoid warnings */ - } - case ']': { - if (skip_sep(ls) == sep) { - save_and_next(ls); /* skip 2nd ']' */ - goto endloop; - } - break; - } - case '\n': case '\r': { - save(ls, '\n'); - inclinenumber(ls); - if (!seminfo) luaZ_resetbuffer(ls->buff); /* avoid wasting space */ - break; - } - default: { - if (seminfo) save_and_next(ls); - else next(ls); - } - } - } endloop: - if (seminfo) - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + (2 + sep), - luaZ_bufflen(ls->buff) - 2*(2 + sep)); -} - - -static void esccheck (LexState *ls, int c, const char *msg) { - if (!c) { - if (ls->current != EOZ) - save_and_next(ls); /* add current to buffer for error message */ - lexerror(ls, msg, TK_STRING); - } -} - - -static int gethexa (LexState *ls) { - save_and_next(ls); - esccheck (ls, lisxdigit(ls->current), "hexadecimal digit expected"); - return luaO_hexavalue(ls->current); -} - - -static int readhexaesc (LexState *ls) { - int r = gethexa(ls); - r = (r << 4) + gethexa(ls); - luaZ_buffremove(ls->buff, 2); /* remove saved chars from buffer */ - return r; -} - - -static unsigned long readutf8esc (LexState *ls) { - unsigned long r; - int i = 4; /* chars to be removed: '\', 'u', '{', and first digit */ - save_and_next(ls); /* skip 'u' */ - esccheck(ls, ls->current == '{', "missing '{'"); - r = gethexa(ls); /* must have at least one digit */ - while ((save_and_next(ls), lisxdigit(ls->current))) { - i++; - r = (r << 4) + luaO_hexavalue(ls->current); - esccheck(ls, r <= 0x10FFFF, "UTF-8 value too large"); - } - esccheck(ls, ls->current == '}', "missing '}'"); - next(ls); /* skip '}' */ - luaZ_buffremove(ls->buff, i); /* remove saved chars from buffer */ - return r; -} - - -static void utf8esc (LexState *ls) { - char buff[UTF8BUFFSZ]; - int n = luaO_utf8esc(buff, readutf8esc(ls)); - for (; n > 0; n--) /* add 'buff' to string */ - save(ls, buff[UTF8BUFFSZ - n]); -} - - -static int readdecesc (LexState *ls) { - int i; - int r = 0; /* result accumulator */ - for (i = 0; i < 3 && lisdigit(ls->current); i++) { /* read up to 3 digits */ - r = 10*r + ls->current - '0'; - save_and_next(ls); - } - esccheck(ls, r <= UCHAR_MAX, "decimal escape too large"); - luaZ_buffremove(ls->buff, i); /* remove read digits from buffer */ - return r; -} - - -static void read_string (LexState *ls, int del, SemInfo *seminfo) { - save_and_next(ls); /* keep delimiter (for error messages) */ - while (ls->current != del) { - switch (ls->current) { - case EOZ: - lexerror(ls, "unfinished string", TK_EOS); - break; /* to avoid warnings */ - case '\n': - case '\r': - lexerror(ls, "unfinished string", TK_STRING); - break; /* to avoid warnings */ - case '\\': { /* escape sequences */ - int c; /* final character to be saved */ - save_and_next(ls); /* keep '\\' for error messages */ - switch (ls->current) { - case 'a': c = '\a'; goto read_save; - case 'b': c = '\b'; goto read_save; - case 'f': c = '\f'; goto read_save; - case 'n': c = '\n'; goto read_save; - case 'r': c = '\r'; goto read_save; - case 't': c = '\t'; goto read_save; - case 'v': c = '\v'; goto read_save; - case 'x': c = readhexaesc(ls); goto read_save; - case 'u': utf8esc(ls); goto no_save; - case '\n': case '\r': - inclinenumber(ls); c = '\n'; goto only_save; - case '\\': case '\"': case '\'': - c = ls->current; goto read_save; - case EOZ: goto no_save; /* will raise an error next loop */ - case 'z': { /* zap following span of spaces */ - luaZ_buffremove(ls->buff, 1); /* remove '\\' */ - next(ls); /* skip the 'z' */ - while (lisspace(ls->current)) { - if (currIsNewline(ls)) inclinenumber(ls); - else next(ls); - } - goto no_save; - } - default: { - esccheck(ls, lisdigit(ls->current), "invalid escape sequence"); - c = readdecesc(ls); /* digital escape '\ddd' */ - goto only_save; - } - } - read_save: - next(ls); - /* go through */ - only_save: - luaZ_buffremove(ls->buff, 1); /* remove '\\' */ - save(ls, c); - /* go through */ - no_save: break; - } - default: - save_and_next(ls); - } - } - save_and_next(ls); /* skip delimiter */ - seminfo->ts = luaX_newstring(ls, luaZ_buffer(ls->buff) + 1, - luaZ_bufflen(ls->buff) - 2); -} - - -static int llex (LexState *ls, SemInfo *seminfo) { - luaZ_resetbuffer(ls->buff); - for (;;) { - switch (ls->current) { - case '\n': case '\r': { /* line breaks */ - inclinenumber(ls); - break; - } - case ' ': case '\f': case '\t': case '\v': { /* spaces */ - next(ls); - break; - } - case '-': { /* '-' or '--' (comment) */ - next(ls); - if (ls->current != '-') return '-'; - /* else is a comment */ - next(ls); - if (ls->current == '[') { /* long comment? */ - int sep = skip_sep(ls); - luaZ_resetbuffer(ls->buff); /* 'skip_sep' may dirty the buffer */ - if (sep >= 0) { - read_long_string(ls, NULL, sep); /* skip long comment */ - luaZ_resetbuffer(ls->buff); /* previous call may dirty the buff. */ - break; - } - } - /* else short comment */ - while (!currIsNewline(ls) && ls->current != EOZ) - next(ls); /* skip until end of line (or end of file) */ - break; - } - case '[': { /* long string or simply '[' */ - int sep = skip_sep(ls); - if (sep >= 0) { - read_long_string(ls, seminfo, sep); - return TK_STRING; - } - else if (sep != -1) /* '[=...' missing second bracket */ - lexerror(ls, "invalid long string delimiter", TK_STRING); - return '['; - } - case '=': { - next(ls); - if (check_next1(ls, '=')) return TK_EQ; - else return '='; - } - case '<': { - next(ls); - if (check_next1(ls, '=')) return TK_LE; - else if (check_next1(ls, '<')) return TK_SHL; - else return '<'; - } - case '>': { - next(ls); - if (check_next1(ls, '=')) return TK_GE; - else if (check_next1(ls, '>')) return TK_SHR; - else return '>'; - } - case '/': { - next(ls); - if (check_next1(ls, '/')) return TK_IDIV; - else return '/'; - } - case '~': { - next(ls); - if (check_next1(ls, '=')) return TK_NE; - else return '~'; - } - case ':': { - next(ls); - if (check_next1(ls, ':')) return TK_DBCOLON; - else return ':'; - } - case '"': case '\'': { /* short literal strings */ - read_string(ls, ls->current, seminfo); - return TK_STRING; - } - case '.': { /* '.', '..', '...', or number */ - save_and_next(ls); - if (check_next1(ls, '.')) { - if (check_next1(ls, '.')) - return TK_DOTS; /* '...' */ - else return TK_CONCAT; /* '..' */ - } -#ifndef _KERNEL - else if (!lisdigit(ls->current)) return '.'; - else return read_numeral(ls, seminfo); -#else /* _KERNEL */ - else return '.'; -#endif - } - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': { - return read_numeral(ls, seminfo); - } - case EOZ: { - return TK_EOS; - } - default: { - if (lislalpha(ls->current)) { /* identifier or reserved word? */ - TString *ts; - do { - save_and_next(ls); - } while (lislalnum(ls->current)); - ts = luaX_newstring(ls, luaZ_buffer(ls->buff), - luaZ_bufflen(ls->buff)); - seminfo->ts = ts; - if (isreserved(ts)) /* reserved word? */ - return ts->extra - 1 + FIRST_RESERVED; - else { - return TK_NAME; - } - } - else { /* single-char tokens (+ - / ...) */ - int c = ls->current; - next(ls); - return c; - } - } - } - } -} - - -void luaX_next (LexState *ls) { - ls->lastline = ls->linenumber; - if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ - ls->t = ls->lookahead; /* use this one */ - ls->lookahead.token = TK_EOS; /* and discharge it */ - } - else - ls->t.token = llex(ls, &ls->t.seminfo); /* read next token */ -} - - -int luaX_lookahead (LexState *ls) { - lua_assert(ls->lookahead.token == TK_EOS); - ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); - return ls->lookahead.token; -} - diff --git a/external/mit/lua/dist/src/llex.h b/external/mit/lua/dist/src/llex.h deleted file mode 100644 index 3f4074625..000000000 --- a/external/mit/lua/dist/src/llex.h +++ /dev/null @@ -1,92 +0,0 @@ -/* $NetBSD: llex.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: llex.h,v 1.78 2014/10/29 15:38:24 roberto Exp -** Lexical Analyzer -** See Copyright Notice in lua.h -*/ - -#ifndef llex_h -#define llex_h - -#include "lobject.h" -#include "lzio.h" - - -#define FIRST_RESERVED 257 - - -#if !defined(LUA_ENV) -#define LUA_ENV "_ENV" -#endif - - -/* -* WARNING: if you change the order of this enumeration, -* grep "ORDER RESERVED" -*/ -enum RESERVED { - /* terminal symbols denoted by reserved words */ - TK_AND = FIRST_RESERVED, TK_BREAK, - TK_DO, TK_ELSE, TK_ELSEIF, TK_END, TK_FALSE, TK_FOR, TK_FUNCTION, - TK_GOTO, TK_IF, TK_IN, TK_LOCAL, TK_NIL, TK_NOT, TK_OR, TK_REPEAT, - TK_RETURN, TK_THEN, TK_TRUE, TK_UNTIL, TK_WHILE, - /* other terminal symbols */ - TK_IDIV, TK_CONCAT, TK_DOTS, TK_EQ, TK_GE, TK_LE, TK_NE, - TK_SHL, TK_SHR, - TK_DBCOLON, TK_EOS, -#ifndef _KERNEL - TK_FLT, TK_INT, TK_NAME, TK_STRING -#else /* _KERNEL */ - TK_INT, TK_NAME, TK_STRING -#endif -}; - -/* number of reserved words */ -#define NUM_RESERVED (cast(int, TK_WHILE-FIRST_RESERVED+1)) - - -typedef union { - lua_Number r; - lua_Integer i; - TString *ts; -} SemInfo; /* semantics information */ - - -typedef struct Token { - int token; - SemInfo seminfo; -} Token; - - -/* state of the lexer plus state of the parser when shared by all - functions */ -typedef struct LexState { - int current; /* current character (charint) */ - int linenumber; /* input line counter */ - int lastline; /* line of last token 'consumed' */ - Token t; /* current token */ - Token lookahead; /* look ahead token */ - struct FuncState *fs; /* current function (parser) */ - struct lua_State *L; - ZIO *z; /* input stream */ - Mbuffer *buff; /* buffer for tokens */ - Table *h; /* to avoid collection/reuse strings */ - struct Dyndata *dyd; /* dynamic structures used by the parser */ - TString *source; /* current source name */ - TString *envn; /* environment variable name */ - char decpoint; /* locale decimal point */ -} LexState; - - -LUAI_FUNC void luaX_init (lua_State *L); -LUAI_FUNC void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, - TString *source, int firstchar); -LUAI_FUNC TString *luaX_newstring (LexState *ls, const char *str, size_t l); -LUAI_FUNC void luaX_next (LexState *ls); -LUAI_FUNC int luaX_lookahead (LexState *ls); -LUAI_FUNC l_noret luaX_syntaxerror (LexState *ls, const char *s); -LUAI_FUNC const char *luaX_token2str (LexState *ls, int token); - - -#endif diff --git a/external/mit/lua/dist/src/llimits.h b/external/mit/lua/dist/src/llimits.h deleted file mode 100644 index afeca3bea..000000000 --- a/external/mit/lua/dist/src/llimits.h +++ /dev/null @@ -1,323 +0,0 @@ -/* $NetBSD: llimits.h,v 1.5 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: llimits.h,v 1.135 2015/06/09 14:21:00 roberto Exp -** Limits, basic types, and some other 'installation-dependent' definitions -** See Copyright Notice in lua.h -*/ - -#ifndef llimits_h -#define llimits_h - - -#ifndef _KERNEL -#include -#include -#endif - - -#include "lua.h" - -/* -** 'lu_mem' and 'l_mem' are unsigned/signed integers big enough to count -** the total memory used by Lua (in bytes). Usually, 'size_t' and -** 'ptrdiff_t' should work, but we use 'long' for 16-bit machines. -*/ -#if defined(LUAI_MEM) /* { external definitions? */ -typedef LUAI_UMEM lu_mem; -typedef LUAI_MEM l_mem; -#elif LUAI_BITSINT >= 32 /* }{ */ -typedef size_t lu_mem; -typedef ptrdiff_t l_mem; -#else /* 16-bit ints */ /* }{ */ -typedef unsigned long lu_mem; -typedef long l_mem; -#endif /* } */ - - -/* chars used as small naturals (so that 'char' is reserved for characters) */ -typedef unsigned char lu_byte; - - -/* maximum value for size_t */ -#define MAX_SIZET ((size_t)(~(size_t)0)) - -/* maximum size visible for Lua (must be representable in a lua_Integer */ -#define MAX_SIZE (sizeof(size_t) < sizeof(lua_Integer) ? MAX_SIZET \ - : (size_t)(LUA_MAXINTEGER)) - - -#define MAX_LUMEM ((lu_mem)(~(lu_mem)0)) - -#define MAX_LMEM ((l_mem)(MAX_LUMEM >> 1)) - - -#define MAX_INT INT_MAX /* maximum value of an int */ - - -/* -** conversion of pointer to unsigned integer: -** this is for hashing only; there is no problem if the integer -** cannot hold the whole pointer value -*/ -#define point2uint(p) ((unsigned int)((size_t)(p) & UINT_MAX)) - - - -/* type to ensure maximum alignment */ -#if defined(LUAI_USER_ALIGNMENT_T) -typedef LUAI_USER_ALIGNMENT_T L_Umaxalign; -#else -#ifndef _KERNEL -typedef union { double u; void *s; lua_Integer i; long l; } L_Umaxalign; -#else /* _KERNEL */ -typedef union { void *s; lua_Integer i; long l; } L_Umaxalign; -#endif -#endif - - - -/* types of 'usual argument conversions' for lua_Number and lua_Integer */ -#ifndef _KERNEL -typedef LUAI_UACNUMBER l_uacNumber; -#endif -typedef LUAI_UACINT l_uacInt; - - -/* internal assertions for in-house debugging */ -#if defined(lua_assert) -#define check_exp(c,e) (lua_assert(c), (e)) -/* to avoid problems with conditions too long */ -#define lua_longassert(c) { if (!(c)) lua_assert(0); } -#else -#define lua_assert(c) ((void)0) -#define check_exp(c,e) (e) -#define lua_longassert(c) ((void)0) -#endif - -/* -** assertion for checking API calls -*/ -#if !defined(luai_apicheck) -#define luai_apicheck(l,e) lua_assert(e) -#endif - -#define api_check(l,e,msg) luai_apicheck(l,(e) && msg) - - -/* macro to avoid warnings about unused variables */ -#if !defined(UNUSED) -#define UNUSED(x) ((void)(x)) -#endif - - -/* type casts (a macro highlights casts in the code) */ -#define cast(t, exp) ((t)(exp)) - -#define cast_void(i) cast(void, (i)) -#define cast_byte(i) cast(lu_byte, (i)) -#define cast_num(i) cast(lua_Number, (i)) -#define cast_int(i) cast(int, (i)) -#define cast_uchar(i) cast(unsigned char, (i)) - - -/* cast a signed lua_Integer to lua_Unsigned */ -#if !defined(l_castS2U) -#define l_castS2U(i) ((lua_Unsigned)(i)) -#endif - -/* -** cast a lua_Unsigned to a signed lua_Integer; this cast is -** not strict ISO C, but two-complement architectures should -** work fine. -*/ -#if !defined(l_castU2S) -#define l_castU2S(i) ((lua_Integer)(i)) -#endif - - -/* -** non-return type -*/ -#if defined(__GNUC__) -#define l_noret void __attribute__((noreturn)) -#elif defined(_MSC_VER) && _MSC_VER >= 1200 -#define l_noret void __declspec(noreturn) -#else -#define l_noret void -#endif - - - -/* -** maximum depth for nested C calls and syntactical nested non-terminals -** in a program. (Value must fit in an unsigned short int.) -*/ -#if !defined(LUAI_MAXCCALLS) -#define LUAI_MAXCCALLS 200 -#endif - - - -/* -** type for virtual-machine instructions; -** must be an unsigned with (at least) 4 bytes (see details in lopcodes.h) -*/ -#if LUAI_BITSINT >= 32 -typedef unsigned int Instruction; -#else -typedef unsigned long Instruction; -#endif - - - -/* -** Maximum length for short strings, that is, strings that are -** internalized. (Cannot be smaller than reserved words or tags for -** metamethods, as these strings must be internalized; -** #("function") = 8, #("__newindex") = 10.) -*/ -#if !defined(LUAI_MAXSHORTLEN) -#define LUAI_MAXSHORTLEN 40 -#endif - - -/* -** Initial size for the string table (must be power of 2). -** The Lua core alone registers ~50 strings (reserved words + -** metaevent keys + a few others). Libraries would typically add -** a few dozens more. -*/ -#if !defined(MINSTRTABSIZE) -#define MINSTRTABSIZE 128 -#endif - - -/* -** Size of cache for strings in the API (better be a prime) -*/ -#if !defined(STRCACHE_SIZE) -#define STRCACHE_SIZE 127 -#endif - - -/* minimum size for string buffer */ -#if !defined(LUA_MINBUFFER) -#define LUA_MINBUFFER 32 -#endif - - -/* -** macros that are executed whenether program enters the Lua core -** ('lua_lock') and leaves the core ('lua_unlock') -*/ -#if !defined(lua_lock) -#define lua_lock(L) ((void) 0) -#define lua_unlock(L) ((void) 0) -#endif - -/* -** macro executed during Lua functions at points where the -** function can yield. -*/ -#if !defined(luai_threadyield) -#define luai_threadyield(L) {lua_unlock(L); lua_lock(L);} -#endif - - -/* -** these macros allow user-specific actions on threads when you defined -** LUAI_EXTRASPACE and need to do something extra when a thread is -** created/deleted/resumed/yielded. -*/ -#if !defined(luai_userstateopen) -#define luai_userstateopen(L) ((void)L) -#endif - -#if !defined(luai_userstateclose) -#define luai_userstateclose(L) ((void)L) -#endif - -#if !defined(luai_userstatethread) -#define luai_userstatethread(L,L1) ((void)L) -#endif - -#if !defined(luai_userstatefree) -#define luai_userstatefree(L,L1) ((void)L) -#endif - -#if !defined(luai_userstateresume) -#define luai_userstateresume(L,n) ((void)L) -#endif - -#if !defined(luai_userstateyield) -#define luai_userstateyield(L,n) ((void)L) -#endif - - - -/* -** The luai_num* macros define the primitive operations over numbers. -*/ - -/* floor division (defined as 'floor(a/b)') */ -#if !defined(luai_numidiv) -#define luai_numidiv(L,a,b) ((void)L, l_floor(luai_numdiv(L,a,b))) -#endif - -/* float division */ -#if !defined(luai_numdiv) -#define luai_numdiv(L,a,b) ((a)/(b)) -#endif - -/* -** modulo: defined as 'a - floor(a/b)*b'; this definition gives NaN when -** 'b' is huge, but the result should be 'a'. 'fmod' gives the result of -** 'a - trunc(a/b)*b', and therefore must be corrected when 'trunc(a/b) -** ~= floor(a/b)'. That happens when the division has a non-integer -** negative result, which is equivalent to the test below. -*/ -#if !defined(luai_nummod) -#define luai_nummod(L,a,b,m) \ - { (m) = l_mathop(fmod)(a,b); if ((m)*(b) < 0) (m) += (b); } -#endif - -/* exponentiation */ -#if !defined(luai_numpow) -#define luai_numpow(L,a,b) ((void)L, l_mathop(pow)(a,b)) -#endif - -/* the others are quite standard operations */ -#if !defined(luai_numadd) -#define luai_numadd(L,a,b) ((a)+(b)) -#define luai_numsub(L,a,b) ((a)-(b)) -#define luai_nummul(L,a,b) ((a)*(b)) -#define luai_numunm(L,a) (-(a)) -#define luai_numeq(a,b) ((a)==(b)) -#define luai_numlt(a,b) ((a)<(b)) -#define luai_numle(a,b) ((a)<=(b)) -#define luai_numisnan(a) (!luai_numeq((a), (a))) -#endif - - - - - -/* -** macro to control inclusion of some hard tests on stack reallocation -*/ -#if !defined(HARDSTACKTESTS) -#define condmovestack(L) ((void)0) -#else -/* realloc stack keeping its size */ -#define condmovestack(L) luaD_reallocstack((L), (L)->stacksize) -#endif - -#if !defined(HARDMEMTESTS) -#define condchangemem(L) condmovestack(L) -#else -#define condchangemem(L) \ - ((void)(!(G(L)->gcrunning) || (luaC_fullgc(L, 0), 1))) -#endif - -#endif diff --git a/external/mit/lua/dist/src/lmathlib.c b/external/mit/lua/dist/src/lmathlib.c deleted file mode 100644 index ffae9aa2c..000000000 --- a/external/mit/lua/dist/src/lmathlib.c +++ /dev/null @@ -1,409 +0,0 @@ -/* $NetBSD: lmathlib.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lmathlib.c,v 1.115 2015/03/12 14:04:04 roberto Exp -** Standard mathematical library -** See Copyright Notice in lua.h -*/ - -#define lmathlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#undef PI -#define PI (l_mathop(3.141592653589793238462643383279502884)) - - -#if !defined(l_rand) /* { */ -#if defined(LUA_USE_POSIX) -#define l_rand() random() -#define l_srand(x) srandom(x) -#define L_RANDMAX 2147483647 /* (2^31 - 1), following POSIX */ -#else -#define l_rand() rand() -#define l_srand(x) srand(x) -#define L_RANDMAX RAND_MAX -#endif -#endif /* } */ - - -static int math_abs (lua_State *L) { - if (lua_isinteger(L, 1)) { - lua_Integer n = lua_tointeger(L, 1); - if (n < 0) n = (lua_Integer)(0u - n); - lua_pushinteger(L, n); - } - else - lua_pushnumber(L, l_mathop(fabs)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_sin (lua_State *L) { - lua_pushnumber(L, l_mathop(sin)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_cos (lua_State *L) { - lua_pushnumber(L, l_mathop(cos)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_tan (lua_State *L) { - lua_pushnumber(L, l_mathop(tan)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_asin (lua_State *L) { - lua_pushnumber(L, l_mathop(asin)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_acos (lua_State *L) { - lua_pushnumber(L, l_mathop(acos)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_atan (lua_State *L) { - lua_Number y = luaL_checknumber(L, 1); - lua_Number x = luaL_optnumber(L, 2, 1); - lua_pushnumber(L, l_mathop(atan2)(y, x)); - return 1; -} - - -static int math_toint (lua_State *L) { - int valid; - lua_Integer n = lua_tointegerx(L, 1, &valid); - if (valid) - lua_pushinteger(L, n); - else { - luaL_checkany(L, 1); - lua_pushnil(L); /* value is not convertible to integer */ - } - return 1; -} - - -static void pushnumint (lua_State *L, lua_Number d) { - lua_Integer n; - if (lua_numbertointeger(d, &n)) /* does 'd' fit in an integer? */ - lua_pushinteger(L, n); /* result is integer */ - else - lua_pushnumber(L, d); /* result is float */ -} - - -static int math_floor (lua_State *L) { - if (lua_isinteger(L, 1)) - lua_settop(L, 1); /* integer is its own floor */ - else { - lua_Number d = l_mathop(floor)(luaL_checknumber(L, 1)); - pushnumint(L, d); - } - return 1; -} - - -static int math_ceil (lua_State *L) { - if (lua_isinteger(L, 1)) - lua_settop(L, 1); /* integer is its own ceil */ - else { - lua_Number d = l_mathop(ceil)(luaL_checknumber(L, 1)); - pushnumint(L, d); - } - return 1; -} - - -static int math_fmod (lua_State *L) { - if (lua_isinteger(L, 1) && lua_isinteger(L, 2)) { - lua_Integer d = lua_tointeger(L, 2); - if ((lua_Unsigned)d + 1u <= 1u) { /* special cases: -1 or 0 */ - luaL_argcheck(L, d != 0, 2, "zero"); - lua_pushinteger(L, 0); /* avoid overflow with 0x80000... / -1 */ - } - else - lua_pushinteger(L, lua_tointeger(L, 1) % d); - } - else - lua_pushnumber(L, l_mathop(fmod)(luaL_checknumber(L, 1), - luaL_checknumber(L, 2))); - return 1; -} - - -/* -** next function does not use 'modf', avoiding problems with 'double*' -** (which is not compatible with 'float*') when lua_Number is not -** 'double'. -*/ -static int math_modf (lua_State *L) { - if (lua_isinteger(L ,1)) { - lua_settop(L, 1); /* number is its own integer part */ - lua_pushnumber(L, 0); /* no fractional part */ - } - else { - lua_Number n = luaL_checknumber(L, 1); - /* integer part (rounds toward zero) */ - lua_Number ip = (n < 0) ? l_mathop(ceil)(n) : l_mathop(floor)(n); - pushnumint(L, ip); - /* fractional part (test needed for inf/-inf) */ - lua_pushnumber(L, (n == ip) ? l_mathop(0.0) : (n - ip)); - } - return 2; -} - - -static int math_sqrt (lua_State *L) { - lua_pushnumber(L, l_mathop(sqrt)(luaL_checknumber(L, 1))); - return 1; -} - - -static int math_ult (lua_State *L) { - lua_Integer a = luaL_checkinteger(L, 1); - lua_Integer b = luaL_checkinteger(L, 2); - lua_pushboolean(L, (lua_Unsigned)a < (lua_Unsigned)b); - return 1; -} - -static int math_log (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - lua_Number res; - if (lua_isnoneornil(L, 2)) - res = l_mathop(log)(x); - else { - lua_Number base = luaL_checknumber(L, 2); -#if !defined(LUA_USE_C89) - if (base == 2.0) res = l_mathop(log2)(x); else -#endif - if (base == 10.0) res = l_mathop(log10)(x); - else res = l_mathop(log)(x)/l_mathop(log)(base); - } - lua_pushnumber(L, res); - return 1; -} - -static int math_exp (lua_State *L) { - lua_pushnumber(L, l_mathop(exp)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_deg (lua_State *L) { - lua_pushnumber(L, luaL_checknumber(L, 1) * (l_mathop(180.0) / PI)); - return 1; -} - -static int math_rad (lua_State *L) { - lua_pushnumber(L, luaL_checknumber(L, 1) * (PI / l_mathop(180.0))); - return 1; -} - - -static int math_min (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int imin = 1; /* index of current minimum value */ - int i; - luaL_argcheck(L, n >= 1, 1, "value expected"); - for (i = 2; i <= n; i++) { - if (lua_compare(L, i, imin, LUA_OPLT)) - imin = i; - } - lua_pushvalue(L, imin); - return 1; -} - - -static int math_max (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - int imax = 1; /* index of current maximum value */ - int i; - luaL_argcheck(L, n >= 1, 1, "value expected"); - for (i = 2; i <= n; i++) { - if (lua_compare(L, imax, i, LUA_OPLT)) - imax = i; - } - lua_pushvalue(L, imax); - return 1; -} - -/* -** This function uses 'double' (instead of 'lua_Number') to ensure that -** all bits from 'l_rand' can be represented, and that 'RANDMAX + 1.0' -** will keep full precision (ensuring that 'r' is always less than 1.0.) -*/ -static int math_random (lua_State *L) { - lua_Integer low, up; - double r = (double)l_rand() * (1.0 / ((double)L_RANDMAX + 1.0)); - switch (lua_gettop(L)) { /* check number of arguments */ - case 0: { /* no arguments */ - lua_pushnumber(L, (lua_Number)r); /* Number between 0 and 1 */ - return 1; - } - case 1: { /* only upper limit */ - low = 1; - up = luaL_checkinteger(L, 1); - break; - } - case 2: { /* lower and upper limits */ - low = luaL_checkinteger(L, 1); - up = luaL_checkinteger(L, 2); - break; - } - default: return luaL_error(L, "wrong number of arguments"); - } - /* random integer in the interval [low, up] */ - luaL_argcheck(L, low <= up, 1, "interval is empty"); - luaL_argcheck(L, low >= 0 || up <= LUA_MAXINTEGER + low, 1, - "interval too large"); - r *= (double)(up - low) + 1.0; - lua_pushinteger(L, (lua_Integer)r + low); - return 1; -} - - -static int math_randomseed (lua_State *L) { - l_srand((unsigned int)(lua_Integer)luaL_checknumber(L, 1)); - (void)rand(); /* discard first value to avoid undesirable correlations */ - return 0; -} - - -static int math_type (lua_State *L) { - if (lua_type(L, 1) == LUA_TNUMBER) { - if (lua_isinteger(L, 1)) - lua_pushliteral(L, "integer"); - else - lua_pushliteral(L, "float"); - } - else { - luaL_checkany(L, 1); - lua_pushnil(L); - } - return 1; -} - - -/* -** {================================================================== -** Deprecated functions (for compatibility only) -** =================================================================== -*/ -#if defined(LUA_COMPAT_MATHLIB) - -static int math_cosh (lua_State *L) { - lua_pushnumber(L, l_mathop(cosh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_sinh (lua_State *L) { - lua_pushnumber(L, l_mathop(sinh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_tanh (lua_State *L) { - lua_pushnumber(L, l_mathop(tanh)(luaL_checknumber(L, 1))); - return 1; -} - -static int math_pow (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - lua_Number y = luaL_checknumber(L, 2); - lua_pushnumber(L, l_mathop(pow)(x, y)); - return 1; -} - -static int math_frexp (lua_State *L) { - int e; - lua_pushnumber(L, l_mathop(frexp)(luaL_checknumber(L, 1), &e)); - lua_pushinteger(L, e); - return 2; -} - -static int math_ldexp (lua_State *L) { - lua_Number x = luaL_checknumber(L, 1); - int ep = (int)luaL_checkinteger(L, 2); - lua_pushnumber(L, l_mathop(ldexp)(x, ep)); - return 1; -} - -static int math_log10 (lua_State *L) { - lua_pushnumber(L, l_mathop(log10)(luaL_checknumber(L, 1))); - return 1; -} - -#endif -/* }================================================================== */ - - - -static const luaL_Reg mathlib[] = { - {"abs", math_abs}, - {"acos", math_acos}, - {"asin", math_asin}, - {"atan", math_atan}, - {"ceil", math_ceil}, - {"cos", math_cos}, - {"deg", math_deg}, - {"exp", math_exp}, - {"tointeger", math_toint}, - {"floor", math_floor}, - {"fmod", math_fmod}, - {"ult", math_ult}, - {"log", math_log}, - {"max", math_max}, - {"min", math_min}, - {"modf", math_modf}, - {"rad", math_rad}, - {"random", math_random}, - {"randomseed", math_randomseed}, - {"sin", math_sin}, - {"sqrt", math_sqrt}, - {"tan", math_tan}, - {"type", math_type}, -#if defined(LUA_COMPAT_MATHLIB) - {"atan2", math_atan}, - {"cosh", math_cosh}, - {"sinh", math_sinh}, - {"tanh", math_tanh}, - {"pow", math_pow}, - {"frexp", math_frexp}, - {"ldexp", math_ldexp}, - {"log10", math_log10}, -#endif - /* placeholders */ - {"pi", NULL}, - {"huge", NULL}, - {"maxinteger", NULL}, - {"mininteger", NULL}, - {NULL, NULL} -}; - - -/* -** Open math library -*/ -LUAMOD_API int luaopen_math (lua_State *L) { - luaL_newlib(L, mathlib); - lua_pushnumber(L, PI); - lua_setfield(L, -2, "pi"); - lua_pushnumber(L, (lua_Number)HUGE_VAL); - lua_setfield(L, -2, "huge"); - lua_pushinteger(L, LUA_MAXINTEGER); - lua_setfield(L, -2, "maxinteger"); - lua_pushinteger(L, LUA_MININTEGER); - lua_setfield(L, -2, "mininteger"); - return 1; -} - diff --git a/external/mit/lua/dist/src/lmem.c b/external/mit/lua/dist/src/lmem.c deleted file mode 100644 index 193b26597..000000000 --- a/external/mit/lua/dist/src/lmem.c +++ /dev/null @@ -1,104 +0,0 @@ -/* $NetBSD: lmem.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lmem.c,v 1.91 2015/03/06 19:45:54 roberto Exp -** Interface to Memory Manager -** See Copyright Notice in lua.h -*/ - -#define lmem_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" - - - -/* -** About the realloc function: -** void * frealloc (void *ud, void *ptr, size_t osize, size_t nsize); -** ('osize' is the old size, 'nsize' is the new size) -** -** * frealloc(ud, NULL, x, s) creates a new block of size 's' (no -** matter 'x'). -** -** * frealloc(ud, p, x, 0) frees the block 'p' -** (in this specific case, frealloc must return NULL); -** particularly, frealloc(ud, NULL, 0, 0) does nothing -** (which is equivalent to free(NULL) in ISO C) -** -** frealloc returns NULL if it cannot create or reallocate the area -** (any reallocation to an equal or smaller size cannot fail!) -*/ - - - -#define MINSIZEARRAY 4 - - -void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, - int limit, const char *what) { - void *newblock; - int newsize; - if (*size >= limit/2) { /* cannot double it? */ - if (*size >= limit) /* cannot grow even a little? */ - luaG_runerror(L, "too many %s (limit is %d)", what, limit); - newsize = limit; /* still have at least one free place */ - } - else { - newsize = (*size)*2; - if (newsize < MINSIZEARRAY) - newsize = MINSIZEARRAY; /* minimum size */ - } - newblock = luaM_reallocv(L, block, *size, newsize, size_elems); - *size = newsize; /* update only when everything else is OK */ - return newblock; -} - - -l_noret luaM_toobig (lua_State *L) { - luaG_runerror(L, "memory allocation error: block too big"); -} - - - -/* -** generic allocation routine. -*/ -void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { - void *newblock; - global_State *g = G(L); - size_t realosize = (block) ? osize : 0; - lua_assert((realosize == 0) == (block == NULL)); -#if defined(HARDMEMTESTS) - if (nsize > realosize && g->gcrunning) - luaC_fullgc(L, 1); /* force a GC whenever possible */ -#endif - newblock = (*g->frealloc)(g->ud, block, osize, nsize); - if (newblock == NULL && nsize > 0) { - lua_assert(nsize > realosize); /* cannot fail when shrinking a block */ - if (g->version) { /* is state fully built? */ - luaC_fullgc(L, 1); /* try to free some memory... */ - newblock = (*g->frealloc)(g->ud, block, osize, nsize); /* try again */ - } - if (newblock == NULL) - luaD_throw(L, LUA_ERRMEM); - } - lua_assert((nsize == 0) == (newblock == NULL)); - g->GCdebt = (g->GCdebt + nsize) - realosize; - return newblock; -} - diff --git a/external/mit/lua/dist/src/lmem.h b/external/mit/lua/dist/src/lmem.h deleted file mode 100644 index cff0b10ec..000000000 --- a/external/mit/lua/dist/src/lmem.h +++ /dev/null @@ -1,73 +0,0 @@ -/* $NetBSD: lmem.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lmem.h,v 1.43 2014/12/19 17:26:14 roberto Exp -** Interface to Memory Manager -** See Copyright Notice in lua.h -*/ - -#ifndef lmem_h -#define lmem_h - - -#ifndef _KERNEL -#include -#endif - -#include "llimits.h" -#include "lua.h" - - -/* -** This macro reallocs a vector 'b' from 'on' to 'n' elements, where -** each element has size 'e'. In case of arithmetic overflow of the -** product 'n'*'e', it raises an error (calling 'luaM_toobig'). Because -** 'e' is always constant, it avoids the runtime division MAX_SIZET/(e). -** -** (The macro is somewhat complex to avoid warnings: The 'sizeof' -** comparison avoids a runtime comparison when overflow cannot occur. -** The compiler should be able to optimize the real test by itself, but -** when it does it, it may give a warning about "comparison is always -** false due to limited range of data type"; the +1 tricks the compiler, -** avoiding this warning but also this optimization.) -*/ -#define luaM_reallocv(L,b,on,n,e) \ - (((sizeof(n) >= sizeof(size_t) && cast(size_t, (n)) + 1 > MAX_SIZET/(e)) \ - ? luaM_toobig(L) : cast_void(0)) , \ - luaM_realloc_(L, (b), (on)*(e), (n)*(e))) - -/* -** Arrays of chars do not need any test -*/ -#define luaM_reallocvchar(L,b,on,n) \ - cast(char *, luaM_realloc_(L, (b), (on)*sizeof(char), (n)*sizeof(char))) - -#define luaM_freemem(L, b, s) luaM_realloc_(L, (b), (s), 0) -#define luaM_free(L, b) luaM_realloc_(L, (b), sizeof(*(b)), 0) -#define luaM_freearray(L, b, n) luaM_realloc_(L, (b), (n)*sizeof(*(b)), 0) - -#define luaM_malloc(L,s) luaM_realloc_(L, NULL, 0, (s)) -#define luaM_new(L,t) cast(t *, luaM_malloc(L, sizeof(t))) -#define luaM_newvector(L,n,t) \ - cast(t *, luaM_reallocv(L, NULL, 0, n, sizeof(t))) - -#define luaM_newobject(L,tag,s) luaM_realloc_(L, NULL, tag, (s)) - -#define luaM_growvector(L,v,nelems,size,t,limit,e) \ - if ((nelems)+1 > (size)) \ - ((v)=cast(t *, luaM_growaux_(L,v,&(size),sizeof(t),limit,e))) - -#define luaM_reallocvector(L, v,oldn,n,t) \ - ((v)=cast(t *, luaM_reallocv(L, v, oldn, n, sizeof(t)))) - -LUAI_FUNC l_noret luaM_toobig (lua_State *L); - -/* not to be called directly */ -LUAI_FUNC void *luaM_realloc_ (lua_State *L, void *block, size_t oldsize, - size_t size); -LUAI_FUNC void *luaM_growaux_ (lua_State *L, void *block, int *size, - size_t size_elem, int limit, - const char *what); - -#endif - diff --git a/external/mit/lua/dist/src/loadlib.c b/external/mit/lua/dist/src/loadlib.c deleted file mode 100644 index d638269c4..000000000 --- a/external/mit/lua/dist/src/loadlib.c +++ /dev/null @@ -1,789 +0,0 @@ -/* $NetBSD: loadlib.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: loadlib.c,v 1.126 2015/02/16 13:14:33 roberto Exp -** Dynamic library loader for Lua -** See Copyright Notice in lua.h -** -** This module contains an implementation of loadlib for Unix systems -** that have dlfcn, an implementation for Windows, and a stub for other -** systems. -*/ - -#define loadlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** LUA_PATH_VAR and LUA_CPATH_VAR are the names of the environment -** variables that Lua check to set its paths. -*/ -#if !defined(LUA_PATH_VAR) -#define LUA_PATH_VAR "LUA_PATH" -#endif - -#if !defined(LUA_CPATH_VAR) -#define LUA_CPATH_VAR "LUA_CPATH" -#endif - -#define LUA_PATHSUFFIX "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR - -#define LUA_PATHVARVERSION LUA_PATH_VAR LUA_PATHSUFFIX -#define LUA_CPATHVARVERSION LUA_CPATH_VAR LUA_PATHSUFFIX - -/* -** LUA_PATH_SEP is the character that separates templates in a path. -** LUA_PATH_MARK is the string that marks the substitution points in a -** template. -** LUA_EXEC_DIR in a Windows path is replaced by the executable's -** directory. -** LUA_IGMARK is a mark to ignore all before it when building the -** luaopen_ function name. -*/ -#if !defined (LUA_PATH_SEP) -#define LUA_PATH_SEP ";" -#endif -#if !defined (LUA_PATH_MARK) -#define LUA_PATH_MARK "?" -#endif -#if !defined (LUA_EXEC_DIR) -#define LUA_EXEC_DIR "!" -#endif -#if !defined (LUA_IGMARK) -#define LUA_IGMARK "-" -#endif - - -/* -** LUA_CSUBSEP is the character that replaces dots in submodule names -** when searching for a C loader. -** LUA_LSUBSEP is the character that replaces dots in submodule names -** when searching for a Lua loader. -*/ -#if !defined(LUA_CSUBSEP) -#define LUA_CSUBSEP LUA_DIRSEP -#endif - -#if !defined(LUA_LSUBSEP) -#define LUA_LSUBSEP LUA_DIRSEP -#endif - - -/* prefix for open functions in C libraries */ -#define LUA_POF "luaopen_" - -/* separator for open functions in C libraries */ -#define LUA_OFSEP "_" - - -/* -** unique key for table in the registry that keeps handles -** for all loaded C libraries -*/ -static const int CLIBS = 0; - -#define LIB_FAIL "open" - -#define setprogdir(L) ((void)0) - - -/* -** system-dependent functions -*/ - -/* -** unload library 'lib' -*/ -static void lsys_unloadlib (void *lib); - -/* -** load C library in file 'path'. If 'seeglb', load with all names in -** the library global. -** Returns the library; in case of error, returns NULL plus an -** error string in the stack. -*/ -static void *lsys_load (lua_State *L, const char *path, int seeglb); - -/* -** Try to find a function named 'sym' in library 'lib'. -** Returns the function; in case of error, returns NULL plus an -** error string in the stack. -*/ -static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym); - - - - -#if defined(LUA_USE_DLOPEN) /* { */ -/* -** {======================================================================== -** This is an implementation of loadlib based on the dlfcn interface. -** The dlfcn interface is available in Linux, SunOS, Solaris, IRIX, FreeBSD, -** NetBSD, AIX 4.2, HPUX 11, and probably most other Unix flavors, at least -** as an emulation layer on top of native functions. -** ========================================================================= -*/ - -#include - -/* -** Macro to convert pointer-to-void* to pointer-to-function. This cast -** is undefined according to ISO C, but POSIX assumes that it works. -** (The '__extension__' in gnu compilers is only to avoid warnings.) -*/ -#if defined(__GNUC__) -#define cast_func(p) (__extension__ (lua_CFunction)(p)) -#else -#define cast_func(p) ((lua_CFunction)(p)) -#endif - - -static void lsys_unloadlib (void *lib) { - dlclose(lib); -} - - -static void *lsys_load (lua_State *L, const char *path, int seeglb) { - void *lib = dlopen(path, RTLD_NOW | (seeglb ? RTLD_GLOBAL : RTLD_LOCAL)); - if (lib == NULL) lua_pushstring(L, dlerror()); - return lib; -} - - -static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { - lua_CFunction f = cast_func(dlsym(lib, sym)); - if (f == NULL) lua_pushstring(L, dlerror()); - return f; -} - -/* }====================================================== */ - - - -#elif defined(LUA_DL_DLL) /* }{ */ -/* -** {====================================================================== -** This is an implementation of loadlib for Windows using native functions. -** ======================================================================= -*/ - -#include - -#undef setprogdir - -/* -** optional flags for LoadLibraryEx -*/ -#if !defined(LUA_LLE_FLAGS) -#define LUA_LLE_FLAGS 0 -#endif - - -static void setprogdir (lua_State *L) { - char buff[MAX_PATH + 1]; - char *lb; - DWORD nsize = sizeof(buff)/sizeof(char); - DWORD n = GetModuleFileNameA(NULL, buff, nsize); - if (n == 0 || n == nsize || (lb = strrchr(buff, '\\')) == NULL) - luaL_error(L, "unable to get ModuleFileName"); - else { - *lb = '\0'; - luaL_gsub(L, lua_tostring(L, -1), LUA_EXEC_DIR, buff); - lua_remove(L, -2); /* remove original string */ - } -} - - -static void pusherror (lua_State *L) { - int error = GetLastError(); - char buffer[128]; - if (FormatMessageA(FORMAT_MESSAGE_IGNORE_INSERTS | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error, 0, buffer, sizeof(buffer)/sizeof(char), NULL)) - lua_pushstring(L, buffer); - else - lua_pushfstring(L, "system error %d\n", error); -} - -static void lsys_unloadlib (void *lib) { - FreeLibrary((HMODULE)lib); -} - - -static void *lsys_load (lua_State *L, const char *path, int seeglb) { - HMODULE lib = LoadLibraryExA(path, NULL, LUA_LLE_FLAGS); - (void)(seeglb); /* not used: symbols are 'global' by default */ - if (lib == NULL) pusherror(L); - return lib; -} - - -static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { - lua_CFunction f = (lua_CFunction)GetProcAddress((HMODULE)lib, sym); - if (f == NULL) pusherror(L); - return f; -} - -/* }====================================================== */ - - -#else /* }{ */ -/* -** {====================================================== -** Fallback for other systems -** ======================================================= -*/ - -#undef LIB_FAIL -#define LIB_FAIL "absent" - - -#define DLMSG "dynamic libraries not enabled; check your Lua installation" - - -static void lsys_unloadlib (void *lib) { - (void)(lib); /* not used */ -} - - -static void *lsys_load (lua_State *L, const char *path, int seeglb) { - (void)(path); (void)(seeglb); /* not used */ - lua_pushliteral(L, DLMSG); - return NULL; -} - - -static lua_CFunction lsys_sym (lua_State *L, void *lib, const char *sym) { - (void)(lib); (void)(sym); /* not used */ - lua_pushliteral(L, DLMSG); - return NULL; -} - -/* }====================================================== */ -#endif /* } */ - - -/* -** return registry.CLIBS[path] -*/ -static void *checkclib (lua_State *L, const char *path) { - void *plib; - lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); - lua_getfield(L, -1, path); - plib = lua_touserdata(L, -1); /* plib = CLIBS[path] */ - lua_pop(L, 2); /* pop CLIBS table and 'plib' */ - return plib; -} - - -/* -** registry.CLIBS[path] = plib -- for queries -** registry.CLIBS[#CLIBS + 1] = plib -- also keep a list of all libraries -*/ -static void addtoclib (lua_State *L, const char *path, void *plib) { - lua_rawgetp(L, LUA_REGISTRYINDEX, &CLIBS); - lua_pushlightuserdata(L, plib); - lua_pushvalue(L, -1); - lua_setfield(L, -3, path); /* CLIBS[path] = plib */ - lua_rawseti(L, -2, luaL_len(L, -2) + 1); /* CLIBS[#CLIBS + 1] = plib */ - lua_pop(L, 1); /* pop CLIBS table */ -} - - -/* -** __gc tag method for CLIBS table: calls 'lsys_unloadlib' for all lib -** handles in list CLIBS -*/ -static int gctm (lua_State *L) { - lua_Integer n = luaL_len(L, 1); - for (; n >= 1; n--) { /* for each handle, in reverse order */ - lua_rawgeti(L, 1, n); /* get handle CLIBS[n] */ - lsys_unloadlib(lua_touserdata(L, -1)); - lua_pop(L, 1); /* pop handle */ - } - return 0; -} - - - -/* error codes for 'lookforfunc' */ -#define ERRLIB 1 -#define ERRFUNC 2 - -/* -** Look for a C function named 'sym' in a dynamically loaded library -** 'path'. -** First, check whether the library is already loaded; if not, try -** to load it. -** Then, if 'sym' is '*', return true (as library has been loaded). -** Otherwise, look for symbol 'sym' in the library and push a -** C function with that symbol. -** Return 0 and 'true' or a function in the stack; in case of -** errors, return an error code and an error message in the stack. -*/ -static int lookforfunc (lua_State *L, const char *path, const char *sym) { - void *reg = checkclib(L, path); /* check loaded C libraries */ - if (reg == NULL) { /* must load library? */ - reg = lsys_load(L, path, *sym == '*'); /* global symbols if 'sym'=='*' */ - if (reg == NULL) return ERRLIB; /* unable to load library */ - addtoclib(L, path, reg); - } - if (*sym == '*') { /* loading only library (no function)? */ - lua_pushboolean(L, 1); /* return 'true' */ - return 0; /* no errors */ - } - else { - lua_CFunction f = lsys_sym(L, reg, sym); - if (f == NULL) - return ERRFUNC; /* unable to find function */ - lua_pushcfunction(L, f); /* else create new function */ - return 0; /* no errors */ - } -} - - -static int ll_loadlib (lua_State *L) { - const char *path = luaL_checkstring(L, 1); - const char *init = luaL_checkstring(L, 2); - int stat = lookforfunc(L, path, init); - if (stat == 0) /* no errors? */ - return 1; /* return the loaded function */ - else { /* error; error message is on stack top */ - lua_pushnil(L); - lua_insert(L, -2); - lua_pushstring(L, (stat == ERRLIB) ? LIB_FAIL : "init"); - return 3; /* return nil, error message, and where */ - } -} - - - -/* -** {====================================================== -** 'require' function -** ======================================================= -*/ - - -static int readable (const char *filename) { - FILE *f = fopen(filename, "r"); /* try to open file */ - if (f == NULL) return 0; /* open failed */ - fclose(f); - return 1; -} - - -static const char *pushnexttemplate (lua_State *L, const char *path) { - const char *l; - while (*path == *LUA_PATH_SEP) path++; /* skip separators */ - if (*path == '\0') return NULL; /* no more templates */ - l = strchr(path, *LUA_PATH_SEP); /* find next separator */ - if (l == NULL) l = path + strlen(path); - lua_pushlstring(L, path, l - path); /* template */ - return l; -} - - -static const char *searchpath (lua_State *L, const char *name, - const char *path, - const char *sep, - const char *dirsep) { - luaL_Buffer msg; /* to build error message */ - luaL_buffinit(L, &msg); - if (*sep != '\0') /* non-empty separator? */ - name = luaL_gsub(L, name, sep, dirsep); /* replace it by 'dirsep' */ - while ((path = pushnexttemplate(L, path)) != NULL) { - const char *filename = luaL_gsub(L, lua_tostring(L, -1), - LUA_PATH_MARK, name); - lua_remove(L, -2); /* remove path template */ - if (readable(filename)) /* does file exist and is readable? */ - return filename; /* return that file name */ - lua_pushfstring(L, "\n\tno file '%s'", filename); - lua_remove(L, -2); /* remove file name */ - luaL_addvalue(&msg); /* concatenate error msg. entry */ - } - luaL_pushresult(&msg); /* create error message */ - return NULL; /* not found */ -} - - -static int ll_searchpath (lua_State *L) { - const char *f = searchpath(L, luaL_checkstring(L, 1), - luaL_checkstring(L, 2), - luaL_optstring(L, 3, "."), - luaL_optstring(L, 4, LUA_DIRSEP)); - if (f != NULL) return 1; - else { /* error message is on top of the stack */ - lua_pushnil(L); - lua_insert(L, -2); - return 2; /* return nil + error message */ - } -} - - -static const char *findfile (lua_State *L, const char *name, - const char *pname, - const char *dirsep) { - const char *path; - lua_getfield(L, lua_upvalueindex(1), pname); - path = lua_tostring(L, -1); - if (path == NULL) - luaL_error(L, "'package.%s' must be a string", pname); - return searchpath(L, name, path, ".", dirsep); -} - - -static int checkload (lua_State *L, int stat, const char *filename) { - if (stat) { /* module loaded successfully? */ - lua_pushstring(L, filename); /* will be 2nd argument to module */ - return 2; /* return open function and file name */ - } - else - return luaL_error(L, "error loading module '%s' from file '%s':\n\t%s", - lua_tostring(L, 1), filename, lua_tostring(L, -1)); -} - - -static int searcher_Lua (lua_State *L) { - const char *filename; - const char *name = luaL_checkstring(L, 1); - filename = findfile(L, name, "path", LUA_LSUBSEP); - if (filename == NULL) return 1; /* module not found in this path */ - return checkload(L, (luaL_loadfile(L, filename) == LUA_OK), filename); -} - - -/* -** Try to find a load function for module 'modname' at file 'filename'. -** First, change '.' to '_' in 'modname'; then, if 'modname' has -** the form X-Y (that is, it has an "ignore mark"), build a function -** name "luaopen_X" and look for it. (For compatibility, if that -** fails, it also tries "luaopen_Y".) If there is no ignore mark, -** look for a function named "luaopen_modname". -*/ -static int loadfunc (lua_State *L, const char *filename, const char *modname) { - const char *openfunc; - const char *mark; - modname = luaL_gsub(L, modname, ".", LUA_OFSEP); - mark = strchr(modname, *LUA_IGMARK); - if (mark) { - int stat; - openfunc = lua_pushlstring(L, modname, mark - modname); - openfunc = lua_pushfstring(L, LUA_POF"%s", openfunc); - stat = lookforfunc(L, filename, openfunc); - if (stat != ERRFUNC) return stat; - modname = mark + 1; /* else go ahead and try old-style name */ - } - openfunc = lua_pushfstring(L, LUA_POF"%s", modname); - return lookforfunc(L, filename, openfunc); -} - - -static int searcher_C (lua_State *L) { - const char *name = luaL_checkstring(L, 1); - const char *filename = findfile(L, name, "cpath", LUA_CSUBSEP); - if (filename == NULL) return 1; /* module not found in this path */ - return checkload(L, (loadfunc(L, filename, name) == 0), filename); -} - - -static int searcher_Croot (lua_State *L) { - const char *filename; - const char *name = luaL_checkstring(L, 1); - const char *p = strchr(name, '.'); - int stat; - if (p == NULL) return 0; /* is root */ - lua_pushlstring(L, name, p - name); - filename = findfile(L, lua_tostring(L, -1), "cpath", LUA_CSUBSEP); - if (filename == NULL) return 1; /* root not found */ - if ((stat = loadfunc(L, filename, name)) != 0) { - if (stat != ERRFUNC) - return checkload(L, 0, filename); /* real error */ - else { /* open function not found */ - lua_pushfstring(L, "\n\tno module '%s' in file '%s'", name, filename); - return 1; - } - } - lua_pushstring(L, filename); /* will be 2nd argument to module */ - return 2; -} - - -static int searcher_preload (lua_State *L) { - const char *name = luaL_checkstring(L, 1); - lua_getfield(L, LUA_REGISTRYINDEX, "_PRELOAD"); - if (lua_getfield(L, -1, name) == LUA_TNIL) /* not found? */ - lua_pushfstring(L, "\n\tno field package.preload['%s']", name); - return 1; -} - - -static void findloader (lua_State *L, const char *name) { - int i; - luaL_Buffer msg; /* to build error message */ - luaL_buffinit(L, &msg); - /* push 'package.searchers' to index 3 in the stack */ - if (lua_getfield(L, lua_upvalueindex(1), "searchers") != LUA_TTABLE) - luaL_error(L, "'package.searchers' must be a table"); - /* iterate over available searchers to find a loader */ - for (i = 1; ; i++) { - if (lua_rawgeti(L, 3, i) == LUA_TNIL) { /* no more searchers? */ - lua_pop(L, 1); /* remove nil */ - luaL_pushresult(&msg); /* create error message */ - luaL_error(L, "module '%s' not found:%s", name, lua_tostring(L, -1)); - } - lua_pushstring(L, name); - lua_call(L, 1, 2); /* call it */ - if (lua_isfunction(L, -2)) /* did it find a loader? */ - return; /* module loader found */ - else if (lua_isstring(L, -2)) { /* searcher returned error message? */ - lua_pop(L, 1); /* remove extra return */ - luaL_addvalue(&msg); /* concatenate error message */ - } - else - lua_pop(L, 2); /* remove both returns */ - } -} - - -static int ll_require (lua_State *L) { - const char *name = luaL_checkstring(L, 1); - lua_settop(L, 1); /* _LOADED table will be at index 2 */ - lua_getfield(L, LUA_REGISTRYINDEX, "_LOADED"); - lua_getfield(L, 2, name); /* _LOADED[name] */ - if (lua_toboolean(L, -1)) /* is it there? */ - return 1; /* package is already loaded */ - /* else must load package */ - lua_pop(L, 1); /* remove 'getfield' result */ - findloader(L, name); - lua_pushstring(L, name); /* pass name as argument to module loader */ - lua_insert(L, -2); /* name is 1st argument (before search data) */ - lua_call(L, 2, 1); /* run loader to load module */ - if (!lua_isnil(L, -1)) /* non-nil return? */ - lua_setfield(L, 2, name); /* _LOADED[name] = returned value */ - if (lua_getfield(L, 2, name) == LUA_TNIL) { /* module set no value? */ - lua_pushboolean(L, 1); /* use true as result */ - lua_pushvalue(L, -1); /* extra copy to be returned */ - lua_setfield(L, 2, name); /* _LOADED[name] = true */ - } - return 1; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** 'module' function -** ======================================================= -*/ -#if defined(LUA_COMPAT_MODULE) - -/* -** changes the environment variable of calling function -*/ -static void set_env (lua_State *L) { - lua_Debug ar; - if (lua_getstack(L, 1, &ar) == 0 || - lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ - lua_iscfunction(L, -1)) - luaL_error(L, "'module' not called from a Lua function"); - lua_pushvalue(L, -2); /* copy new environment table to top */ - lua_setupvalue(L, -2, 1); - lua_pop(L, 1); /* remove function */ -} - - -static void dooptions (lua_State *L, int n) { - int i; - for (i = 2; i <= n; i++) { - if (lua_isfunction(L, i)) { /* avoid 'calling' extra info. */ - lua_pushvalue(L, i); /* get option (a function) */ - lua_pushvalue(L, -2); /* module */ - lua_call(L, 1, 0); - } - } -} - - -static void modinit (lua_State *L, const char *modname) { - const char *dot; - lua_pushvalue(L, -1); - lua_setfield(L, -2, "_M"); /* module._M = module */ - lua_pushstring(L, modname); - lua_setfield(L, -2, "_NAME"); - dot = strrchr(modname, '.'); /* look for last dot in module name */ - if (dot == NULL) dot = modname; - else dot++; - /* set _PACKAGE as package name (full module name minus last part) */ - lua_pushlstring(L, modname, dot - modname); - lua_setfield(L, -2, "_PACKAGE"); -} - - -static int ll_module (lua_State *L) { - const char *modname = luaL_checkstring(L, 1); - int lastarg = lua_gettop(L); /* last parameter */ - luaL_pushmodule(L, modname, 1); /* get/create module table */ - /* check whether table already has a _NAME field */ - if (lua_getfield(L, -1, "_NAME") != LUA_TNIL) - lua_pop(L, 1); /* table is an initialized module */ - else { /* no; initialize it */ - lua_pop(L, 1); - modinit(L, modname); - } - lua_pushvalue(L, -1); - set_env(L); - dooptions(L, lastarg); - return 1; -} - - -static int ll_seeall (lua_State *L) { - luaL_checktype(L, 1, LUA_TTABLE); - if (!lua_getmetatable(L, 1)) { - lua_createtable(L, 0, 1); /* create new metatable */ - lua_pushvalue(L, -1); - lua_setmetatable(L, 1); - } - lua_pushglobaltable(L); - lua_setfield(L, -2, "__index"); /* mt.__index = _G */ - return 0; -} - -#endif -/* }====================================================== */ - - - -/* auxiliary mark (for internal use) */ -#define AUXMARK "\1" - - -/* -** return registry.LUA_NOENV as a boolean -*/ -static int noenv (lua_State *L) { - int b; - lua_getfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); - b = lua_toboolean(L, -1); - lua_pop(L, 1); /* remove value */ - return b; -} - - -static void setpath (lua_State *L, const char *fieldname, const char *envname1, - const char *envname2, const char *def) { - const char *path = getenv(envname1); - if (path == NULL) /* no environment variable? */ - path = getenv(envname2); /* try alternative name */ - if (path == NULL || noenv(L)) /* no environment variable? */ - lua_pushstring(L, def); /* use default */ - else { - /* replace ";;" by ";AUXMARK;" and then AUXMARK by default path */ - path = luaL_gsub(L, path, LUA_PATH_SEP LUA_PATH_SEP, - LUA_PATH_SEP AUXMARK LUA_PATH_SEP); - luaL_gsub(L, path, AUXMARK, def); - lua_remove(L, -2); - } - setprogdir(L); - lua_setfield(L, -2, fieldname); -} - - -static const luaL_Reg pk_funcs[] = { - {"loadlib", ll_loadlib}, - {"searchpath", ll_searchpath}, -#if defined(LUA_COMPAT_MODULE) - {"seeall", ll_seeall}, -#endif - /* placeholders */ - {"preload", NULL}, - {"cpath", NULL}, - {"path", NULL}, - {"searchers", NULL}, - {"loaded", NULL}, - {NULL, NULL} -}; - - -static const luaL_Reg ll_funcs[] = { -#if defined(LUA_COMPAT_MODULE) - {"module", ll_module}, -#endif - {"require", ll_require}, - {NULL, NULL} -}; - - -static void createsearcherstable (lua_State *L) { - static const lua_CFunction searchers[] = - {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL}; - int i; - /* create 'searchers' table */ - lua_createtable(L, sizeof(searchers)/sizeof(searchers[0]) - 1, 0); - /* fill it with pre-defined searchers */ - for (i=0; searchers[i] != NULL; i++) { - lua_pushvalue(L, -2); /* set 'package' as upvalue for all searchers */ - lua_pushcclosure(L, searchers[i], 1); - lua_rawseti(L, -2, i+1); - } -#if defined(LUA_COMPAT_LOADERS) - lua_pushvalue(L, -1); /* make a copy of 'searchers' table */ - lua_setfield(L, -3, "loaders"); /* put it in field 'loaders' */ -#endif - lua_setfield(L, -2, "searchers"); /* put it in field 'searchers' */ -} - - -/* -** create table CLIBS to keep track of loaded C libraries, -** setting a finalizer to close all libraries when closing state. -*/ -static void createclibstable (lua_State *L) { - lua_newtable(L); /* create CLIBS table */ - lua_createtable(L, 0, 1); /* create metatable for CLIBS */ - lua_pushcfunction(L, gctm); - lua_setfield(L, -2, "__gc"); /* set finalizer for CLIBS table */ - lua_setmetatable(L, -2); - lua_rawsetp(L, LUA_REGISTRYINDEX, &CLIBS); /* set CLIBS table in registry */ -} - - -LUAMOD_API int luaopen_package (lua_State *L) { - createclibstable(L); - luaL_newlib(L, pk_funcs); /* create 'package' table */ - createsearcherstable(L); - /* set field 'path' */ - setpath(L, "path", LUA_PATHVARVERSION, LUA_PATH_VAR, LUA_PATH_DEFAULT); - /* set field 'cpath' */ - setpath(L, "cpath", LUA_CPATHVARVERSION, LUA_CPATH_VAR, LUA_CPATH_DEFAULT); - /* store config information */ - lua_pushliteral(L, LUA_DIRSEP "\n" LUA_PATH_SEP "\n" LUA_PATH_MARK "\n" - LUA_EXEC_DIR "\n" LUA_IGMARK "\n"); - lua_setfield(L, -2, "config"); - /* set field 'loaded' */ - luaL_getsubtable(L, LUA_REGISTRYINDEX, "_LOADED"); - lua_setfield(L, -2, "loaded"); - /* set field 'preload' */ - luaL_getsubtable(L, LUA_REGISTRYINDEX, "_PRELOAD"); - lua_setfield(L, -2, "preload"); - lua_pushglobaltable(L); - lua_pushvalue(L, -2); /* set 'package' as upvalue for next lib */ - luaL_setfuncs(L, ll_funcs, 1); /* open lib into global table */ - lua_pop(L, 1); /* pop global table */ - return 1; /* return 'package' table */ -} - diff --git a/external/mit/lua/dist/src/lobject.c b/external/mit/lua/dist/src/lobject.c deleted file mode 100644 index dd05f1da8..000000000 --- a/external/mit/lua/dist/src/lobject.c +++ /dev/null @@ -1,510 +0,0 @@ -/* $NetBSD: lobject.c,v 1.5 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lobject.c,v 2.104 2015/04/11 18:30:08 roberto Exp -** Some generic functions over Lua objects -** See Copyright Notice in lua.h -*/ - -#define lobject_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#include -#include -#include -#include -#endif - -#include "lua.h" - -#include "lctype.h" -#include "ldebug.h" -#include "ldo.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "lvm.h" - - - -LUAI_DDEF const TValue luaO_nilobject_ = {NILCONSTANT}; - - -/* -** converts an integer to a "floating point byte", represented as -** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if -** eeeee != 0 and (xxx) otherwise. -*/ -int luaO_int2fb (unsigned int x) { - int e = 0; /* exponent */ - if (x < 8) return x; - while (x >= (8 << 4)) { /* coarse steps */ - x = (x + 0xf) >> 4; /* x = ceil(x / 16) */ - e += 4; - } - while (x >= (8 << 1)) { /* fine steps */ - x = (x + 1) >> 1; /* x = ceil(x / 2) */ - e++; - } - return ((e+1) << 3) | (cast_int(x) - 8); -} - - -/* converts back */ -int luaO_fb2int (int x) { - int e = (x >> 3) & 0x1f; - if (e == 0) return x; - else return ((x & 7) + 8) << (e - 1); -} - - -/* -** Computes ceil(log2(x)) -*/ -int luaO_ceillog2 (unsigned int x) { - static const lu_byte log_2[256] = { /* log_2[i] = ceil(log2(i - 1)) */ - 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, - 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8, - 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8 - }; - int l = 0; - x--; - while (x >= 256) { l += 8; x >>= 8; } - return l + log_2[x]; -} - - -static lua_Integer intarith (lua_State *L, int op, lua_Integer v1, - lua_Integer v2) { - switch (op) { - case LUA_OPADD: return intop(+, v1, v2); - case LUA_OPSUB:return intop(-, v1, v2); - case LUA_OPMUL:return intop(*, v1, v2); - case LUA_OPMOD: return luaV_mod(L, v1, v2); - case LUA_OPIDIV: return luaV_div(L, v1, v2); - case LUA_OPBAND: return intop(&, v1, v2); - case LUA_OPBOR: return intop(|, v1, v2); - case LUA_OPBXOR: return intop(^, v1, v2); - case LUA_OPSHL: return luaV_shiftl(v1, v2); - case LUA_OPSHR: return luaV_shiftl(v1, -v2); - case LUA_OPUNM: return intop(-, 0, v1); - case LUA_OPBNOT: return intop(^, ~l_castS2U(0), v1); - default: lua_assert(0); return 0; - } -} - - -#ifndef _KERNEL -static lua_Number numarith (lua_State *L, int op, lua_Number v1, - lua_Number v2) { - switch (op) { - case LUA_OPADD: return luai_numadd(L, v1, v2); - case LUA_OPSUB: return luai_numsub(L, v1, v2); - case LUA_OPMUL: return luai_nummul(L, v1, v2); - case LUA_OPDIV: return luai_numdiv(L, v1, v2); - case LUA_OPPOW: return luai_numpow(L, v1, v2); - case LUA_OPIDIV: return luai_numidiv(L, v1, v2); - case LUA_OPUNM: return luai_numunm(L, v1); - case LUA_OPMOD: { - lua_Number m; - luai_nummod(L, v1, v2, m); - return m; - } - default: lua_assert(0); return 0; - } -} -#endif - - -void luaO_arith (lua_State *L, int op, const TValue *p1, const TValue *p2, - TValue *res) { - switch (op) { - case LUA_OPBAND: case LUA_OPBOR: case LUA_OPBXOR: - case LUA_OPSHL: case LUA_OPSHR: - case LUA_OPBNOT: { /* operate only on integers */ - lua_Integer i1; lua_Integer i2; - if (tointeger(p1, &i1) && tointeger(p2, &i2)) { - setivalue(res, intarith(L, op, i1, i2)); - return; - } - else break; /* go to the end */ - } -#ifndef _KERNEL - case LUA_OPDIV: case LUA_OPPOW: { /* operate only on floats */ - lua_Number n1; lua_Number n2; - if (tonumber(p1, &n1) && tonumber(p2, &n2)) { - setfltvalue(res, numarith(L, op, n1, n2)); - return; - } - else break; /* go to the end */ - } -#endif - default: { /* other operations */ -#ifndef _KERNEL - lua_Number n1; lua_Number n2; - if (ttisinteger(p1) && ttisinteger(p2)) { - setivalue(res, intarith(L, op, ivalue(p1), ivalue(p2))); - return; - } - else if (tonumber(p1, &n1) && tonumber(p2, &n2)) { - setfltvalue(res, numarith(L, op, n1, n2)); - return; - } -#else /* _KERNEL */ - lua_Integer i1; lua_Integer i2; - if (tointeger(p1, &i1) && tointeger(p2, &i2)) { - setivalue(res, intarith(L, op, i1, i2)); - return; - } -#endif - else break; /* go to the end */ - } - } - /* could not perform raw operation; try metamethod */ - lua_assert(L != NULL); /* should not fail when folding (compile time) */ - luaT_trybinTM(L, p1, p2, res, cast(TMS, (op - LUA_OPADD) + TM_ADD)); -} - - -int luaO_hexavalue (int c) { - if (lisdigit(c)) return c - '0'; - else return (ltolower(c) - 'a') + 10; -} - - -static int isneg (const char **s) { - if (**s == '-') { (*s)++; return 1; } - else if (**s == '+') (*s)++; - return 0; -} - - - -#ifndef _KERNEL -/* -** {================================================================== -** Lua's implementation for 'lua_strx2number' -** =================================================================== -*/ - -#if !defined(lua_strx2number) - -/* maximum number of significant digits to read (to avoid overflows - even with single floats) */ -#define MAXSIGDIG 30 - -/* -** convert an hexadecimal numeric string to a number, following -** C99 specification for 'strtod' -*/ -static lua_Number lua_strx2number (const char *s, char **endptr) { - int dot = lua_getlocaledecpoint(); - lua_Number r = 0.0; /* result (accumulator) */ - int sigdig = 0; /* number of significant digits */ - int nosigdig = 0; /* number of non-significant digits */ - int e = 0; /* exponent correction */ - int neg; /* 1 if number is negative */ - int hasdot = 0; /* true after seen a dot */ - *endptr = cast(char *, s); /* nothing is valid yet */ - while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ - neg = isneg(&s); /* check signal */ - if (!(*s == '0' && (*(s + 1) == 'x' || *(s + 1) == 'X'))) /* check '0x' */ - return 0.0; /* invalid format (no '0x') */ - for (s += 2; ; s++) { /* skip '0x' and read numeral */ - if (*s == dot) { - if (hasdot) break; /* second dot? stop loop */ - else hasdot = 1; - } - else if (lisxdigit(cast_uchar(*s))) { - if (sigdig == 0 && *s == '0') /* non-significant digit (zero)? */ - nosigdig++; - else if (++sigdig <= MAXSIGDIG) /* can read it without overflow? */ - r = (r * cast_num(16.0)) + luaO_hexavalue(*s); - else e++; /* too many digits; ignore, but still count for exponent */ - if (hasdot) e--; /* decimal digit? correct exponent */ - } - else break; /* neither a dot nor a digit */ - } - if (nosigdig + sigdig == 0) /* no digits? */ - return 0.0; /* invalid format */ - *endptr = cast(char *, s); /* valid up to here */ - e *= 4; /* each digit multiplies/divides value by 2^4 */ - if (*s == 'p' || *s == 'P') { /* exponent part? */ - int exp1 = 0; /* exponent value */ - int neg1; /* exponent signal */ - s++; /* skip 'p' */ - neg1 = isneg(&s); /* signal */ - if (!lisdigit(cast_uchar(*s))) - return 0.0; /* invalid; must have at least one digit */ - while (lisdigit(cast_uchar(*s))) /* read exponent */ - exp1 = exp1 * 10 + *(s++) - '0'; - if (neg1) exp1 = -exp1; - e += exp1; - *endptr = cast(char *, s); /* valid up to here */ - } - if (neg) r = -r; - return l_mathop(ldexp)(r, e); -} - -#endif -/* }====================================================== */ - - -static const char *l_str2d (const char *s, lua_Number *result) { - char *endptr; - if (strpbrk(s, "nN")) /* reject 'inf' and 'nan' */ - return NULL; - else if (strpbrk(s, "xX")) /* hex? */ - *result = lua_strx2number(s, &endptr); - else - *result = lua_str2number(s, &endptr); - if (endptr == s) return NULL; /* nothing recognized */ - while (lisspace(cast_uchar(*endptr))) endptr++; - return (*endptr == '\0' ? endptr : NULL); /* OK if no trailing characters */ -} -#endif /* _KERNEL */ - - -static const char *l_str2int (const char *s, lua_Integer *result) { - lua_Unsigned a = 0; - int empty = 1; - int neg; - while (lisspace(cast_uchar(*s))) s++; /* skip initial spaces */ - neg = isneg(&s); - if (s[0] == '0' && - (s[1] == 'x' || s[1] == 'X')) { /* hex? */ - s += 2; /* skip '0x' */ - for (; lisxdigit(cast_uchar(*s)); s++) { - a = a * 16 + luaO_hexavalue(*s); - empty = 0; - } - } - else { /* decimal */ - for (; lisdigit(cast_uchar(*s)); s++) { - a = a * 10 + *s - '0'; - empty = 0; - } - } - while (lisspace(cast_uchar(*s))) s++; /* skip trailing spaces */ - if (empty || *s != '\0') return NULL; /* something wrong in the numeral */ - else { - *result = l_castU2S((neg) ? 0u - a : a); - return s; - } -} - - -size_t luaO_str2num (const char *s, TValue *o) { -#ifndef _KERNEL - lua_Integer i; lua_Number n; -#else /* _KERNEL */ - lua_Integer i; -#endif - const char *e; - if ((e = l_str2int(s, &i)) != NULL) { /* try as an integer */ - setivalue(o, i); - } -#ifndef _KERNEL - else if ((e = l_str2d(s, &n)) != NULL) { /* else try as a float */ - setfltvalue(o, n); - } -#endif - else - return 0; /* conversion failed */ - return (e - s) + 1; /* success; return string size */ -} - - -int luaO_utf8esc (char *buff, unsigned long x) { - int n = 1; /* number of bytes put in buffer (backwards) */ - lua_assert(x <= 0x10FFFF); - if (x < 0x80) /* ascii? */ - buff[UTF8BUFFSZ - 1] = cast(char, x); - else { /* need continuation bytes */ - unsigned int mfb = 0x3f; /* maximum that fits in first byte */ - do { /* add continuation bytes */ - buff[UTF8BUFFSZ - (n++)] = cast(char, 0x80 | (x & 0x3f)); - x >>= 6; /* remove added bits */ - mfb >>= 1; /* now there is one less bit available in first byte */ - } while (x > mfb); /* still needs continuation byte? */ - buff[UTF8BUFFSZ - n] = cast(char, (~mfb << 1) | x); /* add first byte */ - } - return n; -} - - -/* maximum length of the conversion of a number to a string */ -#define MAXNUMBER2STR 50 - - -/* -** Convert a number object to a string -*/ -void luaO_tostring (lua_State *L, StkId obj) { - char buff[MAXNUMBER2STR]; - size_t len; - lua_assert(ttisnumber(obj)); -#ifndef _KERNEL - if (ttisinteger(obj)) - len = lua_integer2str(buff, ivalue(obj)); - else { - len = lua_number2str(buff, fltvalue(obj)); -#if !defined(LUA_COMPAT_FLOATSTRING) - if (buff[strspn(buff, "-0123456789")] == '\0') { /* looks like an int? */ - buff[len++] = lua_getlocaledecpoint(); - buff[len++] = '0'; /* adds '.0' to result */ - } -#endif - } -#else /* _KERNEL */ - lua_assert(ttisinteger(obj)); - len = lua_integer2str(buff, ivalue(obj)); -#endif - setsvalue2s(L, obj, luaS_newlstr(L, buff, len)); -} - - -static void pushstr (lua_State *L, const char *str, size_t l) { - setsvalue2s(L, L->top++, luaS_newlstr(L, str, l)); -} - - -/* this function handles only '%d', '%c', '%f', '%p', and '%s' - conventional formats, plus Lua-specific '%I' and '%U' */ -const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { - int n = 0; - for (;;) { - const char *e = strchr(fmt, '%'); - if (e == NULL) break; - luaD_checkstack(L, 2); /* fmt + item */ - pushstr(L, fmt, e - fmt); - switch (*(e+1)) { - case 's': { - const char *s = va_arg(argp, char *); - if (s == NULL) s = "(null)"; - pushstr(L, s, strlen(s)); - break; - } - case 'c': { - char buff = cast(char, va_arg(argp, int)); - if (lisprint(cast_uchar(buff))) - pushstr(L, &buff, 1); - else /* non-printable character; print its code */ - luaO_pushfstring(L, "<\\%d>", cast_uchar(buff)); - break; - } - case 'd': { - setivalue(L->top++, va_arg(argp, int)); - luaO_tostring(L, L->top - 1); - break; - } - case 'I': { - setivalue(L->top++, cast(lua_Integer, va_arg(argp, l_uacInt))); - luaO_tostring(L, L->top - 1); - break; - } -#ifndef _KERNEL - case 'f': { - setfltvalue(L->top++, cast_num(va_arg(argp, l_uacNumber))); - luaO_tostring(L, L->top - 1); - break; - } -#endif - case 'p': { - char buff[4*sizeof(void *) + 8]; /* should be enough space for a '%p' */ - int l = sprintf(buff, "%p", va_arg(argp, void *)); - pushstr(L, buff, l); - break; - } - case 'U': { - char buff[UTF8BUFFSZ]; - int l = luaO_utf8esc(buff, cast(long, va_arg(argp, long))); - pushstr(L, buff + UTF8BUFFSZ - l, l); - break; - } - case '%': { - pushstr(L, "%", 1); - break; - } - default: { - luaG_runerror(L, "invalid option '%%%c' to 'lua_pushfstring'", - *(e + 1)); - } - } - n += 2; - fmt = e+2; - } - luaD_checkstack(L, 1); - pushstr(L, fmt, strlen(fmt)); - if (n > 0) luaV_concat(L, n + 1); - return svalue(L->top - 1); -} - - -const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { - const char *msg; - va_list argp; - va_start(argp, fmt); - msg = luaO_pushvfstring(L, fmt, argp); - va_end(argp); - return msg; -} - - -/* number of chars of a literal string without the ending \0 */ -#define LL(x) (sizeof(x)/sizeof(char) - 1) - -#define RETS "..." -#define PRE "[string \"" -#define POS "\"]" - -#define addstr(a,b,l) ( memcpy(a,b,(l) * sizeof(char)), a += (l) ) - -void luaO_chunkid (char *out, const char *source, size_t bufflen) { - size_t l = strlen(source); - if (*source == '=') { /* 'literal' source */ - if (l <= bufflen) /* small enough? */ - memcpy(out, source + 1, l * sizeof(char)); - else { /* truncate it */ - addstr(out, source + 1, bufflen - 1); - *out = '\0'; - } - } - else if (*source == '@') { /* file name */ - if (l <= bufflen) /* small enough? */ - memcpy(out, source + 1, l * sizeof(char)); - else { /* add '...' before rest of name */ - addstr(out, RETS, LL(RETS)); - bufflen -= LL(RETS); - memcpy(out, source + 1 + l - bufflen, bufflen * sizeof(char)); - } - } - else { /* string; format as [string "source"] */ - const char *nl = strchr(source, '\n'); /* find first new line (if any) */ - addstr(out, PRE, LL(PRE)); /* add prefix */ - bufflen -= LL(PRE RETS POS) + 1; /* save space for prefix+suffix+'\0' */ - if (l < bufflen && nl == NULL) { /* small one-line source? */ - addstr(out, source, l); /* keep it */ - } - else { - if (nl != NULL) l = nl - source; /* stop at first newline */ - if (l > bufflen) l = bufflen; - addstr(out, source, l); - addstr(out, RETS, LL(RETS)); - } - memcpy(out, POS, (LL(POS) + 1) * sizeof(char)); - } -} - diff --git a/external/mit/lua/dist/src/lobject.h b/external/mit/lua/dist/src/lobject.h deleted file mode 100644 index b5676d3f5..000000000 --- a/external/mit/lua/dist/src/lobject.h +++ /dev/null @@ -1,567 +0,0 @@ -/* $NetBSD: lobject.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lobject.h,v 2.111 2015/06/09 14:21:42 roberto Exp -** Type definitions for Lua objects -** See Copyright Notice in lua.h -*/ - - -#ifndef lobject_h -#define lobject_h - - -#include - - -#include "llimits.h" -#include "lua.h" - - -/* -** Extra tags for non-values -*/ -#define LUA_TPROTO LUA_NUMTAGS -#define LUA_TDEADKEY (LUA_NUMTAGS+1) - -/* -** number of all possible tags (including LUA_TNONE but excluding DEADKEY) -*/ -#define LUA_TOTALTAGS (LUA_TPROTO + 2) - - -/* -** tags for Tagged Values have the following use of bits: -** bits 0-3: actual tag (a LUA_T* value) -** bits 4-5: variant bits -** bit 6: whether value is collectable -*/ - - -/* -** LUA_TFUNCTION variants: -** 0 - Lua function -** 1 - light C function -** 2 - regular C function (closure) -*/ - -/* Variant tags for functions */ -#define LUA_TLCL (LUA_TFUNCTION | (0 << 4)) /* Lua closure */ -#define LUA_TLCF (LUA_TFUNCTION | (1 << 4)) /* light C function */ -#define LUA_TCCL (LUA_TFUNCTION | (2 << 4)) /* C closure */ - - -/* Variant tags for strings */ -#define LUA_TSHRSTR (LUA_TSTRING | (0 << 4)) /* short strings */ -#define LUA_TLNGSTR (LUA_TSTRING | (1 << 4)) /* long strings */ - - -/* Variant tags for numbers */ -#ifndef _KERNEL -#define LUA_TNUMFLT (LUA_TNUMBER | (0 << 4)) /* float numbers */ -#endif -#define LUA_TNUMINT (LUA_TNUMBER | (1 << 4)) /* integer numbers */ - - -/* Bit mark for collectable types */ -#define BIT_ISCOLLECTABLE (1 << 6) - -/* mark a tag as collectable */ -#define ctb(t) ((t) | BIT_ISCOLLECTABLE) - - -/* -** Common type for all collectable objects -*/ -typedef struct GCObject GCObject; - - -/* -** Common Header for all collectable objects (in macro form, to be -** included in other objects) -*/ -#define CommonHeader GCObject *next; lu_byte tt; lu_byte marked - - -/* -** Common type has only the common header -*/ -struct GCObject { - CommonHeader; -}; - - - -/* -** Union of all Lua values -*/ -typedef union Value Value; - - - - -/* -** Tagged Values. This is the basic representation of values in Lua, -** an actual value plus a tag with its type. -*/ - -#define TValuefields Value value_; int tt_ - -typedef struct lua_TValue TValue; - - -/* macro defining a nil value */ -#define NILCONSTANT {NULL}, LUA_TNIL - - -#define val_(o) ((o)->value_) - - -/* raw type tag of a TValue */ -#define rttype(o) ((o)->tt_) - -/* tag with no variants (bits 0-3) */ -#define novariant(x) ((x) & 0x0F) - -/* type tag of a TValue (bits 0-3 for tags + variant bits 4-5) */ -#define ttype(o) (rttype(o) & 0x3F) - -/* type tag of a TValue with no variants (bits 0-3) */ -#define ttnov(o) (novariant(rttype(o))) - - -/* Macros to test type */ -#define checktag(o,t) (rttype(o) == (t)) -#define checktype(o,t) (ttnov(o) == (t)) -#define ttisnumber(o) checktype((o), LUA_TNUMBER) -#ifndef _KERNEL -#define ttisfloat(o) checktag((o), LUA_TNUMFLT) -#endif -#define ttisinteger(o) checktag((o), LUA_TNUMINT) -#define ttisnil(o) checktag((o), LUA_TNIL) -#define ttisboolean(o) checktag((o), LUA_TBOOLEAN) -#define ttislightuserdata(o) checktag((o), LUA_TLIGHTUSERDATA) -#define ttisstring(o) checktype((o), LUA_TSTRING) -#define ttisshrstring(o) checktag((o), ctb(LUA_TSHRSTR)) -#define ttislngstring(o) checktag((o), ctb(LUA_TLNGSTR)) -#define ttistable(o) checktag((o), ctb(LUA_TTABLE)) -#define ttisfunction(o) checktype(o, LUA_TFUNCTION) -#define ttisclosure(o) ((rttype(o) & 0x1F) == LUA_TFUNCTION) -#define ttisCclosure(o) checktag((o), ctb(LUA_TCCL)) -#define ttisLclosure(o) checktag((o), ctb(LUA_TLCL)) -#define ttislcf(o) checktag((o), LUA_TLCF) -#define ttisfulluserdata(o) checktag((o), ctb(LUA_TUSERDATA)) -#define ttisthread(o) checktag((o), ctb(LUA_TTHREAD)) -#define ttisdeadkey(o) checktag((o), LUA_TDEADKEY) - - -/* Macros to access values */ -#define ivalue(o) check_exp(ttisinteger(o), val_(o).i) -#ifndef _KERNEL -#define fltvalue(o) check_exp(ttisfloat(o), val_(o).n) -#define nvalue(o) check_exp(ttisnumber(o), \ - (ttisinteger(o) ? cast_num(ivalue(o)) : fltvalue(o))) -#else /* _KERNEL */ -#define nvalue(o) check_exp(ttisnumber(o), cast_num(ivalue(o))) -#endif -#define gcvalue(o) check_exp(iscollectable(o), val_(o).gc) -#define pvalue(o) check_exp(ttislightuserdata(o), val_(o).p) -#define tsvalue(o) check_exp(ttisstring(o), gco2ts(val_(o).gc)) -#define uvalue(o) check_exp(ttisfulluserdata(o), gco2u(val_(o).gc)) -#define clvalue(o) check_exp(ttisclosure(o), gco2cl(val_(o).gc)) -#define clLvalue(o) check_exp(ttisLclosure(o), gco2lcl(val_(o).gc)) -#define clCvalue(o) check_exp(ttisCclosure(o), gco2ccl(val_(o).gc)) -#define fvalue(o) check_exp(ttislcf(o), val_(o).f) -#define hvalue(o) check_exp(ttistable(o), gco2t(val_(o).gc)) -#define bvalue(o) check_exp(ttisboolean(o), val_(o).b) -#define thvalue(o) check_exp(ttisthread(o), gco2th(val_(o).gc)) -/* a dead value may get the 'gc' field, but cannot access its contents */ -#define deadvalue(o) check_exp(ttisdeadkey(o), cast(void *, val_(o).gc)) - -#define l_isfalse(o) (ttisnil(o) || (ttisboolean(o) && bvalue(o) == 0)) - - -#define iscollectable(o) (rttype(o) & BIT_ISCOLLECTABLE) - - -/* Macros for internal tests */ -#define righttt(obj) (ttype(obj) == gcvalue(obj)->tt) - -#define checkliveness(g,obj) \ - lua_longassert(!iscollectable(obj) || \ - (righttt(obj) && !isdead(g,gcvalue(obj)))) - - -/* Macros to set values */ -#define settt_(o,t) ((o)->tt_=(t)) - -#ifndef _KERNEL -#define setfltvalue(obj,x) \ - { TValue *io=(obj); val_(io).n=(x); settt_(io, LUA_TNUMFLT); } -#endif - -#define chgfltvalue(obj,x) \ - { TValue *io=(obj); lua_assert(ttisfloat(io)); val_(io).n=(x); } - -#define setivalue(obj,x) \ - { TValue *io=(obj); val_(io).i=(x); settt_(io, LUA_TNUMINT); } - -#define chgivalue(obj,x) \ - { TValue *io=(obj); lua_assert(ttisinteger(io)); val_(io).i=(x); } - -#define setnilvalue(obj) settt_(obj, LUA_TNIL) - -#define setfvalue(obj,x) \ - { TValue *io=(obj); val_(io).f=(x); settt_(io, LUA_TLCF); } - -#define setpvalue(obj,x) \ - { TValue *io=(obj); val_(io).p=(x); settt_(io, LUA_TLIGHTUSERDATA); } - -#define setbvalue(obj,x) \ - { TValue *io=(obj); val_(io).b=(x); settt_(io, LUA_TBOOLEAN); } - -#define setgcovalue(L,obj,x) \ - { TValue *io = (obj); GCObject *i_g=(x); \ - val_(io).gc = i_g; settt_(io, ctb(i_g->tt)); } - -#define setsvalue(L,obj,x) \ - { TValue *io = (obj); TString *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(x_->tt)); \ - checkliveness(G(L),io); } - -#define setuvalue(L,obj,x) \ - { TValue *io = (obj); Udata *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TUSERDATA)); \ - checkliveness(G(L),io); } - -#define setthvalue(L,obj,x) \ - { TValue *io = (obj); lua_State *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTHREAD)); \ - checkliveness(G(L),io); } - -#define setclLvalue(L,obj,x) \ - { TValue *io = (obj); LClosure *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TLCL)); \ - checkliveness(G(L),io); } - -#define setclCvalue(L,obj,x) \ - { TValue *io = (obj); CClosure *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TCCL)); \ - checkliveness(G(L),io); } - -#define sethvalue(L,obj,x) \ - { TValue *io = (obj); Table *x_ = (x); \ - val_(io).gc = obj2gco(x_); settt_(io, ctb(LUA_TTABLE)); \ - checkliveness(G(L),io); } - -#define setdeadvalue(obj) settt_(obj, LUA_TDEADKEY) - - - -#define setobj(L,obj1,obj2) \ - { TValue *io1=(obj1); *io1 = *(obj2); \ - (void)L; checkliveness(G(L),io1); } - - -/* -** different types of assignments, according to destination -*/ - -/* from stack to (same) stack */ -#define setobjs2s setobj -/* to stack (not from same stack) */ -#define setobj2s setobj -#define setsvalue2s setsvalue -#define sethvalue2s sethvalue -#define setptvalue2s setptvalue -/* from table to same table */ -#define setobjt2t setobj -/* to table */ -#define setobj2t setobj -/* to new object */ -#define setobj2n setobj -#define setsvalue2n setsvalue - - - - -/* -** {====================================================== -** types and prototypes -** ======================================================= -*/ - - -union Value { - GCObject *gc; /* collectable objects */ - void *p; /* light userdata */ - int b; /* booleans */ - lua_CFunction f; /* light C functions */ - lua_Integer i; /* integer numbers */ -#ifndef _KERNEL - lua_Number n; /* float numbers */ -#endif -}; - - -struct lua_TValue { - TValuefields; -}; - - -typedef TValue *StkId; /* index to stack elements */ - - - - -/* -** Header for string value; string bytes follow the end of this structure -** (aligned according to 'UTString'; see next). -*/ -typedef struct TString { - CommonHeader; - lu_byte extra; /* reserved words for short strings; "has hash" for longs */ - lu_byte shrlen; /* length for short strings */ - unsigned int hash; - union { - size_t lnglen; /* length for long strings */ - struct TString *hnext; /* linked list for hash table */ - } u; -} TString; - - -/* -** Ensures that address after this type is always fully aligned. -*/ -typedef union UTString { - L_Umaxalign dummy; /* ensures maximum alignment for strings */ - TString tsv; -} UTString; - - -/* -** Get the actual string (array of bytes) from a 'TString'. -** (Access to 'extra' ensures that value is really a 'TString'.) -*/ -#define getaddrstr(ts) (cast(char *, (ts)) + sizeof(UTString)) -#define getstr(ts) \ - check_exp(sizeof((ts)->extra), cast(const char*, getaddrstr(ts))) - -/* get the actual string (array of bytes) from a Lua value */ -#define svalue(o) getstr(tsvalue(o)) - -/* get string length from 'TString *s' */ -#define tsslen(s) ((s)->tt == LUA_TSHRSTR ? (s)->shrlen : (s)->u.lnglen) - -/* get string length from 'TValue *o' */ -#define vslen(o) tsslen(tsvalue(o)) - - -/* -** Header for userdata; memory area follows the end of this structure -** (aligned according to 'UUdata'; see next). -*/ -typedef struct Udata { - CommonHeader; - lu_byte ttuv_; /* user value's tag */ - struct Table *metatable; - size_t len; /* number of bytes */ - union Value user_; /* user value */ -} Udata; - - -/* -** Ensures that address after this type is always fully aligned. -*/ -typedef union UUdata { - L_Umaxalign dummy; /* ensures maximum alignment for 'local' udata */ - Udata uv; -} UUdata; - - -/* -** Get the address of memory block inside 'Udata'. -** (Access to 'ttuv_' ensures that value is really a 'Udata'.) -*/ -#define getudatamem(u) \ - check_exp(sizeof((u)->ttuv_), (cast(char*, (u)) + sizeof(UUdata))) - -#define setuservalue(L,u,o) \ - { const TValue *io=(o); Udata *iu = (u); \ - iu->user_ = io->value_; iu->ttuv_ = rttype(io); \ - checkliveness(G(L),io); } - - -#define getuservalue(L,u,o) \ - { TValue *io=(o); const Udata *iu = (u); \ - io->value_ = iu->user_; settt_(io, iu->ttuv_); \ - checkliveness(G(L),io); } - - -/* -** Description of an upvalue for function prototypes -*/ -typedef struct Upvaldesc { - TString *name; /* upvalue name (for debug information) */ - lu_byte instack; /* whether it is in stack (register) */ - lu_byte idx; /* index of upvalue (in stack or in outer function's list) */ -} Upvaldesc; - - -/* -** Description of a local variable for function prototypes -** (used for debug information) -*/ -typedef struct LocVar { - TString *varname; - int startpc; /* first point where variable is active */ - int endpc; /* first point where variable is dead */ -} LocVar; - - -/* -** Function Prototypes -*/ -typedef struct Proto { - CommonHeader; - lu_byte numparams; /* number of fixed parameters */ - lu_byte is_vararg; - lu_byte maxstacksize; /* number of registers needed by this function */ - int sizeupvalues; /* size of 'upvalues' */ - int sizek; /* size of 'k' */ - int sizecode; - int sizelineinfo; - int sizep; /* size of 'p' */ - int sizelocvars; - int linedefined; - int lastlinedefined; - TValue *k; /* constants used by the function */ - Instruction *code; /* opcodes */ - struct Proto **p; /* functions defined inside the function */ - int *lineinfo; /* map from opcodes to source lines (debug information) */ - LocVar *locvars; /* information about local variables (debug information) */ - Upvaldesc *upvalues; /* upvalue information */ - struct LClosure *cache; /* last-created closure with this prototype */ - TString *source; /* used for debug information */ - GCObject *gclist; -} Proto; - - - -/* -** Lua Upvalues -*/ -typedef struct UpVal UpVal; - - -/* -** Closures -*/ - -#define ClosureHeader \ - CommonHeader; lu_byte nupvalues; GCObject *gclist - -typedef struct CClosure { - ClosureHeader; - lua_CFunction f; - TValue upvalue[1]; /* list of upvalues */ -} CClosure; - - -typedef struct LClosure { - ClosureHeader; - struct Proto *p; - UpVal *upvals[1]; /* list of upvalues */ -} LClosure; - - -typedef union Closure { - CClosure c; - LClosure l; -} Closure; - - -#define isLfunction(o) ttisLclosure(o) - -#define getproto(o) (clLvalue(o)->p) - - -/* -** Tables -*/ - -typedef union TKey { - struct { - TValuefields; - int next; /* for chaining (offset for next node) */ - } nk; - TValue tvk; -} TKey; - - -/* copy a value into a key without messing up field 'next' */ -#define setnodekey(L,key,obj) \ - { TKey *k_=(key); const TValue *io_=(obj); \ - k_->nk.value_ = io_->value_; k_->nk.tt_ = io_->tt_; \ - (void)L; checkliveness(G(L),io_); } - - -typedef struct Node { - TValue i_val; - TKey i_key; -} Node; - - -typedef struct Table { - CommonHeader; - lu_byte flags; /* 1<

lsizenode)) - - -/* -** (address of) a fixed nil value -*/ -#define luaO_nilobject (&luaO_nilobject_) - - -LUAI_DDEC const TValue luaO_nilobject_; - -/* size of buffer for 'luaO_utf8esc' function */ -#define UTF8BUFFSZ 8 - -LUAI_FUNC int luaO_int2fb (unsigned int x); -LUAI_FUNC int luaO_fb2int (int x); -LUAI_FUNC int luaO_utf8esc (char *buff, unsigned long x); -LUAI_FUNC int luaO_ceillog2 (unsigned int x); -LUAI_FUNC void luaO_arith (lua_State *L, int op, const TValue *p1, - const TValue *p2, TValue *res); -LUAI_FUNC size_t luaO_str2num (const char *s, TValue *o); -LUAI_FUNC int luaO_hexavalue (int c); -LUAI_FUNC void luaO_tostring (lua_State *L, StkId obj); -LUAI_FUNC const char *luaO_pushvfstring (lua_State *L, const char *fmt, - va_list argp); -LUAI_FUNC const char *luaO_pushfstring (lua_State *L, const char *fmt, ...); -LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t len); - - -#endif - diff --git a/external/mit/lua/dist/src/lopcodes.c b/external/mit/lua/dist/src/lopcodes.c deleted file mode 100644 index 4ce7c4be9..000000000 --- a/external/mit/lua/dist/src/lopcodes.c +++ /dev/null @@ -1,132 +0,0 @@ -/* $NetBSD: lopcodes.c,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lopcodes.c,v 1.55 2015/01/05 13:48:33 roberto Exp -** Opcodes for Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#define lopcodes_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lopcodes.h" - - -/* ORDER OP */ - -LUAI_DDEF const char *const luaP_opnames[NUM_OPCODES+1] = { - "MOVE", - "LOADK", - "LOADKX", - "LOADBOOL", - "LOADNIL", - "GETUPVAL", - "GETTABUP", - "GETTABLE", - "SETTABUP", - "SETUPVAL", - "SETTABLE", - "NEWTABLE", - "SELF", - "ADD", - "SUB", - "MUL", - "MOD", -#ifndef _KERNEL - "POW", - "DIV", -#endif - "IDIV", - "BAND", - "BOR", - "BXOR", - "SHL", - "SHR", - "UNM", - "BNOT", - "NOT", - "LEN", - "CONCAT", - "JMP", - "EQ", - "LT", - "LE", - "TEST", - "TESTSET", - "CALL", - "TAILCALL", - "RETURN", - "FORLOOP", - "FORPREP", - "TFORCALL", - "TFORLOOP", - "SETLIST", - "CLOSURE", - "VARARG", - "EXTRAARG", - NULL -}; - - -#define opmode(t,a,b,c,m) (((t)<<7) | ((a)<<6) | ((b)<<4) | ((c)<<2) | (m)) - -LUAI_DDEF const lu_byte luaP_opmodes[NUM_OPCODES] = { -/* T A B C mode opcode */ - opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_MOVE */ - ,opmode(0, 1, OpArgK, OpArgN, iABx) /* OP_LOADK */ - ,opmode(0, 1, OpArgN, OpArgN, iABx) /* OP_LOADKX */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_LOADBOOL */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_LOADNIL */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_GETUPVAL */ - ,opmode(0, 1, OpArgU, OpArgK, iABC) /* OP_GETTABUP */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_GETTABLE */ - ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABUP */ - ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_SETUPVAL */ - ,opmode(0, 0, OpArgK, OpArgK, iABC) /* OP_SETTABLE */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_NEWTABLE */ - ,opmode(0, 1, OpArgR, OpArgK, iABC) /* OP_SELF */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_ADD */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SUB */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MUL */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_MOD */ -#ifndef _KERNEL - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_POW */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_DIV */ -#endif - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_IDIV */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BAND */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BOR */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_BXOR */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHL */ - ,opmode(0, 1, OpArgK, OpArgK, iABC) /* OP_SHR */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_UNM */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_BNOT */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_NOT */ - ,opmode(0, 1, OpArgR, OpArgN, iABC) /* OP_LEN */ - ,opmode(0, 1, OpArgR, OpArgR, iABC) /* OP_CONCAT */ - ,opmode(0, 0, OpArgR, OpArgN, iAsBx) /* OP_JMP */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_EQ */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LT */ - ,opmode(1, 0, OpArgK, OpArgK, iABC) /* OP_LE */ - ,opmode(1, 0, OpArgN, OpArgU, iABC) /* OP_TEST */ - ,opmode(1, 1, OpArgR, OpArgU, iABC) /* OP_TESTSET */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_CALL */ - ,opmode(0, 1, OpArgU, OpArgU, iABC) /* OP_TAILCALL */ - ,opmode(0, 0, OpArgU, OpArgN, iABC) /* OP_RETURN */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORLOOP */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_FORPREP */ - ,opmode(0, 0, OpArgN, OpArgU, iABC) /* OP_TFORCALL */ - ,opmode(0, 1, OpArgR, OpArgN, iAsBx) /* OP_TFORLOOP */ - ,opmode(0, 0, OpArgU, OpArgU, iABC) /* OP_SETLIST */ - ,opmode(0, 1, OpArgU, OpArgN, iABx) /* OP_CLOSURE */ - ,opmode(0, 1, OpArgU, OpArgN, iABC) /* OP_VARARG */ - ,opmode(0, 0, OpArgU, OpArgU, iAx) /* OP_EXTRAARG */ -}; - diff --git a/external/mit/lua/dist/src/lopcodes.h b/external/mit/lua/dist/src/lopcodes.h deleted file mode 100644 index e5e633b2d..000000000 --- a/external/mit/lua/dist/src/lopcodes.h +++ /dev/null @@ -1,299 +0,0 @@ -/* $NetBSD: lopcodes.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lopcodes.h,v 1.148 2014/10/25 11:50:46 roberto Exp -** Opcodes for Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#ifndef lopcodes_h -#define lopcodes_h - -#include "llimits.h" - - -/*=========================================================================== - We assume that instructions are unsigned numbers. - All instructions have an opcode in the first 6 bits. - Instructions can have the following fields: - 'A' : 8 bits - 'B' : 9 bits - 'C' : 9 bits - 'Ax' : 26 bits ('A', 'B', and 'C' together) - 'Bx' : 18 bits ('B' and 'C' together) - 'sBx' : signed Bx - - A signed argument is represented in excess K; that is, the number - value is the unsigned value minus K. K is exactly the maximum value - for that argument (so that -max is represented by 0, and +max is - represented by 2*max), which is half the maximum for the corresponding - unsigned argument. -===========================================================================*/ - - -enum OpMode {iABC, iABx, iAsBx, iAx}; /* basic instruction format */ - - -/* -** size and position of opcode arguments. -*/ -#define SIZE_C 9 -#define SIZE_B 9 -#define SIZE_Bx (SIZE_C + SIZE_B) -#define SIZE_A 8 -#define SIZE_Ax (SIZE_C + SIZE_B + SIZE_A) - -#define SIZE_OP 6 - -#define POS_OP 0 -#define POS_A (POS_OP + SIZE_OP) -#define POS_C (POS_A + SIZE_A) -#define POS_B (POS_C + SIZE_C) -#define POS_Bx POS_C -#define POS_Ax POS_A - - -/* -** limits for opcode arguments. -** we use (signed) int to manipulate most arguments, -** so they must fit in LUAI_BITSINT-1 bits (-1 for sign) -*/ -#if SIZE_Bx < LUAI_BITSINT-1 -#define MAXARG_Bx ((1<>1) /* 'sBx' is signed */ -#else -#define MAXARG_Bx MAX_INT -#define MAXARG_sBx MAX_INT -#endif - -#if SIZE_Ax < LUAI_BITSINT-1 -#define MAXARG_Ax ((1<>POS_OP) & MASK1(SIZE_OP,0))) -#define SET_OPCODE(i,o) ((i) = (((i)&MASK0(SIZE_OP,POS_OP)) | \ - ((cast(Instruction, o)<>pos) & MASK1(size,0))) -#define setarg(i,v,pos,size) ((i) = (((i)&MASK0(size,pos)) | \ - ((cast(Instruction, v)<> RK(C) */ -OP_UNM,/* A B R(A) := -R(B) */ -OP_BNOT,/* A B R(A) := ~R(B) */ -OP_NOT,/* A B R(A) := not R(B) */ -OP_LEN,/* A B R(A) := length of R(B) */ - -OP_CONCAT,/* A B C R(A) := R(B).. ... ..R(C) */ - -OP_JMP,/* A sBx pc+=sBx; if (A) close all upvalues >= R(A - 1) */ -OP_EQ,/* A B C if ((RK(B) == RK(C)) ~= A) then pc++ */ -OP_LT,/* A B C if ((RK(B) < RK(C)) ~= A) then pc++ */ -OP_LE,/* A B C if ((RK(B) <= RK(C)) ~= A) then pc++ */ - -OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ -OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ - -OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ -OP_RETURN,/* A B return R(A), ... ,R(A+B-2) (see note) */ - -OP_FORLOOP,/* A sBx R(A)+=R(A+2); - if R(A) > 4) & 3)) -#define getCMode(m) (cast(enum OpArgMask, (luaP_opmodes[m] >> 2) & 3)) -#define testAMode(m) (luaP_opmodes[m] & (1 << 6)) -#define testTMode(m) (luaP_opmodes[m] & (1 << 7)) - - -LUAI_DDEC const char *const luaP_opnames[NUM_OPCODES+1]; /* opcode names */ - - -/* number of list items to accumulate before a SETLIST instruction */ -#define LFIELDS_PER_FLUSH 50 - - -#endif diff --git a/external/mit/lua/dist/src/loslib.c b/external/mit/lua/dist/src/loslib.c deleted file mode 100644 index 1c768daa5..000000000 --- a/external/mit/lua/dist/src/loslib.c +++ /dev/null @@ -1,372 +0,0 @@ -/* $NetBSD: loslib.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: loslib.c,v 1.57 2015/04/10 17:41:04 roberto Exp -** Standard Operating System library -** See Copyright Notice in lua.h -*/ - -#define loslib_c -#define LUA_LIB - -#include "lprefix.h" - - -#include -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** {================================================================== -** list of valid conversion specifiers for the 'strftime' function -** =================================================================== -*/ -#if !defined(LUA_STRFTIMEOPTIONS) /* { */ - -#if defined(LUA_USE_C89) -#define LUA_STRFTIMEOPTIONS { "aAbBcdHIjmMpSUwWxXyYz%", "" } -#else /* C99 specification */ -#define LUA_STRFTIMEOPTIONS \ - { "aAbBcCdDeFgGhHIjmMnprRStTuUVwWxXyYzZ%", "", \ - "E", "cCxXyY", \ - "O", "deHImMSuUVwWy" } -#endif - -#endif /* } */ -/* }================================================================== */ - - -/* -** {================================================================== -** Configuration for time-related stuff -** =================================================================== -*/ - -#if !defined(l_time_t) /* { */ -/* -** type to represent time_t in Lua -*/ -#define l_timet lua_Integer -#define l_pushtime(L,t) lua_pushinteger(L,(lua_Integer)(t)) -#define l_checktime(L,a) ((time_t)luaL_checkinteger(L,a)) - -#endif /* } */ - - -#if !defined(l_gmtime) /* { */ -/* -** By default, Lua uses gmtime/localtime, except when POSIX is available, -** where it uses gmtime_r/localtime_r -*/ - -#if defined(LUA_USE_POSIX) /* { */ - -#define l_gmtime(t,r) gmtime_r(t,r) -#define l_localtime(t,r) localtime_r(t,r) - -#else /* }{ */ - -/* ISO C definitions */ -#define l_gmtime(t,r) ((void)(r)->tm_sec, gmtime(t)) -#define l_localtime(t,r) ((void)(r)->tm_sec, localtime(t)) - -#endif /* } */ - -#endif /* } */ - -/* }================================================================== */ - - -/* -** {================================================================== -** Configuration for 'tmpnam': -** By default, Lua uses tmpnam except when POSIX is available, where -** it uses mkstemp. -** =================================================================== -*/ -#if !defined(lua_tmpnam) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#include - -#define LUA_TMPNAMBUFSIZE 32 - -#if !defined(LUA_TMPNAMTEMPLATE) -#define LUA_TMPNAMTEMPLATE "/tmp/lua_XXXXXX" -#endif - -#define lua_tmpnam(b,e) { \ - strcpy(b, LUA_TMPNAMTEMPLATE); \ - e = mkstemp(b); \ - if (e != -1) close(e); \ - e = (e == -1); } - -#else /* }{ */ - -/* ISO C definitions */ -#define LUA_TMPNAMBUFSIZE L_tmpnam -#define lua_tmpnam(b,e) { e = (tmpnam(b) == NULL); } - -#endif /* } */ - -#endif /* } */ -/* }================================================================== */ - - - - -static int os_execute (lua_State *L) { - const char *cmd = luaL_optstring(L, 1, NULL); - int stat = system(cmd); - if (cmd != NULL) - return luaL_execresult(L, stat); - else { - lua_pushboolean(L, stat); /* true if there is a shell */ - return 1; - } -} - - -static int os_remove (lua_State *L) { - const char *filename = luaL_checkstring(L, 1); - return luaL_fileresult(L, remove(filename) == 0, filename); -} - - -static int os_rename (lua_State *L) { - const char *fromname = luaL_checkstring(L, 1); - const char *toname = luaL_checkstring(L, 2); - return luaL_fileresult(L, rename(fromname, toname) == 0, NULL); -} - - -static int os_tmpname (lua_State *L) { - char buff[LUA_TMPNAMBUFSIZE]; - int err; - lua_tmpnam(buff, err); - if (err) - return luaL_error(L, "unable to generate a unique filename"); - lua_pushstring(L, buff); - return 1; -} - - -static int os_getenv (lua_State *L) { - lua_pushstring(L, getenv(luaL_checkstring(L, 1))); /* if NULL push nil */ - return 1; -} - - -static int os_clock (lua_State *L) { - lua_pushnumber(L, ((lua_Number)clock())/(lua_Number)CLOCKS_PER_SEC); - return 1; -} - - -/* -** {====================================================== -** Time/Date operations -** { year=%Y, month=%m, day=%d, hour=%H, min=%M, sec=%S, -** wday=%w+1, yday=%j, isdst=? } -** ======================================================= -*/ - -static void setfield (lua_State *L, const char *key, int value) { - lua_pushinteger(L, value); - lua_setfield(L, -2, key); -} - -static void setboolfield (lua_State *L, const char *key, int value) { - if (value < 0) /* undefined? */ - return; /* does not set field */ - lua_pushboolean(L, value); - lua_setfield(L, -2, key); -} - -static int getboolfield (lua_State *L, const char *key) { - int res; - res = (lua_getfield(L, -1, key) == LUA_TNIL) ? -1 : lua_toboolean(L, -1); - lua_pop(L, 1); - return res; -} - - -static int getfield (lua_State *L, const char *key, int d) { - int res, isnum; - lua_getfield(L, -1, key); - res = (int)lua_tointegerx(L, -1, &isnum); - if (!isnum) { - if (d < 0) - return luaL_error(L, "field '%s' missing in date table", key); - res = d; - } - lua_pop(L, 1); - return res; -} - - -static const char *checkoption (lua_State *L, const char *conv, char *buff) { - static const char *const options[] = LUA_STRFTIMEOPTIONS; - unsigned int i; - for (i = 0; i < sizeof(options)/sizeof(options[0]); i += 2) { - if (*conv != '\0' && strchr(options[i], *conv) != NULL) { - buff[1] = *conv; - if (*options[i + 1] == '\0') { /* one-char conversion specifier? */ - buff[2] = '\0'; /* end buffer */ - return conv + 1; - } - else if (*(conv + 1) != '\0' && - strchr(options[i + 1], *(conv + 1)) != NULL) { - buff[2] = *(conv + 1); /* valid two-char conversion specifier */ - buff[3] = '\0'; /* end buffer */ - return conv + 2; - } - } - } - luaL_argerror(L, 1, - lua_pushfstring(L, "invalid conversion specifier '%%%s'", conv)); - return conv; /* to avoid warnings */ -} - - -static int os_date (lua_State *L) { - const char *s = luaL_optstring(L, 1, "%c"); - time_t t = luaL_opt(L, l_checktime, 2, time(NULL)); - struct tm tmr, *stm; - if (*s == '!') { /* UTC? */ - stm = l_gmtime(&t, &tmr); - s++; /* skip '!' */ - } - else - stm = l_localtime(&t, &tmr); - if (stm == NULL) /* invalid date? */ - lua_pushnil(L); - else if (strcmp(s, "*t") == 0) { - lua_createtable(L, 0, 9); /* 9 = number of fields */ - setfield(L, "sec", stm->tm_sec); - setfield(L, "min", stm->tm_min); - setfield(L, "hour", stm->tm_hour); - setfield(L, "day", stm->tm_mday); - setfield(L, "month", stm->tm_mon+1); - setfield(L, "year", stm->tm_year+1900); - setfield(L, "wday", stm->tm_wday+1); - setfield(L, "yday", stm->tm_yday+1); - setboolfield(L, "isdst", stm->tm_isdst); - } - else { - char cc[4]; - luaL_Buffer b; - cc[0] = '%'; - luaL_buffinit(L, &b); - while (*s) { - if (*s != '%') /* no conversion specifier? */ - luaL_addchar(&b, *s++); - else { - size_t reslen; - char buff[200]; /* should be big enough for any conversion result */ - s = checkoption(L, s + 1, cc); - reslen = strftime(buff, sizeof(buff), cc, stm); - luaL_addlstring(&b, buff, reslen); - } - } - luaL_pushresult(&b); - } - return 1; -} - - -static int os_time (lua_State *L) { - time_t t; - if (lua_isnoneornil(L, 1)) /* called without args? */ - t = time(NULL); /* get current time */ - else { - struct tm ts; - luaL_checktype(L, 1, LUA_TTABLE); - lua_settop(L, 1); /* make sure table is at the top */ - ts.tm_sec = getfield(L, "sec", 0); - ts.tm_min = getfield(L, "min", 0); - ts.tm_hour = getfield(L, "hour", 12); - ts.tm_mday = getfield(L, "day", -1); - ts.tm_mon = getfield(L, "month", -1) - 1; - ts.tm_year = getfield(L, "year", -1) - 1900; - ts.tm_isdst = getboolfield(L, "isdst"); - t = mktime(&ts); - } - if (t != (time_t)(l_timet)t) - luaL_error(L, "time result cannot be represented in this Lua installation"); - else if (t == (time_t)(-1)) - lua_pushnil(L); - else - l_pushtime(L, t); - return 1; -} - - -static int os_difftime (lua_State *L) { - time_t t1 = l_checktime(L, 1); - time_t t2 = l_checktime(L, 2); - lua_pushnumber(L, (lua_Number)difftime(t1, t2)); - return 1; -} - -/* }====================================================== */ - - -static int os_setlocale (lua_State *L) { - static const int cat[] = {LC_ALL, LC_COLLATE, LC_CTYPE, LC_MONETARY, - LC_NUMERIC, LC_TIME}; - static const char *const catnames[] = {"all", "collate", "ctype", "monetary", - "numeric", "time", NULL}; - const char *l = luaL_optstring(L, 1, NULL); - int op = luaL_checkoption(L, 2, "all", catnames); - lua_pushstring(L, setlocale(cat[op], l)); - return 1; -} - - -static int os_exit (lua_State *L) { - int status; - if (lua_isboolean(L, 1)) - status = (lua_toboolean(L, 1) ? EXIT_SUCCESS : EXIT_FAILURE); - else - status = (int)luaL_optinteger(L, 1, EXIT_SUCCESS); - if (lua_toboolean(L, 2)) - lua_close(L); - if (L) exit(status); /* 'if' to avoid warnings for unreachable 'return' */ - return 0; -} - - -static const luaL_Reg syslib[] = { - {"clock", os_clock}, - {"date", os_date}, - {"difftime", os_difftime}, - {"execute", os_execute}, - {"exit", os_exit}, - {"getenv", os_getenv}, - {"remove", os_remove}, - {"rename", os_rename}, - {"setlocale", os_setlocale}, - {"time", os_time}, - {"tmpname", os_tmpname}, - {NULL, NULL} -}; - -/* }====================================================== */ - - - -LUAMOD_API int luaopen_os (lua_State *L) { - luaL_newlib(L, syslib); - return 1; -} - diff --git a/external/mit/lua/dist/src/lparser.c b/external/mit/lua/dist/src/lparser.c deleted file mode 100644 index 5453eaec1..000000000 --- a/external/mit/lua/dist/src/lparser.c +++ /dev/null @@ -1,1657 +0,0 @@ -/* $NetBSD: lparser.c,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lparser.c,v 2.147 2014/12/27 20:31:43 roberto Exp -** Lua Parser -** See Copyright Notice in lua.h -*/ - -#define lparser_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "lcode.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "llex.h" -#include "lmem.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lparser.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" - - - -/* maximum number of local variables per function (must be smaller - than 250, due to the bytecode format) */ -#define MAXVARS 200 - - -#define hasmultret(k) ((k) == VCALL || (k) == VVARARG) - - -/* because all strings are unified by the scanner, the parser - can use pointer equality for string equality */ -#define eqstr(a,b) ((a) == (b)) - - -/* -** nodes for block list (list of active blocks) -*/ -typedef struct BlockCnt { - struct BlockCnt *previous; /* chain */ - int firstlabel; /* index of first label in this block */ - int firstgoto; /* index of first pending goto in this block */ - lu_byte nactvar; /* # active locals outside the block */ - lu_byte upval; /* true if some variable in the block is an upvalue */ - lu_byte isloop; /* true if 'block' is a loop */ -} BlockCnt; - - - -/* -** prototypes for recursive non-terminal functions -*/ -static void statement (LexState *ls); -static void expr (LexState *ls, expdesc *v); - - -/* semantic error */ -static l_noret semerror (LexState *ls, const char *msg) { - ls->t.token = 0; /* remove "near " from final message */ - luaX_syntaxerror(ls, msg); -} - - -static l_noret error_expected (LexState *ls, int token) { - luaX_syntaxerror(ls, - luaO_pushfstring(ls->L, "%s expected", luaX_token2str(ls, token))); -} - - -static l_noret errorlimit (FuncState *fs, int limit, const char *what) { - lua_State *L = fs->ls->L; - const char *msg; - int line = fs->f->linedefined; - const char *where = (line == 0) - ? "main function" - : luaO_pushfstring(L, "function at line %d", line); - msg = luaO_pushfstring(L, "too many %s (limit is %d) in %s", - what, limit, where); - luaX_syntaxerror(fs->ls, msg); -} - - -static void checklimit (FuncState *fs, int v, int l, const char *what) { - if (v > l) errorlimit(fs, l, what); -} - - -static int testnext (LexState *ls, int c) { - if (ls->t.token == c) { - luaX_next(ls); - return 1; - } - else return 0; -} - - -static void check (LexState *ls, int c) { - if (ls->t.token != c) - error_expected(ls, c); -} - - -static void checknext (LexState *ls, int c) { - check(ls, c); - luaX_next(ls); -} - - -#define check_condition(ls,c,msg) { if (!(c)) luaX_syntaxerror(ls, msg); } - - - -static void check_match (LexState *ls, int what, int who, int where) { - if (!testnext(ls, what)) { - if (where == ls->linenumber) - error_expected(ls, what); - else { - luaX_syntaxerror(ls, luaO_pushfstring(ls->L, - "%s expected (to close %s at line %d)", - luaX_token2str(ls, what), luaX_token2str(ls, who), where)); - } - } -} - - -static TString *str_checkname (LexState *ls) { - TString *ts; - check(ls, TK_NAME); - ts = ls->t.seminfo.ts; - luaX_next(ls); - return ts; -} - - -static void init_exp (expdesc *e, expkind k, int i) { - e->f = e->t = NO_JUMP; - e->k = k; - e->u.info = i; -} - - -static void codestring (LexState *ls, expdesc *e, TString *s) { - init_exp(e, VK, luaK_stringK(ls->fs, s)); -} - - -static void checkname (LexState *ls, expdesc *e) { - codestring(ls, e, str_checkname(ls)); -} - - -static int registerlocalvar (LexState *ls, TString *varname) { - FuncState *fs = ls->fs; - Proto *f = fs->f; - int oldsize = f->sizelocvars; - luaM_growvector(ls->L, f->locvars, fs->nlocvars, f->sizelocvars, - LocVar, SHRT_MAX, "local variables"); - while (oldsize < f->sizelocvars) f->locvars[oldsize++].varname = NULL; - f->locvars[fs->nlocvars].varname = varname; - luaC_objbarrier(ls->L, f, varname); - return fs->nlocvars++; -} - - -static void new_localvar (LexState *ls, TString *name) { - FuncState *fs = ls->fs; - Dyndata *dyd = ls->dyd; - int reg = registerlocalvar(ls, name); - checklimit(fs, dyd->actvar.n + 1 - fs->firstlocal, - MAXVARS, "local variables"); - luaM_growvector(ls->L, dyd->actvar.arr, dyd->actvar.n + 1, - dyd->actvar.size, Vardesc, MAX_INT, "local variables"); - dyd->actvar.arr[dyd->actvar.n++].idx = cast(short, reg); -} - - -static void new_localvarliteral_ (LexState *ls, const char *name, size_t sz) { - new_localvar(ls, luaX_newstring(ls, name, sz)); -} - -#define new_localvarliteral(ls,v) \ - new_localvarliteral_(ls, "" v, (sizeof(v)/sizeof(char))-1) - - -static LocVar *getlocvar (FuncState *fs, int i) { - int idx = fs->ls->dyd->actvar.arr[fs->firstlocal + i].idx; - lua_assert(idx < fs->nlocvars); - return &fs->f->locvars[idx]; -} - - -static void adjustlocalvars (LexState *ls, int nvars) { - FuncState *fs = ls->fs; - fs->nactvar = cast_byte(fs->nactvar + nvars); - for (; nvars; nvars--) { - getlocvar(fs, fs->nactvar - nvars)->startpc = fs->pc; - } -} - - -static void removevars (FuncState *fs, int tolevel) { - fs->ls->dyd->actvar.n -= (fs->nactvar - tolevel); - while (fs->nactvar > tolevel) - getlocvar(fs, --fs->nactvar)->endpc = fs->pc; -} - - -static int searchupvalue (FuncState *fs, TString *name) { - int i; - Upvaldesc *up = fs->f->upvalues; - for (i = 0; i < fs->nups; i++) { - if (eqstr(up[i].name, name)) return i; - } - return -1; /* not found */ -} - - -static int newupvalue (FuncState *fs, TString *name, expdesc *v) { - Proto *f = fs->f; - int oldsize = f->sizeupvalues; - checklimit(fs, fs->nups + 1, MAXUPVAL, "upvalues"); - luaM_growvector(fs->ls->L, f->upvalues, fs->nups, f->sizeupvalues, - Upvaldesc, MAXUPVAL, "upvalues"); - while (oldsize < f->sizeupvalues) f->upvalues[oldsize++].name = NULL; - f->upvalues[fs->nups].instack = (v->k == VLOCAL); - f->upvalues[fs->nups].idx = cast_byte(v->u.info); - f->upvalues[fs->nups].name = name; - luaC_objbarrier(fs->ls->L, f, name); - return fs->nups++; -} - - -static int searchvar (FuncState *fs, TString *n) { - int i; - for (i = cast_int(fs->nactvar) - 1; i >= 0; i--) { - if (eqstr(n, getlocvar(fs, i)->varname)) - return i; - } - return -1; /* not found */ -} - - -/* - Mark block where variable at given level was defined - (to emit close instructions later). -*/ -static void markupval (FuncState *fs, int level) { - BlockCnt *bl = fs->bl; - while (bl->nactvar > level) bl = bl->previous; - bl->upval = 1; -} - - -/* - Find variable with given name 'n'. If it is an upvalue, add this - upvalue into all intermediate functions. -*/ -static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { - if (fs == NULL) /* no more levels? */ - return VVOID; /* default is global */ - else { - int v = searchvar(fs, n); /* look up locals at current level */ - if (v >= 0) { /* found? */ - init_exp(var, VLOCAL, v); /* variable is local */ - if (!base) - markupval(fs, v); /* local will be used as an upval */ - return VLOCAL; - } - else { /* not found as local at current level; try upvalues */ - int idx = searchupvalue(fs, n); /* try existing upvalues */ - if (idx < 0) { /* not found? */ - if (singlevaraux(fs->prev, n, var, 0) == VVOID) /* try upper levels */ - return VVOID; /* not found; is a global */ - /* else was LOCAL or UPVAL */ - idx = newupvalue(fs, n, var); /* will be a new upvalue */ - } - init_exp(var, VUPVAL, idx); - return VUPVAL; - } - } -} - - -static void singlevar (LexState *ls, expdesc *var) { - TString *varname = str_checkname(ls); - FuncState *fs = ls->fs; - if (singlevaraux(fs, varname, var, 1) == VVOID) { /* global name? */ - expdesc key; - singlevaraux(fs, ls->envn, var, 1); /* get environment variable */ - lua_assert(var->k == VLOCAL || var->k == VUPVAL); - codestring(ls, &key, varname); /* key is variable name */ - luaK_indexed(fs, var, &key); /* env[varname] */ - } -} - - -static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { - FuncState *fs = ls->fs; - int extra = nvars - nexps; - if (hasmultret(e->k)) { - extra++; /* includes call itself */ - if (extra < 0) extra = 0; - luaK_setreturns(fs, e, extra); /* last exp. provides the difference */ - if (extra > 1) luaK_reserveregs(fs, extra-1); - } - else { - if (e->k != VVOID) luaK_exp2nextreg(fs, e); /* close last expression */ - if (extra > 0) { - int reg = fs->freereg; - luaK_reserveregs(fs, extra); - luaK_nil(fs, reg, extra); - } - } -} - - -static void enterlevel (LexState *ls) { - lua_State *L = ls->L; - ++L->nCcalls; - checklimit(ls->fs, L->nCcalls, LUAI_MAXCCALLS, "C levels"); -} - - -#define leavelevel(ls) ((ls)->L->nCcalls--) - - -static void closegoto (LexState *ls, int g, Labeldesc *label) { - int i; - FuncState *fs = ls->fs; - Labellist *gl = &ls->dyd->gt; - Labeldesc *gt = &gl->arr[g]; - lua_assert(eqstr(gt->name, label->name)); - if (gt->nactvar < label->nactvar) { - TString *vname = getlocvar(fs, gt->nactvar)->varname; - const char *msg = luaO_pushfstring(ls->L, - " at line %d jumps into the scope of local '%s'", - getstr(gt->name), gt->line, getstr(vname)); - semerror(ls, msg); - } - luaK_patchlist(fs, gt->pc, label->pc); - /* remove goto from pending list */ - for (i = g; i < gl->n - 1; i++) - gl->arr[i] = gl->arr[i + 1]; - gl->n--; -} - - -/* -** try to close a goto with existing labels; this solves backward jumps -*/ -static int findlabel (LexState *ls, int g) { - int i; - BlockCnt *bl = ls->fs->bl; - Dyndata *dyd = ls->dyd; - Labeldesc *gt = &dyd->gt.arr[g]; - /* check labels in current block for a match */ - for (i = bl->firstlabel; i < dyd->label.n; i++) { - Labeldesc *lb = &dyd->label.arr[i]; - if (eqstr(lb->name, gt->name)) { /* correct label? */ - if (gt->nactvar > lb->nactvar && - (bl->upval || dyd->label.n > bl->firstlabel)) - luaK_patchclose(ls->fs, gt->pc, lb->nactvar); - closegoto(ls, g, lb); /* close it */ - return 1; - } - } - return 0; /* label not found; cannot close goto */ -} - - -static int newlabelentry (LexState *ls, Labellist *l, TString *name, - int line, int pc) { - int n = l->n; - luaM_growvector(ls->L, l->arr, n, l->size, - Labeldesc, SHRT_MAX, "labels/gotos"); - l->arr[n].name = name; - l->arr[n].line = line; - l->arr[n].nactvar = ls->fs->nactvar; - l->arr[n].pc = pc; - l->n = n + 1; - return n; -} - - -/* -** check whether new label 'lb' matches any pending gotos in current -** block; solves forward jumps -*/ -static void findgotos (LexState *ls, Labeldesc *lb) { - Labellist *gl = &ls->dyd->gt; - int i = ls->fs->bl->firstgoto; - while (i < gl->n) { - if (eqstr(gl->arr[i].name, lb->name)) - closegoto(ls, i, lb); - else - i++; - } -} - - -/* -** export pending gotos to outer level, to check them against -** outer labels; if the block being exited has upvalues, and -** the goto exits the scope of any variable (which can be the -** upvalue), close those variables being exited. -*/ -static void movegotosout (FuncState *fs, BlockCnt *bl) { - int i = bl->firstgoto; - Labellist *gl = &fs->ls->dyd->gt; - /* correct pending gotos to current block and try to close it - with visible labels */ - while (i < gl->n) { - Labeldesc *gt = &gl->arr[i]; - if (gt->nactvar > bl->nactvar) { - if (bl->upval) - luaK_patchclose(fs, gt->pc, bl->nactvar); - gt->nactvar = bl->nactvar; - } - if (!findlabel(fs->ls, i)) - i++; /* move to next one */ - } -} - - -static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isloop) { - bl->isloop = isloop; - bl->nactvar = fs->nactvar; - bl->firstlabel = fs->ls->dyd->label.n; - bl->firstgoto = fs->ls->dyd->gt.n; - bl->upval = 0; - bl->previous = fs->bl; - fs->bl = bl; - lua_assert(fs->freereg == fs->nactvar); -} - - -/* -** create a label named 'break' to resolve break statements -*/ -static void breaklabel (LexState *ls) { - TString *n = luaS_new(ls->L, "break"); - int l = newlabelentry(ls, &ls->dyd->label, n, 0, ls->fs->pc); - findgotos(ls, &ls->dyd->label.arr[l]); -} - -/* -** generates an error for an undefined 'goto'; choose appropriate -** message when label name is a reserved word (which can only be 'break') -*/ -static l_noret undefgoto (LexState *ls, Labeldesc *gt) { - const char *msg = isreserved(gt->name) - ? "<%s> at line %d not inside a loop" - : "no visible label '%s' for at line %d"; - msg = luaO_pushfstring(ls->L, msg, getstr(gt->name), gt->line); - semerror(ls, msg); -} - - -static void leaveblock (FuncState *fs) { - BlockCnt *bl = fs->bl; - LexState *ls = fs->ls; - if (bl->previous && bl->upval) { - /* create a 'jump to here' to close upvalues */ - int j = luaK_jump(fs); - luaK_patchclose(fs, j, bl->nactvar); - luaK_patchtohere(fs, j); - } - if (bl->isloop) - breaklabel(ls); /* close pending breaks */ - fs->bl = bl->previous; - removevars(fs, bl->nactvar); - lua_assert(bl->nactvar == fs->nactvar); - fs->freereg = fs->nactvar; /* free registers */ - ls->dyd->label.n = bl->firstlabel; /* remove local labels */ - if (bl->previous) /* inner block? */ - movegotosout(fs, bl); /* update pending gotos to outer block */ - else if (bl->firstgoto < ls->dyd->gt.n) /* pending gotos in outer block? */ - undefgoto(ls, &ls->dyd->gt.arr[bl->firstgoto]); /* error */ -} - - -/* -** adds a new prototype into list of prototypes -*/ -static Proto *addprototype (LexState *ls) { - Proto *clp; - lua_State *L = ls->L; - FuncState *fs = ls->fs; - Proto *f = fs->f; /* prototype of current function */ - if (fs->np >= f->sizep) { - int oldsize = f->sizep; - luaM_growvector(L, f->p, fs->np, f->sizep, Proto *, MAXARG_Bx, "functions"); - while (oldsize < f->sizep) f->p[oldsize++] = NULL; - } - f->p[fs->np++] = clp = luaF_newproto(L); - luaC_objbarrier(L, f, clp); - return clp; -} - - -/* -** codes instruction to create new closure in parent function. -** The OP_CLOSURE instruction must use the last available register, -** so that, if it invokes the GC, the GC knows which registers -** are in use at that time. -*/ -static void codeclosure (LexState *ls, expdesc *v) { - FuncState *fs = ls->fs->prev; - init_exp(v, VRELOCABLE, luaK_codeABx(fs, OP_CLOSURE, 0, fs->np - 1)); - luaK_exp2nextreg(fs, v); /* fix it at the last register */ -} - - -static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) { - Proto *f; - fs->prev = ls->fs; /* linked list of funcstates */ - fs->ls = ls; - ls->fs = fs; - fs->pc = 0; - fs->lasttarget = 0; - fs->jpc = NO_JUMP; - fs->freereg = 0; - fs->nk = 0; - fs->np = 0; - fs->nups = 0; - fs->nlocvars = 0; - fs->nactvar = 0; - fs->firstlocal = ls->dyd->actvar.n; - fs->bl = NULL; - f = fs->f; - f->source = ls->source; - f->maxstacksize = 2; /* registers 0/1 are always valid */ - enterblock(fs, bl, 0); -} - - -static void close_func (LexState *ls) { - lua_State *L = ls->L; - FuncState *fs = ls->fs; - Proto *f = fs->f; - luaK_ret(fs, 0, 0); /* final return */ - leaveblock(fs); - luaM_reallocvector(L, f->code, f->sizecode, fs->pc, Instruction); - f->sizecode = fs->pc; - luaM_reallocvector(L, f->lineinfo, f->sizelineinfo, fs->pc, int); - f->sizelineinfo = fs->pc; - luaM_reallocvector(L, f->k, f->sizek, fs->nk, TValue); - f->sizek = fs->nk; - luaM_reallocvector(L, f->p, f->sizep, fs->np, Proto *); - f->sizep = fs->np; - luaM_reallocvector(L, f->locvars, f->sizelocvars, fs->nlocvars, LocVar); - f->sizelocvars = fs->nlocvars; - luaM_reallocvector(L, f->upvalues, f->sizeupvalues, fs->nups, Upvaldesc); - f->sizeupvalues = fs->nups; - lua_assert(fs->bl == NULL); - ls->fs = fs->prev; - luaC_checkGC(L); -} - - - -/*============================================================*/ -/* GRAMMAR RULES */ -/*============================================================*/ - - -/* -** check whether current token is in the follow set of a block. -** 'until' closes syntactical blocks, but do not close scope, -** so it is handled in separate. -*/ -static int block_follow (LexState *ls, int withuntil) { - switch (ls->t.token) { - case TK_ELSE: case TK_ELSEIF: - case TK_END: case TK_EOS: - return 1; - case TK_UNTIL: return withuntil; - default: return 0; - } -} - - -static void statlist (LexState *ls) { - /* statlist -> { stat [';'] } */ - while (!block_follow(ls, 1)) { - if (ls->t.token == TK_RETURN) { - statement(ls); - return; /* 'return' must be last statement */ - } - statement(ls); - } -} - - -static void fieldsel (LexState *ls, expdesc *v) { - /* fieldsel -> ['.' | ':'] NAME */ - FuncState *fs = ls->fs; - expdesc key; - luaK_exp2anyregup(fs, v); - luaX_next(ls); /* skip the dot or colon */ - checkname(ls, &key); - luaK_indexed(fs, v, &key); -} - - -static void yindex (LexState *ls, expdesc *v) { - /* index -> '[' expr ']' */ - luaX_next(ls); /* skip the '[' */ - expr(ls, v); - luaK_exp2val(ls->fs, v); - checknext(ls, ']'); -} - - -/* -** {====================================================================== -** Rules for Constructors -** ======================================================================= -*/ - - -struct ConsControl { - expdesc v; /* last list item read */ - expdesc *t; /* table descriptor */ - int nh; /* total number of 'record' elements */ - int na; /* total number of array elements */ - int tostore; /* number of array elements pending to be stored */ -}; - - -static void recfield (LexState *ls, struct ConsControl *cc) { - /* recfield -> (NAME | '['exp1']') = exp1 */ - FuncState *fs = ls->fs; - int reg = ls->fs->freereg; - expdesc key, val; - int rkkey; - if (ls->t.token == TK_NAME) { - checklimit(fs, cc->nh, MAX_INT, "items in a constructor"); - checkname(ls, &key); - } - else /* ls->t.token == '[' */ - yindex(ls, &key); - cc->nh++; - checknext(ls, '='); - rkkey = luaK_exp2RK(fs, &key); - expr(ls, &val); - luaK_codeABC(fs, OP_SETTABLE, cc->t->u.info, rkkey, luaK_exp2RK(fs, &val)); - fs->freereg = reg; /* free registers */ -} - - -static void closelistfield (FuncState *fs, struct ConsControl *cc) { - if (cc->v.k == VVOID) return; /* there is no list item */ - luaK_exp2nextreg(fs, &cc->v); - cc->v.k = VVOID; - if (cc->tostore == LFIELDS_PER_FLUSH) { - luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); /* flush */ - cc->tostore = 0; /* no more items pending */ - } -} - - -static void lastlistfield (FuncState *fs, struct ConsControl *cc) { - if (cc->tostore == 0) return; - if (hasmultret(cc->v.k)) { - luaK_setmultret(fs, &cc->v); - luaK_setlist(fs, cc->t->u.info, cc->na, LUA_MULTRET); - cc->na--; /* do not count last expression (unknown number of elements) */ - } - else { - if (cc->v.k != VVOID) - luaK_exp2nextreg(fs, &cc->v); - luaK_setlist(fs, cc->t->u.info, cc->na, cc->tostore); - } -} - - -static void listfield (LexState *ls, struct ConsControl *cc) { - /* listfield -> exp */ - expr(ls, &cc->v); - checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); - cc->na++; - cc->tostore++; -} - - -static void field (LexState *ls, struct ConsControl *cc) { - /* field -> listfield | recfield */ - switch(ls->t.token) { - case TK_NAME: { /* may be 'listfield' or 'recfield' */ - if (luaX_lookahead(ls) != '=') /* expression? */ - listfield(ls, cc); - else - recfield(ls, cc); - break; - } - case '[': { - recfield(ls, cc); - break; - } - default: { - listfield(ls, cc); - break; - } - } -} - - -static void constructor (LexState *ls, expdesc *t) { - /* constructor -> '{' [ field { sep field } [sep] ] '}' - sep -> ',' | ';' */ - FuncState *fs = ls->fs; - int line = ls->linenumber; - int pc = luaK_codeABC(fs, OP_NEWTABLE, 0, 0, 0); - struct ConsControl cc; - cc.na = cc.nh = cc.tostore = 0; - cc.t = t; - init_exp(t, VRELOCABLE, pc); - init_exp(&cc.v, VVOID, 0); /* no value (yet) */ - luaK_exp2nextreg(ls->fs, t); /* fix it at stack top */ - checknext(ls, '{'); - do { - lua_assert(cc.v.k == VVOID || cc.tostore > 0); - if (ls->t.token == '}') break; - closelistfield(fs, &cc); - field(ls, &cc); - } while (testnext(ls, ',') || testnext(ls, ';')); - check_match(ls, '}', '{', line); - lastlistfield(fs, &cc); - SETARG_B(fs->f->code[pc], luaO_int2fb(cc.na)); /* set initial array size */ - SETARG_C(fs->f->code[pc], luaO_int2fb(cc.nh)); /* set initial table size */ -} - -/* }====================================================================== */ - - - -static void parlist (LexState *ls) { - /* parlist -> [ param { ',' param } ] */ - FuncState *fs = ls->fs; - Proto *f = fs->f; - int nparams = 0; - f->is_vararg = 0; - if (ls->t.token != ')') { /* is 'parlist' not empty? */ - do { - switch (ls->t.token) { - case TK_NAME: { /* param -> NAME */ - new_localvar(ls, str_checkname(ls)); - nparams++; - break; - } - case TK_DOTS: { /* param -> '...' */ - luaX_next(ls); - f->is_vararg = 1; - break; - } - default: luaX_syntaxerror(ls, " or '...' expected"); - } - } while (!f->is_vararg && testnext(ls, ',')); - } - adjustlocalvars(ls, nparams); - f->numparams = cast_byte(fs->nactvar); - luaK_reserveregs(fs, fs->nactvar); /* reserve register for parameters */ -} - - -static void body (LexState *ls, expdesc *e, int ismethod, int line) { - /* body -> '(' parlist ')' block END */ - FuncState new_fs; - BlockCnt bl; - new_fs.f = addprototype(ls); - new_fs.f->linedefined = line; - open_func(ls, &new_fs, &bl); - checknext(ls, '('); - if (ismethod) { - new_localvarliteral(ls, "self"); /* create 'self' parameter */ - adjustlocalvars(ls, 1); - } - parlist(ls); - checknext(ls, ')'); - statlist(ls); - new_fs.f->lastlinedefined = ls->linenumber; - check_match(ls, TK_END, TK_FUNCTION, line); - codeclosure(ls, e); - close_func(ls); -} - - -static int explist (LexState *ls, expdesc *v) { - /* explist -> expr { ',' expr } */ - int n = 1; /* at least one expression */ - expr(ls, v); - while (testnext(ls, ',')) { - luaK_exp2nextreg(ls->fs, v); - expr(ls, v); - n++; - } - return n; -} - - -static void funcargs (LexState *ls, expdesc *f, int line) { - FuncState *fs = ls->fs; - expdesc args; - int base, nparams; - switch (ls->t.token) { - case '(': { /* funcargs -> '(' [ explist ] ')' */ - luaX_next(ls); - if (ls->t.token == ')') /* arg list is empty? */ - args.k = VVOID; - else { - explist(ls, &args); - luaK_setmultret(fs, &args); - } - check_match(ls, ')', '(', line); - break; - } - case '{': { /* funcargs -> constructor */ - constructor(ls, &args); - break; - } - case TK_STRING: { /* funcargs -> STRING */ - codestring(ls, &args, ls->t.seminfo.ts); - luaX_next(ls); /* must use 'seminfo' before 'next' */ - break; - } - default: { - luaX_syntaxerror(ls, "function arguments expected"); - } - } - lua_assert(f->k == VNONRELOC); - base = f->u.info; /* base register for call */ - if (hasmultret(args.k)) - nparams = LUA_MULTRET; /* open call */ - else { - if (args.k != VVOID) - luaK_exp2nextreg(fs, &args); /* close last argument */ - nparams = fs->freereg - (base+1); - } - init_exp(f, VCALL, luaK_codeABC(fs, OP_CALL, base, nparams+1, 2)); - luaK_fixline(fs, line); - fs->freereg = base+1; /* call remove function and arguments and leaves - (unless changed) one result */ -} - - - - -/* -** {====================================================================== -** Expression parsing -** ======================================================================= -*/ - - -static void primaryexp (LexState *ls, expdesc *v) { - /* primaryexp -> NAME | '(' expr ')' */ - switch (ls->t.token) { - case '(': { - int line = ls->linenumber; - luaX_next(ls); - expr(ls, v); - check_match(ls, ')', '(', line); - luaK_dischargevars(ls->fs, v); - return; - } - case TK_NAME: { - singlevar(ls, v); - return; - } - default: { - luaX_syntaxerror(ls, "unexpected symbol"); - } - } -} - - -static void suffixedexp (LexState *ls, expdesc *v) { - /* suffixedexp -> - primaryexp { '.' NAME | '[' exp ']' | ':' NAME funcargs | funcargs } */ - FuncState *fs = ls->fs; - int line = ls->linenumber; - primaryexp(ls, v); - for (;;) { - switch (ls->t.token) { - case '.': { /* fieldsel */ - fieldsel(ls, v); - break; - } - case '[': { /* '[' exp1 ']' */ - expdesc key; - luaK_exp2anyregup(fs, v); - yindex(ls, &key); - luaK_indexed(fs, v, &key); - break; - } - case ':': { /* ':' NAME funcargs */ - expdesc key; - luaX_next(ls); - checkname(ls, &key); - luaK_self(fs, v, &key); - funcargs(ls, v, line); - break; - } - case '(': case TK_STRING: case '{': { /* funcargs */ - luaK_exp2nextreg(fs, v); - funcargs(ls, v, line); - break; - } - default: return; - } - } -} - - -static void simpleexp (LexState *ls, expdesc *v) { - /* simpleexp -> FLT | INT | STRING | NIL | TRUE | FALSE | ... | - constructor | FUNCTION body | suffixedexp */ - switch (ls->t.token) { -#ifndef _KERNEL - case TK_FLT: { - init_exp(v, VKFLT, 0); - v->u.nval = ls->t.seminfo.r; - break; - } -#endif - case TK_INT: { - init_exp(v, VKINT, 0); - v->u.ival = ls->t.seminfo.i; - break; - } - case TK_STRING: { - codestring(ls, v, ls->t.seminfo.ts); - break; - } - case TK_NIL: { - init_exp(v, VNIL, 0); - break; - } - case TK_TRUE: { - init_exp(v, VTRUE, 0); - break; - } - case TK_FALSE: { - init_exp(v, VFALSE, 0); - break; - } - case TK_DOTS: { /* vararg */ - FuncState *fs = ls->fs; - check_condition(ls, fs->f->is_vararg, - "cannot use '...' outside a vararg function"); - init_exp(v, VVARARG, luaK_codeABC(fs, OP_VARARG, 0, 1, 0)); - break; - } - case '{': { /* constructor */ - constructor(ls, v); - return; - } - case TK_FUNCTION: { - luaX_next(ls); - body(ls, v, 0, ls->linenumber); - return; - } - default: { - suffixedexp(ls, v); - return; - } - } - luaX_next(ls); -} - - -static UnOpr getunopr (int op) { - switch (op) { - case TK_NOT: return OPR_NOT; - case '-': return OPR_MINUS; - case '~': return OPR_BNOT; - case '#': return OPR_LEN; - default: return OPR_NOUNOPR; - } -} - - -static BinOpr getbinopr (int op) { - switch (op) { - case '+': return OPR_ADD; - case '-': return OPR_SUB; - case '*': return OPR_MUL; - case '%': return OPR_MOD; -#ifndef _KERNEL - case '^': return OPR_POW; - case '/': return OPR_DIV; -#else - case '/': return OPR_IDIV; -#endif - case TK_IDIV: return OPR_IDIV; - case '&': return OPR_BAND; - case '|': return OPR_BOR; - case '~': return OPR_BXOR; - case TK_SHL: return OPR_SHL; - case TK_SHR: return OPR_SHR; - case TK_CONCAT: return OPR_CONCAT; - case TK_NE: return OPR_NE; - case TK_EQ: return OPR_EQ; - case '<': return OPR_LT; - case TK_LE: return OPR_LE; - case '>': return OPR_GT; - case TK_GE: return OPR_GE; - case TK_AND: return OPR_AND; - case TK_OR: return OPR_OR; - default: return OPR_NOBINOPR; - } -} - - -static const struct { - lu_byte left; /* left priority for each binary operator */ - lu_byte right; /* right priority */ -} priority[] = { /* ORDER OPR */ - {10, 10}, {10, 10}, /* '+' '-' */ - {11, 11}, {11, 11}, /* '*' '%' */ - {14, 13}, /* '^' (right associative) */ - {11, 11}, {11, 11}, /* '/' '//' */ - {6, 6}, {4, 4}, {5, 5}, /* '&' '|' '~' */ - {7, 7}, {7, 7}, /* '<<' '>>' */ - {9, 8}, /* '..' (right associative) */ - {3, 3}, {3, 3}, {3, 3}, /* ==, <, <= */ - {3, 3}, {3, 3}, {3, 3}, /* ~=, >, >= */ - {2, 2}, {1, 1} /* and, or */ -}; - -#define UNARY_PRIORITY 12 /* priority for unary operators */ - - -/* -** subexpr -> (simpleexp | unop subexpr) { binop subexpr } -** where 'binop' is any binary operator with a priority higher than 'limit' -*/ -static BinOpr subexpr (LexState *ls, expdesc *v, int limit) { - BinOpr op; - UnOpr uop; - enterlevel(ls); - uop = getunopr(ls->t.token); - if (uop != OPR_NOUNOPR) { - int line = ls->linenumber; - luaX_next(ls); - subexpr(ls, v, UNARY_PRIORITY); - luaK_prefix(ls->fs, uop, v, line); - } - else simpleexp(ls, v); - /* expand while operators have priorities higher than 'limit' */ - op = getbinopr(ls->t.token); - while (op != OPR_NOBINOPR && priority[op].left > limit) { - expdesc v2; - BinOpr nextop; - int line = ls->linenumber; - luaX_next(ls); - luaK_infix(ls->fs, op, v); - /* read sub-expression with higher priority */ - nextop = subexpr(ls, &v2, priority[op].right); - luaK_posfix(ls->fs, op, v, &v2, line); - op = nextop; - } - leavelevel(ls); - return op; /* return first untreated operator */ -} - - -static void expr (LexState *ls, expdesc *v) { - subexpr(ls, v, 0); -} - -/* }==================================================================== */ - - - -/* -** {====================================================================== -** Rules for Statements -** ======================================================================= -*/ - - -static void block (LexState *ls) { - /* block -> statlist */ - FuncState *fs = ls->fs; - BlockCnt bl; - enterblock(fs, &bl, 0); - statlist(ls); - leaveblock(fs); -} - - -/* -** structure to chain all variables in the left-hand side of an -** assignment -*/ -struct LHS_assign { - struct LHS_assign *prev; - expdesc v; /* variable (global, local, upvalue, or indexed) */ -}; - - -/* -** check whether, in an assignment to an upvalue/local variable, the -** upvalue/local variable is begin used in a previous assignment to a -** table. If so, save original upvalue/local value in a safe place and -** use this safe copy in the previous assignment. -*/ -static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { - FuncState *fs = ls->fs; - int extra = fs->freereg; /* eventual position to save local variable */ - int conflict = 0; - for (; lh; lh = lh->prev) { /* check all previous assignments */ - if (lh->v.k == VINDEXED) { /* assigning to a table? */ - /* table is the upvalue/local being assigned now? */ - if (lh->v.u.ind.vt == v->k && lh->v.u.ind.t == v->u.info) { - conflict = 1; - lh->v.u.ind.vt = VLOCAL; - lh->v.u.ind.t = extra; /* previous assignment will use safe copy */ - } - /* index is the local being assigned? (index cannot be upvalue) */ - if (v->k == VLOCAL && lh->v.u.ind.idx == v->u.info) { - conflict = 1; - lh->v.u.ind.idx = extra; /* previous assignment will use safe copy */ - } - } - } - if (conflict) { - /* copy upvalue/local value to a temporary (in position 'extra') */ - OpCode op = (v->k == VLOCAL) ? OP_MOVE : OP_GETUPVAL; - luaK_codeABC(fs, op, extra, v->u.info, 0); - luaK_reserveregs(fs, 1); - } -} - - -static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { - expdesc e; - check_condition(ls, vkisvar(lh->v.k), "syntax error"); - if (testnext(ls, ',')) { /* assignment -> ',' suffixedexp assignment */ - struct LHS_assign nv; - nv.prev = lh; - suffixedexp(ls, &nv.v); - if (nv.v.k != VINDEXED) - check_conflict(ls, lh, &nv.v); - checklimit(ls->fs, nvars + ls->L->nCcalls, LUAI_MAXCCALLS, - "C levels"); - assignment(ls, &nv, nvars+1); - } - else { /* assignment -> '=' explist */ - int nexps; - checknext(ls, '='); - nexps = explist(ls, &e); - if (nexps != nvars) { - adjust_assign(ls, nvars, nexps, &e); - if (nexps > nvars) - ls->fs->freereg -= nexps - nvars; /* remove extra values */ - } - else { - luaK_setoneret(ls->fs, &e); /* close last expression */ - luaK_storevar(ls->fs, &lh->v, &e); - return; /* avoid default */ - } - } - init_exp(&e, VNONRELOC, ls->fs->freereg-1); /* default assignment */ - luaK_storevar(ls->fs, &lh->v, &e); -} - - -static int cond (LexState *ls) { - /* cond -> exp */ - expdesc v; - expr(ls, &v); /* read condition */ - if (v.k == VNIL) v.k = VFALSE; /* 'falses' are all equal here */ - luaK_goiftrue(ls->fs, &v); - return v.f; -} - - -static void gotostat (LexState *ls, int pc) { - int line = ls->linenumber; - TString *label; - int g; - if (testnext(ls, TK_GOTO)) - label = str_checkname(ls); - else { - luaX_next(ls); /* skip break */ - label = luaS_new(ls->L, "break"); - } - g = newlabelentry(ls, &ls->dyd->gt, label, line, pc); - findlabel(ls, g); /* close it if label already defined */ -} - - -/* check for repeated labels on the same block */ -static void checkrepeated (FuncState *fs, Labellist *ll, TString *label) { - int i; - for (i = fs->bl->firstlabel; i < ll->n; i++) { - if (eqstr(label, ll->arr[i].name)) { - const char *msg = luaO_pushfstring(fs->ls->L, - "label '%s' already defined on line %d", - getstr(label), ll->arr[i].line); - semerror(fs->ls, msg); - } - } -} - - -/* skip no-op statements */ -static void skipnoopstat (LexState *ls) { - while (ls->t.token == ';' || ls->t.token == TK_DBCOLON) - statement(ls); -} - - -static void labelstat (LexState *ls, TString *label, int line) { - /* label -> '::' NAME '::' */ - FuncState *fs = ls->fs; - Labellist *ll = &ls->dyd->label; - int l; /* index of new label being created */ - checkrepeated(fs, ll, label); /* check for repeated labels */ - checknext(ls, TK_DBCOLON); /* skip double colon */ - /* create new entry for this label */ - l = newlabelentry(ls, ll, label, line, fs->pc); - skipnoopstat(ls); /* skip other no-op statements */ - if (block_follow(ls, 0)) { /* label is last no-op statement in the block? */ - /* assume that locals are already out of scope */ - ll->arr[l].nactvar = fs->bl->nactvar; - } - findgotos(ls, &ll->arr[l]); -} - - -static void whilestat (LexState *ls, int line) { - /* whilestat -> WHILE cond DO block END */ - FuncState *fs = ls->fs; - int whileinit; - int condexit; - BlockCnt bl; - luaX_next(ls); /* skip WHILE */ - whileinit = luaK_getlabel(fs); - condexit = cond(ls); - enterblock(fs, &bl, 1); - checknext(ls, TK_DO); - block(ls); - luaK_jumpto(fs, whileinit); - check_match(ls, TK_END, TK_WHILE, line); - leaveblock(fs); - luaK_patchtohere(fs, condexit); /* false conditions finish the loop */ -} - - -static void repeatstat (LexState *ls, int line) { - /* repeatstat -> REPEAT block UNTIL cond */ - int condexit; - FuncState *fs = ls->fs; - int repeat_init = luaK_getlabel(fs); - BlockCnt bl1, bl2; - enterblock(fs, &bl1, 1); /* loop block */ - enterblock(fs, &bl2, 0); /* scope block */ - luaX_next(ls); /* skip REPEAT */ - statlist(ls); - check_match(ls, TK_UNTIL, TK_REPEAT, line); - condexit = cond(ls); /* read condition (inside scope block) */ - if (bl2.upval) /* upvalues? */ - luaK_patchclose(fs, condexit, bl2.nactvar); - leaveblock(fs); /* finish scope */ - luaK_patchlist(fs, condexit, repeat_init); /* close the loop */ - leaveblock(fs); /* finish loop */ -} - - -static int exp1 (LexState *ls) { - expdesc e; - int reg; - expr(ls, &e); - luaK_exp2nextreg(ls->fs, &e); - lua_assert(e.k == VNONRELOC); - reg = e.u.info; - return reg; -} - - -static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { - /* forbody -> DO block */ - BlockCnt bl; - FuncState *fs = ls->fs; - int prep, endfor; - adjustlocalvars(ls, 3); /* control variables */ - checknext(ls, TK_DO); - prep = isnum ? luaK_codeAsBx(fs, OP_FORPREP, base, NO_JUMP) : luaK_jump(fs); - enterblock(fs, &bl, 0); /* scope for declared variables */ - adjustlocalvars(ls, nvars); - luaK_reserveregs(fs, nvars); - block(ls); - leaveblock(fs); /* end of scope for declared variables */ - luaK_patchtohere(fs, prep); - if (isnum) /* numeric for? */ - endfor = luaK_codeAsBx(fs, OP_FORLOOP, base, NO_JUMP); - else { /* generic for */ - luaK_codeABC(fs, OP_TFORCALL, base, 0, nvars); - luaK_fixline(fs, line); - endfor = luaK_codeAsBx(fs, OP_TFORLOOP, base + 2, NO_JUMP); - } - luaK_patchlist(fs, endfor, prep + 1); - luaK_fixline(fs, line); -} - - -static void fornum (LexState *ls, TString *varname, int line) { - /* fornum -> NAME = exp1,exp1[,exp1] forbody */ - FuncState *fs = ls->fs; - int base = fs->freereg; - new_localvarliteral(ls, "(for index)"); - new_localvarliteral(ls, "(for limit)"); - new_localvarliteral(ls, "(for step)"); - new_localvar(ls, varname); - checknext(ls, '='); - exp1(ls); /* initial value */ - checknext(ls, ','); - exp1(ls); /* limit */ - if (testnext(ls, ',')) - exp1(ls); /* optional step */ - else { /* default step = 1 */ - luaK_codek(fs, fs->freereg, luaK_intK(fs, 1)); - luaK_reserveregs(fs, 1); - } - forbody(ls, base, line, 1, 1); -} - - -static void forlist (LexState *ls, TString *indexname) { - /* forlist -> NAME {,NAME} IN explist forbody */ - FuncState *fs = ls->fs; - expdesc e; - int nvars = 4; /* gen, state, control, plus at least one declared var */ - int line; - int base = fs->freereg; - /* create control variables */ - new_localvarliteral(ls, "(for generator)"); - new_localvarliteral(ls, "(for state)"); - new_localvarliteral(ls, "(for control)"); - /* create declared variables */ - new_localvar(ls, indexname); - while (testnext(ls, ',')) { - new_localvar(ls, str_checkname(ls)); - nvars++; - } - checknext(ls, TK_IN); - line = ls->linenumber; - adjust_assign(ls, 3, explist(ls, &e), &e); - luaK_checkstack(fs, 3); /* extra space to call generator */ - forbody(ls, base, line, nvars - 3, 0); -} - - -static void forstat (LexState *ls, int line) { - /* forstat -> FOR (fornum | forlist) END */ - FuncState *fs = ls->fs; - TString *varname; - BlockCnt bl; - enterblock(fs, &bl, 1); /* scope for loop and control variables */ - luaX_next(ls); /* skip 'for' */ - varname = str_checkname(ls); /* first variable name */ - switch (ls->t.token) { - case '=': fornum(ls, varname, line); break; - case ',': case TK_IN: forlist(ls, varname); break; - default: luaX_syntaxerror(ls, "'=' or 'in' expected"); - } - check_match(ls, TK_END, TK_FOR, line); - leaveblock(fs); /* loop scope ('break' jumps to this point) */ -} - - -static void test_then_block (LexState *ls, int *escapelist) { - /* test_then_block -> [IF | ELSEIF] cond THEN block */ - BlockCnt bl; - FuncState *fs = ls->fs; - expdesc v; - int jf; /* instruction to skip 'then' code (if condition is false) */ - luaX_next(ls); /* skip IF or ELSEIF */ - expr(ls, &v); /* read condition */ - checknext(ls, TK_THEN); - if (ls->t.token == TK_GOTO || ls->t.token == TK_BREAK) { - luaK_goiffalse(ls->fs, &v); /* will jump to label if condition is true */ - enterblock(fs, &bl, 0); /* must enter block before 'goto' */ - gotostat(ls, v.t); /* handle goto/break */ - skipnoopstat(ls); /* skip other no-op statements */ - if (block_follow(ls, 0)) { /* 'goto' is the entire block? */ - leaveblock(fs); - return; /* and that is it */ - } - else /* must skip over 'then' part if condition is false */ - jf = luaK_jump(fs); - } - else { /* regular case (not goto/break) */ - luaK_goiftrue(ls->fs, &v); /* skip over block if condition is false */ - enterblock(fs, &bl, 0); - jf = v.f; - } - statlist(ls); /* 'then' part */ - leaveblock(fs); - if (ls->t.token == TK_ELSE || - ls->t.token == TK_ELSEIF) /* followed by 'else'/'elseif'? */ - luaK_concat(fs, escapelist, luaK_jump(fs)); /* must jump over it */ - luaK_patchtohere(fs, jf); -} - - -static void ifstat (LexState *ls, int line) { - /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ - FuncState *fs = ls->fs; - int escapelist = NO_JUMP; /* exit list for finished parts */ - test_then_block(ls, &escapelist); /* IF cond THEN block */ - while (ls->t.token == TK_ELSEIF) - test_then_block(ls, &escapelist); /* ELSEIF cond THEN block */ - if (testnext(ls, TK_ELSE)) - block(ls); /* 'else' part */ - check_match(ls, TK_END, TK_IF, line); - luaK_patchtohere(fs, escapelist); /* patch escape list to 'if' end */ -} - - -static void localfunc (LexState *ls) { - expdesc b; - FuncState *fs = ls->fs; - new_localvar(ls, str_checkname(ls)); /* new local variable */ - adjustlocalvars(ls, 1); /* enter its scope */ - body(ls, &b, 0, ls->linenumber); /* function created in next register */ - /* debug information will only see the variable after this point! */ - getlocvar(fs, b.u.info)->startpc = fs->pc; -} - - -static void localstat (LexState *ls) { - /* stat -> LOCAL NAME {',' NAME} ['=' explist] */ - int nvars = 0; - int nexps; - expdesc e; - do { - new_localvar(ls, str_checkname(ls)); - nvars++; - } while (testnext(ls, ',')); - if (testnext(ls, '=')) - nexps = explist(ls, &e); - else { - e.k = VVOID; - nexps = 0; - } - adjust_assign(ls, nvars, nexps, &e); - adjustlocalvars(ls, nvars); -} - - -static int funcname (LexState *ls, expdesc *v) { - /* funcname -> NAME {fieldsel} [':' NAME] */ - int ismethod = 0; - singlevar(ls, v); - while (ls->t.token == '.') - fieldsel(ls, v); - if (ls->t.token == ':') { - ismethod = 1; - fieldsel(ls, v); - } - return ismethod; -} - - -static void funcstat (LexState *ls, int line) { - /* funcstat -> FUNCTION funcname body */ - int ismethod; - expdesc v, b; - luaX_next(ls); /* skip FUNCTION */ - ismethod = funcname(ls, &v); - body(ls, &b, ismethod, line); - luaK_storevar(ls->fs, &v, &b); - luaK_fixline(ls->fs, line); /* definition "happens" in the first line */ -} - - -static void exprstat (LexState *ls) { - /* stat -> func | assignment */ - FuncState *fs = ls->fs; - struct LHS_assign v; - suffixedexp(ls, &v.v); - if (ls->t.token == '=' || ls->t.token == ',') { /* stat -> assignment ? */ - v.prev = NULL; - assignment(ls, &v, 1); - } - else { /* stat -> func */ - check_condition(ls, v.v.k == VCALL, "syntax error"); - SETARG_C(getcode(fs, &v.v), 1); /* call statement uses no results */ - } -} - - -static void retstat (LexState *ls) { - /* stat -> RETURN [explist] [';'] */ - FuncState *fs = ls->fs; - expdesc e; - int first, nret; /* registers with returned values */ - if (block_follow(ls, 1) || ls->t.token == ';') - first = nret = 0; /* return no values */ - else { - nret = explist(ls, &e); /* optional return values */ - if (hasmultret(e.k)) { - luaK_setmultret(fs, &e); - if (e.k == VCALL && nret == 1) { /* tail call? */ - SET_OPCODE(getcode(fs,&e), OP_TAILCALL); - lua_assert(GETARG_A(getcode(fs,&e)) == fs->nactvar); - } - first = fs->nactvar; - nret = LUA_MULTRET; /* return all values */ - } - else { - if (nret == 1) /* only one single value? */ - first = luaK_exp2anyreg(fs, &e); - else { - luaK_exp2nextreg(fs, &e); /* values must go to the stack */ - first = fs->nactvar; /* return all active values */ - lua_assert(nret == fs->freereg - first); - } - } - } - luaK_ret(fs, first, nret); - testnext(ls, ';'); /* skip optional semicolon */ -} - - -static void statement (LexState *ls) { - int line = ls->linenumber; /* may be needed for error messages */ - enterlevel(ls); - switch (ls->t.token) { - case ';': { /* stat -> ';' (empty statement) */ - luaX_next(ls); /* skip ';' */ - break; - } - case TK_IF: { /* stat -> ifstat */ - ifstat(ls, line); - break; - } - case TK_WHILE: { /* stat -> whilestat */ - whilestat(ls, line); - break; - } - case TK_DO: { /* stat -> DO block END */ - luaX_next(ls); /* skip DO */ - block(ls); - check_match(ls, TK_END, TK_DO, line); - break; - } - case TK_FOR: { /* stat -> forstat */ - forstat(ls, line); - break; - } - case TK_REPEAT: { /* stat -> repeatstat */ - repeatstat(ls, line); - break; - } - case TK_FUNCTION: { /* stat -> funcstat */ - funcstat(ls, line); - break; - } - case TK_LOCAL: { /* stat -> localstat */ - luaX_next(ls); /* skip LOCAL */ - if (testnext(ls, TK_FUNCTION)) /* local function? */ - localfunc(ls); - else - localstat(ls); - break; - } - case TK_DBCOLON: { /* stat -> label */ - luaX_next(ls); /* skip double colon */ - labelstat(ls, str_checkname(ls), line); - break; - } - case TK_RETURN: { /* stat -> retstat */ - luaX_next(ls); /* skip RETURN */ - retstat(ls); - break; - } - case TK_BREAK: /* stat -> breakstat */ - case TK_GOTO: { /* stat -> 'goto' NAME */ - gotostat(ls, luaK_jump(ls->fs)); - break; - } - default: { /* stat -> func | assignment */ - exprstat(ls); - break; - } - } - lua_assert(ls->fs->f->maxstacksize >= ls->fs->freereg && - ls->fs->freereg >= ls->fs->nactvar); - ls->fs->freereg = ls->fs->nactvar; /* free registers */ - leavelevel(ls); -} - -/* }====================================================================== */ - - -/* -** compiles the main function, which is a regular vararg function with an -** upvalue named LUA_ENV -*/ -static void mainfunc (LexState *ls, FuncState *fs) { - BlockCnt bl; - expdesc v; - open_func(ls, fs, &bl); - fs->f->is_vararg = 1; /* main function is always vararg */ - init_exp(&v, VLOCAL, 0); /* create and... */ - newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */ - luaX_next(ls); /* read first token */ - statlist(ls); /* parse main body */ - check(ls, TK_EOS); - close_func(ls); -} - - -LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - Dyndata *dyd, const char *name, int firstchar) { - LexState lexstate; - FuncState funcstate; - LClosure *cl = luaF_newLclosure(L, 1); /* create main closure */ - setclLvalue(L, L->top, cl); /* anchor it (to avoid being collected) */ - incr_top(L); - lexstate.h = luaH_new(L); /* create table for scanner */ - sethvalue(L, L->top, lexstate.h); /* anchor it */ - incr_top(L); - funcstate.f = cl->p = luaF_newproto(L); - funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ - lua_assert(iswhite(funcstate.f)); /* do not need barrier here */ - lexstate.buff = buff; - lexstate.dyd = dyd; - dyd->actvar.n = dyd->gt.n = dyd->label.n = 0; - luaX_setinput(L, &lexstate, z, funcstate.f->source, firstchar); - mainfunc(&lexstate, &funcstate); - lua_assert(!funcstate.prev && funcstate.nups == 1 && !lexstate.fs); - /* all scopes should be correctly finished */ - lua_assert(dyd->actvar.n == 0 && dyd->gt.n == 0 && dyd->label.n == 0); - L->top--; /* remove scanner's table */ - return cl; /* closure is on the stack, too */ -} - diff --git a/external/mit/lua/dist/src/lparser.h b/external/mit/lua/dist/src/lparser.h deleted file mode 100644 index 0ece5369e..000000000 --- a/external/mit/lua/dist/src/lparser.h +++ /dev/null @@ -1,126 +0,0 @@ -/* $NetBSD: lparser.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lparser.h,v 1.74 2014/10/25 11:50:46 roberto Exp -** Lua Parser -** See Copyright Notice in lua.h -*/ - -#ifndef lparser_h -#define lparser_h - -#include "llimits.h" -#include "lobject.h" -#include "lzio.h" - - -/* -** Expression descriptor -*/ - -typedef enum { - VVOID, /* no value */ - VNIL, - VTRUE, - VFALSE, - VK, /* info = index of constant in 'k' */ -#ifndef _KERNEL - VKFLT, /* nval = numerical float value */ -#endif - VKINT, /* nval = numerical integer value */ - VNONRELOC, /* info = result register */ - VLOCAL, /* info = local register */ - VUPVAL, /* info = index of upvalue in 'upvalues' */ - VINDEXED, /* t = table register/upvalue; idx = index R/K */ - VJMP, /* info = instruction pc */ - VRELOCABLE, /* info = instruction pc */ - VCALL, /* info = instruction pc */ - VVARARG /* info = instruction pc */ -} expkind; - - -#define vkisvar(k) (VLOCAL <= (k) && (k) <= VINDEXED) -#define vkisinreg(k) ((k) == VNONRELOC || (k) == VLOCAL) - -typedef struct expdesc { - expkind k; - union { - struct { /* for indexed variables (VINDEXED) */ - short idx; /* index (R/K) */ - lu_byte t; /* table (register or upvalue) */ - lu_byte vt; /* whether 't' is register (VLOCAL) or upvalue (VUPVAL) */ - } ind; - int info; /* for generic use */ -#ifndef _KERNEL - lua_Number nval; /* for VKFLT */ -#endif - lua_Integer ival; /* for VKINT */ - } u; - int t; /* patch list of 'exit when true' */ - int f; /* patch list of 'exit when false' */ -} expdesc; - - -/* description of active local variable */ -typedef struct Vardesc { - short idx; /* variable index in stack */ -} Vardesc; - - -/* description of pending goto statements and label statements */ -typedef struct Labeldesc { - TString *name; /* label identifier */ - int pc; /* position in code */ - int line; /* line where it appeared */ - lu_byte nactvar; /* local level where it appears in current block */ -} Labeldesc; - - -/* list of labels or gotos */ -typedef struct Labellist { - Labeldesc *arr; /* array */ - int n; /* number of entries in use */ - int size; /* array size */ -} Labellist; - - -/* dynamic structures used by the parser */ -typedef struct Dyndata { - struct { /* list of active local variables */ - Vardesc *arr; - int n; - int size; - } actvar; - Labellist gt; /* list of pending gotos */ - Labellist label; /* list of active labels */ -} Dyndata; - - -/* control of blocks */ -struct BlockCnt; /* defined in lparser.c */ - - -/* state needed to generate code for a given function */ -typedef struct FuncState { - Proto *f; /* current function header */ - struct FuncState *prev; /* enclosing function */ - struct LexState *ls; /* lexical state */ - struct BlockCnt *bl; /* chain of current blocks */ - int pc; /* next position to code (equivalent to 'ncode') */ - int lasttarget; /* 'label' of last 'jump label' */ - int jpc; /* list of pending jumps to 'pc' */ - int nk; /* number of elements in 'k' */ - int np; /* number of elements in 'p' */ - int firstlocal; /* index of first local var (in Dyndata array) */ - short nlocvars; /* number of elements in 'f->locvars' */ - lu_byte nactvar; /* number of active local variables */ - lu_byte nups; /* number of upvalues */ - lu_byte freereg; /* first free register */ -} FuncState; - - -LUAI_FUNC LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, - Dyndata *dyd, const char *name, int firstchar); - - -#endif diff --git a/external/mit/lua/dist/src/lprefix.h b/external/mit/lua/dist/src/lprefix.h deleted file mode 100644 index 69bdc905f..000000000 --- a/external/mit/lua/dist/src/lprefix.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: lprefix.h,v 1.2 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lprefix.h,v 1.2 2014/12/29 16:54:13 roberto Exp -** Definitions for Lua code that must come before any other header file -** See Copyright Notice in lua.h -*/ - -#ifndef lprefix_h -#define lprefix_h - - -#ifndef _KERNEL -/* -** Allows POSIX/XSI stuff -*/ -#if !defined(LUA_USE_C89) /* { */ - -#if !defined(_XOPEN_SOURCE) -#define _XOPEN_SOURCE 600 -#elif _XOPEN_SOURCE == 0 -#undef _XOPEN_SOURCE /* use -D_XOPEN_SOURCE=0 to undefine it */ -#endif - -/* -** Allows manipulation of large files in gcc and some other compilers -*/ -#if !defined(LUA_32BITS) && !defined(_FILE_OFFSET_BITS) -#define _LARGEFILE_SOURCE 1 -#define _FILE_OFFSET_BITS 64 -#endif - -#endif /* } */ -#endif - - -/* -** Windows stuff -*/ -#if defined(_WIN32) /* { */ - -#if !defined(_CRT_SECURE_NO_WARNINGS) -#define _CRT_SECURE_NO_WARNINGS /* avoid warnings about ISO C functions */ -#endif - -#endif /* } */ - -#endif - diff --git a/external/mit/lua/dist/src/lstate.c b/external/mit/lua/dist/src/lstate.c deleted file mode 100644 index ecc4c143a..000000000 --- a/external/mit/lua/dist/src/lstate.c +++ /dev/null @@ -1,344 +0,0 @@ -/* $NetBSD: lstate.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lstate.c,v 2.128 2015/03/04 13:31:21 roberto Exp -** Global State -** See Copyright Notice in lua.h -*/ - -#define lstate_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#endif - -#include "lua.h" - -#include "lapi.h" -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "llex.h" -#include "lmem.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" - - -#if !defined(LUAI_GCPAUSE) -#define LUAI_GCPAUSE 200 /* 200% */ -#endif - -#if !defined(LUAI_GCMUL) -#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */ -#endif - - -/* -** a macro to help the creation of a unique random seed when a state is -** created; the seed is used to randomize hashes. -*/ -#if !defined(luai_makeseed) -#include -#define luai_makeseed() cast(unsigned int, time(NULL)) -#endif - - - -/* -** thread state + extra space -*/ -typedef struct LX { - lu_byte extra_[LUA_EXTRASPACE]; - lua_State l; -} LX; - - -/* -** Main thread combines a thread state and the global state -*/ -typedef struct LG { - LX l; - global_State g; -} LG; - - - -#define fromstate(L) (cast(LX *, cast(lu_byte *, (L)) - offsetof(LX, l))) - - -/* -** Compute an initial seed as random as possible. Rely on Address Space -** Layout Randomization (if present) to increase randomness.. -*/ -#define addbuff(b,p,e) \ - { size_t t = cast(size_t, e); \ - memcpy(buff + p, &t, sizeof(t)); p += sizeof(t); } - -static unsigned int makeseed (lua_State *L) { - char buff[4 * sizeof(size_t)]; - unsigned int h = luai_makeseed(); - int p = 0; - addbuff(buff, p, L); /* heap variable */ - addbuff(buff, p, &h); /* local variable */ - addbuff(buff, p, luaO_nilobject); /* global variable */ - addbuff(buff, p, &lua_newstate); /* public function */ - lua_assert(p == sizeof(buff)); - return luaS_hash(buff, p, h); -} - - -/* -** set GCdebt to a new value keeping the value (totalbytes + GCdebt) -** invariant -*/ -void luaE_setdebt (global_State *g, l_mem debt) { - g->totalbytes -= (debt - g->GCdebt); - g->GCdebt = debt; -} - - -CallInfo *luaE_extendCI (lua_State *L) { - CallInfo *ci = luaM_new(L, CallInfo); - lua_assert(L->ci->next == NULL); - L->ci->next = ci; - ci->previous = L->ci; - ci->next = NULL; - return ci; -} - - -/* -** free all CallInfo structures not in use by a thread -*/ -void luaE_freeCI (lua_State *L) { - CallInfo *ci = L->ci; - CallInfo *next = ci->next; - ci->next = NULL; - while ((ci = next) != NULL) { - next = ci->next; - luaM_free(L, ci); - } -} - - -/* -** free half of the CallInfo structures not in use by a thread -*/ -void luaE_shrinkCI (lua_State *L) { - CallInfo *ci = L->ci; - while (ci->next != NULL) { /* while there is 'next' */ - CallInfo *next2 = ci->next->next; /* next's next */ - if (next2 == NULL) break; - luaM_free(L, ci->next); /* remove next */ - ci->next = next2; /* remove 'next' from the list */ - next2->previous = ci; - ci = next2; - } -} - - -static void stack_init (lua_State *L1, lua_State *L) { - int i; CallInfo *ci; - /* initialize stack array */ - L1->stack = luaM_newvector(L, BASIC_STACK_SIZE, TValue); - L1->stacksize = BASIC_STACK_SIZE; - for (i = 0; i < BASIC_STACK_SIZE; i++) - setnilvalue(L1->stack + i); /* erase new stack */ - L1->top = L1->stack; - L1->stack_last = L1->stack + L1->stacksize - EXTRA_STACK; - /* initialize first ci */ - ci = &L1->base_ci; - ci->next = ci->previous = NULL; - ci->callstatus = 0; - ci->func = L1->top; - setnilvalue(L1->top++); /* 'function' entry for this 'ci' */ - ci->top = L1->top + LUA_MINSTACK; - L1->ci = ci; -} - - -static void freestack (lua_State *L) { - if (L->stack == NULL) - return; /* stack not completely built yet */ - L->ci = &L->base_ci; /* free the entire 'ci' list */ - luaE_freeCI(L); - luaM_freearray(L, L->stack, L->stacksize); /* free stack array */ -} - - -/* -** Create registry table and its predefined values -*/ -static void init_registry (lua_State *L, global_State *g) { - TValue temp; - /* create registry */ - Table *registry = luaH_new(L); - sethvalue(L, &g->l_registry, registry); - luaH_resize(L, registry, LUA_RIDX_LAST, 0); - /* registry[LUA_RIDX_MAINTHREAD] = L */ - setthvalue(L, &temp, L); /* temp = L */ - luaH_setint(L, registry, LUA_RIDX_MAINTHREAD, &temp); - /* registry[LUA_RIDX_GLOBALS] = table of globals */ - sethvalue(L, &temp, luaH_new(L)); /* temp = new table (global table) */ - luaH_setint(L, registry, LUA_RIDX_GLOBALS, &temp); -} - - -/* -** open parts of the state that may cause memory-allocation errors. -** ('g->version' != NULL flags that the state was completely build) -*/ -static void f_luaopen (lua_State *L, void *ud) { - global_State *g = G(L); - UNUSED(ud); - stack_init(L, L); /* init stack */ - init_registry(L, g); - luaS_init(L); - luaT_init(L); - luaX_init(L); - g->gcrunning = 1; /* allow gc */ - g->version = lua_version(NULL); - luai_userstateopen(L); -} - - -/* -** preinitialize a thread with consistent values without allocating -** any memory (to avoid errors) -*/ -static void preinit_thread (lua_State *L, global_State *g) { - G(L) = g; - L->stack = NULL; - L->ci = NULL; - L->stacksize = 0; - L->twups = L; /* thread has no upvalues */ - L->errorJmp = NULL; - L->nCcalls = 0; - L->hook = NULL; - L->hookmask = 0; - L->basehookcount = 0; - L->allowhook = 1; - resethookcount(L); - L->openupval = NULL; - L->nny = 1; - L->status = LUA_OK; - L->errfunc = 0; -} - - -static void close_state (lua_State *L) { - global_State *g = G(L); - luaF_close(L, L->stack); /* close all upvalues for this thread */ - luaC_freeallobjects(L); /* collect all objects */ - if (g->version) /* closing a fully built state? */ - luai_userstateclose(L); - luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); - luaZ_freebuffer(L, &g->buff); - freestack(L); - lua_assert(gettotalbytes(g) == sizeof(LG)); - (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ -} - - -LUA_API lua_State *lua_newthread (lua_State *L) { - global_State *g = G(L); - lua_State *L1; - lua_lock(L); - luaC_checkGC(L); - /* create new thread */ - L1 = &cast(LX *, luaM_newobject(L, LUA_TTHREAD, sizeof(LX)))->l; - L1->marked = luaC_white(g); - L1->tt = LUA_TTHREAD; - /* link it on list 'allgc' */ - L1->next = g->allgc; - g->allgc = obj2gco(L1); - /* anchor it on L stack */ - setthvalue(L, L->top, L1); - api_incr_top(L); - preinit_thread(L1, g); - L1->hookmask = L->hookmask; - L1->basehookcount = L->basehookcount; - L1->hook = L->hook; - resethookcount(L1); - /* initialize L1 extra space */ - memcpy(lua_getextraspace(L1), lua_getextraspace(g->mainthread), - LUA_EXTRASPACE); - luai_userstatethread(L, L1); - stack_init(L1, L); /* init stack */ - lua_unlock(L); - return L1; -} - - -void luaE_freethread (lua_State *L, lua_State *L1) { - LX *l = fromstate(L1); - luaF_close(L1, L1->stack); /* close all upvalues for this thread */ - lua_assert(L1->openupval == NULL); - luai_userstatefree(L, L1); - freestack(L1); - luaM_free(L, l); -} - - -LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { - int i; - lua_State *L; - global_State *g; - LG *l = cast(LG *, (*f)(ud, NULL, LUA_TTHREAD, sizeof(LG))); - if (l == NULL) return NULL; - L = &l->l.l; - g = &l->g; - L->next = NULL; - L->tt = LUA_TTHREAD; - g->currentwhite = bitmask(WHITE0BIT); - L->marked = luaC_white(g); - preinit_thread(L, g); - g->frealloc = f; - g->ud = ud; - g->mainthread = L; - g->seed = makeseed(L); - g->gcrunning = 0; /* no GC while building state */ - g->GCestimate = 0; - g->strt.size = g->strt.nuse = 0; - g->strt.hash = NULL; - setnilvalue(&g->l_registry); - luaZ_initbuffer(L, &g->buff); - g->panic = NULL; - g->version = NULL; - g->gcstate = GCSpause; - g->gckind = KGC_NORMAL; - g->allgc = g->finobj = g->tobefnz = g->fixedgc = NULL; - g->sweepgc = NULL; - g->gray = g->grayagain = NULL; - g->weak = g->ephemeron = g->allweak = NULL; - g->twups = NULL; - g->totalbytes = sizeof(LG); - g->GCdebt = 0; - g->gcfinnum = 0; - g->gcpause = LUAI_GCPAUSE; - g->gcstepmul = LUAI_GCMUL; - for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; - if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { - /* memory allocation error: free partial state */ - close_state(L); - L = NULL; - } - return L; -} - - -LUA_API void lua_close (lua_State *L) { - L = G(L)->mainthread; /* only the main thread can be closed */ - lua_lock(L); - close_state(L); -} - - diff --git a/external/mit/lua/dist/src/lstate.h b/external/mit/lua/dist/src/lstate.h deleted file mode 100644 index 936f81240..000000000 --- a/external/mit/lua/dist/src/lstate.h +++ /dev/null @@ -1,227 +0,0 @@ -/* $NetBSD: lstate.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lstate.h,v 2.122 2015/06/01 16:34:37 roberto Exp -** Global State -** See Copyright Notice in lua.h -*/ - -#ifndef lstate_h -#define lstate_h - -#include "lua.h" - -#include "lobject.h" -#include "ltm.h" -#include "lzio.h" - - -/* - -** Some notes about garbage-collected objects: All objects in Lua must -** be kept somehow accessible until being freed, so all objects always -** belong to one (and only one) of these lists, using field 'next' of -** the 'CommonHeader' for the link: -** -** 'allgc': all objects not marked for finalization; -** 'finobj': all objects marked for finalization; -** 'tobefnz': all objects ready to be finalized; -** 'fixedgc': all objects that are not to be collected (currently -** only small strings, such as reserved words). - -*/ - - -struct lua_longjmp; /* defined in ldo.c */ - - - -/* extra stack space to handle TM calls and some other extras */ -#define EXTRA_STACK 5 - - -#define BASIC_STACK_SIZE (2*LUA_MINSTACK) - - -/* kinds of Garbage Collection */ -#define KGC_NORMAL 0 -#define KGC_EMERGENCY 1 /* gc was forced by an allocation failure */ - - -typedef struct stringtable { - TString **hash; - int nuse; /* number of elements */ - int size; -} stringtable; - - -/* -** Information about a call. -** When a thread yields, 'func' is adjusted to pretend that the -** top function has only the yielded values in its stack; in that -** case, the actual 'func' value is saved in field 'extra'. -** When a function calls another with a continuation, 'extra' keeps -** the function index so that, in case of errors, the continuation -** function can be called with the correct top. -*/ -typedef struct CallInfo { - StkId func; /* function index in the stack */ - StkId top; /* top for this function */ - struct CallInfo *previous, *next; /* dynamic call link */ - union { - struct { /* only for Lua functions */ - StkId base; /* base for this function */ - const Instruction *savedpc; - } l; - struct { /* only for C functions */ - lua_KFunction k; /* continuation in case of yields */ - ptrdiff_t old_errfunc; - lua_KContext ctx; /* context info. in case of yields */ - } c; - } u; - ptrdiff_t extra; - short nresults; /* expected number of results from this function */ - lu_byte callstatus; -} CallInfo; - - -/* -** Bits in CallInfo status -*/ -#define CIST_OAH (1<<0) /* original value of 'allowhook' */ -#define CIST_LUA (1<<1) /* call is running a Lua function */ -#define CIST_HOOKED (1<<2) /* call is running a debug hook */ -#define CIST_REENTRY (1<<3) /* call is running on same invocation of - luaV_execute of previous call */ -#define CIST_YPCALL (1<<4) /* call is a yieldable protected call */ -#define CIST_TAIL (1<<5) /* call was tail called */ -#define CIST_HOOKYIELD (1<<6) /* last hook called yielded */ -#define CIST_LEQ (1<<7) /* using __lt for __le */ - -#define isLua(ci) ((ci)->callstatus & CIST_LUA) - -/* assume that CIST_OAH has offset 0 and that 'v' is strictly 0/1 */ -#define setoah(st,v) ((st) = ((st) & ~CIST_OAH) | (v)) -#define getoah(st) ((st) & CIST_OAH) - - -/* -** 'global state', shared by all threads of this state -*/ -typedef struct global_State { - lua_Alloc frealloc; /* function to reallocate memory */ - void *ud; /* auxiliary data to 'frealloc' */ - lu_mem totalbytes; /* number of bytes currently allocated - GCdebt */ - l_mem GCdebt; /* bytes allocated not yet compensated by the collector */ - lu_mem GCmemtrav; /* memory traversed by the GC */ - lu_mem GCestimate; /* an estimate of the non-garbage memory in use */ - stringtable strt; /* hash table for strings */ - TValue l_registry; - unsigned int seed; /* randomized seed for hashes */ - lu_byte currentwhite; - lu_byte gcstate; /* state of garbage collector */ - lu_byte gckind; /* kind of GC running */ - lu_byte gcrunning; /* true if GC is running */ - GCObject *allgc; /* list of all collectable objects */ - GCObject **sweepgc; /* current position of sweep in list */ - GCObject *finobj; /* list of collectable objects with finalizers */ - GCObject *gray; /* list of gray objects */ - GCObject *grayagain; /* list of objects to be traversed atomically */ - GCObject *weak; /* list of tables with weak values */ - GCObject *ephemeron; /* list of ephemeron tables (weak keys) */ - GCObject *allweak; /* list of all-weak tables */ - GCObject *tobefnz; /* list of userdata to be GC */ - GCObject *fixedgc; /* list of objects not to be collected */ - struct lua_State *twups; /* list of threads with open upvalues */ - Mbuffer buff; /* temporary buffer for string concatenation */ - unsigned int gcfinnum; /* number of finalizers to call in each GC step */ - int gcpause; /* size of pause between successive GCs */ - int gcstepmul; /* GC 'granularity' */ - lua_CFunction panic; /* to be called in unprotected errors */ - struct lua_State *mainthread; - const lua_Number *version; /* pointer to version number */ - TString *memerrmsg; /* memory-error message */ - TString *tmname[TM_N]; /* array with tag-method names */ - struct Table *mt[LUA_NUMTAGS]; /* metatables for basic types */ - TString *strcache[STRCACHE_SIZE][1]; /* cache for strings in API */ -} global_State; - - -/* -** 'per thread' state -*/ -struct lua_State { - CommonHeader; - lu_byte status; - StkId top; /* first free slot in the stack */ - global_State *l_G; - CallInfo *ci; /* call info for current function */ - const Instruction *oldpc; /* last pc traced */ - StkId stack_last; /* last free slot in the stack */ - StkId stack; /* stack base */ - UpVal *openupval; /* list of open upvalues in this stack */ - GCObject *gclist; - struct lua_State *twups; /* list of threads with open upvalues */ - struct lua_longjmp *errorJmp; /* current error recover point */ - CallInfo base_ci; /* CallInfo for first level (C calling Lua) */ - lua_Hook hook; - ptrdiff_t errfunc; /* current error handling function (stack index) */ - int stacksize; - int basehookcount; - int hookcount; - unsigned short nny; /* number of non-yieldable calls in stack */ - unsigned short nCcalls; /* number of nested C calls */ - lu_byte hookmask; - lu_byte allowhook; -}; - - -#define G(L) (L->l_G) - - -/* -** Union of all collectable objects (only for conversions) -*/ -union GCUnion { - GCObject gc; /* common header */ - struct TString ts; - struct Udata u; - union Closure cl; - struct Table h; - struct Proto p; - struct lua_State th; /* thread */ -}; - - -#define cast_u(o) cast(union GCUnion *, (o)) - -/* macros to convert a GCObject into a specific value */ -#define gco2ts(o) \ - check_exp(novariant((o)->tt) == LUA_TSTRING, &((cast_u(o))->ts)) -#define gco2u(o) check_exp((o)->tt == LUA_TUSERDATA, &((cast_u(o))->u)) -#define gco2lcl(o) check_exp((o)->tt == LUA_TLCL, &((cast_u(o))->cl.l)) -#define gco2ccl(o) check_exp((o)->tt == LUA_TCCL, &((cast_u(o))->cl.c)) -#define gco2cl(o) \ - check_exp(novariant((o)->tt) == LUA_TFUNCTION, &((cast_u(o))->cl)) -#define gco2t(o) check_exp((o)->tt == LUA_TTABLE, &((cast_u(o))->h)) -#define gco2p(o) check_exp((o)->tt == LUA_TPROTO, &((cast_u(o))->p)) -#define gco2th(o) check_exp((o)->tt == LUA_TTHREAD, &((cast_u(o))->th)) - - -/* macro to convert a Lua object into a GCObject */ -#define obj2gco(v) \ - check_exp(novariant((v)->tt) < LUA_TDEADKEY, (&(cast_u(v)->gc))) - - -/* actual number of total bytes allocated */ -#define gettotalbytes(g) ((g)->totalbytes + (g)->GCdebt) - -LUAI_FUNC void luaE_setdebt (global_State *g, l_mem debt); -LUAI_FUNC void luaE_freethread (lua_State *L, lua_State *L1); -LUAI_FUNC CallInfo *luaE_extendCI (lua_State *L); -LUAI_FUNC void luaE_freeCI (lua_State *L); -LUAI_FUNC void luaE_shrinkCI (lua_State *L); - - -#endif - diff --git a/external/mit/lua/dist/src/lstring.c b/external/mit/lua/dist/src/lstring.c deleted file mode 100644 index 49b80714a..000000000 --- a/external/mit/lua/dist/src/lstring.c +++ /dev/null @@ -1,230 +0,0 @@ -/* $NetBSD: lstring.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lstring.c,v 2.49 2015/06/01 16:34:37 roberto Exp -** String table (keeps all strings handled by Lua) -** See Copyright Notice in lua.h -*/ - -#define lstring_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" - - -#define MEMERRMSG "not enough memory" - - -/* -** Lua will use at most ~(2^LUAI_HASHLIMIT) bytes from a string to -** compute its hash -*/ -#if !defined(LUAI_HASHLIMIT) -#define LUAI_HASHLIMIT 5 -#endif - - -/* -** equality for long strings -*/ -int luaS_eqlngstr (TString *a, TString *b) { - size_t len = a->u.lnglen; - lua_assert(a->tt == LUA_TLNGSTR && b->tt == LUA_TLNGSTR); - return (a == b) || /* same instance or... */ - ((len == b->u.lnglen) && /* equal length and ... */ - (memcmp(getstr(a), getstr(b), len) == 0)); /* equal contents */ -} - - -unsigned int luaS_hash (const char *str, size_t l, unsigned int seed) { - unsigned int h = seed ^ cast(unsigned int, l); - size_t l1; - size_t step = (l >> LUAI_HASHLIMIT) + 1; - for (l1 = l; l1 >= step; l1 -= step) - h = h ^ ((h<<5) + (h>>2) + cast_byte(str[l1 - 1])); - return h; -} - - -/* -** resizes the string table -*/ -void luaS_resize (lua_State *L, int newsize) { - int i; - stringtable *tb = &G(L)->strt; - if (newsize > tb->size) { /* grow table if needed */ - luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); - for (i = tb->size; i < newsize; i++) - tb->hash[i] = NULL; - } - for (i = 0; i < tb->size; i++) { /* rehash */ - TString *p = tb->hash[i]; - tb->hash[i] = NULL; - while (p) { /* for each node in the list */ - TString *hnext = p->u.hnext; /* save next */ - unsigned int h = lmod(p->hash, newsize); /* new position */ - p->u.hnext = tb->hash[h]; /* chain it */ - tb->hash[h] = p; - p = hnext; - } - } - if (newsize < tb->size) { /* shrink table if needed */ - /* vanishing slice should be empty */ - lua_assert(tb->hash[newsize] == NULL && tb->hash[tb->size - 1] == NULL); - luaM_reallocvector(L, tb->hash, tb->size, newsize, TString *); - } - tb->size = newsize; -} - - -/* -** Clear API string cache. (Entries cannot be empty, so fill them with -** a non-collectable string.) -*/ -void luaS_clearcache (global_State *g) { - int i; - for (i = 0; i < STRCACHE_SIZE; i++) { - if (iswhite(g->strcache[i][0])) /* will entry be collected? */ - g->strcache[i][0] = g->memerrmsg; /* replace it with something fixed */ - } -} - - -/* -** Initialize the string table and the string cache -*/ -void luaS_init (lua_State *L) { - global_State *g = G(L); - int i; - luaS_resize(L, MINSTRTABSIZE); /* initial size of string table */ - /* pre-create memory-error message */ - g->memerrmsg = luaS_newliteral(L, MEMERRMSG); - luaC_fix(L, obj2gco(g->memerrmsg)); /* it should never be collected */ - for (i = 0; i < STRCACHE_SIZE; i++) /* fill cache with valid strings */ - g->strcache[i][0] = g->memerrmsg; -} - - - -/* -** creates a new string object -*/ -static TString *createstrobj (lua_State *L, const char *str, size_t l, - int tag, unsigned int h) { - TString *ts; - GCObject *o; - size_t totalsize; /* total size of TString object */ - totalsize = sizelstring(l); - o = luaC_newobj(L, tag, totalsize); - ts = gco2ts(o); - ts->hash = h; - ts->extra = 0; - memcpy(getaddrstr(ts), str, l * sizeof(char)); - getaddrstr(ts)[l] = '\0'; /* ending 0 */ - return ts; -} - - -void luaS_remove (lua_State *L, TString *ts) { - stringtable *tb = &G(L)->strt; - TString **p = &tb->hash[lmod(ts->hash, tb->size)]; - while (*p != ts) /* find previous element */ - p = &(*p)->u.hnext; - *p = (*p)->u.hnext; /* remove element from its list */ - tb->nuse--; -} - - -/* -** checks whether short string exists and reuses it or creates a new one -*/ -static TString *internshrstr (lua_State *L, const char *str, size_t l) { - TString *ts; - global_State *g = G(L); - unsigned int h = luaS_hash(str, l, g->seed); - TString **list = &g->strt.hash[lmod(h, g->strt.size)]; - for (ts = *list; ts != NULL; ts = ts->u.hnext) { - if (l == ts->shrlen && - (memcmp(str, getstr(ts), l * sizeof(char)) == 0)) { - /* found! */ - if (isdead(g, ts)) /* dead (but not collected yet)? */ - changewhite(ts); /* resurrect it */ - return ts; - } - } - if (g->strt.nuse >= g->strt.size && g->strt.size <= MAX_INT/2) { - luaS_resize(L, g->strt.size * 2); - list = &g->strt.hash[lmod(h, g->strt.size)]; /* recompute with new size */ - } - ts = createstrobj(L, str, l, LUA_TSHRSTR, h); - ts->shrlen = cast_byte(l); - ts->u.hnext = *list; - *list = ts; - g->strt.nuse++; - return ts; -} - - -/* -** new string (with explicit length) -*/ -TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { - if (l <= LUAI_MAXSHORTLEN) /* short string? */ - return internshrstr(L, str, l); - else { - TString *ts; - if (l + 1 > (MAX_SIZE - sizeof(TString))/sizeof(char)) - luaM_toobig(L); - ts = createstrobj(L, str, l, LUA_TLNGSTR, G(L)->seed); - ts->u.lnglen = l; - return ts; - } -} - - -/* -** Create or reuse a zero-terminated string, first checking in the -** cache (using the string address as a key). The cache can contain -** only zero-terminated strings, so it is safe to use 'strcmp' to -** check hits. -*/ -TString *luaS_new (lua_State *L, const char *str) { - unsigned int i = point2uint(str) % STRCACHE_SIZE; /* hash */ - TString **p = G(L)->strcache[i]; - if (strcmp(str, getstr(p[0])) == 0) /* hit? */ - return p[0]; /* that it is */ - else { /* normal route */ - TString *s = luaS_newlstr(L, str, strlen(str)); - p[0] = s; - return s; - } -} - - -Udata *luaS_newudata (lua_State *L, size_t s) { - Udata *u; - GCObject *o; - if (s > MAX_SIZE - sizeof(Udata)) - luaM_toobig(L); - o = luaC_newobj(L, LUA_TUSERDATA, sizeludata(s)); - u = gco2u(o); - u->len = s; - u->metatable = NULL; - setuservalue(L, u, luaO_nilobject); - return u; -} - diff --git a/external/mit/lua/dist/src/lstring.h b/external/mit/lua/dist/src/lstring.h deleted file mode 100644 index bf0e6c70e..000000000 --- a/external/mit/lua/dist/src/lstring.h +++ /dev/null @@ -1,49 +0,0 @@ -/* $NetBSD: lstring.h,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lstring.h,v 1.59 2015/03/25 13:42:19 roberto Exp -** String table (keep all strings handled by Lua) -** See Copyright Notice in lua.h -*/ - -#ifndef lstring_h -#define lstring_h - -#include "lgc.h" -#include "lobject.h" -#include "lstate.h" - - -#define sizelstring(l) (sizeof(union UTString) + ((l) + 1) * sizeof(char)) - -#define sizeludata(l) (sizeof(union UUdata) + (l)) -#define sizeudata(u) sizeludata((u)->len) - -#define luaS_newliteral(L, s) (luaS_newlstr(L, "" s, \ - (sizeof(s)/sizeof(char))-1)) - - -/* -** test whether a string is a reserved word -*/ -#define isreserved(s) ((s)->tt == LUA_TSHRSTR && (s)->extra > 0) - - -/* -** equality for short strings, which are always internalized -*/ -#define eqshrstr(a,b) check_exp((a)->tt == LUA_TSHRSTR, (a) == (b)) - - -LUAI_FUNC unsigned int luaS_hash (const char *str, size_t l, unsigned int seed); -LUAI_FUNC int luaS_eqlngstr (TString *a, TString *b); -LUAI_FUNC void luaS_resize (lua_State *L, int newsize); -LUAI_FUNC void luaS_clearcache (global_State *g); -LUAI_FUNC void luaS_init (lua_State *L); -LUAI_FUNC void luaS_remove (lua_State *L, TString *ts); -LUAI_FUNC Udata *luaS_newudata (lua_State *L, size_t s); -LUAI_FUNC TString *luaS_newlstr (lua_State *L, const char *str, size_t l); -LUAI_FUNC TString *luaS_new (lua_State *L, const char *str); - - -#endif diff --git a/external/mit/lua/dist/src/lstrlib.c b/external/mit/lua/dist/src/lstrlib.c deleted file mode 100644 index 2d105c5a0..000000000 --- a/external/mit/lua/dist/src/lstrlib.c +++ /dev/null @@ -1,1541 +0,0 @@ -/* $NetBSD: lstrlib.c,v 1.9 2015/10/08 13:40:16 mbalmer Exp $ */ - -/* -** Id: lstrlib.c,v 1.229 2015/05/20 17:39:23 roberto Exp -** Standard library for string operations and pattern-matching -** See Copyright Notice in lua.h -*/ - -#define lstrlib_c -#define LUA_LIB - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#include -#include -#include -#include -#include -#endif - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -/* -** maximum number of captures that a pattern can do during -** pattern-matching. This limit is arbitrary. -*/ -#if !defined(LUA_MAXCAPTURES) -#define LUA_MAXCAPTURES 32 -#endif - - -/* macro to 'unsign' a character */ -#define uchar(c) ((unsigned char)(c)) - - -/* -** Some sizes are better limited to fit in 'int', but must also fit in -** 'size_t'. (We assume that 'lua_Integer' cannot be smaller than 'int'.) -*/ -#define MAXSIZE \ - (sizeof(size_t) < sizeof(int) ? (~(size_t)0) : (size_t)(INT_MAX)) - - - - -static int str_len (lua_State *L) { - size_t l; - luaL_checklstring(L, 1, &l); - lua_pushinteger(L, (lua_Integer)l); - return 1; -} - - -/* translate a relative string position: negative means back from end */ -static lua_Integer posrelat (lua_Integer pos, size_t len) { - if (pos >= 0) return pos; - else if (0u - (size_t)pos > len) return 0; - else return (lua_Integer)len + pos + 1; -} - - -static int str_sub (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - lua_Integer start = posrelat(luaL_checkinteger(L, 2), l); - lua_Integer end = posrelat(luaL_optinteger(L, 3, -1), l); - if (start < 1) start = 1; - if (end > (lua_Integer)l) end = l; - if (start <= end) - lua_pushlstring(L, s + start - 1, (size_t)(end - start) + 1); - else lua_pushliteral(L, ""); - return 1; -} - - -static int str_reverse (lua_State *L) { - size_t l, i; - luaL_Buffer b; - const char *s = luaL_checklstring(L, 1, &l); - char *p = luaL_buffinitsize(L, &b, l); - for (i = 0; i < l; i++) - p[i] = s[l - i - 1]; - luaL_pushresultsize(&b, l); - return 1; -} - - -static int str_lower (lua_State *L) { - size_t l; - size_t i; - luaL_Buffer b; - const char *s = luaL_checklstring(L, 1, &l); - char *p = luaL_buffinitsize(L, &b, l); - for (i=0; i MAXSIZE / n) /* may overflow? */ - return luaL_error(L, "resulting string too large"); - else { - size_t totallen = (size_t)n * l + (size_t)(n - 1) * lsep; - luaL_Buffer b; - char *p = luaL_buffinitsize(L, &b, totallen); - while (n-- > 1) { /* first n-1 copies (followed by separator) */ - memcpy(p, s, l * sizeof(char)); p += l; - if (lsep > 0) { /* empty 'memcpy' is not that cheap */ - memcpy(p, sep, lsep * sizeof(char)); - p += lsep; - } - } - memcpy(p, s, l * sizeof(char)); /* last copy (not followed by separator) */ - luaL_pushresultsize(&b, totallen); - } - return 1; -} - - -static int str_byte (lua_State *L) { - size_t l; - const char *s = luaL_checklstring(L, 1, &l); - lua_Integer posi = posrelat(luaL_optinteger(L, 2, 1), l); - lua_Integer pose = posrelat(luaL_optinteger(L, 3, posi), l); - int n, i; - if (posi < 1) posi = 1; - if (pose > (lua_Integer)l) pose = l; - if (posi > pose) return 0; /* empty interval; return no values */ - if (pose - posi >= INT_MAX) /* arithmetic overflow? */ - return luaL_error(L, "string slice too long"); - n = (int)(pose - posi) + 1; - luaL_checkstack(L, n, "string slice too long"); - for (i=0; i= ms->level || ms->capture[l].len == CAP_UNFINISHED) - return luaL_error(ms->L, "invalid capture index %%%d", l + 1); - return l; -} - - -static int capture_to_close (MatchState *ms) { - int level = ms->level; - for (level--; level>=0; level--) - if (ms->capture[level].len == CAP_UNFINISHED) return level; - return luaL_error(ms->L, "invalid pattern capture"); -} - - -static const char *classend (MatchState *ms, const char *p) { - switch (*p++) { - case L_ESC: { - if (p == ms->p_end) - luaL_error(ms->L, "malformed pattern (ends with '%%')"); - return p+1; - } - case '[': { - if (*p == '^') p++; - do { /* look for a ']' */ - if (p == ms->p_end) - luaL_error(ms->L, "malformed pattern (missing ']')"); - if (*(p++) == L_ESC && p < ms->p_end) - p++; /* skip escapes (e.g. '%]') */ - } while (*p != ']'); - return p+1; - } - default: { - return p; - } - } -} - - -static int match_class (int c, int cl) { - int res; - switch (tolower(cl)) { - case 'a' : res = isalpha(c); break; - case 'c' : res = iscntrl(c); break; - case 'd' : res = isdigit(c); break; - case 'g' : res = isgraph(c); break; - case 'l' : res = islower(c); break; - case 'p' : res = ispunct(c); break; - case 's' : res = isspace(c); break; - case 'u' : res = isupper(c); break; - case 'w' : res = isalnum(c); break; - case 'x' : res = isxdigit(c); break; - case 'z' : res = (c == 0); break; /* deprecated option */ - default: return (cl == c); - } - return (islower(cl) ? res : !res); -} - - -static int matchbracketclass (int c, const char *p, const char *ec) { - int sig = 1; - if (*(p+1) == '^') { - sig = 0; - p++; /* skip the '^' */ - } - while (++p < ec) { - if (*p == L_ESC) { - p++; - if (match_class(c, uchar(*p))) - return sig; - } - else if ((*(p+1) == '-') && (p+2 < ec)) { - p+=2; - if (uchar(*(p-2)) <= c && c <= uchar(*p)) - return sig; - } - else if (uchar(*p) == c) return sig; - } - return !sig; -} - - -static int singlematch (MatchState *ms, const char *s, const char *p, - const char *ep) { - if (s >= ms->src_end) - return 0; - else { - int c = uchar(*s); - switch (*p) { - case '.': return 1; /* matches any char */ - case L_ESC: return match_class(c, uchar(*(p+1))); - case '[': return matchbracketclass(c, p, ep-1); - default: return (uchar(*p) == c); - } - } -} - - -static const char *matchbalance (MatchState *ms, const char *s, - const char *p) { - if (p >= ms->p_end - 1) - luaL_error(ms->L, "malformed pattern (missing arguments to '%%b')"); - if (*s != *p) return NULL; - else { - int b = *p; - int e = *(p+1); - int cont = 1; - while (++s < ms->src_end) { - if (*s == e) { - if (--cont == 0) return s+1; - } - else if (*s == b) cont++; - } - } - return NULL; /* string ends out of balance */ -} - - -static const char *max_expand (MatchState *ms, const char *s, - const char *p, const char *ep) { - ptrdiff_t i = 0; /* counts maximum expand for item */ - while (singlematch(ms, s + i, p, ep)) - i++; - /* keeps trying to match with the maximum repetitions */ - while (i>=0) { - const char *res = match(ms, (s+i), ep+1); - if (res) return res; - i--; /* else didn't match; reduce 1 repetition to try again */ - } - return NULL; -} - - -static const char *min_expand (MatchState *ms, const char *s, - const char *p, const char *ep) { - for (;;) { - const char *res = match(ms, s, ep+1); - if (res != NULL) - return res; - else if (singlematch(ms, s, p, ep)) - s++; /* try with one more repetition */ - else return NULL; - } -} - - -static const char *start_capture (MatchState *ms, const char *s, - const char *p, int what) { - const char *res; - int level = ms->level; - if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures"); - ms->capture[level].init = s; - ms->capture[level].len = what; - ms->level = level+1; - if ((res=match(ms, s, p)) == NULL) /* match failed? */ - ms->level--; /* undo capture */ - return res; -} - - -static const char *end_capture (MatchState *ms, const char *s, - const char *p) { - int l = capture_to_close(ms); - const char *res; - ms->capture[l].len = s - ms->capture[l].init; /* close capture */ - if ((res = match(ms, s, p)) == NULL) /* match failed? */ - ms->capture[l].len = CAP_UNFINISHED; /* undo capture */ - return res; -} - - -static const char *match_capture (MatchState *ms, const char *s, int l) { - size_t len; - l = check_capture(ms, l); - len = ms->capture[l].len; - if ((size_t)(ms->src_end-s) >= len && - memcmp(ms->capture[l].init, s, len) == 0) - return s+len; - else return NULL; -} - - -static const char *match (MatchState *ms, const char *s, const char *p) { - if (ms->matchdepth-- == 0) - luaL_error(ms->L, "pattern too complex"); - init: /* using goto's to optimize tail recursion */ - if (p != ms->p_end) { /* end of pattern? */ - switch (*p) { - case '(': { /* start capture */ - if (*(p + 1) == ')') /* position capture? */ - s = start_capture(ms, s, p + 2, CAP_POSITION); - else - s = start_capture(ms, s, p + 1, CAP_UNFINISHED); - break; - } - case ')': { /* end capture */ - s = end_capture(ms, s, p + 1); - break; - } - case '$': { - if ((p + 1) != ms->p_end) /* is the '$' the last char in pattern? */ - goto dflt; /* no; go to default */ - s = (s == ms->src_end) ? s : NULL; /* check end of string */ - break; - } - case L_ESC: { /* escaped sequences not in the format class[*+?-]? */ - switch (*(p + 1)) { - case 'b': { /* balanced string? */ - s = matchbalance(ms, s, p + 2); - if (s != NULL) { - p += 4; goto init; /* return match(ms, s, p + 4); */ - } /* else fail (s == NULL) */ - break; - } - case 'f': { /* frontier? */ - const char *ep; char previous; - p += 2; - if (*p != '[') - luaL_error(ms->L, "missing '[' after '%%f' in pattern"); - ep = classend(ms, p); /* points to what is next */ - previous = (s == ms->src_init) ? '\0' : *(s - 1); - if (!matchbracketclass(uchar(previous), p, ep - 1) && - matchbracketclass(uchar(*s), p, ep - 1)) { - p = ep; goto init; /* return match(ms, s, ep); */ - } - s = NULL; /* match failed */ - break; - } - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - case '8': case '9': { /* capture results (%0-%9)? */ - s = match_capture(ms, s, uchar(*(p + 1))); - if (s != NULL) { - p += 2; goto init; /* return match(ms, s, p + 2) */ - } - break; - } - default: goto dflt; - } - break; - } - default: dflt: { /* pattern class plus optional suffix */ - const char *ep = classend(ms, p); /* points to optional suffix */ - /* does not match at least once? */ - if (!singlematch(ms, s, p, ep)) { - if (*ep == '*' || *ep == '?' || *ep == '-') { /* accept empty? */ - p = ep + 1; goto init; /* return match(ms, s, ep + 1); */ - } - else /* '+' or no suffix */ - s = NULL; /* fail */ - } - else { /* matched once */ - switch (*ep) { /* handle optional suffix */ - case '?': { /* optional */ - const char *res; - if ((res = match(ms, s + 1, ep + 1)) != NULL) - s = res; - else { - p = ep + 1; goto init; /* else return match(ms, s, ep + 1); */ - } - break; - } - case '+': /* 1 or more repetitions */ - s++; /* 1 match already done */ - /* FALLTHROUGH */ - case '*': /* 0 or more repetitions */ - s = max_expand(ms, s, p, ep); - break; - case '-': /* 0 or more repetitions (minimum) */ - s = min_expand(ms, s, p, ep); - break; - default: /* no suffix */ - s++; p = ep; goto init; /* return match(ms, s + 1, ep); */ - } - } - break; - } - } - } - ms->matchdepth++; - return s; -} - - - -static const char *lmemfind (const char *s1, size_t l1, - const char *s2, size_t l2) { - if (l2 == 0) return s1; /* empty strings are everywhere */ - else if (l2 > l1) return NULL; /* avoids a negative 'l1' */ - else { - const char *init; /* to search for a '*s2' inside 's1' */ - l2--; /* 1st char will be checked by 'memchr' */ - l1 = l1-l2; /* 's2' cannot be found after that */ - while (l1 > 0 && (init = (const char *)memchr(s1, *s2, l1)) != NULL) { - init++; /* 1st char is already checked */ - if (memcmp(init, s2+1, l2) == 0) - return init-1; - else { /* correct 'l1' and 's1' to try again */ - l1 -= init-s1; - s1 = init; - } - } - return NULL; /* not found */ - } -} - - -static void push_onecapture (MatchState *ms, int i, const char *s, - const char *e) { - if (i >= ms->level) { - if (i == 0) /* ms->level == 0, too */ - lua_pushlstring(ms->L, s, e - s); /* add whole match */ - else - luaL_error(ms->L, "invalid capture index %%%d", i + 1); - } - else { - ptrdiff_t l = ms->capture[i].len; - if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture"); - if (l == CAP_POSITION) - lua_pushinteger(ms->L, (ms->capture[i].init - ms->src_init) + 1); - else - lua_pushlstring(ms->L, ms->capture[i].init, l); - } -} - - -static int push_captures (MatchState *ms, const char *s, const char *e) { - int i; - int nlevels = (ms->level == 0 && s) ? 1 : ms->level; - luaL_checkstack(ms->L, nlevels, "too many captures"); - for (i = 0; i < nlevels; i++) - push_onecapture(ms, i, s, e); - return nlevels; /* number of strings pushed */ -} - - -/* check whether pattern has no special characters */ -static int nospecials (const char *p, size_t l) { - size_t upto = 0; - do { - if (strpbrk(p + upto, SPECIALS)) - return 0; /* pattern has a special character */ - upto += strlen(p + upto) + 1; /* may have more after \0 */ - } while (upto <= l); - return 1; /* no special chars found */ -} - - -static int str_find_aux (lua_State *L, int find) { - size_t ls, lp; - const char *s = luaL_checklstring(L, 1, &ls); - const char *p = luaL_checklstring(L, 2, &lp); - lua_Integer init = posrelat(luaL_optinteger(L, 3, 1), ls); - if (init < 1) init = 1; - else if (init > (lua_Integer)ls + 1) { /* start after string's end? */ - lua_pushnil(L); /* cannot find anything */ - return 1; - } - /* explicit request or no special characters? */ - if (find && (lua_toboolean(L, 4) || nospecials(p, lp))) { - /* do a plain search */ - const char *s2 = lmemfind(s + init - 1, ls - (size_t)init + 1, p, lp); - if (s2) { - lua_pushinteger(L, (s2 - s) + 1); - lua_pushinteger(L, (s2 - s) + lp); - return 2; - } - } - else { - MatchState ms; - const char *s1 = s + init - 1; - int anchor = (*p == '^'); - if (anchor) { - p++; lp--; /* skip anchor character */ - } - ms.L = L; - ms.matchdepth = MAXCCALLS; - ms.src_init = s; - ms.src_end = s + ls; - ms.p_end = p + lp; - do { - const char *res; - ms.level = 0; - lua_assert(ms.matchdepth == MAXCCALLS); - if ((res=match(&ms, s1, p)) != NULL) { - if (find) { - lua_pushinteger(L, (s1 - s) + 1); /* start */ - lua_pushinteger(L, res - s); /* end */ - return push_captures(&ms, NULL, 0) + 2; - } - else - return push_captures(&ms, s1, res); - } - } while (s1++ < ms.src_end && !anchor); - } - lua_pushnil(L); /* not found */ - return 1; -} - - -static int str_find (lua_State *L) { - return str_find_aux(L, 1); -} - - -static int str_match (lua_State *L) { - return str_find_aux(L, 0); -} - - -static int gmatch_aux (lua_State *L) { - MatchState ms; - size_t ls, lp; - const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); - const char *p = lua_tolstring(L, lua_upvalueindex(2), &lp); - const char *src; - ms.L = L; - ms.matchdepth = MAXCCALLS; - ms.src_init = s; - ms.src_end = s+ls; - ms.p_end = p + lp; - for (src = s + (size_t)lua_tointeger(L, lua_upvalueindex(3)); - src <= ms.src_end; - src++) { - const char *e; - ms.level = 0; - lua_assert(ms.matchdepth == MAXCCALLS); - if ((e = match(&ms, src, p)) != NULL) { - lua_Integer newstart = e-s; - if (e == src) newstart++; /* empty match? go at least one position */ - lua_pushinteger(L, newstart); - lua_replace(L, lua_upvalueindex(3)); - return push_captures(&ms, src, e); - } - } - return 0; /* not found */ -} - - -static int gmatch (lua_State *L) { - luaL_checkstring(L, 1); - luaL_checkstring(L, 2); - lua_settop(L, 2); - lua_pushinteger(L, 0); - lua_pushcclosure(L, gmatch_aux, 3); - return 1; -} - - -static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, - const char *e) { - size_t l, i; - lua_State *L = ms->L; - const char *news = lua_tolstring(L, 3, &l); - for (i = 0; i < l; i++) { - if (news[i] != L_ESC) - luaL_addchar(b, news[i]); - else { - i++; /* skip ESC */ - if (!isdigit(uchar(news[i]))) { - if (news[i] != L_ESC) - luaL_error(L, "invalid use of '%c' in replacement string", L_ESC); - luaL_addchar(b, news[i]); - } - else if (news[i] == '0') - luaL_addlstring(b, s, e - s); - else { - push_onecapture(ms, news[i] - '1', s, e); - luaL_tolstring(L, -1, NULL); /* if number, convert it to string */ - lua_remove(L, -2); /* remove original value */ - luaL_addvalue(b); /* add capture to accumulated result */ - } - } - } -} - - -static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, - const char *e, int tr) { - lua_State *L = ms->L; - switch (tr) { - case LUA_TFUNCTION: { - int n; - lua_pushvalue(L, 3); - n = push_captures(ms, s, e); - lua_call(L, n, 1); - break; - } - case LUA_TTABLE: { - push_onecapture(ms, 0, s, e); - lua_gettable(L, 3); - break; - } - default: { /* LUA_TNUMBER or LUA_TSTRING */ - add_s(ms, b, s, e); - return; - } - } - if (!lua_toboolean(L, -1)) { /* nil or false? */ - lua_pop(L, 1); - lua_pushlstring(L, s, e - s); /* keep original text */ - } - else if (!lua_isstring(L, -1)) - luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); - luaL_addvalue(b); /* add result to accumulator */ -} - - -static int str_gsub (lua_State *L) { - size_t srcl, lp; - const char *src = luaL_checklstring(L, 1, &srcl); - const char *p = luaL_checklstring(L, 2, &lp); - int tr = lua_type(L, 3); - lua_Integer max_s = luaL_optinteger(L, 4, srcl + 1); - int anchor = (*p == '^'); - lua_Integer n = 0; - MatchState ms; - luaL_Buffer b; - luaL_argcheck(L, tr == LUA_TNUMBER || tr == LUA_TSTRING || - tr == LUA_TFUNCTION || tr == LUA_TTABLE, 3, - "string/function/table expected"); - luaL_buffinit(L, &b); - if (anchor) { - p++; lp--; /* skip anchor character */ - } - ms.L = L; - ms.matchdepth = MAXCCALLS; - ms.src_init = src; - ms.src_end = src+srcl; - ms.p_end = p + lp; - while (n < max_s) { - const char *e; - ms.level = 0; - lua_assert(ms.matchdepth == MAXCCALLS); - e = match(&ms, src, p); - if (e) { - n++; - add_value(&ms, &b, src, e, tr); - } - if (e && e>src) /* non empty match? */ - src = e; /* skip it */ - else if (src < ms.src_end) - luaL_addchar(&b, *src++); - else break; - if (anchor) break; - } - luaL_addlstring(&b, src, ms.src_end-src); - luaL_pushresult(&b); - lua_pushinteger(L, n); /* number of substitutions */ - return 2; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** STRING FORMAT -** ======================================================= -*/ - -#if !defined(lua_number2strx) /* { */ - -/* -** Hexadecimal floating-point formatter -*/ - -#include -#include - -#define SIZELENMOD (sizeof(LUA_NUMBER_FRMLEN)/sizeof(char)) - - -/* -** Number of bits that goes into the first digit. It can be any value -** between 1 and 4; the following definition tries to align the number -** to nibble boundaries by making what is left after that first digit a -** multiple of 4. -*/ -#define L_NBFD ((l_mathlim(MANT_DIG) - 1)%4 + 1) - - -/* -** Add integer part of 'x' to buffer and return new 'x' -*/ -static lua_Number adddigit (char *buff, int n, lua_Number x) { - lua_Number dd = l_mathop(floor)(x); /* get integer part from 'x' */ - int d = (int)dd; - buff[n] = (d < 10 ? d + '0' : d - 10 + 'a'); /* add to buffer */ - return x - dd; /* return what is left */ -} - - -static int num2straux (char *buff, lua_Number x) { - if (x != x || x == HUGE_VAL || x == -HUGE_VAL) /* inf or NaN? */ - return sprintf(buff, LUA_NUMBER_FMT, x); /* equal to '%g' */ - else if (x == 0) { /* can be -0... */ - sprintf(buff, LUA_NUMBER_FMT, x); - strcat(buff, "x0p+0"); /* reuses '0/-0' from 'sprintf'... */ - return strlen(buff); - } - else { - int e; - lua_Number m = l_mathop(frexp)(x, &e); /* 'x' fraction and exponent */ - int n = 0; /* character count */ - if (m < 0) { /* is number negative? */ - buff[n++] = '-'; /* add signal */ - m = -m; /* make it positive */ - } - buff[n++] = '0'; buff[n++] = 'x'; /* add "0x" */ - m = adddigit(buff, n++, m * (1 << L_NBFD)); /* add first digit */ - e -= L_NBFD; /* this digit goes before the radix point */ - if (m > 0) { /* more digits? */ - buff[n++] = lua_getlocaledecpoint(); /* add radix point */ - do { /* add as many digits as needed */ - m = adddigit(buff, n++, m * 16); - } while (m > 0); - } - n += sprintf(buff + n, "p%+d", e); /* add exponent */ - return n; - } -} - - -static int lua_number2strx (lua_State *L, char *buff, const char *fmt, - lua_Number x) { - int n = num2straux(buff, x); - if (fmt[SIZELENMOD] == 'A') { - int i; - for (i = 0; i < n; i++) - buff[i] = toupper(uchar(buff[i])); - } - else if (fmt[SIZELENMOD] != 'a') - luaL_error(L, "modifiers for format '%%a'/'%%A' not implemented"); - return n; -} - -#endif /* } */ - - -/* -** Maximum size of each formatted item. This maximum size is produced -** by format('%.99f', minfloat), and is equal to 99 + 2 ('-' and '.') + -** number of decimal digits to represent minfloat. -*/ -#ifndef _KERNEL -#define MAX_ITEM (120 + l_mathlim(MAX_10_EXP)) -#else -#define MAX_ITEM (120) -#endif - -/* valid flags in a format specification */ -#define FLAGS "-+ #0" - -/* -** maximum size of each format specification (such as "%-099.99d") -*/ -#define MAX_FORMAT 32 - - -static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { - size_t l; - const char *s = luaL_checklstring(L, arg, &l); - luaL_addchar(b, '"'); - while (l--) { - if (*s == '"' || *s == '\\' || *s == '\n') { - luaL_addchar(b, '\\'); - luaL_addchar(b, *s); - } - else if (*s == '\0' || iscntrl(uchar(*s))) { - char buff[10]; - if (!isdigit(uchar(*(s+1)))) - sprintf(buff, "\\%d", (int)uchar(*s)); - else - sprintf(buff, "\\%03d", (int)uchar(*s)); - luaL_addstring(b, buff); - } - else - luaL_addchar(b, *s); - s++; - } - luaL_addchar(b, '"'); -} - -static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { - const char *p = strfrmt; - while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */ - if ((size_t)(p - strfrmt) >= sizeof(FLAGS)/sizeof(char)) - luaL_error(L, "invalid format (repeated flags)"); - if (isdigit(uchar(*p))) p++; /* skip width */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - if (*p == '.') { - p++; - if (isdigit(uchar(*p))) p++; /* skip precision */ - if (isdigit(uchar(*p))) p++; /* (2 digits at most) */ - } - if (isdigit(uchar(*p))) - luaL_error(L, "invalid format (width or precision too long)"); - *(form++) = '%'; - memcpy(form, strfrmt, ((p - strfrmt) + 1) * sizeof(char)); - form += (p - strfrmt) + 1; - *form = '\0'; - return p; -} - - -/* -** add length modifier into formats -*/ -static void addlenmod (char *form, const char *lenmod) { - size_t l = strlen(form); - size_t lm = strlen(lenmod); - char spec = form[l - 1]; - strcpy(form + l - 1, lenmod); - form[l + lm - 1] = spec; - form[l + lm] = '\0'; -} - - -static int str_format (lua_State *L) { - int top = lua_gettop(L); - int arg = 1; - size_t sfl; - const char *strfrmt = luaL_checklstring(L, arg, &sfl); - const char *strfrmt_end = strfrmt+sfl; - luaL_Buffer b; - luaL_buffinit(L, &b); - while (strfrmt < strfrmt_end) { - if (*strfrmt != L_ESC) - luaL_addchar(&b, *strfrmt++); - else if (*++strfrmt == L_ESC) - luaL_addchar(&b, *strfrmt++); /* %% */ - else { /* format item */ - char form[MAX_FORMAT]; /* to store the format ('%...') */ - char *buff = luaL_prepbuffsize(&b, MAX_ITEM); /* to put formatted item */ - int nb = 0; /* number of bytes in added item */ - if (++arg > top) - luaL_argerror(L, arg, "no value"); - strfrmt = scanformat(L, strfrmt, form); - switch (*strfrmt++) { - case 'c': { - nb = sprintf(buff, form, (int)luaL_checkinteger(L, arg)); - break; - } - case 'd': case 'i': - case 'o': case 'u': case 'x': case 'X': { - lua_Integer n = luaL_checkinteger(L, arg); - addlenmod(form, LUA_INTEGER_FRMLEN); - nb = sprintf(buff, form, n); - break; - } -#ifndef _KERNEL - case 'a': case 'A': - addlenmod(form, LUA_NUMBER_FRMLEN); - nb = lua_number2strx(L, buff, form, luaL_checknumber(L, arg)); - break; - case 'e': case 'E': case 'f': - case 'g': case 'G': { - addlenmod(form, LUA_NUMBER_FRMLEN); - nb = sprintf(buff, form, luaL_checknumber(L, arg)); - break; - } -#endif - case 'q': { - addquoted(L, &b, arg); - break; - } - case 's': { - size_t l; - const char *s = luaL_tolstring(L, arg, &l); - if (!strchr(form, '.') && l >= 100) { - /* no precision and string is too long to be formatted; - keep original string */ - luaL_addvalue(&b); - } - else { - nb = sprintf(buff, form, s); - lua_pop(L, 1); /* remove result from 'luaL_tolstring' */ - } - break; - } - default: { /* also treat cases 'pnLlh' */ - return luaL_error(L, "invalid option '%%%c' to 'format'", - *(strfrmt - 1)); - } - } - luaL_addsize(&b, nb); - } - } - luaL_pushresult(&b); - return 1; -} - -/* }====================================================== */ - - -/* -** {====================================================== -** PACK/UNPACK -** ======================================================= -*/ - - -/* value used for padding */ -#if !defined(LUA_PACKPADBYTE) -#define LUA_PACKPADBYTE 0x00 -#endif - -/* maximum size for the binary representation of an integer */ -#define MAXINTSIZE 16 - -/* number of bits in a character */ -#define NB CHAR_BIT - -/* mask for one character (NB 1's) */ -#define MC ((1 << NB) - 1) - -/* size of a lua_Integer */ -#define SZINT ((int)sizeof(lua_Integer)) - - -/* dummy union to get native endianness */ -static const union { - int dummy; - char little; /* true iff machine is little endian */ -} nativeendian = {1}; - - -/* dummy structure to get native alignment requirements */ -struct cD { - char c; -#ifndef _KERNEL - union { double d; void *p; lua_Integer i; lua_Number n; } u; -#else /* _KERNEL */ - union { void *p; lua_Integer i; lua_Number n; } u; -#endif -}; - -#define MAXALIGN (offsetof(struct cD, u)) - - -#ifndef _KERNEL -/* -** Union for serializing floats -*/ -typedef union Ftypes { - float f; - double d; - lua_Number n; - char buff[5 * sizeof(lua_Number)]; /* enough for any float type */ -} Ftypes; -#endif - - -/* -** information to pack/unpack stuff -*/ -typedef struct Header { - lua_State *L; - int islittle; - int maxalign; -} Header; - - -/* -** options for pack/unpack -*/ -typedef enum KOption { - Kint, /* signed integers */ - Kuint, /* unsigned integers */ -#ifndef _KERNEL - Kfloat, /* floating-point numbers */ -#endif - Kchar, /* fixed-length strings */ - Kstring, /* strings with prefixed length */ - Kzstr, /* zero-terminated strings */ - Kpadding, /* padding */ - Kpaddalign, /* padding for alignment */ - Knop /* no-op (configuration or spaces) */ -} KOption; - - -/* -** Read an integer numeral from string 'fmt' or return 'df' if -** there is no numeral -*/ -static int digit (int c) { return '0' <= c && c <= '9'; } - -static int getnum (const char **fmt, int df) { - if (!digit(**fmt)) /* no number? */ - return df; /* return default value */ - else { - int a = 0; - do { - a = a*10 + (*((*fmt)++) - '0'); - } while (digit(**fmt) && a <= ((int)MAXSIZE - 9)/10); - return a; - } -} - - -/* -** Read an integer numeral and raises an error if it is larger -** than the maximum size for integers. -*/ -static int getnumlimit (Header *h, const char **fmt, int df) { - int sz = getnum(fmt, df); - if (sz > MAXINTSIZE || sz <= 0) - luaL_error(h->L, "integral size (%d) out of limits [1,%d]", - sz, MAXINTSIZE); - return sz; -} - - -/* -** Initialize Header -*/ -static void initheader (lua_State *L, Header *h) { - h->L = L; - h->islittle = nativeendian.little; - h->maxalign = 1; -} - - -/* -** Read and classify next option. 'size' is filled with option's size. -*/ -static KOption getoption (Header *h, const char **fmt, int *size) { - int opt = *((*fmt)++); - *size = 0; /* default */ - switch (opt) { - case 'b': *size = sizeof(char); return Kint; - case 'B': *size = sizeof(char); return Kuint; - case 'h': *size = sizeof(short); return Kint; - case 'H': *size = sizeof(short); return Kuint; - case 'l': *size = sizeof(long); return Kint; - case 'L': *size = sizeof(long); return Kuint; - case 'j': *size = sizeof(lua_Integer); return Kint; - case 'J': *size = sizeof(lua_Integer); return Kuint; - case 'T': *size = sizeof(size_t); return Kuint; -#ifndef _KERNEL - case 'f': *size = sizeof(float); return Kfloat; - case 'd': *size = sizeof(double); return Kfloat; - case 'n': *size = sizeof(lua_Number); return Kfloat; -#else /* _KERNEL */ - case 'n': *size = sizeof(lua_Number); return Kint; -#endif - case 'i': *size = getnumlimit(h, fmt, sizeof(int)); return Kint; - case 'I': *size = getnumlimit(h, fmt, sizeof(int)); return Kuint; - case 's': *size = getnumlimit(h, fmt, sizeof(size_t)); return Kstring; - case 'c': - *size = getnum(fmt, -1); - if (*size == -1) - luaL_error(h->L, "missing size for format option 'c'"); - return Kchar; - case 'z': return Kzstr; - case 'x': *size = 1; return Kpadding; - case 'X': return Kpaddalign; - case ' ': break; - case '<': h->islittle = 1; break; - case '>': h->islittle = 0; break; - case '=': h->islittle = nativeendian.little; break; - case '!': h->maxalign = getnumlimit(h, fmt, MAXALIGN); break; - default: luaL_error(h->L, "invalid format option '%c'", opt); - } - return Knop; -} - - -/* -** Read, classify, and fill other details about the next option. -** 'psize' is filled with option's size, 'notoalign' with its -** alignment requirements. -** Local variable 'size' gets the size to be aligned. (Kpadal option -** always gets its full alignment, other options are limited by -** the maximum alignment ('maxalign'). Kchar option needs no alignment -** despite its size. -*/ -static KOption getdetails (Header *h, size_t totalsize, - const char **fmt, int *psize, int *ntoalign) { - KOption opt = getoption(h, fmt, psize); - int align = *psize; /* usually, alignment follows size */ - if (opt == Kpaddalign) { /* 'X' gets alignment from following option */ - if (**fmt == '\0' || getoption(h, fmt, &align) == Kchar || align == 0) - luaL_argerror(h->L, 1, "invalid next option for option 'X'"); - } - if (align <= 1 || opt == Kchar) /* need no alignment? */ - *ntoalign = 0; - else { - if (align > h->maxalign) /* enforce maximum alignment */ - align = h->maxalign; - if ((align & (align - 1)) != 0) /* is 'align' not a power of 2? */ - luaL_argerror(h->L, 1, "format asks for alignment not power of 2"); - *ntoalign = (align - (int)(totalsize & (align - 1))) & (align - 1); - } - return opt; -} - - -/* -** Pack integer 'n' with 'size' bytes and 'islittle' endianness. -** The final 'if' handles the case when 'size' is larger than -** the size of a Lua integer, correcting the extra sign-extension -** bytes if necessary (by default they would be zeros). -*/ -static void packint (luaL_Buffer *b, lua_Unsigned n, - int islittle, int size, int neg) { - char *buff = luaL_prepbuffsize(b, size); - int i; - buff[islittle ? 0 : size - 1] = (char)(n & MC); /* first byte */ - for (i = 1; i < size; i++) { - n >>= NB; - buff[islittle ? i : size - 1 - i] = (char)(n & MC); - } - if (neg && size > SZINT) { /* negative number need sign extension? */ - for (i = SZINT; i < size; i++) /* correct extra bytes */ - buff[islittle ? i : size - 1 - i] = (char)MC; - } - luaL_addsize(b, size); /* add result to buffer */ -} - - -#ifndef _KERNEL -/* -** Copy 'size' bytes from 'src' to 'dest', correcting endianness if -** given 'islittle' is different from native endianness. -*/ -static void copywithendian (volatile char *dest, volatile const char *src, - int size, int islittle) { - if (islittle == nativeendian.little) { - while (size-- != 0) - *(dest++) = *(src++); - } - else { - dest += size - 1; - while (size-- != 0) - *(dest--) = *(src++); - } -} -#endif - - -static int str_pack (lua_State *L) { - luaL_Buffer b; - Header h; - const char *fmt = luaL_checkstring(L, 1); /* format string */ - int arg = 1; /* current argument to pack */ - size_t totalsize = 0; /* accumulate total size of result */ - initheader(L, &h); - lua_pushnil(L); /* mark to separate arguments from string buffer */ - luaL_buffinit(L, &b); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); - totalsize += ntoalign + size; - while (ntoalign-- > 0) - luaL_addchar(&b, LUA_PACKPADBYTE); /* fill alignment */ - arg++; - switch (opt) { - case Kint: { /* signed integers */ - lua_Integer n = luaL_checkinteger(L, arg); - if (size < SZINT) { /* need overflow check? */ - lua_Integer lim = (lua_Integer)1 << ((size * NB) - 1); - luaL_argcheck(L, -lim <= n && n < lim, arg, "integer overflow"); - } - packint(&b, (lua_Unsigned)n, h.islittle, size, (n < 0)); - break; - } - case Kuint: { /* unsigned integers */ - lua_Integer n = luaL_checkinteger(L, arg); - if (size < SZINT) /* need overflow check? */ - luaL_argcheck(L, (lua_Unsigned)n < ((lua_Unsigned)1 << (size * NB)), - arg, "unsigned overflow"); - packint(&b, (lua_Unsigned)n, h.islittle, size, 0); - break; - } -#ifndef _KERNEL - case Kfloat: { /* floating-point options */ - volatile Ftypes u; - char *buff = luaL_prepbuffsize(&b, size); - lua_Number n = luaL_checknumber(L, arg); /* get argument */ - if (size == sizeof(u.f)) u.f = (float)n; /* copy it into 'u' */ - else if (size == sizeof(u.d)) u.d = (double)n; - else u.n = n; - /* move 'u' to final result, correcting endianness if needed */ - copywithendian(buff, u.buff, size, h.islittle); - luaL_addsize(&b, size); - break; - } -#endif - case Kchar: { /* fixed-size string */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, len == (size_t)size, arg, "wrong length"); - luaL_addlstring(&b, s, size); - break; - } - case Kstring: { /* strings with length count */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, size >= (int)sizeof(size_t) || - len < ((size_t)1 << (size * NB)), - arg, "string length does not fit in given size"); - packint(&b, (lua_Unsigned)len, h.islittle, size, 0); /* pack length */ - luaL_addlstring(&b, s, len); - totalsize += len; - break; - } - case Kzstr: { /* zero-terminated string */ - size_t len; - const char *s = luaL_checklstring(L, arg, &len); - luaL_argcheck(L, strlen(s) == len, arg, "string contains zeros"); - luaL_addlstring(&b, s, len); - luaL_addchar(&b, '\0'); /* add zero at the end */ - totalsize += len + 1; - break; - } - case Kpadding: luaL_addchar(&b, LUA_PACKPADBYTE); /* FALLTHROUGH */ - case Kpaddalign: case Knop: - arg--; /* undo increment */ - break; - } - } - luaL_pushresult(&b); - return 1; -} - - -static int str_packsize (lua_State *L) { - Header h; - const char *fmt = luaL_checkstring(L, 1); /* format string */ - size_t totalsize = 0; /* accumulate total size of result */ - initheader(L, &h); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, totalsize, &fmt, &size, &ntoalign); - size += ntoalign; /* total space used by option */ - luaL_argcheck(L, totalsize <= MAXSIZE - size, 1, - "format result too large"); - totalsize += size; - switch (opt) { - case Kstring: /* strings with length count */ - case Kzstr: /* zero-terminated string */ - luaL_argerror(L, 1, "variable-length format"); - break; - default: break; - } - } - lua_pushinteger(L, (lua_Integer)totalsize); - return 1; -} - - -/* -** Unpack an integer with 'size' bytes and 'islittle' endianness. -** If size is smaller than the size of a Lua integer and integer -** is signed, must do sign extension (propagating the sign to the -** higher bits); if size is larger than the size of a Lua integer, -** it must check the unread bytes to see whether they do not cause an -** overflow. -*/ -static lua_Integer unpackint (lua_State *L, const char *str, - int islittle, int size, int issigned) { - lua_Unsigned res = 0; - int i; - int limit = (size <= SZINT) ? size : SZINT; - for (i = limit - 1; i >= 0; i--) { - res <<= NB; - res |= (lua_Unsigned)(unsigned char)str[islittle ? i : size - 1 - i]; - } - if (size < SZINT) { /* real size smaller than lua_Integer? */ - if (issigned) { /* needs sign extension? */ - lua_Unsigned mask = (lua_Unsigned)1 << (size*NB - 1); - res = ((res ^ mask) - mask); /* do sign extension */ - } - } - else if (size > SZINT) { /* must check unread bytes */ - int mask = (!issigned || (lua_Integer)res >= 0) ? 0 : MC; - for (i = limit; i < size; i++) { - if ((unsigned char)str[islittle ? i : size - 1 - i] != mask) - luaL_error(L, "%d-byte integer does not fit into Lua Integer", size); - } - } - return (lua_Integer)res; -} - - -static int str_unpack (lua_State *L) { - Header h; - const char *fmt = luaL_checkstring(L, 1); - size_t ld; - const char *data = luaL_checklstring(L, 2, &ld); - size_t pos = (size_t)posrelat(luaL_optinteger(L, 3, 1), ld) - 1; - int n = 0; /* number of results */ - luaL_argcheck(L, pos <= ld, 3, "initial position out of string"); - initheader(L, &h); - while (*fmt != '\0') { - int size, ntoalign; - KOption opt = getdetails(&h, pos, &fmt, &size, &ntoalign); - if ((size_t)ntoalign + size > ~pos || pos + ntoalign + size > ld) - luaL_argerror(L, 2, "data string too short"); - pos += ntoalign; /* skip alignment */ - /* stack space for item + next position */ - luaL_checkstack(L, 2, "too many results"); - n++; - switch (opt) { - case Kint: - case Kuint: { - lua_Integer res = unpackint(L, data + pos, h.islittle, size, - (opt == Kint)); - lua_pushinteger(L, res); - break; - } -#ifndef _KERNEL - case Kfloat: { - volatile Ftypes u; - lua_Number num; - copywithendian(u.buff, data + pos, size, h.islittle); - if (size == sizeof(u.f)) num = (lua_Number)u.f; - else if (size == sizeof(u.d)) num = (lua_Number)u.d; - else num = u.n; - lua_pushnumber(L, num); - break; - } -#endif - case Kchar: { - lua_pushlstring(L, data + pos, size); - break; - } - case Kstring: { - size_t len = (size_t)unpackint(L, data + pos, h.islittle, size, 0); - luaL_argcheck(L, pos + len + size <= ld, 2, "data string too short"); - lua_pushlstring(L, data + pos + size, len); - pos += len; /* skip string */ - break; - } - case Kzstr: { - size_t len = (int)strlen(data + pos); - lua_pushlstring(L, data + pos, len); - pos += len + 1; /* skip string plus final '\0' */ - break; - } - case Kpaddalign: case Kpadding: case Knop: - n--; /* undo increment */ - break; - } - pos += size; - } - lua_pushinteger(L, pos + 1); /* next position */ - return n + 1; -} - -/* }====================================================== */ - - -static const luaL_Reg strlib[] = { - {"byte", str_byte}, - {"char", str_char}, - {"dump", str_dump}, - {"find", str_find}, - {"format", str_format}, - {"gmatch", gmatch}, - {"gsub", str_gsub}, - {"len", str_len}, - {"lower", str_lower}, - {"match", str_match}, - {"rep", str_rep}, - {"reverse", str_reverse}, - {"sub", str_sub}, - {"upper", str_upper}, - {"pack", str_pack}, - {"packsize", str_packsize}, - {"unpack", str_unpack}, - {NULL, NULL} -}; - - -static void createmetatable (lua_State *L) { - lua_createtable(L, 0, 1); /* table to be metatable for strings */ - lua_pushliteral(L, ""); /* dummy string */ - lua_pushvalue(L, -2); /* copy table */ - lua_setmetatable(L, -2); /* set table as metatable for strings */ - lua_pop(L, 1); /* pop dummy string */ - lua_pushvalue(L, -2); /* get string library */ - lua_setfield(L, -2, "__index"); /* metatable.__index = string */ - lua_pop(L, 1); /* pop metatable */ -} - - -/* -** Open string library -*/ -LUAMOD_API int luaopen_string (lua_State *L) { - luaL_newlib(L, strlib); - createmetatable(L); - return 1; -} - diff --git a/external/mit/lua/dist/src/ltable.c b/external/mit/lua/dist/src/ltable.c deleted file mode 100644 index 99515568c..000000000 --- a/external/mit/lua/dist/src/ltable.c +++ /dev/null @@ -1,669 +0,0 @@ -/* $NetBSD: ltable.c,v 1.5 2015/10/08 13:40:16 mbalmer Exp $ */ - -/* -** Id: ltable.c,v 2.111 2015/06/09 14:21:13 roberto Exp -** Lua tables (hash) -** See Copyright Notice in lua.h -*/ - -#define ltable_c -#define LUA_CORE - -#include "lprefix.h" - - -/* -** Implementation of tables (aka arrays, objects, or hash tables). -** Tables keep its elements in two parts: an array part and a hash part. -** Non-negative integer keys are all candidates to be kept in the array -** part. The actual size of the array is the largest 'n' such that -** more than half the slots between 1 and n are in use. -** Hash uses a mix of chained scatter table with Brent's variation. -** A main invariant of these tables is that, if an element is not -** in its main position (i.e. the 'original' position that its hash gives -** to it), then the colliding element is in its own main position. -** Hence even when the load factor reaches 100%, performance remains good. -*/ - -#ifndef _KERNEL -#include -#include -#include -#endif - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lgc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "lvm.h" - - -/* -** Maximum size of array part (MAXASIZE) is 2^MAXABITS. MAXABITS is -** the largest integer such that MAXASIZE fits in an unsigned int. -*/ -#define MAXABITS cast_int(sizeof(int) * CHAR_BIT - 1) -#define MAXASIZE (1u << MAXABITS) - -/* -** Maximum size of hash part is 2^MAXHBITS. MAXHBITS is the largest -** integer such that 2^MAXHBITS fits in a signed int. (Note that the -** maximum number of elements in a table, 2^MAXABITS + 2^MAXHBITS, still -** fits comfortably in an unsigned int.) -*/ -#define MAXHBITS (MAXABITS - 1) - - -#define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) - -#define hashstr(t,str) hashpow2(t, (str)->hash) -#define hashboolean(t,p) hashpow2(t, p) -#define hashint(t,i) hashpow2(t, i) - - -/* -** for some types, it is better to avoid modulus by power of 2, as -** they tend to have many 2 factors. -*/ -#define hashmod(t,n) (gnode(t, ((n) % ((sizenode(t)-1)|1)))) - - -#define hashpointer(t,p) hashmod(t, point2uint(p)) - - -#define dummynode (&dummynode_) - -#define isdummy(n) ((n) == dummynode) - -static const Node dummynode_ = { - {NILCONSTANT}, /* value */ - {{NILCONSTANT, 0}} /* key */ -}; - - -#ifndef _KERNEL -/* -** Hash for floating-point numbers. -** The main computation should be just -** n = frepx(n, &i); return (n * INT_MAX) + i -** but there are some numerical subtleties. -** In a two-complement representation, INT_MAX does not has an exact -** representation as a float, but INT_MIN does; because the absolute -** value of 'frexp' is smaller than 1 (unless 'n' is inf/NaN), the -** absolute value of the product 'frexp * -INT_MIN' is smaller or equal -** to INT_MAX. Next, the use of 'unsigned int' avoids overflows when -** adding 'i'; the use of '~u' (instead of '-u') avoids problems with -** INT_MIN. -*/ -#if !defined(l_hashfloat) -static int l_hashfloat (lua_Number n) { - int i; - lua_Integer ni; - n = l_mathop(frexp)(n, &i) * -cast_num(INT_MIN); - if (!lua_numbertointeger(n, &ni)) { /* is 'n' inf/-inf/NaN? */ - lua_assert(luai_numisnan(n) || l_mathop(fabs)(n) == HUGE_VAL); - return 0; - } - else { /* normal case */ - unsigned int u = cast(unsigned int, i) + cast(unsigned int, ni); - return cast_int(u <= cast(unsigned int, INT_MAX) ? u : ~u); - } -} -#endif -#endif /*_KERNEL */ - -/* -** returns the 'main' position of an element in a table (that is, the index -** of its hash value) -*/ -static Node *mainposition (const Table *t, const TValue *key) { - switch (ttype(key)) { - case LUA_TNUMINT: - return hashint(t, ivalue(key)); -#ifndef _KERNEL - case LUA_TNUMFLT: - return hashmod(t, l_hashfloat(fltvalue(key))); -#endif - case LUA_TSHRSTR: - return hashstr(t, tsvalue(key)); - case LUA_TLNGSTR: { - TString *s = tsvalue(key); - if (s->extra == 0) { /* no hash? */ - s->hash = luaS_hash(getstr(s), s->u.lnglen, s->hash); - s->extra = 1; /* now it has its hash */ - } - return hashstr(t, tsvalue(key)); - } - case LUA_TBOOLEAN: - return hashboolean(t, bvalue(key)); - case LUA_TLIGHTUSERDATA: - return hashpointer(t, pvalue(key)); - case LUA_TLCF: - return hashpointer(t, fvalue(key)); - default: - return hashpointer(t, gcvalue(key)); - } -} - - -/* -** returns the index for 'key' if 'key' is an appropriate key to live in -** the array part of the table, 0 otherwise. -*/ -static unsigned int arrayindex (const TValue *key) { - if (ttisinteger(key)) { - lua_Integer k = ivalue(key); - if (0 < k && (lua_Unsigned)k <= MAXASIZE) - return cast(unsigned int, k); /* 'key' is an appropriate array index */ - } - return 0; /* 'key' did not match some condition */ -} - - -/* -** returns the index of a 'key' for table traversals. First goes all -** elements in the array part, then elements in the hash part. The -** beginning of a traversal is signaled by 0. -*/ -static unsigned int findindex (lua_State *L, Table *t, StkId key) { - unsigned int i; - if (ttisnil(key)) return 0; /* first iteration */ - i = arrayindex(key); - if (i != 0 && i <= t->sizearray) /* is 'key' inside array part? */ - return i; /* yes; that's the index */ - else { - int nx; - Node *n = mainposition(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - /* key may be dead already, but it is ok to use it in 'next' */ - if (luaV_rawequalobj(gkey(n), key) || - (ttisdeadkey(gkey(n)) && iscollectable(key) && - deadvalue(gkey(n)) == gcvalue(key))) { - i = cast_int(n - gnode(t, 0)); /* key index in hash table */ - /* hash elements are numbered after array ones */ - return (i + 1) + t->sizearray; - } - nx = gnext(n); - if (nx == 0) - luaG_runerror(L, "invalid key to 'next'"); /* key not found */ - else n += nx; - } - } -} - - -int luaH_next (lua_State *L, Table *t, StkId key) { - unsigned int i = findindex(L, t, key); /* find original element */ - for (; i < t->sizearray; i++) { /* try first array part */ - if (!ttisnil(&t->array[i])) { /* a non-nil value? */ - setivalue(key, i + 1); - setobj2s(L, key+1, &t->array[i]); - return 1; - } - } - for (i -= t->sizearray; cast_int(i) < sizenode(t); i++) { /* hash part */ - if (!ttisnil(gval(gnode(t, i)))) { /* a non-nil value? */ - setobj2s(L, key, gkey(gnode(t, i))); - setobj2s(L, key+1, gval(gnode(t, i))); - return 1; - } - } - return 0; /* no more elements */ -} - - -/* -** {============================================================= -** Rehash -** ============================================================== -*/ - -/* -** Compute the optimal size for the array part of table 't'. 'nums' is a -** "count array" where 'nums[i]' is the number of integers in the table -** between 2^(i - 1) + 1 and 2^i. 'pna' enters with the total number of -** integer keys in the table and leaves with the number of keys that -** will go to the array part; return the optimal size. -*/ -static unsigned int computesizes (unsigned int nums[], unsigned int *pna) { - int i; - unsigned int twotoi; /* 2^i (candidate for optimal size) */ - unsigned int a = 0; /* number of elements smaller than 2^i */ - unsigned int na = 0; /* number of elements to go to array part */ - unsigned int optimal = 0; /* optimal size for array part */ - /* loop while keys can fill more than half of total size */ - for (i = 0, twotoi = 1; *pna > twotoi / 2; i++, twotoi *= 2) { - if (nums[i] > 0) { - a += nums[i]; - if (a > twotoi/2) { /* more than half elements present? */ - optimal = twotoi; /* optimal size (till now) */ - na = a; /* all elements up to 'optimal' will go to array part */ - } - } - } - lua_assert((optimal == 0 || optimal / 2 < na) && na <= optimal); - *pna = na; - return optimal; -} - - -static int countint (const TValue *key, unsigned int *nums) { - unsigned int k = arrayindex(key); - if (k != 0) { /* is 'key' an appropriate array index? */ - nums[luaO_ceillog2(k)]++; /* count as such */ - return 1; - } - else - return 0; -} - - -/* -** Count keys in array part of table 't': Fill 'nums[i]' with -** number of keys that will go into corresponding slice and return -** total number of non-nil keys. -*/ -static unsigned int numusearray (const Table *t, unsigned int *nums) { - int lg; - unsigned int ttlg; /* 2^lg */ - unsigned int ause = 0; /* summation of 'nums' */ - unsigned int i = 1; /* count to traverse all array keys */ - /* traverse each slice */ - for (lg = 0, ttlg = 1; lg <= MAXABITS; lg++, ttlg *= 2) { - unsigned int lc = 0; /* counter */ - unsigned int lim = ttlg; - if (lim > t->sizearray) { - lim = t->sizearray; /* adjust upper limit */ - if (i > lim) - break; /* no more elements to count */ - } - /* count elements in range (2^(lg - 1), 2^lg] */ - for (; i <= lim; i++) { - if (!ttisnil(&t->array[i-1])) - lc++; - } - nums[lg] += lc; - ause += lc; - } - return ause; -} - - -static int numusehash (const Table *t, unsigned int *nums, unsigned int *pna) { - int totaluse = 0; /* total number of elements */ - int ause = 0; /* elements added to 'nums' (can go to array part) */ - int i = sizenode(t); - while (i--) { - Node *n = &t->node[i]; - if (!ttisnil(gval(n))) { - ause += countint(gkey(n), nums); - totaluse++; - } - } - *pna += ause; - return totaluse; -} - - -static void setarrayvector (lua_State *L, Table *t, unsigned int size) { - unsigned int i; - luaM_reallocvector(L, t->array, t->sizearray, size, TValue); - for (i=t->sizearray; iarray[i]); - t->sizearray = size; -} - - -static void setnodevector (lua_State *L, Table *t, unsigned int size) { - int lsize; - if (size == 0) { /* no elements to hash part? */ - t->node = cast(Node *, dummynode); /* use common 'dummynode' */ - lsize = 0; - } - else { - int i; - lsize = luaO_ceillog2(size); - if (lsize > MAXHBITS) - luaG_runerror(L, "table overflow"); - size = twoto(lsize); - t->node = luaM_newvector(L, size, Node); - for (i = 0; i < (int)size; i++) { - Node *n = gnode(t, i); - gnext(n) = 0; - setnilvalue(wgkey(n)); - setnilvalue(gval(n)); - } - } - t->lsizenode = cast_byte(lsize); - t->lastfree = gnode(t, size); /* all positions are free */ -} - - -void luaH_resize (lua_State *L, Table *t, unsigned int nasize, - unsigned int nhsize) { - unsigned int i; - int j; - unsigned int oldasize = t->sizearray; - int oldhsize = t->lsizenode; - Node *nold = t->node; /* save old hash ... */ - if (nasize > oldasize) /* array part must grow? */ - setarrayvector(L, t, nasize); - /* create new hash part with appropriate size */ - setnodevector(L, t, nhsize); - if (nasize < oldasize) { /* array part must shrink? */ - t->sizearray = nasize; - /* re-insert elements from vanishing slice */ - for (i=nasize; iarray[i])) - luaH_setint(L, t, i + 1, &t->array[i]); - } - /* shrink array */ - luaM_reallocvector(L, t->array, oldasize, nasize, TValue); - } - /* re-insert elements from hash part */ - for (j = twoto(oldhsize) - 1; j >= 0; j--) { - Node *old = nold + j; - if (!ttisnil(gval(old))) { - /* doesn't need barrier/invalidate cache, as entry was - already present in the table */ - setobjt2t(L, luaH_set(L, t, gkey(old)), gval(old)); - } - } - if (!isdummy(nold)) - luaM_freearray(L, nold, cast(size_t, twoto(oldhsize))); /* free old hash */ -} - - -void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize) { - int nsize = isdummy(t->node) ? 0 : sizenode(t); - luaH_resize(L, t, nasize, nsize); -} - -/* -** nums[i] = number of keys 'k' where 2^(i - 1) < k <= 2^i -*/ -static void rehash (lua_State *L, Table *t, const TValue *ek) { - unsigned int asize; /* optimal size for array part */ - unsigned int na; /* number of keys in the array part */ - unsigned int nums[MAXABITS + 1]; - int i; - int totaluse; - for (i = 0; i <= MAXABITS; i++) nums[i] = 0; /* reset counts */ - na = numusearray(t, nums); /* count keys in array part */ - totaluse = na; /* all those keys are integer keys */ - totaluse += numusehash(t, nums, &na); /* count keys in hash part */ - /* count extra key */ - na += countint(ek, nums); - totaluse++; - /* compute new size for array part */ - asize = computesizes(nums, &na); - /* resize the table to new computed sizes */ - luaH_resize(L, t, asize, totaluse - na); -} - - - -/* -** }============================================================= -*/ - - -Table *luaH_new (lua_State *L) { - GCObject *o = luaC_newobj(L, LUA_TTABLE, sizeof(Table)); - Table *t = gco2t(o); - t->metatable = NULL; - t->flags = cast_byte(~0); - t->array = NULL; - t->sizearray = 0; - setnodevector(L, t, 0); - return t; -} - - -void luaH_free (lua_State *L, Table *t) { - if (!isdummy(t->node)) - luaM_freearray(L, t->node, cast(size_t, sizenode(t))); - luaM_freearray(L, t->array, t->sizearray); - luaM_free(L, t); -} - - -static Node *getfreepos (Table *t) { - while (t->lastfree > t->node) { - t->lastfree--; - if (ttisnil(gkey(t->lastfree))) - return t->lastfree; - } - return NULL; /* could not find a free place */ -} - - - -/* -** inserts a new key into a hash table; first, check whether key's main -** position is free. If not, check whether colliding node is in its main -** position or not: if it is not, move colliding node to an empty place and -** put new key in its main position; otherwise (colliding node is in its main -** position), new key goes to an empty position. -*/ -TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key) { - Node *mp; -#ifndef _KERNEL - TValue aux; -#endif - if (ttisnil(key)) luaG_runerror(L, "table index is nil"); -#ifndef _KERNEL - else if (ttisfloat(key)) { - lua_Integer k; - if (luaV_tointeger(key, &k, 0)) { /* index is int? */ - setivalue(&aux, k); - key = &aux; /* insert it as an integer */ - } - else if (luai_numisnan(fltvalue(key))) - luaG_runerror(L, "table index is NaN"); - } -#endif - mp = mainposition(t, key); - if (!ttisnil(gval(mp)) || isdummy(mp)) { /* main position is taken? */ - Node *othern; - Node *f = getfreepos(t); /* get a free place */ - if (f == NULL) { /* cannot find a free place? */ - rehash(L, t, key); /* grow table */ - /* whatever called 'newkey' takes care of TM cache and GC barrier */ - return luaH_set(L, t, key); /* insert key into grown table */ - } - lua_assert(!isdummy(f)); - othern = mainposition(t, gkey(mp)); - if (othern != mp) { /* is colliding node out of its main position? */ - /* yes; move colliding node into free position */ - while (othern + gnext(othern) != mp) /* find previous */ - othern += gnext(othern); - gnext(othern) = cast_int(f - othern); /* rechain to point to 'f' */ - *f = *mp; /* copy colliding node into free pos. (mp->next also goes) */ - if (gnext(mp) != 0) { - gnext(f) += cast_int(mp - f); /* correct 'next' */ - gnext(mp) = 0; /* now 'mp' is free */ - } - setnilvalue(gval(mp)); - } - else { /* colliding node is in its own main position */ - /* new node will go into free position */ - if (gnext(mp) != 0) - gnext(f) = cast_int((mp + gnext(mp)) - f); /* chain new position */ - else lua_assert(gnext(f) == 0); - gnext(mp) = cast_int(f - mp); - mp = f; - } - } - setnodekey(L, &mp->i_key, key); - luaC_barrierback(L, t, key); - lua_assert(ttisnil(gval(mp))); - return gval(mp); -} - - -/* -** search function for integers -*/ -const TValue *luaH_getint (Table *t, lua_Integer key) { - /* (1 <= key && key <= t->sizearray) */ - if (l_castS2U(key - 1) < t->sizearray) - return &t->array[key - 1]; - else { - Node *n = hashint(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - if (ttisinteger(gkey(n)) && ivalue(gkey(n)) == key) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) break; - n += nx; - } - }; - return luaO_nilobject; - } -} - - -/* -** search function for short strings -*/ -const TValue *luaH_getstr (Table *t, TString *key) { - Node *n = hashstr(t, key); - lua_assert(key->tt == LUA_TSHRSTR); - for (;;) { /* check whether 'key' is somewhere in the chain */ - const TValue *k = gkey(n); - if (ttisshrstring(k) && eqshrstr(tsvalue(k), key)) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) break; - n += nx; - } - }; - return luaO_nilobject; -} - - -/* -** main search function -*/ -const TValue *luaH_get (Table *t, const TValue *key) { - switch (ttype(key)) { - case LUA_TSHRSTR: return luaH_getstr(t, tsvalue(key)); - case LUA_TNUMINT: return luaH_getint(t, ivalue(key)); - case LUA_TNIL: return luaO_nilobject; -#ifndef _KERNEL - case LUA_TNUMFLT: { - lua_Integer k; - if (luaV_tointeger(key, &k, 0)) /* index is int? */ - return luaH_getint(t, k); /* use specialized version */ - /* else... */ - } /* FALLTHROUGH */ -#endif - default: { - Node *n = mainposition(t, key); - for (;;) { /* check whether 'key' is somewhere in the chain */ - if (luaV_rawequalobj(gkey(n), key)) - return gval(n); /* that's it */ - else { - int nx = gnext(n); - if (nx == 0) break; - n += nx; - } - }; - return luaO_nilobject; - } - } -} - - -/* -** beware: when using this function you probably need to check a GC -** barrier and invalidate the TM cache. -*/ -TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { - const TValue *p = luaH_get(t, key); - if (p != luaO_nilobject) - return cast(TValue *, p); - else return luaH_newkey(L, t, key); -} - - -void luaH_setint (lua_State *L, Table *t, lua_Integer key, TValue *value) { - const TValue *p = luaH_getint(t, key); - TValue *cell; - if (p != luaO_nilobject) - cell = cast(TValue *, p); - else { - TValue k; - setivalue(&k, key); - cell = luaH_newkey(L, t, &k); - } - setobj2t(L, cell, value); -} - - -static int unbound_search (Table *t, unsigned int j) { - unsigned int i = j; /* i is zero or a present index */ - j++; - /* find 'i' and 'j' such that i is present and j is not */ - while (!ttisnil(luaH_getint(t, j))) { - i = j; - if (j > cast(unsigned int, MAX_INT)/2) { /* overflow? */ - /* table was built with bad purposes: resort to linear search */ - i = 1; - while (!ttisnil(luaH_getint(t, i))) i++; - return i - 1; - } - j *= 2; - } - /* now do a binary search between them */ - while (j - i > 1) { - unsigned int m = (i+j)/2; - if (ttisnil(luaH_getint(t, m))) j = m; - else i = m; - } - return i; -} - - -/* -** Try to find a boundary in table 't'. A 'boundary' is an integer index -** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). -*/ -int luaH_getn (Table *t) { - unsigned int j = t->sizearray; - if (j > 0 && ttisnil(&t->array[j - 1])) { - /* there is a boundary in the array part: (binary) search for it */ - unsigned int i = 0; - while (j - i > 1) { - unsigned int m = (i+j)/2; - if (ttisnil(&t->array[m - 1])) j = m; - else i = m; - } - return i; - } - /* else must find a boundary in hash part */ - else if (isdummy(t->node)) /* hash part is empty? */ - return j; /* that is easy... */ - else return unbound_search(t, j); -} - - - -#if defined(LUA_DEBUG) - -Node *luaH_mainposition (const Table *t, const TValue *key) { - return mainposition(t, key); -} - -int luaH_isdummy (Node *n) { return isdummy(n); } - -#endif diff --git a/external/mit/lua/dist/src/ltable.h b/external/mit/lua/dist/src/ltable.h deleted file mode 100644 index cce63dd95..000000000 --- a/external/mit/lua/dist/src/ltable.h +++ /dev/null @@ -1,53 +0,0 @@ -/* -** $Id: ltable.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ -** Lua tables (hash) -** See Copyright Notice in lua.h -*/ - -#ifndef ltable_h -#define ltable_h - -#include "lobject.h" - - -#define gnode(t,i) (&(t)->node[i]) -#define gval(n) (&(n)->i_val) -#define gnext(n) ((n)->i_key.nk.next) - - -/* 'const' to avoid wrong writings that can mess up field 'next' */ -#define gkey(n) cast(const TValue*, (&(n)->i_key.tvk)) - -#define wgkey(n) (&(n)->i_key.nk) - -#define invalidateTMcache(t) ((t)->flags = 0) - - -/* returns the key, given the value of a table entry */ -#define keyfromval(v) \ - (gkey(cast(Node *, cast(char *, (v)) - offsetof(Node, i_val)))) - - -LUAI_FUNC const TValue *luaH_getint (Table *t, lua_Integer key); -LUAI_FUNC void luaH_setint (lua_State *L, Table *t, lua_Integer key, - TValue *value); -LUAI_FUNC const TValue *luaH_getstr (Table *t, TString *key); -LUAI_FUNC const TValue *luaH_get (Table *t, const TValue *key); -LUAI_FUNC TValue *luaH_newkey (lua_State *L, Table *t, const TValue *key); -LUAI_FUNC TValue *luaH_set (lua_State *L, Table *t, const TValue *key); -LUAI_FUNC Table *luaH_new (lua_State *L); -LUAI_FUNC void luaH_resize (lua_State *L, Table *t, unsigned int nasize, - unsigned int nhsize); -LUAI_FUNC void luaH_resizearray (lua_State *L, Table *t, unsigned int nasize); -LUAI_FUNC void luaH_free (lua_State *L, Table *t); -LUAI_FUNC int luaH_next (lua_State *L, Table *t, StkId key); -LUAI_FUNC int luaH_getn (Table *t); - - -#if defined(LUA_DEBUG) -LUAI_FUNC Node *luaH_mainposition (const Table *t, const TValue *key); -LUAI_FUNC int luaH_isdummy (Node *n); -#endif - - -#endif diff --git a/external/mit/lua/dist/src/ltablib.c b/external/mit/lua/dist/src/ltablib.c deleted file mode 100644 index 37bf6efa4..000000000 --- a/external/mit/lua/dist/src/ltablib.c +++ /dev/null @@ -1,363 +0,0 @@ -/* $NetBSD: ltablib.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: ltablib.c,v 1.80 2015/01/13 16:27:29 roberto Exp -** Library for Table Manipulation -** See Copyright Notice in lua.h -*/ - -#define ltablib_c -#define LUA_LIB - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#endif - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - - -/* -** Structure with table-access functions -*/ -typedef struct { - int (*geti) (lua_State *L, int idx, lua_Integer n); - void (*seti) (lua_State *L, int idx, lua_Integer n); -} TabA; - - -/* -** Check that 'arg' has a table and set access functions in 'ta' to raw -** or non-raw according to the presence of corresponding metamethods. -*/ -static void checktab (lua_State *L, int arg, TabA *ta) { - ta->geti = NULL; ta->seti = NULL; - if (lua_getmetatable(L, arg)) { - lua_pushliteral(L, "__index"); /* 'index' metamethod */ - if (lua_rawget(L, -2) != LUA_TNIL) - ta->geti = lua_geti; - lua_pushliteral(L, "__newindex"); /* 'newindex' metamethod */ - if (lua_rawget(L, -3) != LUA_TNIL) - ta->seti = lua_seti; - lua_pop(L, 3); /* pop metatable plus both metamethods */ - } - if (ta->geti == NULL || ta->seti == NULL) { - luaL_checktype(L, arg, LUA_TTABLE); /* must be table for raw methods */ - if (ta->geti == NULL) ta->geti = lua_rawgeti; - if (ta->seti == NULL) ta->seti = lua_rawseti; - } -} - - -#define aux_getn(L,n,ta) (checktab(L, n, ta), luaL_len(L, n)) - - -#if defined(LUA_COMPAT_MAXN) -static int maxn (lua_State *L) { - lua_Number max = 0; - luaL_checktype(L, 1, LUA_TTABLE); - lua_pushnil(L); /* first key */ - while (lua_next(L, 1)) { - lua_pop(L, 1); /* remove value */ - if (lua_type(L, -1) == LUA_TNUMBER) { - lua_Number v = lua_tonumber(L, -1); - if (v > max) max = v; - } - } - lua_pushnumber(L, max); - return 1; -} -#endif - - -static int tinsert (lua_State *L) { - TabA ta; - lua_Integer e = aux_getn(L, 1, &ta) + 1; /* first empty element */ - lua_Integer pos; /* where to insert new element */ - switch (lua_gettop(L)) { - case 2: { /* called with only 2 arguments */ - pos = e; /* insert new element at the end */ - break; - } - case 3: { - lua_Integer i; - pos = luaL_checkinteger(L, 2); /* 2nd argument is the position */ - luaL_argcheck(L, 1 <= pos && pos <= e, 2, "position out of bounds"); - for (i = e; i > pos; i--) { /* move up elements */ - (*ta.geti)(L, 1, i - 1); - (*ta.seti)(L, 1, i); /* t[i] = t[i - 1] */ - } - break; - } - default: { - return luaL_error(L, "wrong number of arguments to 'insert'"); - } - } - (*ta.seti)(L, 1, pos); /* t[pos] = v */ - return 0; -} - - -static int tremove (lua_State *L) { - TabA ta; - lua_Integer size = aux_getn(L, 1, &ta); - lua_Integer pos = luaL_optinteger(L, 2, size); - if (pos != size) /* validate 'pos' if given */ - luaL_argcheck(L, 1 <= pos && pos <= size + 1, 1, "position out of bounds"); - (*ta.geti)(L, 1, pos); /* result = t[pos] */ - for ( ; pos < size; pos++) { - (*ta.geti)(L, 1, pos + 1); - (*ta.seti)(L, 1, pos); /* t[pos] = t[pos + 1] */ - } - lua_pushnil(L); - (*ta.seti)(L, 1, pos); /* t[pos] = nil */ - return 1; -} - - -static int tmove (lua_State *L) { - TabA ta; - lua_Integer f = luaL_checkinteger(L, 2); - lua_Integer e = luaL_checkinteger(L, 3); - lua_Integer t = luaL_checkinteger(L, 4); - int tt = !lua_isnoneornil(L, 5) ? 5 : 1; /* destination table */ - if (e >= f) { /* otherwise, nothing to move */ - lua_Integer n, i; - ta.geti = (luaL_getmetafield(L, 1, "__index") == LUA_TNIL) - ? (luaL_checktype(L, 1, LUA_TTABLE), lua_rawgeti) - : lua_geti; - ta.seti = (luaL_getmetafield(L, tt, "__newindex") == LUA_TNIL) - ? (luaL_checktype(L, tt, LUA_TTABLE), lua_rawseti) - : lua_seti; - luaL_argcheck(L, f > 0 || e < LUA_MAXINTEGER + f, 3, - "too many elements to move"); - n = e - f + 1; /* number of elements to move */ - luaL_argcheck(L, t <= LUA_MAXINTEGER - n + 1, 4, - "destination wrap around"); - if (t > f) { - for (i = n - 1; i >= 0; i--) { - (*ta.geti)(L, 1, f + i); - (*ta.seti)(L, tt, t + i); - } - } - else { - for (i = 0; i < n; i++) { - (*ta.geti)(L, 1, f + i); - (*ta.seti)(L, tt, t + i); - } - } - } - lua_pushvalue(L, tt); /* return "to table" */ - return 1; -} - - -static void addfield (lua_State *L, luaL_Buffer *b, TabA *ta, lua_Integer i) { - (*ta->geti)(L, 1, i); - if (!lua_isstring(L, -1)) - luaL_error(L, "invalid value (%s) at index %d in table for 'concat'", - luaL_typename(L, -1), i); - luaL_addvalue(b); -} - - -static int tconcat (lua_State *L) { - TabA ta; - luaL_Buffer b; - size_t lsep; - lua_Integer i, last; - const char *sep = luaL_optlstring(L, 2, "", &lsep); - checktab(L, 1, &ta); - i = luaL_optinteger(L, 3, 1); - last = luaL_opt(L, luaL_checkinteger, 4, luaL_len(L, 1)); - luaL_buffinit(L, &b); - for (; i < last; i++) { - addfield(L, &b, &ta, i); - luaL_addlstring(&b, sep, lsep); - } - if (i == last) /* add last value (if interval was not empty) */ - addfield(L, &b, &ta, i); - luaL_pushresult(&b); - return 1; -} - - -/* -** {====================================================== -** Pack/unpack -** ======================================================= -*/ - -static int pack (lua_State *L) { - int i; - int n = lua_gettop(L); /* number of elements to pack */ - lua_createtable(L, n, 1); /* create result table */ - lua_insert(L, 1); /* put it at index 1 */ - for (i = n; i >= 1; i--) /* assign elements */ - lua_rawseti(L, 1, i); - lua_pushinteger(L, n); - lua_setfield(L, 1, "n"); /* t.n = number of elements */ - return 1; /* return table */ -} - - -static int unpack (lua_State *L) { - TabA ta; - lua_Integer i, e; - lua_Unsigned n; - checktab(L, 1, &ta); - i = luaL_optinteger(L, 2, 1); - e = luaL_opt(L, luaL_checkinteger, 3, luaL_len(L, 1)); - if (i > e) return 0; /* empty range */ - n = (lua_Unsigned)e - i; /* number of elements minus 1 (avoid overflows) */ - if (n >= (unsigned int)INT_MAX || !lua_checkstack(L, (int)(++n))) - return luaL_error(L, "too many results to unpack"); - do { /* must have at least one element */ - (*ta.geti)(L, 1, i); /* push arg[i..e] */ - } while (i++ < e); - - return (int)n; -} - -/* }====================================================== */ - - - -/* -** {====================================================== -** Quicksort -** (based on 'Algorithms in MODULA-3', Robert Sedgewick; -** Addison-Wesley, 1993.) -** ======================================================= -*/ - - -static void set2 (lua_State *L, TabA *ta, int i, int j) { - (*ta->seti)(L, 1, i); - (*ta->seti)(L, 1, j); -} - -static int sort_comp (lua_State *L, int a, int b) { - if (!lua_isnil(L, 2)) { /* function? */ - int res; - lua_pushvalue(L, 2); - lua_pushvalue(L, a-1); /* -1 to compensate function */ - lua_pushvalue(L, b-2); /* -2 to compensate function and 'a' */ - lua_call(L, 2, 1); - res = lua_toboolean(L, -1); - lua_pop(L, 1); - return res; - } - else /* a < b? */ - return lua_compare(L, a, b, LUA_OPLT); -} - -static void auxsort (lua_State *L, TabA *ta, int l, int u) { - while (l < u) { /* for tail recursion */ - int i, j; - /* sort elements a[l], a[(l+u)/2] and a[u] */ - (*ta->geti)(L, 1, l); - (*ta->geti)(L, 1, u); - if (sort_comp(L, -1, -2)) /* a[u] < a[l]? */ - set2(L, ta, l, u); /* swap a[l] - a[u] */ - else - lua_pop(L, 2); - if (u-l == 1) break; /* only 2 elements */ - i = (l+u)/2; - (*ta->geti)(L, 1, i); - (*ta->geti)(L, 1, l); - if (sort_comp(L, -2, -1)) /* a[i]geti)(L, 1, u); - if (sort_comp(L, -1, -2)) /* a[u]geti)(L, 1, i); /* Pivot */ - lua_pushvalue(L, -1); - (*ta->geti)(L, 1, u-1); - set2(L, ta, i, u-1); - /* a[l] <= P == a[u-1] <= a[u], only need to sort from l+1 to u-2 */ - i = l; j = u-1; - for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */ - /* repeat ++i until a[i] >= P */ - while ((*ta->geti)(L, 1, ++i), sort_comp(L, -1, -2)) { - if (i>=u) luaL_error(L, "invalid order function for sorting"); - lua_pop(L, 1); /* remove a[i] */ - } - /* repeat --j until a[j] <= P */ - while ((*ta->geti)(L, 1, --j), sort_comp(L, -3, -1)) { - if (j<=l) luaL_error(L, "invalid order function for sorting"); - lua_pop(L, 1); /* remove a[j] */ - } - if (jgeti)(L, 1, u-1); - (*ta->geti)(L, 1, i); - set2(L, ta, u-1, i); /* swap pivot (a[u-1]) with a[i] */ - /* a[l..i-1] <= a[i] == P <= a[i+1..u] */ - /* adjust so that smaller half is in [j..i] and larger one in [l..u] */ - if (i-l < u-i) { - j=l; i=i-1; l=i+2; - } - else { - j=i+1; i=u; u=j-2; - } - auxsort(L, ta, j, i); /* call recursively the smaller one */ - } /* repeat the routine for the larger one */ -} - -static int sort (lua_State *L) { - TabA ta; - int n = (int)aux_getn(L, 1, &ta); - luaL_checkstack(L, 50, ""); /* assume array is smaller than 2^50 */ - if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */ - luaL_checktype(L, 2, LUA_TFUNCTION); - lua_settop(L, 2); /* make sure there are two arguments */ - auxsort(L, &ta, 1, n); - return 0; -} - -/* }====================================================== */ - - -static const luaL_Reg tab_funcs[] = { - {"concat", tconcat}, -#if defined(LUA_COMPAT_MAXN) - {"maxn", maxn}, -#endif - {"insert", tinsert}, - {"pack", pack}, - {"unpack", unpack}, - {"remove", tremove}, - {"move", tmove}, - {"sort", sort}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_table (lua_State *L) { - luaL_newlib(L, tab_funcs); -#if defined(LUA_COMPAT_UNPACK) - /* _G.unpack = table.unpack */ - lua_getfield(L, -1, "unpack"); - lua_setglobal(L, "unpack"); -#endif - return 1; -} - diff --git a/external/mit/lua/dist/src/ltm.c b/external/mit/lua/dist/src/ltm.c deleted file mode 100644 index bebc70271..000000000 --- a/external/mit/lua/dist/src/ltm.c +++ /dev/null @@ -1,153 +0,0 @@ -/* $NetBSD: ltm.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: ltm.c,v 2.34 2015/03/30 15:42:27 roberto Exp -** Tag methods -** See Copyright Notice in lua.h -*/ - -#define ltm_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lobject.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - -static const char udatatypename[] = "userdata"; - -LUAI_DDEF const char *const luaT_typenames_[LUA_TOTALTAGS] = { - "no value", - "nil", "boolean", udatatypename, "number", - "string", "table", "function", udatatypename, "thread", - "proto" /* this last case is used for tests only */ -}; - - -void luaT_init (lua_State *L) { - static const char *const luaT_eventname[] = { /* ORDER TM */ - "__index", "__newindex", - "__gc", "__mode", "__len", "__eq", -#ifndef _KERNEL - "__add", "__sub", "__mul", "__mod", "__pow", - "__div", "__idiv", -#else - "__add", "__sub", "__mul", "__mod", - "__idiv", -#endif - "__band", "__bor", "__bxor", "__shl", "__shr", - "__unm", "__bnot", "__lt", "__le", - "__concat", "__call" - }; - int i; - for (i=0; itmname[i] = luaS_new(L, luaT_eventname[i]); - luaC_fix(L, obj2gco(G(L)->tmname[i])); /* never collect these names */ - } -} - - -/* -** function to be used with macro "fasttm": optimized for absence of -** tag methods -*/ -const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { - const TValue *tm = luaH_getstr(events, ename); - lua_assert(event <= TM_EQ); - if (ttisnil(tm)) { /* no tag method? */ - events->flags |= cast_byte(1u<metatable; - break; - case LUA_TUSERDATA: - mt = uvalue(o)->metatable; - break; - default: - mt = G(L)->mt[ttnov(o)]; - } - return (mt ? luaH_getstr(mt, G(L)->tmname[event]) : luaO_nilobject); -} - - -void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, - const TValue *p2, TValue *p3, int hasres) { - ptrdiff_t result = savestack(L, p3); - setobj2s(L, L->top++, f); /* push function (assume EXTRA_STACK) */ - setobj2s(L, L->top++, p1); /* 1st argument */ - setobj2s(L, L->top++, p2); /* 2nd argument */ - if (!hasres) /* no result? 'p3' is third argument */ - setobj2s(L, L->top++, p3); /* 3rd argument */ - /* metamethod may yield only when called from Lua code */ - luaD_call(L, L->top - (4 - hasres), hasres, isLua(L->ci)); - if (hasres) { /* if has result, move it to its place */ - p3 = restorestack(L, result); - setobjs2s(L, p3, --L->top); - } -} - - -int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event) { - const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ - if (ttisnil(tm)) - tm = luaT_gettmbyobj(L, p2, event); /* try second operand */ - if (ttisnil(tm)) return 0; - luaT_callTM(L, tm, p1, p2, res, 1); - return 1; -} - - -void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event) { - if (!luaT_callbinTM(L, p1, p2, res, event)) { - switch (event) { - case TM_CONCAT: - luaG_concaterror(L, p1, p2); - /* call never returns, but to avoid warnings: *//* FALLTHROUGH */ - case TM_BAND: case TM_BOR: case TM_BXOR: - case TM_SHL: case TM_SHR: case TM_BNOT: { - lua_Number dummy; - if (tonumber(p1, &dummy) && tonumber(p2, &dummy)) - luaG_tointerror(L, p1, p2); - else - luaG_opinterror(L, p1, p2, "perform bitwise operation on"); - } - /* calls never return, but to avoid warnings: *//* FALLTHROUGH */ - default: - luaG_opinterror(L, p1, p2, "perform arithmetic on"); - } - } -} - - -int luaT_callorderTM (lua_State *L, const TValue *p1, const TValue *p2, - TMS event) { - if (!luaT_callbinTM(L, p1, p2, L->top, event)) - return -1; /* no metamethod */ - else - return !l_isfalse(L->top); -} - diff --git a/external/mit/lua/dist/src/ltm.h b/external/mit/lua/dist/src/ltm.h deleted file mode 100644 index 2a097d8cf..000000000 --- a/external/mit/lua/dist/src/ltm.h +++ /dev/null @@ -1,79 +0,0 @@ -/* $NetBSD: ltm.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: ltm.h,v 2.21 2014/10/25 11:50:46 roberto Exp -** Tag methods -** See Copyright Notice in lua.h -*/ - -#ifndef ltm_h -#define ltm_h - - -#include "lobject.h" - - -/* -* WARNING: if you change the order of this enumeration, -* grep "ORDER TM" and "ORDER OP" -*/ -typedef enum { - TM_INDEX, - TM_NEWINDEX, - TM_GC, - TM_MODE, - TM_LEN, - TM_EQ, /* last tag method with fast access */ - TM_ADD, - TM_SUB, - TM_MUL, - TM_MOD, -#ifndef _KERNEL - TM_POW, - TM_DIV, -#endif - TM_IDIV, - TM_BAND, - TM_BOR, - TM_BXOR, - TM_SHL, - TM_SHR, - TM_UNM, - TM_BNOT, - TM_LT, - TM_LE, - TM_CONCAT, - TM_CALL, - TM_N /* number of elements in the enum */ -} TMS; - - - -#define gfasttm(g,et,e) ((et) == NULL ? NULL : \ - ((et)->flags & (1u<<(e))) ? NULL : luaT_gettm(et, e, (g)->tmname[e])) - -#define fasttm(l,et,e) gfasttm(G(l), et, e) - -#define ttypename(x) luaT_typenames_[(x) + 1] -#define objtypename(x) ttypename(ttnov(x)) - -LUAI_DDEC const char *const luaT_typenames_[LUA_TOTALTAGS]; - - -LUAI_FUNC const TValue *luaT_gettm (Table *events, TMS event, TString *ename); -LUAI_FUNC const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, - TMS event); -LUAI_FUNC void luaT_init (lua_State *L); - -LUAI_FUNC void luaT_callTM (lua_State *L, const TValue *f, const TValue *p1, - const TValue *p2, TValue *p3, int hasres); -LUAI_FUNC int luaT_callbinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event); -LUAI_FUNC void luaT_trybinTM (lua_State *L, const TValue *p1, const TValue *p2, - StkId res, TMS event); -LUAI_FUNC int luaT_callorderTM (lua_State *L, const TValue *p1, - const TValue *p2, TMS event); - - - -#endif diff --git a/external/mit/lua/dist/src/lua.c b/external/mit/lua/dist/src/lua.c deleted file mode 100644 index 2273fd271..000000000 --- a/external/mit/lua/dist/src/lua.c +++ /dev/null @@ -1,615 +0,0 @@ -/* $NetBSD: lua.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lua.c,v 1.225 2015/03/30 15:42:59 roberto Exp -** Lua stand-alone interpreter -** See Copyright Notice in lua.h -*/ - -#define lua_c - -#include "lprefix.h" - - -#include -#include -#include -#include - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - - -#if !defined(LUA_PROMPT) -#define LUA_PROMPT "> " -#define LUA_PROMPT2 ">> " -#endif - -#if !defined(LUA_PROGNAME) -#define LUA_PROGNAME "lua" -#endif - -#if !defined(LUA_MAXINPUT) -#define LUA_MAXINPUT 512 -#endif - -#if !defined(LUA_INIT_VAR) -#define LUA_INIT_VAR "LUA_INIT" -#endif - -#define LUA_INITVARVERSION \ - LUA_INIT_VAR "_" LUA_VERSION_MAJOR "_" LUA_VERSION_MINOR - - -/* -** lua_stdin_is_tty detects whether the standard input is a 'tty' (that -** is, whether we're running lua interactively). -*/ -#if !defined(lua_stdin_is_tty) /* { */ - -#if defined(LUA_USE_POSIX) /* { */ - -#include -#define lua_stdin_is_tty() isatty(0) - -#elif defined(LUA_USE_WINDOWS) /* }{ */ - -#include -#define lua_stdin_is_tty() _isatty(_fileno(stdin)) - -#else /* }{ */ - -/* ISO C definition */ -#define lua_stdin_is_tty() 1 /* assume stdin is a tty */ - -#endif /* } */ - -#endif /* } */ - - -/* -** lua_readline defines how to show a prompt and then read a line from -** the standard input. -** lua_saveline defines how to "save" a read line in a "history". -** lua_freeline defines how to free a line read by lua_readline. -*/ -#if !defined(lua_readline) /* { */ - -#if defined(LUA_USE_READLINE) /* { */ - -#include -#include -#define lua_readline(L,b,p) ((void)L, ((b)=readline(p)) != NULL) -#define lua_saveline(L,line) ((void)L, add_history(line)) -#define lua_freeline(L,b) ((void)L, free(b)) - -#else /* }{ */ - -#define lua_readline(L,b,p) \ - ((void)L, fputs(p, stdout), fflush(stdout), /* show prompt */ \ - fgets(b, LUA_MAXINPUT, stdin) != NULL) /* get line */ -#define lua_saveline(L,line) { (void)L; (void)line; } -#define lua_freeline(L,b) { (void)L; (void)b; } - -#endif /* } */ - -#endif /* } */ - - - - -static lua_State *globalL = NULL; - -static const char *progname = LUA_PROGNAME; - - -/* -** Hook set by signal function to stop the interpreter. -*/ -static void lstop (lua_State *L, lua_Debug *ar) { - (void)ar; /* unused arg. */ - lua_sethook(L, NULL, 0, 0); /* reset hook */ - luaL_error(L, "interrupted!"); -} - - -/* -** Function to be called at a C signal. Because a C signal cannot -** just change a Lua state (as there is no proper synchronization), -** this function only sets a hook that, when called, will stop the -** interpreter. -*/ -static void laction (int i) { - signal(i, SIG_DFL); /* if another SIGINT happens, terminate process */ - lua_sethook(globalL, lstop, LUA_MASKCALL | LUA_MASKRET | LUA_MASKCOUNT, 1); -} - - -static void print_usage (const char *badoption) { - lua_writestringerror("%s: ", progname); - if (badoption[1] == 'e' || badoption[1] == 'l') - lua_writestringerror("'%s' needs argument\n", badoption); - else - lua_writestringerror("unrecognized option '%s'\n", badoption); - lua_writestringerror( - "usage: %s [options] [script [args]]\n" - "Available options are:\n" - " -e stat execute string 'stat'\n" - " -i enter interactive mode after executing 'script'\n" - " -l name require library 'name'\n" - " -v show version information\n" - " -E ignore environment variables\n" - " -- stop handling options\n" - " - stop handling options and execute stdin\n" - , - progname); -} - - -/* -** Prints an error message, adding the program name in front of it -** (if present) -*/ -static void l_message (const char *pname, const char *msg) { - if (pname) lua_writestringerror("%s: ", pname); - lua_writestringerror("%s\n", msg); -} - - -/* -** Check whether 'status' is not OK and, if so, prints the error -** message on the top of the stack. It assumes that the error object -** is a string, as it was either generated by Lua or by 'msghandler'. -*/ -static int report (lua_State *L, int status) { - if (status != LUA_OK) { - const char *msg = lua_tostring(L, -1); - l_message(progname, msg); - lua_pop(L, 1); /* remove message */ - } - return status; -} - - -/* -** Message handler used to run all chunks -*/ -static int msghandler (lua_State *L) { - const char *msg = lua_tostring(L, 1); - if (msg == NULL) { /* is error object not a string? */ - if (luaL_callmeta(L, 1, "__tostring") && /* does it have a metamethod */ - lua_type(L, -1) == LUA_TSTRING) /* that produces a string? */ - return 1; /* that is the message */ - else - msg = lua_pushfstring(L, "(error object is a %s value)", - luaL_typename(L, 1)); - } - luaL_traceback(L, L, msg, 1); /* append a standard traceback */ - return 1; /* return the traceback */ -} - - -/* -** Interface to 'lua_pcall', which sets appropriate message function -** and C-signal handler. Used to run all chunks. -*/ -static int docall (lua_State *L, int narg, int nres) { - int status; - int base = lua_gettop(L) - narg; /* function index */ - lua_pushcfunction(L, msghandler); /* push message handler */ - lua_insert(L, base); /* put it under function and args */ - globalL = L; /* to be available to 'laction' */ - signal(SIGINT, laction); /* set C-signal handler */ - status = lua_pcall(L, narg, nres, base); - signal(SIGINT, SIG_DFL); /* reset C-signal handler */ - lua_remove(L, base); /* remove message handler from the stack */ - return status; -} - - -static void print_version (void) { - lua_writestring(LUA_COPYRIGHT, strlen(LUA_COPYRIGHT)); - lua_writeline(); -} - - -/* -** Create the 'arg' table, which stores all arguments from the -** command line ('argv'). It should be aligned so that, at index 0, -** it has 'argv[script]', which is the script name. The arguments -** to the script (everything after 'script') go to positive indices; -** other arguments (before the script name) go to negative indices. -** If there is no script name, assume interpreter's name as base. -*/ -static void createargtable (lua_State *L, char **argv, int argc, int script) { - int i, narg; - if (script == argc) script = 0; /* no script name? */ - narg = argc - (script + 1); /* number of positive indices */ - lua_createtable(L, narg, script + 1); - for (i = 0; i < argc; i++) { - lua_pushstring(L, argv[i]); - lua_rawseti(L, -2, i - script); - } - lua_setglobal(L, "arg"); -} - - -static int dochunk (lua_State *L, int status) { - if (status == LUA_OK) status = docall(L, 0, 0); - return report(L, status); -} - - -static int dofile (lua_State *L, const char *name) { - return dochunk(L, luaL_loadfile(L, name)); -} - - -static int dostring (lua_State *L, const char *s, const char *name) { - return dochunk(L, luaL_loadbuffer(L, s, strlen(s), name)); -} - - -/* -** Calls 'require(name)' and stores the result in a global variable -** with the given name. -*/ -static int dolibrary (lua_State *L, const char *name) { - int status; - lua_getglobal(L, "require"); - lua_pushstring(L, name); - status = docall(L, 1, 1); /* call 'require(name)' */ - if (status == LUA_OK) - lua_setglobal(L, name); /* global[name] = require return */ - return report(L, status); -} - - -/* -** Returns the string to be used as a prompt by the interpreter. -*/ -static const char *get_prompt (lua_State *L, int firstline) { - const char *p; - lua_getglobal(L, firstline ? "_PROMPT" : "_PROMPT2"); - p = lua_tostring(L, -1); - if (p == NULL) p = (firstline ? LUA_PROMPT : LUA_PROMPT2); - return p; -} - -/* mark in error messages for incomplete statements */ -#define EOFMARK "" -#define marklen (sizeof(EOFMARK)/sizeof(char) - 1) - - -/* -** Check whether 'status' signals a syntax error and the error -** message at the top of the stack ends with the above mark for -** incomplete statements. -*/ -static int incomplete (lua_State *L, int status) { - if (status == LUA_ERRSYNTAX) { - size_t lmsg; - const char *msg = lua_tolstring(L, -1, &lmsg); - if (lmsg >= marklen && strcmp(msg + lmsg - marklen, EOFMARK) == 0) { - lua_pop(L, 1); - return 1; - } - } - return 0; /* else... */ -} - - -/* -** Prompt the user, read a line, and push it into the Lua stack. -*/ -static int pushline (lua_State *L, int firstline) { - char buffer[LUA_MAXINPUT]; - char *b = buffer; - size_t l; - const char *prmt = get_prompt(L, firstline); - int readstatus = lua_readline(L, b, prmt); - if (readstatus == 0) - return 0; /* no input (prompt will be popped by caller) */ - lua_pop(L, 1); /* remove prompt */ - l = strlen(b); - if (l > 0 && b[l-1] == '\n') /* line ends with newline? */ - b[--l] = '\0'; /* remove it */ - if (firstline && b[0] == '=') /* for compatibility with 5.2, ... */ - lua_pushfstring(L, "return %s", b + 1); /* change '=' to 'return' */ - else - lua_pushlstring(L, b, l); - lua_freeline(L, b); - return 1; -} - - -/* -** Try to compile line on the stack as 'return '; on return, stack -** has either compiled chunk or original line (if compilation failed). -*/ -static int addreturn (lua_State *L) { - int status; - size_t len; const char *line; - lua_pushliteral(L, "return "); - lua_pushvalue(L, -2); /* duplicate line */ - lua_concat(L, 2); /* new line is "return ..." */ - line = lua_tolstring(L, -1, &len); - if ((status = luaL_loadbuffer(L, line, len, "=stdin")) == LUA_OK) { - lua_remove(L, -3); /* remove original line */ - line += sizeof("return")/sizeof(char); /* remove 'return' for history */ - if (line[0] != '\0') /* non empty? */ - lua_saveline(L, line); /* keep history */ - } - else - lua_pop(L, 2); /* remove result from 'luaL_loadbuffer' and new line */ - return status; -} - - -/* -** Read multiple lines until a complete Lua statement -*/ -static int multiline (lua_State *L) { - for (;;) { /* repeat until gets a complete statement */ - size_t len; - const char *line = lua_tolstring(L, 1, &len); /* get what it has */ - int status = luaL_loadbuffer(L, line, len, "=stdin"); /* try it */ - if (!incomplete(L, status) || !pushline(L, 0)) { - lua_saveline(L, line); /* keep history */ - return status; /* cannot or should not try to add continuation line */ - } - lua_pushliteral(L, "\n"); /* add newline... */ - lua_insert(L, -2); /* ...between the two lines */ - lua_concat(L, 3); /* join them */ - } -} - - -/* -** Read a line and try to load (compile) it first as an expression (by -** adding "return " in front of it) and second as a statement. Return -** the final status of load/call with the resulting function (if any) -** in the top of the stack. -*/ -static int loadline (lua_State *L) { - int status; - lua_settop(L, 0); - if (!pushline(L, 1)) - return -1; /* no input */ - if ((status = addreturn(L)) != LUA_OK) /* 'return ...' did not work? */ - status = multiline(L); /* try as command, maybe with continuation lines */ - lua_remove(L, 1); /* remove line from the stack */ - lua_assert(lua_gettop(L) == 1); - return status; -} - - -/* -** Prints (calling the Lua 'print' function) any values on the stack -*/ -static void l_print (lua_State *L) { - int n = lua_gettop(L); - if (n > 0) { /* any result to be printed? */ - luaL_checkstack(L, LUA_MINSTACK, "too many results to print"); - lua_getglobal(L, "print"); - lua_insert(L, 1); - if (lua_pcall(L, n, 0, 0) != LUA_OK) - l_message(progname, lua_pushfstring(L, "error calling 'print' (%s)", - lua_tostring(L, -1))); - } -} - - -/* -** Do the REPL: repeatedly read (load) a line, evaluate (call) it, and -** print any results. -*/ -static void doREPL (lua_State *L) { - int status; - const char *oldprogname = progname; - progname = NULL; /* no 'progname' on errors in interactive mode */ - while ((status = loadline(L)) != -1) { - if (status == LUA_OK) - status = docall(L, 0, LUA_MULTRET); - if (status == LUA_OK) l_print(L); - else report(L, status); - } - lua_settop(L, 0); /* clear stack */ - lua_writeline(); - progname = oldprogname; -} - - -/* -** Push on the stack the contents of table 'arg' from 1 to #arg -*/ -static int pushargs (lua_State *L) { - int i, n; - if (lua_getglobal(L, "arg") != LUA_TTABLE) - luaL_error(L, "'arg' is not a table"); - n = (int)luaL_len(L, -1); - luaL_checkstack(L, n + 3, "too many arguments to script"); - for (i = 1; i <= n; i++) - lua_rawgeti(L, -i, i); - lua_remove(L, -i); /* remove table from the stack */ - return n; -} - - -static int handle_script (lua_State *L, char **argv) { - int status; - const char *fname = argv[0]; - if (strcmp(fname, "-") == 0 && strcmp(argv[-1], "--") != 0) - fname = NULL; /* stdin */ - status = luaL_loadfile(L, fname); - if (status == LUA_OK) { - int n = pushargs(L); /* push arguments to script */ - status = docall(L, n, LUA_MULTRET); - } - return report(L, status); -} - - - -/* bits of various argument indicators in 'args' */ -#define has_error 1 /* bad option */ -#define has_i 2 /* -i */ -#define has_v 4 /* -v */ -#define has_e 8 /* -e */ -#define has_E 16 /* -E */ - -/* -** Traverses all arguments from 'argv', returning a mask with those -** needed before running any Lua code (or an error code if it finds -** any invalid argument). 'first' returns the first not-handled argument -** (either the script name or a bad argument in case of error). -*/ -static int collectargs (char **argv, int *first) { - int args = 0; - int i; - for (i = 1; argv[i] != NULL; i++) { - *first = i; - if (argv[i][0] != '-') /* not an option? */ - return args; /* stop handling options */ - switch (argv[i][1]) { /* else check option */ - case '-': /* '--' */ - if (argv[i][2] != '\0') /* extra characters after '--'? */ - return has_error; /* invalid option */ - *first = i + 1; - return args; - case '\0': /* '-' */ - return args; /* script "name" is '-' */ - case 'E': - if (argv[i][2] != '\0') /* extra characters after 1st? */ - return has_error; /* invalid option */ - args |= has_E; - break; - case 'i': - args |= has_i; /* (-i implies -v) *//* FALLTHROUGH */ - case 'v': - if (argv[i][2] != '\0') /* extra characters after 1st? */ - return has_error; /* invalid option */ - args |= has_v; - break; - case 'e': - args |= has_e; /* FALLTHROUGH */ - case 'l': /* both options need an argument */ - if (argv[i][2] == '\0') { /* no concatenated argument? */ - i++; /* try next 'argv' */ - if (argv[i] == NULL || argv[i][0] == '-') - return has_error; /* no next argument or it is another option */ - } - break; - default: /* invalid option */ - return has_error; - } - } - *first = i; /* no script name */ - return args; -} - - -/* -** Processes options 'e' and 'l', which involve running Lua code. -** Returns 0 if some code raises an error. -*/ -static int runargs (lua_State *L, char **argv, int n) { - int i; - for (i = 1; i < n; i++) { - int option = argv[i][1]; - lua_assert(argv[i][0] == '-'); /* already checked */ - if (option == 'e' || option == 'l') { - int status; - const char *extra = argv[i] + 2; /* both options need an argument */ - if (*extra == '\0') extra = argv[++i]; - lua_assert(extra != NULL); - status = (option == 'e') - ? dostring(L, extra, "=(command line)") - : dolibrary(L, extra); - if (status != LUA_OK) return 0; - } - } - return 1; -} - - -static int handle_luainit (lua_State *L) { - const char *name = "=" LUA_INITVARVERSION; - const char *init = getenv(name + 1); - if (init == NULL) { - name = "=" LUA_INIT_VAR; - init = getenv(name + 1); /* try alternative name */ - } - if (init == NULL) return LUA_OK; - else if (init[0] == '@') - return dofile(L, init+1); - else - return dostring(L, init, name); -} - - -/* -** Main body of stand-alone interpreter (to be called in protected mode). -** Reads the options and handles them all. -*/ -static int pmain (lua_State *L) { - int argc = (int)lua_tointeger(L, 1); - char **argv = (char **)lua_touserdata(L, 2); - int script; - int args = collectargs(argv, &script); - luaL_checkversion(L); /* check that interpreter has correct version */ - if (argv[0] && argv[0][0]) progname = argv[0]; - if (args == has_error) { /* bad arg? */ - print_usage(argv[script]); /* 'script' has index of bad arg. */ - return 0; - } - if (args & has_v) /* option '-v'? */ - print_version(); - if (args & has_E) { /* option '-E'? */ - lua_pushboolean(L, 1); /* signal for libraries to ignore env. vars. */ - lua_setfield(L, LUA_REGISTRYINDEX, "LUA_NOENV"); - } - luaL_openlibs(L); /* open standard libraries */ - createargtable(L, argv, argc, script); /* create table 'arg' */ - if (!(args & has_E)) { /* no option '-E'? */ - if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ - return 0; /* error running LUA_INIT */ - } - if (!runargs(L, argv, script)) /* execute arguments -e and -l */ - return 0; /* something failed */ - if (script < argc && /* execute main script (if there is one) */ - handle_script(L, argv + script) != LUA_OK) - return 0; - if (args & has_i) /* -i option? */ - doREPL(L); /* do read-eval-print loop */ - else if (script == argc && !(args & (has_e | has_v))) { /* no arguments? */ - if (lua_stdin_is_tty()) { /* running in interactive mode? */ - print_version(); - doREPL(L); /* do read-eval-print loop */ - } - else dofile(L, NULL); /* executes stdin as a file */ - } - lua_pushboolean(L, 1); /* signal no errors */ - return 1; -} - - -int main (int argc, char **argv) { - int status, result; - lua_State *L = luaL_newstate(); /* create state */ - if (L == NULL) { - l_message(argv[0], "cannot create state: not enough memory"); - return EXIT_FAILURE; - } - lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ - lua_pushinteger(L, argc); /* 1st argument */ - lua_pushlightuserdata(L, argv); /* 2nd argument */ - status = lua_pcall(L, 2, 1, 0); /* do the call */ - result = lua_toboolean(L, -1); /* get result */ - report(L, status); - lua_close(L); - return (result && status == LUA_OK) ? EXIT_SUCCESS : EXIT_FAILURE; -} - diff --git a/external/mit/lua/dist/src/lua.h b/external/mit/lua/dist/src/lua.h deleted file mode 100644 index b80435ceb..000000000 --- a/external/mit/lua/dist/src/lua.h +++ /dev/null @@ -1,522 +0,0 @@ -/* $NetBSD: lua.h,v 1.5 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lua.h,v 1.328 2015/06/03 13:03:38 roberto Exp -** Lua - A Scripting Language -** Lua.org, PUC-Rio, Brazil (http://www.lua.org) -** See Copyright Notice at the end of this file -*/ - - -#ifndef lua_h -#define lua_h - -#include -#ifndef _KERNEL -#include -#endif - - -#include "luaconf.h" - - -#define LUA_VERSION_MAJOR "5" -#define LUA_VERSION_MINOR "3" -#define LUA_VERSION_NUM 503 -#ifndef _KERNEL -#define LUA_VERSION_RELEASE "1" -#else /* _KERNEL */ -#define LUA_VERSION_RELEASE "1 (kernel)" -#endif - -#define LUA_VERSION "Lua " LUA_VERSION_MAJOR "." LUA_VERSION_MINOR -#define LUA_RELEASE LUA_VERSION "." LUA_VERSION_RELEASE -#ifndef _KERNEL -#define LUA_COPYRIGHT LUA_RELEASE " Copyright (C) 1994-2015 Lua.org, PUC-Rio" -#else /* _KERNEL */ -#define LUA_COPYRIGHT LUA_RELEASE \ - " Copyright (c) 2015, Lourival Vieira Neto ." \ - " Copyright (C) 1994-2015 Lua.org, PUC-Rio" -#endif -#define LUA_AUTHORS "R. Ierusalimschy, L. H. de Figueiredo, W. Celes" - - -/* mark for precompiled code ('Lua') */ -#define LUA_SIGNATURE "\x1bLua" - -/* option for multiple returns in 'lua_pcall' and 'lua_call' */ -#define LUA_MULTRET (-1) - - -/* -** Pseudo-indices -** (-LUAI_MAXSTACK is the minimum valid index; we keep some free empty -** space after that to help overflow detection) -*/ -#define LUA_REGISTRYINDEX (-LUAI_MAXSTACK - 1000) -#define lua_upvalueindex(i) (LUA_REGISTRYINDEX - (i)) - - -/* thread status */ -#define LUA_OK 0 -#define LUA_YIELD 1 -#define LUA_ERRRUN 2 -#define LUA_ERRSYNTAX 3 -#define LUA_ERRMEM 4 -#define LUA_ERRGCMM 5 -#define LUA_ERRERR 6 - - -typedef struct lua_State lua_State; - - -/* -** basic types -*/ -#define LUA_TNONE (-1) - -#define LUA_TNIL 0 -#define LUA_TBOOLEAN 1 -#define LUA_TLIGHTUSERDATA 2 -#define LUA_TNUMBER 3 -#define LUA_TSTRING 4 -#define LUA_TTABLE 5 -#define LUA_TFUNCTION 6 -#define LUA_TUSERDATA 7 -#define LUA_TTHREAD 8 - -#define LUA_NUMTAGS 9 - - - -/* minimum Lua stack available to a C function */ -#define LUA_MINSTACK 20 - - -/* predefined values in the registry */ -#define LUA_RIDX_MAINTHREAD 1 -#define LUA_RIDX_GLOBALS 2 -#define LUA_RIDX_LAST LUA_RIDX_GLOBALS - - -/* type of numbers in Lua */ -typedef LUA_NUMBER lua_Number; - - -/* type for integer functions */ -typedef LUA_INTEGER lua_Integer; - -/* unsigned integer type */ -typedef LUA_UNSIGNED lua_Unsigned; - -/* type for continuation-function contexts */ -typedef LUA_KCONTEXT lua_KContext; - - -/* -** Type for C functions registered with Lua -*/ -typedef int (*lua_CFunction) (lua_State *L); - -/* -** Type for continuation functions -*/ -typedef int (*lua_KFunction) (lua_State *L, int status, lua_KContext ctx); - - -/* -** Type for functions that read/write blocks when loading/dumping Lua chunks -*/ -typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz); - -typedef int (*lua_Writer) (lua_State *L, const void *p, size_t sz, void *ud); - - -/* -** Type for memory-allocation functions -*/ -typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize); - - - -/* -** generic extra include file -*/ -#if defined(LUA_USER_H) -#include LUA_USER_H -#endif - - -/* -** RCS ident string -*/ -extern const char lua_ident[]; - - -/* -** state manipulation -*/ -LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud); -LUA_API void (lua_close) (lua_State *L); -LUA_API lua_State *(lua_newthread) (lua_State *L); - -LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf); - - -LUA_API const lua_Number *(lua_version) (lua_State *L); - - -/* -** basic stack manipulation -*/ -LUA_API int (lua_absindex) (lua_State *L, int idx); -LUA_API int (lua_gettop) (lua_State *L); -LUA_API void (lua_settop) (lua_State *L, int idx); -LUA_API void (lua_pushvalue) (lua_State *L, int idx); -LUA_API void (lua_rotate) (lua_State *L, int idx, int n); -LUA_API void (lua_copy) (lua_State *L, int fromidx, int toidx); -LUA_API int (lua_checkstack) (lua_State *L, int n); - -LUA_API void (lua_xmove) (lua_State *from, lua_State *to, int n); - - -/* -** access functions (stack -> C) -*/ - -LUA_API int (lua_isnumber) (lua_State *L, int idx); -LUA_API int (lua_isstring) (lua_State *L, int idx); -LUA_API int (lua_iscfunction) (lua_State *L, int idx); -LUA_API int (lua_isinteger) (lua_State *L, int idx); -LUA_API int (lua_isuserdata) (lua_State *L, int idx); -LUA_API int (lua_type) (lua_State *L, int idx); -LUA_API const char *(lua_typename) (lua_State *L, int tp); - -#ifndef _KERNEL -LUA_API lua_Number (lua_tonumberx) (lua_State *L, int idx, int *isnum); -#else /* _KERNEL */ -#define lua_tonumberx (lua_Integer) lua_tointegerx -#endif -LUA_API lua_Integer (lua_tointegerx) (lua_State *L, int idx, int *isnum); -LUA_API int (lua_toboolean) (lua_State *L, int idx); -LUA_API const char *(lua_tolstring) (lua_State *L, int idx, size_t *len); -LUA_API size_t (lua_rawlen) (lua_State *L, int idx); -LUA_API lua_CFunction (lua_tocfunction) (lua_State *L, int idx); -LUA_API void *(lua_touserdata) (lua_State *L, int idx); -LUA_API lua_State *(lua_tothread) (lua_State *L, int idx); -LUA_API const void *(lua_topointer) (lua_State *L, int idx); - - -/* -** Comparison and arithmetic functions -*/ - -#define LUA_OPADD 0 /* ORDER TM, ORDER OP */ -#define LUA_OPSUB 1 -#define LUA_OPMUL 2 -#define LUA_OPMOD 3 -#ifndef _KERNEL -#define LUA_OPPOW 4 -#define LUA_OPDIV 5 -#define LUA_OPIDIV 6 -#define LUA_OPBAND 7 -#define LUA_OPBOR 8 -#define LUA_OPBXOR 9 -#define LUA_OPSHL 10 -#define LUA_OPSHR 11 -#define LUA_OPUNM 12 -#define LUA_OPBNOT 13 -#else /* _KERNEL */ -#define LUA_OPIDIV 4 -#define LUA_OPBAND 5 -#define LUA_OPBOR 6 -#define LUA_OPBXOR 7 -#define LUA_OPSHL 8 -#define LUA_OPSHR 9 -#define LUA_OPUNM 10 -#define LUA_OPBNOT 11 -#endif - -LUA_API void (lua_arith) (lua_State *L, int op); - -#define LUA_OPEQ 0 -#define LUA_OPLT 1 -#define LUA_OPLE 2 - -LUA_API int (lua_rawequal) (lua_State *L, int idx1, int idx2); -LUA_API int (lua_compare) (lua_State *L, int idx1, int idx2, int op); - - -/* -** push functions (C -> stack) -*/ -LUA_API void (lua_pushnil) (lua_State *L); -#ifndef _KERNEL -LUA_API void (lua_pushnumber) (lua_State *L, lua_Number n); -#else /* _KERNEL */ -#define lua_pushnumber(L, n) lua_pushinteger(L, (lua_Integer)(n)) -#endif -LUA_API void (lua_pushinteger) (lua_State *L, lua_Integer n); -LUA_API const char *(lua_pushlstring) (lua_State *L, const char *s, size_t len); -LUA_API const char *(lua_pushstring) (lua_State *L, const char *s); -LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt, - va_list argp); -LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...); -LUA_API void (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n); -LUA_API void (lua_pushboolean) (lua_State *L, int b); -LUA_API void (lua_pushlightuserdata) (lua_State *L, void *p); -LUA_API int (lua_pushthread) (lua_State *L); - - -/* -** get functions (Lua -> stack) -*/ -LUA_API int (lua_getglobal) (lua_State *L, const char *name); -LUA_API int (lua_gettable) (lua_State *L, int idx); -LUA_API int (lua_getfield) (lua_State *L, int idx, const char *k); -LUA_API int (lua_geti) (lua_State *L, int idx, lua_Integer n); -LUA_API int (lua_rawget) (lua_State *L, int idx); -LUA_API int (lua_rawgeti) (lua_State *L, int idx, lua_Integer n); -LUA_API int (lua_rawgetp) (lua_State *L, int idx, const void *p); - -LUA_API void (lua_createtable) (lua_State *L, int narr, int nrec); -LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz); -LUA_API int (lua_getmetatable) (lua_State *L, int objindex); -LUA_API int (lua_getuservalue) (lua_State *L, int idx); - - -/* -** set functions (stack -> Lua) -*/ -LUA_API void (lua_setglobal) (lua_State *L, const char *name); -LUA_API void (lua_settable) (lua_State *L, int idx); -LUA_API void (lua_setfield) (lua_State *L, int idx, const char *k); -LUA_API void (lua_seti) (lua_State *L, int idx, lua_Integer n); -LUA_API void (lua_rawset) (lua_State *L, int idx); -LUA_API void (lua_rawseti) (lua_State *L, int idx, lua_Integer n); -LUA_API void (lua_rawsetp) (lua_State *L, int idx, const void *p); -LUA_API int (lua_setmetatable) (lua_State *L, int objindex); -LUA_API void (lua_setuservalue) (lua_State *L, int idx); - - -/* -** 'load' and 'call' functions (load and run Lua code) -*/ -LUA_API void (lua_callk) (lua_State *L, int nargs, int nresults, - lua_KContext ctx, lua_KFunction k); -#define lua_call(L,n,r) lua_callk(L, (n), (r), 0, NULL) - -LUA_API int (lua_pcallk) (lua_State *L, int nargs, int nresults, int errfunc, - lua_KContext ctx, lua_KFunction k); -#define lua_pcall(L,n,r,f) lua_pcallk(L, (n), (r), (f), 0, NULL) - -LUA_API int (lua_load) (lua_State *L, lua_Reader reader, void *dt, - const char *chunkname, const char *mode); - -LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data, int strip); - - -/* -** coroutine functions -*/ -LUA_API int (lua_yieldk) (lua_State *L, int nresults, lua_KContext ctx, - lua_KFunction k); -LUA_API int (lua_resume) (lua_State *L, lua_State *from, int narg); -LUA_API int (lua_status) (lua_State *L); -LUA_API int (lua_isyieldable) (lua_State *L); - -#define lua_yield(L,n) lua_yieldk(L, (n), 0, NULL) - - -/* -** garbage-collection function and options -*/ - -#define LUA_GCSTOP 0 -#define LUA_GCRESTART 1 -#define LUA_GCCOLLECT 2 -#define LUA_GCCOUNT 3 -#define LUA_GCCOUNTB 4 -#define LUA_GCSTEP 5 -#define LUA_GCSETPAUSE 6 -#define LUA_GCSETSTEPMUL 7 -#define LUA_GCISRUNNING 9 - -LUA_API int (lua_gc) (lua_State *L, int what, int data); - - -/* -** miscellaneous functions -*/ - -LUA_API int (lua_error) (lua_State *L); - -LUA_API int (lua_next) (lua_State *L, int idx); - -LUA_API void (lua_concat) (lua_State *L, int n); -LUA_API void (lua_len) (lua_State *L, int idx); - -LUA_API size_t (lua_stringtonumber) (lua_State *L, const char *s); - -LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud); -LUA_API void (lua_setallocf) (lua_State *L, lua_Alloc f, void *ud); - - - -/* -** {============================================================== -** some useful macros -** =============================================================== -*/ - -#define lua_getextraspace(L) ((void *)((char *)(L) - LUA_EXTRASPACE)) - -#define lua_tonumber(L,i) lua_tonumberx(L,(i),NULL) -#define lua_tointeger(L,i) lua_tointegerx(L,(i),NULL) - -#define lua_pop(L,n) lua_settop(L, -(n)-1) - -#define lua_newtable(L) lua_createtable(L, 0, 0) - -#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n))) - -#define lua_pushcfunction(L,f) lua_pushcclosure(L, (f), 0) - -#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION) -#define lua_istable(L,n) (lua_type(L, (n)) == LUA_TTABLE) -#define lua_islightuserdata(L,n) (lua_type(L, (n)) == LUA_TLIGHTUSERDATA) -#define lua_isnil(L,n) (lua_type(L, (n)) == LUA_TNIL) -#define lua_isboolean(L,n) (lua_type(L, (n)) == LUA_TBOOLEAN) -#define lua_isthread(L,n) (lua_type(L, (n)) == LUA_TTHREAD) -#define lua_isnone(L,n) (lua_type(L, (n)) == LUA_TNONE) -#define lua_isnoneornil(L, n) (lua_type(L, (n)) <= 0) - -#define lua_pushliteral(L, s) lua_pushstring(L, "" s) - -#define lua_pushglobaltable(L) \ - lua_rawgeti(L, LUA_REGISTRYINDEX, LUA_RIDX_GLOBALS) - -#define lua_tostring(L,i) lua_tolstring(L, (i), NULL) - - -#define lua_insert(L,idx) lua_rotate(L, (idx), 1) - -#define lua_remove(L,idx) (lua_rotate(L, (idx), -1), lua_pop(L, 1)) - -#define lua_replace(L,idx) (lua_copy(L, -1, (idx)), lua_pop(L, 1)) - -/* }============================================================== */ - - -/* -** {============================================================== -** compatibility macros for unsigned conversions -** =============================================================== -*/ -#if defined(LUA_COMPAT_APIINTCASTS) - -#define lua_pushunsigned(L,n) lua_pushinteger(L, (lua_Integer)(n)) -#define lua_tounsignedx(L,i,is) ((lua_Unsigned)lua_tointegerx(L,i,is)) -#define lua_tounsigned(L,i) lua_tounsignedx(L,(i),NULL) - -#endif -/* }============================================================== */ - -/* -** {====================================================================== -** Debug API -** ======================================================================= -*/ - - -/* -** Event codes -*/ -#define LUA_HOOKCALL 0 -#define LUA_HOOKRET 1 -#define LUA_HOOKLINE 2 -#define LUA_HOOKCOUNT 3 -#define LUA_HOOKTAILCALL 4 - - -/* -** Event masks -*/ -#define LUA_MASKCALL (1 << LUA_HOOKCALL) -#define LUA_MASKRET (1 << LUA_HOOKRET) -#define LUA_MASKLINE (1 << LUA_HOOKLINE) -#define LUA_MASKCOUNT (1 << LUA_HOOKCOUNT) - -typedef struct lua_Debug lua_Debug; /* activation record */ - - -/* Functions to be called by the debugger in specific events */ -typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar); - - -LUA_API int (lua_getstack) (lua_State *L, int level, lua_Debug *ar); -LUA_API int (lua_getinfo) (lua_State *L, const char *what, lua_Debug *ar); -LUA_API const char *(lua_getlocal) (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *(lua_setlocal) (lua_State *L, const lua_Debug *ar, int n); -LUA_API const char *(lua_getupvalue) (lua_State *L, int funcindex, int n); -LUA_API const char *(lua_setupvalue) (lua_State *L, int funcindex, int n); - -LUA_API void *(lua_upvalueid) (lua_State *L, int fidx, int n); -LUA_API void (lua_upvaluejoin) (lua_State *L, int fidx1, int n1, - int fidx2, int n2); - -LUA_API void (lua_sethook) (lua_State *L, lua_Hook func, int mask, int count); -LUA_API lua_Hook (lua_gethook) (lua_State *L); -LUA_API int (lua_gethookmask) (lua_State *L); -LUA_API int (lua_gethookcount) (lua_State *L); - - -struct lua_Debug { - int event; - const char *name; /* (n) */ - const char *namewhat; /* (n) 'global', 'local', 'field', 'method' */ - const char *what; /* (S) 'Lua', 'C', 'main', 'tail' */ - const char *source; /* (S) */ - int currentline; /* (l) */ - int linedefined; /* (S) */ - int lastlinedefined; /* (S) */ - unsigned char nups; /* (u) number of upvalues */ - unsigned char nparams;/* (u) number of parameters */ - char isvararg; /* (u) */ - char istailcall; /* (t) */ - char short_src[LUA_IDSIZE]; /* (S) */ - /* private part */ - struct CallInfo *i_ci; /* active function */ -}; - -/* }====================================================================== */ - - -/****************************************************************************** -#ifdef _KERNEL -* Copyright (c) 2015, Lourival Vieira Neto . -#endif -* Copyright (C) 1994-2015 Lua.org, PUC-Rio. -* -* Permission is hereby granted, free of charge, to any person obtaining -* a copy of this software and associated documentation files (the -* "Software"), to deal in the Software without restriction, including -* without limitation the rights to use, copy, modify, merge, publish, -* distribute, sublicense, and/or sell copies of the Software, and to -* permit persons to whom the Software is furnished to do so, subject to -* the following conditions: -* -* The above copyright notice and this permission notice shall be -* included in all copies or substantial portions of the Software. -* -* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -******************************************************************************/ - - -#endif diff --git a/external/mit/lua/dist/src/lua.hpp b/external/mit/lua/dist/src/lua.hpp deleted file mode 100644 index ec417f594..000000000 --- a/external/mit/lua/dist/src/lua.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// lua.hpp -// Lua header files for C++ -// <> not supplied automatically because Lua also compiles as C++ - -extern "C" { -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" -} diff --git a/external/mit/lua/dist/src/luac.c b/external/mit/lua/dist/src/luac.c deleted file mode 100644 index 76b542c33..000000000 --- a/external/mit/lua/dist/src/luac.c +++ /dev/null @@ -1,451 +0,0 @@ -/* $NetBSD: luac.c,v 1.4 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp -** Lua compiler (saves bytecodes to files; also lists bytecodes) -** See Copyright Notice in lua.h -*/ - -#define luac_c -#define LUA_CORE - -#include "lprefix.h" - -#include -#include -#include -#include -#include - -#include "lua.h" -#include "lauxlib.h" - -#include "lobject.h" -#include "lstate.h" -#include "lundump.h" - -static void PrintFunction(const Proto* f, int full); -#define luaU_print PrintFunction - -#define PROGNAME "luac" /* default program name */ -#define OUTPUT PROGNAME ".out" /* default output file */ - -static int listing=0; /* list bytecodes? */ -static int dumping=1; /* dump bytecodes? */ -static int stripping=0; /* strip debug information? */ -static char Output[]={ OUTPUT }; /* default output file name */ -static const char* output=Output; /* actual output file name */ -static const char* progname=PROGNAME; /* actual program name */ - -static void fatal(const char* message) -{ - fprintf(stderr,"%s: %s\n",progname,message); - exit(EXIT_FAILURE); -} - -static void cannot(const char* what) -{ - fprintf(stderr,"%s: cannot %s %s: %s\n",progname,what,output,strerror(errno)); - exit(EXIT_FAILURE); -} - -static void usage(const char* message) -{ - if (*message=='-') - fprintf(stderr,"%s: unrecognized option '%s'\n",progname,message); - else - fprintf(stderr,"%s: %s\n",progname,message); - fprintf(stderr, - "usage: %s [options] [filenames]\n" - "Available options are:\n" - " -l list (use -l -l for full listing)\n" - " -o name output to file 'name' (default is \"%s\")\n" - " -p parse only\n" - " -s strip debug information\n" - " -v show version information\n" - " -- stop handling options\n" - " - stop handling options and process stdin\n" - ,progname,Output); - exit(EXIT_FAILURE); -} - -#define IS(s) (strcmp(argv[i],s)==0) - -static int doargs(int argc, char* argv[]) -{ - int i; - int version=0; - if (argv[0]!=NULL && *argv[0]!=0) progname=argv[0]; - for (i=1; itop+(i)) - -static const Proto* combine(lua_State* L, int n) -{ - if (n==1) - return toproto(L,-1); - else - { - Proto* f; - int i=n; - if (lua_load(L,reader,&i,"=(" PROGNAME ")",NULL)!=LUA_OK) fatal(lua_tostring(L,-1)); - f=toproto(L,-1); - for (i=0; ip[i]=toproto(L,i-n-1); - if (f->p[i]->sizeupvalues>0) f->p[i]->upvalues[0].instack=0; - } - f->sizelineinfo=0; - return f; - } -} - -static int writer(lua_State* L, const void* p, size_t size, void* u) -{ - UNUSED(L); - return (fwrite(p,size,1,(FILE*)u)!=1) && (size!=0); -} - -static int pmain(lua_State* L) -{ - int argc=(int)lua_tointeger(L,1); - char** argv=(char**)lua_touserdata(L,2); - const Proto* f; - int i; - if (!lua_checkstack(L,argc)) fatal("too many input files"); - for (i=0; i1); - if (dumping) - { - FILE* D= (output==NULL) ? stdout : fopen(output,"wb"); - if (D==NULL) cannot("open"); - lua_lock(L); - luaU_dump(L,f,writer,D,stripping); - lua_unlock(L); - if (ferror(D)) cannot("write"); - if (fclose(D)) cannot("close"); - } - return 0; -} - -int main(int argc, char* argv[]) -{ - lua_State* L; - int i=doargs(argc,argv); - argc-=i; argv+=i; - if (argc<=0) usage("no input files given"); - L=luaL_newstate(); - if (L==NULL) fatal("cannot create state: not enough memory"); - lua_pushcfunction(L,&pmain); - lua_pushinteger(L,argc); - lua_pushlightuserdata(L,argv); - if (lua_pcall(L,2,0,0)!=LUA_OK) fatal(lua_tostring(L,-1)); - lua_close(L); - return EXIT_SUCCESS; -} - -/* -** Id: luac.c,v 1.75 2015/03/12 01:58:27 lhf Exp -** print bytecodes -** See Copyright Notice in lua.h -*/ - -#include -#include - -#define luac_c -#define LUA_CORE - -#include "ldebug.h" -#include "lobject.h" -#include "lopcodes.h" - -#define VOID(p) ((const void*)(p)) - -static void PrintString(const TString* ts) -{ - const char* s=getstr(ts); - size_t i,n=tsslen(ts); - printf("%c",'"'); - for (i=0; ik[i]; - switch (ttype(o)) - { - case LUA_TNIL: - printf("nil"); - break; - case LUA_TBOOLEAN: - printf(bvalue(o) ? "true" : "false"); - break; - case LUA_TNUMFLT: - { - char buff[100]; - sprintf(buff,LUA_NUMBER_FMT,fltvalue(o)); - printf("%s",buff); - if (buff[strspn(buff,"-0123456789")]=='\0') printf(".0"); - break; - } - case LUA_TNUMINT: - printf(LUA_INTEGER_FMT,ivalue(o)); - break; - case LUA_TSHRSTR: case LUA_TLNGSTR: - PrintString(tsvalue(o)); - break; - default: /* cannot happen */ - printf("? type=%d",ttype(o)); - break; - } -} - -#define UPVALNAME(x) ((f->upvalues[x].name) ? getstr(f->upvalues[x].name) : "-") -#define MYK(x) (-1-(x)) - -static void PrintCode(const Proto* f) -{ - const Instruction* code=f->code; - int pc,n=f->sizecode; - for (pc=0; pc0) printf("[%d]\t",line); else printf("[-]\t"); - printf("%-9s\t",luaP_opnames[o]); - switch (getOpMode(o)) - { - case iABC: - printf("%d",a); - if (getBMode(o)!=OpArgN) printf(" %d",ISK(b) ? (MYK(INDEXK(b))) : b); - if (getCMode(o)!=OpArgN) printf(" %d",ISK(c) ? (MYK(INDEXK(c))) : c); - break; - case iABx: - printf("%d",a); - if (getBMode(o)==OpArgK) printf(" %d",MYK(bx)); - if (getBMode(o)==OpArgU) printf(" %d",bx); - break; - case iAsBx: - printf("%d %d",a,sbx); - break; - case iAx: - printf("%d",MYK(ax)); - break; - } - switch (o) - { - case OP_LOADK: - printf("\t; "); PrintConstant(f,bx); - break; - case OP_GETUPVAL: - case OP_SETUPVAL: - printf("\t; %s",UPVALNAME(b)); - break; - case OP_GETTABUP: - printf("\t; %s",UPVALNAME(b)); - if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } - break; - case OP_SETTABUP: - printf("\t; %s",UPVALNAME(a)); - if (ISK(b)) { printf(" "); PrintConstant(f,INDEXK(b)); } - if (ISK(c)) { printf(" "); PrintConstant(f,INDEXK(c)); } - break; - case OP_GETTABLE: - case OP_SELF: - if (ISK(c)) { printf("\t; "); PrintConstant(f,INDEXK(c)); } - break; - case OP_SETTABLE: - case OP_ADD: - case OP_SUB: - case OP_MUL: - case OP_POW: - case OP_DIV: - case OP_IDIV: - case OP_BAND: - case OP_BOR: - case OP_BXOR: - case OP_SHL: - case OP_SHR: - case OP_EQ: - case OP_LT: - case OP_LE: - if (ISK(b) || ISK(c)) - { - printf("\t; "); - if (ISK(b)) PrintConstant(f,INDEXK(b)); else printf("-"); - printf(" "); - if (ISK(c)) PrintConstant(f,INDEXK(c)); else printf("-"); - } - break; - case OP_JMP: - case OP_FORLOOP: - case OP_FORPREP: - case OP_TFORLOOP: - printf("\t; to %d",sbx+pc+2); - break; - case OP_CLOSURE: - printf("\t; %p",VOID(f->p[bx])); - break; - case OP_SETLIST: - if (c==0) printf("\t; %d",(int)code[++pc]); else printf("\t; %d",c); - break; - case OP_EXTRAARG: - printf("\t; "); PrintConstant(f,ax); - break; - default: - break; - } - printf("\n"); - } -} - -#define SS(x) ((x==1)?"":"s") -#define S(x) (int)(x),SS(x) - -static void PrintHeader(const Proto* f) -{ - const char* s=f->source ? getstr(f->source) : "=?"; - if (*s=='@' || *s=='=') - s++; - else if (*s==LUA_SIGNATURE[0]) - s="(bstring)"; - else - s="(string)"; - printf("\n%s <%s:%d,%d> (%d instruction%s at %p)\n", - (f->linedefined==0)?"main":"function",s, - f->linedefined,f->lastlinedefined, - S(f->sizecode),VOID(f)); - printf("%d%s param%s, %d slot%s, %d upvalue%s, ", - (int)(f->numparams),f->is_vararg?"+":"",SS(f->numparams), - S(f->maxstacksize),S(f->sizeupvalues)); - printf("%d local%s, %d constant%s, %d function%s\n", - S(f->sizelocvars),S(f->sizek),S(f->sizep)); -} - -static void PrintDebug(const Proto* f) -{ - int i,n; - n=f->sizek; - printf("constants (%d) for %p:\n",n,VOID(f)); - for (i=0; isizelocvars; - printf("locals (%d) for %p:\n",n,VOID(f)); - for (i=0; ilocvars[i].varname),f->locvars[i].startpc+1,f->locvars[i].endpc+1); - } - n=f->sizeupvalues; - printf("upvalues (%d) for %p:\n",n,VOID(f)); - for (i=0; iupvalues[i].instack,f->upvalues[i].idx); - } -} - -static void PrintFunction(const Proto* f, int full) -{ - int i,n=f->sizep; - PrintHeader(f); - PrintCode(f); - if (full) PrintDebug(f); - for (i=0; ip[i],full); -} diff --git a/external/mit/lua/dist/src/luaconf.h b/external/mit/lua/dist/src/luaconf.h deleted file mode 100644 index 333658423..000000000 --- a/external/mit/lua/dist/src/luaconf.h +++ /dev/null @@ -1,818 +0,0 @@ -/* $NetBSD: luaconf.h,v 1.14 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: luaconf.h,v 1.251 2015/05/20 17:39:23 roberto Exp -** Configuration file for Lua -** See Copyright Notice in lua.h -*/ - - -#ifndef luaconf_h -#define luaconf_h - -#ifndef _KERNEL -#include -#include -#else -#include -#include -#endif - - -/* -** =================================================================== -** Search for "@@" to find all configurable definitions. -** =================================================================== -*/ - - -/* -** {==================================================================== -** System Configuration: macros to adapt (if needed) Lua to some -** particular platform, for instance compiling it with 32-bit numbers or -** restricting it to C89. -** ===================================================================== -*/ - -/* -@@ LUA_32BITS enables Lua with 32-bit integers and 32-bit floats. You -** can also define LUA_32BITS in the make file, but changing here you -** ensure that all software connected to Lua will be compiled with the -** same configuration. -*/ -/* #define LUA_32BITS */ - - -/* -@@ LUA_USE_C89 controls the use of non-ISO-C89 features. -** Define it if you want Lua to avoid the use of a few C99 features -** or Windows-specific features on Windows. -*/ -/* #define LUA_USE_C89 */ - - -/* -** By default, Lua on Windows use (some) specific Windows features -*/ -#if !defined(LUA_USE_C89) && defined(_WIN32) && !defined(_WIN32_WCE) -#define LUA_USE_WINDOWS /* enable goodies for regular Windows */ -#endif - - -#if defined(LUA_USE_WINDOWS) -#define LUA_DL_DLL /* enable support for DLL */ -#define LUA_USE_C89 /* broadly, Windows is C89 */ -#endif - - -#if defined(LUA_USE_LINUX) -#define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* needs an extra library: -ldl */ -#define LUA_USE_READLINE /* needs some extra libraries */ -#endif - - -#if defined(LUA_USE_MACOSX) -#define LUA_USE_POSIX -#define LUA_USE_DLOPEN /* MacOS does not need -ldl */ -#define LUA_USE_READLINE /* needs an extra library: -lreadline */ -#endif - - -/* -@@ LUA_C89_NUMBERS ensures that Lua uses the largest types available for -** C89 ('long' and 'double'); Windows always has '__int64', so it does -** not need to use this case. -*/ -#if defined(LUA_USE_C89) && !defined(LUA_USE_WINDOWS) -#define LUA_C89_NUMBERS -#endif - - - -/* -@@ LUAI_BITSINT defines the (minimum) number of bits in an 'int'. -*/ -/* avoid undefined shifts */ -#if ((INT_MAX >> 15) >> 15) >= 1 -#define LUAI_BITSINT 32 -#else -/* 'int' always must have at least 16 bits */ -#define LUAI_BITSINT 16 -#endif - - -/* -@@ LUA_INT_TYPE defines the type for Lua integers. -@@ LUA_FLOAT_TYPE defines the type for Lua floats. -** Lua should work fine with any mix of these options (if supported -** by your C compiler). The usual configurations are 64-bit integers -** and 'double' (the default), 32-bit integers and 'float' (for -** restricted platforms), and 'long'/'double' (for C compilers not -** compliant with C99, which may not have support for 'long long'). -*/ - -/* predefined options for LUA_INT_TYPE */ -#define LUA_INT_INT 1 -#define LUA_INT_LONG 2 -#define LUA_INT_LONGLONG 3 - -/* predefined options for LUA_FLOAT_TYPE */ -#define LUA_FLOAT_FLOAT 1 -#define LUA_FLOAT_DOUBLE 2 -#define LUA_FLOAT_LONGDOUBLE 3 - -#if defined(LUA_32BITS) /* { */ -/* -** 32-bit integers and 'float' -*/ -#if LUAI_BITSINT >= 32 /* use 'int' if big enough */ -#define LUA_INT_TYPE LUA_INT_INT -#else /* otherwise use 'long' */ -#define LUA_INT_TYPE LUA_INT_LONG -#endif -#define LUA_FLOAT_TYPE LUA_FLOAT_FLOAT - -#elif defined(LUA_C89_NUMBERS) /* }{ */ -/* -** largest types available for C89 ('long' and 'double') -*/ -#define LUA_INT_TYPE LUA_INT_LONG -#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE - -#endif /* } */ - - -/* -** default configuration for 64-bit Lua ('long long' and 'double') -*/ -#if !defined(LUA_INT_TYPE) -#define LUA_INT_TYPE LUA_INT_LONGLONG -#endif - -#if !defined(LUA_FLOAT_TYPE) -#define LUA_FLOAT_TYPE LUA_FLOAT_DOUBLE -#endif /* } */ - -/* }================================================================== */ - - - - -/* -** {================================================================== -** Configuration for Paths. -** =================================================================== -*/ - -/* -@@ LUA_PATH_DEFAULT is the default path that Lua uses to look for -** Lua libraries. -@@ LUA_CPATH_DEFAULT is the default path that Lua uses to look for -** C libraries. -** CHANGE them if your machine has a non-conventional directory -** hierarchy or if you want to install your libraries in -** non-conventional directories. -*/ -#define LUA_VDIR LUA_VERSION_MAJOR "." LUA_VERSION_MINOR -#if defined(_WIN32) /* { */ -/* -** In Windows, any exclamation mark ('!') in the path is replaced by the -** path of the directory of the executable file of the current process. -*/ -#define LUA_LDIR "!\\lua\\" -#define LUA_CDIR "!\\" -#define LUA_SHRDIR "!\\..\\share\\lua\\" LUA_VDIR "\\" -#define LUA_PATH_DEFAULT \ - LUA_LDIR"?.lua;" LUA_LDIR"?\\init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?\\init.lua;" \ - LUA_SHRDIR"?.lua;" LUA_SHRDIR"?\\init.lua;" \ - ".\\?.lua;" ".\\?\\init.lua" -#define LUA_CPATH_DEFAULT \ - LUA_CDIR"?.dll;" \ - LUA_CDIR"..\\lib\\lua\\" LUA_VDIR "\\?.dll;" \ - LUA_CDIR"loadall.dll;" ".\\?.dll" - -#else /* }{ */ - -#define LUA_ROOT "/usr/local/" -#define LUA_LDIR LUA_ROOT "share/lua/" LUA_VDIR "/" -#define LUA_CDIR LUA_ROOT "lib/lua/" LUA_VDIR "/" -#define LUA_PATH_DEFAULT \ - LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua;" \ - "./?.lua;" "./?/init.lua" -#define LUA_CPATH_DEFAULT \ - LUA_CDIR"?.so;" LUA_CDIR"loadall.so;" "./?.so" -#endif /* } */ - - -/* -@@ LUA_DIRSEP is the directory separator (for submodules). -** CHANGE it if your machine does not use "/" as the directory separator -** and is not Windows. (On Windows Lua automatically uses "\".) -*/ -#if defined(_WIN32) -#define LUA_DIRSEP "\\" -#else -#define LUA_DIRSEP "/" -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Marks for exported symbols in the C code -** =================================================================== -*/ - -/* -@@ LUA_API is a mark for all core API functions. -@@ LUALIB_API is a mark for all auxiliary library functions. -@@ LUAMOD_API is a mark for all standard library opening functions. -** CHANGE them if you need to define those functions in some special way. -** For instance, if you want to create one Windows DLL with the core and -** the libraries, you may want to use the following definition (define -** LUA_BUILD_AS_DLL to get it). -*/ -#if defined(LUA_BUILD_AS_DLL) /* { */ - -#if defined(LUA_CORE) || defined(LUA_LIB) /* { */ -#define LUA_API __declspec(dllexport) -#else /* }{ */ -#define LUA_API __declspec(dllimport) -#endif /* } */ - -#else /* }{ */ - -#define LUA_API extern - -#endif /* } */ - - -/* more often than not the libs go together with the core */ -#define LUALIB_API LUA_API -#define LUAMOD_API LUALIB_API - - -/* -@@ LUAI_FUNC is a mark for all extern functions that are not to be -** exported to outside modules. -@@ LUAI_DDEF and LUAI_DDEC are marks for all extern (const) variables -** that are not to be exported to outside modules (LUAI_DDEF for -** definitions and LUAI_DDEC for declarations). -** CHANGE them if you need to mark them in some special way. Elf/gcc -** (versions 3.2 and later) mark them as "hidden" to optimize access -** when Lua is compiled as a shared library. Not all elf targets support -** this attribute. Unfortunately, gcc does not offer a way to check -** whether the target offers that support, and those without support -** give a warning about it. To avoid these warnings, change to the -** default definition. -*/ -#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 302) && \ - defined(__ELF__) /* { */ -#define LUAI_FUNC __attribute__((visibility("hidden"))) extern -#else /* }{ */ -#define LUAI_FUNC extern -#endif /* } */ - -#define LUAI_DDEC LUAI_FUNC -#define LUAI_DDEF /* empty */ - -/* }================================================================== */ - - -/* -** {================================================================== -** Compatibility with previous versions -** =================================================================== -*/ - -/* -@@ LUA_COMPAT_5_2 controls other macros for compatibility with Lua 5.2. -@@ LUA_COMPAT_5_1 controls other macros for compatibility with Lua 5.1. -** You can define it to get all options, or change specific options -** to fit your specific needs. -*/ -#if defined(LUA_COMPAT_5_2) /* { */ - -/* -@@ LUA_COMPAT_MATHLIB controls the presence of several deprecated -** functions in the mathematical library. -*/ -#define LUA_COMPAT_MATHLIB - -/* -@@ LUA_COMPAT_BITLIB controls the presence of library 'bit32'. -*/ -#define LUA_COMPAT_BITLIB - -/* -@@ LUA_COMPAT_IPAIRS controls the effectiveness of the __ipairs metamethod. -*/ -#define LUA_COMPAT_IPAIRS - -/* -@@ LUA_COMPAT_APIINTCASTS controls the presence of macros for -** manipulating other integer types (lua_pushunsigned, lua_tounsigned, -** luaL_checkint, luaL_checklong, etc.) -*/ -#define LUA_COMPAT_APIINTCASTS - -#endif /* } */ - - -#if defined(LUA_COMPAT_5_1) /* { */ - -/* Incompatibilities from 5.2 -> 5.3 */ -#define LUA_COMPAT_MATHLIB -#define LUA_COMPAT_APIINTCASTS - -/* -@@ LUA_COMPAT_UNPACK controls the presence of global 'unpack'. -** You can replace it with 'table.unpack'. -*/ -#define LUA_COMPAT_UNPACK - -/* -@@ LUA_COMPAT_LOADERS controls the presence of table 'package.loaders'. -** You can replace it with 'package.searchers'. -*/ -#define LUA_COMPAT_LOADERS - -/* -@@ macro 'lua_cpcall' emulates deprecated function lua_cpcall. -** You can call your C function directly (with light C functions). -*/ -#define lua_cpcall(L,f,u) \ - (lua_pushcfunction(L, (f)), \ - lua_pushlightuserdata(L,(u)), \ - lua_pcall(L,1,0,0)) - - -/* -@@ LUA_COMPAT_LOG10 defines the function 'log10' in the math library. -** You can rewrite 'log10(x)' as 'log(x, 10)'. -*/ -#define LUA_COMPAT_LOG10 - -/* -@@ LUA_COMPAT_LOADSTRING defines the function 'loadstring' in the base -** library. You can rewrite 'loadstring(s)' as 'load(s)'. -*/ -#define LUA_COMPAT_LOADSTRING - -/* -@@ LUA_COMPAT_MAXN defines the function 'maxn' in the table library. -*/ -#define LUA_COMPAT_MAXN - -/* -@@ The following macros supply trivial compatibility for some -** changes in the API. The macros themselves document how to -** change your code to avoid using them. -*/ -#define lua_strlen(L,i) lua_rawlen(L, (i)) - -#define lua_objlen(L,i) lua_rawlen(L, (i)) - -#define lua_equal(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPEQ) -#define lua_lessthan(L,idx1,idx2) lua_compare(L,(idx1),(idx2),LUA_OPLT) - -/* -@@ LUA_COMPAT_MODULE controls compatibility with previous -** module functions 'module' (Lua) and 'luaL_register' (C). -*/ -#define LUA_COMPAT_MODULE - -#endif /* } */ - - -/* -@@ LUA_COMPAT_FLOATSTRING makes Lua format integral floats without a -@@ a float mark ('.0'). -** This macro is not on by default even in compatibility mode, -** because this is not really an incompatibility. -*/ -/* #define LUA_COMPAT_FLOATSTRING */ - -/* }================================================================== */ - - - -/* -** {================================================================== -** Configuration for Numbers. -** Change these definitions if no predefined LUA_FLOAT_* / LUA_INT_* -** satisfy your needs. -** =================================================================== -*/ - -#ifndef _KERNEL -/* -@@ LUA_NUMBER is the floating-point type used by Lua. -@@ LUAI_UACNUMBER is the result of an 'usual argument conversion' -@@ over a floating number. -@@ l_mathlim(x) corrects limit name 'x' to the proper float type -** by prefixing it with one of FLT/DBL/LDBL. -@@ LUA_NUMBER_FRMLEN is the length modifier for writing floats. -@@ LUA_NUMBER_FMT is the format for writing floats. -@@ lua_number2str converts a float to a string. -@@ l_mathop allows the addition of an 'l' or 'f' to all math operations. -@@ lua_str2number converts a decimal numeric string to a number. -*/ - -#if LUA_FLOAT_TYPE == LUA_FLOAT_FLOAT /* { single float */ - -#define LUA_NUMBER float - -#define l_mathlim(n) (FLT_##n) - -#define LUAI_UACNUMBER double - -#define LUA_NUMBER_FRMLEN "" -#define LUA_NUMBER_FMT "%.7g" - -#define l_mathop(op) op##f - -#define lua_str2number(s,p) strtof((s), (p)) - - -#elif LUA_FLOAT_TYPE == LUA_FLOAT_LONGDOUBLE /* }{ long double */ - -#define LUA_NUMBER long double - -#define l_mathlim(n) (LDBL_##n) - -#define LUAI_UACNUMBER long double - -#define LUA_NUMBER_FRMLEN "L" -#define LUA_NUMBER_FMT "%.19Lg" - -#define l_mathop(op) op##l - -#define lua_str2number(s,p) strtold((s), (p)) - -#elif LUA_FLOAT_TYPE == LUA_FLOAT_DOUBLE /* }{ double */ - -#define LUA_NUMBER double - -#define l_mathlim(n) (DBL_##n) - -#define LUAI_UACNUMBER double - -#define LUA_NUMBER_FRMLEN "" -#define LUA_NUMBER_FMT "%.14g" - -#define l_mathop(op) op - -#define lua_str2number(s,p) strtod((s), (p)) - -#else /* }{ */ - -#error "numeric float type not defined" - -#endif /* } */ - - -#define l_floor(x) (l_mathop(floor)(x)) - -#define lua_number2str(s,n) sprintf((s), LUA_NUMBER_FMT, (n)) - - -/* -@@ lua_numbertointeger converts a float number to an integer, or -** returns 0 if float is not within the range of a lua_Integer. -** (The range comparisons are tricky because of rounding. The tests -** here assume a two-complement representation, where MININTEGER always -** has an exact representation as a float; MAXINTEGER may not have one, -** and therefore its conversion to float may have an ill-defined value.) -*/ -#define lua_numbertointeger(n,p) \ - ((n) >= (LUA_NUMBER)(LUA_MININTEGER) && \ - (n) < -(LUA_NUMBER)(LUA_MININTEGER) && \ - (*(p) = (LUA_INTEGER)(n), 1)) - -#endif /*_KERNEL */ - - -/* -@@ LUA_INTEGER is the integer type used by Lua. -** -@@ LUA_UNSIGNED is the unsigned version of LUA_INTEGER. -** -@@ LUAI_UACINT is the result of an 'usual argument conversion' -@@ over a lUA_INTEGER. -@@ LUA_INTEGER_FRMLEN is the length modifier for reading/writing integers. -@@ LUA_INTEGER_FMT is the format for writing integers. -@@ LUA_MAXINTEGER is the maximum value for a LUA_INTEGER. -@@ LUA_MININTEGER is the minimum value for a LUA_INTEGER. -@@ lua_integer2str converts an integer to a string. -*/ - - -/* The following definitions are good for most cases here */ - -#define LUA_INTEGER_FMT "%" LUA_INTEGER_FRMLEN "d" -#define lua_integer2str(s,n) sprintf((s), LUA_INTEGER_FMT, (n)) - -#define LUAI_UACINT LUA_INTEGER - -/* -** use LUAI_UACINT here to avoid problems with promotions (which -** can turn a comparison between unsigneds into a signed comparison) -*/ -#define LUA_UNSIGNED unsigned LUAI_UACINT - - -/* now the variable definitions */ - -#if LUA_INT_TYPE == LUA_INT_INT /* { int */ - -#define LUA_INTEGER int -#define LUA_INTEGER_FRMLEN "" - -#define LUA_MAXINTEGER INT_MAX -#define LUA_MININTEGER INT_MIN - -#elif LUA_INT_TYPE == LUA_INT_LONG /* }{ long */ - -#define LUA_INTEGER long -#define LUA_INTEGER_FRMLEN "l" - -#define LUA_MAXINTEGER LONG_MAX -#define LUA_MININTEGER LONG_MIN - -#elif LUA_INT_TYPE == LUA_INT_LONGLONG /* }{ long long */ - -#if defined(LLONG_MAX) /* { */ -/* use ISO C99 stuff */ - -#define LUA_INTEGER long long -#define LUA_INTEGER_FRMLEN "ll" - -#define LUA_MAXINTEGER LLONG_MAX -#define LUA_MININTEGER LLONG_MIN - -#elif defined(LUA_USE_WINDOWS) /* }{ */ -/* in Windows, can use specific Windows types */ - -#define LUA_INTEGER __int64 -#define LUA_INTEGER_FRMLEN "I64" - -#define LUA_MAXINTEGER _I64_MAX -#define LUA_MININTEGER _I64_MIN - -#else /* }{ */ - -#error "Compiler does not support 'long long'. Use option '-DLUA_32BITS' \ - or '-DLUA_C89_NUMBERS' (see file 'luaconf.h' for details)" - -#endif /* } */ - -#else /* }{ */ - -#error "numeric integer type not defined" - -#endif /* } */ - -/* }================================================================== */ - - -/* -** {================================================================== -** Dependencies with C99 and other C details -** =================================================================== -*/ - -/* -@@ lua_strx2number converts an hexadecimal numeric string to a number. -** In C99, 'strtod' does that conversion. Otherwise, you can -** leave 'lua_strx2number' undefined and Lua will provide its own -** implementation. -*/ -#if !defined(LUA_USE_C89) -#define lua_strx2number(s,p) lua_str2number(s,p) -#endif - - -/* -@@ lua_number2strx converts a float to an hexadecimal numeric string. -** In C99, 'sprintf' (with format specifiers '%a'/'%A') does that. -** Otherwise, you can leave 'lua_number2strx' undefined and Lua will -** provide its own implementation. -*/ -#if !defined(LUA_USE_C89) -#define lua_number2strx(L,b,f,n) sprintf(b,f,n) -#endif - - -/* -** 'strtof' and 'opf' variants for math functions are not valid in -** C89. Otherwise, the macro 'HUGE_VALF' is a good proxy for testing the -** availability of these variants. ('math.h' is already included in -** all files that use these macros.) -*/ -#if defined(LUA_USE_C89) || (defined(HUGE_VAL) && !defined(HUGE_VALF)) -#undef l_mathop /* variants not available */ -#undef lua_str2number -#define l_mathop(op) (lua_Number)op /* no variant */ -#define lua_str2number(s,p) ((lua_Number)strtod((s), (p))) -#endif - - -/* -@@ LUA_KCONTEXT is the type of the context ('ctx') for continuation -** functions. It must be a numerical type; Lua will use 'intptr_t' if -** available, otherwise it will use 'ptrdiff_t' (the nearest thing to -** 'intptr_t' in C89) -*/ -#define LUA_KCONTEXT ptrdiff_t - -#if !defined(LUA_USE_C89) && defined(__STDC_VERSION__) && \ - __STDC_VERSION__ >= 199901L -#include -#if defined(INTPTR_MAX) /* even in C99 this type is optional */ -#undef LUA_KCONTEXT -#define LUA_KCONTEXT intptr_t -#endif -#endif - - -/* -@@ lua_getlocaledecpoint gets the locale "radix character" (decimal point). -** Change that if you do not want to use C locales. (Code using this -** macro must include header 'locale.h'.) -*/ -#if !defined(lua_getlocaledecpoint) -#define lua_getlocaledecpoint() (localeconv()->decimal_point[0]) -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Language Variations -** ===================================================================== -*/ - -/* -@@ LUA_NOCVTN2S/LUA_NOCVTS2N control how Lua performs some -** coercions. Define LUA_NOCVTN2S to turn off automatic coercion from -** numbers to strings. Define LUA_NOCVTS2N to turn off automatic -** coercion from strings to numbers. -*/ -/* #define LUA_NOCVTN2S */ -/* #define LUA_NOCVTS2N */ - - -/* -@@ LUA_USE_APICHECK turns on several consistency checks on the C API. -** Define it as a help when debugging C code. -*/ -#if defined(LUA_USE_APICHECK) -#include -#define luai_apicheck(l,e) assert(e) -#endif - -/* }================================================================== */ - - -/* -** {================================================================== -** Macros that affect the API and must be stable (that is, must be the -** same when you compile Lua and when you compile code that links to -** Lua). You probably do not want/need to change them. -** ===================================================================== -*/ - -/* -@@ LUAI_MAXSTACK limits the size of the Lua stack. -** CHANGE it if you need a different limit. This limit is arbitrary; -** its only purpose is to stop Lua from consuming unlimited stack -** space (and to reserve some numbers for pseudo-indices). -*/ -#if LUAI_BITSINT >= 32 -#define LUAI_MAXSTACK 1000000 -#else -#define LUAI_MAXSTACK 15000 -#endif - - -/* -@@ LUA_EXTRASPACE defines the size of a raw memory area associated with -** a Lua state with very fast access. -** CHANGE it if you need a different size. -*/ -#define LUA_EXTRASPACE (sizeof(void *)) - - -/* -@@ LUA_IDSIZE gives the maximum size for the description of the source -@@ of a function in debug information. -** CHANGE it if you want a different size. -*/ -#define LUA_IDSIZE 60 - - -/* -@@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system. -** CHANGE it if it uses too much C-stack space. (For long double, -** 'string.format("%.99f", 1e4932)' needs ~5030 bytes, so a -** smaller buffer would force a memory allocation for each call to -** 'string.format'.) -*/ -#if defined(LUA_FLOAT_LONGDOUBLE) -#define LUAL_BUFFERSIZE 8192 -#else -#define LUAL_BUFFERSIZE ((int)(0x80 * sizeof(void*) * sizeof(lua_Integer))) -#endif - -/* }================================================================== */ - - -/* -@@ LUA_QL describes how error messages quote program elements. -** Lua does not use these macros anymore; they are here for -** compatibility only. -*/ -#define LUA_QL(x) "'" x "'" -#define LUA_QS LUA_QL("%s") - - - - -/* =================================================================== */ - -/* -** Local configuration. You can use this space to add your redefinitions -** without modifying the main part of the file. -*/ - -#if defined(__NetBSD__) || defined(__minix) - -/* Integer types */ -#undef LUA_INTEGER -#undef LUA_INTEGER_FRMLEN -#undef LUA_UNSIGNED -#undef LUA_MAXUNSIGNED -#undef LUA_MAXINTEGER -#undef LUA_MININTEGER - -#define LUA_INTEGER intmax_t -#define LUA_INTEGER_FRMLEN "j" -#define LUA_UNSIGNED uintmax_t -#define LUA_MAXUNSIGNED UINTMAX_MAX -#define LUA_MAXINTEGER INTMAX_MAX -#define LUA_MININTEGER INTMAX_MIN - -/* Path */ -#undef LUA_ROOT -#undef LUA_PATH_DEFAULT -#undef LUA_CPATH_DEFAULT - -#define LUA_ROOT "/usr/" -#define LUA_PATH_DEFAULT \ - LUA_LDIR"?.lua;" LUA_LDIR"?/init.lua;" \ - LUA_CDIR"?.lua;" LUA_CDIR"?/init.lua" -#define LUA_CPATH_DEFAULT \ - LUA_CDIR"?.so;" LUA_CDIR"loadall.so" - -#ifndef _KERNEL - -#include - -#else /* _KERNEL */ - -#define LUA_NUMBER LUA_INTEGER -#define LUA_NUMBER_FMT LUA_INTEGER_FMT - -/* setjmp.h */ -#define LUAI_THROW(L,c) longjmp(&((c)->b)) -#define LUAI_TRY(L,c,a) if (setjmp(&((c)->b)) == 0) { a } -#define luai_jmpbuf label_t - -/* time.h */ -#include -#define time(p) (time_uptime) - -/* stdio.h */ -#define lua_writestring(s,l) printf("%s", (s)) -#define lua_writeline() printf("\n") - -#define sprintf(s,fmt,...) snprintf(s, sizeof(s), fmt, __VA_ARGS__) - -/* string.h */ -#define strcoll strcmp - -/* stdlib.h */ -#define abort() panic("Lua has aborted!") - -#endif /* _KERNEL */ - -#endif /* __NetBSD__ || __minix */ - -#endif - diff --git a/external/mit/lua/dist/src/lualib.h b/external/mit/lua/dist/src/lualib.h deleted file mode 100644 index 644f80d9e..000000000 --- a/external/mit/lua/dist/src/lualib.h +++ /dev/null @@ -1,60 +0,0 @@ -/* $NetBSD: lualib.h,v 1.2 2014/07/19 18:38:34 lneto Exp $ */ - -/* -** $Id: lualib.h,v 1.2 2014/07/19 18:38:34 lneto Exp $ -** Lua standard libraries -** See Copyright Notice in lua.h -*/ - - -#ifndef lualib_h -#define lualib_h - -#include "lua.h" - - - -LUAMOD_API int (luaopen_base) (lua_State *L); - -#define LUA_COLIBNAME "coroutine" -LUAMOD_API int (luaopen_coroutine) (lua_State *L); - -#define LUA_TABLIBNAME "table" -LUAMOD_API int (luaopen_table) (lua_State *L); - -#define LUA_IOLIBNAME "io" -LUAMOD_API int (luaopen_io) (lua_State *L); - -#define LUA_OSLIBNAME "os" -LUAMOD_API int (luaopen_os) (lua_State *L); - -#define LUA_STRLIBNAME "string" -LUAMOD_API int (luaopen_string) (lua_State *L); - -#define LUA_UTF8LIBNAME "utf8" -LUAMOD_API int (luaopen_utf8) (lua_State *L); - -#define LUA_BITLIBNAME "bit32" -LUAMOD_API int (luaopen_bit32) (lua_State *L); - -#define LUA_MATHLIBNAME "math" -LUAMOD_API int (luaopen_math) (lua_State *L); - -#define LUA_DBLIBNAME "debug" -LUAMOD_API int (luaopen_debug) (lua_State *L); - -#define LUA_LOADLIBNAME "package" -LUAMOD_API int (luaopen_package) (lua_State *L); - - -/* open all previous libraries */ -LUALIB_API void (luaL_openlibs) (lua_State *L); - - - -#if !defined(lua_assert) -#define lua_assert(x) ((void)0) -#endif - - -#endif diff --git a/external/mit/lua/dist/src/lundump.c b/external/mit/lua/dist/src/lundump.c deleted file mode 100644 index a20f1d389..000000000 --- a/external/mit/lua/dist/src/lundump.c +++ /dev/null @@ -1,283 +0,0 @@ -/* $NetBSD: lundump.c,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lundump.c,v 2.41 2014/11/02 19:19:04 roberto Exp -** load precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#define lundump_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lmem.h" -#include "lobject.h" -#include "lstring.h" -#include "lundump.h" -#include "lzio.h" - - -#if !defined(luai_verifycode) -#define luai_verifycode(L,b,f) /* empty */ -#endif - - -typedef struct { - lua_State *L; - ZIO *Z; - Mbuffer *b; - const char *name; -} LoadState; - - -static l_noret error(LoadState *S, const char *why) { - luaO_pushfstring(S->L, "%s: %s precompiled chunk", S->name, why); - luaD_throw(S->L, LUA_ERRSYNTAX); -} - - -/* -** All high-level loads go through LoadVector; you can change it to -** adapt to the endianness of the input -*/ -#define LoadVector(S,b,n) LoadBlock(S,b,(n)*sizeof((b)[0])) - -static void LoadBlock (LoadState *S, void *b, size_t size) { - if (luaZ_read(S->Z, b, size) != 0) - error(S, "truncated"); -} - - -#define LoadVar(S,x) LoadVector(S,&x,1) - - -static lu_byte LoadByte (LoadState *S) { - lu_byte x; - LoadVar(S, x); - return x; -} - - -static int LoadInt (LoadState *S) { - int x; - LoadVar(S, x); - return x; -} - - -static lua_Number LoadNumber (LoadState *S) { - lua_Number x; - LoadVar(S, x); - return x; -} - - -static lua_Integer LoadInteger (LoadState *S) { - lua_Integer x; - LoadVar(S, x); - return x; -} - - -static TString *LoadString (LoadState *S) { - size_t size = LoadByte(S); - if (size == 0xFF) - LoadVar(S, size); - if (size == 0) - return NULL; - else { - char *s = luaZ_openspace(S->L, S->b, --size); - LoadVector(S, s, size); - return luaS_newlstr(S->L, s, size); - } -} - - -static void LoadCode (LoadState *S, Proto *f) { - int n = LoadInt(S); - f->code = luaM_newvector(S->L, n, Instruction); - f->sizecode = n; - LoadVector(S, f->code, n); -} - - -static void LoadFunction(LoadState *S, Proto *f, TString *psource); - - -static void LoadConstants (LoadState *S, Proto *f) { - int i; - int n = LoadInt(S); - f->k = luaM_newvector(S->L, n, TValue); - f->sizek = n; - for (i = 0; i < n; i++) - setnilvalue(&f->k[i]); - for (i = 0; i < n; i++) { - TValue *o = &f->k[i]; - int t = LoadByte(S); - switch (t) { - case LUA_TNIL: - setnilvalue(o); - break; - case LUA_TBOOLEAN: - setbvalue(o, LoadByte(S)); - break; -#ifndef _KERNEL - case LUA_TNUMFLT: - setfltvalue(o, LoadNumber(S)); - break; -#endif - case LUA_TNUMINT: - setivalue(o, LoadInteger(S)); - break; - case LUA_TSHRSTR: - case LUA_TLNGSTR: - setsvalue2n(S->L, o, LoadString(S)); - break; - default: - lua_assert(0); - } - } -} - - -static void LoadProtos (LoadState *S, Proto *f) { - int i; - int n = LoadInt(S); - f->p = luaM_newvector(S->L, n, Proto *); - f->sizep = n; - for (i = 0; i < n; i++) - f->p[i] = NULL; - for (i = 0; i < n; i++) { - f->p[i] = luaF_newproto(S->L); - LoadFunction(S, f->p[i], f->source); - } -} - - -static void LoadUpvalues (LoadState *S, Proto *f) { - int i, n; - n = LoadInt(S); - f->upvalues = luaM_newvector(S->L, n, Upvaldesc); - f->sizeupvalues = n; - for (i = 0; i < n; i++) - f->upvalues[i].name = NULL; - for (i = 0; i < n; i++) { - f->upvalues[i].instack = LoadByte(S); - f->upvalues[i].idx = LoadByte(S); - } -} - - -static void LoadDebug (LoadState *S, Proto *f) { - int i, n; - n = LoadInt(S); - f->lineinfo = luaM_newvector(S->L, n, int); - f->sizelineinfo = n; - LoadVector(S, f->lineinfo, n); - n = LoadInt(S); - f->locvars = luaM_newvector(S->L, n, LocVar); - f->sizelocvars = n; - for (i = 0; i < n; i++) - f->locvars[i].varname = NULL; - for (i = 0; i < n; i++) { - f->locvars[i].varname = LoadString(S); - f->locvars[i].startpc = LoadInt(S); - f->locvars[i].endpc = LoadInt(S); - } - n = LoadInt(S); - for (i = 0; i < n; i++) - f->upvalues[i].name = LoadString(S); -} - - -static void LoadFunction (LoadState *S, Proto *f, TString *psource) { - f->source = LoadString(S); - if (f->source == NULL) /* no source in dump? */ - f->source = psource; /* reuse parent's source */ - f->linedefined = LoadInt(S); - f->lastlinedefined = LoadInt(S); - f->numparams = LoadByte(S); - f->is_vararg = LoadByte(S); - f->maxstacksize = LoadByte(S); - LoadCode(S, f); - LoadConstants(S, f); - LoadUpvalues(S, f); - LoadProtos(S, f); - LoadDebug(S, f); -} - - -static void checkliteral (LoadState *S, const char *s, const char *msg) { - char buff[sizeof(LUA_SIGNATURE) + sizeof(LUAC_DATA)]; /* larger than both */ - size_t len = strlen(s); - LoadVector(S, buff, len); - if (memcmp(s, buff, len) != 0) - error(S, msg); -} - - -static void fchecksize (LoadState *S, size_t size, const char *tname) { - if (LoadByte(S) != size) - error(S, luaO_pushfstring(S->L, "%s size mismatch in", tname)); -} - - -#define checksize(S,t) fchecksize(S,sizeof(t),#t) - -static void checkHeader (LoadState *S) { - checkliteral(S, LUA_SIGNATURE + 1, "not a"); /* 1st char already checked */ - if (LoadByte(S) != LUAC_VERSION) - error(S, "version mismatch in"); - if (LoadByte(S) != LUAC_FORMAT) - error(S, "format mismatch in"); - checkliteral(S, LUAC_DATA, "corrupted"); - checksize(S, int); - checksize(S, size_t); - checksize(S, Instruction); - checksize(S, lua_Integer); - checksize(S, lua_Number); - if (LoadInteger(S) != LUAC_INT) - error(S, "endianness mismatch in"); - if (LoadNumber(S) != LUAC_NUM) - error(S, "float format mismatch in"); -} - - -/* -** load precompiled chunk -*/ -LClosure *luaU_undump(lua_State *L, ZIO *Z, Mbuffer *buff, - const char *name) { - LoadState S; - LClosure *cl; - if (*name == '@' || *name == '=') - S.name = name + 1; - else if (*name == LUA_SIGNATURE[0]) - S.name = "binary string"; - else - S.name = name; - S.L = L; - S.Z = Z; - S.b = buff; - checkHeader(&S); - cl = luaF_newLclosure(L, LoadByte(&S)); - setclLvalue(L, L->top, cl); - incr_top(L); - cl->p = luaF_newproto(L); - LoadFunction(&S, cl->p, NULL); - lua_assert(cl->nupvalues == cl->p->sizeupvalues); - luai_verifycode(L, buff, cl->p); - return cl; -} - diff --git a/external/mit/lua/dist/src/lundump.h b/external/mit/lua/dist/src/lundump.h deleted file mode 100644 index e67d2b62c..000000000 --- a/external/mit/lua/dist/src/lundump.h +++ /dev/null @@ -1,35 +0,0 @@ -/* $NetBSD: lundump.h,v 1.2 2014/07/19 18:38:34 lneto Exp $ */ - -/* -** $Id: lundump.h,v 1.2 2014/07/19 18:38:34 lneto Exp $ -** load precompiled Lua chunks -** See Copyright Notice in lua.h -*/ - -#ifndef lundump_h -#define lundump_h - -#include "llimits.h" -#include "lobject.h" -#include "lzio.h" - - -/* data to catch conversion errors */ -#define LUAC_DATA "\x19\x93\r\n\x1a\n" - -#define LUAC_INT 0x5678 -#define LUAC_NUM cast_num(370.5) - -#define MYINT(s) (s[0]-'0') -#define LUAC_VERSION (MYINT(LUA_VERSION_MAJOR)*16+MYINT(LUA_VERSION_MINOR)) -#define LUAC_FORMAT 0 /* this is the official format */ - -/* load one chunk; from lundump.c */ -LUAI_FUNC LClosure* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, - const char* name); - -/* dump one chunk; from ldump.c */ -LUAI_FUNC int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, - void* data, int strip); - -#endif diff --git a/external/mit/lua/dist/src/lutf8lib.c b/external/mit/lua/dist/src/lutf8lib.c deleted file mode 100644 index 2ae133eb2..000000000 --- a/external/mit/lua/dist/src/lutf8lib.c +++ /dev/null @@ -1,260 +0,0 @@ -/* $NetBSD: lutf8lib.c,v 1.3 2015/10/08 13:21:00 mbalmer Exp $ */ - -/* -** Id: lutf8lib.c,v 1.15 2015/03/28 19:16:55 roberto Exp -** Standard library for UTF-8 manipulation -** See Copyright Notice in lua.h -*/ - -#define lutf8lib_c -#define LUA_LIB - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#include -#include -#include -#endif - -#include "lua.h" - -#include "lauxlib.h" -#include "lualib.h" - -#define MAXUNICODE 0x10FFFF - -#define iscont(p) ((*(p) & 0xC0) == 0x80) - - -/* from strlib */ -/* translate a relative string position: negative means back from end */ -static lua_Integer u_posrelat (lua_Integer pos, size_t len) { - if (pos >= 0) return pos; - else if (0u - (size_t)pos > len) return 0; - else return (lua_Integer)len + pos + 1; -} - - -/* -** Decode one UTF-8 sequence, returning NULL if byte sequence is invalid. -*/ -static const char *utf8_decode (const char *o, int *val) { - static const unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF}; - const unsigned char *s = (const unsigned char *)o; - unsigned int c = s[0]; - unsigned int res = 0; /* final result */ - if (c < 0x80) /* ascii? */ - res = c; - else { - int count = 0; /* to count number of continuation bytes */ - while (c & 0x40) { /* still have continuation bytes? */ - int cc = s[++count]; /* read next byte */ - if ((cc & 0xC0) != 0x80) /* not a continuation byte? */ - return NULL; /* invalid byte sequence */ - res = (res << 6) | (cc & 0x3F); /* add lower 6 bits from cont. byte */ - c <<= 1; /* to test next bit */ - } - res |= ((c & 0x7F) << (count * 5)); /* add first byte */ - if (count > 3 || res > MAXUNICODE || res <= limits[count]) - return NULL; /* invalid byte sequence */ - s += count; /* skip continuation bytes read */ - } - if (val) *val = res; - return (const char *)s + 1; /* +1 to include first byte */ -} - - -/* -** utf8len(s [, i [, j]]) --> number of characters that start in the -** range [i,j], or nil + current position if 's' is not well formed in -** that interval -*/ -static int utflen (lua_State *L) { - int n = 0; - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); - lua_Integer posj = u_posrelat(luaL_optinteger(L, 3, -1), len); - luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 2, - "initial position out of string"); - luaL_argcheck(L, --posj < (lua_Integer)len, 3, - "final position out of string"); - while (posi <= posj) { - const char *s1 = utf8_decode(s + posi, NULL); - if (s1 == NULL) { /* conversion error? */ - lua_pushnil(L); /* return nil ... */ - lua_pushinteger(L, posi + 1); /* ... and current position */ - return 2; - } - posi = s1 - s; - n++; - } - lua_pushinteger(L, n); - return 1; -} - - -/* -** codepoint(s, [i, [j]]) -> returns codepoints for all characters -** that start in the range [i,j] -*/ -static int codepoint (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer posi = u_posrelat(luaL_optinteger(L, 2, 1), len); - lua_Integer pose = u_posrelat(luaL_optinteger(L, 3, posi), len); - int n; - const char *se; - luaL_argcheck(L, posi >= 1, 2, "out of range"); - luaL_argcheck(L, pose <= (lua_Integer)len, 3, "out of range"); - if (posi > pose) return 0; /* empty interval; return no values */ - if (pose - posi >= INT_MAX) /* (lua_Integer -> int) overflow? */ - return luaL_error(L, "string slice too long"); - n = (int)(pose - posi) + 1; - luaL_checkstack(L, n, "string slice too long"); - n = 0; - se = s + pose; - for (s += posi - 1; s < se;) { - int code; - s = utf8_decode(s, &code); - if (s == NULL) - return luaL_error(L, "invalid UTF-8 code"); - lua_pushinteger(L, code); - n++; - } - return n; -} - - -static void pushutfchar (lua_State *L, int arg) { - lua_Integer code = luaL_checkinteger(L, arg); - luaL_argcheck(L, 0 <= code && code <= MAXUNICODE, arg, "value out of range"); - lua_pushfstring(L, "%U", (long)code); -} - - -/* -** utfchar(n1, n2, ...) -> char(n1)..char(n2)... -*/ -static int utfchar (lua_State *L) { - int n = lua_gettop(L); /* number of arguments */ - if (n == 1) /* optimize common case of single char */ - pushutfchar(L, 1); - else { - int i; - luaL_Buffer b; - luaL_buffinit(L, &b); - for (i = 1; i <= n; i++) { - pushutfchar(L, i); - luaL_addvalue(&b); - } - luaL_pushresult(&b); - } - return 1; -} - - -/* -** offset(s, n, [i]) -> index where n-th character counting from -** position 'i' starts; 0 means character at 'i'. -*/ -static int byteoffset (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = luaL_checkinteger(L, 2); - lua_Integer posi = (n >= 0) ? 1 : len + 1; - posi = u_posrelat(luaL_optinteger(L, 3, posi), len); - luaL_argcheck(L, 1 <= posi && --posi <= (lua_Integer)len, 3, - "position out of range"); - if (n == 0) { - /* find beginning of current byte sequence */ - while (posi > 0 && iscont(s + posi)) posi--; - } - else { - if (iscont(s + posi)) - luaL_error(L, "initial position is a continuation byte"); - if (n < 0) { - while (n < 0 && posi > 0) { /* move back */ - do { /* find beginning of previous character */ - posi--; - } while (posi > 0 && iscont(s + posi)); - n++; - } - } - else { - n--; /* do not move for 1st character */ - while (n > 0 && posi < (lua_Integer)len) { - do { /* find beginning of next character */ - posi++; - } while (iscont(s + posi)); /* (cannot pass final '\0') */ - n--; - } - } - } - if (n == 0) /* did it find given character? */ - lua_pushinteger(L, posi + 1); - else /* no such character */ - lua_pushnil(L); - return 1; -} - - -static int iter_aux (lua_State *L) { - size_t len; - const char *s = luaL_checklstring(L, 1, &len); - lua_Integer n = lua_tointeger(L, 2) - 1; - if (n < 0) /* first iteration? */ - n = 0; /* start from here */ - else if (n < (lua_Integer)len) { - n++; /* skip current byte */ - while (iscont(s + n)) n++; /* and its continuations */ - } - if (n >= (lua_Integer)len) - return 0; /* no more codepoints */ - else { - int code; - const char *next = utf8_decode(s + n, &code); - if (next == NULL || iscont(next)) - return luaL_error(L, "invalid UTF-8 code"); - lua_pushinteger(L, n + 1); - lua_pushinteger(L, code); - return 2; - } -} - - -static int iter_codes (lua_State *L) { - luaL_checkstring(L, 1); - lua_pushcfunction(L, iter_aux); - lua_pushvalue(L, 1); - lua_pushinteger(L, 0); - return 3; -} - - -/* pattern to match a single UTF-8 character */ -#define UTF8PATT "[\0-\x7F\xC2-\xF4][\x80-\xBF]*" - - -static const luaL_Reg funcs[] = { - {"offset", byteoffset}, - {"codepoint", codepoint}, - {"char", utfchar}, - {"len", utflen}, - {"codes", iter_codes}, - /* placeholders */ - {"charpattern", NULL}, - {NULL, NULL} -}; - - -LUAMOD_API int luaopen_utf8 (lua_State *L) { - luaL_newlib(L, funcs); - lua_pushlstring(L, UTF8PATT, sizeof(UTF8PATT)/sizeof(char) - 1); - lua_setfield(L, -2, "charpattern"); - return 1; -} - diff --git a/external/mit/lua/dist/src/lvm.c b/external/mit/lua/dist/src/lvm.c deleted file mode 100644 index 635646440..000000000 --- a/external/mit/lua/dist/src/lvm.c +++ /dev/null @@ -1,1371 +0,0 @@ -/* $NetBSD: lvm.c,v 1.7 2015/10/08 13:40:16 mbalmer Exp $ */ - -/* -** Id: lvm.c,v 2.245 2015/06/09 15:53:35 roberto Exp -** Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#define lvm_c -#define LUA_CORE - -#include "lprefix.h" - -#ifndef _KERNEL -#include -#include -#include -#include -#include -#include -#endif - -#include "lua.h" - -#include "ldebug.h" -#include "ldo.h" -#include "lfunc.h" -#include "lgc.h" -#include "lobject.h" -#include "lopcodes.h" -#include "lstate.h" -#include "lstring.h" -#include "ltable.h" -#include "ltm.h" -#include "lvm.h" - - -/* limit for table tag-method chains (to avoid loops) */ -#define MAXTAGLOOP 2000 - - -#ifndef _KERNEL -/* -** 'l_intfitsf' checks whether a given integer can be converted to a -** float without rounding. Used in comparisons. Left undefined if -** all integers fit in a float precisely. -*/ -#if !defined(l_intfitsf) - -/* number of bits in the mantissa of a float */ -#define NBM (l_mathlim(MANT_DIG)) - -/* -** Check whether some integers may not fit in a float, that is, whether -** (maxinteger >> NBM) > 0 (that implies (1 << NBM) <= maxinteger). -** (The shifts are done in parts to avoid shifting by more than the size -** of an integer. In a worst case, NBM == 113 for long double and -** sizeof(integer) == 32.) -*/ -#if ((((LUA_MAXINTEGER >> (NBM / 4)) >> (NBM / 4)) >> (NBM / 4)) \ - >> (NBM - (3 * (NBM / 4)))) > 0 - -#define l_intfitsf(i) \ - (-((lua_Integer)1 << NBM) <= (i) && (i) <= ((lua_Integer)1 << NBM)) - -#endif - -#endif -#endif /*_KERNEL */ - -#ifndef _KERNEL -/* -** Try to convert a value to a float. The float case is already handled -** by the macro 'tonumber'. -*/ -int luaV_tonumber_ (const TValue *obj, lua_Number *n) { - TValue v; - if (ttisinteger(obj)) { - *n = cast_num(ivalue(obj)); - return 1; - } - else if (cvt2num(obj) && /* string convertible to number? */ - luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { - *n = nvalue(&v); /* convert result of 'luaO_str2num' to a float */ - return 1; - } - else - return 0; /* conversion failed */ -} -#endif - - -/* -** try to convert a value to an integer, rounding according to 'mode': -** mode == 0: accepts only integral values -** mode == 1: takes the floor of the number -** mode == 2: takes the ceil of the number -*/ -int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode) { - TValue v; - again: -#ifndef _KERNEL - if (ttisfloat(obj)) { - lua_Number n = fltvalue(obj); - lua_Number f = l_floor(n); - if (n != f) { /* not an integral value? */ - if (mode == 0) return 0; /* fails if mode demands integral value */ - else if (mode > 1) /* needs ceil? */ - f += 1; /* convert floor to ceil (remember: n != f) */ - } - return lua_numbertointeger(f, p); - } - else if (ttisinteger(obj)) { -#else /* _KERNEL */ - if (ttisinteger(obj)) { - UNUSED(mode); -#endif - *p = ivalue(obj); - return 1; - } - else if (cvt2num(obj) && - luaO_str2num(svalue(obj), &v) == vslen(obj) + 1) { - obj = &v; - goto again; /* convert result from 'luaO_str2num' to an integer */ - } - return 0; /* conversion failed */ -} - - -#ifndef _KERNEL -/* -** Try to convert a 'for' limit to an integer, preserving the -** semantics of the loop. -** (The following explanation assumes a non-negative step; it is valid -** for negative steps mutatis mutandis.) -** If the limit can be converted to an integer, rounding down, that is -** it. -** Otherwise, check whether the limit can be converted to a number. If -** the number is too large, it is OK to set the limit as LUA_MAXINTEGER, -** which means no limit. If the number is too negative, the loop -** should not run, because any initial integer value is larger than the -** limit. So, it sets the limit to LUA_MININTEGER. 'stopnow' corrects -** the extreme case when the initial value is LUA_MININTEGER, in which -** case the LUA_MININTEGER limit would still run the loop once. -*/ -static int forlimit (const TValue *obj, lua_Integer *p, lua_Integer step, - int *stopnow) { - *stopnow = 0; /* usually, let loops run */ - if (!luaV_tointeger(obj, p, (step < 0 ? 2 : 1))) { /* not fit in integer? */ - lua_Number n; /* try to convert to float */ - if (!tonumber(obj, &n)) /* cannot convert to float? */ - return 0; /* not a number */ - if (luai_numlt(0, n)) { /* if true, float is larger than max integer */ - *p = LUA_MAXINTEGER; - if (step < 0) *stopnow = 1; - } - else { /* float is smaller than min integer */ - *p = LUA_MININTEGER; - if (step >= 0) *stopnow = 1; - } - } - return 1; -} -#endif - - -/* -** Main function for table access (invoking metamethods if needed). -** Compute 'val = t[key]' -*/ -void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { - int loop; /* counter to avoid infinite loops */ - for (loop = 0; loop < MAXTAGLOOP; loop++) { - const TValue *tm; - if (ttistable(t)) { /* 't' is a table? */ - Table *h = hvalue(t); - const TValue *res = luaH_get(h, key); /* do a primitive get */ - if (!ttisnil(res) || /* result is not nil? */ - (tm = fasttm(L, h->metatable, TM_INDEX)) == NULL) { /* or no TM? */ - setobj2s(L, val, res); /* result is the raw get */ - return; - } - /* else will try metamethod */ - } - else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))) - luaG_typeerror(L, t, "index"); /* no metamethod */ - if (ttisfunction(tm)) { /* metamethod is a function */ - luaT_callTM(L, tm, t, key, val, 1); - return; - } - t = tm; /* else repeat access over 'tm' */ - } - luaG_runerror(L, "gettable chain too long; possible loop"); -} - - -/* -** Main function for table assignment (invoking metamethods if needed). -** Compute 't[key] = val' -*/ -void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { - int loop; /* counter to avoid infinite loops */ - for (loop = 0; loop < MAXTAGLOOP; loop++) { - const TValue *tm; - if (ttistable(t)) { /* 't' is a table? */ - Table *h = hvalue(t); - TValue *oldval = cast(TValue *, luaH_get(h, key)); - /* if previous value is not nil, there must be a previous entry - in the table; a metamethod has no relevance */ - if (!ttisnil(oldval) || - /* previous value is nil; must check the metamethod */ - ((tm = fasttm(L, h->metatable, TM_NEWINDEX)) == NULL && - /* no metamethod; is there a previous entry in the table? */ - (oldval != luaO_nilobject || - /* no previous entry; must create one. (The next test is - always true; we only need the assignment.) */ - (oldval = luaH_newkey(L, h, key), 1)))) { - /* no metamethod and (now) there is an entry with given key */ - setobj2t(L, oldval, val); /* assign new value to that entry */ - invalidateTMcache(h); - luaC_barrierback(L, h, val); - return; - } - /* else will try the metamethod */ - } - else /* not a table; check metamethod */ - if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))) - luaG_typeerror(L, t, "index"); - /* try the metamethod */ - if (ttisfunction(tm)) { - luaT_callTM(L, tm, t, key, val, 0); - return; - } - t = tm; /* else repeat assignment over 'tm' */ - } - luaG_runerror(L, "settable chain too long; possible loop"); -} - - -/* -** Compare two strings 'ls' x 'rs', returning an integer smaller-equal- -** -larger than zero if 'ls' is smaller-equal-larger than 'rs'. -** The code is a little tricky because it allows '\0' in the strings -** and it uses 'strcoll' (to respect locales) for each segments -** of the strings. -*/ -static int l_strcmp (const TString *ls, const TString *rs) { - const char *l = getstr(ls); - size_t ll = tsslen(ls); - const char *r = getstr(rs); - size_t lr = tsslen(rs); - for (;;) { /* for each segment */ - int temp = strcoll(l, r); - if (temp != 0) /* not equal? */ - return temp; /* done */ - else { /* strings are equal up to a '\0' */ - size_t len = strlen(l); /* index of first '\0' in both strings */ - if (len == lr) /* 'rs' is finished? */ - return (len == ll) ? 0 : 1; /* check 'ls' */ - else if (len == ll) /* 'ls' is finished? */ - return -1; /* 'ls' is smaller than 'rs' ('rs' is not finished) */ - /* both strings longer than 'len'; go on comparing after the '\0' */ - len++; - l += len; ll -= len; r += len; lr -= len; - } - } -} - - -/* -** Check whether integer 'i' is less than float 'f'. If 'i' has an -** exact representation as a float ('l_intfitsf'), compare numbers as -** floats. Otherwise, if 'f' is outside the range for integers, result -** is trivial. Otherwise, compare them as integers. (When 'i' has no -** float representation, either 'f' is "far away" from 'i' or 'f' has -** no precision left for a fractional part; either way, how 'f' is -** truncated is irrelevant.) When 'f' is NaN, comparisons must result -** in false. -*/ -static int LTintfloat (lua_Integer i, lua_Number f) { -#if defined(l_intfitsf) - if (!l_intfitsf(i)) { - if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ - return 1; /* f >= maxint + 1 > i */ - else if (f > cast_num(LUA_MININTEGER)) /* minint < f <= maxint ? */ - return (i < cast(lua_Integer, f)); /* compare them as integers */ - else /* f <= minint <= i (or 'f' is NaN) --> not(i < f) */ - return 0; - } -#endif - return luai_numlt(cast_num(i), f); /* compare them as floats */ -} - - -/* -** Check whether integer 'i' is less than or equal to float 'f'. -** See comments on previous function. -*/ -static int LEintfloat (lua_Integer i, lua_Number f) { -#if defined(l_intfitsf) - if (!l_intfitsf(i)) { - if (f >= -cast_num(LUA_MININTEGER)) /* -minint == maxint + 1 */ - return 1; /* f >= maxint + 1 > i */ - else if (f >= cast_num(LUA_MININTEGER)) /* minint <= f <= maxint ? */ - return (i <= cast(lua_Integer, f)); /* compare them as integers */ - else /* f < minint <= i (or 'f' is NaN) --> not(i <= f) */ - return 0; - } -#endif - return luai_numle(cast_num(i), f); /* compare them as floats */ -} - - -/* -** Return 'l < r', for numbers. -*/ -static int LTnum (const TValue *l, const TValue *r) { - if (ttisinteger(l)) { - lua_Integer li = ivalue(l); - if (ttisinteger(r)) - return li < ivalue(r); /* both are integers */ -#ifndef _KERNEL - else /* 'l' is int and 'r' is float */ - return LTintfloat(li, fltvalue(r)); /* l < r ? */ -#endif - } -#ifndef _KERNEL - else { - lua_Number lf = fltvalue(l); /* 'l' must be float */ - if (ttisfloat(r)) - return luai_numlt(lf, fltvalue(r)); /* both are float */ - else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ - return 0; /* NaN < i is always false */ - else /* without NaN, (l < r) <--> not(r <= l) */ - return !LEintfloat(ivalue(r), lf); /* not (r <= l) ? */ - } -#endif -} - - -/* -** Return 'l <= r', for numbers. -*/ -static int LEnum (const TValue *l, const TValue *r) { - if (ttisinteger(l)) { - lua_Integer li = ivalue(l); - if (ttisinteger(r)) - return li <= ivalue(r); /* both are integers */ -#ifndef _KERNEL - else /* 'l' is int and 'r' is float */ - return LEintfloat(li, fltvalue(r)); /* l <= r ? */ -#endif - } -#ifndef _KERNEL - else { - lua_Number lf = fltvalue(l); /* 'l' must be float */ - if (ttisfloat(r)) - return luai_numle(lf, fltvalue(r)); /* both are float */ - else if (luai_numisnan(lf)) /* 'r' is int and 'l' is float */ - return 0; /* NaN <= i is always false */ - else /* without NaN, (l <= r) <--> not(r < l) */ - return !LTintfloat(ivalue(r), lf); /* not (r < l) ? */ - } -#endif -} - - -/* -** Main operation less than; return 'l < r'. -*/ -int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { - int res; - if (ttisnumber(l) && ttisnumber(r)) /* both operands are numbers? */ - return LTnum(l, r); - else if (ttisstring(l) && ttisstring(r)) /* both are strings? */ - return l_strcmp(tsvalue(l), tsvalue(r)) < 0; - else if ((res = luaT_callorderTM(L, l, r, TM_LT)) < 0) /* no metamethod? */ - luaG_ordererror(L, l, r); /* error */ - return res; -} - - -/* -** Main operation less than or equal to; return 'l <= r'. If it needs -** a metamethod and there is no '__le', try '__lt', based on -** l <= r iff !(r < l) (assuming a total order). If the metamethod -** yields during this substitution, the continuation has to know -** about it (to negate the result of r= 0) /* try 'le' */ - return res; - else { /* try 'lt': */ - L->ci->callstatus |= CIST_LEQ; /* mark it is doing 'lt' for 'le' */ - res = luaT_callorderTM(L, r, l, TM_LT); - L->ci->callstatus ^= CIST_LEQ; /* clear mark */ - if (res < 0) - luaG_ordererror(L, l, r); - return !res; /* result is negated */ - } -} - - -/* -** Main operation for equality of Lua values; return 't1 == t2'. -** L == NULL means raw equality (no metamethods) -*/ -int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2) { - const TValue *tm; - if (ttype(t1) != ttype(t2)) { /* not the same variant? */ -#ifndef _KERNEL - if (ttnov(t1) != ttnov(t2) || ttnov(t1) != LUA_TNUMBER) - return 0; /* only numbers can be equal with different variants */ - else { /* two numbers with different variants */ - lua_Integer i1, i2; /* compare them as integers */ - return (tointeger(t1, &i1) && tointeger(t2, &i2) && i1 == i2); - } -#else /* _KERNEL */ - return 0; /* numbers have only the integer variant */ -#endif - } - /* values have same type and same variant */ - switch (ttype(t1)) { - case LUA_TNIL: return 1; - case LUA_TNUMINT: return (ivalue(t1) == ivalue(t2)); -#ifndef _KERNEL - case LUA_TNUMFLT: return luai_numeq(fltvalue(t1), fltvalue(t2)); -#endif - case LUA_TBOOLEAN: return bvalue(t1) == bvalue(t2); /* true must be 1 !! */ - case LUA_TLIGHTUSERDATA: return pvalue(t1) == pvalue(t2); - case LUA_TLCF: return fvalue(t1) == fvalue(t2); - case LUA_TSHRSTR: return eqshrstr(tsvalue(t1), tsvalue(t2)); - case LUA_TLNGSTR: return luaS_eqlngstr(tsvalue(t1), tsvalue(t2)); - case LUA_TUSERDATA: { - if (uvalue(t1) == uvalue(t2)) return 1; - else if (L == NULL) return 0; - tm = fasttm(L, uvalue(t1)->metatable, TM_EQ); - if (tm == NULL) - tm = fasttm(L, uvalue(t2)->metatable, TM_EQ); - break; /* will try TM */ - } - case LUA_TTABLE: { - if (hvalue(t1) == hvalue(t2)) return 1; - else if (L == NULL) return 0; - tm = fasttm(L, hvalue(t1)->metatable, TM_EQ); - if (tm == NULL) - tm = fasttm(L, hvalue(t2)->metatable, TM_EQ); - break; /* will try TM */ - } - default: - return gcvalue(t1) == gcvalue(t2); - } - if (tm == NULL) /* no TM? */ - return 0; /* objects are different */ - luaT_callTM(L, tm, t1, t2, L->top, 1); /* call TM */ - return !l_isfalse(L->top); -} - - -/* macro used by 'luaV_concat' to ensure that element at 'o' is a string */ -#define tostring(L,o) \ - (ttisstring(o) || (cvt2str(o) && (luaO_tostring(L, o), 1))) - -#define isemptystr(o) (ttisshrstring(o) && tsvalue(o)->shrlen == 0) - -/* -** Main operation for concatenation: concat 'total' values in the stack, -** from 'L->top - total' up to 'L->top - 1'. -*/ -void luaV_concat (lua_State *L, int total) { - lua_assert(total >= 2); - do { - StkId top = L->top; - int n = 2; /* number of elements handled in this pass (at least 2) */ - if (!(ttisstring(top-2) || cvt2str(top-2)) || !tostring(L, top-1)) - luaT_trybinTM(L, top-2, top-1, top-2, TM_CONCAT); - else if (isemptystr(top - 1)) /* second operand is empty? */ - cast_void(tostring(L, top - 2)); /* result is first operand */ - else if (isemptystr(top - 2)) { /* first operand is an empty string? */ - setobjs2s(L, top - 2, top - 1); /* result is second op. */ - } - else { - /* at least two non-empty string values; get as many as possible */ - size_t tl = vslen(top - 1); - char *buffer; - int i; - /* collect total length */ - for (i = 1; i < total && tostring(L, top-i-1); i++) { - size_t l = vslen(top - i - 1); - if (l >= (MAX_SIZE/sizeof(char)) - tl) - luaG_runerror(L, "string length overflow"); - tl += l; - } - buffer = luaZ_openspace(L, &G(L)->buff, tl); - tl = 0; - n = i; - do { /* copy all strings to buffer */ - size_t l = vslen(top - i); - memcpy(buffer+tl, svalue(top-i), l * sizeof(char)); - tl += l; - } while (--i > 0); - setsvalue2s(L, top-n, luaS_newlstr(L, buffer, tl)); /* create result */ - } - total -= n-1; /* got 'n' strings to create 1 new */ - L->top -= n-1; /* popped 'n' strings and pushed one */ - } while (total > 1); /* repeat until only 1 result left */ -} - - -/* -** Main operation 'ra' = #rb'. -*/ -void luaV_objlen (lua_State *L, StkId ra, const TValue *rb) { - const TValue *tm; - switch (ttype(rb)) { - case LUA_TTABLE: { - Table *h = hvalue(rb); - tm = fasttm(L, h->metatable, TM_LEN); - if (tm) break; /* metamethod? break switch to call it */ - setivalue(ra, luaH_getn(h)); /* else primitive len */ - return; - } - case LUA_TSHRSTR: { - setivalue(ra, tsvalue(rb)->shrlen); - return; - } - case LUA_TLNGSTR: { - setivalue(ra, tsvalue(rb)->u.lnglen); - return; - } - default: { /* try metamethod */ - tm = luaT_gettmbyobj(L, rb, TM_LEN); - if (ttisnil(tm)) /* no metamethod? */ - luaG_typeerror(L, rb, "get length of"); - break; - } - } - luaT_callTM(L, tm, rb, rb, ra, 1); -} - - -/* -** Integer division; return 'm // n', that is, floor(m/n). -** C division truncates its result (rounds towards zero). -** 'floor(q) == trunc(q)' when 'q >= 0' or when 'q' is integer, -** otherwise 'floor(q) == trunc(q) - 1'. -*/ -lua_Integer luaV_div (lua_State *L, lua_Integer m, lua_Integer n) { - if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ - if (n == 0) - luaG_runerror(L, "attempt to divide by zero"); - return intop(-, 0, m); /* n==-1; avoid overflow with 0x80000...//-1 */ - } - else { - lua_Integer q = m / n; /* perform C division */ - if ((m ^ n) < 0 && m % n != 0) /* 'm/n' would be negative non-integer? */ - q -= 1; /* correct result for different rounding */ - return q; - } -} - - -/* -** Integer modulus; return 'm % n'. (Assume that C '%' with -** negative operands follows C99 behavior. See previous comment -** about luaV_div.) -*/ -lua_Integer luaV_mod (lua_State *L, lua_Integer m, lua_Integer n) { - if (l_castS2U(n) + 1u <= 1u) { /* special cases: -1 or 0 */ - if (n == 0) - luaG_runerror(L, "attempt to perform 'n%%0'"); - return 0; /* m % -1 == 0; avoid overflow with 0x80000...%-1 */ - } - else { - lua_Integer r = m % n; - if (r != 0 && (m ^ n) < 0) /* 'm/n' would be non-integer negative? */ - r += n; /* correct result for different rounding */ - return r; - } -} - - -/* number of bits in an integer */ -#define NBITS cast_int(sizeof(lua_Integer) * CHAR_BIT) - -/* -** Shift left operation. (Shift right just negates 'y'.) -*/ -lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y) { - if (y < 0) { /* shift right? */ - if (y <= -NBITS) return 0; - else return intop(>>, x, -y); - } - else { /* shift left */ - if (y >= NBITS) return 0; - else return intop(<<, x, y); - } -} - - -/* -** check whether cached closure in prototype 'p' may be reused, that is, -** whether there is a cached closure with the same upvalues needed by -** new closure to be created. -*/ -static LClosure *getcached (Proto *p, UpVal **encup, StkId base) { - LClosure *c = p->cache; - if (c != NULL) { /* is there a cached closure? */ - int nup = p->sizeupvalues; - Upvaldesc *uv = p->upvalues; - int i; - for (i = 0; i < nup; i++) { /* check whether it has right upvalues */ - TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v; - if (c->upvals[i]->v != v) - return NULL; /* wrong upvalue; cannot reuse closure */ - } - } - return c; /* return cached closure (or NULL if no cached closure) */ -} - - -/* -** create a new Lua closure, push it in the stack, and initialize -** its upvalues. Note that the closure is not cached if prototype is -** already black (which means that 'cache' was already cleared by the -** GC). -*/ -static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, - StkId ra) { - int nup = p->sizeupvalues; - Upvaldesc *uv = p->upvalues; - int i; - LClosure *ncl = luaF_newLclosure(L, nup); - ncl->p = p; - setclLvalue(L, ra, ncl); /* anchor new closure in stack */ - for (i = 0; i < nup; i++) { /* fill in its upvalues */ - if (uv[i].instack) /* upvalue refers to local variable? */ - ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); - else /* get upvalue from enclosing function */ - ncl->upvals[i] = encup[uv[i].idx]; - ncl->upvals[i]->refcount++; - /* new closure is white, so we do not need a barrier here */ - } - if (!isblack(p)) /* cache will not break GC invariant? */ - p->cache = ncl; /* save it on cache for reuse */ -} - - -/* -** finish execution of an opcode interrupted by an yield -*/ -void luaV_finishOp (lua_State *L) { - CallInfo *ci = L->ci; - StkId base = ci->u.l.base; - Instruction inst = *(ci->u.l.savedpc - 1); /* interrupted instruction */ - OpCode op = GET_OPCODE(inst); - switch (op) { /* finish its execution */ -#ifndef _KERNEL - case OP_ADD: case OP_SUB: case OP_MUL: case OP_DIV: case OP_IDIV: -#else - case OP_ADD: case OP_SUB: case OP_MUL: case OP_IDIV: -#endif - case OP_BAND: case OP_BOR: case OP_BXOR: case OP_SHL: case OP_SHR: -#ifndef _KERNEL - case OP_MOD: case OP_POW: -#else - case OP_MOD: -#endif - case OP_UNM: case OP_BNOT: case OP_LEN: - case OP_GETTABUP: case OP_GETTABLE: case OP_SELF: { - setobjs2s(L, base + GETARG_A(inst), --L->top); - break; - } - case OP_LE: case OP_LT: case OP_EQ: { - int res = !l_isfalse(L->top - 1); - L->top--; - if (ci->callstatus & CIST_LEQ) { /* "<=" using "<" instead? */ - lua_assert(op == OP_LE); - ci->callstatus ^= CIST_LEQ; /* clear mark */ - res = !res; /* negate result */ - } - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_JMP); - if (res != GETARG_A(inst)) /* condition failed? */ - ci->u.l.savedpc++; /* skip jump instruction */ - break; - } - case OP_CONCAT: { - StkId top = L->top - 1; /* top when 'luaT_trybinTM' was called */ - int b = GETARG_B(inst); /* first element to concatenate */ - int total = cast_int(top - 1 - (base + b)); /* yet to concatenate */ - setobj2s(L, top - 2, top); /* put TM result in proper position */ - if (total > 1) { /* are there elements to concat? */ - L->top = top - 1; /* top is one after last element (at top-2) */ - luaV_concat(L, total); /* concat them (may yield again) */ - } - /* move final result to final position */ - setobj2s(L, ci->u.l.base + GETARG_A(inst), L->top - 1); - L->top = ci->top; /* restore top */ - break; - } - case OP_TFORCALL: { - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_TFORLOOP); - L->top = ci->top; /* correct top */ - break; - } - case OP_CALL: { - if (GETARG_C(inst) - 1 >= 0) /* nresults >= 0? */ - L->top = ci->top; /* adjust results */ - break; - } - case OP_TAILCALL: case OP_SETTABUP: case OP_SETTABLE: - break; - default: lua_assert(0); - } -} - - - - -/* -** {================================================================== -** Function 'luaV_execute': main interpreter loop -** =================================================================== -*/ - - -/* -** some macros for common tasks in 'luaV_execute' -*/ - -#if !defined(luai_runtimecheck) -#define luai_runtimecheck(L, c) /* void */ -#endif - - -#define RA(i) (base+GETARG_A(i)) -/* to be used after possible stack reallocation */ -#define RB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i)) -#define RC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i)) -#define RKB(i) check_exp(getBMode(GET_OPCODE(i)) == OpArgK, \ - ISK(GETARG_B(i)) ? k+INDEXK(GETARG_B(i)) : base+GETARG_B(i)) -#define RKC(i) check_exp(getCMode(GET_OPCODE(i)) == OpArgK, \ - ISK(GETARG_C(i)) ? k+INDEXK(GETARG_C(i)) : base+GETARG_C(i)) -#define KBx(i) \ - (k + (GETARG_Bx(i) != 0 ? GETARG_Bx(i) - 1 : GETARG_Ax(*ci->u.l.savedpc++))) - - -/* execute a jump instruction */ -#define dojump(ci,i,e) \ - { int a = GETARG_A(i); \ - if (a > 0) luaF_close(L, ci->u.l.base + a - 1); \ - ci->u.l.savedpc += GETARG_sBx(i) + e; } - -/* for test instructions, execute the jump instruction that follows it */ -#define donextjump(ci) { i = *ci->u.l.savedpc; dojump(ci, i, 1); } - - -#define Protect(x) { {x;}; base = ci->u.l.base; } - -#define checkGC(L,c) \ - Protect( luaC_condGC(L,{L->top = (c); /* limit of live values */ \ - luaC_step(L); \ - L->top = ci->top;}) /* restore top */ \ - luai_threadyield(L); ) - - -#define vmdispatch(o) switch(o) -#define vmcase(l) case l: -#define vmbreak break - -void luaV_execute (lua_State *L) { - CallInfo *ci = L->ci; - LClosure *cl; - TValue *k; - StkId base; - newframe: /* reentry point when frame changes (call/return) */ - lua_assert(ci == L->ci); - cl = clLvalue(ci->func); - k = cl->p->k; - base = ci->u.l.base; - /* main loop of interpreter */ - for (;;) { - Instruction i = *(ci->u.l.savedpc++); - StkId ra; - if ((L->hookmask & (LUA_MASKLINE | LUA_MASKCOUNT)) && - (--L->hookcount == 0 || L->hookmask & LUA_MASKLINE)) { - Protect(luaG_traceexec(L)); - } - /* WARNING: several calls may realloc the stack and invalidate 'ra' */ - ra = RA(i); - lua_assert(base == ci->u.l.base); - lua_assert(base <= L->top && L->top < L->stack + L->stacksize); - vmdispatch (GET_OPCODE(i)) { - vmcase(OP_MOVE) { - setobjs2s(L, ra, RB(i)); - vmbreak; - } - vmcase(OP_LOADK) { - TValue *rb = k + GETARG_Bx(i); - setobj2s(L, ra, rb); - vmbreak; - } - vmcase(OP_LOADKX) { - TValue *rb; - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); - rb = k + GETARG_Ax(*ci->u.l.savedpc++); - setobj2s(L, ra, rb); - vmbreak; - } - vmcase(OP_LOADBOOL) { - setbvalue(ra, GETARG_B(i)); - if (GETARG_C(i)) ci->u.l.savedpc++; /* skip next instruction (if C) */ - vmbreak; - } - vmcase(OP_LOADNIL) { - int b = GETARG_B(i); - do { - setnilvalue(ra++); - } while (b--); - vmbreak; - } - vmcase(OP_GETUPVAL) { - int b = GETARG_B(i); - setobj2s(L, ra, cl->upvals[b]->v); - vmbreak; - } - vmcase(OP_GETTABUP) { - int b = GETARG_B(i); - Protect(luaV_gettable(L, cl->upvals[b]->v, RKC(i), ra)); - vmbreak; - } - vmcase(OP_GETTABLE) { - Protect(luaV_gettable(L, RB(i), RKC(i), ra)); - vmbreak; - } - vmcase(OP_SETTABUP) { - int a = GETARG_A(i); - Protect(luaV_settable(L, cl->upvals[a]->v, RKB(i), RKC(i))); - vmbreak; - } - vmcase(OP_SETUPVAL) { - UpVal *uv = cl->upvals[GETARG_B(i)]; - setobj(L, uv->v, ra); - luaC_upvalbarrier(L, uv); - vmbreak; - } - vmcase(OP_SETTABLE) { - Protect(luaV_settable(L, ra, RKB(i), RKC(i))); - vmbreak; - } - vmcase(OP_NEWTABLE) { - int b = GETARG_B(i); - int c = GETARG_C(i); - Table *t = luaH_new(L); - sethvalue(L, ra, t); - if (b != 0 || c != 0) - luaH_resize(L, t, luaO_fb2int(b), luaO_fb2int(c)); - checkGC(L, ra + 1); - vmbreak; - } - vmcase(OP_SELF) { - StkId rb = RB(i); - setobjs2s(L, ra+1, rb); - Protect(luaV_gettable(L, rb, RKC(i), ra)); - vmbreak; - } - vmcase(OP_ADD) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); -#ifndef _KERNEL - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(+, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numadd(L, nb, nc)); - } -#else /* _KERNEL */ - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(+, ib, ic)); - } -#endif - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_ADD)); } - vmbreak; - } - vmcase(OP_SUB) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); -#ifndef _KERNEL - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(-, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numsub(L, nb, nc)); - } -#else /* _KERNEL */ - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(-, ib, ic)); - } -#endif - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SUB)); } - vmbreak; - } - vmcase(OP_MUL) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); -#ifndef _KERNEL - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, intop(*, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_nummul(L, nb, nc)); - } -#else /* _KERNEL */ - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(*, ib, ic)); - } -#endif - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MUL)); } - vmbreak; - } -#ifndef _KERNEL - vmcase(OP_DIV) { /* float division (always with floats) */ - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numdiv(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_DIV)); } - vmbreak; - } -#endif - vmcase(OP_BAND) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(&, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BAND)); } - vmbreak; - } - vmcase(OP_BOR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(|, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BOR)); } - vmbreak; - } - vmcase(OP_BXOR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, intop(^, ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_BXOR)); } - vmbreak; - } - vmcase(OP_SHL) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, luaV_shiftl(ib, ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHL)); } - vmbreak; - } - vmcase(OP_SHR) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, luaV_shiftl(ib, -ic)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_SHR)); } - vmbreak; - } - vmcase(OP_MOD) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); -#ifndef _KERNEL - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, luaV_mod(L, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - lua_Number m; - luai_nummod(L, nb, nc, m); - setfltvalue(ra, m); - } -#else /* _KERNEL */ - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, luaV_mod(L, ib, ic)); - } -#endif - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_MOD)); } - vmbreak; - } - vmcase(OP_IDIV) { /* floor division */ - TValue *rb = RKB(i); - TValue *rc = RKC(i); -#ifndef _KERNEL - lua_Number nb; lua_Number nc; - if (ttisinteger(rb) && ttisinteger(rc)) { - lua_Integer ib = ivalue(rb); lua_Integer ic = ivalue(rc); - setivalue(ra, luaV_div(L, ib, ic)); - } - else if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numidiv(L, nb, nc)); - } -#else /* _KERNEL */ - lua_Integer ib; lua_Integer ic; - if (tointeger(rb, &ib) && tointeger(rc, &ic)) { - setivalue(ra, luaV_div(L, ib, ic)); - } -#endif - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_IDIV)); } - vmbreak; - } -#ifndef _KERNEL - vmcase(OP_POW) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - lua_Number nb; lua_Number nc; - if (tonumber(rb, &nb) && tonumber(rc, &nc)) { - setfltvalue(ra, luai_numpow(L, nb, nc)); - } - else { Protect(luaT_trybinTM(L, rb, rc, ra, TM_POW)); } - vmbreak; - } -#endif - vmcase(OP_UNM) { - TValue *rb = RB(i); -#ifndef _KERNEL - lua_Number nb; - if (ttisinteger(rb)) { - lua_Integer ib = ivalue(rb); - setivalue(ra, intop(-, 0, ib)); - } - else if (tonumber(rb, &nb)) { - setfltvalue(ra, luai_numunm(L, nb)); - } -#else /* _KERNEL */ - lua_Integer ib; - if (tointeger(rb, &ib)) { - setivalue(ra, intop(-, 0, ib)); - } -#endif - else { - Protect(luaT_trybinTM(L, rb, rb, ra, TM_UNM)); - } - vmbreak; - } - vmcase(OP_BNOT) { - TValue *rb = RB(i); - lua_Integer ib; - if (tointeger(rb, &ib)) { - setivalue(ra, intop(^, ~l_castS2U(0), ib)); - } - else { - Protect(luaT_trybinTM(L, rb, rb, ra, TM_BNOT)); - } - vmbreak; - } - vmcase(OP_NOT) { - TValue *rb = RB(i); - int res = l_isfalse(rb); /* next assignment may change this value */ - setbvalue(ra, res); - vmbreak; - } - vmcase(OP_LEN) { - Protect(luaV_objlen(L, ra, RB(i))); - vmbreak; - } - vmcase(OP_CONCAT) { - int b = GETARG_B(i); - int c = GETARG_C(i); - StkId rb; - L->top = base + c + 1; /* mark the end of concat operands */ - Protect(luaV_concat(L, c - b + 1)); - ra = RA(i); /* 'luav_concat' may invoke TMs and move the stack */ - rb = base + b; - setobjs2s(L, ra, rb); - checkGC(L, (ra >= rb ? ra + 1 : rb)); - L->top = ci->top; /* restore top */ - vmbreak; - } - vmcase(OP_JMP) { - dojump(ci, i, 0); - vmbreak; - } - vmcase(OP_EQ) { - TValue *rb = RKB(i); - TValue *rc = RKC(i); - Protect( - if (cast_int(luaV_equalobj(L, rb, rc)) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_LT) { - Protect( - if (luaV_lessthan(L, RKB(i), RKC(i)) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_LE) { - Protect( - if (luaV_lessequal(L, RKB(i), RKC(i)) != GETARG_A(i)) - ci->u.l.savedpc++; - else - donextjump(ci); - ) - vmbreak; - } - vmcase(OP_TEST) { - if (GETARG_C(i) ? l_isfalse(ra) : !l_isfalse(ra)) - ci->u.l.savedpc++; - else - donextjump(ci); - vmbreak; - } - vmcase(OP_TESTSET) { - TValue *rb = RB(i); - if (GETARG_C(i) ? l_isfalse(rb) : !l_isfalse(rb)) - ci->u.l.savedpc++; - else { - setobjs2s(L, ra, rb); - donextjump(ci); - } - vmbreak; - } - vmcase(OP_CALL) { - int b = GETARG_B(i); - int nresults = GETARG_C(i) - 1; - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - if (luaD_precall(L, ra, nresults)) { /* C function? */ - if (nresults >= 0) L->top = ci->top; /* adjust results */ - base = ci->u.l.base; - } - else { /* Lua function */ - ci = L->ci; - ci->callstatus |= CIST_REENTRY; - goto newframe; /* restart luaV_execute over new Lua function */ - } - vmbreak; - } - vmcase(OP_TAILCALL) { - int b = GETARG_B(i); - if (b != 0) L->top = ra+b; /* else previous instruction set top */ - lua_assert(GETARG_C(i) - 1 == LUA_MULTRET); - if (luaD_precall(L, ra, LUA_MULTRET)) /* C function? */ - base = ci->u.l.base; - else { - /* tail call: put called frame (n) in place of caller one (o) */ - CallInfo *nci = L->ci; /* called frame */ - CallInfo *oci = nci->previous; /* caller frame */ - StkId nfunc = nci->func; /* called function */ - StkId ofunc = oci->func; /* caller function */ - /* last stack slot filled by 'precall' */ - StkId lim = nci->u.l.base + getproto(nfunc)->numparams; - int aux; - /* close all upvalues from previous call */ - if (cl->p->sizep > 0) luaF_close(L, oci->u.l.base); - /* move new frame into old one */ - for (aux = 0; nfunc + aux < lim; aux++) - setobjs2s(L, ofunc + aux, nfunc + aux); - oci->u.l.base = ofunc + (nci->u.l.base - nfunc); /* correct base */ - oci->top = L->top = ofunc + (L->top - nfunc); /* correct top */ - oci->u.l.savedpc = nci->u.l.savedpc; - oci->callstatus |= CIST_TAIL; /* function was tail called */ - ci = L->ci = oci; /* remove new frame */ - lua_assert(L->top == oci->u.l.base + getproto(ofunc)->maxstacksize); - goto newframe; /* restart luaV_execute over new Lua function */ - } - vmbreak; - } - vmcase(OP_RETURN) { - int b = GETARG_B(i); - if (cl->p->sizep > 0) luaF_close(L, base); - b = luaD_poscall(L, ra, (b != 0 ? b - 1 : L->top - ra)); - if (!(ci->callstatus & CIST_REENTRY)) /* 'ci' still the called one */ - return; /* external invocation: return */ - else { /* invocation via reentry: continue execution */ - ci = L->ci; - if (b) L->top = ci->top; - lua_assert(isLua(ci)); - lua_assert(GET_OPCODE(*((ci)->u.l.savedpc - 1)) == OP_CALL); - goto newframe; /* restart luaV_execute over new Lua function */ - } - } - vmcase(OP_FORLOOP) { -#ifndef _KERNEL - if (ttisinteger(ra)) { /* integer loop? */ -#endif - lua_Integer step = ivalue(ra + 2); - lua_Integer idx = ivalue(ra) + step; /* increment index */ - lua_Integer limit = ivalue(ra + 1); - if ((0 < step) ? (idx <= limit) : (limit <= idx)) { - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - chgivalue(ra, idx); /* update internal index... */ - setivalue(ra + 3, idx); /* ...and external index */ - } -#ifndef _KERNEL - } - else { /* floating loop */ - lua_Number step = fltvalue(ra + 2); - lua_Number idx = luai_numadd(L, fltvalue(ra), step); /* inc. index */ - lua_Number limit = fltvalue(ra + 1); - if (luai_numlt(0, step) ? luai_numle(idx, limit) - : luai_numle(limit, idx)) { - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - chgfltvalue(ra, idx); /* update internal index... */ - setfltvalue(ra + 3, idx); /* ...and external index */ - } - } -#endif - vmbreak; - } - vmcase(OP_FORPREP) { - TValue *init = ra; - TValue *plimit = ra + 1; - TValue *pstep = ra + 2; - lua_Integer ilimit; -#ifndef _KERNEL - int stopnow; - if (ttisinteger(init) && ttisinteger(pstep) && - forlimit(plimit, &ilimit, ivalue(pstep), &stopnow)) { - /* all values are integer */ - lua_Integer initv = (stopnow ? 0 : ivalue(init)); - setivalue(plimit, ilimit); - setivalue(init, initv - ivalue(pstep)); - } - else { /* try making all values floats */ - lua_Number ninit; lua_Number nlimit; lua_Number nstep; - if (!tonumber(plimit, &nlimit)) - luaG_runerror(L, "'for' limit must be a number"); - setfltvalue(plimit, nlimit); - if (!tonumber(pstep, &nstep)) - luaG_runerror(L, "'for' step must be a number"); - setfltvalue(pstep, nstep); - if (!tonumber(init, &ninit)) - luaG_runerror(L, "'for' initial value must be a number"); - setfltvalue(init, luai_numsub(L, ninit, nstep)); - } -#else /* _KERNEL */ - lua_Integer initv; lua_Integer step; - if (!tointeger(plimit, &ilimit)) - luaG_runerror(L, "'for' limit must be a number"); - setivalue(plimit, ilimit); - if (!tointeger(pstep, &step)) - luaG_runerror(L, "'for' step must be a number"); - setivalue(pstep, step); - if (!tointeger(init, &initv)) - luaG_runerror(L, "'for' initial value must be a number"); - setivalue(init, initv - step); -#endif - ci->u.l.savedpc += GETARG_sBx(i); - vmbreak; - } - vmcase(OP_TFORCALL) { - StkId cb = ra + 3; /* call base */ - setobjs2s(L, cb+2, ra+2); - setobjs2s(L, cb+1, ra+1); - setobjs2s(L, cb, ra); - L->top = cb + 3; /* func. + 2 args (state and index) */ - Protect(luaD_call(L, cb, GETARG_C(i), 1)); - L->top = ci->top; - i = *(ci->u.l.savedpc++); /* go to next instruction */ - ra = RA(i); - lua_assert(GET_OPCODE(i) == OP_TFORLOOP); - goto l_tforloop; - } - vmcase(OP_TFORLOOP) { - l_tforloop: - if (!ttisnil(ra + 1)) { /* continue loop? */ - setobjs2s(L, ra, ra + 1); /* save control variable */ - ci->u.l.savedpc += GETARG_sBx(i); /* jump back */ - } - vmbreak; - } - vmcase(OP_SETLIST) { - int n = GETARG_B(i); - int c = GETARG_C(i); - unsigned int last; - Table *h; - if (n == 0) n = cast_int(L->top - ra) - 1; - if (c == 0) { - lua_assert(GET_OPCODE(*ci->u.l.savedpc) == OP_EXTRAARG); - c = GETARG_Ax(*ci->u.l.savedpc++); - } - luai_runtimecheck(L, ttistable(ra)); - h = hvalue(ra); - last = ((c-1)*LFIELDS_PER_FLUSH) + n; - if (last > h->sizearray) /* needs more space? */ - luaH_resizearray(L, h, last); /* pre-allocate it at once */ - for (; n > 0; n--) { - TValue *val = ra+n; - luaH_setint(L, h, last--, val); - luaC_barrierback(L, h, val); - } - L->top = ci->top; /* correct top (in case of previous open call) */ - vmbreak; - } - vmcase(OP_CLOSURE) { - Proto *p = cl->p->p[GETARG_Bx(i)]; - LClosure *ncl = getcached(p, cl->upvals, base); /* cached closure */ - if (ncl == NULL) /* no match? */ - pushclosure(L, p, cl->upvals, base, ra); /* create a new one */ - else - setclLvalue(L, ra, ncl); /* push cashed closure */ - checkGC(L, ra + 1); - vmbreak; - } - vmcase(OP_VARARG) { - int b = GETARG_B(i) - 1; - int j; - int n = cast_int(base - ci->func) - cl->p->numparams - 1; - if (b < 0) { /* B == 0? */ - b = n; /* get all var. arguments */ - Protect(luaD_checkstack(L, n)); - ra = RA(i); /* previous call may change the stack */ - L->top = ra + n; - } - for (j = 0; j < b; j++) { - if (j < n) { - setobjs2s(L, ra + j, base - n + j); - } - else { - setnilvalue(ra + j); - } - } - vmbreak; - } - vmcase(OP_EXTRAARG) { - lua_assert(0); - vmbreak; - } - } - } -} - -/* }================================================================== */ - diff --git a/external/mit/lua/dist/src/lvm.h b/external/mit/lua/dist/src/lvm.h deleted file mode 100644 index 43da859bb..000000000 --- a/external/mit/lua/dist/src/lvm.h +++ /dev/null @@ -1,74 +0,0 @@ -/* $NetBSD: lvm.h,v 1.5 2015/10/08 13:40:16 mbalmer Exp $ */ - -/* -** Id: lvm.h,v 2.35 2015/02/20 14:27:53 roberto Exp -** Lua virtual machine -** See Copyright Notice in lua.h -*/ - -#ifndef lvm_h -#define lvm_h - - -#include "ldo.h" -#include "lobject.h" -#include "ltm.h" - - -#if !defined(LUA_NOCVTN2S) -#define cvt2str(o) ttisnumber(o) -#else -#define cvt2str(o) 0 /* no conversion from numbers to strings */ -#endif - - -#if !defined(LUA_NOCVTS2N) -#define cvt2num(o) ttisstring(o) -#else -#define cvt2num(o) 0 /* no conversion from strings to numbers */ -#endif - - -/* -** You can define LUA_FLOORN2I if you want to convert floats to integers -** by flooring them (instead of raising an error if they are not -** integral values) -*/ -#if !defined(LUA_FLOORN2I) -#define LUA_FLOORN2I 0 -#endif - - -#ifndef _KERNEL -#define tonumber(o,n) \ - (ttisfloat(o) ? (*(n) = fltvalue(o), 1) : luaV_tonumber_(o,n)) -#else /* _KERNEL */ -#define tonumber tointeger -#endif - -#define tointeger(o,i) \ - (ttisinteger(o) ? (*(i) = ivalue(o), 1) : luaV_tointeger(o,i,LUA_FLOORN2I)) - -#define intop(op,v1,v2) l_castU2S(l_castS2U(v1) op l_castS2U(v2)) - -#define luaV_rawequalobj(t1,t2) luaV_equalobj(NULL,t1,t2) - - -LUAI_FUNC int luaV_equalobj (lua_State *L, const TValue *t1, const TValue *t2); -LUAI_FUNC int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r); -LUAI_FUNC int luaV_lessequal (lua_State *L, const TValue *l, const TValue *r); -LUAI_FUNC int luaV_tonumber_ (const TValue *obj, lua_Number *n); -LUAI_FUNC int luaV_tointeger (const TValue *obj, lua_Integer *p, int mode); -LUAI_FUNC void luaV_gettable (lua_State *L, const TValue *t, TValue *key, - StkId val); -LUAI_FUNC void luaV_settable (lua_State *L, const TValue *t, TValue *key, - StkId val); -LUAI_FUNC void luaV_finishOp (lua_State *L); -LUAI_FUNC void luaV_execute (lua_State *L); -LUAI_FUNC void luaV_concat (lua_State *L, int total); -LUAI_FUNC lua_Integer luaV_div (lua_State *L, lua_Integer x, lua_Integer y); -LUAI_FUNC lua_Integer luaV_mod (lua_State *L, lua_Integer x, lua_Integer y); -LUAI_FUNC lua_Integer luaV_shiftl (lua_Integer x, lua_Integer y); -LUAI_FUNC void luaV_objlen (lua_State *L, StkId ra, const TValue *rb); - -#endif diff --git a/external/mit/lua/dist/src/lzio.c b/external/mit/lua/dist/src/lzio.c deleted file mode 100644 index 38c4ecf10..000000000 --- a/external/mit/lua/dist/src/lzio.c +++ /dev/null @@ -1,82 +0,0 @@ -/* $NetBSD: lzio.c,v 1.3 2015/02/02 14:03:05 lneto Exp $ */ - -/* -** Id: lzio.c,v 1.36 2014/11/02 19:19:04 roberto Exp -** Buffered streams -** See Copyright Notice in lua.h -*/ - -#define lzio_c -#define LUA_CORE - -#include "lprefix.h" - - -#ifndef _KERNEL -#include -#endif - -#include "lua.h" - -#include "llimits.h" -#include "lmem.h" -#include "lstate.h" -#include "lzio.h" - - -int luaZ_fill (ZIO *z) { - size_t size; - lua_State *L = z->L; - const char *buff; - lua_unlock(L); - buff = z->reader(L, z->data, &size); - lua_lock(L); - if (buff == NULL || size == 0) - return EOZ; - z->n = size - 1; /* discount char being returned */ - z->p = buff; - return cast_uchar(*(z->p++)); -} - - -void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { - z->L = L; - z->reader = reader; - z->data = data; - z->n = 0; - z->p = NULL; -} - - -/* --------------------------------------------------------------- read --- */ -size_t luaZ_read (ZIO *z, void *b, size_t n) { - while (n) { - size_t m; - if (z->n == 0) { /* no bytes in buffer? */ - if (luaZ_fill(z) == EOZ) /* try to read more */ - return n; /* no more input; return number of missing bytes */ - else { - z->n++; /* luaZ_fill consumed first byte; put it back */ - z->p--; - } - } - m = (n <= z->n) ? n : z->n; /* min. between n and z->n */ - memcpy(b, z->p, m); - z->n -= m; - z->p += m; - b = (char *)b + m; - n -= m; - } - return 0; -} - -/* ------------------------------------------------------------------------ */ -char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { - if (n > buff->buffsize) { - if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; - luaZ_resizebuffer(L, buff, n); - } - return buff->buffer; -} - - diff --git a/external/mit/lua/dist/src/lzio.h b/external/mit/lua/dist/src/lzio.h deleted file mode 100644 index ca06aa2c7..000000000 --- a/external/mit/lua/dist/src/lzio.h +++ /dev/null @@ -1,67 +0,0 @@ -/* -** $Id: lzio.h,v 1.3 2015/02/02 14:03:05 lneto Exp $ -** Buffered streams -** See Copyright Notice in lua.h -*/ - - -#ifndef lzio_h -#define lzio_h - -#include "lua.h" - -#include "lmem.h" - - -#define EOZ (-1) /* end of stream */ - -typedef struct Zio ZIO; - -#define zgetc(z) (((z)->n--)>0 ? cast_uchar(*(z)->p++) : luaZ_fill(z)) - - -typedef struct Mbuffer { - char *buffer; - size_t n; - size_t buffsize; -} Mbuffer; - -#define luaZ_initbuffer(L, buff) ((buff)->buffer = NULL, (buff)->buffsize = 0) - -#define luaZ_buffer(buff) ((buff)->buffer) -#define luaZ_sizebuffer(buff) ((buff)->buffsize) -#define luaZ_bufflen(buff) ((buff)->n) - -#define luaZ_buffremove(buff,i) ((buff)->n -= (i)) -#define luaZ_resetbuffer(buff) ((buff)->n = 0) - - -#define luaZ_resizebuffer(L, buff, size) \ - ((buff)->buffer = luaM_reallocvchar(L, (buff)->buffer, \ - (buff)->buffsize, size), \ - (buff)->buffsize = size) - -#define luaZ_freebuffer(L, buff) luaZ_resizebuffer(L, buff, 0) - - -LUAI_FUNC char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n); -LUAI_FUNC void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, - void *data); -LUAI_FUNC size_t luaZ_read (ZIO* z, void *b, size_t n); /* read next n bytes */ - - - -/* --------- Private Part ------------------ */ - -struct Zio { - size_t n; /* bytes still unread */ - const char *p; /* current position in buffer */ - lua_Reader reader; /* reader function */ - void *data; /* additional data */ - lua_State *L; /* Lua state (for reader) */ -}; - - -LUAI_FUNC int luaZ_fill (ZIO *z); - -#endif diff --git a/external/mit/lua/lib/Makefile b/external/mit/lua/lib/Makefile deleted file mode 100644 index 7753ce33d..000000000 --- a/external/mit/lua/lib/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2010/10/31 11:26:01 mbalmer Exp $ - -SUBDIR+= liblua - -.include diff --git a/external/mit/lua/lib/liblua/Makefile b/external/mit/lua/lib/liblua/Makefile deleted file mode 100644 index 93c8e3054..000000000 --- a/external/mit/lua/lib/liblua/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# $NetBSD: Makefile,v 1.8 2015/02/09 20:41:01 christos Exp $ - -LIB= lua -LUA_CORE= lapi.c lcode.c lctype.c ldebug.c ldo.c ldump.c lfunc.c lgc.c \ - llex.c lmem.c lobject.c lopcodes.c lparser.c lstate.c \ - lstring.c ltable.c ltm.c lundump.c lvm.c lzio.c -LUA_LIB= lauxlib.c lbaselib.c lbitlib.c lcorolib.c ldblib.c liolib.c \ - lmathlib.c loslib.c lstrlib.c ltablib.c lutf8lib.c loadlib.c \ - linit.c -SRCS= ${LUA_CORE} ${LUA_LIB} - -.include - -INCS= lauxlib.h lua.h lua.hpp luaconf.h lualib.h -INCSDIR= /usr/include - -CPPFLAGS+= -DLUA_USE_POSIX -DLUA_USE_DLOPEN -DLUA_C89_NUMBERS -CWARNFLAGS.clang+= -Wno-empty-body - -LIBDPLIBS+= m ${NETBSDSRCDIR}/lib/libm - -.PATH: ${NETBSDSRCDIR}/external/mit/lua/dist/src - -.include diff --git a/external/mit/lua/lib/liblua/shlib_version b/external/mit/lua/lib/liblua/shlib_version deleted file mode 100644 index 6b0a45307..000000000 --- a/external/mit/lua/lib/liblua/shlib_version +++ /dev/null @@ -1,3 +0,0 @@ -# $NetBSD: shlib_version,v 1.2 2014/07/19 18:38:34 lneto Exp $ -major=5 -minor=3 diff --git a/external/mit/lua/usr.bin/Makefile b/external/mit/lua/usr.bin/Makefile deleted file mode 100644 index c89f90793..000000000 --- a/external/mit/lua/usr.bin/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2010/10/31 11:26:01 mbalmer Exp $ - -SUBDIR+= lua luac - -.include diff --git a/external/mit/lua/usr.bin/lua/Makefile b/external/mit/lua/usr.bin/lua/Makefile deleted file mode 100644 index 71f1c1474..000000000 --- a/external/mit/lua/usr.bin/lua/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2011/01/19 11:55:50 plunky Exp $ - -PROG= lua -SRCS= lua.c -BINDIR= /usr/bin - -.if defined(__MINIX) -# BJG - lua has to be dynamic to allow loading modules -# Diagnosed by Marc Balmer -LDSTATIC=-dynamic -.endif # defined(__MINIX) - -CPPFLAGS+= -DLUA_USE_READLINE - -LDADD+= -llua -lm -ledit -lterminfo -DPADD+= ${LIBLUA} ${LIBM} ${LIBEDIT} ${LIBTERMINFO} - -.include - -.PATH: ${NETBSDSRCDIR}/external/mit/lua/dist/src \ - ${NETBSDSRCDIR}/external/mit/lua/dist/doc - -.include diff --git a/external/mit/lua/usr.bin/luac/Makefile b/external/mit/lua/usr.bin/luac/Makefile deleted file mode 100644 index c136122f0..000000000 --- a/external/mit/lua/usr.bin/luac/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2014/07/19 18:38:34 lneto Exp $ - -PROG= luac -SRCS= luac.c -BINDIR= /usr/bin - -# -# statically link ${LIBLUA} as "hidden" symbols need to be accessed -# -DPADD+= ${LIBLUA} ${LIBM} -LDADD+= ${LIBLUA} -lm - -.include - -.PATH: ${NETBSDSRCDIR}/external/mit/lua/dist/src \ - ${NETBSDSRCDIR}/external/mit/lua/dist/doc - -.include diff --git a/external/mit/xorg/Makefile.inc b/external/mit/xorg/Makefile.inc deleted file mode 100644 index 85c805ee8..000000000 --- a/external/mit/xorg/Makefile.inc +++ /dev/null @@ -1 +0,0 @@ -LDSTATIC:=-dynamic diff --git a/external/mit/xorg/server/Makefile b/external/mit/xorg/server/Makefile deleted file mode 100644 index c90cf52f9..000000000 --- a/external/mit/xorg/server/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.8 2013/06/12 21:35:29 mrg Exp $ - -# Makefile for modular-xorg-server and drivers - -.include - -.include "xorg-server/Makefile.common" - -SUBDIR= xorg-server - -# We only make drivers if we make the actual Xorg server, -# as opposed to Xvfb and Xnest. -.if ${MKXORG_SERVER} != "no" -SUBDIR+= drivers -.endif - -.include diff --git a/external/mit/xorg/server/Makefile.inc b/external/mit/xorg/server/Makefile.inc deleted file mode 100644 index 308d7b9c3..000000000 --- a/external/mit/xorg/server/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -#__MINIX -.include "../Makefile.inc" - diff --git a/external/mit/xorg/server/drivers/Makefile b/external/mit/xorg/server/drivers/Makefile deleted file mode 100644 index 6a44eca3a..000000000 --- a/external/mit/xorg/server/drivers/Makefile +++ /dev/null @@ -1,284 +0,0 @@ -# $NetBSD: Makefile,v 1.69 2015/09/30 22:58:02 rjs Exp $ - -# xf86-input drivers - -SUBDIR= \ - xf86-input-keyboard \ - xf86-input-mouse \ - #__MINIX: xf86-input-ws - -.if ${MACHINE_ARCH} == "i386" || \ - ${MACHINE_ARCH} == "x86_64" -SUBDIR+= \ - xf86-input-vmmouse - -.if ${MACHINE_ARCH} == "i386" -SUBDIR+= \ - xf86-input-elographics -.endif - -.endif - -# xf86-video drivers - -.include - -.if ${MACHINE_ARCH} == "i386" || \ - ${MACHINE_ARCH} == "x86_64" -SUBDIR+= \ - xf86-video-apm \ - xf86-video-ark \ - xf86-video-ast \ - xf86-video-ati \ - xf86-video-chips \ - xf86-video-cirrus \ - xf86-video-cirrus_alpine \ - xf86-video-cirrus_laguna \ - xf86-video-glint \ - xf86-video-i128 \ - xf86-video-i740 \ - -# needs porting for xorg-server 1.6 -# xf86-video-imstt \ - -#__MINIX: Not Supported -# xf86-video-wsfb \ - -SUBDIR+= \ - xf86-video-intel \ - xf86-video-intel-old \ - xf86-video-mach64 \ - xf86-video-mga \ - xf86-video-neomagic \ - xf86-video-nv \ - xf86-video-openchrome \ - xf86-video-r128 \ - xf86-video-radeon \ - xf86-video-radeon-kms \ - xf86-video-s3 \ - xf86-video-s3virge \ - xf86-video-savage \ - xf86-video-siliconmotion \ - xf86-video-sis \ - xf86-video-tdfx \ - xf86-video-tga \ - xf86-video-trident \ - xf86-video-tseng \ - xf86-video-vmware \ - xf86-video-vesa \ - xf86-video-xgi -# xf86-video-rendition - -.if ${MACHINE_ARCH} == "i386" -SUBDIR+= \ - xf86-video-geode -.endif # ${MACHINE_ARCH} == "i386" - -.endif # ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" - -.if ${MACHINE} == "alpha" -SUBDIR+= \ - xf86-video-apm \ - xf86-video-ark \ - xf86-video-ast \ - xf86-video-ati \ - xf86-video-chips \ - xf86-video-cirrus \ - xf86-video-cirrus_alpine \ - xf86-video-cirrus_laguna \ - xf86-video-glint \ - xf86-video-i128 \ - xf86-video-i740 \ - xf86-video-mach64 \ - xf86-video-mga \ - xf86-video-nv \ - xf86-video-r128 \ - xf86-video-radeon \ - xf86-video-s3 \ - xf86-video-s3virge \ - xf86-video-savage \ - xf86-video-siliconmotion \ - xf86-video-sis \ - xf86-video-tdfx \ - xf86-video-tga \ - xf86-video-trident \ - xf86-video-tseng \ - xf86-video-wsfb -# xf86-video-imstt -.endif # ${MACHINE} == "alpha" - -.if ${MACHINE} == "bebox" -SUBDIR+= \ - xf86-video-cirrus \ - xf86-video-cirrus_alpine \ - xf86-video-mga \ - xf86-video-s3 \ - xf86-video-s3virge -.endif # ${MACHINE} == "bebox" - -.if ${MACHINE} == "cats" -SUBDIR+= \ - xf86-video-apm \ - xf86-video-ark \ - xf86-video-ast \ - xf86-video-ati \ - xf86-video-chips \ - xf86-video-cirrus \ - xf86-video-cirrus_alpine \ - xf86-video-cirrus_laguna \ - xf86-video-glint \ - xf86-video-i128 \ - xf86-video-i740 \ - xf86-video-mga \ - xf86-video-neomagic \ - xf86-video-nv \ - xf86-video-radeon \ - xf86-video-s3 \ - xf86-video-s3virge \ - xf86-video-savage \ - xf86-video-siliconmotion \ - xf86-video-tdfx \ - xf86-video-tga \ - xf86-video-trident \ - xf86-video-tseng \ - xf86-video-vesa \ - xf86-video-wsfb -.endif # ${MACHINE} == "cats" - -.if ${MACHINE} == "dreamcast" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "dreamcast" - -.if ${MACHINE} == "evbarm" -SUBDIR+= \ - #__MINIX: xf86-video-wsfb -.endif # ${MACHINE} == "evbarm" - -.if ${MACHINE} == "evbmips" -SUBDIR+= \ - xf86-video-siliconmotion \ - xf86-video-sis \ - xf86-video-wsfb -.endif # ${MACHINE} == "evbmips" - -.if ${MACHINE} == "ews4800mips" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "ews4800mips" - -.if ${MACHINE} == "hp300" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "hp300" - -.if ${MACHINE} == "hpcarm" || \ - ${MACHINE} == "hpcmips" || \ - ${MACHINE} == "hpcsh" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "hpcarm" || ${MACHINE} == "hpcmips" || ${MACHINE} == "hpcsh" - -.if ${MACHINE} == "luna68k" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "luna68k" - -.if ${MACHINE} == "mac68k" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "mac68k" - -.if ${MACHINE} == "macppc" -SUBDIR+= \ - xf86-video-ati \ - xf86-video-chips \ - xf86-video-mach64 \ - xf86-video-mga \ - xf86-video-nv \ - xf86-video-radeon \ - xf86-video-r128 \ - xf86-video-tdfx \ - xf86-video-wsfb -# xf86-video-imstt -.endif # ${MACHINE} == "macppc" - -.if ${MACHINE} == "netwinder" -SUBDIR+= \ - xf86-video-wsfb -# xf86-video-igs -.endif # ${MACHINE} == "netwinder" - -.if ${MACHINE} == "newsmips" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "newsmips" - -.if ${MACHINE} == "ofppc" -SUBDIR+= \ - xf86-video-ati \ - xf86-video-chips \ - xf86-video-mach64 \ - xf86-video-mga \ - xf86-video-nv \ - xf86-video-radeon \ - xf86-video-r128 \ - xf86-video-tdfx \ - xf86-video-wsfb -.endif # ${MACHINE} == "ofppc" - -.if ${MACHINE} == "prep" -SUBDIR+= \ - xf86-video-cirrus \ - xf86-video-cirrus_alpine \ - xf86-video-mga \ - xf86-video-s3 -.endif # ${MACHINE} == "prep" - -.if ${MACHINE} == "sgimips" -SUBDIR+= \ - xf86-video-crime \ - xf86-video-newport \ - xf86-video-wsfb -.endif # ${MACHINE} == "sgimips" - -.if ${MACHINE} == "shark" -SUBDIR+= \ - xf86-video-chips \ - xf86-video-igs \ - xf86-video-wsfb -.endif # ${MACHINE} == "shark" - -.if ${MACHINE} == "sparc" || \ - ${MACHINE} == "sparc64" -SUBDIR+= \ - xf86-video-ag10e \ - xf86-video-ati \ - xf86-video-glint \ - xf86-video-mach64 \ - xf86-video-mga \ - xf86-video-r128 \ - xf86-video-radeon \ - xf86-video-suncg6 \ - xf86-video-sunffb \ - xf86-video-sunleo \ - xf86-video-wsfb -.if ${MACHINE} == "sparc" -SUBDIR+= \ - xf86-video-pnozz \ - xf86-video-suncg14 \ - xf86-video-suntcx -.endif # ${MACHINE} == "sparc" -.endif # ${MACHINE} == "sparc" || ${MACHINE} == "sparc64" - -.if ${MACHINE} == "vax" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "vax" - -.if ${MACHINE} == "zaurus" -SUBDIR+= \ - xf86-video-wsfb -.endif # ${MACHINE} == "zaurus" - -.include diff --git a/external/mit/xorg/server/drivers/Makefile.xf86-driver b/external/mit/xorg/server/drivers/Makefile.xf86-driver deleted file mode 100644 index 6798b4674..000000000 --- a/external/mit/xorg/server/drivers/Makefile.xf86-driver +++ /dev/null @@ -1,51 +0,0 @@ -# $NetBSD: Makefile.xf86-driver,v 1.19 2010/11/23 08:22:29 mrg Exp $ - -LIBISMODULE= yes -SHLIB_MAJOR= ${PACKAGE_MAJOR} - -.include -.include - -LIB= ${DRIVER_NAME} -LIBDIR= ${X11USRLIBDIR}/modules/drivers - -# Extract version from configure script if not set in makefile. -# -.if defined(DRIVER_VERSION) -PACKAGE_VERSION= ${DRIVER_VERSION} -.else -PRINT_PACKAGE_VERSION= ${TOOL_AWK} '/^PACKAGE_VERSION=/ { \ - match($$1, "[0-9]+\\.[0-9]+\\.[0-9]+"); \ - version = substr($$1, RSTART, RLENGTH); \ - } END { print version }' \ - ${X11SRCDIR.${DRIVER}}/configure - -PACKAGE_VERSION!= ${PRINT_PACKAGE_VERSION} -.endif - -PACKAGE_MAJOR= ${PACKAGE_VERSION:R:R} -PACKAGE_MINOR= ${PACKAGE_VERSION:R:E} -PACKAGE_PATCH= ${PACKAGE_VERSION:E} - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/dri \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include \ - ${X11FLAGS.EXTENSION} \ - ${X11FLAGS.SERVER} \ - -DHAVE_XORG_SERVER_1_1_0 \ - -DSERVER_1_5 \ - -DXSERVER_LIBPCIACCESS \ - -DXFree86LOADER \ - -DHAVE_XEXTPROTO_71 - -CPPFLAGS+= -DPACKAGE_VERSION_MAJOR=${PACKAGE_MAJOR} -CPPFLAGS+= -DPACKAGE_VERSION_MINOR=${PACKAGE_MINOR} -CPPFLAGS+= -DPACKAGE_VERSION_PATCHLEVEL=${PACKAGE_PATCH} -CPPFLAGS+= -DXORG_VERSION_CURRENT=${XORG_VERSION_CURRENT} - -.PATH: ${X11SRCDIR.${DRIVER}}/src -.PATH: ${X11SRCDIR.${DRIVER}}/man - -.include diff --git a/external/mit/xorg/server/drivers/xf86-input-elographics/Makefile b/external/mit/xorg/server/drivers/xf86-input-elographics/Makefile deleted file mode 100644 index 130f25612..000000000 --- a/external/mit/xorg/server/drivers/xf86-input-elographics/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2009/11/28 17:27:30 mbalmer Exp $ - -DRIVER= xf86-input-elographics -DRIVER_NAME= elographics_drv - -SRCS= xf86Elo.c -MAN= elographics.4 - -CPPFLAGS+= -DHAVE_CONFIG_H \ - -I${X11SRCDIR.${DRIVER}}/../include \ - -COPTS.xf86Elo.c= -Wno-error # XXX deprecated - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile b/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile deleted file mode 100644 index 2cb6cc6e4..000000000 --- a/external/mit/xorg/server/drivers/xf86-input-keyboard/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# $NetBSD: Makefile,v 1.15 2013/01/12 18:32:12 macallan Exp $ - -DRIVER= xf86-input-keyboard -DRIVER_NAME= kbd_drv - -SRCS= kbd.c bsd_KbdMap.c bsd_kbd.c at_scancode.c -MAN= kbd.4 - -.include -.if !defined(__MINIX) -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE} == "cats" -CPPFLAGS+= -DPCVT_SUPPORT -.endif - -# turns out we can't use wskbd everywhere without a couple more translation -# tables in the X driver so make it the default only where we know it will work - -.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE} == "sparc" || \ - ${MACHINE} == "sparc64" || ${MACHINE} == "sgimips" || \ - ${MACHINE} == "shark" || ${MACHINE} == "vax" || \ - ${MACHINE} == "evbarm" -CPPFLAGS+= -DDEFAULT_TO_WSKBD -.endif - -CPPFLAGS+= -DWSCONS_SUPPORT -.endif # !defined(__MINIX) -CPPFLAGS+= -DXKB -CPPFLAGS.kbd.c= -D__XKBDEFRULES__=${__XKBDEFRULES__} - -X11EXTRAMANDEFS+= -e 's,__xkb_path__,${X11LIBDIR}/xkb,g' - -COPTS.kbd.c= -Wno-error # XXX deprecated - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-input-mouse/Makefile b/external/mit/xorg/server/drivers/xf86-input-mouse/Makefile deleted file mode 100644 index ef5779690..000000000 --- a/external/mit/xorg/server/drivers/xf86-input-mouse/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2015/07/22 09:49:51 mrg Exp $ - -WARNS?= 2 - -DRIVER= xf86-input-mouse -DRIVER_NAME= mouse_drv - -SRCS= mouse.c pnp.c bsd_mouse.c -MAN= mousedrv.4 - -CPPFLAGS+= -DHAVE_XORG_CONFIG_H -DHAVE_ASPRINTF -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/include - -INCSDIR= ${X11INCDIR}/xorg -INCS= xf86-mouse-properties.h - -PKGCONFIG= xorg-mouse -PKGDIST.xorg-mouse= ${X11SRCDIR.${DRIVER}} - -.include "../Makefile.xf86-driver" - -.PATH: ${X11SRCDIR.${DRIVER}}/include -.PATH: ${X11SRCDIR.${DRIVER}} - -XORG_PKG_VER_PROG= ${DRIVER} -.include "../../../xorg-pkg-ver.mk" diff --git a/external/mit/xorg/server/drivers/xf86-input-synaptics/Makefile b/external/mit/xorg/server/drivers/xf86-input-synaptics/Makefile deleted file mode 100644 index 4b716b972..000000000 --- a/external/mit/xorg/server/drivers/xf86-input-synaptics/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2011/01/29 02:32:36 mrg Exp $ - -DRIVER= xf86-input-synaptics -DRIVER_NAME= synaptics_drv - -SRCS= synaptics.c alpscomm.c ps2comm.c properties.c -#SRCS+= psmcomm.c - -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/include -CPPFLAGS+= -DHAVE_CONFIG_H -I${X11SRCDIR.${DRIVER}}/../include - -MAN= synaptics.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-input-vmmouse/Makefile b/external/mit/xorg/server/drivers/xf86-input-vmmouse/Makefile deleted file mode 100644 index d28318017..000000000 --- a/external/mit/xorg/server/drivers/xf86-input-vmmouse/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2011/10/19 23:07:34 jmcneill Exp $ - -DRIVER= xf86-input-vmmouse -DRIVER_NAME= vmmouse_drv - -SRCS= vmmouse.c vmmouse_client.c vmmouse_proto.c -MAN= vmmouse.4 -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/shared -CPPFLAGS+= -DXINPUT -DHAVE_XORG_SERVER_1_5_0 -CPPFLAGS+= -DABS_VALUATOR_AXES -DNO_MOUSE_MODULE - -COPTS.vmmouse.c= -Wno-error # XXX deprecated - -.include "../Makefile.xf86-driver" -.PATH: ${X11SRCDIR.${DRIVER}}/shared diff --git a/external/mit/xorg/server/drivers/xf86-input-ws/Makefile b/external/mit/xorg/server/drivers/xf86-input-ws/Makefile deleted file mode 100644 index fbfeb9a5e..000000000 --- a/external/mit/xorg/server/drivers/xf86-input-ws/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2012/03/22 23:46:27 joerg Exp $ - -WARNS?= 2 - -DRIVER= xf86-input-ws -DRIVER_NAME= ws_drv - -SRCS= ws.c emumb.c -MAN= ws.4 - -CPPFLAGS+= -DHAVE_CONFIG_H \ - -I${X11SRCDIR.${DRIVER}}/../include \ - -I${X11SRCDIR.${DRIVER}}/include - -CWARNFLAGS.clang+= -Wno-parentheses-equality - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-ag10e/Makefile b/external/mit/xorg/server/drivers/xf86-video-ag10e/Makefile deleted file mode 100644 index 232733ffd..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-ag10e/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/11/11 03:37:27 macallan Exp $ - -DRIVER= xf86-video-ag10e -DRIVER_NAME= ag10e_drv - -SRCS= ag10e_accel.c ag10e_cursor.c ag10e_driver.c -MAN= ag10e.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-apm/Makefile b/external/mit/xorg/server/drivers/xf86-video-apm/Makefile deleted file mode 100644 index 80e2cb53a..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-apm/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/03 07:32:03 rtr Exp $ - -DRIVER= xf86-video-apm -DRIVER_NAME= apm_drv - -SRCS= apm_accel.c apm_cursor.c apm_dga.c apm_driver.c apm_i2c.c -MAN= apm.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-ark/Makefile b/external/mit/xorg/server/drivers/xf86-video-ark/Makefile deleted file mode 100644 index 52ec78f50..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-ark/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2015/07/23 02:04:09 mrg Exp $ - -DRIVER= xf86-video-ark -DRIVER_NAME= ark_drv - -SRCS= ark_accel.c ark_driver.c - -CPPFLAGS+= -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\" -CPPFLAGS+= -DHAVE_XAA_H - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-ast/Makefile b/external/mit/xorg/server/drivers/xf86-video-ast/Makefile deleted file mode 100644 index c7ec25796..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-ast/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2014/03/20 05:32:31 mrg Exp $ - -DRIVER= xf86-video-ast -DRIVER_NAME= ast_drv - -SRCS= ast_2dtool.c ast_accel.c ast_cursor.c ast_driver.c -SRCS+= ast_mode.c ast_tool.c ast_vgatool.c - -CPPFLAGS+= -DHAVE_XAA_H - -CWARNFLAGS.clang+= -Wno-format - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-ati/Makefile b/external/mit/xorg/server/drivers/xf86-video-ati/Makefile deleted file mode 100644 index 6e4bf4aea..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-ati/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2014/07/26 08:04:54 mrg Exp $ - -DRIVER= xf86-video-ati -DRIVER_NAME= ati_drv - -SRCS= ati.c atimodule.c -MAN= ati.4 - -LIBDPLIBS+= drm_radeon ${.CURDIR}/../../../lib/libdrm_radeon - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-chips/Makefile b/external/mit/xorg/server/drivers/xf86-video-chips/Makefile deleted file mode 100644 index 061df0768..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-chips/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2011/05/15 22:55:01 christos Exp $ - -DRIVER= xf86-video-chips -DRIVER_NAME= chips_drv - -SRCS= ct_accel.c ct_bank.c ct_cursor.c ct_ddc.c ct_dga.c -SRCS+= ct_driver.c ct_regs.c ct_shadow.c ct_video.c -SRCS+= ct_accelmm.c ct_accelhi.c -MAN= chips.4 - -.if ${MACHINE} == "shark" -CPPFLAGS+= -DHAVE_ISA -.endif - -CPPFLAGS.ct_driver.c= -DVERSION=${PACKAGE_MAJOR} -I${X11SRCDIR.xorg-server} -CPPFLAGS.ct_accelmm.c= -DCHIPS_MMIO -I${X11SRCDIR.${DRIVER}}/src -CPPFLAGS.ct_accelhi.c= -DCHIPS_MMIO -DCHIPS_HIQV -I${X11SRCDIR.${DRIVER}}/src - -BUILDSYMLINKS= ct_accel.c ct_accelmm.c \ - ct_accel.c ct_accelhi.c - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-cirrus/Makefile b/external/mit/xorg/server/drivers/xf86-video-cirrus/Makefile deleted file mode 100644 index a0f97f116..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-cirrus/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/08/03 09:24:14 rtr Exp $ - -DRIVER= xf86-video-cirrus -DRIVER_NAME= cirrus_drv - -SRCS= cir_dga.c cir_driver.c CirrusClk.c cir_shadow.c -MAN= cirrus.4 - -CPPFLAGS.cir_driver.c= -DVERSION=${PACKAGE_MAJOR} - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-cirrus_alpine/Makefile b/external/mit/xorg/server/drivers/xf86-video-cirrus_alpine/Makefile deleted file mode 100644 index 22e5c26ee..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-cirrus_alpine/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/10/27 20:29:10 veego Exp $ - -# XXX move this under ../xf86-video-cirrus - -DRIVER= xf86-video-cirrus -DRIVER_NAME= cirrus_alpine - -SRCS= alp_driver.c alp.h alp_hwcurs.c alp_i2c.c alp_xaa.c -SRCS+= alp_xaam.c - -#CPPFLAGS.cir_driver.c= -DVERSION=${PACKAGE_MAJOR} - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-cirrus_laguna/Makefile b/external/mit/xorg/server/drivers/xf86-video-cirrus_laguna/Makefile deleted file mode 100644 index 3efe2fe9a..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-cirrus_laguna/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/10/27 20:29:10 veego Exp $ - -# XXX move this under ../xf86-video-cirrus - -DRIVER= xf86-video-cirrus -DRIVER_NAME= cirrus_laguna - -SRCS= lg_driver.c lg_hwcurs.c lg_i2c.c lg_xaa.c - -CPPFLAGS.lg_driver.c= -Wno-error # XXX - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-crime/Makefile b/external/mit/xorg/server/drivers/xf86-video-crime/Makefile deleted file mode 100644 index 8d0968c67..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-crime/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2011/05/23 02:48:48 christos Exp $ - -DRIVER= xf86-video-crime -DRIVER_NAME= crime_drv - -SRCS= crime_driver.c crime_cursor.c crime_accel.c -MAN= crime.4 - -CFLAGS+= -march=mips3 -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/fb - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-geode/Makefile b/external/mit/xorg/server/drivers/xf86-video-geode/Makefile deleted file mode 100644 index 1921d808d..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-geode/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2015/07/20 06:34:29 mrg Exp $ - -DRIVER= xf86-video-geode -DRIVER_NAME= geode_drv - -SRCS= \ - geode_driver.c \ - geode_common.c \ - geode_dcon.c \ - geode_ddc.c \ - geode_msr.c \ - gx_driver.c\ - gx_accel.c \ - gx_cursor.c \ - gx_video.c \ - gx_regacc.c \ - gx_rotate.c \ - gx_randr.c \ - durango.c \ - panel.c \ - lx_driver.c \ - lx_cursor.c \ - lx_memory.c \ - lx_panel.c \ - lx_output.c \ - lx_display.c \ - lx_video.c \ - lx_exa.c \ - cimarron.c -NOMAN= # defined - -CPPFLAGS+= -DHAVE_GX -DHAVE_LX -DAMD_V4L2_VIDEO -DOPT_ACCEL -DPNL_SUP -# This enables multi-mmap support; no idea why it is Linux 2.6 specific -CPPFLAGS+= -DLINUX_2_6 - -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src/cim \ - -I${X11SRCDIR.${DRIVER}}/src/gfx \ - -I${X11SRCDIR.${DRIVER}}/src/panel - -# XXX ugh -CPPFLAGS+= -Doff64_t=off_t -Dlseek64=lseek - -COPTS.gx_randr.c+= -Wno-error # XXX -COPTS.lx_memory.c+= -Wno-error # XXX -COPTS.panel.c+= -Wno-error # XXX -- huh? don't get this one - -.include "../Makefile.xf86-driver" - -XORG_PKG_VER_PROG= ${DRIVER} -.include "../../../xorg-pkg-ver.mk" diff --git a/external/mit/xorg/server/drivers/xf86-video-glint/Makefile b/external/mit/xorg/server/drivers/xf86-video-glint/Makefile deleted file mode 100644 index 090f58713..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-glint/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# $NetBSD: Makefile,v 1.11 2013/06/02 07:41:35 mrg Exp $ - -DRIVER= xf86-video-glint -DRIVER_NAME= glint_drv - -SRCS= glint_dga.c glint_driver.c glint_shadow.c -SRCS+= IBMramdac.c pm2_accel.c pm2_dac.c pm2ramdac.c pm2v_dac.c -SRCS+= pm2_video.c pm2vramdac.c pm3_accel.c pm3_dac.c pm3_video.c -SRCS+= pm_accel.c pm_dac.c sx_accel.c TIramdac.c tx_accel.c tx_dac.c -MAN= glint.4 - -.if ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "sparc" -CPPFLAGS+= -DSPARC_MMIO_IS_BE -.endif - -.if ${MACHINE_ARCH} == "powerpc" -CPPFLAGS+= -DPPC_MMIO_IS_BE -.endif - -CPPFLAGS+= -DHAVE_CONFIG_H -I${X11SRCDIR.${DRIVER}}/../include -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm - -COPTS.glint_driver.c= -Wno-error # XXX xf86dgastr.h - -CWARNFLAGS.clang+= -Wno-format - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-i128/Makefile b/external/mit/xorg/server/drivers/xf86-video-i128/Makefile deleted file mode 100644 index 098d95fb8..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-i128/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/03 07:32:04 rtr Exp $ - -DRIVER= xf86-video-i128 -DRIVER_NAME= i128_drv - -SRCS= i128accel.c i128dga.c i128exa.c i128_driver.c -SRCS+= i128IBMDAC.c i128init.c -MAN= i128.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-i740/Makefile b/external/mit/xorg/server/drivers/xf86-video-i740/Makefile deleted file mode 100644 index c6c9aae8a..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-i740/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2013/06/02 08:57:17 mrg Exp $ - -DRIVER= xf86-video-i740 -DRIVER_NAME= i740_drv - -SRCS= i740_accel.c i740_cursor.c i740_dga.c i740_driver.c -SRCS+= i740_i2c.c i740_io.c i740_video.c -MAN= i740.4 - -CPPFLAGS+= -DHAVE_XAA_H - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-igs/Makefile b/external/mit/xorg/server/drivers/xf86-video-igs/Makefile deleted file mode 100644 index a7ee1c009..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-igs/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2009/11/10 21:44:11 macallan Exp $ - -DRIVER= xf86-video-igs -DRIVER_NAME= igs_drv - -SRCS= igs_driver.c igs_cursor.c igs_accel.c -MAN= igs.4 - -CPPFLAGS+= -DHAVE_CONFIG_H -I${X11SRCDIR.${DRIVER}}/../include - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-imstt/Makefile b/external/mit/xorg/server/drivers/xf86-video-imstt/Makefile deleted file mode 100644 index cdec72fad..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-imstt/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/03 07:32:04 rtr Exp $ - -DRIVER= xf86-video-imstt -DRIVER_NAME= imstt_drv - -SRCS= imstt_accel.c imstt_driver.c -MAN= imstt.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-intel-old/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel-old/Makefile deleted file mode 100644 index e67306ff4..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel-old/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/05/21 00:12:10 rjs Exp $ - -.include - -DRIVER= xf86-video-intel-old -DRIVER_NAME= intel_drv_old - -SRCS= drmmode_display.c i810_accel.c i810_cursor.c i810_dga.c -SRCS+= i810_dri.c i810_driver.c i810_io.c i810_memory.c i810_video.c -SRCS+= i810_wmark.c i830_3d.c i830_accel.c i830_bios.c -SRCS+= i830_batchbuffer.c i830_crt.c i830_cursor.c i830_debug.c -SRCS+= i830_display.c i830_quirks.c i830_driver.c i830_dvo.c -SRCS+= i830_hdmi.c i830_i2c.c i830_io.c i830_lvds.c i830_memory.c -SRCS+= i830_modes.c i830_sdvo.c i830_tv.c i830_uxa.c i830_video.c -SRCS+= i915_3d.c i915_video.c i965_video.c -SRCS+= i830_render.c i915_render.c i965_render.c -SRCS+= i830_dri.c -#SRCS+= i830_hwmc.c i915_hwmc.c i965_hwmc.c - -# uxa -.PATH: ${X11SRCDIR.${DRIVER}}/uxa -SRCS+= uxa-accel.c uxa-unaccel.c uxa-glyphs.c uxa-render.c uxa.c - -MAN= intel.4 - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/uxa -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src/render_program -#CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src/xvmc -CPPFLAGS+= -DI830_XV # -DINTEL_XVMC - -LDADD+= -ldrm_intel - -.include "../Makefile.xf86-driver" - -SUBDIR= ch7017 ch7xxx ivch sil164 tfp410 - -CWARNFLAGS.clang+= -Wno-parentheses -Wno-tautological-compare \ - -Wno-empty-body -Wno-error - -.if defined(__MINIX) -CWARNFLAGS.gcc+= -Wno-deprecated-declarations -.endif # defined(__MINIX) -.include diff --git a/external/mit/xorg/server/drivers/xf86-video-intel-old/Makefile.inc b/external/mit/xorg/server/drivers/xf86-video-intel-old/Makefile.inc deleted file mode 100644 index 3cfaf273c..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel-old/Makefile.inc +++ /dev/null @@ -1,5 +0,0 @@ -.include - -.if defined(__MINIX) -CWARNFLAGS.gcc+= -Wno-deprecated-declarations -.endif # defined(__MINIX) diff --git a/external/mit/xorg/server/drivers/xf86-video-intel-old/ch7017/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel-old/ch7017/Makefile deleted file mode 100644 index 2e346697a..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel-old/ch7017/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/05/21 00:12:10 rjs Exp $ - -DRIVER= xf86-video-intel-old -DRIVER_NAME= ch7017_drv - - -SRCS= ch7017_module.c ch7017.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.include "../../Makefile.xf86-driver" -.PATH: ${X11SRCDIR.${DRIVER}}/src/ch7017 diff --git a/external/mit/xorg/server/drivers/xf86-video-intel-old/ch7xxx/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel-old/ch7xxx/Makefile deleted file mode 100644 index dcfa904c0..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel-old/ch7xxx/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/05/21 00:12:10 rjs Exp $ - -DRIVER= xf86-video-intel-old -DRIVER_NAME= ch7xxx_drv - - -SRCS= ch7xxx_module.c ch7xxx.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.include "../../Makefile.xf86-driver" -.PATH: ${X11SRCDIR.${DRIVER}}/src/ch7xxx diff --git a/external/mit/xorg/server/drivers/xf86-video-intel-old/ivch/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel-old/ivch/Makefile deleted file mode 100644 index cd788d924..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel-old/ivch/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/05/21 00:12:10 rjs Exp $ - -DRIVER= xf86-video-intel-old -DRIVER_NAME= ivch_drv - - -SRCS= ivch_module.c ivch.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.include "../../Makefile.xf86-driver" -.PATH: ${X11SRCDIR.${DRIVER}}/src/ivch diff --git a/external/mit/xorg/server/drivers/xf86-video-intel-old/sil164/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel-old/sil164/Makefile deleted file mode 100644 index b4c98527b..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel-old/sil164/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/05/21 00:12:10 rjs Exp $ - -DRIVER= xf86-video-intel-old -DRIVER_NAME= sil164_drv - - -SRCS= sil164_module.c sil164.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.include "../../Makefile.xf86-driver" -.PATH: ${X11SRCDIR.${DRIVER}}/src/sil164 diff --git a/external/mit/xorg/server/drivers/xf86-video-intel-old/tfp410/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel-old/tfp410/Makefile deleted file mode 100644 index f4395a29d..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel-old/tfp410/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2015/05/21 00:12:10 rjs Exp $ - -DRIVER= xf86-video-intel-old -DRIVER_NAME= tfp410_drv - - -SRCS= tfp410_module.c tfp410.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.include "../../Makefile.xf86-driver" -.PATH: ${X11SRCDIR.${DRIVER}}/src/tfp410 diff --git a/external/mit/xorg/server/drivers/xf86-video-intel/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel/Makefile deleted file mode 100644 index 2ae64b23b..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel/Makefile +++ /dev/null @@ -1,208 +0,0 @@ -# $NetBSD: Makefile,v 1.21 2015/05/14 02:43:33 mrg Exp $ - -.include - -DRIVER= xf86-video-intel -DRIVER_NAME= intel_drv - -# main module -SRCS+= intel_device.c -SRCS+= intel_options.c -SRCS+= intel_module.c -SRCS+= backlight.c -SRCS+= fd.c - -# legacy/i810 -.PATH: ${X11SRCDIR.${DRIVER}}/src/legacy/i810 -SRCS+= i810_accel.c -SRCS+= i810_cursor.c -SRCS+= i810_dga.c -SRCS+= i810_dri.c -SRCS+= i810_driver.c -SRCS+= i810_hwmc.c -SRCS+= i810_memory.c -SRCS+= i810_video.c -SRCS+= i810_wmark.c -SRCS+= i810_xaa.c - -.if !defined(__MINIX) -# sna -.PATH: ${X11SRCDIR.${DRIVER}}/src/sna -SRCS+= blt.c -SRCS+= kgem.c -SRCS+= gen2_render.c -SRCS+= gen3_render.c -SRCS+= gen4_common.c -SRCS+= gen4_render.c -SRCS+= gen4_source.c -SRCS+= gen4_vertex.c -SRCS+= gen5_render.c -SRCS+= gen6_common.c -SRCS+= gen6_render.c -SRCS+= gen7_render.c -SRCS+= gen8_eu.c -SRCS+= gen8_render.c -SRCS+= gen8_vertex.c - -SRCS+= sna_accel.c -SRCS+= sna_acpi.c -SRCS+= sna_blt.c -SRCS+= sna_composite.c -SRCS+= sna_cpu.c -SRCS+= sna_damage.c -SRCS+= sna_display.c -SRCS+= sna_display_fake.c -SRCS+= sna_dri2.c -#SRCS+= sna_dri3.c -SRCS+= sna_driver.c -SRCS+= sna_glyphs.c -SRCS+= sna_gradient.c -SRCS+= sna_io.c -#SRCS+= sna_present.c -SRCS+= sna_render.c -SRCS+= sna_stream.c -SRCS+= sna_threads.c -SRCS+= sna_tiling.c -SRCS+= sna_transform.c -SRCS+= sna_trapezoids.c -SRCS+= sna_trapezoids_boxes.c -SRCS+= sna_trapezoids_imprecise.c -SRCS+= sna_trapezoids_mono.c -SRCS+= sna_trapezoids_precise.c -SRCS+= sna_vertex.c -SRCS+= sna_video.c -SRCS+= sna_video_hwmc.c -SRCS+= sna_video_overlay.c -SRCS+= sna_video_sprite.c -SRCS+= sna_video_textured.c - -# sna/brw -.PATH: ${X11SRCDIR.${DRIVER}}/src/sna/brw -SRCS+= brw_disasm.c -SRCS+= brw_eu.c -SRCS+= brw_eu_emit.c -SRCS+= brw_sf.c -SRCS+= brw_wm.c - -# sna/fb -.PATH: ${X11SRCDIR.${DRIVER}}/src/sna/fb -SRCS+= fbarc.c -SRCS+= fbbitmap.c -SRCS+= fbblt.c -SRCS+= fbbltone.c -SRCS+= fbclip.c -SRCS+= fbcopy.c -SRCS+= fbfill.c -SRCS+= fbgc.c -SRCS+= fbglyph.c -SRCS+= fbimage.c -SRCS+= fbline.c -SRCS+= fbpict.c -SRCS+= fbpoint.c -SRCS+= fbpush.c -SRCS+= fbseg.c -SRCS+= fbspan.c -SRCS+= fbstipple.c -SRCS+= fbtile.c -SRCS+= fbutil.c -.endif # !defined(__MINIX) - -# uxa -.PATH: ${X11SRCDIR.${DRIVER}}/src/uxa -SRCS+= i830_3d.c -SRCS+= i830_render.c -SRCS+= i915_3d.c -SRCS+= i915_render.c -SRCS+= i915_video.c -SRCS+= i965_3d.c -SRCS+= i965_render.c -SRCS+= i965_video.c -SRCS+= intel_batchbuffer.c -SRCS+= intel_display.c -SRCS+= intel_dri.c -SRCS+= intel_driver.c -SRCS+= intel_hwmc.c -SRCS+= intel_memory.c -#SRCS+= intel_present.c -#SRCS+= intel_sync.c -SRCS+= intel_uxa.c -SRCS+= intel_uxa_video.c -SRCS+= intel_video.c -SRCS+= intel_video_overlay.c -SRCS+= uxa-accel.c -SRCS+= uxa-glyphs.c -SRCS+= uxa-render.c -SRCS+= uxa-unaccel.c -SRCS+= uxa.c - -MAN= intel.4 - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src/render_program -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/xvmc - -# Use the Intel-style __sync_* atomic primitives. - -CPPFLAGS+= -DDEFAULT_ACCEL_METHOD=SNA -CPPFLAGS+= -DENABLE_XVMC=1 -CPPFLAGS+= -DHAS_PIXMAN_GLYPHS=1 -CPPFLAGS+= -DHAS_PIXMAN_TRIANGLES=1 -CPPFLAGS+= -DHAVE_ATOMIC_PRIMITIVES=1 -CPPFLAGS+= -DHAVE_CPUID_H=1 -CPPFLAGS+= -DHAVE_DGAPROC_H=1 -CPPFLAGS+= -DHAVE_DLFCN_H=1 -CPPFLAGS+= -DHAVE_DRI1=1 -CPPFLAGS+= -DHAVE_DRI2=1 -CPPFLAGS+= -DHAVE_DRI2_H=1 -CPPFLAGS+= -DHAVE_DRISTRUCT_H=1 -CPPFLAGS+= -DHAVE_DRI_H=1 -CPPFLAGS+= -DHAVE_GETLINE=1 -CPPFLAGS+= -DHAVE_INTTYPES_H=1 -CPPFLAGS+= -DHAVE_MEMORY_H=1 -CPPFLAGS+= -DHAVE_SAREA_H=1 -CPPFLAGS+= -DHAVE_STDINT_H=1 -CPPFLAGS+= -DHAVE_STDLIB_H=1 -CPPFLAGS+= -DHAVE_STRINGS_H=1 -CPPFLAGS+= -DHAVE_STRING_H=1 -CPPFLAGS+= -DHAVE_STRLCAT=1 -CPPFLAGS+= -DHAVE_STRLCPY=1 -CPPFLAGS+= -DHAVE_STRNDUP=1 -CPPFLAGS+= -DHAVE_SYS_IPC_H=1 -CPPFLAGS+= -DHAVE_SYS_STAT_H=1 -CPPFLAGS+= -DHAVE_SYS_TYPES_H=1 -CPPFLAGS+= -DHAVE_UNISTD_H=1 -CPPFLAGS+= -DHAVE_VGAHW_H=1 -CPPFLAGS+= -DHAVE_XAA_H=1 -CPPFLAGS+= -DKMS=1 -CPPFLAGS+= -DSTDC_HEADERS=1 -CPPFLAGS+= -DUMS=1 -CPPFLAGS+= -DUSE_BACKLIGHT=1 -CPPFLAGS+= -DUSE_SNA=1 -CPPFLAGS+= -DUSE_UXA=1 - -# XXX This should not be hard-coded here... -DRI_DRIVER_PATH= /usr/X11R7/lib/modules/dri -CPPFLAGS+= -DDRI_DRIVER_PATH=\"${DRI_DRIVER_PATH:Q}\" - -# XXX Probably better to set this in Makefile.xf86-driver, conditional -# on ELF &c. -CFLAGS+= -fvisibility=hidden - -LIBDPLIBS+= drm_intel ${.CURDIR}/../../../lib/libdrm_intel -# MINIX: No pthread -#LIBDPLIBS+= pthread ${NETBSDSRCDIR}/lib/libpthread - -.include "../Makefile.xf86-driver" - -CWARNFLAGS.clang+= -Wno-parentheses -Wno-tautological-compare \ - -Wno-empty-body -Wno-error - -COPTS.sna_display.c= -Wno-stack-protector -#LSC: Clang/Minix3 -DBG= -O0 -NOCLANGERROR?= yes - -.include diff --git a/external/mit/xorg/server/drivers/xf86-video-intel/ch7017/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel/ch7017/Makefile deleted file mode 100644 index 0e61408d3..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel/ch7017/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2010/05/23 01:59:13 mrg Exp $ - -DRIVER= xf86-video-intel -DRIVER_NAME= ch7017_drv - - -SRCS= ch7017_module.c ch7017.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -.include "../../Makefile.xf86-driver" - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.PATH: ${X11SRCDIR.${DRIVER}}/src/ch7017 diff --git a/external/mit/xorg/server/drivers/xf86-video-intel/ch7xxx/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel/ch7xxx/Makefile deleted file mode 100644 index 338bb214c..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel/ch7xxx/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2010/05/23 01:59:13 mrg Exp $ - -DRIVER= xf86-video-intel -DRIVER_NAME= ch7xxx_drv - - -SRCS= ch7xxx_module.c ch7xxx.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -.include "../../Makefile.xf86-driver" - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.PATH: ${X11SRCDIR.${DRIVER}}/src/ch7xxx diff --git a/external/mit/xorg/server/drivers/xf86-video-intel/ivch/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel/ivch/Makefile deleted file mode 100644 index 8c8525a56..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel/ivch/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2010/05/23 01:59:13 mrg Exp $ - -DRIVER= xf86-video-intel -DRIVER_NAME= ivch_drv - - -SRCS= ivch_module.c ivch.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -.include "../../Makefile.xf86-driver" - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.PATH: ${X11SRCDIR.${DRIVER}}/src/ivch diff --git a/external/mit/xorg/server/drivers/xf86-video-intel/sil164/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel/sil164/Makefile deleted file mode 100644 index 2242d008f..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel/sil164/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2010/05/23 01:59:13 mrg Exp $ - -DRIVER= xf86-video-intel -DRIVER_NAME= sil164_drv - - -SRCS= sil164_module.c sil164.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -.include "../../Makefile.xf86-driver" - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.PATH: ${X11SRCDIR.${DRIVER}}/src/sil164 diff --git a/external/mit/xorg/server/drivers/xf86-video-intel/tfp410/Makefile b/external/mit/xorg/server/drivers/xf86-video-intel/tfp410/Makefile deleted file mode 100644 index 2817a94be..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-intel/tfp410/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2010/05/23 01:59:13 mrg Exp $ - -DRIVER= xf86-video-intel -DRIVER_NAME= tfp410_drv - - -SRCS= tfp410_module.c tfp410.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri - -.include "../../Makefile.xf86-driver" - -#LSC: Clang/Minix3 -NOCLANGERROR?= yes - -.PATH: ${X11SRCDIR.${DRIVER}}/src/tfp410 diff --git a/external/mit/xorg/server/drivers/xf86-video-mach64/Makefile b/external/mit/xorg/server/drivers/xf86-video-mach64/Makefile deleted file mode 100644 index 6b16a0af5..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-mach64/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# $NetBSD: Makefile,v 1.8 2015/07/20 01:17:46 mrg Exp $ - -DRIVER= xf86-video-mach64 -DRIVER_NAME= mach64_drv - -SRCS= atibus.c atichip.c atiprobe.c atividmem.c \ - atiadjust.c aticlock.c aticonfig.c \ - aticonsole.c atidac.c atidsp.c \ - atii2c.c atilock.c atimach64.c atimach64accel.c \ - atimach64cursor.c atimach64i2c.c atimach64io.c \ - atimach64xv.c atimode.c atipreinit.c atiprint.c \ - atirgb514.c atiscreen.c atituner.c atiutil.c \ - ativalid.c atiload.c atimisc.c atimach64probe.c \ - ${SRCS.cpio} ${SRCS.dga} ${SRCS.exa} #${SRCS.dri} - -SRCS.cpio= ativga.c ativgaio.c atibank.c atiwonder.c atiwonderio.c -SRCS.dga= atidga.c -SRCS.dri= atidri.c -SRCS.exa= atimach64exa.c - -CPPFLAGS+= -DUSE_XAA -DUSE_EXA - -.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE_ARCH} == "sparc64" || \ - ${MACHINE_ARCH} == "sparc" -CPPFLAGS+= -DAVOID_CPIO -.endif - -MAN= # defined - -CWARNFLAGS.clang+= -Wno-pointer-sign - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-mga/Makefile b/external/mit/xorg/server/drivers/xf86-video-mga/Makefile deleted file mode 100644 index 08e2daf31..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-mga/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# $NetBSD: Makefile,v 1.12 2014/03/20 05:32:31 mrg Exp $ - -.include - -DRIVER= xf86-video-mga -DRIVER_NAME= mga_drv - -SRCS= mga_bios.c mga_dac3026.c mga_dacG.c -SRCS+= mga_dga.c mga_dh.c mga_driver.c mga_g450pll.c -SRCS+= mga_halmod.c mga_hwcurs.c mga_merge.c mga_shadow.c -SRCS+= mga_vga.c mga_video.c mga_storm.c -MAN= mga.4 - -.if ${X11DRI} != "no" -#SRCS+= mga_dri.c -.endif - -#if USE_EXA -SRCS+= mga_exa.c -CPPFLAGS+= -DUSE_EXA -#endif - -#if USE_XAA -SRCS+= mga_arc.c -CPPFLAGS+= -DUSE_XAA -DHAVE_XAA_H -#endif - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -#CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm - -CPPFLAGS.mga_driver.c= -Wno-error # XXX fix me please -CPPFLAGS.mga_dacG.c= -Wno-error # XXX fix me please - -CWARNFLAGS.clang+= -Wno-conversion -Wno-format -Wno-empty-body - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-neomagic/Makefile b/external/mit/xorg/server/drivers/xf86-video-neomagic/Makefile deleted file mode 100644 index bfa16a0e2..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-neomagic/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2013/06/02 08:57:17 mrg Exp $ - -DRIVER= xf86-video-neomagic -DRIVER_NAME= neomagic_drv - -SRCS= neo_2070.c neo_2090.c neo_2097.c neo_2200.c -SRCS+= neo_cursor.c neo_dga.c neo_driver.c neo_i2c.c -SRCS+= neo_shadow.c neo_video.c -MAN= neomagic.4 - -COPTS.neo_driver.c= -Wno-error # XXX xf86dgastr.h - -CPPFLAGS+= -DHAVE_XAA_H - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-newport/Makefile b/external/mit/xorg/server/drivers/xf86-video-newport/Makefile deleted file mode 100644 index 310e442d9..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-newport/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2009/02/14 03:15:15 macallan Exp $ - -DRIVER= xf86-video-newport -DRIVER_NAME= newport_drv - -SRCS= newport_accel.c newport_cmap.c newport_cursor.c \ - newport_driver.c newport_regs.c newport_shadow.c - -CPPFLAGS+= ${X11FLAGS.DRI} - -MAN= newport.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-nsc/Makefile b/external/mit/xorg/server/drivers/xf86-video-nsc/Makefile deleted file mode 100644 index c434e1f6d..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-nsc/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2009/06/12 04:40:22 mrg Exp $ - -DRIVER= xf86-video-nsc -DRIVER_NAME= nsc_drv - -SRCS= durango.c nsc_driver.c nsc_galstub.c -SRCS+= nsc_gx1_accel.c nsc_gx1_cursor.c nsc_gx1_dga.c -SRCS+= nsc_gx1_driver.c nsc_gx1_shadow.c nsc_gx1_video.c -SRCS+= nsc_gx2_accel.c nsc_gx2_cursor.c nsc_gx2_dga.c -SRCS+= nsc_gx2_driver.c nsc_gx2_shadow.c nsc_gx2_video.c -SRCS+= panel.c -MAN= nsc.4 - -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src/gfx -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src/panel - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-nv/Makefile b/external/mit/xorg/server/drivers/xf86-video-nv/Makefile deleted file mode 100644 index 845cf865e..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-nv/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2014/08/13 22:48:15 macallan Exp $ - -DRIVER= xf86-video-nv -DRIVER_NAME= nv_drv - -SRCS= nv_cursor.c nv_dac.c nv_dga.c nv_driver.c nv_hw.c -SRCS+= nv_setup.c nv_shadow.c nv_video.c nv_xaa.c riva_cursor.c -SRCS+= riva_dac.c riva_dga.c riva_driver.c riva_hw.c -SRCS+= riva_setup.c riva_shadow.c riva_xaa.c g80_cursor.c -SRCS+= g80_dac.c g80_display.c g80_dma.c g80_driver.c g80_exa.c -SRCS+= g80_output.c g80_sor.c g80_xaa.c -MAN= nv.4 - -.if ${MACHINE} == "macppc" -CPPFLAGS+= -DAVOID_VGAHW -.endif - -.if ${MACHINE} == "i386" || ${MACHINE} == "amd64" -# XXX -# the test uses pci_device_has_kernel_driver() which, for now at least, only -# makes sense on x86 ( it just checks if the kernel driver handling the -# device is vga ) - and even there, genfb and the like don't do anything -# that would prevent this driver from working. Might need to revisit this once -# the new DRM2 code has nvidia support -#CPPFLAGS+= -DNV_TEST_FOR_KERNEL_DRIVER -.endif - -CPPFLAGS+= -DHAVE_XAA_H - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-nvxbox/Makefile b/external/mit/xorg/server/drivers/xf86-video-nvxbox/Makefile deleted file mode 100644 index 5d9712d3e..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-nvxbox/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/10/12 03:09:10 rtr Exp $ - -DRIVER= xf86-video-nvxbox -DRIVER_NAME= nvxbox_drv - -SRCS= nv_dac.c nv_driver.c nv_setup.c nv_xaa.c \ - nv_cursor.c nv_dga.c nv_shadow.c nv_video.c \ - riva_hw.c - -MAN= # XXX dist is not nvxbox.man??? nvxbox.4 - -COPTS.nv_video.c= -Wno-error - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile b/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile deleted file mode 100644 index ffa4f5d25..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-openchrome/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2014/08/24 06:13:36 mrg Exp $ - -DRIVER= xf86-video-openchrome -DRIVER_NAME= openchrome_drv - -SRCS= \ - via_3d.c \ - via_exa.c \ - via_exa_h2.c \ - via_exa_h6.c \ - via_bandwidth.c \ - via_ch7xxx.c \ - via_display.c \ - via_driver.c \ - via_i2c.c \ - via_id.c \ - via_lvds.c \ - via_memcpy.c \ - via_memmgr.c \ - via_outputs.c \ - via_xv_overlay.c \ - via_ums.c \ - via_vbe.c \ - via_vgahw.c \ - via_xv.c \ - via_vt162x.c - -# DRI -SRCS+= \ - via_dri.c \ - via_kms.c \ - via_xvmc.c - -MAN= openchrome.4 - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src -CPPFLAGS+= -DHAVE_CONFIG_H -I${X11SRCDIR.${DRIVER}}/../include - -.include "../Makefile.xf86-driver" - -# XXX -.if defined(HAVE_GCC) -COPTS.via_dri.c+= -Wno-error -.endif - -CWARNFLAGS.clang+= -Wno-tautological-compare diff --git a/external/mit/xorg/server/drivers/xf86-video-pnozz/Makefile b/external/mit/xorg/server/drivers/xf86-video-pnozz/Makefile deleted file mode 100644 index 97aa790c5..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-pnozz/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2009/08/26 22:30:46 macallan Exp $ - -DRIVER= xf86-video-pnozz -DRIVER_NAME= pnozz_drv - -SRCS= pnozz_driver.c pnozz_cursor.c pnozz_accel.c - -CPPFLAGS+= ${X11FLAGS.DRI} - -MAN= pnozz.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-r128/Makefile b/external/mit/xorg/server/drivers/xf86-video-r128/Makefile deleted file mode 100644 index e1417341a..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-r128/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# $NetBSD: Makefile,v 1.10 2015/07/30 02:58:00 macallan Exp $ - -DRIVER= xf86-video-r128 -DRIVER_NAME= r128_drv - -SRCS= r128_accel.c r128_cursor.c r128_driver.c r128_exa.c \ - r128_crtc.c r128_output.c \ - r128_video.c r128_misc.c r128_probe.c r128_dri.c - -MAN= r128.4 - -.if ${MACHINE_ARCH} == "powerpc" || ${MACHINE} == "sparc64" -CPPFLAGS+= -DAVOID_FBDEV -.endif - -# Enable VGA support (esp. hw state save/restore) on i386 / amd64 platforms -.if ${MACHINE} == "amd64" || ${MACHINE} == "i386" -CPPFLAGS+= -DWITH_VGAHW -.endif - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm - -CPPFLAGS+= -DHAVE_XAA_H -DUSE_EXA -DR128DRI - -CWARNFLAGS.clang+= -Wno-format -Wno-pointer-sign - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-radeon-kms/Makefile b/external/mit/xorg/server/drivers/xf86-video-radeon-kms/Makefile deleted file mode 100644 index 9245e46b2..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-radeon-kms/Makefile +++ /dev/null @@ -1,56 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2015/09/19 23:00:44 wiz Exp $ - -.include - -DRIVER= xf86-video-ati-kms -DRIVER_NAME= radeon_drv - -.PATH: ${X11SRCDIR.${DRIVER}}/src/AtomBios -SRCS.ATOMBIOS= \ - CD_Operations.c \ - Decoder.c \ - hwserv_drv.c - -.if ${X11DRI} != "no" -SRCS.DRI= radeon_dri.c -CPPFLAGS+= ${X11FLAGS.DRI} -.endif - -.if ${X11DRI} != "no" -# XXX -. if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -SRCS.KMS= radeon_dri2.c radeon_kms.c drmmode_display.c radeon_vbo.c -CPPFLAGS+= -DXF86DRM_MODE -LIBDPLIBS+= drm_radeon ${.CURDIR}/../../../lib/libdrm_radeon -. endif -.endif - -SRCS.EXA= radeon_exa.c r600_exa.c r6xx_accel.c \ - r600_textured_videofuncs.c r600_shader.c radeon_exa_shared.c \ - evergreen_exa.c evergreen_accel.c evergreen_shader.c \ - evergreen_textured_videofuncs.c cayman_accel.c cayman_shader.c -SRCS.KMS= radeon_dri2.c radeon_kms.c drmmode_display.c radeon_vbo.c \ - radeon_bo_helper.c -# XXX not yet -SRCS.GLAMOR= radeon_glamor.c - -SRCS= radeon_accel.c radeon_video.c \ - radeon_misc.c radeon_probe.c \ - radeon_textured_video.c radeon_xvmc.c \ - $(SRCS.EXA) \ - $(SRCS.KMS) - -MAN= radeon.4 -MANSUBDIR= /x86 - -CPPFLAGS+= -DHAVE_CONFIG_H -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/dri \ - -I${DESTDIR}${X11INCDIR}/libdrm \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.${DRIVER}}/../include - -# XXX -COPTS+= -Wno-error - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-radeon/Makefile b/external/mit/xorg/server/drivers/xf86-video-radeon/Makefile deleted file mode 100644 index fe4c3176b..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-radeon/Makefile +++ /dev/null @@ -1,62 +0,0 @@ -# $NetBSD: Makefile,v 1.19 2015/05/28 14:36:45 rjs Exp $ - -.include - -DRIVER= xf86-video-ati -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -DRIVER_NAME= radeon_drv_old -.else -DRIVER_NAME= radeon_drv -.endif - -.PATH: ${X11SRCDIR.${DRIVER}}/src/AtomBios -SRCS.ATOMBIOS= \ - CD_Operations.c \ - Decoder.c \ - hwserv_drv.c - -.if ${X11DRI} != "no" -SRCS.DRI= radeon_dri.c -CPPFLAGS+= ${X11FLAGS.DRI} -.endif - -.if ${X11DRI} != "no" -# XXX -. if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -SRCS.KMS= radeon_dri2.c radeon_kms.c drmmode_display.c radeon_vbo.c -CPPFLAGS+= -DXF86DRM_MODE -LIBDPLIBS+= drm_radeon ${.CURDIR}/../../../lib/libdrm_radeon -. endif -.endif - -SRCS.EXA= radeon_exa.c r600_exa.c r6xx_accel.c \ - r600_textured_videofuncs.c r600_shader.c \ - radeon_exa_shared.c \ - evergreen_exa.c evergreen_accel.c evergreen_shader.c \ - evergreen_textured_videofuncs.c \ - cayman_accel.c cayman_shader.c - -SRCS= radeon_accel.c radeon_cursor.c \ - radeon_driver.c radeon_video.c radeon_bios.c \ - radeon_mm_i2c.c radeon_vip.c radeon_misc.c radeon_probe.c \ - legacy_crtc.c legacy_output.c radeon_textured_video.c \ - radeon_crtc.c radeon_output.c radeon_modes.c radeon_tv.c \ - radeon_legacy_memory.c radeon_pm.c radeon_xvmc.c \ - $(SRCS.ATOMBIOS) radeon_atombios.c radeon_atomwrapper.c \ - $(SRCS.DRI) $(SRCS.EXA) atombios_output.c atombios_crtc.c \ - $(SRCS.KMS) -MAN= radeon.4 - -CPPFLAGS+= -DDISABLE_EASF -DENABLE_ALL_SERVICE_FUNCTIONS \ - -DATOM_BIOS -DATOM_BIOS_PARSER -DDRIVER_PARSER \ - -DHAVE_CONFIG_H -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src/AtomBios/includes \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/dri \ - -I${DESTDIR}${X11INCDIR}/libdrm \ - -I${X11SRCDIR.${DRIVER}}/../include - -# XXX -COPTS+= -Wno-error - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-rendition/Makefile b/external/mit/xorg/server/drivers/xf86-video-rendition/Makefile deleted file mode 100644 index ee69bc947..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-rendition/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/08/03 09:24:14 rtr Exp $ - -DRIVER= xf86-video-rendition -DRIVER_NAME= rendition_drv - -SRCS= accelX.c hwcursor.c rendition.c rendition_shadow.c -SRCS+= v1krisc.c vboard.c vloaduc.c vmisc.c vmodes.c vramdac.c -MAN= rendition.4 - -CPPFLAGS.vboard.c= -DMODULEDIR=\"${X11USRLIBDIR}/modules/\" - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-s3/Makefile b/external/mit/xorg/server/drivers/xf86-video-s3/Makefile deleted file mode 100644 index 5f2739765..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-s3/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# $NetBSD: Makefile,v 1.11 2013/06/03 08:51:18 mrg Exp $ - -DRIVER= xf86-video-s3 -DRIVER_NAME= s3_drv -DRIVER_VERSION= 0.6.3 - -SRCS= s3_bios.c s3_cursor.c s3_dga.c s3_driver.c s3_IBMRGB.c \ - s3_Ti.c s3_Trio64DAC.c s3_video.c s3_accel.c \ - s3_accel_newmmio.c s3_shadow.c -SRCS+= s3_GENDAC.c -MAN= s3.4 - -# PLEASE NOTE: s3_accel.c is compiled two times with different -# cpp macros for PIO and NEWMMIO support. Check Makefile.am -# before upgrading the driver. -# -BUILDSYMLINKS= s3_accel.c s3_accel_newmmio.c -CPPFLAGS.s3_accel_newmmio.c+= -DS3_NEWMMIO=1 \ - -I${X11SRCDIR.xf86-video-s3}/src -CPPFLAGS.s3_video.c+= -DS3_NEWMMIO=1 \ - -CPPFLAGS+= -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\" -CPPFLAGS+= -DHAVE_XAA_H - -CWARNFLAGS.clang+= -Wno-parentheses - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-s3virge/Makefile b/external/mit/xorg/server/drivers/xf86-video-s3virge/Makefile deleted file mode 100644 index 9f8d63c69..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-s3virge/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2011/08/11 23:15:40 joerg Exp $ - -DRIVER= xf86-video-s3virge -DRIVER_NAME= s3virge_drv - -SRCS= s3v_accel.c s3v_dac.c s3v_dga.c s3v_driver.c s3v_hwcurs.c -SRCS+= s3v_i2c.c s3v_shadow.c s3v_xv.c -MAN= s3virge.4 - -CPPFLAGS+= -DPACKAGE_VERSION=\"${PACKAGE_VERSION}\" - -CWARNFLAGS.clang+= -Wno-parentheses - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-savage/Makefile b/external/mit/xorg/server/drivers/xf86-video-savage/Makefile deleted file mode 100644 index f1939c45c..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-savage/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# $NetBSD: Makefile,v 1.13 2014/03/19 23:46:05 mrg Exp $ - -DRIVER= xf86-video-savage -DRIVER_NAME= savage_drv - -SRCS= \ - savage_accel.c \ - savage_xaa.c \ - savage_exa.c \ - savage_cursor.c \ - savage_dga.c \ - savage_driver.c \ - savage_i2c.c \ - savage_shadow.c \ - savage_streams.c \ - savage_vbe.c \ - savage_video.c \ - savage_hwmc.c \ - savage_dri.c -MAN= savage.4 - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm - -CPPFLAGS+= -DHAVE_XAA_H -DSAVAGEDRI - -CPPFLAGS.savage_driver.c= -DPACKAGE_VERSION=\"${PACKAGE_MAJOR}\" -CPPFLAGS.savage_exa.c= -Wno-error # volatile -> mempcy - -CWARNFLAGS.clang+= -Wno-parentheses -Wno-format \ - -Wno-constant-logical-operand - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-siliconmotion/Makefile b/external/mit/xorg/server/drivers/xf86-video-siliconmotion/Makefile deleted file mode 100644 index fab7ae59b..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-siliconmotion/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2015/07/20 02:07:36 mrg Exp $ - -DRIVER= xf86-video-siliconmotion -DRIVER_NAME= siliconmotion_drv - -SRCS= smi_501.c smi_accel.c smi_xaa.c smi_exa.c smi_dac.c -SRCS+= smi_driver.c smi_i2c.c smi_video.c -SRCS+= smi_crtc.c smilynx_crtc.c smi_output.c -SRCS+= smilynx_output.c smilynx_hw.c smilynx.h -SRCS+= smi501_crtc.c smi501_output.c -MAN= siliconmotion.4 - -CPPFLAGS+= -DHAVE_XAA_H -DHAVE_XMODES -DHAVE_XEXTPROTO_71 - -.include "../Makefile.xf86-driver" - -XORG_PKG_VER_PROG= ${DRIVER} -.include "../../../xorg-pkg-ver.mk" diff --git a/external/mit/xorg/server/drivers/xf86-video-sis/Makefile b/external/mit/xorg/server/drivers/xf86-video-sis/Makefile deleted file mode 100644 index 81ad110e4..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-sis/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $NetBSD: Makefile,v 1.10 2011/08/11 23:15:40 joerg Exp $ - -DRIVER= xf86-video-sis -DRIVER_NAME= sis_drv - -SRCS= init301.c init.c initextx.c sis300_accel.c -SRCS+= sis310_accel.c sis6326_video.c sis_accel.c sis_cursor.c -SRCS+= sis_dac.c sis_dga.c sis_driver.c sis_memcpy.c sis_opt.c -SRCS+= sis_setup.c sis_shadow.c sis_utility.c sis_vb.c -SRCS+= sis_vga.c sis_video.c -MAN= sis.4 - -CPPFLAGS+= -DHAVE_CONFIG_H -I${X11SRCDIR.${DRIVER}}/../include -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/src -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm - -# XXX -COPTS.sis_driver.c= -Wno-error - -X11MANCPP= yes - -CWARNFLAGS.clang+= -Wno-parentheses - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile b/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile deleted file mode 100644 index aae4d3034..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-suncg14/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2013/06/25 12:27:41 macallan Exp $ - -DRIVER= xf86-video-suncg14 -DRIVER_NAME= suncg14_drv - -SRCS= cg14_driver.c cg14_cursor.c cg14_accel.c cg14_render.c -MAN= suncg14.4 - -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/../include -CPPFLAGS+= -DHAVE_XAA_H - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-suncg6/Makefile b/external/mit/xorg/server/drivers/xf86-video-suncg6/Makefile deleted file mode 100644 index c2afb8c3c..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-suncg6/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2013/06/04 22:45:08 mrg Exp $ - -DRIVER= xf86-video-suncg6 -DRIVER_NAME= suncg6_drv - -SRCS= cg6_driver.c cg6_cursor.c cg6_accel.c - -CPPFLAGS+= ${X11FLAGS.DRI} -CPPFLAGS+= -DHAVE_XAA_H - -MAN= suncg6.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-sunffb/Makefile b/external/mit/xorg/server/drivers/xf86-video-sunffb/Makefile deleted file mode 100644 index 4b2d3fd21..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-sunffb/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2015/08/16 17:48:24 macallan Exp $ - -DRIVER= xf86-video-sunffb -DRIVER_NAME= sunffb_drv - -SRCS= ffb_accel.c ffb_dac.c ffb_driver.c ffb_wid.c ffb_attr.c \ - ffb_ddc.c ffb_cursor.c ffb_dga.c ffb_exa.c \ - ffb_accel_common.c \ - VISmoveImage.s ffb_asm.s - -.if ${MACHINE_ARCH} == "sparc64" -AFLAGS+= -x assembler-with-cpp -Wa,-Av9a -.endif - -.if ${MACHINE_ARCH} == "sparc" -AFLAGS+= -x assembler-with-cpp -Wa,-Av8plusa -COPTS= -mv8plus -.endif - -CPPFLAGS+= ${X11FLAGS.DRI} -DUSE_VIS -CPPFLAGS+= -DHAVE_XAA_H - -MAN= sunffb.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-sunleo/Makefile b/external/mit/xorg/server/drivers/xf86-video-sunleo/Makefile deleted file mode 100644 index f11ee58f9..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-sunleo/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2013/06/04 22:45:08 mrg Exp $ - -DRIVER= xf86-video-sunleo -DRIVER_NAME= sunleo_drv - -SRCS= leo_accel.c leo_cursor.c leo_driver.c - -CPPFLAGS+= ${X11FLAGS.DRI} -CPPFLAGS+= -DHAVE_XAA_H - -MAN= sunleo.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-suntcx/Makefile b/external/mit/xorg/server/drivers/xf86-video-suntcx/Makefile deleted file mode 100644 index d600e333d..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-suntcx/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2013/06/04 22:45:08 mrg Exp $ - -DRIVER= xf86-video-suntcx -DRIVER_NAME= suntcx_drv - -SRCS= tcx_driver.c tcx_cursor.c tcx_accel.c - -CPPFLAGS+= ${X11FLAGS.DRI} -CPPFLAGS+= -DHAVE_XAA_H - -MAN= suntcx.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-tdfx/Makefile b/external/mit/xorg/server/drivers/xf86-video-tdfx/Makefile deleted file mode 100644 index 91d7158fc..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-tdfx/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $NetBSD: Makefile,v 1.12 2014/03/20 05:32:31 mrg Exp $ - -DRIVER= xf86-video-tdfx -DRIVER_NAME= tdfx_drv - -SRCS= tdfx_accel.c tdfx_dga.c tdfx_driver.c tdfx_hwcurs.c -SRCS+= tdfx_io.c tdfx_priv.c tdfx_sli.c tdfx_video.c -SRCS+= tdfx_dri.c -MAN= tdfx.4 - -.if ${MACHINE_ARCH} == "i386" || \ - ${MACHINE_ARCH} == "x86_64" -CPPFLAGS+= -DUSE_INT10 -.endif -CPPFLAGS+= -DHAVE_XAA_H -CPPFLAGS+= -DTDFXDRI - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm - -COPTS.tdfx_driver.c= -Wno-error # XXX deprecated - -CWARNFLAGS.clang+= -Wno-format -Wno-pointer-sign - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-tga/Makefile b/external/mit/xorg/server/drivers/xf86-video-tga/Makefile deleted file mode 100644 index 05d39a470..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-tga/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2013/06/03 10:03:14 mrg Exp $ - -DRIVER= xf86-video-tga -DRIVER_NAME= tga_drv - -SRCS= BT463ramdac.c BTramdac.c IBM561ramdac.c ICS1562.c -SRCS+= tga_accel.c tga_cursor.c tga_dac.c tga_driver.c -SRCS+= tga_line.c tga_seg.c - -CPPFLAGS+= -DHAVE_XAA_H - -COPTS.tga_driver.c= -Wno-error # XXX xf86dgastr.h - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-trident/Makefile b/external/mit/xorg/server/drivers/xf86-video-trident/Makefile deleted file mode 100644 index b6e75b30c..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-trident/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2015/07/20 03:00:01 mrg Exp $ - -DRIVER= xf86-video-trident -DRIVER_NAME= trident_drv - -SRCS= blade_accel.c blade_accel_exa.c image_accel.c -SRCS+= trident_accel.c trident_bank.c trident_dac.c -SRCS+= trident_dga.c trident_driver.c tridenthelper.c -SRCS+= trident_i2c.c trident_shadow.c -SRCS+= trident_tv.c trident_video.c tvga_dac.c xp_accel.c -SRCS+= xp4_accel.c xp4_accel_exa.c -MAN= trident.4 - -CPPFLAGS+= -DHAVE_XAA_H - -COPTS.trident_driver.c= -Wno-error # XXX xf86dgastr.h - -CWARNFLAGS.clang+= -Wno-return-type -Wno-empty-body - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-tseng/Makefile b/external/mit/xorg/server/drivers/xf86-video-tseng/Makefile deleted file mode 100644 index 89ec2a938..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-tseng/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2011/08/11 23:15:41 joerg Exp $ - -DRIVER= xf86-video-tseng -DRIVER_NAME= tseng_drv - -SRCS= tseng_accel.c tseng_cursor.c tseng_dga.c -SRCS+= tseng_driver.c tseng_mode.c -MAN= tseng.4 - -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/../include - -CWARNFLAGS.clang+= -Wno-pointer-sign - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-vesa/Makefile b/external/mit/xorg/server/drivers/xf86-video-vesa/Makefile deleted file mode 100644 index 3c5386c49..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-vesa/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2008/08/30 04:44:34 mrg Exp $ - -DRIVER= xf86-video-vesa -DRIVER_NAME= vesa_drv - -SRCS= vesa.c -MAN= vesa.4 - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-vmware/Makefile b/external/mit/xorg/server/drivers/xf86-video-vmware/Makefile deleted file mode 100644 index 0a63a60c4..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-vmware/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $NetBSD: Makefile,v 1.9 2013/06/05 08:42:21 mrg Exp $ - -DRIVER= xf86-video-vmware -DRIVER_NAME= vmware_drv - -SRCS= \ - bits2pixels.c \ - vmware.c \ - vmwarecurs.c \ - vmwarectrl.c \ - vmwarexinerama.c \ - vmwarevideo.c \ - vmwaremodes.c \ - vmware_bootstrap.c \ - vmware_common.c - -MAN= vmware.4 - -CPPFLAGS+= -DXORG_VERSION_CURRENT=${XORG_VERSION_CURRENT} -CPPFLAGS+= -I${X11SRCDIR.${DRIVER}}/../include -DHAVE_CONFIG_H \ - -I${DESTDIR}${X11INCDIR}/libdrm - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-wsfb/Makefile b/external/mit/xorg/server/drivers/xf86-video-wsfb/Makefile deleted file mode 100644 index 945de91d6..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-wsfb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2009/06/12 01:59:04 mrg Exp $ - -DRIVER= xf86-video-wsfb -DRIVER_NAME= wsfb_drv - -SRCS= wsfb_driver.c wsfb_cursor.c -MAN= wsfb.4 - -CPPFLAGS+= -DHAVE_CONFIG_H -I${X11SRCDIR.${DRIVER}}/../include - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/drivers/xf86-video-xgi/Makefile b/external/mit/xorg/server/drivers/xf86-video-xgi/Makefile deleted file mode 100644 index 15274125f..000000000 --- a/external/mit/xorg/server/drivers/xf86-video-xgi/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2012/11/18 08:24:02 apb Exp $ - -DRIVER= xf86-video-xgi -DRIVER_NAME= xgi_drv - -SRCS= init.c vb_ext.c vb_i2c.c vb_setmode.c xgi_accel.c -#SRC+= vb_init.c -SRCS+= xgi_cursor.c xgi_dac.c xgi_dga.c xgi_driver.c xgi_opt.c -SRCS+= xgi_setup.c xgi_vb.c xgi_vga.c xgi_video.c xgi_videohw.c - -MAN= xgi.4 - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11/dri -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/libdrm -# for now, I'd like to see this thing work first -CPPFLAGS+= -DHAVE_UNISTD_H -Wno-deprecated-declarations - -# vb_struct.h contains this declaration: -# -# typedef struct _XGI_CRT1TableStruct -# { -# UCHAR CR[15]; -# } XGI_CRT1TableStruct; -# -# but code in init.c and vb_setmode.c reads elements beyond the end of -# the array and writes the result into hardware registers. It's not -# clear how to fix this, so just disable the -Warray-bounds warning to -# allow the build to complete. -# -COPTS.init.c= -Wno-array-bounds -COPTS.vb_setmode.c= -Wno-array-bounds - -.include "../Makefile.xf86-driver" diff --git a/external/mit/xorg/server/xorg-server/Makefile b/external/mit/xorg/server/xorg-server/Makefile deleted file mode 100644 index 89ef4d3b6..000000000 --- a/external/mit/xorg/server/xorg-server/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# $NetBSD: Makefile,v 1.22 2014/12/30 22:07:21 mrg Exp $ - -.include - -.include "Makefile.common" - -.if ${XSERVER_NEEDS_XFONT} != "no" -SUBDIR.xfont=Xfont fontbase -.else -SUBDIR.xfont= -.endif - -SUBDIR= doc include .WAIT -SUBDIR+= glx -SUBDIR+= dix fb mi Xext miext os randr render -SUBDIR+= Xi xkb xkbstubs dbe record xfixes -SUBDIR+= damageext composite config .WAIT -SUBDIR+= hw - -.PATH: ${X11SRCDIR.xorg-server} - -PKGCONFIG= xorg-server -# Use -fvisibility=hidden for symbol_visibility? -PKGCONFIG_SED_FLAGS= \ - -e "s,@sysconfigdir@,${X11ETCDIR},; \ - s,@SDK_REQUIRED_MODULES@,xproto >= 7.0.17 randrproto >= 1.2.99.3 renderproto >= 0.11 xextproto >= 7.1.99 inputproto >= 1.9.99.902 kbproto >= 1.0.3 fontsproto,; \ - s,@symbol_visibility@,," - -.include -.include -.include diff --git a/external/mit/xorg/server/xorg-server/Makefile.Xserver b/external/mit/xorg/server/xorg-server/Makefile.Xserver deleted file mode 100644 index 956bae252..000000000 --- a/external/mit/xorg/server/xorg-server/Makefile.Xserver +++ /dev/null @@ -1,85 +0,0 @@ -# $NetBSD: Makefile.Xserver,v 1.13 2012/10/03 21:50:14 gsutre Exp $ - -.for _SL in \ - mi \ - config \ - fb \ - xfixes \ - Xext \ - Xext/Xextbuiltin \ - dbe \ - record \ - render \ - randr \ - damageext \ - miext/damage \ - miext/shadow \ - miext/cw \ - miext/sync \ - Xi \ - xkb \ - xkbstubs \ - composite \ - dix/xpstubs \ - os \ - dix \ - config \ - glx \ - hw/xnest \ - hw/xfree86/common \ - hw/xfree86/ddc \ - hw/xfree86/dixmods \ - hw/xfree86/dixmods/dbe \ - hw/xfree86/dixmods/extmod \ - hw/xfree86/dixmods/fb \ - hw/xfree86/dixmods/freetype \ - hw/xfree86/dixmods/record \ - hw/xfree86/dixmods/shadow \ - hw/xfree86/dixmods/type1 \ - hw/xfree86/dixmods/wfb \ - hw/xfree86/dixmods/xorgxkb \ - hw/xfree86/dixmods/xtrap \ - hw/xfree86/doc \ - hw/xfree86/dri \ - hw/xfree86/dri2 \ - hw/xfree86/dummy \ - hw/xfree86/i2c \ - hw/xfree86/init \ - hw/xfree86/int10 \ - hw/xfree86/loader \ - hw/xfree86/xorgos \ - hw/xfree86/rac \ - hw/xfree86/ramdac \ - hw/xfree86/scanpci \ - hw/xfree86/shadowfb \ - hw/xfree86/utils \ - hw/xfree86/vbe \ - hw/xfree86/vgahw \ - hw/xfree86/x86emu \ - hw/xfree86/xaa \ - hw/xfree86/xf8_16bpp \ - hw/xfree86/xf8_32bpp \ - hw/xfree86/xf86config \ - hw/xfree86/xf86modes - -.if !defined(LIBDIR.${_SL}) -LIBDIR.${_SL}!= cd ${NETBSDSRCDIR}/external/mit/xorg/server/xorg-server/${_SL} && ${PRINTOBJDIR} -.MAKEOVERRIDES+=LIBDIR.${_SL} -.endif -LDADD.${_SL}= ${LIBDIR.${_SL}}/lib${_SL:T}.a -DPADD.${_SL}= ${LIBDIR.${_SL}}/lib${_SL:T}.a -.endfor - -LDADD.XORG_CORE= ${LDADD.dix} ${LDADD.config} -DPADD.XORG_CORE= ${DPADD.dix} ${DPADD.config} - -# X servers need all symbols exported -LDFLAGS+= -Wl,--export-dynamic - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include - -LDADD+= -lm -DPADD+= ${LIBM} diff --git a/external/mit/xorg/server/xorg-server/Makefile.common b/external/mit/xorg/server/xorg-server/Makefile.common deleted file mode 100644 index 8be5389dc..000000000 --- a/external/mit/xorg/server/xorg-server/Makefile.common +++ /dev/null @@ -1,93 +0,0 @@ -# $NetBSD: Makefile.common,v 1.26 2013/06/12 21:35:29 mrg Exp $ - -# These define parts of the Xserver tree that are to be -# conditionally compiled for different platforms. See -# below for descriptions of each variable. - -.include - - -# XFree86 servers all need XFONT as well. -.if ${MKXORG_SERVER} != "no" -XSERVER_NEEDS_XFONT= yes -XSERVER_XFREE86= yes -.endif - -.if ${MACHINE} == "acorn32" -XSERVER_XARM32VIDC= yes -.endif - -.if ${MACHINE} == "alpha" -XSERVER_XALPHANETBSD= yes -XSERVER_XDECNETBSD= yes -.endif - -.if ${MACHINE} == "amiga" -XSERVER_XAMIGA= yes -.endif - -.if ${MACHINE} == "atari" -#XSERVER_XFREE68= yes -.endif - -.if ${MACHINE} == "mac68k" -XSERVER_XMAC68K= yes -.endif - -.if ${MACHINE} == "macppc" -XSERVER_XMACPPC= yes -.endif - -.if ${MACHINE} == "pmax" -XSERVER_XDECNETBSD= yes -XSERVER_XPMAX= no # XXX should be yes but may be obsoleted -.endif - -.if ${MACHINE} == "sparc" || ${MACHINE} == "sparc64" -XSERVER_XSUN= yes -XSERVER_XSUNMONO= yes -XSERVER_XSUN24= yes -.endif - -.if ${MACHINE} == "sun3" -XSERVER_XSUN= yes -XSERVER_XSUNMONO= yes -.endif - -.if ${MACHINE} == "x68k" -XSERVER_X68K= yes -.endif - - -# Does this server need Xfont/fontbase libraries? -XSERVER_NEEDS_XFONT?= no - -# Does this platform build XFree86 X server? -XSERVER_XFREE86?= no - -# Does this platform build the XalphaNetBSD server? -XSERVER_XALPHANETBSD?= no -# Does this platform build the Xamiga server? -XSERVER_XAMIGA?= no -# Does this platform build the Xarm32VIDC server? -XSERVER_XARM32VIDC?= no -# Does this platform build the XdecNetBSD server? -XSERVER_XDECNETBSD?= no -# Does this platform build the Xfree68 servers? -XSERVER_XFREE68?= no -# Does this platform build the Xmac68k X server? -XSERVER_XMAC68K?= no -# Does this platform build Xmacppc X server? -XSERVER_XMACPPC?= no -# Does this platform build the Xnewsmips server? -XSERVER_XNEWSMIPS?= no -# Does this platform build Xpmax X servers? -XSERVER_XPMAX?= no -# Does this platform build Xsun* X servers? -XSERVER_XSUN?= no -XSERVER_XSUNMONO?= no -XSERVER_XSUN24?= no -# Does this platform build X68k X servers? -XSERVER_X68K?= no -# Does this platform build Xvfb X server? -XSERVER_XVFB?= yes diff --git a/external/mit/xorg/server/xorg-server/Makefile.inc b/external/mit/xorg/server/xorg-server/Makefile.inc deleted file mode 100644 index 308d7b9c3..000000000 --- a/external/mit/xorg/server/xorg-server/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -#__MINIX -.include "../Makefile.inc" - diff --git a/external/mit/xorg/server/xorg-server/Makefile.serverlib b/external/mit/xorg/server/xorg-server/Makefile.serverlib deleted file mode 100644 index ae2878e9f..000000000 --- a/external/mit/xorg/server/xorg-server/Makefile.serverlib +++ /dev/null @@ -1,25 +0,0 @@ -# $NetBSD: Makefile.serverlib,v 1.8 2015/07/18 08:56:06 mrg Exp $ - -# We can't use LIBISPRIVATE here as we need the ".so" installed. -MKPICINSTALL:= no -MKLINT:= no -MKDEBUGLIB:= no -MKPROFILE:= no - -.include # for NETBSDSRCDIR -.include - -.if ${TARGET_ENDIANNESS} == "1234" -X_BYTE_ORDER=X_LITTLE_ENDIAN -.elif ${TARGET_ENDIANNESS} == "4321" -X_BYTE_ORDER=X_BIG_ENDIAN -.else -X_BYTE_ORDER=0 -.endif - -CPPFLAGS+= ${X11FLAGS.SERVER} -CPPFLAGS+= -DXORG_VERSION_CURRENT=${XORG_VERSION_CURRENT} - -.if (${MACHINE_ARCH} == "sparc") || (${MACHINE_ARCH} == "sparc64") -CPPFLAGS+= -D__GLX_ALIGN64 -.endif diff --git a/external/mit/xorg/server/xorg-server/Makefile.servermod b/external/mit/xorg/server/xorg-server/Makefile.servermod deleted file mode 100644 index 2c1df1610..000000000 --- a/external/mit/xorg/server/xorg-server/Makefile.servermod +++ /dev/null @@ -1,23 +0,0 @@ -# $NetBSD: Makefile.servermod,v 1.3 2015/07/18 08:56:06 mrg Exp $ - -.if defined(XMODULEDIR) -SHLIB_MAJOR=0 - -# dri, dri2 and fb need to be linked statically as well? -.if !defined(XMODULEDIRANDSTATIC) -MKSTATICLIB:= no -.endif - -.else - -# if these aren't defined the module being built is not installed -# instead it is statically linked into the xserver -libinstall:: -moduleinstall:: - -.endif - -# x11 modules that are installed need the X11FLAGS.LOADABLE's defined -.if defined(XMODULEDIR) -CPPFLAGS+= ${X11FLAGS.LOADABLE} -.endif diff --git a/external/mit/xorg/server/xorg-server/XTrap/Makefile b/external/mit/xorg/server/xorg-server/XTrap/Makefile deleted file mode 100644 index df4557901..000000000 --- a/external/mit/xorg/server/xorg-server/XTrap/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:25:03 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../Makefile.serverlib" - -LIB= XTrap -SRCS= ${SRCS.XTrap} - -.include "Makefile.xtrap" diff --git a/external/mit/xorg/server/xorg-server/XTrap/Makefile.xtrap b/external/mit/xorg/server/xorg-server/XTrap/Makefile.xtrap deleted file mode 100644 index 24646dea2..000000000 --- a/external/mit/xorg/server/xorg-server/XTrap/Makefile.xtrap +++ /dev/null @@ -1,17 +0,0 @@ -# $NetBSD: Makefile.xtrap,v 1.4 2008/08/24 13:25:03 rtr Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/XTrap -SRCS.XTrap= xtrapddmi.c xtrapdi.c xtrapdiswp.c xtrapditbl.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/Xext - -# XXX -COPTS.xtrapdi.c= -Wno-error - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/Xext/Makefile b/external/mit/xorg/server/xorg-server/Xext/Makefile deleted file mode 100644 index c99793423..000000000 --- a/external/mit/xorg/server/xorg-server/Xext/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2008/08/09 06:48:17 rtr Exp $ - -LIBISPRIVATE= yes -LIB= Xext - -.include "../Makefile.serverlib" - -.include "Makefile.Xextbuiltin" -.include "Makefile.Xextmodule" - -SRCS= ${SRCS.Xextbuiltin} ${SRCS.Xextmodule} - -SUBDIR= Xextbuiltin Xextmodule - -.include -.include "Makefile.Xext" diff --git a/external/mit/xorg/server/xorg-server/Xext/Makefile.Xext b/external/mit/xorg/server/xorg-server/Xext/Makefile.Xext deleted file mode 100644 index 17490e0ee..000000000 --- a/external/mit/xorg/server/xorg-server/Xext/Makefile.Xext +++ /dev/null @@ -1,33 +0,0 @@ -# $NetBSD: Makefile.Xext,v 1.11 2011/08/02 09:11:37 mrg Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/Xext - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/Xext -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/pixman-1 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/xorg -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/Xi -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/xfixes -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/miext/sync -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/composite -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/damageext -CPPFLAGS+= -DHAVE_DIX_CONFIG_H - -COPTS.panoramiX.c+= -Wno-error -COPTS.panoramiXprocs.c+= -Wno-error -COPTS.saver.c+= -Wno-error -COPTS.security.c+= -Wno-error -COPTS.shape.c+= -Wno-error -COPTS.shm.c+= -Wno-error -COPTS.sync.c+= -Wno-error -COPTS.xf86bigfont.c+= -Wno-error -COPTS.xres.c= -Wno-error -COPTS.xvdisp.c+= -Wno-error -COPTS.xvmain.c+= -Wno-error -COPTS.xvmc.c+= -Wno-error -COPTS.bigreq.c+= -Wno-error # XXX bigreqstr.h -COPTS.xcmisc.c+= -Wno-error # XXX xcmiscstr.h - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/Xext/Makefile.Xextbuiltin b/external/mit/xorg/server/xorg-server/Xext/Makefile.Xextbuiltin deleted file mode 100644 index 742ea5aad..000000000 --- a/external/mit/xorg/server/xorg-server/Xext/Makefile.Xextbuiltin +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile.Xextbuiltin,v 1.6 2009/06/12 01:59:04 mrg Exp $ - -SRCS.Xextbuiltin= bigreq.c geext.c shape.c sleepuntil.c \ - sync.c xcmisc.c xtest.c -SRCS.Xextbuiltin+= shm.c -SRCS.Xextbuiltin+= panoramiX.c panoramiXprocs.c panoramiXSwap.c -SRCS.Xextbuiltin+= xace.c -SRCS.Xextbuiltin+= security.c -SRCS.Xextbuiltin+= xf86bigfont.c diff --git a/external/mit/xorg/server/xorg-server/Xext/Makefile.Xextmodule b/external/mit/xorg/server/xorg-server/Xext/Makefile.Xextmodule deleted file mode 100644 index 00cbf837c..000000000 --- a/external/mit/xorg/server/xorg-server/Xext/Makefile.Xextmodule +++ /dev/null @@ -1,6 +0,0 @@ -# $NetBSD: Makefile.Xextmodule,v 1.9 2010/11/23 08:22:29 mrg Exp $ - -SRCS.Xextmodule= xvmain.c xvdisp.c xvmc.c -SRCS.Xextmodule+= xres.c -SRCS.Xextmodule+= saver.c -SRCS.Xextmodule+= dpms.c diff --git a/external/mit/xorg/server/xorg-server/Xext/Xextbuiltin/Makefile b/external/mit/xorg/server/xorg-server/Xext/Xextbuiltin/Makefile deleted file mode 100644 index a7cfeb1ae..000000000 --- a/external/mit/xorg/server/xorg-server/Xext/Xextbuiltin/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2008/08/09 05:26:41 rtr Exp $ - -LIBISPRIVATE= yes -LIB= Xextbuiltin - -.include "../../Makefile.serverlib" -.include "../Makefile.Xextbuiltin" - -SRCS= ${SRCS.Xextbuiltin} - -.include "../Makefile.Xext" diff --git a/external/mit/xorg/server/xorg-server/Xext/Xextmodule/Makefile b/external/mit/xorg/server/xorg-server/Xext/Xextmodule/Makefile deleted file mode 100644 index 3d6e9c0a1..000000000 --- a/external/mit/xorg/server/xorg-server/Xext/Xextmodule/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2013/09/12 15:36:14 joerg Exp $ - -LIBISPRIVATE= yes -LIB= Xextmodule - -COPTS+= ${PICFLAGS} - -.include "../../Makefile.serverlib" -.include "../Makefile.Xextmodule" - -SRCS= ${SRCS.Xextmodule} shape.c ${SRCS.Xext} - -.include "../Makefile.Xext" diff --git a/external/mit/xorg/server/xorg-server/Xi/Makefile b/external/mit/xorg/server/xorg-server/Xi/Makefile deleted file mode 100644 index ddd34e9bd..000000000 --- a/external/mit/xorg/server/xorg-server/Xi/Makefile +++ /dev/null @@ -1,42 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2011/08/11 23:15:41 joerg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= Xi - -.PATH: ${X11SRCDIR.xorg-server}/${LIB} - -SRCS= allowev.c chgdctl.c chgfctl.c chgkbd.c chgkmap.c chgprop.c \ - chgptr.c closedev.c devbell.c exevents.c extinit.c \ - getbmap.c getdctl.c getfctl.c getfocus.c getkmap.c \ - getmmap.c getprop.c getselev.c getvers.c grabdev.c \ - grabdevb.c grabdevk.c gtmotion.c listdev.c opendev.c \ - queryst.c selectev.c sendexev.c setbmap.c setdval.c \ - setfocus.c setmmap.c setmode.c ungrdev.c ungrdevb.c \ - ungrdevk.c \ - xiallowev.c \ - xichangecursor.c \ - xichangehierarchy.c \ - xigetclientpointer.c \ - xigrabdev.c \ - xipassivegrab.c \ - xiproperty.c \ - xiquerydevice.c \ - xiquerypointer.c \ - xiqueryversion.c \ - xiselectev.c \ - xisetclientpointer.c \ - xisetdevfocus.c \ - xiwarppointer.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/../include -CPPFLAGS+= ${X11FLAGS.DIX} - -CWARNFLAGS.clang+= -Wno-tautological-compare - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/afb/Makefile b/external/mit/xorg/server/xorg-server/afb/Makefile deleted file mode 100644 index b86298e5d..000000000 --- a/external/mit/xorg/server/xorg-server/afb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/08/02 20:41:29 mrg Exp $ - -.include "../Makefile.serverlib" - -.if ${MKX11LOADABLE} != "no" -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions -SRCS= afbmodule.c -.endif - -.include "../Makefile.servermod" -.include "Makefile.afb" diff --git a/external/mit/xorg/server/xorg-server/afb/Makefile.afb b/external/mit/xorg/server/xorg-server/afb/Makefile.afb deleted file mode 100644 index d601e25aa..000000000 --- a/external/mit/xorg/server/xorg-server/afb/Makefile.afb +++ /dev/null @@ -1,38 +0,0 @@ -# $NetBSD: Makefile.afb,v 1.3 2008/08/15 15:55:05 rtr Exp $ - -LIB= afb - -.PATH: ${X11SRCDIR.xorg-server}/${LIB} -SRCS+= afbbltC.c afbbltX.c afbbltCI.c afbbltO.c afbbltG.c \ - afbtileC.c afbtileG.c afbseg.c \ - afbgc.c afbwindow.c afbfont.c afbfillrct.c afbpntwin.c \ - afbpixmap.c afbimage.c afbline.c afbbres.c afbhrzvert.c \ - afbbresd.c afbpushpxl.c afbply1rct.c afbzerarc.c afbfillarc.c \ - afbfillsp.c afbsetsp.c afbscrinit.c afbplygblt.c afbclip.c \ - afbgetsp.c afbpolypnt.c afbbitblt.c afbcmap.c afbimggblt.c \ - afbpntarea.c afbmisc.c afbbstore.c afbtegblt.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/${LIB} \ - -I${X11SRCDIR.xorg-server}/cfb \ - -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 - -# XXX some path so that "../../mfb/mfbblt.c" works -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86 - -# XXX -COPTS.afbfillsp.c+= -Wno-error -COPTS.afbgetsp.c+= -Wno-error -COPTS.afbpntarea.c+= -Wno-error -COPTS.afbsetsp.c+= -Wno-error -COPTS.afbtegblt.c+= -Wno-error -COPTS.afbtileC.c+= -Wno-error -COPTS.afbtileG.c+= -Wno-error - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/cfb/Makefile b/external/mit/xorg/server/xorg-server/cfb/Makefile deleted file mode 100644 index 5bf2678c7..000000000 --- a/external/mit/xorg/server/xorg-server/cfb/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:23:33 rtr Exp $ - -LIBISPRIVATE= yes -PIXELSIZE= 8 - -.include "../Makefile.serverlib" - -LIB= cfb -SRCS= ${SRCS.cfb} - -.include "Makefile.cfb" - diff --git a/external/mit/xorg/server/xorg-server/cfb/Makefile.cfb b/external/mit/xorg/server/xorg-server/cfb/Makefile.cfb deleted file mode 100644 index 8f028f6ec..000000000 --- a/external/mit/xorg/server/xorg-server/cfb/Makefile.cfb +++ /dev/null @@ -1,119 +0,0 @@ -# $NetBSD: Makefile.cfb,v 1.4 2008/10/24 19:47:24 macallan Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/cfb -SRCS.cfb+= cfbseg.c cfbfillarcC.c cfbfillarcG.c cfbzerarcC.c \ - cfbzerarcX.c cfbzerarcG.c cfbbltC.c cfbbltX.c \ - cfbbltO.c cfbbltG.c cfbsolidC.c cfbsolidX.c \ - cfbsolidG.c cfbtileoddC.c cfbtileoddG.c cfbtile32C.c \ - cfbtile32G.c cfb8lineCO.c cfb8lineCP.c cfb8lineX.c \ - cfb8lineG.c cfb8segCS.c cfb8segC.c cfb8segX.c \ - cfb8setG.c cfbply1rctC.c cfbply1rctG.c - -SRCS.cfb+= cfbgc.c cfbrrop.c cfbwindow.c cfbpntwin.c \ - cfbmskbits.c cfbpixmap.c cfbbitblt.c cfbfillsp.c \ - cfbsetsp.c cfbscrinit.c cfballpriv.c cfbgetsp.c \ - cfbfillrct.c cfbigblt8.c cfbglblt8.c cfbtegblt.c \ - cfbbstore.c cfbpolypnt.c cfbbres.c cfbline.c \ - cfbhrzvert.c cfbbresd.c cfbimage.c cfbcppl.c \ - cfbcmap.c - -X11XSERVERDIR= ${X11SRCDIR.xorg-server} - -.if 0 -BUILDSYMLINKS= cfbline.c cfbseg.c \ - cfbfillarc.c cfbfillarcC.c \ - cfbfillarc.c cfbfillarcG.c \ - cfbzerarc.c cfbzerarcC.c \ - cfbzerarc.c cfbzerarcX.c \ - cfbzerarc.c cfbzerarcG.c \ - cfbblt.c cfbbltC.c \ - cfbblt.c cfbbltX.c \ - cfbblt.c cfbbltO.c \ - cfbblt.c cfbbltG.c \ - cfbsolid.c cfbsolidC.c \ - cfbsolid.c cfbsolidX.c \ - cfbsolid.c cfbsolidG.c \ - cfbtileodd.c cfbtileoddC.c \ - cfbtileodd.c cfbtileoddG.c \ - cfbtile32.c cfbtile32C.c \ - cfbtile32.c cfbtile32G.c \ - cfb8line.c cfb8lineCO.c \ - cfb8line.c cfb8lineCP.c \ - cfb8line.c cfb8lineX.c \ - cfb8line.c cfb8lineG.c \ - cfb8line.c cfb8segCS.c \ - cfb8line.c cfb8segC.c \ - cfb8line.c cfb8segX.c \ - cfb8line.c cfb8segG.c \ - cfbply1rct.c cfbply1rctC.c \ - cfbply1rct.c cfbply1rctG.c \ - ${X11XSERVERDIR}/cfb32/cfbmodule.c cfbmodule32.c -.endif - - -.if ${PIXELSIZE} == 8 # { -SRCS.cfb+= cfb8bit.c cfbteblt8.c cfbglrop8.c cfbpush8.c cfbrctstp8.c -.if 0 -BUILDSYMLINKS+= cfbglblt8.c cfbglrop8.c -.endif -.endif # } - -.include "../Makefile.common" - -.if ${XSERVER_XAMIGA} != "no" -CPPFLAGS+= -DFORCE_SEPARATE_PRIVATE -.endif - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/cfb \ - -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/Xext - -# XXX some path so that "../../mfb/mfbblt.c" works -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86 - -CPPFLAGS+= -DPSZ=${PIXELSIZE} -DXFREE86 - - -.if 0 -CPPFLAGS.cfb8lineCO.c= -DRROP=GXcopy -CPPFLAGS.cfb8lineCP.c= -DRROP=GXcopy -DPREVIOUS -CPPFLAGS.cfb8lineG.c= -DRROP=GXset -CPPFLAGS.cfb8lineX.c= -DRROP=GXxor -CPPFLAGS.cfb8segC.c= -DRROP=GXcopy -DPOLYSEGMENT -CPPFLAGS.cfb8segCS.c= -DRROP=GXcopy -DPOLYSEGMENT -DWIDTH_SHIFT -CPPFLAGS.cfb8segG.c= -DRROP=GXset -DPOLYSEGMENT -CPPFLAGS.cfb8segX.c= -DRROP=GXxor -DPOLYSEGMENT -CPPFLAGS.cfbbltC.c= -DMROP=Mcopy -CPPFLAGS.cfbbltG.c= -DMROP=0 -CPPFLAGS.cfbbltO.c= -DMROP=Mor -CPPFLAGS.cfbbltX.c= -DMROP=Mxor -CPPFLAGS.cfbcmap.c= ${X11FLAGS.EXTENSION} -DGLXEXT -DGLX_USE_MESA -CPPFLAGS.cfbfillarcC.c= -DRROP=GXcopy -CPPFLAGS.cfbfillarcG.c= -DRROP=GXset -CPPFLAGS.cfbglrop8.c= -DGLYPHROP -CPPFLAGS.cfbply1rctC.c= -DRROP=GXcopy -CPPFLAGS.cfbply1rctG.c= -DRROP=GXset -CPPFLAGS.cfbseg.c= -DPOLYSEGMENT -CPPFLAGS.cfbsolidC.c= -DRROP=GXcopy -CPPFLAGS.cfbsolidG.c= -DRROP=GXset -CPPFLAGS.cfbsolidX.c= -DRROP=GXxor -CPPFLAGS.cfbtile32C.c= -DMROP=Mcopy -CPPFLAGS.cfbtile32G.c= -DMROP=0 -CPPFLAGS.cfbtileoddC.c= -DMROP=Mcopy -CPPFLAGS.cfbtileoddG.c= -DMROP=0 -CPPFLAGS.cfbzerarcC.c= -DRROP=GXcopy -CPPFLAGS.cfbzerarcG.c= -DRROP=GXset -CPPFLAGS.cfbzerarcX.c= -DRROP=GXxor -.endif - -# XXX -COPTS.cfbgc.c= -Wno-error -COPTS.cfbscrinit.c= -Wno-error - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/cfb32/Makefile b/external/mit/xorg/server/xorg-server/cfb32/Makefile deleted file mode 100644 index 6f5058dd8..000000000 --- a/external/mit/xorg/server/xorg-server/cfb32/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:24:12 rtr Exp $ - -LIBISPRIVATE= yes -PIXELSIZE= 32 - -.include "../Makefile.serverlib" - -LIB= cfb32 -SRCS= ${SRCS.cfb} - -.include "../cfb/Makefile.cfb" diff --git a/external/mit/xorg/server/xorg-server/composite/Makefile b/external/mit/xorg/server/xorg-server/composite/Makefile deleted file mode 100644 index eb5bd1d4b..000000000 --- a/external/mit/xorg/server/xorg-server/composite/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2009/08/22 02:40:26 mrg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= composite -.PATH: ${X11SRCDIR.xorg-server}/composite - -SRCS= compalloc.c compext.c compint.h compinit.c compwindow.c \ - compoverlay.c - -CPPFLAGS+= ${X11FLAGS.PERVASIVE_EXTENSION} ${X11FLAGS.DIX} ${X11INCS.DIX} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/render \ - -I${X11SRCDIR.xorg-server}/xfixes \ - -I${X11SRCDIR.xorg-server}/damageext \ - -I${X11SRCDIR.xorg-server}/miext/damage \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include \ - -# XXX -COPTS.compwindow.c= -Wno-error -COPTS.compext.c= -Wno-error -COPTS.compinit.c= -Wno-error - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/config/Makefile b/external/mit/xorg/server/xorg-server/config/Makefile deleted file mode 100644 index 4ec113cce..000000000 --- a/external/mit/xorg/server/xorg-server/config/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/08/02 21:44:14 mrg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= config -.PATH: ${X11SRCDIR.xorg-server}/config - -SRCS= config.c - -CPPFLAGS+= ${X11FLAGS.DIX} -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/damageext/Makefile b/external/mit/xorg/server/xorg-server/damageext/Makefile deleted file mode 100644 index 16ec09d59..000000000 --- a/external/mit/xorg/server/xorg-server/damageext/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2011/01/15 13:54:52 jmcneill Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= damageext -.PATH: ${X11SRCDIR.xorg-server}/damageext - -SRCS= damageext.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/xfixes \ - -I${X11SRCDIR.xorg-server}/damagext \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -COPTS.damageext.c+= -Wno-error - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/dbe/Makefile b/external/mit/xorg/server/xorg-server/dbe/Makefile deleted file mode 100644 index d4319319d..000000000 --- a/external/mit/xorg/server/xorg-server/dbe/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2009/08/22 02:40:27 mrg Exp $ - -LIBISPRIVATE= yes - -.include "../Makefile.serverlib" - -LIB= dbe -SRCS= ${SRCS.dbe} - -COPTS.dbe.c= -Wno-error - -.include "Makefile.dbe" diff --git a/external/mit/xorg/server/xorg-server/dbe/Makefile.dbe b/external/mit/xorg/server/xorg-server/dbe/Makefile.dbe deleted file mode 100644 index 6d7b04efd..000000000 --- a/external/mit/xorg/server/xorg-server/dbe/Makefile.dbe +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile.dbe,v 1.6 2011/01/15 13:54:53 jmcneill Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/dbe -SRCS.dbe= dbe.c midbe.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/dix/Makefile b/external/mit/xorg/server/xorg-server/dix/Makefile deleted file mode 100644 index d768f7830..000000000 --- a/external/mit/xorg/server/xorg-server/dix/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# $NetBSD: Makefile,v 1.12 2012/03/22 23:46:28 joerg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" -.include "Makefile.common" - -LIB= dix - -.PATH: ${X11SRCDIR.xorg-server}/dix -SRCS= atom.c colormap.c cursor.c devices.c dispatch.c dixfonts.c \ - dixutils.c events.c extension.c ffs.c gc.c getevents.c \ - globals.c glyphcurs.c grabs.c initatoms.c main.c pixmap.c \ - privates.c property.c resource.c swaprep.c swapreq.c \ - tables.c window.c \ - deprecated.c enterleave.c ptrveloc.c registry.c selection.c \ - eventconvert.c inpututils.c region.c - - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/pixman-1 -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/xorg -CPPFLAGS+= ${X11FLAGS.PERVASIVE_EXTENSION} -CPPFLAGS+= ${X11FLAGS.DIX} ${X11INCS.DIX} - -CPPFLAGS.globals.c= -DCOMPILEDDEFAULTFONTPATH=\"${X11DEFAULTFONTPATH:ts,}\" \ - -DRGB_DB=\"${X11LIBDIR}/rgb\" - -# XXX make user variables -CPPFLAGS.dispatch.c= -DVENDOR_NAME="\"The Xorg Foundation\"" -CPPFLAGS.main.c= -DVENDOR_STRING="\"The Xorg Group\"" \ - -DVENDOR_RELEASE=${XORG_VERSION_CURRENT} \ - -DVENDOR_NAME="\"The Xorg Foundation\"" - -FILES= protocol.txt -FILESDIR= ${X11ROOTDIR}/lib/xorg - -COPTS.dixutils.c= -Wno-error -COPTS.colormap.c= -Wno-error -COPTS.cursor.c= -Wno-error -COPTS.deprecated.c= -Wno-error -COPTS.dispatch.c= -Wno-error -COPTS.dixfonts.c= -Wno-error -COPTS.events.c= -Wno-error -COPTS.resource.c= -Wno-error -COPTS.window.c= -Wno-error -COPTS.inpututils.c= -Wno-error - -CWARNFLAGS.clang+= -Wno-switch - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/dix/Makefile.common b/external/mit/xorg/server/xorg-server/dix/Makefile.common deleted file mode 100644 index b4c59425d..000000000 --- a/external/mit/xorg/server/xorg-server/dix/Makefile.common +++ /dev/null @@ -1,7 +0,0 @@ -# $NetBSD: Makefile.common,v 1.2 2009/06/18 02:45:46 mrg Exp $ - -X11DEFAULTFONTPATH= ${X11FONTDIR}/misc/ \ - ${X11FONTDIR}/TTF/ \ - ${X11FONTDIR}/Type1/ \ - ${X11FONTDIR}/75dpi/ \ - ${X11FONTDIR}/100dpi/ diff --git a/external/mit/xorg/server/xorg-server/dix/xpstubs/Makefile b/external/mit/xorg/server/xorg-server/dix/xpstubs/Makefile deleted file mode 100644 index 182767380..000000000 --- a/external/mit/xorg/server/xorg-server/dix/xpstubs/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/03 03:17:16 mrg Exp $ - -.include "../../Makefile.serverlib" -.include "../../Makefile.servermod" - -LIB= xpstubs - -.PATH: ${X11SRCDIR.xorg-server}/dix -SRCS= xpstubs.c - -CPPFLAGS+= ${X11FLAGS.DIX} ${X11INCS.DIX} \ - -I${DESTDIR}${X11INCDIR}/xorg - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/doc/Makefile b/external/mit/xorg/server/xorg-server/doc/Makefile deleted file mode 100644 index e77605b02..000000000 --- a/external/mit/xorg/server/xorg-server/doc/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2011/08/02 07:41:00 mrg Exp $ - -.include - -.include "../dix/Makefile.common" - -.PATH: ${X11SRCDIR.xorg-server}/doc -.PATH: ${X11SRCDIR.xorg-server}/doc/man -MAN= Xserver.1 -X11EXTRAMANDEFS+= -e 's%__default_font_path__%${X11DEFAULTFONTPATH:ts,:S/,/, /g}%g' - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/exa/Makefile b/external/mit/xorg/server/xorg-server/exa/Makefile deleted file mode 100644 index 1cce22dd8..000000000 --- a/external/mit/xorg/server/xorg-server/exa/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/09/01 10:18:03 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../Makefile.serverlib" - -LIB= exa -SRCS= ${SRCS.exa} - -.include "Makefile.exa" diff --git a/external/mit/xorg/server/xorg-server/exa/Makefile.exa b/external/mit/xorg/server/xorg-server/exa/Makefile.exa deleted file mode 100644 index 8445ce5e1..000000000 --- a/external/mit/xorg/server/xorg-server/exa/Makefile.exa +++ /dev/null @@ -1,33 +0,0 @@ -# $NetBSD: Makefile.exa,v 1.5 2011/01/15 13:54:53 jmcneill Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/exa - -SRCS.exa=\ - exa.c \ - exa_classic.c \ - exa_migration_classic.c \ - exa_driver.c \ - exa_mixed.c \ - exa_migration_mixed.c \ - exa_accel.c \ - exa_glyphs.c \ - exa_offscreen.c \ - exa_render.c \ - exa_unaccel.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/exa \ - -I${X11SRCDIR.xorg-server}/fb \ - -I${X11SRCDIR.xorg-server}/miext/cw \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -.if !defined(XMODULEDIR) -.include -LIBDIR= ${XMODULEDIR} -.include -.endif diff --git a/external/mit/xorg/server/xorg-server/fb/Makefile b/external/mit/xorg/server/xorg-server/fb/Makefile deleted file mode 100644 index 5cc401178..000000000 --- a/external/mit/xorg/server/xorg-server/fb/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/09 11:14:52 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../Makefile.serverlib" - -LIB= fb -SRCS= ${SRCS.fb} - -.include "Makefile.fb" diff --git a/external/mit/xorg/server/xorg-server/fb/Makefile.fb b/external/mit/xorg/server/xorg-server/fb/Makefile.fb deleted file mode 100644 index 0a019271e..000000000 --- a/external/mit/xorg/server/xorg-server/fb/Makefile.fb +++ /dev/null @@ -1,27 +0,0 @@ -# $NetBSD: Makefile.fb,v 1.8 2011/08/02 09:11:37 mrg Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/fb -SRCS.fb= fb24_32.c fballpriv.c fbarc.c fbbits.c fbblt.c \ - fbbltone.c fbcopy.c \ - fbfill.c fbfillrect.c fbfillsp.c fbgc.c fbgetsp.c \ - fbglyph.c fbimage.c fbline.c fboverlay.c \ - fbpict.c fbpixmap.c fbpoint.c fbpush.c fbscreen.c \ - fbseg.c fbsetsp.c fbsolid.c fbstipple.c fbtile.c \ - fbtrap.c fbutil.c fbwindow.c - -CPPFLAGS+= ${X11FLAGS.DIX} ${X11INCS.DIX} -DHAVE_DIX_CONFIG_H - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -CPPFLAGS+= -DHAVE_DIX_CONFIG_H - -# XXX -COPTS.fbpict.c= -Wno-error -COPTS.fbwindow.c= -Wno-error -COPTS.colormap.c= -Wno-error -COPTS.fboverlay.c= -Wno-error # XXX shmstr.h - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/glx/Makefile b/external/mit/xorg/server/xorg-server/glx/Makefile deleted file mode 100644 index 272fa74fd..000000000 --- a/external/mit/xorg/server/xorg-server/glx/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2009/06/11 05:43:16 mrg Exp $ - -LIBISPRIVATE=yes - -.include "../Makefile.serverlib" - -LIB= glx -SRCS= ${SRCS.glx} - -.include "Makefile.glx" diff --git a/external/mit/xorg/server/xorg-server/glx/Makefile.glx b/external/mit/xorg/server/xorg-server/glx/Makefile.glx deleted file mode 100644 index 62a85a4ac..000000000 --- a/external/mit/xorg/server/xorg-server/glx/Makefile.glx +++ /dev/null @@ -1,72 +0,0 @@ -# $NetBSD: Makefile.glx,v 1.10 2012/10/03 21:50:14 gsutre Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/glx -.PATH: ${X11SRCDIR.MesaLib}/src/mesa/glapi -.PATH: ${X11SRCDIR.MesaLib}/src/glx - -SRCS.glx= \ - indirect_dispatch.c \ - indirect_dispatch_swap.c \ - indirect_reqsize.c \ - indirect_size_get.c \ - indirect_table.c \ - glapi.c \ - glapi_gentable.c \ - glthread.c \ - glxdri.c \ - glxdri2.c \ - extension_string.c \ - indirect_util.c \ - indirect_program.c \ - indirect_texture_compression.c \ - glxcmds.c \ - glxcmdsswap.c \ - glxext.c \ - glxdriswrast.c \ - glxdricommon.c \ - glxscreens.c \ - render2.c \ - render2swap.c \ - renderpix.c \ - renderpixswap.c \ - rensize.c \ - single2.c \ - single2swap.c \ - singlepix.c \ - singlepixswap.c \ - singlesize.c \ - swap_interval.c \ - xfont.c - -COPTS.glxcmds.c= -Wno-error -COPTS.indirect_dispatch.c= -Wno-error -COPTS.indirect_dispatch_swap.c= -Wno-error -COPTS.glxscreens.c= -Wno-error -COPTS.xfont.c= -Wno-error - -CPPFLAGS+= \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/glx \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/dri \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/dri2 \ - -I${X11SRCDIR.MesaLib}/include \ - -I${X11SRCDIR.MesaLib}/src/glx \ - -I${X11SRCDIR.MesaLib}/src/mesa \ - -I${X11SRCDIR.MesaLib}/src/mesa/main \ - -I${X11SRCDIR.MesaLib}/src/mesa/glapi \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/libdrm \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= \ - -DGLXEXT \ - -DGLX_USE_MESA \ - -I${X11SRCDIR.xorg-server}/../include \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/Makefile b/external/mit/xorg/server/xorg-server/hw/Makefile deleted file mode 100644 index 0ccbbce78..000000000 --- a/external/mit/xorg/server/xorg-server/hw/Makefile +++ /dev/null @@ -1,64 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2014/03/01 19:45:29 tsutsui Exp $ - -.include "../Makefile.common" - -SUBDIR= xnest vfb -.if ${XSERVER_XFREE86} != "no" -SUBDIR+= xfree86 -.endif - -.if ${XSERVER_X68K} != "no" -SUBDIR+=netbsd/x68k -.endif - -.if 0 -.if ${XSERVER_XALPHANETBSD} != "no" -SUBDIR+=netbsd/alpha -.endif - -.if ${XSERVER_XAMIGA} != "no" -SUBDIR+=netbsd/amiga -.endif - -.if ${XSERVER_XARM32VIDC} != "no" -SUBDIR+=netbsd/arm32vidc -.endif - -.if ${XSERVER_XDECNETBSD} != "no" -SUBDIR+=netbsd/dec -.endif - -.if ${XSERVER_XDREAMCAST} != "no" -SUBDIR+=netbsd/dreamcast -.endif - -.if ${XSERVER_XFREE86} != "no" -SUBDIR+=xfree86 -.endif - -.if ${XSERVER_XHPC} != "no" -SUBDIR+=netbsd/hpc -.endif - -.if ${XSERVER_XMAC68K} != "no" -SUBDIR+=netbsd/mac68k -.endif - -.if ${XSERVER_XMACPPC} != "no" -SUBDIR+=netbsd/macppc -.endif - -.if ${XSERVER_XNEWSMIPS} != "no" -SUBDIR+=netbsd/newsmips -.endif - -.if ${XSERVER_XSUN} != "no" -SUBDIR+=sun -.endif - -.if ${XSERVER_XVFB} != "no" -SUBDIR+=vfb -.endif -.endif - -.include diff --git a/external/mit/xorg/server/xorg-server/hw/Makefile.inc b/external/mit/xorg/server/xorg-server/hw/Makefile.inc deleted file mode 100644 index 308d7b9c3..000000000 --- a/external/mit/xorg/server/xorg-server/hw/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -#__MINIX -.include "../Makefile.inc" - diff --git a/external/mit/xorg/server/xorg-server/hw/vfb/Makefile b/external/mit/xorg/server/xorg-server/hw/vfb/Makefile deleted file mode 100644 index 9bc24c06b..000000000 --- a/external/mit/xorg/server/xorg-server/hw/vfb/Makefile +++ /dev/null @@ -1,142 +0,0 @@ -# $NetBSD: Makefile,v 1.11 2011/08/02 09:11:38 mrg Exp $ - -.include - -.include "../../Makefile.Xserver" - -PROG= Xvfb - -.PATH: ${X11SRCDIR.xorg-server}/hw/vfb -.PATH: ${X11SRCDIR.xorg-server}/hw/vfb/man -.PATH: ${X11SRCDIR.xorg-server}/Xext -.PATH: ${X11SRCDIR.xorg-server}/Xi -.PATH: ${X11SRCDIR.xorg-server}/mi -SRCS= InitInput.c InitOutput.c dpmsstubs.c miinitext.c stubs.c - -.PATH: ${X11SRCDIR.xorg-server}/fb -SRCS+= fbcmap_mi.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 \ - -I${X11SRCDIR.xorg-server}/fb \ - -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/os \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/render \ - -DHAVE_DIX_CONFIG_H \ - -DNO_HW_ONLY_EXTS \ - -DNO_MODULE_EXTS \ - -UGLXEXT - -.if !defined(__MINIX) -CPPFLAGS+= ${X11FLAGS.OS_DEFINES} ${X11FLAGS.DIX} \ - -DHAS_SHM -DHAS_MMAP -UXFree86LOADER -.else -CPPFLAGS+= ${X11FLAGS.OS_DEFINES} ${X11FLAGS.DIX} \ - -DHAS_SHM -UXFree86LOADER -.endif # !defined(__MINIX) - -.include "../../Makefile.common" - -.if ${XSERVER_XFREE86} == "no" -CPPFLAGS+= -UDDXTIME -.endif - -CPPFLAGS.InitInput.c= ${X11FLAGS.EXTENSION} \ - -UGLXEXT -CPPFLAGS.miinitext.c= ${X11FLAGS.EXTENSION} \ - -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS \ - -UXFree86LOADER \ - -UGLXEXT -CPPFLAGS.dpmsstubs.c= ${X11FLAGS.EXTENSION} \ - -UGLXEXT - -COPTS.InitInput.c= -Wno-error -COPTS.InitOutput.c= -Wno-error - -LDADD+= ${LDADD.dix} \ - ${LDADD.fb} \ - ${LDADD.mi} \ - ${LDADD.xfixes} \ - ${LDADD.Xext} \ - ${LDADD.config} \ - ${LDADD.dbe} \ - ${LDADD.record} \ - ${LDADD.randr} \ - ${LDADD.render} \ - ${LDADD.damageext} \ - ${LDADD.miext/damage} \ - ${LDADD.miext/shadow} \ - ${LDADD.miext/sync} \ - ${LDADD.Xi} \ - ${LDADD.xkb} \ - ${LDADD.xkbstubs} \ - ${LDADD.composite} \ - ${LDADD.os} \ - ${LDADD.glx} \ - -lXfont \ - -lfreetype \ - -lXau \ - -lfontenc \ - ${LIBCWRAPPER} \ - -lpixman-1 \ - -lXdmcp \ - -lz \ - -lm \ - -lcrypto - -DPADD+= ${DPADD.dix} \ - ${DPADD.fb} \ - ${DPADD.mi} \ - ${DPADD.xfixes} \ - ${DPADD.Xext} \ - ${DPADD.config} \ - ${DPADD.dbe} \ - ${DPADD.record} \ - ${DPADD.render} \ - ${DPADD.randr} \ - ${DPADD.damageext} \ - ${DPADD.miext/damage} \ - ${DPADD.miext/shadow} \ - ${DPADD.miext/sync} \ - ${DPADD.Xi} \ - ${DPADD.xkb} \ - ${DPADD.xkbstubs} \ - ${DPADD.composite} \ - ${DPADD.os} \ - ${DPADD.glx} \ - ${LIBXFONT} \ - ${LIBFREETYPE} \ - ${LIBXAU} \ - ${LIBFONTENC} \ - ${LIBPIXMAN1} \ - ${LIBXDMCP} \ - ${LIBZ} \ - ${LIBM} \ - ${LIBCRYPTO} - -.if !defined(__MINIX) -.if ${MACHINE_ARCH} == "i386" -LDADD+= -li386 -DPADD+= ${LIBI386} -.endif - -.if ${MACHINE_ARCH} == "x86_64" -LDADD+= -lx86_64 -DPADD+= ${LIBX86_64} -.endif - -.if ${MACHINE_ARCH} == "alpha" -LDADD+= -lalpha -DPADD+= ${LIBALPHA} -.endif -.endif # !defined(__MINIX) - -COPTS.miinitext.c+= -Wno-error # XXX xf86bigfstr.h - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/Makefile deleted file mode 100644 index f1b8fe651..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile,v 1.33 2011/08/02 09:11:38 mrg Exp $ - -SUBDIR= common init ddc dixmods doc dri dri2 i2c loader \ - xf86modes exa \ - xorgos ramdac shadowfb vbe vgahw \ - x86emu xaa xf86config - -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" || ${MACHINE_ARCH} == "powerpc" -SUBDIR+= int10 -.endif - -SUBDIR+= .WAIT utils - -SUBDIR+= .WAIT Xorg - -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/Makefile.inc b/external/mit/xorg/server/xorg-server/hw/xfree86/Makefile.inc deleted file mode 100644 index 308d7b9c3..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/Makefile.inc +++ /dev/null @@ -1,3 +0,0 @@ -#__MINIX -.include "../Makefile.inc" - diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile deleted file mode 100644 index f21151146..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/Xorg/Makefile +++ /dev/null @@ -1,139 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2015/07/23 08:03:25 mrg Exp $ - -.include - -.include "../../../Makefile.Xserver" - -PROG= Xorg -BINMODE= 4711 - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86 -SRCS= xorg.c libxorg.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 \ - -I${X11SRCDIR.xorg-server}/fb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/os \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/render \ - -DHAVE_DIX_CONFIG_H - -CPPFLAGS+= ${X11FLAGS.OS_DEFINES} ${X11FLAGS.DIX} \ - ${X11FLAGS.EXTENSION} - -LDFLAGS+= -rdynamic - -LDADD+= -Wl,--whole-archive -LDADD+= ${LDADD.dix} -LDADD+= ${LDADD.hw/xfree86/init} -LDADD+= ${LDADD.config} -LDADD+= ${LDADD.hw/xfree86/loader} -LDADD+= ${LDADD.hw/xfree86/common} -LDADD+= ${LDADD.hw/xfree86/xorgos} -#LDADD+= ${LDADD.osandcommon} -LDADD+= ${LDADD.hw/xfree86/xf86config} -LDADD+= ${LDADD.hw/xfree86/dixmods} -LDADD+= ${LDADD.hw/xfree86/xf86modes} -LDADD+= ${LDADD.hw/xfree86/ramdac} -LDADD+= ${LDADD.hw/xfree86/ddc} -LDADD+= ${LDADD.hw/xfree86/i2c} -LDADD+= ${LDADD.composite} -LDADD+= ${LDADD.mi} -LDADD+= ${LDADD.xfixes} -LDADD+= ${LDADD.Xext/Xextbuiltin} -LDADD+= ${LDADD.render} -LDADD+= ${LDADD.randr} -LDADD+= ${LDADD.damageext} -LDADD+= ${LDADD.miext/damage} -LDADD+= ${LDADD.miext/shadow} -LDADD+= ${LDADD.miext/cw} -LDADD+= ${LDADD.miext/sync} -LDADD+= ${LDADD.Xi} -LDADD+= ${LDADD.xkb} -LDADD+= ${LDADD.os} -LDADD+= ${LDADD.glx} -LDADD+= ${LDADD.hw/xfree86/dri} -LDADD+= ${LDADD.hw/xfree86/dri2} -LDADD+= ${LDADD.hw/xfree86/dixmods/fb} -LDADD+= ${LDADD.hw/xfree86/dixmods/xorgxkb} -LDADD+= -lpixman-1 -lXfont -lfreetype -lXau -lfontenc -lXdmcp -LDADD+= -lpciaccess -ldrm -LDADD+= -lcrypto -LDADD+= -Wl,--no-whole-archive - -.if !defined(__MINIX) -.if ${MACHINE_ARCH} == "i386" -LDADD+= -li386 -DPADD+= ${LIBI386} -.elif ${MACHINE_ARCH} == "x86_64" -LDADD+= -lx86_64 -DPADD+= ${LIBX86_64} -.elif ${MACHINE_ARCH} == "alpha" -LDADD+= -lalpha -DPADD+= ${LIBALPHA} -.endif - -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -# Needed by current xf86-video-intel for SNA. -LDADD+= -lpthread -DPADD+= ${LIBPTHREAD} -.endif -.endif # !defined(__MINIX) - -LDADD+= -lm - -DPADD+= ${DPADD.dix} \ - ${DPADD.fb} \ - ${DPADD.mi} \ - ${DPADD.xfixes} \ - ${DPADD.Xext} \ - ${DPADD.config} \ - ${DPADD.dbe} \ - ${DPADD.record} \ - ${DPADD.render} \ - ${DPADD.randr} \ - ${DPADD.damageext} \ - ${DPADD.miext/damage} \ - ${DPADD.miext/shadow} \ - ${DPADD.miext/cw} \ - ${DPADD.miext/sync} \ - ${DPADD.Xi} \ - ${DPADD.xkb} \ - ${DPADD.composite} \ - ${DPADD.os} \ - ${DPADD.glx} \ - ${DPADD.hw/xfree86/dri} \ - ${DPADD.hw/xfree86/dri2} \ - ${DPADD.hw/xfree86/dixmods/fb} \ - ${DPADD.hw/xfree86/fb} \ - ${DPADD.hw/xfree86/init} \ - ${DPADD.hw/xfree86/common} \ - ${DPADD.hw/xfree86/loader} \ - ${DPADD.hw/xfree86/xf86config} \ - ${DPADD.hw/xfree86/dixmods} \ - ${DPADD.hw/xfree86/xf86modes} \ - ${DPADD.hw/xfree86/ramdac} \ - ${DPADD.hw/xfree86/ddc} \ - ${DPADD.hw/xfree86/i2c} \ - ${LIBCWRAPPER} \ - ${LIBXFONT} ${LIBFREETYPE} ${LIBXAU} ${LIBFONTENC} \ - ${LIBPIXMAN1} ${LIBXDMCP} ${LIBZ} ${LIBM} ${LIBPCIACCESS} \ - ${LIBCRYPTO} - -SYMLINKS= ${X11BINDIR}/Xorg ${X11BINDIR}/X - -# Done in ../doc -MKMAN= no - -FILES= xorg-server.m4 -FILESDIR= ${X11ROOTDIR}/share/aclocal - -.PATH: ${X11SRCDIR.xorg-server} - -.include -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile deleted file mode 100644 index 6936c7a4e..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile +++ /dev/null @@ -1,152 +0,0 @@ -# $NetBSD: Makefile,v 1.21 2014/01/16 01:15:33 christos Exp $ - -.include - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= common - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/common -SRCS.xv= xf86xv.c xf86xvmc.c -SRCS.bus= xf86pciBus.c xf86fbBus.c xf86noBus.c -SRCS.randr= xf86RandR.c - -SRCS= xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \ - xf86Cursor.c xf86DGA.c xf86DPMS.c \ - xf86Events.c xf86Globals.c xf86AutoConfig.c \ - xf86Option.c \ - xf86VidMode.c xf86fbman.c xf86cmap.c \ - xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \ - xf86Mode.c xorgHelper.c \ - ${SRCS.xv} ${SRCS.bus} ${SRCS.randr} \ - xf86DefModeSet.c \ - xf86VGAarbiter.c - -.if ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64" -SRCS.bus+= xf86sbusBus.c -.endif - -# Rebuild xf86Build.h on every make -# -CLEANFILES+= xf86Build.h -xf86Build.h: .PHONY - ${_MKTARGET_CREATE} - echo "#define BUILD_DATE `date +%Y%m%d`" > ${.TARGET} - -# We don't use DPSRCS+=xf86Build.h because we don't want the entire -# library to be rebuilt each time -# -xf86Init.c xf86Init.o: xf86Build.h - -CLEANFILES+= xf86DefModeSet.c -xf86DefModeSet.c: - ${_MKTARGET_CREATE} - cat \ - ${X11SRCDIR.xorg-server}/hw/xfree86/common/vesamodes \ - ${X11SRCDIR.xorg-server}/hw/xfree86/common/extramodes | \ - ${TOOL_AWK} -f ${X11SRCDIR.xorg-server}/hw/xfree86/common/modeline2c.awk > ${.TARGET} - @echo >> ${.TARGET} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/os \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xi \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ddc \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/modes \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/i2c \ - -I${X11SRCDIR.xorg-server}/hw/xfree86 \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/parser \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/loader \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/vgahw \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/rac \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/vbe \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/int10 \ - -I${X11SRCDIR.xorg-server}/render \ - -I${X11SRCDIR.xorg-server}/randr \ - -I. \ - -I${X11SRCDIR.xorg-server}/../include \ - -D__${MACHINE} - -.if !defined(__MINIX) -CPPFLAGS+= ${X11FLAGS.EXTENSION} ${X11FLAGS.OS_DEFINES} \ - ${X11FLAGS.DIX} \ - -DXFree86LOADER -DWSCONS_SUPPORT -D__XKBDEFRULES__='"xorg"' \ - -D__XSERVERNAME__='"Xorg"' -D__XCONFIGFILE__='"xorg.conf"' \ - -D__VENDORDWEBSUPPORT__='"http://wiki.X.Org"' \ - -DXVENDORNAME='"The X.Org Foundation"' \ - -DHAVE_XORG_CONFIG_H \ - -DHAVE_PCI_DEVICE_IS_BOOT_VGA -.else -CPPFLAGS+= ${X11FLAGS.EXTENSION} ${X11FLAGS.OS_DEFINES} \ - ${X11FLAGS.DIX} \ - -DXFree86LOADER -D__XKBDEFRULES__='"xorg"' \ - -D__XSERVERNAME__='"Xorg"' -D__XCONFIGFILE__='"xorg.conf"' \ - -D__VENDORDWEBSUPPORT__='"http://wiki.X.Org"' \ - -DXVENDORNAME='"The X.Org Foundation"' \ - -DHAVE_XORG_CONFIG_H \ - -DHAVE_PCI_DEVICE_IS_BOOT_VGA -.endif # !defined(__MINIX) - -.if ${MACHINE_ARCH} == "i386" -.if !defined(__MINIX) -CPPFLAGS+= -DPCCONS_SUPPORT -DPCVT_SUPPORT -.else -CPPFLAGS+= -DPCCONS_SUPPORT -.endif # !defined(__MINIX) -.endif - -.if ${MACHINE} == "cats" || ${MACHINE} == "ofppc" -CPPFLAGS+= -DPCVT_SUPPORT -.endif - -OS_RELEASE!= ${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh - -DRIVERS= mga glint nv tga s3 s3virge sis rendition neomagic \ - i740 tdfx savage cirrus vmware tseng trident chips \ - apm i128 -DRIVERS+= ati i810 ark cyrix siliconmotion via fbdev vesa \ - dummy - -IDRIVERS= mouse keyboard acecad calcomp citron digitaledge \ - dmc dynapro elographics tek4957 microtouch \ - mutouch penmount spaceorb summa wacom void \ - magellan hyperpen jamstudio fpit palmax - -CPPFLAGS.xf86Bus.c= -DBUILDERADDR='"xfree86@xfree86.org"' -CPPFLAGS.xf86Init.c= -DOSNAME='"NetBSD/${MACHINE} ${OS_RELEASE} -"' \ - -DXORG_RELEASE='"Release 1.4.2"' \ - -DBUILDERADDR='"xorg@xorg.org"' \ - -DOSVENDOR='" The NetBSD Foundation, Inc."' -CPPFLAGS.xf86Globals.c= -DDEFAULT_LOGPREFIX='"/var/log/Xorg."' \ - -DDEFAULT_MODULE_PATH='"${X11USRLIBDIR}/modules"' -CPPFLAGS.xf86Configure.c= -DXF86CONFIGFILE='"xorg.conf"' -CPPFLAGS.xf86Config.c= -DDRIVERS='"${DRIVERS}"' \ - -DIDRIVERS='"${IDRIVERS}"' \ - -DPROJECTROOT='"${X11ROOTDIR}"' -CPPFLAGS.xf86AutoConfig.c= -DPROJECTROOT='"${X11ROOTDIR}"' \ - -DBINDIR='"${X11BINDIR}"' \ - -DDRIVERS='"${DRIVERS}"' \ - -DIDRIVERS='"${IDRIVERS}"' - -COPTS.xf86AutoConfig.c= -Wno-error -COPTS.xf86Config.c= -Wno-error -COPTS.xf86Cursor.c= -Wno-error -COPTS.xf86RandR.c= -Wno-error -COPTS.xf86Helper.c= -Wno-error -COPTS.xf86cmap.c= -Wno-error -COPTS.xf86Cursor.c= -Wno-error # XXX xf86dgastr.h -COPTS.xf86DGA.c= -Wno-error # XXX xf86dgastr.h - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/ddc/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/ddc/Makefile deleted file mode 100644 index b199d1d20..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/ddc/Makefile +++ /dev/null @@ -1,23 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2015/07/18 08:56:06 mrg Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= ddc - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= ddc.c interpret_edid.c print_edid.c ddcProperty.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/i2c - -CWARNFLAGS.clang+= -Wno-format - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/GLcore/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/GLcore/Makefile deleted file mode 100644 index 0108bf037..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/GLcore/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/09/26 06:57:03 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= GLcore - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.GLcore} GLcoremodule.c - -.include "../../../../GL/GLcore/Makefile.GLcore" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/Makefile deleted file mode 100644 index 77e56dde7..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# $NetBSD: Makefile,v 1.9 2010/05/22 05:45:01 mrg Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= dixmods - -.PATH: ${X11SRCDIR.xorg-server}/mi -SRCS= miinitext.c - -CPPFLAGS+= \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/loader - -CPPFLAGS+= \ - ${X11FLAGS.EXTENSION} \ - -DHAVE_DIX_CONFIG_H \ - -DXFree86LOADER - -SUBDIR = \ - dbe \ - extmod \ - fb \ - glx \ - record \ - shadow \ - wfb \ - xorgxkb - -COPTS.miinitext.c= -Wno-error # XXX xf86bigfstr.h - -.include -LIBDIR= ${XMODULEDIR} -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/Makefile.dixmod b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/Makefile.dixmod deleted file mode 100644 index 652c129e2..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/Makefile.dixmod +++ /dev/null @@ -1,24 +0,0 @@ -# $NetBSD: Makefile.dixmod,v 1.6 2010/11/23 08:22:31 mrg Exp $ - -.include - -MKLINT= no - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/dbe \ - -I${X11SRCDIR.xorg-server}/glx \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= ${X11FLAGS.DIX} - -.include -LIBDIR=${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/afb/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/afb/Makefile deleted file mode 100644 index 5fa21d053..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/afb/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/08/06 07:16:40 mrg Exp $ - -LIB= afb - -SRCS= afbmodule.c - -.include "../Makefile.dixmod" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/cfb/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/cfb/Makefile deleted file mode 100644 index 8c31d9832..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/cfb/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:23:33 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions -PIXELSIZE= 8 - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= cfb - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.cfb} cfbmodule.c - -.include "../../../../cfb/Makefile.cfb" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/cfb32/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/cfb32/Makefile deleted file mode 100644 index 72a4d64d4..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/cfb32/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:24:12 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions -PIXELSIZE= 32 - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= cfb32 - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.cfb} cfb32module.c - -.include "../../../../cfb/Makefile.cfb" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/dbe/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/dbe/Makefile deleted file mode 100644 index 72fb42d4c..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/dbe/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2010/11/23 08:22:31 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= dbe - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.dbe} dbemodule.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/xorg -CPPFLAGS+= -DHAVE_XORG_CONFIG_H ${X11INCS.DIX} - -COPTS.dbe.c+= -Wno-error - -.include "../../../../dbe/Makefile.dbe" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/extmod/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/extmod/Makefile deleted file mode 100644 index 56adcedbc..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/extmod/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# $NetBSD: Makefile,v 1.10 2010/11/23 08:22:32 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= extmod - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod -SRCS= xf86dga2.c \ - xvmod.c \ - xf86vmode.c \ - modinit.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/afb \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/mfb \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/cfb \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/dbe \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/hw/xfree86/loader \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/miext/shadow \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -CPPFLAGS+= ${X11FLAGS.DIX} ${X11INCS.DIX} \ - -DHAVE_XORG_CONFIG_H - -# XXX -CPPFLAGS.xf86RandR12.c= -Wno-error -CPPFLAGS.xf86dga2.c= -Wno-error -CPPFLAGS.xf86vmode.c= -Wno-error # XXX xf86vmstr.h - -XEXTMODULEOBJDIR!= cd ${NETBSDSRCDIR}/external/mit/xorg/server/xorg-server/Xext/Xextmodule && ${PRINTOBJDIR} -LIBXEXTMODULE= ${XEXTMODULEOBJDIR}/libXextmodule.a - -LDADD= -L${XEXTMODULEOBJDIR} -lXextmodule -DPADD= ${LIBXEXTMODULE} - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/fb/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/fb/Makefile deleted file mode 100644 index 53ff7294f..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/fb/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2015/07/18 08:56:06 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules -XMODULEDIRANDSTATIC= # defined - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= fb - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.fb} fbmodule.c fbcmap_mi.c - -.include "../../../../fb/Makefile.fb" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/freetype/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/freetype/Makefile deleted file mode 100644 index 0d0e084ee..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/freetype/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2009/06/11 05:43:16 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/fonts - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= freetype - -SRCS= # ftmodule.c - -.include "../Makefile.dixmod" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/glx/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/glx/Makefile deleted file mode 100644 index 24b9c4412..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/glx/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2009/06/12 01:59:05 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= glx - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.glx} glxmodule.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/${LIB} - -.include "../../../../glx/Makefile.glx" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/mfb/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/mfb/Makefile deleted file mode 100644 index b4d29d234..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/mfb/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/08/26 04:05:35 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= mfb - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.mfb} mfbmodule.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/xorg - -.include "../../../../mfb/Makefile.mfb" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/record/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/record/Makefile deleted file mode 100644 index 7c481b911..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/record/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/10 06:43:29 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= record - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.record} recordmod.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/common - -.include "../../../../record/Makefile.record" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/shadow/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/shadow/Makefile deleted file mode 100644 index 45b332316..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/shadow/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:37:33 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= shadow - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.shadow} shmodule.c - -.include "../../../../miext/shadow/Makefile.shadow" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/type1/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/type1/Makefile deleted file mode 100644 index 5f7712264..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/type1/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/10 06:30:21 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/fonts - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= type1 - -SRCS= type1mod.c - -.include "../Makefile.dixmod" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/wfb/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/wfb/Makefile deleted file mode 100644 index 11480bc1e..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/wfb/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2009/06/12 01:59:05 mrg Exp $ - -LIB= wfb - -SRCS= fbmodule.c fbcmap_mi.c - -CPPFLAGS+= -DFB_ACCESS_WRAPPER \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/fb - -.include "../Makefile.dixmod" - -.PATH: ${X11SRCDIR.xorg-server}/fb diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/xorgxkb/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/xorgxkb/Makefile deleted file mode 100644 index 8e41d0c3d..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/xorgxkb/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2009/06/12 01:59:05 mrg Exp $ - -LIB= xorgxkb - -SRCS= xkbVT.c xkbPrivate.c xkbKillSrv.c - -CPPFLAGS= -I${X11SRCDIR.xorg-server}/Xext - -.include "../Makefile.dixmod" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/xtrap/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/xtrap/Makefile deleted file mode 100644 index 566a1333f..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dixmods/xtrap/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2008/08/29 04:30:07 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions - -.include "../../../../Makefile.serverlib" -.include "../../../../Makefile.servermod" - -LIB= xtrap - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dixmods -SRCS= ${SRCS.XTrap} xf86XTrapModule.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/xorg - -.include "../../../../XTrap/Makefile.xtrap" diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/doc/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/doc/Makefile deleted file mode 100644 index fa3835699..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/doc/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2011/08/02 07:41:01 mrg Exp $ - -.include - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/doc -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/doc/man - -FILES= README.modes - -FILESDIR= ${X11USRLIBDIR}/X11/doc - -MAN= Xorg.1 xorg.conf.5 -# xorg.conf.d.5? - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dri/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dri/Makefile deleted file mode 100644 index e0879ef45..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dri/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# $NetBSD: Makefile,v 1.11 2015/07/18 08:56:06 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions -XMODULEDIRANDSTATIC= # define - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= dri - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= dri.c drimodule.c xf86dri.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/glx \ - -I${X11SRCDIR.xorg-server}/GL/include \ - -I${X11SRCDIR.xorg-server}/modes \ - -I${X11SRCDIR.xorg-server}/ddc \ - -I${X11SRCDIR.xorg-server}/i2c \ - -I${X11SRCDIR.xorg-server}/parser \ - -I${X11SRCDIR.xorg-server}/ramdac \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.MesaLib}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/dri \ - -I${DESTDIR}${X11INCDIR}/libdrm \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= -DXF86DRI \ - ${X11FLAGS.DIX} - -CPPFLAGS.dri.c= -Wno-error -CPPFLAGS.drimodule.c= -Wno-error # XXX xf86dristr.h -CPPFLAGS.xf86dri.c= -Wno-error # XXX xf86dristr.h - -LIBDPLIBS= drm ${.CURDIR}/../../../../../lib/libdrm - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dri2/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dri2/Makefile deleted file mode 100644 index 16b445551..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dri2/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# $NetBSD: Makefile,v 1.8 2015/07/18 08:56:06 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules/extensions -XMODULEDIRANDSTATIC= # defined - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= dri2 - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= dri2.c dri2ext.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/xfixes \ - -I${X11SRCDIR.xorg-server}/glx \ - -I${X11SRCDIR.xorg-server}/GL/include \ - -I${X11SRCDIR.xorg-server}/modes \ - -I${X11SRCDIR.xorg-server}/ddc \ - -I${X11SRCDIR.xorg-server}/i2c \ - -I${X11SRCDIR.xorg-server}/parser \ - -I${X11SRCDIR.xorg-server}/ramdac \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.MesaLib}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/dri \ - -I${DESTDIR}${X11INCDIR}/libdrm \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= -DXF86DRI \ - -DCOMPOSITE \ - ${X11FLAGS.DIX} - -LIBDPLIBS= drm ${.CURDIR}/../../../../../lib/libdrm - -COPTS.dri2ext.c+= -Wno-error - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/dummy/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/dummy/Makefile deleted file mode 100644 index e91c2b970..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/dummy/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2009/06/12 01:59:05 mrg Exp $ - -MKX11LOADABLE=no - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= dummy - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/dummylib -SRCS= dixprivates.c fatalerror.c logvwrite.c \ - verrorf.c xalloc.c \ - xf86allocscripi.c xf86addrestolist.c xf86drvmsg.c \ - xf86drvmsgverb.c xf86errorf.c xf86errorfverb.c \ - xf86getverb.c xf86info.c xf86msg.c \ - xf86msgverb.c xf86opt.c xf86screens.c xf86servisinit.c \ - xf86verbose.c - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/os-support/shared/ -SRCS+= sigiostubs.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/dummylib \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -COPTS.fatalerror.c+= -Wno-error -COPTS.xf86info.c+= -Wno-error - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/exa/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/exa/Makefile deleted file mode 100644 index 0228ac0e8..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/exa/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2011/08/02 07:41:01 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" -.include "../../../exa/Makefile.exa" - -LIB= exa -MAN= exa.4 - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/exa -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/exa/man -SRCS+= ${SRCS.exa} examodule.c - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/i2c/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/i2c/Makefile deleted file mode 100644 index 3ce59da2f..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/i2c/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2015/07/18 08:56:06 mrg Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= i2c - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= xf86i2c.c # xf86i2cmodule.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR} \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/hw/xfree86 \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= ${X11FLAGS.DIX} - -.include -LIBDIR= ${XMODULEDIR} -.include - diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/init/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/init/Makefile deleted file mode 100644 index 28b7660d9..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/init/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# $NetBSD: Makefile,v 1.9 2014/01/16 01:15:33 christos Exp $ - -.include - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= init - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/common -SRCS= xf86Init.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/os \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xi \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ddc \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/i2c \ - -I${X11SRCDIR.xorg-server}/hw/xfree86 \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/parser \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/loader \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/vgahw \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/rac \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/scanpci \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/vbe \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/int10 \ - -I${X11SRCDIR.xorg-server}/render \ - -I${X11SRCDIR.xorg-server}/randr \ - -I${X11SRCDIR.xorg-server}/../include \ - -I. - -.if !defined(__MINIX) -CPPFLAGS+= ${X11FLAGS.EXTENSION} ${X11FLAGS.OS_DEFINES} \ - ${X11FLAGS.DIX} \ - -DXFree86LOADER -DWSCONS_SUPPORT -D__XKBDEFRULES__='"xorg"' \ - -D__XSERVERNAME__='"Xorg"' -D__XCONFIGFILE__='"xorg.conf"' \ - -D__VENDORDWEBSUPPORT__='"http://wiki.X.Org"' \ - -DXVENDORNAME='"The X.Org Foundation"' \ - -DHAVE_XORG_CONFIG_H -.else -CPPFLAGS+= ${X11FLAGS.EXTENSION} ${X11FLAGS.OS_DEFINES} \ - ${X11FLAGS.DIX} \ - -DXFree86LOADER -D__XKBDEFRULES__='"xorg"' \ - -D__XSERVERNAME__='"Xorg"' -D__XCONFIGFILE__='"xorg.conf"' \ - -D__VENDORDWEBSUPPORT__='"http://wiki.X.Org"' \ - -DXVENDORNAME='"The X.Org Foundation"' \ - -DHAVE_XORG_CONFIG_H -.endif # !defined(__MINIX) - -.if ${MACHINE_ARCH} == "i386" -CPPFLAGS+= -DPCCONS_SUPPORT -DPCVT_SUPPORT -.endif - -.if ${MACHINE} == "cats" || ${MACHINE} == "ofppc" -CPPFLAGS+= -DPCVT_SUPPORT -.endif - -CPPFLAGS.xf86Init.c= -DOSNAME='"NetBSD/${MACHINE} ${OS_RELEASE} -"' \ - -DXORG_RELEASE='"Release 1.4.2"' \ - -DBUILDERADDR='"xorg@xorg.org"' \ - -DDEFAULT_MODULE_PATH=\"${X11USRLIBDIR}/modules\" \ - -DDEFAULT_LIBRARY_PATH=\"${X11USRLIBDIR}\" - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/int10/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/int10/Makefile deleted file mode 100644 index ce46e9114..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/int10/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# $NetBSD: Makefile,v 1.9 2015/07/29 19:03:15 christos Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= int10 - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/int10 -SRCS= x86emu.c generic.c xf86x86emu.c xf86int10.c helper_mem.c \ - helper_exec.c xf86int10module.c - -CPPFLAGS+= -D__DRIVER__ -DFORCE_POST -D_CEXPORT= -DNO_LONG_LONG \ - -D_X86EMU - -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -CPPFLAGS+= -D_PC -.endif - -# do not muck around in IO space trying to enable / disable non-PCI VGAs -.if ${MACHINE} == "macppc" || ${MACHINE} == "sparc64" -CPPFLAGS+= -DNO_LEGACY_VGA -.endif - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/x86emu \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 - -COPTS.xf86x86emu.c= -Wno-error # XXX? - -CWARNFLAGS.clang+= -Wno-format - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/loader/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/loader/Makefile deleted file mode 100644 index bebe698e3..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/loader/Makefile +++ /dev/null @@ -1,57 +0,0 @@ -# $NetBSD: Makefile,v 1.13 2014/03/23 20:39:40 tron Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= loader -LOADERDIR= ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -.PATH: ${LOADERDIR} - -SRCS= loader.c loadext.c loadmod.c os.c sdksyms.c - -.if ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64" -#SRCS+= SparcMulDiv.S -.endif - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/parser \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/vbe \ - -I${X11SRCDIR.xorg-server}/miext/cw \ - -I${X11SRCDIR.xorg-server}/miext/sync \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/int10 \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ddc \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/i2c \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/modes \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ramdac \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/os \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/xfixes \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -CPPFLAGS+= ${X11FLAGS.OS_DEFINES} -DDLOPEN_SUPPORT -DHAS_SHM \ - -DIN_LOADER \ - ${x11FLAGS.DIX} - -.if ${MACHINE_ARCH} == "x86_64" -CPPFLAGS+= -DUseMMAP -.endif - -CPPFLAGS.loadmod.c= ${X11FLAGS.EXTENSION} -DDEFAULT_MODULE_PATH=\"${X11USRLIBDIR}/modules\" -CPPFLAGS.sdksyms.c= ${X11FLAGS.EXTENSION} - -#COPTS.sdksyms.c= -Wno-error -COPTS.loadmod.c= -Wno-error - -sdksyms.c: sdksyms.sh - CPP=${CPP:Q} AWK=${TOOL_AWK:Q} ${HOST_SH} $(LOADERDIR)/sdksyms.sh $(X11SRCDIR.xorg-server) ${CFLAGS} ${CPPFLAGS} -sdksyms.d: sdksyms.c -CLEANFILES+= sdksyms.c sdksyms.dep - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/pcidata/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/pcidata/Makefile deleted file mode 100644 index 46c5da58a..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/pcidata/Makefile +++ /dev/null @@ -1,38 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2009/06/12 01:59:06 mrg Exp $ - -# XXX this one is installed in modular-xorg-server - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= pcidata - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/scanpci -SRCS= xf86PciData.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/os \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xi \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/parser \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/loader \ - -I${X11SRCDIR.xorg-server}/rac \ - -I. - -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -FILES= pci.ids -FILESDIR= ${X11ROOTDIR}/share/pciids -.endif - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/rac/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/rac/Makefile deleted file mode 100644 index 4794aa7df..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/rac/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/08/05 05:25:49 mrg Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= rac - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= xf86RAC.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -CPPFLAGS+= ${X11FLAGS.DIX} - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/ramdac/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/ramdac/Makefile deleted file mode 100644 index 1cb1662fe..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/ramdac/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2010/11/23 08:22:33 mrg Exp $ - -#XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= ramdac - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= xf86RamDac.c xf86RamDacCmap.c \ - xf86Cursor.c xf86HWCurs.c IBM.c BT.c TI.c \ - xf86BitOrder.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= ${X11FLAGS.DIX} - -CPPFLAGS.xf86BitOrder.c= -DRAMDAC_MODULE - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/scanpci/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/scanpci/Makefile deleted file mode 100644 index 933335da1..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/scanpci/Makefile +++ /dev/null @@ -1,34 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2008/08/24 13:47:05 rtr Exp $ - -# XXX this one is installed in modular-xorg-server - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= scanpci - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/scanpci -SRCS= xf86ScanPci.c -DPSRCS+=xf86PciIds.h - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/os \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xi \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/parser \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/loader \ - -I${X11SRCDIR.xorg-server}/rac \ - -I. - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/shadowfb/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/shadowfb/Makefile deleted file mode 100644 index 39ff2f694..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/shadowfb/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2009/06/12 01:59:06 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= shadowfb -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= sfbmodule.c shadow.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/render \ - -I${DESTDIR}${X11INCDIR}/X11/extensions - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/utils/Makefile deleted file mode 100644 index 9e3d69bc8..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $NetBSD: Makefile,v 1.15 2011/02/21 04:42:17 mrg Exp $ - -SUBDIR= cvt gtf -#SUBDIR= cvt gtf xorgconfig - -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -#SUBDIR+=ioport pcitweak scanpci -.endif - -.if ${MACHINE} == "cats" || ${MACHINE} == "macppc" || \ - ${MACHINE} == "netwinder" || ${MACHINE_ARCH} == "sparc" || \ - ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "alpha" || \ - ${MACHINE} == "prep" || ${MACHINE} == "bebox" || \ - ${MACHINE} == "ofppc" -#SUBDIR+=pcitweak scanpci -.endif - -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/Makefile.utils b/external/mit/xorg/server/xorg-server/hw/xfree86/utils/Makefile.utils deleted file mode 100644 index 15c2e685f..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/Makefile.utils +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile.utils,v 1.5 2008/08/15 15:55:06 rtr Exp $ - -.include - -#SCANPCIINCDIR!= cd ${NETBSDSRCDIR}/x11/Xserver/hw/xfree86/bin/xf86cfg && ${PRINTOBJDIR} -#XF86OBJDIR!= cd ${NETBSDSRCDIR}/x11/Xserver/hw/xfree86/xf86config && ${PRINTOBJDIR} -#XLOADEROBJDIR!= cd ${NETBSDSRCDIR}/x11/Xserver/hw/xfree86/xloader && ${PRINTOBJDIR} -DUMMYOBJDIR!= cd ${NETBSDSRCDIR}/external/mit/xorg/server/xorg-server/hw/xfree86/dummy && ${PRINTOBJDIR} -SCANPCIOBJDIR!= cd ${NETBSDSRCDIR}/external/mit/xorg/server/xorg-server/hw/xfree86/scanpci && ${PRINTOBJDIR} -XORGOSOBJDIR!= cd ${NETBSDSRCDIR}/external/mit/xorg/server/xorg-server/hw/xfree86/xorgos && ${PRINTOBJDIR} - -LIBDUMMY= ${DUMMYOBJDIR}/libdummy.a -LIBXORGOS= ${XORGOSOBJDIR}/libxorgos.a -LIBSCANPCI= ${SCANPCIOBJDIR}/libscanpci.a diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/cvt/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/utils/cvt/Makefile deleted file mode 100644 index 51309606b..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/cvt/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2011/08/02 09:11:38 mrg Exp $ - -PROG= cvt -SRCS= cvt.c xf86cvt.c xprintf.c -MAN= cvt.1 - -.include "../Makefile.utils" - -CPPFLAGS+= ${X11FLAGS.DIX} -DHAVE_XORG_CONFIG_H \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/../include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ddc \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/parser - -LDADD+= -lm -DPADD+= ${LIBM} - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/utils/${PROG} -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/utils/man -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/modes -.PATH: ${X11SRCDIR.xorg-server}/os - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/gtf/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/utils/gtf/Makefile deleted file mode 100644 index ed579099d..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/gtf/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2011/08/02 07:41:01 mrg Exp $ - -.include - -PROG= gtf -MAN= gtf.1 - -CPPFLAGS+= -DHAVE_XORG_CONFIG_H \ - -I${X11SRCDIR.xorg-server}/../include - -LDADD+= -lm -DPADD+= ${LIBM} - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/utils/${PROG} -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/utils/man - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/ioport/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/utils/ioport/Makefile deleted file mode 100644 index 41a4eac85..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/ioport/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2010/11/23 08:22:33 mrg Exp $ - -.include - -PROG= ioport -# XXX NOMAN no workie? -MKMAN= no - -.include "../Makefile.utils" - -CPPFLAGS+= -DHAVE_XORG_CONFIG_H \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include - - -LDADD= -L${XORGOSOBJDIR} -lxorgos \ - -L${DUMMYOBJDIR} -lm - -DPADD= ${LIBXORGOS} ${LIBM} - -.if !defined(__MINIX) -.if ${MACHINE_ARCH} == "i386" -LDADD+= -li386 -DPADD+= ${LIBI386} -.elif ${MACHINE_ARCH} == "x86_64" -LDADD+= -lx86_64 -DPADD+= ${LIBX86_64} -.elif ${MACHINE_ARCH} == "alpha" -LDADD+= -lalpha -DPADD+= ${LIBALPHA} -.endif -.endif # !defined(__MINIX) - -LINKS= ${X11BINDIR}/ioport ${X11BINDIR}/inb \ - ${X11BINDIR}/ioport ${X11BINDIR}/inw \ - ${X11BINDIR}/ioport ${X11BINDIR}/inl \ - ${X11BINDIR}/ioport ${X11BINDIR}/outb \ - ${X11BINDIR}/ioport ${X11BINDIR}/outw \ - ${X11BINDIR}/ioport ${X11BINDIR}/outl - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/utils/${PROG} - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/pcitweak/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/utils/pcitweak/Makefile deleted file mode 100644 index d53e219c3..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/pcitweak/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2010/11/23 08:22:34 mrg Exp $ - -.include - -PROG= pcitweak -MAN= pcitweak.1 - -.include "../Makefile.utils" - -CPPFLAGS+= -DHAVE_XORG_CONFIG_H \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include - -LDADD= -L${XORGOSOBJDIR} -lxorgos \ - -L${DUMMYOBJDIR} -lm - -DPADD= ${LIBXORGOS} ${LIBM} - -.if !defined(__MINIX) -.if ${MACHINE_ARCH} == "i386" -LDADD+= -li386 -DPADD+= ${LIBI386} -.elif ${MACHINE_ARCH} == "x86_64" -LDADD+= -lx86_64 -DPADD+= ${LIBX86_64} -.elif ${MACHINE_ARCH} == "alpha" -LDADD+= -lalpha -DPADD+= ${LIBALPHA} -.endif -.endif # !defined(__MINIX) - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/utils/${PROG} - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/scanpci/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/utils/scanpci/Makefile deleted file mode 100644 index 91321d250..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/scanpci/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2010/11/23 08:22:34 mrg Exp $ - -.include - -PROG= scanpci -MAN= scanpci.1 - -.include "../Makefile.utils" - -CPPFLAGS+= -DHAVE_XORG_CONFIG_H \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/scanpci - -LDADD= -L${SCANPCIOBJDIR} -lscanpci \ - -Wl,-rpath,${X11USRLIBDIR}/modules \ - -L${XORGOSOBJDIR} -lxorgos \ - -L${DUMMYOBJDIR} -lm - -DPADD= ${LIBSCANPCI} ${LIBXORGOS} ${LIBM} - -.if !defined(__MINIX) -.if ${MACHINE_ARCH} == "i386" -LDADD+= -li386 -DPADD+= ${LIBI386} -.elif ${MACHINE_ARCH} == "x86_64" -LDADD+= -lx86_64 -DPADD+= ${LIBX86_64} -.elif ${MACHINE_ARCH} == "alpha" -LDADD+= -lalpha -DPADD+= ${LIBALPHA} -.endif -.endif # !defined(__MINIX) - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/utils/${PROG} - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/xorgconfig/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/utils/xorgconfig/Makefile deleted file mode 100644 index 0d26770a5..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/utils/xorgconfig/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# $NetBSD: Makefile,v 1.8 2011/02/21 04:42:17 mrg Exp $ - -.include - -PROG= xorgconfig - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/utils/xorgconfig - -SRCS= xorgconfig.c cards.c - -LDADD= -lxkbfile -lXext -lX11 -DPADD= ${LIBXKBFILE} ${LIBXEXT} ${LIBX11} - -.if !defined(__MINIX) -CPPFLAGS+= -DCARD_DATABASE_FILE='"${X11USRLIBDIR}/X11/Cards"' \ - -DXKB_RULES_DIR=\"${X11USRLIBDIR}/X11/xkb/rules\" \ - -DXVERSION=${XORG_VERSION_CURRENT} \ - -DWSCONS_SUPPORT -D__XKBDEFRULES__='"xorg"' \ - -D__XCONFIGFILE__='"xorg.conf"' \ - -D__XSERVERNAME__='"Xorg"' \ - -D__XKBDEFRULES__='"xorg"' \ - -DXVENDORNAME='"The X.Org Foundation"' \ - -DFILEMANSUFFIX=\"5\" \ - -DXVERSIONSTRING=\"1.4.2\" -.else -CPPFLAGS+= -DCARD_DATABASE_FILE='"${X11USRLIBDIR}/X11/Cards"' \ - -DXKB_RULES_DIR=\"${X11USRLIBDIR}/X11/xkb/rules\" \ - -DXVERSION=${XORG_VERSION_CURRENT} \ - -D__XKBDEFRULES__='"xorg"' \ - -D__XCONFIGFILE__='"xorg.conf"' \ - -D__XSERVERNAME__='"Xorg"' \ - -D__XKBDEFRULES__='"xorg"' \ - -DXVENDORNAME='"The X.Org Foundation"' \ - -DFILEMANSUFFIX=\"5\" \ - -DXVERSIONSTRING=\"1.4.2\" -.endif # !defined(__MINIX) - -.if ${MACHINE_ARCH} == "i386" || ${MACHINE} == "cats" || ${MACHINE} == "ofppc" -CPPFLAGS+= -DPCVT_SUPPORT -.endif - -FILES+= Cards -FILESDIR_Cards= ${X11USRLIBDIR}/X11 - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/vbe/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/vbe/Makefile deleted file mode 100644 index 3c9022615..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/vbe/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2009/06/12 01:59:06 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= vbe - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= vbe.c vbeModes.c vbe_module.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ddc \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/i2c \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/int10 - -# XXX -COPTS.vbe.c= -Wno-error - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/vgahw/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/vgahw/Makefile deleted file mode 100644 index 5a0b53ccd..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/vgahw/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2009/06/12 01:59:06 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= vgahw - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= vgaHW.c vgaHWmodule.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/vgahw \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/cfb \ - -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ddc \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/i2c - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/x86emu/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/x86emu/Makefile deleted file mode 100644 index 3466cb05e..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/x86emu/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/15 15:55:06 rtr Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xf86emu - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/x86emu -SRCS= debug.c \ - decode.c \ - fpu.c \ - ops2.c \ - ops.c \ - prim_ops.c \ - sys.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/x86emu \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -CPPFLAGS+= ${X11FLAGS.DIX} - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/xaa/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/xaa/Makefile deleted file mode 100644 index a63dd082d..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/xaa/Makefile +++ /dev/null @@ -1,78 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2011/08/02 09:11:38 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xaa - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} - -SRCS= xaaInit.c xaaGC.c xaaInitAccel.c xaaFallback.c \ - xaaBitBlt.c xaaCpyArea.c xaaGCmisc.c xaaCpyWin.c \ - xaaCpyPlane.c xaaFillRect.c xaaTEText.c xaaNonTEText.c \ - xaaPCache.c xaaSpans.c xaaROP.c xaaImage.c \ - xaaRect.c xaaLineMisc.c xaaBitOrder.c \ - xaaFillPoly.c xaaWideLine.c xaaTables.c xaaFillArc.c \ - xaaLine.c xaaDashLine.c xaaOverlay.c xaaOffscreen.c \ - xaaOverlayDF.c xaaStateChange.c xaaPict.c - -SRCS+= l-xaaBitmap.c l-xaaStipple.c l-xaaTEGlyph.c \ - l3-xaaBitmap.c l3-xaaStipple.c \ - m-xaaBitmap.c m-xaaStipple.c m-xaaTEGlyph.c \ - m3-xaaBitmap.c m3-xaaStipple.c \ - lf-xaaBitmap.c lf-xaaStipple.c lf-xaaTEGlyph.c \ - lf3-xaaBitmap.c lf3-xaaStipple.c \ - mf-xaaBitmap.c mf-xaaStipple.c mf-xaaTEGlyph.c \ - mf3-xaaBitmap.c mf3-xaaStipple.c \ - s-xaaLine.c s-xaaDashLine.c \ - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/include/extensions \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/miext/cw \ - -I${X11SRCDIR.xorg-server}/render \ - -I${X11SRCDIR.xorg-server}/../include - -# XXX to find files lokoing for "../../../../hw/something" -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod \ - -CPPFLAGS+= ${X11FLAGS.DIX} - -.if 0 -CPPFLAGS.lsb_fixed_xaaBitmap.c= -DLSBFIRST -DFIXEDBASE -CPPFLAGS.lsb_fixed_xaaBitmap3.c= -DLSBFIRST -DFIXEDBASE -DTRIPLE_BITS -CPPFLAGS.lsb_fixed_xaaStipple.c= -DLSBFIRST -DFIXEDBASE -CPPFLAGS.lsb_fixed_xaaStipple3.c= -DLSBFIRST -DFIXEDBASE -DTRIPLE_BITS -CPPFLAGS.lsb_fixed_xaaTEGlyph.c= -DLSBFIRST -DFIXEDBASE -CPPFLAGS.lsb_xaaBitmap.c= -DLSBFIRST -CPPFLAGS.lsb_xaaBitmap3.c= -DLSBFIRST -DTRIPLE_BITS -CPPFLAGS.lsb_xaaStipple.c= -DLSBFIRST -CPPFLAGS.lsb_xaaStipple3.c= -DLSBFIRST -DTRIPLE_BITS -CPPFLAGS.lsb_xaaTEGlyph.c= -DLSBFIRST -CPPFLAGS.msb_fixed_xaaBitmap.c= -DMSBFIRST -DFIXEDBASE -CPPFLAGS.msb_fixed_xaaBitmap3.c= -DMSBFIRST -DFIXEDBASE -DTRIPLE_BITS -CPPFLAGS.msb_fixed_xaaStipple.c= -DMSBFIRST -DFIXEDBASE -CPPFLAGS.msb_fixed_xaaStipple3.c= -DMSBFIRST -DFIXEDBASE -DTRIPLE_BITS -CPPFLAGS.msb_fixed_xaaTEGlyph.c= -DMSBFIRST -DFIXEDBASE -CPPFLAGS.msb_xaaBitmap.c= -DMSBFIRST -CPPFLAGS.msb_xaaBitmap3.c= -DMSBFIRST -DTRIPLE_BITS -CPPFLAGS.msb_xaaStipple.c= -DMSBFIRST -CPPFLAGS.msb_xaaStipple3.c= -DMSBFIRST -DTRIPLE_BITS -CPPFLAGS.msb_xaaTEGlyph.c= -DMSBFIRST -CPPFLAGS.xaaSeg.c= -DPOLYSEGMENT -CPPFLAGS.xaaDashSeg.c= -DPOLYSEGMENT -.endif - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/xf1bpp/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/xf1bpp/Makefile deleted file mode 100644 index d91e4faf4..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/xf1bpp/Makefile +++ /dev/null @@ -1,80 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/08/24 13:47:05 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xf1bpp - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= mfbseg.c \ - mfbpgbwht.c \ - mfbpgbblak.c \ - mfbpgbinv.c \ - mfbigbwht.c \ - mfbigbblak.c \ - mfbpawhite.c \ - mfbpablack.c \ - mfbpainv.c \ - mfbtewhite.c \ - mfbteblack.c \ - mfbplywhite.c \ - mfbplyblack.c \ - mfbplyinv.c \ - mfbbltC.c \ - mfbbltX.c \ - mfbbltCI.c \ - mfbbltO.c \ - mfbbltG.c \ - mfbtileC.c \ - mfbtileG.c - -SRCS+= maskbits.c \ - mfbbitblt.c \ - mfbbres.c \ - mfbbresd.c \ - mfbbstore.c \ - mfbclip.c \ - mfbcmap.c \ - mfbfillarc.c \ - mfbfillrct.c \ - mfbfillsp.c \ - mfbfont.c \ - mfbgc.c \ - mfbgetsp.c \ - mfbhrzvert.c \ - mfbimage.c \ - mfbline.c \ - mfbmisc.c \ - mfbpixmap.c \ - mfbpntwin.c \ - mfbpolypnt.c \ - mfbpushpxl.c \ - mfbscrclse.c \ - mfbscrinit.c \ - mfbsetsp.c \ - mfbwindow.c \ - mfbzerarc.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86 \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -# XXX for ../../../../ files -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod - -COPTS.mfbclip.c= -Wno-error -COPTS.mfbfont.c= -Wno-error -COPTS.mfbmisc.c= -Wno-error -COPTS.mfbpushpxl.c= -Wno-error - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/xf4bpp/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/xf4bpp/Makefile deleted file mode 100644 index c3d3af59f..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/xf4bpp/Makefile +++ /dev/null @@ -1,71 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/08/24 13:47:05 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xf4bpp - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= ppcArea.c \ - ppcBStore.c \ - ppcClip.c \ - ppcCpArea.c \ - ppcCReduce.c \ - ppcDepth.c \ - ppcFillRct.c \ - ppcWinFS.c \ - ppcPixFS.c \ - ppcGC.c \ - ppcGetSp.c \ - ppcImg.c \ - ppcPixmap.c \ - ppcPntWin.c \ - ppcPolyPnt.c \ - ppcQuery.c \ - ppcRslvC.c \ - ppcSetSp.c \ - ppcWindow.c \ - ppcIO.c \ - emulOpStip.c \ - emulRepAre.c \ - emulTile.c \ - vgaGC.c \ - vgaBitBlt.c \ - vgaImages.c \ - vgaStipple.c \ - vgaSolid.c \ - offscreen.c \ - wm3.c \ - mfbimggblt.c \ - mfbline.c \ - mfbseg.c \ - mfbhrzvert.c \ - mfbbres.c \ - mfbbresd.c \ - mfbfillarc.c \ - mfbzerarc.c \ - vgamodule.c - - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/xf1bpp \ - -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/cfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -CPPFLAGS+= -DXF86VGA16 - -# XXX for ../../../../ files -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/xf86config/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/xf86config/Makefile deleted file mode 100644 index e87d1e816..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/xf86config/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2011/08/11 23:15:41 joerg Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xf86config - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/parser -SRCS= DRI.c Device.c Extensions.c Files.c Flags.c Input.c Layout.c \ - Module.c Monitor.c Pointer.c Screen.c Vendor.c Video.c read.c \ - scan.c write.c \ - InputClass.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xi \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/parser \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= ${X11FLAGS.DIX} -CPPFLAGS+= -DPROJECTROOT='"${X11ROOTDIR}"' - -CWARNFLAGS.clang+= -Wno-format - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/xf86modes/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/xf86modes/Makefile deleted file mode 100644 index b729ed99d..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/xf86modes/Makefile +++ /dev/null @@ -1,50 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2011/08/11 23:15:41 joerg Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xf86modes - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/modes -SRCS=\ - xf86Crtc.c \ - xf86Cursors.c \ - xf86cvt.c \ - xf86gtf.c \ - xf86DisplayIDModes.c \ - xf86EdidModes.c \ - xf86Modes.c \ - xf86RandR12.c \ - xf86Rotate.c \ - xf86DiDGA.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ddc \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/i2c \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/loader \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/rac \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/parser \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/scanpci \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/vbe \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/int10 \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/vgahw \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/ramdac \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/xfixes \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= ${X11FLAGS.DIX} \ - -DHAVE_XORG_CONFIG_H - -# XXX -CPPFLAGS.xf86RandR12.c= -Wno-error - -CWARNFLAGS.clang+= -Wno-format - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/xf8_16bpp/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/xf8_16bpp/Makefile deleted file mode 100644 index 78a5c5fea..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/xf8_16bpp/Makefile +++ /dev/null @@ -1,25 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2009/06/12 01:59:07 mrg Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xf8_16bpp - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= xf8_16module.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/xf8_32bpp/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/xf8_32bpp/Makefile deleted file mode 100644 index 9e80b2634..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/xf8_32bpp/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2008/08/24 13:47:05 rtr Exp $ - -XMODULEDIR= ${X11USRLIBDIR}/modules - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xf8_32bpp - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} -SRCS= cfbbstore.c \ - cfbcpyarea.c \ - cfbcpyplane.c \ - cfbgcmisc.c \ - cfbimage.c \ - cfbpntwin.c \ - cfbscrinit.c \ - cfbwindow.c \ - xf86overlay.c \ - cfb8_32module.c \ - cfbgc8.c \ - cfbgc32.c \ - cfbgcunder.c - - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/xf1bpp \ - -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/cfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xext - -# XXX for ../../../../ files -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/dixmods/extmod - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xfree86/xorgos/Makefile b/external/mit/xorg/server/xorg-server/hw/xfree86/xorgos/Makefile deleted file mode 100644 index ed878c1c4..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xfree86/xorgos/Makefile +++ /dev/null @@ -1,186 +0,0 @@ -# $NetBSD: Makefile,v 1.38 2015/09/30 22:58:02 rjs Exp $ - -.include "../../../Makefile.serverlib" -.include "../../../Makefile.servermod" - -LIB= xorgos - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/os-support -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bsd -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/os-support/shared -SRCS.bsd= \ - bsd_VTsw.c bsd_bell.c bsd_init.c bsd_pci.c \ - kmod_noop.c \ - posix_tty.c sigio.c vidmem.c - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/os-support/linux -.if ${MACHINE_ARCH} == "x86_64" -SRCS.bsd+= pm_noop.c -.endif -.if ${MACHINE_ARCH} == "i386" -.if !defined(__MINIX) -SRCS.bsd+= bsd_apm.c -.else -SRCS.bsd+= pm_noop.c -.endif # !defined(__MINIX) -.endif -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -.if !defined(__MINIX) -SRCS.bsd+= i386_video.c lnx_agp.c -.else -SRCS.bsd+= i386_video.c agp_noop.c -.endif # !defined(__MINIX) -.for _FN in ${SRCS.bsd} -.if !defined(__MINIX) -.if ${MACHINE_ARCH} == "i386" -CPPFLAGS.${_FN}+= -DPCCONS_SUPPORT -DHAS_APERTURE_DRV -.endif -CPPFLAGS.${_FN}+= -DUSE_I386_IOPL -DPCVT_SUPPORT -DWSCONS_SUPPORT \ - -DUSESTDRES -DHAVE_SYSV_IPC \ - -DHAS_MTRR_BUILTIN -.else -CPPFLAGS.${_FN}= -DUSESTDRES -DHAVE_SYSV_IPC -.endif # !defined(__MINIX) -.endfor -.endif - -.if ${MACHINE} == "macppc" || ${MACHINE} == "prep" || ${MACHINE} == "bebox" || ${MACHINE} == "ofppc" -SRCS.bsd+= ppc_video.c pm_noop.c lnx_agp.c -.for _FN in ${SRCS.bsd} -CPPFLAGS.${_FN}= -DWSCONS_SUPPORT -DPCVT_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC -.endfor -.endif - -.if ${MACHINE_ARCH} == "alpha" -SRCS.bsd+= alpha_video.c bsd_ev56.c pm_noop.c agp_noop.c -.for _FN in ${SRCS.bsd} -CPPFLAGS.${_FN}= -DWSCONS_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC -DUSE_ALPHA_PIO -.endfor -.endif - -.if ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64" -SRCS.bsd+= ppc_video.c pm_noop.c agp_noop.c -SRCS.bus+= netbsdSbus.c -.for _FN in ${SRCS.bsd} -CPPFLAGS.${_FN}= -DWSCONS_SUPPORT -DPCVT_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC -.endfor -.endif - -.if ${MACHINE} == "ews4800mips" || \ - ${MACHINE} == "hpcmips" || \ - ${MACHINE} == "newsmips" || \ - ${MACHINE} == "sgimips" || \ - ${MACHINE} == "evbmips" -SRCS.bsd+= ppc_video.c pm_noop.c agp_noop.c -.for _FN in ${SRCS.bsd} -CPPFLAGS.${_FN}= -DWSCONS_SUPPORT -DPCVT_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC -.endfor -.endif - -.if ${MACHINE} == "cats" || \ - ${MACHINE} == "evbarm" || \ - ${MACHINE} == "hpcarm" || \ - ${MACHINE} == "shark" || \ - ${MACHINE} == "netwinder" || \ - ${MACHINE} == "zaurus" -SRCS.bsd+= ppc_video.c pm_noop.c agp_noop.c -.for _FN in ${SRCS.bsd} -.if !defined(__MINIX) -CPPFLAGS.${_FN}= -DWSCONS_SUPPORT -DPCVT_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC -.else -CPPFLAGS.${_FN}= -DUSESTDRES -DHAVE_SYSV_IPC -.endif # !defined(__MINIX) -.endfor -.endif - -.if ${MACHINE} == "shark" -CPPFLAGS.ppc_video.c += -DPCI_MAGIC_IO_RANGE=0xf0000000 -.endif - -.if ${MACHINE} == "dreamcast" || \ - ${MACHINE} == "hpcsh" -SRCS.bsd+= ppc_video.c pm_noop.c agp_noop.c -.for _FN in ${SRCS.bsd} -CPPFLAGS.${_FN}= -DWSCONS_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC -.endfor -.endif - -.if ${MACHINE} == "hp300" || \ - ${MACHINE} == "luna68k" || \ - ${MACHINE} == "mac68k" -SRCS.bsd+= ppc_video.c pm_noop.c agp_noop.c -.for _FN in ${SRCS.bsd} -CPPFLAGS.${_FN}= -DWSCONS_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC -.endfor -.endif - -.if ${MACHINE} == "vax" -SRCS.bsd+= ppc_video.c pm_noop.c agp_noop.c -.for _FN in ${SRCS.bsd} -CPPFLAGS.${_FN}= -DWSCONS_SUPPORT -DUSESTDRES -DHAVE_SYSV_IPC -.endfor -.endif - -# some platforms will probably need ioperm_noop.c - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus -SRCS.bus+= Pci.c - -.if ${MACHINE} == "macppc" || ${MACHINE} == "cats" || \ - ${MACHINE} == "sgimips" || ${MACHINE} == "shark" || \ - ${MACHINE} == "netwinder" || ${MACHINE_ARCH} == "sparc" || \ - ${MACHINE_ARCH} == "sparc64" || ${MACHINE_ARCH} == "alpha" || \ - ${MACHINE} == "prep" || ${MACHINE} == "bebox" || ${MACHINE} == "ofppc" -#SRCS.bus+= netbsdPci.c -.endif - -.if ${MACHINE} == "sparc" || ${MACHINE} == "sparc64" || \ - ${MACHINE_ARCH} == "powerpc" || ${MACHINE} == "netwinder" -#CPPFLAGS.netbsdPci.c+= -DPCI_VIA_TTYE0 -.endif - -# XXX .S not built from automake either -.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64" -#SRCS.misc+= CBUSmemcpy.c CIODelay.c CSlowBcopy.c -#CPPFLAGS.BUSmemcpy.S= -DUSE_GAS -#CPPFLAGS.IODelay.S= -DUSE_GAS -#CPPFLAGS.SlowBcopy.S= -DUSE_GAS -.endif - -.if ${MACHINE} == "macppc" || ${MACHINE} == "cats" || \ - ${MACHINE} == "sgimips" || ${MACHINE_ARCH} == "sparc64" || \ - ${MACHINE_ARCH} == "sparc" || ${MACHINE} == "netwinder" || \ - ${MACHINE} == "shark" || ${MACHINE} == "ofppc" || \ - ${MACHINE_ARCH} == "alpha" || ${MACHINE} == "prep" || \ - ${MACHINE} == "bebox" -#SRCS.misc+= CBUSmemcpy.c CIODelay.c CSlowBcopy.c -.endif - -.PATH: ${X11SRCDIR.xorg-server}/hw/xfree86/os-support/misc -SRCS.misc+= SlowBcopy.c - -# XXX namespace collision so avoid it, only has to be done for non-i386. -#BUILDSYMLINKS= BUSmemcpy.c CBUSmemcpy.c \ -# IODelay.c CIODelay.c \ -# SlowBcopy.c CSlowBcopy.c - -SRCS= ${SRCS.bsd} ${SRCS.bus} ${SRCS.misc} xorgos.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bsd \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/bus \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/misc \ - -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support/shared -.if ${X11DRI} != "no" -CPPFLAGS+= ${X11FLAGS.DRI} -.endif - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/hw/xnest/Makefile b/external/mit/xorg/server/xorg-server/hw/xnest/Makefile deleted file mode 100644 index b5703279e..000000000 --- a/external/mit/xorg/server/xorg-server/hw/xnest/Makefile +++ /dev/null @@ -1,120 +0,0 @@ -# $NetBSD: Makefile,v 1.14 2011/08/02 09:11:38 mrg Exp $ - -.include - -PROG= Xnest - -.include "../../Makefile.serverlib" -.include "../../Makefile.servermod" - -.PATH: ${X11SRCDIR.xorg-server}/hw/xnest -.PATH: ${X11SRCDIR.xorg-server}/hw/xnest/man -.PATH: ${X11SRCDIR.xorg-server}/Xext -.PATH: ${X11SRCDIR.xorg-server}/Xi -.PATH: ${X11SRCDIR.xorg-server}/mi -.PATH: ${X11SRCDIR.xorg-server}/fb -SRCS= Args.c Color.c Cursor.c Display.c Events.c Font.c \ - GC.c GCOps.c Handlers.c Init.c Keyboard.c \ - Pixmap.c Pointer.c Screen.c Visual.c Window.c \ - dpmsstubs.c stubs.c miinitext.c \ - fbcmap_mi.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xnest \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/os \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include \ - -I${X11INCS.DIX} - -CPPFLAGS+= ${X11FLAGS.OS_DEFINES} \ - ${X11FLAGS.EXTENSION} \ - ${X11FLAGS.DIX} \ - -DNO_HW_ONLY_EXTS -UXFree86LOADER -UMITSHM \ - -D__XKBDEFRULES__='"xorg"' - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xnest \ - -DHAVE_XNEST_CONFIG_H \ - -UGLXEXT - -CPPFLAGS.Events.c= -Wno-error -CPPFLAGS.Screen.c= -Wno-error -CPPFLAGS.Color.c= -Wno-error -CPPFLAGS.Window.c= -Wno-error -CPPFLAGS.miinitext.c= -UDPMSExtension - -.include "../../Makefile.Xserver" - -LDADD+= ${LDADD.dix} \ - ${LDADD.fb} \ - ${LDADD.mi} \ - ${LDADD.config} \ - ${LDADD.xfixes} \ - ${LDADD.Xext} \ - ${LDADD.dbe} \ - ${LDADD.record} \ - ${LDADD.randr} \ - ${LDADD.render} \ - ${LDADD.damageext} \ - ${LDADD.miext/damage} \ - ${LDADD.cw/cw} \ - ${LDADD.miext/shadow} \ - ${LDADD.miext/sync} \ - ${LDADD.Xi} \ - ${LDADD.xkb} \ - ${LDADD.xkbstubs} \ - ${LDADD.composite} \ - ${LDADD.os} \ - ${LDADD.glx} \ - -lXfont -lXext -lfontenc \ - -lpixman-1 -lX11 -lXau \ - -lXdmcp -lfreetype -lm -lcrypto - -DPADD+= ${LDADD.dix} \ - ${DPADD.fb} \ - ${DPADD.mi} \ - ${DPADD.config} \ - ${DPADD.xfixes} \ - ${DPADD.Xext} \ - ${DPADD.dbe} \ - ${DPADD.record} \ - ${DPADD.render} \ - ${DPADD.randr} \ - ${DPADD.damageext} \ - ${DPADD.miext/damage} \ - ${DPADD.cw/cw} \ - ${DPADD.miext/shadow} \ - ${DPADD.miext/sync} \ - ${DPADD.Xi} \ - ${DPADD.xkb} \ - ${DPADD.composite} \ - ${DPADD.os} \ - ${DPADD.glx} \ - ${LIBXFONT} ${LIBXEXT} ${LIBFONTENC} \ - ${LIBPIXMAN-1} ${LIBX11} ${LIBXAU} \ - ${LIBXDMCP} ${LIBFREETYPE} ${LIBM} ${LIBCRYPTO} - -.if !defined(__MINIX) -.if ${MACHINE_ARCH} == "i386" -LDADD+= -li386 -DPADD+= ${LIBI386} -.endif - -.if ${MACHINE_ARCH} == "x86_64" -LDADD+= -lx86_64 -DPADD+= ${LIBX86_64} -.endif - -.if ${MACHINE_ARCH} == "alpha" -LDADD+= -lalpha -DPADD+= ${LIBALPHA} -.endif -.endif # !defined(__MINIX) - -COPTS.miinitext.c+= -Wno-error # XXX xf86bigfstr.h - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/include/Makefile b/external/mit/xorg/server/xorg-server/include/Makefile deleted file mode 100644 index d05d59eee..000000000 --- a/external/mit/xorg/server/xorg-server/include/Makefile +++ /dev/null @@ -1,61 +0,0 @@ -# $NetBSD: Makefile,v 1.12 2014/11/05 14:30:00 prlw1 Exp $ - -.include - -XORGSRC= ${X11SRCDIR.xorg-server} - -XORGINC_SUBDIR= Xext composite dbe exa fb include mi \ - miext/damage miext/shadow randr render xkb record -XF86_SUBDIR= common ddc dixmods/extmod dri fbdevhw i2c int10 modes \ - os-support os-support/bus parser rac ramdac shadowfb \ - vbe vgahw xaa xf1bpp xf4bpp xf8_16bpp xf8_32bpp dri2 - -.for _dir in ${XORGINC_SUBDIR} -.PATH: ${XORGSRC}/${_dir} -.endfor - -.for _dir in ${XF86_SUBDIR} -.PATH: ${XORGSRC}/hw/xfree86/${_dir} -.endfor - -.PATH: ${XORGSRC}/../include - -INCSDIR=${X11INCDIR}/xorg -INCS= BT.h IBM.h TI.h XIstubs.h Xprintf.h \ - bt829.h \ - callback.h closestr.h closure.h colormap.h \ - colormapst.h compiler.h compositeext.h cursor.h cursorstr.h \ - damage.h damagestr.h \ - dbestruct.h dgaproc.h dix.h dixevents.h dixfont.h dixfontstr.h \ - dixgrabs.h dixstruct.h dri.h dristruct.h edid.h exa.h exevents.h \ - eventconvert.h events.h eventstr.h list.h \ - extension.h extinit.h extnsionst.h fb.h fbdevhw.h fboverlay.h \ - fbpict.h fbrop.h fi1236.h fourcc.h gc.h gcstruct.h geext.h globals.h \ - glyphstr.h i2c_def.h input.h inputstr.h inpututils.h \ - mi.h mibstore.h micmap.h micoord.h mifillarc.h mifpoly.h \ - migc.h miline.h mipict.h mipointer.h mipointrst.h misc.h miscstruct.h \ - mispans.h mistruct.h miwideline.h mizerarc.h msp3430.h opaque.h \ - os.h picture.h picturestr.h pixmap.h pixmapstr.h property.h \ - protocol-versions.h \ - propertyst.h randrstr.h region.h regionstr.h resource.h \ - rgb.h sarea.h screenint.h scrnintstr.h selection.h servermd.h \ - shadow.h shadowfb.h shmint.h site.h swaprep.h swapreq.h \ - tda8425.h tda9850.h \ - tda9885.h uda1380.h validate.h vbe.h vbeModes.h vgaHW.h \ - window.h windowstr.h xaa.h xaalocal.h xaarop.h \ - xkbDflts.h xkb.h set.h \ - xf86.h xf86Crtc.h xf86Cursor.h xf86DDC.h \ - xf86Modes.h xf86Module.h \ - xf86Opt.h xf86Optrec.h xf86Parser.h xf86Pci.h xf86PciInfo.h \ - xf86Priv.h xf86Privstr.h xf86RamDac.h xf86RandR12.h \ - xf86Rename.h xf86Xinput.h xf86_OSlib.h \ - xf86_OSproc.h xf86cmap.h xf86fbman.h \ - xf86i2c.h xf86int10.h xf86sbusBus.h xf86str.h xf86xv.h \ - xkbstr.h xkbrules.h xserver-properties.h \ - dixaccess.h privates.h ptrveloc.h registry.h xkbfile.h \ - xf86xvmc.h xf86xvpriv.h xisb.h xorg-server.h xorgVersion.h xvdix.h \ - xvmcext.h hotplug.h xkbsrv.h dix-config.h dri2.h rrtransform.h \ - xsha1.h version-config.h - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/mfb/Makefile b/external/mit/xorg/server/xorg-server/mfb/Makefile deleted file mode 100644 index 5bb6b2493..000000000 --- a/external/mit/xorg/server/xorg-server/mfb/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:30:20 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../Makefile.serverlib" - -LIB= mfb -SRCS= ${SRCS.mfb} - -.include "Makefile.mfb" diff --git a/external/mit/xorg/server/xorg-server/mfb/Makefile.mfb b/external/mit/xorg/server/xorg-server/mfb/Makefile.mfb deleted file mode 100644 index 42b951312..000000000 --- a/external/mit/xorg/server/xorg-server/mfb/Makefile.mfb +++ /dev/null @@ -1,37 +0,0 @@ -# $NetBSD: Makefile.mfb,v 1.3 2008/08/24 13:30:20 rtr Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/mfb -SRCS.mfb= mfbseg.c mfbpgbwht.c mfbpgbblak.c mfbpgbinv.c mfbigbwht.c \ - mfbigbblak.c mfbpawhite.c mfbpablack.c mfbpainv.c \ - mfbtewhite.c mfbteblack.c mfbbltC.c mfbbltX.c mfbbltCI.c \ - mfbbltO.c mfbbltG.c mfbtileC.c mfbtileG.c mfbplywhite.c \ - mfbplyblack.c mfbplyinv.c mfbgc.c mfbwindow.c mfbfont.c \ - mfbfillrct.c mfbpntwin.c maskbits.c mfbpixmap.c \ - mfbimage.c mfbline.c mfbbres.c mfbhrzvert.c mfbbresd.c \ - mfbpushpxl.c mfbzerarc.c mfbfillarc.c mfbfillsp.c \ - mfbsetsp.c mfbscrinit.c mfbscrclse.c mfbclip.c mfbbitblt.c \ - mfbgetsp.c mfbpolypnt.c mfbcmap.c mfbmisc.c mfbbstore.c - -CPPFLAGS+= ${X11FLAGS.DIX} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/mfb \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include - -# XXX some path so that "../../mfb/mfbblt.c" works -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86 - - -# XXX -COPTS.mfbclip.c+= -Wno-error -COPTS.mfbfont.c+= -Wno-error -COPTS.mfbmisc.c+= -Wno-error -COPTS.mfbpushpxl.c+= -Wno-error - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/mi/Makefile b/external/mit/xorg/server/xorg-server/mi/Makefile deleted file mode 100644 index 03aa0b1bf..000000000 --- a/external/mit/xorg/server/xorg-server/mi/Makefile +++ /dev/null @@ -1,48 +0,0 @@ -# $NetBSD: Makefile,v 1.9 2011/08/02 09:11:38 mrg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= mi - -.PATH: ${X11SRCDIR.xorg-server}/mi -SRCS= miarc.c mibitblt.c micopy.c \ - micmap.c micursor.c midash.c midispcur.c mieq.c \ - miexpose.c mifillarc.c mifillrct.c mifpolycon.c \ - migc.c miglblt.c mioverlay.c mipointer.c mipoly.c \ - mipolycon.c mipolygen.c mipolypnt.c mipolyrect.c \ - mipolyseg.c mipolytext.c mipolyutil.c mipushpxl.c \ - miscrinit.c mispans.c misprite.c \ - mivaltree.c miwideline.c miwindow.c mizerarc.c \ - mizerclip.c mizerline.c - -# XXX the order is important since there are headers with the same -# name but differ depending on location -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/../include \ - -I${X11SRCDIR.xorg-server}/render \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/miext/damage \ - -I${X11SRCDIR.xorg-server}/Xi \ - -I${X11SRCDIR.xorg-server}/hw/xnest \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - ${X11FLAGS.DIX} \ - -DHAVE_XNEST_CONFIG_H - -CPPFLAGS.miscrinit.c= ${X11FLAGS.EXTENSION} - -.if 0 -.if ${MACHINE_ARCH} == "sparc" || ${MACHINE_ARCH} == "sparc64" || ${MACHINE} == "mac68k" -SRCS+= miinitext.c -CPPFLAGS.miinitext.c= ${X11FLAGS.EXTENSION} -CPPFLAGS.miinitext.c+= -UXF86MISC -UXINPUT -UXF86VIDMODE -UXFreeXDGA -CPPFLAGS.miscrinit.c+= -UXF86MISC -UXINPUT -UXF86VIDMODE -UXFreeXDGA -.endif -.endif - -COPTS.micmap.c+= -Wno-error -COPTS.miexpose.c+= -Wno-error - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/miext/Makefile b/external/mit/xorg/server/xorg-server/miext/Makefile deleted file mode 100644 index 5c4d1177f..000000000 --- a/external/mit/xorg/server/xorg-server/miext/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2011/08/02 07:41:02 mrg Exp $ - -SUBDIR= damage shadow cw sync # rootless - -.include diff --git a/external/mit/xorg/server/xorg-server/miext/cw/Makefile b/external/mit/xorg/server/xorg-server/miext/cw/Makefile deleted file mode 100644 index 482ea898b..000000000 --- a/external/mit/xorg/server/xorg-server/miext/cw/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:40:13 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../../Makefile.serverlib" - -LIB= cw -SRCS= ${SRCS.cw} - -.include "Makefile.cw" diff --git a/external/mit/xorg/server/xorg-server/miext/cw/Makefile.cw b/external/mit/xorg/server/xorg-server/miext/cw/Makefile.cw deleted file mode 100644 index c2729e66c..000000000 --- a/external/mit/xorg/server/xorg-server/miext/cw/Makefile.cw +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile.cw,v 1.3 2008/08/24 13:40:13 rtr Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/miext/cw -SRCS.cw= cw.c cw_ops.c cw_render.c - -CPPFLAGS+= ${X11FLAGS.PERVASIVE_EXTENSION} \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/miext/damage/Makefile b/external/mit/xorg/server/xorg-server/miext/damage/Makefile deleted file mode 100644 index 8fd537040..000000000 --- a/external/mit/xorg/server/xorg-server/miext/damage/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:40:13 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../../Makefile.serverlib" - -LIB= damage -SRCS= ${SRCS.damage} - -.include "Makefile.damage" - diff --git a/external/mit/xorg/server/xorg-server/miext/damage/Makefile.damage b/external/mit/xorg/server/xorg-server/miext/damage/Makefile.damage deleted file mode 100644 index 0921a7d7d..000000000 --- a/external/mit/xorg/server/xorg-server/miext/damage/Makefile.damage +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile.damage,v 1.3 2008/08/24 13:40:13 rtr Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/miext/damage -SRCS.damage= damage.c - -CPPFLAGS+= ${X11FLAGS.PERVASIVE_EXTENSION} \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/miext/cw - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/miext/rootless/Makefile b/external/mit/xorg/server/xorg-server/miext/rootless/Makefile deleted file mode 100644 index bb412aa9d..000000000 --- a/external/mit/xorg/server/xorg-server/miext/rootless/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:40:13 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../../Makefile.serverlib" - -LIB= rootless -SRCS= ${SRCS.rootless} - -.include "Makefile.rootless" diff --git a/external/mit/xorg/server/xorg-server/miext/rootless/Makefile.rootless b/external/mit/xorg/server/xorg-server/miext/rootless/Makefile.rootless deleted file mode 100644 index bc1094d88..000000000 --- a/external/mit/xorg/server/xorg-server/miext/rootless/Makefile.rootless +++ /dev/null @@ -1,16 +0,0 @@ -# $NetBSD: Makefile.rootless,v 1.2 2008/08/24 13:40:13 rtr Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/miext/rootless -SRCS.rootless+= rootlessCommon.c rootlessGC.c rootlessScreen.c \ - rootlessValTree.c rootlessWindow.c - -CPPFLAGS+= ${X11FLAGS.PERVASIVE_EXTENSION} \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/miext/cw \ - -I${DESTDIR}${X11INCDIR}/pixman-1 - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/miext/shadow/Makefile b/external/mit/xorg/server/xorg-server/miext/shadow/Makefile deleted file mode 100644 index 66fc25185..000000000 --- a/external/mit/xorg/server/xorg-server/miext/shadow/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/24 13:37:33 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../../Makefile.serverlib" - -LIB= shadow -SRCS= ${SRCS.shadow} - -.include "Makefile.shadow" diff --git a/external/mit/xorg/server/xorg-server/miext/shadow/Makefile.shadow b/external/mit/xorg/server/xorg-server/miext/shadow/Makefile.shadow deleted file mode 100644 index 4492e5cf3..000000000 --- a/external/mit/xorg/server/xorg-server/miext/shadow/Makefile.shadow +++ /dev/null @@ -1,21 +0,0 @@ -# $NetBSD: Makefile.shadow,v 1.3 2008/08/24 13:37:33 rtr Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/miext/shadow -SRCS.shadow+= shadow.c shalloc.c shpacked.c shplanar8.c shplanar.c \ - shrot16pack_180.c shrot16pack_270.c shrot16pack_270YX.c \ - shrot16pack_90.c shrot16pack_90YX.c shrot16pack.c \ - shrot32pack_180.c shrot32pack_270.c shrot32pack_90.c \ - shrot32pack.c shrot8pack_180.c shrot8pack_270.c \ - shrot8pack_90.c shrot8pack.c shrotate.c - -CPPFLAGS+= ${X11FLAGS.PERVASIVE_EXTENSION} \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${X11SRCDIR.xorg-server}/miext/cw \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/miext/sync/Makefile b/external/mit/xorg/server/xorg-server/miext/sync/Makefile deleted file mode 100644 index eec917073..000000000 --- a/external/mit/xorg/server/xorg-server/miext/sync/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2011/08/02 07:41:02 mrg Exp $ - -LIBISPRIVATE= yes - -.include "../../Makefile.serverlib" - -LIB= sync -SRCS= ${SRCS.sync} - -.include "Makefile.sync" diff --git a/external/mit/xorg/server/xorg-server/miext/sync/Makefile.sync b/external/mit/xorg/server/xorg-server/miext/sync/Makefile.sync deleted file mode 100644 index 779d92cc5..000000000 --- a/external/mit/xorg/server/xorg-server/miext/sync/Makefile.sync +++ /dev/null @@ -1,15 +0,0 @@ -# $NetBSD: Makefile.sync,v 1.1 2011/08/02 07:41:02 mrg Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/miext/sync -SRCS.sync= misync.c - -CPPFLAGS+= ${X11FLAGS.PERVASIVE_EXTENSION} \ - ${X11FLAGS.DIX} ${X11INCS.DIX} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/hw/xfree86/os-support \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/os/Makefile b/external/mit/xorg/server/xorg-server/os/Makefile deleted file mode 100644 index 04caf8f19..000000000 --- a/external/mit/xorg/server/xorg-server/os/Makefile +++ /dev/null @@ -1,68 +0,0 @@ -# $NetBSD: Makefile,v 1.11 2015/07/23 08:03:25 mrg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= os - -.PATH: ${X11SRCDIR.xorg-server}/os -SRCS= WaitFor.c access.c auth.c connection.c io.c mitauth.c \ - oscolor.c osinit.c utils.c xdmauth.c \ - xstrans.c xprintf.c log.c xdmcp.c \ - rpcauth.c backtrace.c xprintf.c xsha1.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/render \ - -I${X11SRCDIR.xorg-server}/lbx \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= ${X11FLAGS.DIX} \ - ${X11FLAGS.CONNECTION} \ - ${X11FLAGS.EXTENSION} \ - -DHASXDMAUTH \ - ${X11FLAGS.OS_DEFINES} \ - -DUSE_RGB_TXT \ - -UDDXTIME \ - -DHAVE_SHA1_IN_LIBC \ - -DMONOTONIC_CLOCK - -.include "../Makefile.common" - -.if 0 -# XXX The XFree86 Xserver has its own GetTimeInMillis(), however if we are -# building XFree86 and Xmacppc or Xsun* we want both copies. The copy -# here is linked into the non XFree86 server. -#.if ${XSERVER_XFREE86} == "no" || \ -# ${XSERVER_XMACPPC} != "no" || \ -# ${XSERVER_XSUN} != "no" -SRCS+= GetTimeInMillis.c -SRCS+= ddxInitGlobals.c -#.endif - -XDMCP_DEFINES= -DXDMCP -DXDMCP_NO_IPV6 - -CPPFLAGS.WaitFor.c= ${X11FLAGS.EXTENSION} -CPPFLAGS.access.c= ${XDMCP_DEFINES} -DBSD44SOCKETS -DHAS_GETIFADDRS -CPPFLAGS.auth.c= ${XDMCP_DEFINES} -DHAVE_ARC4RANDOM -CPPFLAGS.connection.c= ${XDMCP_DEFINES} -DBSD44SOCKETS -CPPFLAGS.io.c= ${X11FLAGS.EXTENSION} -CPPFLAGS.lbxio.c= ${X11FLAGS.EXTENSION} -CPPFLAGS.oscolor.c= -DNDBM -CPPFLAGS.osinit.c= -DADMPATH=\"/var/log/X\%smsgs\" -CPPFLAGS.transport.c= -DBSD44SOCKETS -CPPFLAGS.utils.c= ${XDMCP_DEFINES} ${X11FLAGS.EXTENSION} -CPPFLAGS.xdmauth.c= ${XDMCP_DEFINES} -CPPFLAGS.xdmcp.c= ${XDMCP_DEFINES} -DBSD44SOCKETS -.endif - -COPTS.xdmauth.c= -Wno-error # XXX -COPTS.xstrans.c= -Wno-error # XXX -COPTS.access.c= -Wno-error # XXX bigreqstr.h -COPTS.io.c= -Wno-error # XXX bigreqstr.h - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/randr/Makefile b/external/mit/xorg/server/xorg-server/randr/Makefile deleted file mode 100644 index e5c56ca52..000000000 --- a/external/mit/xorg/server/xorg-server/randr/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2011/08/02 09:11:39 mrg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= randr - -.PATH: ${X11SRCDIR.xorg-server}/randr -SRCS= randr.c randrstr.h rrcrtc.c rrdispatch.c \ - rrinfo.c rrmode.c rroutput.c rrpointer.c rrproperty.c \ - rrscreen.c rrsdispatch.c rrtransform.c -SRCS+= rrxinerama.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/../include -CPPFLAGS+= ${X11FLAGS.DIX} - -COPTS.randr.c+= -Wno-error -COPTS.rrcrtc.c+= -Wno-error -COPTS.rrdispatch.c+= -Wno-error -COPTS.rrmode.c+= -Wno-error -COPTS.rroutput.c+= -Wno-error -COPTS.rrproperty.c+= -Wno-error - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/record/Makefile b/external/mit/xorg/server/xorg-server/record/Makefile deleted file mode 100644 index ef794b10d..000000000 --- a/external/mit/xorg/server/xorg-server/record/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.2 2008/08/10 06:42:39 rtr Exp $ - -LIBISPRIVATE= yes - -.include "../Makefile.serverlib" - -LIB= record -SRCS= ${SRCS.record} - -.include "Makefile.record" diff --git a/external/mit/xorg/server/xorg-server/record/Makefile.record b/external/mit/xorg/server/xorg-server/record/Makefile.record deleted file mode 100644 index dd56d6df8..000000000 --- a/external/mit/xorg/server/xorg-server/record/Makefile.record +++ /dev/null @@ -1,18 +0,0 @@ -# $NetBSD: Makefile.record,v 1.3 2008/08/24 13:47:05 rtr Exp $ - -.PATH: ${X11SRCDIR.xorg-server}/record -SRCS.record= record.c set.c - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/Xext - -CPPFLAGS+= -DNDEBUG - -# XXX -COPTS.record.c= -Wno-error - -.include -LIBDIR= ${XMODULEDIR} -.include diff --git a/external/mit/xorg/server/xorg-server/render/Makefile b/external/mit/xorg/server/xorg-server/render/Makefile deleted file mode 100644 index 6b350424f..000000000 --- a/external/mit/xorg/server/xorg-server/render/Makefile +++ /dev/null @@ -1,24 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2011/08/02 09:11:39 mrg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= render - -.PATH: ${X11SRCDIR.xorg-server}/render -SRCS= animcur.c filter.c glyph.c matrix.c miindex.c mipict.c \ - mirect.c mitrap.c mitri.c picture.c render.c - -CPPFLAGS+= -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${DESTDIR}${X11INCDIR}/xorg \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/../include -CPPFLAGS+= ${X11FLAGS.DIX} - -COPTS.miglyph.c=-Wno-error # XXX gcc 3.3 -COPTS.mirect.c= -Wno-error # XXX gcc 3.3 -COPTS.picture.c= -Wno-error -COPTS.render.c= -Wno-error - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/xfixes/Makefile b/external/mit/xorg/server/xorg-server/xfixes/Makefile deleted file mode 100644 index 9ae9c9178..000000000 --- a/external/mit/xorg/server/xorg-server/xfixes/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2009/08/22 02:40:28 mrg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= xfixes - -.PATH: ${X11SRCDIR.xorg-server}/xfixes -SRCS= cursor.c region.c saveset.c select.c xfixes.c - -CPPFLAGS+= ${X11FLAGS.PERVASIVE_EXTENSION} ${X11FLAGS.DIX} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/fixes \ - -I${X11SRCDIR.xorg-server}/render \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/../include - -# XXX -COPTS.cursor.c+= -Wno-error -COPTS.region.c+= -Wno-error -COPTS.select.c+= -Wno-error - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/xkb/Makefile b/external/mit/xorg/server/xorg-server/xkb/Makefile deleted file mode 100644 index 43fadc4ba..000000000 --- a/external/mit/xorg/server/xorg-server/xkb/Makefile +++ /dev/null @@ -1,54 +0,0 @@ -# $NetBSD: Makefile,v 1.8 2010/11/23 08:22:35 mrg Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= xkb - -.PATH: ${X11SRCDIR.xorg-server}/${LIB} -.PATH: ${X11SRCDIR.X11}/src -.PATH: ${X11SRCDIR.xkbfile}/src -DDXSRCS= ddxBeep.c ddxCtrls.c \ - ddxLEDs.c ddxLoad.c \ - ddxList.c -DIXSRCS= xkb.c xkbUtils.c xkbEvents.c xkbAccessX.c xkbSwap.c \ - xkbLEDs.c xkbInit.c xkbActions.c xkbPrKeyEv.c -XKBFILESRCS= maprules.c xkmread.c xkbtext.c xkbfmisc.c \ - xkbout.c -X11SRCS= XKBMisc.c XKBAlloc.c XKBGAlloc.c XKBMAlloc.c - -SRCS= ${DDXSRCS} ${DIXSRCS} ${XKBFILESRCS} ${X11SRCS} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/Xext/extmod \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/Xi \ - -I${X11SRCDIR.xorg-server}/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/../include - -# For ${XKBROOTDIR} and ${XKBCOMPDIR} -.include "../../../bin/xkbcomp/Makefile.common" - -# XXX: ddxLoad.c expects XKM_OUTPUT_DIR to have a trailing '/'. - -CPPFLAGS+= -DXKB_IN_SERVER -DHAVE_XKB_CONFIG_H \ - -DXKB_BASE_DIRECTORY=\"${XKBROOTDIR}\" \ - -DXKB_BIN_DIRECTORY=\"${X11BINDIR}\" \ - -DXKM_OUTPUT_DIR=\"${XKBCOMPDIR}/\" \ - -DXKB_DFLT_DISABLED=0 - -COPTS.XKBAlloc.c= -Wno-error # XXX gcc 3.3 -COPTS.XKBMAlloc.c= -Wno-error # XXX gcc 3.3 -COPTS.xkb.c= -Wno-error # XXX gcc 3.3 -COPTS.xkbUtils.c= -Wno-error # XXX gcc 3.3 - -CLEANFILES+= ${BUILDOBJS} -realall: ${BUILDOBJS} - -.include -.include diff --git a/external/mit/xorg/server/xorg-server/xkbstubs/Makefile b/external/mit/xorg/server/xorg-server/xkbstubs/Makefile deleted file mode 100644 index 627ffd6b0..000000000 --- a/external/mit/xorg/server/xorg-server/xkbstubs/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2008/12/22 01:04:27 jmcneill Exp $ - -.include "../Makefile.serverlib" -.include "../Makefile.servermod" - -LIB= xkbstubs - -.PATH: ${X11SRCDIR.xorg-server}/xkb -DDXSRCS= ddxVT.c ddxPrivate.c ddxKillSrv.c - -SRCS= ${DDXSRCS} - -CPPFLAGS+= -I${X11SRCDIR.xorg-server}/include \ - -I${DESTDIR}${X11INCDIR}/X11 \ - -I${DESTDIR}${X11INCDIR}/X11/extensions \ - -I${DESTDIR}${X11INCDIR}/pixman-1 \ - -I${X11SRCDIR.xorg-server}/Xext \ - -I${X11SRCDIR.xorg-server}/Xext/extmod \ - -I${X11SRCDIR.xorg-server}/mi \ - -I${X11SRCDIR.xorg-server}/${LIB} \ - -I${X11SRCDIR.xorg-server}/hw/xfree86/common \ - -I${X11SRCDIR.xorg-server}/../include - -CPPFLAGS+= -DXKB_IN_SERVER -DHAVE_XKB_CONFIG_H - -CLEANFILES+= ${BUILDOBJS} -realall: ${BUILDOBJS} - -.include -.include diff --git a/external/mit/xorg/tools/fc-cache/Makefile b/external/mit/xorg/tools/fc-cache/Makefile deleted file mode 100644 index e14ab0670..000000000 --- a/external/mit/xorg/tools/fc-cache/Makefile +++ /dev/null @@ -1,121 +0,0 @@ -# $NetBSD: Makefile,v 1.10 2015/07/20 04:10:40 mrg Exp $ - -NOMAN= 1 - -.include - -HOSTPROG= fc-cache - -FONTCONFIG= ${X11SRCDIR.fontconfig} -FREETYPE= ${X11SRCDIR.freetype} -EXPAT= ${NETBSDSRCDIR}/external/mit/expat/dist - -.PATH: ${FONTCONFIG}/fc-cache -SRCS.fc-cache= fc-cache.c - -.PATH: ${FONTCONFIG}/src -SRCS.fontconfig= fcatomic.c fcblanks.c fccache.c fccfg.c \ - fccharset.c fcdbg.c fccompat.c fcdefault.c fcdir.c \ - fcfreetype.c fcfs.c fchash.c fcinit.c fclang.c \ - fclist.c fcmatch.c fcmatrix.c fcname.c fcobjs.c \ - fcpat.c fcserialize.c fcstat.c fcstr.c fcxml.c \ - ftglue.c - -.PATH: ${FREETYPE}/src/base -SRCS.freetype= ftapi.c ftbase.c ftbbox.c ftbdf.c ftdebug.c ftfntfmt.c \ - ftglyph.c ftinit.c ftmm.c ftpfr.c ftstroke.c ftsynth.c \ - ftsystem.c fttype1.c ftwinfnt.c ftbitmap.c - -.PATH: ${FREETYPE}/src/autofit -SRCS.freetype+= autofit.c - -.PATH: ${FREETYPE}/src/bdf -SRCS.freetype+= bdf.c - -.PATH: ${FREETYPE}/src/cff -SRCS.freetype+= cff.c - -.PATH: ${FREETYPE}/src/cid -SRCS.freetype+= type1cid.c - -.PATH: ${FREETYPE}/src/gzip -SRCS.freetype+= ftgzip.c - -#.PATH: ${FREETYPE}/src/bzip2 -#SRCS.freetype+= ftbzip2.c - -.PATH: ${FREETYPE}/src/lzw -SRCS.freetype+= ftlzw.c - -.PATH: ${FREETYPE}/src/pcf -SRCS.freetype+= pcf.c - -.PATH: ${FREETYPE}/src/pfr -SRCS.freetype+= pfr.c - -.PATH: ${FREETYPE}/src/psaux -SRCS.freetype+= psaux.c - -.PATH: ${FREETYPE}/src/pshinter -SRCS.freetype+= pshinter.c - -.PATH: ${FREETYPE}/src/psnames -SRCS.freetype+= psnames.c - -.PATH: ${FREETYPE}/src/raster -SRCS.freetype+= raster.c - -.PATH: ${FREETYPE}/src/sfnt -SRCS.freetype+= sfnt.c - -.PATH: ${FREETYPE}/src/smooth -SRCS.freetype+= smooth.c - -.PATH: ${FREETYPE}/src/truetype -SRCS.freetype+= truetype.c - -.PATH: ${FREETYPE}/src/type1 -SRCS.freetype+= type1.c - -.PATH: ${FREETYPE}/src/type42 -SRCS.freetype+= type42.c - -.PATH: ${FREETYPE}/src/winfonts -SRCS.freetype+= winfnt.c - -.PATH: ${EXPAT}/lib -SRCS.expat= xmlparse.c xmltok.c xmlrole.c - -SRCS= ${SRCS.fc-cache} ${SRCS.fontconfig} ${SRCS.freetype} ${SRCS.expat} - -# XXX FONTCONFIG_PATH was arbitrarily chosen -HOST_CPPFLAGS= -DFONTCONFIG_PATH='"${DESTDIR}/etc/X11/fonts"' \ - -DFC_DEFAULT_FONTS='"${X11FONTDIR}/Type1"' \ - -DFC_CACHEDIR='"${DESTDIR}/var/cache/fontconfig"' \ - -DHAVE_FT_BITMAP_SIZE_Y_PPEM \ - -DHAVE_FT_GET_BDF_PROPERTY \ - -DHAVE_FT_GET_NEXT_CHAR \ - -DHAVE_FT_GET_PS_FONT_INFO \ - -DHAVE_FT_GET_X11_FONT_FORMAT \ - -DHAVE_FT_HAS_PS_GLYPH_NAMES \ - -DHAVE_EXPAT -DXFREE86_FT2 -DHAVE_INTTYPES_H \ - -DFT2_BUILD_LIBRARY \ - -DXML_BYTE_ORDER=0 -DHAVE_MEMMOVE=1 \ - -DHAVE_STDINT_H -DHAVE_RANDOM -DDARWIN_NO_CARBON \ - -DHAVE_SYS_TYPES_H -DHAVE_FCNTL_H -DHAVE_SYS_STAT_H \ - -DHAVE_MKSTEMP \ - -DHAVE_SCANDIR \ - -DFLEXIBLE_ARRAY_MEMBER="/**/" -HOST_CPPFLAGS+= -DFT_CONFIG_OPTION_DISABLE_BZIP2 -HOST_CPPFLAGS+= -I${FONTCONFIG} -I${FREETYPE} \ - -I${FREETYPE}/include -I${EXPAT}/lib \ - -I${FONTCONFIG}/../include \ - -I${DESTDIR}${X11INCDIR} -I. - -LDADD= -lz -#LDADD+= -lbz2 - -.include "../../lib/fontconfig/src/Makefile.fcarch" - -.include -.include diff --git a/external/mit/xorg/tools/fc-cache/Makefile.fc-cache b/external/mit/xorg/tools/fc-cache/Makefile.fc-cache deleted file mode 100644 index 85b14f4b6..000000000 --- a/external/mit/xorg/tools/fc-cache/Makefile.fc-cache +++ /dev/null @@ -1,7 +0,0 @@ -# $NetBSD: Makefile.fc-cache,v 1.1.1.1 2008/07/29 05:01:23 mrg Exp $ - -FCCACHEDIR!= cd ${NETBSDSRCDIR}/external/mit/xorg/tools/fc-cache && ${PRINTOBJDIR} -FCCACHE= ${FCCACHEDIR}/fc-cache - -${FCCACHE}: - (cd ${NETBSDSRCDIR}/external/mit/xorg/tools/fc-cache && ${MAKE}) diff --git a/external/mit/xorg/tools/makestrs/Makefile b/external/mit/xorg/tools/makestrs/Makefile deleted file mode 100644 index 1d19b8ffe..000000000 --- a/external/mit/xorg/tools/makestrs/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -# $NetBSD: Makefile,v 1.4 2015/06/24 22:20:26 matt Exp $ - -NOMAN= 1 - -.include - -.PATH: ${X11SRCDIR.Xt}/util - -PROG= makestrs -SRCS= makestrs.c - -CPPFLAGS+= -I. - -.include diff --git a/external/mit/xorg/tools/mkfontscale/Makefile b/external/mit/xorg/tools/mkfontscale/Makefile deleted file mode 100644 index cf4936058..000000000 --- a/external/mit/xorg/tools/mkfontscale/Makefile +++ /dev/null @@ -1,93 +0,0 @@ -# $NetBSD: Makefile,v 1.7 2015/07/23 08:03:26 mrg Exp $ - -NOMAN= 1 - -.include - -HOSTPROG= mkfontscale - -FREETYPE= ${X11SRCDIR.freetype} - -.PATH: ${X11SRCDIR.${HOSTPROG}} -SRCS.mkfontscale= mkfontscale.c list.c hash.c ident.c - -.PATH: ${FREETYPE}/src/base -SRCS.freetype+= ftapi.c ftbase.c ftbbox.c ftbdf.c ftdebug.c ftfntfmt.c \ - ftglyph.c ftinit.c ftmm.c ftpfr.c ftstroke.c ftsynth.c \ - ftsystem.c fttype1.c ftwinfnt.c ftbitmap.c - -.PATH: ${FREETYPE}/src/autofit -SRCS.freetype+= autofit.c - -.PATH: ${FREETYPE}/src/bdf -SRCS.freetype+= bdf.c - -.PATH: ${FREETYPE}/src/cff -SRCS.freetype+= cff.c - -.PATH: ${FREETYPE}/src/cid -SRCS.freetype+= type1cid.c - -.PATH: ${FREETYPE}/src/gzip -SRCS.freetype+= ftgzip.c - -#.PATH: ${FREETYPE}/src/bzip2 -#SRCS.freetype+= ftbzip2.c - -.PATH: ${FREETYPE}/src/lzw -SRCS.freetype+= ftlzw.c - -.PATH: ${FREETYPE}/src/pcf -SRCS.freetype+= pcf.c - -.PATH: ${FREETYPE}/src/pfr -SRCS.freetype+= pfr.c - -.PATH: ${FREETYPE}/src/psaux -SRCS.freetype+= psaux.c - -.PATH: ${FREETYPE}/src/pshinter -SRCS.freetype+= pshinter.c - -.PATH: ${FREETYPE}/src/psnames -SRCS.freetype+= psnames.c - -.PATH: ${FREETYPE}/src/raster -SRCS.freetype+= raster.c - -.PATH: ${FREETYPE}/src/sfnt -SRCS.freetype+= sfnt.c - -.PATH: ${FREETYPE}/src/smooth -SRCS.freetype+= smooth.c - -.PATH: ${FREETYPE}/src/truetype -SRCS.freetype+= truetype.c - -.PATH: ${FREETYPE}/src/type1 -SRCS.freetype+= type1.c - -.PATH: ${FREETYPE}/src/type42 -SRCS.freetype+= type42.c - -.PATH: ${FREETYPE}/src/winfonts -SRCS.freetype+= winfnt.c - -.PATH: ${X11SRCDIR.fontenc}/src -SRCS.fontenc= fontenc.c encparse.c - -SRCS+= ${SRCS.mkfontscale} ${SRCS.freetype} ${SRCS.fontenc} - -LDADD= -lz -#LDADD+= -lbz2 - -HOST_CPPFLAGS= -DFONTENC_NO_LIBFONT -DXFREE86_FT2 -DFONTENC_NO_LIBFONT \ - -DFT2_BUILD_LIBRARY -DDARWIN_NO_CARBON \ - -DFONT_ENCODINGS_DIRECTORY=\"${X11FONTDIR}/encodings/encodings.dir\" \ - -DPACKAGE_STRING=\"NetBSD\ tools\ version\" -HOST_CPPFLAGS+= -DFT_CONFIG_OPTION_DISABLE_BZIP2 -HOST_CPPFLAGS+= -I${FREETYPE}/include -I${DESTDIR}${X11INCDIR} \ - -I${DESTDIR}${X11INCDIR}/freetype2 - -.include -.include diff --git a/external/mit/xorg/xorg-pkg-ver.mk b/external/mit/xorg/xorg-pkg-ver.mk deleted file mode 100644 index a3612856b..000000000 --- a/external/mit/xorg/xorg-pkg-ver.mk +++ /dev/null @@ -1,47 +0,0 @@ -# $NetBSD: xorg-pkg-ver.mk,v 1.8 2015/08/09 10:09:07 aymeric Exp $ - -# when including this make sure PROG is set so that $X11SRCDIR.$PROG -# is a valid setting. set XORG_PKG_VER_PROG if PROG is wrong. -# set XORG_PKG_VER_CONFIG_PATH if "configure" at the top-level is wrong. - -XORG_PKG_VER_PROG?= ${PROG} - -XORG_PKG_VER_CONFIG_PATH?= configure -_XORG_PKG_CONFIGURE_PATH= ${X11SRCDIR.${XORG_PKG_VER_PROG}}/${XORG_PKG_VER_CONFIG_PATH} - -.if exists(${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure) -XORG_PKG_PACKAGE_VERSION!= \ - ${TOOL_AWK} -F= '/^PACKAGE_VERSION=/ { \ - match($$2, "([0-9]+\\.)+[0-9]+"); \ - version = substr($$2, RSTART, RLENGTH); \ - print version; \ - exit 0; \ - }' ${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure -.if !empty(XORG_PKG_PACKAGE_VERSION) -CPPFLAGS+= -DPACKAGE_VERSION=\"${XORG_PKG_PACKAGE_VERSION:Q}\" -CPPFLAGS+= -DVERSION=\"${XORG_PKG_PACKAGE_VERSION:Q}\" -.endif - -XORG_PKG_PACKAGE_STRING!= \ - ${TOOL_AWK} -F= '/^PACKAGE_STRING=/ { \ - match($$2, "[-_a-zA-Z]+[ ]+([0-9]+\\.)+[0-9]+"); \ - string = substr($$2, RSTART, RLENGTH); \ - print string; \ - exit 0; \ - }' ${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure -.if !empty(XORG_PKG_PACKAGE_STRING) -CPPFLAGS+= -DPACKAGE_STRING=\"${XORG_PKG_PACKAGE_STRING:Q}\" -.endif - -XORG_PKG_PACKAGE_NAME!= \ - ${TOOL_AWK} -F= '/^PACKAGE_NAME=/ { \ - match($$2, "'"'"'[-_a-zA-Z0-9]+'"'"'"); \ - name = substr($$2, RSTART, RLENGTH); \ - print name; \ - exit 0; \ - }' ${X11SRCDIR.${XORG_PKG_VER_PROG}}/configure -.if !empty(XORG_PKG_PACKAGE_NAME) -CPPFLAGS+= -DPACKAGE_NAME=\"${XORG_PKG_PACKAGE_NAME:Q}\" -.endif - -.endif diff --git a/external/public-domain/Makefile b/external/public-domain/Makefile deleted file mode 100644 index 797cecc88..000000000 --- a/external/public-domain/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2014/08/08 09:34:10 apb Exp $ - -.include - -SUBDIR+= sqlite tz xz - -.include diff --git a/external/public-domain/sqlite/Makefile b/external/public-domain/sqlite/Makefile deleted file mode 100644 index b9a4b1bc2..000000000 --- a/external/public-domain/sqlite/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2011/10/13 21:40:27 joerg Exp $ - -SUBDIR+= lib .WAIT bin - -.include diff --git a/external/public-domain/sqlite/Makefile.inc b/external/public-domain/sqlite/Makefile.inc deleted file mode 100644 index 09616af0a..000000000 --- a/external/public-domain/sqlite/Makefile.inc +++ /dev/null @@ -1,30 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.5 2012/06/01 20:28:02 wiz Exp $ - -WARNS= 2 - -SRCDIR:= ${.PARSEDIR}/dist - -.PATH: ${SRCDIR} - -CPPFLAGS+= \ - -DHAVE_GMTIME_R=1 \ - -DHAVE_INTTYPES_H=1 \ - -DHAVE_LOCALTIME_R=1 \ - -DHAVE_READLINE=1 \ - -DHAVE_STDINT_H=1 \ - -DHAVE_STRERROR_R=1 \ - -DHAVE_USLEEP=1 \ - -DSQLITE_ENABLE_COLUMN_METADATA \ - -DSQLITE_ENABLE_FTS3_PARENTHESIS \ - -DSQLITE_ENABLE_FTS4 \ - -DSQLITE_ENABLE_LOAD_EXTENSION \ - -DSQLITE_ENABLE_UNLOCK_NOTIFY \ - -DSQLITE_HAVE_ISNAN - -.if defined(__MINIX) -CPPFLAGS+= \ - -DSQLITE_THREADSAFE=0 \ - -DSQLITE_OMIT_WAL -.endif # defined(__MINIX) - -CWARNFLAGS+= -Wno-shadow -Wno-unused diff --git a/external/public-domain/sqlite/bin/Makefile b/external/public-domain/sqlite/bin/Makefile deleted file mode 100644 index 126362770..000000000 --- a/external/public-domain/sqlite/bin/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -# $NetBSD: Makefile,v 1.5 2013/02/14 21:07:25 martin Exp $ - -PROG= sqlite3 - -SRCS= shell.c - -DPADD+= ${LIBSQLITE3} ${LIBEDIT} ${LIBTERIMINFO} -LDADD+= -lsqlite3 -ledit -lterminfo - -BINDIR= /usr/bin - -.include diff --git a/external/public-domain/sqlite/dist/shell.c b/external/public-domain/sqlite/dist/shell.c deleted file mode 100644 index 1c4c4ad3e..000000000 --- a/external/public-domain/sqlite/dist/shell.c +++ /dev/null @@ -1,3565 +0,0 @@ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code to implement the "sqlite" command line -** utility for accessing SQLite databases. -*/ -#if (defined(_WIN32) || defined(WIN32)) && !defined(_CRT_SECURE_NO_WARNINGS) -/* This needs to come before any includes for MSVC compiler */ -#define _CRT_SECURE_NO_WARNINGS -#endif - -/* -** Enable large-file support for fopen() and friends on unix. -*/ -#ifndef SQLITE_DISABLE_LFS -# define _LARGE_FILE 1 -# ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -# endif -# define _LARGEFILE_SOURCE 1 -#endif - -#include -#include -#include -#include -#include "sqlite3.h" -#include -#include - -#if !defined(_WIN32) && !defined(WIN32) -# include -# if !defined(__RTP__) && !defined(_WRS_KERNEL) -# include -# endif -# include -# include -#endif - -#ifdef HAVE_EDITLINE -# include -#endif -#if defined(HAVE_READLINE) && HAVE_READLINE==1 -# include -# include -#endif -#if !defined(HAVE_EDITLINE) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1) -# define add_history(X) -# define read_history(X) -# define write_history(X) -# define stifle_history(X) -#endif - -#if defined(_WIN32) || defined(WIN32) -# include -#define isatty(h) _isatty(h) -#define access(f,m) _access((f),(m)) -#undef popen -#define popen _popen -#undef pclose -#define pclose _pclose -#else -/* Make sure isatty() has a prototype. -*/ -extern int isatty(int); - -/* popen and pclose are not C89 functions and so are sometimes omitted from -** the header */ -extern FILE *popen(const char*,const char*); -extern int pclose(FILE*); -#endif - -#if defined(_WIN32_WCE) -/* Windows CE (arm-wince-mingw32ce-gcc) does not provide isatty() - * thus we always assume that we have a console. That can be - * overridden with the -batch command line option. - */ -#define isatty(x) 1 -#endif - -/* ctype macros that work with signed characters */ -#define IsSpace(X) isspace((unsigned char)X) -#define IsDigit(X) isdigit((unsigned char)X) -#define ToLower(X) (char)tolower((unsigned char)X) - - -/* True if the timer is enabled */ -static int enableTimer = 0; - -/* Return the current wall-clock time */ -static sqlite3_int64 timeOfDay(void){ - static sqlite3_vfs *clockVfs = 0; - sqlite3_int64 t; - if( clockVfs==0 ) clockVfs = sqlite3_vfs_find(0); - if( clockVfs->iVersion>=1 && clockVfs->xCurrentTimeInt64!=0 ){ - clockVfs->xCurrentTimeInt64(clockVfs, &t); - }else{ - double r; - clockVfs->xCurrentTime(clockVfs, &r); - t = (sqlite3_int64)(r*86400000.0); - } - return t; -} - -#if !defined(_WIN32) && !defined(WIN32) && !defined(_WRS_KERNEL) \ - && !defined(__minux) -#include -#include - -/* Saved resource information for the beginning of an operation */ -static struct rusage sBegin; /* CPU time at start */ -static sqlite3_int64 iBegin; /* Wall-clock time at start */ - -/* -** Begin timing an operation -*/ -static void beginTimer(void){ - if( enableTimer ){ - getrusage(RUSAGE_SELF, &sBegin); - iBegin = timeOfDay(); - } -} - -/* Return the difference of two time_structs in seconds */ -static double timeDiff(struct timeval *pStart, struct timeval *pEnd){ - return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + - (double)(pEnd->tv_sec - pStart->tv_sec); -} - -/* -** Print the timing results. -*/ -static void endTimer(void){ - if( enableTimer ){ - struct rusage sEnd; - sqlite3_int64 iEnd = timeOfDay(); - getrusage(RUSAGE_SELF, &sEnd); - printf("Run Time: real %.3f user %f sys %f\n", - (iEnd - iBegin)*0.001, - timeDiff(&sBegin.ru_utime, &sEnd.ru_utime), - timeDiff(&sBegin.ru_stime, &sEnd.ru_stime)); - } -} - -#define BEGIN_TIMER beginTimer() -#define END_TIMER endTimer() -#define HAS_TIMER 1 - -#elif (defined(_WIN32) || defined(WIN32)) - -#include - -/* Saved resource information for the beginning of an operation */ -static HANDLE hProcess; -static FILETIME ftKernelBegin; -static FILETIME ftUserBegin; -static sqlite3_int64 ftWallBegin; -typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME); -static GETPROCTIMES getProcessTimesAddr = NULL; - -/* -** Check to see if we have timer support. Return 1 if necessary -** support found (or found previously). -*/ -static int hasTimer(void){ - if( getProcessTimesAddr ){ - return 1; - } else { - /* GetProcessTimes() isn't supported in WIN95 and some other Windows versions. - ** See if the version we are running on has it, and if it does, save off - ** a pointer to it and the current process handle. - */ - hProcess = GetCurrentProcess(); - if( hProcess ){ - HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll")); - if( NULL != hinstLib ){ - getProcessTimesAddr = (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes"); - if( NULL != getProcessTimesAddr ){ - return 1; - } - FreeLibrary(hinstLib); - } - } - } - return 0; -} - -/* -** Begin timing an operation -*/ -static void beginTimer(void){ - if( enableTimer && getProcessTimesAddr ){ - FILETIME ftCreation, ftExit; - getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin); - ftWallBegin = timeOfDay(); - } -} - -/* Return the difference of two FILETIME structs in seconds */ -static double timeDiff(FILETIME *pStart, FILETIME *pEnd){ - sqlite_int64 i64Start = *((sqlite_int64 *) pStart); - sqlite_int64 i64End = *((sqlite_int64 *) pEnd); - return (double) ((i64End - i64Start) / 10000000.0); -} - -/* -** Print the timing results. -*/ -static void endTimer(void){ - if( enableTimer && getProcessTimesAddr){ - FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd; - sqlite3_int64 ftWallEnd = timeOfDay(); - getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelEnd, &ftUserEnd); - printf("Run Time: real %.3f user %f sys %f\n", - (ftWallEnd - ftWallBegin)*0.001, - timeDiff(&ftUserBegin, &ftUserEnd), - timeDiff(&ftKernelBegin, &ftKernelEnd)); - } -} - -#define BEGIN_TIMER beginTimer() -#define END_TIMER endTimer() -#define HAS_TIMER hasTimer() - -#else -#define BEGIN_TIMER -#define END_TIMER -#define HAS_TIMER 0 -#endif - -/* -** Used to prevent warnings about unused parameters -*/ -#define UNUSED_PARAMETER(x) (void)(x) - -/* -** If the following flag is set, then command execution stops -** at an error if we are not interactive. -*/ -static int bail_on_error = 0; - -/* -** Threat stdin as an interactive input if the following variable -** is true. Otherwise, assume stdin is connected to a file or pipe. -*/ -static int stdin_is_interactive = 1; - -/* -** The following is the open SQLite database. We make a pointer -** to this database a static variable so that it can be accessed -** by the SIGINT handler to interrupt database processing. -*/ -static sqlite3 *db = 0; - -/* -** True if an interrupt (Control-C) has been received. -*/ -static volatile int seenInterrupt = 0; - -/* -** This is the name of our program. It is set in main(), used -** in a number of other places, mostly for error messages. -*/ -static char *Argv0; - -/* -** Prompt strings. Initialized in main. Settable with -** .prompt main continue -*/ -static char mainPrompt[20]; /* First line prompt. default: "sqlite> "*/ -static char continuePrompt[20]; /* Continuation prompt. default: " ...> " */ - -/* -** Write I/O traces to the following stream. -*/ -#ifdef SQLITE_ENABLE_IOTRACE -static FILE *iotrace = 0; -#endif - -/* -** This routine works like printf in that its first argument is a -** format string and subsequent arguments are values to be substituted -** in place of % fields. The result of formatting this string -** is written to iotrace. -*/ -#ifdef SQLITE_ENABLE_IOTRACE -static void iotracePrintf(const char *zFormat, ...){ - va_list ap; - char *z; - if( iotrace==0 ) return; - va_start(ap, zFormat); - z = sqlite3_vmprintf(zFormat, ap); - va_end(ap); - fprintf(iotrace, "%s", z); - sqlite3_free(z); -} -#endif - - -/* -** Determines if a string is a number of not. -*/ -static int isNumber(const char *z, int *realnum){ - if( *z=='-' || *z=='+' ) z++; - if( !IsDigit(*z) ){ - return 0; - } - z++; - if( realnum ) *realnum = 0; - while( IsDigit(*z) ){ z++; } - if( *z=='.' ){ - z++; - if( !IsDigit(*z) ) return 0; - while( IsDigit(*z) ){ z++; } - if( realnum ) *realnum = 1; - } - if( *z=='e' || *z=='E' ){ - z++; - if( *z=='+' || *z=='-' ) z++; - if( !IsDigit(*z) ) return 0; - while( IsDigit(*z) ){ z++; } - if( realnum ) *realnum = 1; - } - return *z==0; -} - -/* -** A global char* and an SQL function to access its current value -** from within an SQL statement. This program used to use the -** sqlite_exec_printf() API to substitue a string into an SQL statement. -** The correct way to do this with sqlite3 is to use the bind API, but -** since the shell is built around the callback paradigm it would be a lot -** of work. Instead just use this hack, which is quite harmless. -*/ -static const char *zShellStatic = 0; -static void shellstaticFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - assert( 0==argc ); - assert( zShellStatic ); - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(argv); - sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC); -} - - -/* -** This routine reads a line of text from FILE in, stores -** the text in memory obtained from malloc() and returns a pointer -** to the text. NULL is returned at end of file, or if malloc() -** fails. -** -** If zLine is not NULL then it is a malloced buffer returned from -** a previous call to this routine that may be reused. -*/ -static char *local_getline(char *zLine, FILE *in){ - int nLine = zLine==0 ? 0 : 100; - int n = 0; - - while( 1 ){ - if( n+100>nLine ){ - nLine = nLine*2 + 100; - zLine = realloc(zLine, nLine); - if( zLine==0 ) return 0; - } - if( fgets(&zLine[n], nLine - n, in)==0 ){ - if( n==0 ){ - free(zLine); - return 0; - } - zLine[n] = 0; - break; - } - while( zLine[n] ) n++; - if( n>0 && zLine[n-1]=='\n' ){ - n--; - if( n>0 && zLine[n-1]=='\r' ) n--; - zLine[n] = 0; - break; - } - } - return zLine; -} - -/* -** Retrieve a single line of input text. -** -** If in==0 then read from standard input and prompt before each line. -** If isContinuation is true, then a continuation prompt is appropriate. -** If isContinuation is zero, then the main prompt should be used. -** -** If zPrior is not NULL then it is a buffer from a prior call to this -** routine that can be reused. -** -** The result is stored in space obtained from malloc() and must either -** be freed by the caller or else passed back into this routine via the -** zPrior argument for reuse. -*/ -static char *one_input_line(FILE *in, char *zPrior, int isContinuation){ - char *zPrompt; - char *zResult; - if( in!=0 ){ - zResult = local_getline(zPrior, in); - }else{ - zPrompt = isContinuation ? continuePrompt : mainPrompt; -#if defined(HAVE_READLINE) && HAVE_READLINE==1 - free(zPrior); - zResult = readline(zPrompt); - if( zResult && *zResult ) add_history(zResult); -#else - printf("%s", zPrompt); - fflush(stdout); - zResult = local_getline(zPrior, stdin); -#endif - } - return zResult; -} - -struct previous_mode_data { - int valid; /* Is there legit data in here? */ - int mode; - int showHeader; - int colWidth[100]; -}; - -/* -** An pointer to an instance of this structure is passed from -** the main program to the callback. This is used to communicate -** state and mode information. -*/ -struct callback_data { - sqlite3 *db; /* The database */ - int echoOn; /* True to echo input commands */ - int statsOn; /* True to display memory stats before each finalize */ - int cnt; /* Number of records displayed so far */ - FILE *out; /* Write results here */ - FILE *traceOut; /* Output for sqlite3_trace() */ - int nErr; /* Number of errors seen */ - int mode; /* An output mode setting */ - int writableSchema; /* True if PRAGMA writable_schema=ON */ - int showHeader; /* True to show column names in List or Column mode */ - char *zDestTable; /* Name of destination table when MODE_Insert */ - char separator[20]; /* Separator character for MODE_List */ - int colWidth[100]; /* Requested width of each column when in column mode*/ - int actualWidth[100]; /* Actual width of each column */ - char nullvalue[20]; /* The text to print when a NULL comes back from - ** the database */ - struct previous_mode_data explainPrev; - /* Holds the mode information just before - ** .explain ON */ - char outfile[FILENAME_MAX]; /* Filename for *out */ - const char *zDbFilename; /* name of the database file */ - char *zFreeOnClose; /* Filename to free when closing */ - const char *zVfs; /* Name of VFS to use */ - sqlite3_stmt *pStmt; /* Current statement if any. */ - FILE *pLog; /* Write log output here */ - int *aiIndent; /* Array of indents used in MODE_Explain */ - int nIndent; /* Size of array aiIndent[] */ - int iIndent; /* Index of current op in aiIndent[] */ -}; - -/* -** These are the allowed modes. -*/ -#define MODE_Line 0 /* One column per line. Blank line between records */ -#define MODE_Column 1 /* One record per line in neat columns */ -#define MODE_List 2 /* One record per line with a separator */ -#define MODE_Semi 3 /* Same as MODE_List but append ";" to each line */ -#define MODE_Html 4 /* Generate an XHTML table */ -#define MODE_Insert 5 /* Generate SQL "insert" statements */ -#define MODE_Tcl 6 /* Generate ANSI-C or TCL quoted elements */ -#define MODE_Csv 7 /* Quote strings, numbers are plain */ -#define MODE_Explain 8 /* Like MODE_Column, but do not truncate data */ - -static const char *modeDescr[] = { - "line", - "column", - "list", - "semi", - "html", - "insert", - "tcl", - "csv", - "explain", -}; - -/* -** Number of elements in an array -*/ -#define ArraySize(X) (int)(sizeof(X)/sizeof(X[0])) - -/* -** Compute a string length that is limited to what can be stored in -** lower 30 bits of a 32-bit signed integer. -*/ -static int strlen30(const char *z){ - const char *z2 = z; - while( *z2 ){ z2++; } - return 0x3fffffff & (int)(z2 - z); -} - -/* -** A callback for the sqlite3_log() interface. -*/ -static void shellLog(void *pArg, int iErrCode, const char *zMsg){ - struct callback_data *p = (struct callback_data*)pArg; - if( p->pLog==0 ) return; - fprintf(p->pLog, "(%d) %s\n", iErrCode, zMsg); - fflush(p->pLog); -} - -/* -** Output the given string as a hex-encoded blob (eg. X'1234' ) -*/ -static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){ - int i; - char *zBlob = (char *)pBlob; - fprintf(out,"X'"); - for(i=0; i0 ){ - fprintf(out,"%.*s",i,z); - } - if( z[i]=='<' ){ - fprintf(out,"<"); - }else if( z[i]=='&' ){ - fprintf(out,"&"); - }else if( z[i]=='>' ){ - fprintf(out,">"); - }else if( z[i]=='\"' ){ - fprintf(out,"""); - }else if( z[i]=='\'' ){ - fprintf(out,"'"); - }else{ - break; - } - z += i + 1; - } -} - -/* -** If a field contains any character identified by a 1 in the following -** array, then the string must be quoted for CSV. -*/ -static const char needCsvQuote[] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, -}; - -/* -** Output a single term of CSV. Actually, p->separator is used for -** the separator, which may or may not be a comma. p->nullvalue is -** the null value. Strings are quoted if necessary. -*/ -static void output_csv(struct callback_data *p, const char *z, int bSep){ - FILE *out = p->out; - if( z==0 ){ - fprintf(out,"%s",p->nullvalue); - }else{ - int i; - int nSep = strlen30(p->separator); - for(i=0; z[i]; i++){ - if( needCsvQuote[((unsigned char*)z)[i]] - || (z[i]==p->separator[0] && - (nSep==1 || memcmp(z, p->separator, nSep)==0)) ){ - i = 0; - break; - } - } - if( i==0 ){ - putc('"', out); - for(i=0; z[i]; i++){ - if( z[i]=='"' ) putc('"', out); - putc(z[i], out); - } - putc('"', out); - }else{ - fprintf(out, "%s", z); - } - } - if( bSep ){ - fprintf(p->out, "%s", p->separator); - } -} - -#ifdef SIGINT -/* -** This routine runs when the user presses Ctrl-C -*/ -static void interrupt_handler(int NotUsed){ - UNUSED_PARAMETER(NotUsed); - seenInterrupt = 1; - if( db ) sqlite3_interrupt(db); -} -#endif - -/* -** This is the callback routine that the shell -** invokes for each row of a query result. -*/ -static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int *aiType){ - int i; - struct callback_data *p = (struct callback_data*)pArg; - - switch( p->mode ){ - case MODE_Line: { - int w = 5; - if( azArg==0 ) break; - for(i=0; iw ) w = len; - } - if( p->cnt++>0 ) fprintf(p->out,"\n"); - for(i=0; iout,"%*s = %s\n", w, azCol[i], - azArg[i] ? azArg[i] : p->nullvalue); - } - break; - } - case MODE_Explain: - case MODE_Column: { - if( p->cnt++==0 ){ - for(i=0; icolWidth) ){ - w = p->colWidth[i]; - }else{ - w = 0; - } - if( w==0 ){ - w = strlen30(azCol[i] ? azCol[i] : ""); - if( w<10 ) w = 10; - n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue); - if( wactualWidth) ){ - p->actualWidth[i] = w; - } - if( p->showHeader ){ - if( w<0 ){ - fprintf(p->out,"%*.*s%s",-w,-w,azCol[i], i==nArg-1 ? "\n": " "); - }else{ - fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": " "); - } - } - } - if( p->showHeader ){ - for(i=0; iactualWidth) ){ - w = p->actualWidth[i]; - if( w<0 ) w = -w; - }else{ - w = 10; - } - fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------" - "----------------------------------------------------------", - i==nArg-1 ? "\n": " "); - } - } - } - if( azArg==0 ) break; - for(i=0; iactualWidth) ){ - w = p->actualWidth[i]; - }else{ - w = 10; - } - if( p->mode==MODE_Explain && azArg[i] && strlen30(azArg[i])>w ){ - w = strlen30(azArg[i]); - } - if( i==1 && p->aiIndent && p->pStmt ){ - if( p->iIndentnIndent ){ - fprintf(p->out, "%*.s", p->aiIndent[p->iIndent], ""); - } - p->iIndent++; - } - if( w<0 ){ - fprintf(p->out,"%*.*s%s",-w,-w, - azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": " "); - }else{ - fprintf(p->out,"%-*.*s%s",w,w, - azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": " "); - } - } - break; - } - case MODE_Semi: - case MODE_List: { - if( p->cnt++==0 && p->showHeader ){ - for(i=0; iout,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator); - } - } - if( azArg==0 ) break; - for(i=0; inullvalue; - fprintf(p->out, "%s", z); - if( iout, "%s", p->separator); - }else if( p->mode==MODE_Semi ){ - fprintf(p->out, ";\n"); - }else{ - fprintf(p->out, "\n"); - } - } - break; - } - case MODE_Html: { - if( p->cnt++==0 && p->showHeader ){ - fprintf(p->out,""); - for(i=0; iout,""); - output_html_string(p->out, azCol[i]); - fprintf(p->out,"\n"); - } - fprintf(p->out,"\n"); - } - if( azArg==0 ) break; - fprintf(p->out,""); - for(i=0; iout,""); - output_html_string(p->out, azArg[i] ? azArg[i] : p->nullvalue); - fprintf(p->out,"\n"); - } - fprintf(p->out,"\n"); - break; - } - case MODE_Tcl: { - if( p->cnt++==0 && p->showHeader ){ - for(i=0; iout,azCol[i] ? azCol[i] : ""); - if(iout, "%s", p->separator); - } - fprintf(p->out,"\n"); - } - if( azArg==0 ) break; - for(i=0; iout, azArg[i] ? azArg[i] : p->nullvalue); - if(iout, "%s", p->separator); - } - fprintf(p->out,"\n"); - break; - } - case MODE_Csv: { - if( p->cnt++==0 && p->showHeader ){ - for(i=0; iout,"\n"); - } - if( azArg==0 ) break; - for(i=0; iout,"\n"); - break; - } - case MODE_Insert: { - p->cnt++; - if( azArg==0 ) break; - fprintf(p->out,"INSERT INTO %s VALUES(",p->zDestTable); - for(i=0; i0 ? ",": ""; - if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){ - fprintf(p->out,"%sNULL",zSep); - }else if( aiType && aiType[i]==SQLITE_TEXT ){ - if( zSep[0] ) fprintf(p->out,"%s",zSep); - output_quoted_string(p->out, azArg[i]); - }else if( aiType && (aiType[i]==SQLITE_INTEGER || aiType[i]==SQLITE_FLOAT) ){ - fprintf(p->out,"%s%s",zSep, azArg[i]); - }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){ - const void *pBlob = sqlite3_column_blob(p->pStmt, i); - int nBlob = sqlite3_column_bytes(p->pStmt, i); - if( zSep[0] ) fprintf(p->out,"%s",zSep); - output_hex_blob(p->out, pBlob, nBlob); - }else if( isNumber(azArg[i], 0) ){ - fprintf(p->out,"%s%s",zSep, azArg[i]); - }else{ - if( zSep[0] ) fprintf(p->out,"%s",zSep); - output_quoted_string(p->out, azArg[i]); - } - } - fprintf(p->out,");\n"); - break; - } - } - return 0; -} - -/* -** This is the callback routine that the SQLite library -** invokes for each row of a query result. -*/ -static int callback(void *pArg, int nArg, char **azArg, char **azCol){ - /* since we don't have type info, call the shell_callback with a NULL value */ - return shell_callback(pArg, nArg, azArg, azCol, NULL); -} - -/* -** Set the destination table field of the callback_data structure to -** the name of the table given. Escape any quote characters in the -** table name. -*/ -static void set_table_name(struct callback_data *p, const char *zName){ - int i, n; - int needQuote; - char *z; - - if( p->zDestTable ){ - free(p->zDestTable); - p->zDestTable = 0; - } - if( zName==0 ) return; - needQuote = !isalpha((unsigned char)*zName) && *zName!='_'; - for(i=n=0; zName[i]; i++, n++){ - if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ){ - needQuote = 1; - if( zName[i]=='\'' ) n++; - } - } - if( needQuote ) n += 2; - z = p->zDestTable = malloc( n+1 ); - if( z==0 ){ - fprintf(stderr,"Error: out of memory\n"); - exit(1); - } - n = 0; - if( needQuote ) z[n++] = '\''; - for(i=0; zName[i]; i++){ - z[n++] = zName[i]; - if( zName[i]=='\'' ) z[n++] = '\''; - } - if( needQuote ) z[n++] = '\''; - z[n] = 0; -} - -/* zIn is either a pointer to a NULL-terminated string in memory obtained -** from malloc(), or a NULL pointer. The string pointed to by zAppend is -** added to zIn, and the result returned in memory obtained from malloc(). -** zIn, if it was not NULL, is freed. -** -** If the third argument, quote, is not '\0', then it is used as a -** quote character for zAppend. -*/ -static char *appendText(char *zIn, char const *zAppend, char quote){ - int len; - int i; - int nAppend = strlen30(zAppend); - int nIn = (zIn?strlen30(zIn):0); - - len = nAppend+nIn+1; - if( quote ){ - len += 2; - for(i=0; idb, zSelect, -1, &pSelect, 0); - if( rc!=SQLITE_OK || !pSelect ){ - fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db)); - if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++; - return rc; - } - rc = sqlite3_step(pSelect); - nResult = sqlite3_column_count(pSelect); - while( rc==SQLITE_ROW ){ - if( zFirstRow ){ - fprintf(p->out, "%s", zFirstRow); - zFirstRow = 0; - } - z = (const char*)sqlite3_column_text(pSelect, 0); - fprintf(p->out, "%s", z); - for(i=1; iout, ",%s", sqlite3_column_text(pSelect, i)); - } - if( z==0 ) z = ""; - while( z[0] && (z[0]!='-' || z[1]!='-') ) z++; - if( z[0] ){ - fprintf(p->out, "\n;\n"); - }else{ - fprintf(p->out, ";\n"); - } - rc = sqlite3_step(pSelect); - } - rc = sqlite3_finalize(pSelect); - if( rc!=SQLITE_OK ){ - fprintf(p->out, "/**** ERROR: (%d) %s *****/\n", rc, sqlite3_errmsg(p->db)); - if( (rc&0xff)!=SQLITE_CORRUPT ) p->nErr++; - } - return rc; -} - -/* -** Allocate space and save off current error string. -*/ -static char *save_err_msg( - sqlite3 *db /* Database to query */ -){ - int nErrMsg = 1+strlen30(sqlite3_errmsg(db)); - char *zErrMsg = sqlite3_malloc(nErrMsg); - if( zErrMsg ){ - memcpy(zErrMsg, sqlite3_errmsg(db), nErrMsg); - } - return zErrMsg; -} - -/* -** Display memory stats. -*/ -static int display_stats( - sqlite3 *db, /* Database to query */ - struct callback_data *pArg, /* Pointer to struct callback_data */ - int bReset /* True to reset the stats */ -){ - int iCur; - int iHiwtr; - - if( pArg && pArg->out ){ - - iHiwtr = iCur = -1; - sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Memory Used: %d (max %d) bytes\n", iCur, iHiwtr); - iHiwtr = iCur = -1; - sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Number of Outstanding Allocations: %d (max %d)\n", iCur, iHiwtr); -/* -** Not currently used by the CLI. -** iHiwtr = iCur = -1; -** sqlite3_status(SQLITE_STATUS_PAGECACHE_USED, &iCur, &iHiwtr, bReset); -** fprintf(pArg->out, "Number of Pcache Pages Used: %d (max %d) pages\n", iCur, iHiwtr); -*/ - iHiwtr = iCur = -1; - sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Number of Pcache Overflow Bytes: %d (max %d) bytes\n", iCur, iHiwtr); -/* -** Not currently used by the CLI. -** iHiwtr = iCur = -1; -** sqlite3_status(SQLITE_STATUS_SCRATCH_USED, &iCur, &iHiwtr, bReset); -** fprintf(pArg->out, "Number of Scratch Allocations Used: %d (max %d)\n", iCur, iHiwtr); -*/ - iHiwtr = iCur = -1; - sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Number of Scratch Overflow Bytes: %d (max %d) bytes\n", iCur, iHiwtr); - iHiwtr = iCur = -1; - sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Largest Allocation: %d bytes\n", iHiwtr); - iHiwtr = iCur = -1; - sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Largest Pcache Allocation: %d bytes\n", iHiwtr); - iHiwtr = iCur = -1; - sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Largest Scratch Allocation: %d bytes\n", iHiwtr); -#ifdef YYTRACKMAXSTACKDEPTH - iHiwtr = iCur = -1; - sqlite3_status(SQLITE_STATUS_PARSER_STACK, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Deepest Parser Stack: %d (max %d)\n", iCur, iHiwtr); -#endif - } - - if( pArg && pArg->out && db ){ - iHiwtr = iCur = -1; - sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Lookaside Slots Used: %d (max %d)\n", iCur, iHiwtr); - sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Successful lookaside attempts: %d\n", iHiwtr); - sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Lookaside failures due to size: %d\n", iHiwtr); - sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Lookaside failures due to OOM: %d\n", iHiwtr); - iHiwtr = iCur = -1; - sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Pager Heap Usage: %d bytes\n", iCur); iHiwtr = iCur = -1; - sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_HIT, &iCur, &iHiwtr, 1); - fprintf(pArg->out, "Page cache hits: %d\n", iCur); - iHiwtr = iCur = -1; - sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_MISS, &iCur, &iHiwtr, 1); - fprintf(pArg->out, "Page cache misses: %d\n", iCur); - iHiwtr = iCur = -1; - sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_WRITE, &iCur, &iHiwtr, 1); - fprintf(pArg->out, "Page cache writes: %d\n", iCur); - iHiwtr = iCur = -1; - sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Schema Heap Usage: %d bytes\n", iCur); - iHiwtr = iCur = -1; - sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset); - fprintf(pArg->out, "Statement Heap/Lookaside Usage: %d bytes\n", iCur); - } - - if( pArg && pArg->out && db && pArg->pStmt ){ - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset); - fprintf(pArg->out, "Fullscan Steps: %d\n", iCur); - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset); - fprintf(pArg->out, "Sort Operations: %d\n", iCur); - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset); - fprintf(pArg->out, "Autoindex Inserts: %d\n", iCur); - iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP, bReset); - fprintf(pArg->out, "Virtual Machine Steps: %d\n", iCur); - } - - return 0; -} - -/* -** Parameter azArray points to a zero-terminated array of strings. zStr -** points to a single nul-terminated string. Return non-zero if zStr -** is equal, according to strcmp(), to any of the strings in the array. -** Otherwise, return zero. -*/ -static int str_in_array(const char *zStr, const char **azArray){ - int i; - for(i=0; azArray[i]; i++){ - if( 0==strcmp(zStr, azArray[i]) ) return 1; - } - return 0; -} - -/* -** If compiled statement pSql appears to be an EXPLAIN statement, allocate -** and populate the callback_data.aiIndent[] array with the number of -** spaces each opcode should be indented before it is output. -** -** The indenting rules are: -** -** * For each "Next", "Prev", "VNext" or "VPrev" instruction, indent -** all opcodes that occur between the p2 jump destination and the opcode -** itself by 2 spaces. -** -** * For each "Goto", if the jump destination is earlier in the program -** and ends on one of: -** Yield SeekGt SeekLt RowSetRead Rewind -** then indent all opcodes between the earlier instruction -** and "Goto" by 2 spaces. -*/ -static void explain_data_prepare(struct callback_data *p, sqlite3_stmt *pSql){ - const char *zSql; /* The text of the SQL statement */ - const char *z; /* Used to check if this is an EXPLAIN */ - int *abYield = 0; /* True if op is an OP_Yield */ - int nAlloc = 0; /* Allocated size of p->aiIndent[], abYield */ - int iOp; /* Index of operation in p->aiIndent[] */ - - const char *azNext[] = { "Next", "Prev", "VPrev", "VNext", "SorterNext", 0 }; - const char *azYield[] = { "Yield", "SeekLt", "SeekGt", "RowSetRead", "Rewind", 0 }; - const char *azGoto[] = { "Goto", 0 }; - - /* Try to figure out if this is really an EXPLAIN statement. If this - ** cannot be verified, return early. */ - zSql = sqlite3_sql(pSql); - if( zSql==0 ) return; - for(z=zSql; *z==' ' || *z=='\t' || *z=='\n' || *z=='\f' || *z=='\r'; z++); - if( sqlite3_strnicmp(z, "explain", 7) ) return; - - for(iOp=0; SQLITE_ROW==sqlite3_step(pSql); iOp++){ - int i; - int iAddr = sqlite3_column_int(pSql, 0); - const char *zOp = (const char*)sqlite3_column_text(pSql, 1); - - /* Set p2 to the P2 field of the current opcode. Then, assuming that - ** p2 is an instruction address, set variable p2op to the index of that - ** instruction in the aiIndent[] array. p2 and p2op may be different if - ** the current instruction is part of a sub-program generated by an - ** SQL trigger or foreign key. */ - int p2 = sqlite3_column_int(pSql, 3); - int p2op = (p2 + (iOp-iAddr)); - - /* Grow the p->aiIndent array as required */ - if( iOp>=nAlloc ){ - nAlloc += 100; - p->aiIndent = (int*)sqlite3_realloc(p->aiIndent, nAlloc*sizeof(int)); - abYield = (int*)sqlite3_realloc(abYield, nAlloc*sizeof(int)); - } - abYield[iOp] = str_in_array(zOp, azYield); - p->aiIndent[iOp] = 0; - p->nIndent = iOp+1; - - if( str_in_array(zOp, azNext) ){ - for(i=p2op; iaiIndent[i] += 2; - } - if( str_in_array(zOp, azGoto) && p2opnIndent && abYield[p2op] ){ - for(i=p2op+1; iaiIndent[i] += 2; - } - } - - p->iIndent = 0; - sqlite3_free(abYield); - sqlite3_reset(pSql); -} - -/* -** Free the array allocated by explain_data_prepare(). -*/ -static void explain_data_delete(struct callback_data *p){ - sqlite3_free(p->aiIndent); - p->aiIndent = 0; - p->nIndent = 0; - p->iIndent = 0; -} - -/* -** Execute a statement or set of statements. Print -** any result rows/columns depending on the current mode -** set via the supplied callback. -** -** This is very similar to SQLite's built-in sqlite3_exec() -** function except it takes a slightly different callback -** and callback data argument. -*/ -static int shell_exec( - sqlite3 *db, /* An open database */ - const char *zSql, /* SQL to be evaluated */ - int (*xCallback)(void*,int,char**,char**,int*), /* Callback function */ - /* (not the same as sqlite3_exec) */ - struct callback_data *pArg, /* Pointer to struct callback_data */ - char **pzErrMsg /* Error msg written here */ -){ - sqlite3_stmt *pStmt = NULL; /* Statement to execute. */ - int rc = SQLITE_OK; /* Return Code */ - int rc2; - const char *zLeftover; /* Tail of unprocessed SQL */ - - if( pzErrMsg ){ - *pzErrMsg = NULL; - } - - while( zSql[0] && (SQLITE_OK == rc) ){ - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover); - if( SQLITE_OK != rc ){ - if( pzErrMsg ){ - *pzErrMsg = save_err_msg(db); - } - }else{ - if( !pStmt ){ - /* this happens for a comment or white-space */ - zSql = zLeftover; - while( IsSpace(zSql[0]) ) zSql++; - continue; - } - - /* save off the prepared statment handle and reset row count */ - if( pArg ){ - pArg->pStmt = pStmt; - pArg->cnt = 0; - } - - /* echo the sql statement if echo on */ - if( pArg && pArg->echoOn ){ - const char *zStmtSql = sqlite3_sql(pStmt); - fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql); - } - - /* Output TESTCTRL_EXPLAIN text of requested */ - if( pArg && pArg->mode==MODE_Explain ){ - const char *zExplain = 0; - sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, pStmt, &zExplain); - if( zExplain && zExplain[0] ){ - fprintf(pArg->out, "%s", zExplain); - } - } - - /* If the shell is currently in ".explain" mode, gather the extra - ** data required to add indents to the output.*/ - if( pArg && pArg->mode==MODE_Explain ){ - explain_data_prepare(pArg, pStmt); - } - - /* perform the first step. this will tell us if we - ** have a result set or not and how wide it is. - */ - rc = sqlite3_step(pStmt); - /* if we have a result set... */ - if( SQLITE_ROW == rc ){ - /* if we have a callback... */ - if( xCallback ){ - /* allocate space for col name ptr, value ptr, and type */ - int nCol = sqlite3_column_count(pStmt); - void *pData = sqlite3_malloc(3*nCol*sizeof(const char*) + 1); - if( !pData ){ - rc = SQLITE_NOMEM; - }else{ - char **azCols = (char **)pData; /* Names of result columns */ - char **azVals = &azCols[nCol]; /* Results */ - int *aiTypes = (int *)&azVals[nCol]; /* Result types */ - int i, x; - assert(sizeof(int) <= sizeof(char *)); - /* save off ptrs to column names */ - for(i=0; imode==MODE_Insert ){ - azVals[i] = ""; - }else{ - azVals[i] = (char*)sqlite3_column_text(pStmt, i); - } - if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){ - rc = SQLITE_NOMEM; - break; /* from for */ - } - } /* end for */ - - /* if data and types extracted successfully... */ - if( SQLITE_ROW == rc ){ - /* call the supplied callback with the result row data */ - if( xCallback(pArg, nCol, azVals, azCols, aiTypes) ){ - rc = SQLITE_ABORT; - }else{ - rc = sqlite3_step(pStmt); - } - } - } while( SQLITE_ROW == rc ); - sqlite3_free(pData); - } - }else{ - do{ - rc = sqlite3_step(pStmt); - } while( rc == SQLITE_ROW ); - } - } - - explain_data_delete(pArg); - - /* print usage stats if stats on */ - if( pArg && pArg->statsOn ){ - display_stats(db, pArg, 0); - } - - /* Finalize the statement just executed. If this fails, save a - ** copy of the error message. Otherwise, set zSql to point to the - ** next statement to execute. */ - rc2 = sqlite3_finalize(pStmt); - if( rc!=SQLITE_NOMEM ) rc = rc2; - if( rc==SQLITE_OK ){ - zSql = zLeftover; - while( IsSpace(zSql[0]) ) zSql++; - }else if( pzErrMsg ){ - *pzErrMsg = save_err_msg(db); - } - - /* clear saved stmt handle */ - if( pArg ){ - pArg->pStmt = NULL; - } - } - } /* end while */ - - return rc; -} - - -/* -** This is a different callback routine used for dumping the database. -** Each row received by this callback consists of a table name, -** the table type ("index" or "table") and SQL to create the table. -** This routine should print text sufficient to recreate the table. -*/ -static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){ - int rc; - const char *zTable; - const char *zType; - const char *zSql; - const char *zPrepStmt = 0; - struct callback_data *p = (struct callback_data *)pArg; - - UNUSED_PARAMETER(azCol); - if( nArg!=3 ) return 1; - zTable = azArg[0]; - zType = azArg[1]; - zSql = azArg[2]; - - if( strcmp(zTable, "sqlite_sequence")==0 ){ - zPrepStmt = "DELETE FROM sqlite_sequence;\n"; - }else if( sqlite3_strglob("sqlite_stat?", zTable)==0 ){ - fprintf(p->out, "ANALYZE sqlite_master;\n"); - }else if( strncmp(zTable, "sqlite_", 7)==0 ){ - return 0; - }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){ - char *zIns; - if( !p->writableSchema ){ - fprintf(p->out, "PRAGMA writable_schema=ON;\n"); - p->writableSchema = 1; - } - zIns = sqlite3_mprintf( - "INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)" - "VALUES('table','%q','%q',0,'%q');", - zTable, zTable, zSql); - fprintf(p->out, "%s\n", zIns); - sqlite3_free(zIns); - return 0; - }else{ - fprintf(p->out, "%s;\n", zSql); - } - - if( strcmp(zType, "table")==0 ){ - sqlite3_stmt *pTableInfo = 0; - char *zSelect = 0; - char *zTableInfo = 0; - char *zTmp = 0; - int nRow = 0; - - zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0); - zTableInfo = appendText(zTableInfo, zTable, '"'); - zTableInfo = appendText(zTableInfo, ");", 0); - - rc = sqlite3_prepare(p->db, zTableInfo, -1, &pTableInfo, 0); - free(zTableInfo); - if( rc!=SQLITE_OK || !pTableInfo ){ - return 1; - } - - zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0); - /* Always quote the table name, even if it appears to be pure ascii, - ** in case it is a keyword. Ex: INSERT INTO "table" ... */ - zTmp = appendText(zTmp, zTable, '"'); - if( zTmp ){ - zSelect = appendText(zSelect, zTmp, '\''); - free(zTmp); - } - zSelect = appendText(zSelect, " || ' VALUES(' || ", 0); - rc = sqlite3_step(pTableInfo); - while( rc==SQLITE_ROW ){ - const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1); - zSelect = appendText(zSelect, "quote(", 0); - zSelect = appendText(zSelect, zText, '"'); - rc = sqlite3_step(pTableInfo); - if( rc==SQLITE_ROW ){ - zSelect = appendText(zSelect, "), ", 0); - }else{ - zSelect = appendText(zSelect, ") ", 0); - } - nRow++; - } - rc = sqlite3_finalize(pTableInfo); - if( rc!=SQLITE_OK || nRow==0 ){ - free(zSelect); - return 1; - } - zSelect = appendText(zSelect, "|| ')' FROM ", 0); - zSelect = appendText(zSelect, zTable, '"'); - - rc = run_table_dump_query(p, zSelect, zPrepStmt); - if( rc==SQLITE_CORRUPT ){ - zSelect = appendText(zSelect, " ORDER BY rowid DESC", 0); - run_table_dump_query(p, zSelect, 0); - } - free(zSelect); - } - return 0; -} - -/* -** Run zQuery. Use dump_callback() as the callback routine so that -** the contents of the query are output as SQL statements. -** -** If we get a SQLITE_CORRUPT error, rerun the query after appending -** "ORDER BY rowid DESC" to the end. -*/ -static int run_schema_dump_query( - struct callback_data *p, - const char *zQuery -){ - int rc; - char *zErr = 0; - rc = sqlite3_exec(p->db, zQuery, dump_callback, p, &zErr); - if( rc==SQLITE_CORRUPT ){ - char *zQ2; - int len = strlen30(zQuery); - fprintf(p->out, "/****** CORRUPTION ERROR *******/\n"); - if( zErr ){ - fprintf(p->out, "/****** %s ******/\n", zErr); - sqlite3_free(zErr); - zErr = 0; - } - zQ2 = malloc( len+100 ); - if( zQ2==0 ) return rc; - sqlite3_snprintf(len+100, zQ2, "%s ORDER BY rowid DESC", zQuery); - rc = sqlite3_exec(p->db, zQ2, dump_callback, p, &zErr); - if( rc ){ - fprintf(p->out, "/****** ERROR: %s ******/\n", zErr); - }else{ - rc = SQLITE_CORRUPT; - } - sqlite3_free(zErr); - free(zQ2); - } - return rc; -} - -/* -** Text of a help message -*/ -static char zHelp[] = - ".backup ?DB? FILE Backup DB (default \"main\") to FILE\n" - ".bail ON|OFF Stop after hitting an error. Default OFF\n" - ".databases List names and files of attached databases\n" - ".dump ?TABLE? ... Dump the database in an SQL text format\n" - " If TABLE specified, only dump tables matching\n" - " LIKE pattern TABLE.\n" - ".echo ON|OFF Turn command echo on or off\n" - ".exit Exit this program\n" - ".explain ?ON|OFF? Turn output mode suitable for EXPLAIN on or off.\n" - " With no args, it turns EXPLAIN on.\n" - ".header(s) ON|OFF Turn display of headers on or off\n" - ".help Show this message\n" - ".import FILE TABLE Import data from FILE into TABLE\n" - ".indices ?TABLE? Show names of all indices\n" - " If TABLE specified, only show indices for tables\n" - " matching LIKE pattern TABLE.\n" -#ifdef SQLITE_ENABLE_IOTRACE - ".iotrace FILE Enable I/O diagnostic logging to FILE\n" -#endif -#ifndef SQLITE_OMIT_LOAD_EXTENSION - ".load FILE ?ENTRY? Load an extension library\n" -#endif - ".log FILE|off Turn logging on or off. FILE can be stderr/stdout\n" - ".mode MODE ?TABLE? Set output mode where MODE is one of:\n" - " csv Comma-separated values\n" - " column Left-aligned columns. (See .width)\n" - " html HTML code\n" - " insert SQL insert statements for TABLE\n" - " line One value per line\n" - " list Values delimited by .separator string\n" - " tabs Tab-separated values\n" - " tcl TCL list elements\n" - ".nullvalue STRING Use STRING in place of NULL values\n" - ".open ?FILENAME? Close existing database and reopen FILENAME\n" - ".output FILENAME Send output to FILENAME\n" - ".output stdout Send output to the screen\n" - ".print STRING... Print literal STRING\n" - ".prompt MAIN CONTINUE Replace the standard prompts\n" - ".quit Exit this program\n" - ".read FILENAME Execute SQL in FILENAME\n" - ".restore ?DB? FILE Restore content of DB (default \"main\") from FILE\n" - ".schema ?TABLE? Show the CREATE statements\n" - " If TABLE specified, only show tables matching\n" - " LIKE pattern TABLE.\n" - ".separator STRING Change separator used by output mode and .import\n" - ".show Show the current values for various settings\n" - ".stats ON|OFF Turn stats on or off\n" - ".tables ?TABLE? List names of tables\n" - " If TABLE specified, only list tables matching\n" - " LIKE pattern TABLE.\n" - ".timeout MS Try opening locked tables for MS milliseconds\n" - ".trace FILE|off Output each SQL statement as it is run\n" - ".vfsname ?AUX? Print the name of the VFS stack\n" - ".width NUM1 NUM2 ... Set column widths for \"column\" mode\n" -; - -static char zTimerHelp[] = - ".timer ON|OFF Turn the CPU timer measurement on or off\n" -; - -/* Forward reference */ -static int process_input(struct callback_data *p, FILE *in); - -/* -** Make sure the database is open. If it is not, then open it. If -** the database fails to open, print an error message and exit. -*/ -static void open_db(struct callback_data *p, int keepAlive){ - if( p->db==0 ){ - sqlite3_initialize(); - sqlite3_open(p->zDbFilename, &p->db); - db = p->db; - if( db && sqlite3_errcode(db)==SQLITE_OK ){ - sqlite3_create_function(db, "shellstatic", 0, SQLITE_UTF8, 0, - shellstaticFunc, 0, 0); - } - if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){ - fprintf(stderr,"Error: unable to open database \"%s\": %s\n", - p->zDbFilename, sqlite3_errmsg(db)); - if( keepAlive ) return; - exit(1); - } -#ifndef SQLITE_OMIT_LOAD_EXTENSION - sqlite3_enable_load_extension(p->db, 1); -#endif - } -} - -/* -** Do C-language style dequoting. -** -** \t -> tab -** \n -> newline -** \r -> carriage return -** \" -> " -** \NNN -> ascii character NNN in octal -** \\ -> backslash -*/ -static void resolve_backslashes(char *z){ - int i, j; - char c; - for(i=j=0; (c = z[i])!=0; i++, j++){ - if( c=='\\' ){ - c = z[++i]; - if( c=='n' ){ - c = '\n'; - }else if( c=='t' ){ - c = '\t'; - }else if( c=='r' ){ - c = '\r'; - }else if( c=='\\' ){ - c = '\\'; - }else if( c>='0' && c<='7' ){ - c -= '0'; - if( z[i+1]>='0' && z[i+1]<='7' ){ - i++; - c = (c<<3) + z[i] - '0'; - if( z[i+1]>='0' && z[i+1]<='7' ){ - i++; - c = (c<<3) + z[i] - '0'; - } - } - } - } - z[j] = c; - } - z[j] = 0; -} - -/* -** Return the value of a hexadecimal digit. Return -1 if the input -** is not a hex digit. -*/ -static int hexDigitValue(char c){ - if( c>='0' && c<='9' ) return c - '0'; - if( c>='a' && c<='f' ) return c - 'a' + 10; - if( c>='A' && c<='F' ) return c - 'A' + 10; - return -1; -} - -/* -** Interpret zArg as an integer value, possibly with suffixes. -*/ -static sqlite3_int64 integerValue(const char *zArg){ - sqlite3_int64 v = 0; - static const struct { char *zSuffix; int iMult; } aMult[] = { - { "KiB", 1024 }, - { "MiB", 1024*1024 }, - { "GiB", 1024*1024*1024 }, - { "KB", 1000 }, - { "MB", 1000000 }, - { "GB", 1000000000 }, - { "K", 1000 }, - { "M", 1000000 }, - { "G", 1000000000 }, - }; - int i; - int isNeg = 0; - if( zArg[0]=='-' ){ - isNeg = 1; - zArg++; - }else if( zArg[0]=='+' ){ - zArg++; - } - if( zArg[0]=='0' && zArg[1]=='x' ){ - int x; - zArg += 2; - while( (x = hexDigitValue(zArg[0]))>=0 ){ - v = (v<<4) + x; - zArg++; - } - }else{ - while( IsDigit(zArg[0]) ){ - v = v*10 + zArg[0] - '0'; - zArg++; - } - } - for(i=0; i=0; i++){} - }else{ - for(i=0; zArg[i]>='0' && zArg[i]<='9'; i++){} - } - if( i>0 && zArg[i]==0 ) return (int)(integerValue(zArg) & 0xffffffff); - if( sqlite3_stricmp(zArg, "on")==0 || sqlite3_stricmp(zArg,"yes")==0 ){ - return 1; - } - if( sqlite3_stricmp(zArg, "off")==0 || sqlite3_stricmp(zArg,"no")==0 ){ - return 0; - } - fprintf(stderr, "ERROR: Not a boolean value: \"%s\". Assuming \"no\".\n", - zArg); - return 0; -} - -/* -** Close an output file, assuming it is not stderr or stdout -*/ -static void output_file_close(FILE *f){ - if( f && f!=stdout && f!=stderr ) fclose(f); -} - -/* -** Try to open an output file. The names "stdout" and "stderr" are -** recognized and do the right thing. NULL is returned if the output -** filename is "off". -*/ -static FILE *output_file_open(const char *zFile){ - FILE *f; - if( strcmp(zFile,"stdout")==0 ){ - f = stdout; - }else if( strcmp(zFile, "stderr")==0 ){ - f = stderr; - }else if( strcmp(zFile, "off")==0 ){ - f = 0; - }else{ - f = fopen(zFile, "wb"); - if( f==0 ){ - fprintf(stderr, "Error: cannot open \"%s\"\n", zFile); - } - } - return f; -} - -/* -** A routine for handling output from sqlite3_trace(). -*/ -static void sql_trace_callback(void *pArg, const char *z){ - FILE *f = (FILE*)pArg; - if( f ) fprintf(f, "%s\n", z); -} - -/* -** A no-op routine that runs with the ".breakpoint" doc-command. This is -** a useful spot to set a debugger breakpoint. -*/ -static void test_breakpoint(void){ - static int nCall = 0; - nCall++; -} - -/* -** An object used to read a CSV file -*/ -typedef struct CSVReader CSVReader; -struct CSVReader { - const char *zFile; /* Name of the input file */ - FILE *in; /* Read the CSV text from this input stream */ - char *z; /* Accumulated text for a field */ - int n; /* Number of bytes in z */ - int nAlloc; /* Space allocated for z[] */ - int nLine; /* Current line number */ - int cTerm; /* Character that terminated the most recent field */ - int cSeparator; /* The separator character. (Usually ",") */ -}; - -/* Append a single byte to z[] */ -static void csv_append_char(CSVReader *p, int c){ - if( p->n+1>=p->nAlloc ){ - p->nAlloc += p->nAlloc + 100; - p->z = sqlite3_realloc(p->z, p->nAlloc); - if( p->z==0 ){ - fprintf(stderr, "out of memory\n"); - exit(1); - } - } - p->z[p->n++] = (char)c; -} - -/* Read a single field of CSV text. Compatible with rfc4180 and extended -** with the option of having a separator other than ",". -** -** + Input comes from p->in. -** + Store results in p->z of length p->n. Space to hold p->z comes -** from sqlite3_malloc(). -** + Use p->cSep as the separator. The default is ",". -** + Keep track of the line number in p->nLine. -** + Store the character that terminates the field in p->cTerm. Store -** EOF on end-of-file. -** + Report syntax errors on stderr -*/ -static char *csv_read_one_field(CSVReader *p){ - int c, pc, ppc; - int cSep = p->cSeparator; - p->n = 0; - c = fgetc(p->in); - if( c==EOF || seenInterrupt ){ - p->cTerm = EOF; - return 0; - } - if( c=='"' ){ - int startLine = p->nLine; - int cQuote = c; - pc = ppc = 0; - while( 1 ){ - c = fgetc(p->in); - if( c=='\n' ) p->nLine++; - if( c==cQuote ){ - if( pc==cQuote ){ - pc = 0; - continue; - } - } - if( (c==cSep && pc==cQuote) - || (c=='\n' && pc==cQuote) - || (c=='\n' && pc=='\r' && ppc==cQuote) - || (c==EOF && pc==cQuote) - ){ - do{ p->n--; }while( p->z[p->n]!=cQuote ); - p->cTerm = c; - break; - } - if( pc==cQuote && c!='\r' ){ - fprintf(stderr, "%s:%d: unescaped %c character\n", - p->zFile, p->nLine, cQuote); - } - if( c==EOF ){ - fprintf(stderr, "%s:%d: unterminated %c-quoted field\n", - p->zFile, startLine, cQuote); - p->cTerm = EOF; - break; - } - csv_append_char(p, c); - ppc = pc; - pc = c; - } - }else{ - while( c!=EOF && c!=cSep && c!='\n' ){ - csv_append_char(p, c); - c = fgetc(p->in); - } - if( c=='\n' ){ - p->nLine++; - if( p->n>1 && p->z[p->n-1]=='\r' ) p->n--; - } - p->cTerm = c; - } - if( p->z ) p->z[p->n] = 0; - return p->z; -} - -/* -** If an input line begins with "." then invoke this routine to -** process that line. -** -** Return 1 on error, 2 to exit, and 0 otherwise. -*/ -static int do_meta_command(char *zLine, struct callback_data *p){ - int i = 1; - int nArg = 0; - int n, c; - int rc = 0; - char *azArg[50]; - - /* Parse the input line into tokens. - */ - while( zLine[i] && nArg=3 && strncmp(azArg[0], "backup", n)==0 ){ - const char *zDestFile = 0; - const char *zDb = 0; - sqlite3 *pDest; - sqlite3_backup *pBackup; - int j; - for(j=1; jdb, zDb); - if( pBackup==0 ){ - fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest)); - sqlite3_close(pDest); - return 1; - } - while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ){} - sqlite3_backup_finish(pBackup); - if( rc==SQLITE_DONE ){ - rc = 0; - }else{ - fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest)); - rc = 1; - } - sqlite3_close(pDest); - }else - - if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 && nArg>1 && nArg<3 ){ - bail_on_error = booleanValue(azArg[1]); - }else - - /* The undocumented ".breakpoint" command causes a call to the no-op - ** routine named test_breakpoint(). - */ - if( c=='b' && n>=3 && strncmp(azArg[0], "breakpoint", n)==0 ){ - test_breakpoint(); - }else - - if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 && nArg==1 ){ - struct callback_data data; - char *zErrMsg = 0; - open_db(p, 0); - memcpy(&data, p, sizeof(data)); - data.showHeader = 1; - data.mode = MODE_Column; - data.colWidth[0] = 3; - data.colWidth[1] = 15; - data.colWidth[2] = 58; - data.cnt = 0; - sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg); - if( zErrMsg ){ - fprintf(stderr,"Error: %s\n", zErrMsg); - sqlite3_free(zErrMsg); - rc = 1; - } - }else - - if( c=='d' && strncmp(azArg[0], "dump", n)==0 && nArg<3 ){ - open_db(p, 0); - /* When playing back a "dump", the content might appear in an order - ** which causes immediate foreign key constraints to be violated. - ** So disable foreign-key constraint enforcement to prevent problems. */ - fprintf(p->out, "PRAGMA foreign_keys=OFF;\n"); - fprintf(p->out, "BEGIN TRANSACTION;\n"); - p->writableSchema = 0; - sqlite3_exec(p->db, "SAVEPOINT dump; PRAGMA writable_schema=ON", 0, 0, 0); - p->nErr = 0; - if( nArg==1 ){ - run_schema_dump_query(p, - "SELECT name, type, sql FROM sqlite_master " - "WHERE sql NOT NULL AND type=='table' AND name!='sqlite_sequence'" - ); - run_schema_dump_query(p, - "SELECT name, type, sql FROM sqlite_master " - "WHERE name=='sqlite_sequence'" - ); - run_table_dump_query(p, - "SELECT sql FROM sqlite_master " - "WHERE sql NOT NULL AND type IN ('index','trigger','view')", 0 - ); - }else{ - int i; - for(i=1; iwritableSchema ){ - fprintf(p->out, "PRAGMA writable_schema=OFF;\n"); - p->writableSchema = 0; - } - sqlite3_exec(p->db, "PRAGMA writable_schema=OFF;", 0, 0, 0); - sqlite3_exec(p->db, "RELEASE dump;", 0, 0, 0); - fprintf(p->out, p->nErr ? "ROLLBACK; -- due to errors\n" : "COMMIT;\n"); - }else - - if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){ - p->echoOn = booleanValue(azArg[1]); - }else - - if( c=='e' && strncmp(azArg[0], "exit", n)==0 ){ - if( nArg>1 && (rc = (int)integerValue(azArg[1]))!=0 ) exit(rc); - rc = 2; - }else - - if( c=='e' && strncmp(azArg[0], "explain", n)==0 && nArg<3 ){ - int val = nArg>=2 ? booleanValue(azArg[1]) : 1; - if(val == 1) { - if(!p->explainPrev.valid) { - p->explainPrev.valid = 1; - p->explainPrev.mode = p->mode; - p->explainPrev.showHeader = p->showHeader; - memcpy(p->explainPrev.colWidth,p->colWidth,sizeof(p->colWidth)); - } - /* We could put this code under the !p->explainValid - ** condition so that it does not execute if we are already in - ** explain mode. However, always executing it allows us an easy - ** was to reset to explain mode in case the user previously - ** did an .explain followed by a .width, .mode or .header - ** command. - */ - p->mode = MODE_Explain; - p->showHeader = 1; - memset(p->colWidth,0,sizeof(p->colWidth)); - p->colWidth[0] = 4; /* addr */ - p->colWidth[1] = 13; /* opcode */ - p->colWidth[2] = 4; /* P1 */ - p->colWidth[3] = 4; /* P2 */ - p->colWidth[4] = 4; /* P3 */ - p->colWidth[5] = 13; /* P4 */ - p->colWidth[6] = 2; /* P5 */ - p->colWidth[7] = 13; /* Comment */ - }else if (p->explainPrev.valid) { - p->explainPrev.valid = 0; - p->mode = p->explainPrev.mode; - p->showHeader = p->explainPrev.showHeader; - memcpy(p->colWidth,p->explainPrev.colWidth,sizeof(p->colWidth)); - } - }else - - if( c=='h' && (strncmp(azArg[0], "header", n)==0 || - strncmp(azArg[0], "headers", n)==0) && nArg>1 && nArg<3 ){ - p->showHeader = booleanValue(azArg[1]); - }else - - if( c=='h' && strncmp(azArg[0], "help", n)==0 ){ - fprintf(stderr,"%s",zHelp); - if( HAS_TIMER ){ - fprintf(stderr,"%s",zTimerHelp); - } - }else - - if( c=='i' && strncmp(azArg[0], "import", n)==0 && nArg==3 ){ - char *zTable = azArg[2]; /* Insert data into this table */ - char *zFile = azArg[1]; /* Name of file to extra content from */ - sqlite3_stmt *pStmt = NULL; /* A statement */ - int nCol; /* Number of columns in the table */ - int nByte; /* Number of bytes in an SQL string */ - int i, j; /* Loop counters */ - int needCommit; /* True to COMMIT or ROLLBACK at end */ - int nSep; /* Number of bytes in p->separator[] */ - char *zSql; /* An SQL statement */ - CSVReader sCsv; /* Reader context */ - int (*xCloser)(FILE*); /* Procedure to close th3 connection */ - - seenInterrupt = 0; - memset(&sCsv, 0, sizeof(sCsv)); - open_db(p, 0); - nSep = strlen30(p->separator); - if( nSep==0 ){ - fprintf(stderr, "Error: non-null separator required for import\n"); - return 1; - } - if( nSep>1 ){ - fprintf(stderr, "Error: multi-character separators not allowed" - " for import\n"); - return 1; - } - sCsv.zFile = zFile; - sCsv.nLine = 1; - if( sCsv.zFile[0]=='|' ){ - sCsv.in = popen(sCsv.zFile+1, "r"); - sCsv.zFile = ""; - xCloser = pclose; - }else{ - sCsv.in = fopen(sCsv.zFile, "rb"); - xCloser = fclose; - } - if( sCsv.in==0 ){ - fprintf(stderr, "Error: cannot open \"%s\"\n", zFile); - return 1; - } - sCsv.cSeparator = p->separator[0]; - zSql = sqlite3_mprintf("SELECT * FROM %s", zTable); - if( zSql==0 ){ - fprintf(stderr, "Error: out of memory\n"); - xCloser(sCsv.in); - return 1; - } - nByte = strlen30(zSql); - rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0); - if( rc && sqlite3_strglob("no such table: *", sqlite3_errmsg(db))==0 ){ - char *zCreate = sqlite3_mprintf("CREATE TABLE %s", zTable); - char cSep = '('; - while( csv_read_one_field(&sCsv) ){ - zCreate = sqlite3_mprintf("%z%c\n \"%s\" TEXT", zCreate, cSep, sCsv.z); - cSep = ','; - if( sCsv.cTerm!=sCsv.cSeparator ) break; - } - if( cSep=='(' ){ - sqlite3_free(zCreate); - sqlite3_free(sCsv.z); - xCloser(sCsv.in); - fprintf(stderr,"%s: empty file\n", sCsv.zFile); - return 1; - } - zCreate = sqlite3_mprintf("%z\n)", zCreate); - rc = sqlite3_exec(p->db, zCreate, 0, 0, 0); - sqlite3_free(zCreate); - if( rc ){ - fprintf(stderr, "CREATE TABLE %s(...) failed: %s\n", zTable, - sqlite3_errmsg(db)); - sqlite3_free(sCsv.z); - xCloser(sCsv.in); - return 1; - } - rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0); - } - sqlite3_free(zSql); - if( rc ){ - if (pStmt) sqlite3_finalize(pStmt); - fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db)); - xCloser(sCsv.in); - return 1; - } - nCol = sqlite3_column_count(pStmt); - sqlite3_finalize(pStmt); - pStmt = 0; - if( nCol==0 ) return 0; /* no columns, no error */ - zSql = sqlite3_malloc( nByte*2 + 20 + nCol*2 ); - if( zSql==0 ){ - fprintf(stderr, "Error: out of memory\n"); - xCloser(sCsv.in); - return 1; - } - sqlite3_snprintf(nByte+20, zSql, "INSERT INTO \"%w\" VALUES(?", zTable); - j = strlen30(zSql); - for(i=1; idb, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); - if( rc ){ - fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db)); - if (pStmt) sqlite3_finalize(pStmt); - xCloser(sCsv.in); - return 1; - } - needCommit = sqlite3_get_autocommit(db); - if( needCommit ) sqlite3_exec(db, "BEGIN", 0, 0, 0); - do{ - int startLine = sCsv.nLine; - for(i=0; i=nCol ){ - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); - if( rc!=SQLITE_OK ){ - fprintf(stderr, "%s:%d: INSERT failed: %s\n", sCsv.zFile, startLine, - sqlite3_errmsg(db)); - } - } - }while( sCsv.cTerm!=EOF ); - - xCloser(sCsv.in); - sqlite3_free(sCsv.z); - sqlite3_finalize(pStmt); - if( needCommit ) sqlite3_exec(db, "COMMIT", 0, 0, 0); - }else - - if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg<3 ){ - struct callback_data data; - char *zErrMsg = 0; - open_db(p, 0); - memcpy(&data, p, sizeof(data)); - data.showHeader = 0; - data.mode = MODE_List; - if( nArg==1 ){ - rc = sqlite3_exec(p->db, - "SELECT name FROM sqlite_master " - "WHERE type='index' AND name NOT LIKE 'sqlite_%' " - "UNION ALL " - "SELECT name FROM sqlite_temp_master " - "WHERE type='index' " - "ORDER BY 1", - callback, &data, &zErrMsg - ); - }else{ - zShellStatic = azArg[1]; - rc = sqlite3_exec(p->db, - "SELECT name FROM sqlite_master " - "WHERE type='index' AND tbl_name LIKE shellstatic() " - "UNION ALL " - "SELECT name FROM sqlite_temp_master " - "WHERE type='index' AND tbl_name LIKE shellstatic() " - "ORDER BY 1", - callback, &data, &zErrMsg - ); - zShellStatic = 0; - } - if( zErrMsg ){ - fprintf(stderr,"Error: %s\n", zErrMsg); - sqlite3_free(zErrMsg); - rc = 1; - }else if( rc != SQLITE_OK ){ - fprintf(stderr,"Error: querying sqlite_master and sqlite_temp_master\n"); - rc = 1; - } - }else - -#ifdef SQLITE_ENABLE_IOTRACE - if( c=='i' && strncmp(azArg[0], "iotrace", n)==0 ){ - extern void (*sqlite3IoTrace)(const char*, ...); - if( iotrace && iotrace!=stdout ) fclose(iotrace); - iotrace = 0; - if( nArg<2 ){ - sqlite3IoTrace = 0; - }else if( strcmp(azArg[1], "-")==0 ){ - sqlite3IoTrace = iotracePrintf; - iotrace = stdout; - }else{ - iotrace = fopen(azArg[1], "w"); - if( iotrace==0 ){ - fprintf(stderr, "Error: cannot open \"%s\"\n", azArg[1]); - sqlite3IoTrace = 0; - rc = 1; - }else{ - sqlite3IoTrace = iotracePrintf; - } - } - }else -#endif - -#ifndef SQLITE_OMIT_LOAD_EXTENSION - if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){ - const char *zFile, *zProc; - char *zErrMsg = 0; - zFile = azArg[1]; - zProc = nArg>=3 ? azArg[2] : 0; - open_db(p, 0); - rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg); - if( rc!=SQLITE_OK ){ - fprintf(stderr, "Error: %s\n", zErrMsg); - sqlite3_free(zErrMsg); - rc = 1; - } - }else -#endif - - if( c=='l' && strncmp(azArg[0], "log", n)==0 && nArg>=2 ){ - const char *zFile = azArg[1]; - output_file_close(p->pLog); - p->pLog = output_file_open(zFile); - }else - - if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg==2 ){ - int n2 = strlen30(azArg[1]); - if( (n2==4 && strncmp(azArg[1],"line",n2)==0) - || - (n2==5 && strncmp(azArg[1],"lines",n2)==0) ){ - p->mode = MODE_Line; - }else if( (n2==6 && strncmp(azArg[1],"column",n2)==0) - || - (n2==7 && strncmp(azArg[1],"columns",n2)==0) ){ - p->mode = MODE_Column; - }else if( n2==4 && strncmp(azArg[1],"list",n2)==0 ){ - p->mode = MODE_List; - }else if( n2==4 && strncmp(azArg[1],"html",n2)==0 ){ - p->mode = MODE_Html; - }else if( n2==3 && strncmp(azArg[1],"tcl",n2)==0 ){ - p->mode = MODE_Tcl; - sqlite3_snprintf(sizeof(p->separator), p->separator, " "); - }else if( n2==3 && strncmp(azArg[1],"csv",n2)==0 ){ - p->mode = MODE_Csv; - sqlite3_snprintf(sizeof(p->separator), p->separator, ","); - }else if( n2==4 && strncmp(azArg[1],"tabs",n2)==0 ){ - p->mode = MODE_List; - sqlite3_snprintf(sizeof(p->separator), p->separator, "\t"); - }else if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){ - p->mode = MODE_Insert; - set_table_name(p, "table"); - }else { - fprintf(stderr,"Error: mode should be one of: " - "column csv html insert line list tabs tcl\n"); - rc = 1; - } - }else - - if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg==3 ){ - int n2 = strlen30(azArg[1]); - if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){ - p->mode = MODE_Insert; - set_table_name(p, azArg[2]); - }else { - fprintf(stderr, "Error: invalid arguments: " - " \"%s\". Enter \".help\" for help\n", azArg[2]); - rc = 1; - } - }else - - if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 && nArg==2 ) { - sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue, - "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]); - }else - - if( c=='o' && strncmp(azArg[0], "open", n)==0 && n>=2 ){ - sqlite3 *savedDb = p->db; - const char *zSavedFilename = p->zDbFilename; - char *zNewFilename = 0; - p->db = 0; - if( nArg>=2 ){ - p->zDbFilename = zNewFilename = sqlite3_mprintf("%s", azArg[1]); - } - open_db(p, 1); - if( p->db!=0 ){ - sqlite3_close(savedDb); - sqlite3_free(p->zFreeOnClose); - p->zFreeOnClose = zNewFilename; - }else{ - sqlite3_free(zNewFilename); - p->db = savedDb; - p->zDbFilename = zSavedFilename; - } - }else - - if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){ - if( p->outfile[0]=='|' ){ - pclose(p->out); - }else{ - output_file_close(p->out); - } - p->outfile[0] = 0; - if( azArg[1][0]=='|' ){ - p->out = popen(&azArg[1][1], "w"); - if( p->out==0 ){ - fprintf(stderr,"Error: cannot open pipe \"%s\"\n", &azArg[1][1]); - p->out = stdout; - rc = 1; - }else{ - sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]); - } - }else{ - p->out = output_file_open(azArg[1]); - if( p->out==0 ){ - if( strcmp(azArg[1],"off")!=0 ){ - fprintf(stderr,"Error: cannot write to \"%s\"\n", azArg[1]); - } - p->out = stdout; - rc = 1; - } else { - sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]); - } - } - }else - - if( c=='p' && n>=3 && strncmp(azArg[0], "print", n)==0 ){ - int i; - for(i=1; i1 ) fprintf(p->out, " "); - fprintf(p->out, "%s", azArg[i]); - } - fprintf(p->out, "\n"); - }else - - if( c=='p' && strncmp(azArg[0], "prompt", n)==0 && (nArg==2 || nArg==3)){ - if( nArg >= 2) { - strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1); - } - if( nArg >= 3) { - strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1); - } - }else - - if( c=='q' && strncmp(azArg[0], "quit", n)==0 && nArg==1 ){ - rc = 2; - }else - - if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 && nArg==2 ){ - FILE *alt = fopen(azArg[1], "rb"); - if( alt==0 ){ - fprintf(stderr,"Error: cannot open \"%s\"\n", azArg[1]); - rc = 1; - }else{ - rc = process_input(p, alt); - fclose(alt); - } - }else - - if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 && nArg>1 && nArg<4){ - const char *zSrcFile; - const char *zDb; - sqlite3 *pSrc; - sqlite3_backup *pBackup; - int nTimeout = 0; - - if( nArg==2 ){ - zSrcFile = azArg[1]; - zDb = "main"; - }else{ - zSrcFile = azArg[2]; - zDb = azArg[1]; - } - rc = sqlite3_open(zSrcFile, &pSrc); - if( rc!=SQLITE_OK ){ - fprintf(stderr, "Error: cannot open \"%s\"\n", zSrcFile); - sqlite3_close(pSrc); - return 1; - } - open_db(p, 0); - pBackup = sqlite3_backup_init(p->db, zDb, pSrc, "main"); - if( pBackup==0 ){ - fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db)); - sqlite3_close(pSrc); - return 1; - } - while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK - || rc==SQLITE_BUSY ){ - if( rc==SQLITE_BUSY ){ - if( nTimeout++ >= 3 ) break; - sqlite3_sleep(100); - } - } - sqlite3_backup_finish(pBackup); - if( rc==SQLITE_DONE ){ - rc = 0; - }else if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED ){ - fprintf(stderr, "Error: source database is busy\n"); - rc = 1; - }else{ - fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db)); - rc = 1; - } - sqlite3_close(pSrc); - }else - - if( c=='s' && strncmp(azArg[0], "schema", n)==0 && nArg<3 ){ - struct callback_data data; - char *zErrMsg = 0; - open_db(p, 0); - memcpy(&data, p, sizeof(data)); - data.showHeader = 0; - data.mode = MODE_Semi; - if( nArg>1 ){ - int i; - for(i=0; azArg[1][i]; i++) azArg[1][i] = ToLower(azArg[1][i]); - if( strcmp(azArg[1],"sqlite_master")==0 ){ - char *new_argv[2], *new_colv[2]; - new_argv[0] = "CREATE TABLE sqlite_master (\n" - " type text,\n" - " name text,\n" - " tbl_name text,\n" - " rootpage integer,\n" - " sql text\n" - ")"; - new_argv[1] = 0; - new_colv[0] = "sql"; - new_colv[1] = 0; - callback(&data, 1, new_argv, new_colv); - rc = SQLITE_OK; - }else if( strcmp(azArg[1],"sqlite_temp_master")==0 ){ - char *new_argv[2], *new_colv[2]; - new_argv[0] = "CREATE TEMP TABLE sqlite_temp_master (\n" - " type text,\n" - " name text,\n" - " tbl_name text,\n" - " rootpage integer,\n" - " sql text\n" - ")"; - new_argv[1] = 0; - new_colv[0] = "sql"; - new_colv[1] = 0; - callback(&data, 1, new_argv, new_colv); - rc = SQLITE_OK; - }else{ - zShellStatic = azArg[1]; - rc = sqlite3_exec(p->db, - "SELECT sql FROM " - " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x" - " FROM sqlite_master UNION ALL" - " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) " - "WHERE lower(tbl_name) LIKE shellstatic()" - " AND type!='meta' AND sql NOTNULL " - "ORDER BY rowid", - callback, &data, &zErrMsg); - zShellStatic = 0; - } - }else{ - rc = sqlite3_exec(p->db, - "SELECT sql FROM " - " (SELECT sql sql, type type, tbl_name tbl_name, name name, rowid x" - " FROM sqlite_master UNION ALL" - " SELECT sql, type, tbl_name, name, rowid FROM sqlite_temp_master) " - "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'" - "ORDER BY rowid", - callback, &data, &zErrMsg - ); - } - if( zErrMsg ){ - fprintf(stderr,"Error: %s\n", zErrMsg); - sqlite3_free(zErrMsg); - rc = 1; - }else if( rc != SQLITE_OK ){ - fprintf(stderr,"Error: querying schema information\n"); - rc = 1; - }else{ - rc = 0; - } - }else - -#ifdef SQLITE_DEBUG - /* Undocumented commands for internal testing. Subject to change - ** without notice. */ - if( c=='s' && n>=10 && strncmp(azArg[0], "selftest-", 9)==0 ){ - if( strncmp(azArg[0]+9, "boolean", n-9)==0 ){ - int i, v; - for(i=1; iout, "%s: %d 0x%x\n", azArg[i], v, v); - } - } - if( strncmp(azArg[0]+9, "integer", n-9)==0 ){ - int i; sqlite3_int64 v; - for(i=1; iout, "%s", zBuf); - } - } - }else -#endif - - if( c=='s' && strncmp(azArg[0], "separator", n)==0 && nArg==2 ){ - sqlite3_snprintf(sizeof(p->separator), p->separator, - "%.*s", (int)sizeof(p->separator)-1, azArg[1]); - }else - - if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){ - int i; - fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off"); - fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off"); - fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off"); - fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]); - fprintf(p->out,"%9.9s: ", "nullvalue"); - output_c_string(p->out, p->nullvalue); - fprintf(p->out, "\n"); - fprintf(p->out,"%9.9s: %s\n","output", - strlen30(p->outfile) ? p->outfile : "stdout"); - fprintf(p->out,"%9.9s: ", "separator"); - output_c_string(p->out, p->separator); - fprintf(p->out, "\n"); - fprintf(p->out,"%9.9s: %s\n","stats", p->statsOn ? "on" : "off"); - fprintf(p->out,"%9.9s: ","width"); - for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) { - fprintf(p->out,"%d ",p->colWidth[i]); - } - fprintf(p->out,"\n"); - }else - - if( c=='s' && strncmp(azArg[0], "stats", n)==0 && nArg>1 && nArg<3 ){ - p->statsOn = booleanValue(azArg[1]); - }else - - if( c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0 && nArg<3 ){ - sqlite3_stmt *pStmt; - char **azResult; - int nRow, nAlloc; - char *zSql = 0; - int ii; - open_db(p, 0); - rc = sqlite3_prepare_v2(p->db, "PRAGMA database_list", -1, &pStmt, 0); - if( rc ) return rc; - zSql = sqlite3_mprintf( - "SELECT name FROM sqlite_master" - " WHERE type IN ('table','view')" - " AND name NOT LIKE 'sqlite_%%'" - " AND name LIKE ?1"); - while( sqlite3_step(pStmt)==SQLITE_ROW ){ - const char *zDbName = (const char*)sqlite3_column_text(pStmt, 1); - if( zDbName==0 || strcmp(zDbName,"main")==0 ) continue; - if( strcmp(zDbName,"temp")==0 ){ - zSql = sqlite3_mprintf( - "%z UNION ALL " - "SELECT 'temp.' || name FROM sqlite_temp_master" - " WHERE type IN ('table','view')" - " AND name NOT LIKE 'sqlite_%%'" - " AND name LIKE ?1", zSql); - }else{ - zSql = sqlite3_mprintf( - "%z UNION ALL " - "SELECT '%q.' || name FROM \"%w\".sqlite_master" - " WHERE type IN ('table','view')" - " AND name NOT LIKE 'sqlite_%%'" - " AND name LIKE ?1", zSql, zDbName, zDbName); - } - } - sqlite3_finalize(pStmt); - zSql = sqlite3_mprintf("%z ORDER BY 1", zSql); - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); - if( rc ) return rc; - nRow = nAlloc = 0; - azResult = 0; - if( nArg>1 ){ - sqlite3_bind_text(pStmt, 1, azArg[1], -1, SQLITE_TRANSIENT); - }else{ - sqlite3_bind_text(pStmt, 1, "%", -1, SQLITE_STATIC); - } - while( sqlite3_step(pStmt)==SQLITE_ROW ){ - if( nRow>=nAlloc ){ - char **azNew; - int n = nAlloc*2 + 10; - azNew = sqlite3_realloc(azResult, sizeof(azResult[0])*n); - if( azNew==0 ){ - fprintf(stderr, "Error: out of memory\n"); - break; - } - nAlloc = n; - azResult = azNew; - } - azResult[nRow] = sqlite3_mprintf("%s", sqlite3_column_text(pStmt, 0)); - if( azResult[nRow] ) nRow++; - } - sqlite3_finalize(pStmt); - if( nRow>0 ){ - int len, maxlen = 0; - int i, j; - int nPrintCol, nPrintRow; - for(i=0; imaxlen ) maxlen = len; - } - nPrintCol = 80/(maxlen+2); - if( nPrintCol<1 ) nPrintCol = 1; - nPrintRow = (nRow + nPrintCol - 1)/nPrintCol; - for(i=0; iout, "%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : ""); - } - fprintf(p->out, "\n"); - } - } - for(ii=0; ii=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){ - static const struct { - const char *zCtrlName; /* Name of a test-control option */ - int ctrlCode; /* Integer code for that option */ - } aCtrl[] = { - { "prng_save", SQLITE_TESTCTRL_PRNG_SAVE }, - { "prng_restore", SQLITE_TESTCTRL_PRNG_RESTORE }, - { "prng_reset", SQLITE_TESTCTRL_PRNG_RESET }, - { "bitvec_test", SQLITE_TESTCTRL_BITVEC_TEST }, - { "fault_install", SQLITE_TESTCTRL_FAULT_INSTALL }, - { "benign_malloc_hooks", SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS }, - { "pending_byte", SQLITE_TESTCTRL_PENDING_BYTE }, - { "assert", SQLITE_TESTCTRL_ASSERT }, - { "always", SQLITE_TESTCTRL_ALWAYS }, - { "reserve", SQLITE_TESTCTRL_RESERVE }, - { "optimizations", SQLITE_TESTCTRL_OPTIMIZATIONS }, - { "iskeyword", SQLITE_TESTCTRL_ISKEYWORD }, - { "scratchmalloc", SQLITE_TESTCTRL_SCRATCHMALLOC }, - }; - int testctrl = -1; - int rc = 0; - int i, n; - open_db(p, 0); - - /* convert testctrl text option to value. allow any unique prefix - ** of the option name, or a numerical value. */ - n = strlen30(azArg[1]); - for(i=0; i<(int)(sizeof(aCtrl)/sizeof(aCtrl[0])); i++){ - if( strncmp(azArg[1], aCtrl[i].zCtrlName, n)==0 ){ - if( testctrl<0 ){ - testctrl = aCtrl[i].ctrlCode; - }else{ - fprintf(stderr, "ambiguous option name: \"%s\"\n", azArg[1]); - testctrl = -1; - break; - } - } - } - if( testctrl<0 ) testctrl = (int)integerValue(azArg[1]); - if( (testctrlSQLITE_TESTCTRL_LAST) ){ - fprintf(stderr,"Error: invalid testctrl option: %s\n", azArg[1]); - }else{ - switch(testctrl){ - - /* sqlite3_test_control(int, db, int) */ - case SQLITE_TESTCTRL_OPTIMIZATIONS: - case SQLITE_TESTCTRL_RESERVE: - if( nArg==3 ){ - int opt = (int)strtol(azArg[2], 0, 0); - rc = sqlite3_test_control(testctrl, p->db, opt); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); - } else { - fprintf(stderr,"Error: testctrl %s takes a single int option\n", - azArg[1]); - } - break; - - /* sqlite3_test_control(int) */ - case SQLITE_TESTCTRL_PRNG_SAVE: - case SQLITE_TESTCTRL_PRNG_RESTORE: - case SQLITE_TESTCTRL_PRNG_RESET: - if( nArg==2 ){ - rc = sqlite3_test_control(testctrl); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); - } else { - fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]); - } - break; - - /* sqlite3_test_control(int, uint) */ - case SQLITE_TESTCTRL_PENDING_BYTE: - if( nArg==3 ){ - unsigned int opt = (unsigned int)integerValue(azArg[2]); - rc = sqlite3_test_control(testctrl, opt); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); - } else { - fprintf(stderr,"Error: testctrl %s takes a single unsigned" - " int option\n", azArg[1]); - } - break; - - /* sqlite3_test_control(int, int) */ - case SQLITE_TESTCTRL_ASSERT: - case SQLITE_TESTCTRL_ALWAYS: - if( nArg==3 ){ - int opt = booleanValue(azArg[2]); - rc = sqlite3_test_control(testctrl, opt); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); - } else { - fprintf(stderr,"Error: testctrl %s takes a single int option\n", - azArg[1]); - } - break; - - /* sqlite3_test_control(int, char *) */ -#ifdef SQLITE_N_KEYWORD - case SQLITE_TESTCTRL_ISKEYWORD: - if( nArg==3 ){ - const char *opt = azArg[2]; - rc = sqlite3_test_control(testctrl, opt); - fprintf(p->out, "%d (0x%08x)\n", rc, rc); - } else { - fprintf(stderr,"Error: testctrl %s takes a single char * option\n", - azArg[1]); - } - break; -#endif - - case SQLITE_TESTCTRL_BITVEC_TEST: - case SQLITE_TESTCTRL_FAULT_INSTALL: - case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: - case SQLITE_TESTCTRL_SCRATCHMALLOC: - default: - fprintf(stderr,"Error: CLI support for testctrl %s not implemented\n", - azArg[1]); - break; - } - } - }else - - if( c=='t' && n>4 && strncmp(azArg[0], "timeout", n)==0 && nArg==2 ){ - open_db(p, 0); - sqlite3_busy_timeout(p->db, (int)integerValue(azArg[1])); - }else - - if( HAS_TIMER && c=='t' && n>=5 && strncmp(azArg[0], "timer", n)==0 - && nArg==2 - ){ - enableTimer = booleanValue(azArg[1]); - }else - - if( c=='t' && strncmp(azArg[0], "trace", n)==0 && nArg>1 ){ - open_db(p, 0); - output_file_close(p->traceOut); - p->traceOut = output_file_open(azArg[1]); -#if !defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_OMIT_FLOATING_POINT) - if( p->traceOut==0 ){ - sqlite3_trace(p->db, 0, 0); - }else{ - sqlite3_trace(p->db, sql_trace_callback, p->traceOut); - } -#endif - }else - - if( c=='v' && strncmp(azArg[0], "version", n)==0 ){ - fprintf(p->out, "SQLite %s %s\n" /*extra-version-info*/, - sqlite3_libversion(), sqlite3_sourceid()); - }else - - if( c=='v' && strncmp(azArg[0], "vfsname", n)==0 ){ - const char *zDbName = nArg==2 ? azArg[1] : "main"; - char *zVfsName = 0; - if( p->db ){ - sqlite3_file_control(p->db, zDbName, SQLITE_FCNTL_VFSNAME, &zVfsName); - if( zVfsName ){ - fprintf(p->out, "%s\n", zVfsName); - sqlite3_free(zVfsName); - } - } - }else - -#if defined(SQLITE_DEBUG) && defined(SQLITE_ENABLE_WHERETRACE) - if( c=='w' && strncmp(azArg[0], "wheretrace", n)==0 ){ - extern int sqlite3WhereTrace; - sqlite3WhereTrace = booleanValue(azArg[1]); - }else -#endif - - if( c=='w' && strncmp(azArg[0], "width", n)==0 && nArg>1 ){ - int j; - assert( nArg<=ArraySize(azArg) ); - for(j=1; jcolWidth); j++){ - p->colWidth[j-1] = (int)integerValue(azArg[j]); - } - }else - - { - fprintf(stderr, "Error: unknown command or invalid arguments: " - " \"%s\". Enter \".help\" for help\n", azArg[0]); - rc = 1; - } - - return rc; -} - -/* -** Return TRUE if a semicolon occurs anywhere in the first N characters -** of string z[]. -*/ -static int line_contains_semicolon(const char *z, int N){ - int i; - for(i=0; iout); - zLine = one_input_line(in, zLine, nSql>0); - if( zLine==0 ){ - /* End of input */ - if( stdin_is_interactive ) printf("\n"); - break; - } - if( seenInterrupt ){ - if( in!=0 ) break; - seenInterrupt = 0; - } - lineno++; - if( nSql==0 && _all_whitespace(zLine) ){ - if( p->echoOn ) printf("%s\n", zLine); - continue; - } - if( zLine && zLine[0]=='.' && nSql==0 ){ - if( p->echoOn ) printf("%s\n", zLine); - rc = do_meta_command(zLine, p); - if( rc==2 ){ /* exit requested */ - break; - }else if( rc ){ - errCnt++; - } - continue; - } - if( line_is_command_terminator(zLine) && line_is_complete(zSql, nSql) ){ - memcpy(zLine,";",2); - } - nLine = strlen30(zLine); - if( nSql+nLine+2>=nAlloc ){ - nAlloc = nSql+nLine+100; - zSql = realloc(zSql, nAlloc); - if( zSql==0 ){ - fprintf(stderr, "Error: out of memory\n"); - exit(1); - } - } - nSqlPrior = nSql; - if( nSql==0 ){ - int i; - for(i=0; zLine[i] && IsSpace(zLine[i]); i++){} - assert( nAlloc>0 && zSql!=0 ); - memcpy(zSql, zLine+i, nLine+1-i); - startline = lineno; - nSql = nLine-i; - }else{ - zSql[nSql++] = '\n'; - memcpy(zSql+nSql, zLine, nLine+1); - nSql += nLine; - } - if( nSql && line_contains_semicolon(&zSql[nSqlPrior], nSql-nSqlPrior) - && sqlite3_complete(zSql) ){ - p->cnt = 0; - open_db(p, 0); - BEGIN_TIMER; - rc = shell_exec(p->db, zSql, shell_callback, p, &zErrMsg); - END_TIMER; - if( rc || zErrMsg ){ - char zPrefix[100]; - if( in!=0 || !stdin_is_interactive ){ - sqlite3_snprintf(sizeof(zPrefix), zPrefix, - "Error: near line %d:", startline); - }else{ - sqlite3_snprintf(sizeof(zPrefix), zPrefix, "Error:"); - } - if( zErrMsg!=0 ){ - fprintf(stderr, "%s %s\n", zPrefix, zErrMsg); - sqlite3_free(zErrMsg); - zErrMsg = 0; - }else{ - fprintf(stderr, "%s %s\n", zPrefix, sqlite3_errmsg(p->db)); - } - errCnt++; - } - nSql = 0; - }else if( nSql && _all_whitespace(zSql) ){ - if( p->echoOn ) printf("%s\n", zSql); - nSql = 0; - } - } - if( nSql ){ - if( !_all_whitespace(zSql) ){ - fprintf(stderr, "Error: incomplete SQL: %s\n", zSql); - } - free(zSql); - } - free(zLine); - return errCnt>0; -} - -/* -** Return a pathname which is the user's home directory. A -** 0 return indicates an error of some kind. -*/ -static char *find_home_dir(void){ - static char *home_dir = NULL; - if( home_dir ) return home_dir; - -#if !defined(_WIN32) && !defined(WIN32) && !defined(_WIN32_WCE) && !defined(__RTP__) && !defined(_WRS_KERNEL) - { - struct passwd *pwent; - uid_t uid = getuid(); - if( (pwent=getpwuid(uid)) != NULL) { - home_dir = pwent->pw_dir; - } - } -#endif - -#if defined(_WIN32_WCE) - /* Windows CE (arm-wince-mingw32ce-gcc) does not provide getenv() - */ - home_dir = "/"; -#else - -#if defined(_WIN32) || defined(WIN32) - if (!home_dir) { - home_dir = getenv("USERPROFILE"); - } -#endif - - if (!home_dir) { - home_dir = getenv("HOME"); - } - -#if defined(_WIN32) || defined(WIN32) - if (!home_dir) { - char *zDrive, *zPath; - int n; - zDrive = getenv("HOMEDRIVE"); - zPath = getenv("HOMEPATH"); - if( zDrive && zPath ){ - n = strlen30(zDrive) + strlen30(zPath) + 1; - home_dir = malloc( n ); - if( home_dir==0 ) return 0; - sqlite3_snprintf(n, home_dir, "%s%s", zDrive, zPath); - return home_dir; - } - home_dir = "c:\\"; - } -#endif - -#endif /* !_WIN32_WCE */ - - if( home_dir ){ - int n = strlen30(home_dir) + 1; - char *z = malloc( n ); - if( z ) memcpy(z, home_dir, n); - home_dir = z; - } - - return home_dir; -} - -/* -** Read input from the file given by sqliterc_override. Or if that -** parameter is NULL, take input from ~/.sqliterc -** -** Returns the number of errors. -*/ -static int process_sqliterc( - struct callback_data *p, /* Configuration data */ - const char *sqliterc_override /* Name of config file. NULL to use default */ -){ - char *home_dir = NULL; - const char *sqliterc = sqliterc_override; - char *zBuf = 0; - FILE *in = NULL; - int rc = 0; - - if (sqliterc == NULL) { - home_dir = find_home_dir(); - if( home_dir==0 ){ -#if !defined(__RTP__) && !defined(_WRS_KERNEL) - fprintf(stderr,"%s: Error: cannot locate your home directory\n", Argv0); -#endif - return 1; - } - sqlite3_initialize(); - zBuf = sqlite3_mprintf("%s/.sqliterc",home_dir); - sqliterc = zBuf; - } - in = fopen(sqliterc,"rb"); - if( in ){ - if( stdin_is_interactive ){ - fprintf(stderr,"-- Loading resources from %s\n",sqliterc); - } - rc = process_input(p,in); - fclose(in); - } - sqlite3_free(zBuf); - return rc; -} - -/* -** Show available command line options -*/ -static const char zOptions[] = - " -bail stop after hitting an error\n" - " -batch force batch I/O\n" - " -column set output mode to 'column'\n" - " -cmd COMMAND run \"COMMAND\" before reading stdin\n" - " -csv set output mode to 'csv'\n" - " -echo print commands before execution\n" - " -init FILENAME read/process named file\n" - " -[no]header turn headers on or off\n" -#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5) - " -heap SIZE Size of heap for memsys3 or memsys5\n" -#endif - " -help show this message\n" - " -html set output mode to HTML\n" - " -interactive force interactive I/O\n" - " -line set output mode to 'line'\n" - " -list set output mode to 'list'\n" - " -mmap N default mmap size set to N\n" -#ifdef SQLITE_ENABLE_MULTIPLEX - " -multiplex enable the multiplexor VFS\n" -#endif - " -nullvalue TEXT set text string for NULL values. Default ''\n" - " -separator SEP set output field separator. Default: '|'\n" - " -stats print memory stats before each finalize\n" - " -version show SQLite version\n" - " -vfs NAME use NAME as the default VFS\n" -#ifdef SQLITE_ENABLE_VFSTRACE - " -vfstrace enable tracing of all VFS calls\n" -#endif -; -static void usage(int showDetail){ - fprintf(stderr, - "Usage: %s [OPTIONS] FILENAME [SQL]\n" - "FILENAME is the name of an SQLite database. A new database is created\n" - "if the file does not previously exist.\n", Argv0); - if( showDetail ){ - fprintf(stderr, "OPTIONS include:\n%s", zOptions); - }else{ - fprintf(stderr, "Use the -help option for additional information\n"); - } - exit(1); -} - -/* -** Initialize the state information in data -*/ -static void main_init(struct callback_data *data) { - memset(data, 0, sizeof(*data)); - data->mode = MODE_List; - memcpy(data->separator,"|", 2); - data->showHeader = 0; - sqlite3_config(SQLITE_CONFIG_URI, 1); - sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data); - sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> "); - sqlite3_snprintf(sizeof(continuePrompt), continuePrompt," ...> "); - sqlite3_config(SQLITE_CONFIG_SINGLETHREAD); -} - -/* -** Get the argument to an --option. Throw an error and die if no argument -** is available. -*/ -static char *cmdline_option_value(int argc, char **argv, int i){ - if( i==argc ){ - fprintf(stderr, "%s: Error: missing argument to %s\n", - argv[0], argv[argc-1]); - exit(1); - } - return argv[i]; -} - -int main(int argc, char **argv){ - char *zErrMsg = 0; - struct callback_data data; - const char *zInitFile = 0; - char *zFirstCmd = 0; - int i; - int rc = 0; - - if( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)!=0 ){ - fprintf(stderr, "SQLite header and source version mismatch\n%s\n%s\n", - sqlite3_sourceid(), SQLITE_SOURCE_ID); - exit(1); - } - Argv0 = argv[0]; - main_init(&data); - stdin_is_interactive = isatty(0); - - /* Make sure we have a valid signal handler early, before anything - ** else is done. - */ -#ifdef SIGINT - signal(SIGINT, interrupt_handler); -#endif - - /* Do an initial pass through the command-line argument to locate - ** the name of the database file, the name of the initialization file, - ** the size of the alternative malloc heap, - ** and the first command to execute. - */ - for(i=1; i0x7fff0000 ) szHeap = 0x7fff0000; - sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64); -#endif -#ifdef SQLITE_ENABLE_VFSTRACE - }else if( strcmp(z,"-vfstrace")==0 ){ - extern int vfstrace_register( - const char *zTraceName, - const char *zOldVfsName, - int (*xOut)(const char*,void*), - void *pOutArg, - int makeDefault - ); - vfstrace_register("trace",0,(int(*)(const char*,void*))fputs,stderr,1); -#endif -#ifdef SQLITE_ENABLE_MULTIPLEX - }else if( strcmp(z,"-multiplex")==0 ){ - extern int sqlite3_multiple_initialize(const char*,int); - sqlite3_multiplex_initialize(0, 1); -#endif - }else if( strcmp(z,"-mmap")==0 ){ - sqlite3_int64 sz = integerValue(cmdline_option_value(argc,argv,++i)); - sqlite3_config(SQLITE_CONFIG_MMAP_SIZE, sz, sz); - }else if( strcmp(z,"-vfs")==0 ){ - sqlite3_vfs *pVfs = sqlite3_vfs_find(cmdline_option_value(argc,argv,++i)); - if( pVfs ){ - sqlite3_vfs_register(pVfs, 1); - }else{ - fprintf(stderr, "no such VFS: \"%s\"\n", argv[i]); - exit(1); - } - } - } - if( data.zDbFilename==0 ){ -#ifndef SQLITE_OMIT_MEMORYDB - data.zDbFilename = ":memory:"; -#else - fprintf(stderr,"%s: Error: no database filename specified\n", Argv0); - return 1; -#endif - } - data.out = stdout; - - /* Go ahead and open the database file if it already exists. If the - ** file does not exist, delay opening it. This prevents empty database - ** files from being created if a user mistypes the database name argument - ** to the sqlite command-line tool. - */ - if( access(data.zDbFilename, 0)==0 ){ - open_db(&data, 0); - } - - /* Process the initialization file if there is one. If no -init option - ** is given on the command line, look for a file named ~/.sqliterc and - ** try to process it. - */ - rc = process_sqliterc(&data,zInitFile); - if( rc>0 ){ - return rc; - } - - /* Make a second pass through the command-line argument and set - ** options. This second pass is delayed until after the initialization - ** file is processed so that the command-line arguments will override - ** settings in the initialization file. - */ - for(i=1; i create table memos(text, priority INTEGER); -sqlite> insert into memos values('deliver project description', 10); -sqlite> insert into memos values('lunch with Christine', 100); -sqlite> select * from memos; -deliver project description|10 -lunch with Christine|100 -sqlite> -.Ed -.Pp -If no database name is supplied, the -.Em ATTACH -sql command can be used -to attach to existing or create new database files. -.Em ATTACH -can also be used to attach to multiple databases within the same -interactive session. -This is useful for migrating data between databases, -possibly changing the schema along the way. -.Pp -Optionally, a SQL statement or set of SQL statements can be supplied as -a single argument. -Multiple statements should be separated by semi-colons. -.Pp -For example: -.Bd -literal -offset indent -$ sqlite3 -line mydata.db 'select * from memos where priority > 20;' - text = lunch with Christine - priority = 100 -.Ed -.Ss SQLITE META-COMMANDS -The interactive interpreter offers a set of meta-commands that can be -used to control the output format, examine the currently attached -database files, or perform administrative operations upon the -attached databases (such as rebuilding indices). -Meta-commands are always prefixed with a dot -.Dq \&. . -.Pp -A list of available meta-commands can be viewed at any time by issuing -the '.help' command. -For example: -.Bd -literal -offset indent -sqlite> .help -\&.databases List names and files of attached databases -\&.dump ?TABLE? ... Dump the database in an SQL text format -\&.echo ON|OFF Turn command echo on or off -\&.exit Exit this program -\&.explain ON|OFF Turn output mode suitable for EXPLAIN on or off. -\&.header(s) ON|OFF Turn display of headers on or off -\&.help Show this message -\&.import FILE TABLE Import data from FILE into TABLE -\&.indices TABLE Show names of all indices on TABLE -\&.mode MODE ?TABLE? Set output mode where MODE is one of: - csv Comma-separated values - column Left-aligned columns. (See .width) - html HTML
code - insert SQL insert statements for TABLE - line One value per line - list Values delimited by .separator string - tabs Tab-separated values - tcl TCL list elements -\&.nullvalue STRING Print STRING in place of NULL values -\&.output FILENAME Send output to FILENAME -\&.output stdout Send output to the screen -\&.prompt MAIN CONTINUE Replace the standard prompts -\&.quit Exit this program -\&.read FILENAME Execute SQL in FILENAME -\&.schema ?TABLE? Show the CREATE statements -\&.separator STRING Change separator used by output mode and .import -\&.show Show the current values for various settings -\&.tables ?PATTERN? List names of tables matching a LIKE pattern -\&.timeout MS Try opening locked tables for MS milliseconds -\&.width NUM NUM ... Set column widths for "column" mode -sqlite> -.Ed -.Sh OPTIONS -.Nm -has the following options: -.Bl -tag -width abcdefghij -.It Fl init Ar file -Read and execute commands from -.Ar file , -which can contain a mix of SQL statements and meta-commands. -.It Fl echo -Print commands before execution. -.It Fl header -Turn headers on. -.It Fl noheader -Turn headers off. -.It Fl column -Query results will be displayed in a table like form, using -whitespace characters to separate the columns and align the -output. -.It Fl html -Query results will be output as simple HTML tables. -.It Fl line -Query results will be displayed with one value per line, rows -separated by a blank line. -Designed to be easily parsed by scripts or other programs -.It Fl list -Query results will be displayed with the separator (|, by default) -character between each field value. -.It Fl separator Ar separator -Set output field separator. -Default is -.Dq | . -.It Fl nullvalue Ar string -Set -.Ar string -used to represent -.Dv NULL -values. -Default is -.Dq \e -(empty string). -.It Fl version -Show SQLite version. -.It Fl help -Show help on options and exit. -.El -.Ss INIT FILE -.Nm -reads an initialization file to set the configuration of the -interactive environment. -Throughout initialization, any previously specified setting can be overridden. -The sequence of initialization is as follows: -.Bl -enum -.It -The default configuration is established as follows: -.Bd -literal -offset indent -mode = LIST -separator = "|" -main prompt = "sqlite> " -continue prompt = " ...> " -.Ed -.It -If the file -.Pa ~/.sqliterc -exists, it is processed first. -can be found in the user's home directory, it is -read and processed. -It should generally only contain meta-commands. -.It -If the -.Fl init -option is present, the specified file is processed. -.It -All other command line options are processed. -.El -.Sh SEE ALSO -.Lk http://www.sqlite.org/ -.Sh AUTHORS -This manual page was originally written by Andreas Rottmann -.Aq rotty@debian.org , -for the Debian GNU/Linux system (but may be used by others). -It was subsequently revised by Bill Bumgarner -.Aq bbum@mac.com . diff --git a/external/public-domain/sqlite/dist/sqlite3.c b/external/public-domain/sqlite/dist/sqlite3.c deleted file mode 100644 index 7a635c4b6..000000000 --- a/external/public-domain/sqlite/dist/sqlite3.c +++ /dev/null @@ -1,145788 +0,0 @@ -/****************************************************************************** -** This file is an amalgamation of many separate C source files from SQLite -** version 3.8.3.1. By combining all the individual C code files into this -** single large file, the entire code can be compiled as a single translation -** unit. This allows many compilers to do optimizations that would not be -** possible if the files were compiled separately. Performance improvements -** of 5% or more are commonly seen when SQLite is compiled as a single -** translation unit. -** -** This file is all you need to compile SQLite. To use SQLite in other -** programs, you need this file and the "sqlite3.h" header file that defines -** the programming interface to the SQLite library. (If you do not have -** the "sqlite3.h" header file at hand, you will find a copy embedded within -** the text of this file. Search for "Begin file sqlite3.h" to find the start -** of the embedded sqlite3.h header file.) Additional code files may be needed -** if you want a wrapper to interface SQLite with your choice of programming -** language. The code for the "sqlite3" command-line shell is also in a -** separate file. This file contains only code for the core SQLite library. -*/ -#define SQLITE_CORE 1 -#define SQLITE_AMALGAMATION 1 -#ifndef SQLITE_PRIVATE -# define SQLITE_PRIVATE static -#endif -#ifndef SQLITE_API -# define SQLITE_API -#endif -/************** Begin file sqlite3.h *****************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the interface that the SQLite library -** presents to client programs. If a C-function, structure, datatype, -** or constant definition does not appear in this file, then it is -** not a published API of SQLite, is subject to change without -** notice, and should not be referenced by programs that use SQLite. -** -** Some of the definitions that are in this file are marked as -** "experimental". Experimental interfaces are normally new -** features recently added to SQLite. We do not anticipate changes -** to experimental interfaces but reserve the right to make minor changes -** if experience from use "in the wild" suggest such changes are prudent. -** -** The official C-language API documentation for SQLite is derived -** from comments in this file. This file is the authoritative source -** on how SQLite interfaces are suppose to operate. -** -** The name of this file under configuration management is "sqlite.h.in". -** The makefile makes some minor changes to this file (such as inserting -** the version number) and changes its name to "sqlite3.h" as -** part of the build process. -*/ -#ifndef _SQLITE3_H_ -#define _SQLITE3_H_ -#include /* Needed for the definition of va_list */ - -/* -** Make sure we can call this stuff from C++. -*/ -#if 0 -extern "C" { -#endif - - -/* -** Add the ability to override 'extern' -*/ -#ifndef SQLITE_EXTERN -# define SQLITE_EXTERN extern -#endif - -#ifndef SQLITE_API -# define SQLITE_API -#endif - - -/* -** These no-op macros are used in front of interfaces to mark those -** interfaces as either deprecated or experimental. New applications -** should not use deprecated interfaces - they are support for backwards -** compatibility only. Application writers should be aware that -** experimental interfaces are subject to change in point releases. -** -** These macros used to resolve to various kinds of compiler magic that -** would generate warning messages when they were used. But that -** compiler magic ended up generating such a flurry of bug reports -** that we have taken it all out and gone back to using simple -** noop macros. -*/ -#define SQLITE_DEPRECATED -#define SQLITE_EXPERIMENTAL - -/* -** Ensure these symbols were not defined by some previous header file. -*/ -#ifdef SQLITE_VERSION -# undef SQLITE_VERSION -#endif -#ifdef SQLITE_VERSION_NUMBER -# undef SQLITE_VERSION_NUMBER -#endif - -/* -** CAPI3REF: Compile-Time Library Version Numbers -** -** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header -** evaluates to a string literal that is the SQLite version in the -** format "X.Y.Z" where X is the major version number (always 3 for -** SQLite3) and Y is the minor version number and Z is the release number.)^ -** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer -** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same -** numbers used in [SQLITE_VERSION].)^ -** The SQLITE_VERSION_NUMBER for any given release of SQLite will also -** be larger than the release from which it is derived. Either Y will -** be held constant and Z will be incremented or else Y will be incremented -** and Z will be reset to zero. -** -** Since version 3.6.18, SQLite source code has been stored in the -** Fossil configuration management -** system. ^The SQLITE_SOURCE_ID macro evaluates to -** a string which identifies a particular check-in of SQLite -** within its configuration management system. ^The SQLITE_SOURCE_ID -** string contains the date and time of the check-in (UTC) and an SHA1 -** hash of the entire source tree. -** -** See also: [sqlite3_libversion()], -** [sqlite3_libversion_number()], [sqlite3_sourceid()], -** [sqlite_version()] and [sqlite_source_id()]. -*/ -#define SQLITE_VERSION "3.8.3.1" -#define SQLITE_VERSION_NUMBER 3008003 -#define SQLITE_SOURCE_ID "2014-02-11 14:52:19 ea3317a4803d71d88183b29f1d3086f46d68a00e" - -/* -** CAPI3REF: Run-Time Library Version Numbers -** KEYWORDS: sqlite3_version, sqlite3_sourceid -** -** These interfaces provide the same information as the [SQLITE_VERSION], -** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros -** but are associated with the library instead of the header file. ^(Cautious -** programmers might include assert() statements in their application to -** verify that values returned by these interfaces match the macros in -** the header, and thus insure that the application is -** compiled with matching library and header files. -** -**
-** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
-** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
-** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
-** 
)^ -** -** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] -** macro. ^The sqlite3_libversion() function returns a pointer to the -** to the sqlite3_version[] string constant. The sqlite3_libversion() -** function is provided for use in DLLs since DLL users usually do not have -** direct access to string constants within the DLL. ^The -** sqlite3_libversion_number() function returns an integer equal to -** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns -** a pointer to a string constant whose value is the same as the -** [SQLITE_SOURCE_ID] C preprocessor macro. -** -** See also: [sqlite_version()] and [sqlite_source_id()]. -*/ -SQLITE_API const char sqlite3_version[] = SQLITE_VERSION; -SQLITE_API const char *sqlite3_libversion(void); -SQLITE_API const char *sqlite3_sourceid(void); -SQLITE_API int sqlite3_libversion_number(void); - -/* -** CAPI3REF: Run-Time Library Compilation Options Diagnostics -** -** ^The sqlite3_compileoption_used() function returns 0 or 1 -** indicating whether the specified option was defined at -** compile time. ^The SQLITE_ prefix may be omitted from the -** option name passed to sqlite3_compileoption_used(). -** -** ^The sqlite3_compileoption_get() function allows iterating -** over the list of options that were defined at compile time by -** returning the N-th compile time option string. ^If N is out of range, -** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ -** prefix is omitted from any strings returned by -** sqlite3_compileoption_get(). -** -** ^Support for the diagnostic functions sqlite3_compileoption_used() -** and sqlite3_compileoption_get() may be omitted by specifying the -** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. -** -** See also: SQL functions [sqlite_compileoption_used()] and -** [sqlite_compileoption_get()] and the [compile_options pragma]. -*/ -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS -SQLITE_API int sqlite3_compileoption_used(const char *zOptName); -SQLITE_API const char *sqlite3_compileoption_get(int N); -#endif - -/* -** CAPI3REF: Test To See If The Library Is Threadsafe -** -** ^The sqlite3_threadsafe() function returns zero if and only if -** SQLite was compiled with mutexing code omitted due to the -** [SQLITE_THREADSAFE] compile-time option being set to 0. -** -** SQLite can be compiled with or without mutexes. When -** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes -** are enabled and SQLite is threadsafe. When the -** [SQLITE_THREADSAFE] macro is 0, -** the mutexes are omitted. Without the mutexes, it is not safe -** to use SQLite concurrently from more than one thread. -** -** Enabling mutexes incurs a measurable performance penalty. -** So if speed is of utmost importance, it makes sense to disable -** the mutexes. But for maximum safety, mutexes should be enabled. -** ^The default behavior is for mutexes to be enabled. -** -** This interface can be used by an application to make sure that the -** version of SQLite that it is linking against was compiled with -** the desired setting of the [SQLITE_THREADSAFE] macro. -** -** This interface only reports on the compile-time mutex setting -** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with -** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but -** can be fully or partially disabled using a call to [sqlite3_config()] -** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], -** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the -** sqlite3_threadsafe() function shows only the compile-time setting of -** thread safety, not any run-time changes to that setting made by -** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() -** is unchanged by calls to sqlite3_config().)^ -** -** See the [threading mode] documentation for additional information. -*/ -SQLITE_API int sqlite3_threadsafe(void); - -/* -** CAPI3REF: Database Connection Handle -** KEYWORDS: {database connection} {database connections} -** -** Each open SQLite database is represented by a pointer to an instance of -** the opaque structure named "sqlite3". It is useful to think of an sqlite3 -** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and -** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] -** and [sqlite3_close_v2()] are its destructors. There are many other -** interfaces (such as -** [sqlite3_prepare_v2()], [sqlite3_create_function()], and -** [sqlite3_busy_timeout()] to name but three) that are methods on an -** sqlite3 object. -*/ -typedef struct sqlite3 sqlite3; - -/* -** CAPI3REF: 64-Bit Integer Types -** KEYWORDS: sqlite_int64 sqlite_uint64 -** -** Because there is no cross-platform way to specify 64-bit integer types -** SQLite includes typedefs for 64-bit signed and unsigned integers. -** -** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. -** The sqlite_int64 and sqlite_uint64 types are supported for backwards -** compatibility only. -** -** ^The sqlite3_int64 and sqlite_int64 types can store integer values -** between -9223372036854775808 and +9223372036854775807 inclusive. ^The -** sqlite3_uint64 and sqlite_uint64 types can store integer values -** between 0 and +18446744073709551615 inclusive. -*/ -#ifdef SQLITE_INT64_TYPE - typedef SQLITE_INT64_TYPE sqlite_int64; - typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; -#elif defined(_MSC_VER) || defined(__BORLANDC__) - typedef __int64 sqlite_int64; - typedef unsigned __int64 sqlite_uint64; -#else - typedef long long int sqlite_int64; - typedef unsigned long long int sqlite_uint64; -#endif -typedef sqlite_int64 sqlite3_int64; -typedef sqlite_uint64 sqlite3_uint64; - -/* -** If compiling for a processor that lacks floating point support, -** substitute integer for floating-point. -*/ -#ifdef SQLITE_OMIT_FLOATING_POINT -# define double sqlite3_int64 -#endif - -/* -** CAPI3REF: Closing A Database Connection -** -** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors -** for the [sqlite3] object. -** ^Calls to sqlite3_close() and sqlite3_close_v2() return SQLITE_OK if -** the [sqlite3] object is successfully destroyed and all associated -** resources are deallocated. -** -** ^If the database connection is associated with unfinalized prepared -** statements or unfinished sqlite3_backup objects then sqlite3_close() -** will leave the database connection open and return [SQLITE_BUSY]. -** ^If sqlite3_close_v2() is called with unfinalized prepared statements -** and unfinished sqlite3_backups, then the database connection becomes -** an unusable "zombie" which will automatically be deallocated when the -** last prepared statement is finalized or the last sqlite3_backup is -** finished. The sqlite3_close_v2() interface is intended for use with -** host languages that are garbage collected, and where the order in which -** destructors are called is arbitrary. -** -** Applications should [sqlite3_finalize | finalize] all [prepared statements], -** [sqlite3_blob_close | close] all [BLOB handles], and -** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated -** with the [sqlite3] object prior to attempting to close the object. ^If -** sqlite3_close_v2() is called on a [database connection] that still has -** outstanding [prepared statements], [BLOB handles], and/or -** [sqlite3_backup] objects then it returns SQLITE_OK but the deallocation -** of resources is deferred until all [prepared statements], [BLOB handles], -** and [sqlite3_backup] objects are also destroyed. -** -** ^If an [sqlite3] object is destroyed while a transaction is open, -** the transaction is automatically rolled back. -** -** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)] -** must be either a NULL -** pointer or an [sqlite3] object pointer obtained -** from [sqlite3_open()], [sqlite3_open16()], or -** [sqlite3_open_v2()], and not previously closed. -** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer -** argument is a harmless no-op. -*/ -SQLITE_API int sqlite3_close(sqlite3*); -SQLITE_API int sqlite3_close_v2(sqlite3*); - -/* -** The type for a callback function. -** This is legacy and deprecated. It is included for historical -** compatibility and is not documented. -*/ -typedef int (*sqlite3_callback)(void*,int,char**, char**); - -/* -** CAPI3REF: One-Step Query Execution Interface -** -** The sqlite3_exec() interface is a convenience wrapper around -** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], -** that allows an application to run multiple statements of SQL -** without having to use a lot of C code. -** -** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, -** semicolon-separate SQL statements passed into its 2nd argument, -** in the context of the [database connection] passed in as its 1st -** argument. ^If the callback function of the 3rd argument to -** sqlite3_exec() is not NULL, then it is invoked for each result row -** coming out of the evaluated SQL statements. ^The 4th argument to -** sqlite3_exec() is relayed through to the 1st argument of each -** callback invocation. ^If the callback pointer to sqlite3_exec() -** is NULL, then no callback is ever invoked and result rows are -** ignored. -** -** ^If an error occurs while evaluating the SQL statements passed into -** sqlite3_exec(), then execution of the current statement stops and -** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() -** is not NULL then any error message is written into memory obtained -** from [sqlite3_malloc()] and passed back through the 5th parameter. -** To avoid memory leaks, the application should invoke [sqlite3_free()] -** on error message strings returned through the 5th parameter of -** of sqlite3_exec() after the error message string is no longer needed. -** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors -** occur, then sqlite3_exec() sets the pointer in its 5th parameter to -** NULL before returning. -** -** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() -** routine returns SQLITE_ABORT without invoking the callback again and -** without running any subsequent SQL statements. -** -** ^The 2nd argument to the sqlite3_exec() callback function is the -** number of columns in the result. ^The 3rd argument to the sqlite3_exec() -** callback is an array of pointers to strings obtained as if from -** [sqlite3_column_text()], one for each column. ^If an element of a -** result row is NULL then the corresponding string pointer for the -** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the -** sqlite3_exec() callback is an array of pointers to strings where each -** entry represents the name of corresponding result column as obtained -** from [sqlite3_column_name()]. -** -** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer -** to an empty string, or a pointer that contains only whitespace and/or -** SQL comments, then no SQL statements are evaluated and the database -** is not changed. -** -** Restrictions: -** -**
    -**
  • The application must insure that the 1st parameter to sqlite3_exec() -** is a valid and open [database connection]. -**
  • The application must not close the [database connection] specified by -** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. -**
  • The application must not modify the SQL statement text passed into -** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. -**
-*/ -SQLITE_API int sqlite3_exec( - sqlite3*, /* An open database */ - const char *sql, /* SQL to be evaluated */ - int (*callback)(void*,int,char**,char**), /* Callback function */ - void *, /* 1st argument to callback */ - char **errmsg /* Error msg written here */ -); - -/* -** CAPI3REF: Result Codes -** KEYWORDS: SQLITE_OK {error code} {error codes} -** KEYWORDS: {result code} {result codes} -** -** Many SQLite functions return an integer result code from the set shown -** here in order to indicate success or failure. -** -** New error codes may be added in future versions of SQLite. -** -** See also: [SQLITE_IOERR_READ | extended result codes], -** [sqlite3_vtab_on_conflict()] [SQLITE_ROLLBACK | result codes]. -*/ -#define SQLITE_OK 0 /* Successful result */ -/* beginning-of-error-codes */ -#define SQLITE_ERROR 1 /* SQL error or missing database */ -#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ -#define SQLITE_PERM 3 /* Access permission denied */ -#define SQLITE_ABORT 4 /* Callback routine requested an abort */ -#define SQLITE_BUSY 5 /* The database file is locked */ -#define SQLITE_LOCKED 6 /* A table in the database is locked */ -#define SQLITE_NOMEM 7 /* A malloc() failed */ -#define SQLITE_READONLY 8 /* Attempt to write a readonly database */ -#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ -#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ -#define SQLITE_CORRUPT 11 /* The database disk image is malformed */ -#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ -#define SQLITE_FULL 13 /* Insertion failed because database is full */ -#define SQLITE_CANTOPEN 14 /* Unable to open the database file */ -#define SQLITE_PROTOCOL 15 /* Database lock protocol error */ -#define SQLITE_EMPTY 16 /* Database is empty */ -#define SQLITE_SCHEMA 17 /* The database schema changed */ -#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ -#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ -#define SQLITE_MISMATCH 20 /* Data type mismatch */ -#define SQLITE_MISUSE 21 /* Library used incorrectly */ -#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ -#define SQLITE_AUTH 23 /* Authorization denied */ -#define SQLITE_FORMAT 24 /* Auxiliary database format error */ -#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ -#define SQLITE_NOTADB 26 /* File opened that is not a database file */ -#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */ -#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */ -#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ -#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ -/* end-of-error-codes */ - -/* -** CAPI3REF: Extended Result Codes -** KEYWORDS: {extended error code} {extended error codes} -** KEYWORDS: {extended result code} {extended result codes} -** -** In its default configuration, SQLite API routines return one of 26 integer -** [SQLITE_OK | result codes]. However, experience has shown that many of -** these result codes are too coarse-grained. They do not provide as -** much information about problems as programmers might like. In an effort to -** address this, newer versions of SQLite (version 3.3.8 and later) include -** support for additional result codes that provide more detailed information -** about errors. The extended result codes are enabled or disabled -** on a per database connection basis using the -** [sqlite3_extended_result_codes()] API. -** -** Some of the available extended result codes are listed here. -** One may expect the number of extended result codes will increase -** over time. Software that uses extended result codes should expect -** to see new result codes in future releases of SQLite. -** -** The SQLITE_OK result code will never be extended. It will always -** be exactly zero. -*/ -#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) -#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) -#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) -#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) -#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) -#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) -#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) -#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8)) -#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8)) -#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8)) -#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8)) -#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8)) -#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8)) -#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8)) -#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8)) -#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8)) -#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8)) -#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8)) -#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8)) -#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) -#define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) -#define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) -#define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) -#define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) -#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) -#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8)) -#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) -#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) -#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) -#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) -#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) -#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) -#define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) -#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) -#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) -#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) -#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) -#define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) -#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) -#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) -#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) -#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) -#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) -#define SQLITE_CONSTRAINT_NOTNULL (SQLITE_CONSTRAINT | (5<<8)) -#define SQLITE_CONSTRAINT_PRIMARYKEY (SQLITE_CONSTRAINT | (6<<8)) -#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7<<8)) -#define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8<<8)) -#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8)) -#define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) -#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) -#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) -#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) - -/* -** CAPI3REF: Flags For File Open Operations -** -** These bit values are intended for use in the -** 3rd parameter to the [sqlite3_open_v2()] interface and -** in the 4th parameter to the [sqlite3_vfs.xOpen] method. -*/ -#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ -#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ -#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ -#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ -#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ -#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ -#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */ -#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ -#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ -#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ -#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ - -/* Reserved: 0x00F00000 */ - -/* -** CAPI3REF: Device Characteristics -** -** The xDeviceCharacteristics method of the [sqlite3_io_methods] -** object returns an integer which is a vector of these -** bit values expressing I/O characteristics of the mass storage -** device that holds the file that the [sqlite3_io_methods] -** refers to. -** -** The SQLITE_IOCAP_ATOMIC property means that all writes of -** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values -** mean that writes of blocks that are nnn bytes in size and -** are aligned to an address which is an integer multiple of -** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means -** that when data is appended to a file, the data is appended -** first then the size of the file is extended, never the other -** way around. The SQLITE_IOCAP_SEQUENTIAL property means that -** information is written to disk in the same order as calls -** to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that -** after reboot following a crash or power loss, the only bytes in a -** file that were written at the application level might have changed -** and that adjacent bytes, even bytes within the same sector are -** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN -** flag indicate that a file cannot be deleted when open. -*/ -#define SQLITE_IOCAP_ATOMIC 0x00000001 -#define SQLITE_IOCAP_ATOMIC512 0x00000002 -#define SQLITE_IOCAP_ATOMIC1K 0x00000004 -#define SQLITE_IOCAP_ATOMIC2K 0x00000008 -#define SQLITE_IOCAP_ATOMIC4K 0x00000010 -#define SQLITE_IOCAP_ATOMIC8K 0x00000020 -#define SQLITE_IOCAP_ATOMIC16K 0x00000040 -#define SQLITE_IOCAP_ATOMIC32K 0x00000080 -#define SQLITE_IOCAP_ATOMIC64K 0x00000100 -#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 -#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 -#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 -#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 - -/* -** CAPI3REF: File Locking Levels -** -** SQLite uses one of these integer values as the second -** argument to calls it makes to the xLock() and xUnlock() methods -** of an [sqlite3_io_methods] object. -*/ -#define SQLITE_LOCK_NONE 0 -#define SQLITE_LOCK_SHARED 1 -#define SQLITE_LOCK_RESERVED 2 -#define SQLITE_LOCK_PENDING 3 -#define SQLITE_LOCK_EXCLUSIVE 4 - -/* -** CAPI3REF: Synchronization Type Flags -** -** When SQLite invokes the xSync() method of an -** [sqlite3_io_methods] object it uses a combination of -** these integer values as the second argument. -** -** When the SQLITE_SYNC_DATAONLY flag is used, it means that the -** sync operation only needs to flush data to mass storage. Inode -** information need not be flushed. If the lower four bits of the flag -** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. -** If the lower four bits equal SQLITE_SYNC_FULL, that means -** to use Mac OS X style fullsync instead of fsync(). -** -** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags -** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL -** settings. The [synchronous pragma] determines when calls to the -** xSync VFS method occur and applies uniformly across all platforms. -** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how -** energetic or rigorous or forceful the sync operations are and -** only make a difference on Mac OSX for the default SQLite code. -** (Third-party VFS implementations might also make the distinction -** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the -** operating systems natively supported by SQLite, only Mac OSX -** cares about the difference.) -*/ -#define SQLITE_SYNC_NORMAL 0x00002 -#define SQLITE_SYNC_FULL 0x00003 -#define SQLITE_SYNC_DATAONLY 0x00010 - -/* -** CAPI3REF: OS Interface Open File Handle -** -** An [sqlite3_file] object represents an open file in the -** [sqlite3_vfs | OS interface layer]. Individual OS interface -** implementations will -** want to subclass this object by appending additional fields -** for their own use. The pMethods entry is a pointer to an -** [sqlite3_io_methods] object that defines methods for performing -** I/O operations on the open file. -*/ -typedef struct sqlite3_file sqlite3_file; -struct sqlite3_file { - const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ -}; - -/* -** CAPI3REF: OS Interface File Virtual Methods Object -** -** Every file opened by the [sqlite3_vfs.xOpen] method populates an -** [sqlite3_file] object (or, more commonly, a subclass of the -** [sqlite3_file] object) with a pointer to an instance of this object. -** This object defines the methods used to perform various operations -** against the open file represented by the [sqlite3_file] object. -** -** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element -** to a non-NULL pointer, then the sqlite3_io_methods.xClose method -** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The -** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] -** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element -** to NULL. -** -** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or -** [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). -** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] -** flag may be ORed in to indicate that only the data of the file -** and not its inode needs to be synced. -** -** The integer values to xLock() and xUnlock() are one of -**
    -**
  • [SQLITE_LOCK_NONE], -**
  • [SQLITE_LOCK_SHARED], -**
  • [SQLITE_LOCK_RESERVED], -**
  • [SQLITE_LOCK_PENDING], or -**
  • [SQLITE_LOCK_EXCLUSIVE]. -**
-** xLock() increases the lock. xUnlock() decreases the lock. -** The xCheckReservedLock() method checks whether any database connection, -** either in this process or in some other process, is holding a RESERVED, -** PENDING, or EXCLUSIVE lock on the file. It returns true -** if such a lock exists and false otherwise. -** -** The xFileControl() method is a generic interface that allows custom -** VFS implementations to directly control an open file using the -** [sqlite3_file_control()] interface. The second "op" argument is an -** integer opcode. The third argument is a generic pointer intended to -** point to a structure that may contain arguments or space in which to -** write return values. Potential uses for xFileControl() might be -** functions to enable blocking locks with timeouts, to change the -** locking strategy (for example to use dot-file locks), to inquire -** about the status of a lock, or to break stale locks. The SQLite -** core reserves all opcodes less than 100 for its own use. -** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available. -** Applications that define a custom xFileControl method should use opcodes -** greater than 100 to avoid conflicts. VFS implementations should -** return [SQLITE_NOTFOUND] for file control opcodes that they do not -** recognize. -** -** The xSectorSize() method returns the sector size of the -** device that underlies the file. The sector size is the -** minimum write that can be performed without disturbing -** other bytes in the file. The xDeviceCharacteristics() -** method returns a bit vector describing behaviors of the -** underlying device: -** -**
    -**
  • [SQLITE_IOCAP_ATOMIC] -**
  • [SQLITE_IOCAP_ATOMIC512] -**
  • [SQLITE_IOCAP_ATOMIC1K] -**
  • [SQLITE_IOCAP_ATOMIC2K] -**
  • [SQLITE_IOCAP_ATOMIC4K] -**
  • [SQLITE_IOCAP_ATOMIC8K] -**
  • [SQLITE_IOCAP_ATOMIC16K] -**
  • [SQLITE_IOCAP_ATOMIC32K] -**
  • [SQLITE_IOCAP_ATOMIC64K] -**
  • [SQLITE_IOCAP_SAFE_APPEND] -**
  • [SQLITE_IOCAP_SEQUENTIAL] -**
-** -** The SQLITE_IOCAP_ATOMIC property means that all writes of -** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values -** mean that writes of blocks that are nnn bytes in size and -** are aligned to an address which is an integer multiple of -** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means -** that when data is appended to a file, the data is appended -** first then the size of the file is extended, never the other -** way around. The SQLITE_IOCAP_SEQUENTIAL property means that -** information is written to disk in the same order as calls -** to xWrite(). -** -** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill -** in the unread portions of the buffer with zeros. A VFS that -** fails to zero-fill short reads might seem to work. However, -** failure to zero-fill short reads will eventually lead to -** database corruption. -*/ -typedef struct sqlite3_io_methods sqlite3_io_methods; -struct sqlite3_io_methods { - int iVersion; - int (*xClose)(sqlite3_file*); - int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); - int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); - int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); - int (*xSync)(sqlite3_file*, int flags); - int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); - int (*xLock)(sqlite3_file*, int); - int (*xUnlock)(sqlite3_file*, int); - int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); - int (*xFileControl)(sqlite3_file*, int op, void *pArg); - int (*xSectorSize)(sqlite3_file*); - int (*xDeviceCharacteristics)(sqlite3_file*); - /* Methods above are valid for version 1 */ - int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); - int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); - void (*xShmBarrier)(sqlite3_file*); - int (*xShmUnmap)(sqlite3_file*, int deleteFlag); - /* Methods above are valid for version 2 */ - int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp); - int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p); - /* Methods above are valid for version 3 */ - /* Additional methods may be added in future releases */ -}; - -/* -** CAPI3REF: Standard File Control Opcodes -** -** These integer constants are opcodes for the xFileControl method -** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] -** interface. -** -** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This -** opcode causes the xFileControl method to write the current state of -** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], -** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) -** into an integer that the pArg argument points to. This capability -** is used during testing and only needs to be supported when SQLITE_TEST -** is defined. -**
    -**
  • [[SQLITE_FCNTL_SIZE_HINT]] -** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS -** layer a hint of how large the database file will grow to be during the -** current transaction. This hint is not guaranteed to be accurate but it -** is often close. The underlying VFS might choose to preallocate database -** file space based on this hint in order to help writes to the database -** file run faster. -** -**
  • [[SQLITE_FCNTL_CHUNK_SIZE]] -** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS -** extends and truncates the database file in chunks of a size specified -** by the user. The fourth argument to [sqlite3_file_control()] should -** point to an integer (type int) containing the new chunk-size to use -** for the nominated database. Allocating database file space in large -** chunks (say 1MB at a time), may reduce file-system fragmentation and -** improve performance on some systems. -** -**
  • [[SQLITE_FCNTL_FILE_POINTER]] -** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer -** to the [sqlite3_file] object associated with a particular database -** connection. See the [sqlite3_file_control()] documentation for -** additional information. -** -**
  • [[SQLITE_FCNTL_SYNC_OMITTED]] -** No longer in use. -** -**
  • [[SQLITE_FCNTL_SYNC]] -** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and -** sent to the VFS immediately before the xSync method is invoked on a -** database file descriptor. Or, if the xSync method is not invoked -** because the user has configured SQLite with -** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place -** of the xSync method. In most cases, the pointer argument passed with -** this file-control is NULL. However, if the database file is being synced -** as part of a multi-database commit, the argument points to a nul-terminated -** string containing the transactions master-journal file name. VFSes that -** do not need this signal should silently ignore this opcode. Applications -** should not call [sqlite3_file_control()] with this opcode as doing so may -** disrupt the operation of the specialized VFSes that do require it. -** -**
  • [[SQLITE_FCNTL_COMMIT_PHASETWO]] -** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite -** and sent to the VFS after a transaction has been committed immediately -** but before the database is unlocked. VFSes that do not need this signal -** should silently ignore this opcode. Applications should not call -** [sqlite3_file_control()] with this opcode as doing so may disrupt the -** operation of the specialized VFSes that do require it. -** -**
  • [[SQLITE_FCNTL_WIN32_AV_RETRY]] -** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic -** retry counts and intervals for certain disk I/O operations for the -** windows [VFS] in order to provide robustness in the presence of -** anti-virus programs. By default, the windows VFS will retry file read, -** file write, and file delete operations up to 10 times, with a delay -** of 25 milliseconds before the first retry and with the delay increasing -** by an additional 25 milliseconds with each subsequent retry. This -** opcode allows these two values (10 retries and 25 milliseconds of delay) -** to be adjusted. The values are changed for all database connections -** within the same process. The argument is a pointer to an array of two -** integers where the first integer i the new retry count and the second -** integer is the delay. If either integer is negative, then the setting -** is not changed but instead the prior value of that setting is written -** into the array entry, allowing the current retry settings to be -** interrogated. The zDbName parameter is ignored. -** -**
  • [[SQLITE_FCNTL_PERSIST_WAL]] -** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the -** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary -** write ahead log and shared memory files used for transaction control -** are automatically deleted when the latest connection to the database -** closes. Setting persistent WAL mode causes those files to persist after -** close. Persisting the files is useful when other processes that do not -** have write permission on the directory containing the database file want -** to read the database file, as the WAL and shared memory files must exist -** in order for the database to be readable. The fourth parameter to -** [sqlite3_file_control()] for this opcode should be a pointer to an integer. -** That integer is 0 to disable persistent WAL mode or 1 to enable persistent -** WAL mode. If the integer is -1, then it is overwritten with the current -** WAL persistence setting. -** -**
  • [[SQLITE_FCNTL_POWERSAFE_OVERWRITE]] -** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the -** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting -** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the -** xDeviceCharacteristics methods. The fourth parameter to -** [sqlite3_file_control()] for this opcode should be a pointer to an integer. -** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage -** mode. If the integer is -1, then it is overwritten with the current -** zero-damage mode setting. -** -**
  • [[SQLITE_FCNTL_OVERWRITE]] -** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening -** a write transaction to indicate that, unless it is rolled back for some -** reason, the entire database file will be overwritten by the current -** transaction. This is used by VACUUM operations. -** -**
  • [[SQLITE_FCNTL_VFSNAME]] -** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of -** all [VFSes] in the VFS stack. The names are of all VFS shims and the -** final bottom-level VFS are written into memory obtained from -** [sqlite3_malloc()] and the result is stored in the char* variable -** that the fourth parameter of [sqlite3_file_control()] points to. -** The caller is responsible for freeing the memory when done. As with -** all file-control actions, there is no guarantee that this will actually -** do anything. Callers should initialize the char* variable to a NULL -** pointer in case this file-control is not implemented. This file-control -** is intended for diagnostic use only. -** -**
  • [[SQLITE_FCNTL_PRAGMA]] -** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] -** file control is sent to the open [sqlite3_file] object corresponding -** to the database file to which the pragma statement refers. ^The argument -** to the [SQLITE_FCNTL_PRAGMA] file control is an array of -** pointers to strings (char**) in which the second element of the array -** is the name of the pragma and the third element is the argument to the -** pragma or NULL if the pragma has no argument. ^The handler for an -** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element -** of the char** argument point to a string obtained from [sqlite3_mprintf()] -** or the equivalent and that string will become the result of the pragma or -** the error message if the pragma fails. ^If the -** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal -** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] -** file control returns [SQLITE_OK], then the parser assumes that the -** VFS has handled the PRAGMA itself and the parser generates a no-op -** prepared statement. ^If the [SQLITE_FCNTL_PRAGMA] file control returns -** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means -** that the VFS encountered an error while handling the [PRAGMA] and the -** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA] -** file control occurs at the beginning of pragma statement analysis and so -** it is able to override built-in [PRAGMA] statements. -** -**
  • [[SQLITE_FCNTL_BUSYHANDLER]] -** ^The [SQLITE_FCNTL_BUSYHANDLER] -** file-control may be invoked by SQLite on the database file handle -** shortly after it is opened in order to provide a custom VFS with access -** to the connections busy-handler callback. The argument is of type (void **) -** - an array of two (void *) values. The first (void *) actually points -** to a function of type (int (*)(void *)). In order to invoke the connections -** busy-handler, this function should be invoked with the second (void *) in -** the array as the only argument. If it returns non-zero, then the operation -** should be retried. If it returns zero, the custom VFS should abandon the -** current operation. -** -**
  • [[SQLITE_FCNTL_TEMPFILENAME]] -** ^Application can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control -** to have SQLite generate a -** temporary filename using the same algorithm that is followed to generate -** temporary filenames for TEMP tables and other internal uses. The -** argument should be a char** which will be filled with the filename -** written into memory obtained from [sqlite3_malloc()]. The caller should -** invoke [sqlite3_free()] on the result to avoid a memory leak. -** -**
  • [[SQLITE_FCNTL_MMAP_SIZE]] -** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the -** maximum number of bytes that will be used for memory-mapped I/O. -** The argument is a pointer to a value of type sqlite3_int64 that -** is an advisory maximum number of bytes in the file to memory map. The -** pointer is overwritten with the old value. The limit is not changed if -** the value originally pointed to is negative, and so the current limit -** can be queried by passing in a pointer to a negative number. This -** file-control is used internally to implement [PRAGMA mmap_size]. -** -**
  • [[SQLITE_FCNTL_TRACE]] -** The [SQLITE_FCNTL_TRACE] file control provides advisory information -** to the VFS about what the higher layers of the SQLite stack are doing. -** This file control is used by some VFS activity tracing [shims]. -** The argument is a zero-terminated string. Higher layers in the -** SQLite stack may generate instances of this file control if -** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled. -** -**
  • [[SQLITE_FCNTL_HAS_MOVED]] -** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a -** pointer to an integer and it writes a boolean into that integer depending -** on whether or not the file has been renamed, moved, or deleted since it -** was first opened. -** -**
-*/ -#define SQLITE_FCNTL_LOCKSTATE 1 -#define SQLITE_GET_LOCKPROXYFILE 2 -#define SQLITE_SET_LOCKPROXYFILE 3 -#define SQLITE_LAST_ERRNO 4 -#define SQLITE_FCNTL_SIZE_HINT 5 -#define SQLITE_FCNTL_CHUNK_SIZE 6 -#define SQLITE_FCNTL_FILE_POINTER 7 -#define SQLITE_FCNTL_SYNC_OMITTED 8 -#define SQLITE_FCNTL_WIN32_AV_RETRY 9 -#define SQLITE_FCNTL_PERSIST_WAL 10 -#define SQLITE_FCNTL_OVERWRITE 11 -#define SQLITE_FCNTL_VFSNAME 12 -#define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13 -#define SQLITE_FCNTL_PRAGMA 14 -#define SQLITE_FCNTL_BUSYHANDLER 15 -#define SQLITE_FCNTL_TEMPFILENAME 16 -#define SQLITE_FCNTL_MMAP_SIZE 18 -#define SQLITE_FCNTL_TRACE 19 -#define SQLITE_FCNTL_HAS_MOVED 20 -#define SQLITE_FCNTL_SYNC 21 -#define SQLITE_FCNTL_COMMIT_PHASETWO 22 - -/* -** CAPI3REF: Mutex Handle -** -** The mutex module within SQLite defines [sqlite3_mutex] to be an -** abstract type for a mutex object. The SQLite core never looks -** at the internal representation of an [sqlite3_mutex]. It only -** deals with pointers to the [sqlite3_mutex] object. -** -** Mutexes are created using [sqlite3_mutex_alloc()]. -*/ -typedef struct sqlite3_mutex sqlite3_mutex; - -/* -** CAPI3REF: OS Interface Object -** -** An instance of the sqlite3_vfs object defines the interface between -** the SQLite core and the underlying operating system. The "vfs" -** in the name of the object stands for "virtual file system". See -** the [VFS | VFS documentation] for further information. -** -** The value of the iVersion field is initially 1 but may be larger in -** future versions of SQLite. Additional fields may be appended to this -** object when the iVersion value is increased. Note that the structure -** of the sqlite3_vfs object changes in the transaction between -** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not -** modified. -** -** The szOsFile field is the size of the subclassed [sqlite3_file] -** structure used by this VFS. mxPathname is the maximum length of -** a pathname in this VFS. -** -** Registered sqlite3_vfs objects are kept on a linked list formed by -** the pNext pointer. The [sqlite3_vfs_register()] -** and [sqlite3_vfs_unregister()] interfaces manage this list -** in a thread-safe way. The [sqlite3_vfs_find()] interface -** searches the list. Neither the application code nor the VFS -** implementation should use the pNext pointer. -** -** The pNext field is the only field in the sqlite3_vfs -** structure that SQLite will ever modify. SQLite will only access -** or modify this field while holding a particular static mutex. -** The application should never modify anything within the sqlite3_vfs -** object once the object has been registered. -** -** The zName field holds the name of the VFS module. The name must -** be unique across all VFS modules. -** -** [[sqlite3_vfs.xOpen]] -** ^SQLite guarantees that the zFilename parameter to xOpen -** is either a NULL pointer or string obtained -** from xFullPathname() with an optional suffix added. -** ^If a suffix is added to the zFilename parameter, it will -** consist of a single "-" character followed by no more than -** 11 alphanumeric and/or "-" characters. -** ^SQLite further guarantees that -** the string will be valid and unchanged until xClose() is -** called. Because of the previous sentence, -** the [sqlite3_file] can safely store a pointer to the -** filename if it needs to remember the filename for some reason. -** If the zFilename parameter to xOpen is a NULL pointer then xOpen -** must invent its own temporary name for the file. ^Whenever the -** xFilename parameter is NULL it will also be the case that the -** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. -** -** The flags argument to xOpen() includes all bits set in -** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] -** or [sqlite3_open16()] is used, then flags includes at least -** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. -** If xOpen() opens a file read-only then it sets *pOutFlags to -** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. -** -** ^(SQLite will also add one of the following flags to the xOpen() -** call, depending on the object being opened: -** -**
    -**
  • [SQLITE_OPEN_MAIN_DB] -**
  • [SQLITE_OPEN_MAIN_JOURNAL] -**
  • [SQLITE_OPEN_TEMP_DB] -**
  • [SQLITE_OPEN_TEMP_JOURNAL] -**
  • [SQLITE_OPEN_TRANSIENT_DB] -**
  • [SQLITE_OPEN_SUBJOURNAL] -**
  • [SQLITE_OPEN_MASTER_JOURNAL] -**
  • [SQLITE_OPEN_WAL] -**
)^ -** -** The file I/O implementation can use the object type flags to -** change the way it deals with files. For example, an application -** that does not care about crash recovery or rollback might make -** the open of a journal file a no-op. Writes to this journal would -** also be no-ops, and any attempt to read the journal would return -** SQLITE_IOERR. Or the implementation might recognize that a database -** file will be doing page-aligned sector reads and writes in a random -** order and set up its I/O subsystem accordingly. -** -** SQLite might also add one of the following flags to the xOpen method: -** -**
    -**
  • [SQLITE_OPEN_DELETEONCLOSE] -**
  • [SQLITE_OPEN_EXCLUSIVE] -**
-** -** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be -** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] -** will be set for TEMP databases and their journals, transient -** databases, and subjournals. -** -** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction -** with the [SQLITE_OPEN_CREATE] flag, which are both directly -** analogous to the O_EXCL and O_CREAT flags of the POSIX open() -** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the -** SQLITE_OPEN_CREATE, is used to indicate that file should always -** be created, and that it is an error if it already exists. -** It is not used to indicate the file should be opened -** for exclusive access. -** -** ^At least szOsFile bytes of memory are allocated by SQLite -** to hold the [sqlite3_file] structure passed as the third -** argument to xOpen. The xOpen method does not have to -** allocate the structure; it should just fill it in. Note that -** the xOpen method must set the sqlite3_file.pMethods to either -** a valid [sqlite3_io_methods] object or to NULL. xOpen must do -** this even if the open fails. SQLite expects that the sqlite3_file.pMethods -** element will be valid after xOpen returns regardless of the success -** or failure of the xOpen call. -** -** [[sqlite3_vfs.xAccess]] -** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] -** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to -** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] -** to test whether a file is at least readable. The file can be a -** directory. -** -** ^SQLite will always allocate at least mxPathname+1 bytes for the -** output buffer xFullPathname. The exact size of the output buffer -** is also passed as a parameter to both methods. If the output buffer -** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is -** handled as a fatal error by SQLite, vfs implementations should endeavor -** to prevent this by setting mxPathname to a sufficiently large value. -** -** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() -** interfaces are not strictly a part of the filesystem, but they are -** included in the VFS structure for completeness. -** The xRandomness() function attempts to return nBytes bytes -** of good-quality randomness into zOut. The return value is -** the actual number of bytes of randomness obtained. -** The xSleep() method causes the calling thread to sleep for at -** least the number of microseconds given. ^The xCurrentTime() -** method returns a Julian Day Number for the current date and time as -** a floating point value. -** ^The xCurrentTimeInt64() method returns, as an integer, the Julian -** Day Number multiplied by 86400000 (the number of milliseconds in -** a 24-hour day). -** ^SQLite will use the xCurrentTimeInt64() method to get the current -** date and time if that method is available (if iVersion is 2 or -** greater and the function pointer is not NULL) and will fall back -** to xCurrentTime() if xCurrentTimeInt64() is unavailable. -** -** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces -** are not used by the SQLite core. These optional interfaces are provided -** by some VFSes to facilitate testing of the VFS code. By overriding -** system calls with functions under its control, a test program can -** simulate faults and error conditions that would otherwise be difficult -** or impossible to induce. The set of system calls that can be overridden -** varies from one VFS to another, and from one version of the same VFS to the -** next. Applications that use these interfaces must be prepared for any -** or all of these interfaces to be NULL or for their behavior to change -** from one release to the next. Applications must not attempt to access -** any of these methods if the iVersion of the VFS is less than 3. -*/ -typedef struct sqlite3_vfs sqlite3_vfs; -typedef void (*sqlite3_syscall_ptr)(void); -struct sqlite3_vfs { - int iVersion; /* Structure version number (currently 3) */ - int szOsFile; /* Size of subclassed sqlite3_file */ - int mxPathname; /* Maximum file pathname length */ - sqlite3_vfs *pNext; /* Next registered VFS */ - const char *zName; /* Name of this virtual file system */ - void *pAppData; /* Pointer to application-specific data */ - int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, - int flags, int *pOutFlags); - int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); - int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); - int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); - void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); - void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); - void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); - void (*xDlClose)(sqlite3_vfs*, void*); - int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); - int (*xSleep)(sqlite3_vfs*, int microseconds); - int (*xCurrentTime)(sqlite3_vfs*, double*); - int (*xGetLastError)(sqlite3_vfs*, int, char *); - /* - ** The methods above are in version 1 of the sqlite_vfs object - ** definition. Those that follow are added in version 2 or later - */ - int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); - /* - ** The methods above are in versions 1 and 2 of the sqlite_vfs object. - ** Those below are for version 3 and greater. - */ - int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr); - sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName); - const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName); - /* - ** The methods above are in versions 1 through 3 of the sqlite_vfs object. - ** New fields may be appended in figure versions. The iVersion - ** value will increment whenever this happens. - */ -}; - -/* -** CAPI3REF: Flags for the xAccess VFS method -** -** These integer constants can be used as the third parameter to -** the xAccess method of an [sqlite3_vfs] object. They determine -** what kind of permissions the xAccess method is looking for. -** With SQLITE_ACCESS_EXISTS, the xAccess method -** simply checks whether the file exists. -** With SQLITE_ACCESS_READWRITE, the xAccess method -** checks whether the named directory is both readable and writable -** (in other words, if files can be added, removed, and renamed within -** the directory). -** The SQLITE_ACCESS_READWRITE constant is currently used only by the -** [temp_store_directory pragma], though this could change in a future -** release of SQLite. -** With SQLITE_ACCESS_READ, the xAccess method -** checks whether the file is readable. The SQLITE_ACCESS_READ constant is -** currently unused, though it might be used in a future release of -** SQLite. -*/ -#define SQLITE_ACCESS_EXISTS 0 -#define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */ -#define SQLITE_ACCESS_READ 2 /* Unused */ - -/* -** CAPI3REF: Flags for the xShmLock VFS method -** -** These integer constants define the various locking operations -** allowed by the xShmLock method of [sqlite3_io_methods]. The -** following are the only legal combinations of flags to the -** xShmLock method: -** -**
    -**
  • SQLITE_SHM_LOCK | SQLITE_SHM_SHARED -**
  • SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE -**
  • SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED -**
  • SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE -**
-** -** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as -** was given no the corresponding lock. -** -** The xShmLock method can transition between unlocked and SHARED or -** between unlocked and EXCLUSIVE. It cannot transition between SHARED -** and EXCLUSIVE. -*/ -#define SQLITE_SHM_UNLOCK 1 -#define SQLITE_SHM_LOCK 2 -#define SQLITE_SHM_SHARED 4 -#define SQLITE_SHM_EXCLUSIVE 8 - -/* -** CAPI3REF: Maximum xShmLock index -** -** The xShmLock method on [sqlite3_io_methods] may use values -** between 0 and this upper bound as its "offset" argument. -** The SQLite core will never attempt to acquire or release a -** lock outside of this range -*/ -#define SQLITE_SHM_NLOCK 8 - - -/* -** CAPI3REF: Initialize The SQLite Library -** -** ^The sqlite3_initialize() routine initializes the -** SQLite library. ^The sqlite3_shutdown() routine -** deallocates any resources that were allocated by sqlite3_initialize(). -** These routines are designed to aid in process initialization and -** shutdown on embedded systems. Workstation applications using -** SQLite normally do not need to invoke either of these routines. -** -** A call to sqlite3_initialize() is an "effective" call if it is -** the first time sqlite3_initialize() is invoked during the lifetime of -** the process, or if it is the first time sqlite3_initialize() is invoked -** following a call to sqlite3_shutdown(). ^(Only an effective call -** of sqlite3_initialize() does any initialization. All other calls -** are harmless no-ops.)^ -** -** A call to sqlite3_shutdown() is an "effective" call if it is the first -** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only -** an effective call to sqlite3_shutdown() does any deinitialization. -** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ -** -** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() -** is not. The sqlite3_shutdown() interface must only be called from a -** single thread. All open [database connections] must be closed and all -** other SQLite resources must be deallocated prior to invoking -** sqlite3_shutdown(). -** -** Among other things, ^sqlite3_initialize() will invoke -** sqlite3_os_init(). Similarly, ^sqlite3_shutdown() -** will invoke sqlite3_os_end(). -** -** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. -** ^If for some reason, sqlite3_initialize() is unable to initialize -** the library (perhaps it is unable to allocate a needed resource such -** as a mutex) it returns an [error code] other than [SQLITE_OK]. -** -** ^The sqlite3_initialize() routine is called internally by many other -** SQLite interfaces so that an application usually does not need to -** invoke sqlite3_initialize() directly. For example, [sqlite3_open()] -** calls sqlite3_initialize() so the SQLite library will be automatically -** initialized when [sqlite3_open()] is called if it has not be initialized -** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] -** compile-time option, then the automatic calls to sqlite3_initialize() -** are omitted and the application must call sqlite3_initialize() directly -** prior to using any other SQLite interface. For maximum portability, -** it is recommended that applications always invoke sqlite3_initialize() -** directly prior to using any other SQLite interface. Future releases -** of SQLite may require this. In other words, the behavior exhibited -** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the -** default behavior in some future release of SQLite. -** -** The sqlite3_os_init() routine does operating-system specific -** initialization of the SQLite library. The sqlite3_os_end() -** routine undoes the effect of sqlite3_os_init(). Typical tasks -** performed by these routines include allocation or deallocation -** of static resources, initialization of global variables, -** setting up a default [sqlite3_vfs] module, or setting up -** a default configuration using [sqlite3_config()]. -** -** The application should never invoke either sqlite3_os_init() -** or sqlite3_os_end() directly. The application should only invoke -** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() -** interface is called automatically by sqlite3_initialize() and -** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate -** implementations for sqlite3_os_init() and sqlite3_os_end() -** are built into SQLite when it is compiled for Unix, Windows, or OS/2. -** When [custom builds | built for other platforms] -** (using the [SQLITE_OS_OTHER=1] compile-time -** option) the application must supply a suitable implementation for -** sqlite3_os_init() and sqlite3_os_end(). An application-supplied -** implementation of sqlite3_os_init() or sqlite3_os_end() -** must return [SQLITE_OK] on success and some other [error code] upon -** failure. -*/ -SQLITE_API int sqlite3_initialize(void); -SQLITE_API int sqlite3_shutdown(void); -SQLITE_API int sqlite3_os_init(void); -SQLITE_API int sqlite3_os_end(void); - -/* -** CAPI3REF: Configuring The SQLite Library -** -** The sqlite3_config() interface is used to make global configuration -** changes to SQLite in order to tune SQLite to the specific needs of -** the application. The default configuration is recommended for most -** applications and so this routine is usually not necessary. It is -** provided to support rare applications with unusual needs. -** -** The sqlite3_config() interface is not threadsafe. The application -** must insure that no other SQLite interfaces are invoked by other -** threads while sqlite3_config() is running. Furthermore, sqlite3_config() -** may only be invoked prior to library initialization using -** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. -** ^If sqlite3_config() is called after [sqlite3_initialize()] and before -** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. -** Note, however, that ^sqlite3_config() can be called as part of the -** implementation of an application-defined [sqlite3_os_init()]. -** -** The first argument to sqlite3_config() is an integer -** [configuration option] that determines -** what property of SQLite is to be configured. Subsequent arguments -** vary depending on the [configuration option] -** in the first argument. -** -** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. -** ^If the option is unknown or SQLite is unable to set the option -** then this routine returns a non-zero [error code]. -*/ -SQLITE_API int sqlite3_config(int, ...); - -/* -** CAPI3REF: Configure database connections -** -** The sqlite3_db_config() interface is used to make configuration -** changes to a [database connection]. The interface is similar to -** [sqlite3_config()] except that the changes apply to a single -** [database connection] (specified in the first argument). -** -** The second argument to sqlite3_db_config(D,V,...) is the -** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code -** that indicates what aspect of the [database connection] is being configured. -** Subsequent arguments vary depending on the configuration verb. -** -** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if -** the call is considered successful. -*/ -SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); - -/* -** CAPI3REF: Memory Allocation Routines -** -** An instance of this object defines the interface between SQLite -** and low-level memory allocation routines. -** -** This object is used in only one place in the SQLite interface. -** A pointer to an instance of this object is the argument to -** [sqlite3_config()] when the configuration option is -** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. -** By creating an instance of this object -** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) -** during configuration, an application can specify an alternative -** memory allocation subsystem for SQLite to use for all of its -** dynamic memory needs. -** -** Note that SQLite comes with several [built-in memory allocators] -** that are perfectly adequate for the overwhelming majority of applications -** and that this object is only useful to a tiny minority of applications -** with specialized memory allocation requirements. This object is -** also used during testing of SQLite in order to specify an alternative -** memory allocator that simulates memory out-of-memory conditions in -** order to verify that SQLite recovers gracefully from such -** conditions. -** -** The xMalloc, xRealloc, and xFree methods must work like the -** malloc(), realloc() and free() functions from the standard C library. -** ^SQLite guarantees that the second argument to -** xRealloc is always a value returned by a prior call to xRoundup. -** -** xSize should return the allocated size of a memory allocation -** previously obtained from xMalloc or xRealloc. The allocated size -** is always at least as big as the requested size but may be larger. -** -** The xRoundup method returns what would be the allocated size of -** a memory allocation given a particular requested size. Most memory -** allocators round up memory allocations at least to the next multiple -** of 8. Some allocators round up to a larger multiple or to a power of 2. -** Every memory allocation request coming in through [sqlite3_malloc()] -** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, -** that causes the corresponding memory allocation to fail. -** -** The xInit method initializes the memory allocator. For example, -** it might allocate any require mutexes or initialize internal data -** structures. The xShutdown method is invoked (indirectly) by -** [sqlite3_shutdown()] and should deallocate any resources acquired -** by xInit. The pAppData pointer is used as the only parameter to -** xInit and xShutdown. -** -** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes -** the xInit method, so the xInit method need not be threadsafe. The -** xShutdown method is only called from [sqlite3_shutdown()] so it does -** not need to be threadsafe either. For all other methods, SQLite -** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the -** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which -** it is by default) and so the methods are automatically serialized. -** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other -** methods must be threadsafe or else make their own arrangements for -** serialization. -** -** SQLite will never invoke xInit() more than once without an intervening -** call to xShutdown(). -*/ -typedef struct sqlite3_mem_methods sqlite3_mem_methods; -struct sqlite3_mem_methods { - void *(*xMalloc)(int); /* Memory allocation function */ - void (*xFree)(void*); /* Free a prior allocation */ - void *(*xRealloc)(void*,int); /* Resize an allocation */ - int (*xSize)(void*); /* Return the size of an allocation */ - int (*xRoundup)(int); /* Round up request size to allocation size */ - int (*xInit)(void*); /* Initialize the memory allocator */ - void (*xShutdown)(void*); /* Deinitialize the memory allocator */ - void *pAppData; /* Argument to xInit() and xShutdown() */ -}; - -/* -** CAPI3REF: Configuration Options -** KEYWORDS: {configuration option} -** -** These constants are the available integer configuration options that -** can be passed as the first argument to the [sqlite3_config()] interface. -** -** New configuration options may be added in future releases of SQLite. -** Existing configuration options might be discontinued. Applications -** should check the return code from [sqlite3_config()] to make sure that -** the call worked. The [sqlite3_config()] interface will return a -** non-zero [error code] if a discontinued or unsupported configuration option -** is invoked. -** -**
-** [[SQLITE_CONFIG_SINGLETHREAD]]
SQLITE_CONFIG_SINGLETHREAD
-**
There are no arguments to this option. ^This option sets the -** [threading mode] to Single-thread. In other words, it disables -** all mutexing and puts SQLite into a mode where it can only be used -** by a single thread. ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** it is not possible to change the [threading mode] from its default -** value of Single-thread and so [sqlite3_config()] will return -** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD -** configuration option.
-** -** [[SQLITE_CONFIG_MULTITHREAD]]
SQLITE_CONFIG_MULTITHREAD
-**
There are no arguments to this option. ^This option sets the -** [threading mode] to Multi-thread. In other words, it disables -** mutexing on [database connection] and [prepared statement] objects. -** The application is responsible for serializing access to -** [database connections] and [prepared statements]. But other mutexes -** are enabled so that SQLite will be safe to use in a multi-threaded -** environment as long as no two threads attempt to use the same -** [database connection] at the same time. ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** it is not possible to set the Multi-thread [threading mode] and -** [sqlite3_config()] will return [SQLITE_ERROR] if called with the -** SQLITE_CONFIG_MULTITHREAD configuration option.
-** -** [[SQLITE_CONFIG_SERIALIZED]]
SQLITE_CONFIG_SERIALIZED
-**
There are no arguments to this option. ^This option sets the -** [threading mode] to Serialized. In other words, this option enables -** all mutexes including the recursive -** mutexes on [database connection] and [prepared statement] objects. -** In this mode (which is the default when SQLite is compiled with -** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access -** to [database connections] and [prepared statements] so that the -** application is free to use the same [database connection] or the -** same [prepared statement] in different threads at the same time. -** ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** it is not possible to set the Serialized [threading mode] and -** [sqlite3_config()] will return [SQLITE_ERROR] if called with the -** SQLITE_CONFIG_SERIALIZED configuration option.
-** -** [[SQLITE_CONFIG_MALLOC]]
SQLITE_CONFIG_MALLOC
-**
^(This option takes a single argument which is a pointer to an -** instance of the [sqlite3_mem_methods] structure. The argument specifies -** alternative low-level memory allocation routines to be used in place of -** the memory allocation routines built into SQLite.)^ ^SQLite makes -** its own private copy of the content of the [sqlite3_mem_methods] structure -** before the [sqlite3_config()] call returns.
-** -** [[SQLITE_CONFIG_GETMALLOC]]
SQLITE_CONFIG_GETMALLOC
-**
^(This option takes a single argument which is a pointer to an -** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods] -** structure is filled with the currently defined memory allocation routines.)^ -** This option can be used to overload the default memory allocation -** routines with a wrapper that simulations memory allocation failure or -** tracks memory usage, for example.
-** -** [[SQLITE_CONFIG_MEMSTATUS]]
SQLITE_CONFIG_MEMSTATUS
-**
^This option takes single argument of type int, interpreted as a -** boolean, which enables or disables the collection of memory allocation -** statistics. ^(When memory allocation statistics are disabled, the -** following SQLite interfaces become non-operational: -**
    -**
  • [sqlite3_memory_used()] -**
  • [sqlite3_memory_highwater()] -**
  • [sqlite3_soft_heap_limit64()] -**
  • [sqlite3_status()] -**
)^ -** ^Memory allocation statistics are enabled by default unless SQLite is -** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory -** allocation statistics are disabled by default. -**
-** -** [[SQLITE_CONFIG_SCRATCH]]
SQLITE_CONFIG_SCRATCH
-**
^This option specifies a static memory buffer that SQLite can use for -** scratch memory. There are three arguments: A pointer an 8-byte -** aligned memory buffer from which the scratch allocations will be -** drawn, the size of each scratch allocation (sz), -** and the maximum number of scratch allocations (N). The sz -** argument must be a multiple of 16. -** The first argument must be a pointer to an 8-byte aligned buffer -** of at least sz*N bytes of memory. -** ^SQLite will use no more than two scratch buffers per thread. So -** N should be set to twice the expected maximum number of threads. -** ^SQLite will never require a scratch buffer that is more than 6 -** times the database page size. ^If SQLite needs needs additional -** scratch memory beyond what is provided by this configuration option, then -** [sqlite3_malloc()] will be used to obtain the memory needed.
-** -** [[SQLITE_CONFIG_PAGECACHE]]
SQLITE_CONFIG_PAGECACHE
-**
^This option specifies a static memory buffer that SQLite can use for -** the database page cache with the default page cache implementation. -** This configuration should not be used if an application-define page -** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option. -** There are three arguments to this option: A pointer to 8-byte aligned -** memory, the size of each page buffer (sz), and the number of pages (N). -** The sz argument should be the size of the largest database page -** (a power of two between 512 and 32768) plus a little extra for each -** page header. ^The page header size is 20 to 40 bytes depending on -** the host architecture. ^It is harmless, apart from the wasted memory, -** to make sz a little too large. The first -** argument should point to an allocation of at least sz*N bytes of memory. -** ^SQLite will use the memory provided by the first argument to satisfy its -** memory needs for the first N pages that it adds to cache. ^If additional -** page cache memory is needed beyond what is provided by this option, then -** SQLite goes to [sqlite3_malloc()] for the additional storage space. -** The pointer in the first argument must -** be aligned to an 8-byte boundary or subsequent behavior of SQLite -** will be undefined.
-** -** [[SQLITE_CONFIG_HEAP]]
SQLITE_CONFIG_HEAP
-**
^This option specifies a static memory buffer that SQLite will use -** for all of its dynamic memory allocation needs beyond those provided -** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE]. -** There are three arguments: An 8-byte aligned pointer to the memory, -** the number of bytes in the memory buffer, and the minimum allocation size. -** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts -** to using its default memory allocator (the system malloc() implementation), -** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the -** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or -** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory -** allocator is engaged to handle all of SQLites memory allocation needs. -** The first pointer (the memory pointer) must be aligned to an 8-byte -** boundary or subsequent behavior of SQLite will be undefined. -** The minimum allocation size is capped at 2**12. Reasonable values -** for the minimum allocation size are 2**5 through 2**8.
-** -** [[SQLITE_CONFIG_MUTEX]]
SQLITE_CONFIG_MUTEX
-**
^(This option takes a single argument which is a pointer to an -** instance of the [sqlite3_mutex_methods] structure. The argument specifies -** alternative low-level mutex routines to be used in place -** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the -** content of the [sqlite3_mutex_methods] structure before the call to -** [sqlite3_config()] returns. ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** the entire mutexing subsystem is omitted from the build and hence calls to -** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will -** return [SQLITE_ERROR].
-** -** [[SQLITE_CONFIG_GETMUTEX]]
SQLITE_CONFIG_GETMUTEX
-**
^(This option takes a single argument which is a pointer to an -** instance of the [sqlite3_mutex_methods] structure. The -** [sqlite3_mutex_methods] -** structure is filled with the currently defined mutex routines.)^ -** This option can be used to overload the default mutex allocation -** routines with a wrapper used to track mutex usage for performance -** profiling or testing, for example. ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** the entire mutexing subsystem is omitted from the build and hence calls to -** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will -** return [SQLITE_ERROR].
-** -** [[SQLITE_CONFIG_LOOKASIDE]]
SQLITE_CONFIG_LOOKASIDE
-**
^(This option takes two arguments that determine the default -** memory allocation for the lookaside memory allocator on each -** [database connection]. The first argument is the -** size of each lookaside buffer slot and the second is the number of -** slots allocated to each database connection.)^ ^(This option sets the -** default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] -** verb to [sqlite3_db_config()] can be used to change the lookaside -** configuration on individual connections.)^
-** -** [[SQLITE_CONFIG_PCACHE2]]
SQLITE_CONFIG_PCACHE2
-**
^(This option takes a single argument which is a pointer to -** an [sqlite3_pcache_methods2] object. This object specifies the interface -** to a custom page cache implementation.)^ ^SQLite makes a copy of the -** object and uses it for page cache memory allocations.
-** -** [[SQLITE_CONFIG_GETPCACHE2]]
SQLITE_CONFIG_GETPCACHE2
-**
^(This option takes a single argument which is a pointer to an -** [sqlite3_pcache_methods2] object. SQLite copies of the current -** page cache implementation into that object.)^
-** -** [[SQLITE_CONFIG_LOG]]
SQLITE_CONFIG_LOG
-**
The SQLITE_CONFIG_LOG option is used to configure the SQLite -** global [error log]. -** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a -** function with a call signature of void(*)(void*,int,const char*), -** and a pointer to void. ^If the function pointer is not NULL, it is -** invoked by [sqlite3_log()] to process each logging event. ^If the -** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op. -** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is -** passed through as the first parameter to the application-defined logger -** function whenever that function is invoked. ^The second parameter to -** the logger function is a copy of the first parameter to the corresponding -** [sqlite3_log()] call and is intended to be a [result code] or an -** [extended result code]. ^The third parameter passed to the logger is -** log message after formatting via [sqlite3_snprintf()]. -** The SQLite logging interface is not reentrant; the logger function -** supplied by the application must not invoke any SQLite interface. -** In a multi-threaded application, the application-defined logger -** function must be threadsafe.
-** -** [[SQLITE_CONFIG_URI]]
SQLITE_CONFIG_URI -**
^(This option takes a single argument of type int. If non-zero, then -** URI handling is globally enabled. If the parameter is zero, then URI handling -** is globally disabled.)^ ^If URI handling is globally enabled, all filenames -** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or -** specified as part of [ATTACH] commands are interpreted as URIs, regardless -** of whether or not the [SQLITE_OPEN_URI] flag is set when the database -** connection is opened. ^If it is globally disabled, filenames are -** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the -** database connection is opened. ^(By default, URI handling is globally -** disabled. The default value may be changed by compiling with the -** [SQLITE_USE_URI] symbol defined.)^ -** -** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]]
SQLITE_CONFIG_COVERING_INDEX_SCAN -**
^This option takes a single integer argument which is interpreted as -** a boolean in order to enable or disable the use of covering indices for -** full table scans in the query optimizer. ^The default setting is determined -** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" -** if that compile-time option is omitted. -** The ability to disable the use of covering indices for full table scans -** is because some incorrectly coded legacy applications might malfunction -** when the optimization is enabled. Providing the ability to -** disable the optimization allows the older, buggy application code to work -** without change even with newer versions of SQLite. -** -** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] -**
SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE -**
These options are obsolete and should not be used by new code. -** They are retained for backwards compatibility but are now no-ops. -**
-** -** [[SQLITE_CONFIG_SQLLOG]] -**
SQLITE_CONFIG_SQLLOG -**
This option is only available if sqlite is compiled with the -** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should -** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int). -** The second should be of type (void*). The callback is invoked by the library -** in three separate circumstances, identified by the value passed as the -** fourth parameter. If the fourth parameter is 0, then the database connection -** passed as the second argument has just been opened. The third argument -** points to a buffer containing the name of the main database file. If the -** fourth parameter is 1, then the SQL statement that the third parameter -** points to has just been executed. Or, if the fourth parameter is 2, then -** the connection being passed as the second parameter is being closed. The -** third parameter is passed NULL In this case. An example of using this -** configuration option can be seen in the "test_sqllog.c" source file in -** the canonical SQLite source tree.
-** -** [[SQLITE_CONFIG_MMAP_SIZE]] -**
SQLITE_CONFIG_MMAP_SIZE -**
^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values -** that are the default mmap size limit (the default setting for -** [PRAGMA mmap_size]) and the maximum allowed mmap size limit. -** ^The default setting can be overridden by each database connection using -** either the [PRAGMA mmap_size] command, or by using the -** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size -** cannot be changed at run-time. Nor may the maximum allowed mmap size -** exceed the compile-time maximum mmap size set by the -** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^ -** ^If either argument to this option is negative, then that argument is -** changed to its compile-time default. -** -** [[SQLITE_CONFIG_WIN32_HEAPSIZE]] -**
SQLITE_CONFIG_WIN32_HEAPSIZE -**
^This option is only available if SQLite is compiled for Windows -** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined. -** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value -** that specifies the maximum size of the created heap. -**
-*/ -#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ -#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ -#define SQLITE_CONFIG_SERIALIZED 3 /* nil */ -#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ -#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ -#define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ -#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ -#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ -#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ -#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ -#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ -/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ -#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ -#define SQLITE_CONFIG_PCACHE 14 /* no-op */ -#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ -#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ -#define SQLITE_CONFIG_URI 17 /* int */ -#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ -#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ -#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ -#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ -#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ -#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ - -/* -** CAPI3REF: Database Connection Configuration Options -** -** These constants are the available integer configuration options that -** can be passed as the second argument to the [sqlite3_db_config()] interface. -** -** New configuration options may be added in future releases of SQLite. -** Existing configuration options might be discontinued. Applications -** should check the return code from [sqlite3_db_config()] to make sure that -** the call worked. ^The [sqlite3_db_config()] interface will return a -** non-zero [error code] if a discontinued or unsupported configuration option -** is invoked. -** -**
-**
SQLITE_DBCONFIG_LOOKASIDE
-**
^This option takes three additional arguments that determine the -** [lookaside memory allocator] configuration for the [database connection]. -** ^The first argument (the third parameter to [sqlite3_db_config()] is a -** pointer to a memory buffer to use for lookaside memory. -** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb -** may be NULL in which case SQLite will allocate the -** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the -** size of each lookaside buffer slot. ^The third argument is the number of -** slots. The size of the buffer in the first argument must be greater than -** or equal to the product of the second and third arguments. The buffer -** must be aligned to an 8-byte boundary. ^If the second argument to -** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally -** rounded down to the next smaller multiple of 8. ^(The lookaside memory -** configuration for a database connection can only be changed when that -** connection is not currently using lookaside memory, or in other words -** when the "current value" returned by -** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. -** Any attempt to change the lookaside memory configuration when lookaside -** memory is in use leaves the configuration unchanged and returns -** [SQLITE_BUSY].)^
-** -**
SQLITE_DBCONFIG_ENABLE_FKEY
-**
^This option is used to enable or disable the enforcement of -** [foreign key constraints]. There should be two additional arguments. -** The first argument is an integer which is 0 to disable FK enforcement, -** positive to enable FK enforcement or negative to leave FK enforcement -** unchanged. The second parameter is a pointer to an integer into which -** is written 0 or 1 to indicate whether FK enforcement is off or on -** following this call. The second parameter may be a NULL pointer, in -** which case the FK enforcement setting is not reported back.
-** -**
SQLITE_DBCONFIG_ENABLE_TRIGGER
-**
^This option is used to enable or disable [CREATE TRIGGER | triggers]. -** There should be two additional arguments. -** The first argument is an integer which is 0 to disable triggers, -** positive to enable triggers or negative to leave the setting unchanged. -** The second parameter is a pointer to an integer into which -** is written 0 or 1 to indicate whether triggers are disabled or enabled -** following this call. The second parameter may be a NULL pointer, in -** which case the trigger setting is not reported back.
-** -**
-*/ -#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ -#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ -#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ - - -/* -** CAPI3REF: Enable Or Disable Extended Result Codes -** -** ^The sqlite3_extended_result_codes() routine enables or disables the -** [extended result codes] feature of SQLite. ^The extended result -** codes are disabled by default for historical compatibility. -*/ -SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); - -/* -** CAPI3REF: Last Insert Rowid -** -** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables) -** has a unique 64-bit signed -** integer key called the [ROWID | "rowid"]. ^The rowid is always available -** as an undeclared column named ROWID, OID, or _ROWID_ as long as those -** names are not also used by explicitly declared columns. ^If -** the table has a column of type [INTEGER PRIMARY KEY] then that column -** is another alias for the rowid. -** -** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the -** most recent successful [INSERT] into a rowid table or [virtual table] -** on database connection D. -** ^Inserts into [WITHOUT ROWID] tables are not recorded. -** ^If no successful [INSERT]s into rowid tables -** have ever occurred on the database connection D, -** then sqlite3_last_insert_rowid(D) returns zero. -** -** ^(If an [INSERT] occurs within a trigger or within a [virtual table] -** method, then this routine will return the [rowid] of the inserted -** row as long as the trigger or virtual table method is running. -** But once the trigger or virtual table method ends, the value returned -** by this routine reverts to what it was before the trigger or virtual -** table method began.)^ -** -** ^An [INSERT] that fails due to a constraint violation is not a -** successful [INSERT] and does not change the value returned by this -** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, -** and INSERT OR ABORT make no changes to the return value of this -** routine when their insertion fails. ^(When INSERT OR REPLACE -** encounters a constraint violation, it does not fail. The -** INSERT continues to completion after deleting rows that caused -** the constraint problem so INSERT OR REPLACE will always change -** the return value of this interface.)^ -** -** ^For the purposes of this routine, an [INSERT] is considered to -** be successful even if it is subsequently rolled back. -** -** This function is accessible to SQL statements via the -** [last_insert_rowid() SQL function]. -** -** If a separate thread performs a new [INSERT] on the same -** database connection while the [sqlite3_last_insert_rowid()] -** function is running and thus changes the last insert [rowid], -** then the value returned by [sqlite3_last_insert_rowid()] is -** unpredictable and might not equal either the old or the new -** last insert [rowid]. -*/ -SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); - -/* -** CAPI3REF: Count The Number Of Rows Modified -** -** ^This function returns the number of database rows that were changed -** or inserted or deleted by the most recently completed SQL statement -** on the [database connection] specified by the first parameter. -** ^(Only changes that are directly specified by the [INSERT], [UPDATE], -** or [DELETE] statement are counted. Auxiliary changes caused by -** triggers or [foreign key actions] are not counted.)^ Use the -** [sqlite3_total_changes()] function to find the total number of changes -** including changes caused by triggers and foreign key actions. -** -** ^Changes to a view that are simulated by an [INSTEAD OF trigger] -** are not counted. Only real table changes are counted. -** -** ^(A "row change" is a change to a single row of a single table -** caused by an INSERT, DELETE, or UPDATE statement. Rows that -** are changed as side effects of [REPLACE] constraint resolution, -** rollback, ABORT processing, [DROP TABLE], or by any other -** mechanisms do not count as direct row changes.)^ -** -** A "trigger context" is a scope of execution that begins and -** ends with the script of a [CREATE TRIGGER | trigger]. -** Most SQL statements are -** evaluated outside of any trigger. This is the "top level" -** trigger context. If a trigger fires from the top level, a -** new trigger context is entered for the duration of that one -** trigger. Subtriggers create subcontexts for their duration. -** -** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does -** not create a new trigger context. -** -** ^This function returns the number of direct row changes in the -** most recent INSERT, UPDATE, or DELETE statement within the same -** trigger context. -** -** ^Thus, when called from the top level, this function returns the -** number of changes in the most recent INSERT, UPDATE, or DELETE -** that also occurred at the top level. ^(Within the body of a trigger, -** the sqlite3_changes() interface can be called to find the number of -** changes in the most recently completed INSERT, UPDATE, or DELETE -** statement within the body of the same trigger. -** However, the number returned does not include changes -** caused by subtriggers since those have their own context.)^ -** -** See also the [sqlite3_total_changes()] interface, the -** [count_changes pragma], and the [changes() SQL function]. -** -** If a separate thread makes changes on the same database connection -** while [sqlite3_changes()] is running then the value returned -** is unpredictable and not meaningful. -*/ -SQLITE_API int sqlite3_changes(sqlite3*); - -/* -** CAPI3REF: Total Number Of Rows Modified -** -** ^This function returns the number of row changes caused by [INSERT], -** [UPDATE] or [DELETE] statements since the [database connection] was opened. -** ^(The count returned by sqlite3_total_changes() includes all changes -** from all [CREATE TRIGGER | trigger] contexts and changes made by -** [foreign key actions]. However, -** the count does not include changes used to implement [REPLACE] constraints, -** do rollbacks or ABORT processing, or [DROP TABLE] processing. The -** count does not include rows of views that fire an [INSTEAD OF trigger], -** though if the INSTEAD OF trigger makes changes of its own, those changes -** are counted.)^ -** ^The sqlite3_total_changes() function counts the changes as soon as -** the statement that makes them is completed (when the statement handle -** is passed to [sqlite3_reset()] or [sqlite3_finalize()]). -** -** See also the [sqlite3_changes()] interface, the -** [count_changes pragma], and the [total_changes() SQL function]. -** -** If a separate thread makes changes on the same database connection -** while [sqlite3_total_changes()] is running then the value -** returned is unpredictable and not meaningful. -*/ -SQLITE_API int sqlite3_total_changes(sqlite3*); - -/* -** CAPI3REF: Interrupt A Long-Running Query -** -** ^This function causes any pending database operation to abort and -** return at its earliest opportunity. This routine is typically -** called in response to a user action such as pressing "Cancel" -** or Ctrl-C where the user wants a long query operation to halt -** immediately. -** -** ^It is safe to call this routine from a thread different from the -** thread that is currently running the database operation. But it -** is not safe to call this routine with a [database connection] that -** is closed or might close before sqlite3_interrupt() returns. -** -** ^If an SQL operation is very nearly finished at the time when -** sqlite3_interrupt() is called, then it might not have an opportunity -** to be interrupted and might continue to completion. -** -** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. -** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE -** that is inside an explicit transaction, then the entire transaction -** will be rolled back automatically. -** -** ^The sqlite3_interrupt(D) call is in effect until all currently running -** SQL statements on [database connection] D complete. ^Any new SQL statements -** that are started after the sqlite3_interrupt() call and before the -** running statements reaches zero are interrupted as if they had been -** running prior to the sqlite3_interrupt() call. ^New SQL statements -** that are started after the running statement count reaches zero are -** not effected by the sqlite3_interrupt(). -** ^A call to sqlite3_interrupt(D) that occurs when there are no running -** SQL statements is a no-op and has no effect on SQL statements -** that are started after the sqlite3_interrupt() call returns. -** -** If the database connection closes while [sqlite3_interrupt()] -** is running then bad things will likely happen. -*/ -SQLITE_API void sqlite3_interrupt(sqlite3*); - -/* -** CAPI3REF: Determine If An SQL Statement Is Complete -** -** These routines are useful during command-line input to determine if the -** currently entered text seems to form a complete SQL statement or -** if additional input is needed before sending the text into -** SQLite for parsing. ^These routines return 1 if the input string -** appears to be a complete SQL statement. ^A statement is judged to be -** complete if it ends with a semicolon token and is not a prefix of a -** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within -** string literals or quoted identifier names or comments are not -** independent tokens (they are part of the token in which they are -** embedded) and thus do not count as a statement terminator. ^Whitespace -** and comments that follow the final semicolon are ignored. -** -** ^These routines return 0 if the statement is incomplete. ^If a -** memory allocation fails, then SQLITE_NOMEM is returned. -** -** ^These routines do not parse the SQL statements thus -** will not detect syntactically incorrect SQL. -** -** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior -** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked -** automatically by sqlite3_complete16(). If that initialization fails, -** then the return value from sqlite3_complete16() will be non-zero -** regardless of whether or not the input SQL is complete.)^ -** -** The input to [sqlite3_complete()] must be a zero-terminated -** UTF-8 string. -** -** The input to [sqlite3_complete16()] must be a zero-terminated -** UTF-16 string in native byte order. -*/ -SQLITE_API int sqlite3_complete(const char *sql); -SQLITE_API int sqlite3_complete16(const void *sql); - -/* -** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors -** -** ^This routine sets a callback function that might be invoked whenever -** an attempt is made to open a database table that another thread -** or process has locked. -** -** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] -** is returned immediately upon encountering the lock. ^If the busy callback -** is not NULL, then the callback might be invoked with two arguments. -** -** ^The first argument to the busy handler is a copy of the void* pointer which -** is the third argument to sqlite3_busy_handler(). ^The second argument to -** the busy handler callback is the number of times that the busy handler has -** been invoked for this locking event. ^If the -** busy callback returns 0, then no additional attempts are made to -** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned. -** ^If the callback returns non-zero, then another attempt -** is made to open the database for reading and the cycle repeats. -** -** The presence of a busy handler does not guarantee that it will be invoked -** when there is lock contention. ^If SQLite determines that invoking the busy -** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] -** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler. -** Consider a scenario where one process is holding a read lock that -** it is trying to promote to a reserved lock and -** a second process is holding a reserved lock that it is trying -** to promote to an exclusive lock. The first process cannot proceed -** because it is blocked by the second and the second process cannot -** proceed because it is blocked by the first. If both processes -** invoke the busy handlers, neither will make any progress. Therefore, -** SQLite returns [SQLITE_BUSY] for the first process, hoping that this -** will induce the first process to release its read lock and allow -** the second process to proceed. -** -** ^The default busy callback is NULL. -** -** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED] -** when SQLite is in the middle of a large transaction where all the -** changes will not fit into the in-memory cache. SQLite will -** already hold a RESERVED lock on the database file, but it needs -** to promote this lock to EXCLUSIVE so that it can spill cache -** pages into the database file without harm to concurrent -** readers. ^If it is unable to promote the lock, then the in-memory -** cache will be left in an inconsistent state and so the error -** code is promoted from the relatively benign [SQLITE_BUSY] to -** the more severe [SQLITE_IOERR_BLOCKED]. ^This error code promotion -** forces an automatic rollback of the changes. See the -** -** CorruptionFollowingBusyError wiki page for a discussion of why -** this is important. -** -** ^(There can only be a single busy handler defined for each -** [database connection]. Setting a new busy handler clears any -** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] -** will also set or clear the busy handler. -** -** The busy callback should not take any actions which modify the -** database connection that invoked the busy handler. Any such actions -** result in undefined behavior. -** -** A busy handler must not close the database connection -** or [prepared statement] that invoked the busy handler. -*/ -SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); - -/* -** CAPI3REF: Set A Busy Timeout -** -** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps -** for a specified amount of time when a table is locked. ^The handler -** will sleep multiple times until at least "ms" milliseconds of sleeping -** have accumulated. ^After at least "ms" milliseconds of sleeping, -** the handler returns 0 which causes [sqlite3_step()] to return -** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]. -** -** ^Calling this routine with an argument less than or equal to zero -** turns off all busy handlers. -** -** ^(There can only be a single busy handler for a particular -** [database connection] any any given moment. If another busy handler -** was defined (using [sqlite3_busy_handler()]) prior to calling -** this routine, that other busy handler is cleared.)^ -*/ -SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); - -/* -** CAPI3REF: Convenience Routines For Running Queries -** -** This is a legacy interface that is preserved for backwards compatibility. -** Use of this interface is not recommended. -** -** Definition: A result table is memory data structure created by the -** [sqlite3_get_table()] interface. A result table records the -** complete query results from one or more queries. -** -** The table conceptually has a number of rows and columns. But -** these numbers are not part of the result table itself. These -** numbers are obtained separately. Let N be the number of rows -** and M be the number of columns. -** -** A result table is an array of pointers to zero-terminated UTF-8 strings. -** There are (N+1)*M elements in the array. The first M pointers point -** to zero-terminated strings that contain the names of the columns. -** The remaining entries all point to query results. NULL values result -** in NULL pointers. All other values are in their UTF-8 zero-terminated -** string representation as returned by [sqlite3_column_text()]. -** -** A result table might consist of one or more memory allocations. -** It is not safe to pass a result table directly to [sqlite3_free()]. -** A result table should be deallocated using [sqlite3_free_table()]. -** -** ^(As an example of the result table format, suppose a query result -** is as follows: -** -**
-**        Name        | Age
-**        -----------------------
-**        Alice       | 43
-**        Bob         | 28
-**        Cindy       | 21
-** 
-** -** There are two column (M==2) and three rows (N==3). Thus the -** result table has 8 entries. Suppose the result table is stored -** in an array names azResult. Then azResult holds this content: -** -**
-**        azResult[0] = "Name";
-**        azResult[1] = "Age";
-**        azResult[2] = "Alice";
-**        azResult[3] = "43";
-**        azResult[4] = "Bob";
-**        azResult[5] = "28";
-**        azResult[6] = "Cindy";
-**        azResult[7] = "21";
-** 
)^ -** -** ^The sqlite3_get_table() function evaluates one or more -** semicolon-separated SQL statements in the zero-terminated UTF-8 -** string of its 2nd parameter and returns a result table to the -** pointer given in its 3rd parameter. -** -** After the application has finished with the result from sqlite3_get_table(), -** it must pass the result table pointer to sqlite3_free_table() in order to -** release the memory that was malloced. Because of the way the -** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling -** function must not try to call [sqlite3_free()] directly. Only -** [sqlite3_free_table()] is able to release the memory properly and safely. -** -** The sqlite3_get_table() interface is implemented as a wrapper around -** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access -** to any internal data structures of SQLite. It uses only the public -** interface defined here. As a consequence, errors that occur in the -** wrapper layer outside of the internal [sqlite3_exec()] call are not -** reflected in subsequent calls to [sqlite3_errcode()] or -** [sqlite3_errmsg()]. -*/ -SQLITE_API int sqlite3_get_table( - sqlite3 *db, /* An open database */ - const char *zSql, /* SQL to be evaluated */ - char ***pazResult, /* Results of the query */ - int *pnRow, /* Number of result rows written here */ - int *pnColumn, /* Number of result columns written here */ - char **pzErrmsg /* Error msg written here */ -); -SQLITE_API void sqlite3_free_table(char **result); - -/* -** CAPI3REF: Formatted String Printing Functions -** -** These routines are work-alikes of the "printf()" family of functions -** from the standard C library. -** -** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their -** results into memory obtained from [sqlite3_malloc()]. -** The strings returned by these two routines should be -** released by [sqlite3_free()]. ^Both routines return a -** NULL pointer if [sqlite3_malloc()] is unable to allocate enough -** memory to hold the resulting string. -** -** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from -** the standard C library. The result is written into the -** buffer supplied as the second parameter whose size is given by -** the first parameter. Note that the order of the -** first two parameters is reversed from snprintf().)^ This is an -** historical accident that cannot be fixed without breaking -** backwards compatibility. ^(Note also that sqlite3_snprintf() -** returns a pointer to its buffer instead of the number of -** characters actually written into the buffer.)^ We admit that -** the number of characters written would be a more useful return -** value but we cannot change the implementation of sqlite3_snprintf() -** now without breaking compatibility. -** -** ^As long as the buffer size is greater than zero, sqlite3_snprintf() -** guarantees that the buffer is always zero-terminated. ^The first -** parameter "n" is the total size of the buffer, including space for -** the zero terminator. So the longest string that can be completely -** written will be n-1 characters. -** -** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). -** -** These routines all implement some additional formatting -** options that are useful for constructing SQL statements. -** All of the usual printf() formatting options apply. In addition, there -** is are "%q", "%Q", and "%z" options. -** -** ^(The %q option works like %s in that it substitutes a nul-terminated -** string from the argument list. But %q also doubles every '\'' character. -** %q is designed for use inside a string literal.)^ By doubling each '\'' -** character it escapes that character and allows it to be inserted into -** the string. -** -** For example, assume the string variable zText contains text as follows: -** -**
-**  char *zText = "It's a happy day!";
-** 
-** -** One can use this text in an SQL statement as follows: -** -**
-**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
-**  sqlite3_exec(db, zSQL, 0, 0, 0);
-**  sqlite3_free(zSQL);
-** 
-** -** Because the %q format string is used, the '\'' character in zText -** is escaped and the SQL generated is as follows: -** -**
-**  INSERT INTO table1 VALUES('It''s a happy day!')
-** 
-** -** This is correct. Had we used %s instead of %q, the generated SQL -** would have looked like this: -** -**
-**  INSERT INTO table1 VALUES('It's a happy day!');
-** 
-** -** This second example is an SQL syntax error. As a general rule you should -** always use %q instead of %s when inserting text into a string literal. -** -** ^(The %Q option works like %q except it also adds single quotes around -** the outside of the total string. Additionally, if the parameter in the -** argument list is a NULL pointer, %Q substitutes the text "NULL" (without -** single quotes).)^ So, for example, one could say: -** -**
-**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
-**  sqlite3_exec(db, zSQL, 0, 0, 0);
-**  sqlite3_free(zSQL);
-** 
-** -** The code above will render a correct SQL statement in the zSQL -** variable even if the zText variable is a NULL pointer. -** -** ^(The "%z" formatting option works like "%s" but with the -** addition that after the string has been read and copied into -** the result, [sqlite3_free()] is called on the input string.)^ -*/ -SQLITE_API char *sqlite3_mprintf(const char*,...); -SQLITE_API char *sqlite3_vmprintf(const char*, va_list); -SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); -SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list); - -/* -** CAPI3REF: Memory Allocation Subsystem -** -** The SQLite core uses these three routines for all of its own -** internal memory allocation needs. "Core" in the previous sentence -** does not include operating-system specific VFS implementation. The -** Windows VFS uses native malloc() and free() for some operations. -** -** ^The sqlite3_malloc() routine returns a pointer to a block -** of memory at least N bytes in length, where N is the parameter. -** ^If sqlite3_malloc() is unable to obtain sufficient free -** memory, it returns a NULL pointer. ^If the parameter N to -** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns -** a NULL pointer. -** -** ^Calling sqlite3_free() with a pointer previously returned -** by sqlite3_malloc() or sqlite3_realloc() releases that memory so -** that it might be reused. ^The sqlite3_free() routine is -** a no-op if is called with a NULL pointer. Passing a NULL pointer -** to sqlite3_free() is harmless. After being freed, memory -** should neither be read nor written. Even reading previously freed -** memory might result in a segmentation fault or other severe error. -** Memory corruption, a segmentation fault, or other severe error -** might result if sqlite3_free() is called with a non-NULL pointer that -** was not obtained from sqlite3_malloc() or sqlite3_realloc(). -** -** ^(The sqlite3_realloc() interface attempts to resize a -** prior memory allocation to be at least N bytes, where N is the -** second parameter. The memory allocation to be resized is the first -** parameter.)^ ^ If the first parameter to sqlite3_realloc() -** is a NULL pointer then its behavior is identical to calling -** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc(). -** ^If the second parameter to sqlite3_realloc() is zero or -** negative then the behavior is exactly the same as calling -** sqlite3_free(P) where P is the first parameter to sqlite3_realloc(). -** ^sqlite3_realloc() returns a pointer to a memory allocation -** of at least N bytes in size or NULL if sufficient memory is unavailable. -** ^If M is the size of the prior allocation, then min(N,M) bytes -** of the prior allocation are copied into the beginning of buffer returned -** by sqlite3_realloc() and the prior allocation is freed. -** ^If sqlite3_realloc() returns NULL, then the prior allocation -** is not freed. -** -** ^The memory returned by sqlite3_malloc() and sqlite3_realloc() -** is always aligned to at least an 8 byte boundary, or to a -** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time -** option is used. -** -** In SQLite version 3.5.0 and 3.5.1, it was possible to define -** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in -** implementation of these routines to be omitted. That capability -** is no longer provided. Only built-in memory allocators can be used. -** -** Prior to SQLite version 3.7.10, the Windows OS interface layer called -** the system malloc() and free() directly when converting -** filenames between the UTF-8 encoding used by SQLite -** and whatever filename encoding is used by the particular Windows -** installation. Memory allocation errors were detected, but -** they were reported back as [SQLITE_CANTOPEN] or -** [SQLITE_IOERR] rather than [SQLITE_NOMEM]. -** -** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] -** must be either NULL or else pointers obtained from a prior -** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have -** not yet been released. -** -** The application must not read or write any part of -** a block of memory after it has been released using -** [sqlite3_free()] or [sqlite3_realloc()]. -*/ -SQLITE_API void *sqlite3_malloc(int); -SQLITE_API void *sqlite3_realloc(void*, int); -SQLITE_API void sqlite3_free(void*); - -/* -** CAPI3REF: Memory Allocator Statistics -** -** SQLite provides these two interfaces for reporting on the status -** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] -** routines, which form the built-in memory allocation subsystem. -** -** ^The [sqlite3_memory_used()] routine returns the number of bytes -** of memory currently outstanding (malloced but not freed). -** ^The [sqlite3_memory_highwater()] routine returns the maximum -** value of [sqlite3_memory_used()] since the high-water mark -** was last reset. ^The values returned by [sqlite3_memory_used()] and -** [sqlite3_memory_highwater()] include any overhead -** added by SQLite in its implementation of [sqlite3_malloc()], -** but not overhead added by the any underlying system library -** routines that [sqlite3_malloc()] may call. -** -** ^The memory high-water mark is reset to the current value of -** [sqlite3_memory_used()] if and only if the parameter to -** [sqlite3_memory_highwater()] is true. ^The value returned -** by [sqlite3_memory_highwater(1)] is the high-water mark -** prior to the reset. -*/ -SQLITE_API sqlite3_int64 sqlite3_memory_used(void); -SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); - -/* -** CAPI3REF: Pseudo-Random Number Generator -** -** SQLite contains a high-quality pseudo-random number generator (PRNG) used to -** select random [ROWID | ROWIDs] when inserting new records into a table that -** already uses the largest possible [ROWID]. The PRNG is also used for -** the build-in random() and randomblob() SQL functions. This interface allows -** applications to access the same PRNG for other purposes. -** -** ^A call to this routine stores N bytes of randomness into buffer P. -** ^If N is less than one, then P can be a NULL pointer. -** -** ^If this routine has not been previously called or if the previous -** call had N less than one, then the PRNG is seeded using randomness -** obtained from the xRandomness method of the default [sqlite3_vfs] object. -** ^If the previous call to this routine had an N of 1 or more then -** the pseudo-randomness is generated -** internally and without recourse to the [sqlite3_vfs] xRandomness -** method. -*/ -SQLITE_API void sqlite3_randomness(int N, void *P); - -/* -** CAPI3REF: Compile-Time Authorization Callbacks -** -** ^This routine registers an authorizer callback with a particular -** [database connection], supplied in the first argument. -** ^The authorizer callback is invoked as SQL statements are being compiled -** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], -** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various -** points during the compilation process, as logic is being created -** to perform various actions, the authorizer callback is invoked to -** see if those actions are allowed. ^The authorizer callback should -** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the -** specific action but allow the SQL statement to continue to be -** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be -** rejected with an error. ^If the authorizer callback returns -** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] -** then the [sqlite3_prepare_v2()] or equivalent call that triggered -** the authorizer will fail with an error message. -** -** When the callback returns [SQLITE_OK], that means the operation -** requested is ok. ^When the callback returns [SQLITE_DENY], the -** [sqlite3_prepare_v2()] or equivalent call that triggered the -** authorizer will fail with an error message explaining that -** access is denied. -** -** ^The first parameter to the authorizer callback is a copy of the third -** parameter to the sqlite3_set_authorizer() interface. ^The second parameter -** to the callback is an integer [SQLITE_COPY | action code] that specifies -** the particular action to be authorized. ^The third through sixth parameters -** to the callback are zero-terminated strings that contain additional -** details about the action to be authorized. -** -** ^If the action code is [SQLITE_READ] -** and the callback returns [SQLITE_IGNORE] then the -** [prepared statement] statement is constructed to substitute -** a NULL value in place of the table column that would have -** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] -** return can be used to deny an untrusted user access to individual -** columns of a table. -** ^If the action code is [SQLITE_DELETE] and the callback returns -** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the -** [truncate optimization] is disabled and all rows are deleted individually. -** -** An authorizer is used when [sqlite3_prepare | preparing] -** SQL statements from an untrusted source, to ensure that the SQL statements -** do not try to access data they are not allowed to see, or that they do not -** try to execute malicious statements that damage the database. For -** example, an application may allow a user to enter arbitrary -** SQL queries for evaluation by a database. But the application does -** not want the user to be able to make arbitrary changes to the -** database. An authorizer could then be put in place while the -** user-entered SQL is being [sqlite3_prepare | prepared] that -** disallows everything except [SELECT] statements. -** -** Applications that need to process SQL from untrusted sources -** might also consider lowering resource limits using [sqlite3_limit()] -** and limiting database size using the [max_page_count] [PRAGMA] -** in addition to using an authorizer. -** -** ^(Only a single authorizer can be in place on a database connection -** at a time. Each call to sqlite3_set_authorizer overrides the -** previous call.)^ ^Disable the authorizer by installing a NULL callback. -** The authorizer is disabled by default. -** -** The authorizer callback must not do anything that will modify -** the database connection that invoked the authorizer callback. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the -** statement might be re-prepared during [sqlite3_step()] due to a -** schema change. Hence, the application should ensure that the -** correct authorizer callback remains in place during the [sqlite3_step()]. -** -** ^Note that the authorizer callback is invoked only during -** [sqlite3_prepare()] or its variants. Authorization is not -** performed during statement evaluation in [sqlite3_step()], unless -** as stated in the previous paragraph, sqlite3_step() invokes -** sqlite3_prepare_v2() to reprepare a statement after a schema change. -*/ -SQLITE_API int sqlite3_set_authorizer( - sqlite3*, - int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), - void *pUserData -); - -/* -** CAPI3REF: Authorizer Return Codes -** -** The [sqlite3_set_authorizer | authorizer callback function] must -** return either [SQLITE_OK] or one of these two constants in order -** to signal SQLite whether or not the action is permitted. See the -** [sqlite3_set_authorizer | authorizer documentation] for additional -** information. -** -** Note that SQLITE_IGNORE is also used as a [SQLITE_ROLLBACK | return code] -** from the [sqlite3_vtab_on_conflict()] interface. -*/ -#define SQLITE_DENY 1 /* Abort the SQL statement with an error */ -#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ - -/* -** CAPI3REF: Authorizer Action Codes -** -** The [sqlite3_set_authorizer()] interface registers a callback function -** that is invoked to authorize certain SQL statement actions. The -** second parameter to the callback is an integer code that specifies -** what action is being authorized. These are the integer action codes that -** the authorizer callback may be passed. -** -** These action code values signify what kind of operation is to be -** authorized. The 3rd and 4th parameters to the authorization -** callback function will be parameters or NULL depending on which of these -** codes is used as the second parameter. ^(The 5th parameter to the -** authorizer callback is the name of the database ("main", "temp", -** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback -** is the name of the inner-most trigger or view that is responsible for -** the access attempt or NULL if this access attempt is directly from -** top-level SQL code. -*/ -/******************************************* 3rd ************ 4th ***********/ -#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ -#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ -#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ -#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ -#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ -#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ -#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ -#define SQLITE_CREATE_VIEW 8 /* View Name NULL */ -#define SQLITE_DELETE 9 /* Table Name NULL */ -#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ -#define SQLITE_DROP_TABLE 11 /* Table Name NULL */ -#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ -#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ -#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ -#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ -#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ -#define SQLITE_DROP_VIEW 17 /* View Name NULL */ -#define SQLITE_INSERT 18 /* Table Name NULL */ -#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ -#define SQLITE_READ 20 /* Table Name Column Name */ -#define SQLITE_SELECT 21 /* NULL NULL */ -#define SQLITE_TRANSACTION 22 /* Operation NULL */ -#define SQLITE_UPDATE 23 /* Table Name Column Name */ -#define SQLITE_ATTACH 24 /* Filename NULL */ -#define SQLITE_DETACH 25 /* Database Name NULL */ -#define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ -#define SQLITE_REINDEX 27 /* Index Name NULL */ -#define SQLITE_ANALYZE 28 /* Table Name NULL */ -#define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ -#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ -#define SQLITE_FUNCTION 31 /* NULL Function Name */ -#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */ -#define SQLITE_COPY 0 /* No longer used */ -#define SQLITE_RECURSIVE 33 /* NULL NULL */ - -/* -** CAPI3REF: Tracing And Profiling Functions -** -** These routines register callback functions that can be used for -** tracing and profiling the execution of SQL statements. -** -** ^The callback function registered by sqlite3_trace() is invoked at -** various times when an SQL statement is being run by [sqlite3_step()]. -** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the -** SQL statement text as the statement first begins executing. -** ^(Additional sqlite3_trace() callbacks might occur -** as each triggered subprogram is entered. The callbacks for triggers -** contain a UTF-8 SQL comment that identifies the trigger.)^ -** -** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit -** the length of [bound parameter] expansion in the output of sqlite3_trace(). -** -** ^The callback function registered by sqlite3_profile() is invoked -** as each SQL statement finishes. ^The profile callback contains -** the original statement text and an estimate of wall-clock time -** of how long that statement took to run. ^The profile callback -** time is in units of nanoseconds, however the current implementation -** is only capable of millisecond resolution so the six least significant -** digits in the time are meaningless. Future versions of SQLite -** might provide greater resolution on the profiler callback. The -** sqlite3_profile() function is considered experimental and is -** subject to change in future versions of SQLite. -*/ -SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); -SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, - void(*xProfile)(void*,const char*,sqlite3_uint64), void*); - -/* -** CAPI3REF: Query Progress Callbacks -** -** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback -** function X to be invoked periodically during long running calls to -** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for -** database connection D. An example use for this -** interface is to keep a GUI updated during a large query. -** -** ^The parameter P is passed through as the only parameter to the -** callback function X. ^The parameter N is the approximate number of -** [virtual machine instructions] that are evaluated between successive -** invocations of the callback X. ^If N is less than one then the progress -** handler is disabled. -** -** ^Only a single progress handler may be defined at one time per -** [database connection]; setting a new progress handler cancels the -** old one. ^Setting parameter X to NULL disables the progress handler. -** ^The progress handler is also disabled by setting N to a value less -** than 1. -** -** ^If the progress callback returns non-zero, the operation is -** interrupted. This feature can be used to implement a -** "Cancel" button on a GUI progress dialog box. -** -** The progress handler callback must not do anything that will modify -** the database connection that invoked the progress handler. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -*/ -SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); - -/* -** CAPI3REF: Opening A New Database Connection -** -** ^These routines open an SQLite database file as specified by the -** filename argument. ^The filename argument is interpreted as UTF-8 for -** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte -** order for sqlite3_open16(). ^(A [database connection] handle is usually -** returned in *ppDb, even if an error occurs. The only exception is that -** if SQLite is unable to allocate memory to hold the [sqlite3] object, -** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] -** object.)^ ^(If the database is opened (and/or created) successfully, then -** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The -** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain -** an English language description of the error following a failure of any -** of the sqlite3_open() routines. -** -** ^The default encoding for the database will be UTF-8 if -** sqlite3_open() or sqlite3_open_v2() is called and -** UTF-16 in the native byte order if sqlite3_open16() is used. -** -** Whether or not an error occurs when it is opened, resources -** associated with the [database connection] handle should be released by -** passing it to [sqlite3_close()] when it is no longer required. -** -** The sqlite3_open_v2() interface works like sqlite3_open() -** except that it accepts two additional parameters for additional control -** over the new database connection. ^(The flags parameter to -** sqlite3_open_v2() can take one of -** the following three values, optionally combined with the -** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE], -** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^ -** -**
-** ^(
[SQLITE_OPEN_READONLY]
-**
The database is opened in read-only mode. If the database does not -** already exist, an error is returned.
)^ -** -** ^(
[SQLITE_OPEN_READWRITE]
-**
The database is opened for reading and writing if possible, or reading -** only if the file is write protected by the operating system. In either -** case the database must already exist, otherwise an error is returned.
)^ -** -** ^(
[SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
-**
The database is opened for reading and writing, and is created if -** it does not already exist. This is the behavior that is always used for -** sqlite3_open() and sqlite3_open16().
)^ -**
-** -** If the 3rd parameter to sqlite3_open_v2() is not one of the -** combinations shown above optionally combined with other -** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] -** then the behavior is undefined. -** -** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection -** opens in the multi-thread [threading mode] as long as the single-thread -** mode has not been set at compile-time or start-time. ^If the -** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens -** in the serialized [threading mode] unless single-thread was -** previously selected at compile-time or start-time. -** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be -** eligible to use [shared cache mode], regardless of whether or not shared -** cache is enabled using [sqlite3_enable_shared_cache()]. ^The -** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not -** participate in [shared cache mode] even if it is enabled. -** -** ^The fourth parameter to sqlite3_open_v2() is the name of the -** [sqlite3_vfs] object that defines the operating system interface that -** the new database connection should use. ^If the fourth parameter is -** a NULL pointer then the default [sqlite3_vfs] object is used. -** -** ^If the filename is ":memory:", then a private, temporary in-memory database -** is created for the connection. ^This in-memory database will vanish when -** the database connection is closed. Future versions of SQLite might -** make use of additional special filenames that begin with the ":" character. -** It is recommended that when a database filename actually does begin with -** a ":" character you should prefix the filename with a pathname such as -** "./" to avoid ambiguity. -** -** ^If the filename is an empty string, then a private, temporary -** on-disk database will be created. ^This private database will be -** automatically deleted as soon as the database connection is closed. -** -** [[URI filenames in sqlite3_open()]]

URI Filenames

-** -** ^If [URI filename] interpretation is enabled, and the filename argument -** begins with "file:", then the filename is interpreted as a URI. ^URI -** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is -** set in the fourth argument to sqlite3_open_v2(), or if it has -** been enabled globally using the [SQLITE_CONFIG_URI] option with the -** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. -** As of SQLite version 3.7.7, URI filename interpretation is turned off -** by default, but future releases of SQLite might enable URI filename -** interpretation by default. See "[URI filenames]" for additional -** information. -** -** URI filenames are parsed according to RFC 3986. ^If the URI contains an -** authority, then it must be either an empty string or the string -** "localhost". ^If the authority is not an empty string or "localhost", an -** error is returned to the caller. ^The fragment component of a URI, if -** present, is ignored. -** -** ^SQLite uses the path component of the URI as the name of the disk file -** which contains the database. ^If the path begins with a '/' character, -** then it is interpreted as an absolute path. ^If the path does not begin -** with a '/' (meaning that the authority section is omitted from the URI) -** then the path is interpreted as a relative path. -** ^On windows, the first component of an absolute path -** is a drive specification (e.g. "C:"). -** -** [[core URI query parameters]] -** The query component of a URI may contain parameters that are interpreted -** either by SQLite itself, or by a [VFS | custom VFS implementation]. -** SQLite interprets the following three query parameters: -** -**
    -**
  • vfs: ^The "vfs" parameter may be used to specify the name of -** a VFS object that provides the operating system interface that should -** be used to access the database file on disk. ^If this option is set to -** an empty string the default VFS object is used. ^Specifying an unknown -** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is -** present, then the VFS specified by the option takes precedence over -** the value passed as the fourth parameter to sqlite3_open_v2(). -** -**
  • mode: ^(The mode parameter may be set to either "ro", "rw", -** "rwc", or "memory". Attempting to set it to any other value is -** an error)^. -** ^If "ro" is specified, then the database is opened for read-only -** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the -** third argument to sqlite3_open_v2(). ^If the mode option is set to -** "rw", then the database is opened for read-write (but not create) -** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had -** been set. ^Value "rwc" is equivalent to setting both -** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is -** set to "memory" then a pure [in-memory database] that never reads -** or writes from disk is used. ^It is an error to specify a value for -** the mode parameter that is less restrictive than that specified by -** the flags passed in the third parameter to sqlite3_open_v2(). -** -**
  • cache: ^The cache parameter may be set to either "shared" or -** "private". ^Setting it to "shared" is equivalent to setting the -** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to -** sqlite3_open_v2(). ^Setting the cache parameter to "private" is -** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit. -** ^If sqlite3_open_v2() is used and the "cache" parameter is present in -** a URI filename, its value overrides any behavior requested by setting -** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag. -**
-** -** ^Specifying an unknown parameter in the query component of a URI is not an -** error. Future versions of SQLite might understand additional query -** parameters. See "[query parameters with special meaning to SQLite]" for -** additional information. -** -** [[URI filename examples]]

URI filename examples

-** -**
-**
URI filenames Results -**
file:data.db -** Open the file "data.db" in the current directory. -**
file:/home/fred/data.db
-** file:///home/fred/data.db
-** file://localhost/home/fred/data.db
-** Open the database file "/home/fred/data.db". -**
file://darkstar/home/fred/data.db -** An error. "darkstar" is not a recognized authority. -**
-** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db -** Windows only: Open the file "data.db" on fred's desktop on drive -** C:. Note that the %20 escaping in this example is not strictly -** necessary - space characters can be used literally -** in URI filenames. -**
file:data.db?mode=ro&cache=private -** Open file "data.db" in the current directory for read-only access. -** Regardless of whether or not shared-cache mode is enabled by -** default, use a private cache. -**
file:/home/fred/data.db?vfs=unix-nolock -** Open file "/home/fred/data.db". Use the special VFS "unix-nolock". -**
file:data.db?mode=readonly -** An error. "readonly" is not a valid option for the "mode" parameter. -**
-** -** ^URI hexadecimal escape sequences (%HH) are supported within the path and -** query components of a URI. A hexadecimal escape sequence consists of a -** percent sign - "%" - followed by exactly two hexadecimal digits -** specifying an octet value. ^Before the path or query components of a -** URI filename are interpreted, they are encoded using UTF-8 and all -** hexadecimal escape sequences replaced by a single byte containing the -** corresponding octet. If this process generates an invalid UTF-8 encoding, -** the results are undefined. -** -** Note to Windows users: The encoding used for the filename argument -** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever -** codepage is currently defined. Filenames containing international -** characters must be converted to UTF-8 prior to passing them into -** sqlite3_open() or sqlite3_open_v2(). -** -** Note to Windows Runtime users: The temporary directory must be set -** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various -** features that require the use of temporary files may fail. -** -** See also: [sqlite3_temp_directory] -*/ -SQLITE_API int sqlite3_open( - const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb /* OUT: SQLite db handle */ -); -SQLITE_API int sqlite3_open16( - const void *filename, /* Database filename (UTF-16) */ - sqlite3 **ppDb /* OUT: SQLite db handle */ -); -SQLITE_API int sqlite3_open_v2( - const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb, /* OUT: SQLite db handle */ - int flags, /* Flags */ - const char *zVfs /* Name of VFS module to use */ -); - -/* -** CAPI3REF: Obtain Values For URI Parameters -** -** These are utility routines, useful to VFS implementations, that check -** to see if a database file was a URI that contained a specific query -** parameter, and if so obtains the value of that query parameter. -** -** If F is the database filename pointer passed into the xOpen() method of -** a VFS implementation when the flags parameter to xOpen() has one or -** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and -** P is the name of the query parameter, then -** sqlite3_uri_parameter(F,P) returns the value of the P -** parameter if it exists or a NULL pointer if P does not appear as a -** query parameter on F. If P is a query parameter of F -** has no explicit value, then sqlite3_uri_parameter(F,P) returns -** a pointer to an empty string. -** -** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean -** parameter and returns true (1) or false (0) according to the value -** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the -** value of query parameter P is one of "yes", "true", or "on" in any -** case or if the value begins with a non-zero number. The -** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of -** query parameter P is one of "no", "false", or "off" in any case or -** if the value begins with a numeric zero. If P is not a query -** parameter on F or if the value of P is does not match any of the -** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0). -** -** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a -** 64-bit signed integer and returns that integer, or D if P does not -** exist. If the value of P is something other than an integer, then -** zero is returned. -** -** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and -** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and -** is not a database file pathname pointer that SQLite passed into the xOpen -** VFS method, then the behavior of this routine is undefined and probably -** undesirable. -*/ -SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); -SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); -SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64); - - -/* -** CAPI3REF: Error Codes And Messages -** -** ^The sqlite3_errcode() interface returns the numeric [result code] or -** [extended result code] for the most recent failed sqlite3_* API call -** associated with a [database connection]. If a prior API call failed -** but the most recent API call succeeded, the return value from -** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode() -** interface is the same except that it always returns the -** [extended result code] even when extended result codes are -** disabled. -** -** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language -** text that describes the error, as either UTF-8 or UTF-16 respectively. -** ^(Memory to hold the error message string is managed internally. -** The application does not need to worry about freeing the result. -** However, the error string might be overwritten or deallocated by -** subsequent calls to other SQLite interface functions.)^ -** -** ^The sqlite3_errstr() interface returns the English-language text -** that describes the [result code], as UTF-8. -** ^(Memory to hold the error message string is managed internally -** and must not be freed by the application)^. -** -** When the serialized [threading mode] is in use, it might be the -** case that a second error occurs on a separate thread in between -** the time of the first error and the call to these interfaces. -** When that happens, the second error will be reported since these -** interfaces always report the most recent result. To avoid -** this, each thread can obtain exclusive use of the [database connection] D -** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning -** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after -** all calls to the interfaces listed here are completed. -** -** If an interface fails with SQLITE_MISUSE, that means the interface -** was invoked incorrectly by the application. In that case, the -** error code and message may or may not be set. -*/ -SQLITE_API int sqlite3_errcode(sqlite3 *db); -SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); -SQLITE_API const char *sqlite3_errmsg(sqlite3*); -SQLITE_API const void *sqlite3_errmsg16(sqlite3*); -SQLITE_API const char *sqlite3_errstr(int); - -/* -** CAPI3REF: SQL Statement Object -** KEYWORDS: {prepared statement} {prepared statements} -** -** An instance of this object represents a single SQL statement. -** This object is variously known as a "prepared statement" or a -** "compiled SQL statement" or simply as a "statement". -** -** The life of a statement object goes something like this: -** -**

    -**
  1. Create the object using [sqlite3_prepare_v2()] or a related -** function. -**
  2. Bind values to [host parameters] using the sqlite3_bind_*() -** interfaces. -**
  3. Run the SQL by calling [sqlite3_step()] one or more times. -**
  4. Reset the statement using [sqlite3_reset()] then go back -** to step 2. Do this zero or more times. -**
  5. Destroy the object using [sqlite3_finalize()]. -**
-** -** Refer to documentation on individual methods above for additional -** information. -*/ -typedef struct sqlite3_stmt sqlite3_stmt; - -/* -** CAPI3REF: Run-time Limits -** -** ^(This interface allows the size of various constructs to be limited -** on a connection by connection basis. The first parameter is the -** [database connection] whose limit is to be set or queried. The -** second parameter is one of the [limit categories] that define a -** class of constructs to be size limited. The third parameter is the -** new limit for that construct.)^ -** -** ^If the new limit is a negative number, the limit is unchanged. -** ^(For each limit category SQLITE_LIMIT_NAME there is a -** [limits | hard upper bound] -** set at compile-time by a C preprocessor macro called -** [limits | SQLITE_MAX_NAME]. -** (The "_LIMIT_" in the name is changed to "_MAX_".))^ -** ^Attempts to increase a limit above its hard upper bound are -** silently truncated to the hard upper bound. -** -** ^Regardless of whether or not the limit was changed, the -** [sqlite3_limit()] interface returns the prior value of the limit. -** ^Hence, to find the current value of a limit without changing it, -** simply invoke this interface with the third parameter set to -1. -** -** Run-time limits are intended for use in applications that manage -** both their own internal database and also databases that are controlled -** by untrusted external sources. An example application might be a -** web browser that has its own databases for storing history and -** separate databases controlled by JavaScript applications downloaded -** off the Internet. The internal databases can be given the -** large, default limits. Databases managed by external sources can -** be given much smaller limits designed to prevent a denial of service -** attack. Developers might also want to use the [sqlite3_set_authorizer()] -** interface to further control untrusted SQL. The size of the database -** created by an untrusted script can be contained using the -** [max_page_count] [PRAGMA]. -** -** New run-time limit categories may be added in future releases. -*/ -SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); - -/* -** CAPI3REF: Run-Time Limit Categories -** KEYWORDS: {limit category} {*limit categories} -** -** These constants define various performance limits -** that can be lowered at run-time using [sqlite3_limit()]. -** The synopsis of the meanings of the various limits is shown below. -** Additional information is available at [limits | Limits in SQLite]. -** -**
-** [[SQLITE_LIMIT_LENGTH]] ^(
SQLITE_LIMIT_LENGTH
-**
The maximum size of any string or BLOB or table row, in bytes.
)^ -** -** [[SQLITE_LIMIT_SQL_LENGTH]] ^(
SQLITE_LIMIT_SQL_LENGTH
-**
The maximum length of an SQL statement, in bytes.
)^ -** -** [[SQLITE_LIMIT_COLUMN]] ^(
SQLITE_LIMIT_COLUMN
-**
The maximum number of columns in a table definition or in the -** result set of a [SELECT] or the maximum number of columns in an index -** or in an ORDER BY or GROUP BY clause.
)^ -** -** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(
SQLITE_LIMIT_EXPR_DEPTH
-**
The maximum depth of the parse tree on any expression.
)^ -** -** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(
SQLITE_LIMIT_COMPOUND_SELECT
-**
The maximum number of terms in a compound SELECT statement.
)^ -** -** [[SQLITE_LIMIT_VDBE_OP]] ^(
SQLITE_LIMIT_VDBE_OP
-**
The maximum number of instructions in a virtual machine program -** used to implement an SQL statement. This limit is not currently -** enforced, though that might be added in some future release of -** SQLite.
)^ -** -** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(
SQLITE_LIMIT_FUNCTION_ARG
-**
The maximum number of arguments on a function.
)^ -** -** [[SQLITE_LIMIT_ATTACHED]] ^(
SQLITE_LIMIT_ATTACHED
-**
The maximum number of [ATTACH | attached databases].)^
-** -** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]] -** ^(
SQLITE_LIMIT_LIKE_PATTERN_LENGTH
-**
The maximum length of the pattern argument to the [LIKE] or -** [GLOB] operators.
)^ -** -** [[SQLITE_LIMIT_VARIABLE_NUMBER]] -** ^(
SQLITE_LIMIT_VARIABLE_NUMBER
-**
The maximum index number of any [parameter] in an SQL statement.)^ -** -** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(
SQLITE_LIMIT_TRIGGER_DEPTH
-**
The maximum depth of recursion for triggers.
)^ -**
-*/ -#define SQLITE_LIMIT_LENGTH 0 -#define SQLITE_LIMIT_SQL_LENGTH 1 -#define SQLITE_LIMIT_COLUMN 2 -#define SQLITE_LIMIT_EXPR_DEPTH 3 -#define SQLITE_LIMIT_COMPOUND_SELECT 4 -#define SQLITE_LIMIT_VDBE_OP 5 -#define SQLITE_LIMIT_FUNCTION_ARG 6 -#define SQLITE_LIMIT_ATTACHED 7 -#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 -#define SQLITE_LIMIT_VARIABLE_NUMBER 9 -#define SQLITE_LIMIT_TRIGGER_DEPTH 10 - -/* -** CAPI3REF: Compiling An SQL Statement -** KEYWORDS: {SQL statement compiler} -** -** To execute an SQL query, it must first be compiled into a byte-code -** program using one of these routines. -** -** The first argument, "db", is a [database connection] obtained from a -** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or -** [sqlite3_open16()]. The database connection must not have been closed. -** -** The second argument, "zSql", is the statement to be compiled, encoded -** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() -** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() -** use UTF-16. -** -** ^If the nByte argument is less than zero, then zSql is read up to the -** first zero terminator. ^If nByte is non-negative, then it is the maximum -** number of bytes read from zSql. ^When nByte is non-negative, the -** zSql string ends at either the first '\000' or '\u0000' character or -** the nByte-th byte, whichever comes first. If the caller knows -** that the supplied string is nul-terminated, then there is a small -** performance advantage to be gained by passing an nByte parameter that -** is equal to the number of bytes in the input string including -** the nul-terminator bytes as this saves SQLite from having to -** make a copy of the input string. -** -** ^If pzTail is not NULL then *pzTail is made to point to the first byte -** past the end of the first SQL statement in zSql. These routines only -** compile the first statement in zSql, so *pzTail is left pointing to -** what remains uncompiled. -** -** ^*ppStmt is left pointing to a compiled [prepared statement] that can be -** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set -** to NULL. ^If the input text contains no SQL (if the input is an empty -** string or a comment) then *ppStmt is set to NULL. -** The calling procedure is responsible for deleting the compiled -** SQL statement using [sqlite3_finalize()] after it has finished with it. -** ppStmt may not be NULL. -** -** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; -** otherwise an [error code] is returned. -** -** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are -** recommended for all new programs. The two older interfaces are retained -** for backwards compatibility, but their use is discouraged. -** ^In the "v2" interfaces, the prepared statement -** that is returned (the [sqlite3_stmt] object) contains a copy of the -** original SQL text. This causes the [sqlite3_step()] interface to -** behave differently in three ways: -** -**
    -**
  1. -** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it -** always used to do, [sqlite3_step()] will automatically recompile the SQL -** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY] -** retries will occur before sqlite3_step() gives up and returns an error. -**
  2. -** -**
  3. -** ^When an error occurs, [sqlite3_step()] will return one of the detailed -** [error codes] or [extended error codes]. ^The legacy behavior was that -** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code -** and the application would have to make a second call to [sqlite3_reset()] -** in order to find the underlying cause of the problem. With the "v2" prepare -** interfaces, the underlying reason for the error is returned immediately. -**
  4. -** -**
  5. -** ^If the specific value bound to [parameter | host parameter] in the -** WHERE clause might influence the choice of query plan for a statement, -** then the statement will be automatically recompiled, as if there had been -** a schema change, on the first [sqlite3_step()] call following any change -** to the [sqlite3_bind_text | bindings] of that [parameter]. -** ^The specific value of WHERE-clause [parameter] might influence the -** choice of query plan if the parameter is the left-hand side of a [LIKE] -** or [GLOB] operator or if the parameter is compared to an indexed column -** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. -**
  6. -**
-*/ -SQLITE_API int sqlite3_prepare( - sqlite3 *db, /* Database handle */ - const char *zSql, /* SQL statement, UTF-8 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const char **pzTail /* OUT: Pointer to unused portion of zSql */ -); -SQLITE_API int sqlite3_prepare_v2( - sqlite3 *db, /* Database handle */ - const char *zSql, /* SQL statement, UTF-8 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const char **pzTail /* OUT: Pointer to unused portion of zSql */ -); -SQLITE_API int sqlite3_prepare16( - sqlite3 *db, /* Database handle */ - const void *zSql, /* SQL statement, UTF-16 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const void **pzTail /* OUT: Pointer to unused portion of zSql */ -); -SQLITE_API int sqlite3_prepare16_v2( - sqlite3 *db, /* Database handle */ - const void *zSql, /* SQL statement, UTF-16 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const void **pzTail /* OUT: Pointer to unused portion of zSql */ -); - -/* -** CAPI3REF: Retrieving Statement SQL -** -** ^This interface can be used to retrieve a saved copy of the original -** SQL text used to create a [prepared statement] if that statement was -** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. -*/ -SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Determine If An SQL Statement Writes The Database -** -** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if -** and only if the [prepared statement] X makes no direct changes to -** the content of the database file. -** -** Note that [application-defined SQL functions] or -** [virtual tables] might change the database indirectly as a side effect. -** ^(For example, if an application defines a function "eval()" that -** calls [sqlite3_exec()], then the following SQL statement would -** change the database file through side-effects: -** -**
-**    SELECT eval('DELETE FROM t1') FROM t2;
-** 
-** -** But because the [SELECT] statement does not change the database file -** directly, sqlite3_stmt_readonly() would still return true.)^ -** -** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK], -** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true, -** since the statements themselves do not actually modify the database but -** rather they control the timing of when other statements modify the -** database. ^The [ATTACH] and [DETACH] statements also cause -** sqlite3_stmt_readonly() to return true since, while those statements -** change the configuration of a database connection, they do not make -** changes to the content of the database files on disk. -*/ -SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Determine If A Prepared Statement Has Been Reset -** -** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the -** [prepared statement] S has been stepped at least once using -** [sqlite3_step(S)] but has not run to completion and/or has not -** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S) -** interface returns false if S is a NULL pointer. If S is not a -** NULL pointer and is not a pointer to a valid [prepared statement] -** object, then the behavior is undefined and probably undesirable. -** -** This interface can be used in combination [sqlite3_next_stmt()] -** to locate all prepared statements associated with a database -** connection that are in need of being reset. This can be used, -** for example, in diagnostic routines to search for prepared -** statements that are holding a transaction open. -*/ -SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); - -/* -** CAPI3REF: Dynamically Typed Value Object -** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} -** -** SQLite uses the sqlite3_value object to represent all values -** that can be stored in a database table. SQLite uses dynamic typing -** for the values it stores. ^Values stored in sqlite3_value objects -** can be integers, floating point values, strings, BLOBs, or NULL. -** -** An sqlite3_value object may be either "protected" or "unprotected". -** Some interfaces require a protected sqlite3_value. Other interfaces -** will accept either a protected or an unprotected sqlite3_value. -** Every interface that accepts sqlite3_value arguments specifies -** whether or not it requires a protected sqlite3_value. -** -** The terms "protected" and "unprotected" refer to whether or not -** a mutex is held. An internal mutex is held for a protected -** sqlite3_value object but no mutex is held for an unprotected -** sqlite3_value object. If SQLite is compiled to be single-threaded -** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) -** or if SQLite is run in one of reduced mutex modes -** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] -** then there is no distinction between protected and unprotected -** sqlite3_value objects and they can be used interchangeably. However, -** for maximum code portability it is recommended that applications -** still make the distinction between protected and unprotected -** sqlite3_value objects even when not strictly required. -** -** ^The sqlite3_value objects that are passed as parameters into the -** implementation of [application-defined SQL functions] are protected. -** ^The sqlite3_value object returned by -** [sqlite3_column_value()] is unprotected. -** Unprotected sqlite3_value objects may only be used with -** [sqlite3_result_value()] and [sqlite3_bind_value()]. -** The [sqlite3_value_blob | sqlite3_value_type()] family of -** interfaces require protected sqlite3_value objects. -*/ -typedef struct Mem sqlite3_value; - -/* -** CAPI3REF: SQL Function Context Object -** -** The context in which an SQL function executes is stored in an -** sqlite3_context object. ^A pointer to an sqlite3_context object -** is always first parameter to [application-defined SQL functions]. -** The application-defined SQL function implementation will pass this -** pointer through into calls to [sqlite3_result_int | sqlite3_result()], -** [sqlite3_aggregate_context()], [sqlite3_user_data()], -** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], -** and/or [sqlite3_set_auxdata()]. -*/ -typedef struct sqlite3_context sqlite3_context; - -/* -** CAPI3REF: Binding Values To Prepared Statements -** KEYWORDS: {host parameter} {host parameters} {host parameter name} -** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} -** -** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, -** literals may be replaced by a [parameter] that matches one of following -** templates: -** -**
    -**
  • ? -**
  • ?NNN -**
  • :VVV -**
  • @VVV -**
  • $VVV -**
-** -** In the templates above, NNN represents an integer literal, -** and VVV represents an alphanumeric identifier.)^ ^The values of these -** parameters (also called "host parameter names" or "SQL parameters") -** can be set using the sqlite3_bind_*() routines defined here. -** -** ^The first argument to the sqlite3_bind_*() routines is always -** a pointer to the [sqlite3_stmt] object returned from -** [sqlite3_prepare_v2()] or its variants. -** -** ^The second argument is the index of the SQL parameter to be set. -** ^The leftmost SQL parameter has an index of 1. ^When the same named -** SQL parameter is used more than once, second and subsequent -** occurrences have the same index as the first occurrence. -** ^The index for named parameters can be looked up using the -** [sqlite3_bind_parameter_index()] API if desired. ^The index -** for "?NNN" parameters is the value of NNN. -** ^The NNN value must be between 1 and the [sqlite3_limit()] -** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999). -** -** ^The third argument is the value to bind to the parameter. -** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16() -** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter -** is ignored and the end result is the same as sqlite3_bind_null(). -** -** ^(In those routines that have a fourth argument, its value is the -** number of bytes in the parameter. To be clear: the value is the -** number of bytes in the value, not the number of characters.)^ -** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16() -** is negative, then the length of the string is -** the number of bytes up to the first zero terminator. -** If the fourth parameter to sqlite3_bind_blob() is negative, then -** the behavior is undefined. -** If a non-negative fourth parameter is provided to sqlite3_bind_text() -** or sqlite3_bind_text16() then that parameter must be the byte offset -** where the NUL terminator would occur assuming the string were NUL -** terminated. If any NUL characters occur at byte offsets less than -** the value of the fourth parameter then the resulting string value will -** contain embedded NULs. The result of expressions involving strings -** with embedded NULs is undefined. -** -** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and -** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or -** string after SQLite has finished with it. ^The destructor is called -** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(), -** sqlite3_bind_text(), or sqlite3_bind_text16() fails. -** ^If the fifth argument is -** the special value [SQLITE_STATIC], then SQLite assumes that the -** information is in static, unmanaged space and does not need to be freed. -** ^If the fifth argument has the value [SQLITE_TRANSIENT], then -** SQLite makes its own private copy of the data immediately, before -** the sqlite3_bind_*() routine returns. -** -** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that -** is filled with zeroes. ^A zeroblob uses a fixed amount of memory -** (just an integer to hold its size) while it is being processed. -** Zeroblobs are intended to serve as placeholders for BLOBs whose -** content is later written using -** [sqlite3_blob_open | incremental BLOB I/O] routines. -** ^A negative value for the zeroblob results in a zero-length BLOB. -** -** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer -** for the [prepared statement] or with a prepared statement for which -** [sqlite3_step()] has been called more recently than [sqlite3_reset()], -** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() -** routine is passed a [prepared statement] that has been finalized, the -** result is undefined and probably harmful. -** -** ^Bindings are not cleared by the [sqlite3_reset()] routine. -** ^Unbound parameters are interpreted as NULL. -** -** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an -** [error code] if anything goes wrong. -** ^[SQLITE_RANGE] is returned if the parameter -** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. -** -** See also: [sqlite3_bind_parameter_count()], -** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. -*/ -SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); -SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); -SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); -SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); -SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); -SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); -SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); -SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); -SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); - -/* -** CAPI3REF: Number Of SQL Parameters -** -** ^This routine can be used to find the number of [SQL parameters] -** in a [prepared statement]. SQL parameters are tokens of the -** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as -** placeholders for values that are [sqlite3_bind_blob | bound] -** to the parameters at a later time. -** -** ^(This routine actually returns the index of the largest (rightmost) -** parameter. For all forms except ?NNN, this will correspond to the -** number of unique parameters. If parameters of the ?NNN form are used, -** there may be gaps in the list.)^ -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_name()], and -** [sqlite3_bind_parameter_index()]. -*/ -SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); - -/* -** CAPI3REF: Name Of A Host Parameter -** -** ^The sqlite3_bind_parameter_name(P,N) interface returns -** the name of the N-th [SQL parameter] in the [prepared statement] P. -** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" -** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" -** respectively. -** In other words, the initial ":" or "$" or "@" or "?" -** is included as part of the name.)^ -** ^Parameters of the form "?" without a following integer have no name -** and are referred to as "nameless" or "anonymous parameters". -** -** ^The first host parameter has an index of 1, not 0. -** -** ^If the value N is out of range or if the N-th parameter is -** nameless, then NULL is returned. ^The returned string is -** always in UTF-8 encoding even if the named parameter was -** originally specified as UTF-16 in [sqlite3_prepare16()] or -** [sqlite3_prepare16_v2()]. -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_count()], and -** [sqlite3_bind_parameter_index()]. -*/ -SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); - -/* -** CAPI3REF: Index Of A Parameter With A Given Name -** -** ^Return the index of an SQL parameter given its name. ^The -** index value returned is suitable for use as the second -** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero -** is returned if no matching parameter is found. ^The parameter -** name must be given in UTF-8 even if the original statement -** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_count()], and -** [sqlite3_bind_parameter_index()]. -*/ -SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); - -/* -** CAPI3REF: Reset All Bindings On A Prepared Statement -** -** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset -** the [sqlite3_bind_blob | bindings] on a [prepared statement]. -** ^Use this routine to reset all host parameters to NULL. -*/ -SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); - -/* -** CAPI3REF: Number Of Columns In A Result Set -** -** ^Return the number of columns in the result set returned by the -** [prepared statement]. ^This routine returns 0 if pStmt is an SQL -** statement that does not return data (for example an [UPDATE]). -** -** See also: [sqlite3_data_count()] -*/ -SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Column Names In A Result Set -** -** ^These routines return the name assigned to a particular column -** in the result set of a [SELECT] statement. ^The sqlite3_column_name() -** interface returns a pointer to a zero-terminated UTF-8 string -** and sqlite3_column_name16() returns a pointer to a zero-terminated -** UTF-16 string. ^The first parameter is the [prepared statement] -** that implements the [SELECT] statement. ^The second parameter is the -** column number. ^The leftmost column is number 0. -** -** ^The returned string pointer is valid until either the [prepared statement] -** is destroyed by [sqlite3_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite3_step()] for a particular run -** or until the next call to -** sqlite3_column_name() or sqlite3_column_name16() on the same column. -** -** ^If sqlite3_malloc() fails during the processing of either routine -** (for example during a conversion from UTF-8 to UTF-16) then a -** NULL pointer is returned. -** -** ^The name of a result column is the value of the "AS" clause for -** that column, if there is an AS clause. If there is no AS clause -** then the name of the column is unspecified and may change from -** one release of SQLite to the next. -*/ -SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N); -SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); - -/* -** CAPI3REF: Source Of Data In A Query Result -** -** ^These routines provide a means to determine the database, table, and -** table column that is the origin of a particular result column in -** [SELECT] statement. -** ^The name of the database or table or column can be returned as -** either a UTF-8 or UTF-16 string. ^The _database_ routines return -** the database name, the _table_ routines return the table name, and -** the origin_ routines return the column name. -** ^The returned string is valid until the [prepared statement] is destroyed -** using [sqlite3_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite3_step()] for a particular run -** or until the same information is requested -** again in a different encoding. -** -** ^The names returned are the original un-aliased names of the -** database, table, and column. -** -** ^The first argument to these interfaces is a [prepared statement]. -** ^These functions return information about the Nth result column returned by -** the statement, where N is the second function argument. -** ^The left-most column is column 0 for these routines. -** -** ^If the Nth column returned by the statement is an expression or -** subquery and is not a column value, then all of these functions return -** NULL. ^These routine might also return NULL if a memory allocation error -** occurs. ^Otherwise, they return the name of the attached database, table, -** or column that query result column was extracted from. -** -** ^As with all other SQLite APIs, those whose names end with "16" return -** UTF-16 encoded strings and the other functions return UTF-8. -** -** ^These APIs are only available if the library was compiled with the -** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. -** -** If two or more threads call one or more of these routines against the same -** prepared statement and column at the same time then the results are -** undefined. -** -** If two or more threads call one or more -** [sqlite3_column_database_name | column metadata interfaces] -** for the same [prepared statement] and result column -** at the same time then the results are undefined. -*/ -SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); -SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int); -SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); - -/* -** CAPI3REF: Declared Datatype Of A Query Result -** -** ^(The first parameter is a [prepared statement]. -** If this statement is a [SELECT] statement and the Nth column of the -** returned result set of that [SELECT] is a table column (not an -** expression or subquery) then the declared type of the table -** column is returned.)^ ^If the Nth column of the result set is an -** expression or subquery, then a NULL pointer is returned. -** ^The returned string is always UTF-8 encoded. -** -** ^(For example, given the database schema: -** -** CREATE TABLE t1(c1 VARIANT); -** -** and the following statement to be compiled: -** -** SELECT c1 + 1, c1 FROM t1; -** -** this routine would return the string "VARIANT" for the second result -** column (i==1), and a NULL pointer for the first result column (i==0).)^ -** -** ^SQLite uses dynamic run-time typing. ^So just because a column -** is declared to contain a particular type does not mean that the -** data stored in that column is of the declared type. SQLite is -** strongly typed, but the typing is dynamic not static. ^Type -** is associated with individual values, not with the containers -** used to hold those values. -*/ -SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); - -/* -** CAPI3REF: Evaluate An SQL Statement -** -** After a [prepared statement] has been prepared using either -** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy -** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function -** must be called one or more times to evaluate the statement. -** -** The details of the behavior of the sqlite3_step() interface depend -** on whether the statement was prepared using the newer "v2" interface -** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy -** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the -** new "v2" interface is recommended for new applications but the legacy -** interface will continue to be supported. -** -** ^In the legacy interface, the return value will be either [SQLITE_BUSY], -** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. -** ^With the "v2" interface, any of the other [result codes] or -** [extended result codes] might be returned as well. -** -** ^[SQLITE_BUSY] means that the database engine was unable to acquire the -** database locks it needs to do its job. ^If the statement is a [COMMIT] -** or occurs outside of an explicit transaction, then you can retry the -** statement. If the statement is not a [COMMIT] and occurs within an -** explicit transaction then you should rollback the transaction before -** continuing. -** -** ^[SQLITE_DONE] means that the statement has finished executing -** successfully. sqlite3_step() should not be called again on this virtual -** machine without first calling [sqlite3_reset()] to reset the virtual -** machine back to its initial state. -** -** ^If the SQL statement being executed returns any data, then [SQLITE_ROW] -** is returned each time a new row of data is ready for processing by the -** caller. The values may be accessed using the [column access functions]. -** sqlite3_step() is called again to retrieve the next row of data. -** -** ^[SQLITE_ERROR] means that a run-time error (such as a constraint -** violation) has occurred. sqlite3_step() should not be called again on -** the VM. More information may be found by calling [sqlite3_errmsg()]. -** ^With the legacy interface, a more specific error code (for example, -** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth) -** can be obtained by calling [sqlite3_reset()] on the -** [prepared statement]. ^In the "v2" interface, -** the more specific error code is returned directly by sqlite3_step(). -** -** [SQLITE_MISUSE] means that the this routine was called inappropriately. -** Perhaps it was called on a [prepared statement] that has -** already been [sqlite3_finalize | finalized] or on one that had -** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could -** be the case that the same database connection is being used by two or -** more threads at the same moment in time. -** -** For all versions of SQLite up to and including 3.6.23.1, a call to -** [sqlite3_reset()] was required after sqlite3_step() returned anything -** other than [SQLITE_ROW] before any subsequent invocation of -** sqlite3_step(). Failure to reset the prepared statement using -** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from -** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began -** calling [sqlite3_reset()] automatically in this circumstance rather -** than returning [SQLITE_MISUSE]. This is not considered a compatibility -** break because any application that ever receives an SQLITE_MISUSE error -** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option -** can be used to restore the legacy behavior. -** -** Goofy Interface Alert: In the legacy interface, the sqlite3_step() -** API always returns a generic error code, [SQLITE_ERROR], following any -** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call -** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the -** specific [error codes] that better describes the error. -** We admit that this is a goofy design. The problem has been fixed -** with the "v2" interface. If you prepare all of your SQL statements -** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead -** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, -** then the more specific [error codes] are returned directly -** by sqlite3_step(). The use of the "v2" interface is recommended. -*/ -SQLITE_API int sqlite3_step(sqlite3_stmt*); - -/* -** CAPI3REF: Number of columns in a result set -** -** ^The sqlite3_data_count(P) interface returns the number of columns in the -** current row of the result set of [prepared statement] P. -** ^If prepared statement P does not have results ready to return -** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of -** interfaces) then sqlite3_data_count(P) returns 0. -** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. -** ^The sqlite3_data_count(P) routine returns 0 if the previous call to -** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P) -** will return non-zero if previous call to [sqlite3_step](P) returned -** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum] -** where it always returns zero since each step of that multi-step -** pragma returns 0 columns of data. -** -** See also: [sqlite3_column_count()] -*/ -SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Fundamental Datatypes -** KEYWORDS: SQLITE_TEXT -** -** ^(Every value in SQLite has one of five fundamental datatypes: -** -**
    -**
  • 64-bit signed integer -**
  • 64-bit IEEE floating point number -**
  • string -**
  • BLOB -**
  • NULL -**
)^ -** -** These constants are codes for each of those types. -** -** Note that the SQLITE_TEXT constant was also used in SQLite version 2 -** for a completely different meaning. Software that links against both -** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not -** SQLITE_TEXT. -*/ -#define SQLITE_INTEGER 1 -#define SQLITE_FLOAT 2 -#define SQLITE_BLOB 4 -#define SQLITE_NULL 5 -#ifdef SQLITE_TEXT -# undef SQLITE_TEXT -#else -# define SQLITE_TEXT 3 -#endif -#define SQLITE3_TEXT 3 - -/* -** CAPI3REF: Result Values From A Query -** KEYWORDS: {column access functions} -** -** These routines form the "result set" interface. -** -** ^These routines return information about a single column of the current -** result row of a query. ^In every case the first argument is a pointer -** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] -** that was returned from [sqlite3_prepare_v2()] or one of its variants) -** and the second argument is the index of the column for which information -** should be returned. ^The leftmost column of the result set has the index 0. -** ^The number of columns in the result can be determined using -** [sqlite3_column_count()]. -** -** If the SQL statement does not currently point to a valid row, or if the -** column index is out of range, the result is undefined. -** These routines may only be called when the most recent call to -** [sqlite3_step()] has returned [SQLITE_ROW] and neither -** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. -** If any of these routines are called after [sqlite3_reset()] or -** [sqlite3_finalize()] or after [sqlite3_step()] has returned -** something other than [SQLITE_ROW], the results are undefined. -** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()] -** are called from a different thread while any of these routines -** are pending, then the results are undefined. -** -** ^The sqlite3_column_type() routine returns the -** [SQLITE_INTEGER | datatype code] for the initial data type -** of the result column. ^The returned value is one of [SQLITE_INTEGER], -** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value -** returned by sqlite3_column_type() is only meaningful if no type -** conversions have occurred as described below. After a type conversion, -** the value returned by sqlite3_column_type() is undefined. Future -** versions of SQLite may change the behavior of sqlite3_column_type() -** following a type conversion. -** -** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() -** routine returns the number of bytes in that BLOB or string. -** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts -** the string to UTF-8 and then returns the number of bytes. -** ^If the result is a numeric value then sqlite3_column_bytes() uses -** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns -** the number of bytes in that string. -** ^If the result is NULL, then sqlite3_column_bytes() returns zero. -** -** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16() -** routine returns the number of bytes in that BLOB or string. -** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts -** the string to UTF-16 and then returns the number of bytes. -** ^If the result is a numeric value then sqlite3_column_bytes16() uses -** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns -** the number of bytes in that string. -** ^If the result is NULL, then sqlite3_column_bytes16() returns zero. -** -** ^The values returned by [sqlite3_column_bytes()] and -** [sqlite3_column_bytes16()] do not include the zero terminators at the end -** of the string. ^For clarity: the values returned by -** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of -** bytes in the string, not the number of characters. -** -** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), -** even empty strings, are always zero-terminated. ^The return -** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. -** -** ^The object returned by [sqlite3_column_value()] is an -** [unprotected sqlite3_value] object. An unprotected sqlite3_value object -** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()]. -** If the [unprotected sqlite3_value] object returned by -** [sqlite3_column_value()] is used in any other way, including calls -** to routines like [sqlite3_value_int()], [sqlite3_value_text()], -** or [sqlite3_value_bytes()], then the behavior is undefined. -** -** These routines attempt to convert the value where appropriate. ^For -** example, if the internal representation is FLOAT and a text result -** is requested, [sqlite3_snprintf()] is used internally to perform the -** conversion automatically. ^(The following table details the conversions -** that are applied: -** -**
-** -**
Internal
Type
Requested
Type
Conversion -** -**
NULL INTEGER Result is 0 -**
NULL FLOAT Result is 0.0 -**
NULL TEXT Result is a NULL pointer -**
NULL BLOB Result is a NULL pointer -**
INTEGER FLOAT Convert from integer to float -**
INTEGER TEXT ASCII rendering of the integer -**
INTEGER BLOB Same as INTEGER->TEXT -**
FLOAT INTEGER [CAST] to INTEGER -**
FLOAT TEXT ASCII rendering of the float -**
FLOAT BLOB [CAST] to BLOB -**
TEXT INTEGER [CAST] to INTEGER -**
TEXT FLOAT [CAST] to REAL -**
TEXT BLOB No change -**
BLOB INTEGER [CAST] to INTEGER -**
BLOB FLOAT [CAST] to REAL -**
BLOB TEXT Add a zero terminator if needed -**
-**
)^ -** -** The table above makes reference to standard C library functions atoi() -** and atof(). SQLite does not really use these functions. It has its -** own equivalent internal routines. The atoi() and atof() names are -** used in the table for brevity and because they are familiar to most -** C programmers. -** -** Note that when type conversions occur, pointers returned by prior -** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or -** sqlite3_column_text16() may be invalidated. -** Type conversions and pointer invalidations might occur -** in the following cases: -** -**
    -**
  • The initial content is a BLOB and sqlite3_column_text() or -** sqlite3_column_text16() is called. A zero-terminator might -** need to be added to the string.
  • -**
  • The initial content is UTF-8 text and sqlite3_column_bytes16() or -** sqlite3_column_text16() is called. The content must be converted -** to UTF-16.
  • -**
  • The initial content is UTF-16 text and sqlite3_column_bytes() or -** sqlite3_column_text() is called. The content must be converted -** to UTF-8.
  • -**
-** -** ^Conversions between UTF-16be and UTF-16le are always done in place and do -** not invalidate a prior pointer, though of course the content of the buffer -** that the prior pointer references will have been modified. Other kinds -** of conversion are done in place when it is possible, but sometimes they -** are not possible and in those cases prior pointers are invalidated. -** -** The safest and easiest to remember policy is to invoke these routines -** in one of the following ways: -** -**
    -**
  • sqlite3_column_text() followed by sqlite3_column_bytes()
  • -**
  • sqlite3_column_blob() followed by sqlite3_column_bytes()
  • -**
  • sqlite3_column_text16() followed by sqlite3_column_bytes16()
  • -**
-** -** In other words, you should call sqlite3_column_text(), -** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result -** into the desired format, then invoke sqlite3_column_bytes() or -** sqlite3_column_bytes16() to find the size of the result. Do not mix calls -** to sqlite3_column_text() or sqlite3_column_blob() with calls to -** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() -** with calls to sqlite3_column_bytes(). -** -** ^The pointers returned are valid until a type conversion occurs as -** described above, or until [sqlite3_step()] or [sqlite3_reset()] or -** [sqlite3_finalize()] is called. ^The memory space used to hold strings -** and BLOBs is freed automatically. Do not pass the pointers returned -** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into -** [sqlite3_free()]. -** -** ^(If a memory allocation error occurs during the evaluation of any -** of these routines, a default value is returned. The default value -** is either the integer 0, the floating point number 0.0, or a NULL -** pointer. Subsequent calls to [sqlite3_errcode()] will return -** [SQLITE_NOMEM].)^ -*/ -SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); -SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); -SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); -SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); -SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); -SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); - -/* -** CAPI3REF: Destroy A Prepared Statement Object -** -** ^The sqlite3_finalize() function is called to delete a [prepared statement]. -** ^If the most recent evaluation of the statement encountered no errors -** or if the statement is never been evaluated, then sqlite3_finalize() returns -** SQLITE_OK. ^If the most recent evaluation of statement S failed, then -** sqlite3_finalize(S) returns the appropriate [error code] or -** [extended error code]. -** -** ^The sqlite3_finalize(S) routine can be called at any point during -** the life cycle of [prepared statement] S: -** before statement S is ever evaluated, after -** one or more calls to [sqlite3_reset()], or after any call -** to [sqlite3_step()] regardless of whether or not the statement has -** completed execution. -** -** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. -** -** The application must finalize every [prepared statement] in order to avoid -** resource leaks. It is a grievous error for the application to try to use -** a prepared statement after it has been finalized. Any use of a prepared -** statement after it has been finalized can result in undefined and -** undesirable behavior such as segfaults and heap corruption. -*/ -SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Reset A Prepared Statement Object -** -** The sqlite3_reset() function is called to reset a [prepared statement] -** object back to its initial state, ready to be re-executed. -** ^Any SQL statement variables that had values bound to them using -** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. -** Use [sqlite3_clear_bindings()] to reset the bindings. -** -** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S -** back to the beginning of its program. -** -** ^If the most recent call to [sqlite3_step(S)] for the -** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], -** or if [sqlite3_step(S)] has never before been called on S, -** then [sqlite3_reset(S)] returns [SQLITE_OK]. -** -** ^If the most recent call to [sqlite3_step(S)] for the -** [prepared statement] S indicated an error, then -** [sqlite3_reset(S)] returns an appropriate [error code]. -** -** ^The [sqlite3_reset(S)] interface does not change the values -** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. -*/ -SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Create Or Redefine SQL Functions -** KEYWORDS: {function creation routines} -** KEYWORDS: {application-defined SQL function} -** KEYWORDS: {application-defined SQL functions} -** -** ^These functions (collectively known as "function creation routines") -** are used to add SQL functions or aggregates or to redefine the behavior -** of existing SQL functions or aggregates. The only differences between -** these routines are the text encoding expected for -** the second parameter (the name of the function being created) -** and the presence or absence of a destructor callback for -** the application data pointer. -** -** ^The first parameter is the [database connection] to which the SQL -** function is to be added. ^If an application uses more than one database -** connection then application-defined SQL functions must be added -** to each database connection separately. -** -** ^The second parameter is the name of the SQL function to be created or -** redefined. ^The length of the name is limited to 255 bytes in a UTF-8 -** representation, exclusive of the zero-terminator. ^Note that the name -** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. -** ^Any attempt to create a function with a longer name -** will result in [SQLITE_MISUSE] being returned. -** -** ^The third parameter (nArg) -** is the number of arguments that the SQL function or -** aggregate takes. ^If this parameter is -1, then the SQL function or -** aggregate may take any number of arguments between 0 and the limit -** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third -** parameter is less than -1 or greater than 127 then the behavior is -** undefined. -** -** ^The fourth parameter, eTextRep, specifies what -** [SQLITE_UTF8 | text encoding] this SQL function prefers for -** its parameters. The application should set this parameter to -** [SQLITE_UTF16LE] if the function implementation invokes -** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the -** implementation invokes [sqlite3_value_text16be()] on an input, or -** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] -** otherwise. ^The same SQL function may be registered multiple times using -** different preferred text encodings, with different implementations for -** each encoding. -** ^When multiple implementations of the same function are available, SQLite -** will pick the one that involves the least amount of data conversion. -** -** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] -** to signal that the function will always return the same result given -** the same inputs within a single SQL statement. Most SQL functions are -** deterministic. The built-in [random()] SQL function is an example of a -** function that is not deterministic. The SQLite query planner is able to -** perform additional optimizations on deterministic functions, so use -** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. -** -** ^(The fifth parameter is an arbitrary pointer. The implementation of the -** function can gain access to this pointer using [sqlite3_user_data()].)^ -** -** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are -** pointers to C-language functions that implement the SQL function or -** aggregate. ^A scalar SQL function requires an implementation of the xFunc -** callback only; NULL pointers must be passed as the xStep and xFinal -** parameters. ^An aggregate SQL function requires an implementation of xStep -** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing -** SQL function or aggregate, pass NULL pointers for all three function -** callbacks. -** -** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL, -** then it is destructor for the application data pointer. -** The destructor is invoked when the function is deleted, either by being -** overloaded or when the database connection closes.)^ -** ^The destructor is also invoked if the call to -** sqlite3_create_function_v2() fails. -** ^When the destructor callback of the tenth parameter is invoked, it -** is passed a single argument which is a copy of the application data -** pointer which was the fifth parameter to sqlite3_create_function_v2(). -** -** ^It is permitted to register multiple implementations of the same -** functions with the same name but with either differing numbers of -** arguments or differing preferred text encodings. ^SQLite will use -** the implementation that most closely matches the way in which the -** SQL function is used. ^A function implementation with a non-negative -** nArg parameter is a better match than a function implementation with -** a negative nArg. ^A function where the preferred text encoding -** matches the database encoding is a better -** match than a function where the encoding is different. -** ^A function where the encoding difference is between UTF16le and UTF16be -** is a closer match than a function where the encoding difference is -** between UTF8 and UTF16. -** -** ^Built-in functions may be overloaded by new application-defined functions. -** -** ^An application-defined function is permitted to call other -** SQLite interfaces. However, such calls must not -** close the database connection nor finalize or reset the prepared -** statement in which the function is running. -*/ -SQLITE_API int sqlite3_create_function( - sqlite3 *db, - const char *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) -); -SQLITE_API int sqlite3_create_function16( - sqlite3 *db, - const void *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) -); -SQLITE_API int sqlite3_create_function_v2( - sqlite3 *db, - const char *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void(*xDestroy)(void*) -); - -/* -** CAPI3REF: Text Encodings -** -** These constant define integer codes that represent the various -** text encodings supported by SQLite. -*/ -#define SQLITE_UTF8 1 -#define SQLITE_UTF16LE 2 -#define SQLITE_UTF16BE 3 -#define SQLITE_UTF16 4 /* Use native byte order */ -#define SQLITE_ANY 5 /* Deprecated */ -#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ - -/* -** CAPI3REF: Function Flags -** -** These constants may be ORed together with the -** [SQLITE_UTF8 | preferred text encoding] as the fourth argument -** to [sqlite3_create_function()], [sqlite3_create_function16()], or -** [sqlite3_create_function_v2()]. -*/ -#define SQLITE_DETERMINISTIC 0x800 - -/* -** CAPI3REF: Deprecated Functions -** DEPRECATED -** -** These functions are [deprecated]. In order to maintain -** backwards compatibility with older code, these functions continue -** to be supported. However, new applications should avoid -** the use of these functions. To help encourage people to avoid -** using these functions, we are not going to tell you what they do. -*/ -#ifndef SQLITE_OMIT_DEPRECATED -SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); -SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); -SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int), - void*,sqlite3_int64); -#endif - -/* -** CAPI3REF: Obtaining SQL Function Parameter Values -** -** The C-language implementation of SQL functions and aggregates uses -** this set of interface routines to access the parameter values on -** the function or aggregate. -** -** The xFunc (for scalar functions) or xStep (for aggregates) parameters -** to [sqlite3_create_function()] and [sqlite3_create_function16()] -** define callbacks that implement the SQL functions and aggregates. -** The 3rd parameter to these callbacks is an array of pointers to -** [protected sqlite3_value] objects. There is one [sqlite3_value] object for -** each parameter to the SQL function. These routines are used to -** extract values from the [sqlite3_value] objects. -** -** These routines work only with [protected sqlite3_value] objects. -** Any attempt to use these routines on an [unprotected sqlite3_value] -** object results in undefined behavior. -** -** ^These routines work just like the corresponding [column access functions] -** except that these routines take a single [protected sqlite3_value] object -** pointer instead of a [sqlite3_stmt*] pointer and an integer column number. -** -** ^The sqlite3_value_text16() interface extracts a UTF-16 string -** in the native byte-order of the host machine. ^The -** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces -** extract UTF-16 strings as big-endian and little-endian respectively. -** -** ^(The sqlite3_value_numeric_type() interface attempts to apply -** numeric affinity to the value. This means that an attempt is -** made to convert the value to an integer or floating point. If -** such a conversion is possible without loss of information (in other -** words, if the value is a string that looks like a number) -** then the conversion is performed. Otherwise no conversion occurs. -** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ -** -** Please pay particular attention to the fact that the pointer returned -** from [sqlite3_value_blob()], [sqlite3_value_text()], or -** [sqlite3_value_text16()] can be invalidated by a subsequent call to -** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], -** or [sqlite3_value_text16()]. -** -** These routines must be called from the same thread as -** the SQL function that supplied the [sqlite3_value*] parameters. -*/ -SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); -SQLITE_API int sqlite3_value_bytes(sqlite3_value*); -SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); -SQLITE_API double sqlite3_value_double(sqlite3_value*); -SQLITE_API int sqlite3_value_int(sqlite3_value*); -SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); -SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); -SQLITE_API int sqlite3_value_type(sqlite3_value*); -SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); - -/* -** CAPI3REF: Obtain Aggregate Function Context -** -** Implementations of aggregate SQL functions use this -** routine to allocate memory for storing their state. -** -** ^The first time the sqlite3_aggregate_context(C,N) routine is called -** for a particular aggregate function, SQLite -** allocates N of memory, zeroes out that memory, and returns a pointer -** to the new memory. ^On second and subsequent calls to -** sqlite3_aggregate_context() for the same aggregate function instance, -** the same buffer is returned. Sqlite3_aggregate_context() is normally -** called once for each invocation of the xStep callback and then one -** last time when the xFinal callback is invoked. ^(When no rows match -** an aggregate query, the xStep() callback of the aggregate function -** implementation is never called and xFinal() is called exactly once. -** In those cases, sqlite3_aggregate_context() might be called for the -** first time from within xFinal().)^ -** -** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer -** when first called if N is less than or equal to zero or if a memory -** allocate error occurs. -** -** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is -** determined by the N parameter on first successful call. Changing the -** value of N in subsequent call to sqlite3_aggregate_context() within -** the same aggregate function instance will not resize the memory -** allocation.)^ Within the xFinal callback, it is customary to set -** N=0 in calls to sqlite3_aggregate_context(C,N) so that no -** pointless memory allocations occur. -** -** ^SQLite automatically frees the memory allocated by -** sqlite3_aggregate_context() when the aggregate query concludes. -** -** The first parameter must be a copy of the -** [sqlite3_context | SQL function context] that is the first parameter -** to the xStep or xFinal callback routine that implements the aggregate -** function. -** -** This routine must be called from the same thread in which -** the aggregate SQL function is running. -*/ -SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); - -/* -** CAPI3REF: User Data For Functions -** -** ^The sqlite3_user_data() interface returns a copy of -** the pointer that was the pUserData parameter (the 5th parameter) -** of the [sqlite3_create_function()] -** and [sqlite3_create_function16()] routines that originally -** registered the application defined function. -** -** This routine must be called from the same thread in which -** the application-defined function is running. -*/ -SQLITE_API void *sqlite3_user_data(sqlite3_context*); - -/* -** CAPI3REF: Database Connection For Functions -** -** ^The sqlite3_context_db_handle() interface returns a copy of -** the pointer to the [database connection] (the 1st parameter) -** of the [sqlite3_create_function()] -** and [sqlite3_create_function16()] routines that originally -** registered the application defined function. -*/ -SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); - -/* -** CAPI3REF: Function Auxiliary Data -** -** These functions may be used by (non-aggregate) SQL functions to -** associate metadata with argument values. If the same value is passed to -** multiple invocations of the same SQL function during query execution, under -** some circumstances the associated metadata may be preserved. An example -** of where this might be useful is in a regular-expression matching -** function. The compiled version of the regular expression can be stored as -** metadata associated with the pattern string. -** Then as long as the pattern string remains the same, -** the compiled regular expression can be reused on multiple -** invocations of the same function. -** -** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata -** associated by the sqlite3_set_auxdata() function with the Nth argument -** value to the application-defined function. ^If there is no metadata -** associated with the function argument, this sqlite3_get_auxdata() interface -** returns a NULL pointer. -** -** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th -** argument of the application-defined function. ^Subsequent -** calls to sqlite3_get_auxdata(C,N) return P from the most recent -** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or -** NULL if the metadata has been discarded. -** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, -** SQLite will invoke the destructor function X with parameter P exactly -** once, when the metadata is discarded. -** SQLite is free to discard the metadata at any time, including:
    -**
  • when the corresponding function parameter changes, or -**
  • when [sqlite3_reset()] or [sqlite3_finalize()] is called for the -** SQL statement, or -**
  • when sqlite3_set_auxdata() is invoked again on the same parameter, or -**
  • during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.
)^ -** -** Note the last bullet in particular. The destructor X in -** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the -** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() -** should be called near the end of the function implementation and the -** function implementation should not make any use of P after -** sqlite3_set_auxdata() has been called. -** -** ^(In practice, metadata is preserved between function calls for -** function parameters that are compile-time constants, including literal -** values and [parameters] and expressions composed from the same.)^ -** -** These routines must be called from the same thread in which -** the SQL function is running. -*/ -SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); -SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); - - -/* -** CAPI3REF: Constants Defining Special Destructor Behavior -** -** These are special values for the destructor that is passed in as the -** final argument to routines like [sqlite3_result_blob()]. ^If the destructor -** argument is SQLITE_STATIC, it means that the content pointer is constant -** and will never change. It does not need to be destroyed. ^The -** SQLITE_TRANSIENT value means that the content will likely change in -** the near future and that SQLite should make its own private copy of -** the content before returning. -** -** The typedef is necessary to work around problems in certain -** C++ compilers. -*/ -typedef void (*sqlite3_destructor_type)(void*); -#define SQLITE_STATIC ((sqlite3_destructor_type)0) -#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) - -/* -** CAPI3REF: Setting The Result Of An SQL Function -** -** These routines are used by the xFunc or xFinal callbacks that -** implement SQL functions and aggregates. See -** [sqlite3_create_function()] and [sqlite3_create_function16()] -** for additional information. -** -** These functions work very much like the [parameter binding] family of -** functions used to bind values to host parameters in prepared statements. -** Refer to the [SQL parameter] documentation for additional information. -** -** ^The sqlite3_result_blob() interface sets the result from -** an application-defined function to be the BLOB whose content is pointed -** to by the second parameter and which is N bytes long where N is the -** third parameter. -** -** ^The sqlite3_result_zeroblob() interfaces set the result of -** the application-defined function to be a BLOB containing all zero -** bytes and N bytes in size, where N is the value of the 2nd parameter. -** -** ^The sqlite3_result_double() interface sets the result from -** an application-defined function to be a floating point value specified -** by its 2nd argument. -** -** ^The sqlite3_result_error() and sqlite3_result_error16() functions -** cause the implemented SQL function to throw an exception. -** ^SQLite uses the string pointed to by the -** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() -** as the text of an error message. ^SQLite interprets the error -** message string from sqlite3_result_error() as UTF-8. ^SQLite -** interprets the string from sqlite3_result_error16() as UTF-16 in native -** byte order. ^If the third parameter to sqlite3_result_error() -** or sqlite3_result_error16() is negative then SQLite takes as the error -** message all text up through the first zero character. -** ^If the third parameter to sqlite3_result_error() or -** sqlite3_result_error16() is non-negative then SQLite takes that many -** bytes (not characters) from the 2nd parameter as the error message. -** ^The sqlite3_result_error() and sqlite3_result_error16() -** routines make a private copy of the error message text before -** they return. Hence, the calling function can deallocate or -** modify the text after they return without harm. -** ^The sqlite3_result_error_code() function changes the error code -** returned by SQLite as a result of an error in a function. ^By default, -** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error() -** or sqlite3_result_error16() resets the error code to SQLITE_ERROR. -** -** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an -** error indicating that a string or BLOB is too long to represent. -** -** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an -** error indicating that a memory allocation failed. -** -** ^The sqlite3_result_int() interface sets the return value -** of the application-defined function to be the 32-bit signed integer -** value given in the 2nd argument. -** ^The sqlite3_result_int64() interface sets the return value -** of the application-defined function to be the 64-bit signed integer -** value given in the 2nd argument. -** -** ^The sqlite3_result_null() interface sets the return value -** of the application-defined function to be NULL. -** -** ^The sqlite3_result_text(), sqlite3_result_text16(), -** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces -** set the return value of the application-defined function to be -** a text string which is represented as UTF-8, UTF-16 native byte order, -** UTF-16 little endian, or UTF-16 big endian, respectively. -** ^SQLite takes the text result from the application from -** the 2nd parameter of the sqlite3_result_text* interfaces. -** ^If the 3rd parameter to the sqlite3_result_text* interfaces -** is negative, then SQLite takes result text from the 2nd parameter -** through the first zero character. -** ^If the 3rd parameter to the sqlite3_result_text* interfaces -** is non-negative, then as many bytes (not characters) of the text -** pointed to by the 2nd parameter are taken as the application-defined -** function result. If the 3rd parameter is non-negative, then it -** must be the byte offset into the string where the NUL terminator would -** appear if the string where NUL terminated. If any NUL characters occur -** in the string at a byte offset that is less than the value of the 3rd -** parameter, then the resulting string will contain embedded NULs and the -** result of expressions operating on strings with embedded NULs is undefined. -** ^If the 4th parameter to the sqlite3_result_text* interfaces -** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that -** function as the destructor on the text or BLOB result when it has -** finished using that result. -** ^If the 4th parameter to the sqlite3_result_text* interfaces or to -** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite -** assumes that the text or BLOB result is in constant space and does not -** copy the content of the parameter nor call a destructor on the content -** when it has finished using that result. -** ^If the 4th parameter to the sqlite3_result_text* interfaces -** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT -** then SQLite makes a copy of the result into space obtained from -** from [sqlite3_malloc()] before it returns. -** -** ^The sqlite3_result_value() interface sets the result of -** the application-defined function to be a copy the -** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The -** sqlite3_result_value() interface makes a copy of the [sqlite3_value] -** so that the [sqlite3_value] specified in the parameter may change or -** be deallocated after sqlite3_result_value() returns without harm. -** ^A [protected sqlite3_value] object may always be used where an -** [unprotected sqlite3_value] object is required, so either -** kind of [sqlite3_value] object can be used with this interface. -** -** If these routines are called from within the different thread -** than the one containing the application-defined function that received -** the [sqlite3_context] pointer, the results are undefined. -*/ -SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_double(sqlite3_context*, double); -SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); -SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); -SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); -SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); -SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); -SQLITE_API void sqlite3_result_int(sqlite3_context*, int); -SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); -SQLITE_API void sqlite3_result_null(sqlite3_context*); -SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); -SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); -SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); -SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); - -/* -** CAPI3REF: Define New Collating Sequences -** -** ^These functions add, remove, or modify a [collation] associated -** with the [database connection] specified as the first argument. -** -** ^The name of the collation is a UTF-8 string -** for sqlite3_create_collation() and sqlite3_create_collation_v2() -** and a UTF-16 string in native byte order for sqlite3_create_collation16(). -** ^Collation names that compare equal according to [sqlite3_strnicmp()] are -** considered to be the same name. -** -** ^(The third argument (eTextRep) must be one of the constants: -**
    -**
  • [SQLITE_UTF8], -**
  • [SQLITE_UTF16LE], -**
  • [SQLITE_UTF16BE], -**
  • [SQLITE_UTF16], or -**
  • [SQLITE_UTF16_ALIGNED]. -**
)^ -** ^The eTextRep argument determines the encoding of strings passed -** to the collating function callback, xCallback. -** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep -** force strings to be UTF16 with native byte order. -** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin -** on an even byte address. -** -** ^The fourth argument, pArg, is an application data pointer that is passed -** through as the first argument to the collating function callback. -** -** ^The fifth argument, xCallback, is a pointer to the collating function. -** ^Multiple collating functions can be registered using the same name but -** with different eTextRep parameters and SQLite will use whichever -** function requires the least amount of data transformation. -** ^If the xCallback argument is NULL then the collating function is -** deleted. ^When all collating functions having the same name are deleted, -** that collation is no longer usable. -** -** ^The collating function callback is invoked with a copy of the pArg -** application data pointer and with two strings in the encoding specified -** by the eTextRep argument. The collating function must return an -** integer that is negative, zero, or positive -** if the first string is less than, equal to, or greater than the second, -** respectively. A collating function must always return the same answer -** given the same inputs. If two or more collating functions are registered -** to the same collation name (using different eTextRep values) then all -** must give an equivalent answer when invoked with equivalent strings. -** The collating function must obey the following properties for all -** strings A, B, and C: -** -**
    -**
  1. If A==B then B==A. -**
  2. If A==B and B==C then A==C. -**
  3. If A<B THEN B>A. -**
  4. If A<B and B<C then A<C. -**
-** -** If a collating function fails any of the above constraints and that -** collating function is registered and used, then the behavior of SQLite -** is undefined. -** -** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() -** with the addition that the xDestroy callback is invoked on pArg when -** the collating function is deleted. -** ^Collating functions are deleted when they are overridden by later -** calls to the collation creation functions or when the -** [database connection] is closed using [sqlite3_close()]. -** -** ^The xDestroy callback is not called if the -** sqlite3_create_collation_v2() function fails. Applications that invoke -** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should -** check the return code and dispose of the application data pointer -** themselves rather than expecting SQLite to deal with it for them. -** This is different from every other SQLite interface. The inconsistency -** is unfortunate but cannot be changed without breaking backwards -** compatibility. -** -** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. -*/ -SQLITE_API int sqlite3_create_collation( - sqlite3*, - const char *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*) -); -SQLITE_API int sqlite3_create_collation_v2( - sqlite3*, - const char *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*), - void(*xDestroy)(void*) -); -SQLITE_API int sqlite3_create_collation16( - sqlite3*, - const void *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*) -); - -/* -** CAPI3REF: Collation Needed Callbacks -** -** ^To avoid having to register all collation sequences before a database -** can be used, a single callback function may be registered with the -** [database connection] to be invoked whenever an undefined collation -** sequence is required. -** -** ^If the function is registered using the sqlite3_collation_needed() API, -** then it is passed the names of undefined collation sequences as strings -** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, -** the names are passed as UTF-16 in machine native byte order. -** ^A call to either function replaces the existing collation-needed callback. -** -** ^(When the callback is invoked, the first argument passed is a copy -** of the second argument to sqlite3_collation_needed() or -** sqlite3_collation_needed16(). The second argument is the database -** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], -** or [SQLITE_UTF16LE], indicating the most desirable form of the collation -** sequence function required. The fourth parameter is the name of the -** required collation sequence.)^ -** -** The callback function should register the desired collation using -** [sqlite3_create_collation()], [sqlite3_create_collation16()], or -** [sqlite3_create_collation_v2()]. -*/ -SQLITE_API int sqlite3_collation_needed( - sqlite3*, - void*, - void(*)(void*,sqlite3*,int eTextRep,const char*) -); -SQLITE_API int sqlite3_collation_needed16( - sqlite3*, - void*, - void(*)(void*,sqlite3*,int eTextRep,const void*) -); - -#ifdef SQLITE_HAS_CODEC -/* -** Specify the key for an encrypted database. This routine should be -** called right after sqlite3_open(). -** -** The code to implement this API is not available in the public release -** of SQLite. -*/ -SQLITE_API int sqlite3_key( - sqlite3 *db, /* Database to be rekeyed */ - const void *pKey, int nKey /* The key */ -); -SQLITE_API int sqlite3_key_v2( - sqlite3 *db, /* Database to be rekeyed */ - const char *zDbName, /* Name of the database */ - const void *pKey, int nKey /* The key */ -); - -/* -** Change the key on an open database. If the current database is not -** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the -** database is decrypted. -** -** The code to implement this API is not available in the public release -** of SQLite. -*/ -SQLITE_API int sqlite3_rekey( - sqlite3 *db, /* Database to be rekeyed */ - const void *pKey, int nKey /* The new key */ -); -SQLITE_API int sqlite3_rekey_v2( - sqlite3 *db, /* Database to be rekeyed */ - const char *zDbName, /* Name of the database */ - const void *pKey, int nKey /* The new key */ -); - -/* -** Specify the activation key for a SEE database. Unless -** activated, none of the SEE routines will work. -*/ -SQLITE_API void sqlite3_activate_see( - const char *zPassPhrase /* Activation phrase */ -); -#endif - -#ifdef SQLITE_ENABLE_CEROD -/* -** Specify the activation key for a CEROD database. Unless -** activated, none of the CEROD routines will work. -*/ -SQLITE_API void sqlite3_activate_cerod( - const char *zPassPhrase /* Activation phrase */ -); -#endif - -/* -** CAPI3REF: Suspend Execution For A Short Time -** -** The sqlite3_sleep() function causes the current thread to suspend execution -** for at least a number of milliseconds specified in its parameter. -** -** If the operating system does not support sleep requests with -** millisecond time resolution, then the time will be rounded up to -** the nearest second. The number of milliseconds of sleep actually -** requested from the operating system is returned. -** -** ^SQLite implements this interface by calling the xSleep() -** method of the default [sqlite3_vfs] object. If the xSleep() method -** of the default VFS is not implemented correctly, or not implemented at -** all, then the behavior of sqlite3_sleep() may deviate from the description -** in the previous paragraphs. -*/ -SQLITE_API int sqlite3_sleep(int); - -/* -** CAPI3REF: Name Of The Folder Holding Temporary Files -** -** ^(If this global variable is made to point to a string which is -** the name of a folder (a.k.a. directory), then all temporary files -** created by SQLite when using a built-in [sqlite3_vfs | VFS] -** will be placed in that directory.)^ ^If this variable -** is a NULL pointer, then SQLite performs a search for an appropriate -** temporary file directory. -** -** It is not safe to read or modify this variable in more than one -** thread at a time. It is not safe to read or modify this variable -** if a [database connection] is being used at the same time in a separate -** thread. -** It is intended that this variable be set once -** as part of process initialization and before any SQLite interface -** routines have been called and that this variable remain unchanged -** thereafter. -** -** ^The [temp_store_directory pragma] may modify this variable and cause -** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, -** the [temp_store_directory pragma] always assumes that any string -** that this variable points to is held in memory obtained from -** [sqlite3_malloc] and the pragma may attempt to free that memory -** using [sqlite3_free]. -** Hence, if this variable is modified directly, either it should be -** made NULL or made to point to memory obtained from [sqlite3_malloc] -** or else the use of the [temp_store_directory pragma] should be avoided. -** -** Note to Windows Runtime users: The temporary directory must be set -** prior to calling [sqlite3_open] or [sqlite3_open_v2]. Otherwise, various -** features that require the use of temporary files may fail. Here is an -** example of how to do this using C++ with the Windows Runtime: -** -**
-** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->
-**       TemporaryFolder->Path->Data();
-** char zPathBuf[MAX_PATH + 1];
-** memset(zPathBuf, 0, sizeof(zPathBuf));
-** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
-**       NULL, NULL);
-** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf);
-** 
-*/ -SQLITE_API char *sqlite3_temp_directory; - -/* -** CAPI3REF: Name Of The Folder Holding Database Files -** -** ^(If this global variable is made to point to a string which is -** the name of a folder (a.k.a. directory), then all database files -** specified with a relative pathname and created or accessed by -** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed -** to be relative to that directory.)^ ^If this variable is a NULL -** pointer, then SQLite assumes that all database files specified -** with a relative pathname are relative to the current directory -** for the process. Only the windows VFS makes use of this global -** variable; it is ignored by the unix VFS. -** -** Changing the value of this variable while a database connection is -** open can result in a corrupt database. -** -** It is not safe to read or modify this variable in more than one -** thread at a time. It is not safe to read or modify this variable -** if a [database connection] is being used at the same time in a separate -** thread. -** It is intended that this variable be set once -** as part of process initialization and before any SQLite interface -** routines have been called and that this variable remain unchanged -** thereafter. -** -** ^The [data_store_directory pragma] may modify this variable and cause -** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, -** the [data_store_directory pragma] always assumes that any string -** that this variable points to is held in memory obtained from -** [sqlite3_malloc] and the pragma may attempt to free that memory -** using [sqlite3_free]. -** Hence, if this variable is modified directly, either it should be -** made NULL or made to point to memory obtained from [sqlite3_malloc] -** or else the use of the [data_store_directory pragma] should be avoided. -*/ -SQLITE_API char *sqlite3_data_directory; - -/* -** CAPI3REF: Test For Auto-Commit Mode -** KEYWORDS: {autocommit mode} -** -** ^The sqlite3_get_autocommit() interface returns non-zero or -** zero if the given database connection is or is not in autocommit mode, -** respectively. ^Autocommit mode is on by default. -** ^Autocommit mode is disabled by a [BEGIN] statement. -** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK]. -** -** If certain kinds of errors occur on a statement within a multi-statement -** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR], -** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the -** transaction might be rolled back automatically. The only way to -** find out whether SQLite automatically rolled back the transaction after -** an error is to use this function. -** -** If another thread changes the autocommit status of the database -** connection while this routine is running, then the return value -** is undefined. -*/ -SQLITE_API int sqlite3_get_autocommit(sqlite3*); - -/* -** CAPI3REF: Find The Database Handle Of A Prepared Statement -** -** ^The sqlite3_db_handle interface returns the [database connection] handle -** to which a [prepared statement] belongs. ^The [database connection] -** returned by sqlite3_db_handle is the same [database connection] -** that was the first argument -** to the [sqlite3_prepare_v2()] call (or its variants) that was used to -** create the statement in the first place. -*/ -SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); - -/* -** CAPI3REF: Return The Filename For A Database Connection -** -** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename -** associated with database N of connection D. ^The main database file -** has the name "main". If there is no attached database N on the database -** connection D, or if database N is a temporary or in-memory database, then -** a NULL pointer is returned. -** -** ^The filename returned by this function is the output of the -** xFullPathname method of the [VFS]. ^In other words, the filename -** will be an absolute pathname, even if the filename used -** to open the database originally was a URI or relative pathname. -*/ -SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName); - -/* -** CAPI3REF: Determine if a database is read-only -** -** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N -** of connection D is read-only, 0 if it is read/write, or -1 if N is not -** the name of a database on connection D. -*/ -SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); - -/* -** CAPI3REF: Find the next prepared statement -** -** ^This interface returns a pointer to the next [prepared statement] after -** pStmt associated with the [database connection] pDb. ^If pStmt is NULL -** then this interface returns a pointer to the first prepared statement -** associated with the database connection pDb. ^If no prepared statement -** satisfies the conditions of this routine, it returns NULL. -** -** The [database connection] pointer D in a call to -** [sqlite3_next_stmt(D,S)] must refer to an open database -** connection and in particular must not be a NULL pointer. -*/ -SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Commit And Rollback Notification Callbacks -** -** ^The sqlite3_commit_hook() interface registers a callback -** function to be invoked whenever a transaction is [COMMIT | committed]. -** ^Any callback set by a previous call to sqlite3_commit_hook() -** for the same database connection is overridden. -** ^The sqlite3_rollback_hook() interface registers a callback -** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. -** ^Any callback set by a previous call to sqlite3_rollback_hook() -** for the same database connection is overridden. -** ^The pArg argument is passed through to the callback. -** ^If the callback on a commit hook function returns non-zero, -** then the commit is converted into a rollback. -** -** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions -** return the P argument from the previous call of the same function -** on the same [database connection] D, or NULL for -** the first call for each function on D. -** -** The commit and rollback hook callbacks are not reentrant. -** The callback implementation must not do anything that will modify -** the database connection that invoked the callback. Any actions -** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the commit -** or rollback hook in the first place. -** Note that running any other SQL statements, including SELECT statements, -** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify -** the database connections for the meaning of "modify" in this paragraph. -** -** ^Registering a NULL function disables the callback. -** -** ^When the commit hook callback routine returns zero, the [COMMIT] -** operation is allowed to continue normally. ^If the commit hook -** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK]. -** ^The rollback hook is invoked on a rollback that results from a commit -** hook returning non-zero, just as it would be with any other rollback. -** -** ^For the purposes of this API, a transaction is said to have been -** rolled back if an explicit "ROLLBACK" statement is executed, or -** an error or constraint causes an implicit rollback to occur. -** ^The rollback callback is not invoked if a transaction is -** automatically rolled back because the database connection is closed. -** -** See also the [sqlite3_update_hook()] interface. -*/ -SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); -SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); - -/* -** CAPI3REF: Data Change Notification Callbacks -** -** ^The sqlite3_update_hook() interface registers a callback function -** with the [database connection] identified by the first argument -** to be invoked whenever a row is updated, inserted or deleted in -** a rowid table. -** ^Any callback set by a previous call to this function -** for the same database connection is overridden. -** -** ^The second argument is a pointer to the function to invoke when a -** row is updated, inserted or deleted in a rowid table. -** ^The first argument to the callback is a copy of the third argument -** to sqlite3_update_hook(). -** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE], -** or [SQLITE_UPDATE], depending on the operation that caused the callback -** to be invoked. -** ^The third and fourth arguments to the callback contain pointers to the -** database and table name containing the affected row. -** ^The final callback parameter is the [rowid] of the row. -** ^In the case of an update, this is the [rowid] after the update takes place. -** -** ^(The update hook is not invoked when internal system tables are -** modified (i.e. sqlite_master and sqlite_sequence).)^ -** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified. -** -** ^In the current implementation, the update hook -** is not invoked when duplication rows are deleted because of an -** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook -** invoked when rows are deleted using the [truncate optimization]. -** The exceptions defined in this paragraph might change in a future -** release of SQLite. -** -** The update hook implementation must not do anything that will modify -** the database connection that invoked the update hook. Any actions -** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the update hook. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -** ^The sqlite3_update_hook(D,C,P) function -** returns the P argument from the previous call -** on the same [database connection] D, or NULL for -** the first call on D. -** -** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()] -** interfaces. -*/ -SQLITE_API void *sqlite3_update_hook( - sqlite3*, - void(*)(void *,int ,char const *,char const *,sqlite3_int64), - void* -); - -/* -** CAPI3REF: Enable Or Disable Shared Pager Cache -** -** ^(This routine enables or disables the sharing of the database cache -** and schema data structures between [database connection | connections] -** to the same database. Sharing is enabled if the argument is true -** and disabled if the argument is false.)^ -** -** ^Cache sharing is enabled and disabled for an entire process. -** This is a change as of SQLite version 3.5.0. In prior versions of SQLite, -** sharing was enabled or disabled for each thread separately. -** -** ^(The cache sharing mode set by this interface effects all subsequent -** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. -** Existing database connections continue use the sharing mode -** that was in effect at the time they were opened.)^ -** -** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled -** successfully. An [error code] is returned otherwise.)^ -** -** ^Shared cache is disabled by default. But this might change in -** future releases of SQLite. Applications that care about shared -** cache setting should set it explicitly. -** -** This interface is threadsafe on processors where writing a -** 32-bit integer is atomic. -** -** See Also: [SQLite Shared-Cache Mode] -*/ -SQLITE_API int sqlite3_enable_shared_cache(int); - -/* -** CAPI3REF: Attempt To Free Heap Memory -** -** ^The sqlite3_release_memory() interface attempts to free N bytes -** of heap memory by deallocating non-essential memory allocations -** held by the database library. Memory used to cache database -** pages to improve performance is an example of non-essential memory. -** ^sqlite3_release_memory() returns the number of bytes actually freed, -** which might be more or less than the amount requested. -** ^The sqlite3_release_memory() routine is a no-op returning zero -** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT]. -** -** See also: [sqlite3_db_release_memory()] -*/ -SQLITE_API int sqlite3_release_memory(int); - -/* -** CAPI3REF: Free Memory Used By A Database Connection -** -** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap -** memory as possible from database connection D. Unlike the -** [sqlite3_release_memory()] interface, this interface is in effect even -** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is -** omitted. -** -** See also: [sqlite3_release_memory()] -*/ -SQLITE_API int sqlite3_db_release_memory(sqlite3*); - -/* -** CAPI3REF: Impose A Limit On Heap Size -** -** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the -** soft limit on the amount of heap memory that may be allocated by SQLite. -** ^SQLite strives to keep heap memory utilization below the soft heap -** limit by reducing the number of pages held in the page cache -** as heap memory usages approaches the limit. -** ^The soft heap limit is "soft" because even though SQLite strives to stay -** below the limit, it will exceed the limit rather than generate -** an [SQLITE_NOMEM] error. In other words, the soft heap limit -** is advisory only. -** -** ^The return value from sqlite3_soft_heap_limit64() is the size of -** the soft heap limit prior to the call, or negative in the case of an -** error. ^If the argument N is negative -** then no change is made to the soft heap limit. Hence, the current -** size of the soft heap limit can be determined by invoking -** sqlite3_soft_heap_limit64() with a negative argument. -** -** ^If the argument N is zero then the soft heap limit is disabled. -** -** ^(The soft heap limit is not enforced in the current implementation -** if one or more of following conditions are true: -** -**
    -**
  • The soft heap limit is set to zero. -**
  • Memory accounting is disabled using a combination of the -** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and -** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. -**
  • An alternative page cache implementation is specified using -** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...). -**
  • The page cache allocates from its own memory pool supplied -** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than -** from the heap. -**
)^ -** -** Beginning with SQLite version 3.7.3, the soft heap limit is enforced -** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT] -** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT], -** the soft heap limit is enforced on every memory allocation. Without -** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced -** when memory is allocated by the page cache. Testing suggests that because -** the page cache is the predominate memory user in SQLite, most -** applications will achieve adequate soft heap limit enforcement without -** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT]. -** -** The circumstances under which SQLite will enforce the soft heap limit may -** changes in future releases of SQLite. -*/ -SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); - -/* -** CAPI3REF: Deprecated Soft Heap Limit Interface -** DEPRECATED -** -** This is a deprecated version of the [sqlite3_soft_heap_limit64()] -** interface. This routine is provided for historical compatibility -** only. All new applications should use the -** [sqlite3_soft_heap_limit64()] interface rather than this one. -*/ -SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); - - -/* -** CAPI3REF: Extract Metadata About A Column Of A Table -** -** ^This routine returns metadata about a specific column of a specific -** database table accessible using the [database connection] handle -** passed as the first function argument. -** -** ^The column is identified by the second, third and fourth parameters to -** this function. ^The second parameter is either the name of the database -** (i.e. "main", "temp", or an attached database) containing the specified -** table or NULL. ^If it is NULL, then all attached databases are searched -** for the table using the same algorithm used by the database engine to -** resolve unqualified table references. -** -** ^The third and fourth parameters to this function are the table and column -** name of the desired column, respectively. Neither of these parameters -** may be NULL. -** -** ^Metadata is returned by writing to the memory locations passed as the 5th -** and subsequent parameters to this function. ^Any of these arguments may be -** NULL, in which case the corresponding element of metadata is omitted. -** -** ^(
-** -**
Parameter Output
Type
Description -** -**
5th const char* Data type -**
6th const char* Name of default collation sequence -**
7th int True if column has a NOT NULL constraint -**
8th int True if column is part of the PRIMARY KEY -**
9th int True if column is [AUTOINCREMENT] -**
-**
)^ -** -** ^The memory pointed to by the character pointers returned for the -** declaration type and collation sequence is valid only until the next -** call to any SQLite API function. -** -** ^If the specified table is actually a view, an [error code] is returned. -** -** ^If the specified column is "rowid", "oid" or "_rowid_" and an -** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output -** parameters are set for the explicitly declared column. ^(If there is no -** explicitly declared [INTEGER PRIMARY KEY] column, then the output -** parameters are set as follows: -** -**
-**     data type: "INTEGER"
-**     collation sequence: "BINARY"
-**     not null: 0
-**     primary key: 1
-**     auto increment: 0
-** 
)^ -** -** ^(This function may load one or more schemas from database files. If an -** error occurs during this process, or if the requested table or column -** cannot be found, an [error code] is returned and an error message left -** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^ -** -** ^This API is only available if the library was compiled with the -** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined. -*/ -SQLITE_API int sqlite3_table_column_metadata( - sqlite3 *db, /* Connection handle */ - const char *zDbName, /* Database name or NULL */ - const char *zTableName, /* Table name */ - const char *zColumnName, /* Column name */ - char const **pzDataType, /* OUTPUT: Declared data type */ - char const **pzCollSeq, /* OUTPUT: Collation sequence name */ - int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ - int *pPrimaryKey, /* OUTPUT: True if column part of PK */ - int *pAutoinc /* OUTPUT: True if column is auto-increment */ -); - -/* -** CAPI3REF: Load An Extension -** -** ^This interface loads an SQLite extension library from the named file. -** -** ^The sqlite3_load_extension() interface attempts to load an -** [SQLite extension] library contained in the file zFile. If -** the file cannot be loaded directly, attempts are made to load -** with various operating-system specific extensions added. -** So for example, if "samplelib" cannot be loaded, then names like -** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might -** be tried also. -** -** ^The entry point is zProc. -** ^(zProc may be 0, in which case SQLite will try to come up with an -** entry point name on its own. It first tries "sqlite3_extension_init". -** If that does not work, it constructs a name "sqlite3_X_init" where the -** X is consists of the lower-case equivalent of all ASCII alphabetic -** characters in the filename from the last "/" to the first following -** "." and omitting any initial "lib".)^ -** ^The sqlite3_load_extension() interface returns -** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong. -** ^If an error occurs and pzErrMsg is not 0, then the -** [sqlite3_load_extension()] interface shall attempt to -** fill *pzErrMsg with error message text stored in memory -** obtained from [sqlite3_malloc()]. The calling function -** should free this memory by calling [sqlite3_free()]. -** -** ^Extension loading must be enabled using -** [sqlite3_enable_load_extension()] prior to calling this API, -** otherwise an error will be returned. -** -** See also the [load_extension() SQL function]. -*/ -SQLITE_API int sqlite3_load_extension( - sqlite3 *db, /* Load the extension into this database connection */ - const char *zFile, /* Name of the shared library containing extension */ - const char *zProc, /* Entry point. Derived from zFile if 0 */ - char **pzErrMsg /* Put error message here if not 0 */ -); - -/* -** CAPI3REF: Enable Or Disable Extension Loading -** -** ^So as not to open security holes in older applications that are -** unprepared to deal with [extension loading], and as a means of disabling -** [extension loading] while evaluating user-entered SQL, the following API -** is provided to turn the [sqlite3_load_extension()] mechanism on and off. -** -** ^Extension loading is off by default. -** ^Call the sqlite3_enable_load_extension() routine with onoff==1 -** to turn extension loading on and call it with onoff==0 to turn -** it back off again. -*/ -SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); - -/* -** CAPI3REF: Automatically Load Statically Linked Extensions -** -** ^This interface causes the xEntryPoint() function to be invoked for -** each new [database connection] that is created. The idea here is that -** xEntryPoint() is the entry point for a statically linked [SQLite extension] -** that is to be automatically loaded into all new database connections. -** -** ^(Even though the function prototype shows that xEntryPoint() takes -** no arguments and returns void, SQLite invokes xEntryPoint() with three -** arguments and expects and integer result as if the signature of the -** entry point where as follows: -** -**
-**    int xEntryPoint(
-**      sqlite3 *db,
-**      const char **pzErrMsg,
-**      const struct sqlite3_api_routines *pThunk
-**    );
-** 
)^ -** -** If the xEntryPoint routine encounters an error, it should make *pzErrMsg -** point to an appropriate error message (obtained from [sqlite3_mprintf()]) -** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg -** is NULL before calling the xEntryPoint(). ^SQLite will invoke -** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any -** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], -** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. -** -** ^Calling sqlite3_auto_extension(X) with an entry point X that is already -** on the list of automatic extensions is a harmless no-op. ^No entry point -** will be called more than once for each database connection that is opened. -** -** See also: [sqlite3_reset_auto_extension()] -** and [sqlite3_cancel_auto_extension()] -*/ -SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); - -/* -** CAPI3REF: Cancel Automatic Extension Loading -** -** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the -** initialization routine X that was registered using a prior call to -** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] -** routine returns 1 if initialization routine X was successfully -** unregistered and it returns 0 if X was not on the list of initialization -** routines. -*/ -SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void)); - -/* -** CAPI3REF: Reset Automatic Extension Loading -** -** ^This interface disables all automatic extensions previously -** registered using [sqlite3_auto_extension()]. -*/ -SQLITE_API void sqlite3_reset_auto_extension(void); - -/* -** The interface to the virtual-table mechanism is currently considered -** to be experimental. The interface might change in incompatible ways. -** If this is a problem for you, do not use the interface at this time. -** -** When the virtual-table mechanism stabilizes, we will declare the -** interface fixed, support it indefinitely, and remove this comment. -*/ - -/* -** Structures used by the virtual table interface -*/ -typedef struct sqlite3_vtab sqlite3_vtab; -typedef struct sqlite3_index_info sqlite3_index_info; -typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; -typedef struct sqlite3_module sqlite3_module; - -/* -** CAPI3REF: Virtual Table Object -** KEYWORDS: sqlite3_module {virtual table module} -** -** This structure, sometimes called a "virtual table module", -** defines the implementation of a [virtual tables]. -** This structure consists mostly of methods for the module. -** -** ^A virtual table module is created by filling in a persistent -** instance of this structure and passing a pointer to that instance -** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. -** ^The registration remains valid until it is replaced by a different -** module or until the [database connection] closes. The content -** of this structure must not change while it is registered with -** any database connection. -*/ -struct sqlite3_module { - int iVersion; - int (*xCreate)(sqlite3*, void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**); - int (*xConnect)(sqlite3*, void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**); - int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); - int (*xDisconnect)(sqlite3_vtab *pVTab); - int (*xDestroy)(sqlite3_vtab *pVTab); - int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); - int (*xClose)(sqlite3_vtab_cursor*); - int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv); - int (*xNext)(sqlite3_vtab_cursor*); - int (*xEof)(sqlite3_vtab_cursor*); - int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); - int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); - int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); - int (*xBegin)(sqlite3_vtab *pVTab); - int (*xSync)(sqlite3_vtab *pVTab); - int (*xCommit)(sqlite3_vtab *pVTab); - int (*xRollback)(sqlite3_vtab *pVTab); - int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), - void **ppArg); - int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); - /* The methods above are in version 1 of the sqlite_module object. Those - ** below are for version 2 and greater. */ - int (*xSavepoint)(sqlite3_vtab *pVTab, int); - int (*xRelease)(sqlite3_vtab *pVTab, int); - int (*xRollbackTo)(sqlite3_vtab *pVTab, int); -}; - -/* -** CAPI3REF: Virtual Table Indexing Information -** KEYWORDS: sqlite3_index_info -** -** The sqlite3_index_info structure and its substructures is used as part -** of the [virtual table] interface to -** pass information into and receive the reply from the [xBestIndex] -** method of a [virtual table module]. The fields under **Inputs** are the -** inputs to xBestIndex and are read-only. xBestIndex inserts its -** results into the **Outputs** fields. -** -** ^(The aConstraint[] array records WHERE clause constraints of the form: -** -**
column OP expr
-** -** where OP is =, <, <=, >, or >=.)^ ^(The particular operator is -** stored in aConstraint[].op using one of the -** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ -** ^(The index of the column is stored in -** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the -** expr on the right-hand side can be evaluated (and thus the constraint -** is usable) and false if it cannot.)^ -** -** ^The optimizer automatically inverts terms of the form "expr OP column" -** and makes other simplifications to the WHERE clause in an attempt to -** get as many WHERE clause terms into the form shown above as possible. -** ^The aConstraint[] array only reports WHERE clause terms that are -** relevant to the particular virtual table being queried. -** -** ^Information about the ORDER BY clause is stored in aOrderBy[]. -** ^Each term of aOrderBy records a column of the ORDER BY clause. -** -** The [xBestIndex] method must fill aConstraintUsage[] with information -** about what parameters to pass to xFilter. ^If argvIndex>0 then -** the right-hand side of the corresponding aConstraint[] is evaluated -** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit -** is true, then the constraint is assumed to be fully handled by the -** virtual table and is not checked again by SQLite.)^ -** -** ^The idxNum and idxPtr values are recorded and passed into the -** [xFilter] method. -** ^[sqlite3_free()] is used to free idxPtr if and only if -** needToFreeIdxPtr is true. -** -** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in -** the correct order to satisfy the ORDER BY clause so that no separate -** sorting step is required. -** -** ^The estimatedCost value is an estimate of the cost of a particular -** strategy. A cost of N indicates that the cost of the strategy is similar -** to a linear scan of an SQLite table with N rows. A cost of log(N) -** indicates that the expense of the operation is similar to that of a -** binary search on a unique indexed field of an SQLite table with N rows. -** -** ^The estimatedRows value is an estimate of the number of rows that -** will be returned by the strategy. -** -** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info -** structure for SQLite version 3.8.2. If a virtual table extension is -** used with an SQLite version earlier than 3.8.2, the results of attempting -** to read or write the estimatedRows field are undefined (but are likely -** to included crashing the application). The estimatedRows field should -** therefore only be used if [sqlite3_libversion_number()] returns a -** value greater than or equal to 3008002. -*/ -struct sqlite3_index_info { - /* Inputs */ - int nConstraint; /* Number of entries in aConstraint */ - struct sqlite3_index_constraint { - int iColumn; /* Column on left-hand side of constraint */ - unsigned char op; /* Constraint operator */ - unsigned char usable; /* True if this constraint is usable */ - int iTermOffset; /* Used internally - xBestIndex should ignore */ - } *aConstraint; /* Table of WHERE clause constraints */ - int nOrderBy; /* Number of terms in the ORDER BY clause */ - struct sqlite3_index_orderby { - int iColumn; /* Column number */ - unsigned char desc; /* True for DESC. False for ASC. */ - } *aOrderBy; /* The ORDER BY clause */ - /* Outputs */ - struct sqlite3_index_constraint_usage { - int argvIndex; /* if >0, constraint is part of argv to xFilter */ - unsigned char omit; /* Do not code a test for this constraint */ - } *aConstraintUsage; - int idxNum; /* Number used to identify the index */ - char *idxStr; /* String, possibly obtained from sqlite3_malloc */ - int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ - int orderByConsumed; /* True if output is already ordered */ - double estimatedCost; /* Estimated cost of using this index */ - /* Fields below are only available in SQLite 3.8.2 and later */ - sqlite3_int64 estimatedRows; /* Estimated number of rows returned */ -}; - -/* -** CAPI3REF: Virtual Table Constraint Operator Codes -** -** These macros defined the allowed values for the -** [sqlite3_index_info].aConstraint[].op field. Each value represents -** an operator that is part of a constraint term in the wHERE clause of -** a query that uses a [virtual table]. -*/ -#define SQLITE_INDEX_CONSTRAINT_EQ 2 -#define SQLITE_INDEX_CONSTRAINT_GT 4 -#define SQLITE_INDEX_CONSTRAINT_LE 8 -#define SQLITE_INDEX_CONSTRAINT_LT 16 -#define SQLITE_INDEX_CONSTRAINT_GE 32 -#define SQLITE_INDEX_CONSTRAINT_MATCH 64 - -/* -** CAPI3REF: Register A Virtual Table Implementation -** -** ^These routines are used to register a new [virtual table module] name. -** ^Module names must be registered before -** creating a new [virtual table] using the module and before using a -** preexisting [virtual table] for the module. -** -** ^The module name is registered on the [database connection] specified -** by the first parameter. ^The name of the module is given by the -** second parameter. ^The third parameter is a pointer to -** the implementation of the [virtual table module]. ^The fourth -** parameter is an arbitrary client data pointer that is passed through -** into the [xCreate] and [xConnect] methods of the virtual table module -** when a new virtual table is be being created or reinitialized. -** -** ^The sqlite3_create_module_v2() interface has a fifth parameter which -** is a pointer to a destructor for the pClientData. ^SQLite will -** invoke the destructor function (if it is not NULL) when SQLite -** no longer needs the pClientData pointer. ^The destructor will also -** be invoked if the call to sqlite3_create_module_v2() fails. -** ^The sqlite3_create_module() -** interface is equivalent to sqlite3_create_module_v2() with a NULL -** destructor. -*/ -SQLITE_API int sqlite3_create_module( - sqlite3 *db, /* SQLite connection to register module with */ - const char *zName, /* Name of the module */ - const sqlite3_module *p, /* Methods for the module */ - void *pClientData /* Client data for xCreate/xConnect */ -); -SQLITE_API int sqlite3_create_module_v2( - sqlite3 *db, /* SQLite connection to register module with */ - const char *zName, /* Name of the module */ - const sqlite3_module *p, /* Methods for the module */ - void *pClientData, /* Client data for xCreate/xConnect */ - void(*xDestroy)(void*) /* Module destructor function */ -); - -/* -** CAPI3REF: Virtual Table Instance Object -** KEYWORDS: sqlite3_vtab -** -** Every [virtual table module] implementation uses a subclass -** of this object to describe a particular instance -** of the [virtual table]. Each subclass will -** be tailored to the specific needs of the module implementation. -** The purpose of this superclass is to define certain fields that are -** common to all module implementations. -** -** ^Virtual tables methods can set an error message by assigning a -** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should -** take care that any prior string is freed by a call to [sqlite3_free()] -** prior to assigning a new string to zErrMsg. ^After the error message -** is delivered up to the client application, the string will be automatically -** freed by sqlite3_free() and the zErrMsg field will be zeroed. -*/ -struct sqlite3_vtab { - const sqlite3_module *pModule; /* The module for this virtual table */ - int nRef; /* NO LONGER USED */ - char *zErrMsg; /* Error message from sqlite3_mprintf() */ - /* Virtual table implementations will typically add additional fields */ -}; - -/* -** CAPI3REF: Virtual Table Cursor Object -** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} -** -** Every [virtual table module] implementation uses a subclass of the -** following structure to describe cursors that point into the -** [virtual table] and are used -** to loop through the virtual table. Cursors are created using the -** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed -** by the [sqlite3_module.xClose | xClose] method. Cursors are used -** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods -** of the module. Each module implementation will define -** the content of a cursor structure to suit its own needs. -** -** This superclass exists in order to define fields of the cursor that -** are common to all implementations. -*/ -struct sqlite3_vtab_cursor { - sqlite3_vtab *pVtab; /* Virtual table of this cursor */ - /* Virtual table implementations will typically add additional fields */ -}; - -/* -** CAPI3REF: Declare The Schema Of A Virtual Table -** -** ^The [xCreate] and [xConnect] methods of a -** [virtual table module] call this interface -** to declare the format (the names and datatypes of the columns) of -** the virtual tables they implement. -*/ -SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); - -/* -** CAPI3REF: Overload A Function For A Virtual Table -** -** ^(Virtual tables can provide alternative implementations of functions -** using the [xFindFunction] method of the [virtual table module]. -** But global versions of those functions -** must exist in order to be overloaded.)^ -** -** ^(This API makes sure a global version of a function with a particular -** name and number of parameters exists. If no such function exists -** before this API is called, a new function is created.)^ ^The implementation -** of the new function always causes an exception to be thrown. So -** the new function is not good for anything by itself. Its only -** purpose is to be a placeholder function that can be overloaded -** by a [virtual table]. -*/ -SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); - -/* -** The interface to the virtual-table mechanism defined above (back up -** to a comment remarkably similar to this one) is currently considered -** to be experimental. The interface might change in incompatible ways. -** If this is a problem for you, do not use the interface at this time. -** -** When the virtual-table mechanism stabilizes, we will declare the -** interface fixed, support it indefinitely, and remove this comment. -*/ - -/* -** CAPI3REF: A Handle To An Open BLOB -** KEYWORDS: {BLOB handle} {BLOB handles} -** -** An instance of this object represents an open BLOB on which -** [sqlite3_blob_open | incremental BLOB I/O] can be performed. -** ^Objects of this type are created by [sqlite3_blob_open()] -** and destroyed by [sqlite3_blob_close()]. -** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces -** can be used to read or write small subsections of the BLOB. -** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. -*/ -typedef struct sqlite3_blob sqlite3_blob; - -/* -** CAPI3REF: Open A BLOB For Incremental I/O -** -** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located -** in row iRow, column zColumn, table zTable in database zDb; -** in other words, the same BLOB that would be selected by: -** -**
-**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
-** 
)^ -** -** ^If the flags parameter is non-zero, then the BLOB is opened for read -** and write access. ^If it is zero, the BLOB is opened for read access. -** ^It is not possible to open a column that is part of an index or primary -** key for writing. ^If [foreign key constraints] are enabled, it is -** not possible to open a column that is part of a [child key] for writing. -** -** ^Note that the database name is not the filename that contains -** the database but rather the symbolic name of the database that -** appears after the AS keyword when the database is connected using [ATTACH]. -** ^For the main database file, the database name is "main". -** ^For TEMP tables, the database name is "temp". -** -** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written -** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set -** to be a null pointer.)^ -** ^This function sets the [database connection] error code and message -** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related -** functions. ^Note that the *ppBlob variable is always initialized in a -** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob -** regardless of the success or failure of this routine. -** -** ^(If the row that a BLOB handle points to is modified by an -** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects -** then the BLOB handle is marked as "expired". -** This is true if any column of the row is changed, even a column -** other than the one the BLOB handle is open on.)^ -** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for -** an expired BLOB handle fail with a return code of [SQLITE_ABORT]. -** ^(Changes written into a BLOB prior to the BLOB expiring are not -** rolled back by the expiration of the BLOB. Such changes will eventually -** commit if the transaction continues to completion.)^ -** -** ^Use the [sqlite3_blob_bytes()] interface to determine the size of -** the opened blob. ^The size of a blob may not be changed by this -** interface. Use the [UPDATE] SQL command to change the size of a -** blob. -** -** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID] -** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables. -** -** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces -** and the built-in [zeroblob] SQL function can be used, if desired, -** to create an empty, zero-filled blob in which to read or write using -** this interface. -** -** To avoid a resource leak, every open [BLOB handle] should eventually -** be released by a call to [sqlite3_blob_close()]. -*/ -SQLITE_API int sqlite3_blob_open( - sqlite3*, - const char *zDb, - const char *zTable, - const char *zColumn, - sqlite3_int64 iRow, - int flags, - sqlite3_blob **ppBlob -); - -/* -** CAPI3REF: Move a BLOB Handle to a New Row -** -** ^This function is used to move an existing blob handle so that it points -** to a different row of the same database table. ^The new row is identified -** by the rowid value passed as the second argument. Only the row can be -** changed. ^The database, table and column on which the blob handle is open -** remain the same. Moving an existing blob handle to a new row can be -** faster than closing the existing handle and opening a new one. -** -** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - -** it must exist and there must be either a blob or text value stored in -** the nominated column.)^ ^If the new row is not present in the table, or if -** it does not contain a blob or text value, or if another error occurs, an -** SQLite error code is returned and the blob handle is considered aborted. -** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or -** [sqlite3_blob_reopen()] on an aborted blob handle immediately return -** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle -** always returns zero. -** -** ^This function sets the database handle error code and message. -*/ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); - -/* -** CAPI3REF: Close A BLOB Handle -** -** ^Closes an open [BLOB handle]. -** -** ^Closing a BLOB shall cause the current transaction to commit -** if there are no other BLOBs, no pending prepared statements, and the -** database connection is in [autocommit mode]. -** ^If any writes were made to the BLOB, they might be held in cache -** until the close operation if they will fit. -** -** ^(Closing the BLOB often forces the changes -** out to disk and so if any I/O errors occur, they will likely occur -** at the time when the BLOB is closed. Any errors that occur during -** closing are reported as a non-zero return value.)^ -** -** ^(The BLOB is closed unconditionally. Even if this routine returns -** an error code, the BLOB is still closed.)^ -** -** ^Calling this routine with a null pointer (such as would be returned -** by a failed call to [sqlite3_blob_open()]) is a harmless no-op. -*/ -SQLITE_API int sqlite3_blob_close(sqlite3_blob *); - -/* -** CAPI3REF: Return The Size Of An Open BLOB -** -** ^Returns the size in bytes of the BLOB accessible via the -** successfully opened [BLOB handle] in its only argument. ^The -** incremental blob I/O routines can only read or overwriting existing -** blob content; they cannot change the size of a blob. -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. -*/ -SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); - -/* -** CAPI3REF: Read Data From A BLOB Incrementally -** -** ^(This function is used to read data from an open [BLOB handle] into a -** caller-supplied buffer. N bytes of data are copied into buffer Z -** from the open BLOB, starting at offset iOffset.)^ -** -** ^If offset iOffset is less than N bytes from the end of the BLOB, -** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is -** less than zero, [SQLITE_ERROR] is returned and no data is read. -** ^The size of the blob (and hence the maximum value of N+iOffset) -** can be determined using the [sqlite3_blob_bytes()] interface. -** -** ^An attempt to read from an expired [BLOB handle] fails with an -** error code of [SQLITE_ABORT]. -** -** ^(On success, sqlite3_blob_read() returns SQLITE_OK. -** Otherwise, an [error code] or an [extended error code] is returned.)^ -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. -** -** See also: [sqlite3_blob_write()]. -*/ -SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); - -/* -** CAPI3REF: Write Data Into A BLOB Incrementally -** -** ^This function is used to write data into an open [BLOB handle] from a -** caller-supplied buffer. ^N bytes of data are copied from the buffer Z -** into the open BLOB, starting at offset iOffset. -** -** ^If the [BLOB handle] passed as the first argument was not opened for -** writing (the flags parameter to [sqlite3_blob_open()] was zero), -** this function returns [SQLITE_READONLY]. -** -** ^This function may only modify the contents of the BLOB; it is -** not possible to increase the size of a BLOB using this API. -** ^If offset iOffset is less than N bytes from the end of the BLOB, -** [SQLITE_ERROR] is returned and no data is written. ^If N is -** less than zero [SQLITE_ERROR] is returned and no data is written. -** The size of the BLOB (and hence the maximum value of N+iOffset) -** can be determined using the [sqlite3_blob_bytes()] interface. -** -** ^An attempt to write to an expired [BLOB handle] fails with an -** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred -** before the [BLOB handle] expired are not rolled back by the -** expiration of the handle, though of course those changes might -** have been overwritten by the statement that expired the BLOB handle -** or by other independent statements. -** -** ^(On success, sqlite3_blob_write() returns SQLITE_OK. -** Otherwise, an [error code] or an [extended error code] is returned.)^ -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. -** -** See also: [sqlite3_blob_read()]. -*/ -SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset); - -/* -** CAPI3REF: Virtual File System Objects -** -** A virtual filesystem (VFS) is an [sqlite3_vfs] object -** that SQLite uses to interact -** with the underlying operating system. Most SQLite builds come with a -** single default VFS that is appropriate for the host computer. -** New VFSes can be registered and existing VFSes can be unregistered. -** The following interfaces are provided. -** -** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name. -** ^Names are case sensitive. -** ^Names are zero-terminated UTF-8 strings. -** ^If there is no match, a NULL pointer is returned. -** ^If zVfsName is NULL then the default VFS is returned. -** -** ^New VFSes are registered with sqlite3_vfs_register(). -** ^Each new VFS becomes the default VFS if the makeDflt flag is set. -** ^The same VFS can be registered multiple times without injury. -** ^To make an existing VFS into the default VFS, register it again -** with the makeDflt flag set. If two different VFSes with the -** same name are registered, the behavior is undefined. If a -** VFS is registered with a name that is NULL or an empty string, -** then the behavior is undefined. -** -** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. -** ^(If the default VFS is unregistered, another VFS is chosen as -** the default. The choice for the new VFS is arbitrary.)^ -*/ -SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); -SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); -SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); - -/* -** CAPI3REF: Mutexes -** -** The SQLite core uses these routines for thread -** synchronization. Though they are intended for internal -** use by SQLite, code that links against SQLite is -** permitted to use any of these routines. -** -** The SQLite source code contains multiple implementations -** of these mutex routines. An appropriate implementation -** is selected automatically at compile-time. ^(The following -** implementations are available in the SQLite core: -** -**
    -**
  • SQLITE_MUTEX_PTHREADS -**
  • SQLITE_MUTEX_W32 -**
  • SQLITE_MUTEX_NOOP -**
)^ -** -** ^The SQLITE_MUTEX_NOOP implementation is a set of routines -** that does no real locking and is appropriate for use in -** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and -** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix -** and Windows. -** -** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor -** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex -** implementation is included with the library. In this case the -** application must supply a custom mutex implementation using the -** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function -** before calling sqlite3_initialize() or any other public sqlite3_ -** function that calls sqlite3_initialize().)^ -** -** ^The sqlite3_mutex_alloc() routine allocates a new -** mutex and returns a pointer to it. ^If it returns NULL -** that means that a mutex could not be allocated. ^SQLite -** will unwind its stack and return an error. ^(The argument -** to sqlite3_mutex_alloc() is one of these integer constants: -** -**
    -**
  • SQLITE_MUTEX_FAST -**
  • SQLITE_MUTEX_RECURSIVE -**
  • SQLITE_MUTEX_STATIC_MASTER -**
  • SQLITE_MUTEX_STATIC_MEM -**
  • SQLITE_MUTEX_STATIC_MEM2 -**
  • SQLITE_MUTEX_STATIC_PRNG -**
  • SQLITE_MUTEX_STATIC_LRU -**
  • SQLITE_MUTEX_STATIC_LRU2 -**
)^ -** -** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) -** cause sqlite3_mutex_alloc() to create -** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE -** is used but not necessarily so when SQLITE_MUTEX_FAST is used. -** The mutex implementation does not need to make a distinction -** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does -** not want to. ^SQLite will only request a recursive mutex in -** cases where it really needs one. ^If a faster non-recursive mutex -** implementation is available on the host platform, the mutex subsystem -** might return such a mutex in response to SQLITE_MUTEX_FAST. -** -** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other -** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return -** a pointer to a static preexisting mutex. ^Six static mutexes are -** used by the current version of SQLite. Future versions of SQLite -** may add additional static mutexes. Static mutexes are for internal -** use by SQLite only. Applications that use SQLite mutexes should -** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or -** SQLITE_MUTEX_RECURSIVE. -** -** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST -** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() -** returns a different mutex on every call. ^But for the static -** mutex types, the same mutex is returned on every call that has -** the same type number. -** -** ^The sqlite3_mutex_free() routine deallocates a previously -** allocated dynamic mutex. ^SQLite is careful to deallocate every -** dynamic mutex that it allocates. The dynamic mutexes must not be in -** use when they are deallocated. Attempting to deallocate a static -** mutex results in undefined behavior. ^SQLite never deallocates -** a static mutex. -** -** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt -** to enter a mutex. ^If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] -** upon successful entry. ^(Mutexes created using -** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. -** In such cases the, -** mutex must be exited an equal number of times before another thread -** can enter.)^ ^(If the same thread tries to enter any other -** kind of mutex more than once, the behavior is undefined. -** SQLite will never exhibit -** such behavior in its own use of mutexes.)^ -** -** ^(Some systems (for example, Windows 95) do not support the operation -** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() -** will always return SQLITE_BUSY. The SQLite core only ever uses -** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^ -** -** ^The sqlite3_mutex_leave() routine exits a mutex that was -** previously entered by the same thread. ^(The behavior -** is undefined if the mutex is not currently entered by the -** calling thread or is not currently allocated. SQLite will -** never do either.)^ -** -** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or -** sqlite3_mutex_leave() is a NULL pointer, then all three routines -** behave as no-ops. -** -** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. -*/ -SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int); -SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); -SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); -SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); -SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); - -/* -** CAPI3REF: Mutex Methods Object -** -** An instance of this structure defines the low-level routines -** used to allocate and use mutexes. -** -** Usually, the default mutex implementations provided by SQLite are -** sufficient, however the user has the option of substituting a custom -** implementation for specialized deployments or systems for which SQLite -** does not provide a suitable implementation. In this case, the user -** creates and populates an instance of this structure to pass -** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. -** Additionally, an instance of this structure can be used as an -** output variable when querying the system for the current mutex -** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. -** -** ^The xMutexInit method defined by this structure is invoked as -** part of system initialization by the sqlite3_initialize() function. -** ^The xMutexInit routine is called by SQLite exactly once for each -** effective call to [sqlite3_initialize()]. -** -** ^The xMutexEnd method defined by this structure is invoked as -** part of system shutdown by the sqlite3_shutdown() function. The -** implementation of this method is expected to release all outstanding -** resources obtained by the mutex methods implementation, especially -** those obtained by the xMutexInit method. ^The xMutexEnd() -** interface is invoked exactly once for each call to [sqlite3_shutdown()]. -** -** ^(The remaining seven methods defined by this structure (xMutexAlloc, -** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and -** xMutexNotheld) implement the following interfaces (respectively): -** -**
    -**
  • [sqlite3_mutex_alloc()]
  • -**
  • [sqlite3_mutex_free()]
  • -**
  • [sqlite3_mutex_enter()]
  • -**
  • [sqlite3_mutex_try()]
  • -**
  • [sqlite3_mutex_leave()]
  • -**
  • [sqlite3_mutex_held()]
  • -**
  • [sqlite3_mutex_notheld()]
  • -**
)^ -** -** The only difference is that the public sqlite3_XXX functions enumerated -** above silently ignore any invocations that pass a NULL pointer instead -** of a valid mutex handle. The implementations of the methods defined -** by this structure are not required to handle this case, the results -** of passing a NULL pointer instead of a valid mutex handle are undefined -** (i.e. it is acceptable to provide an implementation that segfaults if -** it is passed a NULL pointer). -** -** The xMutexInit() method must be threadsafe. ^It must be harmless to -** invoke xMutexInit() multiple times within the same process and without -** intervening calls to xMutexEnd(). Second and subsequent calls to -** xMutexInit() must be no-ops. -** -** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] -** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory -** allocation for a static mutex. ^However xMutexAlloc() may use SQLite -** memory allocation for a fast or recursive mutex. -** -** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is -** called, but only if the prior call to xMutexInit returned SQLITE_OK. -** If xMutexInit fails in any way, it is expected to clean up after itself -** prior to returning. -*/ -typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; -struct sqlite3_mutex_methods { - int (*xMutexInit)(void); - int (*xMutexEnd)(void); - sqlite3_mutex *(*xMutexAlloc)(int); - void (*xMutexFree)(sqlite3_mutex *); - void (*xMutexEnter)(sqlite3_mutex *); - int (*xMutexTry)(sqlite3_mutex *); - void (*xMutexLeave)(sqlite3_mutex *); - int (*xMutexHeld)(sqlite3_mutex *); - int (*xMutexNotheld)(sqlite3_mutex *); -}; - -/* -** CAPI3REF: Mutex Verification Routines -** -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines -** are intended for use inside assert() statements. ^The SQLite core -** never uses these routines except inside an assert() and applications -** are advised to follow the lead of the core. ^The SQLite core only -** provides implementations for these routines when it is compiled -** with the SQLITE_DEBUG flag. ^External mutex implementations -** are only required to provide these routines if SQLITE_DEBUG is -** defined and if NDEBUG is not defined. -** -** ^These routines should return true if the mutex in their argument -** is held or not held, respectively, by the calling thread. -** -** ^The implementation is not required to provide versions of these -** routines that actually work. If the implementation does not provide working -** versions of these routines, it should at least provide stubs that always -** return true so that one does not get spurious assertion failures. -** -** ^If the argument to sqlite3_mutex_held() is a NULL pointer then -** the routine should return 1. This seems counter-intuitive since -** clearly the mutex cannot be held if it does not exist. But -** the reason the mutex does not exist is because the build is not -** using mutexes. And we do not want the assert() containing the -** call to sqlite3_mutex_held() to fail, so a non-zero return is -** the appropriate thing to do. ^The sqlite3_mutex_notheld() -** interface should also return 1 when given a NULL pointer. -*/ -#ifndef NDEBUG -SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); -SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); -#endif - -/* -** CAPI3REF: Mutex Types -** -** The [sqlite3_mutex_alloc()] interface takes a single argument -** which is one of these integer constants. -** -** The set of static mutexes may change from one SQLite release to the -** next. Applications that override the built-in mutex logic must be -** prepared to accommodate additional static mutexes. -*/ -#define SQLITE_MUTEX_FAST 0 -#define SQLITE_MUTEX_RECURSIVE 1 -#define SQLITE_MUTEX_STATIC_MASTER 2 -#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ -#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ -#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ -#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */ -#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ -#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */ -#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */ - -/* -** CAPI3REF: Retrieve the mutex for a database connection -** -** ^This interface returns a pointer the [sqlite3_mutex] object that -** serializes access to the [database connection] given in the argument -** when the [threading mode] is Serialized. -** ^If the [threading mode] is Single-thread or Multi-thread then this -** routine returns a NULL pointer. -*/ -SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); - -/* -** CAPI3REF: Low-Level Control Of Database Files -** -** ^The [sqlite3_file_control()] interface makes a direct call to the -** xFileControl method for the [sqlite3_io_methods] object associated -** with a particular database identified by the second argument. ^The -** name of the database is "main" for the main database or "temp" for the -** TEMP database, or the name that appears after the AS keyword for -** databases that are added using the [ATTACH] SQL command. -** ^A NULL pointer can be used in place of "main" to refer to the -** main database file. -** ^The third and fourth parameters to this routine -** are passed directly through to the second and third parameters of -** the xFileControl method. ^The return value of the xFileControl -** method becomes the return value of this routine. -** -** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes -** a pointer to the underlying [sqlite3_file] object to be written into -** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER -** case is a short-circuit path which does not actually invoke the -** underlying sqlite3_io_methods.xFileControl method. -** -** ^If the second parameter (zDbName) does not match the name of any -** open database file, then SQLITE_ERROR is returned. ^This error -** code is not remembered and will not be recalled by [sqlite3_errcode()] -** or [sqlite3_errmsg()]. The underlying xFileControl method might -** also return SQLITE_ERROR. There is no way to distinguish between -** an incorrect zDbName and an SQLITE_ERROR return from the underlying -** xFileControl method. -** -** See also: [SQLITE_FCNTL_LOCKSTATE] -*/ -SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); - -/* -** CAPI3REF: Testing Interface -** -** ^The sqlite3_test_control() interface is used to read out internal -** state of SQLite and to inject faults into SQLite for testing -** purposes. ^The first parameter is an operation code that determines -** the number, meaning, and operation of all subsequent parameters. -** -** This interface is not for use by applications. It exists solely -** for verifying the correct operation of the SQLite library. Depending -** on how the SQLite library is compiled, this interface might not exist. -** -** The details of the operation codes, their meanings, the parameters -** they take, and what they do are all subject to change without notice. -** Unlike most of the SQLite API, this function is not guaranteed to -** operate consistently from one release to the next. -*/ -SQLITE_API int sqlite3_test_control(int op, ...); - -/* -** CAPI3REF: Testing Interface Operation Codes -** -** These constants are the valid operation code parameters used -** as the first argument to [sqlite3_test_control()]. -** -** These parameters and their meanings are subject to change -** without notice. These values are for testing purposes only. -** Applications should not use any of these parameters or the -** [sqlite3_test_control()] interface. -*/ -#define SQLITE_TESTCTRL_FIRST 5 -#define SQLITE_TESTCTRL_PRNG_SAVE 5 -#define SQLITE_TESTCTRL_PRNG_RESTORE 6 -#define SQLITE_TESTCTRL_PRNG_RESET 7 -#define SQLITE_TESTCTRL_BITVEC_TEST 8 -#define SQLITE_TESTCTRL_FAULT_INSTALL 9 -#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 -#define SQLITE_TESTCTRL_PENDING_BYTE 11 -#define SQLITE_TESTCTRL_ASSERT 12 -#define SQLITE_TESTCTRL_ALWAYS 13 -#define SQLITE_TESTCTRL_RESERVE 14 -#define SQLITE_TESTCTRL_OPTIMIZATIONS 15 -#define SQLITE_TESTCTRL_ISKEYWORD 16 -#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 -#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 -#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 -#define SQLITE_TESTCTRL_NEVER_CORRUPT 20 -#define SQLITE_TESTCTRL_LAST 20 - -/* -** CAPI3REF: SQLite Runtime Status -** -** ^This interface is used to retrieve runtime status information -** about the performance of SQLite, and optionally to reset various -** highwater marks. ^The first argument is an integer code for -** the specific parameter to measure. ^(Recognized integer codes -** are of the form [status parameters | SQLITE_STATUS_...].)^ -** ^The current value of the parameter is returned into *pCurrent. -** ^The highest recorded value is returned in *pHighwater. ^If the -** resetFlag is true, then the highest record value is reset after -** *pHighwater is written. ^(Some parameters do not record the highest -** value. For those parameters -** nothing is written into *pHighwater and the resetFlag is ignored.)^ -** ^(Other parameters record only the highwater mark and not the current -** value. For these latter parameters nothing is written into *pCurrent.)^ -** -** ^The sqlite3_status() routine returns SQLITE_OK on success and a -** non-zero [error code] on failure. -** -** This routine is threadsafe but is not atomic. This routine can be -** called while other threads are running the same or different SQLite -** interfaces. However the values returned in *pCurrent and -** *pHighwater reflect the status of SQLite at different points in time -** and it is possible that another thread might change the parameter -** in between the times when *pCurrent and *pHighwater are written. -** -** See also: [sqlite3_db_status()] -*/ -SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); - - -/* -** CAPI3REF: Status Parameters -** KEYWORDS: {status parameters} -** -** These integer constants designate various run-time status parameters -** that can be returned by [sqlite3_status()]. -** -**
-** [[SQLITE_STATUS_MEMORY_USED]] ^(
SQLITE_STATUS_MEMORY_USED
-**
This parameter is the current amount of memory checked out -** using [sqlite3_malloc()], either directly or indirectly. The -** figure includes calls made to [sqlite3_malloc()] by the application -** and internal memory usage by the SQLite library. Scratch memory -** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache -** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in -** this parameter. The amount returned is the sum of the allocation -** sizes as reported by the xSize method in [sqlite3_mem_methods].
)^ -** -** [[SQLITE_STATUS_MALLOC_SIZE]] ^(
SQLITE_STATUS_MALLOC_SIZE
-**
This parameter records the largest memory allocation request -** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their -** internal equivalents). Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. -** The value written into the *pCurrent parameter is undefined.
)^ -** -** [[SQLITE_STATUS_MALLOC_COUNT]] ^(
SQLITE_STATUS_MALLOC_COUNT
-**
This parameter records the number of separate memory allocations -** currently checked out.
)^ -** -** [[SQLITE_STATUS_PAGECACHE_USED]] ^(
SQLITE_STATUS_PAGECACHE_USED
-**
This parameter returns the number of pages used out of the -** [pagecache memory allocator] that was configured using -** [SQLITE_CONFIG_PAGECACHE]. The -** value returned is in pages, not in bytes.
)^ -** -** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] -** ^(
SQLITE_STATUS_PAGECACHE_OVERFLOW
-**
This parameter returns the number of bytes of page cache -** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE] -** buffer and where forced to overflow to [sqlite3_malloc()]. The -** returned value includes allocations that overflowed because they -** where too large (they were larger than the "sz" parameter to -** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because -** no space was left in the page cache.
)^ -** -** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(
SQLITE_STATUS_PAGECACHE_SIZE
-**
This parameter records the largest memory allocation request -** handed to [pagecache memory allocator]. Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. -** The value written into the *pCurrent parameter is undefined.
)^ -** -** [[SQLITE_STATUS_SCRATCH_USED]] ^(
SQLITE_STATUS_SCRATCH_USED
-**
This parameter returns the number of allocations used out of the -** [scratch memory allocator] configured using -** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not -** in bytes. Since a single thread may only have one scratch allocation -** outstanding at time, this parameter also reports the number of threads -** using scratch memory at the same time.
)^ -** -** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(
SQLITE_STATUS_SCRATCH_OVERFLOW
-**
This parameter returns the number of bytes of scratch memory -** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH] -** buffer and where forced to overflow to [sqlite3_malloc()]. The values -** returned include overflows because the requested allocation was too -** larger (that is, because the requested allocation was larger than the -** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer -** slots were available. -**
)^ -** -** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(
SQLITE_STATUS_SCRATCH_SIZE
-**
This parameter records the largest memory allocation request -** handed to [scratch memory allocator]. Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. -** The value written into the *pCurrent parameter is undefined.
)^ -** -** [[SQLITE_STATUS_PARSER_STACK]] ^(
SQLITE_STATUS_PARSER_STACK
-**
This parameter records the deepest parser stack. It is only -** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].
)^ -**
-** -** New status parameters may be added from time to time. -*/ -#define SQLITE_STATUS_MEMORY_USED 0 -#define SQLITE_STATUS_PAGECACHE_USED 1 -#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 -#define SQLITE_STATUS_SCRATCH_USED 3 -#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 -#define SQLITE_STATUS_MALLOC_SIZE 5 -#define SQLITE_STATUS_PARSER_STACK 6 -#define SQLITE_STATUS_PAGECACHE_SIZE 7 -#define SQLITE_STATUS_SCRATCH_SIZE 8 -#define SQLITE_STATUS_MALLOC_COUNT 9 - -/* -** CAPI3REF: Database Connection Status -** -** ^This interface is used to retrieve runtime status information -** about a single [database connection]. ^The first argument is the -** database connection object to be interrogated. ^The second argument -** is an integer constant, taken from the set of -** [SQLITE_DBSTATUS options], that -** determines the parameter to interrogate. The set of -** [SQLITE_DBSTATUS options] is likely -** to grow in future releases of SQLite. -** -** ^The current value of the requested parameter is written into *pCur -** and the highest instantaneous value is written into *pHiwtr. ^If -** the resetFlg is true, then the highest instantaneous value is -** reset back down to the current value. -** -** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a -** non-zero [error code] on failure. -** -** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. -*/ -SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); - -/* -** CAPI3REF: Status Parameters for database connections -** KEYWORDS: {SQLITE_DBSTATUS options} -** -** These constants are the available integer "verbs" that can be passed as -** the second argument to the [sqlite3_db_status()] interface. -** -** New verbs may be added in future releases of SQLite. Existing verbs -** might be discontinued. Applications should check the return code from -** [sqlite3_db_status()] to make sure that the call worked. -** The [sqlite3_db_status()] interface will return a non-zero error code -** if a discontinued or unsupported verb is invoked. -** -**
-** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(
SQLITE_DBSTATUS_LOOKASIDE_USED
-**
This parameter returns the number of lookaside memory slots currently -** checked out.
)^ -** -** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(
SQLITE_DBSTATUS_LOOKASIDE_HIT
-**
This parameter returns the number malloc attempts that were -** satisfied using lookaside memory. Only the high-water value is meaningful; -** the current value is always zero.)^ -** -** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]] -** ^(
SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE
-**
This parameter returns the number malloc attempts that might have -** been satisfied using lookaside memory but failed due to the amount of -** memory requested being larger than the lookaside slot size. -** Only the high-water value is meaningful; -** the current value is always zero.)^ -** -** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]] -** ^(
SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL
-**
This parameter returns the number malloc attempts that might have -** been satisfied using lookaside memory but failed due to all lookaside -** memory already being in use. -** Only the high-water value is meaningful; -** the current value is always zero.)^ -** -** [[SQLITE_DBSTATUS_CACHE_USED]] ^(
SQLITE_DBSTATUS_CACHE_USED
-**
This parameter returns the approximate number of of bytes of heap -** memory used by all pager caches associated with the database connection.)^ -** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. -** -** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(
SQLITE_DBSTATUS_SCHEMA_USED
-**
This parameter returns the approximate number of of bytes of heap -** memory used to store the schema for all databases associated -** with the connection - main, temp, and any [ATTACH]-ed databases.)^ -** ^The full amount of memory used by the schemas is reported, even if the -** schema memory is shared with other database connections due to -** [shared cache mode] being enabled. -** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0. -** -** [[SQLITE_DBSTATUS_STMT_USED]] ^(
SQLITE_DBSTATUS_STMT_USED
-**
This parameter returns the approximate number of of bytes of heap -** and lookaside memory used by all prepared statements associated with -** the database connection.)^ -** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0. -**
-** -** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(
SQLITE_DBSTATUS_CACHE_HIT
-**
This parameter returns the number of pager cache hits that have -** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT -** is always 0. -**
-** -** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(
SQLITE_DBSTATUS_CACHE_MISS
-**
This parameter returns the number of pager cache misses that have -** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS -** is always 0. -**
-** -** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(
SQLITE_DBSTATUS_CACHE_WRITE
-**
This parameter returns the number of dirty cache entries that have -** been written to disk. Specifically, the number of pages written to the -** wal file in wal mode databases, or the number of pages written to the -** database file in rollback mode databases. Any pages written as part of -** transaction rollback or database recovery operations are not included. -** If an IO or other error occurs while writing a page to disk, the effect -** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The -** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. -**
-** -** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(
SQLITE_DBSTATUS_DEFERRED_FKS
-**
This parameter returns zero for the current value if and only if -** all foreign key constraints (deferred or immediate) have been -** resolved.)^ ^The highwater mark is always 0. -**
-**
-*/ -#define SQLITE_DBSTATUS_LOOKASIDE_USED 0 -#define SQLITE_DBSTATUS_CACHE_USED 1 -#define SQLITE_DBSTATUS_SCHEMA_USED 2 -#define SQLITE_DBSTATUS_STMT_USED 3 -#define SQLITE_DBSTATUS_LOOKASIDE_HIT 4 -#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5 -#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 -#define SQLITE_DBSTATUS_CACHE_HIT 7 -#define SQLITE_DBSTATUS_CACHE_MISS 8 -#define SQLITE_DBSTATUS_CACHE_WRITE 9 -#define SQLITE_DBSTATUS_DEFERRED_FKS 10 -#define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */ - - -/* -** CAPI3REF: Prepared Statement Status -** -** ^(Each prepared statement maintains various -** [SQLITE_STMTSTATUS counters] that measure the number -** of times it has performed specific operations.)^ These counters can -** be used to monitor the performance characteristics of the prepared -** statements. For example, if the number of table steps greatly exceeds -** the number of table searches or result rows, that would tend to indicate -** that the prepared statement is using a full table scan rather than -** an index. -** -** ^(This interface is used to retrieve and reset counter values from -** a [prepared statement]. The first argument is the prepared statement -** object to be interrogated. The second argument -** is an integer code for a specific [SQLITE_STMTSTATUS counter] -** to be interrogated.)^ -** ^The current value of the requested counter is returned. -** ^If the resetFlg is true, then the counter is reset to zero after this -** interface call returns. -** -** See also: [sqlite3_status()] and [sqlite3_db_status()]. -*/ -SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); - -/* -** CAPI3REF: Status Parameters for prepared statements -** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters} -** -** These preprocessor macros define integer codes that name counter -** values associated with the [sqlite3_stmt_status()] interface. -** The meanings of the various counters are as follows: -** -**
-** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]]
SQLITE_STMTSTATUS_FULLSCAN_STEP
-**
^This is the number of times that SQLite has stepped forward in -** a table as part of a full table scan. Large numbers for this counter -** may indicate opportunities for performance improvement through -** careful use of indices.
-** -** [[SQLITE_STMTSTATUS_SORT]]
SQLITE_STMTSTATUS_SORT
-**
^This is the number of sort operations that have occurred. -** A non-zero value in this counter may indicate an opportunity to -** improvement performance through careful use of indices.
-** -** [[SQLITE_STMTSTATUS_AUTOINDEX]]
SQLITE_STMTSTATUS_AUTOINDEX
-**
^This is the number of rows inserted into transient indices that -** were created automatically in order to help joins run faster. -** A non-zero value in this counter may indicate an opportunity to -** improvement performance by adding permanent indices that do not -** need to be reinitialized each time the statement is run.
-** -** [[SQLITE_STMTSTATUS_VM_STEP]]
SQLITE_STMTSTATUS_VM_STEP
-**
^This is the number of virtual machine operations executed -** by the prepared statement if that number is less than or equal -** to 2147483647. The number of virtual machine operations can be -** used as a proxy for the total work done by the prepared statement. -** If the number of virtual machine operations exceeds 2147483647 -** then the value returned by this statement status code is undefined. -**
-**
-*/ -#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 -#define SQLITE_STMTSTATUS_SORT 2 -#define SQLITE_STMTSTATUS_AUTOINDEX 3 -#define SQLITE_STMTSTATUS_VM_STEP 4 - -/* -** CAPI3REF: Custom Page Cache Object -** -** The sqlite3_pcache type is opaque. It is implemented by -** the pluggable module. The SQLite core has no knowledge of -** its size or internal structure and never deals with the -** sqlite3_pcache object except by holding and passing pointers -** to the object. -** -** See [sqlite3_pcache_methods2] for additional information. -*/ -typedef struct sqlite3_pcache sqlite3_pcache; - -/* -** CAPI3REF: Custom Page Cache Object -** -** The sqlite3_pcache_page object represents a single page in the -** page cache. The page cache will allocate instances of this -** object. Various methods of the page cache use pointers to instances -** of this object as parameters or as their return value. -** -** See [sqlite3_pcache_methods2] for additional information. -*/ -typedef struct sqlite3_pcache_page sqlite3_pcache_page; -struct sqlite3_pcache_page { - void *pBuf; /* The content of the page */ - void *pExtra; /* Extra information associated with the page */ -}; - -/* -** CAPI3REF: Application Defined Page Cache. -** KEYWORDS: {page cache} -** -** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can -** register an alternative page cache implementation by passing in an -** instance of the sqlite3_pcache_methods2 structure.)^ -** In many applications, most of the heap memory allocated by -** SQLite is used for the page cache. -** By implementing a -** custom page cache using this API, an application can better control -** the amount of memory consumed by SQLite, the way in which -** that memory is allocated and released, and the policies used to -** determine exactly which parts of a database file are cached and for -** how long. -** -** The alternative page cache mechanism is an -** extreme measure that is only needed by the most demanding applications. -** The built-in page cache is recommended for most uses. -** -** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an -** internal buffer by SQLite within the call to [sqlite3_config]. Hence -** the application may discard the parameter after the call to -** [sqlite3_config()] returns.)^ -** -** [[the xInit() page cache method]] -** ^(The xInit() method is called once for each effective -** call to [sqlite3_initialize()])^ -** (usually only once during the lifetime of the process). ^(The xInit() -** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ -** The intent of the xInit() method is to set up global data structures -** required by the custom page cache implementation. -** ^(If the xInit() method is NULL, then the -** built-in default page cache is used instead of the application defined -** page cache.)^ -** -** [[the xShutdown() page cache method]] -** ^The xShutdown() method is called by [sqlite3_shutdown()]. -** It can be used to clean up -** any outstanding resources before process shutdown, if required. -** ^The xShutdown() method may be NULL. -** -** ^SQLite automatically serializes calls to the xInit method, -** so the xInit method need not be threadsafe. ^The -** xShutdown method is only called from [sqlite3_shutdown()] so it does -** not need to be threadsafe either. All other methods must be threadsafe -** in multithreaded applications. -** -** ^SQLite will never invoke xInit() more than once without an intervening -** call to xShutdown(). -** -** [[the xCreate() page cache methods]] -** ^SQLite invokes the xCreate() method to construct a new cache instance. -** SQLite will typically create one cache instance for each open database file, -** though this is not guaranteed. ^The -** first parameter, szPage, is the size in bytes of the pages that must -** be allocated by the cache. ^szPage will always a power of two. ^The -** second parameter szExtra is a number of bytes of extra storage -** associated with each page cache entry. ^The szExtra parameter will -** a number less than 250. SQLite will use the -** extra szExtra bytes on each page to store metadata about the underlying -** database page on disk. The value passed into szExtra depends -** on the SQLite version, the target platform, and how SQLite was compiled. -** ^The third argument to xCreate(), bPurgeable, is true if the cache being -** created will be used to cache database pages of a file stored on disk, or -** false if it is used for an in-memory database. The cache implementation -** does not have to do anything special based with the value of bPurgeable; -** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will -** never invoke xUnpin() except to deliberately delete a page. -** ^In other words, calls to xUnpin() on a cache with bPurgeable set to -** false will always have the "discard" flag set to true. -** ^Hence, a cache created with bPurgeable false will -** never contain any unpinned pages. -** -** [[the xCachesize() page cache method]] -** ^(The xCachesize() method may be called at any time by SQLite to set the -** suggested maximum cache-size (number of pages stored by) the cache -** instance passed as the first argument. This is the value configured using -** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable -** parameter, the implementation is not required to do anything with this -** value; it is advisory only. -** -** [[the xPagecount() page cache methods]] -** The xPagecount() method must return the number of pages currently -** stored in the cache, both pinned and unpinned. -** -** [[the xFetch() page cache methods]] -** The xFetch() method locates a page in the cache and returns a pointer to -** an sqlite3_pcache_page object associated with that page, or a NULL pointer. -** The pBuf element of the returned sqlite3_pcache_page object will be a -** pointer to a buffer of szPage bytes used to store the content of a -** single database page. The pExtra element of sqlite3_pcache_page will be -** a pointer to the szExtra bytes of extra storage that SQLite has requested -** for each entry in the page cache. -** -** The page to be fetched is determined by the key. ^The minimum key value -** is 1. After it has been retrieved using xFetch, the page is considered -** to be "pinned". -** -** If the requested page is already in the page cache, then the page cache -** implementation must return a pointer to the page buffer with its content -** intact. If the requested page is not already in the cache, then the -** cache implementation should use the value of the createFlag -** parameter to help it determined what action to take: -** -** -**
createFlag Behavior when page is not already in cache -**
0 Do not allocate a new page. Return NULL. -**
1 Allocate a new page if it easy and convenient to do so. -** Otherwise return NULL. -**
2 Make every effort to allocate a new page. Only return -** NULL if allocating a new page is effectively impossible. -**
-** -** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite -** will only use a createFlag of 2 after a prior call with a createFlag of 1 -** failed.)^ In between the to xFetch() calls, SQLite may -** attempt to unpin one or more cache pages by spilling the content of -** pinned pages to disk and synching the operating system disk cache. -** -** [[the xUnpin() page cache method]] -** ^xUnpin() is called by SQLite with a pointer to a currently pinned page -** as its second argument. If the third parameter, discard, is non-zero, -** then the page must be evicted from the cache. -** ^If the discard parameter is -** zero, then the page may be discarded or retained at the discretion of -** page cache implementation. ^The page cache implementation -** may choose to evict unpinned pages at any time. -** -** The cache must not perform any reference counting. A single -** call to xUnpin() unpins the page regardless of the number of prior calls -** to xFetch(). -** -** [[the xRekey() page cache methods]] -** The xRekey() method is used to change the key value associated with the -** page passed as the second argument. If the cache -** previously contains an entry associated with newKey, it must be -** discarded. ^Any prior cache entry associated with newKey is guaranteed not -** to be pinned. -** -** When SQLite calls the xTruncate() method, the cache must discard all -** existing cache entries with page numbers (keys) greater than or equal -** to the value of the iLimit parameter passed to xTruncate(). If any -** of these pages are pinned, they are implicitly unpinned, meaning that -** they can be safely discarded. -** -** [[the xDestroy() page cache method]] -** ^The xDestroy() method is used to delete a cache allocated by xCreate(). -** All resources associated with the specified cache should be freed. ^After -** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] -** handle invalid, and will not use it with any other sqlite3_pcache_methods2 -** functions. -** -** [[the xShrink() page cache method]] -** ^SQLite invokes the xShrink() method when it wants the page cache to -** free up as much of heap memory as possible. The page cache implementation -** is not obligated to free any memory, but well-behaved implementations should -** do their best. -*/ -typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; -struct sqlite3_pcache_methods2 { - int iVersion; - void *pArg; - int (*xInit)(void*); - void (*xShutdown)(void*); - sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable); - void (*xCachesize)(sqlite3_pcache*, int nCachesize); - int (*xPagecount)(sqlite3_pcache*); - sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); - void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard); - void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, - unsigned oldKey, unsigned newKey); - void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); - void (*xDestroy)(sqlite3_pcache*); - void (*xShrink)(sqlite3_pcache*); -}; - -/* -** This is the obsolete pcache_methods object that has now been replaced -** by sqlite3_pcache_methods2. This object is not used by SQLite. It is -** retained in the header file for backwards compatibility only. -*/ -typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; -struct sqlite3_pcache_methods { - void *pArg; - int (*xInit)(void*); - void (*xShutdown)(void*); - sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); - void (*xCachesize)(sqlite3_pcache*, int nCachesize); - int (*xPagecount)(sqlite3_pcache*); - void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); - void (*xUnpin)(sqlite3_pcache*, void*, int discard); - void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); - void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); - void (*xDestroy)(sqlite3_pcache*); -}; - - -/* -** CAPI3REF: Online Backup Object -** -** The sqlite3_backup object records state information about an ongoing -** online backup operation. ^The sqlite3_backup object is created by -** a call to [sqlite3_backup_init()] and is destroyed by a call to -** [sqlite3_backup_finish()]. -** -** See Also: [Using the SQLite Online Backup API] -*/ -typedef struct sqlite3_backup sqlite3_backup; - -/* -** CAPI3REF: Online Backup API. -** -** The backup API copies the content of one database into another. -** It is useful either for creating backups of databases or -** for copying in-memory databases to or from persistent files. -** -** See Also: [Using the SQLite Online Backup API] -** -** ^SQLite holds a write transaction open on the destination database file -** for the duration of the backup operation. -** ^The source database is read-locked only while it is being read; -** it is not locked continuously for the entire backup operation. -** ^Thus, the backup may be performed on a live source database without -** preventing other database connections from -** reading or writing to the source database while the backup is underway. -** -** ^(To perform a backup operation: -**
    -**
  1. sqlite3_backup_init() is called once to initialize the -** backup, -**
  2. sqlite3_backup_step() is called one or more times to transfer -** the data between the two databases, and finally -**
  3. sqlite3_backup_finish() is called to release all resources -** associated with the backup operation. -**
)^ -** There should be exactly one call to sqlite3_backup_finish() for each -** successful call to sqlite3_backup_init(). -** -** [[sqlite3_backup_init()]] sqlite3_backup_init() -** -** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the -** [database connection] associated with the destination database -** and the database name, respectively. -** ^The database name is "main" for the main database, "temp" for the -** temporary database, or the name specified after the AS keyword in -** an [ATTACH] statement for an attached database. -** ^The S and M arguments passed to -** sqlite3_backup_init(D,N,S,M) identify the [database connection] -** and database name of the source database, respectively. -** ^The source and destination [database connections] (parameters S and D) -** must be different or else sqlite3_backup_init(D,N,S,M) will fail with -** an error. -** -** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is -** returned and an error code and error message are stored in the -** destination [database connection] D. -** ^The error code and message for the failed call to sqlite3_backup_init() -** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or -** [sqlite3_errmsg16()] functions. -** ^A successful call to sqlite3_backup_init() returns a pointer to an -** [sqlite3_backup] object. -** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and -** sqlite3_backup_finish() functions to perform the specified backup -** operation. -** -** [[sqlite3_backup_step()]] sqlite3_backup_step() -** -** ^Function sqlite3_backup_step(B,N) will copy up to N pages between -** the source and destination databases specified by [sqlite3_backup] object B. -** ^If N is negative, all remaining source pages are copied. -** ^If sqlite3_backup_step(B,N) successfully copies N pages and there -** are still more pages to be copied, then the function returns [SQLITE_OK]. -** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages -** from source to destination, then it returns [SQLITE_DONE]. -** ^If an error occurs while running sqlite3_backup_step(B,N), -** then an [error code] is returned. ^As well as [SQLITE_OK] and -** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY], -** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an -** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code. -** -** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if -**
    -**
  1. the destination database was opened read-only, or -**
  2. the destination database is using write-ahead-log journaling -** and the destination and source page sizes differ, or -**
  3. the destination database is an in-memory database and the -** destination and source page sizes differ. -**
)^ -** -** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then -** the [sqlite3_busy_handler | busy-handler function] -** is invoked (if one is specified). ^If the -** busy-handler returns non-zero before the lock is available, then -** [SQLITE_BUSY] is returned to the caller. ^In this case the call to -** sqlite3_backup_step() can be retried later. ^If the source -** [database connection] -** is being used to write to the source database when sqlite3_backup_step() -** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this -** case the call to sqlite3_backup_step() can be retried later on. ^(If -** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or -** [SQLITE_READONLY] is returned, then -** there is no point in retrying the call to sqlite3_backup_step(). These -** errors are considered fatal.)^ The application must accept -** that the backup operation has failed and pass the backup operation handle -** to the sqlite3_backup_finish() to release associated resources. -** -** ^The first call to sqlite3_backup_step() obtains an exclusive lock -** on the destination file. ^The exclusive lock is not released until either -** sqlite3_backup_finish() is called or the backup operation is complete -** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to -** sqlite3_backup_step() obtains a [shared lock] on the source database that -** lasts for the duration of the sqlite3_backup_step() call. -** ^Because the source database is not locked between calls to -** sqlite3_backup_step(), the source database may be modified mid-way -** through the backup process. ^If the source database is modified by an -** external process or via a database connection other than the one being -** used by the backup operation, then the backup will be automatically -** restarted by the next call to sqlite3_backup_step(). ^If the source -** database is modified by the using the same database connection as is used -** by the backup operation, then the backup database is automatically -** updated at the same time. -** -** [[sqlite3_backup_finish()]] sqlite3_backup_finish() -** -** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the -** application wishes to abandon the backup operation, the application -** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). -** ^The sqlite3_backup_finish() interfaces releases all -** resources associated with the [sqlite3_backup] object. -** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any -** active write-transaction on the destination database is rolled back. -** The [sqlite3_backup] object is invalid -** and may not be used following a call to sqlite3_backup_finish(). -** -** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no -** sqlite3_backup_step() errors occurred, regardless or whether or not -** sqlite3_backup_step() completed. -** ^If an out-of-memory condition or IO error occurred during any prior -** sqlite3_backup_step() call on the same [sqlite3_backup] object, then -** sqlite3_backup_finish() returns the corresponding [error code]. -** -** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() -** is not a permanent error and does not affect the return value of -** sqlite3_backup_finish(). -** -** [[sqlite3_backup__remaining()]] [[sqlite3_backup_pagecount()]] -** sqlite3_backup_remaining() and sqlite3_backup_pagecount() -** -** ^Each call to sqlite3_backup_step() sets two values inside -** the [sqlite3_backup] object: the number of pages still to be backed -** up and the total number of pages in the source database file. -** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces -** retrieve these two values, respectively. -** -** ^The values returned by these functions are only updated by -** sqlite3_backup_step(). ^If the source database is modified during a backup -** operation, then the values are not updated to account for any extra -** pages that need to be updated or the size of the source database file -** changing. -** -** Concurrent Usage of Database Handles -** -** ^The source [database connection] may be used by the application for other -** purposes while a backup operation is underway or being initialized. -** ^If SQLite is compiled and configured to support threadsafe database -** connections, then the source database connection may be used concurrently -** from within other threads. -** -** However, the application must guarantee that the destination -** [database connection] is not passed to any other API (by any thread) after -** sqlite3_backup_init() is called and before the corresponding call to -** sqlite3_backup_finish(). SQLite does not currently check to see -** if the application incorrectly accesses the destination [database connection] -** and so no error code is reported, but the operations may malfunction -** nevertheless. Use of the destination database connection while a -** backup is in progress might also also cause a mutex deadlock. -** -** If running in [shared cache mode], the application must -** guarantee that the shared cache used by the destination database -** is not accessed while the backup is running. In practice this means -** that the application must guarantee that the disk file being -** backed up to is not accessed by any connection within the process, -** not just the specific connection that was passed to sqlite3_backup_init(). -** -** The [sqlite3_backup] object itself is partially threadsafe. Multiple -** threads may safely make multiple concurrent calls to sqlite3_backup_step(). -** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() -** APIs are not strictly speaking threadsafe. If they are invoked at the -** same time as another thread is invoking sqlite3_backup_step() it is -** possible that they return invalid values. -*/ -SQLITE_API sqlite3_backup *sqlite3_backup_init( - sqlite3 *pDest, /* Destination database handle */ - const char *zDestName, /* Destination database name */ - sqlite3 *pSource, /* Source database handle */ - const char *zSourceName /* Source database name */ -); -SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); -SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); -SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p); -SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); - -/* -** CAPI3REF: Unlock Notification -** -** ^When running in shared-cache mode, a database operation may fail with -** an [SQLITE_LOCKED] error if the required locks on the shared-cache or -** individual tables within the shared-cache cannot be obtained. See -** [SQLite Shared-Cache Mode] for a description of shared-cache locking. -** ^This API may be used to register a callback that SQLite will invoke -** when the connection currently holding the required lock relinquishes it. -** ^This API is only available if the library was compiled with the -** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. -** -** See Also: [Using the SQLite Unlock Notification Feature]. -** -** ^Shared-cache locks are released when a database connection concludes -** its current transaction, either by committing it or rolling it back. -** -** ^When a connection (known as the blocked connection) fails to obtain a -** shared-cache lock and SQLITE_LOCKED is returned to the caller, the -** identity of the database connection (the blocking connection) that -** has locked the required resource is stored internally. ^After an -** application receives an SQLITE_LOCKED error, it may call the -** sqlite3_unlock_notify() method with the blocked connection handle as -** the first argument to register for a callback that will be invoked -** when the blocking connections current transaction is concluded. ^The -** callback is invoked from within the [sqlite3_step] or [sqlite3_close] -** call that concludes the blocking connections transaction. -** -** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, -** there is a chance that the blocking connection will have already -** concluded its transaction by the time sqlite3_unlock_notify() is invoked. -** If this happens, then the specified callback is invoked immediately, -** from within the call to sqlite3_unlock_notify().)^ -** -** ^If the blocked connection is attempting to obtain a write-lock on a -** shared-cache table, and more than one other connection currently holds -** a read-lock on the same table, then SQLite arbitrarily selects one of -** the other connections to use as the blocking connection. -** -** ^(There may be at most one unlock-notify callback registered by a -** blocked connection. If sqlite3_unlock_notify() is called when the -** blocked connection already has a registered unlock-notify callback, -** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is -** called with a NULL pointer as its second argument, then any existing -** unlock-notify callback is canceled. ^The blocked connections -** unlock-notify callback may also be canceled by closing the blocked -** connection using [sqlite3_close()]. -** -** The unlock-notify callback is not reentrant. If an application invokes -** any sqlite3_xxx API functions from within an unlock-notify callback, a -** crash or deadlock may be the result. -** -** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always -** returns SQLITE_OK. -** -** Callback Invocation Details -** -** When an unlock-notify callback is registered, the application provides a -** single void* pointer that is passed to the callback when it is invoked. -** However, the signature of the callback function allows SQLite to pass -** it an array of void* context pointers. The first argument passed to -** an unlock-notify callback is a pointer to an array of void* pointers, -** and the second is the number of entries in the array. -** -** When a blocking connections transaction is concluded, there may be -** more than one blocked connection that has registered for an unlock-notify -** callback. ^If two or more such blocked connections have specified the -** same callback function, then instead of invoking the callback function -** multiple times, it is invoked once with the set of void* context pointers -** specified by the blocked connections bundled together into an array. -** This gives the application an opportunity to prioritize any actions -** related to the set of unblocked database connections. -** -** Deadlock Detection -** -** Assuming that after registering for an unlock-notify callback a -** database waits for the callback to be issued before taking any further -** action (a reasonable assumption), then using this API may cause the -** application to deadlock. For example, if connection X is waiting for -** connection Y's transaction to be concluded, and similarly connection -** Y is waiting on connection X's transaction, then neither connection -** will proceed and the system may remain deadlocked indefinitely. -** -** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock -** detection. ^If a given call to sqlite3_unlock_notify() would put the -** system in a deadlocked state, then SQLITE_LOCKED is returned and no -** unlock-notify callback is registered. The system is said to be in -** a deadlocked state if connection A has registered for an unlock-notify -** callback on the conclusion of connection B's transaction, and connection -** B has itself registered for an unlock-notify callback when connection -** A's transaction is concluded. ^Indirect deadlock is also detected, so -** the system is also considered to be deadlocked if connection B has -** registered for an unlock-notify callback on the conclusion of connection -** C's transaction, where connection C is waiting on connection A. ^Any -** number of levels of indirection are allowed. -** -** The "DROP TABLE" Exception -** -** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost -** always appropriate to call sqlite3_unlock_notify(). There is however, -** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, -** SQLite checks if there are any currently executing SELECT statements -** that belong to the same connection. If there are, SQLITE_LOCKED is -** returned. In this case there is no "blocking connection", so invoking -** sqlite3_unlock_notify() results in the unlock-notify callback being -** invoked immediately. If the application then re-attempts the "DROP TABLE" -** or "DROP INDEX" query, an infinite loop might be the result. -** -** One way around this problem is to check the extended error code returned -** by an sqlite3_step() call. ^(If there is a blocking connection, then the -** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in -** the special "DROP TABLE/INDEX" case, the extended error code is just -** SQLITE_LOCKED.)^ -*/ -SQLITE_API int sqlite3_unlock_notify( - sqlite3 *pBlocked, /* Waiting connection */ - void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ - void *pNotifyArg /* Argument to pass to xNotify */ -); - - -/* -** CAPI3REF: String Comparison -** -** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications -** and extensions to compare the contents of two buffers containing UTF-8 -** strings in a case-independent fashion, using the same definition of "case -** independence" that SQLite uses internally when comparing identifiers. -*/ -SQLITE_API int sqlite3_stricmp(const char *, const char *); -SQLITE_API int sqlite3_strnicmp(const char *, const char *, int); - -/* -** CAPI3REF: String Globbing -* -** ^The [sqlite3_strglob(P,X)] interface returns zero if string X matches -** the glob pattern P, and it returns non-zero if string X does not match -** the glob pattern P. ^The definition of glob pattern matching used in -** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the -** SQL dialect used by SQLite. ^The sqlite3_strglob(P,X) function is case -** sensitive. -** -** Note that this routine returns zero on a match and non-zero if the strings -** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. -*/ -SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr); - -/* -** CAPI3REF: Error Logging Interface -** -** ^The [sqlite3_log()] interface writes a message into the [error log] -** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. -** ^If logging is enabled, the zFormat string and subsequent arguments are -** used with [sqlite3_snprintf()] to generate the final output string. -** -** The sqlite3_log() interface is intended for use by extensions such as -** virtual tables, collating functions, and SQL functions. While there is -** nothing to prevent an application from calling sqlite3_log(), doing so -** is considered bad form. -** -** The zFormat string must not be NULL. -** -** To avoid deadlocks and other threading problems, the sqlite3_log() routine -** will not use dynamically allocated memory. The log message is stored in -** a fixed-length buffer on the stack. If the log message is longer than -** a few hundred characters, it will be truncated to the length of the -** buffer. -*/ -SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); - -/* -** CAPI3REF: Write-Ahead Log Commit Hook -** -** ^The [sqlite3_wal_hook()] function is used to register a callback that -** will be invoked each time a database connection commits data to a -** [write-ahead log] (i.e. whenever a transaction is committed in -** [journal_mode | journal_mode=WAL mode]). -** -** ^The callback is invoked by SQLite after the commit has taken place and -** the associated write-lock on the database released, so the implementation -** may read, write or [checkpoint] the database as required. -** -** ^The first parameter passed to the callback function when it is invoked -** is a copy of the third parameter passed to sqlite3_wal_hook() when -** registering the callback. ^The second is a copy of the database handle. -** ^The third parameter is the name of the database that was written to - -** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter -** is the number of pages currently in the write-ahead log file, -** including those that were just committed. -** -** The callback function should normally return [SQLITE_OK]. ^If an error -** code is returned, that error will propagate back up through the -** SQLite code base to cause the statement that provoked the callback -** to report an error, though the commit will have still occurred. If the -** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value -** that does not correspond to any valid SQLite error code, the results -** are undefined. -** -** A single database handle may have at most a single write-ahead log callback -** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any -** previously registered write-ahead log callback. ^Note that the -** [sqlite3_wal_autocheckpoint()] interface and the -** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will -** those overwrite any prior [sqlite3_wal_hook()] settings. -*/ -SQLITE_API void *sqlite3_wal_hook( - sqlite3*, - int(*)(void *,sqlite3*,const char*,int), - void* -); - -/* -** CAPI3REF: Configure an auto-checkpoint -** -** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around -** [sqlite3_wal_hook()] that causes any database on [database connection] D -** to automatically [checkpoint] -** after committing a transaction if there are N or -** more frames in the [write-ahead log] file. ^Passing zero or -** a negative value as the nFrame parameter disables automatic -** checkpoints entirely. -** -** ^The callback registered by this function replaces any existing callback -** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback -** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism -** configured by this function. -** -** ^The [wal_autocheckpoint pragma] can be used to invoke this interface -** from SQL. -** -** ^Every new [database connection] defaults to having the auto-checkpoint -** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT] -** pages. The use of this interface -** is only necessary if the default setting is found to be suboptimal -** for a particular application. -*/ -SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N); - -/* -** CAPI3REF: Checkpoint a database -** -** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X -** on [database connection] D to be [checkpointed]. ^If X is NULL or an -** empty string, then a checkpoint is run on all databases of -** connection D. ^If the database connection D is not in -** [WAL | write-ahead log mode] then this interface is a harmless no-op. -** -** ^The [wal_checkpoint pragma] can be used to invoke this interface -** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the -** [wal_autocheckpoint pragma] can be used to cause this interface to be -** run whenever the WAL reaches a certain size threshold. -** -** See also: [sqlite3_wal_checkpoint_v2()] -*/ -SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); - -/* -** CAPI3REF: Checkpoint a database -** -** Run a checkpoint operation on WAL database zDb attached to database -** handle db. The specific operation is determined by the value of the -** eMode parameter: -** -**
-**
SQLITE_CHECKPOINT_PASSIVE
-** Checkpoint as many frames as possible without waiting for any database -** readers or writers to finish. Sync the db file if all frames in the log -** are checkpointed. This mode is the same as calling -** sqlite3_wal_checkpoint(). The busy-handler callback is never invoked. -** -**
SQLITE_CHECKPOINT_FULL
-** This mode blocks (calls the busy-handler callback) until there is no -** database writer and all readers are reading from the most recent database -** snapshot. It then checkpoints all frames in the log file and syncs the -** database file. This call blocks database writers while it is running, -** but not database readers. -** -**
SQLITE_CHECKPOINT_RESTART
-** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after -** checkpointing the log file it blocks (calls the busy-handler callback) -** until all readers are reading from the database file only. This ensures -** that the next client to write to the database file restarts the log file -** from the beginning. This call blocks database writers while it is running, -** but not database readers. -**
-** -** If pnLog is not NULL, then *pnLog is set to the total number of frames in -** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to -** the total number of checkpointed frames (including any that were already -** checkpointed when this function is called). *pnLog and *pnCkpt may be -** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK. -** If no values are available because of an error, they are both set to -1 -** before returning to communicate this to the caller. -** -** All calls obtain an exclusive "checkpoint" lock on the database file. If -** any other process is running a checkpoint operation at the same time, the -** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a -** busy-handler configured, it will not be invoked in this case. -** -** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive -** "writer" lock on the database file. If the writer lock cannot be obtained -** immediately, and a busy-handler is configured, it is invoked and the writer -** lock retried until either the busy-handler returns 0 or the lock is -** successfully obtained. The busy-handler is also invoked while waiting for -** database readers as described above. If the busy-handler returns 0 before -** the writer lock is obtained or while waiting for database readers, the -** checkpoint operation proceeds from that point in the same way as -** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible -** without blocking any further. SQLITE_BUSY is returned in this case. -** -** If parameter zDb is NULL or points to a zero length string, then the -** specified operation is attempted on all WAL databases. In this case the -** values written to output parameters *pnLog and *pnCkpt are undefined. If -** an SQLITE_BUSY error is encountered when processing one or more of the -** attached WAL databases, the operation is still attempted on any remaining -** attached databases and SQLITE_BUSY is returned to the caller. If any other -** error occurs while processing an attached database, processing is abandoned -** and the error code returned to the caller immediately. If no error -** (SQLITE_BUSY or otherwise) is encountered while processing the attached -** databases, SQLITE_OK is returned. -** -** If database zDb is the name of an attached database that is not in WAL -** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If -** zDb is not NULL (or a zero length string) and is not the name of any -** attached database, SQLITE_ERROR is returned to the caller. -*/ -SQLITE_API int sqlite3_wal_checkpoint_v2( - sqlite3 *db, /* Database handle */ - const char *zDb, /* Name of attached database (or NULL) */ - int eMode, /* SQLITE_CHECKPOINT_* value */ - int *pnLog, /* OUT: Size of WAL log in frames */ - int *pnCkpt /* OUT: Total number of frames checkpointed */ -); - -/* -** CAPI3REF: Checkpoint operation parameters -** -** These constants can be used as the 3rd parameter to -** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()] -** documentation for additional information about the meaning and use of -** each of these values. -*/ -#define SQLITE_CHECKPOINT_PASSIVE 0 -#define SQLITE_CHECKPOINT_FULL 1 -#define SQLITE_CHECKPOINT_RESTART 2 - -/* -** CAPI3REF: Virtual Table Interface Configuration -** -** This function may be called by either the [xConnect] or [xCreate] method -** of a [virtual table] implementation to configure -** various facets of the virtual table interface. -** -** If this interface is invoked outside the context of an xConnect or -** xCreate virtual table method then the behavior is undefined. -** -** At present, there is only one option that may be configured using -** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options -** may be added in the future. -*/ -SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); - -/* -** CAPI3REF: Virtual Table Configuration Options -** -** These macros define the various options to the -** [sqlite3_vtab_config()] interface that [virtual table] implementations -** can use to customize and optimize their behavior. -** -**
-**
SQLITE_VTAB_CONSTRAINT_SUPPORT -**
Calls of the form -** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, -** where X is an integer. If X is zero, then the [virtual table] whose -** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not -** support constraints. In this configuration (which is the default) if -** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire -** statement is rolled back as if [ON CONFLICT | OR ABORT] had been -** specified as part of the users SQL statement, regardless of the actual -** ON CONFLICT mode specified. -** -** If X is non-zero, then the virtual table implementation guarantees -** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before -** any modifications to internal or persistent data structures have been made. -** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite -** is able to roll back a statement or database transaction, and abandon -** or continue processing the current SQL statement as appropriate. -** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns -** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode -** had been ABORT. -** -** Virtual table implementations that are required to handle OR REPLACE -** must do so within the [xUpdate] method. If a call to the -** [sqlite3_vtab_on_conflict()] function indicates that the current ON -** CONFLICT policy is REPLACE, the virtual table implementation should -** silently replace the appropriate rows within the xUpdate callback and -** return SQLITE_OK. Or, if this is not possible, it may return -** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT -** constraint handling. -**
-*/ -#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 - -/* -** CAPI3REF: Determine The Virtual Table Conflict Policy -** -** This function may only be called from within a call to the [xUpdate] method -** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The -** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL], -** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode -** of the SQL statement that triggered the call to the [xUpdate] method of the -** [virtual table]. -*/ -SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); - -/* -** CAPI3REF: Conflict resolution modes -** -** These constants are returned by [sqlite3_vtab_on_conflict()] to -** inform a [virtual table] implementation what the [ON CONFLICT] mode -** is for the SQL statement being evaluated. -** -** Note that the [SQLITE_IGNORE] constant is also used as a potential -** return value from the [sqlite3_set_authorizer()] callback and that -** [SQLITE_ABORT] is also a [result code]. -*/ -#define SQLITE_ROLLBACK 1 -/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */ -#define SQLITE_FAIL 3 -/* #define SQLITE_ABORT 4 // Also an error code */ -#define SQLITE_REPLACE 5 - - - -/* -** Undo the hack that converts floating point types to integer for -** builds on processors without floating point support. -*/ -#ifdef SQLITE_OMIT_FLOATING_POINT -# undef double -#endif - -#if 0 -} /* End of the 'extern "C"' block */ -#endif -#endif /* _SQLITE3_H_ */ - -/* -** 2010 August 30 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -*/ - -#ifndef _SQLITE3RTREE_H_ -#define _SQLITE3RTREE_H_ - - -#if 0 -extern "C" { -#endif - -typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; - -/* -** Register a geometry callback named zGeom that can be used as part of an -** R-Tree geometry query as follows: -** -** SELECT ... FROM WHERE MATCH $zGeom(... params ...) -*/ -SQLITE_API int sqlite3_rtree_geometry_callback( - sqlite3 *db, - const char *zGeom, -#ifdef SQLITE_RTREE_INT_ONLY - int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes), -#else - int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes), -#endif - void *pContext -); - - -/* -** A pointer to a structure of the following type is passed as the first -** argument to callbacks registered using rtree_geometry_callback(). -*/ -struct sqlite3_rtree_geometry { - void *pContext; /* Copy of pContext passed to s_r_g_c() */ - int nParam; /* Size of array aParam[] */ - double *aParam; /* Parameters passed to SQL geom function */ - void *pUser; /* Callback implementation user data */ - void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ -}; - - -#if 0 -} /* end of the 'extern "C"' block */ -#endif - -#endif /* ifndef _SQLITE3RTREE_H_ */ - - -/************** End of sqlite3.h *********************************************/ -/************** Begin file sqliteInt.h ***************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Internal interface definitions for SQLite. -** -*/ -#ifndef _SQLITEINT_H_ -#define _SQLITEINT_H_ - -/* -** These #defines should enable >2GB file support on POSIX if the -** underlying operating system supports it. If the OS lacks -** large file support, or if the OS is windows, these should be no-ops. -** -** Ticket #2739: The _LARGEFILE_SOURCE macro must appear before any -** system #includes. Hence, this block of code must be the very first -** code in all source files. -** -** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch -** on the compiler command line. This is necessary if you are compiling -** on a recent machine (ex: Red Hat 7.2) but you want your code to work -** on an older machine (ex: Red Hat 6.0). If you compile on Red Hat 7.2 -** without this option, LFS is enable. But LFS does not exist in the kernel -** in Red Hat 6.0, so the code won't work. Hence, for maximum binary -** portability you should omit LFS. -** -** Similar is true for Mac OS X. LFS is only supported on Mac OS X 9 and later. -*/ -#ifndef SQLITE_DISABLE_LFS -# define _LARGE_FILE 1 -# ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -# endif -# define _LARGEFILE_SOURCE 1 -#endif - -/* -** Include the configuration header output by 'configure' if we're using the -** autoconf-based build -*/ -#ifdef _HAVE_SQLITE_CONFIG_H -#include "config.h" -#endif - -/************** Include sqliteLimit.h in the middle of sqliteInt.h ***********/ -/************** Begin file sqliteLimit.h *************************************/ -/* -** 2007 May 7 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file defines various limits of what SQLite can process. -*/ - -/* -** The maximum length of a TEXT or BLOB in bytes. This also -** limits the size of a row in a table or index. -** -** The hard limit is the ability of a 32-bit signed integer -** to count the size: 2^31-1 or 2147483647. -*/ -#ifndef SQLITE_MAX_LENGTH -# define SQLITE_MAX_LENGTH 1000000000 -#endif - -/* -** This is the maximum number of -** -** * Columns in a table -** * Columns in an index -** * Columns in a view -** * Terms in the SET clause of an UPDATE statement -** * Terms in the result set of a SELECT statement -** * Terms in the GROUP BY or ORDER BY clauses of a SELECT statement. -** * Terms in the VALUES clause of an INSERT statement -** -** The hard upper limit here is 32676. Most database people will -** tell you that in a well-normalized database, you usually should -** not have more than a dozen or so columns in any table. And if -** that is the case, there is no point in having more than a few -** dozen values in any of the other situations described above. -*/ -#ifndef SQLITE_MAX_COLUMN -# define SQLITE_MAX_COLUMN 2000 -#endif - -/* -** The maximum length of a single SQL statement in bytes. -** -** It used to be the case that setting this value to zero would -** turn the limit off. That is no longer true. It is not possible -** to turn this limit off. -*/ -#ifdef SQLITE_OMIT_FLOATING_POINT -# define double sqlite_int64 -# define float sqlite_int64 -# define LONGDOUBLE_TYPE sqlite_int64 -# ifndef SQLITE_BIG_DBL -# define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50) -# endif -# define SQLITE_OMIT_DATETIME_FUNCS 1 -# define SQLITE_OMIT_TRACE 1 -# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT -# undef SQLITE_HAVE_ISNAN -#else -# ifdef __vax__ -# include -# define SQLITE_BIG_DBL DBL_MAX -# define SQLITE_HUGE_DBL DBL_MAX -# define SQLITE_HUGE_COST 1e38 -# endif -#endif -#ifndef SQLITE_BIG_DBL -# define SQLITE_BIG_DBL (1e99) -#endif -#ifndef SQLITE_HUGE_DBL -# define SQLITE_HUGE_DBL (1.0e+308) -#endif -#ifndef SQLITE_MAX_SQL_LENGTH -# define SQLITE_MAX_SQL_LENGTH 1000000000 -#endif -#ifndef SQLITE_HUGE_COST -# define SQLITE_HUGE_COST 1e50 -#endif - -/* -** The maximum depth of an expression tree. This is limited to -** some extent by SQLITE_MAX_SQL_LENGTH. But sometime you might -** want to place more severe limits on the complexity of an -** expression. -** -** A value of 0 used to mean that the limit was not enforced. -** But that is no longer true. The limit is now strictly enforced -** at all times. -*/ -#ifndef SQLITE_MAX_EXPR_DEPTH -# define SQLITE_MAX_EXPR_DEPTH 1000 -#endif - -/* -** The maximum number of terms in a compound SELECT statement. -** The code generator for compound SELECT statements does one -** level of recursion for each term. A stack overflow can result -** if the number of terms is too large. In practice, most SQL -** never has more than 3 or 4 terms. Use a value of 0 to disable -** any limit on the number of terms in a compount SELECT. -*/ -#ifndef SQLITE_MAX_COMPOUND_SELECT -# define SQLITE_MAX_COMPOUND_SELECT 500 -#endif - -/* -** The maximum number of opcodes in a VDBE program. -** Not currently enforced. -*/ -#ifndef SQLITE_MAX_VDBE_OP -# define SQLITE_MAX_VDBE_OP 25000 -#endif - -/* -** The maximum number of arguments to an SQL function. -*/ -#ifndef SQLITE_MAX_FUNCTION_ARG -# define SQLITE_MAX_FUNCTION_ARG 127 -#endif - -/* -** The maximum number of in-memory pages to use for the main database -** table and for temporary tables. The SQLITE_DEFAULT_CACHE_SIZE -*/ -#ifndef SQLITE_DEFAULT_CACHE_SIZE -# define SQLITE_DEFAULT_CACHE_SIZE 2000 -#endif -#ifndef SQLITE_DEFAULT_TEMP_CACHE_SIZE -# define SQLITE_DEFAULT_TEMP_CACHE_SIZE 500 -#endif - -/* -** The default number of frames to accumulate in the log file before -** checkpointing the database in WAL mode. -*/ -#ifndef SQLITE_DEFAULT_WAL_AUTOCHECKPOINT -# define SQLITE_DEFAULT_WAL_AUTOCHECKPOINT 1000 -#endif - -/* -** The maximum number of attached databases. This must be between 0 -** and 62. The upper bound on 62 is because a 64-bit integer bitmap -** is used internally to track attached databases. -*/ -#ifndef SQLITE_MAX_ATTACHED -# define SQLITE_MAX_ATTACHED 10 -#endif - - -/* -** The maximum value of a ?nnn wildcard that the parser will accept. -*/ -#ifndef SQLITE_MAX_VARIABLE_NUMBER -# define SQLITE_MAX_VARIABLE_NUMBER 999 -#endif - -/* Maximum page size. The upper bound on this value is 65536. This a limit -** imposed by the use of 16-bit offsets within each page. -** -** Earlier versions of SQLite allowed the user to change this value at -** compile time. This is no longer permitted, on the grounds that it creates -** a library that is technically incompatible with an SQLite library -** compiled with a different limit. If a process operating on a database -** with a page-size of 65536 bytes crashes, then an instance of SQLite -** compiled with the default page-size limit will not be able to rollback -** the aborted transaction. This could lead to database corruption. -*/ -#ifdef SQLITE_MAX_PAGE_SIZE -# undef SQLITE_MAX_PAGE_SIZE -#endif -#define SQLITE_MAX_PAGE_SIZE 65536 - - -/* -** The default size of a database page. -*/ -#ifndef SQLITE_DEFAULT_PAGE_SIZE -# define SQLITE_DEFAULT_PAGE_SIZE 1024 -#endif -#if SQLITE_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE -# undef SQLITE_DEFAULT_PAGE_SIZE -# define SQLITE_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE -#endif - -/* -** Ordinarily, if no value is explicitly provided, SQLite creates databases -** with page size SQLITE_DEFAULT_PAGE_SIZE. However, based on certain -** device characteristics (sector-size and atomic write() support), -** SQLite may choose a larger value. This constant is the maximum value -** SQLite will choose on its own. -*/ -#ifndef SQLITE_MAX_DEFAULT_PAGE_SIZE -# define SQLITE_MAX_DEFAULT_PAGE_SIZE 8192 -#endif -#if SQLITE_MAX_DEFAULT_PAGE_SIZE>SQLITE_MAX_PAGE_SIZE -# undef SQLITE_MAX_DEFAULT_PAGE_SIZE -# define SQLITE_MAX_DEFAULT_PAGE_SIZE SQLITE_MAX_PAGE_SIZE -#endif - - -/* -** Maximum number of pages in one database file. -** -** This is really just the default value for the max_page_count pragma. -** This value can be lowered (or raised) at run-time using that the -** max_page_count macro. -*/ -#ifndef SQLITE_MAX_PAGE_COUNT -# define SQLITE_MAX_PAGE_COUNT 1073741823 -#endif - -/* -** Maximum length (in bytes) of the pattern in a LIKE or GLOB -** operator. -*/ -#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH -# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000 -#endif - -/* -** Maximum depth of recursion for triggers. -** -** A value of 1 means that a trigger program will not be able to itself -** fire any triggers. A value of 0 means that no trigger programs at all -** may be executed. -*/ -#ifndef SQLITE_MAX_TRIGGER_DEPTH -# define SQLITE_MAX_TRIGGER_DEPTH 1000 -#endif - -/************** End of sqliteLimit.h *****************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ - -/* Disable nuisance warnings on Borland compilers */ -#if defined(__BORLANDC__) -#pragma warn -rch /* unreachable code */ -#pragma warn -ccc /* Condition is always true or false */ -#pragma warn -aus /* Assigned value is never used */ -#pragma warn -csu /* Comparing signed and unsigned */ -#pragma warn -spa /* Suspicious pointer arithmetic */ -#endif - -/* Needed for various definitions... */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#if defined(__OpenBSD__) && !defined(_BSD_SOURCE) -# define _BSD_SOURCE -#endif - -/* -** Include standard header files as necessary -*/ -#ifdef HAVE_STDINT_H -#include -#endif -#ifdef HAVE_INTTYPES_H -#include -#endif - -/* -** The following macros are used to cast pointers to integers and -** integers to pointers. The way you do this varies from one compiler -** to the next, so we have developed the following set of #if statements -** to generate appropriate macros for a wide range of compilers. -** -** The correct "ANSI" way to do this is to use the intptr_t type. -** Unfortunately, that typedef is not available on all compilers, or -** if it is available, it requires an #include of specific headers -** that vary from one machine to the next. -** -** Ticket #3860: The llvm-gcc-4.2 compiler from Apple chokes on -** the ((void*)&((char*)0)[X]) construct. But MSVC chokes on ((void*)(X)). -** So we have to define the macros in different ways depending on the -** compiler. -*/ -#if defined(__PTRDIFF_TYPE__) /* This case should work for GCC */ -# define SQLITE_INT_TO_PTR(X) ((void*)(__PTRDIFF_TYPE__)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(__PTRDIFF_TYPE__)(X)) -#elif !defined(__GNUC__) /* Works for compilers other than LLVM */ -# define SQLITE_INT_TO_PTR(X) ((void*)&((char*)0)[X]) -# define SQLITE_PTR_TO_INT(X) ((int)(((char*)X)-(char*)0)) -#elif defined(HAVE_STDINT_H) /* Use this case if we have ANSI headers */ -# define SQLITE_INT_TO_PTR(X) ((void*)(intptr_t)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(intptr_t)(X)) -#else /* Generates a warning - but it always works */ -# define SQLITE_INT_TO_PTR(X) ((void*)(X)) -# define SQLITE_PTR_TO_INT(X) ((int)(X)) -#endif - -/* -** The SQLITE_THREADSAFE macro must be defined as 0, 1, or 2. -** 0 means mutexes are permanently disable and the library is never -** threadsafe. 1 means the library is serialized which is the highest -** level of threadsafety. 2 means the library is multithreaded - multiple -** threads can use SQLite as long as no two threads try to use the same -** database connection at the same time. -** -** Older versions of SQLite used an optional THREADSAFE macro. -** We support that for legacy. -*/ -#if !defined(SQLITE_THREADSAFE) -# if defined(THREADSAFE) -# define SQLITE_THREADSAFE THREADSAFE -# else -# define SQLITE_THREADSAFE 1 /* IMP: R-07272-22309 */ -# endif -#endif - -/* -** Powersafe overwrite is on by default. But can be turned off using -** the -DSQLITE_POWERSAFE_OVERWRITE=0 command-line option. -*/ -#ifndef SQLITE_POWERSAFE_OVERWRITE -# define SQLITE_POWERSAFE_OVERWRITE 1 -#endif - -/* -** The SQLITE_DEFAULT_MEMSTATUS macro must be defined as either 0 or 1. -** It determines whether or not the features related to -** SQLITE_CONFIG_MEMSTATUS are available by default or not. This value can -** be overridden at runtime using the sqlite3_config() API. -*/ -#if !defined(SQLITE_DEFAULT_MEMSTATUS) -# define SQLITE_DEFAULT_MEMSTATUS 1 -#endif - -/* -** Exactly one of the following macros must be defined in order to -** specify which memory allocation subsystem to use. -** -** SQLITE_SYSTEM_MALLOC // Use normal system malloc() -** SQLITE_WIN32_MALLOC // Use Win32 native heap API -** SQLITE_ZERO_MALLOC // Use a stub allocator that always fails -** SQLITE_MEMDEBUG // Debugging version of system malloc() -** -** On Windows, if the SQLITE_WIN32_MALLOC_VALIDATE macro is defined and the -** assert() macro is enabled, each call into the Win32 native heap subsystem -** will cause HeapValidate to be called. If heap validation should fail, an -** assertion will be triggered. -** -** If none of the above are defined, then set SQLITE_SYSTEM_MALLOC as -** the default. -*/ -#if defined(SQLITE_SYSTEM_MALLOC) \ - + defined(SQLITE_WIN32_MALLOC) \ - + defined(SQLITE_ZERO_MALLOC) \ - + defined(SQLITE_MEMDEBUG)>1 -# error "Two or more of the following compile-time configuration options\ - are defined but at most one is allowed:\ - SQLITE_SYSTEM_MALLOC, SQLITE_WIN32_MALLOC, SQLITE_MEMDEBUG,\ - SQLITE_ZERO_MALLOC" -#endif -#if defined(SQLITE_SYSTEM_MALLOC) \ - + defined(SQLITE_WIN32_MALLOC) \ - + defined(SQLITE_ZERO_MALLOC) \ - + defined(SQLITE_MEMDEBUG)==0 -# define SQLITE_SYSTEM_MALLOC 1 -#endif - -/* -** If SQLITE_MALLOC_SOFT_LIMIT is not zero, then try to keep the -** sizes of memory allocations below this value where possible. -*/ -#if !defined(SQLITE_MALLOC_SOFT_LIMIT) -# define SQLITE_MALLOC_SOFT_LIMIT 1024 -#endif - -/* -** We need to define _XOPEN_SOURCE as follows in order to enable -** recursive mutexes on most Unix systems and fchmod() on OpenBSD. -** But _XOPEN_SOURCE define causes problems for Mac OS X, so omit -** it. -*/ -#if !defined(_XOPEN_SOURCE) && !defined(__DARWIN__) && !defined(__APPLE__) -# define _XOPEN_SOURCE 600 -#endif - -/* -** NDEBUG and SQLITE_DEBUG are opposites. It should always be true that -** defined(NDEBUG)==!defined(SQLITE_DEBUG). If this is not currently true, -** make it true by defining or undefining NDEBUG. -** -** Setting NDEBUG makes the code smaller and faster by disabling the -** assert() statements in the code. So we want the default action -** to be for NDEBUG to be set and NDEBUG to be undefined only if SQLITE_DEBUG -** is set. Thus NDEBUG becomes an opt-in rather than an opt-out -** feature. -*/ -#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) -# define NDEBUG 1 -#endif -#if defined(NDEBUG) && defined(SQLITE_DEBUG) -# undef NDEBUG -#endif - -/* -** Enable SQLITE_ENABLE_EXPLAIN_COMMENTS if SQLITE_DEBUG is turned on. -*/ -#if !defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) && defined(SQLITE_DEBUG) -# define SQLITE_ENABLE_EXPLAIN_COMMENTS 1 -#endif - -/* -** The testcase() macro is used to aid in coverage testing. When -** doing coverage testing, the condition inside the argument to -** testcase() must be evaluated both true and false in order to -** get full branch coverage. The testcase() macro is inserted -** to help ensure adequate test coverage in places where simple -** condition/decision coverage is inadequate. For example, testcase() -** can be used to make sure boundary values are tested. For -** bitmask tests, testcase() can be used to make sure each bit -** is significant and used at least once. On switch statements -** where multiple cases go to the same block of code, testcase() -** can insure that all cases are evaluated. -** -*/ -#ifdef SQLITE_COVERAGE_TEST -SQLITE_PRIVATE void sqlite3Coverage(int); -# define testcase(X) if( X ){ sqlite3Coverage(__LINE__); } -#else -# define testcase(X) -#endif - -/* -** The TESTONLY macro is used to enclose variable declarations or -** other bits of code that are needed to support the arguments -** within testcase() and assert() macros. -*/ -#if !defined(NDEBUG) || defined(SQLITE_COVERAGE_TEST) -# define TESTONLY(X) X -#else -# define TESTONLY(X) -#endif - -/* -** Sometimes we need a small amount of code such as a variable initialization -** to setup for a later assert() statement. We do not want this code to -** appear when assert() is disabled. The following macro is therefore -** used to contain that setup code. The "VVA" acronym stands for -** "Verification, Validation, and Accreditation". In other words, the -** code within VVA_ONLY() will only run during verification processes. -*/ -#ifndef NDEBUG -# define VVA_ONLY(X) X -#else -# define VVA_ONLY(X) -#endif - -/* -** The ALWAYS and NEVER macros surround boolean expressions which -** are intended to always be true or false, respectively. Such -** expressions could be omitted from the code completely. But they -** are included in a few cases in order to enhance the resilience -** of SQLite to unexpected behavior - to make the code "self-healing" -** or "ductile" rather than being "brittle" and crashing at the first -** hint of unplanned behavior. -** -** In other words, ALWAYS and NEVER are added for defensive code. -** -** When doing coverage testing ALWAYS and NEVER are hard-coded to -** be true and false so that the unreachable code they specify will -** not be counted as untested code. -*/ -#if defined(SQLITE_COVERAGE_TEST) -# define ALWAYS(X) (1) -# define NEVER(X) (0) -#elif !defined(NDEBUG) -# define ALWAYS(X) ((X)?1:(assert(0),0)) -# define NEVER(X) ((X)?(assert(0),1):0) -#else -# define ALWAYS(X) (X) -# define NEVER(X) (X) -#endif - -/* -** Return true (non-zero) if the input is a integer that is too large -** to fit in 32-bits. This macro is used inside of various testcase() -** macros to verify that we have tested SQLite for large-file support. -*/ -#define IS_BIG_INT(X) (((X)&~(i64)0xffffffff)!=0) - -/* -** The macro unlikely() is a hint that surrounds a boolean -** expression that is usually false. Macro likely() surrounds -** a boolean expression that is usually true. These hints could, -** in theory, be used by the compiler to generate better code, but -** currently they are just comments for human readers. -*/ -#define likely(X) (X) -#define unlikely(X) (X) - -/************** Include hash.h in the middle of sqliteInt.h ******************/ -/************** Begin file hash.h ********************************************/ -/* -** 2001 September 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This is the header file for the generic hash-table implementation -** used in SQLite. -*/ -#ifndef _SQLITE_HASH_H_ -#define _SQLITE_HASH_H_ - -/* Forward declarations of structures. */ -typedef struct Hash Hash; -typedef struct HashElem HashElem; - -/* A complete hash table is an instance of the following structure. -** The internals of this structure are intended to be opaque -- client -** code should not attempt to access or modify the fields of this structure -** directly. Change this structure only by using the routines below. -** However, some of the "procedures" and "functions" for modifying and -** accessing this structure are really macros, so we can't really make -** this structure opaque. -** -** All elements of the hash table are on a single doubly-linked list. -** Hash.first points to the head of this list. -** -** There are Hash.htsize buckets. Each bucket points to a spot in -** the global doubly-linked list. The contents of the bucket are the -** element pointed to plus the next _ht.count-1 elements in the list. -** -** Hash.htsize and Hash.ht may be zero. In that case lookup is done -** by a linear search of the global list. For small tables, the -** Hash.ht table is never allocated because if there are few elements -** in the table, it is faster to do a linear search than to manage -** the hash table. -*/ -struct Hash { - unsigned int htsize; /* Number of buckets in the hash table */ - unsigned int count; /* Number of entries in this table */ - HashElem *first; /* The first element of the array */ - struct _ht { /* the hash table */ - int count; /* Number of entries with this hash */ - HashElem *chain; /* Pointer to first entry with this hash */ - } *ht; -}; - -/* Each element in the hash table is an instance of the following -** structure. All elements are stored on a single doubly-linked list. -** -** Again, this structure is intended to be opaque, but it can't really -** be opaque because it is used by macros. -*/ -struct HashElem { - HashElem *next, *prev; /* Next and previous elements in the table */ - void *data; /* Data associated with this element */ - const char *pKey; int nKey; /* Key associated with this element */ -}; - -/* -** Access routines. To delete, insert a NULL pointer. -*/ -SQLITE_PRIVATE void sqlite3HashInit(Hash*); -SQLITE_PRIVATE void *sqlite3HashInsert(Hash*, const char *pKey, int nKey, void *pData); -SQLITE_PRIVATE void *sqlite3HashFind(const Hash*, const char *pKey, int nKey); -SQLITE_PRIVATE void sqlite3HashClear(Hash*); - -/* -** Macros for looping over all elements of a hash table. The idiom is -** like this: -** -** Hash h; -** HashElem *p; -** ... -** for(p=sqliteHashFirst(&h); p; p=sqliteHashNext(p)){ -** SomeStructure *pData = sqliteHashData(p); -** // do something with pData -** } -*/ -#define sqliteHashFirst(H) ((H)->first) -#define sqliteHashNext(E) ((E)->next) -#define sqliteHashData(E) ((E)->data) -/* #define sqliteHashKey(E) ((E)->pKey) // NOT USED */ -/* #define sqliteHashKeysize(E) ((E)->nKey) // NOT USED */ - -/* -** Number of entries in a hash table -*/ -/* #define sqliteHashCount(H) ((H)->count) // NOT USED */ - -#endif /* _SQLITE_HASH_H_ */ - -/************** End of hash.h ************************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ -/************** Include parse.h in the middle of sqliteInt.h *****************/ -/************** Begin file parse.h *******************************************/ -#define TK_SEMI 1 -#define TK_EXPLAIN 2 -#define TK_QUERY 3 -#define TK_PLAN 4 -#define TK_BEGIN 5 -#define TK_TRANSACTION 6 -#define TK_DEFERRED 7 -#define TK_IMMEDIATE 8 -#define TK_EXCLUSIVE 9 -#define TK_COMMIT 10 -#define TK_END 11 -#define TK_ROLLBACK 12 -#define TK_SAVEPOINT 13 -#define TK_RELEASE 14 -#define TK_TO 15 -#define TK_TABLE 16 -#define TK_CREATE 17 -#define TK_IF 18 -#define TK_NOT 19 -#define TK_EXISTS 20 -#define TK_TEMP 21 -#define TK_LP 22 -#define TK_RP 23 -#define TK_AS 24 -#define TK_WITHOUT 25 -#define TK_COMMA 26 -#define TK_ID 27 -#define TK_INDEXED 28 -#define TK_ABORT 29 -#define TK_ACTION 30 -#define TK_AFTER 31 -#define TK_ANALYZE 32 -#define TK_ASC 33 -#define TK_ATTACH 34 -#define TK_BEFORE 35 -#define TK_BY 36 -#define TK_CASCADE 37 -#define TK_CAST 38 -#define TK_COLUMNKW 39 -#define TK_CONFLICT 40 -#define TK_DATABASE 41 -#define TK_DESC 42 -#define TK_DETACH 43 -#define TK_EACH 44 -#define TK_FAIL 45 -#define TK_FOR 46 -#define TK_IGNORE 47 -#define TK_INITIALLY 48 -#define TK_INSTEAD 49 -#define TK_LIKE_KW 50 -#define TK_MATCH 51 -#define TK_NO 52 -#define TK_KEY 53 -#define TK_OF 54 -#define TK_OFFSET 55 -#define TK_PRAGMA 56 -#define TK_RAISE 57 -#define TK_RECURSIVE 58 -#define TK_REPLACE 59 -#define TK_RESTRICT 60 -#define TK_ROW 61 -#define TK_TRIGGER 62 -#define TK_VACUUM 63 -#define TK_VIEW 64 -#define TK_VIRTUAL 65 -#define TK_WITH 66 -#define TK_REINDEX 67 -#define TK_RENAME 68 -#define TK_CTIME_KW 69 -#define TK_ANY 70 -#define TK_OR 71 -#define TK_AND 72 -#define TK_IS 73 -#define TK_BETWEEN 74 -#define TK_IN 75 -#define TK_ISNULL 76 -#define TK_NOTNULL 77 -#define TK_NE 78 -#define TK_EQ 79 -#define TK_GT 80 -#define TK_LE 81 -#define TK_LT 82 -#define TK_GE 83 -#define TK_ESCAPE 84 -#define TK_BITAND 85 -#define TK_BITOR 86 -#define TK_LSHIFT 87 -#define TK_RSHIFT 88 -#define TK_PLUS 89 -#define TK_MINUS 90 -#define TK_STAR 91 -#define TK_SLASH 92 -#define TK_REM 93 -#define TK_CONCAT 94 -#define TK_COLLATE 95 -#define TK_BITNOT 96 -#define TK_STRING 97 -#define TK_JOIN_KW 98 -#define TK_CONSTRAINT 99 -#define TK_DEFAULT 100 -#define TK_NULL 101 -#define TK_PRIMARY 102 -#define TK_UNIQUE 103 -#define TK_CHECK 104 -#define TK_REFERENCES 105 -#define TK_AUTOINCR 106 -#define TK_ON 107 -#define TK_INSERT 108 -#define TK_DELETE 109 -#define TK_UPDATE 110 -#define TK_SET 111 -#define TK_DEFERRABLE 112 -#define TK_FOREIGN 113 -#define TK_DROP 114 -#define TK_UNION 115 -#define TK_ALL 116 -#define TK_EXCEPT 117 -#define TK_INTERSECT 118 -#define TK_SELECT 119 -#define TK_VALUES 120 -#define TK_DISTINCT 121 -#define TK_DOT 122 -#define TK_FROM 123 -#define TK_JOIN 124 -#define TK_USING 125 -#define TK_ORDER 126 -#define TK_GROUP 127 -#define TK_HAVING 128 -#define TK_LIMIT 129 -#define TK_WHERE 130 -#define TK_INTO 131 -#define TK_INTEGER 132 -#define TK_FLOAT 133 -#define TK_BLOB 134 -#define TK_VARIABLE 135 -#define TK_CASE 136 -#define TK_WHEN 137 -#define TK_THEN 138 -#define TK_ELSE 139 -#define TK_INDEX 140 -#define TK_ALTER 141 -#define TK_ADD 142 -#define TK_TO_TEXT 143 -#define TK_TO_BLOB 144 -#define TK_TO_NUMERIC 145 -#define TK_TO_INT 146 -#define TK_TO_REAL 147 -#define TK_ISNOT 148 -#define TK_END_OF_FILE 149 -#define TK_ILLEGAL 150 -#define TK_SPACE 151 -#define TK_UNCLOSED_STRING 152 -#define TK_FUNCTION 153 -#define TK_COLUMN 154 -#define TK_AGG_FUNCTION 155 -#define TK_AGG_COLUMN 156 -#define TK_UMINUS 157 -#define TK_UPLUS 158 -#define TK_REGISTER 159 - -/************** End of parse.h ***********************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ -#include -#include -#include -#include -#include - -/* -** If compiling for a processor that lacks floating point support, -** substitute integer for floating-point -*/ -#ifdef SQLITE_OMIT_FLOATING_POINT -# define double sqlite_int64 -# define float sqlite_int64 -# define LONGDOUBLE_TYPE sqlite_int64 -# ifndef SQLITE_BIG_DBL -# define SQLITE_BIG_DBL (((sqlite3_int64)1)<<50) -# endif -# define SQLITE_OMIT_DATETIME_FUNCS 1 -# define SQLITE_OMIT_TRACE 1 -# undef SQLITE_MIXED_ENDIAN_64BIT_FLOAT -# undef SQLITE_HAVE_ISNAN -#endif -#ifndef SQLITE_BIG_DBL -# define SQLITE_BIG_DBL (1e99) -#endif - -/* -** OMIT_TEMPDB is set to 1 if SQLITE_OMIT_TEMPDB is defined, or 0 -** afterward. Having this macro allows us to cause the C compiler -** to omit code used by TEMP tables without messy #ifndef statements. -*/ -#ifdef SQLITE_OMIT_TEMPDB -#define OMIT_TEMPDB 1 -#else -#define OMIT_TEMPDB 0 -#endif - -/* -** The "file format" number is an integer that is incremented whenever -** the VDBE-level file format changes. The following macros define the -** the default file format for new databases and the maximum file format -** that the library can read. -*/ -#define SQLITE_MAX_FILE_FORMAT 4 -#ifndef SQLITE_DEFAULT_FILE_FORMAT -# define SQLITE_DEFAULT_FILE_FORMAT 4 -#endif - -/* -** Determine whether triggers are recursive by default. This can be -** changed at run-time using a pragma. -*/ -#ifndef SQLITE_DEFAULT_RECURSIVE_TRIGGERS -# define SQLITE_DEFAULT_RECURSIVE_TRIGGERS 0 -#endif - -/* -** Provide a default value for SQLITE_TEMP_STORE in case it is not specified -** on the command-line -*/ -#ifndef SQLITE_TEMP_STORE -# define SQLITE_TEMP_STORE 1 -# define SQLITE_TEMP_STORE_xc 1 /* Exclude from ctime.c */ -#endif - -/* -** GCC does not define the offsetof() macro so we'll have to do it -** ourselves. -*/ -#ifndef offsetof -#define offsetof(STRUCTURE,FIELD) ((int)((char*)&((STRUCTURE*)0)->FIELD)) -#endif - -/* -** Macros to compute minimum and maximum of two numbers. -*/ -#define MIN(A,B) ((A)<(B)?(A):(B)) -#define MAX(A,B) ((A)>(B)?(A):(B)) - -/* -** Check to see if this machine uses EBCDIC. (Yes, believe it or -** not, there are still machines out there that use EBCDIC.) -*/ -#if 'A' == '\301' -# define SQLITE_EBCDIC 1 -#else -# define SQLITE_ASCII 1 -#endif - -/* -** Integers of known sizes. These typedefs might change for architectures -** where the sizes very. Preprocessor macros are available so that the -** types can be conveniently redefined at compile-type. Like this: -** -** cc '-DUINTPTR_TYPE=long long int' ... -*/ -#ifndef UINT32_TYPE -# ifdef HAVE_UINT32_T -# define UINT32_TYPE uint32_t -# else -# define UINT32_TYPE unsigned int -# endif -#endif -#ifndef UINT16_TYPE -# ifdef HAVE_UINT16_T -# define UINT16_TYPE uint16_t -# else -# define UINT16_TYPE unsigned short int -# endif -#endif -#ifndef INT16_TYPE -# ifdef HAVE_INT16_T -# define INT16_TYPE int16_t -# else -# define INT16_TYPE short int -# endif -#endif -#ifndef UINT8_TYPE -# ifdef HAVE_UINT8_T -# define UINT8_TYPE uint8_t -# else -# define UINT8_TYPE unsigned char -# endif -#endif -#ifndef INT8_TYPE -# ifdef HAVE_INT8_T -# define INT8_TYPE int8_t -# else -# define INT8_TYPE signed char -# endif -#endif -#ifndef LONGDOUBLE_TYPE -# define LONGDOUBLE_TYPE long double -#endif -typedef sqlite_int64 i64; /* 8-byte signed integer */ -typedef sqlite_uint64 u64; /* 8-byte unsigned integer */ -typedef UINT32_TYPE u32; /* 4-byte unsigned integer */ -typedef UINT16_TYPE u16; /* 2-byte unsigned integer */ -typedef INT16_TYPE i16; /* 2-byte signed integer */ -typedef UINT8_TYPE u8; /* 1-byte unsigned integer */ -typedef INT8_TYPE i8; /* 1-byte signed integer */ - -/* -** SQLITE_MAX_U32 is a u64 constant that is the maximum u64 value -** that can be stored in a u32 without loss of data. The value -** is 0x00000000ffffffff. But because of quirks of some compilers, we -** have to specify the value in the less intuitive manner shown: -*/ -#define SQLITE_MAX_U32 ((((u64)1)<<32)-1) - -/* -** The datatype used to store estimates of the number of rows in a -** table or index. This is an unsigned integer type. For 99.9% of -** the world, a 32-bit integer is sufficient. But a 64-bit integer -** can be used at compile-time if desired. -*/ -#ifdef SQLITE_64BIT_STATS - typedef u64 tRowcnt; /* 64-bit only if requested at compile-time */ -#else - typedef u32 tRowcnt; /* 32-bit is the default */ -#endif - -/* -** Estimated quantities used for query planning are stored as 16-bit -** logarithms. For quantity X, the value stored is 10*log2(X). This -** gives a possible range of values of approximately 1.0e986 to 1e-986. -** But the allowed values are "grainy". Not every value is representable. -** For example, quantities 16 and 17 are both represented by a LogEst -** of 40. However, since LogEst quantatites are suppose to be estimates, -** not exact values, this imprecision is not a problem. -** -** "LogEst" is short for "Logarithimic Estimate". -** -** Examples: -** 1 -> 0 20 -> 43 10000 -> 132 -** 2 -> 10 25 -> 46 25000 -> 146 -** 3 -> 16 100 -> 66 1000000 -> 199 -** 4 -> 20 1000 -> 99 1048576 -> 200 -** 10 -> 33 1024 -> 100 4294967296 -> 320 -** -** The LogEst can be negative to indicate fractional values. -** Examples: -** -** 0.5 -> -10 0.1 -> -33 0.0625 -> -40 -*/ -typedef INT16_TYPE LogEst; - -/* -** Macros to determine whether the machine is big or little endian, -** evaluated at runtime. -*/ -#ifdef SQLITE_AMALGAMATION -SQLITE_PRIVATE const int sqlite3one = 1; -#else -SQLITE_PRIVATE const int sqlite3one; -#endif -#if defined(i386) || defined(__i386__) || defined(_M_IX86)\ - || defined(__x86_64) || defined(__x86_64__) -# define SQLITE_BIGENDIAN 0 -# define SQLITE_LITTLEENDIAN 1 -# define SQLITE_UTF16NATIVE SQLITE_UTF16LE -#else -# define SQLITE_BIGENDIAN (*(char *)(&sqlite3one)==0) -# define SQLITE_LITTLEENDIAN (*(char *)(&sqlite3one)==1) -# define SQLITE_UTF16NATIVE (SQLITE_BIGENDIAN?SQLITE_UTF16BE:SQLITE_UTF16LE) -#endif - -/* -** Constants for the largest and smallest possible 64-bit signed integers. -** These macros are designed to work correctly on both 32-bit and 64-bit -** compilers. -*/ -#define LARGEST_INT64 (0xffffffff|(((i64)0x7fffffff)<<32)) -#define SMALLEST_INT64 (((i64)-1) - LARGEST_INT64) - -/* -** Round up a number to the next larger multiple of 8. This is used -** to force 8-byte alignment on 64-bit architectures. -*/ -#define ROUND8(x) (((x)+7)&~7) - -/* -** Round down to the nearest multiple of 8 -*/ -#define ROUNDDOWN8(x) ((x)&~7) - -/* -** Assert that the pointer X is aligned to an 8-byte boundary. This -** macro is used only within assert() to verify that the code gets -** all alignment restrictions correct. -** -** Except, if SQLITE_4_BYTE_ALIGNED_MALLOC is defined, then the -** underlying malloc() implemention might return us 4-byte aligned -** pointers. In that case, only verify 4-byte alignment. -*/ -#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC -# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&3)==0) -#else -# define EIGHT_BYTE_ALIGNMENT(X) ((((char*)(X) - (char*)0)&7)==0) -#endif - -/* -** Disable MMAP on platforms where it is known to not work -*/ -#if defined(__OpenBSD__) || defined(__QNXNTO__) -# undef SQLITE_MAX_MMAP_SIZE -# define SQLITE_MAX_MMAP_SIZE 0 -#endif - -/* -** Default maximum size of memory used by memory-mapped I/O in the VFS -*/ -#ifdef __APPLE__ -# include -# if TARGET_OS_IPHONE -# undef SQLITE_MAX_MMAP_SIZE -# define SQLITE_MAX_MMAP_SIZE 0 -# endif -#endif -#ifndef SQLITE_MAX_MMAP_SIZE -# if defined(__linux__) \ - || defined(_WIN32) \ - || (defined(__APPLE__) && defined(__MACH__)) \ - || defined(__sun) -# define SQLITE_MAX_MMAP_SIZE 0x7fff0000 /* 2147418112 */ -# else -# define SQLITE_MAX_MMAP_SIZE 0 -# endif -# define SQLITE_MAX_MMAP_SIZE_xc 1 /* exclude from ctime.c */ -#endif - -/* -** The default MMAP_SIZE is zero on all platforms. Or, even if a larger -** default MMAP_SIZE is specified at compile-time, make sure that it does -** not exceed the maximum mmap size. -*/ -#ifndef SQLITE_DEFAULT_MMAP_SIZE -# define SQLITE_DEFAULT_MMAP_SIZE 0 -# define SQLITE_DEFAULT_MMAP_SIZE_xc 1 /* Exclude from ctime.c */ -#endif -#if SQLITE_DEFAULT_MMAP_SIZE>SQLITE_MAX_MMAP_SIZE -# undef SQLITE_DEFAULT_MMAP_SIZE -# define SQLITE_DEFAULT_MMAP_SIZE SQLITE_MAX_MMAP_SIZE -#endif - -/* -** Only one of SQLITE_ENABLE_STAT3 or SQLITE_ENABLE_STAT4 can be defined. -** Priority is given to SQLITE_ENABLE_STAT4. If either are defined, also -** define SQLITE_ENABLE_STAT3_OR_STAT4 -*/ -#ifdef SQLITE_ENABLE_STAT4 -# undef SQLITE_ENABLE_STAT3 -# define SQLITE_ENABLE_STAT3_OR_STAT4 1 -#elif SQLITE_ENABLE_STAT3 -# define SQLITE_ENABLE_STAT3_OR_STAT4 1 -#elif SQLITE_ENABLE_STAT3_OR_STAT4 -# undef SQLITE_ENABLE_STAT3_OR_STAT4 -#endif - -/* -** An instance of the following structure is used to store the busy-handler -** callback for a given sqlite handle. -** -** The sqlite.busyHandler member of the sqlite struct contains the busy -** callback for the database handle. Each pager opened via the sqlite -** handle is passed a pointer to sqlite.busyHandler. The busy-handler -** callback is currently invoked only from within pager.c. -*/ -typedef struct BusyHandler BusyHandler; -struct BusyHandler { - int (*xFunc)(void *,int); /* The busy callback */ - void *pArg; /* First arg to busy callback */ - int nBusy; /* Incremented with each busy call */ -}; - -/* -** Name of the master database table. The master database table -** is a special table that holds the names and attributes of all -** user tables and indices. -*/ -#define MASTER_NAME "sqlite_master" -#define TEMP_MASTER_NAME "sqlite_temp_master" - -/* -** The root-page of the master database table. -*/ -#define MASTER_ROOT 1 - -/* -** The name of the schema table. -*/ -#define SCHEMA_TABLE(x) ((!OMIT_TEMPDB)&&(x==1)?TEMP_MASTER_NAME:MASTER_NAME) - -/* -** A convenience macro that returns the number of elements in -** an array. -*/ -#define ArraySize(X) ((int)(sizeof(X)/sizeof(X[0]))) - -/* -** Determine if the argument is a power of two -*/ -#define IsPowerOfTwo(X) (((X)&((X)-1))==0) - -/* -** The following value as a destructor means to use sqlite3DbFree(). -** The sqlite3DbFree() routine requires two parameters instead of the -** one parameter that destructors normally want. So we have to introduce -** this magic value that the code knows to handle differently. Any -** pointer will work here as long as it is distinct from SQLITE_STATIC -** and SQLITE_TRANSIENT. -*/ -#define SQLITE_DYNAMIC ((sqlite3_destructor_type)sqlite3MallocSize) - -/* -** When SQLITE_OMIT_WSD is defined, it means that the target platform does -** not support Writable Static Data (WSD) such as global and static variables. -** All variables must either be on the stack or dynamically allocated from -** the heap. When WSD is unsupported, the variable declarations scattered -** throughout the SQLite code must become constants instead. The SQLITE_WSD -** macro is used for this purpose. And instead of referencing the variable -** directly, we use its constant as a key to lookup the run-time allocated -** buffer that holds real variable. The constant is also the initializer -** for the run-time allocated buffer. -** -** In the usual case where WSD is supported, the SQLITE_WSD and GLOBAL -** macros become no-ops and have zero performance impact. -*/ -#ifdef SQLITE_OMIT_WSD - #define SQLITE_WSD const - #define GLOBAL(t,v) (*(t*)sqlite3_wsd_find((void*)&(v), sizeof(v))) - #define sqlite3GlobalConfig GLOBAL(struct Sqlite3Config, sqlite3Config) -SQLITE_API int sqlite3_wsd_init(int N, int J); -SQLITE_API void *sqlite3_wsd_find(void *K, int L); -#else - #define SQLITE_WSD - #define GLOBAL(t,v) v - #define sqlite3GlobalConfig sqlite3Config -#endif - -/* -** The following macros are used to suppress compiler warnings and to -** make it clear to human readers when a function parameter is deliberately -** left unused within the body of a function. This usually happens when -** a function is called via a function pointer. For example the -** implementation of an SQL aggregate step callback may not use the -** parameter indicating the number of arguments passed to the aggregate, -** if it knows that this is enforced elsewhere. -** -** When a function parameter is not used at all within the body of a function, -** it is generally named "NotUsed" or "NotUsed2" to make things even clearer. -** However, these macros may also be used to suppress warnings related to -** parameters that may or may not be used depending on compilation options. -** For example those parameters only used in assert() statements. In these -** cases the parameters are named as per the usual conventions. -*/ -#define UNUSED_PARAMETER(x) (void)(x) -#define UNUSED_PARAMETER2(x,y) UNUSED_PARAMETER(x),UNUSED_PARAMETER(y) - -/* -** Forward references to structures -*/ -typedef struct AggInfo AggInfo; -typedef struct AuthContext AuthContext; -typedef struct AutoincInfo AutoincInfo; -typedef struct Bitvec Bitvec; -typedef struct CollSeq CollSeq; -typedef struct Column Column; -typedef struct Db Db; -typedef struct Schema Schema; -typedef struct Expr Expr; -typedef struct ExprList ExprList; -typedef struct ExprSpan ExprSpan; -typedef struct FKey FKey; -typedef struct FuncDestructor FuncDestructor; -typedef struct FuncDef FuncDef; -typedef struct FuncDefHash FuncDefHash; -typedef struct IdList IdList; -typedef struct Index Index; -typedef struct IndexSample IndexSample; -typedef struct KeyClass KeyClass; -typedef struct KeyInfo KeyInfo; -typedef struct Lookaside Lookaside; -typedef struct LookasideSlot LookasideSlot; -typedef struct Module Module; -typedef struct NameContext NameContext; -typedef struct Parse Parse; -typedef struct PrintfArguments PrintfArguments; -typedef struct RowSet RowSet; -typedef struct Savepoint Savepoint; -typedef struct Select Select; -typedef struct SelectDest SelectDest; -typedef struct SrcList SrcList; -typedef struct StrAccum StrAccum; -typedef struct Table Table; -typedef struct TableLock TableLock; -typedef struct Token Token; -typedef struct Trigger Trigger; -typedef struct TriggerPrg TriggerPrg; -typedef struct TriggerStep TriggerStep; -typedef struct UnpackedRecord UnpackedRecord; -typedef struct VTable VTable; -typedef struct VtabCtx VtabCtx; -typedef struct Walker Walker; -typedef struct WhereInfo WhereInfo; -typedef struct With With; - -/* -** Defer sourcing vdbe.h and btree.h until after the "u8" and -** "BusyHandler" typedefs. vdbe.h also requires a few of the opaque -** pointer types (i.e. FuncDef) defined above. -*/ -/************** Include btree.h in the middle of sqliteInt.h *****************/ -/************** Begin file btree.h *******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the interface that the sqlite B-Tree file -** subsystem. See comments in the source code for a detailed description -** of what each interface routine does. -*/ -#ifndef _BTREE_H_ -#define _BTREE_H_ - -/* TODO: This definition is just included so other modules compile. It -** needs to be revisited. -*/ -#define SQLITE_N_BTREE_META 10 - -/* -** If defined as non-zero, auto-vacuum is enabled by default. Otherwise -** it must be turned on for each database using "PRAGMA auto_vacuum = 1". -*/ -#ifndef SQLITE_DEFAULT_AUTOVACUUM - #define SQLITE_DEFAULT_AUTOVACUUM 0 -#endif - -#define BTREE_AUTOVACUUM_NONE 0 /* Do not do auto-vacuum */ -#define BTREE_AUTOVACUUM_FULL 1 /* Do full auto-vacuum */ -#define BTREE_AUTOVACUUM_INCR 2 /* Incremental vacuum */ - -/* -** Forward declarations of structure -*/ -typedef struct Btree Btree; -typedef struct BtCursor BtCursor; -typedef struct BtShared BtShared; - - -SQLITE_PRIVATE int sqlite3BtreeOpen( - sqlite3_vfs *pVfs, /* VFS to use with this b-tree */ - const char *zFilename, /* Name of database file to open */ - sqlite3 *db, /* Associated database connection */ - Btree **ppBtree, /* Return open Btree* here */ - int flags, /* Flags */ - int vfsFlags /* Flags passed through to VFS open */ -); - -/* The flags parameter to sqlite3BtreeOpen can be the bitwise or of the -** following values. -** -** NOTE: These values must match the corresponding PAGER_ values in -** pager.h. -*/ -#define BTREE_OMIT_JOURNAL 1 /* Do not create or use a rollback journal */ -#define BTREE_MEMORY 2 /* This is an in-memory DB */ -#define BTREE_SINGLE 4 /* The file contains at most 1 b-tree */ -#define BTREE_UNORDERED 8 /* Use of a hash implementation is OK */ - -SQLITE_PRIVATE int sqlite3BtreeClose(Btree*); -SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree*,int); -SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree*,sqlite3_int64); -SQLITE_PRIVATE int sqlite3BtreeSetPagerFlags(Btree*,unsigned); -SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree*); -SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int nPagesize, int nReserve, int eFix); -SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree*); -SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree*,int); -SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree*); -SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree*,int); -SQLITE_PRIVATE int sqlite3BtreeGetReserve(Btree*); -#if defined(SQLITE_HAS_CODEC) || defined(SQLITE_DEBUG) -SQLITE_PRIVATE int sqlite3BtreeGetReserveNoMutex(Btree *p); -#endif -SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *, int); -SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *); -SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree*,int); -SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree*, const char *zMaster); -SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree*, int); -SQLITE_PRIVATE int sqlite3BtreeCommit(Btree*); -SQLITE_PRIVATE int sqlite3BtreeRollback(Btree*,int); -SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree*,int); -SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree*, int*, int flags); -SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree*); -SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree*); -SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree*); -SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *, int, void(*)(void *)); -SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *pBtree); -SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *pBtree, int iTab, u8 isWriteLock); -SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *, int, int); - -SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *); -SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *); -SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *, Btree *); - -SQLITE_PRIVATE int sqlite3BtreeIncrVacuum(Btree *); - -/* The flags parameter to sqlite3BtreeCreateTable can be the bitwise OR -** of the flags shown below. -** -** Every SQLite table must have either BTREE_INTKEY or BTREE_BLOBKEY set. -** With BTREE_INTKEY, the table key is a 64-bit integer and arbitrary data -** is stored in the leaves. (BTREE_INTKEY is used for SQL tables.) With -** BTREE_BLOBKEY, the key is an arbitrary BLOB and no content is stored -** anywhere - the key is the content. (BTREE_BLOBKEY is used for SQL -** indices.) -*/ -#define BTREE_INTKEY 1 /* Table has only 64-bit signed integer keys */ -#define BTREE_BLOBKEY 2 /* Table has keys only - no data */ - -SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree*, int, int*); -SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree*, int, int*); -SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree*, int); - -SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *pBtree, int idx, u32 *pValue); -SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree*, int idx, u32 value); - -SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p); - -/* -** The second parameter to sqlite3BtreeGetMeta or sqlite3BtreeUpdateMeta -** should be one of the following values. The integer values are assigned -** to constants so that the offset of the corresponding field in an -** SQLite database header may be found using the following formula: -** -** offset = 36 + (idx * 4) -** -** For example, the free-page-count field is located at byte offset 36 of -** the database file header. The incr-vacuum-flag field is located at -** byte offset 64 (== 36+4*7). -*/ -#define BTREE_FREE_PAGE_COUNT 0 -#define BTREE_SCHEMA_VERSION 1 -#define BTREE_FILE_FORMAT 2 -#define BTREE_DEFAULT_CACHE_SIZE 3 -#define BTREE_LARGEST_ROOT_PAGE 4 -#define BTREE_TEXT_ENCODING 5 -#define BTREE_USER_VERSION 6 -#define BTREE_INCR_VACUUM 7 -#define BTREE_APPLICATION_ID 8 - -/* -** Values that may be OR'd together to form the second argument of an -** sqlite3BtreeCursorHints() call. -*/ -#define BTREE_BULKLOAD 0x00000001 - -SQLITE_PRIVATE int sqlite3BtreeCursor( - Btree*, /* BTree containing table to open */ - int iTable, /* Index of root page */ - int wrFlag, /* 1 for writing. 0 for read-only */ - struct KeyInfo*, /* First argument to compare function */ - BtCursor *pCursor /* Space to write cursor structure */ -); -SQLITE_PRIVATE int sqlite3BtreeCursorSize(void); -SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor*); - -SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( - BtCursor*, - UnpackedRecord *pUnKey, - i64 intKey, - int bias, - int *pRes -); -SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor*, int*); -SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreeInsert(BtCursor*, const void *pKey, i64 nKey, - const void *pData, int nData, - int nZero, int bias, int seekResult); -SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor*, int *pRes); -SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor*, int *pRes); -SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor*, int *pRes); -SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor*); -SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor*, int *pRes); -SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor*, i64 *pSize); -SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor*, u32 offset, u32 amt, void*); -SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor*, u32 *pAmt); -SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor*, u32 *pAmt); -SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor*, u32 *pSize); -SQLITE_PRIVATE int sqlite3BtreeData(BtCursor*, u32 offset, u32 amt, void*); -SQLITE_PRIVATE void sqlite3BtreeSetCachedRowid(BtCursor*, sqlite3_int64); -SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeGetCachedRowid(BtCursor*); - -SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck(Btree*, int *aRoot, int nRoot, int, int*); -SQLITE_PRIVATE struct Pager *sqlite3BtreePager(Btree*); - -SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor*, u32 offset, u32 amt, void*); -SQLITE_PRIVATE void sqlite3BtreeCacheOverflow(BtCursor *); -SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *); -SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBt, int iVersion); -SQLITE_PRIVATE void sqlite3BtreeCursorHints(BtCursor *, unsigned int mask); - -#ifndef NDEBUG -SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor*); -#endif - -#ifndef SQLITE_OMIT_BTREECOUNT -SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *, i64 *); -#endif - -#ifdef SQLITE_TEST -SQLITE_PRIVATE int sqlite3BtreeCursorInfo(BtCursor*, int*, int); -SQLITE_PRIVATE void sqlite3BtreeCursorList(Btree*); -#endif - -#ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree*, int, int *, int *); -#endif - -/* -** If we are not using shared cache, then there is no need to -** use mutexes to access the BtShared structures. So make the -** Enter and Leave procedures no-ops. -*/ -#ifndef SQLITE_OMIT_SHARED_CACHE -SQLITE_PRIVATE void sqlite3BtreeEnter(Btree*); -SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3*); -#else -# define sqlite3BtreeEnter(X) -# define sqlite3BtreeEnterAll(X) -#endif - -#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE -SQLITE_PRIVATE int sqlite3BtreeSharable(Btree*); -SQLITE_PRIVATE void sqlite3BtreeLeave(Btree*); -SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor*); -SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor*); -SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3*); -#ifndef NDEBUG - /* These routines are used inside assert() statements only. */ -SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree*); -SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3*); -SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3*,int,Schema*); -#endif -#else - -# define sqlite3BtreeSharable(X) 0 -# define sqlite3BtreeLeave(X) -# define sqlite3BtreeEnterCursor(X) -# define sqlite3BtreeLeaveCursor(X) -# define sqlite3BtreeLeaveAll(X) - -# define sqlite3BtreeHoldsMutex(X) 1 -# define sqlite3BtreeHoldsAllMutexes(X) 1 -# define sqlite3SchemaMutexHeld(X,Y,Z) 1 -#endif - - -#endif /* _BTREE_H_ */ - -/************** End of btree.h ***********************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ -/************** Include vdbe.h in the middle of sqliteInt.h ******************/ -/************** Begin file vdbe.h ********************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Header file for the Virtual DataBase Engine (VDBE) -** -** This header defines the interface to the virtual database engine -** or VDBE. The VDBE implements an abstract machine that runs a -** simple program to access and modify the underlying database. -*/ -#ifndef _SQLITE_VDBE_H_ -#define _SQLITE_VDBE_H_ -/* #include */ - -/* -** A single VDBE is an opaque structure named "Vdbe". Only routines -** in the source file sqliteVdbe.c are allowed to see the insides -** of this structure. -*/ -typedef struct Vdbe Vdbe; - -/* -** The names of the following types declared in vdbeInt.h are required -** for the VdbeOp definition. -*/ -typedef struct Mem Mem; -typedef struct SubProgram SubProgram; - -/* -** A single instruction of the virtual machine has an opcode -** and as many as three operands. The instruction is recorded -** as an instance of the following structure: -*/ -struct VdbeOp { - u8 opcode; /* What operation to perform */ - signed char p4type; /* One of the P4_xxx constants for p4 */ - u8 opflags; /* Mask of the OPFLG_* flags in opcodes.h */ - u8 p5; /* Fifth parameter is an unsigned character */ - int p1; /* First operand */ - int p2; /* Second parameter (often the jump destination) */ - int p3; /* The third parameter */ - union { /* fourth parameter */ - int i; /* Integer value if p4type==P4_INT32 */ - void *p; /* Generic pointer */ - char *z; /* Pointer to data for string (char array) types */ - i64 *pI64; /* Used when p4type is P4_INT64 */ - double *pReal; /* Used when p4type is P4_REAL */ - FuncDef *pFunc; /* Used when p4type is P4_FUNCDEF */ - CollSeq *pColl; /* Used when p4type is P4_COLLSEQ */ - Mem *pMem; /* Used when p4type is P4_MEM */ - VTable *pVtab; /* Used when p4type is P4_VTAB */ - KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */ - int *ai; /* Used when p4type is P4_INTARRAY */ - SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */ - int (*xAdvance)(BtCursor *, int *); - } p4; -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - char *zComment; /* Comment to improve readability */ -#endif -#ifdef VDBE_PROFILE - int cnt; /* Number of times this instruction was executed */ - u64 cycles; /* Total time spent executing this instruction */ -#endif -}; -typedef struct VdbeOp VdbeOp; - - -/* -** A sub-routine used to implement a trigger program. -*/ -struct SubProgram { - VdbeOp *aOp; /* Array of opcodes for sub-program */ - int nOp; /* Elements in aOp[] */ - int nMem; /* Number of memory cells required */ - int nCsr; /* Number of cursors required */ - int nOnce; /* Number of OP_Once instructions */ - void *token; /* id that may be used to recursive triggers */ - SubProgram *pNext; /* Next sub-program already visited */ -}; - -/* -** A smaller version of VdbeOp used for the VdbeAddOpList() function because -** it takes up less space. -*/ -struct VdbeOpList { - u8 opcode; /* What operation to perform */ - signed char p1; /* First operand */ - signed char p2; /* Second parameter (often the jump destination) */ - signed char p3; /* Third parameter */ -}; -typedef struct VdbeOpList VdbeOpList; - -/* -** Allowed values of VdbeOp.p4type -*/ -#define P4_NOTUSED 0 /* The P4 parameter is not used */ -#define P4_DYNAMIC (-1) /* Pointer to a string obtained from sqliteMalloc() */ -#define P4_STATIC (-2) /* Pointer to a static string */ -#define P4_COLLSEQ (-4) /* P4 is a pointer to a CollSeq structure */ -#define P4_FUNCDEF (-5) /* P4 is a pointer to a FuncDef structure */ -#define P4_KEYINFO (-6) /* P4 is a pointer to a KeyInfo structure */ -#define P4_MEM (-8) /* P4 is a pointer to a Mem* structure */ -#define P4_TRANSIENT 0 /* P4 is a pointer to a transient string */ -#define P4_VTAB (-10) /* P4 is a pointer to an sqlite3_vtab structure */ -#define P4_MPRINTF (-11) /* P4 is a string obtained from sqlite3_mprintf() */ -#define P4_REAL (-12) /* P4 is a 64-bit floating point value */ -#define P4_INT64 (-13) /* P4 is a 64-bit signed integer */ -#define P4_INT32 (-14) /* P4 is a 32-bit signed integer */ -#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */ -#define P4_SUBPROGRAM (-18) /* P4 is a pointer to a SubProgram structure */ -#define P4_ADVANCE (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */ - -/* Error message codes for OP_Halt */ -#define P5_ConstraintNotNull 1 -#define P5_ConstraintUnique 2 -#define P5_ConstraintCheck 3 -#define P5_ConstraintFK 4 - -/* -** The Vdbe.aColName array contains 5n Mem structures, where n is the -** number of columns of data returned by the statement. -*/ -#define COLNAME_NAME 0 -#define COLNAME_DECLTYPE 1 -#define COLNAME_DATABASE 2 -#define COLNAME_TABLE 3 -#define COLNAME_COLUMN 4 -#ifdef SQLITE_ENABLE_COLUMN_METADATA -# define COLNAME_N 5 /* Number of COLNAME_xxx symbols */ -#else -# ifdef SQLITE_OMIT_DECLTYPE -# define COLNAME_N 1 /* Store only the name */ -# else -# define COLNAME_N 2 /* Store the name and decltype */ -# endif -#endif - -/* -** The following macro converts a relative address in the p2 field -** of a VdbeOp structure into a negative number so that -** sqlite3VdbeAddOpList() knows that the address is relative. Calling -** the macro again restores the address. -*/ -#define ADDR(X) (-1-(X)) - -/* -** The makefile scans the vdbe.c source file and creates the "opcodes.h" -** header file that defines a number for each opcode used by the VDBE. -*/ -/************** Include opcodes.h in the middle of vdbe.h ********************/ -/************** Begin file opcodes.h *****************************************/ -/* Automatically generated. Do not edit */ -/* See the mkopcodeh.awk script for details */ -#define OP_Function 1 /* synopsis: r[P3]=func(r[P2@P5]) */ -#define OP_Savepoint 2 -#define OP_AutoCommit 3 -#define OP_Transaction 4 -#define OP_SorterNext 5 -#define OP_PrevIfOpen 6 -#define OP_NextIfOpen 7 -#define OP_Prev 8 -#define OP_Next 9 -#define OP_AggStep 10 /* synopsis: accum=r[P3] step(r[P2@P5]) */ -#define OP_Checkpoint 11 -#define OP_JournalMode 12 -#define OP_Vacuum 13 -#define OP_VFilter 14 /* synopsis: iPlan=r[P3] zPlan='P4' */ -#define OP_VUpdate 15 /* synopsis: data=r[P3@P2] */ -#define OP_Goto 16 -#define OP_Gosub 17 -#define OP_Return 18 -#define OP_Not 19 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */ -#define OP_Yield 20 -#define OP_HaltIfNull 21 /* synopsis: if r[P3] null then halt */ -#define OP_Halt 22 -#define OP_Integer 23 /* synopsis: r[P2]=P1 */ -#define OP_Int64 24 /* synopsis: r[P2]=P4 */ -#define OP_String 25 /* synopsis: r[P2]='P4' (len=P1) */ -#define OP_Null 26 /* synopsis: r[P2..P3]=NULL */ -#define OP_Blob 27 /* synopsis: r[P2]=P4 (len=P1) */ -#define OP_Variable 28 /* synopsis: r[P2]=parameter(P1,P4) */ -#define OP_Move 29 /* synopsis: r[P2@P3]=r[P1@P3] */ -#define OP_Copy 30 /* synopsis: r[P2@P3+1]=r[P1@P3+1] */ -#define OP_SCopy 31 /* synopsis: r[P2]=r[P1] */ -#define OP_ResultRow 32 /* synopsis: output=r[P1@P2] */ -#define OP_CollSeq 33 -#define OP_AddImm 34 /* synopsis: r[P1]=r[P1]+P2 */ -#define OP_MustBeInt 35 -#define OP_RealAffinity 36 -#define OP_Permutation 37 -#define OP_Compare 38 -#define OP_Jump 39 -#define OP_Once 40 -#define OP_If 41 -#define OP_IfNot 42 -#define OP_Column 43 /* synopsis: r[P3]=PX */ -#define OP_Affinity 44 /* synopsis: affinity(r[P1@P2]) */ -#define OP_MakeRecord 45 /* synopsis: r[P3]=mkrec(r[P1@P2]) */ -#define OP_Count 46 /* synopsis: r[P2]=count() */ -#define OP_ReadCookie 47 -#define OP_SetCookie 48 -#define OP_VerifyCookie 49 -#define OP_OpenRead 50 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenWrite 51 /* synopsis: root=P2 iDb=P3 */ -#define OP_OpenAutoindex 52 /* synopsis: nColumn=P2 */ -#define OP_OpenEphemeral 53 /* synopsis: nColumn=P2 */ -#define OP_SorterOpen 54 -#define OP_OpenPseudo 55 /* synopsis: content in r[P2@P3] */ -#define OP_Close 56 -#define OP_SeekLt 57 /* synopsis: key=r[P3@P4] */ -#define OP_SeekLe 58 /* synopsis: key=r[P3@P4] */ -#define OP_SeekGe 59 /* synopsis: key=r[P3@P4] */ -#define OP_SeekGt 60 /* synopsis: key=r[P3@P4] */ -#define OP_Seek 61 /* synopsis: intkey=r[P2] */ -#define OP_NoConflict 62 /* synopsis: key=r[P3@P4] */ -#define OP_NotFound 63 /* synopsis: key=r[P3@P4] */ -#define OP_Found 64 /* synopsis: key=r[P3@P4] */ -#define OP_NotExists 65 /* synopsis: intkey=r[P3] */ -#define OP_Sequence 66 /* synopsis: r[P2]=rowid */ -#define OP_NewRowid 67 /* synopsis: r[P2]=rowid */ -#define OP_Insert 68 /* synopsis: intkey=r[P3] data=r[P2] */ -#define OP_InsertInt 69 /* synopsis: intkey=P3 data=r[P2] */ -#define OP_Delete 70 -#define OP_Or 71 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */ -#define OP_And 72 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */ -#define OP_ResetCount 73 -#define OP_SorterCompare 74 /* synopsis: if key(P1)!=rtrim(r[P3],P4) goto P2 */ -#define OP_SorterData 75 /* synopsis: r[P2]=data */ -#define OP_IsNull 76 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */ -#define OP_NotNull 77 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */ -#define OP_Ne 78 /* same as TK_NE, synopsis: if r[P1]!=r[P3] goto P2 */ -#define OP_Eq 79 /* same as TK_EQ, synopsis: if r[P1]==r[P3] goto P2 */ -#define OP_Gt 80 /* same as TK_GT, synopsis: if r[P1]>r[P3] goto P2 */ -#define OP_Le 81 /* same as TK_LE, synopsis: if r[P1]<=r[P3] goto P2 */ -#define OP_Lt 82 /* same as TK_LT, synopsis: if r[P1]=r[P3] goto P2 */ -#define OP_RowKey 84 /* synopsis: r[P2]=key */ -#define OP_BitAnd 85 /* same as TK_BITAND, synopsis: r[P3]=r[P1]&r[P2] */ -#define OP_BitOr 86 /* same as TK_BITOR, synopsis: r[P3]=r[P1]|r[P2] */ -#define OP_ShiftLeft 87 /* same as TK_LSHIFT, synopsis: r[P3]=r[P2]<>r[P1] */ -#define OP_Add 89 /* same as TK_PLUS, synopsis: r[P3]=r[P1]+r[P2] */ -#define OP_Subtract 90 /* same as TK_MINUS, synopsis: r[P3]=r[P2]-r[P1] */ -#define OP_Multiply 91 /* same as TK_STAR, synopsis: r[P3]=r[P1]*r[P2] */ -#define OP_Divide 92 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */ -#define OP_Remainder 93 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */ -#define OP_Concat 94 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */ -#define OP_RowData 95 /* synopsis: r[P2]=data */ -#define OP_BitNot 96 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */ -#define OP_String8 97 /* same as TK_STRING, synopsis: r[P2]='P4' */ -#define OP_Rowid 98 /* synopsis: r[P2]=rowid */ -#define OP_NullRow 99 -#define OP_Last 100 -#define OP_SorterSort 101 -#define OP_Sort 102 -#define OP_Rewind 103 -#define OP_SorterInsert 104 -#define OP_IdxInsert 105 /* synopsis: key=r[P2] */ -#define OP_IdxDelete 106 /* synopsis: key=r[P2@P3] */ -#define OP_IdxRowid 107 /* synopsis: r[P2]=rowid */ -#define OP_IdxLT 108 /* synopsis: key=r[P3@P4] */ -#define OP_IdxGE 109 /* synopsis: key=r[P3@P4] */ -#define OP_Destroy 110 -#define OP_Clear 111 -#define OP_CreateIndex 112 /* synopsis: r[P2]=root iDb=P1 */ -#define OP_CreateTable 113 /* synopsis: r[P2]=root iDb=P1 */ -#define OP_ParseSchema 114 -#define OP_LoadAnalysis 115 -#define OP_DropTable 116 -#define OP_DropIndex 117 -#define OP_DropTrigger 118 -#define OP_IntegrityCk 119 -#define OP_RowSetAdd 120 /* synopsis: rowset(P1)=r[P2] */ -#define OP_RowSetRead 121 /* synopsis: r[P3]=rowset(P1) */ -#define OP_RowSetTest 122 /* synopsis: if r[P3] in rowset(P1) goto P2 */ -#define OP_Program 123 -#define OP_Param 124 -#define OP_FkCounter 125 /* synopsis: fkctr[P1]+=P2 */ -#define OP_FkIfZero 126 /* synopsis: if fkctr[P1]==0 goto P2 */ -#define OP_MemMax 127 /* synopsis: r[P1]=max(r[P1],r[P2]) */ -#define OP_IfPos 128 /* synopsis: if r[P1]>0 goto P2 */ -#define OP_IfNeg 129 /* synopsis: if r[P1]<0 goto P2 */ -#define OP_IfZero 130 /* synopsis: r[P1]+=P3, if r[P1]==0 goto P2 */ -#define OP_AggFinal 131 /* synopsis: accum=r[P1] N=P2 */ -#define OP_IncrVacuum 132 -#define OP_Real 133 /* same as TK_FLOAT, synopsis: r[P2]=P4 */ -#define OP_Expire 134 -#define OP_TableLock 135 /* synopsis: iDb=P1 root=P2 write=P3 */ -#define OP_VBegin 136 -#define OP_VCreate 137 -#define OP_VDestroy 138 -#define OP_VOpen 139 -#define OP_VColumn 140 /* synopsis: r[P3]=vcolumn(P2) */ -#define OP_VNext 141 -#define OP_VRename 142 -#define OP_ToText 143 /* same as TK_TO_TEXT */ -#define OP_ToBlob 144 /* same as TK_TO_BLOB */ -#define OP_ToNumeric 145 /* same as TK_TO_NUMERIC */ -#define OP_ToInt 146 /* same as TK_TO_INT */ -#define OP_ToReal 147 /* same as TK_TO_REAL */ -#define OP_Pagecount 148 -#define OP_MaxPgcnt 149 -#define OP_Trace 150 -#define OP_Noop 151 -#define OP_Explain 152 - - -/* Properties such as "out2" or "jump" that are specified in -** comments following the "case" for each opcode in the vdbe.c -** are encoded into bitvectors as follows: -*/ -#define OPFLG_JUMP 0x0001 /* jump: P2 holds jmp target */ -#define OPFLG_OUT2_PRERELEASE 0x0002 /* out2-prerelease: */ -#define OPFLG_IN1 0x0004 /* in1: P1 is an input */ -#define OPFLG_IN2 0x0008 /* in2: P2 is an input */ -#define OPFLG_IN3 0x0010 /* in3: P3 is an input */ -#define OPFLG_OUT2 0x0020 /* out2: P2 is an output */ -#define OPFLG_OUT3 0x0040 /* out3: P3 is an output */ -#define OPFLG_INITIALIZER {\ -/* 0 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,\ -/* 8 */ 0x01, 0x01, 0x00, 0x00, 0x02, 0x00, 0x01, 0x00,\ -/* 16 */ 0x01, 0x01, 0x04, 0x24, 0x04, 0x10, 0x00, 0x02,\ -/* 24 */ 0x02, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x20,\ -/* 32 */ 0x00, 0x00, 0x04, 0x05, 0x04, 0x00, 0x00, 0x01,\ -/* 40 */ 0x01, 0x05, 0x05, 0x00, 0x00, 0x00, 0x02, 0x02,\ -/* 48 */ 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 56 */ 0x00, 0x11, 0x11, 0x11, 0x11, 0x08, 0x11, 0x11,\ -/* 64 */ 0x11, 0x11, 0x02, 0x02, 0x00, 0x00, 0x00, 0x4c,\ -/* 72 */ 0x4c, 0x00, 0x00, 0x00, 0x05, 0x05, 0x15, 0x15,\ -/* 80 */ 0x15, 0x15, 0x15, 0x15, 0x00, 0x4c, 0x4c, 0x4c,\ -/* 88 */ 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x4c, 0x00,\ -/* 96 */ 0x24, 0x02, 0x02, 0x00, 0x01, 0x01, 0x01, 0x01,\ -/* 104 */ 0x08, 0x08, 0x00, 0x02, 0x01, 0x01, 0x02, 0x00,\ -/* 112 */ 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\ -/* 120 */ 0x0c, 0x45, 0x15, 0x01, 0x02, 0x00, 0x01, 0x08,\ -/* 128 */ 0x05, 0x05, 0x05, 0x00, 0x01, 0x02, 0x00, 0x00,\ -/* 136 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x04,\ -/* 144 */ 0x04, 0x04, 0x04, 0x04, 0x02, 0x02, 0x00, 0x00,\ -/* 152 */ 0x00,} - -/************** End of opcodes.h *********************************************/ -/************** Continuing where we left off in vdbe.h ***********************/ - -/* -** Prototypes for the VDBE interface. See comments on the implementation -** for a description of what each of these routines does. -*/ -SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse*); -SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe*,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe*,int,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe*,int,int,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe*,int,int,int,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp4(Vdbe*,int,int,int,int,const char *zP4,int); -SQLITE_PRIVATE int sqlite3VdbeAddOp4Int(Vdbe*,int,int,int,int,int); -SQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe*, int nOp, VdbeOpList const *aOp); -SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe*,int,char*); -SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe*, u32 addr, int P1); -SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe*, u32 addr, int P2); -SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe*, u32 addr, int P3); -SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe*, u8 P5); -SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe*, int addr); -SQLITE_PRIVATE void sqlite3VdbeChangeToNoop(Vdbe*, int addr); -SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe*, u8 op); -SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe*, int addr, const char *zP4, int N); -SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse*, Index*); -SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe*, int); -SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe*, int); -SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3*,Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeMakeReady(Vdbe*,Parse*); -SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe*, int); -SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe*); -#ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *, int); -#endif -SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe*); -SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe*,int); -SQLITE_PRIVATE int sqlite3VdbeSetColName(Vdbe*, int, int, const char *, void(*)(void*)); -SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe*); -SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe*, const char *z, int n, int); -SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe*,Vdbe*); -SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe*, int*, int*); -SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe*, int, u8); -SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe*, int); -#ifndef SQLITE_OMIT_TRACE -SQLITE_PRIVATE char *sqlite3VdbeExpandSql(Vdbe*, const char*); -#endif - -SQLITE_PRIVATE void sqlite3VdbeRecordUnpack(KeyInfo*,int,const void*,UnpackedRecord*); -SQLITE_PRIVATE int sqlite3VdbeRecordCompare(int,const void*,UnpackedRecord*); -SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord(KeyInfo *, char *, int, char **); - -#ifndef SQLITE_OMIT_TRIGGER -SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *); -#endif - -/* Use SQLITE_ENABLE_COMMENTS to enable generation of extra comments on -** each VDBE opcode. -** -** Use the SQLITE_ENABLE_MODULE_COMMENTS macro to see some extra no-op -** comments in VDBE programs that show key decision points in the code -** generator. -*/ -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS -SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe*, const char*, ...); -# define VdbeComment(X) sqlite3VdbeComment X -SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe*, const char*, ...); -# define VdbeNoopComment(X) sqlite3VdbeNoopComment X -# ifdef SQLITE_ENABLE_MODULE_COMMENTS -# define VdbeModuleComment(X) sqlite3VdbeNoopComment X -# else -# define VdbeModuleComment(X) -# endif -#else -# define VdbeComment(X) -# define VdbeNoopComment(X) -# define VdbeModuleComment(X) -#endif - -#endif - -/************** End of vdbe.h ************************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ -/************** Include pager.h in the middle of sqliteInt.h *****************/ -/************** Begin file pager.h *******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the interface that the sqlite page cache -** subsystem. The page cache subsystem reads and writes a file a page -** at a time and provides a journal for rollback. -*/ - -#ifndef _PAGER_H_ -#define _PAGER_H_ - -/* -** Default maximum size for persistent journal files. A negative -** value means no limit. This value may be overridden using the -** sqlite3PagerJournalSizeLimit() API. See also "PRAGMA journal_size_limit". -*/ -#ifndef SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT - #define SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT -1 -#endif - -/* -** The type used to represent a page number. The first page in a file -** is called page 1. 0 is used to represent "not a page". -*/ -typedef u32 Pgno; - -/* -** Each open file is managed by a separate instance of the "Pager" structure. -*/ -typedef struct Pager Pager; - -/* -** Handle type for pages. -*/ -typedef struct PgHdr DbPage; - -/* -** Page number PAGER_MJ_PGNO is never used in an SQLite database (it is -** reserved for working around a windows/posix incompatibility). It is -** used in the journal to signify that the remainder of the journal file -** is devoted to storing a master journal name - there are no more pages to -** roll back. See comments for function writeMasterJournal() in pager.c -** for details. -*/ -#define PAGER_MJ_PGNO(x) ((Pgno)((PENDING_BYTE/((x)->pageSize))+1)) - -/* -** Allowed values for the flags parameter to sqlite3PagerOpen(). -** -** NOTE: These values must match the corresponding BTREE_ values in btree.h. -*/ -#define PAGER_OMIT_JOURNAL 0x0001 /* Do not use a rollback journal */ -#define PAGER_MEMORY 0x0002 /* In-memory database */ - -/* -** Valid values for the second argument to sqlite3PagerLockingMode(). -*/ -#define PAGER_LOCKINGMODE_QUERY -1 -#define PAGER_LOCKINGMODE_NORMAL 0 -#define PAGER_LOCKINGMODE_EXCLUSIVE 1 - -/* -** Numeric constants that encode the journalmode. -*/ -#define PAGER_JOURNALMODE_QUERY (-1) /* Query the value of journalmode */ -#define PAGER_JOURNALMODE_DELETE 0 /* Commit by deleting journal file */ -#define PAGER_JOURNALMODE_PERSIST 1 /* Commit by zeroing journal header */ -#define PAGER_JOURNALMODE_OFF 2 /* Journal omitted. */ -#define PAGER_JOURNALMODE_TRUNCATE 3 /* Commit by truncating journal */ -#define PAGER_JOURNALMODE_MEMORY 4 /* In-memory journal file */ -#define PAGER_JOURNALMODE_WAL 5 /* Use write-ahead logging */ - -/* -** Flags that make up the mask passed to sqlite3PagerAcquire(). -*/ -#define PAGER_GET_NOCONTENT 0x01 /* Do not load data from disk */ -#define PAGER_GET_READONLY 0x02 /* Read-only page is acceptable */ - -/* -** Flags for sqlite3PagerSetFlags() -*/ -#define PAGER_SYNCHRONOUS_OFF 0x01 /* PRAGMA synchronous=OFF */ -#define PAGER_SYNCHRONOUS_NORMAL 0x02 /* PRAGMA synchronous=NORMAL */ -#define PAGER_SYNCHRONOUS_FULL 0x03 /* PRAGMA synchronous=FULL */ -#define PAGER_SYNCHRONOUS_MASK 0x03 /* Mask for three values above */ -#define PAGER_FULLFSYNC 0x04 /* PRAGMA fullfsync=ON */ -#define PAGER_CKPT_FULLFSYNC 0x08 /* PRAGMA checkpoint_fullfsync=ON */ -#define PAGER_CACHESPILL 0x10 /* PRAGMA cache_spill=ON */ -#define PAGER_FLAGS_MASK 0x1c /* All above except SYNCHRONOUS */ - -/* -** The remainder of this file contains the declarations of the functions -** that make up the Pager sub-system API. See source code comments for -** a detailed description of each routine. -*/ - -/* Open and close a Pager connection. */ -SQLITE_PRIVATE int sqlite3PagerOpen( - sqlite3_vfs*, - Pager **ppPager, - const char*, - int, - int, - int, - void(*)(DbPage*) -); -SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager); -SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager*, int, unsigned char*); - -/* Functions used to configure a Pager object. */ -SQLITE_PRIVATE void sqlite3PagerSetBusyhandler(Pager*, int(*)(void *), void *); -SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager*, u32*, int); -SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager*, int); -SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager*, int); -SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *, sqlite3_int64); -SQLITE_PRIVATE void sqlite3PagerShrink(Pager*); -SQLITE_PRIVATE void sqlite3PagerSetFlags(Pager*,unsigned); -SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *, int); -SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *, int); -SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager*); -SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager*); -SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *, i64); -SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager*); - -/* Functions used to obtain and release page references. */ -SQLITE_PRIVATE int sqlite3PagerAcquire(Pager *pPager, Pgno pgno, DbPage **ppPage, int clrFlag); -#define sqlite3PagerGet(A,B,C) sqlite3PagerAcquire(A,B,C,0) -SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno); -SQLITE_PRIVATE void sqlite3PagerRef(DbPage*); -SQLITE_PRIVATE void sqlite3PagerUnref(DbPage*); -SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage*); - -/* Operations on page references. */ -SQLITE_PRIVATE int sqlite3PagerWrite(DbPage*); -SQLITE_PRIVATE void sqlite3PagerDontWrite(DbPage*); -SQLITE_PRIVATE int sqlite3PagerMovepage(Pager*,DbPage*,Pgno,int); -SQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage*); -SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *); -SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *); - -/* Functions used to manage pager transactions and savepoints. */ -SQLITE_PRIVATE void sqlite3PagerPagecount(Pager*, int*); -SQLITE_PRIVATE int sqlite3PagerBegin(Pager*, int exFlag, int); -SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne(Pager*,const char *zMaster, int); -SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager*); -SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster); -SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager*); -SQLITE_PRIVATE int sqlite3PagerRollback(Pager*); -SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int n); -SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint); -SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager); - -#ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int, int*, int*); -SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager); -SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager); -SQLITE_PRIVATE int sqlite3PagerOpenWal(Pager *pPager, int *pisOpen); -SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager); -#endif - -#ifdef SQLITE_ENABLE_ZIPVFS -SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager); -#endif - -/* Functions used to query pager state and configuration. */ -SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager*); -SQLITE_PRIVATE int sqlite3PagerRefcount(Pager*); -SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager*); -SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager*, int); -SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager*); -SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager*); -SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager*); -SQLITE_PRIVATE int sqlite3PagerNosync(Pager*); -SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager*); -SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager*); -SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *, int, int, int *); -SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *); -SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *); - -/* Functions used to truncate the database file. */ -SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager*,Pgno); - -#if defined(SQLITE_HAS_CODEC) && !defined(SQLITE_OMIT_WAL) -SQLITE_PRIVATE void *sqlite3PagerCodec(DbPage *); -#endif - -/* Functions to support testing and debugging. */ -#if !defined(NDEBUG) || defined(SQLITE_TEST) -SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage*); -SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage*); -#endif -#ifdef SQLITE_TEST -SQLITE_PRIVATE int *sqlite3PagerStats(Pager*); -SQLITE_PRIVATE void sqlite3PagerRefdump(Pager*); - void disable_simulated_io_errors(void); - void enable_simulated_io_errors(void); -#else -# define disable_simulated_io_errors() -# define enable_simulated_io_errors() -#endif - -#endif /* _PAGER_H_ */ - -/************** End of pager.h ***********************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ -/************** Include pcache.h in the middle of sqliteInt.h ****************/ -/************** Begin file pcache.h ******************************************/ -/* -** 2008 August 05 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the interface that the sqlite page cache -** subsystem. -*/ - -#ifndef _PCACHE_H_ - -typedef struct PgHdr PgHdr; -typedef struct PCache PCache; - -/* -** Every page in the cache is controlled by an instance of the following -** structure. -*/ -struct PgHdr { - sqlite3_pcache_page *pPage; /* Pcache object page handle */ - void *pData; /* Page data */ - void *pExtra; /* Extra content */ - PgHdr *pDirty; /* Transient list of dirty pages */ - Pager *pPager; /* The pager this page is part of */ - Pgno pgno; /* Page number for this page */ -#ifdef SQLITE_CHECK_PAGES - u32 pageHash; /* Hash of page content */ -#endif - u16 flags; /* PGHDR flags defined below */ - - /********************************************************************** - ** Elements above are public. All that follows is private to pcache.c - ** and should not be accessed by other modules. - */ - i16 nRef; /* Number of users of this page */ - PCache *pCache; /* Cache that owns this page */ - - PgHdr *pDirtyNext; /* Next element in list of dirty pages */ - PgHdr *pDirtyPrev; /* Previous element in list of dirty pages */ -}; - -/* Bit values for PgHdr.flags */ -#define PGHDR_DIRTY 0x002 /* Page has changed */ -#define PGHDR_NEED_SYNC 0x004 /* Fsync the rollback journal before - ** writing this page to the database */ -#define PGHDR_NEED_READ 0x008 /* Content is unread */ -#define PGHDR_REUSE_UNLIKELY 0x010 /* A hint that reuse is unlikely */ -#define PGHDR_DONT_WRITE 0x020 /* Do not write content to disk */ - -#define PGHDR_MMAP 0x040 /* This is an mmap page object */ - -/* Initialize and shutdown the page cache subsystem */ -SQLITE_PRIVATE int sqlite3PcacheInitialize(void); -SQLITE_PRIVATE void sqlite3PcacheShutdown(void); - -/* Page cache buffer management: -** These routines implement SQLITE_CONFIG_PAGECACHE. -*/ -SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *, int sz, int n); - -/* Create a new pager cache. -** Under memory stress, invoke xStress to try to make pages clean. -** Only clean and unpinned pages can be reclaimed. -*/ -SQLITE_PRIVATE void sqlite3PcacheOpen( - int szPage, /* Size of every page */ - int szExtra, /* Extra space associated with each page */ - int bPurgeable, /* True if pages are on backing store */ - int (*xStress)(void*, PgHdr*), /* Call to try to make pages clean */ - void *pStress, /* Argument to xStress */ - PCache *pToInit /* Preallocated space for the PCache */ -); - -/* Modify the page-size after the cache has been created. */ -SQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *, int); - -/* Return the size in bytes of a PCache object. Used to preallocate -** storage space. -*/ -SQLITE_PRIVATE int sqlite3PcacheSize(void); - -/* One release per successful fetch. Page is pinned until released. -** Reference counted. -*/ -SQLITE_PRIVATE int sqlite3PcacheFetch(PCache*, Pgno, int createFlag, PgHdr**); -SQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr*); - -SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr*); /* Remove page from cache */ -SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr*); /* Make sure page is marked dirty */ -SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr*); /* Mark a single page as clean */ -SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache*); /* Mark all dirty list pages as clean */ - -/* Change a page number. Used by incr-vacuum. */ -SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr*, Pgno); - -/* Remove all pages with pgno>x. Reset the cache if x==0 */ -SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache*, Pgno x); - -/* Get a list of all dirty pages in the cache, sorted by page number */ -SQLITE_PRIVATE PgHdr *sqlite3PcacheDirtyList(PCache*); - -/* Reset and close the cache object */ -SQLITE_PRIVATE void sqlite3PcacheClose(PCache*); - -/* Clear flags from pages of the page cache */ -SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *); - -/* Discard the contents of the cache */ -SQLITE_PRIVATE void sqlite3PcacheClear(PCache*); - -/* Return the total number of outstanding page references */ -SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache*); - -/* Increment the reference count of an existing page */ -SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr*); - -SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr*); - -/* Return the total number of pages stored in the cache */ -SQLITE_PRIVATE int sqlite3PcachePagecount(PCache*); - -#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG) -/* Iterate through all dirty pages currently stored in the cache. This -** interface is only available if SQLITE_CHECK_PAGES is defined when the -** library is built. -*/ -SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)); -#endif - -/* Set and get the suggested cache-size for the specified pager-cache. -** -** If no global maximum is configured, then the system attempts to limit -** the total number of pages cached by purgeable pager-caches to the sum -** of the suggested cache-sizes. -*/ -SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *, int); -#ifdef SQLITE_TEST -SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *); -#endif - -/* Free up as much memory as possible from the page cache */ -SQLITE_PRIVATE void sqlite3PcacheShrink(PCache*); - -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT -/* Try to return memory used by the pcache module to the main memory heap */ -SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int); -#endif - -#ifdef SQLITE_TEST -SQLITE_PRIVATE void sqlite3PcacheStats(int*,int*,int*,int*); -#endif - -SQLITE_PRIVATE void sqlite3PCacheSetDefault(void); - -#endif /* _PCACHE_H_ */ - -/************** End of pcache.h **********************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ - -/************** Include os.h in the middle of sqliteInt.h ********************/ -/************** Begin file os.h **********************************************/ -/* -** 2001 September 16 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This header file (together with is companion C source-code file -** "os.c") attempt to abstract the underlying operating system so that -** the SQLite library will work on both POSIX and windows systems. -** -** This header file is #include-ed by sqliteInt.h and thus ends up -** being included by every source file. -*/ -#ifndef _SQLITE_OS_H_ -#define _SQLITE_OS_H_ - -/* -** Figure out if we are dealing with Unix, Windows, or some other -** operating system. After the following block of preprocess macros, -** all of SQLITE_OS_UNIX, SQLITE_OS_WIN, and SQLITE_OS_OTHER -** will defined to either 1 or 0. One of the four will be 1. The other -** three will be 0. -*/ -#if defined(SQLITE_OS_OTHER) -# if SQLITE_OS_OTHER==1 -# undef SQLITE_OS_UNIX -# define SQLITE_OS_UNIX 0 -# undef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# else -# undef SQLITE_OS_OTHER -# endif -#endif -#if !defined(SQLITE_OS_UNIX) && !defined(SQLITE_OS_OTHER) -# define SQLITE_OS_OTHER 0 -# ifndef SQLITE_OS_WIN -# if defined(_WIN32) || defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__BORLANDC__) -# define SQLITE_OS_WIN 1 -# define SQLITE_OS_UNIX 0 -# else -# define SQLITE_OS_WIN 0 -# define SQLITE_OS_UNIX 1 -# endif -# else -# define SQLITE_OS_UNIX 0 -# endif -#else -# ifndef SQLITE_OS_WIN -# define SQLITE_OS_WIN 0 -# endif -#endif - -#if SQLITE_OS_WIN -# include -#endif - -/* -** Determine if we are dealing with Windows NT. -** -** We ought to be able to determine if we are compiling for win98 or winNT -** using the _WIN32_WINNT macro as follows: -** -** #if defined(_WIN32_WINNT) -** # define SQLITE_OS_WINNT 1 -** #else -** # define SQLITE_OS_WINNT 0 -** #endif -** -** However, vs2005 does not set _WIN32_WINNT by default, as it ought to, -** so the above test does not work. We'll just assume that everything is -** winNT unless the programmer explicitly says otherwise by setting -** SQLITE_OS_WINNT to 0. -*/ -#if SQLITE_OS_WIN && !defined(SQLITE_OS_WINNT) -# define SQLITE_OS_WINNT 1 -#endif - -/* -** Determine if we are dealing with WindowsCE - which has a much -** reduced API. -*/ -#if defined(_WIN32_WCE) -# define SQLITE_OS_WINCE 1 -#else -# define SQLITE_OS_WINCE 0 -#endif - -/* -** Determine if we are dealing with WinRT, which provides only a subset of -** the full Win32 API. -*/ -#if !defined(SQLITE_OS_WINRT) -# define SQLITE_OS_WINRT 0 -#endif - -/* If the SET_FULLSYNC macro is not defined above, then make it -** a no-op -*/ -#ifndef SET_FULLSYNC -# define SET_FULLSYNC(x,y) -#endif - -/* -** The default size of a disk sector -*/ -#ifndef SQLITE_DEFAULT_SECTOR_SIZE -# define SQLITE_DEFAULT_SECTOR_SIZE 4096 -#endif - -/* -** Temporary files are named starting with this prefix followed by 16 random -** alphanumeric characters, and no file extension. They are stored in the -** OS's standard temporary file directory, and are deleted prior to exit. -** If sqlite is being embedded in another program, you may wish to change the -** prefix to reflect your program's name, so that if your program exits -** prematurely, old temporary files can be easily identified. This can be done -** using -DSQLITE_TEMP_FILE_PREFIX=myprefix_ on the compiler command line. -** -** 2006-10-31: The default prefix used to be "sqlite_". But then -** Mcafee started using SQLite in their anti-virus product and it -** started putting files with the "sqlite" name in the c:/temp folder. -** This annoyed many windows users. Those users would then do a -** Google search for "sqlite", find the telephone numbers of the -** developers and call to wake them up at night and complain. -** For this reason, the default name prefix is changed to be "sqlite" -** spelled backwards. So the temp files are still identified, but -** anybody smart enough to figure out the code is also likely smart -** enough to know that calling the developer will not help get rid -** of the file. -*/ -#ifndef SQLITE_TEMP_FILE_PREFIX -# define SQLITE_TEMP_FILE_PREFIX "etilqs_" -#endif - -/* -** The following values may be passed as the second argument to -** sqlite3OsLock(). The various locks exhibit the following semantics: -** -** SHARED: Any number of processes may hold a SHARED lock simultaneously. -** RESERVED: A single process may hold a RESERVED lock on a file at -** any time. Other processes may hold and obtain new SHARED locks. -** PENDING: A single process may hold a PENDING lock on a file at -** any one time. Existing SHARED locks may persist, but no new -** SHARED locks may be obtained by other processes. -** EXCLUSIVE: An EXCLUSIVE lock precludes all other locks. -** -** PENDING_LOCK may not be passed directly to sqlite3OsLock(). Instead, a -** process that requests an EXCLUSIVE lock may actually obtain a PENDING -** lock. This can be upgraded to an EXCLUSIVE lock by a subsequent call to -** sqlite3OsLock(). -*/ -#define NO_LOCK 0 -#define SHARED_LOCK 1 -#define RESERVED_LOCK 2 -#define PENDING_LOCK 3 -#define EXCLUSIVE_LOCK 4 - -/* -** File Locking Notes: (Mostly about windows but also some info for Unix) -** -** We cannot use LockFileEx() or UnlockFileEx() on Win95/98/ME because -** those functions are not available. So we use only LockFile() and -** UnlockFile(). -** -** LockFile() prevents not just writing but also reading by other processes. -** A SHARED_LOCK is obtained by locking a single randomly-chosen -** byte out of a specific range of bytes. The lock byte is obtained at -** random so two separate readers can probably access the file at the -** same time, unless they are unlucky and choose the same lock byte. -** An EXCLUSIVE_LOCK is obtained by locking all bytes in the range. -** There can only be one writer. A RESERVED_LOCK is obtained by locking -** a single byte of the file that is designated as the reserved lock byte. -** A PENDING_LOCK is obtained by locking a designated byte different from -** the RESERVED_LOCK byte. -** -** On WinNT/2K/XP systems, LockFileEx() and UnlockFileEx() are available, -** which means we can use reader/writer locks. When reader/writer locks -** are used, the lock is placed on the same range of bytes that is used -** for probabilistic locking in Win95/98/ME. Hence, the locking scheme -** will support two or more Win95 readers or two or more WinNT readers. -** But a single Win95 reader will lock out all WinNT readers and a single -** WinNT reader will lock out all other Win95 readers. -** -** The following #defines specify the range of bytes used for locking. -** SHARED_SIZE is the number of bytes available in the pool from which -** a random byte is selected for a shared lock. The pool of bytes for -** shared locks begins at SHARED_FIRST. -** -** The same locking strategy and -** byte ranges are used for Unix. This leaves open the possiblity of having -** clients on win95, winNT, and unix all talking to the same shared file -** and all locking correctly. To do so would require that samba (or whatever -** tool is being used for file sharing) implements locks correctly between -** windows and unix. I'm guessing that isn't likely to happen, but by -** using the same locking range we are at least open to the possibility. -** -** Locking in windows is manditory. For this reason, we cannot store -** actual data in the bytes used for locking. The pager never allocates -** the pages involved in locking therefore. SHARED_SIZE is selected so -** that all locks will fit on a single page even at the minimum page size. -** PENDING_BYTE defines the beginning of the locks. By default PENDING_BYTE -** is set high so that we don't have to allocate an unused page except -** for very large databases. But one should test the page skipping logic -** by setting PENDING_BYTE low and running the entire regression suite. -** -** Changing the value of PENDING_BYTE results in a subtly incompatible -** file format. Depending on how it is changed, you might not notice -** the incompatibility right away, even running a full regression test. -** The default location of PENDING_BYTE is the first byte past the -** 1GB boundary. -** -*/ -#ifdef SQLITE_OMIT_WSD -# define PENDING_BYTE (0x40000000) -#else -# define PENDING_BYTE sqlite3PendingByte -#endif -#define RESERVED_BYTE (PENDING_BYTE+1) -#define SHARED_FIRST (PENDING_BYTE+2) -#define SHARED_SIZE 510 - -/* -** Wrapper around OS specific sqlite3_os_init() function. -*/ -SQLITE_PRIVATE int sqlite3OsInit(void); - -/* -** Functions for accessing sqlite3_file methods -*/ -SQLITE_PRIVATE int sqlite3OsClose(sqlite3_file*); -SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file*, void*, int amt, i64 offset); -SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file*, const void*, int amt, i64 offset); -SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file*, i64 size); -SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file*, int); -SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file*, i64 *pSize); -SQLITE_PRIVATE int sqlite3OsLock(sqlite3_file*, int); -SQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file*, int); -SQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut); -SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file*,int,void*); -SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file*,int,void*); -#define SQLITE_FCNTL_DB_UNCHANGED 0xca093fa0 -SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id); -SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id); -SQLITE_PRIVATE int sqlite3OsShmMap(sqlite3_file *,int,int,int,void volatile **); -SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int, int, int); -SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id); -SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int); -SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64, int, void **); -SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *, i64, void *); - - -/* -** Functions for accessing sqlite3_vfs methods -*/ -SQLITE_PRIVATE int sqlite3OsOpen(sqlite3_vfs *, const char *, sqlite3_file*, int, int *); -SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *, const char *, int); -SQLITE_PRIVATE int sqlite3OsAccess(sqlite3_vfs *, const char *, int, int *pResOut); -SQLITE_PRIVATE int sqlite3OsFullPathname(sqlite3_vfs *, const char *, int, char *); -#ifndef SQLITE_OMIT_LOAD_EXTENSION -SQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *, const char *); -SQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *, int, char *); -SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *, void *, const char *))(void); -SQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *, void *); -#endif /* SQLITE_OMIT_LOAD_EXTENSION */ -SQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *, int, char *); -SQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *, int); -SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *, sqlite3_int64*); - -/* -** Convenience functions for opening and closing files using -** sqlite3_malloc() to obtain space for the file-handle structure. -*/ -SQLITE_PRIVATE int sqlite3OsOpenMalloc(sqlite3_vfs *, const char *, sqlite3_file **, int,int*); -SQLITE_PRIVATE int sqlite3OsCloseFree(sqlite3_file *); - -#endif /* _SQLITE_OS_H_ */ - -/************** End of os.h **************************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ -/************** Include mutex.h in the middle of sqliteInt.h *****************/ -/************** Begin file mutex.h *******************************************/ -/* -** 2007 August 28 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains the common header for all mutex implementations. -** The sqliteInt.h header #includes this file so that it is available -** to all source files. We break it out in an effort to keep the code -** better organized. -** -** NOTE: source files should *not* #include this header file directly. -** Source files should #include the sqliteInt.h file and let that file -** include this one indirectly. -*/ - - -/* -** Figure out what version of the code to use. The choices are -** -** SQLITE_MUTEX_OMIT No mutex logic. Not even stubs. The -** mutexes implemention cannot be overridden -** at start-time. -** -** SQLITE_MUTEX_NOOP For single-threaded applications. No -** mutual exclusion is provided. But this -** implementation can be overridden at -** start-time. -** -** SQLITE_MUTEX_PTHREADS For multi-threaded applications on Unix. -** -** SQLITE_MUTEX_W32 For multi-threaded applications on Win32. -*/ -#if !SQLITE_THREADSAFE -# define SQLITE_MUTEX_OMIT -#endif -#if SQLITE_THREADSAFE && !defined(SQLITE_MUTEX_NOOP) -# if SQLITE_OS_UNIX -# define SQLITE_MUTEX_PTHREADS -# elif SQLITE_OS_WIN -# define SQLITE_MUTEX_W32 -# else -# define SQLITE_MUTEX_NOOP -# endif -#endif - -#ifdef SQLITE_MUTEX_OMIT -/* -** If this is a no-op implementation, implement everything as macros. -*/ -#define sqlite3_mutex_alloc(X) ((sqlite3_mutex*)8) -#define sqlite3_mutex_free(X) -#define sqlite3_mutex_enter(X) -#define sqlite3_mutex_try(X) SQLITE_OK -#define sqlite3_mutex_leave(X) -#define sqlite3_mutex_held(X) ((void)(X),1) -#define sqlite3_mutex_notheld(X) ((void)(X),1) -#define sqlite3MutexAlloc(X) ((sqlite3_mutex*)8) -#define sqlite3MutexInit() SQLITE_OK -#define sqlite3MutexEnd() -#define MUTEX_LOGIC(X) -#else -#define MUTEX_LOGIC(X) X -#endif /* defined(SQLITE_MUTEX_OMIT) */ - -/************** End of mutex.h ***********************************************/ -/************** Continuing where we left off in sqliteInt.h ******************/ - - -/* -** Each database file to be accessed by the system is an instance -** of the following structure. There are normally two of these structures -** in the sqlite.aDb[] array. aDb[0] is the main database file and -** aDb[1] is the database file used to hold temporary tables. Additional -** databases may be attached. -*/ -struct Db { - char *zName; /* Name of this database */ - Btree *pBt; /* The B*Tree structure for this database file */ - u8 safety_level; /* How aggressive at syncing data to disk */ - Schema *pSchema; /* Pointer to database schema (possibly shared) */ -}; - -/* -** An instance of the following structure stores a database schema. -** -** Most Schema objects are associated with a Btree. The exception is -** the Schema for the TEMP databaes (sqlite3.aDb[1]) which is free-standing. -** In shared cache mode, a single Schema object can be shared by multiple -** Btrees that refer to the same underlying BtShared object. -** -** Schema objects are automatically deallocated when the last Btree that -** references them is destroyed. The TEMP Schema is manually freed by -** sqlite3_close(). -* -** A thread must be holding a mutex on the corresponding Btree in order -** to access Schema content. This implies that the thread must also be -** holding a mutex on the sqlite3 connection pointer that owns the Btree. -** For a TEMP Schema, only the connection mutex is required. -*/ -struct Schema { - int schema_cookie; /* Database schema version number for this file */ - int iGeneration; /* Generation counter. Incremented with each change */ - Hash tblHash; /* All tables indexed by name */ - Hash idxHash; /* All (named) indices indexed by name */ - Hash trigHash; /* All triggers indexed by name */ - Hash fkeyHash; /* All foreign keys by referenced table name */ - Table *pSeqTab; /* The sqlite_sequence table used by AUTOINCREMENT */ - u8 file_format; /* Schema format version for this file */ - u8 enc; /* Text encoding used by this database */ - u16 flags; /* Flags associated with this schema */ - int cache_size; /* Number of pages to use in the cache */ -}; - -/* -** These macros can be used to test, set, or clear bits in the -** Db.pSchema->flags field. -*/ -#define DbHasProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))==(P)) -#define DbHasAnyProperty(D,I,P) (((D)->aDb[I].pSchema->flags&(P))!=0) -#define DbSetProperty(D,I,P) (D)->aDb[I].pSchema->flags|=(P) -#define DbClearProperty(D,I,P) (D)->aDb[I].pSchema->flags&=~(P) - -/* -** Allowed values for the DB.pSchema->flags field. -** -** The DB_SchemaLoaded flag is set after the database schema has been -** read into internal hash tables. -** -** DB_UnresetViews means that one or more views have column names that -** have been filled out. If the schema changes, these column names might -** changes and so the view will need to be reset. -*/ -#define DB_SchemaLoaded 0x0001 /* The schema has been loaded */ -#define DB_UnresetViews 0x0002 /* Some views have defined column names */ -#define DB_Empty 0x0004 /* The file is empty (length 0 bytes) */ - -/* -** The number of different kinds of things that can be limited -** using the sqlite3_limit() interface. -*/ -#define SQLITE_N_LIMIT (SQLITE_LIMIT_TRIGGER_DEPTH+1) - -/* -** Lookaside malloc is a set of fixed-size buffers that can be used -** to satisfy small transient memory allocation requests for objects -** associated with a particular database connection. The use of -** lookaside malloc provides a significant performance enhancement -** (approx 10%) by avoiding numerous malloc/free requests while parsing -** SQL statements. -** -** The Lookaside structure holds configuration information about the -** lookaside malloc subsystem. Each available memory allocation in -** the lookaside subsystem is stored on a linked list of LookasideSlot -** objects. -** -** Lookaside allocations are only allowed for objects that are associated -** with a particular database connection. Hence, schema information cannot -** be stored in lookaside because in shared cache mode the schema information -** is shared by multiple database connections. Therefore, while parsing -** schema information, the Lookaside.bEnabled flag is cleared so that -** lookaside allocations are not used to construct the schema objects. -*/ -struct Lookaside { - u16 sz; /* Size of each buffer in bytes */ - u8 bEnabled; /* False to disable new lookaside allocations */ - u8 bMalloced; /* True if pStart obtained from sqlite3_malloc() */ - int nOut; /* Number of buffers currently checked out */ - int mxOut; /* Highwater mark for nOut */ - int anStat[3]; /* 0: hits. 1: size misses. 2: full misses */ - LookasideSlot *pFree; /* List of available buffers */ - void *pStart; /* First byte of available memory space */ - void *pEnd; /* First byte past end of available space */ -}; -struct LookasideSlot { - LookasideSlot *pNext; /* Next buffer in the list of free buffers */ -}; - -/* -** A hash table for function definitions. -** -** Hash each FuncDef structure into one of the FuncDefHash.a[] slots. -** Collisions are on the FuncDef.pHash chain. -*/ -struct FuncDefHash { - FuncDef *a[23]; /* Hash table for functions */ -}; - -/* -** Each database connection is an instance of the following structure. -*/ -struct sqlite3 { - sqlite3_vfs *pVfs; /* OS Interface */ - struct Vdbe *pVdbe; /* List of active virtual machines */ - CollSeq *pDfltColl; /* The default collating sequence (BINARY) */ - sqlite3_mutex *mutex; /* Connection mutex */ - Db *aDb; /* All backends */ - int nDb; /* Number of backends currently in use */ - int flags; /* Miscellaneous flags. See below */ - i64 lastRowid; /* ROWID of most recent insert (see above) */ - i64 szMmap; /* Default mmap_size setting */ - unsigned int openFlags; /* Flags passed to sqlite3_vfs.xOpen() */ - int errCode; /* Most recent error code (SQLITE_*) */ - int errMask; /* & result codes with this before returning */ - u16 dbOptFlags; /* Flags to enable/disable optimizations */ - u8 autoCommit; /* The auto-commit flag. */ - u8 temp_store; /* 1: file 2: memory 0: default */ - u8 mallocFailed; /* True if we have seen a malloc failure */ - u8 dfltLockMode; /* Default locking-mode for attached dbs */ - signed char nextAutovac; /* Autovac setting after VACUUM if >=0 */ - u8 suppressErr; /* Do not issue error messages if true */ - u8 vtabOnConflict; /* Value to return for s3_vtab_on_conflict() */ - u8 isTransactionSavepoint; /* True if the outermost savepoint is a TS */ - int nextPagesize; /* Pagesize after VACUUM if >0 */ - u32 magic; /* Magic number for detect library misuse */ - int nChange; /* Value returned by sqlite3_changes() */ - int nTotalChange; /* Value returned by sqlite3_total_changes() */ - int aLimit[SQLITE_N_LIMIT]; /* Limits */ - struct sqlite3InitInfo { /* Information used during initialization */ - int newTnum; /* Rootpage of table being initialized */ - u8 iDb; /* Which db file is being initialized */ - u8 busy; /* TRUE if currently initializing */ - u8 orphanTrigger; /* Last statement is orphaned TEMP trigger */ - } init; - int nVdbeActive; /* Number of VDBEs currently running */ - int nVdbeRead; /* Number of active VDBEs that read or write */ - int nVdbeWrite; /* Number of active VDBEs that read and write */ - int nVdbeExec; /* Number of nested calls to VdbeExec() */ - int nExtension; /* Number of loaded extensions */ - void **aExtension; /* Array of shared library handles */ - void (*xTrace)(void*,const char*); /* Trace function */ - void *pTraceArg; /* Argument to the trace function */ - void (*xProfile)(void*,const char*,u64); /* Profiling function */ - void *pProfileArg; /* Argument to profile function */ - void *pCommitArg; /* Argument to xCommitCallback() */ - int (*xCommitCallback)(void*); /* Invoked at every commit. */ - void *pRollbackArg; /* Argument to xRollbackCallback() */ - void (*xRollbackCallback)(void*); /* Invoked at every commit. */ - void *pUpdateArg; - void (*xUpdateCallback)(void*,int, const char*,const char*,sqlite_int64); -#ifndef SQLITE_OMIT_WAL - int (*xWalCallback)(void *, sqlite3 *, const char *, int); - void *pWalArg; -#endif - void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*); - void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*); - void *pCollNeededArg; - sqlite3_value *pErr; /* Most recent error message */ - union { - volatile int isInterrupted; /* True if sqlite3_interrupt has been called */ - double notUsed1; /* Spacer */ - } u1; - Lookaside lookaside; /* Lookaside malloc configuration */ -#ifndef SQLITE_OMIT_AUTHORIZATION - int (*xAuth)(void*,int,const char*,const char*,const char*,const char*); - /* Access authorization function */ - void *pAuthArg; /* 1st argument to the access auth function */ -#endif -#ifndef SQLITE_OMIT_PROGRESS_CALLBACK - int (*xProgress)(void *); /* The progress callback */ - void *pProgressArg; /* Argument to the progress callback */ - unsigned nProgressOps; /* Number of opcodes for progress callback */ -#endif -#ifndef SQLITE_OMIT_VIRTUALTABLE - int nVTrans; /* Allocated size of aVTrans */ - Hash aModule; /* populated by sqlite3_create_module() */ - VtabCtx *pVtabCtx; /* Context for active vtab connect/create */ - VTable **aVTrans; /* Virtual tables with open transactions */ - VTable *pDisconnect; /* Disconnect these in next sqlite3_prepare() */ -#endif - FuncDefHash aFunc; /* Hash table of connection functions */ - Hash aCollSeq; /* All collating sequences */ - BusyHandler busyHandler; /* Busy callback */ - Db aDbStatic[2]; /* Static space for the 2 default backends */ - Savepoint *pSavepoint; /* List of active savepoints */ - int busyTimeout; /* Busy handler timeout, in msec */ - int nSavepoint; /* Number of non-transaction savepoints */ - int nStatement; /* Number of nested statement-transactions */ - i64 nDeferredCons; /* Net deferred constraints this transaction. */ - i64 nDeferredImmCons; /* Net deferred immediate constraints */ - int *pnBytesFreed; /* If not NULL, increment this in DbFree() */ - -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY - /* The following variables are all protected by the STATIC_MASTER - ** mutex, not by sqlite3.mutex. They are used by code in notify.c. - ** - ** When X.pUnlockConnection==Y, that means that X is waiting for Y to - ** unlock so that it can proceed. - ** - ** When X.pBlockingConnection==Y, that means that something that X tried - ** tried to do recently failed with an SQLITE_LOCKED error due to locks - ** held by Y. - */ - sqlite3 *pBlockingConnection; /* Connection that caused SQLITE_LOCKED */ - sqlite3 *pUnlockConnection; /* Connection to watch for unlock */ - void *pUnlockArg; /* Argument to xUnlockNotify */ - void (*xUnlockNotify)(void **, int); /* Unlock notify callback */ - sqlite3 *pNextBlocked; /* Next in list of all blocked connections */ -#endif -}; - -/* -** A macro to discover the encoding of a database. -*/ -#define ENC(db) ((db)->aDb[0].pSchema->enc) - -/* -** Possible values for the sqlite3.flags. -*/ -#define SQLITE_VdbeTrace 0x00000001 /* True to trace VDBE execution */ -#define SQLITE_InternChanges 0x00000002 /* Uncommitted Hash table changes */ -#define SQLITE_FullFSync 0x00000004 /* Use full fsync on the backend */ -#define SQLITE_CkptFullFSync 0x00000008 /* Use full fsync for checkpoint */ -#define SQLITE_CacheSpill 0x00000010 /* OK to spill pager cache */ -#define SQLITE_FullColNames 0x00000020 /* Show full column names on SELECT */ -#define SQLITE_ShortColNames 0x00000040 /* Show short columns names */ -#define SQLITE_CountRows 0x00000080 /* Count rows changed by INSERT, */ - /* DELETE, or UPDATE and return */ - /* the count using a callback. */ -#define SQLITE_NullCallback 0x00000100 /* Invoke the callback once if the */ - /* result set is empty */ -#define SQLITE_SqlTrace 0x00000200 /* Debug print SQL as it executes */ -#define SQLITE_VdbeListing 0x00000400 /* Debug listings of VDBE programs */ -#define SQLITE_WriteSchema 0x00000800 /* OK to update SQLITE_MASTER */ -#define SQLITE_VdbeAddopTrace 0x00001000 /* Trace sqlite3VdbeAddOp() calls */ -#define SQLITE_IgnoreChecks 0x00002000 /* Do not enforce check constraints */ -#define SQLITE_ReadUncommitted 0x0004000 /* For shared-cache mode */ -#define SQLITE_LegacyFileFmt 0x00008000 /* Create new databases in format 1 */ -#define SQLITE_RecoveryMode 0x00010000 /* Ignore schema errors */ -#define SQLITE_ReverseOrder 0x00020000 /* Reverse unordered SELECTs */ -#define SQLITE_RecTriggers 0x00040000 /* Enable recursive triggers */ -#define SQLITE_ForeignKeys 0x00080000 /* Enforce foreign key constraints */ -#define SQLITE_AutoIndex 0x00100000 /* Enable automatic indexes */ -#define SQLITE_PreferBuiltin 0x00200000 /* Preference to built-in funcs */ -#define SQLITE_LoadExtension 0x00400000 /* Enable load_extension */ -#define SQLITE_EnableTrigger 0x00800000 /* True to enable triggers */ -#define SQLITE_DeferFKs 0x01000000 /* Defer all FK constraints */ -#define SQLITE_QueryOnly 0x02000000 /* Disable database changes */ -#define SQLITE_VdbeEQP 0x04000000 /* Debug EXPLAIN QUERY PLAN */ - - -/* -** Bits of the sqlite3.dbOptFlags field that are used by the -** sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS,...) interface to -** selectively disable various optimizations. -*/ -#define SQLITE_QueryFlattener 0x0001 /* Query flattening */ -#define SQLITE_ColumnCache 0x0002 /* Column cache */ -#define SQLITE_GroupByOrder 0x0004 /* GROUPBY cover of ORDERBY */ -#define SQLITE_FactorOutConst 0x0008 /* Constant factoring */ -/* not used 0x0010 // Was: SQLITE_IdxRealAsInt */ -#define SQLITE_DistinctOpt 0x0020 /* DISTINCT using indexes */ -#define SQLITE_CoverIdxScan 0x0040 /* Covering index scans */ -#define SQLITE_OrderByIdxJoin 0x0080 /* ORDER BY of joins via index */ -#define SQLITE_SubqCoroutine 0x0100 /* Evaluate subqueries as coroutines */ -#define SQLITE_Transitive 0x0200 /* Transitive constraints */ -#define SQLITE_OmitNoopJoin 0x0400 /* Omit unused tables in joins */ -#define SQLITE_Stat3 0x0800 /* Use the SQLITE_STAT3 table */ -#define SQLITE_AdjustOutEst 0x1000 /* Adjust output estimates using WHERE */ -#define SQLITE_AllOpts 0xffff /* All optimizations */ - -/* -** Macros for testing whether or not optimizations are enabled or disabled. -*/ -#ifndef SQLITE_OMIT_BUILTIN_TEST -#define OptimizationDisabled(db, mask) (((db)->dbOptFlags&(mask))!=0) -#define OptimizationEnabled(db, mask) (((db)->dbOptFlags&(mask))==0) -#else -#define OptimizationDisabled(db, mask) 0 -#define OptimizationEnabled(db, mask) 1 -#endif - -/* -** Return true if it OK to factor constant expressions into the initialization -** code. The argument is a Parse object for the code generator. -*/ -#define ConstFactorOk(P) \ - ((P)->cookieGoto>0 && OptimizationEnabled((P)->db,SQLITE_FactorOutConst)) - -/* -** Possible values for the sqlite.magic field. -** The numbers are obtained at random and have no special meaning, other -** than being distinct from one another. -*/ -#define SQLITE_MAGIC_OPEN 0xa029a697 /* Database is open */ -#define SQLITE_MAGIC_CLOSED 0x9f3c2d33 /* Database is closed */ -#define SQLITE_MAGIC_SICK 0x4b771290 /* Error and awaiting close */ -#define SQLITE_MAGIC_BUSY 0xf03b7906 /* Database currently in use */ -#define SQLITE_MAGIC_ERROR 0xb5357930 /* An SQLITE_MISUSE error occurred */ -#define SQLITE_MAGIC_ZOMBIE 0x64cffc7f /* Close with last statement close */ - -/* -** Each SQL function is defined by an instance of the following -** structure. A pointer to this structure is stored in the sqlite.aFunc -** hash table. When multiple functions have the same name, the hash table -** points to a linked list of these structures. -*/ -struct FuncDef { - i16 nArg; /* Number of arguments. -1 means unlimited */ - u16 funcFlags; /* Some combination of SQLITE_FUNC_* */ - void *pUserData; /* User data parameter */ - FuncDef *pNext; /* Next function with same name */ - void (*xFunc)(sqlite3_context*,int,sqlite3_value**); /* Regular function */ - void (*xStep)(sqlite3_context*,int,sqlite3_value**); /* Aggregate step */ - void (*xFinalize)(sqlite3_context*); /* Aggregate finalizer */ - char *zName; /* SQL name of the function. */ - FuncDef *pHash; /* Next with a different name but the same hash */ - FuncDestructor *pDestructor; /* Reference counted destructor function */ -}; - -/* -** This structure encapsulates a user-function destructor callback (as -** configured using create_function_v2()) and a reference counter. When -** create_function_v2() is called to create a function with a destructor, -** a single object of this type is allocated. FuncDestructor.nRef is set to -** the number of FuncDef objects created (either 1 or 3, depending on whether -** or not the specified encoding is SQLITE_ANY). The FuncDef.pDestructor -** member of each of the new FuncDef objects is set to point to the allocated -** FuncDestructor. -** -** Thereafter, when one of the FuncDef objects is deleted, the reference -** count on this object is decremented. When it reaches 0, the destructor -** is invoked and the FuncDestructor structure freed. -*/ -struct FuncDestructor { - int nRef; - void (*xDestroy)(void *); - void *pUserData; -}; - -/* -** Possible values for FuncDef.flags. Note that the _LENGTH and _TYPEOF -** values must correspond to OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG. There -** are assert() statements in the code to verify this. -*/ -#define SQLITE_FUNC_ENCMASK 0x003 /* SQLITE_UTF8, SQLITE_UTF16BE or UTF16LE */ -#define SQLITE_FUNC_LIKE 0x004 /* Candidate for the LIKE optimization */ -#define SQLITE_FUNC_CASE 0x008 /* Case-sensitive LIKE-type function */ -#define SQLITE_FUNC_EPHEM 0x010 /* Ephemeral. Delete with VDBE */ -#define SQLITE_FUNC_NEEDCOLL 0x020 /* sqlite3GetFuncCollSeq() might be called */ -#define SQLITE_FUNC_LENGTH 0x040 /* Built-in length() function */ -#define SQLITE_FUNC_TYPEOF 0x080 /* Built-in typeof() function */ -#define SQLITE_FUNC_COUNT 0x100 /* Built-in count(*) aggregate */ -#define SQLITE_FUNC_COALESCE 0x200 /* Built-in coalesce() or ifnull() */ -#define SQLITE_FUNC_UNLIKELY 0x400 /* Built-in unlikely() function */ -#define SQLITE_FUNC_CONSTANT 0x800 /* Constant inputs give a constant output */ - -/* -** The following three macros, FUNCTION(), LIKEFUNC() and AGGREGATE() are -** used to create the initializers for the FuncDef structures. -** -** FUNCTION(zName, nArg, iArg, bNC, xFunc) -** Used to create a scalar function definition of a function zName -** implemented by C function xFunc that accepts nArg arguments. The -** value passed as iArg is cast to a (void*) and made available -** as the user-data (sqlite3_user_data()) for the function. If -** argument bNC is true, then the SQLITE_FUNC_NEEDCOLL flag is set. -** -** VFUNCTION(zName, nArg, iArg, bNC, xFunc) -** Like FUNCTION except it omits the SQLITE_FUNC_CONSTANT flag. -** -** AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) -** Used to create an aggregate function definition implemented by -** the C functions xStep and xFinal. The first four parameters -** are interpreted in the same way as the first 4 parameters to -** FUNCTION(). -** -** LIKEFUNC(zName, nArg, pArg, flags) -** Used to create a scalar function definition of a function zName -** that accepts nArg arguments and is implemented by a call to C -** function likeFunc. Argument pArg is cast to a (void *) and made -** available as the function user-data (sqlite3_user_data()). The -** FuncDef.flags variable is set to the value passed as the flags -** parameter. -*/ -#define FUNCTION(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ - SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0} -#define VFUNCTION(zName, nArg, iArg, bNC, xFunc) \ - {nArg, SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ - SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0} -#define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags) \ - {nArg,SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL)|extraFlags,\ - SQLITE_INT_TO_PTR(iArg), 0, xFunc, 0, 0, #zName, 0, 0} -#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ - {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|(bNC*SQLITE_FUNC_NEEDCOLL), \ - pArg, 0, xFunc, 0, 0, #zName, 0, 0} -#define LIKEFUNC(zName, nArg, arg, flags) \ - {nArg, SQLITE_FUNC_CONSTANT|SQLITE_UTF8|flags, \ - (void *)arg, 0, likeFunc, 0, 0, #zName, 0, 0} -#define AGGREGATE(zName, nArg, arg, nc, xStep, xFinal) \ - {nArg, SQLITE_UTF8|(nc*SQLITE_FUNC_NEEDCOLL), \ - SQLITE_INT_TO_PTR(arg), 0, 0, xStep,xFinal,#zName,0,0} - -/* -** All current savepoints are stored in a linked list starting at -** sqlite3.pSavepoint. The first element in the list is the most recently -** opened savepoint. Savepoints are added to the list by the vdbe -** OP_Savepoint instruction. -*/ -struct Savepoint { - char *zName; /* Savepoint name (nul-terminated) */ - i64 nDeferredCons; /* Number of deferred fk violations */ - i64 nDeferredImmCons; /* Number of deferred imm fk. */ - Savepoint *pNext; /* Parent savepoint (if any) */ -}; - -/* -** The following are used as the second parameter to sqlite3Savepoint(), -** and as the P1 argument to the OP_Savepoint instruction. -*/ -#define SAVEPOINT_BEGIN 0 -#define SAVEPOINT_RELEASE 1 -#define SAVEPOINT_ROLLBACK 2 - - -/* -** Each SQLite module (virtual table definition) is defined by an -** instance of the following structure, stored in the sqlite3.aModule -** hash table. -*/ -struct Module { - const sqlite3_module *pModule; /* Callback pointers */ - const char *zName; /* Name passed to create_module() */ - void *pAux; /* pAux passed to create_module() */ - void (*xDestroy)(void *); /* Module destructor function */ -}; - -/* -** information about each column of an SQL table is held in an instance -** of this structure. -*/ -struct Column { - char *zName; /* Name of this column */ - Expr *pDflt; /* Default value of this column */ - char *zDflt; /* Original text of the default value */ - char *zType; /* Data type for this column */ - char *zColl; /* Collating sequence. If NULL, use the default */ - u8 notNull; /* An OE_ code for handling a NOT NULL constraint */ - char affinity; /* One of the SQLITE_AFF_... values */ - u8 szEst; /* Estimated size of this column. INT==1 */ - u8 colFlags; /* Boolean properties. See COLFLAG_ defines below */ -}; - -/* Allowed values for Column.colFlags: -*/ -#define COLFLAG_PRIMKEY 0x0001 /* Column is part of the primary key */ -#define COLFLAG_HIDDEN 0x0002 /* A hidden column in a virtual table */ - -/* -** A "Collating Sequence" is defined by an instance of the following -** structure. Conceptually, a collating sequence consists of a name and -** a comparison routine that defines the order of that sequence. -** -** If CollSeq.xCmp is NULL, it means that the -** collating sequence is undefined. Indices built on an undefined -** collating sequence may not be read or written. -*/ -struct CollSeq { - char *zName; /* Name of the collating sequence, UTF-8 encoded */ - u8 enc; /* Text encoding handled by xCmp() */ - void *pUser; /* First argument to xCmp() */ - int (*xCmp)(void*,int, const void*, int, const void*); - void (*xDel)(void*); /* Destructor for pUser */ -}; - -/* -** A sort order can be either ASC or DESC. -*/ -#define SQLITE_SO_ASC 0 /* Sort in ascending order */ -#define SQLITE_SO_DESC 1 /* Sort in ascending order */ - -/* -** Column affinity types. -** -** These used to have mnemonic name like 'i' for SQLITE_AFF_INTEGER and -** 't' for SQLITE_AFF_TEXT. But we can save a little space and improve -** the speed a little by numbering the values consecutively. -** -** But rather than start with 0 or 1, we begin with 'a'. That way, -** when multiple affinity types are concatenated into a string and -** used as the P4 operand, they will be more readable. -** -** Note also that the numeric types are grouped together so that testing -** for a numeric type is a single comparison. -*/ -#define SQLITE_AFF_TEXT 'a' -#define SQLITE_AFF_NONE 'b' -#define SQLITE_AFF_NUMERIC 'c' -#define SQLITE_AFF_INTEGER 'd' -#define SQLITE_AFF_REAL 'e' - -#define sqlite3IsNumericAffinity(X) ((X)>=SQLITE_AFF_NUMERIC) - -/* -** The SQLITE_AFF_MASK values masks off the significant bits of an -** affinity value. -*/ -#define SQLITE_AFF_MASK 0x67 - -/* -** Additional bit values that can be ORed with an affinity without -** changing the affinity. -*/ -#define SQLITE_JUMPIFNULL 0x08 /* jumps if either operand is NULL */ -#define SQLITE_STOREP2 0x10 /* Store result in reg[P2] rather than jump */ -#define SQLITE_NULLEQ 0x80 /* NULL=NULL */ - -/* -** An object of this type is created for each virtual table present in -** the database schema. -** -** If the database schema is shared, then there is one instance of this -** structure for each database connection (sqlite3*) that uses the shared -** schema. This is because each database connection requires its own unique -** instance of the sqlite3_vtab* handle used to access the virtual table -** implementation. sqlite3_vtab* handles can not be shared between -** database connections, even when the rest of the in-memory database -** schema is shared, as the implementation often stores the database -** connection handle passed to it via the xConnect() or xCreate() method -** during initialization internally. This database connection handle may -** then be used by the virtual table implementation to access real tables -** within the database. So that they appear as part of the callers -** transaction, these accesses need to be made via the same database -** connection as that used to execute SQL operations on the virtual table. -** -** All VTable objects that correspond to a single table in a shared -** database schema are initially stored in a linked-list pointed to by -** the Table.pVTable member variable of the corresponding Table object. -** When an sqlite3_prepare() operation is required to access the virtual -** table, it searches the list for the VTable that corresponds to the -** database connection doing the preparing so as to use the correct -** sqlite3_vtab* handle in the compiled query. -** -** When an in-memory Table object is deleted (for example when the -** schema is being reloaded for some reason), the VTable objects are not -** deleted and the sqlite3_vtab* handles are not xDisconnect()ed -** immediately. Instead, they are moved from the Table.pVTable list to -** another linked list headed by the sqlite3.pDisconnect member of the -** corresponding sqlite3 structure. They are then deleted/xDisconnected -** next time a statement is prepared using said sqlite3*. This is done -** to avoid deadlock issues involving multiple sqlite3.mutex mutexes. -** Refer to comments above function sqlite3VtabUnlockList() for an -** explanation as to why it is safe to add an entry to an sqlite3.pDisconnect -** list without holding the corresponding sqlite3.mutex mutex. -** -** The memory for objects of this type is always allocated by -** sqlite3DbMalloc(), using the connection handle stored in VTable.db as -** the first argument. -*/ -struct VTable { - sqlite3 *db; /* Database connection associated with this table */ - Module *pMod; /* Pointer to module implementation */ - sqlite3_vtab *pVtab; /* Pointer to vtab instance */ - int nRef; /* Number of pointers to this structure */ - u8 bConstraint; /* True if constraints are supported */ - int iSavepoint; /* Depth of the SAVEPOINT stack */ - VTable *pNext; /* Next in linked list (see above) */ -}; - -/* -** Each SQL table is represented in memory by an instance of the -** following structure. -** -** Table.zName is the name of the table. The case of the original -** CREATE TABLE statement is stored, but case is not significant for -** comparisons. -** -** Table.nCol is the number of columns in this table. Table.aCol is a -** pointer to an array of Column structures, one for each column. -** -** If the table has an INTEGER PRIMARY KEY, then Table.iPKey is the index of -** the column that is that key. Otherwise Table.iPKey is negative. Note -** that the datatype of the PRIMARY KEY must be INTEGER for this field to -** be set. An INTEGER PRIMARY KEY is used as the rowid for each row of -** the table. If a table has no INTEGER PRIMARY KEY, then a random rowid -** is generated for each row of the table. TF_HasPrimaryKey is set if -** the table has any PRIMARY KEY, INTEGER or otherwise. -** -** Table.tnum is the page number for the root BTree page of the table in the -** database file. If Table.iDb is the index of the database table backend -** in sqlite.aDb[]. 0 is for the main database and 1 is for the file that -** holds temporary tables and indices. If TF_Ephemeral is set -** then the table is stored in a file that is automatically deleted -** when the VDBE cursor to the table is closed. In this case Table.tnum -** refers VDBE cursor number that holds the table open, not to the root -** page number. Transient tables are used to hold the results of a -** sub-query that appears instead of a real table name in the FROM clause -** of a SELECT statement. -*/ -struct Table { - char *zName; /* Name of the table or view */ - Column *aCol; /* Information about each column */ - Index *pIndex; /* List of SQL indexes on this table. */ - Select *pSelect; /* NULL for tables. Points to definition if a view. */ - FKey *pFKey; /* Linked list of all foreign keys in this table */ - char *zColAff; /* String defining the affinity of each column */ -#ifndef SQLITE_OMIT_CHECK - ExprList *pCheck; /* All CHECK constraints */ -#endif - tRowcnt nRowEst; /* Estimated rows in table - from sqlite_stat1 table */ - int tnum; /* Root BTree node for this table (see note above) */ - i16 iPKey; /* If not negative, use aCol[iPKey] as the primary key */ - i16 nCol; /* Number of columns in this table */ - u16 nRef; /* Number of pointers to this Table */ - LogEst szTabRow; /* Estimated size of each table row in bytes */ - u8 tabFlags; /* Mask of TF_* values */ - u8 keyConf; /* What to do in case of uniqueness conflict on iPKey */ -#ifndef SQLITE_OMIT_ALTERTABLE - int addColOffset; /* Offset in CREATE TABLE stmt to add a new column */ -#endif -#ifndef SQLITE_OMIT_VIRTUALTABLE - int nModuleArg; /* Number of arguments to the module */ - char **azModuleArg; /* Text of all module args. [0] is module name */ - VTable *pVTable; /* List of VTable objects. */ -#endif - Trigger *pTrigger; /* List of triggers stored in pSchema */ - Schema *pSchema; /* Schema that contains this table */ - Table *pNextZombie; /* Next on the Parse.pZombieTab list */ -}; - -/* -** Allowed values for Table.tabFlags. -*/ -#define TF_Readonly 0x01 /* Read-only system table */ -#define TF_Ephemeral 0x02 /* An ephemeral table */ -#define TF_HasPrimaryKey 0x04 /* Table has a primary key */ -#define TF_Autoincrement 0x08 /* Integer primary key is autoincrement */ -#define TF_Virtual 0x10 /* Is a virtual table */ -#define TF_WithoutRowid 0x20 /* No rowid used. PRIMARY KEY is the key */ - - -/* -** Test to see whether or not a table is a virtual table. This is -** done as a macro so that it will be optimized out when virtual -** table support is omitted from the build. -*/ -#ifndef SQLITE_OMIT_VIRTUALTABLE -# define IsVirtual(X) (((X)->tabFlags & TF_Virtual)!=0) -# define IsHiddenColumn(X) (((X)->colFlags & COLFLAG_HIDDEN)!=0) -#else -# define IsVirtual(X) 0 -# define IsHiddenColumn(X) 0 -#endif - -/* Does the table have a rowid */ -#define HasRowid(X) (((X)->tabFlags & TF_WithoutRowid)==0) - -/* -** Each foreign key constraint is an instance of the following structure. -** -** A foreign key is associated with two tables. The "from" table is -** the table that contains the REFERENCES clause that creates the foreign -** key. The "to" table is the table that is named in the REFERENCES clause. -** Consider this example: -** -** CREATE TABLE ex1( -** a INTEGER PRIMARY KEY, -** b INTEGER CONSTRAINT fk1 REFERENCES ex2(x) -** ); -** -** For foreign key "fk1", the from-table is "ex1" and the to-table is "ex2". -** Equivalent names: -** -** from-table == child-table -** to-table == parent-table -** -** Each REFERENCES clause generates an instance of the following structure -** which is attached to the from-table. The to-table need not exist when -** the from-table is created. The existence of the to-table is not checked. -** -** The list of all parents for child Table X is held at X.pFKey. -** -** A list of all children for a table named Z (which might not even exist) -** is held in Schema.fkeyHash with a hash key of Z. -*/ -struct FKey { - Table *pFrom; /* Table containing the REFERENCES clause (aka: Child) */ - FKey *pNextFrom; /* Next FKey with the same in pFrom. Next parent of pFrom */ - char *zTo; /* Name of table that the key points to (aka: Parent) */ - FKey *pNextTo; /* Next with the same zTo. Next child of zTo. */ - FKey *pPrevTo; /* Previous with the same zTo */ - int nCol; /* Number of columns in this key */ - /* EV: R-30323-21917 */ - u8 isDeferred; /* True if constraint checking is deferred till COMMIT */ - u8 aAction[2]; /* ON DELETE and ON UPDATE actions, respectively */ - Trigger *apTrigger[2];/* Triggers for aAction[] actions */ - struct sColMap { /* Mapping of columns in pFrom to columns in zTo */ - int iFrom; /* Index of column in pFrom */ - char *zCol; /* Name of column in zTo. If NULL use PRIMARY KEY */ - } aCol[1]; /* One entry for each of nCol columns */ -}; - -/* -** SQLite supports many different ways to resolve a constraint -** error. ROLLBACK processing means that a constraint violation -** causes the operation in process to fail and for the current transaction -** to be rolled back. ABORT processing means the operation in process -** fails and any prior changes from that one operation are backed out, -** but the transaction is not rolled back. FAIL processing means that -** the operation in progress stops and returns an error code. But prior -** changes due to the same operation are not backed out and no rollback -** occurs. IGNORE means that the particular row that caused the constraint -** error is not inserted or updated. Processing continues and no error -** is returned. REPLACE means that preexisting database rows that caused -** a UNIQUE constraint violation are removed so that the new insert or -** update can proceed. Processing continues and no error is reported. -** -** RESTRICT, SETNULL, and CASCADE actions apply only to foreign keys. -** RESTRICT is the same as ABORT for IMMEDIATE foreign keys and the -** same as ROLLBACK for DEFERRED keys. SETNULL means that the foreign -** key is set to NULL. CASCADE means that a DELETE or UPDATE of the -** referenced table row is propagated into the row that holds the -** foreign key. -** -** The following symbolic values are used to record which type -** of action to take. -*/ -#define OE_None 0 /* There is no constraint to check */ -#define OE_Rollback 1 /* Fail the operation and rollback the transaction */ -#define OE_Abort 2 /* Back out changes but do no rollback transaction */ -#define OE_Fail 3 /* Stop the operation but leave all prior changes */ -#define OE_Ignore 4 /* Ignore the error. Do not do the INSERT or UPDATE */ -#define OE_Replace 5 /* Delete existing record, then do INSERT or UPDATE */ - -#define OE_Restrict 6 /* OE_Abort for IMMEDIATE, OE_Rollback for DEFERRED */ -#define OE_SetNull 7 /* Set the foreign key value to NULL */ -#define OE_SetDflt 8 /* Set the foreign key value to its default */ -#define OE_Cascade 9 /* Cascade the changes */ - -#define OE_Default 10 /* Do whatever the default action is */ - - -/* -** An instance of the following structure is passed as the first -** argument to sqlite3VdbeKeyCompare and is used to control the -** comparison of the two index keys. -** -** Note that aSortOrder[] and aColl[] have nField+1 slots. There -** are nField slots for the columns of an index then one extra slot -** for the rowid at the end. -*/ -struct KeyInfo { - u32 nRef; /* Number of references to this KeyInfo object */ - u8 enc; /* Text encoding - one of the SQLITE_UTF* values */ - u16 nField; /* Number of key columns in the index */ - u16 nXField; /* Number of columns beyond the key columns */ - sqlite3 *db; /* The database connection */ - u8 *aSortOrder; /* Sort order for each column. */ - CollSeq *aColl[1]; /* Collating sequence for each term of the key */ -}; - -/* -** An instance of the following structure holds information about a -** single index record that has already been parsed out into individual -** values. -** -** A record is an object that contains one or more fields of data. -** Records are used to store the content of a table row and to store -** the key of an index. A blob encoding of a record is created by -** the OP_MakeRecord opcode of the VDBE and is disassembled by the -** OP_Column opcode. -** -** This structure holds a record that has already been disassembled -** into its constituent fields. -*/ -struct UnpackedRecord { - KeyInfo *pKeyInfo; /* Collation and sort-order information */ - u16 nField; /* Number of entries in apMem[] */ - u8 flags; /* Boolean settings. UNPACKED_... below */ - Mem *aMem; /* Values */ -}; - -/* -** Allowed values of UnpackedRecord.flags -*/ -#define UNPACKED_INCRKEY 0x01 /* Make this key an epsilon larger */ -#define UNPACKED_PREFIX_MATCH 0x02 /* A prefix match is considered OK */ - -/* -** Each SQL index is represented in memory by an -** instance of the following structure. -** -** The columns of the table that are to be indexed are described -** by the aiColumn[] field of this structure. For example, suppose -** we have the following table and index: -** -** CREATE TABLE Ex1(c1 int, c2 int, c3 text); -** CREATE INDEX Ex2 ON Ex1(c3,c1); -** -** In the Table structure describing Ex1, nCol==3 because there are -** three columns in the table. In the Index structure describing -** Ex2, nColumn==2 since 2 of the 3 columns of Ex1 are indexed. -** The value of aiColumn is {2, 0}. aiColumn[0]==2 because the -** first column to be indexed (c3) has an index of 2 in Ex1.aCol[]. -** The second column to be indexed (c1) has an index of 0 in -** Ex1.aCol[], hence Ex2.aiColumn[1]==0. -** -** The Index.onError field determines whether or not the indexed columns -** must be unique and what to do if they are not. When Index.onError=OE_None, -** it means this is not a unique index. Otherwise it is a unique index -** and the value of Index.onError indicate the which conflict resolution -** algorithm to employ whenever an attempt is made to insert a non-unique -** element. -*/ -struct Index { - char *zName; /* Name of this index */ - i16 *aiColumn; /* Which columns are used by this index. 1st is 0 */ - tRowcnt *aiRowEst; /* From ANALYZE: Est. rows selected by each column */ - Table *pTable; /* The SQL table being indexed */ - char *zColAff; /* String defining the affinity of each column */ - Index *pNext; /* The next index associated with the same table */ - Schema *pSchema; /* Schema containing this index */ - u8 *aSortOrder; /* for each column: True==DESC, False==ASC */ - char **azColl; /* Array of collation sequence names for index */ - Expr *pPartIdxWhere; /* WHERE clause for partial indices */ - KeyInfo *pKeyInfo; /* A KeyInfo object suitable for this index */ - int tnum; /* DB Page containing root of this index */ - LogEst szIdxRow; /* Estimated average row size in bytes */ - u16 nKeyCol; /* Number of columns forming the key */ - u16 nColumn; /* Number of columns stored in the index */ - u8 onError; /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ - unsigned autoIndex:2; /* 1==UNIQUE, 2==PRIMARY KEY, 0==CREATE INDEX */ - unsigned bUnordered:1; /* Use this index for == or IN queries only */ - unsigned uniqNotNull:1; /* True if UNIQUE and NOT NULL for all columns */ - unsigned isResized:1; /* True if resizeIndexObject() has been called */ - unsigned isCovering:1; /* True if this is a covering index */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - int nSample; /* Number of elements in aSample[] */ - int nSampleCol; /* Size of IndexSample.anEq[] and so on */ - tRowcnt *aAvgEq; /* Average nEq values for keys not in aSample */ - IndexSample *aSample; /* Samples of the left-most key */ -#endif -}; - -/* -** Each sample stored in the sqlite_stat3 table is represented in memory -** using a structure of this type. See documentation at the top of the -** analyze.c source file for additional information. -*/ -struct IndexSample { - void *p; /* Pointer to sampled record */ - int n; /* Size of record in bytes */ - tRowcnt *anEq; /* Est. number of rows where the key equals this sample */ - tRowcnt *anLt; /* Est. number of rows where key is less than this sample */ - tRowcnt *anDLt; /* Est. number of distinct keys less than this sample */ -}; - -/* -** Each token coming out of the lexer is an instance of -** this structure. Tokens are also used as part of an expression. -** -** Note if Token.z==0 then Token.dyn and Token.n are undefined and -** may contain random values. Do not make any assumptions about Token.dyn -** and Token.n when Token.z==0. -*/ -struct Token { - const char *z; /* Text of the token. Not NULL-terminated! */ - unsigned int n; /* Number of characters in this token */ -}; - -/* -** An instance of this structure contains information needed to generate -** code for a SELECT that contains aggregate functions. -** -** If Expr.op==TK_AGG_COLUMN or TK_AGG_FUNCTION then Expr.pAggInfo is a -** pointer to this structure. The Expr.iColumn field is the index in -** AggInfo.aCol[] or AggInfo.aFunc[] of information needed to generate -** code for that node. -** -** AggInfo.pGroupBy and AggInfo.aFunc.pExpr point to fields within the -** original Select structure that describes the SELECT statement. These -** fields do not need to be freed when deallocating the AggInfo structure. -*/ -struct AggInfo { - u8 directMode; /* Direct rendering mode means take data directly - ** from source tables rather than from accumulators */ - u8 useSortingIdx; /* In direct mode, reference the sorting index rather - ** than the source table */ - int sortingIdx; /* Cursor number of the sorting index */ - int sortingIdxPTab; /* Cursor number of pseudo-table */ - int nSortingColumn; /* Number of columns in the sorting index */ - int mnReg, mxReg; /* Range of registers allocated for aCol and aFunc */ - ExprList *pGroupBy; /* The group by clause */ - struct AggInfo_col { /* For each column used in source tables */ - Table *pTab; /* Source table */ - int iTable; /* Cursor number of the source table */ - int iColumn; /* Column number within the source table */ - int iSorterColumn; /* Column number in the sorting index */ - int iMem; /* Memory location that acts as accumulator */ - Expr *pExpr; /* The original expression */ - } *aCol; - int nColumn; /* Number of used entries in aCol[] */ - int nAccumulator; /* Number of columns that show through to the output. - ** Additional columns are used only as parameters to - ** aggregate functions */ - struct AggInfo_func { /* For each aggregate function */ - Expr *pExpr; /* Expression encoding the function */ - FuncDef *pFunc; /* The aggregate function implementation */ - int iMem; /* Memory location that acts as accumulator */ - int iDistinct; /* Ephemeral table used to enforce DISTINCT */ - } *aFunc; - int nFunc; /* Number of entries in aFunc[] */ -}; - -/* -** The datatype ynVar is a signed integer, either 16-bit or 32-bit. -** Usually it is 16-bits. But if SQLITE_MAX_VARIABLE_NUMBER is greater -** than 32767 we have to make it 32-bit. 16-bit is preferred because -** it uses less memory in the Expr object, which is a big memory user -** in systems with lots of prepared statements. And few applications -** need more than about 10 or 20 variables. But some extreme users want -** to have prepared statements with over 32767 variables, and for them -** the option is available (at compile-time). -*/ -#if SQLITE_MAX_VARIABLE_NUMBER<=32767 -typedef i16 ynVar; -#else -typedef int ynVar; -#endif - -/* -** Each node of an expression in the parse tree is an instance -** of this structure. -** -** Expr.op is the opcode. The integer parser token codes are reused -** as opcodes here. For example, the parser defines TK_GE to be an integer -** code representing the ">=" operator. This same integer code is reused -** to represent the greater-than-or-equal-to operator in the expression -** tree. -** -** If the expression is an SQL literal (TK_INTEGER, TK_FLOAT, TK_BLOB, -** or TK_STRING), then Expr.token contains the text of the SQL literal. If -** the expression is a variable (TK_VARIABLE), then Expr.token contains the -** variable name. Finally, if the expression is an SQL function (TK_FUNCTION), -** then Expr.token contains the name of the function. -** -** Expr.pRight and Expr.pLeft are the left and right subexpressions of a -** binary operator. Either or both may be NULL. -** -** Expr.x.pList is a list of arguments if the expression is an SQL function, -** a CASE expression or an IN expression of the form " IN (, ...)". -** Expr.x.pSelect is used if the expression is a sub-select or an expression of -** the form " IN (SELECT ...)". If the EP_xIsSelect bit is set in the -** Expr.flags mask, then Expr.x.pSelect is valid. Otherwise, Expr.x.pList is -** valid. -** -** An expression of the form ID or ID.ID refers to a column in a table. -** For such expressions, Expr.op is set to TK_COLUMN and Expr.iTable is -** the integer cursor number of a VDBE cursor pointing to that table and -** Expr.iColumn is the column number for the specific column. If the -** expression is used as a result in an aggregate SELECT, then the -** value is also stored in the Expr.iAgg column in the aggregate so that -** it can be accessed after all aggregates are computed. -** -** If the expression is an unbound variable marker (a question mark -** character '?' in the original SQL) then the Expr.iTable holds the index -** number for that variable. -** -** If the expression is a subquery then Expr.iColumn holds an integer -** register number containing the result of the subquery. If the -** subquery gives a constant result, then iTable is -1. If the subquery -** gives a different answer at different times during statement processing -** then iTable is the address of a subroutine that computes the subquery. -** -** If the Expr is of type OP_Column, and the table it is selecting from -** is a disk table or the "old.*" pseudo-table, then pTab points to the -** corresponding table definition. -** -** ALLOCATION NOTES: -** -** Expr objects can use a lot of memory space in database schema. To -** help reduce memory requirements, sometimes an Expr object will be -** truncated. And to reduce the number of memory allocations, sometimes -** two or more Expr objects will be stored in a single memory allocation, -** together with Expr.zToken strings. -** -** If the EP_Reduced and EP_TokenOnly flags are set when -** an Expr object is truncated. When EP_Reduced is set, then all -** the child Expr objects in the Expr.pLeft and Expr.pRight subtrees -** are contained within the same memory allocation. Note, however, that -** the subtrees in Expr.x.pList or Expr.x.pSelect are always separately -** allocated, regardless of whether or not EP_Reduced is set. -*/ -struct Expr { - u8 op; /* Operation performed by this node */ - char affinity; /* The affinity of the column or 0 if not a column */ - u32 flags; /* Various flags. EP_* See below */ - union { - char *zToken; /* Token value. Zero terminated and dequoted */ - int iValue; /* Non-negative integer value if EP_IntValue */ - } u; - - /* If the EP_TokenOnly flag is set in the Expr.flags mask, then no - ** space is allocated for the fields below this point. An attempt to - ** access them will result in a segfault or malfunction. - *********************************************************************/ - - Expr *pLeft; /* Left subnode */ - Expr *pRight; /* Right subnode */ - union { - ExprList *pList; /* op = IN, EXISTS, SELECT, CASE, FUNCTION, BETWEEN */ - Select *pSelect; /* EP_xIsSelect and op = IN, EXISTS, SELECT */ - } x; - - /* If the EP_Reduced flag is set in the Expr.flags mask, then no - ** space is allocated for the fields below this point. An attempt to - ** access them will result in a segfault or malfunction. - *********************************************************************/ - -#if SQLITE_MAX_EXPR_DEPTH>0 - int nHeight; /* Height of the tree headed by this node */ -#endif - int iTable; /* TK_COLUMN: cursor number of table holding column - ** TK_REGISTER: register number - ** TK_TRIGGER: 1 -> new, 0 -> old - ** EP_Unlikely: 1000 times likelihood */ - ynVar iColumn; /* TK_COLUMN: column index. -1 for rowid. - ** TK_VARIABLE: variable number (always >= 1). */ - i16 iAgg; /* Which entry in pAggInfo->aCol[] or ->aFunc[] */ - i16 iRightJoinTable; /* If EP_FromJoin, the right table of the join */ - u8 op2; /* TK_REGISTER: original value of Expr.op - ** TK_COLUMN: the value of p5 for OP_Column - ** TK_AGG_FUNCTION: nesting depth */ - AggInfo *pAggInfo; /* Used by TK_AGG_COLUMN and TK_AGG_FUNCTION */ - Table *pTab; /* Table for TK_COLUMN expressions. */ -}; - -/* -** The following are the meanings of bits in the Expr.flags field. -*/ -#define EP_FromJoin 0x000001 /* Originated in ON or USING clause of a join */ -#define EP_Agg 0x000002 /* Contains one or more aggregate functions */ -#define EP_Resolved 0x000004 /* IDs have been resolved to COLUMNs */ -#define EP_Error 0x000008 /* Expression contains one or more errors */ -#define EP_Distinct 0x000010 /* Aggregate function with DISTINCT keyword */ -#define EP_VarSelect 0x000020 /* pSelect is correlated, not constant */ -#define EP_DblQuoted 0x000040 /* token.z was originally in "..." */ -#define EP_InfixFunc 0x000080 /* True for an infix function: LIKE, GLOB, etc */ -#define EP_Collate 0x000100 /* Tree contains a TK_COLLATE opeartor */ - /* unused 0x000200 */ -#define EP_IntValue 0x000400 /* Integer value contained in u.iValue */ -#define EP_xIsSelect 0x000800 /* x.pSelect is valid (otherwise x.pList is) */ -#define EP_Skip 0x001000 /* COLLATE, AS, or UNLIKELY */ -#define EP_Reduced 0x002000 /* Expr struct EXPR_REDUCEDSIZE bytes only */ -#define EP_TokenOnly 0x004000 /* Expr struct EXPR_TOKENONLYSIZE bytes only */ -#define EP_Static 0x008000 /* Held in memory not obtained from malloc() */ -#define EP_MemToken 0x010000 /* Need to sqlite3DbFree() Expr.zToken */ -#define EP_NoReduce 0x020000 /* Cannot EXPRDUP_REDUCE this Expr */ -#define EP_Unlikely 0x040000 /* unlikely() or likelihood() function */ -#define EP_Constant 0x080000 /* Node is a constant */ - -/* -** These macros can be used to test, set, or clear bits in the -** Expr.flags field. -*/ -#define ExprHasProperty(E,P) (((E)->flags&(P))!=0) -#define ExprHasAllProperty(E,P) (((E)->flags&(P))==(P)) -#define ExprSetProperty(E,P) (E)->flags|=(P) -#define ExprClearProperty(E,P) (E)->flags&=~(P) - -/* The ExprSetVVAProperty() macro is used for Verification, Validation, -** and Accreditation only. It works like ExprSetProperty() during VVA -** processes but is a no-op for delivery. -*/ -#ifdef SQLITE_DEBUG -# define ExprSetVVAProperty(E,P) (E)->flags|=(P) -#else -# define ExprSetVVAProperty(E,P) -#endif - -/* -** Macros to determine the number of bytes required by a normal Expr -** struct, an Expr struct with the EP_Reduced flag set in Expr.flags -** and an Expr struct with the EP_TokenOnly flag set. -*/ -#define EXPR_FULLSIZE sizeof(Expr) /* Full size */ -#define EXPR_REDUCEDSIZE offsetof(Expr,iTable) /* Common features */ -#define EXPR_TOKENONLYSIZE offsetof(Expr,pLeft) /* Fewer features */ - -/* -** Flags passed to the sqlite3ExprDup() function. See the header comment -** above sqlite3ExprDup() for details. -*/ -#define EXPRDUP_REDUCE 0x0001 /* Used reduced-size Expr nodes */ - -/* -** A list of expressions. Each expression may optionally have a -** name. An expr/name combination can be used in several ways, such -** as the list of "expr AS ID" fields following a "SELECT" or in the -** list of "ID = expr" items in an UPDATE. A list of expressions can -** also be used as the argument to a function, in which case the a.zName -** field is not used. -** -** By default the Expr.zSpan field holds a human-readable description of -** the expression that is used in the generation of error messages and -** column labels. In this case, Expr.zSpan is typically the text of a -** column expression as it exists in a SELECT statement. However, if -** the bSpanIsTab flag is set, then zSpan is overloaded to mean the name -** of the result column in the form: DATABASE.TABLE.COLUMN. This later -** form is used for name resolution with nested FROM clauses. -*/ -struct ExprList { - int nExpr; /* Number of expressions on the list */ - int iECursor; /* VDBE Cursor associated with this ExprList */ - struct ExprList_item { /* For each expression in the list */ - Expr *pExpr; /* The list of expressions */ - char *zName; /* Token associated with this expression */ - char *zSpan; /* Original text of the expression */ - u8 sortOrder; /* 1 for DESC or 0 for ASC */ - unsigned done :1; /* A flag to indicate when processing is finished */ - unsigned bSpanIsTab :1; /* zSpan holds DB.TABLE.COLUMN */ - unsigned reusable :1; /* Constant expression is reusable */ - union { - struct { - u16 iOrderByCol; /* For ORDER BY, column number in result set */ - u16 iAlias; /* Index into Parse.aAlias[] for zName */ - } x; - int iConstExprReg; /* Register in which Expr value is cached */ - } u; - } *a; /* Alloc a power of two greater or equal to nExpr */ -}; - -/* -** An instance of this structure is used by the parser to record both -** the parse tree for an expression and the span of input text for an -** expression. -*/ -struct ExprSpan { - Expr *pExpr; /* The expression parse tree */ - const char *zStart; /* First character of input text */ - const char *zEnd; /* One character past the end of input text */ -}; - -/* -** An instance of this structure can hold a simple list of identifiers, -** such as the list "a,b,c" in the following statements: -** -** INSERT INTO t(a,b,c) VALUES ...; -** CREATE INDEX idx ON t(a,b,c); -** CREATE TRIGGER trig BEFORE UPDATE ON t(a,b,c) ...; -** -** The IdList.a.idx field is used when the IdList represents the list of -** column names after a table name in an INSERT statement. In the statement -** -** INSERT INTO t(a,b,c) ... -** -** If "a" is the k-th column of table "t", then IdList.a[0].idx==k. -*/ -struct IdList { - struct IdList_item { - char *zName; /* Name of the identifier */ - int idx; /* Index in some Table.aCol[] of a column named zName */ - } *a; - int nId; /* Number of identifiers on the list */ -}; - -/* -** The bitmask datatype defined below is used for various optimizations. -** -** Changing this from a 64-bit to a 32-bit type limits the number of -** tables in a join to 32 instead of 64. But it also reduces the size -** of the library by 738 bytes on ix86. -*/ -typedef u64 Bitmask; - -/* -** The number of bits in a Bitmask. "BMS" means "BitMask Size". -*/ -#define BMS ((int)(sizeof(Bitmask)*8)) - -/* -** A bit in a Bitmask -*/ -#define MASKBIT(n) (((Bitmask)1)<<(n)) -#define MASKBIT32(n) (((unsigned int)1)<<(n)) - -/* -** The following structure describes the FROM clause of a SELECT statement. -** Each table or subquery in the FROM clause is a separate element of -** the SrcList.a[] array. -** -** With the addition of multiple database support, the following structure -** can also be used to describe a particular table such as the table that -** is modified by an INSERT, DELETE, or UPDATE statement. In standard SQL, -** such a table must be a simple name: ID. But in SQLite, the table can -** now be identified by a database name, a dot, then the table name: ID.ID. -** -** The jointype starts out showing the join type between the current table -** and the next table on the list. The parser builds the list this way. -** But sqlite3SrcListShiftJoinType() later shifts the jointypes so that each -** jointype expresses the join between the table and the previous table. -** -** In the colUsed field, the high-order bit (bit 63) is set if the table -** contains more than 63 columns and the 64-th or later column is used. -*/ -struct SrcList { - u8 nSrc; /* Number of tables or subqueries in the FROM clause */ - u8 nAlloc; /* Number of entries allocated in a[] below */ - struct SrcList_item { - Schema *pSchema; /* Schema to which this item is fixed */ - char *zDatabase; /* Name of database holding this table */ - char *zName; /* Name of the table */ - char *zAlias; /* The "B" part of a "A AS B" phrase. zName is the "A" */ - Table *pTab; /* An SQL table corresponding to zName */ - Select *pSelect; /* A SELECT statement used in place of a table name */ - int addrFillSub; /* Address of subroutine to manifest a subquery */ - int regReturn; /* Register holding return address of addrFillSub */ - u8 jointype; /* Type of join between this able and the previous */ - unsigned notIndexed :1; /* True if there is a NOT INDEXED clause */ - unsigned isCorrelated :1; /* True if sub-query is correlated */ - unsigned viaCoroutine :1; /* Implemented as a co-routine */ - unsigned isRecursive :1; /* True for recursive reference in WITH */ -#ifndef SQLITE_OMIT_EXPLAIN - u8 iSelectId; /* If pSelect!=0, the id of the sub-select in EQP */ -#endif - int iCursor; /* The VDBE cursor number used to access this table */ - Expr *pOn; /* The ON clause of a join */ - IdList *pUsing; /* The USING clause of a join */ - Bitmask colUsed; /* Bit N (1<" clause */ - Index *pIndex; /* Index structure corresponding to zIndex, if any */ - } a[1]; /* One entry for each identifier on the list */ -}; - -/* -** Permitted values of the SrcList.a.jointype field -*/ -#define JT_INNER 0x0001 /* Any kind of inner or cross join */ -#define JT_CROSS 0x0002 /* Explicit use of the CROSS keyword */ -#define JT_NATURAL 0x0004 /* True for a "natural" join */ -#define JT_LEFT 0x0008 /* Left outer join */ -#define JT_RIGHT 0x0010 /* Right outer join */ -#define JT_OUTER 0x0020 /* The "OUTER" keyword is present */ -#define JT_ERROR 0x0040 /* unknown or unsupported join type */ - - -/* -** Flags appropriate for the wctrlFlags parameter of sqlite3WhereBegin() -** and the WhereInfo.wctrlFlags member. -*/ -#define WHERE_ORDERBY_NORMAL 0x0000 /* No-op */ -#define WHERE_ORDERBY_MIN 0x0001 /* ORDER BY processing for min() func */ -#define WHERE_ORDERBY_MAX 0x0002 /* ORDER BY processing for max() func */ -#define WHERE_ONEPASS_DESIRED 0x0004 /* Want to do one-pass UPDATE/DELETE */ -#define WHERE_DUPLICATES_OK 0x0008 /* Ok to return a row more than once */ -#define WHERE_OMIT_OPEN_CLOSE 0x0010 /* Table cursors are already open */ -#define WHERE_FORCE_TABLE 0x0020 /* Do not use an index-only search */ -#define WHERE_ONETABLE_ONLY 0x0040 /* Only code the 1st table in pTabList */ -#define WHERE_AND_ONLY 0x0080 /* Don't use indices for OR terms */ -#define WHERE_GROUPBY 0x0100 /* pOrderBy is really a GROUP BY */ -#define WHERE_DISTINCTBY 0x0200 /* pOrderby is really a DISTINCT clause */ -#define WHERE_WANT_DISTINCT 0x0400 /* All output needs to be distinct */ - -/* Allowed return values from sqlite3WhereIsDistinct() -*/ -#define WHERE_DISTINCT_NOOP 0 /* DISTINCT keyword not used */ -#define WHERE_DISTINCT_UNIQUE 1 /* No duplicates */ -#define WHERE_DISTINCT_ORDERED 2 /* All duplicates are adjacent */ -#define WHERE_DISTINCT_UNORDERED 3 /* Duplicates are scattered */ - -/* -** A NameContext defines a context in which to resolve table and column -** names. The context consists of a list of tables (the pSrcList) field and -** a list of named expression (pEList). The named expression list may -** be NULL. The pSrc corresponds to the FROM clause of a SELECT or -** to the table being operated on by INSERT, UPDATE, or DELETE. The -** pEList corresponds to the result set of a SELECT and is NULL for -** other statements. -** -** NameContexts can be nested. When resolving names, the inner-most -** context is searched first. If no match is found, the next outer -** context is checked. If there is still no match, the next context -** is checked. This process continues until either a match is found -** or all contexts are check. When a match is found, the nRef member of -** the context containing the match is incremented. -** -** Each subquery gets a new NameContext. The pNext field points to the -** NameContext in the parent query. Thus the process of scanning the -** NameContext list corresponds to searching through successively outer -** subqueries looking for a match. -*/ -struct NameContext { - Parse *pParse; /* The parser */ - SrcList *pSrcList; /* One or more tables used to resolve names */ - ExprList *pEList; /* Optional list of result-set columns */ - AggInfo *pAggInfo; /* Information about aggregates at this level */ - NameContext *pNext; /* Next outer name context. NULL for outermost */ - int nRef; /* Number of names resolved by this context */ - int nErr; /* Number of errors encountered while resolving names */ - u8 ncFlags; /* Zero or more NC_* flags defined below */ -}; - -/* -** Allowed values for the NameContext, ncFlags field. -*/ -#define NC_AllowAgg 0x01 /* Aggregate functions are allowed here */ -#define NC_HasAgg 0x02 /* One or more aggregate functions seen */ -#define NC_IsCheck 0x04 /* True if resolving names in a CHECK constraint */ -#define NC_InAggFunc 0x08 /* True if analyzing arguments to an agg func */ -#define NC_PartIdx 0x10 /* True if resolving a partial index WHERE */ - -/* -** An instance of the following structure contains all information -** needed to generate code for a single SELECT statement. -** -** nLimit is set to -1 if there is no LIMIT clause. nOffset is set to 0. -** If there is a LIMIT clause, the parser sets nLimit to the value of the -** limit and nOffset to the value of the offset (or 0 if there is not -** offset). But later on, nLimit and nOffset become the memory locations -** in the VDBE that record the limit and offset counters. -** -** addrOpenEphm[] entries contain the address of OP_OpenEphemeral opcodes. -** These addresses must be stored so that we can go back and fill in -** the P4_KEYINFO and P2 parameters later. Neither the KeyInfo nor -** the number of columns in P2 can be computed at the same time -** as the OP_OpenEphm instruction is coded because not -** enough information about the compound query is known at that point. -** The KeyInfo for addrOpenTran[0] and [1] contains collating sequences -** for the result set. The KeyInfo for addrOpenEphm[2] contains collating -** sequences for the ORDER BY clause. -*/ -struct Select { - ExprList *pEList; /* The fields of the result */ - u8 op; /* One of: TK_UNION TK_ALL TK_INTERSECT TK_EXCEPT */ - u16 selFlags; /* Various SF_* values */ - int iLimit, iOffset; /* Memory registers holding LIMIT & OFFSET counters */ - int addrOpenEphm[3]; /* OP_OpenEphem opcodes related to this select */ - u64 nSelectRow; /* Estimated number of result rows */ - SrcList *pSrc; /* The FROM clause */ - Expr *pWhere; /* The WHERE clause */ - ExprList *pGroupBy; /* The GROUP BY clause */ - Expr *pHaving; /* The HAVING clause */ - ExprList *pOrderBy; /* The ORDER BY clause */ - Select *pPrior; /* Prior select in a compound select statement */ - Select *pNext; /* Next select to the left in a compound */ - Select *pRightmost; /* Right-most select in a compound select statement */ - Expr *pLimit; /* LIMIT expression. NULL means not used. */ - Expr *pOffset; /* OFFSET expression. NULL means not used. */ - With *pWith; /* WITH clause attached to this select. Or NULL. */ -}; - -/* -** Allowed values for Select.selFlags. The "SF" prefix stands for -** "Select Flag". -*/ -#define SF_Distinct 0x0001 /* Output should be DISTINCT */ -#define SF_Resolved 0x0002 /* Identifiers have been resolved */ -#define SF_Aggregate 0x0004 /* Contains aggregate functions */ -#define SF_UsesEphemeral 0x0008 /* Uses the OpenEphemeral opcode */ -#define SF_Expanded 0x0010 /* sqlite3SelectExpand() called on this */ -#define SF_HasTypeInfo 0x0020 /* FROM subqueries have Table metadata */ -#define SF_UseSorter 0x0040 /* Sort using a sorter */ -#define SF_Values 0x0080 /* Synthesized from VALUES clause */ -#define SF_Materialize 0x0100 /* Force materialization of views */ -#define SF_NestedFrom 0x0200 /* Part of a parenthesized FROM clause */ -#define SF_MaybeConvert 0x0400 /* Need convertCompoundSelectToSubquery() */ -#define SF_Recursive 0x0800 /* The recursive part of a recursive CTE */ - - -/* -** The results of a SELECT can be distributed in several ways, as defined -** by one of the following macros. The "SRT" prefix means "SELECT Result -** Type". -** -** SRT_Union Store results as a key in a temporary index -** identified by pDest->iSDParm. -** -** SRT_Except Remove results from the temporary index pDest->iSDParm. -** -** SRT_Exists Store a 1 in memory cell pDest->iSDParm if the result -** set is not empty. -** -** SRT_Discard Throw the results away. This is used by SELECT -** statements within triggers whose only purpose is -** the side-effects of functions. -** -** All of the above are free to ignore their ORDER BY clause. Those that -** follow must honor the ORDER BY clause. -** -** SRT_Output Generate a row of output (using the OP_ResultRow -** opcode) for each row in the result set. -** -** SRT_Mem Only valid if the result is a single column. -** Store the first column of the first result row -** in register pDest->iSDParm then abandon the rest -** of the query. This destination implies "LIMIT 1". -** -** SRT_Set The result must be a single column. Store each -** row of result as the key in table pDest->iSDParm. -** Apply the affinity pDest->affSdst before storing -** results. Used to implement "IN (SELECT ...)". -** -** SRT_EphemTab Create an temporary table pDest->iSDParm and store -** the result there. The cursor is left open after -** returning. This is like SRT_Table except that -** this destination uses OP_OpenEphemeral to create -** the table first. -** -** SRT_Coroutine Generate a co-routine that returns a new row of -** results each time it is invoked. The entry point -** of the co-routine is stored in register pDest->iSDParm -** and the result row is stored in pDest->nDest registers -** starting with pDest->iSdst. -** -** SRT_Table Store results in temporary table pDest->iSDParm. -** This is like SRT_EphemTab except that the table -** is assumed to already be open. -** -** SRT_DistTable Store results in a temporary table pDest->iSDParm. -** But also use temporary table pDest->iSDParm+1 as -** a record of all prior results and ignore any duplicate -** rows. Name means: "Distinct Table". -** -** SRT_Queue Store results in priority queue pDest->iSDParm (really -** an index). Append a sequence number so that all entries -** are distinct. -** -** SRT_DistQueue Store results in priority queue pDest->iSDParm only if -** the same record has never been stored before. The -** index at pDest->iSDParm+1 hold all prior stores. -*/ -#define SRT_Union 1 /* Store result as keys in an index */ -#define SRT_Except 2 /* Remove result from a UNION index */ -#define SRT_Exists 3 /* Store 1 if the result is not empty */ -#define SRT_Discard 4 /* Do not save the results anywhere */ - -/* The ORDER BY clause is ignored for all of the above */ -#define IgnorableOrderby(X) ((X->eDest)<=SRT_Discard) - -#define SRT_Output 5 /* Output each row of result */ -#define SRT_Mem 6 /* Store result in a memory cell */ -#define SRT_Set 7 /* Store results as keys in an index */ -#define SRT_EphemTab 8 /* Create transient tab and store like SRT_Table */ -#define SRT_Coroutine 9 /* Generate a single row of result */ -#define SRT_Table 10 /* Store result as data with an automatic rowid */ -#define SRT_DistTable 11 /* Like SRT_Table, but unique results only */ -#define SRT_Queue 12 /* Store result in an queue */ -#define SRT_DistQueue 13 /* Like SRT_Queue, but unique results only */ - -/* -** An instance of this object describes where to put of the results of -** a SELECT statement. -*/ -struct SelectDest { - u8 eDest; /* How to dispose of the results. On of SRT_* above. */ - char affSdst; /* Affinity used when eDest==SRT_Set */ - int iSDParm; /* A parameter used by the eDest disposal method */ - int iSdst; /* Base register where results are written */ - int nSdst; /* Number of registers allocated */ - ExprList *pOrderBy; /* Key columns for SRT_Queue and SRT_DistQueue */ -}; - -/* -** During code generation of statements that do inserts into AUTOINCREMENT -** tables, the following information is attached to the Table.u.autoInc.p -** pointer of each autoincrement table to record some side information that -** the code generator needs. We have to keep per-table autoincrement -** information in case inserts are down within triggers. Triggers do not -** normally coordinate their activities, but we do need to coordinate the -** loading and saving of autoincrement information. -*/ -struct AutoincInfo { - AutoincInfo *pNext; /* Next info block in a list of them all */ - Table *pTab; /* Table this info block refers to */ - int iDb; /* Index in sqlite3.aDb[] of database holding pTab */ - int regCtr; /* Memory register holding the rowid counter */ -}; - -/* -** Size of the column cache -*/ -#ifndef SQLITE_N_COLCACHE -# define SQLITE_N_COLCACHE 10 -#endif - -/* -** At least one instance of the following structure is created for each -** trigger that may be fired while parsing an INSERT, UPDATE or DELETE -** statement. All such objects are stored in the linked list headed at -** Parse.pTriggerPrg and deleted once statement compilation has been -** completed. -** -** A Vdbe sub-program that implements the body and WHEN clause of trigger -** TriggerPrg.pTrigger, assuming a default ON CONFLICT clause of -** TriggerPrg.orconf, is stored in the TriggerPrg.pProgram variable. -** The Parse.pTriggerPrg list never contains two entries with the same -** values for both pTrigger and orconf. -** -** The TriggerPrg.aColmask[0] variable is set to a mask of old.* columns -** accessed (or set to 0 for triggers fired as a result of INSERT -** statements). Similarly, the TriggerPrg.aColmask[1] variable is set to -** a mask of new.* columns used by the program. -*/ -struct TriggerPrg { - Trigger *pTrigger; /* Trigger this program was coded from */ - TriggerPrg *pNext; /* Next entry in Parse.pTriggerPrg list */ - SubProgram *pProgram; /* Program implementing pTrigger/orconf */ - int orconf; /* Default ON CONFLICT policy */ - u32 aColmask[2]; /* Masks of old.*, new.* columns accessed */ -}; - -/* -** The yDbMask datatype for the bitmask of all attached databases. -*/ -#if SQLITE_MAX_ATTACHED>30 - typedef sqlite3_uint64 yDbMask; -#else - typedef unsigned int yDbMask; -#endif - -/* -** An SQL parser context. A copy of this structure is passed through -** the parser and down into all the parser action routine in order to -** carry around information that is global to the entire parse. -** -** The structure is divided into two parts. When the parser and code -** generate call themselves recursively, the first part of the structure -** is constant but the second part is reset at the beginning and end of -** each recursion. -** -** The nTableLock and aTableLock variables are only used if the shared-cache -** feature is enabled (if sqlite3Tsd()->useSharedData is true). They are -** used to store the set of table-locks required by the statement being -** compiled. Function sqlite3TableLock() is used to add entries to the -** list. -*/ -struct Parse { - sqlite3 *db; /* The main database structure */ - char *zErrMsg; /* An error message */ - Vdbe *pVdbe; /* An engine for executing database bytecode */ - int rc; /* Return code from execution */ - u8 colNamesSet; /* TRUE after OP_ColumnName has been issued to pVdbe */ - u8 checkSchema; /* Causes schema cookie check after an error */ - u8 nested; /* Number of nested calls to the parser/code generator */ - u8 nTempReg; /* Number of temporary registers in aTempReg[] */ - u8 nTempInUse; /* Number of aTempReg[] currently checked out */ - u8 nColCache; /* Number of entries in aColCache[] */ - u8 iColCache; /* Next entry in aColCache[] to replace */ - u8 isMultiWrite; /* True if statement may modify/insert multiple rows */ - u8 mayAbort; /* True if statement may throw an ABORT exception */ - u8 hasCompound; /* Need to invoke convertCompoundSelectToSubquery() */ - int aTempReg[8]; /* Holding area for temporary registers */ - int nRangeReg; /* Size of the temporary register block */ - int iRangeReg; /* First register in temporary register block */ - int nErr; /* Number of errors seen */ - int nTab; /* Number of previously allocated VDBE cursors */ - int nMem; /* Number of memory cells used so far */ - int nSet; /* Number of sets used so far */ - int nOnce; /* Number of OP_Once instructions so far */ - int nOpAlloc; /* Number of slots allocated for Vdbe.aOp[] */ - int nLabel; /* Number of labels used */ - int *aLabel; /* Space to hold the labels */ - int iFixedOp; /* Never back out opcodes iFixedOp-1 or earlier */ - int ckBase; /* Base register of data during check constraints */ - int iPartIdxTab; /* Table corresponding to a partial index */ - int iCacheLevel; /* ColCache valid when aColCache[].iLevel<=iCacheLevel */ - int iCacheCnt; /* Counter used to generate aColCache[].lru values */ - struct yColCache { - int iTable; /* Table cursor number */ - int iColumn; /* Table column number */ - u8 tempReg; /* iReg is a temp register that needs to be freed */ - int iLevel; /* Nesting level */ - int iReg; /* Reg with value of this column. 0 means none. */ - int lru; /* Least recently used entry has the smallest value */ - } aColCache[SQLITE_N_COLCACHE]; /* One for each column cache entry */ - ExprList *pConstExpr;/* Constant expressions */ - yDbMask writeMask; /* Start a write transaction on these databases */ - yDbMask cookieMask; /* Bitmask of schema verified databases */ - int cookieGoto; /* Address of OP_Goto to cookie verifier subroutine */ - int cookieValue[SQLITE_MAX_ATTACHED+2]; /* Values of cookies to verify */ - int regRowid; /* Register holding rowid of CREATE TABLE entry */ - int regRoot; /* Register holding root page number for new objects */ - int nMaxArg; /* Max args passed to user function by sub-program */ - Token constraintName;/* Name of the constraint currently being parsed */ -#ifndef SQLITE_OMIT_SHARED_CACHE - int nTableLock; /* Number of locks in aTableLock */ - TableLock *aTableLock; /* Required table locks for shared-cache mode */ -#endif - AutoincInfo *pAinc; /* Information about AUTOINCREMENT counters */ - - /* Information used while coding trigger programs. */ - Parse *pToplevel; /* Parse structure for main program (or NULL) */ - Table *pTriggerTab; /* Table triggers are being coded for */ - int addrCrTab; /* Address of OP_CreateTable opcode on CREATE TABLE */ - int addrSkipPK; /* Address of instruction to skip PRIMARY KEY index */ - u32 nQueryLoop; /* Est number of iterations of a query (10*log2(N)) */ - u32 oldmask; /* Mask of old.* columns referenced */ - u32 newmask; /* Mask of new.* columns referenced */ - u8 eTriggerOp; /* TK_UPDATE, TK_INSERT or TK_DELETE */ - u8 eOrconf; /* Default ON CONFLICT policy for trigger steps */ - u8 disableTriggers; /* True to disable triggers */ - - /* Above is constant between recursions. Below is reset before and after - ** each recursion */ - - int nVar; /* Number of '?' variables seen in the SQL so far */ - int nzVar; /* Number of available slots in azVar[] */ - u8 iPkSortOrder; /* ASC or DESC for INTEGER PRIMARY KEY */ - u8 explain; /* True if the EXPLAIN flag is found on the query */ -#ifndef SQLITE_OMIT_VIRTUALTABLE - u8 declareVtab; /* True if inside sqlite3_declare_vtab() */ - int nVtabLock; /* Number of virtual tables to lock */ -#endif - int nAlias; /* Number of aliased result set columns */ - int nHeight; /* Expression tree height of current sub-select */ -#ifndef SQLITE_OMIT_EXPLAIN - int iSelectId; /* ID of current select for EXPLAIN output */ - int iNextSelectId; /* Next available select ID for EXPLAIN output */ -#endif - char **azVar; /* Pointers to names of parameters */ - Vdbe *pReprepare; /* VM being reprepared (sqlite3Reprepare()) */ - const char *zTail; /* All SQL text past the last semicolon parsed */ - Table *pNewTable; /* A table being constructed by CREATE TABLE */ - Trigger *pNewTrigger; /* Trigger under construct by a CREATE TRIGGER */ - const char *zAuthContext; /* The 6th parameter to db->xAuth callbacks */ - Token sNameToken; /* Token with unqualified schema object name */ - Token sLastToken; /* The last token parsed */ -#ifndef SQLITE_OMIT_VIRTUALTABLE - Token sArg; /* Complete text of a module argument */ - Table **apVtabLock; /* Pointer to virtual tables needing locking */ -#endif - Table *pZombieTab; /* List of Table objects to delete after code gen */ - TriggerPrg *pTriggerPrg; /* Linked list of coded triggers */ - With *pWith; /* Current WITH clause, or NULL */ - u8 bFreeWith; /* True if pWith should be freed with parser */ -}; - -/* -** Return true if currently inside an sqlite3_declare_vtab() call. -*/ -#ifdef SQLITE_OMIT_VIRTUALTABLE - #define IN_DECLARE_VTAB 0 -#else - #define IN_DECLARE_VTAB (pParse->declareVtab) -#endif - -/* -** An instance of the following structure can be declared on a stack and used -** to save the Parse.zAuthContext value so that it can be restored later. -*/ -struct AuthContext { - const char *zAuthContext; /* Put saved Parse.zAuthContext here */ - Parse *pParse; /* The Parse structure */ -}; - -/* -** Bitfield flags for P5 value in various opcodes. -*/ -#define OPFLAG_NCHANGE 0x01 /* Set to update db->nChange */ -#define OPFLAG_LASTROWID 0x02 /* Set to update db->lastRowid */ -#define OPFLAG_ISUPDATE 0x04 /* This OP_Insert is an sql UPDATE */ -#define OPFLAG_APPEND 0x08 /* This is likely to be an append */ -#define OPFLAG_USESEEKRESULT 0x10 /* Try to avoid a seek in BtreeInsert() */ -#define OPFLAG_CLEARCACHE 0x20 /* Clear pseudo-table cache in OP_Column */ -#define OPFLAG_LENGTHARG 0x40 /* OP_Column only used for length() */ -#define OPFLAG_TYPEOFARG 0x80 /* OP_Column only used for typeof() */ -#define OPFLAG_BULKCSR 0x01 /* OP_Open** used to open bulk cursor */ -#define OPFLAG_P2ISREG 0x02 /* P2 to OP_Open** is a register number */ -#define OPFLAG_PERMUTE 0x01 /* OP_Compare: use the permutation */ - -/* - * Each trigger present in the database schema is stored as an instance of - * struct Trigger. - * - * Pointers to instances of struct Trigger are stored in two ways. - * 1. In the "trigHash" hash table (part of the sqlite3* that represents the - * database). This allows Trigger structures to be retrieved by name. - * 2. All triggers associated with a single table form a linked list, using the - * pNext member of struct Trigger. A pointer to the first element of the - * linked list is stored as the "pTrigger" member of the associated - * struct Table. - * - * The "step_list" member points to the first element of a linked list - * containing the SQL statements specified as the trigger program. - */ -struct Trigger { - char *zName; /* The name of the trigger */ - char *table; /* The table or view to which the trigger applies */ - u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT */ - u8 tr_tm; /* One of TRIGGER_BEFORE, TRIGGER_AFTER */ - Expr *pWhen; /* The WHEN clause of the expression (may be NULL) */ - IdList *pColumns; /* If this is an UPDATE OF trigger, - the is stored here */ - Schema *pSchema; /* Schema containing the trigger */ - Schema *pTabSchema; /* Schema containing the table */ - TriggerStep *step_list; /* Link list of trigger program steps */ - Trigger *pNext; /* Next trigger associated with the table */ -}; - -/* -** A trigger is either a BEFORE or an AFTER trigger. The following constants -** determine which. -** -** If there are multiple triggers, you might of some BEFORE and some AFTER. -** In that cases, the constants below can be ORed together. -*/ -#define TRIGGER_BEFORE 1 -#define TRIGGER_AFTER 2 - -/* - * An instance of struct TriggerStep is used to store a single SQL statement - * that is a part of a trigger-program. - * - * Instances of struct TriggerStep are stored in a singly linked list (linked - * using the "pNext" member) referenced by the "step_list" member of the - * associated struct Trigger instance. The first element of the linked list is - * the first step of the trigger-program. - * - * The "op" member indicates whether this is a "DELETE", "INSERT", "UPDATE" or - * "SELECT" statement. The meanings of the other members is determined by the - * value of "op" as follows: - * - * (op == TK_INSERT) - * orconf -> stores the ON CONFLICT algorithm - * pSelect -> If this is an INSERT INTO ... SELECT ... statement, then - * this stores a pointer to the SELECT statement. Otherwise NULL. - * target -> A token holding the quoted name of the table to insert into. - * pExprList -> If this is an INSERT INTO ... VALUES ... statement, then - * this stores values to be inserted. Otherwise NULL. - * pIdList -> If this is an INSERT INTO ... () VALUES ... - * statement, then this stores the column-names to be - * inserted into. - * - * (op == TK_DELETE) - * target -> A token holding the quoted name of the table to delete from. - * pWhere -> The WHERE clause of the DELETE statement if one is specified. - * Otherwise NULL. - * - * (op == TK_UPDATE) - * target -> A token holding the quoted name of the table to update rows of. - * pWhere -> The WHERE clause of the UPDATE statement if one is specified. - * Otherwise NULL. - * pExprList -> A list of the columns to update and the expressions to update - * them to. See sqlite3Update() documentation of "pChanges" - * argument. - * - */ -struct TriggerStep { - u8 op; /* One of TK_DELETE, TK_UPDATE, TK_INSERT, TK_SELECT */ - u8 orconf; /* OE_Rollback etc. */ - Trigger *pTrig; /* The trigger that this step is a part of */ - Select *pSelect; /* SELECT statment or RHS of INSERT INTO .. SELECT ... */ - Token target; /* Target table for DELETE, UPDATE, INSERT */ - Expr *pWhere; /* The WHERE clause for DELETE or UPDATE steps */ - ExprList *pExprList; /* SET clause for UPDATE. */ - IdList *pIdList; /* Column names for INSERT */ - TriggerStep *pNext; /* Next in the link-list */ - TriggerStep *pLast; /* Last element in link-list. Valid for 1st elem only */ -}; - -/* -** The following structure contains information used by the sqliteFix... -** routines as they walk the parse tree to make database references -** explicit. -*/ -typedef struct DbFixer DbFixer; -struct DbFixer { - Parse *pParse; /* The parsing context. Error messages written here */ - Schema *pSchema; /* Fix items to this schema */ - int bVarOnly; /* Check for variable references only */ - const char *zDb; /* Make sure all objects are contained in this database */ - const char *zType; /* Type of the container - used for error messages */ - const Token *pName; /* Name of the container - used for error messages */ -}; - -/* -** An objected used to accumulate the text of a string where we -** do not necessarily know how big the string will be in the end. -*/ -struct StrAccum { - sqlite3 *db; /* Optional database for lookaside. Can be NULL */ - char *zBase; /* A base allocation. Not from malloc. */ - char *zText; /* The string collected so far */ - int nChar; /* Length of the string so far */ - int nAlloc; /* Amount of space allocated in zText */ - int mxAlloc; /* Maximum allowed string length */ - u8 useMalloc; /* 0: none, 1: sqlite3DbMalloc, 2: sqlite3_malloc */ - u8 accError; /* STRACCUM_NOMEM or STRACCUM_TOOBIG */ -}; -#define STRACCUM_NOMEM 1 -#define STRACCUM_TOOBIG 2 - -/* -** A pointer to this structure is used to communicate information -** from sqlite3Init and OP_ParseSchema into the sqlite3InitCallback. -*/ -typedef struct { - sqlite3 *db; /* The database being initialized */ - char **pzErrMsg; /* Error message stored here */ - int iDb; /* 0 for main database. 1 for TEMP, 2.. for ATTACHed */ - int rc; /* Result code stored here */ -} InitData; - -/* -** Structure containing global configuration data for the SQLite library. -** -** This structure also contains some state information. -*/ -struct Sqlite3Config { - int bMemstat; /* True to enable memory status */ - int bCoreMutex; /* True to enable core mutexing */ - int bFullMutex; /* True to enable full mutexing */ - int bOpenUri; /* True to interpret filenames as URIs */ - int bUseCis; /* Use covering indices for full-scans */ - int mxStrlen; /* Maximum string length */ - int neverCorrupt; /* Database is always well-formed */ - int szLookaside; /* Default lookaside buffer size */ - int nLookaside; /* Default lookaside buffer count */ - sqlite3_mem_methods m; /* Low-level memory allocation interface */ - sqlite3_mutex_methods mutex; /* Low-level mutex interface */ - sqlite3_pcache_methods2 pcache2; /* Low-level page-cache interface */ - void *pHeap; /* Heap storage space */ - int nHeap; /* Size of pHeap[] */ - int mnReq, mxReq; /* Min and max heap requests sizes */ - sqlite3_int64 szMmap; /* mmap() space per open file */ - sqlite3_int64 mxMmap; /* Maximum value for szMmap */ - void *pScratch; /* Scratch memory */ - int szScratch; /* Size of each scratch buffer */ - int nScratch; /* Number of scratch buffers */ - void *pPage; /* Page cache memory */ - int szPage; /* Size of each page in pPage[] */ - int nPage; /* Number of pages in pPage[] */ - int mxParserStack; /* maximum depth of the parser stack */ - int sharedCacheEnabled; /* true if shared-cache mode enabled */ - /* The above might be initialized to non-zero. The following need to always - ** initially be zero, however. */ - int isInit; /* True after initialization has finished */ - int inProgress; /* True while initialization in progress */ - int isMutexInit; /* True after mutexes are initialized */ - int isMallocInit; /* True after malloc is initialized */ - int isPCacheInit; /* True after malloc is initialized */ - sqlite3_mutex *pInitMutex; /* Mutex used by sqlite3_initialize() */ - int nRefInitMutex; /* Number of users of pInitMutex */ - void (*xLog)(void*,int,const char*); /* Function for logging */ - void *pLogArg; /* First argument to xLog() */ - int bLocaltimeFault; /* True to fail localtime() calls */ -#ifdef SQLITE_ENABLE_SQLLOG - void(*xSqllog)(void*,sqlite3*,const char*, int); - void *pSqllogArg; -#endif -}; - -/* -** This macro is used inside of assert() statements to indicate that -** the assert is only valid on a well-formed database. Instead of: -** -** assert( X ); -** -** One writes: -** -** assert( X || CORRUPT_DB ); -** -** CORRUPT_DB is true during normal operation. CORRUPT_DB does not indicate -** that the database is definitely corrupt, only that it might be corrupt. -** For most test cases, CORRUPT_DB is set to false using a special -** sqlite3_test_control(). This enables assert() statements to prove -** things that are always true for well-formed databases. -*/ -#define CORRUPT_DB (sqlite3Config.neverCorrupt==0) - -/* -** Context pointer passed down through the tree-walk. -*/ -struct Walker { - int (*xExprCallback)(Walker*, Expr*); /* Callback for expressions */ - int (*xSelectCallback)(Walker*,Select*); /* Callback for SELECTs */ - void (*xSelectCallback2)(Walker*,Select*);/* Second callback for SELECTs */ - Parse *pParse; /* Parser context. */ - int walkerDepth; /* Number of subqueries */ - union { /* Extra data for callback */ - NameContext *pNC; /* Naming context */ - int i; /* Integer value */ - SrcList *pSrcList; /* FROM clause */ - struct SrcCount *pSrcCount; /* Counting column references */ - } u; -}; - -/* Forward declarations */ -SQLITE_PRIVATE int sqlite3WalkExpr(Walker*, Expr*); -SQLITE_PRIVATE int sqlite3WalkExprList(Walker*, ExprList*); -SQLITE_PRIVATE int sqlite3WalkSelect(Walker*, Select*); -SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker*, Select*); -SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker*, Select*); - -/* -** Return code from the parse-tree walking primitives and their -** callbacks. -*/ -#define WRC_Continue 0 /* Continue down into children */ -#define WRC_Prune 1 /* Omit children but continue walking siblings */ -#define WRC_Abort 2 /* Abandon the tree walk */ - -/* -** An instance of this structure represents a set of one or more CTEs -** (common table expressions) created by a single WITH clause. -*/ -struct With { - int nCte; /* Number of CTEs in the WITH clause */ - With *pOuter; /* Containing WITH clause, or NULL */ - struct Cte { /* For each CTE in the WITH clause.... */ - char *zName; /* Name of this CTE */ - ExprList *pCols; /* List of explicit column names, or NULL */ - Select *pSelect; /* The definition of this CTE */ - const char *zErr; /* Error message for circular references */ - } a[1]; -}; - -/* -** Assuming zIn points to the first byte of a UTF-8 character, -** advance zIn to point to the first byte of the next UTF-8 character. -*/ -#define SQLITE_SKIP_UTF8(zIn) { \ - if( (*(zIn++))>=0xc0 ){ \ - while( (*zIn & 0xc0)==0x80 ){ zIn++; } \ - } \ -} - -/* -** The SQLITE_*_BKPT macros are substitutes for the error codes with -** the same name but without the _BKPT suffix. These macros invoke -** routines that report the line-number on which the error originated -** using sqlite3_log(). The routines also provide a convenient place -** to set a debugger breakpoint. -*/ -SQLITE_PRIVATE int sqlite3CorruptError(int); -SQLITE_PRIVATE int sqlite3MisuseError(int); -SQLITE_PRIVATE int sqlite3CantopenError(int); -#define SQLITE_CORRUPT_BKPT sqlite3CorruptError(__LINE__) -#define SQLITE_MISUSE_BKPT sqlite3MisuseError(__LINE__) -#define SQLITE_CANTOPEN_BKPT sqlite3CantopenError(__LINE__) - - -/* -** FTS4 is really an extension for FTS3. It is enabled using the -** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also all -** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3. -*/ -#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3) -# define SQLITE_ENABLE_FTS3 -#endif - -/* -** The ctype.h header is needed for non-ASCII systems. It is also -** needed by FTS3 when FTS3 is included in the amalgamation. -*/ -#if !defined(SQLITE_ASCII) || \ - (defined(SQLITE_ENABLE_FTS3) && defined(SQLITE_AMALGAMATION)) -# include -#endif - -/* -** The following macros mimic the standard library functions toupper(), -** isspace(), isalnum(), isdigit() and isxdigit(), respectively. The -** sqlite versions only work for ASCII characters, regardless of locale. -*/ -#ifdef SQLITE_ASCII -# define sqlite3Toupper(x) ((x)&~(sqlite3CtypeMap[(unsigned char)(x)]&0x20)) -# define sqlite3Isspace(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x01) -# define sqlite3Isalnum(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x06) -# define sqlite3Isalpha(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x02) -# define sqlite3Isdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x04) -# define sqlite3Isxdigit(x) (sqlite3CtypeMap[(unsigned char)(x)]&0x08) -# define sqlite3Tolower(x) (sqlite3UpperToLower[(unsigned char)(x)]) -#else -# define sqlite3Toupper(x) toupper((unsigned char)(x)) -# define sqlite3Isspace(x) isspace((unsigned char)(x)) -# define sqlite3Isalnum(x) isalnum((unsigned char)(x)) -# define sqlite3Isalpha(x) isalpha((unsigned char)(x)) -# define sqlite3Isdigit(x) isdigit((unsigned char)(x)) -# define sqlite3Isxdigit(x) isxdigit((unsigned char)(x)) -# define sqlite3Tolower(x) tolower((unsigned char)(x)) -#endif - -/* -** Internal function prototypes -*/ -#define sqlite3StrICmp sqlite3_stricmp -SQLITE_PRIVATE int sqlite3Strlen30(const char*); -#define sqlite3StrNICmp sqlite3_strnicmp - -SQLITE_PRIVATE int sqlite3MallocInit(void); -SQLITE_PRIVATE void sqlite3MallocEnd(void); -SQLITE_PRIVATE void *sqlite3Malloc(int); -SQLITE_PRIVATE void *sqlite3MallocZero(int); -SQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3*, int); -SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3*, int); -SQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3*,const char*); -SQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3*,const char*, int); -SQLITE_PRIVATE void *sqlite3Realloc(void*, int); -SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *, void *, int); -SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *, void *, int); -SQLITE_PRIVATE void sqlite3DbFree(sqlite3*, void*); -SQLITE_PRIVATE int sqlite3MallocSize(void*); -SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3*, void*); -SQLITE_PRIVATE void *sqlite3ScratchMalloc(int); -SQLITE_PRIVATE void sqlite3ScratchFree(void*); -SQLITE_PRIVATE void *sqlite3PageMalloc(int); -SQLITE_PRIVATE void sqlite3PageFree(void*); -SQLITE_PRIVATE void sqlite3MemSetDefault(void); -SQLITE_PRIVATE void sqlite3BenignMallocHooks(void (*)(void), void (*)(void)); -SQLITE_PRIVATE int sqlite3HeapNearlyFull(void); - -/* -** On systems with ample stack space and that support alloca(), make -** use of alloca() to obtain space for large automatic objects. By default, -** obtain space from malloc(). -** -** The alloca() routine never returns NULL. This will cause code paths -** that deal with sqlite3StackAlloc() failures to be unreachable. -*/ -#ifdef SQLITE_USE_ALLOCA -# define sqlite3StackAllocRaw(D,N) alloca(N) -# define sqlite3StackAllocZero(D,N) memset(alloca(N), 0, N) -# define sqlite3StackFree(D,P) -#else -# define sqlite3StackAllocRaw(D,N) sqlite3DbMallocRaw(D,N) -# define sqlite3StackAllocZero(D,N) sqlite3DbMallocZero(D,N) -# define sqlite3StackFree(D,P) sqlite3DbFree(D,P) -#endif - -#ifdef SQLITE_ENABLE_MEMSYS3 -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void); -#endif -#ifdef SQLITE_ENABLE_MEMSYS5 -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void); -#endif - - -#ifndef SQLITE_MUTEX_OMIT -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void); -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void); -SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int); -SQLITE_PRIVATE int sqlite3MutexInit(void); -SQLITE_PRIVATE int sqlite3MutexEnd(void); -#endif - -SQLITE_PRIVATE int sqlite3StatusValue(int); -SQLITE_PRIVATE void sqlite3StatusAdd(int, int); -SQLITE_PRIVATE void sqlite3StatusSet(int, int); - -#ifndef SQLITE_OMIT_FLOATING_POINT -SQLITE_PRIVATE int sqlite3IsNaN(double); -#else -# define sqlite3IsNaN(X) 0 -#endif - -/* -** An instance of the following structure holds information about SQL -** functions arguments that are the parameters to the printf() function. -*/ -struct PrintfArguments { - int nArg; /* Total number of arguments */ - int nUsed; /* Number of arguments used so far */ - sqlite3_value **apArg; /* The argument values */ -}; - -#define SQLITE_PRINTF_INTERNAL 0x01 -#define SQLITE_PRINTF_SQLFUNC 0x02 -SQLITE_PRIVATE void sqlite3VXPrintf(StrAccum*, u32, const char*, va_list); -SQLITE_PRIVATE void sqlite3XPrintf(StrAccum*, u32, const char*, ...); -SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3*,const char*, ...); -SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3*,const char*, va_list); -SQLITE_PRIVATE char *sqlite3MAppendf(sqlite3*,char*,const char*,...); -#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) -SQLITE_PRIVATE void sqlite3DebugPrintf(const char*, ...); -#endif -#if defined(SQLITE_TEST) -SQLITE_PRIVATE void *sqlite3TestTextToPtr(const char*); -#endif - -/* Output formatting for SQLITE_TESTCTRL_EXPLAIN */ -#if defined(SQLITE_ENABLE_TREE_EXPLAIN) -SQLITE_PRIVATE void sqlite3ExplainBegin(Vdbe*); -SQLITE_PRIVATE void sqlite3ExplainPrintf(Vdbe*, const char*, ...); -SQLITE_PRIVATE void sqlite3ExplainNL(Vdbe*); -SQLITE_PRIVATE void sqlite3ExplainPush(Vdbe*); -SQLITE_PRIVATE void sqlite3ExplainPop(Vdbe*); -SQLITE_PRIVATE void sqlite3ExplainFinish(Vdbe*); -SQLITE_PRIVATE void sqlite3ExplainSelect(Vdbe*, Select*); -SQLITE_PRIVATE void sqlite3ExplainExpr(Vdbe*, Expr*); -SQLITE_PRIVATE void sqlite3ExplainExprList(Vdbe*, ExprList*); -SQLITE_PRIVATE const char *sqlite3VdbeExplanation(Vdbe*); -#else -# define sqlite3ExplainBegin(X) -# define sqlite3ExplainSelect(A,B) -# define sqlite3ExplainExpr(A,B) -# define sqlite3ExplainExprList(A,B) -# define sqlite3ExplainFinish(X) -# define sqlite3VdbeExplanation(X) 0 -#endif - - -SQLITE_PRIVATE void sqlite3SetString(char **, sqlite3*, const char*, ...); -SQLITE_PRIVATE void sqlite3ErrorMsg(Parse*, const char*, ...); -SQLITE_PRIVATE int sqlite3Dequote(char*); -SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char*, int); -SQLITE_PRIVATE int sqlite3RunParser(Parse*, const char*, char **); -SQLITE_PRIVATE void sqlite3FinishCoding(Parse*); -SQLITE_PRIVATE int sqlite3GetTempReg(Parse*); -SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse*,int); -SQLITE_PRIVATE int sqlite3GetTempRange(Parse*,int); -SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse*,int,int); -SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse*); -SQLITE_PRIVATE Expr *sqlite3ExprAlloc(sqlite3*,int,const Token*,int); -SQLITE_PRIVATE Expr *sqlite3Expr(sqlite3*,int,const char*); -SQLITE_PRIVATE void sqlite3ExprAttachSubtrees(sqlite3*,Expr*,Expr*,Expr*); -SQLITE_PRIVATE Expr *sqlite3PExpr(Parse*, int, Expr*, Expr*, const Token*); -SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3*,Expr*, Expr*); -SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse*,ExprList*, Token*); -SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse*, Expr*); -SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3*, Expr*); -SQLITE_PRIVATE ExprList *sqlite3ExprListAppend(Parse*,ExprList*,Expr*); -SQLITE_PRIVATE void sqlite3ExprListSetName(Parse*,ExprList*,Token*,int); -SQLITE_PRIVATE void sqlite3ExprListSetSpan(Parse*,ExprList*,ExprSpan*); -SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3*, ExprList*); -SQLITE_PRIVATE int sqlite3Init(sqlite3*, char**); -SQLITE_PRIVATE int sqlite3InitCallback(void*, int, char**, char**); -SQLITE_PRIVATE void sqlite3Pragma(Parse*,Token*,Token*,Token*,int); -SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3*); -SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3*,int); -SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3*); -SQLITE_PRIVATE void sqlite3BeginParse(Parse*,int); -SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3*); -SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse*,Select*); -SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *, int); -SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table*); -SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index*, i16); -SQLITE_PRIVATE void sqlite3StartTable(Parse*,Token*,Token*,int,int,int,int); -SQLITE_PRIVATE void sqlite3AddColumn(Parse*,Token*); -SQLITE_PRIVATE void sqlite3AddNotNull(Parse*, int); -SQLITE_PRIVATE void sqlite3AddPrimaryKey(Parse*, ExprList*, int, int, int); -SQLITE_PRIVATE void sqlite3AddCheckConstraint(Parse*, Expr*); -SQLITE_PRIVATE void sqlite3AddColumnType(Parse*,Token*); -SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse*,ExprSpan*); -SQLITE_PRIVATE void sqlite3AddCollateType(Parse*, Token*); -SQLITE_PRIVATE void sqlite3EndTable(Parse*,Token*,Token*,u8,Select*); -SQLITE_PRIVATE int sqlite3ParseUri(const char*,const char*,unsigned int*, - sqlite3_vfs**,char**,char **); -SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3*,const char*); -SQLITE_PRIVATE int sqlite3CodeOnce(Parse *); - -SQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32); -SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec*, u32); -SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec*, u32); -SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec*, u32, void*); -SQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec*); -SQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec*); -SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int,int*); - -SQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3*, void*, unsigned int); -SQLITE_PRIVATE void sqlite3RowSetClear(RowSet*); -SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet*, i64); -SQLITE_PRIVATE int sqlite3RowSetTest(RowSet*, u8 iBatch, i64); -SQLITE_PRIVATE int sqlite3RowSetNext(RowSet*, i64*); - -SQLITE_PRIVATE void sqlite3CreateView(Parse*,Token*,Token*,Token*,Select*,int,int); - -#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) -SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse*,Table*); -#else -# define sqlite3ViewGetColumnNames(A,B) 0 -#endif - -SQLITE_PRIVATE void sqlite3DropTable(Parse*, SrcList*, int, int); -SQLITE_PRIVATE void sqlite3CodeDropTable(Parse*, Table*, int, int); -SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3*, Table*); -#ifndef SQLITE_OMIT_AUTOINCREMENT -SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse); -SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse); -#else -# define sqlite3AutoincrementBegin(X) -# define sqlite3AutoincrementEnd(X) -#endif -SQLITE_PRIVATE int sqlite3CodeCoroutine(Parse*, Select*, SelectDest*); -SQLITE_PRIVATE void sqlite3Insert(Parse*, SrcList*, Select*, IdList*, int); -SQLITE_PRIVATE void *sqlite3ArrayAllocate(sqlite3*,void*,int,int*,int*); -SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3*, IdList*, Token*); -SQLITE_PRIVATE int sqlite3IdListIndex(IdList*,const char*); -SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge(sqlite3*, SrcList*, int, int); -SQLITE_PRIVATE SrcList *sqlite3SrcListAppend(sqlite3*, SrcList*, Token*, Token*); -SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm(Parse*, SrcList*, Token*, Token*, - Token*, Select*, Expr*, IdList*); -SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *, SrcList *, Token *); -SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *, struct SrcList_item *); -SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList*); -SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse*, SrcList*); -SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3*, IdList*); -SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3*, SrcList*); -SQLITE_PRIVATE Index *sqlite3AllocateIndexObject(sqlite3*,i16,int,char**); -SQLITE_PRIVATE Index *sqlite3CreateIndex(Parse*,Token*,Token*,SrcList*,ExprList*,int,Token*, - Expr*, int, int); -SQLITE_PRIVATE void sqlite3DropIndex(Parse*, SrcList*, int); -SQLITE_PRIVATE int sqlite3Select(Parse*, Select*, SelectDest*); -SQLITE_PRIVATE Select *sqlite3SelectNew(Parse*,ExprList*,SrcList*,Expr*,ExprList*, - Expr*,ExprList*,u16,Expr*,Expr*); -SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3*, Select*); -SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse*, SrcList*); -SQLITE_PRIVATE int sqlite3IsReadOnly(Parse*, Table*, int); -SQLITE_PRIVATE void sqlite3OpenTable(Parse*, int iCur, int iDb, Table*, int); -#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) -SQLITE_PRIVATE Expr *sqlite3LimitWhere(Parse*,SrcList*,Expr*,ExprList*,Expr*,Expr*,char*); -#endif -SQLITE_PRIVATE void sqlite3DeleteFrom(Parse*, SrcList*, Expr*); -SQLITE_PRIVATE void sqlite3Update(Parse*, SrcList*, ExprList*, Expr*, int); -SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin(Parse*,SrcList*,Expr*,ExprList*,ExprList*,u16,int); -SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo*); -SQLITE_PRIVATE u64 sqlite3WhereOutputRowCount(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo*); -SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo*, int*); -SQLITE_PRIVATE int sqlite3ExprCodeGetColumn(Parse*, Table*, int, int, int, u8); -SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable(Vdbe*, Table*, int, int, int); -SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse*, int, int, int); -SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse*, int, int, int); -SQLITE_PRIVATE void sqlite3ExprCachePush(Parse*); -SQLITE_PRIVATE void sqlite3ExprCachePop(Parse*, int); -SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse*, int, int); -SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse*); -SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse*, int, int); -SQLITE_PRIVATE int sqlite3ExprCode(Parse*, Expr*, int); -SQLITE_PRIVATE void sqlite3ExprCodeAtInit(Parse*, Expr*, int, u8); -SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse*, Expr*, int*); -SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprCodeExprList(Parse*, ExprList*, int, u8); -#define SQLITE_ECEL_DUP 0x01 /* Deep, not shallow copies */ -#define SQLITE_ECEL_FACTOR 0x02 /* Factor out constant terms */ -SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse*, Expr*, int, int); -SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse*, Expr*, int, int); -SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3*,const char*, const char*); -SQLITE_PRIVATE Table *sqlite3LocateTable(Parse*,int isView,const char*, const char*); -SQLITE_PRIVATE Table *sqlite3LocateTableItem(Parse*,int isView,struct SrcList_item *); -SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3*,const char*, const char*); -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3*,int,const char*); -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3*,int,const char*); -SQLITE_PRIVATE void sqlite3Vacuum(Parse*); -SQLITE_PRIVATE int sqlite3RunVacuum(char**, sqlite3*); -SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3*, Token*); -SQLITE_PRIVATE int sqlite3ExprCompare(Expr*, Expr*, int); -SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList*, ExprList*, int); -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr*, Expr*, int); -SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext*, Expr*); -SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext*,ExprList*); -SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr*, SrcList*); -SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse*); -SQLITE_PRIVATE void sqlite3PrngSaveState(void); -SQLITE_PRIVATE void sqlite3PrngRestoreState(void); -SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3*,int); -SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse*, int); -SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse*, const char *zDb); -SQLITE_PRIVATE void sqlite3BeginTransaction(Parse*, int); -SQLITE_PRIVATE void sqlite3CommitTransaction(Parse*); -SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse*); -SQLITE_PRIVATE void sqlite3Savepoint(Parse*, int, Token*); -SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *); -SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3*); -SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr*); -SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr*); -SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr*, int*); -SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr*); -SQLITE_PRIVATE void sqlite3ExprCodeIsNullJump(Vdbe*, const Expr*, int, int); -SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr*, char); -SQLITE_PRIVATE int sqlite3IsRowid(const char*); -SQLITE_PRIVATE void sqlite3GenerateRowDelete(Parse*,Table*,Trigger*,int,int,int,i16,u8,u8,u8); -SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete(Parse*, Table*, int, int, int*); -SQLITE_PRIVATE int sqlite3GenerateIndexKey(Parse*, Index*, int, int, int, int*,Index*,int); -SQLITE_PRIVATE void sqlite3GenerateConstraintChecks(Parse*,Table*,int*,int,int,int,int, - u8,u8,int,int*); -SQLITE_PRIVATE void sqlite3CompleteInsertion(Parse*,Table*,int,int,int,int*,int,int,int); -SQLITE_PRIVATE int sqlite3OpenTableAndIndices(Parse*, Table*, int, int, u8*, int*, int*); -SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse*, int, int); -SQLITE_PRIVATE void sqlite3MultiWrite(Parse*); -SQLITE_PRIVATE void sqlite3MayAbort(Parse*); -SQLITE_PRIVATE void sqlite3HaltConstraint(Parse*, int, int, char*, i8, u8); -SQLITE_PRIVATE void sqlite3UniqueConstraint(Parse*, int, Index*); -SQLITE_PRIVATE void sqlite3RowidConstraint(Parse*, int, Table*); -SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3*,Expr*,int); -SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3*,ExprList*,int); -SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3*,SrcList*,int); -SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3*,IdList*); -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3*,Select*,int); -SQLITE_PRIVATE void sqlite3FuncDefInsert(FuncDefHash*, FuncDef*); -SQLITE_PRIVATE FuncDef *sqlite3FindFunction(sqlite3*,const char*,int,int,u8,u8); -SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(sqlite3*); -SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void); -SQLITE_PRIVATE void sqlite3RegisterGlobalFunctions(void); -SQLITE_PRIVATE int sqlite3SafetyCheckOk(sqlite3*); -SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3*); -SQLITE_PRIVATE void sqlite3ChangeCookie(Parse*, int); - -#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) -SQLITE_PRIVATE void sqlite3MaterializeView(Parse*, Table*, Expr*, int); -#endif - -#ifndef SQLITE_OMIT_TRIGGER -SQLITE_PRIVATE void sqlite3BeginTrigger(Parse*, Token*,Token*,int,int,IdList*,SrcList*, - Expr*,int, int); -SQLITE_PRIVATE void sqlite3FinishTrigger(Parse*, TriggerStep*, Token*); -SQLITE_PRIVATE void sqlite3DropTrigger(Parse*, SrcList*, int); -SQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse*, Trigger*); -SQLITE_PRIVATE Trigger *sqlite3TriggersExist(Parse *, Table*, int, ExprList*, int *pMask); -SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *, Table *); -SQLITE_PRIVATE void sqlite3CodeRowTrigger(Parse*, Trigger *, int, ExprList*, int, Table *, - int, int, int); -SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect(Parse *, Trigger *, Table *, int, int, int); - void sqliteViewTriggers(Parse*, Table*, Expr*, int, ExprList*); -SQLITE_PRIVATE void sqlite3DeleteTriggerStep(sqlite3*, TriggerStep*); -SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3*,Select*); -SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep(sqlite3*,Token*, IdList*, - Select*,u8); -SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep(sqlite3*,Token*,ExprList*, Expr*, u8); -SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep(sqlite3*,Token*, Expr*); -SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3*, Trigger*); -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3*,int,const char*); -SQLITE_PRIVATE u32 sqlite3TriggerColmask(Parse*,Trigger*,ExprList*,int,int,Table*,int); -# define sqlite3ParseToplevel(p) ((p)->pToplevel ? (p)->pToplevel : (p)) -#else -# define sqlite3TriggersExist(B,C,D,E,F) 0 -# define sqlite3DeleteTrigger(A,B) -# define sqlite3DropTriggerPtr(A,B) -# define sqlite3UnlinkAndDeleteTrigger(A,B,C) -# define sqlite3CodeRowTrigger(A,B,C,D,E,F,G,H,I) -# define sqlite3CodeRowTriggerDirect(A,B,C,D,E,F) -# define sqlite3TriggerList(X, Y) 0 -# define sqlite3ParseToplevel(p) p -# define sqlite3TriggerColmask(A,B,C,D,E,F,G) 0 -#endif - -SQLITE_PRIVATE int sqlite3JoinType(Parse*, Token*, Token*, Token*); -SQLITE_PRIVATE void sqlite3CreateForeignKey(Parse*, ExprList*, Token*, ExprList*, int); -SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse*, int); -#ifndef SQLITE_OMIT_AUTHORIZATION -SQLITE_PRIVATE void sqlite3AuthRead(Parse*,Expr*,Schema*,SrcList*); -SQLITE_PRIVATE int sqlite3AuthCheck(Parse*,int, const char*, const char*, const char*); -SQLITE_PRIVATE void sqlite3AuthContextPush(Parse*, AuthContext*, const char*); -SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext*); -SQLITE_PRIVATE int sqlite3AuthReadCol(Parse*, const char *, const char *, int); -#else -# define sqlite3AuthRead(a,b,c,d) -# define sqlite3AuthCheck(a,b,c,d,e) SQLITE_OK -# define sqlite3AuthContextPush(a,b,c) -# define sqlite3AuthContextPop(a) ((void)(a)) -#endif -SQLITE_PRIVATE void sqlite3Attach(Parse*, Expr*, Expr*, Expr*); -SQLITE_PRIVATE void sqlite3Detach(Parse*, Expr*); -SQLITE_PRIVATE void sqlite3FixInit(DbFixer*, Parse*, int, const char*, const Token*); -SQLITE_PRIVATE int sqlite3FixSrcList(DbFixer*, SrcList*); -SQLITE_PRIVATE int sqlite3FixSelect(DbFixer*, Select*); -SQLITE_PRIVATE int sqlite3FixExpr(DbFixer*, Expr*); -SQLITE_PRIVATE int sqlite3FixExprList(DbFixer*, ExprList*); -SQLITE_PRIVATE int sqlite3FixTriggerStep(DbFixer*, TriggerStep*); -SQLITE_PRIVATE int sqlite3AtoF(const char *z, double*, int, u8); -SQLITE_PRIVATE int sqlite3GetInt32(const char *, int*); -SQLITE_PRIVATE int sqlite3Atoi(const char*); -SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *pData, int nChar); -SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *pData, int nByte); -SQLITE_PRIVATE u32 sqlite3Utf8Read(const u8**); -SQLITE_PRIVATE LogEst sqlite3LogEst(u64); -SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst,LogEst); -#ifndef SQLITE_OMIT_VIRTUALTABLE -SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double); -#endif -SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst); - -/* -** Routines to read and write variable-length integers. These used to -** be defined locally, but now we use the varint routines in the util.c -** file. Code should use the MACRO forms below, as the Varint32 versions -** are coded to assume the single byte case is already handled (which -** the MACRO form does). -*/ -SQLITE_PRIVATE int sqlite3PutVarint(unsigned char*, u64); -SQLITE_PRIVATE int sqlite3PutVarint32(unsigned char*, u32); -SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *, u64 *); -SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *, u32 *); -SQLITE_PRIVATE int sqlite3VarintLen(u64 v); - -/* -** The header of a record consists of a sequence variable-length integers. -** These integers are almost always small and are encoded as a single byte. -** The following macros take advantage this fact to provide a fast encode -** and decode of the integers in a record header. It is faster for the common -** case where the integer is a single byte. It is a little slower when the -** integer is two or more bytes. But overall it is faster. -** -** The following expressions are equivalent: -** -** x = sqlite3GetVarint32( A, &B ); -** x = sqlite3PutVarint32( A, B ); -** -** x = getVarint32( A, B ); -** x = putVarint32( A, B ); -** -*/ -#define getVarint32(A,B) \ - (u8)((*(A)<(u8)0x80)?((B)=(u32)*(A)),1:sqlite3GetVarint32((A),(u32 *)&(B))) -#define putVarint32(A,B) \ - (u8)(((u32)(B)<(u32)0x80)?(*(A)=(unsigned char)(B)),1:\ - sqlite3PutVarint32((A),(B))) -#define getVarint sqlite3GetVarint -#define putVarint sqlite3PutVarint - - -SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(Vdbe *, Index *); -SQLITE_PRIVATE void sqlite3TableAffinityStr(Vdbe *, Table *); -SQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2); -SQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity); -SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr); -SQLITE_PRIVATE int sqlite3Atoi64(const char*, i64*, int, u8); -SQLITE_PRIVATE void sqlite3Error(sqlite3*, int, const char*,...); -SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3*, const char *z, int n); -SQLITE_PRIVATE u8 sqlite3HexToInt(int h); -SQLITE_PRIVATE int sqlite3TwoPartName(Parse *, Token *, Token *, Token **); - -#if defined(SQLITE_TEST) -SQLITE_PRIVATE const char *sqlite3ErrName(int); -#endif - -SQLITE_PRIVATE const char *sqlite3ErrStr(int); -SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse); -SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq(sqlite3*,u8 enc, const char*,int); -SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char*zName); -SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr); -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr*, Token*); -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse*,Expr*,const char*); -SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr*); -SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *, CollSeq *); -SQLITE_PRIVATE int sqlite3CheckObjectName(Parse *, const char *); -SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *, int); -SQLITE_PRIVATE int sqlite3AddInt64(i64*,i64); -SQLITE_PRIVATE int sqlite3SubInt64(i64*,i64); -SQLITE_PRIVATE int sqlite3MulInt64(i64*,i64); -SQLITE_PRIVATE int sqlite3AbsInt32(int); -#ifdef SQLITE_ENABLE_8_3_NAMES -SQLITE_PRIVATE void sqlite3FileSuffix3(const char*, char*); -#else -# define sqlite3FileSuffix3(X,Y) -#endif -SQLITE_PRIVATE u8 sqlite3GetBoolean(const char *z,int); - -SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value*, u8); -SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value*, u8); -SQLITE_PRIVATE void sqlite3ValueSetStr(sqlite3_value*, int, const void *,u8, - void(*)(void*)); -SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value*); -SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value*); -SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *); -SQLITE_PRIVATE char *sqlite3Utf16to8(sqlite3 *, const void*, int, u8); -SQLITE_PRIVATE int sqlite3ValueFromExpr(sqlite3 *, Expr *, u8, u8, sqlite3_value **); -SQLITE_PRIVATE void sqlite3ValueApplyAffinity(sqlite3_value *, u8, u8); -#ifndef SQLITE_AMALGAMATION -SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[]; -SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[]; -SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[]; -SQLITE_PRIVATE const Token sqlite3IntTokens[]; -SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config; -SQLITE_PRIVATE SQLITE_WSD FuncDefHash sqlite3GlobalFunctions; -#ifndef SQLITE_OMIT_WSD -SQLITE_PRIVATE int sqlite3PendingByte; -#endif -#endif -SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3*, int, int, int); -SQLITE_PRIVATE void sqlite3Reindex(Parse*, Token*, Token*); -SQLITE_PRIVATE void sqlite3AlterFunctions(void); -SQLITE_PRIVATE void sqlite3AlterRenameTable(Parse*, SrcList*, Token*); -SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *, int *); -SQLITE_PRIVATE void sqlite3NestedParse(Parse*, const char*, ...); -SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3*); -SQLITE_PRIVATE int sqlite3CodeSubselect(Parse *, Expr *, int, int); -SQLITE_PRIVATE void sqlite3SelectPrep(Parse*, Select*, NameContext*); -SQLITE_PRIVATE int sqlite3MatchSpanName(const char*, const char*, const char*, const char*); -SQLITE_PRIVATE int sqlite3ResolveExprNames(NameContext*, Expr*); -SQLITE_PRIVATE void sqlite3ResolveSelectNames(Parse*, Select*, NameContext*); -SQLITE_PRIVATE void sqlite3ResolveSelfReference(Parse*,Table*,int,Expr*,ExprList*); -SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy(Parse*, Select*, ExprList*, const char*); -SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *, Table *, int, int); -SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *, Token *); -SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *, SrcList *); -SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq(Parse*, u8, CollSeq *, const char*); -SQLITE_PRIVATE char sqlite3AffinityType(const char*, u8*); -SQLITE_PRIVATE void sqlite3Analyze(Parse*, Token*, Token*); -SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler*); -SQLITE_PRIVATE int sqlite3FindDb(sqlite3*, Token*); -SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *, const char *); -SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3*,int iDB); -SQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3*,Index*); -SQLITE_PRIVATE void sqlite3DefaultRowEst(Index*); -SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3*, int); -SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3*,Expr*,int*,char*); -SQLITE_PRIVATE void sqlite3MinimumFileFormat(Parse*, int, int); -SQLITE_PRIVATE void sqlite3SchemaClear(void *); -SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *, Btree *); -SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *); -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3*,int,int); -SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo*); -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoRef(KeyInfo*); -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse*, Index*); -#ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3KeyInfoIsWriteable(KeyInfo*); -#endif -SQLITE_PRIVATE int sqlite3CreateFunc(sqlite3 *, const char *, int, int, void *, - void (*)(sqlite3_context*,int,sqlite3_value **), - void (*)(sqlite3_context*,int,sqlite3_value **), void (*)(sqlite3_context*), - FuncDestructor *pDestructor -); -SQLITE_PRIVATE int sqlite3ApiExit(sqlite3 *db, int); -SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *); - -SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum*, char*, int, int); -SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum*,const char*,int); -SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum*,const char*); -SQLITE_PRIVATE void sqlite3AppendSpace(StrAccum*,int); -SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum*); -SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum*); -SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest*,int,int); -SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *, SrcList *, int, int); - -SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *); -SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *, Pgno, const u8 *); - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -SQLITE_PRIVATE void sqlite3AnalyzeFunctions(void); -SQLITE_PRIVATE int sqlite3Stat4ProbeSetValue(Parse*,Index*,UnpackedRecord**,Expr*,u8,int,int*); -SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord*); -#endif - -/* -** The interface to the LEMON-generated parser -*/ -SQLITE_PRIVATE void *sqlite3ParserAlloc(void*(*)(size_t)); -SQLITE_PRIVATE void sqlite3ParserFree(void*, void(*)(void*)); -SQLITE_PRIVATE void sqlite3Parser(void*, int, Token, Parse*); -#ifdef YYTRACKMAXSTACKDEPTH -SQLITE_PRIVATE int sqlite3ParserStackPeak(void*); -#endif - -SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3*); -#ifndef SQLITE_OMIT_LOAD_EXTENSION -SQLITE_PRIVATE void sqlite3CloseExtensions(sqlite3*); -#else -# define sqlite3CloseExtensions(X) -#endif - -#ifndef SQLITE_OMIT_SHARED_CACHE -SQLITE_PRIVATE void sqlite3TableLock(Parse *, int, int, u8, const char *); -#else - #define sqlite3TableLock(v,w,x,y,z) -#endif - -#ifdef SQLITE_TEST -SQLITE_PRIVATE int sqlite3Utf8To8(unsigned char*); -#endif - -#ifdef SQLITE_OMIT_VIRTUALTABLE -# define sqlite3VtabClear(Y) -# define sqlite3VtabSync(X,Y) SQLITE_OK -# define sqlite3VtabRollback(X) -# define sqlite3VtabCommit(X) -# define sqlite3VtabInSync(db) 0 -# define sqlite3VtabLock(X) -# define sqlite3VtabUnlock(X) -# define sqlite3VtabUnlockList(X) -# define sqlite3VtabSavepoint(X, Y, Z) SQLITE_OK -# define sqlite3GetVTable(X,Y) ((VTable*)0) -#else -SQLITE_PRIVATE void sqlite3VtabClear(sqlite3 *db, Table*); -SQLITE_PRIVATE void sqlite3VtabDisconnect(sqlite3 *db, Table *p); -SQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, Vdbe*); -SQLITE_PRIVATE int sqlite3VtabRollback(sqlite3 *db); -SQLITE_PRIVATE int sqlite3VtabCommit(sqlite3 *db); -SQLITE_PRIVATE void sqlite3VtabLock(VTable *); -SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *); -SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3*); -SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *, int, int); -SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe*, sqlite3_vtab*); -SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3*, Table*); -# define sqlite3VtabInSync(db) ((db)->nVTrans>0 && (db)->aVTrans==0) -#endif -SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse*,Table*); -SQLITE_PRIVATE void sqlite3VtabBeginParse(Parse*, Token*, Token*, Token*, int); -SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse*, Token*); -SQLITE_PRIVATE void sqlite3VtabArgInit(Parse*); -SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse*, Token*); -SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3*, int, const char *, char **); -SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse*, Table*); -SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3*, int, const char *); -SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *, VTable *); -SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction(sqlite3 *,FuncDef*, int nArg, Expr*); -SQLITE_PRIVATE void sqlite3InvalidFunction(sqlite3_context*,int,sqlite3_value**); -SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context*); -SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe*, const char*, int); -SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *, sqlite3_stmt *); -SQLITE_PRIVATE void sqlite3ParserReset(Parse*); -SQLITE_PRIVATE int sqlite3Reprepare(Vdbe*); -SQLITE_PRIVATE void sqlite3ExprListCheckLength(Parse*, ExprList*, const char*); -SQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq(Parse *, Expr *, Expr *); -SQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3*); -SQLITE_PRIVATE const char *sqlite3JournalModename(int); -#ifndef SQLITE_OMIT_WAL -SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3*, int, int, int*, int*); -SQLITE_PRIVATE int sqlite3WalDefaultHook(void*,sqlite3*,const char*,int); -#endif -#ifndef SQLITE_OMIT_CTE -SQLITE_PRIVATE With *sqlite3WithAdd(Parse*,With*,Token*,ExprList*,Select*); -SQLITE_PRIVATE void sqlite3WithDelete(sqlite3*,With*); -SQLITE_PRIVATE void sqlite3WithPush(Parse*, With*, u8); -#else -#define sqlite3WithPush(x,y,z) -#define sqlite3WithDelete(x,y) -#endif - -/* Declarations for functions in fkey.c. All of these are replaced by -** no-op macros if OMIT_FOREIGN_KEY is defined. In this case no foreign -** key functionality is available. If OMIT_TRIGGER is defined but -** OMIT_FOREIGN_KEY is not, only some of the functions are no-oped. In -** this case foreign keys are parsed, but no other functionality is -** provided (enforcement of FK constraints requires the triggers sub-system). -*/ -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) -SQLITE_PRIVATE void sqlite3FkCheck(Parse*, Table*, int, int, int*, int); -SQLITE_PRIVATE void sqlite3FkDropTable(Parse*, SrcList *, Table*); -SQLITE_PRIVATE void sqlite3FkActions(Parse*, Table*, ExprList*, int, int*, int); -SQLITE_PRIVATE int sqlite3FkRequired(Parse*, Table*, int*, int); -SQLITE_PRIVATE u32 sqlite3FkOldmask(Parse*, Table*); -SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *); -#else - #define sqlite3FkActions(a,b,c,d,e,f) - #define sqlite3FkCheck(a,b,c,d,e,f) - #define sqlite3FkDropTable(a,b,c) - #define sqlite3FkOldmask(a,b) 0 - #define sqlite3FkRequired(a,b,c,d) 0 -#endif -#ifndef SQLITE_OMIT_FOREIGN_KEY -SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *, Table*); -SQLITE_PRIVATE int sqlite3FkLocateIndex(Parse*,Table*,FKey*,Index**,int**); -#else - #define sqlite3FkDelete(a,b) - #define sqlite3FkLocateIndex(a,b,c,d,e) -#endif - - -/* -** Available fault injectors. Should be numbered beginning with 0. -*/ -#define SQLITE_FAULTINJECTOR_MALLOC 0 -#define SQLITE_FAULTINJECTOR_COUNT 1 - -/* -** The interface to the code in fault.c used for identifying "benign" -** malloc failures. This is only present if SQLITE_OMIT_BUILTIN_TEST -** is not defined. -*/ -#ifndef SQLITE_OMIT_BUILTIN_TEST -SQLITE_PRIVATE void sqlite3BeginBenignMalloc(void); -SQLITE_PRIVATE void sqlite3EndBenignMalloc(void); -#else - #define sqlite3BeginBenignMalloc() - #define sqlite3EndBenignMalloc() -#endif - -#define IN_INDEX_ROWID 1 -#define IN_INDEX_EPH 2 -#define IN_INDEX_INDEX_ASC 3 -#define IN_INDEX_INDEX_DESC 4 -SQLITE_PRIVATE int sqlite3FindInIndex(Parse *, Expr *, int*); - -#ifdef SQLITE_ENABLE_ATOMIC_WRITE -SQLITE_PRIVATE int sqlite3JournalOpen(sqlite3_vfs *, const char *, sqlite3_file *, int, int); -SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *); -SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *); -SQLITE_PRIVATE int sqlite3JournalExists(sqlite3_file *p); -#else - #define sqlite3JournalSize(pVfs) ((pVfs)->szOsFile) - #define sqlite3JournalExists(p) 1 -#endif - -SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *); -SQLITE_PRIVATE int sqlite3MemJournalSize(void); -SQLITE_PRIVATE int sqlite3IsMemJournal(sqlite3_file *); - -#if SQLITE_MAX_EXPR_DEPTH>0 -SQLITE_PRIVATE void sqlite3ExprSetHeight(Parse *pParse, Expr *p); -SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *); -SQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse*, int); -#else - #define sqlite3ExprSetHeight(x,y) - #define sqlite3SelectExprHeight(x) 0 - #define sqlite3ExprCheckHeight(x,y) -#endif - -SQLITE_PRIVATE u32 sqlite3Get4byte(const u8*); -SQLITE_PRIVATE void sqlite3Put4byte(u8*, u32); - -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY -SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *, sqlite3 *); -SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db); -SQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db); -#else - #define sqlite3ConnectionBlocked(x,y) - #define sqlite3ConnectionUnlocked(x) - #define sqlite3ConnectionClosed(x) -#endif - -#ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3ParserTrace(FILE*, char *); -#endif - -/* -** If the SQLITE_ENABLE IOTRACE exists then the global variable -** sqlite3IoTrace is a pointer to a printf-like routine used to -** print I/O tracing messages. -*/ -#ifdef SQLITE_ENABLE_IOTRACE -# define IOTRACE(A) if( sqlite3IoTrace ){ sqlite3IoTrace A; } -SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe*); -SQLITE_PRIVATE void (*sqlite3IoTrace)(const char*,...); -#else -# define IOTRACE(A) -# define sqlite3VdbeIOTraceSql(X) -#endif - -/* -** These routines are available for the mem2.c debugging memory allocator -** only. They are used to verify that different "types" of memory -** allocations are properly tracked by the system. -** -** sqlite3MemdebugSetType() sets the "type" of an allocation to one of -** the MEMTYPE_* macros defined below. The type must be a bitmask with -** a single bit set. -** -** sqlite3MemdebugHasType() returns true if any of the bits in its second -** argument match the type set by the previous sqlite3MemdebugSetType(). -** sqlite3MemdebugHasType() is intended for use inside assert() statements. -** -** sqlite3MemdebugNoType() returns true if none of the bits in its second -** argument match the type set by the previous sqlite3MemdebugSetType(). -** -** Perhaps the most important point is the difference between MEMTYPE_HEAP -** and MEMTYPE_LOOKASIDE. If an allocation is MEMTYPE_LOOKASIDE, that means -** it might have been allocated by lookaside, except the allocation was -** too large or lookaside was already full. It is important to verify -** that allocations that might have been satisfied by lookaside are not -** passed back to non-lookaside free() routines. Asserts such as the -** example above are placed on the non-lookaside free() routines to verify -** this constraint. -** -** All of this is no-op for a production build. It only comes into -** play when the SQLITE_MEMDEBUG compile-time option is used. -*/ -#ifdef SQLITE_MEMDEBUG -SQLITE_PRIVATE void sqlite3MemdebugSetType(void*,u8); -SQLITE_PRIVATE int sqlite3MemdebugHasType(void*,u8); -SQLITE_PRIVATE int sqlite3MemdebugNoType(void*,u8); -#else -# define sqlite3MemdebugSetType(X,Y) /* no-op */ -# define sqlite3MemdebugHasType(X,Y) 1 -# define sqlite3MemdebugNoType(X,Y) 1 -#endif -#define MEMTYPE_HEAP 0x01 /* General heap allocations */ -#define MEMTYPE_LOOKASIDE 0x02 /* Might have been lookaside memory */ -#define MEMTYPE_SCRATCH 0x04 /* Scratch allocations */ -#define MEMTYPE_PCACHE 0x08 /* Page cache allocations */ -#define MEMTYPE_DB 0x10 /* Uses sqlite3DbMalloc, not sqlite_malloc */ - -#endif /* _SQLITEINT_H_ */ - -/************** End of sqliteInt.h *******************************************/ -/************** Begin file global.c ******************************************/ -/* -** 2008 June 13 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains definitions of global variables and contants. -*/ - -/* An array to map all upper-case characters into their corresponding -** lower-case character. -** -** SQLite only considers US-ASCII (or EBCDIC) characters. We do not -** handle case conversions for the UTF character set since the tables -** involved are nearly as big or bigger than SQLite itself. -*/ -SQLITE_PRIVATE const unsigned char sqlite3UpperToLower[] = { -#ifdef SQLITE_ASCII - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, - 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, - 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 97, 98, 99,100,101,102,103, - 104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121, - 122, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,103,104,105,106,107, - 108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125, - 126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161, - 162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179, - 180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197, - 198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215, - 216,217,218,219,220,221,222,223,224,225,226,227,228,229,230,231,232,233, - 234,235,236,237,238,239,240,241,242,243,244,245,246,247,248,249,250,251, - 252,253,254,255 -#endif -#ifdef SQLITE_EBCDIC - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, /* 0x */ - 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, /* 1x */ - 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, /* 2x */ - 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, /* 3x */ - 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, /* 4x */ - 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, /* 5x */ - 96, 97, 66, 67, 68, 69, 70, 71, 72, 73,106,107,108,109,110,111, /* 6x */ - 112, 81, 82, 83, 84, 85, 86, 87, 88, 89,122,123,124,125,126,127, /* 7x */ - 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143, /* 8x */ - 144,145,146,147,148,149,150,151,152,153,154,155,156,157,156,159, /* 9x */ - 160,161,162,163,164,165,166,167,168,169,170,171,140,141,142,175, /* Ax */ - 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191, /* Bx */ - 192,129,130,131,132,133,134,135,136,137,202,203,204,205,206,207, /* Cx */ - 208,145,146,147,148,149,150,151,152,153,218,219,220,221,222,223, /* Dx */ - 224,225,162,163,164,165,166,167,168,169,232,203,204,205,206,207, /* Ex */ - 239,240,241,242,243,244,245,246,247,248,249,219,220,221,222,255, /* Fx */ -#endif -}; - -/* -** The following 256 byte lookup table is used to support SQLites built-in -** equivalents to the following standard library functions: -** -** isspace() 0x01 -** isalpha() 0x02 -** isdigit() 0x04 -** isalnum() 0x06 -** isxdigit() 0x08 -** toupper() 0x20 -** SQLite identifier character 0x40 -** -** Bit 0x20 is set if the mapped character requires translation to upper -** case. i.e. if the character is a lower-case ASCII character. -** If x is a lower-case ASCII character, then its upper-case equivalent -** is (x - 0x20). Therefore toupper() can be implemented as: -** -** (x & ~(map[x]&0x20)) -** -** Standard function tolower() is implemented using the sqlite3UpperToLower[] -** array. tolower() is used more often than toupper() by SQLite. -** -** Bit 0x40 is set if the character non-alphanumeric and can be used in an -** SQLite identifier. Identifiers are alphanumerics, "_", "$", and any -** non-ASCII UTF character. Hence the test for whether or not a character is -** part of an identifier is 0x46. -** -** SQLite's versions are identical to the standard versions assuming a -** locale of "C". They are implemented as macros in sqliteInt.h. -*/ -#ifdef SQLITE_ASCII -SQLITE_PRIVATE const unsigned char sqlite3CtypeMap[256] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 00..07 ........ */ - 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, /* 08..0f ........ */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 10..17 ........ */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 18..1f ........ */ - 0x01, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, /* 20..27 !"#$%&' */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 28..2f ()*+,-./ */ - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, /* 30..37 01234567 */ - 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38..3f 89:;<=>? */ - - 0x00, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x02, /* 40..47 @ABCDEFG */ - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 48..4f HIJKLMNO */ - 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02, /* 50..57 PQRSTUVW */ - 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x40, /* 58..5f XYZ[\]^_ */ - 0x00, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x2a, 0x22, /* 60..67 `abcdefg */ - 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 68..6f hijklmno */ - 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, /* 70..77 pqrstuvw */ - 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78..7f xyz{|}~. */ - - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 80..87 ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 88..8f ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 90..97 ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* 98..9f ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a0..a7 ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* a8..af ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* b0..b7 ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* b8..bf ........ */ - - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* c0..c7 ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* c8..cf ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* d0..d7 ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* d8..df ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* e0..e7 ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* e8..ef ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, /* f0..f7 ........ */ - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40 /* f8..ff ........ */ -}; -#endif - -#ifndef SQLITE_USE_URI -# define SQLITE_USE_URI 0 -#endif - -#ifndef SQLITE_ALLOW_COVERING_INDEX_SCAN -# define SQLITE_ALLOW_COVERING_INDEX_SCAN 1 -#endif - -/* -** The following singleton contains the global configuration for -** the SQLite library. -*/ -SQLITE_PRIVATE SQLITE_WSD struct Sqlite3Config sqlite3Config = { - SQLITE_DEFAULT_MEMSTATUS, /* bMemstat */ - 1, /* bCoreMutex */ - SQLITE_THREADSAFE==1, /* bFullMutex */ - SQLITE_USE_URI, /* bOpenUri */ - SQLITE_ALLOW_COVERING_INDEX_SCAN, /* bUseCis */ - 0x7ffffffe, /* mxStrlen */ - 0, /* neverCorrupt */ - 128, /* szLookaside */ - 500, /* nLookaside */ - {0,0,0,0,0,0,0,0}, /* m */ - {0,0,0,0,0,0,0,0,0}, /* mutex */ - {0,0,0,0,0,0,0,0,0,0,0,0,0},/* pcache2 */ - (void*)0, /* pHeap */ - 0, /* nHeap */ - 0, 0, /* mnHeap, mxHeap */ - SQLITE_DEFAULT_MMAP_SIZE, /* szMmap */ - SQLITE_MAX_MMAP_SIZE, /* mxMmap */ - (void*)0, /* pScratch */ - 0, /* szScratch */ - 0, /* nScratch */ - (void*)0, /* pPage */ - 0, /* szPage */ - 0, /* nPage */ - 0, /* mxParserStack */ - 0, /* sharedCacheEnabled */ - /* All the rest should always be initialized to zero */ - 0, /* isInit */ - 0, /* inProgress */ - 0, /* isMutexInit */ - 0, /* isMallocInit */ - 0, /* isPCacheInit */ - 0, /* pInitMutex */ - 0, /* nRefInitMutex */ - 0, /* xLog */ - 0, /* pLogArg */ - 0, /* bLocaltimeFault */ -#ifdef SQLITE_ENABLE_SQLLOG - 0, /* xSqllog */ - 0 /* pSqllogArg */ -#endif -}; - -/* -** Hash table for global functions - functions common to all -** database connections. After initialization, this table is -** read-only. -*/ -SQLITE_PRIVATE SQLITE_WSD FuncDefHash sqlite3GlobalFunctions; - -/* -** Constant tokens for values 0 and 1. -*/ -SQLITE_PRIVATE const Token sqlite3IntTokens[] = { - { "0", 1 }, - { "1", 1 } -}; - - -/* -** The value of the "pending" byte must be 0x40000000 (1 byte past the -** 1-gibabyte boundary) in a compatible database. SQLite never uses -** the database page that contains the pending byte. It never attempts -** to read or write that page. The pending byte page is set assign -** for use by the VFS layers as space for managing file locks. -** -** During testing, it is often desirable to move the pending byte to -** a different position in the file. This allows code that has to -** deal with the pending byte to run on files that are much smaller -** than 1 GiB. The sqlite3_test_control() interface can be used to -** move the pending byte. -** -** IMPORTANT: Changing the pending byte to any value other than -** 0x40000000 results in an incompatible database file format! -** Changing the pending byte during operating results in undefined -** and dileterious behavior. -*/ -#ifndef SQLITE_OMIT_WSD -SQLITE_PRIVATE int sqlite3PendingByte = 0x40000000; -#endif - -/* -** Properties of opcodes. The OPFLG_INITIALIZER macro is -** created by mkopcodeh.awk during compilation. Data is obtained -** from the comments following the "case OP_xxxx:" statements in -** the vdbe.c file. -*/ -SQLITE_PRIVATE const unsigned char sqlite3OpcodeProperty[] = OPFLG_INITIALIZER; - -/************** End of global.c **********************************************/ -/************** Begin file ctime.c *******************************************/ -/* -** 2010 February 23 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file implements routines used to report what compile-time options -** SQLite was built with. -*/ - -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS - - -/* -** An array of names of all compile-time options. This array should -** be sorted A-Z. -** -** This array looks large, but in a typical installation actually uses -** only a handful of compile-time options, so most times this array is usually -** rather short and uses little memory space. -*/ -static const char * const azCompileOpt[] = { - -/* These macros are provided to "stringify" the value of the define -** for those options in which the value is meaningful. */ -#define CTIMEOPT_VAL_(opt) #opt -#define CTIMEOPT_VAL(opt) CTIMEOPT_VAL_(opt) - -#ifdef SQLITE_32BIT_ROWID - "32BIT_ROWID", -#endif -#ifdef SQLITE_4_BYTE_ALIGNED_MALLOC - "4_BYTE_ALIGNED_MALLOC", -#endif -#ifdef SQLITE_CASE_SENSITIVE_LIKE - "CASE_SENSITIVE_LIKE", -#endif -#ifdef SQLITE_CHECK_PAGES - "CHECK_PAGES", -#endif -#ifdef SQLITE_COVERAGE_TEST - "COVERAGE_TEST", -#endif -#ifdef SQLITE_DEBUG - "DEBUG", -#endif -#ifdef SQLITE_DEFAULT_LOCKING_MODE - "DEFAULT_LOCKING_MODE=" CTIMEOPT_VAL(SQLITE_DEFAULT_LOCKING_MODE), -#endif -#if defined(SQLITE_DEFAULT_MMAP_SIZE) && !defined(SQLITE_DEFAULT_MMAP_SIZE_xc) - "DEFAULT_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_DEFAULT_MMAP_SIZE), -#endif -#ifdef SQLITE_DISABLE_DIRSYNC - "DISABLE_DIRSYNC", -#endif -#ifdef SQLITE_DISABLE_LFS - "DISABLE_LFS", -#endif -#ifdef SQLITE_ENABLE_ATOMIC_WRITE - "ENABLE_ATOMIC_WRITE", -#endif -#ifdef SQLITE_ENABLE_CEROD - "ENABLE_CEROD", -#endif -#ifdef SQLITE_ENABLE_COLUMN_METADATA - "ENABLE_COLUMN_METADATA", -#endif -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT - "ENABLE_EXPENSIVE_ASSERT", -#endif -#ifdef SQLITE_ENABLE_FTS1 - "ENABLE_FTS1", -#endif -#ifdef SQLITE_ENABLE_FTS2 - "ENABLE_FTS2", -#endif -#ifdef SQLITE_ENABLE_FTS3 - "ENABLE_FTS3", -#endif -#ifdef SQLITE_ENABLE_FTS3_PARENTHESIS - "ENABLE_FTS3_PARENTHESIS", -#endif -#ifdef SQLITE_ENABLE_FTS4 - "ENABLE_FTS4", -#endif -#ifdef SQLITE_ENABLE_ICU - "ENABLE_ICU", -#endif -#ifdef SQLITE_ENABLE_IOTRACE - "ENABLE_IOTRACE", -#endif -#ifdef SQLITE_ENABLE_LOAD_EXTENSION - "ENABLE_LOAD_EXTENSION", -#endif -#ifdef SQLITE_ENABLE_LOCKING_STYLE - "ENABLE_LOCKING_STYLE=" CTIMEOPT_VAL(SQLITE_ENABLE_LOCKING_STYLE), -#endif -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT - "ENABLE_MEMORY_MANAGEMENT", -#endif -#ifdef SQLITE_ENABLE_MEMSYS3 - "ENABLE_MEMSYS3", -#endif -#ifdef SQLITE_ENABLE_MEMSYS5 - "ENABLE_MEMSYS5", -#endif -#ifdef SQLITE_ENABLE_OVERSIZE_CELL_CHECK - "ENABLE_OVERSIZE_CELL_CHECK", -#endif -#ifdef SQLITE_ENABLE_RTREE - "ENABLE_RTREE", -#endif -#if defined(SQLITE_ENABLE_STAT4) - "ENABLE_STAT4", -#elif defined(SQLITE_ENABLE_STAT3) - "ENABLE_STAT3", -#endif -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY - "ENABLE_UNLOCK_NOTIFY", -#endif -#ifdef SQLITE_ENABLE_UPDATE_DELETE_LIMIT - "ENABLE_UPDATE_DELETE_LIMIT", -#endif -#ifdef SQLITE_HAS_CODEC - "HAS_CODEC", -#endif -#ifdef SQLITE_HAVE_ISNAN - "HAVE_ISNAN", -#endif -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX - "HOMEGROWN_RECURSIVE_MUTEX", -#endif -#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS - "IGNORE_AFP_LOCK_ERRORS", -#endif -#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS - "IGNORE_FLOCK_LOCK_ERRORS", -#endif -#ifdef SQLITE_INT64_TYPE - "INT64_TYPE", -#endif -#ifdef SQLITE_LOCK_TRACE - "LOCK_TRACE", -#endif -#if defined(SQLITE_MAX_MMAP_SIZE) && !defined(SQLITE_MAX_MMAP_SIZE_xc) - "MAX_MMAP_SIZE=" CTIMEOPT_VAL(SQLITE_MAX_MMAP_SIZE), -#endif -#ifdef SQLITE_MAX_SCHEMA_RETRY - "MAX_SCHEMA_RETRY=" CTIMEOPT_VAL(SQLITE_MAX_SCHEMA_RETRY), -#endif -#ifdef SQLITE_MEMDEBUG - "MEMDEBUG", -#endif -#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT - "MIXED_ENDIAN_64BIT_FLOAT", -#endif -#ifdef SQLITE_NO_SYNC - "NO_SYNC", -#endif -#ifdef SQLITE_OMIT_ALTERTABLE - "OMIT_ALTERTABLE", -#endif -#ifdef SQLITE_OMIT_ANALYZE - "OMIT_ANALYZE", -#endif -#ifdef SQLITE_OMIT_ATTACH - "OMIT_ATTACH", -#endif -#ifdef SQLITE_OMIT_AUTHORIZATION - "OMIT_AUTHORIZATION", -#endif -#ifdef SQLITE_OMIT_AUTOINCREMENT - "OMIT_AUTOINCREMENT", -#endif -#ifdef SQLITE_OMIT_AUTOINIT - "OMIT_AUTOINIT", -#endif -#ifdef SQLITE_OMIT_AUTOMATIC_INDEX - "OMIT_AUTOMATIC_INDEX", -#endif -#ifdef SQLITE_OMIT_AUTORESET - "OMIT_AUTORESET", -#endif -#ifdef SQLITE_OMIT_AUTOVACUUM - "OMIT_AUTOVACUUM", -#endif -#ifdef SQLITE_OMIT_BETWEEN_OPTIMIZATION - "OMIT_BETWEEN_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_BLOB_LITERAL - "OMIT_BLOB_LITERAL", -#endif -#ifdef SQLITE_OMIT_BTREECOUNT - "OMIT_BTREECOUNT", -#endif -#ifdef SQLITE_OMIT_BUILTIN_TEST - "OMIT_BUILTIN_TEST", -#endif -#ifdef SQLITE_OMIT_CAST - "OMIT_CAST", -#endif -#ifdef SQLITE_OMIT_CHECK - "OMIT_CHECK", -#endif -#ifdef SQLITE_OMIT_COMPLETE - "OMIT_COMPLETE", -#endif -#ifdef SQLITE_OMIT_COMPOUND_SELECT - "OMIT_COMPOUND_SELECT", -#endif -#ifdef SQLITE_OMIT_DATETIME_FUNCS - "OMIT_DATETIME_FUNCS", -#endif -#ifdef SQLITE_OMIT_DECLTYPE - "OMIT_DECLTYPE", -#endif -#ifdef SQLITE_OMIT_DEPRECATED - "OMIT_DEPRECATED", -#endif -#ifdef SQLITE_OMIT_DISKIO - "OMIT_DISKIO", -#endif -#ifdef SQLITE_OMIT_EXPLAIN - "OMIT_EXPLAIN", -#endif -#ifdef SQLITE_OMIT_FLAG_PRAGMAS - "OMIT_FLAG_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_FLOATING_POINT - "OMIT_FLOATING_POINT", -#endif -#ifdef SQLITE_OMIT_FOREIGN_KEY - "OMIT_FOREIGN_KEY", -#endif -#ifdef SQLITE_OMIT_GET_TABLE - "OMIT_GET_TABLE", -#endif -#ifdef SQLITE_OMIT_INCRBLOB - "OMIT_INCRBLOB", -#endif -#ifdef SQLITE_OMIT_INTEGRITY_CHECK - "OMIT_INTEGRITY_CHECK", -#endif -#ifdef SQLITE_OMIT_LIKE_OPTIMIZATION - "OMIT_LIKE_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_LOAD_EXTENSION - "OMIT_LOAD_EXTENSION", -#endif -#ifdef SQLITE_OMIT_LOCALTIME - "OMIT_LOCALTIME", -#endif -#ifdef SQLITE_OMIT_LOOKASIDE - "OMIT_LOOKASIDE", -#endif -#ifdef SQLITE_OMIT_MEMORYDB - "OMIT_MEMORYDB", -#endif -#ifdef SQLITE_OMIT_OR_OPTIMIZATION - "OMIT_OR_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_PAGER_PRAGMAS - "OMIT_PAGER_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_PRAGMA - "OMIT_PRAGMA", -#endif -#ifdef SQLITE_OMIT_PROGRESS_CALLBACK - "OMIT_PROGRESS_CALLBACK", -#endif -#ifdef SQLITE_OMIT_QUICKBALANCE - "OMIT_QUICKBALANCE", -#endif -#ifdef SQLITE_OMIT_REINDEX - "OMIT_REINDEX", -#endif -#ifdef SQLITE_OMIT_SCHEMA_PRAGMAS - "OMIT_SCHEMA_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS - "OMIT_SCHEMA_VERSION_PRAGMAS", -#endif -#ifdef SQLITE_OMIT_SHARED_CACHE - "OMIT_SHARED_CACHE", -#endif -#ifdef SQLITE_OMIT_SUBQUERY - "OMIT_SUBQUERY", -#endif -#ifdef SQLITE_OMIT_TCL_VARIABLE - "OMIT_TCL_VARIABLE", -#endif -#ifdef SQLITE_OMIT_TEMPDB - "OMIT_TEMPDB", -#endif -#ifdef SQLITE_OMIT_TRACE - "OMIT_TRACE", -#endif -#ifdef SQLITE_OMIT_TRIGGER - "OMIT_TRIGGER", -#endif -#ifdef SQLITE_OMIT_TRUNCATE_OPTIMIZATION - "OMIT_TRUNCATE_OPTIMIZATION", -#endif -#ifdef SQLITE_OMIT_UTF16 - "OMIT_UTF16", -#endif -#ifdef SQLITE_OMIT_VACUUM - "OMIT_VACUUM", -#endif -#ifdef SQLITE_OMIT_VIEW - "OMIT_VIEW", -#endif -#ifdef SQLITE_OMIT_VIRTUALTABLE - "OMIT_VIRTUALTABLE", -#endif -#ifdef SQLITE_OMIT_WAL - "OMIT_WAL", -#endif -#ifdef SQLITE_OMIT_WSD - "OMIT_WSD", -#endif -#ifdef SQLITE_OMIT_XFER_OPT - "OMIT_XFER_OPT", -#endif -#ifdef SQLITE_PERFORMANCE_TRACE - "PERFORMANCE_TRACE", -#endif -#ifdef SQLITE_PROXY_DEBUG - "PROXY_DEBUG", -#endif -#ifdef SQLITE_RTREE_INT_ONLY - "RTREE_INT_ONLY", -#endif -#ifdef SQLITE_SECURE_DELETE - "SECURE_DELETE", -#endif -#ifdef SQLITE_SMALL_STACK - "SMALL_STACK", -#endif -#ifdef SQLITE_SOUNDEX - "SOUNDEX", -#endif -#ifdef SQLITE_SYSTEM_MALLOC - "SYSTEM_MALLOC", -#endif -#ifdef SQLITE_TCL - "TCL", -#endif -#if defined(SQLITE_TEMP_STORE) && !defined(SQLITE_TEMP_STORE_xc) - "TEMP_STORE=" CTIMEOPT_VAL(SQLITE_TEMP_STORE), -#endif -#ifdef SQLITE_TEST - "TEST", -#endif -#if defined(SQLITE_THREADSAFE) - "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), -#endif -#ifdef SQLITE_USE_ALLOCA - "USE_ALLOCA", -#endif -#ifdef SQLITE_WIN32_MALLOC - "WIN32_MALLOC", -#endif -#ifdef SQLITE_ZERO_MALLOC - "ZERO_MALLOC" -#endif -}; - -/* -** Given the name of a compile-time option, return true if that option -** was used and false if not. -** -** The name can optionally begin with "SQLITE_" but the "SQLITE_" prefix -** is not required for a match. -*/ -SQLITE_API int sqlite3_compileoption_used(const char *zOptName){ - int i, n; - if( sqlite3StrNICmp(zOptName, "SQLITE_", 7)==0 ) zOptName += 7; - n = sqlite3Strlen30(zOptName); - - /* Since ArraySize(azCompileOpt) is normally in single digits, a - ** linear search is adequate. No need for a binary search. */ - for(i=0; i=0 && NaDb[] (or -1) */ - u8 nullRow; /* True if pointing to a row with no data */ - u8 rowidIsValid; /* True if lastRowid is valid */ - u8 deferredMoveto; /* A call to sqlite3BtreeMoveto() is needed */ - Bool useRandomRowid:1;/* Generate new record numbers semi-randomly */ - Bool isTable:1; /* True if a table requiring integer keys */ - Bool isOrdered:1; /* True if the underlying table is BTREE_UNORDERED */ - Bool multiPseudo:1; /* Multi-register pseudo-cursor */ - sqlite3_vtab_cursor *pVtabCursor; /* The cursor for a virtual table */ - i64 seqCount; /* Sequence counter */ - i64 movetoTarget; /* Argument to the deferred sqlite3BtreeMoveto() */ - i64 lastRowid; /* Rowid being deleted by OP_Delete */ - VdbeSorter *pSorter; /* Sorter object for OP_SorterOpen cursors */ - - /* Cached information about the header for the data record that the - ** cursor is currently pointing to. Only valid if cacheStatus matches - ** Vdbe.cacheCtr. Vdbe.cacheCtr will never take on the value of - ** CACHE_STALE and so setting cacheStatus=CACHE_STALE guarantees that - ** the cache is out of date. - ** - ** aRow might point to (ephemeral) data for the current row, or it might - ** be NULL. - */ - u32 cacheStatus; /* Cache is valid if this matches Vdbe.cacheCtr */ - u32 payloadSize; /* Total number of bytes in the record */ - u32 szRow; /* Byte available in aRow */ - u32 iHdrOffset; /* Offset to next unparsed byte of the header */ - const u8 *aRow; /* Data for the current row, if all on one page */ - u32 aType[1]; /* Type values for all entries in the record */ - /* 2*nField extra array elements allocated for aType[], beyond the one - ** static element declared in the structure. nField total array slots for - ** aType[] and nField+1 array slots for aOffset[] */ -}; -typedef struct VdbeCursor VdbeCursor; - -/* -** When a sub-program is executed (OP_Program), a structure of this type -** is allocated to store the current value of the program counter, as -** well as the current memory cell array and various other frame specific -** values stored in the Vdbe struct. When the sub-program is finished, -** these values are copied back to the Vdbe from the VdbeFrame structure, -** restoring the state of the VM to as it was before the sub-program -** began executing. -** -** The memory for a VdbeFrame object is allocated and managed by a memory -** cell in the parent (calling) frame. When the memory cell is deleted or -** overwritten, the VdbeFrame object is not freed immediately. Instead, it -** is linked into the Vdbe.pDelFrame list. The contents of the Vdbe.pDelFrame -** list is deleted when the VM is reset in VdbeHalt(). The reason for doing -** this instead of deleting the VdbeFrame immediately is to avoid recursive -** calls to sqlite3VdbeMemRelease() when the memory cells belonging to the -** child frame are released. -** -** The currently executing frame is stored in Vdbe.pFrame. Vdbe.pFrame is -** set to NULL if the currently executing frame is the main program. -*/ -typedef struct VdbeFrame VdbeFrame; -struct VdbeFrame { - Vdbe *v; /* VM this frame belongs to */ - VdbeFrame *pParent; /* Parent of this frame, or NULL if parent is main */ - Op *aOp; /* Program instructions for parent frame */ - Mem *aMem; /* Array of memory cells for parent frame */ - u8 *aOnceFlag; /* Array of OP_Once flags for parent frame */ - VdbeCursor **apCsr; /* Array of Vdbe cursors for parent frame */ - void *token; /* Copy of SubProgram.token */ - i64 lastRowid; /* Last insert rowid (sqlite3.lastRowid) */ - int nCursor; /* Number of entries in apCsr */ - int pc; /* Program Counter in parent (calling) frame */ - int nOp; /* Size of aOp array */ - int nMem; /* Number of entries in aMem */ - int nOnceFlag; /* Number of entries in aOnceFlag */ - int nChildMem; /* Number of memory cells for child frame */ - int nChildCsr; /* Number of cursors for child frame */ - int nChange; /* Statement changes (Vdbe.nChanges) */ -}; - -#define VdbeFrameMem(p) ((Mem *)&((u8 *)p)[ROUND8(sizeof(VdbeFrame))]) - -/* -** A value for VdbeCursor.cacheValid that means the cache is always invalid. -*/ -#define CACHE_STALE 0 - -/* -** Internally, the vdbe manipulates nearly all SQL values as Mem -** structures. Each Mem struct may cache multiple representations (string, -** integer etc.) of the same value. -*/ -struct Mem { - sqlite3 *db; /* The associated database connection */ - char *z; /* String or BLOB value */ - double r; /* Real value */ - union { - i64 i; /* Integer value used when MEM_Int is set in flags */ - int nZero; /* Used when bit MEM_Zero is set in flags */ - FuncDef *pDef; /* Used only when flags==MEM_Agg */ - RowSet *pRowSet; /* Used only when flags==MEM_RowSet */ - VdbeFrame *pFrame; /* Used when flags==MEM_Frame */ - } u; - int n; /* Number of characters in string value, excluding '\0' */ - u16 flags; /* Some combination of MEM_Null, MEM_Str, MEM_Dyn, etc. */ - u8 type; /* One of SQLITE_NULL, SQLITE_TEXT, SQLITE_INTEGER, etc */ - u8 enc; /* SQLITE_UTF8, SQLITE_UTF16BE, SQLITE_UTF16LE */ -#ifdef SQLITE_DEBUG - Mem *pScopyFrom; /* This Mem is a shallow copy of pScopyFrom */ - void *pFiller; /* So that sizeof(Mem) is a multiple of 8 */ -#endif - void (*xDel)(void *); /* If not null, call this function to delete Mem.z */ - char *zMalloc; /* Dynamic buffer allocated by sqlite3_malloc() */ -}; - -/* One or more of the following flags are set to indicate the validOK -** representations of the value stored in the Mem struct. -** -** If the MEM_Null flag is set, then the value is an SQL NULL value. -** No other flags may be set in this case. -** -** If the MEM_Str flag is set then Mem.z points at a string representation. -** Usually this is encoded in the same unicode encoding as the main -** database (see below for exceptions). If the MEM_Term flag is also -** set, then the string is nul terminated. The MEM_Int and MEM_Real -** flags may coexist with the MEM_Str flag. -*/ -#define MEM_Null 0x0001 /* Value is NULL */ -#define MEM_Str 0x0002 /* Value is a string */ -#define MEM_Int 0x0004 /* Value is an integer */ -#define MEM_Real 0x0008 /* Value is a real number */ -#define MEM_Blob 0x0010 /* Value is a BLOB */ -#define MEM_RowSet 0x0020 /* Value is a RowSet object */ -#define MEM_Frame 0x0040 /* Value is a VdbeFrame object */ -#define MEM_Invalid 0x0080 /* Value is undefined */ -#define MEM_Cleared 0x0100 /* NULL set by OP_Null, not from data */ -#define MEM_TypeMask 0x01ff /* Mask of type bits */ - - -/* Whenever Mem contains a valid string or blob representation, one of -** the following flags must be set to determine the memory management -** policy for Mem.z. The MEM_Term flag tells us whether or not the -** string is \000 or \u0000 terminated -*/ -#define MEM_Term 0x0200 /* String rep is nul terminated */ -#define MEM_Dyn 0x0400 /* Need to call sqliteFree() on Mem.z */ -#define MEM_Static 0x0800 /* Mem.z points to a static string */ -#define MEM_Ephem 0x1000 /* Mem.z points to an ephemeral string */ -#define MEM_Agg 0x2000 /* Mem.z points to an agg function context */ -#define MEM_Zero 0x4000 /* Mem.i contains count of 0s appended to blob */ -#ifdef SQLITE_OMIT_INCRBLOB - #undef MEM_Zero - #define MEM_Zero 0x0000 -#endif - -/* -** Clear any existing type flags from a Mem and replace them with f -*/ -#define MemSetTypeFlag(p, f) \ - ((p)->flags = ((p)->flags&~(MEM_TypeMask|MEM_Zero))|f) - -/* -** Return true if a memory cell is not marked as invalid. This macro -** is for use inside assert() statements only. -*/ -#ifdef SQLITE_DEBUG -#define memIsValid(M) ((M)->flags & MEM_Invalid)==0 -#endif - -/* -** Each auxilliary data pointer stored by a user defined function -** implementation calling sqlite3_set_auxdata() is stored in an instance -** of this structure. All such structures associated with a single VM -** are stored in a linked list headed at Vdbe.pAuxData. All are destroyed -** when the VM is halted (if not before). -*/ -struct AuxData { - int iOp; /* Instruction number of OP_Function opcode */ - int iArg; /* Index of function argument. */ - void *pAux; /* Aux data pointer */ - void (*xDelete)(void *); /* Destructor for the aux data */ - AuxData *pNext; /* Next element in list */ -}; - -/* -** The "context" argument for a installable function. A pointer to an -** instance of this structure is the first argument to the routines used -** implement the SQL functions. -** -** There is a typedef for this structure in sqlite.h. So all routines, -** even the public interface to SQLite, can use a pointer to this structure. -** But this file is the only place where the internal details of this -** structure are known. -** -** This structure is defined inside of vdbeInt.h because it uses substructures -** (Mem) which are only defined there. -*/ -struct sqlite3_context { - FuncDef *pFunc; /* Pointer to function information. MUST BE FIRST */ - Mem s; /* The return value is stored here */ - Mem *pMem; /* Memory cell used to store aggregate context */ - CollSeq *pColl; /* Collating sequence */ - Vdbe *pVdbe; /* The VM that owns this context */ - int iOp; /* Instruction number of OP_Function */ - int isError; /* Error code returned by the function. */ - u8 skipFlag; /* Skip skip accumulator loading if true */ - u8 fErrorOrAux; /* isError!=0 or pVdbe->pAuxData modified */ -}; - -/* -** An Explain object accumulates indented output which is helpful -** in describing recursive data structures. -*/ -struct Explain { - Vdbe *pVdbe; /* Attach the explanation to this Vdbe */ - StrAccum str; /* The string being accumulated */ - int nIndent; /* Number of elements in aIndent */ - u16 aIndent[100]; /* Levels of indentation */ - char zBase[100]; /* Initial space */ -}; - -/* A bitfield type for use inside of structures. Always follow with :N where -** N is the number of bits. -*/ -typedef unsigned bft; /* Bit Field Type */ - -/* -** An instance of the virtual machine. This structure contains the complete -** state of the virtual machine. -** -** The "sqlite3_stmt" structure pointer that is returned by sqlite3_prepare() -** is really a pointer to an instance of this structure. -** -** The Vdbe.inVtabMethod variable is set to non-zero for the duration of -** any virtual table method invocations made by the vdbe program. It is -** set to 2 for xDestroy method calls and 1 for all other methods. This -** variable is used for two purposes: to allow xDestroy methods to execute -** "DROP TABLE" statements and to prevent some nasty side effects of -** malloc failure when SQLite is invoked recursively by a virtual table -** method function. -*/ -struct Vdbe { - sqlite3 *db; /* The database connection that owns this statement */ - Op *aOp; /* Space to hold the virtual machine's program */ - Mem *aMem; /* The memory locations */ - Mem **apArg; /* Arguments to currently executing user function */ - Mem *aColName; /* Column names to return */ - Mem *pResultSet; /* Pointer to an array of results */ - Parse *pParse; /* Parsing context used to create this Vdbe */ - int nMem; /* Number of memory locations currently allocated */ - int nOp; /* Number of instructions in the program */ - int nCursor; /* Number of slots in apCsr[] */ - u32 magic; /* Magic number for sanity checking */ - char *zErrMsg; /* Error message written here */ - Vdbe *pPrev,*pNext; /* Linked list of VDBEs with the same Vdbe.db */ - VdbeCursor **apCsr; /* One element of this array for each open cursor */ - Mem *aVar; /* Values for the OP_Variable opcode. */ - char **azVar; /* Name of variables */ - ynVar nVar; /* Number of entries in aVar[] */ - ynVar nzVar; /* Number of entries in azVar[] */ - u32 cacheCtr; /* VdbeCursor row cache generation counter */ - int pc; /* The program counter */ - int rc; /* Value to return */ - u16 nResColumn; /* Number of columns in one row of the result set */ - u8 errorAction; /* Recovery action to do in case of an error */ - u8 minWriteFileFormat; /* Minimum file format for writable database files */ - bft explain:2; /* True if EXPLAIN present on SQL command */ - bft inVtabMethod:2; /* See comments above */ - bft changeCntOn:1; /* True to update the change-counter */ - bft expired:1; /* True if the VM needs to be recompiled */ - bft runOnlyOnce:1; /* Automatically expire on reset */ - bft usesStmtJournal:1; /* True if uses a statement journal */ - bft readOnly:1; /* True for statements that do not write */ - bft bIsReader:1; /* True for statements that read */ - bft isPrepareV2:1; /* True if prepared with prepare_v2() */ - bft doingRerun:1; /* True if rerunning after an auto-reprepare */ - int nChange; /* Number of db changes made since last reset */ - yDbMask btreeMask; /* Bitmask of db->aDb[] entries referenced */ - yDbMask lockMask; /* Subset of btreeMask that requires a lock */ - int iStatement; /* Statement number (or 0 if has not opened stmt) */ - u32 aCounter[5]; /* Counters used by sqlite3_stmt_status() */ -#ifndef SQLITE_OMIT_TRACE - i64 startTime; /* Time when query started - used for profiling */ -#endif - i64 iCurrentTime; /* Value of julianday('now') for this statement */ - i64 nFkConstraint; /* Number of imm. FK constraints this VM */ - i64 nStmtDefCons; /* Number of def. constraints when stmt started */ - i64 nStmtDefImmCons; /* Number of def. imm constraints when stmt started */ - char *zSql; /* Text of the SQL statement that generated this */ - void *pFree; /* Free this when deleting the vdbe */ -#ifdef SQLITE_ENABLE_TREE_EXPLAIN - Explain *pExplain; /* The explainer */ - char *zExplain; /* Explanation of data structures */ -#endif - VdbeFrame *pFrame; /* Parent frame */ - VdbeFrame *pDelFrame; /* List of frame objects to free on VM reset */ - int nFrame; /* Number of frames in pFrame list */ - u32 expmask; /* Binding to these vars invalidates VM */ - SubProgram *pProgram; /* Linked list of all sub-programs used by VM */ - int nOnceFlag; /* Size of array aOnceFlag[] */ - u8 *aOnceFlag; /* Flags for OP_Once */ - AuxData *pAuxData; /* Linked list of auxdata allocations */ -}; - -/* -** The following are allowed values for Vdbe.magic -*/ -#define VDBE_MAGIC_INIT 0x26bceaa5 /* Building a VDBE program */ -#define VDBE_MAGIC_RUN 0xbdf20da3 /* VDBE is ready to execute */ -#define VDBE_MAGIC_HALT 0x519c2973 /* VDBE has completed execution */ -#define VDBE_MAGIC_DEAD 0xb606c3c8 /* The VDBE has been deallocated */ - -/* -** Function prototypes -*/ -SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *, VdbeCursor*); -void sqliteVdbePopStack(Vdbe*,int); -SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor*); -#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) -SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE*, int, Op*); -#endif -SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32); -SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem*, int); -SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(unsigned char*, Mem*, u32); -SQLITE_PRIVATE u32 sqlite3VdbeSerialGet(const unsigned char*, u32, Mem*); -SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(Vdbe*, int, int); - -int sqlite2BtreeKeyCompare(BtCursor *, const void *, int, int, int *); -SQLITE_PRIVATE int sqlite3VdbeIdxKeyCompare(VdbeCursor*,UnpackedRecord*,int*); -SQLITE_PRIVATE int sqlite3VdbeIdxRowid(sqlite3*, BtCursor *, i64 *); -SQLITE_PRIVATE int sqlite3MemCompare(const Mem*, const Mem*, const CollSeq*); -SQLITE_PRIVATE int sqlite3VdbeExec(Vdbe*); -SQLITE_PRIVATE int sqlite3VdbeList(Vdbe*); -SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe*); -SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *, int); -SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem*, const Mem*); -SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem*, const Mem*, int); -SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem*, Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemSetStr(Mem*, const char*, int, u8, void(*)(void*)); -SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem*, i64); -#ifdef SQLITE_OMIT_FLOATING_POINT -# define sqlite3VdbeMemSetDouble sqlite3VdbeMemSetInt64 -#else -SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem*, double); -#endif -SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem*); -SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem*,int); -SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem*, int); -SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem*); -SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem*); -SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem*); -SQLITE_PRIVATE int sqlite3VdbeMemFromBtree(BtCursor*,u32,u32,int,Mem*); -SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p); -SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p); -#define VdbeMemRelease(X) \ - if((X)->flags&(MEM_Agg|MEM_Dyn|MEM_RowSet|MEM_Frame)) \ - sqlite3VdbeMemReleaseExternal(X); -SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem*, FuncDef*); -SQLITE_PRIVATE const char *sqlite3OpcodeName(int); -SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int preserve); -SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *, int); -SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame*); -SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *); -SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem); -SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p); - -SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *, VdbeCursor *); -SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *, VdbeCursor *); -SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *, Mem *); -SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *, const VdbeCursor *, int *); -SQLITE_PRIVATE int sqlite3VdbeSorterRewind(sqlite3 *, const VdbeCursor *, int *); -SQLITE_PRIVATE int sqlite3VdbeSorterWrite(sqlite3 *, const VdbeCursor *, Mem *); -SQLITE_PRIVATE int sqlite3VdbeSorterCompare(const VdbeCursor *, Mem *, int, int *); - -#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0 -SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe*); -#else -# define sqlite3VdbeEnter(X) -# define sqlite3VdbeLeave(X) -#endif - -#ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe*,Mem*); -#endif - -#ifndef SQLITE_OMIT_FOREIGN_KEY -SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *, int); -#else -# define sqlite3VdbeCheckFk(p,i) 0 -#endif - -SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem*, u8); -#ifdef SQLITE_DEBUG -SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe*); -SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf); -#endif -SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem); - -#ifndef SQLITE_OMIT_INCRBLOB -SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *); - #define ExpandBlob(P) (((P)->flags&MEM_Zero)?sqlite3VdbeMemExpandBlob(P):0) -#else - #define sqlite3VdbeMemExpandBlob(x) SQLITE_OK - #define ExpandBlob(P) SQLITE_OK -#endif - -#endif /* !defined(_VDBEINT_H_) */ - -/************** End of vdbeInt.h *********************************************/ -/************** Continuing where we left off in status.c *********************/ - -/* -** Variables in which to record status information. -*/ -typedef struct sqlite3StatType sqlite3StatType; -static SQLITE_WSD struct sqlite3StatType { - int nowValue[10]; /* Current value */ - int mxValue[10]; /* Maximum value */ -} sqlite3Stat = { {0,}, {0,} }; - - -/* The "wsdStat" macro will resolve to the status information -** state vector. If writable static data is unsupported on the target, -** we have to locate the state vector at run-time. In the more common -** case where writable static data is supported, wsdStat can refer directly -** to the "sqlite3Stat" state vector declared above. -*/ -#ifdef SQLITE_OMIT_WSD -# define wsdStatInit sqlite3StatType *x = &GLOBAL(sqlite3StatType,sqlite3Stat) -# define wsdStat x[0] -#else -# define wsdStatInit -# define wsdStat sqlite3Stat -#endif - -/* -** Return the current value of a status parameter. -*/ -SQLITE_PRIVATE int sqlite3StatusValue(int op){ - wsdStatInit; - assert( op>=0 && op=0 && opwsdStat.mxValue[op] ){ - wsdStat.mxValue[op] = wsdStat.nowValue[op]; - } -} - -/* -** Set the value of a status to X. -*/ -SQLITE_PRIVATE void sqlite3StatusSet(int op, int X){ - wsdStatInit; - assert( op>=0 && opwsdStat.mxValue[op] ){ - wsdStat.mxValue[op] = wsdStat.nowValue[op]; - } -} - -/* -** Query status information. -** -** This implementation assumes that reading or writing an aligned -** 32-bit integer is an atomic operation. If that assumption is not true, -** then this routine is not threadsafe. -*/ -SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag){ - wsdStatInit; - if( op<0 || op>=ArraySize(wsdStat.nowValue) ){ - return SQLITE_MISUSE_BKPT; - } - *pCurrent = wsdStat.nowValue[op]; - *pHighwater = wsdStat.mxValue[op]; - if( resetFlag ){ - wsdStat.mxValue[op] = wsdStat.nowValue[op]; - } - return SQLITE_OK; -} - -/* -** Query status information for a single database connection -*/ -SQLITE_API int sqlite3_db_status( - sqlite3 *db, /* The database connection whose status is desired */ - int op, /* Status verb */ - int *pCurrent, /* Write current value here */ - int *pHighwater, /* Write high-water mark here */ - int resetFlag /* Reset high-water mark if true */ -){ - int rc = SQLITE_OK; /* Return code */ - sqlite3_mutex_enter(db->mutex); - switch( op ){ - case SQLITE_DBSTATUS_LOOKASIDE_USED: { - *pCurrent = db->lookaside.nOut; - *pHighwater = db->lookaside.mxOut; - if( resetFlag ){ - db->lookaside.mxOut = db->lookaside.nOut; - } - break; - } - - case SQLITE_DBSTATUS_LOOKASIDE_HIT: - case SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE: - case SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL: { - testcase( op==SQLITE_DBSTATUS_LOOKASIDE_HIT ); - testcase( op==SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE ); - testcase( op==SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL ); - assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)>=0 ); - assert( (op-SQLITE_DBSTATUS_LOOKASIDE_HIT)<3 ); - *pCurrent = 0; - *pHighwater = db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT]; - if( resetFlag ){ - db->lookaside.anStat[op - SQLITE_DBSTATUS_LOOKASIDE_HIT] = 0; - } - break; - } - - /* - ** Return an approximation for the amount of memory currently used - ** by all pagers associated with the given database connection. The - ** highwater mark is meaningless and is returned as zero. - */ - case SQLITE_DBSTATUS_CACHE_USED: { - int totalUsed = 0; - int i; - sqlite3BtreeEnterAll(db); - for(i=0; inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - Pager *pPager = sqlite3BtreePager(pBt); - totalUsed += sqlite3PagerMemUsed(pPager); - } - } - sqlite3BtreeLeaveAll(db); - *pCurrent = totalUsed; - *pHighwater = 0; - break; - } - - /* - ** *pCurrent gets an accurate estimate of the amount of memory used - ** to store the schema for all databases (main, temp, and any ATTACHed - ** databases. *pHighwater is set to zero. - */ - case SQLITE_DBSTATUS_SCHEMA_USED: { - int i; /* Used to iterate through schemas */ - int nByte = 0; /* Used to accumulate return value */ - - sqlite3BtreeEnterAll(db); - db->pnBytesFreed = &nByte; - for(i=0; inDb; i++){ - Schema *pSchema = db->aDb[i].pSchema; - if( ALWAYS(pSchema!=0) ){ - HashElem *p; - - nByte += sqlite3GlobalConfig.m.xRoundup(sizeof(HashElem)) * ( - pSchema->tblHash.count - + pSchema->trigHash.count - + pSchema->idxHash.count - + pSchema->fkeyHash.count - ); - nByte += sqlite3MallocSize(pSchema->tblHash.ht); - nByte += sqlite3MallocSize(pSchema->trigHash.ht); - nByte += sqlite3MallocSize(pSchema->idxHash.ht); - nByte += sqlite3MallocSize(pSchema->fkeyHash.ht); - - for(p=sqliteHashFirst(&pSchema->trigHash); p; p=sqliteHashNext(p)){ - sqlite3DeleteTrigger(db, (Trigger*)sqliteHashData(p)); - } - for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){ - sqlite3DeleteTable(db, (Table *)sqliteHashData(p)); - } - } - } - db->pnBytesFreed = 0; - sqlite3BtreeLeaveAll(db); - - *pHighwater = 0; - *pCurrent = nByte; - break; - } - - /* - ** *pCurrent gets an accurate estimate of the amount of memory used - ** to store all prepared statements. - ** *pHighwater is set to zero. - */ - case SQLITE_DBSTATUS_STMT_USED: { - struct Vdbe *pVdbe; /* Used to iterate through VMs */ - int nByte = 0; /* Used to accumulate return value */ - - db->pnBytesFreed = &nByte; - for(pVdbe=db->pVdbe; pVdbe; pVdbe=pVdbe->pNext){ - sqlite3VdbeClearObject(db, pVdbe); - sqlite3DbFree(db, pVdbe); - } - db->pnBytesFreed = 0; - - *pHighwater = 0; - *pCurrent = nByte; - - break; - } - - /* - ** Set *pCurrent to the total cache hits or misses encountered by all - ** pagers the database handle is connected to. *pHighwater is always set - ** to zero. - */ - case SQLITE_DBSTATUS_CACHE_HIT: - case SQLITE_DBSTATUS_CACHE_MISS: - case SQLITE_DBSTATUS_CACHE_WRITE:{ - int i; - int nRet = 0; - assert( SQLITE_DBSTATUS_CACHE_MISS==SQLITE_DBSTATUS_CACHE_HIT+1 ); - assert( SQLITE_DBSTATUS_CACHE_WRITE==SQLITE_DBSTATUS_CACHE_HIT+2 ); - - for(i=0; inDb; i++){ - if( db->aDb[i].pBt ){ - Pager *pPager = sqlite3BtreePager(db->aDb[i].pBt); - sqlite3PagerCacheStat(pPager, op, resetFlag, &nRet); - } - } - *pHighwater = 0; - *pCurrent = nRet; - break; - } - - /* Set *pCurrent to non-zero if there are unresolved deferred foreign - ** key constraints. Set *pCurrent to zero if all foreign key constraints - ** have been satisfied. The *pHighwater is always set to zero. - */ - case SQLITE_DBSTATUS_DEFERRED_FKS: { - *pHighwater = 0; - *pCurrent = db->nDeferredImmCons>0 || db->nDeferredCons>0; - break; - } - - default: { - rc = SQLITE_ERROR; - } - } - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/************** End of status.c **********************************************/ -/************** Begin file date.c ********************************************/ -/* -** 2003 October 31 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the C functions that implement date and time -** functions for SQLite. -** -** There is only one exported symbol in this file - the function -** sqlite3RegisterDateTimeFunctions() found at the bottom of the file. -** All other code has file scope. -** -** SQLite processes all times and dates as Julian Day numbers. The -** dates and times are stored as the number of days since noon -** in Greenwich on November 24, 4714 B.C. according to the Gregorian -** calendar system. -** -** 1970-01-01 00:00:00 is JD 2440587.5 -** 2000-01-01 00:00:00 is JD 2451544.5 -** -** This implemention requires years to be expressed as a 4-digit number -** which means that only dates between 0000-01-01 and 9999-12-31 can -** be represented, even though julian day numbers allow a much wider -** range of dates. -** -** The Gregorian calendar system is used for all dates and times, -** even those that predate the Gregorian calendar. Historians usually -** use the Julian calendar for dates prior to 1582-10-15 and for some -** dates afterwards, depending on locale. Beware of this difference. -** -** The conversion algorithms are implemented based on descriptions -** in the following text: -** -** Jean Meeus -** Astronomical Algorithms, 2nd Edition, 1998 -** ISBM 0-943396-61-1 -** Willmann-Bell, Inc -** Richmond, Virginia (USA) -*/ -/* #include */ -/* #include */ -#include - -#ifndef SQLITE_OMIT_DATETIME_FUNCS - - -/* -** A structure for holding a single date and time. -*/ -typedef struct DateTime DateTime; -struct DateTime { - sqlite3_int64 iJD; /* The julian day number times 86400000 */ - int Y, M, D; /* Year, month, and day */ - int h, m; /* Hour and minutes */ - int tz; /* Timezone offset in minutes */ - double s; /* Seconds */ - char validYMD; /* True (1) if Y,M,D are valid */ - char validHMS; /* True (1) if h,m,s are valid */ - char validJD; /* True (1) if iJD is valid */ - char validTZ; /* True (1) if tz is valid */ -}; - - -/* -** Convert zDate into one or more integers. Additional arguments -** come in groups of 5 as follows: -** -** N number of digits in the integer -** min minimum allowed value of the integer -** max maximum allowed value of the integer -** nextC first character after the integer -** pVal where to write the integers value. -** -** Conversions continue until one with nextC==0 is encountered. -** The function returns the number of successful conversions. -*/ -static int getDigits(const char *zDate, ...){ - va_list ap; - int val; - int N; - int min; - int max; - int nextC; - int *pVal; - int cnt = 0; - va_start(ap, zDate); - do{ - N = va_arg(ap, int); - min = va_arg(ap, int); - max = va_arg(ap, int); - nextC = va_arg(ap, int); - pVal = va_arg(ap, int*); - val = 0; - while( N-- ){ - if( !sqlite3Isdigit(*zDate) ){ - goto end_getDigits; - } - val = val*10 + *zDate - '0'; - zDate++; - } - if( valmax || (nextC!=0 && nextC!=*zDate) ){ - goto end_getDigits; - } - *pVal = val; - zDate++; - cnt++; - }while( nextC ); -end_getDigits: - va_end(ap); - return cnt; -} - -/* -** Parse a timezone extension on the end of a date-time. -** The extension is of the form: -** -** (+/-)HH:MM -** -** Or the "zulu" notation: -** -** Z -** -** If the parse is successful, write the number of minutes -** of change in p->tz and return 0. If a parser error occurs, -** return non-zero. -** -** A missing specifier is not considered an error. -*/ -static int parseTimezone(const char *zDate, DateTime *p){ - int sgn = 0; - int nHr, nMn; - int c; - while( sqlite3Isspace(*zDate) ){ zDate++; } - p->tz = 0; - c = *zDate; - if( c=='-' ){ - sgn = -1; - }else if( c=='+' ){ - sgn = +1; - }else if( c=='Z' || c=='z' ){ - zDate++; - goto zulu_time; - }else{ - return c!=0; - } - zDate++; - if( getDigits(zDate, 2, 0, 14, ':', &nHr, 2, 0, 59, 0, &nMn)!=2 ){ - return 1; - } - zDate += 5; - p->tz = sgn*(nMn + nHr*60); -zulu_time: - while( sqlite3Isspace(*zDate) ){ zDate++; } - return *zDate!=0; -} - -/* -** Parse times of the form HH:MM or HH:MM:SS or HH:MM:SS.FFFF. -** The HH, MM, and SS must each be exactly 2 digits. The -** fractional seconds FFFF can be one or more digits. -** -** Return 1 if there is a parsing error and 0 on success. -*/ -static int parseHhMmSs(const char *zDate, DateTime *p){ - int h, m, s; - double ms = 0.0; - if( getDigits(zDate, 2, 0, 24, ':', &h, 2, 0, 59, 0, &m)!=2 ){ - return 1; - } - zDate += 5; - if( *zDate==':' ){ - zDate++; - if( getDigits(zDate, 2, 0, 59, 0, &s)!=1 ){ - return 1; - } - zDate += 2; - if( *zDate=='.' && sqlite3Isdigit(zDate[1]) ){ - double rScale = 1.0; - zDate++; - while( sqlite3Isdigit(*zDate) ){ - ms = ms*10.0 + *zDate - '0'; - rScale *= 10.0; - zDate++; - } - ms /= rScale; - } - }else{ - s = 0; - } - p->validJD = 0; - p->validHMS = 1; - p->h = h; - p->m = m; - p->s = s + ms; - if( parseTimezone(zDate, p) ) return 1; - p->validTZ = (p->tz!=0)?1:0; - return 0; -} - -/* -** Convert from YYYY-MM-DD HH:MM:SS to julian day. We always assume -** that the YYYY-MM-DD is according to the Gregorian calendar. -** -** Reference: Meeus page 61 -*/ -static void computeJD(DateTime *p){ - int Y, M, D, A, B, X1, X2; - - if( p->validJD ) return; - if( p->validYMD ){ - Y = p->Y; - M = p->M; - D = p->D; - }else{ - Y = 2000; /* If no YMD specified, assume 2000-Jan-01 */ - M = 1; - D = 1; - } - if( M<=2 ){ - Y--; - M += 12; - } - A = Y/100; - B = 2 - A + (A/4); - X1 = 36525*(Y+4716)/100; - X2 = 306001*(M+1)/10000; - p->iJD = (sqlite3_int64)((X1 + X2 + D + B - 1524.5 ) * 86400000); - p->validJD = 1; - if( p->validHMS ){ - p->iJD += p->h*3600000 + p->m*60000 + (sqlite3_int64)(p->s*1000); - if( p->validTZ ){ - p->iJD -= p->tz*60000; - p->validYMD = 0; - p->validHMS = 0; - p->validTZ = 0; - } - } -} - -/* -** Parse dates of the form -** -** YYYY-MM-DD HH:MM:SS.FFF -** YYYY-MM-DD HH:MM:SS -** YYYY-MM-DD HH:MM -** YYYY-MM-DD -** -** Write the result into the DateTime structure and return 0 -** on success and 1 if the input string is not a well-formed -** date. -*/ -static int parseYyyyMmDd(const char *zDate, DateTime *p){ - int Y, M, D, neg; - - if( zDate[0]=='-' ){ - zDate++; - neg = 1; - }else{ - neg = 0; - } - if( getDigits(zDate,4,0,9999,'-',&Y,2,1,12,'-',&M,2,1,31,0,&D)!=3 ){ - return 1; - } - zDate += 10; - while( sqlite3Isspace(*zDate) || 'T'==*(u8*)zDate ){ zDate++; } - if( parseHhMmSs(zDate, p)==0 ){ - /* We got the time */ - }else if( *zDate==0 ){ - p->validHMS = 0; - }else{ - return 1; - } - p->validJD = 0; - p->validYMD = 1; - p->Y = neg ? -Y : Y; - p->M = M; - p->D = D; - if( p->validTZ ){ - computeJD(p); - } - return 0; -} - -/* -** Set the time to the current time reported by the VFS. -** -** Return the number of errors. -*/ -static int setDateTimeToCurrent(sqlite3_context *context, DateTime *p){ - p->iJD = sqlite3StmtCurrentTime(context); - if( p->iJD>0 ){ - p->validJD = 1; - return 0; - }else{ - return 1; - } -} - -/* -** Attempt to parse the given string into a Julian Day Number. Return -** the number of errors. -** -** The following are acceptable forms for the input string: -** -** YYYY-MM-DD HH:MM:SS.FFF +/-HH:MM -** DDDD.DD -** now -** -** In the first form, the +/-HH:MM is always optional. The fractional -** seconds extension (the ".FFF") is optional. The seconds portion -** (":SS.FFF") is option. The year and date can be omitted as long -** as there is a time string. The time string can be omitted as long -** as there is a year and date. -*/ -static int parseDateOrTime( - sqlite3_context *context, - const char *zDate, - DateTime *p -){ - double r; - if( parseYyyyMmDd(zDate,p)==0 ){ - return 0; - }else if( parseHhMmSs(zDate, p)==0 ){ - return 0; - }else if( sqlite3StrICmp(zDate,"now")==0){ - return setDateTimeToCurrent(context, p); - }else if( sqlite3AtoF(zDate, &r, sqlite3Strlen30(zDate), SQLITE_UTF8) ){ - p->iJD = (sqlite3_int64)(r*86400000.0 + 0.5); - p->validJD = 1; - return 0; - } - return 1; -} - -/* -** Compute the Year, Month, and Day from the julian day number. -*/ -static void computeYMD(DateTime *p){ - int Z, A, B, C, D, E, X1; - if( p->validYMD ) return; - if( !p->validJD ){ - p->Y = 2000; - p->M = 1; - p->D = 1; - }else{ - Z = (int)((p->iJD + 43200000)/86400000); - A = (int)((Z - 1867216.25)/36524.25); - A = Z + 1 + A - (A/4); - B = A + 1524; - C = (int)((B - 122.1)/365.25); - D = (36525*C)/100; - E = (int)((B-D)/30.6001); - X1 = (int)(30.6001*E); - p->D = B - D - X1; - p->M = E<14 ? E-1 : E-13; - p->Y = p->M>2 ? C - 4716 : C - 4715; - } - p->validYMD = 1; -} - -/* -** Compute the Hour, Minute, and Seconds from the julian day number. -*/ -static void computeHMS(DateTime *p){ - int s; - if( p->validHMS ) return; - computeJD(p); - s = (int)((p->iJD + 43200000) % 86400000); - p->s = s/1000.0; - s = (int)p->s; - p->s -= s; - p->h = s/3600; - s -= p->h*3600; - p->m = s/60; - p->s += s - p->m*60; - p->validHMS = 1; -} - -/* -** Compute both YMD and HMS -*/ -static void computeYMD_HMS(DateTime *p){ - computeYMD(p); - computeHMS(p); -} - -/* -** Clear the YMD and HMS and the TZ -*/ -static void clearYMD_HMS_TZ(DateTime *p){ - p->validYMD = 0; - p->validHMS = 0; - p->validTZ = 0; -} - -/* -** On recent Windows platforms, the localtime_s() function is available -** as part of the "Secure CRT". It is essentially equivalent to -** localtime_r() available under most POSIX platforms, except that the -** order of the parameters is reversed. -** -** See http://msdn.microsoft.com/en-us/library/a442x3ye(VS.80).aspx. -** -** If the user has not indicated to use localtime_r() or localtime_s() -** already, check for an MSVC build environment that provides -** localtime_s(). -*/ -#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE_LOCALTIME_S) && \ - defined(_MSC_VER) && defined(_CRT_INSECURE_DEPRECATE) -#define HAVE_LOCALTIME_S 1 -#endif - -#ifndef SQLITE_OMIT_LOCALTIME -/* -** The following routine implements the rough equivalent of localtime_r() -** using whatever operating-system specific localtime facility that -** is available. This routine returns 0 on success and -** non-zero on any kind of error. -** -** If the sqlite3GlobalConfig.bLocaltimeFault variable is true then this -** routine will always fail. -** -** EVIDENCE-OF: R-62172-00036 In this implementation, the standard C -** library function localtime_r() is used to assist in the calculation of -** local time. -*/ -static int osLocaltime(time_t *t, struct tm *pTm){ - int rc; -#if (!defined(HAVE_LOCALTIME_R) || !HAVE_LOCALTIME_R) \ - && (!defined(HAVE_LOCALTIME_S) || !HAVE_LOCALTIME_S) - struct tm *pX; -#if SQLITE_THREADSAFE>0 - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); -#endif - sqlite3_mutex_enter(mutex); - pX = localtime(t); -#ifndef SQLITE_OMIT_BUILTIN_TEST - if( sqlite3GlobalConfig.bLocaltimeFault ) pX = 0; -#endif - if( pX ) *pTm = *pX; - sqlite3_mutex_leave(mutex); - rc = pX==0; -#else -#ifndef SQLITE_OMIT_BUILTIN_TEST - if( sqlite3GlobalConfig.bLocaltimeFault ) return 1; -#endif -#if defined(HAVE_LOCALTIME_R) && HAVE_LOCALTIME_R - rc = localtime_r(t, pTm)==0; -#else - rc = localtime_s(pTm, t); -#endif /* HAVE_LOCALTIME_R */ -#endif /* HAVE_LOCALTIME_R || HAVE_LOCALTIME_S */ - return rc; -} -#endif /* SQLITE_OMIT_LOCALTIME */ - - -#ifndef SQLITE_OMIT_LOCALTIME -/* -** Compute the difference (in milliseconds) between localtime and UTC -** (a.k.a. GMT) for the time value p where p is in UTC. If no error occurs, -** return this value and set *pRc to SQLITE_OK. -** -** Or, if an error does occur, set *pRc to SQLITE_ERROR. The returned value -** is undefined in this case. -*/ -static sqlite3_int64 localtimeOffset( - DateTime *p, /* Date at which to calculate offset */ - sqlite3_context *pCtx, /* Write error here if one occurs */ - int *pRc /* OUT: Error code. SQLITE_OK or ERROR */ -){ - DateTime x, y; - time_t t; - struct tm sLocal; - - /* Initialize the contents of sLocal to avoid a compiler warning. */ - memset(&sLocal, 0, sizeof(sLocal)); - - x = *p; - computeYMD_HMS(&x); - if( x.Y<1971 || x.Y>=2038 ){ - /* EVIDENCE-OF: R-55269-29598 The localtime_r() C function normally only - ** works for years between 1970 and 2037. For dates outside this range, - ** SQLite attempts to map the year into an equivalent year within this - ** range, do the calculation, then map the year back. - */ - x.Y = 2000; - x.M = 1; - x.D = 1; - x.h = 0; - x.m = 0; - x.s = 0.0; - } else { - int s = (int)(x.s + 0.5); - x.s = s; - } - x.tz = 0; - x.validJD = 0; - computeJD(&x); - t = (time_t)(x.iJD/1000 - 21086676*(i64)10000); - if( osLocaltime(&t, &sLocal) ){ - sqlite3_result_error(pCtx, "local time unavailable", -1); - *pRc = SQLITE_ERROR; - return 0; - } - y.Y = sLocal.tm_year + 1900; - y.M = sLocal.tm_mon + 1; - y.D = sLocal.tm_mday; - y.h = sLocal.tm_hour; - y.m = sLocal.tm_min; - y.s = sLocal.tm_sec; - y.validYMD = 1; - y.validHMS = 1; - y.validJD = 0; - y.validTZ = 0; - computeJD(&y); - *pRc = SQLITE_OK; - return y.iJD - x.iJD; -} -#endif /* SQLITE_OMIT_LOCALTIME */ - -/* -** Process a modifier to a date-time stamp. The modifiers are -** as follows: -** -** NNN days -** NNN hours -** NNN minutes -** NNN.NNNN seconds -** NNN months -** NNN years -** start of month -** start of year -** start of week -** start of day -** weekday N -** unixepoch -** localtime -** utc -** -** Return 0 on success and 1 if there is any kind of error. If the error -** is in a system call (i.e. localtime()), then an error message is written -** to context pCtx. If the error is an unrecognized modifier, no error is -** written to pCtx. -*/ -static int parseModifier(sqlite3_context *pCtx, const char *zMod, DateTime *p){ - int rc = 1; - int n; - double r; - char *z, zBuf[30]; - z = zBuf; - for(n=0; niJD += localtimeOffset(p, pCtx, &rc); - clearYMD_HMS_TZ(p); - } - break; - } -#endif - case 'u': { - /* - ** unixepoch - ** - ** Treat the current value of p->iJD as the number of - ** seconds since 1970. Convert to a real julian day number. - */ - if( strcmp(z, "unixepoch")==0 && p->validJD ){ - p->iJD = (p->iJD + 43200)/86400 + 21086676*(i64)10000000; - clearYMD_HMS_TZ(p); - rc = 0; - } -#ifndef SQLITE_OMIT_LOCALTIME - else if( strcmp(z, "utc")==0 ){ - sqlite3_int64 c1; - computeJD(p); - c1 = localtimeOffset(p, pCtx, &rc); - if( rc==SQLITE_OK ){ - p->iJD -= c1; - clearYMD_HMS_TZ(p); - p->iJD += c1 - localtimeOffset(p, pCtx, &rc); - } - } -#endif - break; - } - case 'w': { - /* - ** weekday N - ** - ** Move the date to the same time on the next occurrence of - ** weekday N where 0==Sunday, 1==Monday, and so forth. If the - ** date is already on the appropriate weekday, this is a no-op. - */ - if( strncmp(z, "weekday ", 8)==0 - && sqlite3AtoF(&z[8], &r, sqlite3Strlen30(&z[8]), SQLITE_UTF8) - && (n=(int)r)==r && n>=0 && r<7 ){ - sqlite3_int64 Z; - computeYMD_HMS(p); - p->validTZ = 0; - p->validJD = 0; - computeJD(p); - Z = ((p->iJD + 129600000)/86400000) % 7; - if( Z>n ) Z -= 7; - p->iJD += (n - Z)*86400000; - clearYMD_HMS_TZ(p); - rc = 0; - } - break; - } - case 's': { - /* - ** start of TTTTT - ** - ** Move the date backwards to the beginning of the current day, - ** or month or year. - */ - if( strncmp(z, "start of ", 9)!=0 ) break; - z += 9; - computeYMD(p); - p->validHMS = 1; - p->h = p->m = 0; - p->s = 0.0; - p->validTZ = 0; - p->validJD = 0; - if( strcmp(z,"month")==0 ){ - p->D = 1; - rc = 0; - }else if( strcmp(z,"year")==0 ){ - computeYMD(p); - p->M = 1; - p->D = 1; - rc = 0; - }else if( strcmp(z,"day")==0 ){ - rc = 0; - } - break; - } - case '+': - case '-': - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - case '8': - case '9': { - double rRounder; - for(n=1; z[n] && z[n]!=':' && !sqlite3Isspace(z[n]); n++){} - if( !sqlite3AtoF(z, &r, n, SQLITE_UTF8) ){ - rc = 1; - break; - } - if( z[n]==':' ){ - /* A modifier of the form (+|-)HH:MM:SS.FFF adds (or subtracts) the - ** specified number of hours, minutes, seconds, and fractional seconds - ** to the time. The ".FFF" may be omitted. The ":SS.FFF" may be - ** omitted. - */ - const char *z2 = z; - DateTime tx; - sqlite3_int64 day; - if( !sqlite3Isdigit(*z2) ) z2++; - memset(&tx, 0, sizeof(tx)); - if( parseHhMmSs(z2, &tx) ) break; - computeJD(&tx); - tx.iJD -= 43200000; - day = tx.iJD/86400000; - tx.iJD -= day*86400000; - if( z[0]=='-' ) tx.iJD = -tx.iJD; - computeJD(p); - clearYMD_HMS_TZ(p); - p->iJD += tx.iJD; - rc = 0; - break; - } - z += n; - while( sqlite3Isspace(*z) ) z++; - n = sqlite3Strlen30(z); - if( n>10 || n<3 ) break; - if( z[n-1]=='s' ){ z[n-1] = 0; n--; } - computeJD(p); - rc = 0; - rRounder = r<0 ? -0.5 : +0.5; - if( n==3 && strcmp(z,"day")==0 ){ - p->iJD += (sqlite3_int64)(r*86400000.0 + rRounder); - }else if( n==4 && strcmp(z,"hour")==0 ){ - p->iJD += (sqlite3_int64)(r*(86400000.0/24.0) + rRounder); - }else if( n==6 && strcmp(z,"minute")==0 ){ - p->iJD += (sqlite3_int64)(r*(86400000.0/(24.0*60.0)) + rRounder); - }else if( n==6 && strcmp(z,"second")==0 ){ - p->iJD += (sqlite3_int64)(r*(86400000.0/(24.0*60.0*60.0)) + rRounder); - }else if( n==5 && strcmp(z,"month")==0 ){ - int x, y; - computeYMD_HMS(p); - p->M += (int)r; - x = p->M>0 ? (p->M-1)/12 : (p->M-12)/12; - p->Y += x; - p->M -= x*12; - p->validJD = 0; - computeJD(p); - y = (int)r; - if( y!=r ){ - p->iJD += (sqlite3_int64)((r - y)*30.0*86400000.0 + rRounder); - } - }else if( n==4 && strcmp(z,"year")==0 ){ - int y = (int)r; - computeYMD_HMS(p); - p->Y += y; - p->validJD = 0; - computeJD(p); - if( y!=r ){ - p->iJD += (sqlite3_int64)((r - y)*365.0*86400000.0 + rRounder); - } - }else{ - rc = 1; - } - clearYMD_HMS_TZ(p); - break; - } - default: { - break; - } - } - return rc; -} - -/* -** Process time function arguments. argv[0] is a date-time stamp. -** argv[1] and following are modifiers. Parse them all and write -** the resulting time into the DateTime structure p. Return 0 -** on success and 1 if there are any errors. -** -** If there are zero parameters (if even argv[0] is undefined) -** then assume a default value of "now" for argv[0]. -*/ -static int isDate( - sqlite3_context *context, - int argc, - sqlite3_value **argv, - DateTime *p -){ - int i; - const unsigned char *z; - int eType; - memset(p, 0, sizeof(*p)); - if( argc==0 ){ - return setDateTimeToCurrent(context, p); - } - if( (eType = sqlite3_value_type(argv[0]))==SQLITE_FLOAT - || eType==SQLITE_INTEGER ){ - p->iJD = (sqlite3_int64)(sqlite3_value_double(argv[0])*86400000.0 + 0.5); - p->validJD = 1; - }else{ - z = sqlite3_value_text(argv[0]); - if( !z || parseDateOrTime(context, (char*)z, p) ){ - return 1; - } - } - for(i=1; iaLimit[SQLITE_LIMIT_LENGTH]+1 ); - testcase( n==(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ); - if( n(u64)db->aLimit[SQLITE_LIMIT_LENGTH] ){ - sqlite3_result_error_toobig(context); - return; - }else{ - z = sqlite3DbMallocRaw(db, (int)n); - if( z==0 ){ - sqlite3_result_error_nomem(context); - return; - } - } - computeJD(&x); - computeYMD_HMS(&x); - for(i=j=0; zFmt[i]; i++){ - if( zFmt[i]!='%' ){ - z[j++] = zFmt[i]; - }else{ - i++; - switch( zFmt[i] ){ - case 'd': sqlite3_snprintf(3, &z[j],"%02d",x.D); j+=2; break; - case 'f': { - double s = x.s; - if( s>59.999 ) s = 59.999; - sqlite3_snprintf(7, &z[j],"%06.3f", s); - j += sqlite3Strlen30(&z[j]); - break; - } - case 'H': sqlite3_snprintf(3, &z[j],"%02d",x.h); j+=2; break; - case 'W': /* Fall thru */ - case 'j': { - int nDay; /* Number of days since 1st day of year */ - DateTime y = x; - y.validJD = 0; - y.M = 1; - y.D = 1; - computeJD(&y); - nDay = (int)((x.iJD-y.iJD+43200000)/86400000); - if( zFmt[i]=='W' ){ - int wd; /* 0=Monday, 1=Tuesday, ... 6=Sunday */ - wd = (int)(((x.iJD+43200000)/86400000)%7); - sqlite3_snprintf(3, &z[j],"%02d",(nDay+7-wd)/7); - j += 2; - }else{ - sqlite3_snprintf(4, &z[j],"%03d",nDay+1); - j += 3; - } - break; - } - case 'J': { - sqlite3_snprintf(20, &z[j],"%.16g",x.iJD/86400000.0); - j+=sqlite3Strlen30(&z[j]); - break; - } - case 'm': sqlite3_snprintf(3, &z[j],"%02d",x.M); j+=2; break; - case 'M': sqlite3_snprintf(3, &z[j],"%02d",x.m); j+=2; break; - case 's': { - sqlite3_snprintf(30,&z[j],"%lld", - (i64)(x.iJD/1000 - 21086676*(i64)10000)); - j += sqlite3Strlen30(&z[j]); - break; - } - case 'S': sqlite3_snprintf(3,&z[j],"%02d",(int)x.s); j+=2; break; - case 'w': { - z[j++] = (char)(((x.iJD+129600000)/86400000) % 7) + '0'; - break; - } - case 'Y': { - sqlite3_snprintf(5,&z[j],"%04d",x.Y); j+=sqlite3Strlen30(&z[j]); - break; - } - default: z[j++] = '%'; break; - } - } - } - z[j] = 0; - sqlite3_result_text(context, z, -1, - z==zBuf ? SQLITE_TRANSIENT : SQLITE_DYNAMIC); -} - -/* -** current_time() -** -** This function returns the same value as time('now'). -*/ -static void ctimeFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **NotUsed2 -){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - timeFunc(context, 0, 0); -} - -/* -** current_date() -** -** This function returns the same value as date('now'). -*/ -static void cdateFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **NotUsed2 -){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - dateFunc(context, 0, 0); -} - -/* -** current_timestamp() -** -** This function returns the same value as datetime('now'). -*/ -static void ctimestampFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **NotUsed2 -){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - datetimeFunc(context, 0, 0); -} -#endif /* !defined(SQLITE_OMIT_DATETIME_FUNCS) */ - -#ifdef SQLITE_OMIT_DATETIME_FUNCS -/* -** If the library is compiled to omit the full-scale date and time -** handling (to get a smaller binary), the following minimal version -** of the functions current_time(), current_date() and current_timestamp() -** are included instead. This is to support column declarations that -** include "DEFAULT CURRENT_TIME" etc. -** -** This function uses the C-library functions time(), gmtime() -** and strftime(). The format string to pass to strftime() is supplied -** as the user-data for the function. -*/ -static void currentTimeFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - time_t t; - char *zFormat = (char *)sqlite3_user_data(context); - sqlite3 *db; - sqlite3_int64 iT; - struct tm *pTm; - struct tm sNow; - char zBuf[20]; - - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(argv); - - iT = sqlite3StmtCurrentTime(context); - if( iT<=0 ) return; - t = iT/1000 - 10000*(sqlite3_int64)21086676; -#ifdef HAVE_GMTIME_R - pTm = gmtime_r(&t, &sNow); -#else - sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); - pTm = gmtime(&t); - if( pTm ) memcpy(&sNow, pTm, sizeof(sNow)); - sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); -#endif - if( pTm ){ - strftime(zBuf, 20, zFormat, &sNow); - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); - } -} -#endif - -/* -** This function registered all of the above C functions as SQL -** functions. This should be the only routine in this file with -** external linkage. -*/ -SQLITE_PRIVATE void sqlite3RegisterDateTimeFunctions(void){ - static SQLITE_WSD FuncDef aDateTimeFuncs[] = { -#ifndef SQLITE_OMIT_DATETIME_FUNCS - FUNCTION(julianday, -1, 0, 0, juliandayFunc ), - FUNCTION(date, -1, 0, 0, dateFunc ), - FUNCTION(time, -1, 0, 0, timeFunc ), - FUNCTION(datetime, -1, 0, 0, datetimeFunc ), - FUNCTION(strftime, -1, 0, 0, strftimeFunc ), - FUNCTION(current_time, 0, 0, 0, ctimeFunc ), - FUNCTION(current_timestamp, 0, 0, 0, ctimestampFunc), - FUNCTION(current_date, 0, 0, 0, cdateFunc ), -#else - STR_FUNCTION(current_time, 0, "%H:%M:%S", 0, currentTimeFunc), - STR_FUNCTION(current_date, 0, "%Y-%m-%d", 0, currentTimeFunc), - STR_FUNCTION(current_timestamp, 0, "%Y-%m-%d %H:%M:%S", 0, currentTimeFunc), -#endif - }; - int i; - FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions); - FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aDateTimeFuncs); - - for(i=0; ipMethods ){ - rc = pId->pMethods->xClose(pId); - pId->pMethods = 0; - } - return rc; -} -SQLITE_PRIVATE int sqlite3OsRead(sqlite3_file *id, void *pBuf, int amt, i64 offset){ - DO_OS_MALLOC_TEST(id); - return id->pMethods->xRead(id, pBuf, amt, offset); -} -SQLITE_PRIVATE int sqlite3OsWrite(sqlite3_file *id, const void *pBuf, int amt, i64 offset){ - DO_OS_MALLOC_TEST(id); - return id->pMethods->xWrite(id, pBuf, amt, offset); -} -SQLITE_PRIVATE int sqlite3OsTruncate(sqlite3_file *id, i64 size){ - return id->pMethods->xTruncate(id, size); -} -SQLITE_PRIVATE int sqlite3OsSync(sqlite3_file *id, int flags){ - DO_OS_MALLOC_TEST(id); - return id->pMethods->xSync(id, flags); -} -SQLITE_PRIVATE int sqlite3OsFileSize(sqlite3_file *id, i64 *pSize){ - DO_OS_MALLOC_TEST(id); - return id->pMethods->xFileSize(id, pSize); -} -SQLITE_PRIVATE int sqlite3OsLock(sqlite3_file *id, int lockType){ - DO_OS_MALLOC_TEST(id); - return id->pMethods->xLock(id, lockType); -} -SQLITE_PRIVATE int sqlite3OsUnlock(sqlite3_file *id, int lockType){ - return id->pMethods->xUnlock(id, lockType); -} -SQLITE_PRIVATE int sqlite3OsCheckReservedLock(sqlite3_file *id, int *pResOut){ - DO_OS_MALLOC_TEST(id); - return id->pMethods->xCheckReservedLock(id, pResOut); -} - -/* -** Use sqlite3OsFileControl() when we are doing something that might fail -** and we need to know about the failures. Use sqlite3OsFileControlHint() -** when simply tossing information over the wall to the VFS and we do not -** really care if the VFS receives and understands the information since it -** is only a hint and can be safely ignored. The sqlite3OsFileControlHint() -** routine has no return value since the return value would be meaningless. -*/ -SQLITE_PRIVATE int sqlite3OsFileControl(sqlite3_file *id, int op, void *pArg){ -#ifdef SQLITE_TEST - if( op!=SQLITE_FCNTL_COMMIT_PHASETWO ){ - /* Faults are not injected into COMMIT_PHASETWO because, assuming SQLite - ** is using a regular VFS, it is called after the corresponding - ** transaction has been committed. Injecting a fault at this point - ** confuses the test scripts - the COMMIT comand returns SQLITE_NOMEM - ** but the transaction is committed anyway. - ** - ** The core must call OsFileControl() though, not OsFileControlHint(), - ** as if a custom VFS (e.g. zipvfs) returns an error here, it probably - ** means the commit really has failed and an error should be returned - ** to the user. */ - DO_OS_MALLOC_TEST(id); - } -#endif - return id->pMethods->xFileControl(id, op, pArg); -} -SQLITE_PRIVATE void sqlite3OsFileControlHint(sqlite3_file *id, int op, void *pArg){ - (void)id->pMethods->xFileControl(id, op, pArg); -} - -SQLITE_PRIVATE int sqlite3OsSectorSize(sqlite3_file *id){ - int (*xSectorSize)(sqlite3_file*) = id->pMethods->xSectorSize; - return (xSectorSize ? xSectorSize(id) : SQLITE_DEFAULT_SECTOR_SIZE); -} -SQLITE_PRIVATE int sqlite3OsDeviceCharacteristics(sqlite3_file *id){ - return id->pMethods->xDeviceCharacteristics(id); -} -SQLITE_PRIVATE int sqlite3OsShmLock(sqlite3_file *id, int offset, int n, int flags){ - return id->pMethods->xShmLock(id, offset, n, flags); -} -SQLITE_PRIVATE void sqlite3OsShmBarrier(sqlite3_file *id){ - id->pMethods->xShmBarrier(id); -} -SQLITE_PRIVATE int sqlite3OsShmUnmap(sqlite3_file *id, int deleteFlag){ - return id->pMethods->xShmUnmap(id, deleteFlag); -} -SQLITE_PRIVATE int sqlite3OsShmMap( - sqlite3_file *id, /* Database file handle */ - int iPage, - int pgsz, - int bExtend, /* True to extend file if necessary */ - void volatile **pp /* OUT: Pointer to mapping */ -){ - DO_OS_MALLOC_TEST(id); - return id->pMethods->xShmMap(id, iPage, pgsz, bExtend, pp); -} - -#if SQLITE_MAX_MMAP_SIZE>0 -/* The real implementation of xFetch and xUnfetch */ -SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){ - DO_OS_MALLOC_TEST(id); - return id->pMethods->xFetch(id, iOff, iAmt, pp); -} -SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){ - return id->pMethods->xUnfetch(id, iOff, p); -} -#else -/* No-op stubs to use when memory-mapped I/O is disabled */ -SQLITE_PRIVATE int sqlite3OsFetch(sqlite3_file *id, i64 iOff, int iAmt, void **pp){ - *pp = 0; - return SQLITE_OK; -} -SQLITE_PRIVATE int sqlite3OsUnfetch(sqlite3_file *id, i64 iOff, void *p){ - return SQLITE_OK; -} -#endif - -/* -** The next group of routines are convenience wrappers around the -** VFS methods. -*/ -SQLITE_PRIVATE int sqlite3OsOpen( - sqlite3_vfs *pVfs, - const char *zPath, - sqlite3_file *pFile, - int flags, - int *pFlagsOut -){ - int rc; - DO_OS_MALLOC_TEST(0); - /* 0x87f7f is a mask of SQLITE_OPEN_ flags that are valid to be passed - ** down into the VFS layer. Some SQLITE_OPEN_ flags (for example, - ** SQLITE_OPEN_FULLMUTEX or SQLITE_OPEN_SHAREDCACHE) are blocked before - ** reaching the VFS. */ - rc = pVfs->xOpen(pVfs, zPath, pFile, flags & 0x87f7f, pFlagsOut); - assert( rc==SQLITE_OK || pFile->pMethods==0 ); - return rc; -} -SQLITE_PRIVATE int sqlite3OsDelete(sqlite3_vfs *pVfs, const char *zPath, int dirSync){ - DO_OS_MALLOC_TEST(0); - assert( dirSync==0 || dirSync==1 ); - return pVfs->xDelete(pVfs, zPath, dirSync); -} -SQLITE_PRIVATE int sqlite3OsAccess( - sqlite3_vfs *pVfs, - const char *zPath, - int flags, - int *pResOut -){ - DO_OS_MALLOC_TEST(0); - return pVfs->xAccess(pVfs, zPath, flags, pResOut); -} -SQLITE_PRIVATE int sqlite3OsFullPathname( - sqlite3_vfs *pVfs, - const char *zPath, - int nPathOut, - char *zPathOut -){ - DO_OS_MALLOC_TEST(0); - zPathOut[0] = 0; - return pVfs->xFullPathname(pVfs, zPath, nPathOut, zPathOut); -} -#ifndef SQLITE_OMIT_LOAD_EXTENSION -SQLITE_PRIVATE void *sqlite3OsDlOpen(sqlite3_vfs *pVfs, const char *zPath){ - return pVfs->xDlOpen(pVfs, zPath); -} -SQLITE_PRIVATE void sqlite3OsDlError(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ - pVfs->xDlError(pVfs, nByte, zBufOut); -} -SQLITE_PRIVATE void (*sqlite3OsDlSym(sqlite3_vfs *pVfs, void *pHdle, const char *zSym))(void){ - return pVfs->xDlSym(pVfs, pHdle, zSym); -} -SQLITE_PRIVATE void sqlite3OsDlClose(sqlite3_vfs *pVfs, void *pHandle){ - pVfs->xDlClose(pVfs, pHandle); -} -#endif /* SQLITE_OMIT_LOAD_EXTENSION */ -SQLITE_PRIVATE int sqlite3OsRandomness(sqlite3_vfs *pVfs, int nByte, char *zBufOut){ - return pVfs->xRandomness(pVfs, nByte, zBufOut); -} -SQLITE_PRIVATE int sqlite3OsSleep(sqlite3_vfs *pVfs, int nMicro){ - return pVfs->xSleep(pVfs, nMicro); -} -SQLITE_PRIVATE int sqlite3OsCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *pTimeOut){ - int rc; - /* IMPLEMENTATION-OF: R-49045-42493 SQLite will use the xCurrentTimeInt64() - ** method to get the current date and time if that method is available - ** (if iVersion is 2 or greater and the function pointer is not NULL) and - ** will fall back to xCurrentTime() if xCurrentTimeInt64() is - ** unavailable. - */ - if( pVfs->iVersion>=2 && pVfs->xCurrentTimeInt64 ){ - rc = pVfs->xCurrentTimeInt64(pVfs, pTimeOut); - }else{ - double r; - rc = pVfs->xCurrentTime(pVfs, &r); - *pTimeOut = (sqlite3_int64)(r*86400000.0); - } - return rc; -} - -SQLITE_PRIVATE int sqlite3OsOpenMalloc( - sqlite3_vfs *pVfs, - const char *zFile, - sqlite3_file **ppFile, - int flags, - int *pOutFlags -){ - int rc = SQLITE_NOMEM; - sqlite3_file *pFile; - pFile = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile); - if( pFile ){ - rc = sqlite3OsOpen(pVfs, zFile, pFile, flags, pOutFlags); - if( rc!=SQLITE_OK ){ - sqlite3_free(pFile); - }else{ - *ppFile = pFile; - } - } - return rc; -} -SQLITE_PRIVATE int sqlite3OsCloseFree(sqlite3_file *pFile){ - int rc = SQLITE_OK; - assert( pFile ); - rc = sqlite3OsClose(pFile); - sqlite3_free(pFile); - return rc; -} - -/* -** This function is a wrapper around the OS specific implementation of -** sqlite3_os_init(). The purpose of the wrapper is to provide the -** ability to simulate a malloc failure, so that the handling of an -** error in sqlite3_os_init() by the upper layers can be tested. -*/ -SQLITE_PRIVATE int sqlite3OsInit(void){ - void *p = sqlite3_malloc(10); - if( p==0 ) return SQLITE_NOMEM; - sqlite3_free(p); - return sqlite3_os_init(); -} - -/* -** The list of all registered VFS implementations. -*/ -static sqlite3_vfs * SQLITE_WSD vfsList = 0; -#define vfsList GLOBAL(sqlite3_vfs *, vfsList) - -/* -** Locate a VFS by name. If no name is given, simply return the -** first VFS on the list. -*/ -SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfs){ - sqlite3_vfs *pVfs = 0; -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex; -#endif -#ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); - if( rc ) return 0; -#endif -#if SQLITE_THREADSAFE - mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); -#endif - sqlite3_mutex_enter(mutex); - for(pVfs = vfsList; pVfs; pVfs=pVfs->pNext){ - if( zVfs==0 ) break; - if( strcmp(zVfs, pVfs->zName)==0 ) break; - } - sqlite3_mutex_leave(mutex); - return pVfs; -} - -/* -** Unlink a VFS from the linked list -*/ -static void vfsUnlink(sqlite3_vfs *pVfs){ - assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) ); - if( pVfs==0 ){ - /* No-op */ - }else if( vfsList==pVfs ){ - vfsList = pVfs->pNext; - }else if( vfsList ){ - sqlite3_vfs *p = vfsList; - while( p->pNext && p->pNext!=pVfs ){ - p = p->pNext; - } - if( p->pNext==pVfs ){ - p->pNext = pVfs->pNext; - } - } -} - -/* -** Register a VFS with the system. It is harmless to register the same -** VFS multiple times. The new VFS becomes the default if makeDflt is -** true. -*/ -SQLITE_API int sqlite3_vfs_register(sqlite3_vfs *pVfs, int makeDflt){ - MUTEX_LOGIC(sqlite3_mutex *mutex;) -#ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); - if( rc ) return rc; -#endif - MUTEX_LOGIC( mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - sqlite3_mutex_enter(mutex); - vfsUnlink(pVfs); - if( makeDflt || vfsList==0 ){ - pVfs->pNext = vfsList; - vfsList = pVfs; - }else{ - pVfs->pNext = vfsList->pNext; - vfsList->pNext = pVfs; - } - assert(vfsList); - sqlite3_mutex_leave(mutex); - return SQLITE_OK; -} - -/* -** Unregister a VFS so that it is no longer accessible. -*/ -SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs *pVfs){ -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); -#endif - sqlite3_mutex_enter(mutex); - vfsUnlink(pVfs); - sqlite3_mutex_leave(mutex); - return SQLITE_OK; -} - -/************** End of os.c **************************************************/ -/************** Begin file fault.c *******************************************/ -/* -** 2008 Jan 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains code to support the concept of "benign" -** malloc failures (when the xMalloc() or xRealloc() method of the -** sqlite3_mem_methods structure fails to allocate a block of memory -** and returns 0). -** -** Most malloc failures are non-benign. After they occur, SQLite -** abandons the current operation and returns an error code (usually -** SQLITE_NOMEM) to the user. However, sometimes a fault is not necessarily -** fatal. For example, if a malloc fails while resizing a hash table, this -** is completely recoverable simply by not carrying out the resize. The -** hash table will continue to function normally. So a malloc failure -** during a hash table resize is a benign fault. -*/ - - -#ifndef SQLITE_OMIT_BUILTIN_TEST - -/* -** Global variables. -*/ -typedef struct BenignMallocHooks BenignMallocHooks; -static SQLITE_WSD struct BenignMallocHooks { - void (*xBenignBegin)(void); - void (*xBenignEnd)(void); -} sqlite3Hooks = { 0, 0 }; - -/* The "wsdHooks" macro will resolve to the appropriate BenignMallocHooks -** structure. If writable static data is unsupported on the target, -** we have to locate the state vector at run-time. In the more common -** case where writable static data is supported, wsdHooks can refer directly -** to the "sqlite3Hooks" state vector declared above. -*/ -#ifdef SQLITE_OMIT_WSD -# define wsdHooksInit \ - BenignMallocHooks *x = &GLOBAL(BenignMallocHooks,sqlite3Hooks) -# define wsdHooks x[0] -#else -# define wsdHooksInit -# define wsdHooks sqlite3Hooks -#endif - - -/* -** Register hooks to call when sqlite3BeginBenignMalloc() and -** sqlite3EndBenignMalloc() are called, respectively. -*/ -SQLITE_PRIVATE void sqlite3BenignMallocHooks( - void (*xBenignBegin)(void), - void (*xBenignEnd)(void) -){ - wsdHooksInit; - wsdHooks.xBenignBegin = xBenignBegin; - wsdHooks.xBenignEnd = xBenignEnd; -} - -/* -** This (sqlite3EndBenignMalloc()) is called by SQLite code to indicate that -** subsequent malloc failures are benign. A call to sqlite3EndBenignMalloc() -** indicates that subsequent malloc failures are non-benign. -*/ -SQLITE_PRIVATE void sqlite3BeginBenignMalloc(void){ - wsdHooksInit; - if( wsdHooks.xBenignBegin ){ - wsdHooks.xBenignBegin(); - } -} -SQLITE_PRIVATE void sqlite3EndBenignMalloc(void){ - wsdHooksInit; - if( wsdHooks.xBenignEnd ){ - wsdHooks.xBenignEnd(); - } -} - -#endif /* #ifndef SQLITE_OMIT_BUILTIN_TEST */ - -/************** End of fault.c ***********************************************/ -/************** Begin file mem0.c ********************************************/ -/* -** 2008 October 28 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains a no-op memory allocation drivers for use when -** SQLITE_ZERO_MALLOC is defined. The allocation drivers implemented -** here always fail. SQLite will not operate with these drivers. These -** are merely placeholders. Real drivers must be substituted using -** sqlite3_config() before SQLite will operate. -*/ - -/* -** This version of the memory allocator is the default. It is -** used when no other memory allocator is specified using compile-time -** macros. -*/ -#ifdef SQLITE_ZERO_MALLOC - -/* -** No-op versions of all memory allocation routines -*/ -static void *sqlite3MemMalloc(int nByte){ return 0; } -static void sqlite3MemFree(void *pPrior){ return; } -static void *sqlite3MemRealloc(void *pPrior, int nByte){ return 0; } -static int sqlite3MemSize(void *pPrior){ return 0; } -static int sqlite3MemRoundup(int n){ return n; } -static int sqlite3MemInit(void *NotUsed){ return SQLITE_OK; } -static void sqlite3MemShutdown(void *NotUsed){ return; } - -/* -** This routine is the only routine in this file with external linkage. -** -** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. -*/ -SQLITE_PRIVATE void sqlite3MemSetDefault(void){ - static const sqlite3_mem_methods defaultMethods = { - sqlite3MemMalloc, - sqlite3MemFree, - sqlite3MemRealloc, - sqlite3MemSize, - sqlite3MemRoundup, - sqlite3MemInit, - sqlite3MemShutdown, - 0 - }; - sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); -} - -#endif /* SQLITE_ZERO_MALLOC */ - -/************** End of mem0.c ************************************************/ -/************** Begin file mem1.c ********************************************/ -/* -** 2007 August 14 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains low-level memory allocation drivers for when -** SQLite will use the standard C-library malloc/realloc/free interface -** to obtain the memory it needs. -** -** This file contains implementations of the low-level memory allocation -** routines specified in the sqlite3_mem_methods object. The content of -** this file is only used if SQLITE_SYSTEM_MALLOC is defined. The -** SQLITE_SYSTEM_MALLOC macro is defined automatically if neither the -** SQLITE_MEMDEBUG nor the SQLITE_WIN32_MALLOC macros are defined. The -** default configuration is to use memory allocation routines in this -** file. -** -** C-preprocessor macro summary: -** -** HAVE_MALLOC_USABLE_SIZE The configure script sets this symbol if -** the malloc_usable_size() interface exists -** on the target platform. Or, this symbol -** can be set manually, if desired. -** If an equivalent interface exists by -** a different name, using a separate -D -** option to rename it. -** -** SQLITE_WITHOUT_ZONEMALLOC Some older macs lack support for the zone -** memory allocator. Set this symbol to enable -** building on older macs. -** -** SQLITE_WITHOUT_MSIZE Set this symbol to disable the use of -** _msize() on windows systems. This might -** be necessary when compiling for Delphi, -** for example. -*/ - -/* -** This version of the memory allocator is the default. It is -** used when no other memory allocator is specified using compile-time -** macros. -*/ -#ifdef SQLITE_SYSTEM_MALLOC -#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC) - -/* -** Use the zone allocator available on apple products unless the -** SQLITE_WITHOUT_ZONEMALLOC symbol is defined. -*/ -#include -#include -#include -static malloc_zone_t* _sqliteZone_; -#define SQLITE_MALLOC(x) malloc_zone_malloc(_sqliteZone_, (x)) -#define SQLITE_FREE(x) malloc_zone_free(_sqliteZone_, (x)); -#define SQLITE_REALLOC(x,y) malloc_zone_realloc(_sqliteZone_, (x), (y)) -#define SQLITE_MALLOCSIZE(x) \ - (_sqliteZone_ ? _sqliteZone_->size(_sqliteZone_,x) : malloc_size(x)) - -#else /* if not __APPLE__ */ - -/* -** Use standard C library malloc and free on non-Apple systems. -** Also used by Apple systems if SQLITE_WITHOUT_ZONEMALLOC is defined. -*/ -#define SQLITE_MALLOC(x) malloc(x) -#define SQLITE_FREE(x) free(x) -#define SQLITE_REALLOC(x,y) realloc((x),(y)) - -/* -** The malloc.h header file is needed for malloc_usable_size() function -** on some systems (e.g. Linux). -*/ -#if defined(HAVE_MALLOC_H) && defined(HAVE_MALLOC_USABLE_SIZE) -# define SQLITE_USE_MALLOC_H -# define SQLITE_USE_MALLOC_USABLE_SIZE -/* -** The MSVCRT has malloc_usable_size(), but it is called _msize(). The -** use of _msize() is automatic, but can be disabled by compiling with -** -DSQLITE_WITHOUT_MSIZE. Using the _msize() function also requires -** the malloc.h header file. -*/ -#elif defined(_MSC_VER) && !defined(SQLITE_WITHOUT_MSIZE) -# define SQLITE_USE_MALLOC_H -# define SQLITE_USE_MSIZE -#endif - -/* -** Include the malloc.h header file, if necessary. Also set define macro -** SQLITE_MALLOCSIZE to the appropriate function name, which is _msize() -** for MSVC and malloc_usable_size() for most other systems (e.g. Linux). -** The memory size function can always be overridden manually by defining -** the macro SQLITE_MALLOCSIZE to the desired function name. -*/ -#if defined(SQLITE_USE_MALLOC_H) -# include -# if defined(SQLITE_USE_MALLOC_USABLE_SIZE) -# if !defined(SQLITE_MALLOCSIZE) -# define SQLITE_MALLOCSIZE(x) malloc_usable_size(x) -# endif -# elif defined(SQLITE_USE_MSIZE) -# if !defined(SQLITE_MALLOCSIZE) -# define SQLITE_MALLOCSIZE _msize -# endif -# endif -#endif /* defined(SQLITE_USE_MALLOC_H) */ - -#endif /* __APPLE__ or not __APPLE__ */ - -/* -** Like malloc(), but remember the size of the allocation -** so that we can find it later using sqlite3MemSize(). -** -** For this low-level routine, we are guaranteed that nByte>0 because -** cases of nByte<=0 will be intercepted and dealt with by higher level -** routines. -*/ -static void *sqlite3MemMalloc(int nByte){ -#ifdef SQLITE_MALLOCSIZE - void *p = SQLITE_MALLOC( nByte ); - if( p==0 ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte); - } - return p; -#else - sqlite3_int64 *p; - assert( nByte>0 ); - nByte = ROUND8(nByte); - p = SQLITE_MALLOC( nByte+8 ); - if( p ){ - p[0] = nByte; - p++; - }else{ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes of memory", nByte); - } - return (void *)p; -#endif -} - -/* -** Like free() but works for allocations obtained from sqlite3MemMalloc() -** or sqlite3MemRealloc(). -** -** For this low-level routine, we already know that pPrior!=0 since -** cases where pPrior==0 will have been intecepted and dealt with -** by higher-level routines. -*/ -static void sqlite3MemFree(void *pPrior){ -#ifdef SQLITE_MALLOCSIZE - SQLITE_FREE(pPrior); -#else - sqlite3_int64 *p = (sqlite3_int64*)pPrior; - assert( pPrior!=0 ); - p--; - SQLITE_FREE(p); -#endif -} - -/* -** Report the allocated size of a prior return from xMalloc() -** or xRealloc(). -*/ -static int sqlite3MemSize(void *pPrior){ -#ifdef SQLITE_MALLOCSIZE - return pPrior ? (int)SQLITE_MALLOCSIZE(pPrior) : 0; -#else - sqlite3_int64 *p; - if( pPrior==0 ) return 0; - p = (sqlite3_int64*)pPrior; - p--; - return (int)p[0]; -#endif -} - -/* -** Like realloc(). Resize an allocation previously obtained from -** sqlite3MemMalloc(). -** -** For this low-level interface, we know that pPrior!=0. Cases where -** pPrior==0 while have been intercepted by higher-level routine and -** redirected to xMalloc. Similarly, we know that nByte>0 becauses -** cases where nByte<=0 will have been intercepted by higher-level -** routines and redirected to xFree. -*/ -static void *sqlite3MemRealloc(void *pPrior, int nByte){ -#ifdef SQLITE_MALLOCSIZE - void *p = SQLITE_REALLOC(pPrior, nByte); - if( p==0 ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, - "failed memory resize %u to %u bytes", - SQLITE_MALLOCSIZE(pPrior), nByte); - } - return p; -#else - sqlite3_int64 *p = (sqlite3_int64*)pPrior; - assert( pPrior!=0 && nByte>0 ); - assert( nByte==ROUND8(nByte) ); /* EV: R-46199-30249 */ - p--; - p = SQLITE_REALLOC(p, nByte+8 ); - if( p ){ - p[0] = nByte; - p++; - }else{ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, - "failed memory resize %u to %u bytes", - sqlite3MemSize(pPrior), nByte); - } - return (void*)p; -#endif -} - -/* -** Round up a request size to the next valid allocation size. -*/ -static int sqlite3MemRoundup(int n){ - return ROUND8(n); -} - -/* -** Initialize this module. -*/ -static int sqlite3MemInit(void *NotUsed){ -#if defined(__APPLE__) && !defined(SQLITE_WITHOUT_ZONEMALLOC) - int cpuCount; - size_t len; - if( _sqliteZone_ ){ - return SQLITE_OK; - } - len = sizeof(cpuCount); - /* One usually wants to use hw.acctivecpu for MT decisions, but not here */ - sysctlbyname("hw.ncpu", &cpuCount, &len, NULL, 0); - if( cpuCount>1 ){ - /* defer MT decisions to system malloc */ - _sqliteZone_ = malloc_default_zone(); - }else{ - /* only 1 core, use our own zone to contention over global locks, - ** e.g. we have our own dedicated locks */ - bool success; - malloc_zone_t* newzone = malloc_create_zone(4096, 0); - malloc_set_zone_name(newzone, "Sqlite_Heap"); - do{ - success = OSAtomicCompareAndSwapPtrBarrier(NULL, newzone, - (void * volatile *)&_sqliteZone_); - }while(!_sqliteZone_); - if( !success ){ - /* somebody registered a zone first */ - malloc_destroy_zone(newzone); - } - } -#endif - UNUSED_PARAMETER(NotUsed); - return SQLITE_OK; -} - -/* -** Deinitialize this module. -*/ -static void sqlite3MemShutdown(void *NotUsed){ - UNUSED_PARAMETER(NotUsed); - return; -} - -/* -** This routine is the only routine in this file with external linkage. -** -** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. -*/ -SQLITE_PRIVATE void sqlite3MemSetDefault(void){ - static const sqlite3_mem_methods defaultMethods = { - sqlite3MemMalloc, - sqlite3MemFree, - sqlite3MemRealloc, - sqlite3MemSize, - sqlite3MemRoundup, - sqlite3MemInit, - sqlite3MemShutdown, - 0 - }; - sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); -} - -#endif /* SQLITE_SYSTEM_MALLOC */ - -/************** End of mem1.c ************************************************/ -/************** Begin file mem2.c ********************************************/ -/* -** 2007 August 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains low-level memory allocation drivers for when -** SQLite will use the standard C-library malloc/realloc/free interface -** to obtain the memory it needs while adding lots of additional debugging -** information to each allocation in order to help detect and fix memory -** leaks and memory usage errors. -** -** This file contains implementations of the low-level memory allocation -** routines specified in the sqlite3_mem_methods object. -*/ - -/* -** This version of the memory allocator is used only if the -** SQLITE_MEMDEBUG macro is defined -*/ -#ifdef SQLITE_MEMDEBUG - -/* -** The backtrace functionality is only available with GLIBC -*/ -#ifdef __GLIBC__ - extern int backtrace(void**,int); - extern void backtrace_symbols_fd(void*const*,int,int); -#else -# define backtrace(A,B) 1 -# define backtrace_symbols_fd(A,B,C) -#endif -/* #include */ - -/* -** Each memory allocation looks like this: -** -** ------------------------------------------------------------------------ -** | Title | backtrace pointers | MemBlockHdr | allocation | EndGuard | -** ------------------------------------------------------------------------ -** -** The application code sees only a pointer to the allocation. We have -** to back up from the allocation pointer to find the MemBlockHdr. The -** MemBlockHdr tells us the size of the allocation and the number of -** backtrace pointers. There is also a guard word at the end of the -** MemBlockHdr. -*/ -struct MemBlockHdr { - i64 iSize; /* Size of this allocation */ - struct MemBlockHdr *pNext, *pPrev; /* Linked list of all unfreed memory */ - char nBacktrace; /* Number of backtraces on this alloc */ - char nBacktraceSlots; /* Available backtrace slots */ - u8 nTitle; /* Bytes of title; includes '\0' */ - u8 eType; /* Allocation type code */ - int iForeGuard; /* Guard word for sanity */ -}; - -/* -** Guard words -*/ -#define FOREGUARD 0x80F5E153 -#define REARGUARD 0xE4676B53 - -/* -** Number of malloc size increments to track. -*/ -#define NCSIZE 1000 - -/* -** All of the static variables used by this module are collected -** into a single structure named "mem". This is to keep the -** static variables organized and to reduce namespace pollution -** when this module is combined with other in the amalgamation. -*/ -static struct { - - /* - ** Mutex to control access to the memory allocation subsystem. - */ - sqlite3_mutex *mutex; - - /* - ** Head and tail of a linked list of all outstanding allocations - */ - struct MemBlockHdr *pFirst; - struct MemBlockHdr *pLast; - - /* - ** The number of levels of backtrace to save in new allocations. - */ - int nBacktrace; - void (*xBacktrace)(int, int, void **); - - /* - ** Title text to insert in front of each block - */ - int nTitle; /* Bytes of zTitle to save. Includes '\0' and padding */ - char zTitle[100]; /* The title text */ - - /* - ** sqlite3MallocDisallow() increments the following counter. - ** sqlite3MallocAllow() decrements it. - */ - int disallow; /* Do not allow memory allocation */ - - /* - ** Gather statistics on the sizes of memory allocations. - ** nAlloc[i] is the number of allocation attempts of i*8 - ** bytes. i==NCSIZE is the number of allocation attempts for - ** sizes more than NCSIZE*8 bytes. - */ - int nAlloc[NCSIZE]; /* Total number of allocations */ - int nCurrent[NCSIZE]; /* Current number of allocations */ - int mxCurrent[NCSIZE]; /* Highwater mark for nCurrent */ - -} mem; - - -/* -** Adjust memory usage statistics -*/ -static void adjustStats(int iSize, int increment){ - int i = ROUND8(iSize)/8; - if( i>NCSIZE-1 ){ - i = NCSIZE - 1; - } - if( increment>0 ){ - mem.nAlloc[i]++; - mem.nCurrent[i]++; - if( mem.nCurrent[i]>mem.mxCurrent[i] ){ - mem.mxCurrent[i] = mem.nCurrent[i]; - } - }else{ - mem.nCurrent[i]--; - assert( mem.nCurrent[i]>=0 ); - } -} - -/* -** Given an allocation, find the MemBlockHdr for that allocation. -** -** This routine checks the guards at either end of the allocation and -** if they are incorrect it asserts. -*/ -static struct MemBlockHdr *sqlite3MemsysGetHeader(void *pAllocation){ - struct MemBlockHdr *p; - int *pInt; - u8 *pU8; - int nReserve; - - p = (struct MemBlockHdr*)pAllocation; - p--; - assert( p->iForeGuard==(int)FOREGUARD ); - nReserve = ROUND8(p->iSize); - pInt = (int*)pAllocation; - pU8 = (u8*)pAllocation; - assert( pInt[nReserve/sizeof(int)]==(int)REARGUARD ); - /* This checks any of the "extra" bytes allocated due - ** to rounding up to an 8 byte boundary to ensure - ** they haven't been overwritten. - */ - while( nReserve-- > p->iSize ) assert( pU8[nReserve]==0x65 ); - return p; -} - -/* -** Return the number of bytes currently allocated at address p. -*/ -static int sqlite3MemSize(void *p){ - struct MemBlockHdr *pHdr; - if( !p ){ - return 0; - } - pHdr = sqlite3MemsysGetHeader(p); - return (int)pHdr->iSize; -} - -/* -** Initialize the memory allocation subsystem. -*/ -static int sqlite3MemInit(void *NotUsed){ - UNUSED_PARAMETER(NotUsed); - assert( (sizeof(struct MemBlockHdr)&7) == 0 ); - if( !sqlite3GlobalConfig.bMemstat ){ - /* If memory status is enabled, then the malloc.c wrapper will already - ** hold the STATIC_MEM mutex when the routines here are invoked. */ - mem.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); - } - return SQLITE_OK; -} - -/* -** Deinitialize the memory allocation subsystem. -*/ -static void sqlite3MemShutdown(void *NotUsed){ - UNUSED_PARAMETER(NotUsed); - mem.mutex = 0; -} - -/* -** Round up a request size to the next valid allocation size. -*/ -static int sqlite3MemRoundup(int n){ - return ROUND8(n); -} - -/* -** Fill a buffer with pseudo-random bytes. This is used to preset -** the content of a new memory allocation to unpredictable values and -** to clear the content of a freed allocation to unpredictable values. -*/ -static void randomFill(char *pBuf, int nByte){ - unsigned int x, y, r; - x = SQLITE_PTR_TO_INT(pBuf); - y = nByte | 1; - while( nByte >= 4 ){ - x = (x>>1) ^ (-(int)(x&1) & 0xd0000001); - y = y*1103515245 + 12345; - r = x ^ y; - *(int*)pBuf = r; - pBuf += 4; - nByte -= 4; - } - while( nByte-- > 0 ){ - x = (x>>1) ^ (-(int)(x&1) & 0xd0000001); - y = y*1103515245 + 12345; - r = x ^ y; - *(pBuf++) = r & 0xff; - } -} - -/* -** Allocate nByte bytes of memory. -*/ -static void *sqlite3MemMalloc(int nByte){ - struct MemBlockHdr *pHdr; - void **pBt; - char *z; - int *pInt; - void *p = 0; - int totalSize; - int nReserve; - sqlite3_mutex_enter(mem.mutex); - assert( mem.disallow==0 ); - nReserve = ROUND8(nByte); - totalSize = nReserve + sizeof(*pHdr) + sizeof(int) + - mem.nBacktrace*sizeof(void*) + mem.nTitle; - p = malloc(totalSize); - if( p ){ - z = p; - pBt = (void**)&z[mem.nTitle]; - pHdr = (struct MemBlockHdr*)&pBt[mem.nBacktrace]; - pHdr->pNext = 0; - pHdr->pPrev = mem.pLast; - if( mem.pLast ){ - mem.pLast->pNext = pHdr; - }else{ - mem.pFirst = pHdr; - } - mem.pLast = pHdr; - pHdr->iForeGuard = FOREGUARD; - pHdr->eType = MEMTYPE_HEAP; - pHdr->nBacktraceSlots = mem.nBacktrace; - pHdr->nTitle = mem.nTitle; - if( mem.nBacktrace ){ - void *aAddr[40]; - pHdr->nBacktrace = backtrace(aAddr, mem.nBacktrace+1)-1; - memcpy(pBt, &aAddr[1], pHdr->nBacktrace*sizeof(void*)); - assert(pBt[0]); - if( mem.xBacktrace ){ - mem.xBacktrace(nByte, pHdr->nBacktrace-1, &aAddr[1]); - } - }else{ - pHdr->nBacktrace = 0; - } - if( mem.nTitle ){ - memcpy(z, mem.zTitle, mem.nTitle); - } - pHdr->iSize = nByte; - adjustStats(nByte, +1); - pInt = (int*)&pHdr[1]; - pInt[nReserve/sizeof(int)] = REARGUARD; - randomFill((char*)pInt, nByte); - memset(((char*)pInt)+nByte, 0x65, nReserve-nByte); - p = (void*)pInt; - } - sqlite3_mutex_leave(mem.mutex); - return p; -} - -/* -** Free memory. -*/ -static void sqlite3MemFree(void *pPrior){ - struct MemBlockHdr *pHdr; - void **pBt; - char *z; - assert( sqlite3GlobalConfig.bMemstat || sqlite3GlobalConfig.bCoreMutex==0 - || mem.mutex!=0 ); - pHdr = sqlite3MemsysGetHeader(pPrior); - pBt = (void**)pHdr; - pBt -= pHdr->nBacktraceSlots; - sqlite3_mutex_enter(mem.mutex); - if( pHdr->pPrev ){ - assert( pHdr->pPrev->pNext==pHdr ); - pHdr->pPrev->pNext = pHdr->pNext; - }else{ - assert( mem.pFirst==pHdr ); - mem.pFirst = pHdr->pNext; - } - if( pHdr->pNext ){ - assert( pHdr->pNext->pPrev==pHdr ); - pHdr->pNext->pPrev = pHdr->pPrev; - }else{ - assert( mem.pLast==pHdr ); - mem.pLast = pHdr->pPrev; - } - z = (char*)pBt; - z -= pHdr->nTitle; - adjustStats((int)pHdr->iSize, -1); - randomFill(z, sizeof(void*)*pHdr->nBacktraceSlots + sizeof(*pHdr) + - (int)pHdr->iSize + sizeof(int) + pHdr->nTitle); - free(z); - sqlite3_mutex_leave(mem.mutex); -} - -/* -** Change the size of an existing memory allocation. -** -** For this debugging implementation, we *always* make a copy of the -** allocation into a new place in memory. In this way, if the -** higher level code is using pointer to the old allocation, it is -** much more likely to break and we are much more liking to find -** the error. -*/ -static void *sqlite3MemRealloc(void *pPrior, int nByte){ - struct MemBlockHdr *pOldHdr; - void *pNew; - assert( mem.disallow==0 ); - assert( (nByte & 7)==0 ); /* EV: R-46199-30249 */ - pOldHdr = sqlite3MemsysGetHeader(pPrior); - pNew = sqlite3MemMalloc(nByte); - if( pNew ){ - memcpy(pNew, pPrior, (int)(nByteiSize ? nByte : pOldHdr->iSize)); - if( nByte>pOldHdr->iSize ){ - randomFill(&((char*)pNew)[pOldHdr->iSize], nByte - (int)pOldHdr->iSize); - } - sqlite3MemFree(pPrior); - } - return pNew; -} - -/* -** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. -*/ -SQLITE_PRIVATE void sqlite3MemSetDefault(void){ - static const sqlite3_mem_methods defaultMethods = { - sqlite3MemMalloc, - sqlite3MemFree, - sqlite3MemRealloc, - sqlite3MemSize, - sqlite3MemRoundup, - sqlite3MemInit, - sqlite3MemShutdown, - 0 - }; - sqlite3_config(SQLITE_CONFIG_MALLOC, &defaultMethods); -} - -/* -** Set the "type" of an allocation. -*/ -SQLITE_PRIVATE void sqlite3MemdebugSetType(void *p, u8 eType){ - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ - struct MemBlockHdr *pHdr; - pHdr = sqlite3MemsysGetHeader(p); - assert( pHdr->iForeGuard==FOREGUARD ); - pHdr->eType = eType; - } -} - -/* -** Return TRUE if the mask of type in eType matches the type of the -** allocation p. Also return true if p==NULL. -** -** This routine is designed for use within an assert() statement, to -** verify the type of an allocation. For example: -** -** assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) ); -*/ -SQLITE_PRIVATE int sqlite3MemdebugHasType(void *p, u8 eType){ - int rc = 1; - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ - struct MemBlockHdr *pHdr; - pHdr = sqlite3MemsysGetHeader(p); - assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */ - if( (pHdr->eType&eType)==0 ){ - rc = 0; - } - } - return rc; -} - -/* -** Return TRUE if the mask of type in eType matches no bits of the type of the -** allocation p. Also return true if p==NULL. -** -** This routine is designed for use within an assert() statement, to -** verify the type of an allocation. For example: -** -** assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) ); -*/ -SQLITE_PRIVATE int sqlite3MemdebugNoType(void *p, u8 eType){ - int rc = 1; - if( p && sqlite3GlobalConfig.m.xMalloc==sqlite3MemMalloc ){ - struct MemBlockHdr *pHdr; - pHdr = sqlite3MemsysGetHeader(p); - assert( pHdr->iForeGuard==FOREGUARD ); /* Allocation is valid */ - if( (pHdr->eType&eType)!=0 ){ - rc = 0; - } - } - return rc; -} - -/* -** Set the number of backtrace levels kept for each allocation. -** A value of zero turns off backtracing. The number is always rounded -** up to a multiple of 2. -*/ -SQLITE_PRIVATE void sqlite3MemdebugBacktrace(int depth){ - if( depth<0 ){ depth = 0; } - if( depth>20 ){ depth = 20; } - depth = (depth+1)&0xfe; - mem.nBacktrace = depth; -} - -SQLITE_PRIVATE void sqlite3MemdebugBacktraceCallback(void (*xBacktrace)(int, int, void **)){ - mem.xBacktrace = xBacktrace; -} - -/* -** Set the title string for subsequent allocations. -*/ -SQLITE_PRIVATE void sqlite3MemdebugSettitle(const char *zTitle){ - unsigned int n = sqlite3Strlen30(zTitle) + 1; - sqlite3_mutex_enter(mem.mutex); - if( n>=sizeof(mem.zTitle) ) n = sizeof(mem.zTitle)-1; - memcpy(mem.zTitle, zTitle, n); - mem.zTitle[n] = 0; - mem.nTitle = ROUND8(n); - sqlite3_mutex_leave(mem.mutex); -} - -SQLITE_PRIVATE void sqlite3MemdebugSync(){ - struct MemBlockHdr *pHdr; - for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){ - void **pBt = (void**)pHdr; - pBt -= pHdr->nBacktraceSlots; - mem.xBacktrace((int)pHdr->iSize, pHdr->nBacktrace-1, &pBt[1]); - } -} - -/* -** Open the file indicated and write a log of all unfreed memory -** allocations into that log. -*/ -SQLITE_PRIVATE void sqlite3MemdebugDump(const char *zFilename){ - FILE *out; - struct MemBlockHdr *pHdr; - void **pBt; - int i; - out = fopen(zFilename, "w"); - if( out==0 ){ - fprintf(stderr, "** Unable to output memory debug output log: %s **\n", - zFilename); - return; - } - for(pHdr=mem.pFirst; pHdr; pHdr=pHdr->pNext){ - char *z = (char*)pHdr; - z -= pHdr->nBacktraceSlots*sizeof(void*) + pHdr->nTitle; - fprintf(out, "**** %lld bytes at %p from %s ****\n", - pHdr->iSize, &pHdr[1], pHdr->nTitle ? z : "???"); - if( pHdr->nBacktrace ){ - fflush(out); - pBt = (void**)pHdr; - pBt -= pHdr->nBacktraceSlots; - backtrace_symbols_fd(pBt, pHdr->nBacktrace, fileno(out)); - fprintf(out, "\n"); - } - } - fprintf(out, "COUNTS:\n"); - for(i=0; i=1 ); - size = mem3.aPool[i-1].u.hdr.size4x/4; - assert( size==mem3.aPool[i+size-1].u.hdr.prevSize ); - assert( size>=2 ); - if( size <= MX_SMALL ){ - memsys3UnlinkFromList(i, &mem3.aiSmall[size-2]); - }else{ - hash = size % N_HASH; - memsys3UnlinkFromList(i, &mem3.aiHash[hash]); - } -} - -/* -** Link the chunk at mem3.aPool[i] so that is on the list rooted -** at *pRoot. -*/ -static void memsys3LinkIntoList(u32 i, u32 *pRoot){ - assert( sqlite3_mutex_held(mem3.mutex) ); - mem3.aPool[i].u.list.next = *pRoot; - mem3.aPool[i].u.list.prev = 0; - if( *pRoot ){ - mem3.aPool[*pRoot].u.list.prev = i; - } - *pRoot = i; -} - -/* -** Link the chunk at index i into either the appropriate -** small chunk list, or into the large chunk hash table. -*/ -static void memsys3Link(u32 i){ - u32 size, hash; - assert( sqlite3_mutex_held(mem3.mutex) ); - assert( i>=1 ); - assert( (mem3.aPool[i-1].u.hdr.size4x & 1)==0 ); - size = mem3.aPool[i-1].u.hdr.size4x/4; - assert( size==mem3.aPool[i+size-1].u.hdr.prevSize ); - assert( size>=2 ); - if( size <= MX_SMALL ){ - memsys3LinkIntoList(i, &mem3.aiSmall[size-2]); - }else{ - hash = size % N_HASH; - memsys3LinkIntoList(i, &mem3.aiHash[hash]); - } -} - -/* -** If the STATIC_MEM mutex is not already held, obtain it now. The mutex -** will already be held (obtained by code in malloc.c) if -** sqlite3GlobalConfig.bMemStat is true. -*/ -static void memsys3Enter(void){ - if( sqlite3GlobalConfig.bMemstat==0 && mem3.mutex==0 ){ - mem3.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); - } - sqlite3_mutex_enter(mem3.mutex); -} -static void memsys3Leave(void){ - sqlite3_mutex_leave(mem3.mutex); -} - -/* -** Called when we are unable to satisfy an allocation of nBytes. -*/ -static void memsys3OutOfMemory(int nByte){ - if( !mem3.alarmBusy ){ - mem3.alarmBusy = 1; - assert( sqlite3_mutex_held(mem3.mutex) ); - sqlite3_mutex_leave(mem3.mutex); - sqlite3_release_memory(nByte); - sqlite3_mutex_enter(mem3.mutex); - mem3.alarmBusy = 0; - } -} - - -/* -** Chunk i is a free chunk that has been unlinked. Adjust its -** size parameters for check-out and return a pointer to the -** user portion of the chunk. -*/ -static void *memsys3Checkout(u32 i, u32 nBlock){ - u32 x; - assert( sqlite3_mutex_held(mem3.mutex) ); - assert( i>=1 ); - assert( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ); - assert( mem3.aPool[i+nBlock-1].u.hdr.prevSize==nBlock ); - x = mem3.aPool[i-1].u.hdr.size4x; - mem3.aPool[i-1].u.hdr.size4x = nBlock*4 | 1 | (x&2); - mem3.aPool[i+nBlock-1].u.hdr.prevSize = nBlock; - mem3.aPool[i+nBlock-1].u.hdr.size4x |= 2; - return &mem3.aPool[i]; -} - -/* -** Carve a piece off of the end of the mem3.iMaster free chunk. -** Return a pointer to the new allocation. Or, if the master chunk -** is not large enough, return 0. -*/ -static void *memsys3FromMaster(u32 nBlock){ - assert( sqlite3_mutex_held(mem3.mutex) ); - assert( mem3.szMaster>=nBlock ); - if( nBlock>=mem3.szMaster-1 ){ - /* Use the entire master */ - void *p = memsys3Checkout(mem3.iMaster, mem3.szMaster); - mem3.iMaster = 0; - mem3.szMaster = 0; - mem3.mnMaster = 0; - return p; - }else{ - /* Split the master block. Return the tail. */ - u32 newi, x; - newi = mem3.iMaster + mem3.szMaster - nBlock; - assert( newi > mem3.iMaster+1 ); - mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = nBlock; - mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x |= 2; - mem3.aPool[newi-1].u.hdr.size4x = nBlock*4 + 1; - mem3.szMaster -= nBlock; - mem3.aPool[newi-1].u.hdr.prevSize = mem3.szMaster; - x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2; - mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x; - if( mem3.szMaster < mem3.mnMaster ){ - mem3.mnMaster = mem3.szMaster; - } - return (void*)&mem3.aPool[newi]; - } -} - -/* -** *pRoot is the head of a list of free chunks of the same size -** or same size hash. In other words, *pRoot is an entry in either -** mem3.aiSmall[] or mem3.aiHash[]. -** -** This routine examines all entries on the given list and tries -** to coalesce each entries with adjacent free chunks. -** -** If it sees a chunk that is larger than mem3.iMaster, it replaces -** the current mem3.iMaster with the new larger chunk. In order for -** this mem3.iMaster replacement to work, the master chunk must be -** linked into the hash tables. That is not the normal state of -** affairs, of course. The calling routine must link the master -** chunk before invoking this routine, then must unlink the (possibly -** changed) master chunk once this routine has finished. -*/ -static void memsys3Merge(u32 *pRoot){ - u32 iNext, prev, size, i, x; - - assert( sqlite3_mutex_held(mem3.mutex) ); - for(i=*pRoot; i>0; i=iNext){ - iNext = mem3.aPool[i].u.list.next; - size = mem3.aPool[i-1].u.hdr.size4x; - assert( (size&1)==0 ); - if( (size&2)==0 ){ - memsys3UnlinkFromList(i, pRoot); - assert( i > mem3.aPool[i-1].u.hdr.prevSize ); - prev = i - mem3.aPool[i-1].u.hdr.prevSize; - if( prev==iNext ){ - iNext = mem3.aPool[prev].u.list.next; - } - memsys3Unlink(prev); - size = i + size/4 - prev; - x = mem3.aPool[prev-1].u.hdr.size4x & 2; - mem3.aPool[prev-1].u.hdr.size4x = size*4 | x; - mem3.aPool[prev+size-1].u.hdr.prevSize = size; - memsys3Link(prev); - i = prev; - }else{ - size /= 4; - } - if( size>mem3.szMaster ){ - mem3.iMaster = i; - mem3.szMaster = size; - } - } -} - -/* -** Return a block of memory of at least nBytes in size. -** Return NULL if unable. -** -** This function assumes that the necessary mutexes, if any, are -** already held by the caller. Hence "Unsafe". -*/ -static void *memsys3MallocUnsafe(int nByte){ - u32 i; - u32 nBlock; - u32 toFree; - - assert( sqlite3_mutex_held(mem3.mutex) ); - assert( sizeof(Mem3Block)==8 ); - if( nByte<=12 ){ - nBlock = 2; - }else{ - nBlock = (nByte + 11)/8; - } - assert( nBlock>=2 ); - - /* STEP 1: - ** Look for an entry of the correct size in either the small - ** chunk table or in the large chunk hash table. This is - ** successful most of the time (about 9 times out of 10). - */ - if( nBlock <= MX_SMALL ){ - i = mem3.aiSmall[nBlock-2]; - if( i>0 ){ - memsys3UnlinkFromList(i, &mem3.aiSmall[nBlock-2]); - return memsys3Checkout(i, nBlock); - } - }else{ - int hash = nBlock % N_HASH; - for(i=mem3.aiHash[hash]; i>0; i=mem3.aPool[i].u.list.next){ - if( mem3.aPool[i-1].u.hdr.size4x/4==nBlock ){ - memsys3UnlinkFromList(i, &mem3.aiHash[hash]); - return memsys3Checkout(i, nBlock); - } - } - } - - /* STEP 2: - ** Try to satisfy the allocation by carving a piece off of the end - ** of the master chunk. This step usually works if step 1 fails. - */ - if( mem3.szMaster>=nBlock ){ - return memsys3FromMaster(nBlock); - } - - - /* STEP 3: - ** Loop through the entire memory pool. Coalesce adjacent free - ** chunks. Recompute the master chunk as the largest free chunk. - ** Then try again to satisfy the allocation by carving a piece off - ** of the end of the master chunk. This step happens very - ** rarely (we hope!) - */ - for(toFree=nBlock*16; toFree<(mem3.nPool*16); toFree *= 2){ - memsys3OutOfMemory(toFree); - if( mem3.iMaster ){ - memsys3Link(mem3.iMaster); - mem3.iMaster = 0; - mem3.szMaster = 0; - } - for(i=0; i=nBlock ){ - return memsys3FromMaster(nBlock); - } - } - } - - /* If none of the above worked, then we fail. */ - return 0; -} - -/* -** Free an outstanding memory allocation. -** -** This function assumes that the necessary mutexes, if any, are -** already held by the caller. Hence "Unsafe". -*/ -static void memsys3FreeUnsafe(void *pOld){ - Mem3Block *p = (Mem3Block*)pOld; - int i; - u32 size, x; - assert( sqlite3_mutex_held(mem3.mutex) ); - assert( p>mem3.aPool && p<&mem3.aPool[mem3.nPool] ); - i = p - mem3.aPool; - assert( (mem3.aPool[i-1].u.hdr.size4x&1)==1 ); - size = mem3.aPool[i-1].u.hdr.size4x/4; - assert( i+size<=mem3.nPool+1 ); - mem3.aPool[i-1].u.hdr.size4x &= ~1; - mem3.aPool[i+size-1].u.hdr.prevSize = size; - mem3.aPool[i+size-1].u.hdr.size4x &= ~2; - memsys3Link(i); - - /* Try to expand the master using the newly freed chunk */ - if( mem3.iMaster ){ - while( (mem3.aPool[mem3.iMaster-1].u.hdr.size4x&2)==0 ){ - size = mem3.aPool[mem3.iMaster-1].u.hdr.prevSize; - mem3.iMaster -= size; - mem3.szMaster += size; - memsys3Unlink(mem3.iMaster); - x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2; - mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x; - mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster; - } - x = mem3.aPool[mem3.iMaster-1].u.hdr.size4x & 2; - while( (mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x&1)==0 ){ - memsys3Unlink(mem3.iMaster+mem3.szMaster); - mem3.szMaster += mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.size4x/4; - mem3.aPool[mem3.iMaster-1].u.hdr.size4x = mem3.szMaster*4 | x; - mem3.aPool[mem3.iMaster+mem3.szMaster-1].u.hdr.prevSize = mem3.szMaster; - } - } -} - -/* -** Return the size of an outstanding allocation, in bytes. The -** size returned omits the 8-byte header overhead. This only -** works for chunks that are currently checked out. -*/ -static int memsys3Size(void *p){ - Mem3Block *pBlock; - if( p==0 ) return 0; - pBlock = (Mem3Block*)p; - assert( (pBlock[-1].u.hdr.size4x&1)!=0 ); - return (pBlock[-1].u.hdr.size4x&~3)*2 - 4; -} - -/* -** Round up a request size to the next valid allocation size. -*/ -static int memsys3Roundup(int n){ - if( n<=12 ){ - return 12; - }else{ - return ((n+11)&~7) - 4; - } -} - -/* -** Allocate nBytes of memory. -*/ -static void *memsys3Malloc(int nBytes){ - sqlite3_int64 *p; - assert( nBytes>0 ); /* malloc.c filters out 0 byte requests */ - memsys3Enter(); - p = memsys3MallocUnsafe(nBytes); - memsys3Leave(); - return (void*)p; -} - -/* -** Free memory. -*/ -static void memsys3Free(void *pPrior){ - assert( pPrior ); - memsys3Enter(); - memsys3FreeUnsafe(pPrior); - memsys3Leave(); -} - -/* -** Change the size of an existing memory allocation -*/ -static void *memsys3Realloc(void *pPrior, int nBytes){ - int nOld; - void *p; - if( pPrior==0 ){ - return sqlite3_malloc(nBytes); - } - if( nBytes<=0 ){ - sqlite3_free(pPrior); - return 0; - } - nOld = memsys3Size(pPrior); - if( nBytes<=nOld && nBytes>=nOld-128 ){ - return pPrior; - } - memsys3Enter(); - p = memsys3MallocUnsafe(nBytes); - if( p ){ - if( nOld>1)!=(size&1) ){ - fprintf(out, "%p tail checkout bit is incorrect\n", &mem3.aPool[i]); - assert( 0 ); - break; - } - if( size&1 ){ - fprintf(out, "%p %6d bytes checked out\n", &mem3.aPool[i], (size/4)*8-8); - }else{ - fprintf(out, "%p %6d bytes free%s\n", &mem3.aPool[i], (size/4)*8-8, - i==mem3.iMaster ? " **master**" : ""); - } - } - for(i=0; i0; j=mem3.aPool[j].u.list.next){ - fprintf(out, " %p(%d)", &mem3.aPool[j], - (mem3.aPool[j-1].u.hdr.size4x/4)*8-8); - } - fprintf(out, "\n"); - } - for(i=0; i0; j=mem3.aPool[j].u.list.next){ - fprintf(out, " %p(%d)", &mem3.aPool[j], - (mem3.aPool[j-1].u.hdr.size4x/4)*8-8); - } - fprintf(out, "\n"); - } - fprintf(out, "master=%d\n", mem3.iMaster); - fprintf(out, "nowUsed=%d\n", mem3.nPool*8 - mem3.szMaster*8); - fprintf(out, "mxUsed=%d\n", mem3.nPool*8 - mem3.mnMaster*8); - sqlite3_mutex_leave(mem3.mutex); - if( out==stdout ){ - fflush(stdout); - }else{ - fclose(out); - } -#else - UNUSED_PARAMETER(zFilename); -#endif -} - -/* -** This routine is the only routine in this file with external -** linkage. -** -** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. The -** arguments specify the block of memory to manage. -** -** This routine is only called by sqlite3_config(), and therefore -** is not required to be threadsafe (it is not). -*/ -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys3(void){ - static const sqlite3_mem_methods mempoolMethods = { - memsys3Malloc, - memsys3Free, - memsys3Realloc, - memsys3Size, - memsys3Roundup, - memsys3Init, - memsys3Shutdown, - 0 - }; - return &mempoolMethods; -} - -#endif /* SQLITE_ENABLE_MEMSYS3 */ - -/************** End of mem3.c ************************************************/ -/************** Begin file mem5.c ********************************************/ -/* -** 2007 October 14 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the C functions that implement a memory -** allocation subsystem for use by SQLite. -** -** This version of the memory allocation subsystem omits all -** use of malloc(). The application gives SQLite a block of memory -** before calling sqlite3_initialize() from which allocations -** are made and returned by the xMalloc() and xRealloc() -** implementations. Once sqlite3_initialize() has been called, -** the amount of memory available to SQLite is fixed and cannot -** be changed. -** -** This version of the memory allocation subsystem is included -** in the build only if SQLITE_ENABLE_MEMSYS5 is defined. -** -** This memory allocator uses the following algorithm: -** -** 1. All memory allocations sizes are rounded up to a power of 2. -** -** 2. If two adjacent free blocks are the halves of a larger block, -** then the two blocks are coalesed into the single larger block. -** -** 3. New memory is allocated from the first available free block. -** -** This algorithm is described in: J. M. Robson. "Bounds for Some Functions -** Concerning Dynamic Storage Allocation". Journal of the Association for -** Computing Machinery, Volume 21, Number 8, July 1974, pages 491-499. -** -** Let n be the size of the largest allocation divided by the minimum -** allocation size (after rounding all sizes up to a power of 2.) Let M -** be the maximum amount of memory ever outstanding at one time. Let -** N be the total amount of memory available for allocation. Robson -** proved that this memory allocator will never breakdown due to -** fragmentation as long as the following constraint holds: -** -** N >= M*(1 + log2(n)/2) - n + 1 -** -** The sqlite3_status() logic tracks the maximum values of n and M so -** that an application can, at any time, verify this constraint. -*/ - -/* -** This version of the memory allocator is used only when -** SQLITE_ENABLE_MEMSYS5 is defined. -*/ -#ifdef SQLITE_ENABLE_MEMSYS5 - -/* -** A minimum allocation is an instance of the following structure. -** Larger allocations are an array of these structures where the -** size of the array is a power of 2. -** -** The size of this object must be a power of two. That fact is -** verified in memsys5Init(). -*/ -typedef struct Mem5Link Mem5Link; -struct Mem5Link { - int next; /* Index of next free chunk */ - int prev; /* Index of previous free chunk */ -}; - -/* -** Maximum size of any allocation is ((1<=0 && i=0 && iLogsize<=LOGMAX ); - assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize ); - - next = MEM5LINK(i)->next; - prev = MEM5LINK(i)->prev; - if( prev<0 ){ - mem5.aiFreelist[iLogsize] = next; - }else{ - MEM5LINK(prev)->next = next; - } - if( next>=0 ){ - MEM5LINK(next)->prev = prev; - } -} - -/* -** Link the chunk at mem5.aPool[i] so that is on the iLogsize -** free list. -*/ -static void memsys5Link(int i, int iLogsize){ - int x; - assert( sqlite3_mutex_held(mem5.mutex) ); - assert( i>=0 && i=0 && iLogsize<=LOGMAX ); - assert( (mem5.aCtrl[i] & CTRL_LOGSIZE)==iLogsize ); - - x = MEM5LINK(i)->next = mem5.aiFreelist[iLogsize]; - MEM5LINK(i)->prev = -1; - if( x>=0 ){ - assert( xprev = i; - } - mem5.aiFreelist[iLogsize] = i; -} - -/* -** If the STATIC_MEM mutex is not already held, obtain it now. The mutex -** will already be held (obtained by code in malloc.c) if -** sqlite3GlobalConfig.bMemStat is true. -*/ -static void memsys5Enter(void){ - sqlite3_mutex_enter(mem5.mutex); -} -static void memsys5Leave(void){ - sqlite3_mutex_leave(mem5.mutex); -} - -/* -** Return the size of an outstanding allocation, in bytes. The -** size returned omits the 8-byte header overhead. This only -** works for chunks that are currently checked out. -*/ -static int memsys5Size(void *p){ - int iSize = 0; - if( p ){ - int i = (int)(((u8 *)p-mem5.zPool)/mem5.szAtom); - assert( i>=0 && i0 ); - - /* Keep track of the maximum allocation request. Even unfulfilled - ** requests are counted */ - if( (u32)nByte>mem5.maxRequest ){ - mem5.maxRequest = nByte; - } - - /* Abort if the requested allocation size is larger than the largest - ** power of two that we can represent using 32-bit signed integers. - */ - if( nByte > 0x40000000 ){ - return 0; - } - - /* Round nByte up to the next valid power of two */ - for(iFullSz=mem5.szAtom, iLogsize=0; iFullSzLOGMAX ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_NOMEM, "failed to allocate %u bytes", nByte); - return 0; - } - i = mem5.aiFreelist[iBin]; - memsys5Unlink(i, iBin); - while( iBin>iLogsize ){ - int newSize; - - iBin--; - newSize = 1 << iBin; - mem5.aCtrl[i+newSize] = CTRL_FREE | iBin; - memsys5Link(i+newSize, iBin); - } - mem5.aCtrl[i] = iLogsize; - - /* Update allocator performance statistics. */ - mem5.nAlloc++; - mem5.totalAlloc += iFullSz; - mem5.totalExcess += iFullSz - nByte; - mem5.currentCount++; - mem5.currentOut += iFullSz; - if( mem5.maxCount=0 && iBlock0 ); - assert( mem5.currentOut>=(size*mem5.szAtom) ); - mem5.currentCount--; - mem5.currentOut -= size*mem5.szAtom; - assert( mem5.currentOut>0 || mem5.currentCount==0 ); - assert( mem5.currentCount>0 || mem5.currentOut==0 ); - - mem5.aCtrl[iBlock] = CTRL_FREE | iLogsize; - while( ALWAYS(iLogsize>iLogsize) & 1 ){ - iBuddy = iBlock - size; - }else{ - iBuddy = iBlock + size; - } - assert( iBuddy>=0 ); - if( (iBuddy+(1<mem5.nBlock ) break; - if( mem5.aCtrl[iBuddy]!=(CTRL_FREE | iLogsize) ) break; - memsys5Unlink(iBuddy, iLogsize); - iLogsize++; - if( iBuddy0 ){ - memsys5Enter(); - p = memsys5MallocUnsafe(nBytes); - memsys5Leave(); - } - return (void*)p; -} - -/* -** Free memory. -** -** The outer layer memory allocator prevents this routine from -** being called with pPrior==0. -*/ -static void memsys5Free(void *pPrior){ - assert( pPrior!=0 ); - memsys5Enter(); - memsys5FreeUnsafe(pPrior); - memsys5Leave(); -} - -/* -** Change the size of an existing memory allocation. -** -** The outer layer memory allocator prevents this routine from -** being called with pPrior==0. -** -** nBytes is always a value obtained from a prior call to -** memsys5Round(). Hence nBytes is always a non-negative power -** of two. If nBytes==0 that means that an oversize allocation -** (an allocation larger than 0x40000000) was requested and this -** routine should return 0 without freeing pPrior. -*/ -static void *memsys5Realloc(void *pPrior, int nBytes){ - int nOld; - void *p; - assert( pPrior!=0 ); - assert( (nBytes&(nBytes-1))==0 ); /* EV: R-46199-30249 */ - assert( nBytes>=0 ); - if( nBytes==0 ){ - return 0; - } - nOld = memsys5Size(pPrior); - if( nBytes<=nOld ){ - return pPrior; - } - memsys5Enter(); - p = memsys5MallocUnsafe(nBytes); - if( p ){ - memcpy(p, pPrior, nOld); - memsys5FreeUnsafe(pPrior); - } - memsys5Leave(); - return p; -} - -/* -** Round up a request size to the next valid allocation size. If -** the allocation is too large to be handled by this allocation system, -** return 0. -** -** All allocations must be a power of two and must be expressed by a -** 32-bit signed integer. Hence the largest allocation is 0x40000000 -** or 1073741824 bytes. -*/ -static int memsys5Roundup(int n){ - int iFullSz; - if( n > 0x40000000 ) return 0; - for(iFullSz=mem5.szAtom; iFullSz 0 -** memsys5Log(2) -> 1 -** memsys5Log(4) -> 2 -** memsys5Log(5) -> 3 -** memsys5Log(8) -> 3 -** memsys5Log(9) -> 4 -*/ -static int memsys5Log(int iValue){ - int iLog; - for(iLog=0; (iLog<(int)((sizeof(int)*8)-1)) && (1<mem5.szAtom ){ - mem5.szAtom = mem5.szAtom << 1; - } - - mem5.nBlock = (nByte / (mem5.szAtom+sizeof(u8))); - mem5.zPool = zByte; - mem5.aCtrl = (u8 *)&mem5.zPool[mem5.nBlock*mem5.szAtom]; - - for(ii=0; ii<=LOGMAX; ii++){ - mem5.aiFreelist[ii] = -1; - } - - iOffset = 0; - for(ii=LOGMAX; ii>=0; ii--){ - int nAlloc = (1<mem5.nBlock); - } - - /* If a mutex is required for normal operation, allocate one */ - if( sqlite3GlobalConfig.bMemstat==0 ){ - mem5.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); - } - - return SQLITE_OK; -} - -/* -** Deinitialize this module. -*/ -static void memsys5Shutdown(void *NotUsed){ - UNUSED_PARAMETER(NotUsed); - mem5.mutex = 0; - return; -} - -#ifdef SQLITE_TEST -/* -** Open the file indicated and write a log of all unfreed memory -** allocations into that log. -*/ -SQLITE_PRIVATE void sqlite3Memsys5Dump(const char *zFilename){ - FILE *out; - int i, j, n; - int nMinLog; - - if( zFilename==0 || zFilename[0]==0 ){ - out = stdout; - }else{ - out = fopen(zFilename, "w"); - if( out==0 ){ - fprintf(stderr, "** Unable to output memory debug output log: %s **\n", - zFilename); - return; - } - } - memsys5Enter(); - nMinLog = memsys5Log(mem5.szAtom); - for(i=0; i<=LOGMAX && i+nMinLog<32; i++){ - for(n=0, j=mem5.aiFreelist[i]; j>=0; j = MEM5LINK(j)->next, n++){} - fprintf(out, "freelist items of size %d: %d\n", mem5.szAtom << i, n); - } - fprintf(out, "mem5.nAlloc = %llu\n", mem5.nAlloc); - fprintf(out, "mem5.totalAlloc = %llu\n", mem5.totalAlloc); - fprintf(out, "mem5.totalExcess = %llu\n", mem5.totalExcess); - fprintf(out, "mem5.currentOut = %u\n", mem5.currentOut); - fprintf(out, "mem5.currentCount = %u\n", mem5.currentCount); - fprintf(out, "mem5.maxOut = %u\n", mem5.maxOut); - fprintf(out, "mem5.maxCount = %u\n", mem5.maxCount); - fprintf(out, "mem5.maxRequest = %u\n", mem5.maxRequest); - memsys5Leave(); - if( out==stdout ){ - fflush(stdout); - }else{ - fclose(out); - } -} -#endif - -/* -** This routine is the only routine in this file with external -** linkage. It returns a pointer to a static sqlite3_mem_methods -** struct populated with the memsys5 methods. -*/ -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetMemsys5(void){ - static const sqlite3_mem_methods memsys5Methods = { - memsys5Malloc, - memsys5Free, - memsys5Realloc, - memsys5Size, - memsys5Roundup, - memsys5Init, - memsys5Shutdown, - 0 - }; - return &memsys5Methods; -} - -#endif /* SQLITE_ENABLE_MEMSYS5 */ - -/************** End of mem5.c ************************************************/ -/************** Begin file mutex.c *******************************************/ -/* -** 2007 August 14 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the C functions that implement mutexes. -** -** This file contains code that is common across all mutex implementations. -*/ - -#if defined(SQLITE_DEBUG) && !defined(SQLITE_MUTEX_OMIT) -/* -** For debugging purposes, record when the mutex subsystem is initialized -** and uninitialized so that we can assert() if there is an attempt to -** allocate a mutex while the system is uninitialized. -*/ -static SQLITE_WSD int mutexIsInit = 0; -#endif /* SQLITE_DEBUG */ - - -#ifndef SQLITE_MUTEX_OMIT -/* -** Initialize the mutex system. -*/ -SQLITE_PRIVATE int sqlite3MutexInit(void){ - int rc = SQLITE_OK; - if( !sqlite3GlobalConfig.mutex.xMutexAlloc ){ - /* If the xMutexAlloc method has not been set, then the user did not - ** install a mutex implementation via sqlite3_config() prior to - ** sqlite3_initialize() being called. This block copies pointers to - ** the default implementation into the sqlite3GlobalConfig structure. - */ - sqlite3_mutex_methods const *pFrom; - sqlite3_mutex_methods *pTo = &sqlite3GlobalConfig.mutex; - - if( sqlite3GlobalConfig.bCoreMutex ){ - pFrom = sqlite3DefaultMutex(); - }else{ - pFrom = sqlite3NoopMutex(); - } - memcpy(pTo, pFrom, offsetof(sqlite3_mutex_methods, xMutexAlloc)); - memcpy(&pTo->xMutexFree, &pFrom->xMutexFree, - sizeof(*pTo) - offsetof(sqlite3_mutex_methods, xMutexFree)); - pTo->xMutexAlloc = pFrom->xMutexAlloc; - } - rc = sqlite3GlobalConfig.mutex.xMutexInit(); - -#ifdef SQLITE_DEBUG - GLOBAL(int, mutexIsInit) = 1; -#endif - - return rc; -} - -/* -** Shutdown the mutex system. This call frees resources allocated by -** sqlite3MutexInit(). -*/ -SQLITE_PRIVATE int sqlite3MutexEnd(void){ - int rc = SQLITE_OK; - if( sqlite3GlobalConfig.mutex.xMutexEnd ){ - rc = sqlite3GlobalConfig.mutex.xMutexEnd(); - } - -#ifdef SQLITE_DEBUG - GLOBAL(int, mutexIsInit) = 0; -#endif - - return rc; -} - -/* -** Retrieve a pointer to a static mutex or allocate a new dynamic one. -*/ -SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int id){ -#ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; -#endif - return sqlite3GlobalConfig.mutex.xMutexAlloc(id); -} - -SQLITE_PRIVATE sqlite3_mutex *sqlite3MutexAlloc(int id){ - if( !sqlite3GlobalConfig.bCoreMutex ){ - return 0; - } - assert( GLOBAL(int, mutexIsInit) ); - return sqlite3GlobalConfig.mutex.xMutexAlloc(id); -} - -/* -** Free a dynamic mutex. -*/ -SQLITE_API void sqlite3_mutex_free(sqlite3_mutex *p){ - if( p ){ - sqlite3GlobalConfig.mutex.xMutexFree(p); - } -} - -/* -** Obtain the mutex p. If some other thread already has the mutex, block -** until it can be obtained. -*/ -SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex *p){ - if( p ){ - sqlite3GlobalConfig.mutex.xMutexEnter(p); - } -} - -/* -** Obtain the mutex p. If successful, return SQLITE_OK. Otherwise, if another -** thread holds the mutex and it cannot be obtained, return SQLITE_BUSY. -*/ -SQLITE_API int sqlite3_mutex_try(sqlite3_mutex *p){ - int rc = SQLITE_OK; - if( p ){ - return sqlite3GlobalConfig.mutex.xMutexTry(p); - } - return rc; -} - -/* -** The sqlite3_mutex_leave() routine exits a mutex that was previously -** entered by the same thread. The behavior is undefined if the mutex -** is not currently entered. If a NULL pointer is passed as an argument -** this function is a no-op. -*/ -SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex *p){ - if( p ){ - sqlite3GlobalConfig.mutex.xMutexLeave(p); - } -} - -#ifndef NDEBUG -/* -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are -** intended for use inside assert() statements. -*/ -SQLITE_API int sqlite3_mutex_held(sqlite3_mutex *p){ - return p==0 || sqlite3GlobalConfig.mutex.xMutexHeld(p); -} -SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex *p){ - return p==0 || sqlite3GlobalConfig.mutex.xMutexNotheld(p); -} -#endif - -#endif /* !defined(SQLITE_MUTEX_OMIT) */ - -/************** End of mutex.c ***********************************************/ -/************** Begin file mutex_noop.c **************************************/ -/* -** 2008 October 07 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the C functions that implement mutexes. -** -** This implementation in this file does not provide any mutual -** exclusion and is thus suitable for use only in applications -** that use SQLite in a single thread. The routines defined -** here are place-holders. Applications can substitute working -** mutex routines at start-time using the -** -** sqlite3_config(SQLITE_CONFIG_MUTEX,...) -** -** interface. -** -** If compiled with SQLITE_DEBUG, then additional logic is inserted -** that does error checking on mutexes to make sure they are being -** called correctly. -*/ - -#ifndef SQLITE_MUTEX_OMIT - -#ifndef SQLITE_DEBUG -/* -** Stub routines for all mutex methods. -** -** This routines provide no mutual exclusion or error checking. -*/ -static int noopMutexInit(void){ return SQLITE_OK; } -static int noopMutexEnd(void){ return SQLITE_OK; } -static sqlite3_mutex *noopMutexAlloc(int id){ - UNUSED_PARAMETER(id); - return (sqlite3_mutex*)8; -} -static void noopMutexFree(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } -static void noopMutexEnter(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } -static int noopMutexTry(sqlite3_mutex *p){ - UNUSED_PARAMETER(p); - return SQLITE_OK; -} -static void noopMutexLeave(sqlite3_mutex *p){ UNUSED_PARAMETER(p); return; } - -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){ - static const sqlite3_mutex_methods sMutex = { - noopMutexInit, - noopMutexEnd, - noopMutexAlloc, - noopMutexFree, - noopMutexEnter, - noopMutexTry, - noopMutexLeave, - - 0, - 0, - }; - - return &sMutex; -} -#endif /* !SQLITE_DEBUG */ - -#ifdef SQLITE_DEBUG -/* -** In this implementation, error checking is provided for testing -** and debugging purposes. The mutexes still do not provide any -** mutual exclusion. -*/ - -/* -** The mutex object -*/ -typedef struct sqlite3_debug_mutex { - int id; /* The mutex type */ - int cnt; /* Number of entries without a matching leave */ -} sqlite3_debug_mutex; - -/* -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are -** intended for use inside assert() statements. -*/ -static int debugMutexHeld(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; - return p==0 || p->cnt>0; -} -static int debugMutexNotheld(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; - return p==0 || p->cnt==0; -} - -/* -** Initialize and deinitialize the mutex subsystem. -*/ -static int debugMutexInit(void){ return SQLITE_OK; } -static int debugMutexEnd(void){ return SQLITE_OK; } - -/* -** The sqlite3_mutex_alloc() routine allocates a new -** mutex and returns a pointer to it. If it returns NULL -** that means that a mutex could not be allocated. -*/ -static sqlite3_mutex *debugMutexAlloc(int id){ - static sqlite3_debug_mutex aStatic[6]; - sqlite3_debug_mutex *pNew = 0; - switch( id ){ - case SQLITE_MUTEX_FAST: - case SQLITE_MUTEX_RECURSIVE: { - pNew = sqlite3Malloc(sizeof(*pNew)); - if( pNew ){ - pNew->id = id; - pNew->cnt = 0; - } - break; - } - default: { - assert( id-2 >= 0 ); - assert( id-2 < (int)(sizeof(aStatic)/sizeof(aStatic[0])) ); - pNew = &aStatic[id-2]; - pNew->id = id; - break; - } - } - return (sqlite3_mutex*)pNew; -} - -/* -** This routine deallocates a previously allocated mutex. -*/ -static void debugMutexFree(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; - assert( p->cnt==0 ); - assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ); - sqlite3_free(p); -} - -/* -** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt -** to enter a mutex. If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK -** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can -** be entered multiple times by the same thread. In such cases the, -** mutex must be exited an equal number of times before another thread -** can enter. If the same thread tries to enter any other kind of mutex -** more than once, the behavior is undefined. -*/ -static void debugMutexEnter(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; - assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) ); - p->cnt++; -} -static int debugMutexTry(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; - assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) ); - p->cnt++; - return SQLITE_OK; -} - -/* -** The sqlite3_mutex_leave() routine exits a mutex that was -** previously entered by the same thread. The behavior -** is undefined if the mutex is not currently entered or -** is not currently allocated. SQLite will never do either. -*/ -static void debugMutexLeave(sqlite3_mutex *pX){ - sqlite3_debug_mutex *p = (sqlite3_debug_mutex*)pX; - assert( debugMutexHeld(pX) ); - p->cnt--; - assert( p->id==SQLITE_MUTEX_RECURSIVE || debugMutexNotheld(pX) ); -} - -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3NoopMutex(void){ - static const sqlite3_mutex_methods sMutex = { - debugMutexInit, - debugMutexEnd, - debugMutexAlloc, - debugMutexFree, - debugMutexEnter, - debugMutexTry, - debugMutexLeave, - - debugMutexHeld, - debugMutexNotheld - }; - - return &sMutex; -} -#endif /* SQLITE_DEBUG */ - -/* -** If compiled with SQLITE_MUTEX_NOOP, then the no-op mutex implementation -** is used regardless of the run-time threadsafety setting. -*/ -#ifdef SQLITE_MUTEX_NOOP -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ - return sqlite3NoopMutex(); -} -#endif /* defined(SQLITE_MUTEX_NOOP) */ -#endif /* !defined(SQLITE_MUTEX_OMIT) */ - -/************** End of mutex_noop.c ******************************************/ -/************** Begin file mutex_unix.c **************************************/ -/* -** 2007 August 28 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the C functions that implement mutexes for pthreads -*/ - -/* -** The code in this file is only used if we are compiling threadsafe -** under unix with pthreads. -** -** Note that this implementation requires a version of pthreads that -** supports recursive mutexes. -*/ -#ifdef SQLITE_MUTEX_PTHREADS - -#include - -/* -** The sqlite3_mutex.id, sqlite3_mutex.nRef, and sqlite3_mutex.owner fields -** are necessary under two condidtions: (1) Debug builds and (2) using -** home-grown mutexes. Encapsulate these conditions into a single #define. -*/ -#if defined(SQLITE_DEBUG) || defined(SQLITE_HOMEGROWN_RECURSIVE_MUTEX) -# define SQLITE_MUTEX_NREF 1 -#else -# define SQLITE_MUTEX_NREF 0 -#endif - -/* -** Each recursive mutex is an instance of the following structure. -*/ -struct sqlite3_mutex { - pthread_mutex_t mutex; /* Mutex controlling the lock */ -#if SQLITE_MUTEX_NREF - int id; /* Mutex type */ - volatile int nRef; /* Number of entrances */ - volatile pthread_t owner; /* Thread that is within this mutex */ - int trace; /* True to trace changes */ -#endif -}; -#if SQLITE_MUTEX_NREF -#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER, 0, 0, (pthread_t)0, 0 } -#else -#define SQLITE3_MUTEX_INITIALIZER { PTHREAD_MUTEX_INITIALIZER } -#endif - -/* -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are -** intended for use only inside assert() statements. On some platforms, -** there might be race conditions that can cause these routines to -** deliver incorrect results. In particular, if pthread_equal() is -** not an atomic operation, then these routines might delivery -** incorrect results. On most platforms, pthread_equal() is a -** comparison of two integers and is therefore atomic. But we are -** told that HPUX is not such a platform. If so, then these routines -** will not always work correctly on HPUX. -** -** On those platforms where pthread_equal() is not atomic, SQLite -** should be compiled without -DSQLITE_DEBUG and with -DNDEBUG to -** make sure no assert() statements are evaluated and hence these -** routines are never called. -*/ -#if !defined(NDEBUG) || defined(SQLITE_DEBUG) -static int pthreadMutexHeld(sqlite3_mutex *p){ - return (p->nRef!=0 && pthread_equal(p->owner, pthread_self())); -} -static int pthreadMutexNotheld(sqlite3_mutex *p){ - return p->nRef==0 || pthread_equal(p->owner, pthread_self())==0; -} -#endif - -/* -** Initialize and deinitialize the mutex subsystem. -*/ -static int pthreadMutexInit(void){ return SQLITE_OK; } -static int pthreadMutexEnd(void){ return SQLITE_OK; } - -/* -** The sqlite3_mutex_alloc() routine allocates a new -** mutex and returns a pointer to it. If it returns NULL -** that means that a mutex could not be allocated. SQLite -** will unwind its stack and return an error. The argument -** to sqlite3_mutex_alloc() is one of these integer constants: -** -**
    -**
  • SQLITE_MUTEX_FAST -**
  • SQLITE_MUTEX_RECURSIVE -**
  • SQLITE_MUTEX_STATIC_MASTER -**
  • SQLITE_MUTEX_STATIC_MEM -**
  • SQLITE_MUTEX_STATIC_MEM2 -**
  • SQLITE_MUTEX_STATIC_PRNG -**
  • SQLITE_MUTEX_STATIC_LRU -**
  • SQLITE_MUTEX_STATIC_PMEM -**
-** -** The first two constants cause sqlite3_mutex_alloc() to create -** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE -** is used but not necessarily so when SQLITE_MUTEX_FAST is used. -** The mutex implementation does not need to make a distinction -** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does -** not want to. But SQLite will only request a recursive mutex in -** cases where it really needs one. If a faster non-recursive mutex -** implementation is available on the host platform, the mutex subsystem -** might return such a mutex in response to SQLITE_MUTEX_FAST. -** -** The other allowed parameters to sqlite3_mutex_alloc() each return -** a pointer to a static preexisting mutex. Six static mutexes are -** used by the current version of SQLite. Future versions of SQLite -** may add additional static mutexes. Static mutexes are for internal -** use by SQLite only. Applications that use SQLite mutexes should -** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or -** SQLITE_MUTEX_RECURSIVE. -** -** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST -** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() -** returns a different mutex on every call. But for the static -** mutex types, the same mutex is returned on every call that has -** the same type number. -*/ -static sqlite3_mutex *pthreadMutexAlloc(int iType){ - static sqlite3_mutex staticMutexes[] = { - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER - }; - sqlite3_mutex *p; - switch( iType ){ - case SQLITE_MUTEX_RECURSIVE: { - p = sqlite3MallocZero( sizeof(*p) ); - if( p ){ -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX - /* If recursive mutexes are not available, we will have to - ** build our own. See below. */ - pthread_mutex_init(&p->mutex, 0); -#else - /* Use a recursive mutex if it is available */ - pthread_mutexattr_t recursiveAttr; - pthread_mutexattr_init(&recursiveAttr); - pthread_mutexattr_settype(&recursiveAttr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&p->mutex, &recursiveAttr); - pthread_mutexattr_destroy(&recursiveAttr); -#endif -#if SQLITE_MUTEX_NREF - p->id = iType; -#endif - } - break; - } - case SQLITE_MUTEX_FAST: { - p = sqlite3MallocZero( sizeof(*p) ); - if( p ){ -#if SQLITE_MUTEX_NREF - p->id = iType; -#endif - pthread_mutex_init(&p->mutex, 0); - } - break; - } - default: { - assert( iType-2 >= 0 ); - assert( iType-2 < ArraySize(staticMutexes) ); - p = &staticMutexes[iType-2]; -#if SQLITE_MUTEX_NREF - p->id = iType; -#endif - break; - } - } - return p; -} - - -/* -** This routine deallocates a previously -** allocated mutex. SQLite is careful to deallocate every -** mutex that it allocates. -*/ -static void pthreadMutexFree(sqlite3_mutex *p){ - assert( p->nRef==0 ); - assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ); - pthread_mutex_destroy(&p->mutex); - sqlite3_free(p); -} - -/* -** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt -** to enter a mutex. If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK -** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can -** be entered multiple times by the same thread. In such cases the, -** mutex must be exited an equal number of times before another thread -** can enter. If the same thread tries to enter any other kind of mutex -** more than once, the behavior is undefined. -*/ -static void pthreadMutexEnter(sqlite3_mutex *p){ - assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) ); - -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX - /* If recursive mutexes are not available, then we have to grow - ** our own. This implementation assumes that pthread_equal() - ** is atomic - that it cannot be deceived into thinking self - ** and p->owner are equal if p->owner changes between two values - ** that are not equal to self while the comparison is taking place. - ** This implementation also assumes a coherent cache - that - ** separate processes cannot read different values from the same - ** address at the same time. If either of these two conditions - ** are not met, then the mutexes will fail and problems will result. - */ - { - pthread_t self = pthread_self(); - if( p->nRef>0 && pthread_equal(p->owner, self) ){ - p->nRef++; - }else{ - pthread_mutex_lock(&p->mutex); - assert( p->nRef==0 ); - p->owner = self; - p->nRef = 1; - } - } -#else - /* Use the built-in recursive mutexes if they are available. - */ - pthread_mutex_lock(&p->mutex); -#if SQLITE_MUTEX_NREF - assert( p->nRef>0 || p->owner==0 ); - p->owner = pthread_self(); - p->nRef++; -#endif -#endif - -#ifdef SQLITE_DEBUG - if( p->trace ){ - printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef); - } -#endif -} -static int pthreadMutexTry(sqlite3_mutex *p){ - int rc; - assert( p->id==SQLITE_MUTEX_RECURSIVE || pthreadMutexNotheld(p) ); - -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX - /* If recursive mutexes are not available, then we have to grow - ** our own. This implementation assumes that pthread_equal() - ** is atomic - that it cannot be deceived into thinking self - ** and p->owner are equal if p->owner changes between two values - ** that are not equal to self while the comparison is taking place. - ** This implementation also assumes a coherent cache - that - ** separate processes cannot read different values from the same - ** address at the same time. If either of these two conditions - ** are not met, then the mutexes will fail and problems will result. - */ - { - pthread_t self = pthread_self(); - if( p->nRef>0 && pthread_equal(p->owner, self) ){ - p->nRef++; - rc = SQLITE_OK; - }else if( pthread_mutex_trylock(&p->mutex)==0 ){ - assert( p->nRef==0 ); - p->owner = self; - p->nRef = 1; - rc = SQLITE_OK; - }else{ - rc = SQLITE_BUSY; - } - } -#else - /* Use the built-in recursive mutexes if they are available. - */ - if( pthread_mutex_trylock(&p->mutex)==0 ){ -#if SQLITE_MUTEX_NREF - p->owner = pthread_self(); - p->nRef++; -#endif - rc = SQLITE_OK; - }else{ - rc = SQLITE_BUSY; - } -#endif - -#ifdef SQLITE_DEBUG - if( rc==SQLITE_OK && p->trace ){ - printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef); - } -#endif - return rc; -} - -/* -** The sqlite3_mutex_leave() routine exits a mutex that was -** previously entered by the same thread. The behavior -** is undefined if the mutex is not currently entered or -** is not currently allocated. SQLite will never do either. -*/ -static void pthreadMutexLeave(sqlite3_mutex *p){ - assert( pthreadMutexHeld(p) ); -#if SQLITE_MUTEX_NREF - p->nRef--; - if( p->nRef==0 ) p->owner = 0; -#endif - assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE ); - -#ifdef SQLITE_HOMEGROWN_RECURSIVE_MUTEX - if( p->nRef==0 ){ - pthread_mutex_unlock(&p->mutex); - } -#else - pthread_mutex_unlock(&p->mutex); -#endif - -#ifdef SQLITE_DEBUG - if( p->trace ){ - printf("leave mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef); - } -#endif -} - -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ - static const sqlite3_mutex_methods sMutex = { - pthreadMutexInit, - pthreadMutexEnd, - pthreadMutexAlloc, - pthreadMutexFree, - pthreadMutexEnter, - pthreadMutexTry, - pthreadMutexLeave, -#ifdef SQLITE_DEBUG - pthreadMutexHeld, - pthreadMutexNotheld -#else - 0, - 0 -#endif - }; - - return &sMutex; -} - -#endif /* SQLITE_MUTEX_PTHREADS */ - -/************** End of mutex_unix.c ******************************************/ -/************** Begin file mutex_w32.c ***************************************/ -/* -** 2007 August 14 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the C functions that implement mutexes for win32 -*/ - -/* -** The code in this file is only used if we are compiling multithreaded -** on a win32 system. -*/ -#ifdef SQLITE_MUTEX_W32 - -/* -** Each recursive mutex is an instance of the following structure. -*/ -struct sqlite3_mutex { - CRITICAL_SECTION mutex; /* Mutex controlling the lock */ - int id; /* Mutex type */ -#ifdef SQLITE_DEBUG - volatile int nRef; /* Number of enterances */ - volatile DWORD owner; /* Thread holding this mutex */ - int trace; /* True to trace changes */ -#endif -}; -#define SQLITE_W32_MUTEX_INITIALIZER { 0 } -#ifdef SQLITE_DEBUG -#define SQLITE3_MUTEX_INITIALIZER { SQLITE_W32_MUTEX_INITIALIZER, 0, 0L, (DWORD)0, 0 } -#else -#define SQLITE3_MUTEX_INITIALIZER { SQLITE_W32_MUTEX_INITIALIZER, 0 } -#endif - -/* -** Return true (non-zero) if we are running under WinNT, Win2K, WinXP, -** or WinCE. Return false (zero) for Win95, Win98, or WinME. -** -** Here is an interesting observation: Win95, Win98, and WinME lack -** the LockFileEx() API. But we can still statically link against that -** API as long as we don't call it win running Win95/98/ME. A call to -** this routine is used to determine if the host is Win95/98/ME or -** WinNT/2K/XP so that we will know whether or not we can safely call -** the LockFileEx() API. -** -** mutexIsNT() is only used for the TryEnterCriticalSection() API call, -** which is only available if your application was compiled with -** _WIN32_WINNT defined to a value >= 0x0400. Currently, the only -** call to TryEnterCriticalSection() is #ifdef'ed out, so #ifdef -** this out as well. -*/ -#if 0 -#if SQLITE_OS_WINCE || SQLITE_OS_WINRT -# define mutexIsNT() (1) -#else - static int mutexIsNT(void){ - static int osType = 0; - if( osType==0 ){ - OSVERSIONINFO sInfo; - sInfo.dwOSVersionInfoSize = sizeof(sInfo); - GetVersionEx(&sInfo); - osType = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; - } - return osType==2; - } -#endif /* SQLITE_OS_WINCE || SQLITE_OS_WINRT */ -#endif - -#ifdef SQLITE_DEBUG -/* -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routine are -** intended for use only inside assert() statements. -*/ -static int winMutexHeld(sqlite3_mutex *p){ - return p->nRef!=0 && p->owner==GetCurrentThreadId(); -} -static int winMutexNotheld2(sqlite3_mutex *p, DWORD tid){ - return p->nRef==0 || p->owner!=tid; -} -static int winMutexNotheld(sqlite3_mutex *p){ - DWORD tid = GetCurrentThreadId(); - return winMutexNotheld2(p, tid); -} -#endif - - -/* -** Initialize and deinitialize the mutex subsystem. -*/ -static sqlite3_mutex winMutex_staticMutexes[6] = { - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER, - SQLITE3_MUTEX_INITIALIZER -}; -static int winMutex_isInit = 0; -/* As winMutexInit() and winMutexEnd() are called as part -** of the sqlite3_initialize and sqlite3_shutdown() -** processing, the "interlocked" magic is probably not -** strictly necessary. -*/ -static LONG winMutex_lock = 0; - -SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds); /* os_win.c */ - -static int winMutexInit(void){ - /* The first to increment to 1 does actual initialization */ - if( InterlockedCompareExchange(&winMutex_lock, 1, 0)==0 ){ - int i; - for(i=0; i -**
  • SQLITE_MUTEX_FAST -**
  • SQLITE_MUTEX_RECURSIVE -**
  • SQLITE_MUTEX_STATIC_MASTER -**
  • SQLITE_MUTEX_STATIC_MEM -**
  • SQLITE_MUTEX_STATIC_MEM2 -**
  • SQLITE_MUTEX_STATIC_PRNG -**
  • SQLITE_MUTEX_STATIC_LRU -**
  • SQLITE_MUTEX_STATIC_PMEM -** -** -** The first two constants cause sqlite3_mutex_alloc() to create -** a new mutex. The new mutex is recursive when SQLITE_MUTEX_RECURSIVE -** is used but not necessarily so when SQLITE_MUTEX_FAST is used. -** The mutex implementation does not need to make a distinction -** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does -** not want to. But SQLite will only request a recursive mutex in -** cases where it really needs one. If a faster non-recursive mutex -** implementation is available on the host platform, the mutex subsystem -** might return such a mutex in response to SQLITE_MUTEX_FAST. -** -** The other allowed parameters to sqlite3_mutex_alloc() each return -** a pointer to a static preexisting mutex. Six static mutexes are -** used by the current version of SQLite. Future versions of SQLite -** may add additional static mutexes. Static mutexes are for internal -** use by SQLite only. Applications that use SQLite mutexes should -** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or -** SQLITE_MUTEX_RECURSIVE. -** -** Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST -** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() -** returns a different mutex on every call. But for the static -** mutex types, the same mutex is returned on every call that has -** the same type number. -*/ -static sqlite3_mutex *winMutexAlloc(int iType){ - sqlite3_mutex *p; - - switch( iType ){ - case SQLITE_MUTEX_FAST: - case SQLITE_MUTEX_RECURSIVE: { - p = sqlite3MallocZero( sizeof(*p) ); - if( p ){ -#ifdef SQLITE_DEBUG - p->id = iType; -#endif -#if SQLITE_OS_WINRT - InitializeCriticalSectionEx(&p->mutex, 0, 0); -#else - InitializeCriticalSection(&p->mutex); -#endif - } - break; - } - default: { - assert( winMutex_isInit==1 ); - assert( iType-2 >= 0 ); - assert( iType-2 < ArraySize(winMutex_staticMutexes) ); - p = &winMutex_staticMutexes[iType-2]; -#ifdef SQLITE_DEBUG - p->id = iType; -#endif - break; - } - } - return p; -} - - -/* -** This routine deallocates a previously -** allocated mutex. SQLite is careful to deallocate every -** mutex that it allocates. -*/ -static void winMutexFree(sqlite3_mutex *p){ - assert( p ); - assert( p->nRef==0 && p->owner==0 ); - assert( p->id==SQLITE_MUTEX_FAST || p->id==SQLITE_MUTEX_RECURSIVE ); - DeleteCriticalSection(&p->mutex); - sqlite3_free(p); -} - -/* -** The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt -** to enter a mutex. If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. The sqlite3_mutex_try() interface returns SQLITE_OK -** upon successful entry. Mutexes created using SQLITE_MUTEX_RECURSIVE can -** be entered multiple times by the same thread. In such cases the, -** mutex must be exited an equal number of times before another thread -** can enter. If the same thread tries to enter any other kind of mutex -** more than once, the behavior is undefined. -*/ -static void winMutexEnter(sqlite3_mutex *p){ -#ifdef SQLITE_DEBUG - DWORD tid = GetCurrentThreadId(); - assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) ); -#endif - EnterCriticalSection(&p->mutex); -#ifdef SQLITE_DEBUG - assert( p->nRef>0 || p->owner==0 ); - p->owner = tid; - p->nRef++; - if( p->trace ){ - printf("enter mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef); - } -#endif -} -static int winMutexTry(sqlite3_mutex *p){ -#ifndef NDEBUG - DWORD tid = GetCurrentThreadId(); -#endif - int rc = SQLITE_BUSY; - assert( p->id==SQLITE_MUTEX_RECURSIVE || winMutexNotheld2(p, tid) ); - /* - ** The sqlite3_mutex_try() routine is very rarely used, and when it - ** is used it is merely an optimization. So it is OK for it to always - ** fail. - ** - ** The TryEnterCriticalSection() interface is only available on WinNT. - ** And some windows compilers complain if you try to use it without - ** first doing some #defines that prevent SQLite from building on Win98. - ** For that reason, we will omit this optimization for now. See - ** ticket #2685. - */ -#if 0 - if( mutexIsNT() && TryEnterCriticalSection(&p->mutex) ){ - p->owner = tid; - p->nRef++; - rc = SQLITE_OK; - } -#else - UNUSED_PARAMETER(p); -#endif -#ifdef SQLITE_DEBUG - if( rc==SQLITE_OK && p->trace ){ - printf("try mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef); - } -#endif - return rc; -} - -/* -** The sqlite3_mutex_leave() routine exits a mutex that was -** previously entered by the same thread. The behavior -** is undefined if the mutex is not currently entered or -** is not currently allocated. SQLite will never do either. -*/ -static void winMutexLeave(sqlite3_mutex *p){ -#ifndef NDEBUG - DWORD tid = GetCurrentThreadId(); - assert( p->nRef>0 ); - assert( p->owner==tid ); - p->nRef--; - if( p->nRef==0 ) p->owner = 0; - assert( p->nRef==0 || p->id==SQLITE_MUTEX_RECURSIVE ); -#endif - LeaveCriticalSection(&p->mutex); -#ifdef SQLITE_DEBUG - if( p->trace ){ - printf("leave mutex %p (%d) with nRef=%d\n", p, p->trace, p->nRef); - } -#endif -} - -SQLITE_PRIVATE sqlite3_mutex_methods const *sqlite3DefaultMutex(void){ - static const sqlite3_mutex_methods sMutex = { - winMutexInit, - winMutexEnd, - winMutexAlloc, - winMutexFree, - winMutexEnter, - winMutexTry, - winMutexLeave, -#ifdef SQLITE_DEBUG - winMutexHeld, - winMutexNotheld -#else - 0, - 0 -#endif - }; - - return &sMutex; -} -#endif /* SQLITE_MUTEX_W32 */ - -/************** End of mutex_w32.c *******************************************/ -/************** Begin file malloc.c ******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** Memory allocation functions used throughout sqlite. -*/ -/* #include */ - -/* -** Attempt to release up to n bytes of non-essential memory currently -** held by SQLite. An example of non-essential memory is memory used to -** cache database pages that are not currently in use. -*/ -SQLITE_API int sqlite3_release_memory(int n){ -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT - return sqlite3PcacheReleaseMemory(n); -#else - /* IMPLEMENTATION-OF: R-34391-24921 The sqlite3_release_memory() routine - ** is a no-op returning zero if SQLite is not compiled with - ** SQLITE_ENABLE_MEMORY_MANAGEMENT. */ - UNUSED_PARAMETER(n); - return 0; -#endif -} - -/* -** An instance of the following object records the location of -** each unused scratch buffer. -*/ -typedef struct ScratchFreeslot { - struct ScratchFreeslot *pNext; /* Next unused scratch buffer */ -} ScratchFreeslot; - -/* -** State information local to the memory allocation subsystem. -*/ -static SQLITE_WSD struct Mem0Global { - sqlite3_mutex *mutex; /* Mutex to serialize access */ - - /* - ** The alarm callback and its arguments. The mem0.mutex lock will - ** be held while the callback is running. Recursive calls into - ** the memory subsystem are allowed, but no new callbacks will be - ** issued. - */ - sqlite3_int64 alarmThreshold; - void (*alarmCallback)(void*, sqlite3_int64,int); - void *alarmArg; - - /* - ** Pointers to the end of sqlite3GlobalConfig.pScratch memory - ** (so that a range test can be used to determine if an allocation - ** being freed came from pScratch) and a pointer to the list of - ** unused scratch allocations. - */ - void *pScratchEnd; - ScratchFreeslot *pScratchFree; - u32 nScratchFree; - - /* - ** True if heap is nearly "full" where "full" is defined by the - ** sqlite3_soft_heap_limit() setting. - */ - int nearlyFull; -} mem0 = { 0, 0, 0, 0, 0, 0, 0, 0 }; - -#define mem0 GLOBAL(struct Mem0Global, mem0) - -/* -** This routine runs when the memory allocator sees that the -** total memory allocation is about to exceed the soft heap -** limit. -*/ -static void softHeapLimitEnforcer( - void *NotUsed, - sqlite3_int64 NotUsed2, - int allocSize -){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - sqlite3_release_memory(allocSize); -} - -/* -** Change the alarm callback -*/ -static int sqlite3MemoryAlarm( - void(*xCallback)(void *pArg, sqlite3_int64 used,int N), - void *pArg, - sqlite3_int64 iThreshold -){ - int nUsed; - sqlite3_mutex_enter(mem0.mutex); - mem0.alarmCallback = xCallback; - mem0.alarmArg = pArg; - mem0.alarmThreshold = iThreshold; - nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); - mem0.nearlyFull = (iThreshold>0 && iThreshold<=nUsed); - sqlite3_mutex_leave(mem0.mutex); - return SQLITE_OK; -} - -#ifndef SQLITE_OMIT_DEPRECATED -/* -** Deprecated external interface. Internal/core SQLite code -** should call sqlite3MemoryAlarm. -*/ -SQLITE_API int sqlite3_memory_alarm( - void(*xCallback)(void *pArg, sqlite3_int64 used,int N), - void *pArg, - sqlite3_int64 iThreshold -){ - return sqlite3MemoryAlarm(xCallback, pArg, iThreshold); -} -#endif - -/* -** Set the soft heap-size limit for the library. Passing a zero or -** negative value indicates no limit. -*/ -SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 n){ - sqlite3_int64 priorLimit; - sqlite3_int64 excess; -#ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); - if( rc ) return -1; -#endif - sqlite3_mutex_enter(mem0.mutex); - priorLimit = mem0.alarmThreshold; - sqlite3_mutex_leave(mem0.mutex); - if( n<0 ) return priorLimit; - if( n>0 ){ - sqlite3MemoryAlarm(softHeapLimitEnforcer, 0, n); - }else{ - sqlite3MemoryAlarm(0, 0, 0); - } - excess = sqlite3_memory_used() - n; - if( excess>0 ) sqlite3_release_memory((int)(excess & 0x7fffffff)); - return priorLimit; -} -SQLITE_API void sqlite3_soft_heap_limit(int n){ - if( n<0 ) n = 0; - sqlite3_soft_heap_limit64(n); -} - -/* -** Initialize the memory allocation subsystem. -*/ -SQLITE_PRIVATE int sqlite3MallocInit(void){ - if( sqlite3GlobalConfig.m.xMalloc==0 ){ - sqlite3MemSetDefault(); - } - memset(&mem0, 0, sizeof(mem0)); - if( sqlite3GlobalConfig.bCoreMutex ){ - mem0.mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MEM); - } - if( sqlite3GlobalConfig.pScratch && sqlite3GlobalConfig.szScratch>=100 - && sqlite3GlobalConfig.nScratch>0 ){ - int i, n, sz; - ScratchFreeslot *pSlot; - sz = ROUNDDOWN8(sqlite3GlobalConfig.szScratch); - sqlite3GlobalConfig.szScratch = sz; - pSlot = (ScratchFreeslot*)sqlite3GlobalConfig.pScratch; - n = sqlite3GlobalConfig.nScratch; - mem0.pScratchFree = pSlot; - mem0.nScratchFree = n; - for(i=0; ipNext = (ScratchFreeslot*)(sz+(char*)pSlot); - pSlot = pSlot->pNext; - } - pSlot->pNext = 0; - mem0.pScratchEnd = (void*)&pSlot[1]; - }else{ - mem0.pScratchEnd = 0; - sqlite3GlobalConfig.pScratch = 0; - sqlite3GlobalConfig.szScratch = 0; - sqlite3GlobalConfig.nScratch = 0; - } - if( sqlite3GlobalConfig.pPage==0 || sqlite3GlobalConfig.szPage<512 - || sqlite3GlobalConfig.nPage<1 ){ - sqlite3GlobalConfig.pPage = 0; - sqlite3GlobalConfig.szPage = 0; - sqlite3GlobalConfig.nPage = 0; - } - return sqlite3GlobalConfig.m.xInit(sqlite3GlobalConfig.m.pAppData); -} - -/* -** Return true if the heap is currently under memory pressure - in other -** words if the amount of heap used is close to the limit set by -** sqlite3_soft_heap_limit(). -*/ -SQLITE_PRIVATE int sqlite3HeapNearlyFull(void){ - return mem0.nearlyFull; -} - -/* -** Deinitialize the memory allocation subsystem. -*/ -SQLITE_PRIVATE void sqlite3MallocEnd(void){ - if( sqlite3GlobalConfig.m.xShutdown ){ - sqlite3GlobalConfig.m.xShutdown(sqlite3GlobalConfig.m.pAppData); - } - memset(&mem0, 0, sizeof(mem0)); -} - -/* -** Return the amount of memory currently checked out. -*/ -SQLITE_API sqlite3_int64 sqlite3_memory_used(void){ - int n, mx; - sqlite3_int64 res; - sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, 0); - res = (sqlite3_int64)n; /* Work around bug in Borland C. Ticket #3216 */ - return res; -} - -/* -** Return the maximum amount of memory that has ever been -** checked out since either the beginning of this process -** or since the most recent reset. -*/ -SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag){ - int n, mx; - sqlite3_int64 res; - sqlite3_status(SQLITE_STATUS_MEMORY_USED, &n, &mx, resetFlag); - res = (sqlite3_int64)mx; /* Work around bug in Borland C. Ticket #3216 */ - return res; -} - -/* -** Trigger the alarm -*/ -static void sqlite3MallocAlarm(int nByte){ - void (*xCallback)(void*,sqlite3_int64,int); - sqlite3_int64 nowUsed; - void *pArg; - if( mem0.alarmCallback==0 ) return; - xCallback = mem0.alarmCallback; - nowUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); - pArg = mem0.alarmArg; - mem0.alarmCallback = 0; - sqlite3_mutex_leave(mem0.mutex); - xCallback(pArg, nowUsed, nByte); - sqlite3_mutex_enter(mem0.mutex); - mem0.alarmCallback = xCallback; - mem0.alarmArg = pArg; -} - -/* -** Do a memory allocation with statistics and alarms. Assume the -** lock is already held. -*/ -static int mallocWithAlarm(int n, void **pp){ - int nFull; - void *p; - assert( sqlite3_mutex_held(mem0.mutex) ); - nFull = sqlite3GlobalConfig.m.xRoundup(n); - sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, n); - if( mem0.alarmCallback!=0 ){ - int nUsed = sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED); - if( nUsed >= mem0.alarmThreshold - nFull ){ - mem0.nearlyFull = 1; - sqlite3MallocAlarm(nFull); - }else{ - mem0.nearlyFull = 0; - } - } - p = sqlite3GlobalConfig.m.xMalloc(nFull); -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT - if( p==0 && mem0.alarmCallback ){ - sqlite3MallocAlarm(nFull); - p = sqlite3GlobalConfig.m.xMalloc(nFull); - } -#endif - if( p ){ - nFull = sqlite3MallocSize(p); - sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nFull); - sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, 1); - } - *pp = p; - return nFull; -} - -/* -** Allocate memory. This routine is like sqlite3_malloc() except that it -** assumes the memory subsystem has already been initialized. -*/ -SQLITE_PRIVATE void *sqlite3Malloc(int n){ - void *p; - if( n<=0 /* IMP: R-65312-04917 */ - || n>=0x7fffff00 - ){ - /* A memory allocation of a number of bytes which is near the maximum - ** signed integer value might cause an integer overflow inside of the - ** xMalloc(). Hence we limit the maximum size to 0x7fffff00, giving - ** 255 bytes of overhead. SQLite itself will never use anything near - ** this amount. The only way to reach the limit is with sqlite3_malloc() */ - p = 0; - }else if( sqlite3GlobalConfig.bMemstat ){ - sqlite3_mutex_enter(mem0.mutex); - mallocWithAlarm(n, &p); - sqlite3_mutex_leave(mem0.mutex); - }else{ - p = sqlite3GlobalConfig.m.xMalloc(n); - } - assert( EIGHT_BYTE_ALIGNMENT(p) ); /* IMP: R-04675-44850 */ - return p; -} - -/* -** This version of the memory allocation is for use by the application. -** First make sure the memory subsystem is initialized, then do the -** allocation. -*/ -SQLITE_API void *sqlite3_malloc(int n){ -#ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; -#endif - return sqlite3Malloc(n); -} - -/* -** Each thread may only have a single outstanding allocation from -** xScratchMalloc(). We verify this constraint in the single-threaded -** case by setting scratchAllocOut to 1 when an allocation -** is outstanding clearing it when the allocation is freed. -*/ -#if SQLITE_THREADSAFE==0 && !defined(NDEBUG) -static int scratchAllocOut = 0; -#endif - - -/* -** Allocate memory that is to be used and released right away. -** This routine is similar to alloca() in that it is not intended -** for situations where the memory might be held long-term. This -** routine is intended to get memory to old large transient data -** structures that would not normally fit on the stack of an -** embedded processor. -*/ -SQLITE_PRIVATE void *sqlite3ScratchMalloc(int n){ - void *p; - assert( n>0 ); - - sqlite3_mutex_enter(mem0.mutex); - if( mem0.nScratchFree && sqlite3GlobalConfig.szScratch>=n ){ - p = mem0.pScratchFree; - mem0.pScratchFree = mem0.pScratchFree->pNext; - mem0.nScratchFree--; - sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, 1); - sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n); - sqlite3_mutex_leave(mem0.mutex); - }else{ - if( sqlite3GlobalConfig.bMemstat ){ - sqlite3StatusSet(SQLITE_STATUS_SCRATCH_SIZE, n); - n = mallocWithAlarm(n, &p); - if( p ) sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, n); - sqlite3_mutex_leave(mem0.mutex); - }else{ - sqlite3_mutex_leave(mem0.mutex); - p = sqlite3GlobalConfig.m.xMalloc(n); - } - sqlite3MemdebugSetType(p, MEMTYPE_SCRATCH); - } - assert( sqlite3_mutex_notheld(mem0.mutex) ); - - -#if SQLITE_THREADSAFE==0 && !defined(NDEBUG) - /* Verify that no more than two scratch allocations per thread - ** are outstanding at one time. (This is only checked in the - ** single-threaded case since checking in the multi-threaded case - ** would be much more complicated.) */ - assert( scratchAllocOut<=1 ); - if( p ) scratchAllocOut++; -#endif - - return p; -} -SQLITE_PRIVATE void sqlite3ScratchFree(void *p){ - if( p ){ - -#if SQLITE_THREADSAFE==0 && !defined(NDEBUG) - /* Verify that no more than two scratch allocation per thread - ** is outstanding at one time. (This is only checked in the - ** single-threaded case since checking in the multi-threaded case - ** would be much more complicated.) */ - assert( scratchAllocOut>=1 && scratchAllocOut<=2 ); - scratchAllocOut--; -#endif - - if( p>=sqlite3GlobalConfig.pScratch && ppNext = mem0.pScratchFree; - mem0.pScratchFree = pSlot; - mem0.nScratchFree++; - assert( mem0.nScratchFree <= (u32)sqlite3GlobalConfig.nScratch ); - sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_USED, -1); - sqlite3_mutex_leave(mem0.mutex); - }else{ - /* Release memory back to the heap */ - assert( sqlite3MemdebugHasType(p, MEMTYPE_SCRATCH) ); - assert( sqlite3MemdebugNoType(p, ~MEMTYPE_SCRATCH) ); - sqlite3MemdebugSetType(p, MEMTYPE_HEAP); - if( sqlite3GlobalConfig.bMemstat ){ - int iSize = sqlite3MallocSize(p); - sqlite3_mutex_enter(mem0.mutex); - sqlite3StatusAdd(SQLITE_STATUS_SCRATCH_OVERFLOW, -iSize); - sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -iSize); - sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, -1); - sqlite3GlobalConfig.m.xFree(p); - sqlite3_mutex_leave(mem0.mutex); - }else{ - sqlite3GlobalConfig.m.xFree(p); - } - } - } -} - -/* -** TRUE if p is a lookaside memory allocation from db -*/ -#ifndef SQLITE_OMIT_LOOKASIDE -static int isLookaside(sqlite3 *db, void *p){ - return p>=db->lookaside.pStart && plookaside.pEnd; -} -#else -#define isLookaside(A,B) 0 -#endif - -/* -** Return the size of a memory allocation previously obtained from -** sqlite3Malloc() or sqlite3_malloc(). -*/ -SQLITE_PRIVATE int sqlite3MallocSize(void *p){ - assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); - assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) ); - return sqlite3GlobalConfig.m.xSize(p); -} -SQLITE_PRIVATE int sqlite3DbMallocSize(sqlite3 *db, void *p){ - assert( db!=0 ); - assert( sqlite3_mutex_held(db->mutex) ); - if( isLookaside(db, p) ){ - return db->lookaside.sz; - }else{ - assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) ); - assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) ); - assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) ); - return sqlite3GlobalConfig.m.xSize(p); - } -} - -/* -** Free memory previously obtained from sqlite3Malloc(). -*/ -SQLITE_API void sqlite3_free(void *p){ - if( p==0 ) return; /* IMP: R-49053-54554 */ - assert( sqlite3MemdebugNoType(p, MEMTYPE_DB) ); - assert( sqlite3MemdebugHasType(p, MEMTYPE_HEAP) ); - if( sqlite3GlobalConfig.bMemstat ){ - sqlite3_mutex_enter(mem0.mutex); - sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, -sqlite3MallocSize(p)); - sqlite3StatusAdd(SQLITE_STATUS_MALLOC_COUNT, -1); - sqlite3GlobalConfig.m.xFree(p); - sqlite3_mutex_leave(mem0.mutex); - }else{ - sqlite3GlobalConfig.m.xFree(p); - } -} - -/* -** Free memory that might be associated with a particular database -** connection. -*/ -SQLITE_PRIVATE void sqlite3DbFree(sqlite3 *db, void *p){ - assert( db==0 || sqlite3_mutex_held(db->mutex) ); - if( p==0 ) return; - if( db ){ - if( db->pnBytesFreed ){ - *db->pnBytesFreed += sqlite3DbMallocSize(db, p); - return; - } - if( isLookaside(db, p) ){ - LookasideSlot *pBuf = (LookasideSlot*)p; -#if SQLITE_DEBUG - /* Trash all content in the buffer being freed */ - memset(p, 0xaa, db->lookaside.sz); -#endif - pBuf->pNext = db->lookaside.pFree; - db->lookaside.pFree = pBuf; - db->lookaside.nOut--; - return; - } - } - assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) ); - assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) ); - assert( db!=0 || sqlite3MemdebugNoType(p, MEMTYPE_LOOKASIDE) ); - sqlite3MemdebugSetType(p, MEMTYPE_HEAP); - sqlite3_free(p); -} - -/* -** Change the size of an existing memory allocation -*/ -SQLITE_PRIVATE void *sqlite3Realloc(void *pOld, int nBytes){ - int nOld, nNew, nDiff; - void *pNew; - if( pOld==0 ){ - return sqlite3Malloc(nBytes); /* IMP: R-28354-25769 */ - } - if( nBytes<=0 ){ - sqlite3_free(pOld); /* IMP: R-31593-10574 */ - return 0; - } - if( nBytes>=0x7fffff00 ){ - /* The 0x7ffff00 limit term is explained in comments on sqlite3Malloc() */ - return 0; - } - nOld = sqlite3MallocSize(pOld); - /* IMPLEMENTATION-OF: R-46199-30249 SQLite guarantees that the second - ** argument to xRealloc is always a value returned by a prior call to - ** xRoundup. */ - nNew = sqlite3GlobalConfig.m.xRoundup(nBytes); - if( nOld==nNew ){ - pNew = pOld; - }else if( sqlite3GlobalConfig.bMemstat ){ - sqlite3_mutex_enter(mem0.mutex); - sqlite3StatusSet(SQLITE_STATUS_MALLOC_SIZE, nBytes); - nDiff = nNew - nOld; - if( sqlite3StatusValue(SQLITE_STATUS_MEMORY_USED) >= - mem0.alarmThreshold-nDiff ){ - sqlite3MallocAlarm(nDiff); - } - assert( sqlite3MemdebugHasType(pOld, MEMTYPE_HEAP) ); - assert( sqlite3MemdebugNoType(pOld, ~MEMTYPE_HEAP) ); - pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); - if( pNew==0 && mem0.alarmCallback ){ - sqlite3MallocAlarm(nBytes); - pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); - } - if( pNew ){ - nNew = sqlite3MallocSize(pNew); - sqlite3StatusAdd(SQLITE_STATUS_MEMORY_USED, nNew-nOld); - } - sqlite3_mutex_leave(mem0.mutex); - }else{ - pNew = sqlite3GlobalConfig.m.xRealloc(pOld, nNew); - } - assert( EIGHT_BYTE_ALIGNMENT(pNew) ); /* IMP: R-04675-44850 */ - return pNew; -} - -/* -** The public interface to sqlite3Realloc. Make sure that the memory -** subsystem is initialized prior to invoking sqliteRealloc. -*/ -SQLITE_API void *sqlite3_realloc(void *pOld, int n){ -#ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; -#endif - return sqlite3Realloc(pOld, n); -} - - -/* -** Allocate and zero memory. -*/ -SQLITE_PRIVATE void *sqlite3MallocZero(int n){ - void *p = sqlite3Malloc(n); - if( p ){ - memset(p, 0, n); - } - return p; -} - -/* -** Allocate and zero memory. If the allocation fails, make -** the mallocFailed flag in the connection pointer. -*/ -SQLITE_PRIVATE void *sqlite3DbMallocZero(sqlite3 *db, int n){ - void *p = sqlite3DbMallocRaw(db, n); - if( p ){ - memset(p, 0, n); - } - return p; -} - -/* -** Allocate and zero memory. If the allocation fails, make -** the mallocFailed flag in the connection pointer. -** -** If db!=0 and db->mallocFailed is true (indicating a prior malloc -** failure on the same database connection) then always return 0. -** Hence for a particular database connection, once malloc starts -** failing, it fails consistently until mallocFailed is reset. -** This is an important assumption. There are many places in the -** code that do things like this: -** -** int *a = (int*)sqlite3DbMallocRaw(db, 100); -** int *b = (int*)sqlite3DbMallocRaw(db, 200); -** if( b ) a[10] = 9; -** -** In other words, if a subsequent malloc (ex: "b") worked, it is assumed -** that all prior mallocs (ex: "a") worked too. -*/ -SQLITE_PRIVATE void *sqlite3DbMallocRaw(sqlite3 *db, int n){ - void *p; - assert( db==0 || sqlite3_mutex_held(db->mutex) ); - assert( db==0 || db->pnBytesFreed==0 ); -#ifndef SQLITE_OMIT_LOOKASIDE - if( db ){ - LookasideSlot *pBuf; - if( db->mallocFailed ){ - return 0; - } - if( db->lookaside.bEnabled ){ - if( n>db->lookaside.sz ){ - db->lookaside.anStat[1]++; - }else if( (pBuf = db->lookaside.pFree)==0 ){ - db->lookaside.anStat[2]++; - }else{ - db->lookaside.pFree = pBuf->pNext; - db->lookaside.nOut++; - db->lookaside.anStat[0]++; - if( db->lookaside.nOut>db->lookaside.mxOut ){ - db->lookaside.mxOut = db->lookaside.nOut; - } - return (void*)pBuf; - } - } - } -#else - if( db && db->mallocFailed ){ - return 0; - } -#endif - p = sqlite3Malloc(n); - if( !p && db ){ - db->mallocFailed = 1; - } - sqlite3MemdebugSetType(p, MEMTYPE_DB | - ((db && db->lookaside.bEnabled) ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP)); - return p; -} - -/* -** Resize the block of memory pointed to by p to n bytes. If the -** resize fails, set the mallocFailed flag in the connection object. -*/ -SQLITE_PRIVATE void *sqlite3DbRealloc(sqlite3 *db, void *p, int n){ - void *pNew = 0; - assert( db!=0 ); - assert( sqlite3_mutex_held(db->mutex) ); - if( db->mallocFailed==0 ){ - if( p==0 ){ - return sqlite3DbMallocRaw(db, n); - } - if( isLookaside(db, p) ){ - if( n<=db->lookaside.sz ){ - return p; - } - pNew = sqlite3DbMallocRaw(db, n); - if( pNew ){ - memcpy(pNew, p, db->lookaside.sz); - sqlite3DbFree(db, p); - } - }else{ - assert( sqlite3MemdebugHasType(p, MEMTYPE_DB) ); - assert( sqlite3MemdebugHasType(p, MEMTYPE_LOOKASIDE|MEMTYPE_HEAP) ); - sqlite3MemdebugSetType(p, MEMTYPE_HEAP); - pNew = sqlite3_realloc(p, n); - if( !pNew ){ - sqlite3MemdebugSetType(p, MEMTYPE_DB|MEMTYPE_HEAP); - db->mallocFailed = 1; - } - sqlite3MemdebugSetType(pNew, MEMTYPE_DB | - (db->lookaside.bEnabled ? MEMTYPE_LOOKASIDE : MEMTYPE_HEAP)); - } - } - return pNew; -} - -/* -** Attempt to reallocate p. If the reallocation fails, then free p -** and set the mallocFailed flag in the database connection. -*/ -SQLITE_PRIVATE void *sqlite3DbReallocOrFree(sqlite3 *db, void *p, int n){ - void *pNew; - pNew = sqlite3DbRealloc(db, p, n); - if( !pNew ){ - sqlite3DbFree(db, p); - } - return pNew; -} - -/* -** Make a copy of a string in memory obtained from sqliteMalloc(). These -** functions call sqlite3MallocRaw() directly instead of sqliteMalloc(). This -** is because when memory debugging is turned on, these two functions are -** called via macros that record the current file and line number in the -** ThreadData structure. -*/ -SQLITE_PRIVATE char *sqlite3DbStrDup(sqlite3 *db, const char *z){ - char *zNew; - size_t n; - if( z==0 ){ - return 0; - } - n = sqlite3Strlen30(z) + 1; - assert( (n&0x7fffffff)==n ); - zNew = sqlite3DbMallocRaw(db, (int)n); - if( zNew ){ - memcpy(zNew, z, n); - } - return zNew; -} -SQLITE_PRIVATE char *sqlite3DbStrNDup(sqlite3 *db, const char *z, int n){ - char *zNew; - if( z==0 ){ - return 0; - } - assert( (n&0x7fffffff)==n ); - zNew = sqlite3DbMallocRaw(db, n+1); - if( zNew ){ - memcpy(zNew, z, n); - zNew[n] = 0; - } - return zNew; -} - -/* -** Create a string from the zFromat argument and the va_list that follows. -** Store the string in memory obtained from sqliteMalloc() and make *pz -** point to that string. -*/ -SQLITE_PRIVATE void sqlite3SetString(char **pz, sqlite3 *db, const char *zFormat, ...){ - va_list ap; - char *z; - - va_start(ap, zFormat); - z = sqlite3VMPrintf(db, zFormat, ap); - va_end(ap); - sqlite3DbFree(db, *pz); - *pz = z; -} - - -/* -** This function must be called before exiting any API function (i.e. -** returning control to the user) that has called sqlite3_malloc or -** sqlite3_realloc. -** -** The returned value is normally a copy of the second argument to this -** function. However, if a malloc() failure has occurred since the previous -** invocation SQLITE_NOMEM is returned instead. -** -** If the first argument, db, is not NULL and a malloc() error has occurred, -** then the connection error-code (the value returned by sqlite3_errcode()) -** is set to SQLITE_NOMEM. -*/ -SQLITE_PRIVATE int sqlite3ApiExit(sqlite3* db, int rc){ - /* If the db handle is not NULL, then we must hold the connection handle - ** mutex here. Otherwise the read (and possible write) of db->mallocFailed - ** is unsafe, as is the call to sqlite3Error(). - */ - assert( !db || sqlite3_mutex_held(db->mutex) ); - if( db && (db->mallocFailed || rc==SQLITE_IOERR_NOMEM) ){ - sqlite3Error(db, SQLITE_NOMEM, 0); - db->mallocFailed = 0; - rc = SQLITE_NOMEM; - } - return rc & (db ? db->errMask : 0xff); -} - -/************** End of malloc.c **********************************************/ -/************** Begin file printf.c ******************************************/ -/* -** The "printf" code that follows dates from the 1980's. It is in -** the public domain. The original comments are included here for -** completeness. They are very out-of-date but might be useful as -** an historical reference. Most of the "enhancements" have been backed -** out so that the functionality is now the same as standard printf(). -** -************************************************************************** -** -** This file contains code for a set of "printf"-like routines. These -** routines format strings much like the printf() from the standard C -** library, though the implementation here has enhancements to support -** SQLlite. -*/ - -/* -** Conversion types fall into various categories as defined by the -** following enumeration. -*/ -#define etRADIX 1 /* Integer types. %d, %x, %o, and so forth */ -#define etFLOAT 2 /* Floating point. %f */ -#define etEXP 3 /* Exponentional notation. %e and %E */ -#define etGENERIC 4 /* Floating or exponential, depending on exponent. %g */ -#define etSIZE 5 /* Return number of characters processed so far. %n */ -#define etSTRING 6 /* Strings. %s */ -#define etDYNSTRING 7 /* Dynamically allocated strings. %z */ -#define etPERCENT 8 /* Percent symbol. %% */ -#define etCHARX 9 /* Characters. %c */ -/* The rest are extensions, not normally found in printf() */ -#define etSQLESCAPE 10 /* Strings with '\'' doubled. %q */ -#define etSQLESCAPE2 11 /* Strings with '\'' doubled and enclosed in '', - NULL pointers replaced by SQL NULL. %Q */ -#define etTOKEN 12 /* a pointer to a Token structure */ -#define etSRCLIST 13 /* a pointer to a SrcList */ -#define etPOINTER 14 /* The %p conversion */ -#define etSQLESCAPE3 15 /* %w -> Strings with '\"' doubled */ -#define etORDINAL 16 /* %r -> 1st, 2nd, 3rd, 4th, etc. English only */ - -#define etINVALID 0 /* Any unrecognized conversion type */ - - -/* -** An "etByte" is an 8-bit unsigned value. -*/ -typedef unsigned char etByte; - -/* -** Each builtin conversion character (ex: the 'd' in "%d") is described -** by an instance of the following structure -*/ -typedef struct et_info { /* Information about each format field */ - char fmttype; /* The format field code letter */ - etByte base; /* The base for radix conversion */ - etByte flags; /* One or more of FLAG_ constants below */ - etByte type; /* Conversion paradigm */ - etByte charset; /* Offset into aDigits[] of the digits string */ - etByte prefix; /* Offset into aPrefix[] of the prefix string */ -} et_info; - -/* -** Allowed values for et_info.flags -*/ -#define FLAG_SIGNED 1 /* True if the value to convert is signed */ -#define FLAG_INTERN 2 /* True if for internal use only */ -#define FLAG_STRING 4 /* Allow infinity precision */ - - -/* -** The following table is searched linearly, so it is good to put the -** most frequently used conversion types first. -*/ -static const char aDigits[] = "0123456789ABCDEF0123456789abcdef"; -static const char aPrefix[] = "-x0\000X0"; -static const et_info fmtinfo[] = { - { 'd', 10, 1, etRADIX, 0, 0 }, - { 's', 0, 4, etSTRING, 0, 0 }, - { 'g', 0, 1, etGENERIC, 30, 0 }, - { 'z', 0, 4, etDYNSTRING, 0, 0 }, - { 'q', 0, 4, etSQLESCAPE, 0, 0 }, - { 'Q', 0, 4, etSQLESCAPE2, 0, 0 }, - { 'w', 0, 4, etSQLESCAPE3, 0, 0 }, - { 'c', 0, 0, etCHARX, 0, 0 }, - { 'o', 8, 0, etRADIX, 0, 2 }, - { 'u', 10, 0, etRADIX, 0, 0 }, - { 'x', 16, 0, etRADIX, 16, 1 }, - { 'X', 16, 0, etRADIX, 0, 4 }, -#ifndef SQLITE_OMIT_FLOATING_POINT - { 'f', 0, 1, etFLOAT, 0, 0 }, - { 'e', 0, 1, etEXP, 30, 0 }, - { 'E', 0, 1, etEXP, 14, 0 }, - { 'G', 0, 1, etGENERIC, 14, 0 }, -#endif - { 'i', 10, 1, etRADIX, 0, 0 }, - { 'n', 0, 0, etSIZE, 0, 0 }, - { '%', 0, 0, etPERCENT, 0, 0 }, - { 'p', 16, 0, etPOINTER, 0, 1 }, - -/* All the rest have the FLAG_INTERN bit set and are thus for internal -** use only */ - { 'T', 0, 2, etTOKEN, 0, 0 }, - { 'S', 0, 2, etSRCLIST, 0, 0 }, - { 'r', 10, 3, etORDINAL, 0, 0 }, -}; - -/* -** If SQLITE_OMIT_FLOATING_POINT is defined, then none of the floating point -** conversions will work. -*/ -#ifndef SQLITE_OMIT_FLOATING_POINT -/* -** "*val" is a double such that 0.1 <= *val < 10.0 -** Return the ascii code for the leading digit of *val, then -** multiply "*val" by 10.0 to renormalize. -** -** Example: -** input: *val = 3.14159 -** output: *val = 1.4159 function return = '3' -** -** The counter *cnt is incremented each time. After counter exceeds -** 16 (the number of significant digits in a 64-bit float) '0' is -** always returned. -*/ -static char et_getdigit(LONGDOUBLE_TYPE *val, int *cnt){ - int digit; - LONGDOUBLE_TYPE d; - if( (*cnt)<=0 ) return '0'; - (*cnt)--; - digit = (int)*val; - d = digit; - digit += '0'; - *val = (*val - d)*10.0; - return (char)digit; -} -#endif /* SQLITE_OMIT_FLOATING_POINT */ - -/* -** Append N space characters to the given string buffer. -*/ -SQLITE_PRIVATE void sqlite3AppendSpace(StrAccum *pAccum, int N){ - static const char zSpaces[] = " "; - while( N>=(int)sizeof(zSpaces)-1 ){ - sqlite3StrAccumAppend(pAccum, zSpaces, sizeof(zSpaces)-1); - N -= sizeof(zSpaces)-1; - } - if( N>0 ){ - sqlite3StrAccumAppend(pAccum, zSpaces, N); - } -} - -/* -** Set the StrAccum object to an error mode. -*/ -static void setStrAccumError(StrAccum *p, u8 eError){ - p->accError = eError; - p->nAlloc = 0; -} - -/* -** Extra argument values from a PrintfArguments object -*/ -static sqlite3_int64 getIntArg(PrintfArguments *p){ - if( p->nArg<=p->nUsed ) return 0; - return sqlite3_value_int64(p->apArg[p->nUsed++]); -} -static double getDoubleArg(PrintfArguments *p){ - if( p->nArg<=p->nUsed ) return 0.0; - return sqlite3_value_double(p->apArg[p->nUsed++]); -} -static char *getTextArg(PrintfArguments *p){ - if( p->nArg<=p->nUsed ) return 0; - return (char*)sqlite3_value_text(p->apArg[p->nUsed++]); -} - - -/* -** On machines with a small stack size, you can redefine the -** SQLITE_PRINT_BUF_SIZE to be something smaller, if desired. -*/ -#ifndef SQLITE_PRINT_BUF_SIZE -# define SQLITE_PRINT_BUF_SIZE 70 -#endif -#define etBUFSIZE SQLITE_PRINT_BUF_SIZE /* Size of the output buffer */ - -/* -** Render a string given by "fmt" into the StrAccum object. -*/ -SQLITE_PRIVATE void sqlite3VXPrintf( - StrAccum *pAccum, /* Accumulate results here */ - u32 bFlags, /* SQLITE_PRINTF_* flags */ - const char *fmt, /* Format string */ - va_list ap /* arguments */ -){ - int c; /* Next character in the format string */ - char *bufpt; /* Pointer to the conversion buffer */ - int precision; /* Precision of the current field */ - int length; /* Length of the field */ - int idx; /* A general purpose loop counter */ - int width; /* Width of the current field */ - etByte flag_leftjustify; /* True if "-" flag is present */ - etByte flag_plussign; /* True if "+" flag is present */ - etByte flag_blanksign; /* True if " " flag is present */ - etByte flag_alternateform; /* True if "#" flag is present */ - etByte flag_altform2; /* True if "!" flag is present */ - etByte flag_zeropad; /* True if field width constant starts with zero */ - etByte flag_long; /* True if "l" flag is present */ - etByte flag_longlong; /* True if the "ll" flag is present */ - etByte done; /* Loop termination flag */ - etByte xtype = 0; /* Conversion paradigm */ - u8 bArgList; /* True for SQLITE_PRINTF_SQLFUNC */ - u8 useIntern; /* Ok to use internal conversions (ex: %T) */ - char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */ - sqlite_uint64 longvalue; /* Value for integer types */ - LONGDOUBLE_TYPE realvalue; /* Value for real types */ - const et_info *infop; /* Pointer to the appropriate info structure */ - char *zOut; /* Rendering buffer */ - int nOut; /* Size of the rendering buffer */ - char *zExtra; /* Malloced memory used by some conversion */ -#ifndef SQLITE_OMIT_FLOATING_POINT - int exp, e2; /* exponent of real numbers */ - int nsd; /* Number of significant digits returned */ - double rounder; /* Used for rounding floating point values */ - etByte flag_dp; /* True if decimal point should be shown */ - etByte flag_rtz; /* True if trailing zeros should be removed */ -#endif - PrintfArguments *pArgList = 0; /* Arguments for SQLITE_PRINTF_SQLFUNC */ - char buf[etBUFSIZE]; /* Conversion buffer */ - - bufpt = 0; - if( bFlags ){ - if( (bArgList = (bFlags & SQLITE_PRINTF_SQLFUNC))!=0 ){ - pArgList = va_arg(ap, PrintfArguments*); - } - useIntern = bFlags & SQLITE_PRINTF_INTERNAL; - }else{ - bArgList = useIntern = 0; - } - for(; (c=(*fmt))!=0; ++fmt){ - if( c!='%' ){ - int amt; - bufpt = (char *)fmt; - amt = 1; - while( (c=(*++fmt))!='%' && c!=0 ) amt++; - sqlite3StrAccumAppend(pAccum, bufpt, amt); - if( c==0 ) break; - } - if( (c=(*++fmt))==0 ){ - sqlite3StrAccumAppend(pAccum, "%", 1); - break; - } - /* Find out what flags are present */ - flag_leftjustify = flag_plussign = flag_blanksign = - flag_alternateform = flag_altform2 = flag_zeropad = 0; - done = 0; - do{ - switch( c ){ - case '-': flag_leftjustify = 1; break; - case '+': flag_plussign = 1; break; - case ' ': flag_blanksign = 1; break; - case '#': flag_alternateform = 1; break; - case '!': flag_altform2 = 1; break; - case '0': flag_zeropad = 1; break; - default: done = 1; break; - } - }while( !done && (c=(*++fmt))!=0 ); - /* Get the field width */ - width = 0; - if( c=='*' ){ - if( bArgList ){ - width = (int)getIntArg(pArgList); - }else{ - width = va_arg(ap,int); - } - if( width<0 ){ - flag_leftjustify = 1; - width = -width; - } - c = *++fmt; - }else{ - while( c>='0' && c<='9' ){ - width = width*10 + c - '0'; - c = *++fmt; - } - } - /* Get the precision */ - if( c=='.' ){ - precision = 0; - c = *++fmt; - if( c=='*' ){ - if( bArgList ){ - precision = (int)getIntArg(pArgList); - }else{ - precision = va_arg(ap,int); - } - if( precision<0 ) precision = -precision; - c = *++fmt; - }else{ - while( c>='0' && c<='9' ){ - precision = precision*10 + c - '0'; - c = *++fmt; - } - } - }else{ - precision = -1; - } - /* Get the conversion type modifier */ - if( c=='l' ){ - flag_long = 1; - c = *++fmt; - if( c=='l' ){ - flag_longlong = 1; - c = *++fmt; - }else{ - flag_longlong = 0; - } - }else{ - flag_long = flag_longlong = 0; - } - /* Fetch the info entry for the field */ - infop = &fmtinfo[0]; - xtype = etINVALID; - for(idx=0; idxflags & FLAG_INTERN)==0 ){ - xtype = infop->type; - }else{ - return; - } - break; - } - } - zExtra = 0; - - /* - ** At this point, variables are initialized as follows: - ** - ** flag_alternateform TRUE if a '#' is present. - ** flag_altform2 TRUE if a '!' is present. - ** flag_plussign TRUE if a '+' is present. - ** flag_leftjustify TRUE if a '-' is present or if the - ** field width was negative. - ** flag_zeropad TRUE if the width began with 0. - ** flag_long TRUE if the letter 'l' (ell) prefixed - ** the conversion character. - ** flag_longlong TRUE if the letter 'll' (ell ell) prefixed - ** the conversion character. - ** flag_blanksign TRUE if a ' ' is present. - ** width The specified field width. This is - ** always non-negative. Zero is the default. - ** precision The specified precision. The default - ** is -1. - ** xtype The class of the conversion. - ** infop Pointer to the appropriate info struct. - */ - switch( xtype ){ - case etPOINTER: - flag_longlong = sizeof(char*)==sizeof(i64); - flag_long = sizeof(char*)==sizeof(long int); - /* Fall through into the next case */ - case etORDINAL: - case etRADIX: - if( infop->flags & FLAG_SIGNED ){ - i64 v; - if( bArgList ){ - v = getIntArg(pArgList); - }else if( flag_longlong ){ - v = va_arg(ap,i64); - }else if( flag_long ){ - v = va_arg(ap,long int); - }else{ - v = va_arg(ap,int); - } - if( v<0 ){ - if( v==SMALLEST_INT64 ){ - longvalue = ((u64)1)<<63; - }else{ - longvalue = -v; - } - prefix = '-'; - }else{ - longvalue = v; - if( flag_plussign ) prefix = '+'; - else if( flag_blanksign ) prefix = ' '; - else prefix = 0; - } - }else{ - if( bArgList ){ - longvalue = (u64)getIntArg(pArgList); - }else if( flag_longlong ){ - longvalue = va_arg(ap,u64); - }else if( flag_long ){ - longvalue = va_arg(ap,unsigned long int); - }else{ - longvalue = va_arg(ap,unsigned int); - } - prefix = 0; - } - if( longvalue==0 ) flag_alternateform = 0; - if( flag_zeropad && precision=4 || (longvalue/10)%10==1 ){ - x = 0; - } - *(--bufpt) = zOrd[x*2+1]; - *(--bufpt) = zOrd[x*2]; - } - { - register const char *cset; /* Use registers for speed */ - register int base; - cset = &aDigits[infop->charset]; - base = infop->base; - do{ /* Convert to ascii */ - *(--bufpt) = cset[longvalue%base]; - longvalue = longvalue/base; - }while( longvalue>0 ); - } - length = (int)(&zOut[nOut-1]-bufpt); - for(idx=precision-length; idx>0; idx--){ - *(--bufpt) = '0'; /* Zero pad */ - } - if( prefix ) *(--bufpt) = prefix; /* Add sign */ - if( flag_alternateform && infop->prefix ){ /* Add "0" or "0x" */ - const char *pre; - char x; - pre = &aPrefix[infop->prefix]; - for(; (x=(*pre))!=0; pre++) *(--bufpt) = x; - } - length = (int)(&zOut[nOut-1]-bufpt); - break; - case etFLOAT: - case etEXP: - case etGENERIC: - if( bArgList ){ - realvalue = getDoubleArg(pArgList); - }else{ - realvalue = va_arg(ap,double); - } -#ifdef SQLITE_OMIT_FLOATING_POINT - length = 0; -#else - if( precision<0 ) precision = 6; /* Set default precision */ - if( realvalue<0.0 ){ - realvalue = -realvalue; - prefix = '-'; - }else{ - if( flag_plussign ) prefix = '+'; - else if( flag_blanksign ) prefix = ' '; - else prefix = 0; - } - if( xtype==etGENERIC && precision>0 ) precision--; - for(idx=precision, rounder=0.5; idx>0; idx--, rounder*=0.1){} - if( xtype==etFLOAT ) realvalue += rounder; - /* Normalize realvalue to within 10.0 > realvalue >= 1.0 */ - exp = 0; - if( sqlite3IsNaN((double)realvalue) ){ - bufpt = "NaN"; - length = 3; - break; - } - if( realvalue>0.0 ){ - LONGDOUBLE_TYPE scale = 1.0; -#if __DBL_MAX_10_EXP__ > 100 - while( realvalue>=1e100*scale && exp<=350 ){ scale *= 1e100;exp+=100;} -#endif -#if __DBL_MAX_10_EXP__ > 64 - while( realvalue>=1e64*scale && exp<=350 ){ scale *= 1e64; exp+=64; } -#endif - while( realvalue>=1e8*scale && exp<=350 ){ scale *= 1e8; exp+=8; } - while( realvalue>=10.0*scale && exp<=350 ){ scale *= 10.0; exp++; } - realvalue /= scale; - while( realvalue<1e-8 ){ realvalue *= 1e8; exp-=8; } - while( realvalue<1.0 ){ realvalue *= 10.0; exp--; } - if( exp>350 ){ - if( prefix=='-' ){ - bufpt = "-Inf"; - }else if( prefix=='+' ){ - bufpt = "+Inf"; - }else{ - bufpt = "Inf"; - } - length = sqlite3Strlen30(bufpt); - break; - } - } - bufpt = buf; - /* - ** If the field type is etGENERIC, then convert to either etEXP - ** or etFLOAT, as appropriate. - */ - if( xtype!=etFLOAT ){ - realvalue += rounder; - if( realvalue>=10.0 ){ realvalue *= 0.1; exp++; } - } - if( xtype==etGENERIC ){ - flag_rtz = !flag_alternateform; - if( exp<-4 || exp>precision ){ - xtype = etEXP; - }else{ - precision = precision - exp; - xtype = etFLOAT; - } - }else{ - flag_rtz = flag_altform2; - } - if( xtype==etEXP ){ - e2 = 0; - }else{ - e2 = exp; - } - if( MAX(e2,0)+precision+width > etBUFSIZE - 15 ){ - bufpt = zExtra = sqlite3Malloc( MAX(e2,0)+precision+width+15 ); - if( bufpt==0 ){ - setStrAccumError(pAccum, STRACCUM_NOMEM); - return; - } - } - zOut = bufpt; - nsd = 16 + flag_altform2*10; - flag_dp = (precision>0 ?1:0) | flag_alternateform | flag_altform2; - /* The sign in front of the number */ - if( prefix ){ - *(bufpt++) = prefix; - } - /* Digits prior to the decimal point */ - if( e2<0 ){ - *(bufpt++) = '0'; - }else{ - for(; e2>=0; e2--){ - *(bufpt++) = et_getdigit(&realvalue,&nsd); - } - } - /* The decimal point */ - if( flag_dp ){ - *(bufpt++) = '.'; - } - /* "0" digits after the decimal point but before the first - ** significant digit of the number */ - for(e2++; e2<0; precision--, e2++){ - assert( precision>0 ); - *(bufpt++) = '0'; - } - /* Significant digits after the decimal point */ - while( (precision--)>0 ){ - *(bufpt++) = et_getdigit(&realvalue,&nsd); - } - /* Remove trailing zeros and the "." if no digits follow the "." */ - if( flag_rtz && flag_dp ){ - while( bufpt[-1]=='0' ) *(--bufpt) = 0; - assert( bufpt>zOut ); - if( bufpt[-1]=='.' ){ - if( flag_altform2 ){ - *(bufpt++) = '0'; - }else{ - *(--bufpt) = 0; - } - } - } - /* Add the "eNNN" suffix */ - if( xtype==etEXP ){ - *(bufpt++) = aDigits[infop->charset]; - if( exp<0 ){ - *(bufpt++) = '-'; exp = -exp; - }else{ - *(bufpt++) = '+'; - } - if( exp>=100 ){ - *(bufpt++) = (char)((exp/100)+'0'); /* 100's digit */ - exp %= 100; - } - *(bufpt++) = (char)(exp/10+'0'); /* 10's digit */ - *(bufpt++) = (char)(exp%10+'0'); /* 1's digit */ - } - *bufpt = 0; - - /* The converted number is in buf[] and zero terminated. Output it. - ** Note that the number is in the usual order, not reversed as with - ** integer conversions. */ - length = (int)(bufpt-zOut); - bufpt = zOut; - - /* Special case: Add leading zeros if the flag_zeropad flag is - ** set and we are not left justified */ - if( flag_zeropad && !flag_leftjustify && length < width){ - int i; - int nPad = width - length; - for(i=width; i>=nPad; i--){ - bufpt[i] = bufpt[i-nPad]; - } - i = prefix!=0; - while( nPad-- ) bufpt[i++] = '0'; - length = width; - } -#endif /* !defined(SQLITE_OMIT_FLOATING_POINT) */ - break; - case etSIZE: - if( !bArgList ){ - *(va_arg(ap,int*)) = pAccum->nChar; - } - length = width = 0; - break; - case etPERCENT: - buf[0] = '%'; - bufpt = buf; - length = 1; - break; - case etCHARX: - if( bArgList ){ - bufpt = getTextArg(pArgList); - c = bufpt ? bufpt[0] : 0; - }else{ - c = va_arg(ap,int); - } - buf[0] = (char)c; - if( precision>=0 ){ - for(idx=1; idx=0 ){ - for(length=0; lengthetBUFSIZE ){ - bufpt = zExtra = sqlite3Malloc( n ); - if( bufpt==0 ){ - setStrAccumError(pAccum, STRACCUM_NOMEM); - return; - } - }else{ - bufpt = buf; - } - j = 0; - if( needQuote ) bufpt[j++] = q; - k = i; - for(i=0; i=0 && precisionn ){ - sqlite3StrAccumAppend(pAccum, (const char*)pToken->z, pToken->n); - } - length = width = 0; - break; - } - case etSRCLIST: { - SrcList *pSrc = va_arg(ap, SrcList*); - int k = va_arg(ap, int); - struct SrcList_item *pItem = &pSrc->a[k]; - assert( bArgList==0 ); - assert( k>=0 && knSrc ); - if( pItem->zDatabase ){ - sqlite3StrAccumAppendAll(pAccum, pItem->zDatabase); - sqlite3StrAccumAppend(pAccum, ".", 1); - } - sqlite3StrAccumAppendAll(pAccum, pItem->zName); - length = width = 0; - break; - } - default: { - assert( xtype==etINVALID ); - return; - } - }/* End switch over the format type */ - /* - ** The text of the conversion is pointed to by "bufpt" and is - ** "length" characters long. The field width is "width". Do - ** the output. - */ - if( !flag_leftjustify ){ - register int nspace; - nspace = width-length; - if( nspace>0 ){ - sqlite3AppendSpace(pAccum, nspace); - } - } - if( length>0 ){ - sqlite3StrAccumAppend(pAccum, bufpt, length); - } - if( flag_leftjustify ){ - register int nspace; - nspace = width-length; - if( nspace>0 ){ - sqlite3AppendSpace(pAccum, nspace); - } - } - if( zExtra ) sqlite3_free(zExtra); - }/* End for loop over the format string */ -} /* End of function */ - -/* -** Append N bytes of text from z to the StrAccum object. -*/ -SQLITE_PRIVATE void sqlite3StrAccumAppend(StrAccum *p, const char *z, int N){ - assert( z!=0 ); - assert( p->zText!=0 || p->nChar==0 || p->accError ); - assert( N>=0 ); - assert( p->accError==0 || p->nAlloc==0 ); - if( p->nChar+N >= p->nAlloc ){ - char *zNew; - if( p->accError ){ - testcase(p->accError==STRACCUM_TOOBIG); - testcase(p->accError==STRACCUM_NOMEM); - return; - } - if( !p->useMalloc ){ - N = p->nAlloc - p->nChar - 1; - setStrAccumError(p, STRACCUM_TOOBIG); - if( N<=0 ){ - return; - } - }else{ - char *zOld = (p->zText==p->zBase ? 0 : p->zText); - i64 szNew = p->nChar; - szNew += N + 1; - if( szNew > p->mxAlloc ){ - sqlite3StrAccumReset(p); - setStrAccumError(p, STRACCUM_TOOBIG); - return; - }else{ - p->nAlloc = (int)szNew; - } - if( p->useMalloc==1 ){ - zNew = sqlite3DbRealloc(p->db, zOld, p->nAlloc); - }else{ - zNew = sqlite3_realloc(zOld, p->nAlloc); - } - if( zNew ){ - if( zOld==0 && p->nChar>0 ) memcpy(zNew, p->zText, p->nChar); - p->zText = zNew; - }else{ - sqlite3StrAccumReset(p); - setStrAccumError(p, STRACCUM_NOMEM); - return; - } - } - } - assert( p->zText ); - memcpy(&p->zText[p->nChar], z, N); - p->nChar += N; -} - -/* -** Append the complete text of zero-terminated string z[] to the p string. -*/ -SQLITE_PRIVATE void sqlite3StrAccumAppendAll(StrAccum *p, const char *z){ - sqlite3StrAccumAppend(p, z, sqlite3Strlen30(z)); -} - - -/* -** Finish off a string by making sure it is zero-terminated. -** Return a pointer to the resulting string. Return a NULL -** pointer if any kind of error was encountered. -*/ -SQLITE_PRIVATE char *sqlite3StrAccumFinish(StrAccum *p){ - if( p->zText ){ - p->zText[p->nChar] = 0; - if( p->useMalloc && p->zText==p->zBase ){ - if( p->useMalloc==1 ){ - p->zText = sqlite3DbMallocRaw(p->db, p->nChar+1 ); - }else{ - p->zText = sqlite3_malloc(p->nChar+1); - } - if( p->zText ){ - memcpy(p->zText, p->zBase, p->nChar+1); - }else{ - setStrAccumError(p, STRACCUM_NOMEM); - } - } - } - return p->zText; -} - -/* -** Reset an StrAccum string. Reclaim all malloced memory. -*/ -SQLITE_PRIVATE void sqlite3StrAccumReset(StrAccum *p){ - if( p->zText!=p->zBase ){ - if( p->useMalloc==1 ){ - sqlite3DbFree(p->db, p->zText); - }else{ - sqlite3_free(p->zText); - } - } - p->zText = 0; -} - -/* -** Initialize a string accumulator -*/ -SQLITE_PRIVATE void sqlite3StrAccumInit(StrAccum *p, char *zBase, int n, int mx){ - p->zText = p->zBase = zBase; - p->db = 0; - p->nChar = 0; - p->nAlloc = n; - p->mxAlloc = mx; - p->useMalloc = 1; - p->accError = 0; -} - -/* -** Print into memory obtained from sqliteMalloc(). Use the internal -** %-conversion extensions. -*/ -SQLITE_PRIVATE char *sqlite3VMPrintf(sqlite3 *db, const char *zFormat, va_list ap){ - char *z; - char zBase[SQLITE_PRINT_BUF_SIZE]; - StrAccum acc; - assert( db!=0 ); - sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), - db->aLimit[SQLITE_LIMIT_LENGTH]); - acc.db = db; - sqlite3VXPrintf(&acc, SQLITE_PRINTF_INTERNAL, zFormat, ap); - z = sqlite3StrAccumFinish(&acc); - if( acc.accError==STRACCUM_NOMEM ){ - db->mallocFailed = 1; - } - return z; -} - -/* -** Print into memory obtained from sqliteMalloc(). Use the internal -** %-conversion extensions. -*/ -SQLITE_PRIVATE char *sqlite3MPrintf(sqlite3 *db, const char *zFormat, ...){ - va_list ap; - char *z; - va_start(ap, zFormat); - z = sqlite3VMPrintf(db, zFormat, ap); - va_end(ap); - return z; -} - -/* -** Like sqlite3MPrintf(), but call sqlite3DbFree() on zStr after formatting -** the string and before returnning. This routine is intended to be used -** to modify an existing string. For example: -** -** x = sqlite3MPrintf(db, x, "prefix %s suffix", x); -** -*/ -SQLITE_PRIVATE char *sqlite3MAppendf(sqlite3 *db, char *zStr, const char *zFormat, ...){ - va_list ap; - char *z; - va_start(ap, zFormat); - z = sqlite3VMPrintf(db, zFormat, ap); - va_end(ap); - sqlite3DbFree(db, zStr); - return z; -} - -/* -** Print into memory obtained from sqlite3_malloc(). Omit the internal -** %-conversion extensions. -*/ -SQLITE_API char *sqlite3_vmprintf(const char *zFormat, va_list ap){ - char *z; - char zBase[SQLITE_PRINT_BUF_SIZE]; - StrAccum acc; -#ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; -#endif - sqlite3StrAccumInit(&acc, zBase, sizeof(zBase), SQLITE_MAX_LENGTH); - acc.useMalloc = 2; - sqlite3VXPrintf(&acc, 0, zFormat, ap); - z = sqlite3StrAccumFinish(&acc); - return z; -} - -/* -** Print into memory obtained from sqlite3_malloc()(). Omit the internal -** %-conversion extensions. -*/ -SQLITE_API char *sqlite3_mprintf(const char *zFormat, ...){ - va_list ap; - char *z; -#ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize() ) return 0; -#endif - va_start(ap, zFormat); - z = sqlite3_vmprintf(zFormat, ap); - va_end(ap); - return z; -} - -/* -** sqlite3_snprintf() works like snprintf() except that it ignores the -** current locale settings. This is important for SQLite because we -** are not able to use a "," as the decimal point in place of "." as -** specified by some locales. -** -** Oops: The first two arguments of sqlite3_snprintf() are backwards -** from the snprintf() standard. Unfortunately, it is too late to change -** this without breaking compatibility, so we just have to live with the -** mistake. -** -** sqlite3_vsnprintf() is the varargs version. -*/ -SQLITE_API char *sqlite3_vsnprintf(int n, char *zBuf, const char *zFormat, va_list ap){ - StrAccum acc; - if( n<=0 ) return zBuf; - sqlite3StrAccumInit(&acc, zBuf, n, 0); - acc.useMalloc = 0; - sqlite3VXPrintf(&acc, 0, zFormat, ap); - return sqlite3StrAccumFinish(&acc); -} -SQLITE_API char *sqlite3_snprintf(int n, char *zBuf, const char *zFormat, ...){ - char *z; - va_list ap; - va_start(ap,zFormat); - z = sqlite3_vsnprintf(n, zBuf, zFormat, ap); - va_end(ap); - return z; -} - -/* -** This is the routine that actually formats the sqlite3_log() message. -** We house it in a separate routine from sqlite3_log() to avoid using -** stack space on small-stack systems when logging is disabled. -** -** sqlite3_log() must render into a static buffer. It cannot dynamically -** allocate memory because it might be called while the memory allocator -** mutex is held. -*/ -static void renderLogMsg(int iErrCode, const char *zFormat, va_list ap){ - StrAccum acc; /* String accumulator */ - char zMsg[SQLITE_PRINT_BUF_SIZE*3]; /* Complete log message */ - - sqlite3StrAccumInit(&acc, zMsg, sizeof(zMsg), 0); - acc.useMalloc = 0; - sqlite3VXPrintf(&acc, 0, zFormat, ap); - sqlite3GlobalConfig.xLog(sqlite3GlobalConfig.pLogArg, iErrCode, - sqlite3StrAccumFinish(&acc)); -} - -/* -** Format and write a message to the log if logging is enabled. -*/ -SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...){ - va_list ap; /* Vararg list */ - if( sqlite3GlobalConfig.xLog ){ - va_start(ap, zFormat); - renderLogMsg(iErrCode, zFormat, ap); - va_end(ap); - } -} - -#if defined(SQLITE_DEBUG) -/* -** A version of printf() that understands %lld. Used for debugging. -** The printf() built into some versions of windows does not understand %lld -** and segfaults if you give it a long long int. -*/ -SQLITE_PRIVATE void sqlite3DebugPrintf(const char *zFormat, ...){ - va_list ap; - StrAccum acc; - char zBuf[500]; - sqlite3StrAccumInit(&acc, zBuf, sizeof(zBuf), 0); - acc.useMalloc = 0; - va_start(ap,zFormat); - sqlite3VXPrintf(&acc, 0, zFormat, ap); - va_end(ap); - sqlite3StrAccumFinish(&acc); - fprintf(stdout,"%s", zBuf); - fflush(stdout); -} -#endif - -/* -** variable-argument wrapper around sqlite3VXPrintf(). -*/ -SQLITE_PRIVATE void sqlite3XPrintf(StrAccum *p, u32 bFlags, const char *zFormat, ...){ - va_list ap; - va_start(ap,zFormat); - sqlite3VXPrintf(p, bFlags, zFormat, ap); - va_end(ap); -} - -/************** End of printf.c **********************************************/ -/************** Begin file random.c ******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code to implement a pseudo-random number -** generator (PRNG) for SQLite. -** -** Random numbers are used by some of the database backends in order -** to generate random integer keys for tables or random filenames. -*/ - - -/* All threads share a single random number generator. -** This structure is the current state of the generator. -*/ -static SQLITE_WSD struct sqlite3PrngType { - unsigned char isInit; /* True if initialized */ - unsigned char i, j; /* State variables */ - unsigned char s[256]; /* State variables */ -} sqlite3Prng; - -/* -** Return N random bytes. -*/ -SQLITE_API void sqlite3_randomness(int N, void *pBuf){ - unsigned char t; - unsigned char *zBuf = pBuf; - - /* The "wsdPrng" macro will resolve to the pseudo-random number generator - ** state vector. If writable static data is unsupported on the target, - ** we have to locate the state vector at run-time. In the more common - ** case where writable static data is supported, wsdPrng can refer directly - ** to the "sqlite3Prng" state vector declared above. - */ -#ifdef SQLITE_OMIT_WSD - struct sqlite3PrngType *p = &GLOBAL(struct sqlite3PrngType, sqlite3Prng); -# define wsdPrng p[0] -#else -# define wsdPrng sqlite3Prng -#endif - -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_PRNG); - sqlite3_mutex_enter(mutex); -#endif - - if( N<=0 ){ - wsdPrng.isInit = 0; - sqlite3_mutex_leave(mutex); - return; - } - - /* Initialize the state of the random number generator once, - ** the first time this routine is called. The seed value does - ** not need to contain a lot of randomness since we are not - ** trying to do secure encryption or anything like that... - ** - ** Nothing in this file or anywhere else in SQLite does any kind of - ** encryption. The RC4 algorithm is being used as a PRNG (pseudo-random - ** number generator) not as an encryption device. - */ - if( !wsdPrng.isInit ){ - int i; - char k[256]; - wsdPrng.j = 0; - wsdPrng.i = 0; - sqlite3OsRandomness(sqlite3_vfs_find(0), 256, k); - for(i=0; i<256; i++){ - wsdPrng.s[i] = (u8)i; - } - for(i=0; i<256; i++){ - wsdPrng.j += wsdPrng.s[i] + k[i]; - t = wsdPrng.s[wsdPrng.j]; - wsdPrng.s[wsdPrng.j] = wsdPrng.s[i]; - wsdPrng.s[i] = t; - } - wsdPrng.isInit = 1; - } - - assert( N>0 ); - do{ - wsdPrng.i++; - t = wsdPrng.s[wsdPrng.i]; - wsdPrng.j += t; - wsdPrng.s[wsdPrng.i] = wsdPrng.s[wsdPrng.j]; - wsdPrng.s[wsdPrng.j] = t; - t += wsdPrng.s[wsdPrng.i]; - *(zBuf++) = wsdPrng.s[t]; - }while( --N ); - sqlite3_mutex_leave(mutex); -} - -#ifndef SQLITE_OMIT_BUILTIN_TEST -/* -** For testing purposes, we sometimes want to preserve the state of -** PRNG and restore the PRNG to its saved state at a later time, or -** to reset the PRNG to its initial state. These routines accomplish -** those tasks. -** -** The sqlite3_test_control() interface calls these routines to -** control the PRNG. -*/ -static SQLITE_WSD struct sqlite3PrngType sqlite3SavedPrng; -SQLITE_PRIVATE void sqlite3PrngSaveState(void){ - memcpy( - &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng), - &GLOBAL(struct sqlite3PrngType, sqlite3Prng), - sizeof(sqlite3Prng) - ); -} -SQLITE_PRIVATE void sqlite3PrngRestoreState(void){ - memcpy( - &GLOBAL(struct sqlite3PrngType, sqlite3Prng), - &GLOBAL(struct sqlite3PrngType, sqlite3SavedPrng), - sizeof(sqlite3Prng) - ); -} -#endif /* SQLITE_OMIT_BUILTIN_TEST */ - -/************** End of random.c **********************************************/ -/************** Begin file utf.c *********************************************/ -/* -** 2004 April 13 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains routines used to translate between UTF-8, -** UTF-16, UTF-16BE, and UTF-16LE. -** -** Notes on UTF-8: -** -** Byte-0 Byte-1 Byte-2 Byte-3 Value -** 0xxxxxxx 00000000 00000000 0xxxxxxx -** 110yyyyy 10xxxxxx 00000000 00000yyy yyxxxxxx -** 1110zzzz 10yyyyyy 10xxxxxx 00000000 zzzzyyyy yyxxxxxx -** 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx 000uuuuu zzzzyyyy yyxxxxxx -** -** -** Notes on UTF-16: (with wwww+1==uuuuu) -** -** Word-0 Word-1 Value -** 110110ww wwzzzzyy 110111yy yyxxxxxx 000uuuuu zzzzyyyy yyxxxxxx -** zzzzyyyy yyxxxxxx 00000000 zzzzyyyy yyxxxxxx -** -** -** BOM or Byte Order Mark: -** 0xff 0xfe little-endian utf-16 follows -** 0xfe 0xff big-endian utf-16 follows -** -*/ -/* #include */ - -#ifndef SQLITE_AMALGAMATION -/* -** The following constant value is used by the SQLITE_BIGENDIAN and -** SQLITE_LITTLEENDIAN macros. -*/ -SQLITE_PRIVATE const int sqlite3one = 1; -#endif /* SQLITE_AMALGAMATION */ - -/* -** This lookup table is used to help decode the first byte of -** a multi-byte UTF8 character. -*/ -static const unsigned char sqlite3Utf8Trans1[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00, -}; - - -#define WRITE_UTF8(zOut, c) { \ - if( c<0x00080 ){ \ - *zOut++ = (u8)(c&0xFF); \ - } \ - else if( c<0x00800 ){ \ - *zOut++ = 0xC0 + (u8)((c>>6)&0x1F); \ - *zOut++ = 0x80 + (u8)(c & 0x3F); \ - } \ - else if( c<0x10000 ){ \ - *zOut++ = 0xE0 + (u8)((c>>12)&0x0F); \ - *zOut++ = 0x80 + (u8)((c>>6) & 0x3F); \ - *zOut++ = 0x80 + (u8)(c & 0x3F); \ - }else{ \ - *zOut++ = 0xF0 + (u8)((c>>18) & 0x07); \ - *zOut++ = 0x80 + (u8)((c>>12) & 0x3F); \ - *zOut++ = 0x80 + (u8)((c>>6) & 0x3F); \ - *zOut++ = 0x80 + (u8)(c & 0x3F); \ - } \ -} - -#define WRITE_UTF16LE(zOut, c) { \ - if( c<=0xFFFF ){ \ - *zOut++ = (u8)(c&0x00FF); \ - *zOut++ = (u8)((c>>8)&0x00FF); \ - }else{ \ - *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); \ - *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); \ - *zOut++ = (u8)(c&0x00FF); \ - *zOut++ = (u8)(0x00DC + ((c>>8)&0x03)); \ - } \ -} - -#define WRITE_UTF16BE(zOut, c) { \ - if( c<=0xFFFF ){ \ - *zOut++ = (u8)((c>>8)&0x00FF); \ - *zOut++ = (u8)(c&0x00FF); \ - }else{ \ - *zOut++ = (u8)(0x00D8 + (((c-0x10000)>>18)&0x03)); \ - *zOut++ = (u8)(((c>>10)&0x003F) + (((c-0x10000)>>10)&0x00C0)); \ - *zOut++ = (u8)(0x00DC + ((c>>8)&0x03)); \ - *zOut++ = (u8)(c&0x00FF); \ - } \ -} - -#define READ_UTF16LE(zIn, TERM, c){ \ - c = (*zIn++); \ - c += ((*zIn++)<<8); \ - if( c>=0xD800 && c<0xE000 && TERM ){ \ - int c2 = (*zIn++); \ - c2 += ((*zIn++)<<8); \ - c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); \ - } \ -} - -#define READ_UTF16BE(zIn, TERM, c){ \ - c = ((*zIn++)<<8); \ - c += (*zIn++); \ - if( c>=0xD800 && c<0xE000 && TERM ){ \ - int c2 = ((*zIn++)<<8); \ - c2 += (*zIn++); \ - c = (c2&0x03FF) + ((c&0x003F)<<10) + (((c&0x03C0)+0x0040)<<10); \ - } \ -} - -/* -** Translate a single UTF-8 character. Return the unicode value. -** -** During translation, assume that the byte that zTerm points -** is a 0x00. -** -** Write a pointer to the next unread byte back into *pzNext. -** -** Notes On Invalid UTF-8: -** -** * This routine never allows a 7-bit character (0x00 through 0x7f) to -** be encoded as a multi-byte character. Any multi-byte character that -** attempts to encode a value between 0x00 and 0x7f is rendered as 0xfffd. -** -** * This routine never allows a UTF16 surrogate value to be encoded. -** If a multi-byte character attempts to encode a value between -** 0xd800 and 0xe000 then it is rendered as 0xfffd. -** -** * Bytes in the range of 0x80 through 0xbf which occur as the first -** byte of a character are interpreted as single-byte characters -** and rendered as themselves even though they are technically -** invalid characters. -** -** * This routine accepts an infinite number of different UTF8 encodings -** for unicode values 0x80 and greater. It do not change over-length -** encodings to 0xfffd as some systems recommend. -*/ -#define READ_UTF8(zIn, zTerm, c) \ - c = *(zIn++); \ - if( c>=0xc0 ){ \ - c = sqlite3Utf8Trans1[c-0xc0]; \ - while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){ \ - c = (c<<6) + (0x3f & *(zIn++)); \ - } \ - if( c<0x80 \ - || (c&0xFFFFF800)==0xD800 \ - || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \ - } -SQLITE_PRIVATE u32 sqlite3Utf8Read( - const unsigned char **pz /* Pointer to string from which to read char */ -){ - unsigned int c; - - /* Same as READ_UTF8() above but without the zTerm parameter. - ** For this routine, we assume the UTF8 string is always zero-terminated. - */ - c = *((*pz)++); - if( c>=0xc0 ){ - c = sqlite3Utf8Trans1[c-0xc0]; - while( (*(*pz) & 0xc0)==0x80 ){ - c = (c<<6) + (0x3f & *((*pz)++)); - } - if( c<0x80 - || (c&0xFFFFF800)==0xD800 - || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } - } - return c; -} - - - - -/* -** If the TRANSLATE_TRACE macro is defined, the value of each Mem is -** printed on stderr on the way into and out of sqlite3VdbeMemTranslate(). -*/ -/* #define TRANSLATE_TRACE 1 */ - -#ifndef SQLITE_OMIT_UTF16 -/* -** This routine transforms the internal text encoding used by pMem to -** desiredEnc. It is an error if the string is already of the desired -** encoding, or if *pMem does not contain a string value. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemTranslate(Mem *pMem, u8 desiredEnc){ - int len; /* Maximum length of output string in bytes */ - unsigned char *zOut; /* Output buffer */ - unsigned char *zIn; /* Input iterator */ - unsigned char *zTerm; /* End of input */ - unsigned char *z; /* Output iterator */ - unsigned int c; - - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( pMem->flags&MEM_Str ); - assert( pMem->enc!=desiredEnc ); - assert( pMem->enc!=0 ); - assert( pMem->n>=0 ); - -#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG) - { - char zBuf[100]; - sqlite3VdbeMemPrettyPrint(pMem, zBuf); - fprintf(stderr, "INPUT: %s\n", zBuf); - } -#endif - - /* If the translation is between UTF-16 little and big endian, then - ** all that is required is to swap the byte order. This case is handled - ** differently from the others. - */ - if( pMem->enc!=SQLITE_UTF8 && desiredEnc!=SQLITE_UTF8 ){ - u8 temp; - int rc; - rc = sqlite3VdbeMemMakeWriteable(pMem); - if( rc!=SQLITE_OK ){ - assert( rc==SQLITE_NOMEM ); - return SQLITE_NOMEM; - } - zIn = (u8*)pMem->z; - zTerm = &zIn[pMem->n&~1]; - while( zInenc = desiredEnc; - goto translate_out; - } - - /* Set len to the maximum number of bytes required in the output buffer. */ - if( desiredEnc==SQLITE_UTF8 ){ - /* When converting from UTF-16, the maximum growth results from - ** translating a 2-byte character to a 4-byte UTF-8 character. - ** A single byte is required for the output string - ** nul-terminator. - */ - pMem->n &= ~1; - len = pMem->n * 2 + 1; - }else{ - /* When converting from UTF-8 to UTF-16 the maximum growth is caused - ** when a 1-byte UTF-8 character is translated into a 2-byte UTF-16 - ** character. Two bytes are required in the output buffer for the - ** nul-terminator. - */ - len = pMem->n * 2 + 2; - } - - /* Set zIn to point at the start of the input buffer and zTerm to point 1 - ** byte past the end. - ** - ** Variable zOut is set to point at the output buffer, space obtained - ** from sqlite3_malloc(). - */ - zIn = (u8*)pMem->z; - zTerm = &zIn[pMem->n]; - zOut = sqlite3DbMallocRaw(pMem->db, len); - if( !zOut ){ - return SQLITE_NOMEM; - } - z = zOut; - - if( pMem->enc==SQLITE_UTF8 ){ - if( desiredEnc==SQLITE_UTF16LE ){ - /* UTF-8 -> UTF-16 Little-endian */ - while( zIn UTF-16 Big-endian */ - while( zInn = (int)(z - zOut); - *z++ = 0; - }else{ - assert( desiredEnc==SQLITE_UTF8 ); - if( pMem->enc==SQLITE_UTF16LE ){ - /* UTF-16 Little-endian -> UTF-8 */ - while( zIn UTF-8 */ - while( zInn = (int)(z - zOut); - } - *z = 0; - assert( (pMem->n+(desiredEnc==SQLITE_UTF8?1:2))<=len ); - - sqlite3VdbeMemRelease(pMem); - pMem->flags &= ~(MEM_Static|MEM_Dyn|MEM_Ephem); - pMem->enc = desiredEnc; - pMem->flags |= (MEM_Term|MEM_Dyn); - pMem->z = (char*)zOut; - pMem->zMalloc = pMem->z; - -translate_out: -#if defined(TRANSLATE_TRACE) && defined(SQLITE_DEBUG) - { - char zBuf[100]; - sqlite3VdbeMemPrettyPrint(pMem, zBuf); - fprintf(stderr, "OUTPUT: %s\n", zBuf); - } -#endif - return SQLITE_OK; -} - -/* -** This routine checks for a byte-order mark at the beginning of the -** UTF-16 string stored in *pMem. If one is present, it is removed and -** the encoding of the Mem adjusted. This routine does not do any -** byte-swapping, it just sets Mem.enc appropriately. -** -** The allocation (static, dynamic etc.) and encoding of the Mem may be -** changed by this function. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemHandleBom(Mem *pMem){ - int rc = SQLITE_OK; - u8 bom = 0; - - assert( pMem->n>=0 ); - if( pMem->n>1 ){ - u8 b1 = *(u8 *)pMem->z; - u8 b2 = *(((u8 *)pMem->z) + 1); - if( b1==0xFE && b2==0xFF ){ - bom = SQLITE_UTF16BE; - } - if( b1==0xFF && b2==0xFE ){ - bom = SQLITE_UTF16LE; - } - } - - if( bom ){ - rc = sqlite3VdbeMemMakeWriteable(pMem); - if( rc==SQLITE_OK ){ - pMem->n -= 2; - memmove(pMem->z, &pMem->z[2], pMem->n); - pMem->z[pMem->n] = '\0'; - pMem->z[pMem->n+1] = '\0'; - pMem->flags |= MEM_Term; - pMem->enc = bom; - } - } - return rc; -} -#endif /* SQLITE_OMIT_UTF16 */ - -/* -** pZ is a UTF-8 encoded unicode string. If nByte is less than zero, -** return the number of unicode characters in pZ up to (but not including) -** the first 0x00 byte. If nByte is not less than zero, return the -** number of unicode characters in the first nByte of pZ (or up to -** the first 0x00, whichever comes first). -*/ -SQLITE_PRIVATE int sqlite3Utf8CharLen(const char *zIn, int nByte){ - int r = 0; - const u8 *z = (const u8*)zIn; - const u8 *zTerm; - if( nByte>=0 ){ - zTerm = &z[nByte]; - }else{ - zTerm = (const u8*)(-1); - } - assert( z<=zTerm ); - while( *z!=0 && zmallocFailed ){ - sqlite3VdbeMemRelease(&m); - m.z = 0; - } - assert( (m.flags & MEM_Term)!=0 || db->mallocFailed ); - assert( (m.flags & MEM_Str)!=0 || db->mallocFailed ); - assert( (m.flags & MEM_Dyn)!=0 || db->mallocFailed ); - assert( m.z || db->mallocFailed ); - return m.z; -} - -/* -** zIn is a UTF-16 encoded unicode string at least nChar characters long. -** Return the number of bytes in the first nChar unicode characters -** in pZ. nChar must be non-negative. -*/ -SQLITE_PRIVATE int sqlite3Utf16ByteLen(const void *zIn, int nChar){ - int c; - unsigned char const *z = zIn; - int n = 0; - - if( SQLITE_UTF16NATIVE==SQLITE_UTF16BE ){ - while( n0 && n<=4 ); - z[0] = 0; - z = zBuf; - c = sqlite3Utf8Read((const u8**)&z); - t = i; - if( i>=0xD800 && i<=0xDFFF ) t = 0xFFFD; - if( (i&0xFFFFFFFE)==0xFFFE ) t = 0xFFFD; - assert( c==t ); - assert( (z-zBuf)==n ); - } - for(i=0; i<0x00110000; i++){ - if( i>=0xD800 && i<0xE000 ) continue; - z = zBuf; - WRITE_UTF16LE(z, i); - n = (int)(z-zBuf); - assert( n>0 && n<=4 ); - z[0] = 0; - z = zBuf; - READ_UTF16LE(z, 1, c); - assert( c==i ); - assert( (z-zBuf)==n ); - } - for(i=0; i<0x00110000; i++){ - if( i>=0xD800 && i<0xE000 ) continue; - z = zBuf; - WRITE_UTF16BE(z, i); - n = (int)(z-zBuf); - assert( n>0 && n<=4 ); - z[0] = 0; - z = zBuf; - READ_UTF16BE(z, 1, c); - assert( c==i ); - assert( (z-zBuf)==n ); - } -} -#endif /* SQLITE_TEST */ -#endif /* SQLITE_OMIT_UTF16 */ - -/************** End of utf.c *************************************************/ -/************** Begin file util.c ********************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Utility functions used throughout sqlite. -** -** This file contains functions for allocating memory, comparing -** strings, and stuff like that. -** -*/ -/* #include */ -#ifdef SQLITE_HAVE_ISNAN -# include -#endif - -/* -** Routine needed to support the testcase() macro. -*/ -#ifdef SQLITE_COVERAGE_TEST -SQLITE_PRIVATE void sqlite3Coverage(int x){ - static unsigned dummy = 0; - dummy += (unsigned)x; -} -#endif - -#ifndef SQLITE_OMIT_FLOATING_POINT -/* -** Return true if the floating point value is Not a Number (NaN). -** -** Use the math library isnan() function if compiled with SQLITE_HAVE_ISNAN. -** Otherwise, we have our own implementation that works on most systems. -*/ -SQLITE_PRIVATE int sqlite3IsNaN(double x){ - int rc; /* The value return */ -#if !defined(SQLITE_HAVE_ISNAN) - /* - ** Systems that support the isnan() library function should probably - ** make use of it by compiling with -DSQLITE_HAVE_ISNAN. But we have - ** found that many systems do not have a working isnan() function so - ** this implementation is provided as an alternative. - ** - ** This NaN test sometimes fails if compiled on GCC with -ffast-math. - ** On the other hand, the use of -ffast-math comes with the following - ** warning: - ** - ** This option [-ffast-math] should never be turned on by any - ** -O option since it can result in incorrect output for programs - ** which depend on an exact implementation of IEEE or ISO - ** rules/specifications for math functions. - ** - ** Under MSVC, this NaN test may fail if compiled with a floating- - ** point precision mode other than /fp:precise. From the MSDN - ** documentation: - ** - ** The compiler [with /fp:precise] will properly handle comparisons - ** involving NaN. For example, x != x evaluates to true if x is NaN - ** ... - */ -#ifdef __FAST_MATH__ -# error SQLite will not work correctly with the -ffast-math option of GCC. -#endif - volatile double y = x; - volatile double z = y; - rc = (y!=z); -#else /* if defined(SQLITE_HAVE_ISNAN) */ - rc = isnan(x); -#endif /* SQLITE_HAVE_ISNAN */ - testcase( rc ); - return rc; -} -#endif /* SQLITE_OMIT_FLOATING_POINT */ - -/* -** Compute a string length that is limited to what can be stored in -** lower 30 bits of a 32-bit signed integer. -** -** The value returned will never be negative. Nor will it ever be greater -** than the actual length of the string. For very long strings (greater -** than 1GiB) the value returned might be less than the true string length. -*/ -SQLITE_PRIVATE int sqlite3Strlen30(const char *z){ - const char *z2 = z; - if( z==0 ) return 0; - while( *z2 ){ z2++; } - return 0x3fffffff & (int)(z2 - z); -} - -/* -** Set the most recent error code and error string for the sqlite -** handle "db". The error code is set to "err_code". -** -** If it is not NULL, string zFormat specifies the format of the -** error string in the style of the printf functions: The following -** format characters are allowed: -** -** %s Insert a string -** %z A string that should be freed after use -** %d Insert an integer -** %T Insert a token -** %S Insert the first element of a SrcList -** -** zFormat and any string tokens that follow it are assumed to be -** encoded in UTF-8. -** -** To clear the most recent error for sqlite handle "db", sqlite3Error -** should be called with err_code set to SQLITE_OK and zFormat set -** to NULL. -*/ -SQLITE_PRIVATE void sqlite3Error(sqlite3 *db, int err_code, const char *zFormat, ...){ - assert( db!=0 ); - db->errCode = err_code; - if( zFormat && (db->pErr || (db->pErr = sqlite3ValueNew(db))!=0) ){ - char *z; - va_list ap; - va_start(ap, zFormat); - z = sqlite3VMPrintf(db, zFormat, ap); - va_end(ap); - sqlite3ValueSetStr(db->pErr, -1, z, SQLITE_UTF8, SQLITE_DYNAMIC); - }else if( db->pErr ){ - sqlite3ValueSetNull(db->pErr); - } -} - -/* -** Add an error message to pParse->zErrMsg and increment pParse->nErr. -** The following formatting characters are allowed: -** -** %s Insert a string -** %z A string that should be freed after use -** %d Insert an integer -** %T Insert a token -** %S Insert the first element of a SrcList -** -** This function should be used to report any error that occurs whilst -** compiling an SQL statement (i.e. within sqlite3_prepare()). The -** last thing the sqlite3_prepare() function does is copy the error -** stored by this function into the database handle using sqlite3Error(). -** Function sqlite3Error() should be used during statement execution -** (sqlite3_step() etc.). -*/ -SQLITE_PRIVATE void sqlite3ErrorMsg(Parse *pParse, const char *zFormat, ...){ - char *zMsg; - va_list ap; - sqlite3 *db = pParse->db; - va_start(ap, zFormat); - zMsg = sqlite3VMPrintf(db, zFormat, ap); - va_end(ap); - if( db->suppressErr ){ - sqlite3DbFree(db, zMsg); - }else{ - pParse->nErr++; - sqlite3DbFree(db, pParse->zErrMsg); - pParse->zErrMsg = zMsg; - pParse->rc = SQLITE_ERROR; - } -} - -/* -** Convert an SQL-style quoted string into a normal string by removing -** the quote characters. The conversion is done in-place. If the -** input does not begin with a quote character, then this routine -** is a no-op. -** -** The input string must be zero-terminated. A new zero-terminator -** is added to the dequoted string. -** -** The return value is -1 if no dequoting occurs or the length of the -** dequoted string, exclusive of the zero terminator, if dequoting does -** occur. -** -** 2002-Feb-14: This routine is extended to remove MS-Access style -** brackets from around identifers. For example: "[a-b-c]" becomes -** "a-b-c". -*/ -SQLITE_PRIVATE int sqlite3Dequote(char *z){ - char quote; - int i, j; - if( z==0 ) return -1; - quote = z[0]; - switch( quote ){ - case '\'': break; - case '"': break; - case '`': break; /* For MySQL compatibility */ - case '[': quote = ']'; break; /* For MS SqlServer compatibility */ - default: return -1; - } - for(i=1, j=0;; i++){ - assert( z[i] ); - if( z[i]==quote ){ - if( z[i+1]==quote ){ - z[j++] = quote; - i++; - }else{ - break; - } - }else{ - z[j++] = z[i]; - } - } - z[j] = 0; - return j; -} - -/* Convenient short-hand */ -#define UpperToLower sqlite3UpperToLower - -/* -** Some systems have stricmp(). Others have strcasecmp(). Because -** there is no consistency, we will define our own. -** -** IMPLEMENTATION-OF: R-30243-02494 The sqlite3_stricmp() and -** sqlite3_strnicmp() APIs allow applications and extensions to compare -** the contents of two buffers containing UTF-8 strings in a -** case-independent fashion, using the same definition of "case -** independence" that SQLite uses internally when comparing identifiers. -*/ -SQLITE_API int sqlite3_stricmp(const char *zLeft, const char *zRight){ - register unsigned char *a, *b; - a = (unsigned char *)zLeft; - b = (unsigned char *)zRight; - while( *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; } - return UpperToLower[*a] - UpperToLower[*b]; -} -SQLITE_API int sqlite3_strnicmp(const char *zLeft, const char *zRight, int N){ - register unsigned char *a, *b; - a = (unsigned char *)zLeft; - b = (unsigned char *)zRight; - while( N-- > 0 && *a!=0 && UpperToLower[*a]==UpperToLower[*b]){ a++; b++; } - return N<0 ? 0 : UpperToLower[*a] - UpperToLower[*b]; -} - -/* -** The string z[] is an text representation of a real number. -** Convert this string to a double and write it into *pResult. -** -** The string z[] is length bytes in length (bytes, not characters) and -** uses the encoding enc. The string is not necessarily zero-terminated. -** -** Return TRUE if the result is a valid real number (or integer) and FALSE -** if the string is empty or contains extraneous text. Valid numbers -** are in one of these formats: -** -** [+-]digits[E[+-]digits] -** [+-]digits.[digits][E[+-]digits] -** [+-].digits[E[+-]digits] -** -** Leading and trailing whitespace is ignored for the purpose of determining -** validity. -** -** If some prefix of the input string is a valid number, this routine -** returns FALSE but it still converts the prefix and writes the result -** into *pResult. -*/ -SQLITE_PRIVATE int sqlite3AtoF(const char *z, double *pResult, int length, u8 enc){ -#ifndef SQLITE_OMIT_FLOATING_POINT - int incr; - const char *zEnd = z + length; - /* sign * significand * (10 ^ (esign * exponent)) */ - int sign = 1; /* sign of significand */ - i64 s = 0; /* significand */ - int d = 0; /* adjust exponent for shifting decimal point */ - int esign = 1; /* sign of exponent */ - int e = 0; /* exponent */ - int eValid = 1; /* True exponent is either not used or is well-formed */ - double result; - int nDigits = 0; - int nonNum = 0; - - assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE ); - *pResult = 0.0; /* Default return value, in case of an error */ - - if( enc==SQLITE_UTF8 ){ - incr = 1; - }else{ - int i; - incr = 2; - assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 ); - for(i=3-enc; i=zEnd ) return 0; - - /* get sign of significand */ - if( *z=='-' ){ - sign = -1; - z+=incr; - }else if( *z=='+' ){ - z+=incr; - } - - /* skip leading zeroes */ - while( z=zEnd ) goto do_atof_calc; - - /* if decimal point is present */ - if( *z=='.' ){ - z+=incr; - /* copy digits from after decimal to significand - ** (decrease exponent by d to shift decimal right) */ - while( z=zEnd ) goto do_atof_calc; - - /* if exponent is present */ - if( *z=='e' || *z=='E' ){ - z+=incr; - eValid = 0; - if( z>=zEnd ) goto do_atof_calc; - /* get sign of exponent */ - if( *z=='-' ){ - esign = -1; - z+=incr; - }else if( *z=='+' ){ - z+=incr; - } - /* copy digits to exponent */ - while( z0 ){ - while( s<(LARGEST_INT64/10) && e>0 ) e--,s*=10; - }else{ - while( !(s%10) && e>0 ) e--,s/=10; - } - - /* adjust the sign of significand */ - s = sign<0 ? -s : s; - - /* if exponent, scale significand as appropriate - ** and store in result. */ - if( e ){ - LONGDOUBLE_TYPE scale = 1.0; -#ifndef __vax__ - /* attempt to handle extremely small/large numbers better */ - if( e>307 && e<342 ){ - while( e%308 ) { scale *= 1.0e+1; e -= 1; } - if( esign<0 ){ - result = s / scale; - result /= SQLITE_HUGE_DBL; - }else{ - result = s * scale; - result *= SQLITE_HUGE_DBL; - } - }else if( e>=342 ){ - if( esign<0 ){ - result = 0.0*s; - }else{ - result = SQLITE_HUGE_DBL*SQLITE_HUGE_DBL*s; /* Infinity */ - } - }else -#endif - { - /* 1.0e+22 is the largest power of 10 than can be - ** represented exactly. */ - while( e%22 ) { scale *= 1.0e+1; e -= 1; } - while( e>0 ) { scale *= 1.0e+22; e -= 22; } - if( esign<0 ){ - result = s / scale; - }else{ - result = s * scale; - } - } - } else { - result = (double)s; - } - } - - /* store the result */ - *pResult = result; - - /* return true if number and no extra non-whitespace chracters after */ - return z>=zEnd && nDigits>0 && eValid && nonNum==0; -#else - return !sqlite3Atoi64(z, pResult, length, enc); -#endif /* SQLITE_OMIT_FLOATING_POINT */ -} - -/* -** Compare the 19-character string zNum against the text representation -** value 2^63: 9223372036854775808. Return negative, zero, or positive -** if zNum is less than, equal to, or greater than the string. -** Note that zNum must contain exactly 19 characters. -** -** Unlike memcmp() this routine is guaranteed to return the difference -** in the values of the last digit if the only difference is in the -** last digit. So, for example, -** -** compare2pow63("9223372036854775800", 1) -** -** will return -8. -*/ -static int compare2pow63(const char *zNum, int incr){ - int c = 0; - int i; - /* 012345678901234567 */ - const char *pow63 = "922337203685477580"; - for(i=0; c==0 && i<18; i++){ - c = (zNum[i*incr]-pow63[i])*10; - } - if( c==0 ){ - c = zNum[18*incr] - '8'; - testcase( c==(-1) ); - testcase( c==0 ); - testcase( c==(+1) ); - } - return c; -} - - -/* -** Convert zNum to a 64-bit signed integer. -** -** If the zNum value is representable as a 64-bit twos-complement -** integer, then write that value into *pNum and return 0. -** -** If zNum is exactly 9223372036854775808, return 2. This special -** case is broken out because while 9223372036854775808 cannot be a -** signed 64-bit integer, its negative -9223372036854775808 can be. -** -** If zNum is too big for a 64-bit integer and is not -** 9223372036854775808 or if zNum contains any non-numeric text, -** then return 1. -** -** length is the number of bytes in the string (bytes, not characters). -** The string is not necessarily zero-terminated. The encoding is -** given by enc. -*/ -SQLITE_PRIVATE int sqlite3Atoi64(const char *zNum, i64 *pNum, int length, u8 enc){ - int incr; - u64 u = 0; - int neg = 0; /* assume positive */ - int i; - int c = 0; - int nonNum = 0; - const char *zStart; - const char *zEnd = zNum + length; - assert( enc==SQLITE_UTF8 || enc==SQLITE_UTF16LE || enc==SQLITE_UTF16BE ); - if( enc==SQLITE_UTF8 ){ - incr = 1; - }else{ - incr = 2; - assert( SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 ); - for(i=3-enc; i='0' && c<='9'; i+=incr){ - u = u*10 + c - '0'; - } - if( u>LARGEST_INT64 ){ - *pNum = neg ? SMALLEST_INT64 : LARGEST_INT64; - }else if( neg ){ - *pNum = -(i64)u; - }else{ - *pNum = (i64)u; - } - testcase( i==18 ); - testcase( i==19 ); - testcase( i==20 ); - if( (c!=0 && &zNum[i]19*incr || nonNum ){ - /* zNum is empty or contains non-numeric text or is longer - ** than 19 digits (thus guaranteeing that it is too large) */ - return 1; - }else if( i<19*incr ){ - /* Less than 19 digits, so we know that it fits in 64 bits */ - assert( u<=LARGEST_INT64 ); - return 0; - }else{ - /* zNum is a 19-digit numbers. Compare it against 9223372036854775808. */ - c = compare2pow63(zNum, incr); - if( c<0 ){ - /* zNum is less than 9223372036854775808 so it fits */ - assert( u<=LARGEST_INT64 ); - return 0; - }else if( c>0 ){ - /* zNum is greater than 9223372036854775808 so it overflows */ - return 1; - }else{ - /* zNum is exactly 9223372036854775808. Fits if negative. The - ** special case 2 overflow if positive */ - assert( u-1==LARGEST_INT64 ); - return neg ? 0 : 2; - } - } -} - -/* -** If zNum represents an integer that will fit in 32-bits, then set -** *pValue to that integer and return true. Otherwise return false. -** -** Any non-numeric characters that following zNum are ignored. -** This is different from sqlite3Atoi64() which requires the -** input number to be zero-terminated. -*/ -SQLITE_PRIVATE int sqlite3GetInt32(const char *zNum, int *pValue){ - sqlite_int64 v = 0; - int i, c; - int neg = 0; - if( zNum[0]=='-' ){ - neg = 1; - zNum++; - }else if( zNum[0]=='+' ){ - zNum++; - } - while( zNum[0]=='0' ) zNum++; - for(i=0; i<11 && (c = zNum[i] - '0')>=0 && c<=9; i++){ - v = v*10 + c; - } - - /* The longest decimal representation of a 32 bit integer is 10 digits: - ** - ** 1234567890 - ** 2^31 -> 2147483648 - */ - testcase( i==10 ); - if( i>10 ){ - return 0; - } - testcase( v-neg==2147483647 ); - if( v-neg>2147483647 ){ - return 0; - } - if( neg ){ - v = -v; - } - *pValue = (int)v; - return 1; -} - -/* -** Return a 32-bit integer value extracted from a string. If the -** string is not an integer, just return 0. -*/ -SQLITE_PRIVATE int sqlite3Atoi(const char *z){ - int x = 0; - if( z ) sqlite3GetInt32(z, &x); - return x; -} - -/* -** The variable-length integer encoding is as follows: -** -** KEY: -** A = 0xxxxxxx 7 bits of data and one flag bit -** B = 1xxxxxxx 7 bits of data and one flag bit -** C = xxxxxxxx 8 bits of data -** -** 7 bits - A -** 14 bits - BA -** 21 bits - BBA -** 28 bits - BBBA -** 35 bits - BBBBA -** 42 bits - BBBBBA -** 49 bits - BBBBBBA -** 56 bits - BBBBBBBA -** 64 bits - BBBBBBBBC -*/ - -/* -** Write a 64-bit variable-length integer to memory starting at p[0]. -** The length of data write will be between 1 and 9 bytes. The number -** of bytes written is returned. -** -** A variable-length integer consists of the lower 7 bits of each byte -** for all bytes that have the 8th bit set and one byte with the 8th -** bit clear. Except, if we get to the 9th byte, it stores the full -** 8 bits and is the last byte. -*/ -SQLITE_PRIVATE int sqlite3PutVarint(unsigned char *p, u64 v){ - int i, j, n; - u8 buf[10]; - if( v & (((u64)0xff000000)<<32) ){ - p[8] = (u8)v; - v >>= 8; - for(i=7; i>=0; i--){ - p[i] = (u8)((v & 0x7f) | 0x80); - v >>= 7; - } - return 9; - } - n = 0; - do{ - buf[n++] = (u8)((v & 0x7f) | 0x80); - v >>= 7; - }while( v!=0 ); - buf[0] &= 0x7f; - assert( n<=9 ); - for(i=0, j=n-1; j>=0; j--, i++){ - p[i] = buf[j]; - } - return n; -} - -/* -** This routine is a faster version of sqlite3PutVarint() that only -** works for 32-bit positive integers and which is optimized for -** the common case of small integers. A MACRO version, putVarint32, -** is provided which inlines the single-byte case. All code should use -** the MACRO version as this function assumes the single-byte case has -** already been handled. -*/ -SQLITE_PRIVATE int sqlite3PutVarint32(unsigned char *p, u32 v){ -#ifndef putVarint32 - if( (v & ~0x7f)==0 ){ - p[0] = v; - return 1; - } -#endif - if( (v & ~0x3fff)==0 ){ - p[0] = (u8)((v>>7) | 0x80); - p[1] = (u8)(v & 0x7f); - return 2; - } - return sqlite3PutVarint(p, v); -} - -/* -** Bitmasks used by sqlite3GetVarint(). These precomputed constants -** are defined here rather than simply putting the constant expressions -** inline in order to work around bugs in the RVT compiler. -** -** SLOT_2_0 A mask for (0x7f<<14) | 0x7f -** -** SLOT_4_2_0 A mask for (0x7f<<28) | SLOT_2_0 -*/ -#define SLOT_2_0 0x001fc07f -#define SLOT_4_2_0 0xf01fc07f - - -/* -** Read a 64-bit variable-length integer from memory starting at p[0]. -** Return the number of bytes read. The value is stored in *v. -*/ -SQLITE_PRIVATE u8 sqlite3GetVarint(const unsigned char *p, u64 *v){ - u32 a,b,s; - - a = *p; - /* a: p0 (unmasked) */ - if (!(a&0x80)) - { - *v = a; - return 1; - } - - p++; - b = *p; - /* b: p1 (unmasked) */ - if (!(b&0x80)) - { - a &= 0x7f; - a = a<<7; - a |= b; - *v = a; - return 2; - } - - /* Verify that constants are precomputed correctly */ - assert( SLOT_2_0 == ((0x7f<<14) | (0x7f)) ); - assert( SLOT_4_2_0 == ((0xfU<<28) | (0x7f<<14) | (0x7f)) ); - - p++; - a = a<<14; - a |= *p; - /* a: p0<<14 | p2 (unmasked) */ - if (!(a&0x80)) - { - a &= SLOT_2_0; - b &= 0x7f; - b = b<<7; - a |= b; - *v = a; - return 3; - } - - /* CSE1 from below */ - a &= SLOT_2_0; - p++; - b = b<<14; - b |= *p; - /* b: p1<<14 | p3 (unmasked) */ - if (!(b&0x80)) - { - b &= SLOT_2_0; - /* moved CSE1 up */ - /* a &= (0x7f<<14)|(0x7f); */ - a = a<<7; - a |= b; - *v = a; - return 4; - } - - /* a: p0<<14 | p2 (masked) */ - /* b: p1<<14 | p3 (unmasked) */ - /* 1:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */ - /* moved CSE1 up */ - /* a &= (0x7f<<14)|(0x7f); */ - b &= SLOT_2_0; - s = a; - /* s: p0<<14 | p2 (masked) */ - - p++; - a = a<<14; - a |= *p; - /* a: p0<<28 | p2<<14 | p4 (unmasked) */ - if (!(a&0x80)) - { - /* we can skip these cause they were (effectively) done above in calc'ing s */ - /* a &= (0x7f<<28)|(0x7f<<14)|(0x7f); */ - /* b &= (0x7f<<14)|(0x7f); */ - b = b<<7; - a |= b; - s = s>>18; - *v = ((u64)s)<<32 | a; - return 5; - } - - /* 2:save off p0<<21 | p1<<14 | p2<<7 | p3 (masked) */ - s = s<<7; - s |= b; - /* s: p0<<21 | p1<<14 | p2<<7 | p3 (masked) */ - - p++; - b = b<<14; - b |= *p; - /* b: p1<<28 | p3<<14 | p5 (unmasked) */ - if (!(b&0x80)) - { - /* we can skip this cause it was (effectively) done above in calc'ing s */ - /* b &= (0x7f<<28)|(0x7f<<14)|(0x7f); */ - a &= SLOT_2_0; - a = a<<7; - a |= b; - s = s>>18; - *v = ((u64)s)<<32 | a; - return 6; - } - - p++; - a = a<<14; - a |= *p; - /* a: p2<<28 | p4<<14 | p6 (unmasked) */ - if (!(a&0x80)) - { - a &= SLOT_4_2_0; - b &= SLOT_2_0; - b = b<<7; - a |= b; - s = s>>11; - *v = ((u64)s)<<32 | a; - return 7; - } - - /* CSE2 from below */ - a &= SLOT_2_0; - p++; - b = b<<14; - b |= *p; - /* b: p3<<28 | p5<<14 | p7 (unmasked) */ - if (!(b&0x80)) - { - b &= SLOT_4_2_0; - /* moved CSE2 up */ - /* a &= (0x7f<<14)|(0x7f); */ - a = a<<7; - a |= b; - s = s>>4; - *v = ((u64)s)<<32 | a; - return 8; - } - - p++; - a = a<<15; - a |= *p; - /* a: p4<<29 | p6<<15 | p8 (unmasked) */ - - /* moved CSE2 up */ - /* a &= (0x7f<<29)|(0x7f<<15)|(0xff); */ - b &= SLOT_2_0; - b = b<<8; - a |= b; - - s = s<<4; - b = p[-4]; - b &= 0x7f; - b = b>>3; - s |= b; - - *v = ((u64)s)<<32 | a; - - return 9; -} - -/* -** Read a 32-bit variable-length integer from memory starting at p[0]. -** Return the number of bytes read. The value is stored in *v. -** -** If the varint stored in p[0] is larger than can fit in a 32-bit unsigned -** integer, then set *v to 0xffffffff. -** -** A MACRO version, getVarint32, is provided which inlines the -** single-byte case. All code should use the MACRO version as -** this function assumes the single-byte case has already been handled. -*/ -SQLITE_PRIVATE u8 sqlite3GetVarint32(const unsigned char *p, u32 *v){ - u32 a,b; - - /* The 1-byte case. Overwhelmingly the most common. Handled inline - ** by the getVarin32() macro */ - a = *p; - /* a: p0 (unmasked) */ -#ifndef getVarint32 - if (!(a&0x80)) - { - /* Values between 0 and 127 */ - *v = a; - return 1; - } -#endif - - /* The 2-byte case */ - p++; - b = *p; - /* b: p1 (unmasked) */ - if (!(b&0x80)) - { - /* Values between 128 and 16383 */ - a &= 0x7f; - a = a<<7; - *v = a | b; - return 2; - } - - /* The 3-byte case */ - p++; - a = a<<14; - a |= *p; - /* a: p0<<14 | p2 (unmasked) */ - if (!(a&0x80)) - { - /* Values between 16384 and 2097151 */ - a &= (0x7f<<14)|(0x7f); - b &= 0x7f; - b = b<<7; - *v = a | b; - return 3; - } - - /* A 32-bit varint is used to store size information in btrees. - ** Objects are rarely larger than 2MiB limit of a 3-byte varint. - ** A 3-byte varint is sufficient, for example, to record the size - ** of a 1048569-byte BLOB or string. - ** - ** We only unroll the first 1-, 2-, and 3- byte cases. The very - ** rare larger cases can be handled by the slower 64-bit varint - ** routine. - */ -#if 1 - { - u64 v64; - u8 n; - - p -= 2; - n = sqlite3GetVarint(p, &v64); - assert( n>3 && n<=9 ); - if( (v64 & SQLITE_MAX_U32)!=v64 ){ - *v = 0xffffffff; - }else{ - *v = (u32)v64; - } - return n; - } - -#else - /* For following code (kept for historical record only) shows an - ** unrolling for the 3- and 4-byte varint cases. This code is - ** slightly faster, but it is also larger and much harder to test. - */ - p++; - b = b<<14; - b |= *p; - /* b: p1<<14 | p3 (unmasked) */ - if (!(b&0x80)) - { - /* Values between 2097152 and 268435455 */ - b &= (0x7f<<14)|(0x7f); - a &= (0x7f<<14)|(0x7f); - a = a<<7; - *v = a | b; - return 4; - } - - p++; - a = a<<14; - a |= *p; - /* a: p0<<28 | p2<<14 | p4 (unmasked) */ - if (!(a&0x80)) - { - /* Values between 268435456 and 34359738367 */ - a &= SLOT_4_2_0; - b &= SLOT_4_2_0; - b = b<<7; - *v = a | b; - return 5; - } - - /* We can only reach this point when reading a corrupt database - ** file. In that case we are not in any hurry. Use the (relatively - ** slow) general-purpose sqlite3GetVarint() routine to extract the - ** value. */ - { - u64 v64; - u8 n; - - p -= 4; - n = sqlite3GetVarint(p, &v64); - assert( n>5 && n<=9 ); - *v = (u32)v64; - return n; - } -#endif -} - -/* -** Return the number of bytes that will be needed to store the given -** 64-bit integer. -*/ -SQLITE_PRIVATE int sqlite3VarintLen(u64 v){ - int i = 0; - do{ - i++; - v >>= 7; - }while( v!=0 && ALWAYS(i<9) ); - return i; -} - - -/* -** Read or write a four-byte big-endian integer value. -*/ -SQLITE_PRIVATE u32 sqlite3Get4byte(const u8 *p){ - testcase( p[0]&0x80 ); - return ((unsigned)p[0]<<24) | (p[1]<<16) | (p[2]<<8) | p[3]; -} -SQLITE_PRIVATE void sqlite3Put4byte(unsigned char *p, u32 v){ - p[0] = (u8)(v>>24); - p[1] = (u8)(v>>16); - p[2] = (u8)(v>>8); - p[3] = (u8)v; -} - - - -/* -** Translate a single byte of Hex into an integer. -** This routine only works if h really is a valid hexadecimal -** character: 0..9a..fA..F -*/ -SQLITE_PRIVATE u8 sqlite3HexToInt(int h){ - assert( (h>='0' && h<='9') || (h>='a' && h<='f') || (h>='A' && h<='F') ); -#ifdef SQLITE_ASCII - h += 9*(1&(h>>6)); -#endif -#ifdef SQLITE_EBCDIC - h += 9*(1&~(h>>4)); -#endif - return (u8)(h & 0xf); -} - -#if !defined(SQLITE_OMIT_BLOB_LITERAL) || defined(SQLITE_HAS_CODEC) -/* -** Convert a BLOB literal of the form "x'hhhhhh'" into its binary -** value. Return a pointer to its binary value. Space to hold the -** binary value has been obtained from malloc and must be freed by -** the calling routine. -*/ -SQLITE_PRIVATE void *sqlite3HexToBlob(sqlite3 *db, const char *z, int n){ - char *zBlob; - int i; - - zBlob = (char *)sqlite3DbMallocRaw(db, n/2 + 1); - n--; - if( zBlob ){ - for(i=0; imagic; - if( magic!=SQLITE_MAGIC_OPEN ){ - if( sqlite3SafetyCheckSickOrOk(db) ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - logBadConnection("unopened"); - } - return 0; - }else{ - return 1; - } -} -SQLITE_PRIVATE int sqlite3SafetyCheckSickOrOk(sqlite3 *db){ - u32 magic; - magic = db->magic; - if( magic!=SQLITE_MAGIC_SICK && - magic!=SQLITE_MAGIC_OPEN && - magic!=SQLITE_MAGIC_BUSY ){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - logBadConnection("invalid"); - return 0; - }else{ - return 1; - } -} - -/* -** Attempt to add, substract, or multiply the 64-bit signed value iB against -** the other 64-bit signed integer at *pA and store the result in *pA. -** Return 0 on success. Or if the operation would have resulted in an -** overflow, leave *pA unchanged and return 1. -*/ -SQLITE_PRIVATE int sqlite3AddInt64(i64 *pA, i64 iB){ - i64 iA = *pA; - testcase( iA==0 ); testcase( iA==1 ); - testcase( iB==-1 ); testcase( iB==0 ); - if( iB>=0 ){ - testcase( iA>0 && LARGEST_INT64 - iA == iB ); - testcase( iA>0 && LARGEST_INT64 - iA == iB - 1 ); - if( iA>0 && LARGEST_INT64 - iA < iB ) return 1; - *pA += iB; - }else{ - testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 1 ); - testcase( iA<0 && -(iA + LARGEST_INT64) == iB + 2 ); - if( iA<0 && -(iA + LARGEST_INT64) > iB + 1 ) return 1; - *pA += iB; - } - return 0; -} -SQLITE_PRIVATE int sqlite3SubInt64(i64 *pA, i64 iB){ - testcase( iB==SMALLEST_INT64+1 ); - if( iB==SMALLEST_INT64 ){ - testcase( (*pA)==(-1) ); testcase( (*pA)==0 ); - if( (*pA)>=0 ) return 1; - *pA -= iB; - return 0; - }else{ - return sqlite3AddInt64(pA, -iB); - } -} -#define TWOPOWER32 (((i64)1)<<32) -#define TWOPOWER31 (((i64)1)<<31) -SQLITE_PRIVATE int sqlite3MulInt64(i64 *pA, i64 iB){ - i64 iA = *pA; - i64 iA1, iA0, iB1, iB0, r; - - iA1 = iA/TWOPOWER32; - iA0 = iA % TWOPOWER32; - iB1 = iB/TWOPOWER32; - iB0 = iB % TWOPOWER32; - if( iA1*iB1 != 0 ) return 1; - assert( iA1*iB0==0 || iA0*iB1==0 ); - r = iA1*iB0 + iA0*iB1; - testcase( r==(-TWOPOWER31)-1 ); - testcase( r==(-TWOPOWER31) ); - testcase( r==TWOPOWER31 ); - testcase( r==TWOPOWER31-1 ); - if( r<(-TWOPOWER31) || r>=TWOPOWER31 ) return 1; - r *= TWOPOWER32; - if( sqlite3AddInt64(&r, iA0*iB0) ) return 1; - *pA = r; - return 0; -} - -/* -** Compute the absolute value of a 32-bit signed integer, of possible. Or -** if the integer has a value of -2147483648, return +2147483647 -*/ -SQLITE_PRIVATE int sqlite3AbsInt32(int x){ - if( x>=0 ) return x; - if( x==(int)0x80000000 ) return 0x7fffffff; - return -x; -} - -#ifdef SQLITE_ENABLE_8_3_NAMES -/* -** If SQLITE_ENABLE_8_3_NAMES is set at compile-time and if the database -** filename in zBaseFilename is a URI with the "8_3_names=1" parameter and -** if filename in z[] has a suffix (a.k.a. "extension") that is longer than -** three characters, then shorten the suffix on z[] to be the last three -** characters of the original suffix. -** -** If SQLITE_ENABLE_8_3_NAMES is set to 2 at compile-time, then always -** do the suffix shortening regardless of URI parameter. -** -** Examples: -** -** test.db-journal => test.nal -** test.db-wal => test.wal -** test.db-shm => test.shm -** test.db-mj7f3319fa => test.9fa -*/ -SQLITE_PRIVATE void sqlite3FileSuffix3(const char *zBaseFilename, char *z){ -#if SQLITE_ENABLE_8_3_NAMES<2 - if( sqlite3_uri_boolean(zBaseFilename, "8_3_names", 0) ) -#endif - { - int i, sz; - sz = sqlite3Strlen30(z); - for(i=sz-1; i>0 && z[i]!='/' && z[i]!='.'; i--){} - if( z[i]=='.' && ALWAYS(sz>i+4) ) memmove(&z[i+1], &z[sz-3], 4); - } -} -#endif - -/* -** Find (an approximate) sum of two LogEst values. This computation is -** not a simple "+" operator because LogEst is stored as a logarithmic -** value. -** -*/ -SQLITE_PRIVATE LogEst sqlite3LogEstAdd(LogEst a, LogEst b){ - static const unsigned char x[] = { - 10, 10, /* 0,1 */ - 9, 9, /* 2,3 */ - 8, 8, /* 4,5 */ - 7, 7, 7, /* 6,7,8 */ - 6, 6, 6, /* 9,10,11 */ - 5, 5, 5, /* 12-14 */ - 4, 4, 4, 4, /* 15-18 */ - 3, 3, 3, 3, 3, 3, /* 19-24 */ - 2, 2, 2, 2, 2, 2, 2, /* 25-31 */ - }; - if( a>=b ){ - if( a>b+49 ) return a; - if( a>b+31 ) return a+1; - return a+x[a-b]; - }else{ - if( b>a+49 ) return b; - if( b>a+31 ) return b+1; - return b+x[b-a]; - } -} - -/* -** Convert an integer into a LogEst. In other words, compute a -** good approximatation for 10*log2(x). -*/ -SQLITE_PRIVATE LogEst sqlite3LogEst(u64 x){ - static LogEst a[] = { 0, 2, 3, 5, 6, 7, 8, 9 }; - LogEst y = 40; - if( x<8 ){ - if( x<2 ) return 0; - while( x<8 ){ y -= 10; x <<= 1; } - }else{ - while( x>255 ){ y += 40; x >>= 4; } - while( x>15 ){ y += 10; x >>= 1; } - } - return a[x&7] + y - 10; -} - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* -** Convert a double into a LogEst -** In other words, compute an approximation for 10*log2(x). -*/ -SQLITE_PRIVATE LogEst sqlite3LogEstFromDouble(double x){ - u64 a; - LogEst e; - assert( sizeof(x)==8 && sizeof(a)==8 ); - if( x<=1 ) return 0; - if( x<=2000000000 ) return sqlite3LogEst((u64)x); - memcpy(&a, &x, 8); - e = (a>>52) - 1022; - return e*10; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/* -** Convert a LogEst into an integer. -*/ -SQLITE_PRIVATE u64 sqlite3LogEstToInt(LogEst x){ - u64 n; - if( x<10 ) return 1; - n = x%10; - x /= 10; - if( n>=5 ) n -= 2; - else if( n>=1 ) n -= 1; - if( x>=3 ){ - return x>60 ? (u64)LARGEST_INT64 : (n+8)<<(x-3); - } - return (n+8)>>(3-x); -} - -/************** End of util.c ************************************************/ -/************** Begin file hash.c ********************************************/ -/* -** 2001 September 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This is the implementation of generic hash-tables -** used in SQLite. -*/ -/* #include */ - -/* Turn bulk memory into a hash table object by initializing the -** fields of the Hash structure. -** -** "pNew" is a pointer to the hash table that is to be initialized. -*/ -SQLITE_PRIVATE void sqlite3HashInit(Hash *pNew){ - assert( pNew!=0 ); - pNew->first = 0; - pNew->count = 0; - pNew->htsize = 0; - pNew->ht = 0; -} - -/* Remove all entries from a hash table. Reclaim all memory. -** Call this routine to delete a hash table or to reset a hash table -** to the empty state. -*/ -SQLITE_PRIVATE void sqlite3HashClear(Hash *pH){ - HashElem *elem; /* For looping over all elements of the table */ - - assert( pH!=0 ); - elem = pH->first; - pH->first = 0; - sqlite3_free(pH->ht); - pH->ht = 0; - pH->htsize = 0; - while( elem ){ - HashElem *next_elem = elem->next; - sqlite3_free(elem); - elem = next_elem; - } - pH->count = 0; -} - -/* -** The hashing function. -*/ -static unsigned int strHash(const char *z, int nKey){ - unsigned int h = 0; - assert( nKey>=0 ); - while( nKey > 0 ){ - h = (h<<3) ^ h ^ sqlite3UpperToLower[(unsigned char)*z++]; - nKey--; - } - return h; -} - - -/* Link pNew element into the hash table pH. If pEntry!=0 then also -** insert pNew into the pEntry hash bucket. -*/ -static void insertElement( - Hash *pH, /* The complete hash table */ - struct _ht *pEntry, /* The entry into which pNew is inserted */ - HashElem *pNew /* The element to be inserted */ -){ - HashElem *pHead; /* First element already in pEntry */ - if( pEntry ){ - pHead = pEntry->count ? pEntry->chain : 0; - pEntry->count++; - pEntry->chain = pNew; - }else{ - pHead = 0; - } - if( pHead ){ - pNew->next = pHead; - pNew->prev = pHead->prev; - if( pHead->prev ){ pHead->prev->next = pNew; } - else { pH->first = pNew; } - pHead->prev = pNew; - }else{ - pNew->next = pH->first; - if( pH->first ){ pH->first->prev = pNew; } - pNew->prev = 0; - pH->first = pNew; - } -} - - -/* Resize the hash table so that it cantains "new_size" buckets. -** -** The hash table might fail to resize if sqlite3_malloc() fails or -** if the new size is the same as the prior size. -** Return TRUE if the resize occurs and false if not. -*/ -static int rehash(Hash *pH, unsigned int new_size){ - struct _ht *new_ht; /* The new hash table */ - HashElem *elem, *next_elem; /* For looping over existing elements */ - -#if SQLITE_MALLOC_SOFT_LIMIT>0 - if( new_size*sizeof(struct _ht)>SQLITE_MALLOC_SOFT_LIMIT ){ - new_size = SQLITE_MALLOC_SOFT_LIMIT/sizeof(struct _ht); - } - if( new_size==pH->htsize ) return 0; -#endif - - /* The inability to allocates space for a larger hash table is - ** a performance hit but it is not a fatal error. So mark the - ** allocation as a benign. Use sqlite3Malloc()/memset(0) instead of - ** sqlite3MallocZero() to make the allocation, as sqlite3MallocZero() - ** only zeroes the requested number of bytes whereas this module will - ** use the actual amount of space allocated for the hash table (which - ** may be larger than the requested amount). - */ - sqlite3BeginBenignMalloc(); - new_ht = (struct _ht *)sqlite3Malloc( new_size*sizeof(struct _ht) ); - sqlite3EndBenignMalloc(); - - if( new_ht==0 ) return 0; - sqlite3_free(pH->ht); - pH->ht = new_ht; - pH->htsize = new_size = sqlite3MallocSize(new_ht)/sizeof(struct _ht); - memset(new_ht, 0, new_size*sizeof(struct _ht)); - for(elem=pH->first, pH->first=0; elem; elem = next_elem){ - unsigned int h = strHash(elem->pKey, elem->nKey) % new_size; - next_elem = elem->next; - insertElement(pH, &new_ht[h], elem); - } - return 1; -} - -/* This function (for internal use only) locates an element in an -** hash table that matches the given key. The hash for this key has -** already been computed and is passed as the 4th parameter. -*/ -static HashElem *findElementGivenHash( - const Hash *pH, /* The pH to be searched */ - const char *pKey, /* The key we are searching for */ - int nKey, /* Bytes in key (not counting zero terminator) */ - unsigned int h /* The hash for this key. */ -){ - HashElem *elem; /* Used to loop thru the element list */ - int count; /* Number of elements left to test */ - - if( pH->ht ){ - struct _ht *pEntry = &pH->ht[h]; - elem = pEntry->chain; - count = pEntry->count; - }else{ - elem = pH->first; - count = pH->count; - } - while( count-- && ALWAYS(elem) ){ - if( elem->nKey==nKey && sqlite3StrNICmp(elem->pKey,pKey,nKey)==0 ){ - return elem; - } - elem = elem->next; - } - return 0; -} - -/* Remove a single entry from the hash table given a pointer to that -** element and a hash on the element's key. -*/ -static void removeElementGivenHash( - Hash *pH, /* The pH containing "elem" */ - HashElem* elem, /* The element to be removed from the pH */ - unsigned int h /* Hash value for the element */ -){ - struct _ht *pEntry; - if( elem->prev ){ - elem->prev->next = elem->next; - }else{ - pH->first = elem->next; - } - if( elem->next ){ - elem->next->prev = elem->prev; - } - if( pH->ht ){ - pEntry = &pH->ht[h]; - if( pEntry->chain==elem ){ - pEntry->chain = elem->next; - } - pEntry->count--; - assert( pEntry->count>=0 ); - } - sqlite3_free( elem ); - pH->count--; - if( pH->count==0 ){ - assert( pH->first==0 ); - assert( pH->count==0 ); - sqlite3HashClear(pH); - } -} - -/* Attempt to locate an element of the hash table pH with a key -** that matches pKey,nKey. Return the data for this element if it is -** found, or NULL if there is no match. -*/ -SQLITE_PRIVATE void *sqlite3HashFind(const Hash *pH, const char *pKey, int nKey){ - HashElem *elem; /* The element that matches key */ - unsigned int h; /* A hash on key */ - - assert( pH!=0 ); - assert( pKey!=0 ); - assert( nKey>=0 ); - if( pH->ht ){ - h = strHash(pKey, nKey) % pH->htsize; - }else{ - h = 0; - } - elem = findElementGivenHash(pH, pKey, nKey, h); - return elem ? elem->data : 0; -} - -/* Insert an element into the hash table pH. The key is pKey,nKey -** and the data is "data". -** -** If no element exists with a matching key, then a new -** element is created and NULL is returned. -** -** If another element already exists with the same key, then the -** new data replaces the old data and the old data is returned. -** The key is not copied in this instance. If a malloc fails, then -** the new data is returned and the hash table is unchanged. -** -** If the "data" parameter to this function is NULL, then the -** element corresponding to "key" is removed from the hash table. -*/ -SQLITE_PRIVATE void *sqlite3HashInsert(Hash *pH, const char *pKey, int nKey, void *data){ - unsigned int h; /* the hash of the key modulo hash table size */ - HashElem *elem; /* Used to loop thru the element list */ - HashElem *new_elem; /* New element added to the pH */ - - assert( pH!=0 ); - assert( pKey!=0 ); - assert( nKey>=0 ); - if( pH->htsize ){ - h = strHash(pKey, nKey) % pH->htsize; - }else{ - h = 0; - } - elem = findElementGivenHash(pH,pKey,nKey,h); - if( elem ){ - void *old_data = elem->data; - if( data==0 ){ - removeElementGivenHash(pH,elem,h); - }else{ - elem->data = data; - elem->pKey = pKey; - assert(nKey==elem->nKey); - } - return old_data; - } - if( data==0 ) return 0; - new_elem = (HashElem*)sqlite3Malloc( sizeof(HashElem) ); - if( new_elem==0 ) return data; - new_elem->pKey = pKey; - new_elem->nKey = nKey; - new_elem->data = data; - pH->count++; - if( pH->count>=10 && pH->count > 2*pH->htsize ){ - if( rehash(pH, pH->count*2) ){ - assert( pH->htsize>0 ); - h = strHash(pKey, nKey) % pH->htsize; - } - } - if( pH->ht ){ - insertElement(pH, &pH->ht[h], new_elem); - }else{ - insertElement(pH, 0, new_elem); - } - return 0; -} - -/************** End of hash.c ************************************************/ -/************** Begin file opcodes.c *****************************************/ -/* Automatically generated. Do not edit */ -/* See the mkopcodec.awk script for details. */ -#if !defined(SQLITE_OMIT_EXPLAIN) || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG) -#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) || defined(SQLITE_DEBUG) -# define OpHelp(X) "\0" X -#else -# define OpHelp(X) -#endif -SQLITE_PRIVATE const char *sqlite3OpcodeName(int i){ - static const char *const azName[] = { "?", - /* 1 */ "Function" OpHelp("r[P3]=func(r[P2@P5])"), - /* 2 */ "Savepoint" OpHelp(""), - /* 3 */ "AutoCommit" OpHelp(""), - /* 4 */ "Transaction" OpHelp(""), - /* 5 */ "SorterNext" OpHelp(""), - /* 6 */ "PrevIfOpen" OpHelp(""), - /* 7 */ "NextIfOpen" OpHelp(""), - /* 8 */ "Prev" OpHelp(""), - /* 9 */ "Next" OpHelp(""), - /* 10 */ "AggStep" OpHelp("accum=r[P3] step(r[P2@P5])"), - /* 11 */ "Checkpoint" OpHelp(""), - /* 12 */ "JournalMode" OpHelp(""), - /* 13 */ "Vacuum" OpHelp(""), - /* 14 */ "VFilter" OpHelp("iPlan=r[P3] zPlan='P4'"), - /* 15 */ "VUpdate" OpHelp("data=r[P3@P2]"), - /* 16 */ "Goto" OpHelp(""), - /* 17 */ "Gosub" OpHelp(""), - /* 18 */ "Return" OpHelp(""), - /* 19 */ "Not" OpHelp("r[P2]= !r[P1]"), - /* 20 */ "Yield" OpHelp(""), - /* 21 */ "HaltIfNull" OpHelp("if r[P3] null then halt"), - /* 22 */ "Halt" OpHelp(""), - /* 23 */ "Integer" OpHelp("r[P2]=P1"), - /* 24 */ "Int64" OpHelp("r[P2]=P4"), - /* 25 */ "String" OpHelp("r[P2]='P4' (len=P1)"), - /* 26 */ "Null" OpHelp("r[P2..P3]=NULL"), - /* 27 */ "Blob" OpHelp("r[P2]=P4 (len=P1)"), - /* 28 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"), - /* 29 */ "Move" OpHelp("r[P2@P3]=r[P1@P3]"), - /* 30 */ "Copy" OpHelp("r[P2@P3+1]=r[P1@P3+1]"), - /* 31 */ "SCopy" OpHelp("r[P2]=r[P1]"), - /* 32 */ "ResultRow" OpHelp("output=r[P1@P2]"), - /* 33 */ "CollSeq" OpHelp(""), - /* 34 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"), - /* 35 */ "MustBeInt" OpHelp(""), - /* 36 */ "RealAffinity" OpHelp(""), - /* 37 */ "Permutation" OpHelp(""), - /* 38 */ "Compare" OpHelp(""), - /* 39 */ "Jump" OpHelp(""), - /* 40 */ "Once" OpHelp(""), - /* 41 */ "If" OpHelp(""), - /* 42 */ "IfNot" OpHelp(""), - /* 43 */ "Column" OpHelp("r[P3]=PX"), - /* 44 */ "Affinity" OpHelp("affinity(r[P1@P2])"), - /* 45 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1@P2])"), - /* 46 */ "Count" OpHelp("r[P2]=count()"), - /* 47 */ "ReadCookie" OpHelp(""), - /* 48 */ "SetCookie" OpHelp(""), - /* 49 */ "VerifyCookie" OpHelp(""), - /* 50 */ "OpenRead" OpHelp("root=P2 iDb=P3"), - /* 51 */ "OpenWrite" OpHelp("root=P2 iDb=P3"), - /* 52 */ "OpenAutoindex" OpHelp("nColumn=P2"), - /* 53 */ "OpenEphemeral" OpHelp("nColumn=P2"), - /* 54 */ "SorterOpen" OpHelp(""), - /* 55 */ "OpenPseudo" OpHelp("content in r[P2@P3]"), - /* 56 */ "Close" OpHelp(""), - /* 57 */ "SeekLt" OpHelp("key=r[P3@P4]"), - /* 58 */ "SeekLe" OpHelp("key=r[P3@P4]"), - /* 59 */ "SeekGe" OpHelp("key=r[P3@P4]"), - /* 60 */ "SeekGt" OpHelp("key=r[P3@P4]"), - /* 61 */ "Seek" OpHelp("intkey=r[P2]"), - /* 62 */ "NoConflict" OpHelp("key=r[P3@P4]"), - /* 63 */ "NotFound" OpHelp("key=r[P3@P4]"), - /* 64 */ "Found" OpHelp("key=r[P3@P4]"), - /* 65 */ "NotExists" OpHelp("intkey=r[P3]"), - /* 66 */ "Sequence" OpHelp("r[P2]=rowid"), - /* 67 */ "NewRowid" OpHelp("r[P2]=rowid"), - /* 68 */ "Insert" OpHelp("intkey=r[P3] data=r[P2]"), - /* 69 */ "InsertInt" OpHelp("intkey=P3 data=r[P2]"), - /* 70 */ "Delete" OpHelp(""), - /* 71 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"), - /* 72 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"), - /* 73 */ "ResetCount" OpHelp(""), - /* 74 */ "SorterCompare" OpHelp("if key(P1)!=rtrim(r[P3],P4) goto P2"), - /* 75 */ "SorterData" OpHelp("r[P2]=data"), - /* 76 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"), - /* 77 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"), - /* 78 */ "Ne" OpHelp("if r[P1]!=r[P3] goto P2"), - /* 79 */ "Eq" OpHelp("if r[P1]==r[P3] goto P2"), - /* 80 */ "Gt" OpHelp("if r[P1]>r[P3] goto P2"), - /* 81 */ "Le" OpHelp("if r[P1]<=r[P3] goto P2"), - /* 82 */ "Lt" OpHelp("if r[P1]=r[P3] goto P2"), - /* 84 */ "RowKey" OpHelp("r[P2]=key"), - /* 85 */ "BitAnd" OpHelp("r[P3]=r[P1]&r[P2]"), - /* 86 */ "BitOr" OpHelp("r[P3]=r[P1]|r[P2]"), - /* 87 */ "ShiftLeft" OpHelp("r[P3]=r[P2]<>r[P1]"), - /* 89 */ "Add" OpHelp("r[P3]=r[P1]+r[P2]"), - /* 90 */ "Subtract" OpHelp("r[P3]=r[P2]-r[P1]"), - /* 91 */ "Multiply" OpHelp("r[P3]=r[P1]*r[P2]"), - /* 92 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"), - /* 93 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"), - /* 94 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"), - /* 95 */ "RowData" OpHelp("r[P2]=data"), - /* 96 */ "BitNot" OpHelp("r[P1]= ~r[P1]"), - /* 97 */ "String8" OpHelp("r[P2]='P4'"), - /* 98 */ "Rowid" OpHelp("r[P2]=rowid"), - /* 99 */ "NullRow" OpHelp(""), - /* 100 */ "Last" OpHelp(""), - /* 101 */ "SorterSort" OpHelp(""), - /* 102 */ "Sort" OpHelp(""), - /* 103 */ "Rewind" OpHelp(""), - /* 104 */ "SorterInsert" OpHelp(""), - /* 105 */ "IdxInsert" OpHelp("key=r[P2]"), - /* 106 */ "IdxDelete" OpHelp("key=r[P2@P3]"), - /* 107 */ "IdxRowid" OpHelp("r[P2]=rowid"), - /* 108 */ "IdxLT" OpHelp("key=r[P3@P4]"), - /* 109 */ "IdxGE" OpHelp("key=r[P3@P4]"), - /* 110 */ "Destroy" OpHelp(""), - /* 111 */ "Clear" OpHelp(""), - /* 112 */ "CreateIndex" OpHelp("r[P2]=root iDb=P1"), - /* 113 */ "CreateTable" OpHelp("r[P2]=root iDb=P1"), - /* 114 */ "ParseSchema" OpHelp(""), - /* 115 */ "LoadAnalysis" OpHelp(""), - /* 116 */ "DropTable" OpHelp(""), - /* 117 */ "DropIndex" OpHelp(""), - /* 118 */ "DropTrigger" OpHelp(""), - /* 119 */ "IntegrityCk" OpHelp(""), - /* 120 */ "RowSetAdd" OpHelp("rowset(P1)=r[P2]"), - /* 121 */ "RowSetRead" OpHelp("r[P3]=rowset(P1)"), - /* 122 */ "RowSetTest" OpHelp("if r[P3] in rowset(P1) goto P2"), - /* 123 */ "Program" OpHelp(""), - /* 124 */ "Param" OpHelp(""), - /* 125 */ "FkCounter" OpHelp("fkctr[P1]+=P2"), - /* 126 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"), - /* 127 */ "MemMax" OpHelp("r[P1]=max(r[P1],r[P2])"), - /* 128 */ "IfPos" OpHelp("if r[P1]>0 goto P2"), - /* 129 */ "IfNeg" OpHelp("if r[P1]<0 goto P2"), - /* 130 */ "IfZero" OpHelp("r[P1]+=P3, if r[P1]==0 goto P2"), - /* 131 */ "AggFinal" OpHelp("accum=r[P1] N=P2"), - /* 132 */ "IncrVacuum" OpHelp(""), - /* 133 */ "Real" OpHelp("r[P2]=P4"), - /* 134 */ "Expire" OpHelp(""), - /* 135 */ "TableLock" OpHelp("iDb=P1 root=P2 write=P3"), - /* 136 */ "VBegin" OpHelp(""), - /* 137 */ "VCreate" OpHelp(""), - /* 138 */ "VDestroy" OpHelp(""), - /* 139 */ "VOpen" OpHelp(""), - /* 140 */ "VColumn" OpHelp("r[P3]=vcolumn(P2)"), - /* 141 */ "VNext" OpHelp(""), - /* 142 */ "VRename" OpHelp(""), - /* 143 */ "ToText" OpHelp(""), - /* 144 */ "ToBlob" OpHelp(""), - /* 145 */ "ToNumeric" OpHelp(""), - /* 146 */ "ToInt" OpHelp(""), - /* 147 */ "ToReal" OpHelp(""), - /* 148 */ "Pagecount" OpHelp(""), - /* 149 */ "MaxPgcnt" OpHelp(""), - /* 150 */ "Trace" OpHelp(""), - /* 151 */ "Noop" OpHelp(""), - /* 152 */ "Explain" OpHelp(""), - }; - return azName[i]; -} -#endif - -/************** End of opcodes.c *********************************************/ -/************** Begin file os_unix.c *****************************************/ -/* -** 2004 May 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains the VFS implementation for unix-like operating systems -** include Linux, MacOSX, *BSD, QNX, VxWorks, AIX, HPUX, and others. -** -** There are actually several different VFS implementations in this file. -** The differences are in the way that file locking is done. The default -** implementation uses Posix Advisory Locks. Alternative implementations -** use flock(), dot-files, various proprietary locking schemas, or simply -** skip locking all together. -** -** This source file is organized into divisions where the logic for various -** subfunctions is contained within the appropriate division. PLEASE -** KEEP THE STRUCTURE OF THIS FILE INTACT. New code should be placed -** in the correct division and should be clearly labeled. -** -** The layout of divisions is as follows: -** -** * General-purpose declarations and utility functions. -** * Unique file ID logic used by VxWorks. -** * Various locking primitive implementations (all except proxy locking): -** + for Posix Advisory Locks -** + for no-op locks -** + for dot-file locks -** + for flock() locking -** + for named semaphore locks (VxWorks only) -** + for AFP filesystem locks (MacOSX only) -** * sqlite3_file methods not associated with locking. -** * Definitions of sqlite3_io_methods objects for all locking -** methods plus "finder" functions for each locking method. -** * sqlite3_vfs method implementations. -** * Locking primitives for the proxy uber-locking-method. (MacOSX only) -** * Definitions of sqlite3_vfs objects for all locking methods -** plus implementations of sqlite3_os_init() and sqlite3_os_end(). -*/ -#if SQLITE_OS_UNIX /* This file is used on unix only */ - -/* -** There are various methods for file locking used for concurrency -** control: -** -** 1. POSIX locking (the default), -** 2. No locking, -** 3. Dot-file locking, -** 4. flock() locking, -** 5. AFP locking (OSX only), -** 6. Named POSIX semaphores (VXWorks only), -** 7. proxy locking. (OSX only) -** -** Styles 4, 5, and 7 are only available of SQLITE_ENABLE_LOCKING_STYLE -** is defined to 1. The SQLITE_ENABLE_LOCKING_STYLE also enables automatic -** selection of the appropriate locking style based on the filesystem -** where the database is located. -*/ -#if !defined(SQLITE_ENABLE_LOCKING_STYLE) -# if defined(__APPLE__) -# define SQLITE_ENABLE_LOCKING_STYLE 1 -# else -# define SQLITE_ENABLE_LOCKING_STYLE 0 -# endif -#endif - -/* -** Define the OS_VXWORKS pre-processor macro to 1 if building on -** vxworks, or 0 otherwise. -*/ -#ifndef OS_VXWORKS -# if defined(__RTP__) || defined(_WRS_KERNEL) -# define OS_VXWORKS 1 -# else -# define OS_VXWORKS 0 -# endif -#endif - -/* -** These #defines should enable >2GB file support on Posix if the -** underlying operating system supports it. If the OS lacks -** large file support, these should be no-ops. -** -** Large file support can be disabled using the -DSQLITE_DISABLE_LFS switch -** on the compiler command line. This is necessary if you are compiling -** on a recent machine (ex: RedHat 7.2) but you want your code to work -** on an older machine (ex: RedHat 6.0). If you compile on RedHat 7.2 -** without this option, LFS is enable. But LFS does not exist in the kernel -** in RedHat 6.0, so the code won't work. Hence, for maximum binary -** portability you should omit LFS. -** -** The previous paragraph was written in 2005. (This paragraph is written -** on 2008-11-28.) These days, all Linux kernels support large files, so -** you should probably leave LFS enabled. But some embedded platforms might -** lack LFS in which case the SQLITE_DISABLE_LFS macro might still be useful. -*/ -#ifndef SQLITE_DISABLE_LFS -# define _LARGE_FILE 1 -# ifndef _FILE_OFFSET_BITS -# define _FILE_OFFSET_BITS 64 -# endif -# define _LARGEFILE_SOURCE 1 -#endif - -/* -** standard include files. -*/ -#include -#include -#include -#include -/* #include */ -#include -#include -#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 -#include -#endif - - -#if SQLITE_ENABLE_LOCKING_STYLE -# include -# if OS_VXWORKS -# include -# include -# else -# include -# include -# endif -#endif /* SQLITE_ENABLE_LOCKING_STYLE */ - -#if defined(__APPLE__) || (SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS) -# include -#endif - -#ifdef HAVE_UTIME -# include -#endif - -/* -** Allowed values of unixFile.fsFlags -*/ -#define SQLITE_FSFLAGS_IS_MSDOS 0x1 - -/* -** If we are to be thread-safe, include the pthreads header and define -** the SQLITE_UNIX_THREADS macro. -*/ -#if SQLITE_THREADSAFE -/* # include */ -# define SQLITE_UNIX_THREADS 1 -#endif - -/* -** Default permissions when creating a new file -*/ -#ifndef SQLITE_DEFAULT_FILE_PERMISSIONS -# define SQLITE_DEFAULT_FILE_PERMISSIONS 0644 -#endif - -/* -** Default permissions when creating auto proxy dir -*/ -#ifndef SQLITE_DEFAULT_PROXYDIR_PERMISSIONS -# define SQLITE_DEFAULT_PROXYDIR_PERMISSIONS 0755 -#endif - -/* -** Maximum supported path-length. -*/ -#define MAX_PATHNAME 512 - -/* -** Only set the lastErrno if the error code is a real error and not -** a normal expected return code of SQLITE_BUSY or SQLITE_OK -*/ -#define IS_LOCK_ERROR(x) ((x != SQLITE_OK) && (x != SQLITE_BUSY)) - -/* Forward references */ -typedef struct unixShm unixShm; /* Connection shared memory */ -typedef struct unixShmNode unixShmNode; /* Shared memory instance */ -typedef struct unixInodeInfo unixInodeInfo; /* An i-node */ -typedef struct UnixUnusedFd UnixUnusedFd; /* An unused file descriptor */ - -/* -** Sometimes, after a file handle is closed by SQLite, the file descriptor -** cannot be closed immediately. In these cases, instances of the following -** structure are used to store the file descriptor while waiting for an -** opportunity to either close or reuse it. -*/ -struct UnixUnusedFd { - int fd; /* File descriptor to close */ - int flags; /* Flags this file descriptor was opened with */ - UnixUnusedFd *pNext; /* Next unused file descriptor on same file */ -}; - -/* -** The unixFile structure is subclass of sqlite3_file specific to the unix -** VFS implementations. -*/ -typedef struct unixFile unixFile; -struct unixFile { - sqlite3_io_methods const *pMethod; /* Always the first entry */ - sqlite3_vfs *pVfs; /* The VFS that created this unixFile */ - unixInodeInfo *pInode; /* Info about locks on this inode */ - int h; /* The file descriptor */ - unsigned char eFileLock; /* The type of lock held on this fd */ - unsigned short int ctrlFlags; /* Behavioral bits. UNIXFILE_* flags */ - int lastErrno; /* The unix errno from last I/O error */ - void *lockingContext; /* Locking style specific state */ - UnixUnusedFd *pUnused; /* Pre-allocated UnixUnusedFd */ - const char *zPath; /* Name of the file */ - unixShm *pShm; /* Shared memory segment information */ - int szChunk; /* Configured by FCNTL_CHUNK_SIZE */ -#if SQLITE_MAX_MMAP_SIZE>0 - int nFetchOut; /* Number of outstanding xFetch refs */ - sqlite3_int64 mmapSize; /* Usable size of mapping at pMapRegion */ - sqlite3_int64 mmapSizeActual; /* Actual size of mapping at pMapRegion */ - sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */ - void *pMapRegion; /* Memory mapped region */ -#endif -#ifdef __QNXNTO__ - int sectorSize; /* Device sector size */ - int deviceCharacteristics; /* Precomputed device characteristics */ -#endif -#if SQLITE_ENABLE_LOCKING_STYLE - int openFlags; /* The flags specified at open() */ -#endif -#if SQLITE_ENABLE_LOCKING_STYLE || defined(__APPLE__) - unsigned fsFlags; /* cached details from statfs() */ -#endif -#if OS_VXWORKS - struct vxworksFileId *pId; /* Unique file ID */ -#endif -#ifdef SQLITE_DEBUG - /* The next group of variables are used to track whether or not the - ** transaction counter in bytes 24-27 of database files are updated - ** whenever any part of the database changes. An assertion fault will - ** occur if a file is updated without also updating the transaction - ** counter. This test is made to avoid new problems similar to the - ** one described by ticket #3584. - */ - unsigned char transCntrChng; /* True if the transaction counter changed */ - unsigned char dbUpdate; /* True if any part of database file changed */ - unsigned char inNormalWrite; /* True if in a normal write operation */ - -#endif - -#ifdef SQLITE_TEST - /* In test mode, increase the size of this structure a bit so that - ** it is larger than the struct CrashFile defined in test6.c. - */ - char aPadding[32]; -#endif -}; - -/* This variable holds the process id (pid) from when the xRandomness() -** method was called. If xOpen() is called from a different process id, -** indicating that a fork() has occurred, the PRNG will be reset. -*/ -static int randomnessPid = 0; - -/* -** Allowed values for the unixFile.ctrlFlags bitmask: -*/ -#define UNIXFILE_EXCL 0x01 /* Connections from one process only */ -#define UNIXFILE_RDONLY 0x02 /* Connection is read only */ -#define UNIXFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */ -#ifndef SQLITE_DISABLE_DIRSYNC -# define UNIXFILE_DIRSYNC 0x08 /* Directory sync needed */ -#else -# define UNIXFILE_DIRSYNC 0x00 -#endif -#define UNIXFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */ -#define UNIXFILE_DELETE 0x20 /* Delete on close */ -#define UNIXFILE_URI 0x40 /* Filename might have query parameters */ -#define UNIXFILE_NOLOCK 0x80 /* Do no file locking */ -#define UNIXFILE_WARNED 0x0100 /* verifyDbFile() warnings have been issued */ - -/* -** Include code that is common to all os_*.c files -*/ -/************** Include os_common.h in the middle of os_unix.c ***************/ -/************** Begin file os_common.h ***************************************/ -/* -** 2004 May 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains macros and a little bit of code that is common to -** all of the platform-specific files (os_*.c) and is #included into those -** files. -** -** This file should be #included by the os_*.c files only. It is not a -** general purpose header file. -*/ -#ifndef _OS_COMMON_H_ -#define _OS_COMMON_H_ - -/* -** At least two bugs have slipped in because we changed the MEMORY_DEBUG -** macro to SQLITE_DEBUG and some older makefiles have not yet made the -** switch. The following code should catch this problem at compile-time. -*/ -#ifdef MEMORY_DEBUG -# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead." -#endif - -#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) -# ifndef SQLITE_DEBUG_OS_TRACE -# define SQLITE_DEBUG_OS_TRACE 0 -# endif - int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE; -# define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X -#else -# define OSTRACE(X) -#endif - -/* -** Macros for performance tracing. Normally turned off. Only works -** on i486 hardware. -*/ -#ifdef SQLITE_PERFORMANCE_TRACE - -/* -** hwtime.h contains inline assembler code for implementing -** high-performance timing routines. -*/ -/************** Include hwtime.h in the middle of os_common.h ****************/ -/************** Begin file hwtime.h ******************************************/ -/* -** 2008 May 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains inline asm code for retrieving "high-performance" -** counters for x86 class CPUs. -*/ -#ifndef _HWTIME_H_ -#define _HWTIME_H_ - -/* -** The following routine only works on pentium-class (or newer) processors. -** It uses the RDTSC opcode to read the cycle count value out of the -** processor and returns that value. This can be used for high-res -** profiling. -*/ -#if (defined(__GNUC__) || defined(_MSC_VER)) && \ - (defined(i386) || defined(__i386__) || defined(_M_IX86)) - - #if defined(__GNUC__) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned int lo, hi; - __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); - return (sqlite_uint64)hi << 32 | lo; - } - - #elif defined(_MSC_VER) - - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ - __asm { - rdtsc - ret ; return value at EDX:EAX - } - } - - #endif - -#elif (defined(__GNUC__) && defined(__x86_64__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long val; - __asm__ __volatile__ ("rdtsc" : "=A" (val)); - return val; - } - -#elif (defined(__GNUC__) && defined(__ppc__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long long retval; - unsigned long junk; - __asm__ __volatile__ ("\n\ - 1: mftbu %1\n\ - mftb %L0\n\ - mftbu %0\n\ - cmpw %0,%1\n\ - bne 1b" - : "=r" (retval), "=r" (junk)); - return retval; - } - -#else - - #error Need implementation of sqlite3Hwtime() for your platform. - - /* - ** To compile without implementing sqlite3Hwtime() for your platform, - ** you can remove the above #error and use the following - ** stub function. You will lose timing support for many - ** of the debugging and testing utilities, but it should at - ** least compile and run. - */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } - -#endif - -#endif /* !defined(_HWTIME_H_) */ - -/************** End of hwtime.h **********************************************/ -/************** Continuing where we left off in os_common.h ******************/ - -static sqlite_uint64 g_start; -static sqlite_uint64 g_elapsed; -#define TIMER_START g_start=sqlite3Hwtime() -#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start -#define TIMER_ELAPSED g_elapsed -#else -#define TIMER_START -#define TIMER_END -#define TIMER_ELAPSED ((sqlite_uint64)0) -#endif - -/* -** If we compile with the SQLITE_TEST macro set, then the following block -** of code will give us the ability to simulate a disk I/O error. This -** is used for testing the I/O recovery logic. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_io_error_hit = 0; /* Total number of I/O Errors */ -SQLITE_API int sqlite3_io_error_hardhit = 0; /* Number of non-benign errors */ -SQLITE_API int sqlite3_io_error_pending = 0; /* Count down to first I/O error */ -SQLITE_API int sqlite3_io_error_persist = 0; /* True if I/O errors persist */ -SQLITE_API int sqlite3_io_error_benign = 0; /* True if errors are benign */ -SQLITE_API int sqlite3_diskfull_pending = 0; -SQLITE_API int sqlite3_diskfull = 0; -#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) -#define SimulateIOError(CODE) \ - if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ - || sqlite3_io_error_pending-- == 1 ) \ - { local_ioerr(); CODE; } -static void local_ioerr(){ - IOTRACE(("IOERR\n")); - sqlite3_io_error_hit++; - if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; -} -#define SimulateDiskfullError(CODE) \ - if( sqlite3_diskfull_pending ){ \ - if( sqlite3_diskfull_pending == 1 ){ \ - local_ioerr(); \ - sqlite3_diskfull = 1; \ - sqlite3_io_error_hit = 1; \ - CODE; \ - }else{ \ - sqlite3_diskfull_pending--; \ - } \ - } -#else -#define SimulateIOErrorBenign(X) -#define SimulateIOError(A) -#define SimulateDiskfullError(A) -#endif - -/* -** When testing, keep a count of the number of open files. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_open_file_count = 0; -#define OpenCounter(X) sqlite3_open_file_count+=(X) -#else -#define OpenCounter(X) -#endif - -#endif /* !defined(_OS_COMMON_H_) */ - -/************** End of os_common.h *******************************************/ -/************** Continuing where we left off in os_unix.c ********************/ - -/* -** Define various macros that are missing from some systems. -*/ -#ifndef O_LARGEFILE -# define O_LARGEFILE 0 -#endif -#ifdef SQLITE_DISABLE_LFS -# undef O_LARGEFILE -# define O_LARGEFILE 0 -#endif -#ifndef O_NOFOLLOW -# define O_NOFOLLOW 0 -#endif -#ifndef O_BINARY -# define O_BINARY 0 -#endif - -/* -** The threadid macro resolves to the thread-id or to 0. Used for -** testing and debugging only. -*/ -#if SQLITE_THREADSAFE -#define threadid pthread_self() -#else -#define threadid 0 -#endif - -/* -** HAVE_MREMAP defaults to true on Linux and false everywhere else. -*/ -#if !defined(HAVE_MREMAP) -# if defined(__linux__) && defined(_GNU_SOURCE) -# define HAVE_MREMAP 1 -# else -# define HAVE_MREMAP 0 -# endif -#endif - -/* -** Different Unix systems declare open() in different ways. Same use -** open(const char*,int,mode_t). Others use open(const char*,int,...). -** The difference is important when using a pointer to the function. -** -** The safest way to deal with the problem is to always use this wrapper -** which always has the same well-defined interface. -*/ -static int posixOpen(const char *zFile, int flags, int mode){ - return open(zFile, flags, mode); -} - -/* -** On some systems, calls to fchown() will trigger a message in a security -** log if they come from non-root processes. So avoid calling fchown() if -** we are not running as root. -*/ -static int posixFchown(int fd, uid_t uid, gid_t gid){ - return geteuid() ? 0 : fchown(fd,uid,gid); -} - -/* Forward reference */ -static int openDirectory(const char*, int*); - -/* -** Many system calls are accessed through pointer-to-functions so that -** they may be overridden at runtime to facilitate fault injection during -** testing and sandboxing. The following array holds the names and pointers -** to all overrideable system calls. -*/ -static struct unix_syscall { - const char *zName; /* Name of the system call */ - sqlite3_syscall_ptr pCurrent; /* Current value of the system call */ - sqlite3_syscall_ptr pDefault; /* Default value */ -} aSyscall[] = { - { "open", (sqlite3_syscall_ptr)posixOpen, 0 }, -#define osOpen ((int(*)(const char*,int,int))aSyscall[0].pCurrent) - - { "close", (sqlite3_syscall_ptr)close, 0 }, -#define osClose ((int(*)(int))aSyscall[1].pCurrent) - - { "access", (sqlite3_syscall_ptr)access, 0 }, -#define osAccess ((int(*)(const char*,int))aSyscall[2].pCurrent) - - { "getcwd", (sqlite3_syscall_ptr)getcwd, 0 }, -#define osGetcwd ((char*(*)(char*,size_t))aSyscall[3].pCurrent) - - { "stat", (sqlite3_syscall_ptr)stat, 0 }, -#define osStat ((int(*)(const char*,struct stat*))aSyscall[4].pCurrent) - -/* -** The DJGPP compiler environment looks mostly like Unix, but it -** lacks the fcntl() system call. So redefine fcntl() to be something -** that always succeeds. This means that locking does not occur under -** DJGPP. But it is DOS - what did you expect? -*/ -#ifdef __DJGPP__ - { "fstat", 0, 0 }, -#define osFstat(a,b,c) 0 -#else - { "fstat", (sqlite3_syscall_ptr)fstat, 0 }, -#define osFstat ((int(*)(int,struct stat*))aSyscall[5].pCurrent) -#endif - - { "ftruncate", (sqlite3_syscall_ptr)ftruncate, 0 }, -#define osFtruncate ((int(*)(int,off_t))aSyscall[6].pCurrent) - - { "fcntl", (sqlite3_syscall_ptr)fcntl, 0 }, -#define osFcntl ((int(*)(int,int,...))aSyscall[7].pCurrent) - - { "read", (sqlite3_syscall_ptr)read, 0 }, -#define osRead ((ssize_t(*)(int,void*,size_t))aSyscall[8].pCurrent) - -#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE - { "pread", (sqlite3_syscall_ptr)pread, 0 }, -#else - { "pread", (sqlite3_syscall_ptr)0, 0 }, -#endif -#define osPread ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[9].pCurrent) - -#if defined(USE_PREAD64) - { "pread64", (sqlite3_syscall_ptr)pread64, 0 }, -#else - { "pread64", (sqlite3_syscall_ptr)0, 0 }, -#endif -#define osPread64 ((ssize_t(*)(int,void*,size_t,off_t))aSyscall[10].pCurrent) - - { "write", (sqlite3_syscall_ptr)write, 0 }, -#define osWrite ((ssize_t(*)(int,const void*,size_t))aSyscall[11].pCurrent) - -#if defined(USE_PREAD) || SQLITE_ENABLE_LOCKING_STYLE - { "pwrite", (sqlite3_syscall_ptr)pwrite, 0 }, -#else - { "pwrite", (sqlite3_syscall_ptr)0, 0 }, -#endif -#define osPwrite ((ssize_t(*)(int,const void*,size_t,off_t))\ - aSyscall[12].pCurrent) - -#if defined(USE_PREAD64) - { "pwrite64", (sqlite3_syscall_ptr)pwrite64, 0 }, -#else - { "pwrite64", (sqlite3_syscall_ptr)0, 0 }, -#endif -#define osPwrite64 ((ssize_t(*)(int,const void*,size_t,off_t))\ - aSyscall[13].pCurrent) - - { "fchmod", (sqlite3_syscall_ptr)fchmod, 0 }, -#define osFchmod ((int(*)(int,mode_t))aSyscall[14].pCurrent) - -#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE - { "fallocate", (sqlite3_syscall_ptr)posix_fallocate, 0 }, -#else - { "fallocate", (sqlite3_syscall_ptr)0, 0 }, -#endif -#define osFallocate ((int(*)(int,off_t,off_t))aSyscall[15].pCurrent) - - { "unlink", (sqlite3_syscall_ptr)unlink, 0 }, -#define osUnlink ((int(*)(const char*))aSyscall[16].pCurrent) - - { "openDirectory", (sqlite3_syscall_ptr)openDirectory, 0 }, -#define osOpenDirectory ((int(*)(const char*,int*))aSyscall[17].pCurrent) - - { "mkdir", (sqlite3_syscall_ptr)mkdir, 0 }, -#define osMkdir ((int(*)(const char*,mode_t))aSyscall[18].pCurrent) - - { "rmdir", (sqlite3_syscall_ptr)rmdir, 0 }, -#define osRmdir ((int(*)(const char*))aSyscall[19].pCurrent) - - { "fchown", (sqlite3_syscall_ptr)posixFchown, 0 }, -#define osFchown ((int(*)(int,uid_t,gid_t))aSyscall[20].pCurrent) - -#if !defined(SQLITE_OMIT_WAL) || SQLITE_MAX_MMAP_SIZE>0 - { "mmap", (sqlite3_syscall_ptr)mmap, 0 }, -#define osMmap ((void*(*)(void*,size_t,int,int,int,off_t))aSyscall[21].pCurrent) - - { "munmap", (sqlite3_syscall_ptr)munmap, 0 }, -#define osMunmap ((void*(*)(void*,size_t))aSyscall[22].pCurrent) - -#if HAVE_MREMAP - { "mremap", (sqlite3_syscall_ptr)mremap, 0 }, -#else - { "mremap", (sqlite3_syscall_ptr)0, 0 }, -#endif -#define osMremap ((void*(*)(void*,size_t,size_t,int,...))aSyscall[23].pCurrent) -#endif - -}; /* End of the overrideable system calls */ - -/* -** This is the xSetSystemCall() method of sqlite3_vfs for all of the -** "unix" VFSes. Return SQLITE_OK opon successfully updating the -** system call pointer, or SQLITE_NOTFOUND if there is no configurable -** system call named zName. -*/ -static int unixSetSystemCall( - sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ - const char *zName, /* Name of system call to override */ - sqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */ -){ - unsigned int i; - int rc = SQLITE_NOTFOUND; - - UNUSED_PARAMETER(pNotUsed); - if( zName==0 ){ - /* If no zName is given, restore all system calls to their default - ** settings and return NULL - */ - rc = SQLITE_OK; - for(i=0; i=SQLITE_MINIMUM_FILE_DESCRIPTOR ) break; - osClose(fd); - sqlite3_log(SQLITE_WARNING, - "attempt to open \"%s\" as file descriptor %d", z, fd); - fd = -1; - if( osOpen("/dev/null", f, m)<0 ) break; - } - if( fd>=0 ){ - if( m!=0 ){ - struct stat statbuf; - if( osFstat(fd, &statbuf)==0 - && statbuf.st_size==0 - && (statbuf.st_mode&0777)!=m - ){ - osFchmod(fd, m); - } - } -#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0) - osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); -#endif - } - return fd; -} - -/* -** Helper functions to obtain and relinquish the global mutex. The -** global mutex is used to protect the unixInodeInfo and -** vxworksFileId objects used by this file, all of which may be -** shared by multiple threads. -** -** Function unixMutexHeld() is used to assert() that the global mutex -** is held when required. This function is only used as part of assert() -** statements. e.g. -** -** unixEnterMutex() -** assert( unixMutexHeld() ); -** unixEnterLeave() -*/ -static void unixEnterMutex(void){ - sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); -} -static void unixLeaveMutex(void){ - sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); -} -#ifdef SQLITE_DEBUG -static int unixMutexHeld(void) { - return sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); -} -#endif - - -#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) -/* -** Helper function for printing out trace information from debugging -** binaries. This returns the string represetation of the supplied -** integer lock-type. -*/ -static const char *azFileLock(int eFileLock){ - switch( eFileLock ){ - case NO_LOCK: return "NONE"; - case SHARED_LOCK: return "SHARED"; - case RESERVED_LOCK: return "RESERVED"; - case PENDING_LOCK: return "PENDING"; - case EXCLUSIVE_LOCK: return "EXCLUSIVE"; - } - return "ERROR"; -} -#endif - -#ifdef SQLITE_LOCK_TRACE -/* -** Print out information about all locking operations. -** -** This routine is used for troubleshooting locks on multithreaded -** platforms. Enable by compiling with the -DSQLITE_LOCK_TRACE -** command-line option on the compiler. This code is normally -** turned off. -*/ -static int lockTrace(int fd, int op, struct flock *p){ - char *zOpName, *zType; - int s; - int savedErrno; - if( op==F_GETLK ){ - zOpName = "GETLK"; - }else if( op==F_SETLK ){ - zOpName = "SETLK"; - }else{ - s = osFcntl(fd, op, p); - sqlite3DebugPrintf("fcntl unknown %d %d %d\n", fd, op, s); - return s; - } - if( p->l_type==F_RDLCK ){ - zType = "RDLCK"; - }else if( p->l_type==F_WRLCK ){ - zType = "WRLCK"; - }else if( p->l_type==F_UNLCK ){ - zType = "UNLCK"; - }else{ - assert( 0 ); - } - assert( p->l_whence==SEEK_SET ); - s = osFcntl(fd, op, p); - savedErrno = errno; - sqlite3DebugPrintf("fcntl %d %d %s %s %d %d %d %d\n", - threadid, fd, zOpName, zType, (int)p->l_start, (int)p->l_len, - (int)p->l_pid, s); - if( s==(-1) && op==F_SETLK && (p->l_type==F_RDLCK || p->l_type==F_WRLCK) ){ - struct flock l2; - l2 = *p; - osFcntl(fd, F_GETLK, &l2); - if( l2.l_type==F_RDLCK ){ - zType = "RDLCK"; - }else if( l2.l_type==F_WRLCK ){ - zType = "WRLCK"; - }else if( l2.l_type==F_UNLCK ){ - zType = "UNLCK"; - }else{ - assert( 0 ); - } - sqlite3DebugPrintf("fcntl-failure-reason: %s %d %d %d\n", - zType, (int)l2.l_start, (int)l2.l_len, (int)l2.l_pid); - } - errno = savedErrno; - return s; -} -#undef osFcntl -#define osFcntl lockTrace -#endif /* SQLITE_LOCK_TRACE */ - -/* -** Retry ftruncate() calls that fail due to EINTR -*/ -static int robust_ftruncate(int h, sqlite3_int64 sz){ - int rc; - do{ rc = osFtruncate(h,sz); }while( rc<0 && errno==EINTR ); - return rc; -} - -/* -** This routine translates a standard POSIX errno code into something -** useful to the clients of the sqlite3 functions. Specifically, it is -** intended to translate a variety of "try again" errors into SQLITE_BUSY -** and a variety of "please close the file descriptor NOW" errors into -** SQLITE_IOERR -** -** Errors during initialization of locks, or file system support for locks, -** should handle ENOLCK, ENOTSUP, EOPNOTSUPP separately. -*/ -static int sqliteErrorFromPosixError(int posixError, int sqliteIOErr) { - switch (posixError) { -#if 0 - /* At one point this code was not commented out. In theory, this branch - ** should never be hit, as this function should only be called after - ** a locking-related function (i.e. fcntl()) has returned non-zero with - ** the value of errno as the first argument. Since a system call has failed, - ** errno should be non-zero. - ** - ** Despite this, if errno really is zero, we still don't want to return - ** SQLITE_OK. The system call failed, and *some* SQLite error should be - ** propagated back to the caller. Commenting this branch out means errno==0 - ** will be handled by the "default:" case below. - */ - case 0: - return SQLITE_OK; -#endif - - case EAGAIN: - case ETIMEDOUT: - case EBUSY: - case EINTR: - case ENOLCK: - /* random NFS retry error, unless during file system support - * introspection, in which it actually means what it says */ - return SQLITE_BUSY; - - case EACCES: - /* EACCES is like EAGAIN during locking operations, but not any other time*/ - if( (sqliteIOErr == SQLITE_IOERR_LOCK) || - (sqliteIOErr == SQLITE_IOERR_UNLOCK) || - (sqliteIOErr == SQLITE_IOERR_RDLOCK) || - (sqliteIOErr == SQLITE_IOERR_CHECKRESERVEDLOCK) ){ - return SQLITE_BUSY; - } - /* else fall through */ - case EPERM: - return SQLITE_PERM; - - /* EDEADLK is only possible if a call to fcntl(F_SETLKW) is made. And - ** this module never makes such a call. And the code in SQLite itself - ** asserts that SQLITE_IOERR_BLOCKED is never returned. For these reasons - ** this case is also commented out. If the system does set errno to EDEADLK, - ** the default SQLITE_IOERR_XXX code will be returned. */ -#if 0 - case EDEADLK: - return SQLITE_IOERR_BLOCKED; -#endif - -#if EOPNOTSUPP!=ENOTSUP - case EOPNOTSUPP: - /* something went terribly awry, unless during file system support - * introspection, in which it actually means what it says */ -#endif -#ifdef ENOTSUP - case ENOTSUP: - /* invalid fd, unless during file system support introspection, in which - * it actually means what it says */ -#endif - case EIO: - case EBADF: - case EINVAL: - case ENOTCONN: - case ENODEV: - case ENXIO: - case ENOENT: -#ifdef ESTALE /* ESTALE is not defined on Interix systems */ - case ESTALE: -#endif - case ENOSYS: - /* these should force the client to close the file and reconnect */ - - default: - return sqliteIOErr; - } -} - - -/****************************************************************************** -****************** Begin Unique File ID Utility Used By VxWorks *************** -** -** On most versions of unix, we can get a unique ID for a file by concatenating -** the device number and the inode number. But this does not work on VxWorks. -** On VxWorks, a unique file id must be based on the canonical filename. -** -** A pointer to an instance of the following structure can be used as a -** unique file ID in VxWorks. Each instance of this structure contains -** a copy of the canonical filename. There is also a reference count. -** The structure is reclaimed when the number of pointers to it drops to -** zero. -** -** There are never very many files open at one time and lookups are not -** a performance-critical path, so it is sufficient to put these -** structures on a linked list. -*/ -struct vxworksFileId { - struct vxworksFileId *pNext; /* Next in a list of them all */ - int nRef; /* Number of references to this one */ - int nName; /* Length of the zCanonicalName[] string */ - char *zCanonicalName; /* Canonical filename */ -}; - -#if OS_VXWORKS -/* -** All unique filenames are held on a linked list headed by this -** variable: -*/ -static struct vxworksFileId *vxworksFileList = 0; - -/* -** Simplify a filename into its canonical form -** by making the following changes: -** -** * removing any trailing and duplicate / -** * convert /./ into just / -** * convert /A/../ where A is any simple name into just / -** -** Changes are made in-place. Return the new name length. -** -** The original filename is in z[0..n-1]. Return the number of -** characters in the simplified name. -*/ -static int vxworksSimplifyName(char *z, int n){ - int i, j; - while( n>1 && z[n-1]=='/' ){ n--; } - for(i=j=0; i0 && z[j-1]!='/' ){ j--; } - if( j>0 ){ j--; } - i += 2; - continue; - } - } - z[j++] = z[i]; - } - z[j] = 0; - return j; -} - -/* -** Find a unique file ID for the given absolute pathname. Return -** a pointer to the vxworksFileId object. This pointer is the unique -** file ID. -** -** The nRef field of the vxworksFileId object is incremented before -** the object is returned. A new vxworksFileId object is created -** and added to the global list if necessary. -** -** If a memory allocation error occurs, return NULL. -*/ -static struct vxworksFileId *vxworksFindFileId(const char *zAbsoluteName){ - struct vxworksFileId *pNew; /* search key and new file ID */ - struct vxworksFileId *pCandidate; /* For looping over existing file IDs */ - int n; /* Length of zAbsoluteName string */ - - assert( zAbsoluteName[0]=='/' ); - n = (int)strlen(zAbsoluteName); - pNew = sqlite3_malloc( sizeof(*pNew) + (n+1) ); - if( pNew==0 ) return 0; - pNew->zCanonicalName = (char*)&pNew[1]; - memcpy(pNew->zCanonicalName, zAbsoluteName, n+1); - n = vxworksSimplifyName(pNew->zCanonicalName, n); - - /* Search for an existing entry that matching the canonical name. - ** If found, increment the reference count and return a pointer to - ** the existing file ID. - */ - unixEnterMutex(); - for(pCandidate=vxworksFileList; pCandidate; pCandidate=pCandidate->pNext){ - if( pCandidate->nName==n - && memcmp(pCandidate->zCanonicalName, pNew->zCanonicalName, n)==0 - ){ - sqlite3_free(pNew); - pCandidate->nRef++; - unixLeaveMutex(); - return pCandidate; - } - } - - /* No match was found. We will make a new file ID */ - pNew->nRef = 1; - pNew->nName = n; - pNew->pNext = vxworksFileList; - vxworksFileList = pNew; - unixLeaveMutex(); - return pNew; -} - -/* -** Decrement the reference count on a vxworksFileId object. Free -** the object when the reference count reaches zero. -*/ -static void vxworksReleaseFileId(struct vxworksFileId *pId){ - unixEnterMutex(); - assert( pId->nRef>0 ); - pId->nRef--; - if( pId->nRef==0 ){ - struct vxworksFileId **pp; - for(pp=&vxworksFileList; *pp && *pp!=pId; pp = &((*pp)->pNext)){} - assert( *pp==pId ); - *pp = pId->pNext; - sqlite3_free(pId); - } - unixLeaveMutex(); -} -#endif /* OS_VXWORKS */ -/*************** End of Unique File ID Utility Used By VxWorks **************** -******************************************************************************/ - - -/****************************************************************************** -*************************** Posix Advisory Locking **************************** -** -** POSIX advisory locks are broken by design. ANSI STD 1003.1 (1996) -** section 6.5.2.2 lines 483 through 490 specify that when a process -** sets or clears a lock, that operation overrides any prior locks set -** by the same process. It does not explicitly say so, but this implies -** that it overrides locks set by the same process using a different -** file descriptor. Consider this test case: -** -** int fd1 = open("./file1", O_RDWR|O_CREAT, 0644); -** int fd2 = open("./file2", O_RDWR|O_CREAT, 0644); -** -** Suppose ./file1 and ./file2 are really the same file (because -** one is a hard or symbolic link to the other) then if you set -** an exclusive lock on fd1, then try to get an exclusive lock -** on fd2, it works. I would have expected the second lock to -** fail since there was already a lock on the file due to fd1. -** But not so. Since both locks came from the same process, the -** second overrides the first, even though they were on different -** file descriptors opened on different file names. -** -** This means that we cannot use POSIX locks to synchronize file access -** among competing threads of the same process. POSIX locks will work fine -** to synchronize access for threads in separate processes, but not -** threads within the same process. -** -** To work around the problem, SQLite has to manage file locks internally -** on its own. Whenever a new database is opened, we have to find the -** specific inode of the database file (the inode is determined by the -** st_dev and st_ino fields of the stat structure that fstat() fills in) -** and check for locks already existing on that inode. When locks are -** created or removed, we have to look at our own internal record of the -** locks to see if another thread has previously set a lock on that same -** inode. -** -** (Aside: The use of inode numbers as unique IDs does not work on VxWorks. -** For VxWorks, we have to use the alternative unique ID system based on -** canonical filename and implemented in the previous division.) -** -** The sqlite3_file structure for POSIX is no longer just an integer file -** descriptor. It is now a structure that holds the integer file -** descriptor and a pointer to a structure that describes the internal -** locks on the corresponding inode. There is one locking structure -** per inode, so if the same inode is opened twice, both unixFile structures -** point to the same locking structure. The locking structure keeps -** a reference count (so we will know when to delete it) and a "cnt" -** field that tells us its internal lock status. cnt==0 means the -** file is unlocked. cnt==-1 means the file has an exclusive lock. -** cnt>0 means there are cnt shared locks on the file. -** -** Any attempt to lock or unlock a file first checks the locking -** structure. The fcntl() system call is only invoked to set a -** POSIX lock if the internal lock structure transitions between -** a locked and an unlocked state. -** -** But wait: there are yet more problems with POSIX advisory locks. -** -** If you close a file descriptor that points to a file that has locks, -** all locks on that file that are owned by the current process are -** released. To work around this problem, each unixInodeInfo object -** maintains a count of the number of pending locks on tha inode. -** When an attempt is made to close an unixFile, if there are -** other unixFile open on the same inode that are holding locks, the call -** to close() the file descriptor is deferred until all of the locks clear. -** The unixInodeInfo structure keeps a list of file descriptors that need to -** be closed and that list is walked (and cleared) when the last lock -** clears. -** -** Yet another problem: LinuxThreads do not play well with posix locks. -** -** Many older versions of linux use the LinuxThreads library which is -** not posix compliant. Under LinuxThreads, a lock created by thread -** A cannot be modified or overridden by a different thread B. -** Only thread A can modify the lock. Locking behavior is correct -** if the appliation uses the newer Native Posix Thread Library (NPTL) -** on linux - with NPTL a lock created by thread A can override locks -** in thread B. But there is no way to know at compile-time which -** threading library is being used. So there is no way to know at -** compile-time whether or not thread A can override locks on thread B. -** One has to do a run-time check to discover the behavior of the -** current process. -** -** SQLite used to support LinuxThreads. But support for LinuxThreads -** was dropped beginning with version 3.7.0. SQLite will still work with -** LinuxThreads provided that (1) there is no more than one connection -** per database file in the same process and (2) database connections -** do not move across threads. -*/ - -/* -** An instance of the following structure serves as the key used -** to locate a particular unixInodeInfo object. -*/ -struct unixFileId { - dev_t dev; /* Device number */ -#if OS_VXWORKS - struct vxworksFileId *pId; /* Unique file ID for vxworks. */ -#else - ino_t ino; /* Inode number */ -#endif -}; - -/* -** An instance of the following structure is allocated for each open -** inode. Or, on LinuxThreads, there is one of these structures for -** each inode opened by each thread. -** -** A single inode can have multiple file descriptors, so each unixFile -** structure contains a pointer to an instance of this object and this -** object keeps a count of the number of unixFile pointing to it. -*/ -struct unixInodeInfo { - struct unixFileId fileId; /* The lookup key */ - int nShared; /* Number of SHARED locks held */ - unsigned char eFileLock; /* One of SHARED_LOCK, RESERVED_LOCK etc. */ - unsigned char bProcessLock; /* An exclusive process lock is held */ - int nRef; /* Number of pointers to this structure */ - unixShmNode *pShmNode; /* Shared memory associated with this inode */ - int nLock; /* Number of outstanding file locks */ - UnixUnusedFd *pUnused; /* Unused file descriptors to close */ - unixInodeInfo *pNext; /* List of all unixInodeInfo objects */ - unixInodeInfo *pPrev; /* .... doubly linked */ -#if SQLITE_ENABLE_LOCKING_STYLE - unsigned long long sharedByte; /* for AFP simulated shared lock */ -#endif -#if OS_VXWORKS - sem_t *pSem; /* Named POSIX semaphore */ - char aSemName[MAX_PATHNAME+2]; /* Name of that semaphore */ -#endif -}; - -/* -** A lists of all unixInodeInfo objects. -*/ -static unixInodeInfo *inodeList = 0; - -/* -** -** This function - unixLogError_x(), is only ever called via the macro -** unixLogError(). -** -** It is invoked after an error occurs in an OS function and errno has been -** set. It logs a message using sqlite3_log() containing the current value of -** errno and, if possible, the human-readable equivalent from strerror() or -** strerror_r(). -** -** The first argument passed to the macro should be the error code that -** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN). -** The two subsequent arguments should be the name of the OS function that -** failed (e.g. "unlink", "open") and the associated file-system path, -** if any. -*/ -#define unixLogError(a,b,c) unixLogErrorAtLine(a,b,c,__LINE__) -static int unixLogErrorAtLine( - int errcode, /* SQLite error code */ - const char *zFunc, /* Name of OS function that failed */ - const char *zPath, /* File path associated with error */ - int iLine /* Source line number where error occurred */ -){ - char *zErr; /* Message from strerror() or equivalent */ - int iErrno = errno; /* Saved syscall error number */ - - /* If this is not a threadsafe build (SQLITE_THREADSAFE==0), then use - ** the strerror() function to obtain the human-readable error message - ** equivalent to errno. Otherwise, use strerror_r(). - */ -#if SQLITE_THREADSAFE && defined(HAVE_STRERROR_R) - char aErr[80]; - memset(aErr, 0, sizeof(aErr)); - zErr = aErr; - - /* If STRERROR_R_CHAR_P (set by autoconf scripts) or __USE_GNU is defined, - ** assume that the system provides the GNU version of strerror_r() that - ** returns a pointer to a buffer containing the error message. That pointer - ** may point to aErr[], or it may point to some static storage somewhere. - ** Otherwise, assume that the system provides the POSIX version of - ** strerror_r(), which always writes an error message into aErr[]. - ** - ** If the code incorrectly assumes that it is the POSIX version that is - ** available, the error message will often be an empty string. Not a - ** huge problem. Incorrectly concluding that the GNU version is available - ** could lead to a segfault though. - */ -#if defined(STRERROR_R_CHAR_P) || defined(__USE_GNU) - zErr = -# endif - strerror_r(iErrno, aErr, sizeof(aErr)-1); - -#elif SQLITE_THREADSAFE - /* This is a threadsafe build, but strerror_r() is not available. */ - zErr = ""; -#else - /* Non-threadsafe build, use strerror(). */ - zErr = strerror(iErrno); -#endif - - if( zPath==0 ) zPath = ""; - sqlite3_log(errcode, - "os_unix.c:%d: (%d) %s(%s) - %s", - iLine, iErrno, zFunc, zPath, zErr - ); - - return errcode; -} - -/* -** Close a file descriptor. -** -** We assume that close() almost always works, since it is only in a -** very sick application or on a very sick platform that it might fail. -** If it does fail, simply leak the file descriptor, but do log the -** error. -** -** Note that it is not safe to retry close() after EINTR since the -** file descriptor might have already been reused by another thread. -** So we don't even try to recover from an EINTR. Just log the error -** and move on. -*/ -static void robust_close(unixFile *pFile, int h, int lineno){ - if( osClose(h) ){ - unixLogErrorAtLine(SQLITE_IOERR_CLOSE, "close", - pFile ? pFile->zPath : 0, lineno); - } -} - -/* -** Close all file descriptors accumuated in the unixInodeInfo->pUnused list. -*/ -static void closePendingFds(unixFile *pFile){ - unixInodeInfo *pInode = pFile->pInode; - UnixUnusedFd *p; - UnixUnusedFd *pNext; - for(p=pInode->pUnused; p; p=pNext){ - pNext = p->pNext; - robust_close(pFile, p->fd, __LINE__); - sqlite3_free(p); - } - pInode->pUnused = 0; -} - -/* -** Release a unixInodeInfo structure previously allocated by findInodeInfo(). -** -** The mutex entered using the unixEnterMutex() function must be held -** when this function is called. -*/ -static void releaseInodeInfo(unixFile *pFile){ - unixInodeInfo *pInode = pFile->pInode; - assert( unixMutexHeld() ); - if( ALWAYS(pInode) ){ - pInode->nRef--; - if( pInode->nRef==0 ){ - assert( pInode->pShmNode==0 ); - closePendingFds(pFile); - if( pInode->pPrev ){ - assert( pInode->pPrev->pNext==pInode ); - pInode->pPrev->pNext = pInode->pNext; - }else{ - assert( inodeList==pInode ); - inodeList = pInode->pNext; - } - if( pInode->pNext ){ - assert( pInode->pNext->pPrev==pInode ); - pInode->pNext->pPrev = pInode->pPrev; - } - sqlite3_free(pInode); - } - } -} - -/* -** Given a file descriptor, locate the unixInodeInfo object that -** describes that file descriptor. Create a new one if necessary. The -** return value might be uninitialized if an error occurs. -** -** The mutex entered using the unixEnterMutex() function must be held -** when this function is called. -** -** Return an appropriate error code. -*/ -static int findInodeInfo( - unixFile *pFile, /* Unix file with file desc used in the key */ - unixInodeInfo **ppInode /* Return the unixInodeInfo object here */ -){ - int rc; /* System call return code */ - int fd; /* The file descriptor for pFile */ - struct unixFileId fileId; /* Lookup key for the unixInodeInfo */ - struct stat statbuf; /* Low-level file information */ - unixInodeInfo *pInode = 0; /* Candidate unixInodeInfo object */ - - assert( unixMutexHeld() ); - - /* Get low-level information about the file that we can used to - ** create a unique name for the file. - */ - fd = pFile->h; - rc = osFstat(fd, &statbuf); - if( rc!=0 ){ - pFile->lastErrno = errno; -#ifdef EOVERFLOW - if( pFile->lastErrno==EOVERFLOW ) return SQLITE_NOLFS; -#endif - return SQLITE_IOERR; - } - -#ifdef __APPLE__ - /* On OS X on an msdos filesystem, the inode number is reported - ** incorrectly for zero-size files. See ticket #3260. To work - ** around this problem (we consider it a bug in OS X, not SQLite) - ** we always increase the file size to 1 by writing a single byte - ** prior to accessing the inode number. The one byte written is - ** an ASCII 'S' character which also happens to be the first byte - ** in the header of every SQLite database. In this way, if there - ** is a race condition such that another thread has already populated - ** the first page of the database, no damage is done. - */ - if( statbuf.st_size==0 && (pFile->fsFlags & SQLITE_FSFLAGS_IS_MSDOS)!=0 ){ - do{ rc = osWrite(fd, "S", 1); }while( rc<0 && errno==EINTR ); - if( rc!=1 ){ - pFile->lastErrno = errno; - return SQLITE_IOERR; - } - rc = osFstat(fd, &statbuf); - if( rc!=0 ){ - pFile->lastErrno = errno; - return SQLITE_IOERR; - } - } -#endif - - memset(&fileId, 0, sizeof(fileId)); - fileId.dev = statbuf.st_dev; -#if OS_VXWORKS - fileId.pId = pFile->pId; -#else - fileId.ino = statbuf.st_ino; -#endif - pInode = inodeList; - while( pInode && memcmp(&fileId, &pInode->fileId, sizeof(fileId)) ){ - pInode = pInode->pNext; - } - if( pInode==0 ){ - pInode = sqlite3_malloc( sizeof(*pInode) ); - if( pInode==0 ){ - return SQLITE_NOMEM; - } - memset(pInode, 0, sizeof(*pInode)); - memcpy(&pInode->fileId, &fileId, sizeof(fileId)); - pInode->nRef = 1; - pInode->pNext = inodeList; - pInode->pPrev = 0; - if( inodeList ) inodeList->pPrev = pInode; - inodeList = pInode; - }else{ - pInode->nRef++; - } - *ppInode = pInode; - return SQLITE_OK; -} - -/* -** Return TRUE if pFile has been renamed or unlinked since it was first opened. -*/ -static int fileHasMoved(unixFile *pFile){ - struct stat buf; - return pFile->pInode!=0 && - (osStat(pFile->zPath, &buf)!=0 || buf.st_ino!=pFile->pInode->fileId.ino); -} - - -/* -** Check a unixFile that is a database. Verify the following: -** -** (1) There is exactly one hard link on the file -** (2) The file is not a symbolic link -** (3) The file has not been renamed or unlinked -** -** Issue sqlite3_log(SQLITE_WARNING,...) messages if anything is not right. -*/ -static void verifyDbFile(unixFile *pFile){ - struct stat buf; - int rc; - if( pFile->ctrlFlags & UNIXFILE_WARNED ){ - /* One or more of the following warnings have already been issued. Do not - ** repeat them so as not to clutter the error log */ - return; - } - rc = osFstat(pFile->h, &buf); - if( rc!=0 ){ - sqlite3_log(SQLITE_WARNING, "cannot fstat db file %s", pFile->zPath); - pFile->ctrlFlags |= UNIXFILE_WARNED; - return; - } - if( buf.st_nlink==0 && (pFile->ctrlFlags & UNIXFILE_DELETE)==0 ){ - sqlite3_log(SQLITE_WARNING, "file unlinked while open: %s", pFile->zPath); - pFile->ctrlFlags |= UNIXFILE_WARNED; - return; - } - if( buf.st_nlink>1 ){ - sqlite3_log(SQLITE_WARNING, "multiple links to file: %s", pFile->zPath); - pFile->ctrlFlags |= UNIXFILE_WARNED; - return; - } - if( fileHasMoved(pFile) ){ - sqlite3_log(SQLITE_WARNING, "file renamed while open: %s", pFile->zPath); - pFile->ctrlFlags |= UNIXFILE_WARNED; - return; - } -} - - -/* -** This routine checks if there is a RESERVED lock held on the specified -** file by this or any other process. If such a lock is held, set *pResOut -** to a non-zero value otherwise *pResOut is set to zero. The return value -** is set to SQLITE_OK unless an I/O error occurs during lock checking. -*/ -static int unixCheckReservedLock(sqlite3_file *id, int *pResOut){ - int rc = SQLITE_OK; - int reserved = 0; - unixFile *pFile = (unixFile*)id; - - SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); - - assert( pFile ); - unixEnterMutex(); /* Because pFile->pInode is shared across threads */ - - /* Check if a thread in this process holds such a lock */ - if( pFile->pInode->eFileLock>SHARED_LOCK ){ - reserved = 1; - } - - /* Otherwise see if some other process holds it. - */ -#ifndef __DJGPP__ - if( !reserved && !pFile->pInode->bProcessLock ){ - struct flock lock; - lock.l_whence = SEEK_SET; - lock.l_start = RESERVED_BYTE; - lock.l_len = 1; - lock.l_type = F_WRLCK; - if( osFcntl(pFile->h, F_GETLK, &lock) ){ - rc = SQLITE_IOERR_CHECKRESERVEDLOCK; - pFile->lastErrno = errno; - } else if( lock.l_type!=F_UNLCK ){ - reserved = 1; - } - } -#endif - - unixLeaveMutex(); - OSTRACE(("TEST WR-LOCK %d %d %d (unix)\n", pFile->h, rc, reserved)); - - *pResOut = reserved; - return rc; -} - -/* -** Attempt to set a system-lock on the file pFile. The lock is -** described by pLock. -** -** If the pFile was opened read/write from unix-excl, then the only lock -** ever obtained is an exclusive lock, and it is obtained exactly once -** the first time any lock is attempted. All subsequent system locking -** operations become no-ops. Locking operations still happen internally, -** in order to coordinate access between separate database connections -** within this process, but all of that is handled in memory and the -** operating system does not participate. -** -** This function is a pass-through to fcntl(F_SETLK) if pFile is using -** any VFS other than "unix-excl" or if pFile is opened on "unix-excl" -** and is read-only. -** -** Zero is returned if the call completes successfully, or -1 if a call -** to fcntl() fails. In this case, errno is set appropriately (by fcntl()). -*/ -static int unixFileLock(unixFile *pFile, struct flock *pLock){ - int rc; - unixInodeInfo *pInode = pFile->pInode; - assert( unixMutexHeld() ); - assert( pInode!=0 ); - if( ((pFile->ctrlFlags & UNIXFILE_EXCL)!=0 || pInode->bProcessLock) - && ((pFile->ctrlFlags & UNIXFILE_RDONLY)==0) - ){ - if( pInode->bProcessLock==0 ){ - struct flock lock; - assert( pInode->nLock==0 ); - lock.l_whence = SEEK_SET; - lock.l_start = SHARED_FIRST; - lock.l_len = SHARED_SIZE; - lock.l_type = F_WRLCK; - rc = osFcntl(pFile->h, F_SETLK, &lock); - if( rc<0 ) return rc; - pInode->bProcessLock = 1; - pInode->nLock++; - }else{ - rc = 0; - } - }else{ - rc = osFcntl(pFile->h, F_SETLK, pLock); - } - return rc; -} - -/* -** Lock the file with the lock specified by parameter eFileLock - one -** of the following: -** -** (1) SHARED_LOCK -** (2) RESERVED_LOCK -** (3) PENDING_LOCK -** (4) EXCLUSIVE_LOCK -** -** Sometimes when requesting one lock state, additional lock states -** are inserted in between. The locking might fail on one of the later -** transitions leaving the lock state different from what it started but -** still short of its goal. The following chart shows the allowed -** transitions and the inserted intermediate states: -** -** UNLOCKED -> SHARED -** SHARED -> RESERVED -** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> (PENDING) -> EXCLUSIVE -** PENDING -> EXCLUSIVE -** -** This routine will only increase a lock. Use the sqlite3OsUnlock() -** routine to lower a locking level. -*/ -static int unixLock(sqlite3_file *id, int eFileLock){ - /* The following describes the implementation of the various locks and - ** lock transitions in terms of the POSIX advisory shared and exclusive - ** lock primitives (called read-locks and write-locks below, to avoid - ** confusion with SQLite lock names). The algorithms are complicated - ** slightly in order to be compatible with windows systems simultaneously - ** accessing the same database file, in case that is ever required. - ** - ** Symbols defined in os.h indentify the 'pending byte' and the 'reserved - ** byte', each single bytes at well known offsets, and the 'shared byte - ** range', a range of 510 bytes at a well known offset. - ** - ** To obtain a SHARED lock, a read-lock is obtained on the 'pending - ** byte'. If this is successful, a random byte from the 'shared byte - ** range' is read-locked and the lock on the 'pending byte' released. - ** - ** A process may only obtain a RESERVED lock after it has a SHARED lock. - ** A RESERVED lock is implemented by grabbing a write-lock on the - ** 'reserved byte'. - ** - ** A process may only obtain a PENDING lock after it has obtained a - ** SHARED lock. A PENDING lock is implemented by obtaining a write-lock - ** on the 'pending byte'. This ensures that no new SHARED locks can be - ** obtained, but existing SHARED locks are allowed to persist. A process - ** does not have to obtain a RESERVED lock on the way to a PENDING lock. - ** This property is used by the algorithm for rolling back a journal file - ** after a crash. - ** - ** An EXCLUSIVE lock, obtained after a PENDING lock is held, is - ** implemented by obtaining a write-lock on the entire 'shared byte - ** range'. Since all other locks require a read-lock on one of the bytes - ** within this range, this ensures that no other locks are held on the - ** database. - ** - ** The reason a single byte cannot be used instead of the 'shared byte - ** range' is that some versions of windows do not support read-locks. By - ** locking a random byte from a range, concurrent SHARED locks may exist - ** even if the locking primitive used is always a write-lock. - */ - int rc = SQLITE_OK; - unixFile *pFile = (unixFile*)id; - unixInodeInfo *pInode; - struct flock lock; - int tErrno = 0; - - assert( pFile ); - OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (unix)\n", pFile->h, - azFileLock(eFileLock), azFileLock(pFile->eFileLock), - azFileLock(pFile->pInode->eFileLock), pFile->pInode->nShared , getpid())); - - /* If there is already a lock of this type or more restrictive on the - ** unixFile, do nothing. Don't use the end_lock: exit path, as - ** unixEnterMutex() hasn't been called yet. - */ - if( pFile->eFileLock>=eFileLock ){ - OSTRACE(("LOCK %d %s ok (already held) (unix)\n", pFile->h, - azFileLock(eFileLock))); - return SQLITE_OK; - } - - /* Make sure the locking sequence is correct. - ** (1) We never move from unlocked to anything higher than shared lock. - ** (2) SQLite never explicitly requests a pendig lock. - ** (3) A shared lock is always held when a reserve lock is requested. - */ - assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK ); - assert( eFileLock!=PENDING_LOCK ); - assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK ); - - /* This mutex is needed because pFile->pInode is shared across threads - */ - unixEnterMutex(); - pInode = pFile->pInode; - - /* If some thread using this PID has a lock via a different unixFile* - ** handle that precludes the requested lock, return BUSY. - */ - if( (pFile->eFileLock!=pInode->eFileLock && - (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK)) - ){ - rc = SQLITE_BUSY; - goto end_lock; - } - - /* If a SHARED lock is requested, and some thread using this PID already - ** has a SHARED or RESERVED lock, then increment reference counts and - ** return SQLITE_OK. - */ - if( eFileLock==SHARED_LOCK && - (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){ - assert( eFileLock==SHARED_LOCK ); - assert( pFile->eFileLock==0 ); - assert( pInode->nShared>0 ); - pFile->eFileLock = SHARED_LOCK; - pInode->nShared++; - pInode->nLock++; - goto end_lock; - } - - - /* A PENDING lock is needed before acquiring a SHARED lock and before - ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will - ** be released. - */ - lock.l_len = 1L; - lock.l_whence = SEEK_SET; - if( eFileLock==SHARED_LOCK - || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLocklastErrno = tErrno; - } - goto end_lock; - } - } - - - /* If control gets to this point, then actually go ahead and make - ** operating system calls for the specified lock. - */ - if( eFileLock==SHARED_LOCK ){ - assert( pInode->nShared==0 ); - assert( pInode->eFileLock==0 ); - assert( rc==SQLITE_OK ); - - /* Now get the read-lock */ - lock.l_start = SHARED_FIRST; - lock.l_len = SHARED_SIZE; - if( unixFileLock(pFile, &lock) ){ - tErrno = errno; - rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); - } - - /* Drop the temporary PENDING lock */ - lock.l_start = PENDING_BYTE; - lock.l_len = 1L; - lock.l_type = F_UNLCK; - if( unixFileLock(pFile, &lock) && rc==SQLITE_OK ){ - /* This could happen with a network mount */ - tErrno = errno; - rc = SQLITE_IOERR_UNLOCK; - } - - if( rc ){ - if( rc!=SQLITE_BUSY ){ - pFile->lastErrno = tErrno; - } - goto end_lock; - }else{ - pFile->eFileLock = SHARED_LOCK; - pInode->nLock++; - pInode->nShared = 1; - } - }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){ - /* We are trying for an exclusive lock but another thread in this - ** same process is still holding a shared lock. */ - rc = SQLITE_BUSY; - }else{ - /* The request was for a RESERVED or EXCLUSIVE lock. It is - ** assumed that there is a SHARED or greater lock on the file - ** already. - */ - assert( 0!=pFile->eFileLock ); - lock.l_type = F_WRLCK; - - assert( eFileLock==RESERVED_LOCK || eFileLock==EXCLUSIVE_LOCK ); - if( eFileLock==RESERVED_LOCK ){ - lock.l_start = RESERVED_BYTE; - lock.l_len = 1L; - }else{ - lock.l_start = SHARED_FIRST; - lock.l_len = SHARED_SIZE; - } - - if( unixFileLock(pFile, &lock) ){ - tErrno = errno; - rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); - if( rc!=SQLITE_BUSY ){ - pFile->lastErrno = tErrno; - } - } - } - - -#ifdef SQLITE_DEBUG - /* Set up the transaction-counter change checking flags when - ** transitioning from a SHARED to a RESERVED lock. The change - ** from SHARED to RESERVED marks the beginning of a normal - ** write operation (not a hot journal rollback). - */ - if( rc==SQLITE_OK - && pFile->eFileLock<=SHARED_LOCK - && eFileLock==RESERVED_LOCK - ){ - pFile->transCntrChng = 0; - pFile->dbUpdate = 0; - pFile->inNormalWrite = 1; - } -#endif - - - if( rc==SQLITE_OK ){ - pFile->eFileLock = eFileLock; - pInode->eFileLock = eFileLock; - }else if( eFileLock==EXCLUSIVE_LOCK ){ - pFile->eFileLock = PENDING_LOCK; - pInode->eFileLock = PENDING_LOCK; - } - -end_lock: - unixLeaveMutex(); - OSTRACE(("LOCK %d %s %s (unix)\n", pFile->h, azFileLock(eFileLock), - rc==SQLITE_OK ? "ok" : "failed")); - return rc; -} - -/* -** Add the file descriptor used by file handle pFile to the corresponding -** pUnused list. -*/ -static void setPendingFd(unixFile *pFile){ - unixInodeInfo *pInode = pFile->pInode; - UnixUnusedFd *p = pFile->pUnused; - p->pNext = pInode->pUnused; - pInode->pUnused = p; - pFile->h = -1; - pFile->pUnused = 0; -} - -/* -** Lower the locking level on file descriptor pFile to eFileLock. eFileLock -** must be either NO_LOCK or SHARED_LOCK. -** -** If the locking level of the file descriptor is already at or below -** the requested locking level, this routine is a no-op. -** -** If handleNFSUnlock is true, then on downgrading an EXCLUSIVE_LOCK to SHARED -** the byte range is divided into 2 parts and the first part is unlocked then -** set to a read lock, then the other part is simply unlocked. This works -** around a bug in BSD NFS lockd (also seen on MacOSX 10.3+) that fails to -** remove the write lock on a region when a read lock is set. -*/ -static int posixUnlock(sqlite3_file *id, int eFileLock, int handleNFSUnlock){ - unixFile *pFile = (unixFile*)id; - unixInodeInfo *pInode; - struct flock lock; - int rc = SQLITE_OK; - - assert( pFile ); - OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (unix)\n", pFile->h, eFileLock, - pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared, - getpid())); - - assert( eFileLock<=SHARED_LOCK ); - if( pFile->eFileLock<=eFileLock ){ - return SQLITE_OK; - } - unixEnterMutex(); - pInode = pFile->pInode; - assert( pInode->nShared!=0 ); - if( pFile->eFileLock>SHARED_LOCK ){ - assert( pInode->eFileLock==pFile->eFileLock ); - -#ifdef SQLITE_DEBUG - /* When reducing a lock such that other processes can start - ** reading the database file again, make sure that the - ** transaction counter was updated if any part of the database - ** file changed. If the transaction counter is not updated, - ** other connections to the same file might not realize that - ** the file has changed and hence might not know to flush their - ** cache. The use of a stale cache can lead to database corruption. - */ - pFile->inNormalWrite = 0; -#endif - - /* downgrading to a shared lock on NFS involves clearing the write lock - ** before establishing the readlock - to avoid a race condition we downgrade - ** the lock in 2 blocks, so that part of the range will be covered by a - ** write lock until the rest is covered by a read lock: - ** 1: [WWWWW] - ** 2: [....W] - ** 3: [RRRRW] - ** 4: [RRRR.] - */ - if( eFileLock==SHARED_LOCK ){ - -#if !defined(__APPLE__) || !SQLITE_ENABLE_LOCKING_STYLE - (void)handleNFSUnlock; - assert( handleNFSUnlock==0 ); -#endif -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE - if( handleNFSUnlock ){ - int tErrno; /* Error code from system call errors */ - off_t divSize = SHARED_SIZE - 1; - - lock.l_type = F_UNLCK; - lock.l_whence = SEEK_SET; - lock.l_start = SHARED_FIRST; - lock.l_len = divSize; - if( unixFileLock(pFile, &lock)==(-1) ){ - tErrno = errno; - rc = SQLITE_IOERR_UNLOCK; - if( IS_LOCK_ERROR(rc) ){ - pFile->lastErrno = tErrno; - } - goto end_unlock; - } - lock.l_type = F_RDLCK; - lock.l_whence = SEEK_SET; - lock.l_start = SHARED_FIRST; - lock.l_len = divSize; - if( unixFileLock(pFile, &lock)==(-1) ){ - tErrno = errno; - rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_RDLOCK); - if( IS_LOCK_ERROR(rc) ){ - pFile->lastErrno = tErrno; - } - goto end_unlock; - } - lock.l_type = F_UNLCK; - lock.l_whence = SEEK_SET; - lock.l_start = SHARED_FIRST+divSize; - lock.l_len = SHARED_SIZE-divSize; - if( unixFileLock(pFile, &lock)==(-1) ){ - tErrno = errno; - rc = SQLITE_IOERR_UNLOCK; - if( IS_LOCK_ERROR(rc) ){ - pFile->lastErrno = tErrno; - } - goto end_unlock; - } - }else -#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */ - { - lock.l_type = F_RDLCK; - lock.l_whence = SEEK_SET; - lock.l_start = SHARED_FIRST; - lock.l_len = SHARED_SIZE; - if( unixFileLock(pFile, &lock) ){ - /* In theory, the call to unixFileLock() cannot fail because another - ** process is holding an incompatible lock. If it does, this - ** indicates that the other process is not following the locking - ** protocol. If this happens, return SQLITE_IOERR_RDLOCK. Returning - ** SQLITE_BUSY would confuse the upper layer (in practice it causes - ** an assert to fail). */ - rc = SQLITE_IOERR_RDLOCK; - pFile->lastErrno = errno; - goto end_unlock; - } - } - } - lock.l_type = F_UNLCK; - lock.l_whence = SEEK_SET; - lock.l_start = PENDING_BYTE; - lock.l_len = 2L; assert( PENDING_BYTE+1==RESERVED_BYTE ); - if( unixFileLock(pFile, &lock)==0 ){ - pInode->eFileLock = SHARED_LOCK; - }else{ - rc = SQLITE_IOERR_UNLOCK; - pFile->lastErrno = errno; - goto end_unlock; - } - } - if( eFileLock==NO_LOCK ){ - /* Decrement the shared lock counter. Release the lock using an - ** OS call only when all threads in this same process have released - ** the lock. - */ - pInode->nShared--; - if( pInode->nShared==0 ){ - lock.l_type = F_UNLCK; - lock.l_whence = SEEK_SET; - lock.l_start = lock.l_len = 0L; - if( unixFileLock(pFile, &lock)==0 ){ - pInode->eFileLock = NO_LOCK; - }else{ - rc = SQLITE_IOERR_UNLOCK; - pFile->lastErrno = errno; - pInode->eFileLock = NO_LOCK; - pFile->eFileLock = NO_LOCK; - } - } - - /* Decrement the count of locks against this same file. When the - ** count reaches zero, close any other file descriptors whose close - ** was deferred because of outstanding locks. - */ - pInode->nLock--; - assert( pInode->nLock>=0 ); - if( pInode->nLock==0 ){ - closePendingFds(pFile); - } - } - -end_unlock: - unixLeaveMutex(); - if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock; - return rc; -} - -/* -** Lower the locking level on file descriptor pFile to eFileLock. eFileLock -** must be either NO_LOCK or SHARED_LOCK. -** -** If the locking level of the file descriptor is already at or below -** the requested locking level, this routine is a no-op. -*/ -static int unixUnlock(sqlite3_file *id, int eFileLock){ -#if SQLITE_MAX_MMAP_SIZE>0 - assert( eFileLock==SHARED_LOCK || ((unixFile *)id)->nFetchOut==0 ); -#endif - return posixUnlock(id, eFileLock, 0); -} - -#if SQLITE_MAX_MMAP_SIZE>0 -static int unixMapfile(unixFile *pFd, i64 nByte); -static void unixUnmapfile(unixFile *pFd); -#endif - -/* -** This function performs the parts of the "close file" operation -** common to all locking schemes. It closes the directory and file -** handles, if they are valid, and sets all fields of the unixFile -** structure to 0. -** -** It is *not* necessary to hold the mutex when this routine is called, -** even on VxWorks. A mutex will be acquired on VxWorks by the -** vxworksReleaseFileId() routine. -*/ -static int closeUnixFile(sqlite3_file *id){ - unixFile *pFile = (unixFile*)id; -#if SQLITE_MAX_MMAP_SIZE>0 - unixUnmapfile(pFile); -#endif - if( pFile->h>=0 ){ - robust_close(pFile, pFile->h, __LINE__); - pFile->h = -1; - } -#if OS_VXWORKS - if( pFile->pId ){ - if( pFile->ctrlFlags & UNIXFILE_DELETE ){ - osUnlink(pFile->pId->zCanonicalName); - } - vxworksReleaseFileId(pFile->pId); - pFile->pId = 0; - } -#endif - OSTRACE(("CLOSE %-3d\n", pFile->h)); - OpenCounter(-1); - sqlite3_free(pFile->pUnused); - memset(pFile, 0, sizeof(unixFile)); - return SQLITE_OK; -} - -/* -** Close a file. -*/ -static int unixClose(sqlite3_file *id){ - int rc = SQLITE_OK; - unixFile *pFile = (unixFile *)id; - verifyDbFile(pFile); - unixUnlock(id, NO_LOCK); - unixEnterMutex(); - - /* unixFile.pInode is always valid here. Otherwise, a different close - ** routine (e.g. nolockClose()) would be called instead. - */ - assert( pFile->pInode->nLock>0 || pFile->pInode->bProcessLock==0 ); - if( ALWAYS(pFile->pInode) && pFile->pInode->nLock ){ - /* If there are outstanding locks, do not actually close the file just - ** yet because that would clear those locks. Instead, add the file - ** descriptor to pInode->pUnused list. It will be automatically closed - ** when the last lock is cleared. - */ - setPendingFd(pFile); - } - releaseInodeInfo(pFile); - rc = closeUnixFile(id); - unixLeaveMutex(); - return rc; -} - -/************** End of the posix advisory lock implementation ***************** -******************************************************************************/ - -/****************************************************************************** -****************************** No-op Locking ********************************** -** -** Of the various locking implementations available, this is by far the -** simplest: locking is ignored. No attempt is made to lock the database -** file for reading or writing. -** -** This locking mode is appropriate for use on read-only databases -** (ex: databases that are burned into CD-ROM, for example.) It can -** also be used if the application employs some external mechanism to -** prevent simultaneous access of the same database by two or more -** database connections. But there is a serious risk of database -** corruption if this locking mode is used in situations where multiple -** database connections are accessing the same database file at the same -** time and one or more of those connections are writing. -*/ - -static int nolockCheckReservedLock(sqlite3_file *NotUsed, int *pResOut){ - UNUSED_PARAMETER(NotUsed); - *pResOut = 0; - return SQLITE_OK; -} -static int nolockLock(sqlite3_file *NotUsed, int NotUsed2){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - return SQLITE_OK; -} -static int nolockUnlock(sqlite3_file *NotUsed, int NotUsed2){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - return SQLITE_OK; -} - -/* -** Close the file. -*/ -static int nolockClose(sqlite3_file *id) { - return closeUnixFile(id); -} - -/******************* End of the no-op lock implementation ********************* -******************************************************************************/ - -/****************************************************************************** -************************* Begin dot-file Locking ****************************** -** -** The dotfile locking implementation uses the existence of separate lock -** files (really a directory) to control access to the database. This works -** on just about every filesystem imaginable. But there are serious downsides: -** -** (1) There is zero concurrency. A single reader blocks all other -** connections from reading or writing the database. -** -** (2) An application crash or power loss can leave stale lock files -** sitting around that need to be cleared manually. -** -** Nevertheless, a dotlock is an appropriate locking mode for use if no -** other locking strategy is available. -** -** Dotfile locking works by creating a subdirectory in the same directory as -** the database and with the same name but with a ".lock" extension added. -** The existence of a lock directory implies an EXCLUSIVE lock. All other -** lock types (SHARED, RESERVED, PENDING) are mapped into EXCLUSIVE. -*/ - -/* -** The file suffix added to the data base filename in order to create the -** lock directory. -*/ -#define DOTLOCK_SUFFIX ".lock" - -/* -** This routine checks if there is a RESERVED lock held on the specified -** file by this or any other process. If such a lock is held, set *pResOut -** to a non-zero value otherwise *pResOut is set to zero. The return value -** is set to SQLITE_OK unless an I/O error occurs during lock checking. -** -** In dotfile locking, either a lock exists or it does not. So in this -** variation of CheckReservedLock(), *pResOut is set to true if any lock -** is held on the file and false if the file is unlocked. -*/ -static int dotlockCheckReservedLock(sqlite3_file *id, int *pResOut) { - int rc = SQLITE_OK; - int reserved = 0; - unixFile *pFile = (unixFile*)id; - - SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); - - assert( pFile ); - - /* Check if a thread in this process holds such a lock */ - if( pFile->eFileLock>SHARED_LOCK ){ - /* Either this connection or some other connection in the same process - ** holds a lock on the file. No need to check further. */ - reserved = 1; - }else{ - /* The lock is held if and only if the lockfile exists */ - const char *zLockFile = (const char*)pFile->lockingContext; - reserved = osAccess(zLockFile, 0)==0; - } - OSTRACE(("TEST WR-LOCK %d %d %d (dotlock)\n", pFile->h, rc, reserved)); - *pResOut = reserved; - return rc; -} - -/* -** Lock the file with the lock specified by parameter eFileLock - one -** of the following: -** -** (1) SHARED_LOCK -** (2) RESERVED_LOCK -** (3) PENDING_LOCK -** (4) EXCLUSIVE_LOCK -** -** Sometimes when requesting one lock state, additional lock states -** are inserted in between. The locking might fail on one of the later -** transitions leaving the lock state different from what it started but -** still short of its goal. The following chart shows the allowed -** transitions and the inserted intermediate states: -** -** UNLOCKED -> SHARED -** SHARED -> RESERVED -** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> (PENDING) -> EXCLUSIVE -** PENDING -> EXCLUSIVE -** -** This routine will only increase a lock. Use the sqlite3OsUnlock() -** routine to lower a locking level. -** -** With dotfile locking, we really only support state (4): EXCLUSIVE. -** But we track the other locking levels internally. -*/ -static int dotlockLock(sqlite3_file *id, int eFileLock) { - unixFile *pFile = (unixFile*)id; - char *zLockFile = (char *)pFile->lockingContext; - int rc = SQLITE_OK; - - - /* If we have any lock, then the lock file already exists. All we have - ** to do is adjust our internal record of the lock level. - */ - if( pFile->eFileLock > NO_LOCK ){ - pFile->eFileLock = eFileLock; - /* Always update the timestamp on the old file */ -#ifdef HAVE_UTIME - utime(zLockFile, NULL); -#else - utimes(zLockFile, NULL); -#endif - return SQLITE_OK; - } - - /* grab an exclusive lock */ - rc = osMkdir(zLockFile, 0777); - if( rc<0 ){ - /* failed to open/create the lock directory */ - int tErrno = errno; - if( EEXIST == tErrno ){ - rc = SQLITE_BUSY; - } else { - rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); - if( IS_LOCK_ERROR(rc) ){ - pFile->lastErrno = tErrno; - } - } - return rc; - } - - /* got it, set the type and return ok */ - pFile->eFileLock = eFileLock; - return rc; -} - -/* -** Lower the locking level on file descriptor pFile to eFileLock. eFileLock -** must be either NO_LOCK or SHARED_LOCK. -** -** If the locking level of the file descriptor is already at or below -** the requested locking level, this routine is a no-op. -** -** When the locking level reaches NO_LOCK, delete the lock file. -*/ -static int dotlockUnlock(sqlite3_file *id, int eFileLock) { - unixFile *pFile = (unixFile*)id; - char *zLockFile = (char *)pFile->lockingContext; - int rc; - - assert( pFile ); - OSTRACE(("UNLOCK %d %d was %d pid=%d (dotlock)\n", pFile->h, eFileLock, - pFile->eFileLock, getpid())); - assert( eFileLock<=SHARED_LOCK ); - - /* no-op if possible */ - if( pFile->eFileLock==eFileLock ){ - return SQLITE_OK; - } - - /* To downgrade to shared, simply update our internal notion of the - ** lock state. No need to mess with the file on disk. - */ - if( eFileLock==SHARED_LOCK ){ - pFile->eFileLock = SHARED_LOCK; - return SQLITE_OK; - } - - /* To fully unlock the database, delete the lock file */ - assert( eFileLock==NO_LOCK ); - rc = osRmdir(zLockFile); - if( rc<0 && errno==ENOTDIR ) rc = osUnlink(zLockFile); - if( rc<0 ){ - int tErrno = errno; - rc = 0; - if( ENOENT != tErrno ){ - rc = SQLITE_IOERR_UNLOCK; - } - if( IS_LOCK_ERROR(rc) ){ - pFile->lastErrno = tErrno; - } - return rc; - } - pFile->eFileLock = NO_LOCK; - return SQLITE_OK; -} - -/* -** Close a file. Make sure the lock has been released before closing. -*/ -static int dotlockClose(sqlite3_file *id) { - int rc = SQLITE_OK; - if( id ){ - unixFile *pFile = (unixFile*)id; - dotlockUnlock(id, NO_LOCK); - sqlite3_free(pFile->lockingContext); - rc = closeUnixFile(id); - } - return rc; -} -/****************** End of the dot-file lock implementation ******************* -******************************************************************************/ - -/****************************************************************************** -************************** Begin flock Locking ******************************** -** -** Use the flock() system call to do file locking. -** -** flock() locking is like dot-file locking in that the various -** fine-grain locking levels supported by SQLite are collapsed into -** a single exclusive lock. In other words, SHARED, RESERVED, and -** PENDING locks are the same thing as an EXCLUSIVE lock. SQLite -** still works when you do this, but concurrency is reduced since -** only a single process can be reading the database at a time. -** -** Omit this section if SQLITE_ENABLE_LOCKING_STYLE is turned off or if -** compiling for VXWORKS. -*/ -#if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS - -/* -** Retry flock() calls that fail with EINTR -*/ -#ifdef EINTR -static int robust_flock(int fd, int op){ - int rc; - do{ rc = flock(fd,op); }while( rc<0 && errno==EINTR ); - return rc; -} -#else -# define robust_flock(a,b) flock(a,b) -#endif - - -/* -** This routine checks if there is a RESERVED lock held on the specified -** file by this or any other process. If such a lock is held, set *pResOut -** to a non-zero value otherwise *pResOut is set to zero. The return value -** is set to SQLITE_OK unless an I/O error occurs during lock checking. -*/ -static int flockCheckReservedLock(sqlite3_file *id, int *pResOut){ - int rc = SQLITE_OK; - int reserved = 0; - unixFile *pFile = (unixFile*)id; - - SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); - - assert( pFile ); - - /* Check if a thread in this process holds such a lock */ - if( pFile->eFileLock>SHARED_LOCK ){ - reserved = 1; - } - - /* Otherwise see if some other process holds it. */ - if( !reserved ){ - /* attempt to get the lock */ - int lrc = robust_flock(pFile->h, LOCK_EX | LOCK_NB); - if( !lrc ){ - /* got the lock, unlock it */ - lrc = robust_flock(pFile->h, LOCK_UN); - if ( lrc ) { - int tErrno = errno; - /* unlock failed with an error */ - lrc = SQLITE_IOERR_UNLOCK; - if( IS_LOCK_ERROR(lrc) ){ - pFile->lastErrno = tErrno; - rc = lrc; - } - } - } else { - int tErrno = errno; - reserved = 1; - /* someone else might have it reserved */ - lrc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); - if( IS_LOCK_ERROR(lrc) ){ - pFile->lastErrno = tErrno; - rc = lrc; - } - } - } - OSTRACE(("TEST WR-LOCK %d %d %d (flock)\n", pFile->h, rc, reserved)); - -#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS - if( (rc & SQLITE_IOERR) == SQLITE_IOERR ){ - rc = SQLITE_OK; - reserved=1; - } -#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */ - *pResOut = reserved; - return rc; -} - -/* -** Lock the file with the lock specified by parameter eFileLock - one -** of the following: -** -** (1) SHARED_LOCK -** (2) RESERVED_LOCK -** (3) PENDING_LOCK -** (4) EXCLUSIVE_LOCK -** -** Sometimes when requesting one lock state, additional lock states -** are inserted in between. The locking might fail on one of the later -** transitions leaving the lock state different from what it started but -** still short of its goal. The following chart shows the allowed -** transitions and the inserted intermediate states: -** -** UNLOCKED -> SHARED -** SHARED -> RESERVED -** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> (PENDING) -> EXCLUSIVE -** PENDING -> EXCLUSIVE -** -** flock() only really support EXCLUSIVE locks. We track intermediate -** lock states in the sqlite3_file structure, but all locks SHARED or -** above are really EXCLUSIVE locks and exclude all other processes from -** access the file. -** -** This routine will only increase a lock. Use the sqlite3OsUnlock() -** routine to lower a locking level. -*/ -static int flockLock(sqlite3_file *id, int eFileLock) { - int rc = SQLITE_OK; - unixFile *pFile = (unixFile*)id; - - assert( pFile ); - - /* if we already have a lock, it is exclusive. - ** Just adjust level and punt on outta here. */ - if (pFile->eFileLock > NO_LOCK) { - pFile->eFileLock = eFileLock; - return SQLITE_OK; - } - - /* grab an exclusive lock */ - - if (robust_flock(pFile->h, LOCK_EX | LOCK_NB)) { - int tErrno = errno; - /* didn't get, must be busy */ - rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_LOCK); - if( IS_LOCK_ERROR(rc) ){ - pFile->lastErrno = tErrno; - } - } else { - /* got it, set the type and return ok */ - pFile->eFileLock = eFileLock; - } - OSTRACE(("LOCK %d %s %s (flock)\n", pFile->h, azFileLock(eFileLock), - rc==SQLITE_OK ? "ok" : "failed")); -#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS - if( (rc & SQLITE_IOERR) == SQLITE_IOERR ){ - rc = SQLITE_BUSY; - } -#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */ - return rc; -} - - -/* -** Lower the locking level on file descriptor pFile to eFileLock. eFileLock -** must be either NO_LOCK or SHARED_LOCK. -** -** If the locking level of the file descriptor is already at or below -** the requested locking level, this routine is a no-op. -*/ -static int flockUnlock(sqlite3_file *id, int eFileLock) { - unixFile *pFile = (unixFile*)id; - - assert( pFile ); - OSTRACE(("UNLOCK %d %d was %d pid=%d (flock)\n", pFile->h, eFileLock, - pFile->eFileLock, getpid())); - assert( eFileLock<=SHARED_LOCK ); - - /* no-op if possible */ - if( pFile->eFileLock==eFileLock ){ - return SQLITE_OK; - } - - /* shared can just be set because we always have an exclusive */ - if (eFileLock==SHARED_LOCK) { - pFile->eFileLock = eFileLock; - return SQLITE_OK; - } - - /* no, really, unlock. */ - if( robust_flock(pFile->h, LOCK_UN) ){ -#ifdef SQLITE_IGNORE_FLOCK_LOCK_ERRORS - return SQLITE_OK; -#endif /* SQLITE_IGNORE_FLOCK_LOCK_ERRORS */ - return SQLITE_IOERR_UNLOCK; - }else{ - pFile->eFileLock = NO_LOCK; - return SQLITE_OK; - } -} - -/* -** Close a file. -*/ -static int flockClose(sqlite3_file *id) { - int rc = SQLITE_OK; - if( id ){ - flockUnlock(id, NO_LOCK); - rc = closeUnixFile(id); - } - return rc; -} - -#endif /* SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORK */ - -/******************* End of the flock lock implementation ********************* -******************************************************************************/ - -/****************************************************************************** -************************ Begin Named Semaphore Locking ************************ -** -** Named semaphore locking is only supported on VxWorks. -** -** Semaphore locking is like dot-lock and flock in that it really only -** supports EXCLUSIVE locking. Only a single process can read or write -** the database file at a time. This reduces potential concurrency, but -** makes the lock implementation much easier. -*/ -#if OS_VXWORKS - -/* -** This routine checks if there is a RESERVED lock held on the specified -** file by this or any other process. If such a lock is held, set *pResOut -** to a non-zero value otherwise *pResOut is set to zero. The return value -** is set to SQLITE_OK unless an I/O error occurs during lock checking. -*/ -static int semCheckReservedLock(sqlite3_file *id, int *pResOut) { - int rc = SQLITE_OK; - int reserved = 0; - unixFile *pFile = (unixFile*)id; - - SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); - - assert( pFile ); - - /* Check if a thread in this process holds such a lock */ - if( pFile->eFileLock>SHARED_LOCK ){ - reserved = 1; - } - - /* Otherwise see if some other process holds it. */ - if( !reserved ){ - sem_t *pSem = pFile->pInode->pSem; - struct stat statBuf; - - if( sem_trywait(pSem)==-1 ){ - int tErrno = errno; - if( EAGAIN != tErrno ){ - rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_CHECKRESERVEDLOCK); - pFile->lastErrno = tErrno; - } else { - /* someone else has the lock when we are in NO_LOCK */ - reserved = (pFile->eFileLock < SHARED_LOCK); - } - }else{ - /* we could have it if we want it */ - sem_post(pSem); - } - } - OSTRACE(("TEST WR-LOCK %d %d %d (sem)\n", pFile->h, rc, reserved)); - - *pResOut = reserved; - return rc; -} - -/* -** Lock the file with the lock specified by parameter eFileLock - one -** of the following: -** -** (1) SHARED_LOCK -** (2) RESERVED_LOCK -** (3) PENDING_LOCK -** (4) EXCLUSIVE_LOCK -** -** Sometimes when requesting one lock state, additional lock states -** are inserted in between. The locking might fail on one of the later -** transitions leaving the lock state different from what it started but -** still short of its goal. The following chart shows the allowed -** transitions and the inserted intermediate states: -** -** UNLOCKED -> SHARED -** SHARED -> RESERVED -** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> (PENDING) -> EXCLUSIVE -** PENDING -> EXCLUSIVE -** -** Semaphore locks only really support EXCLUSIVE locks. We track intermediate -** lock states in the sqlite3_file structure, but all locks SHARED or -** above are really EXCLUSIVE locks and exclude all other processes from -** access the file. -** -** This routine will only increase a lock. Use the sqlite3OsUnlock() -** routine to lower a locking level. -*/ -static int semLock(sqlite3_file *id, int eFileLock) { - unixFile *pFile = (unixFile*)id; - int fd; - sem_t *pSem = pFile->pInode->pSem; - int rc = SQLITE_OK; - - /* if we already have a lock, it is exclusive. - ** Just adjust level and punt on outta here. */ - if (pFile->eFileLock > NO_LOCK) { - pFile->eFileLock = eFileLock; - rc = SQLITE_OK; - goto sem_end_lock; - } - - /* lock semaphore now but bail out when already locked. */ - if( sem_trywait(pSem)==-1 ){ - rc = SQLITE_BUSY; - goto sem_end_lock; - } - - /* got it, set the type and return ok */ - pFile->eFileLock = eFileLock; - - sem_end_lock: - return rc; -} - -/* -** Lower the locking level on file descriptor pFile to eFileLock. eFileLock -** must be either NO_LOCK or SHARED_LOCK. -** -** If the locking level of the file descriptor is already at or below -** the requested locking level, this routine is a no-op. -*/ -static int semUnlock(sqlite3_file *id, int eFileLock) { - unixFile *pFile = (unixFile*)id; - sem_t *pSem = pFile->pInode->pSem; - - assert( pFile ); - assert( pSem ); - OSTRACE(("UNLOCK %d %d was %d pid=%d (sem)\n", pFile->h, eFileLock, - pFile->eFileLock, getpid())); - assert( eFileLock<=SHARED_LOCK ); - - /* no-op if possible */ - if( pFile->eFileLock==eFileLock ){ - return SQLITE_OK; - } - - /* shared can just be set because we always have an exclusive */ - if (eFileLock==SHARED_LOCK) { - pFile->eFileLock = eFileLock; - return SQLITE_OK; - } - - /* no, really unlock. */ - if ( sem_post(pSem)==-1 ) { - int rc, tErrno = errno; - rc = sqliteErrorFromPosixError(tErrno, SQLITE_IOERR_UNLOCK); - if( IS_LOCK_ERROR(rc) ){ - pFile->lastErrno = tErrno; - } - return rc; - } - pFile->eFileLock = NO_LOCK; - return SQLITE_OK; -} - -/* - ** Close a file. - */ -static int semClose(sqlite3_file *id) { - if( id ){ - unixFile *pFile = (unixFile*)id; - semUnlock(id, NO_LOCK); - assert( pFile ); - unixEnterMutex(); - releaseInodeInfo(pFile); - unixLeaveMutex(); - closeUnixFile(id); - } - return SQLITE_OK; -} - -#endif /* OS_VXWORKS */ -/* -** Named semaphore locking is only available on VxWorks. -** -*************** End of the named semaphore lock implementation **************** -******************************************************************************/ - - -/****************************************************************************** -*************************** Begin AFP Locking ********************************* -** -** AFP is the Apple Filing Protocol. AFP is a network filesystem found -** on Apple Macintosh computers - both OS9 and OSX. -** -** Third-party implementations of AFP are available. But this code here -** only works on OSX. -*/ - -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE -/* -** The afpLockingContext structure contains all afp lock specific state -*/ -typedef struct afpLockingContext afpLockingContext; -struct afpLockingContext { - int reserved; - const char *dbPath; /* Name of the open file */ -}; - -struct ByteRangeLockPB2 -{ - unsigned long long offset; /* offset to first byte to lock */ - unsigned long long length; /* nbr of bytes to lock */ - unsigned long long retRangeStart; /* nbr of 1st byte locked if successful */ - unsigned char unLockFlag; /* 1 = unlock, 0 = lock */ - unsigned char startEndFlag; /* 1=rel to end of fork, 0=rel to start */ - int fd; /* file desc to assoc this lock with */ -}; - -#define afpfsByteRangeLock2FSCTL _IOWR('z', 23, struct ByteRangeLockPB2) - -/* -** This is a utility for setting or clearing a bit-range lock on an -** AFP filesystem. -** -** Return SQLITE_OK on success, SQLITE_BUSY on failure. -*/ -static int afpSetLock( - const char *path, /* Name of the file to be locked or unlocked */ - unixFile *pFile, /* Open file descriptor on path */ - unsigned long long offset, /* First byte to be locked */ - unsigned long long length, /* Number of bytes to lock */ - int setLockFlag /* True to set lock. False to clear lock */ -){ - struct ByteRangeLockPB2 pb; - int err; - - pb.unLockFlag = setLockFlag ? 0 : 1; - pb.startEndFlag = 0; - pb.offset = offset; - pb.length = length; - pb.fd = pFile->h; - - OSTRACE(("AFPSETLOCK [%s] for %d%s in range %llx:%llx\n", - (setLockFlag?"ON":"OFF"), pFile->h, (pb.fd==-1?"[testval-1]":""), - offset, length)); - err = fsctl(path, afpfsByteRangeLock2FSCTL, &pb, 0); - if ( err==-1 ) { - int rc; - int tErrno = errno; - OSTRACE(("AFPSETLOCK failed to fsctl() '%s' %d %s\n", - path, tErrno, strerror(tErrno))); -#ifdef SQLITE_IGNORE_AFP_LOCK_ERRORS - rc = SQLITE_BUSY; -#else - rc = sqliteErrorFromPosixError(tErrno, - setLockFlag ? SQLITE_IOERR_LOCK : SQLITE_IOERR_UNLOCK); -#endif /* SQLITE_IGNORE_AFP_LOCK_ERRORS */ - if( IS_LOCK_ERROR(rc) ){ - pFile->lastErrno = tErrno; - } - return rc; - } else { - return SQLITE_OK; - } -} - -/* -** This routine checks if there is a RESERVED lock held on the specified -** file by this or any other process. If such a lock is held, set *pResOut -** to a non-zero value otherwise *pResOut is set to zero. The return value -** is set to SQLITE_OK unless an I/O error occurs during lock checking. -*/ -static int afpCheckReservedLock(sqlite3_file *id, int *pResOut){ - int rc = SQLITE_OK; - int reserved = 0; - unixFile *pFile = (unixFile*)id; - afpLockingContext *context; - - SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); - - assert( pFile ); - context = (afpLockingContext *) pFile->lockingContext; - if( context->reserved ){ - *pResOut = 1; - return SQLITE_OK; - } - unixEnterMutex(); /* Because pFile->pInode is shared across threads */ - - /* Check if a thread in this process holds such a lock */ - if( pFile->pInode->eFileLock>SHARED_LOCK ){ - reserved = 1; - } - - /* Otherwise see if some other process holds it. - */ - if( !reserved ){ - /* lock the RESERVED byte */ - int lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1); - if( SQLITE_OK==lrc ){ - /* if we succeeded in taking the reserved lock, unlock it to restore - ** the original state */ - lrc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0); - } else { - /* if we failed to get the lock then someone else must have it */ - reserved = 1; - } - if( IS_LOCK_ERROR(lrc) ){ - rc=lrc; - } - } - - unixLeaveMutex(); - OSTRACE(("TEST WR-LOCK %d %d %d (afp)\n", pFile->h, rc, reserved)); - - *pResOut = reserved; - return rc; -} - -/* -** Lock the file with the lock specified by parameter eFileLock - one -** of the following: -** -** (1) SHARED_LOCK -** (2) RESERVED_LOCK -** (3) PENDING_LOCK -** (4) EXCLUSIVE_LOCK -** -** Sometimes when requesting one lock state, additional lock states -** are inserted in between. The locking might fail on one of the later -** transitions leaving the lock state different from what it started but -** still short of its goal. The following chart shows the allowed -** transitions and the inserted intermediate states: -** -** UNLOCKED -> SHARED -** SHARED -> RESERVED -** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> (PENDING) -> EXCLUSIVE -** PENDING -> EXCLUSIVE -** -** This routine will only increase a lock. Use the sqlite3OsUnlock() -** routine to lower a locking level. -*/ -static int afpLock(sqlite3_file *id, int eFileLock){ - int rc = SQLITE_OK; - unixFile *pFile = (unixFile*)id; - unixInodeInfo *pInode = pFile->pInode; - afpLockingContext *context = (afpLockingContext *) pFile->lockingContext; - - assert( pFile ); - OSTRACE(("LOCK %d %s was %s(%s,%d) pid=%d (afp)\n", pFile->h, - azFileLock(eFileLock), azFileLock(pFile->eFileLock), - azFileLock(pInode->eFileLock), pInode->nShared , getpid())); - - /* If there is already a lock of this type or more restrictive on the - ** unixFile, do nothing. Don't use the afp_end_lock: exit path, as - ** unixEnterMutex() hasn't been called yet. - */ - if( pFile->eFileLock>=eFileLock ){ - OSTRACE(("LOCK %d %s ok (already held) (afp)\n", pFile->h, - azFileLock(eFileLock))); - return SQLITE_OK; - } - - /* Make sure the locking sequence is correct - ** (1) We never move from unlocked to anything higher than shared lock. - ** (2) SQLite never explicitly requests a pendig lock. - ** (3) A shared lock is always held when a reserve lock is requested. - */ - assert( pFile->eFileLock!=NO_LOCK || eFileLock==SHARED_LOCK ); - assert( eFileLock!=PENDING_LOCK ); - assert( eFileLock!=RESERVED_LOCK || pFile->eFileLock==SHARED_LOCK ); - - /* This mutex is needed because pFile->pInode is shared across threads - */ - unixEnterMutex(); - pInode = pFile->pInode; - - /* If some thread using this PID has a lock via a different unixFile* - ** handle that precludes the requested lock, return BUSY. - */ - if( (pFile->eFileLock!=pInode->eFileLock && - (pInode->eFileLock>=PENDING_LOCK || eFileLock>SHARED_LOCK)) - ){ - rc = SQLITE_BUSY; - goto afp_end_lock; - } - - /* If a SHARED lock is requested, and some thread using this PID already - ** has a SHARED or RESERVED lock, then increment reference counts and - ** return SQLITE_OK. - */ - if( eFileLock==SHARED_LOCK && - (pInode->eFileLock==SHARED_LOCK || pInode->eFileLock==RESERVED_LOCK) ){ - assert( eFileLock==SHARED_LOCK ); - assert( pFile->eFileLock==0 ); - assert( pInode->nShared>0 ); - pFile->eFileLock = SHARED_LOCK; - pInode->nShared++; - pInode->nLock++; - goto afp_end_lock; - } - - /* A PENDING lock is needed before acquiring a SHARED lock and before - ** acquiring an EXCLUSIVE lock. For the SHARED lock, the PENDING will - ** be released. - */ - if( eFileLock==SHARED_LOCK - || (eFileLock==EXCLUSIVE_LOCK && pFile->eFileLockdbPath, pFile, PENDING_BYTE, 1, 1); - if (failed) { - rc = failed; - goto afp_end_lock; - } - } - - /* If control gets to this point, then actually go ahead and make - ** operating system calls for the specified lock. - */ - if( eFileLock==SHARED_LOCK ){ - int lrc1, lrc2, lrc1Errno = 0; - long lk, mask; - - assert( pInode->nShared==0 ); - assert( pInode->eFileLock==0 ); - - mask = (sizeof(long)==8) ? LARGEST_INT64 : 0x7fffffff; - /* Now get the read-lock SHARED_LOCK */ - /* note that the quality of the randomness doesn't matter that much */ - lk = random(); - pInode->sharedByte = (lk & mask)%(SHARED_SIZE - 1); - lrc1 = afpSetLock(context->dbPath, pFile, - SHARED_FIRST+pInode->sharedByte, 1, 1); - if( IS_LOCK_ERROR(lrc1) ){ - lrc1Errno = pFile->lastErrno; - } - /* Drop the temporary PENDING lock */ - lrc2 = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0); - - if( IS_LOCK_ERROR(lrc1) ) { - pFile->lastErrno = lrc1Errno; - rc = lrc1; - goto afp_end_lock; - } else if( IS_LOCK_ERROR(lrc2) ){ - rc = lrc2; - goto afp_end_lock; - } else if( lrc1 != SQLITE_OK ) { - rc = lrc1; - } else { - pFile->eFileLock = SHARED_LOCK; - pInode->nLock++; - pInode->nShared = 1; - } - }else if( eFileLock==EXCLUSIVE_LOCK && pInode->nShared>1 ){ - /* We are trying for an exclusive lock but another thread in this - ** same process is still holding a shared lock. */ - rc = SQLITE_BUSY; - }else{ - /* The request was for a RESERVED or EXCLUSIVE lock. It is - ** assumed that there is a SHARED or greater lock on the file - ** already. - */ - int failed = 0; - assert( 0!=pFile->eFileLock ); - if (eFileLock >= RESERVED_LOCK && pFile->eFileLock < RESERVED_LOCK) { - /* Acquire a RESERVED lock */ - failed = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1,1); - if( !failed ){ - context->reserved = 1; - } - } - if (!failed && eFileLock == EXCLUSIVE_LOCK) { - /* Acquire an EXCLUSIVE lock */ - - /* Remove the shared lock before trying the range. we'll need to - ** reestablish the shared lock if we can't get the afpUnlock - */ - if( !(failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST + - pInode->sharedByte, 1, 0)) ){ - int failed2 = SQLITE_OK; - /* now attemmpt to get the exclusive lock range */ - failed = afpSetLock(context->dbPath, pFile, SHARED_FIRST, - SHARED_SIZE, 1); - if( failed && (failed2 = afpSetLock(context->dbPath, pFile, - SHARED_FIRST + pInode->sharedByte, 1, 1)) ){ - /* Can't reestablish the shared lock. Sqlite can't deal, this is - ** a critical I/O error - */ - rc = ((failed & SQLITE_IOERR) == SQLITE_IOERR) ? failed2 : - SQLITE_IOERR_LOCK; - goto afp_end_lock; - } - }else{ - rc = failed; - } - } - if( failed ){ - rc = failed; - } - } - - if( rc==SQLITE_OK ){ - pFile->eFileLock = eFileLock; - pInode->eFileLock = eFileLock; - }else if( eFileLock==EXCLUSIVE_LOCK ){ - pFile->eFileLock = PENDING_LOCK; - pInode->eFileLock = PENDING_LOCK; - } - -afp_end_lock: - unixLeaveMutex(); - OSTRACE(("LOCK %d %s %s (afp)\n", pFile->h, azFileLock(eFileLock), - rc==SQLITE_OK ? "ok" : "failed")); - return rc; -} - -/* -** Lower the locking level on file descriptor pFile to eFileLock. eFileLock -** must be either NO_LOCK or SHARED_LOCK. -** -** If the locking level of the file descriptor is already at or below -** the requested locking level, this routine is a no-op. -*/ -static int afpUnlock(sqlite3_file *id, int eFileLock) { - int rc = SQLITE_OK; - unixFile *pFile = (unixFile*)id; - unixInodeInfo *pInode; - afpLockingContext *context = (afpLockingContext *) pFile->lockingContext; - int skipShared = 0; -#ifdef SQLITE_TEST - int h = pFile->h; -#endif - - assert( pFile ); - OSTRACE(("UNLOCK %d %d was %d(%d,%d) pid=%d (afp)\n", pFile->h, eFileLock, - pFile->eFileLock, pFile->pInode->eFileLock, pFile->pInode->nShared, - getpid())); - - assert( eFileLock<=SHARED_LOCK ); - if( pFile->eFileLock<=eFileLock ){ - return SQLITE_OK; - } - unixEnterMutex(); - pInode = pFile->pInode; - assert( pInode->nShared!=0 ); - if( pFile->eFileLock>SHARED_LOCK ){ - assert( pInode->eFileLock==pFile->eFileLock ); - SimulateIOErrorBenign(1); - SimulateIOError( h=(-1) ) - SimulateIOErrorBenign(0); - -#ifdef SQLITE_DEBUG - /* When reducing a lock such that other processes can start - ** reading the database file again, make sure that the - ** transaction counter was updated if any part of the database - ** file changed. If the transaction counter is not updated, - ** other connections to the same file might not realize that - ** the file has changed and hence might not know to flush their - ** cache. The use of a stale cache can lead to database corruption. - */ - assert( pFile->inNormalWrite==0 - || pFile->dbUpdate==0 - || pFile->transCntrChng==1 ); - pFile->inNormalWrite = 0; -#endif - - if( pFile->eFileLock==EXCLUSIVE_LOCK ){ - rc = afpSetLock(context->dbPath, pFile, SHARED_FIRST, SHARED_SIZE, 0); - if( rc==SQLITE_OK && (eFileLock==SHARED_LOCK || pInode->nShared>1) ){ - /* only re-establish the shared lock if necessary */ - int sharedLockByte = SHARED_FIRST+pInode->sharedByte; - rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 1); - } else { - skipShared = 1; - } - } - if( rc==SQLITE_OK && pFile->eFileLock>=PENDING_LOCK ){ - rc = afpSetLock(context->dbPath, pFile, PENDING_BYTE, 1, 0); - } - if( rc==SQLITE_OK && pFile->eFileLock>=RESERVED_LOCK && context->reserved ){ - rc = afpSetLock(context->dbPath, pFile, RESERVED_BYTE, 1, 0); - if( !rc ){ - context->reserved = 0; - } - } - if( rc==SQLITE_OK && (eFileLock==SHARED_LOCK || pInode->nShared>1)){ - pInode->eFileLock = SHARED_LOCK; - } - } - if( rc==SQLITE_OK && eFileLock==NO_LOCK ){ - - /* Decrement the shared lock counter. Release the lock using an - ** OS call only when all threads in this same process have released - ** the lock. - */ - unsigned long long sharedLockByte = SHARED_FIRST+pInode->sharedByte; - pInode->nShared--; - if( pInode->nShared==0 ){ - SimulateIOErrorBenign(1); - SimulateIOError( h=(-1) ) - SimulateIOErrorBenign(0); - if( !skipShared ){ - rc = afpSetLock(context->dbPath, pFile, sharedLockByte, 1, 0); - } - if( !rc ){ - pInode->eFileLock = NO_LOCK; - pFile->eFileLock = NO_LOCK; - } - } - if( rc==SQLITE_OK ){ - pInode->nLock--; - assert( pInode->nLock>=0 ); - if( pInode->nLock==0 ){ - closePendingFds(pFile); - } - } - } - - unixLeaveMutex(); - if( rc==SQLITE_OK ) pFile->eFileLock = eFileLock; - return rc; -} - -/* -** Close a file & cleanup AFP specific locking context -*/ -static int afpClose(sqlite3_file *id) { - int rc = SQLITE_OK; - if( id ){ - unixFile *pFile = (unixFile*)id; - afpUnlock(id, NO_LOCK); - unixEnterMutex(); - if( pFile->pInode && pFile->pInode->nLock ){ - /* If there are outstanding locks, do not actually close the file just - ** yet because that would clear those locks. Instead, add the file - ** descriptor to pInode->aPending. It will be automatically closed when - ** the last lock is cleared. - */ - setPendingFd(pFile); - } - releaseInodeInfo(pFile); - sqlite3_free(pFile->lockingContext); - rc = closeUnixFile(id); - unixLeaveMutex(); - } - return rc; -} - -#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */ -/* -** The code above is the AFP lock implementation. The code is specific -** to MacOSX and does not work on other unix platforms. No alternative -** is available. If you don't compile for a mac, then the "unix-afp" -** VFS is not available. -** -********************* End of the AFP lock implementation ********************** -******************************************************************************/ - -/****************************************************************************** -*************************** Begin NFS Locking ********************************/ - -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE -/* - ** Lower the locking level on file descriptor pFile to eFileLock. eFileLock - ** must be either NO_LOCK or SHARED_LOCK. - ** - ** If the locking level of the file descriptor is already at or below - ** the requested locking level, this routine is a no-op. - */ -static int nfsUnlock(sqlite3_file *id, int eFileLock){ - return posixUnlock(id, eFileLock, 1); -} - -#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */ -/* -** The code above is the NFS lock implementation. The code is specific -** to MacOSX and does not work on other unix platforms. No alternative -** is available. -** -********************* End of the NFS lock implementation ********************** -******************************************************************************/ - -/****************************************************************************** -**************** Non-locking sqlite3_file methods ***************************** -** -** The next division contains implementations for all methods of the -** sqlite3_file object other than the locking methods. The locking -** methods were defined in divisions above (one locking method per -** division). Those methods that are common to all locking modes -** are gather together into this division. -*/ - -/* -** Seek to the offset passed as the second argument, then read cnt -** bytes into pBuf. Return the number of bytes actually read. -** -** NB: If you define USE_PREAD or USE_PREAD64, then it might also -** be necessary to define _XOPEN_SOURCE to be 500. This varies from -** one system to another. Since SQLite does not define USE_PREAD -** any any form by default, we will not attempt to define _XOPEN_SOURCE. -** See tickets #2741 and #2681. -** -** To avoid stomping the errno value on a failed read the lastErrno value -** is set before returning. -*/ -static int seekAndRead(unixFile *id, sqlite3_int64 offset, void *pBuf, int cnt){ - int got; - int prior = 0; -#if (!defined(USE_PREAD) && !defined(USE_PREAD64)) - i64 newOffset; -#endif - TIMER_START; - assert( cnt==(cnt&0x1ffff) ); - assert( id->h>2 ); - cnt &= 0x1ffff; - do{ -#if defined(USE_PREAD) - got = osPread(id->h, pBuf, cnt, offset); - SimulateIOError( got = -1 ); -#elif defined(USE_PREAD64) - got = osPread64(id->h, pBuf, cnt, offset); - SimulateIOError( got = -1 ); -#else - newOffset = lseek(id->h, offset, SEEK_SET); - SimulateIOError( newOffset-- ); - if( newOffset!=offset ){ - if( newOffset == -1 ){ - ((unixFile*)id)->lastErrno = errno; - }else{ - ((unixFile*)id)->lastErrno = 0; - } - return -1; - } - got = osRead(id->h, pBuf, cnt); -#endif - if( got==cnt ) break; - if( got<0 ){ - if( errno==EINTR ){ got = 1; continue; } - prior = 0; - ((unixFile*)id)->lastErrno = errno; - break; - }else if( got>0 ){ - cnt -= got; - offset += got; - prior += got; - pBuf = (void*)(got + (char*)pBuf); - } - }while( got>0 ); - TIMER_END; - OSTRACE(("READ %-3d %5d %7lld %llu\n", - id->h, got+prior, offset-prior, TIMER_ELAPSED)); - return got+prior; -} - -/* -** Read data from a file into a buffer. Return SQLITE_OK if all -** bytes were read successfully and SQLITE_IOERR if anything goes -** wrong. -*/ -static int unixRead( - sqlite3_file *id, - void *pBuf, - int amt, - sqlite3_int64 offset -){ - unixFile *pFile = (unixFile *)id; - int got; - assert( id ); - assert( offset>=0 ); - assert( amt>0 ); - - /* If this is a database file (not a journal, master-journal or temp - ** file), the bytes in the locking range should never be read or written. */ -#if 0 - assert( pFile->pUnused==0 - || offset>=PENDING_BYTE+512 - || offset+amt<=PENDING_BYTE - ); -#endif - -#if SQLITE_MAX_MMAP_SIZE>0 - /* Deal with as much of this read request as possible by transfering - ** data from the memory mapping using memcpy(). */ - if( offsetmmapSize ){ - if( offset+amt <= pFile->mmapSize ){ - memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt); - return SQLITE_OK; - }else{ - int nCopy = pFile->mmapSize - offset; - memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy); - pBuf = &((u8 *)pBuf)[nCopy]; - amt -= nCopy; - offset += nCopy; - } - } -#endif - - got = seekAndRead(pFile, offset, pBuf, amt); - if( got==amt ){ - return SQLITE_OK; - }else if( got<0 ){ - /* lastErrno set by seekAndRead */ - return SQLITE_IOERR_READ; - }else{ - pFile->lastErrno = 0; /* not a system error */ - /* Unread parts of the buffer must be zero-filled */ - memset(&((char*)pBuf)[got], 0, amt-got); - return SQLITE_IOERR_SHORT_READ; - } -} - -/* -** Attempt to seek the file-descriptor passed as the first argument to -** absolute offset iOff, then attempt to write nBuf bytes of data from -** pBuf to it. If an error occurs, return -1 and set *piErrno. Otherwise, -** return the actual number of bytes written (which may be less than -** nBuf). -*/ -static int seekAndWriteFd( - int fd, /* File descriptor to write to */ - i64 iOff, /* File offset to begin writing at */ - const void *pBuf, /* Copy data from this buffer to the file */ - int nBuf, /* Size of buffer pBuf in bytes */ - int *piErrno /* OUT: Error number if error occurs */ -){ - int rc = 0; /* Value returned by system call */ - - assert( nBuf==(nBuf&0x1ffff) ); - assert( fd>2 ); - nBuf &= 0x1ffff; - TIMER_START; - -#if defined(USE_PREAD) - do{ rc = osPwrite(fd, pBuf, nBuf, iOff); }while( rc<0 && errno==EINTR ); -#elif defined(USE_PREAD64) - do{ rc = osPwrite64(fd, pBuf, nBuf, iOff);}while( rc<0 && errno==EINTR); -#else - do{ - i64 iSeek = lseek(fd, iOff, SEEK_SET); - SimulateIOError( iSeek-- ); - - if( iSeek!=iOff ){ - if( piErrno ) *piErrno = (iSeek==-1 ? errno : 0); - return -1; - } - rc = osWrite(fd, pBuf, nBuf); - }while( rc<0 && errno==EINTR ); -#endif - - TIMER_END; - OSTRACE(("WRITE %-3d %5d %7lld %llu\n", fd, rc, iOff, TIMER_ELAPSED)); - - if( rc<0 && piErrno ) *piErrno = errno; - return rc; -} - - -/* -** Seek to the offset in id->offset then read cnt bytes into pBuf. -** Return the number of bytes actually read. Update the offset. -** -** To avoid stomping the errno value on a failed write the lastErrno value -** is set before returning. -*/ -static int seekAndWrite(unixFile *id, i64 offset, const void *pBuf, int cnt){ - return seekAndWriteFd(id->h, offset, pBuf, cnt, &id->lastErrno); -} - - -/* -** Write data from a buffer into a file. Return SQLITE_OK on success -** or some other error code on failure. -*/ -static int unixWrite( - sqlite3_file *id, - const void *pBuf, - int amt, - sqlite3_int64 offset -){ - unixFile *pFile = (unixFile*)id; - int wrote = 0; - assert( id ); - assert( amt>0 ); - - /* If this is a database file (not a journal, master-journal or temp - ** file), the bytes in the locking range should never be read or written. */ -#if 0 - assert( pFile->pUnused==0 - || offset>=PENDING_BYTE+512 - || offset+amt<=PENDING_BYTE - ); -#endif - -#ifdef SQLITE_DEBUG - /* If we are doing a normal write to a database file (as opposed to - ** doing a hot-journal rollback or a write to some file other than a - ** normal database file) then record the fact that the database - ** has changed. If the transaction counter is modified, record that - ** fact too. - */ - if( pFile->inNormalWrite ){ - pFile->dbUpdate = 1; /* The database has been modified */ - if( offset<=24 && offset+amt>=27 ){ - int rc; - char oldCntr[4]; - SimulateIOErrorBenign(1); - rc = seekAndRead(pFile, 24, oldCntr, 4); - SimulateIOErrorBenign(0); - if( rc!=4 || memcmp(oldCntr, &((char*)pBuf)[24-offset], 4)!=0 ){ - pFile->transCntrChng = 1; /* The transaction counter has changed */ - } - } - } -#endif - -#if SQLITE_MAX_MMAP_SIZE>0 - /* Deal with as much of this write request as possible by transfering - ** data from the memory mapping using memcpy(). */ - if( offsetmmapSize ){ - if( offset+amt <= pFile->mmapSize ){ - memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt); - return SQLITE_OK; - }else{ - int nCopy = pFile->mmapSize - offset; - memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy); - pBuf = &((u8 *)pBuf)[nCopy]; - amt -= nCopy; - offset += nCopy; - } - } -#endif - - while( amt>0 && (wrote = seekAndWrite(pFile, offset, pBuf, amt))>0 ){ - amt -= wrote; - offset += wrote; - pBuf = &((char*)pBuf)[wrote]; - } - SimulateIOError(( wrote=(-1), amt=1 )); - SimulateDiskfullError(( wrote=0, amt=1 )); - - if( amt>0 ){ - if( wrote<0 && pFile->lastErrno!=ENOSPC ){ - /* lastErrno set by seekAndWrite */ - return SQLITE_IOERR_WRITE; - }else{ - pFile->lastErrno = 0; /* not a system error */ - return SQLITE_FULL; - } - } - - return SQLITE_OK; -} - -#ifdef SQLITE_TEST -/* -** Count the number of fullsyncs and normal syncs. This is used to test -** that syncs and fullsyncs are occurring at the right times. -*/ -SQLITE_API int sqlite3_sync_count = 0; -SQLITE_API int sqlite3_fullsync_count = 0; -#endif - -/* -** We do not trust systems to provide a working fdatasync(). Some do. -** Others do no. To be safe, we will stick with the (slightly slower) -** fsync(). If you know that your system does support fdatasync() correctly, -** then simply compile with -Dfdatasync=fdatasync -*/ -#if !defined(fdatasync) -# define fdatasync fsync -#endif - -/* -** Define HAVE_FULLFSYNC to 0 or 1 depending on whether or not -** the F_FULLFSYNC macro is defined. F_FULLFSYNC is currently -** only available on Mac OS X. But that could change. -*/ -#ifdef F_FULLFSYNC -# define HAVE_FULLFSYNC 1 -#else -# define HAVE_FULLFSYNC 0 -#endif - - -/* -** The fsync() system call does not work as advertised on many -** unix systems. The following procedure is an attempt to make -** it work better. -** -** The SQLITE_NO_SYNC macro disables all fsync()s. This is useful -** for testing when we want to run through the test suite quickly. -** You are strongly advised *not* to deploy with SQLITE_NO_SYNC -** enabled, however, since with SQLITE_NO_SYNC enabled, an OS crash -** or power failure will likely corrupt the database file. -** -** SQLite sets the dataOnly flag if the size of the file is unchanged. -** The idea behind dataOnly is that it should only write the file content -** to disk, not the inode. We only set dataOnly if the file size is -** unchanged since the file size is part of the inode. However, -** Ted Ts'o tells us that fdatasync() will also write the inode if the -** file size has changed. The only real difference between fdatasync() -** and fsync(), Ted tells us, is that fdatasync() will not flush the -** inode if the mtime or owner or other inode attributes have changed. -** We only care about the file size, not the other file attributes, so -** as far as SQLite is concerned, an fdatasync() is always adequate. -** So, we always use fdatasync() if it is available, regardless of -** the value of the dataOnly flag. -*/ -static int full_fsync(int fd, int fullSync, int dataOnly){ - int rc; - - /* The following "ifdef/elif/else/" block has the same structure as - ** the one below. It is replicated here solely to avoid cluttering - ** up the real code with the UNUSED_PARAMETER() macros. - */ -#ifdef SQLITE_NO_SYNC - UNUSED_PARAMETER(fd); - UNUSED_PARAMETER(fullSync); - UNUSED_PARAMETER(dataOnly); -#elif HAVE_FULLFSYNC - UNUSED_PARAMETER(dataOnly); -#else - UNUSED_PARAMETER(fullSync); - UNUSED_PARAMETER(dataOnly); -#endif - - /* Record the number of times that we do a normal fsync() and - ** FULLSYNC. This is used during testing to verify that this procedure - ** gets called with the correct arguments. - */ -#ifdef SQLITE_TEST - if( fullSync ) sqlite3_fullsync_count++; - sqlite3_sync_count++; -#endif - - /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a - ** no-op - */ -#ifdef SQLITE_NO_SYNC - rc = SQLITE_OK; -#elif HAVE_FULLFSYNC - if( fullSync ){ - rc = osFcntl(fd, F_FULLFSYNC, 0); - }else{ - rc = 1; - } - /* If the FULLFSYNC failed, fall back to attempting an fsync(). - ** It shouldn't be possible for fullfsync to fail on the local - ** file system (on OSX), so failure indicates that FULLFSYNC - ** isn't supported for this file system. So, attempt an fsync - ** and (for now) ignore the overhead of a superfluous fcntl call. - ** It'd be better to detect fullfsync support once and avoid - ** the fcntl call every time sync is called. - */ - if( rc ) rc = fsync(fd); - -#elif defined(__APPLE__) - /* fdatasync() on HFS+ doesn't yet flush the file size if it changed correctly - ** so currently we default to the macro that redefines fdatasync to fsync - */ - rc = fsync(fd); -#else - rc = fdatasync(fd); -#if OS_VXWORKS - if( rc==-1 && errno==ENOTSUP ){ - rc = fsync(fd); - } -#endif /* OS_VXWORKS */ -#endif /* ifdef SQLITE_NO_SYNC elif HAVE_FULLFSYNC */ - - if( OS_VXWORKS && rc!= -1 ){ - rc = 0; - } - return rc; -} - -/* -** Open a file descriptor to the directory containing file zFilename. -** If successful, *pFd is set to the opened file descriptor and -** SQLITE_OK is returned. If an error occurs, either SQLITE_NOMEM -** or SQLITE_CANTOPEN is returned and *pFd is set to an undefined -** value. -** -** The directory file descriptor is used for only one thing - to -** fsync() a directory to make sure file creation and deletion events -** are flushed to disk. Such fsyncs are not needed on newer -** journaling filesystems, but are required on older filesystems. -** -** This routine can be overridden using the xSetSysCall interface. -** The ability to override this routine was added in support of the -** chromium sandbox. Opening a directory is a security risk (we are -** told) so making it overrideable allows the chromium sandbox to -** replace this routine with a harmless no-op. To make this routine -** a no-op, replace it with a stub that returns SQLITE_OK but leaves -** *pFd set to a negative number. -** -** If SQLITE_OK is returned, the caller is responsible for closing -** the file descriptor *pFd using close(). -*/ -static int openDirectory(const char *zFilename, int *pFd){ - int ii; - int fd = -1; - char zDirname[MAX_PATHNAME+1]; - - sqlite3_snprintf(MAX_PATHNAME, zDirname, "%s", zFilename); - for(ii=(int)strlen(zDirname); ii>1 && zDirname[ii]!='/'; ii--); - if( ii>0 ){ - zDirname[ii] = '\0'; - fd = robust_open(zDirname, O_RDONLY|O_BINARY, 0); - if( fd>=0 ){ - OSTRACE(("OPENDIR %-3d %s\n", fd, zDirname)); - } - } - *pFd = fd; - return (fd>=0?SQLITE_OK:unixLogError(SQLITE_CANTOPEN_BKPT, "open", zDirname)); -} - -/* -** Make sure all writes to a particular file are committed to disk. -** -** If dataOnly==0 then both the file itself and its metadata (file -** size, access time, etc) are synced. If dataOnly!=0 then only the -** file data is synced. -** -** Under Unix, also make sure that the directory entry for the file -** has been created by fsync-ing the directory that contains the file. -** If we do not do this and we encounter a power failure, the directory -** entry for the journal might not exist after we reboot. The next -** SQLite to access the file will not know that the journal exists (because -** the directory entry for the journal was never created) and the transaction -** will not roll back - possibly leading to database corruption. -*/ -static int unixSync(sqlite3_file *id, int flags){ - int rc; - unixFile *pFile = (unixFile*)id; - - int isDataOnly = (flags&SQLITE_SYNC_DATAONLY); - int isFullsync = (flags&0x0F)==SQLITE_SYNC_FULL; - - /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */ - assert((flags&0x0F)==SQLITE_SYNC_NORMAL - || (flags&0x0F)==SQLITE_SYNC_FULL - ); - - /* Unix cannot, but some systems may return SQLITE_FULL from here. This - ** line is to test that doing so does not cause any problems. - */ - SimulateDiskfullError( return SQLITE_FULL ); - - assert( pFile ); - OSTRACE(("SYNC %-3d\n", pFile->h)); - rc = full_fsync(pFile->h, isFullsync, isDataOnly); - SimulateIOError( rc=1 ); - if( rc ){ - pFile->lastErrno = errno; - return unixLogError(SQLITE_IOERR_FSYNC, "full_fsync", pFile->zPath); - } - - /* Also fsync the directory containing the file if the DIRSYNC flag - ** is set. This is a one-time occurrence. Many systems (examples: AIX) - ** are unable to fsync a directory, so ignore errors on the fsync. - */ - if( pFile->ctrlFlags & UNIXFILE_DIRSYNC ){ - int dirfd; - OSTRACE(("DIRSYNC %s (have_fullfsync=%d fullsync=%d)\n", pFile->zPath, - HAVE_FULLFSYNC, isFullsync)); - rc = osOpenDirectory(pFile->zPath, &dirfd); - if( rc==SQLITE_OK && dirfd>=0 ){ - full_fsync(dirfd, 0, 0); - robust_close(pFile, dirfd, __LINE__); - }else if( rc==SQLITE_CANTOPEN ){ - rc = SQLITE_OK; - } - pFile->ctrlFlags &= ~UNIXFILE_DIRSYNC; - } - return rc; -} - -/* -** Truncate an open file to a specified size -*/ -static int unixTruncate(sqlite3_file *id, i64 nByte){ - unixFile *pFile = (unixFile *)id; - int rc; - assert( pFile ); - SimulateIOError( return SQLITE_IOERR_TRUNCATE ); - - /* If the user has configured a chunk-size for this file, truncate the - ** file so that it consists of an integer number of chunks (i.e. the - ** actual file size after the operation may be larger than the requested - ** size). - */ - if( pFile->szChunk>0 ){ - nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk; - } - - rc = robust_ftruncate(pFile->h, (off_t)nByte); - if( rc ){ - pFile->lastErrno = errno; - return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath); - }else{ -#ifdef SQLITE_DEBUG - /* If we are doing a normal write to a database file (as opposed to - ** doing a hot-journal rollback or a write to some file other than a - ** normal database file) and we truncate the file to zero length, - ** that effectively updates the change counter. This might happen - ** when restoring a database using the backup API from a zero-length - ** source. - */ - if( pFile->inNormalWrite && nByte==0 ){ - pFile->transCntrChng = 1; - } -#endif - -#if SQLITE_MAX_MMAP_SIZE>0 - /* If the file was just truncated to a size smaller than the currently - ** mapped region, reduce the effective mapping size as well. SQLite will - ** use read() and write() to access data beyond this point from now on. - */ - if( nBytemmapSize ){ - pFile->mmapSize = nByte; - } -#endif - - return SQLITE_OK; - } -} - -/* -** Determine the current size of a file in bytes -*/ -static int unixFileSize(sqlite3_file *id, i64 *pSize){ - int rc; - struct stat buf; - assert( id ); - rc = osFstat(((unixFile*)id)->h, &buf); - SimulateIOError( rc=1 ); - if( rc!=0 ){ - ((unixFile*)id)->lastErrno = errno; - return SQLITE_IOERR_FSTAT; - } - *pSize = buf.st_size; - - /* When opening a zero-size database, the findInodeInfo() procedure - ** writes a single byte into that file in order to work around a bug - ** in the OS-X msdos filesystem. In order to avoid problems with upper - ** layers, we need to report this file size as zero even though it is - ** really 1. Ticket #3260. - */ - if( *pSize==1 ) *pSize = 0; - - - return SQLITE_OK; -} - -#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) -/* -** Handler for proxy-locking file-control verbs. Defined below in the -** proxying locking division. -*/ -static int proxyFileControl(sqlite3_file*,int,void*); -#endif - -/* -** This function is called to handle the SQLITE_FCNTL_SIZE_HINT -** file-control operation. Enlarge the database to nBytes in size -** (rounded up to the next chunk-size). If the database is already -** nBytes or larger, this routine is a no-op. -*/ -static int fcntlSizeHint(unixFile *pFile, i64 nByte){ - if( pFile->szChunk>0 ){ - i64 nSize; /* Required file size */ - struct stat buf; /* Used to hold return values of fstat() */ - - if( osFstat(pFile->h, &buf) ) return SQLITE_IOERR_FSTAT; - - nSize = ((nByte+pFile->szChunk-1) / pFile->szChunk) * pFile->szChunk; - if( nSize>(i64)buf.st_size ){ - -#if defined(HAVE_POSIX_FALLOCATE) && HAVE_POSIX_FALLOCATE - /* The code below is handling the return value of osFallocate() - ** correctly. posix_fallocate() is defined to "returns zero on success, - ** or an error number on failure". See the manpage for details. */ - int err; - do{ - err = osFallocate(pFile->h, buf.st_size, nSize-buf.st_size); - }while( err==EINTR ); - if( err ) return SQLITE_IOERR_WRITE; -#else - /* If the OS does not have posix_fallocate(), fake it. First use - ** ftruncate() to set the file size, then write a single byte to - ** the last byte in each block within the extended region. This - ** is the same technique used by glibc to implement posix_fallocate() - ** on systems that do not have a real fallocate() system call. - */ - int nBlk = buf.st_blksize; /* File-system block size */ - i64 iWrite; /* Next offset to write to */ - - if( robust_ftruncate(pFile->h, nSize) ){ - pFile->lastErrno = errno; - return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath); - } - iWrite = ((buf.st_size + 2*nBlk - 1)/nBlk)*nBlk-1; - while( iWrite0 - if( pFile->mmapSizeMax>0 && nByte>pFile->mmapSize ){ - int rc; - if( pFile->szChunk<=0 ){ - if( robust_ftruncate(pFile->h, nByte) ){ - pFile->lastErrno = errno; - return unixLogError(SQLITE_IOERR_TRUNCATE, "ftruncate", pFile->zPath); - } - } - - rc = unixMapfile(pFile, nByte); - return rc; - } -#endif - - return SQLITE_OK; -} - -/* -** If *pArg is inititially negative then this is a query. Set *pArg to -** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set. -** -** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags. -*/ -static void unixModeBit(unixFile *pFile, unsigned char mask, int *pArg){ - if( *pArg<0 ){ - *pArg = (pFile->ctrlFlags & mask)!=0; - }else if( (*pArg)==0 ){ - pFile->ctrlFlags &= ~mask; - }else{ - pFile->ctrlFlags |= mask; - } -} - -/* Forward declaration */ -static int unixGetTempname(int nBuf, char *zBuf); - -/* -** Information and control of an open file handle. -*/ -static int unixFileControl(sqlite3_file *id, int op, void *pArg){ - unixFile *pFile = (unixFile*)id; - switch( op ){ - case SQLITE_FCNTL_LOCKSTATE: { - *(int*)pArg = pFile->eFileLock; - return SQLITE_OK; - } - case SQLITE_LAST_ERRNO: { - *(int*)pArg = pFile->lastErrno; - return SQLITE_OK; - } - case SQLITE_FCNTL_CHUNK_SIZE: { - pFile->szChunk = *(int *)pArg; - return SQLITE_OK; - } - case SQLITE_FCNTL_SIZE_HINT: { - int rc; - SimulateIOErrorBenign(1); - rc = fcntlSizeHint(pFile, *(i64 *)pArg); - SimulateIOErrorBenign(0); - return rc; - } - case SQLITE_FCNTL_PERSIST_WAL: { - unixModeBit(pFile, UNIXFILE_PERSIST_WAL, (int*)pArg); - return SQLITE_OK; - } - case SQLITE_FCNTL_POWERSAFE_OVERWRITE: { - unixModeBit(pFile, UNIXFILE_PSOW, (int*)pArg); - return SQLITE_OK; - } - case SQLITE_FCNTL_VFSNAME: { - *(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName); - return SQLITE_OK; - } - case SQLITE_FCNTL_TEMPFILENAME: { - char *zTFile = sqlite3_malloc( pFile->pVfs->mxPathname ); - if( zTFile ){ - unixGetTempname(pFile->pVfs->mxPathname, zTFile); - *(char**)pArg = zTFile; - } - return SQLITE_OK; - } - case SQLITE_FCNTL_HAS_MOVED: { - *(int*)pArg = fileHasMoved(pFile); - return SQLITE_OK; - } -#if SQLITE_MAX_MMAP_SIZE>0 - case SQLITE_FCNTL_MMAP_SIZE: { - i64 newLimit = *(i64*)pArg; - int rc = SQLITE_OK; - if( newLimit>sqlite3GlobalConfig.mxMmap ){ - newLimit = sqlite3GlobalConfig.mxMmap; - } - *(i64*)pArg = pFile->mmapSizeMax; - if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){ - pFile->mmapSizeMax = newLimit; - if( pFile->mmapSize>0 ){ - unixUnmapfile(pFile); - rc = unixMapfile(pFile, -1); - } - } - return rc; - } -#endif -#ifdef SQLITE_DEBUG - /* The pager calls this method to signal that it has done - ** a rollback and that the database is therefore unchanged and - ** it hence it is OK for the transaction change counter to be - ** unchanged. - */ - case SQLITE_FCNTL_DB_UNCHANGED: { - ((unixFile*)id)->dbUpdate = 0; - return SQLITE_OK; - } -#endif -#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) - case SQLITE_SET_LOCKPROXYFILE: - case SQLITE_GET_LOCKPROXYFILE: { - return proxyFileControl(id,op,pArg); - } -#endif /* SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) */ - } - return SQLITE_NOTFOUND; -} - -/* -** Return the sector size in bytes of the underlying block device for -** the specified file. This is almost always 512 bytes, but may be -** larger for some devices. -** -** SQLite code assumes this function cannot fail. It also assumes that -** if two files are created in the same file-system directory (i.e. -** a database and its journal file) that the sector size will be the -** same for both. -*/ -#ifndef __QNXNTO__ -static int unixSectorSize(sqlite3_file *NotUsed){ - UNUSED_PARAMETER(NotUsed); - return SQLITE_DEFAULT_SECTOR_SIZE; -} -#endif - -/* -** The following version of unixSectorSize() is optimized for QNX. -*/ -#ifdef __QNXNTO__ -#include -#include -static int unixSectorSize(sqlite3_file *id){ - unixFile *pFile = (unixFile*)id; - if( pFile->sectorSize == 0 ){ - struct statvfs fsInfo; - - /* Set defaults for non-supported filesystems */ - pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE; - pFile->deviceCharacteristics = 0; - if( fstatvfs(pFile->h, &fsInfo) == -1 ) { - return pFile->sectorSize; - } - - if( !strcmp(fsInfo.f_basetype, "tmp") ) { - pFile->sectorSize = fsInfo.f_bsize; - pFile->deviceCharacteristics = - SQLITE_IOCAP_ATOMIC4K | /* All ram filesystem writes are atomic */ - SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until - ** the write succeeds */ - SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind - ** so it is ordered */ - 0; - }else if( strstr(fsInfo.f_basetype, "etfs") ){ - pFile->sectorSize = fsInfo.f_bsize; - pFile->deviceCharacteristics = - /* etfs cluster size writes are atomic */ - (pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) | - SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until - ** the write succeeds */ - SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind - ** so it is ordered */ - 0; - }else if( !strcmp(fsInfo.f_basetype, "qnx6") ){ - pFile->sectorSize = fsInfo.f_bsize; - pFile->deviceCharacteristics = - SQLITE_IOCAP_ATOMIC | /* All filesystem writes are atomic */ - SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until - ** the write succeeds */ - SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind - ** so it is ordered */ - 0; - }else if( !strcmp(fsInfo.f_basetype, "qnx4") ){ - pFile->sectorSize = fsInfo.f_bsize; - pFile->deviceCharacteristics = - /* full bitset of atomics from max sector size and smaller */ - ((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 | - SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind - ** so it is ordered */ - 0; - }else if( strstr(fsInfo.f_basetype, "dos") ){ - pFile->sectorSize = fsInfo.f_bsize; - pFile->deviceCharacteristics = - /* full bitset of atomics from max sector size and smaller */ - ((pFile->sectorSize / 512 * SQLITE_IOCAP_ATOMIC512) << 1) - 2 | - SQLITE_IOCAP_SEQUENTIAL | /* The ram filesystem has no write behind - ** so it is ordered */ - 0; - }else{ - pFile->deviceCharacteristics = - SQLITE_IOCAP_ATOMIC512 | /* blocks are atomic */ - SQLITE_IOCAP_SAFE_APPEND | /* growing the file does not occur until - ** the write succeeds */ - 0; - } - } - /* Last chance verification. If the sector size isn't a multiple of 512 - ** then it isn't valid.*/ - if( pFile->sectorSize % 512 != 0 ){ - pFile->deviceCharacteristics = 0; - pFile->sectorSize = SQLITE_DEFAULT_SECTOR_SIZE; - } - return pFile->sectorSize; -} -#endif /* __QNXNTO__ */ - -/* -** Return the device characteristics for the file. -** -** This VFS is set up to return SQLITE_IOCAP_POWERSAFE_OVERWRITE by default. -** However, that choice is contraversial since technically the underlying -** file system does not always provide powersafe overwrites. (In other -** words, after a power-loss event, parts of the file that were never -** written might end up being altered.) However, non-PSOW behavior is very, -** very rare. And asserting PSOW makes a large reduction in the amount -** of required I/O for journaling, since a lot of padding is eliminated. -** Hence, while POWERSAFE_OVERWRITE is on by default, there is a file-control -** available to turn it off and URI query parameter available to turn it off. -*/ -static int unixDeviceCharacteristics(sqlite3_file *id){ - unixFile *p = (unixFile*)id; - int rc = 0; -#ifdef __QNXNTO__ - if( p->sectorSize==0 ) unixSectorSize(id); - rc = p->deviceCharacteristics; -#endif - if( p->ctrlFlags & UNIXFILE_PSOW ){ - rc |= SQLITE_IOCAP_POWERSAFE_OVERWRITE; - } - return rc; -} - -#ifndef SQLITE_OMIT_WAL - - -/* -** Object used to represent an shared memory buffer. -** -** When multiple threads all reference the same wal-index, each thread -** has its own unixShm object, but they all point to a single instance -** of this unixShmNode object. In other words, each wal-index is opened -** only once per process. -** -** Each unixShmNode object is connected to a single unixInodeInfo object. -** We could coalesce this object into unixInodeInfo, but that would mean -** every open file that does not use shared memory (in other words, most -** open files) would have to carry around this extra information. So -** the unixInodeInfo object contains a pointer to this unixShmNode object -** and the unixShmNode object is created only when needed. -** -** unixMutexHeld() must be true when creating or destroying -** this object or while reading or writing the following fields: -** -** nRef -** -** The following fields are read-only after the object is created: -** -** fid -** zFilename -** -** Either unixShmNode.mutex must be held or unixShmNode.nRef==0 and -** unixMutexHeld() is true when reading or writing any other field -** in this structure. -*/ -struct unixShmNode { - unixInodeInfo *pInode; /* unixInodeInfo that owns this SHM node */ - sqlite3_mutex *mutex; /* Mutex to access this object */ - char *zFilename; /* Name of the mmapped file */ - int h; /* Open file descriptor */ - int szRegion; /* Size of shared-memory regions */ - u16 nRegion; /* Size of array apRegion */ - u8 isReadonly; /* True if read-only */ - char **apRegion; /* Array of mapped shared-memory regions */ - int nRef; /* Number of unixShm objects pointing to this */ - unixShm *pFirst; /* All unixShm objects pointing to this */ -#ifdef SQLITE_DEBUG - u8 exclMask; /* Mask of exclusive locks held */ - u8 sharedMask; /* Mask of shared locks held */ - u8 nextShmId; /* Next available unixShm.id value */ -#endif -}; - -/* -** Structure used internally by this VFS to record the state of an -** open shared memory connection. -** -** The following fields are initialized when this object is created and -** are read-only thereafter: -** -** unixShm.pFile -** unixShm.id -** -** All other fields are read/write. The unixShm.pFile->mutex must be held -** while accessing any read/write fields. -*/ -struct unixShm { - unixShmNode *pShmNode; /* The underlying unixShmNode object */ - unixShm *pNext; /* Next unixShm with the same unixShmNode */ - u8 hasMutex; /* True if holding the unixShmNode mutex */ - u8 id; /* Id of this connection within its unixShmNode */ - u16 sharedMask; /* Mask of shared locks held */ - u16 exclMask; /* Mask of exclusive locks held */ -}; - -/* -** Constants used for locking -*/ -#define UNIX_SHM_BASE ((22+SQLITE_SHM_NLOCK)*4) /* first lock byte */ -#define UNIX_SHM_DMS (UNIX_SHM_BASE+SQLITE_SHM_NLOCK) /* deadman switch */ - -/* -** Apply posix advisory locks for all bytes from ofst through ofst+n-1. -** -** Locks block if the mask is exactly UNIX_SHM_C and are non-blocking -** otherwise. -*/ -static int unixShmSystemLock( - unixShmNode *pShmNode, /* Apply locks to this open shared-memory segment */ - int lockType, /* F_UNLCK, F_RDLCK, or F_WRLCK */ - int ofst, /* First byte of the locking range */ - int n /* Number of bytes to lock */ -){ - struct flock f; /* The posix advisory locking structure */ - int rc = SQLITE_OK; /* Result code form fcntl() */ - - /* Access to the unixShmNode object is serialized by the caller */ - assert( sqlite3_mutex_held(pShmNode->mutex) || pShmNode->nRef==0 ); - - /* Shared locks never span more than one byte */ - assert( n==1 || lockType!=F_RDLCK ); - - /* Locks are within range */ - assert( n>=1 && nh>=0 ){ - /* Initialize the locking parameters */ - memset(&f, 0, sizeof(f)); - f.l_type = lockType; - f.l_whence = SEEK_SET; - f.l_start = ofst; - f.l_len = n; - - rc = osFcntl(pShmNode->h, F_SETLK, &f); - rc = (rc!=(-1)) ? SQLITE_OK : SQLITE_BUSY; - } - - /* Update the global lock state and do debug tracing */ -#ifdef SQLITE_DEBUG - { u16 mask; - OSTRACE(("SHM-LOCK ")); - mask = ofst>31 ? 0xffff : (1<<(ofst+n)) - (1<exclMask &= ~mask; - pShmNode->sharedMask &= ~mask; - }else if( lockType==F_RDLCK ){ - OSTRACE(("read-lock %d ok", ofst)); - pShmNode->exclMask &= ~mask; - pShmNode->sharedMask |= mask; - }else{ - assert( lockType==F_WRLCK ); - OSTRACE(("write-lock %d ok", ofst)); - pShmNode->exclMask |= mask; - pShmNode->sharedMask &= ~mask; - } - }else{ - if( lockType==F_UNLCK ){ - OSTRACE(("unlock %d failed", ofst)); - }else if( lockType==F_RDLCK ){ - OSTRACE(("read-lock failed")); - }else{ - assert( lockType==F_WRLCK ); - OSTRACE(("write-lock %d failed", ofst)); - } - } - OSTRACE((" - afterwards %03x,%03x\n", - pShmNode->sharedMask, pShmNode->exclMask)); - } -#endif - - return rc; -} - - -/* -** Purge the unixShmNodeList list of all entries with unixShmNode.nRef==0. -** -** This is not a VFS shared-memory method; it is a utility function called -** by VFS shared-memory methods. -*/ -static void unixShmPurge(unixFile *pFd){ - unixShmNode *p = pFd->pInode->pShmNode; - assert( unixMutexHeld() ); - if( p && p->nRef==0 ){ - int i; - assert( p->pInode==pFd->pInode ); - sqlite3_mutex_free(p->mutex); - for(i=0; inRegion; i++){ - if( p->h>=0 ){ - osMunmap(p->apRegion[i], p->szRegion); - }else{ - sqlite3_free(p->apRegion[i]); - } - } - sqlite3_free(p->apRegion); - if( p->h>=0 ){ - robust_close(pFd, p->h, __LINE__); - p->h = -1; - } - p->pInode->pShmNode = 0; - sqlite3_free(p); - } -} - -/* -** Open a shared-memory area associated with open database file pDbFd. -** This particular implementation uses mmapped files. -** -** The file used to implement shared-memory is in the same directory -** as the open database file and has the same name as the open database -** file with the "-shm" suffix added. For example, if the database file -** is "/home/user1/config.db" then the file that is created and mmapped -** for shared memory will be called "/home/user1/config.db-shm". -** -** Another approach to is to use files in /dev/shm or /dev/tmp or an -** some other tmpfs mount. But if a file in a different directory -** from the database file is used, then differing access permissions -** or a chroot() might cause two different processes on the same -** database to end up using different files for shared memory - -** meaning that their memory would not really be shared - resulting -** in database corruption. Nevertheless, this tmpfs file usage -** can be enabled at compile-time using -DSQLITE_SHM_DIRECTORY="/dev/shm" -** or the equivalent. The use of the SQLITE_SHM_DIRECTORY compile-time -** option results in an incompatible build of SQLite; builds of SQLite -** that with differing SQLITE_SHM_DIRECTORY settings attempt to use the -** same database file at the same time, database corruption will likely -** result. The SQLITE_SHM_DIRECTORY compile-time option is considered -** "unsupported" and may go away in a future SQLite release. -** -** When opening a new shared-memory file, if no other instances of that -** file are currently open, in this process or in other processes, then -** the file must be truncated to zero length or have its header cleared. -** -** If the original database file (pDbFd) is using the "unix-excl" VFS -** that means that an exclusive lock is held on the database file and -** that no other processes are able to read or write the database. In -** that case, we do not really need shared memory. No shared memory -** file is created. The shared memory will be simulated with heap memory. -*/ -static int unixOpenSharedMemory(unixFile *pDbFd){ - struct unixShm *p = 0; /* The connection to be opened */ - struct unixShmNode *pShmNode; /* The underlying mmapped file */ - int rc; /* Result code */ - unixInodeInfo *pInode; /* The inode of fd */ - char *zShmFilename; /* Name of the file used for SHM */ - int nShmFilename; /* Size of the SHM filename in bytes */ - - /* Allocate space for the new unixShm object. */ - p = sqlite3_malloc( sizeof(*p) ); - if( p==0 ) return SQLITE_NOMEM; - memset(p, 0, sizeof(*p)); - assert( pDbFd->pShm==0 ); - - /* Check to see if a unixShmNode object already exists. Reuse an existing - ** one if present. Create a new one if necessary. - */ - unixEnterMutex(); - pInode = pDbFd->pInode; - pShmNode = pInode->pShmNode; - if( pShmNode==0 ){ - struct stat sStat; /* fstat() info for database file */ - - /* Call fstat() to figure out the permissions on the database file. If - ** a new *-shm file is created, an attempt will be made to create it - ** with the same permissions. - */ - if( osFstat(pDbFd->h, &sStat) && pInode->bProcessLock==0 ){ - rc = SQLITE_IOERR_FSTAT; - goto shm_open_err; - } - -#ifdef SQLITE_SHM_DIRECTORY - nShmFilename = sizeof(SQLITE_SHM_DIRECTORY) + 31; -#else - nShmFilename = 6 + (int)strlen(pDbFd->zPath); -#endif - pShmNode = sqlite3_malloc( sizeof(*pShmNode) + nShmFilename ); - if( pShmNode==0 ){ - rc = SQLITE_NOMEM; - goto shm_open_err; - } - memset(pShmNode, 0, sizeof(*pShmNode)+nShmFilename); - zShmFilename = pShmNode->zFilename = (char*)&pShmNode[1]; -#ifdef SQLITE_SHM_DIRECTORY - sqlite3_snprintf(nShmFilename, zShmFilename, - SQLITE_SHM_DIRECTORY "/sqlite-shm-%x-%x", - (u32)sStat.st_ino, (u32)sStat.st_dev); -#else - sqlite3_snprintf(nShmFilename, zShmFilename, "%s-shm", pDbFd->zPath); - sqlite3FileSuffix3(pDbFd->zPath, zShmFilename); -#endif - pShmNode->h = -1; - pDbFd->pInode->pShmNode = pShmNode; - pShmNode->pInode = pDbFd->pInode; - pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); - if( pShmNode->mutex==0 ){ - rc = SQLITE_NOMEM; - goto shm_open_err; - } - - if( pInode->bProcessLock==0 ){ - int openFlags = O_RDWR | O_CREAT; - if( sqlite3_uri_boolean(pDbFd->zPath, "readonly_shm", 0) ){ - openFlags = O_RDONLY; - pShmNode->isReadonly = 1; - } - pShmNode->h = robust_open(zShmFilename, openFlags, (sStat.st_mode&0777)); - if( pShmNode->h<0 ){ - rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename); - goto shm_open_err; - } - - /* If this process is running as root, make sure that the SHM file - ** is owned by the same user that owns the original database. Otherwise, - ** the original owner will not be able to connect. - */ - osFchown(pShmNode->h, sStat.st_uid, sStat.st_gid); - - /* Check to see if another process is holding the dead-man switch. - ** If not, truncate the file to zero length. - */ - rc = SQLITE_OK; - if( unixShmSystemLock(pShmNode, F_WRLCK, UNIX_SHM_DMS, 1)==SQLITE_OK ){ - if( robust_ftruncate(pShmNode->h, 0) ){ - rc = unixLogError(SQLITE_IOERR_SHMOPEN, "ftruncate", zShmFilename); - } - } - if( rc==SQLITE_OK ){ - rc = unixShmSystemLock(pShmNode, F_RDLCK, UNIX_SHM_DMS, 1); - } - if( rc ) goto shm_open_err; - } - } - - /* Make the new connection a child of the unixShmNode */ - p->pShmNode = pShmNode; -#ifdef SQLITE_DEBUG - p->id = pShmNode->nextShmId++; -#endif - pShmNode->nRef++; - pDbFd->pShm = p; - unixLeaveMutex(); - - /* The reference count on pShmNode has already been incremented under - ** the cover of the unixEnterMutex() mutex and the pointer from the - ** new (struct unixShm) object to the pShmNode has been set. All that is - ** left to do is to link the new object into the linked list starting - ** at pShmNode->pFirst. This must be done while holding the pShmNode->mutex - ** mutex. - */ - sqlite3_mutex_enter(pShmNode->mutex); - p->pNext = pShmNode->pFirst; - pShmNode->pFirst = p; - sqlite3_mutex_leave(pShmNode->mutex); - return SQLITE_OK; - - /* Jump here on any error */ -shm_open_err: - unixShmPurge(pDbFd); /* This call frees pShmNode if required */ - sqlite3_free(p); - unixLeaveMutex(); - return rc; -} - -/* -** This function is called to obtain a pointer to region iRegion of the -** shared-memory associated with the database file fd. Shared-memory regions -** are numbered starting from zero. Each shared-memory region is szRegion -** bytes in size. -** -** If an error occurs, an error code is returned and *pp is set to NULL. -** -** Otherwise, if the bExtend parameter is 0 and the requested shared-memory -** region has not been allocated (by any client, including one running in a -** separate process), then *pp is set to NULL and SQLITE_OK returned. If -** bExtend is non-zero and the requested shared-memory region has not yet -** been allocated, it is allocated by this function. -** -** If the shared-memory region has already been allocated or is allocated by -** this call as described above, then it is mapped into this processes -** address space (if it is not already), *pp is set to point to the mapped -** memory and SQLITE_OK returned. -*/ -static int unixShmMap( - sqlite3_file *fd, /* Handle open on database file */ - int iRegion, /* Region to retrieve */ - int szRegion, /* Size of regions */ - int bExtend, /* True to extend file if necessary */ - void volatile **pp /* OUT: Mapped memory */ -){ - unixFile *pDbFd = (unixFile*)fd; - unixShm *p; - unixShmNode *pShmNode; - int rc = SQLITE_OK; - - /* If the shared-memory file has not yet been opened, open it now. */ - if( pDbFd->pShm==0 ){ - rc = unixOpenSharedMemory(pDbFd); - if( rc!=SQLITE_OK ) return rc; - } - - p = pDbFd->pShm; - pShmNode = p->pShmNode; - sqlite3_mutex_enter(pShmNode->mutex); - assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 ); - assert( pShmNode->pInode==pDbFd->pInode ); - assert( pShmNode->h>=0 || pDbFd->pInode->bProcessLock==1 ); - assert( pShmNode->h<0 || pDbFd->pInode->bProcessLock==0 ); - - if( pShmNode->nRegion<=iRegion ){ - char **apNew; /* New apRegion[] array */ - int nByte = (iRegion+1)*szRegion; /* Minimum required file size */ - struct stat sStat; /* Used by fstat() */ - - pShmNode->szRegion = szRegion; - - if( pShmNode->h>=0 ){ - /* The requested region is not mapped into this processes address space. - ** Check to see if it has been allocated (i.e. if the wal-index file is - ** large enough to contain the requested region). - */ - if( osFstat(pShmNode->h, &sStat) ){ - rc = SQLITE_IOERR_SHMSIZE; - goto shmpage_out; - } - - if( sStat.st_sizeh, iPg*pgsz + pgsz-1, "", 1, 0)!=1 ){ - const char *zFile = pShmNode->zFilename; - rc = unixLogError(SQLITE_IOERR_SHMSIZE, "write", zFile); - goto shmpage_out; - } - } - } - } - } - - /* Map the requested memory region into this processes address space. */ - apNew = (char **)sqlite3_realloc( - pShmNode->apRegion, (iRegion+1)*sizeof(char *) - ); - if( !apNew ){ - rc = SQLITE_IOERR_NOMEM; - goto shmpage_out; - } - pShmNode->apRegion = apNew; - while(pShmNode->nRegion<=iRegion){ - void *pMem; - if( pShmNode->h>=0 ){ - pMem = osMmap(0, szRegion, - pShmNode->isReadonly ? PROT_READ : PROT_READ|PROT_WRITE, - MAP_SHARED, pShmNode->h, szRegion*(i64)pShmNode->nRegion - ); - if( pMem==MAP_FAILED ){ - rc = unixLogError(SQLITE_IOERR_SHMMAP, "mmap", pShmNode->zFilename); - goto shmpage_out; - } - }else{ - pMem = sqlite3_malloc(szRegion); - if( pMem==0 ){ - rc = SQLITE_NOMEM; - goto shmpage_out; - } - memset(pMem, 0, szRegion); - } - pShmNode->apRegion[pShmNode->nRegion] = pMem; - pShmNode->nRegion++; - } - } - -shmpage_out: - if( pShmNode->nRegion>iRegion ){ - *pp = pShmNode->apRegion[iRegion]; - }else{ - *pp = 0; - } - if( pShmNode->isReadonly && rc==SQLITE_OK ) rc = SQLITE_READONLY; - sqlite3_mutex_leave(pShmNode->mutex); - return rc; -} - -/* -** Change the lock state for a shared-memory segment. -** -** Note that the relationship between SHAREd and EXCLUSIVE locks is a little -** different here than in posix. In xShmLock(), one can go from unlocked -** to shared and back or from unlocked to exclusive and back. But one may -** not go from shared to exclusive or from exclusive to shared. -*/ -static int unixShmLock( - sqlite3_file *fd, /* Database file holding the shared memory */ - int ofst, /* First lock to acquire or release */ - int n, /* Number of locks to acquire or release */ - int flags /* What to do with the lock */ -){ - unixFile *pDbFd = (unixFile*)fd; /* Connection holding shared memory */ - unixShm *p = pDbFd->pShm; /* The shared memory being locked */ - unixShm *pX; /* For looping over all siblings */ - unixShmNode *pShmNode = p->pShmNode; /* The underlying file iNode */ - int rc = SQLITE_OK; /* Result code */ - u16 mask; /* Mask of locks to take or release */ - - assert( pShmNode==pDbFd->pInode->pShmNode ); - assert( pShmNode->pInode==pDbFd->pInode ); - assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK ); - assert( n>=1 ); - assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED) - || flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE) - || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED) - || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE) ); - assert( n==1 || (flags & SQLITE_SHM_EXCLUSIVE)!=0 ); - assert( pShmNode->h>=0 || pDbFd->pInode->bProcessLock==1 ); - assert( pShmNode->h<0 || pDbFd->pInode->bProcessLock==0 ); - - mask = (1<<(ofst+n)) - (1<1 || mask==(1<mutex); - if( flags & SQLITE_SHM_UNLOCK ){ - u16 allMask = 0; /* Mask of locks held by siblings */ - - /* See if any siblings hold this same lock */ - for(pX=pShmNode->pFirst; pX; pX=pX->pNext){ - if( pX==p ) continue; - assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 ); - allMask |= pX->sharedMask; - } - - /* Unlock the system-level locks */ - if( (mask & allMask)==0 ){ - rc = unixShmSystemLock(pShmNode, F_UNLCK, ofst+UNIX_SHM_BASE, n); - }else{ - rc = SQLITE_OK; - } - - /* Undo the local locks */ - if( rc==SQLITE_OK ){ - p->exclMask &= ~mask; - p->sharedMask &= ~mask; - } - }else if( flags & SQLITE_SHM_SHARED ){ - u16 allShared = 0; /* Union of locks held by connections other than "p" */ - - /* Find out which shared locks are already held by sibling connections. - ** If any sibling already holds an exclusive lock, go ahead and return - ** SQLITE_BUSY. - */ - for(pX=pShmNode->pFirst; pX; pX=pX->pNext){ - if( (pX->exclMask & mask)!=0 ){ - rc = SQLITE_BUSY; - break; - } - allShared |= pX->sharedMask; - } - - /* Get shared locks at the system level, if necessary */ - if( rc==SQLITE_OK ){ - if( (allShared & mask)==0 ){ - rc = unixShmSystemLock(pShmNode, F_RDLCK, ofst+UNIX_SHM_BASE, n); - }else{ - rc = SQLITE_OK; - } - } - - /* Get the local shared locks */ - if( rc==SQLITE_OK ){ - p->sharedMask |= mask; - } - }else{ - /* Make sure no sibling connections hold locks that will block this - ** lock. If any do, return SQLITE_BUSY right away. - */ - for(pX=pShmNode->pFirst; pX; pX=pX->pNext){ - if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){ - rc = SQLITE_BUSY; - break; - } - } - - /* Get the exclusive locks at the system level. Then if successful - ** also mark the local connection as being locked. - */ - if( rc==SQLITE_OK ){ - rc = unixShmSystemLock(pShmNode, F_WRLCK, ofst+UNIX_SHM_BASE, n); - if( rc==SQLITE_OK ){ - assert( (p->sharedMask & mask)==0 ); - p->exclMask |= mask; - } - } - } - sqlite3_mutex_leave(pShmNode->mutex); - OSTRACE(("SHM-LOCK shmid-%d, pid-%d got %03x,%03x\n", - p->id, getpid(), p->sharedMask, p->exclMask)); - return rc; -} - -/* -** Implement a memory barrier or memory fence on shared memory. -** -** All loads and stores begun before the barrier must complete before -** any load or store begun after the barrier. -*/ -static void unixShmBarrier( - sqlite3_file *fd /* Database file holding the shared memory */ -){ - UNUSED_PARAMETER(fd); - unixEnterMutex(); - unixLeaveMutex(); -} - -/* -** Close a connection to shared-memory. Delete the underlying -** storage if deleteFlag is true. -** -** If there is no shared memory associated with the connection then this -** routine is a harmless no-op. -*/ -static int unixShmUnmap( - sqlite3_file *fd, /* The underlying database file */ - int deleteFlag /* Delete shared-memory if true */ -){ - unixShm *p; /* The connection to be closed */ - unixShmNode *pShmNode; /* The underlying shared-memory file */ - unixShm **pp; /* For looping over sibling connections */ - unixFile *pDbFd; /* The underlying database file */ - - pDbFd = (unixFile*)fd; - p = pDbFd->pShm; - if( p==0 ) return SQLITE_OK; - pShmNode = p->pShmNode; - - assert( pShmNode==pDbFd->pInode->pShmNode ); - assert( pShmNode->pInode==pDbFd->pInode ); - - /* Remove connection p from the set of connections associated - ** with pShmNode */ - sqlite3_mutex_enter(pShmNode->mutex); - for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){} - *pp = p->pNext; - - /* Free the connection p */ - sqlite3_free(p); - pDbFd->pShm = 0; - sqlite3_mutex_leave(pShmNode->mutex); - - /* If pShmNode->nRef has reached 0, then close the underlying - ** shared-memory file, too */ - unixEnterMutex(); - assert( pShmNode->nRef>0 ); - pShmNode->nRef--; - if( pShmNode->nRef==0 ){ - if( deleteFlag && pShmNode->h>=0 ) osUnlink(pShmNode->zFilename); - unixShmPurge(pDbFd); - } - unixLeaveMutex(); - - return SQLITE_OK; -} - - -#else -# define unixShmMap 0 -# define unixShmLock 0 -# define unixShmBarrier 0 -# define unixShmUnmap 0 -#endif /* #ifndef SQLITE_OMIT_WAL */ - -#if SQLITE_MAX_MMAP_SIZE>0 -/* -** If it is currently memory mapped, unmap file pFd. -*/ -static void unixUnmapfile(unixFile *pFd){ - assert( pFd->nFetchOut==0 ); - if( pFd->pMapRegion ){ - osMunmap(pFd->pMapRegion, pFd->mmapSizeActual); - pFd->pMapRegion = 0; - pFd->mmapSize = 0; - pFd->mmapSizeActual = 0; - } -} - -/* -** Return the system page size. -*/ -static int unixGetPagesize(void){ -#if HAVE_MREMAP - return 512; -#elif defined(_BSD_SOURCE) - return getpagesize(); -#else - return (int)sysconf(_SC_PAGESIZE); -#endif -} - -/* -** Attempt to set the size of the memory mapping maintained by file -** descriptor pFd to nNew bytes. Any existing mapping is discarded. -** -** If successful, this function sets the following variables: -** -** unixFile.pMapRegion -** unixFile.mmapSize -** unixFile.mmapSizeActual -** -** If unsuccessful, an error message is logged via sqlite3_log() and -** the three variables above are zeroed. In this case SQLite should -** continue accessing the database using the xRead() and xWrite() -** methods. -*/ -static void unixRemapfile( - unixFile *pFd, /* File descriptor object */ - i64 nNew /* Required mapping size */ -){ - const char *zErr = "mmap"; - int h = pFd->h; /* File descriptor open on db file */ - u8 *pOrig = (u8 *)pFd->pMapRegion; /* Pointer to current file mapping */ - i64 nOrig = pFd->mmapSizeActual; /* Size of pOrig region in bytes */ - u8 *pNew = 0; /* Location of new mapping */ - int flags = PROT_READ; /* Flags to pass to mmap() */ - - assert( pFd->nFetchOut==0 ); - assert( nNew>pFd->mmapSize ); - assert( nNew<=pFd->mmapSizeMax ); - assert( nNew>0 ); - assert( pFd->mmapSizeActual>=pFd->mmapSize ); - assert( MAP_FAILED!=0 ); - - if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE; - - if( pOrig ){ - const int szSyspage = unixGetPagesize(); - i64 nReuse = (pFd->mmapSize & ~(szSyspage-1)); - u8 *pReq = &pOrig[nReuse]; - - /* Unmap any pages of the existing mapping that cannot be reused. */ - if( nReuse!=nOrig ){ - osMunmap(pReq, nOrig-nReuse); - } - -#if HAVE_MREMAP - pNew = osMremap(pOrig, nReuse, nNew, MREMAP_MAYMOVE); - zErr = "mremap"; -#else - pNew = osMmap(pReq, nNew-nReuse, flags, MAP_SHARED, h, nReuse); - if( pNew!=MAP_FAILED ){ - if( pNew!=pReq ){ - osMunmap(pNew, nNew - nReuse); - pNew = 0; - }else{ - pNew = pOrig; - } - } -#endif - - /* The attempt to extend the existing mapping failed. Free it. */ - if( pNew==MAP_FAILED || pNew==0 ){ - osMunmap(pOrig, nReuse); - } - } - - /* If pNew is still NULL, try to create an entirely new mapping. */ - if( pNew==0 ){ - pNew = osMmap(0, nNew, flags, MAP_SHARED, h, 0); - } - - if( pNew==MAP_FAILED ){ - pNew = 0; - nNew = 0; - unixLogError(SQLITE_OK, zErr, pFd->zPath); - - /* If the mmap() above failed, assume that all subsequent mmap() calls - ** will probably fail too. Fall back to using xRead/xWrite exclusively - ** in this case. */ - pFd->mmapSizeMax = 0; - } - pFd->pMapRegion = (void *)pNew; - pFd->mmapSize = pFd->mmapSizeActual = nNew; -} - -/* -** Memory map or remap the file opened by file-descriptor pFd (if the file -** is already mapped, the existing mapping is replaced by the new). Or, if -** there already exists a mapping for this file, and there are still -** outstanding xFetch() references to it, this function is a no-op. -** -** If parameter nByte is non-negative, then it is the requested size of -** the mapping to create. Otherwise, if nByte is less than zero, then the -** requested size is the size of the file on disk. The actual size of the -** created mapping is either the requested size or the value configured -** using SQLITE_FCNTL_MMAP_LIMIT, whichever is smaller. -** -** SQLITE_OK is returned if no error occurs (even if the mapping is not -** recreated as a result of outstanding references) or an SQLite error -** code otherwise. -*/ -static int unixMapfile(unixFile *pFd, i64 nByte){ - i64 nMap = nByte; - int rc; - - assert( nMap>=0 || pFd->nFetchOut==0 ); - if( pFd->nFetchOut>0 ) return SQLITE_OK; - - if( nMap<0 ){ - struct stat statbuf; /* Low-level file information */ - rc = osFstat(pFd->h, &statbuf); - if( rc!=SQLITE_OK ){ - return SQLITE_IOERR_FSTAT; - } - nMap = statbuf.st_size; - } - if( nMap>pFd->mmapSizeMax ){ - nMap = pFd->mmapSizeMax; - } - - if( nMap!=pFd->mmapSize ){ - if( nMap>0 ){ - unixRemapfile(pFd, nMap); - }else{ - unixUnmapfile(pFd); - } - } - - return SQLITE_OK; -} -#endif /* SQLITE_MAX_MMAP_SIZE>0 */ - -/* -** If possible, return a pointer to a mapping of file fd starting at offset -** iOff. The mapping must be valid for at least nAmt bytes. -** -** If such a pointer can be obtained, store it in *pp and return SQLITE_OK. -** Or, if one cannot but no error occurs, set *pp to 0 and return SQLITE_OK. -** Finally, if an error does occur, return an SQLite error code. The final -** value of *pp is undefined in this case. -** -** If this function does return a pointer, the caller must eventually -** release the reference by calling unixUnfetch(). -*/ -static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ -#if SQLITE_MAX_MMAP_SIZE>0 - unixFile *pFd = (unixFile *)fd; /* The underlying database file */ -#endif - *pp = 0; - -#if SQLITE_MAX_MMAP_SIZE>0 - if( pFd->mmapSizeMax>0 ){ - if( pFd->pMapRegion==0 ){ - int rc = unixMapfile(pFd, -1); - if( rc!=SQLITE_OK ) return rc; - } - if( pFd->mmapSize >= iOff+nAmt ){ - *pp = &((u8 *)pFd->pMapRegion)[iOff]; - pFd->nFetchOut++; - } - } -#endif - return SQLITE_OK; -} - -/* -** If the third argument is non-NULL, then this function releases a -** reference obtained by an earlier call to unixFetch(). The second -** argument passed to this function must be the same as the corresponding -** argument that was passed to the unixFetch() invocation. -** -** Or, if the third argument is NULL, then this function is being called -** to inform the VFS layer that, according to POSIX, any existing mapping -** may now be invalid and should be unmapped. -*/ -static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){ -#if SQLITE_MAX_MMAP_SIZE>0 - unixFile *pFd = (unixFile *)fd; /* The underlying database file */ - UNUSED_PARAMETER(iOff); - - /* If p==0 (unmap the entire file) then there must be no outstanding - ** xFetch references. Or, if p!=0 (meaning it is an xFetch reference), - ** then there must be at least one outstanding. */ - assert( (p==0)==(pFd->nFetchOut==0) ); - - /* If p!=0, it must match the iOff value. */ - assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] ); - - if( p ){ - pFd->nFetchOut--; - }else{ - unixUnmapfile(pFd); - } - - assert( pFd->nFetchOut>=0 ); -#else - UNUSED_PARAMETER(fd); - UNUSED_PARAMETER(p); - UNUSED_PARAMETER(iOff); -#endif - return SQLITE_OK; -} - -/* -** Here ends the implementation of all sqlite3_file methods. -** -********************** End sqlite3_file Methods ******************************* -******************************************************************************/ - -/* -** This division contains definitions of sqlite3_io_methods objects that -** implement various file locking strategies. It also contains definitions -** of "finder" functions. A finder-function is used to locate the appropriate -** sqlite3_io_methods object for a particular database file. The pAppData -** field of the sqlite3_vfs VFS objects are initialized to be pointers to -** the correct finder-function for that VFS. -** -** Most finder functions return a pointer to a fixed sqlite3_io_methods -** object. The only interesting finder-function is autolockIoFinder, which -** looks at the filesystem type and tries to guess the best locking -** strategy from that. -** -** For finder-funtion F, two objects are created: -** -** (1) The real finder-function named "FImpt()". -** -** (2) A constant pointer to this function named just "F". -** -** -** A pointer to the F pointer is used as the pAppData value for VFS -** objects. We have to do this instead of letting pAppData point -** directly at the finder-function since C90 rules prevent a void* -** from be cast into a function pointer. -** -** -** Each instance of this macro generates two objects: -** -** * A constant sqlite3_io_methods object call METHOD that has locking -** methods CLOSE, LOCK, UNLOCK, CKRESLOCK. -** -** * An I/O method finder function called FINDER that returns a pointer -** to the METHOD object in the previous bullet. -*/ -#define IOMETHODS(FINDER, METHOD, VERSION, CLOSE, LOCK, UNLOCK, CKLOCK) \ -static const sqlite3_io_methods METHOD = { \ - VERSION, /* iVersion */ \ - CLOSE, /* xClose */ \ - unixRead, /* xRead */ \ - unixWrite, /* xWrite */ \ - unixTruncate, /* xTruncate */ \ - unixSync, /* xSync */ \ - unixFileSize, /* xFileSize */ \ - LOCK, /* xLock */ \ - UNLOCK, /* xUnlock */ \ - CKLOCK, /* xCheckReservedLock */ \ - unixFileControl, /* xFileControl */ \ - unixSectorSize, /* xSectorSize */ \ - unixDeviceCharacteristics, /* xDeviceCapabilities */ \ - unixShmMap, /* xShmMap */ \ - unixShmLock, /* xShmLock */ \ - unixShmBarrier, /* xShmBarrier */ \ - unixShmUnmap, /* xShmUnmap */ \ - unixFetch, /* xFetch */ \ - unixUnfetch, /* xUnfetch */ \ -}; \ -static const sqlite3_io_methods *FINDER##Impl(const char *z, unixFile *p){ \ - UNUSED_PARAMETER(z); UNUSED_PARAMETER(p); \ - return &METHOD; \ -} \ -static const sqlite3_io_methods *(*const FINDER)(const char*,unixFile *p) \ - = FINDER##Impl; - -/* -** Here are all of the sqlite3_io_methods objects for each of the -** locking strategies. Functions that return pointers to these methods -** are also created. -*/ -IOMETHODS( - posixIoFinder, /* Finder function name */ - posixIoMethods, /* sqlite3_io_methods object name */ - 3, /* shared memory and mmap are enabled */ - unixClose, /* xClose method */ - unixLock, /* xLock method */ - unixUnlock, /* xUnlock method */ - unixCheckReservedLock /* xCheckReservedLock method */ -) -IOMETHODS( - nolockIoFinder, /* Finder function name */ - nolockIoMethods, /* sqlite3_io_methods object name */ - 1, /* shared memory is disabled */ - nolockClose, /* xClose method */ - nolockLock, /* xLock method */ - nolockUnlock, /* xUnlock method */ - nolockCheckReservedLock /* xCheckReservedLock method */ -) -IOMETHODS( - dotlockIoFinder, /* Finder function name */ - dotlockIoMethods, /* sqlite3_io_methods object name */ - 1, /* shared memory is disabled */ - dotlockClose, /* xClose method */ - dotlockLock, /* xLock method */ - dotlockUnlock, /* xUnlock method */ - dotlockCheckReservedLock /* xCheckReservedLock method */ -) - -#if SQLITE_ENABLE_LOCKING_STYLE && !OS_VXWORKS -IOMETHODS( - flockIoFinder, /* Finder function name */ - flockIoMethods, /* sqlite3_io_methods object name */ - 1, /* shared memory is disabled */ - flockClose, /* xClose method */ - flockLock, /* xLock method */ - flockUnlock, /* xUnlock method */ - flockCheckReservedLock /* xCheckReservedLock method */ -) -#endif - -#if OS_VXWORKS -IOMETHODS( - semIoFinder, /* Finder function name */ - semIoMethods, /* sqlite3_io_methods object name */ - 1, /* shared memory is disabled */ - semClose, /* xClose method */ - semLock, /* xLock method */ - semUnlock, /* xUnlock method */ - semCheckReservedLock /* xCheckReservedLock method */ -) -#endif - -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE -IOMETHODS( - afpIoFinder, /* Finder function name */ - afpIoMethods, /* sqlite3_io_methods object name */ - 1, /* shared memory is disabled */ - afpClose, /* xClose method */ - afpLock, /* xLock method */ - afpUnlock, /* xUnlock method */ - afpCheckReservedLock /* xCheckReservedLock method */ -) -#endif - -/* -** The proxy locking method is a "super-method" in the sense that it -** opens secondary file descriptors for the conch and lock files and -** it uses proxy, dot-file, AFP, and flock() locking methods on those -** secondary files. For this reason, the division that implements -** proxy locking is located much further down in the file. But we need -** to go ahead and define the sqlite3_io_methods and finder function -** for proxy locking here. So we forward declare the I/O methods. -*/ -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE -static int proxyClose(sqlite3_file*); -static int proxyLock(sqlite3_file*, int); -static int proxyUnlock(sqlite3_file*, int); -static int proxyCheckReservedLock(sqlite3_file*, int*); -IOMETHODS( - proxyIoFinder, /* Finder function name */ - proxyIoMethods, /* sqlite3_io_methods object name */ - 1, /* shared memory is disabled */ - proxyClose, /* xClose method */ - proxyLock, /* xLock method */ - proxyUnlock, /* xUnlock method */ - proxyCheckReservedLock /* xCheckReservedLock method */ -) -#endif - -/* nfs lockd on OSX 10.3+ doesn't clear write locks when a read lock is set */ -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE -IOMETHODS( - nfsIoFinder, /* Finder function name */ - nfsIoMethods, /* sqlite3_io_methods object name */ - 1, /* shared memory is disabled */ - unixClose, /* xClose method */ - unixLock, /* xLock method */ - nfsUnlock, /* xUnlock method */ - unixCheckReservedLock /* xCheckReservedLock method */ -) -#endif - -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE -/* -** This "finder" function attempts to determine the best locking strategy -** for the database file "filePath". It then returns the sqlite3_io_methods -** object that implements that strategy. -** -** This is for MacOSX only. -*/ -static const sqlite3_io_methods *autolockIoFinderImpl( - const char *filePath, /* name of the database file */ - unixFile *pNew /* open file object for the database file */ -){ - static const struct Mapping { - const char *zFilesystem; /* Filesystem type name */ - const sqlite3_io_methods *pMethods; /* Appropriate locking method */ - } aMap[] = { - { "hfs", &posixIoMethods }, - { "ufs", &posixIoMethods }, - { "afpfs", &afpIoMethods }, - { "smbfs", &afpIoMethods }, - { "webdav", &nolockIoMethods }, - { 0, 0 } - }; - int i; - struct statfs fsInfo; - struct flock lockInfo; - - if( !filePath ){ - /* If filePath==NULL that means we are dealing with a transient file - ** that does not need to be locked. */ - return &nolockIoMethods; - } - if( statfs(filePath, &fsInfo) != -1 ){ - if( fsInfo.f_flags & MNT_RDONLY ){ - return &nolockIoMethods; - } - for(i=0; aMap[i].zFilesystem; i++){ - if( strcmp(fsInfo.f_fstypename, aMap[i].zFilesystem)==0 ){ - return aMap[i].pMethods; - } - } - } - - /* Default case. Handles, amongst others, "nfs". - ** Test byte-range lock using fcntl(). If the call succeeds, - ** assume that the file-system supports POSIX style locks. - */ - lockInfo.l_len = 1; - lockInfo.l_start = 0; - lockInfo.l_whence = SEEK_SET; - lockInfo.l_type = F_RDLCK; - if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) { - if( strcmp(fsInfo.f_fstypename, "nfs")==0 ){ - return &nfsIoMethods; - } else { - return &posixIoMethods; - } - }else{ - return &dotlockIoMethods; - } -} -static const sqlite3_io_methods - *(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl; - -#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */ - -#if OS_VXWORKS && SQLITE_ENABLE_LOCKING_STYLE -/* -** This "finder" function attempts to determine the best locking strategy -** for the database file "filePath". It then returns the sqlite3_io_methods -** object that implements that strategy. -** -** This is for VXWorks only. -*/ -static const sqlite3_io_methods *autolockIoFinderImpl( - const char *filePath, /* name of the database file */ - unixFile *pNew /* the open file object */ -){ - struct flock lockInfo; - - if( !filePath ){ - /* If filePath==NULL that means we are dealing with a transient file - ** that does not need to be locked. */ - return &nolockIoMethods; - } - - /* Test if fcntl() is supported and use POSIX style locks. - ** Otherwise fall back to the named semaphore method. - */ - lockInfo.l_len = 1; - lockInfo.l_start = 0; - lockInfo.l_whence = SEEK_SET; - lockInfo.l_type = F_RDLCK; - if( osFcntl(pNew->h, F_GETLK, &lockInfo)!=-1 ) { - return &posixIoMethods; - }else{ - return &semIoMethods; - } -} -static const sqlite3_io_methods - *(*const autolockIoFinder)(const char*,unixFile*) = autolockIoFinderImpl; - -#endif /* OS_VXWORKS && SQLITE_ENABLE_LOCKING_STYLE */ - -/* -** An abstract type for a pointer to a IO method finder function: -*/ -typedef const sqlite3_io_methods *(*finder_type)(const char*,unixFile*); - - -/**************************************************************************** -**************************** sqlite3_vfs methods **************************** -** -** This division contains the implementation of methods on the -** sqlite3_vfs object. -*/ - -/* -** Initialize the contents of the unixFile structure pointed to by pId. -*/ -static int fillInUnixFile( - sqlite3_vfs *pVfs, /* Pointer to vfs object */ - int h, /* Open file descriptor of file being opened */ - sqlite3_file *pId, /* Write to the unixFile structure here */ - const char *zFilename, /* Name of the file being opened */ - int ctrlFlags /* Zero or more UNIXFILE_* values */ -){ - const sqlite3_io_methods *pLockingStyle; - unixFile *pNew = (unixFile *)pId; - int rc = SQLITE_OK; - - assert( pNew->pInode==NULL ); - - /* Usually the path zFilename should not be a relative pathname. The - ** exception is when opening the proxy "conch" file in builds that - ** include the special Apple locking styles. - */ -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE - assert( zFilename==0 || zFilename[0]=='/' - || pVfs->pAppData==(void*)&autolockIoFinder ); -#else - assert( zFilename==0 || zFilename[0]=='/' ); -#endif - - /* No locking occurs in temporary files */ - assert( zFilename!=0 || (ctrlFlags & UNIXFILE_NOLOCK)!=0 ); - - OSTRACE(("OPEN %-3d %s\n", h, zFilename)); - pNew->h = h; - pNew->pVfs = pVfs; - pNew->zPath = zFilename; - pNew->ctrlFlags = (u8)ctrlFlags; -#if SQLITE_MAX_MMAP_SIZE>0 - pNew->mmapSizeMax = sqlite3GlobalConfig.szMmap; -#endif - if( sqlite3_uri_boolean(((ctrlFlags & UNIXFILE_URI) ? zFilename : 0), - "psow", SQLITE_POWERSAFE_OVERWRITE) ){ - pNew->ctrlFlags |= UNIXFILE_PSOW; - } - if( strcmp(pVfs->zName,"unix-excl")==0 ){ - pNew->ctrlFlags |= UNIXFILE_EXCL; - } - -#if OS_VXWORKS - pNew->pId = vxworksFindFileId(zFilename); - if( pNew->pId==0 ){ - ctrlFlags |= UNIXFILE_NOLOCK; - rc = SQLITE_NOMEM; - } -#endif - - if( ctrlFlags & UNIXFILE_NOLOCK ){ - pLockingStyle = &nolockIoMethods; - }else{ - pLockingStyle = (**(finder_type*)pVfs->pAppData)(zFilename, pNew); -#if SQLITE_ENABLE_LOCKING_STYLE - /* Cache zFilename in the locking context (AFP and dotlock override) for - ** proxyLock activation is possible (remote proxy is based on db name) - ** zFilename remains valid until file is closed, to support */ - pNew->lockingContext = (void*)zFilename; -#endif - } - - if( pLockingStyle == &posixIoMethods -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE - || pLockingStyle == &nfsIoMethods -#endif - ){ - unixEnterMutex(); - rc = findInodeInfo(pNew, &pNew->pInode); - if( rc!=SQLITE_OK ){ - /* If an error occurred in findInodeInfo(), close the file descriptor - ** immediately, before releasing the mutex. findInodeInfo() may fail - ** in two scenarios: - ** - ** (a) A call to fstat() failed. - ** (b) A malloc failed. - ** - ** Scenario (b) may only occur if the process is holding no other - ** file descriptors open on the same file. If there were other file - ** descriptors on this file, then no malloc would be required by - ** findInodeInfo(). If this is the case, it is quite safe to close - ** handle h - as it is guaranteed that no posix locks will be released - ** by doing so. - ** - ** If scenario (a) caused the error then things are not so safe. The - ** implicit assumption here is that if fstat() fails, things are in - ** such bad shape that dropping a lock or two doesn't matter much. - */ - robust_close(pNew, h, __LINE__); - h = -1; - } - unixLeaveMutex(); - } - -#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) - else if( pLockingStyle == &afpIoMethods ){ - /* AFP locking uses the file path so it needs to be included in - ** the afpLockingContext. - */ - afpLockingContext *pCtx; - pNew->lockingContext = pCtx = sqlite3_malloc( sizeof(*pCtx) ); - if( pCtx==0 ){ - rc = SQLITE_NOMEM; - }else{ - /* NB: zFilename exists and remains valid until the file is closed - ** according to requirement F11141. So we do not need to make a - ** copy of the filename. */ - pCtx->dbPath = zFilename; - pCtx->reserved = 0; - srandomdev(); - unixEnterMutex(); - rc = findInodeInfo(pNew, &pNew->pInode); - if( rc!=SQLITE_OK ){ - sqlite3_free(pNew->lockingContext); - robust_close(pNew, h, __LINE__); - h = -1; - } - unixLeaveMutex(); - } - } -#endif - - else if( pLockingStyle == &dotlockIoMethods ){ - /* Dotfile locking uses the file path so it needs to be included in - ** the dotlockLockingContext - */ - char *zLockFile; - int nFilename; - assert( zFilename!=0 ); - nFilename = (int)strlen(zFilename) + 6; - zLockFile = (char *)sqlite3_malloc(nFilename); - if( zLockFile==0 ){ - rc = SQLITE_NOMEM; - }else{ - sqlite3_snprintf(nFilename, zLockFile, "%s" DOTLOCK_SUFFIX, zFilename); - } - pNew->lockingContext = zLockFile; - } - -#if OS_VXWORKS - else if( pLockingStyle == &semIoMethods ){ - /* Named semaphore locking uses the file path so it needs to be - ** included in the semLockingContext - */ - unixEnterMutex(); - rc = findInodeInfo(pNew, &pNew->pInode); - if( (rc==SQLITE_OK) && (pNew->pInode->pSem==NULL) ){ - char *zSemName = pNew->pInode->aSemName; - int n; - sqlite3_snprintf(MAX_PATHNAME, zSemName, "/%s.sem", - pNew->pId->zCanonicalName); - for( n=1; zSemName[n]; n++ ) - if( zSemName[n]=='/' ) zSemName[n] = '_'; - pNew->pInode->pSem = sem_open(zSemName, O_CREAT, 0666, 1); - if( pNew->pInode->pSem == SEM_FAILED ){ - rc = SQLITE_NOMEM; - pNew->pInode->aSemName[0] = '\0'; - } - } - unixLeaveMutex(); - } -#endif - - pNew->lastErrno = 0; -#if OS_VXWORKS - if( rc!=SQLITE_OK ){ - if( h>=0 ) robust_close(pNew, h, __LINE__); - h = -1; - osUnlink(zFilename); - pNew->ctrlFlags |= UNIXFILE_DELETE; - } -#endif - if( rc!=SQLITE_OK ){ - if( h>=0 ) robust_close(pNew, h, __LINE__); - }else{ - pNew->pMethod = pLockingStyle; - OpenCounter(+1); - verifyDbFile(pNew); - } - return rc; -} - -/* -** Return the name of a directory in which to put temporary files. -** If no suitable temporary file directory can be found, return NULL. -*/ -static const char *unixTempFileDir(void){ - static const char *azDirs[] = { - 0, - 0, - 0, - "/var/tmp", - "/usr/tmp", - "/tmp", - 0 /* List terminator */ - }; - unsigned int i; - struct stat buf; - const char *zDir = 0; - - azDirs[0] = sqlite3_temp_directory; - if( !azDirs[1] ) azDirs[1] = getenv("SQLITE_TMPDIR"); - if( !azDirs[2] ) azDirs[2] = getenv("TMPDIR"); - for(i=0; imxPathname bytes. -*/ -static int unixGetTempname(int nBuf, char *zBuf){ - static const unsigned char zChars[] = - "abcdefghijklmnopqrstuvwxyz" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "0123456789"; - unsigned int i, j; - const char *zDir; - - /* It's odd to simulate an io-error here, but really this is just - ** using the io-error infrastructure to test that SQLite handles this - ** function failing. - */ - SimulateIOError( return SQLITE_IOERR ); - - zDir = unixTempFileDir(); - if( zDir==0 ) zDir = "."; - - /* Check that the output buffer is large enough for the temporary file - ** name. If it is not, return SQLITE_ERROR. - */ - if( (strlen(zDir) + strlen(SQLITE_TEMP_FILE_PREFIX) + 18) >= (size_t)nBuf ){ - return SQLITE_ERROR; - } - - do{ - sqlite3_snprintf(nBuf-18, zBuf, "%s/"SQLITE_TEMP_FILE_PREFIX, zDir); - j = (int)strlen(zBuf); - sqlite3_randomness(15, &zBuf[j]); - for(i=0; i<15; i++, j++){ - zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; - } - zBuf[j] = 0; - zBuf[j+1] = 0; - }while( osAccess(zBuf,0)==0 ); - return SQLITE_OK; -} - -#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) -/* -** Routine to transform a unixFile into a proxy-locking unixFile. -** Implementation in the proxy-lock division, but used by unixOpen() -** if SQLITE_PREFER_PROXY_LOCKING is defined. -*/ -static int proxyTransformUnixFile(unixFile*, const char*); -#endif - -/* -** Search for an unused file descriptor that was opened on the database -** file (not a journal or master-journal file) identified by pathname -** zPath with SQLITE_OPEN_XXX flags matching those passed as the second -** argument to this function. -** -** Such a file descriptor may exist if a database connection was closed -** but the associated file descriptor could not be closed because some -** other file descriptor open on the same file is holding a file-lock. -** Refer to comments in the unixClose() function and the lengthy comment -** describing "Posix Advisory Locking" at the start of this file for -** further details. Also, ticket #4018. -** -** If a suitable file descriptor is found, then it is returned. If no -** such file descriptor is located, -1 is returned. -*/ -static UnixUnusedFd *findReusableFd(const char *zPath, int flags){ - UnixUnusedFd *pUnused = 0; - - /* Do not search for an unused file descriptor on vxworks. Not because - ** vxworks would not benefit from the change (it might, we're not sure), - ** but because no way to test it is currently available. It is better - ** not to risk breaking vxworks support for the sake of such an obscure - ** feature. */ -#if !OS_VXWORKS - struct stat sStat; /* Results of stat() call */ - - /* A stat() call may fail for various reasons. If this happens, it is - ** almost certain that an open() call on the same path will also fail. - ** For this reason, if an error occurs in the stat() call here, it is - ** ignored and -1 is returned. The caller will try to open a new file - ** descriptor on the same path, fail, and return an error to SQLite. - ** - ** Even if a subsequent open() call does succeed, the consequences of - ** not searching for a resusable file descriptor are not dire. */ - if( 0==osStat(zPath, &sStat) ){ - unixInodeInfo *pInode; - - unixEnterMutex(); - pInode = inodeList; - while( pInode && (pInode->fileId.dev!=sStat.st_dev - || pInode->fileId.ino!=sStat.st_ino) ){ - pInode = pInode->pNext; - } - if( pInode ){ - UnixUnusedFd **pp; - for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext)); - pUnused = *pp; - if( pUnused ){ - *pp = pUnused->pNext; - } - } - unixLeaveMutex(); - } -#endif /* if !OS_VXWORKS */ - return pUnused; -} - -/* -** This function is called by unixOpen() to determine the unix permissions -** to create new files with. If no error occurs, then SQLITE_OK is returned -** and a value suitable for passing as the third argument to open(2) is -** written to *pMode. If an IO error occurs, an SQLite error code is -** returned and the value of *pMode is not modified. -** -** In most cases cases, this routine sets *pMode to 0, which will become -** an indication to robust_open() to create the file using -** SQLITE_DEFAULT_FILE_PERMISSIONS adjusted by the umask. -** But if the file being opened is a WAL or regular journal file, then -** this function queries the file-system for the permissions on the -** corresponding database file and sets *pMode to this value. Whenever -** possible, WAL and journal files are created using the same permissions -** as the associated database file. -** -** If the SQLITE_ENABLE_8_3_NAMES option is enabled, then the -** original filename is unavailable. But 8_3_NAMES is only used for -** FAT filesystems and permissions do not matter there, so just use -** the default permissions. -*/ -static int findCreateFileMode( - const char *zPath, /* Path of file (possibly) being created */ - int flags, /* Flags passed as 4th argument to xOpen() */ - mode_t *pMode, /* OUT: Permissions to open file with */ - uid_t *pUid, /* OUT: uid to set on the file */ - gid_t *pGid /* OUT: gid to set on the file */ -){ - int rc = SQLITE_OK; /* Return Code */ - *pMode = 0; - *pUid = 0; - *pGid = 0; - if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){ - char zDb[MAX_PATHNAME+1]; /* Database file path */ - int nDb; /* Number of valid bytes in zDb */ - struct stat sStat; /* Output of stat() on database file */ - - /* zPath is a path to a WAL or journal file. The following block derives - ** the path to the associated database file from zPath. This block handles - ** the following naming conventions: - ** - ** "-journal" - ** "-wal" - ** "-journalNN" - ** "-walNN" - ** - ** where NN is a decimal number. The NN naming schemes are - ** used by the test_multiplex.c module. - */ - nDb = sqlite3Strlen30(zPath) - 1; -#ifdef SQLITE_ENABLE_8_3_NAMES - while( nDb>0 && sqlite3Isalnum(zPath[nDb]) ) nDb--; - if( nDb==0 || zPath[nDb]!='-' ) return SQLITE_OK; -#else - while( zPath[nDb]!='-' ){ - assert( nDb>0 ); - assert( zPath[nDb]!='\n' ); - nDb--; - } -#endif - memcpy(zDb, zPath, nDb); - zDb[nDb] = '\0'; - - if( 0==osStat(zDb, &sStat) ){ - *pMode = sStat.st_mode & 0777; - *pUid = sStat.st_uid; - *pGid = sStat.st_gid; - }else{ - rc = SQLITE_IOERR_FSTAT; - } - }else if( flags & SQLITE_OPEN_DELETEONCLOSE ){ - *pMode = 0600; - } - return rc; -} - -/* -** Open the file zPath. -** -** Previously, the SQLite OS layer used three functions in place of this -** one: -** -** sqlite3OsOpenReadWrite(); -** sqlite3OsOpenReadOnly(); -** sqlite3OsOpenExclusive(); -** -** These calls correspond to the following combinations of flags: -** -** ReadWrite() -> (READWRITE | CREATE) -** ReadOnly() -> (READONLY) -** OpenExclusive() -> (READWRITE | CREATE | EXCLUSIVE) -** -** The old OpenExclusive() accepted a boolean argument - "delFlag". If -** true, the file was configured to be automatically deleted when the -** file handle closed. To achieve the same effect using this new -** interface, add the DELETEONCLOSE flag to those specified above for -** OpenExclusive(). -*/ -static int unixOpen( - sqlite3_vfs *pVfs, /* The VFS for which this is the xOpen method */ - const char *zPath, /* Pathname of file to be opened */ - sqlite3_file *pFile, /* The file descriptor to be filled in */ - int flags, /* Input flags to control the opening */ - int *pOutFlags /* Output flags returned to SQLite core */ -){ - unixFile *p = (unixFile *)pFile; - int fd = -1; /* File descriptor returned by open() */ - int openFlags = 0; /* Flags to pass to open() */ - int eType = flags&0xFFFFFF00; /* Type of file to open */ - int noLock; /* True to omit locking primitives */ - int rc = SQLITE_OK; /* Function Return Code */ - int ctrlFlags = 0; /* UNIXFILE_* flags */ - - int isExclusive = (flags & SQLITE_OPEN_EXCLUSIVE); - int isDelete = (flags & SQLITE_OPEN_DELETEONCLOSE); - int isCreate = (flags & SQLITE_OPEN_CREATE); - int isReadonly = (flags & SQLITE_OPEN_READONLY); - int isReadWrite = (flags & SQLITE_OPEN_READWRITE); -#if SQLITE_ENABLE_LOCKING_STYLE - int isAutoProxy = (flags & SQLITE_OPEN_AUTOPROXY); -#endif -#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE - struct statfs fsInfo; -#endif - - /* If creating a master or main-file journal, this function will open - ** a file-descriptor on the directory too. The first time unixSync() - ** is called the directory file descriptor will be fsync()ed and close()d. - */ - int syncDir = (isCreate && ( - eType==SQLITE_OPEN_MASTER_JOURNAL - || eType==SQLITE_OPEN_MAIN_JOURNAL - || eType==SQLITE_OPEN_WAL - )); - - /* If argument zPath is a NULL pointer, this function is required to open - ** a temporary file. Use this buffer to store the file name in. - */ - char zTmpname[MAX_PATHNAME+2]; - const char *zName = zPath; - - /* Check the following statements are true: - ** - ** (a) Exactly one of the READWRITE and READONLY flags must be set, and - ** (b) if CREATE is set, then READWRITE must also be set, and - ** (c) if EXCLUSIVE is set, then CREATE must also be set. - ** (d) if DELETEONCLOSE is set, then CREATE must also be set. - */ - assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly)); - assert(isCreate==0 || isReadWrite); - assert(isExclusive==0 || isCreate); - assert(isDelete==0 || isCreate); - - /* The main DB, main journal, WAL file and master journal are never - ** automatically deleted. Nor are they ever temporary files. */ - assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB ); - assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL ); - assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MASTER_JOURNAL ); - assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL ); - - /* Assert that the upper layer has set one of the "file-type" flags. */ - assert( eType==SQLITE_OPEN_MAIN_DB || eType==SQLITE_OPEN_TEMP_DB - || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL - || eType==SQLITE_OPEN_SUBJOURNAL || eType==SQLITE_OPEN_MASTER_JOURNAL - || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL - ); - - /* Detect a pid change and reset the PRNG. There is a race condition - ** here such that two or more threads all trying to open databases at - ** the same instant might all reset the PRNG. But multiple resets - ** are harmless. - */ - if( randomnessPid!=getpid() ){ - randomnessPid = getpid(); - sqlite3_randomness(0,0); - } - - memset(p, 0, sizeof(unixFile)); - - if( eType==SQLITE_OPEN_MAIN_DB ){ - UnixUnusedFd *pUnused; - pUnused = findReusableFd(zName, flags); - if( pUnused ){ - fd = pUnused->fd; - }else{ - pUnused = sqlite3_malloc(sizeof(*pUnused)); - if( !pUnused ){ - return SQLITE_NOMEM; - } - } - p->pUnused = pUnused; - - /* Database filenames are double-zero terminated if they are not - ** URIs with parameters. Hence, they can always be passed into - ** sqlite3_uri_parameter(). */ - assert( (flags & SQLITE_OPEN_URI) || zName[strlen(zName)+1]==0 ); - - }else if( !zName ){ - /* If zName is NULL, the upper layer is requesting a temp file. */ - assert(isDelete && !syncDir); - rc = unixGetTempname(MAX_PATHNAME+2, zTmpname); - if( rc!=SQLITE_OK ){ - return rc; - } - zName = zTmpname; - - /* Generated temporary filenames are always double-zero terminated - ** for use by sqlite3_uri_parameter(). */ - assert( zName[strlen(zName)+1]==0 ); - } - - /* Determine the value of the flags parameter passed to POSIX function - ** open(). These must be calculated even if open() is not called, as - ** they may be stored as part of the file handle and used by the - ** 'conch file' locking functions later on. */ - if( isReadonly ) openFlags |= O_RDONLY; - if( isReadWrite ) openFlags |= O_RDWR; - if( isCreate ) openFlags |= O_CREAT; - if( isExclusive ) openFlags |= (O_EXCL|O_NOFOLLOW); - openFlags |= (O_LARGEFILE|O_BINARY); - - if( fd<0 ){ - mode_t openMode; /* Permissions to create file with */ - uid_t uid; /* Userid for the file */ - gid_t gid; /* Groupid for the file */ - rc = findCreateFileMode(zName, flags, &openMode, &uid, &gid); - if( rc!=SQLITE_OK ){ - assert( !p->pUnused ); - assert( eType==SQLITE_OPEN_WAL || eType==SQLITE_OPEN_MAIN_JOURNAL ); - return rc; - } - fd = robust_open(zName, openFlags, openMode); - OSTRACE(("OPENX %-3d %s 0%o\n", fd, zName, openFlags)); - if( fd<0 && errno!=EISDIR && isReadWrite && !isExclusive ){ - /* Failed to open the file for read/write access. Try read-only. */ - flags &= ~(SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE); - openFlags &= ~(O_RDWR|O_CREAT); - flags |= SQLITE_OPEN_READONLY; - openFlags |= O_RDONLY; - isReadonly = 1; - fd = robust_open(zName, openFlags, openMode); - } - if( fd<0 ){ - rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zName); - goto open_finished; - } - - /* If this process is running as root and if creating a new rollback - ** journal or WAL file, set the ownership of the journal or WAL to be - ** the same as the original database. - */ - if( flags & (SQLITE_OPEN_WAL|SQLITE_OPEN_MAIN_JOURNAL) ){ - osFchown(fd, uid, gid); - } - } - assert( fd>=0 ); - if( pOutFlags ){ - *pOutFlags = flags; - } - - if( p->pUnused ){ - p->pUnused->fd = fd; - p->pUnused->flags = flags; - } - - if( isDelete ){ -#if OS_VXWORKS - zPath = zName; -#else - osUnlink(zName); -#endif - } -#if SQLITE_ENABLE_LOCKING_STYLE - else{ - p->openFlags = openFlags; - } -#endif - - noLock = eType!=SQLITE_OPEN_MAIN_DB; - - -#if defined(__APPLE__) || SQLITE_ENABLE_LOCKING_STYLE - if( fstatfs(fd, &fsInfo) == -1 ){ - ((unixFile*)pFile)->lastErrno = errno; - robust_close(p, fd, __LINE__); - return SQLITE_IOERR_ACCESS; - } - if (0 == strncmp("msdos", fsInfo.f_fstypename, 5)) { - ((unixFile*)pFile)->fsFlags |= SQLITE_FSFLAGS_IS_MSDOS; - } -#endif - - /* Set up appropriate ctrlFlags */ - if( isDelete ) ctrlFlags |= UNIXFILE_DELETE; - if( isReadonly ) ctrlFlags |= UNIXFILE_RDONLY; - if( noLock ) ctrlFlags |= UNIXFILE_NOLOCK; - if( syncDir ) ctrlFlags |= UNIXFILE_DIRSYNC; - if( flags & SQLITE_OPEN_URI ) ctrlFlags |= UNIXFILE_URI; - -#if SQLITE_ENABLE_LOCKING_STYLE -#if SQLITE_PREFER_PROXY_LOCKING - isAutoProxy = 1; -#endif - if( isAutoProxy && (zPath!=NULL) && (!noLock) && pVfs->xOpen ){ - char *envforce = getenv("SQLITE_FORCE_PROXY_LOCKING"); - int useProxy = 0; - - /* SQLITE_FORCE_PROXY_LOCKING==1 means force always use proxy, 0 means - ** never use proxy, NULL means use proxy for non-local files only. */ - if( envforce!=NULL ){ - useProxy = atoi(envforce)>0; - }else{ - if( statfs(zPath, &fsInfo) == -1 ){ - /* In theory, the close(fd) call is sub-optimal. If the file opened - ** with fd is a database file, and there are other connections open - ** on that file that are currently holding advisory locks on it, - ** then the call to close() will cancel those locks. In practice, - ** we're assuming that statfs() doesn't fail very often. At least - ** not while other file descriptors opened by the same process on - ** the same file are working. */ - p->lastErrno = errno; - robust_close(p, fd, __LINE__); - rc = SQLITE_IOERR_ACCESS; - goto open_finished; - } - useProxy = !(fsInfo.f_flags&MNT_LOCAL); - } - if( useProxy ){ - rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags); - if( rc==SQLITE_OK ){ - rc = proxyTransformUnixFile((unixFile*)pFile, ":auto:"); - if( rc!=SQLITE_OK ){ - /* Use unixClose to clean up the resources added in fillInUnixFile - ** and clear all the structure's references. Specifically, - ** pFile->pMethods will be NULL so sqlite3OsClose will be a no-op - */ - unixClose(pFile); - return rc; - } - } - goto open_finished; - } - } -#endif - - rc = fillInUnixFile(pVfs, fd, pFile, zPath, ctrlFlags); - -open_finished: - if( rc!=SQLITE_OK ){ - sqlite3_free(p->pUnused); - } - return rc; -} - - -/* -** Delete the file at zPath. If the dirSync argument is true, fsync() -** the directory after deleting the file. -*/ -static int unixDelete( - sqlite3_vfs *NotUsed, /* VFS containing this as the xDelete method */ - const char *zPath, /* Name of file to be deleted */ - int dirSync /* If true, fsync() directory after deleting file */ -){ - int rc = SQLITE_OK; - UNUSED_PARAMETER(NotUsed); - SimulateIOError(return SQLITE_IOERR_DELETE); - if( osUnlink(zPath)==(-1) ){ - if( errno==ENOENT ){ - rc = SQLITE_IOERR_DELETE_NOENT; - }else{ - rc = unixLogError(SQLITE_IOERR_DELETE, "unlink", zPath); - } - return rc; - } -#ifndef SQLITE_DISABLE_DIRSYNC - if( (dirSync & 1)!=0 ){ - int fd; - rc = osOpenDirectory(zPath, &fd); - if( rc==SQLITE_OK ){ -#if OS_VXWORKS - if( fsync(fd)==-1 ) -#else - if( fsync(fd) ) -#endif - { - rc = unixLogError(SQLITE_IOERR_DIR_FSYNC, "fsync", zPath); - } - robust_close(0, fd, __LINE__); - }else if( rc==SQLITE_CANTOPEN ){ - rc = SQLITE_OK; - } - } -#endif - return rc; -} - -/* -** Test the existence of or access permissions of file zPath. The -** test performed depends on the value of flags: -** -** SQLITE_ACCESS_EXISTS: Return 1 if the file exists -** SQLITE_ACCESS_READWRITE: Return 1 if the file is read and writable. -** SQLITE_ACCESS_READONLY: Return 1 if the file is readable. -** -** Otherwise return 0. -*/ -static int unixAccess( - sqlite3_vfs *NotUsed, /* The VFS containing this xAccess method */ - const char *zPath, /* Path of the file to examine */ - int flags, /* What do we want to learn about the zPath file? */ - int *pResOut /* Write result boolean here */ -){ - int amode = 0; - UNUSED_PARAMETER(NotUsed); - SimulateIOError( return SQLITE_IOERR_ACCESS; ); - switch( flags ){ - case SQLITE_ACCESS_EXISTS: - amode = F_OK; - break; - case SQLITE_ACCESS_READWRITE: - amode = W_OK|R_OK; - break; - case SQLITE_ACCESS_READ: - amode = R_OK; - break; - - default: - assert(!"Invalid flags argument"); - } - *pResOut = (osAccess(zPath, amode)==0); - if( flags==SQLITE_ACCESS_EXISTS && *pResOut ){ - struct stat buf; - if( 0==osStat(zPath, &buf) && buf.st_size==0 ){ - *pResOut = 0; - } - } - return SQLITE_OK; -} - - -/* -** Turn a relative pathname into a full pathname. The relative path -** is stored as a nul-terminated string in the buffer pointed to by -** zPath. -** -** zOut points to a buffer of at least sqlite3_vfs.mxPathname bytes -** (in this case, MAX_PATHNAME bytes). The full-path is written to -** this buffer before returning. -*/ -static int unixFullPathname( - sqlite3_vfs *pVfs, /* Pointer to vfs object */ - const char *zPath, /* Possibly relative input path */ - int nOut, /* Size of output buffer in bytes */ - char *zOut /* Output buffer */ -){ - - /* It's odd to simulate an io-error here, but really this is just - ** using the io-error infrastructure to test that SQLite handles this - ** function failing. This function could fail if, for example, the - ** current working directory has been unlinked. - */ - SimulateIOError( return SQLITE_ERROR ); - - assert( pVfs->mxPathname==MAX_PATHNAME ); - UNUSED_PARAMETER(pVfs); - - zOut[nOut-1] = '\0'; - if( zPath[0]=='/' ){ - sqlite3_snprintf(nOut, zOut, "%s", zPath); - }else{ - int nCwd; - if( osGetcwd(zOut, nOut-1)==0 ){ - return unixLogError(SQLITE_CANTOPEN_BKPT, "getcwd", zPath); - } - nCwd = (int)strlen(zOut); - sqlite3_snprintf(nOut-nCwd, &zOut[nCwd], "/%s", zPath); - } - return SQLITE_OK; -} - - -#ifndef SQLITE_OMIT_LOAD_EXTENSION -/* -** Interfaces for opening a shared library, finding entry points -** within the shared library, and closing the shared library. -*/ -#include -static void *unixDlOpen(sqlite3_vfs *NotUsed, const char *zFilename){ - UNUSED_PARAMETER(NotUsed); - return dlopen(zFilename, RTLD_NOW | RTLD_GLOBAL); -} - -/* -** SQLite calls this function immediately after a call to unixDlSym() or -** unixDlOpen() fails (returns a null pointer). If a more detailed error -** message is available, it is written to zBufOut. If no error message -** is available, zBufOut is left unmodified and SQLite uses a default -** error message. -*/ -static void unixDlError(sqlite3_vfs *NotUsed, int nBuf, char *zBufOut){ - const char *zErr; - UNUSED_PARAMETER(NotUsed); - unixEnterMutex(); - zErr = dlerror(); - if( zErr ){ - sqlite3_snprintf(nBuf, zBufOut, "%s", zErr); - } - unixLeaveMutex(); -} -static void (*unixDlSym(sqlite3_vfs *NotUsed, void *p, const char*zSym))(void){ - /* - ** GCC with -pedantic-errors says that C90 does not allow a void* to be - ** cast into a pointer to a function. And yet the library dlsym() routine - ** returns a void* which is really a pointer to a function. So how do we - ** use dlsym() with -pedantic-errors? - ** - ** Variable x below is defined to be a pointer to a function taking - ** parameters void* and const char* and returning a pointer to a function. - ** We initialize x by assigning it a pointer to the dlsym() function. - ** (That assignment requires a cast.) Then we call the function that - ** x points to. - ** - ** This work-around is unlikely to work correctly on any system where - ** you really cannot cast a function pointer into void*. But then, on the - ** other hand, dlsym() will not work on such a system either, so we have - ** not really lost anything. - */ - void (*(*x)(void*,const char*))(void); - UNUSED_PARAMETER(NotUsed); - x = (void(*(*)(void*,const char*))(void))dlsym; - return (*x)(p, zSym); -} -static void unixDlClose(sqlite3_vfs *NotUsed, void *pHandle){ - UNUSED_PARAMETER(NotUsed); - dlclose(pHandle); -} -#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */ - #define unixDlOpen 0 - #define unixDlError 0 - #define unixDlSym 0 - #define unixDlClose 0 -#endif - -/* -** Write nBuf bytes of random data to the supplied buffer zBuf. -*/ -static int unixRandomness(sqlite3_vfs *NotUsed, int nBuf, char *zBuf){ - UNUSED_PARAMETER(NotUsed); - assert((size_t)nBuf>=(sizeof(time_t)+sizeof(int))); - - /* We have to initialize zBuf to prevent valgrind from reporting - ** errors. The reports issued by valgrind are incorrect - we would - ** prefer that the randomness be increased by making use of the - ** uninitialized space in zBuf - but valgrind errors tend to worry - ** some users. Rather than argue, it seems easier just to initialize - ** the whole array and silence valgrind, even if that means less randomness - ** in the random seed. - ** - ** When testing, initializing zBuf[] to zero is all we do. That means - ** that we always use the same random number sequence. This makes the - ** tests repeatable. - */ - memset(zBuf, 0, nBuf); - randomnessPid = getpid(); -#if !defined(SQLITE_TEST) - { - int fd, got; - fd = robust_open("/dev/urandom", O_RDONLY, 0); - if( fd<0 ){ - time_t t; - time(&t); - memcpy(zBuf, &t, sizeof(t)); - memcpy(&zBuf[sizeof(t)], &randomnessPid, sizeof(randomnessPid)); - assert( sizeof(t)+sizeof(randomnessPid)<=(size_t)nBuf ); - nBuf = sizeof(t) + sizeof(randomnessPid); - }else{ - do{ got = osRead(fd, zBuf, nBuf); }while( got<0 && errno==EINTR ); - robust_close(0, fd, __LINE__); - } - } -#endif - return nBuf; -} - - -/* -** Sleep for a little while. Return the amount of time slept. -** The argument is the number of microseconds we want to sleep. -** The return value is the number of microseconds of sleep actually -** requested from the underlying operating system, a number which -** might be greater than or equal to the argument, but not less -** than the argument. -*/ -static int unixSleep(sqlite3_vfs *NotUsed, int microseconds){ -#if OS_VXWORKS - struct timespec sp; - - sp.tv_sec = microseconds / 1000000; - sp.tv_nsec = (microseconds % 1000000) * 1000; - nanosleep(&sp, NULL); - UNUSED_PARAMETER(NotUsed); - return microseconds; -#elif defined(HAVE_USLEEP) && HAVE_USLEEP - usleep(microseconds); - UNUSED_PARAMETER(NotUsed); - return microseconds; -#else - int seconds = (microseconds+999999)/1000000; - sleep(seconds); - UNUSED_PARAMETER(NotUsed); - return seconds*1000000; -#endif -} - -/* -** The following variable, if set to a non-zero value, is interpreted as -** the number of seconds since 1970 and is used to set the result of -** sqlite3OsCurrentTime() during testing. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_current_time = 0; /* Fake system time in seconds since 1970. */ -#endif - -/* -** Find the current time (in Universal Coordinated Time). Write into *piNow -** the current time and date as a Julian Day number times 86_400_000. In -** other words, write into *piNow the number of milliseconds since the Julian -** epoch of noon in Greenwich on November 24, 4714 B.C according to the -** proleptic Gregorian calendar. -** -** On success, return SQLITE_OK. Return SQLITE_ERROR if the time and date -** cannot be found. -*/ -static int unixCurrentTimeInt64(sqlite3_vfs *NotUsed, sqlite3_int64 *piNow){ - static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000; - int rc = SQLITE_OK; -#if defined(NO_GETTOD) - time_t t; - time(&t); - *piNow = ((sqlite3_int64)t)*1000 + unixEpoch; -#elif OS_VXWORKS - struct timespec sNow; - clock_gettime(CLOCK_REALTIME, &sNow); - *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_nsec/1000000; -#else - struct timeval sNow; - if( gettimeofday(&sNow, 0)==0 ){ - *piNow = unixEpoch + 1000*(sqlite3_int64)sNow.tv_sec + sNow.tv_usec/1000; - }else{ - rc = SQLITE_ERROR; - } -#endif - -#ifdef SQLITE_TEST - if( sqlite3_current_time ){ - *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch; - } -#endif - UNUSED_PARAMETER(NotUsed); - return rc; -} - -/* -** Find the current time (in Universal Coordinated Time). Write the -** current time and date as a Julian Day number into *prNow and -** return 0. Return 1 if the time and date cannot be found. -*/ -static int unixCurrentTime(sqlite3_vfs *NotUsed, double *prNow){ - sqlite3_int64 i = 0; - int rc; - UNUSED_PARAMETER(NotUsed); - rc = unixCurrentTimeInt64(0, &i); - *prNow = i/86400000.0; - return rc; -} - -/* -** We added the xGetLastError() method with the intention of providing -** better low-level error messages when operating-system problems come up -** during SQLite operation. But so far, none of that has been implemented -** in the core. So this routine is never called. For now, it is merely -** a place-holder. -*/ -static int unixGetLastError(sqlite3_vfs *NotUsed, int NotUsed2, char *NotUsed3){ - UNUSED_PARAMETER(NotUsed); - UNUSED_PARAMETER(NotUsed2); - UNUSED_PARAMETER(NotUsed3); - return 0; -} - - -/* -************************ End of sqlite3_vfs methods *************************** -******************************************************************************/ - -/****************************************************************************** -************************** Begin Proxy Locking ******************************** -** -** Proxy locking is a "uber-locking-method" in this sense: It uses the -** other locking methods on secondary lock files. Proxy locking is a -** meta-layer over top of the primitive locking implemented above. For -** this reason, the division that implements of proxy locking is deferred -** until late in the file (here) after all of the other I/O methods have -** been defined - so that the primitive locking methods are available -** as services to help with the implementation of proxy locking. -** -**** -** -** The default locking schemes in SQLite use byte-range locks on the -** database file to coordinate safe, concurrent access by multiple readers -** and writers [http://sqlite.org/lockingv3.html]. The five file locking -** states (UNLOCKED, PENDING, SHARED, RESERVED, EXCLUSIVE) are implemented -** as POSIX read & write locks over fixed set of locations (via fsctl), -** on AFP and SMB only exclusive byte-range locks are available via fsctl -** with _IOWR('z', 23, struct ByteRangeLockPB2) to track the same 5 states. -** To simulate a F_RDLCK on the shared range, on AFP a randomly selected -** address in the shared range is taken for a SHARED lock, the entire -** shared range is taken for an EXCLUSIVE lock): -** -** PENDING_BYTE 0x40000000 -** RESERVED_BYTE 0x40000001 -** SHARED_RANGE 0x40000002 -> 0x40000200 -** -** This works well on the local file system, but shows a nearly 100x -** slowdown in read performance on AFP because the AFP client disables -** the read cache when byte-range locks are present. Enabling the read -** cache exposes a cache coherency problem that is present on all OS X -** supported network file systems. NFS and AFP both observe the -** close-to-open semantics for ensuring cache coherency -** [http://nfs.sourceforge.net/#faq_a8], which does not effectively -** address the requirements for concurrent database access by multiple -** readers and writers -** [http://www.nabble.com/SQLite-on-NFS-cache-coherency-td15655701.html]. -** -** To address the performance and cache coherency issues, proxy file locking -** changes the way database access is controlled by limiting access to a -** single host at a time and moving file locks off of the database file -** and onto a proxy file on the local file system. -** -** -** Using proxy locks -** ----------------- -** -** C APIs -** -** sqlite3_file_control(db, dbname, SQLITE_SET_LOCKPROXYFILE, -** | ":auto:"); -** sqlite3_file_control(db, dbname, SQLITE_GET_LOCKPROXYFILE, &); -** -** -** SQL pragmas -** -** PRAGMA [database.]lock_proxy_file= | :auto: -** PRAGMA [database.]lock_proxy_file -** -** Specifying ":auto:" means that if there is a conch file with a matching -** host ID in it, the proxy path in the conch file will be used, otherwise -** a proxy path based on the user's temp dir -** (via confstr(_CS_DARWIN_USER_TEMP_DIR,...)) will be used and the -** actual proxy file name is generated from the name and path of the -** database file. For example: -** -** For database path "/Users/me/foo.db" -** The lock path will be "/sqliteplocks/_Users_me_foo.db:auto:") -** -** Once a lock proxy is configured for a database connection, it can not -** be removed, however it may be switched to a different proxy path via -** the above APIs (assuming the conch file is not being held by another -** connection or process). -** -** -** How proxy locking works -** ----------------------- -** -** Proxy file locking relies primarily on two new supporting files: -** -** * conch file to limit access to the database file to a single host -** at a time -** -** * proxy file to act as a proxy for the advisory locks normally -** taken on the database -** -** The conch file - to use a proxy file, sqlite must first "hold the conch" -** by taking an sqlite-style shared lock on the conch file, reading the -** contents and comparing the host's unique host ID (see below) and lock -** proxy path against the values stored in the conch. The conch file is -** stored in the same directory as the database file and the file name -** is patterned after the database file name as ".-conch". -** If the conch file does not exist, or it's contents do not match the -** host ID and/or proxy path, then the lock is escalated to an exclusive -** lock and the conch file contents is updated with the host ID and proxy -** path and the lock is downgraded to a shared lock again. If the conch -** is held by another process (with a shared lock), the exclusive lock -** will fail and SQLITE_BUSY is returned. -** -** The proxy file - a single-byte file used for all advisory file locks -** normally taken on the database file. This allows for safe sharing -** of the database file for multiple readers and writers on the same -** host (the conch ensures that they all use the same local lock file). -** -** Requesting the lock proxy does not immediately take the conch, it is -** only taken when the first request to lock database file is made. -** This matches the semantics of the traditional locking behavior, where -** opening a connection to a database file does not take a lock on it. -** The shared lock and an open file descriptor are maintained until -** the connection to the database is closed. -** -** The proxy file and the lock file are never deleted so they only need -** to be created the first time they are used. -** -** Configuration options -** --------------------- -** -** SQLITE_PREFER_PROXY_LOCKING -** -** Database files accessed on non-local file systems are -** automatically configured for proxy locking, lock files are -** named automatically using the same logic as -** PRAGMA lock_proxy_file=":auto:" -** -** SQLITE_PROXY_DEBUG -** -** Enables the logging of error messages during host id file -** retrieval and creation -** -** LOCKPROXYDIR -** -** Overrides the default directory used for lock proxy files that -** are named automatically via the ":auto:" setting -** -** SQLITE_DEFAULT_PROXYDIR_PERMISSIONS -** -** Permissions to use when creating a directory for storing the -** lock proxy files, only used when LOCKPROXYDIR is not set. -** -** -** As mentioned above, when compiled with SQLITE_PREFER_PROXY_LOCKING, -** setting the environment variable SQLITE_FORCE_PROXY_LOCKING to 1 will -** force proxy locking to be used for every database file opened, and 0 -** will force automatic proxy locking to be disabled for all database -** files (explicity calling the SQLITE_SET_LOCKPROXYFILE pragma or -** sqlite_file_control API is not affected by SQLITE_FORCE_PROXY_LOCKING). -*/ - -/* -** Proxy locking is only available on MacOSX -*/ -#if defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE - -/* -** The proxyLockingContext has the path and file structures for the remote -** and local proxy files in it -*/ -typedef struct proxyLockingContext proxyLockingContext; -struct proxyLockingContext { - unixFile *conchFile; /* Open conch file */ - char *conchFilePath; /* Name of the conch file */ - unixFile *lockProxy; /* Open proxy lock file */ - char *lockProxyPath; /* Name of the proxy lock file */ - char *dbPath; /* Name of the open file */ - int conchHeld; /* 1 if the conch is held, -1 if lockless */ - void *oldLockingContext; /* Original lockingcontext to restore on close */ - sqlite3_io_methods const *pOldMethod; /* Original I/O methods for close */ -}; - -/* -** The proxy lock file path for the database at dbPath is written into lPath, -** which must point to valid, writable memory large enough for a maxLen length -** file path. -*/ -static int proxyGetLockPath(const char *dbPath, char *lPath, size_t maxLen){ - int len; - int dbLen; - int i; - -#ifdef LOCKPROXYDIR - len = strlcpy(lPath, LOCKPROXYDIR, maxLen); -#else -# ifdef _CS_DARWIN_USER_TEMP_DIR - { - if( !confstr(_CS_DARWIN_USER_TEMP_DIR, lPath, maxLen) ){ - OSTRACE(("GETLOCKPATH failed %s errno=%d pid=%d\n", - lPath, errno, getpid())); - return SQLITE_IOERR_LOCK; - } - len = strlcat(lPath, "sqliteplocks", maxLen); - } -# else - len = strlcpy(lPath, "/tmp/", maxLen); -# endif -#endif - - if( lPath[len-1]!='/' ){ - len = strlcat(lPath, "/", maxLen); - } - - /* transform the db path to a unique cache name */ - dbLen = (int)strlen(dbPath); - for( i=0; i 0) ){ - /* only mkdir if leaf dir != "." or "/" or ".." */ - if( i-start>2 || (i-start==1 && buf[start] != '.' && buf[start] != '/') - || (i-start==2 && buf[start] != '.' && buf[start+1] != '.') ){ - buf[i]='\0'; - if( osMkdir(buf, SQLITE_DEFAULT_PROXYDIR_PERMISSIONS) ){ - int err=errno; - if( err!=EEXIST ) { - OSTRACE(("CREATELOCKPATH FAILED creating %s, " - "'%s' proxy lock path=%s pid=%d\n", - buf, strerror(err), lockPath, getpid())); - return err; - } - } - } - start=i+1; - } - buf[i] = lockPath[i]; - } - OSTRACE(("CREATELOCKPATH proxy lock path=%s pid=%d\n", lockPath, getpid())); - return 0; -} - -/* -** Create a new VFS file descriptor (stored in memory obtained from -** sqlite3_malloc) and open the file named "path" in the file descriptor. -** -** The caller is responsible not only for closing the file descriptor -** but also for freeing the memory associated with the file descriptor. -*/ -static int proxyCreateUnixFile( - const char *path, /* path for the new unixFile */ - unixFile **ppFile, /* unixFile created and returned by ref */ - int islockfile /* if non zero missing dirs will be created */ -) { - int fd = -1; - unixFile *pNew; - int rc = SQLITE_OK; - int openFlags = O_RDWR | O_CREAT; - sqlite3_vfs dummyVfs; - int terrno = 0; - UnixUnusedFd *pUnused = NULL; - - /* 1. first try to open/create the file - ** 2. if that fails, and this is a lock file (not-conch), try creating - ** the parent directories and then try again. - ** 3. if that fails, try to open the file read-only - ** otherwise return BUSY (if lock file) or CANTOPEN for the conch file - */ - pUnused = findReusableFd(path, openFlags); - if( pUnused ){ - fd = pUnused->fd; - }else{ - pUnused = sqlite3_malloc(sizeof(*pUnused)); - if( !pUnused ){ - return SQLITE_NOMEM; - } - } - if( fd<0 ){ - fd = robust_open(path, openFlags, 0); - terrno = errno; - if( fd<0 && errno==ENOENT && islockfile ){ - if( proxyCreateLockPath(path) == SQLITE_OK ){ - fd = robust_open(path, openFlags, 0); - } - } - } - if( fd<0 ){ - openFlags = O_RDONLY; - fd = robust_open(path, openFlags, 0); - terrno = errno; - } - if( fd<0 ){ - if( islockfile ){ - return SQLITE_BUSY; - } - switch (terrno) { - case EACCES: - return SQLITE_PERM; - case EIO: - return SQLITE_IOERR_LOCK; /* even though it is the conch */ - default: - return SQLITE_CANTOPEN_BKPT; - } - } - - pNew = (unixFile *)sqlite3_malloc(sizeof(*pNew)); - if( pNew==NULL ){ - rc = SQLITE_NOMEM; - goto end_create_proxy; - } - memset(pNew, 0, sizeof(unixFile)); - pNew->openFlags = openFlags; - memset(&dummyVfs, 0, sizeof(dummyVfs)); - dummyVfs.pAppData = (void*)&autolockIoFinder; - dummyVfs.zName = "dummy"; - pUnused->fd = fd; - pUnused->flags = openFlags; - pNew->pUnused = pUnused; - - rc = fillInUnixFile(&dummyVfs, fd, (sqlite3_file*)pNew, path, 0); - if( rc==SQLITE_OK ){ - *ppFile = pNew; - return SQLITE_OK; - } -end_create_proxy: - robust_close(pNew, fd, __LINE__); - sqlite3_free(pNew); - sqlite3_free(pUnused); - return rc; -} - -#ifdef SQLITE_TEST -/* simulate multiple hosts by creating unique hostid file paths */ -SQLITE_API int sqlite3_hostid_num = 0; -#endif - -#define PROXY_HOSTIDLEN 16 /* conch file host id length */ - -/* Not always defined in the headers as it ought to be */ -extern int gethostuuid(uuid_t id, const struct timespec *wait); - -/* get the host ID via gethostuuid(), pHostID must point to PROXY_HOSTIDLEN -** bytes of writable memory. -*/ -static int proxyGetHostID(unsigned char *pHostID, int *pError){ - assert(PROXY_HOSTIDLEN == sizeof(uuid_t)); - memset(pHostID, 0, PROXY_HOSTIDLEN); -#if defined(__MAX_OS_X_VERSION_MIN_REQUIRED)\ - && __MAC_OS_X_VERSION_MIN_REQUIRED<1050 - { - static const struct timespec timeout = {1, 0}; /* 1 sec timeout */ - if( gethostuuid(pHostID, &timeout) ){ - int err = errno; - if( pError ){ - *pError = err; - } - return SQLITE_IOERR; - } - } -#else - UNUSED_PARAMETER(pError); -#endif -#ifdef SQLITE_TEST - /* simulate multiple hosts by creating unique hostid file paths */ - if( sqlite3_hostid_num != 0){ - pHostID[0] = (char)(pHostID[0] + (char)(sqlite3_hostid_num & 0xFF)); - } -#endif - - return SQLITE_OK; -} - -/* The conch file contains the header, host id and lock file path - */ -#define PROXY_CONCHVERSION 2 /* 1-byte header, 16-byte host id, path */ -#define PROXY_HEADERLEN 1 /* conch file header length */ -#define PROXY_PATHINDEX (PROXY_HEADERLEN+PROXY_HOSTIDLEN) -#define PROXY_MAXCONCHLEN (PROXY_HEADERLEN+PROXY_HOSTIDLEN+MAXPATHLEN) - -/* -** Takes an open conch file, copies the contents to a new path and then moves -** it back. The newly created file's file descriptor is assigned to the -** conch file structure and finally the original conch file descriptor is -** closed. Returns zero if successful. -*/ -static int proxyBreakConchLock(unixFile *pFile, uuid_t myHostID){ - proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; - unixFile *conchFile = pCtx->conchFile; - char tPath[MAXPATHLEN]; - char buf[PROXY_MAXCONCHLEN]; - char *cPath = pCtx->conchFilePath; - size_t readLen = 0; - size_t pathLen = 0; - char errmsg[64] = ""; - int fd = -1; - int rc = -1; - UNUSED_PARAMETER(myHostID); - - /* create a new path by replace the trailing '-conch' with '-break' */ - pathLen = strlcpy(tPath, cPath, MAXPATHLEN); - if( pathLen>MAXPATHLEN || pathLen<6 || - (strlcpy(&tPath[pathLen-5], "break", 6) != 5) ){ - sqlite3_snprintf(sizeof(errmsg),errmsg,"path error (len %d)",(int)pathLen); - goto end_breaklock; - } - /* read the conch content */ - readLen = osPread(conchFile->h, buf, PROXY_MAXCONCHLEN, 0); - if( readLenh, __LINE__); - conchFile->h = fd; - conchFile->openFlags = O_RDWR | O_CREAT; - -end_breaklock: - if( rc ){ - if( fd>=0 ){ - osUnlink(tPath); - robust_close(pFile, fd, __LINE__); - } - fprintf(stderr, "failed to break stale lock on %s, %s\n", cPath, errmsg); - } - return rc; -} - -/* Take the requested lock on the conch file and break a stale lock if the -** host id matches. -*/ -static int proxyConchLock(unixFile *pFile, uuid_t myHostID, int lockType){ - proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; - unixFile *conchFile = pCtx->conchFile; - int rc = SQLITE_OK; - int nTries = 0; - struct timespec conchModTime; - - memset(&conchModTime, 0, sizeof(conchModTime)); - do { - rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType); - nTries ++; - if( rc==SQLITE_BUSY ){ - /* If the lock failed (busy): - * 1st try: get the mod time of the conch, wait 0.5s and try again. - * 2nd try: fail if the mod time changed or host id is different, wait - * 10 sec and try again - * 3rd try: break the lock unless the mod time has changed. - */ - struct stat buf; - if( osFstat(conchFile->h, &buf) ){ - pFile->lastErrno = errno; - return SQLITE_IOERR_LOCK; - } - - if( nTries==1 ){ - conchModTime = buf.st_mtimespec; - usleep(500000); /* wait 0.5 sec and try the lock again*/ - continue; - } - - assert( nTries>1 ); - if( conchModTime.tv_sec != buf.st_mtimespec.tv_sec || - conchModTime.tv_nsec != buf.st_mtimespec.tv_nsec ){ - return SQLITE_BUSY; - } - - if( nTries==2 ){ - char tBuf[PROXY_MAXCONCHLEN]; - int len = osPread(conchFile->h, tBuf, PROXY_MAXCONCHLEN, 0); - if( len<0 ){ - pFile->lastErrno = errno; - return SQLITE_IOERR_LOCK; - } - if( len>PROXY_PATHINDEX && tBuf[0]==(char)PROXY_CONCHVERSION){ - /* don't break the lock if the host id doesn't match */ - if( 0!=memcmp(&tBuf[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN) ){ - return SQLITE_BUSY; - } - }else{ - /* don't break the lock on short read or a version mismatch */ - return SQLITE_BUSY; - } - usleep(10000000); /* wait 10 sec and try the lock again */ - continue; - } - - assert( nTries==3 ); - if( 0==proxyBreakConchLock(pFile, myHostID) ){ - rc = SQLITE_OK; - if( lockType==EXCLUSIVE_LOCK ){ - rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, SHARED_LOCK); - } - if( !rc ){ - rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, lockType); - } - } - } - } while( rc==SQLITE_BUSY && nTries<3 ); - - return rc; -} - -/* Takes the conch by taking a shared lock and read the contents conch, if -** lockPath is non-NULL, the host ID and lock file path must match. A NULL -** lockPath means that the lockPath in the conch file will be used if the -** host IDs match, or a new lock path will be generated automatically -** and written to the conch file. -*/ -static int proxyTakeConch(unixFile *pFile){ - proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; - - if( pCtx->conchHeld!=0 ){ - return SQLITE_OK; - }else{ - unixFile *conchFile = pCtx->conchFile; - uuid_t myHostID; - int pError = 0; - char readBuf[PROXY_MAXCONCHLEN]; - char lockPath[MAXPATHLEN]; - char *tempLockPath = NULL; - int rc = SQLITE_OK; - int createConch = 0; - int hostIdMatch = 0; - int readLen = 0; - int tryOldLockPath = 0; - int forceNewLockPath = 0; - - OSTRACE(("TAKECONCH %d for %s pid=%d\n", conchFile->h, - (pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"), getpid())); - - rc = proxyGetHostID(myHostID, &pError); - if( (rc&0xff)==SQLITE_IOERR ){ - pFile->lastErrno = pError; - goto end_takeconch; - } - rc = proxyConchLock(pFile, myHostID, SHARED_LOCK); - if( rc!=SQLITE_OK ){ - goto end_takeconch; - } - /* read the existing conch file */ - readLen = seekAndRead((unixFile*)conchFile, 0, readBuf, PROXY_MAXCONCHLEN); - if( readLen<0 ){ - /* I/O error: lastErrno set by seekAndRead */ - pFile->lastErrno = conchFile->lastErrno; - rc = SQLITE_IOERR_READ; - goto end_takeconch; - }else if( readLen<=(PROXY_HEADERLEN+PROXY_HOSTIDLEN) || - readBuf[0]!=(char)PROXY_CONCHVERSION ){ - /* a short read or version format mismatch means we need to create a new - ** conch file. - */ - createConch = 1; - } - /* if the host id matches and the lock path already exists in the conch - ** we'll try to use the path there, if we can't open that path, we'll - ** retry with a new auto-generated path - */ - do { /* in case we need to try again for an :auto: named lock file */ - - if( !createConch && !forceNewLockPath ){ - hostIdMatch = !memcmp(&readBuf[PROXY_HEADERLEN], myHostID, - PROXY_HOSTIDLEN); - /* if the conch has data compare the contents */ - if( !pCtx->lockProxyPath ){ - /* for auto-named local lock file, just check the host ID and we'll - ** use the local lock file path that's already in there - */ - if( hostIdMatch ){ - size_t pathLen = (readLen - PROXY_PATHINDEX); - - if( pathLen>=MAXPATHLEN ){ - pathLen=MAXPATHLEN-1; - } - memcpy(lockPath, &readBuf[PROXY_PATHINDEX], pathLen); - lockPath[pathLen] = 0; - tempLockPath = lockPath; - tryOldLockPath = 1; - /* create a copy of the lock path if the conch is taken */ - goto end_takeconch; - } - }else if( hostIdMatch - && !strncmp(pCtx->lockProxyPath, &readBuf[PROXY_PATHINDEX], - readLen-PROXY_PATHINDEX) - ){ - /* conch host and lock path match */ - goto end_takeconch; - } - } - - /* if the conch isn't writable and doesn't match, we can't take it */ - if( (conchFile->openFlags&O_RDWR) == 0 ){ - rc = SQLITE_BUSY; - goto end_takeconch; - } - - /* either the conch didn't match or we need to create a new one */ - if( !pCtx->lockProxyPath ){ - proxyGetLockPath(pCtx->dbPath, lockPath, MAXPATHLEN); - tempLockPath = lockPath; - /* create a copy of the lock path _only_ if the conch is taken */ - } - - /* update conch with host and path (this will fail if other process - ** has a shared lock already), if the host id matches, use the big - ** stick. - */ - futimes(conchFile->h, NULL); - if( hostIdMatch && !createConch ){ - if( conchFile->pInode && conchFile->pInode->nShared>1 ){ - /* We are trying for an exclusive lock but another thread in this - ** same process is still holding a shared lock. */ - rc = SQLITE_BUSY; - } else { - rc = proxyConchLock(pFile, myHostID, EXCLUSIVE_LOCK); - } - }else{ - rc = conchFile->pMethod->xLock((sqlite3_file*)conchFile, EXCLUSIVE_LOCK); - } - if( rc==SQLITE_OK ){ - char writeBuffer[PROXY_MAXCONCHLEN]; - int writeSize = 0; - - writeBuffer[0] = (char)PROXY_CONCHVERSION; - memcpy(&writeBuffer[PROXY_HEADERLEN], myHostID, PROXY_HOSTIDLEN); - if( pCtx->lockProxyPath!=NULL ){ - strlcpy(&writeBuffer[PROXY_PATHINDEX], pCtx->lockProxyPath, MAXPATHLEN); - }else{ - strlcpy(&writeBuffer[PROXY_PATHINDEX], tempLockPath, MAXPATHLEN); - } - writeSize = PROXY_PATHINDEX + strlen(&writeBuffer[PROXY_PATHINDEX]); - robust_ftruncate(conchFile->h, writeSize); - rc = unixWrite((sqlite3_file *)conchFile, writeBuffer, writeSize, 0); - fsync(conchFile->h); - /* If we created a new conch file (not just updated the contents of a - ** valid conch file), try to match the permissions of the database - */ - if( rc==SQLITE_OK && createConch ){ - struct stat buf; - int err = osFstat(pFile->h, &buf); - if( err==0 ){ - mode_t cmode = buf.st_mode&(S_IRUSR|S_IWUSR | S_IRGRP|S_IWGRP | - S_IROTH|S_IWOTH); - /* try to match the database file R/W permissions, ignore failure */ -#ifndef SQLITE_PROXY_DEBUG - osFchmod(conchFile->h, cmode); -#else - do{ - rc = osFchmod(conchFile->h, cmode); - }while( rc==(-1) && errno==EINTR ); - if( rc!=0 ){ - int code = errno; - fprintf(stderr, "fchmod %o FAILED with %d %s\n", - cmode, code, strerror(code)); - } else { - fprintf(stderr, "fchmod %o SUCCEDED\n",cmode); - } - }else{ - int code = errno; - fprintf(stderr, "STAT FAILED[%d] with %d %s\n", - err, code, strerror(code)); -#endif - } - } - } - conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, SHARED_LOCK); - - end_takeconch: - OSTRACE(("TRANSPROXY: CLOSE %d\n", pFile->h)); - if( rc==SQLITE_OK && pFile->openFlags ){ - int fd; - if( pFile->h>=0 ){ - robust_close(pFile, pFile->h, __LINE__); - } - pFile->h = -1; - fd = robust_open(pCtx->dbPath, pFile->openFlags, 0); - OSTRACE(("TRANSPROXY: OPEN %d\n", fd)); - if( fd>=0 ){ - pFile->h = fd; - }else{ - rc=SQLITE_CANTOPEN_BKPT; /* SQLITE_BUSY? proxyTakeConch called - during locking */ - } - } - if( rc==SQLITE_OK && !pCtx->lockProxy ){ - char *path = tempLockPath ? tempLockPath : pCtx->lockProxyPath; - rc = proxyCreateUnixFile(path, &pCtx->lockProxy, 1); - if( rc!=SQLITE_OK && rc!=SQLITE_NOMEM && tryOldLockPath ){ - /* we couldn't create the proxy lock file with the old lock file path - ** so try again via auto-naming - */ - forceNewLockPath = 1; - tryOldLockPath = 0; - continue; /* go back to the do {} while start point, try again */ - } - } - if( rc==SQLITE_OK ){ - /* Need to make a copy of path if we extracted the value - ** from the conch file or the path was allocated on the stack - */ - if( tempLockPath ){ - pCtx->lockProxyPath = sqlite3DbStrDup(0, tempLockPath); - if( !pCtx->lockProxyPath ){ - rc = SQLITE_NOMEM; - } - } - } - if( rc==SQLITE_OK ){ - pCtx->conchHeld = 1; - - if( pCtx->lockProxy->pMethod == &afpIoMethods ){ - afpLockingContext *afpCtx; - afpCtx = (afpLockingContext *)pCtx->lockProxy->lockingContext; - afpCtx->dbPath = pCtx->lockProxyPath; - } - } else { - conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK); - } - OSTRACE(("TAKECONCH %d %s\n", conchFile->h, - rc==SQLITE_OK?"ok":"failed")); - return rc; - } while (1); /* in case we need to retry the :auto: lock file - - ** we should never get here except via the 'continue' call. */ - } -} - -/* -** If pFile holds a lock on a conch file, then release that lock. -*/ -static int proxyReleaseConch(unixFile *pFile){ - int rc = SQLITE_OK; /* Subroutine return code */ - proxyLockingContext *pCtx; /* The locking context for the proxy lock */ - unixFile *conchFile; /* Name of the conch file */ - - pCtx = (proxyLockingContext *)pFile->lockingContext; - conchFile = pCtx->conchFile; - OSTRACE(("RELEASECONCH %d for %s pid=%d\n", conchFile->h, - (pCtx->lockProxyPath ? pCtx->lockProxyPath : ":auto:"), - getpid())); - if( pCtx->conchHeld>0 ){ - rc = conchFile->pMethod->xUnlock((sqlite3_file*)conchFile, NO_LOCK); - } - pCtx->conchHeld = 0; - OSTRACE(("RELEASECONCH %d %s\n", conchFile->h, - (rc==SQLITE_OK ? "ok" : "failed"))); - return rc; -} - -/* -** Given the name of a database file, compute the name of its conch file. -** Store the conch filename in memory obtained from sqlite3_malloc(). -** Make *pConchPath point to the new name. Return SQLITE_OK on success -** or SQLITE_NOMEM if unable to obtain memory. -** -** The caller is responsible for ensuring that the allocated memory -** space is eventually freed. -** -** *pConchPath is set to NULL if a memory allocation error occurs. -*/ -static int proxyCreateConchPathname(char *dbPath, char **pConchPath){ - int i; /* Loop counter */ - int len = (int)strlen(dbPath); /* Length of database filename - dbPath */ - char *conchPath; /* buffer in which to construct conch name */ - - /* Allocate space for the conch filename and initialize the name to - ** the name of the original database file. */ - *pConchPath = conchPath = (char *)sqlite3_malloc(len + 8); - if( conchPath==0 ){ - return SQLITE_NOMEM; - } - memcpy(conchPath, dbPath, len+1); - - /* now insert a "." before the last / character */ - for( i=(len-1); i>=0; i-- ){ - if( conchPath[i]=='/' ){ - i++; - break; - } - } - conchPath[i]='.'; - while ( ilockingContext; - char *oldPath = pCtx->lockProxyPath; - int rc = SQLITE_OK; - - if( pFile->eFileLock!=NO_LOCK ){ - return SQLITE_BUSY; - } - - /* nothing to do if the path is NULL, :auto: or matches the existing path */ - if( !path || path[0]=='\0' || !strcmp(path, ":auto:") || - (oldPath && !strncmp(oldPath, path, MAXPATHLEN)) ){ - return SQLITE_OK; - }else{ - unixFile *lockProxy = pCtx->lockProxy; - pCtx->lockProxy=NULL; - pCtx->conchHeld = 0; - if( lockProxy!=NULL ){ - rc=lockProxy->pMethod->xClose((sqlite3_file *)lockProxy); - if( rc ) return rc; - sqlite3_free(lockProxy); - } - sqlite3_free(oldPath); - pCtx->lockProxyPath = sqlite3DbStrDup(0, path); - } - - return rc; -} - -/* -** pFile is a file that has been opened by a prior xOpen call. dbPath -** is a string buffer at least MAXPATHLEN+1 characters in size. -** -** This routine find the filename associated with pFile and writes it -** int dbPath. -*/ -static int proxyGetDbPathForUnixFile(unixFile *pFile, char *dbPath){ -#if defined(__APPLE__) - if( pFile->pMethod == &afpIoMethods ){ - /* afp style keeps a reference to the db path in the filePath field - ** of the struct */ - assert( (int)strlen((char*)pFile->lockingContext)<=MAXPATHLEN ); - strlcpy(dbPath, ((afpLockingContext *)pFile->lockingContext)->dbPath, MAXPATHLEN); - } else -#endif - if( pFile->pMethod == &dotlockIoMethods ){ - /* dot lock style uses the locking context to store the dot lock - ** file path */ - int len = strlen((char *)pFile->lockingContext) - strlen(DOTLOCK_SUFFIX); - memcpy(dbPath, (char *)pFile->lockingContext, len + 1); - }else{ - /* all other styles use the locking context to store the db file path */ - assert( strlen((char*)pFile->lockingContext)<=MAXPATHLEN ); - strlcpy(dbPath, (char *)pFile->lockingContext, MAXPATHLEN); - } - return SQLITE_OK; -} - -/* -** Takes an already filled in unix file and alters it so all file locking -** will be performed on the local proxy lock file. The following fields -** are preserved in the locking context so that they can be restored and -** the unix structure properly cleaned up at close time: -** ->lockingContext -** ->pMethod -*/ -static int proxyTransformUnixFile(unixFile *pFile, const char *path) { - proxyLockingContext *pCtx; - char dbPath[MAXPATHLEN+1]; /* Name of the database file */ - char *lockPath=NULL; - int rc = SQLITE_OK; - - if( pFile->eFileLock!=NO_LOCK ){ - return SQLITE_BUSY; - } - proxyGetDbPathForUnixFile(pFile, dbPath); - if( !path || path[0]=='\0' || !strcmp(path, ":auto:") ){ - lockPath=NULL; - }else{ - lockPath=(char *)path; - } - - OSTRACE(("TRANSPROXY %d for %s pid=%d\n", pFile->h, - (lockPath ? lockPath : ":auto:"), getpid())); - - pCtx = sqlite3_malloc( sizeof(*pCtx) ); - if( pCtx==0 ){ - return SQLITE_NOMEM; - } - memset(pCtx, 0, sizeof(*pCtx)); - - rc = proxyCreateConchPathname(dbPath, &pCtx->conchFilePath); - if( rc==SQLITE_OK ){ - rc = proxyCreateUnixFile(pCtx->conchFilePath, &pCtx->conchFile, 0); - if( rc==SQLITE_CANTOPEN && ((pFile->openFlags&O_RDWR) == 0) ){ - /* if (a) the open flags are not O_RDWR, (b) the conch isn't there, and - ** (c) the file system is read-only, then enable no-locking access. - ** Ugh, since O_RDONLY==0x0000 we test for !O_RDWR since unixOpen asserts - ** that openFlags will have only one of O_RDONLY or O_RDWR. - */ - struct statfs fsInfo; - struct stat conchInfo; - int goLockless = 0; - - if( osStat(pCtx->conchFilePath, &conchInfo) == -1 ) { - int err = errno; - if( (err==ENOENT) && (statfs(dbPath, &fsInfo) != -1) ){ - goLockless = (fsInfo.f_flags&MNT_RDONLY) == MNT_RDONLY; - } - } - if( goLockless ){ - pCtx->conchHeld = -1; /* read only FS/ lockless */ - rc = SQLITE_OK; - } - } - } - if( rc==SQLITE_OK && lockPath ){ - pCtx->lockProxyPath = sqlite3DbStrDup(0, lockPath); - } - - if( rc==SQLITE_OK ){ - pCtx->dbPath = sqlite3DbStrDup(0, dbPath); - if( pCtx->dbPath==NULL ){ - rc = SQLITE_NOMEM; - } - } - if( rc==SQLITE_OK ){ - /* all memory is allocated, proxys are created and assigned, - ** switch the locking context and pMethod then return. - */ - pCtx->oldLockingContext = pFile->lockingContext; - pFile->lockingContext = pCtx; - pCtx->pOldMethod = pFile->pMethod; - pFile->pMethod = &proxyIoMethods; - }else{ - if( pCtx->conchFile ){ - pCtx->conchFile->pMethod->xClose((sqlite3_file *)pCtx->conchFile); - sqlite3_free(pCtx->conchFile); - } - sqlite3DbFree(0, pCtx->lockProxyPath); - sqlite3_free(pCtx->conchFilePath); - sqlite3_free(pCtx); - } - OSTRACE(("TRANSPROXY %d %s\n", pFile->h, - (rc==SQLITE_OK ? "ok" : "failed"))); - return rc; -} - - -/* -** This routine handles sqlite3_file_control() calls that are specific -** to proxy locking. -*/ -static int proxyFileControl(sqlite3_file *id, int op, void *pArg){ - switch( op ){ - case SQLITE_GET_LOCKPROXYFILE: { - unixFile *pFile = (unixFile*)id; - if( pFile->pMethod == &proxyIoMethods ){ - proxyLockingContext *pCtx = (proxyLockingContext*)pFile->lockingContext; - proxyTakeConch(pFile); - if( pCtx->lockProxyPath ){ - *(const char **)pArg = pCtx->lockProxyPath; - }else{ - *(const char **)pArg = ":auto: (not held)"; - } - } else { - *(const char **)pArg = NULL; - } - return SQLITE_OK; - } - case SQLITE_SET_LOCKPROXYFILE: { - unixFile *pFile = (unixFile*)id; - int rc = SQLITE_OK; - int isProxyStyle = (pFile->pMethod == &proxyIoMethods); - if( pArg==NULL || (const char *)pArg==0 ){ - if( isProxyStyle ){ - /* turn off proxy locking - not supported */ - rc = SQLITE_ERROR /*SQLITE_PROTOCOL? SQLITE_MISUSE?*/; - }else{ - /* turn off proxy locking - already off - NOOP */ - rc = SQLITE_OK; - } - }else{ - const char *proxyPath = (const char *)pArg; - if( isProxyStyle ){ - proxyLockingContext *pCtx = - (proxyLockingContext*)pFile->lockingContext; - if( !strcmp(pArg, ":auto:") - || (pCtx->lockProxyPath && - !strncmp(pCtx->lockProxyPath, proxyPath, MAXPATHLEN)) - ){ - rc = SQLITE_OK; - }else{ - rc = switchLockProxyPath(pFile, proxyPath); - } - }else{ - /* turn on proxy file locking */ - rc = proxyTransformUnixFile(pFile, proxyPath); - } - } - return rc; - } - default: { - assert( 0 ); /* The call assures that only valid opcodes are sent */ - } - } - /*NOTREACHED*/ - return SQLITE_ERROR; -} - -/* -** Within this division (the proxying locking implementation) the procedures -** above this point are all utilities. The lock-related methods of the -** proxy-locking sqlite3_io_method object follow. -*/ - - -/* -** This routine checks if there is a RESERVED lock held on the specified -** file by this or any other process. If such a lock is held, set *pResOut -** to a non-zero value otherwise *pResOut is set to zero. The return value -** is set to SQLITE_OK unless an I/O error occurs during lock checking. -*/ -static int proxyCheckReservedLock(sqlite3_file *id, int *pResOut) { - unixFile *pFile = (unixFile*)id; - int rc = proxyTakeConch(pFile); - if( rc==SQLITE_OK ){ - proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; - if( pCtx->conchHeld>0 ){ - unixFile *proxy = pCtx->lockProxy; - return proxy->pMethod->xCheckReservedLock((sqlite3_file*)proxy, pResOut); - }else{ /* conchHeld < 0 is lockless */ - pResOut=0; - } - } - return rc; -} - -/* -** Lock the file with the lock specified by parameter eFileLock - one -** of the following: -** -** (1) SHARED_LOCK -** (2) RESERVED_LOCK -** (3) PENDING_LOCK -** (4) EXCLUSIVE_LOCK -** -** Sometimes when requesting one lock state, additional lock states -** are inserted in between. The locking might fail on one of the later -** transitions leaving the lock state different from what it started but -** still short of its goal. The following chart shows the allowed -** transitions and the inserted intermediate states: -** -** UNLOCKED -> SHARED -** SHARED -> RESERVED -** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> (PENDING) -> EXCLUSIVE -** PENDING -> EXCLUSIVE -** -** This routine will only increase a lock. Use the sqlite3OsUnlock() -** routine to lower a locking level. -*/ -static int proxyLock(sqlite3_file *id, int eFileLock) { - unixFile *pFile = (unixFile*)id; - int rc = proxyTakeConch(pFile); - if( rc==SQLITE_OK ){ - proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; - if( pCtx->conchHeld>0 ){ - unixFile *proxy = pCtx->lockProxy; - rc = proxy->pMethod->xLock((sqlite3_file*)proxy, eFileLock); - pFile->eFileLock = proxy->eFileLock; - }else{ - /* conchHeld < 0 is lockless */ - } - } - return rc; -} - - -/* -** Lower the locking level on file descriptor pFile to eFileLock. eFileLock -** must be either NO_LOCK or SHARED_LOCK. -** -** If the locking level of the file descriptor is already at or below -** the requested locking level, this routine is a no-op. -*/ -static int proxyUnlock(sqlite3_file *id, int eFileLock) { - unixFile *pFile = (unixFile*)id; - int rc = proxyTakeConch(pFile); - if( rc==SQLITE_OK ){ - proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; - if( pCtx->conchHeld>0 ){ - unixFile *proxy = pCtx->lockProxy; - rc = proxy->pMethod->xUnlock((sqlite3_file*)proxy, eFileLock); - pFile->eFileLock = proxy->eFileLock; - }else{ - /* conchHeld < 0 is lockless */ - } - } - return rc; -} - -/* -** Close a file that uses proxy locks. -*/ -static int proxyClose(sqlite3_file *id) { - if( id ){ - unixFile *pFile = (unixFile*)id; - proxyLockingContext *pCtx = (proxyLockingContext *)pFile->lockingContext; - unixFile *lockProxy = pCtx->lockProxy; - unixFile *conchFile = pCtx->conchFile; - int rc = SQLITE_OK; - - if( lockProxy ){ - rc = lockProxy->pMethod->xUnlock((sqlite3_file*)lockProxy, NO_LOCK); - if( rc ) return rc; - rc = lockProxy->pMethod->xClose((sqlite3_file*)lockProxy); - if( rc ) return rc; - sqlite3_free(lockProxy); - pCtx->lockProxy = 0; - } - if( conchFile ){ - if( pCtx->conchHeld ){ - rc = proxyReleaseConch(pFile); - if( rc ) return rc; - } - rc = conchFile->pMethod->xClose((sqlite3_file*)conchFile); - if( rc ) return rc; - sqlite3_free(conchFile); - } - sqlite3DbFree(0, pCtx->lockProxyPath); - sqlite3_free(pCtx->conchFilePath); - sqlite3DbFree(0, pCtx->dbPath); - /* restore the original locking context and pMethod then close it */ - pFile->lockingContext = pCtx->oldLockingContext; - pFile->pMethod = pCtx->pOldMethod; - sqlite3_free(pCtx); - return pFile->pMethod->xClose(id); - } - return SQLITE_OK; -} - - - -#endif /* defined(__APPLE__) && SQLITE_ENABLE_LOCKING_STYLE */ -/* -** The proxy locking style is intended for use with AFP filesystems. -** And since AFP is only supported on MacOSX, the proxy locking is also -** restricted to MacOSX. -** -** -******************* End of the proxy lock implementation ********************** -******************************************************************************/ - -/* -** Initialize the operating system interface. -** -** This routine registers all VFS implementations for unix-like operating -** systems. This routine, and the sqlite3_os_end() routine that follows, -** should be the only routines in this file that are visible from other -** files. -** -** This routine is called once during SQLite initialization and by a -** single thread. The memory allocation and mutex subsystems have not -** necessarily been initialized when this routine is called, and so they -** should not be used. -*/ -SQLITE_API int sqlite3_os_init(void){ - /* - ** The following macro defines an initializer for an sqlite3_vfs object. - ** The name of the VFS is NAME. The pAppData is a pointer to a pointer - ** to the "finder" function. (pAppData is a pointer to a pointer because - ** silly C90 rules prohibit a void* from being cast to a function pointer - ** and so we have to go through the intermediate pointer to avoid problems - ** when compiling with -pedantic-errors on GCC.) - ** - ** The FINDER parameter to this macro is the name of the pointer to the - ** finder-function. The finder-function returns a pointer to the - ** sqlite_io_methods object that implements the desired locking - ** behaviors. See the division above that contains the IOMETHODS - ** macro for addition information on finder-functions. - ** - ** Most finders simply return a pointer to a fixed sqlite3_io_methods - ** object. But the "autolockIoFinder" available on MacOSX does a little - ** more than that; it looks at the filesystem type that hosts the - ** database file and tries to choose an locking method appropriate for - ** that filesystem time. - */ - #define UNIXVFS(VFSNAME, FINDER) { \ - 3, /* iVersion */ \ - sizeof(unixFile), /* szOsFile */ \ - MAX_PATHNAME, /* mxPathname */ \ - 0, /* pNext */ \ - VFSNAME, /* zName */ \ - (void*)&FINDER, /* pAppData */ \ - unixOpen, /* xOpen */ \ - unixDelete, /* xDelete */ \ - unixAccess, /* xAccess */ \ - unixFullPathname, /* xFullPathname */ \ - unixDlOpen, /* xDlOpen */ \ - unixDlError, /* xDlError */ \ - unixDlSym, /* xDlSym */ \ - unixDlClose, /* xDlClose */ \ - unixRandomness, /* xRandomness */ \ - unixSleep, /* xSleep */ \ - unixCurrentTime, /* xCurrentTime */ \ - unixGetLastError, /* xGetLastError */ \ - unixCurrentTimeInt64, /* xCurrentTimeInt64 */ \ - unixSetSystemCall, /* xSetSystemCall */ \ - unixGetSystemCall, /* xGetSystemCall */ \ - unixNextSystemCall, /* xNextSystemCall */ \ - } - - /* - ** All default VFSes for unix are contained in the following array. - ** - ** Note that the sqlite3_vfs.pNext field of the VFS object is modified - ** by the SQLite core when the VFS is registered. So the following - ** array cannot be const. - */ - static sqlite3_vfs aVfs[] = { -#if SQLITE_ENABLE_LOCKING_STYLE && (OS_VXWORKS || defined(__APPLE__)) - UNIXVFS("unix", autolockIoFinder ), -#else - UNIXVFS("unix", posixIoFinder ), -#endif - UNIXVFS("unix-none", nolockIoFinder ), - UNIXVFS("unix-dotfile", dotlockIoFinder ), - UNIXVFS("unix-excl", posixIoFinder ), -#if OS_VXWORKS - UNIXVFS("unix-namedsem", semIoFinder ), -#endif -#if SQLITE_ENABLE_LOCKING_STYLE - UNIXVFS("unix-posix", posixIoFinder ), -#if !OS_VXWORKS - UNIXVFS("unix-flock", flockIoFinder ), -#endif -#endif -#if SQLITE_ENABLE_LOCKING_STYLE && defined(__APPLE__) - UNIXVFS("unix-afp", afpIoFinder ), - UNIXVFS("unix-nfs", nfsIoFinder ), - UNIXVFS("unix-proxy", proxyIoFinder ), -#endif - }; - unsigned int i; /* Loop counter */ - - /* Double-check that the aSyscall[] array has been constructed - ** correctly. See ticket [bb3a86e890c8e96ab] */ - assert( ArraySize(aSyscall)==24 ); - - /* Register all VFSes defined in the aVfs[] array */ - for(i=0; i<(sizeof(aVfs)/sizeof(sqlite3_vfs)); i++){ - sqlite3_vfs_register(&aVfs[i], i==0); - } - return SQLITE_OK; -} - -/* -** Shutdown the operating system interface. -** -** Some operating systems might need to do some cleanup in this routine, -** to release dynamically allocated objects. But not on unix. -** This routine is a no-op for unix. -*/ -SQLITE_API int sqlite3_os_end(void){ - return SQLITE_OK; -} - -#endif /* SQLITE_OS_UNIX */ - -/************** End of os_unix.c *********************************************/ -/************** Begin file os_win.c ******************************************/ -/* -** 2004 May 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains code that is specific to Windows. -*/ -#if SQLITE_OS_WIN /* This file is used for Windows only */ - -#ifdef __CYGWIN__ -# include -# include /* amalgamator: keep */ -#endif - -/* -** Include code that is common to all os_*.c files -*/ -/************** Include os_common.h in the middle of os_win.c ****************/ -/************** Begin file os_common.h ***************************************/ -/* -** 2004 May 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains macros and a little bit of code that is common to -** all of the platform-specific files (os_*.c) and is #included into those -** files. -** -** This file should be #included by the os_*.c files only. It is not a -** general purpose header file. -*/ -#ifndef _OS_COMMON_H_ -#define _OS_COMMON_H_ - -/* -** At least two bugs have slipped in because we changed the MEMORY_DEBUG -** macro to SQLITE_DEBUG and some older makefiles have not yet made the -** switch. The following code should catch this problem at compile-time. -*/ -#ifdef MEMORY_DEBUG -# error "The MEMORY_DEBUG macro is obsolete. Use SQLITE_DEBUG instead." -#endif - -#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) -# ifndef SQLITE_DEBUG_OS_TRACE -# define SQLITE_DEBUG_OS_TRACE 0 -# endif - int sqlite3OSTrace = SQLITE_DEBUG_OS_TRACE; -# define OSTRACE(X) if( sqlite3OSTrace ) sqlite3DebugPrintf X -#else -# define OSTRACE(X) -#endif - -/* -** Macros for performance tracing. Normally turned off. Only works -** on i486 hardware. -*/ -#ifdef SQLITE_PERFORMANCE_TRACE - -/* -** hwtime.h contains inline assembler code for implementing -** high-performance timing routines. -*/ -/************** Include hwtime.h in the middle of os_common.h ****************/ -/************** Begin file hwtime.h ******************************************/ -/* -** 2008 May 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains inline asm code for retrieving "high-performance" -** counters for x86 class CPUs. -*/ -#ifndef _HWTIME_H_ -#define _HWTIME_H_ - -/* -** The following routine only works on pentium-class (or newer) processors. -** It uses the RDTSC opcode to read the cycle count value out of the -** processor and returns that value. This can be used for high-res -** profiling. -*/ -#if (defined(__GNUC__) || defined(_MSC_VER)) && \ - (defined(i386) || defined(__i386__) || defined(_M_IX86)) - - #if defined(__GNUC__) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned int lo, hi; - __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); - return (sqlite_uint64)hi << 32 | lo; - } - - #elif defined(_MSC_VER) - - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ - __asm { - rdtsc - ret ; return value at EDX:EAX - } - } - - #endif - -#elif (defined(__GNUC__) && defined(__x86_64__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long val; - __asm__ __volatile__ ("rdtsc" : "=A" (val)); - return val; - } - -#elif (defined(__GNUC__) && defined(__ppc__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long long retval; - unsigned long junk; - __asm__ __volatile__ ("\n\ - 1: mftbu %1\n\ - mftb %L0\n\ - mftbu %0\n\ - cmpw %0,%1\n\ - bne 1b" - : "=r" (retval), "=r" (junk)); - return retval; - } - -#else - - #error Need implementation of sqlite3Hwtime() for your platform. - - /* - ** To compile without implementing sqlite3Hwtime() for your platform, - ** you can remove the above #error and use the following - ** stub function. You will lose timing support for many - ** of the debugging and testing utilities, but it should at - ** least compile and run. - */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } - -#endif - -#endif /* !defined(_HWTIME_H_) */ - -/************** End of hwtime.h **********************************************/ -/************** Continuing where we left off in os_common.h ******************/ - -static sqlite_uint64 g_start; -static sqlite_uint64 g_elapsed; -#define TIMER_START g_start=sqlite3Hwtime() -#define TIMER_END g_elapsed=sqlite3Hwtime()-g_start -#define TIMER_ELAPSED g_elapsed -#else -#define TIMER_START -#define TIMER_END -#define TIMER_ELAPSED ((sqlite_uint64)0) -#endif - -/* -** If we compile with the SQLITE_TEST macro set, then the following block -** of code will give us the ability to simulate a disk I/O error. This -** is used for testing the I/O recovery logic. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_io_error_hit = 0; /* Total number of I/O Errors */ -SQLITE_API int sqlite3_io_error_hardhit = 0; /* Number of non-benign errors */ -SQLITE_API int sqlite3_io_error_pending = 0; /* Count down to first I/O error */ -SQLITE_API int sqlite3_io_error_persist = 0; /* True if I/O errors persist */ -SQLITE_API int sqlite3_io_error_benign = 0; /* True if errors are benign */ -SQLITE_API int sqlite3_diskfull_pending = 0; -SQLITE_API int sqlite3_diskfull = 0; -#define SimulateIOErrorBenign(X) sqlite3_io_error_benign=(X) -#define SimulateIOError(CODE) \ - if( (sqlite3_io_error_persist && sqlite3_io_error_hit) \ - || sqlite3_io_error_pending-- == 1 ) \ - { local_ioerr(); CODE; } -static void local_ioerr(){ - IOTRACE(("IOERR\n")); - sqlite3_io_error_hit++; - if( !sqlite3_io_error_benign ) sqlite3_io_error_hardhit++; -} -#define SimulateDiskfullError(CODE) \ - if( sqlite3_diskfull_pending ){ \ - if( sqlite3_diskfull_pending == 1 ){ \ - local_ioerr(); \ - sqlite3_diskfull = 1; \ - sqlite3_io_error_hit = 1; \ - CODE; \ - }else{ \ - sqlite3_diskfull_pending--; \ - } \ - } -#else -#define SimulateIOErrorBenign(X) -#define SimulateIOError(A) -#define SimulateDiskfullError(A) -#endif - -/* -** When testing, keep a count of the number of open files. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_open_file_count = 0; -#define OpenCounter(X) sqlite3_open_file_count+=(X) -#else -#define OpenCounter(X) -#endif - -#endif /* !defined(_OS_COMMON_H_) */ - -/************** End of os_common.h *******************************************/ -/************** Continuing where we left off in os_win.c *********************/ - -/* -** Compiling and using WAL mode requires several APIs that are only -** available in Windows platforms based on the NT kernel. -*/ -#if !SQLITE_OS_WINNT && !defined(SQLITE_OMIT_WAL) -# error "WAL mode requires support from the Windows NT kernel, compile\ - with SQLITE_OMIT_WAL." -#endif - -/* -** Are most of the Win32 ANSI APIs available (i.e. with certain exceptions -** based on the sub-platform)? -*/ -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(SQLITE_WIN32_NO_ANSI) -# define SQLITE_WIN32_HAS_ANSI -#endif - -/* -** Are most of the Win32 Unicode APIs available (i.e. with certain exceptions -** based on the sub-platform)? -*/ -#if (SQLITE_OS_WINCE || SQLITE_OS_WINNT || SQLITE_OS_WINRT) && \ - !defined(SQLITE_WIN32_NO_WIDE) -# define SQLITE_WIN32_HAS_WIDE -#endif - -/* -** Make sure at least one set of Win32 APIs is available. -*/ -#if !defined(SQLITE_WIN32_HAS_ANSI) && !defined(SQLITE_WIN32_HAS_WIDE) -# error "At least one of SQLITE_WIN32_HAS_ANSI and SQLITE_WIN32_HAS_WIDE\ - must be defined." -#endif - -/* -** Define the required Windows SDK version constants if they are not -** already available. -*/ -#ifndef NTDDI_WIN8 -# define NTDDI_WIN8 0x06020000 -#endif - -#ifndef NTDDI_WINBLUE -# define NTDDI_WINBLUE 0x06030000 -#endif - -/* -** Check if the GetVersionEx[AW] functions should be considered deprecated -** and avoid using them in that case. It should be noted here that if the -** value of the SQLITE_WIN32_GETVERSIONEX pre-processor macro is zero -** (whether via this block or via being manually specified), that implies -** the underlying operating system will always be based on the Windows NT -** Kernel. -*/ -#ifndef SQLITE_WIN32_GETVERSIONEX -# if defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WINBLUE -# define SQLITE_WIN32_GETVERSIONEX 0 -# else -# define SQLITE_WIN32_GETVERSIONEX 1 -# endif -#endif - -/* -** This constant should already be defined (in the "WinDef.h" SDK file). -*/ -#ifndef MAX_PATH -# define MAX_PATH (260) -#endif - -/* -** Maximum pathname length (in chars) for Win32. This should normally be -** MAX_PATH. -*/ -#ifndef SQLITE_WIN32_MAX_PATH_CHARS -# define SQLITE_WIN32_MAX_PATH_CHARS (MAX_PATH) -#endif - -/* -** This constant should already be defined (in the "WinNT.h" SDK file). -*/ -#ifndef UNICODE_STRING_MAX_CHARS -# define UNICODE_STRING_MAX_CHARS (32767) -#endif - -/* -** Maximum pathname length (in chars) for WinNT. This should normally be -** UNICODE_STRING_MAX_CHARS. -*/ -#ifndef SQLITE_WINNT_MAX_PATH_CHARS -# define SQLITE_WINNT_MAX_PATH_CHARS (UNICODE_STRING_MAX_CHARS) -#endif - -/* -** Maximum pathname length (in bytes) for Win32. The MAX_PATH macro is in -** characters, so we allocate 4 bytes per character assuming worst-case of -** 4-bytes-per-character for UTF8. -*/ -#ifndef SQLITE_WIN32_MAX_PATH_BYTES -# define SQLITE_WIN32_MAX_PATH_BYTES (SQLITE_WIN32_MAX_PATH_CHARS*4) -#endif - -/* -** Maximum pathname length (in bytes) for WinNT. This should normally be -** UNICODE_STRING_MAX_CHARS * sizeof(WCHAR). -*/ -#ifndef SQLITE_WINNT_MAX_PATH_BYTES -# define SQLITE_WINNT_MAX_PATH_BYTES \ - (sizeof(WCHAR) * SQLITE_WINNT_MAX_PATH_CHARS) -#endif - -/* -** Maximum error message length (in chars) for WinRT. -*/ -#ifndef SQLITE_WIN32_MAX_ERRMSG_CHARS -# define SQLITE_WIN32_MAX_ERRMSG_CHARS (1024) -#endif - -/* -** Returns non-zero if the character should be treated as a directory -** separator. -*/ -#ifndef winIsDirSep -# define winIsDirSep(a) (((a) == '/') || ((a) == '\\')) -#endif - -/* -** This macro is used when a local variable is set to a value that is -** [sometimes] not used by the code (e.g. via conditional compilation). -*/ -#ifndef UNUSED_VARIABLE_VALUE -# define UNUSED_VARIABLE_VALUE(x) (void)(x) -#endif - -/* -** Returns the character that should be used as the directory separator. -*/ -#ifndef winGetDirSep -# define winGetDirSep() '\\' -#endif - -/* -** Do we need to manually define the Win32 file mapping APIs for use with WAL -** mode (e.g. these APIs are available in the Windows CE SDK; however, they -** are not present in the header file)? -*/ -#if SQLITE_WIN32_FILEMAPPING_API && !defined(SQLITE_OMIT_WAL) -/* -** Two of the file mapping APIs are different under WinRT. Figure out which -** set we need. -*/ -#if SQLITE_OS_WINRT -WINBASEAPI HANDLE WINAPI CreateFileMappingFromApp(HANDLE, \ - LPSECURITY_ATTRIBUTES, ULONG, ULONG64, LPCWSTR); - -WINBASEAPI LPVOID WINAPI MapViewOfFileFromApp(HANDLE, ULONG, ULONG64, SIZE_T); -#else -#if defined(SQLITE_WIN32_HAS_ANSI) -WINBASEAPI HANDLE WINAPI CreateFileMappingA(HANDLE, LPSECURITY_ATTRIBUTES, \ - DWORD, DWORD, DWORD, LPCSTR); -#endif /* defined(SQLITE_WIN32_HAS_ANSI) */ - -#if defined(SQLITE_WIN32_HAS_WIDE) -WINBASEAPI HANDLE WINAPI CreateFileMappingW(HANDLE, LPSECURITY_ATTRIBUTES, \ - DWORD, DWORD, DWORD, LPCWSTR); -#endif /* defined(SQLITE_WIN32_HAS_WIDE) */ - -WINBASEAPI LPVOID WINAPI MapViewOfFile(HANDLE, DWORD, DWORD, DWORD, SIZE_T); -#endif /* SQLITE_OS_WINRT */ - -/* -** This file mapping API is common to both Win32 and WinRT. -*/ -WINBASEAPI BOOL WINAPI UnmapViewOfFile(LPCVOID); -#endif /* SQLITE_WIN32_FILEMAPPING_API && !defined(SQLITE_OMIT_WAL) */ - -/* -** Some Microsoft compilers lack this definition. -*/ -#ifndef INVALID_FILE_ATTRIBUTES -# define INVALID_FILE_ATTRIBUTES ((DWORD)-1) -#endif - -#ifndef FILE_FLAG_MASK -# define FILE_FLAG_MASK (0xFF3C0000) -#endif - -#ifndef FILE_ATTRIBUTE_MASK -# define FILE_ATTRIBUTE_MASK (0x0003FFF7) -#endif - -#ifndef SQLITE_OMIT_WAL -/* Forward references to structures used for WAL */ -typedef struct winShm winShm; /* A connection to shared-memory */ -typedef struct winShmNode winShmNode; /* A region of shared-memory */ -#endif - -/* -** WinCE lacks native support for file locking so we have to fake it -** with some code of our own. -*/ -#if SQLITE_OS_WINCE -typedef struct winceLock { - int nReaders; /* Number of reader locks obtained */ - BOOL bPending; /* Indicates a pending lock has been obtained */ - BOOL bReserved; /* Indicates a reserved lock has been obtained */ - BOOL bExclusive; /* Indicates an exclusive lock has been obtained */ -} winceLock; -#endif - -/* -** The winFile structure is a subclass of sqlite3_file* specific to the win32 -** portability layer. -*/ -typedef struct winFile winFile; -struct winFile { - const sqlite3_io_methods *pMethod; /*** Must be first ***/ - sqlite3_vfs *pVfs; /* The VFS used to open this file */ - HANDLE h; /* Handle for accessing the file */ - u8 locktype; /* Type of lock currently held on this file */ - short sharedLockByte; /* Randomly chosen byte used as a shared lock */ - u8 ctrlFlags; /* Flags. See WINFILE_* below */ - DWORD lastErrno; /* The Windows errno from the last I/O error */ -#ifndef SQLITE_OMIT_WAL - winShm *pShm; /* Instance of shared memory on this file */ -#endif - const char *zPath; /* Full pathname of this file */ - int szChunk; /* Chunk size configured by FCNTL_CHUNK_SIZE */ -#if SQLITE_OS_WINCE - LPWSTR zDeleteOnClose; /* Name of file to delete when closing */ - HANDLE hMutex; /* Mutex used to control access to shared lock */ - HANDLE hShared; /* Shared memory segment used for locking */ - winceLock local; /* Locks obtained by this instance of winFile */ - winceLock *shared; /* Global shared lock memory for the file */ -#endif -#if SQLITE_MAX_MMAP_SIZE>0 - int nFetchOut; /* Number of outstanding xFetch references */ - HANDLE hMap; /* Handle for accessing memory mapping */ - void *pMapRegion; /* Area memory mapped */ - sqlite3_int64 mmapSize; /* Usable size of mapped region */ - sqlite3_int64 mmapSizeActual; /* Actual size of mapped region */ - sqlite3_int64 mmapSizeMax; /* Configured FCNTL_MMAP_SIZE value */ -#endif -}; - -/* -** Allowed values for winFile.ctrlFlags -*/ -#define WINFILE_RDONLY 0x02 /* Connection is read only */ -#define WINFILE_PERSIST_WAL 0x04 /* Persistent WAL mode */ -#define WINFILE_PSOW 0x10 /* SQLITE_IOCAP_POWERSAFE_OVERWRITE */ - -/* - * The size of the buffer used by sqlite3_win32_write_debug(). - */ -#ifndef SQLITE_WIN32_DBG_BUF_SIZE -# define SQLITE_WIN32_DBG_BUF_SIZE ((int)(4096-sizeof(DWORD))) -#endif - -/* - * The value used with sqlite3_win32_set_directory() to specify that - * the data directory should be changed. - */ -#ifndef SQLITE_WIN32_DATA_DIRECTORY_TYPE -# define SQLITE_WIN32_DATA_DIRECTORY_TYPE (1) -#endif - -/* - * The value used with sqlite3_win32_set_directory() to specify that - * the temporary directory should be changed. - */ -#ifndef SQLITE_WIN32_TEMP_DIRECTORY_TYPE -# define SQLITE_WIN32_TEMP_DIRECTORY_TYPE (2) -#endif - -/* - * If compiled with SQLITE_WIN32_MALLOC on Windows, we will use the - * various Win32 API heap functions instead of our own. - */ -#ifdef SQLITE_WIN32_MALLOC - -/* - * If this is non-zero, an isolated heap will be created by the native Win32 - * allocator subsystem; otherwise, the default process heap will be used. This - * setting has no effect when compiling for WinRT. By default, this is enabled - * and an isolated heap will be created to store all allocated data. - * - ****************************************************************************** - * WARNING: It is important to note that when this setting is non-zero and the - * winMemShutdown function is called (e.g. by the sqlite3_shutdown - * function), all data that was allocated using the isolated heap will - * be freed immediately and any attempt to access any of that freed - * data will almost certainly result in an immediate access violation. - ****************************************************************************** - */ -#ifndef SQLITE_WIN32_HEAP_CREATE -# define SQLITE_WIN32_HEAP_CREATE (TRUE) -#endif - -/* - * The initial size of the Win32-specific heap. This value may be zero. - */ -#ifndef SQLITE_WIN32_HEAP_INIT_SIZE -# define SQLITE_WIN32_HEAP_INIT_SIZE ((SQLITE_DEFAULT_CACHE_SIZE) * \ - (SQLITE_DEFAULT_PAGE_SIZE) + 4194304) -#endif - -/* - * The maximum size of the Win32-specific heap. This value may be zero. - */ -#ifndef SQLITE_WIN32_HEAP_MAX_SIZE -# define SQLITE_WIN32_HEAP_MAX_SIZE (0) -#endif - -/* - * The extra flags to use in calls to the Win32 heap APIs. This value may be - * zero for the default behavior. - */ -#ifndef SQLITE_WIN32_HEAP_FLAGS -# define SQLITE_WIN32_HEAP_FLAGS (0) -#endif - - -/* -** The winMemData structure stores information required by the Win32-specific -** sqlite3_mem_methods implementation. -*/ -typedef struct winMemData winMemData; -struct winMemData { -#ifndef NDEBUG - u32 magic1; /* Magic number to detect structure corruption. */ -#endif - HANDLE hHeap; /* The handle to our heap. */ - BOOL bOwned; /* Do we own the heap (i.e. destroy it on shutdown)? */ -#ifndef NDEBUG - u32 magic2; /* Magic number to detect structure corruption. */ -#endif -}; - -#ifndef NDEBUG -#define WINMEM_MAGIC1 0x42b2830b -#define WINMEM_MAGIC2 0xbd4d7cf4 -#endif - -static struct winMemData win_mem_data = { -#ifndef NDEBUG - WINMEM_MAGIC1, -#endif - NULL, FALSE -#ifndef NDEBUG - ,WINMEM_MAGIC2 -#endif -}; - -#ifndef NDEBUG -#define winMemAssertMagic1() assert( win_mem_data.magic1==WINMEM_MAGIC1 ) -#define winMemAssertMagic2() assert( win_mem_data.magic2==WINMEM_MAGIC2 ) -#define winMemAssertMagic() winMemAssertMagic1(); winMemAssertMagic2(); -#else -#define winMemAssertMagic() -#endif - -#define winMemGetDataPtr() &win_mem_data -#define winMemGetHeap() win_mem_data.hHeap -#define winMemGetOwned() win_mem_data.bOwned - -static void *winMemMalloc(int nBytes); -static void winMemFree(void *pPrior); -static void *winMemRealloc(void *pPrior, int nBytes); -static int winMemSize(void *p); -static int winMemRoundup(int n); -static int winMemInit(void *pAppData); -static void winMemShutdown(void *pAppData); - -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void); -#endif /* SQLITE_WIN32_MALLOC */ - -/* -** The following variable is (normally) set once and never changes -** thereafter. It records whether the operating system is Win9x -** or WinNT. -** -** 0: Operating system unknown. -** 1: Operating system is Win9x. -** 2: Operating system is WinNT. -** -** In order to facilitate testing on a WinNT system, the test fixture -** can manually set this value to 1 to emulate Win98 behavior. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_os_type = 0; -#elif !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && \ - defined(SQLITE_WIN32_HAS_ANSI) && defined(SQLITE_WIN32_HAS_WIDE) -static int sqlite3_os_type = 0; -#endif - -#ifndef SYSCALL -# define SYSCALL sqlite3_syscall_ptr -#endif - -/* -** This function is not available on Windows CE or WinRT. - */ - -#if SQLITE_OS_WINCE || SQLITE_OS_WINRT -# define osAreFileApisANSI() 1 -#endif - -/* -** Many system calls are accessed through pointer-to-functions so that -** they may be overridden at runtime to facilitate fault injection during -** testing and sandboxing. The following array holds the names and pointers -** to all overrideable system calls. -*/ -static struct win_syscall { - const char *zName; /* Name of the system call */ - sqlite3_syscall_ptr pCurrent; /* Current value of the system call */ - sqlite3_syscall_ptr pDefault; /* Default value */ -} aSyscall[] = { -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT - { "AreFileApisANSI", (SYSCALL)AreFileApisANSI, 0 }, -#else - { "AreFileApisANSI", (SYSCALL)0, 0 }, -#endif - -#ifndef osAreFileApisANSI -#define osAreFileApisANSI ((BOOL(WINAPI*)(VOID))aSyscall[0].pCurrent) -#endif - -#if SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE) - { "CharLowerW", (SYSCALL)CharLowerW, 0 }, -#else - { "CharLowerW", (SYSCALL)0, 0 }, -#endif - -#define osCharLowerW ((LPWSTR(WINAPI*)(LPWSTR))aSyscall[1].pCurrent) - -#if SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_WIDE) - { "CharUpperW", (SYSCALL)CharUpperW, 0 }, -#else - { "CharUpperW", (SYSCALL)0, 0 }, -#endif - -#define osCharUpperW ((LPWSTR(WINAPI*)(LPWSTR))aSyscall[2].pCurrent) - - { "CloseHandle", (SYSCALL)CloseHandle, 0 }, - -#define osCloseHandle ((BOOL(WINAPI*)(HANDLE))aSyscall[3].pCurrent) - -#if defined(SQLITE_WIN32_HAS_ANSI) - { "CreateFileA", (SYSCALL)CreateFileA, 0 }, -#else - { "CreateFileA", (SYSCALL)0, 0 }, -#endif - -#define osCreateFileA ((HANDLE(WINAPI*)(LPCSTR,DWORD,DWORD, \ - LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[4].pCurrent) - -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) - { "CreateFileW", (SYSCALL)CreateFileW, 0 }, -#else - { "CreateFileW", (SYSCALL)0, 0 }, -#endif - -#define osCreateFileW ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD, \ - LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))aSyscall[5].pCurrent) - -#if (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_ANSI) && \ - !defined(SQLITE_OMIT_WAL)) - { "CreateFileMappingA", (SYSCALL)CreateFileMappingA, 0 }, -#else - { "CreateFileMappingA", (SYSCALL)0, 0 }, -#endif - -#define osCreateFileMappingA ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ - DWORD,DWORD,DWORD,LPCSTR))aSyscall[6].pCurrent) - -#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ - !defined(SQLITE_OMIT_WAL)) - { "CreateFileMappingW", (SYSCALL)CreateFileMappingW, 0 }, -#else - { "CreateFileMappingW", (SYSCALL)0, 0 }, -#endif - -#define osCreateFileMappingW ((HANDLE(WINAPI*)(HANDLE,LPSECURITY_ATTRIBUTES, \ - DWORD,DWORD,DWORD,LPCWSTR))aSyscall[7].pCurrent) - -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) - { "CreateMutexW", (SYSCALL)CreateMutexW, 0 }, -#else - { "CreateMutexW", (SYSCALL)0, 0 }, -#endif - -#define osCreateMutexW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,BOOL, \ - LPCWSTR))aSyscall[8].pCurrent) - -#if defined(SQLITE_WIN32_HAS_ANSI) - { "DeleteFileA", (SYSCALL)DeleteFileA, 0 }, -#else - { "DeleteFileA", (SYSCALL)0, 0 }, -#endif - -#define osDeleteFileA ((BOOL(WINAPI*)(LPCSTR))aSyscall[9].pCurrent) - -#if defined(SQLITE_WIN32_HAS_WIDE) - { "DeleteFileW", (SYSCALL)DeleteFileW, 0 }, -#else - { "DeleteFileW", (SYSCALL)0, 0 }, -#endif - -#define osDeleteFileW ((BOOL(WINAPI*)(LPCWSTR))aSyscall[10].pCurrent) - -#if SQLITE_OS_WINCE - { "FileTimeToLocalFileTime", (SYSCALL)FileTimeToLocalFileTime, 0 }, -#else - { "FileTimeToLocalFileTime", (SYSCALL)0, 0 }, -#endif - -#define osFileTimeToLocalFileTime ((BOOL(WINAPI*)(CONST FILETIME*, \ - LPFILETIME))aSyscall[11].pCurrent) - -#if SQLITE_OS_WINCE - { "FileTimeToSystemTime", (SYSCALL)FileTimeToSystemTime, 0 }, -#else - { "FileTimeToSystemTime", (SYSCALL)0, 0 }, -#endif - -#define osFileTimeToSystemTime ((BOOL(WINAPI*)(CONST FILETIME*, \ - LPSYSTEMTIME))aSyscall[12].pCurrent) - - { "FlushFileBuffers", (SYSCALL)FlushFileBuffers, 0 }, - -#define osFlushFileBuffers ((BOOL(WINAPI*)(HANDLE))aSyscall[13].pCurrent) - -#if defined(SQLITE_WIN32_HAS_ANSI) - { "FormatMessageA", (SYSCALL)FormatMessageA, 0 }, -#else - { "FormatMessageA", (SYSCALL)0, 0 }, -#endif - -#define osFormatMessageA ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPSTR, \ - DWORD,va_list*))aSyscall[14].pCurrent) - -#if defined(SQLITE_WIN32_HAS_WIDE) - { "FormatMessageW", (SYSCALL)FormatMessageW, 0 }, -#else - { "FormatMessageW", (SYSCALL)0, 0 }, -#endif - -#define osFormatMessageW ((DWORD(WINAPI*)(DWORD,LPCVOID,DWORD,DWORD,LPWSTR, \ - DWORD,va_list*))aSyscall[15].pCurrent) - -#if !defined(SQLITE_OMIT_LOAD_EXTENSION) - { "FreeLibrary", (SYSCALL)FreeLibrary, 0 }, -#else - { "FreeLibrary", (SYSCALL)0, 0 }, -#endif - -#define osFreeLibrary ((BOOL(WINAPI*)(HMODULE))aSyscall[16].pCurrent) - - { "GetCurrentProcessId", (SYSCALL)GetCurrentProcessId, 0 }, - -#define osGetCurrentProcessId ((DWORD(WINAPI*)(VOID))aSyscall[17].pCurrent) - -#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) - { "GetDiskFreeSpaceA", (SYSCALL)GetDiskFreeSpaceA, 0 }, -#else - { "GetDiskFreeSpaceA", (SYSCALL)0, 0 }, -#endif - -#define osGetDiskFreeSpaceA ((BOOL(WINAPI*)(LPCSTR,LPDWORD,LPDWORD,LPDWORD, \ - LPDWORD))aSyscall[18].pCurrent) - -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) - { "GetDiskFreeSpaceW", (SYSCALL)GetDiskFreeSpaceW, 0 }, -#else - { "GetDiskFreeSpaceW", (SYSCALL)0, 0 }, -#endif - -#define osGetDiskFreeSpaceW ((BOOL(WINAPI*)(LPCWSTR,LPDWORD,LPDWORD,LPDWORD, \ - LPDWORD))aSyscall[19].pCurrent) - -#if defined(SQLITE_WIN32_HAS_ANSI) - { "GetFileAttributesA", (SYSCALL)GetFileAttributesA, 0 }, -#else - { "GetFileAttributesA", (SYSCALL)0, 0 }, -#endif - -#define osGetFileAttributesA ((DWORD(WINAPI*)(LPCSTR))aSyscall[20].pCurrent) - -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) - { "GetFileAttributesW", (SYSCALL)GetFileAttributesW, 0 }, -#else - { "GetFileAttributesW", (SYSCALL)0, 0 }, -#endif - -#define osGetFileAttributesW ((DWORD(WINAPI*)(LPCWSTR))aSyscall[21].pCurrent) - -#if defined(SQLITE_WIN32_HAS_WIDE) - { "GetFileAttributesExW", (SYSCALL)GetFileAttributesExW, 0 }, -#else - { "GetFileAttributesExW", (SYSCALL)0, 0 }, -#endif - -#define osGetFileAttributesExW ((BOOL(WINAPI*)(LPCWSTR,GET_FILEEX_INFO_LEVELS, \ - LPVOID))aSyscall[22].pCurrent) - -#if !SQLITE_OS_WINRT - { "GetFileSize", (SYSCALL)GetFileSize, 0 }, -#else - { "GetFileSize", (SYSCALL)0, 0 }, -#endif - -#define osGetFileSize ((DWORD(WINAPI*)(HANDLE,LPDWORD))aSyscall[23].pCurrent) - -#if !SQLITE_OS_WINCE && defined(SQLITE_WIN32_HAS_ANSI) - { "GetFullPathNameA", (SYSCALL)GetFullPathNameA, 0 }, -#else - { "GetFullPathNameA", (SYSCALL)0, 0 }, -#endif - -#define osGetFullPathNameA ((DWORD(WINAPI*)(LPCSTR,DWORD,LPSTR, \ - LPSTR*))aSyscall[24].pCurrent) - -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) - { "GetFullPathNameW", (SYSCALL)GetFullPathNameW, 0 }, -#else - { "GetFullPathNameW", (SYSCALL)0, 0 }, -#endif - -#define osGetFullPathNameW ((DWORD(WINAPI*)(LPCWSTR,DWORD,LPWSTR, \ - LPWSTR*))aSyscall[25].pCurrent) - - { "GetLastError", (SYSCALL)GetLastError, 0 }, - -#define osGetLastError ((DWORD(WINAPI*)(VOID))aSyscall[26].pCurrent) - -#if !defined(SQLITE_OMIT_LOAD_EXTENSION) -#if SQLITE_OS_WINCE - /* The GetProcAddressA() routine is only available on Windows CE. */ - { "GetProcAddressA", (SYSCALL)GetProcAddressA, 0 }, -#else - /* All other Windows platforms expect GetProcAddress() to take - ** an ANSI string regardless of the _UNICODE setting */ - { "GetProcAddressA", (SYSCALL)GetProcAddress, 0 }, -#endif -#else - { "GetProcAddressA", (SYSCALL)0, 0 }, -#endif - -#define osGetProcAddressA ((FARPROC(WINAPI*)(HMODULE, \ - LPCSTR))aSyscall[27].pCurrent) - -#if !SQLITE_OS_WINRT - { "GetSystemInfo", (SYSCALL)GetSystemInfo, 0 }, -#else - { "GetSystemInfo", (SYSCALL)0, 0 }, -#endif - -#define osGetSystemInfo ((VOID(WINAPI*)(LPSYSTEM_INFO))aSyscall[28].pCurrent) - - { "GetSystemTime", (SYSCALL)GetSystemTime, 0 }, - -#define osGetSystemTime ((VOID(WINAPI*)(LPSYSTEMTIME))aSyscall[29].pCurrent) - -#if !SQLITE_OS_WINCE - { "GetSystemTimeAsFileTime", (SYSCALL)GetSystemTimeAsFileTime, 0 }, -#else - { "GetSystemTimeAsFileTime", (SYSCALL)0, 0 }, -#endif - -#define osGetSystemTimeAsFileTime ((VOID(WINAPI*)( \ - LPFILETIME))aSyscall[30].pCurrent) - -#if defined(SQLITE_WIN32_HAS_ANSI) - { "GetTempPathA", (SYSCALL)GetTempPathA, 0 }, -#else - { "GetTempPathA", (SYSCALL)0, 0 }, -#endif - -#define osGetTempPathA ((DWORD(WINAPI*)(DWORD,LPSTR))aSyscall[31].pCurrent) - -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) - { "GetTempPathW", (SYSCALL)GetTempPathW, 0 }, -#else - { "GetTempPathW", (SYSCALL)0, 0 }, -#endif - -#define osGetTempPathW ((DWORD(WINAPI*)(DWORD,LPWSTR))aSyscall[32].pCurrent) - -#if !SQLITE_OS_WINRT - { "GetTickCount", (SYSCALL)GetTickCount, 0 }, -#else - { "GetTickCount", (SYSCALL)0, 0 }, -#endif - -#define osGetTickCount ((DWORD(WINAPI*)(VOID))aSyscall[33].pCurrent) - -#if defined(SQLITE_WIN32_HAS_ANSI) && defined(SQLITE_WIN32_GETVERSIONEX) && \ - SQLITE_WIN32_GETVERSIONEX - { "GetVersionExA", (SYSCALL)GetVersionExA, 0 }, -#else - { "GetVersionExA", (SYSCALL)0, 0 }, -#endif - -#define osGetVersionExA ((BOOL(WINAPI*)( \ - LPOSVERSIONINFOA))aSyscall[34].pCurrent) - -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ - defined(SQLITE_WIN32_GETVERSIONEX) && SQLITE_WIN32_GETVERSIONEX - { "GetVersionExW", (SYSCALL)GetVersionExW, 0 }, -#else - { "GetVersionExW", (SYSCALL)0, 0 }, -#endif - -#define osGetVersionExW ((BOOL(WINAPI*)( \ - LPOSVERSIONINFOW))aSyscall[35].pCurrent) - - { "HeapAlloc", (SYSCALL)HeapAlloc, 0 }, - -#define osHeapAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD, \ - SIZE_T))aSyscall[36].pCurrent) - -#if !SQLITE_OS_WINRT - { "HeapCreate", (SYSCALL)HeapCreate, 0 }, -#else - { "HeapCreate", (SYSCALL)0, 0 }, -#endif - -#define osHeapCreate ((HANDLE(WINAPI*)(DWORD,SIZE_T, \ - SIZE_T))aSyscall[37].pCurrent) - -#if !SQLITE_OS_WINRT - { "HeapDestroy", (SYSCALL)HeapDestroy, 0 }, -#else - { "HeapDestroy", (SYSCALL)0, 0 }, -#endif - -#define osHeapDestroy ((BOOL(WINAPI*)(HANDLE))aSyscall[38].pCurrent) - - { "HeapFree", (SYSCALL)HeapFree, 0 }, - -#define osHeapFree ((BOOL(WINAPI*)(HANDLE,DWORD,LPVOID))aSyscall[39].pCurrent) - - { "HeapReAlloc", (SYSCALL)HeapReAlloc, 0 }, - -#define osHeapReAlloc ((LPVOID(WINAPI*)(HANDLE,DWORD,LPVOID, \ - SIZE_T))aSyscall[40].pCurrent) - - { "HeapSize", (SYSCALL)HeapSize, 0 }, - -#define osHeapSize ((SIZE_T(WINAPI*)(HANDLE,DWORD, \ - LPCVOID))aSyscall[41].pCurrent) - -#if !SQLITE_OS_WINRT - { "HeapValidate", (SYSCALL)HeapValidate, 0 }, -#else - { "HeapValidate", (SYSCALL)0, 0 }, -#endif - -#define osHeapValidate ((BOOL(WINAPI*)(HANDLE,DWORD, \ - LPCVOID))aSyscall[42].pCurrent) - -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT - { "HeapCompact", (SYSCALL)HeapCompact, 0 }, -#else - { "HeapCompact", (SYSCALL)0, 0 }, -#endif - -#define osHeapCompact ((UINT(WINAPI*)(HANDLE,DWORD))aSyscall[43].pCurrent) - -#if defined(SQLITE_WIN32_HAS_ANSI) && !defined(SQLITE_OMIT_LOAD_EXTENSION) - { "LoadLibraryA", (SYSCALL)LoadLibraryA, 0 }, -#else - { "LoadLibraryA", (SYSCALL)0, 0 }, -#endif - -#define osLoadLibraryA ((HMODULE(WINAPI*)(LPCSTR))aSyscall[44].pCurrent) - -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_HAS_WIDE) && \ - !defined(SQLITE_OMIT_LOAD_EXTENSION) - { "LoadLibraryW", (SYSCALL)LoadLibraryW, 0 }, -#else - { "LoadLibraryW", (SYSCALL)0, 0 }, -#endif - -#define osLoadLibraryW ((HMODULE(WINAPI*)(LPCWSTR))aSyscall[45].pCurrent) - -#if !SQLITE_OS_WINRT - { "LocalFree", (SYSCALL)LocalFree, 0 }, -#else - { "LocalFree", (SYSCALL)0, 0 }, -#endif - -#define osLocalFree ((HLOCAL(WINAPI*)(HLOCAL))aSyscall[46].pCurrent) - -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT - { "LockFile", (SYSCALL)LockFile, 0 }, -#else - { "LockFile", (SYSCALL)0, 0 }, -#endif - -#ifndef osLockFile -#define osLockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ - DWORD))aSyscall[47].pCurrent) -#endif - -#if !SQLITE_OS_WINCE - { "LockFileEx", (SYSCALL)LockFileEx, 0 }, -#else - { "LockFileEx", (SYSCALL)0, 0 }, -#endif - -#ifndef osLockFileEx -#define osLockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD,DWORD, \ - LPOVERLAPPED))aSyscall[48].pCurrent) -#endif - -#if SQLITE_OS_WINCE || (!SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL)) - { "MapViewOfFile", (SYSCALL)MapViewOfFile, 0 }, -#else - { "MapViewOfFile", (SYSCALL)0, 0 }, -#endif - -#define osMapViewOfFile ((LPVOID(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ - SIZE_T))aSyscall[49].pCurrent) - - { "MultiByteToWideChar", (SYSCALL)MultiByteToWideChar, 0 }, - -#define osMultiByteToWideChar ((int(WINAPI*)(UINT,DWORD,LPCSTR,int,LPWSTR, \ - int))aSyscall[50].pCurrent) - - { "QueryPerformanceCounter", (SYSCALL)QueryPerformanceCounter, 0 }, - -#define osQueryPerformanceCounter ((BOOL(WINAPI*)( \ - LARGE_INTEGER*))aSyscall[51].pCurrent) - - { "ReadFile", (SYSCALL)ReadFile, 0 }, - -#define osReadFile ((BOOL(WINAPI*)(HANDLE,LPVOID,DWORD,LPDWORD, \ - LPOVERLAPPED))aSyscall[52].pCurrent) - - { "SetEndOfFile", (SYSCALL)SetEndOfFile, 0 }, - -#define osSetEndOfFile ((BOOL(WINAPI*)(HANDLE))aSyscall[53].pCurrent) - -#if !SQLITE_OS_WINRT - { "SetFilePointer", (SYSCALL)SetFilePointer, 0 }, -#else - { "SetFilePointer", (SYSCALL)0, 0 }, -#endif - -#define osSetFilePointer ((DWORD(WINAPI*)(HANDLE,LONG,PLONG, \ - DWORD))aSyscall[54].pCurrent) - -#if !SQLITE_OS_WINRT - { "Sleep", (SYSCALL)Sleep, 0 }, -#else - { "Sleep", (SYSCALL)0, 0 }, -#endif - -#define osSleep ((VOID(WINAPI*)(DWORD))aSyscall[55].pCurrent) - - { "SystemTimeToFileTime", (SYSCALL)SystemTimeToFileTime, 0 }, - -#define osSystemTimeToFileTime ((BOOL(WINAPI*)(CONST SYSTEMTIME*, \ - LPFILETIME))aSyscall[56].pCurrent) - -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT - { "UnlockFile", (SYSCALL)UnlockFile, 0 }, -#else - { "UnlockFile", (SYSCALL)0, 0 }, -#endif - -#ifndef osUnlockFile -#define osUnlockFile ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ - DWORD))aSyscall[57].pCurrent) -#endif - -#if !SQLITE_OS_WINCE - { "UnlockFileEx", (SYSCALL)UnlockFileEx, 0 }, -#else - { "UnlockFileEx", (SYSCALL)0, 0 }, -#endif - -#define osUnlockFileEx ((BOOL(WINAPI*)(HANDLE,DWORD,DWORD,DWORD, \ - LPOVERLAPPED))aSyscall[58].pCurrent) - -#if SQLITE_OS_WINCE || !defined(SQLITE_OMIT_WAL) - { "UnmapViewOfFile", (SYSCALL)UnmapViewOfFile, 0 }, -#else - { "UnmapViewOfFile", (SYSCALL)0, 0 }, -#endif - -#define osUnmapViewOfFile ((BOOL(WINAPI*)(LPCVOID))aSyscall[59].pCurrent) - - { "WideCharToMultiByte", (SYSCALL)WideCharToMultiByte, 0 }, - -#define osWideCharToMultiByte ((int(WINAPI*)(UINT,DWORD,LPCWSTR,int,LPSTR,int, \ - LPCSTR,LPBOOL))aSyscall[60].pCurrent) - - { "WriteFile", (SYSCALL)WriteFile, 0 }, - -#define osWriteFile ((BOOL(WINAPI*)(HANDLE,LPCVOID,DWORD,LPDWORD, \ - LPOVERLAPPED))aSyscall[61].pCurrent) - -#if SQLITE_OS_WINRT - { "CreateEventExW", (SYSCALL)CreateEventExW, 0 }, -#else - { "CreateEventExW", (SYSCALL)0, 0 }, -#endif - -#define osCreateEventExW ((HANDLE(WINAPI*)(LPSECURITY_ATTRIBUTES,LPCWSTR, \ - DWORD,DWORD))aSyscall[62].pCurrent) - -#if !SQLITE_OS_WINRT - { "WaitForSingleObject", (SYSCALL)WaitForSingleObject, 0 }, -#else - { "WaitForSingleObject", (SYSCALL)0, 0 }, -#endif - -#define osWaitForSingleObject ((DWORD(WINAPI*)(HANDLE, \ - DWORD))aSyscall[63].pCurrent) - -#if SQLITE_OS_WINRT - { "WaitForSingleObjectEx", (SYSCALL)WaitForSingleObjectEx, 0 }, -#else - { "WaitForSingleObjectEx", (SYSCALL)0, 0 }, -#endif - -#define osWaitForSingleObjectEx ((DWORD(WINAPI*)(HANDLE,DWORD, \ - BOOL))aSyscall[64].pCurrent) - -#if SQLITE_OS_WINRT - { "SetFilePointerEx", (SYSCALL)SetFilePointerEx, 0 }, -#else - { "SetFilePointerEx", (SYSCALL)0, 0 }, -#endif - -#define osSetFilePointerEx ((BOOL(WINAPI*)(HANDLE,LARGE_INTEGER, \ - PLARGE_INTEGER,DWORD))aSyscall[65].pCurrent) - -#if SQLITE_OS_WINRT - { "GetFileInformationByHandleEx", (SYSCALL)GetFileInformationByHandleEx, 0 }, -#else - { "GetFileInformationByHandleEx", (SYSCALL)0, 0 }, -#endif - -#define osGetFileInformationByHandleEx ((BOOL(WINAPI*)(HANDLE, \ - FILE_INFO_BY_HANDLE_CLASS,LPVOID,DWORD))aSyscall[66].pCurrent) - -#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL) - { "MapViewOfFileFromApp", (SYSCALL)MapViewOfFileFromApp, 0 }, -#else - { "MapViewOfFileFromApp", (SYSCALL)0, 0 }, -#endif - -#define osMapViewOfFileFromApp ((LPVOID(WINAPI*)(HANDLE,ULONG,ULONG64, \ - SIZE_T))aSyscall[67].pCurrent) - -#if SQLITE_OS_WINRT - { "CreateFile2", (SYSCALL)CreateFile2, 0 }, -#else - { "CreateFile2", (SYSCALL)0, 0 }, -#endif - -#define osCreateFile2 ((HANDLE(WINAPI*)(LPCWSTR,DWORD,DWORD,DWORD, \ - LPCREATEFILE2_EXTENDED_PARAMETERS))aSyscall[68].pCurrent) - -#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_LOAD_EXTENSION) - { "LoadPackagedLibrary", (SYSCALL)LoadPackagedLibrary, 0 }, -#else - { "LoadPackagedLibrary", (SYSCALL)0, 0 }, -#endif - -#define osLoadPackagedLibrary ((HMODULE(WINAPI*)(LPCWSTR, \ - DWORD))aSyscall[69].pCurrent) - -#if SQLITE_OS_WINRT - { "GetTickCount64", (SYSCALL)GetTickCount64, 0 }, -#else - { "GetTickCount64", (SYSCALL)0, 0 }, -#endif - -#define osGetTickCount64 ((ULONGLONG(WINAPI*)(VOID))aSyscall[70].pCurrent) - -#if SQLITE_OS_WINRT - { "GetNativeSystemInfo", (SYSCALL)GetNativeSystemInfo, 0 }, -#else - { "GetNativeSystemInfo", (SYSCALL)0, 0 }, -#endif - -#define osGetNativeSystemInfo ((VOID(WINAPI*)( \ - LPSYSTEM_INFO))aSyscall[71].pCurrent) - -#if defined(SQLITE_WIN32_HAS_ANSI) - { "OutputDebugStringA", (SYSCALL)OutputDebugStringA, 0 }, -#else - { "OutputDebugStringA", (SYSCALL)0, 0 }, -#endif - -#define osOutputDebugStringA ((VOID(WINAPI*)(LPCSTR))aSyscall[72].pCurrent) - -#if defined(SQLITE_WIN32_HAS_WIDE) - { "OutputDebugStringW", (SYSCALL)OutputDebugStringW, 0 }, -#else - { "OutputDebugStringW", (SYSCALL)0, 0 }, -#endif - -#define osOutputDebugStringW ((VOID(WINAPI*)(LPCWSTR))aSyscall[73].pCurrent) - - { "GetProcessHeap", (SYSCALL)GetProcessHeap, 0 }, - -#define osGetProcessHeap ((HANDLE(WINAPI*)(VOID))aSyscall[74].pCurrent) - -#if SQLITE_OS_WINRT && !defined(SQLITE_OMIT_WAL) - { "CreateFileMappingFromApp", (SYSCALL)CreateFileMappingFromApp, 0 }, -#else - { "CreateFileMappingFromApp", (SYSCALL)0, 0 }, -#endif - -#define osCreateFileMappingFromApp ((HANDLE(WINAPI*)(HANDLE, \ - LPSECURITY_ATTRIBUTES,ULONG,ULONG64,LPCWSTR))aSyscall[75].pCurrent) - -}; /* End of the overrideable system calls */ - -/* -** This is the xSetSystemCall() method of sqlite3_vfs for all of the -** "win32" VFSes. Return SQLITE_OK opon successfully updating the -** system call pointer, or SQLITE_NOTFOUND if there is no configurable -** system call named zName. -*/ -static int winSetSystemCall( - sqlite3_vfs *pNotUsed, /* The VFS pointer. Not used */ - const char *zName, /* Name of system call to override */ - sqlite3_syscall_ptr pNewFunc /* Pointer to new system call value */ -){ - unsigned int i; - int rc = SQLITE_NOTFOUND; - - UNUSED_PARAMETER(pNotUsed); - if( zName==0 ){ - /* If no zName is given, restore all system calls to their default - ** settings and return NULL - */ - rc = SQLITE_OK; - for(i=0; i0 ){ - memset(zDbgBuf, 0, SQLITE_WIN32_DBG_BUF_SIZE); - memcpy(zDbgBuf, zBuf, nMin); - osOutputDebugStringA(zDbgBuf); - }else{ - osOutputDebugStringA(zBuf); - } -#elif defined(SQLITE_WIN32_HAS_WIDE) - memset(zDbgBuf, 0, SQLITE_WIN32_DBG_BUF_SIZE); - if ( osMultiByteToWideChar( - osAreFileApisANSI() ? CP_ACP : CP_OEMCP, 0, zBuf, - nMin, (LPWSTR)zDbgBuf, SQLITE_WIN32_DBG_BUF_SIZE/sizeof(WCHAR))<=0 ){ - return; - } - osOutputDebugStringW((LPCWSTR)zDbgBuf); -#else - if( nMin>0 ){ - memset(zDbgBuf, 0, SQLITE_WIN32_DBG_BUF_SIZE); - memcpy(zDbgBuf, zBuf, nMin); - fprintf(stderr, "%s", zDbgBuf); - }else{ - fprintf(stderr, "%s", zBuf); - } -#endif -} - -/* -** The following routine suspends the current thread for at least ms -** milliseconds. This is equivalent to the Win32 Sleep() interface. -*/ -#if SQLITE_OS_WINRT -static HANDLE sleepObj = NULL; -#endif - -SQLITE_API void sqlite3_win32_sleep(DWORD milliseconds){ -#if SQLITE_OS_WINRT - if ( sleepObj==NULL ){ - sleepObj = osCreateEventExW(NULL, NULL, CREATE_EVENT_MANUAL_RESET, - SYNCHRONIZE); - } - assert( sleepObj!=NULL ); - osWaitForSingleObjectEx(sleepObj, milliseconds, FALSE); -#else - osSleep(milliseconds); -#endif -} - -/* -** Return true (non-zero) if we are running under WinNT, Win2K, WinXP, -** or WinCE. Return false (zero) for Win95, Win98, or WinME. -** -** Here is an interesting observation: Win95, Win98, and WinME lack -** the LockFileEx() API. But we can still statically link against that -** API as long as we don't call it when running Win95/98/ME. A call to -** this routine is used to determine if the host is Win95/98/ME or -** WinNT/2K/XP so that we will know whether or not we can safely call -** the LockFileEx() API. -*/ - -#if !defined(SQLITE_WIN32_GETVERSIONEX) || !SQLITE_WIN32_GETVERSIONEX -# define osIsNT() (1) -#elif SQLITE_OS_WINCE || SQLITE_OS_WINRT || !defined(SQLITE_WIN32_HAS_ANSI) -# define osIsNT() (1) -#elif !defined(SQLITE_WIN32_HAS_WIDE) -# define osIsNT() (0) -#else - static int osIsNT(void){ - if( sqlite3_os_type==0 ){ -#if defined(NTDDI_VERSION) && NTDDI_VERSION >= NTDDI_WIN8 - OSVERSIONINFOW sInfo; - sInfo.dwOSVersionInfoSize = sizeof(sInfo); - osGetVersionExW(&sInfo); -#else - OSVERSIONINFOA sInfo; - sInfo.dwOSVersionInfoSize = sizeof(sInfo); - osGetVersionExA(&sInfo); -#endif - sqlite3_os_type = sInfo.dwPlatformId==VER_PLATFORM_WIN32_NT ? 2 : 1; - } - return sqlite3_os_type==2; - } -#endif - -#ifdef SQLITE_WIN32_MALLOC -/* -** Allocate nBytes of memory. -*/ -static void *winMemMalloc(int nBytes){ - HANDLE hHeap; - void *p; - - winMemAssertMagic(); - hHeap = winMemGetHeap(); - assert( hHeap!=0 ); - assert( hHeap!=INVALID_HANDLE_VALUE ); -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) - assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) ); -#endif - assert( nBytes>=0 ); - p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes); - if( !p ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapAlloc %u bytes (%lu), heap=%p", - nBytes, osGetLastError(), (void*)hHeap); - } - return p; -} - -/* -** Free memory. -*/ -static void winMemFree(void *pPrior){ - HANDLE hHeap; - - winMemAssertMagic(); - hHeap = winMemGetHeap(); - assert( hHeap!=0 ); - assert( hHeap!=INVALID_HANDLE_VALUE ); -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) - assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ); -#endif - if( !pPrior ) return; /* Passing NULL to HeapFree is undefined. */ - if( !osHeapFree(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapFree block %p (%lu), heap=%p", - pPrior, osGetLastError(), (void*)hHeap); - } -} - -/* -** Change the size of an existing memory allocation -*/ -static void *winMemRealloc(void *pPrior, int nBytes){ - HANDLE hHeap; - void *p; - - winMemAssertMagic(); - hHeap = winMemGetHeap(); - assert( hHeap!=0 ); - assert( hHeap!=INVALID_HANDLE_VALUE ); -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) - assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior) ); -#endif - assert( nBytes>=0 ); - if( !pPrior ){ - p = osHeapAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, (SIZE_T)nBytes); - }else{ - p = osHeapReAlloc(hHeap, SQLITE_WIN32_HEAP_FLAGS, pPrior, (SIZE_T)nBytes); - } - if( !p ){ - sqlite3_log(SQLITE_NOMEM, "failed to %s %u bytes (%lu), heap=%p", - pPrior ? "HeapReAlloc" : "HeapAlloc", nBytes, osGetLastError(), - (void*)hHeap); - } - return p; -} - -/* -** Return the size of an outstanding allocation, in bytes. -*/ -static int winMemSize(void *p){ - HANDLE hHeap; - SIZE_T n; - - winMemAssertMagic(); - hHeap = winMemGetHeap(); - assert( hHeap!=0 ); - assert( hHeap!=INVALID_HANDLE_VALUE ); -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) - assert( osHeapValidate(hHeap, SQLITE_WIN32_HEAP_FLAGS, p) ); -#endif - if( !p ) return 0; - n = osHeapSize(hHeap, SQLITE_WIN32_HEAP_FLAGS, p); - if( n==(SIZE_T)-1 ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapSize block %p (%lu), heap=%p", - p, osGetLastError(), (void*)hHeap); - return 0; - } - return (int)n; -} - -/* -** Round up a request size to the next valid allocation size. -*/ -static int winMemRoundup(int n){ - return n; -} - -/* -** Initialize this module. -*/ -static int winMemInit(void *pAppData){ - winMemData *pWinMemData = (winMemData *)pAppData; - - if( !pWinMemData ) return SQLITE_ERROR; - assert( pWinMemData->magic1==WINMEM_MAGIC1 ); - assert( pWinMemData->magic2==WINMEM_MAGIC2 ); - -#if !SQLITE_OS_WINRT && SQLITE_WIN32_HEAP_CREATE - if( !pWinMemData->hHeap ){ - DWORD dwInitialSize = SQLITE_WIN32_HEAP_INIT_SIZE; - DWORD dwMaximumSize = (DWORD)sqlite3GlobalConfig.nHeap; - if( dwMaximumSize==0 ){ - dwMaximumSize = SQLITE_WIN32_HEAP_MAX_SIZE; - }else if( dwInitialSize>dwMaximumSize ){ - dwInitialSize = dwMaximumSize; - } - pWinMemData->hHeap = osHeapCreate(SQLITE_WIN32_HEAP_FLAGS, - dwInitialSize, dwMaximumSize); - if( !pWinMemData->hHeap ){ - sqlite3_log(SQLITE_NOMEM, - "failed to HeapCreate (%lu), flags=%u, initSize=%lu, maxSize=%lu", - osGetLastError(), SQLITE_WIN32_HEAP_FLAGS, dwInitialSize, - dwMaximumSize); - return SQLITE_NOMEM; - } - pWinMemData->bOwned = TRUE; - assert( pWinMemData->bOwned ); - } -#else - pWinMemData->hHeap = osGetProcessHeap(); - if( !pWinMemData->hHeap ){ - sqlite3_log(SQLITE_NOMEM, - "failed to GetProcessHeap (%lu)", osGetLastError()); - return SQLITE_NOMEM; - } - pWinMemData->bOwned = FALSE; - assert( !pWinMemData->bOwned ); -#endif - assert( pWinMemData->hHeap!=0 ); - assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE ); -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) - assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) ); -#endif - return SQLITE_OK; -} - -/* -** Deinitialize this module. -*/ -static void winMemShutdown(void *pAppData){ - winMemData *pWinMemData = (winMemData *)pAppData; - - if( !pWinMemData ) return; - assert( pWinMemData->magic1==WINMEM_MAGIC1 ); - assert( pWinMemData->magic2==WINMEM_MAGIC2 ); - - if( pWinMemData->hHeap ){ - assert( pWinMemData->hHeap!=INVALID_HANDLE_VALUE ); -#if !SQLITE_OS_WINRT && defined(SQLITE_WIN32_MALLOC_VALIDATE) - assert( osHeapValidate(pWinMemData->hHeap, SQLITE_WIN32_HEAP_FLAGS, NULL) ); -#endif - if( pWinMemData->bOwned ){ - if( !osHeapDestroy(pWinMemData->hHeap) ){ - sqlite3_log(SQLITE_NOMEM, "failed to HeapDestroy (%lu), heap=%p", - osGetLastError(), (void*)pWinMemData->hHeap); - } - pWinMemData->bOwned = FALSE; - } - pWinMemData->hHeap = NULL; - } -} - -/* -** Populate the low-level memory allocation function pointers in -** sqlite3GlobalConfig.m with pointers to the routines in this file. The -** arguments specify the block of memory to manage. -** -** This routine is only called by sqlite3_config(), and therefore -** is not required to be threadsafe (it is not). -*/ -SQLITE_PRIVATE const sqlite3_mem_methods *sqlite3MemGetWin32(void){ - static const sqlite3_mem_methods winMemMethods = { - winMemMalloc, - winMemFree, - winMemRealloc, - winMemSize, - winMemRoundup, - winMemInit, - winMemShutdown, - &win_mem_data - }; - return &winMemMethods; -} - -SQLITE_PRIVATE void sqlite3MemSetDefault(void){ - sqlite3_config(SQLITE_CONFIG_MALLOC, sqlite3MemGetWin32()); -} -#endif /* SQLITE_WIN32_MALLOC */ - -/* -** Convert a UTF-8 string to Microsoft Unicode (UTF-16?). -** -** Space to hold the returned string is obtained from malloc. -*/ -static LPWSTR winUtf8ToUnicode(const char *zFilename){ - int nChar; - LPWSTR zWideFilename; - - nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, NULL, 0); - if( nChar==0 ){ - return 0; - } - zWideFilename = sqlite3MallocZero( nChar*sizeof(zWideFilename[0]) ); - if( zWideFilename==0 ){ - return 0; - } - nChar = osMultiByteToWideChar(CP_UTF8, 0, zFilename, -1, zWideFilename, - nChar); - if( nChar==0 ){ - sqlite3_free(zWideFilename); - zWideFilename = 0; - } - return zWideFilename; -} - -/* -** Convert Microsoft Unicode to UTF-8. Space to hold the returned string is -** obtained from sqlite3_malloc(). -*/ -static char *winUnicodeToUtf8(LPCWSTR zWideFilename){ - int nByte; - char *zFilename; - - nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, 0, 0, 0, 0); - if( nByte == 0 ){ - return 0; - } - zFilename = sqlite3MallocZero( nByte ); - if( zFilename==0 ){ - return 0; - } - nByte = osWideCharToMultiByte(CP_UTF8, 0, zWideFilename, -1, zFilename, nByte, - 0, 0); - if( nByte == 0 ){ - sqlite3_free(zFilename); - zFilename = 0; - } - return zFilename; -} - -/* -** Convert an ANSI string to Microsoft Unicode, based on the -** current codepage settings for file apis. -** -** Space to hold the returned string is obtained -** from sqlite3_malloc. -*/ -static LPWSTR winMbcsToUnicode(const char *zFilename){ - int nByte; - LPWSTR zMbcsFilename; - int codepage = osAreFileApisANSI() ? CP_ACP : CP_OEMCP; - - nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, NULL, - 0)*sizeof(WCHAR); - if( nByte==0 ){ - return 0; - } - zMbcsFilename = sqlite3MallocZero( nByte*sizeof(zMbcsFilename[0]) ); - if( zMbcsFilename==0 ){ - return 0; - } - nByte = osMultiByteToWideChar(codepage, 0, zFilename, -1, zMbcsFilename, - nByte); - if( nByte==0 ){ - sqlite3_free(zMbcsFilename); - zMbcsFilename = 0; - } - return zMbcsFilename; -} - -/* -** Convert Microsoft Unicode to multi-byte character string, based on the -** user's ANSI codepage. -** -** Space to hold the returned string is obtained from -** sqlite3_malloc(). -*/ -static char *winUnicodeToMbcs(LPCWSTR zWideFilename){ - int nByte; - char *zFilename; - int codepage = osAreFileApisANSI() ? CP_ACP : CP_OEMCP; - - nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, 0, 0, 0, 0); - if( nByte == 0 ){ - return 0; - } - zFilename = sqlite3MallocZero( nByte ); - if( zFilename==0 ){ - return 0; - } - nByte = osWideCharToMultiByte(codepage, 0, zWideFilename, -1, zFilename, - nByte, 0, 0); - if( nByte == 0 ){ - sqlite3_free(zFilename); - zFilename = 0; - } - return zFilename; -} - -/* -** Convert multibyte character string to UTF-8. Space to hold the -** returned string is obtained from sqlite3_malloc(). -*/ -SQLITE_API char *sqlite3_win32_mbcs_to_utf8(const char *zFilename){ - char *zFilenameUtf8; - LPWSTR zTmpWide; - - zTmpWide = winMbcsToUnicode(zFilename); - if( zTmpWide==0 ){ - return 0; - } - zFilenameUtf8 = winUnicodeToUtf8(zTmpWide); - sqlite3_free(zTmpWide); - return zFilenameUtf8; -} - -/* -** Convert UTF-8 to multibyte character string. Space to hold the -** returned string is obtained from sqlite3_malloc(). -*/ -SQLITE_API char *sqlite3_win32_utf8_to_mbcs(const char *zFilename){ - char *zFilenameMbcs; - LPWSTR zTmpWide; - - zTmpWide = winUtf8ToUnicode(zFilename); - if( zTmpWide==0 ){ - return 0; - } - zFilenameMbcs = winUnicodeToMbcs(zTmpWide); - sqlite3_free(zTmpWide); - return zFilenameMbcs; -} - -/* -** This function sets the data directory or the temporary directory based on -** the provided arguments. The type argument must be 1 in order to set the -** data directory or 2 in order to set the temporary directory. The zValue -** argument is the name of the directory to use. The return value will be -** SQLITE_OK if successful. -*/ -SQLITE_API int sqlite3_win32_set_directory(DWORD type, LPCWSTR zValue){ - char **ppDirectory = 0; -#ifndef SQLITE_OMIT_AUTOINIT - int rc = sqlite3_initialize(); - if( rc ) return rc; -#endif - if( type==SQLITE_WIN32_DATA_DIRECTORY_TYPE ){ - ppDirectory = &sqlite3_data_directory; - }else if( type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE ){ - ppDirectory = &sqlite3_temp_directory; - } - assert( !ppDirectory || type==SQLITE_WIN32_DATA_DIRECTORY_TYPE - || type==SQLITE_WIN32_TEMP_DIRECTORY_TYPE - ); - assert( !ppDirectory || sqlite3MemdebugHasType(*ppDirectory, MEMTYPE_HEAP) ); - if( ppDirectory ){ - char *zValueUtf8 = 0; - if( zValue && zValue[0] ){ - zValueUtf8 = winUnicodeToUtf8(zValue); - if ( zValueUtf8==0 ){ - return SQLITE_NOMEM; - } - } - sqlite3_free(*ppDirectory); - *ppDirectory = zValueUtf8; - return SQLITE_OK; - } - return SQLITE_ERROR; -} - -/* -** The return value of winGetLastErrorMsg -** is zero if the error message fits in the buffer, or non-zero -** otherwise (if the message was truncated). -*/ -static int winGetLastErrorMsg(DWORD lastErrno, int nBuf, char *zBuf){ - /* FormatMessage returns 0 on failure. Otherwise it - ** returns the number of TCHARs written to the output - ** buffer, excluding the terminating null char. - */ - DWORD dwLen = 0; - char *zOut = 0; - - if( osIsNT() ){ -#if SQLITE_OS_WINRT - WCHAR zTempWide[SQLITE_WIN32_MAX_ERRMSG_CHARS+1]; - dwLen = osFormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - lastErrno, - 0, - zTempWide, - SQLITE_WIN32_MAX_ERRMSG_CHARS, - 0); -#else - LPWSTR zTempWide = NULL; - dwLen = osFormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - lastErrno, - 0, - (LPWSTR) &zTempWide, - 0, - 0); -#endif - if( dwLen > 0 ){ - /* allocate a buffer and convert to UTF8 */ - sqlite3BeginBenignMalloc(); - zOut = winUnicodeToUtf8(zTempWide); - sqlite3EndBenignMalloc(); -#if !SQLITE_OS_WINRT - /* free the system buffer allocated by FormatMessage */ - osLocalFree(zTempWide); -#endif - } - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - char *zTemp = NULL; - dwLen = osFormatMessageA(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, - lastErrno, - 0, - (LPSTR) &zTemp, - 0, - 0); - if( dwLen > 0 ){ - /* allocate a buffer and convert to UTF8 */ - sqlite3BeginBenignMalloc(); - zOut = sqlite3_win32_mbcs_to_utf8(zTemp); - sqlite3EndBenignMalloc(); - /* free the system buffer allocated by FormatMessage */ - osLocalFree(zTemp); - } - } -#endif - if( 0 == dwLen ){ - sqlite3_snprintf(nBuf, zBuf, "OsError 0x%lx (%lu)", lastErrno, lastErrno); - }else{ - /* copy a maximum of nBuf chars to output buffer */ - sqlite3_snprintf(nBuf, zBuf, "%s", zOut); - /* free the UTF8 buffer */ - sqlite3_free(zOut); - } - return 0; -} - -/* -** -** This function - winLogErrorAtLine() - is only ever called via the macro -** winLogError(). -** -** This routine is invoked after an error occurs in an OS function. -** It logs a message using sqlite3_log() containing the current value of -** error code and, if possible, the human-readable equivalent from -** FormatMessage. -** -** The first argument passed to the macro should be the error code that -** will be returned to SQLite (e.g. SQLITE_IOERR_DELETE, SQLITE_CANTOPEN). -** The two subsequent arguments should be the name of the OS function that -** failed and the associated file-system path, if any. -*/ -#define winLogError(a,b,c,d) winLogErrorAtLine(a,b,c,d,__LINE__) -static int winLogErrorAtLine( - int errcode, /* SQLite error code */ - DWORD lastErrno, /* Win32 last error */ - const char *zFunc, /* Name of OS function that failed */ - const char *zPath, /* File path associated with error */ - int iLine /* Source line number where error occurred */ -){ - char zMsg[500]; /* Human readable error text */ - int i; /* Loop counter */ - - zMsg[0] = 0; - winGetLastErrorMsg(lastErrno, sizeof(zMsg), zMsg); - assert( errcode!=SQLITE_OK ); - if( zPath==0 ) zPath = ""; - for(i=0; zMsg[i] && zMsg[i]!='\r' && zMsg[i]!='\n'; i++){} - zMsg[i] = 0; - sqlite3_log(errcode, - "os_win.c:%d: (%lu) %s(%s) - %s", - iLine, lastErrno, zFunc, zPath, zMsg - ); - - return errcode; -} - -/* -** The number of times that a ReadFile(), WriteFile(), and DeleteFile() -** will be retried following a locking error - probably caused by -** antivirus software. Also the initial delay before the first retry. -** The delay increases linearly with each retry. -*/ -#ifndef SQLITE_WIN32_IOERR_RETRY -# define SQLITE_WIN32_IOERR_RETRY 10 -#endif -#ifndef SQLITE_WIN32_IOERR_RETRY_DELAY -# define SQLITE_WIN32_IOERR_RETRY_DELAY 25 -#endif -static int winIoerrRetry = SQLITE_WIN32_IOERR_RETRY; -static int winIoerrRetryDelay = SQLITE_WIN32_IOERR_RETRY_DELAY; - -/* -** If a ReadFile() or WriteFile() error occurs, invoke this routine -** to see if it should be retried. Return TRUE to retry. Return FALSE -** to give up with an error. -*/ -static int winRetryIoerr(int *pnRetry, DWORD *pError){ - DWORD e = osGetLastError(); - if( *pnRetry>=winIoerrRetry ){ - if( pError ){ - *pError = e; - } - return 0; - } - if( e==ERROR_ACCESS_DENIED || - e==ERROR_LOCK_VIOLATION || - e==ERROR_SHARING_VIOLATION ){ - sqlite3_win32_sleep(winIoerrRetryDelay*(1+*pnRetry)); - ++*pnRetry; - return 1; - } - if( pError ){ - *pError = e; - } - return 0; -} - -/* -** Log a I/O error retry episode. -*/ -static void winLogIoerr(int nRetry){ - if( nRetry ){ - sqlite3_log(SQLITE_IOERR, - "delayed %dms for lock/sharing conflict", - winIoerrRetryDelay*nRetry*(nRetry+1)/2 - ); - } -} - -#if SQLITE_OS_WINCE -/************************************************************************* -** This section contains code for WinCE only. -*/ -#if !defined(SQLITE_MSVC_LOCALTIME_API) || !SQLITE_MSVC_LOCALTIME_API -/* -** The MSVC CRT on Windows CE may not have a localtime() function. So -** create a substitute. -*/ -/* #include */ -struct tm *__cdecl localtime(const time_t *t) -{ - static struct tm y; - FILETIME uTm, lTm; - SYSTEMTIME pTm; - sqlite3_int64 t64; - t64 = *t; - t64 = (t64 + 11644473600)*10000000; - uTm.dwLowDateTime = (DWORD)(t64 & 0xFFFFFFFF); - uTm.dwHighDateTime= (DWORD)(t64 >> 32); - osFileTimeToLocalFileTime(&uTm,&lTm); - osFileTimeToSystemTime(&lTm,&pTm); - y.tm_year = pTm.wYear - 1900; - y.tm_mon = pTm.wMonth - 1; - y.tm_wday = pTm.wDayOfWeek; - y.tm_mday = pTm.wDay; - y.tm_hour = pTm.wHour; - y.tm_min = pTm.wMinute; - y.tm_sec = pTm.wSecond; - return &y; -} -#endif - -#define HANDLE_TO_WINFILE(a) (winFile*)&((char*)a)[-(int)offsetof(winFile,h)] - -/* -** Acquire a lock on the handle h -*/ -static void winceMutexAcquire(HANDLE h){ - DWORD dwErr; - do { - dwErr = osWaitForSingleObject(h, INFINITE); - } while (dwErr != WAIT_OBJECT_0 && dwErr != WAIT_ABANDONED); -} -/* -** Release a lock acquired by winceMutexAcquire() -*/ -#define winceMutexRelease(h) ReleaseMutex(h) - -/* -** Create the mutex and shared memory used for locking in the file -** descriptor pFile -*/ -static int winceCreateLock(const char *zFilename, winFile *pFile){ - LPWSTR zTok; - LPWSTR zName; - DWORD lastErrno; - BOOL bLogged = FALSE; - BOOL bInit = TRUE; - - zName = winUtf8ToUnicode(zFilename); - if( zName==0 ){ - /* out of memory */ - return SQLITE_IOERR_NOMEM; - } - - /* Initialize the local lockdata */ - memset(&pFile->local, 0, sizeof(pFile->local)); - - /* Replace the backslashes from the filename and lowercase it - ** to derive a mutex name. */ - zTok = osCharLowerW(zName); - for (;*zTok;zTok++){ - if (*zTok == '\\') *zTok = '_'; - } - - /* Create/open the named mutex */ - pFile->hMutex = osCreateMutexW(NULL, FALSE, zName); - if (!pFile->hMutex){ - pFile->lastErrno = osGetLastError(); - sqlite3_free(zName); - return winLogError(SQLITE_IOERR, pFile->lastErrno, - "winceCreateLock1", zFilename); - } - - /* Acquire the mutex before continuing */ - winceMutexAcquire(pFile->hMutex); - - /* Since the names of named mutexes, semaphores, file mappings etc are - ** case-sensitive, take advantage of that by uppercasing the mutex name - ** and using that as the shared filemapping name. - */ - osCharUpperW(zName); - pFile->hShared = osCreateFileMappingW(INVALID_HANDLE_VALUE, NULL, - PAGE_READWRITE, 0, sizeof(winceLock), - zName); - - /* Set a flag that indicates we're the first to create the memory so it - ** must be zero-initialized */ - lastErrno = osGetLastError(); - if (lastErrno == ERROR_ALREADY_EXISTS){ - bInit = FALSE; - } - - sqlite3_free(zName); - - /* If we succeeded in making the shared memory handle, map it. */ - if( pFile->hShared ){ - pFile->shared = (winceLock*)osMapViewOfFile(pFile->hShared, - FILE_MAP_READ|FILE_MAP_WRITE, 0, 0, sizeof(winceLock)); - /* If mapping failed, close the shared memory handle and erase it */ - if( !pFile->shared ){ - pFile->lastErrno = osGetLastError(); - winLogError(SQLITE_IOERR, pFile->lastErrno, - "winceCreateLock2", zFilename); - bLogged = TRUE; - osCloseHandle(pFile->hShared); - pFile->hShared = NULL; - } - } - - /* If shared memory could not be created, then close the mutex and fail */ - if( pFile->hShared==NULL ){ - if( !bLogged ){ - pFile->lastErrno = lastErrno; - winLogError(SQLITE_IOERR, pFile->lastErrno, - "winceCreateLock3", zFilename); - bLogged = TRUE; - } - winceMutexRelease(pFile->hMutex); - osCloseHandle(pFile->hMutex); - pFile->hMutex = NULL; - return SQLITE_IOERR; - } - - /* Initialize the shared memory if we're supposed to */ - if( bInit ){ - memset(pFile->shared, 0, sizeof(winceLock)); - } - - winceMutexRelease(pFile->hMutex); - return SQLITE_OK; -} - -/* -** Destroy the part of winFile that deals with wince locks -*/ -static void winceDestroyLock(winFile *pFile){ - if (pFile->hMutex){ - /* Acquire the mutex */ - winceMutexAcquire(pFile->hMutex); - - /* The following blocks should probably assert in debug mode, but they - are to cleanup in case any locks remained open */ - if (pFile->local.nReaders){ - pFile->shared->nReaders --; - } - if (pFile->local.bReserved){ - pFile->shared->bReserved = FALSE; - } - if (pFile->local.bPending){ - pFile->shared->bPending = FALSE; - } - if (pFile->local.bExclusive){ - pFile->shared->bExclusive = FALSE; - } - - /* De-reference and close our copy of the shared memory handle */ - osUnmapViewOfFile(pFile->shared); - osCloseHandle(pFile->hShared); - - /* Done with the mutex */ - winceMutexRelease(pFile->hMutex); - osCloseHandle(pFile->hMutex); - pFile->hMutex = NULL; - } -} - -/* -** An implementation of the LockFile() API of Windows for CE -*/ -static BOOL winceLockFile( - LPHANDLE phFile, - DWORD dwFileOffsetLow, - DWORD dwFileOffsetHigh, - DWORD nNumberOfBytesToLockLow, - DWORD nNumberOfBytesToLockHigh -){ - winFile *pFile = HANDLE_TO_WINFILE(phFile); - BOOL bReturn = FALSE; - - UNUSED_PARAMETER(dwFileOffsetHigh); - UNUSED_PARAMETER(nNumberOfBytesToLockHigh); - - if (!pFile->hMutex) return TRUE; - winceMutexAcquire(pFile->hMutex); - - /* Wanting an exclusive lock? */ - if (dwFileOffsetLow == (DWORD)SHARED_FIRST - && nNumberOfBytesToLockLow == (DWORD)SHARED_SIZE){ - if (pFile->shared->nReaders == 0 && pFile->shared->bExclusive == 0){ - pFile->shared->bExclusive = TRUE; - pFile->local.bExclusive = TRUE; - bReturn = TRUE; - } - } - - /* Want a read-only lock? */ - else if (dwFileOffsetLow == (DWORD)SHARED_FIRST && - nNumberOfBytesToLockLow == 1){ - if (pFile->shared->bExclusive == 0){ - pFile->local.nReaders ++; - if (pFile->local.nReaders == 1){ - pFile->shared->nReaders ++; - } - bReturn = TRUE; - } - } - - /* Want a pending lock? */ - else if (dwFileOffsetLow == (DWORD)PENDING_BYTE - && nNumberOfBytesToLockLow == 1){ - /* If no pending lock has been acquired, then acquire it */ - if (pFile->shared->bPending == 0) { - pFile->shared->bPending = TRUE; - pFile->local.bPending = TRUE; - bReturn = TRUE; - } - } - - /* Want a reserved lock? */ - else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE - && nNumberOfBytesToLockLow == 1){ - if (pFile->shared->bReserved == 0) { - pFile->shared->bReserved = TRUE; - pFile->local.bReserved = TRUE; - bReturn = TRUE; - } - } - - winceMutexRelease(pFile->hMutex); - return bReturn; -} - -/* -** An implementation of the UnlockFile API of Windows for CE -*/ -static BOOL winceUnlockFile( - LPHANDLE phFile, - DWORD dwFileOffsetLow, - DWORD dwFileOffsetHigh, - DWORD nNumberOfBytesToUnlockLow, - DWORD nNumberOfBytesToUnlockHigh -){ - winFile *pFile = HANDLE_TO_WINFILE(phFile); - BOOL bReturn = FALSE; - - UNUSED_PARAMETER(dwFileOffsetHigh); - UNUSED_PARAMETER(nNumberOfBytesToUnlockHigh); - - if (!pFile->hMutex) return TRUE; - winceMutexAcquire(pFile->hMutex); - - /* Releasing a reader lock or an exclusive lock */ - if (dwFileOffsetLow == (DWORD)SHARED_FIRST){ - /* Did we have an exclusive lock? */ - if (pFile->local.bExclusive){ - assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE); - pFile->local.bExclusive = FALSE; - pFile->shared->bExclusive = FALSE; - bReturn = TRUE; - } - - /* Did we just have a reader lock? */ - else if (pFile->local.nReaders){ - assert(nNumberOfBytesToUnlockLow == (DWORD)SHARED_SIZE - || nNumberOfBytesToUnlockLow == 1); - pFile->local.nReaders --; - if (pFile->local.nReaders == 0) - { - pFile->shared->nReaders --; - } - bReturn = TRUE; - } - } - - /* Releasing a pending lock */ - else if (dwFileOffsetLow == (DWORD)PENDING_BYTE - && nNumberOfBytesToUnlockLow == 1){ - if (pFile->local.bPending){ - pFile->local.bPending = FALSE; - pFile->shared->bPending = FALSE; - bReturn = TRUE; - } - } - /* Releasing a reserved lock */ - else if (dwFileOffsetLow == (DWORD)RESERVED_BYTE - && nNumberOfBytesToUnlockLow == 1){ - if (pFile->local.bReserved) { - pFile->local.bReserved = FALSE; - pFile->shared->bReserved = FALSE; - bReturn = TRUE; - } - } - - winceMutexRelease(pFile->hMutex); - return bReturn; -} -/* -** End of the special code for wince -*****************************************************************************/ -#endif /* SQLITE_OS_WINCE */ - -/* -** Lock a file region. -*/ -static BOOL winLockFile( - LPHANDLE phFile, - DWORD flags, - DWORD offsetLow, - DWORD offsetHigh, - DWORD numBytesLow, - DWORD numBytesHigh -){ -#if SQLITE_OS_WINCE - /* - ** NOTE: Windows CE is handled differently here due its lack of the Win32 - ** API LockFile. - */ - return winceLockFile(phFile, offsetLow, offsetHigh, - numBytesLow, numBytesHigh); -#else - if( osIsNT() ){ - OVERLAPPED ovlp; - memset(&ovlp, 0, sizeof(OVERLAPPED)); - ovlp.Offset = offsetLow; - ovlp.OffsetHigh = offsetHigh; - return osLockFileEx(*phFile, flags, 0, numBytesLow, numBytesHigh, &ovlp); - }else{ - return osLockFile(*phFile, offsetLow, offsetHigh, numBytesLow, - numBytesHigh); - } -#endif -} - -/* -** Unlock a file region. - */ -static BOOL winUnlockFile( - LPHANDLE phFile, - DWORD offsetLow, - DWORD offsetHigh, - DWORD numBytesLow, - DWORD numBytesHigh -){ -#if SQLITE_OS_WINCE - /* - ** NOTE: Windows CE is handled differently here due its lack of the Win32 - ** API UnlockFile. - */ - return winceUnlockFile(phFile, offsetLow, offsetHigh, - numBytesLow, numBytesHigh); -#else - if( osIsNT() ){ - OVERLAPPED ovlp; - memset(&ovlp, 0, sizeof(OVERLAPPED)); - ovlp.Offset = offsetLow; - ovlp.OffsetHigh = offsetHigh; - return osUnlockFileEx(*phFile, 0, numBytesLow, numBytesHigh, &ovlp); - }else{ - return osUnlockFile(*phFile, offsetLow, offsetHigh, numBytesLow, - numBytesHigh); - } -#endif -} - -/***************************************************************************** -** The next group of routines implement the I/O methods specified -** by the sqlite3_io_methods object. -******************************************************************************/ - -/* -** Some Microsoft compilers lack this definition. -*/ -#ifndef INVALID_SET_FILE_POINTER -# define INVALID_SET_FILE_POINTER ((DWORD)-1) -#endif - -/* -** Move the current position of the file handle passed as the first -** argument to offset iOffset within the file. If successful, return 0. -** Otherwise, set pFile->lastErrno and return non-zero. -*/ -static int winSeekFile(winFile *pFile, sqlite3_int64 iOffset){ -#if !SQLITE_OS_WINRT - LONG upperBits; /* Most sig. 32 bits of new offset */ - LONG lowerBits; /* Least sig. 32 bits of new offset */ - DWORD dwRet; /* Value returned by SetFilePointer() */ - DWORD lastErrno; /* Value returned by GetLastError() */ - - OSTRACE(("SEEK file=%p, offset=%lld\n", pFile->h, iOffset)); - - upperBits = (LONG)((iOffset>>32) & 0x7fffffff); - lowerBits = (LONG)(iOffset & 0xffffffff); - - /* API oddity: If successful, SetFilePointer() returns a dword - ** containing the lower 32-bits of the new file-offset. Or, if it fails, - ** it returns INVALID_SET_FILE_POINTER. However according to MSDN, - ** INVALID_SET_FILE_POINTER may also be a valid new offset. So to determine - ** whether an error has actually occurred, it is also necessary to call - ** GetLastError(). - */ - dwRet = osSetFilePointer(pFile->h, lowerBits, &upperBits, FILE_BEGIN); - - if( (dwRet==INVALID_SET_FILE_POINTER - && ((lastErrno = osGetLastError())!=NO_ERROR)) ){ - pFile->lastErrno = lastErrno; - winLogError(SQLITE_IOERR_SEEK, pFile->lastErrno, - "winSeekFile", pFile->zPath); - OSTRACE(("SEEK file=%p, rc=SQLITE_IOERR_SEEK\n", pFile->h)); - return 1; - } - - OSTRACE(("SEEK file=%p, rc=SQLITE_OK\n", pFile->h)); - return 0; -#else - /* - ** Same as above, except that this implementation works for WinRT. - */ - - LARGE_INTEGER x; /* The new offset */ - BOOL bRet; /* Value returned by SetFilePointerEx() */ - - x.QuadPart = iOffset; - bRet = osSetFilePointerEx(pFile->h, x, 0, FILE_BEGIN); - - if(!bRet){ - pFile->lastErrno = osGetLastError(); - winLogError(SQLITE_IOERR_SEEK, pFile->lastErrno, - "winSeekFile", pFile->zPath); - OSTRACE(("SEEK file=%p, rc=SQLITE_IOERR_SEEK\n", pFile->h)); - return 1; - } - - OSTRACE(("SEEK file=%p, rc=SQLITE_OK\n", pFile->h)); - return 0; -#endif -} - -#if SQLITE_MAX_MMAP_SIZE>0 -/* Forward references to VFS helper methods used for memory mapped files */ -static int winMapfile(winFile*, sqlite3_int64); -static int winUnmapfile(winFile*); -#endif - -/* -** Close a file. -** -** It is reported that an attempt to close a handle might sometimes -** fail. This is a very unreasonable result, but Windows is notorious -** for being unreasonable so I do not doubt that it might happen. If -** the close fails, we pause for 100 milliseconds and try again. As -** many as MX_CLOSE_ATTEMPT attempts to close the handle are made before -** giving up and returning an error. -*/ -#define MX_CLOSE_ATTEMPT 3 -static int winClose(sqlite3_file *id){ - int rc, cnt = 0; - winFile *pFile = (winFile*)id; - - assert( id!=0 ); -#ifndef SQLITE_OMIT_WAL - assert( pFile->pShm==0 ); -#endif - assert( pFile->h!=NULL && pFile->h!=INVALID_HANDLE_VALUE ); - OSTRACE(("CLOSE file=%p\n", pFile->h)); - -#if SQLITE_MAX_MMAP_SIZE>0 - winUnmapfile(pFile); -#endif - - do{ - rc = osCloseHandle(pFile->h); - /* SimulateIOError( rc=0; cnt=MX_CLOSE_ATTEMPT; ); */ - }while( rc==0 && ++cnt < MX_CLOSE_ATTEMPT && (sqlite3_win32_sleep(100), 1) ); -#if SQLITE_OS_WINCE -#define WINCE_DELETION_ATTEMPTS 3 - winceDestroyLock(pFile); - if( pFile->zDeleteOnClose ){ - int cnt = 0; - while( - osDeleteFileW(pFile->zDeleteOnClose)==0 - && osGetFileAttributesW(pFile->zDeleteOnClose)!=0xffffffff - && cnt++ < WINCE_DELETION_ATTEMPTS - ){ - sqlite3_win32_sleep(100); /* Wait a little before trying again */ - } - sqlite3_free(pFile->zDeleteOnClose); - } -#endif - if( rc ){ - pFile->h = NULL; - } - OpenCounter(-1); - OSTRACE(("CLOSE file=%p, rc=%s\n", pFile->h, rc ? "ok" : "failed")); - return rc ? SQLITE_OK - : winLogError(SQLITE_IOERR_CLOSE, osGetLastError(), - "winClose", pFile->zPath); -} - -/* -** Read data from a file into a buffer. Return SQLITE_OK if all -** bytes were read successfully and SQLITE_IOERR if anything goes -** wrong. -*/ -static int winRead( - sqlite3_file *id, /* File to read from */ - void *pBuf, /* Write content into this buffer */ - int amt, /* Number of bytes to read */ - sqlite3_int64 offset /* Begin reading at this offset */ -){ -#if !SQLITE_OS_WINCE - OVERLAPPED overlapped; /* The offset for ReadFile. */ -#endif - winFile *pFile = (winFile*)id; /* file handle */ - DWORD nRead; /* Number of bytes actually read from file */ - int nRetry = 0; /* Number of retrys */ - - assert( id!=0 ); - assert( amt>0 ); - assert( offset>=0 ); - SimulateIOError(return SQLITE_IOERR_READ); - OSTRACE(("READ file=%p, buffer=%p, amount=%d, offset=%lld, lock=%d\n", - pFile->h, pBuf, amt, offset, pFile->locktype)); - -#if SQLITE_MAX_MMAP_SIZE>0 - /* Deal with as much of this read request as possible by transfering - ** data from the memory mapping using memcpy(). */ - if( offsetmmapSize ){ - if( offset+amt <= pFile->mmapSize ){ - memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], amt); - OSTRACE(("READ-MMAP file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - }else{ - int nCopy = (int)(pFile->mmapSize - offset); - memcpy(pBuf, &((u8 *)(pFile->pMapRegion))[offset], nCopy); - pBuf = &((u8 *)pBuf)[nCopy]; - amt -= nCopy; - offset += nCopy; - } - } -#endif - -#if SQLITE_OS_WINCE - if( winSeekFile(pFile, offset) ){ - OSTRACE(("READ file=%p, rc=SQLITE_FULL\n", pFile->h)); - return SQLITE_FULL; - } - while( !osReadFile(pFile->h, pBuf, amt, &nRead, 0) ){ -#else - memset(&overlapped, 0, sizeof(OVERLAPPED)); - overlapped.Offset = (LONG)(offset & 0xffffffff); - overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff); - while( !osReadFile(pFile->h, pBuf, amt, &nRead, &overlapped) && - osGetLastError()!=ERROR_HANDLE_EOF ){ -#endif - DWORD lastErrno; - if( winRetryIoerr(&nRetry, &lastErrno) ) continue; - pFile->lastErrno = lastErrno; - OSTRACE(("READ file=%p, rc=SQLITE_IOERR_READ\n", pFile->h)); - return winLogError(SQLITE_IOERR_READ, pFile->lastErrno, - "winRead", pFile->zPath); - } - winLogIoerr(nRetry); - if( nRead<(DWORD)amt ){ - /* Unread parts of the buffer must be zero-filled */ - memset(&((char*)pBuf)[nRead], 0, amt-nRead); - OSTRACE(("READ file=%p, rc=SQLITE_IOERR_SHORT_READ\n", pFile->h)); - return SQLITE_IOERR_SHORT_READ; - } - - OSTRACE(("READ file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; -} - -/* -** Write data from a buffer into a file. Return SQLITE_OK on success -** or some other error code on failure. -*/ -static int winWrite( - sqlite3_file *id, /* File to write into */ - const void *pBuf, /* The bytes to be written */ - int amt, /* Number of bytes to write */ - sqlite3_int64 offset /* Offset into the file to begin writing at */ -){ - int rc = 0; /* True if error has occurred, else false */ - winFile *pFile = (winFile*)id; /* File handle */ - int nRetry = 0; /* Number of retries */ - - assert( amt>0 ); - assert( pFile ); - SimulateIOError(return SQLITE_IOERR_WRITE); - SimulateDiskfullError(return SQLITE_FULL); - - OSTRACE(("WRITE file=%p, buffer=%p, amount=%d, offset=%lld, lock=%d\n", - pFile->h, pBuf, amt, offset, pFile->locktype)); - -#if SQLITE_MAX_MMAP_SIZE>0 - /* Deal with as much of this write request as possible by transfering - ** data from the memory mapping using memcpy(). */ - if( offsetmmapSize ){ - if( offset+amt <= pFile->mmapSize ){ - memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, amt); - OSTRACE(("WRITE-MMAP file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - }else{ - int nCopy = (int)(pFile->mmapSize - offset); - memcpy(&((u8 *)(pFile->pMapRegion))[offset], pBuf, nCopy); - pBuf = &((u8 *)pBuf)[nCopy]; - amt -= nCopy; - offset += nCopy; - } - } -#endif - -#if SQLITE_OS_WINCE - rc = winSeekFile(pFile, offset); - if( rc==0 ){ -#else - { -#endif -#if !SQLITE_OS_WINCE - OVERLAPPED overlapped; /* The offset for WriteFile. */ -#endif - u8 *aRem = (u8 *)pBuf; /* Data yet to be written */ - int nRem = amt; /* Number of bytes yet to be written */ - DWORD nWrite; /* Bytes written by each WriteFile() call */ - DWORD lastErrno = NO_ERROR; /* Value returned by GetLastError() */ - -#if !SQLITE_OS_WINCE - memset(&overlapped, 0, sizeof(OVERLAPPED)); - overlapped.Offset = (LONG)(offset & 0xffffffff); - overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff); -#endif - - while( nRem>0 ){ -#if SQLITE_OS_WINCE - if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, 0) ){ -#else - if( !osWriteFile(pFile->h, aRem, nRem, &nWrite, &overlapped) ){ -#endif - if( winRetryIoerr(&nRetry, &lastErrno) ) continue; - break; - } - assert( nWrite==0 || nWrite<=(DWORD)nRem ); - if( nWrite==0 || nWrite>(DWORD)nRem ){ - lastErrno = osGetLastError(); - break; - } -#if !SQLITE_OS_WINCE - offset += nWrite; - overlapped.Offset = (LONG)(offset & 0xffffffff); - overlapped.OffsetHigh = (LONG)((offset>>32) & 0x7fffffff); -#endif - aRem += nWrite; - nRem -= nWrite; - } - if( nRem>0 ){ - pFile->lastErrno = lastErrno; - rc = 1; - } - } - - if( rc ){ - if( ( pFile->lastErrno==ERROR_HANDLE_DISK_FULL ) - || ( pFile->lastErrno==ERROR_DISK_FULL )){ - OSTRACE(("WRITE file=%p, rc=SQLITE_FULL\n", pFile->h)); - return winLogError(SQLITE_FULL, pFile->lastErrno, - "winWrite1", pFile->zPath); - } - OSTRACE(("WRITE file=%p, rc=SQLITE_IOERR_WRITE\n", pFile->h)); - return winLogError(SQLITE_IOERR_WRITE, pFile->lastErrno, - "winWrite2", pFile->zPath); - }else{ - winLogIoerr(nRetry); - } - OSTRACE(("WRITE file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; -} - -/* -** Truncate an open file to a specified size -*/ -static int winTruncate(sqlite3_file *id, sqlite3_int64 nByte){ - winFile *pFile = (winFile*)id; /* File handle object */ - int rc = SQLITE_OK; /* Return code for this function */ - DWORD lastErrno; - - assert( pFile ); - SimulateIOError(return SQLITE_IOERR_TRUNCATE); - OSTRACE(("TRUNCATE file=%p, size=%lld, lock=%d\n", - pFile->h, nByte, pFile->locktype)); - - /* If the user has configured a chunk-size for this file, truncate the - ** file so that it consists of an integer number of chunks (i.e. the - ** actual file size after the operation may be larger than the requested - ** size). - */ - if( pFile->szChunk>0 ){ - nByte = ((nByte + pFile->szChunk - 1)/pFile->szChunk) * pFile->szChunk; - } - - /* SetEndOfFile() returns non-zero when successful, or zero when it fails. */ - if( winSeekFile(pFile, nByte) ){ - rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno, - "winTruncate1", pFile->zPath); - }else if( 0==osSetEndOfFile(pFile->h) && - ((lastErrno = osGetLastError())!=ERROR_USER_MAPPED_FILE) ){ - pFile->lastErrno = lastErrno; - rc = winLogError(SQLITE_IOERR_TRUNCATE, pFile->lastErrno, - "winTruncate2", pFile->zPath); - } - -#if SQLITE_MAX_MMAP_SIZE>0 - /* If the file was truncated to a size smaller than the currently - ** mapped region, reduce the effective mapping size as well. SQLite will - ** use read() and write() to access data beyond this point from now on. - */ - if( pFile->pMapRegion && nBytemmapSize ){ - pFile->mmapSize = nByte; - } -#endif - - OSTRACE(("TRUNCATE file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc))); - return rc; -} - -#ifdef SQLITE_TEST -/* -** Count the number of fullsyncs and normal syncs. This is used to test -** that syncs and fullsyncs are occuring at the right times. -*/ -SQLITE_API int sqlite3_sync_count = 0; -SQLITE_API int sqlite3_fullsync_count = 0; -#endif - -/* -** Make sure all writes to a particular file are committed to disk. -*/ -static int winSync(sqlite3_file *id, int flags){ -#ifndef SQLITE_NO_SYNC - /* - ** Used only when SQLITE_NO_SYNC is not defined. - */ - BOOL rc; -#endif -#if !defined(NDEBUG) || !defined(SQLITE_NO_SYNC) || \ - (defined(SQLITE_TEST) && defined(SQLITE_DEBUG)) - /* - ** Used when SQLITE_NO_SYNC is not defined and by the assert() and/or - ** OSTRACE() macros. - */ - winFile *pFile = (winFile*)id; -#else - UNUSED_PARAMETER(id); -#endif - - assert( pFile ); - /* Check that one of SQLITE_SYNC_NORMAL or FULL was passed */ - assert((flags&0x0F)==SQLITE_SYNC_NORMAL - || (flags&0x0F)==SQLITE_SYNC_FULL - ); - - /* Unix cannot, but some systems may return SQLITE_FULL from here. This - ** line is to test that doing so does not cause any problems. - */ - SimulateDiskfullError( return SQLITE_FULL ); - - OSTRACE(("SYNC file=%p, flags=%x, lock=%d\n", - pFile->h, flags, pFile->locktype)); - -#ifndef SQLITE_TEST - UNUSED_PARAMETER(flags); -#else - if( (flags&0x0F)==SQLITE_SYNC_FULL ){ - sqlite3_fullsync_count++; - } - sqlite3_sync_count++; -#endif - - /* If we compiled with the SQLITE_NO_SYNC flag, then syncing is a - ** no-op - */ -#ifdef SQLITE_NO_SYNC - OSTRACE(("SYNC-NOP file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; -#else - rc = osFlushFileBuffers(pFile->h); - SimulateIOError( rc=FALSE ); - if( rc ){ - OSTRACE(("SYNC file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - }else{ - pFile->lastErrno = osGetLastError(); - OSTRACE(("SYNC file=%p, rc=SQLITE_IOERR_FSYNC\n", pFile->h)); - return winLogError(SQLITE_IOERR_FSYNC, pFile->lastErrno, - "winSync", pFile->zPath); - } -#endif -} - -/* -** Determine the current size of a file in bytes -*/ -static int winFileSize(sqlite3_file *id, sqlite3_int64 *pSize){ - winFile *pFile = (winFile*)id; - int rc = SQLITE_OK; - - assert( id!=0 ); - assert( pSize!=0 ); - SimulateIOError(return SQLITE_IOERR_FSTAT); - OSTRACE(("SIZE file=%p, pSize=%p\n", pFile->h, pSize)); - -#if SQLITE_OS_WINRT - { - FILE_STANDARD_INFO info; - if( osGetFileInformationByHandleEx(pFile->h, FileStandardInfo, - &info, sizeof(info)) ){ - *pSize = info.EndOfFile.QuadPart; - }else{ - pFile->lastErrno = osGetLastError(); - rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno, - "winFileSize", pFile->zPath); - } - } -#else - { - DWORD upperBits; - DWORD lowerBits; - DWORD lastErrno; - - lowerBits = osGetFileSize(pFile->h, &upperBits); - *pSize = (((sqlite3_int64)upperBits)<<32) + lowerBits; - if( (lowerBits == INVALID_FILE_SIZE) - && ((lastErrno = osGetLastError())!=NO_ERROR) ){ - pFile->lastErrno = lastErrno; - rc = winLogError(SQLITE_IOERR_FSTAT, pFile->lastErrno, - "winFileSize", pFile->zPath); - } - } -#endif - OSTRACE(("SIZE file=%p, pSize=%p, *pSize=%lld, rc=%s\n", - pFile->h, pSize, *pSize, sqlite3ErrName(rc))); - return rc; -} - -/* -** LOCKFILE_FAIL_IMMEDIATELY is undefined on some Windows systems. -*/ -#ifndef LOCKFILE_FAIL_IMMEDIATELY -# define LOCKFILE_FAIL_IMMEDIATELY 1 -#endif - -#ifndef LOCKFILE_EXCLUSIVE_LOCK -# define LOCKFILE_EXCLUSIVE_LOCK 2 -#endif - -/* -** Historically, SQLite has used both the LockFile and LockFileEx functions. -** When the LockFile function was used, it was always expected to fail -** immediately if the lock could not be obtained. Also, it always expected to -** obtain an exclusive lock. These flags are used with the LockFileEx function -** and reflect those expectations; therefore, they should not be changed. -*/ -#ifndef SQLITE_LOCKFILE_FLAGS -# define SQLITE_LOCKFILE_FLAGS (LOCKFILE_FAIL_IMMEDIATELY | \ - LOCKFILE_EXCLUSIVE_LOCK) -#endif - -/* -** Currently, SQLite never calls the LockFileEx function without wanting the -** call to fail immediately if the lock cannot be obtained. -*/ -#ifndef SQLITE_LOCKFILEEX_FLAGS -# define SQLITE_LOCKFILEEX_FLAGS (LOCKFILE_FAIL_IMMEDIATELY) -#endif - -/* -** Acquire a reader lock. -** Different API routines are called depending on whether or not this -** is Win9x or WinNT. -*/ -static int winGetReadLock(winFile *pFile){ - int res; - OSTRACE(("READ-LOCK file=%p, lock=%d\n", pFile->h, pFile->locktype)); - if( osIsNT() ){ -#if SQLITE_OS_WINCE - /* - ** NOTE: Windows CE is handled differently here due its lack of the Win32 - ** API LockFileEx. - */ - res = winceLockFile(&pFile->h, SHARED_FIRST, 0, 1, 0); -#else - res = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS, SHARED_FIRST, 0, - SHARED_SIZE, 0); -#endif - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - int lk; - sqlite3_randomness(sizeof(lk), &lk); - pFile->sharedLockByte = (short)((lk & 0x7fffffff)%(SHARED_SIZE - 1)); - res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, - SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0); - } -#endif - if( res == 0 ){ - pFile->lastErrno = osGetLastError(); - /* No need to log a failure to lock */ - } - OSTRACE(("READ-LOCK file=%p, rc=%s\n", pFile->h, sqlite3ErrName(res))); - return res; -} - -/* -** Undo a readlock -*/ -static int winUnlockReadLock(winFile *pFile){ - int res; - DWORD lastErrno; - OSTRACE(("READ-UNLOCK file=%p, lock=%d\n", pFile->h, pFile->locktype)); - if( osIsNT() ){ - res = winUnlockFile(&pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0); - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - res = winUnlockFile(&pFile->h, SHARED_FIRST+pFile->sharedLockByte, 0, 1, 0); - } -#endif - if( res==0 && ((lastErrno = osGetLastError())!=ERROR_NOT_LOCKED) ){ - pFile->lastErrno = lastErrno; - winLogError(SQLITE_IOERR_UNLOCK, pFile->lastErrno, - "winUnlockReadLock", pFile->zPath); - } - OSTRACE(("READ-UNLOCK file=%p, rc=%s\n", pFile->h, sqlite3ErrName(res))); - return res; -} - -/* -** Lock the file with the lock specified by parameter locktype - one -** of the following: -** -** (1) SHARED_LOCK -** (2) RESERVED_LOCK -** (3) PENDING_LOCK -** (4) EXCLUSIVE_LOCK -** -** Sometimes when requesting one lock state, additional lock states -** are inserted in between. The locking might fail on one of the later -** transitions leaving the lock state different from what it started but -** still short of its goal. The following chart shows the allowed -** transitions and the inserted intermediate states: -** -** UNLOCKED -> SHARED -** SHARED -> RESERVED -** SHARED -> (PENDING) -> EXCLUSIVE -** RESERVED -> (PENDING) -> EXCLUSIVE -** PENDING -> EXCLUSIVE -** -** This routine will only increase a lock. The winUnlock() routine -** erases all locks at once and returns us immediately to locking level 0. -** It is not possible to lower the locking level one step at a time. You -** must go straight to locking level 0. -*/ -static int winLock(sqlite3_file *id, int locktype){ - int rc = SQLITE_OK; /* Return code from subroutines */ - int res = 1; /* Result of a Windows lock call */ - int newLocktype; /* Set pFile->locktype to this value before exiting */ - int gotPendingLock = 0;/* True if we acquired a PENDING lock this time */ - winFile *pFile = (winFile*)id; - DWORD lastErrno = NO_ERROR; - - assert( id!=0 ); - OSTRACE(("LOCK file=%p, oldLock=%d(%d), newLock=%d\n", - pFile->h, pFile->locktype, pFile->sharedLockByte, locktype)); - - /* If there is already a lock of this type or more restrictive on the - ** OsFile, do nothing. Don't use the end_lock: exit path, as - ** sqlite3OsEnterMutex() hasn't been called yet. - */ - if( pFile->locktype>=locktype ){ - OSTRACE(("LOCK-HELD file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - - /* Make sure the locking sequence is correct - */ - assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK ); - assert( locktype!=PENDING_LOCK ); - assert( locktype!=RESERVED_LOCK || pFile->locktype==SHARED_LOCK ); - - /* Lock the PENDING_LOCK byte if we need to acquire a PENDING lock or - ** a SHARED lock. If we are acquiring a SHARED lock, the acquisition of - ** the PENDING_LOCK byte is temporary. - */ - newLocktype = pFile->locktype; - if( (pFile->locktype==NO_LOCK) - || ( (locktype==EXCLUSIVE_LOCK) - && (pFile->locktype==RESERVED_LOCK)) - ){ - int cnt = 3; - while( cnt-->0 && (res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, - PENDING_BYTE, 0, 1, 0))==0 ){ - /* Try 3 times to get the pending lock. This is needed to work - ** around problems caused by indexing and/or anti-virus software on - ** Windows systems. - ** If you are using this code as a model for alternative VFSes, do not - ** copy this retry logic. It is a hack intended for Windows only. - */ - OSTRACE(("LOCK-PENDING-FAIL file=%p, count=%d, rc=%s\n", - pFile->h, cnt, sqlite3ErrName(res))); - if( cnt ) sqlite3_win32_sleep(1); - } - gotPendingLock = res; - if( !res ){ - lastErrno = osGetLastError(); - } - } - - /* Acquire a shared lock - */ - if( locktype==SHARED_LOCK && res ){ - assert( pFile->locktype==NO_LOCK ); - res = winGetReadLock(pFile); - if( res ){ - newLocktype = SHARED_LOCK; - }else{ - lastErrno = osGetLastError(); - } - } - - /* Acquire a RESERVED lock - */ - if( locktype==RESERVED_LOCK && res ){ - assert( pFile->locktype==SHARED_LOCK ); - res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, RESERVED_BYTE, 0, 1, 0); - if( res ){ - newLocktype = RESERVED_LOCK; - }else{ - lastErrno = osGetLastError(); - } - } - - /* Acquire a PENDING lock - */ - if( locktype==EXCLUSIVE_LOCK && res ){ - newLocktype = PENDING_LOCK; - gotPendingLock = 0; - } - - /* Acquire an EXCLUSIVE lock - */ - if( locktype==EXCLUSIVE_LOCK && res ){ - assert( pFile->locktype>=SHARED_LOCK ); - res = winUnlockReadLock(pFile); - res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS, SHARED_FIRST, 0, - SHARED_SIZE, 0); - if( res ){ - newLocktype = EXCLUSIVE_LOCK; - }else{ - lastErrno = osGetLastError(); - winGetReadLock(pFile); - } - } - - /* If we are holding a PENDING lock that ought to be released, then - ** release it now. - */ - if( gotPendingLock && locktype==SHARED_LOCK ){ - winUnlockFile(&pFile->h, PENDING_BYTE, 0, 1, 0); - } - - /* Update the state of the lock has held in the file descriptor then - ** return the appropriate result code. - */ - if( res ){ - rc = SQLITE_OK; - }else{ - pFile->lastErrno = lastErrno; - rc = SQLITE_BUSY; - OSTRACE(("LOCK-FAIL file=%p, wanted=%d, got=%d\n", - pFile->h, locktype, newLocktype)); - } - pFile->locktype = (u8)newLocktype; - OSTRACE(("LOCK file=%p, lock=%d, rc=%s\n", - pFile->h, pFile->locktype, sqlite3ErrName(rc))); - return rc; -} - -/* -** This routine checks if there is a RESERVED lock held on the specified -** file by this or any other process. If such a lock is held, return -** non-zero, otherwise zero. -*/ -static int winCheckReservedLock(sqlite3_file *id, int *pResOut){ - int rc; - winFile *pFile = (winFile*)id; - - SimulateIOError( return SQLITE_IOERR_CHECKRESERVEDLOCK; ); - OSTRACE(("TEST-WR-LOCK file=%p, pResOut=%p\n", pFile->h, pResOut)); - - assert( id!=0 ); - if( pFile->locktype>=RESERVED_LOCK ){ - rc = 1; - OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (local)\n", pFile->h, rc)); - }else{ - rc = winLockFile(&pFile->h, SQLITE_LOCKFILEEX_FLAGS,RESERVED_BYTE, 0, 1, 0); - if( rc ){ - winUnlockFile(&pFile->h, RESERVED_BYTE, 0, 1, 0); - } - rc = !rc; - OSTRACE(("TEST-WR-LOCK file=%p, rc=%d (remote)\n", pFile->h, rc)); - } - *pResOut = rc; - OSTRACE(("TEST-WR-LOCK file=%p, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n", - pFile->h, pResOut, *pResOut)); - return SQLITE_OK; -} - -/* -** Lower the locking level on file descriptor id to locktype. locktype -** must be either NO_LOCK or SHARED_LOCK. -** -** If the locking level of the file descriptor is already at or below -** the requested locking level, this routine is a no-op. -** -** It is not possible for this routine to fail if the second argument -** is NO_LOCK. If the second argument is SHARED_LOCK then this routine -** might return SQLITE_IOERR; -*/ -static int winUnlock(sqlite3_file *id, int locktype){ - int type; - winFile *pFile = (winFile*)id; - int rc = SQLITE_OK; - assert( pFile!=0 ); - assert( locktype<=SHARED_LOCK ); - OSTRACE(("UNLOCK file=%p, oldLock=%d(%d), newLock=%d\n", - pFile->h, pFile->locktype, pFile->sharedLockByte, locktype)); - type = pFile->locktype; - if( type>=EXCLUSIVE_LOCK ){ - winUnlockFile(&pFile->h, SHARED_FIRST, 0, SHARED_SIZE, 0); - if( locktype==SHARED_LOCK && !winGetReadLock(pFile) ){ - /* This should never happen. We should always be able to - ** reacquire the read lock */ - rc = winLogError(SQLITE_IOERR_UNLOCK, osGetLastError(), - "winUnlock", pFile->zPath); - } - } - if( type>=RESERVED_LOCK ){ - winUnlockFile(&pFile->h, RESERVED_BYTE, 0, 1, 0); - } - if( locktype==NO_LOCK && type>=SHARED_LOCK ){ - winUnlockReadLock(pFile); - } - if( type>=PENDING_LOCK ){ - winUnlockFile(&pFile->h, PENDING_BYTE, 0, 1, 0); - } - pFile->locktype = (u8)locktype; - OSTRACE(("UNLOCK file=%p, lock=%d, rc=%s\n", - pFile->h, pFile->locktype, sqlite3ErrName(rc))); - return rc; -} - -/* -** If *pArg is inititially negative then this is a query. Set *pArg to -** 1 or 0 depending on whether or not bit mask of pFile->ctrlFlags is set. -** -** If *pArg is 0 or 1, then clear or set the mask bit of pFile->ctrlFlags. -*/ -static void winModeBit(winFile *pFile, unsigned char mask, int *pArg){ - if( *pArg<0 ){ - *pArg = (pFile->ctrlFlags & mask)!=0; - }else if( (*pArg)==0 ){ - pFile->ctrlFlags &= ~mask; - }else{ - pFile->ctrlFlags |= mask; - } -} - -/* Forward references to VFS helper methods used for temporary files */ -static int winGetTempname(sqlite3_vfs *, char **); -static int winIsDir(const void *); -static BOOL winIsDriveLetterAndColon(const char *); - -/* -** Control and query of the open file handle. -*/ -static int winFileControl(sqlite3_file *id, int op, void *pArg){ - winFile *pFile = (winFile*)id; - OSTRACE(("FCNTL file=%p, op=%d, pArg=%p\n", pFile->h, op, pArg)); - switch( op ){ - case SQLITE_FCNTL_LOCKSTATE: { - *(int*)pArg = pFile->locktype; - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - case SQLITE_LAST_ERRNO: { - *(int*)pArg = (int)pFile->lastErrno; - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - case SQLITE_FCNTL_CHUNK_SIZE: { - pFile->szChunk = *(int *)pArg; - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - case SQLITE_FCNTL_SIZE_HINT: { - if( pFile->szChunk>0 ){ - sqlite3_int64 oldSz; - int rc = winFileSize(id, &oldSz); - if( rc==SQLITE_OK ){ - sqlite3_int64 newSz = *(sqlite3_int64*)pArg; - if( newSz>oldSz ){ - SimulateIOErrorBenign(1); - rc = winTruncate(id, newSz); - SimulateIOErrorBenign(0); - } - } - OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc))); - return rc; - } - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - case SQLITE_FCNTL_PERSIST_WAL: { - winModeBit(pFile, WINFILE_PERSIST_WAL, (int*)pArg); - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - case SQLITE_FCNTL_POWERSAFE_OVERWRITE: { - winModeBit(pFile, WINFILE_PSOW, (int*)pArg); - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - case SQLITE_FCNTL_VFSNAME: { - *(char**)pArg = sqlite3_mprintf("%s", pFile->pVfs->zName); - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - case SQLITE_FCNTL_WIN32_AV_RETRY: { - int *a = (int*)pArg; - if( a[0]>0 ){ - winIoerrRetry = a[0]; - }else{ - a[0] = winIoerrRetry; - } - if( a[1]>0 ){ - winIoerrRetryDelay = a[1]; - }else{ - a[1] = winIoerrRetryDelay; - } - OSTRACE(("FCNTL file=%p, rc=SQLITE_OK\n", pFile->h)); - return SQLITE_OK; - } - case SQLITE_FCNTL_TEMPFILENAME: { - char *zTFile = 0; - int rc = winGetTempname(pFile->pVfs, &zTFile); - if( rc==SQLITE_OK ){ - *(char**)pArg = zTFile; - } - OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc))); - return rc; - } -#if SQLITE_MAX_MMAP_SIZE>0 - case SQLITE_FCNTL_MMAP_SIZE: { - i64 newLimit = *(i64*)pArg; - int rc = SQLITE_OK; - if( newLimit>sqlite3GlobalConfig.mxMmap ){ - newLimit = sqlite3GlobalConfig.mxMmap; - } - *(i64*)pArg = pFile->mmapSizeMax; - if( newLimit>=0 && newLimit!=pFile->mmapSizeMax && pFile->nFetchOut==0 ){ - pFile->mmapSizeMax = newLimit; - if( pFile->mmapSize>0 ){ - winUnmapfile(pFile); - rc = winMapfile(pFile, -1); - } - } - OSTRACE(("FCNTL file=%p, rc=%s\n", pFile->h, sqlite3ErrName(rc))); - return rc; - } -#endif - } - OSTRACE(("FCNTL file=%p, rc=SQLITE_NOTFOUND\n", pFile->h)); - return SQLITE_NOTFOUND; -} - -/* -** Return the sector size in bytes of the underlying block device for -** the specified file. This is almost always 512 bytes, but may be -** larger for some devices. -** -** SQLite code assumes this function cannot fail. It also assumes that -** if two files are created in the same file-system directory (i.e. -** a database and its journal file) that the sector size will be the -** same for both. -*/ -static int winSectorSize(sqlite3_file *id){ - (void)id; - return SQLITE_DEFAULT_SECTOR_SIZE; -} - -/* -** Return a vector of device characteristics. -*/ -static int winDeviceCharacteristics(sqlite3_file *id){ - winFile *p = (winFile*)id; - return SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN | - ((p->ctrlFlags & WINFILE_PSOW)?SQLITE_IOCAP_POWERSAFE_OVERWRITE:0); -} - -/* -** Windows will only let you create file view mappings -** on allocation size granularity boundaries. -** During sqlite3_os_init() we do a GetSystemInfo() -** to get the granularity size. -*/ -SYSTEM_INFO winSysInfo; - -#ifndef SQLITE_OMIT_WAL - -/* -** Helper functions to obtain and relinquish the global mutex. The -** global mutex is used to protect the winLockInfo objects used by -** this file, all of which may be shared by multiple threads. -** -** Function winShmMutexHeld() is used to assert() that the global mutex -** is held when required. This function is only used as part of assert() -** statements. e.g. -** -** winShmEnterMutex() -** assert( winShmMutexHeld() ); -** winShmLeaveMutex() -*/ -static void winShmEnterMutex(void){ - sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); -} -static void winShmLeaveMutex(void){ - sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); -} -#ifndef NDEBUG -static int winShmMutexHeld(void) { - return sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); -} -#endif - -/* -** Object used to represent a single file opened and mmapped to provide -** shared memory. When multiple threads all reference the same -** log-summary, each thread has its own winFile object, but they all -** point to a single instance of this object. In other words, each -** log-summary is opened only once per process. -** -** winShmMutexHeld() must be true when creating or destroying -** this object or while reading or writing the following fields: -** -** nRef -** pNext -** -** The following fields are read-only after the object is created: -** -** fid -** zFilename -** -** Either winShmNode.mutex must be held or winShmNode.nRef==0 and -** winShmMutexHeld() is true when reading or writing any other field -** in this structure. -** -*/ -struct winShmNode { - sqlite3_mutex *mutex; /* Mutex to access this object */ - char *zFilename; /* Name of the file */ - winFile hFile; /* File handle from winOpen */ - - int szRegion; /* Size of shared-memory regions */ - int nRegion; /* Size of array apRegion */ - struct ShmRegion { - HANDLE hMap; /* File handle from CreateFileMapping */ - void *pMap; - } *aRegion; - DWORD lastErrno; /* The Windows errno from the last I/O error */ - - int nRef; /* Number of winShm objects pointing to this */ - winShm *pFirst; /* All winShm objects pointing to this */ - winShmNode *pNext; /* Next in list of all winShmNode objects */ -#ifdef SQLITE_DEBUG - u8 nextShmId; /* Next available winShm.id value */ -#endif -}; - -/* -** A global array of all winShmNode objects. -** -** The winShmMutexHeld() must be true while reading or writing this list. -*/ -static winShmNode *winShmNodeList = 0; - -/* -** Structure used internally by this VFS to record the state of an -** open shared memory connection. -** -** The following fields are initialized when this object is created and -** are read-only thereafter: -** -** winShm.pShmNode -** winShm.id -** -** All other fields are read/write. The winShm.pShmNode->mutex must be held -** while accessing any read/write fields. -*/ -struct winShm { - winShmNode *pShmNode; /* The underlying winShmNode object */ - winShm *pNext; /* Next winShm with the same winShmNode */ - u8 hasMutex; /* True if holding the winShmNode mutex */ - u16 sharedMask; /* Mask of shared locks held */ - u16 exclMask; /* Mask of exclusive locks held */ -#ifdef SQLITE_DEBUG - u8 id; /* Id of this connection with its winShmNode */ -#endif -}; - -/* -** Constants used for locking -*/ -#define WIN_SHM_BASE ((22+SQLITE_SHM_NLOCK)*4) /* first lock byte */ -#define WIN_SHM_DMS (WIN_SHM_BASE+SQLITE_SHM_NLOCK) /* deadman switch */ - -/* -** Apply advisory locks for all n bytes beginning at ofst. -*/ -#define _SHM_UNLCK 1 -#define _SHM_RDLCK 2 -#define _SHM_WRLCK 3 -static int winShmSystemLock( - winShmNode *pFile, /* Apply locks to this open shared-memory segment */ - int lockType, /* _SHM_UNLCK, _SHM_RDLCK, or _SHM_WRLCK */ - int ofst, /* Offset to first byte to be locked/unlocked */ - int nByte /* Number of bytes to lock or unlock */ -){ - int rc = 0; /* Result code form Lock/UnlockFileEx() */ - - /* Access to the winShmNode object is serialized by the caller */ - assert( sqlite3_mutex_held(pFile->mutex) || pFile->nRef==0 ); - - OSTRACE(("SHM-LOCK file=%p, lock=%d, offset=%d, size=%d\n", - pFile->hFile.h, lockType, ofst, nByte)); - - /* Release/Acquire the system-level lock */ - if( lockType==_SHM_UNLCK ){ - rc = winUnlockFile(&pFile->hFile.h, ofst, 0, nByte, 0); - }else{ - /* Initialize the locking parameters */ - DWORD dwFlags = LOCKFILE_FAIL_IMMEDIATELY; - if( lockType == _SHM_WRLCK ) dwFlags |= LOCKFILE_EXCLUSIVE_LOCK; - rc = winLockFile(&pFile->hFile.h, dwFlags, ofst, 0, nByte, 0); - } - - if( rc!= 0 ){ - rc = SQLITE_OK; - }else{ - pFile->lastErrno = osGetLastError(); - rc = SQLITE_BUSY; - } - - OSTRACE(("SHM-LOCK file=%p, func=%s, errno=%lu, rc=%s\n", - pFile->hFile.h, (lockType == _SHM_UNLCK) ? "winUnlockFile" : - "winLockFile", pFile->lastErrno, sqlite3ErrName(rc))); - - return rc; -} - -/* Forward references to VFS methods */ -static int winOpen(sqlite3_vfs*,const char*,sqlite3_file*,int,int*); -static int winDelete(sqlite3_vfs *,const char*,int); - -/* -** Purge the winShmNodeList list of all entries with winShmNode.nRef==0. -** -** This is not a VFS shared-memory method; it is a utility function called -** by VFS shared-memory methods. -*/ -static void winShmPurge(sqlite3_vfs *pVfs, int deleteFlag){ - winShmNode **pp; - winShmNode *p; - assert( winShmMutexHeld() ); - OSTRACE(("SHM-PURGE pid=%lu, deleteFlag=%d\n", - osGetCurrentProcessId(), deleteFlag)); - pp = &winShmNodeList; - while( (p = *pp)!=0 ){ - if( p->nRef==0 ){ - int i; - if( p->mutex ){ sqlite3_mutex_free(p->mutex); } - for(i=0; inRegion; i++){ - BOOL bRc = osUnmapViewOfFile(p->aRegion[i].pMap); - OSTRACE(("SHM-PURGE-UNMAP pid=%lu, region=%d, rc=%s\n", - osGetCurrentProcessId(), i, bRc ? "ok" : "failed")); - UNUSED_VARIABLE_VALUE(bRc); - bRc = osCloseHandle(p->aRegion[i].hMap); - OSTRACE(("SHM-PURGE-CLOSE pid=%lu, region=%d, rc=%s\n", - osGetCurrentProcessId(), i, bRc ? "ok" : "failed")); - UNUSED_VARIABLE_VALUE(bRc); - } - if( p->hFile.h!=NULL && p->hFile.h!=INVALID_HANDLE_VALUE ){ - SimulateIOErrorBenign(1); - winClose((sqlite3_file *)&p->hFile); - SimulateIOErrorBenign(0); - } - if( deleteFlag ){ - SimulateIOErrorBenign(1); - sqlite3BeginBenignMalloc(); - winDelete(pVfs, p->zFilename, 0); - sqlite3EndBenignMalloc(); - SimulateIOErrorBenign(0); - } - *pp = p->pNext; - sqlite3_free(p->aRegion); - sqlite3_free(p); - }else{ - pp = &p->pNext; - } - } -} - -/* -** Open the shared-memory area associated with database file pDbFd. -** -** When opening a new shared-memory file, if no other instances of that -** file are currently open, in this process or in other processes, then -** the file must be truncated to zero length or have its header cleared. -*/ -static int winOpenSharedMemory(winFile *pDbFd){ - struct winShm *p; /* The connection to be opened */ - struct winShmNode *pShmNode = 0; /* The underlying mmapped file */ - int rc; /* Result code */ - struct winShmNode *pNew; /* Newly allocated winShmNode */ - int nName; /* Size of zName in bytes */ - - assert( pDbFd->pShm==0 ); /* Not previously opened */ - - /* Allocate space for the new sqlite3_shm object. Also speculatively - ** allocate space for a new winShmNode and filename. - */ - p = sqlite3MallocZero( sizeof(*p) ); - if( p==0 ) return SQLITE_IOERR_NOMEM; - nName = sqlite3Strlen30(pDbFd->zPath); - pNew = sqlite3MallocZero( sizeof(*pShmNode) + nName + 17 ); - if( pNew==0 ){ - sqlite3_free(p); - return SQLITE_IOERR_NOMEM; - } - pNew->zFilename = (char*)&pNew[1]; - sqlite3_snprintf(nName+15, pNew->zFilename, "%s-shm", pDbFd->zPath); - sqlite3FileSuffix3(pDbFd->zPath, pNew->zFilename); - - /* Look to see if there is an existing winShmNode that can be used. - ** If no matching winShmNode currently exists, create a new one. - */ - winShmEnterMutex(); - for(pShmNode = winShmNodeList; pShmNode; pShmNode=pShmNode->pNext){ - /* TBD need to come up with better match here. Perhaps - ** use FILE_ID_BOTH_DIR_INFO Structure. - */ - if( sqlite3StrICmp(pShmNode->zFilename, pNew->zFilename)==0 ) break; - } - if( pShmNode ){ - sqlite3_free(pNew); - }else{ - pShmNode = pNew; - pNew = 0; - ((winFile*)(&pShmNode->hFile))->h = INVALID_HANDLE_VALUE; - pShmNode->pNext = winShmNodeList; - winShmNodeList = pShmNode; - - pShmNode->mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_FAST); - if( pShmNode->mutex==0 ){ - rc = SQLITE_IOERR_NOMEM; - goto shm_open_err; - } - - rc = winOpen(pDbFd->pVfs, - pShmNode->zFilename, /* Name of the file (UTF-8) */ - (sqlite3_file*)&pShmNode->hFile, /* File handle here */ - SQLITE_OPEN_WAL | SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, - 0); - if( SQLITE_OK!=rc ){ - goto shm_open_err; - } - - /* Check to see if another process is holding the dead-man switch. - ** If not, truncate the file to zero length. - */ - if( winShmSystemLock(pShmNode, _SHM_WRLCK, WIN_SHM_DMS, 1)==SQLITE_OK ){ - rc = winTruncate((sqlite3_file *)&pShmNode->hFile, 0); - if( rc!=SQLITE_OK ){ - rc = winLogError(SQLITE_IOERR_SHMOPEN, osGetLastError(), - "winOpenShm", pDbFd->zPath); - } - } - if( rc==SQLITE_OK ){ - winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); - rc = winShmSystemLock(pShmNode, _SHM_RDLCK, WIN_SHM_DMS, 1); - } - if( rc ) goto shm_open_err; - } - - /* Make the new connection a child of the winShmNode */ - p->pShmNode = pShmNode; -#ifdef SQLITE_DEBUG - p->id = pShmNode->nextShmId++; -#endif - pShmNode->nRef++; - pDbFd->pShm = p; - winShmLeaveMutex(); - - /* The reference count on pShmNode has already been incremented under - ** the cover of the winShmEnterMutex() mutex and the pointer from the - ** new (struct winShm) object to the pShmNode has been set. All that is - ** left to do is to link the new object into the linked list starting - ** at pShmNode->pFirst. This must be done while holding the pShmNode->mutex - ** mutex. - */ - sqlite3_mutex_enter(pShmNode->mutex); - p->pNext = pShmNode->pFirst; - pShmNode->pFirst = p; - sqlite3_mutex_leave(pShmNode->mutex); - return SQLITE_OK; - - /* Jump here on any error */ -shm_open_err: - winShmSystemLock(pShmNode, _SHM_UNLCK, WIN_SHM_DMS, 1); - winShmPurge(pDbFd->pVfs, 0); /* This call frees pShmNode if required */ - sqlite3_free(p); - sqlite3_free(pNew); - winShmLeaveMutex(); - return rc; -} - -/* -** Close a connection to shared-memory. Delete the underlying -** storage if deleteFlag is true. -*/ -static int winShmUnmap( - sqlite3_file *fd, /* Database holding shared memory */ - int deleteFlag /* Delete after closing if true */ -){ - winFile *pDbFd; /* Database holding shared-memory */ - winShm *p; /* The connection to be closed */ - winShmNode *pShmNode; /* The underlying shared-memory file */ - winShm **pp; /* For looping over sibling connections */ - - pDbFd = (winFile*)fd; - p = pDbFd->pShm; - if( p==0 ) return SQLITE_OK; - pShmNode = p->pShmNode; - - /* Remove connection p from the set of connections associated - ** with pShmNode */ - sqlite3_mutex_enter(pShmNode->mutex); - for(pp=&pShmNode->pFirst; (*pp)!=p; pp = &(*pp)->pNext){} - *pp = p->pNext; - - /* Free the connection p */ - sqlite3_free(p); - pDbFd->pShm = 0; - sqlite3_mutex_leave(pShmNode->mutex); - - /* If pShmNode->nRef has reached 0, then close the underlying - ** shared-memory file, too */ - winShmEnterMutex(); - assert( pShmNode->nRef>0 ); - pShmNode->nRef--; - if( pShmNode->nRef==0 ){ - winShmPurge(pDbFd->pVfs, deleteFlag); - } - winShmLeaveMutex(); - - return SQLITE_OK; -} - -/* -** Change the lock state for a shared-memory segment. -*/ -static int winShmLock( - sqlite3_file *fd, /* Database file holding the shared memory */ - int ofst, /* First lock to acquire or release */ - int n, /* Number of locks to acquire or release */ - int flags /* What to do with the lock */ -){ - winFile *pDbFd = (winFile*)fd; /* Connection holding shared memory */ - winShm *p = pDbFd->pShm; /* The shared memory being locked */ - winShm *pX; /* For looping over all siblings */ - winShmNode *pShmNode = p->pShmNode; - int rc = SQLITE_OK; /* Result code */ - u16 mask; /* Mask of locks to take or release */ - - assert( ofst>=0 && ofst+n<=SQLITE_SHM_NLOCK ); - assert( n>=1 ); - assert( flags==(SQLITE_SHM_LOCK | SQLITE_SHM_SHARED) - || flags==(SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE) - || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED) - || flags==(SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE) ); - assert( n==1 || (flags & SQLITE_SHM_EXCLUSIVE)!=0 ); - - mask = (u16)((1U<<(ofst+n)) - (1U<1 || mask==(1<mutex); - if( flags & SQLITE_SHM_UNLOCK ){ - u16 allMask = 0; /* Mask of locks held by siblings */ - - /* See if any siblings hold this same lock */ - for(pX=pShmNode->pFirst; pX; pX=pX->pNext){ - if( pX==p ) continue; - assert( (pX->exclMask & (p->exclMask|p->sharedMask))==0 ); - allMask |= pX->sharedMask; - } - - /* Unlock the system-level locks */ - if( (mask & allMask)==0 ){ - rc = winShmSystemLock(pShmNode, _SHM_UNLCK, ofst+WIN_SHM_BASE, n); - }else{ - rc = SQLITE_OK; - } - - /* Undo the local locks */ - if( rc==SQLITE_OK ){ - p->exclMask &= ~mask; - p->sharedMask &= ~mask; - } - }else if( flags & SQLITE_SHM_SHARED ){ - u16 allShared = 0; /* Union of locks held by connections other than "p" */ - - /* Find out which shared locks are already held by sibling connections. - ** If any sibling already holds an exclusive lock, go ahead and return - ** SQLITE_BUSY. - */ - for(pX=pShmNode->pFirst; pX; pX=pX->pNext){ - if( (pX->exclMask & mask)!=0 ){ - rc = SQLITE_BUSY; - break; - } - allShared |= pX->sharedMask; - } - - /* Get shared locks at the system level, if necessary */ - if( rc==SQLITE_OK ){ - if( (allShared & mask)==0 ){ - rc = winShmSystemLock(pShmNode, _SHM_RDLCK, ofst+WIN_SHM_BASE, n); - }else{ - rc = SQLITE_OK; - } - } - - /* Get the local shared locks */ - if( rc==SQLITE_OK ){ - p->sharedMask |= mask; - } - }else{ - /* Make sure no sibling connections hold locks that will block this - ** lock. If any do, return SQLITE_BUSY right away. - */ - for(pX=pShmNode->pFirst; pX; pX=pX->pNext){ - if( (pX->exclMask & mask)!=0 || (pX->sharedMask & mask)!=0 ){ - rc = SQLITE_BUSY; - break; - } - } - - /* Get the exclusive locks at the system level. Then if successful - ** also mark the local connection as being locked. - */ - if( rc==SQLITE_OK ){ - rc = winShmSystemLock(pShmNode, _SHM_WRLCK, ofst+WIN_SHM_BASE, n); - if( rc==SQLITE_OK ){ - assert( (p->sharedMask & mask)==0 ); - p->exclMask |= mask; - } - } - } - sqlite3_mutex_leave(pShmNode->mutex); - OSTRACE(("SHM-LOCK pid=%lu, id=%d, sharedMask=%03x, exclMask=%03x, rc=%s\n", - osGetCurrentProcessId(), p->id, p->sharedMask, p->exclMask, - sqlite3ErrName(rc))); - return rc; -} - -/* -** Implement a memory barrier or memory fence on shared memory. -** -** All loads and stores begun before the barrier must complete before -** any load or store begun after the barrier. -*/ -static void winShmBarrier( - sqlite3_file *fd /* Database holding the shared memory */ -){ - UNUSED_PARAMETER(fd); - /* MemoryBarrier(); // does not work -- do not know why not */ - winShmEnterMutex(); - winShmLeaveMutex(); -} - -/* -** This function is called to obtain a pointer to region iRegion of the -** shared-memory associated with the database file fd. Shared-memory regions -** are numbered starting from zero. Each shared-memory region is szRegion -** bytes in size. -** -** If an error occurs, an error code is returned and *pp is set to NULL. -** -** Otherwise, if the isWrite parameter is 0 and the requested shared-memory -** region has not been allocated (by any client, including one running in a -** separate process), then *pp is set to NULL and SQLITE_OK returned. If -** isWrite is non-zero and the requested shared-memory region has not yet -** been allocated, it is allocated by this function. -** -** If the shared-memory region has already been allocated or is allocated by -** this call as described above, then it is mapped into this processes -** address space (if it is not already), *pp is set to point to the mapped -** memory and SQLITE_OK returned. -*/ -static int winShmMap( - sqlite3_file *fd, /* Handle open on database file */ - int iRegion, /* Region to retrieve */ - int szRegion, /* Size of regions */ - int isWrite, /* True to extend file if necessary */ - void volatile **pp /* OUT: Mapped memory */ -){ - winFile *pDbFd = (winFile*)fd; - winShm *p = pDbFd->pShm; - winShmNode *pShmNode; - int rc = SQLITE_OK; - - if( !p ){ - rc = winOpenSharedMemory(pDbFd); - if( rc!=SQLITE_OK ) return rc; - p = pDbFd->pShm; - } - pShmNode = p->pShmNode; - - sqlite3_mutex_enter(pShmNode->mutex); - assert( szRegion==pShmNode->szRegion || pShmNode->nRegion==0 ); - - if( pShmNode->nRegion<=iRegion ){ - struct ShmRegion *apNew; /* New aRegion[] array */ - int nByte = (iRegion+1)*szRegion; /* Minimum required file size */ - sqlite3_int64 sz; /* Current size of wal-index file */ - - pShmNode->szRegion = szRegion; - - /* The requested region is not mapped into this processes address space. - ** Check to see if it has been allocated (i.e. if the wal-index file is - ** large enough to contain the requested region). - */ - rc = winFileSize((sqlite3_file *)&pShmNode->hFile, &sz); - if( rc!=SQLITE_OK ){ - rc = winLogError(SQLITE_IOERR_SHMSIZE, osGetLastError(), - "winShmMap1", pDbFd->zPath); - goto shmpage_out; - } - - if( szhFile, nByte); - if( rc!=SQLITE_OK ){ - rc = winLogError(SQLITE_IOERR_SHMSIZE, osGetLastError(), - "winShmMap2", pDbFd->zPath); - goto shmpage_out; - } - } - - /* Map the requested memory region into this processes address space. */ - apNew = (struct ShmRegion *)sqlite3_realloc( - pShmNode->aRegion, (iRegion+1)*sizeof(apNew[0]) - ); - if( !apNew ){ - rc = SQLITE_IOERR_NOMEM; - goto shmpage_out; - } - pShmNode->aRegion = apNew; - - while( pShmNode->nRegion<=iRegion ){ - HANDLE hMap = NULL; /* file-mapping handle */ - void *pMap = 0; /* Mapped memory region */ - -#if SQLITE_OS_WINRT - hMap = osCreateFileMappingFromApp(pShmNode->hFile.h, - NULL, PAGE_READWRITE, nByte, NULL - ); -#elif defined(SQLITE_WIN32_HAS_WIDE) - hMap = osCreateFileMappingW(pShmNode->hFile.h, - NULL, PAGE_READWRITE, 0, nByte, NULL - ); -#elif defined(SQLITE_WIN32_HAS_ANSI) - hMap = osCreateFileMappingA(pShmNode->hFile.h, - NULL, PAGE_READWRITE, 0, nByte, NULL - ); -#endif - OSTRACE(("SHM-MAP-CREATE pid=%lu, region=%d, size=%d, rc=%s\n", - osGetCurrentProcessId(), pShmNode->nRegion, nByte, - hMap ? "ok" : "failed")); - if( hMap ){ - int iOffset = pShmNode->nRegion*szRegion; - int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity; -#if SQLITE_OS_WINRT - pMap = osMapViewOfFileFromApp(hMap, FILE_MAP_WRITE | FILE_MAP_READ, - iOffset - iOffsetShift, szRegion + iOffsetShift - ); -#else - pMap = osMapViewOfFile(hMap, FILE_MAP_WRITE | FILE_MAP_READ, - 0, iOffset - iOffsetShift, szRegion + iOffsetShift - ); -#endif - OSTRACE(("SHM-MAP-MAP pid=%lu, region=%d, offset=%d, size=%d, rc=%s\n", - osGetCurrentProcessId(), pShmNode->nRegion, iOffset, - szRegion, pMap ? "ok" : "failed")); - } - if( !pMap ){ - pShmNode->lastErrno = osGetLastError(); - rc = winLogError(SQLITE_IOERR_SHMMAP, pShmNode->lastErrno, - "winShmMap3", pDbFd->zPath); - if( hMap ) osCloseHandle(hMap); - goto shmpage_out; - } - - pShmNode->aRegion[pShmNode->nRegion].pMap = pMap; - pShmNode->aRegion[pShmNode->nRegion].hMap = hMap; - pShmNode->nRegion++; - } - } - -shmpage_out: - if( pShmNode->nRegion>iRegion ){ - int iOffset = iRegion*szRegion; - int iOffsetShift = iOffset % winSysInfo.dwAllocationGranularity; - char *p = (char *)pShmNode->aRegion[iRegion].pMap; - *pp = (void *)&p[iOffsetShift]; - }else{ - *pp = 0; - } - sqlite3_mutex_leave(pShmNode->mutex); - return rc; -} - -#else -# define winShmMap 0 -# define winShmLock 0 -# define winShmBarrier 0 -# define winShmUnmap 0 -#endif /* #ifndef SQLITE_OMIT_WAL */ - -/* -** Cleans up the mapped region of the specified file, if any. -*/ -#if SQLITE_MAX_MMAP_SIZE>0 -static int winUnmapfile(winFile *pFile){ - assert( pFile!=0 ); - OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, hMap=%p, pMapRegion=%p, " - "mmapSize=%lld, mmapSizeActual=%lld, mmapSizeMax=%lld\n", - osGetCurrentProcessId(), pFile, pFile->hMap, pFile->pMapRegion, - pFile->mmapSize, pFile->mmapSizeActual, pFile->mmapSizeMax)); - if( pFile->pMapRegion ){ - if( !osUnmapViewOfFile(pFile->pMapRegion) ){ - pFile->lastErrno = osGetLastError(); - OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, pMapRegion=%p, " - "rc=SQLITE_IOERR_MMAP\n", osGetCurrentProcessId(), pFile, - pFile->pMapRegion)); - return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno, - "winUnmapfile1", pFile->zPath); - } - pFile->pMapRegion = 0; - pFile->mmapSize = 0; - pFile->mmapSizeActual = 0; - } - if( pFile->hMap!=NULL ){ - if( !osCloseHandle(pFile->hMap) ){ - pFile->lastErrno = osGetLastError(); - OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, hMap=%p, rc=SQLITE_IOERR_MMAP\n", - osGetCurrentProcessId(), pFile, pFile->hMap)); - return winLogError(SQLITE_IOERR_MMAP, pFile->lastErrno, - "winUnmapfile2", pFile->zPath); - } - pFile->hMap = NULL; - } - OSTRACE(("UNMAP-FILE pid=%lu, pFile=%p, rc=SQLITE_OK\n", - osGetCurrentProcessId(), pFile)); - return SQLITE_OK; -} - -/* -** Memory map or remap the file opened by file-descriptor pFd (if the file -** is already mapped, the existing mapping is replaced by the new). Or, if -** there already exists a mapping for this file, and there are still -** outstanding xFetch() references to it, this function is a no-op. -** -** If parameter nByte is non-negative, then it is the requested size of -** the mapping to create. Otherwise, if nByte is less than zero, then the -** requested size is the size of the file on disk. The actual size of the -** created mapping is either the requested size or the value configured -** using SQLITE_FCNTL_MMAP_SIZE, whichever is smaller. -** -** SQLITE_OK is returned if no error occurs (even if the mapping is not -** recreated as a result of outstanding references) or an SQLite error -** code otherwise. -*/ -static int winMapfile(winFile *pFd, sqlite3_int64 nByte){ - sqlite3_int64 nMap = nByte; - int rc; - - assert( nMap>=0 || pFd->nFetchOut==0 ); - OSTRACE(("MAP-FILE pid=%lu, pFile=%p, size=%lld\n", - osGetCurrentProcessId(), pFd, nByte)); - - if( pFd->nFetchOut>0 ) return SQLITE_OK; - - if( nMap<0 ){ - rc = winFileSize((sqlite3_file*)pFd, &nMap); - if( rc ){ - OSTRACE(("MAP-FILE pid=%lu, pFile=%p, rc=SQLITE_IOERR_FSTAT\n", - osGetCurrentProcessId(), pFd)); - return SQLITE_IOERR_FSTAT; - } - } - if( nMap>pFd->mmapSizeMax ){ - nMap = pFd->mmapSizeMax; - } - nMap &= ~(sqlite3_int64)(winSysInfo.dwPageSize - 1); - - if( nMap==0 && pFd->mmapSize>0 ){ - winUnmapfile(pFd); - } - if( nMap!=pFd->mmapSize ){ - void *pNew = 0; - DWORD protect = PAGE_READONLY; - DWORD flags = FILE_MAP_READ; - - winUnmapfile(pFd); - if( (pFd->ctrlFlags & WINFILE_RDONLY)==0 ){ - protect = PAGE_READWRITE; - flags |= FILE_MAP_WRITE; - } -#if SQLITE_OS_WINRT - pFd->hMap = osCreateFileMappingFromApp(pFd->h, NULL, protect, nMap, NULL); -#elif defined(SQLITE_WIN32_HAS_WIDE) - pFd->hMap = osCreateFileMappingW(pFd->h, NULL, protect, - (DWORD)((nMap>>32) & 0xffffffff), - (DWORD)(nMap & 0xffffffff), NULL); -#elif defined(SQLITE_WIN32_HAS_ANSI) - pFd->hMap = osCreateFileMappingA(pFd->h, NULL, protect, - (DWORD)((nMap>>32) & 0xffffffff), - (DWORD)(nMap & 0xffffffff), NULL); -#endif - if( pFd->hMap==NULL ){ - pFd->lastErrno = osGetLastError(); - rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno, - "winMapfile1", pFd->zPath); - /* Log the error, but continue normal operation using xRead/xWrite */ - OSTRACE(("MAP-FILE-CREATE pid=%lu, pFile=%p, rc=%s\n", - osGetCurrentProcessId(), pFd, sqlite3ErrName(rc))); - return SQLITE_OK; - } - assert( (nMap % winSysInfo.dwPageSize)==0 ); - assert( sizeof(SIZE_T)==sizeof(sqlite3_int64) || nMap<=0xffffffff ); -#if SQLITE_OS_WINRT - pNew = osMapViewOfFileFromApp(pFd->hMap, flags, 0, (SIZE_T)nMap); -#else - pNew = osMapViewOfFile(pFd->hMap, flags, 0, 0, (SIZE_T)nMap); -#endif - if( pNew==NULL ){ - osCloseHandle(pFd->hMap); - pFd->hMap = NULL; - pFd->lastErrno = osGetLastError(); - rc = winLogError(SQLITE_IOERR_MMAP, pFd->lastErrno, - "winMapfile2", pFd->zPath); - /* Log the error, but continue normal operation using xRead/xWrite */ - OSTRACE(("MAP-FILE-MAP pid=%lu, pFile=%p, rc=%s\n", - osGetCurrentProcessId(), pFd, sqlite3ErrName(rc))); - return SQLITE_OK; - } - pFd->pMapRegion = pNew; - pFd->mmapSize = nMap; - pFd->mmapSizeActual = nMap; - } - - OSTRACE(("MAP-FILE pid=%lu, pFile=%p, rc=SQLITE_OK\n", - osGetCurrentProcessId(), pFd)); - return SQLITE_OK; -} -#endif /* SQLITE_MAX_MMAP_SIZE>0 */ - -/* -** If possible, return a pointer to a mapping of file fd starting at offset -** iOff. The mapping must be valid for at least nAmt bytes. -** -** If such a pointer can be obtained, store it in *pp and return SQLITE_OK. -** Or, if one cannot but no error occurs, set *pp to 0 and return SQLITE_OK. -** Finally, if an error does occur, return an SQLite error code. The final -** value of *pp is undefined in this case. -** -** If this function does return a pointer, the caller must eventually -** release the reference by calling winUnfetch(). -*/ -static int winFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){ -#if SQLITE_MAX_MMAP_SIZE>0 - winFile *pFd = (winFile*)fd; /* The underlying database file */ -#endif - *pp = 0; - - OSTRACE(("FETCH pid=%lu, pFile=%p, offset=%lld, amount=%d, pp=%p\n", - osGetCurrentProcessId(), fd, iOff, nAmt, pp)); - -#if SQLITE_MAX_MMAP_SIZE>0 - if( pFd->mmapSizeMax>0 ){ - if( pFd->pMapRegion==0 ){ - int rc = winMapfile(pFd, -1); - if( rc!=SQLITE_OK ){ - OSTRACE(("FETCH pid=%lu, pFile=%p, rc=%s\n", - osGetCurrentProcessId(), pFd, sqlite3ErrName(rc))); - return rc; - } - } - if( pFd->mmapSize >= iOff+nAmt ){ - *pp = &((u8 *)pFd->pMapRegion)[iOff]; - pFd->nFetchOut++; - } - } -#endif - - OSTRACE(("FETCH pid=%lu, pFile=%p, pp=%p, *pp=%p, rc=SQLITE_OK\n", - osGetCurrentProcessId(), fd, pp, *pp)); - return SQLITE_OK; -} - -/* -** If the third argument is non-NULL, then this function releases a -** reference obtained by an earlier call to winFetch(). The second -** argument passed to this function must be the same as the corresponding -** argument that was passed to the winFetch() invocation. -** -** Or, if the third argument is NULL, then this function is being called -** to inform the VFS layer that, according to POSIX, any existing mapping -** may now be invalid and should be unmapped. -*/ -static int winUnfetch(sqlite3_file *fd, i64 iOff, void *p){ -#if SQLITE_MAX_MMAP_SIZE>0 - winFile *pFd = (winFile*)fd; /* The underlying database file */ - - /* If p==0 (unmap the entire file) then there must be no outstanding - ** xFetch references. Or, if p!=0 (meaning it is an xFetch reference), - ** then there must be at least one outstanding. */ - assert( (p==0)==(pFd->nFetchOut==0) ); - - /* If p!=0, it must match the iOff value. */ - assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] ); - - OSTRACE(("UNFETCH pid=%lu, pFile=%p, offset=%lld, p=%p\n", - osGetCurrentProcessId(), pFd, iOff, p)); - - if( p ){ - pFd->nFetchOut--; - }else{ - /* FIXME: If Windows truly always prevents truncating or deleting a - ** file while a mapping is held, then the following winUnmapfile() call - ** is unnecessary can can be omitted - potentially improving - ** performance. */ - winUnmapfile(pFd); - } - - assert( pFd->nFetchOut>=0 ); -#endif - - OSTRACE(("UNFETCH pid=%lu, pFile=%p, rc=SQLITE_OK\n", - osGetCurrentProcessId(), fd)); - return SQLITE_OK; -} - -/* -** Here ends the implementation of all sqlite3_file methods. -** -********************** End sqlite3_file Methods ******************************* -******************************************************************************/ - -/* -** This vector defines all the methods that can operate on an -** sqlite3_file for win32. -*/ -static const sqlite3_io_methods winIoMethod = { - 3, /* iVersion */ - winClose, /* xClose */ - winRead, /* xRead */ - winWrite, /* xWrite */ - winTruncate, /* xTruncate */ - winSync, /* xSync */ - winFileSize, /* xFileSize */ - winLock, /* xLock */ - winUnlock, /* xUnlock */ - winCheckReservedLock, /* xCheckReservedLock */ - winFileControl, /* xFileControl */ - winSectorSize, /* xSectorSize */ - winDeviceCharacteristics, /* xDeviceCharacteristics */ - winShmMap, /* xShmMap */ - winShmLock, /* xShmLock */ - winShmBarrier, /* xShmBarrier */ - winShmUnmap, /* xShmUnmap */ - winFetch, /* xFetch */ - winUnfetch /* xUnfetch */ -}; - -/**************************************************************************** -**************************** sqlite3_vfs methods **************************** -** -** This division contains the implementation of methods on the -** sqlite3_vfs object. -*/ - -#if defined(__CYGWIN__) -/* -** Convert a filename from whatever the underlying operating system -** supports for filenames into UTF-8. Space to hold the result is -** obtained from malloc and must be freed by the calling function. -*/ -static char *winConvertToUtf8Filename(const void *zFilename){ - char *zConverted = 0; - if( osIsNT() ){ - zConverted = winUnicodeToUtf8(zFilename); - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - zConverted = sqlite3_win32_mbcs_to_utf8(zFilename); - } -#endif - /* caller will handle out of memory */ - return zConverted; -} -#endif - -/* -** Convert a UTF-8 filename into whatever form the underlying -** operating system wants filenames in. Space to hold the result -** is obtained from malloc and must be freed by the calling -** function. -*/ -static void *winConvertFromUtf8Filename(const char *zFilename){ - void *zConverted = 0; - if( osIsNT() ){ - zConverted = winUtf8ToUnicode(zFilename); - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - zConverted = sqlite3_win32_utf8_to_mbcs(zFilename); - } -#endif - /* caller will handle out of memory */ - return zConverted; -} - -/* -** This function returns non-zero if the specified UTF-8 string buffer -** ends with a directory separator character or one was successfully -** added to it. -*/ -static int winMakeEndInDirSep(int nBuf, char *zBuf){ - if( zBuf ){ - int nLen = sqlite3Strlen30(zBuf); - if( nLen>0 ){ - if( winIsDirSep(zBuf[nLen-1]) ){ - return 1; - }else if( nLen+1mxPathname; nBuf = nMax + 2; - zBuf = sqlite3MallocZero( nBuf ); - if( !zBuf ){ - OSTRACE(("TEMP-FILENAME rc=SQLITE_IOERR_NOMEM\n")); - return SQLITE_IOERR_NOMEM; - } - - /* Figure out the effective temporary directory. First, check if one - ** has been explicitly set by the application; otherwise, use the one - ** configured by the operating system. - */ - nDir = nMax - (nPre + 15); - assert( nDir>0 ); - if( sqlite3_temp_directory ){ - int nDirLen = sqlite3Strlen30(sqlite3_temp_directory); - if( nDirLen>0 ){ - if( !winIsDirSep(sqlite3_temp_directory[nDirLen-1]) ){ - nDirLen++; - } - if( nDirLen>nDir ){ - sqlite3_free(zBuf); - OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n")); - return winLogError(SQLITE_ERROR, 0, "winGetTempname1", 0); - } - sqlite3_snprintf(nMax, zBuf, "%s", sqlite3_temp_directory); - } - } -#if defined(__CYGWIN__) - else{ - static const char *azDirs[] = { - 0, /* getenv("SQLITE_TMPDIR") */ - 0, /* getenv("TMPDIR") */ - 0, /* getenv("TMP") */ - 0, /* getenv("TEMP") */ - 0, /* getenv("USERPROFILE") */ - "/var/tmp", - "/usr/tmp", - "/tmp", - ".", - 0 /* List terminator */ - }; - unsigned int i; - const char *zDir = 0; - - if( !azDirs[0] ) azDirs[0] = getenv("SQLITE_TMPDIR"); - if( !azDirs[1] ) azDirs[1] = getenv("TMPDIR"); - if( !azDirs[2] ) azDirs[2] = getenv("TMP"); - if( !azDirs[3] ) azDirs[3] = getenv("TEMP"); - if( !azDirs[4] ) azDirs[4] = getenv("USERPROFILE"); - for(i=0; i/etilqs_XXXXXXXXXXXXXXX\0\0" - ** - ** If not, return SQLITE_ERROR. The number 17 is used here in order to - ** account for the space used by the 15 character random suffix and the - ** two trailing NUL characters. The final directory separator character - ** has already added if it was not already present. - */ - nLen = sqlite3Strlen30(zBuf); - if( (nLen + nPre + 17) > nBuf ){ - sqlite3_free(zBuf); - OSTRACE(("TEMP-FILENAME rc=SQLITE_ERROR\n")); - return winLogError(SQLITE_ERROR, 0, "winGetTempname5", 0); - } - - sqlite3_snprintf(nBuf-16-nLen, zBuf+nLen, SQLITE_TEMP_FILE_PREFIX); - - j = sqlite3Strlen30(zBuf); - sqlite3_randomness(15, &zBuf[j]); - for(i=0; i<15; i++, j++){ - zBuf[j] = (char)zChars[ ((unsigned char)zBuf[j])%(sizeof(zChars)-1) ]; - } - zBuf[j] = 0; - zBuf[j+1] = 0; - *pzBuf = zBuf; - - OSTRACE(("TEMP-FILENAME name=%s, rc=SQLITE_OK\n", zBuf)); - return SQLITE_OK; -} - -/* -** Return TRUE if the named file is really a directory. Return false if -** it is something other than a directory, or if there is any kind of memory -** allocation failure. -*/ -static int winIsDir(const void *zConverted){ - DWORD attr; - int rc = 0; - DWORD lastErrno; - - if( osIsNT() ){ - int cnt = 0; - WIN32_FILE_ATTRIBUTE_DATA sAttrData; - memset(&sAttrData, 0, sizeof(sAttrData)); - while( !(rc = osGetFileAttributesExW((LPCWSTR)zConverted, - GetFileExInfoStandard, - &sAttrData)) && winRetryIoerr(&cnt, &lastErrno) ){} - if( !rc ){ - return 0; /* Invalid name? */ - } - attr = sAttrData.dwFileAttributes; -#if SQLITE_OS_WINCE==0 - }else{ - attr = osGetFileAttributesA((char*)zConverted); -#endif - } - return (attr!=INVALID_FILE_ATTRIBUTES) && (attr&FILE_ATTRIBUTE_DIRECTORY); -} - -/* -** Open a file. -*/ -static int winOpen( - sqlite3_vfs *pVfs, /* Used to get maximum path name length */ - const char *zName, /* Name of the file (UTF-8) */ - sqlite3_file *id, /* Write the SQLite file handle here */ - int flags, /* Open mode flags */ - int *pOutFlags /* Status return flags */ -){ - HANDLE h; - DWORD lastErrno = 0; - DWORD dwDesiredAccess; - DWORD dwShareMode; - DWORD dwCreationDisposition; - DWORD dwFlagsAndAttributes = 0; -#if SQLITE_OS_WINCE - int isTemp = 0; -#endif - winFile *pFile = (winFile*)id; - void *zConverted; /* Filename in OS encoding */ - const char *zUtf8Name = zName; /* Filename in UTF-8 encoding */ - int cnt = 0; - - /* If argument zPath is a NULL pointer, this function is required to open - ** a temporary file. Use this buffer to store the file name in. - */ - char *zTmpname = 0; /* For temporary filename, if necessary. */ - - int rc = SQLITE_OK; /* Function Return Code */ -#if !defined(NDEBUG) || SQLITE_OS_WINCE - int eType = flags&0xFFFFFF00; /* Type of file to open */ -#endif - - int isExclusive = (flags & SQLITE_OPEN_EXCLUSIVE); - int isDelete = (flags & SQLITE_OPEN_DELETEONCLOSE); - int isCreate = (flags & SQLITE_OPEN_CREATE); - int isReadonly = (flags & SQLITE_OPEN_READONLY); - int isReadWrite = (flags & SQLITE_OPEN_READWRITE); - -#ifndef NDEBUG - int isOpenJournal = (isCreate && ( - eType==SQLITE_OPEN_MASTER_JOURNAL - || eType==SQLITE_OPEN_MAIN_JOURNAL - || eType==SQLITE_OPEN_WAL - )); -#endif - - OSTRACE(("OPEN name=%s, pFile=%p, flags=%x, pOutFlags=%p\n", - zUtf8Name, id, flags, pOutFlags)); - - /* Check the following statements are true: - ** - ** (a) Exactly one of the READWRITE and READONLY flags must be set, and - ** (b) if CREATE is set, then READWRITE must also be set, and - ** (c) if EXCLUSIVE is set, then CREATE must also be set. - ** (d) if DELETEONCLOSE is set, then CREATE must also be set. - */ - assert((isReadonly==0 || isReadWrite==0) && (isReadWrite || isReadonly)); - assert(isCreate==0 || isReadWrite); - assert(isExclusive==0 || isCreate); - assert(isDelete==0 || isCreate); - - /* The main DB, main journal, WAL file and master journal are never - ** automatically deleted. Nor are they ever temporary files. */ - assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_DB ); - assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MAIN_JOURNAL ); - assert( (!isDelete && zName) || eType!=SQLITE_OPEN_MASTER_JOURNAL ); - assert( (!isDelete && zName) || eType!=SQLITE_OPEN_WAL ); - - /* Assert that the upper layer has set one of the "file-type" flags. */ - assert( eType==SQLITE_OPEN_MAIN_DB || eType==SQLITE_OPEN_TEMP_DB - || eType==SQLITE_OPEN_MAIN_JOURNAL || eType==SQLITE_OPEN_TEMP_JOURNAL - || eType==SQLITE_OPEN_SUBJOURNAL || eType==SQLITE_OPEN_MASTER_JOURNAL - || eType==SQLITE_OPEN_TRANSIENT_DB || eType==SQLITE_OPEN_WAL - ); - - assert( pFile!=0 ); - memset(pFile, 0, sizeof(winFile)); - pFile->h = INVALID_HANDLE_VALUE; - -#if SQLITE_OS_WINRT - if( !zUtf8Name && !sqlite3_temp_directory ){ - sqlite3_log(SQLITE_ERROR, - "sqlite3_temp_directory variable should be set for WinRT"); - } -#endif - - /* If the second argument to this function is NULL, generate a - ** temporary file name to use - */ - if( !zUtf8Name ){ - assert( isDelete && !isOpenJournal ); - rc = winGetTempname(pVfs, &zTmpname); - if( rc!=SQLITE_OK ){ - OSTRACE(("OPEN name=%s, rc=%s", zUtf8Name, sqlite3ErrName(rc))); - return rc; - } - zUtf8Name = zTmpname; - } - - /* Database filenames are double-zero terminated if they are not - ** URIs with parameters. Hence, they can always be passed into - ** sqlite3_uri_parameter(). - */ - assert( (eType!=SQLITE_OPEN_MAIN_DB) || (flags & SQLITE_OPEN_URI) || - zUtf8Name[sqlite3Strlen30(zUtf8Name)+1]==0 ); - - /* Convert the filename to the system encoding. */ - zConverted = winConvertFromUtf8Filename(zUtf8Name); - if( zConverted==0 ){ - sqlite3_free(zTmpname); - OSTRACE(("OPEN name=%s, rc=SQLITE_IOERR_NOMEM", zUtf8Name)); - return SQLITE_IOERR_NOMEM; - } - - if( winIsDir(zConverted) ){ - sqlite3_free(zConverted); - sqlite3_free(zTmpname); - OSTRACE(("OPEN name=%s, rc=SQLITE_CANTOPEN_ISDIR", zUtf8Name)); - return SQLITE_CANTOPEN_ISDIR; - } - - if( isReadWrite ){ - dwDesiredAccess = GENERIC_READ | GENERIC_WRITE; - }else{ - dwDesiredAccess = GENERIC_READ; - } - - /* SQLITE_OPEN_EXCLUSIVE is used to make sure that a new file is - ** created. SQLite doesn't use it to indicate "exclusive access" - ** as it is usually understood. - */ - if( isExclusive ){ - /* Creates a new file, only if it does not already exist. */ - /* If the file exists, it fails. */ - dwCreationDisposition = CREATE_NEW; - }else if( isCreate ){ - /* Open existing file, or create if it doesn't exist */ - dwCreationDisposition = OPEN_ALWAYS; - }else{ - /* Opens a file, only if it exists. */ - dwCreationDisposition = OPEN_EXISTING; - } - - dwShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE; - - if( isDelete ){ -#if SQLITE_OS_WINCE - dwFlagsAndAttributes = FILE_ATTRIBUTE_HIDDEN; - isTemp = 1; -#else - dwFlagsAndAttributes = FILE_ATTRIBUTE_TEMPORARY - | FILE_ATTRIBUTE_HIDDEN - | FILE_FLAG_DELETE_ON_CLOSE; -#endif - }else{ - dwFlagsAndAttributes = FILE_ATTRIBUTE_NORMAL; - } - /* Reports from the internet are that performance is always - ** better if FILE_FLAG_RANDOM_ACCESS is used. Ticket #2699. */ -#if SQLITE_OS_WINCE - dwFlagsAndAttributes |= FILE_FLAG_RANDOM_ACCESS; -#endif - - if( osIsNT() ){ -#if SQLITE_OS_WINRT - CREATEFILE2_EXTENDED_PARAMETERS extendedParameters; - extendedParameters.dwSize = sizeof(CREATEFILE2_EXTENDED_PARAMETERS); - extendedParameters.dwFileAttributes = - dwFlagsAndAttributes & FILE_ATTRIBUTE_MASK; - extendedParameters.dwFileFlags = dwFlagsAndAttributes & FILE_FLAG_MASK; - extendedParameters.dwSecurityQosFlags = SECURITY_ANONYMOUS; - extendedParameters.lpSecurityAttributes = NULL; - extendedParameters.hTemplateFile = NULL; - while( (h = osCreateFile2((LPCWSTR)zConverted, - dwDesiredAccess, - dwShareMode, - dwCreationDisposition, - &extendedParameters))==INVALID_HANDLE_VALUE && - winRetryIoerr(&cnt, &lastErrno) ){ - /* Noop */ - } -#else - while( (h = osCreateFileW((LPCWSTR)zConverted, - dwDesiredAccess, - dwShareMode, NULL, - dwCreationDisposition, - dwFlagsAndAttributes, - NULL))==INVALID_HANDLE_VALUE && - winRetryIoerr(&cnt, &lastErrno) ){ - /* Noop */ - } -#endif - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - while( (h = osCreateFileA((LPCSTR)zConverted, - dwDesiredAccess, - dwShareMode, NULL, - dwCreationDisposition, - dwFlagsAndAttributes, - NULL))==INVALID_HANDLE_VALUE && - winRetryIoerr(&cnt, &lastErrno) ){ - /* Noop */ - } - } -#endif - winLogIoerr(cnt); - - OSTRACE(("OPEN file=%p, name=%s, access=%lx, rc=%s\n", h, zUtf8Name, - dwDesiredAccess, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); - - if( h==INVALID_HANDLE_VALUE ){ - pFile->lastErrno = lastErrno; - winLogError(SQLITE_CANTOPEN, pFile->lastErrno, "winOpen", zUtf8Name); - sqlite3_free(zConverted); - sqlite3_free(zTmpname); - if( isReadWrite && !isExclusive ){ - return winOpen(pVfs, zName, id, - ((flags|SQLITE_OPEN_READONLY) & - ~(SQLITE_OPEN_CREATE|SQLITE_OPEN_READWRITE)), - pOutFlags); - }else{ - return SQLITE_CANTOPEN_BKPT; - } - } - - if( pOutFlags ){ - if( isReadWrite ){ - *pOutFlags = SQLITE_OPEN_READWRITE; - }else{ - *pOutFlags = SQLITE_OPEN_READONLY; - } - } - - OSTRACE(("OPEN file=%p, name=%s, access=%lx, pOutFlags=%p, *pOutFlags=%d, " - "rc=%s\n", h, zUtf8Name, dwDesiredAccess, pOutFlags, pOutFlags ? - *pOutFlags : 0, (h==INVALID_HANDLE_VALUE) ? "failed" : "ok")); - -#if SQLITE_OS_WINCE - if( isReadWrite && eType==SQLITE_OPEN_MAIN_DB - && (rc = winceCreateLock(zName, pFile))!=SQLITE_OK - ){ - osCloseHandle(h); - sqlite3_free(zConverted); - sqlite3_free(zTmpname); - OSTRACE(("OPEN-CE-LOCK name=%s, rc=%s\n", zName, sqlite3ErrName(rc))); - return rc; - } - if( isTemp ){ - pFile->zDeleteOnClose = zConverted; - }else -#endif - { - sqlite3_free(zConverted); - } - - sqlite3_free(zTmpname); - pFile->pMethod = &winIoMethod; - pFile->pVfs = pVfs; - pFile->h = h; - if( isReadonly ){ - pFile->ctrlFlags |= WINFILE_RDONLY; - } - if( sqlite3_uri_boolean(zName, "psow", SQLITE_POWERSAFE_OVERWRITE) ){ - pFile->ctrlFlags |= WINFILE_PSOW; - } - pFile->lastErrno = NO_ERROR; - pFile->zPath = zName; -#if SQLITE_MAX_MMAP_SIZE>0 - pFile->hMap = NULL; - pFile->pMapRegion = 0; - pFile->mmapSize = 0; - pFile->mmapSizeActual = 0; - pFile->mmapSizeMax = sqlite3GlobalConfig.szMmap; -#endif - - OpenCounter(+1); - return rc; -} - -/* -** Delete the named file. -** -** Note that Windows does not allow a file to be deleted if some other -** process has it open. Sometimes a virus scanner or indexing program -** will open a journal file shortly after it is created in order to do -** whatever it does. While this other process is holding the -** file open, we will be unable to delete it. To work around this -** problem, we delay 100 milliseconds and try to delete again. Up -** to MX_DELETION_ATTEMPTs deletion attempts are run before giving -** up and returning an error. -*/ -static int winDelete( - sqlite3_vfs *pVfs, /* Not used on win32 */ - const char *zFilename, /* Name of file to delete */ - int syncDir /* Not used on win32 */ -){ - int cnt = 0; - int rc; - DWORD attr; - DWORD lastErrno = 0; - void *zConverted; - UNUSED_PARAMETER(pVfs); - UNUSED_PARAMETER(syncDir); - - SimulateIOError(return SQLITE_IOERR_DELETE); - OSTRACE(("DELETE name=%s, syncDir=%d\n", zFilename, syncDir)); - - zConverted = winConvertFromUtf8Filename(zFilename); - if( zConverted==0 ){ - OSTRACE(("DELETE name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename)); - return SQLITE_IOERR_NOMEM; - } - if( osIsNT() ){ - do { -#if SQLITE_OS_WINRT - WIN32_FILE_ATTRIBUTE_DATA sAttrData; - memset(&sAttrData, 0, sizeof(sAttrData)); - if ( osGetFileAttributesExW(zConverted, GetFileExInfoStandard, - &sAttrData) ){ - attr = sAttrData.dwFileAttributes; - }else{ - lastErrno = osGetLastError(); - if( lastErrno==ERROR_FILE_NOT_FOUND - || lastErrno==ERROR_PATH_NOT_FOUND ){ - rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */ - }else{ - rc = SQLITE_ERROR; - } - break; - } -#else - attr = osGetFileAttributesW(zConverted); -#endif - if ( attr==INVALID_FILE_ATTRIBUTES ){ - lastErrno = osGetLastError(); - if( lastErrno==ERROR_FILE_NOT_FOUND - || lastErrno==ERROR_PATH_NOT_FOUND ){ - rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */ - }else{ - rc = SQLITE_ERROR; - } - break; - } - if ( attr&FILE_ATTRIBUTE_DIRECTORY ){ - rc = SQLITE_ERROR; /* Files only. */ - break; - } - if ( osDeleteFileW(zConverted) ){ - rc = SQLITE_OK; /* Deleted OK. */ - break; - } - if ( !winRetryIoerr(&cnt, &lastErrno) ){ - rc = SQLITE_ERROR; /* No more retries. */ - break; - } - } while(1); - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - do { - attr = osGetFileAttributesA(zConverted); - if ( attr==INVALID_FILE_ATTRIBUTES ){ - lastErrno = osGetLastError(); - if( lastErrno==ERROR_FILE_NOT_FOUND - || lastErrno==ERROR_PATH_NOT_FOUND ){ - rc = SQLITE_IOERR_DELETE_NOENT; /* Already gone? */ - }else{ - rc = SQLITE_ERROR; - } - break; - } - if ( attr&FILE_ATTRIBUTE_DIRECTORY ){ - rc = SQLITE_ERROR; /* Files only. */ - break; - } - if ( osDeleteFileA(zConverted) ){ - rc = SQLITE_OK; /* Deleted OK. */ - break; - } - if ( !winRetryIoerr(&cnt, &lastErrno) ){ - rc = SQLITE_ERROR; /* No more retries. */ - break; - } - } while(1); - } -#endif - if( rc && rc!=SQLITE_IOERR_DELETE_NOENT ){ - rc = winLogError(SQLITE_IOERR_DELETE, lastErrno, "winDelete", zFilename); - }else{ - winLogIoerr(cnt); - } - sqlite3_free(zConverted); - OSTRACE(("DELETE name=%s, rc=%s\n", zFilename, sqlite3ErrName(rc))); - return rc; -} - -/* -** Check the existence and status of a file. -*/ -static int winAccess( - sqlite3_vfs *pVfs, /* Not used on win32 */ - const char *zFilename, /* Name of file to check */ - int flags, /* Type of test to make on this file */ - int *pResOut /* OUT: Result */ -){ - DWORD attr; - int rc = 0; - DWORD lastErrno = 0; - void *zConverted; - UNUSED_PARAMETER(pVfs); - - SimulateIOError( return SQLITE_IOERR_ACCESS; ); - OSTRACE(("ACCESS name=%s, flags=%x, pResOut=%p\n", - zFilename, flags, pResOut)); - - zConverted = winConvertFromUtf8Filename(zFilename); - if( zConverted==0 ){ - OSTRACE(("ACCESS name=%s, rc=SQLITE_IOERR_NOMEM\n", zFilename)); - return SQLITE_IOERR_NOMEM; - } - if( osIsNT() ){ - int cnt = 0; - WIN32_FILE_ATTRIBUTE_DATA sAttrData; - memset(&sAttrData, 0, sizeof(sAttrData)); - while( !(rc = osGetFileAttributesExW((LPCWSTR)zConverted, - GetFileExInfoStandard, - &sAttrData)) && winRetryIoerr(&cnt, &lastErrno) ){} - if( rc ){ - /* For an SQLITE_ACCESS_EXISTS query, treat a zero-length file - ** as if it does not exist. - */ - if( flags==SQLITE_ACCESS_EXISTS - && sAttrData.nFileSizeHigh==0 - && sAttrData.nFileSizeLow==0 ){ - attr = INVALID_FILE_ATTRIBUTES; - }else{ - attr = sAttrData.dwFileAttributes; - } - }else{ - winLogIoerr(cnt); - if( lastErrno!=ERROR_FILE_NOT_FOUND && lastErrno!=ERROR_PATH_NOT_FOUND ){ - sqlite3_free(zConverted); - return winLogError(SQLITE_IOERR_ACCESS, lastErrno, "winAccess", - zFilename); - }else{ - attr = INVALID_FILE_ATTRIBUTES; - } - } - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - attr = osGetFileAttributesA((char*)zConverted); - } -#endif - sqlite3_free(zConverted); - switch( flags ){ - case SQLITE_ACCESS_READ: - case SQLITE_ACCESS_EXISTS: - rc = attr!=INVALID_FILE_ATTRIBUTES; - break; - case SQLITE_ACCESS_READWRITE: - rc = attr!=INVALID_FILE_ATTRIBUTES && - (attr & FILE_ATTRIBUTE_READONLY)==0; - break; - default: - assert(!"Invalid flags argument"); - } - *pResOut = rc; - OSTRACE(("ACCESS name=%s, pResOut=%p, *pResOut=%d, rc=SQLITE_OK\n", - zFilename, pResOut, *pResOut)); - return SQLITE_OK; -} - -/* -** Returns non-zero if the specified path name starts with a drive letter -** followed by a colon character. -*/ -static BOOL winIsDriveLetterAndColon( - const char *zPathname -){ - return ( sqlite3Isalpha(zPathname[0]) && zPathname[1]==':' ); -} - -/* -** Returns non-zero if the specified path name should be used verbatim. If -** non-zero is returned from this function, the calling function must simply -** use the provided path name verbatim -OR- resolve it into a full path name -** using the GetFullPathName Win32 API function (if available). -*/ -static BOOL winIsVerbatimPathname( - const char *zPathname -){ - /* - ** If the path name starts with a forward slash or a backslash, it is either - ** a legal UNC name, a volume relative path, or an absolute path name in the - ** "Unix" format on Windows. There is no easy way to differentiate between - ** the final two cases; therefore, we return the safer return value of TRUE - ** so that callers of this function will simply use it verbatim. - */ - if ( winIsDirSep(zPathname[0]) ){ - return TRUE; - } - - /* - ** If the path name starts with a letter and a colon it is either a volume - ** relative path or an absolute path. Callers of this function must not - ** attempt to treat it as a relative path name (i.e. they should simply use - ** it verbatim). - */ - if ( winIsDriveLetterAndColon(zPathname) ){ - return TRUE; - } - - /* - ** If we get to this point, the path name should almost certainly be a purely - ** relative one (i.e. not a UNC name, not absolute, and not volume relative). - */ - return FALSE; -} - -/* -** Turn a relative pathname into a full pathname. Write the full -** pathname into zOut[]. zOut[] will be at least pVfs->mxPathname -** bytes in size. -*/ -static int winFullPathname( - sqlite3_vfs *pVfs, /* Pointer to vfs object */ - const char *zRelative, /* Possibly relative input path */ - int nFull, /* Size of output buffer in bytes */ - char *zFull /* Output buffer */ -){ - -#if defined(__CYGWIN__) - SimulateIOError( return SQLITE_ERROR ); - UNUSED_PARAMETER(nFull); - assert( nFull>=pVfs->mxPathname ); - if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ - /* - ** NOTE: We are dealing with a relative path name and the data - ** directory has been set. Therefore, use it as the basis - ** for converting the relative path name to an absolute - ** one by prepending the data directory and a slash. - */ - char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); - if( !zOut ){ - return SQLITE_IOERR_NOMEM; - } - if( cygwin_conv_path( - (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A) | - CCP_RELATIVE, zRelative, zOut, pVfs->mxPathname+1)<0 ){ - sqlite3_free(zOut); - return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno, - "winFullPathname1", zRelative); - }else{ - char *zUtf8 = winConvertToUtf8Filename(zOut); - if( !zUtf8 ){ - sqlite3_free(zOut); - return SQLITE_IOERR_NOMEM; - } - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", - sqlite3_data_directory, winGetDirSep(), zUtf8); - sqlite3_free(zUtf8); - sqlite3_free(zOut); - } - }else{ - char *zOut = sqlite3MallocZero( pVfs->mxPathname+1 ); - if( !zOut ){ - return SQLITE_IOERR_NOMEM; - } - if( cygwin_conv_path( - (osIsNT() ? CCP_POSIX_TO_WIN_W : CCP_POSIX_TO_WIN_A), - zRelative, zOut, pVfs->mxPathname+1)<0 ){ - sqlite3_free(zOut); - return winLogError(SQLITE_CANTOPEN_CONVPATH, (DWORD)errno, - "winFullPathname2", zRelative); - }else{ - char *zUtf8 = winConvertToUtf8Filename(zOut); - if( !zUtf8 ){ - sqlite3_free(zOut); - return SQLITE_IOERR_NOMEM; - } - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zUtf8); - sqlite3_free(zUtf8); - sqlite3_free(zOut); - } - } - return SQLITE_OK; -#endif - -#if (SQLITE_OS_WINCE || SQLITE_OS_WINRT) && !defined(__CYGWIN__) - SimulateIOError( return SQLITE_ERROR ); - /* WinCE has no concept of a relative pathname, or so I am told. */ - /* WinRT has no way to convert a relative path to an absolute one. */ - if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ - /* - ** NOTE: We are dealing with a relative path name and the data - ** directory has been set. Therefore, use it as the basis - ** for converting the relative path name to an absolute - ** one by prepending the data directory and a backslash. - */ - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", - sqlite3_data_directory, winGetDirSep(), zRelative); - }else{ - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zRelative); - } - return SQLITE_OK; -#endif - -#if !SQLITE_OS_WINCE && !SQLITE_OS_WINRT && !defined(__CYGWIN__) - DWORD nByte; - void *zConverted; - char *zOut; - - /* If this path name begins with "/X:", where "X" is any alphabetic - ** character, discard the initial "/" from the pathname. - */ - if( zRelative[0]=='/' && winIsDriveLetterAndColon(zRelative+1) ){ - zRelative++; - } - - /* It's odd to simulate an io-error here, but really this is just - ** using the io-error infrastructure to test that SQLite handles this - ** function failing. This function could fail if, for example, the - ** current working directory has been unlinked. - */ - SimulateIOError( return SQLITE_ERROR ); - if ( sqlite3_data_directory && !winIsVerbatimPathname(zRelative) ){ - /* - ** NOTE: We are dealing with a relative path name and the data - ** directory has been set. Therefore, use it as the basis - ** for converting the relative path name to an absolute - ** one by prepending the data directory and a backslash. - */ - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s%c%s", - sqlite3_data_directory, winGetDirSep(), zRelative); - return SQLITE_OK; - } - zConverted = winConvertFromUtf8Filename(zRelative); - if( zConverted==0 ){ - return SQLITE_IOERR_NOMEM; - } - if( osIsNT() ){ - LPWSTR zTemp; - nByte = osGetFullPathNameW((LPCWSTR)zConverted, 0, 0, 0); - if( nByte==0 ){ - sqlite3_free(zConverted); - return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), - "winFullPathname1", zRelative); - } - nByte += 3; - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); - if( zTemp==0 ){ - sqlite3_free(zConverted); - return SQLITE_IOERR_NOMEM; - } - nByte = osGetFullPathNameW((LPCWSTR)zConverted, nByte, zTemp, 0); - if( nByte==0 ){ - sqlite3_free(zConverted); - sqlite3_free(zTemp); - return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), - "winFullPathname2", zRelative); - } - sqlite3_free(zConverted); - zOut = winUnicodeToUtf8(zTemp); - sqlite3_free(zTemp); - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - char *zTemp; - nByte = osGetFullPathNameA((char*)zConverted, 0, 0, 0); - if( nByte==0 ){ - sqlite3_free(zConverted); - return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), - "winFullPathname3", zRelative); - } - nByte += 3; - zTemp = sqlite3MallocZero( nByte*sizeof(zTemp[0]) ); - if( zTemp==0 ){ - sqlite3_free(zConverted); - return SQLITE_IOERR_NOMEM; - } - nByte = osGetFullPathNameA((char*)zConverted, nByte, zTemp, 0); - if( nByte==0 ){ - sqlite3_free(zConverted); - sqlite3_free(zTemp); - return winLogError(SQLITE_CANTOPEN_FULLPATH, osGetLastError(), - "winFullPathname4", zRelative); - } - sqlite3_free(zConverted); - zOut = sqlite3_win32_mbcs_to_utf8(zTemp); - sqlite3_free(zTemp); - } -#endif - if( zOut ){ - sqlite3_snprintf(MIN(nFull, pVfs->mxPathname), zFull, "%s", zOut); - sqlite3_free(zOut); - return SQLITE_OK; - }else{ - return SQLITE_IOERR_NOMEM; - } -#endif -} - -#ifndef SQLITE_OMIT_LOAD_EXTENSION -/* -** Interfaces for opening a shared library, finding entry points -** within the shared library, and closing the shared library. -*/ -/* -** Interfaces for opening a shared library, finding entry points -** within the shared library, and closing the shared library. -*/ -static void *winDlOpen(sqlite3_vfs *pVfs, const char *zFilename){ - HANDLE h; - void *zConverted = winConvertFromUtf8Filename(zFilename); - UNUSED_PARAMETER(pVfs); - if( zConverted==0 ){ - return 0; - } - if( osIsNT() ){ -#if SQLITE_OS_WINRT - h = osLoadPackagedLibrary((LPCWSTR)zConverted, 0); -#else - h = osLoadLibraryW((LPCWSTR)zConverted); -#endif - } -#ifdef SQLITE_WIN32_HAS_ANSI - else{ - h = osLoadLibraryA((char*)zConverted); - } -#endif - sqlite3_free(zConverted); - return (void*)h; -} -static void winDlError(sqlite3_vfs *pVfs, int nBuf, char *zBufOut){ - UNUSED_PARAMETER(pVfs); - winGetLastErrorMsg(osGetLastError(), nBuf, zBufOut); -} -static void (*winDlSym(sqlite3_vfs *pVfs,void *pH,const char *zSym))(void){ - UNUSED_PARAMETER(pVfs); - return (void(*)(void))osGetProcAddressA((HANDLE)pH, zSym); -} -static void winDlClose(sqlite3_vfs *pVfs, void *pHandle){ - UNUSED_PARAMETER(pVfs); - osFreeLibrary((HANDLE)pHandle); -} -#else /* if SQLITE_OMIT_LOAD_EXTENSION is defined: */ - #define winDlOpen 0 - #define winDlError 0 - #define winDlSym 0 - #define winDlClose 0 -#endif - - -/* -** Write up to nBuf bytes of randomness into zBuf. -*/ -static int winRandomness(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ - int n = 0; - UNUSED_PARAMETER(pVfs); -#if defined(SQLITE_TEST) - n = nBuf; - memset(zBuf, 0, nBuf); -#else - if( sizeof(SYSTEMTIME)<=nBuf-n ){ - SYSTEMTIME x; - osGetSystemTime(&x); - memcpy(&zBuf[n], &x, sizeof(x)); - n += sizeof(x); - } - if( sizeof(DWORD)<=nBuf-n ){ - DWORD pid = osGetCurrentProcessId(); - memcpy(&zBuf[n], &pid, sizeof(pid)); - n += sizeof(pid); - } -#if SQLITE_OS_WINRT - if( sizeof(ULONGLONG)<=nBuf-n ){ - ULONGLONG cnt = osGetTickCount64(); - memcpy(&zBuf[n], &cnt, sizeof(cnt)); - n += sizeof(cnt); - } -#else - if( sizeof(DWORD)<=nBuf-n ){ - DWORD cnt = osGetTickCount(); - memcpy(&zBuf[n], &cnt, sizeof(cnt)); - n += sizeof(cnt); - } -#endif - if( sizeof(LARGE_INTEGER)<=nBuf-n ){ - LARGE_INTEGER i; - osQueryPerformanceCounter(&i); - memcpy(&zBuf[n], &i, sizeof(i)); - n += sizeof(i); - } -#endif - return n; -} - - -/* -** Sleep for a little while. Return the amount of time slept. -*/ -static int winSleep(sqlite3_vfs *pVfs, int microsec){ - sqlite3_win32_sleep((microsec+999)/1000); - UNUSED_PARAMETER(pVfs); - return ((microsec+999)/1000)*1000; -} - -/* -** The following variable, if set to a non-zero value, is interpreted as -** the number of seconds since 1970 and is used to set the result of -** sqlite3OsCurrentTime() during testing. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_current_time = 0; /* Fake system time in seconds since 1970. */ -#endif - -/* -** Find the current time (in Universal Coordinated Time). Write into *piNow -** the current time and date as a Julian Day number times 86_400_000. In -** other words, write into *piNow the number of milliseconds since the Julian -** epoch of noon in Greenwich on November 24, 4714 B.C according to the -** proleptic Gregorian calendar. -** -** On success, return SQLITE_OK. Return SQLITE_ERROR if the time and date -** cannot be found. -*/ -static int winCurrentTimeInt64(sqlite3_vfs *pVfs, sqlite3_int64 *piNow){ - /* FILETIME structure is a 64-bit value representing the number of - 100-nanosecond intervals since January 1, 1601 (= JD 2305813.5). - */ - FILETIME ft; - static const sqlite3_int64 winFiletimeEpoch = 23058135*(sqlite3_int64)8640000; -#ifdef SQLITE_TEST - static const sqlite3_int64 unixEpoch = 24405875*(sqlite3_int64)8640000; -#endif - /* 2^32 - to avoid use of LL and warnings in gcc */ - static const sqlite3_int64 max32BitValue = - (sqlite3_int64)2000000000 + (sqlite3_int64)2000000000 + - (sqlite3_int64)294967296; - -#if SQLITE_OS_WINCE - SYSTEMTIME time; - osGetSystemTime(&time); - /* if SystemTimeToFileTime() fails, it returns zero. */ - if (!osSystemTimeToFileTime(&time,&ft)){ - return SQLITE_ERROR; - } -#else - osGetSystemTimeAsFileTime( &ft ); -#endif - - *piNow = winFiletimeEpoch + - ((((sqlite3_int64)ft.dwHighDateTime)*max32BitValue) + - (sqlite3_int64)ft.dwLowDateTime)/(sqlite3_int64)10000; - -#ifdef SQLITE_TEST - if( sqlite3_current_time ){ - *piNow = 1000*(sqlite3_int64)sqlite3_current_time + unixEpoch; - } -#endif - UNUSED_PARAMETER(pVfs); - return SQLITE_OK; -} - -/* -** Find the current time (in Universal Coordinated Time). Write the -** current time and date as a Julian Day number into *prNow and -** return 0. Return 1 if the time and date cannot be found. -*/ -static int winCurrentTime(sqlite3_vfs *pVfs, double *prNow){ - int rc; - sqlite3_int64 i; - rc = winCurrentTimeInt64(pVfs, &i); - if( !rc ){ - *prNow = i/86400000.0; - } - return rc; -} - -/* -** The idea is that this function works like a combination of -** GetLastError() and FormatMessage() on Windows (or errno and -** strerror_r() on Unix). After an error is returned by an OS -** function, SQLite calls this function with zBuf pointing to -** a buffer of nBuf bytes. The OS layer should populate the -** buffer with a nul-terminated UTF-8 encoded error message -** describing the last IO error to have occurred within the calling -** thread. -** -** If the error message is too large for the supplied buffer, -** it should be truncated. The return value of xGetLastError -** is zero if the error message fits in the buffer, or non-zero -** otherwise (if the message was truncated). If non-zero is returned, -** then it is not necessary to include the nul-terminator character -** in the output buffer. -** -** Not supplying an error message will have no adverse effect -** on SQLite. It is fine to have an implementation that never -** returns an error message: -** -** int xGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ -** assert(zBuf[0]=='\0'); -** return 0; -** } -** -** However if an error message is supplied, it will be incorporated -** by sqlite into the error message available to the user using -** sqlite3_errmsg(), possibly making IO errors easier to debug. -*/ -static int winGetLastError(sqlite3_vfs *pVfs, int nBuf, char *zBuf){ - UNUSED_PARAMETER(pVfs); - return winGetLastErrorMsg(osGetLastError(), nBuf, zBuf); -} - -/* -** Initialize and deinitialize the operating system interface. -*/ -SQLITE_API int sqlite3_os_init(void){ - static sqlite3_vfs winVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ - SQLITE_WIN32_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32", /* zName */ - 0, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ - }; -#if defined(SQLITE_WIN32_HAS_WIDE) - static sqlite3_vfs winLongPathVfs = { - 3, /* iVersion */ - sizeof(winFile), /* szOsFile */ - SQLITE_WINNT_MAX_PATH_BYTES, /* mxPathname */ - 0, /* pNext */ - "win32-longpath", /* zName */ - 0, /* pAppData */ - winOpen, /* xOpen */ - winDelete, /* xDelete */ - winAccess, /* xAccess */ - winFullPathname, /* xFullPathname */ - winDlOpen, /* xDlOpen */ - winDlError, /* xDlError */ - winDlSym, /* xDlSym */ - winDlClose, /* xDlClose */ - winRandomness, /* xRandomness */ - winSleep, /* xSleep */ - winCurrentTime, /* xCurrentTime */ - winGetLastError, /* xGetLastError */ - winCurrentTimeInt64, /* xCurrentTimeInt64 */ - winSetSystemCall, /* xSetSystemCall */ - winGetSystemCall, /* xGetSystemCall */ - winNextSystemCall, /* xNextSystemCall */ - }; -#endif - - /* Double-check that the aSyscall[] array has been constructed - ** correctly. See ticket [bb3a86e890c8e96ab] */ - assert( ArraySize(aSyscall)==76 ); - - /* get memory map allocation granularity */ - memset(&winSysInfo, 0, sizeof(SYSTEM_INFO)); -#if SQLITE_OS_WINRT - osGetNativeSystemInfo(&winSysInfo); -#else - osGetSystemInfo(&winSysInfo); -#endif - assert( winSysInfo.dwAllocationGranularity>0 ); - assert( winSysInfo.dwPageSize>0 ); - - sqlite3_vfs_register(&winVfs, 1); - -#if defined(SQLITE_WIN32_HAS_WIDE) - sqlite3_vfs_register(&winLongPathVfs, 0); -#endif - - return SQLITE_OK; -} - -SQLITE_API int sqlite3_os_end(void){ -#if SQLITE_OS_WINRT - if( sleepObj!=NULL ){ - osCloseHandle(sleepObj); - sleepObj = NULL; - } -#endif - return SQLITE_OK; -} - -#endif /* SQLITE_OS_WIN */ - -/************** End of os_win.c **********************************************/ -/************** Begin file bitvec.c ******************************************/ -/* -** 2008 February 16 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file implements an object that represents a fixed-length -** bitmap. Bits are numbered starting with 1. -** -** A bitmap is used to record which pages of a database file have been -** journalled during a transaction, or which pages have the "dont-write" -** property. Usually only a few pages are meet either condition. -** So the bitmap is usually sparse and has low cardinality. -** But sometimes (for example when during a DROP of a large table) most -** or all of the pages in a database can get journalled. In those cases, -** the bitmap becomes dense with high cardinality. The algorithm needs -** to handle both cases well. -** -** The size of the bitmap is fixed when the object is created. -** -** All bits are clear when the bitmap is created. Individual bits -** may be set or cleared one at a time. -** -** Test operations are about 100 times more common that set operations. -** Clear operations are exceedingly rare. There are usually between -** 5 and 500 set operations per Bitvec object, though the number of sets can -** sometimes grow into tens of thousands or larger. The size of the -** Bitvec object is the number of pages in the database file at the -** start of a transaction, and is thus usually less than a few thousand, -** but can be as large as 2 billion for a really big database. -*/ - -/* Size of the Bitvec structure in bytes. */ -#define BITVEC_SZ 512 - -/* Round the union size down to the nearest pointer boundary, since that's how -** it will be aligned within the Bitvec struct. */ -#define BITVEC_USIZE (((BITVEC_SZ-(3*sizeof(u32)))/sizeof(Bitvec*))*sizeof(Bitvec*)) - -/* Type of the array "element" for the bitmap representation. -** Should be a power of 2, and ideally, evenly divide into BITVEC_USIZE. -** Setting this to the "natural word" size of your CPU may improve -** performance. */ -#define BITVEC_TELEM u8 -/* Size, in bits, of the bitmap element. */ -#define BITVEC_SZELEM 8 -/* Number of elements in a bitmap array. */ -#define BITVEC_NELEM (BITVEC_USIZE/sizeof(BITVEC_TELEM)) -/* Number of bits in the bitmap array. */ -#define BITVEC_NBIT (BITVEC_NELEM*BITVEC_SZELEM) - -/* Number of u32 values in hash table. */ -#define BITVEC_NINT (BITVEC_USIZE/sizeof(u32)) -/* Maximum number of entries in hash table before -** sub-dividing and re-hashing. */ -#define BITVEC_MXHASH (BITVEC_NINT/2) -/* Hashing function for the aHash representation. -** Empirical testing showed that the *37 multiplier -** (an arbitrary prime)in the hash function provided -** no fewer collisions than the no-op *1. */ -#define BITVEC_HASH(X) (((X)*1)%BITVEC_NINT) - -#define BITVEC_NPTR (BITVEC_USIZE/sizeof(Bitvec *)) - - -/* -** A bitmap is an instance of the following structure. -** -** This bitmap records the existence of zero or more bits -** with values between 1 and iSize, inclusive. -** -** There are three possible representations of the bitmap. -** If iSize<=BITVEC_NBIT, then Bitvec.u.aBitmap[] is a straight -** bitmap. The least significant bit is bit 1. -** -** If iSize>BITVEC_NBIT and iDivisor==0 then Bitvec.u.aHash[] is -** a hash table that will hold up to BITVEC_MXHASH distinct values. -** -** Otherwise, the value i is redirected into one of BITVEC_NPTR -** sub-bitmaps pointed to by Bitvec.u.apSub[]. Each subbitmap -** handles up to iDivisor separate values of i. apSub[0] holds -** values between 1 and iDivisor. apSub[1] holds values between -** iDivisor+1 and 2*iDivisor. apSub[N] holds values between -** N*iDivisor+1 and (N+1)*iDivisor. Each subbitmap is normalized -** to hold deal with values between 1 and iDivisor. -*/ -struct Bitvec { - u32 iSize; /* Maximum bit index. Max iSize is 4,294,967,296. */ - u32 nSet; /* Number of bits that are set - only valid for aHash - ** element. Max is BITVEC_NINT. For BITVEC_SZ of 512, - ** this would be 125. */ - u32 iDivisor; /* Number of bits handled by each apSub[] entry. */ - /* Should >=0 for apSub element. */ - /* Max iDivisor is max(u32) / BITVEC_NPTR + 1. */ - /* For a BITVEC_SZ of 512, this would be 34,359,739. */ - union { - BITVEC_TELEM aBitmap[BITVEC_NELEM]; /* Bitmap representation */ - u32 aHash[BITVEC_NINT]; /* Hash table representation */ - Bitvec *apSub[BITVEC_NPTR]; /* Recursive representation */ - } u; -}; - -/* -** Create a new bitmap object able to handle bits between 0 and iSize, -** inclusive. Return a pointer to the new object. Return NULL if -** malloc fails. -*/ -SQLITE_PRIVATE Bitvec *sqlite3BitvecCreate(u32 iSize){ - Bitvec *p; - assert( sizeof(*p)==BITVEC_SZ ); - p = sqlite3MallocZero( sizeof(*p) ); - if( p ){ - p->iSize = iSize; - } - return p; -} - -/* -** Check to see if the i-th bit is set. Return true or false. -** If p is NULL (if the bitmap has not been created) or if -** i is out of range, then return false. -*/ -SQLITE_PRIVATE int sqlite3BitvecTest(Bitvec *p, u32 i){ - if( p==0 ) return 0; - if( i>p->iSize || i==0 ) return 0; - i--; - while( p->iDivisor ){ - u32 bin = i/p->iDivisor; - i = i%p->iDivisor; - p = p->u.apSub[bin]; - if (!p) { - return 0; - } - } - if( p->iSize<=BITVEC_NBIT ){ - return (p->u.aBitmap[i/BITVEC_SZELEM] & (1<<(i&(BITVEC_SZELEM-1))))!=0; - } else{ - u32 h = BITVEC_HASH(i++); - while( p->u.aHash[h] ){ - if( p->u.aHash[h]==i ) return 1; - h = (h+1) % BITVEC_NINT; - } - return 0; - } -} - -/* -** Set the i-th bit. Return 0 on success and an error code if -** anything goes wrong. -** -** This routine might cause sub-bitmaps to be allocated. Failing -** to get the memory needed to hold the sub-bitmap is the only -** that can go wrong with an insert, assuming p and i are valid. -** -** The calling function must ensure that p is a valid Bitvec object -** and that the value for "i" is within range of the Bitvec object. -** Otherwise the behavior is undefined. -*/ -SQLITE_PRIVATE int sqlite3BitvecSet(Bitvec *p, u32 i){ - u32 h; - if( p==0 ) return SQLITE_OK; - assert( i>0 ); - assert( i<=p->iSize ); - i--; - while((p->iSize > BITVEC_NBIT) && p->iDivisor) { - u32 bin = i/p->iDivisor; - i = i%p->iDivisor; - if( p->u.apSub[bin]==0 ){ - p->u.apSub[bin] = sqlite3BitvecCreate( p->iDivisor ); - if( p->u.apSub[bin]==0 ) return SQLITE_NOMEM; - } - p = p->u.apSub[bin]; - } - if( p->iSize<=BITVEC_NBIT ){ - p->u.aBitmap[i/BITVEC_SZELEM] |= 1 << (i&(BITVEC_SZELEM-1)); - return SQLITE_OK; - } - h = BITVEC_HASH(i++); - /* if there wasn't a hash collision, and this doesn't */ - /* completely fill the hash, then just add it without */ - /* worring about sub-dividing and re-hashing. */ - if( !p->u.aHash[h] ){ - if (p->nSet<(BITVEC_NINT-1)) { - goto bitvec_set_end; - } else { - goto bitvec_set_rehash; - } - } - /* there was a collision, check to see if it's already */ - /* in hash, if not, try to find a spot for it */ - do { - if( p->u.aHash[h]==i ) return SQLITE_OK; - h++; - if( h>=BITVEC_NINT ) h = 0; - } while( p->u.aHash[h] ); - /* we didn't find it in the hash. h points to the first */ - /* available free spot. check to see if this is going to */ - /* make our hash too "full". */ -bitvec_set_rehash: - if( p->nSet>=BITVEC_MXHASH ){ - unsigned int j; - int rc; - u32 *aiValues = sqlite3StackAllocRaw(0, sizeof(p->u.aHash)); - if( aiValues==0 ){ - return SQLITE_NOMEM; - }else{ - memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash)); - memset(p->u.apSub, 0, sizeof(p->u.apSub)); - p->iDivisor = (p->iSize + BITVEC_NPTR - 1)/BITVEC_NPTR; - rc = sqlite3BitvecSet(p, i); - for(j=0; jnSet++; - p->u.aHash[h] = i; - return SQLITE_OK; -} - -/* -** Clear the i-th bit. -** -** pBuf must be a pointer to at least BITVEC_SZ bytes of temporary storage -** that BitvecClear can use to rebuilt its hash table. -*/ -SQLITE_PRIVATE void sqlite3BitvecClear(Bitvec *p, u32 i, void *pBuf){ - if( p==0 ) return; - assert( i>0 ); - i--; - while( p->iDivisor ){ - u32 bin = i/p->iDivisor; - i = i%p->iDivisor; - p = p->u.apSub[bin]; - if (!p) { - return; - } - } - if( p->iSize<=BITVEC_NBIT ){ - p->u.aBitmap[i/BITVEC_SZELEM] &= ~(1 << (i&(BITVEC_SZELEM-1))); - }else{ - unsigned int j; - u32 *aiValues = pBuf; - memcpy(aiValues, p->u.aHash, sizeof(p->u.aHash)); - memset(p->u.aHash, 0, sizeof(p->u.aHash)); - p->nSet = 0; - for(j=0; jnSet++; - while( p->u.aHash[h] ){ - h++; - if( h>=BITVEC_NINT ) h = 0; - } - p->u.aHash[h] = aiValues[j]; - } - } - } -} - -/* -** Destroy a bitmap object. Reclaim all memory used. -*/ -SQLITE_PRIVATE void sqlite3BitvecDestroy(Bitvec *p){ - if( p==0 ) return; - if( p->iDivisor ){ - unsigned int i; - for(i=0; iu.apSub[i]); - } - } - sqlite3_free(p); -} - -/* -** Return the value of the iSize parameter specified when Bitvec *p -** was created. -*/ -SQLITE_PRIVATE u32 sqlite3BitvecSize(Bitvec *p){ - return p->iSize; -} - -#ifndef SQLITE_OMIT_BUILTIN_TEST -/* -** Let V[] be an array of unsigned characters sufficient to hold -** up to N bits. Let I be an integer between 0 and N. 0<=I>3] |= (1<<(I&7)) -#define CLEARBIT(V,I) V[I>>3] &= ~(1<<(I&7)) -#define TESTBIT(V,I) (V[I>>3]&(1<<(I&7)))!=0 - -/* -** This routine runs an extensive test of the Bitvec code. -** -** The input is an array of integers that acts as a program -** to test the Bitvec. The integers are opcodes followed -** by 0, 1, or 3 operands, depending on the opcode. Another -** opcode follows immediately after the last operand. -** -** There are 6 opcodes numbered from 0 through 5. 0 is the -** "halt" opcode and causes the test to end. -** -** 0 Halt and return the number of errors -** 1 N S X Set N bits beginning with S and incrementing by X -** 2 N S X Clear N bits beginning with S and incrementing by X -** 3 N Set N randomly chosen bits -** 4 N Clear N randomly chosen bits -** 5 N S X Set N bits from S increment X in array only, not in bitvec -** -** The opcodes 1 through 4 perform set and clear operations are performed -** on both a Bitvec object and on a linear array of bits obtained from malloc. -** Opcode 5 works on the linear array only, not on the Bitvec. -** Opcode 5 is used to deliberately induce a fault in order to -** confirm that error detection works. -** -** At the conclusion of the test the linear array is compared -** against the Bitvec object. If there are any differences, -** an error is returned. If they are the same, zero is returned. -** -** If a memory allocation error occurs, return -1. -*/ -SQLITE_PRIVATE int sqlite3BitvecBuiltinTest(int sz, int *aOp){ - Bitvec *pBitvec = 0; - unsigned char *pV = 0; - int rc = -1; - int i, nx, pc, op; - void *pTmpSpace; - - /* Allocate the Bitvec to be tested and a linear array of - ** bits to act as the reference */ - pBitvec = sqlite3BitvecCreate( sz ); - pV = sqlite3MallocZero( (sz+7)/8 + 1 ); - pTmpSpace = sqlite3_malloc(BITVEC_SZ); - if( pBitvec==0 || pV==0 || pTmpSpace==0 ) goto bitvec_end; - - /* NULL pBitvec tests */ - sqlite3BitvecSet(0, 1); - sqlite3BitvecClear(0, 1, pTmpSpace); - - /* Run the program */ - pc = 0; - while( (op = aOp[pc])!=0 ){ - switch( op ){ - case 1: - case 2: - case 5: { - nx = 4; - i = aOp[pc+2] - 1; - aOp[pc+2] += aOp[pc+3]; - break; - } - case 3: - case 4: - default: { - nx = 2; - sqlite3_randomness(sizeof(i), &i); - break; - } - } - if( (--aOp[pc+1]) > 0 ) nx = 0; - pc += nx; - i = (i & 0x7fffffff)%sz; - if( (op & 1)!=0 ){ - SETBIT(pV, (i+1)); - if( op!=5 ){ - if( sqlite3BitvecSet(pBitvec, i+1) ) goto bitvec_end; - } - }else{ - CLEARBIT(pV, (i+1)); - sqlite3BitvecClear(pBitvec, i+1, pTmpSpace); - } - } - - /* Test to make sure the linear array exactly matches the - ** Bitvec object. Start with the assumption that they do - ** match (rc==0). Change rc to non-zero if a discrepancy - ** is found. - */ - rc = sqlite3BitvecTest(0,0) + sqlite3BitvecTest(pBitvec, sz+1) - + sqlite3BitvecTest(pBitvec, 0) - + (sqlite3BitvecSize(pBitvec) - sz); - for(i=1; i<=sz; i++){ - if( (TESTBIT(pV,i))!=sqlite3BitvecTest(pBitvec,i) ){ - rc = i; - break; - } - } - - /* Free allocated structure */ -bitvec_end: - sqlite3_free(pTmpSpace); - sqlite3_free(pV); - sqlite3BitvecDestroy(pBitvec); - return rc; -} -#endif /* SQLITE_OMIT_BUILTIN_TEST */ - -/************** End of bitvec.c **********************************************/ -/************** Begin file pcache.c ******************************************/ -/* -** 2008 August 05 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file implements that page cache. -*/ - -/* -** A complete page cache is an instance of this structure. -*/ -struct PCache { - PgHdr *pDirty, *pDirtyTail; /* List of dirty pages in LRU order */ - PgHdr *pSynced; /* Last synced page in dirty page list */ - int nRef; /* Number of referenced pages */ - int szCache; /* Configured cache size */ - int szPage; /* Size of every page in this cache */ - int szExtra; /* Size of extra space for each page */ - int bPurgeable; /* True if pages are on backing store */ - int (*xStress)(void*,PgHdr*); /* Call to try make a page clean */ - void *pStress; /* Argument to xStress */ - sqlite3_pcache *pCache; /* Pluggable cache module */ - PgHdr *pPage1; /* Reference to page 1 */ -}; - -/* -** Some of the assert() macros in this code are too expensive to run -** even during normal debugging. Use them only rarely on long-running -** tests. Enable the expensive asserts using the -** -DSQLITE_ENABLE_EXPENSIVE_ASSERT=1 compile-time option. -*/ -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT -# define expensive_assert(X) assert(X) -#else -# define expensive_assert(X) -#endif - -/********************************** Linked List Management ********************/ - -#if !defined(NDEBUG) && defined(SQLITE_ENABLE_EXPENSIVE_ASSERT) -/* -** Check that the pCache->pSynced variable is set correctly. If it -** is not, either fail an assert or return zero. Otherwise, return -** non-zero. This is only used in debugging builds, as follows: -** -** expensive_assert( pcacheCheckSynced(pCache) ); -*/ -static int pcacheCheckSynced(PCache *pCache){ - PgHdr *p; - for(p=pCache->pDirtyTail; p!=pCache->pSynced; p=p->pDirtyPrev){ - assert( p->nRef || (p->flags&PGHDR_NEED_SYNC) ); - } - return (p==0 || p->nRef || (p->flags&PGHDR_NEED_SYNC)==0); -} -#endif /* !NDEBUG && SQLITE_ENABLE_EXPENSIVE_ASSERT */ - -/* -** Remove page pPage from the list of dirty pages. -*/ -static void pcacheRemoveFromDirtyList(PgHdr *pPage){ - PCache *p = pPage->pCache; - - assert( pPage->pDirtyNext || pPage==p->pDirtyTail ); - assert( pPage->pDirtyPrev || pPage==p->pDirty ); - - /* Update the PCache1.pSynced variable if necessary. */ - if( p->pSynced==pPage ){ - PgHdr *pSynced = pPage->pDirtyPrev; - while( pSynced && (pSynced->flags&PGHDR_NEED_SYNC) ){ - pSynced = pSynced->pDirtyPrev; - } - p->pSynced = pSynced; - } - - if( pPage->pDirtyNext ){ - pPage->pDirtyNext->pDirtyPrev = pPage->pDirtyPrev; - }else{ - assert( pPage==p->pDirtyTail ); - p->pDirtyTail = pPage->pDirtyPrev; - } - if( pPage->pDirtyPrev ){ - pPage->pDirtyPrev->pDirtyNext = pPage->pDirtyNext; - }else{ - assert( pPage==p->pDirty ); - p->pDirty = pPage->pDirtyNext; - } - pPage->pDirtyNext = 0; - pPage->pDirtyPrev = 0; - - expensive_assert( pcacheCheckSynced(p) ); -} - -/* -** Add page pPage to the head of the dirty list (PCache1.pDirty is set to -** pPage). -*/ -static void pcacheAddToDirtyList(PgHdr *pPage){ - PCache *p = pPage->pCache; - - assert( pPage->pDirtyNext==0 && pPage->pDirtyPrev==0 && p->pDirty!=pPage ); - - pPage->pDirtyNext = p->pDirty; - if( pPage->pDirtyNext ){ - assert( pPage->pDirtyNext->pDirtyPrev==0 ); - pPage->pDirtyNext->pDirtyPrev = pPage; - } - p->pDirty = pPage; - if( !p->pDirtyTail ){ - p->pDirtyTail = pPage; - } - if( !p->pSynced && 0==(pPage->flags&PGHDR_NEED_SYNC) ){ - p->pSynced = pPage; - } - expensive_assert( pcacheCheckSynced(p) ); -} - -/* -** Wrapper around the pluggable caches xUnpin method. If the cache is -** being used for an in-memory database, this function is a no-op. -*/ -static void pcacheUnpin(PgHdr *p){ - PCache *pCache = p->pCache; - if( pCache->bPurgeable ){ - if( p->pgno==1 ){ - pCache->pPage1 = 0; - } - sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, p->pPage, 0); - } -} - -/*************************************************** General Interfaces ****** -** -** Initialize and shutdown the page cache subsystem. Neither of these -** functions are threadsafe. -*/ -SQLITE_PRIVATE int sqlite3PcacheInitialize(void){ - if( sqlite3GlobalConfig.pcache2.xInit==0 ){ - /* IMPLEMENTATION-OF: R-26801-64137 If the xInit() method is NULL, then the - ** built-in default page cache is used instead of the application defined - ** page cache. */ - sqlite3PCacheSetDefault(); - } - return sqlite3GlobalConfig.pcache2.xInit(sqlite3GlobalConfig.pcache2.pArg); -} -SQLITE_PRIVATE void sqlite3PcacheShutdown(void){ - if( sqlite3GlobalConfig.pcache2.xShutdown ){ - /* IMPLEMENTATION-OF: R-26000-56589 The xShutdown() method may be NULL. */ - sqlite3GlobalConfig.pcache2.xShutdown(sqlite3GlobalConfig.pcache2.pArg); - } -} - -/* -** Return the size in bytes of a PCache object. -*/ -SQLITE_PRIVATE int sqlite3PcacheSize(void){ return sizeof(PCache); } - -/* -** Create a new PCache object. Storage space to hold the object -** has already been allocated and is passed in as the p pointer. -** The caller discovers how much space needs to be allocated by -** calling sqlite3PcacheSize(). -*/ -SQLITE_PRIVATE void sqlite3PcacheOpen( - int szPage, /* Size of every page */ - int szExtra, /* Extra space associated with each page */ - int bPurgeable, /* True if pages are on backing store */ - int (*xStress)(void*,PgHdr*),/* Call to try to make pages clean */ - void *pStress, /* Argument to xStress */ - PCache *p /* Preallocated space for the PCache */ -){ - memset(p, 0, sizeof(PCache)); - p->szPage = szPage; - p->szExtra = szExtra; - p->bPurgeable = bPurgeable; - p->xStress = xStress; - p->pStress = pStress; - p->szCache = 100; -} - -/* -** Change the page size for PCache object. The caller must ensure that there -** are no outstanding page references when this function is called. -*/ -SQLITE_PRIVATE void sqlite3PcacheSetPageSize(PCache *pCache, int szPage){ - assert( pCache->nRef==0 && pCache->pDirty==0 ); - if( pCache->pCache ){ - sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache); - pCache->pCache = 0; - pCache->pPage1 = 0; - } - pCache->szPage = szPage; -} - -/* -** Compute the number of pages of cache requested. -*/ -static int numberOfCachePages(PCache *p){ - if( p->szCache>=0 ){ - return p->szCache; - }else{ - return (int)((-1024*(i64)p->szCache)/(p->szPage+p->szExtra)); - } -} - -/* -** Try to obtain a page from the cache. -*/ -SQLITE_PRIVATE int sqlite3PcacheFetch( - PCache *pCache, /* Obtain the page from this cache */ - Pgno pgno, /* Page number to obtain */ - int createFlag, /* If true, create page if it does not exist already */ - PgHdr **ppPage /* Write the page here */ -){ - sqlite3_pcache_page *pPage = 0; - PgHdr *pPgHdr = 0; - int eCreate; - - assert( pCache!=0 ); - assert( createFlag==1 || createFlag==0 ); - assert( pgno>0 ); - - /* If the pluggable cache (sqlite3_pcache*) has not been allocated, - ** allocate it now. - */ - if( !pCache->pCache && createFlag ){ - sqlite3_pcache *p; - p = sqlite3GlobalConfig.pcache2.xCreate( - pCache->szPage, pCache->szExtra + sizeof(PgHdr), pCache->bPurgeable - ); - if( !p ){ - return SQLITE_NOMEM; - } - sqlite3GlobalConfig.pcache2.xCachesize(p, numberOfCachePages(pCache)); - pCache->pCache = p; - } - - eCreate = createFlag * (1 + (!pCache->bPurgeable || !pCache->pDirty)); - if( pCache->pCache ){ - pPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, eCreate); - } - - if( !pPage && eCreate==1 ){ - PgHdr *pPg; - - /* Find a dirty page to write-out and recycle. First try to find a - ** page that does not require a journal-sync (one with PGHDR_NEED_SYNC - ** cleared), but if that is not possible settle for any other - ** unreferenced dirty page. - */ - expensive_assert( pcacheCheckSynced(pCache) ); - for(pPg=pCache->pSynced; - pPg && (pPg->nRef || (pPg->flags&PGHDR_NEED_SYNC)); - pPg=pPg->pDirtyPrev - ); - pCache->pSynced = pPg; - if( !pPg ){ - for(pPg=pCache->pDirtyTail; pPg && pPg->nRef; pPg=pPg->pDirtyPrev); - } - if( pPg ){ - int rc; -#ifdef SQLITE_LOG_CACHE_SPILL - sqlite3_log(SQLITE_FULL, - "spill page %d making room for %d - cache used: %d/%d", - pPg->pgno, pgno, - sqlite3GlobalConfig.pcache.xPagecount(pCache->pCache), - numberOfCachePages(pCache)); -#endif - rc = pCache->xStress(pCache->pStress, pPg); - if( rc!=SQLITE_OK && rc!=SQLITE_BUSY ){ - return rc; - } - } - - pPage = sqlite3GlobalConfig.pcache2.xFetch(pCache->pCache, pgno, 2); - } - - if( pPage ){ - pPgHdr = (PgHdr *)pPage->pExtra; - - if( !pPgHdr->pPage ){ - memset(pPgHdr, 0, sizeof(PgHdr)); - pPgHdr->pPage = pPage; - pPgHdr->pData = pPage->pBuf; - pPgHdr->pExtra = (void *)&pPgHdr[1]; - memset(pPgHdr->pExtra, 0, pCache->szExtra); - pPgHdr->pCache = pCache; - pPgHdr->pgno = pgno; - } - assert( pPgHdr->pCache==pCache ); - assert( pPgHdr->pgno==pgno ); - assert( pPgHdr->pData==pPage->pBuf ); - assert( pPgHdr->pExtra==(void *)&pPgHdr[1] ); - - if( 0==pPgHdr->nRef ){ - pCache->nRef++; - } - pPgHdr->nRef++; - if( pgno==1 ){ - pCache->pPage1 = pPgHdr; - } - } - *ppPage = pPgHdr; - return (pPgHdr==0 && eCreate) ? SQLITE_NOMEM : SQLITE_OK; -} - -/* -** Decrement the reference count on a page. If the page is clean and the -** reference count drops to 0, then it is made elible for recycling. -*/ -SQLITE_PRIVATE void sqlite3PcacheRelease(PgHdr *p){ - assert( p->nRef>0 ); - p->nRef--; - if( p->nRef==0 ){ - PCache *pCache = p->pCache; - pCache->nRef--; - if( (p->flags&PGHDR_DIRTY)==0 ){ - pcacheUnpin(p); - }else{ - /* Move the page to the head of the dirty list. */ - pcacheRemoveFromDirtyList(p); - pcacheAddToDirtyList(p); - } - } -} - -/* -** Increase the reference count of a supplied page by 1. -*/ -SQLITE_PRIVATE void sqlite3PcacheRef(PgHdr *p){ - assert(p->nRef>0); - p->nRef++; -} - -/* -** Drop a page from the cache. There must be exactly one reference to the -** page. This function deletes that reference, so after it returns the -** page pointed to by p is invalid. -*/ -SQLITE_PRIVATE void sqlite3PcacheDrop(PgHdr *p){ - PCache *pCache; - assert( p->nRef==1 ); - if( p->flags&PGHDR_DIRTY ){ - pcacheRemoveFromDirtyList(p); - } - pCache = p->pCache; - pCache->nRef--; - if( p->pgno==1 ){ - pCache->pPage1 = 0; - } - sqlite3GlobalConfig.pcache2.xUnpin(pCache->pCache, p->pPage, 1); -} - -/* -** Make sure the page is marked as dirty. If it isn't dirty already, -** make it so. -*/ -SQLITE_PRIVATE void sqlite3PcacheMakeDirty(PgHdr *p){ - p->flags &= ~PGHDR_DONT_WRITE; - assert( p->nRef>0 ); - if( 0==(p->flags & PGHDR_DIRTY) ){ - p->flags |= PGHDR_DIRTY; - pcacheAddToDirtyList( p); - } -} - -/* -** Make sure the page is marked as clean. If it isn't clean already, -** make it so. -*/ -SQLITE_PRIVATE void sqlite3PcacheMakeClean(PgHdr *p){ - if( (p->flags & PGHDR_DIRTY) ){ - pcacheRemoveFromDirtyList(p); - p->flags &= ~(PGHDR_DIRTY|PGHDR_NEED_SYNC); - if( p->nRef==0 ){ - pcacheUnpin(p); - } - } -} - -/* -** Make every page in the cache clean. -*/ -SQLITE_PRIVATE void sqlite3PcacheCleanAll(PCache *pCache){ - PgHdr *p; - while( (p = pCache->pDirty)!=0 ){ - sqlite3PcacheMakeClean(p); - } -} - -/* -** Clear the PGHDR_NEED_SYNC flag from all dirty pages. -*/ -SQLITE_PRIVATE void sqlite3PcacheClearSyncFlags(PCache *pCache){ - PgHdr *p; - for(p=pCache->pDirty; p; p=p->pDirtyNext){ - p->flags &= ~PGHDR_NEED_SYNC; - } - pCache->pSynced = pCache->pDirtyTail; -} - -/* -** Change the page number of page p to newPgno. -*/ -SQLITE_PRIVATE void sqlite3PcacheMove(PgHdr *p, Pgno newPgno){ - PCache *pCache = p->pCache; - assert( p->nRef>0 ); - assert( newPgno>0 ); - sqlite3GlobalConfig.pcache2.xRekey(pCache->pCache, p->pPage, p->pgno,newPgno); - p->pgno = newPgno; - if( (p->flags&PGHDR_DIRTY) && (p->flags&PGHDR_NEED_SYNC) ){ - pcacheRemoveFromDirtyList(p); - pcacheAddToDirtyList(p); - } -} - -/* -** Drop every cache entry whose page number is greater than "pgno". The -** caller must ensure that there are no outstanding references to any pages -** other than page 1 with a page number greater than pgno. -** -** If there is a reference to page 1 and the pgno parameter passed to this -** function is 0, then the data area associated with page 1 is zeroed, but -** the page object is not dropped. -*/ -SQLITE_PRIVATE void sqlite3PcacheTruncate(PCache *pCache, Pgno pgno){ - if( pCache->pCache ){ - PgHdr *p; - PgHdr *pNext; - for(p=pCache->pDirty; p; p=pNext){ - pNext = p->pDirtyNext; - /* This routine never gets call with a positive pgno except right - ** after sqlite3PcacheCleanAll(). So if there are dirty pages, - ** it must be that pgno==0. - */ - assert( p->pgno>0 ); - if( ALWAYS(p->pgno>pgno) ){ - assert( p->flags&PGHDR_DIRTY ); - sqlite3PcacheMakeClean(p); - } - } - if( pgno==0 && pCache->pPage1 ){ - memset(pCache->pPage1->pData, 0, pCache->szPage); - pgno = 1; - } - sqlite3GlobalConfig.pcache2.xTruncate(pCache->pCache, pgno+1); - } -} - -/* -** Close a cache. -*/ -SQLITE_PRIVATE void sqlite3PcacheClose(PCache *pCache){ - if( pCache->pCache ){ - sqlite3GlobalConfig.pcache2.xDestroy(pCache->pCache); - } -} - -/* -** Discard the contents of the cache. -*/ -SQLITE_PRIVATE void sqlite3PcacheClear(PCache *pCache){ - sqlite3PcacheTruncate(pCache, 0); -} - -/* -** Merge two lists of pages connected by pDirty and in pgno order. -** Do not both fixing the pDirtyPrev pointers. -*/ -static PgHdr *pcacheMergeDirtyList(PgHdr *pA, PgHdr *pB){ - PgHdr result, *pTail; - pTail = &result; - while( pA && pB ){ - if( pA->pgnopgno ){ - pTail->pDirty = pA; - pTail = pA; - pA = pA->pDirty; - }else{ - pTail->pDirty = pB; - pTail = pB; - pB = pB->pDirty; - } - } - if( pA ){ - pTail->pDirty = pA; - }else if( pB ){ - pTail->pDirty = pB; - }else{ - pTail->pDirty = 0; - } - return result.pDirty; -} - -/* -** Sort the list of pages in accending order by pgno. Pages are -** connected by pDirty pointers. The pDirtyPrev pointers are -** corrupted by this sort. -** -** Since there cannot be more than 2^31 distinct pages in a database, -** there cannot be more than 31 buckets required by the merge sorter. -** One extra bucket is added to catch overflow in case something -** ever changes to make the previous sentence incorrect. -*/ -#define N_SORT_BUCKET 32 -static PgHdr *pcacheSortDirtyList(PgHdr *pIn){ - PgHdr *a[N_SORT_BUCKET], *p; - int i; - memset(a, 0, sizeof(a)); - while( pIn ){ - p = pIn; - pIn = p->pDirty; - p->pDirty = 0; - for(i=0; ALWAYS(ipDirty; p; p=p->pDirtyNext){ - p->pDirty = p->pDirtyNext; - } - return pcacheSortDirtyList(pCache->pDirty); -} - -/* -** Return the total number of referenced pages held by the cache. -*/ -SQLITE_PRIVATE int sqlite3PcacheRefCount(PCache *pCache){ - return pCache->nRef; -} - -/* -** Return the number of references to the page supplied as an argument. -*/ -SQLITE_PRIVATE int sqlite3PcachePageRefcount(PgHdr *p){ - return p->nRef; -} - -/* -** Return the total number of pages in the cache. -*/ -SQLITE_PRIVATE int sqlite3PcachePagecount(PCache *pCache){ - int nPage = 0; - if( pCache->pCache ){ - nPage = sqlite3GlobalConfig.pcache2.xPagecount(pCache->pCache); - } - return nPage; -} - -#ifdef SQLITE_TEST -/* -** Get the suggested cache-size value. -*/ -SQLITE_PRIVATE int sqlite3PcacheGetCachesize(PCache *pCache){ - return numberOfCachePages(pCache); -} -#endif - -/* -** Set the suggested cache-size value. -*/ -SQLITE_PRIVATE void sqlite3PcacheSetCachesize(PCache *pCache, int mxPage){ - pCache->szCache = mxPage; - if( pCache->pCache ){ - sqlite3GlobalConfig.pcache2.xCachesize(pCache->pCache, - numberOfCachePages(pCache)); - } -} - -/* -** Free up as much memory as possible from the page cache. -*/ -SQLITE_PRIVATE void sqlite3PcacheShrink(PCache *pCache){ - if( pCache->pCache ){ - sqlite3GlobalConfig.pcache2.xShrink(pCache->pCache); - } -} - -#if defined(SQLITE_CHECK_PAGES) || defined(SQLITE_DEBUG) -/* -** For all dirty pages currently in the cache, invoke the specified -** callback. This is only used if the SQLITE_CHECK_PAGES macro is -** defined. -*/ -SQLITE_PRIVATE void sqlite3PcacheIterateDirty(PCache *pCache, void (*xIter)(PgHdr *)){ - PgHdr *pDirty; - for(pDirty=pCache->pDirty; pDirty; pDirty=pDirty->pDirtyNext){ - xIter(pDirty); - } -} -#endif - -/************** End of pcache.c **********************************************/ -/************** Begin file pcache1.c *****************************************/ -/* -** 2008 November 05 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file implements the default page cache implementation (the -** sqlite3_pcache interface). It also contains part of the implementation -** of the SQLITE_CONFIG_PAGECACHE and sqlite3_release_memory() features. -** If the default page cache implementation is overriden, then neither of -** these two features are available. -*/ - - -typedef struct PCache1 PCache1; -typedef struct PgHdr1 PgHdr1; -typedef struct PgFreeslot PgFreeslot; -typedef struct PGroup PGroup; - -/* Each page cache (or PCache) belongs to a PGroup. A PGroup is a set -** of one or more PCaches that are able to recycle each others unpinned -** pages when they are under memory pressure. A PGroup is an instance of -** the following object. -** -** This page cache implementation works in one of two modes: -** -** (1) Every PCache is the sole member of its own PGroup. There is -** one PGroup per PCache. -** -** (2) There is a single global PGroup that all PCaches are a member -** of. -** -** Mode 1 uses more memory (since PCache instances are not able to rob -** unused pages from other PCaches) but it also operates without a mutex, -** and is therefore often faster. Mode 2 requires a mutex in order to be -** threadsafe, but recycles pages more efficiently. -** -** For mode (1), PGroup.mutex is NULL. For mode (2) there is only a single -** PGroup which is the pcache1.grp global variable and its mutex is -** SQLITE_MUTEX_STATIC_LRU. -*/ -struct PGroup { - sqlite3_mutex *mutex; /* MUTEX_STATIC_LRU or NULL */ - unsigned int nMaxPage; /* Sum of nMax for purgeable caches */ - unsigned int nMinPage; /* Sum of nMin for purgeable caches */ - unsigned int mxPinned; /* nMaxpage + 10 - nMinPage */ - unsigned int nCurrentPage; /* Number of purgeable pages allocated */ - PgHdr1 *pLruHead, *pLruTail; /* LRU list of unpinned pages */ -}; - -/* Each page cache is an instance of the following object. Every -** open database file (including each in-memory database and each -** temporary or transient database) has a single page cache which -** is an instance of this object. -** -** Pointers to structures of this type are cast and returned as -** opaque sqlite3_pcache* handles. -*/ -struct PCache1 { - /* Cache configuration parameters. Page size (szPage) and the purgeable - ** flag (bPurgeable) are set when the cache is created. nMax may be - ** modified at any time by a call to the pcache1Cachesize() method. - ** The PGroup mutex must be held when accessing nMax. - */ - PGroup *pGroup; /* PGroup this cache belongs to */ - int szPage; /* Size of allocated pages in bytes */ - int szExtra; /* Size of extra space in bytes */ - int bPurgeable; /* True if cache is purgeable */ - unsigned int nMin; /* Minimum number of pages reserved */ - unsigned int nMax; /* Configured "cache_size" value */ - unsigned int n90pct; /* nMax*9/10 */ - unsigned int iMaxKey; /* Largest key seen since xTruncate() */ - - /* Hash table of all pages. The following variables may only be accessed - ** when the accessor is holding the PGroup mutex. - */ - unsigned int nRecyclable; /* Number of pages in the LRU list */ - unsigned int nPage; /* Total number of pages in apHash */ - unsigned int nHash; /* Number of slots in apHash[] */ - PgHdr1 **apHash; /* Hash table for fast lookup by key */ -}; - -/* -** Each cache entry is represented by an instance of the following -** structure. Unless SQLITE_PCACHE_SEPARATE_HEADER is defined, a buffer of -** PgHdr1.pCache->szPage bytes is allocated directly before this structure -** in memory. -*/ -struct PgHdr1 { - sqlite3_pcache_page page; - unsigned int iKey; /* Key value (page number) */ - u8 isPinned; /* Page in use, not on the LRU list */ - PgHdr1 *pNext; /* Next in hash table chain */ - PCache1 *pCache; /* Cache that currently owns this page */ - PgHdr1 *pLruNext; /* Next in LRU list of unpinned pages */ - PgHdr1 *pLruPrev; /* Previous in LRU list of unpinned pages */ -}; - -/* -** Free slots in the allocator used to divide up the buffer provided using -** the SQLITE_CONFIG_PAGECACHE mechanism. -*/ -struct PgFreeslot { - PgFreeslot *pNext; /* Next free slot */ -}; - -/* -** Global data used by this cache. -*/ -static SQLITE_WSD struct PCacheGlobal { - PGroup grp; /* The global PGroup for mode (2) */ - - /* Variables related to SQLITE_CONFIG_PAGECACHE settings. The - ** szSlot, nSlot, pStart, pEnd, nReserve, and isInit values are all - ** fixed at sqlite3_initialize() time and do not require mutex protection. - ** The nFreeSlot and pFree values do require mutex protection. - */ - int isInit; /* True if initialized */ - int szSlot; /* Size of each free slot */ - int nSlot; /* The number of pcache slots */ - int nReserve; /* Try to keep nFreeSlot above this */ - void *pStart, *pEnd; /* Bounds of pagecache malloc range */ - /* Above requires no mutex. Use mutex below for variable that follow. */ - sqlite3_mutex *mutex; /* Mutex for accessing the following: */ - PgFreeslot *pFree; /* Free page blocks */ - int nFreeSlot; /* Number of unused pcache slots */ - /* The following value requires a mutex to change. We skip the mutex on - ** reading because (1) most platforms read a 32-bit integer atomically and - ** (2) even if an incorrect value is read, no great harm is done since this - ** is really just an optimization. */ - int bUnderPressure; /* True if low on PAGECACHE memory */ -} pcache1_g; - -/* -** All code in this file should access the global structure above via the -** alias "pcache1". This ensures that the WSD emulation is used when -** compiling for systems that do not support real WSD. -*/ -#define pcache1 (GLOBAL(struct PCacheGlobal, pcache1_g)) - -/* -** Macros to enter and leave the PCache LRU mutex. -*/ -#define pcache1EnterMutex(X) sqlite3_mutex_enter((X)->mutex) -#define pcache1LeaveMutex(X) sqlite3_mutex_leave((X)->mutex) - -/******************************************************************************/ -/******** Page Allocation/SQLITE_CONFIG_PCACHE Related Functions **************/ - -/* -** This function is called during initialization if a static buffer is -** supplied to use for the page-cache by passing the SQLITE_CONFIG_PAGECACHE -** verb to sqlite3_config(). Parameter pBuf points to an allocation large -** enough to contain 'n' buffers of 'sz' bytes each. -** -** This routine is called from sqlite3_initialize() and so it is guaranteed -** to be serialized already. There is no need for further mutexing. -*/ -SQLITE_PRIVATE void sqlite3PCacheBufferSetup(void *pBuf, int sz, int n){ - if( pcache1.isInit ){ - PgFreeslot *p; - sz = ROUNDDOWN8(sz); - pcache1.szSlot = sz; - pcache1.nSlot = pcache1.nFreeSlot = n; - pcache1.nReserve = n>90 ? 10 : (n/10 + 1); - pcache1.pStart = pBuf; - pcache1.pFree = 0; - pcache1.bUnderPressure = 0; - while( n-- ){ - p = (PgFreeslot*)pBuf; - p->pNext = pcache1.pFree; - pcache1.pFree = p; - pBuf = (void*)&((char*)pBuf)[sz]; - } - pcache1.pEnd = pBuf; - } -} - -/* -** Malloc function used within this file to allocate space from the buffer -** configured using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no -** such buffer exists or there is no space left in it, this function falls -** back to sqlite3Malloc(). -** -** Multiple threads can run this routine at the same time. Global variables -** in pcache1 need to be protected via mutex. -*/ -static void *pcache1Alloc(int nByte){ - void *p = 0; - assert( sqlite3_mutex_notheld(pcache1.grp.mutex) ); - sqlite3StatusSet(SQLITE_STATUS_PAGECACHE_SIZE, nByte); - if( nByte<=pcache1.szSlot ){ - sqlite3_mutex_enter(pcache1.mutex); - p = (PgHdr1 *)pcache1.pFree; - if( p ){ - pcache1.pFree = pcache1.pFree->pNext; - pcache1.nFreeSlot--; - pcache1.bUnderPressure = pcache1.nFreeSlot=0 ); - sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_USED, 1); - } - sqlite3_mutex_leave(pcache1.mutex); - } - if( p==0 ){ - /* Memory is not available in the SQLITE_CONFIG_PAGECACHE pool. Get - ** it from sqlite3Malloc instead. - */ - p = sqlite3Malloc(nByte); -#ifndef SQLITE_DISABLE_PAGECACHE_OVERFLOW_STATS - if( p ){ - int sz = sqlite3MallocSize(p); - sqlite3_mutex_enter(pcache1.mutex); - sqlite3StatusAdd(SQLITE_STATUS_PAGECACHE_OVERFLOW, sz); - sqlite3_mutex_leave(pcache1.mutex); - } -#endif - sqlite3MemdebugSetType(p, MEMTYPE_PCACHE); - } - return p; -} - -/* -** Free an allocated buffer obtained from pcache1Alloc(). -*/ -static int pcache1Free(void *p){ - int nFreed = 0; - if( p==0 ) return 0; - if( p>=pcache1.pStart && ppNext = pcache1.pFree; - pcache1.pFree = pSlot; - pcache1.nFreeSlot++; - pcache1.bUnderPressure = pcache1.nFreeSlot=pcache1.pStart && ppGroup->mutex) ); - pcache1LeaveMutex(pCache->pGroup); -#ifdef SQLITE_PCACHE_SEPARATE_HEADER - pPg = pcache1Alloc(pCache->szPage); - p = sqlite3Malloc(sizeof(PgHdr1) + pCache->szExtra); - if( !pPg || !p ){ - pcache1Free(pPg); - sqlite3_free(p); - pPg = 0; - } -#else - pPg = pcache1Alloc(sizeof(PgHdr1) + pCache->szPage + pCache->szExtra); - p = (PgHdr1 *)&((u8 *)pPg)[pCache->szPage]; -#endif - pcache1EnterMutex(pCache->pGroup); - - if( pPg ){ - p->page.pBuf = pPg; - p->page.pExtra = &p[1]; - if( pCache->bPurgeable ){ - pCache->pGroup->nCurrentPage++; - } - return p; - } - return 0; -} - -/* -** Free a page object allocated by pcache1AllocPage(). -** -** The pointer is allowed to be NULL, which is prudent. But it turns out -** that the current implementation happens to never call this routine -** with a NULL pointer, so we mark the NULL test with ALWAYS(). -*/ -static void pcache1FreePage(PgHdr1 *p){ - if( ALWAYS(p) ){ - PCache1 *pCache = p->pCache; - assert( sqlite3_mutex_held(p->pCache->pGroup->mutex) ); - pcache1Free(p->page.pBuf); -#ifdef SQLITE_PCACHE_SEPARATE_HEADER - sqlite3_free(p); -#endif - if( pCache->bPurgeable ){ - pCache->pGroup->nCurrentPage--; - } - } -} - -/* -** Malloc function used by SQLite to obtain space from the buffer configured -** using sqlite3_config(SQLITE_CONFIG_PAGECACHE) option. If no such buffer -** exists, this function falls back to sqlite3Malloc(). -*/ -SQLITE_PRIVATE void *sqlite3PageMalloc(int sz){ - return pcache1Alloc(sz); -} - -/* -** Free an allocated buffer obtained from sqlite3PageMalloc(). -*/ -SQLITE_PRIVATE void sqlite3PageFree(void *p){ - pcache1Free(p); -} - - -/* -** Return true if it desirable to avoid allocating a new page cache -** entry. -** -** If memory was allocated specifically to the page cache using -** SQLITE_CONFIG_PAGECACHE but that memory has all been used, then -** it is desirable to avoid allocating a new page cache entry because -** presumably SQLITE_CONFIG_PAGECACHE was suppose to be sufficient -** for all page cache needs and we should not need to spill the -** allocation onto the heap. -** -** Or, the heap is used for all page cache memory but the heap is -** under memory pressure, then again it is desirable to avoid -** allocating a new page cache entry in order to avoid stressing -** the heap even further. -*/ -static int pcache1UnderMemoryPressure(PCache1 *pCache){ - if( pcache1.nSlot && (pCache->szPage+pCache->szExtra)<=pcache1.szSlot ){ - return pcache1.bUnderPressure; - }else{ - return sqlite3HeapNearlyFull(); - } -} - -/******************************************************************************/ -/******** General Implementation Functions ************************************/ - -/* -** This function is used to resize the hash table used by the cache passed -** as the first argument. -** -** The PCache mutex must be held when this function is called. -*/ -static int pcache1ResizeHash(PCache1 *p){ - PgHdr1 **apNew; - unsigned int nNew; - unsigned int i; - - assert( sqlite3_mutex_held(p->pGroup->mutex) ); - - nNew = p->nHash*2; - if( nNew<256 ){ - nNew = 256; - } - - pcache1LeaveMutex(p->pGroup); - if( p->nHash ){ sqlite3BeginBenignMalloc(); } - apNew = (PgHdr1 **)sqlite3MallocZero(sizeof(PgHdr1 *)*nNew); - if( p->nHash ){ sqlite3EndBenignMalloc(); } - pcache1EnterMutex(p->pGroup); - if( apNew ){ - for(i=0; inHash; i++){ - PgHdr1 *pPage; - PgHdr1 *pNext = p->apHash[i]; - while( (pPage = pNext)!=0 ){ - unsigned int h = pPage->iKey % nNew; - pNext = pPage->pNext; - pPage->pNext = apNew[h]; - apNew[h] = pPage; - } - } - sqlite3_free(p->apHash); - p->apHash = apNew; - p->nHash = nNew; - } - - return (p->apHash ? SQLITE_OK : SQLITE_NOMEM); -} - -/* -** This function is used internally to remove the page pPage from the -** PGroup LRU list, if is part of it. If pPage is not part of the PGroup -** LRU list, then this function is a no-op. -** -** The PGroup mutex must be held when this function is called. -*/ -static void pcache1PinPage(PgHdr1 *pPage){ - PCache1 *pCache; - PGroup *pGroup; - - assert( pPage!=0 ); - assert( pPage->isPinned==0 ); - pCache = pPage->pCache; - pGroup = pCache->pGroup; - assert( pPage->pLruNext || pPage==pGroup->pLruTail ); - assert( pPage->pLruPrev || pPage==pGroup->pLruHead ); - assert( sqlite3_mutex_held(pGroup->mutex) ); - if( pPage->pLruPrev ){ - pPage->pLruPrev->pLruNext = pPage->pLruNext; - }else{ - pGroup->pLruHead = pPage->pLruNext; - } - if( pPage->pLruNext ){ - pPage->pLruNext->pLruPrev = pPage->pLruPrev; - }else{ - pGroup->pLruTail = pPage->pLruPrev; - } - pPage->pLruNext = 0; - pPage->pLruPrev = 0; - pPage->isPinned = 1; - pCache->nRecyclable--; -} - - -/* -** Remove the page supplied as an argument from the hash table -** (PCache1.apHash structure) that it is currently stored in. -** -** The PGroup mutex must be held when this function is called. -*/ -static void pcache1RemoveFromHash(PgHdr1 *pPage){ - unsigned int h; - PCache1 *pCache = pPage->pCache; - PgHdr1 **pp; - - assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); - h = pPage->iKey % pCache->nHash; - for(pp=&pCache->apHash[h]; (*pp)!=pPage; pp=&(*pp)->pNext); - *pp = (*pp)->pNext; - - pCache->nPage--; -} - -/* -** If there are currently more than nMaxPage pages allocated, try -** to recycle pages to reduce the number allocated to nMaxPage. -*/ -static void pcache1EnforceMaxPage(PGroup *pGroup){ - assert( sqlite3_mutex_held(pGroup->mutex) ); - while( pGroup->nCurrentPage>pGroup->nMaxPage && pGroup->pLruTail ){ - PgHdr1 *p = pGroup->pLruTail; - assert( p->pCache->pGroup==pGroup ); - assert( p->isPinned==0 ); - pcache1PinPage(p); - pcache1RemoveFromHash(p); - pcache1FreePage(p); - } -} - -/* -** Discard all pages from cache pCache with a page number (key value) -** greater than or equal to iLimit. Any pinned pages that meet this -** criteria are unpinned before they are discarded. -** -** The PCache mutex must be held when this function is called. -*/ -static void pcache1TruncateUnsafe( - PCache1 *pCache, /* The cache to truncate */ - unsigned int iLimit /* Drop pages with this pgno or larger */ -){ - TESTONLY( unsigned int nPage = 0; ) /* To assert pCache->nPage is correct */ - unsigned int h; - assert( sqlite3_mutex_held(pCache->pGroup->mutex) ); - for(h=0; hnHash; h++){ - PgHdr1 **pp = &pCache->apHash[h]; - PgHdr1 *pPage; - while( (pPage = *pp)!=0 ){ - if( pPage->iKey>=iLimit ){ - pCache->nPage--; - *pp = pPage->pNext; - if( !pPage->isPinned ) pcache1PinPage(pPage); - pcache1FreePage(pPage); - }else{ - pp = &pPage->pNext; - TESTONLY( nPage++; ) - } - } - } - assert( pCache->nPage==nPage ); -} - -/******************************************************************************/ -/******** sqlite3_pcache Methods **********************************************/ - -/* -** Implementation of the sqlite3_pcache.xInit method. -*/ -static int pcache1Init(void *NotUsed){ - UNUSED_PARAMETER(NotUsed); - assert( pcache1.isInit==0 ); - memset(&pcache1, 0, sizeof(pcache1)); - if( sqlite3GlobalConfig.bCoreMutex ){ - pcache1.grp.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_LRU); - pcache1.mutex = sqlite3_mutex_alloc(SQLITE_MUTEX_STATIC_PMEM); - } - pcache1.grp.mxPinned = 10; - pcache1.isInit = 1; - return SQLITE_OK; -} - -/* -** Implementation of the sqlite3_pcache.xShutdown method. -** Note that the static mutex allocated in xInit does -** not need to be freed. -*/ -static void pcache1Shutdown(void *NotUsed){ - UNUSED_PARAMETER(NotUsed); - assert( pcache1.isInit!=0 ); - memset(&pcache1, 0, sizeof(pcache1)); -} - -/* -** Implementation of the sqlite3_pcache.xCreate method. -** -** Allocate a new cache. -*/ -static sqlite3_pcache *pcache1Create(int szPage, int szExtra, int bPurgeable){ - PCache1 *pCache; /* The newly created page cache */ - PGroup *pGroup; /* The group the new page cache will belong to */ - int sz; /* Bytes of memory required to allocate the new cache */ - - /* - ** The separateCache variable is true if each PCache has its own private - ** PGroup. In other words, separateCache is true for mode (1) where no - ** mutexing is required. - ** - ** * Always use a unified cache (mode-2) if ENABLE_MEMORY_MANAGEMENT - ** - ** * Always use a unified cache in single-threaded applications - ** - ** * Otherwise (if multi-threaded and ENABLE_MEMORY_MANAGEMENT is off) - ** use separate caches (mode-1) - */ -#if defined(SQLITE_ENABLE_MEMORY_MANAGEMENT) || SQLITE_THREADSAFE==0 - const int separateCache = 0; -#else - int separateCache = sqlite3GlobalConfig.bCoreMutex>0; -#endif - - assert( (szPage & (szPage-1))==0 && szPage>=512 && szPage<=65536 ); - assert( szExtra < 300 ); - - sz = sizeof(PCache1) + sizeof(PGroup)*separateCache; - pCache = (PCache1 *)sqlite3MallocZero(sz); - if( pCache ){ - if( separateCache ){ - pGroup = (PGroup*)&pCache[1]; - pGroup->mxPinned = 10; - }else{ - pGroup = &pcache1.grp; - } - pCache->pGroup = pGroup; - pCache->szPage = szPage; - pCache->szExtra = szExtra; - pCache->bPurgeable = (bPurgeable ? 1 : 0); - if( bPurgeable ){ - pCache->nMin = 10; - pcache1EnterMutex(pGroup); - pGroup->nMinPage += pCache->nMin; - pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; - pcache1LeaveMutex(pGroup); - } - } - return (sqlite3_pcache *)pCache; -} - -/* -** Implementation of the sqlite3_pcache.xCachesize method. -** -** Configure the cache_size limit for a cache. -*/ -static void pcache1Cachesize(sqlite3_pcache *p, int nMax){ - PCache1 *pCache = (PCache1 *)p; - if( pCache->bPurgeable ){ - PGroup *pGroup = pCache->pGroup; - pcache1EnterMutex(pGroup); - pGroup->nMaxPage += (nMax - pCache->nMax); - pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; - pCache->nMax = nMax; - pCache->n90pct = pCache->nMax*9/10; - pcache1EnforceMaxPage(pGroup); - pcache1LeaveMutex(pGroup); - } -} - -/* -** Implementation of the sqlite3_pcache.xShrink method. -** -** Free up as much memory as possible. -*/ -static void pcache1Shrink(sqlite3_pcache *p){ - PCache1 *pCache = (PCache1*)p; - if( pCache->bPurgeable ){ - PGroup *pGroup = pCache->pGroup; - int savedMaxPage; - pcache1EnterMutex(pGroup); - savedMaxPage = pGroup->nMaxPage; - pGroup->nMaxPage = 0; - pcache1EnforceMaxPage(pGroup); - pGroup->nMaxPage = savedMaxPage; - pcache1LeaveMutex(pGroup); - } -} - -/* -** Implementation of the sqlite3_pcache.xPagecount method. -*/ -static int pcache1Pagecount(sqlite3_pcache *p){ - int n; - PCache1 *pCache = (PCache1*)p; - pcache1EnterMutex(pCache->pGroup); - n = pCache->nPage; - pcache1LeaveMutex(pCache->pGroup); - return n; -} - -/* -** Implementation of the sqlite3_pcache.xFetch method. -** -** Fetch a page by key value. -** -** Whether or not a new page may be allocated by this function depends on -** the value of the createFlag argument. 0 means do not allocate a new -** page. 1 means allocate a new page if space is easily available. 2 -** means to try really hard to allocate a new page. -** -** For a non-purgeable cache (a cache used as the storage for an in-memory -** database) there is really no difference between createFlag 1 and 2. So -** the calling function (pcache.c) will never have a createFlag of 1 on -** a non-purgeable cache. -** -** There are three different approaches to obtaining space for a page, -** depending on the value of parameter createFlag (which may be 0, 1 or 2). -** -** 1. Regardless of the value of createFlag, the cache is searched for a -** copy of the requested page. If one is found, it is returned. -** -** 2. If createFlag==0 and the page is not already in the cache, NULL is -** returned. -** -** 3. If createFlag is 1, and the page is not already in the cache, then -** return NULL (do not allocate a new page) if any of the following -** conditions are true: -** -** (a) the number of pages pinned by the cache is greater than -** PCache1.nMax, or -** -** (b) the number of pages pinned by the cache is greater than -** the sum of nMax for all purgeable caches, less the sum of -** nMin for all other purgeable caches, or -** -** 4. If none of the first three conditions apply and the cache is marked -** as purgeable, and if one of the following is true: -** -** (a) The number of pages allocated for the cache is already -** PCache1.nMax, or -** -** (b) The number of pages allocated for all purgeable caches is -** already equal to or greater than the sum of nMax for all -** purgeable caches, -** -** (c) The system is under memory pressure and wants to avoid -** unnecessary pages cache entry allocations -** -** then attempt to recycle a page from the LRU list. If it is the right -** size, return the recycled buffer. Otherwise, free the buffer and -** proceed to step 5. -** -** 5. Otherwise, allocate and return a new page buffer. -*/ -static sqlite3_pcache_page *pcache1Fetch( - sqlite3_pcache *p, - unsigned int iKey, - int createFlag -){ - unsigned int nPinned; - PCache1 *pCache = (PCache1 *)p; - PGroup *pGroup; - PgHdr1 *pPage = 0; - - assert( offsetof(PgHdr1,page)==0 ); - assert( pCache->bPurgeable || createFlag!=1 ); - assert( pCache->bPurgeable || pCache->nMin==0 ); - assert( pCache->bPurgeable==0 || pCache->nMin==10 ); - assert( pCache->nMin==0 || pCache->bPurgeable ); - pcache1EnterMutex(pGroup = pCache->pGroup); - - /* Step 1: Search the hash table for an existing entry. */ - if( pCache->nHash>0 ){ - unsigned int h = iKey % pCache->nHash; - for(pPage=pCache->apHash[h]; pPage&&pPage->iKey!=iKey; pPage=pPage->pNext); - } - - /* Step 2: Abort if no existing page is found and createFlag is 0 */ - if( pPage ){ - if( !pPage->isPinned ) pcache1PinPage(pPage); - goto fetch_out; - } - if( createFlag==0 ){ - goto fetch_out; - } - - /* The pGroup local variable will normally be initialized by the - ** pcache1EnterMutex() macro above. But if SQLITE_MUTEX_OMIT is defined, - ** then pcache1EnterMutex() is a no-op, so we have to initialize the - ** local variable here. Delaying the initialization of pGroup is an - ** optimization: The common case is to exit the module before reaching - ** this point. - */ -#ifdef SQLITE_MUTEX_OMIT - pGroup = pCache->pGroup; -#endif - - /* Step 3: Abort if createFlag is 1 but the cache is nearly full */ - assert( pCache->nPage >= pCache->nRecyclable ); - nPinned = pCache->nPage - pCache->nRecyclable; - assert( pGroup->mxPinned == pGroup->nMaxPage + 10 - pGroup->nMinPage ); - assert( pCache->n90pct == pCache->nMax*9/10 ); - if( createFlag==1 && ( - nPinned>=pGroup->mxPinned - || nPinned>=pCache->n90pct - || pcache1UnderMemoryPressure(pCache) - )){ - goto fetch_out; - } - - if( pCache->nPage>=pCache->nHash && pcache1ResizeHash(pCache) ){ - goto fetch_out; - } - assert( pCache->nHash>0 && pCache->apHash ); - - /* Step 4. Try to recycle a page. */ - if( pCache->bPurgeable && pGroup->pLruTail && ( - (pCache->nPage+1>=pCache->nMax) - || pGroup->nCurrentPage>=pGroup->nMaxPage - || pcache1UnderMemoryPressure(pCache) - )){ - PCache1 *pOther; - pPage = pGroup->pLruTail; - assert( pPage->isPinned==0 ); - pcache1RemoveFromHash(pPage); - pcache1PinPage(pPage); - pOther = pPage->pCache; - - /* We want to verify that szPage and szExtra are the same for pOther - ** and pCache. Assert that we can verify this by comparing sums. */ - assert( (pCache->szPage & (pCache->szPage-1))==0 && pCache->szPage>=512 ); - assert( pCache->szExtra<512 ); - assert( (pOther->szPage & (pOther->szPage-1))==0 && pOther->szPage>=512 ); - assert( pOther->szExtra<512 ); - - if( pOther->szPage+pOther->szExtra != pCache->szPage+pCache->szExtra ){ - pcache1FreePage(pPage); - pPage = 0; - }else{ - pGroup->nCurrentPage -= (pOther->bPurgeable - pCache->bPurgeable); - } - } - - /* Step 5. If a usable page buffer has still not been found, - ** attempt to allocate a new one. - */ - if( !pPage ){ - if( createFlag==1 ) sqlite3BeginBenignMalloc(); - pPage = pcache1AllocPage(pCache); - if( createFlag==1 ) sqlite3EndBenignMalloc(); - } - - if( pPage ){ - unsigned int h = iKey % pCache->nHash; - pCache->nPage++; - pPage->iKey = iKey; - pPage->pNext = pCache->apHash[h]; - pPage->pCache = pCache; - pPage->pLruPrev = 0; - pPage->pLruNext = 0; - pPage->isPinned = 1; - *(void **)pPage->page.pExtra = 0; - pCache->apHash[h] = pPage; - } - -fetch_out: - if( pPage && iKey>pCache->iMaxKey ){ - pCache->iMaxKey = iKey; - } - pcache1LeaveMutex(pGroup); - return (sqlite3_pcache_page*)pPage; -} - - -/* -** Implementation of the sqlite3_pcache.xUnpin method. -** -** Mark a page as unpinned (eligible for asynchronous recycling). -*/ -static void pcache1Unpin( - sqlite3_pcache *p, - sqlite3_pcache_page *pPg, - int reuseUnlikely -){ - PCache1 *pCache = (PCache1 *)p; - PgHdr1 *pPage = (PgHdr1 *)pPg; - PGroup *pGroup = pCache->pGroup; - - assert( pPage->pCache==pCache ); - pcache1EnterMutex(pGroup); - - /* It is an error to call this function if the page is already - ** part of the PGroup LRU list. - */ - assert( pPage->pLruPrev==0 && pPage->pLruNext==0 ); - assert( pGroup->pLruHead!=pPage && pGroup->pLruTail!=pPage ); - assert( pPage->isPinned==1 ); - - if( reuseUnlikely || pGroup->nCurrentPage>pGroup->nMaxPage ){ - pcache1RemoveFromHash(pPage); - pcache1FreePage(pPage); - }else{ - /* Add the page to the PGroup LRU list. */ - if( pGroup->pLruHead ){ - pGroup->pLruHead->pLruPrev = pPage; - pPage->pLruNext = pGroup->pLruHead; - pGroup->pLruHead = pPage; - }else{ - pGroup->pLruTail = pPage; - pGroup->pLruHead = pPage; - } - pCache->nRecyclable++; - pPage->isPinned = 0; - } - - pcache1LeaveMutex(pCache->pGroup); -} - -/* -** Implementation of the sqlite3_pcache.xRekey method. -*/ -static void pcache1Rekey( - sqlite3_pcache *p, - sqlite3_pcache_page *pPg, - unsigned int iOld, - unsigned int iNew -){ - PCache1 *pCache = (PCache1 *)p; - PgHdr1 *pPage = (PgHdr1 *)pPg; - PgHdr1 **pp; - unsigned int h; - assert( pPage->iKey==iOld ); - assert( pPage->pCache==pCache ); - - pcache1EnterMutex(pCache->pGroup); - - h = iOld%pCache->nHash; - pp = &pCache->apHash[h]; - while( (*pp)!=pPage ){ - pp = &(*pp)->pNext; - } - *pp = pPage->pNext; - - h = iNew%pCache->nHash; - pPage->iKey = iNew; - pPage->pNext = pCache->apHash[h]; - pCache->apHash[h] = pPage; - if( iNew>pCache->iMaxKey ){ - pCache->iMaxKey = iNew; - } - - pcache1LeaveMutex(pCache->pGroup); -} - -/* -** Implementation of the sqlite3_pcache.xTruncate method. -** -** Discard all unpinned pages in the cache with a page number equal to -** or greater than parameter iLimit. Any pinned pages with a page number -** equal to or greater than iLimit are implicitly unpinned. -*/ -static void pcache1Truncate(sqlite3_pcache *p, unsigned int iLimit){ - PCache1 *pCache = (PCache1 *)p; - pcache1EnterMutex(pCache->pGroup); - if( iLimit<=pCache->iMaxKey ){ - pcache1TruncateUnsafe(pCache, iLimit); - pCache->iMaxKey = iLimit-1; - } - pcache1LeaveMutex(pCache->pGroup); -} - -/* -** Implementation of the sqlite3_pcache.xDestroy method. -** -** Destroy a cache allocated using pcache1Create(). -*/ -static void pcache1Destroy(sqlite3_pcache *p){ - PCache1 *pCache = (PCache1 *)p; - PGroup *pGroup = pCache->pGroup; - assert( pCache->bPurgeable || (pCache->nMax==0 && pCache->nMin==0) ); - pcache1EnterMutex(pGroup); - pcache1TruncateUnsafe(pCache, 0); - assert( pGroup->nMaxPage >= pCache->nMax ); - pGroup->nMaxPage -= pCache->nMax; - assert( pGroup->nMinPage >= pCache->nMin ); - pGroup->nMinPage -= pCache->nMin; - pGroup->mxPinned = pGroup->nMaxPage + 10 - pGroup->nMinPage; - pcache1EnforceMaxPage(pGroup); - pcache1LeaveMutex(pGroup); - sqlite3_free(pCache->apHash); - sqlite3_free(pCache); -} - -/* -** This function is called during initialization (sqlite3_initialize()) to -** install the default pluggable cache module, assuming the user has not -** already provided an alternative. -*/ -SQLITE_PRIVATE void sqlite3PCacheSetDefault(void){ - static const sqlite3_pcache_methods2 defaultMethods = { - 1, /* iVersion */ - 0, /* pArg */ - pcache1Init, /* xInit */ - pcache1Shutdown, /* xShutdown */ - pcache1Create, /* xCreate */ - pcache1Cachesize, /* xCachesize */ - pcache1Pagecount, /* xPagecount */ - pcache1Fetch, /* xFetch */ - pcache1Unpin, /* xUnpin */ - pcache1Rekey, /* xRekey */ - pcache1Truncate, /* xTruncate */ - pcache1Destroy, /* xDestroy */ - pcache1Shrink /* xShrink */ - }; - sqlite3_config(SQLITE_CONFIG_PCACHE2, &defaultMethods); -} - -#ifdef SQLITE_ENABLE_MEMORY_MANAGEMENT -/* -** This function is called to free superfluous dynamically allocated memory -** held by the pager system. Memory in use by any SQLite pager allocated -** by the current thread may be sqlite3_free()ed. -** -** nReq is the number of bytes of memory required. Once this much has -** been released, the function returns. The return value is the total number -** of bytes of memory released. -*/ -SQLITE_PRIVATE int sqlite3PcacheReleaseMemory(int nReq){ - int nFree = 0; - assert( sqlite3_mutex_notheld(pcache1.grp.mutex) ); - assert( sqlite3_mutex_notheld(pcache1.mutex) ); - if( pcache1.pStart==0 ){ - PgHdr1 *p; - pcache1EnterMutex(&pcache1.grp); - while( (nReq<0 || nFreepage.pBuf); -#ifdef SQLITE_PCACHE_SEPARATE_HEADER - nFree += sqlite3MemSize(p); -#endif - assert( p->isPinned==0 ); - pcache1PinPage(p); - pcache1RemoveFromHash(p); - pcache1FreePage(p); - } - pcache1LeaveMutex(&pcache1.grp); - } - return nFree; -} -#endif /* SQLITE_ENABLE_MEMORY_MANAGEMENT */ - -#ifdef SQLITE_TEST -/* -** This function is used by test procedures to inspect the internal state -** of the global cache. -*/ -SQLITE_PRIVATE void sqlite3PcacheStats( - int *pnCurrent, /* OUT: Total number of pages cached */ - int *pnMax, /* OUT: Global maximum cache size */ - int *pnMin, /* OUT: Sum of PCache1.nMin for purgeable caches */ - int *pnRecyclable /* OUT: Total number of pages available for recycling */ -){ - PgHdr1 *p; - int nRecyclable = 0; - for(p=pcache1.grp.pLruHead; p; p=p->pLruNext){ - assert( p->isPinned==0 ); - nRecyclable++; - } - *pnCurrent = pcache1.grp.nCurrentPage; - *pnMax = (int)pcache1.grp.nMaxPage; - *pnMin = (int)pcache1.grp.nMinPage; - *pnRecyclable = nRecyclable; -} -#endif - -/************** End of pcache1.c *********************************************/ -/************** Begin file rowset.c ******************************************/ -/* -** 2008 December 3 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This module implements an object we call a "RowSet". -** -** The RowSet object is a collection of rowids. Rowids -** are inserted into the RowSet in an arbitrary order. Inserts -** can be intermixed with tests to see if a given rowid has been -** previously inserted into the RowSet. -** -** After all inserts are finished, it is possible to extract the -** elements of the RowSet in sorted order. Once this extraction -** process has started, no new elements may be inserted. -** -** Hence, the primitive operations for a RowSet are: -** -** CREATE -** INSERT -** TEST -** SMALLEST -** DESTROY -** -** The CREATE and DESTROY primitives are the constructor and destructor, -** obviously. The INSERT primitive adds a new element to the RowSet. -** TEST checks to see if an element is already in the RowSet. SMALLEST -** extracts the least value from the RowSet. -** -** The INSERT primitive might allocate additional memory. Memory is -** allocated in chunks so most INSERTs do no allocation. There is an -** upper bound on the size of allocated memory. No memory is freed -** until DESTROY. -** -** The TEST primitive includes a "batch" number. The TEST primitive -** will only see elements that were inserted before the last change -** in the batch number. In other words, if an INSERT occurs between -** two TESTs where the TESTs have the same batch nubmer, then the -** value added by the INSERT will not be visible to the second TEST. -** The initial batch number is zero, so if the very first TEST contains -** a non-zero batch number, it will see all prior INSERTs. -** -** No INSERTs may occurs after a SMALLEST. An assertion will fail if -** that is attempted. -** -** The cost of an INSERT is roughly constant. (Sometime new memory -** has to be allocated on an INSERT.) The cost of a TEST with a new -** batch number is O(NlogN) where N is the number of elements in the RowSet. -** The cost of a TEST using the same batch number is O(logN). The cost -** of the first SMALLEST is O(NlogN). Second and subsequent SMALLEST -** primitives are constant time. The cost of DESTROY is O(N). -** -** There is an added cost of O(N) when switching between TEST and -** SMALLEST primitives. -*/ - - -/* -** Target size for allocation chunks. -*/ -#define ROWSET_ALLOCATION_SIZE 1024 - -/* -** The number of rowset entries per allocation chunk. -*/ -#define ROWSET_ENTRY_PER_CHUNK \ - ((ROWSET_ALLOCATION_SIZE-8)/sizeof(struct RowSetEntry)) - -/* -** Each entry in a RowSet is an instance of the following object. -** -** This same object is reused to store a linked list of trees of RowSetEntry -** objects. In that alternative use, pRight points to the next entry -** in the list, pLeft points to the tree, and v is unused. The -** RowSet.pForest value points to the head of this forest list. -*/ -struct RowSetEntry { - i64 v; /* ROWID value for this entry */ - struct RowSetEntry *pRight; /* Right subtree (larger entries) or list */ - struct RowSetEntry *pLeft; /* Left subtree (smaller entries) */ -}; - -/* -** RowSetEntry objects are allocated in large chunks (instances of the -** following structure) to reduce memory allocation overhead. The -** chunks are kept on a linked list so that they can be deallocated -** when the RowSet is destroyed. -*/ -struct RowSetChunk { - struct RowSetChunk *pNextChunk; /* Next chunk on list of them all */ - struct RowSetEntry aEntry[ROWSET_ENTRY_PER_CHUNK]; /* Allocated entries */ -}; - -/* -** A RowSet in an instance of the following structure. -** -** A typedef of this structure if found in sqliteInt.h. -*/ -struct RowSet { - struct RowSetChunk *pChunk; /* List of all chunk allocations */ - sqlite3 *db; /* The database connection */ - struct RowSetEntry *pEntry; /* List of entries using pRight */ - struct RowSetEntry *pLast; /* Last entry on the pEntry list */ - struct RowSetEntry *pFresh; /* Source of new entry objects */ - struct RowSetEntry *pForest; /* List of binary trees of entries */ - u16 nFresh; /* Number of objects on pFresh */ - u8 rsFlags; /* Various flags */ - u8 iBatch; /* Current insert batch */ -}; - -/* -** Allowed values for RowSet.rsFlags -*/ -#define ROWSET_SORTED 0x01 /* True if RowSet.pEntry is sorted */ -#define ROWSET_NEXT 0x02 /* True if sqlite3RowSetNext() has been called */ - -/* -** Turn bulk memory into a RowSet object. N bytes of memory -** are available at pSpace. The db pointer is used as a memory context -** for any subsequent allocations that need to occur. -** Return a pointer to the new RowSet object. -** -** It must be the case that N is sufficient to make a Rowset. If not -** an assertion fault occurs. -** -** If N is larger than the minimum, use the surplus as an initial -** allocation of entries available to be filled. -*/ -SQLITE_PRIVATE RowSet *sqlite3RowSetInit(sqlite3 *db, void *pSpace, unsigned int N){ - RowSet *p; - assert( N >= ROUND8(sizeof(*p)) ); - p = pSpace; - p->pChunk = 0; - p->db = db; - p->pEntry = 0; - p->pLast = 0; - p->pForest = 0; - p->pFresh = (struct RowSetEntry*)(ROUND8(sizeof(*p)) + (char*)p); - p->nFresh = (u16)((N - ROUND8(sizeof(*p)))/sizeof(struct RowSetEntry)); - p->rsFlags = ROWSET_SORTED; - p->iBatch = 0; - return p; -} - -/* -** Deallocate all chunks from a RowSet. This frees all memory that -** the RowSet has allocated over its lifetime. This routine is -** the destructor for the RowSet. -*/ -SQLITE_PRIVATE void sqlite3RowSetClear(RowSet *p){ - struct RowSetChunk *pChunk, *pNextChunk; - for(pChunk=p->pChunk; pChunk; pChunk = pNextChunk){ - pNextChunk = pChunk->pNextChunk; - sqlite3DbFree(p->db, pChunk); - } - p->pChunk = 0; - p->nFresh = 0; - p->pEntry = 0; - p->pLast = 0; - p->pForest = 0; - p->rsFlags = ROWSET_SORTED; -} - -/* -** Allocate a new RowSetEntry object that is associated with the -** given RowSet. Return a pointer to the new and completely uninitialized -** objected. -** -** In an OOM situation, the RowSet.db->mallocFailed flag is set and this -** routine returns NULL. -*/ -static struct RowSetEntry *rowSetEntryAlloc(RowSet *p){ - assert( p!=0 ); - if( p->nFresh==0 ){ - struct RowSetChunk *pNew; - pNew = sqlite3DbMallocRaw(p->db, sizeof(*pNew)); - if( pNew==0 ){ - return 0; - } - pNew->pNextChunk = p->pChunk; - p->pChunk = pNew; - p->pFresh = pNew->aEntry; - p->nFresh = ROWSET_ENTRY_PER_CHUNK; - } - p->nFresh--; - return p->pFresh++; -} - -/* -** Insert a new value into a RowSet. -** -** The mallocFailed flag of the database connection is set if a -** memory allocation fails. -*/ -SQLITE_PRIVATE void sqlite3RowSetInsert(RowSet *p, i64 rowid){ - struct RowSetEntry *pEntry; /* The new entry */ - struct RowSetEntry *pLast; /* The last prior entry */ - - /* This routine is never called after sqlite3RowSetNext() */ - assert( p!=0 && (p->rsFlags & ROWSET_NEXT)==0 ); - - pEntry = rowSetEntryAlloc(p); - if( pEntry==0 ) return; - pEntry->v = rowid; - pEntry->pRight = 0; - pLast = p->pLast; - if( pLast ){ - if( (p->rsFlags & ROWSET_SORTED)!=0 && rowid<=pLast->v ){ - p->rsFlags &= ~ROWSET_SORTED; - } - pLast->pRight = pEntry; - }else{ - p->pEntry = pEntry; - } - p->pLast = pEntry; -} - -/* -** Merge two lists of RowSetEntry objects. Remove duplicates. -** -** The input lists are connected via pRight pointers and are -** assumed to each already be in sorted order. -*/ -static struct RowSetEntry *rowSetEntryMerge( - struct RowSetEntry *pA, /* First sorted list to be merged */ - struct RowSetEntry *pB /* Second sorted list to be merged */ -){ - struct RowSetEntry head; - struct RowSetEntry *pTail; - - pTail = &head; - while( pA && pB ){ - assert( pA->pRight==0 || pA->v<=pA->pRight->v ); - assert( pB->pRight==0 || pB->v<=pB->pRight->v ); - if( pA->vv ){ - pTail->pRight = pA; - pA = pA->pRight; - pTail = pTail->pRight; - }else if( pB->vv ){ - pTail->pRight = pB; - pB = pB->pRight; - pTail = pTail->pRight; - }else{ - pA = pA->pRight; - } - } - if( pA ){ - assert( pA->pRight==0 || pA->v<=pA->pRight->v ); - pTail->pRight = pA; - }else{ - assert( pB==0 || pB->pRight==0 || pB->v<=pB->pRight->v ); - pTail->pRight = pB; - } - return head.pRight; -} - -/* -** Sort all elements on the list of RowSetEntry objects into order of -** increasing v. -*/ -static struct RowSetEntry *rowSetEntrySort(struct RowSetEntry *pIn){ - unsigned int i; - struct RowSetEntry *pNext, *aBucket[40]; - - memset(aBucket, 0, sizeof(aBucket)); - while( pIn ){ - pNext = pIn->pRight; - pIn->pRight = 0; - for(i=0; aBucket[i]; i++){ - pIn = rowSetEntryMerge(aBucket[i], pIn); - aBucket[i] = 0; - } - aBucket[i] = pIn; - pIn = pNext; - } - pIn = 0; - for(i=0; ipLeft ){ - struct RowSetEntry *p; - rowSetTreeToList(pIn->pLeft, ppFirst, &p); - p->pRight = pIn; - }else{ - *ppFirst = pIn; - } - if( pIn->pRight ){ - rowSetTreeToList(pIn->pRight, &pIn->pRight, ppLast); - }else{ - *ppLast = pIn; - } - assert( (*ppLast)->pRight==0 ); -} - - -/* -** Convert a sorted list of elements (connected by pRight) into a binary -** tree with depth of iDepth. A depth of 1 means the tree contains a single -** node taken from the head of *ppList. A depth of 2 means a tree with -** three nodes. And so forth. -** -** Use as many entries from the input list as required and update the -** *ppList to point to the unused elements of the list. If the input -** list contains too few elements, then construct an incomplete tree -** and leave *ppList set to NULL. -** -** Return a pointer to the root of the constructed binary tree. -*/ -static struct RowSetEntry *rowSetNDeepTree( - struct RowSetEntry **ppList, - int iDepth -){ - struct RowSetEntry *p; /* Root of the new tree */ - struct RowSetEntry *pLeft; /* Left subtree */ - if( *ppList==0 ){ - return 0; - } - if( iDepth==1 ){ - p = *ppList; - *ppList = p->pRight; - p->pLeft = p->pRight = 0; - return p; - } - pLeft = rowSetNDeepTree(ppList, iDepth-1); - p = *ppList; - if( p==0 ){ - return pLeft; - } - p->pLeft = pLeft; - *ppList = p->pRight; - p->pRight = rowSetNDeepTree(ppList, iDepth-1); - return p; -} - -/* -** Convert a sorted list of elements into a binary tree. Make the tree -** as deep as it needs to be in order to contain the entire list. -*/ -static struct RowSetEntry *rowSetListToTree(struct RowSetEntry *pList){ - int iDepth; /* Depth of the tree so far */ - struct RowSetEntry *p; /* Current tree root */ - struct RowSetEntry *pLeft; /* Left subtree */ - - assert( pList!=0 ); - p = pList; - pList = p->pRight; - p->pLeft = p->pRight = 0; - for(iDepth=1; pList; iDepth++){ - pLeft = p; - p = pList; - pList = p->pRight; - p->pLeft = pLeft; - p->pRight = rowSetNDeepTree(&pList, iDepth); - } - return p; -} - -/* -** Take all the entries on p->pEntry and on the trees in p->pForest and -** sort them all together into one big ordered list on p->pEntry. -** -** This routine should only be called once in the life of a RowSet. -*/ -static void rowSetToList(RowSet *p){ - - /* This routine is called only once */ - assert( p!=0 && (p->rsFlags & ROWSET_NEXT)==0 ); - - if( (p->rsFlags & ROWSET_SORTED)==0 ){ - p->pEntry = rowSetEntrySort(p->pEntry); - } - - /* While this module could theoretically support it, sqlite3RowSetNext() - ** is never called after sqlite3RowSetText() for the same RowSet. So - ** there is never a forest to deal with. Should this change, simply - ** remove the assert() and the #if 0. */ - assert( p->pForest==0 ); -#if 0 - while( p->pForest ){ - struct RowSetEntry *pTree = p->pForest->pLeft; - if( pTree ){ - struct RowSetEntry *pHead, *pTail; - rowSetTreeToList(pTree, &pHead, &pTail); - p->pEntry = rowSetEntryMerge(p->pEntry, pHead); - } - p->pForest = p->pForest->pRight; - } -#endif - p->rsFlags |= ROWSET_NEXT; /* Verify this routine is never called again */ -} - -/* -** Extract the smallest element from the RowSet. -** Write the element into *pRowid. Return 1 on success. Return -** 0 if the RowSet is already empty. -** -** After this routine has been called, the sqlite3RowSetInsert() -** routine may not be called again. -*/ -SQLITE_PRIVATE int sqlite3RowSetNext(RowSet *p, i64 *pRowid){ - assert( p!=0 ); - - /* Merge the forest into a single sorted list on first call */ - if( (p->rsFlags & ROWSET_NEXT)==0 ) rowSetToList(p); - - /* Return the next entry on the list */ - if( p->pEntry ){ - *pRowid = p->pEntry->v; - p->pEntry = p->pEntry->pRight; - if( p->pEntry==0 ){ - sqlite3RowSetClear(p); - } - return 1; - }else{ - return 0; - } -} - -/* -** Check to see if element iRowid was inserted into the rowset as -** part of any insert batch prior to iBatch. Return 1 or 0. -** -** If this is the first test of a new batch and if there exist entires -** on pRowSet->pEntry, then sort those entires into the forest at -** pRowSet->pForest so that they can be tested. -*/ -SQLITE_PRIVATE int sqlite3RowSetTest(RowSet *pRowSet, u8 iBatch, sqlite3_int64 iRowid){ - struct RowSetEntry *p, *pTree; - - /* This routine is never called after sqlite3RowSetNext() */ - assert( pRowSet!=0 && (pRowSet->rsFlags & ROWSET_NEXT)==0 ); - - /* Sort entries into the forest on the first test of a new batch - */ - if( iBatch!=pRowSet->iBatch ){ - p = pRowSet->pEntry; - if( p ){ - struct RowSetEntry **ppPrevTree = &pRowSet->pForest; - if( (pRowSet->rsFlags & ROWSET_SORTED)==0 ){ - p = rowSetEntrySort(p); - } - for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){ - ppPrevTree = &pTree->pRight; - if( pTree->pLeft==0 ){ - pTree->pLeft = rowSetListToTree(p); - break; - }else{ - struct RowSetEntry *pAux, *pTail; - rowSetTreeToList(pTree->pLeft, &pAux, &pTail); - pTree->pLeft = 0; - p = rowSetEntryMerge(pAux, p); - } - } - if( pTree==0 ){ - *ppPrevTree = pTree = rowSetEntryAlloc(pRowSet); - if( pTree ){ - pTree->v = 0; - pTree->pRight = 0; - pTree->pLeft = rowSetListToTree(p); - } - } - pRowSet->pEntry = 0; - pRowSet->pLast = 0; - pRowSet->rsFlags |= ROWSET_SORTED; - } - pRowSet->iBatch = iBatch; - } - - /* Test to see if the iRowid value appears anywhere in the forest. - ** Return 1 if it does and 0 if not. - */ - for(pTree = pRowSet->pForest; pTree; pTree=pTree->pRight){ - p = pTree->pLeft; - while( p ){ - if( p->vpRight; - }else if( p->v>iRowid ){ - p = p->pLeft; - }else{ - return 1; - } - } - } - return 0; -} - -/************** End of rowset.c **********************************************/ -/************** Begin file pager.c *******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This is the implementation of the page cache subsystem or "pager". -** -** The pager is used to access a database disk file. It implements -** atomic commit and rollback through the use of a journal file that -** is separate from the database file. The pager also implements file -** locking to prevent two processes from writing the same database -** file simultaneously, or one process from reading the database while -** another is writing. -*/ -#ifndef SQLITE_OMIT_DISKIO -/************** Include wal.h in the middle of pager.c ***********************/ -/************** Begin file wal.h *********************************************/ -/* -** 2010 February 1 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the interface to the write-ahead logging -** system. Refer to the comments below and the header comment attached to -** the implementation of each function in log.c for further details. -*/ - -#ifndef _WAL_H_ -#define _WAL_H_ - - -/* Additional values that can be added to the sync_flags argument of -** sqlite3WalFrames(): -*/ -#define WAL_SYNC_TRANSACTIONS 0x20 /* Sync at the end of each transaction */ -#define SQLITE_SYNC_MASK 0x13 /* Mask off the SQLITE_SYNC_* values */ - -#ifdef SQLITE_OMIT_WAL -# define sqlite3WalOpen(x,y,z) 0 -# define sqlite3WalLimit(x,y) -# define sqlite3WalClose(w,x,y,z) 0 -# define sqlite3WalBeginReadTransaction(y,z) 0 -# define sqlite3WalEndReadTransaction(z) -# define sqlite3WalDbsize(y) 0 -# define sqlite3WalBeginWriteTransaction(y) 0 -# define sqlite3WalEndWriteTransaction(x) 0 -# define sqlite3WalUndo(x,y,z) 0 -# define sqlite3WalSavepoint(y,z) -# define sqlite3WalSavepointUndo(y,z) 0 -# define sqlite3WalFrames(u,v,w,x,y,z) 0 -# define sqlite3WalCheckpoint(r,s,t,u,v,w,x,y,z) 0 -# define sqlite3WalCallback(z) 0 -# define sqlite3WalExclusiveMode(y,z) 0 -# define sqlite3WalHeapMemory(z) 0 -# define sqlite3WalFramesize(z) 0 -# define sqlite3WalFindFrame(x,y,z) 0 -#else - -#define WAL_SAVEPOINT_NDATA 4 - -/* Connection to a write-ahead log (WAL) file. -** There is one object of this type for each pager. -*/ -typedef struct Wal Wal; - -/* Open and close a connection to a write-ahead log. */ -SQLITE_PRIVATE int sqlite3WalOpen(sqlite3_vfs*, sqlite3_file*, const char *, int, i64, Wal**); -SQLITE_PRIVATE int sqlite3WalClose(Wal *pWal, int sync_flags, int, u8 *); - -/* Set the limiting size of a WAL file. */ -SQLITE_PRIVATE void sqlite3WalLimit(Wal*, i64); - -/* Used by readers to open (lock) and close (unlock) a snapshot. A -** snapshot is like a read-transaction. It is the state of the database -** at an instant in time. sqlite3WalOpenSnapshot gets a read lock and -** preserves the current state even if the other threads or processes -** write to or checkpoint the WAL. sqlite3WalCloseSnapshot() closes the -** transaction and releases the lock. -*/ -SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *); -SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal); - -/* Read a page from the write-ahead log, if it is present. */ -SQLITE_PRIVATE int sqlite3WalFindFrame(Wal *, Pgno, u32 *); -SQLITE_PRIVATE int sqlite3WalReadFrame(Wal *, u32, int, u8 *); - -/* If the WAL is not empty, return the size of the database. */ -SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal); - -/* Obtain or release the WRITER lock. */ -SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal); -SQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal); - -/* Undo any frames written (but not committed) to the log */ -SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx); - -/* Return an integer that records the current (uncommitted) write -** position in the WAL */ -SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData); - -/* Move the write position of the WAL back to iFrame. Called in -** response to a ROLLBACK TO command. */ -SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData); - -/* Write a frame or frames to the log. */ -SQLITE_PRIVATE int sqlite3WalFrames(Wal *pWal, int, PgHdr *, Pgno, int, int); - -/* Copy pages from the log to the database file */ -SQLITE_PRIVATE int sqlite3WalCheckpoint( - Wal *pWal, /* Write-ahead log connection */ - int eMode, /* One of PASSIVE, FULL and RESTART */ - int (*xBusy)(void*), /* Function to call when busy */ - void *pBusyArg, /* Context argument for xBusyHandler */ - int sync_flags, /* Flags to sync db file with (or 0) */ - int nBuf, /* Size of buffer nBuf */ - u8 *zBuf, /* Temporary buffer to use */ - int *pnLog, /* OUT: Number of frames in WAL */ - int *pnCkpt /* OUT: Number of backfilled frames in WAL */ -); - -/* Return the value to pass to a sqlite3_wal_hook callback, the -** number of frames in the WAL at the point of the last commit since -** sqlite3WalCallback() was called. If no commits have occurred since -** the last call, then return 0. -*/ -SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal); - -/* Tell the wal layer that an EXCLUSIVE lock has been obtained (or released) -** by the pager layer on the database file. -*/ -SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op); - -/* Return true if the argument is non-NULL and the WAL module is using -** heap-memory for the wal-index. Otherwise, if the argument is NULL or the -** WAL module is using shared-memory, return false. -*/ -SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal); - -#ifdef SQLITE_ENABLE_ZIPVFS -/* If the WAL file is not empty, return the number of bytes of content -** stored in each frame (i.e. the db page-size when the WAL was created). -*/ -SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal); -#endif - -#endif /* ifndef SQLITE_OMIT_WAL */ -#endif /* _WAL_H_ */ - -/************** End of wal.h *************************************************/ -/************** Continuing where we left off in pager.c **********************/ - - -/******************* NOTES ON THE DESIGN OF THE PAGER ************************ -** -** This comment block describes invariants that hold when using a rollback -** journal. These invariants do not apply for journal_mode=WAL, -** journal_mode=MEMORY, or journal_mode=OFF. -** -** Within this comment block, a page is deemed to have been synced -** automatically as soon as it is written when PRAGMA synchronous=OFF. -** Otherwise, the page is not synced until the xSync method of the VFS -** is called successfully on the file containing the page. -** -** Definition: A page of the database file is said to be "overwriteable" if -** one or more of the following are true about the page: -** -** (a) The original content of the page as it was at the beginning of -** the transaction has been written into the rollback journal and -** synced. -** -** (b) The page was a freelist leaf page at the start of the transaction. -** -** (c) The page number is greater than the largest page that existed in -** the database file at the start of the transaction. -** -** (1) A page of the database file is never overwritten unless one of the -** following are true: -** -** (a) The page and all other pages on the same sector are overwriteable. -** -** (b) The atomic page write optimization is enabled, and the entire -** transaction other than the update of the transaction sequence -** number consists of a single page change. -** -** (2) The content of a page written into the rollback journal exactly matches -** both the content in the database when the rollback journal was written -** and the content in the database at the beginning of the current -** transaction. -** -** (3) Writes to the database file are an integer multiple of the page size -** in length and are aligned on a page boundary. -** -** (4) Reads from the database file are either aligned on a page boundary and -** an integer multiple of the page size in length or are taken from the -** first 100 bytes of the database file. -** -** (5) All writes to the database file are synced prior to the rollback journal -** being deleted, truncated, or zeroed. -** -** (6) If a master journal file is used, then all writes to the database file -** are synced prior to the master journal being deleted. -** -** Definition: Two databases (or the same database at two points it time) -** are said to be "logically equivalent" if they give the same answer to -** all queries. Note in particular the content of freelist leaf -** pages can be changed arbitarily without effecting the logical equivalence -** of the database. -** -** (7) At any time, if any subset, including the empty set and the total set, -** of the unsynced changes to a rollback journal are removed and the -** journal is rolled back, the resulting database file will be logical -** equivalent to the database file at the beginning of the transaction. -** -** (8) When a transaction is rolled back, the xTruncate method of the VFS -** is called to restore the database file to the same size it was at -** the beginning of the transaction. (In some VFSes, the xTruncate -** method is a no-op, but that does not change the fact the SQLite will -** invoke it.) -** -** (9) Whenever the database file is modified, at least one bit in the range -** of bytes from 24 through 39 inclusive will be changed prior to releasing -** the EXCLUSIVE lock, thus signaling other connections on the same -** database to flush their caches. -** -** (10) The pattern of bits in bytes 24 through 39 shall not repeat in less -** than one billion transactions. -** -** (11) A database file is well-formed at the beginning and at the conclusion -** of every transaction. -** -** (12) An EXCLUSIVE lock is held on the database file when writing to -** the database file. -** -** (13) A SHARED lock is held on the database file while reading any -** content out of the database file. -** -******************************************************************************/ - -/* -** Macros for troubleshooting. Normally turned off -*/ -#if 0 -int sqlite3PagerTrace=1; /* True to enable tracing */ -#define sqlite3DebugPrintf printf -#define PAGERTRACE(X) if( sqlite3PagerTrace ){ sqlite3DebugPrintf X; } -#else -#define PAGERTRACE(X) -#endif - -/* -** The following two macros are used within the PAGERTRACE() macros above -** to print out file-descriptors. -** -** PAGERID() takes a pointer to a Pager struct as its argument. The -** associated file-descriptor is returned. FILEHANDLEID() takes an sqlite3_file -** struct as its argument. -*/ -#define PAGERID(p) ((int)(p->fd)) -#define FILEHANDLEID(fd) ((int)fd) - -/* -** The Pager.eState variable stores the current 'state' of a pager. A -** pager may be in any one of the seven states shown in the following -** state diagram. -** -** OPEN <------+------+ -** | | | -** V | | -** +---------> READER-------+ | -** | | | -** | V | -** |<-------WRITER_LOCKED------> ERROR -** | | ^ -** | V | -** |<------WRITER_CACHEMOD-------->| -** | | | -** | V | -** |<-------WRITER_DBMOD---------->| -** | | | -** | V | -** +<------WRITER_FINISHED-------->+ -** -** -** List of state transitions and the C [function] that performs each: -** -** OPEN -> READER [sqlite3PagerSharedLock] -** READER -> OPEN [pager_unlock] -** -** READER -> WRITER_LOCKED [sqlite3PagerBegin] -** WRITER_LOCKED -> WRITER_CACHEMOD [pager_open_journal] -** WRITER_CACHEMOD -> WRITER_DBMOD [syncJournal] -** WRITER_DBMOD -> WRITER_FINISHED [sqlite3PagerCommitPhaseOne] -** WRITER_*** -> READER [pager_end_transaction] -** -** WRITER_*** -> ERROR [pager_error] -** ERROR -> OPEN [pager_unlock] -** -** -** OPEN: -** -** The pager starts up in this state. Nothing is guaranteed in this -** state - the file may or may not be locked and the database size is -** unknown. The database may not be read or written. -** -** * No read or write transaction is active. -** * Any lock, or no lock at all, may be held on the database file. -** * The dbSize, dbOrigSize and dbFileSize variables may not be trusted. -** -** READER: -** -** In this state all the requirements for reading the database in -** rollback (non-WAL) mode are met. Unless the pager is (or recently -** was) in exclusive-locking mode, a user-level read transaction is -** open. The database size is known in this state. -** -** A connection running with locking_mode=normal enters this state when -** it opens a read-transaction on the database and returns to state -** OPEN after the read-transaction is completed. However a connection -** running in locking_mode=exclusive (including temp databases) remains in -** this state even after the read-transaction is closed. The only way -** a locking_mode=exclusive connection can transition from READER to OPEN -** is via the ERROR state (see below). -** -** * A read transaction may be active (but a write-transaction cannot). -** * A SHARED or greater lock is held on the database file. -** * The dbSize variable may be trusted (even if a user-level read -** transaction is not active). The dbOrigSize and dbFileSize variables -** may not be trusted at this point. -** * If the database is a WAL database, then the WAL connection is open. -** * Even if a read-transaction is not open, it is guaranteed that -** there is no hot-journal in the file-system. -** -** WRITER_LOCKED: -** -** The pager moves to this state from READER when a write-transaction -** is first opened on the database. In WRITER_LOCKED state, all locks -** required to start a write-transaction are held, but no actual -** modifications to the cache or database have taken place. -** -** In rollback mode, a RESERVED or (if the transaction was opened with -** BEGIN EXCLUSIVE) EXCLUSIVE lock is obtained on the database file when -** moving to this state, but the journal file is not written to or opened -** to in this state. If the transaction is committed or rolled back while -** in WRITER_LOCKED state, all that is required is to unlock the database -** file. -** -** IN WAL mode, WalBeginWriteTransaction() is called to lock the log file. -** If the connection is running with locking_mode=exclusive, an attempt -** is made to obtain an EXCLUSIVE lock on the database file. -** -** * A write transaction is active. -** * If the connection is open in rollback-mode, a RESERVED or greater -** lock is held on the database file. -** * If the connection is open in WAL-mode, a WAL write transaction -** is open (i.e. sqlite3WalBeginWriteTransaction() has been successfully -** called). -** * The dbSize, dbOrigSize and dbFileSize variables are all valid. -** * The contents of the pager cache have not been modified. -** * The journal file may or may not be open. -** * Nothing (not even the first header) has been written to the journal. -** -** WRITER_CACHEMOD: -** -** A pager moves from WRITER_LOCKED state to this state when a page is -** first modified by the upper layer. In rollback mode the journal file -** is opened (if it is not already open) and a header written to the -** start of it. The database file on disk has not been modified. -** -** * A write transaction is active. -** * A RESERVED or greater lock is held on the database file. -** * The journal file is open and the first header has been written -** to it, but the header has not been synced to disk. -** * The contents of the page cache have been modified. -** -** WRITER_DBMOD: -** -** The pager transitions from WRITER_CACHEMOD into WRITER_DBMOD state -** when it modifies the contents of the database file. WAL connections -** never enter this state (since they do not modify the database file, -** just the log file). -** -** * A write transaction is active. -** * An EXCLUSIVE or greater lock is held on the database file. -** * The journal file is open and the first header has been written -** and synced to disk. -** * The contents of the page cache have been modified (and possibly -** written to disk). -** -** WRITER_FINISHED: -** -** It is not possible for a WAL connection to enter this state. -** -** A rollback-mode pager changes to WRITER_FINISHED state from WRITER_DBMOD -** state after the entire transaction has been successfully written into the -** database file. In this state the transaction may be committed simply -** by finalizing the journal file. Once in WRITER_FINISHED state, it is -** not possible to modify the database further. At this point, the upper -** layer must either commit or rollback the transaction. -** -** * A write transaction is active. -** * An EXCLUSIVE or greater lock is held on the database file. -** * All writing and syncing of journal and database data has finished. -** If no error occurred, all that remains is to finalize the journal to -** commit the transaction. If an error did occur, the caller will need -** to rollback the transaction. -** -** ERROR: -** -** The ERROR state is entered when an IO or disk-full error (including -** SQLITE_IOERR_NOMEM) occurs at a point in the code that makes it -** difficult to be sure that the in-memory pager state (cache contents, -** db size etc.) are consistent with the contents of the file-system. -** -** Temporary pager files may enter the ERROR state, but in-memory pagers -** cannot. -** -** For example, if an IO error occurs while performing a rollback, -** the contents of the page-cache may be left in an inconsistent state. -** At this point it would be dangerous to change back to READER state -** (as usually happens after a rollback). Any subsequent readers might -** report database corruption (due to the inconsistent cache), and if -** they upgrade to writers, they may inadvertently corrupt the database -** file. To avoid this hazard, the pager switches into the ERROR state -** instead of READER following such an error. -** -** Once it has entered the ERROR state, any attempt to use the pager -** to read or write data returns an error. Eventually, once all -** outstanding transactions have been abandoned, the pager is able to -** transition back to OPEN state, discarding the contents of the -** page-cache and any other in-memory state at the same time. Everything -** is reloaded from disk (and, if necessary, hot-journal rollback peformed) -** when a read-transaction is next opened on the pager (transitioning -** the pager into READER state). At that point the system has recovered -** from the error. -** -** Specifically, the pager jumps into the ERROR state if: -** -** 1. An error occurs while attempting a rollback. This happens in -** function sqlite3PagerRollback(). -** -** 2. An error occurs while attempting to finalize a journal file -** following a commit in function sqlite3PagerCommitPhaseTwo(). -** -** 3. An error occurs while attempting to write to the journal or -** database file in function pagerStress() in order to free up -** memory. -** -** In other cases, the error is returned to the b-tree layer. The b-tree -** layer then attempts a rollback operation. If the error condition -** persists, the pager enters the ERROR state via condition (1) above. -** -** Condition (3) is necessary because it can be triggered by a read-only -** statement executed within a transaction. In this case, if the error -** code were simply returned to the user, the b-tree layer would not -** automatically attempt a rollback, as it assumes that an error in a -** read-only statement cannot leave the pager in an internally inconsistent -** state. -** -** * The Pager.errCode variable is set to something other than SQLITE_OK. -** * There are one or more outstanding references to pages (after the -** last reference is dropped the pager should move back to OPEN state). -** * The pager is not an in-memory pager. -** -** -** Notes: -** -** * A pager is never in WRITER_DBMOD or WRITER_FINISHED state if the -** connection is open in WAL mode. A WAL connection is always in one -** of the first four states. -** -** * Normally, a connection open in exclusive mode is never in PAGER_OPEN -** state. There are two exceptions: immediately after exclusive-mode has -** been turned on (and before any read or write transactions are -** executed), and when the pager is leaving the "error state". -** -** * See also: assert_pager_state(). -*/ -#define PAGER_OPEN 0 -#define PAGER_READER 1 -#define PAGER_WRITER_LOCKED 2 -#define PAGER_WRITER_CACHEMOD 3 -#define PAGER_WRITER_DBMOD 4 -#define PAGER_WRITER_FINISHED 5 -#define PAGER_ERROR 6 - -/* -** The Pager.eLock variable is almost always set to one of the -** following locking-states, according to the lock currently held on -** the database file: NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK. -** This variable is kept up to date as locks are taken and released by -** the pagerLockDb() and pagerUnlockDb() wrappers. -** -** If the VFS xLock() or xUnlock() returns an error other than SQLITE_BUSY -** (i.e. one of the SQLITE_IOERR subtypes), it is not clear whether or not -** the operation was successful. In these circumstances pagerLockDb() and -** pagerUnlockDb() take a conservative approach - eLock is always updated -** when unlocking the file, and only updated when locking the file if the -** VFS call is successful. This way, the Pager.eLock variable may be set -** to a less exclusive (lower) value than the lock that is actually held -** at the system level, but it is never set to a more exclusive value. -** -** This is usually safe. If an xUnlock fails or appears to fail, there may -** be a few redundant xLock() calls or a lock may be held for longer than -** required, but nothing really goes wrong. -** -** The exception is when the database file is unlocked as the pager moves -** from ERROR to OPEN state. At this point there may be a hot-journal file -** in the file-system that needs to be rolled back (as part of a OPEN->SHARED -** transition, by the same pager or any other). If the call to xUnlock() -** fails at this point and the pager is left holding an EXCLUSIVE lock, this -** can confuse the call to xCheckReservedLock() call made later as part -** of hot-journal detection. -** -** xCheckReservedLock() is defined as returning true "if there is a RESERVED -** lock held by this process or any others". So xCheckReservedLock may -** return true because the caller itself is holding an EXCLUSIVE lock (but -** doesn't know it because of a previous error in xUnlock). If this happens -** a hot-journal may be mistaken for a journal being created by an active -** transaction in another process, causing SQLite to read from the database -** without rolling it back. -** -** To work around this, if a call to xUnlock() fails when unlocking the -** database in the ERROR state, Pager.eLock is set to UNKNOWN_LOCK. It -** is only changed back to a real locking state after a successful call -** to xLock(EXCLUSIVE). Also, the code to do the OPEN->SHARED state transition -** omits the check for a hot-journal if Pager.eLock is set to UNKNOWN_LOCK -** lock. Instead, it assumes a hot-journal exists and obtains an EXCLUSIVE -** lock on the database file before attempting to roll it back. See function -** PagerSharedLock() for more detail. -** -** Pager.eLock may only be set to UNKNOWN_LOCK when the pager is in -** PAGER_OPEN state. -*/ -#define UNKNOWN_LOCK (EXCLUSIVE_LOCK+1) - -/* -** A macro used for invoking the codec if there is one -*/ -#ifdef SQLITE_HAS_CODEC -# define CODEC1(P,D,N,X,E) \ - if( P->xCodec && P->xCodec(P->pCodec,D,N,X)==0 ){ E; } -# define CODEC2(P,D,N,X,E,O) \ - if( P->xCodec==0 ){ O=(char*)D; }else \ - if( (O=(char*)(P->xCodec(P->pCodec,D,N,X)))==0 ){ E; } -#else -# define CODEC1(P,D,N,X,E) /* NO-OP */ -# define CODEC2(P,D,N,X,E,O) O=(char*)D -#endif - -/* -** The maximum allowed sector size. 64KiB. If the xSectorsize() method -** returns a value larger than this, then MAX_SECTOR_SIZE is used instead. -** This could conceivably cause corruption following a power failure on -** such a system. This is currently an undocumented limit. -*/ -#define MAX_SECTOR_SIZE 0x10000 - -/* -** An instance of the following structure is allocated for each active -** savepoint and statement transaction in the system. All such structures -** are stored in the Pager.aSavepoint[] array, which is allocated and -** resized using sqlite3Realloc(). -** -** When a savepoint is created, the PagerSavepoint.iHdrOffset field is -** set to 0. If a journal-header is written into the main journal while -** the savepoint is active, then iHdrOffset is set to the byte offset -** immediately following the last journal record written into the main -** journal before the journal-header. This is required during savepoint -** rollback (see pagerPlaybackSavepoint()). -*/ -typedef struct PagerSavepoint PagerSavepoint; -struct PagerSavepoint { - i64 iOffset; /* Starting offset in main journal */ - i64 iHdrOffset; /* See above */ - Bitvec *pInSavepoint; /* Set of pages in this savepoint */ - Pgno nOrig; /* Original number of pages in file */ - Pgno iSubRec; /* Index of first record in sub-journal */ -#ifndef SQLITE_OMIT_WAL - u32 aWalData[WAL_SAVEPOINT_NDATA]; /* WAL savepoint context */ -#endif -}; - -/* -** Bits of the Pager.doNotSpill flag. See further description below. -*/ -#define SPILLFLAG_OFF 0x01 /* Never spill cache. Set via pragma */ -#define SPILLFLAG_ROLLBACK 0x02 /* Current rolling back, so do not spill */ -#define SPILLFLAG_NOSYNC 0x04 /* Spill is ok, but do not sync */ - -/* -** A open page cache is an instance of struct Pager. A description of -** some of the more important member variables follows: -** -** eState -** -** The current 'state' of the pager object. See the comment and state -** diagram above for a description of the pager state. -** -** eLock -** -** For a real on-disk database, the current lock held on the database file - -** NO_LOCK, SHARED_LOCK, RESERVED_LOCK or EXCLUSIVE_LOCK. -** -** For a temporary or in-memory database (neither of which require any -** locks), this variable is always set to EXCLUSIVE_LOCK. Since such -** databases always have Pager.exclusiveMode==1, this tricks the pager -** logic into thinking that it already has all the locks it will ever -** need (and no reason to release them). -** -** In some (obscure) circumstances, this variable may also be set to -** UNKNOWN_LOCK. See the comment above the #define of UNKNOWN_LOCK for -** details. -** -** changeCountDone -** -** This boolean variable is used to make sure that the change-counter -** (the 4-byte header field at byte offset 24 of the database file) is -** not updated more often than necessary. -** -** It is set to true when the change-counter field is updated, which -** can only happen if an exclusive lock is held on the database file. -** It is cleared (set to false) whenever an exclusive lock is -** relinquished on the database file. Each time a transaction is committed, -** The changeCountDone flag is inspected. If it is true, the work of -** updating the change-counter is omitted for the current transaction. -** -** This mechanism means that when running in exclusive mode, a connection -** need only update the change-counter once, for the first transaction -** committed. -** -** setMaster -** -** When PagerCommitPhaseOne() is called to commit a transaction, it may -** (or may not) specify a master-journal name to be written into the -** journal file before it is synced to disk. -** -** Whether or not a journal file contains a master-journal pointer affects -** the way in which the journal file is finalized after the transaction is -** committed or rolled back when running in "journal_mode=PERSIST" mode. -** If a journal file does not contain a master-journal pointer, it is -** finalized by overwriting the first journal header with zeroes. If -** it does contain a master-journal pointer the journal file is finalized -** by truncating it to zero bytes, just as if the connection were -** running in "journal_mode=truncate" mode. -** -** Journal files that contain master journal pointers cannot be finalized -** simply by overwriting the first journal-header with zeroes, as the -** master journal pointer could interfere with hot-journal rollback of any -** subsequently interrupted transaction that reuses the journal file. -** -** The flag is cleared as soon as the journal file is finalized (either -** by PagerCommitPhaseTwo or PagerRollback). If an IO error prevents the -** journal file from being successfully finalized, the setMaster flag -** is cleared anyway (and the pager will move to ERROR state). -** -** doNotSpill -** -** This variables control the behavior of cache-spills (calls made by -** the pcache module to the pagerStress() routine to write cached data -** to the file-system in order to free up memory). -** -** When bits SPILLFLAG_OFF or SPILLFLAG_ROLLBACK of doNotSpill are set, -** writing to the database from pagerStress() is disabled altogether. -** The SPILLFLAG_ROLLBACK case is done in a very obscure case that -** comes up during savepoint rollback that requires the pcache module -** to allocate a new page to prevent the journal file from being written -** while it is being traversed by code in pager_playback(). The SPILLFLAG_OFF -** case is a user preference. -** -** If the SPILLFLAG_NOSYNC bit is set, writing to the database from pagerStress() -** is permitted, but syncing the journal file is not. This flag is set -** by sqlite3PagerWrite() when the file-system sector-size is larger than -** the database page-size in order to prevent a journal sync from happening -** in between the journalling of two pages on the same sector. -** -** subjInMemory -** -** This is a boolean variable. If true, then any required sub-journal -** is opened as an in-memory journal file. If false, then in-memory -** sub-journals are only used for in-memory pager files. -** -** This variable is updated by the upper layer each time a new -** write-transaction is opened. -** -** dbSize, dbOrigSize, dbFileSize -** -** Variable dbSize is set to the number of pages in the database file. -** It is valid in PAGER_READER and higher states (all states except for -** OPEN and ERROR). -** -** dbSize is set based on the size of the database file, which may be -** larger than the size of the database (the value stored at offset -** 28 of the database header by the btree). If the size of the file -** is not an integer multiple of the page-size, the value stored in -** dbSize is rounded down (i.e. a 5KB file with 2K page-size has dbSize==2). -** Except, any file that is greater than 0 bytes in size is considered -** to have at least one page. (i.e. a 1KB file with 2K page-size leads -** to dbSize==1). -** -** During a write-transaction, if pages with page-numbers greater than -** dbSize are modified in the cache, dbSize is updated accordingly. -** Similarly, if the database is truncated using PagerTruncateImage(), -** dbSize is updated. -** -** Variables dbOrigSize and dbFileSize are valid in states -** PAGER_WRITER_LOCKED and higher. dbOrigSize is a copy of the dbSize -** variable at the start of the transaction. It is used during rollback, -** and to determine whether or not pages need to be journalled before -** being modified. -** -** Throughout a write-transaction, dbFileSize contains the size of -** the file on disk in pages. It is set to a copy of dbSize when the -** write-transaction is first opened, and updated when VFS calls are made -** to write or truncate the database file on disk. -** -** The only reason the dbFileSize variable is required is to suppress -** unnecessary calls to xTruncate() after committing a transaction. If, -** when a transaction is committed, the dbFileSize variable indicates -** that the database file is larger than the database image (Pager.dbSize), -** pager_truncate() is called. The pager_truncate() call uses xFilesize() -** to measure the database file on disk, and then truncates it if required. -** dbFileSize is not used when rolling back a transaction. In this case -** pager_truncate() is called unconditionally (which means there may be -** a call to xFilesize() that is not strictly required). In either case, -** pager_truncate() may cause the file to become smaller or larger. -** -** dbHintSize -** -** The dbHintSize variable is used to limit the number of calls made to -** the VFS xFileControl(FCNTL_SIZE_HINT) method. -** -** dbHintSize is set to a copy of the dbSize variable when a -** write-transaction is opened (at the same time as dbFileSize and -** dbOrigSize). If the xFileControl(FCNTL_SIZE_HINT) method is called, -** dbHintSize is increased to the number of pages that correspond to the -** size-hint passed to the method call. See pager_write_pagelist() for -** details. -** -** errCode -** -** The Pager.errCode variable is only ever used in PAGER_ERROR state. It -** is set to zero in all other states. In PAGER_ERROR state, Pager.errCode -** is always set to SQLITE_FULL, SQLITE_IOERR or one of the SQLITE_IOERR_XXX -** sub-codes. -*/ -struct Pager { - sqlite3_vfs *pVfs; /* OS functions to use for IO */ - u8 exclusiveMode; /* Boolean. True if locking_mode==EXCLUSIVE */ - u8 journalMode; /* One of the PAGER_JOURNALMODE_* values */ - u8 useJournal; /* Use a rollback journal on this file */ - u8 noSync; /* Do not sync the journal if true */ - u8 fullSync; /* Do extra syncs of the journal for robustness */ - u8 ckptSyncFlags; /* SYNC_NORMAL or SYNC_FULL for checkpoint */ - u8 walSyncFlags; /* SYNC_NORMAL or SYNC_FULL for wal writes */ - u8 syncFlags; /* SYNC_NORMAL or SYNC_FULL otherwise */ - u8 tempFile; /* zFilename is a temporary file */ - u8 readOnly; /* True for a read-only database */ - u8 memDb; /* True to inhibit all file I/O */ - - /************************************************************************** - ** The following block contains those class members that change during - ** routine opertion. Class members not in this block are either fixed - ** when the pager is first created or else only change when there is a - ** significant mode change (such as changing the page_size, locking_mode, - ** or the journal_mode). From another view, these class members describe - ** the "state" of the pager, while other class members describe the - ** "configuration" of the pager. - */ - u8 eState; /* Pager state (OPEN, READER, WRITER_LOCKED..) */ - u8 eLock; /* Current lock held on database file */ - u8 changeCountDone; /* Set after incrementing the change-counter */ - u8 setMaster; /* True if a m-j name has been written to jrnl */ - u8 doNotSpill; /* Do not spill the cache when non-zero */ - u8 subjInMemory; /* True to use in-memory sub-journals */ - Pgno dbSize; /* Number of pages in the database */ - Pgno dbOrigSize; /* dbSize before the current transaction */ - Pgno dbFileSize; /* Number of pages in the database file */ - Pgno dbHintSize; /* Value passed to FCNTL_SIZE_HINT call */ - int errCode; /* One of several kinds of errors */ - int nRec; /* Pages journalled since last j-header written */ - u32 cksumInit; /* Quasi-random value added to every checksum */ - u32 nSubRec; /* Number of records written to sub-journal */ - Bitvec *pInJournal; /* One bit for each page in the database file */ - sqlite3_file *fd; /* File descriptor for database */ - sqlite3_file *jfd; /* File descriptor for main journal */ - sqlite3_file *sjfd; /* File descriptor for sub-journal */ - i64 journalOff; /* Current write offset in the journal file */ - i64 journalHdr; /* Byte offset to previous journal header */ - sqlite3_backup *pBackup; /* Pointer to list of ongoing backup processes */ - PagerSavepoint *aSavepoint; /* Array of active savepoints */ - int nSavepoint; /* Number of elements in aSavepoint[] */ - char dbFileVers[16]; /* Changes whenever database file changes */ - - u8 bUseFetch; /* True to use xFetch() */ - int nMmapOut; /* Number of mmap pages currently outstanding */ - sqlite3_int64 szMmap; /* Desired maximum mmap size */ - PgHdr *pMmapFreelist; /* List of free mmap page headers (pDirty) */ - /* - ** End of the routinely-changing class members - ***************************************************************************/ - - u16 nExtra; /* Add this many bytes to each in-memory page */ - i16 nReserve; /* Number of unused bytes at end of each page */ - u32 vfsFlags; /* Flags for sqlite3_vfs.xOpen() */ - u32 sectorSize; /* Assumed sector size during rollback */ - int pageSize; /* Number of bytes in a page */ - Pgno mxPgno; /* Maximum allowed size of the database */ - i64 journalSizeLimit; /* Size limit for persistent journal files */ - char *zFilename; /* Name of the database file */ - char *zJournal; /* Name of the journal file */ - int (*xBusyHandler)(void*); /* Function to call when busy */ - void *pBusyHandlerArg; /* Context argument for xBusyHandler */ - int aStat[3]; /* Total cache hits, misses and writes */ -#ifdef SQLITE_TEST - int nRead; /* Database pages read */ -#endif - void (*xReiniter)(DbPage*); /* Call this routine when reloading pages */ -#ifdef SQLITE_HAS_CODEC - void *(*xCodec)(void*,void*,Pgno,int); /* Routine for en/decoding data */ - void (*xCodecSizeChng)(void*,int,int); /* Notify of page size changes */ - void (*xCodecFree)(void*); /* Destructor for the codec */ - void *pCodec; /* First argument to xCodec... methods */ -#endif - char *pTmpSpace; /* Pager.pageSize bytes of space for tmp use */ - PCache *pPCache; /* Pointer to page cache object */ -#ifndef SQLITE_OMIT_WAL - Wal *pWal; /* Write-ahead log used by "journal_mode=wal" */ - char *zWal; /* File name for write-ahead log */ -#endif -}; - -/* -** Indexes for use with Pager.aStat[]. The Pager.aStat[] array contains -** the values accessed by passing SQLITE_DBSTATUS_CACHE_HIT, CACHE_MISS -** or CACHE_WRITE to sqlite3_db_status(). -*/ -#define PAGER_STAT_HIT 0 -#define PAGER_STAT_MISS 1 -#define PAGER_STAT_WRITE 2 - -/* -** The following global variables hold counters used for -** testing purposes only. These variables do not exist in -** a non-testing build. These variables are not thread-safe. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_pager_readdb_count = 0; /* Number of full pages read from DB */ -SQLITE_API int sqlite3_pager_writedb_count = 0; /* Number of full pages written to DB */ -SQLITE_API int sqlite3_pager_writej_count = 0; /* Number of pages written to journal */ -# define PAGER_INCR(v) v++ -#else -# define PAGER_INCR(v) -#endif - - - -/* -** Journal files begin with the following magic string. The data -** was obtained from /dev/random. It is used only as a sanity check. -** -** Since version 2.8.0, the journal format contains additional sanity -** checking information. If the power fails while the journal is being -** written, semi-random garbage data might appear in the journal -** file after power is restored. If an attempt is then made -** to roll the journal back, the database could be corrupted. The additional -** sanity checking data is an attempt to discover the garbage in the -** journal and ignore it. -** -** The sanity checking information for the new journal format consists -** of a 32-bit checksum on each page of data. The checksum covers both -** the page number and the pPager->pageSize bytes of data for the page. -** This cksum is initialized to a 32-bit random value that appears in the -** journal file right after the header. The random initializer is important, -** because garbage data that appears at the end of a journal is likely -** data that was once in other files that have now been deleted. If the -** garbage data came from an obsolete journal file, the checksums might -** be correct. But by initializing the checksum to random value which -** is different for every journal, we minimize that risk. -*/ -static const unsigned char aJournalMagic[] = { - 0xd9, 0xd5, 0x05, 0xf9, 0x20, 0xa1, 0x63, 0xd7, -}; - -/* -** The size of the of each page record in the journal is given by -** the following macro. -*/ -#define JOURNAL_PG_SZ(pPager) ((pPager->pageSize) + 8) - -/* -** The journal header size for this pager. This is usually the same -** size as a single disk sector. See also setSectorSize(). -*/ -#define JOURNAL_HDR_SZ(pPager) (pPager->sectorSize) - -/* -** The macro MEMDB is true if we are dealing with an in-memory database. -** We do this as a macro so that if the SQLITE_OMIT_MEMORYDB macro is set, -** the value of MEMDB will be a constant and the compiler will optimize -** out code that would never execute. -*/ -#ifdef SQLITE_OMIT_MEMORYDB -# define MEMDB 0 -#else -# define MEMDB pPager->memDb -#endif - -/* -** The macro USEFETCH is true if we are allowed to use the xFetch and xUnfetch -** interfaces to access the database using memory-mapped I/O. -*/ -#if SQLITE_MAX_MMAP_SIZE>0 -# define USEFETCH(x) ((x)->bUseFetch) -#else -# define USEFETCH(x) 0 -#endif - -/* -** The maximum legal page number is (2^31 - 1). -*/ -#define PAGER_MAX_PGNO 2147483647 - -/* -** The argument to this macro is a file descriptor (type sqlite3_file*). -** Return 0 if it is not open, or non-zero (but not 1) if it is. -** -** This is so that expressions can be written as: -** -** if( isOpen(pPager->jfd) ){ ... -** -** instead of -** -** if( pPager->jfd->pMethods ){ ... -*/ -#define isOpen(pFd) ((pFd)->pMethods) - -/* -** Return true if this pager uses a write-ahead log instead of the usual -** rollback journal. Otherwise false. -*/ -#ifndef SQLITE_OMIT_WAL -static int pagerUseWal(Pager *pPager){ - return (pPager->pWal!=0); -} -#else -# define pagerUseWal(x) 0 -# define pagerRollbackWal(x) 0 -# define pagerWalFrames(v,w,x,y) 0 -# define pagerOpenWalIfPresent(z) SQLITE_OK -# define pagerBeginReadTransaction(z) SQLITE_OK -#endif - -#ifndef NDEBUG -/* -** Usage: -** -** assert( assert_pager_state(pPager) ); -** -** This function runs many asserts to try to find inconsistencies in -** the internal state of the Pager object. -*/ -static int assert_pager_state(Pager *p){ - Pager *pPager = p; - - /* State must be valid. */ - assert( p->eState==PAGER_OPEN - || p->eState==PAGER_READER - || p->eState==PAGER_WRITER_LOCKED - || p->eState==PAGER_WRITER_CACHEMOD - || p->eState==PAGER_WRITER_DBMOD - || p->eState==PAGER_WRITER_FINISHED - || p->eState==PAGER_ERROR - ); - - /* Regardless of the current state, a temp-file connection always behaves - ** as if it has an exclusive lock on the database file. It never updates - ** the change-counter field, so the changeCountDone flag is always set. - */ - assert( p->tempFile==0 || p->eLock==EXCLUSIVE_LOCK ); - assert( p->tempFile==0 || pPager->changeCountDone ); - - /* If the useJournal flag is clear, the journal-mode must be "OFF". - ** And if the journal-mode is "OFF", the journal file must not be open. - */ - assert( p->journalMode==PAGER_JOURNALMODE_OFF || p->useJournal ); - assert( p->journalMode!=PAGER_JOURNALMODE_OFF || !isOpen(p->jfd) ); - - /* Check that MEMDB implies noSync. And an in-memory journal. Since - ** this means an in-memory pager performs no IO at all, it cannot encounter - ** either SQLITE_IOERR or SQLITE_FULL during rollback or while finalizing - ** a journal file. (although the in-memory journal implementation may - ** return SQLITE_IOERR_NOMEM while the journal file is being written). It - ** is therefore not possible for an in-memory pager to enter the ERROR - ** state. - */ - if( MEMDB ){ - assert( p->noSync ); - assert( p->journalMode==PAGER_JOURNALMODE_OFF - || p->journalMode==PAGER_JOURNALMODE_MEMORY - ); - assert( p->eState!=PAGER_ERROR && p->eState!=PAGER_OPEN ); - assert( pagerUseWal(p)==0 ); - } - - /* If changeCountDone is set, a RESERVED lock or greater must be held - ** on the file. - */ - assert( pPager->changeCountDone==0 || pPager->eLock>=RESERVED_LOCK ); - assert( p->eLock!=PENDING_LOCK ); - - switch( p->eState ){ - case PAGER_OPEN: - assert( !MEMDB ); - assert( pPager->errCode==SQLITE_OK ); - assert( sqlite3PcacheRefCount(pPager->pPCache)==0 || pPager->tempFile ); - break; - - case PAGER_READER: - assert( pPager->errCode==SQLITE_OK ); - assert( p->eLock!=UNKNOWN_LOCK ); - assert( p->eLock>=SHARED_LOCK ); - break; - - case PAGER_WRITER_LOCKED: - assert( p->eLock!=UNKNOWN_LOCK ); - assert( pPager->errCode==SQLITE_OK ); - if( !pagerUseWal(pPager) ){ - assert( p->eLock>=RESERVED_LOCK ); - } - assert( pPager->dbSize==pPager->dbOrigSize ); - assert( pPager->dbOrigSize==pPager->dbFileSize ); - assert( pPager->dbOrigSize==pPager->dbHintSize ); - assert( pPager->setMaster==0 ); - break; - - case PAGER_WRITER_CACHEMOD: - assert( p->eLock!=UNKNOWN_LOCK ); - assert( pPager->errCode==SQLITE_OK ); - if( !pagerUseWal(pPager) ){ - /* It is possible that if journal_mode=wal here that neither the - ** journal file nor the WAL file are open. This happens during - ** a rollback transaction that switches from journal_mode=off - ** to journal_mode=wal. - */ - assert( p->eLock>=RESERVED_LOCK ); - assert( isOpen(p->jfd) - || p->journalMode==PAGER_JOURNALMODE_OFF - || p->journalMode==PAGER_JOURNALMODE_WAL - ); - } - assert( pPager->dbOrigSize==pPager->dbFileSize ); - assert( pPager->dbOrigSize==pPager->dbHintSize ); - break; - - case PAGER_WRITER_DBMOD: - assert( p->eLock==EXCLUSIVE_LOCK ); - assert( pPager->errCode==SQLITE_OK ); - assert( !pagerUseWal(pPager) ); - assert( p->eLock>=EXCLUSIVE_LOCK ); - assert( isOpen(p->jfd) - || p->journalMode==PAGER_JOURNALMODE_OFF - || p->journalMode==PAGER_JOURNALMODE_WAL - ); - assert( pPager->dbOrigSize<=pPager->dbHintSize ); - break; - - case PAGER_WRITER_FINISHED: - assert( p->eLock==EXCLUSIVE_LOCK ); - assert( pPager->errCode==SQLITE_OK ); - assert( !pagerUseWal(pPager) ); - assert( isOpen(p->jfd) - || p->journalMode==PAGER_JOURNALMODE_OFF - || p->journalMode==PAGER_JOURNALMODE_WAL - ); - break; - - case PAGER_ERROR: - /* There must be at least one outstanding reference to the pager if - ** in ERROR state. Otherwise the pager should have already dropped - ** back to OPEN state. - */ - assert( pPager->errCode!=SQLITE_OK ); - assert( sqlite3PcacheRefCount(pPager->pPCache)>0 ); - break; - } - - return 1; -} -#endif /* ifndef NDEBUG */ - -#ifdef SQLITE_DEBUG -/* -** Return a pointer to a human readable string in a static buffer -** containing the state of the Pager object passed as an argument. This -** is intended to be used within debuggers. For example, as an alternative -** to "print *pPager" in gdb: -** -** (gdb) printf "%s", print_pager_state(pPager) -*/ -static char *print_pager_state(Pager *p){ - static char zRet[1024]; - - sqlite3_snprintf(1024, zRet, - "Filename: %s\n" - "State: %s errCode=%d\n" - "Lock: %s\n" - "Locking mode: locking_mode=%s\n" - "Journal mode: journal_mode=%s\n" - "Backing store: tempFile=%d memDb=%d useJournal=%d\n" - "Journal: journalOff=%lld journalHdr=%lld\n" - "Size: dbsize=%d dbOrigSize=%d dbFileSize=%d\n" - , p->zFilename - , p->eState==PAGER_OPEN ? "OPEN" : - p->eState==PAGER_READER ? "READER" : - p->eState==PAGER_WRITER_LOCKED ? "WRITER_LOCKED" : - p->eState==PAGER_WRITER_CACHEMOD ? "WRITER_CACHEMOD" : - p->eState==PAGER_WRITER_DBMOD ? "WRITER_DBMOD" : - p->eState==PAGER_WRITER_FINISHED ? "WRITER_FINISHED" : - p->eState==PAGER_ERROR ? "ERROR" : "?error?" - , (int)p->errCode - , p->eLock==NO_LOCK ? "NO_LOCK" : - p->eLock==RESERVED_LOCK ? "RESERVED" : - p->eLock==EXCLUSIVE_LOCK ? "EXCLUSIVE" : - p->eLock==SHARED_LOCK ? "SHARED" : - p->eLock==UNKNOWN_LOCK ? "UNKNOWN" : "?error?" - , p->exclusiveMode ? "exclusive" : "normal" - , p->journalMode==PAGER_JOURNALMODE_MEMORY ? "memory" : - p->journalMode==PAGER_JOURNALMODE_OFF ? "off" : - p->journalMode==PAGER_JOURNALMODE_DELETE ? "delete" : - p->journalMode==PAGER_JOURNALMODE_PERSIST ? "persist" : - p->journalMode==PAGER_JOURNALMODE_TRUNCATE ? "truncate" : - p->journalMode==PAGER_JOURNALMODE_WAL ? "wal" : "?error?" - , (int)p->tempFile, (int)p->memDb, (int)p->useJournal - , p->journalOff, p->journalHdr - , (int)p->dbSize, (int)p->dbOrigSize, (int)p->dbFileSize - ); - - return zRet; -} -#endif - -/* -** Return true if it is necessary to write page *pPg into the sub-journal. -** A page needs to be written into the sub-journal if there exists one -** or more open savepoints for which: -** -** * The page-number is less than or equal to PagerSavepoint.nOrig, and -** * The bit corresponding to the page-number is not set in -** PagerSavepoint.pInSavepoint. -*/ -static int subjRequiresPage(PgHdr *pPg){ - Pager *pPager = pPg->pPager; - PagerSavepoint *p; - Pgno pgno = pPg->pgno; - int i; - for(i=0; inSavepoint; i++){ - p = &pPager->aSavepoint[i]; - if( p->nOrig>=pgno && 0==sqlite3BitvecTest(p->pInSavepoint, pgno) ){ - return 1; - } - } - return 0; -} - -/* -** Return true if the page is already in the journal file. -*/ -static int pageInJournal(Pager *pPager, PgHdr *pPg){ - return sqlite3BitvecTest(pPager->pInJournal, pPg->pgno); -} - -/* -** Read a 32-bit integer from the given file descriptor. Store the integer -** that is read in *pRes. Return SQLITE_OK if everything worked, or an -** error code is something goes wrong. -** -** All values are stored on disk as big-endian. -*/ -static int read32bits(sqlite3_file *fd, i64 offset, u32 *pRes){ - unsigned char ac[4]; - int rc = sqlite3OsRead(fd, ac, sizeof(ac), offset); - if( rc==SQLITE_OK ){ - *pRes = sqlite3Get4byte(ac); - } - return rc; -} - -/* -** Write a 32-bit integer into a string buffer in big-endian byte order. -*/ -#define put32bits(A,B) sqlite3Put4byte((u8*)A,B) - - -/* -** Write a 32-bit integer into the given file descriptor. Return SQLITE_OK -** on success or an error code is something goes wrong. -*/ -static int write32bits(sqlite3_file *fd, i64 offset, u32 val){ - char ac[4]; - put32bits(ac, val); - return sqlite3OsWrite(fd, ac, 4, offset); -} - -/* -** Unlock the database file to level eLock, which must be either NO_LOCK -** or SHARED_LOCK. Regardless of whether or not the call to xUnlock() -** succeeds, set the Pager.eLock variable to match the (attempted) new lock. -** -** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is -** called, do not modify it. See the comment above the #define of -** UNKNOWN_LOCK for an explanation of this. -*/ -static int pagerUnlockDb(Pager *pPager, int eLock){ - int rc = SQLITE_OK; - - assert( !pPager->exclusiveMode || pPager->eLock==eLock ); - assert( eLock==NO_LOCK || eLock==SHARED_LOCK ); - assert( eLock!=NO_LOCK || pagerUseWal(pPager)==0 ); - if( isOpen(pPager->fd) ){ - assert( pPager->eLock>=eLock ); - rc = sqlite3OsUnlock(pPager->fd, eLock); - if( pPager->eLock!=UNKNOWN_LOCK ){ - pPager->eLock = (u8)eLock; - } - IOTRACE(("UNLOCK %p %d\n", pPager, eLock)) - } - return rc; -} - -/* -** Lock the database file to level eLock, which must be either SHARED_LOCK, -** RESERVED_LOCK or EXCLUSIVE_LOCK. If the caller is successful, set the -** Pager.eLock variable to the new locking state. -** -** Except, if Pager.eLock is set to UNKNOWN_LOCK when this function is -** called, do not modify it unless the new locking state is EXCLUSIVE_LOCK. -** See the comment above the #define of UNKNOWN_LOCK for an explanation -** of this. -*/ -static int pagerLockDb(Pager *pPager, int eLock){ - int rc = SQLITE_OK; - - assert( eLock==SHARED_LOCK || eLock==RESERVED_LOCK || eLock==EXCLUSIVE_LOCK ); - if( pPager->eLockeLock==UNKNOWN_LOCK ){ - rc = sqlite3OsLock(pPager->fd, eLock); - if( rc==SQLITE_OK && (pPager->eLock!=UNKNOWN_LOCK||eLock==EXCLUSIVE_LOCK) ){ - pPager->eLock = (u8)eLock; - IOTRACE(("LOCK %p %d\n", pPager, eLock)) - } - } - return rc; -} - -/* -** This function determines whether or not the atomic-write optimization -** can be used with this pager. The optimization can be used if: -** -** (a) the value returned by OsDeviceCharacteristics() indicates that -** a database page may be written atomically, and -** (b) the value returned by OsSectorSize() is less than or equal -** to the page size. -** -** The optimization is also always enabled for temporary files. It is -** an error to call this function if pPager is opened on an in-memory -** database. -** -** If the optimization cannot be used, 0 is returned. If it can be used, -** then the value returned is the size of the journal file when it -** contains rollback data for exactly one page. -*/ -#ifdef SQLITE_ENABLE_ATOMIC_WRITE -static int jrnlBufferSize(Pager *pPager){ - assert( !MEMDB ); - if( !pPager->tempFile ){ - int dc; /* Device characteristics */ - int nSector; /* Sector size */ - int szPage; /* Page size */ - - assert( isOpen(pPager->fd) ); - dc = sqlite3OsDeviceCharacteristics(pPager->fd); - nSector = pPager->sectorSize; - szPage = pPager->pageSize; - - assert(SQLITE_IOCAP_ATOMIC512==(512>>8)); - assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8)); - if( 0==(dc&(SQLITE_IOCAP_ATOMIC|(szPage>>8)) || nSector>szPage) ){ - return 0; - } - } - - return JOURNAL_HDR_SZ(pPager) + JOURNAL_PG_SZ(pPager); -} -#endif - -/* -** If SQLITE_CHECK_PAGES is defined then we do some sanity checking -** on the cache using a hash function. This is used for testing -** and debugging only. -*/ -#ifdef SQLITE_CHECK_PAGES -/* -** Return a 32-bit hash of the page data for pPage. -*/ -static u32 pager_datahash(int nByte, unsigned char *pData){ - u32 hash = 0; - int i; - for(i=0; ipPager->pageSize, (unsigned char *)pPage->pData); -} -static void pager_set_pagehash(PgHdr *pPage){ - pPage->pageHash = pager_pagehash(pPage); -} - -/* -** The CHECK_PAGE macro takes a PgHdr* as an argument. If SQLITE_CHECK_PAGES -** is defined, and NDEBUG is not defined, an assert() statement checks -** that the page is either dirty or still matches the calculated page-hash. -*/ -#define CHECK_PAGE(x) checkPage(x) -static void checkPage(PgHdr *pPg){ - Pager *pPager = pPg->pPager; - assert( pPager->eState!=PAGER_ERROR ); - assert( (pPg->flags&PGHDR_DIRTY) || pPg->pageHash==pager_pagehash(pPg) ); -} - -#else -#define pager_datahash(X,Y) 0 -#define pager_pagehash(X) 0 -#define pager_set_pagehash(X) -#define CHECK_PAGE(x) -#endif /* SQLITE_CHECK_PAGES */ - -/* -** When this is called the journal file for pager pPager must be open. -** This function attempts to read a master journal file name from the -** end of the file and, if successful, copies it into memory supplied -** by the caller. See comments above writeMasterJournal() for the format -** used to store a master journal file name at the end of a journal file. -** -** zMaster must point to a buffer of at least nMaster bytes allocated by -** the caller. This should be sqlite3_vfs.mxPathname+1 (to ensure there is -** enough space to write the master journal name). If the master journal -** name in the journal is longer than nMaster bytes (including a -** nul-terminator), then this is handled as if no master journal name -** were present in the journal. -** -** If a master journal file name is present at the end of the journal -** file, then it is copied into the buffer pointed to by zMaster. A -** nul-terminator byte is appended to the buffer following the master -** journal file name. -** -** If it is determined that no master journal file name is present -** zMaster[0] is set to 0 and SQLITE_OK returned. -** -** If an error occurs while reading from the journal file, an SQLite -** error code is returned. -*/ -static int readMasterJournal(sqlite3_file *pJrnl, char *zMaster, u32 nMaster){ - int rc; /* Return code */ - u32 len; /* Length in bytes of master journal name */ - i64 szJ; /* Total size in bytes of journal file pJrnl */ - u32 cksum; /* MJ checksum value read from journal */ - u32 u; /* Unsigned loop counter */ - unsigned char aMagic[8]; /* A buffer to hold the magic header */ - zMaster[0] = '\0'; - - if( SQLITE_OK!=(rc = sqlite3OsFileSize(pJrnl, &szJ)) - || szJ<16 - || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-16, &len)) - || len>=nMaster - || len==0 - || SQLITE_OK!=(rc = read32bits(pJrnl, szJ-12, &cksum)) - || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, aMagic, 8, szJ-8)) - || memcmp(aMagic, aJournalMagic, 8) - || SQLITE_OK!=(rc = sqlite3OsRead(pJrnl, zMaster, len, szJ-16-len)) - ){ - return rc; - } - - /* See if the checksum matches the master journal name */ - for(u=0; ujournalOff, assuming a sector -** size of pPager->sectorSize bytes. -** -** i.e for a sector size of 512: -** -** Pager.journalOff Return value -** --------------------------------------- -** 0 0 -** 512 512 -** 100 512 -** 2000 2048 -** -*/ -static i64 journalHdrOffset(Pager *pPager){ - i64 offset = 0; - i64 c = pPager->journalOff; - if( c ){ - offset = ((c-1)/JOURNAL_HDR_SZ(pPager) + 1) * JOURNAL_HDR_SZ(pPager); - } - assert( offset%JOURNAL_HDR_SZ(pPager)==0 ); - assert( offset>=c ); - assert( (offset-c)jfd) ); - if( pPager->journalOff ){ - const i64 iLimit = pPager->journalSizeLimit; /* Local cache of jsl */ - - IOTRACE(("JZEROHDR %p\n", pPager)) - if( doTruncate || iLimit==0 ){ - rc = sqlite3OsTruncate(pPager->jfd, 0); - }else{ - static const char zeroHdr[28] = {0}; - rc = sqlite3OsWrite(pPager->jfd, zeroHdr, sizeof(zeroHdr), 0); - } - if( rc==SQLITE_OK && !pPager->noSync ){ - rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_DATAONLY|pPager->syncFlags); - } - - /* At this point the transaction is committed but the write lock - ** is still held on the file. If there is a size limit configured for - ** the persistent journal and the journal file currently consumes more - ** space than that limit allows for, truncate it now. There is no need - ** to sync the file following this operation. - */ - if( rc==SQLITE_OK && iLimit>0 ){ - i64 sz; - rc = sqlite3OsFileSize(pPager->jfd, &sz); - if( rc==SQLITE_OK && sz>iLimit ){ - rc = sqlite3OsTruncate(pPager->jfd, iLimit); - } - } - } - return rc; -} - -/* -** The journal file must be open when this routine is called. A journal -** header (JOURNAL_HDR_SZ bytes) is written into the journal file at the -** current location. -** -** The format for the journal header is as follows: -** - 8 bytes: Magic identifying journal format. -** - 4 bytes: Number of records in journal, or -1 no-sync mode is on. -** - 4 bytes: Random number used for page hash. -** - 4 bytes: Initial database page count. -** - 4 bytes: Sector size used by the process that wrote this journal. -** - 4 bytes: Database page size. -** -** Followed by (JOURNAL_HDR_SZ - 28) bytes of unused space. -*/ -static int writeJournalHdr(Pager *pPager){ - int rc = SQLITE_OK; /* Return code */ - char *zHeader = pPager->pTmpSpace; /* Temporary space used to build header */ - u32 nHeader = (u32)pPager->pageSize;/* Size of buffer pointed to by zHeader */ - u32 nWrite; /* Bytes of header sector written */ - int ii; /* Loop counter */ - - assert( isOpen(pPager->jfd) ); /* Journal file must be open. */ - - if( nHeader>JOURNAL_HDR_SZ(pPager) ){ - nHeader = JOURNAL_HDR_SZ(pPager); - } - - /* If there are active savepoints and any of them were created - ** since the most recent journal header was written, update the - ** PagerSavepoint.iHdrOffset fields now. - */ - for(ii=0; iinSavepoint; ii++){ - if( pPager->aSavepoint[ii].iHdrOffset==0 ){ - pPager->aSavepoint[ii].iHdrOffset = pPager->journalOff; - } - } - - pPager->journalHdr = pPager->journalOff = journalHdrOffset(pPager); - - /* - ** Write the nRec Field - the number of page records that follow this - ** journal header. Normally, zero is written to this value at this time. - ** After the records are added to the journal (and the journal synced, - ** if in full-sync mode), the zero is overwritten with the true number - ** of records (see syncJournal()). - ** - ** A faster alternative is to write 0xFFFFFFFF to the nRec field. When - ** reading the journal this value tells SQLite to assume that the - ** rest of the journal file contains valid page records. This assumption - ** is dangerous, as if a failure occurred whilst writing to the journal - ** file it may contain some garbage data. There are two scenarios - ** where this risk can be ignored: - ** - ** * When the pager is in no-sync mode. Corruption can follow a - ** power failure in this case anyway. - ** - ** * When the SQLITE_IOCAP_SAFE_APPEND flag is set. This guarantees - ** that garbage data is never appended to the journal file. - */ - assert( isOpen(pPager->fd) || pPager->noSync ); - if( pPager->noSync || (pPager->journalMode==PAGER_JOURNALMODE_MEMORY) - || (sqlite3OsDeviceCharacteristics(pPager->fd)&SQLITE_IOCAP_SAFE_APPEND) - ){ - memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic)); - put32bits(&zHeader[sizeof(aJournalMagic)], 0xffffffff); - }else{ - memset(zHeader, 0, sizeof(aJournalMagic)+4); - } - - /* The random check-hash initializer */ - sqlite3_randomness(sizeof(pPager->cksumInit), &pPager->cksumInit); - put32bits(&zHeader[sizeof(aJournalMagic)+4], pPager->cksumInit); - /* The initial database size */ - put32bits(&zHeader[sizeof(aJournalMagic)+8], pPager->dbOrigSize); - /* The assumed sector size for this process */ - put32bits(&zHeader[sizeof(aJournalMagic)+12], pPager->sectorSize); - - /* The page size */ - put32bits(&zHeader[sizeof(aJournalMagic)+16], pPager->pageSize); - - /* Initializing the tail of the buffer is not necessary. Everything - ** works find if the following memset() is omitted. But initializing - ** the memory prevents valgrind from complaining, so we are willing to - ** take the performance hit. - */ - memset(&zHeader[sizeof(aJournalMagic)+20], 0, - nHeader-(sizeof(aJournalMagic)+20)); - - /* In theory, it is only necessary to write the 28 bytes that the - ** journal header consumes to the journal file here. Then increment the - ** Pager.journalOff variable by JOURNAL_HDR_SZ so that the next - ** record is written to the following sector (leaving a gap in the file - ** that will be implicitly filled in by the OS). - ** - ** However it has been discovered that on some systems this pattern can - ** be significantly slower than contiguously writing data to the file, - ** even if that means explicitly writing data to the block of - ** (JOURNAL_HDR_SZ - 28) bytes that will not be used. So that is what - ** is done. - ** - ** The loop is required here in case the sector-size is larger than the - ** database page size. Since the zHeader buffer is only Pager.pageSize - ** bytes in size, more than one call to sqlite3OsWrite() may be required - ** to populate the entire journal header sector. - */ - for(nWrite=0; rc==SQLITE_OK&&nWritejournalHdr, nHeader)) - rc = sqlite3OsWrite(pPager->jfd, zHeader, nHeader, pPager->journalOff); - assert( pPager->journalHdr <= pPager->journalOff ); - pPager->journalOff += nHeader; - } - - return rc; -} - -/* -** The journal file must be open when this is called. A journal header file -** (JOURNAL_HDR_SZ bytes) is read from the current location in the journal -** file. The current location in the journal file is given by -** pPager->journalOff. See comments above function writeJournalHdr() for -** a description of the journal header format. -** -** If the header is read successfully, *pNRec is set to the number of -** page records following this header and *pDbSize is set to the size of the -** database before the transaction began, in pages. Also, pPager->cksumInit -** is set to the value read from the journal header. SQLITE_OK is returned -** in this case. -** -** If the journal header file appears to be corrupted, SQLITE_DONE is -** returned and *pNRec and *PDbSize are undefined. If JOURNAL_HDR_SZ bytes -** cannot be read from the journal file an error code is returned. -*/ -static int readJournalHdr( - Pager *pPager, /* Pager object */ - int isHot, - i64 journalSize, /* Size of the open journal file in bytes */ - u32 *pNRec, /* OUT: Value read from the nRec field */ - u32 *pDbSize /* OUT: Value of original database size field */ -){ - int rc; /* Return code */ - unsigned char aMagic[8]; /* A buffer to hold the magic header */ - i64 iHdrOff; /* Offset of journal header being read */ - - assert( isOpen(pPager->jfd) ); /* Journal file must be open. */ - - /* Advance Pager.journalOff to the start of the next sector. If the - ** journal file is too small for there to be a header stored at this - ** point, return SQLITE_DONE. - */ - pPager->journalOff = journalHdrOffset(pPager); - if( pPager->journalOff+JOURNAL_HDR_SZ(pPager) > journalSize ){ - return SQLITE_DONE; - } - iHdrOff = pPager->journalOff; - - /* Read in the first 8 bytes of the journal header. If they do not match - ** the magic string found at the start of each journal header, return - ** SQLITE_DONE. If an IO error occurs, return an error code. Otherwise, - ** proceed. - */ - if( isHot || iHdrOff!=pPager->journalHdr ){ - rc = sqlite3OsRead(pPager->jfd, aMagic, sizeof(aMagic), iHdrOff); - if( rc ){ - return rc; - } - if( memcmp(aMagic, aJournalMagic, sizeof(aMagic))!=0 ){ - return SQLITE_DONE; - } - } - - /* Read the first three 32-bit fields of the journal header: The nRec - ** field, the checksum-initializer and the database size at the start - ** of the transaction. Return an error code if anything goes wrong. - */ - if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+8, pNRec)) - || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+12, &pPager->cksumInit)) - || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+16, pDbSize)) - ){ - return rc; - } - - if( pPager->journalOff==0 ){ - u32 iPageSize; /* Page-size field of journal header */ - u32 iSectorSize; /* Sector-size field of journal header */ - - /* Read the page-size and sector-size journal header fields. */ - if( SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+20, &iSectorSize)) - || SQLITE_OK!=(rc = read32bits(pPager->jfd, iHdrOff+24, &iPageSize)) - ){ - return rc; - } - - /* Versions of SQLite prior to 3.5.8 set the page-size field of the - ** journal header to zero. In this case, assume that the Pager.pageSize - ** variable is already set to the correct page size. - */ - if( iPageSize==0 ){ - iPageSize = pPager->pageSize; - } - - /* Check that the values read from the page-size and sector-size fields - ** are within range. To be 'in range', both values need to be a power - ** of two greater than or equal to 512 or 32, and not greater than their - ** respective compile time maximum limits. - */ - if( iPageSize<512 || iSectorSize<32 - || iPageSize>SQLITE_MAX_PAGE_SIZE || iSectorSize>MAX_SECTOR_SIZE - || ((iPageSize-1)&iPageSize)!=0 || ((iSectorSize-1)&iSectorSize)!=0 - ){ - /* If the either the page-size or sector-size in the journal-header is - ** invalid, then the process that wrote the journal-header must have - ** crashed before the header was synced. In this case stop reading - ** the journal file here. - */ - return SQLITE_DONE; - } - - /* Update the page-size to match the value read from the journal. - ** Use a testcase() macro to make sure that malloc failure within - ** PagerSetPagesize() is tested. - */ - rc = sqlite3PagerSetPagesize(pPager, &iPageSize, -1); - testcase( rc!=SQLITE_OK ); - - /* Update the assumed sector-size to match the value used by - ** the process that created this journal. If this journal was - ** created by a process other than this one, then this routine - ** is being called from within pager_playback(). The local value - ** of Pager.sectorSize is restored at the end of that routine. - */ - pPager->sectorSize = iSectorSize; - } - - pPager->journalOff += JOURNAL_HDR_SZ(pPager); - return rc; -} - - -/* -** Write the supplied master journal name into the journal file for pager -** pPager at the current location. The master journal name must be the last -** thing written to a journal file. If the pager is in full-sync mode, the -** journal file descriptor is advanced to the next sector boundary before -** anything is written. The format is: -** -** + 4 bytes: PAGER_MJ_PGNO. -** + N bytes: Master journal filename in utf-8. -** + 4 bytes: N (length of master journal name in bytes, no nul-terminator). -** + 4 bytes: Master journal name checksum. -** + 8 bytes: aJournalMagic[]. -** -** The master journal page checksum is the sum of the bytes in the master -** journal name, where each byte is interpreted as a signed 8-bit integer. -** -** If zMaster is a NULL pointer (occurs for a single database transaction), -** this call is a no-op. -*/ -static int writeMasterJournal(Pager *pPager, const char *zMaster){ - int rc; /* Return code */ - int nMaster; /* Length of string zMaster */ - i64 iHdrOff; /* Offset of header in journal file */ - i64 jrnlSize; /* Size of journal file on disk */ - u32 cksum = 0; /* Checksum of string zMaster */ - - assert( pPager->setMaster==0 ); - assert( !pagerUseWal(pPager) ); - - if( !zMaster - || pPager->journalMode==PAGER_JOURNALMODE_MEMORY - || pPager->journalMode==PAGER_JOURNALMODE_OFF - ){ - return SQLITE_OK; - } - pPager->setMaster = 1; - assert( isOpen(pPager->jfd) ); - assert( pPager->journalHdr <= pPager->journalOff ); - - /* Calculate the length in bytes and the checksum of zMaster */ - for(nMaster=0; zMaster[nMaster]; nMaster++){ - cksum += zMaster[nMaster]; - } - - /* If in full-sync mode, advance to the next disk sector before writing - ** the master journal name. This is in case the previous page written to - ** the journal has already been synced. - */ - if( pPager->fullSync ){ - pPager->journalOff = journalHdrOffset(pPager); - } - iHdrOff = pPager->journalOff; - - /* Write the master journal data to the end of the journal file. If - ** an error occurs, return the error code to the caller. - */ - if( (0 != (rc = write32bits(pPager->jfd, iHdrOff, PAGER_MJ_PGNO(pPager)))) - || (0 != (rc = sqlite3OsWrite(pPager->jfd, zMaster, nMaster, iHdrOff+4))) - || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster, nMaster))) - || (0 != (rc = write32bits(pPager->jfd, iHdrOff+4+nMaster+4, cksum))) - || (0 != (rc = sqlite3OsWrite(pPager->jfd, aJournalMagic, 8, iHdrOff+4+nMaster+8))) - ){ - return rc; - } - pPager->journalOff += (nMaster+20); - - /* If the pager is in peristent-journal mode, then the physical - ** journal-file may extend past the end of the master-journal name - ** and 8 bytes of magic data just written to the file. This is - ** dangerous because the code to rollback a hot-journal file - ** will not be able to find the master-journal name to determine - ** whether or not the journal is hot. - ** - ** Easiest thing to do in this scenario is to truncate the journal - ** file to the required size. - */ - if( SQLITE_OK==(rc = sqlite3OsFileSize(pPager->jfd, &jrnlSize)) - && jrnlSize>pPager->journalOff - ){ - rc = sqlite3OsTruncate(pPager->jfd, pPager->journalOff); - } - return rc; -} - -/* -** Find a page in the hash table given its page number. Return -** a pointer to the page or NULL if the requested page is not -** already in memory. -*/ -static PgHdr *pager_lookup(Pager *pPager, Pgno pgno){ - PgHdr *p = 0; /* Return value */ - - /* It is not possible for a call to PcacheFetch() with createFlag==0 to - ** fail, since no attempt to allocate dynamic memory will be made. - */ - (void)sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &p); - return p; -} - -/* -** Discard the entire contents of the in-memory page-cache. -*/ -static void pager_reset(Pager *pPager){ - sqlite3BackupRestart(pPager->pBackup); - sqlite3PcacheClear(pPager->pPCache); -} - -/* -** Free all structures in the Pager.aSavepoint[] array and set both -** Pager.aSavepoint and Pager.nSavepoint to zero. Close the sub-journal -** if it is open and the pager is not in exclusive mode. -*/ -static void releaseAllSavepoints(Pager *pPager){ - int ii; /* Iterator for looping through Pager.aSavepoint */ - for(ii=0; iinSavepoint; ii++){ - sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint); - } - if( !pPager->exclusiveMode || sqlite3IsMemJournal(pPager->sjfd) ){ - sqlite3OsClose(pPager->sjfd); - } - sqlite3_free(pPager->aSavepoint); - pPager->aSavepoint = 0; - pPager->nSavepoint = 0; - pPager->nSubRec = 0; -} - -/* -** Set the bit number pgno in the PagerSavepoint.pInSavepoint -** bitvecs of all open savepoints. Return SQLITE_OK if successful -** or SQLITE_NOMEM if a malloc failure occurs. -*/ -static int addToSavepointBitvecs(Pager *pPager, Pgno pgno){ - int ii; /* Loop counter */ - int rc = SQLITE_OK; /* Result code */ - - for(ii=0; iinSavepoint; ii++){ - PagerSavepoint *p = &pPager->aSavepoint[ii]; - if( pgno<=p->nOrig ){ - rc |= sqlite3BitvecSet(p->pInSavepoint, pgno); - testcase( rc==SQLITE_NOMEM ); - assert( rc==SQLITE_OK || rc==SQLITE_NOMEM ); - } - } - return rc; -} - -/* -** This function is a no-op if the pager is in exclusive mode and not -** in the ERROR state. Otherwise, it switches the pager to PAGER_OPEN -** state. -** -** If the pager is not in exclusive-access mode, the database file is -** completely unlocked. If the file is unlocked and the file-system does -** not exhibit the UNDELETABLE_WHEN_OPEN property, the journal file is -** closed (if it is open). -** -** If the pager is in ERROR state when this function is called, the -** contents of the pager cache are discarded before switching back to -** the OPEN state. Regardless of whether the pager is in exclusive-mode -** or not, any journal file left in the file-system will be treated -** as a hot-journal and rolled back the next time a read-transaction -** is opened (by this or by any other connection). -*/ -static void pager_unlock(Pager *pPager){ - - assert( pPager->eState==PAGER_READER - || pPager->eState==PAGER_OPEN - || pPager->eState==PAGER_ERROR - ); - - sqlite3BitvecDestroy(pPager->pInJournal); - pPager->pInJournal = 0; - releaseAllSavepoints(pPager); - - if( pagerUseWal(pPager) ){ - assert( !isOpen(pPager->jfd) ); - sqlite3WalEndReadTransaction(pPager->pWal); - pPager->eState = PAGER_OPEN; - }else if( !pPager->exclusiveMode ){ - int rc; /* Error code returned by pagerUnlockDb() */ - int iDc = isOpen(pPager->fd)?sqlite3OsDeviceCharacteristics(pPager->fd):0; - - /* If the operating system support deletion of open files, then - ** close the journal file when dropping the database lock. Otherwise - ** another connection with journal_mode=delete might delete the file - ** out from under us. - */ - assert( (PAGER_JOURNALMODE_MEMORY & 5)!=1 ); - assert( (PAGER_JOURNALMODE_OFF & 5)!=1 ); - assert( (PAGER_JOURNALMODE_WAL & 5)!=1 ); - assert( (PAGER_JOURNALMODE_DELETE & 5)!=1 ); - assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 ); - assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 ); - if( 0==(iDc & SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN) - || 1!=(pPager->journalMode & 5) - ){ - sqlite3OsClose(pPager->jfd); - } - - /* If the pager is in the ERROR state and the call to unlock the database - ** file fails, set the current lock to UNKNOWN_LOCK. See the comment - ** above the #define for UNKNOWN_LOCK for an explanation of why this - ** is necessary. - */ - rc = pagerUnlockDb(pPager, NO_LOCK); - if( rc!=SQLITE_OK && pPager->eState==PAGER_ERROR ){ - pPager->eLock = UNKNOWN_LOCK; - } - - /* The pager state may be changed from PAGER_ERROR to PAGER_OPEN here - ** without clearing the error code. This is intentional - the error - ** code is cleared and the cache reset in the block below. - */ - assert( pPager->errCode || pPager->eState!=PAGER_ERROR ); - pPager->changeCountDone = 0; - pPager->eState = PAGER_OPEN; - } - - /* If Pager.errCode is set, the contents of the pager cache cannot be - ** trusted. Now that there are no outstanding references to the pager, - ** it can safely move back to PAGER_OPEN state. This happens in both - ** normal and exclusive-locking mode. - */ - if( pPager->errCode ){ - assert( !MEMDB ); - pager_reset(pPager); - pPager->changeCountDone = pPager->tempFile; - pPager->eState = PAGER_OPEN; - pPager->errCode = SQLITE_OK; - if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0); - } - - pPager->journalOff = 0; - pPager->journalHdr = 0; - pPager->setMaster = 0; -} - -/* -** This function is called whenever an IOERR or FULL error that requires -** the pager to transition into the ERROR state may ahve occurred. -** The first argument is a pointer to the pager structure, the second -** the error-code about to be returned by a pager API function. The -** value returned is a copy of the second argument to this function. -** -** If the second argument is SQLITE_FULL, SQLITE_IOERR or one of the -** IOERR sub-codes, the pager enters the ERROR state and the error code -** is stored in Pager.errCode. While the pager remains in the ERROR state, -** all major API calls on the Pager will immediately return Pager.errCode. -** -** The ERROR state indicates that the contents of the pager-cache -** cannot be trusted. This state can be cleared by completely discarding -** the contents of the pager-cache. If a transaction was active when -** the persistent error occurred, then the rollback journal may need -** to be replayed to restore the contents of the database file (as if -** it were a hot-journal). -*/ -static int pager_error(Pager *pPager, int rc){ - int rc2 = rc & 0xff; - assert( rc==SQLITE_OK || !MEMDB ); - assert( - pPager->errCode==SQLITE_FULL || - pPager->errCode==SQLITE_OK || - (pPager->errCode & 0xff)==SQLITE_IOERR - ); - if( rc2==SQLITE_FULL || rc2==SQLITE_IOERR ){ - pPager->errCode = rc; - pPager->eState = PAGER_ERROR; - } - return rc; -} - -static int pager_truncate(Pager *pPager, Pgno nPage); - -/* -** This routine ends a transaction. A transaction is usually ended by -** either a COMMIT or a ROLLBACK operation. This routine may be called -** after rollback of a hot-journal, or if an error occurs while opening -** the journal file or writing the very first journal-header of a -** database transaction. -** -** This routine is never called in PAGER_ERROR state. If it is called -** in PAGER_NONE or PAGER_SHARED state and the lock held is less -** exclusive than a RESERVED lock, it is a no-op. -** -** Otherwise, any active savepoints are released. -** -** If the journal file is open, then it is "finalized". Once a journal -** file has been finalized it is not possible to use it to roll back a -** transaction. Nor will it be considered to be a hot-journal by this -** or any other database connection. Exactly how a journal is finalized -** depends on whether or not the pager is running in exclusive mode and -** the current journal-mode (Pager.journalMode value), as follows: -** -** journalMode==MEMORY -** Journal file descriptor is simply closed. This destroys an -** in-memory journal. -** -** journalMode==TRUNCATE -** Journal file is truncated to zero bytes in size. -** -** journalMode==PERSIST -** The first 28 bytes of the journal file are zeroed. This invalidates -** the first journal header in the file, and hence the entire journal -** file. An invalid journal file cannot be rolled back. -** -** journalMode==DELETE -** The journal file is closed and deleted using sqlite3OsDelete(). -** -** If the pager is running in exclusive mode, this method of finalizing -** the journal file is never used. Instead, if the journalMode is -** DELETE and the pager is in exclusive mode, the method described under -** journalMode==PERSIST is used instead. -** -** After the journal is finalized, the pager moves to PAGER_READER state. -** If running in non-exclusive rollback mode, the lock on the file is -** downgraded to a SHARED_LOCK. -** -** SQLITE_OK is returned if no error occurs. If an error occurs during -** any of the IO operations to finalize the journal file or unlock the -** database then the IO error code is returned to the user. If the -** operation to finalize the journal file fails, then the code still -** tries to unlock the database file if not in exclusive mode. If the -** unlock operation fails as well, then the first error code related -** to the first error encountered (the journal finalization one) is -** returned. -*/ -static int pager_end_transaction(Pager *pPager, int hasMaster, int bCommit){ - int rc = SQLITE_OK; /* Error code from journal finalization operation */ - int rc2 = SQLITE_OK; /* Error code from db file unlock operation */ - - /* Do nothing if the pager does not have an open write transaction - ** or at least a RESERVED lock. This function may be called when there - ** is no write-transaction active but a RESERVED or greater lock is - ** held under two circumstances: - ** - ** 1. After a successful hot-journal rollback, it is called with - ** eState==PAGER_NONE and eLock==EXCLUSIVE_LOCK. - ** - ** 2. If a connection with locking_mode=exclusive holding an EXCLUSIVE - ** lock switches back to locking_mode=normal and then executes a - ** read-transaction, this function is called with eState==PAGER_READER - ** and eLock==EXCLUSIVE_LOCK when the read-transaction is closed. - */ - assert( assert_pager_state(pPager) ); - assert( pPager->eState!=PAGER_ERROR ); - if( pPager->eStateeLockjfd) || pPager->pInJournal==0 ); - if( isOpen(pPager->jfd) ){ - assert( !pagerUseWal(pPager) ); - - /* Finalize the journal file. */ - if( sqlite3IsMemJournal(pPager->jfd) ){ - assert( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ); - sqlite3OsClose(pPager->jfd); - }else if( pPager->journalMode==PAGER_JOURNALMODE_TRUNCATE ){ - if( pPager->journalOff==0 ){ - rc = SQLITE_OK; - }else{ - rc = sqlite3OsTruncate(pPager->jfd, 0); - } - pPager->journalOff = 0; - }else if( pPager->journalMode==PAGER_JOURNALMODE_PERSIST - || (pPager->exclusiveMode && pPager->journalMode!=PAGER_JOURNALMODE_WAL) - ){ - rc = zeroJournalHdr(pPager, hasMaster); - pPager->journalOff = 0; - }else{ - /* This branch may be executed with Pager.journalMode==MEMORY if - ** a hot-journal was just rolled back. In this case the journal - ** file should be closed and deleted. If this connection writes to - ** the database file, it will do so using an in-memory journal. - */ - int bDelete = (!pPager->tempFile && sqlite3JournalExists(pPager->jfd)); - assert( pPager->journalMode==PAGER_JOURNALMODE_DELETE - || pPager->journalMode==PAGER_JOURNALMODE_MEMORY - || pPager->journalMode==PAGER_JOURNALMODE_WAL - ); - sqlite3OsClose(pPager->jfd); - if( bDelete ){ - rc = sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); - } - } - } - -#ifdef SQLITE_CHECK_PAGES - sqlite3PcacheIterateDirty(pPager->pPCache, pager_set_pagehash); - if( pPager->dbSize==0 && sqlite3PcacheRefCount(pPager->pPCache)>0 ){ - PgHdr *p = pager_lookup(pPager, 1); - if( p ){ - p->pageHash = 0; - sqlite3PagerUnrefNotNull(p); - } - } -#endif - - sqlite3BitvecDestroy(pPager->pInJournal); - pPager->pInJournal = 0; - pPager->nRec = 0; - sqlite3PcacheCleanAll(pPager->pPCache); - sqlite3PcacheTruncate(pPager->pPCache, pPager->dbSize); - - if( pagerUseWal(pPager) ){ - /* Drop the WAL write-lock, if any. Also, if the connection was in - ** locking_mode=exclusive mode but is no longer, drop the EXCLUSIVE - ** lock held on the database file. - */ - rc2 = sqlite3WalEndWriteTransaction(pPager->pWal); - assert( rc2==SQLITE_OK ); - }else if( rc==SQLITE_OK && bCommit && pPager->dbFileSize>pPager->dbSize ){ - /* This branch is taken when committing a transaction in rollback-journal - ** mode if the database file on disk is larger than the database image. - ** At this point the journal has been finalized and the transaction - ** successfully committed, but the EXCLUSIVE lock is still held on the - ** file. So it is safe to truncate the database file to its minimum - ** required size. */ - assert( pPager->eLock==EXCLUSIVE_LOCK ); - rc = pager_truncate(pPager, pPager->dbSize); - } - - if( rc==SQLITE_OK && bCommit && isOpen(pPager->fd) ){ - rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_COMMIT_PHASETWO, 0); - if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; - } - - if( !pPager->exclusiveMode - && (!pagerUseWal(pPager) || sqlite3WalExclusiveMode(pPager->pWal, 0)) - ){ - rc2 = pagerUnlockDb(pPager, SHARED_LOCK); - pPager->changeCountDone = 0; - } - pPager->eState = PAGER_READER; - pPager->setMaster = 0; - - return (rc==SQLITE_OK?rc2:rc); -} - -/* -** Execute a rollback if a transaction is active and unlock the -** database file. -** -** If the pager has already entered the ERROR state, do not attempt -** the rollback at this time. Instead, pager_unlock() is called. The -** call to pager_unlock() will discard all in-memory pages, unlock -** the database file and move the pager back to OPEN state. If this -** means that there is a hot-journal left in the file-system, the next -** connection to obtain a shared lock on the pager (which may be this one) -** will roll it back. -** -** If the pager has not already entered the ERROR state, but an IO or -** malloc error occurs during a rollback, then this will itself cause -** the pager to enter the ERROR state. Which will be cleared by the -** call to pager_unlock(), as described above. -*/ -static void pagerUnlockAndRollback(Pager *pPager){ - if( pPager->eState!=PAGER_ERROR && pPager->eState!=PAGER_OPEN ){ - assert( assert_pager_state(pPager) ); - if( pPager->eState>=PAGER_WRITER_LOCKED ){ - sqlite3BeginBenignMalloc(); - sqlite3PagerRollback(pPager); - sqlite3EndBenignMalloc(); - }else if( !pPager->exclusiveMode ){ - assert( pPager->eState==PAGER_READER ); - pager_end_transaction(pPager, 0, 0); - } - } - pager_unlock(pPager); -} - -/* -** Parameter aData must point to a buffer of pPager->pageSize bytes -** of data. Compute and return a checksum based ont the contents of the -** page of data and the current value of pPager->cksumInit. -** -** This is not a real checksum. It is really just the sum of the -** random initial value (pPager->cksumInit) and every 200th byte -** of the page data, starting with byte offset (pPager->pageSize%200). -** Each byte is interpreted as an 8-bit unsigned integer. -** -** Changing the formula used to compute this checksum results in an -** incompatible journal file format. -** -** If journal corruption occurs due to a power failure, the most likely -** scenario is that one end or the other of the record will be changed. -** It is much less likely that the two ends of the journal record will be -** correct and the middle be corrupt. Thus, this "checksum" scheme, -** though fast and simple, catches the mostly likely kind of corruption. -*/ -static u32 pager_cksum(Pager *pPager, const u8 *aData){ - u32 cksum = pPager->cksumInit; /* Checksum value to return */ - int i = pPager->pageSize-200; /* Loop counter */ - while( i>0 ){ - cksum += aData[i]; - i -= 200; - } - return cksum; -} - -/* -** Report the current page size and number of reserved bytes back -** to the codec. -*/ -#ifdef SQLITE_HAS_CODEC -static void pagerReportSize(Pager *pPager){ - if( pPager->xCodecSizeChng ){ - pPager->xCodecSizeChng(pPager->pCodec, pPager->pageSize, - (int)pPager->nReserve); - } -} -#else -# define pagerReportSize(X) /* No-op if we do not support a codec */ -#endif - -/* -** Read a single page from either the journal file (if isMainJrnl==1) or -** from the sub-journal (if isMainJrnl==0) and playback that page. -** The page begins at offset *pOffset into the file. The *pOffset -** value is increased to the start of the next page in the journal. -** -** The main rollback journal uses checksums - the statement journal does -** not. -** -** If the page number of the page record read from the (sub-)journal file -** is greater than the current value of Pager.dbSize, then playback is -** skipped and SQLITE_OK is returned. -** -** If pDone is not NULL, then it is a record of pages that have already -** been played back. If the page at *pOffset has already been played back -** (if the corresponding pDone bit is set) then skip the playback. -** Make sure the pDone bit corresponding to the *pOffset page is set -** prior to returning. -** -** If the page record is successfully read from the (sub-)journal file -** and played back, then SQLITE_OK is returned. If an IO error occurs -** while reading the record from the (sub-)journal file or while writing -** to the database file, then the IO error code is returned. If data -** is successfully read from the (sub-)journal file but appears to be -** corrupted, SQLITE_DONE is returned. Data is considered corrupted in -** two circumstances: -** -** * If the record page-number is illegal (0 or PAGER_MJ_PGNO), or -** * If the record is being rolled back from the main journal file -** and the checksum field does not match the record content. -** -** Neither of these two scenarios are possible during a savepoint rollback. -** -** If this is a savepoint rollback, then memory may have to be dynamically -** allocated by this function. If this is the case and an allocation fails, -** SQLITE_NOMEM is returned. -*/ -static int pager_playback_one_page( - Pager *pPager, /* The pager being played back */ - i64 *pOffset, /* Offset of record to playback */ - Bitvec *pDone, /* Bitvec of pages already played back */ - int isMainJrnl, /* 1 -> main journal. 0 -> sub-journal. */ - int isSavepnt /* True for a savepoint rollback */ -){ - int rc; - PgHdr *pPg; /* An existing page in the cache */ - Pgno pgno; /* The page number of a page in journal */ - u32 cksum; /* Checksum used for sanity checking */ - char *aData; /* Temporary storage for the page */ - sqlite3_file *jfd; /* The file descriptor for the journal file */ - int isSynced; /* True if journal page is synced */ - - assert( (isMainJrnl&~1)==0 ); /* isMainJrnl is 0 or 1 */ - assert( (isSavepnt&~1)==0 ); /* isSavepnt is 0 or 1 */ - assert( isMainJrnl || pDone ); /* pDone always used on sub-journals */ - assert( isSavepnt || pDone==0 ); /* pDone never used on non-savepoint */ - - aData = pPager->pTmpSpace; - assert( aData ); /* Temp storage must have already been allocated */ - assert( pagerUseWal(pPager)==0 || (!isMainJrnl && isSavepnt) ); - - /* Either the state is greater than PAGER_WRITER_CACHEMOD (a transaction - ** or savepoint rollback done at the request of the caller) or this is - ** a hot-journal rollback. If it is a hot-journal rollback, the pager - ** is in state OPEN and holds an EXCLUSIVE lock. Hot-journal rollback - ** only reads from the main journal, not the sub-journal. - */ - assert( pPager->eState>=PAGER_WRITER_CACHEMOD - || (pPager->eState==PAGER_OPEN && pPager->eLock==EXCLUSIVE_LOCK) - ); - assert( pPager->eState>=PAGER_WRITER_CACHEMOD || isMainJrnl ); - - /* Read the page number and page data from the journal or sub-journal - ** file. Return an error code to the caller if an IO error occurs. - */ - jfd = isMainJrnl ? pPager->jfd : pPager->sjfd; - rc = read32bits(jfd, *pOffset, &pgno); - if( rc!=SQLITE_OK ) return rc; - rc = sqlite3OsRead(jfd, (u8*)aData, pPager->pageSize, (*pOffset)+4); - if( rc!=SQLITE_OK ) return rc; - *pOffset += pPager->pageSize + 4 + isMainJrnl*4; - - /* Sanity checking on the page. This is more important that I originally - ** thought. If a power failure occurs while the journal is being written, - ** it could cause invalid data to be written into the journal. We need to - ** detect this invalid data (with high probability) and ignore it. - */ - if( pgno==0 || pgno==PAGER_MJ_PGNO(pPager) ){ - assert( !isSavepnt ); - return SQLITE_DONE; - } - if( pgno>(Pgno)pPager->dbSize || sqlite3BitvecTest(pDone, pgno) ){ - return SQLITE_OK; - } - if( isMainJrnl ){ - rc = read32bits(jfd, (*pOffset)-4, &cksum); - if( rc ) return rc; - if( !isSavepnt && pager_cksum(pPager, (u8*)aData)!=cksum ){ - return SQLITE_DONE; - } - } - - /* If this page has already been played by before during the current - ** rollback, then don't bother to play it back again. - */ - if( pDone && (rc = sqlite3BitvecSet(pDone, pgno))!=SQLITE_OK ){ - return rc; - } - - /* When playing back page 1, restore the nReserve setting - */ - if( pgno==1 && pPager->nReserve!=((u8*)aData)[20] ){ - pPager->nReserve = ((u8*)aData)[20]; - pagerReportSize(pPager); - } - - /* If the pager is in CACHEMOD state, then there must be a copy of this - ** page in the pager cache. In this case just update the pager cache, - ** not the database file. The page is left marked dirty in this case. - ** - ** An exception to the above rule: If the database is in no-sync mode - ** and a page is moved during an incremental vacuum then the page may - ** not be in the pager cache. Later: if a malloc() or IO error occurs - ** during a Movepage() call, then the page may not be in the cache - ** either. So the condition described in the above paragraph is not - ** assert()able. - ** - ** If in WRITER_DBMOD, WRITER_FINISHED or OPEN state, then we update the - ** pager cache if it exists and the main file. The page is then marked - ** not dirty. Since this code is only executed in PAGER_OPEN state for - ** a hot-journal rollback, it is guaranteed that the page-cache is empty - ** if the pager is in OPEN state. - ** - ** Ticket #1171: The statement journal might contain page content that is - ** different from the page content at the start of the transaction. - ** This occurs when a page is changed prior to the start of a statement - ** then changed again within the statement. When rolling back such a - ** statement we must not write to the original database unless we know - ** for certain that original page contents are synced into the main rollback - ** journal. Otherwise, a power loss might leave modified data in the - ** database file without an entry in the rollback journal that can - ** restore the database to its original form. Two conditions must be - ** met before writing to the database files. (1) the database must be - ** locked. (2) we know that the original page content is fully synced - ** in the main journal either because the page is not in cache or else - ** the page is marked as needSync==0. - ** - ** 2008-04-14: When attempting to vacuum a corrupt database file, it - ** is possible to fail a statement on a database that does not yet exist. - ** Do not attempt to write if database file has never been opened. - */ - if( pagerUseWal(pPager) ){ - pPg = 0; - }else{ - pPg = pager_lookup(pPager, pgno); - } - assert( pPg || !MEMDB ); - assert( pPager->eState!=PAGER_OPEN || pPg==0 ); - PAGERTRACE(("PLAYBACK %d page %d hash(%08x) %s\n", - PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, (u8*)aData), - (isMainJrnl?"main-journal":"sub-journal") - )); - if( isMainJrnl ){ - isSynced = pPager->noSync || (*pOffset <= pPager->journalHdr); - }else{ - isSynced = (pPg==0 || 0==(pPg->flags & PGHDR_NEED_SYNC)); - } - if( isOpen(pPager->fd) - && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) - && isSynced - ){ - i64 ofst = (pgno-1)*(i64)pPager->pageSize; - testcase( !isSavepnt && pPg!=0 && (pPg->flags&PGHDR_NEED_SYNC)!=0 ); - assert( !pagerUseWal(pPager) ); - rc = sqlite3OsWrite(pPager->fd, (u8 *)aData, pPager->pageSize, ofst); - if( pgno>pPager->dbFileSize ){ - pPager->dbFileSize = pgno; - } - if( pPager->pBackup ){ - CODEC1(pPager, aData, pgno, 3, rc=SQLITE_NOMEM); - sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)aData); - CODEC2(pPager, aData, pgno, 7, rc=SQLITE_NOMEM, aData); - } - }else if( !isMainJrnl && pPg==0 ){ - /* If this is a rollback of a savepoint and data was not written to - ** the database and the page is not in-memory, there is a potential - ** problem. When the page is next fetched by the b-tree layer, it - ** will be read from the database file, which may or may not be - ** current. - ** - ** There are a couple of different ways this can happen. All are quite - ** obscure. When running in synchronous mode, this can only happen - ** if the page is on the free-list at the start of the transaction, then - ** populated, then moved using sqlite3PagerMovepage(). - ** - ** The solution is to add an in-memory page to the cache containing - ** the data just read from the sub-journal. Mark the page as dirty - ** and if the pager requires a journal-sync, then mark the page as - ** requiring a journal-sync before it is written. - */ - assert( isSavepnt ); - assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)==0 ); - pPager->doNotSpill |= SPILLFLAG_ROLLBACK; - rc = sqlite3PagerAcquire(pPager, pgno, &pPg, 1); - assert( (pPager->doNotSpill & SPILLFLAG_ROLLBACK)!=0 ); - pPager->doNotSpill &= ~SPILLFLAG_ROLLBACK; - if( rc!=SQLITE_OK ) return rc; - pPg->flags &= ~PGHDR_NEED_READ; - sqlite3PcacheMakeDirty(pPg); - } - if( pPg ){ - /* No page should ever be explicitly rolled back that is in use, except - ** for page 1 which is held in use in order to keep the lock on the - ** database active. However such a page may be rolled back as a result - ** of an internal error resulting in an automatic call to - ** sqlite3PagerRollback(). - */ - void *pData; - pData = pPg->pData; - memcpy(pData, (u8*)aData, pPager->pageSize); - pPager->xReiniter(pPg); - if( isMainJrnl && (!isSavepnt || *pOffset<=pPager->journalHdr) ){ - /* If the contents of this page were just restored from the main - ** journal file, then its content must be as they were when the - ** transaction was first opened. In this case we can mark the page - ** as clean, since there will be no need to write it out to the - ** database. - ** - ** There is one exception to this rule. If the page is being rolled - ** back as part of a savepoint (or statement) rollback from an - ** unsynced portion of the main journal file, then it is not safe - ** to mark the page as clean. This is because marking the page as - ** clean will clear the PGHDR_NEED_SYNC flag. Since the page is - ** already in the journal file (recorded in Pager.pInJournal) and - ** the PGHDR_NEED_SYNC flag is cleared, if the page is written to - ** again within this transaction, it will be marked as dirty but - ** the PGHDR_NEED_SYNC flag will not be set. It could then potentially - ** be written out into the database file before its journal file - ** segment is synced. If a crash occurs during or following this, - ** database corruption may ensue. - */ - assert( !pagerUseWal(pPager) ); - sqlite3PcacheMakeClean(pPg); - } - pager_set_pagehash(pPg); - - /* If this was page 1, then restore the value of Pager.dbFileVers. - ** Do this before any decoding. */ - if( pgno==1 ){ - memcpy(&pPager->dbFileVers, &((u8*)pData)[24],sizeof(pPager->dbFileVers)); - } - - /* Decode the page just read from disk */ - CODEC1(pPager, pData, pPg->pgno, 3, rc=SQLITE_NOMEM); - sqlite3PcacheRelease(pPg); - } - return rc; -} - -/* -** Parameter zMaster is the name of a master journal file. A single journal -** file that referred to the master journal file has just been rolled back. -** This routine checks if it is possible to delete the master journal file, -** and does so if it is. -** -** Argument zMaster may point to Pager.pTmpSpace. So that buffer is not -** available for use within this function. -** -** When a master journal file is created, it is populated with the names -** of all of its child journals, one after another, formatted as utf-8 -** encoded text. The end of each child journal file is marked with a -** nul-terminator byte (0x00). i.e. the entire contents of a master journal -** file for a transaction involving two databases might be: -** -** "/home/bill/a.db-journal\x00/home/bill/b.db-journal\x00" -** -** A master journal file may only be deleted once all of its child -** journals have been rolled back. -** -** This function reads the contents of the master-journal file into -** memory and loops through each of the child journal names. For -** each child journal, it checks if: -** -** * if the child journal exists, and if so -** * if the child journal contains a reference to master journal -** file zMaster -** -** If a child journal can be found that matches both of the criteria -** above, this function returns without doing anything. Otherwise, if -** no such child journal can be found, file zMaster is deleted from -** the file-system using sqlite3OsDelete(). -** -** If an IO error within this function, an error code is returned. This -** function allocates memory by calling sqlite3Malloc(). If an allocation -** fails, SQLITE_NOMEM is returned. Otherwise, if no IO or malloc errors -** occur, SQLITE_OK is returned. -** -** TODO: This function allocates a single block of memory to load -** the entire contents of the master journal file. This could be -** a couple of kilobytes or so - potentially larger than the page -** size. -*/ -static int pager_delmaster(Pager *pPager, const char *zMaster){ - sqlite3_vfs *pVfs = pPager->pVfs; - int rc; /* Return code */ - sqlite3_file *pMaster; /* Malloc'd master-journal file descriptor */ - sqlite3_file *pJournal; /* Malloc'd child-journal file descriptor */ - char *zMasterJournal = 0; /* Contents of master journal file */ - i64 nMasterJournal; /* Size of master journal file */ - char *zJournal; /* Pointer to one journal within MJ file */ - char *zMasterPtr; /* Space to hold MJ filename from a journal file */ - int nMasterPtr; /* Amount of space allocated to zMasterPtr[] */ - - /* Allocate space for both the pJournal and pMaster file descriptors. - ** If successful, open the master journal file for reading. - */ - pMaster = (sqlite3_file *)sqlite3MallocZero(pVfs->szOsFile * 2); - pJournal = (sqlite3_file *)(((u8 *)pMaster) + pVfs->szOsFile); - if( !pMaster ){ - rc = SQLITE_NOMEM; - }else{ - const int flags = (SQLITE_OPEN_READONLY|SQLITE_OPEN_MASTER_JOURNAL); - rc = sqlite3OsOpen(pVfs, zMaster, pMaster, flags, 0); - } - if( rc!=SQLITE_OK ) goto delmaster_out; - - /* Load the entire master journal file into space obtained from - ** sqlite3_malloc() and pointed to by zMasterJournal. Also obtain - ** sufficient space (in zMasterPtr) to hold the names of master - ** journal files extracted from regular rollback-journals. - */ - rc = sqlite3OsFileSize(pMaster, &nMasterJournal); - if( rc!=SQLITE_OK ) goto delmaster_out; - nMasterPtr = pVfs->mxPathname+1; - zMasterJournal = sqlite3Malloc((int)nMasterJournal + nMasterPtr + 1); - if( !zMasterJournal ){ - rc = SQLITE_NOMEM; - goto delmaster_out; - } - zMasterPtr = &zMasterJournal[nMasterJournal+1]; - rc = sqlite3OsRead(pMaster, zMasterJournal, (int)nMasterJournal, 0); - if( rc!=SQLITE_OK ) goto delmaster_out; - zMasterJournal[nMasterJournal] = 0; - - zJournal = zMasterJournal; - while( (zJournal-zMasterJournal)pageSize bytes). -** If the file on disk is currently larger than nPage pages, then use the VFS -** xTruncate() method to truncate it. -** -** Or, it might might be the case that the file on disk is smaller than -** nPage pages. Some operating system implementations can get confused if -** you try to truncate a file to some size that is larger than it -** currently is, so detect this case and write a single zero byte to -** the end of the new file instead. -** -** If successful, return SQLITE_OK. If an IO error occurs while modifying -** the database file, return the error code to the caller. -*/ -static int pager_truncate(Pager *pPager, Pgno nPage){ - int rc = SQLITE_OK; - assert( pPager->eState!=PAGER_ERROR ); - assert( pPager->eState!=PAGER_READER ); - - if( isOpen(pPager->fd) - && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) - ){ - i64 currentSize, newSize; - int szPage = pPager->pageSize; - assert( pPager->eLock==EXCLUSIVE_LOCK ); - /* TODO: Is it safe to use Pager.dbFileSize here? */ - rc = sqlite3OsFileSize(pPager->fd, ¤tSize); - newSize = szPage*(i64)nPage; - if( rc==SQLITE_OK && currentSize!=newSize ){ - if( currentSize>newSize ){ - rc = sqlite3OsTruncate(pPager->fd, newSize); - }else if( (currentSize+szPage)<=newSize ){ - char *pTmp = pPager->pTmpSpace; - memset(pTmp, 0, szPage); - testcase( (newSize-szPage) == currentSize ); - testcase( (newSize-szPage) > currentSize ); - rc = sqlite3OsWrite(pPager->fd, pTmp, szPage, newSize-szPage); - } - if( rc==SQLITE_OK ){ - pPager->dbFileSize = nPage; - } - } - } - return rc; -} - -/* -** Return a sanitized version of the sector-size of OS file pFile. The -** return value is guaranteed to lie between 32 and MAX_SECTOR_SIZE. -*/ -SQLITE_PRIVATE int sqlite3SectorSize(sqlite3_file *pFile){ - int iRet = sqlite3OsSectorSize(pFile); - if( iRet<32 ){ - iRet = 512; - }else if( iRet>MAX_SECTOR_SIZE ){ - assert( MAX_SECTOR_SIZE>=512 ); - iRet = MAX_SECTOR_SIZE; - } - return iRet; -} - -/* -** Set the value of the Pager.sectorSize variable for the given -** pager based on the value returned by the xSectorSize method -** of the open database file. The sector size will be used used -** to determine the size and alignment of journal header and -** master journal pointers within created journal files. -** -** For temporary files the effective sector size is always 512 bytes. -** -** Otherwise, for non-temporary files, the effective sector size is -** the value returned by the xSectorSize() method rounded up to 32 if -** it is less than 32, or rounded down to MAX_SECTOR_SIZE if it -** is greater than MAX_SECTOR_SIZE. -** -** If the file has the SQLITE_IOCAP_POWERSAFE_OVERWRITE property, then set -** the effective sector size to its minimum value (512). The purpose of -** pPager->sectorSize is to define the "blast radius" of bytes that -** might change if a crash occurs while writing to a single byte in -** that range. But with POWERSAFE_OVERWRITE, the blast radius is zero -** (that is what POWERSAFE_OVERWRITE means), so we minimize the sector -** size. For backwards compatibility of the rollback journal file format, -** we cannot reduce the effective sector size below 512. -*/ -static void setSectorSize(Pager *pPager){ - assert( isOpen(pPager->fd) || pPager->tempFile ); - - if( pPager->tempFile - || (sqlite3OsDeviceCharacteristics(pPager->fd) & - SQLITE_IOCAP_POWERSAFE_OVERWRITE)!=0 - ){ - /* Sector size doesn't matter for temporary files. Also, the file - ** may not have been opened yet, in which case the OsSectorSize() - ** call will segfault. */ - pPager->sectorSize = 512; - }else{ - pPager->sectorSize = sqlite3SectorSize(pPager->fd); - } -} - -/* -** Playback the journal and thus restore the database file to -** the state it was in before we started making changes. -** -** The journal file format is as follows: -** -** (1) 8 byte prefix. A copy of aJournalMagic[]. -** (2) 4 byte big-endian integer which is the number of valid page records -** in the journal. If this value is 0xffffffff, then compute the -** number of page records from the journal size. -** (3) 4 byte big-endian integer which is the initial value for the -** sanity checksum. -** (4) 4 byte integer which is the number of pages to truncate the -** database to during a rollback. -** (5) 4 byte big-endian integer which is the sector size. The header -** is this many bytes in size. -** (6) 4 byte big-endian integer which is the page size. -** (7) zero padding out to the next sector size. -** (8) Zero or more pages instances, each as follows: -** + 4 byte page number. -** + pPager->pageSize bytes of data. -** + 4 byte checksum -** -** When we speak of the journal header, we mean the first 7 items above. -** Each entry in the journal is an instance of the 8th item. -** -** Call the value from the second bullet "nRec". nRec is the number of -** valid page entries in the journal. In most cases, you can compute the -** value of nRec from the size of the journal file. But if a power -** failure occurred while the journal was being written, it could be the -** case that the size of the journal file had already been increased but -** the extra entries had not yet made it safely to disk. In such a case, -** the value of nRec computed from the file size would be too large. For -** that reason, we always use the nRec value in the header. -** -** If the nRec value is 0xffffffff it means that nRec should be computed -** from the file size. This value is used when the user selects the -** no-sync option for the journal. A power failure could lead to corruption -** in this case. But for things like temporary table (which will be -** deleted when the power is restored) we don't care. -** -** If the file opened as the journal file is not a well-formed -** journal file then all pages up to the first corrupted page are rolled -** back (or no pages if the journal header is corrupted). The journal file -** is then deleted and SQLITE_OK returned, just as if no corruption had -** been encountered. -** -** If an I/O or malloc() error occurs, the journal-file is not deleted -** and an error code is returned. -** -** The isHot parameter indicates that we are trying to rollback a journal -** that might be a hot journal. Or, it could be that the journal is -** preserved because of JOURNALMODE_PERSIST or JOURNALMODE_TRUNCATE. -** If the journal really is hot, reset the pager cache prior rolling -** back any content. If the journal is merely persistent, no reset is -** needed. -*/ -static int pager_playback(Pager *pPager, int isHot){ - sqlite3_vfs *pVfs = pPager->pVfs; - i64 szJ; /* Size of the journal file in bytes */ - u32 nRec; /* Number of Records in the journal */ - u32 u; /* Unsigned loop counter */ - Pgno mxPg = 0; /* Size of the original file in pages */ - int rc; /* Result code of a subroutine */ - int res = 1; /* Value returned by sqlite3OsAccess() */ - char *zMaster = 0; /* Name of master journal file if any */ - int needPagerReset; /* True to reset page prior to first page rollback */ - int nPlayback = 0; /* Total number of pages restored from journal */ - - /* Figure out how many records are in the journal. Abort early if - ** the journal is empty. - */ - assert( isOpen(pPager->jfd) ); - rc = sqlite3OsFileSize(pPager->jfd, &szJ); - if( rc!=SQLITE_OK ){ - goto end_playback; - } - - /* Read the master journal name from the journal, if it is present. - ** If a master journal file name is specified, but the file is not - ** present on disk, then the journal is not hot and does not need to be - ** played back. - ** - ** TODO: Technically the following is an error because it assumes that - ** buffer Pager.pTmpSpace is (mxPathname+1) bytes or larger. i.e. that - ** (pPager->pageSize >= pPager->pVfs->mxPathname+1). Using os_unix.c, - ** mxPathname is 512, which is the same as the minimum allowable value - ** for pageSize. - */ - zMaster = pPager->pTmpSpace; - rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1); - if( rc==SQLITE_OK && zMaster[0] ){ - rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res); - } - zMaster = 0; - if( rc!=SQLITE_OK || !res ){ - goto end_playback; - } - pPager->journalOff = 0; - needPagerReset = isHot; - - /* This loop terminates either when a readJournalHdr() or - ** pager_playback_one_page() call returns SQLITE_DONE or an IO error - ** occurs. - */ - while( 1 ){ - /* Read the next journal header from the journal file. If there are - ** not enough bytes left in the journal file for a complete header, or - ** it is corrupted, then a process must have failed while writing it. - ** This indicates nothing more needs to be rolled back. - */ - rc = readJournalHdr(pPager, isHot, szJ, &nRec, &mxPg); - if( rc!=SQLITE_OK ){ - if( rc==SQLITE_DONE ){ - rc = SQLITE_OK; - } - goto end_playback; - } - - /* If nRec is 0xffffffff, then this journal was created by a process - ** working in no-sync mode. This means that the rest of the journal - ** file consists of pages, there are no more journal headers. Compute - ** the value of nRec based on this assumption. - */ - if( nRec==0xffffffff ){ - assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ); - nRec = (int)((szJ - JOURNAL_HDR_SZ(pPager))/JOURNAL_PG_SZ(pPager)); - } - - /* If nRec is 0 and this rollback is of a transaction created by this - ** process and if this is the final header in the journal, then it means - ** that this part of the journal was being filled but has not yet been - ** synced to disk. Compute the number of pages based on the remaining - ** size of the file. - ** - ** The third term of the test was added to fix ticket #2565. - ** When rolling back a hot journal, nRec==0 always means that the next - ** chunk of the journal contains zero pages to be rolled back. But - ** when doing a ROLLBACK and the nRec==0 chunk is the last chunk in - ** the journal, it means that the journal might contain additional - ** pages that need to be rolled back and that the number of pages - ** should be computed based on the journal file size. - */ - if( nRec==0 && !isHot && - pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff ){ - nRec = (int)((szJ - pPager->journalOff) / JOURNAL_PG_SZ(pPager)); - } - - /* If this is the first header read from the journal, truncate the - ** database file back to its original size. - */ - if( pPager->journalOff==JOURNAL_HDR_SZ(pPager) ){ - rc = pager_truncate(pPager, mxPg); - if( rc!=SQLITE_OK ){ - goto end_playback; - } - pPager->dbSize = mxPg; - } - - /* Copy original pages out of the journal and back into the - ** database file and/or page cache. - */ - for(u=0; ujournalOff,0,1,0); - if( rc==SQLITE_OK ){ - nPlayback++; - }else{ - if( rc==SQLITE_DONE ){ - pPager->journalOff = szJ; - break; - }else if( rc==SQLITE_IOERR_SHORT_READ ){ - /* If the journal has been truncated, simply stop reading and - ** processing the journal. This might happen if the journal was - ** not completely written and synced prior to a crash. In that - ** case, the database should have never been written in the - ** first place so it is OK to simply abandon the rollback. */ - rc = SQLITE_OK; - goto end_playback; - }else{ - /* If we are unable to rollback, quit and return the error - ** code. This will cause the pager to enter the error state - ** so that no further harm will be done. Perhaps the next - ** process to come along will be able to rollback the database. - */ - goto end_playback; - } - } - } - } - /*NOTREACHED*/ - assert( 0 ); - -end_playback: - /* Following a rollback, the database file should be back in its original - ** state prior to the start of the transaction, so invoke the - ** SQLITE_FCNTL_DB_UNCHANGED file-control method to disable the - ** assertion that the transaction counter was modified. - */ -#ifdef SQLITE_DEBUG - if( pPager->fd->pMethods ){ - sqlite3OsFileControlHint(pPager->fd,SQLITE_FCNTL_DB_UNCHANGED,0); - } -#endif - - /* If this playback is happening automatically as a result of an IO or - ** malloc error that occurred after the change-counter was updated but - ** before the transaction was committed, then the change-counter - ** modification may just have been reverted. If this happens in exclusive - ** mode, then subsequent transactions performed by the connection will not - ** update the change-counter at all. This may lead to cache inconsistency - ** problems for other processes at some point in the future. So, just - ** in case this has happened, clear the changeCountDone flag now. - */ - pPager->changeCountDone = pPager->tempFile; - - if( rc==SQLITE_OK ){ - zMaster = pPager->pTmpSpace; - rc = readMasterJournal(pPager->jfd, zMaster, pPager->pVfs->mxPathname+1); - testcase( rc!=SQLITE_OK ); - } - if( rc==SQLITE_OK - && (pPager->eState>=PAGER_WRITER_DBMOD || pPager->eState==PAGER_OPEN) - ){ - rc = sqlite3PagerSync(pPager, 0); - } - if( rc==SQLITE_OK ){ - rc = pager_end_transaction(pPager, zMaster[0]!='\0', 0); - testcase( rc!=SQLITE_OK ); - } - if( rc==SQLITE_OK && zMaster[0] && res ){ - /* If there was a master journal and this routine will return success, - ** see if it is possible to delete the master journal. - */ - rc = pager_delmaster(pPager, zMaster); - testcase( rc!=SQLITE_OK ); - } - if( isHot && nPlayback ){ - sqlite3_log(SQLITE_NOTICE_RECOVER_ROLLBACK, "recovered %d pages from %s", - nPlayback, pPager->zJournal); - } - - /* The Pager.sectorSize variable may have been updated while rolling - ** back a journal created by a process with a different sector size - ** value. Reset it to the correct value for this process. - */ - setSectorSize(pPager); - return rc; -} - - -/* -** Read the content for page pPg out of the database file and into -** pPg->pData. A shared lock or greater must be held on the database -** file before this function is called. -** -** If page 1 is read, then the value of Pager.dbFileVers[] is set to -** the value read from the database file. -** -** If an IO error occurs, then the IO error is returned to the caller. -** Otherwise, SQLITE_OK is returned. -*/ -static int readDbPage(PgHdr *pPg, u32 iFrame){ - Pager *pPager = pPg->pPager; /* Pager object associated with page pPg */ - Pgno pgno = pPg->pgno; /* Page number to read */ - int rc = SQLITE_OK; /* Return code */ - int pgsz = pPager->pageSize; /* Number of bytes to read */ - - assert( pPager->eState>=PAGER_READER && !MEMDB ); - assert( isOpen(pPager->fd) ); - -#ifndef SQLITE_OMIT_WAL - if( iFrame ){ - /* Try to pull the page from the write-ahead log. */ - rc = sqlite3WalReadFrame(pPager->pWal, iFrame, pgsz, pPg->pData); - }else -#endif - { - i64 iOffset = (pgno-1)*(i64)pPager->pageSize; - rc = sqlite3OsRead(pPager->fd, pPg->pData, pgsz, iOffset); - if( rc==SQLITE_IOERR_SHORT_READ ){ - rc = SQLITE_OK; - } - } - - if( pgno==1 ){ - if( rc ){ - /* If the read is unsuccessful, set the dbFileVers[] to something - ** that will never be a valid file version. dbFileVers[] is a copy - ** of bytes 24..39 of the database. Bytes 28..31 should always be - ** zero or the size of the database in page. Bytes 32..35 and 35..39 - ** should be page numbers which are never 0xffffffff. So filling - ** pPager->dbFileVers[] with all 0xff bytes should suffice. - ** - ** For an encrypted database, the situation is more complex: bytes - ** 24..39 of the database are white noise. But the probability of - ** white noising equaling 16 bytes of 0xff is vanishingly small so - ** we should still be ok. - */ - memset(pPager->dbFileVers, 0xff, sizeof(pPager->dbFileVers)); - }else{ - u8 *dbFileVers = &((u8*)pPg->pData)[24]; - memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers)); - } - } - CODEC1(pPager, pPg->pData, pgno, 3, rc = SQLITE_NOMEM); - - PAGER_INCR(sqlite3_pager_readdb_count); - PAGER_INCR(pPager->nRead); - IOTRACE(("PGIN %p %d\n", pPager, pgno)); - PAGERTRACE(("FETCH %d page %d hash(%08x)\n", - PAGERID(pPager), pgno, pager_pagehash(pPg))); - - return rc; -} - -/* -** Update the value of the change-counter at offsets 24 and 92 in -** the header and the sqlite version number at offset 96. -** -** This is an unconditional update. See also the pager_incr_changecounter() -** routine which only updates the change-counter if the update is actually -** needed, as determined by the pPager->changeCountDone state variable. -*/ -static void pager_write_changecounter(PgHdr *pPg){ - u32 change_counter; - - /* Increment the value just read and write it back to byte 24. */ - change_counter = sqlite3Get4byte((u8*)pPg->pPager->dbFileVers)+1; - put32bits(((char*)pPg->pData)+24, change_counter); - - /* Also store the SQLite version number in bytes 96..99 and in - ** bytes 92..95 store the change counter for which the version number - ** is valid. */ - put32bits(((char*)pPg->pData)+92, change_counter); - put32bits(((char*)pPg->pData)+96, SQLITE_VERSION_NUMBER); -} - -#ifndef SQLITE_OMIT_WAL -/* -** This function is invoked once for each page that has already been -** written into the log file when a WAL transaction is rolled back. -** Parameter iPg is the page number of said page. The pCtx argument -** is actually a pointer to the Pager structure. -** -** If page iPg is present in the cache, and has no outstanding references, -** it is discarded. Otherwise, if there are one or more outstanding -** references, the page content is reloaded from the database. If the -** attempt to reload content from the database is required and fails, -** return an SQLite error code. Otherwise, SQLITE_OK. -*/ -static int pagerUndoCallback(void *pCtx, Pgno iPg){ - int rc = SQLITE_OK; - Pager *pPager = (Pager *)pCtx; - PgHdr *pPg; - - assert( pagerUseWal(pPager) ); - pPg = sqlite3PagerLookup(pPager, iPg); - if( pPg ){ - if( sqlite3PcachePageRefcount(pPg)==1 ){ - sqlite3PcacheDrop(pPg); - }else{ - u32 iFrame = 0; - rc = sqlite3WalFindFrame(pPager->pWal, pPg->pgno, &iFrame); - if( rc==SQLITE_OK ){ - rc = readDbPage(pPg, iFrame); - } - if( rc==SQLITE_OK ){ - pPager->xReiniter(pPg); - } - sqlite3PagerUnrefNotNull(pPg); - } - } - - /* Normally, if a transaction is rolled back, any backup processes are - ** updated as data is copied out of the rollback journal and into the - ** database. This is not generally possible with a WAL database, as - ** rollback involves simply truncating the log file. Therefore, if one - ** or more frames have already been written to the log (and therefore - ** also copied into the backup databases) as part of this transaction, - ** the backups must be restarted. - */ - sqlite3BackupRestart(pPager->pBackup); - - return rc; -} - -/* -** This function is called to rollback a transaction on a WAL database. -*/ -static int pagerRollbackWal(Pager *pPager){ - int rc; /* Return Code */ - PgHdr *pList; /* List of dirty pages to revert */ - - /* For all pages in the cache that are currently dirty or have already - ** been written (but not committed) to the log file, do one of the - ** following: - ** - ** + Discard the cached page (if refcount==0), or - ** + Reload page content from the database (if refcount>0). - */ - pPager->dbSize = pPager->dbOrigSize; - rc = sqlite3WalUndo(pPager->pWal, pagerUndoCallback, (void *)pPager); - pList = sqlite3PcacheDirtyList(pPager->pPCache); - while( pList && rc==SQLITE_OK ){ - PgHdr *pNext = pList->pDirty; - rc = pagerUndoCallback((void *)pPager, pList->pgno); - pList = pNext; - } - - return rc; -} - -/* -** This function is a wrapper around sqlite3WalFrames(). As well as logging -** the contents of the list of pages headed by pList (connected by pDirty), -** this function notifies any active backup processes that the pages have -** changed. -** -** The list of pages passed into this routine is always sorted by page number. -** Hence, if page 1 appears anywhere on the list, it will be the first page. -*/ -static int pagerWalFrames( - Pager *pPager, /* Pager object */ - PgHdr *pList, /* List of frames to log */ - Pgno nTruncate, /* Database size after this commit */ - int isCommit /* True if this is a commit */ -){ - int rc; /* Return code */ - int nList; /* Number of pages in pList */ -#if defined(SQLITE_DEBUG) || defined(SQLITE_CHECK_PAGES) - PgHdr *p; /* For looping over pages */ -#endif - - assert( pPager->pWal ); - assert( pList ); -#ifdef SQLITE_DEBUG - /* Verify that the page list is in accending order */ - for(p=pList; p && p->pDirty; p=p->pDirty){ - assert( p->pgno < p->pDirty->pgno ); - } -#endif - - assert( pList->pDirty==0 || isCommit ); - if( isCommit ){ - /* If a WAL transaction is being committed, there is no point in writing - ** any pages with page numbers greater than nTruncate into the WAL file. - ** They will never be read by any client. So remove them from the pDirty - ** list here. */ - PgHdr *p; - PgHdr **ppNext = &pList; - nList = 0; - for(p=pList; (*ppNext = p)!=0; p=p->pDirty){ - if( p->pgno<=nTruncate ){ - ppNext = &p->pDirty; - nList++; - } - } - assert( pList ); - }else{ - nList = 1; - } - pPager->aStat[PAGER_STAT_WRITE] += nList; - - if( pList->pgno==1 ) pager_write_changecounter(pList); - rc = sqlite3WalFrames(pPager->pWal, - pPager->pageSize, pList, nTruncate, isCommit, pPager->walSyncFlags - ); - if( rc==SQLITE_OK && pPager->pBackup ){ - PgHdr *p; - for(p=pList; p; p=p->pDirty){ - sqlite3BackupUpdate(pPager->pBackup, p->pgno, (u8 *)p->pData); - } - } - -#ifdef SQLITE_CHECK_PAGES - pList = sqlite3PcacheDirtyList(pPager->pPCache); - for(p=pList; p; p=p->pDirty){ - pager_set_pagehash(p); - } -#endif - - return rc; -} - -/* -** Begin a read transaction on the WAL. -** -** This routine used to be called "pagerOpenSnapshot()" because it essentially -** makes a snapshot of the database at the current point in time and preserves -** that snapshot for use by the reader in spite of concurrently changes by -** other writers or checkpointers. -*/ -static int pagerBeginReadTransaction(Pager *pPager){ - int rc; /* Return code */ - int changed = 0; /* True if cache must be reset */ - - assert( pagerUseWal(pPager) ); - assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER ); - - /* sqlite3WalEndReadTransaction() was not called for the previous - ** transaction in locking_mode=EXCLUSIVE. So call it now. If we - ** are in locking_mode=NORMAL and EndRead() was previously called, - ** the duplicate call is harmless. - */ - sqlite3WalEndReadTransaction(pPager->pWal); - - rc = sqlite3WalBeginReadTransaction(pPager->pWal, &changed); - if( rc!=SQLITE_OK || changed ){ - pager_reset(pPager); - if( USEFETCH(pPager) ) sqlite3OsUnfetch(pPager->fd, 0, 0); - } - - return rc; -} -#endif - -/* -** This function is called as part of the transition from PAGER_OPEN -** to PAGER_READER state to determine the size of the database file -** in pages (assuming the page size currently stored in Pager.pageSize). -** -** If no error occurs, SQLITE_OK is returned and the size of the database -** in pages is stored in *pnPage. Otherwise, an error code (perhaps -** SQLITE_IOERR_FSTAT) is returned and *pnPage is left unmodified. -*/ -static int pagerPagecount(Pager *pPager, Pgno *pnPage){ - Pgno nPage; /* Value to return via *pnPage */ - - /* Query the WAL sub-system for the database size. The WalDbsize() - ** function returns zero if the WAL is not open (i.e. Pager.pWal==0), or - ** if the database size is not available. The database size is not - ** available from the WAL sub-system if the log file is empty or - ** contains no valid committed transactions. - */ - assert( pPager->eState==PAGER_OPEN ); - assert( pPager->eLock>=SHARED_LOCK ); - nPage = sqlite3WalDbsize(pPager->pWal); - - /* If the database size was not available from the WAL sub-system, - ** determine it based on the size of the database file. If the size - ** of the database file is not an integer multiple of the page-size, - ** round down to the nearest page. Except, any file larger than 0 - ** bytes in size is considered to contain at least one page. - */ - if( nPage==0 ){ - i64 n = 0; /* Size of db file in bytes */ - assert( isOpen(pPager->fd) || pPager->tempFile ); - if( isOpen(pPager->fd) ){ - int rc = sqlite3OsFileSize(pPager->fd, &n); - if( rc!=SQLITE_OK ){ - return rc; - } - } - nPage = (Pgno)((n+pPager->pageSize-1) / pPager->pageSize); - } - - /* If the current number of pages in the file is greater than the - ** configured maximum pager number, increase the allowed limit so - ** that the file can be read. - */ - if( nPage>pPager->mxPgno ){ - pPager->mxPgno = (Pgno)nPage; - } - - *pnPage = nPage; - return SQLITE_OK; -} - -#ifndef SQLITE_OMIT_WAL -/* -** Check if the *-wal file that corresponds to the database opened by pPager -** exists if the database is not empy, or verify that the *-wal file does -** not exist (by deleting it) if the database file is empty. -** -** If the database is not empty and the *-wal file exists, open the pager -** in WAL mode. If the database is empty or if no *-wal file exists and -** if no error occurs, make sure Pager.journalMode is not set to -** PAGER_JOURNALMODE_WAL. -** -** Return SQLITE_OK or an error code. -** -** The caller must hold a SHARED lock on the database file to call this -** function. Because an EXCLUSIVE lock on the db file is required to delete -** a WAL on a none-empty database, this ensures there is no race condition -** between the xAccess() below and an xDelete() being executed by some -** other connection. -*/ -static int pagerOpenWalIfPresent(Pager *pPager){ - int rc = SQLITE_OK; - assert( pPager->eState==PAGER_OPEN ); - assert( pPager->eLock>=SHARED_LOCK ); - - if( !pPager->tempFile ){ - int isWal; /* True if WAL file exists */ - Pgno nPage; /* Size of the database file */ - - rc = pagerPagecount(pPager, &nPage); - if( rc ) return rc; - if( nPage==0 ){ - rc = sqlite3OsDelete(pPager->pVfs, pPager->zWal, 0); - if( rc==SQLITE_IOERR_DELETE_NOENT ) rc = SQLITE_OK; - isWal = 0; - }else{ - rc = sqlite3OsAccess( - pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &isWal - ); - } - if( rc==SQLITE_OK ){ - if( isWal ){ - testcase( sqlite3PcachePagecount(pPager->pPCache)==0 ); - rc = sqlite3PagerOpenWal(pPager, 0); - }else if( pPager->journalMode==PAGER_JOURNALMODE_WAL ){ - pPager->journalMode = PAGER_JOURNALMODE_DELETE; - } - } - } - return rc; -} -#endif - -/* -** Playback savepoint pSavepoint. Or, if pSavepoint==NULL, then playback -** the entire master journal file. The case pSavepoint==NULL occurs when -** a ROLLBACK TO command is invoked on a SAVEPOINT that is a transaction -** savepoint. -** -** When pSavepoint is not NULL (meaning a non-transaction savepoint is -** being rolled back), then the rollback consists of up to three stages, -** performed in the order specified: -** -** * Pages are played back from the main journal starting at byte -** offset PagerSavepoint.iOffset and continuing to -** PagerSavepoint.iHdrOffset, or to the end of the main journal -** file if PagerSavepoint.iHdrOffset is zero. -** -** * If PagerSavepoint.iHdrOffset is not zero, then pages are played -** back starting from the journal header immediately following -** PagerSavepoint.iHdrOffset to the end of the main journal file. -** -** * Pages are then played back from the sub-journal file, starting -** with the PagerSavepoint.iSubRec and continuing to the end of -** the journal file. -** -** Throughout the rollback process, each time a page is rolled back, the -** corresponding bit is set in a bitvec structure (variable pDone in the -** implementation below). This is used to ensure that a page is only -** rolled back the first time it is encountered in either journal. -** -** If pSavepoint is NULL, then pages are only played back from the main -** journal file. There is no need for a bitvec in this case. -** -** In either case, before playback commences the Pager.dbSize variable -** is reset to the value that it held at the start of the savepoint -** (or transaction). No page with a page-number greater than this value -** is played back. If one is encountered it is simply skipped. -*/ -static int pagerPlaybackSavepoint(Pager *pPager, PagerSavepoint *pSavepoint){ - i64 szJ; /* Effective size of the main journal */ - i64 iHdrOff; /* End of first segment of main-journal records */ - int rc = SQLITE_OK; /* Return code */ - Bitvec *pDone = 0; /* Bitvec to ensure pages played back only once */ - - assert( pPager->eState!=PAGER_ERROR ); - assert( pPager->eState>=PAGER_WRITER_LOCKED ); - - /* Allocate a bitvec to use to store the set of pages rolled back */ - if( pSavepoint ){ - pDone = sqlite3BitvecCreate(pSavepoint->nOrig); - if( !pDone ){ - return SQLITE_NOMEM; - } - } - - /* Set the database size back to the value it was before the savepoint - ** being reverted was opened. - */ - pPager->dbSize = pSavepoint ? pSavepoint->nOrig : pPager->dbOrigSize; - pPager->changeCountDone = pPager->tempFile; - - if( !pSavepoint && pagerUseWal(pPager) ){ - return pagerRollbackWal(pPager); - } - - /* Use pPager->journalOff as the effective size of the main rollback - ** journal. The actual file might be larger than this in - ** PAGER_JOURNALMODE_TRUNCATE or PAGER_JOURNALMODE_PERSIST. But anything - ** past pPager->journalOff is off-limits to us. - */ - szJ = pPager->journalOff; - assert( pagerUseWal(pPager)==0 || szJ==0 ); - - /* Begin by rolling back records from the main journal starting at - ** PagerSavepoint.iOffset and continuing to the next journal header. - ** There might be records in the main journal that have a page number - ** greater than the current database size (pPager->dbSize) but those - ** will be skipped automatically. Pages are added to pDone as they - ** are played back. - */ - if( pSavepoint && !pagerUseWal(pPager) ){ - iHdrOff = pSavepoint->iHdrOffset ? pSavepoint->iHdrOffset : szJ; - pPager->journalOff = pSavepoint->iOffset; - while( rc==SQLITE_OK && pPager->journalOffjournalOff, pDone, 1, 1); - } - assert( rc!=SQLITE_DONE ); - }else{ - pPager->journalOff = 0; - } - - /* Continue rolling back records out of the main journal starting at - ** the first journal header seen and continuing until the effective end - ** of the main journal file. Continue to skip out-of-range pages and - ** continue adding pages rolled back to pDone. - */ - while( rc==SQLITE_OK && pPager->journalOffjournalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff" - ** test is related to ticket #2565. See the discussion in the - ** pager_playback() function for additional information. - */ - if( nJRec==0 - && pPager->journalHdr+JOURNAL_HDR_SZ(pPager)==pPager->journalOff - ){ - nJRec = (u32)((szJ - pPager->journalOff)/JOURNAL_PG_SZ(pPager)); - } - for(ii=0; rc==SQLITE_OK && iijournalOffjournalOff, pDone, 1, 1); - } - assert( rc!=SQLITE_DONE ); - } - assert( rc!=SQLITE_OK || pPager->journalOff>=szJ ); - - /* Finally, rollback pages from the sub-journal. Page that were - ** previously rolled back out of the main journal (and are hence in pDone) - ** will be skipped. Out-of-range pages are also skipped. - */ - if( pSavepoint ){ - u32 ii; /* Loop counter */ - i64 offset = (i64)pSavepoint->iSubRec*(4+pPager->pageSize); - - if( pagerUseWal(pPager) ){ - rc = sqlite3WalSavepointUndo(pPager->pWal, pSavepoint->aWalData); - } - for(ii=pSavepoint->iSubRec; rc==SQLITE_OK && iinSubRec; ii++){ - assert( offset==(i64)ii*(4+pPager->pageSize) ); - rc = pager_playback_one_page(pPager, &offset, pDone, 0, 1); - } - assert( rc!=SQLITE_DONE ); - } - - sqlite3BitvecDestroy(pDone); - if( rc==SQLITE_OK ){ - pPager->journalOff = szJ; - } - - return rc; -} - -/* -** Change the maximum number of in-memory pages that are allowed. -*/ -SQLITE_PRIVATE void sqlite3PagerSetCachesize(Pager *pPager, int mxPage){ - sqlite3PcacheSetCachesize(pPager->pPCache, mxPage); -} - -/* -** Invoke SQLITE_FCNTL_MMAP_SIZE based on the current value of szMmap. -*/ -static void pagerFixMaplimit(Pager *pPager){ -#if SQLITE_MAX_MMAP_SIZE>0 - sqlite3_file *fd = pPager->fd; - if( isOpen(fd) && fd->pMethods->iVersion>=3 ){ - sqlite3_int64 sz; - sz = pPager->szMmap; - pPager->bUseFetch = (sz>0); - sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_MMAP_SIZE, &sz); - } -#endif -} - -/* -** Change the maximum size of any memory mapping made of the database file. -*/ -SQLITE_PRIVATE void sqlite3PagerSetMmapLimit(Pager *pPager, sqlite3_int64 szMmap){ - pPager->szMmap = szMmap; - pagerFixMaplimit(pPager); -} - -/* -** Free as much memory as possible from the pager. -*/ -SQLITE_PRIVATE void sqlite3PagerShrink(Pager *pPager){ - sqlite3PcacheShrink(pPager->pPCache); -} - -/* -** Adjust settings of the pager to those specified in the pgFlags parameter. -** -** The "level" in pgFlags & PAGER_SYNCHRONOUS_MASK sets the robustness -** of the database to damage due to OS crashes or power failures by -** changing the number of syncs()s when writing the journals. -** There are three levels: -** -** OFF sqlite3OsSync() is never called. This is the default -** for temporary and transient files. -** -** NORMAL The journal is synced once before writes begin on the -** database. This is normally adequate protection, but -** it is theoretically possible, though very unlikely, -** that an inopertune power failure could leave the journal -** in a state which would cause damage to the database -** when it is rolled back. -** -** FULL The journal is synced twice before writes begin on the -** database (with some additional information - the nRec field -** of the journal header - being written in between the two -** syncs). If we assume that writing a -** single disk sector is atomic, then this mode provides -** assurance that the journal will not be corrupted to the -** point of causing damage to the database during rollback. -** -** The above is for a rollback-journal mode. For WAL mode, OFF continues -** to mean that no syncs ever occur. NORMAL means that the WAL is synced -** prior to the start of checkpoint and that the database file is synced -** at the conclusion of the checkpoint if the entire content of the WAL -** was written back into the database. But no sync operations occur for -** an ordinary commit in NORMAL mode with WAL. FULL means that the WAL -** file is synced following each commit operation, in addition to the -** syncs associated with NORMAL. -** -** Do not confuse synchronous=FULL with SQLITE_SYNC_FULL. The -** SQLITE_SYNC_FULL macro means to use the MacOSX-style full-fsync -** using fcntl(F_FULLFSYNC). SQLITE_SYNC_NORMAL means to do an -** ordinary fsync() call. There is no difference between SQLITE_SYNC_FULL -** and SQLITE_SYNC_NORMAL on platforms other than MacOSX. But the -** synchronous=FULL versus synchronous=NORMAL setting determines when -** the xSync primitive is called and is relevant to all platforms. -** -** Numeric values associated with these states are OFF==1, NORMAL=2, -** and FULL=3. -*/ -#ifndef SQLITE_OMIT_PAGER_PRAGMAS -SQLITE_PRIVATE void sqlite3PagerSetFlags( - Pager *pPager, /* The pager to set safety level for */ - unsigned pgFlags /* Various flags */ -){ - unsigned level = pgFlags & PAGER_SYNCHRONOUS_MASK; - assert( level>=1 && level<=3 ); - pPager->noSync = (level==1 || pPager->tempFile) ?1:0; - pPager->fullSync = (level==3 && !pPager->tempFile) ?1:0; - if( pPager->noSync ){ - pPager->syncFlags = 0; - pPager->ckptSyncFlags = 0; - }else if( pgFlags & PAGER_FULLFSYNC ){ - pPager->syncFlags = SQLITE_SYNC_FULL; - pPager->ckptSyncFlags = SQLITE_SYNC_FULL; - }else if( pgFlags & PAGER_CKPT_FULLFSYNC ){ - pPager->syncFlags = SQLITE_SYNC_NORMAL; - pPager->ckptSyncFlags = SQLITE_SYNC_FULL; - }else{ - pPager->syncFlags = SQLITE_SYNC_NORMAL; - pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL; - } - pPager->walSyncFlags = pPager->syncFlags; - if( pPager->fullSync ){ - pPager->walSyncFlags |= WAL_SYNC_TRANSACTIONS; - } - if( pgFlags & PAGER_CACHESPILL ){ - pPager->doNotSpill &= ~SPILLFLAG_OFF; - }else{ - pPager->doNotSpill |= SPILLFLAG_OFF; - } -} -#endif - -/* -** The following global variable is incremented whenever the library -** attempts to open a temporary file. This information is used for -** testing and analysis only. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_opentemp_count = 0; -#endif - -/* -** Open a temporary file. -** -** Write the file descriptor into *pFile. Return SQLITE_OK on success -** or some other error code if we fail. The OS will automatically -** delete the temporary file when it is closed. -** -** The flags passed to the VFS layer xOpen() call are those specified -** by parameter vfsFlags ORed with the following: -** -** SQLITE_OPEN_READWRITE -** SQLITE_OPEN_CREATE -** SQLITE_OPEN_EXCLUSIVE -** SQLITE_OPEN_DELETEONCLOSE -*/ -static int pagerOpentemp( - Pager *pPager, /* The pager object */ - sqlite3_file *pFile, /* Write the file descriptor here */ - int vfsFlags /* Flags passed through to the VFS */ -){ - int rc; /* Return code */ - -#ifdef SQLITE_TEST - sqlite3_opentemp_count++; /* Used for testing and analysis only */ -#endif - - vfsFlags |= SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | - SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE; - rc = sqlite3OsOpen(pPager->pVfs, 0, pFile, vfsFlags, 0); - assert( rc!=SQLITE_OK || isOpen(pFile) ); - return rc; -} - -/* -** Set the busy handler function. -** -** The pager invokes the busy-handler if sqlite3OsLock() returns -** SQLITE_BUSY when trying to upgrade from no-lock to a SHARED lock, -** or when trying to upgrade from a RESERVED lock to an EXCLUSIVE -** lock. It does *not* invoke the busy handler when upgrading from -** SHARED to RESERVED, or when upgrading from SHARED to EXCLUSIVE -** (which occurs during hot-journal rollback). Summary: -** -** Transition | Invokes xBusyHandler -** -------------------------------------------------------- -** NO_LOCK -> SHARED_LOCK | Yes -** SHARED_LOCK -> RESERVED_LOCK | No -** SHARED_LOCK -> EXCLUSIVE_LOCK | No -** RESERVED_LOCK -> EXCLUSIVE_LOCK | Yes -** -** If the busy-handler callback returns non-zero, the lock is -** retried. If it returns zero, then the SQLITE_BUSY error is -** returned to the caller of the pager API function. -*/ -SQLITE_PRIVATE void sqlite3PagerSetBusyhandler( - Pager *pPager, /* Pager object */ - int (*xBusyHandler)(void *), /* Pointer to busy-handler function */ - void *pBusyHandlerArg /* Argument to pass to xBusyHandler */ -){ - pPager->xBusyHandler = xBusyHandler; - pPager->pBusyHandlerArg = pBusyHandlerArg; - - if( isOpen(pPager->fd) ){ - void **ap = (void **)&pPager->xBusyHandler; - assert( ((int(*)(void *))(ap[0]))==xBusyHandler ); - assert( ap[1]==pBusyHandlerArg ); - sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_BUSYHANDLER, (void *)ap); - } -} - -/* -** Change the page size used by the Pager object. The new page size -** is passed in *pPageSize. -** -** If the pager is in the error state when this function is called, it -** is a no-op. The value returned is the error state error code (i.e. -** one of SQLITE_IOERR, an SQLITE_IOERR_xxx sub-code or SQLITE_FULL). -** -** Otherwise, if all of the following are true: -** -** * the new page size (value of *pPageSize) is valid (a power -** of two between 512 and SQLITE_MAX_PAGE_SIZE, inclusive), and -** -** * there are no outstanding page references, and -** -** * the database is either not an in-memory database or it is -** an in-memory database that currently consists of zero pages. -** -** then the pager object page size is set to *pPageSize. -** -** If the page size is changed, then this function uses sqlite3PagerMalloc() -** to obtain a new Pager.pTmpSpace buffer. If this allocation attempt -** fails, SQLITE_NOMEM is returned and the page size remains unchanged. -** In all other cases, SQLITE_OK is returned. -** -** If the page size is not changed, either because one of the enumerated -** conditions above is not true, the pager was in error state when this -** function was called, or because the memory allocation attempt failed, -** then *pPageSize is set to the old, retained page size before returning. -*/ -SQLITE_PRIVATE int sqlite3PagerSetPagesize(Pager *pPager, u32 *pPageSize, int nReserve){ - int rc = SQLITE_OK; - - /* It is not possible to do a full assert_pager_state() here, as this - ** function may be called from within PagerOpen(), before the state - ** of the Pager object is internally consistent. - ** - ** At one point this function returned an error if the pager was in - ** PAGER_ERROR state. But since PAGER_ERROR state guarantees that - ** there is at least one outstanding page reference, this function - ** is a no-op for that case anyhow. - */ - - u32 pageSize = *pPageSize; - assert( pageSize==0 || (pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE) ); - if( (pPager->memDb==0 || pPager->dbSize==0) - && sqlite3PcacheRefCount(pPager->pPCache)==0 - && pageSize && pageSize!=(u32)pPager->pageSize - ){ - char *pNew = NULL; /* New temp space */ - i64 nByte = 0; - - if( pPager->eState>PAGER_OPEN && isOpen(pPager->fd) ){ - rc = sqlite3OsFileSize(pPager->fd, &nByte); - } - if( rc==SQLITE_OK ){ - pNew = (char *)sqlite3PageMalloc(pageSize); - if( !pNew ) rc = SQLITE_NOMEM; - } - - if( rc==SQLITE_OK ){ - pager_reset(pPager); - pPager->dbSize = (Pgno)((nByte+pageSize-1)/pageSize); - pPager->pageSize = pageSize; - sqlite3PageFree(pPager->pTmpSpace); - pPager->pTmpSpace = pNew; - sqlite3PcacheSetPageSize(pPager->pPCache, pageSize); - } - } - - *pPageSize = pPager->pageSize; - if( rc==SQLITE_OK ){ - if( nReserve<0 ) nReserve = pPager->nReserve; - assert( nReserve>=0 && nReserve<1000 ); - pPager->nReserve = (i16)nReserve; - pagerReportSize(pPager); - pagerFixMaplimit(pPager); - } - return rc; -} - -/* -** Return a pointer to the "temporary page" buffer held internally -** by the pager. This is a buffer that is big enough to hold the -** entire content of a database page. This buffer is used internally -** during rollback and will be overwritten whenever a rollback -** occurs. But other modules are free to use it too, as long as -** no rollbacks are happening. -*/ -SQLITE_PRIVATE void *sqlite3PagerTempSpace(Pager *pPager){ - return pPager->pTmpSpace; -} - -/* -** Attempt to set the maximum database page count if mxPage is positive. -** Make no changes if mxPage is zero or negative. And never reduce the -** maximum page count below the current size of the database. -** -** Regardless of mxPage, return the current maximum page count. -*/ -SQLITE_PRIVATE int sqlite3PagerMaxPageCount(Pager *pPager, int mxPage){ - if( mxPage>0 ){ - pPager->mxPgno = mxPage; - } - assert( pPager->eState!=PAGER_OPEN ); /* Called only by OP_MaxPgcnt */ - assert( pPager->mxPgno>=pPager->dbSize ); /* OP_MaxPgcnt enforces this */ - return pPager->mxPgno; -} - -/* -** The following set of routines are used to disable the simulated -** I/O error mechanism. These routines are used to avoid simulated -** errors in places where we do not care about errors. -** -** Unless -DSQLITE_TEST=1 is used, these routines are all no-ops -** and generate no code. -*/ -#ifdef SQLITE_TEST -SQLITE_API extern int sqlite3_io_error_pending; -SQLITE_API extern int sqlite3_io_error_hit; -static int saved_cnt; -void disable_simulated_io_errors(void){ - saved_cnt = sqlite3_io_error_pending; - sqlite3_io_error_pending = -1; -} -void enable_simulated_io_errors(void){ - sqlite3_io_error_pending = saved_cnt; -} -#else -# define disable_simulated_io_errors() -# define enable_simulated_io_errors() -#endif - -/* -** Read the first N bytes from the beginning of the file into memory -** that pDest points to. -** -** If the pager was opened on a transient file (zFilename==""), or -** opened on a file less than N bytes in size, the output buffer is -** zeroed and SQLITE_OK returned. The rationale for this is that this -** function is used to read database headers, and a new transient or -** zero sized database has a header than consists entirely of zeroes. -** -** If any IO error apart from SQLITE_IOERR_SHORT_READ is encountered, -** the error code is returned to the caller and the contents of the -** output buffer undefined. -*/ -SQLITE_PRIVATE int sqlite3PagerReadFileheader(Pager *pPager, int N, unsigned char *pDest){ - int rc = SQLITE_OK; - memset(pDest, 0, N); - assert( isOpen(pPager->fd) || pPager->tempFile ); - - /* This routine is only called by btree immediately after creating - ** the Pager object. There has not been an opportunity to transition - ** to WAL mode yet. - */ - assert( !pagerUseWal(pPager) ); - - if( isOpen(pPager->fd) ){ - IOTRACE(("DBHDR %p 0 %d\n", pPager, N)) - rc = sqlite3OsRead(pPager->fd, pDest, N, 0); - if( rc==SQLITE_IOERR_SHORT_READ ){ - rc = SQLITE_OK; - } - } - return rc; -} - -/* -** This function may only be called when a read-transaction is open on -** the pager. It returns the total number of pages in the database. -** -** However, if the file is between 1 and bytes in size, then -** this is considered a 1 page file. -*/ -SQLITE_PRIVATE void sqlite3PagerPagecount(Pager *pPager, int *pnPage){ - assert( pPager->eState>=PAGER_READER ); - assert( pPager->eState!=PAGER_WRITER_FINISHED ); - *pnPage = (int)pPager->dbSize; -} - - -/* -** Try to obtain a lock of type locktype on the database file. If -** a similar or greater lock is already held, this function is a no-op -** (returning SQLITE_OK immediately). -** -** Otherwise, attempt to obtain the lock using sqlite3OsLock(). Invoke -** the busy callback if the lock is currently not available. Repeat -** until the busy callback returns false or until the attempt to -** obtain the lock succeeds. -** -** Return SQLITE_OK on success and an error code if we cannot obtain -** the lock. If the lock is obtained successfully, set the Pager.state -** variable to locktype before returning. -*/ -static int pager_wait_on_lock(Pager *pPager, int locktype){ - int rc; /* Return code */ - - /* Check that this is either a no-op (because the requested lock is - ** already held, or one of the transistions that the busy-handler - ** may be invoked during, according to the comment above - ** sqlite3PagerSetBusyhandler(). - */ - assert( (pPager->eLock>=locktype) - || (pPager->eLock==NO_LOCK && locktype==SHARED_LOCK) - || (pPager->eLock==RESERVED_LOCK && locktype==EXCLUSIVE_LOCK) - ); - - do { - rc = pagerLockDb(pPager, locktype); - }while( rc==SQLITE_BUSY && pPager->xBusyHandler(pPager->pBusyHandlerArg) ); - return rc; -} - -/* -** Function assertTruncateConstraint(pPager) checks that one of the -** following is true for all dirty pages currently in the page-cache: -** -** a) The page number is less than or equal to the size of the -** current database image, in pages, OR -** -** b) if the page content were written at this time, it would not -** be necessary to write the current content out to the sub-journal -** (as determined by function subjRequiresPage()). -** -** If the condition asserted by this function were not true, and the -** dirty page were to be discarded from the cache via the pagerStress() -** routine, pagerStress() would not write the current page content to -** the database file. If a savepoint transaction were rolled back after -** this happened, the correct behavior would be to restore the current -** content of the page. However, since this content is not present in either -** the database file or the portion of the rollback journal and -** sub-journal rolled back the content could not be restored and the -** database image would become corrupt. It is therefore fortunate that -** this circumstance cannot arise. -*/ -#if defined(SQLITE_DEBUG) -static void assertTruncateConstraintCb(PgHdr *pPg){ - assert( pPg->flags&PGHDR_DIRTY ); - assert( !subjRequiresPage(pPg) || pPg->pgno<=pPg->pPager->dbSize ); -} -static void assertTruncateConstraint(Pager *pPager){ - sqlite3PcacheIterateDirty(pPager->pPCache, assertTruncateConstraintCb); -} -#else -# define assertTruncateConstraint(pPager) -#endif - -/* -** Truncate the in-memory database file image to nPage pages. This -** function does not actually modify the database file on disk. It -** just sets the internal state of the pager object so that the -** truncation will be done when the current transaction is committed. -** -** This function is only called right before committing a transaction. -** Once this function has been called, the transaction must either be -** rolled back or committed. It is not safe to call this function and -** then continue writing to the database. -*/ -SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ - assert( pPager->dbSize>=nPage ); - assert( pPager->eState>=PAGER_WRITER_CACHEMOD ); - pPager->dbSize = nPage; - - /* At one point the code here called assertTruncateConstraint() to - ** ensure that all pages being truncated away by this operation are, - ** if one or more savepoints are open, present in the savepoint - ** journal so that they can be restored if the savepoint is rolled - ** back. This is no longer necessary as this function is now only - ** called right before committing a transaction. So although the - ** Pager object may still have open savepoints (Pager.nSavepoint!=0), - ** they cannot be rolled back. So the assertTruncateConstraint() call - ** is no longer correct. */ -} - - -/* -** This function is called before attempting a hot-journal rollback. It -** syncs the journal file to disk, then sets pPager->journalHdr to the -** size of the journal file so that the pager_playback() routine knows -** that the entire journal file has been synced. -** -** Syncing a hot-journal to disk before attempting to roll it back ensures -** that if a power-failure occurs during the rollback, the process that -** attempts rollback following system recovery sees the same journal -** content as this process. -** -** If everything goes as planned, SQLITE_OK is returned. Otherwise, -** an SQLite error code. -*/ -static int pagerSyncHotJournal(Pager *pPager){ - int rc = SQLITE_OK; - if( !pPager->noSync ){ - rc = sqlite3OsSync(pPager->jfd, SQLITE_SYNC_NORMAL); - } - if( rc==SQLITE_OK ){ - rc = sqlite3OsFileSize(pPager->jfd, &pPager->journalHdr); - } - return rc; -} - -/* -** Obtain a reference to a memory mapped page object for page number pgno. -** The new object will use the pointer pData, obtained from xFetch(). -** If successful, set *ppPage to point to the new page reference -** and return SQLITE_OK. Otherwise, return an SQLite error code and set -** *ppPage to zero. -** -** Page references obtained by calling this function should be released -** by calling pagerReleaseMapPage(). -*/ -static int pagerAcquireMapPage( - Pager *pPager, /* Pager object */ - Pgno pgno, /* Page number */ - void *pData, /* xFetch()'d data for this page */ - PgHdr **ppPage /* OUT: Acquired page object */ -){ - PgHdr *p; /* Memory mapped page to return */ - - if( pPager->pMmapFreelist ){ - *ppPage = p = pPager->pMmapFreelist; - pPager->pMmapFreelist = p->pDirty; - p->pDirty = 0; - memset(p->pExtra, 0, pPager->nExtra); - }else{ - *ppPage = p = (PgHdr *)sqlite3MallocZero(sizeof(PgHdr) + pPager->nExtra); - if( p==0 ){ - sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1) * pPager->pageSize, pData); - return SQLITE_NOMEM; - } - p->pExtra = (void *)&p[1]; - p->flags = PGHDR_MMAP; - p->nRef = 1; - p->pPager = pPager; - } - - assert( p->pExtra==(void *)&p[1] ); - assert( p->pPage==0 ); - assert( p->flags==PGHDR_MMAP ); - assert( p->pPager==pPager ); - assert( p->nRef==1 ); - - p->pgno = pgno; - p->pData = pData; - pPager->nMmapOut++; - - return SQLITE_OK; -} - -/* -** Release a reference to page pPg. pPg must have been returned by an -** earlier call to pagerAcquireMapPage(). -*/ -static void pagerReleaseMapPage(PgHdr *pPg){ - Pager *pPager = pPg->pPager; - pPager->nMmapOut--; - pPg->pDirty = pPager->pMmapFreelist; - pPager->pMmapFreelist = pPg; - - assert( pPager->fd->pMethods->iVersion>=3 ); - sqlite3OsUnfetch(pPager->fd, (i64)(pPg->pgno-1)*pPager->pageSize, pPg->pData); -} - -/* -** Free all PgHdr objects stored in the Pager.pMmapFreelist list. -*/ -static void pagerFreeMapHdrs(Pager *pPager){ - PgHdr *p; - PgHdr *pNext; - for(p=pPager->pMmapFreelist; p; p=pNext){ - pNext = p->pDirty; - sqlite3_free(p); - } -} - - -/* -** Shutdown the page cache. Free all memory and close all files. -** -** If a transaction was in progress when this routine is called, that -** transaction is rolled back. All outstanding pages are invalidated -** and their memory is freed. Any attempt to use a page associated -** with this page cache after this function returns will likely -** result in a coredump. -** -** This function always succeeds. If a transaction is active an attempt -** is made to roll it back. If an error occurs during the rollback -** a hot journal may be left in the filesystem but no error is returned -** to the caller. -*/ -SQLITE_PRIVATE int sqlite3PagerClose(Pager *pPager){ - u8 *pTmp = (u8 *)pPager->pTmpSpace; - - assert( assert_pager_state(pPager) ); - disable_simulated_io_errors(); - sqlite3BeginBenignMalloc(); - pagerFreeMapHdrs(pPager); - /* pPager->errCode = 0; */ - pPager->exclusiveMode = 0; -#ifndef SQLITE_OMIT_WAL - sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, pPager->pageSize, pTmp); - pPager->pWal = 0; -#endif - pager_reset(pPager); - if( MEMDB ){ - pager_unlock(pPager); - }else{ - /* If it is open, sync the journal file before calling UnlockAndRollback. - ** If this is not done, then an unsynced portion of the open journal - ** file may be played back into the database. If a power failure occurs - ** while this is happening, the database could become corrupt. - ** - ** If an error occurs while trying to sync the journal, shift the pager - ** into the ERROR state. This causes UnlockAndRollback to unlock the - ** database and close the journal file without attempting to roll it - ** back or finalize it. The next database user will have to do hot-journal - ** rollback before accessing the database file. - */ - if( isOpen(pPager->jfd) ){ - pager_error(pPager, pagerSyncHotJournal(pPager)); - } - pagerUnlockAndRollback(pPager); - } - sqlite3EndBenignMalloc(); - enable_simulated_io_errors(); - PAGERTRACE(("CLOSE %d\n", PAGERID(pPager))); - IOTRACE(("CLOSE %p\n", pPager)) - sqlite3OsClose(pPager->jfd); - sqlite3OsClose(pPager->fd); - sqlite3PageFree(pTmp); - sqlite3PcacheClose(pPager->pPCache); - -#ifdef SQLITE_HAS_CODEC - if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec); -#endif - - assert( !pPager->aSavepoint && !pPager->pInJournal ); - assert( !isOpen(pPager->jfd) && !isOpen(pPager->sjfd) ); - - sqlite3_free(pPager); - return SQLITE_OK; -} - -#if !defined(NDEBUG) || defined(SQLITE_TEST) -/* -** Return the page number for page pPg. -*/ -SQLITE_PRIVATE Pgno sqlite3PagerPagenumber(DbPage *pPg){ - return pPg->pgno; -} -#endif - -/* -** Increment the reference count for page pPg. -*/ -SQLITE_PRIVATE void sqlite3PagerRef(DbPage *pPg){ - sqlite3PcacheRef(pPg); -} - -/* -** Sync the journal. In other words, make sure all the pages that have -** been written to the journal have actually reached the surface of the -** disk and can be restored in the event of a hot-journal rollback. -** -** If the Pager.noSync flag is set, then this function is a no-op. -** Otherwise, the actions required depend on the journal-mode and the -** device characteristics of the file-system, as follows: -** -** * If the journal file is an in-memory journal file, no action need -** be taken. -** -** * Otherwise, if the device does not support the SAFE_APPEND property, -** then the nRec field of the most recently written journal header -** is updated to contain the number of journal records that have -** been written following it. If the pager is operating in full-sync -** mode, then the journal file is synced before this field is updated. -** -** * If the device does not support the SEQUENTIAL property, then -** journal file is synced. -** -** Or, in pseudo-code: -** -** if( NOT ){ -** if( NOT SAFE_APPEND ){ -** if( ) xSync(); -** -** } -** if( NOT SEQUENTIAL ) xSync(); -** } -** -** If successful, this routine clears the PGHDR_NEED_SYNC flag of every -** page currently held in memory before returning SQLITE_OK. If an IO -** error is encountered, then the IO error code is returned to the caller. -*/ -static int syncJournal(Pager *pPager, int newHdr){ - int rc; /* Return code */ - - assert( pPager->eState==PAGER_WRITER_CACHEMOD - || pPager->eState==PAGER_WRITER_DBMOD - ); - assert( assert_pager_state(pPager) ); - assert( !pagerUseWal(pPager) ); - - rc = sqlite3PagerExclusiveLock(pPager); - if( rc!=SQLITE_OK ) return rc; - - if( !pPager->noSync ){ - assert( !pPager->tempFile ); - if( isOpen(pPager->jfd) && pPager->journalMode!=PAGER_JOURNALMODE_MEMORY ){ - const int iDc = sqlite3OsDeviceCharacteristics(pPager->fd); - assert( isOpen(pPager->jfd) ); - - if( 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){ - /* This block deals with an obscure problem. If the last connection - ** that wrote to this database was operating in persistent-journal - ** mode, then the journal file may at this point actually be larger - ** than Pager.journalOff bytes. If the next thing in the journal - ** file happens to be a journal-header (written as part of the - ** previous connection's transaction), and a crash or power-failure - ** occurs after nRec is updated but before this connection writes - ** anything else to the journal file (or commits/rolls back its - ** transaction), then SQLite may become confused when doing the - ** hot-journal rollback following recovery. It may roll back all - ** of this connections data, then proceed to rolling back the old, - ** out-of-date data that follows it. Database corruption. - ** - ** To work around this, if the journal file does appear to contain - ** a valid header following Pager.journalOff, then write a 0x00 - ** byte to the start of it to prevent it from being recognized. - ** - ** Variable iNextHdrOffset is set to the offset at which this - ** problematic header will occur, if it exists. aMagic is used - ** as a temporary buffer to inspect the first couple of bytes of - ** the potential journal header. - */ - i64 iNextHdrOffset; - u8 aMagic[8]; - u8 zHeader[sizeof(aJournalMagic)+4]; - - memcpy(zHeader, aJournalMagic, sizeof(aJournalMagic)); - put32bits(&zHeader[sizeof(aJournalMagic)], pPager->nRec); - - iNextHdrOffset = journalHdrOffset(pPager); - rc = sqlite3OsRead(pPager->jfd, aMagic, 8, iNextHdrOffset); - if( rc==SQLITE_OK && 0==memcmp(aMagic, aJournalMagic, 8) ){ - static const u8 zerobyte = 0; - rc = sqlite3OsWrite(pPager->jfd, &zerobyte, 1, iNextHdrOffset); - } - if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){ - return rc; - } - - /* Write the nRec value into the journal file header. If in - ** full-synchronous mode, sync the journal first. This ensures that - ** all data has really hit the disk before nRec is updated to mark - ** it as a candidate for rollback. - ** - ** This is not required if the persistent media supports the - ** SAFE_APPEND property. Because in this case it is not possible - ** for garbage data to be appended to the file, the nRec field - ** is populated with 0xFFFFFFFF when the journal header is written - ** and never needs to be updated. - */ - if( pPager->fullSync && 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){ - PAGERTRACE(("SYNC journal of %d\n", PAGERID(pPager))); - IOTRACE(("JSYNC %p\n", pPager)) - rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags); - if( rc!=SQLITE_OK ) return rc; - } - IOTRACE(("JHDR %p %lld\n", pPager, pPager->journalHdr)); - rc = sqlite3OsWrite( - pPager->jfd, zHeader, sizeof(zHeader), pPager->journalHdr - ); - if( rc!=SQLITE_OK ) return rc; - } - if( 0==(iDc&SQLITE_IOCAP_SEQUENTIAL) ){ - PAGERTRACE(("SYNC journal of %d\n", PAGERID(pPager))); - IOTRACE(("JSYNC %p\n", pPager)) - rc = sqlite3OsSync(pPager->jfd, pPager->syncFlags| - (pPager->syncFlags==SQLITE_SYNC_FULL?SQLITE_SYNC_DATAONLY:0) - ); - if( rc!=SQLITE_OK ) return rc; - } - - pPager->journalHdr = pPager->journalOff; - if( newHdr && 0==(iDc&SQLITE_IOCAP_SAFE_APPEND) ){ - pPager->nRec = 0; - rc = writeJournalHdr(pPager); - if( rc!=SQLITE_OK ) return rc; - } - }else{ - pPager->journalHdr = pPager->journalOff; - } - } - - /* Unless the pager is in noSync mode, the journal file was just - ** successfully synced. Either way, clear the PGHDR_NEED_SYNC flag on - ** all pages. - */ - sqlite3PcacheClearSyncFlags(pPager->pPCache); - pPager->eState = PAGER_WRITER_DBMOD; - assert( assert_pager_state(pPager) ); - return SQLITE_OK; -} - -/* -** The argument is the first in a linked list of dirty pages connected -** by the PgHdr.pDirty pointer. This function writes each one of the -** in-memory pages in the list to the database file. The argument may -** be NULL, representing an empty list. In this case this function is -** a no-op. -** -** The pager must hold at least a RESERVED lock when this function -** is called. Before writing anything to the database file, this lock -** is upgraded to an EXCLUSIVE lock. If the lock cannot be obtained, -** SQLITE_BUSY is returned and no data is written to the database file. -** -** If the pager is a temp-file pager and the actual file-system file -** is not yet open, it is created and opened before any data is -** written out. -** -** Once the lock has been upgraded and, if necessary, the file opened, -** the pages are written out to the database file in list order. Writing -** a page is skipped if it meets either of the following criteria: -** -** * The page number is greater than Pager.dbSize, or -** * The PGHDR_DONT_WRITE flag is set on the page. -** -** If writing out a page causes the database file to grow, Pager.dbFileSize -** is updated accordingly. If page 1 is written out, then the value cached -** in Pager.dbFileVers[] is updated to match the new value stored in -** the database file. -** -** If everything is successful, SQLITE_OK is returned. If an IO error -** occurs, an IO error code is returned. Or, if the EXCLUSIVE lock cannot -** be obtained, SQLITE_BUSY is returned. -*/ -static int pager_write_pagelist(Pager *pPager, PgHdr *pList){ - int rc = SQLITE_OK; /* Return code */ - - /* This function is only called for rollback pagers in WRITER_DBMOD state. */ - assert( !pagerUseWal(pPager) ); - assert( pPager->eState==PAGER_WRITER_DBMOD ); - assert( pPager->eLock==EXCLUSIVE_LOCK ); - - /* If the file is a temp-file has not yet been opened, open it now. It - ** is not possible for rc to be other than SQLITE_OK if this branch - ** is taken, as pager_wait_on_lock() is a no-op for temp-files. - */ - if( !isOpen(pPager->fd) ){ - assert( pPager->tempFile && rc==SQLITE_OK ); - rc = pagerOpentemp(pPager, pPager->fd, pPager->vfsFlags); - } - - /* Before the first write, give the VFS a hint of what the final - ** file size will be. - */ - assert( rc!=SQLITE_OK || isOpen(pPager->fd) ); - if( rc==SQLITE_OK - && pPager->dbHintSizedbSize - && (pList->pDirty || pList->pgno>pPager->dbHintSize) - ){ - sqlite3_int64 szFile = pPager->pageSize * (sqlite3_int64)pPager->dbSize; - sqlite3OsFileControlHint(pPager->fd, SQLITE_FCNTL_SIZE_HINT, &szFile); - pPager->dbHintSize = pPager->dbSize; - } - - while( rc==SQLITE_OK && pList ){ - Pgno pgno = pList->pgno; - - /* If there are dirty pages in the page cache with page numbers greater - ** than Pager.dbSize, this means sqlite3PagerTruncateImage() was called to - ** make the file smaller (presumably by auto-vacuum code). Do not write - ** any such pages to the file. - ** - ** Also, do not write out any page that has the PGHDR_DONT_WRITE flag - ** set (set by sqlite3PagerDontWrite()). - */ - if( pgno<=pPager->dbSize && 0==(pList->flags&PGHDR_DONT_WRITE) ){ - i64 offset = (pgno-1)*(i64)pPager->pageSize; /* Offset to write */ - char *pData; /* Data to write */ - - assert( (pList->flags&PGHDR_NEED_SYNC)==0 ); - if( pList->pgno==1 ) pager_write_changecounter(pList); - - /* Encode the database */ - CODEC2(pPager, pList->pData, pgno, 6, return SQLITE_NOMEM, pData); - - /* Write out the page data. */ - rc = sqlite3OsWrite(pPager->fd, pData, pPager->pageSize, offset); - - /* If page 1 was just written, update Pager.dbFileVers to match - ** the value now stored in the database file. If writing this - ** page caused the database file to grow, update dbFileSize. - */ - if( pgno==1 ){ - memcpy(&pPager->dbFileVers, &pData[24], sizeof(pPager->dbFileVers)); - } - if( pgno>pPager->dbFileSize ){ - pPager->dbFileSize = pgno; - } - pPager->aStat[PAGER_STAT_WRITE]++; - - /* Update any backup objects copying the contents of this pager. */ - sqlite3BackupUpdate(pPager->pBackup, pgno, (u8*)pList->pData); - - PAGERTRACE(("STORE %d page %d hash(%08x)\n", - PAGERID(pPager), pgno, pager_pagehash(pList))); - IOTRACE(("PGOUT %p %d\n", pPager, pgno)); - PAGER_INCR(sqlite3_pager_writedb_count); - }else{ - PAGERTRACE(("NOSTORE %d page %d\n", PAGERID(pPager), pgno)); - } - pager_set_pagehash(pList); - pList = pList->pDirty; - } - - return rc; -} - -/* -** Ensure that the sub-journal file is open. If it is already open, this -** function is a no-op. -** -** SQLITE_OK is returned if everything goes according to plan. An -** SQLITE_IOERR_XXX error code is returned if a call to sqlite3OsOpen() -** fails. -*/ -static int openSubJournal(Pager *pPager){ - int rc = SQLITE_OK; - if( !isOpen(pPager->sjfd) ){ - if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY || pPager->subjInMemory ){ - sqlite3MemJournalOpen(pPager->sjfd); - }else{ - rc = pagerOpentemp(pPager, pPager->sjfd, SQLITE_OPEN_SUBJOURNAL); - } - } - return rc; -} - -/* -** Append a record of the current state of page pPg to the sub-journal. -** It is the callers responsibility to use subjRequiresPage() to check -** that it is really required before calling this function. -** -** If successful, set the bit corresponding to pPg->pgno in the bitvecs -** for all open savepoints before returning. -** -** This function returns SQLITE_OK if everything is successful, an IO -** error code if the attempt to write to the sub-journal fails, or -** SQLITE_NOMEM if a malloc fails while setting a bit in a savepoint -** bitvec. -*/ -static int subjournalPage(PgHdr *pPg){ - int rc = SQLITE_OK; - Pager *pPager = pPg->pPager; - if( pPager->journalMode!=PAGER_JOURNALMODE_OFF ){ - - /* Open the sub-journal, if it has not already been opened */ - assert( pPager->useJournal ); - assert( isOpen(pPager->jfd) || pagerUseWal(pPager) ); - assert( isOpen(pPager->sjfd) || pPager->nSubRec==0 ); - assert( pagerUseWal(pPager) - || pageInJournal(pPager, pPg) - || pPg->pgno>pPager->dbOrigSize - ); - rc = openSubJournal(pPager); - - /* If the sub-journal was opened successfully (or was already open), - ** write the journal record into the file. */ - if( rc==SQLITE_OK ){ - void *pData = pPg->pData; - i64 offset = (i64)pPager->nSubRec*(4+pPager->pageSize); - char *pData2; - - CODEC2(pPager, pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2); - PAGERTRACE(("STMT-JOURNAL %d page %d\n", PAGERID(pPager), pPg->pgno)); - rc = write32bits(pPager->sjfd, offset, pPg->pgno); - if( rc==SQLITE_OK ){ - rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4); - } - } - } - if( rc==SQLITE_OK ){ - pPager->nSubRec++; - assert( pPager->nSavepoint>0 ); - rc = addToSavepointBitvecs(pPager, pPg->pgno); - } - return rc; -} - -/* -** This function is called by the pcache layer when it has reached some -** soft memory limit. The first argument is a pointer to a Pager object -** (cast as a void*). The pager is always 'purgeable' (not an in-memory -** database). The second argument is a reference to a page that is -** currently dirty but has no outstanding references. The page -** is always associated with the Pager object passed as the first -** argument. -** -** The job of this function is to make pPg clean by writing its contents -** out to the database file, if possible. This may involve syncing the -** journal file. -** -** If successful, sqlite3PcacheMakeClean() is called on the page and -** SQLITE_OK returned. If an IO error occurs while trying to make the -** page clean, the IO error code is returned. If the page cannot be -** made clean for some other reason, but no error occurs, then SQLITE_OK -** is returned by sqlite3PcacheMakeClean() is not called. -*/ -static int pagerStress(void *p, PgHdr *pPg){ - Pager *pPager = (Pager *)p; - int rc = SQLITE_OK; - - assert( pPg->pPager==pPager ); - assert( pPg->flags&PGHDR_DIRTY ); - - /* The doNotSpill NOSYNC bit is set during times when doing a sync of - ** journal (and adding a new header) is not allowed. This occurs - ** during calls to sqlite3PagerWrite() while trying to journal multiple - ** pages belonging to the same sector. - ** - ** The doNotSpill ROLLBACK and OFF bits inhibits all cache spilling - ** regardless of whether or not a sync is required. This is set during - ** a rollback or by user request, respectively. - ** - ** Spilling is also prohibited when in an error state since that could - ** lead to database corruption. In the current implementaton it - ** is impossible for sqlite3PcacheFetch() to be called with createFlag==1 - ** while in the error state, hence it is impossible for this routine to - ** be called in the error state. Nevertheless, we include a NEVER() - ** test for the error state as a safeguard against future changes. - */ - if( NEVER(pPager->errCode) ) return SQLITE_OK; - testcase( pPager->doNotSpill & SPILLFLAG_ROLLBACK ); - testcase( pPager->doNotSpill & SPILLFLAG_OFF ); - testcase( pPager->doNotSpill & SPILLFLAG_NOSYNC ); - if( pPager->doNotSpill - && ((pPager->doNotSpill & (SPILLFLAG_ROLLBACK|SPILLFLAG_OFF))!=0 - || (pPg->flags & PGHDR_NEED_SYNC)!=0) - ){ - return SQLITE_OK; - } - - pPg->pDirty = 0; - if( pagerUseWal(pPager) ){ - /* Write a single frame for this page to the log. */ - if( subjRequiresPage(pPg) ){ - rc = subjournalPage(pPg); - } - if( rc==SQLITE_OK ){ - rc = pagerWalFrames(pPager, pPg, 0, 0); - } - }else{ - - /* Sync the journal file if required. */ - if( pPg->flags&PGHDR_NEED_SYNC - || pPager->eState==PAGER_WRITER_CACHEMOD - ){ - rc = syncJournal(pPager, 1); - } - - /* If the page number of this page is larger than the current size of - ** the database image, it may need to be written to the sub-journal. - ** This is because the call to pager_write_pagelist() below will not - ** actually write data to the file in this case. - ** - ** Consider the following sequence of events: - ** - ** BEGIN; - ** - ** - ** SAVEPOINT sp; - ** - ** pagerStress(page X) - ** ROLLBACK TO sp; - ** - ** If (X>Y), then when pagerStress is called page X will not be written - ** out to the database file, but will be dropped from the cache. Then, - ** following the "ROLLBACK TO sp" statement, reading page X will read - ** data from the database file. This will be the copy of page X as it - ** was when the transaction started, not as it was when "SAVEPOINT sp" - ** was executed. - ** - ** The solution is to write the current data for page X into the - ** sub-journal file now (if it is not already there), so that it will - ** be restored to its current value when the "ROLLBACK TO sp" is - ** executed. - */ - if( NEVER( - rc==SQLITE_OK && pPg->pgno>pPager->dbSize && subjRequiresPage(pPg) - ) ){ - rc = subjournalPage(pPg); - } - - /* Write the contents of the page out to the database file. */ - if( rc==SQLITE_OK ){ - assert( (pPg->flags&PGHDR_NEED_SYNC)==0 ); - rc = pager_write_pagelist(pPager, pPg); - } - } - - /* Mark the page as clean. */ - if( rc==SQLITE_OK ){ - PAGERTRACE(("STRESS %d page %d\n", PAGERID(pPager), pPg->pgno)); - sqlite3PcacheMakeClean(pPg); - } - - return pager_error(pPager, rc); -} - - -/* -** Allocate and initialize a new Pager object and put a pointer to it -** in *ppPager. The pager should eventually be freed by passing it -** to sqlite3PagerClose(). -** -** The zFilename argument is the path to the database file to open. -** If zFilename is NULL then a randomly-named temporary file is created -** and used as the file to be cached. Temporary files are be deleted -** automatically when they are closed. If zFilename is ":memory:" then -** all information is held in cache. It is never written to disk. -** This can be used to implement an in-memory database. -** -** The nExtra parameter specifies the number of bytes of space allocated -** along with each page reference. This space is available to the user -** via the sqlite3PagerGetExtra() API. -** -** The flags argument is used to specify properties that affect the -** operation of the pager. It should be passed some bitwise combination -** of the PAGER_* flags. -** -** The vfsFlags parameter is a bitmask to pass to the flags parameter -** of the xOpen() method of the supplied VFS when opening files. -** -** If the pager object is allocated and the specified file opened -** successfully, SQLITE_OK is returned and *ppPager set to point to -** the new pager object. If an error occurs, *ppPager is set to NULL -** and error code returned. This function may return SQLITE_NOMEM -** (sqlite3Malloc() is used to allocate memory), SQLITE_CANTOPEN or -** various SQLITE_IO_XXX errors. -*/ -SQLITE_PRIVATE int sqlite3PagerOpen( - sqlite3_vfs *pVfs, /* The virtual file system to use */ - Pager **ppPager, /* OUT: Return the Pager structure here */ - const char *zFilename, /* Name of the database file to open */ - int nExtra, /* Extra bytes append to each in-memory page */ - int flags, /* flags controlling this file */ - int vfsFlags, /* flags passed through to sqlite3_vfs.xOpen() */ - void (*xReinit)(DbPage*) /* Function to reinitialize pages */ -){ - u8 *pPtr; - Pager *pPager = 0; /* Pager object to allocate and return */ - int rc = SQLITE_OK; /* Return code */ - int tempFile = 0; /* True for temp files (incl. in-memory files) */ - int memDb = 0; /* True if this is an in-memory file */ - int readOnly = 0; /* True if this is a read-only file */ - int journalFileSize; /* Bytes to allocate for each journal fd */ - char *zPathname = 0; /* Full path to database file */ - int nPathname = 0; /* Number of bytes in zPathname */ - int useJournal = (flags & PAGER_OMIT_JOURNAL)==0; /* False to omit journal */ - int pcacheSize = sqlite3PcacheSize(); /* Bytes to allocate for PCache */ - u32 szPageDflt = SQLITE_DEFAULT_PAGE_SIZE; /* Default page size */ - const char *zUri = 0; /* URI args to copy */ - int nUri = 0; /* Number of bytes of URI args at *zUri */ - - /* Figure out how much space is required for each journal file-handle - ** (there are two of them, the main journal and the sub-journal). This - ** is the maximum space required for an in-memory journal file handle - ** and a regular journal file-handle. Note that a "regular journal-handle" - ** may be a wrapper capable of caching the first portion of the journal - ** file in memory to implement the atomic-write optimization (see - ** source file journal.c). - */ - if( sqlite3JournalSize(pVfs)>sqlite3MemJournalSize() ){ - journalFileSize = ROUND8(sqlite3JournalSize(pVfs)); - }else{ - journalFileSize = ROUND8(sqlite3MemJournalSize()); - } - - /* Set the output variable to NULL in case an error occurs. */ - *ppPager = 0; - -#ifndef SQLITE_OMIT_MEMORYDB - if( flags & PAGER_MEMORY ){ - memDb = 1; - if( zFilename && zFilename[0] ){ - zPathname = sqlite3DbStrDup(0, zFilename); - if( zPathname==0 ) return SQLITE_NOMEM; - nPathname = sqlite3Strlen30(zPathname); - zFilename = 0; - } - } -#endif - - /* Compute and store the full pathname in an allocated buffer pointed - ** to by zPathname, length nPathname. Or, if this is a temporary file, - ** leave both nPathname and zPathname set to 0. - */ - if( zFilename && zFilename[0] ){ - const char *z; - nPathname = pVfs->mxPathname+1; - zPathname = sqlite3DbMallocRaw(0, nPathname*2); - if( zPathname==0 ){ - return SQLITE_NOMEM; - } - zPathname[0] = 0; /* Make sure initialized even if FullPathname() fails */ - rc = sqlite3OsFullPathname(pVfs, zFilename, nPathname, zPathname); - nPathname = sqlite3Strlen30(zPathname); - z = zUri = &zFilename[sqlite3Strlen30(zFilename)+1]; - while( *z ){ - z += sqlite3Strlen30(z)+1; - z += sqlite3Strlen30(z)+1; - } - nUri = (int)(&z[1] - zUri); - assert( nUri>=0 ); - if( rc==SQLITE_OK && nPathname+8>pVfs->mxPathname ){ - /* This branch is taken when the journal path required by - ** the database being opened will be more than pVfs->mxPathname - ** bytes in length. This means the database cannot be opened, - ** as it will not be possible to open the journal file or even - ** check for a hot-journal before reading. - */ - rc = SQLITE_CANTOPEN_BKPT; - } - if( rc!=SQLITE_OK ){ - sqlite3DbFree(0, zPathname); - return rc; - } - } - - /* Allocate memory for the Pager structure, PCache object, the - ** three file descriptors, the database file name and the journal - ** file name. The layout in memory is as follows: - ** - ** Pager object (sizeof(Pager) bytes) - ** PCache object (sqlite3PcacheSize() bytes) - ** Database file handle (pVfs->szOsFile bytes) - ** Sub-journal file handle (journalFileSize bytes) - ** Main journal file handle (journalFileSize bytes) - ** Database file name (nPathname+1 bytes) - ** Journal file name (nPathname+8+1 bytes) - */ - pPtr = (u8 *)sqlite3MallocZero( - ROUND8(sizeof(*pPager)) + /* Pager structure */ - ROUND8(pcacheSize) + /* PCache object */ - ROUND8(pVfs->szOsFile) + /* The main db file */ - journalFileSize * 2 + /* The two journal files */ - nPathname + 1 + nUri + /* zFilename */ - nPathname + 8 + 2 /* zJournal */ -#ifndef SQLITE_OMIT_WAL - + nPathname + 4 + 2 /* zWal */ -#endif - ); - assert( EIGHT_BYTE_ALIGNMENT(SQLITE_INT_TO_PTR(journalFileSize)) ); - if( !pPtr ){ - sqlite3DbFree(0, zPathname); - return SQLITE_NOMEM; - } - pPager = (Pager*)(pPtr); - pPager->pPCache = (PCache*)(pPtr += ROUND8(sizeof(*pPager))); - pPager->fd = (sqlite3_file*)(pPtr += ROUND8(pcacheSize)); - pPager->sjfd = (sqlite3_file*)(pPtr += ROUND8(pVfs->szOsFile)); - pPager->jfd = (sqlite3_file*)(pPtr += journalFileSize); - pPager->zFilename = (char*)(pPtr += journalFileSize); - assert( EIGHT_BYTE_ALIGNMENT(pPager->jfd) ); - - /* Fill in the Pager.zFilename and Pager.zJournal buffers, if required. */ - if( zPathname ){ - assert( nPathname>0 ); - pPager->zJournal = (char*)(pPtr += nPathname + 1 + nUri); - memcpy(pPager->zFilename, zPathname, nPathname); - if( nUri ) memcpy(&pPager->zFilename[nPathname+1], zUri, nUri); - memcpy(pPager->zJournal, zPathname, nPathname); - memcpy(&pPager->zJournal[nPathname], "-journal\000", 8+2); - sqlite3FileSuffix3(pPager->zFilename, pPager->zJournal); -#ifndef SQLITE_OMIT_WAL - pPager->zWal = &pPager->zJournal[nPathname+8+1]; - memcpy(pPager->zWal, zPathname, nPathname); - memcpy(&pPager->zWal[nPathname], "-wal\000", 4+1); - sqlite3FileSuffix3(pPager->zFilename, pPager->zWal); -#endif - sqlite3DbFree(0, zPathname); - } - pPager->pVfs = pVfs; - pPager->vfsFlags = vfsFlags; - - /* Open the pager file. - */ - if( zFilename && zFilename[0] ){ - int fout = 0; /* VFS flags returned by xOpen() */ - rc = sqlite3OsOpen(pVfs, pPager->zFilename, pPager->fd, vfsFlags, &fout); - assert( !memDb ); - readOnly = (fout&SQLITE_OPEN_READONLY); - - /* If the file was successfully opened for read/write access, - ** choose a default page size in case we have to create the - ** database file. The default page size is the maximum of: - ** - ** + SQLITE_DEFAULT_PAGE_SIZE, - ** + The value returned by sqlite3OsSectorSize() - ** + The largest page size that can be written atomically. - */ - if( rc==SQLITE_OK && !readOnly ){ - setSectorSize(pPager); - assert(SQLITE_DEFAULT_PAGE_SIZE<=SQLITE_MAX_DEFAULT_PAGE_SIZE); - if( szPageDfltsectorSize ){ - if( pPager->sectorSize>SQLITE_MAX_DEFAULT_PAGE_SIZE ){ - szPageDflt = SQLITE_MAX_DEFAULT_PAGE_SIZE; - }else{ - szPageDflt = (u32)pPager->sectorSize; - } - } -#ifdef SQLITE_ENABLE_ATOMIC_WRITE - { - int iDc = sqlite3OsDeviceCharacteristics(pPager->fd); - int ii; - assert(SQLITE_IOCAP_ATOMIC512==(512>>8)); - assert(SQLITE_IOCAP_ATOMIC64K==(65536>>8)); - assert(SQLITE_MAX_DEFAULT_PAGE_SIZE<=65536); - for(ii=szPageDflt; ii<=SQLITE_MAX_DEFAULT_PAGE_SIZE; ii=ii*2){ - if( iDc&(SQLITE_IOCAP_ATOMIC|(ii>>8)) ){ - szPageDflt = ii; - } - } - } -#endif - } - }else{ - /* If a temporary file is requested, it is not opened immediately. - ** In this case we accept the default page size and delay actually - ** opening the file until the first call to OsWrite(). - ** - ** This branch is also run for an in-memory database. An in-memory - ** database is the same as a temp-file that is never written out to - ** disk and uses an in-memory rollback journal. - */ - tempFile = 1; - pPager->eState = PAGER_READER; - pPager->eLock = EXCLUSIVE_LOCK; - readOnly = (vfsFlags&SQLITE_OPEN_READONLY); - } - - /* The following call to PagerSetPagesize() serves to set the value of - ** Pager.pageSize and to allocate the Pager.pTmpSpace buffer. - */ - if( rc==SQLITE_OK ){ - assert( pPager->memDb==0 ); - rc = sqlite3PagerSetPagesize(pPager, &szPageDflt, -1); - testcase( rc!=SQLITE_OK ); - } - - /* If an error occurred in either of the blocks above, free the - ** Pager structure and close the file. - */ - if( rc!=SQLITE_OK ){ - assert( !pPager->pTmpSpace ); - sqlite3OsClose(pPager->fd); - sqlite3_free(pPager); - return rc; - } - - /* Initialize the PCache object. */ - assert( nExtra<1000 ); - nExtra = ROUND8(nExtra); - sqlite3PcacheOpen(szPageDflt, nExtra, !memDb, - !memDb?pagerStress:0, (void *)pPager, pPager->pPCache); - - PAGERTRACE(("OPEN %d %s\n", FILEHANDLEID(pPager->fd), pPager->zFilename)); - IOTRACE(("OPEN %p %s\n", pPager, pPager->zFilename)) - - pPager->useJournal = (u8)useJournal; - /* pPager->stmtOpen = 0; */ - /* pPager->stmtInUse = 0; */ - /* pPager->nRef = 0; */ - /* pPager->stmtSize = 0; */ - /* pPager->stmtJSize = 0; */ - /* pPager->nPage = 0; */ - pPager->mxPgno = SQLITE_MAX_PAGE_COUNT; - /* pPager->state = PAGER_UNLOCK; */ -#if 0 - assert( pPager->state == (tempFile ? PAGER_EXCLUSIVE : PAGER_UNLOCK) ); -#endif - /* pPager->errMask = 0; */ - pPager->tempFile = (u8)tempFile; - assert( tempFile==PAGER_LOCKINGMODE_NORMAL - || tempFile==PAGER_LOCKINGMODE_EXCLUSIVE ); - assert( PAGER_LOCKINGMODE_EXCLUSIVE==1 ); - pPager->exclusiveMode = (u8)tempFile; - pPager->changeCountDone = pPager->tempFile; - pPager->memDb = (u8)memDb; - pPager->readOnly = (u8)readOnly; - assert( useJournal || pPager->tempFile ); - pPager->noSync = pPager->tempFile; - if( pPager->noSync ){ - assert( pPager->fullSync==0 ); - assert( pPager->syncFlags==0 ); - assert( pPager->walSyncFlags==0 ); - assert( pPager->ckptSyncFlags==0 ); - }else{ - pPager->fullSync = 1; - pPager->syncFlags = SQLITE_SYNC_NORMAL; - pPager->walSyncFlags = SQLITE_SYNC_NORMAL | WAL_SYNC_TRANSACTIONS; - pPager->ckptSyncFlags = SQLITE_SYNC_NORMAL; - } - /* pPager->pFirst = 0; */ - /* pPager->pFirstSynced = 0; */ - /* pPager->pLast = 0; */ - pPager->nExtra = (u16)nExtra; - pPager->journalSizeLimit = SQLITE_DEFAULT_JOURNAL_SIZE_LIMIT; - assert( isOpen(pPager->fd) || tempFile ); - setSectorSize(pPager); - if( !useJournal ){ - pPager->journalMode = PAGER_JOURNALMODE_OFF; - }else if( memDb ){ - pPager->journalMode = PAGER_JOURNALMODE_MEMORY; - } - /* pPager->xBusyHandler = 0; */ - /* pPager->pBusyHandlerArg = 0; */ - pPager->xReiniter = xReinit; - /* memset(pPager->aHash, 0, sizeof(pPager->aHash)); */ - /* pPager->szMmap = SQLITE_DEFAULT_MMAP_SIZE // will be set by btree.c */ - - *ppPager = pPager; - return SQLITE_OK; -} - - -/* Verify that the database file has not be deleted or renamed out from -** under the pager. Return SQLITE_OK if the database is still were it ought -** to be on disk. Return non-zero (SQLITE_READONLY_DBMOVED or some other error -** code from sqlite3OsAccess()) if the database has gone missing. -*/ -static int databaseIsUnmoved(Pager *pPager){ - int bHasMoved = 0; - int rc; - - if( pPager->tempFile ) return SQLITE_OK; - if( pPager->dbSize==0 ) return SQLITE_OK; - assert( pPager->zFilename && pPager->zFilename[0] ); - rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_HAS_MOVED, &bHasMoved); - if( rc==SQLITE_NOTFOUND ){ - /* If the HAS_MOVED file-control is unimplemented, assume that the file - ** has not been moved. That is the historical behavior of SQLite: prior to - ** version 3.8.3, it never checked */ - rc = SQLITE_OK; - }else if( rc==SQLITE_OK && bHasMoved ){ - rc = SQLITE_READONLY_DBMOVED; - } - return rc; -} - - -/* -** This function is called after transitioning from PAGER_UNLOCK to -** PAGER_SHARED state. It tests if there is a hot journal present in -** the file-system for the given pager. A hot journal is one that -** needs to be played back. According to this function, a hot-journal -** file exists if the following criteria are met: -** -** * The journal file exists in the file system, and -** * No process holds a RESERVED or greater lock on the database file, and -** * The database file itself is greater than 0 bytes in size, and -** * The first byte of the journal file exists and is not 0x00. -** -** If the current size of the database file is 0 but a journal file -** exists, that is probably an old journal left over from a prior -** database with the same name. In this case the journal file is -** just deleted using OsDelete, *pExists is set to 0 and SQLITE_OK -** is returned. -** -** This routine does not check if there is a master journal filename -** at the end of the file. If there is, and that master journal file -** does not exist, then the journal file is not really hot. In this -** case this routine will return a false-positive. The pager_playback() -** routine will discover that the journal file is not really hot and -** will not roll it back. -** -** If a hot-journal file is found to exist, *pExists is set to 1 and -** SQLITE_OK returned. If no hot-journal file is present, *pExists is -** set to 0 and SQLITE_OK returned. If an IO error occurs while trying -** to determine whether or not a hot-journal file exists, the IO error -** code is returned and the value of *pExists is undefined. -*/ -static int hasHotJournal(Pager *pPager, int *pExists){ - sqlite3_vfs * const pVfs = pPager->pVfs; - int rc = SQLITE_OK; /* Return code */ - int exists = 1; /* True if a journal file is present */ - int jrnlOpen = !!isOpen(pPager->jfd); - - assert( pPager->useJournal ); - assert( isOpen(pPager->fd) ); - assert( pPager->eState==PAGER_OPEN ); - - assert( jrnlOpen==0 || ( sqlite3OsDeviceCharacteristics(pPager->jfd) & - SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN - )); - - *pExists = 0; - if( !jrnlOpen ){ - rc = sqlite3OsAccess(pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &exists); - } - if( rc==SQLITE_OK && exists ){ - int locked = 0; /* True if some process holds a RESERVED lock */ - - /* Race condition here: Another process might have been holding the - ** the RESERVED lock and have a journal open at the sqlite3OsAccess() - ** call above, but then delete the journal and drop the lock before - ** we get to the following sqlite3OsCheckReservedLock() call. If that - ** is the case, this routine might think there is a hot journal when - ** in fact there is none. This results in a false-positive which will - ** be dealt with by the playback routine. Ticket #3883. - */ - rc = sqlite3OsCheckReservedLock(pPager->fd, &locked); - if( rc==SQLITE_OK && !locked ){ - Pgno nPage; /* Number of pages in database file */ - - /* Check the size of the database file. If it consists of 0 pages, - ** then delete the journal file. See the header comment above for - ** the reasoning here. Delete the obsolete journal file under - ** a RESERVED lock to avoid race conditions and to avoid violating - ** [H33020]. - */ - rc = pagerPagecount(pPager, &nPage); - if( rc==SQLITE_OK ){ - if( nPage==0 ){ - sqlite3BeginBenignMalloc(); - if( pagerLockDb(pPager, RESERVED_LOCK)==SQLITE_OK ){ - sqlite3OsDelete(pVfs, pPager->zJournal, 0); - if( !pPager->exclusiveMode ) pagerUnlockDb(pPager, SHARED_LOCK); - } - sqlite3EndBenignMalloc(); - }else{ - /* The journal file exists and no other connection has a reserved - ** or greater lock on the database file. Now check that there is - ** at least one non-zero bytes at the start of the journal file. - ** If there is, then we consider this journal to be hot. If not, - ** it can be ignored. - */ - if( !jrnlOpen ){ - int f = SQLITE_OPEN_READONLY|SQLITE_OPEN_MAIN_JOURNAL; - rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &f); - } - if( rc==SQLITE_OK ){ - u8 first = 0; - rc = sqlite3OsRead(pPager->jfd, (void *)&first, 1, 0); - if( rc==SQLITE_IOERR_SHORT_READ ){ - rc = SQLITE_OK; - } - if( !jrnlOpen ){ - sqlite3OsClose(pPager->jfd); - } - *pExists = (first!=0); - }else if( rc==SQLITE_CANTOPEN ){ - /* If we cannot open the rollback journal file in order to see if - ** its has a zero header, that might be due to an I/O error, or - ** it might be due to the race condition described above and in - ** ticket #3883. Either way, assume that the journal is hot. - ** This might be a false positive. But if it is, then the - ** automatic journal playback and recovery mechanism will deal - ** with it under an EXCLUSIVE lock where we do not need to - ** worry so much with race conditions. - */ - *pExists = 1; - rc = SQLITE_OK; - } - } - } - } - } - - return rc; -} - -/* -** This function is called to obtain a shared lock on the database file. -** It is illegal to call sqlite3PagerAcquire() until after this function -** has been successfully called. If a shared-lock is already held when -** this function is called, it is a no-op. -** -** The following operations are also performed by this function. -** -** 1) If the pager is currently in PAGER_OPEN state (no lock held -** on the database file), then an attempt is made to obtain a -** SHARED lock on the database file. Immediately after obtaining -** the SHARED lock, the file-system is checked for a hot-journal, -** which is played back if present. Following any hot-journal -** rollback, the contents of the cache are validated by checking -** the 'change-counter' field of the database file header and -** discarded if they are found to be invalid. -** -** 2) If the pager is running in exclusive-mode, and there are currently -** no outstanding references to any pages, and is in the error state, -** then an attempt is made to clear the error state by discarding -** the contents of the page cache and rolling back any open journal -** file. -** -** If everything is successful, SQLITE_OK is returned. If an IO error -** occurs while locking the database, checking for a hot-journal file or -** rolling back a journal file, the IO error code is returned. -*/ -SQLITE_PRIVATE int sqlite3PagerSharedLock(Pager *pPager){ - int rc = SQLITE_OK; /* Return code */ - - /* This routine is only called from b-tree and only when there are no - ** outstanding pages. This implies that the pager state should either - ** be OPEN or READER. READER is only possible if the pager is or was in - ** exclusive access mode. - */ - assert( sqlite3PcacheRefCount(pPager->pPCache)==0 ); - assert( assert_pager_state(pPager) ); - assert( pPager->eState==PAGER_OPEN || pPager->eState==PAGER_READER ); - if( NEVER(MEMDB && pPager->errCode) ){ return pPager->errCode; } - - if( !pagerUseWal(pPager) && pPager->eState==PAGER_OPEN ){ - int bHotJournal = 1; /* True if there exists a hot journal-file */ - - assert( !MEMDB ); - - rc = pager_wait_on_lock(pPager, SHARED_LOCK); - if( rc!=SQLITE_OK ){ - assert( pPager->eLock==NO_LOCK || pPager->eLock==UNKNOWN_LOCK ); - goto failed; - } - - /* If a journal file exists, and there is no RESERVED lock on the - ** database file, then it either needs to be played back or deleted. - */ - if( pPager->eLock<=SHARED_LOCK ){ - rc = hasHotJournal(pPager, &bHotJournal); - } - if( rc!=SQLITE_OK ){ - goto failed; - } - if( bHotJournal ){ - if( pPager->readOnly ){ - rc = SQLITE_READONLY_ROLLBACK; - goto failed; - } - - /* Get an EXCLUSIVE lock on the database file. At this point it is - ** important that a RESERVED lock is not obtained on the way to the - ** EXCLUSIVE lock. If it were, another process might open the - ** database file, detect the RESERVED lock, and conclude that the - ** database is safe to read while this process is still rolling the - ** hot-journal back. - ** - ** Because the intermediate RESERVED lock is not requested, any - ** other process attempting to access the database file will get to - ** this point in the code and fail to obtain its own EXCLUSIVE lock - ** on the database file. - ** - ** Unless the pager is in locking_mode=exclusive mode, the lock is - ** downgraded to SHARED_LOCK before this function returns. - */ - rc = pagerLockDb(pPager, EXCLUSIVE_LOCK); - if( rc!=SQLITE_OK ){ - goto failed; - } - - /* If it is not already open and the file exists on disk, open the - ** journal for read/write access. Write access is required because - ** in exclusive-access mode the file descriptor will be kept open - ** and possibly used for a transaction later on. Also, write-access - ** is usually required to finalize the journal in journal_mode=persist - ** mode (and also for journal_mode=truncate on some systems). - ** - ** If the journal does not exist, it usually means that some - ** other connection managed to get in and roll it back before - ** this connection obtained the exclusive lock above. Or, it - ** may mean that the pager was in the error-state when this - ** function was called and the journal file does not exist. - */ - if( !isOpen(pPager->jfd) ){ - sqlite3_vfs * const pVfs = pPager->pVfs; - int bExists; /* True if journal file exists */ - rc = sqlite3OsAccess( - pVfs, pPager->zJournal, SQLITE_ACCESS_EXISTS, &bExists); - if( rc==SQLITE_OK && bExists ){ - int fout = 0; - int f = SQLITE_OPEN_READWRITE|SQLITE_OPEN_MAIN_JOURNAL; - assert( !pPager->tempFile ); - rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, f, &fout); - assert( rc!=SQLITE_OK || isOpen(pPager->jfd) ); - if( rc==SQLITE_OK && fout&SQLITE_OPEN_READONLY ){ - rc = SQLITE_CANTOPEN_BKPT; - sqlite3OsClose(pPager->jfd); - } - } - } - - /* Playback and delete the journal. Drop the database write - ** lock and reacquire the read lock. Purge the cache before - ** playing back the hot-journal so that we don't end up with - ** an inconsistent cache. Sync the hot journal before playing - ** it back since the process that crashed and left the hot journal - ** probably did not sync it and we are required to always sync - ** the journal before playing it back. - */ - if( isOpen(pPager->jfd) ){ - assert( rc==SQLITE_OK ); - rc = pagerSyncHotJournal(pPager); - if( rc==SQLITE_OK ){ - rc = pager_playback(pPager, 1); - pPager->eState = PAGER_OPEN; - } - }else if( !pPager->exclusiveMode ){ - pagerUnlockDb(pPager, SHARED_LOCK); - } - - if( rc!=SQLITE_OK ){ - /* This branch is taken if an error occurs while trying to open - ** or roll back a hot-journal while holding an EXCLUSIVE lock. The - ** pager_unlock() routine will be called before returning to unlock - ** the file. If the unlock attempt fails, then Pager.eLock must be - ** set to UNKNOWN_LOCK (see the comment above the #define for - ** UNKNOWN_LOCK above for an explanation). - ** - ** In order to get pager_unlock() to do this, set Pager.eState to - ** PAGER_ERROR now. This is not actually counted as a transition - ** to ERROR state in the state diagram at the top of this file, - ** since we know that the same call to pager_unlock() will very - ** shortly transition the pager object to the OPEN state. Calling - ** assert_pager_state() would fail now, as it should not be possible - ** to be in ERROR state when there are zero outstanding page - ** references. - */ - pager_error(pPager, rc); - goto failed; - } - - assert( pPager->eState==PAGER_OPEN ); - assert( (pPager->eLock==SHARED_LOCK) - || (pPager->exclusiveMode && pPager->eLock>SHARED_LOCK) - ); - } - - if( !pPager->tempFile && ( - pPager->pBackup - || sqlite3PcachePagecount(pPager->pPCache)>0 - || USEFETCH(pPager) - )){ - /* The shared-lock has just been acquired on the database file - ** and there are already pages in the cache (from a previous - ** read or write transaction). Check to see if the database - ** has been modified. If the database has changed, flush the - ** cache. - ** - ** Database changes is detected by looking at 15 bytes beginning - ** at offset 24 into the file. The first 4 of these 16 bytes are - ** a 32-bit counter that is incremented with each change. The - ** other bytes change randomly with each file change when - ** a codec is in use. - ** - ** There is a vanishingly small chance that a change will not be - ** detected. The chance of an undetected change is so small that - ** it can be neglected. - */ - Pgno nPage = 0; - char dbFileVers[sizeof(pPager->dbFileVers)]; - - rc = pagerPagecount(pPager, &nPage); - if( rc ) goto failed; - - if( nPage>0 ){ - IOTRACE(("CKVERS %p %d\n", pPager, sizeof(dbFileVers))); - rc = sqlite3OsRead(pPager->fd, &dbFileVers, sizeof(dbFileVers), 24); - if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){ - goto failed; - } - }else{ - memset(dbFileVers, 0, sizeof(dbFileVers)); - } - - if( memcmp(pPager->dbFileVers, dbFileVers, sizeof(dbFileVers))!=0 ){ - pager_reset(pPager); - - /* Unmap the database file. It is possible that external processes - ** may have truncated the database file and then extended it back - ** to its original size while this process was not holding a lock. - ** In this case there may exist a Pager.pMap mapping that appears - ** to be the right size but is not actually valid. Avoid this - ** possibility by unmapping the db here. */ - if( USEFETCH(pPager) ){ - sqlite3OsUnfetch(pPager->fd, 0, 0); - } - } - } - - /* If there is a WAL file in the file-system, open this database in WAL - ** mode. Otherwise, the following function call is a no-op. - */ - rc = pagerOpenWalIfPresent(pPager); -#ifndef SQLITE_OMIT_WAL - assert( pPager->pWal==0 || rc==SQLITE_OK ); -#endif - } - - if( pagerUseWal(pPager) ){ - assert( rc==SQLITE_OK ); - rc = pagerBeginReadTransaction(pPager); - } - - if( pPager->eState==PAGER_OPEN && rc==SQLITE_OK ){ - rc = pagerPagecount(pPager, &pPager->dbSize); - } - - failed: - if( rc!=SQLITE_OK ){ - assert( !MEMDB ); - pager_unlock(pPager); - assert( pPager->eState==PAGER_OPEN ); - }else{ - pPager->eState = PAGER_READER; - } - return rc; -} - -/* -** If the reference count has reached zero, rollback any active -** transaction and unlock the pager. -** -** Except, in locking_mode=EXCLUSIVE when there is nothing to in -** the rollback journal, the unlock is not performed and there is -** nothing to rollback, so this routine is a no-op. -*/ -static void pagerUnlockIfUnused(Pager *pPager){ - if( pPager->nMmapOut==0 && (sqlite3PcacheRefCount(pPager->pPCache)==0) ){ - pagerUnlockAndRollback(pPager); - } -} - -/* -** Acquire a reference to page number pgno in pager pPager (a page -** reference has type DbPage*). If the requested reference is -** successfully obtained, it is copied to *ppPage and SQLITE_OK returned. -** -** If the requested page is already in the cache, it is returned. -** Otherwise, a new page object is allocated and populated with data -** read from the database file. In some cases, the pcache module may -** choose not to allocate a new page object and may reuse an existing -** object with no outstanding references. -** -** The extra data appended to a page is always initialized to zeros the -** first time a page is loaded into memory. If the page requested is -** already in the cache when this function is called, then the extra -** data is left as it was when the page object was last used. -** -** If the database image is smaller than the requested page or if a -** non-zero value is passed as the noContent parameter and the -** requested page is not already stored in the cache, then no -** actual disk read occurs. In this case the memory image of the -** page is initialized to all zeros. -** -** If noContent is true, it means that we do not care about the contents -** of the page. This occurs in two scenarios: -** -** a) When reading a free-list leaf page from the database, and -** -** b) When a savepoint is being rolled back and we need to load -** a new page into the cache to be filled with the data read -** from the savepoint journal. -** -** If noContent is true, then the data returned is zeroed instead of -** being read from the database. Additionally, the bits corresponding -** to pgno in Pager.pInJournal (bitvec of pages already written to the -** journal file) and the PagerSavepoint.pInSavepoint bitvecs of any open -** savepoints are set. This means if the page is made writable at any -** point in the future, using a call to sqlite3PagerWrite(), its contents -** will not be journaled. This saves IO. -** -** The acquisition might fail for several reasons. In all cases, -** an appropriate error code is returned and *ppPage is set to NULL. -** -** See also sqlite3PagerLookup(). Both this routine and Lookup() attempt -** to find a page in the in-memory cache first. If the page is not already -** in memory, this routine goes to disk to read it in whereas Lookup() -** just returns 0. This routine acquires a read-lock the first time it -** has to go to disk, and could also playback an old journal if necessary. -** Since Lookup() never goes to disk, it never has to deal with locks -** or journal files. -*/ -SQLITE_PRIVATE int sqlite3PagerAcquire( - Pager *pPager, /* The pager open on the database file */ - Pgno pgno, /* Page number to fetch */ - DbPage **ppPage, /* Write a pointer to the page here */ - int flags /* PAGER_GET_XXX flags */ -){ - int rc = SQLITE_OK; - PgHdr *pPg = 0; - u32 iFrame = 0; /* Frame to read from WAL file */ - const int noContent = (flags & PAGER_GET_NOCONTENT); - - /* It is acceptable to use a read-only (mmap) page for any page except - ** page 1 if there is no write-transaction open or the ACQUIRE_READONLY - ** flag was specified by the caller. And so long as the db is not a - ** temporary or in-memory database. */ - const int bMmapOk = (pgno!=1 && USEFETCH(pPager) - && (pPager->eState==PAGER_READER || (flags & PAGER_GET_READONLY)) -#ifdef SQLITE_HAS_CODEC - && pPager->xCodec==0 -#endif - ); - - assert( pPager->eState>=PAGER_READER ); - assert( assert_pager_state(pPager) ); - assert( noContent==0 || bMmapOk==0 ); - - if( pgno==0 ){ - return SQLITE_CORRUPT_BKPT; - } - - /* If the pager is in the error state, return an error immediately. - ** Otherwise, request the page from the PCache layer. */ - if( pPager->errCode!=SQLITE_OK ){ - rc = pPager->errCode; - }else{ - - if( bMmapOk && pagerUseWal(pPager) ){ - rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame); - if( rc!=SQLITE_OK ) goto pager_acquire_err; - } - - if( bMmapOk && iFrame==0 ){ - void *pData = 0; - - rc = sqlite3OsFetch(pPager->fd, - (i64)(pgno-1) * pPager->pageSize, pPager->pageSize, &pData - ); - - if( rc==SQLITE_OK && pData ){ - if( pPager->eState>PAGER_READER ){ - (void)sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg); - } - if( pPg==0 ){ - rc = pagerAcquireMapPage(pPager, pgno, pData, &pPg); - }else{ - sqlite3OsUnfetch(pPager->fd, (i64)(pgno-1)*pPager->pageSize, pData); - } - if( pPg ){ - assert( rc==SQLITE_OK ); - *ppPage = pPg; - return SQLITE_OK; - } - } - if( rc!=SQLITE_OK ){ - goto pager_acquire_err; - } - } - - rc = sqlite3PcacheFetch(pPager->pPCache, pgno, 1, ppPage); - } - - if( rc!=SQLITE_OK ){ - /* Either the call to sqlite3PcacheFetch() returned an error or the - ** pager was already in the error-state when this function was called. - ** Set pPg to 0 and jump to the exception handler. */ - pPg = 0; - goto pager_acquire_err; - } - assert( (*ppPage)->pgno==pgno ); - assert( (*ppPage)->pPager==pPager || (*ppPage)->pPager==0 ); - - if( (*ppPage)->pPager && !noContent ){ - /* In this case the pcache already contains an initialized copy of - ** the page. Return without further ado. */ - assert( pgno<=PAGER_MAX_PGNO && pgno!=PAGER_MJ_PGNO(pPager) ); - pPager->aStat[PAGER_STAT_HIT]++; - return SQLITE_OK; - - }else{ - /* The pager cache has created a new page. Its content needs to - ** be initialized. */ - - pPg = *ppPage; - pPg->pPager = pPager; - - /* The maximum page number is 2^31. Return SQLITE_CORRUPT if a page - ** number greater than this, or the unused locking-page, is requested. */ - if( pgno>PAGER_MAX_PGNO || pgno==PAGER_MJ_PGNO(pPager) ){ - rc = SQLITE_CORRUPT_BKPT; - goto pager_acquire_err; - } - - if( MEMDB || pPager->dbSizefd) ){ - if( pgno>pPager->mxPgno ){ - rc = SQLITE_FULL; - goto pager_acquire_err; - } - if( noContent ){ - /* Failure to set the bits in the InJournal bit-vectors is benign. - ** It merely means that we might do some extra work to journal a - ** page that does not need to be journaled. Nevertheless, be sure - ** to test the case where a malloc error occurs while trying to set - ** a bit in a bit vector. - */ - sqlite3BeginBenignMalloc(); - if( pgno<=pPager->dbOrigSize ){ - TESTONLY( rc = ) sqlite3BitvecSet(pPager->pInJournal, pgno); - testcase( rc==SQLITE_NOMEM ); - } - TESTONLY( rc = ) addToSavepointBitvecs(pPager, pgno); - testcase( rc==SQLITE_NOMEM ); - sqlite3EndBenignMalloc(); - } - memset(pPg->pData, 0, pPager->pageSize); - IOTRACE(("ZERO %p %d\n", pPager, pgno)); - }else{ - if( pagerUseWal(pPager) && bMmapOk==0 ){ - rc = sqlite3WalFindFrame(pPager->pWal, pgno, &iFrame); - if( rc!=SQLITE_OK ) goto pager_acquire_err; - } - assert( pPg->pPager==pPager ); - pPager->aStat[PAGER_STAT_MISS]++; - rc = readDbPage(pPg, iFrame); - if( rc!=SQLITE_OK ){ - goto pager_acquire_err; - } - } - pager_set_pagehash(pPg); - } - - return SQLITE_OK; - -pager_acquire_err: - assert( rc!=SQLITE_OK ); - if( pPg ){ - sqlite3PcacheDrop(pPg); - } - pagerUnlockIfUnused(pPager); - - *ppPage = 0; - return rc; -} - -/* -** Acquire a page if it is already in the in-memory cache. Do -** not read the page from disk. Return a pointer to the page, -** or 0 if the page is not in cache. -** -** See also sqlite3PagerGet(). The difference between this routine -** and sqlite3PagerGet() is that _get() will go to the disk and read -** in the page if the page is not already in cache. This routine -** returns NULL if the page is not in cache or if a disk I/O error -** has ever happened. -*/ -SQLITE_PRIVATE DbPage *sqlite3PagerLookup(Pager *pPager, Pgno pgno){ - PgHdr *pPg = 0; - assert( pPager!=0 ); - assert( pgno!=0 ); - assert( pPager->pPCache!=0 ); - assert( pPager->eState>=PAGER_READER && pPager->eState!=PAGER_ERROR ); - sqlite3PcacheFetch(pPager->pPCache, pgno, 0, &pPg); - return pPg; -} - -/* -** Release a page reference. -** -** If the number of references to the page drop to zero, then the -** page is added to the LRU list. When all references to all pages -** are released, a rollback occurs and the lock on the database is -** removed. -*/ -SQLITE_PRIVATE void sqlite3PagerUnrefNotNull(DbPage *pPg){ - Pager *pPager; - assert( pPg!=0 ); - pPager = pPg->pPager; - if( pPg->flags & PGHDR_MMAP ){ - pagerReleaseMapPage(pPg); - }else{ - sqlite3PcacheRelease(pPg); - } - pagerUnlockIfUnused(pPager); -} -SQLITE_PRIVATE void sqlite3PagerUnref(DbPage *pPg){ - if( pPg ) sqlite3PagerUnrefNotNull(pPg); -} - -/* -** This function is called at the start of every write transaction. -** There must already be a RESERVED or EXCLUSIVE lock on the database -** file when this routine is called. -** -** Open the journal file for pager pPager and write a journal header -** to the start of it. If there are active savepoints, open the sub-journal -** as well. This function is only used when the journal file is being -** opened to write a rollback log for a transaction. It is not used -** when opening a hot journal file to roll it back. -** -** If the journal file is already open (as it may be in exclusive mode), -** then this function just writes a journal header to the start of the -** already open file. -** -** Whether or not the journal file is opened by this function, the -** Pager.pInJournal bitvec structure is allocated. -** -** Return SQLITE_OK if everything is successful. Otherwise, return -** SQLITE_NOMEM if the attempt to allocate Pager.pInJournal fails, or -** an IO error code if opening or writing the journal file fails. -*/ -static int pager_open_journal(Pager *pPager){ - int rc = SQLITE_OK; /* Return code */ - sqlite3_vfs * const pVfs = pPager->pVfs; /* Local cache of vfs pointer */ - - assert( pPager->eState==PAGER_WRITER_LOCKED ); - assert( assert_pager_state(pPager) ); - assert( pPager->pInJournal==0 ); - - /* If already in the error state, this function is a no-op. But on - ** the other hand, this routine is never called if we are already in - ** an error state. */ - if( NEVER(pPager->errCode) ) return pPager->errCode; - - if( !pagerUseWal(pPager) && pPager->journalMode!=PAGER_JOURNALMODE_OFF ){ - pPager->pInJournal = sqlite3BitvecCreate(pPager->dbSize); - if( pPager->pInJournal==0 ){ - return SQLITE_NOMEM; - } - - /* Open the journal file if it is not already open. */ - if( !isOpen(pPager->jfd) ){ - if( pPager->journalMode==PAGER_JOURNALMODE_MEMORY ){ - sqlite3MemJournalOpen(pPager->jfd); - }else{ - const int flags = /* VFS flags to open journal file */ - SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE| - (pPager->tempFile ? - (SQLITE_OPEN_DELETEONCLOSE|SQLITE_OPEN_TEMP_JOURNAL): - (SQLITE_OPEN_MAIN_JOURNAL) - ); - - /* Verify that the database still has the same name as it did when - ** it was originally opened. */ - rc = databaseIsUnmoved(pPager); - if( rc==SQLITE_OK ){ -#ifdef SQLITE_ENABLE_ATOMIC_WRITE - rc = sqlite3JournalOpen( - pVfs, pPager->zJournal, pPager->jfd, flags, jrnlBufferSize(pPager) - ); -#else - rc = sqlite3OsOpen(pVfs, pPager->zJournal, pPager->jfd, flags, 0); -#endif - } - } - assert( rc!=SQLITE_OK || isOpen(pPager->jfd) ); - } - - - /* Write the first journal header to the journal file and open - ** the sub-journal if necessary. - */ - if( rc==SQLITE_OK ){ - /* TODO: Check if all of these are really required. */ - pPager->nRec = 0; - pPager->journalOff = 0; - pPager->setMaster = 0; - pPager->journalHdr = 0; - rc = writeJournalHdr(pPager); - } - } - - if( rc!=SQLITE_OK ){ - sqlite3BitvecDestroy(pPager->pInJournal); - pPager->pInJournal = 0; - }else{ - assert( pPager->eState==PAGER_WRITER_LOCKED ); - pPager->eState = PAGER_WRITER_CACHEMOD; - } - - return rc; -} - -/* -** Begin a write-transaction on the specified pager object. If a -** write-transaction has already been opened, this function is a no-op. -** -** If the exFlag argument is false, then acquire at least a RESERVED -** lock on the database file. If exFlag is true, then acquire at least -** an EXCLUSIVE lock. If such a lock is already held, no locking -** functions need be called. -** -** If the subjInMemory argument is non-zero, then any sub-journal opened -** within this transaction will be opened as an in-memory file. This -** has no effect if the sub-journal is already opened (as it may be when -** running in exclusive mode) or if the transaction does not require a -** sub-journal. If the subjInMemory argument is zero, then any required -** sub-journal is implemented in-memory if pPager is an in-memory database, -** or using a temporary file otherwise. -*/ -SQLITE_PRIVATE int sqlite3PagerBegin(Pager *pPager, int exFlag, int subjInMemory){ - int rc = SQLITE_OK; - - if( pPager->errCode ) return pPager->errCode; - assert( pPager->eState>=PAGER_READER && pPager->eStatesubjInMemory = (u8)subjInMemory; - - if( ALWAYS(pPager->eState==PAGER_READER) ){ - assert( pPager->pInJournal==0 ); - - if( pagerUseWal(pPager) ){ - /* If the pager is configured to use locking_mode=exclusive, and an - ** exclusive lock on the database is not already held, obtain it now. - */ - if( pPager->exclusiveMode && sqlite3WalExclusiveMode(pPager->pWal, -1) ){ - rc = pagerLockDb(pPager, EXCLUSIVE_LOCK); - if( rc!=SQLITE_OK ){ - return rc; - } - sqlite3WalExclusiveMode(pPager->pWal, 1); - } - - /* Grab the write lock on the log file. If successful, upgrade to - ** PAGER_RESERVED state. Otherwise, return an error code to the caller. - ** The busy-handler is not invoked if another connection already - ** holds the write-lock. If possible, the upper layer will call it. - */ - rc = sqlite3WalBeginWriteTransaction(pPager->pWal); - }else{ - /* Obtain a RESERVED lock on the database file. If the exFlag parameter - ** is true, then immediately upgrade this to an EXCLUSIVE lock. The - ** busy-handler callback can be used when upgrading to the EXCLUSIVE - ** lock, but not when obtaining the RESERVED lock. - */ - rc = pagerLockDb(pPager, RESERVED_LOCK); - if( rc==SQLITE_OK && exFlag ){ - rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK); - } - } - - if( rc==SQLITE_OK ){ - /* Change to WRITER_LOCKED state. - ** - ** WAL mode sets Pager.eState to PAGER_WRITER_LOCKED or CACHEMOD - ** when it has an open transaction, but never to DBMOD or FINISHED. - ** This is because in those states the code to roll back savepoint - ** transactions may copy data from the sub-journal into the database - ** file as well as into the page cache. Which would be incorrect in - ** WAL mode. - */ - pPager->eState = PAGER_WRITER_LOCKED; - pPager->dbHintSize = pPager->dbSize; - pPager->dbFileSize = pPager->dbSize; - pPager->dbOrigSize = pPager->dbSize; - pPager->journalOff = 0; - } - - assert( rc==SQLITE_OK || pPager->eState==PAGER_READER ); - assert( rc!=SQLITE_OK || pPager->eState==PAGER_WRITER_LOCKED ); - assert( assert_pager_state(pPager) ); - } - - PAGERTRACE(("TRANSACTION %d\n", PAGERID(pPager))); - return rc; -} - -/* -** Mark a single data page as writeable. The page is written into the -** main journal or sub-journal as required. If the page is written into -** one of the journals, the corresponding bit is set in the -** Pager.pInJournal bitvec and the PagerSavepoint.pInSavepoint bitvecs -** of any open savepoints as appropriate. -*/ -static int pager_write(PgHdr *pPg){ - Pager *pPager = pPg->pPager; - int rc = SQLITE_OK; - int inJournal; - - /* This routine is not called unless a write-transaction has already - ** been started. The journal file may or may not be open at this point. - ** It is never called in the ERROR state. - */ - assert( pPager->eState==PAGER_WRITER_LOCKED - || pPager->eState==PAGER_WRITER_CACHEMOD - || pPager->eState==PAGER_WRITER_DBMOD - ); - assert( assert_pager_state(pPager) ); - assert( pPager->errCode==0 ); - assert( pPager->readOnly==0 ); - - CHECK_PAGE(pPg); - - /* The journal file needs to be opened. Higher level routines have already - ** obtained the necessary locks to begin the write-transaction, but the - ** rollback journal might not yet be open. Open it now if this is the case. - ** - ** This is done before calling sqlite3PcacheMakeDirty() on the page. - ** Otherwise, if it were done after calling sqlite3PcacheMakeDirty(), then - ** an error might occur and the pager would end up in WRITER_LOCKED state - ** with pages marked as dirty in the cache. - */ - if( pPager->eState==PAGER_WRITER_LOCKED ){ - rc = pager_open_journal(pPager); - if( rc!=SQLITE_OK ) return rc; - } - assert( pPager->eState>=PAGER_WRITER_CACHEMOD ); - assert( assert_pager_state(pPager) ); - - /* Mark the page as dirty. If the page has already been written - ** to the journal then we can return right away. - */ - sqlite3PcacheMakeDirty(pPg); - inJournal = pageInJournal(pPager, pPg); - if( inJournal && (pPager->nSavepoint==0 || !subjRequiresPage(pPg)) ){ - assert( !pagerUseWal(pPager) ); - }else{ - - /* The transaction journal now exists and we have a RESERVED or an - ** EXCLUSIVE lock on the main database file. Write the current page to - ** the transaction journal if it is not there already. - */ - if( !inJournal && !pagerUseWal(pPager) ){ - assert( pagerUseWal(pPager)==0 ); - if( pPg->pgno<=pPager->dbOrigSize && isOpen(pPager->jfd) ){ - u32 cksum; - char *pData2; - i64 iOff = pPager->journalOff; - - /* We should never write to the journal file the page that - ** contains the database locks. The following assert verifies - ** that we do not. */ - assert( pPg->pgno!=PAGER_MJ_PGNO(pPager) ); - - assert( pPager->journalHdr<=pPager->journalOff ); - CODEC2(pPager, pPg->pData, pPg->pgno, 7, return SQLITE_NOMEM, pData2); - cksum = pager_cksum(pPager, (u8*)pData2); - - /* Even if an IO or diskfull error occurs while journalling the - ** page in the block above, set the need-sync flag for the page. - ** Otherwise, when the transaction is rolled back, the logic in - ** playback_one_page() will think that the page needs to be restored - ** in the database file. And if an IO error occurs while doing so, - ** then corruption may follow. - */ - pPg->flags |= PGHDR_NEED_SYNC; - - rc = write32bits(pPager->jfd, iOff, pPg->pgno); - if( rc!=SQLITE_OK ) return rc; - rc = sqlite3OsWrite(pPager->jfd, pData2, pPager->pageSize, iOff+4); - if( rc!=SQLITE_OK ) return rc; - rc = write32bits(pPager->jfd, iOff+pPager->pageSize+4, cksum); - if( rc!=SQLITE_OK ) return rc; - - IOTRACE(("JOUT %p %d %lld %d\n", pPager, pPg->pgno, - pPager->journalOff, pPager->pageSize)); - PAGER_INCR(sqlite3_pager_writej_count); - PAGERTRACE(("JOURNAL %d page %d needSync=%d hash(%08x)\n", - PAGERID(pPager), pPg->pgno, - ((pPg->flags&PGHDR_NEED_SYNC)?1:0), pager_pagehash(pPg))); - - pPager->journalOff += 8 + pPager->pageSize; - pPager->nRec++; - assert( pPager->pInJournal!=0 ); - rc = sqlite3BitvecSet(pPager->pInJournal, pPg->pgno); - testcase( rc==SQLITE_NOMEM ); - assert( rc==SQLITE_OK || rc==SQLITE_NOMEM ); - rc |= addToSavepointBitvecs(pPager, pPg->pgno); - if( rc!=SQLITE_OK ){ - assert( rc==SQLITE_NOMEM ); - return rc; - } - }else{ - if( pPager->eState!=PAGER_WRITER_DBMOD ){ - pPg->flags |= PGHDR_NEED_SYNC; - } - PAGERTRACE(("APPEND %d page %d needSync=%d\n", - PAGERID(pPager), pPg->pgno, - ((pPg->flags&PGHDR_NEED_SYNC)?1:0))); - } - } - - /* If the statement journal is open and the page is not in it, - ** then write the current page to the statement journal. Note that - ** the statement journal format differs from the standard journal format - ** in that it omits the checksums and the header. - */ - if( pPager->nSavepoint>0 && subjRequiresPage(pPg) ){ - rc = subjournalPage(pPg); - } - } - - /* Update the database size and return. - */ - if( pPager->dbSizepgno ){ - pPager->dbSize = pPg->pgno; - } - return rc; -} - -/* -** Mark a data page as writeable. This routine must be called before -** making changes to a page. The caller must check the return value -** of this function and be careful not to change any page data unless -** this routine returns SQLITE_OK. -** -** The difference between this function and pager_write() is that this -** function also deals with the special case where 2 or more pages -** fit on a single disk sector. In this case all co-resident pages -** must have been written to the journal file before returning. -** -** If an error occurs, SQLITE_NOMEM or an IO error code is returned -** as appropriate. Otherwise, SQLITE_OK. -*/ -SQLITE_PRIVATE int sqlite3PagerWrite(DbPage *pDbPage){ - int rc = SQLITE_OK; - - PgHdr *pPg = pDbPage; - Pager *pPager = pPg->pPager; - - assert( (pPg->flags & PGHDR_MMAP)==0 ); - assert( pPager->eState>=PAGER_WRITER_LOCKED ); - assert( pPager->eState!=PAGER_ERROR ); - assert( assert_pager_state(pPager) ); - - if( pPager->sectorSize > (u32)pPager->pageSize ){ - Pgno nPageCount; /* Total number of pages in database file */ - Pgno pg1; /* First page of the sector pPg is located on. */ - int nPage = 0; /* Number of pages starting at pg1 to journal */ - int ii; /* Loop counter */ - int needSync = 0; /* True if any page has PGHDR_NEED_SYNC */ - Pgno nPagePerSector = (pPager->sectorSize/pPager->pageSize); - - /* Set the doNotSpill NOSYNC bit to 1. This is because we cannot allow - ** a journal header to be written between the pages journaled by - ** this function. - */ - assert( !MEMDB ); - assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)==0 ); - pPager->doNotSpill |= SPILLFLAG_NOSYNC; - - /* This trick assumes that both the page-size and sector-size are - ** an integer power of 2. It sets variable pg1 to the identifier - ** of the first page of the sector pPg is located on. - */ - pg1 = ((pPg->pgno-1) & ~(nPagePerSector-1)) + 1; - - nPageCount = pPager->dbSize; - if( pPg->pgno>nPageCount ){ - nPage = (pPg->pgno - pg1)+1; - }else if( (pg1+nPagePerSector-1)>nPageCount ){ - nPage = nPageCount+1-pg1; - }else{ - nPage = nPagePerSector; - } - assert(nPage>0); - assert(pg1<=pPg->pgno); - assert((pg1+nPage)>pPg->pgno); - - for(ii=0; iipgno || !sqlite3BitvecTest(pPager->pInJournal, pg) ){ - if( pg!=PAGER_MJ_PGNO(pPager) ){ - rc = sqlite3PagerGet(pPager, pg, &pPage); - if( rc==SQLITE_OK ){ - rc = pager_write(pPage); - if( pPage->flags&PGHDR_NEED_SYNC ){ - needSync = 1; - } - sqlite3PagerUnrefNotNull(pPage); - } - } - }else if( (pPage = pager_lookup(pPager, pg))!=0 ){ - if( pPage->flags&PGHDR_NEED_SYNC ){ - needSync = 1; - } - sqlite3PagerUnrefNotNull(pPage); - } - } - - /* If the PGHDR_NEED_SYNC flag is set for any of the nPage pages - ** starting at pg1, then it needs to be set for all of them. Because - ** writing to any of these nPage pages may damage the others, the - ** journal file must contain sync()ed copies of all of them - ** before any of them can be written out to the database file. - */ - if( rc==SQLITE_OK && needSync ){ - assert( !MEMDB ); - for(ii=0; iiflags |= PGHDR_NEED_SYNC; - sqlite3PagerUnrefNotNull(pPage); - } - } - } - - assert( (pPager->doNotSpill & SPILLFLAG_NOSYNC)!=0 ); - pPager->doNotSpill &= ~SPILLFLAG_NOSYNC; - }else{ - rc = pager_write(pDbPage); - } - return rc; -} - -/* -** Return TRUE if the page given in the argument was previously passed -** to sqlite3PagerWrite(). In other words, return TRUE if it is ok -** to change the content of the page. -*/ -#ifndef NDEBUG -SQLITE_PRIVATE int sqlite3PagerIswriteable(DbPage *pPg){ - return pPg->flags&PGHDR_DIRTY; -} -#endif - -/* -** A call to this routine tells the pager that it is not necessary to -** write the information on page pPg back to the disk, even though -** that page might be marked as dirty. This happens, for example, when -** the page has been added as a leaf of the freelist and so its -** content no longer matters. -** -** The overlying software layer calls this routine when all of the data -** on the given page is unused. The pager marks the page as clean so -** that it does not get written to disk. -** -** Tests show that this optimization can quadruple the speed of large -** DELETE operations. -*/ -SQLITE_PRIVATE void sqlite3PagerDontWrite(PgHdr *pPg){ - Pager *pPager = pPg->pPager; - if( (pPg->flags&PGHDR_DIRTY) && pPager->nSavepoint==0 ){ - PAGERTRACE(("DONT_WRITE page %d of %d\n", pPg->pgno, PAGERID(pPager))); - IOTRACE(("CLEAN %p %d\n", pPager, pPg->pgno)) - pPg->flags |= PGHDR_DONT_WRITE; - pager_set_pagehash(pPg); - } -} - -/* -** This routine is called to increment the value of the database file -** change-counter, stored as a 4-byte big-endian integer starting at -** byte offset 24 of the pager file. The secondary change counter at -** 92 is also updated, as is the SQLite version number at offset 96. -** -** But this only happens if the pPager->changeCountDone flag is false. -** To avoid excess churning of page 1, the update only happens once. -** See also the pager_write_changecounter() routine that does an -** unconditional update of the change counters. -** -** If the isDirectMode flag is zero, then this is done by calling -** sqlite3PagerWrite() on page 1, then modifying the contents of the -** page data. In this case the file will be updated when the current -** transaction is committed. -** -** The isDirectMode flag may only be non-zero if the library was compiled -** with the SQLITE_ENABLE_ATOMIC_WRITE macro defined. In this case, -** if isDirect is non-zero, then the database file is updated directly -** by writing an updated version of page 1 using a call to the -** sqlite3OsWrite() function. -*/ -static int pager_incr_changecounter(Pager *pPager, int isDirectMode){ - int rc = SQLITE_OK; - - assert( pPager->eState==PAGER_WRITER_CACHEMOD - || pPager->eState==PAGER_WRITER_DBMOD - ); - assert( assert_pager_state(pPager) ); - - /* Declare and initialize constant integer 'isDirect'. If the - ** atomic-write optimization is enabled in this build, then isDirect - ** is initialized to the value passed as the isDirectMode parameter - ** to this function. Otherwise, it is always set to zero. - ** - ** The idea is that if the atomic-write optimization is not - ** enabled at compile time, the compiler can omit the tests of - ** 'isDirect' below, as well as the block enclosed in the - ** "if( isDirect )" condition. - */ -#ifndef SQLITE_ENABLE_ATOMIC_WRITE -# define DIRECT_MODE 0 - assert( isDirectMode==0 ); - UNUSED_PARAMETER(isDirectMode); -#else -# define DIRECT_MODE isDirectMode -#endif - - if( !pPager->changeCountDone && ALWAYS(pPager->dbSize>0) ){ - PgHdr *pPgHdr; /* Reference to page 1 */ - - assert( !pPager->tempFile && isOpen(pPager->fd) ); - - /* Open page 1 of the file for writing. */ - rc = sqlite3PagerGet(pPager, 1, &pPgHdr); - assert( pPgHdr==0 || rc==SQLITE_OK ); - - /* If page one was fetched successfully, and this function is not - ** operating in direct-mode, make page 1 writable. When not in - ** direct mode, page 1 is always held in cache and hence the PagerGet() - ** above is always successful - hence the ALWAYS on rc==SQLITE_OK. - */ - if( !DIRECT_MODE && ALWAYS(rc==SQLITE_OK) ){ - rc = sqlite3PagerWrite(pPgHdr); - } - - if( rc==SQLITE_OK ){ - /* Actually do the update of the change counter */ - pager_write_changecounter(pPgHdr); - - /* If running in direct mode, write the contents of page 1 to the file. */ - if( DIRECT_MODE ){ - const void *zBuf; - assert( pPager->dbFileSize>0 ); - CODEC2(pPager, pPgHdr->pData, 1, 6, rc=SQLITE_NOMEM, zBuf); - if( rc==SQLITE_OK ){ - rc = sqlite3OsWrite(pPager->fd, zBuf, pPager->pageSize, 0); - pPager->aStat[PAGER_STAT_WRITE]++; - } - if( rc==SQLITE_OK ){ - /* Update the pager's copy of the change-counter. Otherwise, the - ** next time a read transaction is opened the cache will be - ** flushed (as the change-counter values will not match). */ - const void *pCopy = (const void *)&((const char *)zBuf)[24]; - memcpy(&pPager->dbFileVers, pCopy, sizeof(pPager->dbFileVers)); - pPager->changeCountDone = 1; - } - }else{ - pPager->changeCountDone = 1; - } - } - - /* Release the page reference. */ - sqlite3PagerUnref(pPgHdr); - } - return rc; -} - -/* -** Sync the database file to disk. This is a no-op for in-memory databases -** or pages with the Pager.noSync flag set. -** -** If successful, or if called on a pager for which it is a no-op, this -** function returns SQLITE_OK. Otherwise, an IO error code is returned. -*/ -SQLITE_PRIVATE int sqlite3PagerSync(Pager *pPager, const char *zMaster){ - int rc = SQLITE_OK; - - if( isOpen(pPager->fd) ){ - void *pArg = (void*)zMaster; - rc = sqlite3OsFileControl(pPager->fd, SQLITE_FCNTL_SYNC, pArg); - if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; - } - if( rc==SQLITE_OK && !pPager->noSync ){ - assert( !MEMDB ); - rc = sqlite3OsSync(pPager->fd, pPager->syncFlags); - } - return rc; -} - -/* -** This function may only be called while a write-transaction is active in -** rollback. If the connection is in WAL mode, this call is a no-op. -** Otherwise, if the connection does not already have an EXCLUSIVE lock on -** the database file, an attempt is made to obtain one. -** -** If the EXCLUSIVE lock is already held or the attempt to obtain it is -** successful, or the connection is in WAL mode, SQLITE_OK is returned. -** Otherwise, either SQLITE_BUSY or an SQLITE_IOERR_XXX error code is -** returned. -*/ -SQLITE_PRIVATE int sqlite3PagerExclusiveLock(Pager *pPager){ - int rc = SQLITE_OK; - assert( pPager->eState==PAGER_WRITER_CACHEMOD - || pPager->eState==PAGER_WRITER_DBMOD - || pPager->eState==PAGER_WRITER_LOCKED - ); - assert( assert_pager_state(pPager) ); - if( 0==pagerUseWal(pPager) ){ - rc = pager_wait_on_lock(pPager, EXCLUSIVE_LOCK); - } - return rc; -} - -/* -** Sync the database file for the pager pPager. zMaster points to the name -** of a master journal file that should be written into the individual -** journal file. zMaster may be NULL, which is interpreted as no master -** journal (a single database transaction). -** -** This routine ensures that: -** -** * The database file change-counter is updated, -** * the journal is synced (unless the atomic-write optimization is used), -** * all dirty pages are written to the database file, -** * the database file is truncated (if required), and -** * the database file synced. -** -** The only thing that remains to commit the transaction is to finalize -** (delete, truncate or zero the first part of) the journal file (or -** delete the master journal file if specified). -** -** Note that if zMaster==NULL, this does not overwrite a previous value -** passed to an sqlite3PagerCommitPhaseOne() call. -** -** If the final parameter - noSync - is true, then the database file itself -** is not synced. The caller must call sqlite3PagerSync() directly to -** sync the database file before calling CommitPhaseTwo() to delete the -** journal file in this case. -*/ -SQLITE_PRIVATE int sqlite3PagerCommitPhaseOne( - Pager *pPager, /* Pager object */ - const char *zMaster, /* If not NULL, the master journal name */ - int noSync /* True to omit the xSync on the db file */ -){ - int rc = SQLITE_OK; /* Return code */ - - assert( pPager->eState==PAGER_WRITER_LOCKED - || pPager->eState==PAGER_WRITER_CACHEMOD - || pPager->eState==PAGER_WRITER_DBMOD - || pPager->eState==PAGER_ERROR - ); - assert( assert_pager_state(pPager) ); - - /* If a prior error occurred, report that error again. */ - if( NEVER(pPager->errCode) ) return pPager->errCode; - - PAGERTRACE(("DATABASE SYNC: File=%s zMaster=%s nSize=%d\n", - pPager->zFilename, zMaster, pPager->dbSize)); - - /* If no database changes have been made, return early. */ - if( pPager->eStatepBackup); - }else{ - if( pagerUseWal(pPager) ){ - PgHdr *pList = sqlite3PcacheDirtyList(pPager->pPCache); - PgHdr *pPageOne = 0; - if( pList==0 ){ - /* Must have at least one page for the WAL commit flag. - ** Ticket [2d1a5c67dfc2363e44f29d9bbd57f] 2011-05-18 */ - rc = sqlite3PagerGet(pPager, 1, &pPageOne); - pList = pPageOne; - pList->pDirty = 0; - } - assert( rc==SQLITE_OK ); - if( ALWAYS(pList) ){ - rc = pagerWalFrames(pPager, pList, pPager->dbSize, 1); - } - sqlite3PagerUnref(pPageOne); - if( rc==SQLITE_OK ){ - sqlite3PcacheCleanAll(pPager->pPCache); - } - }else{ - /* The following block updates the change-counter. Exactly how it - ** does this depends on whether or not the atomic-update optimization - ** was enabled at compile time, and if this transaction meets the - ** runtime criteria to use the operation: - ** - ** * The file-system supports the atomic-write property for - ** blocks of size page-size, and - ** * This commit is not part of a multi-file transaction, and - ** * Exactly one page has been modified and store in the journal file. - ** - ** If the optimization was not enabled at compile time, then the - ** pager_incr_changecounter() function is called to update the change - ** counter in 'indirect-mode'. If the optimization is compiled in but - ** is not applicable to this transaction, call sqlite3JournalCreate() - ** to make sure the journal file has actually been created, then call - ** pager_incr_changecounter() to update the change-counter in indirect - ** mode. - ** - ** Otherwise, if the optimization is both enabled and applicable, - ** then call pager_incr_changecounter() to update the change-counter - ** in 'direct' mode. In this case the journal file will never be - ** created for this transaction. - */ - #ifdef SQLITE_ENABLE_ATOMIC_WRITE - PgHdr *pPg; - assert( isOpen(pPager->jfd) - || pPager->journalMode==PAGER_JOURNALMODE_OFF - || pPager->journalMode==PAGER_JOURNALMODE_WAL - ); - if( !zMaster && isOpen(pPager->jfd) - && pPager->journalOff==jrnlBufferSize(pPager) - && pPager->dbSize>=pPager->dbOrigSize - && (0==(pPg = sqlite3PcacheDirtyList(pPager->pPCache)) || 0==pPg->pDirty) - ){ - /* Update the db file change counter via the direct-write method. The - ** following call will modify the in-memory representation of page 1 - ** to include the updated change counter and then write page 1 - ** directly to the database file. Because of the atomic-write - ** property of the host file-system, this is safe. - */ - rc = pager_incr_changecounter(pPager, 1); - }else{ - rc = sqlite3JournalCreate(pPager->jfd); - if( rc==SQLITE_OK ){ - rc = pager_incr_changecounter(pPager, 0); - } - } - #else - rc = pager_incr_changecounter(pPager, 0); - #endif - if( rc!=SQLITE_OK ) goto commit_phase_one_exit; - - /* Write the master journal name into the journal file. If a master - ** journal file name has already been written to the journal file, - ** or if zMaster is NULL (no master journal), then this call is a no-op. - */ - rc = writeMasterJournal(pPager, zMaster); - if( rc!=SQLITE_OK ) goto commit_phase_one_exit; - - /* Sync the journal file and write all dirty pages to the database. - ** If the atomic-update optimization is being used, this sync will not - ** create the journal file or perform any real IO. - ** - ** Because the change-counter page was just modified, unless the - ** atomic-update optimization is used it is almost certain that the - ** journal requires a sync here. However, in locking_mode=exclusive - ** on a system under memory pressure it is just possible that this is - ** not the case. In this case it is likely enough that the redundant - ** xSync() call will be changed to a no-op by the OS anyhow. - */ - rc = syncJournal(pPager, 0); - if( rc!=SQLITE_OK ) goto commit_phase_one_exit; - - rc = pager_write_pagelist(pPager,sqlite3PcacheDirtyList(pPager->pPCache)); - if( rc!=SQLITE_OK ){ - assert( rc!=SQLITE_IOERR_BLOCKED ); - goto commit_phase_one_exit; - } - sqlite3PcacheCleanAll(pPager->pPCache); - - /* If the file on disk is smaller than the database image, use - ** pager_truncate to grow the file here. This can happen if the database - ** image was extended as part of the current transaction and then the - ** last page in the db image moved to the free-list. In this case the - ** last page is never written out to disk, leaving the database file - ** undersized. Fix this now if it is the case. */ - if( pPager->dbSize>pPager->dbFileSize ){ - Pgno nNew = pPager->dbSize - (pPager->dbSize==PAGER_MJ_PGNO(pPager)); - assert( pPager->eState==PAGER_WRITER_DBMOD ); - rc = pager_truncate(pPager, nNew); - if( rc!=SQLITE_OK ) goto commit_phase_one_exit; - } - - /* Finally, sync the database file. */ - if( !noSync ){ - rc = sqlite3PagerSync(pPager, zMaster); - } - IOTRACE(("DBSYNC %p\n", pPager)) - } - } - -commit_phase_one_exit: - if( rc==SQLITE_OK && !pagerUseWal(pPager) ){ - pPager->eState = PAGER_WRITER_FINISHED; - } - return rc; -} - - -/* -** When this function is called, the database file has been completely -** updated to reflect the changes made by the current transaction and -** synced to disk. The journal file still exists in the file-system -** though, and if a failure occurs at this point it will eventually -** be used as a hot-journal and the current transaction rolled back. -** -** This function finalizes the journal file, either by deleting, -** truncating or partially zeroing it, so that it cannot be used -** for hot-journal rollback. Once this is done the transaction is -** irrevocably committed. -** -** If an error occurs, an IO error code is returned and the pager -** moves into the error state. Otherwise, SQLITE_OK is returned. -*/ -SQLITE_PRIVATE int sqlite3PagerCommitPhaseTwo(Pager *pPager){ - int rc = SQLITE_OK; /* Return code */ - - /* This routine should not be called if a prior error has occurred. - ** But if (due to a coding error elsewhere in the system) it does get - ** called, just return the same error code without doing anything. */ - if( NEVER(pPager->errCode) ) return pPager->errCode; - - assert( pPager->eState==PAGER_WRITER_LOCKED - || pPager->eState==PAGER_WRITER_FINISHED - || (pagerUseWal(pPager) && pPager->eState==PAGER_WRITER_CACHEMOD) - ); - assert( assert_pager_state(pPager) ); - - /* An optimization. If the database was not actually modified during - ** this transaction, the pager is running in exclusive-mode and is - ** using persistent journals, then this function is a no-op. - ** - ** The start of the journal file currently contains a single journal - ** header with the nRec field set to 0. If such a journal is used as - ** a hot-journal during hot-journal rollback, 0 changes will be made - ** to the database file. So there is no need to zero the journal - ** header. Since the pager is in exclusive mode, there is no need - ** to drop any locks either. - */ - if( pPager->eState==PAGER_WRITER_LOCKED - && pPager->exclusiveMode - && pPager->journalMode==PAGER_JOURNALMODE_PERSIST - ){ - assert( pPager->journalOff==JOURNAL_HDR_SZ(pPager) || !pPager->journalOff ); - pPager->eState = PAGER_READER; - return SQLITE_OK; - } - - PAGERTRACE(("COMMIT %d\n", PAGERID(pPager))); - rc = pager_end_transaction(pPager, pPager->setMaster, 1); - return pager_error(pPager, rc); -} - -/* -** If a write transaction is open, then all changes made within the -** transaction are reverted and the current write-transaction is closed. -** The pager falls back to PAGER_READER state if successful, or PAGER_ERROR -** state if an error occurs. -** -** If the pager is already in PAGER_ERROR state when this function is called, -** it returns Pager.errCode immediately. No work is performed in this case. -** -** Otherwise, in rollback mode, this function performs two functions: -** -** 1) It rolls back the journal file, restoring all database file and -** in-memory cache pages to the state they were in when the transaction -** was opened, and -** -** 2) It finalizes the journal file, so that it is not used for hot -** rollback at any point in the future. -** -** Finalization of the journal file (task 2) is only performed if the -** rollback is successful. -** -** In WAL mode, all cache-entries containing data modified within the -** current transaction are either expelled from the cache or reverted to -** their pre-transaction state by re-reading data from the database or -** WAL files. The WAL transaction is then closed. -*/ -SQLITE_PRIVATE int sqlite3PagerRollback(Pager *pPager){ - int rc = SQLITE_OK; /* Return code */ - PAGERTRACE(("ROLLBACK %d\n", PAGERID(pPager))); - - /* PagerRollback() is a no-op if called in READER or OPEN state. If - ** the pager is already in the ERROR state, the rollback is not - ** attempted here. Instead, the error code is returned to the caller. - */ - assert( assert_pager_state(pPager) ); - if( pPager->eState==PAGER_ERROR ) return pPager->errCode; - if( pPager->eState<=PAGER_READER ) return SQLITE_OK; - - if( pagerUseWal(pPager) ){ - int rc2; - rc = sqlite3PagerSavepoint(pPager, SAVEPOINT_ROLLBACK, -1); - rc2 = pager_end_transaction(pPager, pPager->setMaster, 0); - if( rc==SQLITE_OK ) rc = rc2; - }else if( !isOpen(pPager->jfd) || pPager->eState==PAGER_WRITER_LOCKED ){ - int eState = pPager->eState; - rc = pager_end_transaction(pPager, 0, 0); - if( !MEMDB && eState>PAGER_WRITER_LOCKED ){ - /* This can happen using journal_mode=off. Move the pager to the error - ** state to indicate that the contents of the cache may not be trusted. - ** Any active readers will get SQLITE_ABORT. - */ - pPager->errCode = SQLITE_ABORT; - pPager->eState = PAGER_ERROR; - return rc; - } - }else{ - rc = pager_playback(pPager, 0); - } - - assert( pPager->eState==PAGER_READER || rc!=SQLITE_OK ); - assert( rc==SQLITE_OK || rc==SQLITE_FULL || rc==SQLITE_CORRUPT - || rc==SQLITE_NOMEM || (rc&0xFF)==SQLITE_IOERR - || rc==SQLITE_CANTOPEN - ); - - /* If an error occurs during a ROLLBACK, we can no longer trust the pager - ** cache. So call pager_error() on the way out to make any error persistent. - */ - return pager_error(pPager, rc); -} - -/* -** Return TRUE if the database file is opened read-only. Return FALSE -** if the database is (in theory) writable. -*/ -SQLITE_PRIVATE u8 sqlite3PagerIsreadonly(Pager *pPager){ - return pPager->readOnly; -} - -/* -** Return the number of references to the pager. -*/ -SQLITE_PRIVATE int sqlite3PagerRefcount(Pager *pPager){ - return sqlite3PcacheRefCount(pPager->pPCache); -} - -/* -** Return the approximate number of bytes of memory currently -** used by the pager and its associated cache. -*/ -SQLITE_PRIVATE int sqlite3PagerMemUsed(Pager *pPager){ - int perPageSize = pPager->pageSize + pPager->nExtra + sizeof(PgHdr) - + 5*sizeof(void*); - return perPageSize*sqlite3PcachePagecount(pPager->pPCache) - + sqlite3MallocSize(pPager) - + pPager->pageSize; -} - -/* -** Return the number of references to the specified page. -*/ -SQLITE_PRIVATE int sqlite3PagerPageRefcount(DbPage *pPage){ - return sqlite3PcachePageRefcount(pPage); -} - -#ifdef SQLITE_TEST -/* -** This routine is used for testing and analysis only. -*/ -SQLITE_PRIVATE int *sqlite3PagerStats(Pager *pPager){ - static int a[11]; - a[0] = sqlite3PcacheRefCount(pPager->pPCache); - a[1] = sqlite3PcachePagecount(pPager->pPCache); - a[2] = sqlite3PcacheGetCachesize(pPager->pPCache); - a[3] = pPager->eState==PAGER_OPEN ? -1 : (int) pPager->dbSize; - a[4] = pPager->eState; - a[5] = pPager->errCode; - a[6] = pPager->aStat[PAGER_STAT_HIT]; - a[7] = pPager->aStat[PAGER_STAT_MISS]; - a[8] = 0; /* Used to be pPager->nOvfl */ - a[9] = pPager->nRead; - a[10] = pPager->aStat[PAGER_STAT_WRITE]; - return a; -} -#endif - -/* -** Parameter eStat must be either SQLITE_DBSTATUS_CACHE_HIT or -** SQLITE_DBSTATUS_CACHE_MISS. Before returning, *pnVal is incremented by the -** current cache hit or miss count, according to the value of eStat. If the -** reset parameter is non-zero, the cache hit or miss count is zeroed before -** returning. -*/ -SQLITE_PRIVATE void sqlite3PagerCacheStat(Pager *pPager, int eStat, int reset, int *pnVal){ - - assert( eStat==SQLITE_DBSTATUS_CACHE_HIT - || eStat==SQLITE_DBSTATUS_CACHE_MISS - || eStat==SQLITE_DBSTATUS_CACHE_WRITE - ); - - assert( SQLITE_DBSTATUS_CACHE_HIT+1==SQLITE_DBSTATUS_CACHE_MISS ); - assert( SQLITE_DBSTATUS_CACHE_HIT+2==SQLITE_DBSTATUS_CACHE_WRITE ); - assert( PAGER_STAT_HIT==0 && PAGER_STAT_MISS==1 && PAGER_STAT_WRITE==2 ); - - *pnVal += pPager->aStat[eStat - SQLITE_DBSTATUS_CACHE_HIT]; - if( reset ){ - pPager->aStat[eStat - SQLITE_DBSTATUS_CACHE_HIT] = 0; - } -} - -/* -** Return true if this is an in-memory pager. -*/ -SQLITE_PRIVATE int sqlite3PagerIsMemdb(Pager *pPager){ - return MEMDB; -} - -/* -** Check that there are at least nSavepoint savepoints open. If there are -** currently less than nSavepoints open, then open one or more savepoints -** to make up the difference. If the number of savepoints is already -** equal to nSavepoint, then this function is a no-op. -** -** If a memory allocation fails, SQLITE_NOMEM is returned. If an error -** occurs while opening the sub-journal file, then an IO error code is -** returned. Otherwise, SQLITE_OK. -*/ -SQLITE_PRIVATE int sqlite3PagerOpenSavepoint(Pager *pPager, int nSavepoint){ - int rc = SQLITE_OK; /* Return code */ - int nCurrent = pPager->nSavepoint; /* Current number of savepoints */ - - assert( pPager->eState>=PAGER_WRITER_LOCKED ); - assert( assert_pager_state(pPager) ); - - if( nSavepoint>nCurrent && pPager->useJournal ){ - int ii; /* Iterator variable */ - PagerSavepoint *aNew; /* New Pager.aSavepoint array */ - - /* Grow the Pager.aSavepoint array using realloc(). Return SQLITE_NOMEM - ** if the allocation fails. Otherwise, zero the new portion in case a - ** malloc failure occurs while populating it in the for(...) loop below. - */ - aNew = (PagerSavepoint *)sqlite3Realloc( - pPager->aSavepoint, sizeof(PagerSavepoint)*nSavepoint - ); - if( !aNew ){ - return SQLITE_NOMEM; - } - memset(&aNew[nCurrent], 0, (nSavepoint-nCurrent) * sizeof(PagerSavepoint)); - pPager->aSavepoint = aNew; - - /* Populate the PagerSavepoint structures just allocated. */ - for(ii=nCurrent; iidbSize; - if( isOpen(pPager->jfd) && pPager->journalOff>0 ){ - aNew[ii].iOffset = pPager->journalOff; - }else{ - aNew[ii].iOffset = JOURNAL_HDR_SZ(pPager); - } - aNew[ii].iSubRec = pPager->nSubRec; - aNew[ii].pInSavepoint = sqlite3BitvecCreate(pPager->dbSize); - if( !aNew[ii].pInSavepoint ){ - return SQLITE_NOMEM; - } - if( pagerUseWal(pPager) ){ - sqlite3WalSavepoint(pPager->pWal, aNew[ii].aWalData); - } - pPager->nSavepoint = ii+1; - } - assert( pPager->nSavepoint==nSavepoint ); - assertTruncateConstraint(pPager); - } - - return rc; -} - -/* -** This function is called to rollback or release (commit) a savepoint. -** The savepoint to release or rollback need not be the most recently -** created savepoint. -** -** Parameter op is always either SAVEPOINT_ROLLBACK or SAVEPOINT_RELEASE. -** If it is SAVEPOINT_RELEASE, then release and destroy the savepoint with -** index iSavepoint. If it is SAVEPOINT_ROLLBACK, then rollback all changes -** that have occurred since the specified savepoint was created. -** -** The savepoint to rollback or release is identified by parameter -** iSavepoint. A value of 0 means to operate on the outermost savepoint -** (the first created). A value of (Pager.nSavepoint-1) means operate -** on the most recently created savepoint. If iSavepoint is greater than -** (Pager.nSavepoint-1), then this function is a no-op. -** -** If a negative value is passed to this function, then the current -** transaction is rolled back. This is different to calling -** sqlite3PagerRollback() because this function does not terminate -** the transaction or unlock the database, it just restores the -** contents of the database to its original state. -** -** In any case, all savepoints with an index greater than iSavepoint -** are destroyed. If this is a release operation (op==SAVEPOINT_RELEASE), -** then savepoint iSavepoint is also destroyed. -** -** This function may return SQLITE_NOMEM if a memory allocation fails, -** or an IO error code if an IO error occurs while rolling back a -** savepoint. If no errors occur, SQLITE_OK is returned. -*/ -SQLITE_PRIVATE int sqlite3PagerSavepoint(Pager *pPager, int op, int iSavepoint){ - int rc = pPager->errCode; /* Return code */ - - assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK ); - assert( iSavepoint>=0 || op==SAVEPOINT_ROLLBACK ); - - if( rc==SQLITE_OK && iSavepointnSavepoint ){ - int ii; /* Iterator variable */ - int nNew; /* Number of remaining savepoints after this op. */ - - /* Figure out how many savepoints will still be active after this - ** operation. Store this value in nNew. Then free resources associated - ** with any savepoints that are destroyed by this operation. - */ - nNew = iSavepoint + (( op==SAVEPOINT_RELEASE ) ? 0 : 1); - for(ii=nNew; iinSavepoint; ii++){ - sqlite3BitvecDestroy(pPager->aSavepoint[ii].pInSavepoint); - } - pPager->nSavepoint = nNew; - - /* If this is a release of the outermost savepoint, truncate - ** the sub-journal to zero bytes in size. */ - if( op==SAVEPOINT_RELEASE ){ - if( nNew==0 && isOpen(pPager->sjfd) ){ - /* Only truncate if it is an in-memory sub-journal. */ - if( sqlite3IsMemJournal(pPager->sjfd) ){ - rc = sqlite3OsTruncate(pPager->sjfd, 0); - assert( rc==SQLITE_OK ); - } - pPager->nSubRec = 0; - } - } - /* Else this is a rollback operation, playback the specified savepoint. - ** If this is a temp-file, it is possible that the journal file has - ** not yet been opened. In this case there have been no changes to - ** the database file, so the playback operation can be skipped. - */ - else if( pagerUseWal(pPager) || isOpen(pPager->jfd) ){ - PagerSavepoint *pSavepoint = (nNew==0)?0:&pPager->aSavepoint[nNew-1]; - rc = pagerPlaybackSavepoint(pPager, pSavepoint); - assert(rc!=SQLITE_DONE); - } - } - - return rc; -} - -/* -** Return the full pathname of the database file. -** -** Except, if the pager is in-memory only, then return an empty string if -** nullIfMemDb is true. This routine is called with nullIfMemDb==1 when -** used to report the filename to the user, for compatibility with legacy -** behavior. But when the Btree needs to know the filename for matching to -** shared cache, it uses nullIfMemDb==0 so that in-memory databases can -** participate in shared-cache. -*/ -SQLITE_PRIVATE const char *sqlite3PagerFilename(Pager *pPager, int nullIfMemDb){ - return (nullIfMemDb && pPager->memDb) ? "" : pPager->zFilename; -} - -/* -** Return the VFS structure for the pager. -*/ -SQLITE_PRIVATE const sqlite3_vfs *sqlite3PagerVfs(Pager *pPager){ - return pPager->pVfs; -} - -/* -** Return the file handle for the database file associated -** with the pager. This might return NULL if the file has -** not yet been opened. -*/ -SQLITE_PRIVATE sqlite3_file *sqlite3PagerFile(Pager *pPager){ - return pPager->fd; -} - -/* -** Return the full pathname of the journal file. -*/ -SQLITE_PRIVATE const char *sqlite3PagerJournalname(Pager *pPager){ - return pPager->zJournal; -} - -/* -** Return true if fsync() calls are disabled for this pager. Return FALSE -** if fsync()s are executed normally. -*/ -SQLITE_PRIVATE int sqlite3PagerNosync(Pager *pPager){ - return pPager->noSync; -} - -#ifdef SQLITE_HAS_CODEC -/* -** Set or retrieve the codec for this pager -*/ -SQLITE_PRIVATE void sqlite3PagerSetCodec( - Pager *pPager, - void *(*xCodec)(void*,void*,Pgno,int), - void (*xCodecSizeChng)(void*,int,int), - void (*xCodecFree)(void*), - void *pCodec -){ - if( pPager->xCodecFree ) pPager->xCodecFree(pPager->pCodec); - pPager->xCodec = pPager->memDb ? 0 : xCodec; - pPager->xCodecSizeChng = xCodecSizeChng; - pPager->xCodecFree = xCodecFree; - pPager->pCodec = pCodec; - pagerReportSize(pPager); -} -SQLITE_PRIVATE void *sqlite3PagerGetCodec(Pager *pPager){ - return pPager->pCodec; -} - -/* -** This function is called by the wal module when writing page content -** into the log file. -** -** This function returns a pointer to a buffer containing the encrypted -** page content. If a malloc fails, this function may return NULL. -*/ -SQLITE_PRIVATE void *sqlite3PagerCodec(PgHdr *pPg){ - void *aData = 0; - CODEC2(pPg->pPager, pPg->pData, pPg->pgno, 6, return 0, aData); - return aData; -} - -/* -** Return the current pager state -*/ -SQLITE_PRIVATE int sqlite3PagerState(Pager *pPager){ - return pPager->eState; -} -#endif /* SQLITE_HAS_CODEC */ - -#ifndef SQLITE_OMIT_AUTOVACUUM -/* -** Move the page pPg to location pgno in the file. -** -** There must be no references to the page previously located at -** pgno (which we call pPgOld) though that page is allowed to be -** in cache. If the page previously located at pgno is not already -** in the rollback journal, it is not put there by by this routine. -** -** References to the page pPg remain valid. Updating any -** meta-data associated with pPg (i.e. data stored in the nExtra bytes -** allocated along with the page) is the responsibility of the caller. -** -** A transaction must be active when this routine is called. It used to be -** required that a statement transaction was not active, but this restriction -** has been removed (CREATE INDEX needs to move a page when a statement -** transaction is active). -** -** If the fourth argument, isCommit, is non-zero, then this page is being -** moved as part of a database reorganization just before the transaction -** is being committed. In this case, it is guaranteed that the database page -** pPg refers to will not be written to again within this transaction. -** -** This function may return SQLITE_NOMEM or an IO error code if an error -** occurs. Otherwise, it returns SQLITE_OK. -*/ -SQLITE_PRIVATE int sqlite3PagerMovepage(Pager *pPager, DbPage *pPg, Pgno pgno, int isCommit){ - PgHdr *pPgOld; /* The page being overwritten. */ - Pgno needSyncPgno = 0; /* Old value of pPg->pgno, if sync is required */ - int rc; /* Return code */ - Pgno origPgno; /* The original page number */ - - assert( pPg->nRef>0 ); - assert( pPager->eState==PAGER_WRITER_CACHEMOD - || pPager->eState==PAGER_WRITER_DBMOD - ); - assert( assert_pager_state(pPager) ); - - /* In order to be able to rollback, an in-memory database must journal - ** the page we are moving from. - */ - if( MEMDB ){ - rc = sqlite3PagerWrite(pPg); - if( rc ) return rc; - } - - /* If the page being moved is dirty and has not been saved by the latest - ** savepoint, then save the current contents of the page into the - ** sub-journal now. This is required to handle the following scenario: - ** - ** BEGIN; - ** - ** SAVEPOINT one; - ** - ** ROLLBACK TO one; - ** - ** If page X were not written to the sub-journal here, it would not - ** be possible to restore its contents when the "ROLLBACK TO one" - ** statement were is processed. - ** - ** subjournalPage() may need to allocate space to store pPg->pgno into - ** one or more savepoint bitvecs. This is the reason this function - ** may return SQLITE_NOMEM. - */ - if( pPg->flags&PGHDR_DIRTY - && subjRequiresPage(pPg) - && SQLITE_OK!=(rc = subjournalPage(pPg)) - ){ - return rc; - } - - PAGERTRACE(("MOVE %d page %d (needSync=%d) moves to %d\n", - PAGERID(pPager), pPg->pgno, (pPg->flags&PGHDR_NEED_SYNC)?1:0, pgno)); - IOTRACE(("MOVE %p %d %d\n", pPager, pPg->pgno, pgno)) - - /* If the journal needs to be sync()ed before page pPg->pgno can - ** be written to, store pPg->pgno in local variable needSyncPgno. - ** - ** If the isCommit flag is set, there is no need to remember that - ** the journal needs to be sync()ed before database page pPg->pgno - ** can be written to. The caller has already promised not to write to it. - */ - if( (pPg->flags&PGHDR_NEED_SYNC) && !isCommit ){ - needSyncPgno = pPg->pgno; - assert( pPager->journalMode==PAGER_JOURNALMODE_OFF || - pageInJournal(pPager, pPg) || pPg->pgno>pPager->dbOrigSize ); - assert( pPg->flags&PGHDR_DIRTY ); - } - - /* If the cache contains a page with page-number pgno, remove it - ** from its hash chain. Also, if the PGHDR_NEED_SYNC flag was set for - ** page pgno before the 'move' operation, it needs to be retained - ** for the page moved there. - */ - pPg->flags &= ~PGHDR_NEED_SYNC; - pPgOld = pager_lookup(pPager, pgno); - assert( !pPgOld || pPgOld->nRef==1 ); - if( pPgOld ){ - pPg->flags |= (pPgOld->flags&PGHDR_NEED_SYNC); - if( MEMDB ){ - /* Do not discard pages from an in-memory database since we might - ** need to rollback later. Just move the page out of the way. */ - sqlite3PcacheMove(pPgOld, pPager->dbSize+1); - }else{ - sqlite3PcacheDrop(pPgOld); - } - } - - origPgno = pPg->pgno; - sqlite3PcacheMove(pPg, pgno); - sqlite3PcacheMakeDirty(pPg); - - /* For an in-memory database, make sure the original page continues - ** to exist, in case the transaction needs to roll back. Use pPgOld - ** as the original page since it has already been allocated. - */ - if( MEMDB ){ - assert( pPgOld ); - sqlite3PcacheMove(pPgOld, origPgno); - sqlite3PagerUnrefNotNull(pPgOld); - } - - if( needSyncPgno ){ - /* If needSyncPgno is non-zero, then the journal file needs to be - ** sync()ed before any data is written to database file page needSyncPgno. - ** Currently, no such page exists in the page-cache and the - ** "is journaled" bitvec flag has been set. This needs to be remedied by - ** loading the page into the pager-cache and setting the PGHDR_NEED_SYNC - ** flag. - ** - ** If the attempt to load the page into the page-cache fails, (due - ** to a malloc() or IO failure), clear the bit in the pInJournal[] - ** array. Otherwise, if the page is loaded and written again in - ** this transaction, it may be written to the database file before - ** it is synced into the journal file. This way, it may end up in - ** the journal file twice, but that is not a problem. - */ - PgHdr *pPgHdr; - rc = sqlite3PagerGet(pPager, needSyncPgno, &pPgHdr); - if( rc!=SQLITE_OK ){ - if( needSyncPgno<=pPager->dbOrigSize ){ - assert( pPager->pTmpSpace!=0 ); - sqlite3BitvecClear(pPager->pInJournal, needSyncPgno, pPager->pTmpSpace); - } - return rc; - } - pPgHdr->flags |= PGHDR_NEED_SYNC; - sqlite3PcacheMakeDirty(pPgHdr); - sqlite3PagerUnrefNotNull(pPgHdr); - } - - return SQLITE_OK; -} -#endif - -/* -** Return a pointer to the data for the specified page. -*/ -SQLITE_PRIVATE void *sqlite3PagerGetData(DbPage *pPg){ - assert( pPg->nRef>0 || pPg->pPager->memDb ); - return pPg->pData; -} - -/* -** Return a pointer to the Pager.nExtra bytes of "extra" space -** allocated along with the specified page. -*/ -SQLITE_PRIVATE void *sqlite3PagerGetExtra(DbPage *pPg){ - return pPg->pExtra; -} - -/* -** Get/set the locking-mode for this pager. Parameter eMode must be one -** of PAGER_LOCKINGMODE_QUERY, PAGER_LOCKINGMODE_NORMAL or -** PAGER_LOCKINGMODE_EXCLUSIVE. If the parameter is not _QUERY, then -** the locking-mode is set to the value specified. -** -** The returned value is either PAGER_LOCKINGMODE_NORMAL or -** PAGER_LOCKINGMODE_EXCLUSIVE, indicating the current (possibly updated) -** locking-mode. -*/ -SQLITE_PRIVATE int sqlite3PagerLockingMode(Pager *pPager, int eMode){ - assert( eMode==PAGER_LOCKINGMODE_QUERY - || eMode==PAGER_LOCKINGMODE_NORMAL - || eMode==PAGER_LOCKINGMODE_EXCLUSIVE ); - assert( PAGER_LOCKINGMODE_QUERY<0 ); - assert( PAGER_LOCKINGMODE_NORMAL>=0 && PAGER_LOCKINGMODE_EXCLUSIVE>=0 ); - assert( pPager->exclusiveMode || 0==sqlite3WalHeapMemory(pPager->pWal) ); - if( eMode>=0 && !pPager->tempFile && !sqlite3WalHeapMemory(pPager->pWal) ){ - pPager->exclusiveMode = (u8)eMode; - } - return (int)pPager->exclusiveMode; -} - -/* -** Set the journal-mode for this pager. Parameter eMode must be one of: -** -** PAGER_JOURNALMODE_DELETE -** PAGER_JOURNALMODE_TRUNCATE -** PAGER_JOURNALMODE_PERSIST -** PAGER_JOURNALMODE_OFF -** PAGER_JOURNALMODE_MEMORY -** PAGER_JOURNALMODE_WAL -** -** The journalmode is set to the value specified if the change is allowed. -** The change may be disallowed for the following reasons: -** -** * An in-memory database can only have its journal_mode set to _OFF -** or _MEMORY. -** -** * Temporary databases cannot have _WAL journalmode. -** -** The returned indicate the current (possibly updated) journal-mode. -*/ -SQLITE_PRIVATE int sqlite3PagerSetJournalMode(Pager *pPager, int eMode){ - u8 eOld = pPager->journalMode; /* Prior journalmode */ - -#ifdef SQLITE_DEBUG - /* The print_pager_state() routine is intended to be used by the debugger - ** only. We invoke it once here to suppress a compiler warning. */ - print_pager_state(pPager); -#endif - - - /* The eMode parameter is always valid */ - assert( eMode==PAGER_JOURNALMODE_DELETE - || eMode==PAGER_JOURNALMODE_TRUNCATE - || eMode==PAGER_JOURNALMODE_PERSIST - || eMode==PAGER_JOURNALMODE_OFF - || eMode==PAGER_JOURNALMODE_WAL - || eMode==PAGER_JOURNALMODE_MEMORY ); - - /* This routine is only called from the OP_JournalMode opcode, and - ** the logic there will never allow a temporary file to be changed - ** to WAL mode. - */ - assert( pPager->tempFile==0 || eMode!=PAGER_JOURNALMODE_WAL ); - - /* Do allow the journalmode of an in-memory database to be set to - ** anything other than MEMORY or OFF - */ - if( MEMDB ){ - assert( eOld==PAGER_JOURNALMODE_MEMORY || eOld==PAGER_JOURNALMODE_OFF ); - if( eMode!=PAGER_JOURNALMODE_MEMORY && eMode!=PAGER_JOURNALMODE_OFF ){ - eMode = eOld; - } - } - - if( eMode!=eOld ){ - - /* Change the journal mode. */ - assert( pPager->eState!=PAGER_ERROR ); - pPager->journalMode = (u8)eMode; - - /* When transistioning from TRUNCATE or PERSIST to any other journal - ** mode except WAL, unless the pager is in locking_mode=exclusive mode, - ** delete the journal file. - */ - assert( (PAGER_JOURNALMODE_TRUNCATE & 5)==1 ); - assert( (PAGER_JOURNALMODE_PERSIST & 5)==1 ); - assert( (PAGER_JOURNALMODE_DELETE & 5)==0 ); - assert( (PAGER_JOURNALMODE_MEMORY & 5)==4 ); - assert( (PAGER_JOURNALMODE_OFF & 5)==0 ); - assert( (PAGER_JOURNALMODE_WAL & 5)==5 ); - - assert( isOpen(pPager->fd) || pPager->exclusiveMode ); - if( !pPager->exclusiveMode && (eOld & 5)==1 && (eMode & 1)==0 ){ - - /* In this case we would like to delete the journal file. If it is - ** not possible, then that is not a problem. Deleting the journal file - ** here is an optimization only. - ** - ** Before deleting the journal file, obtain a RESERVED lock on the - ** database file. This ensures that the journal file is not deleted - ** while it is in use by some other client. - */ - sqlite3OsClose(pPager->jfd); - if( pPager->eLock>=RESERVED_LOCK ){ - sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); - }else{ - int rc = SQLITE_OK; - int state = pPager->eState; - assert( state==PAGER_OPEN || state==PAGER_READER ); - if( state==PAGER_OPEN ){ - rc = sqlite3PagerSharedLock(pPager); - } - if( pPager->eState==PAGER_READER ){ - assert( rc==SQLITE_OK ); - rc = pagerLockDb(pPager, RESERVED_LOCK); - } - if( rc==SQLITE_OK ){ - sqlite3OsDelete(pPager->pVfs, pPager->zJournal, 0); - } - if( rc==SQLITE_OK && state==PAGER_READER ){ - pagerUnlockDb(pPager, SHARED_LOCK); - }else if( state==PAGER_OPEN ){ - pager_unlock(pPager); - } - assert( state==pPager->eState ); - } - } - } - - /* Return the new journal mode */ - return (int)pPager->journalMode; -} - -/* -** Return the current journal mode. -*/ -SQLITE_PRIVATE int sqlite3PagerGetJournalMode(Pager *pPager){ - return (int)pPager->journalMode; -} - -/* -** Return TRUE if the pager is in a state where it is OK to change the -** journalmode. Journalmode changes can only happen when the database -** is unmodified. -*/ -SQLITE_PRIVATE int sqlite3PagerOkToChangeJournalMode(Pager *pPager){ - assert( assert_pager_state(pPager) ); - if( pPager->eState>=PAGER_WRITER_CACHEMOD ) return 0; - if( NEVER(isOpen(pPager->jfd) && pPager->journalOff>0) ) return 0; - return 1; -} - -/* -** Get/set the size-limit used for persistent journal files. -** -** Setting the size limit to -1 means no limit is enforced. -** An attempt to set a limit smaller than -1 is a no-op. -*/ -SQLITE_PRIVATE i64 sqlite3PagerJournalSizeLimit(Pager *pPager, i64 iLimit){ - if( iLimit>=-1 ){ - pPager->journalSizeLimit = iLimit; - sqlite3WalLimit(pPager->pWal, iLimit); - } - return pPager->journalSizeLimit; -} - -/* -** Return a pointer to the pPager->pBackup variable. The backup module -** in backup.c maintains the content of this variable. This module -** uses it opaquely as an argument to sqlite3BackupRestart() and -** sqlite3BackupUpdate() only. -*/ -SQLITE_PRIVATE sqlite3_backup **sqlite3PagerBackupPtr(Pager *pPager){ - return &pPager->pBackup; -} - -#ifndef SQLITE_OMIT_VACUUM -/* -** Unless this is an in-memory or temporary database, clear the pager cache. -*/ -SQLITE_PRIVATE void sqlite3PagerClearCache(Pager *pPager){ - if( !MEMDB && pPager->tempFile==0 ) pager_reset(pPager); -} -#endif - -#ifndef SQLITE_OMIT_WAL -/* -** This function is called when the user invokes "PRAGMA wal_checkpoint", -** "PRAGMA wal_blocking_checkpoint" or calls the sqlite3_wal_checkpoint() -** or wal_blocking_checkpoint() API functions. -** -** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. -*/ -SQLITE_PRIVATE int sqlite3PagerCheckpoint(Pager *pPager, int eMode, int *pnLog, int *pnCkpt){ - int rc = SQLITE_OK; - if( pPager->pWal ){ - rc = sqlite3WalCheckpoint(pPager->pWal, eMode, - pPager->xBusyHandler, pPager->pBusyHandlerArg, - pPager->ckptSyncFlags, pPager->pageSize, (u8 *)pPager->pTmpSpace, - pnLog, pnCkpt - ); - } - return rc; -} - -SQLITE_PRIVATE int sqlite3PagerWalCallback(Pager *pPager){ - return sqlite3WalCallback(pPager->pWal); -} - -/* -** Return true if the underlying VFS for the given pager supports the -** primitives necessary for write-ahead logging. -*/ -SQLITE_PRIVATE int sqlite3PagerWalSupported(Pager *pPager){ - const sqlite3_io_methods *pMethods = pPager->fd->pMethods; - return pPager->exclusiveMode || (pMethods->iVersion>=2 && pMethods->xShmMap); -} - -/* -** Attempt to take an exclusive lock on the database file. If a PENDING lock -** is obtained instead, immediately release it. -*/ -static int pagerExclusiveLock(Pager *pPager){ - int rc; /* Return code */ - - assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK ); - rc = pagerLockDb(pPager, EXCLUSIVE_LOCK); - if( rc!=SQLITE_OK ){ - /* If the attempt to grab the exclusive lock failed, release the - ** pending lock that may have been obtained instead. */ - pagerUnlockDb(pPager, SHARED_LOCK); - } - - return rc; -} - -/* -** Call sqlite3WalOpen() to open the WAL handle. If the pager is in -** exclusive-locking mode when this function is called, take an EXCLUSIVE -** lock on the database file and use heap-memory to store the wal-index -** in. Otherwise, use the normal shared-memory. -*/ -static int pagerOpenWal(Pager *pPager){ - int rc = SQLITE_OK; - - assert( pPager->pWal==0 && pPager->tempFile==0 ); - assert( pPager->eLock==SHARED_LOCK || pPager->eLock==EXCLUSIVE_LOCK ); - - /* If the pager is already in exclusive-mode, the WAL module will use - ** heap-memory for the wal-index instead of the VFS shared-memory - ** implementation. Take the exclusive lock now, before opening the WAL - ** file, to make sure this is safe. - */ - if( pPager->exclusiveMode ){ - rc = pagerExclusiveLock(pPager); - } - - /* Open the connection to the log file. If this operation fails, - ** (e.g. due to malloc() failure), return an error code. - */ - if( rc==SQLITE_OK ){ - rc = sqlite3WalOpen(pPager->pVfs, - pPager->fd, pPager->zWal, pPager->exclusiveMode, - pPager->journalSizeLimit, &pPager->pWal - ); - } - pagerFixMaplimit(pPager); - - return rc; -} - - -/* -** The caller must be holding a SHARED lock on the database file to call -** this function. -** -** If the pager passed as the first argument is open on a real database -** file (not a temp file or an in-memory database), and the WAL file -** is not already open, make an attempt to open it now. If successful, -** return SQLITE_OK. If an error occurs or the VFS used by the pager does -** not support the xShmXXX() methods, return an error code. *pbOpen is -** not modified in either case. -** -** If the pager is open on a temp-file (or in-memory database), or if -** the WAL file is already open, set *pbOpen to 1 and return SQLITE_OK -** without doing anything. -*/ -SQLITE_PRIVATE int sqlite3PagerOpenWal( - Pager *pPager, /* Pager object */ - int *pbOpen /* OUT: Set to true if call is a no-op */ -){ - int rc = SQLITE_OK; /* Return code */ - - assert( assert_pager_state(pPager) ); - assert( pPager->eState==PAGER_OPEN || pbOpen ); - assert( pPager->eState==PAGER_READER || !pbOpen ); - assert( pbOpen==0 || *pbOpen==0 ); - assert( pbOpen!=0 || (!pPager->tempFile && !pPager->pWal) ); - - if( !pPager->tempFile && !pPager->pWal ){ - if( !sqlite3PagerWalSupported(pPager) ) return SQLITE_CANTOPEN; - - /* Close any rollback journal previously open */ - sqlite3OsClose(pPager->jfd); - - rc = pagerOpenWal(pPager); - if( rc==SQLITE_OK ){ - pPager->journalMode = PAGER_JOURNALMODE_WAL; - pPager->eState = PAGER_OPEN; - } - }else{ - *pbOpen = 1; - } - - return rc; -} - -/* -** This function is called to close the connection to the log file prior -** to switching from WAL to rollback mode. -** -** Before closing the log file, this function attempts to take an -** EXCLUSIVE lock on the database file. If this cannot be obtained, an -** error (SQLITE_BUSY) is returned and the log connection is not closed. -** If successful, the EXCLUSIVE lock is not released before returning. -*/ -SQLITE_PRIVATE int sqlite3PagerCloseWal(Pager *pPager){ - int rc = SQLITE_OK; - - assert( pPager->journalMode==PAGER_JOURNALMODE_WAL ); - - /* If the log file is not already open, but does exist in the file-system, - ** it may need to be checkpointed before the connection can switch to - ** rollback mode. Open it now so this can happen. - */ - if( !pPager->pWal ){ - int logexists = 0; - rc = pagerLockDb(pPager, SHARED_LOCK); - if( rc==SQLITE_OK ){ - rc = sqlite3OsAccess( - pPager->pVfs, pPager->zWal, SQLITE_ACCESS_EXISTS, &logexists - ); - } - if( rc==SQLITE_OK && logexists ){ - rc = pagerOpenWal(pPager); - } - } - - /* Checkpoint and close the log. Because an EXCLUSIVE lock is held on - ** the database file, the log and log-summary files will be deleted. - */ - if( rc==SQLITE_OK && pPager->pWal ){ - rc = pagerExclusiveLock(pPager); - if( rc==SQLITE_OK ){ - rc = sqlite3WalClose(pPager->pWal, pPager->ckptSyncFlags, - pPager->pageSize, (u8*)pPager->pTmpSpace); - pPager->pWal = 0; - pagerFixMaplimit(pPager); - } - } - return rc; -} - -#endif /* !SQLITE_OMIT_WAL */ - -#ifdef SQLITE_ENABLE_ZIPVFS -/* -** A read-lock must be held on the pager when this function is called. If -** the pager is in WAL mode and the WAL file currently contains one or more -** frames, return the size in bytes of the page images stored within the -** WAL frames. Otherwise, if this is not a WAL database or the WAL file -** is empty, return 0. -*/ -SQLITE_PRIVATE int sqlite3PagerWalFramesize(Pager *pPager){ - assert( pPager->eState==PAGER_READER ); - return sqlite3WalFramesize(pPager->pWal); -} -#endif - -#endif /* SQLITE_OMIT_DISKIO */ - -/************** End of pager.c ***********************************************/ -/************** Begin file wal.c *********************************************/ -/* -** 2010 February 1 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains the implementation of a write-ahead log (WAL) used in -** "journal_mode=WAL" mode. -** -** WRITE-AHEAD LOG (WAL) FILE FORMAT -** -** A WAL file consists of a header followed by zero or more "frames". -** Each frame records the revised content of a single page from the -** database file. All changes to the database are recorded by writing -** frames into the WAL. Transactions commit when a frame is written that -** contains a commit marker. A single WAL can and usually does record -** multiple transactions. Periodically, the content of the WAL is -** transferred back into the database file in an operation called a -** "checkpoint". -** -** A single WAL file can be used multiple times. In other words, the -** WAL can fill up with frames and then be checkpointed and then new -** frames can overwrite the old ones. A WAL always grows from beginning -** toward the end. Checksums and counters attached to each frame are -** used to determine which frames within the WAL are valid and which -** are leftovers from prior checkpoints. -** -** The WAL header is 32 bytes in size and consists of the following eight -** big-endian 32-bit unsigned integer values: -** -** 0: Magic number. 0x377f0682 or 0x377f0683 -** 4: File format version. Currently 3007000 -** 8: Database page size. Example: 1024 -** 12: Checkpoint sequence number -** 16: Salt-1, random integer incremented with each checkpoint -** 20: Salt-2, a different random integer changing with each ckpt -** 24: Checksum-1 (first part of checksum for first 24 bytes of header). -** 28: Checksum-2 (second part of checksum for first 24 bytes of header). -** -** Immediately following the wal-header are zero or more frames. Each -** frame consists of a 24-byte frame-header followed by a bytes -** of page data. The frame-header is six big-endian 32-bit unsigned -** integer values, as follows: -** -** 0: Page number. -** 4: For commit records, the size of the database image in pages -** after the commit. For all other records, zero. -** 8: Salt-1 (copied from the header) -** 12: Salt-2 (copied from the header) -** 16: Checksum-1. -** 20: Checksum-2. -** -** A frame is considered valid if and only if the following conditions are -** true: -** -** (1) The salt-1 and salt-2 values in the frame-header match -** salt values in the wal-header -** -** (2) The checksum values in the final 8 bytes of the frame-header -** exactly match the checksum computed consecutively on the -** WAL header and the first 8 bytes and the content of all frames -** up to and including the current frame. -** -** The checksum is computed using 32-bit big-endian integers if the -** magic number in the first 4 bytes of the WAL is 0x377f0683 and it -** is computed using little-endian if the magic number is 0x377f0682. -** The checksum values are always stored in the frame header in a -** big-endian format regardless of which byte order is used to compute -** the checksum. The checksum is computed by interpreting the input as -** an even number of unsigned 32-bit integers: x[0] through x[N]. The -** algorithm used for the checksum is as follows: -** -** for i from 0 to n-1 step 2: -** s0 += x[i] + s1; -** s1 += x[i+1] + s0; -** endfor -** -** Note that s0 and s1 are both weighted checksums using fibonacci weights -** in reverse order (the largest fibonacci weight occurs on the first element -** of the sequence being summed.) The s1 value spans all 32-bit -** terms of the sequence whereas s0 omits the final term. -** -** On a checkpoint, the WAL is first VFS.xSync-ed, then valid content of the -** WAL is transferred into the database, then the database is VFS.xSync-ed. -** The VFS.xSync operations serve as write barriers - all writes launched -** before the xSync must complete before any write that launches after the -** xSync begins. -** -** After each checkpoint, the salt-1 value is incremented and the salt-2 -** value is randomized. This prevents old and new frames in the WAL from -** being considered valid at the same time and being checkpointing together -** following a crash. -** -** READER ALGORITHM -** -** To read a page from the database (call it page number P), a reader -** first checks the WAL to see if it contains page P. If so, then the -** last valid instance of page P that is a followed by a commit frame -** or is a commit frame itself becomes the value read. If the WAL -** contains no copies of page P that are valid and which are a commit -** frame or are followed by a commit frame, then page P is read from -** the database file. -** -** To start a read transaction, the reader records the index of the last -** valid frame in the WAL. The reader uses this recorded "mxFrame" value -** for all subsequent read operations. New transactions can be appended -** to the WAL, but as long as the reader uses its original mxFrame value -** and ignores the newly appended content, it will see a consistent snapshot -** of the database from a single point in time. This technique allows -** multiple concurrent readers to view different versions of the database -** content simultaneously. -** -** The reader algorithm in the previous paragraphs works correctly, but -** because frames for page P can appear anywhere within the WAL, the -** reader has to scan the entire WAL looking for page P frames. If the -** WAL is large (multiple megabytes is typical) that scan can be slow, -** and read performance suffers. To overcome this problem, a separate -** data structure called the wal-index is maintained to expedite the -** search for frames of a particular page. -** -** WAL-INDEX FORMAT -** -** Conceptually, the wal-index is shared memory, though VFS implementations -** might choose to implement the wal-index using a mmapped file. Because -** the wal-index is shared memory, SQLite does not support journal_mode=WAL -** on a network filesystem. All users of the database must be able to -** share memory. -** -** The wal-index is transient. After a crash, the wal-index can (and should -** be) reconstructed from the original WAL file. In fact, the VFS is required -** to either truncate or zero the header of the wal-index when the last -** connection to it closes. Because the wal-index is transient, it can -** use an architecture-specific format; it does not have to be cross-platform. -** Hence, unlike the database and WAL file formats which store all values -** as big endian, the wal-index can store multi-byte values in the native -** byte order of the host computer. -** -** The purpose of the wal-index is to answer this question quickly: Given -** a page number P and a maximum frame index M, return the index of the -** last frame in the wal before frame M for page P in the WAL, or return -** NULL if there are no frames for page P in the WAL prior to M. -** -** The wal-index consists of a header region, followed by an one or -** more index blocks. -** -** The wal-index header contains the total number of frames within the WAL -** in the mxFrame field. -** -** Each index block except for the first contains information on -** HASHTABLE_NPAGE frames. The first index block contains information on -** HASHTABLE_NPAGE_ONE frames. The values of HASHTABLE_NPAGE_ONE and -** HASHTABLE_NPAGE are selected so that together the wal-index header and -** first index block are the same size as all other index blocks in the -** wal-index. -** -** Each index block contains two sections, a page-mapping that contains the -** database page number associated with each wal frame, and a hash-table -** that allows readers to query an index block for a specific page number. -** The page-mapping is an array of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE -** for the first index block) 32-bit page numbers. The first entry in the -** first index-block contains the database page number corresponding to the -** first frame in the WAL file. The first entry in the second index block -** in the WAL file corresponds to the (HASHTABLE_NPAGE_ONE+1)th frame in -** the log, and so on. -** -** The last index block in a wal-index usually contains less than the full -** complement of HASHTABLE_NPAGE (or HASHTABLE_NPAGE_ONE) page-numbers, -** depending on the contents of the WAL file. This does not change the -** allocated size of the page-mapping array - the page-mapping array merely -** contains unused entries. -** -** Even without using the hash table, the last frame for page P -** can be found by scanning the page-mapping sections of each index block -** starting with the last index block and moving toward the first, and -** within each index block, starting at the end and moving toward the -** beginning. The first entry that equals P corresponds to the frame -** holding the content for that page. -** -** The hash table consists of HASHTABLE_NSLOT 16-bit unsigned integers. -** HASHTABLE_NSLOT = 2*HASHTABLE_NPAGE, and there is one entry in the -** hash table for each page number in the mapping section, so the hash -** table is never more than half full. The expected number of collisions -** prior to finding a match is 1. Each entry of the hash table is an -** 1-based index of an entry in the mapping section of the same -** index block. Let K be the 1-based index of the largest entry in -** the mapping section. (For index blocks other than the last, K will -** always be exactly HASHTABLE_NPAGE (4096) and for the last index block -** K will be (mxFrame%HASHTABLE_NPAGE).) Unused slots of the hash table -** contain a value of 0. -** -** To look for page P in the hash table, first compute a hash iKey on -** P as follows: -** -** iKey = (P * 383) % HASHTABLE_NSLOT -** -** Then start scanning entries of the hash table, starting with iKey -** (wrapping around to the beginning when the end of the hash table is -** reached) until an unused hash slot is found. Let the first unused slot -** be at index iUnused. (iUnused might be less than iKey if there was -** wrap-around.) Because the hash table is never more than half full, -** the search is guaranteed to eventually hit an unused entry. Let -** iMax be the value between iKey and iUnused, closest to iUnused, -** where aHash[iMax]==P. If there is no iMax entry (if there exists -** no hash slot such that aHash[i]==p) then page P is not in the -** current index block. Otherwise the iMax-th mapping entry of the -** current index block corresponds to the last entry that references -** page P. -** -** A hash search begins with the last index block and moves toward the -** first index block, looking for entries corresponding to page P. On -** average, only two or three slots in each index block need to be -** examined in order to either find the last entry for page P, or to -** establish that no such entry exists in the block. Each index block -** holds over 4000 entries. So two or three index blocks are sufficient -** to cover a typical 10 megabyte WAL file, assuming 1K pages. 8 or 10 -** comparisons (on average) suffice to either locate a frame in the -** WAL or to establish that the frame does not exist in the WAL. This -** is much faster than scanning the entire 10MB WAL. -** -** Note that entries are added in order of increasing K. Hence, one -** reader might be using some value K0 and a second reader that started -** at a later time (after additional transactions were added to the WAL -** and to the wal-index) might be using a different value K1, where K1>K0. -** Both readers can use the same hash table and mapping section to get -** the correct result. There may be entries in the hash table with -** K>K0 but to the first reader, those entries will appear to be unused -** slots in the hash table and so the first reader will get an answer as -** if no values greater than K0 had ever been inserted into the hash table -** in the first place - which is what reader one wants. Meanwhile, the -** second reader using K1 will see additional values that were inserted -** later, which is exactly what reader two wants. -** -** When a rollback occurs, the value of K is decreased. Hash table entries -** that correspond to frames greater than the new K value are removed -** from the hash table at this point. -*/ -#ifndef SQLITE_OMIT_WAL - - -/* -** Trace output macros -*/ -#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) -SQLITE_PRIVATE int sqlite3WalTrace = 0; -# define WALTRACE(X) if(sqlite3WalTrace) sqlite3DebugPrintf X -#else -# define WALTRACE(X) -#endif - -/* -** The maximum (and only) versions of the wal and wal-index formats -** that may be interpreted by this version of SQLite. -** -** If a client begins recovering a WAL file and finds that (a) the checksum -** values in the wal-header are correct and (b) the version field is not -** WAL_MAX_VERSION, recovery fails and SQLite returns SQLITE_CANTOPEN. -** -** Similarly, if a client successfully reads a wal-index header (i.e. the -** checksum test is successful) and finds that the version field is not -** WALINDEX_MAX_VERSION, then no read-transaction is opened and SQLite -** returns SQLITE_CANTOPEN. -*/ -#define WAL_MAX_VERSION 3007000 -#define WALINDEX_MAX_VERSION 3007000 - -/* -** Indices of various locking bytes. WAL_NREADER is the number -** of available reader locks and should be at least 3. -*/ -#define WAL_WRITE_LOCK 0 -#define WAL_ALL_BUT_WRITE 1 -#define WAL_CKPT_LOCK 1 -#define WAL_RECOVER_LOCK 2 -#define WAL_READ_LOCK(I) (3+(I)) -#define WAL_NREADER (SQLITE_SHM_NLOCK-3) - - -/* Object declarations */ -typedef struct WalIndexHdr WalIndexHdr; -typedef struct WalIterator WalIterator; -typedef struct WalCkptInfo WalCkptInfo; - - -/* -** The following object holds a copy of the wal-index header content. -** -** The actual header in the wal-index consists of two copies of this -** object. -** -** The szPage value can be any power of 2 between 512 and 32768, inclusive. -** Or it can be 1 to represent a 65536-byte page. The latter case was -** added in 3.7.1 when support for 64K pages was added. -*/ -struct WalIndexHdr { - u32 iVersion; /* Wal-index version */ - u32 unused; /* Unused (padding) field */ - u32 iChange; /* Counter incremented each transaction */ - u8 isInit; /* 1 when initialized */ - u8 bigEndCksum; /* True if checksums in WAL are big-endian */ - u16 szPage; /* Database page size in bytes. 1==64K */ - u32 mxFrame; /* Index of last valid frame in the WAL */ - u32 nPage; /* Size of database in pages */ - u32 aFrameCksum[2]; /* Checksum of last frame in log */ - u32 aSalt[2]; /* Two salt values copied from WAL header */ - u32 aCksum[2]; /* Checksum over all prior fields */ -}; - -/* -** A copy of the following object occurs in the wal-index immediately -** following the second copy of the WalIndexHdr. This object stores -** information used by checkpoint. -** -** nBackfill is the number of frames in the WAL that have been written -** back into the database. (We call the act of moving content from WAL to -** database "backfilling".) The nBackfill number is never greater than -** WalIndexHdr.mxFrame. nBackfill can only be increased by threads -** holding the WAL_CKPT_LOCK lock (which includes a recovery thread). -** However, a WAL_WRITE_LOCK thread can move the value of nBackfill from -** mxFrame back to zero when the WAL is reset. -** -** There is one entry in aReadMark[] for each reader lock. If a reader -** holds read-lock K, then the value in aReadMark[K] is no greater than -** the mxFrame for that reader. The value READMARK_NOT_USED (0xffffffff) -** for any aReadMark[] means that entry is unused. aReadMark[0] is -** a special case; its value is never used and it exists as a place-holder -** to avoid having to offset aReadMark[] indexs by one. Readers holding -** WAL_READ_LOCK(0) always ignore the entire WAL and read all content -** directly from the database. -** -** The value of aReadMark[K] may only be changed by a thread that -** is holding an exclusive lock on WAL_READ_LOCK(K). Thus, the value of -** aReadMark[K] cannot changed while there is a reader is using that mark -** since the reader will be holding a shared lock on WAL_READ_LOCK(K). -** -** The checkpointer may only transfer frames from WAL to database where -** the frame numbers are less than or equal to every aReadMark[] that is -** in use (that is, every aReadMark[j] for which there is a corresponding -** WAL_READ_LOCK(j)). New readers (usually) pick the aReadMark[] with the -** largest value and will increase an unused aReadMark[] to mxFrame if there -** is not already an aReadMark[] equal to mxFrame. The exception to the -** previous sentence is when nBackfill equals mxFrame (meaning that everything -** in the WAL has been backfilled into the database) then new readers -** will choose aReadMark[0] which has value 0 and hence such reader will -** get all their all content directly from the database file and ignore -** the WAL. -** -** Writers normally append new frames to the end of the WAL. However, -** if nBackfill equals mxFrame (meaning that all WAL content has been -** written back into the database) and if no readers are using the WAL -** (in other words, if there are no WAL_READ_LOCK(i) where i>0) then -** the writer will first "reset" the WAL back to the beginning and start -** writing new content beginning at frame 1. -** -** We assume that 32-bit loads are atomic and so no locks are needed in -** order to read from any aReadMark[] entries. -*/ -struct WalCkptInfo { - u32 nBackfill; /* Number of WAL frames backfilled into DB */ - u32 aReadMark[WAL_NREADER]; /* Reader marks */ -}; -#define READMARK_NOT_USED 0xffffffff - - -/* A block of WALINDEX_LOCK_RESERVED bytes beginning at -** WALINDEX_LOCK_OFFSET is reserved for locks. Since some systems -** only support mandatory file-locks, we do not read or write data -** from the region of the file on which locks are applied. -*/ -#define WALINDEX_LOCK_OFFSET (sizeof(WalIndexHdr)*2 + sizeof(WalCkptInfo)) -#define WALINDEX_LOCK_RESERVED 16 -#define WALINDEX_HDR_SIZE (WALINDEX_LOCK_OFFSET+WALINDEX_LOCK_RESERVED) - -/* Size of header before each frame in wal */ -#define WAL_FRAME_HDRSIZE 24 - -/* Size of write ahead log header, including checksum. */ -/* #define WAL_HDRSIZE 24 */ -#define WAL_HDRSIZE 32 - -/* WAL magic value. Either this value, or the same value with the least -** significant bit also set (WAL_MAGIC | 0x00000001) is stored in 32-bit -** big-endian format in the first 4 bytes of a WAL file. -** -** If the LSB is set, then the checksums for each frame within the WAL -** file are calculated by treating all data as an array of 32-bit -** big-endian words. Otherwise, they are calculated by interpreting -** all data as 32-bit little-endian words. -*/ -#define WAL_MAGIC 0x377f0682 - -/* -** Return the offset of frame iFrame in the write-ahead log file, -** assuming a database page size of szPage bytes. The offset returned -** is to the start of the write-ahead log frame-header. -*/ -#define walFrameOffset(iFrame, szPage) ( \ - WAL_HDRSIZE + ((iFrame)-1)*(i64)((szPage)+WAL_FRAME_HDRSIZE) \ -) - -/* -** An open write-ahead log file is represented by an instance of the -** following object. -*/ -struct Wal { - sqlite3_vfs *pVfs; /* The VFS used to create pDbFd */ - sqlite3_file *pDbFd; /* File handle for the database file */ - sqlite3_file *pWalFd; /* File handle for WAL file */ - u32 iCallback; /* Value to pass to log callback (or 0) */ - i64 mxWalSize; /* Truncate WAL to this size upon reset */ - int nWiData; /* Size of array apWiData */ - int szFirstBlock; /* Size of first block written to WAL file */ - volatile u32 **apWiData; /* Pointer to wal-index content in memory */ - u32 szPage; /* Database page size */ - i16 readLock; /* Which read lock is being held. -1 for none */ - u8 syncFlags; /* Flags to use to sync header writes */ - u8 exclusiveMode; /* Non-zero if connection is in exclusive mode */ - u8 writeLock; /* True if in a write transaction */ - u8 ckptLock; /* True if holding a checkpoint lock */ - u8 readOnly; /* WAL_RDWR, WAL_RDONLY, or WAL_SHM_RDONLY */ - u8 truncateOnCommit; /* True to truncate WAL file on commit */ - u8 syncHeader; /* Fsync the WAL header if true */ - u8 padToSectorBoundary; /* Pad transactions out to the next sector */ - WalIndexHdr hdr; /* Wal-index header for current transaction */ - const char *zWalName; /* Name of WAL file */ - u32 nCkpt; /* Checkpoint sequence counter in the wal-header */ -#ifdef SQLITE_DEBUG - u8 lockError; /* True if a locking error has occurred */ -#endif -}; - -/* -** Candidate values for Wal.exclusiveMode. -*/ -#define WAL_NORMAL_MODE 0 -#define WAL_EXCLUSIVE_MODE 1 -#define WAL_HEAPMEMORY_MODE 2 - -/* -** Possible values for WAL.readOnly -*/ -#define WAL_RDWR 0 /* Normal read/write connection */ -#define WAL_RDONLY 1 /* The WAL file is readonly */ -#define WAL_SHM_RDONLY 2 /* The SHM file is readonly */ - -/* -** Each page of the wal-index mapping contains a hash-table made up of -** an array of HASHTABLE_NSLOT elements of the following type. -*/ -typedef u16 ht_slot; - -/* -** This structure is used to implement an iterator that loops through -** all frames in the WAL in database page order. Where two or more frames -** correspond to the same database page, the iterator visits only the -** frame most recently written to the WAL (in other words, the frame with -** the largest index). -** -** The internals of this structure are only accessed by: -** -** walIteratorInit() - Create a new iterator, -** walIteratorNext() - Step an iterator, -** walIteratorFree() - Free an iterator. -** -** This functionality is used by the checkpoint code (see walCheckpoint()). -*/ -struct WalIterator { - int iPrior; /* Last result returned from the iterator */ - int nSegment; /* Number of entries in aSegment[] */ - struct WalSegment { - int iNext; /* Next slot in aIndex[] not yet returned */ - ht_slot *aIndex; /* i0, i1, i2... such that aPgno[iN] ascend */ - u32 *aPgno; /* Array of page numbers. */ - int nEntry; /* Nr. of entries in aPgno[] and aIndex[] */ - int iZero; /* Frame number associated with aPgno[0] */ - } aSegment[1]; /* One for every 32KB page in the wal-index */ -}; - -/* -** Define the parameters of the hash tables in the wal-index file. There -** is a hash-table following every HASHTABLE_NPAGE page numbers in the -** wal-index. -** -** Changing any of these constants will alter the wal-index format and -** create incompatibilities. -*/ -#define HASHTABLE_NPAGE 4096 /* Must be power of 2 */ -#define HASHTABLE_HASH_1 383 /* Should be prime */ -#define HASHTABLE_NSLOT (HASHTABLE_NPAGE*2) /* Must be a power of 2 */ - -/* -** The block of page numbers associated with the first hash-table in a -** wal-index is smaller than usual. This is so that there is a complete -** hash-table on each aligned 32KB page of the wal-index. -*/ -#define HASHTABLE_NPAGE_ONE (HASHTABLE_NPAGE - (WALINDEX_HDR_SIZE/sizeof(u32))) - -/* The wal-index is divided into pages of WALINDEX_PGSZ bytes each. */ -#define WALINDEX_PGSZ ( \ - sizeof(ht_slot)*HASHTABLE_NSLOT + HASHTABLE_NPAGE*sizeof(u32) \ -) - -/* -** Obtain a pointer to the iPage'th page of the wal-index. The wal-index -** is broken into pages of WALINDEX_PGSZ bytes. Wal-index pages are -** numbered from zero. -** -** If this call is successful, *ppPage is set to point to the wal-index -** page and SQLITE_OK is returned. If an error (an OOM or VFS error) occurs, -** then an SQLite error code is returned and *ppPage is set to 0. -*/ -static int walIndexPage(Wal *pWal, int iPage, volatile u32 **ppPage){ - int rc = SQLITE_OK; - - /* Enlarge the pWal->apWiData[] array if required */ - if( pWal->nWiData<=iPage ){ - int nByte = sizeof(u32*)*(iPage+1); - volatile u32 **apNew; - apNew = (volatile u32 **)sqlite3_realloc((void *)pWal->apWiData, nByte); - if( !apNew ){ - *ppPage = 0; - return SQLITE_NOMEM; - } - memset((void*)&apNew[pWal->nWiData], 0, - sizeof(u32*)*(iPage+1-pWal->nWiData)); - pWal->apWiData = apNew; - pWal->nWiData = iPage+1; - } - - /* Request a pointer to the required page from the VFS */ - if( pWal->apWiData[iPage]==0 ){ - if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){ - pWal->apWiData[iPage] = (u32 volatile *)sqlite3MallocZero(WALINDEX_PGSZ); - if( !pWal->apWiData[iPage] ) rc = SQLITE_NOMEM; - }else{ - rc = sqlite3OsShmMap(pWal->pDbFd, iPage, WALINDEX_PGSZ, - pWal->writeLock, (void volatile **)&pWal->apWiData[iPage] - ); - if( rc==SQLITE_READONLY ){ - pWal->readOnly |= WAL_SHM_RDONLY; - rc = SQLITE_OK; - } - } - } - - *ppPage = pWal->apWiData[iPage]; - assert( iPage==0 || *ppPage || rc!=SQLITE_OK ); - return rc; -} - -/* -** Return a pointer to the WalCkptInfo structure in the wal-index. -*/ -static volatile WalCkptInfo *walCkptInfo(Wal *pWal){ - assert( pWal->nWiData>0 && pWal->apWiData[0] ); - return (volatile WalCkptInfo*)&(pWal->apWiData[0][sizeof(WalIndexHdr)/2]); -} - -/* -** Return a pointer to the WalIndexHdr structure in the wal-index. -*/ -static volatile WalIndexHdr *walIndexHdr(Wal *pWal){ - assert( pWal->nWiData>0 && pWal->apWiData[0] ); - return (volatile WalIndexHdr*)pWal->apWiData[0]; -} - -/* -** The argument to this macro must be of type u32. On a little-endian -** architecture, it returns the u32 value that results from interpreting -** the 4 bytes as a big-endian value. On a big-endian architecture, it -** returns the value that would be produced by intepreting the 4 bytes -** of the input value as a little-endian integer. -*/ -#define BYTESWAP32(x) ( \ - (((x)&0x000000FF)<<24) + (((x)&0x0000FF00)<<8) \ - + (((x)&0x00FF0000)>>8) + (((x)&0xFF000000)>>24) \ -) - -/* -** Generate or extend an 8 byte checksum based on the data in -** array aByte[] and the initial values of aIn[0] and aIn[1] (or -** initial values of 0 and 0 if aIn==NULL). -** -** The checksum is written back into aOut[] before returning. -** -** nByte must be a positive multiple of 8. -*/ -static void walChecksumBytes( - int nativeCksum, /* True for native byte-order, false for non-native */ - u8 *a, /* Content to be checksummed */ - int nByte, /* Bytes of content in a[]. Must be a multiple of 8. */ - const u32 *aIn, /* Initial checksum value input */ - u32 *aOut /* OUT: Final checksum value output */ -){ - u32 s1, s2; - u32 *aData = (u32 *)a; - u32 *aEnd = (u32 *)&a[nByte]; - - if( aIn ){ - s1 = aIn[0]; - s2 = aIn[1]; - }else{ - s1 = s2 = 0; - } - - assert( nByte>=8 ); - assert( (nByte&0x00000007)==0 ); - - if( nativeCksum ){ - do { - s1 += *aData++ + s2; - s2 += *aData++ + s1; - }while( aDataexclusiveMode!=WAL_HEAPMEMORY_MODE ){ - sqlite3OsShmBarrier(pWal->pDbFd); - } -} - -/* -** Write the header information in pWal->hdr into the wal-index. -** -** The checksum on pWal->hdr is updated before it is written. -*/ -static void walIndexWriteHdr(Wal *pWal){ - volatile WalIndexHdr *aHdr = walIndexHdr(pWal); - const int nCksum = offsetof(WalIndexHdr, aCksum); - - assert( pWal->writeLock ); - pWal->hdr.isInit = 1; - pWal->hdr.iVersion = WALINDEX_MAX_VERSION; - walChecksumBytes(1, (u8*)&pWal->hdr, nCksum, 0, pWal->hdr.aCksum); - memcpy((void *)&aHdr[1], (void *)&pWal->hdr, sizeof(WalIndexHdr)); - walShmBarrier(pWal); - memcpy((void *)&aHdr[0], (void *)&pWal->hdr, sizeof(WalIndexHdr)); -} - -/* -** This function encodes a single frame header and writes it to a buffer -** supplied by the caller. A frame-header is made up of a series of -** 4-byte big-endian integers, as follows: -** -** 0: Page number. -** 4: For commit records, the size of the database image in pages -** after the commit. For all other records, zero. -** 8: Salt-1 (copied from the wal-header) -** 12: Salt-2 (copied from the wal-header) -** 16: Checksum-1. -** 20: Checksum-2. -*/ -static void walEncodeFrame( - Wal *pWal, /* The write-ahead log */ - u32 iPage, /* Database page number for frame */ - u32 nTruncate, /* New db size (or 0 for non-commit frames) */ - u8 *aData, /* Pointer to page data */ - u8 *aFrame /* OUT: Write encoded frame here */ -){ - int nativeCksum; /* True for native byte-order checksums */ - u32 *aCksum = pWal->hdr.aFrameCksum; - assert( WAL_FRAME_HDRSIZE==24 ); - sqlite3Put4byte(&aFrame[0], iPage); - sqlite3Put4byte(&aFrame[4], nTruncate); - memcpy(&aFrame[8], pWal->hdr.aSalt, 8); - - nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN); - walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum); - walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum); - - sqlite3Put4byte(&aFrame[16], aCksum[0]); - sqlite3Put4byte(&aFrame[20], aCksum[1]); -} - -/* -** Check to see if the frame with header in aFrame[] and content -** in aData[] is valid. If it is a valid frame, fill *piPage and -** *pnTruncate and return true. Return if the frame is not valid. -*/ -static int walDecodeFrame( - Wal *pWal, /* The write-ahead log */ - u32 *piPage, /* OUT: Database page number for frame */ - u32 *pnTruncate, /* OUT: New db size (or 0 if not commit) */ - u8 *aData, /* Pointer to page data (for checksum) */ - u8 *aFrame /* Frame data */ -){ - int nativeCksum; /* True for native byte-order checksums */ - u32 *aCksum = pWal->hdr.aFrameCksum; - u32 pgno; /* Page number of the frame */ - assert( WAL_FRAME_HDRSIZE==24 ); - - /* A frame is only valid if the salt values in the frame-header - ** match the salt values in the wal-header. - */ - if( memcmp(&pWal->hdr.aSalt, &aFrame[8], 8)!=0 ){ - return 0; - } - - /* A frame is only valid if the page number is creater than zero. - */ - pgno = sqlite3Get4byte(&aFrame[0]); - if( pgno==0 ){ - return 0; - } - - /* A frame is only valid if a checksum of the WAL header, - ** all prior frams, the first 16 bytes of this frame-header, - ** and the frame-data matches the checksum in the last 8 - ** bytes of this frame-header. - */ - nativeCksum = (pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN); - walChecksumBytes(nativeCksum, aFrame, 8, aCksum, aCksum); - walChecksumBytes(nativeCksum, aData, pWal->szPage, aCksum, aCksum); - if( aCksum[0]!=sqlite3Get4byte(&aFrame[16]) - || aCksum[1]!=sqlite3Get4byte(&aFrame[20]) - ){ - /* Checksum failed. */ - return 0; - } - - /* If we reach this point, the frame is valid. Return the page number - ** and the new database size. - */ - *piPage = pgno; - *pnTruncate = sqlite3Get4byte(&aFrame[4]); - return 1; -} - - -#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) -/* -** Names of locks. This routine is used to provide debugging output and is not -** a part of an ordinary build. -*/ -static const char *walLockName(int lockIdx){ - if( lockIdx==WAL_WRITE_LOCK ){ - return "WRITE-LOCK"; - }else if( lockIdx==WAL_CKPT_LOCK ){ - return "CKPT-LOCK"; - }else if( lockIdx==WAL_RECOVER_LOCK ){ - return "RECOVER-LOCK"; - }else{ - static char zName[15]; - sqlite3_snprintf(sizeof(zName), zName, "READ-LOCK[%d]", - lockIdx-WAL_READ_LOCK(0)); - return zName; - } -} -#endif /*defined(SQLITE_TEST) || defined(SQLITE_DEBUG) */ - - -/* -** Set or release locks on the WAL. Locks are either shared or exclusive. -** A lock cannot be moved directly between shared and exclusive - it must go -** through the unlocked state first. -** -** In locking_mode=EXCLUSIVE, all of these routines become no-ops. -*/ -static int walLockShared(Wal *pWal, int lockIdx){ - int rc; - if( pWal->exclusiveMode ) return SQLITE_OK; - rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1, - SQLITE_SHM_LOCK | SQLITE_SHM_SHARED); - WALTRACE(("WAL%p: acquire SHARED-%s %s\n", pWal, - walLockName(lockIdx), rc ? "failed" : "ok")); - VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); ) - return rc; -} -static void walUnlockShared(Wal *pWal, int lockIdx){ - if( pWal->exclusiveMode ) return; - (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, 1, - SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED); - WALTRACE(("WAL%p: release SHARED-%s\n", pWal, walLockName(lockIdx))); -} -static int walLockExclusive(Wal *pWal, int lockIdx, int n){ - int rc; - if( pWal->exclusiveMode ) return SQLITE_OK; - rc = sqlite3OsShmLock(pWal->pDbFd, lockIdx, n, - SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE); - WALTRACE(("WAL%p: acquire EXCLUSIVE-%s cnt=%d %s\n", pWal, - walLockName(lockIdx), n, rc ? "failed" : "ok")); - VVA_ONLY( pWal->lockError = (u8)(rc!=SQLITE_OK && rc!=SQLITE_BUSY); ) - return rc; -} -static void walUnlockExclusive(Wal *pWal, int lockIdx, int n){ - if( pWal->exclusiveMode ) return; - (void)sqlite3OsShmLock(pWal->pDbFd, lockIdx, n, - SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE); - WALTRACE(("WAL%p: release EXCLUSIVE-%s cnt=%d\n", pWal, - walLockName(lockIdx), n)); -} - -/* -** Compute a hash on a page number. The resulting hash value must land -** between 0 and (HASHTABLE_NSLOT-1). The walHashNext() function advances -** the hash to the next value in the event of a collision. -*/ -static int walHash(u32 iPage){ - assert( iPage>0 ); - assert( (HASHTABLE_NSLOT & (HASHTABLE_NSLOT-1))==0 ); - return (iPage*HASHTABLE_HASH_1) & (HASHTABLE_NSLOT-1); -} -static int walNextHash(int iPriorHash){ - return (iPriorHash+1)&(HASHTABLE_NSLOT-1); -} - -/* -** Return pointers to the hash table and page number array stored on -** page iHash of the wal-index. The wal-index is broken into 32KB pages -** numbered starting from 0. -** -** Set output variable *paHash to point to the start of the hash table -** in the wal-index file. Set *piZero to one less than the frame -** number of the first frame indexed by this hash table. If a -** slot in the hash table is set to N, it refers to frame number -** (*piZero+N) in the log. -** -** Finally, set *paPgno so that *paPgno[1] is the page number of the -** first frame indexed by the hash table, frame (*piZero+1). -*/ -static int walHashGet( - Wal *pWal, /* WAL handle */ - int iHash, /* Find the iHash'th table */ - volatile ht_slot **paHash, /* OUT: Pointer to hash index */ - volatile u32 **paPgno, /* OUT: Pointer to page number array */ - u32 *piZero /* OUT: Frame associated with *paPgno[0] */ -){ - int rc; /* Return code */ - volatile u32 *aPgno; - - rc = walIndexPage(pWal, iHash, &aPgno); - assert( rc==SQLITE_OK || iHash>0 ); - - if( rc==SQLITE_OK ){ - u32 iZero; - volatile ht_slot *aHash; - - aHash = (volatile ht_slot *)&aPgno[HASHTABLE_NPAGE]; - if( iHash==0 ){ - aPgno = &aPgno[WALINDEX_HDR_SIZE/sizeof(u32)]; - iZero = 0; - }else{ - iZero = HASHTABLE_NPAGE_ONE + (iHash-1)*HASHTABLE_NPAGE; - } - - *paPgno = &aPgno[-1]; - *paHash = aHash; - *piZero = iZero; - } - return rc; -} - -/* -** Return the number of the wal-index page that contains the hash-table -** and page-number array that contain entries corresponding to WAL frame -** iFrame. The wal-index is broken up into 32KB pages. Wal-index pages -** are numbered starting from 0. -*/ -static int walFramePage(u32 iFrame){ - int iHash = (iFrame+HASHTABLE_NPAGE-HASHTABLE_NPAGE_ONE-1) / HASHTABLE_NPAGE; - assert( (iHash==0 || iFrame>HASHTABLE_NPAGE_ONE) - && (iHash>=1 || iFrame<=HASHTABLE_NPAGE_ONE) - && (iHash<=1 || iFrame>(HASHTABLE_NPAGE_ONE+HASHTABLE_NPAGE)) - && (iHash>=2 || iFrame<=HASHTABLE_NPAGE_ONE+HASHTABLE_NPAGE) - && (iHash<=2 || iFrame>(HASHTABLE_NPAGE_ONE+2*HASHTABLE_NPAGE)) - ); - return iHash; -} - -/* -** Return the page number associated with frame iFrame in this WAL. -*/ -static u32 walFramePgno(Wal *pWal, u32 iFrame){ - int iHash = walFramePage(iFrame); - if( iHash==0 ){ - return pWal->apWiData[0][WALINDEX_HDR_SIZE/sizeof(u32) + iFrame - 1]; - } - return pWal->apWiData[iHash][(iFrame-1-HASHTABLE_NPAGE_ONE)%HASHTABLE_NPAGE]; -} - -/* -** Remove entries from the hash table that point to WAL slots greater -** than pWal->hdr.mxFrame. -** -** This function is called whenever pWal->hdr.mxFrame is decreased due -** to a rollback or savepoint. -** -** At most only the hash table containing pWal->hdr.mxFrame needs to be -** updated. Any later hash tables will be automatically cleared when -** pWal->hdr.mxFrame advances to the point where those hash tables are -** actually needed. -*/ -static void walCleanupHash(Wal *pWal){ - volatile ht_slot *aHash = 0; /* Pointer to hash table to clear */ - volatile u32 *aPgno = 0; /* Page number array for hash table */ - u32 iZero = 0; /* frame == (aHash[x]+iZero) */ - int iLimit = 0; /* Zero values greater than this */ - int nByte; /* Number of bytes to zero in aPgno[] */ - int i; /* Used to iterate through aHash[] */ - - assert( pWal->writeLock ); - testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE-1 ); - testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE ); - testcase( pWal->hdr.mxFrame==HASHTABLE_NPAGE_ONE+1 ); - - if( pWal->hdr.mxFrame==0 ) return; - - /* Obtain pointers to the hash-table and page-number array containing - ** the entry that corresponds to frame pWal->hdr.mxFrame. It is guaranteed - ** that the page said hash-table and array reside on is already mapped. - */ - assert( pWal->nWiData>walFramePage(pWal->hdr.mxFrame) ); - assert( pWal->apWiData[walFramePage(pWal->hdr.mxFrame)] ); - walHashGet(pWal, walFramePage(pWal->hdr.mxFrame), &aHash, &aPgno, &iZero); - - /* Zero all hash-table entries that correspond to frame numbers greater - ** than pWal->hdr.mxFrame. - */ - iLimit = pWal->hdr.mxFrame - iZero; - assert( iLimit>0 ); - for(i=0; iiLimit ){ - aHash[i] = 0; - } - } - - /* Zero the entries in the aPgno array that correspond to frames with - ** frame numbers greater than pWal->hdr.mxFrame. - */ - nByte = (int)((char *)aHash - (char *)&aPgno[iLimit+1]); - memset((void *)&aPgno[iLimit+1], 0, nByte); - -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT - /* Verify that the every entry in the mapping region is still reachable - ** via the hash table even after the cleanup. - */ - if( iLimit ){ - int i; /* Loop counter */ - int iKey; /* Hash key */ - for(i=1; i<=iLimit; i++){ - for(iKey=walHash(aPgno[i]); aHash[iKey]; iKey=walNextHash(iKey)){ - if( aHash[iKey]==i ) break; - } - assert( aHash[iKey]==i ); - } - } -#endif /* SQLITE_ENABLE_EXPENSIVE_ASSERT */ -} - - -/* -** Set an entry in the wal-index that will map database page number -** pPage into WAL frame iFrame. -*/ -static int walIndexAppend(Wal *pWal, u32 iFrame, u32 iPage){ - int rc; /* Return code */ - u32 iZero = 0; /* One less than frame number of aPgno[1] */ - volatile u32 *aPgno = 0; /* Page number array */ - volatile ht_slot *aHash = 0; /* Hash table */ - - rc = walHashGet(pWal, walFramePage(iFrame), &aHash, &aPgno, &iZero); - - /* Assuming the wal-index file was successfully mapped, populate the - ** page number array and hash table entry. - */ - if( rc==SQLITE_OK ){ - int iKey; /* Hash table key */ - int idx; /* Value to write to hash-table slot */ - int nCollide; /* Number of hash collisions */ - - idx = iFrame - iZero; - assert( idx <= HASHTABLE_NSLOT/2 + 1 ); - - /* If this is the first entry to be added to this hash-table, zero the - ** entire hash table and aPgno[] array before proceding. - */ - if( idx==1 ){ - int nByte = (int)((u8 *)&aHash[HASHTABLE_NSLOT] - (u8 *)&aPgno[1]); - memset((void*)&aPgno[1], 0, nByte); - } - - /* If the entry in aPgno[] is already set, then the previous writer - ** must have exited unexpectedly in the middle of a transaction (after - ** writing one or more dirty pages to the WAL to free up memory). - ** Remove the remnants of that writers uncommitted transaction from - ** the hash-table before writing any new entries. - */ - if( aPgno[idx] ){ - walCleanupHash(pWal); - assert( !aPgno[idx] ); - } - - /* Write the aPgno[] array entry and the hash-table slot. */ - nCollide = idx; - for(iKey=walHash(iPage); aHash[iKey]; iKey=walNextHash(iKey)){ - if( (nCollide--)==0 ) return SQLITE_CORRUPT_BKPT; - } - aPgno[idx] = iPage; - aHash[iKey] = (ht_slot)idx; - -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT - /* Verify that the number of entries in the hash table exactly equals - ** the number of entries in the mapping region. - */ - { - int i; /* Loop counter */ - int nEntry = 0; /* Number of entries in the hash table */ - for(i=0; ickptLock==1 || pWal->ckptLock==0 ); - assert( WAL_ALL_BUT_WRITE==WAL_WRITE_LOCK+1 ); - assert( WAL_CKPT_LOCK==WAL_ALL_BUT_WRITE ); - assert( pWal->writeLock ); - iLock = WAL_ALL_BUT_WRITE + pWal->ckptLock; - nLock = SQLITE_SHM_NLOCK - iLock; - rc = walLockExclusive(pWal, iLock, nLock); - if( rc ){ - return rc; - } - WALTRACE(("WAL%p: recovery begin...\n", pWal)); - - memset(&pWal->hdr, 0, sizeof(WalIndexHdr)); - - rc = sqlite3OsFileSize(pWal->pWalFd, &nSize); - if( rc!=SQLITE_OK ){ - goto recovery_error; - } - - if( nSize>WAL_HDRSIZE ){ - u8 aBuf[WAL_HDRSIZE]; /* Buffer to load WAL header into */ - u8 *aFrame = 0; /* Malloc'd buffer to load entire frame */ - int szFrame; /* Number of bytes in buffer aFrame[] */ - u8 *aData; /* Pointer to data part of aFrame buffer */ - int iFrame; /* Index of last frame read */ - i64 iOffset; /* Next offset to read from log file */ - int szPage; /* Page size according to the log */ - u32 magic; /* Magic value read from WAL header */ - u32 version; /* Magic value read from WAL header */ - int isValid; /* True if this frame is valid */ - - /* Read in the WAL header. */ - rc = sqlite3OsRead(pWal->pWalFd, aBuf, WAL_HDRSIZE, 0); - if( rc!=SQLITE_OK ){ - goto recovery_error; - } - - /* If the database page size is not a power of two, or is greater than - ** SQLITE_MAX_PAGE_SIZE, conclude that the WAL file contains no valid - ** data. Similarly, if the 'magic' value is invalid, ignore the whole - ** WAL file. - */ - magic = sqlite3Get4byte(&aBuf[0]); - szPage = sqlite3Get4byte(&aBuf[8]); - if( (magic&0xFFFFFFFE)!=WAL_MAGIC - || szPage&(szPage-1) - || szPage>SQLITE_MAX_PAGE_SIZE - || szPage<512 - ){ - goto finished; - } - pWal->hdr.bigEndCksum = (u8)(magic&0x00000001); - pWal->szPage = szPage; - pWal->nCkpt = sqlite3Get4byte(&aBuf[12]); - memcpy(&pWal->hdr.aSalt, &aBuf[16], 8); - - /* Verify that the WAL header checksum is correct */ - walChecksumBytes(pWal->hdr.bigEndCksum==SQLITE_BIGENDIAN, - aBuf, WAL_HDRSIZE-2*4, 0, pWal->hdr.aFrameCksum - ); - if( pWal->hdr.aFrameCksum[0]!=sqlite3Get4byte(&aBuf[24]) - || pWal->hdr.aFrameCksum[1]!=sqlite3Get4byte(&aBuf[28]) - ){ - goto finished; - } - - /* Verify that the version number on the WAL format is one that - ** are able to understand */ - version = sqlite3Get4byte(&aBuf[4]); - if( version!=WAL_MAX_VERSION ){ - rc = SQLITE_CANTOPEN_BKPT; - goto finished; - } - - /* Malloc a buffer to read frames into. */ - szFrame = szPage + WAL_FRAME_HDRSIZE; - aFrame = (u8 *)sqlite3_malloc(szFrame); - if( !aFrame ){ - rc = SQLITE_NOMEM; - goto recovery_error; - } - aData = &aFrame[WAL_FRAME_HDRSIZE]; - - /* Read all frames from the log file. */ - iFrame = 0; - for(iOffset=WAL_HDRSIZE; (iOffset+szFrame)<=nSize; iOffset+=szFrame){ - u32 pgno; /* Database page number for frame */ - u32 nTruncate; /* dbsize field from frame header */ - - /* Read and decode the next log frame. */ - iFrame++; - rc = sqlite3OsRead(pWal->pWalFd, aFrame, szFrame, iOffset); - if( rc!=SQLITE_OK ) break; - isValid = walDecodeFrame(pWal, &pgno, &nTruncate, aData, aFrame); - if( !isValid ) break; - rc = walIndexAppend(pWal, iFrame, pgno); - if( rc!=SQLITE_OK ) break; - - /* If nTruncate is non-zero, this is a commit record. */ - if( nTruncate ){ - pWal->hdr.mxFrame = iFrame; - pWal->hdr.nPage = nTruncate; - pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16)); - testcase( szPage<=32768 ); - testcase( szPage>=65536 ); - aFrameCksum[0] = pWal->hdr.aFrameCksum[0]; - aFrameCksum[1] = pWal->hdr.aFrameCksum[1]; - } - } - - sqlite3_free(aFrame); - } - -finished: - if( rc==SQLITE_OK ){ - volatile WalCkptInfo *pInfo; - int i; - pWal->hdr.aFrameCksum[0] = aFrameCksum[0]; - pWal->hdr.aFrameCksum[1] = aFrameCksum[1]; - walIndexWriteHdr(pWal); - - /* Reset the checkpoint-header. This is safe because this thread is - ** currently holding locks that exclude all other readers, writers and - ** checkpointers. - */ - pInfo = walCkptInfo(pWal); - pInfo->nBackfill = 0; - pInfo->aReadMark[0] = 0; - for(i=1; iaReadMark[i] = READMARK_NOT_USED; - if( pWal->hdr.mxFrame ) pInfo->aReadMark[1] = pWal->hdr.mxFrame; - - /* If more than one frame was recovered from the log file, report an - ** event via sqlite3_log(). This is to help with identifying performance - ** problems caused by applications routinely shutting down without - ** checkpointing the log file. - */ - if( pWal->hdr.nPage ){ - sqlite3_log(SQLITE_NOTICE_RECOVER_WAL, - "recovered %d frames from WAL file %s", - pWal->hdr.mxFrame, pWal->zWalName - ); - } - } - -recovery_error: - WALTRACE(("WAL%p: recovery %s\n", pWal, rc ? "failed" : "ok")); - walUnlockExclusive(pWal, iLock, nLock); - return rc; -} - -/* -** Close an open wal-index. -*/ -static void walIndexClose(Wal *pWal, int isDelete){ - if( pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ){ - int i; - for(i=0; inWiData; i++){ - sqlite3_free((void *)pWal->apWiData[i]); - pWal->apWiData[i] = 0; - } - }else{ - sqlite3OsShmUnmap(pWal->pDbFd, isDelete); - } -} - -/* -** Open a connection to the WAL file zWalName. The database file must -** already be opened on connection pDbFd. The buffer that zWalName points -** to must remain valid for the lifetime of the returned Wal* handle. -** -** A SHARED lock should be held on the database file when this function -** is called. The purpose of this SHARED lock is to prevent any other -** client from unlinking the WAL or wal-index file. If another process -** were to do this just after this client opened one of these files, the -** system would be badly broken. -** -** If the log file is successfully opened, SQLITE_OK is returned and -** *ppWal is set to point to a new WAL handle. If an error occurs, -** an SQLite error code is returned and *ppWal is left unmodified. -*/ -SQLITE_PRIVATE int sqlite3WalOpen( - sqlite3_vfs *pVfs, /* vfs module to open wal and wal-index */ - sqlite3_file *pDbFd, /* The open database file */ - const char *zWalName, /* Name of the WAL file */ - int bNoShm, /* True to run in heap-memory mode */ - i64 mxWalSize, /* Truncate WAL to this size on reset */ - Wal **ppWal /* OUT: Allocated Wal handle */ -){ - int rc; /* Return Code */ - Wal *pRet; /* Object to allocate and return */ - int flags; /* Flags passed to OsOpen() */ - - assert( zWalName && zWalName[0] ); - assert( pDbFd ); - - /* In the amalgamation, the os_unix.c and os_win.c source files come before - ** this source file. Verify that the #defines of the locking byte offsets - ** in os_unix.c and os_win.c agree with the WALINDEX_LOCK_OFFSET value. - */ -#ifdef WIN_SHM_BASE - assert( WIN_SHM_BASE==WALINDEX_LOCK_OFFSET ); -#endif -#ifdef UNIX_SHM_BASE - assert( UNIX_SHM_BASE==WALINDEX_LOCK_OFFSET ); -#endif - - - /* Allocate an instance of struct Wal to return. */ - *ppWal = 0; - pRet = (Wal*)sqlite3MallocZero(sizeof(Wal) + pVfs->szOsFile); - if( !pRet ){ - return SQLITE_NOMEM; - } - - pRet->pVfs = pVfs; - pRet->pWalFd = (sqlite3_file *)&pRet[1]; - pRet->pDbFd = pDbFd; - pRet->readLock = -1; - pRet->mxWalSize = mxWalSize; - pRet->zWalName = zWalName; - pRet->syncHeader = 1; - pRet->padToSectorBoundary = 1; - pRet->exclusiveMode = (bNoShm ? WAL_HEAPMEMORY_MODE: WAL_NORMAL_MODE); - - /* Open file handle on the write-ahead log file. */ - flags = (SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE|SQLITE_OPEN_WAL); - rc = sqlite3OsOpen(pVfs, zWalName, pRet->pWalFd, flags, &flags); - if( rc==SQLITE_OK && flags&SQLITE_OPEN_READONLY ){ - pRet->readOnly = WAL_RDONLY; - } - - if( rc!=SQLITE_OK ){ - walIndexClose(pRet, 0); - sqlite3OsClose(pRet->pWalFd); - sqlite3_free(pRet); - }else{ - int iDC = sqlite3OsDeviceCharacteristics(pRet->pWalFd); - if( iDC & SQLITE_IOCAP_SEQUENTIAL ){ pRet->syncHeader = 0; } - if( iDC & SQLITE_IOCAP_POWERSAFE_OVERWRITE ){ - pRet->padToSectorBoundary = 0; - } - *ppWal = pRet; - WALTRACE(("WAL%d: opened\n", pRet)); - } - return rc; -} - -/* -** Change the size to which the WAL file is trucated on each reset. -*/ -SQLITE_PRIVATE void sqlite3WalLimit(Wal *pWal, i64 iLimit){ - if( pWal ) pWal->mxWalSize = iLimit; -} - -/* -** Find the smallest page number out of all pages held in the WAL that -** has not been returned by any prior invocation of this method on the -** same WalIterator object. Write into *piFrame the frame index where -** that page was last written into the WAL. Write into *piPage the page -** number. -** -** Return 0 on success. If there are no pages in the WAL with a page -** number larger than *piPage, then return 1. -*/ -static int walIteratorNext( - WalIterator *p, /* Iterator */ - u32 *piPage, /* OUT: The page number of the next page */ - u32 *piFrame /* OUT: Wal frame index of next page */ -){ - u32 iMin; /* Result pgno must be greater than iMin */ - u32 iRet = 0xFFFFFFFF; /* 0xffffffff is never a valid page number */ - int i; /* For looping through segments */ - - iMin = p->iPrior; - assert( iMin<0xffffffff ); - for(i=p->nSegment-1; i>=0; i--){ - struct WalSegment *pSegment = &p->aSegment[i]; - while( pSegment->iNextnEntry ){ - u32 iPg = pSegment->aPgno[pSegment->aIndex[pSegment->iNext]]; - if( iPg>iMin ){ - if( iPgiZero + pSegment->aIndex[pSegment->iNext]; - } - break; - } - pSegment->iNext++; - } - } - - *piPage = p->iPrior = iRet; - return (iRet==0xFFFFFFFF); -} - -/* -** This function merges two sorted lists into a single sorted list. -** -** aLeft[] and aRight[] are arrays of indices. The sort key is -** aContent[aLeft[]] and aContent[aRight[]]. Upon entry, the following -** is guaranteed for all J0 && nRight>0 ); - while( iRight=nRight || aContent[aLeft[iLeft]]=nLeft || aContent[aLeft[iLeft]]>dbpage ); - assert( iRight>=nRight || aContent[aRight[iRight]]>dbpage ); - } - - *paRight = aLeft; - *pnRight = iOut; - memcpy(aLeft, aTmp, sizeof(aTmp[0])*iOut); -} - -/* -** Sort the elements in list aList using aContent[] as the sort key. -** Remove elements with duplicate keys, preferring to keep the -** larger aList[] values. -** -** The aList[] entries are indices into aContent[]. The values in -** aList[] are to be sorted so that for all J0 ); - assert( HASHTABLE_NPAGE==(1<<(ArraySize(aSub)-1)) ); - - for(iList=0; iListaList && p->nList<=(1<aList==&aList[iList&~((2<aList, p->nList, &aMerge, &nMerge, aBuffer); - } - aSub[iSub].aList = aMerge; - aSub[iSub].nList = nMerge; - } - - for(iSub++; iSubnList<=(1<aList==&aList[nList&~((2<aList, p->nList, &aMerge, &nMerge, aBuffer); - } - } - assert( aMerge==aList ); - *pnList = nMerge; - -#ifdef SQLITE_DEBUG - { - int i; - for(i=1; i<*pnList; i++){ - assert( aContent[aList[i]] > aContent[aList[i-1]] ); - } - } -#endif -} - -/* -** Free an iterator allocated by walIteratorInit(). -*/ -static void walIteratorFree(WalIterator *p){ - sqlite3ScratchFree(p); -} - -/* -** Construct a WalInterator object that can be used to loop over all -** pages in the WAL in ascending order. The caller must hold the checkpoint -** lock. -** -** On success, make *pp point to the newly allocated WalInterator object -** return SQLITE_OK. Otherwise, return an error code. If this routine -** returns an error, the value of *pp is undefined. -** -** The calling routine should invoke walIteratorFree() to destroy the -** WalIterator object when it has finished with it. -*/ -static int walIteratorInit(Wal *pWal, WalIterator **pp){ - WalIterator *p; /* Return value */ - int nSegment; /* Number of segments to merge */ - u32 iLast; /* Last frame in log */ - int nByte; /* Number of bytes to allocate */ - int i; /* Iterator variable */ - ht_slot *aTmp; /* Temp space used by merge-sort */ - int rc = SQLITE_OK; /* Return Code */ - - /* This routine only runs while holding the checkpoint lock. And - ** it only runs if there is actually content in the log (mxFrame>0). - */ - assert( pWal->ckptLock && pWal->hdr.mxFrame>0 ); - iLast = pWal->hdr.mxFrame; - - /* Allocate space for the WalIterator object. */ - nSegment = walFramePage(iLast) + 1; - nByte = sizeof(WalIterator) - + (nSegment-1)*sizeof(struct WalSegment) - + iLast*sizeof(ht_slot); - p = (WalIterator *)sqlite3ScratchMalloc(nByte); - if( !p ){ - return SQLITE_NOMEM; - } - memset(p, 0, nByte); - p->nSegment = nSegment; - - /* Allocate temporary space used by the merge-sort routine. This block - ** of memory will be freed before this function returns. - */ - aTmp = (ht_slot *)sqlite3ScratchMalloc( - sizeof(ht_slot) * (iLast>HASHTABLE_NPAGE?HASHTABLE_NPAGE:iLast) - ); - if( !aTmp ){ - rc = SQLITE_NOMEM; - } - - for(i=0; rc==SQLITE_OK && iaSegment[p->nSegment])[iZero]; - iZero++; - - for(j=0; jaSegment[i].iZero = iZero; - p->aSegment[i].nEntry = nEntry; - p->aSegment[i].aIndex = aIndex; - p->aSegment[i].aPgno = (u32 *)aPgno; - } - } - sqlite3ScratchFree(aTmp); - - if( rc!=SQLITE_OK ){ - walIteratorFree(p); - } - *pp = p; - return rc; -} - -/* -** Attempt to obtain the exclusive WAL lock defined by parameters lockIdx and -** n. If the attempt fails and parameter xBusy is not NULL, then it is a -** busy-handler function. Invoke it and retry the lock until either the -** lock is successfully obtained or the busy-handler returns 0. -*/ -static int walBusyLock( - Wal *pWal, /* WAL connection */ - int (*xBusy)(void*), /* Function to call when busy */ - void *pBusyArg, /* Context argument for xBusyHandler */ - int lockIdx, /* Offset of first byte to lock */ - int n /* Number of bytes to lock */ -){ - int rc; - do { - rc = walLockExclusive(pWal, lockIdx, n); - }while( xBusy && rc==SQLITE_BUSY && xBusy(pBusyArg) ); - return rc; -} - -/* -** The cache of the wal-index header must be valid to call this function. -** Return the page-size in bytes used by the database. -*/ -static int walPagesize(Wal *pWal){ - return (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16); -} - -/* -** Copy as much content as we can from the WAL back into the database file -** in response to an sqlite3_wal_checkpoint() request or the equivalent. -** -** The amount of information copies from WAL to database might be limited -** by active readers. This routine will never overwrite a database page -** that a concurrent reader might be using. -** -** All I/O barrier operations (a.k.a fsyncs) occur in this routine when -** SQLite is in WAL-mode in synchronous=NORMAL. That means that if -** checkpoints are always run by a background thread or background -** process, foreground threads will never block on a lengthy fsync call. -** -** Fsync is called on the WAL before writing content out of the WAL and -** into the database. This ensures that if the new content is persistent -** in the WAL and can be recovered following a power-loss or hard reset. -** -** Fsync is also called on the database file if (and only if) the entire -** WAL content is copied into the database file. This second fsync makes -** it safe to delete the WAL since the new content will persist in the -** database file. -** -** This routine uses and updates the nBackfill field of the wal-index header. -** This is the only routine tha will increase the value of nBackfill. -** (A WAL reset or recovery will revert nBackfill to zero, but not increase -** its value.) -** -** The caller must be holding sufficient locks to ensure that no other -** checkpoint is running (in any other thread or process) at the same -** time. -*/ -static int walCheckpoint( - Wal *pWal, /* Wal connection */ - int eMode, /* One of PASSIVE, FULL or RESTART */ - int (*xBusyCall)(void*), /* Function to call when busy */ - void *pBusyArg, /* Context argument for xBusyHandler */ - int sync_flags, /* Flags for OsSync() (or 0) */ - u8 *zBuf /* Temporary buffer to use */ -){ - int rc; /* Return code */ - int szPage; /* Database page-size */ - WalIterator *pIter = 0; /* Wal iterator context */ - u32 iDbpage = 0; /* Next database page to write */ - u32 iFrame = 0; /* Wal frame containing data for iDbpage */ - u32 mxSafeFrame; /* Max frame that can be backfilled */ - u32 mxPage; /* Max database page to write */ - int i; /* Loop counter */ - volatile WalCkptInfo *pInfo; /* The checkpoint status information */ - int (*xBusy)(void*) = 0; /* Function to call when waiting for locks */ - - szPage = walPagesize(pWal); - testcase( szPage<=32768 ); - testcase( szPage>=65536 ); - pInfo = walCkptInfo(pWal); - if( pInfo->nBackfill>=pWal->hdr.mxFrame ) return SQLITE_OK; - - /* Allocate the iterator */ - rc = walIteratorInit(pWal, &pIter); - if( rc!=SQLITE_OK ){ - return rc; - } - assert( pIter ); - - if( eMode!=SQLITE_CHECKPOINT_PASSIVE ) xBusy = xBusyCall; - - /* Compute in mxSafeFrame the index of the last frame of the WAL that is - ** safe to write into the database. Frames beyond mxSafeFrame might - ** overwrite database pages that are in use by active readers and thus - ** cannot be backfilled from the WAL. - */ - mxSafeFrame = pWal->hdr.mxFrame; - mxPage = pWal->hdr.nPage; - for(i=1; iaReadMark[i]; - if( mxSafeFrame>y ){ - assert( y<=pWal->hdr.mxFrame ); - rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(i), 1); - if( rc==SQLITE_OK ){ - pInfo->aReadMark[i] = (i==1 ? mxSafeFrame : READMARK_NOT_USED); - walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); - }else if( rc==SQLITE_BUSY ){ - mxSafeFrame = y; - xBusy = 0; - }else{ - goto walcheckpoint_out; - } - } - } - - if( pInfo->nBackfillnBackfill; - - /* Sync the WAL to disk */ - if( sync_flags ){ - rc = sqlite3OsSync(pWal->pWalFd, sync_flags); - } - - /* If the database may grow as a result of this checkpoint, hint - ** about the eventual size of the db file to the VFS layer. - */ - if( rc==SQLITE_OK ){ - i64 nReq = ((i64)mxPage * szPage); - rc = sqlite3OsFileSize(pWal->pDbFd, &nSize); - if( rc==SQLITE_OK && nSizepDbFd, SQLITE_FCNTL_SIZE_HINT, &nReq); - } - } - - - /* Iterate through the contents of the WAL, copying data to the db file. */ - while( rc==SQLITE_OK && 0==walIteratorNext(pIter, &iDbpage, &iFrame) ){ - i64 iOffset; - assert( walFramePgno(pWal, iFrame)==iDbpage ); - if( iFrame<=nBackfill || iFrame>mxSafeFrame || iDbpage>mxPage ) continue; - iOffset = walFrameOffset(iFrame, szPage) + WAL_FRAME_HDRSIZE; - /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL file */ - rc = sqlite3OsRead(pWal->pWalFd, zBuf, szPage, iOffset); - if( rc!=SQLITE_OK ) break; - iOffset = (iDbpage-1)*(i64)szPage; - testcase( IS_BIG_INT(iOffset) ); - rc = sqlite3OsWrite(pWal->pDbFd, zBuf, szPage, iOffset); - if( rc!=SQLITE_OK ) break; - } - - /* If work was actually accomplished... */ - if( rc==SQLITE_OK ){ - if( mxSafeFrame==walIndexHdr(pWal)->mxFrame ){ - i64 szDb = pWal->hdr.nPage*(i64)szPage; - testcase( IS_BIG_INT(szDb) ); - rc = sqlite3OsTruncate(pWal->pDbFd, szDb); - if( rc==SQLITE_OK && sync_flags ){ - rc = sqlite3OsSync(pWal->pDbFd, sync_flags); - } - } - if( rc==SQLITE_OK ){ - pInfo->nBackfill = mxSafeFrame; - } - } - - /* Release the reader lock held while backfilling */ - walUnlockExclusive(pWal, WAL_READ_LOCK(0), 1); - } - - if( rc==SQLITE_BUSY ){ - /* Reset the return code so as not to report a checkpoint failure - ** just because there are active readers. */ - rc = SQLITE_OK; - } - - /* If this is an SQLITE_CHECKPOINT_RESTART operation, and the entire wal - ** file has been copied into the database file, then block until all - ** readers have finished using the wal file. This ensures that the next - ** process to write to the database restarts the wal file. - */ - if( rc==SQLITE_OK && eMode!=SQLITE_CHECKPOINT_PASSIVE ){ - assert( pWal->writeLock ); - if( pInfo->nBackfillhdr.mxFrame ){ - rc = SQLITE_BUSY; - }else if( eMode==SQLITE_CHECKPOINT_RESTART ){ - assert( mxSafeFrame==pWal->hdr.mxFrame ); - rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_READ_LOCK(1), WAL_NREADER-1); - if( rc==SQLITE_OK ){ - walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1); - } - } - } - - walcheckpoint_out: - walIteratorFree(pIter); - return rc; -} - -/* -** If the WAL file is currently larger than nMax bytes in size, truncate -** it to exactly nMax bytes. If an error occurs while doing so, ignore it. -*/ -static void walLimitSize(Wal *pWal, i64 nMax){ - i64 sz; - int rx; - sqlite3BeginBenignMalloc(); - rx = sqlite3OsFileSize(pWal->pWalFd, &sz); - if( rx==SQLITE_OK && (sz > nMax ) ){ - rx = sqlite3OsTruncate(pWal->pWalFd, nMax); - } - sqlite3EndBenignMalloc(); - if( rx ){ - sqlite3_log(rx, "cannot limit WAL size: %s", pWal->zWalName); - } -} - -/* -** Close a connection to a log file. -*/ -SQLITE_PRIVATE int sqlite3WalClose( - Wal *pWal, /* Wal to close */ - int sync_flags, /* Flags to pass to OsSync() (or 0) */ - int nBuf, - u8 *zBuf /* Buffer of at least nBuf bytes */ -){ - int rc = SQLITE_OK; - if( pWal ){ - int isDelete = 0; /* True to unlink wal and wal-index files */ - - /* If an EXCLUSIVE lock can be obtained on the database file (using the - ** ordinary, rollback-mode locking methods, this guarantees that the - ** connection associated with this log file is the only connection to - ** the database. In this case checkpoint the database and unlink both - ** the wal and wal-index files. - ** - ** The EXCLUSIVE lock is not released before returning. - */ - rc = sqlite3OsLock(pWal->pDbFd, SQLITE_LOCK_EXCLUSIVE); - if( rc==SQLITE_OK ){ - if( pWal->exclusiveMode==WAL_NORMAL_MODE ){ - pWal->exclusiveMode = WAL_EXCLUSIVE_MODE; - } - rc = sqlite3WalCheckpoint( - pWal, SQLITE_CHECKPOINT_PASSIVE, 0, 0, sync_flags, nBuf, zBuf, 0, 0 - ); - if( rc==SQLITE_OK ){ - int bPersist = -1; - sqlite3OsFileControlHint( - pWal->pDbFd, SQLITE_FCNTL_PERSIST_WAL, &bPersist - ); - if( bPersist!=1 ){ - /* Try to delete the WAL file if the checkpoint completed and - ** fsyned (rc==SQLITE_OK) and if we are not in persistent-wal - ** mode (!bPersist) */ - isDelete = 1; - }else if( pWal->mxWalSize>=0 ){ - /* Try to truncate the WAL file to zero bytes if the checkpoint - ** completed and fsynced (rc==SQLITE_OK) and we are in persistent - ** WAL mode (bPersist) and if the PRAGMA journal_size_limit is a - ** non-negative value (pWal->mxWalSize>=0). Note that we truncate - ** to zero bytes as truncating to the journal_size_limit might - ** leave a corrupt WAL file on disk. */ - walLimitSize(pWal, 0); - } - } - } - - walIndexClose(pWal, isDelete); - sqlite3OsClose(pWal->pWalFd); - if( isDelete ){ - sqlite3BeginBenignMalloc(); - sqlite3OsDelete(pWal->pVfs, pWal->zWalName, 0); - sqlite3EndBenignMalloc(); - } - WALTRACE(("WAL%p: closed\n", pWal)); - sqlite3_free((void *)pWal->apWiData); - sqlite3_free(pWal); - } - return rc; -} - -/* -** Try to read the wal-index header. Return 0 on success and 1 if -** there is a problem. -** -** The wal-index is in shared memory. Another thread or process might -** be writing the header at the same time this procedure is trying to -** read it, which might result in inconsistency. A dirty read is detected -** by verifying that both copies of the header are the same and also by -** a checksum on the header. -** -** If and only if the read is consistent and the header is different from -** pWal->hdr, then pWal->hdr is updated to the content of the new header -** and *pChanged is set to 1. -** -** If the checksum cannot be verified return non-zero. If the header -** is read successfully and the checksum verified, return zero. -*/ -static int walIndexTryHdr(Wal *pWal, int *pChanged){ - u32 aCksum[2]; /* Checksum on the header content */ - WalIndexHdr h1, h2; /* Two copies of the header content */ - WalIndexHdr volatile *aHdr; /* Header in shared memory */ - - /* The first page of the wal-index must be mapped at this point. */ - assert( pWal->nWiData>0 && pWal->apWiData[0] ); - - /* Read the header. This might happen concurrently with a write to the - ** same area of shared memory on a different CPU in a SMP, - ** meaning it is possible that an inconsistent snapshot is read - ** from the file. If this happens, return non-zero. - ** - ** There are two copies of the header at the beginning of the wal-index. - ** When reading, read [0] first then [1]. Writes are in the reverse order. - ** Memory barriers are used to prevent the compiler or the hardware from - ** reordering the reads and writes. - */ - aHdr = walIndexHdr(pWal); - memcpy(&h1, (void *)&aHdr[0], sizeof(h1)); - walShmBarrier(pWal); - memcpy(&h2, (void *)&aHdr[1], sizeof(h2)); - - if( memcmp(&h1, &h2, sizeof(h1))!=0 ){ - return 1; /* Dirty read */ - } - if( h1.isInit==0 ){ - return 1; /* Malformed header - probably all zeros */ - } - walChecksumBytes(1, (u8*)&h1, sizeof(h1)-sizeof(h1.aCksum), 0, aCksum); - if( aCksum[0]!=h1.aCksum[0] || aCksum[1]!=h1.aCksum[1] ){ - return 1; /* Checksum does not match */ - } - - if( memcmp(&pWal->hdr, &h1, sizeof(WalIndexHdr)) ){ - *pChanged = 1; - memcpy(&pWal->hdr, &h1, sizeof(WalIndexHdr)); - pWal->szPage = (pWal->hdr.szPage&0xfe00) + ((pWal->hdr.szPage&0x0001)<<16); - testcase( pWal->szPage<=32768 ); - testcase( pWal->szPage>=65536 ); - } - - /* The header was successfully read. Return zero. */ - return 0; -} - -/* -** Read the wal-index header from the wal-index and into pWal->hdr. -** If the wal-header appears to be corrupt, try to reconstruct the -** wal-index from the WAL before returning. -** -** Set *pChanged to 1 if the wal-index header value in pWal->hdr is -** changed by this opertion. If pWal->hdr is unchanged, set *pChanged -** to 0. -** -** If the wal-index header is successfully read, return SQLITE_OK. -** Otherwise an SQLite error code. -*/ -static int walIndexReadHdr(Wal *pWal, int *pChanged){ - int rc; /* Return code */ - int badHdr; /* True if a header read failed */ - volatile u32 *page0; /* Chunk of wal-index containing header */ - - /* Ensure that page 0 of the wal-index (the page that contains the - ** wal-index header) is mapped. Return early if an error occurs here. - */ - assert( pChanged ); - rc = walIndexPage(pWal, 0, &page0); - if( rc!=SQLITE_OK ){ - return rc; - }; - assert( page0 || pWal->writeLock==0 ); - - /* If the first page of the wal-index has been mapped, try to read the - ** wal-index header immediately, without holding any lock. This usually - ** works, but may fail if the wal-index header is corrupt or currently - ** being modified by another thread or process. - */ - badHdr = (page0 ? walIndexTryHdr(pWal, pChanged) : 1); - - /* If the first attempt failed, it might have been due to a race - ** with a writer. So get a WRITE lock and try again. - */ - assert( badHdr==0 || pWal->writeLock==0 ); - if( badHdr ){ - if( pWal->readOnly & WAL_SHM_RDONLY ){ - if( SQLITE_OK==(rc = walLockShared(pWal, WAL_WRITE_LOCK)) ){ - walUnlockShared(pWal, WAL_WRITE_LOCK); - rc = SQLITE_READONLY_RECOVERY; - } - }else if( SQLITE_OK==(rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1)) ){ - pWal->writeLock = 1; - if( SQLITE_OK==(rc = walIndexPage(pWal, 0, &page0)) ){ - badHdr = walIndexTryHdr(pWal, pChanged); - if( badHdr ){ - /* If the wal-index header is still malformed even while holding - ** a WRITE lock, it can only mean that the header is corrupted and - ** needs to be reconstructed. So run recovery to do exactly that. - */ - rc = walIndexRecover(pWal); - *pChanged = 1; - } - } - pWal->writeLock = 0; - walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1); - } - } - - /* If the header is read successfully, check the version number to make - ** sure the wal-index was not constructed with some future format that - ** this version of SQLite cannot understand. - */ - if( badHdr==0 && pWal->hdr.iVersion!=WALINDEX_MAX_VERSION ){ - rc = SQLITE_CANTOPEN_BKPT; - } - - return rc; -} - -/* -** This is the value that walTryBeginRead returns when it needs to -** be retried. -*/ -#define WAL_RETRY (-1) - -/* -** Attempt to start a read transaction. This might fail due to a race or -** other transient condition. When that happens, it returns WAL_RETRY to -** indicate to the caller that it is safe to retry immediately. -** -** On success return SQLITE_OK. On a permanent failure (such an -** I/O error or an SQLITE_BUSY because another process is running -** recovery) return a positive error code. -** -** The useWal parameter is true to force the use of the WAL and disable -** the case where the WAL is bypassed because it has been completely -** checkpointed. If useWal==0 then this routine calls walIndexReadHdr() -** to make a copy of the wal-index header into pWal->hdr. If the -** wal-index header has changed, *pChanged is set to 1 (as an indication -** to the caller that the local paget cache is obsolete and needs to be -** flushed.) When useWal==1, the wal-index header is assumed to already -** be loaded and the pChanged parameter is unused. -** -** The caller must set the cnt parameter to the number of prior calls to -** this routine during the current read attempt that returned WAL_RETRY. -** This routine will start taking more aggressive measures to clear the -** race conditions after multiple WAL_RETRY returns, and after an excessive -** number of errors will ultimately return SQLITE_PROTOCOL. The -** SQLITE_PROTOCOL return indicates that some other process has gone rogue -** and is not honoring the locking protocol. There is a vanishingly small -** chance that SQLITE_PROTOCOL could be returned because of a run of really -** bad luck when there is lots of contention for the wal-index, but that -** possibility is so small that it can be safely neglected, we believe. -** -** On success, this routine obtains a read lock on -** WAL_READ_LOCK(pWal->readLock). The pWal->readLock integer is -** in the range 0 <= pWal->readLock < WAL_NREADER. If pWal->readLock==(-1) -** that means the Wal does not hold any read lock. The reader must not -** access any database page that is modified by a WAL frame up to and -** including frame number aReadMark[pWal->readLock]. The reader will -** use WAL frames up to and including pWal->hdr.mxFrame if pWal->readLock>0 -** Or if pWal->readLock==0, then the reader will ignore the WAL -** completely and get all content directly from the database file. -** If the useWal parameter is 1 then the WAL will never be ignored and -** this routine will always set pWal->readLock>0 on success. -** When the read transaction is completed, the caller must release the -** lock on WAL_READ_LOCK(pWal->readLock) and set pWal->readLock to -1. -** -** This routine uses the nBackfill and aReadMark[] fields of the header -** to select a particular WAL_READ_LOCK() that strives to let the -** checkpoint process do as much work as possible. This routine might -** update values of the aReadMark[] array in the header, but if it does -** so it takes care to hold an exclusive lock on the corresponding -** WAL_READ_LOCK() while changing values. -*/ -static int walTryBeginRead(Wal *pWal, int *pChanged, int useWal, int cnt){ - volatile WalCkptInfo *pInfo; /* Checkpoint information in wal-index */ - u32 mxReadMark; /* Largest aReadMark[] value */ - int mxI; /* Index of largest aReadMark[] value */ - int i; /* Loop counter */ - int rc = SQLITE_OK; /* Return code */ - - assert( pWal->readLock<0 ); /* Not currently locked */ - - /* Take steps to avoid spinning forever if there is a protocol error. - ** - ** Circumstances that cause a RETRY should only last for the briefest - ** instances of time. No I/O or other system calls are done while the - ** locks are held, so the locks should not be held for very long. But - ** if we are unlucky, another process that is holding a lock might get - ** paged out or take a page-fault that is time-consuming to resolve, - ** during the few nanoseconds that it is holding the lock. In that case, - ** it might take longer than normal for the lock to free. - ** - ** After 5 RETRYs, we begin calling sqlite3OsSleep(). The first few - ** calls to sqlite3OsSleep() have a delay of 1 microsecond. Really this - ** is more of a scheduler yield than an actual delay. But on the 10th - ** an subsequent retries, the delays start becoming longer and longer, - ** so that on the 100th (and last) RETRY we delay for 21 milliseconds. - ** The total delay time before giving up is less than 1 second. - */ - if( cnt>5 ){ - int nDelay = 1; /* Pause time in microseconds */ - if( cnt>100 ){ - VVA_ONLY( pWal->lockError = 1; ) - return SQLITE_PROTOCOL; - } - if( cnt>=10 ) nDelay = (cnt-9)*238; /* Max delay 21ms. Total delay 996ms */ - sqlite3OsSleep(pWal->pVfs, nDelay); - } - - if( !useWal ){ - rc = walIndexReadHdr(pWal, pChanged); - if( rc==SQLITE_BUSY ){ - /* If there is not a recovery running in another thread or process - ** then convert BUSY errors to WAL_RETRY. If recovery is known to - ** be running, convert BUSY to BUSY_RECOVERY. There is a race here - ** which might cause WAL_RETRY to be returned even if BUSY_RECOVERY - ** would be technically correct. But the race is benign since with - ** WAL_RETRY this routine will be called again and will probably be - ** right on the second iteration. - */ - if( pWal->apWiData[0]==0 ){ - /* This branch is taken when the xShmMap() method returns SQLITE_BUSY. - ** We assume this is a transient condition, so return WAL_RETRY. The - ** xShmMap() implementation used by the default unix and win32 VFS - ** modules may return SQLITE_BUSY due to a race condition in the - ** code that determines whether or not the shared-memory region - ** must be zeroed before the requested page is returned. - */ - rc = WAL_RETRY; - }else if( SQLITE_OK==(rc = walLockShared(pWal, WAL_RECOVER_LOCK)) ){ - walUnlockShared(pWal, WAL_RECOVER_LOCK); - rc = WAL_RETRY; - }else if( rc==SQLITE_BUSY ){ - rc = SQLITE_BUSY_RECOVERY; - } - } - if( rc!=SQLITE_OK ){ - return rc; - } - } - - pInfo = walCkptInfo(pWal); - if( !useWal && pInfo->nBackfill==pWal->hdr.mxFrame ){ - /* The WAL has been completely backfilled (or it is empty). - ** and can be safely ignored. - */ - rc = walLockShared(pWal, WAL_READ_LOCK(0)); - walShmBarrier(pWal); - if( rc==SQLITE_OK ){ - if( memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) ){ - /* It is not safe to allow the reader to continue here if frames - ** may have been appended to the log before READ_LOCK(0) was obtained. - ** When holding READ_LOCK(0), the reader ignores the entire log file, - ** which implies that the database file contains a trustworthy - ** snapshoT. Since holding READ_LOCK(0) prevents a checkpoint from - ** happening, this is usually correct. - ** - ** However, if frames have been appended to the log (or if the log - ** is wrapped and written for that matter) before the READ_LOCK(0) - ** is obtained, that is not necessarily true. A checkpointer may - ** have started to backfill the appended frames but crashed before - ** it finished. Leaving a corrupt image in the database file. - */ - walUnlockShared(pWal, WAL_READ_LOCK(0)); - return WAL_RETRY; - } - pWal->readLock = 0; - return SQLITE_OK; - }else if( rc!=SQLITE_BUSY ){ - return rc; - } - } - - /* If we get this far, it means that the reader will want to use - ** the WAL to get at content from recent commits. The job now is - ** to select one of the aReadMark[] entries that is closest to - ** but not exceeding pWal->hdr.mxFrame and lock that entry. - */ - mxReadMark = 0; - mxI = 0; - for(i=1; iaReadMark[i]; - if( mxReadMark<=thisMark && thisMark<=pWal->hdr.mxFrame ){ - assert( thisMark!=READMARK_NOT_USED ); - mxReadMark = thisMark; - mxI = i; - } - } - /* There was once an "if" here. The extra "{" is to preserve indentation. */ - { - if( (pWal->readOnly & WAL_SHM_RDONLY)==0 - && (mxReadMarkhdr.mxFrame || mxI==0) - ){ - for(i=1; iaReadMark[i] = pWal->hdr.mxFrame; - mxI = i; - walUnlockExclusive(pWal, WAL_READ_LOCK(i), 1); - break; - }else if( rc!=SQLITE_BUSY ){ - return rc; - } - } - } - if( mxI==0 ){ - assert( rc==SQLITE_BUSY || (pWal->readOnly & WAL_SHM_RDONLY)!=0 ); - return rc==SQLITE_BUSY ? WAL_RETRY : SQLITE_READONLY_CANTLOCK; - } - - rc = walLockShared(pWal, WAL_READ_LOCK(mxI)); - if( rc ){ - return rc==SQLITE_BUSY ? WAL_RETRY : rc; - } - /* Now that the read-lock has been obtained, check that neither the - ** value in the aReadMark[] array or the contents of the wal-index - ** header have changed. - ** - ** It is necessary to check that the wal-index header did not change - ** between the time it was read and when the shared-lock was obtained - ** on WAL_READ_LOCK(mxI) was obtained to account for the possibility - ** that the log file may have been wrapped by a writer, or that frames - ** that occur later in the log than pWal->hdr.mxFrame may have been - ** copied into the database by a checkpointer. If either of these things - ** happened, then reading the database with the current value of - ** pWal->hdr.mxFrame risks reading a corrupted snapshot. So, retry - ** instead. - ** - ** This does not guarantee that the copy of the wal-index header is up to - ** date before proceeding. That would not be possible without somehow - ** blocking writers. It only guarantees that a dangerous checkpoint or - ** log-wrap (either of which would require an exclusive lock on - ** WAL_READ_LOCK(mxI)) has not occurred since the snapshot was valid. - */ - walShmBarrier(pWal); - if( pInfo->aReadMark[mxI]!=mxReadMark - || memcmp((void *)walIndexHdr(pWal), &pWal->hdr, sizeof(WalIndexHdr)) - ){ - walUnlockShared(pWal, WAL_READ_LOCK(mxI)); - return WAL_RETRY; - }else{ - assert( mxReadMark<=pWal->hdr.mxFrame ); - pWal->readLock = (i16)mxI; - } - } - return rc; -} - -/* -** Begin a read transaction on the database. -** -** This routine used to be called sqlite3OpenSnapshot() and with good reason: -** it takes a snapshot of the state of the WAL and wal-index for the current -** instant in time. The current thread will continue to use this snapshot. -** Other threads might append new content to the WAL and wal-index but -** that extra content is ignored by the current thread. -** -** If the database contents have changes since the previous read -** transaction, then *pChanged is set to 1 before returning. The -** Pager layer will use this to know that is cache is stale and -** needs to be flushed. -*/ -SQLITE_PRIVATE int sqlite3WalBeginReadTransaction(Wal *pWal, int *pChanged){ - int rc; /* Return code */ - int cnt = 0; /* Number of TryBeginRead attempts */ - - do{ - rc = walTryBeginRead(pWal, pChanged, 0, ++cnt); - }while( rc==WAL_RETRY ); - testcase( (rc&0xff)==SQLITE_BUSY ); - testcase( (rc&0xff)==SQLITE_IOERR ); - testcase( rc==SQLITE_PROTOCOL ); - testcase( rc==SQLITE_OK ); - return rc; -} - -/* -** Finish with a read transaction. All this does is release the -** read-lock. -*/ -SQLITE_PRIVATE void sqlite3WalEndReadTransaction(Wal *pWal){ - sqlite3WalEndWriteTransaction(pWal); - if( pWal->readLock>=0 ){ - walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock)); - pWal->readLock = -1; - } -} - -/* -** Search the wal file for page pgno. If found, set *piRead to the frame that -** contains the page. Otherwise, if pgno is not in the wal file, set *piRead -** to zero. -** -** Return SQLITE_OK if successful, or an error code if an error occurs. If an -** error does occur, the final value of *piRead is undefined. -*/ -SQLITE_PRIVATE int sqlite3WalFindFrame( - Wal *pWal, /* WAL handle */ - Pgno pgno, /* Database page number to read data for */ - u32 *piRead /* OUT: Frame number (or zero) */ -){ - u32 iRead = 0; /* If !=0, WAL frame to return data from */ - u32 iLast = pWal->hdr.mxFrame; /* Last page in WAL for this reader */ - int iHash; /* Used to loop through N hash tables */ - - /* This routine is only be called from within a read transaction. */ - assert( pWal->readLock>=0 || pWal->lockError ); - - /* If the "last page" field of the wal-index header snapshot is 0, then - ** no data will be read from the wal under any circumstances. Return early - ** in this case as an optimization. Likewise, if pWal->readLock==0, - ** then the WAL is ignored by the reader so return early, as if the - ** WAL were empty. - */ - if( iLast==0 || pWal->readLock==0 ){ - *piRead = 0; - return SQLITE_OK; - } - - /* Search the hash table or tables for an entry matching page number - ** pgno. Each iteration of the following for() loop searches one - ** hash table (each hash table indexes up to HASHTABLE_NPAGE frames). - ** - ** This code might run concurrently to the code in walIndexAppend() - ** that adds entries to the wal-index (and possibly to this hash - ** table). This means the value just read from the hash - ** slot (aHash[iKey]) may have been added before or after the - ** current read transaction was opened. Values added after the - ** read transaction was opened may have been written incorrectly - - ** i.e. these slots may contain garbage data. However, we assume - ** that any slots written before the current read transaction was - ** opened remain unmodified. - ** - ** For the reasons above, the if(...) condition featured in the inner - ** loop of the following block is more stringent that would be required - ** if we had exclusive access to the hash-table: - ** - ** (aPgno[iFrame]==pgno): - ** This condition filters out normal hash-table collisions. - ** - ** (iFrame<=iLast): - ** This condition filters out entries that were added to the hash - ** table after the current read-transaction had started. - */ - for(iHash=walFramePage(iLast); iHash>=0 && iRead==0; iHash--){ - volatile ht_slot *aHash; /* Pointer to hash table */ - volatile u32 *aPgno; /* Pointer to array of page numbers */ - u32 iZero; /* Frame number corresponding to aPgno[0] */ - int iKey; /* Hash slot index */ - int nCollide; /* Number of hash collisions remaining */ - int rc; /* Error code */ - - rc = walHashGet(pWal, iHash, &aHash, &aPgno, &iZero); - if( rc!=SQLITE_OK ){ - return rc; - } - nCollide = HASHTABLE_NSLOT; - for(iKey=walHash(pgno); aHash[iKey]; iKey=walNextHash(iKey)){ - u32 iFrame = aHash[iKey] + iZero; - if( iFrame<=iLast && aPgno[aHash[iKey]]==pgno ){ - /* assert( iFrame>iRead ); -- not true if there is corruption */ - iRead = iFrame; - } - if( (nCollide--)==0 ){ - return SQLITE_CORRUPT_BKPT; - } - } - } - -#ifdef SQLITE_ENABLE_EXPENSIVE_ASSERT - /* If expensive assert() statements are available, do a linear search - ** of the wal-index file content. Make sure the results agree with the - ** result obtained using the hash indexes above. */ - { - u32 iRead2 = 0; - u32 iTest; - for(iTest=iLast; iTest>0; iTest--){ - if( walFramePgno(pWal, iTest)==pgno ){ - iRead2 = iTest; - break; - } - } - assert( iRead==iRead2 ); - } -#endif - - *piRead = iRead; - return SQLITE_OK; -} - -/* -** Read the contents of frame iRead from the wal file into buffer pOut -** (which is nOut bytes in size). Return SQLITE_OK if successful, or an -** error code otherwise. -*/ -SQLITE_PRIVATE int sqlite3WalReadFrame( - Wal *pWal, /* WAL handle */ - u32 iRead, /* Frame to read */ - int nOut, /* Size of buffer pOut in bytes */ - u8 *pOut /* Buffer to write page data to */ -){ - int sz; - i64 iOffset; - sz = pWal->hdr.szPage; - sz = (sz&0xfe00) + ((sz&0x0001)<<16); - testcase( sz<=32768 ); - testcase( sz>=65536 ); - iOffset = walFrameOffset(iRead, sz) + WAL_FRAME_HDRSIZE; - /* testcase( IS_BIG_INT(iOffset) ); // requires a 4GiB WAL */ - return sqlite3OsRead(pWal->pWalFd, pOut, (nOut>sz ? sz : nOut), iOffset); -} - -/* -** Return the size of the database in pages (or zero, if unknown). -*/ -SQLITE_PRIVATE Pgno sqlite3WalDbsize(Wal *pWal){ - if( pWal && ALWAYS(pWal->readLock>=0) ){ - return pWal->hdr.nPage; - } - return 0; -} - - -/* -** This function starts a write transaction on the WAL. -** -** A read transaction must have already been started by a prior call -** to sqlite3WalBeginReadTransaction(). -** -** If another thread or process has written into the database since -** the read transaction was started, then it is not possible for this -** thread to write as doing so would cause a fork. So this routine -** returns SQLITE_BUSY in that case and no write transaction is started. -** -** There can only be a single writer active at a time. -*/ -SQLITE_PRIVATE int sqlite3WalBeginWriteTransaction(Wal *pWal){ - int rc; - - /* Cannot start a write transaction without first holding a read - ** transaction. */ - assert( pWal->readLock>=0 ); - - if( pWal->readOnly ){ - return SQLITE_READONLY; - } - - /* Only one writer allowed at a time. Get the write lock. Return - ** SQLITE_BUSY if unable. - */ - rc = walLockExclusive(pWal, WAL_WRITE_LOCK, 1); - if( rc ){ - return rc; - } - pWal->writeLock = 1; - - /* If another connection has written to the database file since the - ** time the read transaction on this connection was started, then - ** the write is disallowed. - */ - if( memcmp(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr))!=0 ){ - walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1); - pWal->writeLock = 0; - rc = SQLITE_BUSY_SNAPSHOT; - } - - return rc; -} - -/* -** End a write transaction. The commit has already been done. This -** routine merely releases the lock. -*/ -SQLITE_PRIVATE int sqlite3WalEndWriteTransaction(Wal *pWal){ - if( pWal->writeLock ){ - walUnlockExclusive(pWal, WAL_WRITE_LOCK, 1); - pWal->writeLock = 0; - pWal->truncateOnCommit = 0; - } - return SQLITE_OK; -} - -/* -** If any data has been written (but not committed) to the log file, this -** function moves the write-pointer back to the start of the transaction. -** -** Additionally, the callback function is invoked for each frame written -** to the WAL since the start of the transaction. If the callback returns -** other than SQLITE_OK, it is not invoked again and the error code is -** returned to the caller. -** -** Otherwise, if the callback function does not return an error, this -** function returns SQLITE_OK. -*/ -SQLITE_PRIVATE int sqlite3WalUndo(Wal *pWal, int (*xUndo)(void *, Pgno), void *pUndoCtx){ - int rc = SQLITE_OK; - if( ALWAYS(pWal->writeLock) ){ - Pgno iMax = pWal->hdr.mxFrame; - Pgno iFrame; - - /* Restore the clients cache of the wal-index header to the state it - ** was in before the client began writing to the database. - */ - memcpy(&pWal->hdr, (void *)walIndexHdr(pWal), sizeof(WalIndexHdr)); - - for(iFrame=pWal->hdr.mxFrame+1; - ALWAYS(rc==SQLITE_OK) && iFrame<=iMax; - iFrame++ - ){ - /* This call cannot fail. Unless the page for which the page number - ** is passed as the second argument is (a) in the cache and - ** (b) has an outstanding reference, then xUndo is either a no-op - ** (if (a) is false) or simply expels the page from the cache (if (b) - ** is false). - ** - ** If the upper layer is doing a rollback, it is guaranteed that there - ** are no outstanding references to any page other than page 1. And - ** page 1 is never written to the log until the transaction is - ** committed. As a result, the call to xUndo may not fail. - */ - assert( walFramePgno(pWal, iFrame)!=1 ); - rc = xUndo(pUndoCtx, walFramePgno(pWal, iFrame)); - } - if( iMax!=pWal->hdr.mxFrame ) walCleanupHash(pWal); - } - assert( rc==SQLITE_OK ); - return rc; -} - -/* -** Argument aWalData must point to an array of WAL_SAVEPOINT_NDATA u32 -** values. This function populates the array with values required to -** "rollback" the write position of the WAL handle back to the current -** point in the event of a savepoint rollback (via WalSavepointUndo()). -*/ -SQLITE_PRIVATE void sqlite3WalSavepoint(Wal *pWal, u32 *aWalData){ - assert( pWal->writeLock ); - aWalData[0] = pWal->hdr.mxFrame; - aWalData[1] = pWal->hdr.aFrameCksum[0]; - aWalData[2] = pWal->hdr.aFrameCksum[1]; - aWalData[3] = pWal->nCkpt; -} - -/* -** Move the write position of the WAL back to the point identified by -** the values in the aWalData[] array. aWalData must point to an array -** of WAL_SAVEPOINT_NDATA u32 values that has been previously populated -** by a call to WalSavepoint(). -*/ -SQLITE_PRIVATE int sqlite3WalSavepointUndo(Wal *pWal, u32 *aWalData){ - int rc = SQLITE_OK; - - assert( pWal->writeLock ); - assert( aWalData[3]!=pWal->nCkpt || aWalData[0]<=pWal->hdr.mxFrame ); - - if( aWalData[3]!=pWal->nCkpt ){ - /* This savepoint was opened immediately after the write-transaction - ** was started. Right after that, the writer decided to wrap around - ** to the start of the log. Update the savepoint values to match. - */ - aWalData[0] = 0; - aWalData[3] = pWal->nCkpt; - } - - if( aWalData[0]hdr.mxFrame ){ - pWal->hdr.mxFrame = aWalData[0]; - pWal->hdr.aFrameCksum[0] = aWalData[1]; - pWal->hdr.aFrameCksum[1] = aWalData[2]; - walCleanupHash(pWal); - } - - return rc; -} - - -/* -** This function is called just before writing a set of frames to the log -** file (see sqlite3WalFrames()). It checks to see if, instead of appending -** to the current log file, it is possible to overwrite the start of the -** existing log file with the new frames (i.e. "reset" the log). If so, -** it sets pWal->hdr.mxFrame to 0. Otherwise, pWal->hdr.mxFrame is left -** unchanged. -** -** SQLITE_OK is returned if no error is encountered (regardless of whether -** or not pWal->hdr.mxFrame is modified). An SQLite error code is returned -** if an error occurs. -*/ -static int walRestartLog(Wal *pWal){ - int rc = SQLITE_OK; - int cnt; - - if( pWal->readLock==0 ){ - volatile WalCkptInfo *pInfo = walCkptInfo(pWal); - assert( pInfo->nBackfill==pWal->hdr.mxFrame ); - if( pInfo->nBackfill>0 ){ - u32 salt1; - sqlite3_randomness(4, &salt1); - rc = walLockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1); - if( rc==SQLITE_OK ){ - /* If all readers are using WAL_READ_LOCK(0) (in other words if no - ** readers are currently using the WAL), then the transactions - ** frames will overwrite the start of the existing log. Update the - ** wal-index header to reflect this. - ** - ** In theory it would be Ok to update the cache of the header only - ** at this point. But updating the actual wal-index header is also - ** safe and means there is no special case for sqlite3WalUndo() - ** to handle if this transaction is rolled back. - */ - int i; /* Loop counter */ - u32 *aSalt = pWal->hdr.aSalt; /* Big-endian salt values */ - - pWal->nCkpt++; - pWal->hdr.mxFrame = 0; - sqlite3Put4byte((u8*)&aSalt[0], 1 + sqlite3Get4byte((u8*)&aSalt[0])); - aSalt[1] = salt1; - walIndexWriteHdr(pWal); - pInfo->nBackfill = 0; - pInfo->aReadMark[1] = 0; - for(i=2; iaReadMark[i] = READMARK_NOT_USED; - assert( pInfo->aReadMark[0]==0 ); - walUnlockExclusive(pWal, WAL_READ_LOCK(1), WAL_NREADER-1); - }else if( rc!=SQLITE_BUSY ){ - return rc; - } - } - walUnlockShared(pWal, WAL_READ_LOCK(0)); - pWal->readLock = -1; - cnt = 0; - do{ - int notUsed; - rc = walTryBeginRead(pWal, ¬Used, 1, ++cnt); - }while( rc==WAL_RETRY ); - assert( (rc&0xff)!=SQLITE_BUSY ); /* BUSY not possible when useWal==1 */ - testcase( (rc&0xff)==SQLITE_IOERR ); - testcase( rc==SQLITE_PROTOCOL ); - testcase( rc==SQLITE_OK ); - } - return rc; -} - -/* -** Information about the current state of the WAL file and where -** the next fsync should occur - passed from sqlite3WalFrames() into -** walWriteToLog(). -*/ -typedef struct WalWriter { - Wal *pWal; /* The complete WAL information */ - sqlite3_file *pFd; /* The WAL file to which we write */ - sqlite3_int64 iSyncPoint; /* Fsync at this offset */ - int syncFlags; /* Flags for the fsync */ - int szPage; /* Size of one page */ -} WalWriter; - -/* -** Write iAmt bytes of content into the WAL file beginning at iOffset. -** Do a sync when crossing the p->iSyncPoint boundary. -** -** In other words, if iSyncPoint is in between iOffset and iOffset+iAmt, -** first write the part before iSyncPoint, then sync, then write the -** rest. -*/ -static int walWriteToLog( - WalWriter *p, /* WAL to write to */ - void *pContent, /* Content to be written */ - int iAmt, /* Number of bytes to write */ - sqlite3_int64 iOffset /* Start writing at this offset */ -){ - int rc; - if( iOffsetiSyncPoint && iOffset+iAmt>=p->iSyncPoint ){ - int iFirstAmt = (int)(p->iSyncPoint - iOffset); - rc = sqlite3OsWrite(p->pFd, pContent, iFirstAmt, iOffset); - if( rc ) return rc; - iOffset += iFirstAmt; - iAmt -= iFirstAmt; - pContent = (void*)(iFirstAmt + (char*)pContent); - assert( p->syncFlags & (SQLITE_SYNC_NORMAL|SQLITE_SYNC_FULL) ); - rc = sqlite3OsSync(p->pFd, p->syncFlags); - if( iAmt==0 || rc ) return rc; - } - rc = sqlite3OsWrite(p->pFd, pContent, iAmt, iOffset); - return rc; -} - -/* -** Write out a single frame of the WAL -*/ -static int walWriteOneFrame( - WalWriter *p, /* Where to write the frame */ - PgHdr *pPage, /* The page of the frame to be written */ - int nTruncate, /* The commit flag. Usually 0. >0 for commit */ - sqlite3_int64 iOffset /* Byte offset at which to write */ -){ - int rc; /* Result code from subfunctions */ - void *pData; /* Data actually written */ - u8 aFrame[WAL_FRAME_HDRSIZE]; /* Buffer to assemble frame-header in */ -#if defined(SQLITE_HAS_CODEC) - if( (pData = sqlite3PagerCodec(pPage))==0 ) return SQLITE_NOMEM; -#else - pData = pPage->pData; -#endif - walEncodeFrame(p->pWal, pPage->pgno, nTruncate, pData, aFrame); - rc = walWriteToLog(p, aFrame, sizeof(aFrame), iOffset); - if( rc ) return rc; - /* Write the page data */ - rc = walWriteToLog(p, pData, p->szPage, iOffset+sizeof(aFrame)); - return rc; -} - -/* -** Write a set of frames to the log. The caller must hold the write-lock -** on the log file (obtained using sqlite3WalBeginWriteTransaction()). -*/ -SQLITE_PRIVATE int sqlite3WalFrames( - Wal *pWal, /* Wal handle to write to */ - int szPage, /* Database page-size in bytes */ - PgHdr *pList, /* List of dirty pages to write */ - Pgno nTruncate, /* Database size after this commit */ - int isCommit, /* True if this is a commit */ - int sync_flags /* Flags to pass to OsSync() (or 0) */ -){ - int rc; /* Used to catch return codes */ - u32 iFrame; /* Next frame address */ - PgHdr *p; /* Iterator to run through pList with. */ - PgHdr *pLast = 0; /* Last frame in list */ - int nExtra = 0; /* Number of extra copies of last page */ - int szFrame; /* The size of a single frame */ - i64 iOffset; /* Next byte to write in WAL file */ - WalWriter w; /* The writer */ - - assert( pList ); - assert( pWal->writeLock ); - - /* If this frame set completes a transaction, then nTruncate>0. If - ** nTruncate==0 then this frame set does not complete the transaction. */ - assert( (isCommit!=0)==(nTruncate!=0) ); - -#if defined(SQLITE_TEST) && defined(SQLITE_DEBUG) - { int cnt; for(cnt=0, p=pList; p; p=p->pDirty, cnt++){} - WALTRACE(("WAL%p: frame write begin. %d frames. mxFrame=%d. %s\n", - pWal, cnt, pWal->hdr.mxFrame, isCommit ? "Commit" : "Spill")); - } -#endif - - /* See if it is possible to write these frames into the start of the - ** log file, instead of appending to it at pWal->hdr.mxFrame. - */ - if( SQLITE_OK!=(rc = walRestartLog(pWal)) ){ - return rc; - } - - /* If this is the first frame written into the log, write the WAL - ** header to the start of the WAL file. See comments at the top of - ** this source file for a description of the WAL header format. - */ - iFrame = pWal->hdr.mxFrame; - if( iFrame==0 ){ - u8 aWalHdr[WAL_HDRSIZE]; /* Buffer to assemble wal-header in */ - u32 aCksum[2]; /* Checksum for wal-header */ - - sqlite3Put4byte(&aWalHdr[0], (WAL_MAGIC | SQLITE_BIGENDIAN)); - sqlite3Put4byte(&aWalHdr[4], WAL_MAX_VERSION); - sqlite3Put4byte(&aWalHdr[8], szPage); - sqlite3Put4byte(&aWalHdr[12], pWal->nCkpt); - if( pWal->nCkpt==0 ) sqlite3_randomness(8, pWal->hdr.aSalt); - memcpy(&aWalHdr[16], pWal->hdr.aSalt, 8); - walChecksumBytes(1, aWalHdr, WAL_HDRSIZE-2*4, 0, aCksum); - sqlite3Put4byte(&aWalHdr[24], aCksum[0]); - sqlite3Put4byte(&aWalHdr[28], aCksum[1]); - - pWal->szPage = szPage; - pWal->hdr.bigEndCksum = SQLITE_BIGENDIAN; - pWal->hdr.aFrameCksum[0] = aCksum[0]; - pWal->hdr.aFrameCksum[1] = aCksum[1]; - pWal->truncateOnCommit = 1; - - rc = sqlite3OsWrite(pWal->pWalFd, aWalHdr, sizeof(aWalHdr), 0); - WALTRACE(("WAL%p: wal-header write %s\n", pWal, rc ? "failed" : "ok")); - if( rc!=SQLITE_OK ){ - return rc; - } - - /* Sync the header (unless SQLITE_IOCAP_SEQUENTIAL is true or unless - ** all syncing is turned off by PRAGMA synchronous=OFF). Otherwise - ** an out-of-order write following a WAL restart could result in - ** database corruption. See the ticket: - ** - ** http://localhost:591/sqlite/info/ff5be73dee - */ - if( pWal->syncHeader && sync_flags ){ - rc = sqlite3OsSync(pWal->pWalFd, sync_flags & SQLITE_SYNC_MASK); - if( rc ) return rc; - } - } - assert( (int)pWal->szPage==szPage ); - - /* Setup information needed to write frames into the WAL */ - w.pWal = pWal; - w.pFd = pWal->pWalFd; - w.iSyncPoint = 0; - w.syncFlags = sync_flags; - w.szPage = szPage; - iOffset = walFrameOffset(iFrame+1, szPage); - szFrame = szPage + WAL_FRAME_HDRSIZE; - - /* Write all frames into the log file exactly once */ - for(p=pList; p; p=p->pDirty){ - int nDbSize; /* 0 normally. Positive == commit flag */ - iFrame++; - assert( iOffset==walFrameOffset(iFrame, szPage) ); - nDbSize = (isCommit && p->pDirty==0) ? nTruncate : 0; - rc = walWriteOneFrame(&w, p, nDbSize, iOffset); - if( rc ) return rc; - pLast = p; - iOffset += szFrame; - } - - /* If this is the end of a transaction, then we might need to pad - ** the transaction and/or sync the WAL file. - ** - ** Padding and syncing only occur if this set of frames complete a - ** transaction and if PRAGMA synchronous=FULL. If synchronous==NORMAL - ** or synchonous==OFF, then no padding or syncing are needed. - ** - ** If SQLITE_IOCAP_POWERSAFE_OVERWRITE is defined, then padding is not - ** needed and only the sync is done. If padding is needed, then the - ** final frame is repeated (with its commit mark) until the next sector - ** boundary is crossed. Only the part of the WAL prior to the last - ** sector boundary is synced; the part of the last frame that extends - ** past the sector boundary is written after the sync. - */ - if( isCommit && (sync_flags & WAL_SYNC_TRANSACTIONS)!=0 ){ - if( pWal->padToSectorBoundary ){ - int sectorSize = sqlite3SectorSize(pWal->pWalFd); - w.iSyncPoint = ((iOffset+sectorSize-1)/sectorSize)*sectorSize; - while( iOffsettruncateOnCommit && pWal->mxWalSize>=0 ){ - i64 sz = pWal->mxWalSize; - if( walFrameOffset(iFrame+nExtra+1, szPage)>pWal->mxWalSize ){ - sz = walFrameOffset(iFrame+nExtra+1, szPage); - } - walLimitSize(pWal, sz); - pWal->truncateOnCommit = 0; - } - - /* Append data to the wal-index. It is not necessary to lock the - ** wal-index to do this as the SQLITE_SHM_WRITE lock held on the wal-index - ** guarantees that there are no other writers, and no data that may - ** be in use by existing readers is being overwritten. - */ - iFrame = pWal->hdr.mxFrame; - for(p=pList; p && rc==SQLITE_OK; p=p->pDirty){ - iFrame++; - rc = walIndexAppend(pWal, iFrame, p->pgno); - } - while( rc==SQLITE_OK && nExtra>0 ){ - iFrame++; - nExtra--; - rc = walIndexAppend(pWal, iFrame, pLast->pgno); - } - - if( rc==SQLITE_OK ){ - /* Update the private copy of the header. */ - pWal->hdr.szPage = (u16)((szPage&0xff00) | (szPage>>16)); - testcase( szPage<=32768 ); - testcase( szPage>=65536 ); - pWal->hdr.mxFrame = iFrame; - if( isCommit ){ - pWal->hdr.iChange++; - pWal->hdr.nPage = nTruncate; - } - /* If this is a commit, update the wal-index header too. */ - if( isCommit ){ - walIndexWriteHdr(pWal); - pWal->iCallback = iFrame; - } - } - - WALTRACE(("WAL%p: frame write %s\n", pWal, rc ? "failed" : "ok")); - return rc; -} - -/* -** This routine is called to implement sqlite3_wal_checkpoint() and -** related interfaces. -** -** Obtain a CHECKPOINT lock and then backfill as much information as -** we can from WAL into the database. -** -** If parameter xBusy is not NULL, it is a pointer to a busy-handler -** callback. In this case this function runs a blocking checkpoint. -*/ -SQLITE_PRIVATE int sqlite3WalCheckpoint( - Wal *pWal, /* Wal connection */ - int eMode, /* PASSIVE, FULL or RESTART */ - int (*xBusy)(void*), /* Function to call when busy */ - void *pBusyArg, /* Context argument for xBusyHandler */ - int sync_flags, /* Flags to sync db file with (or 0) */ - int nBuf, /* Size of temporary buffer */ - u8 *zBuf, /* Temporary buffer to use */ - int *pnLog, /* OUT: Number of frames in WAL */ - int *pnCkpt /* OUT: Number of backfilled frames in WAL */ -){ - int rc; /* Return code */ - int isChanged = 0; /* True if a new wal-index header is loaded */ - int eMode2 = eMode; /* Mode to pass to walCheckpoint() */ - - assert( pWal->ckptLock==0 ); - assert( pWal->writeLock==0 ); - - if( pWal->readOnly ) return SQLITE_READONLY; - WALTRACE(("WAL%p: checkpoint begins\n", pWal)); - rc = walLockExclusive(pWal, WAL_CKPT_LOCK, 1); - if( rc ){ - /* Usually this is SQLITE_BUSY meaning that another thread or process - ** is already running a checkpoint, or maybe a recovery. But it might - ** also be SQLITE_IOERR. */ - return rc; - } - pWal->ckptLock = 1; - - /* If this is a blocking-checkpoint, then obtain the write-lock as well - ** to prevent any writers from running while the checkpoint is underway. - ** This has to be done before the call to walIndexReadHdr() below. - ** - ** If the writer lock cannot be obtained, then a passive checkpoint is - ** run instead. Since the checkpointer is not holding the writer lock, - ** there is no point in blocking waiting for any readers. Assuming no - ** other error occurs, this function will return SQLITE_BUSY to the caller. - */ - if( eMode!=SQLITE_CHECKPOINT_PASSIVE ){ - rc = walBusyLock(pWal, xBusy, pBusyArg, WAL_WRITE_LOCK, 1); - if( rc==SQLITE_OK ){ - pWal->writeLock = 1; - }else if( rc==SQLITE_BUSY ){ - eMode2 = SQLITE_CHECKPOINT_PASSIVE; - rc = SQLITE_OK; - } - } - - /* Read the wal-index header. */ - if( rc==SQLITE_OK ){ - rc = walIndexReadHdr(pWal, &isChanged); - if( isChanged && pWal->pDbFd->pMethods->iVersion>=3 ){ - sqlite3OsUnfetch(pWal->pDbFd, 0, 0); - } - } - - /* Copy data from the log to the database file. */ - if( rc==SQLITE_OK ){ - if( pWal->hdr.mxFrame && walPagesize(pWal)!=nBuf ){ - rc = SQLITE_CORRUPT_BKPT; - }else{ - rc = walCheckpoint(pWal, eMode2, xBusy, pBusyArg, sync_flags, zBuf); - } - - /* If no error occurred, set the output variables. */ - if( rc==SQLITE_OK || rc==SQLITE_BUSY ){ - if( pnLog ) *pnLog = (int)pWal->hdr.mxFrame; - if( pnCkpt ) *pnCkpt = (int)(walCkptInfo(pWal)->nBackfill); - } - } - - if( isChanged ){ - /* If a new wal-index header was loaded before the checkpoint was - ** performed, then the pager-cache associated with pWal is now - ** out of date. So zero the cached wal-index header to ensure that - ** next time the pager opens a snapshot on this database it knows that - ** the cache needs to be reset. - */ - memset(&pWal->hdr, 0, sizeof(WalIndexHdr)); - } - - /* Release the locks. */ - sqlite3WalEndWriteTransaction(pWal); - walUnlockExclusive(pWal, WAL_CKPT_LOCK, 1); - pWal->ckptLock = 0; - WALTRACE(("WAL%p: checkpoint %s\n", pWal, rc ? "failed" : "ok")); - return (rc==SQLITE_OK && eMode!=eMode2 ? SQLITE_BUSY : rc); -} - -/* Return the value to pass to a sqlite3_wal_hook callback, the -** number of frames in the WAL at the point of the last commit since -** sqlite3WalCallback() was called. If no commits have occurred since -** the last call, then return 0. -*/ -SQLITE_PRIVATE int sqlite3WalCallback(Wal *pWal){ - u32 ret = 0; - if( pWal ){ - ret = pWal->iCallback; - pWal->iCallback = 0; - } - return (int)ret; -} - -/* -** This function is called to change the WAL subsystem into or out -** of locking_mode=EXCLUSIVE. -** -** If op is zero, then attempt to change from locking_mode=EXCLUSIVE -** into locking_mode=NORMAL. This means that we must acquire a lock -** on the pWal->readLock byte. If the WAL is already in locking_mode=NORMAL -** or if the acquisition of the lock fails, then return 0. If the -** transition out of exclusive-mode is successful, return 1. This -** operation must occur while the pager is still holding the exclusive -** lock on the main database file. -** -** If op is one, then change from locking_mode=NORMAL into -** locking_mode=EXCLUSIVE. This means that the pWal->readLock must -** be released. Return 1 if the transition is made and 0 if the -** WAL is already in exclusive-locking mode - meaning that this -** routine is a no-op. The pager must already hold the exclusive lock -** on the main database file before invoking this operation. -** -** If op is negative, then do a dry-run of the op==1 case but do -** not actually change anything. The pager uses this to see if it -** should acquire the database exclusive lock prior to invoking -** the op==1 case. -*/ -SQLITE_PRIVATE int sqlite3WalExclusiveMode(Wal *pWal, int op){ - int rc; - assert( pWal->writeLock==0 ); - assert( pWal->exclusiveMode!=WAL_HEAPMEMORY_MODE || op==-1 ); - - /* pWal->readLock is usually set, but might be -1 if there was a - ** prior error while attempting to acquire are read-lock. This cannot - ** happen if the connection is actually in exclusive mode (as no xShmLock - ** locks are taken in this case). Nor should the pager attempt to - ** upgrade to exclusive-mode following such an error. - */ - assert( pWal->readLock>=0 || pWal->lockError ); - assert( pWal->readLock>=0 || (op<=0 && pWal->exclusiveMode==0) ); - - if( op==0 ){ - if( pWal->exclusiveMode ){ - pWal->exclusiveMode = 0; - if( walLockShared(pWal, WAL_READ_LOCK(pWal->readLock))!=SQLITE_OK ){ - pWal->exclusiveMode = 1; - } - rc = pWal->exclusiveMode==0; - }else{ - /* Already in locking_mode=NORMAL */ - rc = 0; - } - }else if( op>0 ){ - assert( pWal->exclusiveMode==0 ); - assert( pWal->readLock>=0 ); - walUnlockShared(pWal, WAL_READ_LOCK(pWal->readLock)); - pWal->exclusiveMode = 1; - rc = 1; - }else{ - rc = pWal->exclusiveMode==0; - } - return rc; -} - -/* -** Return true if the argument is non-NULL and the WAL module is using -** heap-memory for the wal-index. Otherwise, if the argument is NULL or the -** WAL module is using shared-memory, return false. -*/ -SQLITE_PRIVATE int sqlite3WalHeapMemory(Wal *pWal){ - return (pWal && pWal->exclusiveMode==WAL_HEAPMEMORY_MODE ); -} - -#ifdef SQLITE_ENABLE_ZIPVFS -/* -** If the argument is not NULL, it points to a Wal object that holds a -** read-lock. This function returns the database page-size if it is known, -** or zero if it is not (or if pWal is NULL). -*/ -SQLITE_PRIVATE int sqlite3WalFramesize(Wal *pWal){ - assert( pWal==0 || pWal->readLock>=0 ); - return (pWal ? pWal->szPage : 0); -} -#endif - -#endif /* #ifndef SQLITE_OMIT_WAL */ - -/************** End of wal.c *************************************************/ -/************** Begin file btmutex.c *****************************************/ -/* -** 2007 August 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains code used to implement mutexes on Btree objects. -** This code really belongs in btree.c. But btree.c is getting too -** big and we want to break it down some. This packaged seemed like -** a good breakout. -*/ -/************** Include btreeInt.h in the middle of btmutex.c ****************/ -/************** Begin file btreeInt.h ****************************************/ -/* -** 2004 April 6 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file implements a external (disk-based) database using BTrees. -** For a detailed discussion of BTrees, refer to -** -** Donald E. Knuth, THE ART OF COMPUTER PROGRAMMING, Volume 3: -** "Sorting And Searching", pages 473-480. Addison-Wesley -** Publishing Company, Reading, Massachusetts. -** -** The basic idea is that each page of the file contains N database -** entries and N+1 pointers to subpages. -** -** ---------------------------------------------------------------- -** | Ptr(0) | Key(0) | Ptr(1) | Key(1) | ... | Key(N-1) | Ptr(N) | -** ---------------------------------------------------------------- -** -** All of the keys on the page that Ptr(0) points to have values less -** than Key(0). All of the keys on page Ptr(1) and its subpages have -** values greater than Key(0) and less than Key(1). All of the keys -** on Ptr(N) and its subpages have values greater than Key(N-1). And -** so forth. -** -** Finding a particular key requires reading O(log(M)) pages from the -** disk where M is the number of entries in the tree. -** -** In this implementation, a single file can hold one or more separate -** BTrees. Each BTree is identified by the index of its root page. The -** key and data for any entry are combined to form the "payload". A -** fixed amount of payload can be carried directly on the database -** page. If the payload is larger than the preset amount then surplus -** bytes are stored on overflow pages. The payload for an entry -** and the preceding pointer are combined to form a "Cell". Each -** page has a small header which contains the Ptr(N) pointer and other -** information such as the size of key and data. -** -** FORMAT DETAILS -** -** The file is divided into pages. The first page is called page 1, -** the second is page 2, and so forth. A page number of zero indicates -** "no such page". The page size can be any power of 2 between 512 and 65536. -** Each page can be either a btree page, a freelist page, an overflow -** page, or a pointer-map page. -** -** The first page is always a btree page. The first 100 bytes of the first -** page contain a special header (the "file header") that describes the file. -** The format of the file header is as follows: -** -** OFFSET SIZE DESCRIPTION -** 0 16 Header string: "SQLite format 3\000" -** 16 2 Page size in bytes. (1 means 65536) -** 18 1 File format write version -** 19 1 File format read version -** 20 1 Bytes of unused space at the end of each page -** 21 1 Max embedded payload fraction (must be 64) -** 22 1 Min embedded payload fraction (must be 32) -** 23 1 Min leaf payload fraction (must be 32) -** 24 4 File change counter -** 28 4 Reserved for future use -** 32 4 First freelist page -** 36 4 Number of freelist pages in the file -** 40 60 15 4-byte meta values passed to higher layers -** -** 40 4 Schema cookie -** 44 4 File format of schema layer -** 48 4 Size of page cache -** 52 4 Largest root-page (auto/incr_vacuum) -** 56 4 1=UTF-8 2=UTF16le 3=UTF16be -** 60 4 User version -** 64 4 Incremental vacuum mode -** 68 4 Application-ID -** 72 20 unused -** 92 4 The version-valid-for number -** 96 4 SQLITE_VERSION_NUMBER -** -** All of the integer values are big-endian (most significant byte first). -** -** The file change counter is incremented when the database is changed -** This counter allows other processes to know when the file has changed -** and thus when they need to flush their cache. -** -** The max embedded payload fraction is the amount of the total usable -** space in a page that can be consumed by a single cell for standard -** B-tree (non-LEAFDATA) tables. A value of 255 means 100%. The default -** is to limit the maximum cell size so that at least 4 cells will fit -** on one page. Thus the default max embedded payload fraction is 64. -** -** If the payload for a cell is larger than the max payload, then extra -** payload is spilled to overflow pages. Once an overflow page is allocated, -** as many bytes as possible are moved into the overflow pages without letting -** the cell size drop below the min embedded payload fraction. -** -** The min leaf payload fraction is like the min embedded payload fraction -** except that it applies to leaf nodes in a LEAFDATA tree. The maximum -** payload fraction for a LEAFDATA tree is always 100% (or 255) and it -** not specified in the header. -** -** Each btree pages is divided into three sections: The header, the -** cell pointer array, and the cell content area. Page 1 also has a 100-byte -** file header that occurs before the page header. -** -** |----------------| -** | file header | 100 bytes. Page 1 only. -** |----------------| -** | page header | 8 bytes for leaves. 12 bytes for interior nodes -** |----------------| -** | cell pointer | | 2 bytes per cell. Sorted order. -** | array | | Grows downward -** | | v -** |----------------| -** | unallocated | -** | space | -** |----------------| ^ Grows upwards -** | cell content | | Arbitrary order interspersed with freeblocks. -** | area | | and free space fragments. -** |----------------| -** -** The page headers looks like this: -** -** OFFSET SIZE DESCRIPTION -** 0 1 Flags. 1: intkey, 2: zerodata, 4: leafdata, 8: leaf -** 1 2 byte offset to the first freeblock -** 3 2 number of cells on this page -** 5 2 first byte of the cell content area -** 7 1 number of fragmented free bytes -** 8 4 Right child (the Ptr(N) value). Omitted on leaves. -** -** The flags define the format of this btree page. The leaf flag means that -** this page has no children. The zerodata flag means that this page carries -** only keys and no data. The intkey flag means that the key is a integer -** which is stored in the key size entry of the cell header rather than in -** the payload area. -** -** The cell pointer array begins on the first byte after the page header. -** The cell pointer array contains zero or more 2-byte numbers which are -** offsets from the beginning of the page to the cell content in the cell -** content area. The cell pointers occur in sorted order. The system strives -** to keep free space after the last cell pointer so that new cells can -** be easily added without having to defragment the page. -** -** Cell content is stored at the very end of the page and grows toward the -** beginning of the page. -** -** Unused space within the cell content area is collected into a linked list of -** freeblocks. Each freeblock is at least 4 bytes in size. The byte offset -** to the first freeblock is given in the header. Freeblocks occur in -** increasing order. Because a freeblock must be at least 4 bytes in size, -** any group of 3 or fewer unused bytes in the cell content area cannot -** exist on the freeblock chain. A group of 3 or fewer free bytes is called -** a fragment. The total number of bytes in all fragments is recorded. -** in the page header at offset 7. -** -** SIZE DESCRIPTION -** 2 Byte offset of the next freeblock -** 2 Bytes in this freeblock -** -** Cells are of variable length. Cells are stored in the cell content area at -** the end of the page. Pointers to the cells are in the cell pointer array -** that immediately follows the page header. Cells is not necessarily -** contiguous or in order, but cell pointers are contiguous and in order. -** -** Cell content makes use of variable length integers. A variable -** length integer is 1 to 9 bytes where the lower 7 bits of each -** byte are used. The integer consists of all bytes that have bit 8 set and -** the first byte with bit 8 clear. The most significant byte of the integer -** appears first. A variable-length integer may not be more than 9 bytes long. -** As a special case, all 8 bytes of the 9th byte are used as data. This -** allows a 64-bit integer to be encoded in 9 bytes. -** -** 0x00 becomes 0x00000000 -** 0x7f becomes 0x0000007f -** 0x81 0x00 becomes 0x00000080 -** 0x82 0x00 becomes 0x00000100 -** 0x80 0x7f becomes 0x0000007f -** 0x8a 0x91 0xd1 0xac 0x78 becomes 0x12345678 -** 0x81 0x81 0x81 0x81 0x01 becomes 0x10204081 -** -** Variable length integers are used for rowids and to hold the number of -** bytes of key and data in a btree cell. -** -** The content of a cell looks like this: -** -** SIZE DESCRIPTION -** 4 Page number of the left child. Omitted if leaf flag is set. -** var Number of bytes of data. Omitted if the zerodata flag is set. -** var Number of bytes of key. Or the key itself if intkey flag is set. -** * Payload -** 4 First page of the overflow chain. Omitted if no overflow -** -** Overflow pages form a linked list. Each page except the last is completely -** filled with data (pagesize - 4 bytes). The last page can have as little -** as 1 byte of data. -** -** SIZE DESCRIPTION -** 4 Page number of next overflow page -** * Data -** -** Freelist pages come in two subtypes: trunk pages and leaf pages. The -** file header points to the first in a linked list of trunk page. Each trunk -** page points to multiple leaf pages. The content of a leaf page is -** unspecified. A trunk page looks like this: -** -** SIZE DESCRIPTION -** 4 Page number of next trunk page -** 4 Number of leaf pointers on this page -** * zero or more pages numbers of leaves -*/ - - -/* The following value is the maximum cell size assuming a maximum page -** size give above. -*/ -#define MX_CELL_SIZE(pBt) ((int)(pBt->pageSize-8)) - -/* The maximum number of cells on a single page of the database. This -** assumes a minimum cell size of 6 bytes (4 bytes for the cell itself -** plus 2 bytes for the index to the cell in the page header). Such -** small cells will be rare, but they are possible. -*/ -#define MX_CELL(pBt) ((pBt->pageSize-8)/6) - -/* Forward declarations */ -typedef struct MemPage MemPage; -typedef struct BtLock BtLock; - -/* -** This is a magic string that appears at the beginning of every -** SQLite database in order to identify the file as a real database. -** -** You can change this value at compile-time by specifying a -** -DSQLITE_FILE_HEADER="..." on the compiler command-line. The -** header must be exactly 16 bytes including the zero-terminator so -** the string itself should be 15 characters long. If you change -** the header, then your custom library will not be able to read -** databases generated by the standard tools and the standard tools -** will not be able to read databases created by your custom library. -*/ -#ifndef SQLITE_FILE_HEADER /* 123456789 123456 */ -# define SQLITE_FILE_HEADER "SQLite format 3" -#endif - -/* -** Page type flags. An ORed combination of these flags appear as the -** first byte of on-disk image of every BTree page. -*/ -#define PTF_INTKEY 0x01 -#define PTF_ZERODATA 0x02 -#define PTF_LEAFDATA 0x04 -#define PTF_LEAF 0x08 - -/* -** As each page of the file is loaded into memory, an instance of the following -** structure is appended and initialized to zero. This structure stores -** information about the page that is decoded from the raw file page. -** -** The pParent field points back to the parent page. This allows us to -** walk up the BTree from any leaf to the root. Care must be taken to -** unref() the parent page pointer when this page is no longer referenced. -** The pageDestructor() routine handles that chore. -** -** Access to all fields of this structure is controlled by the mutex -** stored in MemPage.pBt->mutex. -*/ -struct MemPage { - u8 isInit; /* True if previously initialized. MUST BE FIRST! */ - u8 nOverflow; /* Number of overflow cell bodies in aCell[] */ - u8 intKey; /* True if intkey flag is set */ - u8 leaf; /* True if leaf flag is set */ - u8 hasData; /* True if this page stores data */ - u8 hdrOffset; /* 100 for page 1. 0 otherwise */ - u8 childPtrSize; /* 0 if leaf==1. 4 if leaf==0 */ - u8 max1bytePayload; /* min(maxLocal,127) */ - u16 maxLocal; /* Copy of BtShared.maxLocal or BtShared.maxLeaf */ - u16 minLocal; /* Copy of BtShared.minLocal or BtShared.minLeaf */ - u16 cellOffset; /* Index in aData of first cell pointer */ - u16 nFree; /* Number of free bytes on the page */ - u16 nCell; /* Number of cells on this page, local and ovfl */ - u16 maskPage; /* Mask for page offset */ - u16 aiOvfl[5]; /* Insert the i-th overflow cell before the aiOvfl-th - ** non-overflow cell */ - u8 *apOvfl[5]; /* Pointers to the body of overflow cells */ - BtShared *pBt; /* Pointer to BtShared that this page is part of */ - u8 *aData; /* Pointer to disk image of the page data */ - u8 *aDataEnd; /* One byte past the end of usable data */ - u8 *aCellIdx; /* The cell index area */ - DbPage *pDbPage; /* Pager page handle */ - Pgno pgno; /* Page number for this page */ -}; - -/* -** The in-memory image of a disk page has the auxiliary information appended -** to the end. EXTRA_SIZE is the number of bytes of space needed to hold -** that extra information. -*/ -#define EXTRA_SIZE sizeof(MemPage) - -/* -** A linked list of the following structures is stored at BtShared.pLock. -** Locks are added (or upgraded from READ_LOCK to WRITE_LOCK) when a cursor -** is opened on the table with root page BtShared.iTable. Locks are removed -** from this list when a transaction is committed or rolled back, or when -** a btree handle is closed. -*/ -struct BtLock { - Btree *pBtree; /* Btree handle holding this lock */ - Pgno iTable; /* Root page of table */ - u8 eLock; /* READ_LOCK or WRITE_LOCK */ - BtLock *pNext; /* Next in BtShared.pLock list */ -}; - -/* Candidate values for BtLock.eLock */ -#define READ_LOCK 1 -#define WRITE_LOCK 2 - -/* A Btree handle -** -** A database connection contains a pointer to an instance of -** this object for every database file that it has open. This structure -** is opaque to the database connection. The database connection cannot -** see the internals of this structure and only deals with pointers to -** this structure. -** -** For some database files, the same underlying database cache might be -** shared between multiple connections. In that case, each connection -** has it own instance of this object. But each instance of this object -** points to the same BtShared object. The database cache and the -** schema associated with the database file are all contained within -** the BtShared object. -** -** All fields in this structure are accessed under sqlite3.mutex. -** The pBt pointer itself may not be changed while there exists cursors -** in the referenced BtShared that point back to this Btree since those -** cursors have to go through this Btree to find their BtShared and -** they often do so without holding sqlite3.mutex. -*/ -struct Btree { - sqlite3 *db; /* The database connection holding this btree */ - BtShared *pBt; /* Sharable content of this btree */ - u8 inTrans; /* TRANS_NONE, TRANS_READ or TRANS_WRITE */ - u8 sharable; /* True if we can share pBt with another db */ - u8 locked; /* True if db currently has pBt locked */ - int wantToLock; /* Number of nested calls to sqlite3BtreeEnter() */ - int nBackup; /* Number of backup operations reading this btree */ - Btree *pNext; /* List of other sharable Btrees from the same db */ - Btree *pPrev; /* Back pointer of the same list */ -#ifndef SQLITE_OMIT_SHARED_CACHE - BtLock lock; /* Object used to lock page 1 */ -#endif -}; - -/* -** Btree.inTrans may take one of the following values. -** -** If the shared-data extension is enabled, there may be multiple users -** of the Btree structure. At most one of these may open a write transaction, -** but any number may have active read transactions. -*/ -#define TRANS_NONE 0 -#define TRANS_READ 1 -#define TRANS_WRITE 2 - -/* -** An instance of this object represents a single database file. -** -** A single database file can be in use at the same time by two -** or more database connections. When two or more connections are -** sharing the same database file, each connection has it own -** private Btree object for the file and each of those Btrees points -** to this one BtShared object. BtShared.nRef is the number of -** connections currently sharing this database file. -** -** Fields in this structure are accessed under the BtShared.mutex -** mutex, except for nRef and pNext which are accessed under the -** global SQLITE_MUTEX_STATIC_MASTER mutex. The pPager field -** may not be modified once it is initially set as long as nRef>0. -** The pSchema field may be set once under BtShared.mutex and -** thereafter is unchanged as long as nRef>0. -** -** isPending: -** -** If a BtShared client fails to obtain a write-lock on a database -** table (because there exists one or more read-locks on the table), -** the shared-cache enters 'pending-lock' state and isPending is -** set to true. -** -** The shared-cache leaves the 'pending lock' state when either of -** the following occur: -** -** 1) The current writer (BtShared.pWriter) concludes its transaction, OR -** 2) The number of locks held by other connections drops to zero. -** -** while in the 'pending-lock' state, no connection may start a new -** transaction. -** -** This feature is included to help prevent writer-starvation. -*/ -struct BtShared { - Pager *pPager; /* The page cache */ - sqlite3 *db; /* Database connection currently using this Btree */ - BtCursor *pCursor; /* A list of all open cursors */ - MemPage *pPage1; /* First page of the database */ - u8 openFlags; /* Flags to sqlite3BtreeOpen() */ -#ifndef SQLITE_OMIT_AUTOVACUUM - u8 autoVacuum; /* True if auto-vacuum is enabled */ - u8 incrVacuum; /* True if incr-vacuum is enabled */ - u8 bDoTruncate; /* True to truncate db on commit */ -#endif - u8 inTransaction; /* Transaction state */ - u8 max1bytePayload; /* Maximum first byte of cell for a 1-byte payload */ - u16 btsFlags; /* Boolean parameters. See BTS_* macros below */ - u16 maxLocal; /* Maximum local payload in non-LEAFDATA tables */ - u16 minLocal; /* Minimum local payload in non-LEAFDATA tables */ - u16 maxLeaf; /* Maximum local payload in a LEAFDATA table */ - u16 minLeaf; /* Minimum local payload in a LEAFDATA table */ - u32 pageSize; /* Total number of bytes on a page */ - u32 usableSize; /* Number of usable bytes on each page */ - int nTransaction; /* Number of open transactions (read + write) */ - u32 nPage; /* Number of pages in the database */ - void *pSchema; /* Pointer to space allocated by sqlite3BtreeSchema() */ - void (*xFreeSchema)(void*); /* Destructor for BtShared.pSchema */ - sqlite3_mutex *mutex; /* Non-recursive mutex required to access this object */ - Bitvec *pHasContent; /* Set of pages moved to free-list this transaction */ -#ifndef SQLITE_OMIT_SHARED_CACHE - int nRef; /* Number of references to this structure */ - BtShared *pNext; /* Next on a list of sharable BtShared structs */ - BtLock *pLock; /* List of locks held on this shared-btree struct */ - Btree *pWriter; /* Btree with currently open write transaction */ -#endif - u8 *pTmpSpace; /* BtShared.pageSize bytes of space for tmp use */ -}; - -/* -** Allowed values for BtShared.btsFlags -*/ -#define BTS_READ_ONLY 0x0001 /* Underlying file is readonly */ -#define BTS_PAGESIZE_FIXED 0x0002 /* Page size can no longer be changed */ -#define BTS_SECURE_DELETE 0x0004 /* PRAGMA secure_delete is enabled */ -#define BTS_INITIALLY_EMPTY 0x0008 /* Database was empty at trans start */ -#define BTS_NO_WAL 0x0010 /* Do not open write-ahead-log files */ -#define BTS_EXCLUSIVE 0x0020 /* pWriter has an exclusive lock */ -#define BTS_PENDING 0x0040 /* Waiting for read-locks to clear */ - -/* -** An instance of the following structure is used to hold information -** about a cell. The parseCellPtr() function fills in this structure -** based on information extract from the raw disk page. -*/ -typedef struct CellInfo CellInfo; -struct CellInfo { - i64 nKey; /* The key for INTKEY tables, or number of bytes in key */ - u8 *pCell; /* Pointer to the start of cell content */ - u32 nData; /* Number of bytes of data */ - u32 nPayload; /* Total amount of payload */ - u16 nHeader; /* Size of the cell content header in bytes */ - u16 nLocal; /* Amount of payload held locally */ - u16 iOverflow; /* Offset to overflow page number. Zero if no overflow */ - u16 nSize; /* Size of the cell content on the main b-tree page */ -}; - -/* -** Maximum depth of an SQLite B-Tree structure. Any B-Tree deeper than -** this will be declared corrupt. This value is calculated based on a -** maximum database size of 2^31 pages a minimum fanout of 2 for a -** root-node and 3 for all other internal nodes. -** -** If a tree that appears to be taller than this is encountered, it is -** assumed that the database is corrupt. -*/ -#define BTCURSOR_MAX_DEPTH 20 - -/* -** A cursor is a pointer to a particular entry within a particular -** b-tree within a database file. -** -** The entry is identified by its MemPage and the index in -** MemPage.aCell[] of the entry. -** -** A single database file can be shared by two more database connections, -** but cursors cannot be shared. Each cursor is associated with a -** particular database connection identified BtCursor.pBtree.db. -** -** Fields in this structure are accessed under the BtShared.mutex -** found at self->pBt->mutex. -*/ -struct BtCursor { - Btree *pBtree; /* The Btree to which this cursor belongs */ - BtShared *pBt; /* The BtShared this cursor points to */ - BtCursor *pNext, *pPrev; /* Forms a linked list of all cursors */ - struct KeyInfo *pKeyInfo; /* Argument passed to comparison function */ -#ifndef SQLITE_OMIT_INCRBLOB - Pgno *aOverflow; /* Cache of overflow page locations */ -#endif - Pgno pgnoRoot; /* The root page of this tree */ - sqlite3_int64 cachedRowid; /* Next rowid cache. 0 means not valid */ - CellInfo info; /* A parse of the cell we are pointing at */ - i64 nKey; /* Size of pKey, or last integer key */ - void *pKey; /* Saved key that was cursor's last known position */ - int skipNext; /* Prev() is noop if negative. Next() is noop if positive */ - u8 wrFlag; /* True if writable */ - u8 atLast; /* Cursor pointing to the last entry */ - u8 validNKey; /* True if info.nKey is valid */ - u8 eState; /* One of the CURSOR_XXX constants (see below) */ -#ifndef SQLITE_OMIT_INCRBLOB - u8 isIncrblobHandle; /* True if this cursor is an incr. io handle */ -#endif - u8 hints; /* As configured by CursorSetHints() */ - i16 iPage; /* Index of current page in apPage */ - u16 aiIdx[BTCURSOR_MAX_DEPTH]; /* Current index in apPage[i] */ - MemPage *apPage[BTCURSOR_MAX_DEPTH]; /* Pages from root to current page */ -}; - -/* -** Potential values for BtCursor.eState. -** -** CURSOR_INVALID: -** Cursor does not point to a valid entry. This can happen (for example) -** because the table is empty or because BtreeCursorFirst() has not been -** called. -** -** CURSOR_VALID: -** Cursor points to a valid entry. getPayload() etc. may be called. -** -** CURSOR_SKIPNEXT: -** Cursor is valid except that the Cursor.skipNext field is non-zero -** indicating that the next sqlite3BtreeNext() or sqlite3BtreePrevious() -** operation should be a no-op. -** -** CURSOR_REQUIRESEEK: -** The table that this cursor was opened on still exists, but has been -** modified since the cursor was last used. The cursor position is saved -** in variables BtCursor.pKey and BtCursor.nKey. When a cursor is in -** this state, restoreCursorPosition() can be called to attempt to -** seek the cursor to the saved position. -** -** CURSOR_FAULT: -** A unrecoverable error (an I/O error or a malloc failure) has occurred -** on a different connection that shares the BtShared cache with this -** cursor. The error has left the cache in an inconsistent state. -** Do nothing else with this cursor. Any attempt to use the cursor -** should return the error code stored in BtCursor.skip -*/ -#define CURSOR_INVALID 0 -#define CURSOR_VALID 1 -#define CURSOR_SKIPNEXT 2 -#define CURSOR_REQUIRESEEK 3 -#define CURSOR_FAULT 4 - -/* -** The database page the PENDING_BYTE occupies. This page is never used. -*/ -# define PENDING_BYTE_PAGE(pBt) PAGER_MJ_PGNO(pBt) - -/* -** These macros define the location of the pointer-map entry for a -** database page. The first argument to each is the number of usable -** bytes on each page of the database (often 1024). The second is the -** page number to look up in the pointer map. -** -** PTRMAP_PAGENO returns the database page number of the pointer-map -** page that stores the required pointer. PTRMAP_PTROFFSET returns -** the offset of the requested map entry. -** -** If the pgno argument passed to PTRMAP_PAGENO is a pointer-map page, -** then pgno is returned. So (pgno==PTRMAP_PAGENO(pgsz, pgno)) can be -** used to test if pgno is a pointer-map page. PTRMAP_ISPAGE implements -** this test. -*/ -#define PTRMAP_PAGENO(pBt, pgno) ptrmapPageno(pBt, pgno) -#define PTRMAP_PTROFFSET(pgptrmap, pgno) (5*(pgno-pgptrmap-1)) -#define PTRMAP_ISPAGE(pBt, pgno) (PTRMAP_PAGENO((pBt),(pgno))==(pgno)) - -/* -** The pointer map is a lookup table that identifies the parent page for -** each child page in the database file. The parent page is the page that -** contains a pointer to the child. Every page in the database contains -** 0 or 1 parent pages. (In this context 'database page' refers -** to any page that is not part of the pointer map itself.) Each pointer map -** entry consists of a single byte 'type' and a 4 byte parent page number. -** The PTRMAP_XXX identifiers below are the valid types. -** -** The purpose of the pointer map is to facility moving pages from one -** position in the file to another as part of autovacuum. When a page -** is moved, the pointer in its parent must be updated to point to the -** new location. The pointer map is used to locate the parent page quickly. -** -** PTRMAP_ROOTPAGE: The database page is a root-page. The page-number is not -** used in this case. -** -** PTRMAP_FREEPAGE: The database page is an unused (free) page. The page-number -** is not used in this case. -** -** PTRMAP_OVERFLOW1: The database page is the first page in a list of -** overflow pages. The page number identifies the page that -** contains the cell with a pointer to this overflow page. -** -** PTRMAP_OVERFLOW2: The database page is the second or later page in a list of -** overflow pages. The page-number identifies the previous -** page in the overflow page list. -** -** PTRMAP_BTREE: The database page is a non-root btree page. The page number -** identifies the parent page in the btree. -*/ -#define PTRMAP_ROOTPAGE 1 -#define PTRMAP_FREEPAGE 2 -#define PTRMAP_OVERFLOW1 3 -#define PTRMAP_OVERFLOW2 4 -#define PTRMAP_BTREE 5 - -/* A bunch of assert() statements to check the transaction state variables -** of handle p (type Btree*) are internally consistent. -*/ -#define btreeIntegrity(p) \ - assert( p->pBt->inTransaction!=TRANS_NONE || p->pBt->nTransaction==0 ); \ - assert( p->pBt->inTransaction>=p->inTrans ); - - -/* -** The ISAUTOVACUUM macro is used within balance_nonroot() to determine -** if the database supports auto-vacuum or not. Because it is used -** within an expression that is an argument to another macro -** (sqliteMallocRaw), it is not possible to use conditional compilation. -** So, this macro is defined instead. -*/ -#ifndef SQLITE_OMIT_AUTOVACUUM -#define ISAUTOVACUUM (pBt->autoVacuum) -#else -#define ISAUTOVACUUM 0 -#endif - - -/* -** This structure is passed around through all the sanity checking routines -** in order to keep track of some global state information. -** -** The aRef[] array is allocated so that there is 1 bit for each page in -** the database. As the integrity-check proceeds, for each page used in -** the database the corresponding bit is set. This allows integrity-check to -** detect pages that are used twice and orphaned pages (both of which -** indicate corruption). -*/ -typedef struct IntegrityCk IntegrityCk; -struct IntegrityCk { - BtShared *pBt; /* The tree being checked out */ - Pager *pPager; /* The associated pager. Also accessible by pBt->pPager */ - u8 *aPgRef; /* 1 bit per page in the db (see above) */ - Pgno nPage; /* Number of pages in the database */ - int mxErr; /* Stop accumulating errors when this reaches zero */ - int nErr; /* Number of messages written to zErrMsg so far */ - int mallocFailed; /* A memory allocation error has occurred */ - StrAccum errMsg; /* Accumulate the error message text here */ -}; - -/* -** Routines to read or write a two- and four-byte big-endian integer values. -*/ -#define get2byte(x) ((x)[0]<<8 | (x)[1]) -#define put2byte(p,v) ((p)[0] = (u8)((v)>>8), (p)[1] = (u8)(v)) -#define get4byte sqlite3Get4byte -#define put4byte sqlite3Put4byte - -/************** End of btreeInt.h ********************************************/ -/************** Continuing where we left off in btmutex.c ********************/ -#ifndef SQLITE_OMIT_SHARED_CACHE -#if SQLITE_THREADSAFE - -/* -** Obtain the BtShared mutex associated with B-Tree handle p. Also, -** set BtShared.db to the database handle associated with p and the -** p->locked boolean to true. -*/ -static void lockBtreeMutex(Btree *p){ - assert( p->locked==0 ); - assert( sqlite3_mutex_notheld(p->pBt->mutex) ); - assert( sqlite3_mutex_held(p->db->mutex) ); - - sqlite3_mutex_enter(p->pBt->mutex); - p->pBt->db = p->db; - p->locked = 1; -} - -/* -** Release the BtShared mutex associated with B-Tree handle p and -** clear the p->locked boolean. -*/ -static void unlockBtreeMutex(Btree *p){ - BtShared *pBt = p->pBt; - assert( p->locked==1 ); - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( sqlite3_mutex_held(p->db->mutex) ); - assert( p->db==pBt->db ); - - sqlite3_mutex_leave(pBt->mutex); - p->locked = 0; -} - -/* -** Enter a mutex on the given BTree object. -** -** If the object is not sharable, then no mutex is ever required -** and this routine is a no-op. The underlying mutex is non-recursive. -** But we keep a reference count in Btree.wantToLock so the behavior -** of this interface is recursive. -** -** To avoid deadlocks, multiple Btrees are locked in the same order -** by all database connections. The p->pNext is a list of other -** Btrees belonging to the same database connection as the p Btree -** which need to be locked after p. If we cannot get a lock on -** p, then first unlock all of the others on p->pNext, then wait -** for the lock to become available on p, then relock all of the -** subsequent Btrees that desire a lock. -*/ -SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){ - Btree *pLater; - - /* Some basic sanity checking on the Btree. The list of Btrees - ** connected by pNext and pPrev should be in sorted order by - ** Btree.pBt value. All elements of the list should belong to - ** the same connection. Only shared Btrees are on the list. */ - assert( p->pNext==0 || p->pNext->pBt>p->pBt ); - assert( p->pPrev==0 || p->pPrev->pBtpBt ); - assert( p->pNext==0 || p->pNext->db==p->db ); - assert( p->pPrev==0 || p->pPrev->db==p->db ); - assert( p->sharable || (p->pNext==0 && p->pPrev==0) ); - - /* Check for locking consistency */ - assert( !p->locked || p->wantToLock>0 ); - assert( p->sharable || p->wantToLock==0 ); - - /* We should already hold a lock on the database connection */ - assert( sqlite3_mutex_held(p->db->mutex) ); - - /* Unless the database is sharable and unlocked, then BtShared.db - ** should already be set correctly. */ - assert( (p->locked==0 && p->sharable) || p->pBt->db==p->db ); - - if( !p->sharable ) return; - p->wantToLock++; - if( p->locked ) return; - - /* In most cases, we should be able to acquire the lock we - ** want without having to go throught the ascending lock - ** procedure that follows. Just be sure not to block. - */ - if( sqlite3_mutex_try(p->pBt->mutex)==SQLITE_OK ){ - p->pBt->db = p->db; - p->locked = 1; - return; - } - - /* To avoid deadlock, first release all locks with a larger - ** BtShared address. Then acquire our lock. Then reacquire - ** the other BtShared locks that we used to hold in ascending - ** order. - */ - for(pLater=p->pNext; pLater; pLater=pLater->pNext){ - assert( pLater->sharable ); - assert( pLater->pNext==0 || pLater->pNext->pBt>pLater->pBt ); - assert( !pLater->locked || pLater->wantToLock>0 ); - if( pLater->locked ){ - unlockBtreeMutex(pLater); - } - } - lockBtreeMutex(p); - for(pLater=p->pNext; pLater; pLater=pLater->pNext){ - if( pLater->wantToLock ){ - lockBtreeMutex(pLater); - } - } -} - -/* -** Exit the recursive mutex on a Btree. -*/ -SQLITE_PRIVATE void sqlite3BtreeLeave(Btree *p){ - if( p->sharable ){ - assert( p->wantToLock>0 ); - p->wantToLock--; - if( p->wantToLock==0 ){ - unlockBtreeMutex(p); - } - } -} - -#ifndef NDEBUG -/* -** Return true if the BtShared mutex is held on the btree, or if the -** B-Tree is not marked as sharable. -** -** This routine is used only from within assert() statements. -*/ -SQLITE_PRIVATE int sqlite3BtreeHoldsMutex(Btree *p){ - assert( p->sharable==0 || p->locked==0 || p->wantToLock>0 ); - assert( p->sharable==0 || p->locked==0 || p->db==p->pBt->db ); - assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->pBt->mutex) ); - assert( p->sharable==0 || p->locked==0 || sqlite3_mutex_held(p->db->mutex) ); - - return (p->sharable==0 || p->locked); -} -#endif - - -#ifndef SQLITE_OMIT_INCRBLOB -/* -** Enter and leave a mutex on a Btree given a cursor owned by that -** Btree. These entry points are used by incremental I/O and can be -** omitted if that module is not used. -*/ -SQLITE_PRIVATE void sqlite3BtreeEnterCursor(BtCursor *pCur){ - sqlite3BtreeEnter(pCur->pBtree); -} -SQLITE_PRIVATE void sqlite3BtreeLeaveCursor(BtCursor *pCur){ - sqlite3BtreeLeave(pCur->pBtree); -} -#endif /* SQLITE_OMIT_INCRBLOB */ - - -/* -** Enter the mutex on every Btree associated with a database -** connection. This is needed (for example) prior to parsing -** a statement since we will be comparing table and column names -** against all schemas and we do not want those schemas being -** reset out from under us. -** -** There is a corresponding leave-all procedures. -** -** Enter the mutexes in accending order by BtShared pointer address -** to avoid the possibility of deadlock when two threads with -** two or more btrees in common both try to lock all their btrees -** at the same instant. -*/ -SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){ - int i; - Btree *p; - assert( sqlite3_mutex_held(db->mutex) ); - for(i=0; inDb; i++){ - p = db->aDb[i].pBt; - if( p ) sqlite3BtreeEnter(p); - } -} -SQLITE_PRIVATE void sqlite3BtreeLeaveAll(sqlite3 *db){ - int i; - Btree *p; - assert( sqlite3_mutex_held(db->mutex) ); - for(i=0; inDb; i++){ - p = db->aDb[i].pBt; - if( p ) sqlite3BtreeLeave(p); - } -} - -/* -** Return true if a particular Btree requires a lock. Return FALSE if -** no lock is ever required since it is not sharable. -*/ -SQLITE_PRIVATE int sqlite3BtreeSharable(Btree *p){ - return p->sharable; -} - -#ifndef NDEBUG -/* -** Return true if the current thread holds the database connection -** mutex and all required BtShared mutexes. -** -** This routine is used inside assert() statements only. -*/ -SQLITE_PRIVATE int sqlite3BtreeHoldsAllMutexes(sqlite3 *db){ - int i; - if( !sqlite3_mutex_held(db->mutex) ){ - return 0; - } - for(i=0; inDb; i++){ - Btree *p; - p = db->aDb[i].pBt; - if( p && p->sharable && - (p->wantToLock==0 || !sqlite3_mutex_held(p->pBt->mutex)) ){ - return 0; - } - } - return 1; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* -** Return true if the correct mutexes are held for accessing the -** db->aDb[iDb].pSchema structure. The mutexes required for schema -** access are: -** -** (1) The mutex on db -** (2) if iDb!=1, then the mutex on db->aDb[iDb].pBt. -** -** If pSchema is not NULL, then iDb is computed from pSchema and -** db using sqlite3SchemaToIndex(). -*/ -SQLITE_PRIVATE int sqlite3SchemaMutexHeld(sqlite3 *db, int iDb, Schema *pSchema){ - Btree *p; - assert( db!=0 ); - if( pSchema ) iDb = sqlite3SchemaToIndex(db, pSchema); - assert( iDb>=0 && iDbnDb ); - if( !sqlite3_mutex_held(db->mutex) ) return 0; - if( iDb==1 ) return 1; - p = db->aDb[iDb].pBt; - assert( p!=0 ); - return p->sharable==0 || p->locked==1; -} -#endif /* NDEBUG */ - -#else /* SQLITE_THREADSAFE>0 above. SQLITE_THREADSAFE==0 below */ -/* -** The following are special cases for mutex enter routines for use -** in single threaded applications that use shared cache. Except for -** these two routines, all mutex operations are no-ops in that case and -** are null #defines in btree.h. -** -** If shared cache is disabled, then all btree mutex routines, including -** the ones below, are no-ops and are null #defines in btree.h. -*/ - -SQLITE_PRIVATE void sqlite3BtreeEnter(Btree *p){ - p->pBt->db = p->db; -} -SQLITE_PRIVATE void sqlite3BtreeEnterAll(sqlite3 *db){ - int i; - for(i=0; inDb; i++){ - Btree *p = db->aDb[i].pBt; - if( p ){ - p->pBt->db = p->db; - } - } -} -#endif /* if SQLITE_THREADSAFE */ -#endif /* ifndef SQLITE_OMIT_SHARED_CACHE */ - -/************** End of btmutex.c *********************************************/ -/************** Begin file btree.c *******************************************/ -/* -** 2004 April 6 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file implements a external (disk-based) database using BTrees. -** See the header comment on "btreeInt.h" for additional information. -** Including a description of file format and an overview of operation. -*/ - -/* -** The header string that appears at the beginning of every -** SQLite database. -*/ -static const char zMagicHeader[] = SQLITE_FILE_HEADER; - -/* -** Set this global variable to 1 to enable tracing using the TRACE -** macro. -*/ -#if 0 -int sqlite3BtreeTrace=1; /* True to enable tracing */ -# define TRACE(X) if(sqlite3BtreeTrace){printf X;fflush(stdout);} -#else -# define TRACE(X) -#endif - -/* -** Extract a 2-byte big-endian integer from an array of unsigned bytes. -** But if the value is zero, make it 65536. -** -** This routine is used to extract the "offset to cell content area" value -** from the header of a btree page. If the page size is 65536 and the page -** is empty, the offset should be 65536, but the 2-byte value stores zero. -** This routine makes the necessary adjustment to 65536. -*/ -#define get2byteNotZero(X) (((((int)get2byte(X))-1)&0xffff)+1) - -/* -** Values passed as the 5th argument to allocateBtreePage() -*/ -#define BTALLOC_ANY 0 /* Allocate any page */ -#define BTALLOC_EXACT 1 /* Allocate exact page if possible */ -#define BTALLOC_LE 2 /* Allocate any page <= the parameter */ - -/* -** Macro IfNotOmitAV(x) returns (x) if SQLITE_OMIT_AUTOVACUUM is not -** defined, or 0 if it is. For example: -** -** bIncrVacuum = IfNotOmitAV(pBtShared->incrVacuum); -*/ -#ifndef SQLITE_OMIT_AUTOVACUUM -#define IfNotOmitAV(expr) (expr) -#else -#define IfNotOmitAV(expr) 0 -#endif - -#ifndef SQLITE_OMIT_SHARED_CACHE -/* -** A list of BtShared objects that are eligible for participation -** in shared cache. This variable has file scope during normal builds, -** but the test harness needs to access it so we make it global for -** test builds. -** -** Access to this variable is protected by SQLITE_MUTEX_STATIC_MASTER. -*/ -#ifdef SQLITE_TEST -SQLITE_PRIVATE BtShared *SQLITE_WSD sqlite3SharedCacheList = 0; -#else -static BtShared *SQLITE_WSD sqlite3SharedCacheList = 0; -#endif -#endif /* SQLITE_OMIT_SHARED_CACHE */ - -#ifndef SQLITE_OMIT_SHARED_CACHE -/* -** Enable or disable the shared pager and schema features. -** -** This routine has no effect on existing database connections. -** The shared cache setting effects only future calls to -** sqlite3_open(), sqlite3_open16(), or sqlite3_open_v2(). -*/ -SQLITE_API int sqlite3_enable_shared_cache(int enable){ - sqlite3GlobalConfig.sharedCacheEnabled = enable; - return SQLITE_OK; -} -#endif - - - -#ifdef SQLITE_OMIT_SHARED_CACHE - /* - ** The functions querySharedCacheTableLock(), setSharedCacheTableLock(), - ** and clearAllSharedCacheTableLocks() - ** manipulate entries in the BtShared.pLock linked list used to store - ** shared-cache table level locks. If the library is compiled with the - ** shared-cache feature disabled, then there is only ever one user - ** of each BtShared structure and so this locking is not necessary. - ** So define the lock related functions as no-ops. - */ - #define querySharedCacheTableLock(a,b,c) SQLITE_OK - #define setSharedCacheTableLock(a,b,c) SQLITE_OK - #define clearAllSharedCacheTableLocks(a) - #define downgradeAllSharedCacheTableLocks(a) - #define hasSharedCacheTableLock(a,b,c,d) 1 - #define hasReadConflicts(a, b) 0 -#endif - -#ifndef SQLITE_OMIT_SHARED_CACHE - -#ifdef SQLITE_DEBUG -/* -**** This function is only used as part of an assert() statement. *** -** -** Check to see if pBtree holds the required locks to read or write to the -** table with root page iRoot. Return 1 if it does and 0 if not. -** -** For example, when writing to a table with root-page iRoot via -** Btree connection pBtree: -** -** assert( hasSharedCacheTableLock(pBtree, iRoot, 0, WRITE_LOCK) ); -** -** When writing to an index that resides in a sharable database, the -** caller should have first obtained a lock specifying the root page of -** the corresponding table. This makes things a bit more complicated, -** as this module treats each table as a separate structure. To determine -** the table corresponding to the index being written, this -** function has to search through the database schema. -** -** Instead of a lock on the table/index rooted at page iRoot, the caller may -** hold a write-lock on the schema table (root page 1). This is also -** acceptable. -*/ -static int hasSharedCacheTableLock( - Btree *pBtree, /* Handle that must hold lock */ - Pgno iRoot, /* Root page of b-tree */ - int isIndex, /* True if iRoot is the root of an index b-tree */ - int eLockType /* Required lock type (READ_LOCK or WRITE_LOCK) */ -){ - Schema *pSchema = (Schema *)pBtree->pBt->pSchema; - Pgno iTab = 0; - BtLock *pLock; - - /* If this database is not shareable, or if the client is reading - ** and has the read-uncommitted flag set, then no lock is required. - ** Return true immediately. - */ - if( (pBtree->sharable==0) - || (eLockType==READ_LOCK && (pBtree->db->flags & SQLITE_ReadUncommitted)) - ){ - return 1; - } - - /* If the client is reading or writing an index and the schema is - ** not loaded, then it is too difficult to actually check to see if - ** the correct locks are held. So do not bother - just return true. - ** This case does not come up very often anyhow. - */ - if( isIndex && (!pSchema || (pSchema->flags&DB_SchemaLoaded)==0) ){ - return 1; - } - - /* Figure out the root-page that the lock should be held on. For table - ** b-trees, this is just the root page of the b-tree being read or - ** written. For index b-trees, it is the root page of the associated - ** table. */ - if( isIndex ){ - HashElem *p; - for(p=sqliteHashFirst(&pSchema->idxHash); p; p=sqliteHashNext(p)){ - Index *pIdx = (Index *)sqliteHashData(p); - if( pIdx->tnum==(int)iRoot ){ - iTab = pIdx->pTable->tnum; - } - } - }else{ - iTab = iRoot; - } - - /* Search for the required lock. Either a write-lock on root-page iTab, a - ** write-lock on the schema table, or (if the client is reading) a - ** read-lock on iTab will suffice. Return 1 if any of these are found. */ - for(pLock=pBtree->pBt->pLock; pLock; pLock=pLock->pNext){ - if( pLock->pBtree==pBtree - && (pLock->iTable==iTab || (pLock->eLock==WRITE_LOCK && pLock->iTable==1)) - && pLock->eLock>=eLockType - ){ - return 1; - } - } - - /* Failed to find the required lock. */ - return 0; -} -#endif /* SQLITE_DEBUG */ - -#ifdef SQLITE_DEBUG -/* -**** This function may be used as part of assert() statements only. **** -** -** Return true if it would be illegal for pBtree to write into the -** table or index rooted at iRoot because other shared connections are -** simultaneously reading that same table or index. -** -** It is illegal for pBtree to write if some other Btree object that -** shares the same BtShared object is currently reading or writing -** the iRoot table. Except, if the other Btree object has the -** read-uncommitted flag set, then it is OK for the other object to -** have a read cursor. -** -** For example, before writing to any part of the table or index -** rooted at page iRoot, one should call: -** -** assert( !hasReadConflicts(pBtree, iRoot) ); -*/ -static int hasReadConflicts(Btree *pBtree, Pgno iRoot){ - BtCursor *p; - for(p=pBtree->pBt->pCursor; p; p=p->pNext){ - if( p->pgnoRoot==iRoot - && p->pBtree!=pBtree - && 0==(p->pBtree->db->flags & SQLITE_ReadUncommitted) - ){ - return 1; - } - } - return 0; -} -#endif /* #ifdef SQLITE_DEBUG */ - -/* -** Query to see if Btree handle p may obtain a lock of type eLock -** (READ_LOCK or WRITE_LOCK) on the table with root-page iTab. Return -** SQLITE_OK if the lock may be obtained (by calling -** setSharedCacheTableLock()), or SQLITE_LOCKED if not. -*/ -static int querySharedCacheTableLock(Btree *p, Pgno iTab, u8 eLock){ - BtShared *pBt = p->pBt; - BtLock *pIter; - - assert( sqlite3BtreeHoldsMutex(p) ); - assert( eLock==READ_LOCK || eLock==WRITE_LOCK ); - assert( p->db!=0 ); - assert( !(p->db->flags&SQLITE_ReadUncommitted)||eLock==WRITE_LOCK||iTab==1 ); - - /* If requesting a write-lock, then the Btree must have an open write - ** transaction on this file. And, obviously, for this to be so there - ** must be an open write transaction on the file itself. - */ - assert( eLock==READ_LOCK || (p==pBt->pWriter && p->inTrans==TRANS_WRITE) ); - assert( eLock==READ_LOCK || pBt->inTransaction==TRANS_WRITE ); - - /* This routine is a no-op if the shared-cache is not enabled */ - if( !p->sharable ){ - return SQLITE_OK; - } - - /* If some other connection is holding an exclusive lock, the - ** requested lock may not be obtained. - */ - if( pBt->pWriter!=p && (pBt->btsFlags & BTS_EXCLUSIVE)!=0 ){ - sqlite3ConnectionBlocked(p->db, pBt->pWriter->db); - return SQLITE_LOCKED_SHAREDCACHE; - } - - for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){ - /* The condition (pIter->eLock!=eLock) in the following if(...) - ** statement is a simplification of: - ** - ** (eLock==WRITE_LOCK || pIter->eLock==WRITE_LOCK) - ** - ** since we know that if eLock==WRITE_LOCK, then no other connection - ** may hold a WRITE_LOCK on any table in this file (since there can - ** only be a single writer). - */ - assert( pIter->eLock==READ_LOCK || pIter->eLock==WRITE_LOCK ); - assert( eLock==READ_LOCK || pIter->pBtree==p || pIter->eLock==READ_LOCK); - if( pIter->pBtree!=p && pIter->iTable==iTab && pIter->eLock!=eLock ){ - sqlite3ConnectionBlocked(p->db, pIter->pBtree->db); - if( eLock==WRITE_LOCK ){ - assert( p==pBt->pWriter ); - pBt->btsFlags |= BTS_PENDING; - } - return SQLITE_LOCKED_SHAREDCACHE; - } - } - return SQLITE_OK; -} -#endif /* !SQLITE_OMIT_SHARED_CACHE */ - -#ifndef SQLITE_OMIT_SHARED_CACHE -/* -** Add a lock on the table with root-page iTable to the shared-btree used -** by Btree handle p. Parameter eLock must be either READ_LOCK or -** WRITE_LOCK. -** -** This function assumes the following: -** -** (a) The specified Btree object p is connected to a sharable -** database (one with the BtShared.sharable flag set), and -** -** (b) No other Btree objects hold a lock that conflicts -** with the requested lock (i.e. querySharedCacheTableLock() has -** already been called and returned SQLITE_OK). -** -** SQLITE_OK is returned if the lock is added successfully. SQLITE_NOMEM -** is returned if a malloc attempt fails. -*/ -static int setSharedCacheTableLock(Btree *p, Pgno iTable, u8 eLock){ - BtShared *pBt = p->pBt; - BtLock *pLock = 0; - BtLock *pIter; - - assert( sqlite3BtreeHoldsMutex(p) ); - assert( eLock==READ_LOCK || eLock==WRITE_LOCK ); - assert( p->db!=0 ); - - /* A connection with the read-uncommitted flag set will never try to - ** obtain a read-lock using this function. The only read-lock obtained - ** by a connection in read-uncommitted mode is on the sqlite_master - ** table, and that lock is obtained in BtreeBeginTrans(). */ - assert( 0==(p->db->flags&SQLITE_ReadUncommitted) || eLock==WRITE_LOCK ); - - /* This function should only be called on a sharable b-tree after it - ** has been determined that no other b-tree holds a conflicting lock. */ - assert( p->sharable ); - assert( SQLITE_OK==querySharedCacheTableLock(p, iTable, eLock) ); - - /* First search the list for an existing lock on this table. */ - for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){ - if( pIter->iTable==iTable && pIter->pBtree==p ){ - pLock = pIter; - break; - } - } - - /* If the above search did not find a BtLock struct associating Btree p - ** with table iTable, allocate one and link it into the list. - */ - if( !pLock ){ - pLock = (BtLock *)sqlite3MallocZero(sizeof(BtLock)); - if( !pLock ){ - return SQLITE_NOMEM; - } - pLock->iTable = iTable; - pLock->pBtree = p; - pLock->pNext = pBt->pLock; - pBt->pLock = pLock; - } - - /* Set the BtLock.eLock variable to the maximum of the current lock - ** and the requested lock. This means if a write-lock was already held - ** and a read-lock requested, we don't incorrectly downgrade the lock. - */ - assert( WRITE_LOCK>READ_LOCK ); - if( eLock>pLock->eLock ){ - pLock->eLock = eLock; - } - - return SQLITE_OK; -} -#endif /* !SQLITE_OMIT_SHARED_CACHE */ - -#ifndef SQLITE_OMIT_SHARED_CACHE -/* -** Release all the table locks (locks obtained via calls to -** the setSharedCacheTableLock() procedure) held by Btree object p. -** -** This function assumes that Btree p has an open read or write -** transaction. If it does not, then the BTS_PENDING flag -** may be incorrectly cleared. -*/ -static void clearAllSharedCacheTableLocks(Btree *p){ - BtShared *pBt = p->pBt; - BtLock **ppIter = &pBt->pLock; - - assert( sqlite3BtreeHoldsMutex(p) ); - assert( p->sharable || 0==*ppIter ); - assert( p->inTrans>0 ); - - while( *ppIter ){ - BtLock *pLock = *ppIter; - assert( (pBt->btsFlags & BTS_EXCLUSIVE)==0 || pBt->pWriter==pLock->pBtree ); - assert( pLock->pBtree->inTrans>=pLock->eLock ); - if( pLock->pBtree==p ){ - *ppIter = pLock->pNext; - assert( pLock->iTable!=1 || pLock==&p->lock ); - if( pLock->iTable!=1 ){ - sqlite3_free(pLock); - } - }else{ - ppIter = &pLock->pNext; - } - } - - assert( (pBt->btsFlags & BTS_PENDING)==0 || pBt->pWriter ); - if( pBt->pWriter==p ){ - pBt->pWriter = 0; - pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING); - }else if( pBt->nTransaction==2 ){ - /* This function is called when Btree p is concluding its - ** transaction. If there currently exists a writer, and p is not - ** that writer, then the number of locks held by connections other - ** than the writer must be about to drop to zero. In this case - ** set the BTS_PENDING flag to 0. - ** - ** If there is not currently a writer, then BTS_PENDING must - ** be zero already. So this next line is harmless in that case. - */ - pBt->btsFlags &= ~BTS_PENDING; - } -} - -/* -** This function changes all write-locks held by Btree p into read-locks. -*/ -static void downgradeAllSharedCacheTableLocks(Btree *p){ - BtShared *pBt = p->pBt; - if( pBt->pWriter==p ){ - BtLock *pLock; - pBt->pWriter = 0; - pBt->btsFlags &= ~(BTS_EXCLUSIVE|BTS_PENDING); - for(pLock=pBt->pLock; pLock; pLock=pLock->pNext){ - assert( pLock->eLock==READ_LOCK || pLock->pBtree==p ); - pLock->eLock = READ_LOCK; - } - } -} - -#endif /* SQLITE_OMIT_SHARED_CACHE */ - -static void releasePage(MemPage *pPage); /* Forward reference */ - -/* -***** This routine is used inside of assert() only **** -** -** Verify that the cursor holds the mutex on its BtShared -*/ -#ifdef SQLITE_DEBUG -static int cursorHoldsMutex(BtCursor *p){ - return sqlite3_mutex_held(p->pBt->mutex); -} -#endif - - -#ifndef SQLITE_OMIT_INCRBLOB -/* -** Invalidate the overflow page-list cache for cursor pCur, if any. -*/ -static void invalidateOverflowCache(BtCursor *pCur){ - assert( cursorHoldsMutex(pCur) ); - sqlite3_free(pCur->aOverflow); - pCur->aOverflow = 0; -} - -/* -** Invalidate the overflow page-list cache for all cursors opened -** on the shared btree structure pBt. -*/ -static void invalidateAllOverflowCache(BtShared *pBt){ - BtCursor *p; - assert( sqlite3_mutex_held(pBt->mutex) ); - for(p=pBt->pCursor; p; p=p->pNext){ - invalidateOverflowCache(p); - } -} - -/* -** This function is called before modifying the contents of a table -** to invalidate any incrblob cursors that are open on the -** row or one of the rows being modified. -** -** If argument isClearTable is true, then the entire contents of the -** table is about to be deleted. In this case invalidate all incrblob -** cursors open on any row within the table with root-page pgnoRoot. -** -** Otherwise, if argument isClearTable is false, then the row with -** rowid iRow is being replaced or deleted. In this case invalidate -** only those incrblob cursors open on that specific row. -*/ -static void invalidateIncrblobCursors( - Btree *pBtree, /* The database file to check */ - i64 iRow, /* The rowid that might be changing */ - int isClearTable /* True if all rows are being deleted */ -){ - BtCursor *p; - BtShared *pBt = pBtree->pBt; - assert( sqlite3BtreeHoldsMutex(pBtree) ); - for(p=pBt->pCursor; p; p=p->pNext){ - if( p->isIncrblobHandle && (isClearTable || p->info.nKey==iRow) ){ - p->eState = CURSOR_INVALID; - } - } -} - -#else - /* Stub functions when INCRBLOB is omitted */ - #define invalidateOverflowCache(x) - #define invalidateAllOverflowCache(x) - #define invalidateIncrblobCursors(x,y,z) -#endif /* SQLITE_OMIT_INCRBLOB */ - -/* -** Set bit pgno of the BtShared.pHasContent bitvec. This is called -** when a page that previously contained data becomes a free-list leaf -** page. -** -** The BtShared.pHasContent bitvec exists to work around an obscure -** bug caused by the interaction of two useful IO optimizations surrounding -** free-list leaf pages: -** -** 1) When all data is deleted from a page and the page becomes -** a free-list leaf page, the page is not written to the database -** (as free-list leaf pages contain no meaningful data). Sometimes -** such a page is not even journalled (as it will not be modified, -** why bother journalling it?). -** -** 2) When a free-list leaf page is reused, its content is not read -** from the database or written to the journal file (why should it -** be, if it is not at all meaningful?). -** -** By themselves, these optimizations work fine and provide a handy -** performance boost to bulk delete or insert operations. However, if -** a page is moved to the free-list and then reused within the same -** transaction, a problem comes up. If the page is not journalled when -** it is moved to the free-list and it is also not journalled when it -** is extracted from the free-list and reused, then the original data -** may be lost. In the event of a rollback, it may not be possible -** to restore the database to its original configuration. -** -** The solution is the BtShared.pHasContent bitvec. Whenever a page is -** moved to become a free-list leaf page, the corresponding bit is -** set in the bitvec. Whenever a leaf page is extracted from the free-list, -** optimization 2 above is omitted if the corresponding bit is already -** set in BtShared.pHasContent. The contents of the bitvec are cleared -** at the end of every transaction. -*/ -static int btreeSetHasContent(BtShared *pBt, Pgno pgno){ - int rc = SQLITE_OK; - if( !pBt->pHasContent ){ - assert( pgno<=pBt->nPage ); - pBt->pHasContent = sqlite3BitvecCreate(pBt->nPage); - if( !pBt->pHasContent ){ - rc = SQLITE_NOMEM; - } - } - if( rc==SQLITE_OK && pgno<=sqlite3BitvecSize(pBt->pHasContent) ){ - rc = sqlite3BitvecSet(pBt->pHasContent, pgno); - } - return rc; -} - -/* -** Query the BtShared.pHasContent vector. -** -** This function is called when a free-list leaf page is removed from the -** free-list for reuse. It returns false if it is safe to retrieve the -** page from the pager layer with the 'no-content' flag set. True otherwise. -*/ -static int btreeGetHasContent(BtShared *pBt, Pgno pgno){ - Bitvec *p = pBt->pHasContent; - return (p && (pgno>sqlite3BitvecSize(p) || sqlite3BitvecTest(p, pgno))); -} - -/* -** Clear (destroy) the BtShared.pHasContent bitvec. This should be -** invoked at the conclusion of each write-transaction. -*/ -static void btreeClearHasContent(BtShared *pBt){ - sqlite3BitvecDestroy(pBt->pHasContent); - pBt->pHasContent = 0; -} - -/* -** Release all of the apPage[] pages for a cursor. -*/ -static void btreeReleaseAllCursorPages(BtCursor *pCur){ - int i; - for(i=0; i<=pCur->iPage; i++){ - releasePage(pCur->apPage[i]); - pCur->apPage[i] = 0; - } - pCur->iPage = -1; -} - - -/* -** Save the current cursor position in the variables BtCursor.nKey -** and BtCursor.pKey. The cursor's state is set to CURSOR_REQUIRESEEK. -** -** The caller must ensure that the cursor is valid (has eState==CURSOR_VALID) -** prior to calling this routine. -*/ -static int saveCursorPosition(BtCursor *pCur){ - int rc; - - assert( CURSOR_VALID==pCur->eState ); - assert( 0==pCur->pKey ); - assert( cursorHoldsMutex(pCur) ); - - rc = sqlite3BtreeKeySize(pCur, &pCur->nKey); - assert( rc==SQLITE_OK ); /* KeySize() cannot fail */ - - /* If this is an intKey table, then the above call to BtreeKeySize() - ** stores the integer key in pCur->nKey. In this case this value is - ** all that is required. Otherwise, if pCur is not open on an intKey - ** table, then malloc space for and store the pCur->nKey bytes of key - ** data. - */ - if( 0==pCur->apPage[0]->intKey ){ - void *pKey = sqlite3Malloc( (int)pCur->nKey ); - if( pKey ){ - rc = sqlite3BtreeKey(pCur, 0, (int)pCur->nKey, pKey); - if( rc==SQLITE_OK ){ - pCur->pKey = pKey; - }else{ - sqlite3_free(pKey); - } - }else{ - rc = SQLITE_NOMEM; - } - } - assert( !pCur->apPage[0]->intKey || !pCur->pKey ); - - if( rc==SQLITE_OK ){ - btreeReleaseAllCursorPages(pCur); - pCur->eState = CURSOR_REQUIRESEEK; - } - - invalidateOverflowCache(pCur); - return rc; -} - -/* -** Save the positions of all cursors (except pExcept) that are open on -** the table with root-page iRoot. Usually, this is called just before cursor -** pExcept is used to modify the table (BtreeDelete() or BtreeInsert()). -*/ -static int saveAllCursors(BtShared *pBt, Pgno iRoot, BtCursor *pExcept){ - BtCursor *p; - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( pExcept==0 || pExcept->pBt==pBt ); - for(p=pBt->pCursor; p; p=p->pNext){ - if( p!=pExcept && (0==iRoot || p->pgnoRoot==iRoot) ){ - if( p->eState==CURSOR_VALID ){ - int rc = saveCursorPosition(p); - if( SQLITE_OK!=rc ){ - return rc; - } - }else{ - testcase( p->iPage>0 ); - btreeReleaseAllCursorPages(p); - } - } - } - return SQLITE_OK; -} - -/* -** Clear the current cursor position. -*/ -SQLITE_PRIVATE void sqlite3BtreeClearCursor(BtCursor *pCur){ - assert( cursorHoldsMutex(pCur) ); - sqlite3_free(pCur->pKey); - pCur->pKey = 0; - pCur->eState = CURSOR_INVALID; -} - -/* -** In this version of BtreeMoveto, pKey is a packed index record -** such as is generated by the OP_MakeRecord opcode. Unpack the -** record and then call BtreeMovetoUnpacked() to do the work. -*/ -static int btreeMoveto( - BtCursor *pCur, /* Cursor open on the btree to be searched */ - const void *pKey, /* Packed key if the btree is an index */ - i64 nKey, /* Integer key for tables. Size of pKey for indices */ - int bias, /* Bias search to the high end */ - int *pRes /* Write search results here */ -){ - int rc; /* Status code */ - UnpackedRecord *pIdxKey; /* Unpacked index key */ - char aSpace[200]; /* Temp space for pIdxKey - to avoid a malloc */ - char *pFree = 0; - - if( pKey ){ - assert( nKey==(i64)(int)nKey ); - pIdxKey = sqlite3VdbeAllocUnpackedRecord( - pCur->pKeyInfo, aSpace, sizeof(aSpace), &pFree - ); - if( pIdxKey==0 ) return SQLITE_NOMEM; - sqlite3VdbeRecordUnpack(pCur->pKeyInfo, (int)nKey, pKey, pIdxKey); - if( pIdxKey->nField==0 ){ - sqlite3DbFree(pCur->pKeyInfo->db, pFree); - return SQLITE_CORRUPT_BKPT; - } - }else{ - pIdxKey = 0; - } - rc = sqlite3BtreeMovetoUnpacked(pCur, pIdxKey, nKey, bias, pRes); - if( pFree ){ - sqlite3DbFree(pCur->pKeyInfo->db, pFree); - } - return rc; -} - -/* -** Restore the cursor to the position it was in (or as close to as possible) -** when saveCursorPosition() was called. Note that this call deletes the -** saved position info stored by saveCursorPosition(), so there can be -** at most one effective restoreCursorPosition() call after each -** saveCursorPosition(). -*/ -static int btreeRestoreCursorPosition(BtCursor *pCur){ - int rc; - assert( cursorHoldsMutex(pCur) ); - assert( pCur->eState>=CURSOR_REQUIRESEEK ); - if( pCur->eState==CURSOR_FAULT ){ - return pCur->skipNext; - } - pCur->eState = CURSOR_INVALID; - rc = btreeMoveto(pCur, pCur->pKey, pCur->nKey, 0, &pCur->skipNext); - if( rc==SQLITE_OK ){ - sqlite3_free(pCur->pKey); - pCur->pKey = 0; - assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_INVALID ); - if( pCur->skipNext && pCur->eState==CURSOR_VALID ){ - pCur->eState = CURSOR_SKIPNEXT; - } - } - return rc; -} - -#define restoreCursorPosition(p) \ - (p->eState>=CURSOR_REQUIRESEEK ? \ - btreeRestoreCursorPosition(p) : \ - SQLITE_OK) - -/* -** Determine whether or not a cursor has moved from the position it -** was last placed at. Cursors can move when the row they are pointing -** at is deleted out from under them. -** -** This routine returns an error code if something goes wrong. The -** integer *pHasMoved is set to one if the cursor has moved and 0 if not. -*/ -SQLITE_PRIVATE int sqlite3BtreeCursorHasMoved(BtCursor *pCur, int *pHasMoved){ - int rc; - - rc = restoreCursorPosition(pCur); - if( rc ){ - *pHasMoved = 1; - return rc; - } - if( pCur->eState!=CURSOR_VALID || NEVER(pCur->skipNext!=0) ){ - *pHasMoved = 1; - }else{ - *pHasMoved = 0; - } - return SQLITE_OK; -} - -#ifndef SQLITE_OMIT_AUTOVACUUM -/* -** Given a page number of a regular database page, return the page -** number for the pointer-map page that contains the entry for the -** input page number. -** -** Return 0 (not a valid page) for pgno==1 since there is -** no pointer map associated with page 1. The integrity_check logic -** requires that ptrmapPageno(*,1)!=1. -*/ -static Pgno ptrmapPageno(BtShared *pBt, Pgno pgno){ - int nPagesPerMapPage; - Pgno iPtrMap, ret; - assert( sqlite3_mutex_held(pBt->mutex) ); - if( pgno<2 ) return 0; - nPagesPerMapPage = (pBt->usableSize/5)+1; - iPtrMap = (pgno-2)/nPagesPerMapPage; - ret = (iPtrMap*nPagesPerMapPage) + 2; - if( ret==PENDING_BYTE_PAGE(pBt) ){ - ret++; - } - return ret; -} - -/* -** Write an entry into the pointer map. -** -** This routine updates the pointer map entry for page number 'key' -** so that it maps to type 'eType' and parent page number 'pgno'. -** -** If *pRC is initially non-zero (non-SQLITE_OK) then this routine is -** a no-op. If an error occurs, the appropriate error code is written -** into *pRC. -*/ -static void ptrmapPut(BtShared *pBt, Pgno key, u8 eType, Pgno parent, int *pRC){ - DbPage *pDbPage; /* The pointer map page */ - u8 *pPtrmap; /* The pointer map data */ - Pgno iPtrmap; /* The pointer map page number */ - int offset; /* Offset in pointer map page */ - int rc; /* Return code from subfunctions */ - - if( *pRC ) return; - - assert( sqlite3_mutex_held(pBt->mutex) ); - /* The master-journal page number must never be used as a pointer map page */ - assert( 0==PTRMAP_ISPAGE(pBt, PENDING_BYTE_PAGE(pBt)) ); - - assert( pBt->autoVacuum ); - if( key==0 ){ - *pRC = SQLITE_CORRUPT_BKPT; - return; - } - iPtrmap = PTRMAP_PAGENO(pBt, key); - rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage); - if( rc!=SQLITE_OK ){ - *pRC = rc; - return; - } - offset = PTRMAP_PTROFFSET(iPtrmap, key); - if( offset<0 ){ - *pRC = SQLITE_CORRUPT_BKPT; - goto ptrmap_exit; - } - assert( offset <= (int)pBt->usableSize-5 ); - pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage); - - if( eType!=pPtrmap[offset] || get4byte(&pPtrmap[offset+1])!=parent ){ - TRACE(("PTRMAP_UPDATE: %d->(%d,%d)\n", key, eType, parent)); - *pRC= rc = sqlite3PagerWrite(pDbPage); - if( rc==SQLITE_OK ){ - pPtrmap[offset] = eType; - put4byte(&pPtrmap[offset+1], parent); - } - } - -ptrmap_exit: - sqlite3PagerUnref(pDbPage); -} - -/* -** Read an entry from the pointer map. -** -** This routine retrieves the pointer map entry for page 'key', writing -** the type and parent page number to *pEType and *pPgno respectively. -** An error code is returned if something goes wrong, otherwise SQLITE_OK. -*/ -static int ptrmapGet(BtShared *pBt, Pgno key, u8 *pEType, Pgno *pPgno){ - DbPage *pDbPage; /* The pointer map page */ - int iPtrmap; /* Pointer map page index */ - u8 *pPtrmap; /* Pointer map page data */ - int offset; /* Offset of entry in pointer map */ - int rc; - - assert( sqlite3_mutex_held(pBt->mutex) ); - - iPtrmap = PTRMAP_PAGENO(pBt, key); - rc = sqlite3PagerGet(pBt->pPager, iPtrmap, &pDbPage); - if( rc!=0 ){ - return rc; - } - pPtrmap = (u8 *)sqlite3PagerGetData(pDbPage); - - offset = PTRMAP_PTROFFSET(iPtrmap, key); - if( offset<0 ){ - sqlite3PagerUnref(pDbPage); - return SQLITE_CORRUPT_BKPT; - } - assert( offset <= (int)pBt->usableSize-5 ); - assert( pEType!=0 ); - *pEType = pPtrmap[offset]; - if( pPgno ) *pPgno = get4byte(&pPtrmap[offset+1]); - - sqlite3PagerUnref(pDbPage); - if( *pEType<1 || *pEType>5 ) return SQLITE_CORRUPT_BKPT; - return SQLITE_OK; -} - -#else /* if defined SQLITE_OMIT_AUTOVACUUM */ - #define ptrmapPut(w,x,y,z,rc) - #define ptrmapGet(w,x,y,z) SQLITE_OK - #define ptrmapPutOvflPtr(x, y, rc) -#endif - -/* -** Given a btree page and a cell index (0 means the first cell on -** the page, 1 means the second cell, and so forth) return a pointer -** to the cell content. -** -** This routine works only for pages that do not contain overflow cells. -*/ -#define findCell(P,I) \ - ((P)->aData + ((P)->maskPage & get2byte(&(P)->aCellIdx[2*(I)]))) -#define findCellv2(D,M,O,I) (D+(M&get2byte(D+(O+2*(I))))) - - -/* -** This a more complex version of findCell() that works for -** pages that do contain overflow cells. -*/ -static u8 *findOverflowCell(MemPage *pPage, int iCell){ - int i; - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - for(i=pPage->nOverflow-1; i>=0; i--){ - int k; - k = pPage->aiOvfl[i]; - if( k<=iCell ){ - if( k==iCell ){ - return pPage->apOvfl[i]; - } - iCell--; - } - } - return findCell(pPage, iCell); -} - -/* -** Parse a cell content block and fill in the CellInfo structure. There -** are two versions of this function. btreeParseCell() takes a -** cell index as the second argument and btreeParseCellPtr() -** takes a pointer to the body of the cell as its second argument. -** -** Within this file, the parseCell() macro can be called instead of -** btreeParseCellPtr(). Using some compilers, this will be faster. -*/ -static void btreeParseCellPtr( - MemPage *pPage, /* Page containing the cell */ - u8 *pCell, /* Pointer to the cell text. */ - CellInfo *pInfo /* Fill in this structure */ -){ - u16 n; /* Number bytes in cell content header */ - u32 nPayload; /* Number of bytes of cell payload */ - - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - - pInfo->pCell = pCell; - assert( pPage->leaf==0 || pPage->leaf==1 ); - n = pPage->childPtrSize; - assert( n==4-4*pPage->leaf ); - if( pPage->intKey ){ - if( pPage->hasData ){ - assert( n==0 ); - n = getVarint32(pCell, nPayload); - }else{ - nPayload = 0; - } - n += getVarint(&pCell[n], (u64*)&pInfo->nKey); - pInfo->nData = nPayload; - }else{ - pInfo->nData = 0; - n += getVarint32(&pCell[n], nPayload); - pInfo->nKey = nPayload; - } - pInfo->nPayload = nPayload; - pInfo->nHeader = n; - testcase( nPayload==pPage->maxLocal ); - testcase( nPayload==pPage->maxLocal+1 ); - if( likely(nPayload<=pPage->maxLocal) ){ - /* This is the (easy) common case where the entire payload fits - ** on the local page. No overflow is required. - */ - if( (pInfo->nSize = (u16)(n+nPayload))<4 ) pInfo->nSize = 4; - pInfo->nLocal = (u16)nPayload; - pInfo->iOverflow = 0; - }else{ - /* If the payload will not fit completely on the local page, we have - ** to decide how much to store locally and how much to spill onto - ** overflow pages. The strategy is to minimize the amount of unused - ** space on overflow pages while keeping the amount of local storage - ** in between minLocal and maxLocal. - ** - ** Warning: changing the way overflow payload is distributed in any - ** way will result in an incompatible file format. - */ - int minLocal; /* Minimum amount of payload held locally */ - int maxLocal; /* Maximum amount of payload held locally */ - int surplus; /* Overflow payload available for local storage */ - - minLocal = pPage->minLocal; - maxLocal = pPage->maxLocal; - surplus = minLocal + (nPayload - minLocal)%(pPage->pBt->usableSize - 4); - testcase( surplus==maxLocal ); - testcase( surplus==maxLocal+1 ); - if( surplus <= maxLocal ){ - pInfo->nLocal = (u16)surplus; - }else{ - pInfo->nLocal = (u16)minLocal; - } - pInfo->iOverflow = (u16)(pInfo->nLocal + n); - pInfo->nSize = pInfo->iOverflow + 4; - } -} -#define parseCell(pPage, iCell, pInfo) \ - btreeParseCellPtr((pPage), findCell((pPage), (iCell)), (pInfo)) -static void btreeParseCell( - MemPage *pPage, /* Page containing the cell */ - int iCell, /* The cell index. First cell is 0 */ - CellInfo *pInfo /* Fill in this structure */ -){ - parseCell(pPage, iCell, pInfo); -} - -/* -** Compute the total number of bytes that a Cell needs in the cell -** data area of the btree-page. The return number includes the cell -** data header and the local payload, but not any overflow page or -** the space used by the cell pointer. -*/ -static u16 cellSizePtr(MemPage *pPage, u8 *pCell){ - u8 *pIter = &pCell[pPage->childPtrSize]; - u32 nSize; - -#ifdef SQLITE_DEBUG - /* The value returned by this function should always be the same as - ** the (CellInfo.nSize) value found by doing a full parse of the - ** cell. If SQLITE_DEBUG is defined, an assert() at the bottom of - ** this function verifies that this invariant is not violated. */ - CellInfo debuginfo; - btreeParseCellPtr(pPage, pCell, &debuginfo); -#endif - - if( pPage->intKey ){ - u8 *pEnd; - if( pPage->hasData ){ - pIter += getVarint32(pIter, nSize); - }else{ - nSize = 0; - } - - /* pIter now points at the 64-bit integer key value, a variable length - ** integer. The following block moves pIter to point at the first byte - ** past the end of the key value. */ - pEnd = &pIter[9]; - while( (*pIter++)&0x80 && pItermaxLocal ); - testcase( nSize==pPage->maxLocal+1 ); - if( nSize>pPage->maxLocal ){ - int minLocal = pPage->minLocal; - nSize = minLocal + (nSize - minLocal) % (pPage->pBt->usableSize - 4); - testcase( nSize==pPage->maxLocal ); - testcase( nSize==pPage->maxLocal+1 ); - if( nSize>pPage->maxLocal ){ - nSize = minLocal; - } - nSize += 4; - } - nSize += (u32)(pIter - pCell); - - /* The minimum size of any cell is 4 bytes. */ - if( nSize<4 ){ - nSize = 4; - } - - assert( nSize==debuginfo.nSize ); - return (u16)nSize; -} - -#ifdef SQLITE_DEBUG -/* This variation on cellSizePtr() is used inside of assert() statements -** only. */ -static u16 cellSize(MemPage *pPage, int iCell){ - return cellSizePtr(pPage, findCell(pPage, iCell)); -} -#endif - -#ifndef SQLITE_OMIT_AUTOVACUUM -/* -** If the cell pCell, part of page pPage contains a pointer -** to an overflow page, insert an entry into the pointer-map -** for the overflow page. -*/ -static void ptrmapPutOvflPtr(MemPage *pPage, u8 *pCell, int *pRC){ - CellInfo info; - if( *pRC ) return; - assert( pCell!=0 ); - btreeParseCellPtr(pPage, pCell, &info); - assert( (info.nData+(pPage->intKey?0:info.nKey))==info.nPayload ); - if( info.iOverflow ){ - Pgno ovfl = get4byte(&pCell[info.iOverflow]); - ptrmapPut(pPage->pBt, ovfl, PTRMAP_OVERFLOW1, pPage->pgno, pRC); - } -} -#endif - - -/* -** Defragment the page given. All Cells are moved to the -** end of the page and all free space is collected into one -** big FreeBlk that occurs in between the header and cell -** pointer array and the cell content area. -*/ -static int defragmentPage(MemPage *pPage){ - int i; /* Loop counter */ - int pc; /* Address of a i-th cell */ - int hdr; /* Offset to the page header */ - int size; /* Size of a cell */ - int usableSize; /* Number of usable bytes on a page */ - int cellOffset; /* Offset to the cell pointer array */ - int cbrk; /* Offset to the cell content area */ - int nCell; /* Number of cells on the page */ - unsigned char *data; /* The page data */ - unsigned char *temp; /* Temp area for cell content */ - int iCellFirst; /* First allowable cell index */ - int iCellLast; /* Last possible cell index */ - - - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - assert( pPage->pBt!=0 ); - assert( pPage->pBt->usableSize <= SQLITE_MAX_PAGE_SIZE ); - assert( pPage->nOverflow==0 ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - temp = sqlite3PagerTempSpace(pPage->pBt->pPager); - data = pPage->aData; - hdr = pPage->hdrOffset; - cellOffset = pPage->cellOffset; - nCell = pPage->nCell; - assert( nCell==get2byte(&data[hdr+3]) ); - usableSize = pPage->pBt->usableSize; - cbrk = get2byte(&data[hdr+5]); - memcpy(&temp[cbrk], &data[cbrk], usableSize - cbrk); - cbrk = usableSize; - iCellFirst = cellOffset + 2*nCell; - iCellLast = usableSize - 4; - for(i=0; iiCellLast ){ - return SQLITE_CORRUPT_BKPT; - } -#endif - assert( pc>=iCellFirst && pc<=iCellLast ); - size = cellSizePtr(pPage, &temp[pc]); - cbrk -= size; -#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK) - if( cbrkusableSize ){ - return SQLITE_CORRUPT_BKPT; - } -#endif - assert( cbrk+size<=usableSize && cbrk>=iCellFirst ); - testcase( cbrk+size==usableSize ); - testcase( pc+size==usableSize ); - memcpy(&data[cbrk], &temp[pc], size); - put2byte(pAddr, cbrk); - } - assert( cbrk>=iCellFirst ); - put2byte(&data[hdr+5], cbrk); - data[hdr+1] = 0; - data[hdr+2] = 0; - data[hdr+7] = 0; - memset(&data[iCellFirst], 0, cbrk-iCellFirst); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - if( cbrk-iCellFirst!=pPage->nFree ){ - return SQLITE_CORRUPT_BKPT; - } - return SQLITE_OK; -} - -/* -** Allocate nByte bytes of space from within the B-Tree page passed -** as the first argument. Write into *pIdx the index into pPage->aData[] -** of the first byte of allocated space. Return either SQLITE_OK or -** an error code (usually SQLITE_CORRUPT). -** -** The caller guarantees that there is sufficient space to make the -** allocation. This routine might need to defragment in order to bring -** all the space together, however. This routine will avoid using -** the first two bytes past the cell pointer area since presumably this -** allocation is being made in order to insert a new cell, so we will -** also end up needing a new cell pointer. -*/ -static int allocateSpace(MemPage *pPage, int nByte, int *pIdx){ - const int hdr = pPage->hdrOffset; /* Local cache of pPage->hdrOffset */ - u8 * const data = pPage->aData; /* Local cache of pPage->aData */ - int nFrag; /* Number of fragmented bytes on pPage */ - int top; /* First byte of cell content area */ - int gap; /* First byte of gap between cell pointers and cell content */ - int rc; /* Integer return code */ - int usableSize; /* Usable size of the page */ - - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - assert( pPage->pBt ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( nByte>=0 ); /* Minimum cell size is 4 */ - assert( pPage->nFree>=nByte ); - assert( pPage->nOverflow==0 ); - usableSize = pPage->pBt->usableSize; - assert( nByte < usableSize-8 ); - - nFrag = data[hdr+7]; - assert( pPage->cellOffset == hdr + 12 - 4*pPage->leaf ); - gap = pPage->cellOffset + 2*pPage->nCell; - top = get2byteNotZero(&data[hdr+5]); - if( gap>top ) return SQLITE_CORRUPT_BKPT; - testcase( gap+2==top ); - testcase( gap+1==top ); - testcase( gap==top ); - - if( nFrag>=60 ){ - /* Always defragment highly fragmented pages */ - rc = defragmentPage(pPage); - if( rc ) return rc; - top = get2byteNotZero(&data[hdr+5]); - }else if( gap+2<=top ){ - /* Search the freelist looking for a free slot big enough to satisfy - ** the request. The allocation is made from the first free slot in - ** the list that is large enough to accommodate it. - */ - int pc, addr; - for(addr=hdr+1; (pc = get2byte(&data[addr]))>0; addr=pc){ - int size; /* Size of the free slot */ - if( pc>usableSize-4 || pc=nByte ){ - int x = size - nByte; - testcase( x==4 ); - testcase( x==3 ); - if( x<4 ){ - /* Remove the slot from the free-list. Update the number of - ** fragmented bytes within the page. */ - memcpy(&data[addr], &data[pc], 2); - data[hdr+7] = (u8)(nFrag + x); - }else if( size+pc > usableSize ){ - return SQLITE_CORRUPT_BKPT; - }else{ - /* The slot remains on the free-list. Reduce its size to account - ** for the portion used by the new allocation. */ - put2byte(&data[pc+2], x); - } - *pIdx = pc + x; - return SQLITE_OK; - } - } - } - - /* Check to make sure there is enough space in the gap to satisfy - ** the allocation. If not, defragment. - */ - testcase( gap+2+nByte==top ); - if( gap+2+nByte>top ){ - rc = defragmentPage(pPage); - if( rc ) return rc; - top = get2byteNotZero(&data[hdr+5]); - assert( gap+nByte<=top ); - } - - - /* Allocate memory from the gap in between the cell pointer array - ** and the cell content area. The btreeInitPage() call has already - ** validated the freelist. Given that the freelist is valid, there - ** is no way that the allocation can extend off the end of the page. - ** The assert() below verifies the previous sentence. - */ - top -= nByte; - put2byte(&data[hdr+5], top); - assert( top+nByte <= (int)pPage->pBt->usableSize ); - *pIdx = top; - return SQLITE_OK; -} - -/* -** Return a section of the pPage->aData to the freelist. -** The first byte of the new free block is pPage->aDisk[start] -** and the size of the block is "size" bytes. -** -** Most of the effort here is involved in coalesing adjacent -** free blocks into a single big free block. -*/ -static int freeSpace(MemPage *pPage, int start, int size){ - int addr, pbegin, hdr; - int iLast; /* Largest possible freeblock offset */ - unsigned char *data = pPage->aData; - - assert( pPage->pBt!=0 ); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - assert( start>=pPage->hdrOffset+6+pPage->childPtrSize ); - assert( (start + size) <= (int)pPage->pBt->usableSize ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( size>=0 ); /* Minimum cell size is 4 */ - - if( pPage->pBt->btsFlags & BTS_SECURE_DELETE ){ - /* Overwrite deleted information with zeros when the secure_delete - ** option is enabled */ - memset(&data[start], 0, size); - } - - /* Add the space back into the linked list of freeblocks. Note that - ** even though the freeblock list was checked by btreeInitPage(), - ** btreeInitPage() did not detect overlapping cells or - ** freeblocks that overlapped cells. Nor does it detect when the - ** cell content area exceeds the value in the page header. If these - ** situations arise, then subsequent insert operations might corrupt - ** the freelist. So we do need to check for corruption while scanning - ** the freelist. - */ - hdr = pPage->hdrOffset; - addr = hdr + 1; - iLast = pPage->pBt->usableSize - 4; - assert( start<=iLast ); - while( (pbegin = get2byte(&data[addr]))0 ){ - if( pbeginiLast ){ - return SQLITE_CORRUPT_BKPT; - } - assert( pbegin>addr || pbegin==0 ); - put2byte(&data[addr], start); - put2byte(&data[start], pbegin); - put2byte(&data[start+2], size); - pPage->nFree = pPage->nFree + (u16)size; - - /* Coalesce adjacent free blocks */ - addr = hdr + 1; - while( (pbegin = get2byte(&data[addr]))>0 ){ - int pnext, psize, x; - assert( pbegin>addr ); - assert( pbegin <= (int)pPage->pBt->usableSize-4 ); - pnext = get2byte(&data[pbegin]); - psize = get2byte(&data[pbegin+2]); - if( pbegin + psize + 3 >= pnext && pnext>0 ){ - int frag = pnext - (pbegin+psize); - if( (frag<0) || (frag>(int)data[hdr+7]) ){ - return SQLITE_CORRUPT_BKPT; - } - data[hdr+7] -= (u8)frag; - x = get2byte(&data[pnext]); - put2byte(&data[pbegin], x); - x = pnext + get2byte(&data[pnext+2]) - pbegin; - put2byte(&data[pbegin+2], x); - }else{ - addr = pbegin; - } - } - - /* If the cell content area begins with a freeblock, remove it. */ - if( data[hdr+1]==data[hdr+5] && data[hdr+2]==data[hdr+6] ){ - int top; - pbegin = get2byte(&data[hdr+1]); - memcpy(&data[hdr+1], &data[pbegin], 2); - top = get2byte(&data[hdr+5]) + get2byte(&data[pbegin+2]); - put2byte(&data[hdr+5], top); - } - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - return SQLITE_OK; -} - -/* -** Decode the flags byte (the first byte of the header) for a page -** and initialize fields of the MemPage structure accordingly. -** -** Only the following combinations are supported. Anything different -** indicates a corrupt database files: -** -** PTF_ZERODATA -** PTF_ZERODATA | PTF_LEAF -** PTF_LEAFDATA | PTF_INTKEY -** PTF_LEAFDATA | PTF_INTKEY | PTF_LEAF -*/ -static int decodeFlags(MemPage *pPage, int flagByte){ - BtShared *pBt; /* A copy of pPage->pBt */ - - assert( pPage->hdrOffset==(pPage->pgno==1 ? 100 : 0) ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - pPage->leaf = (u8)(flagByte>>3); assert( PTF_LEAF == 1<<3 ); - flagByte &= ~PTF_LEAF; - pPage->childPtrSize = 4-4*pPage->leaf; - pBt = pPage->pBt; - if( flagByte==(PTF_LEAFDATA | PTF_INTKEY) ){ - pPage->intKey = 1; - pPage->hasData = pPage->leaf; - pPage->maxLocal = pBt->maxLeaf; - pPage->minLocal = pBt->minLeaf; - }else if( flagByte==PTF_ZERODATA ){ - pPage->intKey = 0; - pPage->hasData = 0; - pPage->maxLocal = pBt->maxLocal; - pPage->minLocal = pBt->minLocal; - }else{ - return SQLITE_CORRUPT_BKPT; - } - pPage->max1bytePayload = pBt->max1bytePayload; - return SQLITE_OK; -} - -/* -** Initialize the auxiliary information for a disk block. -** -** Return SQLITE_OK on success. If we see that the page does -** not contain a well-formed database page, then return -** SQLITE_CORRUPT. Note that a return of SQLITE_OK does not -** guarantee that the page is well-formed. It only shows that -** we failed to detect any corruption. -*/ -static int btreeInitPage(MemPage *pPage){ - - assert( pPage->pBt!=0 ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( pPage->pgno==sqlite3PagerPagenumber(pPage->pDbPage) ); - assert( pPage == sqlite3PagerGetExtra(pPage->pDbPage) ); - assert( pPage->aData == sqlite3PagerGetData(pPage->pDbPage) ); - - if( !pPage->isInit ){ - u16 pc; /* Address of a freeblock within pPage->aData[] */ - u8 hdr; /* Offset to beginning of page header */ - u8 *data; /* Equal to pPage->aData */ - BtShared *pBt; /* The main btree structure */ - int usableSize; /* Amount of usable space on each page */ - u16 cellOffset; /* Offset from start of page to first cell pointer */ - int nFree; /* Number of unused bytes on the page */ - int top; /* First byte of the cell content area */ - int iCellFirst; /* First allowable cell or freeblock offset */ - int iCellLast; /* Last possible cell or freeblock offset */ - - pBt = pPage->pBt; - - hdr = pPage->hdrOffset; - data = pPage->aData; - if( decodeFlags(pPage, data[hdr]) ) return SQLITE_CORRUPT_BKPT; - assert( pBt->pageSize>=512 && pBt->pageSize<=65536 ); - pPage->maskPage = (u16)(pBt->pageSize - 1); - pPage->nOverflow = 0; - usableSize = pBt->usableSize; - pPage->cellOffset = cellOffset = hdr + 12 - 4*pPage->leaf; - pPage->aDataEnd = &data[usableSize]; - pPage->aCellIdx = &data[cellOffset]; - top = get2byteNotZero(&data[hdr+5]); - pPage->nCell = get2byte(&data[hdr+3]); - if( pPage->nCell>MX_CELL(pBt) ){ - /* To many cells for a single page. The page must be corrupt */ - return SQLITE_CORRUPT_BKPT; - } - testcase( pPage->nCell==MX_CELL(pBt) ); - - /* A malformed database page might cause us to read past the end - ** of page when parsing a cell. - ** - ** The following block of code checks early to see if a cell extends - ** past the end of a page boundary and causes SQLITE_CORRUPT to be - ** returned if it does. - */ - iCellFirst = cellOffset + 2*pPage->nCell; - iCellLast = usableSize - 4; -#if defined(SQLITE_ENABLE_OVERSIZE_CELL_CHECK) - { - int i; /* Index into the cell pointer array */ - int sz; /* Size of a cell */ - - if( !pPage->leaf ) iCellLast--; - for(i=0; inCell; i++){ - pc = get2byte(&data[cellOffset+i*2]); - testcase( pc==iCellFirst ); - testcase( pc==iCellLast ); - if( pciCellLast ){ - return SQLITE_CORRUPT_BKPT; - } - sz = cellSizePtr(pPage, &data[pc]); - testcase( pc+sz==usableSize ); - if( pc+sz>usableSize ){ - return SQLITE_CORRUPT_BKPT; - } - } - if( !pPage->leaf ) iCellLast++; - } -#endif - - /* Compute the total free space on the page */ - pc = get2byte(&data[hdr+1]); - nFree = data[hdr+7] + top; - while( pc>0 ){ - u16 next, size; - if( pciCellLast ){ - /* Start of free block is off the page */ - return SQLITE_CORRUPT_BKPT; - } - next = get2byte(&data[pc]); - size = get2byte(&data[pc+2]); - if( (next>0 && next<=pc+size+3) || pc+size>usableSize ){ - /* Free blocks must be in ascending order. And the last byte of - ** the free-block must lie on the database page. */ - return SQLITE_CORRUPT_BKPT; - } - nFree = nFree + size; - pc = next; - } - - /* At this point, nFree contains the sum of the offset to the start - ** of the cell-content area plus the number of free bytes within - ** the cell-content area. If this is greater than the usable-size - ** of the page, then the page must be corrupted. This check also - ** serves to verify that the offset to the start of the cell-content - ** area, according to the page header, lies within the page. - */ - if( nFree>usableSize ){ - return SQLITE_CORRUPT_BKPT; - } - pPage->nFree = (u16)(nFree - iCellFirst); - pPage->isInit = 1; - } - return SQLITE_OK; -} - -/* -** Set up a raw page so that it looks like a database page holding -** no entries. -*/ -static void zeroPage(MemPage *pPage, int flags){ - unsigned char *data = pPage->aData; - BtShared *pBt = pPage->pBt; - u8 hdr = pPage->hdrOffset; - u16 first; - - assert( sqlite3PagerPagenumber(pPage->pDbPage)==pPage->pgno ); - assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); - assert( sqlite3PagerGetData(pPage->pDbPage) == data ); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - assert( sqlite3_mutex_held(pBt->mutex) ); - if( pBt->btsFlags & BTS_SECURE_DELETE ){ - memset(&data[hdr], 0, pBt->usableSize - hdr); - } - data[hdr] = (char)flags; - first = hdr + 8 + 4*((flags&PTF_LEAF)==0 ?1:0); - memset(&data[hdr+1], 0, 4); - data[hdr+7] = 0; - put2byte(&data[hdr+5], pBt->usableSize); - pPage->nFree = (u16)(pBt->usableSize - first); - decodeFlags(pPage, flags); - pPage->hdrOffset = hdr; - pPage->cellOffset = first; - pPage->aDataEnd = &data[pBt->usableSize]; - pPage->aCellIdx = &data[first]; - pPage->nOverflow = 0; - assert( pBt->pageSize>=512 && pBt->pageSize<=65536 ); - pPage->maskPage = (u16)(pBt->pageSize - 1); - pPage->nCell = 0; - pPage->isInit = 1; -} - - -/* -** Convert a DbPage obtained from the pager into a MemPage used by -** the btree layer. -*/ -static MemPage *btreePageFromDbPage(DbPage *pDbPage, Pgno pgno, BtShared *pBt){ - MemPage *pPage = (MemPage*)sqlite3PagerGetExtra(pDbPage); - pPage->aData = sqlite3PagerGetData(pDbPage); - pPage->pDbPage = pDbPage; - pPage->pBt = pBt; - pPage->pgno = pgno; - pPage->hdrOffset = pPage->pgno==1 ? 100 : 0; - return pPage; -} - -/* -** Get a page from the pager. Initialize the MemPage.pBt and -** MemPage.aData elements if needed. -** -** If the noContent flag is set, it means that we do not care about -** the content of the page at this time. So do not go to the disk -** to fetch the content. Just fill in the content with zeros for now. -** If in the future we call sqlite3PagerWrite() on this page, that -** means we have started to be concerned about content and the disk -** read should occur at that point. -*/ -static int btreeGetPage( - BtShared *pBt, /* The btree */ - Pgno pgno, /* Number of the page to fetch */ - MemPage **ppPage, /* Return the page in this parameter */ - int flags /* PAGER_GET_NOCONTENT or PAGER_GET_READONLY */ -){ - int rc; - DbPage *pDbPage; - - assert( flags==0 || flags==PAGER_GET_NOCONTENT || flags==PAGER_GET_READONLY ); - assert( sqlite3_mutex_held(pBt->mutex) ); - rc = sqlite3PagerAcquire(pBt->pPager, pgno, (DbPage**)&pDbPage, flags); - if( rc ) return rc; - *ppPage = btreePageFromDbPage(pDbPage, pgno, pBt); - return SQLITE_OK; -} - -/* -** Retrieve a page from the pager cache. If the requested page is not -** already in the pager cache return NULL. Initialize the MemPage.pBt and -** MemPage.aData elements if needed. -*/ -static MemPage *btreePageLookup(BtShared *pBt, Pgno pgno){ - DbPage *pDbPage; - assert( sqlite3_mutex_held(pBt->mutex) ); - pDbPage = sqlite3PagerLookup(pBt->pPager, pgno); - if( pDbPage ){ - return btreePageFromDbPage(pDbPage, pgno, pBt); - } - return 0; -} - -/* -** Return the size of the database file in pages. If there is any kind of -** error, return ((unsigned int)-1). -*/ -static Pgno btreePagecount(BtShared *pBt){ - return pBt->nPage; -} -SQLITE_PRIVATE u32 sqlite3BtreeLastPage(Btree *p){ - assert( sqlite3BtreeHoldsMutex(p) ); - assert( ((p->pBt->nPage)&0x8000000)==0 ); - return (int)btreePagecount(p->pBt); -} - -/* -** Get a page from the pager and initialize it. This routine is just a -** convenience wrapper around separate calls to btreeGetPage() and -** btreeInitPage(). -** -** If an error occurs, then the value *ppPage is set to is undefined. It -** may remain unchanged, or it may be set to an invalid value. -*/ -static int getAndInitPage( - BtShared *pBt, /* The database file */ - Pgno pgno, /* Number of the page to get */ - MemPage **ppPage, /* Write the page pointer here */ - int bReadonly /* PAGER_GET_READONLY or 0 */ -){ - int rc; - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( bReadonly==PAGER_GET_READONLY || bReadonly==0 ); - - if( pgno>btreePagecount(pBt) ){ - rc = SQLITE_CORRUPT_BKPT; - }else{ - rc = btreeGetPage(pBt, pgno, ppPage, bReadonly); - if( rc==SQLITE_OK && (*ppPage)->isInit==0 ){ - rc = btreeInitPage(*ppPage); - if( rc!=SQLITE_OK ){ - releasePage(*ppPage); - } - } - } - - testcase( pgno==0 ); - assert( pgno!=0 || rc==SQLITE_CORRUPT ); - return rc; -} - -/* -** Release a MemPage. This should be called once for each prior -** call to btreeGetPage. -*/ -static void releasePage(MemPage *pPage){ - if( pPage ){ - assert( pPage->aData ); - assert( pPage->pBt ); - assert( pPage->pDbPage!=0 ); - assert( sqlite3PagerGetExtra(pPage->pDbPage) == (void*)pPage ); - assert( sqlite3PagerGetData(pPage->pDbPage)==pPage->aData ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - sqlite3PagerUnrefNotNull(pPage->pDbPage); - } -} - -/* -** During a rollback, when the pager reloads information into the cache -** so that the cache is restored to its original state at the start of -** the transaction, for each page restored this routine is called. -** -** This routine needs to reset the extra data section at the end of the -** page to agree with the restored data. -*/ -static void pageReinit(DbPage *pData){ - MemPage *pPage; - pPage = (MemPage *)sqlite3PagerGetExtra(pData); - assert( sqlite3PagerPageRefcount(pData)>0 ); - if( pPage->isInit ){ - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - pPage->isInit = 0; - if( sqlite3PagerPageRefcount(pData)>1 ){ - /* pPage might not be a btree page; it might be an overflow page - ** or ptrmap page or a free page. In those cases, the following - ** call to btreeInitPage() will likely return SQLITE_CORRUPT. - ** But no harm is done by this. And it is very important that - ** btreeInitPage() be called on every btree page so we make - ** the call for every page that comes in for re-initing. */ - btreeInitPage(pPage); - } - } -} - -/* -** Invoke the busy handler for a btree. -*/ -static int btreeInvokeBusyHandler(void *pArg){ - BtShared *pBt = (BtShared*)pArg; - assert( pBt->db ); - assert( sqlite3_mutex_held(pBt->db->mutex) ); - return sqlite3InvokeBusyHandler(&pBt->db->busyHandler); -} - -/* -** Open a database file. -** -** zFilename is the name of the database file. If zFilename is NULL -** then an ephemeral database is created. The ephemeral database might -** be exclusively in memory, or it might use a disk-based memory cache. -** Either way, the ephemeral database will be automatically deleted -** when sqlite3BtreeClose() is called. -** -** If zFilename is ":memory:" then an in-memory database is created -** that is automatically destroyed when it is closed. -** -** The "flags" parameter is a bitmask that might contain bits like -** BTREE_OMIT_JOURNAL and/or BTREE_MEMORY. -** -** If the database is already opened in the same database connection -** and we are in shared cache mode, then the open will fail with an -** SQLITE_CONSTRAINT error. We cannot allow two or more BtShared -** objects in the same database connection since doing so will lead -** to problems with locking. -*/ -SQLITE_PRIVATE int sqlite3BtreeOpen( - sqlite3_vfs *pVfs, /* VFS to use for this b-tree */ - const char *zFilename, /* Name of the file containing the BTree database */ - sqlite3 *db, /* Associated database handle */ - Btree **ppBtree, /* Pointer to new Btree object written here */ - int flags, /* Options */ - int vfsFlags /* Flags passed through to sqlite3_vfs.xOpen() */ -){ - BtShared *pBt = 0; /* Shared part of btree structure */ - Btree *p; /* Handle to return */ - sqlite3_mutex *mutexOpen = 0; /* Prevents a race condition. Ticket #3537 */ - int rc = SQLITE_OK; /* Result code from this function */ - u8 nReserve; /* Byte of unused space on each page */ - unsigned char zDbHeader[100]; /* Database header content */ - - /* True if opening an ephemeral, temporary database */ - const int isTempDb = zFilename==0 || zFilename[0]==0; - - /* Set the variable isMemdb to true for an in-memory database, or - ** false for a file-based database. - */ -#ifdef SQLITE_OMIT_MEMORYDB - const int isMemdb = 0; -#else - const int isMemdb = (zFilename && strcmp(zFilename, ":memory:")==0) - || (isTempDb && sqlite3TempInMemory(db)) - || (vfsFlags & SQLITE_OPEN_MEMORY)!=0; -#endif - - assert( db!=0 ); - assert( pVfs!=0 ); - assert( sqlite3_mutex_held(db->mutex) ); - assert( (flags&0xff)==flags ); /* flags fit in 8 bits */ - - /* Only a BTREE_SINGLE database can be BTREE_UNORDERED */ - assert( (flags & BTREE_UNORDERED)==0 || (flags & BTREE_SINGLE)!=0 ); - - /* A BTREE_SINGLE database is always a temporary and/or ephemeral */ - assert( (flags & BTREE_SINGLE)==0 || isTempDb ); - - if( isMemdb ){ - flags |= BTREE_MEMORY; - } - if( (vfsFlags & SQLITE_OPEN_MAIN_DB)!=0 && (isMemdb || isTempDb) ){ - vfsFlags = (vfsFlags & ~SQLITE_OPEN_MAIN_DB) | SQLITE_OPEN_TEMP_DB; - } - p = sqlite3MallocZero(sizeof(Btree)); - if( !p ){ - return SQLITE_NOMEM; - } - p->inTrans = TRANS_NONE; - p->db = db; -#ifndef SQLITE_OMIT_SHARED_CACHE - p->lock.pBtree = p; - p->lock.iTable = 1; -#endif - -#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO) - /* - ** If this Btree is a candidate for shared cache, try to find an - ** existing BtShared object that we can share with - */ - if( isTempDb==0 && (isMemdb==0 || (vfsFlags&SQLITE_OPEN_URI)!=0) ){ - if( vfsFlags & SQLITE_OPEN_SHAREDCACHE ){ - int nFullPathname = pVfs->mxPathname+1; - char *zFullPathname = sqlite3Malloc(nFullPathname); - MUTEX_LOGIC( sqlite3_mutex *mutexShared; ) - p->sharable = 1; - if( !zFullPathname ){ - sqlite3_free(p); - return SQLITE_NOMEM; - } - if( isMemdb ){ - memcpy(zFullPathname, zFilename, sqlite3Strlen30(zFilename)+1); - }else{ - rc = sqlite3OsFullPathname(pVfs, zFilename, - nFullPathname, zFullPathname); - if( rc ){ - sqlite3_free(zFullPathname); - sqlite3_free(p); - return rc; - } - } -#if SQLITE_THREADSAFE - mutexOpen = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_OPEN); - sqlite3_mutex_enter(mutexOpen); - mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); - sqlite3_mutex_enter(mutexShared); -#endif - for(pBt=GLOBAL(BtShared*,sqlite3SharedCacheList); pBt; pBt=pBt->pNext){ - assert( pBt->nRef>0 ); - if( 0==strcmp(zFullPathname, sqlite3PagerFilename(pBt->pPager, 0)) - && sqlite3PagerVfs(pBt->pPager)==pVfs ){ - int iDb; - for(iDb=db->nDb-1; iDb>=0; iDb--){ - Btree *pExisting = db->aDb[iDb].pBt; - if( pExisting && pExisting->pBt==pBt ){ - sqlite3_mutex_leave(mutexShared); - sqlite3_mutex_leave(mutexOpen); - sqlite3_free(zFullPathname); - sqlite3_free(p); - return SQLITE_CONSTRAINT; - } - } - p->pBt = pBt; - pBt->nRef++; - break; - } - } - sqlite3_mutex_leave(mutexShared); - sqlite3_free(zFullPathname); - } -#ifdef SQLITE_DEBUG - else{ - /* In debug mode, we mark all persistent databases as sharable - ** even when they are not. This exercises the locking code and - ** gives more opportunity for asserts(sqlite3_mutex_held()) - ** statements to find locking problems. - */ - p->sharable = 1; - } -#endif - } -#endif - if( pBt==0 ){ - /* - ** The following asserts make sure that structures used by the btree are - ** the right size. This is to guard against size changes that result - ** when compiling on a different architecture. - */ - assert( sizeof(i64)==8 || sizeof(i64)==4 ); - assert( sizeof(u64)==8 || sizeof(u64)==4 ); - assert( sizeof(u32)==4 ); - assert( sizeof(u16)==2 ); - assert( sizeof(Pgno)==4 ); - - pBt = sqlite3MallocZero( sizeof(*pBt) ); - if( pBt==0 ){ - rc = SQLITE_NOMEM; - goto btree_open_out; - } - rc = sqlite3PagerOpen(pVfs, &pBt->pPager, zFilename, - EXTRA_SIZE, flags, vfsFlags, pageReinit); - if( rc==SQLITE_OK ){ - sqlite3PagerSetMmapLimit(pBt->pPager, db->szMmap); - rc = sqlite3PagerReadFileheader(pBt->pPager,sizeof(zDbHeader),zDbHeader); - } - if( rc!=SQLITE_OK ){ - goto btree_open_out; - } - pBt->openFlags = (u8)flags; - pBt->db = db; - sqlite3PagerSetBusyhandler(pBt->pPager, btreeInvokeBusyHandler, pBt); - p->pBt = pBt; - - pBt->pCursor = 0; - pBt->pPage1 = 0; - if( sqlite3PagerIsreadonly(pBt->pPager) ) pBt->btsFlags |= BTS_READ_ONLY; -#ifdef SQLITE_SECURE_DELETE - pBt->btsFlags |= BTS_SECURE_DELETE; -#endif - pBt->pageSize = (zDbHeader[16]<<8) | (zDbHeader[17]<<16); - if( pBt->pageSize<512 || pBt->pageSize>SQLITE_MAX_PAGE_SIZE - || ((pBt->pageSize-1)&pBt->pageSize)!=0 ){ - pBt->pageSize = 0; -#ifndef SQLITE_OMIT_AUTOVACUUM - /* If the magic name ":memory:" will create an in-memory database, then - ** leave the autoVacuum mode at 0 (do not auto-vacuum), even if - ** SQLITE_DEFAULT_AUTOVACUUM is true. On the other hand, if - ** SQLITE_OMIT_MEMORYDB has been defined, then ":memory:" is just a - ** regular file-name. In this case the auto-vacuum applies as per normal. - */ - if( zFilename && !isMemdb ){ - pBt->autoVacuum = (SQLITE_DEFAULT_AUTOVACUUM ? 1 : 0); - pBt->incrVacuum = (SQLITE_DEFAULT_AUTOVACUUM==2 ? 1 : 0); - } -#endif - nReserve = 0; - }else{ - nReserve = zDbHeader[20]; - pBt->btsFlags |= BTS_PAGESIZE_FIXED; -#ifndef SQLITE_OMIT_AUTOVACUUM - pBt->autoVacuum = (get4byte(&zDbHeader[36 + 4*4])?1:0); - pBt->incrVacuum = (get4byte(&zDbHeader[36 + 7*4])?1:0); -#endif - } - rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve); - if( rc ) goto btree_open_out; - pBt->usableSize = pBt->pageSize - nReserve; - assert( (pBt->pageSize & 7)==0 ); /* 8-byte alignment of pageSize */ - -#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO) - /* Add the new BtShared object to the linked list sharable BtShareds. - */ - if( p->sharable ){ - MUTEX_LOGIC( sqlite3_mutex *mutexShared; ) - pBt->nRef = 1; - MUTEX_LOGIC( mutexShared = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER);) - if( SQLITE_THREADSAFE && sqlite3GlobalConfig.bCoreMutex ){ - pBt->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_FAST); - if( pBt->mutex==0 ){ - rc = SQLITE_NOMEM; - db->mallocFailed = 0; - goto btree_open_out; - } - } - sqlite3_mutex_enter(mutexShared); - pBt->pNext = GLOBAL(BtShared*,sqlite3SharedCacheList); - GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt; - sqlite3_mutex_leave(mutexShared); - } -#endif - } - -#if !defined(SQLITE_OMIT_SHARED_CACHE) && !defined(SQLITE_OMIT_DISKIO) - /* If the new Btree uses a sharable pBtShared, then link the new - ** Btree into the list of all sharable Btrees for the same connection. - ** The list is kept in ascending order by pBt address. - */ - if( p->sharable ){ - int i; - Btree *pSib; - for(i=0; inDb; i++){ - if( (pSib = db->aDb[i].pBt)!=0 && pSib->sharable ){ - while( pSib->pPrev ){ pSib = pSib->pPrev; } - if( p->pBtpBt ){ - p->pNext = pSib; - p->pPrev = 0; - pSib->pPrev = p; - }else{ - while( pSib->pNext && pSib->pNext->pBtpBt ){ - pSib = pSib->pNext; - } - p->pNext = pSib->pNext; - p->pPrev = pSib; - if( p->pNext ){ - p->pNext->pPrev = p; - } - pSib->pNext = p; - } - break; - } - } - } -#endif - *ppBtree = p; - -btree_open_out: - if( rc!=SQLITE_OK ){ - if( pBt && pBt->pPager ){ - sqlite3PagerClose(pBt->pPager); - } - sqlite3_free(pBt); - sqlite3_free(p); - *ppBtree = 0; - }else{ - /* If the B-Tree was successfully opened, set the pager-cache size to the - ** default value. Except, when opening on an existing shared pager-cache, - ** do not change the pager-cache size. - */ - if( sqlite3BtreeSchema(p, 0, 0)==0 ){ - sqlite3PagerSetCachesize(p->pBt->pPager, SQLITE_DEFAULT_CACHE_SIZE); - } - } - if( mutexOpen ){ - assert( sqlite3_mutex_held(mutexOpen) ); - sqlite3_mutex_leave(mutexOpen); - } - return rc; -} - -/* -** Decrement the BtShared.nRef counter. When it reaches zero, -** remove the BtShared structure from the sharing list. Return -** true if the BtShared.nRef counter reaches zero and return -** false if it is still positive. -*/ -static int removeFromSharingList(BtShared *pBt){ -#ifndef SQLITE_OMIT_SHARED_CACHE - MUTEX_LOGIC( sqlite3_mutex *pMaster; ) - BtShared *pList; - int removed = 0; - - assert( sqlite3_mutex_notheld(pBt->mutex) ); - MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - sqlite3_mutex_enter(pMaster); - pBt->nRef--; - if( pBt->nRef<=0 ){ - if( GLOBAL(BtShared*,sqlite3SharedCacheList)==pBt ){ - GLOBAL(BtShared*,sqlite3SharedCacheList) = pBt->pNext; - }else{ - pList = GLOBAL(BtShared*,sqlite3SharedCacheList); - while( ALWAYS(pList) && pList->pNext!=pBt ){ - pList=pList->pNext; - } - if( ALWAYS(pList) ){ - pList->pNext = pBt->pNext; - } - } - if( SQLITE_THREADSAFE ){ - sqlite3_mutex_free(pBt->mutex); - } - removed = 1; - } - sqlite3_mutex_leave(pMaster); - return removed; -#else - return 1; -#endif -} - -/* -** Make sure pBt->pTmpSpace points to an allocation of -** MX_CELL_SIZE(pBt) bytes. -*/ -static void allocateTempSpace(BtShared *pBt){ - if( !pBt->pTmpSpace ){ - pBt->pTmpSpace = sqlite3PageMalloc( pBt->pageSize ); - - /* One of the uses of pBt->pTmpSpace is to format cells before - ** inserting them into a leaf page (function fillInCell()). If - ** a cell is less than 4 bytes in size, it is rounded up to 4 bytes - ** by the various routines that manipulate binary cells. Which - ** can mean that fillInCell() only initializes the first 2 or 3 - ** bytes of pTmpSpace, but that the first 4 bytes are copied from - ** it into a database page. This is not actually a problem, but it - ** does cause a valgrind error when the 1 or 2 bytes of unitialized - ** data is passed to system call write(). So to avoid this error, - ** zero the first 4 bytes of temp space here. */ - if( pBt->pTmpSpace ) memset(pBt->pTmpSpace, 0, 4); - } -} - -/* -** Free the pBt->pTmpSpace allocation -*/ -static void freeTempSpace(BtShared *pBt){ - sqlite3PageFree( pBt->pTmpSpace); - pBt->pTmpSpace = 0; -} - -/* -** Close an open database and invalidate all cursors. -*/ -SQLITE_PRIVATE int sqlite3BtreeClose(Btree *p){ - BtShared *pBt = p->pBt; - BtCursor *pCur; - - /* Close all cursors opened via this handle. */ - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - pCur = pBt->pCursor; - while( pCur ){ - BtCursor *pTmp = pCur; - pCur = pCur->pNext; - if( pTmp->pBtree==p ){ - sqlite3BtreeCloseCursor(pTmp); - } - } - - /* Rollback any active transaction and free the handle structure. - ** The call to sqlite3BtreeRollback() drops any table-locks held by - ** this handle. - */ - sqlite3BtreeRollback(p, SQLITE_OK); - sqlite3BtreeLeave(p); - - /* If there are still other outstanding references to the shared-btree - ** structure, return now. The remainder of this procedure cleans - ** up the shared-btree. - */ - assert( p->wantToLock==0 && p->locked==0 ); - if( !p->sharable || removeFromSharingList(pBt) ){ - /* The pBt is no longer on the sharing list, so we can access - ** it without having to hold the mutex. - ** - ** Clean out and delete the BtShared object. - */ - assert( !pBt->pCursor ); - sqlite3PagerClose(pBt->pPager); - if( pBt->xFreeSchema && pBt->pSchema ){ - pBt->xFreeSchema(pBt->pSchema); - } - sqlite3DbFree(0, pBt->pSchema); - freeTempSpace(pBt); - sqlite3_free(pBt); - } - -#ifndef SQLITE_OMIT_SHARED_CACHE - assert( p->wantToLock==0 ); - assert( p->locked==0 ); - if( p->pPrev ) p->pPrev->pNext = p->pNext; - if( p->pNext ) p->pNext->pPrev = p->pPrev; -#endif - - sqlite3_free(p); - return SQLITE_OK; -} - -/* -** Change the limit on the number of pages allowed in the cache. -** -** The maximum number of cache pages is set to the absolute -** value of mxPage. If mxPage is negative, the pager will -** operate asynchronously - it will not stop to do fsync()s -** to insure data is written to the disk surface before -** continuing. Transactions still work if synchronous is off, -** and the database cannot be corrupted if this program -** crashes. But if the operating system crashes or there is -** an abrupt power failure when synchronous is off, the database -** could be left in an inconsistent and unrecoverable state. -** Synchronous is on by default so database corruption is not -** normally a worry. -*/ -SQLITE_PRIVATE int sqlite3BtreeSetCacheSize(Btree *p, int mxPage){ - BtShared *pBt = p->pBt; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - sqlite3PagerSetCachesize(pBt->pPager, mxPage); - sqlite3BtreeLeave(p); - return SQLITE_OK; -} - -/* -** Change the limit on the amount of the database file that may be -** memory mapped. -*/ -SQLITE_PRIVATE int sqlite3BtreeSetMmapLimit(Btree *p, sqlite3_int64 szMmap){ - BtShared *pBt = p->pBt; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - sqlite3PagerSetMmapLimit(pBt->pPager, szMmap); - sqlite3BtreeLeave(p); - return SQLITE_OK; -} - -/* -** Change the way data is synced to disk in order to increase or decrease -** how well the database resists damage due to OS crashes and power -** failures. Level 1 is the same as asynchronous (no syncs() occur and -** there is a high probability of damage) Level 2 is the default. There -** is a very low but non-zero probability of damage. Level 3 reduces the -** probability of damage to near zero but with a write performance reduction. -*/ -#ifndef SQLITE_OMIT_PAGER_PRAGMAS -SQLITE_PRIVATE int sqlite3BtreeSetPagerFlags( - Btree *p, /* The btree to set the safety level on */ - unsigned pgFlags /* Various PAGER_* flags */ -){ - BtShared *pBt = p->pBt; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - sqlite3PagerSetFlags(pBt->pPager, pgFlags); - sqlite3BtreeLeave(p); - return SQLITE_OK; -} -#endif - -/* -** Return TRUE if the given btree is set to safety level 1. In other -** words, return TRUE if no sync() occurs on the disk files. -*/ -SQLITE_PRIVATE int sqlite3BtreeSyncDisabled(Btree *p){ - BtShared *pBt = p->pBt; - int rc; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - assert( pBt && pBt->pPager ); - rc = sqlite3PagerNosync(pBt->pPager); - sqlite3BtreeLeave(p); - return rc; -} - -/* -** Change the default pages size and the number of reserved bytes per page. -** Or, if the page size has already been fixed, return SQLITE_READONLY -** without changing anything. -** -** The page size must be a power of 2 between 512 and 65536. If the page -** size supplied does not meet this constraint then the page size is not -** changed. -** -** Page sizes are constrained to be a power of two so that the region -** of the database file used for locking (beginning at PENDING_BYTE, -** the first byte past the 1GB boundary, 0x40000000) needs to occur -** at the beginning of a page. -** -** If parameter nReserve is less than zero, then the number of reserved -** bytes per page is left unchanged. -** -** If the iFix!=0 then the BTS_PAGESIZE_FIXED flag is set so that the page size -** and autovacuum mode can no longer be changed. -*/ -SQLITE_PRIVATE int sqlite3BtreeSetPageSize(Btree *p, int pageSize, int nReserve, int iFix){ - int rc = SQLITE_OK; - BtShared *pBt = p->pBt; - assert( nReserve>=-1 && nReserve<=255 ); - sqlite3BtreeEnter(p); - if( pBt->btsFlags & BTS_PAGESIZE_FIXED ){ - sqlite3BtreeLeave(p); - return SQLITE_READONLY; - } - if( nReserve<0 ){ - nReserve = pBt->pageSize - pBt->usableSize; - } - assert( nReserve>=0 && nReserve<=255 ); - if( pageSize>=512 && pageSize<=SQLITE_MAX_PAGE_SIZE && - ((pageSize-1)&pageSize)==0 ){ - assert( (pageSize & 7)==0 ); - assert( !pBt->pPage1 && !pBt->pCursor ); - pBt->pageSize = (u32)pageSize; - freeTempSpace(pBt); - } - rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, nReserve); - pBt->usableSize = pBt->pageSize - (u16)nReserve; - if( iFix ) pBt->btsFlags |= BTS_PAGESIZE_FIXED; - sqlite3BtreeLeave(p); - return rc; -} - -/* -** Return the currently defined page size -*/ -SQLITE_PRIVATE int sqlite3BtreeGetPageSize(Btree *p){ - return p->pBt->pageSize; -} - -#if defined(SQLITE_HAS_CODEC) || defined(SQLITE_DEBUG) -/* -** This function is similar to sqlite3BtreeGetReserve(), except that it -** may only be called if it is guaranteed that the b-tree mutex is already -** held. -** -** This is useful in one special case in the backup API code where it is -** known that the shared b-tree mutex is held, but the mutex on the -** database handle that owns *p is not. In this case if sqlite3BtreeEnter() -** were to be called, it might collide with some other operation on the -** database handle that owns *p, causing undefined behavior. -*/ -SQLITE_PRIVATE int sqlite3BtreeGetReserveNoMutex(Btree *p){ - assert( sqlite3_mutex_held(p->pBt->mutex) ); - return p->pBt->pageSize - p->pBt->usableSize; -} -#endif /* SQLITE_HAS_CODEC || SQLITE_DEBUG */ - -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM) -/* -** Return the number of bytes of space at the end of every page that -** are intentually left unused. This is the "reserved" space that is -** sometimes used by extensions. -*/ -SQLITE_PRIVATE int sqlite3BtreeGetReserve(Btree *p){ - int n; - sqlite3BtreeEnter(p); - n = p->pBt->pageSize - p->pBt->usableSize; - sqlite3BtreeLeave(p); - return n; -} - -/* -** Set the maximum page count for a database if mxPage is positive. -** No changes are made if mxPage is 0 or negative. -** Regardless of the value of mxPage, return the maximum page count. -*/ -SQLITE_PRIVATE int sqlite3BtreeMaxPageCount(Btree *p, int mxPage){ - int n; - sqlite3BtreeEnter(p); - n = sqlite3PagerMaxPageCount(p->pBt->pPager, mxPage); - sqlite3BtreeLeave(p); - return n; -} - -/* -** Set the BTS_SECURE_DELETE flag if newFlag is 0 or 1. If newFlag is -1, -** then make no changes. Always return the value of the BTS_SECURE_DELETE -** setting after the change. -*/ -SQLITE_PRIVATE int sqlite3BtreeSecureDelete(Btree *p, int newFlag){ - int b; - if( p==0 ) return 0; - sqlite3BtreeEnter(p); - if( newFlag>=0 ){ - p->pBt->btsFlags &= ~BTS_SECURE_DELETE; - if( newFlag ) p->pBt->btsFlags |= BTS_SECURE_DELETE; - } - b = (p->pBt->btsFlags & BTS_SECURE_DELETE)!=0; - sqlite3BtreeLeave(p); - return b; -} -#endif /* !defined(SQLITE_OMIT_PAGER_PRAGMAS) || !defined(SQLITE_OMIT_VACUUM) */ - -/* -** Change the 'auto-vacuum' property of the database. If the 'autoVacuum' -** parameter is non-zero, then auto-vacuum mode is enabled. If zero, it -** is disabled. The default value for the auto-vacuum property is -** determined by the SQLITE_DEFAULT_AUTOVACUUM macro. -*/ -SQLITE_PRIVATE int sqlite3BtreeSetAutoVacuum(Btree *p, int autoVacuum){ -#ifdef SQLITE_OMIT_AUTOVACUUM - return SQLITE_READONLY; -#else - BtShared *pBt = p->pBt; - int rc = SQLITE_OK; - u8 av = (u8)autoVacuum; - - sqlite3BtreeEnter(p); - if( (pBt->btsFlags & BTS_PAGESIZE_FIXED)!=0 && (av ?1:0)!=pBt->autoVacuum ){ - rc = SQLITE_READONLY; - }else{ - pBt->autoVacuum = av ?1:0; - pBt->incrVacuum = av==2 ?1:0; - } - sqlite3BtreeLeave(p); - return rc; -#endif -} - -/* -** Return the value of the 'auto-vacuum' property. If auto-vacuum is -** enabled 1 is returned. Otherwise 0. -*/ -SQLITE_PRIVATE int sqlite3BtreeGetAutoVacuum(Btree *p){ -#ifdef SQLITE_OMIT_AUTOVACUUM - return BTREE_AUTOVACUUM_NONE; -#else - int rc; - sqlite3BtreeEnter(p); - rc = ( - (!p->pBt->autoVacuum)?BTREE_AUTOVACUUM_NONE: - (!p->pBt->incrVacuum)?BTREE_AUTOVACUUM_FULL: - BTREE_AUTOVACUUM_INCR - ); - sqlite3BtreeLeave(p); - return rc; -#endif -} - - -/* -** Get a reference to pPage1 of the database file. This will -** also acquire a readlock on that file. -** -** SQLITE_OK is returned on success. If the file is not a -** well-formed database file, then SQLITE_CORRUPT is returned. -** SQLITE_BUSY is returned if the database is locked. SQLITE_NOMEM -** is returned if we run out of memory. -*/ -static int lockBtree(BtShared *pBt){ - int rc; /* Result code from subfunctions */ - MemPage *pPage1; /* Page 1 of the database file */ - int nPage; /* Number of pages in the database */ - int nPageFile = 0; /* Number of pages in the database file */ - int nPageHeader; /* Number of pages in the database according to hdr */ - - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( pBt->pPage1==0 ); - rc = sqlite3PagerSharedLock(pBt->pPager); - if( rc!=SQLITE_OK ) return rc; - rc = btreeGetPage(pBt, 1, &pPage1, 0); - if( rc!=SQLITE_OK ) return rc; - - /* Do some checking to help insure the file we opened really is - ** a valid database file. - */ - nPage = nPageHeader = get4byte(28+(u8*)pPage1->aData); - sqlite3PagerPagecount(pBt->pPager, &nPageFile); - if( nPage==0 || memcmp(24+(u8*)pPage1->aData, 92+(u8*)pPage1->aData,4)!=0 ){ - nPage = nPageFile; - } - if( nPage>0 ){ - u32 pageSize; - u32 usableSize; - u8 *page1 = pPage1->aData; - rc = SQLITE_NOTADB; - if( memcmp(page1, zMagicHeader, 16)!=0 ){ - goto page1_init_failed; - } - -#ifdef SQLITE_OMIT_WAL - if( page1[18]>1 ){ - pBt->btsFlags |= BTS_READ_ONLY; - } - if( page1[19]>1 ){ - goto page1_init_failed; - } -#else - if( page1[18]>2 ){ - pBt->btsFlags |= BTS_READ_ONLY; - } - if( page1[19]>2 ){ - goto page1_init_failed; - } - - /* If the write version is set to 2, this database should be accessed - ** in WAL mode. If the log is not already open, open it now. Then - ** return SQLITE_OK and return without populating BtShared.pPage1. - ** The caller detects this and calls this function again. This is - ** required as the version of page 1 currently in the page1 buffer - ** may not be the latest version - there may be a newer one in the log - ** file. - */ - if( page1[19]==2 && (pBt->btsFlags & BTS_NO_WAL)==0 ){ - int isOpen = 0; - rc = sqlite3PagerOpenWal(pBt->pPager, &isOpen); - if( rc!=SQLITE_OK ){ - goto page1_init_failed; - }else if( isOpen==0 ){ - releasePage(pPage1); - return SQLITE_OK; - } - rc = SQLITE_NOTADB; - } -#endif - - /* The maximum embedded fraction must be exactly 25%. And the minimum - ** embedded fraction must be 12.5% for both leaf-data and non-leaf-data. - ** The original design allowed these amounts to vary, but as of - ** version 3.6.0, we require them to be fixed. - */ - if( memcmp(&page1[21], "\100\040\040",3)!=0 ){ - goto page1_init_failed; - } - pageSize = (page1[16]<<8) | (page1[17]<<16); - if( ((pageSize-1)&pageSize)!=0 - || pageSize>SQLITE_MAX_PAGE_SIZE - || pageSize<=256 - ){ - goto page1_init_failed; - } - assert( (pageSize & 7)==0 ); - usableSize = pageSize - page1[20]; - if( (u32)pageSize!=pBt->pageSize ){ - /* After reading the first page of the database assuming a page size - ** of BtShared.pageSize, we have discovered that the page-size is - ** actually pageSize. Unlock the database, leave pBt->pPage1 at - ** zero and return SQLITE_OK. The caller will call this function - ** again with the correct page-size. - */ - releasePage(pPage1); - pBt->usableSize = usableSize; - pBt->pageSize = pageSize; - freeTempSpace(pBt); - rc = sqlite3PagerSetPagesize(pBt->pPager, &pBt->pageSize, - pageSize-usableSize); - return rc; - } - if( (pBt->db->flags & SQLITE_RecoveryMode)==0 && nPage>nPageFile ){ - rc = SQLITE_CORRUPT_BKPT; - goto page1_init_failed; - } - if( usableSize<480 ){ - goto page1_init_failed; - } - pBt->pageSize = pageSize; - pBt->usableSize = usableSize; -#ifndef SQLITE_OMIT_AUTOVACUUM - pBt->autoVacuum = (get4byte(&page1[36 + 4*4])?1:0); - pBt->incrVacuum = (get4byte(&page1[36 + 7*4])?1:0); -#endif - } - - /* maxLocal is the maximum amount of payload to store locally for - ** a cell. Make sure it is small enough so that at least minFanout - ** cells can will fit on one page. We assume a 10-byte page header. - ** Besides the payload, the cell must store: - ** 2-byte pointer to the cell - ** 4-byte child pointer - ** 9-byte nKey value - ** 4-byte nData value - ** 4-byte overflow page pointer - ** So a cell consists of a 2-byte pointer, a header which is as much as - ** 17 bytes long, 0 to N bytes of payload, and an optional 4 byte overflow - ** page pointer. - */ - pBt->maxLocal = (u16)((pBt->usableSize-12)*64/255 - 23); - pBt->minLocal = (u16)((pBt->usableSize-12)*32/255 - 23); - pBt->maxLeaf = (u16)(pBt->usableSize - 35); - pBt->minLeaf = (u16)((pBt->usableSize-12)*32/255 - 23); - if( pBt->maxLocal>127 ){ - pBt->max1bytePayload = 127; - }else{ - pBt->max1bytePayload = (u8)pBt->maxLocal; - } - assert( pBt->maxLeaf + 23 <= MX_CELL_SIZE(pBt) ); - pBt->pPage1 = pPage1; - pBt->nPage = nPage; - return SQLITE_OK; - -page1_init_failed: - releasePage(pPage1); - pBt->pPage1 = 0; - return rc; -} - -#ifndef NDEBUG -/* -** Return the number of cursors open on pBt. This is for use -** in assert() expressions, so it is only compiled if NDEBUG is not -** defined. -** -** Only write cursors are counted if wrOnly is true. If wrOnly is -** false then all cursors are counted. -** -** For the purposes of this routine, a cursor is any cursor that -** is capable of reading or writing to the databse. Cursors that -** have been tripped into the CURSOR_FAULT state are not counted. -*/ -static int countValidCursors(BtShared *pBt, int wrOnly){ - BtCursor *pCur; - int r = 0; - for(pCur=pBt->pCursor; pCur; pCur=pCur->pNext){ - if( (wrOnly==0 || pCur->wrFlag) && pCur->eState!=CURSOR_FAULT ) r++; - } - return r; -} -#endif - -/* -** If there are no outstanding cursors and we are not in the middle -** of a transaction but there is a read lock on the database, then -** this routine unrefs the first page of the database file which -** has the effect of releasing the read lock. -** -** If there is a transaction in progress, this routine is a no-op. -*/ -static void unlockBtreeIfUnused(BtShared *pBt){ - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( countValidCursors(pBt,0)==0 || pBt->inTransaction>TRANS_NONE ); - if( pBt->inTransaction==TRANS_NONE && pBt->pPage1!=0 ){ - assert( pBt->pPage1->aData ); - assert( sqlite3PagerRefcount(pBt->pPager)==1 ); - assert( pBt->pPage1->aData ); - releasePage(pBt->pPage1); - pBt->pPage1 = 0; - } -} - -/* -** If pBt points to an empty file then convert that empty file -** into a new empty database by initializing the first page of -** the database. -*/ -static int newDatabase(BtShared *pBt){ - MemPage *pP1; - unsigned char *data; - int rc; - - assert( sqlite3_mutex_held(pBt->mutex) ); - if( pBt->nPage>0 ){ - return SQLITE_OK; - } - pP1 = pBt->pPage1; - assert( pP1!=0 ); - data = pP1->aData; - rc = sqlite3PagerWrite(pP1->pDbPage); - if( rc ) return rc; - memcpy(data, zMagicHeader, sizeof(zMagicHeader)); - assert( sizeof(zMagicHeader)==16 ); - data[16] = (u8)((pBt->pageSize>>8)&0xff); - data[17] = (u8)((pBt->pageSize>>16)&0xff); - data[18] = 1; - data[19] = 1; - assert( pBt->usableSize<=pBt->pageSize && pBt->usableSize+255>=pBt->pageSize); - data[20] = (u8)(pBt->pageSize - pBt->usableSize); - data[21] = 64; - data[22] = 32; - data[23] = 32; - memset(&data[24], 0, 100-24); - zeroPage(pP1, PTF_INTKEY|PTF_LEAF|PTF_LEAFDATA ); - pBt->btsFlags |= BTS_PAGESIZE_FIXED; -#ifndef SQLITE_OMIT_AUTOVACUUM - assert( pBt->autoVacuum==1 || pBt->autoVacuum==0 ); - assert( pBt->incrVacuum==1 || pBt->incrVacuum==0 ); - put4byte(&data[36 + 4*4], pBt->autoVacuum); - put4byte(&data[36 + 7*4], pBt->incrVacuum); -#endif - pBt->nPage = 1; - data[31] = 1; - return SQLITE_OK; -} - -/* -** Initialize the first page of the database file (creating a database -** consisting of a single page and no schema objects). Return SQLITE_OK -** if successful, or an SQLite error code otherwise. -*/ -SQLITE_PRIVATE int sqlite3BtreeNewDb(Btree *p){ - int rc; - sqlite3BtreeEnter(p); - p->pBt->nPage = 0; - rc = newDatabase(p->pBt); - sqlite3BtreeLeave(p); - return rc; -} - -/* -** Attempt to start a new transaction. A write-transaction -** is started if the second argument is nonzero, otherwise a read- -** transaction. If the second argument is 2 or more and exclusive -** transaction is started, meaning that no other process is allowed -** to access the database. A preexisting transaction may not be -** upgraded to exclusive by calling this routine a second time - the -** exclusivity flag only works for a new transaction. -** -** A write-transaction must be started before attempting any -** changes to the database. None of the following routines -** will work unless a transaction is started first: -** -** sqlite3BtreeCreateTable() -** sqlite3BtreeCreateIndex() -** sqlite3BtreeClearTable() -** sqlite3BtreeDropTable() -** sqlite3BtreeInsert() -** sqlite3BtreeDelete() -** sqlite3BtreeUpdateMeta() -** -** If an initial attempt to acquire the lock fails because of lock contention -** and the database was previously unlocked, then invoke the busy handler -** if there is one. But if there was previously a read-lock, do not -** invoke the busy handler - just return SQLITE_BUSY. SQLITE_BUSY is -** returned when there is already a read-lock in order to avoid a deadlock. -** -** Suppose there are two processes A and B. A has a read lock and B has -** a reserved lock. B tries to promote to exclusive but is blocked because -** of A's read lock. A tries to promote to reserved but is blocked by B. -** One or the other of the two processes must give way or there can be -** no progress. By returning SQLITE_BUSY and not invoking the busy callback -** when A already has a read lock, we encourage A to give up and let B -** proceed. -*/ -SQLITE_PRIVATE int sqlite3BtreeBeginTrans(Btree *p, int wrflag){ - sqlite3 *pBlock = 0; - BtShared *pBt = p->pBt; - int rc = SQLITE_OK; - - sqlite3BtreeEnter(p); - btreeIntegrity(p); - - /* If the btree is already in a write-transaction, or it - ** is already in a read-transaction and a read-transaction - ** is requested, this is a no-op. - */ - if( p->inTrans==TRANS_WRITE || (p->inTrans==TRANS_READ && !wrflag) ){ - goto trans_begun; - } - assert( pBt->inTransaction==TRANS_WRITE || IfNotOmitAV(pBt->bDoTruncate)==0 ); - - /* Write transactions are not possible on a read-only database */ - if( (pBt->btsFlags & BTS_READ_ONLY)!=0 && wrflag ){ - rc = SQLITE_READONLY; - goto trans_begun; - } - -#ifndef SQLITE_OMIT_SHARED_CACHE - /* If another database handle has already opened a write transaction - ** on this shared-btree structure and a second write transaction is - ** requested, return SQLITE_LOCKED. - */ - if( (wrflag && pBt->inTransaction==TRANS_WRITE) - || (pBt->btsFlags & BTS_PENDING)!=0 - ){ - pBlock = pBt->pWriter->db; - }else if( wrflag>1 ){ - BtLock *pIter; - for(pIter=pBt->pLock; pIter; pIter=pIter->pNext){ - if( pIter->pBtree!=p ){ - pBlock = pIter->pBtree->db; - break; - } - } - } - if( pBlock ){ - sqlite3ConnectionBlocked(p->db, pBlock); - rc = SQLITE_LOCKED_SHAREDCACHE; - goto trans_begun; - } -#endif - - /* Any read-only or read-write transaction implies a read-lock on - ** page 1. So if some other shared-cache client already has a write-lock - ** on page 1, the transaction cannot be opened. */ - rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK); - if( SQLITE_OK!=rc ) goto trans_begun; - - pBt->btsFlags &= ~BTS_INITIALLY_EMPTY; - if( pBt->nPage==0 ) pBt->btsFlags |= BTS_INITIALLY_EMPTY; - do { - /* Call lockBtree() until either pBt->pPage1 is populated or - ** lockBtree() returns something other than SQLITE_OK. lockBtree() - ** may return SQLITE_OK but leave pBt->pPage1 set to 0 if after - ** reading page 1 it discovers that the page-size of the database - ** file is not pBt->pageSize. In this case lockBtree() will update - ** pBt->pageSize to the page-size of the file on disk. - */ - while( pBt->pPage1==0 && SQLITE_OK==(rc = lockBtree(pBt)) ); - - if( rc==SQLITE_OK && wrflag ){ - if( (pBt->btsFlags & BTS_READ_ONLY)!=0 ){ - rc = SQLITE_READONLY; - }else{ - rc = sqlite3PagerBegin(pBt->pPager,wrflag>1,sqlite3TempInMemory(p->db)); - if( rc==SQLITE_OK ){ - rc = newDatabase(pBt); - } - } - } - - if( rc!=SQLITE_OK ){ - unlockBtreeIfUnused(pBt); - } - }while( (rc&0xFF)==SQLITE_BUSY && pBt->inTransaction==TRANS_NONE && - btreeInvokeBusyHandler(pBt) ); - - if( rc==SQLITE_OK ){ - if( p->inTrans==TRANS_NONE ){ - pBt->nTransaction++; -#ifndef SQLITE_OMIT_SHARED_CACHE - if( p->sharable ){ - assert( p->lock.pBtree==p && p->lock.iTable==1 ); - p->lock.eLock = READ_LOCK; - p->lock.pNext = pBt->pLock; - pBt->pLock = &p->lock; - } -#endif - } - p->inTrans = (wrflag?TRANS_WRITE:TRANS_READ); - if( p->inTrans>pBt->inTransaction ){ - pBt->inTransaction = p->inTrans; - } - if( wrflag ){ - MemPage *pPage1 = pBt->pPage1; -#ifndef SQLITE_OMIT_SHARED_CACHE - assert( !pBt->pWriter ); - pBt->pWriter = p; - pBt->btsFlags &= ~BTS_EXCLUSIVE; - if( wrflag>1 ) pBt->btsFlags |= BTS_EXCLUSIVE; -#endif - - /* If the db-size header field is incorrect (as it may be if an old - ** client has been writing the database file), update it now. Doing - ** this sooner rather than later means the database size can safely - ** re-read the database size from page 1 if a savepoint or transaction - ** rollback occurs within the transaction. - */ - if( pBt->nPage!=get4byte(&pPage1->aData[28]) ){ - rc = sqlite3PagerWrite(pPage1->pDbPage); - if( rc==SQLITE_OK ){ - put4byte(&pPage1->aData[28], pBt->nPage); - } - } - } - } - - -trans_begun: - if( rc==SQLITE_OK && wrflag ){ - /* This call makes sure that the pager has the correct number of - ** open savepoints. If the second parameter is greater than 0 and - ** the sub-journal is not already open, then it will be opened here. - */ - rc = sqlite3PagerOpenSavepoint(pBt->pPager, p->db->nSavepoint); - } - - btreeIntegrity(p); - sqlite3BtreeLeave(p); - return rc; -} - -#ifndef SQLITE_OMIT_AUTOVACUUM - -/* -** Set the pointer-map entries for all children of page pPage. Also, if -** pPage contains cells that point to overflow pages, set the pointer -** map entries for the overflow pages as well. -*/ -static int setChildPtrmaps(MemPage *pPage){ - int i; /* Counter variable */ - int nCell; /* Number of cells in page pPage */ - int rc; /* Return code */ - BtShared *pBt = pPage->pBt; - u8 isInitOrig = pPage->isInit; - Pgno pgno = pPage->pgno; - - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - rc = btreeInitPage(pPage); - if( rc!=SQLITE_OK ){ - goto set_child_ptrmaps_out; - } - nCell = pPage->nCell; - - for(i=0; ileaf ){ - Pgno childPgno = get4byte(pCell); - ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc); - } - } - - if( !pPage->leaf ){ - Pgno childPgno = get4byte(&pPage->aData[pPage->hdrOffset+8]); - ptrmapPut(pBt, childPgno, PTRMAP_BTREE, pgno, &rc); - } - -set_child_ptrmaps_out: - pPage->isInit = isInitOrig; - return rc; -} - -/* -** Somewhere on pPage is a pointer to page iFrom. Modify this pointer so -** that it points to iTo. Parameter eType describes the type of pointer to -** be modified, as follows: -** -** PTRMAP_BTREE: pPage is a btree-page. The pointer points at a child -** page of pPage. -** -** PTRMAP_OVERFLOW1: pPage is a btree-page. The pointer points at an overflow -** page pointed to by one of the cells on pPage. -** -** PTRMAP_OVERFLOW2: pPage is an overflow-page. The pointer points at the next -** overflow page in the list. -*/ -static int modifyPagePointer(MemPage *pPage, Pgno iFrom, Pgno iTo, u8 eType){ - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - if( eType==PTRMAP_OVERFLOW2 ){ - /* The pointer is always the first 4 bytes of the page in this case. */ - if( get4byte(pPage->aData)!=iFrom ){ - return SQLITE_CORRUPT_BKPT; - } - put4byte(pPage->aData, iTo); - }else{ - u8 isInitOrig = pPage->isInit; - int i; - int nCell; - - btreeInitPage(pPage); - nCell = pPage->nCell; - - for(i=0; iaData+pPage->maskPage - && iFrom==get4byte(&pCell[info.iOverflow]) - ){ - put4byte(&pCell[info.iOverflow], iTo); - break; - } - }else{ - if( get4byte(pCell)==iFrom ){ - put4byte(pCell, iTo); - break; - } - } - } - - if( i==nCell ){ - if( eType!=PTRMAP_BTREE || - get4byte(&pPage->aData[pPage->hdrOffset+8])!=iFrom ){ - return SQLITE_CORRUPT_BKPT; - } - put4byte(&pPage->aData[pPage->hdrOffset+8], iTo); - } - - pPage->isInit = isInitOrig; - } - return SQLITE_OK; -} - - -/* -** Move the open database page pDbPage to location iFreePage in the -** database. The pDbPage reference remains valid. -** -** The isCommit flag indicates that there is no need to remember that -** the journal needs to be sync()ed before database page pDbPage->pgno -** can be written to. The caller has already promised not to write to that -** page. -*/ -static int relocatePage( - BtShared *pBt, /* Btree */ - MemPage *pDbPage, /* Open page to move */ - u8 eType, /* Pointer map 'type' entry for pDbPage */ - Pgno iPtrPage, /* Pointer map 'page-no' entry for pDbPage */ - Pgno iFreePage, /* The location to move pDbPage to */ - int isCommit /* isCommit flag passed to sqlite3PagerMovepage */ -){ - MemPage *pPtrPage; /* The page that contains a pointer to pDbPage */ - Pgno iDbPage = pDbPage->pgno; - Pager *pPager = pBt->pPager; - int rc; - - assert( eType==PTRMAP_OVERFLOW2 || eType==PTRMAP_OVERFLOW1 || - eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ); - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( pDbPage->pBt==pBt ); - - /* Move page iDbPage from its current location to page number iFreePage */ - TRACE(("AUTOVACUUM: Moving %d to free page %d (ptr page %d type %d)\n", - iDbPage, iFreePage, iPtrPage, eType)); - rc = sqlite3PagerMovepage(pPager, pDbPage->pDbPage, iFreePage, isCommit); - if( rc!=SQLITE_OK ){ - return rc; - } - pDbPage->pgno = iFreePage; - - /* If pDbPage was a btree-page, then it may have child pages and/or cells - ** that point to overflow pages. The pointer map entries for all these - ** pages need to be changed. - ** - ** If pDbPage is an overflow page, then the first 4 bytes may store a - ** pointer to a subsequent overflow page. If this is the case, then - ** the pointer map needs to be updated for the subsequent overflow page. - */ - if( eType==PTRMAP_BTREE || eType==PTRMAP_ROOTPAGE ){ - rc = setChildPtrmaps(pDbPage); - if( rc!=SQLITE_OK ){ - return rc; - } - }else{ - Pgno nextOvfl = get4byte(pDbPage->aData); - if( nextOvfl!=0 ){ - ptrmapPut(pBt, nextOvfl, PTRMAP_OVERFLOW2, iFreePage, &rc); - if( rc!=SQLITE_OK ){ - return rc; - } - } - } - - /* Fix the database pointer on page iPtrPage that pointed at iDbPage so - ** that it points at iFreePage. Also fix the pointer map entry for - ** iPtrPage. - */ - if( eType!=PTRMAP_ROOTPAGE ){ - rc = btreeGetPage(pBt, iPtrPage, &pPtrPage, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - rc = sqlite3PagerWrite(pPtrPage->pDbPage); - if( rc!=SQLITE_OK ){ - releasePage(pPtrPage); - return rc; - } - rc = modifyPagePointer(pPtrPage, iDbPage, iFreePage, eType); - releasePage(pPtrPage); - if( rc==SQLITE_OK ){ - ptrmapPut(pBt, iFreePage, eType, iPtrPage, &rc); - } - } - return rc; -} - -/* Forward declaration required by incrVacuumStep(). */ -static int allocateBtreePage(BtShared *, MemPage **, Pgno *, Pgno, u8); - -/* -** Perform a single step of an incremental-vacuum. If successful, return -** SQLITE_OK. If there is no work to do (and therefore no point in -** calling this function again), return SQLITE_DONE. Or, if an error -** occurs, return some other error code. -** -** More specificly, this function attempts to re-organize the database so -** that the last page of the file currently in use is no longer in use. -** -** Parameter nFin is the number of pages that this database would contain -** were this function called until it returns SQLITE_DONE. -** -** If the bCommit parameter is non-zero, this function assumes that the -** caller will keep calling incrVacuumStep() until it returns SQLITE_DONE -** or an error. bCommit is passed true for an auto-vacuum-on-commmit -** operation, or false for an incremental vacuum. -*/ -static int incrVacuumStep(BtShared *pBt, Pgno nFin, Pgno iLastPg, int bCommit){ - Pgno nFreeList; /* Number of pages still on the free-list */ - int rc; - - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( iLastPg>nFin ); - - if( !PTRMAP_ISPAGE(pBt, iLastPg) && iLastPg!=PENDING_BYTE_PAGE(pBt) ){ - u8 eType; - Pgno iPtrPage; - - nFreeList = get4byte(&pBt->pPage1->aData[36]); - if( nFreeList==0 ){ - return SQLITE_DONE; - } - - rc = ptrmapGet(pBt, iLastPg, &eType, &iPtrPage); - if( rc!=SQLITE_OK ){ - return rc; - } - if( eType==PTRMAP_ROOTPAGE ){ - return SQLITE_CORRUPT_BKPT; - } - - if( eType==PTRMAP_FREEPAGE ){ - if( bCommit==0 ){ - /* Remove the page from the files free-list. This is not required - ** if bCommit is non-zero. In that case, the free-list will be - ** truncated to zero after this function returns, so it doesn't - ** matter if it still contains some garbage entries. - */ - Pgno iFreePg; - MemPage *pFreePg; - rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, iLastPg, BTALLOC_EXACT); - if( rc!=SQLITE_OK ){ - return rc; - } - assert( iFreePg==iLastPg ); - releasePage(pFreePg); - } - } else { - Pgno iFreePg; /* Index of free page to move pLastPg to */ - MemPage *pLastPg; - u8 eMode = BTALLOC_ANY; /* Mode parameter for allocateBtreePage() */ - Pgno iNear = 0; /* nearby parameter for allocateBtreePage() */ - - rc = btreeGetPage(pBt, iLastPg, &pLastPg, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - - /* If bCommit is zero, this loop runs exactly once and page pLastPg - ** is swapped with the first free page pulled off the free list. - ** - ** On the other hand, if bCommit is greater than zero, then keep - ** looping until a free-page located within the first nFin pages - ** of the file is found. - */ - if( bCommit==0 ){ - eMode = BTALLOC_LE; - iNear = nFin; - } - do { - MemPage *pFreePg; - rc = allocateBtreePage(pBt, &pFreePg, &iFreePg, iNear, eMode); - if( rc!=SQLITE_OK ){ - releasePage(pLastPg); - return rc; - } - releasePage(pFreePg); - }while( bCommit && iFreePg>nFin ); - assert( iFreePgbDoTruncate = 1; - pBt->nPage = iLastPg; - } - return SQLITE_OK; -} - -/* -** The database opened by the first argument is an auto-vacuum database -** nOrig pages in size containing nFree free pages. Return the expected -** size of the database in pages following an auto-vacuum operation. -*/ -static Pgno finalDbSize(BtShared *pBt, Pgno nOrig, Pgno nFree){ - int nEntry; /* Number of entries on one ptrmap page */ - Pgno nPtrmap; /* Number of PtrMap pages to be freed */ - Pgno nFin; /* Return value */ - - nEntry = pBt->usableSize/5; - nPtrmap = (nFree-nOrig+PTRMAP_PAGENO(pBt, nOrig)+nEntry)/nEntry; - nFin = nOrig - nFree - nPtrmap; - if( nOrig>PENDING_BYTE_PAGE(pBt) && nFinpBt; - - sqlite3BtreeEnter(p); - assert( pBt->inTransaction==TRANS_WRITE && p->inTrans==TRANS_WRITE ); - if( !pBt->autoVacuum ){ - rc = SQLITE_DONE; - }else{ - Pgno nOrig = btreePagecount(pBt); - Pgno nFree = get4byte(&pBt->pPage1->aData[36]); - Pgno nFin = finalDbSize(pBt, nOrig, nFree); - - if( nOrig0 ){ - rc = saveAllCursors(pBt, 0, 0); - if( rc==SQLITE_OK ){ - invalidateAllOverflowCache(pBt); - rc = incrVacuumStep(pBt, nFin, nOrig, 0); - } - if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); - put4byte(&pBt->pPage1->aData[28], pBt->nPage); - } - }else{ - rc = SQLITE_DONE; - } - } - sqlite3BtreeLeave(p); - return rc; -} - -/* -** This routine is called prior to sqlite3PagerCommit when a transaction -** is committed for an auto-vacuum database. -** -** If SQLITE_OK is returned, then *pnTrunc is set to the number of pages -** the database file should be truncated to during the commit process. -** i.e. the database has been reorganized so that only the first *pnTrunc -** pages are in use. -*/ -static int autoVacuumCommit(BtShared *pBt){ - int rc = SQLITE_OK; - Pager *pPager = pBt->pPager; - VVA_ONLY( int nRef = sqlite3PagerRefcount(pPager) ); - - assert( sqlite3_mutex_held(pBt->mutex) ); - invalidateAllOverflowCache(pBt); - assert(pBt->autoVacuum); - if( !pBt->incrVacuum ){ - Pgno nFin; /* Number of pages in database after autovacuuming */ - Pgno nFree; /* Number of pages on the freelist initially */ - Pgno iFree; /* The next page to be freed */ - Pgno nOrig; /* Database size before freeing */ - - nOrig = btreePagecount(pBt); - if( PTRMAP_ISPAGE(pBt, nOrig) || nOrig==PENDING_BYTE_PAGE(pBt) ){ - /* It is not possible to create a database for which the final page - ** is either a pointer-map page or the pending-byte page. If one - ** is encountered, this indicates corruption. - */ - return SQLITE_CORRUPT_BKPT; - } - - nFree = get4byte(&pBt->pPage1->aData[36]); - nFin = finalDbSize(pBt, nOrig, nFree); - if( nFin>nOrig ) return SQLITE_CORRUPT_BKPT; - if( nFinnFin && rc==SQLITE_OK; iFree--){ - rc = incrVacuumStep(pBt, nFin, iFree, 1); - } - if( (rc==SQLITE_DONE || rc==SQLITE_OK) && nFree>0 ){ - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); - put4byte(&pBt->pPage1->aData[32], 0); - put4byte(&pBt->pPage1->aData[36], 0); - put4byte(&pBt->pPage1->aData[28], nFin); - pBt->bDoTruncate = 1; - pBt->nPage = nFin; - } - if( rc!=SQLITE_OK ){ - sqlite3PagerRollback(pPager); - } - } - - assert( nRef>=sqlite3PagerRefcount(pPager) ); - return rc; -} - -#else /* ifndef SQLITE_OMIT_AUTOVACUUM */ -# define setChildPtrmaps(x) SQLITE_OK -#endif - -/* -** This routine does the first phase of a two-phase commit. This routine -** causes a rollback journal to be created (if it does not already exist) -** and populated with enough information so that if a power loss occurs -** the database can be restored to its original state by playing back -** the journal. Then the contents of the journal are flushed out to -** the disk. After the journal is safely on oxide, the changes to the -** database are written into the database file and flushed to oxide. -** At the end of this call, the rollback journal still exists on the -** disk and we are still holding all locks, so the transaction has not -** committed. See sqlite3BtreeCommitPhaseTwo() for the second phase of the -** commit process. -** -** This call is a no-op if no write-transaction is currently active on pBt. -** -** Otherwise, sync the database file for the btree pBt. zMaster points to -** the name of a master journal file that should be written into the -** individual journal file, or is NULL, indicating no master journal file -** (single database transaction). -** -** When this is called, the master journal should already have been -** created, populated with this journal pointer and synced to disk. -** -** Once this is routine has returned, the only thing required to commit -** the write-transaction for this database file is to delete the journal. -*/ -SQLITE_PRIVATE int sqlite3BtreeCommitPhaseOne(Btree *p, const char *zMaster){ - int rc = SQLITE_OK; - if( p->inTrans==TRANS_WRITE ){ - BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); -#ifndef SQLITE_OMIT_AUTOVACUUM - if( pBt->autoVacuum ){ - rc = autoVacuumCommit(pBt); - if( rc!=SQLITE_OK ){ - sqlite3BtreeLeave(p); - return rc; - } - } - if( pBt->bDoTruncate ){ - sqlite3PagerTruncateImage(pBt->pPager, pBt->nPage); - } -#endif - rc = sqlite3PagerCommitPhaseOne(pBt->pPager, zMaster, 0); - sqlite3BtreeLeave(p); - } - return rc; -} - -/* -** This function is called from both BtreeCommitPhaseTwo() and BtreeRollback() -** at the conclusion of a transaction. -*/ -static void btreeEndTransaction(Btree *p){ - BtShared *pBt = p->pBt; - sqlite3 *db = p->db; - assert( sqlite3BtreeHoldsMutex(p) ); - -#ifndef SQLITE_OMIT_AUTOVACUUM - pBt->bDoTruncate = 0; -#endif - if( p->inTrans>TRANS_NONE && db->nVdbeRead>1 ){ - /* If there are other active statements that belong to this database - ** handle, downgrade to a read-only transaction. The other statements - ** may still be reading from the database. */ - downgradeAllSharedCacheTableLocks(p); - p->inTrans = TRANS_READ; - }else{ - /* If the handle had any kind of transaction open, decrement the - ** transaction count of the shared btree. If the transaction count - ** reaches 0, set the shared state to TRANS_NONE. The unlockBtreeIfUnused() - ** call below will unlock the pager. */ - if( p->inTrans!=TRANS_NONE ){ - clearAllSharedCacheTableLocks(p); - pBt->nTransaction--; - if( 0==pBt->nTransaction ){ - pBt->inTransaction = TRANS_NONE; - } - } - - /* Set the current transaction state to TRANS_NONE and unlock the - ** pager if this call closed the only read or write transaction. */ - p->inTrans = TRANS_NONE; - unlockBtreeIfUnused(pBt); - } - - btreeIntegrity(p); -} - -/* -** Commit the transaction currently in progress. -** -** This routine implements the second phase of a 2-phase commit. The -** sqlite3BtreeCommitPhaseOne() routine does the first phase and should -** be invoked prior to calling this routine. The sqlite3BtreeCommitPhaseOne() -** routine did all the work of writing information out to disk and flushing the -** contents so that they are written onto the disk platter. All this -** routine has to do is delete or truncate or zero the header in the -** the rollback journal (which causes the transaction to commit) and -** drop locks. -** -** Normally, if an error occurs while the pager layer is attempting to -** finalize the underlying journal file, this function returns an error and -** the upper layer will attempt a rollback. However, if the second argument -** is non-zero then this b-tree transaction is part of a multi-file -** transaction. In this case, the transaction has already been committed -** (by deleting a master journal file) and the caller will ignore this -** functions return code. So, even if an error occurs in the pager layer, -** reset the b-tree objects internal state to indicate that the write -** transaction has been closed. This is quite safe, as the pager will have -** transitioned to the error state. -** -** This will release the write lock on the database file. If there -** are no active cursors, it also releases the read lock. -*/ -SQLITE_PRIVATE int sqlite3BtreeCommitPhaseTwo(Btree *p, int bCleanup){ - - if( p->inTrans==TRANS_NONE ) return SQLITE_OK; - sqlite3BtreeEnter(p); - btreeIntegrity(p); - - /* If the handle has a write-transaction open, commit the shared-btrees - ** transaction and set the shared state to TRANS_READ. - */ - if( p->inTrans==TRANS_WRITE ){ - int rc; - BtShared *pBt = p->pBt; - assert( pBt->inTransaction==TRANS_WRITE ); - assert( pBt->nTransaction>0 ); - rc = sqlite3PagerCommitPhaseTwo(pBt->pPager); - if( rc!=SQLITE_OK && bCleanup==0 ){ - sqlite3BtreeLeave(p); - return rc; - } - pBt->inTransaction = TRANS_READ; - btreeClearHasContent(pBt); - } - - btreeEndTransaction(p); - sqlite3BtreeLeave(p); - return SQLITE_OK; -} - -/* -** Do both phases of a commit. -*/ -SQLITE_PRIVATE int sqlite3BtreeCommit(Btree *p){ - int rc; - sqlite3BtreeEnter(p); - rc = sqlite3BtreeCommitPhaseOne(p, 0); - if( rc==SQLITE_OK ){ - rc = sqlite3BtreeCommitPhaseTwo(p, 0); - } - sqlite3BtreeLeave(p); - return rc; -} - -/* -** This routine sets the state to CURSOR_FAULT and the error -** code to errCode for every cursor on BtShared that pBtree -** references. -** -** Every cursor is tripped, including cursors that belong -** to other database connections that happen to be sharing -** the cache with pBtree. -** -** This routine gets called when a rollback occurs. -** All cursors using the same cache must be tripped -** to prevent them from trying to use the btree after -** the rollback. The rollback may have deleted tables -** or moved root pages, so it is not sufficient to -** save the state of the cursor. The cursor must be -** invalidated. -*/ -SQLITE_PRIVATE void sqlite3BtreeTripAllCursors(Btree *pBtree, int errCode){ - BtCursor *p; - if( pBtree==0 ) return; - sqlite3BtreeEnter(pBtree); - for(p=pBtree->pBt->pCursor; p; p=p->pNext){ - int i; - sqlite3BtreeClearCursor(p); - p->eState = CURSOR_FAULT; - p->skipNext = errCode; - for(i=0; i<=p->iPage; i++){ - releasePage(p->apPage[i]); - p->apPage[i] = 0; - } - } - sqlite3BtreeLeave(pBtree); -} - -/* -** Rollback the transaction in progress. All cursors will be -** invalided by this operation. Any attempt to use a cursor -** that was open at the beginning of this operation will result -** in an error. -** -** This will release the write lock on the database file. If there -** are no active cursors, it also releases the read lock. -*/ -SQLITE_PRIVATE int sqlite3BtreeRollback(Btree *p, int tripCode){ - int rc; - BtShared *pBt = p->pBt; - MemPage *pPage1; - - sqlite3BtreeEnter(p); - if( tripCode==SQLITE_OK ){ - rc = tripCode = saveAllCursors(pBt, 0, 0); - }else{ - rc = SQLITE_OK; - } - if( tripCode ){ - sqlite3BtreeTripAllCursors(p, tripCode); - } - btreeIntegrity(p); - - if( p->inTrans==TRANS_WRITE ){ - int rc2; - - assert( TRANS_WRITE==pBt->inTransaction ); - rc2 = sqlite3PagerRollback(pBt->pPager); - if( rc2!=SQLITE_OK ){ - rc = rc2; - } - - /* The rollback may have destroyed the pPage1->aData value. So - ** call btreeGetPage() on page 1 again to make - ** sure pPage1->aData is set correctly. */ - if( btreeGetPage(pBt, 1, &pPage1, 0)==SQLITE_OK ){ - int nPage = get4byte(28+(u8*)pPage1->aData); - testcase( nPage==0 ); - if( nPage==0 ) sqlite3PagerPagecount(pBt->pPager, &nPage); - testcase( pBt->nPage!=nPage ); - pBt->nPage = nPage; - releasePage(pPage1); - } - assert( countValidCursors(pBt, 1)==0 ); - pBt->inTransaction = TRANS_READ; - btreeClearHasContent(pBt); - } - - btreeEndTransaction(p); - sqlite3BtreeLeave(p); - return rc; -} - -/* -** Start a statement subtransaction. The subtransaction can can be rolled -** back independently of the main transaction. You must start a transaction -** before starting a subtransaction. The subtransaction is ended automatically -** if the main transaction commits or rolls back. -** -** Statement subtransactions are used around individual SQL statements -** that are contained within a BEGIN...COMMIT block. If a constraint -** error occurs within the statement, the effect of that one statement -** can be rolled back without having to rollback the entire transaction. -** -** A statement sub-transaction is implemented as an anonymous savepoint. The -** value passed as the second parameter is the total number of savepoints, -** including the new anonymous savepoint, open on the B-Tree. i.e. if there -** are no active savepoints and no other statement-transactions open, -** iStatement is 1. This anonymous savepoint can be released or rolled back -** using the sqlite3BtreeSavepoint() function. -*/ -SQLITE_PRIVATE int sqlite3BtreeBeginStmt(Btree *p, int iStatement){ - int rc; - BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); - assert( p->inTrans==TRANS_WRITE ); - assert( (pBt->btsFlags & BTS_READ_ONLY)==0 ); - assert( iStatement>0 ); - assert( iStatement>p->db->nSavepoint ); - assert( pBt->inTransaction==TRANS_WRITE ); - /* At the pager level, a statement transaction is a savepoint with - ** an index greater than all savepoints created explicitly using - ** SQL statements. It is illegal to open, release or rollback any - ** such savepoints while the statement transaction savepoint is active. - */ - rc = sqlite3PagerOpenSavepoint(pBt->pPager, iStatement); - sqlite3BtreeLeave(p); - return rc; -} - -/* -** The second argument to this function, op, is always SAVEPOINT_ROLLBACK -** or SAVEPOINT_RELEASE. This function either releases or rolls back the -** savepoint identified by parameter iSavepoint, depending on the value -** of op. -** -** Normally, iSavepoint is greater than or equal to zero. However, if op is -** SAVEPOINT_ROLLBACK, then iSavepoint may also be -1. In this case the -** contents of the entire transaction are rolled back. This is different -** from a normal transaction rollback, as no locks are released and the -** transaction remains open. -*/ -SQLITE_PRIVATE int sqlite3BtreeSavepoint(Btree *p, int op, int iSavepoint){ - int rc = SQLITE_OK; - if( p && p->inTrans==TRANS_WRITE ){ - BtShared *pBt = p->pBt; - assert( op==SAVEPOINT_RELEASE || op==SAVEPOINT_ROLLBACK ); - assert( iSavepoint>=0 || (iSavepoint==-1 && op==SAVEPOINT_ROLLBACK) ); - sqlite3BtreeEnter(p); - rc = sqlite3PagerSavepoint(pBt->pPager, op, iSavepoint); - if( rc==SQLITE_OK ){ - if( iSavepoint<0 && (pBt->btsFlags & BTS_INITIALLY_EMPTY)!=0 ){ - pBt->nPage = 0; - } - rc = newDatabase(pBt); - pBt->nPage = get4byte(28 + pBt->pPage1->aData); - - /* The database size was written into the offset 28 of the header - ** when the transaction started, so we know that the value at offset - ** 28 is nonzero. */ - assert( pBt->nPage>0 ); - } - sqlite3BtreeLeave(p); - } - return rc; -} - -/* -** Create a new cursor for the BTree whose root is on the page -** iTable. If a read-only cursor is requested, it is assumed that -** the caller already has at least a read-only transaction open -** on the database already. If a write-cursor is requested, then -** the caller is assumed to have an open write transaction. -** -** If wrFlag==0, then the cursor can only be used for reading. -** If wrFlag==1, then the cursor can be used for reading or for -** writing if other conditions for writing are also met. These -** are the conditions that must be met in order for writing to -** be allowed: -** -** 1: The cursor must have been opened with wrFlag==1 -** -** 2: Other database connections that share the same pager cache -** but which are not in the READ_UNCOMMITTED state may not have -** cursors open with wrFlag==0 on the same table. Otherwise -** the changes made by this write cursor would be visible to -** the read cursors in the other database connection. -** -** 3: The database must be writable (not on read-only media) -** -** 4: There must be an active transaction. -** -** No checking is done to make sure that page iTable really is the -** root page of a b-tree. If it is not, then the cursor acquired -** will not work correctly. -** -** It is assumed that the sqlite3BtreeCursorZero() has been called -** on pCur to initialize the memory space prior to invoking this routine. -*/ -static int btreeCursor( - Btree *p, /* The btree */ - int iTable, /* Root page of table to open */ - int wrFlag, /* 1 to write. 0 read-only */ - struct KeyInfo *pKeyInfo, /* First arg to comparison function */ - BtCursor *pCur /* Space for new cursor */ -){ - BtShared *pBt = p->pBt; /* Shared b-tree handle */ - - assert( sqlite3BtreeHoldsMutex(p) ); - assert( wrFlag==0 || wrFlag==1 ); - - /* The following assert statements verify that if this is a sharable - ** b-tree database, the connection is holding the required table locks, - ** and that no other connection has any open cursor that conflicts with - ** this lock. */ - assert( hasSharedCacheTableLock(p, iTable, pKeyInfo!=0, wrFlag+1) ); - assert( wrFlag==0 || !hasReadConflicts(p, iTable) ); - - /* Assert that the caller has opened the required transaction. */ - assert( p->inTrans>TRANS_NONE ); - assert( wrFlag==0 || p->inTrans==TRANS_WRITE ); - assert( pBt->pPage1 && pBt->pPage1->aData ); - - if( NEVER(wrFlag && (pBt->btsFlags & BTS_READ_ONLY)!=0) ){ - return SQLITE_READONLY; - } - if( iTable==1 && btreePagecount(pBt)==0 ){ - assert( wrFlag==0 ); - iTable = 0; - } - - /* Now that no other errors can occur, finish filling in the BtCursor - ** variables and link the cursor into the BtShared list. */ - pCur->pgnoRoot = (Pgno)iTable; - pCur->iPage = -1; - pCur->pKeyInfo = pKeyInfo; - pCur->pBtree = p; - pCur->pBt = pBt; - pCur->wrFlag = (u8)wrFlag; - pCur->pNext = pBt->pCursor; - if( pCur->pNext ){ - pCur->pNext->pPrev = pCur; - } - pBt->pCursor = pCur; - pCur->eState = CURSOR_INVALID; - pCur->cachedRowid = 0; - return SQLITE_OK; -} -SQLITE_PRIVATE int sqlite3BtreeCursor( - Btree *p, /* The btree */ - int iTable, /* Root page of table to open */ - int wrFlag, /* 1 to write. 0 read-only */ - struct KeyInfo *pKeyInfo, /* First arg to xCompare() */ - BtCursor *pCur /* Write new cursor here */ -){ - int rc; - sqlite3BtreeEnter(p); - rc = btreeCursor(p, iTable, wrFlag, pKeyInfo, pCur); - sqlite3BtreeLeave(p); - return rc; -} - -/* -** Return the size of a BtCursor object in bytes. -** -** This interfaces is needed so that users of cursors can preallocate -** sufficient storage to hold a cursor. The BtCursor object is opaque -** to users so they cannot do the sizeof() themselves - they must call -** this routine. -*/ -SQLITE_PRIVATE int sqlite3BtreeCursorSize(void){ - return ROUND8(sizeof(BtCursor)); -} - -/* -** Initialize memory that will be converted into a BtCursor object. -** -** The simple approach here would be to memset() the entire object -** to zero. But it turns out that the apPage[] and aiIdx[] arrays -** do not need to be zeroed and they are large, so we can save a lot -** of run-time by skipping the initialization of those elements. -*/ -SQLITE_PRIVATE void sqlite3BtreeCursorZero(BtCursor *p){ - memset(p, 0, offsetof(BtCursor, iPage)); -} - -/* -** Set the cached rowid value of every cursor in the same database file -** as pCur and having the same root page number as pCur. The value is -** set to iRowid. -** -** Only positive rowid values are considered valid for this cache. -** The cache is initialized to zero, indicating an invalid cache. -** A btree will work fine with zero or negative rowids. We just cannot -** cache zero or negative rowids, which means tables that use zero or -** negative rowids might run a little slower. But in practice, zero -** or negative rowids are very uncommon so this should not be a problem. -*/ -SQLITE_PRIVATE void sqlite3BtreeSetCachedRowid(BtCursor *pCur, sqlite3_int64 iRowid){ - BtCursor *p; - for(p=pCur->pBt->pCursor; p; p=p->pNext){ - if( p->pgnoRoot==pCur->pgnoRoot ) p->cachedRowid = iRowid; - } - assert( pCur->cachedRowid==iRowid ); -} - -/* -** Return the cached rowid for the given cursor. A negative or zero -** return value indicates that the rowid cache is invalid and should be -** ignored. If the rowid cache has never before been set, then a -** zero is returned. -*/ -SQLITE_PRIVATE sqlite3_int64 sqlite3BtreeGetCachedRowid(BtCursor *pCur){ - return pCur->cachedRowid; -} - -/* -** Close a cursor. The read lock on the database file is released -** when the last cursor is closed. -*/ -SQLITE_PRIVATE int sqlite3BtreeCloseCursor(BtCursor *pCur){ - Btree *pBtree = pCur->pBtree; - if( pBtree ){ - int i; - BtShared *pBt = pCur->pBt; - sqlite3BtreeEnter(pBtree); - sqlite3BtreeClearCursor(pCur); - if( pCur->pPrev ){ - pCur->pPrev->pNext = pCur->pNext; - }else{ - pBt->pCursor = pCur->pNext; - } - if( pCur->pNext ){ - pCur->pNext->pPrev = pCur->pPrev; - } - for(i=0; i<=pCur->iPage; i++){ - releasePage(pCur->apPage[i]); - } - unlockBtreeIfUnused(pBt); - invalidateOverflowCache(pCur); - /* sqlite3_free(pCur); */ - sqlite3BtreeLeave(pBtree); - } - return SQLITE_OK; -} - -/* -** Make sure the BtCursor* given in the argument has a valid -** BtCursor.info structure. If it is not already valid, call -** btreeParseCell() to fill it in. -** -** BtCursor.info is a cache of the information in the current cell. -** Using this cache reduces the number of calls to btreeParseCell(). -** -** 2007-06-25: There is a bug in some versions of MSVC that cause the -** compiler to crash when getCellInfo() is implemented as a macro. -** But there is a measureable speed advantage to using the macro on gcc -** (when less compiler optimizations like -Os or -O0 are used and the -** compiler is not doing agressive inlining.) So we use a real function -** for MSVC and a macro for everything else. Ticket #2457. -*/ -#ifndef NDEBUG - static void assertCellInfo(BtCursor *pCur){ - CellInfo info; - int iPage = pCur->iPage; - memset(&info, 0, sizeof(info)); - btreeParseCell(pCur->apPage[iPage], pCur->aiIdx[iPage], &info); - assert( CORRUPT_DB || memcmp(&info, &pCur->info, sizeof(info))==0 ); - } -#else - #define assertCellInfo(x) -#endif -#ifdef _MSC_VER - /* Use a real function in MSVC to work around bugs in that compiler. */ - static void getCellInfo(BtCursor *pCur){ - if( pCur->info.nSize==0 ){ - int iPage = pCur->iPage; - btreeParseCell(pCur->apPage[iPage],pCur->aiIdx[iPage],&pCur->info); - pCur->validNKey = 1; - }else{ - assertCellInfo(pCur); - } - } -#else /* if not _MSC_VER */ - /* Use a macro in all other compilers so that the function is inlined */ -#define getCellInfo(pCur) \ - if( pCur->info.nSize==0 ){ \ - int iPage = pCur->iPage; \ - btreeParseCell(pCur->apPage[iPage],pCur->aiIdx[iPage],&pCur->info); \ - pCur->validNKey = 1; \ - }else{ \ - assertCellInfo(pCur); \ - } -#endif /* _MSC_VER */ - -#ifndef NDEBUG /* The next routine used only within assert() statements */ -/* -** Return true if the given BtCursor is valid. A valid cursor is one -** that is currently pointing to a row in a (non-empty) table. -** This is a verification routine is used only within assert() statements. -*/ -SQLITE_PRIVATE int sqlite3BtreeCursorIsValid(BtCursor *pCur){ - return pCur && pCur->eState==CURSOR_VALID; -} -#endif /* NDEBUG */ - -/* -** Set *pSize to the size of the buffer needed to hold the value of -** the key for the current entry. If the cursor is not pointing -** to a valid entry, *pSize is set to 0. -** -** For a table with the INTKEY flag set, this routine returns the key -** itself, not the number of bytes in the key. -** -** The caller must position the cursor prior to invoking this routine. -** -** This routine cannot fail. It always returns SQLITE_OK. -*/ -SQLITE_PRIVATE int sqlite3BtreeKeySize(BtCursor *pCur, i64 *pSize){ - assert( cursorHoldsMutex(pCur) ); - assert( pCur->eState==CURSOR_INVALID || pCur->eState==CURSOR_VALID ); - if( pCur->eState!=CURSOR_VALID ){ - *pSize = 0; - }else{ - getCellInfo(pCur); - *pSize = pCur->info.nKey; - } - return SQLITE_OK; -} - -/* -** Set *pSize to the number of bytes of data in the entry the -** cursor currently points to. -** -** The caller must guarantee that the cursor is pointing to a non-NULL -** valid entry. In other words, the calling procedure must guarantee -** that the cursor has Cursor.eState==CURSOR_VALID. -** -** Failure is not possible. This function always returns SQLITE_OK. -** It might just as well be a procedure (returning void) but we continue -** to return an integer result code for historical reasons. -*/ -SQLITE_PRIVATE int sqlite3BtreeDataSize(BtCursor *pCur, u32 *pSize){ - assert( cursorHoldsMutex(pCur) ); - assert( pCur->eState==CURSOR_VALID ); - getCellInfo(pCur); - *pSize = pCur->info.nData; - return SQLITE_OK; -} - -/* -** Given the page number of an overflow page in the database (parameter -** ovfl), this function finds the page number of the next page in the -** linked list of overflow pages. If possible, it uses the auto-vacuum -** pointer-map data instead of reading the content of page ovfl to do so. -** -** If an error occurs an SQLite error code is returned. Otherwise: -** -** The page number of the next overflow page in the linked list is -** written to *pPgnoNext. If page ovfl is the last page in its linked -** list, *pPgnoNext is set to zero. -** -** If ppPage is not NULL, and a reference to the MemPage object corresponding -** to page number pOvfl was obtained, then *ppPage is set to point to that -** reference. It is the responsibility of the caller to call releasePage() -** on *ppPage to free the reference. In no reference was obtained (because -** the pointer-map was used to obtain the value for *pPgnoNext), then -** *ppPage is set to zero. -*/ -static int getOverflowPage( - BtShared *pBt, /* The database file */ - Pgno ovfl, /* Current overflow page number */ - MemPage **ppPage, /* OUT: MemPage handle (may be NULL) */ - Pgno *pPgnoNext /* OUT: Next overflow page number */ -){ - Pgno next = 0; - MemPage *pPage = 0; - int rc = SQLITE_OK; - - assert( sqlite3_mutex_held(pBt->mutex) ); - assert(pPgnoNext); - -#ifndef SQLITE_OMIT_AUTOVACUUM - /* Try to find the next page in the overflow list using the - ** autovacuum pointer-map pages. Guess that the next page in - ** the overflow list is page number (ovfl+1). If that guess turns - ** out to be wrong, fall back to loading the data of page - ** number ovfl to determine the next page number. - */ - if( pBt->autoVacuum ){ - Pgno pgno; - Pgno iGuess = ovfl+1; - u8 eType; - - while( PTRMAP_ISPAGE(pBt, iGuess) || iGuess==PENDING_BYTE_PAGE(pBt) ){ - iGuess++; - } - - if( iGuess<=btreePagecount(pBt) ){ - rc = ptrmapGet(pBt, iGuess, &eType, &pgno); - if( rc==SQLITE_OK && eType==PTRMAP_OVERFLOW2 && pgno==ovfl ){ - next = iGuess; - rc = SQLITE_DONE; - } - } - } -#endif - - assert( next==0 || rc==SQLITE_DONE ); - if( rc==SQLITE_OK ){ - rc = btreeGetPage(pBt, ovfl, &pPage, (ppPage==0) ? PAGER_GET_READONLY : 0); - assert( rc==SQLITE_OK || pPage==0 ); - if( rc==SQLITE_OK ){ - next = get4byte(pPage->aData); - } - } - - *pPgnoNext = next; - if( ppPage ){ - *ppPage = pPage; - }else{ - releasePage(pPage); - } - return (rc==SQLITE_DONE ? SQLITE_OK : rc); -} - -/* -** Copy data from a buffer to a page, or from a page to a buffer. -** -** pPayload is a pointer to data stored on database page pDbPage. -** If argument eOp is false, then nByte bytes of data are copied -** from pPayload to the buffer pointed at by pBuf. If eOp is true, -** then sqlite3PagerWrite() is called on pDbPage and nByte bytes -** of data are copied from the buffer pBuf to pPayload. -** -** SQLITE_OK is returned on success, otherwise an error code. -*/ -static int copyPayload( - void *pPayload, /* Pointer to page data */ - void *pBuf, /* Pointer to buffer */ - int nByte, /* Number of bytes to copy */ - int eOp, /* 0 -> copy from page, 1 -> copy to page */ - DbPage *pDbPage /* Page containing pPayload */ -){ - if( eOp ){ - /* Copy data from buffer to page (a write operation) */ - int rc = sqlite3PagerWrite(pDbPage); - if( rc!=SQLITE_OK ){ - return rc; - } - memcpy(pPayload, pBuf, nByte); - }else{ - /* Copy data from page to buffer (a read operation) */ - memcpy(pBuf, pPayload, nByte); - } - return SQLITE_OK; -} - -/* -** This function is used to read or overwrite payload information -** for the entry that the pCur cursor is pointing to. If the eOp -** parameter is 0, this is a read operation (data copied into -** buffer pBuf). If it is non-zero, a write (data copied from -** buffer pBuf). -** -** A total of "amt" bytes are read or written beginning at "offset". -** Data is read to or from the buffer pBuf. -** -** The content being read or written might appear on the main page -** or be scattered out on multiple overflow pages. -** -** If the BtCursor.isIncrblobHandle flag is set, and the current -** cursor entry uses one or more overflow pages, this function -** allocates space for and lazily popluates the overflow page-list -** cache array (BtCursor.aOverflow). Subsequent calls use this -** cache to make seeking to the supplied offset more efficient. -** -** Once an overflow page-list cache has been allocated, it may be -** invalidated if some other cursor writes to the same table, or if -** the cursor is moved to a different row. Additionally, in auto-vacuum -** mode, the following events may invalidate an overflow page-list cache. -** -** * An incremental vacuum, -** * A commit in auto_vacuum="full" mode, -** * Creating a table (may require moving an overflow page). -*/ -static int accessPayload( - BtCursor *pCur, /* Cursor pointing to entry to read from */ - u32 offset, /* Begin reading this far into payload */ - u32 amt, /* Read this many bytes */ - unsigned char *pBuf, /* Write the bytes into this buffer */ - int eOp /* zero to read. non-zero to write. */ -){ - unsigned char *aPayload; - int rc = SQLITE_OK; - u32 nKey; - int iIdx = 0; - MemPage *pPage = pCur->apPage[pCur->iPage]; /* Btree page of current entry */ - BtShared *pBt = pCur->pBt; /* Btree this cursor belongs to */ - - assert( pPage ); - assert( pCur->eState==CURSOR_VALID ); - assert( pCur->aiIdx[pCur->iPage]nCell ); - assert( cursorHoldsMutex(pCur) ); - - getCellInfo(pCur); - aPayload = pCur->info.pCell + pCur->info.nHeader; - nKey = (pPage->intKey ? 0 : (int)pCur->info.nKey); - - if( NEVER(offset+amt > nKey+pCur->info.nData) - || &aPayload[pCur->info.nLocal] > &pPage->aData[pBt->usableSize] - ){ - /* Trying to read or write past the end of the data is an error */ - return SQLITE_CORRUPT_BKPT; - } - - /* Check if data must be read/written to/from the btree page itself. */ - if( offsetinfo.nLocal ){ - int a = amt; - if( a+offset>pCur->info.nLocal ){ - a = pCur->info.nLocal - offset; - } - rc = copyPayload(&aPayload[offset], pBuf, a, eOp, pPage->pDbPage); - offset = 0; - pBuf += a; - amt -= a; - }else{ - offset -= pCur->info.nLocal; - } - - if( rc==SQLITE_OK && amt>0 ){ - const u32 ovflSize = pBt->usableSize - 4; /* Bytes content per ovfl page */ - Pgno nextPage; - - nextPage = get4byte(&aPayload[pCur->info.nLocal]); - -#ifndef SQLITE_OMIT_INCRBLOB - /* If the isIncrblobHandle flag is set and the BtCursor.aOverflow[] - ** has not been allocated, allocate it now. The array is sized at - ** one entry for each overflow page in the overflow chain. The - ** page number of the first overflow page is stored in aOverflow[0], - ** etc. A value of 0 in the aOverflow[] array means "not yet known" - ** (the cache is lazily populated). - */ - if( pCur->isIncrblobHandle && !pCur->aOverflow ){ - int nOvfl = (pCur->info.nPayload-pCur->info.nLocal+ovflSize-1)/ovflSize; - pCur->aOverflow = (Pgno *)sqlite3MallocZero(sizeof(Pgno)*nOvfl); - /* nOvfl is always positive. If it were zero, fetchPayload would have - ** been used instead of this routine. */ - if( ALWAYS(nOvfl) && !pCur->aOverflow ){ - rc = SQLITE_NOMEM; - } - } - - /* If the overflow page-list cache has been allocated and the - ** entry for the first required overflow page is valid, skip - ** directly to it. - */ - if( pCur->aOverflow && pCur->aOverflow[offset/ovflSize] ){ - iIdx = (offset/ovflSize); - nextPage = pCur->aOverflow[iIdx]; - offset = (offset%ovflSize); - } -#endif - - for( ; rc==SQLITE_OK && amt>0 && nextPage; iIdx++){ - -#ifndef SQLITE_OMIT_INCRBLOB - /* If required, populate the overflow page-list cache. */ - if( pCur->aOverflow ){ - assert(!pCur->aOverflow[iIdx] || pCur->aOverflow[iIdx]==nextPage); - pCur->aOverflow[iIdx] = nextPage; - } -#endif - - if( offset>=ovflSize ){ - /* The only reason to read this page is to obtain the page - ** number for the next page in the overflow chain. The page - ** data is not required. So first try to lookup the overflow - ** page-list cache, if any, then fall back to the getOverflowPage() - ** function. - */ -#ifndef SQLITE_OMIT_INCRBLOB - if( pCur->aOverflow && pCur->aOverflow[iIdx+1] ){ - nextPage = pCur->aOverflow[iIdx+1]; - } else -#endif - rc = getOverflowPage(pBt, nextPage, 0, &nextPage); - offset -= ovflSize; - }else{ - /* Need to read this page properly. It contains some of the - ** range of data that is being read (eOp==0) or written (eOp!=0). - */ -#ifdef SQLITE_DIRECT_OVERFLOW_READ - sqlite3_file *fd; -#endif - int a = amt; - if( a + offset > ovflSize ){ - a = ovflSize - offset; - } - -#ifdef SQLITE_DIRECT_OVERFLOW_READ - /* If all the following are true: - ** - ** 1) this is a read operation, and - ** 2) data is required from the start of this overflow page, and - ** 3) the database is file-backed, and - ** 4) there is no open write-transaction, and - ** 5) the database is not a WAL database, - ** - ** then data can be read directly from the database file into the - ** output buffer, bypassing the page-cache altogether. This speeds - ** up loading large records that span many overflow pages. - */ - if( eOp==0 /* (1) */ - && offset==0 /* (2) */ - && pBt->inTransaction==TRANS_READ /* (4) */ - && (fd = sqlite3PagerFile(pBt->pPager))->pMethods /* (3) */ - && pBt->pPage1->aData[19]==0x01 /* (5) */ - ){ - u8 aSave[4]; - u8 *aWrite = &pBuf[-4]; - memcpy(aSave, aWrite, 4); - rc = sqlite3OsRead(fd, aWrite, a+4, (i64)pBt->pageSize*(nextPage-1)); - nextPage = get4byte(aWrite); - memcpy(aWrite, aSave, 4); - }else -#endif - - { - DbPage *pDbPage; - rc = sqlite3PagerAcquire(pBt->pPager, nextPage, &pDbPage, - (eOp==0 ? PAGER_GET_READONLY : 0) - ); - if( rc==SQLITE_OK ){ - aPayload = sqlite3PagerGetData(pDbPage); - nextPage = get4byte(aPayload); - rc = copyPayload(&aPayload[offset+4], pBuf, a, eOp, pDbPage); - sqlite3PagerUnref(pDbPage); - offset = 0; - } - } - amt -= a; - pBuf += a; - } - } - } - - if( rc==SQLITE_OK && amt>0 ){ - return SQLITE_CORRUPT_BKPT; - } - return rc; -} - -/* -** Read part of the key associated with cursor pCur. Exactly -** "amt" bytes will be transfered into pBuf[]. The transfer -** begins at "offset". -** -** The caller must ensure that pCur is pointing to a valid row -** in the table. -** -** Return SQLITE_OK on success or an error code if anything goes -** wrong. An error is returned if "offset+amt" is larger than -** the available payload. -*/ -SQLITE_PRIVATE int sqlite3BtreeKey(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){ - assert( cursorHoldsMutex(pCur) ); - assert( pCur->eState==CURSOR_VALID ); - assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] ); - assert( pCur->aiIdx[pCur->iPage]apPage[pCur->iPage]->nCell ); - return accessPayload(pCur, offset, amt, (unsigned char*)pBuf, 0); -} - -/* -** Read part of the data associated with cursor pCur. Exactly -** "amt" bytes will be transfered into pBuf[]. The transfer -** begins at "offset". -** -** Return SQLITE_OK on success or an error code if anything goes -** wrong. An error is returned if "offset+amt" is larger than -** the available payload. -*/ -SQLITE_PRIVATE int sqlite3BtreeData(BtCursor *pCur, u32 offset, u32 amt, void *pBuf){ - int rc; - -#ifndef SQLITE_OMIT_INCRBLOB - if ( pCur->eState==CURSOR_INVALID ){ - return SQLITE_ABORT; - } -#endif - - assert( cursorHoldsMutex(pCur) ); - rc = restoreCursorPosition(pCur); - if( rc==SQLITE_OK ){ - assert( pCur->eState==CURSOR_VALID ); - assert( pCur->iPage>=0 && pCur->apPage[pCur->iPage] ); - assert( pCur->aiIdx[pCur->iPage]apPage[pCur->iPage]->nCell ); - rc = accessPayload(pCur, offset, amt, pBuf, 0); - } - return rc; -} - -/* -** Return a pointer to payload information from the entry that the -** pCur cursor is pointing to. The pointer is to the beginning of -** the key if index btrees (pPage->intKey==0) and is the data for -** table btrees (pPage->intKey==1). The number of bytes of available -** key/data is written into *pAmt. If *pAmt==0, then the value -** returned will not be a valid pointer. -** -** This routine is an optimization. It is common for the entire key -** and data to fit on the local page and for there to be no overflow -** pages. When that is so, this routine can be used to access the -** key and data without making a copy. If the key and/or data spills -** onto overflow pages, then accessPayload() must be used to reassemble -** the key/data and copy it into a preallocated buffer. -** -** The pointer returned by this routine looks directly into the cached -** page of the database. The data might change or move the next time -** any btree routine is called. -*/ -static const void *fetchPayload( - BtCursor *pCur, /* Cursor pointing to entry to read from */ - u32 *pAmt /* Write the number of available bytes here */ -){ - assert( pCur!=0 && pCur->iPage>=0 && pCur->apPage[pCur->iPage]); - assert( pCur->eState==CURSOR_VALID ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - assert( cursorHoldsMutex(pCur) ); - assert( pCur->aiIdx[pCur->iPage]apPage[pCur->iPage]->nCell ); - if( pCur->info.nSize==0 ){ - btreeParseCell(pCur->apPage[pCur->iPage], pCur->aiIdx[pCur->iPage], - &pCur->info); - } - *pAmt = pCur->info.nLocal; - return (void*)(pCur->info.pCell + pCur->info.nHeader); -} - - -/* -** For the entry that cursor pCur is point to, return as -** many bytes of the key or data as are available on the local -** b-tree page. Write the number of available bytes into *pAmt. -** -** The pointer returned is ephemeral. The key/data may move -** or be destroyed on the next call to any Btree routine, -** including calls from other threads against the same cache. -** Hence, a mutex on the BtShared should be held prior to calling -** this routine. -** -** These routines is used to get quick access to key and data -** in the common case where no overflow pages are used. -*/ -SQLITE_PRIVATE const void *sqlite3BtreeKeyFetch(BtCursor *pCur, u32 *pAmt){ - return fetchPayload(pCur, pAmt); -} -SQLITE_PRIVATE const void *sqlite3BtreeDataFetch(BtCursor *pCur, u32 *pAmt){ - return fetchPayload(pCur, pAmt); -} - - -/* -** Move the cursor down to a new child page. The newPgno argument is the -** page number of the child page to move to. -** -** This function returns SQLITE_CORRUPT if the page-header flags field of -** the new child page does not match the flags field of the parent (i.e. -** if an intkey page appears to be the parent of a non-intkey page, or -** vice-versa). -*/ -static int moveToChild(BtCursor *pCur, u32 newPgno){ - int rc; - int i = pCur->iPage; - MemPage *pNewPage; - BtShared *pBt = pCur->pBt; - - assert( cursorHoldsMutex(pCur) ); - assert( pCur->eState==CURSOR_VALID ); - assert( pCur->iPageiPage>=0 ); - if( pCur->iPage>=(BTCURSOR_MAX_DEPTH-1) ){ - return SQLITE_CORRUPT_BKPT; - } - rc = getAndInitPage(pBt, newPgno, &pNewPage, - pCur->wrFlag==0 ? PAGER_GET_READONLY : 0); - if( rc ) return rc; - pCur->apPage[i+1] = pNewPage; - pCur->aiIdx[i+1] = 0; - pCur->iPage++; - - pCur->info.nSize = 0; - pCur->validNKey = 0; - if( pNewPage->nCell<1 || pNewPage->intKey!=pCur->apPage[i]->intKey ){ - return SQLITE_CORRUPT_BKPT; - } - return SQLITE_OK; -} - -#if 0 -/* -** Page pParent is an internal (non-leaf) tree page. This function -** asserts that page number iChild is the left-child if the iIdx'th -** cell in page pParent. Or, if iIdx is equal to the total number of -** cells in pParent, that page number iChild is the right-child of -** the page. -*/ -static void assertParentIndex(MemPage *pParent, int iIdx, Pgno iChild){ - assert( iIdx<=pParent->nCell ); - if( iIdx==pParent->nCell ){ - assert( get4byte(&pParent->aData[pParent->hdrOffset+8])==iChild ); - }else{ - assert( get4byte(findCell(pParent, iIdx))==iChild ); - } -} -#else -# define assertParentIndex(x,y,z) -#endif - -/* -** Move the cursor up to the parent page. -** -** pCur->idx is set to the cell index that contains the pointer -** to the page we are coming from. If we are coming from the -** right-most child page then pCur->idx is set to one more than -** the largest cell index. -*/ -static void moveToParent(BtCursor *pCur){ - assert( cursorHoldsMutex(pCur) ); - assert( pCur->eState==CURSOR_VALID ); - assert( pCur->iPage>0 ); - assert( pCur->apPage[pCur->iPage] ); - - /* UPDATE: It is actually possible for the condition tested by the assert - ** below to be untrue if the database file is corrupt. This can occur if - ** one cursor has modified page pParent while a reference to it is held - ** by a second cursor. Which can only happen if a single page is linked - ** into more than one b-tree structure in a corrupt database. */ -#if 0 - assertParentIndex( - pCur->apPage[pCur->iPage-1], - pCur->aiIdx[pCur->iPage-1], - pCur->apPage[pCur->iPage]->pgno - ); -#endif - testcase( pCur->aiIdx[pCur->iPage-1] > pCur->apPage[pCur->iPage-1]->nCell ); - - releasePage(pCur->apPage[pCur->iPage]); - pCur->iPage--; - pCur->info.nSize = 0; - pCur->validNKey = 0; -} - -/* -** Move the cursor to point to the root page of its b-tree structure. -** -** If the table has a virtual root page, then the cursor is moved to point -** to the virtual root page instead of the actual root page. A table has a -** virtual root page when the actual root page contains no cells and a -** single child page. This can only happen with the table rooted at page 1. -** -** If the b-tree structure is empty, the cursor state is set to -** CURSOR_INVALID. Otherwise, the cursor is set to point to the first -** cell located on the root (or virtual root) page and the cursor state -** is set to CURSOR_VALID. -** -** If this function returns successfully, it may be assumed that the -** page-header flags indicate that the [virtual] root-page is the expected -** kind of b-tree page (i.e. if when opening the cursor the caller did not -** specify a KeyInfo structure the flags byte is set to 0x05 or 0x0D, -** indicating a table b-tree, or if the caller did specify a KeyInfo -** structure the flags byte is set to 0x02 or 0x0A, indicating an index -** b-tree). -*/ -static int moveToRoot(BtCursor *pCur){ - MemPage *pRoot; - int rc = SQLITE_OK; - - assert( cursorHoldsMutex(pCur) ); - assert( CURSOR_INVALID < CURSOR_REQUIRESEEK ); - assert( CURSOR_VALID < CURSOR_REQUIRESEEK ); - assert( CURSOR_FAULT > CURSOR_REQUIRESEEK ); - if( pCur->eState>=CURSOR_REQUIRESEEK ){ - if( pCur->eState==CURSOR_FAULT ){ - assert( pCur->skipNext!=SQLITE_OK ); - return pCur->skipNext; - } - sqlite3BtreeClearCursor(pCur); - } - - if( pCur->iPage>=0 ){ - while( pCur->iPage ) releasePage(pCur->apPage[pCur->iPage--]); - }else if( pCur->pgnoRoot==0 ){ - pCur->eState = CURSOR_INVALID; - return SQLITE_OK; - }else{ - rc = getAndInitPage(pCur->pBtree->pBt, pCur->pgnoRoot, &pCur->apPage[0], - pCur->wrFlag==0 ? PAGER_GET_READONLY : 0); - if( rc!=SQLITE_OK ){ - pCur->eState = CURSOR_INVALID; - return rc; - } - pCur->iPage = 0; - } - pRoot = pCur->apPage[0]; - assert( pRoot->pgno==pCur->pgnoRoot ); - - /* If pCur->pKeyInfo is not NULL, then the caller that opened this cursor - ** expected to open it on an index b-tree. Otherwise, if pKeyInfo is - ** NULL, the caller expects a table b-tree. If this is not the case, - ** return an SQLITE_CORRUPT error. - ** - ** Earlier versions of SQLite assumed that this test could not fail - ** if the root page was already loaded when this function was called (i.e. - ** if pCur->iPage>=0). But this is not so if the database is corrupted - ** in such a way that page pRoot is linked into a second b-tree table - ** (or the freelist). */ - assert( pRoot->intKey==1 || pRoot->intKey==0 ); - if( pRoot->isInit==0 || (pCur->pKeyInfo==0)!=pRoot->intKey ){ - return SQLITE_CORRUPT_BKPT; - } - - pCur->aiIdx[0] = 0; - pCur->info.nSize = 0; - pCur->atLast = 0; - pCur->validNKey = 0; - - if( pRoot->nCell>0 ){ - pCur->eState = CURSOR_VALID; - }else if( !pRoot->leaf ){ - Pgno subpage; - if( pRoot->pgno!=1 ) return SQLITE_CORRUPT_BKPT; - subpage = get4byte(&pRoot->aData[pRoot->hdrOffset+8]); - pCur->eState = CURSOR_VALID; - rc = moveToChild(pCur, subpage); - }else{ - pCur->eState = CURSOR_INVALID; - } - return rc; -} - -/* -** Move the cursor down to the left-most leaf entry beneath the -** entry to which it is currently pointing. -** -** The left-most leaf is the one with the smallest key - the first -** in ascending order. -*/ -static int moveToLeftmost(BtCursor *pCur){ - Pgno pgno; - int rc = SQLITE_OK; - MemPage *pPage; - - assert( cursorHoldsMutex(pCur) ); - assert( pCur->eState==CURSOR_VALID ); - while( rc==SQLITE_OK && !(pPage = pCur->apPage[pCur->iPage])->leaf ){ - assert( pCur->aiIdx[pCur->iPage]nCell ); - pgno = get4byte(findCell(pPage, pCur->aiIdx[pCur->iPage])); - rc = moveToChild(pCur, pgno); - } - return rc; -} - -/* -** Move the cursor down to the right-most leaf entry beneath the -** page to which it is currently pointing. Notice the difference -** between moveToLeftmost() and moveToRightmost(). moveToLeftmost() -** finds the left-most entry beneath the *entry* whereas moveToRightmost() -** finds the right-most entry beneath the *page*. -** -** The right-most entry is the one with the largest key - the last -** key in ascending order. -*/ -static int moveToRightmost(BtCursor *pCur){ - Pgno pgno; - int rc = SQLITE_OK; - MemPage *pPage = 0; - - assert( cursorHoldsMutex(pCur) ); - assert( pCur->eState==CURSOR_VALID ); - while( rc==SQLITE_OK && !(pPage = pCur->apPage[pCur->iPage])->leaf ){ - pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]); - pCur->aiIdx[pCur->iPage] = pPage->nCell; - rc = moveToChild(pCur, pgno); - } - if( rc==SQLITE_OK ){ - pCur->aiIdx[pCur->iPage] = pPage->nCell-1; - pCur->info.nSize = 0; - pCur->validNKey = 0; - } - return rc; -} - -/* Move the cursor to the first entry in the table. Return SQLITE_OK -** on success. Set *pRes to 0 if the cursor actually points to something -** or set *pRes to 1 if the table is empty. -*/ -SQLITE_PRIVATE int sqlite3BtreeFirst(BtCursor *pCur, int *pRes){ - int rc; - - assert( cursorHoldsMutex(pCur) ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - rc = moveToRoot(pCur); - if( rc==SQLITE_OK ){ - if( pCur->eState==CURSOR_INVALID ){ - assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 ); - *pRes = 1; - }else{ - assert( pCur->apPage[pCur->iPage]->nCell>0 ); - *pRes = 0; - rc = moveToLeftmost(pCur); - } - } - return rc; -} - -/* Move the cursor to the last entry in the table. Return SQLITE_OK -** on success. Set *pRes to 0 if the cursor actually points to something -** or set *pRes to 1 if the table is empty. -*/ -SQLITE_PRIVATE int sqlite3BtreeLast(BtCursor *pCur, int *pRes){ - int rc; - - assert( cursorHoldsMutex(pCur) ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - - /* If the cursor already points to the last entry, this is a no-op. */ - if( CURSOR_VALID==pCur->eState && pCur->atLast ){ -#ifdef SQLITE_DEBUG - /* This block serves to assert() that the cursor really does point - ** to the last entry in the b-tree. */ - int ii; - for(ii=0; iiiPage; ii++){ - assert( pCur->aiIdx[ii]==pCur->apPage[ii]->nCell ); - } - assert( pCur->aiIdx[pCur->iPage]==pCur->apPage[pCur->iPage]->nCell-1 ); - assert( pCur->apPage[pCur->iPage]->leaf ); -#endif - return SQLITE_OK; - } - - rc = moveToRoot(pCur); - if( rc==SQLITE_OK ){ - if( CURSOR_INVALID==pCur->eState ){ - assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 ); - *pRes = 1; - }else{ - assert( pCur->eState==CURSOR_VALID ); - *pRes = 0; - rc = moveToRightmost(pCur); - pCur->atLast = rc==SQLITE_OK ?1:0; - } - } - return rc; -} - -/* Move the cursor so that it points to an entry near the key -** specified by pIdxKey or intKey. Return a success code. -** -** For INTKEY tables, the intKey parameter is used. pIdxKey -** must be NULL. For index tables, pIdxKey is used and intKey -** is ignored. -** -** If an exact match is not found, then the cursor is always -** left pointing at a leaf page which would hold the entry if it -** were present. The cursor might point to an entry that comes -** before or after the key. -** -** An integer is written into *pRes which is the result of -** comparing the key with the entry to which the cursor is -** pointing. The meaning of the integer written into -** *pRes is as follows: -** -** *pRes<0 The cursor is left pointing at an entry that -** is smaller than intKey/pIdxKey or if the table is empty -** and the cursor is therefore left point to nothing. -** -** *pRes==0 The cursor is left pointing at an entry that -** exactly matches intKey/pIdxKey. -** -** *pRes>0 The cursor is left pointing at an entry that -** is larger than intKey/pIdxKey. -** -*/ -SQLITE_PRIVATE int sqlite3BtreeMovetoUnpacked( - BtCursor *pCur, /* The cursor to be moved */ - UnpackedRecord *pIdxKey, /* Unpacked index key */ - i64 intKey, /* The table key */ - int biasRight, /* If true, bias the search to the high end */ - int *pRes /* Write search results here */ -){ - int rc; - - assert( cursorHoldsMutex(pCur) ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - assert( pRes ); - assert( (pIdxKey==0)==(pCur->pKeyInfo==0) ); - - /* If the cursor is already positioned at the point we are trying - ** to move to, then just return without doing any work */ - if( pCur->eState==CURSOR_VALID && pCur->validNKey - && pCur->apPage[0]->intKey - ){ - if( pCur->info.nKey==intKey ){ - *pRes = 0; - return SQLITE_OK; - } - if( pCur->atLast && pCur->info.nKeypgnoRoot==0 || pCur->apPage[pCur->iPage] ); - assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->isInit ); - assert( pCur->eState==CURSOR_INVALID || pCur->apPage[pCur->iPage]->nCell>0 ); - if( pCur->eState==CURSOR_INVALID ){ - *pRes = -1; - assert( pCur->pgnoRoot==0 || pCur->apPage[pCur->iPage]->nCell==0 ); - return SQLITE_OK; - } - assert( pCur->apPage[0]->intKey || pIdxKey ); - for(;;){ - int lwr, upr, idx, c; - Pgno chldPg; - MemPage *pPage = pCur->apPage[pCur->iPage]; - u8 *pCell; /* Pointer to current cell in pPage */ - - /* pPage->nCell must be greater than zero. If this is the root-page - ** the cursor would have been INVALID above and this for(;;) loop - ** not run. If this is not the root-page, then the moveToChild() routine - ** would have already detected db corruption. Similarly, pPage must - ** be the right kind (index or table) of b-tree page. Otherwise - ** a moveToChild() or moveToRoot() call would have detected corruption. */ - assert( pPage->nCell>0 ); - assert( pPage->intKey==(pIdxKey==0) ); - lwr = 0; - upr = pPage->nCell-1; - assert( biasRight==0 || biasRight==1 ); - idx = upr>>(1-biasRight); /* idx = biasRight ? upr : (lwr+upr)/2; */ - pCur->aiIdx[pCur->iPage] = (u16)idx; - if( pPage->intKey ){ - for(;;){ - i64 nCellKey; - pCell = findCell(pPage, idx) + pPage->childPtrSize; - if( pPage->hasData ){ - while( 0x80 <= *(pCell++) ){ - if( pCell>=pPage->aDataEnd ) return SQLITE_CORRUPT_BKPT; - } - } - getVarint(pCell, (u64*)&nCellKey); - if( nCellKeyupr ){ c = -1; break; } - }else if( nCellKey>intKey ){ - upr = idx-1; - if( lwr>upr ){ c = +1; break; } - }else{ - assert( nCellKey==intKey ); - pCur->validNKey = 1; - pCur->info.nKey = nCellKey; - pCur->aiIdx[pCur->iPage] = (u16)idx; - if( !pPage->leaf ){ - lwr = idx; - goto moveto_next_layer; - }else{ - *pRes = 0; - rc = SQLITE_OK; - goto moveto_finish; - } - } - assert( lwr+upr>=0 ); - idx = (lwr+upr)>>1; /* idx = (lwr+upr)/2; */ - } - }else{ - for(;;){ - int nCell; - pCell = findCell(pPage, idx) + pPage->childPtrSize; - - /* The maximum supported page-size is 65536 bytes. This means that - ** the maximum number of record bytes stored on an index B-Tree - ** page is less than 16384 bytes and may be stored as a 2-byte - ** varint. This information is used to attempt to avoid parsing - ** the entire cell by checking for the cases where the record is - ** stored entirely within the b-tree page by inspecting the first - ** 2 bytes of the cell. - */ - nCell = pCell[0]; - if( nCell<=pPage->max1bytePayload ){ - /* This branch runs if the record-size field of the cell is a - ** single byte varint and the record fits entirely on the main - ** b-tree page. */ - testcase( pCell+nCell+1==pPage->aDataEnd ); - c = sqlite3VdbeRecordCompare(nCell, (void*)&pCell[1], pIdxKey); - }else if( !(pCell[1] & 0x80) - && (nCell = ((nCell&0x7f)<<7) + pCell[1])<=pPage->maxLocal - ){ - /* The record-size field is a 2 byte varint and the record - ** fits entirely on the main b-tree page. */ - testcase( pCell+nCell+2==pPage->aDataEnd ); - c = sqlite3VdbeRecordCompare(nCell, (void*)&pCell[2], pIdxKey); - }else{ - /* The record flows over onto one or more overflow pages. In - ** this case the whole cell needs to be parsed, a buffer allocated - ** and accessPayload() used to retrieve the record into the - ** buffer before VdbeRecordCompare() can be called. */ - void *pCellKey; - u8 * const pCellBody = pCell - pPage->childPtrSize; - btreeParseCellPtr(pPage, pCellBody, &pCur->info); - nCell = (int)pCur->info.nKey; - pCellKey = sqlite3Malloc( nCell ); - if( pCellKey==0 ){ - rc = SQLITE_NOMEM; - goto moveto_finish; - } - pCur->aiIdx[pCur->iPage] = (u16)idx; - rc = accessPayload(pCur, 0, nCell, (unsigned char*)pCellKey, 0); - if( rc ){ - sqlite3_free(pCellKey); - goto moveto_finish; - } - c = sqlite3VdbeRecordCompare(nCell, pCellKey, pIdxKey); - sqlite3_free(pCellKey); - } - if( c<0 ){ - lwr = idx+1; - }else if( c>0 ){ - upr = idx-1; - }else{ - assert( c==0 ); - *pRes = 0; - rc = SQLITE_OK; - pCur->aiIdx[pCur->iPage] = (u16)idx; - goto moveto_finish; - } - if( lwr>upr ) break; - assert( lwr+upr>=0 ); - idx = (lwr+upr)>>1; /* idx = (lwr+upr)/2 */ - } - } - assert( lwr==upr+1 || (pPage->intKey && !pPage->leaf) ); - assert( pPage->isInit ); - if( pPage->leaf ){ - assert( pCur->aiIdx[pCur->iPage]apPage[pCur->iPage]->nCell ); - pCur->aiIdx[pCur->iPage] = (u16)idx; - *pRes = c; - rc = SQLITE_OK; - goto moveto_finish; - } -moveto_next_layer: - if( lwr>=pPage->nCell ){ - chldPg = get4byte(&pPage->aData[pPage->hdrOffset+8]); - }else{ - chldPg = get4byte(findCell(pPage, lwr)); - } - pCur->aiIdx[pCur->iPage] = (u16)lwr; - rc = moveToChild(pCur, chldPg); - if( rc ) break; - } -moveto_finish: - pCur->info.nSize = 0; - pCur->validNKey = 0; - return rc; -} - - -/* -** Return TRUE if the cursor is not pointing at an entry of the table. -** -** TRUE will be returned after a call to sqlite3BtreeNext() moves -** past the last entry in the table or sqlite3BtreePrev() moves past -** the first entry. TRUE is also returned if the table is empty. -*/ -SQLITE_PRIVATE int sqlite3BtreeEof(BtCursor *pCur){ - /* TODO: What if the cursor is in CURSOR_REQUIRESEEK but all table entries - ** have been deleted? This API will need to change to return an error code - ** as well as the boolean result value. - */ - return (CURSOR_VALID!=pCur->eState); -} - -/* -** Advance the cursor to the next entry in the database. If -** successful then set *pRes=0. If the cursor -** was already pointing to the last entry in the database before -** this routine was called, then set *pRes=1. -*/ -SQLITE_PRIVATE int sqlite3BtreeNext(BtCursor *pCur, int *pRes){ - int rc; - int idx; - MemPage *pPage; - - assert( cursorHoldsMutex(pCur) ); - assert( pRes!=0 ); - assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID ); - if( pCur->eState!=CURSOR_VALID ){ - rc = restoreCursorPosition(pCur); - if( rc!=SQLITE_OK ){ - *pRes = 0; - return rc; - } - if( CURSOR_INVALID==pCur->eState ){ - *pRes = 1; - return SQLITE_OK; - } - if( pCur->skipNext ){ - assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT ); - pCur->eState = CURSOR_VALID; - if( pCur->skipNext>0 ){ - pCur->skipNext = 0; - *pRes = 0; - return SQLITE_OK; - } - pCur->skipNext = 0; - } - } - - pPage = pCur->apPage[pCur->iPage]; - idx = ++pCur->aiIdx[pCur->iPage]; - assert( pPage->isInit ); - - /* If the database file is corrupt, it is possible for the value of idx - ** to be invalid here. This can only occur if a second cursor modifies - ** the page while cursor pCur is holding a reference to it. Which can - ** only happen if the database is corrupt in such a way as to link the - ** page into more than one b-tree structure. */ - testcase( idx>pPage->nCell ); - - pCur->info.nSize = 0; - pCur->validNKey = 0; - if( idx>=pPage->nCell ){ - if( !pPage->leaf ){ - rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8])); - if( rc ){ - *pRes = 0; - return rc; - } - rc = moveToLeftmost(pCur); - *pRes = 0; - return rc; - } - do{ - if( pCur->iPage==0 ){ - *pRes = 1; - pCur->eState = CURSOR_INVALID; - return SQLITE_OK; - } - moveToParent(pCur); - pPage = pCur->apPage[pCur->iPage]; - }while( pCur->aiIdx[pCur->iPage]>=pPage->nCell ); - *pRes = 0; - if( pPage->intKey ){ - rc = sqlite3BtreeNext(pCur, pRes); - }else{ - rc = SQLITE_OK; - } - return rc; - } - *pRes = 0; - if( pPage->leaf ){ - return SQLITE_OK; - } - rc = moveToLeftmost(pCur); - return rc; -} - - -/* -** Step the cursor to the back to the previous entry in the database. If -** successful then set *pRes=0. If the cursor -** was already pointing to the first entry in the database before -** this routine was called, then set *pRes=1. -*/ -SQLITE_PRIVATE int sqlite3BtreePrevious(BtCursor *pCur, int *pRes){ - int rc; - MemPage *pPage; - - assert( cursorHoldsMutex(pCur) ); - assert( pRes!=0 ); - assert( pCur->skipNext==0 || pCur->eState!=CURSOR_VALID ); - pCur->atLast = 0; - if( pCur->eState!=CURSOR_VALID ){ - if( ALWAYS(pCur->eState>=CURSOR_REQUIRESEEK) ){ - rc = btreeRestoreCursorPosition(pCur); - if( rc!=SQLITE_OK ){ - *pRes = 0; - return rc; - } - } - if( CURSOR_INVALID==pCur->eState ){ - *pRes = 1; - return SQLITE_OK; - } - if( pCur->skipNext ){ - assert( pCur->eState==CURSOR_VALID || pCur->eState==CURSOR_SKIPNEXT ); - pCur->eState = CURSOR_VALID; - if( pCur->skipNext<0 ){ - pCur->skipNext = 0; - *pRes = 0; - return SQLITE_OK; - } - pCur->skipNext = 0; - } - } - - pPage = pCur->apPage[pCur->iPage]; - assert( pPage->isInit ); - if( !pPage->leaf ){ - int idx = pCur->aiIdx[pCur->iPage]; - rc = moveToChild(pCur, get4byte(findCell(pPage, idx))); - if( rc ){ - *pRes = 0; - return rc; - } - rc = moveToRightmost(pCur); - }else{ - while( pCur->aiIdx[pCur->iPage]==0 ){ - if( pCur->iPage==0 ){ - pCur->eState = CURSOR_INVALID; - *pRes = 1; - return SQLITE_OK; - } - moveToParent(pCur); - } - pCur->info.nSize = 0; - pCur->validNKey = 0; - - pCur->aiIdx[pCur->iPage]--; - pPage = pCur->apPage[pCur->iPage]; - if( pPage->intKey && !pPage->leaf ){ - rc = sqlite3BtreePrevious(pCur, pRes); - }else{ - rc = SQLITE_OK; - } - } - *pRes = 0; - return rc; -} - -/* -** Allocate a new page from the database file. -** -** The new page is marked as dirty. (In other words, sqlite3PagerWrite() -** has already been called on the new page.) The new page has also -** been referenced and the calling routine is responsible for calling -** sqlite3PagerUnref() on the new page when it is done. -** -** SQLITE_OK is returned on success. Any other return value indicates -** an error. *ppPage and *pPgno are undefined in the event of an error. -** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned. -** -** If the "nearby" parameter is not 0, then an effort is made to -** locate a page close to the page number "nearby". This can be used in an -** attempt to keep related pages close to each other in the database file, -** which in turn can make database access faster. -** -** If the eMode parameter is BTALLOC_EXACT and the nearby page exists -** anywhere on the free-list, then it is guaranteed to be returned. If -** eMode is BTALLOC_LT then the page returned will be less than or equal -** to nearby if any such page exists. If eMode is BTALLOC_ANY then there -** are no restrictions on which page is returned. -*/ -static int allocateBtreePage( - BtShared *pBt, /* The btree */ - MemPage **ppPage, /* Store pointer to the allocated page here */ - Pgno *pPgno, /* Store the page number here */ - Pgno nearby, /* Search for a page near this one */ - u8 eMode /* BTALLOC_EXACT, BTALLOC_LT, or BTALLOC_ANY */ -){ - MemPage *pPage1; - int rc; - u32 n; /* Number of pages on the freelist */ - u32 k; /* Number of leaves on the trunk of the freelist */ - MemPage *pTrunk = 0; - MemPage *pPrevTrunk = 0; - Pgno mxPage; /* Total size of the database file */ - - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( eMode==BTALLOC_ANY || (nearby>0 && IfNotOmitAV(pBt->autoVacuum)) ); - pPage1 = pBt->pPage1; - mxPage = btreePagecount(pBt); - n = get4byte(&pPage1->aData[36]); - testcase( n==mxPage-1 ); - if( n>=mxPage ){ - return SQLITE_CORRUPT_BKPT; - } - if( n>0 ){ - /* There are pages on the freelist. Reuse one of those pages. */ - Pgno iTrunk; - u8 searchList = 0; /* If the free-list must be searched for 'nearby' */ - - /* If eMode==BTALLOC_EXACT and a query of the pointer-map - ** shows that the page 'nearby' is somewhere on the free-list, then - ** the entire-list will be searched for that page. - */ -#ifndef SQLITE_OMIT_AUTOVACUUM - if( eMode==BTALLOC_EXACT ){ - if( nearby<=mxPage ){ - u8 eType; - assert( nearby>0 ); - assert( pBt->autoVacuum ); - rc = ptrmapGet(pBt, nearby, &eType, 0); - if( rc ) return rc; - if( eType==PTRMAP_FREEPAGE ){ - searchList = 1; - } - } - }else if( eMode==BTALLOC_LE ){ - searchList = 1; - } -#endif - - /* Decrement the free-list count by 1. Set iTrunk to the index of the - ** first free-list trunk page. iPrevTrunk is initially 1. - */ - rc = sqlite3PagerWrite(pPage1->pDbPage); - if( rc ) return rc; - put4byte(&pPage1->aData[36], n-1); - - /* The code within this loop is run only once if the 'searchList' variable - ** is not true. Otherwise, it runs once for each trunk-page on the - ** free-list until the page 'nearby' is located (eMode==BTALLOC_EXACT) - ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT) - */ - do { - pPrevTrunk = pTrunk; - if( pPrevTrunk ){ - iTrunk = get4byte(&pPrevTrunk->aData[0]); - }else{ - iTrunk = get4byte(&pPage1->aData[32]); - } - testcase( iTrunk==mxPage ); - if( iTrunk>mxPage ){ - rc = SQLITE_CORRUPT_BKPT; - }else{ - rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0); - } - if( rc ){ - pTrunk = 0; - goto end_allocate_page; - } - assert( pTrunk!=0 ); - assert( pTrunk->aData!=0 ); - - k = get4byte(&pTrunk->aData[4]); /* # of leaves on this trunk page */ - if( k==0 && !searchList ){ - /* The trunk has no leaves and the list is not being searched. - ** So extract the trunk page itself and use it as the newly - ** allocated page */ - assert( pPrevTrunk==0 ); - rc = sqlite3PagerWrite(pTrunk->pDbPage); - if( rc ){ - goto end_allocate_page; - } - *pPgno = iTrunk; - memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4); - *ppPage = pTrunk; - pTrunk = 0; - TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1)); - }else if( k>(u32)(pBt->usableSize/4 - 2) ){ - /* Value of k is out of range. Database corruption */ - rc = SQLITE_CORRUPT_BKPT; - goto end_allocate_page; -#ifndef SQLITE_OMIT_AUTOVACUUM - }else if( searchList - && (nearby==iTrunk || (iTrunkpDbPage); - if( rc ){ - goto end_allocate_page; - } - if( k==0 ){ - if( !pPrevTrunk ){ - memcpy(&pPage1->aData[32], &pTrunk->aData[0], 4); - }else{ - rc = sqlite3PagerWrite(pPrevTrunk->pDbPage); - if( rc!=SQLITE_OK ){ - goto end_allocate_page; - } - memcpy(&pPrevTrunk->aData[0], &pTrunk->aData[0], 4); - } - }else{ - /* The trunk page is required by the caller but it contains - ** pointers to free-list leaves. The first leaf becomes a trunk - ** page in this case. - */ - MemPage *pNewTrunk; - Pgno iNewTrunk = get4byte(&pTrunk->aData[8]); - if( iNewTrunk>mxPage ){ - rc = SQLITE_CORRUPT_BKPT; - goto end_allocate_page; - } - testcase( iNewTrunk==mxPage ); - rc = btreeGetPage(pBt, iNewTrunk, &pNewTrunk, 0); - if( rc!=SQLITE_OK ){ - goto end_allocate_page; - } - rc = sqlite3PagerWrite(pNewTrunk->pDbPage); - if( rc!=SQLITE_OK ){ - releasePage(pNewTrunk); - goto end_allocate_page; - } - memcpy(&pNewTrunk->aData[0], &pTrunk->aData[0], 4); - put4byte(&pNewTrunk->aData[4], k-1); - memcpy(&pNewTrunk->aData[8], &pTrunk->aData[12], (k-1)*4); - releasePage(pNewTrunk); - if( !pPrevTrunk ){ - assert( sqlite3PagerIswriteable(pPage1->pDbPage) ); - put4byte(&pPage1->aData[32], iNewTrunk); - }else{ - rc = sqlite3PagerWrite(pPrevTrunk->pDbPage); - if( rc ){ - goto end_allocate_page; - } - put4byte(&pPrevTrunk->aData[0], iNewTrunk); - } - } - pTrunk = 0; - TRACE(("ALLOCATE: %d trunk - %d free pages left\n", *pPgno, n-1)); -#endif - }else if( k>0 ){ - /* Extract a leaf from the trunk */ - u32 closest; - Pgno iPage; - unsigned char *aData = pTrunk->aData; - if( nearby>0 ){ - u32 i; - closest = 0; - if( eMode==BTALLOC_LE ){ - for(i=0; imxPage ){ - rc = SQLITE_CORRUPT_BKPT; - goto end_allocate_page; - } - testcase( iPage==mxPage ); - if( !searchList - || (iPage==nearby || (iPagepgno, n-1)); - rc = sqlite3PagerWrite(pTrunk->pDbPage); - if( rc ) goto end_allocate_page; - if( closestpDbPage); - if( rc!=SQLITE_OK ){ - releasePage(*ppPage); - } - } - searchList = 0; - } - } - releasePage(pPrevTrunk); - pPrevTrunk = 0; - }while( searchList ); - }else{ - /* There are no pages on the freelist, so append a new page to the - ** database image. - ** - ** Normally, new pages allocated by this block can be requested from the - ** pager layer with the 'no-content' flag set. This prevents the pager - ** from trying to read the pages content from disk. However, if the - ** current transaction has already run one or more incremental-vacuum - ** steps, then the page we are about to allocate may contain content - ** that is required in the event of a rollback. In this case, do - ** not set the no-content flag. This causes the pager to load and journal - ** the current page content before overwriting it. - ** - ** Note that the pager will not actually attempt to load or journal - ** content for any page that really does lie past the end of the database - ** file on disk. So the effects of disabling the no-content optimization - ** here are confined to those pages that lie between the end of the - ** database image and the end of the database file. - */ - int bNoContent = (0==IfNotOmitAV(pBt->bDoTruncate)) ? PAGER_GET_NOCONTENT : 0; - - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); - if( rc ) return rc; - pBt->nPage++; - if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ) pBt->nPage++; - -#ifndef SQLITE_OMIT_AUTOVACUUM - if( pBt->autoVacuum && PTRMAP_ISPAGE(pBt, pBt->nPage) ){ - /* If *pPgno refers to a pointer-map page, allocate two new pages - ** at the end of the file instead of one. The first allocated page - ** becomes a new pointer-map page, the second is used by the caller. - */ - MemPage *pPg = 0; - TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", pBt->nPage)); - assert( pBt->nPage!=PENDING_BYTE_PAGE(pBt) ); - rc = btreeGetPage(pBt, pBt->nPage, &pPg, bNoContent); - if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pPg->pDbPage); - releasePage(pPg); - } - if( rc ) return rc; - pBt->nPage++; - if( pBt->nPage==PENDING_BYTE_PAGE(pBt) ){ pBt->nPage++; } - } -#endif - put4byte(28 + (u8*)pBt->pPage1->aData, pBt->nPage); - *pPgno = pBt->nPage; - - assert( *pPgno!=PENDING_BYTE_PAGE(pBt) ); - rc = btreeGetPage(pBt, *pPgno, ppPage, bNoContent); - if( rc ) return rc; - rc = sqlite3PagerWrite((*ppPage)->pDbPage); - if( rc!=SQLITE_OK ){ - releasePage(*ppPage); - } - TRACE(("ALLOCATE: %d from end of file\n", *pPgno)); - } - - assert( *pPgno!=PENDING_BYTE_PAGE(pBt) ); - -end_allocate_page: - releasePage(pTrunk); - releasePage(pPrevTrunk); - if( rc==SQLITE_OK ){ - if( sqlite3PagerPageRefcount((*ppPage)->pDbPage)>1 ){ - releasePage(*ppPage); - *ppPage = 0; - return SQLITE_CORRUPT_BKPT; - } - (*ppPage)->isInit = 0; - }else{ - *ppPage = 0; - } - assert( rc!=SQLITE_OK || sqlite3PagerIswriteable((*ppPage)->pDbPage) ); - return rc; -} - -/* -** This function is used to add page iPage to the database file free-list. -** It is assumed that the page is not already a part of the free-list. -** -** The value passed as the second argument to this function is optional. -** If the caller happens to have a pointer to the MemPage object -** corresponding to page iPage handy, it may pass it as the second value. -** Otherwise, it may pass NULL. -** -** If a pointer to a MemPage object is passed as the second argument, -** its reference count is not altered by this function. -*/ -static int freePage2(BtShared *pBt, MemPage *pMemPage, Pgno iPage){ - MemPage *pTrunk = 0; /* Free-list trunk page */ - Pgno iTrunk = 0; /* Page number of free-list trunk page */ - MemPage *pPage1 = pBt->pPage1; /* Local reference to page 1 */ - MemPage *pPage; /* Page being freed. May be NULL. */ - int rc; /* Return Code */ - int nFree; /* Initial number of pages on free-list */ - - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( iPage>1 ); - assert( !pMemPage || pMemPage->pgno==iPage ); - - if( pMemPage ){ - pPage = pMemPage; - sqlite3PagerRef(pPage->pDbPage); - }else{ - pPage = btreePageLookup(pBt, iPage); - } - - /* Increment the free page count on pPage1 */ - rc = sqlite3PagerWrite(pPage1->pDbPage); - if( rc ) goto freepage_out; - nFree = get4byte(&pPage1->aData[36]); - put4byte(&pPage1->aData[36], nFree+1); - - if( pBt->btsFlags & BTS_SECURE_DELETE ){ - /* If the secure_delete option is enabled, then - ** always fully overwrite deleted information with zeros. - */ - if( (!pPage && ((rc = btreeGetPage(pBt, iPage, &pPage, 0))!=0) ) - || ((rc = sqlite3PagerWrite(pPage->pDbPage))!=0) - ){ - goto freepage_out; - } - memset(pPage->aData, 0, pPage->pBt->pageSize); - } - - /* If the database supports auto-vacuum, write an entry in the pointer-map - ** to indicate that the page is free. - */ - if( ISAUTOVACUUM ){ - ptrmapPut(pBt, iPage, PTRMAP_FREEPAGE, 0, &rc); - if( rc ) goto freepage_out; - } - - /* Now manipulate the actual database free-list structure. There are two - ** possibilities. If the free-list is currently empty, or if the first - ** trunk page in the free-list is full, then this page will become a - ** new free-list trunk page. Otherwise, it will become a leaf of the - ** first trunk page in the current free-list. This block tests if it - ** is possible to add the page as a new free-list leaf. - */ - if( nFree!=0 ){ - u32 nLeaf; /* Initial number of leaf cells on trunk page */ - - iTrunk = get4byte(&pPage1->aData[32]); - rc = btreeGetPage(pBt, iTrunk, &pTrunk, 0); - if( rc!=SQLITE_OK ){ - goto freepage_out; - } - - nLeaf = get4byte(&pTrunk->aData[4]); - assert( pBt->usableSize>32 ); - if( nLeaf > (u32)pBt->usableSize/4 - 2 ){ - rc = SQLITE_CORRUPT_BKPT; - goto freepage_out; - } - if( nLeaf < (u32)pBt->usableSize/4 - 8 ){ - /* In this case there is room on the trunk page to insert the page - ** being freed as a new leaf. - ** - ** Note that the trunk page is not really full until it contains - ** usableSize/4 - 2 entries, not usableSize/4 - 8 entries as we have - ** coded. But due to a coding error in versions of SQLite prior to - ** 3.6.0, databases with freelist trunk pages holding more than - ** usableSize/4 - 8 entries will be reported as corrupt. In order - ** to maintain backwards compatibility with older versions of SQLite, - ** we will continue to restrict the number of entries to usableSize/4 - 8 - ** for now. At some point in the future (once everyone has upgraded - ** to 3.6.0 or later) we should consider fixing the conditional above - ** to read "usableSize/4-2" instead of "usableSize/4-8". - */ - rc = sqlite3PagerWrite(pTrunk->pDbPage); - if( rc==SQLITE_OK ){ - put4byte(&pTrunk->aData[4], nLeaf+1); - put4byte(&pTrunk->aData[8+nLeaf*4], iPage); - if( pPage && (pBt->btsFlags & BTS_SECURE_DELETE)==0 ){ - sqlite3PagerDontWrite(pPage->pDbPage); - } - rc = btreeSetHasContent(pBt, iPage); - } - TRACE(("FREE-PAGE: %d leaf on trunk page %d\n",pPage->pgno,pTrunk->pgno)); - goto freepage_out; - } - } - - /* If control flows to this point, then it was not possible to add the - ** the page being freed as a leaf page of the first trunk in the free-list. - ** Possibly because the free-list is empty, or possibly because the - ** first trunk in the free-list is full. Either way, the page being freed - ** will become the new first trunk page in the free-list. - */ - if( pPage==0 && SQLITE_OK!=(rc = btreeGetPage(pBt, iPage, &pPage, 0)) ){ - goto freepage_out; - } - rc = sqlite3PagerWrite(pPage->pDbPage); - if( rc!=SQLITE_OK ){ - goto freepage_out; - } - put4byte(pPage->aData, iTrunk); - put4byte(&pPage->aData[4], 0); - put4byte(&pPage1->aData[32], iPage); - TRACE(("FREE-PAGE: %d new trunk page replacing %d\n", pPage->pgno, iTrunk)); - -freepage_out: - if( pPage ){ - pPage->isInit = 0; - } - releasePage(pPage); - releasePage(pTrunk); - return rc; -} -static void freePage(MemPage *pPage, int *pRC){ - if( (*pRC)==SQLITE_OK ){ - *pRC = freePage2(pPage->pBt, pPage, pPage->pgno); - } -} - -/* -** Free any overflow pages associated with the given Cell. -*/ -static int clearCell(MemPage *pPage, unsigned char *pCell){ - BtShared *pBt = pPage->pBt; - CellInfo info; - Pgno ovflPgno; - int rc; - int nOvfl; - u32 ovflPageSize; - - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - btreeParseCellPtr(pPage, pCell, &info); - if( info.iOverflow==0 ){ - return SQLITE_OK; /* No overflow pages. Return without doing anything */ - } - if( pCell+info.iOverflow+3 > pPage->aData+pPage->maskPage ){ - return SQLITE_CORRUPT_BKPT; /* Cell extends past end of page */ - } - ovflPgno = get4byte(&pCell[info.iOverflow]); - assert( pBt->usableSize > 4 ); - ovflPageSize = pBt->usableSize - 4; - nOvfl = (info.nPayload - info.nLocal + ovflPageSize - 1)/ovflPageSize; - assert( ovflPgno==0 || nOvfl>0 ); - while( nOvfl-- ){ - Pgno iNext = 0; - MemPage *pOvfl = 0; - if( ovflPgno<2 || ovflPgno>btreePagecount(pBt) ){ - /* 0 is not a legal page number and page 1 cannot be an - ** overflow page. Therefore if ovflPgno<2 or past the end of the - ** file the database must be corrupt. */ - return SQLITE_CORRUPT_BKPT; - } - if( nOvfl ){ - rc = getOverflowPage(pBt, ovflPgno, &pOvfl, &iNext); - if( rc ) return rc; - } - - if( ( pOvfl || ((pOvfl = btreePageLookup(pBt, ovflPgno))!=0) ) - && sqlite3PagerPageRefcount(pOvfl->pDbPage)!=1 - ){ - /* There is no reason any cursor should have an outstanding reference - ** to an overflow page belonging to a cell that is being deleted/updated. - ** So if there exists more than one reference to this page, then it - ** must not really be an overflow page and the database must be corrupt. - ** It is helpful to detect this before calling freePage2(), as - ** freePage2() may zero the page contents if secure-delete mode is - ** enabled. If this 'overflow' page happens to be a page that the - ** caller is iterating through or using in some other way, this - ** can be problematic. - */ - rc = SQLITE_CORRUPT_BKPT; - }else{ - rc = freePage2(pBt, pOvfl, ovflPgno); - } - - if( pOvfl ){ - sqlite3PagerUnref(pOvfl->pDbPage); - } - if( rc ) return rc; - ovflPgno = iNext; - } - return SQLITE_OK; -} - -/* -** Create the byte sequence used to represent a cell on page pPage -** and write that byte sequence into pCell[]. Overflow pages are -** allocated and filled in as necessary. The calling procedure -** is responsible for making sure sufficient space has been allocated -** for pCell[]. -** -** Note that pCell does not necessary need to point to the pPage->aData -** area. pCell might point to some temporary storage. The cell will -** be constructed in this temporary area then copied into pPage->aData -** later. -*/ -static int fillInCell( - MemPage *pPage, /* The page that contains the cell */ - unsigned char *pCell, /* Complete text of the cell */ - const void *pKey, i64 nKey, /* The key */ - const void *pData,int nData, /* The data */ - int nZero, /* Extra zero bytes to append to pData */ - int *pnSize /* Write cell size here */ -){ - int nPayload; - const u8 *pSrc; - int nSrc, n, rc; - int spaceLeft; - MemPage *pOvfl = 0; - MemPage *pToRelease = 0; - unsigned char *pPrior; - unsigned char *pPayload; - BtShared *pBt = pPage->pBt; - Pgno pgnoOvfl = 0; - int nHeader; - CellInfo info; - - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - - /* pPage is not necessarily writeable since pCell might be auxiliary - ** buffer space that is separate from the pPage buffer area */ - assert( pCellaData || pCell>=&pPage->aData[pBt->pageSize] - || sqlite3PagerIswriteable(pPage->pDbPage) ); - - /* Fill in the header. */ - nHeader = 0; - if( !pPage->leaf ){ - nHeader += 4; - } - if( pPage->hasData ){ - nHeader += putVarint32(&pCell[nHeader], nData+nZero); - }else{ - nData = nZero = 0; - } - nHeader += putVarint(&pCell[nHeader], *(u64*)&nKey); - btreeParseCellPtr(pPage, pCell, &info); - assert( info.nHeader==nHeader ); - assert( info.nKey==nKey ); - assert( info.nData==(u32)(nData+nZero) ); - - /* Fill in the payload */ - nPayload = nData + nZero; - if( pPage->intKey ){ - pSrc = pData; - nSrc = nData; - nData = 0; - }else{ - if( NEVER(nKey>0x7fffffff || pKey==0) ){ - return SQLITE_CORRUPT_BKPT; - } - nPayload += (int)nKey; - pSrc = pKey; - nSrc = (int)nKey; - } - *pnSize = info.nSize; - spaceLeft = info.nLocal; - pPayload = &pCell[nHeader]; - pPrior = &pCell[info.iOverflow]; - - while( nPayload>0 ){ - if( spaceLeft==0 ){ -#ifndef SQLITE_OMIT_AUTOVACUUM - Pgno pgnoPtrmap = pgnoOvfl; /* Overflow page pointer-map entry page */ - if( pBt->autoVacuum ){ - do{ - pgnoOvfl++; - } while( - PTRMAP_ISPAGE(pBt, pgnoOvfl) || pgnoOvfl==PENDING_BYTE_PAGE(pBt) - ); - } -#endif - rc = allocateBtreePage(pBt, &pOvfl, &pgnoOvfl, pgnoOvfl, 0); -#ifndef SQLITE_OMIT_AUTOVACUUM - /* If the database supports auto-vacuum, and the second or subsequent - ** overflow page is being allocated, add an entry to the pointer-map - ** for that page now. - ** - ** If this is the first overflow page, then write a partial entry - ** to the pointer-map. If we write nothing to this pointer-map slot, - ** then the optimistic overflow chain processing in clearCell() - ** may misinterpret the uninitialized values and delete the - ** wrong pages from the database. - */ - if( pBt->autoVacuum && rc==SQLITE_OK ){ - u8 eType = (pgnoPtrmap?PTRMAP_OVERFLOW2:PTRMAP_OVERFLOW1); - ptrmapPut(pBt, pgnoOvfl, eType, pgnoPtrmap, &rc); - if( rc ){ - releasePage(pOvfl); - } - } -#endif - if( rc ){ - releasePage(pToRelease); - return rc; - } - - /* If pToRelease is not zero than pPrior points into the data area - ** of pToRelease. Make sure pToRelease is still writeable. */ - assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) ); - - /* If pPrior is part of the data area of pPage, then make sure pPage - ** is still writeable */ - assert( pPrioraData || pPrior>=&pPage->aData[pBt->pageSize] - || sqlite3PagerIswriteable(pPage->pDbPage) ); - - put4byte(pPrior, pgnoOvfl); - releasePage(pToRelease); - pToRelease = pOvfl; - pPrior = pOvfl->aData; - put4byte(pPrior, 0); - pPayload = &pOvfl->aData[4]; - spaceLeft = pBt->usableSize - 4; - } - n = nPayload; - if( n>spaceLeft ) n = spaceLeft; - - /* If pToRelease is not zero than pPayload points into the data area - ** of pToRelease. Make sure pToRelease is still writeable. */ - assert( pToRelease==0 || sqlite3PagerIswriteable(pToRelease->pDbPage) ); - - /* If pPayload is part of the data area of pPage, then make sure pPage - ** is still writeable */ - assert( pPayloadaData || pPayload>=&pPage->aData[pBt->pageSize] - || sqlite3PagerIswriteable(pPage->pDbPage) ); - - if( nSrc>0 ){ - if( n>nSrc ) n = nSrc; - assert( pSrc ); - memcpy(pPayload, pSrc, n); - }else{ - memset(pPayload, 0, n); - } - nPayload -= n; - pPayload += n; - pSrc += n; - nSrc -= n; - spaceLeft -= n; - if( nSrc==0 ){ - nSrc = nData; - pSrc = pData; - } - } - releasePage(pToRelease); - return SQLITE_OK; -} - -/* -** Remove the i-th cell from pPage. This routine effects pPage only. -** The cell content is not freed or deallocated. It is assumed that -** the cell content has been copied someplace else. This routine just -** removes the reference to the cell from pPage. -** -** "sz" must be the number of bytes in the cell. -*/ -static void dropCell(MemPage *pPage, int idx, int sz, int *pRC){ - u32 pc; /* Offset to cell content of cell being deleted */ - u8 *data; /* pPage->aData */ - u8 *ptr; /* Used to move bytes around within data[] */ - int rc; /* The return code */ - int hdr; /* Beginning of the header. 0 most pages. 100 page 1 */ - - if( *pRC ) return; - - assert( idx>=0 && idxnCell ); - assert( sz==cellSize(pPage, idx) ); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - data = pPage->aData; - ptr = &pPage->aCellIdx[2*idx]; - pc = get2byte(ptr); - hdr = pPage->hdrOffset; - testcase( pc==get2byte(&data[hdr+5]) ); - testcase( pc+sz==pPage->pBt->usableSize ); - if( pc < (u32)get2byte(&data[hdr+5]) || pc+sz > pPage->pBt->usableSize ){ - *pRC = SQLITE_CORRUPT_BKPT; - return; - } - rc = freeSpace(pPage, pc, sz); - if( rc ){ - *pRC = rc; - return; - } - pPage->nCell--; - memmove(ptr, ptr+2, 2*(pPage->nCell - idx)); - put2byte(&data[hdr+3], pPage->nCell); - pPage->nFree += 2; -} - -/* -** Insert a new cell on pPage at cell index "i". pCell points to the -** content of the cell. -** -** If the cell content will fit on the page, then put it there. If it -** will not fit, then make a copy of the cell content into pTemp if -** pTemp is not null. Regardless of pTemp, allocate a new entry -** in pPage->apOvfl[] and make it point to the cell content (either -** in pTemp or the original pCell) and also record its index. -** Allocating a new entry in pPage->aCell[] implies that -** pPage->nOverflow is incremented. -** -** If nSkip is non-zero, then do not copy the first nSkip bytes of the -** cell. The caller will overwrite them after this function returns. If -** nSkip is non-zero, then pCell may not point to an invalid memory location -** (but pCell+nSkip is always valid). -*/ -static void insertCell( - MemPage *pPage, /* Page into which we are copying */ - int i, /* New cell becomes the i-th cell of the page */ - u8 *pCell, /* Content of the new cell */ - int sz, /* Bytes of content in pCell */ - u8 *pTemp, /* Temp storage space for pCell, if needed */ - Pgno iChild, /* If non-zero, replace first 4 bytes with this value */ - int *pRC /* Read and write return code from here */ -){ - int idx = 0; /* Where to write new cell content in data[] */ - int j; /* Loop counter */ - int end; /* First byte past the last cell pointer in data[] */ - int ins; /* Index in data[] where new cell pointer is inserted */ - int cellOffset; /* Address of first cell pointer in data[] */ - u8 *data; /* The content of the whole page */ - int nSkip = (iChild ? 4 : 0); - - if( *pRC ) return; - - assert( i>=0 && i<=pPage->nCell+pPage->nOverflow ); - assert( pPage->nCell<=MX_CELL(pPage->pBt) && MX_CELL(pPage->pBt)<=10921 ); - assert( pPage->nOverflow<=ArraySize(pPage->apOvfl) ); - assert( ArraySize(pPage->apOvfl)==ArraySize(pPage->aiOvfl) ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - /* The cell should normally be sized correctly. However, when moving a - ** malformed cell from a leaf page to an interior page, if the cell size - ** wanted to be less than 4 but got rounded up to 4 on the leaf, then size - ** might be less than 8 (leaf-size + pointer) on the interior node. Hence - ** the term after the || in the following assert(). */ - assert( sz==cellSizePtr(pPage, pCell) || (sz==8 && iChild>0) ); - if( pPage->nOverflow || sz+2>pPage->nFree ){ - if( pTemp ){ - memcpy(pTemp+nSkip, pCell+nSkip, sz-nSkip); - pCell = pTemp; - } - if( iChild ){ - put4byte(pCell, iChild); - } - j = pPage->nOverflow++; - assert( j<(int)(sizeof(pPage->apOvfl)/sizeof(pPage->apOvfl[0])) ); - pPage->apOvfl[j] = pCell; - pPage->aiOvfl[j] = (u16)i; - }else{ - int rc = sqlite3PagerWrite(pPage->pDbPage); - if( rc!=SQLITE_OK ){ - *pRC = rc; - return; - } - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - data = pPage->aData; - cellOffset = pPage->cellOffset; - end = cellOffset + 2*pPage->nCell; - ins = cellOffset + 2*i; - rc = allocateSpace(pPage, sz, &idx); - if( rc ){ *pRC = rc; return; } - /* The allocateSpace() routine guarantees the following two properties - ** if it returns success */ - assert( idx >= end+2 ); - assert( idx+sz <= (int)pPage->pBt->usableSize ); - pPage->nCell++; - pPage->nFree -= (u16)(2 + sz); - memcpy(&data[idx+nSkip], pCell+nSkip, sz-nSkip); - if( iChild ){ - put4byte(&data[idx], iChild); - } - memmove(&data[ins+2], &data[ins], end-ins); - put2byte(&data[ins], idx); - put2byte(&data[pPage->hdrOffset+3], pPage->nCell); -#ifndef SQLITE_OMIT_AUTOVACUUM - if( pPage->pBt->autoVacuum ){ - /* The cell may contain a pointer to an overflow page. If so, write - ** the entry for the overflow page into the pointer map. - */ - ptrmapPutOvflPtr(pPage, pCell, pRC); - } -#endif - } -} - -/* -** Add a list of cells to a page. The page should be initially empty. -** The cells are guaranteed to fit on the page. -*/ -static void assemblePage( - MemPage *pPage, /* The page to be assemblied */ - int nCell, /* The number of cells to add to this page */ - u8 **apCell, /* Pointers to cell bodies */ - u16 *aSize /* Sizes of the cells */ -){ - int i; /* Loop counter */ - u8 *pCellptr; /* Address of next cell pointer */ - int cellbody; /* Address of next cell body */ - u8 * const data = pPage->aData; /* Pointer to data for pPage */ - const int hdr = pPage->hdrOffset; /* Offset of header on pPage */ - const int nUsable = pPage->pBt->usableSize; /* Usable size of page */ - - assert( pPage->nOverflow==0 ); - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( nCell>=0 && nCell<=(int)MX_CELL(pPage->pBt) - && (int)MX_CELL(pPage->pBt)<=10921); - assert( sqlite3PagerIswriteable(pPage->pDbPage) ); - - /* Check that the page has just been zeroed by zeroPage() */ - assert( pPage->nCell==0 ); - assert( get2byteNotZero(&data[hdr+5])==nUsable ); - - pCellptr = &pPage->aCellIdx[nCell*2]; - cellbody = nUsable; - for(i=nCell-1; i>=0; i--){ - u16 sz = aSize[i]; - pCellptr -= 2; - cellbody -= sz; - put2byte(pCellptr, cellbody); - memcpy(&data[cellbody], apCell[i], sz); - } - put2byte(&data[hdr+3], nCell); - put2byte(&data[hdr+5], cellbody); - pPage->nFree -= (nCell*2 + nUsable - cellbody); - pPage->nCell = (u16)nCell; -} - -/* -** The following parameters determine how many adjacent pages get involved -** in a balancing operation. NN is the number of neighbors on either side -** of the page that participate in the balancing operation. NB is the -** total number of pages that participate, including the target page and -** NN neighbors on either side. -** -** The minimum value of NN is 1 (of course). Increasing NN above 1 -** (to 2 or 3) gives a modest improvement in SELECT and DELETE performance -** in exchange for a larger degradation in INSERT and UPDATE performance. -** The value of NN appears to give the best results overall. -*/ -#define NN 1 /* Number of neighbors on either side of pPage */ -#define NB (NN*2+1) /* Total pages involved in the balance */ - - -#ifndef SQLITE_OMIT_QUICKBALANCE -/* -** This version of balance() handles the common special case where -** a new entry is being inserted on the extreme right-end of the -** tree, in other words, when the new entry will become the largest -** entry in the tree. -** -** Instead of trying to balance the 3 right-most leaf pages, just add -** a new page to the right-hand side and put the one new entry in -** that page. This leaves the right side of the tree somewhat -** unbalanced. But odds are that we will be inserting new entries -** at the end soon afterwards so the nearly empty page will quickly -** fill up. On average. -** -** pPage is the leaf page which is the right-most page in the tree. -** pParent is its parent. pPage must have a single overflow entry -** which is also the right-most entry on the page. -** -** The pSpace buffer is used to store a temporary copy of the divider -** cell that will be inserted into pParent. Such a cell consists of a 4 -** byte page number followed by a variable length integer. In other -** words, at most 13 bytes. Hence the pSpace buffer must be at -** least 13 bytes in size. -*/ -static int balance_quick(MemPage *pParent, MemPage *pPage, u8 *pSpace){ - BtShared *const pBt = pPage->pBt; /* B-Tree Database */ - MemPage *pNew; /* Newly allocated page */ - int rc; /* Return Code */ - Pgno pgnoNew; /* Page number of pNew */ - - assert( sqlite3_mutex_held(pPage->pBt->mutex) ); - assert( sqlite3PagerIswriteable(pParent->pDbPage) ); - assert( pPage->nOverflow==1 ); - - /* This error condition is now caught prior to reaching this function */ - if( pPage->nCell==0 ) return SQLITE_CORRUPT_BKPT; - - /* Allocate a new page. This page will become the right-sibling of - ** pPage. Make the parent page writable, so that the new divider cell - ** may be inserted. If both these operations are successful, proceed. - */ - rc = allocateBtreePage(pBt, &pNew, &pgnoNew, 0, 0); - - if( rc==SQLITE_OK ){ - - u8 *pOut = &pSpace[4]; - u8 *pCell = pPage->apOvfl[0]; - u16 szCell = cellSizePtr(pPage, pCell); - u8 *pStop; - - assert( sqlite3PagerIswriteable(pNew->pDbPage) ); - assert( pPage->aData[0]==(PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF) ); - zeroPage(pNew, PTF_INTKEY|PTF_LEAFDATA|PTF_LEAF); - assemblePage(pNew, 1, &pCell, &szCell); - - /* If this is an auto-vacuum database, update the pointer map - ** with entries for the new page, and any pointer from the - ** cell on the page to an overflow page. If either of these - ** operations fails, the return code is set, but the contents - ** of the parent page are still manipulated by thh code below. - ** That is Ok, at this point the parent page is guaranteed to - ** be marked as dirty. Returning an error code will cause a - ** rollback, undoing any changes made to the parent page. - */ - if( ISAUTOVACUUM ){ - ptrmapPut(pBt, pgnoNew, PTRMAP_BTREE, pParent->pgno, &rc); - if( szCell>pNew->minLocal ){ - ptrmapPutOvflPtr(pNew, pCell, &rc); - } - } - - /* Create a divider cell to insert into pParent. The divider cell - ** consists of a 4-byte page number (the page number of pPage) and - ** a variable length key value (which must be the same value as the - ** largest key on pPage). - ** - ** To find the largest key value on pPage, first find the right-most - ** cell on pPage. The first two fields of this cell are the - ** record-length (a variable length integer at most 32-bits in size) - ** and the key value (a variable length integer, may have any value). - ** The first of the while(...) loops below skips over the record-length - ** field. The second while(...) loop copies the key value from the - ** cell on pPage into the pSpace buffer. - */ - pCell = findCell(pPage, pPage->nCell-1); - pStop = &pCell[9]; - while( (*(pCell++)&0x80) && pCellnCell, pSpace, (int)(pOut-pSpace), - 0, pPage->pgno, &rc); - - /* Set the right-child pointer of pParent to point to the new page. */ - put4byte(&pParent->aData[pParent->hdrOffset+8], pgnoNew); - - /* Release the reference to the new page. */ - releasePage(pNew); - } - - return rc; -} -#endif /* SQLITE_OMIT_QUICKBALANCE */ - -#if 0 -/* -** This function does not contribute anything to the operation of SQLite. -** it is sometimes activated temporarily while debugging code responsible -** for setting pointer-map entries. -*/ -static int ptrmapCheckPages(MemPage **apPage, int nPage){ - int i, j; - for(i=0; ipBt; - assert( pPage->isInit ); - - for(j=0; jnCell; j++){ - CellInfo info; - u8 *z; - - z = findCell(pPage, j); - btreeParseCellPtr(pPage, z, &info); - if( info.iOverflow ){ - Pgno ovfl = get4byte(&z[info.iOverflow]); - ptrmapGet(pBt, ovfl, &e, &n); - assert( n==pPage->pgno && e==PTRMAP_OVERFLOW1 ); - } - if( !pPage->leaf ){ - Pgno child = get4byte(z); - ptrmapGet(pBt, child, &e, &n); - assert( n==pPage->pgno && e==PTRMAP_BTREE ); - } - } - if( !pPage->leaf ){ - Pgno child = get4byte(&pPage->aData[pPage->hdrOffset+8]); - ptrmapGet(pBt, child, &e, &n); - assert( n==pPage->pgno && e==PTRMAP_BTREE ); - } - } - return 1; -} -#endif - -/* -** This function is used to copy the contents of the b-tree node stored -** on page pFrom to page pTo. If page pFrom was not a leaf page, then -** the pointer-map entries for each child page are updated so that the -** parent page stored in the pointer map is page pTo. If pFrom contained -** any cells with overflow page pointers, then the corresponding pointer -** map entries are also updated so that the parent page is page pTo. -** -** If pFrom is currently carrying any overflow cells (entries in the -** MemPage.apOvfl[] array), they are not copied to pTo. -** -** Before returning, page pTo is reinitialized using btreeInitPage(). -** -** The performance of this function is not critical. It is only used by -** the balance_shallower() and balance_deeper() procedures, neither of -** which are called often under normal circumstances. -*/ -static void copyNodeContent(MemPage *pFrom, MemPage *pTo, int *pRC){ - if( (*pRC)==SQLITE_OK ){ - BtShared * const pBt = pFrom->pBt; - u8 * const aFrom = pFrom->aData; - u8 * const aTo = pTo->aData; - int const iFromHdr = pFrom->hdrOffset; - int const iToHdr = ((pTo->pgno==1) ? 100 : 0); - int rc; - int iData; - - - assert( pFrom->isInit ); - assert( pFrom->nFree>=iToHdr ); - assert( get2byte(&aFrom[iFromHdr+5]) <= (int)pBt->usableSize ); - - /* Copy the b-tree node content from page pFrom to page pTo. */ - iData = get2byte(&aFrom[iFromHdr+5]); - memcpy(&aTo[iData], &aFrom[iData], pBt->usableSize-iData); - memcpy(&aTo[iToHdr], &aFrom[iFromHdr], pFrom->cellOffset + 2*pFrom->nCell); - - /* Reinitialize page pTo so that the contents of the MemPage structure - ** match the new data. The initialization of pTo can actually fail under - ** fairly obscure circumstances, even though it is a copy of initialized - ** page pFrom. - */ - pTo->isInit = 0; - rc = btreeInitPage(pTo); - if( rc!=SQLITE_OK ){ - *pRC = rc; - return; - } - - /* If this is an auto-vacuum database, update the pointer-map entries - ** for any b-tree or overflow pages that pTo now contains the pointers to. - */ - if( ISAUTOVACUUM ){ - *pRC = setChildPtrmaps(pTo); - } - } -} - -/* -** This routine redistributes cells on the iParentIdx'th child of pParent -** (hereafter "the page") and up to 2 siblings so that all pages have about the -** same amount of free space. Usually a single sibling on either side of the -** page are used in the balancing, though both siblings might come from one -** side if the page is the first or last child of its parent. If the page -** has fewer than 2 siblings (something which can only happen if the page -** is a root page or a child of a root page) then all available siblings -** participate in the balancing. -** -** The number of siblings of the page might be increased or decreased by -** one or two in an effort to keep pages nearly full but not over full. -** -** Note that when this routine is called, some of the cells on the page -** might not actually be stored in MemPage.aData[]. This can happen -** if the page is overfull. This routine ensures that all cells allocated -** to the page and its siblings fit into MemPage.aData[] before returning. -** -** In the course of balancing the page and its siblings, cells may be -** inserted into or removed from the parent page (pParent). Doing so -** may cause the parent page to become overfull or underfull. If this -** happens, it is the responsibility of the caller to invoke the correct -** balancing routine to fix this problem (see the balance() routine). -** -** If this routine fails for any reason, it might leave the database -** in a corrupted state. So if this routine fails, the database should -** be rolled back. -** -** The third argument to this function, aOvflSpace, is a pointer to a -** buffer big enough to hold one page. If while inserting cells into the parent -** page (pParent) the parent page becomes overfull, this buffer is -** used to store the parent's overflow cells. Because this function inserts -** a maximum of four divider cells into the parent page, and the maximum -** size of a cell stored within an internal node is always less than 1/4 -** of the page-size, the aOvflSpace[] buffer is guaranteed to be large -** enough for all overflow cells. -** -** If aOvflSpace is set to a null pointer, this function returns -** SQLITE_NOMEM. -*/ -#if defined(_MSC_VER) && _MSC_VER >= 1700 && defined(_M_ARM) -#pragma optimize("", off) -#endif -static int balance_nonroot( - MemPage *pParent, /* Parent page of siblings being balanced */ - int iParentIdx, /* Index of "the page" in pParent */ - u8 *aOvflSpace, /* page-size bytes of space for parent ovfl */ - int isRoot, /* True if pParent is a root-page */ - int bBulk /* True if this call is part of a bulk load */ -){ - BtShared *pBt; /* The whole database */ - int nCell = 0; /* Number of cells in apCell[] */ - int nMaxCells = 0; /* Allocated size of apCell, szCell, aFrom. */ - int nNew = 0; /* Number of pages in apNew[] */ - int nOld; /* Number of pages in apOld[] */ - int i, j, k; /* Loop counters */ - int nxDiv; /* Next divider slot in pParent->aCell[] */ - int rc = SQLITE_OK; /* The return code */ - u16 leafCorrection; /* 4 if pPage is a leaf. 0 if not */ - int leafData; /* True if pPage is a leaf of a LEAFDATA tree */ - int usableSpace; /* Bytes in pPage beyond the header */ - int pageFlags; /* Value of pPage->aData[0] */ - int subtotal; /* Subtotal of bytes in cells on one page */ - int iSpace1 = 0; /* First unused byte of aSpace1[] */ - int iOvflSpace = 0; /* First unused byte of aOvflSpace[] */ - int szScratch; /* Size of scratch memory requested */ - MemPage *apOld[NB]; /* pPage and up to two siblings */ - MemPage *apCopy[NB]; /* Private copies of apOld[] pages */ - MemPage *apNew[NB+2]; /* pPage and up to NB siblings after balancing */ - u8 *pRight; /* Location in parent of right-sibling pointer */ - u8 *apDiv[NB-1]; /* Divider cells in pParent */ - int cntNew[NB+2]; /* Index in aCell[] of cell after i-th page */ - int szNew[NB+2]; /* Combined size of cells place on i-th page */ - u8 **apCell = 0; /* All cells begin balanced */ - u16 *szCell; /* Local size of all cells in apCell[] */ - u8 *aSpace1; /* Space for copies of dividers cells */ - Pgno pgno; /* Temp var to store a page number in */ - - pBt = pParent->pBt; - assert( sqlite3_mutex_held(pBt->mutex) ); - assert( sqlite3PagerIswriteable(pParent->pDbPage) ); - -#if 0 - TRACE(("BALANCE: begin page %d child of %d\n", pPage->pgno, pParent->pgno)); -#endif - - /* At this point pParent may have at most one overflow cell. And if - ** this overflow cell is present, it must be the cell with - ** index iParentIdx. This scenario comes about when this function - ** is called (indirectly) from sqlite3BtreeDelete(). - */ - assert( pParent->nOverflow==0 || pParent->nOverflow==1 ); - assert( pParent->nOverflow==0 || pParent->aiOvfl[0]==iParentIdx ); - - if( !aOvflSpace ){ - return SQLITE_NOMEM; - } - - /* Find the sibling pages to balance. Also locate the cells in pParent - ** that divide the siblings. An attempt is made to find NN siblings on - ** either side of pPage. More siblings are taken from one side, however, - ** if there are fewer than NN siblings on the other side. If pParent - ** has NB or fewer children then all children of pParent are taken. - ** - ** This loop also drops the divider cells from the parent page. This - ** way, the remainder of the function does not have to deal with any - ** overflow cells in the parent page, since if any existed they will - ** have already been removed. - */ - i = pParent->nOverflow + pParent->nCell; - if( i<2 ){ - nxDiv = 0; - }else{ - assert( bBulk==0 || bBulk==1 ); - if( iParentIdx==0 ){ - nxDiv = 0; - }else if( iParentIdx==i ){ - nxDiv = i-2+bBulk; - }else{ - assert( bBulk==0 ); - nxDiv = iParentIdx-1; - } - i = 2-bBulk; - } - nOld = i+1; - if( (i+nxDiv-pParent->nOverflow)==pParent->nCell ){ - pRight = &pParent->aData[pParent->hdrOffset+8]; - }else{ - pRight = findCell(pParent, i+nxDiv-pParent->nOverflow); - } - pgno = get4byte(pRight); - while( 1 ){ - rc = getAndInitPage(pBt, pgno, &apOld[i], 0); - if( rc ){ - memset(apOld, 0, (i+1)*sizeof(MemPage*)); - goto balance_cleanup; - } - nMaxCells += 1+apOld[i]->nCell+apOld[i]->nOverflow; - if( (i--)==0 ) break; - - if( i+nxDiv==pParent->aiOvfl[0] && pParent->nOverflow ){ - apDiv[i] = pParent->apOvfl[0]; - pgno = get4byte(apDiv[i]); - szNew[i] = cellSizePtr(pParent, apDiv[i]); - pParent->nOverflow = 0; - }else{ - apDiv[i] = findCell(pParent, i+nxDiv-pParent->nOverflow); - pgno = get4byte(apDiv[i]); - szNew[i] = cellSizePtr(pParent, apDiv[i]); - - /* Drop the cell from the parent page. apDiv[i] still points to - ** the cell within the parent, even though it has been dropped. - ** This is safe because dropping a cell only overwrites the first - ** four bytes of it, and this function does not need the first - ** four bytes of the divider cell. So the pointer is safe to use - ** later on. - ** - ** But not if we are in secure-delete mode. In secure-delete mode, - ** the dropCell() routine will overwrite the entire cell with zeroes. - ** In this case, temporarily copy the cell into the aOvflSpace[] - ** buffer. It will be copied out again as soon as the aSpace[] buffer - ** is allocated. */ - if( pBt->btsFlags & BTS_SECURE_DELETE ){ - int iOff; - - iOff = SQLITE_PTR_TO_INT(apDiv[i]) - SQLITE_PTR_TO_INT(pParent->aData); - if( (iOff+szNew[i])>(int)pBt->usableSize ){ - rc = SQLITE_CORRUPT_BKPT; - memset(apOld, 0, (i+1)*sizeof(MemPage*)); - goto balance_cleanup; - }else{ - memcpy(&aOvflSpace[iOff], apDiv[i], szNew[i]); - apDiv[i] = &aOvflSpace[apDiv[i]-pParent->aData]; - } - } - dropCell(pParent, i+nxDiv-pParent->nOverflow, szNew[i], &rc); - } - } - - /* Make nMaxCells a multiple of 4 in order to preserve 8-byte - ** alignment */ - nMaxCells = (nMaxCells + 3)&~3; - - /* - ** Allocate space for memory structures - */ - k = pBt->pageSize + ROUND8(sizeof(MemPage)); - szScratch = - nMaxCells*sizeof(u8*) /* apCell */ - + nMaxCells*sizeof(u16) /* szCell */ - + pBt->pageSize /* aSpace1 */ - + k*nOld; /* Page copies (apCopy) */ - apCell = sqlite3ScratchMalloc( szScratch ); - if( apCell==0 ){ - rc = SQLITE_NOMEM; - goto balance_cleanup; - } - szCell = (u16*)&apCell[nMaxCells]; - aSpace1 = (u8*)&szCell[nMaxCells]; - assert( EIGHT_BYTE_ALIGNMENT(aSpace1) ); - - /* - ** Load pointers to all cells on sibling pages and the divider cells - ** into the local apCell[] array. Make copies of the divider cells - ** into space obtained from aSpace1[] and remove the divider cells - ** from pParent. - ** - ** If the siblings are on leaf pages, then the child pointers of the - ** divider cells are stripped from the cells before they are copied - ** into aSpace1[]. In this way, all cells in apCell[] are without - ** child pointers. If siblings are not leaves, then all cell in - ** apCell[] include child pointers. Either way, all cells in apCell[] - ** are alike. - ** - ** leafCorrection: 4 if pPage is a leaf. 0 if pPage is not a leaf. - ** leafData: 1 if pPage holds key+data and pParent holds only keys. - */ - leafCorrection = apOld[0]->leaf*4; - leafData = apOld[0]->hasData; - for(i=0; ipageSize + k*i]; - memcpy(pOld, apOld[i], sizeof(MemPage)); - pOld->aData = (void*)&pOld[1]; - memcpy(pOld->aData, apOld[i]->aData, pBt->pageSize); - - limit = pOld->nCell+pOld->nOverflow; - if( pOld->nOverflow>0 ){ - for(j=0; jaData; - u16 maskPage = pOld->maskPage; - u16 cellOffset = pOld->cellOffset; - for(j=0; jmaxLocal+23 ); - assert( iSpace1 <= (int)pBt->pageSize ); - memcpy(pTemp, apDiv[i], sz); - apCell[nCell] = pTemp+leafCorrection; - assert( leafCorrection==0 || leafCorrection==4 ); - szCell[nCell] = szCell[nCell] - leafCorrection; - if( !pOld->leaf ){ - assert( leafCorrection==0 ); - assert( pOld->hdrOffset==0 ); - /* The right pointer of the child page pOld becomes the left - ** pointer of the divider cell */ - memcpy(apCell[nCell], &pOld->aData[8], 4); - }else{ - assert( leafCorrection==4 ); - if( szCell[nCell]<4 ){ - /* Do not allow any cells smaller than 4 bytes. */ - szCell[nCell] = 4; - } - } - nCell++; - } - } - - /* - ** Figure out the number of pages needed to hold all nCell cells. - ** Store this number in "k". Also compute szNew[] which is the total - ** size of all cells on the i-th page and cntNew[] which is the index - ** in apCell[] of the cell that divides page i from page i+1. - ** cntNew[k] should equal nCell. - ** - ** Values computed by this block: - ** - ** k: The total number of sibling pages - ** szNew[i]: Spaced used on the i-th sibling page. - ** cntNew[i]: Index in apCell[] and szCell[] for the first cell to - ** the right of the i-th sibling page. - ** usableSpace: Number of bytes of space available on each sibling. - ** - */ - usableSpace = pBt->usableSize - 12 + leafCorrection; - for(subtotal=k=i=0; i usableSpace ){ - szNew[k] = subtotal - szCell[i]; - cntNew[k] = i; - if( leafData ){ i--; } - subtotal = 0; - k++; - if( k>NB+1 ){ rc = SQLITE_CORRUPT_BKPT; goto balance_cleanup; } - } - } - szNew[k] = subtotal; - cntNew[k] = nCell; - k++; - - /* - ** The packing computed by the previous block is biased toward the siblings - ** on the left side. The left siblings are always nearly full, while the - ** right-most sibling might be nearly empty. This block of code attempts - ** to adjust the packing of siblings to get a better balance. - ** - ** This adjustment is more than an optimization. The packing above might - ** be so out of balance as to be illegal. For example, the right-most - ** sibling might be completely empty. This adjustment is not optional. - */ - for(i=k-1; i>0; i--){ - int szRight = szNew[i]; /* Size of sibling on the right */ - int szLeft = szNew[i-1]; /* Size of sibling on the left */ - int r; /* Index of right-most cell in left sibling */ - int d; /* Index of first cell to the left of right sibling */ - - r = cntNew[i-1] - 1; - d = r + 1 - leafData; - assert( d0) or pPage is - ** a virtual root page. A virtual root page is when the real root - ** page is page 1 and we are the only child of that page. - ** - ** UPDATE: The assert() below is not necessarily true if the database - ** file is corrupt. The corruption will be detected and reported later - ** in this procedure so there is no need to act upon it now. - */ -#if 0 - assert( cntNew[0]>0 || (pParent->pgno==1 && pParent->nCell==0) ); -#endif - - TRACE(("BALANCE: old: %d %d %d ", - apOld[0]->pgno, - nOld>=2 ? apOld[1]->pgno : 0, - nOld>=3 ? apOld[2]->pgno : 0 - )); - - /* - ** Allocate k new pages. Reuse old pages where possible. - */ - if( apOld[0]->pgno<=1 ){ - rc = SQLITE_CORRUPT_BKPT; - goto balance_cleanup; - } - pageFlags = apOld[0]->aData[0]; - for(i=0; ipDbPage); - nNew++; - if( rc ) goto balance_cleanup; - }else{ - assert( i>0 ); - rc = allocateBtreePage(pBt, &pNew, &pgno, (bBulk ? 1 : pgno), 0); - if( rc ) goto balance_cleanup; - apNew[i] = pNew; - nNew++; - - /* Set the pointer-map entry for the new sibling page. */ - if( ISAUTOVACUUM ){ - ptrmapPut(pBt, pNew->pgno, PTRMAP_BTREE, pParent->pgno, &rc); - if( rc!=SQLITE_OK ){ - goto balance_cleanup; - } - } - } - } - - /* Free any old pages that were not reused as new pages. - */ - while( ipgno; - int minI = i; - for(j=i+1; jpgno<(unsigned)minV ){ - minI = j; - minV = apNew[j]->pgno; - } - } - if( minI>i ){ - MemPage *pT; - pT = apNew[i]; - apNew[i] = apNew[minI]; - apNew[minI] = pT; - } - } - TRACE(("new: %d(%d) %d(%d) %d(%d) %d(%d) %d(%d)\n", - apNew[0]->pgno, szNew[0], - nNew>=2 ? apNew[1]->pgno : 0, nNew>=2 ? szNew[1] : 0, - nNew>=3 ? apNew[2]->pgno : 0, nNew>=3 ? szNew[2] : 0, - nNew>=4 ? apNew[3]->pgno : 0, nNew>=4 ? szNew[3] : 0, - nNew>=5 ? apNew[4]->pgno : 0, nNew>=5 ? szNew[4] : 0)); - - assert( sqlite3PagerIswriteable(pParent->pDbPage) ); - put4byte(pRight, apNew[nNew-1]->pgno); - - /* - ** Evenly distribute the data in apCell[] across the new pages. - ** Insert divider cells into pParent as necessary. - */ - j = 0; - for(i=0; inCell>0 || (nNew==1 && cntNew[0]==0) ); - assert( pNew->nOverflow==0 ); - - j = cntNew[i]; - - /* If the sibling page assembled above was not the right-most sibling, - ** insert a divider cell into the parent page. - */ - assert( ileaf ){ - memcpy(&pNew->aData[8], pCell, 4); - }else if( leafData ){ - /* If the tree is a leaf-data tree, and the siblings are leaves, - ** then there is no divider cell in apCell[]. Instead, the divider - ** cell consists of the integer key for the right-most cell of - ** the sibling-page assembled above only. - */ - CellInfo info; - j--; - btreeParseCellPtr(pNew, apCell[j], &info); - pCell = pTemp; - sz = 4 + putVarint(&pCell[4], info.nKey); - pTemp = 0; - }else{ - pCell -= 4; - /* Obscure case for non-leaf-data trees: If the cell at pCell was - ** previously stored on a leaf node, and its reported size was 4 - ** bytes, then it may actually be smaller than this - ** (see btreeParseCellPtr(), 4 bytes is the minimum size of - ** any cell). But it is important to pass the correct size to - ** insertCell(), so reparse the cell now. - ** - ** Note that this can never happen in an SQLite data file, as all - ** cells are at least 4 bytes. It only happens in b-trees used - ** to evaluate "IN (SELECT ...)" and similar clauses. - */ - if( szCell[j]==4 ){ - assert(leafCorrection==4); - sz = cellSizePtr(pParent, pCell); - } - } - iOvflSpace += sz; - assert( sz<=pBt->maxLocal+23 ); - assert( iOvflSpace <= (int)pBt->pageSize ); - insertCell(pParent, nxDiv, pCell, sz, pTemp, pNew->pgno, &rc); - if( rc!=SQLITE_OK ) goto balance_cleanup; - assert( sqlite3PagerIswriteable(pParent->pDbPage) ); - - j++; - nxDiv++; - } - } - assert( j==nCell ); - assert( nOld>0 ); - assert( nNew>0 ); - if( (pageFlags & PTF_LEAF)==0 ){ - u8 *zChild = &apCopy[nOld-1]->aData[8]; - memcpy(&apNew[nNew-1]->aData[8], zChild, 4); - } - - if( isRoot && pParent->nCell==0 && pParent->hdrOffset<=apNew[0]->nFree ){ - /* The root page of the b-tree now contains no cells. The only sibling - ** page is the right-child of the parent. Copy the contents of the - ** child page into the parent, decreasing the overall height of the - ** b-tree structure by one. This is described as the "balance-shallower" - ** sub-algorithm in some documentation. - ** - ** If this is an auto-vacuum database, the call to copyNodeContent() - ** sets all pointer-map entries corresponding to database image pages - ** for which the pointer is stored within the content being copied. - ** - ** The second assert below verifies that the child page is defragmented - ** (it must be, as it was just reconstructed using assemblePage()). This - ** is important if the parent page happens to be page 1 of the database - ** image. */ - assert( nNew==1 ); - assert( apNew[0]->nFree == - (get2byte(&apNew[0]->aData[5])-apNew[0]->cellOffset-apNew[0]->nCell*2) - ); - copyNodeContent(apNew[0], pParent, &rc); - freePage(apNew[0], &rc); - }else if( ISAUTOVACUUM ){ - /* Fix the pointer-map entries for all the cells that were shifted around. - ** There are several different types of pointer-map entries that need to - ** be dealt with by this routine. Some of these have been set already, but - ** many have not. The following is a summary: - ** - ** 1) The entries associated with new sibling pages that were not - ** siblings when this function was called. These have already - ** been set. We don't need to worry about old siblings that were - ** moved to the free-list - the freePage() code has taken care - ** of those. - ** - ** 2) The pointer-map entries associated with the first overflow - ** page in any overflow chains used by new divider cells. These - ** have also already been taken care of by the insertCell() code. - ** - ** 3) If the sibling pages are not leaves, then the child pages of - ** cells stored on the sibling pages may need to be updated. - ** - ** 4) If the sibling pages are not internal intkey nodes, then any - ** overflow pages used by these cells may need to be updated - ** (internal intkey nodes never contain pointers to overflow pages). - ** - ** 5) If the sibling pages are not leaves, then the pointer-map - ** entries for the right-child pages of each sibling may need - ** to be updated. - ** - ** Cases 1 and 2 are dealt with above by other code. The next - ** block deals with cases 3 and 4 and the one after that, case 5. Since - ** setting a pointer map entry is a relatively expensive operation, this - ** code only sets pointer map entries for child or overflow pages that have - ** actually moved between pages. */ - MemPage *pNew = apNew[0]; - MemPage *pOld = apCopy[0]; - int nOverflow = pOld->nOverflow; - int iNextOld = pOld->nCell + nOverflow; - int iOverflow = (nOverflow ? pOld->aiOvfl[0] : -1); - j = 0; /* Current 'old' sibling page */ - k = 0; /* Current 'new' sibling page */ - for(i=0; inCell + pOld->nOverflow; - if( pOld->nOverflow ){ - nOverflow = pOld->nOverflow; - iOverflow = i + !leafData + pOld->aiOvfl[0]; - } - isDivider = !leafData; - } - - assert(nOverflow>0 || iOverflowaiOvfl[0]==pOld->aiOvfl[1]-1); - assert(nOverflow<3 || pOld->aiOvfl[1]==pOld->aiOvfl[2]-1); - if( i==iOverflow ){ - isDivider = 1; - if( (--nOverflow)>0 ){ - iOverflow++; - } - } - - if( i==cntNew[k] ){ - /* Cell i is the cell immediately following the last cell on new - ** sibling page k. If the siblings are not leaf pages of an - ** intkey b-tree, then cell i is a divider cell. */ - pNew = apNew[++k]; - if( !leafData ) continue; - } - assert( jpgno!=pNew->pgno ){ - if( !leafCorrection ){ - ptrmapPut(pBt, get4byte(apCell[i]), PTRMAP_BTREE, pNew->pgno, &rc); - } - if( szCell[i]>pNew->minLocal ){ - ptrmapPutOvflPtr(pNew, apCell[i], &rc); - } - } - } - - if( !leafCorrection ){ - for(i=0; iaData[8]); - ptrmapPut(pBt, key, PTRMAP_BTREE, apNew[i]->pgno, &rc); - } - } - -#if 0 - /* The ptrmapCheckPages() contains assert() statements that verify that - ** all pointer map pages are set correctly. This is helpful while - ** debugging. This is usually disabled because a corrupt database may - ** cause an assert() statement to fail. */ - ptrmapCheckPages(apNew, nNew); - ptrmapCheckPages(&pParent, 1); -#endif - } - - assert( pParent->isInit ); - TRACE(("BALANCE: finished: old=%d new=%d cells=%d\n", - nOld, nNew, nCell)); - - /* - ** Cleanup before returning. - */ -balance_cleanup: - sqlite3ScratchFree(apCell); - for(i=0; i= 1700 && defined(_M_ARM) -#pragma optimize("", on) -#endif - - -/* -** This function is called when the root page of a b-tree structure is -** overfull (has one or more overflow pages). -** -** A new child page is allocated and the contents of the current root -** page, including overflow cells, are copied into the child. The root -** page is then overwritten to make it an empty page with the right-child -** pointer pointing to the new page. -** -** Before returning, all pointer-map entries corresponding to pages -** that the new child-page now contains pointers to are updated. The -** entry corresponding to the new right-child pointer of the root -** page is also updated. -** -** If successful, *ppChild is set to contain a reference to the child -** page and SQLITE_OK is returned. In this case the caller is required -** to call releasePage() on *ppChild exactly once. If an error occurs, -** an error code is returned and *ppChild is set to 0. -*/ -static int balance_deeper(MemPage *pRoot, MemPage **ppChild){ - int rc; /* Return value from subprocedures */ - MemPage *pChild = 0; /* Pointer to a new child page */ - Pgno pgnoChild = 0; /* Page number of the new child page */ - BtShared *pBt = pRoot->pBt; /* The BTree */ - - assert( pRoot->nOverflow>0 ); - assert( sqlite3_mutex_held(pBt->mutex) ); - - /* Make pRoot, the root page of the b-tree, writable. Allocate a new - ** page that will become the new right-child of pPage. Copy the contents - ** of the node stored on pRoot into the new child page. - */ - rc = sqlite3PagerWrite(pRoot->pDbPage); - if( rc==SQLITE_OK ){ - rc = allocateBtreePage(pBt,&pChild,&pgnoChild,pRoot->pgno,0); - copyNodeContent(pRoot, pChild, &rc); - if( ISAUTOVACUUM ){ - ptrmapPut(pBt, pgnoChild, PTRMAP_BTREE, pRoot->pgno, &rc); - } - } - if( rc ){ - *ppChild = 0; - releasePage(pChild); - return rc; - } - assert( sqlite3PagerIswriteable(pChild->pDbPage) ); - assert( sqlite3PagerIswriteable(pRoot->pDbPage) ); - assert( pChild->nCell==pRoot->nCell ); - - TRACE(("BALANCE: copy root %d into %d\n", pRoot->pgno, pChild->pgno)); - - /* Copy the overflow cells from pRoot to pChild */ - memcpy(pChild->aiOvfl, pRoot->aiOvfl, - pRoot->nOverflow*sizeof(pRoot->aiOvfl[0])); - memcpy(pChild->apOvfl, pRoot->apOvfl, - pRoot->nOverflow*sizeof(pRoot->apOvfl[0])); - pChild->nOverflow = pRoot->nOverflow; - - /* Zero the contents of pRoot. Then install pChild as the right-child. */ - zeroPage(pRoot, pChild->aData[0] & ~PTF_LEAF); - put4byte(&pRoot->aData[pRoot->hdrOffset+8], pgnoChild); - - *ppChild = pChild; - return SQLITE_OK; -} - -/* -** The page that pCur currently points to has just been modified in -** some way. This function figures out if this modification means the -** tree needs to be balanced, and if so calls the appropriate balancing -** routine. Balancing routines are: -** -** balance_quick() -** balance_deeper() -** balance_nonroot() -*/ -static int balance(BtCursor *pCur){ - int rc = SQLITE_OK; - const int nMin = pCur->pBt->usableSize * 2 / 3; - u8 aBalanceQuickSpace[13]; - u8 *pFree = 0; - - TESTONLY( int balance_quick_called = 0 ); - TESTONLY( int balance_deeper_called = 0 ); - - do { - int iPage = pCur->iPage; - MemPage *pPage = pCur->apPage[iPage]; - - if( iPage==0 ){ - if( pPage->nOverflow ){ - /* The root page of the b-tree is overfull. In this case call the - ** balance_deeper() function to create a new child for the root-page - ** and copy the current contents of the root-page to it. The - ** next iteration of the do-loop will balance the child page. - */ - assert( (balance_deeper_called++)==0 ); - rc = balance_deeper(pPage, &pCur->apPage[1]); - if( rc==SQLITE_OK ){ - pCur->iPage = 1; - pCur->aiIdx[0] = 0; - pCur->aiIdx[1] = 0; - assert( pCur->apPage[1]->nOverflow ); - } - }else{ - break; - } - }else if( pPage->nOverflow==0 && pPage->nFree<=nMin ){ - break; - }else{ - MemPage * const pParent = pCur->apPage[iPage-1]; - int const iIdx = pCur->aiIdx[iPage-1]; - - rc = sqlite3PagerWrite(pParent->pDbPage); - if( rc==SQLITE_OK ){ -#ifndef SQLITE_OMIT_QUICKBALANCE - if( pPage->hasData - && pPage->nOverflow==1 - && pPage->aiOvfl[0]==pPage->nCell - && pParent->pgno!=1 - && pParent->nCell==iIdx - ){ - /* Call balance_quick() to create a new sibling of pPage on which - ** to store the overflow cell. balance_quick() inserts a new cell - ** into pParent, which may cause pParent overflow. If this - ** happens, the next interation of the do-loop will balance pParent - ** use either balance_nonroot() or balance_deeper(). Until this - ** happens, the overflow cell is stored in the aBalanceQuickSpace[] - ** buffer. - ** - ** The purpose of the following assert() is to check that only a - ** single call to balance_quick() is made for each call to this - ** function. If this were not verified, a subtle bug involving reuse - ** of the aBalanceQuickSpace[] might sneak in. - */ - assert( (balance_quick_called++)==0 ); - rc = balance_quick(pParent, pPage, aBalanceQuickSpace); - }else -#endif - { - /* In this case, call balance_nonroot() to redistribute cells - ** between pPage and up to 2 of its sibling pages. This involves - ** modifying the contents of pParent, which may cause pParent to - ** become overfull or underfull. The next iteration of the do-loop - ** will balance the parent page to correct this. - ** - ** If the parent page becomes overfull, the overflow cell or cells - ** are stored in the pSpace buffer allocated immediately below. - ** A subsequent iteration of the do-loop will deal with this by - ** calling balance_nonroot() (balance_deeper() may be called first, - ** but it doesn't deal with overflow cells - just moves them to a - ** different page). Once this subsequent call to balance_nonroot() - ** has completed, it is safe to release the pSpace buffer used by - ** the previous call, as the overflow cell data will have been - ** copied either into the body of a database page or into the new - ** pSpace buffer passed to the latter call to balance_nonroot(). - */ - u8 *pSpace = sqlite3PageMalloc(pCur->pBt->pageSize); - rc = balance_nonroot(pParent, iIdx, pSpace, iPage==1, pCur->hints); - if( pFree ){ - /* If pFree is not NULL, it points to the pSpace buffer used - ** by a previous call to balance_nonroot(). Its contents are - ** now stored either on real database pages or within the - ** new pSpace buffer, so it may be safely freed here. */ - sqlite3PageFree(pFree); - } - - /* The pSpace buffer will be freed after the next call to - ** balance_nonroot(), or just before this function returns, whichever - ** comes first. */ - pFree = pSpace; - } - } - - pPage->nOverflow = 0; - - /* The next iteration of the do-loop balances the parent page. */ - releasePage(pPage); - pCur->iPage--; - } - }while( rc==SQLITE_OK ); - - if( pFree ){ - sqlite3PageFree(pFree); - } - return rc; -} - - -/* -** Insert a new record into the BTree. The key is given by (pKey,nKey) -** and the data is given by (pData,nData). The cursor is used only to -** define what table the record should be inserted into. The cursor -** is left pointing at a random location. -** -** For an INTKEY table, only the nKey value of the key is used. pKey is -** ignored. For a ZERODATA table, the pData and nData are both ignored. -** -** If the seekResult parameter is non-zero, then a successful call to -** MovetoUnpacked() to seek cursor pCur to (pKey, nKey) has already -** been performed. seekResult is the search result returned (a negative -** number if pCur points at an entry that is smaller than (pKey, nKey), or -** a positive value if pCur points at an etry that is larger than -** (pKey, nKey)). -** -** If the seekResult parameter is non-zero, then the caller guarantees that -** cursor pCur is pointing at the existing copy of a row that is to be -** overwritten. If the seekResult parameter is 0, then cursor pCur may -** point to any entry or to no entry at all and so this function has to seek -** the cursor before the new key can be inserted. -*/ -SQLITE_PRIVATE int sqlite3BtreeInsert( - BtCursor *pCur, /* Insert data into the table of this cursor */ - const void *pKey, i64 nKey, /* The key of the new record */ - const void *pData, int nData, /* The data of the new record */ - int nZero, /* Number of extra 0 bytes to append to data */ - int appendBias, /* True if this is likely an append */ - int seekResult /* Result of prior MovetoUnpacked() call */ -){ - int rc; - int loc = seekResult; /* -1: before desired location +1: after */ - int szNew = 0; - int idx; - MemPage *pPage; - Btree *p = pCur->pBtree; - BtShared *pBt = p->pBt; - unsigned char *oldCell; - unsigned char *newCell = 0; - - if( pCur->eState==CURSOR_FAULT ){ - assert( pCur->skipNext!=SQLITE_OK ); - return pCur->skipNext; - } - - assert( cursorHoldsMutex(pCur) ); - assert( pCur->wrFlag && pBt->inTransaction==TRANS_WRITE - && (pBt->btsFlags & BTS_READ_ONLY)==0 ); - assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) ); - - /* Assert that the caller has been consistent. If this cursor was opened - ** expecting an index b-tree, then the caller should be inserting blob - ** keys with no associated data. If the cursor was opened expecting an - ** intkey table, the caller should be inserting integer keys with a - ** blob of associated data. */ - assert( (pKey==0)==(pCur->pKeyInfo==0) ); - - /* Save the positions of any other cursors open on this table. - ** - ** In some cases, the call to btreeMoveto() below is a no-op. For - ** example, when inserting data into a table with auto-generated integer - ** keys, the VDBE layer invokes sqlite3BtreeLast() to figure out the - ** integer key to use. It then calls this function to actually insert the - ** data into the intkey B-Tree. In this case btreeMoveto() recognizes - ** that the cursor is already where it needs to be and returns without - ** doing any work. To avoid thwarting these optimizations, it is important - ** not to clear the cursor here. - */ - rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); - if( rc ) return rc; - - /* If this is an insert into a table b-tree, invalidate any incrblob - ** cursors open on the row being replaced (assuming this is a replace - ** operation - if it is not, the following is a no-op). */ - if( pCur->pKeyInfo==0 ){ - invalidateIncrblobCursors(p, nKey, 0); - } - - if( !loc ){ - rc = btreeMoveto(pCur, pKey, nKey, appendBias, &loc); - if( rc ) return rc; - } - assert( pCur->eState==CURSOR_VALID || (pCur->eState==CURSOR_INVALID && loc) ); - - pPage = pCur->apPage[pCur->iPage]; - assert( pPage->intKey || nKey>=0 ); - assert( pPage->leaf || !pPage->intKey ); - - TRACE(("INSERT: table=%d nkey=%lld ndata=%d page=%d %s\n", - pCur->pgnoRoot, nKey, nData, pPage->pgno, - loc==0 ? "overwrite" : "new entry")); - assert( pPage->isInit ); - allocateTempSpace(pBt); - newCell = pBt->pTmpSpace; - if( newCell==0 ) return SQLITE_NOMEM; - rc = fillInCell(pPage, newCell, pKey, nKey, pData, nData, nZero, &szNew); - if( rc ) goto end_insert; - assert( szNew==cellSizePtr(pPage, newCell) ); - assert( szNew <= MX_CELL_SIZE(pBt) ); - idx = pCur->aiIdx[pCur->iPage]; - if( loc==0 ){ - u16 szOld; - assert( idxnCell ); - rc = sqlite3PagerWrite(pPage->pDbPage); - if( rc ){ - goto end_insert; - } - oldCell = findCell(pPage, idx); - if( !pPage->leaf ){ - memcpy(newCell, oldCell, 4); - } - szOld = cellSizePtr(pPage, oldCell); - rc = clearCell(pPage, oldCell); - dropCell(pPage, idx, szOld, &rc); - if( rc ) goto end_insert; - }else if( loc<0 && pPage->nCell>0 ){ - assert( pPage->leaf ); - idx = ++pCur->aiIdx[pCur->iPage]; - }else{ - assert( pPage->leaf ); - } - insertCell(pPage, idx, newCell, szNew, 0, 0, &rc); - assert( rc!=SQLITE_OK || pPage->nCell>0 || pPage->nOverflow>0 ); - - /* If no error has occurred and pPage has an overflow cell, call balance() - ** to redistribute the cells within the tree. Since balance() may move - ** the cursor, zero the BtCursor.info.nSize and BtCursor.validNKey - ** variables. - ** - ** Previous versions of SQLite called moveToRoot() to move the cursor - ** back to the root page as balance() used to invalidate the contents - ** of BtCursor.apPage[] and BtCursor.aiIdx[]. Instead of doing that, - ** set the cursor state to "invalid". This makes common insert operations - ** slightly faster. - ** - ** There is a subtle but important optimization here too. When inserting - ** multiple records into an intkey b-tree using a single cursor (as can - ** happen while processing an "INSERT INTO ... SELECT" statement), it - ** is advantageous to leave the cursor pointing to the last entry in - ** the b-tree if possible. If the cursor is left pointing to the last - ** entry in the table, and the next row inserted has an integer key - ** larger than the largest existing key, it is possible to insert the - ** row without seeking the cursor. This can be a big performance boost. - */ - pCur->info.nSize = 0; - pCur->validNKey = 0; - if( rc==SQLITE_OK && pPage->nOverflow ){ - rc = balance(pCur); - - /* Must make sure nOverflow is reset to zero even if the balance() - ** fails. Internal data structure corruption will result otherwise. - ** Also, set the cursor state to invalid. This stops saveCursorPosition() - ** from trying to save the current position of the cursor. */ - pCur->apPage[pCur->iPage]->nOverflow = 0; - pCur->eState = CURSOR_INVALID; - } - assert( pCur->apPage[pCur->iPage]->nOverflow==0 ); - -end_insert: - return rc; -} - -/* -** Delete the entry that the cursor is pointing to. The cursor -** is left pointing at a arbitrary location. -*/ -SQLITE_PRIVATE int sqlite3BtreeDelete(BtCursor *pCur){ - Btree *p = pCur->pBtree; - BtShared *pBt = p->pBt; - int rc; /* Return code */ - MemPage *pPage; /* Page to delete cell from */ - unsigned char *pCell; /* Pointer to cell to delete */ - int iCellIdx; /* Index of cell to delete */ - int iCellDepth; /* Depth of node containing pCell */ - - assert( cursorHoldsMutex(pCur) ); - assert( pBt->inTransaction==TRANS_WRITE ); - assert( (pBt->btsFlags & BTS_READ_ONLY)==0 ); - assert( pCur->wrFlag ); - assert( hasSharedCacheTableLock(p, pCur->pgnoRoot, pCur->pKeyInfo!=0, 2) ); - assert( !hasReadConflicts(p, pCur->pgnoRoot) ); - - if( NEVER(pCur->aiIdx[pCur->iPage]>=pCur->apPage[pCur->iPage]->nCell) - || NEVER(pCur->eState!=CURSOR_VALID) - ){ - return SQLITE_ERROR; /* Something has gone awry. */ - } - - iCellDepth = pCur->iPage; - iCellIdx = pCur->aiIdx[iCellDepth]; - pPage = pCur->apPage[iCellDepth]; - pCell = findCell(pPage, iCellIdx); - - /* If the page containing the entry to delete is not a leaf page, move - ** the cursor to the largest entry in the tree that is smaller than - ** the entry being deleted. This cell will replace the cell being deleted - ** from the internal node. The 'previous' entry is used for this instead - ** of the 'next' entry, as the previous entry is always a part of the - ** sub-tree headed by the child page of the cell being deleted. This makes - ** balancing the tree following the delete operation easier. */ - if( !pPage->leaf ){ - int notUsed; - rc = sqlite3BtreePrevious(pCur, ¬Used); - if( rc ) return rc; - } - - /* Save the positions of any other cursors open on this table before - ** making any modifications. Make the page containing the entry to be - ** deleted writable. Then free any overflow pages associated with the - ** entry and finally remove the cell itself from within the page. - */ - rc = saveAllCursors(pBt, pCur->pgnoRoot, pCur); - if( rc ) return rc; - - /* If this is a delete operation to remove a row from a table b-tree, - ** invalidate any incrblob cursors open on the row being deleted. */ - if( pCur->pKeyInfo==0 ){ - invalidateIncrblobCursors(p, pCur->info.nKey, 0); - } - - rc = sqlite3PagerWrite(pPage->pDbPage); - if( rc ) return rc; - rc = clearCell(pPage, pCell); - dropCell(pPage, iCellIdx, cellSizePtr(pPage, pCell), &rc); - if( rc ) return rc; - - /* If the cell deleted was not located on a leaf page, then the cursor - ** is currently pointing to the largest entry in the sub-tree headed - ** by the child-page of the cell that was just deleted from an internal - ** node. The cell from the leaf node needs to be moved to the internal - ** node to replace the deleted cell. */ - if( !pPage->leaf ){ - MemPage *pLeaf = pCur->apPage[pCur->iPage]; - int nCell; - Pgno n = pCur->apPage[iCellDepth+1]->pgno; - unsigned char *pTmp; - - pCell = findCell(pLeaf, pLeaf->nCell-1); - nCell = cellSizePtr(pLeaf, pCell); - assert( MX_CELL_SIZE(pBt) >= nCell ); - - allocateTempSpace(pBt); - pTmp = pBt->pTmpSpace; - - rc = sqlite3PagerWrite(pLeaf->pDbPage); - insertCell(pPage, iCellIdx, pCell-4, nCell+4, pTmp, n, &rc); - dropCell(pLeaf, pLeaf->nCell-1, nCell, &rc); - if( rc ) return rc; - } - - /* Balance the tree. If the entry deleted was located on a leaf page, - ** then the cursor still points to that page. In this case the first - ** call to balance() repairs the tree, and the if(...) condition is - ** never true. - ** - ** Otherwise, if the entry deleted was on an internal node page, then - ** pCur is pointing to the leaf page from which a cell was removed to - ** replace the cell deleted from the internal node. This is slightly - ** tricky as the leaf node may be underfull, and the internal node may - ** be either under or overfull. In this case run the balancing algorithm - ** on the leaf node first. If the balance proceeds far enough up the - ** tree that we can be sure that any problem in the internal node has - ** been corrected, so be it. Otherwise, after balancing the leaf node, - ** walk the cursor up the tree to the internal node and balance it as - ** well. */ - rc = balance(pCur); - if( rc==SQLITE_OK && pCur->iPage>iCellDepth ){ - while( pCur->iPage>iCellDepth ){ - releasePage(pCur->apPage[pCur->iPage--]); - } - rc = balance(pCur); - } - - if( rc==SQLITE_OK ){ - moveToRoot(pCur); - } - return rc; -} - -/* -** Create a new BTree table. Write into *piTable the page -** number for the root page of the new table. -** -** The type of type is determined by the flags parameter. Only the -** following values of flags are currently in use. Other values for -** flags might not work: -** -** BTREE_INTKEY|BTREE_LEAFDATA Used for SQL tables with rowid keys -** BTREE_ZERODATA Used for SQL indices -*/ -static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){ - BtShared *pBt = p->pBt; - MemPage *pRoot; - Pgno pgnoRoot; - int rc; - int ptfFlags; /* Page-type flage for the root page of new table */ - - assert( sqlite3BtreeHoldsMutex(p) ); - assert( pBt->inTransaction==TRANS_WRITE ); - assert( (pBt->btsFlags & BTS_READ_ONLY)==0 ); - -#ifdef SQLITE_OMIT_AUTOVACUUM - rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0); - if( rc ){ - return rc; - } -#else - if( pBt->autoVacuum ){ - Pgno pgnoMove; /* Move a page here to make room for the root-page */ - MemPage *pPageMove; /* The page to move to. */ - - /* Creating a new table may probably require moving an existing database - ** to make room for the new tables root page. In case this page turns - ** out to be an overflow page, delete all overflow page-map caches - ** held by open cursors. - */ - invalidateAllOverflowCache(pBt); - - /* Read the value of meta[3] from the database to determine where the - ** root page of the new table should go. meta[3] is the largest root-page - ** created so far, so the new root-page is (meta[3]+1). - */ - sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot); - pgnoRoot++; - - /* The new root-page may not be allocated on a pointer-map page, or the - ** PENDING_BYTE page. - */ - while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) || - pgnoRoot==PENDING_BYTE_PAGE(pBt) ){ - pgnoRoot++; - } - assert( pgnoRoot>=3 ); - - /* Allocate a page. The page that currently resides at pgnoRoot will - ** be moved to the allocated page (unless the allocated page happens - ** to reside at pgnoRoot). - */ - rc = allocateBtreePage(pBt, &pPageMove, &pgnoMove, pgnoRoot, BTALLOC_EXACT); - if( rc!=SQLITE_OK ){ - return rc; - } - - if( pgnoMove!=pgnoRoot ){ - /* pgnoRoot is the page that will be used for the root-page of - ** the new table (assuming an error did not occur). But we were - ** allocated pgnoMove. If required (i.e. if it was not allocated - ** by extending the file), the current page at position pgnoMove - ** is already journaled. - */ - u8 eType = 0; - Pgno iPtrPage = 0; - - /* Save the positions of any open cursors. This is required in - ** case they are holding a reference to an xFetch reference - ** corresponding to page pgnoRoot. */ - rc = saveAllCursors(pBt, 0, 0); - releasePage(pPageMove); - if( rc!=SQLITE_OK ){ - return rc; - } - - /* Move the page currently at pgnoRoot to pgnoMove. */ - rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage); - if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){ - rc = SQLITE_CORRUPT_BKPT; - } - if( rc!=SQLITE_OK ){ - releasePage(pRoot); - return rc; - } - assert( eType!=PTRMAP_ROOTPAGE ); - assert( eType!=PTRMAP_FREEPAGE ); - rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove, 0); - releasePage(pRoot); - - /* Obtain the page at pgnoRoot */ - if( rc!=SQLITE_OK ){ - return rc; - } - rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - rc = sqlite3PagerWrite(pRoot->pDbPage); - if( rc!=SQLITE_OK ){ - releasePage(pRoot); - return rc; - } - }else{ - pRoot = pPageMove; - } - - /* Update the pointer-map and meta-data with the new root-page number. */ - ptrmapPut(pBt, pgnoRoot, PTRMAP_ROOTPAGE, 0, &rc); - if( rc ){ - releasePage(pRoot); - return rc; - } - - /* When the new root page was allocated, page 1 was made writable in - ** order either to increase the database filesize, or to decrement the - ** freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail. - */ - assert( sqlite3PagerIswriteable(pBt->pPage1->pDbPage) ); - rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot); - if( NEVER(rc) ){ - releasePage(pRoot); - return rc; - } - - }else{ - rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0); - if( rc ) return rc; - } -#endif - assert( sqlite3PagerIswriteable(pRoot->pDbPage) ); - if( createTabFlags & BTREE_INTKEY ){ - ptfFlags = PTF_INTKEY | PTF_LEAFDATA | PTF_LEAF; - }else{ - ptfFlags = PTF_ZERODATA | PTF_LEAF; - } - zeroPage(pRoot, ptfFlags); - sqlite3PagerUnref(pRoot->pDbPage); - assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 ); - *piTable = (int)pgnoRoot; - return SQLITE_OK; -} -SQLITE_PRIVATE int sqlite3BtreeCreateTable(Btree *p, int *piTable, int flags){ - int rc; - sqlite3BtreeEnter(p); - rc = btreeCreateTable(p, piTable, flags); - sqlite3BtreeLeave(p); - return rc; -} - -/* -** Erase the given database page and all its children. Return -** the page to the freelist. -*/ -static int clearDatabasePage( - BtShared *pBt, /* The BTree that contains the table */ - Pgno pgno, /* Page number to clear */ - int freePageFlag, /* Deallocate page if true */ - int *pnChange /* Add number of Cells freed to this counter */ -){ - MemPage *pPage; - int rc; - unsigned char *pCell; - int i; - int hdr; - - assert( sqlite3_mutex_held(pBt->mutex) ); - if( pgno>btreePagecount(pBt) ){ - return SQLITE_CORRUPT_BKPT; - } - - rc = getAndInitPage(pBt, pgno, &pPage, 0); - if( rc ) return rc; - hdr = pPage->hdrOffset; - for(i=0; inCell; i++){ - pCell = findCell(pPage, i); - if( !pPage->leaf ){ - rc = clearDatabasePage(pBt, get4byte(pCell), 1, pnChange); - if( rc ) goto cleardatabasepage_out; - } - rc = clearCell(pPage, pCell); - if( rc ) goto cleardatabasepage_out; - } - if( !pPage->leaf ){ - rc = clearDatabasePage(pBt, get4byte(&pPage->aData[hdr+8]), 1, pnChange); - if( rc ) goto cleardatabasepage_out; - }else if( pnChange ){ - assert( pPage->intKey ); - *pnChange += pPage->nCell; - } - if( freePageFlag ){ - freePage(pPage, &rc); - }else if( (rc = sqlite3PagerWrite(pPage->pDbPage))==0 ){ - zeroPage(pPage, pPage->aData[hdr] | PTF_LEAF); - } - -cleardatabasepage_out: - releasePage(pPage); - return rc; -} - -/* -** Delete all information from a single table in the database. iTable is -** the page number of the root of the table. After this routine returns, -** the root page is empty, but still exists. -** -** This routine will fail with SQLITE_LOCKED if there are any open -** read cursors on the table. Open write cursors are moved to the -** root of the table. -** -** If pnChange is not NULL, then table iTable must be an intkey table. The -** integer value pointed to by pnChange is incremented by the number of -** entries in the table. -*/ -SQLITE_PRIVATE int sqlite3BtreeClearTable(Btree *p, int iTable, int *pnChange){ - int rc; - BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); - assert( p->inTrans==TRANS_WRITE ); - - rc = saveAllCursors(pBt, (Pgno)iTable, 0); - - if( SQLITE_OK==rc ){ - /* Invalidate all incrblob cursors open on table iTable (assuming iTable - ** is the root of a table b-tree - if it is not, the following call is - ** a no-op). */ - invalidateIncrblobCursors(p, 0, 1); - rc = clearDatabasePage(pBt, (Pgno)iTable, 0, pnChange); - } - sqlite3BtreeLeave(p); - return rc; -} - -/* -** Erase all information in a table and add the root of the table to -** the freelist. Except, the root of the principle table (the one on -** page 1) is never added to the freelist. -** -** This routine will fail with SQLITE_LOCKED if there are any open -** cursors on the table. -** -** If AUTOVACUUM is enabled and the page at iTable is not the last -** root page in the database file, then the last root page -** in the database file is moved into the slot formerly occupied by -** iTable and that last slot formerly occupied by the last root page -** is added to the freelist instead of iTable. In this say, all -** root pages are kept at the beginning of the database file, which -** is necessary for AUTOVACUUM to work right. *piMoved is set to the -** page number that used to be the last root page in the file before -** the move. If no page gets moved, *piMoved is set to 0. -** The last root page is recorded in meta[3] and the value of -** meta[3] is updated by this procedure. -*/ -static int btreeDropTable(Btree *p, Pgno iTable, int *piMoved){ - int rc; - MemPage *pPage = 0; - BtShared *pBt = p->pBt; - - assert( sqlite3BtreeHoldsMutex(p) ); - assert( p->inTrans==TRANS_WRITE ); - - /* It is illegal to drop a table if any cursors are open on the - ** database. This is because in auto-vacuum mode the backend may - ** need to move another root-page to fill a gap left by the deleted - ** root page. If an open cursor was using this page a problem would - ** occur. - ** - ** This error is caught long before control reaches this point. - */ - if( NEVER(pBt->pCursor) ){ - sqlite3ConnectionBlocked(p->db, pBt->pCursor->pBtree->db); - return SQLITE_LOCKED_SHAREDCACHE; - } - - rc = btreeGetPage(pBt, (Pgno)iTable, &pPage, 0); - if( rc ) return rc; - rc = sqlite3BtreeClearTable(p, iTable, 0); - if( rc ){ - releasePage(pPage); - return rc; - } - - *piMoved = 0; - - if( iTable>1 ){ -#ifdef SQLITE_OMIT_AUTOVACUUM - freePage(pPage, &rc); - releasePage(pPage); -#else - if( pBt->autoVacuum ){ - Pgno maxRootPgno; - sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &maxRootPgno); - - if( iTable==maxRootPgno ){ - /* If the table being dropped is the table with the largest root-page - ** number in the database, put the root page on the free list. - */ - freePage(pPage, &rc); - releasePage(pPage); - if( rc!=SQLITE_OK ){ - return rc; - } - }else{ - /* The table being dropped does not have the largest root-page - ** number in the database. So move the page that does into the - ** gap left by the deleted root-page. - */ - MemPage *pMove; - releasePage(pPage); - rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - rc = relocatePage(pBt, pMove, PTRMAP_ROOTPAGE, 0, iTable, 0); - releasePage(pMove); - if( rc!=SQLITE_OK ){ - return rc; - } - pMove = 0; - rc = btreeGetPage(pBt, maxRootPgno, &pMove, 0); - freePage(pMove, &rc); - releasePage(pMove); - if( rc!=SQLITE_OK ){ - return rc; - } - *piMoved = maxRootPgno; - } - - /* Set the new 'max-root-page' value in the database header. This - ** is the old value less one, less one more if that happens to - ** be a root-page number, less one again if that is the - ** PENDING_BYTE_PAGE. - */ - maxRootPgno--; - while( maxRootPgno==PENDING_BYTE_PAGE(pBt) - || PTRMAP_ISPAGE(pBt, maxRootPgno) ){ - maxRootPgno--; - } - assert( maxRootPgno!=PENDING_BYTE_PAGE(pBt) ); - - rc = sqlite3BtreeUpdateMeta(p, 4, maxRootPgno); - }else{ - freePage(pPage, &rc); - releasePage(pPage); - } -#endif - }else{ - /* If sqlite3BtreeDropTable was called on page 1. - ** This really never should happen except in a corrupt - ** database. - */ - zeroPage(pPage, PTF_INTKEY|PTF_LEAF ); - releasePage(pPage); - } - return rc; -} -SQLITE_PRIVATE int sqlite3BtreeDropTable(Btree *p, int iTable, int *piMoved){ - int rc; - sqlite3BtreeEnter(p); - rc = btreeDropTable(p, iTable, piMoved); - sqlite3BtreeLeave(p); - return rc; -} - - -/* -** This function may only be called if the b-tree connection already -** has a read or write transaction open on the database. -** -** Read the meta-information out of a database file. Meta[0] -** is the number of free pages currently in the database. Meta[1] -** through meta[15] are available for use by higher layers. Meta[0] -** is read-only, the others are read/write. -** -** The schema layer numbers meta values differently. At the schema -** layer (and the SetCookie and ReadCookie opcodes) the number of -** free pages is not visible. So Cookie[0] is the same as Meta[1]. -*/ -SQLITE_PRIVATE void sqlite3BtreeGetMeta(Btree *p, int idx, u32 *pMeta){ - BtShared *pBt = p->pBt; - - sqlite3BtreeEnter(p); - assert( p->inTrans>TRANS_NONE ); - assert( SQLITE_OK==querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK) ); - assert( pBt->pPage1 ); - assert( idx>=0 && idx<=15 ); - - *pMeta = get4byte(&pBt->pPage1->aData[36 + idx*4]); - - /* If auto-vacuum is disabled in this build and this is an auto-vacuum - ** database, mark the database as read-only. */ -#ifdef SQLITE_OMIT_AUTOVACUUM - if( idx==BTREE_LARGEST_ROOT_PAGE && *pMeta>0 ){ - pBt->btsFlags |= BTS_READ_ONLY; - } -#endif - - sqlite3BtreeLeave(p); -} - -/* -** Write meta-information back into the database. Meta[0] is -** read-only and may not be written. -*/ -SQLITE_PRIVATE int sqlite3BtreeUpdateMeta(Btree *p, int idx, u32 iMeta){ - BtShared *pBt = p->pBt; - unsigned char *pP1; - int rc; - assert( idx>=1 && idx<=15 ); - sqlite3BtreeEnter(p); - assert( p->inTrans==TRANS_WRITE ); - assert( pBt->pPage1!=0 ); - pP1 = pBt->pPage1->aData; - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); - if( rc==SQLITE_OK ){ - put4byte(&pP1[36 + idx*4], iMeta); -#ifndef SQLITE_OMIT_AUTOVACUUM - if( idx==BTREE_INCR_VACUUM ){ - assert( pBt->autoVacuum || iMeta==0 ); - assert( iMeta==0 || iMeta==1 ); - pBt->incrVacuum = (u8)iMeta; - } -#endif - } - sqlite3BtreeLeave(p); - return rc; -} - -#ifndef SQLITE_OMIT_BTREECOUNT -/* -** The first argument, pCur, is a cursor opened on some b-tree. Count the -** number of entries in the b-tree and write the result to *pnEntry. -** -** SQLITE_OK is returned if the operation is successfully executed. -** Otherwise, if an error is encountered (i.e. an IO error or database -** corruption) an SQLite error code is returned. -*/ -SQLITE_PRIVATE int sqlite3BtreeCount(BtCursor *pCur, i64 *pnEntry){ - i64 nEntry = 0; /* Value to return in *pnEntry */ - int rc; /* Return code */ - - if( pCur->pgnoRoot==0 ){ - *pnEntry = 0; - return SQLITE_OK; - } - rc = moveToRoot(pCur); - - /* Unless an error occurs, the following loop runs one iteration for each - ** page in the B-Tree structure (not including overflow pages). - */ - while( rc==SQLITE_OK ){ - int iIdx; /* Index of child node in parent */ - MemPage *pPage; /* Current page of the b-tree */ - - /* If this is a leaf page or the tree is not an int-key tree, then - ** this page contains countable entries. Increment the entry counter - ** accordingly. - */ - pPage = pCur->apPage[pCur->iPage]; - if( pPage->leaf || !pPage->intKey ){ - nEntry += pPage->nCell; - } - - /* pPage is a leaf node. This loop navigates the cursor so that it - ** points to the first interior cell that it points to the parent of - ** the next page in the tree that has not yet been visited. The - ** pCur->aiIdx[pCur->iPage] value is set to the index of the parent cell - ** of the page, or to the number of cells in the page if the next page - ** to visit is the right-child of its parent. - ** - ** If all pages in the tree have been visited, return SQLITE_OK to the - ** caller. - */ - if( pPage->leaf ){ - do { - if( pCur->iPage==0 ){ - /* All pages of the b-tree have been visited. Return successfully. */ - *pnEntry = nEntry; - return SQLITE_OK; - } - moveToParent(pCur); - }while ( pCur->aiIdx[pCur->iPage]>=pCur->apPage[pCur->iPage]->nCell ); - - pCur->aiIdx[pCur->iPage]++; - pPage = pCur->apPage[pCur->iPage]; - } - - /* Descend to the child node of the cell that the cursor currently - ** points at. This is the right-child if (iIdx==pPage->nCell). - */ - iIdx = pCur->aiIdx[pCur->iPage]; - if( iIdx==pPage->nCell ){ - rc = moveToChild(pCur, get4byte(&pPage->aData[pPage->hdrOffset+8])); - }else{ - rc = moveToChild(pCur, get4byte(findCell(pPage, iIdx))); - } - } - - /* An error has occurred. Return an error code. */ - return rc; -} -#endif - -/* -** Return the pager associated with a BTree. This routine is used for -** testing and debugging only. -*/ -SQLITE_PRIVATE Pager *sqlite3BtreePager(Btree *p){ - return p->pBt->pPager; -} - -#ifndef SQLITE_OMIT_INTEGRITY_CHECK -/* -** Append a message to the error message string. -*/ -static void checkAppendMsg( - IntegrityCk *pCheck, - char *zMsg1, - const char *zFormat, - ... -){ - va_list ap; - if( !pCheck->mxErr ) return; - pCheck->mxErr--; - pCheck->nErr++; - va_start(ap, zFormat); - if( pCheck->errMsg.nChar ){ - sqlite3StrAccumAppend(&pCheck->errMsg, "\n", 1); - } - if( zMsg1 ){ - sqlite3StrAccumAppendAll(&pCheck->errMsg, zMsg1); - } - sqlite3VXPrintf(&pCheck->errMsg, 1, zFormat, ap); - va_end(ap); - if( pCheck->errMsg.accError==STRACCUM_NOMEM ){ - pCheck->mallocFailed = 1; - } -} -#endif /* SQLITE_OMIT_INTEGRITY_CHECK */ - -#ifndef SQLITE_OMIT_INTEGRITY_CHECK - -/* -** Return non-zero if the bit in the IntegrityCk.aPgRef[] array that -** corresponds to page iPg is already set. -*/ -static int getPageReferenced(IntegrityCk *pCheck, Pgno iPg){ - assert( iPg<=pCheck->nPage && sizeof(pCheck->aPgRef[0])==1 ); - return (pCheck->aPgRef[iPg/8] & (1 << (iPg & 0x07))); -} - -/* -** Set the bit in the IntegrityCk.aPgRef[] array that corresponds to page iPg. -*/ -static void setPageReferenced(IntegrityCk *pCheck, Pgno iPg){ - assert( iPg<=pCheck->nPage && sizeof(pCheck->aPgRef[0])==1 ); - pCheck->aPgRef[iPg/8] |= (1 << (iPg & 0x07)); -} - - -/* -** Add 1 to the reference count for page iPage. If this is the second -** reference to the page, add an error message to pCheck->zErrMsg. -** Return 1 if there are 2 ore more references to the page and 0 if -** if this is the first reference to the page. -** -** Also check that the page number is in bounds. -*/ -static int checkRef(IntegrityCk *pCheck, Pgno iPage, char *zContext){ - if( iPage==0 ) return 1; - if( iPage>pCheck->nPage ){ - checkAppendMsg(pCheck, zContext, "invalid page number %d", iPage); - return 1; - } - if( getPageReferenced(pCheck, iPage) ){ - checkAppendMsg(pCheck, zContext, "2nd reference to page %d", iPage); - return 1; - } - setPageReferenced(pCheck, iPage); - return 0; -} - -#ifndef SQLITE_OMIT_AUTOVACUUM -/* -** Check that the entry in the pointer-map for page iChild maps to -** page iParent, pointer type ptrType. If not, append an error message -** to pCheck. -*/ -static void checkPtrmap( - IntegrityCk *pCheck, /* Integrity check context */ - Pgno iChild, /* Child page number */ - u8 eType, /* Expected pointer map type */ - Pgno iParent, /* Expected pointer map parent page number */ - char *zContext /* Context description (used for error msg) */ -){ - int rc; - u8 ePtrmapType; - Pgno iPtrmapParent; - - rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent); - if( rc!=SQLITE_OK ){ - if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) pCheck->mallocFailed = 1; - checkAppendMsg(pCheck, zContext, "Failed to read ptrmap key=%d", iChild); - return; - } - - if( ePtrmapType!=eType || iPtrmapParent!=iParent ){ - checkAppendMsg(pCheck, zContext, - "Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)", - iChild, eType, iParent, ePtrmapType, iPtrmapParent); - } -} -#endif - -/* -** Check the integrity of the freelist or of an overflow page list. -** Verify that the number of pages on the list is N. -*/ -static void checkList( - IntegrityCk *pCheck, /* Integrity checking context */ - int isFreeList, /* True for a freelist. False for overflow page list */ - int iPage, /* Page number for first page in the list */ - int N, /* Expected number of pages in the list */ - char *zContext /* Context for error messages */ -){ - int i; - int expected = N; - int iFirst = iPage; - while( N-- > 0 && pCheck->mxErr ){ - DbPage *pOvflPage; - unsigned char *pOvflData; - if( iPage<1 ){ - checkAppendMsg(pCheck, zContext, - "%d of %d pages missing from overflow list starting at %d", - N+1, expected, iFirst); - break; - } - if( checkRef(pCheck, iPage, zContext) ) break; - if( sqlite3PagerGet(pCheck->pPager, (Pgno)iPage, &pOvflPage) ){ - checkAppendMsg(pCheck, zContext, "failed to get page %d", iPage); - break; - } - pOvflData = (unsigned char *)sqlite3PagerGetData(pOvflPage); - if( isFreeList ){ - int n = get4byte(&pOvflData[4]); -#ifndef SQLITE_OMIT_AUTOVACUUM - if( pCheck->pBt->autoVacuum ){ - checkPtrmap(pCheck, iPage, PTRMAP_FREEPAGE, 0, zContext); - } -#endif - if( n>(int)pCheck->pBt->usableSize/4-2 ){ - checkAppendMsg(pCheck, zContext, - "freelist leaf count too big on page %d", iPage); - N--; - }else{ - for(i=0; ipBt->autoVacuum ){ - checkPtrmap(pCheck, iFreePage, PTRMAP_FREEPAGE, 0, zContext); - } -#endif - checkRef(pCheck, iFreePage, zContext); - } - N -= n; - } - } -#ifndef SQLITE_OMIT_AUTOVACUUM - else{ - /* If this database supports auto-vacuum and iPage is not the last - ** page in this overflow list, check that the pointer-map entry for - ** the following page matches iPage. - */ - if( pCheck->pBt->autoVacuum && N>0 ){ - i = get4byte(pOvflData); - checkPtrmap(pCheck, i, PTRMAP_OVERFLOW2, iPage, zContext); - } - } -#endif - iPage = get4byte(pOvflData); - sqlite3PagerUnref(pOvflPage); - } -} -#endif /* SQLITE_OMIT_INTEGRITY_CHECK */ - -#ifndef SQLITE_OMIT_INTEGRITY_CHECK -/* -** Do various sanity checks on a single page of a tree. Return -** the tree depth. Root pages return 0. Parents of root pages -** return 1, and so forth. -** -** These checks are done: -** -** 1. Make sure that cells and freeblocks do not overlap -** but combine to completely cover the page. -** NO 2. Make sure cell keys are in order. -** NO 3. Make sure no key is less than or equal to zLowerBound. -** NO 4. Make sure no key is greater than or equal to zUpperBound. -** 5. Check the integrity of overflow pages. -** 6. Recursively call checkTreePage on all children. -** 7. Verify that the depth of all children is the same. -** 8. Make sure this page is at least 33% full or else it is -** the root of the tree. -*/ -static int checkTreePage( - IntegrityCk *pCheck, /* Context for the sanity check */ - int iPage, /* Page number of the page to check */ - char *zParentContext, /* Parent context */ - i64 *pnParentMinKey, - i64 *pnParentMaxKey -){ - MemPage *pPage; - int i, rc, depth, d2, pgno, cnt; - int hdr, cellStart; - int nCell; - u8 *data; - BtShared *pBt; - int usableSize; - char zContext[100]; - char *hit = 0; - i64 nMinKey = 0; - i64 nMaxKey = 0; - - sqlite3_snprintf(sizeof(zContext), zContext, "Page %d: ", iPage); - - /* Check that the page exists - */ - pBt = pCheck->pBt; - usableSize = pBt->usableSize; - if( iPage==0 ) return 0; - if( checkRef(pCheck, iPage, zParentContext) ) return 0; - if( (rc = btreeGetPage(pBt, (Pgno)iPage, &pPage, 0))!=0 ){ - checkAppendMsg(pCheck, zContext, - "unable to get the page. error code=%d", rc); - return 0; - } - - /* Clear MemPage.isInit to make sure the corruption detection code in - ** btreeInitPage() is executed. */ - pPage->isInit = 0; - if( (rc = btreeInitPage(pPage))!=0 ){ - assert( rc==SQLITE_CORRUPT ); /* The only possible error from InitPage */ - checkAppendMsg(pCheck, zContext, - "btreeInitPage() returns error code %d", rc); - releasePage(pPage); - return 0; - } - - /* Check out all the cells. - */ - depth = 0; - for(i=0; inCell && pCheck->mxErr; i++){ - u8 *pCell; - u32 sz; - CellInfo info; - - /* Check payload overflow pages - */ - sqlite3_snprintf(sizeof(zContext), zContext, - "On tree page %d cell %d: ", iPage, i); - pCell = findCell(pPage,i); - btreeParseCellPtr(pPage, pCell, &info); - sz = info.nData; - if( !pPage->intKey ) sz += (int)info.nKey; - /* For intKey pages, check that the keys are in order. - */ - else if( i==0 ) nMinKey = nMaxKey = info.nKey; - else{ - if( info.nKey <= nMaxKey ){ - checkAppendMsg(pCheck, zContext, - "Rowid %lld out of order (previous was %lld)", info.nKey, nMaxKey); - } - nMaxKey = info.nKey; - } - assert( sz==info.nPayload ); - if( (sz>info.nLocal) - && (&pCell[info.iOverflow]<=&pPage->aData[pBt->usableSize]) - ){ - int nPage = (sz - info.nLocal + usableSize - 5)/(usableSize - 4); - Pgno pgnoOvfl = get4byte(&pCell[info.iOverflow]); -#ifndef SQLITE_OMIT_AUTOVACUUM - if( pBt->autoVacuum ){ - checkPtrmap(pCheck, pgnoOvfl, PTRMAP_OVERFLOW1, iPage, zContext); - } -#endif - checkList(pCheck, 0, pgnoOvfl, nPage, zContext); - } - - /* Check sanity of left child page. - */ - if( !pPage->leaf ){ - pgno = get4byte(pCell); -#ifndef SQLITE_OMIT_AUTOVACUUM - if( pBt->autoVacuum ){ - checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext); - } -#endif - d2 = checkTreePage(pCheck, pgno, zContext, &nMinKey, i==0 ? NULL : &nMaxKey); - if( i>0 && d2!=depth ){ - checkAppendMsg(pCheck, zContext, "Child page depth differs"); - } - depth = d2; - } - } - - if( !pPage->leaf ){ - pgno = get4byte(&pPage->aData[pPage->hdrOffset+8]); - sqlite3_snprintf(sizeof(zContext), zContext, - "On page %d at right child: ", iPage); -#ifndef SQLITE_OMIT_AUTOVACUUM - if( pBt->autoVacuum ){ - checkPtrmap(pCheck, pgno, PTRMAP_BTREE, iPage, zContext); - } -#endif - checkTreePage(pCheck, pgno, zContext, NULL, !pPage->nCell ? NULL : &nMaxKey); - } - - /* For intKey leaf pages, check that the min/max keys are in order - ** with any left/parent/right pages. - */ - if( pPage->leaf && pPage->intKey ){ - /* if we are a left child page */ - if( pnParentMinKey ){ - /* if we are the left most child page */ - if( !pnParentMaxKey ){ - if( nMaxKey > *pnParentMinKey ){ - checkAppendMsg(pCheck, zContext, - "Rowid %lld out of order (max larger than parent min of %lld)", - nMaxKey, *pnParentMinKey); - } - }else{ - if( nMinKey <= *pnParentMinKey ){ - checkAppendMsg(pCheck, zContext, - "Rowid %lld out of order (min less than parent min of %lld)", - nMinKey, *pnParentMinKey); - } - if( nMaxKey > *pnParentMaxKey ){ - checkAppendMsg(pCheck, zContext, - "Rowid %lld out of order (max larger than parent max of %lld)", - nMaxKey, *pnParentMaxKey); - } - *pnParentMinKey = nMaxKey; - } - /* else if we're a right child page */ - } else if( pnParentMaxKey ){ - if( nMinKey <= *pnParentMaxKey ){ - checkAppendMsg(pCheck, zContext, - "Rowid %lld out of order (min less than parent max of %lld)", - nMinKey, *pnParentMaxKey); - } - } - } - - /* Check for complete coverage of the page - */ - data = pPage->aData; - hdr = pPage->hdrOffset; - hit = sqlite3PageMalloc( pBt->pageSize ); - if( hit==0 ){ - pCheck->mallocFailed = 1; - }else{ - int contentOffset = get2byteNotZero(&data[hdr+5]); - assert( contentOffset<=usableSize ); /* Enforced by btreeInitPage() */ - memset(hit+contentOffset, 0, usableSize-contentOffset); - memset(hit, 1, contentOffset); - nCell = get2byte(&data[hdr+3]); - cellStart = hdr + 12 - 4*pPage->leaf; - for(i=0; i=usableSize ){ - checkAppendMsg(pCheck, 0, - "Corruption detected in cell %d on page %d",i,iPage); - }else{ - for(j=pc+size-1; j>=pc; j--) hit[j]++; - } - } - i = get2byte(&data[hdr+1]); - while( i>0 ){ - int size, j; - assert( i<=usableSize-4 ); /* Enforced by btreeInitPage() */ - size = get2byte(&data[i+2]); - assert( i+size<=usableSize ); /* Enforced by btreeInitPage() */ - for(j=i+size-1; j>=i; j--) hit[j]++; - j = get2byte(&data[i]); - assert( j==0 || j>i+size ); /* Enforced by btreeInitPage() */ - assert( j<=usableSize-4 ); /* Enforced by btreeInitPage() */ - i = j; - } - for(i=cnt=0; i1 ){ - checkAppendMsg(pCheck, 0, - "Multiple uses for byte %d of page %d", i, iPage); - break; - } - } - if( cnt!=data[hdr+7] ){ - checkAppendMsg(pCheck, 0, - "Fragmentation of %d bytes reported as %d on page %d", - cnt, data[hdr+7], iPage); - } - } - sqlite3PageFree(hit); - releasePage(pPage); - return depth+1; -} -#endif /* SQLITE_OMIT_INTEGRITY_CHECK */ - -#ifndef SQLITE_OMIT_INTEGRITY_CHECK -/* -** This routine does a complete check of the given BTree file. aRoot[] is -** an array of pages numbers were each page number is the root page of -** a table. nRoot is the number of entries in aRoot. -** -** A read-only or read-write transaction must be opened before calling -** this function. -** -** Write the number of error seen in *pnErr. Except for some memory -** allocation errors, an error message held in memory obtained from -** malloc is returned if *pnErr is non-zero. If *pnErr==0 then NULL is -** returned. If a memory allocation error occurs, NULL is returned. -*/ -SQLITE_PRIVATE char *sqlite3BtreeIntegrityCheck( - Btree *p, /* The btree to be checked */ - int *aRoot, /* An array of root pages numbers for individual trees */ - int nRoot, /* Number of entries in aRoot[] */ - int mxErr, /* Stop reporting errors after this many */ - int *pnErr /* Write number of errors seen to this variable */ -){ - Pgno i; - int nRef; - IntegrityCk sCheck; - BtShared *pBt = p->pBt; - char zErr[100]; - - sqlite3BtreeEnter(p); - assert( p->inTrans>TRANS_NONE && pBt->inTransaction>TRANS_NONE ); - nRef = sqlite3PagerRefcount(pBt->pPager); - sCheck.pBt = pBt; - sCheck.pPager = pBt->pPager; - sCheck.nPage = btreePagecount(sCheck.pBt); - sCheck.mxErr = mxErr; - sCheck.nErr = 0; - sCheck.mallocFailed = 0; - *pnErr = 0; - if( sCheck.nPage==0 ){ - sqlite3BtreeLeave(p); - return 0; - } - - sCheck.aPgRef = sqlite3MallocZero((sCheck.nPage / 8)+ 1); - if( !sCheck.aPgRef ){ - *pnErr = 1; - sqlite3BtreeLeave(p); - return 0; - } - i = PENDING_BYTE_PAGE(pBt); - if( i<=sCheck.nPage ) setPageReferenced(&sCheck, i); - sqlite3StrAccumInit(&sCheck.errMsg, zErr, sizeof(zErr), SQLITE_MAX_LENGTH); - sCheck.errMsg.useMalloc = 2; - - /* Check the integrity of the freelist - */ - checkList(&sCheck, 1, get4byte(&pBt->pPage1->aData[32]), - get4byte(&pBt->pPage1->aData[36]), "Main freelist: "); - - /* Check all the tables. - */ - for(i=0; (int)iautoVacuum && aRoot[i]>1 ){ - checkPtrmap(&sCheck, aRoot[i], PTRMAP_ROOTPAGE, 0, 0); - } -#endif - checkTreePage(&sCheck, aRoot[i], "List of tree roots: ", NULL, NULL); - } - - /* Make sure every page in the file is referenced - */ - for(i=1; i<=sCheck.nPage && sCheck.mxErr; i++){ -#ifdef SQLITE_OMIT_AUTOVACUUM - if( getPageReferenced(&sCheck, i)==0 ){ - checkAppendMsg(&sCheck, 0, "Page %d is never used", i); - } -#else - /* If the database supports auto-vacuum, make sure no tables contain - ** references to pointer-map pages. - */ - if( getPageReferenced(&sCheck, i)==0 && - (PTRMAP_PAGENO(pBt, i)!=i || !pBt->autoVacuum) ){ - checkAppendMsg(&sCheck, 0, "Page %d is never used", i); - } - if( getPageReferenced(&sCheck, i)!=0 && - (PTRMAP_PAGENO(pBt, i)==i && pBt->autoVacuum) ){ - checkAppendMsg(&sCheck, 0, "Pointer map page %d is referenced", i); - } -#endif - } - - /* Make sure this analysis did not leave any unref() pages. - ** This is an internal consistency check; an integrity check - ** of the integrity check. - */ - if( NEVER(nRef != sqlite3PagerRefcount(pBt->pPager)) ){ - checkAppendMsg(&sCheck, 0, - "Outstanding page count goes from %d to %d during this analysis", - nRef, sqlite3PagerRefcount(pBt->pPager) - ); - } - - /* Clean up and report errors. - */ - sqlite3BtreeLeave(p); - sqlite3_free(sCheck.aPgRef); - if( sCheck.mallocFailed ){ - sqlite3StrAccumReset(&sCheck.errMsg); - *pnErr = sCheck.nErr+1; - return 0; - } - *pnErr = sCheck.nErr; - if( sCheck.nErr==0 ) sqlite3StrAccumReset(&sCheck.errMsg); - return sqlite3StrAccumFinish(&sCheck.errMsg); -} -#endif /* SQLITE_OMIT_INTEGRITY_CHECK */ - -/* -** Return the full pathname of the underlying database file. Return -** an empty string if the database is in-memory or a TEMP database. -** -** The pager filename is invariant as long as the pager is -** open so it is safe to access without the BtShared mutex. -*/ -SQLITE_PRIVATE const char *sqlite3BtreeGetFilename(Btree *p){ - assert( p->pBt->pPager!=0 ); - return sqlite3PagerFilename(p->pBt->pPager, 1); -} - -/* -** Return the pathname of the journal file for this database. The return -** value of this routine is the same regardless of whether the journal file -** has been created or not. -** -** The pager journal filename is invariant as long as the pager is -** open so it is safe to access without the BtShared mutex. -*/ -SQLITE_PRIVATE const char *sqlite3BtreeGetJournalname(Btree *p){ - assert( p->pBt->pPager!=0 ); - return sqlite3PagerJournalname(p->pBt->pPager); -} - -/* -** Return non-zero if a transaction is active. -*/ -SQLITE_PRIVATE int sqlite3BtreeIsInTrans(Btree *p){ - assert( p==0 || sqlite3_mutex_held(p->db->mutex) ); - return (p && (p->inTrans==TRANS_WRITE)); -} - -#ifndef SQLITE_OMIT_WAL -/* -** Run a checkpoint on the Btree passed as the first argument. -** -** Return SQLITE_LOCKED if this or any other connection has an open -** transaction on the shared-cache the argument Btree is connected to. -** -** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. -*/ -SQLITE_PRIVATE int sqlite3BtreeCheckpoint(Btree *p, int eMode, int *pnLog, int *pnCkpt){ - int rc = SQLITE_OK; - if( p ){ - BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); - if( pBt->inTransaction!=TRANS_NONE ){ - rc = SQLITE_LOCKED; - }else{ - rc = sqlite3PagerCheckpoint(pBt->pPager, eMode, pnLog, pnCkpt); - } - sqlite3BtreeLeave(p); - } - return rc; -} -#endif - -/* -** Return non-zero if a read (or write) transaction is active. -*/ -SQLITE_PRIVATE int sqlite3BtreeIsInReadTrans(Btree *p){ - assert( p ); - assert( sqlite3_mutex_held(p->db->mutex) ); - return p->inTrans!=TRANS_NONE; -} - -SQLITE_PRIVATE int sqlite3BtreeIsInBackup(Btree *p){ - assert( p ); - assert( sqlite3_mutex_held(p->db->mutex) ); - return p->nBackup!=0; -} - -/* -** This function returns a pointer to a blob of memory associated with -** a single shared-btree. The memory is used by client code for its own -** purposes (for example, to store a high-level schema associated with -** the shared-btree). The btree layer manages reference counting issues. -** -** The first time this is called on a shared-btree, nBytes bytes of memory -** are allocated, zeroed, and returned to the caller. For each subsequent -** call the nBytes parameter is ignored and a pointer to the same blob -** of memory returned. -** -** If the nBytes parameter is 0 and the blob of memory has not yet been -** allocated, a null pointer is returned. If the blob has already been -** allocated, it is returned as normal. -** -** Just before the shared-btree is closed, the function passed as the -** xFree argument when the memory allocation was made is invoked on the -** blob of allocated memory. The xFree function should not call sqlite3_free() -** on the memory, the btree layer does that. -*/ -SQLITE_PRIVATE void *sqlite3BtreeSchema(Btree *p, int nBytes, void(*xFree)(void *)){ - BtShared *pBt = p->pBt; - sqlite3BtreeEnter(p); - if( !pBt->pSchema && nBytes ){ - pBt->pSchema = sqlite3DbMallocZero(0, nBytes); - pBt->xFreeSchema = xFree; - } - sqlite3BtreeLeave(p); - return pBt->pSchema; -} - -/* -** Return SQLITE_LOCKED_SHAREDCACHE if another user of the same shared -** btree as the argument handle holds an exclusive lock on the -** sqlite_master table. Otherwise SQLITE_OK. -*/ -SQLITE_PRIVATE int sqlite3BtreeSchemaLocked(Btree *p){ - int rc; - assert( sqlite3_mutex_held(p->db->mutex) ); - sqlite3BtreeEnter(p); - rc = querySharedCacheTableLock(p, MASTER_ROOT, READ_LOCK); - assert( rc==SQLITE_OK || rc==SQLITE_LOCKED_SHAREDCACHE ); - sqlite3BtreeLeave(p); - return rc; -} - - -#ifndef SQLITE_OMIT_SHARED_CACHE -/* -** Obtain a lock on the table whose root page is iTab. The -** lock is a write lock if isWritelock is true or a read lock -** if it is false. -*/ -SQLITE_PRIVATE int sqlite3BtreeLockTable(Btree *p, int iTab, u8 isWriteLock){ - int rc = SQLITE_OK; - assert( p->inTrans!=TRANS_NONE ); - if( p->sharable ){ - u8 lockType = READ_LOCK + isWriteLock; - assert( READ_LOCK+1==WRITE_LOCK ); - assert( isWriteLock==0 || isWriteLock==1 ); - - sqlite3BtreeEnter(p); - rc = querySharedCacheTableLock(p, iTab, lockType); - if( rc==SQLITE_OK ){ - rc = setSharedCacheTableLock(p, iTab, lockType); - } - sqlite3BtreeLeave(p); - } - return rc; -} -#endif - -#ifndef SQLITE_OMIT_INCRBLOB -/* -** Argument pCsr must be a cursor opened for writing on an -** INTKEY table currently pointing at a valid table entry. -** This function modifies the data stored as part of that entry. -** -** Only the data content may only be modified, it is not possible to -** change the length of the data stored. If this function is called with -** parameters that attempt to write past the end of the existing data, -** no modifications are made and SQLITE_CORRUPT is returned. -*/ -SQLITE_PRIVATE int sqlite3BtreePutData(BtCursor *pCsr, u32 offset, u32 amt, void *z){ - int rc; - assert( cursorHoldsMutex(pCsr) ); - assert( sqlite3_mutex_held(pCsr->pBtree->db->mutex) ); - assert( pCsr->isIncrblobHandle ); - - rc = restoreCursorPosition(pCsr); - if( rc!=SQLITE_OK ){ - return rc; - } - assert( pCsr->eState!=CURSOR_REQUIRESEEK ); - if( pCsr->eState!=CURSOR_VALID ){ - return SQLITE_ABORT; - } - - /* Save the positions of all other cursors open on this table. This is - ** required in case any of them are holding references to an xFetch - ** version of the b-tree page modified by the accessPayload call below. - ** - ** Note that pCsr must be open on a BTREE_INTKEY table and saveCursorPosition() - ** and hence saveAllCursors() cannot fail on a BTREE_INTKEY table, hence - ** saveAllCursors can only return SQLITE_OK. - */ - VVA_ONLY(rc =) saveAllCursors(pCsr->pBt, pCsr->pgnoRoot, pCsr); - assert( rc==SQLITE_OK ); - - /* Check some assumptions: - ** (a) the cursor is open for writing, - ** (b) there is a read/write transaction open, - ** (c) the connection holds a write-lock on the table (if required), - ** (d) there are no conflicting read-locks, and - ** (e) the cursor points at a valid row of an intKey table. - */ - if( !pCsr->wrFlag ){ - return SQLITE_READONLY; - } - assert( (pCsr->pBt->btsFlags & BTS_READ_ONLY)==0 - && pCsr->pBt->inTransaction==TRANS_WRITE ); - assert( hasSharedCacheTableLock(pCsr->pBtree, pCsr->pgnoRoot, 0, 2) ); - assert( !hasReadConflicts(pCsr->pBtree, pCsr->pgnoRoot) ); - assert( pCsr->apPage[pCsr->iPage]->intKey ); - - return accessPayload(pCsr, offset, amt, (unsigned char *)z, 1); -} - -/* -** Set a flag on this cursor to cache the locations of pages from the -** overflow list for the current row. This is used by cursors opened -** for incremental blob IO only. -** -** This function sets a flag only. The actual page location cache -** (stored in BtCursor.aOverflow[]) is allocated and used by function -** accessPayload() (the worker function for sqlite3BtreeData() and -** sqlite3BtreePutData()). -*/ -SQLITE_PRIVATE void sqlite3BtreeCacheOverflow(BtCursor *pCur){ - assert( cursorHoldsMutex(pCur) ); - assert( sqlite3_mutex_held(pCur->pBtree->db->mutex) ); - invalidateOverflowCache(pCur); - pCur->isIncrblobHandle = 1; -} -#endif - -/* -** Set both the "read version" (single byte at byte offset 18) and -** "write version" (single byte at byte offset 19) fields in the database -** header to iVersion. -*/ -SQLITE_PRIVATE int sqlite3BtreeSetVersion(Btree *pBtree, int iVersion){ - BtShared *pBt = pBtree->pBt; - int rc; /* Return code */ - - assert( iVersion==1 || iVersion==2 ); - - /* If setting the version fields to 1, do not automatically open the - ** WAL connection, even if the version fields are currently set to 2. - */ - pBt->btsFlags &= ~BTS_NO_WAL; - if( iVersion==1 ) pBt->btsFlags |= BTS_NO_WAL; - - rc = sqlite3BtreeBeginTrans(pBtree, 0); - if( rc==SQLITE_OK ){ - u8 *aData = pBt->pPage1->aData; - if( aData[18]!=(u8)iVersion || aData[19]!=(u8)iVersion ){ - rc = sqlite3BtreeBeginTrans(pBtree, 2); - if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pBt->pPage1->pDbPage); - if( rc==SQLITE_OK ){ - aData[18] = (u8)iVersion; - aData[19] = (u8)iVersion; - } - } - } - } - - pBt->btsFlags &= ~BTS_NO_WAL; - return rc; -} - -/* -** set the mask of hint flags for cursor pCsr. Currently the only valid -** values are 0 and BTREE_BULKLOAD. -*/ -SQLITE_PRIVATE void sqlite3BtreeCursorHints(BtCursor *pCsr, unsigned int mask){ - assert( mask==BTREE_BULKLOAD || mask==0 ); - pCsr->hints = mask; -} - -/************** End of btree.c ***********************************************/ -/************** Begin file backup.c ******************************************/ -/* -** 2009 January 28 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the implementation of the sqlite3_backup_XXX() -** API functions and the related features. -*/ - -/* -** Structure allocated for each backup operation. -*/ -struct sqlite3_backup { - sqlite3* pDestDb; /* Destination database handle */ - Btree *pDest; /* Destination b-tree file */ - u32 iDestSchema; /* Original schema cookie in destination */ - int bDestLocked; /* True once a write-transaction is open on pDest */ - - Pgno iNext; /* Page number of the next source page to copy */ - sqlite3* pSrcDb; /* Source database handle */ - Btree *pSrc; /* Source b-tree file */ - - int rc; /* Backup process error code */ - - /* These two variables are set by every call to backup_step(). They are - ** read by calls to backup_remaining() and backup_pagecount(). - */ - Pgno nRemaining; /* Number of pages left to copy */ - Pgno nPagecount; /* Total number of pages to copy */ - - int isAttached; /* True once backup has been registered with pager */ - sqlite3_backup *pNext; /* Next backup associated with source pager */ -}; - -/* -** THREAD SAFETY NOTES: -** -** Once it has been created using backup_init(), a single sqlite3_backup -** structure may be accessed via two groups of thread-safe entry points: -** -** * Via the sqlite3_backup_XXX() API function backup_step() and -** backup_finish(). Both these functions obtain the source database -** handle mutex and the mutex associated with the source BtShared -** structure, in that order. -** -** * Via the BackupUpdate() and BackupRestart() functions, which are -** invoked by the pager layer to report various state changes in -** the page cache associated with the source database. The mutex -** associated with the source database BtShared structure will always -** be held when either of these functions are invoked. -** -** The other sqlite3_backup_XXX() API functions, backup_remaining() and -** backup_pagecount() are not thread-safe functions. If they are called -** while some other thread is calling backup_step() or backup_finish(), -** the values returned may be invalid. There is no way for a call to -** BackupUpdate() or BackupRestart() to interfere with backup_remaining() -** or backup_pagecount(). -** -** Depending on the SQLite configuration, the database handles and/or -** the Btree objects may have their own mutexes that require locking. -** Non-sharable Btrees (in-memory databases for example), do not have -** associated mutexes. -*/ - -/* -** Return a pointer corresponding to database zDb (i.e. "main", "temp") -** in connection handle pDb. If such a database cannot be found, return -** a NULL pointer and write an error message to pErrorDb. -** -** If the "temp" database is requested, it may need to be opened by this -** function. If an error occurs while doing so, return 0 and write an -** error message to pErrorDb. -*/ -static Btree *findBtree(sqlite3 *pErrorDb, sqlite3 *pDb, const char *zDb){ - int i = sqlite3FindDbName(pDb, zDb); - - if( i==1 ){ - Parse *pParse; - int rc = 0; - pParse = sqlite3StackAllocZero(pErrorDb, sizeof(*pParse)); - if( pParse==0 ){ - sqlite3Error(pErrorDb, SQLITE_NOMEM, "out of memory"); - rc = SQLITE_NOMEM; - }else{ - pParse->db = pDb; - if( sqlite3OpenTempDatabase(pParse) ){ - sqlite3Error(pErrorDb, pParse->rc, "%s", pParse->zErrMsg); - rc = SQLITE_ERROR; - } - sqlite3DbFree(pErrorDb, pParse->zErrMsg); - sqlite3ParserReset(pParse); - sqlite3StackFree(pErrorDb, pParse); - } - if( rc ){ - return 0; - } - } - - if( i<0 ){ - sqlite3Error(pErrorDb, SQLITE_ERROR, "unknown database %s", zDb); - return 0; - } - - return pDb->aDb[i].pBt; -} - -/* -** Attempt to set the page size of the destination to match the page size -** of the source. -*/ -static int setDestPgsz(sqlite3_backup *p){ - int rc; - rc = sqlite3BtreeSetPageSize(p->pDest,sqlite3BtreeGetPageSize(p->pSrc),-1,0); - return rc; -} - -/* -** Create an sqlite3_backup process to copy the contents of zSrcDb from -** connection handle pSrcDb to zDestDb in pDestDb. If successful, return -** a pointer to the new sqlite3_backup object. -** -** If an error occurs, NULL is returned and an error code and error message -** stored in database handle pDestDb. -*/ -SQLITE_API sqlite3_backup *sqlite3_backup_init( - sqlite3* pDestDb, /* Database to write to */ - const char *zDestDb, /* Name of database within pDestDb */ - sqlite3* pSrcDb, /* Database connection to read from */ - const char *zSrcDb /* Name of database within pSrcDb */ -){ - sqlite3_backup *p; /* Value to return */ - - /* Lock the source database handle. The destination database - ** handle is not locked in this routine, but it is locked in - ** sqlite3_backup_step(). The user is required to ensure that no - ** other thread accesses the destination handle for the duration - ** of the backup operation. Any attempt to use the destination - ** database connection while a backup is in progress may cause - ** a malfunction or a deadlock. - */ - sqlite3_mutex_enter(pSrcDb->mutex); - sqlite3_mutex_enter(pDestDb->mutex); - - if( pSrcDb==pDestDb ){ - sqlite3Error( - pDestDb, SQLITE_ERROR, "source and destination must be distinct" - ); - p = 0; - }else { - /* Allocate space for a new sqlite3_backup object... - ** EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a - ** call to sqlite3_backup_init() and is destroyed by a call to - ** sqlite3_backup_finish(). */ - p = (sqlite3_backup *)sqlite3MallocZero(sizeof(sqlite3_backup)); - if( !p ){ - sqlite3Error(pDestDb, SQLITE_NOMEM, 0); - } - } - - /* If the allocation succeeded, populate the new object. */ - if( p ){ - p->pSrc = findBtree(pDestDb, pSrcDb, zSrcDb); - p->pDest = findBtree(pDestDb, pDestDb, zDestDb); - p->pDestDb = pDestDb; - p->pSrcDb = pSrcDb; - p->iNext = 1; - p->isAttached = 0; - - if( 0==p->pSrc || 0==p->pDest || setDestPgsz(p)==SQLITE_NOMEM ){ - /* One (or both) of the named databases did not exist or an OOM - ** error was hit. The error has already been written into the - ** pDestDb handle. All that is left to do here is free the - ** sqlite3_backup structure. - */ - sqlite3_free(p); - p = 0; - } - } - if( p ){ - p->pSrc->nBackup++; - } - - sqlite3_mutex_leave(pDestDb->mutex); - sqlite3_mutex_leave(pSrcDb->mutex); - return p; -} - -/* -** Argument rc is an SQLite error code. Return true if this error is -** considered fatal if encountered during a backup operation. All errors -** are considered fatal except for SQLITE_BUSY and SQLITE_LOCKED. -*/ -static int isFatalError(int rc){ - return (rc!=SQLITE_OK && rc!=SQLITE_BUSY && ALWAYS(rc!=SQLITE_LOCKED)); -} - -/* -** Parameter zSrcData points to a buffer containing the data for -** page iSrcPg from the source database. Copy this data into the -** destination database. -*/ -static int backupOnePage( - sqlite3_backup *p, /* Backup handle */ - Pgno iSrcPg, /* Source database page to backup */ - const u8 *zSrcData, /* Source database page data */ - int bUpdate /* True for an update, false otherwise */ -){ - Pager * const pDestPager = sqlite3BtreePager(p->pDest); - const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc); - int nDestPgsz = sqlite3BtreeGetPageSize(p->pDest); - const int nCopy = MIN(nSrcPgsz, nDestPgsz); - const i64 iEnd = (i64)iSrcPg*(i64)nSrcPgsz; -#ifdef SQLITE_HAS_CODEC - /* Use BtreeGetReserveNoMutex() for the source b-tree, as although it is - ** guaranteed that the shared-mutex is held by this thread, handle - ** p->pSrc may not actually be the owner. */ - int nSrcReserve = sqlite3BtreeGetReserveNoMutex(p->pSrc); - int nDestReserve = sqlite3BtreeGetReserve(p->pDest); -#endif - int rc = SQLITE_OK; - i64 iOff; - - assert( sqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 ); - assert( p->bDestLocked ); - assert( !isFatalError(p->rc) ); - assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ); - assert( zSrcData ); - - /* Catch the case where the destination is an in-memory database and the - ** page sizes of the source and destination differ. - */ - if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){ - rc = SQLITE_READONLY; - } - -#ifdef SQLITE_HAS_CODEC - /* Backup is not possible if the page size of the destination is changing - ** and a codec is in use. - */ - if( nSrcPgsz!=nDestPgsz && sqlite3PagerGetCodec(pDestPager)!=0 ){ - rc = SQLITE_READONLY; - } - - /* Backup is not possible if the number of bytes of reserve space differ - ** between source and destination. If there is a difference, try to - ** fix the destination to agree with the source. If that is not possible, - ** then the backup cannot proceed. - */ - if( nSrcReserve!=nDestReserve ){ - u32 newPgsz = nSrcPgsz; - rc = sqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve); - if( rc==SQLITE_OK && newPgsz!=nSrcPgsz ) rc = SQLITE_READONLY; - } -#endif - - /* This loop runs once for each destination page spanned by the source - ** page. For each iteration, variable iOff is set to the byte offset - ** of the destination page. - */ - for(iOff=iEnd-(i64)nSrcPgsz; rc==SQLITE_OK && iOffpDest->pBt) ) continue; - if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg)) - && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg)) - ){ - const u8 *zIn = &zSrcData[iOff%nSrcPgsz]; - u8 *zDestData = sqlite3PagerGetData(pDestPg); - u8 *zOut = &zDestData[iOff%nDestPgsz]; - - /* Copy the data from the source page into the destination page. - ** Then clear the Btree layer MemPage.isInit flag. Both this module - ** and the pager code use this trick (clearing the first byte - ** of the page 'extra' space to invalidate the Btree layers - ** cached parse of the page). MemPage.isInit is marked - ** "MUST BE FIRST" for this purpose. - */ - memcpy(zOut, zIn, nCopy); - ((u8 *)sqlite3PagerGetExtra(pDestPg))[0] = 0; - if( iOff==0 && bUpdate==0 ){ - sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc)); - } - } - sqlite3PagerUnref(pDestPg); - } - - return rc; -} - -/* -** If pFile is currently larger than iSize bytes, then truncate it to -** exactly iSize bytes. If pFile is not larger than iSize bytes, then -** this function is a no-op. -** -** Return SQLITE_OK if everything is successful, or an SQLite error -** code if an error occurs. -*/ -static int backupTruncateFile(sqlite3_file *pFile, i64 iSize){ - i64 iCurrent; - int rc = sqlite3OsFileSize(pFile, &iCurrent); - if( rc==SQLITE_OK && iCurrent>iSize ){ - rc = sqlite3OsTruncate(pFile, iSize); - } - return rc; -} - -/* -** Register this backup object with the associated source pager for -** callbacks when pages are changed or the cache invalidated. -*/ -static void attachBackupObject(sqlite3_backup *p){ - sqlite3_backup **pp; - assert( sqlite3BtreeHoldsMutex(p->pSrc) ); - pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); - p->pNext = *pp; - *pp = p; - p->isAttached = 1; -} - -/* -** Copy nPage pages from the source b-tree to the destination. -*/ -SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage){ - int rc; - int destMode; /* Destination journal mode */ - int pgszSrc = 0; /* Source page size */ - int pgszDest = 0; /* Destination page size */ - - sqlite3_mutex_enter(p->pSrcDb->mutex); - sqlite3BtreeEnter(p->pSrc); - if( p->pDestDb ){ - sqlite3_mutex_enter(p->pDestDb->mutex); - } - - rc = p->rc; - if( !isFatalError(rc) ){ - Pager * const pSrcPager = sqlite3BtreePager(p->pSrc); /* Source pager */ - Pager * const pDestPager = sqlite3BtreePager(p->pDest); /* Dest pager */ - int ii; /* Iterator variable */ - int nSrcPage = -1; /* Size of source db in pages */ - int bCloseTrans = 0; /* True if src db requires unlocking */ - - /* If the source pager is currently in a write-transaction, return - ** SQLITE_BUSY immediately. - */ - if( p->pDestDb && p->pSrc->pBt->inTransaction==TRANS_WRITE ){ - rc = SQLITE_BUSY; - }else{ - rc = SQLITE_OK; - } - - /* Lock the destination database, if it is not locked already. */ - if( SQLITE_OK==rc && p->bDestLocked==0 - && SQLITE_OK==(rc = sqlite3BtreeBeginTrans(p->pDest, 2)) - ){ - p->bDestLocked = 1; - sqlite3BtreeGetMeta(p->pDest, BTREE_SCHEMA_VERSION, &p->iDestSchema); - } - - /* If there is no open read-transaction on the source database, open - ** one now. If a transaction is opened here, then it will be closed - ** before this function exits. - */ - if( rc==SQLITE_OK && 0==sqlite3BtreeIsInReadTrans(p->pSrc) ){ - rc = sqlite3BtreeBeginTrans(p->pSrc, 0); - bCloseTrans = 1; - } - - /* Do not allow backup if the destination database is in WAL mode - ** and the page sizes are different between source and destination */ - pgszSrc = sqlite3BtreeGetPageSize(p->pSrc); - pgszDest = sqlite3BtreeGetPageSize(p->pDest); - destMode = sqlite3PagerGetJournalMode(sqlite3BtreePager(p->pDest)); - if( SQLITE_OK==rc && destMode==PAGER_JOURNALMODE_WAL && pgszSrc!=pgszDest ){ - rc = SQLITE_READONLY; - } - - /* Now that there is a read-lock on the source database, query the - ** source pager for the number of pages in the database. - */ - nSrcPage = (int)sqlite3BtreeLastPage(p->pSrc); - assert( nSrcPage>=0 ); - for(ii=0; (nPage<0 || iiiNext<=(Pgno)nSrcPage && !rc; ii++){ - const Pgno iSrcPg = p->iNext; /* Source page number */ - if( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ){ - DbPage *pSrcPg; /* Source page object */ - rc = sqlite3PagerAcquire(pSrcPager, iSrcPg, &pSrcPg, - PAGER_GET_READONLY); - if( rc==SQLITE_OK ){ - rc = backupOnePage(p, iSrcPg, sqlite3PagerGetData(pSrcPg), 0); - sqlite3PagerUnref(pSrcPg); - } - } - p->iNext++; - } - if( rc==SQLITE_OK ){ - p->nPagecount = nSrcPage; - p->nRemaining = nSrcPage+1-p->iNext; - if( p->iNext>(Pgno)nSrcPage ){ - rc = SQLITE_DONE; - }else if( !p->isAttached ){ - attachBackupObject(p); - } - } - - /* Update the schema version field in the destination database. This - ** is to make sure that the schema-version really does change in - ** the case where the source and destination databases have the - ** same schema version. - */ - if( rc==SQLITE_DONE ){ - if( nSrcPage==0 ){ - rc = sqlite3BtreeNewDb(p->pDest); - nSrcPage = 1; - } - if( rc==SQLITE_OK || rc==SQLITE_DONE ){ - rc = sqlite3BtreeUpdateMeta(p->pDest,1,p->iDestSchema+1); - } - if( rc==SQLITE_OK ){ - if( p->pDestDb ){ - sqlite3ResetAllSchemasOfConnection(p->pDestDb); - } - if( destMode==PAGER_JOURNALMODE_WAL ){ - rc = sqlite3BtreeSetVersion(p->pDest, 2); - } - } - if( rc==SQLITE_OK ){ - int nDestTruncate; - /* Set nDestTruncate to the final number of pages in the destination - ** database. The complication here is that the destination page - ** size may be different to the source page size. - ** - ** If the source page size is smaller than the destination page size, - ** round up. In this case the call to sqlite3OsTruncate() below will - ** fix the size of the file. However it is important to call - ** sqlite3PagerTruncateImage() here so that any pages in the - ** destination file that lie beyond the nDestTruncate page mark are - ** journalled by PagerCommitPhaseOne() before they are destroyed - ** by the file truncation. - */ - assert( pgszSrc==sqlite3BtreeGetPageSize(p->pSrc) ); - assert( pgszDest==sqlite3BtreeGetPageSize(p->pDest) ); - if( pgszSrcpDest->pBt) ){ - nDestTruncate--; - } - }else{ - nDestTruncate = nSrcPage * (pgszSrc/pgszDest); - } - assert( nDestTruncate>0 ); - - if( pgszSrc= iSize || ( - nDestTruncate==(int)(PENDING_BYTE_PAGE(p->pDest->pBt)-1) - && iSize>=PENDING_BYTE && iSize<=PENDING_BYTE+pgszDest - )); - - /* This block ensures that all data required to recreate the original - ** database has been stored in the journal for pDestPager and the - ** journal synced to disk. So at this point we may safely modify - ** the database file in any way, knowing that if a power failure - ** occurs, the original database will be reconstructed from the - ** journal file. */ - sqlite3PagerPagecount(pDestPager, &nDstPage); - for(iPg=nDestTruncate; rc==SQLITE_OK && iPg<=(Pgno)nDstPage; iPg++){ - if( iPg!=PENDING_BYTE_PAGE(p->pDest->pBt) ){ - DbPage *pPg; - rc = sqlite3PagerGet(pDestPager, iPg, &pPg); - if( rc==SQLITE_OK ){ - rc = sqlite3PagerWrite(pPg); - sqlite3PagerUnref(pPg); - } - } - } - if( rc==SQLITE_OK ){ - rc = sqlite3PagerCommitPhaseOne(pDestPager, 0, 1); - } - - /* Write the extra pages and truncate the database file as required */ - iEnd = MIN(PENDING_BYTE + pgszDest, iSize); - for( - iOff=PENDING_BYTE+pgszSrc; - rc==SQLITE_OK && iOffpDest, 0)) - ){ - rc = SQLITE_DONE; - } - } - } - - /* If bCloseTrans is true, then this function opened a read transaction - ** on the source database. Close the read transaction here. There is - ** no need to check the return values of the btree methods here, as - ** "committing" a read-only transaction cannot fail. - */ - if( bCloseTrans ){ - TESTONLY( int rc2 ); - TESTONLY( rc2 = ) sqlite3BtreeCommitPhaseOne(p->pSrc, 0); - TESTONLY( rc2 |= ) sqlite3BtreeCommitPhaseTwo(p->pSrc, 0); - assert( rc2==SQLITE_OK ); - } - - if( rc==SQLITE_IOERR_NOMEM ){ - rc = SQLITE_NOMEM; - } - p->rc = rc; - } - if( p->pDestDb ){ - sqlite3_mutex_leave(p->pDestDb->mutex); - } - sqlite3BtreeLeave(p->pSrc); - sqlite3_mutex_leave(p->pSrcDb->mutex); - return rc; -} - -/* -** Release all resources associated with an sqlite3_backup* handle. -*/ -SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p){ - sqlite3_backup **pp; /* Ptr to head of pagers backup list */ - sqlite3 *pSrcDb; /* Source database connection */ - int rc; /* Value to return */ - - /* Enter the mutexes */ - if( p==0 ) return SQLITE_OK; - pSrcDb = p->pSrcDb; - sqlite3_mutex_enter(pSrcDb->mutex); - sqlite3BtreeEnter(p->pSrc); - if( p->pDestDb ){ - sqlite3_mutex_enter(p->pDestDb->mutex); - } - - /* Detach this backup from the source pager. */ - if( p->pDestDb ){ - p->pSrc->nBackup--; - } - if( p->isAttached ){ - pp = sqlite3PagerBackupPtr(sqlite3BtreePager(p->pSrc)); - while( *pp!=p ){ - pp = &(*pp)->pNext; - } - *pp = p->pNext; - } - - /* If a transaction is still open on the Btree, roll it back. */ - sqlite3BtreeRollback(p->pDest, SQLITE_OK); - - /* Set the error code of the destination database handle. */ - rc = (p->rc==SQLITE_DONE) ? SQLITE_OK : p->rc; - if( p->pDestDb ){ - sqlite3Error(p->pDestDb, rc, 0); - - /* Exit the mutexes and free the backup context structure. */ - sqlite3LeaveMutexAndCloseZombie(p->pDestDb); - } - sqlite3BtreeLeave(p->pSrc); - if( p->pDestDb ){ - /* EVIDENCE-OF: R-64852-21591 The sqlite3_backup object is created by a - ** call to sqlite3_backup_init() and is destroyed by a call to - ** sqlite3_backup_finish(). */ - sqlite3_free(p); - } - sqlite3LeaveMutexAndCloseZombie(pSrcDb); - return rc; -} - -/* -** Return the number of pages still to be backed up as of the most recent -** call to sqlite3_backup_step(). -*/ -SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p){ - return p->nRemaining; -} - -/* -** Return the total number of pages in the source database as of the most -** recent call to sqlite3_backup_step(). -*/ -SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p){ - return p->nPagecount; -} - -/* -** This function is called after the contents of page iPage of the -** source database have been modified. If page iPage has already been -** copied into the destination database, then the data written to the -** destination is now invalidated. The destination copy of iPage needs -** to be updated with the new data before the backup operation is -** complete. -** -** It is assumed that the mutex associated with the BtShared object -** corresponding to the source database is held when this function is -** called. -*/ -SQLITE_PRIVATE void sqlite3BackupUpdate(sqlite3_backup *pBackup, Pgno iPage, const u8 *aData){ - sqlite3_backup *p; /* Iterator variable */ - for(p=pBackup; p; p=p->pNext){ - assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) ); - if( !isFatalError(p->rc) && iPageiNext ){ - /* The backup process p has already copied page iPage. But now it - ** has been modified by a transaction on the source pager. Copy - ** the new data into the backup. - */ - int rc; - assert( p->pDestDb ); - sqlite3_mutex_enter(p->pDestDb->mutex); - rc = backupOnePage(p, iPage, aData, 1); - sqlite3_mutex_leave(p->pDestDb->mutex); - assert( rc!=SQLITE_BUSY && rc!=SQLITE_LOCKED ); - if( rc!=SQLITE_OK ){ - p->rc = rc; - } - } - } -} - -/* -** Restart the backup process. This is called when the pager layer -** detects that the database has been modified by an external database -** connection. In this case there is no way of knowing which of the -** pages that have been copied into the destination database are still -** valid and which are not, so the entire process needs to be restarted. -** -** It is assumed that the mutex associated with the BtShared object -** corresponding to the source database is held when this function is -** called. -*/ -SQLITE_PRIVATE void sqlite3BackupRestart(sqlite3_backup *pBackup){ - sqlite3_backup *p; /* Iterator variable */ - for(p=pBackup; p; p=p->pNext){ - assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) ); - p->iNext = 1; - } -} - -#ifndef SQLITE_OMIT_VACUUM -/* -** Copy the complete content of pBtFrom into pBtTo. A transaction -** must be active for both files. -** -** The size of file pTo may be reduced by this operation. If anything -** goes wrong, the transaction on pTo is rolled back. If successful, the -** transaction is committed before returning. -*/ -SQLITE_PRIVATE int sqlite3BtreeCopyFile(Btree *pTo, Btree *pFrom){ - int rc; - sqlite3_file *pFd; /* File descriptor for database pTo */ - sqlite3_backup b; - sqlite3BtreeEnter(pTo); - sqlite3BtreeEnter(pFrom); - - assert( sqlite3BtreeIsInTrans(pTo) ); - pFd = sqlite3PagerFile(sqlite3BtreePager(pTo)); - if( pFd->pMethods ){ - i64 nByte = sqlite3BtreeGetPageSize(pFrom)*(i64)sqlite3BtreeLastPage(pFrom); - rc = sqlite3OsFileControl(pFd, SQLITE_FCNTL_OVERWRITE, &nByte); - if( rc==SQLITE_NOTFOUND ) rc = SQLITE_OK; - if( rc ) goto copy_finished; - } - - /* Set up an sqlite3_backup object. sqlite3_backup.pDestDb must be set - ** to 0. This is used by the implementations of sqlite3_backup_step() - ** and sqlite3_backup_finish() to detect that they are being called - ** from this function, not directly by the user. - */ - memset(&b, 0, sizeof(b)); - b.pSrcDb = pFrom->db; - b.pSrc = pFrom; - b.pDest = pTo; - b.iNext = 1; - - /* 0x7FFFFFFF is the hard limit for the number of pages in a database - ** file. By passing this as the number of pages to copy to - ** sqlite3_backup_step(), we can guarantee that the copy finishes - ** within a single call (unless an error occurs). The assert() statement - ** checks this assumption - (p->rc) should be set to either SQLITE_DONE - ** or an error code. - */ - sqlite3_backup_step(&b, 0x7FFFFFFF); - assert( b.rc!=SQLITE_OK ); - rc = sqlite3_backup_finish(&b); - if( rc==SQLITE_OK ){ - pTo->pBt->btsFlags &= ~BTS_PAGESIZE_FIXED; - }else{ - sqlite3PagerClearCache(sqlite3BtreePager(b.pDest)); - } - - assert( sqlite3BtreeIsInTrans(pTo)==0 ); -copy_finished: - sqlite3BtreeLeave(pFrom); - sqlite3BtreeLeave(pTo); - return rc; -} -#endif /* SQLITE_OMIT_VACUUM */ - -/************** End of backup.c **********************************************/ -/************** Begin file vdbemem.c *****************************************/ -/* -** 2004 May 26 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains code use to manipulate "Mem" structure. A "Mem" -** stores a single value in the VDBE. Mem is an opaque structure visible -** only within the VDBE. Interface routines refer to a Mem using the -** name sqlite_value -*/ - -/* -** If pMem is an object with a valid string representation, this routine -** ensures the internal encoding for the string representation is -** 'desiredEnc', one of SQLITE_UTF8, SQLITE_UTF16LE or SQLITE_UTF16BE. -** -** If pMem is not a string object, or the encoding of the string -** representation is already stored using the requested encoding, then this -** routine is a no-op. -** -** SQLITE_OK is returned if the conversion is successful (or not required). -** SQLITE_NOMEM may be returned if a malloc() fails during conversion -** between formats. -*/ -SQLITE_PRIVATE int sqlite3VdbeChangeEncoding(Mem *pMem, int desiredEnc){ -#ifndef SQLITE_OMIT_UTF16 - int rc; -#endif - assert( (pMem->flags&MEM_RowSet)==0 ); - assert( desiredEnc==SQLITE_UTF8 || desiredEnc==SQLITE_UTF16LE - || desiredEnc==SQLITE_UTF16BE ); - if( !(pMem->flags&MEM_Str) || pMem->enc==desiredEnc ){ - return SQLITE_OK; - } - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); -#ifdef SQLITE_OMIT_UTF16 - return SQLITE_ERROR; -#else - - /* MemTranslate() may return SQLITE_OK or SQLITE_NOMEM. If NOMEM is returned, - ** then the encoding of the value may not have changed. - */ - rc = sqlite3VdbeMemTranslate(pMem, (u8)desiredEnc); - assert(rc==SQLITE_OK || rc==SQLITE_NOMEM); - assert(rc==SQLITE_OK || pMem->enc!=desiredEnc); - assert(rc==SQLITE_NOMEM || pMem->enc==desiredEnc); - return rc; -#endif -} - -/* -** Make sure pMem->z points to a writable allocation of at least -** min(n,32) bytes. -** -** If the bPreserve argument is true, then copy of the content of -** pMem->z into the new allocation. pMem must be either a string or -** blob if bPreserve is true. If bPreserve is false, any prior content -** in pMem->z is discarded. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemGrow(Mem *pMem, int n, int bPreserve){ - assert( 1 >= - ((pMem->zMalloc && pMem->zMalloc==pMem->z) ? 1 : 0) + - (((pMem->flags&MEM_Dyn)&&pMem->xDel) ? 1 : 0) + - ((pMem->flags&MEM_Ephem) ? 1 : 0) + - ((pMem->flags&MEM_Static) ? 1 : 0) - ); - assert( (pMem->flags&MEM_RowSet)==0 ); - - /* If the bPreserve flag is set to true, then the memory cell must already - ** contain a valid string or blob value. */ - assert( bPreserve==0 || pMem->flags&(MEM_Blob|MEM_Str) ); - testcase( bPreserve && pMem->z==0 ); - - if( pMem->zMalloc==0 || sqlite3DbMallocSize(pMem->db, pMem->zMalloc)z==pMem->zMalloc ){ - pMem->z = pMem->zMalloc = sqlite3DbReallocOrFree(pMem->db, pMem->z, n); - bPreserve = 0; - }else{ - sqlite3DbFree(pMem->db, pMem->zMalloc); - pMem->zMalloc = sqlite3DbMallocRaw(pMem->db, n); - } - if( pMem->zMalloc==0 ){ - sqlite3VdbeMemRelease(pMem); - pMem->flags = MEM_Null; - return SQLITE_NOMEM; - } - } - - if( pMem->z && bPreserve && pMem->z!=pMem->zMalloc ){ - memcpy(pMem->zMalloc, pMem->z, pMem->n); - } - if( (pMem->flags&MEM_Dyn)!=0 && pMem->xDel ){ - assert( pMem->xDel!=SQLITE_DYNAMIC ); - pMem->xDel((void *)(pMem->z)); - } - - pMem->z = pMem->zMalloc; - pMem->flags &= ~(MEM_Ephem|MEM_Static); - pMem->xDel = 0; - return SQLITE_OK; -} - -/* -** Make the given Mem object MEM_Dyn. In other words, make it so -** that any TEXT or BLOB content is stored in memory obtained from -** malloc(). In this way, we know that the memory is safe to be -** overwritten or altered. -** -** Return SQLITE_OK on success or SQLITE_NOMEM if malloc fails. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemMakeWriteable(Mem *pMem){ - int f; - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( (pMem->flags&MEM_RowSet)==0 ); - ExpandBlob(pMem); - f = pMem->flags; - if( (f&(MEM_Str|MEM_Blob)) && pMem->z!=pMem->zMalloc ){ - if( sqlite3VdbeMemGrow(pMem, pMem->n + 2, 1) ){ - return SQLITE_NOMEM; - } - pMem->z[pMem->n] = 0; - pMem->z[pMem->n+1] = 0; - pMem->flags |= MEM_Term; -#ifdef SQLITE_DEBUG - pMem->pScopyFrom = 0; -#endif - } - - return SQLITE_OK; -} - -/* -** If the given Mem* has a zero-filled tail, turn it into an ordinary -** blob stored in dynamically allocated space. -*/ -#ifndef SQLITE_OMIT_INCRBLOB -SQLITE_PRIVATE int sqlite3VdbeMemExpandBlob(Mem *pMem){ - if( pMem->flags & MEM_Zero ){ - int nByte; - assert( pMem->flags&MEM_Blob ); - assert( (pMem->flags&MEM_RowSet)==0 ); - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - - /* Set nByte to the number of bytes required to store the expanded blob. */ - nByte = pMem->n + pMem->u.nZero; - if( nByte<=0 ){ - nByte = 1; - } - if( sqlite3VdbeMemGrow(pMem, nByte, 1) ){ - return SQLITE_NOMEM; - } - - memset(&pMem->z[pMem->n], 0, pMem->u.nZero); - pMem->n += pMem->u.nZero; - pMem->flags &= ~(MEM_Zero|MEM_Term); - } - return SQLITE_OK; -} -#endif - - -/* -** Make sure the given Mem is \u0000 terminated. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemNulTerminate(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - if( (pMem->flags & MEM_Term)!=0 || (pMem->flags & MEM_Str)==0 ){ - return SQLITE_OK; /* Nothing to do */ - } - if( sqlite3VdbeMemGrow(pMem, pMem->n+2, 1) ){ - return SQLITE_NOMEM; - } - pMem->z[pMem->n] = 0; - pMem->z[pMem->n+1] = 0; - pMem->flags |= MEM_Term; - return SQLITE_OK; -} - -/* -** Add MEM_Str to the set of representations for the given Mem. Numbers -** are converted using sqlite3_snprintf(). Converting a BLOB to a string -** is a no-op. -** -** Existing representations MEM_Int and MEM_Real are *not* invalidated. -** -** A MEM_Null value will never be passed to this function. This function is -** used for converting values to text for returning to the user (i.e. via -** sqlite3_value_text()), or for ensuring that values to be used as btree -** keys are strings. In the former case a NULL pointer is returned the -** user and the later is an internal programming error. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemStringify(Mem *pMem, int enc){ - int rc = SQLITE_OK; - int fg = pMem->flags; - const int nByte = 32; - - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( !(fg&MEM_Zero) ); - assert( !(fg&(MEM_Str|MEM_Blob)) ); - assert( fg&(MEM_Int|MEM_Real) ); - assert( (pMem->flags&MEM_RowSet)==0 ); - assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - - - if( sqlite3VdbeMemGrow(pMem, nByte, 0) ){ - return SQLITE_NOMEM; - } - - /* For a Real or Integer, use sqlite3_mprintf() to produce the UTF-8 - ** string representation of the value. Then, if the required encoding - ** is UTF-16le or UTF-16be do a translation. - ** - ** FIX ME: It would be better if sqlite3_snprintf() could do UTF-16. - */ - if( fg & MEM_Int ){ - sqlite3_snprintf(nByte, pMem->z, "%lld", pMem->u.i); - }else{ - assert( fg & MEM_Real ); - sqlite3_snprintf(nByte, pMem->z, "%!.15g", pMem->r); - } - pMem->n = sqlite3Strlen30(pMem->z); - pMem->enc = SQLITE_UTF8; - pMem->flags |= MEM_Str|MEM_Term; - sqlite3VdbeChangeEncoding(pMem, enc); - return rc; -} - -/* -** Memory cell pMem contains the context of an aggregate function. -** This routine calls the finalize method for that function. The -** result of the aggregate is stored back into pMem. -** -** Return SQLITE_ERROR if the finalizer reports an error. SQLITE_OK -** otherwise. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemFinalize(Mem *pMem, FuncDef *pFunc){ - int rc = SQLITE_OK; - if( ALWAYS(pFunc && pFunc->xFinalize) ){ - sqlite3_context ctx; - assert( (pMem->flags & MEM_Null)!=0 || pFunc==pMem->u.pDef ); - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - memset(&ctx, 0, sizeof(ctx)); - ctx.s.flags = MEM_Null; - ctx.s.db = pMem->db; - ctx.pMem = pMem; - ctx.pFunc = pFunc; - pFunc->xFinalize(&ctx); /* IMP: R-24505-23230 */ - assert( 0==(pMem->flags&MEM_Dyn) && !pMem->xDel ); - sqlite3DbFree(pMem->db, pMem->zMalloc); - memcpy(pMem, &ctx.s, sizeof(ctx.s)); - rc = ctx.isError; - } - return rc; -} - -/* -** If the memory cell contains a string value that must be freed by -** invoking an external callback, free it now. Calling this function -** does not free any Mem.zMalloc buffer. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemReleaseExternal(Mem *p){ - assert( p->db==0 || sqlite3_mutex_held(p->db->mutex) ); - if( p->flags&MEM_Agg ){ - sqlite3VdbeMemFinalize(p, p->u.pDef); - assert( (p->flags & MEM_Agg)==0 ); - sqlite3VdbeMemRelease(p); - }else if( p->flags&MEM_Dyn && p->xDel ){ - assert( (p->flags&MEM_RowSet)==0 ); - assert( p->xDel!=SQLITE_DYNAMIC ); - p->xDel((void *)p->z); - p->xDel = 0; - }else if( p->flags&MEM_RowSet ){ - sqlite3RowSetClear(p->u.pRowSet); - }else if( p->flags&MEM_Frame ){ - sqlite3VdbeMemSetNull(p); - } -} - -/* -** Release any memory held by the Mem. This may leave the Mem in an -** inconsistent state, for example with (Mem.z==0) and -** (Mem.type==SQLITE_TEXT). -*/ -SQLITE_PRIVATE void sqlite3VdbeMemRelease(Mem *p){ - VdbeMemRelease(p); - if( p->zMalloc ){ - sqlite3DbFree(p->db, p->zMalloc); - p->zMalloc = 0; - } - p->z = 0; - assert( p->xDel==0 ); /* Zeroed by VdbeMemRelease() above */ -} - -/* -** Convert a 64-bit IEEE double into a 64-bit signed integer. -** If the double is out of range of a 64-bit signed integer then -** return the closest available 64-bit signed integer. -*/ -static i64 doubleToInt64(double r){ -#ifdef SQLITE_OMIT_FLOATING_POINT - /* When floating-point is omitted, double and int64 are the same thing */ - return r; -#else - /* - ** Many compilers we encounter do not define constants for the - ** minimum and maximum 64-bit integers, or they define them - ** inconsistently. And many do not understand the "LL" notation. - ** So we define our own static constants here using nothing - ** larger than a 32-bit integer constant. - */ - static const i64 maxInt = LARGEST_INT64; - static const i64 minInt = SMALLEST_INT64; - - if( r<=(double)minInt ){ - return minInt; - }else if( r>=(double)maxInt ){ - return maxInt; - }else{ - return (i64)r; - } -#endif -} - -/* -** Return some kind of integer value which is the best we can do -** at representing the value that *pMem describes as an integer. -** If pMem is an integer, then the value is exact. If pMem is -** a floating-point then the value returned is the integer part. -** If pMem is a string or blob, then we make an attempt to convert -** it into a integer and return that. If pMem represents an -** an SQL-NULL value, return 0. -** -** If pMem represents a string value, its encoding might be changed. -*/ -SQLITE_PRIVATE i64 sqlite3VdbeIntValue(Mem *pMem){ - int flags; - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - flags = pMem->flags; - if( flags & MEM_Int ){ - return pMem->u.i; - }else if( flags & MEM_Real ){ - return doubleToInt64(pMem->r); - }else if( flags & (MEM_Str|MEM_Blob) ){ - i64 value = 0; - assert( pMem->z || pMem->n==0 ); - testcase( pMem->z==0 ); - sqlite3Atoi64(pMem->z, &value, pMem->n, pMem->enc); - return value; - }else{ - return 0; - } -} - -/* -** Return the best representation of pMem that we can get into a -** double. If pMem is already a double or an integer, return its -** value. If it is a string or blob, try to convert it to a double. -** If it is a NULL, return 0.0. -*/ -SQLITE_PRIVATE double sqlite3VdbeRealValue(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - if( pMem->flags & MEM_Real ){ - return pMem->r; - }else if( pMem->flags & MEM_Int ){ - return (double)pMem->u.i; - }else if( pMem->flags & (MEM_Str|MEM_Blob) ){ - /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ - double val = (double)0; - sqlite3AtoF(pMem->z, &val, pMem->n, pMem->enc); - return val; - }else{ - /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ - return (double)0; - } -} - -/* -** The MEM structure is already a MEM_Real. Try to also make it a -** MEM_Int if we can. -*/ -SQLITE_PRIVATE void sqlite3VdbeIntegerAffinity(Mem *pMem){ - assert( pMem->flags & MEM_Real ); - assert( (pMem->flags & MEM_RowSet)==0 ); - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - - pMem->u.i = doubleToInt64(pMem->r); - - /* Only mark the value as an integer if - ** - ** (1) the round-trip conversion real->int->real is a no-op, and - ** (2) The integer is neither the largest nor the smallest - ** possible integer (ticket #3922) - ** - ** The second and third terms in the following conditional enforces - ** the second condition under the assumption that addition overflow causes - ** values to wrap around. - */ - if( pMem->r==(double)pMem->u.i - && pMem->u.i>SMALLEST_INT64 - && pMem->u.iflags |= MEM_Int; - } -} - -/* -** Convert pMem to type integer. Invalidate any prior representations. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemIntegerify(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( (pMem->flags & MEM_RowSet)==0 ); - assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - - pMem->u.i = sqlite3VdbeIntValue(pMem); - MemSetTypeFlag(pMem, MEM_Int); - return SQLITE_OK; -} - -/* -** Convert pMem so that it is of type MEM_Real. -** Invalidate any prior representations. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemRealify(Mem *pMem){ - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - - pMem->r = sqlite3VdbeRealValue(pMem); - MemSetTypeFlag(pMem, MEM_Real); - return SQLITE_OK; -} - -/* -** Convert pMem so that it has types MEM_Real or MEM_Int or both. -** Invalidate any prior representations. -** -** Every effort is made to force the conversion, even if the input -** is a string that does not look completely like a number. Convert -** as much of the string as we can and ignore the rest. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemNumerify(Mem *pMem){ - if( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))==0 ){ - assert( (pMem->flags & (MEM_Blob|MEM_Str))!=0 ); - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - if( 0==sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc) ){ - MemSetTypeFlag(pMem, MEM_Int); - }else{ - pMem->r = sqlite3VdbeRealValue(pMem); - MemSetTypeFlag(pMem, MEM_Real); - sqlite3VdbeIntegerAffinity(pMem); - } - } - assert( (pMem->flags & (MEM_Int|MEM_Real|MEM_Null))!=0 ); - pMem->flags &= ~(MEM_Str|MEM_Blob); - return SQLITE_OK; -} - -/* -** Delete any previous value and set the value stored in *pMem to NULL. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemSetNull(Mem *pMem){ - if( pMem->flags & MEM_Frame ){ - VdbeFrame *pFrame = pMem->u.pFrame; - pFrame->pParent = pFrame->v->pDelFrame; - pFrame->v->pDelFrame = pFrame; - } - if( pMem->flags & MEM_RowSet ){ - sqlite3RowSetClear(pMem->u.pRowSet); - } - MemSetTypeFlag(pMem, MEM_Null); - pMem->type = SQLITE_NULL; -} -SQLITE_PRIVATE void sqlite3ValueSetNull(sqlite3_value *p){ - sqlite3VdbeMemSetNull((Mem*)p); -} - -/* -** Delete any previous value and set the value to be a BLOB of length -** n containing all zeros. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemSetZeroBlob(Mem *pMem, int n){ - sqlite3VdbeMemRelease(pMem); - pMem->flags = MEM_Blob|MEM_Zero; - pMem->type = SQLITE_BLOB; - pMem->n = 0; - if( n<0 ) n = 0; - pMem->u.nZero = n; - pMem->enc = SQLITE_UTF8; - -#ifdef SQLITE_OMIT_INCRBLOB - sqlite3VdbeMemGrow(pMem, n, 0); - if( pMem->z ){ - pMem->n = n; - memset(pMem->z, 0, n); - } -#endif -} - -/* -** Delete any previous value and set the value stored in *pMem to val, -** manifest type INTEGER. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemSetInt64(Mem *pMem, i64 val){ - sqlite3VdbeMemRelease(pMem); - pMem->u.i = val; - pMem->flags = MEM_Int; - pMem->type = SQLITE_INTEGER; -} - -#ifndef SQLITE_OMIT_FLOATING_POINT -/* -** Delete any previous value and set the value stored in *pMem to val, -** manifest type REAL. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemSetDouble(Mem *pMem, double val){ - if( sqlite3IsNaN(val) ){ - sqlite3VdbeMemSetNull(pMem); - }else{ - sqlite3VdbeMemRelease(pMem); - pMem->r = val; - pMem->flags = MEM_Real; - pMem->type = SQLITE_FLOAT; - } -} -#endif - -/* -** Delete any previous value and set the value of pMem to be an -** empty boolean index. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemSetRowSet(Mem *pMem){ - sqlite3 *db = pMem->db; - assert( db!=0 ); - assert( (pMem->flags & MEM_RowSet)==0 ); - sqlite3VdbeMemRelease(pMem); - pMem->zMalloc = sqlite3DbMallocRaw(db, 64); - if( db->mallocFailed ){ - pMem->flags = MEM_Null; - }else{ - assert( pMem->zMalloc ); - pMem->u.pRowSet = sqlite3RowSetInit(db, pMem->zMalloc, - sqlite3DbMallocSize(db, pMem->zMalloc)); - assert( pMem->u.pRowSet!=0 ); - pMem->flags = MEM_RowSet; - } -} - -/* -** Return true if the Mem object contains a TEXT or BLOB that is -** too large - whose size exceeds SQLITE_MAX_LENGTH. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemTooBig(Mem *p){ - assert( p->db!=0 ); - if( p->flags & (MEM_Str|MEM_Blob) ){ - int n = p->n; - if( p->flags & MEM_Zero ){ - n += p->u.nZero; - } - return n>p->db->aLimit[SQLITE_LIMIT_LENGTH]; - } - return 0; -} - -#ifdef SQLITE_DEBUG -/* -** This routine prepares a memory cell for modication by breaking -** its link to a shallow copy and by marking any current shallow -** copies of this cell as invalid. -** -** This is used for testing and debugging only - to make sure shallow -** copies are not misused. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemAboutToChange(Vdbe *pVdbe, Mem *pMem){ - int i; - Mem *pX; - for(i=1, pX=&pVdbe->aMem[1]; i<=pVdbe->nMem; i++, pX++){ - if( pX->pScopyFrom==pMem ){ - pX->flags |= MEM_Invalid; - pX->pScopyFrom = 0; - } - } - pMem->pScopyFrom = 0; -} -#endif /* SQLITE_DEBUG */ - -/* -** Size of struct Mem not including the Mem.zMalloc member. -*/ -#define MEMCELLSIZE offsetof(Mem,zMalloc) - -/* -** Make an shallow copy of pFrom into pTo. Prior contents of -** pTo are freed. The pFrom->z field is not duplicated. If -** pFrom->z is used, then pTo->z points to the same thing as pFrom->z -** and flags gets srcType (either MEM_Ephem or MEM_Static). -*/ -SQLITE_PRIVATE void sqlite3VdbeMemShallowCopy(Mem *pTo, const Mem *pFrom, int srcType){ - assert( (pFrom->flags & MEM_RowSet)==0 ); - VdbeMemRelease(pTo); - memcpy(pTo, pFrom, MEMCELLSIZE); - pTo->xDel = 0; - if( (pFrom->flags&MEM_Static)==0 ){ - pTo->flags &= ~(MEM_Dyn|MEM_Static|MEM_Ephem); - assert( srcType==MEM_Ephem || srcType==MEM_Static ); - pTo->flags |= srcType; - } -} - -/* -** Make a full copy of pFrom into pTo. Prior contents of pTo are -** freed before the copy is made. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemCopy(Mem *pTo, const Mem *pFrom){ - int rc = SQLITE_OK; - - assert( (pFrom->flags & MEM_RowSet)==0 ); - VdbeMemRelease(pTo); - memcpy(pTo, pFrom, MEMCELLSIZE); - pTo->flags &= ~MEM_Dyn; - - if( pTo->flags&(MEM_Str|MEM_Blob) ){ - if( 0==(pFrom->flags&MEM_Static) ){ - pTo->flags |= MEM_Ephem; - rc = sqlite3VdbeMemMakeWriteable(pTo); - } - } - - return rc; -} - -/* -** Transfer the contents of pFrom to pTo. Any existing value in pTo is -** freed. If pFrom contains ephemeral data, a copy is made. -** -** pFrom contains an SQL NULL when this routine returns. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemMove(Mem *pTo, Mem *pFrom){ - assert( pFrom->db==0 || sqlite3_mutex_held(pFrom->db->mutex) ); - assert( pTo->db==0 || sqlite3_mutex_held(pTo->db->mutex) ); - assert( pFrom->db==0 || pTo->db==0 || pFrom->db==pTo->db ); - - sqlite3VdbeMemRelease(pTo); - memcpy(pTo, pFrom, sizeof(Mem)); - pFrom->flags = MEM_Null; - pFrom->xDel = 0; - pFrom->zMalloc = 0; -} - -/* -** Change the value of a Mem to be a string or a BLOB. -** -** The memory management strategy depends on the value of the xDel -** parameter. If the value passed is SQLITE_TRANSIENT, then the -** string is copied into a (possibly existing) buffer managed by the -** Mem structure. Otherwise, any existing buffer is freed and the -** pointer copied. -** -** If the string is too large (if it exceeds the SQLITE_LIMIT_LENGTH -** size limit) then no memory allocation occurs. If the string can be -** stored without allocating memory, then it is. If a memory allocation -** is required to store the string, then value of pMem is unchanged. In -** either case, SQLITE_TOOBIG is returned. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemSetStr( - Mem *pMem, /* Memory cell to set to string value */ - const char *z, /* String pointer */ - int n, /* Bytes in string, or negative */ - u8 enc, /* Encoding of z. 0 for BLOBs */ - void (*xDel)(void*) /* Destructor function */ -){ - int nByte = n; /* New value for pMem->n */ - int iLimit; /* Maximum allowed string or blob size */ - u16 flags = 0; /* New value for pMem->flags */ - - assert( pMem->db==0 || sqlite3_mutex_held(pMem->db->mutex) ); - assert( (pMem->flags & MEM_RowSet)==0 ); - - /* If z is a NULL pointer, set pMem to contain an SQL NULL. */ - if( !z ){ - sqlite3VdbeMemSetNull(pMem); - return SQLITE_OK; - } - - if( pMem->db ){ - iLimit = pMem->db->aLimit[SQLITE_LIMIT_LENGTH]; - }else{ - iLimit = SQLITE_MAX_LENGTH; - } - flags = (enc==0?MEM_Blob:MEM_Str); - if( nByte<0 ){ - assert( enc!=0 ); - if( enc==SQLITE_UTF8 ){ - for(nByte=0; nByte<=iLimit && z[nByte]; nByte++){} - }else{ - for(nByte=0; nByte<=iLimit && (z[nByte] | z[nByte+1]); nByte+=2){} - } - flags |= MEM_Term; - } - - /* The following block sets the new values of Mem.z and Mem.xDel. It - ** also sets a flag in local variable "flags" to indicate the memory - ** management (one of MEM_Dyn or MEM_Static). - */ - if( xDel==SQLITE_TRANSIENT ){ - int nAlloc = nByte; - if( flags&MEM_Term ){ - nAlloc += (enc==SQLITE_UTF8?1:2); - } - if( nByte>iLimit ){ - return SQLITE_TOOBIG; - } - if( sqlite3VdbeMemGrow(pMem, nAlloc, 0) ){ - return SQLITE_NOMEM; - } - memcpy(pMem->z, z, nAlloc); - }else if( xDel==SQLITE_DYNAMIC ){ - sqlite3VdbeMemRelease(pMem); - pMem->zMalloc = pMem->z = (char *)z; - pMem->xDel = 0; - }else{ - sqlite3VdbeMemRelease(pMem); - pMem->z = (char *)z; - pMem->xDel = xDel; - flags |= ((xDel==SQLITE_STATIC)?MEM_Static:MEM_Dyn); - } - - pMem->n = nByte; - pMem->flags = flags; - pMem->enc = (enc==0 ? SQLITE_UTF8 : enc); - pMem->type = (enc==0 ? SQLITE_BLOB : SQLITE_TEXT); - -#ifndef SQLITE_OMIT_UTF16 - if( pMem->enc!=SQLITE_UTF8 && sqlite3VdbeMemHandleBom(pMem) ){ - return SQLITE_NOMEM; - } -#endif - - if( nByte>iLimit ){ - return SQLITE_TOOBIG; - } - - return SQLITE_OK; -} - -/* -** Compare the values contained by the two memory cells, returning -** negative, zero or positive if pMem1 is less than, equal to, or greater -** than pMem2. Sorting order is NULL's first, followed by numbers (integers -** and reals) sorted numerically, followed by text ordered by the collating -** sequence pColl and finally blob's ordered by memcmp(). -** -** Two NULL values are considered equal by this function. -*/ -SQLITE_PRIVATE int sqlite3MemCompare(const Mem *pMem1, const Mem *pMem2, const CollSeq *pColl){ - int rc; - int f1, f2; - int combined_flags; - - f1 = pMem1->flags; - f2 = pMem2->flags; - combined_flags = f1|f2; - assert( (combined_flags & MEM_RowSet)==0 ); - - /* If one value is NULL, it is less than the other. If both values - ** are NULL, return 0. - */ - if( combined_flags&MEM_Null ){ - return (f2&MEM_Null) - (f1&MEM_Null); - } - - /* If one value is a number and the other is not, the number is less. - ** If both are numbers, compare as reals if one is a real, or as integers - ** if both values are integers. - */ - if( combined_flags&(MEM_Int|MEM_Real) ){ - double r1, r2; - if( (f1 & f2 & MEM_Int)!=0 ){ - if( pMem1->u.i < pMem2->u.i ) return -1; - if( pMem1->u.i > pMem2->u.i ) return 1; - return 0; - } - if( (f1&MEM_Real)!=0 ){ - r1 = pMem1->r; - }else if( (f1&MEM_Int)!=0 ){ - r1 = (double)pMem1->u.i; - }else{ - return 1; - } - if( (f2&MEM_Real)!=0 ){ - r2 = pMem2->r; - }else if( (f2&MEM_Int)!=0 ){ - r2 = (double)pMem2->u.i; - }else{ - return -1; - } - if( r1r2 ) return 1; - return 0; - } - - /* If one value is a string and the other is a blob, the string is less. - ** If both are strings, compare using the collating functions. - */ - if( combined_flags&MEM_Str ){ - if( (f1 & MEM_Str)==0 ){ - return 1; - } - if( (f2 & MEM_Str)==0 ){ - return -1; - } - - assert( pMem1->enc==pMem2->enc ); - assert( pMem1->enc==SQLITE_UTF8 || - pMem1->enc==SQLITE_UTF16LE || pMem1->enc==SQLITE_UTF16BE ); - - /* The collation sequence must be defined at this point, even if - ** the user deletes the collation sequence after the vdbe program is - ** compiled (this was not always the case). - */ - assert( !pColl || pColl->xCmp ); - - if( pColl ){ - if( pMem1->enc==pColl->enc ){ - /* The strings are already in the correct encoding. Call the - ** comparison function directly */ - return pColl->xCmp(pColl->pUser,pMem1->n,pMem1->z,pMem2->n,pMem2->z); - }else{ - const void *v1, *v2; - int n1, n2; - Mem c1; - Mem c2; - memset(&c1, 0, sizeof(c1)); - memset(&c2, 0, sizeof(c2)); - sqlite3VdbeMemShallowCopy(&c1, pMem1, MEM_Ephem); - sqlite3VdbeMemShallowCopy(&c2, pMem2, MEM_Ephem); - v1 = sqlite3ValueText((sqlite3_value*)&c1, pColl->enc); - n1 = v1==0 ? 0 : c1.n; - v2 = sqlite3ValueText((sqlite3_value*)&c2, pColl->enc); - n2 = v2==0 ? 0 : c2.n; - rc = pColl->xCmp(pColl->pUser, n1, v1, n2, v2); - sqlite3VdbeMemRelease(&c1); - sqlite3VdbeMemRelease(&c2); - return rc; - } - } - /* If a NULL pointer was passed as the collate function, fall through - ** to the blob case and use memcmp(). */ - } - - /* Both values must be blobs. Compare using memcmp(). */ - rc = memcmp(pMem1->z, pMem2->z, (pMem1->n>pMem2->n)?pMem2->n:pMem1->n); - if( rc==0 ){ - rc = pMem1->n - pMem2->n; - } - return rc; -} - -/* -** Move data out of a btree key or data field and into a Mem structure. -** The data or key is taken from the entry that pCur is currently pointing -** to. offset and amt determine what portion of the data or key to retrieve. -** key is true to get the key or false to get data. The result is written -** into the pMem element. -** -** The pMem structure is assumed to be uninitialized. Any prior content -** is overwritten without being freed. -** -** If this routine fails for any reason (malloc returns NULL or unable -** to read from the disk) then the pMem is left in an inconsistent state. -*/ -SQLITE_PRIVATE int sqlite3VdbeMemFromBtree( - BtCursor *pCur, /* Cursor pointing at record to retrieve. */ - u32 offset, /* Offset from the start of data to return bytes from. */ - u32 amt, /* Number of bytes to return. */ - int key, /* If true, retrieve from the btree key, not data. */ - Mem *pMem /* OUT: Return data in this Mem structure. */ -){ - char *zData; /* Data from the btree layer */ - u32 available = 0; /* Number of bytes available on the local btree page */ - int rc = SQLITE_OK; /* Return code */ - - assert( sqlite3BtreeCursorIsValid(pCur) ); - - /* Note: the calls to BtreeKeyFetch() and DataFetch() below assert() - ** that both the BtShared and database handle mutexes are held. */ - assert( (pMem->flags & MEM_RowSet)==0 ); - if( key ){ - zData = (char *)sqlite3BtreeKeyFetch(pCur, &available); - }else{ - zData = (char *)sqlite3BtreeDataFetch(pCur, &available); - } - assert( zData!=0 ); - - if( offset+amt<=available ){ - sqlite3VdbeMemRelease(pMem); - pMem->z = &zData[offset]; - pMem->flags = MEM_Blob|MEM_Ephem; - }else if( SQLITE_OK==(rc = sqlite3VdbeMemGrow(pMem, amt+2, 0)) ){ - pMem->flags = MEM_Blob|MEM_Dyn|MEM_Term; - pMem->enc = 0; - pMem->type = SQLITE_BLOB; - if( key ){ - rc = sqlite3BtreeKey(pCur, offset, amt, pMem->z); - }else{ - rc = sqlite3BtreeData(pCur, offset, amt, pMem->z); - } - pMem->z[amt] = 0; - pMem->z[amt+1] = 0; - if( rc!=SQLITE_OK ){ - sqlite3VdbeMemRelease(pMem); - } - } - pMem->n = (int)amt; - - return rc; -} - -/* This function is only available internally, it is not part of the -** external API. It works in a similar way to sqlite3_value_text(), -** except the data returned is in the encoding specified by the second -** parameter, which must be one of SQLITE_UTF16BE, SQLITE_UTF16LE or -** SQLITE_UTF8. -** -** (2006-02-16:) The enc value can be or-ed with SQLITE_UTF16_ALIGNED. -** If that is the case, then the result must be aligned on an even byte -** boundary. -*/ -SQLITE_PRIVATE const void *sqlite3ValueText(sqlite3_value* pVal, u8 enc){ - if( !pVal ) return 0; - - assert( pVal->db==0 || sqlite3_mutex_held(pVal->db->mutex) ); - assert( (enc&3)==(enc&~SQLITE_UTF16_ALIGNED) ); - assert( (pVal->flags & MEM_RowSet)==0 ); - - if( pVal->flags&MEM_Null ){ - return 0; - } - assert( (MEM_Blob>>3) == MEM_Str ); - pVal->flags |= (pVal->flags & MEM_Blob)>>3; - ExpandBlob(pVal); - if( pVal->flags&MEM_Str ){ - sqlite3VdbeChangeEncoding(pVal, enc & ~SQLITE_UTF16_ALIGNED); - if( (enc & SQLITE_UTF16_ALIGNED)!=0 && 1==(1&SQLITE_PTR_TO_INT(pVal->z)) ){ - assert( (pVal->flags & (MEM_Ephem|MEM_Static))!=0 ); - if( sqlite3VdbeMemMakeWriteable(pVal)!=SQLITE_OK ){ - return 0; - } - } - sqlite3VdbeMemNulTerminate(pVal); /* IMP: R-31275-44060 */ - }else{ - assert( (pVal->flags&MEM_Blob)==0 ); - sqlite3VdbeMemStringify(pVal, enc); - assert( 0==(1&SQLITE_PTR_TO_INT(pVal->z)) ); - } - assert(pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) || pVal->db==0 - || pVal->db->mallocFailed ); - if( pVal->enc==(enc & ~SQLITE_UTF16_ALIGNED) ){ - return pVal->z; - }else{ - return 0; - } -} - -/* -** Create a new sqlite3_value object. -*/ -SQLITE_PRIVATE sqlite3_value *sqlite3ValueNew(sqlite3 *db){ - Mem *p = sqlite3DbMallocZero(db, sizeof(*p)); - if( p ){ - p->flags = MEM_Null; - p->type = SQLITE_NULL; - p->db = db; - } - return p; -} - -/* -** Context object passed by sqlite3Stat4ProbeSetValue() through to -** valueNew(). See comments above valueNew() for details. -*/ -struct ValueNewStat4Ctx { - Parse *pParse; - Index *pIdx; - UnpackedRecord **ppRec; - int iVal; -}; - -/* -** Allocate and return a pointer to a new sqlite3_value object. If -** the second argument to this function is NULL, the object is allocated -** by calling sqlite3ValueNew(). -** -** Otherwise, if the second argument is non-zero, then this function is -** being called indirectly by sqlite3Stat4ProbeSetValue(). If it has not -** already been allocated, allocate the UnpackedRecord structure that -** that function will return to its caller here. Then return a pointer -** an sqlite3_value within the UnpackedRecord.a[] array. -*/ -static sqlite3_value *valueNew(sqlite3 *db, struct ValueNewStat4Ctx *p){ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - if( p ){ - UnpackedRecord *pRec = p->ppRec[0]; - - if( pRec==0 ){ - Index *pIdx = p->pIdx; /* Index being probed */ - int nByte; /* Bytes of space to allocate */ - int i; /* Counter variable */ - int nCol = pIdx->nColumn; /* Number of index columns including rowid */ - - nByte = sizeof(Mem) * nCol + ROUND8(sizeof(UnpackedRecord)); - pRec = (UnpackedRecord*)sqlite3DbMallocZero(db, nByte); - if( pRec ){ - pRec->pKeyInfo = sqlite3KeyInfoOfIndex(p->pParse, pIdx); - if( pRec->pKeyInfo ){ - assert( pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField==nCol ); - assert( pRec->pKeyInfo->enc==ENC(db) ); - pRec->flags = UNPACKED_PREFIX_MATCH; - pRec->aMem = (Mem *)((u8*)pRec + ROUND8(sizeof(UnpackedRecord))); - for(i=0; iaMem[i].flags = MEM_Null; - pRec->aMem[i].type = SQLITE_NULL; - pRec->aMem[i].db = db; - } - }else{ - sqlite3DbFree(db, pRec); - pRec = 0; - } - } - if( pRec==0 ) return 0; - p->ppRec[0] = pRec; - } - - pRec->nField = p->iVal+1; - return &pRec->aMem[p->iVal]; - } -#else - UNUSED_PARAMETER(p); -#endif /* defined(SQLITE_ENABLE_STAT3_OR_STAT4) */ - return sqlite3ValueNew(db); -} - -/* -** Extract a value from the supplied expression in the manner described -** above sqlite3ValueFromExpr(). Allocate the sqlite3_value object -** using valueNew(). -** -** If pCtx is NULL and an error occurs after the sqlite3_value object -** has been allocated, it is freed before returning. Or, if pCtx is not -** NULL, it is assumed that the caller will free any allocated object -** in all cases. -*/ -static int valueFromExpr( - sqlite3 *db, /* The database connection */ - Expr *pExpr, /* The expression to evaluate */ - u8 enc, /* Encoding to use */ - u8 affinity, /* Affinity to use */ - sqlite3_value **ppVal, /* Write the new value here */ - struct ValueNewStat4Ctx *pCtx /* Second argument for valueNew() */ -){ - int op; - char *zVal = 0; - sqlite3_value *pVal = 0; - int negInt = 1; - const char *zNeg = ""; - int rc = SQLITE_OK; - - if( !pExpr ){ - *ppVal = 0; - return SQLITE_OK; - } - op = pExpr->op; - if( NEVER(op==TK_REGISTER) ) op = pExpr->op2; - - /* Handle negative integers in a single step. This is needed in the - ** case when the value is -9223372036854775808. - */ - if( op==TK_UMINUS - && (pExpr->pLeft->op==TK_INTEGER || pExpr->pLeft->op==TK_FLOAT) ){ - pExpr = pExpr->pLeft; - op = pExpr->op; - negInt = -1; - zNeg = "-"; - } - - if( op==TK_STRING || op==TK_FLOAT || op==TK_INTEGER ){ - pVal = valueNew(db, pCtx); - if( pVal==0 ) goto no_mem; - if( ExprHasProperty(pExpr, EP_IntValue) ){ - sqlite3VdbeMemSetInt64(pVal, (i64)pExpr->u.iValue*negInt); - }else{ - zVal = sqlite3MPrintf(db, "%s%s", zNeg, pExpr->u.zToken); - if( zVal==0 ) goto no_mem; - sqlite3ValueSetStr(pVal, -1, zVal, SQLITE_UTF8, SQLITE_DYNAMIC); - if( op==TK_FLOAT ) pVal->type = SQLITE_FLOAT; - } - if( (op==TK_INTEGER || op==TK_FLOAT ) && affinity==SQLITE_AFF_NONE ){ - sqlite3ValueApplyAffinity(pVal, SQLITE_AFF_NUMERIC, SQLITE_UTF8); - }else{ - sqlite3ValueApplyAffinity(pVal, affinity, SQLITE_UTF8); - } - if( pVal->flags & (MEM_Int|MEM_Real) ) pVal->flags &= ~MEM_Str; - if( enc!=SQLITE_UTF8 ){ - rc = sqlite3VdbeChangeEncoding(pVal, enc); - } - }else if( op==TK_UMINUS ) { - /* This branch happens for multiple negative signs. Ex: -(-5) */ - if( SQLITE_OK==sqlite3ValueFromExpr(db,pExpr->pLeft,enc,affinity,&pVal) - && pVal!=0 - ){ - sqlite3VdbeMemNumerify(pVal); - if( pVal->u.i==SMALLEST_INT64 ){ - pVal->flags &= MEM_Int; - pVal->flags |= MEM_Real; - pVal->r = (double)LARGEST_INT64; - }else{ - pVal->u.i = -pVal->u.i; - } - pVal->r = -pVal->r; - sqlite3ValueApplyAffinity(pVal, affinity, enc); - } - }else if( op==TK_NULL ){ - pVal = valueNew(db, pCtx); - if( pVal==0 ) goto no_mem; - } -#ifndef SQLITE_OMIT_BLOB_LITERAL - else if( op==TK_BLOB ){ - int nVal; - assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' ); - assert( pExpr->u.zToken[1]=='\'' ); - pVal = valueNew(db, pCtx); - if( !pVal ) goto no_mem; - zVal = &pExpr->u.zToken[2]; - nVal = sqlite3Strlen30(zVal)-1; - assert( zVal[nVal]=='\'' ); - sqlite3VdbeMemSetStr(pVal, sqlite3HexToBlob(db, zVal, nVal), nVal/2, - 0, SQLITE_DYNAMIC); - } -#endif - - if( pVal ){ - sqlite3VdbeMemStoreType(pVal); - } - *ppVal = pVal; - return rc; - -no_mem: - db->mallocFailed = 1; - sqlite3DbFree(db, zVal); - assert( *ppVal==0 ); -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - if( pCtx==0 ) sqlite3ValueFree(pVal); -#else - assert( pCtx==0 ); sqlite3ValueFree(pVal); -#endif - return SQLITE_NOMEM; -} - -/* -** Create a new sqlite3_value object, containing the value of pExpr. -** -** This only works for very simple expressions that consist of one constant -** token (i.e. "5", "5.1", "'a string'"). If the expression can -** be converted directly into a value, then the value is allocated and -** a pointer written to *ppVal. The caller is responsible for deallocating -** the value by passing it to sqlite3ValueFree() later on. If the expression -** cannot be converted to a value, then *ppVal is set to NULL. -*/ -SQLITE_PRIVATE int sqlite3ValueFromExpr( - sqlite3 *db, /* The database connection */ - Expr *pExpr, /* The expression to evaluate */ - u8 enc, /* Encoding to use */ - u8 affinity, /* Affinity to use */ - sqlite3_value **ppVal /* Write the new value here */ -){ - return valueFromExpr(db, pExpr, enc, affinity, ppVal, 0); -} - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -/* -** The implementation of the sqlite_record() function. This function accepts -** a single argument of any type. The return value is a formatted database -** record (a blob) containing the argument value. -** -** This is used to convert the value stored in the 'sample' column of the -** sqlite_stat3 table to the record format SQLite uses internally. -*/ -static void recordFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const int file_format = 1; - int iSerial; /* Serial type */ - int nSerial; /* Bytes of space for iSerial as varint */ - int nVal; /* Bytes of space required for argv[0] */ - int nRet; - sqlite3 *db; - u8 *aRet; - - UNUSED_PARAMETER( argc ); - iSerial = sqlite3VdbeSerialType(argv[0], file_format); - nSerial = sqlite3VarintLen(iSerial); - nVal = sqlite3VdbeSerialTypeLen(iSerial); - db = sqlite3_context_db_handle(context); - - nRet = 1 + nSerial + nVal; - aRet = sqlite3DbMallocRaw(db, nRet); - if( aRet==0 ){ - sqlite3_result_error_nomem(context); - }else{ - aRet[0] = nSerial+1; - sqlite3PutVarint(&aRet[1], iSerial); - sqlite3VdbeSerialPut(&aRet[1+nSerial], argv[0], iSerial); - sqlite3_result_blob(context, aRet, nRet, SQLITE_TRANSIENT); - sqlite3DbFree(db, aRet); - } -} - -/* -** Register built-in functions used to help read ANALYZE data. -*/ -SQLITE_PRIVATE void sqlite3AnalyzeFunctions(void){ - static SQLITE_WSD FuncDef aAnalyzeTableFuncs[] = { - FUNCTION(sqlite_record, 1, 0, 0, recordFunc), - }; - int i; - FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions); - FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aAnalyzeTableFuncs); - for(i=0; idb; - - - struct ValueNewStat4Ctx alloc; - alloc.pParse = pParse; - alloc.pIdx = pIdx; - alloc.ppRec = ppRec; - alloc.iVal = iVal; - - /* Skip over any TK_COLLATE nodes */ - pExpr = sqlite3ExprSkipCollate(pExpr); - - if( !pExpr ){ - pVal = valueNew(db, &alloc); - if( pVal ){ - sqlite3VdbeMemSetNull((Mem*)pVal); - } - }else if( pExpr->op==TK_VARIABLE - || NEVER(pExpr->op==TK_REGISTER && pExpr->op2==TK_VARIABLE) - ){ - Vdbe *v; - int iBindVar = pExpr->iColumn; - sqlite3VdbeSetVarmask(pParse->pVdbe, iBindVar); - if( (v = pParse->pReprepare)!=0 ){ - pVal = valueNew(db, &alloc); - if( pVal ){ - rc = sqlite3VdbeMemCopy((Mem*)pVal, &v->aVar[iBindVar-1]); - if( rc==SQLITE_OK ){ - sqlite3ValueApplyAffinity(pVal, affinity, ENC(db)); - } - pVal->db = pParse->db; - sqlite3VdbeMemStoreType((Mem*)pVal); - } - } - }else{ - rc = valueFromExpr(db, pExpr, ENC(db), affinity, &pVal, &alloc); - } - *pbOk = (pVal!=0); - - assert( pVal==0 || pVal->db==db ); - return rc; -} - -/* -** Unless it is NULL, the argument must be an UnpackedRecord object returned -** by an earlier call to sqlite3Stat4ProbeSetValue(). This call deletes -** the object. -*/ -SQLITE_PRIVATE void sqlite3Stat4ProbeFree(UnpackedRecord *pRec){ - if( pRec ){ - int i; - int nCol = pRec->pKeyInfo->nField+pRec->pKeyInfo->nXField; - Mem *aMem = pRec->aMem; - sqlite3 *db = aMem[0].db; - for(i=0; ipKeyInfo); - sqlite3DbFree(db, pRec); - } -} -#endif /* ifdef SQLITE_ENABLE_STAT4 */ - -/* -** Change the string value of an sqlite3_value object -*/ -SQLITE_PRIVATE void sqlite3ValueSetStr( - sqlite3_value *v, /* Value to be set */ - int n, /* Length of string z */ - const void *z, /* Text of the new string */ - u8 enc, /* Encoding to use */ - void (*xDel)(void*) /* Destructor for the string */ -){ - if( v ) sqlite3VdbeMemSetStr((Mem *)v, z, n, enc, xDel); -} - -/* -** Free an sqlite3_value object -*/ -SQLITE_PRIVATE void sqlite3ValueFree(sqlite3_value *v){ - if( !v ) return; - sqlite3VdbeMemRelease((Mem *)v); - sqlite3DbFree(((Mem*)v)->db, v); -} - -/* -** Return the number of bytes in the sqlite3_value object assuming -** that it uses the encoding "enc" -*/ -SQLITE_PRIVATE int sqlite3ValueBytes(sqlite3_value *pVal, u8 enc){ - Mem *p = (Mem*)pVal; - if( (p->flags & MEM_Blob)!=0 || sqlite3ValueText(pVal, enc) ){ - if( p->flags & MEM_Zero ){ - return p->n + p->u.nZero; - }else{ - return p->n; - } - } - return 0; -} - -/************** End of vdbemem.c *********************************************/ -/************** Begin file vdbeaux.c *****************************************/ -/* -** 2003 September 6 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code used for creating, destroying, and populating -** a VDBE (or an "sqlite3_stmt" as it is known to the outside world.) Prior -** to version 2.8.7, all this code was combined into the vdbe.c source file. -** But that file was getting too big so this subroutines were split out. -*/ - -/* -** Create a new virtual database engine. -*/ -SQLITE_PRIVATE Vdbe *sqlite3VdbeCreate(Parse *pParse){ - sqlite3 *db = pParse->db; - Vdbe *p; - p = sqlite3DbMallocZero(db, sizeof(Vdbe) ); - if( p==0 ) return 0; - p->db = db; - if( db->pVdbe ){ - db->pVdbe->pPrev = p; - } - p->pNext = db->pVdbe; - p->pPrev = 0; - db->pVdbe = p; - p->magic = VDBE_MAGIC_INIT; - p->pParse = pParse; - assert( pParse->aLabel==0 ); - assert( pParse->nLabel==0 ); - assert( pParse->nOpAlloc==0 ); - return p; -} - -/* -** Remember the SQL string for a prepared statement. -*/ -SQLITE_PRIVATE void sqlite3VdbeSetSql(Vdbe *p, const char *z, int n, int isPrepareV2){ - assert( isPrepareV2==1 || isPrepareV2==0 ); - if( p==0 ) return; -#if defined(SQLITE_OMIT_TRACE) && !defined(SQLITE_ENABLE_SQLLOG) - if( !isPrepareV2 ) return; -#endif - assert( p->zSql==0 ); - p->zSql = sqlite3DbStrNDup(p->db, z, n); - p->isPrepareV2 = (u8)isPrepareV2; -} - -/* -** Return the SQL associated with a prepared statement -*/ -SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt){ - Vdbe *p = (Vdbe *)pStmt; - return (p && p->isPrepareV2) ? p->zSql : 0; -} - -/* -** Swap all content between two VDBE structures. -*/ -SQLITE_PRIVATE void sqlite3VdbeSwap(Vdbe *pA, Vdbe *pB){ - Vdbe tmp, *pTmp; - char *zTmp; - tmp = *pA; - *pA = *pB; - *pB = tmp; - pTmp = pA->pNext; - pA->pNext = pB->pNext; - pB->pNext = pTmp; - pTmp = pA->pPrev; - pA->pPrev = pB->pPrev; - pB->pPrev = pTmp; - zTmp = pA->zSql; - pA->zSql = pB->zSql; - pB->zSql = zTmp; - pB->isPrepareV2 = pA->isPrepareV2; -} - -/* -** Resize the Vdbe.aOp array so that it is at least one op larger than -** it was. -** -** If an out-of-memory error occurs while resizing the array, return -** SQLITE_NOMEM. In this case Vdbe.aOp and Vdbe.nOpAlloc remain -** unchanged (this is so that any opcodes already allocated can be -** correctly deallocated along with the rest of the Vdbe). -*/ -static int growOpArray(Vdbe *v){ - VdbeOp *pNew; - Parse *p = v->pParse; - int nNew = (p->nOpAlloc ? p->nOpAlloc*2 : (int)(1024/sizeof(Op))); - pNew = sqlite3DbRealloc(p->db, v->aOp, nNew*sizeof(Op)); - if( pNew ){ - p->nOpAlloc = sqlite3DbMallocSize(p->db, pNew)/sizeof(Op); - v->aOp = pNew; - } - return (pNew ? SQLITE_OK : SQLITE_NOMEM); -} - -#ifdef SQLITE_DEBUG -/* This routine is just a convenient place to set a breakpoint that will -** fire after each opcode is inserted and displayed using -** "PRAGMA vdbe_addoptrace=on". -*/ -static void test_addop_breakpoint(void){ - static int n = 0; - n++; -} -#endif - -/* -** Add a new instruction to the list of instructions current in the -** VDBE. Return the address of the new instruction. -** -** Parameters: -** -** p Pointer to the VDBE -** -** op The opcode for this instruction -** -** p1, p2, p3 Operands -** -** Use the sqlite3VdbeResolveLabel() function to fix an address and -** the sqlite3VdbeChangeP4() function to change the value of the P4 -** operand. -*/ -SQLITE_PRIVATE int sqlite3VdbeAddOp3(Vdbe *p, int op, int p1, int p2, int p3){ - int i; - VdbeOp *pOp; - - i = p->nOp; - assert( p->magic==VDBE_MAGIC_INIT ); - assert( op>0 && op<0xff ); - if( p->pParse->nOpAlloc<=i ){ - if( growOpArray(p) ){ - return 1; - } - } - p->nOp++; - pOp = &p->aOp[i]; - pOp->opcode = (u8)op; - pOp->p5 = 0; - pOp->p1 = p1; - pOp->p2 = p2; - pOp->p3 = p3; - pOp->p4.p = 0; - pOp->p4type = P4_NOTUSED; -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - pOp->zComment = 0; -#endif -#ifdef SQLITE_DEBUG - if( p->db->flags & SQLITE_VdbeAddopTrace ){ - int jj, kk; - Parse *pParse = p->pParse; - for(jj=kk=0; jjaColCache + jj; - if( x->iLevel>pParse->iCacheLevel || x->iReg==0 ) continue; - printf(" r[%d]={%d:%d}", x->iReg, x->iTable, x->iColumn); - kk++; - } - if( kk ) printf("\n"); - sqlite3VdbePrintOp(0, i, &p->aOp[i]); - test_addop_breakpoint(); - } -#endif -#ifdef VDBE_PROFILE - pOp->cycles = 0; - pOp->cnt = 0; -#endif - return i; -} -SQLITE_PRIVATE int sqlite3VdbeAddOp0(Vdbe *p, int op){ - return sqlite3VdbeAddOp3(p, op, 0, 0, 0); -} -SQLITE_PRIVATE int sqlite3VdbeAddOp1(Vdbe *p, int op, int p1){ - return sqlite3VdbeAddOp3(p, op, p1, 0, 0); -} -SQLITE_PRIVATE int sqlite3VdbeAddOp2(Vdbe *p, int op, int p1, int p2){ - return sqlite3VdbeAddOp3(p, op, p1, p2, 0); -} - - -/* -** Add an opcode that includes the p4 value as a pointer. -*/ -SQLITE_PRIVATE int sqlite3VdbeAddOp4( - Vdbe *p, /* Add the opcode to this VM */ - int op, /* The new opcode */ - int p1, /* The P1 operand */ - int p2, /* The P2 operand */ - int p3, /* The P3 operand */ - const char *zP4, /* The P4 operand */ - int p4type /* P4 operand type */ -){ - int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3); - sqlite3VdbeChangeP4(p, addr, zP4, p4type); - return addr; -} - -/* -** Add an OP_ParseSchema opcode. This routine is broken out from -** sqlite3VdbeAddOp4() since it needs to also needs to mark all btrees -** as having been used. -** -** The zWhere string must have been obtained from sqlite3_malloc(). -** This routine will take ownership of the allocated memory. -*/ -SQLITE_PRIVATE void sqlite3VdbeAddParseSchemaOp(Vdbe *p, int iDb, char *zWhere){ - int j; - int addr = sqlite3VdbeAddOp3(p, OP_ParseSchema, iDb, 0, 0); - sqlite3VdbeChangeP4(p, addr, zWhere, P4_DYNAMIC); - for(j=0; jdb->nDb; j++) sqlite3VdbeUsesBtree(p, j); -} - -/* -** Add an opcode that includes the p4 value as an integer. -*/ -SQLITE_PRIVATE int sqlite3VdbeAddOp4Int( - Vdbe *p, /* Add the opcode to this VM */ - int op, /* The new opcode */ - int p1, /* The P1 operand */ - int p2, /* The P2 operand */ - int p3, /* The P3 operand */ - int p4 /* The P4 operand as an integer */ -){ - int addr = sqlite3VdbeAddOp3(p, op, p1, p2, p3); - sqlite3VdbeChangeP4(p, addr, SQLITE_INT_TO_PTR(p4), P4_INT32); - return addr; -} - -/* -** Create a new symbolic label for an instruction that has yet to be -** coded. The symbolic label is really just a negative number. The -** label can be used as the P2 value of an operation. Later, when -** the label is resolved to a specific address, the VDBE will scan -** through its operation list and change all values of P2 which match -** the label into the resolved address. -** -** The VDBE knows that a P2 value is a label because labels are -** always negative and P2 values are suppose to be non-negative. -** Hence, a negative P2 value is a label that has yet to be resolved. -** -** Zero is returned if a malloc() fails. -*/ -SQLITE_PRIVATE int sqlite3VdbeMakeLabel(Vdbe *v){ - Parse *p = v->pParse; - int i = p->nLabel++; - assert( v->magic==VDBE_MAGIC_INIT ); - if( (i & (i-1))==0 ){ - p->aLabel = sqlite3DbReallocOrFree(p->db, p->aLabel, - (i*2+1)*sizeof(p->aLabel[0])); - } - if( p->aLabel ){ - p->aLabel[i] = -1; - } - return -1-i; -} - -/* -** Resolve label "x" to be the address of the next instruction to -** be inserted. The parameter "x" must have been obtained from -** a prior call to sqlite3VdbeMakeLabel(). -*/ -SQLITE_PRIVATE void sqlite3VdbeResolveLabel(Vdbe *v, int x){ - Parse *p = v->pParse; - int j = -1-x; - assert( v->magic==VDBE_MAGIC_INIT ); - assert( jnLabel ); - if( j>=0 && p->aLabel ){ - p->aLabel[j] = v->nOp; - } - p->iFixedOp = v->nOp - 1; -} - -/* -** Mark the VDBE as one that can only be run one time. -*/ -SQLITE_PRIVATE void sqlite3VdbeRunOnlyOnce(Vdbe *p){ - p->runOnlyOnce = 1; -} - -#ifdef SQLITE_DEBUG /* sqlite3AssertMayAbort() logic */ - -/* -** The following type and function are used to iterate through all opcodes -** in a Vdbe main program and each of the sub-programs (triggers) it may -** invoke directly or indirectly. It should be used as follows: -** -** Op *pOp; -** VdbeOpIter sIter; -** -** memset(&sIter, 0, sizeof(sIter)); -** sIter.v = v; // v is of type Vdbe* -** while( (pOp = opIterNext(&sIter)) ){ -** // Do something with pOp -** } -** sqlite3DbFree(v->db, sIter.apSub); -** -*/ -typedef struct VdbeOpIter VdbeOpIter; -struct VdbeOpIter { - Vdbe *v; /* Vdbe to iterate through the opcodes of */ - SubProgram **apSub; /* Array of subprograms */ - int nSub; /* Number of entries in apSub */ - int iAddr; /* Address of next instruction to return */ - int iSub; /* 0 = main program, 1 = first sub-program etc. */ -}; -static Op *opIterNext(VdbeOpIter *p){ - Vdbe *v = p->v; - Op *pRet = 0; - Op *aOp; - int nOp; - - if( p->iSub<=p->nSub ){ - - if( p->iSub==0 ){ - aOp = v->aOp; - nOp = v->nOp; - }else{ - aOp = p->apSub[p->iSub-1]->aOp; - nOp = p->apSub[p->iSub-1]->nOp; - } - assert( p->iAddriAddr]; - p->iAddr++; - if( p->iAddr==nOp ){ - p->iSub++; - p->iAddr = 0; - } - - if( pRet->p4type==P4_SUBPROGRAM ){ - int nByte = (p->nSub+1)*sizeof(SubProgram*); - int j; - for(j=0; jnSub; j++){ - if( p->apSub[j]==pRet->p4.pProgram ) break; - } - if( j==p->nSub ){ - p->apSub = sqlite3DbReallocOrFree(v->db, p->apSub, nByte); - if( !p->apSub ){ - pRet = 0; - }else{ - p->apSub[p->nSub++] = pRet->p4.pProgram; - } - } - } - } - - return pRet; -} - -/* -** Check if the program stored in the VM associated with pParse may -** throw an ABORT exception (causing the statement, but not entire transaction -** to be rolled back). This condition is true if the main program or any -** sub-programs contains any of the following: -** -** * OP_Halt with P1=SQLITE_CONSTRAINT and P2=OE_Abort. -** * OP_HaltIfNull with P1=SQLITE_CONSTRAINT and P2=OE_Abort. -** * OP_Destroy -** * OP_VUpdate -** * OP_VRename -** * OP_FkCounter with P2==0 (immediate foreign key constraint) -** -** Then check that the value of Parse.mayAbort is true if an -** ABORT may be thrown, or false otherwise. Return true if it does -** match, or false otherwise. This function is intended to be used as -** part of an assert statement in the compiler. Similar to: -** -** assert( sqlite3VdbeAssertMayAbort(pParse->pVdbe, pParse->mayAbort) ); -*/ -SQLITE_PRIVATE int sqlite3VdbeAssertMayAbort(Vdbe *v, int mayAbort){ - int hasAbort = 0; - Op *pOp; - VdbeOpIter sIter; - memset(&sIter, 0, sizeof(sIter)); - sIter.v = v; - - while( (pOp = opIterNext(&sIter))!=0 ){ - int opcode = pOp->opcode; - if( opcode==OP_Destroy || opcode==OP_VUpdate || opcode==OP_VRename -#ifndef SQLITE_OMIT_FOREIGN_KEY - || (opcode==OP_FkCounter && pOp->p1==0 && pOp->p2==1) -#endif - || ((opcode==OP_Halt || opcode==OP_HaltIfNull) - && ((pOp->p1&0xff)==SQLITE_CONSTRAINT && pOp->p2==OE_Abort)) - ){ - hasAbort = 1; - break; - } - } - sqlite3DbFree(v->db, sIter.apSub); - - /* Return true if hasAbort==mayAbort. Or if a malloc failure occurred. - ** If malloc failed, then the while() loop above may not have iterated - ** through all opcodes and hasAbort may be set incorrectly. Return - ** true for this case to prevent the assert() in the callers frame - ** from failing. */ - return ( v->db->mallocFailed || hasAbort==mayAbort ); -} -#endif /* SQLITE_DEBUG - the sqlite3AssertMayAbort() function */ - -/* -** Loop through the program looking for P2 values that are negative -** on jump instructions. Each such value is a label. Resolve the -** label by setting the P2 value to its correct non-zero value. -** -** This routine is called once after all opcodes have been inserted. -** -** Variable *pMaxFuncArgs is set to the maximum value of any P2 argument -** to an OP_Function, OP_AggStep or OP_VFilter opcode. This is used by -** sqlite3VdbeMakeReady() to size the Vdbe.apArg[] array. -** -** The Op.opflags field is set on all opcodes. -*/ -static void resolveP2Values(Vdbe *p, int *pMaxFuncArgs){ - int i; - int nMaxArgs = *pMaxFuncArgs; - Op *pOp; - Parse *pParse = p->pParse; - int *aLabel = pParse->aLabel; - p->readOnly = 1; - p->bIsReader = 0; - for(pOp=p->aOp, i=p->nOp-1; i>=0; i--, pOp++){ - u8 opcode = pOp->opcode; - - /* NOTE: Be sure to update mkopcodeh.awk when adding or removing - ** cases from this switch! */ - switch( opcode ){ - case OP_Function: - case OP_AggStep: { - if( pOp->p5>nMaxArgs ) nMaxArgs = pOp->p5; - break; - } - case OP_Transaction: { - if( pOp->p2!=0 ) p->readOnly = 0; - /* fall thru */ - } - case OP_AutoCommit: - case OP_Savepoint: { - p->bIsReader = 1; - break; - } -#ifndef SQLITE_OMIT_WAL - case OP_Checkpoint: -#endif - case OP_Vacuum: - case OP_JournalMode: { - p->readOnly = 0; - p->bIsReader = 1; - break; - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - case OP_VUpdate: { - if( pOp->p2>nMaxArgs ) nMaxArgs = pOp->p2; - break; - } - case OP_VFilter: { - int n; - assert( p->nOp - i >= 3 ); - assert( pOp[-1].opcode==OP_Integer ); - n = pOp[-1].p1; - if( n>nMaxArgs ) nMaxArgs = n; - break; - } -#endif - case OP_Next: - case OP_NextIfOpen: - case OP_SorterNext: { - pOp->p4.xAdvance = sqlite3BtreeNext; - pOp->p4type = P4_ADVANCE; - break; - } - case OP_Prev: - case OP_PrevIfOpen: { - pOp->p4.xAdvance = sqlite3BtreePrevious; - pOp->p4type = P4_ADVANCE; - break; - } - } - - pOp->opflags = sqlite3OpcodeProperty[opcode]; - if( (pOp->opflags & OPFLG_JUMP)!=0 && pOp->p2<0 ){ - assert( -1-pOp->p2nLabel ); - pOp->p2 = aLabel[-1-pOp->p2]; - } - } - sqlite3DbFree(p->db, pParse->aLabel); - pParse->aLabel = 0; - pParse->nLabel = 0; - *pMaxFuncArgs = nMaxArgs; - assert( p->bIsReader!=0 || p->btreeMask==0 ); -} - -/* -** Return the address of the next instruction to be inserted. -*/ -SQLITE_PRIVATE int sqlite3VdbeCurrentAddr(Vdbe *p){ - assert( p->magic==VDBE_MAGIC_INIT ); - return p->nOp; -} - -/* -** This function returns a pointer to the array of opcodes associated with -** the Vdbe passed as the first argument. It is the callers responsibility -** to arrange for the returned array to be eventually freed using the -** vdbeFreeOpArray() function. -** -** Before returning, *pnOp is set to the number of entries in the returned -** array. Also, *pnMaxArg is set to the larger of its current value and -** the number of entries in the Vdbe.apArg[] array required to execute the -** returned program. -*/ -SQLITE_PRIVATE VdbeOp *sqlite3VdbeTakeOpArray(Vdbe *p, int *pnOp, int *pnMaxArg){ - VdbeOp *aOp = p->aOp; - assert( aOp && !p->db->mallocFailed ); - - /* Check that sqlite3VdbeUsesBtree() was not called on this VM */ - assert( p->btreeMask==0 ); - - resolveP2Values(p, pnMaxArg); - *pnOp = p->nOp; - p->aOp = 0; - return aOp; -} - -/* -** Add a whole list of operations to the operation stack. Return the -** address of the first operation added. -*/ -SQLITE_PRIVATE int sqlite3VdbeAddOpList(Vdbe *p, int nOp, VdbeOpList const *aOp){ - int addr; - assert( p->magic==VDBE_MAGIC_INIT ); - if( p->nOp + nOp > p->pParse->nOpAlloc && growOpArray(p) ){ - return 0; - } - addr = p->nOp; - if( ALWAYS(nOp>0) ){ - int i; - VdbeOpList const *pIn = aOp; - for(i=0; ip2; - VdbeOp *pOut = &p->aOp[i+addr]; - pOut->opcode = pIn->opcode; - pOut->p1 = pIn->p1; - if( p2<0 ){ - assert( sqlite3OpcodeProperty[pOut->opcode] & OPFLG_JUMP ); - pOut->p2 = addr + ADDR(p2); - }else{ - pOut->p2 = p2; - } - pOut->p3 = pIn->p3; - pOut->p4type = P4_NOTUSED; - pOut->p4.p = 0; - pOut->p5 = 0; -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - pOut->zComment = 0; -#endif -#ifdef SQLITE_DEBUG - if( p->db->flags & SQLITE_VdbeAddopTrace ){ - sqlite3VdbePrintOp(0, i+addr, &p->aOp[i+addr]); - } -#endif - } - p->nOp += nOp; - } - return addr; -} - -/* -** Change the value of the P1 operand for a specific instruction. -** This routine is useful when a large program is loaded from a -** static array using sqlite3VdbeAddOpList but we want to make a -** few minor changes to the program. -*/ -SQLITE_PRIVATE void sqlite3VdbeChangeP1(Vdbe *p, u32 addr, int val){ - assert( p!=0 ); - if( ((u32)p->nOp)>addr ){ - p->aOp[addr].p1 = val; - } -} - -/* -** Change the value of the P2 operand for a specific instruction. -** This routine is useful for setting a jump destination. -*/ -SQLITE_PRIVATE void sqlite3VdbeChangeP2(Vdbe *p, u32 addr, int val){ - assert( p!=0 ); - if( ((u32)p->nOp)>addr ){ - p->aOp[addr].p2 = val; - } -} - -/* -** Change the value of the P3 operand for a specific instruction. -*/ -SQLITE_PRIVATE void sqlite3VdbeChangeP3(Vdbe *p, u32 addr, int val){ - assert( p!=0 ); - if( ((u32)p->nOp)>addr ){ - p->aOp[addr].p3 = val; - } -} - -/* -** Change the value of the P5 operand for the most recently -** added operation. -*/ -SQLITE_PRIVATE void sqlite3VdbeChangeP5(Vdbe *p, u8 val){ - assert( p!=0 ); - if( p->aOp ){ - assert( p->nOp>0 ); - p->aOp[p->nOp-1].p5 = val; - } -} - -/* -** Change the P2 operand of instruction addr so that it points to -** the address of the next instruction to be coded. -*/ -SQLITE_PRIVATE void sqlite3VdbeJumpHere(Vdbe *p, int addr){ - sqlite3VdbeChangeP2(p, addr, p->nOp); - p->pParse->iFixedOp = p->nOp - 1; -} - - -/* -** If the input FuncDef structure is ephemeral, then free it. If -** the FuncDef is not ephermal, then do nothing. -*/ -static void freeEphemeralFunction(sqlite3 *db, FuncDef *pDef){ - if( ALWAYS(pDef) && (pDef->funcFlags & SQLITE_FUNC_EPHEM)!=0 ){ - sqlite3DbFree(db, pDef); - } -} - -static void vdbeFreeOpArray(sqlite3 *, Op *, int); - -/* -** Delete a P4 value if necessary. -*/ -static void freeP4(sqlite3 *db, int p4type, void *p4){ - if( p4 ){ - assert( db ); - switch( p4type ){ - case P4_REAL: - case P4_INT64: - case P4_DYNAMIC: - case P4_INTARRAY: { - sqlite3DbFree(db, p4); - break; - } - case P4_KEYINFO: { - if( db->pnBytesFreed==0 ) sqlite3KeyInfoUnref((KeyInfo*)p4); - break; - } - case P4_MPRINTF: { - if( db->pnBytesFreed==0 ) sqlite3_free(p4); - break; - } - case P4_FUNCDEF: { - freeEphemeralFunction(db, (FuncDef*)p4); - break; - } - case P4_MEM: { - if( db->pnBytesFreed==0 ){ - sqlite3ValueFree((sqlite3_value*)p4); - }else{ - Mem *p = (Mem*)p4; - sqlite3DbFree(db, p->zMalloc); - sqlite3DbFree(db, p); - } - break; - } - case P4_VTAB : { - if( db->pnBytesFreed==0 ) sqlite3VtabUnlock((VTable *)p4); - break; - } - } - } -} - -/* -** Free the space allocated for aOp and any p4 values allocated for the -** opcodes contained within. If aOp is not NULL it is assumed to contain -** nOp entries. -*/ -static void vdbeFreeOpArray(sqlite3 *db, Op *aOp, int nOp){ - if( aOp ){ - Op *pOp; - for(pOp=aOp; pOp<&aOp[nOp]; pOp++){ - freeP4(db, pOp->p4type, pOp->p4.p); -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - sqlite3DbFree(db, pOp->zComment); -#endif - } - } - sqlite3DbFree(db, aOp); -} - -/* -** Link the SubProgram object passed as the second argument into the linked -** list at Vdbe.pSubProgram. This list is used to delete all sub-program -** objects when the VM is no longer required. -*/ -SQLITE_PRIVATE void sqlite3VdbeLinkSubProgram(Vdbe *pVdbe, SubProgram *p){ - p->pNext = pVdbe->pProgram; - pVdbe->pProgram = p; -} - -/* -** Change the opcode at addr into OP_Noop -*/ -SQLITE_PRIVATE void sqlite3VdbeChangeToNoop(Vdbe *p, int addr){ - if( p->aOp ){ - VdbeOp *pOp = &p->aOp[addr]; - sqlite3 *db = p->db; - freeP4(db, pOp->p4type, pOp->p4.p); - memset(pOp, 0, sizeof(pOp[0])); - pOp->opcode = OP_Noop; - if( addr==p->nOp-1 ) p->nOp--; - } -} - -/* -** Remove the last opcode inserted -*/ -SQLITE_PRIVATE int sqlite3VdbeDeletePriorOpcode(Vdbe *p, u8 op){ - if( (p->nOp-1)>(p->pParse->iFixedOp) && p->aOp[p->nOp-1].opcode==op ){ - sqlite3VdbeChangeToNoop(p, p->nOp-1); - return 1; - }else{ - return 0; - } -} - -/* -** Change the value of the P4 operand for a specific instruction. -** This routine is useful when a large program is loaded from a -** static array using sqlite3VdbeAddOpList but we want to make a -** few minor changes to the program. -** -** If n>=0 then the P4 operand is dynamic, meaning that a copy of -** the string is made into memory obtained from sqlite3_malloc(). -** A value of n==0 means copy bytes of zP4 up to and including the -** first null byte. If n>0 then copy n+1 bytes of zP4. -** -** Other values of n (P4_STATIC, P4_COLLSEQ etc.) indicate that zP4 points -** to a string or structure that is guaranteed to exist for the lifetime of -** the Vdbe. In these cases we can just copy the pointer. -** -** If addr<0 then change P4 on the most recently inserted instruction. -*/ -SQLITE_PRIVATE void sqlite3VdbeChangeP4(Vdbe *p, int addr, const char *zP4, int n){ - Op *pOp; - sqlite3 *db; - assert( p!=0 ); - db = p->db; - assert( p->magic==VDBE_MAGIC_INIT ); - if( p->aOp==0 || db->mallocFailed ){ - if( n!=P4_VTAB ){ - freeP4(db, n, (void*)*(char**)&zP4); - } - return; - } - assert( p->nOp>0 ); - assert( addrnOp ); - if( addr<0 ){ - addr = p->nOp - 1; - } - pOp = &p->aOp[addr]; - assert( pOp->p4type==P4_NOTUSED || pOp->p4type==P4_INT32 ); - freeP4(db, pOp->p4type, pOp->p4.p); - pOp->p4.p = 0; - if( n==P4_INT32 ){ - /* Note: this cast is safe, because the origin data point was an int - ** that was cast to a (const char *). */ - pOp->p4.i = SQLITE_PTR_TO_INT(zP4); - pOp->p4type = P4_INT32; - }else if( zP4==0 ){ - pOp->p4.p = 0; - pOp->p4type = P4_NOTUSED; - }else if( n==P4_KEYINFO ){ - pOp->p4.p = (void*)zP4; - pOp->p4type = P4_KEYINFO; - }else if( n==P4_VTAB ){ - pOp->p4.p = (void*)zP4; - pOp->p4type = P4_VTAB; - sqlite3VtabLock((VTable *)zP4); - assert( ((VTable *)zP4)->db==p->db ); - }else if( n<0 ){ - pOp->p4.p = (void*)zP4; - pOp->p4type = (signed char)n; - }else{ - if( n==0 ) n = sqlite3Strlen30(zP4); - pOp->p4.z = sqlite3DbStrNDup(p->db, zP4, n); - pOp->p4type = P4_DYNAMIC; - } -} - -/* -** Set the P4 on the most recently added opcode to the KeyInfo for the -** index given. -*/ -SQLITE_PRIVATE void sqlite3VdbeSetP4KeyInfo(Parse *pParse, Index *pIdx){ - Vdbe *v = pParse->pVdbe; - assert( v!=0 ); - assert( pIdx!=0 ); - sqlite3VdbeChangeP4(v, -1, (char*)sqlite3KeyInfoOfIndex(pParse, pIdx), - P4_KEYINFO); -} - -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS -/* -** Change the comment on the most recently coded instruction. Or -** insert a No-op and add the comment to that new instruction. This -** makes the code easier to read during debugging. None of this happens -** in a production build. -*/ -static void vdbeVComment(Vdbe *p, const char *zFormat, va_list ap){ - assert( p->nOp>0 || p->aOp==0 ); - assert( p->aOp==0 || p->aOp[p->nOp-1].zComment==0 || p->db->mallocFailed ); - if( p->nOp ){ - assert( p->aOp ); - sqlite3DbFree(p->db, p->aOp[p->nOp-1].zComment); - p->aOp[p->nOp-1].zComment = sqlite3VMPrintf(p->db, zFormat, ap); - } -} -SQLITE_PRIVATE void sqlite3VdbeComment(Vdbe *p, const char *zFormat, ...){ - va_list ap; - if( p ){ - va_start(ap, zFormat); - vdbeVComment(p, zFormat, ap); - va_end(ap); - } -} -SQLITE_PRIVATE void sqlite3VdbeNoopComment(Vdbe *p, const char *zFormat, ...){ - va_list ap; - if( p ){ - sqlite3VdbeAddOp0(p, OP_Noop); - va_start(ap, zFormat); - vdbeVComment(p, zFormat, ap); - va_end(ap); - } -} -#endif /* NDEBUG */ - -/* -** Return the opcode for a given address. If the address is -1, then -** return the most recently inserted opcode. -** -** If a memory allocation error has occurred prior to the calling of this -** routine, then a pointer to a dummy VdbeOp will be returned. That opcode -** is readable but not writable, though it is cast to a writable value. -** The return of a dummy opcode allows the call to continue functioning -** after a OOM fault without having to check to see if the return from -** this routine is a valid pointer. But because the dummy.opcode is 0, -** dummy will never be written to. This is verified by code inspection and -** by running with Valgrind. -** -** About the #ifdef SQLITE_OMIT_TRACE: Normally, this routine is never called -** unless p->nOp>0. This is because in the absense of SQLITE_OMIT_TRACE, -** an OP_Trace instruction is always inserted by sqlite3VdbeGet() as soon as -** a new VDBE is created. So we are free to set addr to p->nOp-1 without -** having to double-check to make sure that the result is non-negative. But -** if SQLITE_OMIT_TRACE is defined, the OP_Trace is omitted and we do need to -** check the value of p->nOp-1 before continuing. -*/ -SQLITE_PRIVATE VdbeOp *sqlite3VdbeGetOp(Vdbe *p, int addr){ - /* C89 specifies that the constant "dummy" will be initialized to all - ** zeros, which is correct. MSVC generates a warning, nevertheless. */ - static VdbeOp dummy; /* Ignore the MSVC warning about no initializer */ - assert( p->magic==VDBE_MAGIC_INIT ); - if( addr<0 ){ -#ifdef SQLITE_OMIT_TRACE - if( p->nOp==0 ) return (VdbeOp*)&dummy; -#endif - addr = p->nOp - 1; - } - assert( (addr>=0 && addrnOp) || p->db->mallocFailed ); - if( p->db->mallocFailed ){ - return (VdbeOp*)&dummy; - }else{ - return &p->aOp[addr]; - } -} - -#if defined(SQLITE_ENABLE_EXPLAIN_COMMENTS) -/* -** Return an integer value for one of the parameters to the opcode pOp -** determined by character c. -*/ -static int translateP(char c, const Op *pOp){ - if( c=='1' ) return pOp->p1; - if( c=='2' ) return pOp->p2; - if( c=='3' ) return pOp->p3; - if( c=='4' ) return pOp->p4.i; - return pOp->p5; -} - -/* -** Compute a string for the "comment" field of a VDBE opcode listing. -** -** The Synopsis: field in comments in the vdbe.c source file gets converted -** to an extra string that is appended to the sqlite3OpcodeName(). In the -** absence of other comments, this synopsis becomes the comment on the opcode. -** Some translation occurs: -** -** "PX" -> "r[X]" -** "PX@PY" -> "r[X..X+Y-1]" or "r[x]" if y is 0 or 1 -** "PX@PY+1" -> "r[X..X+Y]" or "r[x]" if y is 0 -** "PY..PY" -> "r[X..Y]" or "r[x]" if y<=x -*/ -static int displayComment( - const Op *pOp, /* The opcode to be commented */ - const char *zP4, /* Previously obtained value for P4 */ - char *zTemp, /* Write result here */ - int nTemp /* Space available in zTemp[] */ -){ - const char *zOpName; - const char *zSynopsis; - int nOpName; - int ii, jj; - zOpName = sqlite3OpcodeName(pOp->opcode); - nOpName = sqlite3Strlen30(zOpName); - if( zOpName[nOpName+1] ){ - int seenCom = 0; - char c; - zSynopsis = zOpName += nOpName + 1; - for(ii=jj=0; jjzComment); - seenCom = 1; - }else{ - int v1 = translateP(c, pOp); - int v2; - sqlite3_snprintf(nTemp-jj, zTemp+jj, "%d", v1); - if( strncmp(zSynopsis+ii+1, "@P", 2)==0 ){ - ii += 3; - jj += sqlite3Strlen30(zTemp+jj); - v2 = translateP(zSynopsis[ii], pOp); - if( strncmp(zSynopsis+ii+1,"+1",2)==0 ){ - ii += 2; - v2++; - } - if( v2>1 ){ - sqlite3_snprintf(nTemp-jj, zTemp+jj, "..%d", v1+v2-1); - } - }else if( strncmp(zSynopsis+ii+1, "..P3", 4)==0 && pOp->p3==0 ){ - ii += 4; - } - } - jj += sqlite3Strlen30(zTemp+jj); - }else{ - zTemp[jj++] = c; - } - } - if( !seenCom && jjzComment ){ - sqlite3_snprintf(nTemp-jj, zTemp+jj, "; %s", pOp->zComment); - jj += sqlite3Strlen30(zTemp+jj); - } - if( jjzComment ){ - sqlite3_snprintf(nTemp, zTemp, "%s", pOp->zComment); - jj = sqlite3Strlen30(zTemp); - }else{ - zTemp[0] = 0; - jj = 0; - } - return jj; -} -#endif /* SQLITE_DEBUG */ - - -#if !defined(SQLITE_OMIT_EXPLAIN) || !defined(NDEBUG) \ - || defined(VDBE_PROFILE) || defined(SQLITE_DEBUG) -/* -** Compute a string that describes the P4 parameter for an opcode. -** Use zTemp for any required temporary buffer space. -*/ -static char *displayP4(Op *pOp, char *zTemp, int nTemp){ - char *zP4 = zTemp; - assert( nTemp>=20 ); - switch( pOp->p4type ){ - case P4_KEYINFO: { - int i, j; - KeyInfo *pKeyInfo = pOp->p4.pKeyInfo; - assert( pKeyInfo->aSortOrder!=0 ); - sqlite3_snprintf(nTemp, zTemp, "k(%d", pKeyInfo->nField); - i = sqlite3Strlen30(zTemp); - for(j=0; jnField; j++){ - CollSeq *pColl = pKeyInfo->aColl[j]; - const char *zColl = pColl ? pColl->zName : "nil"; - int n = sqlite3Strlen30(zColl); - if( n==6 && memcmp(zColl,"BINARY",6)==0 ){ - zColl = "B"; - n = 1; - } - if( i+n>nTemp-6 ){ - memcpy(&zTemp[i],",...",4); - break; - } - zTemp[i++] = ','; - if( pKeyInfo->aSortOrder[j] ){ - zTemp[i++] = '-'; - } - memcpy(&zTemp[i], zColl, n+1); - i += n; - } - zTemp[i++] = ')'; - zTemp[i] = 0; - assert( ip4.pColl; - sqlite3_snprintf(nTemp, zTemp, "(%.20s)", pColl->zName); - break; - } - case P4_FUNCDEF: { - FuncDef *pDef = pOp->p4.pFunc; - sqlite3_snprintf(nTemp, zTemp, "%s(%d)", pDef->zName, pDef->nArg); - break; - } - case P4_INT64: { - sqlite3_snprintf(nTemp, zTemp, "%lld", *pOp->p4.pI64); - break; - } - case P4_INT32: { - sqlite3_snprintf(nTemp, zTemp, "%d", pOp->p4.i); - break; - } - case P4_REAL: { - sqlite3_snprintf(nTemp, zTemp, "%.16g", *pOp->p4.pReal); - break; - } - case P4_MEM: { - Mem *pMem = pOp->p4.pMem; - if( pMem->flags & MEM_Str ){ - zP4 = pMem->z; - }else if( pMem->flags & MEM_Int ){ - sqlite3_snprintf(nTemp, zTemp, "%lld", pMem->u.i); - }else if( pMem->flags & MEM_Real ){ - sqlite3_snprintf(nTemp, zTemp, "%.16g", pMem->r); - }else if( pMem->flags & MEM_Null ){ - sqlite3_snprintf(nTemp, zTemp, "NULL"); - }else{ - assert( pMem->flags & MEM_Blob ); - zP4 = "(blob)"; - } - break; - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - case P4_VTAB: { - sqlite3_vtab *pVtab = pOp->p4.pVtab->pVtab; - sqlite3_snprintf(nTemp, zTemp, "vtab:%p:%p", pVtab, pVtab->pModule); - break; - } -#endif - case P4_INTARRAY: { - sqlite3_snprintf(nTemp, zTemp, "intarray"); - break; - } - case P4_SUBPROGRAM: { - sqlite3_snprintf(nTemp, zTemp, "program"); - break; - } - case P4_ADVANCE: { - zTemp[0] = 0; - break; - } - default: { - zP4 = pOp->p4.z; - if( zP4==0 ){ - zP4 = zTemp; - zTemp[0] = 0; - } - } - } - assert( zP4!=0 ); - return zP4; -} -#endif - -/* -** Declare to the Vdbe that the BTree object at db->aDb[i] is used. -** -** The prepared statements need to know in advance the complete set of -** attached databases that will be use. A mask of these databases -** is maintained in p->btreeMask. The p->lockMask value is the subset of -** p->btreeMask of databases that will require a lock. -*/ -SQLITE_PRIVATE void sqlite3VdbeUsesBtree(Vdbe *p, int i){ - assert( i>=0 && idb->nDb && i<(int)sizeof(yDbMask)*8 ); - assert( i<(int)sizeof(p->btreeMask)*8 ); - p->btreeMask |= ((yDbMask)1)<db->aDb[i].pBt) ){ - p->lockMask |= ((yDbMask)1)<0 -/* -** If SQLite is compiled to support shared-cache mode and to be threadsafe, -** this routine obtains the mutex associated with each BtShared structure -** that may be accessed by the VM passed as an argument. In doing so it also -** sets the BtShared.db member of each of the BtShared structures, ensuring -** that the correct busy-handler callback is invoked if required. -** -** If SQLite is not threadsafe but does support shared-cache mode, then -** sqlite3BtreeEnter() is invoked to set the BtShared.db variables -** of all of BtShared structures accessible via the database handle -** associated with the VM. -** -** If SQLite is not threadsafe and does not support shared-cache mode, this -** function is a no-op. -** -** The p->btreeMask field is a bitmask of all btrees that the prepared -** statement p will ever use. Let N be the number of bits in p->btreeMask -** corresponding to btrees that use shared cache. Then the runtime of -** this routine is N*N. But as N is rarely more than 1, this should not -** be a problem. -*/ -SQLITE_PRIVATE void sqlite3VdbeEnter(Vdbe *p){ - int i; - yDbMask mask; - sqlite3 *db; - Db *aDb; - int nDb; - if( p->lockMask==0 ) return; /* The common case */ - db = p->db; - aDb = db->aDb; - nDb = db->nDb; - for(i=0, mask=1; ilockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){ - sqlite3BtreeEnter(aDb[i].pBt); - } - } -} -#endif - -#if !defined(SQLITE_OMIT_SHARED_CACHE) && SQLITE_THREADSAFE>0 -/* -** Unlock all of the btrees previously locked by a call to sqlite3VdbeEnter(). -*/ -SQLITE_PRIVATE void sqlite3VdbeLeave(Vdbe *p){ - int i; - yDbMask mask; - sqlite3 *db; - Db *aDb; - int nDb; - if( p->lockMask==0 ) return; /* The common case */ - db = p->db; - aDb = db->aDb; - nDb = db->nDb; - for(i=0, mask=1; ilockMask)!=0 && ALWAYS(aDb[i].pBt!=0) ){ - sqlite3BtreeLeave(aDb[i].pBt); - } - } -} -#endif - -#if defined(VDBE_PROFILE) || defined(SQLITE_DEBUG) -/* -** Print a single opcode. This routine is used for debugging only. -*/ -SQLITE_PRIVATE void sqlite3VdbePrintOp(FILE *pOut, int pc, Op *pOp){ - char *zP4; - char zPtr[50]; - char zCom[100]; - static const char *zFormat1 = "%4d %-13s %4d %4d %4d %-13s %.2X %s\n"; - if( pOut==0 ) pOut = stdout; - zP4 = displayP4(pOp, zPtr, sizeof(zPtr)); -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - displayComment(pOp, zP4, zCom, sizeof(zCom)); -#else - zCom[0] = 0 -#endif - /* NB: The sqlite3OpcodeName() function is implemented by code created - ** by the mkopcodeh.awk and mkopcodec.awk scripts which extract the - ** information from the vdbe.c source text */ - fprintf(pOut, zFormat1, pc, - sqlite3OpcodeName(pOp->opcode), pOp->p1, pOp->p2, pOp->p3, zP4, pOp->p5, - zCom - ); - fflush(pOut); -} -#endif - -/* -** Release an array of N Mem elements -*/ -static void releaseMemArray(Mem *p, int N){ - if( p && N ){ - Mem *pEnd; - sqlite3 *db = p->db; - u8 malloc_failed = db->mallocFailed; - if( db->pnBytesFreed ){ - for(pEnd=&p[N]; pzMalloc); - } - return; - } - for(pEnd=&p[N]; pflags&(MEM_Agg|MEM_Dyn|MEM_Frame|MEM_RowSet) ){ - sqlite3VdbeMemRelease(p); - }else if( p->zMalloc ){ - sqlite3DbFree(db, p->zMalloc); - p->zMalloc = 0; - } - - p->flags = MEM_Invalid; - } - db->mallocFailed = malloc_failed; - } -} - -/* -** Delete a VdbeFrame object and its contents. VdbeFrame objects are -** allocated by the OP_Program opcode in sqlite3VdbeExec(). -*/ -SQLITE_PRIVATE void sqlite3VdbeFrameDelete(VdbeFrame *p){ - int i; - Mem *aMem = VdbeFrameMem(p); - VdbeCursor **apCsr = (VdbeCursor **)&aMem[p->nChildMem]; - for(i=0; inChildCsr; i++){ - sqlite3VdbeFreeCursor(p->v, apCsr[i]); - } - releaseMemArray(aMem, p->nChildMem); - sqlite3DbFree(p->v->db, p); -} - -#ifndef SQLITE_OMIT_EXPLAIN -/* -** Give a listing of the program in the virtual machine. -** -** The interface is the same as sqlite3VdbeExec(). But instead of -** running the code, it invokes the callback once for each instruction. -** This feature is used to implement "EXPLAIN". -** -** When p->explain==1, each instruction is listed. When -** p->explain==2, only OP_Explain instructions are listed and these -** are shown in a different format. p->explain==2 is used to implement -** EXPLAIN QUERY PLAN. -** -** When p->explain==1, first the main program is listed, then each of -** the trigger subprograms are listed one by one. -*/ -SQLITE_PRIVATE int sqlite3VdbeList( - Vdbe *p /* The VDBE */ -){ - int nRow; /* Stop when row count reaches this */ - int nSub = 0; /* Number of sub-vdbes seen so far */ - SubProgram **apSub = 0; /* Array of sub-vdbes */ - Mem *pSub = 0; /* Memory cell hold array of subprogs */ - sqlite3 *db = p->db; /* The database connection */ - int i; /* Loop counter */ - int rc = SQLITE_OK; /* Return code */ - Mem *pMem = &p->aMem[1]; /* First Mem of result set */ - - assert( p->explain ); - assert( p->magic==VDBE_MAGIC_RUN ); - assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY || p->rc==SQLITE_NOMEM ); - - /* Even though this opcode does not use dynamic strings for - ** the result, result columns may become dynamic if the user calls - ** sqlite3_column_text16(), causing a translation to UTF-16 encoding. - */ - releaseMemArray(pMem, 8); - p->pResultSet = 0; - - if( p->rc==SQLITE_NOMEM ){ - /* This happens if a malloc() inside a call to sqlite3_column_text() or - ** sqlite3_column_text16() failed. */ - db->mallocFailed = 1; - return SQLITE_ERROR; - } - - /* When the number of output rows reaches nRow, that means the - ** listing has finished and sqlite3_step() should return SQLITE_DONE. - ** nRow is the sum of the number of rows in the main program, plus - ** the sum of the number of rows in all trigger subprograms encountered - ** so far. The nRow value will increase as new trigger subprograms are - ** encountered, but p->pc will eventually catch up to nRow. - */ - nRow = p->nOp; - if( p->explain==1 ){ - /* The first 8 memory cells are used for the result set. So we will - ** commandeer the 9th cell to use as storage for an array of pointers - ** to trigger subprograms. The VDBE is guaranteed to have at least 9 - ** cells. */ - assert( p->nMem>9 ); - pSub = &p->aMem[9]; - if( pSub->flags&MEM_Blob ){ - /* On the first call to sqlite3_step(), pSub will hold a NULL. It is - ** initialized to a BLOB by the P4_SUBPROGRAM processing logic below */ - nSub = pSub->n/sizeof(Vdbe*); - apSub = (SubProgram **)pSub->z; - } - for(i=0; inOp; - } - } - - do{ - i = p->pc++; - }while( iexplain==2 && p->aOp[i].opcode!=OP_Explain ); - if( i>=nRow ){ - p->rc = SQLITE_OK; - rc = SQLITE_DONE; - }else if( db->u1.isInterrupted ){ - p->rc = SQLITE_INTERRUPT; - rc = SQLITE_ERROR; - sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(p->rc)); - }else{ - char *zP4; - Op *pOp; - if( inOp ){ - /* The output line number is small enough that we are still in the - ** main program. */ - pOp = &p->aOp[i]; - }else{ - /* We are currently listing subprograms. Figure out which one and - ** pick up the appropriate opcode. */ - int j; - i -= p->nOp; - for(j=0; i>=apSub[j]->nOp; j++){ - i -= apSub[j]->nOp; - } - pOp = &apSub[j]->aOp[i]; - } - if( p->explain==1 ){ - pMem->flags = MEM_Int; - pMem->type = SQLITE_INTEGER; - pMem->u.i = i; /* Program counter */ - pMem++; - - pMem->flags = MEM_Static|MEM_Str|MEM_Term; - pMem->z = (char*)sqlite3OpcodeName(pOp->opcode); /* Opcode */ - assert( pMem->z!=0 ); - pMem->n = sqlite3Strlen30(pMem->z); - pMem->type = SQLITE_TEXT; - pMem->enc = SQLITE_UTF8; - pMem++; - - /* When an OP_Program opcode is encounter (the only opcode that has - ** a P4_SUBPROGRAM argument), expand the size of the array of subprograms - ** kept in p->aMem[9].z to hold the new program - assuming this subprogram - ** has not already been seen. - */ - if( pOp->p4type==P4_SUBPROGRAM ){ - int nByte = (nSub+1)*sizeof(SubProgram*); - int j; - for(j=0; jp4.pProgram ) break; - } - if( j==nSub && SQLITE_OK==sqlite3VdbeMemGrow(pSub, nByte, nSub!=0) ){ - apSub = (SubProgram **)pSub->z; - apSub[nSub++] = pOp->p4.pProgram; - pSub->flags |= MEM_Blob; - pSub->n = nSub*sizeof(SubProgram*); - } - } - } - - pMem->flags = MEM_Int; - pMem->u.i = pOp->p1; /* P1 */ - pMem->type = SQLITE_INTEGER; - pMem++; - - pMem->flags = MEM_Int; - pMem->u.i = pOp->p2; /* P2 */ - pMem->type = SQLITE_INTEGER; - pMem++; - - pMem->flags = MEM_Int; - pMem->u.i = pOp->p3; /* P3 */ - pMem->type = SQLITE_INTEGER; - pMem++; - - if( sqlite3VdbeMemGrow(pMem, 32, 0) ){ /* P4 */ - assert( p->db->mallocFailed ); - return SQLITE_ERROR; - } - pMem->flags = MEM_Dyn|MEM_Str|MEM_Term; - zP4 = displayP4(pOp, pMem->z, 32); - if( zP4!=pMem->z ){ - sqlite3VdbeMemSetStr(pMem, zP4, -1, SQLITE_UTF8, 0); - }else{ - assert( pMem->z!=0 ); - pMem->n = sqlite3Strlen30(pMem->z); - pMem->enc = SQLITE_UTF8; - } - pMem->type = SQLITE_TEXT; - pMem++; - - if( p->explain==1 ){ - if( sqlite3VdbeMemGrow(pMem, 4, 0) ){ - assert( p->db->mallocFailed ); - return SQLITE_ERROR; - } - pMem->flags = MEM_Dyn|MEM_Str|MEM_Term; - pMem->n = 2; - sqlite3_snprintf(3, pMem->z, "%.2x", pOp->p5); /* P5 */ - pMem->type = SQLITE_TEXT; - pMem->enc = SQLITE_UTF8; - pMem++; - -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS - if( sqlite3VdbeMemGrow(pMem, 500, 0) ){ - assert( p->db->mallocFailed ); - return SQLITE_ERROR; - } - pMem->flags = MEM_Dyn|MEM_Str|MEM_Term; - pMem->n = displayComment(pOp, zP4, pMem->z, 500); - pMem->type = SQLITE_TEXT; - pMem->enc = SQLITE_UTF8; -#else - pMem->flags = MEM_Null; /* Comment */ - pMem->type = SQLITE_NULL; -#endif - } - - p->nResColumn = 8 - 4*(p->explain-1); - p->pResultSet = &p->aMem[1]; - p->rc = SQLITE_OK; - rc = SQLITE_ROW; - } - return rc; -} -#endif /* SQLITE_OMIT_EXPLAIN */ - -#ifdef SQLITE_DEBUG -/* -** Print the SQL that was used to generate a VDBE program. -*/ -SQLITE_PRIVATE void sqlite3VdbePrintSql(Vdbe *p){ - const char *z = 0; - if( p->zSql ){ - z = p->zSql; - }else if( p->nOp>=1 ){ - const VdbeOp *pOp = &p->aOp[0]; - if( pOp->opcode==OP_Trace && pOp->p4.z!=0 ){ - z = pOp->p4.z; - while( sqlite3Isspace(*z) ) z++; - } - } - if( z ) printf("SQL: [%s]\n", z); -} -#endif - -#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE) -/* -** Print an IOTRACE message showing SQL content. -*/ -SQLITE_PRIVATE void sqlite3VdbeIOTraceSql(Vdbe *p){ - int nOp = p->nOp; - VdbeOp *pOp; - if( sqlite3IoTrace==0 ) return; - if( nOp<1 ) return; - pOp = &p->aOp[0]; - if( pOp->opcode==OP_Trace && pOp->p4.z!=0 ){ - int i, j; - char z[1000]; - sqlite3_snprintf(sizeof(z), z, "%s", pOp->p4.z); - for(i=0; sqlite3Isspace(z[i]); i++){} - for(j=0; z[i]; i++){ - if( sqlite3Isspace(z[i]) ){ - if( z[i-1]!=' ' ){ - z[j++] = ' '; - } - }else{ - z[j++] = z[i]; - } - } - z[j] = 0; - sqlite3IoTrace("SQL %s\n", z); - } -} -#endif /* !SQLITE_OMIT_TRACE && SQLITE_ENABLE_IOTRACE */ - -/* -** Allocate space from a fixed size buffer and return a pointer to -** that space. If insufficient space is available, return NULL. -** -** The pBuf parameter is the initial value of a pointer which will -** receive the new memory. pBuf is normally NULL. If pBuf is not -** NULL, it means that memory space has already been allocated and that -** this routine should not allocate any new memory. When pBuf is not -** NULL simply return pBuf. Only allocate new memory space when pBuf -** is NULL. -** -** nByte is the number of bytes of space needed. -** -** *ppFrom points to available space and pEnd points to the end of the -** available space. When space is allocated, *ppFrom is advanced past -** the end of the allocated space. -** -** *pnByte is a counter of the number of bytes of space that have failed -** to allocate. If there is insufficient space in *ppFrom to satisfy the -** request, then increment *pnByte by the amount of the request. -*/ -static void *allocSpace( - void *pBuf, /* Where return pointer will be stored */ - int nByte, /* Number of bytes to allocate */ - u8 **ppFrom, /* IN/OUT: Allocate from *ppFrom */ - u8 *pEnd, /* Pointer to 1 byte past the end of *ppFrom buffer */ - int *pnByte /* If allocation cannot be made, increment *pnByte */ -){ - assert( EIGHT_BYTE_ALIGNMENT(*ppFrom) ); - if( pBuf ) return pBuf; - nByte = ROUND8(nByte); - if( &(*ppFrom)[nByte] <= pEnd ){ - pBuf = (void*)*ppFrom; - *ppFrom += nByte; - }else{ - *pnByte += nByte; - } - return pBuf; -} - -/* -** Rewind the VDBE back to the beginning in preparation for -** running it. -*/ -SQLITE_PRIVATE void sqlite3VdbeRewind(Vdbe *p){ -#if defined(SQLITE_DEBUG) || defined(VDBE_PROFILE) - int i; -#endif - assert( p!=0 ); - assert( p->magic==VDBE_MAGIC_INIT ); - - /* There should be at least one opcode. - */ - assert( p->nOp>0 ); - - /* Set the magic to VDBE_MAGIC_RUN sooner rather than later. */ - p->magic = VDBE_MAGIC_RUN; - -#ifdef SQLITE_DEBUG - for(i=1; inMem; i++){ - assert( p->aMem[i].db==p->db ); - } -#endif - p->pc = -1; - p->rc = SQLITE_OK; - p->errorAction = OE_Abort; - p->magic = VDBE_MAGIC_RUN; - p->nChange = 0; - p->cacheCtr = 1; - p->minWriteFileFormat = 255; - p->iStatement = 0; - p->nFkConstraint = 0; -#ifdef VDBE_PROFILE - for(i=0; inOp; i++){ - p->aOp[i].cnt = 0; - p->aOp[i].cycles = 0; - } -#endif -} - -/* -** Prepare a virtual machine for execution for the first time after -** creating the virtual machine. This involves things such -** as allocating stack space and initializing the program counter. -** After the VDBE has be prepped, it can be executed by one or more -** calls to sqlite3VdbeExec(). -** -** This function may be called exact once on a each virtual machine. -** After this routine is called the VM has been "packaged" and is ready -** to run. After this routine is called, futher calls to -** sqlite3VdbeAddOp() functions are prohibited. This routine disconnects -** the Vdbe from the Parse object that helped generate it so that the -** the Vdbe becomes an independent entity and the Parse object can be -** destroyed. -** -** Use the sqlite3VdbeRewind() procedure to restore a virtual machine back -** to its initial state after it has been run. -*/ -SQLITE_PRIVATE void sqlite3VdbeMakeReady( - Vdbe *p, /* The VDBE */ - Parse *pParse /* Parsing context */ -){ - sqlite3 *db; /* The database connection */ - int nVar; /* Number of parameters */ - int nMem; /* Number of VM memory registers */ - int nCursor; /* Number of cursors required */ - int nArg; /* Number of arguments in subprograms */ - int nOnce; /* Number of OP_Once instructions */ - int n; /* Loop counter */ - u8 *zCsr; /* Memory available for allocation */ - u8 *zEnd; /* First byte past allocated memory */ - int nByte; /* How much extra memory is needed */ - - assert( p!=0 ); - assert( p->nOp>0 ); - assert( pParse!=0 ); - assert( p->magic==VDBE_MAGIC_INIT ); - assert( pParse==p->pParse ); - db = p->db; - assert( db->mallocFailed==0 ); - nVar = pParse->nVar; - nMem = pParse->nMem; - nCursor = pParse->nTab; - nArg = pParse->nMaxArg; - nOnce = pParse->nOnce; - if( nOnce==0 ) nOnce = 1; /* Ensure at least one byte in p->aOnceFlag[] */ - - /* For each cursor required, also allocate a memory cell. Memory - ** cells (nMem+1-nCursor)..nMem, inclusive, will never be used by - ** the vdbe program. Instead they are used to allocate space for - ** VdbeCursor/BtCursor structures. The blob of memory associated with - ** cursor 0 is stored in memory cell nMem. Memory cell (nMem-1) - ** stores the blob of memory associated with cursor 1, etc. - ** - ** See also: allocateCursor(). - */ - nMem += nCursor; - - /* Allocate space for memory registers, SQL variables, VDBE cursors and - ** an array to marshal SQL function arguments in. - */ - zCsr = (u8*)&p->aOp[p->nOp]; /* Memory avaliable for allocation */ - zEnd = (u8*)&p->aOp[pParse->nOpAlloc]; /* First byte past end of zCsr[] */ - - resolveP2Values(p, &nArg); - p->usesStmtJournal = (u8)(pParse->isMultiWrite && pParse->mayAbort); - if( pParse->explain && nMem<10 ){ - nMem = 10; - } - memset(zCsr, 0, zEnd-zCsr); - zCsr += (zCsr - (u8*)0)&7; - assert( EIGHT_BYTE_ALIGNMENT(zCsr) ); - p->expired = 0; - - /* Memory for registers, parameters, cursor, etc, is allocated in two - ** passes. On the first pass, we try to reuse unused space at the - ** end of the opcode array. If we are unable to satisfy all memory - ** requirements by reusing the opcode array tail, then the second - ** pass will fill in the rest using a fresh allocation. - ** - ** This two-pass approach that reuses as much memory as possible from - ** the leftover space at the end of the opcode array can significantly - ** reduce the amount of memory held by a prepared statement. - */ - do { - nByte = 0; - p->aMem = allocSpace(p->aMem, nMem*sizeof(Mem), &zCsr, zEnd, &nByte); - p->aVar = allocSpace(p->aVar, nVar*sizeof(Mem), &zCsr, zEnd, &nByte); - p->apArg = allocSpace(p->apArg, nArg*sizeof(Mem*), &zCsr, zEnd, &nByte); - p->azVar = allocSpace(p->azVar, nVar*sizeof(char*), &zCsr, zEnd, &nByte); - p->apCsr = allocSpace(p->apCsr, nCursor*sizeof(VdbeCursor*), - &zCsr, zEnd, &nByte); - p->aOnceFlag = allocSpace(p->aOnceFlag, nOnce, &zCsr, zEnd, &nByte); - if( nByte ){ - p->pFree = sqlite3DbMallocZero(db, nByte); - } - zCsr = p->pFree; - zEnd = &zCsr[nByte]; - }while( nByte && !db->mallocFailed ); - - p->nCursor = nCursor; - p->nOnceFlag = nOnce; - if( p->aVar ){ - p->nVar = (ynVar)nVar; - for(n=0; naVar[n].flags = MEM_Null; - p->aVar[n].db = db; - } - } - if( p->azVar ){ - p->nzVar = pParse->nzVar; - memcpy(p->azVar, pParse->azVar, p->nzVar*sizeof(p->azVar[0])); - memset(pParse->azVar, 0, pParse->nzVar*sizeof(pParse->azVar[0])); - } - if( p->aMem ){ - p->aMem--; /* aMem[] goes from 1..nMem */ - p->nMem = nMem; /* not from 0..nMem-1 */ - for(n=1; n<=nMem; n++){ - p->aMem[n].flags = MEM_Invalid; - p->aMem[n].db = db; - } - } - p->explain = pParse->explain; - sqlite3VdbeRewind(p); -} - -/* -** Close a VDBE cursor and release all the resources that cursor -** happens to hold. -*/ -SQLITE_PRIVATE void sqlite3VdbeFreeCursor(Vdbe *p, VdbeCursor *pCx){ - if( pCx==0 ){ - return; - } - sqlite3VdbeSorterClose(p->db, pCx); - if( pCx->pBt ){ - sqlite3BtreeClose(pCx->pBt); - /* The pCx->pCursor will be close automatically, if it exists, by - ** the call above. */ - }else if( pCx->pCursor ){ - sqlite3BtreeCloseCursor(pCx->pCursor); - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( pCx->pVtabCursor ){ - sqlite3_vtab_cursor *pVtabCursor = pCx->pVtabCursor; - const sqlite3_module *pModule = pVtabCursor->pVtab->pModule; - p->inVtabMethod = 1; - pModule->xClose(pVtabCursor); - p->inVtabMethod = 0; - } -#endif -} - -/* -** Copy the values stored in the VdbeFrame structure to its Vdbe. This -** is used, for example, when a trigger sub-program is halted to restore -** control to the main program. -*/ -SQLITE_PRIVATE int sqlite3VdbeFrameRestore(VdbeFrame *pFrame){ - Vdbe *v = pFrame->v; - v->aOnceFlag = pFrame->aOnceFlag; - v->nOnceFlag = pFrame->nOnceFlag; - v->aOp = pFrame->aOp; - v->nOp = pFrame->nOp; - v->aMem = pFrame->aMem; - v->nMem = pFrame->nMem; - v->apCsr = pFrame->apCsr; - v->nCursor = pFrame->nCursor; - v->db->lastRowid = pFrame->lastRowid; - v->nChange = pFrame->nChange; - return pFrame->pc; -} - -/* -** Close all cursors. -** -** Also release any dynamic memory held by the VM in the Vdbe.aMem memory -** cell array. This is necessary as the memory cell array may contain -** pointers to VdbeFrame objects, which may in turn contain pointers to -** open cursors. -*/ -static void closeAllCursors(Vdbe *p){ - if( p->pFrame ){ - VdbeFrame *pFrame; - for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent); - sqlite3VdbeFrameRestore(pFrame); - } - p->pFrame = 0; - p->nFrame = 0; - - if( p->apCsr ){ - int i; - for(i=0; inCursor; i++){ - VdbeCursor *pC = p->apCsr[i]; - if( pC ){ - sqlite3VdbeFreeCursor(p, pC); - p->apCsr[i] = 0; - } - } - } - if( p->aMem ){ - releaseMemArray(&p->aMem[1], p->nMem); - } - while( p->pDelFrame ){ - VdbeFrame *pDel = p->pDelFrame; - p->pDelFrame = pDel->pParent; - sqlite3VdbeFrameDelete(pDel); - } - - /* Delete any auxdata allocations made by the VM */ - sqlite3VdbeDeleteAuxData(p, -1, 0); - assert( p->pAuxData==0 ); -} - -/* -** Clean up the VM after execution. -** -** This routine will automatically close any cursors, lists, and/or -** sorters that were left open. It also deletes the values of -** variables in the aVar[] array. -*/ -static void Cleanup(Vdbe *p){ - sqlite3 *db = p->db; - -#ifdef SQLITE_DEBUG - /* Execute assert() statements to ensure that the Vdbe.apCsr[] and - ** Vdbe.aMem[] arrays have already been cleaned up. */ - int i; - if( p->apCsr ) for(i=0; inCursor; i++) assert( p->apCsr[i]==0 ); - if( p->aMem ){ - for(i=1; i<=p->nMem; i++) assert( p->aMem[i].flags==MEM_Invalid ); - } -#endif - - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = 0; - p->pResultSet = 0; -} - -/* -** Set the number of result columns that will be returned by this SQL -** statement. This is now set at compile time, rather than during -** execution of the vdbe program so that sqlite3_column_count() can -** be called on an SQL statement before sqlite3_step(). -*/ -SQLITE_PRIVATE void sqlite3VdbeSetNumCols(Vdbe *p, int nResColumn){ - Mem *pColName; - int n; - sqlite3 *db = p->db; - - releaseMemArray(p->aColName, p->nResColumn*COLNAME_N); - sqlite3DbFree(db, p->aColName); - n = nResColumn*COLNAME_N; - p->nResColumn = (u16)nResColumn; - p->aColName = pColName = (Mem*)sqlite3DbMallocZero(db, sizeof(Mem)*n ); - if( p->aColName==0 ) return; - while( n-- > 0 ){ - pColName->flags = MEM_Null; - pColName->db = p->db; - pColName++; - } -} - -/* -** Set the name of the idx'th column to be returned by the SQL statement. -** zName must be a pointer to a nul terminated string. -** -** This call must be made after a call to sqlite3VdbeSetNumCols(). -** -** The final parameter, xDel, must be one of SQLITE_DYNAMIC, SQLITE_STATIC -** or SQLITE_TRANSIENT. If it is SQLITE_DYNAMIC, then the buffer pointed -** to by zName will be freed by sqlite3DbFree() when the vdbe is destroyed. -*/ -SQLITE_PRIVATE int sqlite3VdbeSetColName( - Vdbe *p, /* Vdbe being configured */ - int idx, /* Index of column zName applies to */ - int var, /* One of the COLNAME_* constants */ - const char *zName, /* Pointer to buffer containing name */ - void (*xDel)(void*) /* Memory management strategy for zName */ -){ - int rc; - Mem *pColName; - assert( idxnResColumn ); - assert( vardb->mallocFailed ){ - assert( !zName || xDel!=SQLITE_DYNAMIC ); - return SQLITE_NOMEM; - } - assert( p->aColName!=0 ); - pColName = &(p->aColName[idx+var*p->nResColumn]); - rc = sqlite3VdbeMemSetStr(pColName, zName, -1, SQLITE_UTF8, xDel); - assert( rc!=0 || !zName || (pColName->flags&MEM_Term)!=0 ); - return rc; -} - -/* -** A read or write transaction may or may not be active on database handle -** db. If a transaction is active, commit it. If there is a -** write-transaction spanning more than one database file, this routine -** takes care of the master journal trickery. -*/ -static int vdbeCommit(sqlite3 *db, Vdbe *p){ - int i; - int nTrans = 0; /* Number of databases with an active write-transaction */ - int rc = SQLITE_OK; - int needXcommit = 0; - -#ifdef SQLITE_OMIT_VIRTUALTABLE - /* With this option, sqlite3VtabSync() is defined to be simply - ** SQLITE_OK so p is not used. - */ - UNUSED_PARAMETER(p); -#endif - - /* Before doing anything else, call the xSync() callback for any - ** virtual module tables written in this transaction. This has to - ** be done before determining whether a master journal file is - ** required, as an xSync() callback may add an attached database - ** to the transaction. - */ - rc = sqlite3VtabSync(db, p); - - /* This loop determines (a) if the commit hook should be invoked and - ** (b) how many database files have open write transactions, not - ** including the temp database. (b) is important because if more than - ** one database file has an open write transaction, a master journal - ** file is required for an atomic commit. - */ - for(i=0; rc==SQLITE_OK && inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( sqlite3BtreeIsInTrans(pBt) ){ - needXcommit = 1; - if( i!=1 ) nTrans++; - sqlite3BtreeEnter(pBt); - rc = sqlite3PagerExclusiveLock(sqlite3BtreePager(pBt)); - sqlite3BtreeLeave(pBt); - } - } - if( rc!=SQLITE_OK ){ - return rc; - } - - /* If there are any write-transactions at all, invoke the commit hook */ - if( needXcommit && db->xCommitCallback ){ - rc = db->xCommitCallback(db->pCommitArg); - if( rc ){ - return SQLITE_CONSTRAINT_COMMITHOOK; - } - } - - /* The simple case - no more than one database file (not counting the - ** TEMP database) has a transaction active. There is no need for the - ** master-journal. - ** - ** If the return value of sqlite3BtreeGetFilename() is a zero length - ** string, it means the main database is :memory: or a temp file. In - ** that case we do not support atomic multi-file commits, so use the - ** simple case then too. - */ - if( 0==sqlite3Strlen30(sqlite3BtreeGetFilename(db->aDb[0].pBt)) - || nTrans<=1 - ){ - for(i=0; rc==SQLITE_OK && inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - rc = sqlite3BtreeCommitPhaseOne(pBt, 0); - } - } - - /* Do the commit only if all databases successfully complete phase 1. - ** If one of the BtreeCommitPhaseOne() calls fails, this indicates an - ** IO error while deleting or truncating a journal file. It is unlikely, - ** but could happen. In this case abandon processing and return the error. - */ - for(i=0; rc==SQLITE_OK && inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - rc = sqlite3BtreeCommitPhaseTwo(pBt, 0); - } - } - if( rc==SQLITE_OK ){ - sqlite3VtabCommit(db); - } - } - - /* The complex case - There is a multi-file write-transaction active. - ** This requires a master journal file to ensure the transaction is - ** committed atomicly. - */ -#ifndef SQLITE_OMIT_DISKIO - else{ - sqlite3_vfs *pVfs = db->pVfs; - int needSync = 0; - char *zMaster = 0; /* File-name for the master journal */ - char const *zMainFile = sqlite3BtreeGetFilename(db->aDb[0].pBt); - sqlite3_file *pMaster = 0; - i64 offset = 0; - int res; - int retryCount = 0; - int nMainFile; - - /* Select a master journal file name */ - nMainFile = sqlite3Strlen30(zMainFile); - zMaster = sqlite3MPrintf(db, "%s-mjXXXXXX9XXz", zMainFile); - if( zMaster==0 ) return SQLITE_NOMEM; - do { - u32 iRandom; - if( retryCount ){ - if( retryCount>100 ){ - sqlite3_log(SQLITE_FULL, "MJ delete: %s", zMaster); - sqlite3OsDelete(pVfs, zMaster, 0); - break; - }else if( retryCount==1 ){ - sqlite3_log(SQLITE_FULL, "MJ collide: %s", zMaster); - } - } - retryCount++; - sqlite3_randomness(sizeof(iRandom), &iRandom); - sqlite3_snprintf(13, &zMaster[nMainFile], "-mj%06X9%02X", - (iRandom>>8)&0xffffff, iRandom&0xff); - /* The antipenultimate character of the master journal name must - ** be "9" to avoid name collisions when using 8+3 filenames. */ - assert( zMaster[sqlite3Strlen30(zMaster)-3]=='9' ); - sqlite3FileSuffix3(zMainFile, zMaster); - rc = sqlite3OsAccess(pVfs, zMaster, SQLITE_ACCESS_EXISTS, &res); - }while( rc==SQLITE_OK && res ); - if( rc==SQLITE_OK ){ - /* Open the master journal. */ - rc = sqlite3OsOpenMalloc(pVfs, zMaster, &pMaster, - SQLITE_OPEN_READWRITE|SQLITE_OPEN_CREATE| - SQLITE_OPEN_EXCLUSIVE|SQLITE_OPEN_MASTER_JOURNAL, 0 - ); - } - if( rc!=SQLITE_OK ){ - sqlite3DbFree(db, zMaster); - return rc; - } - - /* Write the name of each database file in the transaction into the new - ** master journal file. If an error occurs at this point close - ** and delete the master journal file. All the individual journal files - ** still have 'null' as the master journal pointer, so they will roll - ** back independently if a failure occurs. - */ - for(i=0; inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( sqlite3BtreeIsInTrans(pBt) ){ - char const *zFile = sqlite3BtreeGetJournalname(pBt); - if( zFile==0 ){ - continue; /* Ignore TEMP and :memory: databases */ - } - assert( zFile[0]!=0 ); - if( !needSync && !sqlite3BtreeSyncDisabled(pBt) ){ - needSync = 1; - } - rc = sqlite3OsWrite(pMaster, zFile, sqlite3Strlen30(zFile)+1, offset); - offset += sqlite3Strlen30(zFile)+1; - if( rc!=SQLITE_OK ){ - sqlite3OsCloseFree(pMaster); - sqlite3OsDelete(pVfs, zMaster, 0); - sqlite3DbFree(db, zMaster); - return rc; - } - } - } - - /* Sync the master journal file. If the IOCAP_SEQUENTIAL device - ** flag is set this is not required. - */ - if( needSync - && 0==(sqlite3OsDeviceCharacteristics(pMaster)&SQLITE_IOCAP_SEQUENTIAL) - && SQLITE_OK!=(rc = sqlite3OsSync(pMaster, SQLITE_SYNC_NORMAL)) - ){ - sqlite3OsCloseFree(pMaster); - sqlite3OsDelete(pVfs, zMaster, 0); - sqlite3DbFree(db, zMaster); - return rc; - } - - /* Sync all the db files involved in the transaction. The same call - ** sets the master journal pointer in each individual journal. If - ** an error occurs here, do not delete the master journal file. - ** - ** If the error occurs during the first call to - ** sqlite3BtreeCommitPhaseOne(), then there is a chance that the - ** master journal file will be orphaned. But we cannot delete it, - ** in case the master journal file name was written into the journal - ** file before the failure occurred. - */ - for(i=0; rc==SQLITE_OK && inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - rc = sqlite3BtreeCommitPhaseOne(pBt, zMaster); - } - } - sqlite3OsCloseFree(pMaster); - assert( rc!=SQLITE_BUSY ); - if( rc!=SQLITE_OK ){ - sqlite3DbFree(db, zMaster); - return rc; - } - - /* Delete the master journal file. This commits the transaction. After - ** doing this the directory is synced again before any individual - ** transaction files are deleted. - */ - rc = sqlite3OsDelete(pVfs, zMaster, 1); - sqlite3DbFree(db, zMaster); - zMaster = 0; - if( rc ){ - return rc; - } - - /* All files and directories have already been synced, so the following - ** calls to sqlite3BtreeCommitPhaseTwo() are only closing files and - ** deleting or truncating journals. If something goes wrong while - ** this is happening we don't really care. The integrity of the - ** transaction is already guaranteed, but some stray 'cold' journals - ** may be lying around. Returning an error code won't help matters. - */ - disable_simulated_io_errors(); - sqlite3BeginBenignMalloc(); - for(i=0; inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - sqlite3BtreeCommitPhaseTwo(pBt, 1); - } - } - sqlite3EndBenignMalloc(); - enable_simulated_io_errors(); - - sqlite3VtabCommit(db); - } -#endif - - return rc; -} - -/* -** This routine checks that the sqlite3.nVdbeActive count variable -** matches the number of vdbe's in the list sqlite3.pVdbe that are -** currently active. An assertion fails if the two counts do not match. -** This is an internal self-check only - it is not an essential processing -** step. -** -** This is a no-op if NDEBUG is defined. -*/ -#ifndef NDEBUG -static void checkActiveVdbeCnt(sqlite3 *db){ - Vdbe *p; - int cnt = 0; - int nWrite = 0; - int nRead = 0; - p = db->pVdbe; - while( p ){ - if( p->magic==VDBE_MAGIC_RUN && p->pc>=0 ){ - cnt++; - if( p->readOnly==0 ) nWrite++; - if( p->bIsReader ) nRead++; - } - p = p->pNext; - } - assert( cnt==db->nVdbeActive ); - assert( nWrite==db->nVdbeWrite ); - assert( nRead==db->nVdbeRead ); -} -#else -#define checkActiveVdbeCnt(x) -#endif - -/* -** If the Vdbe passed as the first argument opened a statement-transaction, -** close it now. Argument eOp must be either SAVEPOINT_ROLLBACK or -** SAVEPOINT_RELEASE. If it is SAVEPOINT_ROLLBACK, then the statement -** transaction is rolled back. If eOp is SAVEPOINT_RELEASE, then the -** statement transaction is committed. -** -** If an IO error occurs, an SQLITE_IOERR_XXX error code is returned. -** Otherwise SQLITE_OK. -*/ -SQLITE_PRIVATE int sqlite3VdbeCloseStatement(Vdbe *p, int eOp){ - sqlite3 *const db = p->db; - int rc = SQLITE_OK; - - /* If p->iStatement is greater than zero, then this Vdbe opened a - ** statement transaction that should be closed here. The only exception - ** is that an IO error may have occurred, causing an emergency rollback. - ** In this case (db->nStatement==0), and there is nothing to do. - */ - if( db->nStatement && p->iStatement ){ - int i; - const int iSavepoint = p->iStatement-1; - - assert( eOp==SAVEPOINT_ROLLBACK || eOp==SAVEPOINT_RELEASE); - assert( db->nStatement>0 ); - assert( p->iStatement==(db->nStatement+db->nSavepoint) ); - - for(i=0; inDb; i++){ - int rc2 = SQLITE_OK; - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - if( eOp==SAVEPOINT_ROLLBACK ){ - rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_ROLLBACK, iSavepoint); - } - if( rc2==SQLITE_OK ){ - rc2 = sqlite3BtreeSavepoint(pBt, SAVEPOINT_RELEASE, iSavepoint); - } - if( rc==SQLITE_OK ){ - rc = rc2; - } - } - } - db->nStatement--; - p->iStatement = 0; - - if( rc==SQLITE_OK ){ - if( eOp==SAVEPOINT_ROLLBACK ){ - rc = sqlite3VtabSavepoint(db, SAVEPOINT_ROLLBACK, iSavepoint); - } - if( rc==SQLITE_OK ){ - rc = sqlite3VtabSavepoint(db, SAVEPOINT_RELEASE, iSavepoint); - } - } - - /* If the statement transaction is being rolled back, also restore the - ** database handles deferred constraint counter to the value it had when - ** the statement transaction was opened. */ - if( eOp==SAVEPOINT_ROLLBACK ){ - db->nDeferredCons = p->nStmtDefCons; - db->nDeferredImmCons = p->nStmtDefImmCons; - } - } - return rc; -} - -/* -** This function is called when a transaction opened by the database -** handle associated with the VM passed as an argument is about to be -** committed. If there are outstanding deferred foreign key constraint -** violations, return SQLITE_ERROR. Otherwise, SQLITE_OK. -** -** If there are outstanding FK violations and this function returns -** SQLITE_ERROR, set the result of the VM to SQLITE_CONSTRAINT_FOREIGNKEY -** and write an error message to it. Then return SQLITE_ERROR. -*/ -#ifndef SQLITE_OMIT_FOREIGN_KEY -SQLITE_PRIVATE int sqlite3VdbeCheckFk(Vdbe *p, int deferred){ - sqlite3 *db = p->db; - if( (deferred && (db->nDeferredCons+db->nDeferredImmCons)>0) - || (!deferred && p->nFkConstraint>0) - ){ - p->rc = SQLITE_CONSTRAINT_FOREIGNKEY; - p->errorAction = OE_Abort; - sqlite3SetString(&p->zErrMsg, db, "FOREIGN KEY constraint failed"); - return SQLITE_ERROR; - } - return SQLITE_OK; -} -#endif - -/* -** This routine is called the when a VDBE tries to halt. If the VDBE -** has made changes and is in autocommit mode, then commit those -** changes. If a rollback is needed, then do the rollback. -** -** This routine is the only way to move the state of a VM from -** SQLITE_MAGIC_RUN to SQLITE_MAGIC_HALT. It is harmless to -** call this on a VM that is in the SQLITE_MAGIC_HALT state. -** -** Return an error code. If the commit could not complete because of -** lock contention, return SQLITE_BUSY. If SQLITE_BUSY is returned, it -** means the close did not happen and needs to be repeated. -*/ -SQLITE_PRIVATE int sqlite3VdbeHalt(Vdbe *p){ - int rc; /* Used to store transient return codes */ - sqlite3 *db = p->db; - - /* This function contains the logic that determines if a statement or - ** transaction will be committed or rolled back as a result of the - ** execution of this virtual machine. - ** - ** If any of the following errors occur: - ** - ** SQLITE_NOMEM - ** SQLITE_IOERR - ** SQLITE_FULL - ** SQLITE_INTERRUPT - ** - ** Then the internal cache might have been left in an inconsistent - ** state. We need to rollback the statement transaction, if there is - ** one, or the complete transaction if there is no statement transaction. - */ - - if( p->db->mallocFailed ){ - p->rc = SQLITE_NOMEM; - } - if( p->aOnceFlag ) memset(p->aOnceFlag, 0, p->nOnceFlag); - closeAllCursors(p); - if( p->magic!=VDBE_MAGIC_RUN ){ - return SQLITE_OK; - } - checkActiveVdbeCnt(db); - - /* No commit or rollback needed if the program never started or if the - ** SQL statement does not read or write a database file. */ - if( p->pc>=0 && p->bIsReader ){ - int mrc; /* Primary error code from p->rc */ - int eStatementOp = 0; - int isSpecialError; /* Set to true if a 'special' error */ - - /* Lock all btrees used by the statement */ - sqlite3VdbeEnter(p); - - /* Check for one of the special errors */ - mrc = p->rc & 0xff; - assert( p->rc!=SQLITE_IOERR_BLOCKED ); /* This error no longer exists */ - isSpecialError = mrc==SQLITE_NOMEM || mrc==SQLITE_IOERR - || mrc==SQLITE_INTERRUPT || mrc==SQLITE_FULL; - if( isSpecialError ){ - /* If the query was read-only and the error code is SQLITE_INTERRUPT, - ** no rollback is necessary. Otherwise, at least a savepoint - ** transaction must be rolled back to restore the database to a - ** consistent state. - ** - ** Even if the statement is read-only, it is important to perform - ** a statement or transaction rollback operation. If the error - ** occurred while writing to the journal, sub-journal or database - ** file as part of an effort to free up cache space (see function - ** pagerStress() in pager.c), the rollback is required to restore - ** the pager to a consistent state. - */ - if( !p->readOnly || mrc!=SQLITE_INTERRUPT ){ - if( (mrc==SQLITE_NOMEM || mrc==SQLITE_FULL) && p->usesStmtJournal ){ - eStatementOp = SAVEPOINT_ROLLBACK; - }else{ - /* We are forced to roll back the active transaction. Before doing - ** so, abort any other statements this handle currently has active. - */ - sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); - sqlite3CloseSavepoints(db); - db->autoCommit = 1; - } - } - } - - /* Check for immediate foreign key violations. */ - if( p->rc==SQLITE_OK ){ - sqlite3VdbeCheckFk(p, 0); - } - - /* If the auto-commit flag is set and this is the only active writer - ** VM, then we do either a commit or rollback of the current transaction. - ** - ** Note: This block also runs if one of the special errors handled - ** above has occurred. - */ - if( !sqlite3VtabInSync(db) - && db->autoCommit - && db->nVdbeWrite==(p->readOnly==0) - ){ - if( p->rc==SQLITE_OK || (p->errorAction==OE_Fail && !isSpecialError) ){ - rc = sqlite3VdbeCheckFk(p, 1); - if( rc!=SQLITE_OK ){ - if( NEVER(p->readOnly) ){ - sqlite3VdbeLeave(p); - return SQLITE_ERROR; - } - rc = SQLITE_CONSTRAINT_FOREIGNKEY; - }else{ - /* The auto-commit flag is true, the vdbe program was successful - ** or hit an 'OR FAIL' constraint and there are no deferred foreign - ** key constraints to hold up the transaction. This means a commit - ** is required. */ - rc = vdbeCommit(db, p); - } - if( rc==SQLITE_BUSY && p->readOnly ){ - sqlite3VdbeLeave(p); - return SQLITE_BUSY; - }else if( rc!=SQLITE_OK ){ - p->rc = rc; - sqlite3RollbackAll(db, SQLITE_OK); - }else{ - db->nDeferredCons = 0; - db->nDeferredImmCons = 0; - db->flags &= ~SQLITE_DeferFKs; - sqlite3CommitInternalChanges(db); - } - }else{ - sqlite3RollbackAll(db, SQLITE_OK); - } - db->nStatement = 0; - }else if( eStatementOp==0 ){ - if( p->rc==SQLITE_OK || p->errorAction==OE_Fail ){ - eStatementOp = SAVEPOINT_RELEASE; - }else if( p->errorAction==OE_Abort ){ - eStatementOp = SAVEPOINT_ROLLBACK; - }else{ - sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); - sqlite3CloseSavepoints(db); - db->autoCommit = 1; - } - } - - /* If eStatementOp is non-zero, then a statement transaction needs to - ** be committed or rolled back. Call sqlite3VdbeCloseStatement() to - ** do so. If this operation returns an error, and the current statement - ** error code is SQLITE_OK or SQLITE_CONSTRAINT, then promote the - ** current statement error code. - */ - if( eStatementOp ){ - rc = sqlite3VdbeCloseStatement(p, eStatementOp); - if( rc ){ - if( p->rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ){ - p->rc = rc; - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = 0; - } - sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); - sqlite3CloseSavepoints(db); - db->autoCommit = 1; - } - } - - /* If this was an INSERT, UPDATE or DELETE and no statement transaction - ** has been rolled back, update the database connection change-counter. - */ - if( p->changeCntOn ){ - if( eStatementOp!=SAVEPOINT_ROLLBACK ){ - sqlite3VdbeSetChanges(db, p->nChange); - }else{ - sqlite3VdbeSetChanges(db, 0); - } - p->nChange = 0; - } - - /* Release the locks */ - sqlite3VdbeLeave(p); - } - - /* We have successfully halted and closed the VM. Record this fact. */ - if( p->pc>=0 ){ - db->nVdbeActive--; - if( !p->readOnly ) db->nVdbeWrite--; - if( p->bIsReader ) db->nVdbeRead--; - assert( db->nVdbeActive>=db->nVdbeRead ); - assert( db->nVdbeRead>=db->nVdbeWrite ); - assert( db->nVdbeWrite>=0 ); - } - p->magic = VDBE_MAGIC_HALT; - checkActiveVdbeCnt(db); - if( p->db->mallocFailed ){ - p->rc = SQLITE_NOMEM; - } - - /* If the auto-commit flag is set to true, then any locks that were held - ** by connection db have now been released. Call sqlite3ConnectionUnlocked() - ** to invoke any required unlock-notify callbacks. - */ - if( db->autoCommit ){ - sqlite3ConnectionUnlocked(db); - } - - assert( db->nVdbeActive>0 || db->autoCommit==0 || db->nStatement==0 ); - return (p->rc==SQLITE_BUSY ? SQLITE_BUSY : SQLITE_OK); -} - - -/* -** Each VDBE holds the result of the most recent sqlite3_step() call -** in p->rc. This routine sets that result back to SQLITE_OK. -*/ -SQLITE_PRIVATE void sqlite3VdbeResetStepResult(Vdbe *p){ - p->rc = SQLITE_OK; -} - -/* -** Copy the error code and error message belonging to the VDBE passed -** as the first argument to its database handle (so that they will be -** returned by calls to sqlite3_errcode() and sqlite3_errmsg()). -** -** This function does not clear the VDBE error code or message, just -** copies them to the database handle. -*/ -SQLITE_PRIVATE int sqlite3VdbeTransferError(Vdbe *p){ - sqlite3 *db = p->db; - int rc = p->rc; - if( p->zErrMsg ){ - u8 mallocFailed = db->mallocFailed; - sqlite3BeginBenignMalloc(); - if( db->pErr==0 ) db->pErr = sqlite3ValueNew(db); - sqlite3ValueSetStr(db->pErr, -1, p->zErrMsg, SQLITE_UTF8, SQLITE_TRANSIENT); - sqlite3EndBenignMalloc(); - db->mallocFailed = mallocFailed; - db->errCode = rc; - }else{ - sqlite3Error(db, rc, 0); - } - return rc; -} - -#ifdef SQLITE_ENABLE_SQLLOG -/* -** If an SQLITE_CONFIG_SQLLOG hook is registered and the VM has been run, -** invoke it. -*/ -static void vdbeInvokeSqllog(Vdbe *v){ - if( sqlite3GlobalConfig.xSqllog && v->rc==SQLITE_OK && v->zSql && v->pc>=0 ){ - char *zExpanded = sqlite3VdbeExpandSql(v, v->zSql); - assert( v->db->init.busy==0 ); - if( zExpanded ){ - sqlite3GlobalConfig.xSqllog( - sqlite3GlobalConfig.pSqllogArg, v->db, zExpanded, 1 - ); - sqlite3DbFree(v->db, zExpanded); - } - } -} -#else -# define vdbeInvokeSqllog(x) -#endif - -/* -** Clean up a VDBE after execution but do not delete the VDBE just yet. -** Write any error messages into *pzErrMsg. Return the result code. -** -** After this routine is run, the VDBE should be ready to be executed -** again. -** -** To look at it another way, this routine resets the state of the -** virtual machine from VDBE_MAGIC_RUN or VDBE_MAGIC_HALT back to -** VDBE_MAGIC_INIT. -*/ -SQLITE_PRIVATE int sqlite3VdbeReset(Vdbe *p){ - sqlite3 *db; - db = p->db; - - /* If the VM did not run to completion or if it encountered an - ** error, then it might not have been halted properly. So halt - ** it now. - */ - sqlite3VdbeHalt(p); - - /* If the VDBE has be run even partially, then transfer the error code - ** and error message from the VDBE into the main database structure. But - ** if the VDBE has just been set to run but has not actually executed any - ** instructions yet, leave the main database error information unchanged. - */ - if( p->pc>=0 ){ - vdbeInvokeSqllog(p); - sqlite3VdbeTransferError(p); - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = 0; - if( p->runOnlyOnce ) p->expired = 1; - }else if( p->rc && p->expired ){ - /* The expired flag was set on the VDBE before the first call - ** to sqlite3_step(). For consistency (since sqlite3_step() was - ** called), set the database error in this case as well. - */ - sqlite3Error(db, p->rc, p->zErrMsg ? "%s" : 0, p->zErrMsg); - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = 0; - } - - /* Reclaim all memory used by the VDBE - */ - Cleanup(p); - - /* Save profiling information from this VDBE run. - */ -#ifdef VDBE_PROFILE - { - FILE *out = fopen("vdbe_profile.out", "a"); - if( out ){ - int i; - fprintf(out, "---- "); - for(i=0; inOp; i++){ - fprintf(out, "%02x", p->aOp[i].opcode); - } - fprintf(out, "\n"); - for(i=0; inOp; i++){ - fprintf(out, "%6d %10lld %8lld ", - p->aOp[i].cnt, - p->aOp[i].cycles, - p->aOp[i].cnt>0 ? p->aOp[i].cycles/p->aOp[i].cnt : 0 - ); - sqlite3VdbePrintOp(out, i, &p->aOp[i]); - } - fclose(out); - } - } -#endif - p->iCurrentTime = 0; - p->magic = VDBE_MAGIC_INIT; - return p->rc & db->errMask; -} - -/* -** Clean up and delete a VDBE after execution. Return an integer which is -** the result code. Write any error message text into *pzErrMsg. -*/ -SQLITE_PRIVATE int sqlite3VdbeFinalize(Vdbe *p){ - int rc = SQLITE_OK; - if( p->magic==VDBE_MAGIC_RUN || p->magic==VDBE_MAGIC_HALT ){ - rc = sqlite3VdbeReset(p); - assert( (rc & p->db->errMask)==rc ); - } - sqlite3VdbeDelete(p); - return rc; -} - -/* -** If parameter iOp is less than zero, then invoke the destructor for -** all auxiliary data pointers currently cached by the VM passed as -** the first argument. -** -** Or, if iOp is greater than or equal to zero, then the destructor is -** only invoked for those auxiliary data pointers created by the user -** function invoked by the OP_Function opcode at instruction iOp of -** VM pVdbe, and only then if: -** -** * the associated function parameter is the 32nd or later (counting -** from left to right), or -** -** * the corresponding bit in argument mask is clear (where the first -** function parameter corrsponds to bit 0 etc.). -*/ -SQLITE_PRIVATE void sqlite3VdbeDeleteAuxData(Vdbe *pVdbe, int iOp, int mask){ - AuxData **pp = &pVdbe->pAuxData; - while( *pp ){ - AuxData *pAux = *pp; - if( (iOp<0) - || (pAux->iOp==iOp && (pAux->iArg>31 || !(mask & MASKBIT32(pAux->iArg)))) - ){ - testcase( pAux->iArg==31 ); - if( pAux->xDelete ){ - pAux->xDelete(pAux->pAux); - } - *pp = pAux->pNext; - sqlite3DbFree(pVdbe->db, pAux); - }else{ - pp= &pAux->pNext; - } - } -} - -/* -** Free all memory associated with the Vdbe passed as the second argument, -** except for object itself, which is preserved. -** -** The difference between this function and sqlite3VdbeDelete() is that -** VdbeDelete() also unlinks the Vdbe from the list of VMs associated with -** the database connection and frees the object itself. -*/ -SQLITE_PRIVATE void sqlite3VdbeClearObject(sqlite3 *db, Vdbe *p){ - SubProgram *pSub, *pNext; - int i; - assert( p->db==0 || p->db==db ); - releaseMemArray(p->aVar, p->nVar); - releaseMemArray(p->aColName, p->nResColumn*COLNAME_N); - for(pSub=p->pProgram; pSub; pSub=pNext){ - pNext = pSub->pNext; - vdbeFreeOpArray(db, pSub->aOp, pSub->nOp); - sqlite3DbFree(db, pSub); - } - for(i=p->nzVar-1; i>=0; i--) sqlite3DbFree(db, p->azVar[i]); - vdbeFreeOpArray(db, p->aOp, p->nOp); - sqlite3DbFree(db, p->aColName); - sqlite3DbFree(db, p->zSql); - sqlite3DbFree(db, p->pFree); -#if defined(SQLITE_ENABLE_TREE_EXPLAIN) - sqlite3DbFree(db, p->zExplain); - sqlite3DbFree(db, p->pExplain); -#endif -} - -/* -** Delete an entire VDBE. -*/ -SQLITE_PRIVATE void sqlite3VdbeDelete(Vdbe *p){ - sqlite3 *db; - - if( NEVER(p==0) ) return; - db = p->db; - assert( sqlite3_mutex_held(db->mutex) ); - sqlite3VdbeClearObject(db, p); - if( p->pPrev ){ - p->pPrev->pNext = p->pNext; - }else{ - assert( db->pVdbe==p ); - db->pVdbe = p->pNext; - } - if( p->pNext ){ - p->pNext->pPrev = p->pPrev; - } - p->magic = VDBE_MAGIC_DEAD; - p->db = 0; - sqlite3DbFree(db, p); -} - -/* -** Make sure the cursor p is ready to read or write the row to which it -** was last positioned. Return an error code if an OOM fault or I/O error -** prevents us from positioning the cursor to its correct position. -** -** If a MoveTo operation is pending on the given cursor, then do that -** MoveTo now. If no move is pending, check to see if the row has been -** deleted out from under the cursor and if it has, mark the row as -** a NULL row. -** -** If the cursor is already pointing to the correct row and that row has -** not been deleted out from under the cursor, then this routine is a no-op. -*/ -SQLITE_PRIVATE int sqlite3VdbeCursorMoveto(VdbeCursor *p){ - if( p->deferredMoveto ){ - int res, rc; -#ifdef SQLITE_TEST - extern int sqlite3_search_count; -#endif - assert( p->isTable ); - rc = sqlite3BtreeMovetoUnpacked(p->pCursor, 0, p->movetoTarget, 0, &res); - if( rc ) return rc; - p->lastRowid = p->movetoTarget; - if( res!=0 ) return SQLITE_CORRUPT_BKPT; - p->rowidIsValid = 1; -#ifdef SQLITE_TEST - sqlite3_search_count++; -#endif - p->deferredMoveto = 0; - p->cacheStatus = CACHE_STALE; - }else if( p->pCursor ){ - int hasMoved; - int rc = sqlite3BtreeCursorHasMoved(p->pCursor, &hasMoved); - if( rc ) return rc; - if( hasMoved ){ - p->cacheStatus = CACHE_STALE; - p->nullRow = 1; - } - } - return SQLITE_OK; -} - -/* -** The following functions: -** -** sqlite3VdbeSerialType() -** sqlite3VdbeSerialTypeLen() -** sqlite3VdbeSerialLen() -** sqlite3VdbeSerialPut() -** sqlite3VdbeSerialGet() -** -** encapsulate the code that serializes values for storage in SQLite -** data and index records. Each serialized value consists of a -** 'serial-type' and a blob of data. The serial type is an 8-byte unsigned -** integer, stored as a varint. -** -** In an SQLite index record, the serial type is stored directly before -** the blob of data that it corresponds to. In a table record, all serial -** types are stored at the start of the record, and the blobs of data at -** the end. Hence these functions allow the caller to handle the -** serial-type and data blob separately. -** -** The following table describes the various storage classes for data: -** -** serial type bytes of data type -** -------------- --------------- --------------- -** 0 0 NULL -** 1 1 signed integer -** 2 2 signed integer -** 3 3 signed integer -** 4 4 signed integer -** 5 6 signed integer -** 6 8 signed integer -** 7 8 IEEE float -** 8 0 Integer constant 0 -** 9 0 Integer constant 1 -** 10,11 reserved for expansion -** N>=12 and even (N-12)/2 BLOB -** N>=13 and odd (N-13)/2 text -** -** The 8 and 9 types were added in 3.3.0, file format 4. Prior versions -** of SQLite will not understand those serial types. -*/ - -/* -** Return the serial-type for the value stored in pMem. -*/ -SQLITE_PRIVATE u32 sqlite3VdbeSerialType(Mem *pMem, int file_format){ - int flags = pMem->flags; - int n; - - if( flags&MEM_Null ){ - return 0; - } - if( flags&MEM_Int ){ - /* Figure out whether to use 1, 2, 4, 6 or 8 bytes. */ -# define MAX_6BYTE ((((i64)0x00008000)<<32)-1) - i64 i = pMem->u.i; - u64 u; - if( i<0 ){ - if( i<(-MAX_6BYTE) ) return 6; - /* Previous test prevents: u = -(-9223372036854775808) */ - u = -i; - }else{ - u = i; - } - if( u<=127 ){ - return ((i&1)==i && file_format>=4) ? 8+(u32)u : 1; - } - if( u<=32767 ) return 2; - if( u<=8388607 ) return 3; - if( u<=2147483647 ) return 4; - if( u<=MAX_6BYTE ) return 5; - return 6; - } - if( flags&MEM_Real ){ - return 7; - } - assert( pMem->db->mallocFailed || flags&(MEM_Str|MEM_Blob) ); - n = pMem->n; - if( flags & MEM_Zero ){ - n += pMem->u.nZero; - } - assert( n>=0 ); - return ((n*2) + 12 + ((flags&MEM_Str)!=0)); -} - -/* -** Return the length of the data corresponding to the supplied serial-type. -*/ -SQLITE_PRIVATE u32 sqlite3VdbeSerialTypeLen(u32 serial_type){ - if( serial_type>=12 ){ - return (serial_type-12)/2; - }else{ - static const u8 aSize[] = { 0, 1, 2, 3, 4, 6, 8, 8, 0, 0, 0, 0 }; - return aSize[serial_type]; - } -} - -/* -** If we are on an architecture with mixed-endian floating -** points (ex: ARM7) then swap the lower 4 bytes with the -** upper 4 bytes. Return the result. -** -** For most architectures, this is a no-op. -** -** (later): It is reported to me that the mixed-endian problem -** on ARM7 is an issue with GCC, not with the ARM7 chip. It seems -** that early versions of GCC stored the two words of a 64-bit -** float in the wrong order. And that error has been propagated -** ever since. The blame is not necessarily with GCC, though. -** GCC might have just copying the problem from a prior compiler. -** I am also told that newer versions of GCC that follow a different -** ABI get the byte order right. -** -** Developers using SQLite on an ARM7 should compile and run their -** application using -DSQLITE_DEBUG=1 at least once. With DEBUG -** enabled, some asserts below will ensure that the byte order of -** floating point values is correct. -** -** (2007-08-30) Frank van Vugt has studied this problem closely -** and has send his findings to the SQLite developers. Frank -** writes that some Linux kernels offer floating point hardware -** emulation that uses only 32-bit mantissas instead of a full -** 48-bits as required by the IEEE standard. (This is the -** CONFIG_FPE_FASTFPE option.) On such systems, floating point -** byte swapping becomes very complicated. To avoid problems, -** the necessary byte swapping is carried out using a 64-bit integer -** rather than a 64-bit float. Frank assures us that the code here -** works for him. We, the developers, have no way to independently -** verify this, but Frank seems to know what he is talking about -** so we trust him. -*/ -#ifdef SQLITE_MIXED_ENDIAN_64BIT_FLOAT -static u64 floatSwap(u64 in){ - union { - u64 r; - u32 i[2]; - } u; - u32 t; - - u.r = in; - t = u.i[0]; - u.i[0] = u.i[1]; - u.i[1] = t; - return u.r; -} -# define swapMixedEndianFloat(X) X = floatSwap(X) -#else -# define swapMixedEndianFloat(X) -#endif - -/* -** Write the serialized data blob for the value stored in pMem into -** buf. It is assumed that the caller has allocated sufficient space. -** Return the number of bytes written. -** -** nBuf is the amount of space left in buf[]. The caller is responsible -** for allocating enough space to buf[] to hold the entire field, exclusive -** of the pMem->u.nZero bytes for a MEM_Zero value. -** -** Return the number of bytes actually written into buf[]. The number -** of bytes in the zero-filled tail is included in the return value only -** if those bytes were zeroed in buf[]. -*/ -SQLITE_PRIVATE u32 sqlite3VdbeSerialPut(u8 *buf, Mem *pMem, u32 serial_type){ - u32 len; - - /* Integer and Real */ - if( serial_type<=7 && serial_type>0 ){ - u64 v; - u32 i; - if( serial_type==7 ){ - assert( sizeof(v)==sizeof(pMem->r) ); - memcpy(&v, &pMem->r, sizeof(v)); - swapMixedEndianFloat(v); - }else{ - v = pMem->u.i; - } - len = i = sqlite3VdbeSerialTypeLen(serial_type); - while( i-- ){ - buf[i] = (u8)(v&0xFF); - v >>= 8; - } - return len; - } - - /* String or blob */ - if( serial_type>=12 ){ - assert( pMem->n + ((pMem->flags & MEM_Zero)?pMem->u.nZero:0) - == (int)sqlite3VdbeSerialTypeLen(serial_type) ); - len = pMem->n; - memcpy(buf, pMem->z, len); - return len; - } - - /* NULL or constants 0 or 1 */ - return 0; -} - -/* -** Deserialize the data blob pointed to by buf as serial type serial_type -** and store the result in pMem. Return the number of bytes read. -*/ -SQLITE_PRIVATE u32 sqlite3VdbeSerialGet( - const unsigned char *buf, /* Buffer to deserialize from */ - u32 serial_type, /* Serial type to deserialize */ - Mem *pMem /* Memory cell to write value into */ -){ - u64 x; - u32 y; - int i; - switch( serial_type ){ - case 10: /* Reserved for future use */ - case 11: /* Reserved for future use */ - case 0: { /* NULL */ - pMem->flags = MEM_Null; - break; - } - case 1: { /* 1-byte signed integer */ - pMem->u.i = (signed char)buf[0]; - pMem->flags = MEM_Int; - return 1; - } - case 2: { /* 2-byte signed integer */ - i = 256*(signed char)buf[0] | buf[1]; - pMem->u.i = (i64)i; - pMem->flags = MEM_Int; - return 2; - } - case 3: { /* 3-byte signed integer */ - i = 65536*(signed char)buf[0] | (buf[1]<<8) | buf[2]; - pMem->u.i = (i64)i; - pMem->flags = MEM_Int; - return 3; - } - case 4: { /* 4-byte signed integer */ - y = ((unsigned)buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3]; - pMem->u.i = (i64)*(int*)&y; - pMem->flags = MEM_Int; - return 4; - } - case 5: { /* 6-byte signed integer */ - x = 256*(signed char)buf[0] + buf[1]; - y = ((unsigned)buf[2]<<24) | (buf[3]<<16) | (buf[4]<<8) | buf[5]; - x = (x<<32) | y; - pMem->u.i = *(i64*)&x; - pMem->flags = MEM_Int; - return 6; - } - case 6: /* 8-byte signed integer */ - case 7: { /* IEEE floating point */ -#if !defined(NDEBUG) && !defined(SQLITE_OMIT_FLOATING_POINT) - /* Verify that integers and floating point values use the same - ** byte order. Or, that if SQLITE_MIXED_ENDIAN_64BIT_FLOAT is - ** defined that 64-bit floating point values really are mixed - ** endian. - */ - static const u64 t1 = ((u64)0x3ff00000)<<32; - static const double r1 = 1.0; - u64 t2 = t1; - swapMixedEndianFloat(t2); - assert( sizeof(r1)==sizeof(t2) && memcmp(&r1, &t2, sizeof(r1))==0 ); -#endif - x = ((unsigned)buf[0]<<24) | (buf[1]<<16) | (buf[2]<<8) | buf[3]; - y = ((unsigned)buf[4]<<24) | (buf[5]<<16) | (buf[6]<<8) | buf[7]; - x = (x<<32) | y; - if( serial_type==6 ){ - pMem->u.i = *(i64*)&x; - pMem->flags = MEM_Int; - }else{ - assert( sizeof(x)==8 && sizeof(pMem->r)==8 ); - swapMixedEndianFloat(x); - memcpy(&pMem->r, &x, sizeof(x)); - pMem->flags = sqlite3IsNaN(pMem->r) ? MEM_Null : MEM_Real; - } - return 8; - } - case 8: /* Integer 0 */ - case 9: { /* Integer 1 */ - pMem->u.i = serial_type-8; - pMem->flags = MEM_Int; - return 0; - } - default: { - static const u16 aFlag[] = { MEM_Blob|MEM_Ephem, MEM_Str|MEM_Ephem }; - u32 len = (serial_type-12)/2; - pMem->z = (char *)buf; - pMem->n = len; - pMem->xDel = 0; - pMem->flags = aFlag[serial_type&1]; - return len; - } - } - return 0; -} - -/* -** This routine is used to allocate sufficient space for an UnpackedRecord -** structure large enough to be used with sqlite3VdbeRecordUnpack() if -** the first argument is a pointer to KeyInfo structure pKeyInfo. -** -** The space is either allocated using sqlite3DbMallocRaw() or from within -** the unaligned buffer passed via the second and third arguments (presumably -** stack space). If the former, then *ppFree is set to a pointer that should -** be eventually freed by the caller using sqlite3DbFree(). Or, if the -** allocation comes from the pSpace/szSpace buffer, *ppFree is set to NULL -** before returning. -** -** If an OOM error occurs, NULL is returned. -*/ -SQLITE_PRIVATE UnpackedRecord *sqlite3VdbeAllocUnpackedRecord( - KeyInfo *pKeyInfo, /* Description of the record */ - char *pSpace, /* Unaligned space available */ - int szSpace, /* Size of pSpace[] in bytes */ - char **ppFree /* OUT: Caller should free this pointer */ -){ - UnpackedRecord *p; /* Unpacked record to return */ - int nOff; /* Increment pSpace by nOff to align it */ - int nByte; /* Number of bytes required for *p */ - - /* We want to shift the pointer pSpace up such that it is 8-byte aligned. - ** Thus, we need to calculate a value, nOff, between 0 and 7, to shift - ** it by. If pSpace is already 8-byte aligned, nOff should be zero. - */ - nOff = (8 - (SQLITE_PTR_TO_INT(pSpace) & 7)) & 7; - nByte = ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*(pKeyInfo->nField+1); - if( nByte>szSpace+nOff ){ - p = (UnpackedRecord *)sqlite3DbMallocRaw(pKeyInfo->db, nByte); - *ppFree = (char *)p; - if( !p ) return 0; - }else{ - p = (UnpackedRecord*)&pSpace[nOff]; - *ppFree = 0; - } - - p->aMem = (Mem*)&((char*)p)[ROUND8(sizeof(UnpackedRecord))]; - assert( pKeyInfo->aSortOrder!=0 ); - p->pKeyInfo = pKeyInfo; - p->nField = pKeyInfo->nField + 1; - return p; -} - -/* -** Given the nKey-byte encoding of a record in pKey[], populate the -** UnpackedRecord structure indicated by the fourth argument with the -** contents of the decoded record. -*/ -SQLITE_PRIVATE void sqlite3VdbeRecordUnpack( - KeyInfo *pKeyInfo, /* Information about the record format */ - int nKey, /* Size of the binary record */ - const void *pKey, /* The binary record */ - UnpackedRecord *p /* Populate this structure before returning. */ -){ - const unsigned char *aKey = (const unsigned char *)pKey; - int d; - u32 idx; /* Offset in aKey[] to read from */ - u16 u; /* Unsigned loop counter */ - u32 szHdr; - Mem *pMem = p->aMem; - - p->flags = 0; - assert( EIGHT_BYTE_ALIGNMENT(pMem) ); - idx = getVarint32(aKey, szHdr); - d = szHdr; - u = 0; - while( idxnField && d<=nKey ){ - u32 serial_type; - - idx += getVarint32(&aKey[idx], serial_type); - pMem->enc = pKeyInfo->enc; - pMem->db = pKeyInfo->db; - /* pMem->flags = 0; // sqlite3VdbeSerialGet() will set this for us */ - pMem->zMalloc = 0; - d += sqlite3VdbeSerialGet(&aKey[d], serial_type, pMem); - pMem++; - u++; - } - assert( u<=pKeyInfo->nField + 1 ); - p->nField = u; -} - -/* -** This function compares the two table rows or index records -** specified by {nKey1, pKey1} and pPKey2. It returns a negative, zero -** or positive integer if key1 is less than, equal to or -** greater than key2. The {nKey1, pKey1} key must be a blob -** created by th OP_MakeRecord opcode of the VDBE. The pPKey2 -** key must be a parsed key such as obtained from -** sqlite3VdbeParseRecord. -** -** Key1 and Key2 do not have to contain the same number of fields. -** The key with fewer fields is usually compares less than the -** longer key. However if the UNPACKED_INCRKEY flags in pPKey2 is set -** and the common prefixes are equal, then key1 is less than key2. -** Or if the UNPACKED_MATCH_PREFIX flag is set and the prefixes are -** equal, then the keys are considered to be equal and -** the parts beyond the common prefix are ignored. -*/ -SQLITE_PRIVATE int sqlite3VdbeRecordCompare( - int nKey1, const void *pKey1, /* Left key */ - UnpackedRecord *pPKey2 /* Right key */ -){ - u32 d1; /* Offset into aKey[] of next data element */ - u32 idx1; /* Offset into aKey[] of next header element */ - u32 szHdr1; /* Number of bytes in header */ - int i = 0; - int rc = 0; - const unsigned char *aKey1 = (const unsigned char *)pKey1; - KeyInfo *pKeyInfo; - Mem mem1; - - pKeyInfo = pPKey2->pKeyInfo; - mem1.enc = pKeyInfo->enc; - mem1.db = pKeyInfo->db; - /* mem1.flags = 0; // Will be initialized by sqlite3VdbeSerialGet() */ - VVA_ONLY( mem1.zMalloc = 0; ) /* Only needed by assert() statements */ - - /* Compilers may complain that mem1.u.i is potentially uninitialized. - ** We could initialize it, as shown here, to silence those complaints. - ** But in fact, mem1.u.i will never actually be used uninitialized, and doing - ** the unnecessary initialization has a measurable negative performance - ** impact, since this routine is a very high runner. And so, we choose - ** to ignore the compiler warnings and leave this variable uninitialized. - */ - /* mem1.u.i = 0; // not needed, here to silence compiler warning */ - - idx1 = getVarint32(aKey1, szHdr1); - d1 = szHdr1; - assert( pKeyInfo->nField+pKeyInfo->nXField>=pPKey2->nField || CORRUPT_DB ); - assert( pKeyInfo->aSortOrder!=0 ); - assert( pKeyInfo->nField>0 ); - assert( idx1<=szHdr1 || CORRUPT_DB ); - do{ - u32 serial_type1; - - /* Read the serial types for the next element in each key. */ - idx1 += getVarint32( aKey1+idx1, serial_type1 ); - - /* Verify that there is enough key space remaining to avoid - ** a buffer overread. The "d1+serial_type1+2" subexpression will - ** always be greater than or equal to the amount of required key space. - ** Use that approximation to avoid the more expensive call to - ** sqlite3VdbeSerialTypeLen() in the common case. - */ - if( d1+serial_type1+2>(u32)nKey1 - && d1+sqlite3VdbeSerialTypeLen(serial_type1)>(u32)nKey1 - ){ - break; - } - - /* Extract the values to be compared. - */ - d1 += sqlite3VdbeSerialGet(&aKey1[d1], serial_type1, &mem1); - - /* Do the comparison - */ - rc = sqlite3MemCompare(&mem1, &pPKey2->aMem[i], pKeyInfo->aColl[i]); - if( rc!=0 ){ - assert( mem1.zMalloc==0 ); /* See comment below */ - if( pKeyInfo->aSortOrder[i] ){ - rc = -rc; /* Invert the result for DESC sort order. */ - } - return rc; - } - i++; - }while( idx1nField ); - - /* No memory allocation is ever used on mem1. Prove this using - ** the following assert(). If the assert() fails, it indicates a - ** memory leak and a need to call sqlite3VdbeMemRelease(&mem1). - */ - assert( mem1.zMalloc==0 ); - - /* rc==0 here means that one of the keys ran out of fields and - ** all the fields up to that point were equal. If the UNPACKED_INCRKEY - ** flag is set, then break the tie by treating key2 as larger. - ** If the UPACKED_PREFIX_MATCH flag is set, then keys with common prefixes - ** are considered to be equal. Otherwise, the longer key is the - ** larger. As it happens, the pPKey2 will always be the longer - ** if there is a difference. - */ - assert( rc==0 ); - if( pPKey2->flags & UNPACKED_INCRKEY ){ - rc = -1; - }else if( pPKey2->flags & UNPACKED_PREFIX_MATCH ){ - /* Leave rc==0 */ - }else if( idx1m.n) ){ - goto idx_rowid_corruption; - } - - /* The last field of the index should be an integer - the ROWID. - ** Verify that the last entry really is an integer. */ - (void)getVarint32((u8*)&m.z[szHdr-1], typeRowid); - testcase( typeRowid==1 ); - testcase( typeRowid==2 ); - testcase( typeRowid==3 ); - testcase( typeRowid==4 ); - testcase( typeRowid==5 ); - testcase( typeRowid==6 ); - testcase( typeRowid==8 ); - testcase( typeRowid==9 ); - if( unlikely(typeRowid<1 || typeRowid>9 || typeRowid==7) ){ - goto idx_rowid_corruption; - } - lenRowid = sqlite3VdbeSerialTypeLen(typeRowid); - testcase( (u32)m.n==szHdr+lenRowid ); - if( unlikely((u32)m.npCursor; - Mem m; - - assert( sqlite3BtreeCursorIsValid(pCur) ); - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCur, &nCellKey); - assert( rc==SQLITE_OK ); /* pCur is always valid so KeySize cannot fail */ - /* nCellKey will always be between 0 and 0xffffffff because of the say - ** that btreeParseCellPtr() and sqlite3GetVarint32() are implemented */ - if( nCellKey<=0 || nCellKey>0x7fffffff ){ - *res = 0; - return SQLITE_CORRUPT_BKPT; - } - memset(&m, 0, sizeof(m)); - rc = sqlite3VdbeMemFromBtree(pC->pCursor, 0, (u32)nCellKey, 1, &m); - if( rc ){ - return rc; - } - assert( pUnpacked->flags & UNPACKED_PREFIX_MATCH ); - *res = sqlite3VdbeRecordCompare(m.n, m.z, pUnpacked); - sqlite3VdbeMemRelease(&m); - return SQLITE_OK; -} - -/* -** This routine sets the value to be returned by subsequent calls to -** sqlite3_changes() on the database handle 'db'. -*/ -SQLITE_PRIVATE void sqlite3VdbeSetChanges(sqlite3 *db, int nChange){ - assert( sqlite3_mutex_held(db->mutex) ); - db->nChange = nChange; - db->nTotalChange += nChange; -} - -/* -** Set a flag in the vdbe to update the change counter when it is finalised -** or reset. -*/ -SQLITE_PRIVATE void sqlite3VdbeCountChanges(Vdbe *v){ - v->changeCntOn = 1; -} - -/* -** Mark every prepared statement associated with a database connection -** as expired. -** -** An expired statement means that recompilation of the statement is -** recommend. Statements expire when things happen that make their -** programs obsolete. Removing user-defined functions or collating -** sequences, or changing an authorization function are the types of -** things that make prepared statements obsolete. -*/ -SQLITE_PRIVATE void sqlite3ExpirePreparedStatements(sqlite3 *db){ - Vdbe *p; - for(p = db->pVdbe; p; p=p->pNext){ - p->expired = 1; - } -} - -/* -** Return the database associated with the Vdbe. -*/ -SQLITE_PRIVATE sqlite3 *sqlite3VdbeDb(Vdbe *v){ - return v->db; -} - -/* -** Return a pointer to an sqlite3_value structure containing the value bound -** parameter iVar of VM v. Except, if the value is an SQL NULL, return -** 0 instead. Unless it is NULL, apply affinity aff (one of the SQLITE_AFF_* -** constants) to the value before returning it. -** -** The returned value must be freed by the caller using sqlite3ValueFree(). -*/ -SQLITE_PRIVATE sqlite3_value *sqlite3VdbeGetBoundValue(Vdbe *v, int iVar, u8 aff){ - assert( iVar>0 ); - if( v ){ - Mem *pMem = &v->aVar[iVar-1]; - if( 0==(pMem->flags & MEM_Null) ){ - sqlite3_value *pRet = sqlite3ValueNew(v->db); - if( pRet ){ - sqlite3VdbeMemCopy((Mem *)pRet, pMem); - sqlite3ValueApplyAffinity(pRet, aff, SQLITE_UTF8); - sqlite3VdbeMemStoreType((Mem *)pRet); - } - return pRet; - } - } - return 0; -} - -/* -** Configure SQL variable iVar so that binding a new value to it signals -** to sqlite3_reoptimize() that re-preparing the statement may result -** in a better query plan. -*/ -SQLITE_PRIVATE void sqlite3VdbeSetVarmask(Vdbe *v, int iVar){ - assert( iVar>0 ); - if( iVar>32 ){ - v->expmask = 0xffffffff; - }else{ - v->expmask |= ((u32)1 << (iVar-1)); - } -} - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* -** Transfer error message text from an sqlite3_vtab.zErrMsg (text stored -** in memory obtained from sqlite3_malloc) into a Vdbe.zErrMsg (text stored -** in memory obtained from sqlite3DbMalloc). -*/ -SQLITE_PRIVATE void sqlite3VtabImportErrmsg(Vdbe *p, sqlite3_vtab *pVtab){ - sqlite3 *db = p->db; - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = sqlite3DbStrDup(db, pVtab->zErrMsg); - sqlite3_free(pVtab->zErrMsg); - pVtab->zErrMsg = 0; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/************** End of vdbeaux.c *********************************************/ -/************** Begin file vdbeapi.c *****************************************/ -/* -** 2004 May 26 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains code use to implement APIs that are part of the -** VDBE. -*/ - -#ifndef SQLITE_OMIT_DEPRECATED -/* -** Return TRUE (non-zero) of the statement supplied as an argument needs -** to be recompiled. A statement needs to be recompiled whenever the -** execution environment changes in a way that would alter the program -** that sqlite3_prepare() generates. For example, if new functions or -** collating sequences are registered or if an authorizer function is -** added or changed. -*/ -SQLITE_API int sqlite3_expired(sqlite3_stmt *pStmt){ - Vdbe *p = (Vdbe*)pStmt; - return p==0 || p->expired; -} -#endif - -/* -** Check on a Vdbe to make sure it has not been finalized. Log -** an error and return true if it has been finalized (or is otherwise -** invalid). Return false if it is ok. -*/ -static int vdbeSafety(Vdbe *p){ - if( p->db==0 ){ - sqlite3_log(SQLITE_MISUSE, "API called with finalized prepared statement"); - return 1; - }else{ - return 0; - } -} -static int vdbeSafetyNotNull(Vdbe *p){ - if( p==0 ){ - sqlite3_log(SQLITE_MISUSE, "API called with NULL prepared statement"); - return 1; - }else{ - return vdbeSafety(p); - } -} - -/* -** The following routine destroys a virtual machine that is created by -** the sqlite3_compile() routine. The integer returned is an SQLITE_ -** success/failure code that describes the result of executing the virtual -** machine. -** -** This routine sets the error code and string returned by -** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16(). -*/ -SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt){ - int rc; - if( pStmt==0 ){ - /* IMPLEMENTATION-OF: R-57228-12904 Invoking sqlite3_finalize() on a NULL - ** pointer is a harmless no-op. */ - rc = SQLITE_OK; - }else{ - Vdbe *v = (Vdbe*)pStmt; - sqlite3 *db = v->db; - if( vdbeSafety(v) ) return SQLITE_MISUSE_BKPT; - sqlite3_mutex_enter(db->mutex); - rc = sqlite3VdbeFinalize(v); - rc = sqlite3ApiExit(db, rc); - sqlite3LeaveMutexAndCloseZombie(db); - } - return rc; -} - -/* -** Terminate the current execution of an SQL statement and reset it -** back to its starting state so that it can be reused. A success code from -** the prior execution is returned. -** -** This routine sets the error code and string returned by -** sqlite3_errcode(), sqlite3_errmsg() and sqlite3_errmsg16(). -*/ -SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt){ - int rc; - if( pStmt==0 ){ - rc = SQLITE_OK; - }else{ - Vdbe *v = (Vdbe*)pStmt; - sqlite3_mutex_enter(v->db->mutex); - rc = sqlite3VdbeReset(v); - sqlite3VdbeRewind(v); - assert( (rc & (v->db->errMask))==rc ); - rc = sqlite3ApiExit(v->db, rc); - sqlite3_mutex_leave(v->db->mutex); - } - return rc; -} - -/* -** Set all the parameters in the compiled SQL statement to NULL. -*/ -SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt *pStmt){ - int i; - int rc = SQLITE_OK; - Vdbe *p = (Vdbe*)pStmt; -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex = ((Vdbe*)pStmt)->db->mutex; -#endif - sqlite3_mutex_enter(mutex); - for(i=0; inVar; i++){ - sqlite3VdbeMemRelease(&p->aVar[i]); - p->aVar[i].flags = MEM_Null; - } - if( p->isPrepareV2 && p->expmask ){ - p->expired = 1; - } - sqlite3_mutex_leave(mutex); - return rc; -} - - -/**************************** sqlite3_value_ ******************************* -** The following routines extract information from a Mem or sqlite3_value -** structure. -*/ -SQLITE_API const void *sqlite3_value_blob(sqlite3_value *pVal){ - Mem *p = (Mem*)pVal; - if( p->flags & (MEM_Blob|MEM_Str) ){ - sqlite3VdbeMemExpandBlob(p); - p->flags &= ~MEM_Str; - p->flags |= MEM_Blob; - return p->n ? p->z : 0; - }else{ - return sqlite3_value_text(pVal); - } -} -SQLITE_API int sqlite3_value_bytes(sqlite3_value *pVal){ - return sqlite3ValueBytes(pVal, SQLITE_UTF8); -} -SQLITE_API int sqlite3_value_bytes16(sqlite3_value *pVal){ - return sqlite3ValueBytes(pVal, SQLITE_UTF16NATIVE); -} -SQLITE_API double sqlite3_value_double(sqlite3_value *pVal){ - return sqlite3VdbeRealValue((Mem*)pVal); -} -SQLITE_API int sqlite3_value_int(sqlite3_value *pVal){ - return (int)sqlite3VdbeIntValue((Mem*)pVal); -} -SQLITE_API sqlite_int64 sqlite3_value_int64(sqlite3_value *pVal){ - return sqlite3VdbeIntValue((Mem*)pVal); -} -SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value *pVal){ - return (const unsigned char *)sqlite3ValueText(pVal, SQLITE_UTF8); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_value_text16(sqlite3_value* pVal){ - return sqlite3ValueText(pVal, SQLITE_UTF16NATIVE); -} -SQLITE_API const void *sqlite3_value_text16be(sqlite3_value *pVal){ - return sqlite3ValueText(pVal, SQLITE_UTF16BE); -} -SQLITE_API const void *sqlite3_value_text16le(sqlite3_value *pVal){ - return sqlite3ValueText(pVal, SQLITE_UTF16LE); -} -#endif /* SQLITE_OMIT_UTF16 */ -SQLITE_API int sqlite3_value_type(sqlite3_value* pVal){ - return pVal->type; -} - -/**************************** sqlite3_result_ ******************************* -** The following routines are used by user-defined functions to specify -** the function result. -** -** The setStrOrError() funtion calls sqlite3VdbeMemSetStr() to store the -** result as a string or blob but if the string or blob is too large, it -** then sets the error code to SQLITE_TOOBIG -*/ -static void setResultStrOrError( - sqlite3_context *pCtx, /* Function context */ - const char *z, /* String pointer */ - int n, /* Bytes in string, or negative */ - u8 enc, /* Encoding of z. 0 for BLOBs */ - void (*xDel)(void*) /* Destructor function */ -){ - if( sqlite3VdbeMemSetStr(&pCtx->s, z, n, enc, xDel)==SQLITE_TOOBIG ){ - sqlite3_result_error_toobig(pCtx); - } -} -SQLITE_API void sqlite3_result_blob( - sqlite3_context *pCtx, - const void *z, - int n, - void (*xDel)(void *) -){ - assert( n>=0 ); - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - setResultStrOrError(pCtx, z, n, 0, xDel); -} -SQLITE_API void sqlite3_result_double(sqlite3_context *pCtx, double rVal){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - sqlite3VdbeMemSetDouble(&pCtx->s, rVal); -} -SQLITE_API void sqlite3_result_error(sqlite3_context *pCtx, const char *z, int n){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - pCtx->isError = SQLITE_ERROR; - pCtx->fErrorOrAux = 1; - sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF8, SQLITE_TRANSIENT); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API void sqlite3_result_error16(sqlite3_context *pCtx, const void *z, int n){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - pCtx->isError = SQLITE_ERROR; - pCtx->fErrorOrAux = 1; - sqlite3VdbeMemSetStr(&pCtx->s, z, n, SQLITE_UTF16NATIVE, SQLITE_TRANSIENT); -} -#endif -SQLITE_API void sqlite3_result_int(sqlite3_context *pCtx, int iVal){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - sqlite3VdbeMemSetInt64(&pCtx->s, (i64)iVal); -} -SQLITE_API void sqlite3_result_int64(sqlite3_context *pCtx, i64 iVal){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - sqlite3VdbeMemSetInt64(&pCtx->s, iVal); -} -SQLITE_API void sqlite3_result_null(sqlite3_context *pCtx){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - sqlite3VdbeMemSetNull(&pCtx->s); -} -SQLITE_API void sqlite3_result_text( - sqlite3_context *pCtx, - const char *z, - int n, - void (*xDel)(void *) -){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - setResultStrOrError(pCtx, z, n, SQLITE_UTF8, xDel); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API void sqlite3_result_text16( - sqlite3_context *pCtx, - const void *z, - int n, - void (*xDel)(void *) -){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - setResultStrOrError(pCtx, z, n, SQLITE_UTF16NATIVE, xDel); -} -SQLITE_API void sqlite3_result_text16be( - sqlite3_context *pCtx, - const void *z, - int n, - void (*xDel)(void *) -){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - setResultStrOrError(pCtx, z, n, SQLITE_UTF16BE, xDel); -} -SQLITE_API void sqlite3_result_text16le( - sqlite3_context *pCtx, - const void *z, - int n, - void (*xDel)(void *) -){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - setResultStrOrError(pCtx, z, n, SQLITE_UTF16LE, xDel); -} -#endif /* SQLITE_OMIT_UTF16 */ -SQLITE_API void sqlite3_result_value(sqlite3_context *pCtx, sqlite3_value *pValue){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - sqlite3VdbeMemCopy(&pCtx->s, pValue); -} -SQLITE_API void sqlite3_result_zeroblob(sqlite3_context *pCtx, int n){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - sqlite3VdbeMemSetZeroBlob(&pCtx->s, n); -} -SQLITE_API void sqlite3_result_error_code(sqlite3_context *pCtx, int errCode){ - pCtx->isError = errCode; - pCtx->fErrorOrAux = 1; - if( pCtx->s.flags & MEM_Null ){ - sqlite3VdbeMemSetStr(&pCtx->s, sqlite3ErrStr(errCode), -1, - SQLITE_UTF8, SQLITE_STATIC); - } -} - -/* Force an SQLITE_TOOBIG error. */ -SQLITE_API void sqlite3_result_error_toobig(sqlite3_context *pCtx){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - pCtx->isError = SQLITE_TOOBIG; - pCtx->fErrorOrAux = 1; - sqlite3VdbeMemSetStr(&pCtx->s, "string or blob too big", -1, - SQLITE_UTF8, SQLITE_STATIC); -} - -/* An SQLITE_NOMEM error. */ -SQLITE_API void sqlite3_result_error_nomem(sqlite3_context *pCtx){ - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - sqlite3VdbeMemSetNull(&pCtx->s); - pCtx->isError = SQLITE_NOMEM; - pCtx->fErrorOrAux = 1; - pCtx->s.db->mallocFailed = 1; -} - -/* -** This function is called after a transaction has been committed. It -** invokes callbacks registered with sqlite3_wal_hook() as required. -*/ -static int doWalCallbacks(sqlite3 *db){ - int rc = SQLITE_OK; -#ifndef SQLITE_OMIT_WAL - int i; - for(i=0; inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - int nEntry = sqlite3PagerWalCallback(sqlite3BtreePager(pBt)); - if( db->xWalCallback && nEntry>0 && rc==SQLITE_OK ){ - rc = db->xWalCallback(db->pWalArg, db, db->aDb[i].zName, nEntry); - } - } - } -#endif - return rc; -} - -/* -** Execute the statement pStmt, either until a row of data is ready, the -** statement is completely executed or an error occurs. -** -** This routine implements the bulk of the logic behind the sqlite_step() -** API. The only thing omitted is the automatic recompile if a -** schema change has occurred. That detail is handled by the -** outer sqlite3_step() wrapper procedure. -*/ -static int sqlite3Step(Vdbe *p){ - sqlite3 *db; - int rc; - - assert(p); - if( p->magic!=VDBE_MAGIC_RUN ){ - /* We used to require that sqlite3_reset() be called before retrying - ** sqlite3_step() after any error or after SQLITE_DONE. But beginning - ** with version 3.7.0, we changed this so that sqlite3_reset() would - ** be called automatically instead of throwing the SQLITE_MISUSE error. - ** This "automatic-reset" change is not technically an incompatibility, - ** since any application that receives an SQLITE_MISUSE is broken by - ** definition. - ** - ** Nevertheless, some published applications that were originally written - ** for version 3.6.23 or earlier do in fact depend on SQLITE_MISUSE - ** returns, and those were broken by the automatic-reset change. As a - ** a work-around, the SQLITE_OMIT_AUTORESET compile-time restores the - ** legacy behavior of returning SQLITE_MISUSE for cases where the - ** previous sqlite3_step() returned something other than a SQLITE_LOCKED - ** or SQLITE_BUSY error. - */ -#ifdef SQLITE_OMIT_AUTORESET - if( p->rc==SQLITE_BUSY || p->rc==SQLITE_LOCKED ){ - sqlite3_reset((sqlite3_stmt*)p); - }else{ - return SQLITE_MISUSE_BKPT; - } -#else - sqlite3_reset((sqlite3_stmt*)p); -#endif - } - - /* Check that malloc() has not failed. If it has, return early. */ - db = p->db; - if( db->mallocFailed ){ - p->rc = SQLITE_NOMEM; - return SQLITE_NOMEM; - } - - if( p->pc<=0 && p->expired ){ - p->rc = SQLITE_SCHEMA; - rc = SQLITE_ERROR; - goto end_of_step; - } - if( p->pc<0 ){ - /* If there are no other statements currently running, then - ** reset the interrupt flag. This prevents a call to sqlite3_interrupt - ** from interrupting a statement that has not yet started. - */ - if( db->nVdbeActive==0 ){ - db->u1.isInterrupted = 0; - } - - assert( db->nVdbeWrite>0 || db->autoCommit==0 - || (db->nDeferredCons==0 && db->nDeferredImmCons==0) - ); - -#ifndef SQLITE_OMIT_TRACE - if( db->xProfile && !db->init.busy ){ - sqlite3OsCurrentTimeInt64(db->pVfs, &p->startTime); - } -#endif - - db->nVdbeActive++; - if( p->readOnly==0 ) db->nVdbeWrite++; - if( p->bIsReader ) db->nVdbeRead++; - p->pc = 0; - } -#ifndef SQLITE_OMIT_EXPLAIN - if( p->explain ){ - rc = sqlite3VdbeList(p); - }else -#endif /* SQLITE_OMIT_EXPLAIN */ - { - db->nVdbeExec++; - rc = sqlite3VdbeExec(p); - db->nVdbeExec--; - } - -#ifndef SQLITE_OMIT_TRACE - /* Invoke the profile callback if there is one - */ - if( rc!=SQLITE_ROW && db->xProfile && !db->init.busy && p->zSql ){ - sqlite3_int64 iNow; - sqlite3OsCurrentTimeInt64(db->pVfs, &iNow); - db->xProfile(db->pProfileArg, p->zSql, (iNow - p->startTime)*1000000); - } -#endif - - if( rc==SQLITE_DONE ){ - assert( p->rc==SQLITE_OK ); - p->rc = doWalCallbacks(db); - if( p->rc!=SQLITE_OK ){ - rc = SQLITE_ERROR; - } - } - - db->errCode = rc; - if( SQLITE_NOMEM==sqlite3ApiExit(p->db, p->rc) ){ - p->rc = SQLITE_NOMEM; - } -end_of_step: - /* At this point local variable rc holds the value that should be - ** returned if this statement was compiled using the legacy - ** sqlite3_prepare() interface. According to the docs, this can only - ** be one of the values in the first assert() below. Variable p->rc - ** contains the value that would be returned if sqlite3_finalize() - ** were called on statement p. - */ - assert( rc==SQLITE_ROW || rc==SQLITE_DONE || rc==SQLITE_ERROR - || rc==SQLITE_BUSY || rc==SQLITE_MISUSE - ); - assert( p->rc!=SQLITE_ROW && p->rc!=SQLITE_DONE ); - if( p->isPrepareV2 && rc!=SQLITE_ROW && rc!=SQLITE_DONE ){ - /* If this statement was prepared using sqlite3_prepare_v2(), and an - ** error has occurred, then return the error code in p->rc to the - ** caller. Set the error code in the database handle to the same value. - */ - rc = sqlite3VdbeTransferError(p); - } - return (rc&db->errMask); -} - -/* -** This is the top-level implementation of sqlite3_step(). Call -** sqlite3Step() to do most of the work. If a schema error occurs, -** call sqlite3Reprepare() and try again. -*/ -SQLITE_API int sqlite3_step(sqlite3_stmt *pStmt){ - int rc = SQLITE_OK; /* Result from sqlite3Step() */ - int rc2 = SQLITE_OK; /* Result from sqlite3Reprepare() */ - Vdbe *v = (Vdbe*)pStmt; /* the prepared statement */ - int cnt = 0; /* Counter to prevent infinite loop of reprepares */ - sqlite3 *db; /* The database connection */ - - if( vdbeSafetyNotNull(v) ){ - return SQLITE_MISUSE_BKPT; - } - db = v->db; - sqlite3_mutex_enter(db->mutex); - v->doingRerun = 0; - while( (rc = sqlite3Step(v))==SQLITE_SCHEMA - && cnt++ < SQLITE_MAX_SCHEMA_RETRY - && (rc2 = rc = sqlite3Reprepare(v))==SQLITE_OK ){ - sqlite3_reset(pStmt); - v->doingRerun = 1; - assert( v->expired==0 ); - } - if( rc2!=SQLITE_OK ){ - /* This case occurs after failing to recompile an sql statement. - ** The error message from the SQL compiler has already been loaded - ** into the database handle. This block copies the error message - ** from the database handle into the statement and sets the statement - ** program counter to 0 to ensure that when the statement is - ** finalized or reset the parser error message is available via - ** sqlite3_errmsg() and sqlite3_errcode(). - */ - const char *zErr = (const char *)sqlite3_value_text(db->pErr); - assert( zErr!=0 || db->mallocFailed ); - sqlite3DbFree(db, v->zErrMsg); - if( !db->mallocFailed ){ - v->zErrMsg = sqlite3DbStrDup(db, zErr); - v->rc = rc2; - } else { - v->zErrMsg = 0; - v->rc = rc = SQLITE_NOMEM; - } - } - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - - -/* -** Extract the user data from a sqlite3_context structure and return a -** pointer to it. -*/ -SQLITE_API void *sqlite3_user_data(sqlite3_context *p){ - assert( p && p->pFunc ); - return p->pFunc->pUserData; -} - -/* -** Extract the user data from a sqlite3_context structure and return a -** pointer to it. -** -** IMPLEMENTATION-OF: R-46798-50301 The sqlite3_context_db_handle() interface -** returns a copy of the pointer to the database connection (the 1st -** parameter) of the sqlite3_create_function() and -** sqlite3_create_function16() routines that originally registered the -** application defined function. -*/ -SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context *p){ - assert( p && p->pFunc ); - return p->s.db; -} - -/* -** Return the current time for a statement -*/ -SQLITE_PRIVATE sqlite3_int64 sqlite3StmtCurrentTime(sqlite3_context *p){ - Vdbe *v = p->pVdbe; - int rc; - if( v->iCurrentTime==0 ){ - rc = sqlite3OsCurrentTimeInt64(p->s.db->pVfs, &v->iCurrentTime); - if( rc ) v->iCurrentTime = 0; - } - return v->iCurrentTime; -} - -/* -** The following is the implementation of an SQL function that always -** fails with an error message stating that the function is used in the -** wrong context. The sqlite3_overload_function() API might construct -** SQL function that use this routine so that the functions will exist -** for name resolution but are actually overloaded by the xFindFunction -** method of virtual tables. -*/ -SQLITE_PRIVATE void sqlite3InvalidFunction( - sqlite3_context *context, /* The function calling context */ - int NotUsed, /* Number of arguments to the function */ - sqlite3_value **NotUsed2 /* Value of each argument */ -){ - const char *zName = context->pFunc->zName; - char *zErr; - UNUSED_PARAMETER2(NotUsed, NotUsed2); - zErr = sqlite3_mprintf( - "unable to use function %s in the requested context", zName); - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); -} - -/* -** Allocate or return the aggregate context for a user function. A new -** context is allocated on the first call. Subsequent calls return the -** same context that was returned on prior calls. -*/ -SQLITE_API void *sqlite3_aggregate_context(sqlite3_context *p, int nByte){ - Mem *pMem; - assert( p && p->pFunc && p->pFunc->xStep ); - assert( sqlite3_mutex_held(p->s.db->mutex) ); - pMem = p->pMem; - testcase( nByte<0 ); - if( (pMem->flags & MEM_Agg)==0 ){ - if( nByte<=0 ){ - sqlite3VdbeMemReleaseExternal(pMem); - pMem->flags = MEM_Null; - pMem->z = 0; - }else{ - sqlite3VdbeMemGrow(pMem, nByte, 0); - pMem->flags = MEM_Agg; - pMem->u.pDef = p->pFunc; - if( pMem->z ){ - memset(pMem->z, 0, nByte); - } - } - } - return (void*)pMem->z; -} - -/* -** Return the auxilary data pointer, if any, for the iArg'th argument to -** the user-function defined by pCtx. -*/ -SQLITE_API void *sqlite3_get_auxdata(sqlite3_context *pCtx, int iArg){ - AuxData *pAuxData; - - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - for(pAuxData=pCtx->pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNext){ - if( pAuxData->iOp==pCtx->iOp && pAuxData->iArg==iArg ) break; - } - - return (pAuxData ? pAuxData->pAux : 0); -} - -/* -** Set the auxilary data pointer and delete function, for the iArg'th -** argument to the user-function defined by pCtx. Any previous value is -** deleted by calling the delete function specified when it was set. -*/ -SQLITE_API void sqlite3_set_auxdata( - sqlite3_context *pCtx, - int iArg, - void *pAux, - void (*xDelete)(void*) -){ - AuxData *pAuxData; - Vdbe *pVdbe = pCtx->pVdbe; - - assert( sqlite3_mutex_held(pCtx->s.db->mutex) ); - if( iArg<0 ) goto failed; - - for(pAuxData=pVdbe->pAuxData; pAuxData; pAuxData=pAuxData->pNext){ - if( pAuxData->iOp==pCtx->iOp && pAuxData->iArg==iArg ) break; - } - if( pAuxData==0 ){ - pAuxData = sqlite3DbMallocZero(pVdbe->db, sizeof(AuxData)); - if( !pAuxData ) goto failed; - pAuxData->iOp = pCtx->iOp; - pAuxData->iArg = iArg; - pAuxData->pNext = pVdbe->pAuxData; - pVdbe->pAuxData = pAuxData; - if( pCtx->fErrorOrAux==0 ){ - pCtx->isError = 0; - pCtx->fErrorOrAux = 1; - } - }else if( pAuxData->xDelete ){ - pAuxData->xDelete(pAuxData->pAux); - } - - pAuxData->pAux = pAux; - pAuxData->xDelete = xDelete; - return; - -failed: - if( xDelete ){ - xDelete(pAux); - } -} - -#ifndef SQLITE_OMIT_DEPRECATED -/* -** Return the number of times the Step function of a aggregate has been -** called. -** -** This function is deprecated. Do not use it for new code. It is -** provide only to avoid breaking legacy code. New aggregate function -** implementations should keep their own counts within their aggregate -** context. -*/ -SQLITE_API int sqlite3_aggregate_count(sqlite3_context *p){ - assert( p && p->pMem && p->pFunc && p->pFunc->xStep ); - return p->pMem->n; -} -#endif - -/* -** Return the number of columns in the result set for the statement pStmt. -*/ -SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt){ - Vdbe *pVm = (Vdbe *)pStmt; - return pVm ? pVm->nResColumn : 0; -} - -/* -** Return the number of values available from the current row of the -** currently executing statement pStmt. -*/ -SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt){ - Vdbe *pVm = (Vdbe *)pStmt; - if( pVm==0 || pVm->pResultSet==0 ) return 0; - return pVm->nResColumn; -} - - -/* -** Check to see if column iCol of the given statement is valid. If -** it is, return a pointer to the Mem for the value of that column. -** If iCol is not valid, return a pointer to a Mem which has a value -** of NULL. -*/ -static Mem *columnMem(sqlite3_stmt *pStmt, int i){ - Vdbe *pVm; - Mem *pOut; - - pVm = (Vdbe *)pStmt; - if( pVm && pVm->pResultSet!=0 && inResColumn && i>=0 ){ - sqlite3_mutex_enter(pVm->db->mutex); - pOut = &pVm->pResultSet[i]; - }else{ - /* If the value passed as the second argument is out of range, return - ** a pointer to the following static Mem object which contains the - ** value SQL NULL. Even though the Mem structure contains an element - ** of type i64, on certain architectures (x86) with certain compiler - ** switches (-Os), gcc may align this Mem object on a 4-byte boundary - ** instead of an 8-byte one. This all works fine, except that when - ** running with SQLITE_DEBUG defined the SQLite code sometimes assert()s - ** that a Mem structure is located on an 8-byte boundary. To prevent - ** these assert()s from failing, when building with SQLITE_DEBUG defined - ** using gcc, we force nullMem to be 8-byte aligned using the magical - ** __attribute__((aligned(8))) macro. */ - static const Mem nullMem -#if defined(SQLITE_DEBUG) && defined(__GNUC__) - __attribute__((aligned(8))) -#endif - = {0, "", (double)0, {0}, 0, MEM_Null, SQLITE_NULL, 0, -#ifdef SQLITE_DEBUG - 0, 0, /* pScopyFrom, pFiller */ -#endif - 0, 0 }; - - if( pVm && ALWAYS(pVm->db) ){ - sqlite3_mutex_enter(pVm->db->mutex); - sqlite3Error(pVm->db, SQLITE_RANGE, 0); - } - pOut = (Mem*)&nullMem; - } - return pOut; -} - -/* -** This function is called after invoking an sqlite3_value_XXX function on a -** column value (i.e. a value returned by evaluating an SQL expression in the -** select list of a SELECT statement) that may cause a malloc() failure. If -** malloc() has failed, the threads mallocFailed flag is cleared and the result -** code of statement pStmt set to SQLITE_NOMEM. -** -** Specifically, this is called from within: -** -** sqlite3_column_int() -** sqlite3_column_int64() -** sqlite3_column_text() -** sqlite3_column_text16() -** sqlite3_column_real() -** sqlite3_column_bytes() -** sqlite3_column_bytes16() -** sqiite3_column_blob() -*/ -static void columnMallocFailure(sqlite3_stmt *pStmt) -{ - /* If malloc() failed during an encoding conversion within an - ** sqlite3_column_XXX API, then set the return code of the statement to - ** SQLITE_NOMEM. The next call to _step() (if any) will return SQLITE_ERROR - ** and _finalize() will return NOMEM. - */ - Vdbe *p = (Vdbe *)pStmt; - if( p ){ - p->rc = sqlite3ApiExit(p->db, p->rc); - sqlite3_mutex_leave(p->db->mutex); - } -} - -/**************************** sqlite3_column_ ******************************* -** The following routines are used to access elements of the current row -** in the result set. -*/ -SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt *pStmt, int i){ - const void *val; - val = sqlite3_value_blob( columnMem(pStmt,i) ); - /* Even though there is no encoding conversion, value_blob() might - ** need to call malloc() to expand the result of a zeroblob() - ** expression. - */ - columnMallocFailure(pStmt); - return val; -} -SQLITE_API int sqlite3_column_bytes(sqlite3_stmt *pStmt, int i){ - int val = sqlite3_value_bytes( columnMem(pStmt,i) ); - columnMallocFailure(pStmt); - return val; -} -SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt *pStmt, int i){ - int val = sqlite3_value_bytes16( columnMem(pStmt,i) ); - columnMallocFailure(pStmt); - return val; -} -SQLITE_API double sqlite3_column_double(sqlite3_stmt *pStmt, int i){ - double val = sqlite3_value_double( columnMem(pStmt,i) ); - columnMallocFailure(pStmt); - return val; -} -SQLITE_API int sqlite3_column_int(sqlite3_stmt *pStmt, int i){ - int val = sqlite3_value_int( columnMem(pStmt,i) ); - columnMallocFailure(pStmt); - return val; -} -SQLITE_API sqlite_int64 sqlite3_column_int64(sqlite3_stmt *pStmt, int i){ - sqlite_int64 val = sqlite3_value_int64( columnMem(pStmt,i) ); - columnMallocFailure(pStmt); - return val; -} -SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt *pStmt, int i){ - const unsigned char *val = sqlite3_value_text( columnMem(pStmt,i) ); - columnMallocFailure(pStmt); - return val; -} -SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt *pStmt, int i){ - Mem *pOut = columnMem(pStmt, i); - if( pOut->flags&MEM_Static ){ - pOut->flags &= ~MEM_Static; - pOut->flags |= MEM_Ephem; - } - columnMallocFailure(pStmt); - return (sqlite3_value *)pOut; -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt *pStmt, int i){ - const void *val = sqlite3_value_text16( columnMem(pStmt,i) ); - columnMallocFailure(pStmt); - return val; -} -#endif /* SQLITE_OMIT_UTF16 */ -SQLITE_API int sqlite3_column_type(sqlite3_stmt *pStmt, int i){ - int iType = sqlite3_value_type( columnMem(pStmt,i) ); - columnMallocFailure(pStmt); - return iType; -} - -/* -** Convert the N-th element of pStmt->pColName[] into a string using -** xFunc() then return that string. If N is out of range, return 0. -** -** There are up to 5 names for each column. useType determines which -** name is returned. Here are the names: -** -** 0 The column name as it should be displayed for output -** 1 The datatype name for the column -** 2 The name of the database that the column derives from -** 3 The name of the table that the column derives from -** 4 The name of the table column that the result column derives from -** -** If the result is not a simple column reference (if it is an expression -** or a constant) then useTypes 2, 3, and 4 return NULL. -*/ -static const void *columnName( - sqlite3_stmt *pStmt, - int N, - const void *(*xFunc)(Mem*), - int useType -){ - const void *ret = 0; - Vdbe *p = (Vdbe *)pStmt; - int n; - sqlite3 *db = p->db; - - assert( db!=0 ); - n = sqlite3_column_count(pStmt); - if( N=0 ){ - N += useType*n; - sqlite3_mutex_enter(db->mutex); - assert( db->mallocFailed==0 ); - ret = xFunc(&p->aColName[N]); - /* A malloc may have failed inside of the xFunc() call. If this - ** is the case, clear the mallocFailed flag and return NULL. - */ - if( db->mallocFailed ){ - db->mallocFailed = 0; - ret = 0; - } - sqlite3_mutex_leave(db->mutex); - } - return ret; -} - -/* -** Return the name of the Nth column of the result set returned by SQL -** statement pStmt. -*/ -SQLITE_API const char *sqlite3_column_name(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_NAME); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_NAME); -} -#endif - -/* -** Constraint: If you have ENABLE_COLUMN_METADATA then you must -** not define OMIT_DECLTYPE. -*/ -#if defined(SQLITE_OMIT_DECLTYPE) && defined(SQLITE_ENABLE_COLUMN_METADATA) -# error "Must not define both SQLITE_OMIT_DECLTYPE \ - and SQLITE_ENABLE_COLUMN_METADATA" -#endif - -#ifndef SQLITE_OMIT_DECLTYPE -/* -** Return the column declaration type (if applicable) of the 'i'th column -** of the result set of SQL statement pStmt. -*/ -SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DECLTYPE); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DECLTYPE); -} -#endif /* SQLITE_OMIT_UTF16 */ -#endif /* SQLITE_OMIT_DECLTYPE */ - -#ifdef SQLITE_ENABLE_COLUMN_METADATA -/* -** Return the name of the database from which a result column derives. -** NULL is returned if the result column is an expression or constant or -** anything else which is not an unabiguous reference to a database column. -*/ -SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_DATABASE); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_DATABASE); -} -#endif /* SQLITE_OMIT_UTF16 */ - -/* -** Return the name of the table from which a result column derives. -** NULL is returned if the result column is an expression or constant or -** anything else which is not an unabiguous reference to a database column. -*/ -SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_TABLE); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_TABLE); -} -#endif /* SQLITE_OMIT_UTF16 */ - -/* -** Return the name of the table column from which a result column derives. -** NULL is returned if the result column is an expression or constant or -** anything else which is not an unabiguous reference to a database column. -*/ -SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text, COLNAME_COLUMN); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt *pStmt, int N){ - return columnName( - pStmt, N, (const void*(*)(Mem*))sqlite3_value_text16, COLNAME_COLUMN); -} -#endif /* SQLITE_OMIT_UTF16 */ -#endif /* SQLITE_ENABLE_COLUMN_METADATA */ - - -/******************************* sqlite3_bind_ *************************** -** -** Routines used to attach values to wildcards in a compiled SQL statement. -*/ -/* -** Unbind the value bound to variable i in virtual machine p. This is the -** the same as binding a NULL value to the column. If the "i" parameter is -** out of range, then SQLITE_RANGE is returned. Othewise SQLITE_OK. -** -** A successful evaluation of this routine acquires the mutex on p. -** the mutex is released if any kind of error occurs. -** -** The error code stored in database p->db is overwritten with the return -** value in any case. -*/ -static int vdbeUnbind(Vdbe *p, int i){ - Mem *pVar; - if( vdbeSafetyNotNull(p) ){ - return SQLITE_MISUSE_BKPT; - } - sqlite3_mutex_enter(p->db->mutex); - if( p->magic!=VDBE_MAGIC_RUN || p->pc>=0 ){ - sqlite3Error(p->db, SQLITE_MISUSE, 0); - sqlite3_mutex_leave(p->db->mutex); - sqlite3_log(SQLITE_MISUSE, - "bind on a busy prepared statement: [%s]", p->zSql); - return SQLITE_MISUSE_BKPT; - } - if( i<1 || i>p->nVar ){ - sqlite3Error(p->db, SQLITE_RANGE, 0); - sqlite3_mutex_leave(p->db->mutex); - return SQLITE_RANGE; - } - i--; - pVar = &p->aVar[i]; - sqlite3VdbeMemRelease(pVar); - pVar->flags = MEM_Null; - sqlite3Error(p->db, SQLITE_OK, 0); - - /* If the bit corresponding to this variable in Vdbe.expmask is set, then - ** binding a new value to this variable invalidates the current query plan. - ** - ** IMPLEMENTATION-OF: R-48440-37595 If the specific value bound to host - ** parameter in the WHERE clause might influence the choice of query plan - ** for a statement, then the statement will be automatically recompiled, - ** as if there had been a schema change, on the first sqlite3_step() call - ** following any change to the bindings of that parameter. - */ - if( p->isPrepareV2 && - ((i<32 && p->expmask & ((u32)1 << i)) || p->expmask==0xffffffff) - ){ - p->expired = 1; - } - return SQLITE_OK; -} - -/* -** Bind a text or BLOB value. -*/ -static int bindText( - sqlite3_stmt *pStmt, /* The statement to bind against */ - int i, /* Index of the parameter to bind */ - const void *zData, /* Pointer to the data to be bound */ - int nData, /* Number of bytes of data to be bound */ - void (*xDel)(void*), /* Destructor for the data */ - u8 encoding /* Encoding for the data */ -){ - Vdbe *p = (Vdbe *)pStmt; - Mem *pVar; - int rc; - - rc = vdbeUnbind(p, i); - if( rc==SQLITE_OK ){ - if( zData!=0 ){ - pVar = &p->aVar[i-1]; - rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel); - if( rc==SQLITE_OK && encoding!=0 ){ - rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db)); - } - sqlite3Error(p->db, rc, 0); - rc = sqlite3ApiExit(p->db, rc); - } - sqlite3_mutex_leave(p->db->mutex); - }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){ - xDel((void*)zData); - } - return rc; -} - - -/* -** Bind a blob value to an SQL statement variable. -*/ -SQLITE_API int sqlite3_bind_blob( - sqlite3_stmt *pStmt, - int i, - const void *zData, - int nData, - void (*xDel)(void*) -){ - return bindText(pStmt, i, zData, nData, xDel, 0); -} -SQLITE_API int sqlite3_bind_double(sqlite3_stmt *pStmt, int i, double rValue){ - int rc; - Vdbe *p = (Vdbe *)pStmt; - rc = vdbeUnbind(p, i); - if( rc==SQLITE_OK ){ - sqlite3VdbeMemSetDouble(&p->aVar[i-1], rValue); - sqlite3_mutex_leave(p->db->mutex); - } - return rc; -} -SQLITE_API int sqlite3_bind_int(sqlite3_stmt *p, int i, int iValue){ - return sqlite3_bind_int64(p, i, (i64)iValue); -} -SQLITE_API int sqlite3_bind_int64(sqlite3_stmt *pStmt, int i, sqlite_int64 iValue){ - int rc; - Vdbe *p = (Vdbe *)pStmt; - rc = vdbeUnbind(p, i); - if( rc==SQLITE_OK ){ - sqlite3VdbeMemSetInt64(&p->aVar[i-1], iValue); - sqlite3_mutex_leave(p->db->mutex); - } - return rc; -} -SQLITE_API int sqlite3_bind_null(sqlite3_stmt *pStmt, int i){ - int rc; - Vdbe *p = (Vdbe*)pStmt; - rc = vdbeUnbind(p, i); - if( rc==SQLITE_OK ){ - sqlite3_mutex_leave(p->db->mutex); - } - return rc; -} -SQLITE_API int sqlite3_bind_text( - sqlite3_stmt *pStmt, - int i, - const char *zData, - int nData, - void (*xDel)(void*) -){ - return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF8); -} -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API int sqlite3_bind_text16( - sqlite3_stmt *pStmt, - int i, - const void *zData, - int nData, - void (*xDel)(void*) -){ - return bindText(pStmt, i, zData, nData, xDel, SQLITE_UTF16NATIVE); -} -#endif /* SQLITE_OMIT_UTF16 */ -SQLITE_API int sqlite3_bind_value(sqlite3_stmt *pStmt, int i, const sqlite3_value *pValue){ - int rc; - switch( pValue->type ){ - case SQLITE_INTEGER: { - rc = sqlite3_bind_int64(pStmt, i, pValue->u.i); - break; - } - case SQLITE_FLOAT: { - rc = sqlite3_bind_double(pStmt, i, pValue->r); - break; - } - case SQLITE_BLOB: { - if( pValue->flags & MEM_Zero ){ - rc = sqlite3_bind_zeroblob(pStmt, i, pValue->u.nZero); - }else{ - rc = sqlite3_bind_blob(pStmt, i, pValue->z, pValue->n,SQLITE_TRANSIENT); - } - break; - } - case SQLITE_TEXT: { - rc = bindText(pStmt,i, pValue->z, pValue->n, SQLITE_TRANSIENT, - pValue->enc); - break; - } - default: { - rc = sqlite3_bind_null(pStmt, i); - break; - } - } - return rc; -} -SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt *pStmt, int i, int n){ - int rc; - Vdbe *p = (Vdbe *)pStmt; - rc = vdbeUnbind(p, i); - if( rc==SQLITE_OK ){ - sqlite3VdbeMemSetZeroBlob(&p->aVar[i-1], n); - sqlite3_mutex_leave(p->db->mutex); - } - return rc; -} - -/* -** Return the number of wildcards that can be potentially bound to. -** This routine is added to support DBD::SQLite. -*/ -SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt *pStmt){ - Vdbe *p = (Vdbe*)pStmt; - return p ? p->nVar : 0; -} - -/* -** Return the name of a wildcard parameter. Return NULL if the index -** is out of range or if the wildcard is unnamed. -** -** The result is always UTF-8. -*/ -SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt *pStmt, int i){ - Vdbe *p = (Vdbe*)pStmt; - if( p==0 || i<1 || i>p->nzVar ){ - return 0; - } - return p->azVar[i-1]; -} - -/* -** Given a wildcard parameter name, return the index of the variable -** with that name. If there is no variable with the given name, -** return 0. -*/ -SQLITE_PRIVATE int sqlite3VdbeParameterIndex(Vdbe *p, const char *zName, int nName){ - int i; - if( p==0 ){ - return 0; - } - if( zName ){ - for(i=0; inzVar; i++){ - const char *z = p->azVar[i]; - if( z && strncmp(z,zName,nName)==0 && z[nName]==0 ){ - return i+1; - } - } - } - return 0; -} -SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt *pStmt, const char *zName){ - return sqlite3VdbeParameterIndex((Vdbe*)pStmt, zName, sqlite3Strlen30(zName)); -} - -/* -** Transfer all bindings from the first statement over to the second. -*/ -SQLITE_PRIVATE int sqlite3TransferBindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){ - Vdbe *pFrom = (Vdbe*)pFromStmt; - Vdbe *pTo = (Vdbe*)pToStmt; - int i; - assert( pTo->db==pFrom->db ); - assert( pTo->nVar==pFrom->nVar ); - sqlite3_mutex_enter(pTo->db->mutex); - for(i=0; inVar; i++){ - sqlite3VdbeMemMove(&pTo->aVar[i], &pFrom->aVar[i]); - } - sqlite3_mutex_leave(pTo->db->mutex); - return SQLITE_OK; -} - -#ifndef SQLITE_OMIT_DEPRECATED -/* -** Deprecated external interface. Internal/core SQLite code -** should call sqlite3TransferBindings. -** -** Is is misuse to call this routine with statements from different -** database connections. But as this is a deprecated interface, we -** will not bother to check for that condition. -** -** If the two statements contain a different number of bindings, then -** an SQLITE_ERROR is returned. Nothing else can go wrong, so otherwise -** SQLITE_OK is returned. -*/ -SQLITE_API int sqlite3_transfer_bindings(sqlite3_stmt *pFromStmt, sqlite3_stmt *pToStmt){ - Vdbe *pFrom = (Vdbe*)pFromStmt; - Vdbe *pTo = (Vdbe*)pToStmt; - if( pFrom->nVar!=pTo->nVar ){ - return SQLITE_ERROR; - } - if( pTo->isPrepareV2 && pTo->expmask ){ - pTo->expired = 1; - } - if( pFrom->isPrepareV2 && pFrom->expmask ){ - pFrom->expired = 1; - } - return sqlite3TransferBindings(pFromStmt, pToStmt); -} -#endif - -/* -** Return the sqlite3* database handle to which the prepared statement given -** in the argument belongs. This is the same database handle that was -** the first argument to the sqlite3_prepare() that was used to create -** the statement in the first place. -*/ -SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt *pStmt){ - return pStmt ? ((Vdbe*)pStmt)->db : 0; -} - -/* -** Return true if the prepared statement is guaranteed to not modify the -** database. -*/ -SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt){ - return pStmt ? ((Vdbe*)pStmt)->readOnly : 1; -} - -/* -** Return true if the prepared statement is in need of being reset. -*/ -SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt *pStmt){ - Vdbe *v = (Vdbe*)pStmt; - return v!=0 && v->pc>0 && v->magic==VDBE_MAGIC_RUN; -} - -/* -** Return a pointer to the next prepared statement after pStmt associated -** with database connection pDb. If pStmt is NULL, return the first -** prepared statement for the database connection. Return NULL if there -** are no more. -*/ -SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt){ - sqlite3_stmt *pNext; - sqlite3_mutex_enter(pDb->mutex); - if( pStmt==0 ){ - pNext = (sqlite3_stmt*)pDb->pVdbe; - }else{ - pNext = (sqlite3_stmt*)((Vdbe*)pStmt)->pNext; - } - sqlite3_mutex_leave(pDb->mutex); - return pNext; -} - -/* -** Return the value of a status counter for a prepared statement -*/ -SQLITE_API int sqlite3_stmt_status(sqlite3_stmt *pStmt, int op, int resetFlag){ - Vdbe *pVdbe = (Vdbe*)pStmt; - u32 v = pVdbe->aCounter[op]; - if( resetFlag ) pVdbe->aCounter[op] = 0; - return (int)v; -} - -/************** End of vdbeapi.c *********************************************/ -/************** Begin file vdbetrace.c ***************************************/ -/* -** 2009 November 25 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains code used to insert the values of host parameters -** (aka "wildcards") into the SQL text output by sqlite3_trace(). -** -** The Vdbe parse-tree explainer is also found here. -*/ - -#ifndef SQLITE_OMIT_TRACE - -/* -** zSql is a zero-terminated string of UTF-8 SQL text. Return the number of -** bytes in this text up to but excluding the first character in -** a host parameter. If the text contains no host parameters, return -** the total number of bytes in the text. -*/ -static int findNextHostParameter(const char *zSql, int *pnToken){ - int tokenType; - int nTotal = 0; - int n; - - *pnToken = 0; - while( zSql[0] ){ - n = sqlite3GetToken((u8*)zSql, &tokenType); - assert( n>0 && tokenType!=TK_ILLEGAL ); - if( tokenType==TK_VARIABLE ){ - *pnToken = n; - break; - } - nTotal += n; - zSql += n; - } - return nTotal; -} - -/* -** This function returns a pointer to a nul-terminated string in memory -** obtained from sqlite3DbMalloc(). If sqlite3.nVdbeExec is 1, then the -** string contains a copy of zRawSql but with host parameters expanded to -** their current bindings. Or, if sqlite3.nVdbeExec is greater than 1, -** then the returned string holds a copy of zRawSql with "-- " prepended -** to each line of text. -** -** If the SQLITE_TRACE_SIZE_LIMIT macro is defined to an integer, then -** then long strings and blobs are truncated to that many bytes. This -** can be used to prevent unreasonably large trace strings when dealing -** with large (multi-megabyte) strings and blobs. -** -** The calling function is responsible for making sure the memory returned -** is eventually freed. -** -** ALGORITHM: Scan the input string looking for host parameters in any of -** these forms: ?, ?N, $A, @A, :A. Take care to avoid text within -** string literals, quoted identifier names, and comments. For text forms, -** the host parameter index is found by scanning the perpared -** statement for the corresponding OP_Variable opcode. Once the host -** parameter index is known, locate the value in p->aVar[]. Then render -** the value as a literal in place of the host parameter name. -*/ -SQLITE_PRIVATE char *sqlite3VdbeExpandSql( - Vdbe *p, /* The prepared statement being evaluated */ - const char *zRawSql /* Raw text of the SQL statement */ -){ - sqlite3 *db; /* The database connection */ - int idx = 0; /* Index of a host parameter */ - int nextIndex = 1; /* Index of next ? host parameter */ - int n; /* Length of a token prefix */ - int nToken; /* Length of the parameter token */ - int i; /* Loop counter */ - Mem *pVar; /* Value of a host parameter */ - StrAccum out; /* Accumulate the output here */ - char zBase[100]; /* Initial working space */ - - db = p->db; - sqlite3StrAccumInit(&out, zBase, sizeof(zBase), - db->aLimit[SQLITE_LIMIT_LENGTH]); - out.db = db; - if( db->nVdbeExec>1 ){ - while( *zRawSql ){ - const char *zStart = zRawSql; - while( *(zRawSql++)!='\n' && *zRawSql ); - sqlite3StrAccumAppend(&out, "-- ", 3); - assert( (zRawSql - zStart) > 0 ); - sqlite3StrAccumAppend(&out, zStart, (int)(zRawSql-zStart)); - } - }else{ - while( zRawSql[0] ){ - n = findNextHostParameter(zRawSql, &nToken); - assert( n>0 ); - sqlite3StrAccumAppend(&out, zRawSql, n); - zRawSql += n; - assert( zRawSql[0] || nToken==0 ); - if( nToken==0 ) break; - if( zRawSql[0]=='?' ){ - if( nToken>1 ){ - assert( sqlite3Isdigit(zRawSql[1]) ); - sqlite3GetInt32(&zRawSql[1], &idx); - }else{ - idx = nextIndex; - } - }else{ - assert( zRawSql[0]==':' || zRawSql[0]=='$' || zRawSql[0]=='@' ); - testcase( zRawSql[0]==':' ); - testcase( zRawSql[0]=='$' ); - testcase( zRawSql[0]=='@' ); - idx = sqlite3VdbeParameterIndex(p, zRawSql, nToken); - assert( idx>0 ); - } - zRawSql += nToken; - nextIndex = idx + 1; - assert( idx>0 && idx<=p->nVar ); - pVar = &p->aVar[idx-1]; - if( pVar->flags & MEM_Null ){ - sqlite3StrAccumAppend(&out, "NULL", 4); - }else if( pVar->flags & MEM_Int ){ - sqlite3XPrintf(&out, 0, "%lld", pVar->u.i); - }else if( pVar->flags & MEM_Real ){ - sqlite3XPrintf(&out, 0, "%!.15g", pVar->r); - }else if( pVar->flags & MEM_Str ){ - int nOut; /* Number of bytes of the string text to include in output */ -#ifndef SQLITE_OMIT_UTF16 - u8 enc = ENC(db); - Mem utf8; - if( enc!=SQLITE_UTF8 ){ - memset(&utf8, 0, sizeof(utf8)); - utf8.db = db; - sqlite3VdbeMemSetStr(&utf8, pVar->z, pVar->n, enc, SQLITE_STATIC); - sqlite3VdbeChangeEncoding(&utf8, SQLITE_UTF8); - pVar = &utf8; - } -#endif - nOut = pVar->n; -#ifdef SQLITE_TRACE_SIZE_LIMIT - if( nOut>SQLITE_TRACE_SIZE_LIMIT ){ - nOut = SQLITE_TRACE_SIZE_LIMIT; - while( nOutn && (pVar->z[nOut]&0xc0)==0x80 ){ nOut++; } - } -#endif - sqlite3XPrintf(&out, 0, "'%.*q'", nOut, pVar->z); -#ifdef SQLITE_TRACE_SIZE_LIMIT - if( nOutn ){ - sqlite3XPrintf(&out, 0, "/*+%d bytes*/", pVar->n-nOut); - } -#endif -#ifndef SQLITE_OMIT_UTF16 - if( enc!=SQLITE_UTF8 ) sqlite3VdbeMemRelease(&utf8); -#endif - }else if( pVar->flags & MEM_Zero ){ - sqlite3XPrintf(&out, 0, "zeroblob(%d)", pVar->u.nZero); - }else{ - int nOut; /* Number of bytes of the blob to include in output */ - assert( pVar->flags & MEM_Blob ); - sqlite3StrAccumAppend(&out, "x'", 2); - nOut = pVar->n; -#ifdef SQLITE_TRACE_SIZE_LIMIT - if( nOut>SQLITE_TRACE_SIZE_LIMIT ) nOut = SQLITE_TRACE_SIZE_LIMIT; -#endif - for(i=0; iz[i]&0xff); - } - sqlite3StrAccumAppend(&out, "'", 1); -#ifdef SQLITE_TRACE_SIZE_LIMIT - if( nOutn ){ - sqlite3XPrintf(&out, 0, "/*+%d bytes*/", pVar->n-nOut); - } -#endif - } - } - } - return sqlite3StrAccumFinish(&out); -} - -#endif /* #ifndef SQLITE_OMIT_TRACE */ - -/***************************************************************************** -** The following code implements the data-structure explaining logic -** for the Vdbe. -*/ - -#if defined(SQLITE_ENABLE_TREE_EXPLAIN) - -/* -** Allocate a new Explain object -*/ -SQLITE_PRIVATE void sqlite3ExplainBegin(Vdbe *pVdbe){ - if( pVdbe ){ - Explain *p; - sqlite3BeginBenignMalloc(); - p = (Explain *)sqlite3MallocZero( sizeof(Explain) ); - if( p ){ - p->pVdbe = pVdbe; - sqlite3_free(pVdbe->pExplain); - pVdbe->pExplain = p; - sqlite3StrAccumInit(&p->str, p->zBase, sizeof(p->zBase), - SQLITE_MAX_LENGTH); - p->str.useMalloc = 2; - }else{ - sqlite3EndBenignMalloc(); - } - } -} - -/* -** Return true if the Explain ends with a new-line. -*/ -static int endsWithNL(Explain *p){ - return p && p->str.zText && p->str.nChar - && p->str.zText[p->str.nChar-1]=='\n'; -} - -/* -** Append text to the indentation -*/ -SQLITE_PRIVATE void sqlite3ExplainPrintf(Vdbe *pVdbe, const char *zFormat, ...){ - Explain *p; - if( pVdbe && (p = pVdbe->pExplain)!=0 ){ - va_list ap; - if( p->nIndent && endsWithNL(p) ){ - int n = p->nIndent; - if( n>ArraySize(p->aIndent) ) n = ArraySize(p->aIndent); - sqlite3AppendSpace(&p->str, p->aIndent[n-1]); - } - va_start(ap, zFormat); - sqlite3VXPrintf(&p->str, SQLITE_PRINTF_INTERNAL, zFormat, ap); - va_end(ap); - } -} - -/* -** Append a '\n' if there is not already one. -*/ -SQLITE_PRIVATE void sqlite3ExplainNL(Vdbe *pVdbe){ - Explain *p; - if( pVdbe && (p = pVdbe->pExplain)!=0 && !endsWithNL(p) ){ - sqlite3StrAccumAppend(&p->str, "\n", 1); - } -} - -/* -** Push a new indentation level. Subsequent lines will be indented -** so that they begin at the current cursor position. -*/ -SQLITE_PRIVATE void sqlite3ExplainPush(Vdbe *pVdbe){ - Explain *p; - if( pVdbe && (p = pVdbe->pExplain)!=0 ){ - if( p->str.zText && p->nIndentaIndent) ){ - const char *z = p->str.zText; - int i = p->str.nChar-1; - int x; - while( i>=0 && z[i]!='\n' ){ i--; } - x = (p->str.nChar - 1) - i; - if( p->nIndent && xaIndent[p->nIndent-1] ){ - x = p->aIndent[p->nIndent-1]; - } - p->aIndent[p->nIndent] = x; - } - p->nIndent++; - } -} - -/* -** Pop the indentation stack by one level. -*/ -SQLITE_PRIVATE void sqlite3ExplainPop(Vdbe *p){ - if( p && p->pExplain ) p->pExplain->nIndent--; -} - -/* -** Free the indentation structure -*/ -SQLITE_PRIVATE void sqlite3ExplainFinish(Vdbe *pVdbe){ - if( pVdbe && pVdbe->pExplain ){ - sqlite3_free(pVdbe->zExplain); - sqlite3ExplainNL(pVdbe); - pVdbe->zExplain = sqlite3StrAccumFinish(&pVdbe->pExplain->str); - sqlite3_free(pVdbe->pExplain); - pVdbe->pExplain = 0; - sqlite3EndBenignMalloc(); - } -} - -/* -** Return the explanation of a virtual machine. -*/ -SQLITE_PRIVATE const char *sqlite3VdbeExplanation(Vdbe *pVdbe){ - return (pVdbe && pVdbe->zExplain) ? pVdbe->zExplain : 0; -} -#endif /* defined(SQLITE_DEBUG) */ - -/************** End of vdbetrace.c *******************************************/ -/************** Begin file vdbe.c ********************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** The code in this file implements execution method of the -** Virtual Database Engine (VDBE). A separate file ("vdbeaux.c") -** handles housekeeping details such as creating and deleting -** VDBE instances. This file is solely interested in executing -** the VDBE program. -** -** In the external interface, an "sqlite3_stmt*" is an opaque pointer -** to a VDBE. -** -** The SQL parser generates a program which is then executed by -** the VDBE to do the work of the SQL statement. VDBE programs are -** similar in form to assembly language. The program consists of -** a linear sequence of operations. Each operation has an opcode -** and 5 operands. Operands P1, P2, and P3 are integers. Operand P4 -** is a null-terminated string. Operand P5 is an unsigned character. -** Few opcodes use all 5 operands. -** -** Computation results are stored on a set of registers numbered beginning -** with 1 and going up to Vdbe.nMem. Each register can store -** either an integer, a null-terminated string, a floating point -** number, or the SQL "NULL" value. An implicit conversion from one -** type to the other occurs as necessary. -** -** Most of the code in this file is taken up by the sqlite3VdbeExec() -** function which does the work of interpreting a VDBE program. -** But other routines are also provided to help in building up -** a program instruction by instruction. -** -** Various scripts scan this source file in order to generate HTML -** documentation, headers files, or other derived files. The formatting -** of the code in this file is, therefore, important. See other comments -** in this file for details. If in doubt, do not deviate from existing -** commenting and indentation practices when changing or adding code. -*/ - -/* -** Invoke this macro on memory cells just prior to changing the -** value of the cell. This macro verifies that shallow copies are -** not misused. -*/ -#ifdef SQLITE_DEBUG -# define memAboutToChange(P,M) sqlite3VdbeMemAboutToChange(P,M) -#else -# define memAboutToChange(P,M) -#endif - -/* -** The following global variable is incremented every time a cursor -** moves, either by the OP_SeekXX, OP_Next, or OP_Prev opcodes. The test -** procedures use this information to make sure that indices are -** working correctly. This variable has no function other than to -** help verify the correct operation of the library. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_search_count = 0; -#endif - -/* -** When this global variable is positive, it gets decremented once before -** each instruction in the VDBE. When it reaches zero, the u1.isInterrupted -** field of the sqlite3 structure is set in order to simulate an interrupt. -** -** This facility is used for testing purposes only. It does not function -** in an ordinary build. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_interrupt_count = 0; -#endif - -/* -** The next global variable is incremented each type the OP_Sort opcode -** is executed. The test procedures use this information to make sure that -** sorting is occurring or not occurring at appropriate times. This variable -** has no function other than to help verify the correct operation of the -** library. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_sort_count = 0; -#endif - -/* -** The next global variable records the size of the largest MEM_Blob -** or MEM_Str that has been used by a VDBE opcode. The test procedures -** use this information to make sure that the zero-blob functionality -** is working correctly. This variable has no function other than to -** help verify the correct operation of the library. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_max_blobsize = 0; -static void updateMaxBlobsize(Mem *p){ - if( (p->flags & (MEM_Str|MEM_Blob))!=0 && p->n>sqlite3_max_blobsize ){ - sqlite3_max_blobsize = p->n; - } -} -#endif - -/* -** The next global variable is incremented each type the OP_Found opcode -** is executed. This is used to test whether or not the foreign key -** operation implemented using OP_FkIsZero is working. This variable -** has no function other than to help verify the correct operation of the -** library. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_found_count = 0; -#endif - -/* -** Test a register to see if it exceeds the current maximum blob size. -** If it does, record the new maximum blob size. -*/ -#if defined(SQLITE_TEST) && !defined(SQLITE_OMIT_BUILTIN_TEST) -# define UPDATE_MAX_BLOBSIZE(P) updateMaxBlobsize(P) -#else -# define UPDATE_MAX_BLOBSIZE(P) -#endif - -/* -** Convert the given register into a string if it isn't one -** already. Return non-zero if a malloc() fails. -*/ -#define Stringify(P, enc) \ - if(((P)->flags&(MEM_Str|MEM_Blob))==0 && sqlite3VdbeMemStringify(P,enc)) \ - { goto no_mem; } - -/* -** An ephemeral string value (signified by the MEM_Ephem flag) contains -** a pointer to a dynamically allocated string where some other entity -** is responsible for deallocating that string. Because the register -** does not control the string, it might be deleted without the register -** knowing it. -** -** This routine converts an ephemeral string into a dynamically allocated -** string that the register itself controls. In other words, it -** converts an MEM_Ephem string into an MEM_Dyn string. -*/ -#define Deephemeralize(P) \ - if( ((P)->flags&MEM_Ephem)!=0 \ - && sqlite3VdbeMemMakeWriteable(P) ){ goto no_mem;} - -/* Return true if the cursor was opened using the OP_OpenSorter opcode. */ -# define isSorter(x) ((x)->pSorter!=0) - -/* -** Argument pMem points at a register that will be passed to a -** user-defined function or returned to the user as the result of a query. -** This routine sets the pMem->type variable used by the sqlite3_value_*() -** routines. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemStoreType(Mem *pMem){ - int flags = pMem->flags; - if( flags & MEM_Null ){ - pMem->type = SQLITE_NULL; - } - else if( flags & MEM_Int ){ - pMem->type = SQLITE_INTEGER; - } - else if( flags & MEM_Real ){ - pMem->type = SQLITE_FLOAT; - } - else if( flags & MEM_Str ){ - pMem->type = SQLITE_TEXT; - }else{ - pMem->type = SQLITE_BLOB; - } -} - -/* -** Allocate VdbeCursor number iCur. Return a pointer to it. Return NULL -** if we run out of memory. -*/ -static VdbeCursor *allocateCursor( - Vdbe *p, /* The virtual machine */ - int iCur, /* Index of the new VdbeCursor */ - int nField, /* Number of fields in the table or index */ - int iDb, /* Database the cursor belongs to, or -1 */ - int isBtreeCursor /* True for B-Tree. False for pseudo-table or vtab */ -){ - /* Find the memory cell that will be used to store the blob of memory - ** required for this VdbeCursor structure. It is convenient to use a - ** vdbe memory cell to manage the memory allocation required for a - ** VdbeCursor structure for the following reasons: - ** - ** * Sometimes cursor numbers are used for a couple of different - ** purposes in a vdbe program. The different uses might require - ** different sized allocations. Memory cells provide growable - ** allocations. - ** - ** * When using ENABLE_MEMORY_MANAGEMENT, memory cell buffers can - ** be freed lazily via the sqlite3_release_memory() API. This - ** minimizes the number of malloc calls made by the system. - ** - ** Memory cells for cursors are allocated at the top of the address - ** space. Memory cell (p->nMem) corresponds to cursor 0. Space for - ** cursor 1 is managed by memory cell (p->nMem-1), etc. - */ - Mem *pMem = &p->aMem[p->nMem-iCur]; - - int nByte; - VdbeCursor *pCx = 0; - nByte = - ROUND8(sizeof(VdbeCursor)) + 2*sizeof(u32)*nField + - (isBtreeCursor?sqlite3BtreeCursorSize():0); - - assert( iCurnCursor ); - if( p->apCsr[iCur] ){ - sqlite3VdbeFreeCursor(p, p->apCsr[iCur]); - p->apCsr[iCur] = 0; - } - if( SQLITE_OK==sqlite3VdbeMemGrow(pMem, nByte, 0) ){ - p->apCsr[iCur] = pCx = (VdbeCursor*)pMem->z; - memset(pCx, 0, sizeof(VdbeCursor)); - pCx->iDb = iDb; - pCx->nField = nField; - if( isBtreeCursor ){ - pCx->pCursor = (BtCursor*) - &pMem->z[ROUND8(sizeof(VdbeCursor))+2*sizeof(u32)*nField]; - sqlite3BtreeCursorZero(pCx->pCursor); - } - } - return pCx; -} - -/* -** Try to convert a value into a numeric representation if we can -** do so without loss of information. In other words, if the string -** looks like a number, convert it into a number. If it does not -** look like a number, leave it alone. -*/ -static void applyNumericAffinity(Mem *pRec){ - if( (pRec->flags & (MEM_Real|MEM_Int))==0 ){ - double rValue; - i64 iValue; - u8 enc = pRec->enc; - if( (pRec->flags&MEM_Str)==0 ) return; - if( sqlite3AtoF(pRec->z, &rValue, pRec->n, enc)==0 ) return; - if( 0==sqlite3Atoi64(pRec->z, &iValue, pRec->n, enc) ){ - pRec->u.i = iValue; - pRec->flags |= MEM_Int; - }else{ - pRec->r = rValue; - pRec->flags |= MEM_Real; - } - } -} - -/* -** Processing is determine by the affinity parameter: -** -** SQLITE_AFF_INTEGER: -** SQLITE_AFF_REAL: -** SQLITE_AFF_NUMERIC: -** Try to convert pRec to an integer representation or a -** floating-point representation if an integer representation -** is not possible. Note that the integer representation is -** always preferred, even if the affinity is REAL, because -** an integer representation is more space efficient on disk. -** -** SQLITE_AFF_TEXT: -** Convert pRec to a text representation. -** -** SQLITE_AFF_NONE: -** No-op. pRec is unchanged. -*/ -static void applyAffinity( - Mem *pRec, /* The value to apply affinity to */ - char affinity, /* The affinity to be applied */ - u8 enc /* Use this text encoding */ -){ - if( affinity==SQLITE_AFF_TEXT ){ - /* Only attempt the conversion to TEXT if there is an integer or real - ** representation (blob and NULL do not get converted) but no string - ** representation. - */ - if( 0==(pRec->flags&MEM_Str) && (pRec->flags&(MEM_Real|MEM_Int)) ){ - sqlite3VdbeMemStringify(pRec, enc); - } - pRec->flags &= ~(MEM_Real|MEM_Int); - }else if( affinity!=SQLITE_AFF_NONE ){ - assert( affinity==SQLITE_AFF_INTEGER || affinity==SQLITE_AFF_REAL - || affinity==SQLITE_AFF_NUMERIC ); - applyNumericAffinity(pRec); - if( pRec->flags & MEM_Real ){ - sqlite3VdbeIntegerAffinity(pRec); - } - } -} - -/* -** Try to convert the type of a function argument or a result column -** into a numeric representation. Use either INTEGER or REAL whichever -** is appropriate. But only do the conversion if it is possible without -** loss of information and return the revised type of the argument. -*/ -SQLITE_API int sqlite3_value_numeric_type(sqlite3_value *pVal){ - Mem *pMem = (Mem*)pVal; - if( pMem->type==SQLITE_TEXT ){ - applyNumericAffinity(pMem); - sqlite3VdbeMemStoreType(pMem); - } - return pMem->type; -} - -/* -** Exported version of applyAffinity(). This one works on sqlite3_value*, -** not the internal Mem* type. -*/ -SQLITE_PRIVATE void sqlite3ValueApplyAffinity( - sqlite3_value *pVal, - u8 affinity, - u8 enc -){ - applyAffinity((Mem *)pVal, affinity, enc); -} - -#ifdef SQLITE_DEBUG -/* -** Write a nice string representation of the contents of cell pMem -** into buffer zBuf, length nBuf. -*/ -SQLITE_PRIVATE void sqlite3VdbeMemPrettyPrint(Mem *pMem, char *zBuf){ - char *zCsr = zBuf; - int f = pMem->flags; - - static const char *const encnames[] = {"(X)", "(8)", "(16LE)", "(16BE)"}; - - if( f&MEM_Blob ){ - int i; - char c; - if( f & MEM_Dyn ){ - c = 'z'; - assert( (f & (MEM_Static|MEM_Ephem))==0 ); - }else if( f & MEM_Static ){ - c = 't'; - assert( (f & (MEM_Dyn|MEM_Ephem))==0 ); - }else if( f & MEM_Ephem ){ - c = 'e'; - assert( (f & (MEM_Static|MEM_Dyn))==0 ); - }else{ - c = 's'; - } - - sqlite3_snprintf(100, zCsr, "%c", c); - zCsr += sqlite3Strlen30(zCsr); - sqlite3_snprintf(100, zCsr, "%d[", pMem->n); - zCsr += sqlite3Strlen30(zCsr); - for(i=0; i<16 && in; i++){ - sqlite3_snprintf(100, zCsr, "%02X", ((int)pMem->z[i] & 0xFF)); - zCsr += sqlite3Strlen30(zCsr); - } - for(i=0; i<16 && in; i++){ - char z = pMem->z[i]; - if( z<32 || z>126 ) *zCsr++ = '.'; - else *zCsr++ = z; - } - - sqlite3_snprintf(100, zCsr, "]%s", encnames[pMem->enc]); - zCsr += sqlite3Strlen30(zCsr); - if( f & MEM_Zero ){ - sqlite3_snprintf(100, zCsr,"+%dz",pMem->u.nZero); - zCsr += sqlite3Strlen30(zCsr); - } - *zCsr = '\0'; - }else if( f & MEM_Str ){ - int j, k; - zBuf[0] = ' '; - if( f & MEM_Dyn ){ - zBuf[1] = 'z'; - assert( (f & (MEM_Static|MEM_Ephem))==0 ); - }else if( f & MEM_Static ){ - zBuf[1] = 't'; - assert( (f & (MEM_Dyn|MEM_Ephem))==0 ); - }else if( f & MEM_Ephem ){ - zBuf[1] = 'e'; - assert( (f & (MEM_Static|MEM_Dyn))==0 ); - }else{ - zBuf[1] = 's'; - } - k = 2; - sqlite3_snprintf(100, &zBuf[k], "%d", pMem->n); - k += sqlite3Strlen30(&zBuf[k]); - zBuf[k++] = '['; - for(j=0; j<15 && jn; j++){ - u8 c = pMem->z[j]; - if( c>=0x20 && c<0x7f ){ - zBuf[k++] = c; - }else{ - zBuf[k++] = '.'; - } - } - zBuf[k++] = ']'; - sqlite3_snprintf(100,&zBuf[k], encnames[pMem->enc]); - k += sqlite3Strlen30(&zBuf[k]); - zBuf[k++] = 0; - } -} -#endif - -#ifdef SQLITE_DEBUG -/* -** Print the value of a register for tracing purposes: -*/ -static void memTracePrint(Mem *p){ - if( p->flags & MEM_Invalid ){ - printf(" undefined"); - }else if( p->flags & MEM_Null ){ - printf(" NULL"); - }else if( (p->flags & (MEM_Int|MEM_Str))==(MEM_Int|MEM_Str) ){ - printf(" si:%lld", p->u.i); - }else if( p->flags & MEM_Int ){ - printf(" i:%lld", p->u.i); -#ifndef SQLITE_OMIT_FLOATING_POINT - }else if( p->flags & MEM_Real ){ - printf(" r:%g", p->r); -#endif - }else if( p->flags & MEM_RowSet ){ - printf(" (rowset)"); - }else{ - char zBuf[200]; - sqlite3VdbeMemPrettyPrint(p, zBuf); - printf(" %s", zBuf); - } -} -static void registerTrace(int iReg, Mem *p){ - printf("REG[%d] = ", iReg); - memTracePrint(p); - printf("\n"); -} -#endif - -#ifdef SQLITE_DEBUG -# define REGISTER_TRACE(R,M) if(db->flags&SQLITE_VdbeTrace)registerTrace(R,M) -#else -# define REGISTER_TRACE(R,M) -#endif - - -#ifdef VDBE_PROFILE - -/* -** hwtime.h contains inline assembler code for implementing -** high-performance timing routines. -*/ -/************** Include hwtime.h in the middle of vdbe.c *********************/ -/************** Begin file hwtime.h ******************************************/ -/* -** 2008 May 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains inline asm code for retrieving "high-performance" -** counters for x86 class CPUs. -*/ -#ifndef _HWTIME_H_ -#define _HWTIME_H_ - -/* -** The following routine only works on pentium-class (or newer) processors. -** It uses the RDTSC opcode to read the cycle count value out of the -** processor and returns that value. This can be used for high-res -** profiling. -*/ -#if (defined(__GNUC__) || defined(_MSC_VER)) && \ - (defined(i386) || defined(__i386__) || defined(_M_IX86)) - - #if defined(__GNUC__) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned int lo, hi; - __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi)); - return (sqlite_uint64)hi << 32 | lo; - } - - #elif defined(_MSC_VER) - - __declspec(naked) __inline sqlite_uint64 __cdecl sqlite3Hwtime(void){ - __asm { - rdtsc - ret ; return value at EDX:EAX - } - } - - #endif - -#elif (defined(__GNUC__) && defined(__x86_64__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long val; - __asm__ __volatile__ ("rdtsc" : "=A" (val)); - return val; - } - -#elif (defined(__GNUC__) && defined(__ppc__)) - - __inline__ sqlite_uint64 sqlite3Hwtime(void){ - unsigned long long retval; - unsigned long junk; - __asm__ __volatile__ ("\n\ - 1: mftbu %1\n\ - mftb %L0\n\ - mftbu %0\n\ - cmpw %0,%1\n\ - bne 1b" - : "=r" (retval), "=r" (junk)); - return retval; - } - -#else - - #error Need implementation of sqlite3Hwtime() for your platform. - - /* - ** To compile without implementing sqlite3Hwtime() for your platform, - ** you can remove the above #error and use the following - ** stub function. You will lose timing support for many - ** of the debugging and testing utilities, but it should at - ** least compile and run. - */ -SQLITE_PRIVATE sqlite_uint64 sqlite3Hwtime(void){ return ((sqlite_uint64)0); } - -#endif - -#endif /* !defined(_HWTIME_H_) */ - -/************** End of hwtime.h **********************************************/ -/************** Continuing where we left off in vdbe.c ***********************/ - -#endif - -/* -** The CHECK_FOR_INTERRUPT macro defined here looks to see if the -** sqlite3_interrupt() routine has been called. If it has been, then -** processing of the VDBE program is interrupted. -** -** This macro added to every instruction that does a jump in order to -** implement a loop. This test used to be on every single instruction, -** but that meant we more testing than we needed. By only testing the -** flag on jump instructions, we get a (small) speed improvement. -*/ -#define CHECK_FOR_INTERRUPT \ - if( db->u1.isInterrupted ) goto abort_due_to_interrupt; - - -#ifndef NDEBUG -/* -** This function is only called from within an assert() expression. It -** checks that the sqlite3.nTransaction variable is correctly set to -** the number of non-transaction savepoints currently in the -** linked list starting at sqlite3.pSavepoint. -** -** Usage: -** -** assert( checkSavepointCount(db) ); -*/ -static int checkSavepointCount(sqlite3 *db){ - int n = 0; - Savepoint *p; - for(p=db->pSavepoint; p; p=p->pNext) n++; - assert( n==(db->nSavepoint + db->isTransactionSavepoint) ); - return 1; -} -#endif - - -/* -** Execute as much of a VDBE program as we can then return. -** -** sqlite3VdbeMakeReady() must be called before this routine in order to -** close the program with a final OP_Halt and to set up the callbacks -** and the error message pointer. -** -** Whenever a row or result data is available, this routine will either -** invoke the result callback (if there is one) or return with -** SQLITE_ROW. -** -** If an attempt is made to open a locked database, then this routine -** will either invoke the busy callback (if there is one) or it will -** return SQLITE_BUSY. -** -** If an error occurs, an error message is written to memory obtained -** from sqlite3_malloc() and p->zErrMsg is made to point to that memory. -** The error code is stored in p->rc and this routine returns SQLITE_ERROR. -** -** If the callback ever returns non-zero, then the program exits -** immediately. There will be no error message but the p->rc field is -** set to SQLITE_ABORT and this routine will return SQLITE_ERROR. -** -** A memory allocation error causes p->rc to be set to SQLITE_NOMEM and this -** routine to return SQLITE_ERROR. -** -** Other fatal errors return SQLITE_ERROR. -** -** After this routine has finished, sqlite3VdbeFinalize() should be -** used to clean up the mess that was left behind. -*/ -SQLITE_PRIVATE int sqlite3VdbeExec( - Vdbe *p /* The VDBE */ -){ - int pc=0; /* The program counter */ - Op *aOp = p->aOp; /* Copy of p->aOp */ - Op *pOp; /* Current operation */ - int rc = SQLITE_OK; /* Value to return */ - sqlite3 *db = p->db; /* The database */ - u8 resetSchemaOnFault = 0; /* Reset schema after an error if positive */ - u8 encoding = ENC(db); /* The database encoding */ - int iCompare = 0; /* Result of last OP_Compare operation */ - unsigned nVmStep = 0; /* Number of virtual machine steps */ -#ifndef SQLITE_OMIT_PROGRESS_CALLBACK - unsigned nProgressLimit = 0;/* Invoke xProgress() when nVmStep reaches this */ -#endif - Mem *aMem = p->aMem; /* Copy of p->aMem */ - Mem *pIn1 = 0; /* 1st input operand */ - Mem *pIn2 = 0; /* 2nd input operand */ - Mem *pIn3 = 0; /* 3rd input operand */ - Mem *pOut = 0; /* Output operand */ - int *aPermute = 0; /* Permutation of columns for OP_Compare */ - i64 lastRowid = db->lastRowid; /* Saved value of the last insert ROWID */ -#ifdef VDBE_PROFILE - u64 start; /* CPU clock count at start of opcode */ - int origPc; /* Program counter at start of opcode */ -#endif - /*** INSERT STACK UNION HERE ***/ - - assert( p->magic==VDBE_MAGIC_RUN ); /* sqlite3_step() verifies this */ - sqlite3VdbeEnter(p); - if( p->rc==SQLITE_NOMEM ){ - /* This happens if a malloc() inside a call to sqlite3_column_text() or - ** sqlite3_column_text16() failed. */ - goto no_mem; - } - assert( p->rc==SQLITE_OK || p->rc==SQLITE_BUSY ); - assert( p->bIsReader || p->readOnly!=0 ); - p->rc = SQLITE_OK; - p->iCurrentTime = 0; - assert( p->explain==0 ); - p->pResultSet = 0; - db->busyHandler.nBusy = 0; - CHECK_FOR_INTERRUPT; - sqlite3VdbeIOTraceSql(p); -#ifndef SQLITE_OMIT_PROGRESS_CALLBACK - if( db->xProgress ){ - assert( 0 < db->nProgressOps ); - nProgressLimit = (unsigned)p->aCounter[SQLITE_STMTSTATUS_VM_STEP]; - if( nProgressLimit==0 ){ - nProgressLimit = db->nProgressOps; - }else{ - nProgressLimit %= (unsigned)db->nProgressOps; - } - } -#endif -#ifdef SQLITE_DEBUG - sqlite3BeginBenignMalloc(); - if( p->pc==0 - && (p->db->flags & (SQLITE_VdbeListing|SQLITE_VdbeEQP|SQLITE_VdbeTrace))!=0 - ){ - int i; - int once = 1; - sqlite3VdbePrintSql(p); - if( p->db->flags & SQLITE_VdbeListing ){ - printf("VDBE Program Listing:\n"); - for(i=0; inOp; i++){ - sqlite3VdbePrintOp(stdout, i, &aOp[i]); - } - } - if( p->db->flags & SQLITE_VdbeEQP ){ - for(i=0; inOp; i++){ - if( aOp[i].opcode==OP_Explain ){ - if( once ) printf("VDBE Query Plan:\n"); - printf("%s\n", aOp[i].p4.z); - once = 0; - } - } - } - if( p->db->flags & SQLITE_VdbeTrace ) printf("VDBE Trace:\n"); - } - sqlite3EndBenignMalloc(); -#endif - for(pc=p->pc; rc==SQLITE_OK; pc++){ - assert( pc>=0 && pcnOp ); - if( db->mallocFailed ) goto no_mem; -#ifdef VDBE_PROFILE - origPc = pc; - start = sqlite3Hwtime(); -#endif - nVmStep++; - pOp = &aOp[pc]; - - /* Only allow tracing if SQLITE_DEBUG is defined. - */ -#ifdef SQLITE_DEBUG - if( db->flags & SQLITE_VdbeTrace ){ - sqlite3VdbePrintOp(stdout, pc, pOp); - } -#endif - - - /* Check to see if we need to simulate an interrupt. This only happens - ** if we have a special test build. - */ -#ifdef SQLITE_TEST - if( sqlite3_interrupt_count>0 ){ - sqlite3_interrupt_count--; - if( sqlite3_interrupt_count==0 ){ - sqlite3_interrupt(db); - } - } -#endif - - /* On any opcode with the "out2-prerelease" tag, free any - ** external allocations out of mem[p2] and set mem[p2] to be - ** an undefined integer. Opcodes will either fill in the integer - ** value or convert mem[p2] to a different type. - */ - assert( pOp->opflags==sqlite3OpcodeProperty[pOp->opcode] ); - if( pOp->opflags & OPFLG_OUT2_PRERELEASE ){ - assert( pOp->p2>0 ); - assert( pOp->p2<=(p->nMem-p->nCursor) ); - pOut = &aMem[pOp->p2]; - memAboutToChange(p, pOut); - VdbeMemRelease(pOut); - pOut->flags = MEM_Int; - } - - /* Sanity checking on other operands */ -#ifdef SQLITE_DEBUG - if( (pOp->opflags & OPFLG_IN1)!=0 ){ - assert( pOp->p1>0 ); - assert( pOp->p1<=(p->nMem-p->nCursor) ); - assert( memIsValid(&aMem[pOp->p1]) ); - REGISTER_TRACE(pOp->p1, &aMem[pOp->p1]); - } - if( (pOp->opflags & OPFLG_IN2)!=0 ){ - assert( pOp->p2>0 ); - assert( pOp->p2<=(p->nMem-p->nCursor) ); - assert( memIsValid(&aMem[pOp->p2]) ); - REGISTER_TRACE(pOp->p2, &aMem[pOp->p2]); - } - if( (pOp->opflags & OPFLG_IN3)!=0 ){ - assert( pOp->p3>0 ); - assert( pOp->p3<=(p->nMem-p->nCursor) ); - assert( memIsValid(&aMem[pOp->p3]) ); - REGISTER_TRACE(pOp->p3, &aMem[pOp->p3]); - } - if( (pOp->opflags & OPFLG_OUT2)!=0 ){ - assert( pOp->p2>0 ); - assert( pOp->p2<=(p->nMem-p->nCursor) ); - memAboutToChange(p, &aMem[pOp->p2]); - } - if( (pOp->opflags & OPFLG_OUT3)!=0 ){ - assert( pOp->p3>0 ); - assert( pOp->p3<=(p->nMem-p->nCursor) ); - memAboutToChange(p, &aMem[pOp->p3]); - } -#endif - - switch( pOp->opcode ){ - -/***************************************************************************** -** What follows is a massive switch statement where each case implements a -** separate instruction in the virtual machine. If we follow the usual -** indentation conventions, each case should be indented by 6 spaces. But -** that is a lot of wasted space on the left margin. So the code within -** the switch statement will break with convention and be flush-left. Another -** big comment (similar to this one) will mark the point in the code where -** we transition back to normal indentation. -** -** The formatting of each case is important. The makefile for SQLite -** generates two C files "opcodes.h" and "opcodes.c" by scanning this -** file looking for lines that begin with "case OP_". The opcodes.h files -** will be filled with #defines that give unique integer values to each -** opcode and the opcodes.c file is filled with an array of strings where -** each string is the symbolic name for the corresponding opcode. If the -** case statement is followed by a comment of the form "/# same as ... #/" -** that comment is used to determine the particular value of the opcode. -** -** Other keywords in the comment that follows each case are used to -** construct the OPFLG_INITIALIZER value that initializes opcodeProperty[]. -** Keywords include: in1, in2, in3, out2_prerelease, out2, out3. See -** the mkopcodeh.awk script for additional information. -** -** Documentation about VDBE opcodes is generated by scanning this file -** for lines of that contain "Opcode:". That line and all subsequent -** comment lines are used in the generation of the opcode.html documentation -** file. -** -** SUMMARY: -** -** Formatting is important to scripts that scan this file. -** Do not deviate from the formatting style currently in use. -** -*****************************************************************************/ - -/* Opcode: Goto * P2 * * * -** -** An unconditional jump to address P2. -** The next instruction executed will be -** the one at index P2 from the beginning of -** the program. -*/ -case OP_Goto: { /* jump */ - pc = pOp->p2 - 1; - - /* Opcodes that are used as the bottom of a loop (OP_Next, OP_Prev, - ** OP_VNext, OP_RowSetNext, or OP_SorterNext) all jump here upon - ** completion. Check to see if sqlite3_interrupt() has been called - ** or if the progress callback needs to be invoked. - ** - ** This code uses unstructured "goto" statements and does not look clean. - ** But that is not due to sloppy coding habits. The code is written this - ** way for performance, to avoid having to run the interrupt and progress - ** checks on every opcode. This helps sqlite3_step() to run about 1.5% - ** faster according to "valgrind --tool=cachegrind" */ -check_for_interrupt: - CHECK_FOR_INTERRUPT; -#ifndef SQLITE_OMIT_PROGRESS_CALLBACK - /* Call the progress callback if it is configured and the required number - ** of VDBE ops have been executed (either since this invocation of - ** sqlite3VdbeExec() or since last time the progress callback was called). - ** If the progress callback returns non-zero, exit the virtual machine with - ** a return code SQLITE_ABORT. - */ - if( db->xProgress!=0 && nVmStep>=nProgressLimit ){ - assert( db->nProgressOps!=0 ); - nProgressLimit = nVmStep + db->nProgressOps - (nVmStep%db->nProgressOps); - if( db->xProgress(db->pProgressArg) ){ - rc = SQLITE_INTERRUPT; - goto vdbe_error_halt; - } - } -#endif - - break; -} - -/* Opcode: Gosub P1 P2 * * * -** -** Write the current address onto register P1 -** and then jump to address P2. -*/ -case OP_Gosub: { /* jump */ - assert( pOp->p1>0 && pOp->p1<=(p->nMem-p->nCursor) ); - pIn1 = &aMem[pOp->p1]; - assert( (pIn1->flags & MEM_Dyn)==0 ); - memAboutToChange(p, pIn1); - pIn1->flags = MEM_Int; - pIn1->u.i = pc; - REGISTER_TRACE(pOp->p1, pIn1); - pc = pOp->p2 - 1; - break; -} - -/* Opcode: Return P1 * * * * -** -** Jump to the next instruction after the address in register P1. -*/ -case OP_Return: { /* in1 */ - pIn1 = &aMem[pOp->p1]; - assert( pIn1->flags & MEM_Int ); - pc = (int)pIn1->u.i; - break; -} - -/* Opcode: Yield P1 * * * * -** -** Swap the program counter with the value in register P1. -*/ -case OP_Yield: { /* in1 */ - int pcDest; - pIn1 = &aMem[pOp->p1]; - assert( (pIn1->flags & MEM_Dyn)==0 ); - pIn1->flags = MEM_Int; - pcDest = (int)pIn1->u.i; - pIn1->u.i = pc; - REGISTER_TRACE(pOp->p1, pIn1); - pc = pcDest; - break; -} - -/* Opcode: HaltIfNull P1 P2 P3 P4 P5 -** Synopsis: if r[P3] null then halt -** -** Check the value in register P3. If it is NULL then Halt using -** parameter P1, P2, and P4 as if this were a Halt instruction. If the -** value in register P3 is not NULL, then this routine is a no-op. -** The P5 parameter should be 1. -*/ -case OP_HaltIfNull: { /* in3 */ - pIn3 = &aMem[pOp->p3]; - if( (pIn3->flags & MEM_Null)==0 ) break; - /* Fall through into OP_Halt */ -} - -/* Opcode: Halt P1 P2 * P4 P5 -** -** Exit immediately. All open cursors, etc are closed -** automatically. -** -** P1 is the result code returned by sqlite3_exec(), sqlite3_reset(), -** or sqlite3_finalize(). For a normal halt, this should be SQLITE_OK (0). -** For errors, it can be some other value. If P1!=0 then P2 will determine -** whether or not to rollback the current transaction. Do not rollback -** if P2==OE_Fail. Do the rollback if P2==OE_Rollback. If P2==OE_Abort, -** then back out all changes that have occurred during this execution of the -** VDBE, but do not rollback the transaction. -** -** If P4 is not null then it is an error message string. -** -** P5 is a value between 0 and 4, inclusive, that modifies the P4 string. -** -** 0: (no change) -** 1: NOT NULL contraint failed: P4 -** 2: UNIQUE constraint failed: P4 -** 3: CHECK constraint failed: P4 -** 4: FOREIGN KEY constraint failed: P4 -** -** If P5 is not zero and P4 is NULL, then everything after the ":" is -** omitted. -** -** There is an implied "Halt 0 0 0" instruction inserted at the very end of -** every program. So a jump past the last instruction of the program -** is the same as executing Halt. -*/ -case OP_Halt: { - const char *zType; - const char *zLogFmt; - - if( pOp->p1==SQLITE_OK && p->pFrame ){ - /* Halt the sub-program. Return control to the parent frame. */ - VdbeFrame *pFrame = p->pFrame; - p->pFrame = pFrame->pParent; - p->nFrame--; - sqlite3VdbeSetChanges(db, p->nChange); - pc = sqlite3VdbeFrameRestore(pFrame); - lastRowid = db->lastRowid; - if( pOp->p2==OE_Ignore ){ - /* Instruction pc is the OP_Program that invoked the sub-program - ** currently being halted. If the p2 instruction of this OP_Halt - ** instruction is set to OE_Ignore, then the sub-program is throwing - ** an IGNORE exception. In this case jump to the address specified - ** as the p2 of the calling OP_Program. */ - pc = p->aOp[pc].p2-1; - } - aOp = p->aOp; - aMem = p->aMem; - break; - } - p->rc = pOp->p1; - p->errorAction = (u8)pOp->p2; - p->pc = pc; - if( p->rc ){ - if( pOp->p5 ){ - static const char * const azType[] = { "NOT NULL", "UNIQUE", "CHECK", - "FOREIGN KEY" }; - assert( pOp->p5>=1 && pOp->p5<=4 ); - testcase( pOp->p5==1 ); - testcase( pOp->p5==2 ); - testcase( pOp->p5==3 ); - testcase( pOp->p5==4 ); - zType = azType[pOp->p5-1]; - }else{ - zType = 0; - } - assert( zType!=0 || pOp->p4.z!=0 ); - zLogFmt = "abort at %d in [%s]: %s"; - if( zType && pOp->p4.z ){ - sqlite3SetString(&p->zErrMsg, db, "%s constraint failed: %s", - zType, pOp->p4.z); - }else if( pOp->p4.z ){ - sqlite3SetString(&p->zErrMsg, db, "%s", pOp->p4.z); - }else{ - sqlite3SetString(&p->zErrMsg, db, "%s constraint failed", zType); - } - sqlite3_log(pOp->p1, zLogFmt, pc, p->zSql, p->zErrMsg); - } - rc = sqlite3VdbeHalt(p); - assert( rc==SQLITE_BUSY || rc==SQLITE_OK || rc==SQLITE_ERROR ); - if( rc==SQLITE_BUSY ){ - p->rc = rc = SQLITE_BUSY; - }else{ - assert( rc==SQLITE_OK || (p->rc&0xff)==SQLITE_CONSTRAINT ); - assert( rc==SQLITE_OK || db->nDeferredCons>0 || db->nDeferredImmCons>0 ); - rc = p->rc ? SQLITE_ERROR : SQLITE_DONE; - } - goto vdbe_return; -} - -/* Opcode: Integer P1 P2 * * * -** Synopsis: r[P2]=P1 -** -** The 32-bit integer value P1 is written into register P2. -*/ -case OP_Integer: { /* out2-prerelease */ - pOut->u.i = pOp->p1; - break; -} - -/* Opcode: Int64 * P2 * P4 * -** Synopsis: r[P2]=P4 -** -** P4 is a pointer to a 64-bit integer value. -** Write that value into register P2. -*/ -case OP_Int64: { /* out2-prerelease */ - assert( pOp->p4.pI64!=0 ); - pOut->u.i = *pOp->p4.pI64; - break; -} - -#ifndef SQLITE_OMIT_FLOATING_POINT -/* Opcode: Real * P2 * P4 * -** Synopsis: r[P2]=P4 -** -** P4 is a pointer to a 64-bit floating point value. -** Write that value into register P2. -*/ -case OP_Real: { /* same as TK_FLOAT, out2-prerelease */ - pOut->flags = MEM_Real; - assert( !sqlite3IsNaN(*pOp->p4.pReal) ); - pOut->r = *pOp->p4.pReal; - break; -} -#endif - -/* Opcode: String8 * P2 * P4 * -** Synopsis: r[P2]='P4' -** -** P4 points to a nul terminated UTF-8 string. This opcode is transformed -** into an OP_String before it is executed for the first time. -*/ -case OP_String8: { /* same as TK_STRING, out2-prerelease */ - assert( pOp->p4.z!=0 ); - pOp->opcode = OP_String; - pOp->p1 = sqlite3Strlen30(pOp->p4.z); - -#ifndef SQLITE_OMIT_UTF16 - if( encoding!=SQLITE_UTF8 ){ - rc = sqlite3VdbeMemSetStr(pOut, pOp->p4.z, -1, SQLITE_UTF8, SQLITE_STATIC); - if( rc==SQLITE_TOOBIG ) goto too_big; - if( SQLITE_OK!=sqlite3VdbeChangeEncoding(pOut, encoding) ) goto no_mem; - assert( pOut->zMalloc==pOut->z ); - assert( pOut->flags & MEM_Dyn ); - pOut->zMalloc = 0; - pOut->flags |= MEM_Static; - pOut->flags &= ~MEM_Dyn; - if( pOp->p4type==P4_DYNAMIC ){ - sqlite3DbFree(db, pOp->p4.z); - } - pOp->p4type = P4_DYNAMIC; - pOp->p4.z = pOut->z; - pOp->p1 = pOut->n; - } -#endif - if( pOp->p1>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } - /* Fall through to the next case, OP_String */ -} - -/* Opcode: String P1 P2 * P4 * -** Synopsis: r[P2]='P4' (len=P1) -** -** The string value P4 of length P1 (bytes) is stored in register P2. -*/ -case OP_String: { /* out2-prerelease */ - assert( pOp->p4.z!=0 ); - pOut->flags = MEM_Str|MEM_Static|MEM_Term; - pOut->z = pOp->p4.z; - pOut->n = pOp->p1; - pOut->enc = encoding; - UPDATE_MAX_BLOBSIZE(pOut); - break; -} - -/* Opcode: Null P1 P2 P3 * * -** Synopsis: r[P2..P3]=NULL -** -** Write a NULL into registers P2. If P3 greater than P2, then also write -** NULL into register P3 and every register in between P2 and P3. If P3 -** is less than P2 (typically P3 is zero) then only register P2 is -** set to NULL. -** -** If the P1 value is non-zero, then also set the MEM_Cleared flag so that -** NULL values will not compare equal even if SQLITE_NULLEQ is set on -** OP_Ne or OP_Eq. -*/ -case OP_Null: { /* out2-prerelease */ - int cnt; - u16 nullFlag; - cnt = pOp->p3-pOp->p2; - assert( pOp->p3<=(p->nMem-p->nCursor) ); - pOut->flags = nullFlag = pOp->p1 ? (MEM_Null|MEM_Cleared) : MEM_Null; - while( cnt>0 ){ - pOut++; - memAboutToChange(p, pOut); - VdbeMemRelease(pOut); - pOut->flags = nullFlag; - cnt--; - } - break; -} - - -/* Opcode: Blob P1 P2 * P4 -** Synopsis: r[P2]=P4 (len=P1) -** -** P4 points to a blob of data P1 bytes long. Store this -** blob in register P2. -*/ -case OP_Blob: { /* out2-prerelease */ - assert( pOp->p1 <= SQLITE_MAX_LENGTH ); - sqlite3VdbeMemSetStr(pOut, pOp->p4.z, pOp->p1, 0, 0); - pOut->enc = encoding; - UPDATE_MAX_BLOBSIZE(pOut); - break; -} - -/* Opcode: Variable P1 P2 * P4 * -** Synopsis: r[P2]=parameter(P1,P4) -** -** Transfer the values of bound parameter P1 into register P2 -** -** If the parameter is named, then its name appears in P4 and P3==1. -** The P4 value is used by sqlite3_bind_parameter_name(). -*/ -case OP_Variable: { /* out2-prerelease */ - Mem *pVar; /* Value being transferred */ - - assert( pOp->p1>0 && pOp->p1<=p->nVar ); - assert( pOp->p4.z==0 || pOp->p4.z==p->azVar[pOp->p1-1] ); - pVar = &p->aVar[pOp->p1 - 1]; - if( sqlite3VdbeMemTooBig(pVar) ){ - goto too_big; - } - sqlite3VdbeMemShallowCopy(pOut, pVar, MEM_Static); - UPDATE_MAX_BLOBSIZE(pOut); - break; -} - -/* Opcode: Move P1 P2 P3 * * -** Synopsis: r[P2@P3]=r[P1@P3] -** -** Move the values in register P1..P1+P3 over into -** registers P2..P2+P3. Registers P1..P1+P3 are -** left holding a NULL. It is an error for register ranges -** P1..P1+P3 and P2..P2+P3 to overlap. -*/ -case OP_Move: { - char *zMalloc; /* Holding variable for allocated memory */ - int n; /* Number of registers left to copy */ - int p1; /* Register to copy from */ - int p2; /* Register to copy to */ - - n = pOp->p3; - p1 = pOp->p1; - p2 = pOp->p2; - assert( n>=0 && p1>0 && p2>0 ); - assert( p1+n<=p2 || p2+n<=p1 ); - - pIn1 = &aMem[p1]; - pOut = &aMem[p2]; - do{ - assert( pOut<=&aMem[(p->nMem-p->nCursor)] ); - assert( pIn1<=&aMem[(p->nMem-p->nCursor)] ); - assert( memIsValid(pIn1) ); - memAboutToChange(p, pOut); - zMalloc = pOut->zMalloc; - pOut->zMalloc = 0; - sqlite3VdbeMemMove(pOut, pIn1); -#ifdef SQLITE_DEBUG - if( pOut->pScopyFrom>=&aMem[p1] && pOut->pScopyFrom<&aMem[p1+pOp->p3] ){ - pOut->pScopyFrom += p1 - pOp->p2; - } -#endif - pIn1->zMalloc = zMalloc; - REGISTER_TRACE(p2++, pOut); - pIn1++; - pOut++; - }while( n-- ); - break; -} - -/* Opcode: Copy P1 P2 P3 * * -** Synopsis: r[P2@P3+1]=r[P1@P3+1] -** -** Make a copy of registers P1..P1+P3 into registers P2..P2+P3. -** -** This instruction makes a deep copy of the value. A duplicate -** is made of any string or blob constant. See also OP_SCopy. -*/ -case OP_Copy: { - int n; - - n = pOp->p3; - pIn1 = &aMem[pOp->p1]; - pOut = &aMem[pOp->p2]; - assert( pOut!=pIn1 ); - while( 1 ){ - sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); - Deephemeralize(pOut); -#ifdef SQLITE_DEBUG - pOut->pScopyFrom = 0; -#endif - REGISTER_TRACE(pOp->p2+pOp->p3-n, pOut); - if( (n--)==0 ) break; - pOut++; - pIn1++; - } - break; -} - -/* Opcode: SCopy P1 P2 * * * -** Synopsis: r[P2]=r[P1] -** -** Make a shallow copy of register P1 into register P2. -** -** This instruction makes a shallow copy of the value. If the value -** is a string or blob, then the copy is only a pointer to the -** original and hence if the original changes so will the copy. -** Worse, if the original is deallocated, the copy becomes invalid. -** Thus the program must guarantee that the original will not change -** during the lifetime of the copy. Use OP_Copy to make a complete -** copy. -*/ -case OP_SCopy: { /* out2 */ - pIn1 = &aMem[pOp->p1]; - pOut = &aMem[pOp->p2]; - assert( pOut!=pIn1 ); - sqlite3VdbeMemShallowCopy(pOut, pIn1, MEM_Ephem); -#ifdef SQLITE_DEBUG - if( pOut->pScopyFrom==0 ) pOut->pScopyFrom = pIn1; -#endif - break; -} - -/* Opcode: ResultRow P1 P2 * * * -** Synopsis: output=r[P1@P2] -** -** The registers P1 through P1+P2-1 contain a single row of -** results. This opcode causes the sqlite3_step() call to terminate -** with an SQLITE_ROW return code and it sets up the sqlite3_stmt -** structure to provide access to the top P1 values as the result -** row. -*/ -case OP_ResultRow: { - Mem *pMem; - int i; - assert( p->nResColumn==pOp->p2 ); - assert( pOp->p1>0 ); - assert( pOp->p1+pOp->p2<=(p->nMem-p->nCursor)+1 ); - -#ifndef SQLITE_OMIT_PROGRESS_CALLBACK - /* Run the progress counter just before returning. - */ - if( db->xProgress!=0 - && nVmStep>=nProgressLimit - && db->xProgress(db->pProgressArg)!=0 - ){ - rc = SQLITE_INTERRUPT; - goto vdbe_error_halt; - } -#endif - - /* If this statement has violated immediate foreign key constraints, do - ** not return the number of rows modified. And do not RELEASE the statement - ** transaction. It needs to be rolled back. */ - if( SQLITE_OK!=(rc = sqlite3VdbeCheckFk(p, 0)) ){ - assert( db->flags&SQLITE_CountRows ); - assert( p->usesStmtJournal ); - break; - } - - /* If the SQLITE_CountRows flag is set in sqlite3.flags mask, then - ** DML statements invoke this opcode to return the number of rows - ** modified to the user. This is the only way that a VM that - ** opens a statement transaction may invoke this opcode. - ** - ** In case this is such a statement, close any statement transaction - ** opened by this VM before returning control to the user. This is to - ** ensure that statement-transactions are always nested, not overlapping. - ** If the open statement-transaction is not closed here, then the user - ** may step another VM that opens its own statement transaction. This - ** may lead to overlapping statement transactions. - ** - ** The statement transaction is never a top-level transaction. Hence - ** the RELEASE call below can never fail. - */ - assert( p->iStatement==0 || db->flags&SQLITE_CountRows ); - rc = sqlite3VdbeCloseStatement(p, SAVEPOINT_RELEASE); - if( NEVER(rc!=SQLITE_OK) ){ - break; - } - - /* Invalidate all ephemeral cursor row caches */ - p->cacheCtr = (p->cacheCtr + 2)|1; - - /* Make sure the results of the current row are \000 terminated - ** and have an assigned type. The results are de-ephemeralized as - ** a side effect. - */ - pMem = p->pResultSet = &aMem[pOp->p1]; - for(i=0; ip2; i++){ - assert( memIsValid(&pMem[i]) ); - Deephemeralize(&pMem[i]); - assert( (pMem[i].flags & MEM_Ephem)==0 - || (pMem[i].flags & (MEM_Str|MEM_Blob))==0 ); - sqlite3VdbeMemNulTerminate(&pMem[i]); - sqlite3VdbeMemStoreType(&pMem[i]); - REGISTER_TRACE(pOp->p1+i, &pMem[i]); - } - if( db->mallocFailed ) goto no_mem; - - /* Return SQLITE_ROW - */ - p->pc = pc + 1; - rc = SQLITE_ROW; - goto vdbe_return; -} - -/* Opcode: Concat P1 P2 P3 * * -** Synopsis: r[P3]=r[P2]+r[P1] -** -** Add the text in register P1 onto the end of the text in -** register P2 and store the result in register P3. -** If either the P1 or P2 text are NULL then store NULL in P3. -** -** P3 = P2 || P1 -** -** It is illegal for P1 and P3 to be the same register. Sometimes, -** if P3 is the same register as P2, the implementation is able -** to avoid a memcpy(). -*/ -case OP_Concat: { /* same as TK_CONCAT, in1, in2, out3 */ - i64 nByte; - - pIn1 = &aMem[pOp->p1]; - pIn2 = &aMem[pOp->p2]; - pOut = &aMem[pOp->p3]; - assert( pIn1!=pOut ); - if( (pIn1->flags | pIn2->flags) & MEM_Null ){ - sqlite3VdbeMemSetNull(pOut); - break; - } - if( ExpandBlob(pIn1) || ExpandBlob(pIn2) ) goto no_mem; - Stringify(pIn1, encoding); - Stringify(pIn2, encoding); - nByte = pIn1->n + pIn2->n; - if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } - MemSetTypeFlag(pOut, MEM_Str); - if( sqlite3VdbeMemGrow(pOut, (int)nByte+2, pOut==pIn2) ){ - goto no_mem; - } - if( pOut!=pIn2 ){ - memcpy(pOut->z, pIn2->z, pIn2->n); - } - memcpy(&pOut->z[pIn2->n], pIn1->z, pIn1->n); - pOut->z[nByte]=0; - pOut->z[nByte+1] = 0; - pOut->flags |= MEM_Term; - pOut->n = (int)nByte; - pOut->enc = encoding; - UPDATE_MAX_BLOBSIZE(pOut); - break; -} - -/* Opcode: Add P1 P2 P3 * * -** Synopsis: r[P3]=r[P1]+r[P2] -** -** Add the value in register P1 to the value in register P2 -** and store the result in register P3. -** If either input is NULL, the result is NULL. -*/ -/* Opcode: Multiply P1 P2 P3 * * -** Synopsis: r[P3]=r[P1]*r[P2] -** -** -** Multiply the value in register P1 by the value in register P2 -** and store the result in register P3. -** If either input is NULL, the result is NULL. -*/ -/* Opcode: Subtract P1 P2 P3 * * -** Synopsis: r[P3]=r[P2]-r[P1] -** -** Subtract the value in register P1 from the value in register P2 -** and store the result in register P3. -** If either input is NULL, the result is NULL. -*/ -/* Opcode: Divide P1 P2 P3 * * -** Synopsis: r[P3]=r[P2]/r[P1] -** -** Divide the value in register P1 by the value in register P2 -** and store the result in register P3 (P3=P2/P1). If the value in -** register P1 is zero, then the result is NULL. If either input is -** NULL, the result is NULL. -*/ -/* Opcode: Remainder P1 P2 P3 * * -** Synopsis: r[P3]=r[P2]%r[P1] -** -** Compute the remainder after integer register P2 is divided by -** register P1 and store the result in register P3. -** If the value in register P1 is zero the result is NULL. -** If either operand is NULL, the result is NULL. -*/ -case OP_Add: /* same as TK_PLUS, in1, in2, out3 */ -case OP_Subtract: /* same as TK_MINUS, in1, in2, out3 */ -case OP_Multiply: /* same as TK_STAR, in1, in2, out3 */ -case OP_Divide: /* same as TK_SLASH, in1, in2, out3 */ -case OP_Remainder: { /* same as TK_REM, in1, in2, out3 */ - char bIntint; /* Started out as two integer operands */ - int flags; /* Combined MEM_* flags from both inputs */ - i64 iA; /* Integer value of left operand */ - i64 iB; /* Integer value of right operand */ - double rA; /* Real value of left operand */ - double rB; /* Real value of right operand */ - - pIn1 = &aMem[pOp->p1]; - applyNumericAffinity(pIn1); - pIn2 = &aMem[pOp->p2]; - applyNumericAffinity(pIn2); - pOut = &aMem[pOp->p3]; - flags = pIn1->flags | pIn2->flags; - if( (flags & MEM_Null)!=0 ) goto arithmetic_result_is_null; - if( (pIn1->flags & pIn2->flags & MEM_Int)==MEM_Int ){ - iA = pIn1->u.i; - iB = pIn2->u.i; - bIntint = 1; - switch( pOp->opcode ){ - case OP_Add: if( sqlite3AddInt64(&iB,iA) ) goto fp_math; break; - case OP_Subtract: if( sqlite3SubInt64(&iB,iA) ) goto fp_math; break; - case OP_Multiply: if( sqlite3MulInt64(&iB,iA) ) goto fp_math; break; - case OP_Divide: { - if( iA==0 ) goto arithmetic_result_is_null; - if( iA==-1 && iB==SMALLEST_INT64 ) goto fp_math; - iB /= iA; - break; - } - default: { - if( iA==0 ) goto arithmetic_result_is_null; - if( iA==-1 ) iA = 1; - iB %= iA; - break; - } - } - pOut->u.i = iB; - MemSetTypeFlag(pOut, MEM_Int); - }else{ - bIntint = 0; -fp_math: - rA = sqlite3VdbeRealValue(pIn1); - rB = sqlite3VdbeRealValue(pIn2); - switch( pOp->opcode ){ - case OP_Add: rB += rA; break; - case OP_Subtract: rB -= rA; break; - case OP_Multiply: rB *= rA; break; - case OP_Divide: { - /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ - if( rA==(double)0 ) goto arithmetic_result_is_null; - rB /= rA; - break; - } - default: { - iA = (i64)rA; - iB = (i64)rB; - if( iA==0 ) goto arithmetic_result_is_null; - if( iA==-1 ) iA = 1; - rB = (double)(iB % iA); - break; - } - } -#ifdef SQLITE_OMIT_FLOATING_POINT - pOut->u.i = rB; - MemSetTypeFlag(pOut, MEM_Int); -#else - if( sqlite3IsNaN(rB) ){ - goto arithmetic_result_is_null; - } - pOut->r = rB; - MemSetTypeFlag(pOut, MEM_Real); - if( (flags & MEM_Real)==0 && !bIntint ){ - sqlite3VdbeIntegerAffinity(pOut); - } -#endif - } - break; - -arithmetic_result_is_null: - sqlite3VdbeMemSetNull(pOut); - break; -} - -/* Opcode: CollSeq P1 * * P4 -** -** P4 is a pointer to a CollSeq struct. If the next call to a user function -** or aggregate calls sqlite3GetFuncCollSeq(), this collation sequence will -** be returned. This is used by the built-in min(), max() and nullif() -** functions. -** -** If P1 is not zero, then it is a register that a subsequent min() or -** max() aggregate will set to 1 if the current row is not the minimum or -** maximum. The P1 register is initialized to 0 by this instruction. -** -** The interface used by the implementation of the aforementioned functions -** to retrieve the collation sequence set by this opcode is not available -** publicly, only to user functions defined in func.c. -*/ -case OP_CollSeq: { - assert( pOp->p4type==P4_COLLSEQ ); - if( pOp->p1 ){ - sqlite3VdbeMemSetInt64(&aMem[pOp->p1], 0); - } - break; -} - -/* Opcode: Function P1 P2 P3 P4 P5 -** Synopsis: r[P3]=func(r[P2@P5]) -** -** Invoke a user function (P4 is a pointer to a Function structure that -** defines the function) with P5 arguments taken from register P2 and -** successors. The result of the function is stored in register P3. -** Register P3 must not be one of the function inputs. -** -** P1 is a 32-bit bitmask indicating whether or not each argument to the -** function was determined to be constant at compile time. If the first -** argument was constant then bit 0 of P1 is set. This is used to determine -** whether meta data associated with a user function argument using the -** sqlite3_set_auxdata() API may be safely retained until the next -** invocation of this opcode. -** -** See also: AggStep and AggFinal -*/ -case OP_Function: { - int i; - Mem *pArg; - sqlite3_context ctx; - sqlite3_value **apVal; - int n; - - n = pOp->p5; - apVal = p->apArg; - assert( apVal || n==0 ); - assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); - pOut = &aMem[pOp->p3]; - memAboutToChange(p, pOut); - - assert( n==0 || (pOp->p2>0 && pOp->p2+n<=(p->nMem-p->nCursor)+1) ); - assert( pOp->p3p2 || pOp->p3>=pOp->p2+n ); - pArg = &aMem[pOp->p2]; - for(i=0; ip2+i, pArg); - } - - assert( pOp->p4type==P4_FUNCDEF ); - ctx.pFunc = pOp->p4.pFunc; - ctx.iOp = pc; - ctx.pVdbe = p; - - /* The output cell may already have a buffer allocated. Move - ** the pointer to ctx.s so in case the user-function can use - ** the already allocated buffer instead of allocating a new one. - */ - memcpy(&ctx.s, pOut, sizeof(Mem)); - pOut->flags = MEM_Null; - pOut->xDel = 0; - pOut->zMalloc = 0; - MemSetTypeFlag(&ctx.s, MEM_Null); - - ctx.fErrorOrAux = 0; - if( ctx.pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ - assert( pOp>aOp ); - assert( pOp[-1].p4type==P4_COLLSEQ ); - assert( pOp[-1].opcode==OP_CollSeq ); - ctx.pColl = pOp[-1].p4.pColl; - } - db->lastRowid = lastRowid; - (*ctx.pFunc->xFunc)(&ctx, n, apVal); /* IMP: R-24505-23230 */ - lastRowid = db->lastRowid; - - if( db->mallocFailed ){ - /* Even though a malloc() has failed, the implementation of the - ** user function may have called an sqlite3_result_XXX() function - ** to return a value. The following call releases any resources - ** associated with such a value. - */ - sqlite3VdbeMemRelease(&ctx.s); - goto no_mem; - } - - /* If the function returned an error, throw an exception */ - if( ctx.fErrorOrAux ){ - if( ctx.isError ){ - sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&ctx.s)); - rc = ctx.isError; - } - sqlite3VdbeDeleteAuxData(p, pc, pOp->p1); - } - - /* Copy the result of the function into register P3 */ - sqlite3VdbeChangeEncoding(&ctx.s, encoding); - assert( pOut->flags==MEM_Null ); - memcpy(pOut, &ctx.s, sizeof(Mem)); - if( sqlite3VdbeMemTooBig(pOut) ){ - goto too_big; - } - -#if 0 - /* The app-defined function has done something that as caused this - ** statement to expire. (Perhaps the function called sqlite3_exec() - ** with a CREATE TABLE statement.) - */ - if( p->expired ) rc = SQLITE_ABORT; -#endif - - REGISTER_TRACE(pOp->p3, pOut); - UPDATE_MAX_BLOBSIZE(pOut); - break; -} - -/* Opcode: BitAnd P1 P2 P3 * * -** Synopsis: r[P3]=r[P1]&r[P2] -** -** Take the bit-wise AND of the values in register P1 and P2 and -** store the result in register P3. -** If either input is NULL, the result is NULL. -*/ -/* Opcode: BitOr P1 P2 P3 * * -** Synopsis: r[P3]=r[P1]|r[P2] -** -** Take the bit-wise OR of the values in register P1 and P2 and -** store the result in register P3. -** If either input is NULL, the result is NULL. -*/ -/* Opcode: ShiftLeft P1 P2 P3 * * -** Synopsis: r[P3]=r[P2]<>r[P1] -** -** Shift the integer value in register P2 to the right by the -** number of bits specified by the integer in register P1. -** Store the result in register P3. -** If either input is NULL, the result is NULL. -*/ -case OP_BitAnd: /* same as TK_BITAND, in1, in2, out3 */ -case OP_BitOr: /* same as TK_BITOR, in1, in2, out3 */ -case OP_ShiftLeft: /* same as TK_LSHIFT, in1, in2, out3 */ -case OP_ShiftRight: { /* same as TK_RSHIFT, in1, in2, out3 */ - i64 iA; - u64 uA; - i64 iB; - u8 op; - - pIn1 = &aMem[pOp->p1]; - pIn2 = &aMem[pOp->p2]; - pOut = &aMem[pOp->p3]; - if( (pIn1->flags | pIn2->flags) & MEM_Null ){ - sqlite3VdbeMemSetNull(pOut); - break; - } - iA = sqlite3VdbeIntValue(pIn2); - iB = sqlite3VdbeIntValue(pIn1); - op = pOp->opcode; - if( op==OP_BitAnd ){ - iA &= iB; - }else if( op==OP_BitOr ){ - iA |= iB; - }else if( iB!=0 ){ - assert( op==OP_ShiftRight || op==OP_ShiftLeft ); - - /* If shifting by a negative amount, shift in the other direction */ - if( iB<0 ){ - assert( OP_ShiftRight==OP_ShiftLeft+1 ); - op = 2*OP_ShiftLeft + 1 - op; - iB = iB>(-64) ? -iB : 64; - } - - if( iB>=64 ){ - iA = (iA>=0 || op==OP_ShiftLeft) ? 0 : -1; - }else{ - memcpy(&uA, &iA, sizeof(uA)); - if( op==OP_ShiftLeft ){ - uA <<= iB; - }else{ - uA >>= iB; - /* Sign-extend on a right shift of a negative number */ - if( iA<0 ) uA |= ((((u64)0xffffffff)<<32)|0xffffffff) << (64-iB); - } - memcpy(&iA, &uA, sizeof(iA)); - } - } - pOut->u.i = iA; - MemSetTypeFlag(pOut, MEM_Int); - break; -} - -/* Opcode: AddImm P1 P2 * * * -** Synopsis: r[P1]=r[P1]+P2 -** -** Add the constant P2 to the value in register P1. -** The result is always an integer. -** -** To force any register to be an integer, just add 0. -*/ -case OP_AddImm: { /* in1 */ - pIn1 = &aMem[pOp->p1]; - memAboutToChange(p, pIn1); - sqlite3VdbeMemIntegerify(pIn1); - pIn1->u.i += pOp->p2; - break; -} - -/* Opcode: MustBeInt P1 P2 * * * -** -** Force the value in register P1 to be an integer. If the value -** in P1 is not an integer and cannot be converted into an integer -** without data loss, then jump immediately to P2, or if P2==0 -** raise an SQLITE_MISMATCH exception. -*/ -case OP_MustBeInt: { /* jump, in1 */ - pIn1 = &aMem[pOp->p1]; - if( (pIn1->flags & MEM_Int)==0 ){ - applyAffinity(pIn1, SQLITE_AFF_NUMERIC, encoding); - if( (pIn1->flags & MEM_Int)==0 ){ - if( pOp->p2==0 ){ - rc = SQLITE_MISMATCH; - goto abort_due_to_error; - }else{ - pc = pOp->p2 - 1; - break; - } - } - } - MemSetTypeFlag(pIn1, MEM_Int); - break; -} - -#ifndef SQLITE_OMIT_FLOATING_POINT -/* Opcode: RealAffinity P1 * * * * -** -** If register P1 holds an integer convert it to a real value. -** -** This opcode is used when extracting information from a column that -** has REAL affinity. Such column values may still be stored as -** integers, for space efficiency, but after extraction we want them -** to have only a real value. -*/ -case OP_RealAffinity: { /* in1 */ - pIn1 = &aMem[pOp->p1]; - if( pIn1->flags & MEM_Int ){ - sqlite3VdbeMemRealify(pIn1); - } - break; -} -#endif - -#ifndef SQLITE_OMIT_CAST -/* Opcode: ToText P1 * * * * -** -** Force the value in register P1 to be text. -** If the value is numeric, convert it to a string using the -** equivalent of printf(). Blob values are unchanged and -** are afterwards simply interpreted as text. -** -** A NULL value is not changed by this routine. It remains NULL. -*/ -case OP_ToText: { /* same as TK_TO_TEXT, in1 */ - pIn1 = &aMem[pOp->p1]; - memAboutToChange(p, pIn1); - if( pIn1->flags & MEM_Null ) break; - assert( MEM_Str==(MEM_Blob>>3) ); - pIn1->flags |= (pIn1->flags&MEM_Blob)>>3; - applyAffinity(pIn1, SQLITE_AFF_TEXT, encoding); - rc = ExpandBlob(pIn1); - assert( pIn1->flags & MEM_Str || db->mallocFailed ); - pIn1->flags &= ~(MEM_Int|MEM_Real|MEM_Blob|MEM_Zero); - UPDATE_MAX_BLOBSIZE(pIn1); - break; -} - -/* Opcode: ToBlob P1 * * * * -** -** Force the value in register P1 to be a BLOB. -** If the value is numeric, convert it to a string first. -** Strings are simply reinterpreted as blobs with no change -** to the underlying data. -** -** A NULL value is not changed by this routine. It remains NULL. -*/ -case OP_ToBlob: { /* same as TK_TO_BLOB, in1 */ - pIn1 = &aMem[pOp->p1]; - if( pIn1->flags & MEM_Null ) break; - if( (pIn1->flags & MEM_Blob)==0 ){ - applyAffinity(pIn1, SQLITE_AFF_TEXT, encoding); - assert( pIn1->flags & MEM_Str || db->mallocFailed ); - MemSetTypeFlag(pIn1, MEM_Blob); - }else{ - pIn1->flags &= ~(MEM_TypeMask&~MEM_Blob); - } - UPDATE_MAX_BLOBSIZE(pIn1); - break; -} - -/* Opcode: ToNumeric P1 * * * * -** -** Force the value in register P1 to be numeric (either an -** integer or a floating-point number.) -** If the value is text or blob, try to convert it to an using the -** equivalent of atoi() or atof() and store 0 if no such conversion -** is possible. -** -** A NULL value is not changed by this routine. It remains NULL. -*/ -case OP_ToNumeric: { /* same as TK_TO_NUMERIC, in1 */ - pIn1 = &aMem[pOp->p1]; - sqlite3VdbeMemNumerify(pIn1); - break; -} -#endif /* SQLITE_OMIT_CAST */ - -/* Opcode: ToInt P1 * * * * -** -** Force the value in register P1 to be an integer. If -** The value is currently a real number, drop its fractional part. -** If the value is text or blob, try to convert it to an integer using the -** equivalent of atoi() and store 0 if no such conversion is possible. -** -** A NULL value is not changed by this routine. It remains NULL. -*/ -case OP_ToInt: { /* same as TK_TO_INT, in1 */ - pIn1 = &aMem[pOp->p1]; - if( (pIn1->flags & MEM_Null)==0 ){ - sqlite3VdbeMemIntegerify(pIn1); - } - break; -} - -#if !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_FLOATING_POINT) -/* Opcode: ToReal P1 * * * * -** -** Force the value in register P1 to be a floating point number. -** If The value is currently an integer, convert it. -** If the value is text or blob, try to convert it to an integer using the -** equivalent of atoi() and store 0.0 if no such conversion is possible. -** -** A NULL value is not changed by this routine. It remains NULL. -*/ -case OP_ToReal: { /* same as TK_TO_REAL, in1 */ - pIn1 = &aMem[pOp->p1]; - memAboutToChange(p, pIn1); - if( (pIn1->flags & MEM_Null)==0 ){ - sqlite3VdbeMemRealify(pIn1); - } - break; -} -#endif /* !defined(SQLITE_OMIT_CAST) && !defined(SQLITE_OMIT_FLOATING_POINT) */ - -/* Opcode: Lt P1 P2 P3 P4 P5 -** Synopsis: if r[P1]r[P3] goto P2 -** -** This works just like the Lt opcode except that the jump is taken if -** the content of register P3 is greater than the content of -** register P1. See the Lt opcode for additional information. -*/ -/* Opcode: Ge P1 P2 P3 P4 P5 -** Synopsis: if r[P1]>=r[P3] goto P2 -** -** This works just like the Lt opcode except that the jump is taken if -** the content of register P3 is greater than or equal to the content of -** register P1. See the Lt opcode for additional information. -*/ -case OP_Eq: /* same as TK_EQ, jump, in1, in3 */ -case OP_Ne: /* same as TK_NE, jump, in1, in3 */ -case OP_Lt: /* same as TK_LT, jump, in1, in3 */ -case OP_Le: /* same as TK_LE, jump, in1, in3 */ -case OP_Gt: /* same as TK_GT, jump, in1, in3 */ -case OP_Ge: { /* same as TK_GE, jump, in1, in3 */ - int res; /* Result of the comparison of pIn1 against pIn3 */ - char affinity; /* Affinity to use for comparison */ - u16 flags1; /* Copy of initial value of pIn1->flags */ - u16 flags3; /* Copy of initial value of pIn3->flags */ - - pIn1 = &aMem[pOp->p1]; - pIn3 = &aMem[pOp->p3]; - flags1 = pIn1->flags; - flags3 = pIn3->flags; - if( (flags1 | flags3)&MEM_Null ){ - /* One or both operands are NULL */ - if( pOp->p5 & SQLITE_NULLEQ ){ - /* If SQLITE_NULLEQ is set (which will only happen if the operator is - ** OP_Eq or OP_Ne) then take the jump or not depending on whether - ** or not both operands are null. - */ - assert( pOp->opcode==OP_Eq || pOp->opcode==OP_Ne ); - assert( (flags1 & MEM_Cleared)==0 ); - if( (flags1&MEM_Null)!=0 - && (flags3&MEM_Null)!=0 - && (flags3&MEM_Cleared)==0 - ){ - res = 0; /* Results are equal */ - }else{ - res = 1; /* Results are not equal */ - } - }else{ - /* SQLITE_NULLEQ is clear and at least one operand is NULL, - ** then the result is always NULL. - ** The jump is taken if the SQLITE_JUMPIFNULL bit is set. - */ - if( pOp->p5 & SQLITE_JUMPIFNULL ){ - pc = pOp->p2-1; - }else if( pOp->p5 & SQLITE_STOREP2 ){ - pOut = &aMem[pOp->p2]; - MemSetTypeFlag(pOut, MEM_Null); - REGISTER_TRACE(pOp->p2, pOut); - } - break; - } - }else{ - /* Neither operand is NULL. Do a comparison. */ - affinity = pOp->p5 & SQLITE_AFF_MASK; - if( affinity ){ - applyAffinity(pIn1, affinity, encoding); - applyAffinity(pIn3, affinity, encoding); - if( db->mallocFailed ) goto no_mem; - } - - assert( pOp->p4type==P4_COLLSEQ || pOp->p4.pColl==0 ); - ExpandBlob(pIn1); - ExpandBlob(pIn3); - res = sqlite3MemCompare(pIn3, pIn1, pOp->p4.pColl); - } - switch( pOp->opcode ){ - case OP_Eq: res = res==0; break; - case OP_Ne: res = res!=0; break; - case OP_Lt: res = res<0; break; - case OP_Le: res = res<=0; break; - case OP_Gt: res = res>0; break; - default: res = res>=0; break; - } - - if( pOp->p5 & SQLITE_STOREP2 ){ - pOut = &aMem[pOp->p2]; - memAboutToChange(p, pOut); - MemSetTypeFlag(pOut, MEM_Int); - pOut->u.i = res; - REGISTER_TRACE(pOp->p2, pOut); - }else if( res ){ - pc = pOp->p2-1; - } - - /* Undo any changes made by applyAffinity() to the input registers. */ - pIn1->flags = (pIn1->flags&~MEM_TypeMask) | (flags1&MEM_TypeMask); - pIn3->flags = (pIn3->flags&~MEM_TypeMask) | (flags3&MEM_TypeMask); - break; -} - -/* Opcode: Permutation * * * P4 * -** -** Set the permutation used by the OP_Compare operator to be the array -** of integers in P4. -** -** The permutation is only valid until the next OP_Compare that has -** the OPFLAG_PERMUTE bit set in P5. Typically the OP_Permutation should -** occur immediately prior to the OP_Compare. -*/ -case OP_Permutation: { - assert( pOp->p4type==P4_INTARRAY ); - assert( pOp->p4.ai ); - aPermute = pOp->p4.ai; - break; -} - -/* Opcode: Compare P1 P2 P3 P4 P5 -** -** Compare two vectors of registers in reg(P1)..reg(P1+P3-1) (call this -** vector "A") and in reg(P2)..reg(P2+P3-1) ("B"). Save the result of -** the comparison for use by the next OP_Jump instruct. -** -** If P5 has the OPFLAG_PERMUTE bit set, then the order of comparison is -** determined by the most recent OP_Permutation operator. If the -** OPFLAG_PERMUTE bit is clear, then register are compared in sequential -** order. -** -** P4 is a KeyInfo structure that defines collating sequences and sort -** orders for the comparison. The permutation applies to registers -** only. The KeyInfo elements are used sequentially. -** -** The comparison is a sort comparison, so NULLs compare equal, -** NULLs are less than numbers, numbers are less than strings, -** and strings are less than blobs. -*/ -case OP_Compare: { - int n; - int i; - int p1; - int p2; - const KeyInfo *pKeyInfo; - int idx; - CollSeq *pColl; /* Collating sequence to use on this term */ - int bRev; /* True for DESCENDING sort order */ - - if( (pOp->p5 & OPFLAG_PERMUTE)==0 ) aPermute = 0; - n = pOp->p3; - pKeyInfo = pOp->p4.pKeyInfo; - assert( n>0 ); - assert( pKeyInfo!=0 ); - p1 = pOp->p1; - p2 = pOp->p2; -#if SQLITE_DEBUG - if( aPermute ){ - int k, mx = 0; - for(k=0; kmx ) mx = aPermute[k]; - assert( p1>0 && p1+mx<=(p->nMem-p->nCursor)+1 ); - assert( p2>0 && p2+mx<=(p->nMem-p->nCursor)+1 ); - }else{ - assert( p1>0 && p1+n<=(p->nMem-p->nCursor)+1 ); - assert( p2>0 && p2+n<=(p->nMem-p->nCursor)+1 ); - } -#endif /* SQLITE_DEBUG */ - for(i=0; inField ); - pColl = pKeyInfo->aColl[i]; - bRev = pKeyInfo->aSortOrder[i]; - iCompare = sqlite3MemCompare(&aMem[p1+idx], &aMem[p2+idx], pColl); - if( iCompare ){ - if( bRev ) iCompare = -iCompare; - break; - } - } - aPermute = 0; - break; -} - -/* Opcode: Jump P1 P2 P3 * * -** -** Jump to the instruction at address P1, P2, or P3 depending on whether -** in the most recent OP_Compare instruction the P1 vector was less than -** equal to, or greater than the P2 vector, respectively. -*/ -case OP_Jump: { /* jump */ - if( iCompare<0 ){ - pc = pOp->p1 - 1; - }else if( iCompare==0 ){ - pc = pOp->p2 - 1; - }else{ - pc = pOp->p3 - 1; - } - break; -} - -/* Opcode: And P1 P2 P3 * * -** Synopsis: r[P3]=(r[P1] && r[P2]) -** -** Take the logical AND of the values in registers P1 and P2 and -** write the result into register P3. -** -** If either P1 or P2 is 0 (false) then the result is 0 even if -** the other input is NULL. A NULL and true or two NULLs give -** a NULL output. -*/ -/* Opcode: Or P1 P2 P3 * * -** Synopsis: r[P3]=(r[P1] || r[P2]) -** -** Take the logical OR of the values in register P1 and P2 and -** store the answer in register P3. -** -** If either P1 or P2 is nonzero (true) then the result is 1 (true) -** even if the other input is NULL. A NULL and false or two NULLs -** give a NULL output. -*/ -case OP_And: /* same as TK_AND, in1, in2, out3 */ -case OP_Or: { /* same as TK_OR, in1, in2, out3 */ - int v1; /* Left operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ - int v2; /* Right operand: 0==FALSE, 1==TRUE, 2==UNKNOWN or NULL */ - - pIn1 = &aMem[pOp->p1]; - if( pIn1->flags & MEM_Null ){ - v1 = 2; - }else{ - v1 = sqlite3VdbeIntValue(pIn1)!=0; - } - pIn2 = &aMem[pOp->p2]; - if( pIn2->flags & MEM_Null ){ - v2 = 2; - }else{ - v2 = sqlite3VdbeIntValue(pIn2)!=0; - } - if( pOp->opcode==OP_And ){ - static const unsigned char and_logic[] = { 0, 0, 0, 0, 1, 2, 0, 2, 2 }; - v1 = and_logic[v1*3+v2]; - }else{ - static const unsigned char or_logic[] = { 0, 1, 2, 1, 1, 1, 2, 1, 2 }; - v1 = or_logic[v1*3+v2]; - } - pOut = &aMem[pOp->p3]; - if( v1==2 ){ - MemSetTypeFlag(pOut, MEM_Null); - }else{ - pOut->u.i = v1; - MemSetTypeFlag(pOut, MEM_Int); - } - break; -} - -/* Opcode: Not P1 P2 * * * -** Synopsis: r[P2]= !r[P1] -** -** Interpret the value in register P1 as a boolean value. Store the -** boolean complement in register P2. If the value in register P1 is -** NULL, then a NULL is stored in P2. -*/ -case OP_Not: { /* same as TK_NOT, in1, out2 */ - pIn1 = &aMem[pOp->p1]; - pOut = &aMem[pOp->p2]; - if( pIn1->flags & MEM_Null ){ - sqlite3VdbeMemSetNull(pOut); - }else{ - sqlite3VdbeMemSetInt64(pOut, !sqlite3VdbeIntValue(pIn1)); - } - break; -} - -/* Opcode: BitNot P1 P2 * * * -** Synopsis: r[P1]= ~r[P1] -** -** Interpret the content of register P1 as an integer. Store the -** ones-complement of the P1 value into register P2. If P1 holds -** a NULL then store a NULL in P2. -*/ -case OP_BitNot: { /* same as TK_BITNOT, in1, out2 */ - pIn1 = &aMem[pOp->p1]; - pOut = &aMem[pOp->p2]; - if( pIn1->flags & MEM_Null ){ - sqlite3VdbeMemSetNull(pOut); - }else{ - sqlite3VdbeMemSetInt64(pOut, ~sqlite3VdbeIntValue(pIn1)); - } - break; -} - -/* Opcode: Once P1 P2 * * * -** -** Check if OP_Once flag P1 is set. If so, jump to instruction P2. Otherwise, -** set the flag and fall through to the next instruction. -*/ -case OP_Once: { /* jump */ - assert( pOp->p1nOnceFlag ); - if( p->aOnceFlag[pOp->p1] ){ - pc = pOp->p2-1; - }else{ - p->aOnceFlag[pOp->p1] = 1; - } - break; -} - -/* Opcode: If P1 P2 P3 * * -** -** Jump to P2 if the value in register P1 is true. The value -** is considered true if it is numeric and non-zero. If the value -** in P1 is NULL then take the jump if P3 is non-zero. -*/ -/* Opcode: IfNot P1 P2 P3 * * -** -** Jump to P2 if the value in register P1 is False. The value -** is considered false if it has a numeric value of zero. If the value -** in P1 is NULL then take the jump if P3 is zero. -*/ -case OP_If: /* jump, in1 */ -case OP_IfNot: { /* jump, in1 */ - int c; - pIn1 = &aMem[pOp->p1]; - if( pIn1->flags & MEM_Null ){ - c = pOp->p3; - }else{ -#ifdef SQLITE_OMIT_FLOATING_POINT - c = sqlite3VdbeIntValue(pIn1)!=0; -#else - c = sqlite3VdbeRealValue(pIn1)!=0.0; -#endif - if( pOp->opcode==OP_IfNot ) c = !c; - } - if( c ){ - pc = pOp->p2-1; - } - break; -} - -/* Opcode: IsNull P1 P2 * * * -** Synopsis: if r[P1]==NULL goto P2 -** -** Jump to P2 if the value in register P1 is NULL. -*/ -case OP_IsNull: { /* same as TK_ISNULL, jump, in1 */ - pIn1 = &aMem[pOp->p1]; - if( (pIn1->flags & MEM_Null)!=0 ){ - pc = pOp->p2 - 1; - } - break; -} - -/* Opcode: NotNull P1 P2 * * * -** Synopsis: if r[P1]!=NULL goto P2 -** -** Jump to P2 if the value in register P1 is not NULL. -*/ -case OP_NotNull: { /* same as TK_NOTNULL, jump, in1 */ - pIn1 = &aMem[pOp->p1]; - if( (pIn1->flags & MEM_Null)==0 ){ - pc = pOp->p2 - 1; - } - break; -} - -/* Opcode: Column P1 P2 P3 P4 P5 -** Synopsis: r[P3]=PX -** -** Interpret the data that cursor P1 points to as a structure built using -** the MakeRecord instruction. (See the MakeRecord opcode for additional -** information about the format of the data.) Extract the P2-th column -** from this record. If there are less that (P2+1) -** values in the record, extract a NULL. -** -** The value extracted is stored in register P3. -** -** If the column contains fewer than P2 fields, then extract a NULL. Or, -** if the P4 argument is a P4_MEM use the value of the P4 argument as -** the result. -** -** If the OPFLAG_CLEARCACHE bit is set on P5 and P1 is a pseudo-table cursor, -** then the cache of the cursor is reset prior to extracting the column. -** The first OP_Column against a pseudo-table after the value of the content -** register has changed should have this bit set. -** -** If the OPFLAG_LENGTHARG and OPFLAG_TYPEOFARG bits are set on P5 when -** the result is guaranteed to only be used as the argument of a length() -** or typeof() function, respectively. The loading of large blobs can be -** skipped for length() and all content loading can be skipped for typeof(). -*/ -case OP_Column: { - i64 payloadSize64; /* Number of bytes in the record */ - int p2; /* column number to retrieve */ - VdbeCursor *pC; /* The VDBE cursor */ - BtCursor *pCrsr; /* The BTree cursor */ - u32 *aType; /* aType[i] holds the numeric type of the i-th column */ - u32 *aOffset; /* aOffset[i] is offset to start of data for i-th column */ - int len; /* The length of the serialized data for the column */ - int i; /* Loop counter */ - Mem *pDest; /* Where to write the extracted value */ - Mem sMem; /* For storing the record being decoded */ - const u8 *zData; /* Part of the record being decoded */ - const u8 *zHdr; /* Next unparsed byte of the header */ - const u8 *zEndHdr; /* Pointer to first byte after the header */ - u32 offset; /* Offset into the data */ - u32 szField; /* Number of bytes in the content of a field */ - u32 avail; /* Number of bytes of available data */ - u32 t; /* A type code from the record header */ - Mem *pReg; /* PseudoTable input register */ - - p2 = pOp->p2; - assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); - pDest = &aMem[pOp->p3]; - memAboutToChange(p, pDest); - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( p2nField ); - aType = pC->aType; - aOffset = aType + pC->nField; -#ifndef SQLITE_OMIT_VIRTUALTABLE - assert( pC->pVtabCursor==0 ); /* OP_Column never called on virtual table */ -#endif - pCrsr = pC->pCursor; - assert( pCrsr!=0 || pC->pseudoTableReg>0 ); /* pCrsr NULL on PseudoTables */ - assert( pCrsr!=0 || pC->nullRow ); /* pC->nullRow on PseudoTables */ - - /* If the cursor cache is stale, bring it up-to-date */ - rc = sqlite3VdbeCursorMoveto(pC); - if( rc ) goto abort_due_to_error; - if( pC->cacheStatus!=p->cacheCtr || (pOp->p5&OPFLAG_CLEARCACHE)!=0 ){ - if( pC->nullRow ){ - if( pCrsr==0 ){ - assert( pC->pseudoTableReg>0 ); - pReg = &aMem[pC->pseudoTableReg]; - if( pC->multiPseudo ){ - sqlite3VdbeMemShallowCopy(pDest, pReg+p2, MEM_Ephem); - Deephemeralize(pDest); - goto op_column_out; - } - assert( pReg->flags & MEM_Blob ); - assert( memIsValid(pReg) ); - pC->payloadSize = pC->szRow = avail = pReg->n; - pC->aRow = (u8*)pReg->z; - }else{ - MemSetTypeFlag(pDest, MEM_Null); - goto op_column_out; - } - }else{ - assert( pCrsr ); - if( pC->isTable==0 ){ - assert( sqlite3BtreeCursorIsValid(pCrsr) ); - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCrsr, &payloadSize64); - assert( rc==SQLITE_OK ); /* True because of CursorMoveto() call above */ - /* sqlite3BtreeParseCellPtr() uses getVarint32() to extract the - ** payload size, so it is impossible for payloadSize64 to be - ** larger than 32 bits. */ - assert( (payloadSize64 & SQLITE_MAX_U32)==(u64)payloadSize64 ); - pC->aRow = sqlite3BtreeKeyFetch(pCrsr, &avail); - pC->payloadSize = (u32)payloadSize64; - }else{ - assert( sqlite3BtreeCursorIsValid(pCrsr) ); - VVA_ONLY(rc =) sqlite3BtreeDataSize(pCrsr, &pC->payloadSize); - assert( rc==SQLITE_OK ); /* DataSize() cannot fail */ - pC->aRow = sqlite3BtreeDataFetch(pCrsr, &avail); - } - assert( avail<=65536 ); /* Maximum page size is 64KiB */ - if( pC->payloadSize <= (u32)avail ){ - pC->szRow = pC->payloadSize; - }else{ - pC->szRow = avail; - } - if( pC->payloadSize > (u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } - } - pC->cacheStatus = p->cacheCtr; - pC->iHdrOffset = getVarint32(pC->aRow, offset); - pC->nHdrParsed = 0; - aOffset[0] = offset; - if( availaRow does not have to hold the entire row, but it does at least - ** need to cover the header of the record. If pC->aRow does not contain - ** the complete header, then set it to zero, forcing the header to be - ** dynamically allocated. */ - pC->aRow = 0; - pC->szRow = 0; - } - - /* Make sure a corrupt database has not given us an oversize header. - ** Do this now to avoid an oversize memory allocation. - ** - ** Type entries can be between 1 and 5 bytes each. But 4 and 5 byte - ** types use so much data space that there can only be 4096 and 32 of - ** them, respectively. So the maximum header length results from a - ** 3-byte type for each of the maximum of 32768 columns plus three - ** extra bytes for the header length itself. 32768*3 + 3 = 98307. - */ - if( offset > 98307 || offset > pC->payloadSize ){ - rc = SQLITE_CORRUPT_BKPT; - goto op_column_error; - } - } - - /* Make sure at least the first p2+1 entries of the header have been - ** parsed and valid information is in aOffset[] and aType[]. - */ - if( pC->nHdrParsed<=p2 ){ - /* If there is more header available for parsing in the record, try - ** to extract additional fields up through the p2+1-th field - */ - if( pC->iHdrOffsetaRow==0 ){ - memset(&sMem, 0, sizeof(sMem)); - rc = sqlite3VdbeMemFromBtree(pCrsr, 0, aOffset[0], - !pC->isTable, &sMem); - if( rc!=SQLITE_OK ){ - goto op_column_error; - } - zData = (u8*)sMem.z; - }else{ - zData = pC->aRow; - } - - /* Fill in aType[i] and aOffset[i] values through the p2-th field. */ - i = pC->nHdrParsed; - offset = aOffset[i]; - zHdr = zData + pC->iHdrOffset; - zEndHdr = zData + aOffset[0]; - assert( i<=p2 && zHdrnHdrParsed = i; - pC->iHdrOffset = (u32)(zHdr - zData); - if( pC->aRow==0 ){ - sqlite3VdbeMemRelease(&sMem); - sMem.flags = MEM_Null; - } - - /* If we have read more header data than was contained in the header, - ** or if the end of the last field appears to be past the end of the - ** record, or if the end of the last field appears to be before the end - ** of the record (when all fields present), then we must be dealing - ** with a corrupt database. - */ - if( (zHdr > zEndHdr) - || (offset > pC->payloadSize) - || (zHdr==zEndHdr && offset!=pC->payloadSize) - ){ - rc = SQLITE_CORRUPT_BKPT; - goto op_column_error; - } - } - - /* If after trying to extra new entries from the header, nHdrParsed is - ** still not up to p2, that means that the record has fewer than p2 - ** columns. So the result will be either the default value or a NULL. - */ - if( pC->nHdrParsed<=p2 ){ - if( pOp->p4type==P4_MEM ){ - sqlite3VdbeMemShallowCopy(pDest, pOp->p4.pMem, MEM_Static); - }else{ - MemSetTypeFlag(pDest, MEM_Null); - } - goto op_column_out; - } - } - - /* Extract the content for the p2+1-th column. Control can only - ** reach this point if aOffset[p2], aOffset[p2+1], and aType[p2] are - ** all valid. - */ - assert( p2nHdrParsed ); - assert( rc==SQLITE_OK ); - if( pC->szRow>=aOffset[p2+1] ){ - /* This is the common case where the desired content fits on the original - ** page - where the content is not on an overflow page */ - VdbeMemRelease(pDest); - sqlite3VdbeSerialGet(pC->aRow+aOffset[p2], aType[p2], pDest); - }else{ - /* This branch happens only when content is on overflow pages */ - t = aType[p2]; - if( ((pOp->p5 & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG))!=0 - && ((t>=12 && (t&1)==0) || (pOp->p5 & OPFLAG_TYPEOFARG)!=0)) - || (len = sqlite3VdbeSerialTypeLen(t))==0 - ){ - /* Content is irrelevant for the typeof() function and for - ** the length(X) function if X is a blob. So we might as well use - ** bogus content rather than reading content from disk. NULL works - ** for text and blob and whatever is in the payloadSize64 variable - ** will work for everything else. Content is also irrelevant if - ** the content length is 0. */ - zData = t<=13 ? (u8*)&payloadSize64 : 0; - sMem.zMalloc = 0; - }else{ - memset(&sMem, 0, sizeof(sMem)); - sqlite3VdbeMemMove(&sMem, pDest); - rc = sqlite3VdbeMemFromBtree(pCrsr, aOffset[p2], len, !pC->isTable, - &sMem); - if( rc!=SQLITE_OK ){ - goto op_column_error; - } - zData = (u8*)sMem.z; - } - sqlite3VdbeSerialGet(zData, t, pDest); - /* If we dynamically allocated space to hold the data (in the - ** sqlite3VdbeMemFromBtree() call above) then transfer control of that - ** dynamically allocated space over to the pDest structure. - ** This prevents a memory copy. */ - if( sMem.zMalloc ){ - assert( sMem.z==sMem.zMalloc ); - assert( !(pDest->flags & MEM_Dyn) ); - assert( !(pDest->flags & (MEM_Blob|MEM_Str)) || pDest->z==sMem.z ); - pDest->flags &= ~(MEM_Ephem|MEM_Static); - pDest->flags |= MEM_Term; - pDest->z = sMem.z; - pDest->zMalloc = sMem.zMalloc; - } - } - pDest->enc = encoding; - -op_column_out: - Deephemeralize(pDest); -op_column_error: - UPDATE_MAX_BLOBSIZE(pDest); - REGISTER_TRACE(pOp->p3, pDest); - break; -} - -/* Opcode: Affinity P1 P2 * P4 * -** Synopsis: affinity(r[P1@P2]) -** -** Apply affinities to a range of P2 registers starting with P1. -** -** P4 is a string that is P2 characters long. The nth character of the -** string indicates the column affinity that should be used for the nth -** memory cell in the range. -*/ -case OP_Affinity: { - const char *zAffinity; /* The affinity to be applied */ - char cAff; /* A single character of affinity */ - - zAffinity = pOp->p4.z; - assert( zAffinity!=0 ); - assert( zAffinity[pOp->p2]==0 ); - pIn1 = &aMem[pOp->p1]; - while( (cAff = *(zAffinity++))!=0 ){ - assert( pIn1 <= &p->aMem[(p->nMem-p->nCursor)] ); - assert( memIsValid(pIn1) ); - ExpandBlob(pIn1); - applyAffinity(pIn1, cAff, encoding); - pIn1++; - } - break; -} - -/* Opcode: MakeRecord P1 P2 P3 P4 * -** Synopsis: r[P3]=mkrec(r[P1@P2]) -** -** Convert P2 registers beginning with P1 into the [record format] -** use as a data record in a database table or as a key -** in an index. The OP_Column opcode can decode the record later. -** -** P4 may be a string that is P2 characters long. The nth character of the -** string indicates the column affinity that should be used for the nth -** field of the index key. -** -** The mapping from character to affinity is given by the SQLITE_AFF_ -** macros defined in sqliteInt.h. -** -** If P4 is NULL then all index fields have the affinity NONE. -*/ -case OP_MakeRecord: { - u8 *zNewRecord; /* A buffer to hold the data for the new record */ - Mem *pRec; /* The new record */ - u64 nData; /* Number of bytes of data space */ - int nHdr; /* Number of bytes of header space */ - i64 nByte; /* Data space required for this record */ - int nZero; /* Number of zero bytes at the end of the record */ - int nVarint; /* Number of bytes in a varint */ - u32 serial_type; /* Type field */ - Mem *pData0; /* First field to be combined into the record */ - Mem *pLast; /* Last field of the record */ - int nField; /* Number of fields in the record */ - char *zAffinity; /* The affinity string for the record */ - int file_format; /* File format to use for encoding */ - int i; /* Space used in zNewRecord[] header */ - int j; /* Space used in zNewRecord[] content */ - int len; /* Length of a field */ - - /* Assuming the record contains N fields, the record format looks - ** like this: - ** - ** ------------------------------------------------------------------------ - ** | hdr-size | type 0 | type 1 | ... | type N-1 | data0 | ... | data N-1 | - ** ------------------------------------------------------------------------ - ** - ** Data(0) is taken from register P1. Data(1) comes from register P1+1 - ** and so froth. - ** - ** Each type field is a varint representing the serial type of the - ** corresponding data element (see sqlite3VdbeSerialType()). The - ** hdr-size field is also a varint which is the offset from the beginning - ** of the record to data0. - */ - nData = 0; /* Number of bytes of data space */ - nHdr = 0; /* Number of bytes of header space */ - nZero = 0; /* Number of zero bytes at the end of the record */ - nField = pOp->p1; - zAffinity = pOp->p4.z; - assert( nField>0 && pOp->p2>0 && pOp->p2+nField<=(p->nMem-p->nCursor)+1 ); - pData0 = &aMem[nField]; - nField = pOp->p2; - pLast = &pData0[nField-1]; - file_format = p->minWriteFileFormat; - - /* Identify the output register */ - assert( pOp->p3p1 || pOp->p3>=pOp->p1+pOp->p2 ); - pOut = &aMem[pOp->p3]; - memAboutToChange(p, pOut); - - /* Apply the requested affinity to all inputs - */ - assert( pData0<=pLast ); - if( zAffinity ){ - pRec = pData0; - do{ - applyAffinity(pRec, *(zAffinity++), encoding); - }while( (++pRec)<=pLast ); - } - - /* Loop through the elements that will make up the record to figure - ** out how much space is required for the new record. - */ - pRec = pLast; - do{ - assert( memIsValid(pRec) ); - serial_type = sqlite3VdbeSerialType(pRec, file_format); - len = sqlite3VdbeSerialTypeLen(serial_type); - if( pRec->flags & MEM_Zero ){ - if( nData ){ - sqlite3VdbeMemExpandBlob(pRec); - }else{ - nZero += pRec->u.nZero; - len -= pRec->u.nZero; - } - } - nData += len; - testcase( serial_type==127 ); - testcase( serial_type==128 ); - nHdr += serial_type<=127 ? 1 : sqlite3VarintLen(serial_type); - }while( (--pRec)>=pData0 ); - - /* Add the initial header varint and total the size */ - testcase( nHdr==126 ); - testcase( nHdr==127 ); - if( nHdr<=126 ){ - /* The common case */ - nHdr += 1; - }else{ - /* Rare case of a really large header */ - nVarint = sqlite3VarintLen(nHdr); - nHdr += nVarint; - if( nVarintdb->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } - - /* Make sure the output register has a buffer large enough to store - ** the new record. The output register (pOp->p3) is not allowed to - ** be one of the input registers (because the following call to - ** sqlite3VdbeMemGrow() could clobber the value before it is used). - */ - if( sqlite3VdbeMemGrow(pOut, (int)nByte, 0) ){ - goto no_mem; - } - zNewRecord = (u8 *)pOut->z; - - /* Write the record */ - i = putVarint32(zNewRecord, nHdr); - j = nHdr; - assert( pData0<=pLast ); - pRec = pData0; - do{ - serial_type = sqlite3VdbeSerialType(pRec, file_format); - i += putVarint32(&zNewRecord[i], serial_type); /* serial type */ - j += sqlite3VdbeSerialPut(&zNewRecord[j], pRec, serial_type); /* content */ - }while( (++pRec)<=pLast ); - assert( i==nHdr ); - assert( j==nByte ); - - assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); - pOut->n = (int)nByte; - pOut->flags = MEM_Blob | MEM_Dyn; - pOut->xDel = 0; - if( nZero ){ - pOut->u.nZero = nZero; - pOut->flags |= MEM_Zero; - } - pOut->enc = SQLITE_UTF8; /* In case the blob is ever converted to text */ - REGISTER_TRACE(pOp->p3, pOut); - UPDATE_MAX_BLOBSIZE(pOut); - break; -} - -/* Opcode: Count P1 P2 * * * -** Synopsis: r[P2]=count() -** -** Store the number of entries (an integer value) in the table or index -** opened by cursor P1 in register P2 -*/ -#ifndef SQLITE_OMIT_BTREECOUNT -case OP_Count: { /* out2-prerelease */ - i64 nEntry; - BtCursor *pCrsr; - - pCrsr = p->apCsr[pOp->p1]->pCursor; - assert( pCrsr ); - nEntry = 0; /* Not needed. Only used to silence a warning. */ - rc = sqlite3BtreeCount(pCrsr, &nEntry); - pOut->u.i = nEntry; - break; -} -#endif - -/* Opcode: Savepoint P1 * * P4 * -** -** Open, release or rollback the savepoint named by parameter P4, depending -** on the value of P1. To open a new savepoint, P1==0. To release (commit) an -** existing savepoint, P1==1, or to rollback an existing savepoint P1==2. -*/ -case OP_Savepoint: { - int p1; /* Value of P1 operand */ - char *zName; /* Name of savepoint */ - int nName; - Savepoint *pNew; - Savepoint *pSavepoint; - Savepoint *pTmp; - int iSavepoint; - int ii; - - p1 = pOp->p1; - zName = pOp->p4.z; - - /* Assert that the p1 parameter is valid. Also that if there is no open - ** transaction, then there cannot be any savepoints. - */ - assert( db->pSavepoint==0 || db->autoCommit==0 ); - assert( p1==SAVEPOINT_BEGIN||p1==SAVEPOINT_RELEASE||p1==SAVEPOINT_ROLLBACK ); - assert( db->pSavepoint || db->isTransactionSavepoint==0 ); - assert( checkSavepointCount(db) ); - assert( p->bIsReader ); - - if( p1==SAVEPOINT_BEGIN ){ - if( db->nVdbeWrite>0 ){ - /* A new savepoint cannot be created if there are active write - ** statements (i.e. open read/write incremental blob handles). - */ - sqlite3SetString(&p->zErrMsg, db, "cannot open savepoint - " - "SQL statements in progress"); - rc = SQLITE_BUSY; - }else{ - nName = sqlite3Strlen30(zName); - -#ifndef SQLITE_OMIT_VIRTUALTABLE - /* This call is Ok even if this savepoint is actually a transaction - ** savepoint (and therefore should not prompt xSavepoint()) callbacks. - ** If this is a transaction savepoint being opened, it is guaranteed - ** that the db->aVTrans[] array is empty. */ - assert( db->autoCommit==0 || db->nVTrans==0 ); - rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, - db->nStatement+db->nSavepoint); - if( rc!=SQLITE_OK ) goto abort_due_to_error; -#endif - - /* Create a new savepoint structure. */ - pNew = sqlite3DbMallocRaw(db, sizeof(Savepoint)+nName+1); - if( pNew ){ - pNew->zName = (char *)&pNew[1]; - memcpy(pNew->zName, zName, nName+1); - - /* If there is no open transaction, then mark this as a special - ** "transaction savepoint". */ - if( db->autoCommit ){ - db->autoCommit = 0; - db->isTransactionSavepoint = 1; - }else{ - db->nSavepoint++; - } - - /* Link the new savepoint into the database handle's list. */ - pNew->pNext = db->pSavepoint; - db->pSavepoint = pNew; - pNew->nDeferredCons = db->nDeferredCons; - pNew->nDeferredImmCons = db->nDeferredImmCons; - } - } - }else{ - iSavepoint = 0; - - /* Find the named savepoint. If there is no such savepoint, then an - ** an error is returned to the user. */ - for( - pSavepoint = db->pSavepoint; - pSavepoint && sqlite3StrICmp(pSavepoint->zName, zName); - pSavepoint = pSavepoint->pNext - ){ - iSavepoint++; - } - if( !pSavepoint ){ - sqlite3SetString(&p->zErrMsg, db, "no such savepoint: %s", zName); - rc = SQLITE_ERROR; - }else if( db->nVdbeWrite>0 && p1==SAVEPOINT_RELEASE ){ - /* It is not possible to release (commit) a savepoint if there are - ** active write statements. - */ - sqlite3SetString(&p->zErrMsg, db, - "cannot release savepoint - SQL statements in progress" - ); - rc = SQLITE_BUSY; - }else{ - - /* Determine whether or not this is a transaction savepoint. If so, - ** and this is a RELEASE command, then the current transaction - ** is committed. - */ - int isTransaction = pSavepoint->pNext==0 && db->isTransactionSavepoint; - if( isTransaction && p1==SAVEPOINT_RELEASE ){ - if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){ - goto vdbe_return; - } - db->autoCommit = 1; - if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){ - p->pc = pc; - db->autoCommit = 0; - p->rc = rc = SQLITE_BUSY; - goto vdbe_return; - } - db->isTransactionSavepoint = 0; - rc = p->rc; - }else{ - iSavepoint = db->nSavepoint - iSavepoint - 1; - if( p1==SAVEPOINT_ROLLBACK ){ - for(ii=0; iinDb; ii++){ - sqlite3BtreeTripAllCursors(db->aDb[ii].pBt, SQLITE_ABORT); - } - } - for(ii=0; iinDb; ii++){ - rc = sqlite3BtreeSavepoint(db->aDb[ii].pBt, p1, iSavepoint); - if( rc!=SQLITE_OK ){ - goto abort_due_to_error; - } - } - if( p1==SAVEPOINT_ROLLBACK && (db->flags&SQLITE_InternChanges)!=0 ){ - sqlite3ExpirePreparedStatements(db); - sqlite3ResetAllSchemasOfConnection(db); - db->flags = (db->flags | SQLITE_InternChanges); - } - } - - /* Regardless of whether this is a RELEASE or ROLLBACK, destroy all - ** savepoints nested inside of the savepoint being operated on. */ - while( db->pSavepoint!=pSavepoint ){ - pTmp = db->pSavepoint; - db->pSavepoint = pTmp->pNext; - sqlite3DbFree(db, pTmp); - db->nSavepoint--; - } - - /* If it is a RELEASE, then destroy the savepoint being operated on - ** too. If it is a ROLLBACK TO, then set the number of deferred - ** constraint violations present in the database to the value stored - ** when the savepoint was created. */ - if( p1==SAVEPOINT_RELEASE ){ - assert( pSavepoint==db->pSavepoint ); - db->pSavepoint = pSavepoint->pNext; - sqlite3DbFree(db, pSavepoint); - if( !isTransaction ){ - db->nSavepoint--; - } - }else{ - db->nDeferredCons = pSavepoint->nDeferredCons; - db->nDeferredImmCons = pSavepoint->nDeferredImmCons; - } - - if( !isTransaction ){ - rc = sqlite3VtabSavepoint(db, p1, iSavepoint); - if( rc!=SQLITE_OK ) goto abort_due_to_error; - } - } - } - - break; -} - -/* Opcode: AutoCommit P1 P2 * * * -** -** Set the database auto-commit flag to P1 (1 or 0). If P2 is true, roll -** back any currently active btree transactions. If there are any active -** VMs (apart from this one), then a ROLLBACK fails. A COMMIT fails if -** there are active writing VMs or active VMs that use shared cache. -** -** This instruction causes the VM to halt. -*/ -case OP_AutoCommit: { - int desiredAutoCommit; - int iRollback; - int turnOnAC; - - desiredAutoCommit = pOp->p1; - iRollback = pOp->p2; - turnOnAC = desiredAutoCommit && !db->autoCommit; - assert( desiredAutoCommit==1 || desiredAutoCommit==0 ); - assert( desiredAutoCommit==1 || iRollback==0 ); - assert( db->nVdbeActive>0 ); /* At least this one VM is active */ - assert( p->bIsReader ); - -#if 0 - if( turnOnAC && iRollback && db->nVdbeActive>1 ){ - /* If this instruction implements a ROLLBACK and other VMs are - ** still running, and a transaction is active, return an error indicating - ** that the other VMs must complete first. - */ - sqlite3SetString(&p->zErrMsg, db, "cannot rollback transaction - " - "SQL statements in progress"); - rc = SQLITE_BUSY; - }else -#endif - if( turnOnAC && !iRollback && db->nVdbeWrite>0 ){ - /* If this instruction implements a COMMIT and other VMs are writing - ** return an error indicating that the other VMs must complete first. - */ - sqlite3SetString(&p->zErrMsg, db, "cannot commit transaction - " - "SQL statements in progress"); - rc = SQLITE_BUSY; - }else if( desiredAutoCommit!=db->autoCommit ){ - if( iRollback ){ - assert( desiredAutoCommit==1 ); - sqlite3RollbackAll(db, SQLITE_ABORT_ROLLBACK); - db->autoCommit = 1; - }else if( (rc = sqlite3VdbeCheckFk(p, 1))!=SQLITE_OK ){ - goto vdbe_return; - }else{ - db->autoCommit = (u8)desiredAutoCommit; - if( sqlite3VdbeHalt(p)==SQLITE_BUSY ){ - p->pc = pc; - db->autoCommit = (u8)(1-desiredAutoCommit); - p->rc = rc = SQLITE_BUSY; - goto vdbe_return; - } - } - assert( db->nStatement==0 ); - sqlite3CloseSavepoints(db); - if( p->rc==SQLITE_OK ){ - rc = SQLITE_DONE; - }else{ - rc = SQLITE_ERROR; - } - goto vdbe_return; - }else{ - sqlite3SetString(&p->zErrMsg, db, - (!desiredAutoCommit)?"cannot start a transaction within a transaction":( - (iRollback)?"cannot rollback - no transaction is active": - "cannot commit - no transaction is active")); - - rc = SQLITE_ERROR; - } - break; -} - -/* Opcode: Transaction P1 P2 * * * -** -** Begin a transaction. The transaction ends when a Commit or Rollback -** opcode is encountered. Depending on the ON CONFLICT setting, the -** transaction might also be rolled back if an error is encountered. -** -** P1 is the index of the database file on which the transaction is -** started. Index 0 is the main database file and index 1 is the -** file used for temporary tables. Indices of 2 or more are used for -** attached databases. -** -** If P2 is non-zero, then a write-transaction is started. A RESERVED lock is -** obtained on the database file when a write-transaction is started. No -** other process can start another write transaction while this transaction is -** underway. Starting a write transaction also creates a rollback journal. A -** write transaction must be started before any changes can be made to the -** database. If P2 is greater than or equal to 2 then an EXCLUSIVE lock is -** also obtained on the file. -** -** If a write-transaction is started and the Vdbe.usesStmtJournal flag is -** true (this flag is set if the Vdbe may modify more than one row and may -** throw an ABORT exception), a statement transaction may also be opened. -** More specifically, a statement transaction is opened iff the database -** connection is currently not in autocommit mode, or if there are other -** active statements. A statement transaction allows the changes made by this -** VDBE to be rolled back after an error without having to roll back the -** entire transaction. If no error is encountered, the statement transaction -** will automatically commit when the VDBE halts. -** -** If P2 is zero, then a read-lock is obtained on the database file. -*/ -case OP_Transaction: { - Btree *pBt; - - assert( p->bIsReader ); - assert( p->readOnly==0 || pOp->p2==0 ); - assert( pOp->p1>=0 && pOp->p1nDb ); - assert( (p->btreeMask & (((yDbMask)1)<p1))!=0 ); - if( pOp->p2 && (db->flags & SQLITE_QueryOnly)!=0 ){ - rc = SQLITE_READONLY; - goto abort_due_to_error; - } - pBt = db->aDb[pOp->p1].pBt; - - if( pBt ){ - rc = sqlite3BtreeBeginTrans(pBt, pOp->p2); - if( rc==SQLITE_BUSY ){ - p->pc = pc; - p->rc = rc = SQLITE_BUSY; - goto vdbe_return; - } - if( rc!=SQLITE_OK ){ - goto abort_due_to_error; - } - - if( pOp->p2 && p->usesStmtJournal - && (db->autoCommit==0 || db->nVdbeRead>1) - ){ - assert( sqlite3BtreeIsInTrans(pBt) ); - if( p->iStatement==0 ){ - assert( db->nStatement>=0 && db->nSavepoint>=0 ); - db->nStatement++; - p->iStatement = db->nSavepoint + db->nStatement; - } - - rc = sqlite3VtabSavepoint(db, SAVEPOINT_BEGIN, p->iStatement-1); - if( rc==SQLITE_OK ){ - rc = sqlite3BtreeBeginStmt(pBt, p->iStatement); - } - - /* Store the current value of the database handles deferred constraint - ** counter. If the statement transaction needs to be rolled back, - ** the value of this counter needs to be restored too. */ - p->nStmtDefCons = db->nDeferredCons; - p->nStmtDefImmCons = db->nDeferredImmCons; - } - } - break; -} - -/* Opcode: ReadCookie P1 P2 P3 * * -** -** Read cookie number P3 from database P1 and write it into register P2. -** P3==1 is the schema version. P3==2 is the database format. -** P3==3 is the recommended pager cache size, and so forth. P1==0 is -** the main database file and P1==1 is the database file used to store -** temporary tables. -** -** There must be a read-lock on the database (either a transaction -** must be started or there must be an open cursor) before -** executing this instruction. -*/ -case OP_ReadCookie: { /* out2-prerelease */ - int iMeta; - int iDb; - int iCookie; - - assert( p->bIsReader ); - iDb = pOp->p1; - iCookie = pOp->p3; - assert( pOp->p3=0 && iDbnDb ); - assert( db->aDb[iDb].pBt!=0 ); - assert( (p->btreeMask & (((yDbMask)1)<aDb[iDb].pBt, iCookie, (u32 *)&iMeta); - pOut->u.i = iMeta; - break; -} - -/* Opcode: SetCookie P1 P2 P3 * * -** -** Write the content of register P3 (interpreted as an integer) -** into cookie number P2 of database P1. P2==1 is the schema version. -** P2==2 is the database format. P2==3 is the recommended pager cache -** size, and so forth. P1==0 is the main database file and P1==1 is the -** database file used to store temporary tables. -** -** A transaction must be started before executing this opcode. -*/ -case OP_SetCookie: { /* in3 */ - Db *pDb; - assert( pOp->p2p1>=0 && pOp->p1nDb ); - assert( (p->btreeMask & (((yDbMask)1)<p1))!=0 ); - assert( p->readOnly==0 ); - pDb = &db->aDb[pOp->p1]; - assert( pDb->pBt!=0 ); - assert( sqlite3SchemaMutexHeld(db, pOp->p1, 0) ); - pIn3 = &aMem[pOp->p3]; - sqlite3VdbeMemIntegerify(pIn3); - /* See note about index shifting on OP_ReadCookie */ - rc = sqlite3BtreeUpdateMeta(pDb->pBt, pOp->p2, (int)pIn3->u.i); - if( pOp->p2==BTREE_SCHEMA_VERSION ){ - /* When the schema cookie changes, record the new cookie internally */ - pDb->pSchema->schema_cookie = (int)pIn3->u.i; - db->flags |= SQLITE_InternChanges; - }else if( pOp->p2==BTREE_FILE_FORMAT ){ - /* Record changes in the file format */ - pDb->pSchema->file_format = (u8)pIn3->u.i; - } - if( pOp->p1==1 ){ - /* Invalidate all prepared statements whenever the TEMP database - ** schema is changed. Ticket #1644 */ - sqlite3ExpirePreparedStatements(db); - p->expired = 0; - } - break; -} - -/* Opcode: VerifyCookie P1 P2 P3 * * -** -** Check the value of global database parameter number 0 (the -** schema version) and make sure it is equal to P2 and that the -** generation counter on the local schema parse equals P3. -** -** P1 is the database number which is 0 for the main database file -** and 1 for the file holding temporary tables and some higher number -** for auxiliary databases. -** -** The cookie changes its value whenever the database schema changes. -** This operation is used to detect when that the cookie has changed -** and that the current process needs to reread the schema. -** -** Either a transaction needs to have been started or an OP_Open needs -** to be executed (to establish a read lock) before this opcode is -** invoked. -*/ -case OP_VerifyCookie: { - int iMeta; - int iGen; - Btree *pBt; - - assert( pOp->p1>=0 && pOp->p1nDb ); - assert( (p->btreeMask & (((yDbMask)1)<p1))!=0 ); - assert( sqlite3SchemaMutexHeld(db, pOp->p1, 0) ); - assert( p->bIsReader ); - pBt = db->aDb[pOp->p1].pBt; - if( pBt ){ - sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&iMeta); - iGen = db->aDb[pOp->p1].pSchema->iGeneration; - }else{ - iGen = iMeta = 0; - } - if( iMeta!=pOp->p2 || iGen!=pOp->p3 ){ - sqlite3DbFree(db, p->zErrMsg); - p->zErrMsg = sqlite3DbStrDup(db, "database schema has changed"); - /* If the schema-cookie from the database file matches the cookie - ** stored with the in-memory representation of the schema, do - ** not reload the schema from the database file. - ** - ** If virtual-tables are in use, this is not just an optimization. - ** Often, v-tables store their data in other SQLite tables, which - ** are queried from within xNext() and other v-table methods using - ** prepared queries. If such a query is out-of-date, we do not want to - ** discard the database schema, as the user code implementing the - ** v-table would have to be ready for the sqlite3_vtab structure itself - ** to be invalidated whenever sqlite3_step() is called from within - ** a v-table method. - */ - if( db->aDb[pOp->p1].pSchema->schema_cookie!=iMeta ){ - sqlite3ResetOneSchema(db, pOp->p1); - } - - p->expired = 1; - rc = SQLITE_SCHEMA; - } - break; -} - -/* Opcode: OpenRead P1 P2 P3 P4 P5 -** Synopsis: root=P2 iDb=P3 -** -** Open a read-only cursor for the database table whose root page is -** P2 in a database file. The database file is determined by P3. -** P3==0 means the main database, P3==1 means the database used for -** temporary tables, and P3>1 means used the corresponding attached -** database. Give the new cursor an identifier of P1. The P1 -** values need not be contiguous but all P1 values should be small integers. -** It is an error for P1 to be negative. -** -** If P5!=0 then use the content of register P2 as the root page, not -** the value of P2 itself. -** -** There will be a read lock on the database whenever there is an -** open cursor. If the database was unlocked prior to this instruction -** then a read lock is acquired as part of this instruction. A read -** lock allows other processes to read the database but prohibits -** any other process from modifying the database. The read lock is -** released when all cursors are closed. If this instruction attempts -** to get a read lock but fails, the script terminates with an -** SQLITE_BUSY error code. -** -** The P4 value may be either an integer (P4_INT32) or a pointer to -** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo -** structure, then said structure defines the content and collating -** sequence of the index being opened. Otherwise, if P4 is an integer -** value, it is set to the number of columns in the table. -** -** See also OpenWrite. -*/ -/* Opcode: OpenWrite P1 P2 P3 P4 P5 -** Synopsis: root=P2 iDb=P3 -** -** Open a read/write cursor named P1 on the table or index whose root -** page is P2. Or if P5!=0 use the content of register P2 to find the -** root page. -** -** The P4 value may be either an integer (P4_INT32) or a pointer to -** a KeyInfo structure (P4_KEYINFO). If it is a pointer to a KeyInfo -** structure, then said structure defines the content and collating -** sequence of the index being opened. Otherwise, if P4 is an integer -** value, it is set to the number of columns in the table, or to the -** largest index of any column of the table that is actually used. -** -** This instruction works just like OpenRead except that it opens the cursor -** in read/write mode. For a given table, there can be one or more read-only -** cursors or a single read/write cursor but not both. -** -** See also OpenRead. -*/ -case OP_OpenRead: -case OP_OpenWrite: { - int nField; - KeyInfo *pKeyInfo; - int p2; - int iDb; - int wrFlag; - Btree *pX; - VdbeCursor *pCur; - Db *pDb; - - assert( (pOp->p5&(OPFLAG_P2ISREG|OPFLAG_BULKCSR))==pOp->p5 ); - assert( pOp->opcode==OP_OpenWrite || pOp->p5==0 ); - assert( p->bIsReader ); - assert( pOp->opcode==OP_OpenRead || p->readOnly==0 ); - - if( p->expired ){ - rc = SQLITE_ABORT; - break; - } - - nField = 0; - pKeyInfo = 0; - p2 = pOp->p2; - iDb = pOp->p3; - assert( iDb>=0 && iDbnDb ); - assert( (p->btreeMask & (((yDbMask)1)<aDb[iDb]; - pX = pDb->pBt; - assert( pX!=0 ); - if( pOp->opcode==OP_OpenWrite ){ - wrFlag = 1; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - if( pDb->pSchema->file_format < p->minWriteFileFormat ){ - p->minWriteFileFormat = pDb->pSchema->file_format; - } - }else{ - wrFlag = 0; - } - if( pOp->p5 & OPFLAG_P2ISREG ){ - assert( p2>0 ); - assert( p2<=(p->nMem-p->nCursor) ); - pIn2 = &aMem[p2]; - assert( memIsValid(pIn2) ); - assert( (pIn2->flags & MEM_Int)!=0 ); - sqlite3VdbeMemIntegerify(pIn2); - p2 = (int)pIn2->u.i; - /* The p2 value always comes from a prior OP_CreateTable opcode and - ** that opcode will always set the p2 value to 2 or more or else fail. - ** If there were a failure, the prepared statement would have halted - ** before reaching this instruction. */ - if( NEVER(p2<2) ) { - rc = SQLITE_CORRUPT_BKPT; - goto abort_due_to_error; - } - } - if( pOp->p4type==P4_KEYINFO ){ - pKeyInfo = pOp->p4.pKeyInfo; - assert( pKeyInfo->enc==ENC(db) ); - assert( pKeyInfo->db==db ); - nField = pKeyInfo->nField+pKeyInfo->nXField; - }else if( pOp->p4type==P4_INT32 ){ - nField = pOp->p4.i; - } - assert( pOp->p1>=0 ); - assert( nField>=0 ); - testcase( nField==0 ); /* Table with INTEGER PRIMARY KEY and nothing else */ - pCur = allocateCursor(p, pOp->p1, nField, iDb, 1); - if( pCur==0 ) goto no_mem; - pCur->nullRow = 1; - pCur->isOrdered = 1; - rc = sqlite3BtreeCursor(pX, p2, wrFlag, pKeyInfo, pCur->pCursor); - pCur->pKeyInfo = pKeyInfo; - assert( OPFLAG_BULKCSR==BTREE_BULKLOAD ); - sqlite3BtreeCursorHints(pCur->pCursor, (pOp->p5 & OPFLAG_BULKCSR)); - - /* Since it performs no memory allocation or IO, the only value that - ** sqlite3BtreeCursor() may return is SQLITE_OK. */ - assert( rc==SQLITE_OK ); - - /* Set the VdbeCursor.isTable variable. Previous versions of - ** SQLite used to check if the root-page flags were sane at this point - ** and report database corruption if they were not, but this check has - ** since moved into the btree layer. */ - pCur->isTable = pOp->p4type!=P4_KEYINFO; - break; -} - -/* Opcode: OpenEphemeral P1 P2 * P4 P5 -** Synopsis: nColumn=P2 -** -** Open a new cursor P1 to a transient table. -** The cursor is always opened read/write even if -** the main database is read-only. The ephemeral -** table is deleted automatically when the cursor is closed. -** -** P2 is the number of columns in the ephemeral table. -** The cursor points to a BTree table if P4==0 and to a BTree index -** if P4 is not 0. If P4 is not NULL, it points to a KeyInfo structure -** that defines the format of keys in the index. -** -** The P5 parameter can be a mask of the BTREE_* flags defined -** in btree.h. These flags control aspects of the operation of -** the btree. The BTREE_OMIT_JOURNAL and BTREE_SINGLE flags are -** added automatically. -*/ -/* Opcode: OpenAutoindex P1 P2 * P4 * -** Synopsis: nColumn=P2 -** -** This opcode works the same as OP_OpenEphemeral. It has a -** different name to distinguish its use. Tables created using -** by this opcode will be used for automatically created transient -** indices in joins. -*/ -case OP_OpenAutoindex: -case OP_OpenEphemeral: { - VdbeCursor *pCx; - KeyInfo *pKeyInfo; - - static const int vfsFlags = - SQLITE_OPEN_READWRITE | - SQLITE_OPEN_CREATE | - SQLITE_OPEN_EXCLUSIVE | - SQLITE_OPEN_DELETEONCLOSE | - SQLITE_OPEN_TRANSIENT_DB; - assert( pOp->p1>=0 ); - assert( pOp->p2>=0 ); - pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, 1); - if( pCx==0 ) goto no_mem; - pCx->nullRow = 1; - rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pCx->pBt, - BTREE_OMIT_JOURNAL | BTREE_SINGLE | pOp->p5, vfsFlags); - if( rc==SQLITE_OK ){ - rc = sqlite3BtreeBeginTrans(pCx->pBt, 1); - } - if( rc==SQLITE_OK ){ - /* If a transient index is required, create it by calling - ** sqlite3BtreeCreateTable() with the BTREE_BLOBKEY flag before - ** opening it. If a transient table is required, just use the - ** automatically created table with root-page 1 (an BLOB_INTKEY table). - */ - if( (pKeyInfo = pOp->p4.pKeyInfo)!=0 ){ - int pgno; - assert( pOp->p4type==P4_KEYINFO ); - rc = sqlite3BtreeCreateTable(pCx->pBt, &pgno, BTREE_BLOBKEY | pOp->p5); - if( rc==SQLITE_OK ){ - assert( pgno==MASTER_ROOT+1 ); - assert( pKeyInfo->db==db ); - assert( pKeyInfo->enc==ENC(db) ); - pCx->pKeyInfo = pKeyInfo; - rc = sqlite3BtreeCursor(pCx->pBt, pgno, 1, pKeyInfo, pCx->pCursor); - } - pCx->isTable = 0; - }else{ - rc = sqlite3BtreeCursor(pCx->pBt, MASTER_ROOT, 1, 0, pCx->pCursor); - pCx->isTable = 1; - } - } - pCx->isOrdered = (pOp->p5!=BTREE_UNORDERED); - break; -} - -/* Opcode: SorterOpen P1 * * P4 * -** -** This opcode works like OP_OpenEphemeral except that it opens -** a transient index that is specifically designed to sort large -** tables using an external merge-sort algorithm. -*/ -case OP_SorterOpen: { - VdbeCursor *pCx; - - assert( pOp->p1>=0 ); - assert( pOp->p2>=0 ); - pCx = allocateCursor(p, pOp->p1, pOp->p2, -1, 1); - if( pCx==0 ) goto no_mem; - pCx->pKeyInfo = pOp->p4.pKeyInfo; - assert( pCx->pKeyInfo->db==db ); - assert( pCx->pKeyInfo->enc==ENC(db) ); - rc = sqlite3VdbeSorterInit(db, pCx); - break; -} - -/* Opcode: OpenPseudo P1 P2 P3 * P5 -** Synopsis: content in r[P2@P3] -** -** Open a new cursor that points to a fake table that contains a single -** row of data. The content of that one row in the content of memory -** register P2 when P5==0. In other words, cursor P1 becomes an alias for the -** MEM_Blob content contained in register P2. When P5==1, then the -** row is represented by P3 consecutive registers beginning with P2. -** -** A pseudo-table created by this opcode is used to hold a single -** row output from the sorter so that the row can be decomposed into -** individual columns using the OP_Column opcode. The OP_Column opcode -** is the only cursor opcode that works with a pseudo-table. -** -** P3 is the number of fields in the records that will be stored by -** the pseudo-table. -*/ -case OP_OpenPseudo: { - VdbeCursor *pCx; - - assert( pOp->p1>=0 ); - assert( pOp->p3>=0 ); - pCx = allocateCursor(p, pOp->p1, pOp->p3, -1, 0); - if( pCx==0 ) goto no_mem; - pCx->nullRow = 1; - pCx->pseudoTableReg = pOp->p2; - pCx->isTable = 1; - pCx->multiPseudo = pOp->p5; - break; -} - -/* Opcode: Close P1 * * * * -** -** Close a cursor previously opened as P1. If P1 is not -** currently open, this instruction is a no-op. -*/ -case OP_Close: { - assert( pOp->p1>=0 && pOp->p1nCursor ); - sqlite3VdbeFreeCursor(p, p->apCsr[pOp->p1]); - p->apCsr[pOp->p1] = 0; - break; -} - -/* Opcode: SeekGe P1 P2 P3 P4 * -** Synopsis: key=r[P3@P4] -** -** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), -** use the value in register P3 as the key. If cursor P1 refers -** to an SQL index, then P3 is the first in an array of P4 registers -** that are used as an unpacked index key. -** -** Reposition cursor P1 so that it points to the smallest entry that -** is greater than or equal to the key value. If there are no records -** greater than or equal to the key and P2 is not zero, then jump to P2. -** -** See also: Found, NotFound, Distinct, SeekLt, SeekGt, SeekLe -*/ -/* Opcode: SeekGt P1 P2 P3 P4 * -** Synopsis: key=r[P3@P4] -** -** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), -** use the value in register P3 as a key. If cursor P1 refers -** to an SQL index, then P3 is the first in an array of P4 registers -** that are used as an unpacked index key. -** -** Reposition cursor P1 so that it points to the smallest entry that -** is greater than the key value. If there are no records greater than -** the key and P2 is not zero, then jump to P2. -** -** See also: Found, NotFound, Distinct, SeekLt, SeekGe, SeekLe -*/ -/* Opcode: SeekLt P1 P2 P3 P4 * -** Synopsis: key=r[P3@P4] -** -** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), -** use the value in register P3 as a key. If cursor P1 refers -** to an SQL index, then P3 is the first in an array of P4 registers -** that are used as an unpacked index key. -** -** Reposition cursor P1 so that it points to the largest entry that -** is less than the key value. If there are no records less than -** the key and P2 is not zero, then jump to P2. -** -** See also: Found, NotFound, Distinct, SeekGt, SeekGe, SeekLe -*/ -/* Opcode: SeekLe P1 P2 P3 P4 * -** Synopsis: key=r[P3@P4] -** -** If cursor P1 refers to an SQL table (B-Tree that uses integer keys), -** use the value in register P3 as a key. If cursor P1 refers -** to an SQL index, then P3 is the first in an array of P4 registers -** that are used as an unpacked index key. -** -** Reposition cursor P1 so that it points to the largest entry that -** is less than or equal to the key value. If there are no records -** less than or equal to the key and P2 is not zero, then jump to P2. -** -** See also: Found, NotFound, Distinct, SeekGt, SeekGe, SeekLt -*/ -case OP_SeekLt: /* jump, in3 */ -case OP_SeekLe: /* jump, in3 */ -case OP_SeekGe: /* jump, in3 */ -case OP_SeekGt: { /* jump, in3 */ - int res; - int oc; - VdbeCursor *pC; - UnpackedRecord r; - int nField; - i64 iKey; /* The rowid we are to seek to */ - - assert( pOp->p1>=0 && pOp->p1nCursor ); - assert( pOp->p2!=0 ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( pC->pseudoTableReg==0 ); - assert( OP_SeekLe == OP_SeekLt+1 ); - assert( OP_SeekGe == OP_SeekLt+2 ); - assert( OP_SeekGt == OP_SeekLt+3 ); - assert( pC->isOrdered ); - assert( pC->pCursor!=0 ); - oc = pOp->opcode; - pC->nullRow = 0; - if( pC->isTable ){ - /* The input value in P3 might be of any type: integer, real, string, - ** blob, or NULL. But it needs to be an integer before we can do - ** the seek, so covert it. */ - pIn3 = &aMem[pOp->p3]; - applyNumericAffinity(pIn3); - iKey = sqlite3VdbeIntValue(pIn3); - pC->rowidIsValid = 0; - - /* If the P3 value could not be converted into an integer without - ** loss of information, then special processing is required... */ - if( (pIn3->flags & MEM_Int)==0 ){ - if( (pIn3->flags & MEM_Real)==0 ){ - /* If the P3 value cannot be converted into any kind of a number, - ** then the seek is not possible, so jump to P2 */ - pc = pOp->p2 - 1; - break; - } - - /* If the approximation iKey is larger than the actual real search - ** term, substitute >= for > and < for <=. e.g. if the search term - ** is 4.9 and the integer approximation 5: - ** - ** (x > 4.9) -> (x >= 5) - ** (x <= 4.9) -> (x < 5) - */ - if( pIn3->r<(double)iKey ){ - assert( OP_SeekGe==(OP_SeekGt-1) ); - assert( OP_SeekLt==(OP_SeekLe-1) ); - assert( (OP_SeekLe & 0x0001)==(OP_SeekGt & 0x0001) ); - if( (oc & 0x0001)==(OP_SeekGt & 0x0001) ) oc--; - } - - /* If the approximation iKey is smaller than the actual real search - ** term, substitute <= for < and > for >=. */ - else if( pIn3->r>(double)iKey ){ - assert( OP_SeekLe==(OP_SeekLt+1) ); - assert( OP_SeekGt==(OP_SeekGe+1) ); - assert( (OP_SeekLt & 0x0001)==(OP_SeekGe & 0x0001) ); - if( (oc & 0x0001)==(OP_SeekLt & 0x0001) ) oc++; - } - } - rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, 0, (u64)iKey, 0, &res); - if( rc!=SQLITE_OK ){ - goto abort_due_to_error; - } - if( res==0 ){ - pC->rowidIsValid = 1; - pC->lastRowid = iKey; - } - }else{ - nField = pOp->p4.i; - assert( pOp->p4type==P4_INT32 ); - assert( nField>0 ); - r.pKeyInfo = pC->pKeyInfo; - r.nField = (u16)nField; - - /* The next line of code computes as follows, only faster: - ** if( oc==OP_SeekGt || oc==OP_SeekLe ){ - ** r.flags = UNPACKED_INCRKEY; - ** }else{ - ** r.flags = 0; - ** } - */ - r.flags = (u8)(UNPACKED_INCRKEY * (1 & (oc - OP_SeekLt))); - assert( oc!=OP_SeekGt || r.flags==UNPACKED_INCRKEY ); - assert( oc!=OP_SeekLe || r.flags==UNPACKED_INCRKEY ); - assert( oc!=OP_SeekGe || r.flags==0 ); - assert( oc!=OP_SeekLt || r.flags==0 ); - - r.aMem = &aMem[pOp->p3]; -#ifdef SQLITE_DEBUG - { int i; for(i=0; ipCursor, &r, 0, 0, &res); - if( rc!=SQLITE_OK ){ - goto abort_due_to_error; - } - pC->rowidIsValid = 0; - } - pC->deferredMoveto = 0; - pC->cacheStatus = CACHE_STALE; -#ifdef SQLITE_TEST - sqlite3_search_count++; -#endif - if( oc>=OP_SeekGe ){ assert( oc==OP_SeekGe || oc==OP_SeekGt ); - if( res<0 || (res==0 && oc==OP_SeekGt) ){ - rc = sqlite3BtreeNext(pC->pCursor, &res); - if( rc!=SQLITE_OK ) goto abort_due_to_error; - pC->rowidIsValid = 0; - }else{ - res = 0; - } - }else{ - assert( oc==OP_SeekLt || oc==OP_SeekLe ); - if( res>0 || (res==0 && oc==OP_SeekLt) ){ - rc = sqlite3BtreePrevious(pC->pCursor, &res); - if( rc!=SQLITE_OK ) goto abort_due_to_error; - pC->rowidIsValid = 0; - }else{ - /* res might be negative because the table is empty. Check to - ** see if this is the case. - */ - res = sqlite3BtreeEof(pC->pCursor); - } - } - assert( pOp->p2>0 ); - if( res ){ - pc = pOp->p2 - 1; - } - break; -} - -/* Opcode: Seek P1 P2 * * * -** Synopsis: intkey=r[P2] -** -** P1 is an open table cursor and P2 is a rowid integer. Arrange -** for P1 to move so that it points to the rowid given by P2. -** -** This is actually a deferred seek. Nothing actually happens until -** the cursor is used to read a record. That way, if no reads -** occur, no unnecessary I/O happens. -*/ -case OP_Seek: { /* in2 */ - VdbeCursor *pC; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( pC->pCursor!=0 ); - assert( pC->isTable ); - pC->nullRow = 0; - pIn2 = &aMem[pOp->p2]; - pC->movetoTarget = sqlite3VdbeIntValue(pIn2); - pC->rowidIsValid = 0; - pC->deferredMoveto = 1; - break; -} - - -/* Opcode: Found P1 P2 P3 P4 * -** Synopsis: key=r[P3@P4] -** -** If P4==0 then register P3 holds a blob constructed by MakeRecord. If -** P4>0 then register P3 is the first of P4 registers that form an unpacked -** record. -** -** Cursor P1 is on an index btree. If the record identified by P3 and P4 -** is a prefix of any entry in P1 then a jump is made to P2 and -** P1 is left pointing at the matching entry. -** -** See also: NotFound, NoConflict, NotExists. SeekGe -*/ -/* Opcode: NotFound P1 P2 P3 P4 * -** Synopsis: key=r[P3@P4] -** -** If P4==0 then register P3 holds a blob constructed by MakeRecord. If -** P4>0 then register P3 is the first of P4 registers that form an unpacked -** record. -** -** Cursor P1 is on an index btree. If the record identified by P3 and P4 -** is not the prefix of any entry in P1 then a jump is made to P2. If P1 -** does contain an entry whose prefix matches the P3/P4 record then control -** falls through to the next instruction and P1 is left pointing at the -** matching entry. -** -** See also: Found, NotExists, NoConflict -*/ -/* Opcode: NoConflict P1 P2 P3 P4 * -** Synopsis: key=r[P3@P4] -** -** If P4==0 then register P3 holds a blob constructed by MakeRecord. If -** P4>0 then register P3 is the first of P4 registers that form an unpacked -** record. -** -** Cursor P1 is on an index btree. If the record identified by P3 and P4 -** contains any NULL value, jump immediately to P2. If all terms of the -** record are not-NULL then a check is done to determine if any row in the -** P1 index btree has a matching key prefix. If there are no matches, jump -** immediately to P2. If there is a match, fall through and leave the P1 -** cursor pointing to the matching row. -** -** This opcode is similar to OP_NotFound with the exceptions that the -** branch is always taken if any part of the search key input is NULL. -** -** See also: NotFound, Found, NotExists -*/ -case OP_NoConflict: /* jump, in3 */ -case OP_NotFound: /* jump, in3 */ -case OP_Found: { /* jump, in3 */ - int alreadyExists; - int ii; - VdbeCursor *pC; - int res; - char *pFree; - UnpackedRecord *pIdxKey; - UnpackedRecord r; - char aTempRec[ROUND8(sizeof(UnpackedRecord)) + sizeof(Mem)*4 + 7]; - -#ifdef SQLITE_TEST - if( pOp->opcode!=OP_NoConflict ) sqlite3_found_count++; -#endif - - assert( pOp->p1>=0 && pOp->p1nCursor ); - assert( pOp->p4type==P4_INT32 ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - pIn3 = &aMem[pOp->p3]; - assert( pC->pCursor!=0 ); - assert( pC->isTable==0 ); - pFree = 0; /* Not needed. Only used to suppress a compiler warning. */ - if( pOp->p4.i>0 ){ - r.pKeyInfo = pC->pKeyInfo; - r.nField = (u16)pOp->p4.i; - r.aMem = pIn3; -#ifdef SQLITE_DEBUG - { - int i; - for(i=0; ip3+i, &r.aMem[i]); - } - } -#endif - r.flags = UNPACKED_PREFIX_MATCH; - pIdxKey = &r; - }else{ - pIdxKey = sqlite3VdbeAllocUnpackedRecord( - pC->pKeyInfo, aTempRec, sizeof(aTempRec), &pFree - ); - if( pIdxKey==0 ) goto no_mem; - assert( pIn3->flags & MEM_Blob ); - assert( (pIn3->flags & MEM_Zero)==0 ); /* zeroblobs already expanded */ - sqlite3VdbeRecordUnpack(pC->pKeyInfo, pIn3->n, pIn3->z, pIdxKey); - pIdxKey->flags |= UNPACKED_PREFIX_MATCH; - } - if( pOp->opcode==OP_NoConflict ){ - /* For the OP_NoConflict opcode, take the jump if any of the - ** input fields are NULL, since any key with a NULL will not - ** conflict */ - for(ii=0; iip2 - 1; - break; - } - } - } - rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, pIdxKey, 0, 0, &res); - if( pOp->p4.i==0 ){ - sqlite3DbFree(db, pFree); - } - if( rc!=SQLITE_OK ){ - break; - } - pC->seekResult = res; - alreadyExists = (res==0); - pC->nullRow = 1-alreadyExists; - pC->deferredMoveto = 0; - pC->cacheStatus = CACHE_STALE; - if( pOp->opcode==OP_Found ){ - if( alreadyExists ) pc = pOp->p2 - 1; - }else{ - if( !alreadyExists ) pc = pOp->p2 - 1; - } - break; -} - -/* Opcode: NotExists P1 P2 P3 * * -** Synopsis: intkey=r[P3] -** -** P1 is the index of a cursor open on an SQL table btree (with integer -** keys). P3 is an integer rowid. If P1 does not contain a record with -** rowid P3 then jump immediately to P2. If P1 does contain a record -** with rowid P3 then leave the cursor pointing at that record and fall -** through to the next instruction. -** -** The OP_NotFound opcode performs the same operation on index btrees -** (with arbitrary multi-value keys). -** -** See also: Found, NotFound, NoConflict -*/ -case OP_NotExists: { /* jump, in3 */ - VdbeCursor *pC; - BtCursor *pCrsr; - int res; - u64 iKey; - - pIn3 = &aMem[pOp->p3]; - assert( pIn3->flags & MEM_Int ); - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( pC->isTable ); - assert( pC->pseudoTableReg==0 ); - pCrsr = pC->pCursor; - assert( pCrsr!=0 ); - res = 0; - iKey = pIn3->u.i; - rc = sqlite3BtreeMovetoUnpacked(pCrsr, 0, iKey, 0, &res); - pC->lastRowid = pIn3->u.i; - pC->rowidIsValid = res==0 ?1:0; - pC->nullRow = 0; - pC->cacheStatus = CACHE_STALE; - pC->deferredMoveto = 0; - if( res!=0 ){ - pc = pOp->p2 - 1; - assert( pC->rowidIsValid==0 ); - } - pC->seekResult = res; - break; -} - -/* Opcode: Sequence P1 P2 * * * -** Synopsis: r[P2]=rowid -** -** Find the next available sequence number for cursor P1. -** Write the sequence number into register P2. -** The sequence number on the cursor is incremented after this -** instruction. -*/ -case OP_Sequence: { /* out2-prerelease */ - assert( pOp->p1>=0 && pOp->p1nCursor ); - assert( p->apCsr[pOp->p1]!=0 ); - pOut->u.i = p->apCsr[pOp->p1]->seqCount++; - break; -} - - -/* Opcode: NewRowid P1 P2 P3 * * -** Synopsis: r[P2]=rowid -** -** Get a new integer record number (a.k.a "rowid") used as the key to a table. -** The record number is not previously used as a key in the database -** table that cursor P1 points to. The new record number is written -** written to register P2. -** -** If P3>0 then P3 is a register in the root frame of this VDBE that holds -** the largest previously generated record number. No new record numbers are -** allowed to be less than this value. When this value reaches its maximum, -** an SQLITE_FULL error is generated. The P3 register is updated with the ' -** generated record number. This P3 mechanism is used to help implement the -** AUTOINCREMENT feature. -*/ -case OP_NewRowid: { /* out2-prerelease */ - i64 v; /* The new rowid */ - VdbeCursor *pC; /* Cursor of table to get the new rowid */ - int res; /* Result of an sqlite3BtreeLast() */ - int cnt; /* Counter to limit the number of searches */ - Mem *pMem; /* Register holding largest rowid for AUTOINCREMENT */ - VdbeFrame *pFrame; /* Root frame of VDBE */ - - v = 0; - res = 0; - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - if( NEVER(pC->pCursor==0) ){ - /* The zero initialization above is all that is needed */ - }else{ - /* The next rowid or record number (different terms for the same - ** thing) is obtained in a two-step algorithm. - ** - ** First we attempt to find the largest existing rowid and add one - ** to that. But if the largest existing rowid is already the maximum - ** positive integer, we have to fall through to the second - ** probabilistic algorithm - ** - ** The second algorithm is to select a rowid at random and see if - ** it already exists in the table. If it does not exist, we have - ** succeeded. If the random rowid does exist, we select a new one - ** and try again, up to 100 times. - */ - assert( pC->isTable ); - -#ifdef SQLITE_32BIT_ROWID -# define MAX_ROWID 0x7fffffff -#else - /* Some compilers complain about constants of the form 0x7fffffffffffffff. - ** Others complain about 0x7ffffffffffffffffLL. The following macro seems - ** to provide the constant while making all compilers happy. - */ -# define MAX_ROWID (i64)( (((u64)0x7fffffff)<<32) | (u64)0xffffffff ) -#endif - - if( !pC->useRandomRowid ){ - v = sqlite3BtreeGetCachedRowid(pC->pCursor); - if( v==0 ){ - rc = sqlite3BtreeLast(pC->pCursor, &res); - if( rc!=SQLITE_OK ){ - goto abort_due_to_error; - } - if( res ){ - v = 1; /* IMP: R-61914-48074 */ - }else{ - assert( sqlite3BtreeCursorIsValid(pC->pCursor) ); - rc = sqlite3BtreeKeySize(pC->pCursor, &v); - assert( rc==SQLITE_OK ); /* Cannot fail following BtreeLast() */ - if( v>=MAX_ROWID ){ - pC->useRandomRowid = 1; - }else{ - v++; /* IMP: R-29538-34987 */ - } - } - } - -#ifndef SQLITE_OMIT_AUTOINCREMENT - if( pOp->p3 ){ - /* Assert that P3 is a valid memory cell. */ - assert( pOp->p3>0 ); - if( p->pFrame ){ - for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent); - /* Assert that P3 is a valid memory cell. */ - assert( pOp->p3<=pFrame->nMem ); - pMem = &pFrame->aMem[pOp->p3]; - }else{ - /* Assert that P3 is a valid memory cell. */ - assert( pOp->p3<=(p->nMem-p->nCursor) ); - pMem = &aMem[pOp->p3]; - memAboutToChange(p, pMem); - } - assert( memIsValid(pMem) ); - - REGISTER_TRACE(pOp->p3, pMem); - sqlite3VdbeMemIntegerify(pMem); - assert( (pMem->flags & MEM_Int)!=0 ); /* mem(P3) holds an integer */ - if( pMem->u.i==MAX_ROWID || pC->useRandomRowid ){ - rc = SQLITE_FULL; /* IMP: R-12275-61338 */ - goto abort_due_to_error; - } - if( vu.i+1 ){ - v = pMem->u.i + 1; - } - pMem->u.i = v; - } -#endif - - sqlite3BtreeSetCachedRowid(pC->pCursor, vuseRandomRowid ){ - /* IMPLEMENTATION-OF: R-07677-41881 If the largest ROWID is equal to the - ** largest possible integer (9223372036854775807) then the database - ** engine starts picking positive candidate ROWIDs at random until - ** it finds one that is not previously used. */ - assert( pOp->p3==0 ); /* We cannot be in random rowid mode if this is - ** an AUTOINCREMENT table. */ - /* on the first attempt, simply do one more than previous */ - v = lastRowid; - v &= (MAX_ROWID>>1); /* ensure doesn't go negative */ - v++; /* ensure non-zero */ - cnt = 0; - while( ((rc = sqlite3BtreeMovetoUnpacked(pC->pCursor, 0, (u64)v, - 0, &res))==SQLITE_OK) - && (res==0) - && (++cnt<100)){ - /* collision - try another random rowid */ - sqlite3_randomness(sizeof(v), &v); - if( cnt<5 ){ - /* try "small" random rowids for the initial attempts */ - v &= 0xffffff; - }else{ - v &= (MAX_ROWID>>1); /* ensure doesn't go negative */ - } - v++; /* ensure non-zero */ - } - if( rc==SQLITE_OK && res==0 ){ - rc = SQLITE_FULL; /* IMP: R-38219-53002 */ - goto abort_due_to_error; - } - assert( v>0 ); /* EV: R-40812-03570 */ - } - pC->rowidIsValid = 0; - pC->deferredMoveto = 0; - pC->cacheStatus = CACHE_STALE; - } - pOut->u.i = v; - break; -} - -/* Opcode: Insert P1 P2 P3 P4 P5 -** Synopsis: intkey=r[P3] data=r[P2] -** -** Write an entry into the table of cursor P1. A new entry is -** created if it doesn't already exist or the data for an existing -** entry is overwritten. The data is the value MEM_Blob stored in register -** number P2. The key is stored in register P3. The key must -** be a MEM_Int. -** -** If the OPFLAG_NCHANGE flag of P5 is set, then the row change count is -** incremented (otherwise not). If the OPFLAG_LASTROWID flag of P5 is set, -** then rowid is stored for subsequent return by the -** sqlite3_last_insert_rowid() function (otherwise it is unmodified). -** -** If the OPFLAG_USESEEKRESULT flag of P5 is set and if the result of -** the last seek operation (OP_NotExists) was a success, then this -** operation will not attempt to find the appropriate row before doing -** the insert but will instead overwrite the row that the cursor is -** currently pointing to. Presumably, the prior OP_NotExists opcode -** has already positioned the cursor correctly. This is an optimization -** that boosts performance by avoiding redundant seeks. -** -** If the OPFLAG_ISUPDATE flag is set, then this opcode is part of an -** UPDATE operation. Otherwise (if the flag is clear) then this opcode -** is part of an INSERT operation. The difference is only important to -** the update hook. -** -** Parameter P4 may point to a string containing the table-name, or -** may be NULL. If it is not NULL, then the update-hook -** (sqlite3.xUpdateCallback) is invoked following a successful insert. -** -** (WARNING/TODO: If P1 is a pseudo-cursor and P2 is dynamically -** allocated, then ownership of P2 is transferred to the pseudo-cursor -** and register P2 becomes ephemeral. If the cursor is changed, the -** value of register P2 will then change. Make sure this does not -** cause any problems.) -** -** This instruction only works on tables. The equivalent instruction -** for indices is OP_IdxInsert. -*/ -/* Opcode: InsertInt P1 P2 P3 P4 P5 -** Synopsis: intkey=P3 data=r[P2] -** -** This works exactly like OP_Insert except that the key is the -** integer value P3, not the value of the integer stored in register P3. -*/ -case OP_Insert: -case OP_InsertInt: { - Mem *pData; /* MEM cell holding data for the record to be inserted */ - Mem *pKey; /* MEM cell holding key for the record */ - i64 iKey; /* The integer ROWID or key for the record to be inserted */ - VdbeCursor *pC; /* Cursor to table into which insert is written */ - int nZero; /* Number of zero-bytes to append */ - int seekResult; /* Result of prior seek or 0 if no USESEEKRESULT flag */ - const char *zDb; /* database name - used by the update hook */ - const char *zTbl; /* Table name - used by the opdate hook */ - int op; /* Opcode for update hook: SQLITE_UPDATE or SQLITE_INSERT */ - - pData = &aMem[pOp->p2]; - assert( pOp->p1>=0 && pOp->p1nCursor ); - assert( memIsValid(pData) ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( pC->pCursor!=0 ); - assert( pC->pseudoTableReg==0 ); - assert( pC->isTable ); - REGISTER_TRACE(pOp->p2, pData); - - if( pOp->opcode==OP_Insert ){ - pKey = &aMem[pOp->p3]; - assert( pKey->flags & MEM_Int ); - assert( memIsValid(pKey) ); - REGISTER_TRACE(pOp->p3, pKey); - iKey = pKey->u.i; - }else{ - assert( pOp->opcode==OP_InsertInt ); - iKey = pOp->p3; - } - - if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++; - if( pOp->p5 & OPFLAG_LASTROWID ) db->lastRowid = lastRowid = iKey; - if( pData->flags & MEM_Null ){ - pData->z = 0; - pData->n = 0; - }else{ - assert( pData->flags & (MEM_Blob|MEM_Str) ); - } - seekResult = ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0); - if( pData->flags & MEM_Zero ){ - nZero = pData->u.nZero; - }else{ - nZero = 0; - } - sqlite3BtreeSetCachedRowid(pC->pCursor, 0); - rc = sqlite3BtreeInsert(pC->pCursor, 0, iKey, - pData->z, pData->n, nZero, - (pOp->p5 & OPFLAG_APPEND)!=0, seekResult - ); - pC->rowidIsValid = 0; - pC->deferredMoveto = 0; - pC->cacheStatus = CACHE_STALE; - - /* Invoke the update-hook if required. */ - if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z ){ - zDb = db->aDb[pC->iDb].zName; - zTbl = pOp->p4.z; - op = ((pOp->p5 & OPFLAG_ISUPDATE) ? SQLITE_UPDATE : SQLITE_INSERT); - assert( pC->isTable ); - db->xUpdateCallback(db->pUpdateArg, op, zDb, zTbl, iKey); - assert( pC->iDb>=0 ); - } - break; -} - -/* Opcode: Delete P1 P2 * P4 * -** -** Delete the record at which the P1 cursor is currently pointing. -** -** The cursor will be left pointing at either the next or the previous -** record in the table. If it is left pointing at the next record, then -** the next Next instruction will be a no-op. Hence it is OK to delete -** a record from within an Next loop. -** -** If the OPFLAG_NCHANGE flag of P2 is set, then the row change count is -** incremented (otherwise not). -** -** P1 must not be pseudo-table. It has to be a real table with -** multiple rows. -** -** If P4 is not NULL, then it is the name of the table that P1 is -** pointing to. The update hook will be invoked, if it exists. -** If P4 is not NULL then the P1 cursor must have been positioned -** using OP_NotFound prior to invoking this opcode. -*/ -case OP_Delete: { - i64 iKey; - VdbeCursor *pC; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( pC->pCursor!=0 ); /* Only valid for real tables, no pseudotables */ - iKey = pC->lastRowid; /* Only used for the update hook */ - - /* The OP_Delete opcode always follows an OP_NotExists or OP_Last or - ** OP_Column on the same table without any intervening operations that - ** might move or invalidate the cursor. Hence cursor pC is always pointing - ** to the row to be deleted and the sqlite3VdbeCursorMoveto() operation - ** below is always a no-op and cannot fail. We will run it anyhow, though, - ** to guard against future changes to the code generator. - **/ - assert( pC->deferredMoveto==0 ); - rc = sqlite3VdbeCursorMoveto(pC); - if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error; - - sqlite3BtreeSetCachedRowid(pC->pCursor, 0); - rc = sqlite3BtreeDelete(pC->pCursor); - pC->cacheStatus = CACHE_STALE; - - /* Invoke the update-hook if required. */ - if( rc==SQLITE_OK && db->xUpdateCallback && pOp->p4.z && pC->isTable ){ - db->xUpdateCallback(db->pUpdateArg, SQLITE_DELETE, - db->aDb[pC->iDb].zName, pOp->p4.z, iKey); - assert( pC->iDb>=0 ); - } - if( pOp->p2 & OPFLAG_NCHANGE ) p->nChange++; - break; -} -/* Opcode: ResetCount * * * * * -** -** The value of the change counter is copied to the database handle -** change counter (returned by subsequent calls to sqlite3_changes()). -** Then the VMs internal change counter resets to 0. -** This is used by trigger programs. -*/ -case OP_ResetCount: { - sqlite3VdbeSetChanges(db, p->nChange); - p->nChange = 0; - break; -} - -/* Opcode: SorterCompare P1 P2 P3 P4 -** Synopsis: if key(P1)!=rtrim(r[P3],P4) goto P2 -** -** P1 is a sorter cursor. This instruction compares a prefix of the -** the record blob in register P3 against a prefix of the entry that -** the sorter cursor currently points to. The final P4 fields of both -** the P3 and sorter record are ignored. -** -** If either P3 or the sorter contains a NULL in one of their significant -** fields (not counting the P4 fields at the end which are ignored) then -** the comparison is assumed to be equal. -** -** Fall through to next instruction if the two records compare equal to -** each other. Jump to P2 if they are different. -*/ -case OP_SorterCompare: { - VdbeCursor *pC; - int res; - int nIgnore; - - pC = p->apCsr[pOp->p1]; - assert( isSorter(pC) ); - assert( pOp->p4type==P4_INT32 ); - pIn3 = &aMem[pOp->p3]; - nIgnore = pOp->p4.i; - rc = sqlite3VdbeSorterCompare(pC, pIn3, nIgnore, &res); - if( res ){ - pc = pOp->p2-1; - } - break; -}; - -/* Opcode: SorterData P1 P2 * * * -** Synopsis: r[P2]=data -** -** Write into register P2 the current sorter data for sorter cursor P1. -*/ -case OP_SorterData: { - VdbeCursor *pC; - - pOut = &aMem[pOp->p2]; - pC = p->apCsr[pOp->p1]; - assert( isSorter(pC) ); - rc = sqlite3VdbeSorterRowkey(pC, pOut); - break; -} - -/* Opcode: RowData P1 P2 * * * -** Synopsis: r[P2]=data -** -** Write into register P2 the complete row data for cursor P1. -** There is no interpretation of the data. -** It is just copied onto the P2 register exactly as -** it is found in the database file. -** -** If the P1 cursor must be pointing to a valid row (not a NULL row) -** of a real table, not a pseudo-table. -*/ -/* Opcode: RowKey P1 P2 * * * -** Synopsis: r[P2]=key -** -** Write into register P2 the complete row key for cursor P1. -** There is no interpretation of the data. -** The key is copied onto the P3 register exactly as -** it is found in the database file. -** -** If the P1 cursor must be pointing to a valid row (not a NULL row) -** of a real table, not a pseudo-table. -*/ -case OP_RowKey: -case OP_RowData: { - VdbeCursor *pC; - BtCursor *pCrsr; - u32 n; - i64 n64; - - pOut = &aMem[pOp->p2]; - memAboutToChange(p, pOut); - - /* Note that RowKey and RowData are really exactly the same instruction */ - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( isSorter(pC)==0 ); - assert( pC->isTable || pOp->opcode!=OP_RowData ); - assert( pC->isTable==0 || pOp->opcode==OP_RowData ); - assert( pC!=0 ); - assert( pC->nullRow==0 ); - assert( pC->pseudoTableReg==0 ); - assert( pC->pCursor!=0 ); - pCrsr = pC->pCursor; - assert( sqlite3BtreeCursorIsValid(pCrsr) ); - - /* The OP_RowKey and OP_RowData opcodes always follow OP_NotExists or - ** OP_Rewind/Op_Next with no intervening instructions that might invalidate - ** the cursor. Hence the following sqlite3VdbeCursorMoveto() call is always - ** a no-op and can never fail. But we leave it in place as a safety. - */ - assert( pC->deferredMoveto==0 ); - rc = sqlite3VdbeCursorMoveto(pC); - if( NEVER(rc!=SQLITE_OK) ) goto abort_due_to_error; - - if( pC->isTable==0 ){ - assert( !pC->isTable ); - VVA_ONLY(rc =) sqlite3BtreeKeySize(pCrsr, &n64); - assert( rc==SQLITE_OK ); /* True because of CursorMoveto() call above */ - if( n64>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } - n = (u32)n64; - }else{ - VVA_ONLY(rc =) sqlite3BtreeDataSize(pCrsr, &n); - assert( rc==SQLITE_OK ); /* DataSize() cannot fail */ - if( n>(u32)db->aLimit[SQLITE_LIMIT_LENGTH] ){ - goto too_big; - } - } - if( sqlite3VdbeMemGrow(pOut, n, 0) ){ - goto no_mem; - } - pOut->n = n; - MemSetTypeFlag(pOut, MEM_Blob); - if( pC->isTable==0 ){ - rc = sqlite3BtreeKey(pCrsr, 0, n, pOut->z); - }else{ - rc = sqlite3BtreeData(pCrsr, 0, n, pOut->z); - } - pOut->enc = SQLITE_UTF8; /* In case the blob is ever cast to text */ - UPDATE_MAX_BLOBSIZE(pOut); - REGISTER_TRACE(pOp->p2, pOut); - break; -} - -/* Opcode: Rowid P1 P2 * * * -** Synopsis: r[P2]=rowid -** -** Store in register P2 an integer which is the key of the table entry that -** P1 is currently point to. -** -** P1 can be either an ordinary table or a virtual table. There used to -** be a separate OP_VRowid opcode for use with virtual tables, but this -** one opcode now works for both table types. -*/ -case OP_Rowid: { /* out2-prerelease */ - VdbeCursor *pC; - i64 v; - sqlite3_vtab *pVtab; - const sqlite3_module *pModule; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( pC->pseudoTableReg==0 || pC->nullRow ); - if( pC->nullRow ){ - pOut->flags = MEM_Null; - break; - }else if( pC->deferredMoveto ){ - v = pC->movetoTarget; -#ifndef SQLITE_OMIT_VIRTUALTABLE - }else if( pC->pVtabCursor ){ - pVtab = pC->pVtabCursor->pVtab; - pModule = pVtab->pModule; - assert( pModule->xRowid ); - rc = pModule->xRowid(pC->pVtabCursor, &v); - sqlite3VtabImportErrmsg(p, pVtab); -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - }else{ - assert( pC->pCursor!=0 ); - rc = sqlite3VdbeCursorMoveto(pC); - if( rc ) goto abort_due_to_error; - if( pC->rowidIsValid ){ - v = pC->lastRowid; - }else{ - rc = sqlite3BtreeKeySize(pC->pCursor, &v); - assert( rc==SQLITE_OK ); /* Always so because of CursorMoveto() above */ - } - } - pOut->u.i = v; - break; -} - -/* Opcode: NullRow P1 * * * * -** -** Move the cursor P1 to a null row. Any OP_Column operations -** that occur while the cursor is on the null row will always -** write a NULL. -*/ -case OP_NullRow: { - VdbeCursor *pC; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - pC->nullRow = 1; - pC->rowidIsValid = 0; - pC->cacheStatus = CACHE_STALE; - if( pC->pCursor ){ - sqlite3BtreeClearCursor(pC->pCursor); - } - break; -} - -/* Opcode: Last P1 P2 * * * -** -** The next use of the Rowid or Column or Next instruction for P1 -** will refer to the last entry in the database table or index. -** If the table or index is empty and P2>0, then jump immediately to P2. -** If P2 is 0 or if the table or index is not empty, fall through -** to the following instruction. -*/ -case OP_Last: { /* jump */ - VdbeCursor *pC; - BtCursor *pCrsr; - int res; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - pCrsr = pC->pCursor; - res = 0; - assert( pCrsr!=0 ); - rc = sqlite3BtreeLast(pCrsr, &res); - pC->nullRow = (u8)res; - pC->deferredMoveto = 0; - pC->rowidIsValid = 0; - pC->cacheStatus = CACHE_STALE; - if( pOp->p2>0 && res ){ - pc = pOp->p2 - 1; - } - break; -} - - -/* Opcode: Sort P1 P2 * * * -** -** This opcode does exactly the same thing as OP_Rewind except that -** it increments an undocumented global variable used for testing. -** -** Sorting is accomplished by writing records into a sorting index, -** then rewinding that index and playing it back from beginning to -** end. We use the OP_Sort opcode instead of OP_Rewind to do the -** rewinding so that the global variable will be incremented and -** regression tests can determine whether or not the optimizer is -** correctly optimizing out sorts. -*/ -case OP_SorterSort: /* jump */ -case OP_Sort: { /* jump */ -#ifdef SQLITE_TEST - sqlite3_sort_count++; - sqlite3_search_count--; -#endif - p->aCounter[SQLITE_STMTSTATUS_SORT]++; - /* Fall through into OP_Rewind */ -} -/* Opcode: Rewind P1 P2 * * * -** -** The next use of the Rowid or Column or Next instruction for P1 -** will refer to the first entry in the database table or index. -** If the table or index is empty and P2>0, then jump immediately to P2. -** If P2 is 0 or if the table or index is not empty, fall through -** to the following instruction. -*/ -case OP_Rewind: { /* jump */ - VdbeCursor *pC; - BtCursor *pCrsr; - int res; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( isSorter(pC)==(pOp->opcode==OP_SorterSort) ); - res = 1; - if( isSorter(pC) ){ - rc = sqlite3VdbeSorterRewind(db, pC, &res); - }else{ - pCrsr = pC->pCursor; - assert( pCrsr ); - rc = sqlite3BtreeFirst(pCrsr, &res); - pC->deferredMoveto = 0; - pC->cacheStatus = CACHE_STALE; - pC->rowidIsValid = 0; - } - pC->nullRow = (u8)res; - assert( pOp->p2>0 && pOp->p2nOp ); - if( res ){ - pc = pOp->p2 - 1; - } - break; -} - -/* Opcode: Next P1 P2 * * P5 -** -** Advance cursor P1 so that it points to the next key/data pair in its -** table or index. If there are no more key/value pairs then fall through -** to the following instruction. But if the cursor advance was successful, -** jump immediately to P2. -** -** The P1 cursor must be for a real table, not a pseudo-table. P1 must have -** been opened prior to this opcode or the program will segfault. -** -** P4 is always of type P4_ADVANCE. The function pointer points to -** sqlite3BtreeNext(). -** -** If P5 is positive and the jump is taken, then event counter -** number P5-1 in the prepared statement is incremented. -** -** See also: Prev, NextIfOpen -*/ -/* Opcode: NextIfOpen P1 P2 * * P5 -** -** This opcode works just like OP_Next except that if cursor P1 is not -** open it behaves a no-op. -*/ -/* Opcode: Prev P1 P2 * * P5 -** -** Back up cursor P1 so that it points to the previous key/data pair in its -** table or index. If there is no previous key/value pairs then fall through -** to the following instruction. But if the cursor backup was successful, -** jump immediately to P2. -** -** The P1 cursor must be for a real table, not a pseudo-table. If P1 is -** not open then the behavior is undefined. -** -** P4 is always of type P4_ADVANCE. The function pointer points to -** sqlite3BtreePrevious(). -** -** If P5 is positive and the jump is taken, then event counter -** number P5-1 in the prepared statement is incremented. -*/ -/* Opcode: PrevIfOpen P1 P2 * * P5 -** -** This opcode works just like OP_Prev except that if cursor P1 is not -** open it behaves a no-op. -*/ -case OP_SorterNext: { /* jump */ - VdbeCursor *pC; - int res; - - pC = p->apCsr[pOp->p1]; - assert( isSorter(pC) ); - rc = sqlite3VdbeSorterNext(db, pC, &res); - goto next_tail; -case OP_PrevIfOpen: /* jump */ -case OP_NextIfOpen: /* jump */ - if( p->apCsr[pOp->p1]==0 ) break; - /* Fall through */ -case OP_Prev: /* jump */ -case OP_Next: /* jump */ - assert( pOp->p1>=0 && pOp->p1nCursor ); - assert( pOp->p5aCounter) ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( pC->deferredMoveto==0 ); - assert( pC->pCursor ); - assert( pOp->opcode!=OP_Next || pOp->p4.xAdvance==sqlite3BtreeNext ); - assert( pOp->opcode!=OP_Prev || pOp->p4.xAdvance==sqlite3BtreePrevious ); - assert( pOp->opcode!=OP_NextIfOpen || pOp->p4.xAdvance==sqlite3BtreeNext ); - assert( pOp->opcode!=OP_PrevIfOpen || pOp->p4.xAdvance==sqlite3BtreePrevious); - rc = pOp->p4.xAdvance(pC->pCursor, &res); -next_tail: - pC->cacheStatus = CACHE_STALE; - if( res==0 ){ - pC->nullRow = 0; - pc = pOp->p2 - 1; - p->aCounter[pOp->p5]++; -#ifdef SQLITE_TEST - sqlite3_search_count++; -#endif - }else{ - pC->nullRow = 1; - } - pC->rowidIsValid = 0; - goto check_for_interrupt; -} - -/* Opcode: IdxInsert P1 P2 P3 * P5 -** Synopsis: key=r[P2] -** -** Register P2 holds an SQL index key made using the -** MakeRecord instructions. This opcode writes that key -** into the index P1. Data for the entry is nil. -** -** P3 is a flag that provides a hint to the b-tree layer that this -** insert is likely to be an append. -** -** This instruction only works for indices. The equivalent instruction -** for tables is OP_Insert. -*/ -case OP_SorterInsert: /* in2 */ -case OP_IdxInsert: { /* in2 */ - VdbeCursor *pC; - BtCursor *pCrsr; - int nKey; - const char *zKey; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( isSorter(pC)==(pOp->opcode==OP_SorterInsert) ); - pIn2 = &aMem[pOp->p2]; - assert( pIn2->flags & MEM_Blob ); - pCrsr = pC->pCursor; - if( pOp->p5 & OPFLAG_NCHANGE ) p->nChange++; - assert( pCrsr!=0 ); - assert( pC->isTable==0 ); - rc = ExpandBlob(pIn2); - if( rc==SQLITE_OK ){ - if( isSorter(pC) ){ - rc = sqlite3VdbeSorterWrite(db, pC, pIn2); - }else{ - nKey = pIn2->n; - zKey = pIn2->z; - rc = sqlite3BtreeInsert(pCrsr, zKey, nKey, "", 0, 0, pOp->p3, - ((pOp->p5 & OPFLAG_USESEEKRESULT) ? pC->seekResult : 0) - ); - assert( pC->deferredMoveto==0 ); - pC->cacheStatus = CACHE_STALE; - } - } - break; -} - -/* Opcode: IdxDelete P1 P2 P3 * * -** Synopsis: key=r[P2@P3] -** -** The content of P3 registers starting at register P2 form -** an unpacked index key. This opcode removes that entry from the -** index opened by cursor P1. -*/ -case OP_IdxDelete: { - VdbeCursor *pC; - BtCursor *pCrsr; - int res; - UnpackedRecord r; - - assert( pOp->p3>0 ); - assert( pOp->p2>0 && pOp->p2+pOp->p3<=(p->nMem-p->nCursor)+1 ); - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - pCrsr = pC->pCursor; - assert( pCrsr!=0 ); - assert( pOp->p5==0 ); - r.pKeyInfo = pC->pKeyInfo; - r.nField = (u16)pOp->p3; - r.flags = UNPACKED_PREFIX_MATCH; - r.aMem = &aMem[pOp->p2]; -#ifdef SQLITE_DEBUG - { int i; for(i=0; ideferredMoveto==0 ); - pC->cacheStatus = CACHE_STALE; - break; -} - -/* Opcode: IdxRowid P1 P2 * * * -** Synopsis: r[P2]=rowid -** -** Write into register P2 an integer which is the last entry in the record at -** the end of the index key pointed to by cursor P1. This integer should be -** the rowid of the table entry to which this index entry points. -** -** See also: Rowid, MakeRecord. -*/ -case OP_IdxRowid: { /* out2-prerelease */ - BtCursor *pCrsr; - VdbeCursor *pC; - i64 rowid; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - pCrsr = pC->pCursor; - assert( pCrsr!=0 ); - pOut->flags = MEM_Null; - rc = sqlite3VdbeCursorMoveto(pC); - if( NEVER(rc) ) goto abort_due_to_error; - assert( pC->deferredMoveto==0 ); - assert( pC->isTable==0 ); - if( !pC->nullRow ){ - rowid = 0; /* Not needed. Only used to silence a warning. */ - rc = sqlite3VdbeIdxRowid(db, pCrsr, &rowid); - if( rc!=SQLITE_OK ){ - goto abort_due_to_error; - } - pOut->u.i = rowid; - pOut->flags = MEM_Int; - } - break; -} - -/* Opcode: IdxGE P1 P2 P3 P4 P5 -** Synopsis: key=r[P3@P4] -** -** The P4 register values beginning with P3 form an unpacked index -** key that omits the ROWID. Compare this key value against the index -** that P1 is currently pointing to, ignoring the ROWID on the P1 index. -** -** If the P1 index entry is greater than or equal to the key value -** then jump to P2. Otherwise fall through to the next instruction. -** -** If P5 is non-zero then the key value is increased by an epsilon -** prior to the comparison. This make the opcode work like IdxGT except -** that if the key from register P3 is a prefix of the key in the cursor, -** the result is false whereas it would be true with IdxGT. -*/ -/* Opcode: IdxLT P1 P2 P3 P4 P5 -** Synopsis: key=r[P3@P4] -** -** The P4 register values beginning with P3 form an unpacked index -** key that omits the ROWID. Compare this key value against the index -** that P1 is currently pointing to, ignoring the ROWID on the P1 index. -** -** If the P1 index entry is less than the key value then jump to P2. -** Otherwise fall through to the next instruction. -** -** If P5 is non-zero then the key value is increased by an epsilon prior -** to the comparison. This makes the opcode work like IdxLE. -*/ -case OP_IdxLT: /* jump */ -case OP_IdxGE: { /* jump */ - VdbeCursor *pC; - int res; - UnpackedRecord r; - - assert( pOp->p1>=0 && pOp->p1nCursor ); - pC = p->apCsr[pOp->p1]; - assert( pC!=0 ); - assert( pC->isOrdered ); - assert( pC->pCursor!=0); - assert( pC->deferredMoveto==0 ); - assert( pOp->p5==0 || pOp->p5==1 ); - assert( pOp->p4type==P4_INT32 ); - r.pKeyInfo = pC->pKeyInfo; - r.nField = (u16)pOp->p4.i; - if( pOp->p5 ){ - r.flags = UNPACKED_INCRKEY | UNPACKED_PREFIX_MATCH; - }else{ - r.flags = UNPACKED_PREFIX_MATCH; - } - r.aMem = &aMem[pOp->p3]; -#ifdef SQLITE_DEBUG - { int i; for(i=0; iopcode==OP_IdxLT ){ - res = -res; - }else{ - assert( pOp->opcode==OP_IdxGE ); - res++; - } - if( res>0 ){ - pc = pOp->p2 - 1 ; - } - break; -} - -/* Opcode: Destroy P1 P2 P3 * * -** -** Delete an entire database table or index whose root page in the database -** file is given by P1. -** -** The table being destroyed is in the main database file if P3==0. If -** P3==1 then the table to be clear is in the auxiliary database file -** that is used to store tables create using CREATE TEMPORARY TABLE. -** -** If AUTOVACUUM is enabled then it is possible that another root page -** might be moved into the newly deleted root page in order to keep all -** root pages contiguous at the beginning of the database. The former -** value of the root page that moved - its value before the move occurred - -** is stored in register P2. If no page -** movement was required (because the table being dropped was already -** the last one in the database) then a zero is stored in register P2. -** If AUTOVACUUM is disabled then a zero is stored in register P2. -** -** See also: Clear -*/ -case OP_Destroy: { /* out2-prerelease */ - int iMoved; - int iCnt; - Vdbe *pVdbe; - int iDb; - - assert( p->readOnly==0 ); -#ifndef SQLITE_OMIT_VIRTUALTABLE - iCnt = 0; - for(pVdbe=db->pVdbe; pVdbe; pVdbe = pVdbe->pNext){ - if( pVdbe->magic==VDBE_MAGIC_RUN && pVdbe->bIsReader - && pVdbe->inVtabMethod<2 && pVdbe->pc>=0 - ){ - iCnt++; - } - } -#else - iCnt = db->nVdbeRead; -#endif - pOut->flags = MEM_Null; - if( iCnt>1 ){ - rc = SQLITE_LOCKED; - p->errorAction = OE_Abort; - }else{ - iDb = pOp->p3; - assert( iCnt==1 ); - assert( (p->btreeMask & (((yDbMask)1)<aDb[iDb].pBt, pOp->p1, &iMoved); - pOut->flags = MEM_Int; - pOut->u.i = iMoved; -#ifndef SQLITE_OMIT_AUTOVACUUM - if( rc==SQLITE_OK && iMoved!=0 ){ - sqlite3RootPageMoved(db, iDb, iMoved, pOp->p1); - /* All OP_Destroy operations occur on the same btree */ - assert( resetSchemaOnFault==0 || resetSchemaOnFault==iDb+1 ); - resetSchemaOnFault = iDb+1; - } -#endif - } - break; -} - -/* Opcode: Clear P1 P2 P3 -** -** Delete all contents of the database table or index whose root page -** in the database file is given by P1. But, unlike Destroy, do not -** remove the table or index from the database file. -** -** The table being clear is in the main database file if P2==0. If -** P2==1 then the table to be clear is in the auxiliary database file -** that is used to store tables create using CREATE TEMPORARY TABLE. -** -** If the P3 value is non-zero, then the table referred to must be an -** intkey table (an SQL table, not an index). In this case the row change -** count is incremented by the number of rows in the table being cleared. -** If P3 is greater than zero, then the value stored in register P3 is -** also incremented by the number of rows in the table being cleared. -** -** See also: Destroy -*/ -case OP_Clear: { - int nChange; - - nChange = 0; - assert( p->readOnly==0 ); - assert( pOp->p1!=1 ); - assert( (p->btreeMask & (((yDbMask)1)<p2))!=0 ); - rc = sqlite3BtreeClearTable( - db->aDb[pOp->p2].pBt, pOp->p1, (pOp->p3 ? &nChange : 0) - ); - if( pOp->p3 ){ - p->nChange += nChange; - if( pOp->p3>0 ){ - assert( memIsValid(&aMem[pOp->p3]) ); - memAboutToChange(p, &aMem[pOp->p3]); - aMem[pOp->p3].u.i += nChange; - } - } - break; -} - -/* Opcode: CreateTable P1 P2 * * * -** Synopsis: r[P2]=root iDb=P1 -** -** Allocate a new table in the main database file if P1==0 or in the -** auxiliary database file if P1==1 or in an attached database if -** P1>1. Write the root page number of the new table into -** register P2 -** -** The difference between a table and an index is this: A table must -** have a 4-byte integer key and can have arbitrary data. An index -** has an arbitrary key but no data. -** -** See also: CreateIndex -*/ -/* Opcode: CreateIndex P1 P2 * * * -** Synopsis: r[P2]=root iDb=P1 -** -** Allocate a new index in the main database file if P1==0 or in the -** auxiliary database file if P1==1 or in an attached database if -** P1>1. Write the root page number of the new table into -** register P2. -** -** See documentation on OP_CreateTable for additional information. -*/ -case OP_CreateIndex: /* out2-prerelease */ -case OP_CreateTable: { /* out2-prerelease */ - int pgno; - int flags; - Db *pDb; - - pgno = 0; - assert( pOp->p1>=0 && pOp->p1nDb ); - assert( (p->btreeMask & (((yDbMask)1)<p1))!=0 ); - assert( p->readOnly==0 ); - pDb = &db->aDb[pOp->p1]; - assert( pDb->pBt!=0 ); - if( pOp->opcode==OP_CreateTable ){ - /* flags = BTREE_INTKEY; */ - flags = BTREE_INTKEY; - }else{ - flags = BTREE_BLOBKEY; - } - rc = sqlite3BtreeCreateTable(pDb->pBt, &pgno, flags); - pOut->u.i = pgno; - break; -} - -/* Opcode: ParseSchema P1 * * P4 * -** -** Read and parse all entries from the SQLITE_MASTER table of database P1 -** that match the WHERE clause P4. -** -** This opcode invokes the parser to create a new virtual machine, -** then runs the new virtual machine. It is thus a re-entrant opcode. -*/ -case OP_ParseSchema: { - int iDb; - const char *zMaster; - char *zSql; - InitData initData; - - /* Any prepared statement that invokes this opcode will hold mutexes - ** on every btree. This is a prerequisite for invoking - ** sqlite3InitCallback(). - */ -#ifdef SQLITE_DEBUG - for(iDb=0; iDbnDb; iDb++){ - assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); - } -#endif - - iDb = pOp->p1; - assert( iDb>=0 && iDbnDb ); - assert( DbHasProperty(db, iDb, DB_SchemaLoaded) ); - /* Used to be a conditional */ { - zMaster = SCHEMA_TABLE(iDb); - initData.db = db; - initData.iDb = pOp->p1; - initData.pzErrMsg = &p->zErrMsg; - zSql = sqlite3MPrintf(db, - "SELECT name, rootpage, sql FROM '%q'.%s WHERE %s ORDER BY rowid", - db->aDb[iDb].zName, zMaster, pOp->p4.z); - if( zSql==0 ){ - rc = SQLITE_NOMEM; - }else{ - assert( db->init.busy==0 ); - db->init.busy = 1; - initData.rc = SQLITE_OK; - assert( !db->mallocFailed ); - rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0); - if( rc==SQLITE_OK ) rc = initData.rc; - sqlite3DbFree(db, zSql); - db->init.busy = 0; - } - } - if( rc ) sqlite3ResetAllSchemasOfConnection(db); - if( rc==SQLITE_NOMEM ){ - goto no_mem; - } - break; -} - -#if !defined(SQLITE_OMIT_ANALYZE) -/* Opcode: LoadAnalysis P1 * * * * -** -** Read the sqlite_stat1 table for database P1 and load the content -** of that table into the internal index hash table. This will cause -** the analysis to be used when preparing all subsequent queries. -*/ -case OP_LoadAnalysis: { - assert( pOp->p1>=0 && pOp->p1nDb ); - rc = sqlite3AnalysisLoad(db, pOp->p1); - break; -} -#endif /* !defined(SQLITE_OMIT_ANALYZE) */ - -/* Opcode: DropTable P1 * * P4 * -** -** Remove the internal (in-memory) data structures that describe -** the table named P4 in database P1. This is called after a table -** is dropped in order to keep the internal representation of the -** schema consistent with what is on disk. -*/ -case OP_DropTable: { - sqlite3UnlinkAndDeleteTable(db, pOp->p1, pOp->p4.z); - break; -} - -/* Opcode: DropIndex P1 * * P4 * -** -** Remove the internal (in-memory) data structures that describe -** the index named P4 in database P1. This is called after an index -** is dropped in order to keep the internal representation of the -** schema consistent with what is on disk. -*/ -case OP_DropIndex: { - sqlite3UnlinkAndDeleteIndex(db, pOp->p1, pOp->p4.z); - break; -} - -/* Opcode: DropTrigger P1 * * P4 * -** -** Remove the internal (in-memory) data structures that describe -** the trigger named P4 in database P1. This is called after a trigger -** is dropped in order to keep the internal representation of the -** schema consistent with what is on disk. -*/ -case OP_DropTrigger: { - sqlite3UnlinkAndDeleteTrigger(db, pOp->p1, pOp->p4.z); - break; -} - - -#ifndef SQLITE_OMIT_INTEGRITY_CHECK -/* Opcode: IntegrityCk P1 P2 P3 * P5 -** -** Do an analysis of the currently open database. Store in -** register P1 the text of an error message describing any problems. -** If no problems are found, store a NULL in register P1. -** -** The register P3 contains the maximum number of allowed errors. -** At most reg(P3) errors will be reported. -** In other words, the analysis stops as soon as reg(P1) errors are -** seen. Reg(P1) is updated with the number of errors remaining. -** -** The root page numbers of all tables in the database are integer -** stored in reg(P1), reg(P1+1), reg(P1+2), .... There are P2 tables -** total. -** -** If P5 is not zero, the check is done on the auxiliary database -** file, not the main database file. -** -** This opcode is used to implement the integrity_check pragma. -*/ -case OP_IntegrityCk: { - int nRoot; /* Number of tables to check. (Number of root pages.) */ - int *aRoot; /* Array of rootpage numbers for tables to be checked */ - int j; /* Loop counter */ - int nErr; /* Number of errors reported */ - char *z; /* Text of the error report */ - Mem *pnErr; /* Register keeping track of errors remaining */ - - assert( p->bIsReader ); - nRoot = pOp->p2; - assert( nRoot>0 ); - aRoot = sqlite3DbMallocRaw(db, sizeof(int)*(nRoot+1) ); - if( aRoot==0 ) goto no_mem; - assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); - pnErr = &aMem[pOp->p3]; - assert( (pnErr->flags & MEM_Int)!=0 ); - assert( (pnErr->flags & (MEM_Str|MEM_Blob))==0 ); - pIn1 = &aMem[pOp->p1]; - for(j=0; jp5nDb ); - assert( (p->btreeMask & (((yDbMask)1)<p5))!=0 ); - z = sqlite3BtreeIntegrityCheck(db->aDb[pOp->p5].pBt, aRoot, nRoot, - (int)pnErr->u.i, &nErr); - sqlite3DbFree(db, aRoot); - pnErr->u.i -= nErr; - sqlite3VdbeMemSetNull(pIn1); - if( nErr==0 ){ - assert( z==0 ); - }else if( z==0 ){ - goto no_mem; - }else{ - sqlite3VdbeMemSetStr(pIn1, z, -1, SQLITE_UTF8, sqlite3_free); - } - UPDATE_MAX_BLOBSIZE(pIn1); - sqlite3VdbeChangeEncoding(pIn1, encoding); - break; -} -#endif /* SQLITE_OMIT_INTEGRITY_CHECK */ - -/* Opcode: RowSetAdd P1 P2 * * * -** Synopsis: rowset(P1)=r[P2] -** -** Insert the integer value held by register P2 into a boolean index -** held in register P1. -** -** An assertion fails if P2 is not an integer. -*/ -case OP_RowSetAdd: { /* in1, in2 */ - pIn1 = &aMem[pOp->p1]; - pIn2 = &aMem[pOp->p2]; - assert( (pIn2->flags & MEM_Int)!=0 ); - if( (pIn1->flags & MEM_RowSet)==0 ){ - sqlite3VdbeMemSetRowSet(pIn1); - if( (pIn1->flags & MEM_RowSet)==0 ) goto no_mem; - } - sqlite3RowSetInsert(pIn1->u.pRowSet, pIn2->u.i); - break; -} - -/* Opcode: RowSetRead P1 P2 P3 * * -** Synopsis: r[P3]=rowset(P1) -** -** Extract the smallest value from boolean index P1 and put that value into -** register P3. Or, if boolean index P1 is initially empty, leave P3 -** unchanged and jump to instruction P2. -*/ -case OP_RowSetRead: { /* jump, in1, out3 */ - i64 val; - - pIn1 = &aMem[pOp->p1]; - if( (pIn1->flags & MEM_RowSet)==0 - || sqlite3RowSetNext(pIn1->u.pRowSet, &val)==0 - ){ - /* The boolean index is empty */ - sqlite3VdbeMemSetNull(pIn1); - pc = pOp->p2 - 1; - }else{ - /* A value was pulled from the index */ - sqlite3VdbeMemSetInt64(&aMem[pOp->p3], val); - } - goto check_for_interrupt; -} - -/* Opcode: RowSetTest P1 P2 P3 P4 -** Synopsis: if r[P3] in rowset(P1) goto P2 -** -** Register P3 is assumed to hold a 64-bit integer value. If register P1 -** contains a RowSet object and that RowSet object contains -** the value held in P3, jump to register P2. Otherwise, insert the -** integer in P3 into the RowSet and continue on to the -** next opcode. -** -** The RowSet object is optimized for the case where successive sets -** of integers, where each set contains no duplicates. Each set -** of values is identified by a unique P4 value. The first set -** must have P4==0, the final set P4=-1. P4 must be either -1 or -** non-negative. For non-negative values of P4 only the lower 4 -** bits are significant. -** -** This allows optimizations: (a) when P4==0 there is no need to test -** the rowset object for P3, as it is guaranteed not to contain it, -** (b) when P4==-1 there is no need to insert the value, as it will -** never be tested for, and (c) when a value that is part of set X is -** inserted, there is no need to search to see if the same value was -** previously inserted as part of set X (only if it was previously -** inserted as part of some other set). -*/ -case OP_RowSetTest: { /* jump, in1, in3 */ - int iSet; - int exists; - - pIn1 = &aMem[pOp->p1]; - pIn3 = &aMem[pOp->p3]; - iSet = pOp->p4.i; - assert( pIn3->flags&MEM_Int ); - - /* If there is anything other than a rowset object in memory cell P1, - ** delete it now and initialize P1 with an empty rowset - */ - if( (pIn1->flags & MEM_RowSet)==0 ){ - sqlite3VdbeMemSetRowSet(pIn1); - if( (pIn1->flags & MEM_RowSet)==0 ) goto no_mem; - } - - assert( pOp->p4type==P4_INT32 ); - assert( iSet==-1 || iSet>=0 ); - if( iSet ){ - exists = sqlite3RowSetTest(pIn1->u.pRowSet, - (u8)(iSet>=0 ? iSet & 0xf : 0xff), - pIn3->u.i); - if( exists ){ - pc = pOp->p2 - 1; - break; - } - } - if( iSet>=0 ){ - sqlite3RowSetInsert(pIn1->u.pRowSet, pIn3->u.i); - } - break; -} - - -#ifndef SQLITE_OMIT_TRIGGER - -/* Opcode: Program P1 P2 P3 P4 * -** -** Execute the trigger program passed as P4 (type P4_SUBPROGRAM). -** -** P1 contains the address of the memory cell that contains the first memory -** cell in an array of values used as arguments to the sub-program. P2 -** contains the address to jump to if the sub-program throws an IGNORE -** exception using the RAISE() function. Register P3 contains the address -** of a memory cell in this (the parent) VM that is used to allocate the -** memory required by the sub-vdbe at runtime. -** -** P4 is a pointer to the VM containing the trigger program. -*/ -case OP_Program: { /* jump */ - int nMem; /* Number of memory registers for sub-program */ - int nByte; /* Bytes of runtime space required for sub-program */ - Mem *pRt; /* Register to allocate runtime space */ - Mem *pMem; /* Used to iterate through memory cells */ - Mem *pEnd; /* Last memory cell in new array */ - VdbeFrame *pFrame; /* New vdbe frame to execute in */ - SubProgram *pProgram; /* Sub-program to execute */ - void *t; /* Token identifying trigger */ - - pProgram = pOp->p4.pProgram; - pRt = &aMem[pOp->p3]; - assert( pProgram->nOp>0 ); - - /* If the p5 flag is clear, then recursive invocation of triggers is - ** disabled for backwards compatibility (p5 is set if this sub-program - ** is really a trigger, not a foreign key action, and the flag set - ** and cleared by the "PRAGMA recursive_triggers" command is clear). - ** - ** It is recursive invocation of triggers, at the SQL level, that is - ** disabled. In some cases a single trigger may generate more than one - ** SubProgram (if the trigger may be executed with more than one different - ** ON CONFLICT algorithm). SubProgram structures associated with a - ** single trigger all have the same value for the SubProgram.token - ** variable. */ - if( pOp->p5 ){ - t = pProgram->token; - for(pFrame=p->pFrame; pFrame && pFrame->token!=t; pFrame=pFrame->pParent); - if( pFrame ) break; - } - - if( p->nFrame>=db->aLimit[SQLITE_LIMIT_TRIGGER_DEPTH] ){ - rc = SQLITE_ERROR; - sqlite3SetString(&p->zErrMsg, db, "too many levels of trigger recursion"); - break; - } - - /* Register pRt is used to store the memory required to save the state - ** of the current program, and the memory required at runtime to execute - ** the trigger program. If this trigger has been fired before, then pRt - ** is already allocated. Otherwise, it must be initialized. */ - if( (pRt->flags&MEM_Frame)==0 ){ - /* SubProgram.nMem is set to the number of memory cells used by the - ** program stored in SubProgram.aOp. As well as these, one memory - ** cell is required for each cursor used by the program. Set local - ** variable nMem (and later, VdbeFrame.nChildMem) to this value. - */ - nMem = pProgram->nMem + pProgram->nCsr; - nByte = ROUND8(sizeof(VdbeFrame)) - + nMem * sizeof(Mem) - + pProgram->nCsr * sizeof(VdbeCursor *) - + pProgram->nOnce * sizeof(u8); - pFrame = sqlite3DbMallocZero(db, nByte); - if( !pFrame ){ - goto no_mem; - } - sqlite3VdbeMemRelease(pRt); - pRt->flags = MEM_Frame; - pRt->u.pFrame = pFrame; - - pFrame->v = p; - pFrame->nChildMem = nMem; - pFrame->nChildCsr = pProgram->nCsr; - pFrame->pc = pc; - pFrame->aMem = p->aMem; - pFrame->nMem = p->nMem; - pFrame->apCsr = p->apCsr; - pFrame->nCursor = p->nCursor; - pFrame->aOp = p->aOp; - pFrame->nOp = p->nOp; - pFrame->token = pProgram->token; - pFrame->aOnceFlag = p->aOnceFlag; - pFrame->nOnceFlag = p->nOnceFlag; - - pEnd = &VdbeFrameMem(pFrame)[pFrame->nChildMem]; - for(pMem=VdbeFrameMem(pFrame); pMem!=pEnd; pMem++){ - pMem->flags = MEM_Invalid; - pMem->db = db; - } - }else{ - pFrame = pRt->u.pFrame; - assert( pProgram->nMem+pProgram->nCsr==pFrame->nChildMem ); - assert( pProgram->nCsr==pFrame->nChildCsr ); - assert( pc==pFrame->pc ); - } - - p->nFrame++; - pFrame->pParent = p->pFrame; - pFrame->lastRowid = lastRowid; - pFrame->nChange = p->nChange; - p->nChange = 0; - p->pFrame = pFrame; - p->aMem = aMem = &VdbeFrameMem(pFrame)[-1]; - p->nMem = pFrame->nChildMem; - p->nCursor = (u16)pFrame->nChildCsr; - p->apCsr = (VdbeCursor **)&aMem[p->nMem+1]; - p->aOp = aOp = pProgram->aOp; - p->nOp = pProgram->nOp; - p->aOnceFlag = (u8 *)&p->apCsr[p->nCursor]; - p->nOnceFlag = pProgram->nOnce; - pc = -1; - memset(p->aOnceFlag, 0, p->nOnceFlag); - - break; -} - -/* Opcode: Param P1 P2 * * * -** -** This opcode is only ever present in sub-programs called via the -** OP_Program instruction. Copy a value currently stored in a memory -** cell of the calling (parent) frame to cell P2 in the current frames -** address space. This is used by trigger programs to access the new.* -** and old.* values. -** -** The address of the cell in the parent frame is determined by adding -** the value of the P1 argument to the value of the P1 argument to the -** calling OP_Program instruction. -*/ -case OP_Param: { /* out2-prerelease */ - VdbeFrame *pFrame; - Mem *pIn; - pFrame = p->pFrame; - pIn = &pFrame->aMem[pOp->p1 + pFrame->aOp[pFrame->pc].p1]; - sqlite3VdbeMemShallowCopy(pOut, pIn, MEM_Ephem); - break; -} - -#endif /* #ifndef SQLITE_OMIT_TRIGGER */ - -#ifndef SQLITE_OMIT_FOREIGN_KEY -/* Opcode: FkCounter P1 P2 * * * -** Synopsis: fkctr[P1]+=P2 -** -** Increment a "constraint counter" by P2 (P2 may be negative or positive). -** If P1 is non-zero, the database constraint counter is incremented -** (deferred foreign key constraints). Otherwise, if P1 is zero, the -** statement counter is incremented (immediate foreign key constraints). -*/ -case OP_FkCounter: { - if( db->flags & SQLITE_DeferFKs ){ - db->nDeferredImmCons += pOp->p2; - }else if( pOp->p1 ){ - db->nDeferredCons += pOp->p2; - }else{ - p->nFkConstraint += pOp->p2; - } - break; -} - -/* Opcode: FkIfZero P1 P2 * * * -** Synopsis: if fkctr[P1]==0 goto P2 -** -** This opcode tests if a foreign key constraint-counter is currently zero. -** If so, jump to instruction P2. Otherwise, fall through to the next -** instruction. -** -** If P1 is non-zero, then the jump is taken if the database constraint-counter -** is zero (the one that counts deferred constraint violations). If P1 is -** zero, the jump is taken if the statement constraint-counter is zero -** (immediate foreign key constraint violations). -*/ -case OP_FkIfZero: { /* jump */ - if( pOp->p1 ){ - if( db->nDeferredCons==0 && db->nDeferredImmCons==0 ) pc = pOp->p2-1; - }else{ - if( p->nFkConstraint==0 && db->nDeferredImmCons==0 ) pc = pOp->p2-1; - } - break; -} -#endif /* #ifndef SQLITE_OMIT_FOREIGN_KEY */ - -#ifndef SQLITE_OMIT_AUTOINCREMENT -/* Opcode: MemMax P1 P2 * * * -** Synopsis: r[P1]=max(r[P1],r[P2]) -** -** P1 is a register in the root frame of this VM (the root frame is -** different from the current frame if this instruction is being executed -** within a sub-program). Set the value of register P1 to the maximum of -** its current value and the value in register P2. -** -** This instruction throws an error if the memory cell is not initially -** an integer. -*/ -case OP_MemMax: { /* in2 */ - VdbeFrame *pFrame; - if( p->pFrame ){ - for(pFrame=p->pFrame; pFrame->pParent; pFrame=pFrame->pParent); - pIn1 = &pFrame->aMem[pOp->p1]; - }else{ - pIn1 = &aMem[pOp->p1]; - } - assert( memIsValid(pIn1) ); - sqlite3VdbeMemIntegerify(pIn1); - pIn2 = &aMem[pOp->p2]; - sqlite3VdbeMemIntegerify(pIn2); - if( pIn1->u.iu.i){ - pIn1->u.i = pIn2->u.i; - } - break; -} -#endif /* SQLITE_OMIT_AUTOINCREMENT */ - -/* Opcode: IfPos P1 P2 * * * -** Synopsis: if r[P1]>0 goto P2 -** -** If the value of register P1 is 1 or greater, jump to P2. -** -** It is illegal to use this instruction on a register that does -** not contain an integer. An assertion fault will result if you try. -*/ -case OP_IfPos: { /* jump, in1 */ - pIn1 = &aMem[pOp->p1]; - assert( pIn1->flags&MEM_Int ); - if( pIn1->u.i>0 ){ - pc = pOp->p2 - 1; - } - break; -} - -/* Opcode: IfNeg P1 P2 * * * -** Synopsis: if r[P1]<0 goto P2 -** -** If the value of register P1 is less than zero, jump to P2. -** -** It is illegal to use this instruction on a register that does -** not contain an integer. An assertion fault will result if you try. -*/ -case OP_IfNeg: { /* jump, in1 */ - pIn1 = &aMem[pOp->p1]; - assert( pIn1->flags&MEM_Int ); - if( pIn1->u.i<0 ){ - pc = pOp->p2 - 1; - } - break; -} - -/* Opcode: IfZero P1 P2 P3 * * -** Synopsis: r[P1]+=P3, if r[P1]==0 goto P2 -** -** The register P1 must contain an integer. Add literal P3 to the -** value in register P1. If the result is exactly 0, jump to P2. -** -** It is illegal to use this instruction on a register that does -** not contain an integer. An assertion fault will result if you try. -*/ -case OP_IfZero: { /* jump, in1 */ - pIn1 = &aMem[pOp->p1]; - assert( pIn1->flags&MEM_Int ); - pIn1->u.i += pOp->p3; - if( pIn1->u.i==0 ){ - pc = pOp->p2 - 1; - } - break; -} - -/* Opcode: AggStep * P2 P3 P4 P5 -** Synopsis: accum=r[P3] step(r[P2@P5]) -** -** Execute the step function for an aggregate. The -** function has P5 arguments. P4 is a pointer to the FuncDef -** structure that specifies the function. Use register -** P3 as the accumulator. -** -** The P5 arguments are taken from register P2 and its -** successors. -*/ -case OP_AggStep: { - int n; - int i; - Mem *pMem; - Mem *pRec; - sqlite3_context ctx; - sqlite3_value **apVal; - - n = pOp->p5; - assert( n>=0 ); - pRec = &aMem[pOp->p2]; - apVal = p->apArg; - assert( apVal || n==0 ); - for(i=0; ip4.pFunc; - assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); - ctx.pMem = pMem = &aMem[pOp->p3]; - pMem->n++; - ctx.s.flags = MEM_Null; - ctx.s.z = 0; - ctx.s.zMalloc = 0; - ctx.s.xDel = 0; - ctx.s.db = db; - ctx.isError = 0; - ctx.pColl = 0; - ctx.skipFlag = 0; - if( ctx.pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ - assert( pOp>p->aOp ); - assert( pOp[-1].p4type==P4_COLLSEQ ); - assert( pOp[-1].opcode==OP_CollSeq ); - ctx.pColl = pOp[-1].p4.pColl; - } - (ctx.pFunc->xStep)(&ctx, n, apVal); /* IMP: R-24505-23230 */ - if( ctx.isError ){ - sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(&ctx.s)); - rc = ctx.isError; - } - if( ctx.skipFlag ){ - assert( pOp[-1].opcode==OP_CollSeq ); - i = pOp[-1].p1; - if( i ) sqlite3VdbeMemSetInt64(&aMem[i], 1); - } - - sqlite3VdbeMemRelease(&ctx.s); - - break; -} - -/* Opcode: AggFinal P1 P2 * P4 * -** Synopsis: accum=r[P1] N=P2 -** -** Execute the finalizer function for an aggregate. P1 is -** the memory location that is the accumulator for the aggregate. -** -** P2 is the number of arguments that the step function takes and -** P4 is a pointer to the FuncDef for this function. The P2 -** argument is not used by this opcode. It is only there to disambiguate -** functions that can take varying numbers of arguments. The -** P4 argument is only needed for the degenerate case where -** the step function was not previously called. -*/ -case OP_AggFinal: { - Mem *pMem; - assert( pOp->p1>0 && pOp->p1<=(p->nMem-p->nCursor) ); - pMem = &aMem[pOp->p1]; - assert( (pMem->flags & ~(MEM_Null|MEM_Agg))==0 ); - rc = sqlite3VdbeMemFinalize(pMem, pOp->p4.pFunc); - if( rc ){ - sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3_value_text(pMem)); - } - sqlite3VdbeChangeEncoding(pMem, encoding); - UPDATE_MAX_BLOBSIZE(pMem); - if( sqlite3VdbeMemTooBig(pMem) ){ - goto too_big; - } - break; -} - -#ifndef SQLITE_OMIT_WAL -/* Opcode: Checkpoint P1 P2 P3 * * -** -** Checkpoint database P1. This is a no-op if P1 is not currently in -** WAL mode. Parameter P2 is one of SQLITE_CHECKPOINT_PASSIVE, FULL -** or RESTART. Write 1 or 0 into mem[P3] if the checkpoint returns -** SQLITE_BUSY or not, respectively. Write the number of pages in the -** WAL after the checkpoint into mem[P3+1] and the number of pages -** in the WAL that have been checkpointed after the checkpoint -** completes into mem[P3+2]. However on an error, mem[P3+1] and -** mem[P3+2] are initialized to -1. -*/ -case OP_Checkpoint: { - int i; /* Loop counter */ - int aRes[3]; /* Results */ - Mem *pMem; /* Write results here */ - - assert( p->readOnly==0 ); - aRes[0] = 0; - aRes[1] = aRes[2] = -1; - assert( pOp->p2==SQLITE_CHECKPOINT_PASSIVE - || pOp->p2==SQLITE_CHECKPOINT_FULL - || pOp->p2==SQLITE_CHECKPOINT_RESTART - ); - rc = sqlite3Checkpoint(db, pOp->p1, pOp->p2, &aRes[1], &aRes[2]); - if( rc==SQLITE_BUSY ){ - rc = SQLITE_OK; - aRes[0] = 1; - } - for(i=0, pMem = &aMem[pOp->p3]; i<3; i++, pMem++){ - sqlite3VdbeMemSetInt64(pMem, (i64)aRes[i]); - } - break; -}; -#endif - -#ifndef SQLITE_OMIT_PRAGMA -/* Opcode: JournalMode P1 P2 P3 * P5 -** -** Change the journal mode of database P1 to P3. P3 must be one of the -** PAGER_JOURNALMODE_XXX values. If changing between the various rollback -** modes (delete, truncate, persist, off and memory), this is a simple -** operation. No IO is required. -** -** If changing into or out of WAL mode the procedure is more complicated. -** -** Write a string containing the final journal-mode to register P2. -*/ -case OP_JournalMode: { /* out2-prerelease */ - Btree *pBt; /* Btree to change journal mode of */ - Pager *pPager; /* Pager associated with pBt */ - int eNew; /* New journal mode */ - int eOld; /* The old journal mode */ -#ifndef SQLITE_OMIT_WAL - const char *zFilename; /* Name of database file for pPager */ -#endif - - eNew = pOp->p3; - assert( eNew==PAGER_JOURNALMODE_DELETE - || eNew==PAGER_JOURNALMODE_TRUNCATE - || eNew==PAGER_JOURNALMODE_PERSIST - || eNew==PAGER_JOURNALMODE_OFF - || eNew==PAGER_JOURNALMODE_MEMORY - || eNew==PAGER_JOURNALMODE_WAL - || eNew==PAGER_JOURNALMODE_QUERY - ); - assert( pOp->p1>=0 && pOp->p1nDb ); - assert( p->readOnly==0 ); - - pBt = db->aDb[pOp->p1].pBt; - pPager = sqlite3BtreePager(pBt); - eOld = sqlite3PagerGetJournalMode(pPager); - if( eNew==PAGER_JOURNALMODE_QUERY ) eNew = eOld; - if( !sqlite3PagerOkToChangeJournalMode(pPager) ) eNew = eOld; - -#ifndef SQLITE_OMIT_WAL - zFilename = sqlite3PagerFilename(pPager, 1); - - /* Do not allow a transition to journal_mode=WAL for a database - ** in temporary storage or if the VFS does not support shared memory - */ - if( eNew==PAGER_JOURNALMODE_WAL - && (sqlite3Strlen30(zFilename)==0 /* Temp file */ - || !sqlite3PagerWalSupported(pPager)) /* No shared-memory support */ - ){ - eNew = eOld; - } - - if( (eNew!=eOld) - && (eOld==PAGER_JOURNALMODE_WAL || eNew==PAGER_JOURNALMODE_WAL) - ){ - if( !db->autoCommit || db->nVdbeRead>1 ){ - rc = SQLITE_ERROR; - sqlite3SetString(&p->zErrMsg, db, - "cannot change %s wal mode from within a transaction", - (eNew==PAGER_JOURNALMODE_WAL ? "into" : "out of") - ); - break; - }else{ - - if( eOld==PAGER_JOURNALMODE_WAL ){ - /* If leaving WAL mode, close the log file. If successful, the call - ** to PagerCloseWal() checkpoints and deletes the write-ahead-log - ** file. An EXCLUSIVE lock may still be held on the database file - ** after a successful return. - */ - rc = sqlite3PagerCloseWal(pPager); - if( rc==SQLITE_OK ){ - sqlite3PagerSetJournalMode(pPager, eNew); - } - }else if( eOld==PAGER_JOURNALMODE_MEMORY ){ - /* Cannot transition directly from MEMORY to WAL. Use mode OFF - ** as an intermediate */ - sqlite3PagerSetJournalMode(pPager, PAGER_JOURNALMODE_OFF); - } - - /* Open a transaction on the database file. Regardless of the journal - ** mode, this transaction always uses a rollback journal. - */ - assert( sqlite3BtreeIsInTrans(pBt)==0 ); - if( rc==SQLITE_OK ){ - rc = sqlite3BtreeSetVersion(pBt, (eNew==PAGER_JOURNALMODE_WAL ? 2 : 1)); - } - } - } -#endif /* ifndef SQLITE_OMIT_WAL */ - - if( rc ){ - eNew = eOld; - } - eNew = sqlite3PagerSetJournalMode(pPager, eNew); - - pOut = &aMem[pOp->p2]; - pOut->flags = MEM_Str|MEM_Static|MEM_Term; - pOut->z = (char *)sqlite3JournalModename(eNew); - pOut->n = sqlite3Strlen30(pOut->z); - pOut->enc = SQLITE_UTF8; - sqlite3VdbeChangeEncoding(pOut, encoding); - break; -}; -#endif /* SQLITE_OMIT_PRAGMA */ - -#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH) -/* Opcode: Vacuum * * * * * -** -** Vacuum the entire database. This opcode will cause other virtual -** machines to be created and run. It may not be called from within -** a transaction. -*/ -case OP_Vacuum: { - assert( p->readOnly==0 ); - rc = sqlite3RunVacuum(&p->zErrMsg, db); - break; -} -#endif - -#if !defined(SQLITE_OMIT_AUTOVACUUM) -/* Opcode: IncrVacuum P1 P2 * * * -** -** Perform a single step of the incremental vacuum procedure on -** the P1 database. If the vacuum has finished, jump to instruction -** P2. Otherwise, fall through to the next instruction. -*/ -case OP_IncrVacuum: { /* jump */ - Btree *pBt; - - assert( pOp->p1>=0 && pOp->p1nDb ); - assert( (p->btreeMask & (((yDbMask)1)<p1))!=0 ); - assert( p->readOnly==0 ); - pBt = db->aDb[pOp->p1].pBt; - rc = sqlite3BtreeIncrVacuum(pBt); - if( rc==SQLITE_DONE ){ - pc = pOp->p2 - 1; - rc = SQLITE_OK; - } - break; -} -#endif - -/* Opcode: Expire P1 * * * * -** -** Cause precompiled statements to become expired. An expired statement -** fails with an error code of SQLITE_SCHEMA if it is ever executed -** (via sqlite3_step()). -** -** If P1 is 0, then all SQL statements become expired. If P1 is non-zero, -** then only the currently executing statement is affected. -*/ -case OP_Expire: { - if( !pOp->p1 ){ - sqlite3ExpirePreparedStatements(db); - }else{ - p->expired = 1; - } - break; -} - -#ifndef SQLITE_OMIT_SHARED_CACHE -/* Opcode: TableLock P1 P2 P3 P4 * -** Synopsis: iDb=P1 root=P2 write=P3 -** -** Obtain a lock on a particular table. This instruction is only used when -** the shared-cache feature is enabled. -** -** P1 is the index of the database in sqlite3.aDb[] of the database -** on which the lock is acquired. A readlock is obtained if P3==0 or -** a write lock if P3==1. -** -** P2 contains the root-page of the table to lock. -** -** P4 contains a pointer to the name of the table being locked. This is only -** used to generate an error message if the lock cannot be obtained. -*/ -case OP_TableLock: { - u8 isWriteLock = (u8)pOp->p3; - if( isWriteLock || 0==(db->flags&SQLITE_ReadUncommitted) ){ - int p1 = pOp->p1; - assert( p1>=0 && p1nDb ); - assert( (p->btreeMask & (((yDbMask)1)<aDb[p1].pBt, pOp->p2, isWriteLock); - if( (rc&0xFF)==SQLITE_LOCKED ){ - const char *z = pOp->p4.z; - sqlite3SetString(&p->zErrMsg, db, "database table is locked: %s", z); - } - } - break; -} -#endif /* SQLITE_OMIT_SHARED_CACHE */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VBegin * * * P4 * -** -** P4 may be a pointer to an sqlite3_vtab structure. If so, call the -** xBegin method for that table. -** -** Also, whether or not P4 is set, check that this is not being called from -** within a callback to a virtual table xSync() method. If it is, the error -** code will be set to SQLITE_LOCKED. -*/ -case OP_VBegin: { - VTable *pVTab; - pVTab = pOp->p4.pVtab; - rc = sqlite3VtabBegin(db, pVTab); - if( pVTab ) sqlite3VtabImportErrmsg(p, pVTab->pVtab); - break; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VCreate P1 * * P4 * -** -** P4 is the name of a virtual table in database P1. Call the xCreate method -** for that table. -*/ -case OP_VCreate: { - rc = sqlite3VtabCallCreate(db, pOp->p1, pOp->p4.z, &p->zErrMsg); - break; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VDestroy P1 * * P4 * -** -** P4 is the name of a virtual table in database P1. Call the xDestroy method -** of that table. -*/ -case OP_VDestroy: { - p->inVtabMethod = 2; - rc = sqlite3VtabCallDestroy(db, pOp->p1, pOp->p4.z); - p->inVtabMethod = 0; - break; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VOpen P1 * * P4 * -** -** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. -** P1 is a cursor number. This opcode opens a cursor to the virtual -** table and stores that cursor in P1. -*/ -case OP_VOpen: { - VdbeCursor *pCur; - sqlite3_vtab_cursor *pVtabCursor; - sqlite3_vtab *pVtab; - sqlite3_module *pModule; - - assert( p->bIsReader ); - pCur = 0; - pVtabCursor = 0; - pVtab = pOp->p4.pVtab->pVtab; - pModule = (sqlite3_module *)pVtab->pModule; - assert(pVtab && pModule); - rc = pModule->xOpen(pVtab, &pVtabCursor); - sqlite3VtabImportErrmsg(p, pVtab); - if( SQLITE_OK==rc ){ - /* Initialize sqlite3_vtab_cursor base class */ - pVtabCursor->pVtab = pVtab; - - /* Initialize vdbe cursor object */ - pCur = allocateCursor(p, pOp->p1, 0, -1, 0); - if( pCur ){ - pCur->pVtabCursor = pVtabCursor; - }else{ - db->mallocFailed = 1; - pModule->xClose(pVtabCursor); - } - } - break; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VFilter P1 P2 P3 P4 * -** Synopsis: iPlan=r[P3] zPlan='P4' -** -** P1 is a cursor opened using VOpen. P2 is an address to jump to if -** the filtered result set is empty. -** -** P4 is either NULL or a string that was generated by the xBestIndex -** method of the module. The interpretation of the P4 string is left -** to the module implementation. -** -** This opcode invokes the xFilter method on the virtual table specified -** by P1. The integer query plan parameter to xFilter is stored in register -** P3. Register P3+1 stores the argc parameter to be passed to the -** xFilter method. Registers P3+2..P3+1+argc are the argc -** additional parameters which are passed to -** xFilter as argv. Register P3+2 becomes argv[0] when passed to xFilter. -** -** A jump is made to P2 if the result set after filtering would be empty. -*/ -case OP_VFilter: { /* jump */ - int nArg; - int iQuery; - const sqlite3_module *pModule; - Mem *pQuery; - Mem *pArgc; - sqlite3_vtab_cursor *pVtabCursor; - sqlite3_vtab *pVtab; - VdbeCursor *pCur; - int res; - int i; - Mem **apArg; - - pQuery = &aMem[pOp->p3]; - pArgc = &pQuery[1]; - pCur = p->apCsr[pOp->p1]; - assert( memIsValid(pQuery) ); - REGISTER_TRACE(pOp->p3, pQuery); - assert( pCur->pVtabCursor ); - pVtabCursor = pCur->pVtabCursor; - pVtab = pVtabCursor->pVtab; - pModule = pVtab->pModule; - - /* Grab the index number and argc parameters */ - assert( (pQuery->flags&MEM_Int)!=0 && pArgc->flags==MEM_Int ); - nArg = (int)pArgc->u.i; - iQuery = (int)pQuery->u.i; - - /* Invoke the xFilter method */ - { - res = 0; - apArg = p->apArg; - for(i = 0; iinVtabMethod = 1; - rc = pModule->xFilter(pVtabCursor, iQuery, pOp->p4.z, nArg, apArg); - p->inVtabMethod = 0; - sqlite3VtabImportErrmsg(p, pVtab); - if( rc==SQLITE_OK ){ - res = pModule->xEof(pVtabCursor); - } - - if( res ){ - pc = pOp->p2 - 1; - } - } - pCur->nullRow = 0; - - break; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VColumn P1 P2 P3 * * -** Synopsis: r[P3]=vcolumn(P2) -** -** Store the value of the P2-th column of -** the row of the virtual-table that the -** P1 cursor is pointing to into register P3. -*/ -case OP_VColumn: { - sqlite3_vtab *pVtab; - const sqlite3_module *pModule; - Mem *pDest; - sqlite3_context sContext; - - VdbeCursor *pCur = p->apCsr[pOp->p1]; - assert( pCur->pVtabCursor ); - assert( pOp->p3>0 && pOp->p3<=(p->nMem-p->nCursor) ); - pDest = &aMem[pOp->p3]; - memAboutToChange(p, pDest); - if( pCur->nullRow ){ - sqlite3VdbeMemSetNull(pDest); - break; - } - pVtab = pCur->pVtabCursor->pVtab; - pModule = pVtab->pModule; - assert( pModule->xColumn ); - memset(&sContext, 0, sizeof(sContext)); - - /* The output cell may already have a buffer allocated. Move - ** the current contents to sContext.s so in case the user-function - ** can use the already allocated buffer instead of allocating a - ** new one. - */ - sqlite3VdbeMemMove(&sContext.s, pDest); - MemSetTypeFlag(&sContext.s, MEM_Null); - - rc = pModule->xColumn(pCur->pVtabCursor, &sContext, pOp->p2); - sqlite3VtabImportErrmsg(p, pVtab); - if( sContext.isError ){ - rc = sContext.isError; - } - - /* Copy the result of the function to the P3 register. We - ** do this regardless of whether or not an error occurred to ensure any - ** dynamic allocation in sContext.s (a Mem struct) is released. - */ - sqlite3VdbeChangeEncoding(&sContext.s, encoding); - sqlite3VdbeMemMove(pDest, &sContext.s); - REGISTER_TRACE(pOp->p3, pDest); - UPDATE_MAX_BLOBSIZE(pDest); - - if( sqlite3VdbeMemTooBig(pDest) ){ - goto too_big; - } - break; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VNext P1 P2 * * * -** -** Advance virtual table P1 to the next row in its result set and -** jump to instruction P2. Or, if the virtual table has reached -** the end of its result set, then fall through to the next instruction. -*/ -case OP_VNext: { /* jump */ - sqlite3_vtab *pVtab; - const sqlite3_module *pModule; - int res; - VdbeCursor *pCur; - - res = 0; - pCur = p->apCsr[pOp->p1]; - assert( pCur->pVtabCursor ); - if( pCur->nullRow ){ - break; - } - pVtab = pCur->pVtabCursor->pVtab; - pModule = pVtab->pModule; - assert( pModule->xNext ); - - /* Invoke the xNext() method of the module. There is no way for the - ** underlying implementation to return an error if one occurs during - ** xNext(). Instead, if an error occurs, true is returned (indicating that - ** data is available) and the error code returned when xColumn or - ** some other method is next invoked on the save virtual table cursor. - */ - p->inVtabMethod = 1; - rc = pModule->xNext(pCur->pVtabCursor); - p->inVtabMethod = 0; - sqlite3VtabImportErrmsg(p, pVtab); - if( rc==SQLITE_OK ){ - res = pModule->xEof(pCur->pVtabCursor); - } - - if( !res ){ - /* If there is data, jump to P2 */ - pc = pOp->p2 - 1; - } - goto check_for_interrupt; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VRename P1 * * P4 * -** -** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. -** This opcode invokes the corresponding xRename method. The value -** in register P1 is passed as the zName argument to the xRename method. -*/ -case OP_VRename: { - sqlite3_vtab *pVtab; - Mem *pName; - - pVtab = pOp->p4.pVtab->pVtab; - pName = &aMem[pOp->p1]; - assert( pVtab->pModule->xRename ); - assert( memIsValid(pName) ); - assert( p->readOnly==0 ); - REGISTER_TRACE(pOp->p1, pName); - assert( pName->flags & MEM_Str ); - testcase( pName->enc==SQLITE_UTF8 ); - testcase( pName->enc==SQLITE_UTF16BE ); - testcase( pName->enc==SQLITE_UTF16LE ); - rc = sqlite3VdbeChangeEncoding(pName, SQLITE_UTF8); - if( rc==SQLITE_OK ){ - rc = pVtab->pModule->xRename(pVtab, pName->z); - sqlite3VtabImportErrmsg(p, pVtab); - p->expired = 0; - } - break; -} -#endif - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Opcode: VUpdate P1 P2 P3 P4 * -** Synopsis: data=r[P3@P2] -** -** P4 is a pointer to a virtual table object, an sqlite3_vtab structure. -** This opcode invokes the corresponding xUpdate method. P2 values -** are contiguous memory cells starting at P3 to pass to the xUpdate -** invocation. The value in register (P3+P2-1) corresponds to the -** p2th element of the argv array passed to xUpdate. -** -** The xUpdate method will do a DELETE or an INSERT or both. -** The argv[0] element (which corresponds to memory cell P3) -** is the rowid of a row to delete. If argv[0] is NULL then no -** deletion occurs. The argv[1] element is the rowid of the new -** row. This can be NULL to have the virtual table select the new -** rowid for itself. The subsequent elements in the array are -** the values of columns in the new row. -** -** If P2==1 then no insert is performed. argv[0] is the rowid of -** a row to delete. -** -** P1 is a boolean flag. If it is set to true and the xUpdate call -** is successful, then the value returned by sqlite3_last_insert_rowid() -** is set to the value of the rowid for the row just inserted. -*/ -case OP_VUpdate: { - sqlite3_vtab *pVtab; - sqlite3_module *pModule; - int nArg; - int i; - sqlite_int64 rowid; - Mem **apArg; - Mem *pX; - - assert( pOp->p2==1 || pOp->p5==OE_Fail || pOp->p5==OE_Rollback - || pOp->p5==OE_Abort || pOp->p5==OE_Ignore || pOp->p5==OE_Replace - ); - assert( p->readOnly==0 ); - pVtab = pOp->p4.pVtab->pVtab; - pModule = (sqlite3_module *)pVtab->pModule; - nArg = pOp->p2; - assert( pOp->p4type==P4_VTAB ); - if( ALWAYS(pModule->xUpdate) ){ - u8 vtabOnConflict = db->vtabOnConflict; - apArg = p->apArg; - pX = &aMem[pOp->p3]; - for(i=0; ivtabOnConflict = pOp->p5; - rc = pModule->xUpdate(pVtab, nArg, apArg, &rowid); - db->vtabOnConflict = vtabOnConflict; - sqlite3VtabImportErrmsg(p, pVtab); - if( rc==SQLITE_OK && pOp->p1 ){ - assert( nArg>1 && apArg[0] && (apArg[0]->flags&MEM_Null) ); - db->lastRowid = lastRowid = rowid; - } - if( (rc&0xff)==SQLITE_CONSTRAINT && pOp->p4.pVtab->bConstraint ){ - if( pOp->p5==OE_Ignore ){ - rc = SQLITE_OK; - }else{ - p->errorAction = ((pOp->p5==OE_Replace) ? OE_Abort : pOp->p5); - } - }else{ - p->nChange++; - } - } - break; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifndef SQLITE_OMIT_PAGER_PRAGMAS -/* Opcode: Pagecount P1 P2 * * * -** -** Write the current number of pages in database P1 to memory cell P2. -*/ -case OP_Pagecount: { /* out2-prerelease */ - pOut->u.i = sqlite3BtreeLastPage(db->aDb[pOp->p1].pBt); - break; -} -#endif - - -#ifndef SQLITE_OMIT_PAGER_PRAGMAS -/* Opcode: MaxPgcnt P1 P2 P3 * * -** -** Try to set the maximum page count for database P1 to the value in P3. -** Do not let the maximum page count fall below the current page count and -** do not change the maximum page count value if P3==0. -** -** Store the maximum page count after the change in register P2. -*/ -case OP_MaxPgcnt: { /* out2-prerelease */ - unsigned int newMax; - Btree *pBt; - - pBt = db->aDb[pOp->p1].pBt; - newMax = 0; - if( pOp->p3 ){ - newMax = sqlite3BtreeLastPage(pBt); - if( newMax < (unsigned)pOp->p3 ) newMax = (unsigned)pOp->p3; - } - pOut->u.i = sqlite3BtreeMaxPageCount(pBt, newMax); - break; -} -#endif - - -#ifndef SQLITE_OMIT_TRACE -/* Opcode: Trace * * * P4 * -** -** If tracing is enabled (by the sqlite3_trace()) interface, then -** the UTF-8 string contained in P4 is emitted on the trace callback. -*/ -case OP_Trace: { - char *zTrace; - char *z; - - if( db->xTrace - && !p->doingRerun - && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 - ){ - z = sqlite3VdbeExpandSql(p, zTrace); - db->xTrace(db->pTraceArg, z); - sqlite3DbFree(db, z); - } -#ifdef SQLITE_USE_FCNTL_TRACE - zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql); - if( zTrace ){ - int i; - for(i=0; inDb; i++){ - if( MASKBIT(i) & p->btreeMask)==0 ) continue; - sqlite3_file_control(db, db->aDb[i].zName, SQLITE_FCNTL_TRACE, zTrace); - } - } -#endif /* SQLITE_USE_FCNTL_TRACE */ -#ifdef SQLITE_DEBUG - if( (db->flags & SQLITE_SqlTrace)!=0 - && (zTrace = (pOp->p4.z ? pOp->p4.z : p->zSql))!=0 - ){ - sqlite3DebugPrintf("SQL-trace: %s\n", zTrace); - } -#endif /* SQLITE_DEBUG */ - break; -} -#endif - - -/* Opcode: Noop * * * * * -** -** Do nothing. This instruction is often useful as a jump -** destination. -*/ -/* -** The magic Explain opcode are only inserted when explain==2 (which -** is to say when the EXPLAIN QUERY PLAN syntax is used.) -** This opcode records information from the optimizer. It is the -** the same as a no-op. This opcodesnever appears in a real VM program. -*/ -default: { /* This is really OP_Noop and OP_Explain */ - assert( pOp->opcode==OP_Noop || pOp->opcode==OP_Explain ); - break; -} - -/***************************************************************************** -** The cases of the switch statement above this line should all be indented -** by 6 spaces. But the left-most 6 spaces have been removed to improve the -** readability. From this point on down, the normal indentation rules are -** restored. -*****************************************************************************/ - } - -#ifdef VDBE_PROFILE - { - u64 elapsed = sqlite3Hwtime() - start; - pOp->cycles += elapsed; - pOp->cnt++; -#if 0 - fprintf(stdout, "%10llu ", elapsed); - sqlite3VdbePrintOp(stdout, origPc, &aOp[origPc]); -#endif - } -#endif - - /* The following code adds nothing to the actual functionality - ** of the program. It is only here for testing and debugging. - ** On the other hand, it does burn CPU cycles every time through - ** the evaluator loop. So we can leave it out when NDEBUG is defined. - */ -#ifndef NDEBUG - assert( pc>=-1 && pcnOp ); - -#ifdef SQLITE_DEBUG - if( db->flags & SQLITE_VdbeTrace ){ - if( rc!=0 ) printf("rc=%d\n",rc); - if( pOp->opflags & (OPFLG_OUT2_PRERELEASE|OPFLG_OUT2) ){ - registerTrace(pOp->p2, &aMem[pOp->p2]); - } - if( pOp->opflags & OPFLG_OUT3 ){ - registerTrace(pOp->p3, &aMem[pOp->p3]); - } - } -#endif /* SQLITE_DEBUG */ -#endif /* NDEBUG */ - } /* The end of the for(;;) loop the loops through opcodes */ - - /* If we reach this point, it means that execution is finished with - ** an error of some kind. - */ -vdbe_error_halt: - assert( rc ); - p->rc = rc; - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(rc, "statement aborts at %d: [%s] %s", - pc, p->zSql, p->zErrMsg); - sqlite3VdbeHalt(p); - if( rc==SQLITE_IOERR_NOMEM ) db->mallocFailed = 1; - rc = SQLITE_ERROR; - if( resetSchemaOnFault>0 ){ - sqlite3ResetOneSchema(db, resetSchemaOnFault-1); - } - - /* This is the only way out of this procedure. We have to - ** release the mutexes on btrees that were acquired at the - ** top. */ -vdbe_return: - db->lastRowid = lastRowid; - testcase( nVmStep>0 ); - p->aCounter[SQLITE_STMTSTATUS_VM_STEP] += (int)nVmStep; - sqlite3VdbeLeave(p); - return rc; - - /* Jump to here if a string or blob larger than SQLITE_MAX_LENGTH - ** is encountered. - */ -too_big: - sqlite3SetString(&p->zErrMsg, db, "string or blob too big"); - rc = SQLITE_TOOBIG; - goto vdbe_error_halt; - - /* Jump to here if a malloc() fails. - */ -no_mem: - db->mallocFailed = 1; - sqlite3SetString(&p->zErrMsg, db, "out of memory"); - rc = SQLITE_NOMEM; - goto vdbe_error_halt; - - /* Jump to here for any other kind of fatal error. The "rc" variable - ** should hold the error number. - */ -abort_due_to_error: - assert( p->zErrMsg==0 ); - if( db->mallocFailed ) rc = SQLITE_NOMEM; - if( rc!=SQLITE_IOERR_NOMEM ){ - sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(rc)); - } - goto vdbe_error_halt; - - /* Jump to here if the sqlite3_interrupt() API sets the interrupt - ** flag. - */ -abort_due_to_interrupt: - assert( db->u1.isInterrupted ); - rc = SQLITE_INTERRUPT; - p->rc = rc; - sqlite3SetString(&p->zErrMsg, db, "%s", sqlite3ErrStr(rc)); - goto vdbe_error_halt; -} - - -/************** End of vdbe.c ************************************************/ -/************** Begin file vdbeblob.c ****************************************/ -/* -** 2007 May 1 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains code used to implement incremental BLOB I/O. -*/ - - -#ifndef SQLITE_OMIT_INCRBLOB - -/* -** Valid sqlite3_blob* handles point to Incrblob structures. -*/ -typedef struct Incrblob Incrblob; -struct Incrblob { - int flags; /* Copy of "flags" passed to sqlite3_blob_open() */ - int nByte; /* Size of open blob, in bytes */ - int iOffset; /* Byte offset of blob in cursor data */ - int iCol; /* Table column this handle is open on */ - BtCursor *pCsr; /* Cursor pointing at blob row */ - sqlite3_stmt *pStmt; /* Statement holding cursor open */ - sqlite3 *db; /* The associated database */ -}; - - -/* -** This function is used by both blob_open() and blob_reopen(). It seeks -** the b-tree cursor associated with blob handle p to point to row iRow. -** If successful, SQLITE_OK is returned and subsequent calls to -** sqlite3_blob_read() or sqlite3_blob_write() access the specified row. -** -** If an error occurs, or if the specified row does not exist or does not -** contain a value of type TEXT or BLOB in the column nominated when the -** blob handle was opened, then an error code is returned and *pzErr may -** be set to point to a buffer containing an error message. It is the -** responsibility of the caller to free the error message buffer using -** sqlite3DbFree(). -** -** If an error does occur, then the b-tree cursor is closed. All subsequent -** calls to sqlite3_blob_read(), blob_write() or blob_reopen() will -** immediately return SQLITE_ABORT. -*/ -static int blobSeekToRow(Incrblob *p, sqlite3_int64 iRow, char **pzErr){ - int rc; /* Error code */ - char *zErr = 0; /* Error message */ - Vdbe *v = (Vdbe *)p->pStmt; - - /* Set the value of the SQL statements only variable to integer iRow. - ** This is done directly instead of using sqlite3_bind_int64() to avoid - ** triggering asserts related to mutexes. - */ - assert( v->aVar[0].flags&MEM_Int ); - v->aVar[0].u.i = iRow; - - rc = sqlite3_step(p->pStmt); - if( rc==SQLITE_ROW ){ - VdbeCursor *pC = v->apCsr[0]; - u32 type = pC->aType[p->iCol]; - if( type<12 ){ - zErr = sqlite3MPrintf(p->db, "cannot open value of type %s", - type==0?"null": type==7?"real": "integer" - ); - rc = SQLITE_ERROR; - sqlite3_finalize(p->pStmt); - p->pStmt = 0; - }else{ - p->iOffset = pC->aType[p->iCol + pC->nField]; - p->nByte = sqlite3VdbeSerialTypeLen(type); - p->pCsr = pC->pCursor; - sqlite3BtreeEnterCursor(p->pCsr); - sqlite3BtreeCacheOverflow(p->pCsr); - sqlite3BtreeLeaveCursor(p->pCsr); - } - } - - if( rc==SQLITE_ROW ){ - rc = SQLITE_OK; - }else if( p->pStmt ){ - rc = sqlite3_finalize(p->pStmt); - p->pStmt = 0; - if( rc==SQLITE_OK ){ - zErr = sqlite3MPrintf(p->db, "no such rowid: %lld", iRow); - rc = SQLITE_ERROR; - }else{ - zErr = sqlite3MPrintf(p->db, "%s", sqlite3_errmsg(p->db)); - } - } - - assert( rc!=SQLITE_OK || zErr==0 ); - assert( rc!=SQLITE_ROW && rc!=SQLITE_DONE ); - - *pzErr = zErr; - return rc; -} - -/* -** Open a blob handle. -*/ -SQLITE_API int sqlite3_blob_open( - sqlite3* db, /* The database connection */ - const char *zDb, /* The attached database containing the blob */ - const char *zTable, /* The table containing the blob */ - const char *zColumn, /* The column containing the blob */ - sqlite_int64 iRow, /* The row containing the glob */ - int flags, /* True -> read/write access, false -> read-only */ - sqlite3_blob **ppBlob /* Handle for accessing the blob returned here */ -){ - int nAttempt = 0; - int iCol; /* Index of zColumn in row-record */ - - /* This VDBE program seeks a btree cursor to the identified - ** db/table/row entry. The reason for using a vdbe program instead - ** of writing code to use the b-tree layer directly is that the - ** vdbe program will take advantage of the various transaction, - ** locking and error handling infrastructure built into the vdbe. - ** - ** After seeking the cursor, the vdbe executes an OP_ResultRow. - ** Code external to the Vdbe then "borrows" the b-tree cursor and - ** uses it to implement the blob_read(), blob_write() and - ** blob_bytes() functions. - ** - ** The sqlite3_blob_close() function finalizes the vdbe program, - ** which closes the b-tree cursor and (possibly) commits the - ** transaction. - */ - static const VdbeOpList openBlob[] = { - {OP_Transaction, 0, 0, 0}, /* 0: Start a transaction */ - {OP_VerifyCookie, 0, 0, 0}, /* 1: Check the schema cookie */ - {OP_TableLock, 0, 0, 0}, /* 2: Acquire a read or write lock */ - - /* One of the following two instructions is replaced by an OP_Noop. */ - {OP_OpenRead, 0, 0, 0}, /* 3: Open cursor 0 for reading */ - {OP_OpenWrite, 0, 0, 0}, /* 4: Open cursor 0 for read/write */ - - {OP_Variable, 1, 1, 1}, /* 5: Push the rowid to the stack */ - {OP_NotExists, 0, 10, 1}, /* 6: Seek the cursor */ - {OP_Column, 0, 0, 1}, /* 7 */ - {OP_ResultRow, 1, 0, 0}, /* 8 */ - {OP_Goto, 0, 5, 0}, /* 9 */ - {OP_Close, 0, 0, 0}, /* 10 */ - {OP_Halt, 0, 0, 0}, /* 11 */ - }; - - int rc = SQLITE_OK; - char *zErr = 0; - Table *pTab; - Parse *pParse = 0; - Incrblob *pBlob = 0; - - flags = !!flags; /* flags = (flags ? 1 : 0); */ - *ppBlob = 0; - - sqlite3_mutex_enter(db->mutex); - - pBlob = (Incrblob *)sqlite3DbMallocZero(db, sizeof(Incrblob)); - if( !pBlob ) goto blob_open_out; - pParse = sqlite3StackAllocRaw(db, sizeof(*pParse)); - if( !pParse ) goto blob_open_out; - - do { - memset(pParse, 0, sizeof(Parse)); - pParse->db = db; - sqlite3DbFree(db, zErr); - zErr = 0; - - sqlite3BtreeEnterAll(db); - pTab = sqlite3LocateTable(pParse, 0, zTable, zDb); - if( pTab && IsVirtual(pTab) ){ - pTab = 0; - sqlite3ErrorMsg(pParse, "cannot open virtual table: %s", zTable); - } - if( pTab && !HasRowid(pTab) ){ - pTab = 0; - sqlite3ErrorMsg(pParse, "cannot open table without rowid: %s", zTable); - } -#ifndef SQLITE_OMIT_VIEW - if( pTab && pTab->pSelect ){ - pTab = 0; - sqlite3ErrorMsg(pParse, "cannot open view: %s", zTable); - } -#endif - if( !pTab ){ - if( pParse->zErrMsg ){ - sqlite3DbFree(db, zErr); - zErr = pParse->zErrMsg; - pParse->zErrMsg = 0; - } - rc = SQLITE_ERROR; - sqlite3BtreeLeaveAll(db); - goto blob_open_out; - } - - /* Now search pTab for the exact column. */ - for(iCol=0; iColnCol; iCol++) { - if( sqlite3StrICmp(pTab->aCol[iCol].zName, zColumn)==0 ){ - break; - } - } - if( iCol==pTab->nCol ){ - sqlite3DbFree(db, zErr); - zErr = sqlite3MPrintf(db, "no such column: \"%s\"", zColumn); - rc = SQLITE_ERROR; - sqlite3BtreeLeaveAll(db); - goto blob_open_out; - } - - /* If the value is being opened for writing, check that the - ** column is not indexed, and that it is not part of a foreign key. - ** It is against the rules to open a column to which either of these - ** descriptions applies for writing. */ - if( flags ){ - const char *zFault = 0; - Index *pIdx; -#ifndef SQLITE_OMIT_FOREIGN_KEY - if( db->flags&SQLITE_ForeignKeys ){ - /* Check that the column is not part of an FK child key definition. It - ** is not necessary to check if it is part of a parent key, as parent - ** key columns must be indexed. The check below will pick up this - ** case. */ - FKey *pFKey; - for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ - int j; - for(j=0; jnCol; j++){ - if( pFKey->aCol[j].iFrom==iCol ){ - zFault = "foreign key"; - } - } - } - } -#endif - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - int j; - for(j=0; jnKeyCol; j++){ - if( pIdx->aiColumn[j]==iCol ){ - zFault = "indexed"; - } - } - } - if( zFault ){ - sqlite3DbFree(db, zErr); - zErr = sqlite3MPrintf(db, "cannot open %s column for writing", zFault); - rc = SQLITE_ERROR; - sqlite3BtreeLeaveAll(db); - goto blob_open_out; - } - } - - pBlob->pStmt = (sqlite3_stmt *)sqlite3VdbeCreate(pParse); - assert( pBlob->pStmt || db->mallocFailed ); - if( pBlob->pStmt ){ - Vdbe *v = (Vdbe *)pBlob->pStmt; - int iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - - sqlite3VdbeAddOpList(v, sizeof(openBlob)/sizeof(VdbeOpList), openBlob); - - - /* Configure the OP_Transaction */ - sqlite3VdbeChangeP1(v, 0, iDb); - sqlite3VdbeChangeP2(v, 0, flags); - - /* Configure the OP_VerifyCookie */ - sqlite3VdbeChangeP1(v, 1, iDb); - sqlite3VdbeChangeP2(v, 1, pTab->pSchema->schema_cookie); - sqlite3VdbeChangeP3(v, 1, pTab->pSchema->iGeneration); - - /* Make sure a mutex is held on the table to be accessed */ - sqlite3VdbeUsesBtree(v, iDb); - - /* Configure the OP_TableLock instruction */ -#ifdef SQLITE_OMIT_SHARED_CACHE - sqlite3VdbeChangeToNoop(v, 2); -#else - sqlite3VdbeChangeP1(v, 2, iDb); - sqlite3VdbeChangeP2(v, 2, pTab->tnum); - sqlite3VdbeChangeP3(v, 2, flags); - sqlite3VdbeChangeP4(v, 2, pTab->zName, P4_TRANSIENT); -#endif - - /* Remove either the OP_OpenWrite or OpenRead. Set the P2 - ** parameter of the other to pTab->tnum. */ - sqlite3VdbeChangeToNoop(v, 4 - flags); - sqlite3VdbeChangeP2(v, 3 + flags, pTab->tnum); - sqlite3VdbeChangeP3(v, 3 + flags, iDb); - - /* Configure the number of columns. Configure the cursor to - ** think that the table has one more column than it really - ** does. An OP_Column to retrieve this imaginary column will - ** always return an SQL NULL. This is useful because it means - ** we can invoke OP_Column to fill in the vdbe cursors type - ** and offset cache without causing any IO. - */ - sqlite3VdbeChangeP4(v, 3+flags, SQLITE_INT_TO_PTR(pTab->nCol+1),P4_INT32); - sqlite3VdbeChangeP2(v, 7, pTab->nCol); - if( !db->mallocFailed ){ - pParse->nVar = 1; - pParse->nMem = 1; - pParse->nTab = 1; - sqlite3VdbeMakeReady(v, pParse); - } - } - - pBlob->flags = flags; - pBlob->iCol = iCol; - pBlob->db = db; - sqlite3BtreeLeaveAll(db); - if( db->mallocFailed ){ - goto blob_open_out; - } - sqlite3_bind_int64(pBlob->pStmt, 1, iRow); - rc = blobSeekToRow(pBlob, iRow, &zErr); - } while( (++nAttempt)mallocFailed==0 ){ - *ppBlob = (sqlite3_blob *)pBlob; - }else{ - if( pBlob && pBlob->pStmt ) sqlite3VdbeFinalize((Vdbe *)pBlob->pStmt); - sqlite3DbFree(db, pBlob); - } - sqlite3Error(db, rc, (zErr ? "%s" : 0), zErr); - sqlite3DbFree(db, zErr); - sqlite3ParserReset(pParse); - sqlite3StackFree(db, pParse); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/* -** Close a blob handle that was previously created using -** sqlite3_blob_open(). -*/ -SQLITE_API int sqlite3_blob_close(sqlite3_blob *pBlob){ - Incrblob *p = (Incrblob *)pBlob; - int rc; - sqlite3 *db; - - if( p ){ - db = p->db; - sqlite3_mutex_enter(db->mutex); - rc = sqlite3_finalize(p->pStmt); - sqlite3DbFree(db, p); - sqlite3_mutex_leave(db->mutex); - }else{ - rc = SQLITE_OK; - } - return rc; -} - -/* -** Perform a read or write operation on a blob -*/ -static int blobReadWrite( - sqlite3_blob *pBlob, - void *z, - int n, - int iOffset, - int (*xCall)(BtCursor*, u32, u32, void*) -){ - int rc; - Incrblob *p = (Incrblob *)pBlob; - Vdbe *v; - sqlite3 *db; - - if( p==0 ) return SQLITE_MISUSE_BKPT; - db = p->db; - sqlite3_mutex_enter(db->mutex); - v = (Vdbe*)p->pStmt; - - if( n<0 || iOffset<0 || (iOffset+n)>p->nByte ){ - /* Request is out of range. Return a transient error. */ - rc = SQLITE_ERROR; - sqlite3Error(db, SQLITE_ERROR, 0); - }else if( v==0 ){ - /* If there is no statement handle, then the blob-handle has - ** already been invalidated. Return SQLITE_ABORT in this case. - */ - rc = SQLITE_ABORT; - }else{ - /* Call either BtreeData() or BtreePutData(). If SQLITE_ABORT is - ** returned, clean-up the statement handle. - */ - assert( db == v->db ); - sqlite3BtreeEnterCursor(p->pCsr); - rc = xCall(p->pCsr, iOffset+p->iOffset, n, z); - sqlite3BtreeLeaveCursor(p->pCsr); - if( rc==SQLITE_ABORT ){ - sqlite3VdbeFinalize(v); - p->pStmt = 0; - }else{ - db->errCode = rc; - v->rc = rc; - } - } - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/* -** Read data from a blob handle. -*/ -SQLITE_API int sqlite3_blob_read(sqlite3_blob *pBlob, void *z, int n, int iOffset){ - return blobReadWrite(pBlob, z, n, iOffset, sqlite3BtreeData); -} - -/* -** Write data to a blob handle. -*/ -SQLITE_API int sqlite3_blob_write(sqlite3_blob *pBlob, const void *z, int n, int iOffset){ - return blobReadWrite(pBlob, (void *)z, n, iOffset, sqlite3BtreePutData); -} - -/* -** Query a blob handle for the size of the data. -** -** The Incrblob.nByte field is fixed for the lifetime of the Incrblob -** so no mutex is required for access. -*/ -SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *pBlob){ - Incrblob *p = (Incrblob *)pBlob; - return (p && p->pStmt) ? p->nByte : 0; -} - -/* -** Move an existing blob handle to point to a different row of the same -** database table. -** -** If an error occurs, or if the specified row does not exist or does not -** contain a blob or text value, then an error code is returned and the -** database handle error code and message set. If this happens, then all -** subsequent calls to sqlite3_blob_xxx() functions (except blob_close()) -** immediately return SQLITE_ABORT. -*/ -SQLITE_API int sqlite3_blob_reopen(sqlite3_blob *pBlob, sqlite3_int64 iRow){ - int rc; - Incrblob *p = (Incrblob *)pBlob; - sqlite3 *db; - - if( p==0 ) return SQLITE_MISUSE_BKPT; - db = p->db; - sqlite3_mutex_enter(db->mutex); - - if( p->pStmt==0 ){ - /* If there is no statement handle, then the blob-handle has - ** already been invalidated. Return SQLITE_ABORT in this case. - */ - rc = SQLITE_ABORT; - }else{ - char *zErr; - rc = blobSeekToRow(p, iRow, &zErr); - if( rc!=SQLITE_OK ){ - sqlite3Error(db, rc, (zErr ? "%s" : 0), zErr); - sqlite3DbFree(db, zErr); - } - assert( rc!=SQLITE_SCHEMA ); - } - - rc = sqlite3ApiExit(db, rc); - assert( rc==SQLITE_OK || p->pStmt==0 ); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -#endif /* #ifndef SQLITE_OMIT_INCRBLOB */ - -/************** End of vdbeblob.c ********************************************/ -/************** Begin file vdbesort.c ****************************************/ -/* -** 2011 July 9 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code for the VdbeSorter object, used in concert with -** a VdbeCursor to sort large numbers of keys (as may be required, for -** example, by CREATE INDEX statements on tables too large to fit in main -** memory). -*/ - - - -typedef struct VdbeSorterIter VdbeSorterIter; -typedef struct SorterRecord SorterRecord; -typedef struct FileWriter FileWriter; - -/* -** NOTES ON DATA STRUCTURE USED FOR N-WAY MERGES: -** -** As keys are added to the sorter, they are written to disk in a series -** of sorted packed-memory-arrays (PMAs). The size of each PMA is roughly -** the same as the cache-size allowed for temporary databases. In order -** to allow the caller to extract keys from the sorter in sorted order, -** all PMAs currently stored on disk must be merged together. This comment -** describes the data structure used to do so. The structure supports -** merging any number of arrays in a single pass with no redundant comparison -** operations. -** -** The aIter[] array contains an iterator for each of the PMAs being merged. -** An aIter[] iterator either points to a valid key or else is at EOF. For -** the purposes of the paragraphs below, we assume that the array is actually -** N elements in size, where N is the smallest power of 2 greater to or equal -** to the number of iterators being merged. The extra aIter[] elements are -** treated as if they are empty (always at EOF). -** -** The aTree[] array is also N elements in size. The value of N is stored in -** the VdbeSorter.nTree variable. -** -** The final (N/2) elements of aTree[] contain the results of comparing -** pairs of iterator keys together. Element i contains the result of -** comparing aIter[2*i-N] and aIter[2*i-N+1]. Whichever key is smaller, the -** aTree element is set to the index of it. -** -** For the purposes of this comparison, EOF is considered greater than any -** other key value. If the keys are equal (only possible with two EOF -** values), it doesn't matter which index is stored. -** -** The (N/4) elements of aTree[] that precede the final (N/2) described -** above contains the index of the smallest of each block of 4 iterators. -** And so on. So that aTree[1] contains the index of the iterator that -** currently points to the smallest key value. aTree[0] is unused. -** -** Example: -** -** aIter[0] -> Banana -** aIter[1] -> Feijoa -** aIter[2] -> Elderberry -** aIter[3] -> Currant -** aIter[4] -> Grapefruit -** aIter[5] -> Apple -** aIter[6] -> Durian -** aIter[7] -> EOF -** -** aTree[] = { X, 5 0, 5 0, 3, 5, 6 } -** -** The current element is "Apple" (the value of the key indicated by -** iterator 5). When the Next() operation is invoked, iterator 5 will -** be advanced to the next key in its segment. Say the next key is -** "Eggplant": -** -** aIter[5] -> Eggplant -** -** The contents of aTree[] are updated first by comparing the new iterator -** 5 key to the current key of iterator 4 (still "Grapefruit"). The iterator -** 5 value is still smaller, so aTree[6] is set to 5. And so on up the tree. -** The value of iterator 6 - "Durian" - is now smaller than that of iterator -** 5, so aTree[3] is set to 6. Key 0 is smaller than key 6 (BananaaAlloc); - sqlite3DbFree(db, pIter->aBuffer); - memset(pIter, 0, sizeof(VdbeSorterIter)); -} - -/* -** Read nByte bytes of data from the stream of data iterated by object p. -** If successful, set *ppOut to point to a buffer containing the data -** and return SQLITE_OK. Otherwise, if an error occurs, return an SQLite -** error code. -** -** The buffer indicated by *ppOut may only be considered valid until the -** next call to this function. -*/ -static int vdbeSorterIterRead( - sqlite3 *db, /* Database handle (for malloc) */ - VdbeSorterIter *p, /* Iterator */ - int nByte, /* Bytes of data to read */ - u8 **ppOut /* OUT: Pointer to buffer containing data */ -){ - int iBuf; /* Offset within buffer to read from */ - int nAvail; /* Bytes of data available in buffer */ - assert( p->aBuffer ); - - /* If there is no more data to be read from the buffer, read the next - ** p->nBuffer bytes of data from the file into it. Or, if there are less - ** than p->nBuffer bytes remaining in the PMA, read all remaining data. */ - iBuf = p->iReadOff % p->nBuffer; - if( iBuf==0 ){ - int nRead; /* Bytes to read from disk */ - int rc; /* sqlite3OsRead() return code */ - - /* Determine how many bytes of data to read. */ - if( (p->iEof - p->iReadOff) > (i64)p->nBuffer ){ - nRead = p->nBuffer; - }else{ - nRead = (int)(p->iEof - p->iReadOff); - } - assert( nRead>0 ); - - /* Read data from the file. Return early if an error occurs. */ - rc = sqlite3OsRead(p->pFile, p->aBuffer, nRead, p->iReadOff); - assert( rc!=SQLITE_IOERR_SHORT_READ ); - if( rc!=SQLITE_OK ) return rc; - } - nAvail = p->nBuffer - iBuf; - - if( nByte<=nAvail ){ - /* The requested data is available in the in-memory buffer. In this - ** case there is no need to make a copy of the data, just return a - ** pointer into the buffer to the caller. */ - *ppOut = &p->aBuffer[iBuf]; - p->iReadOff += nByte; - }else{ - /* The requested data is not all available in the in-memory buffer. - ** In this case, allocate space at p->aAlloc[] to copy the requested - ** range into. Then return a copy of pointer p->aAlloc to the caller. */ - int nRem; /* Bytes remaining to copy */ - - /* Extend the p->aAlloc[] allocation if required. */ - if( p->nAllocnAlloc*2; - while( nByte>nNew ) nNew = nNew*2; - p->aAlloc = sqlite3DbReallocOrFree(db, p->aAlloc, nNew); - if( !p->aAlloc ) return SQLITE_NOMEM; - p->nAlloc = nNew; - } - - /* Copy as much data as is available in the buffer into the start of - ** p->aAlloc[]. */ - memcpy(p->aAlloc, &p->aBuffer[iBuf], nAvail); - p->iReadOff += nAvail; - nRem = nByte - nAvail; - - /* The following loop copies up to p->nBuffer bytes per iteration into - ** the p->aAlloc[] buffer. */ - while( nRem>0 ){ - int rc; /* vdbeSorterIterRead() return code */ - int nCopy; /* Number of bytes to copy */ - u8 *aNext; /* Pointer to buffer to copy data from */ - - nCopy = nRem; - if( nRem>p->nBuffer ) nCopy = p->nBuffer; - rc = vdbeSorterIterRead(db, p, nCopy, &aNext); - if( rc!=SQLITE_OK ) return rc; - assert( aNext!=p->aAlloc ); - memcpy(&p->aAlloc[nByte - nRem], aNext, nCopy); - nRem -= nCopy; - } - - *ppOut = p->aAlloc; - } - - return SQLITE_OK; -} - -/* -** Read a varint from the stream of data accessed by p. Set *pnOut to -** the value read. -*/ -static int vdbeSorterIterVarint(sqlite3 *db, VdbeSorterIter *p, u64 *pnOut){ - int iBuf; - - iBuf = p->iReadOff % p->nBuffer; - if( iBuf && (p->nBuffer-iBuf)>=9 ){ - p->iReadOff += sqlite3GetVarint(&p->aBuffer[iBuf], pnOut); - }else{ - u8 aVarint[16], *a; - int i = 0, rc; - do{ - rc = vdbeSorterIterRead(db, p, 1, &a); - if( rc ) return rc; - aVarint[(i++)&0xf] = a[0]; - }while( (a[0]&0x80)!=0 ); - sqlite3GetVarint(aVarint, pnOut); - } - - return SQLITE_OK; -} - - -/* -** Advance iterator pIter to the next key in its PMA. Return SQLITE_OK if -** no error occurs, or an SQLite error code if one does. -*/ -static int vdbeSorterIterNext( - sqlite3 *db, /* Database handle (for sqlite3DbMalloc() ) */ - VdbeSorterIter *pIter /* Iterator to advance */ -){ - int rc; /* Return Code */ - u64 nRec = 0; /* Size of record in bytes */ - - if( pIter->iReadOff>=pIter->iEof ){ - /* This is an EOF condition */ - vdbeSorterIterZero(db, pIter); - return SQLITE_OK; - } - - rc = vdbeSorterIterVarint(db, pIter, &nRec); - if( rc==SQLITE_OK ){ - pIter->nKey = (int)nRec; - rc = vdbeSorterIterRead(db, pIter, (int)nRec, &pIter->aKey); - } - - return rc; -} - -/* -** Initialize iterator pIter to scan through the PMA stored in file pFile -** starting at offset iStart and ending at offset iEof-1. This function -** leaves the iterator pointing to the first key in the PMA (or EOF if the -** PMA is empty). -*/ -static int vdbeSorterIterInit( - sqlite3 *db, /* Database handle */ - const VdbeSorter *pSorter, /* Sorter object */ - i64 iStart, /* Start offset in pFile */ - VdbeSorterIter *pIter, /* Iterator to populate */ - i64 *pnByte /* IN/OUT: Increment this value by PMA size */ -){ - int rc = SQLITE_OK; - int nBuf; - - nBuf = sqlite3BtreeGetPageSize(db->aDb[0].pBt); - - assert( pSorter->iWriteOff>iStart ); - assert( pIter->aAlloc==0 ); - assert( pIter->aBuffer==0 ); - pIter->pFile = pSorter->pTemp1; - pIter->iReadOff = iStart; - pIter->nAlloc = 128; - pIter->aAlloc = (u8 *)sqlite3DbMallocRaw(db, pIter->nAlloc); - pIter->nBuffer = nBuf; - pIter->aBuffer = (u8 *)sqlite3DbMallocRaw(db, nBuf); - - if( !pIter->aBuffer ){ - rc = SQLITE_NOMEM; - }else{ - int iBuf; - - iBuf = iStart % nBuf; - if( iBuf ){ - int nRead = nBuf - iBuf; - if( (iStart + nRead) > pSorter->iWriteOff ){ - nRead = (int)(pSorter->iWriteOff - iStart); - } - rc = sqlite3OsRead( - pSorter->pTemp1, &pIter->aBuffer[iBuf], nRead, iStart - ); - assert( rc!=SQLITE_IOERR_SHORT_READ ); - } - - if( rc==SQLITE_OK ){ - u64 nByte; /* Size of PMA in bytes */ - pIter->iEof = pSorter->iWriteOff; - rc = vdbeSorterIterVarint(db, pIter, &nByte); - pIter->iEof = pIter->iReadOff + nByte; - *pnByte += nByte; - } - } - - if( rc==SQLITE_OK ){ - rc = vdbeSorterIterNext(db, pIter); - } - return rc; -} - - -/* -** Compare key1 (buffer pKey1, size nKey1 bytes) with key2 (buffer pKey2, -** size nKey2 bytes). Argument pKeyInfo supplies the collation functions -** used by the comparison. If an error occurs, return an SQLite error code. -** Otherwise, return SQLITE_OK and set *pRes to a negative, zero or positive -** value, depending on whether key1 is smaller, equal to or larger than key2. -** -** If the bOmitRowid argument is non-zero, assume both keys end in a rowid -** field. For the purposes of the comparison, ignore it. Also, if bOmitRowid -** is true and key1 contains even a single NULL value, it is considered to -** be less than key2. Even if key2 also contains NULL values. -** -** If pKey2 is passed a NULL pointer, then it is assumed that the pCsr->aSpace -** has been allocated and contains an unpacked record that is used as key2. -*/ -static void vdbeSorterCompare( - const VdbeCursor *pCsr, /* Cursor object (for pKeyInfo) */ - int nIgnore, /* Ignore the last nIgnore fields */ - const void *pKey1, int nKey1, /* Left side of comparison */ - const void *pKey2, int nKey2, /* Right side of comparison */ - int *pRes /* OUT: Result of comparison */ -){ - KeyInfo *pKeyInfo = pCsr->pKeyInfo; - VdbeSorter *pSorter = pCsr->pSorter; - UnpackedRecord *r2 = pSorter->pUnpacked; - int i; - - if( pKey2 ){ - sqlite3VdbeRecordUnpack(pKeyInfo, nKey2, pKey2, r2); - } - - if( nIgnore ){ - r2->nField = pKeyInfo->nField - nIgnore; - assert( r2->nField>0 ); - for(i=0; inField; i++){ - if( r2->aMem[i].flags & MEM_Null ){ - *pRes = -1; - return; - } - } - r2->flags |= UNPACKED_PREFIX_MATCH; - } - - *pRes = sqlite3VdbeRecordCompare(nKey1, pKey1, r2); -} - -/* -** This function is called to compare two iterator keys when merging -** multiple b-tree segments. Parameter iOut is the index of the aTree[] -** value to recalculate. -*/ -static int vdbeSorterDoCompare(const VdbeCursor *pCsr, int iOut){ - VdbeSorter *pSorter = pCsr->pSorter; - int i1; - int i2; - int iRes; - VdbeSorterIter *p1; - VdbeSorterIter *p2; - - assert( iOutnTree && iOut>0 ); - - if( iOut>=(pSorter->nTree/2) ){ - i1 = (iOut - pSorter->nTree/2) * 2; - i2 = i1 + 1; - }else{ - i1 = pSorter->aTree[iOut*2]; - i2 = pSorter->aTree[iOut*2+1]; - } - - p1 = &pSorter->aIter[i1]; - p2 = &pSorter->aIter[i2]; - - if( p1->pFile==0 ){ - iRes = i2; - }else if( p2->pFile==0 ){ - iRes = i1; - }else{ - int res; - assert( pCsr->pSorter->pUnpacked!=0 ); /* allocated in vdbeSorterMerge() */ - vdbeSorterCompare( - pCsr, 0, p1->aKey, p1->nKey, p2->aKey, p2->nKey, &res - ); - if( res<=0 ){ - iRes = i1; - }else{ - iRes = i2; - } - } - - pSorter->aTree[iOut] = iRes; - return SQLITE_OK; -} - -/* -** Initialize the temporary index cursor just opened as a sorter cursor. -*/ -SQLITE_PRIVATE int sqlite3VdbeSorterInit(sqlite3 *db, VdbeCursor *pCsr){ - int pgsz; /* Page size of main database */ - int mxCache; /* Cache size */ - VdbeSorter *pSorter; /* The new sorter */ - char *d; /* Dummy */ - - assert( pCsr->pKeyInfo && pCsr->pBt==0 ); - pCsr->pSorter = pSorter = sqlite3DbMallocZero(db, sizeof(VdbeSorter)); - if( pSorter==0 ){ - return SQLITE_NOMEM; - } - - pSorter->pUnpacked = sqlite3VdbeAllocUnpackedRecord(pCsr->pKeyInfo, 0, 0, &d); - if( pSorter->pUnpacked==0 ) return SQLITE_NOMEM; - assert( pSorter->pUnpacked==(UnpackedRecord *)d ); - - if( !sqlite3TempInMemory(db) ){ - pgsz = sqlite3BtreeGetPageSize(db->aDb[0].pBt); - pSorter->mnPmaSize = SORTER_MIN_WORKING * pgsz; - mxCache = db->aDb[0].pSchema->cache_size; - if( mxCachemxPmaSize = mxCache * pgsz; - } - - return SQLITE_OK; -} - -/* -** Free the list of sorted records starting at pRecord. -*/ -static void vdbeSorterRecordFree(sqlite3 *db, SorterRecord *pRecord){ - SorterRecord *p; - SorterRecord *pNext; - for(p=pRecord; p; p=pNext){ - pNext = p->pNext; - sqlite3DbFree(db, p); - } -} - -/* -** Free any cursor components allocated by sqlite3VdbeSorterXXX routines. -*/ -SQLITE_PRIVATE void sqlite3VdbeSorterClose(sqlite3 *db, VdbeCursor *pCsr){ - VdbeSorter *pSorter = pCsr->pSorter; - if( pSorter ){ - if( pSorter->aIter ){ - int i; - for(i=0; inTree; i++){ - vdbeSorterIterZero(db, &pSorter->aIter[i]); - } - sqlite3DbFree(db, pSorter->aIter); - } - if( pSorter->pTemp1 ){ - sqlite3OsCloseFree(pSorter->pTemp1); - } - vdbeSorterRecordFree(db, pSorter->pRecord); - sqlite3DbFree(db, pSorter->pUnpacked); - sqlite3DbFree(db, pSorter); - pCsr->pSorter = 0; - } -} - -/* -** Allocate space for a file-handle and open a temporary file. If successful, -** set *ppFile to point to the malloc'd file-handle and return SQLITE_OK. -** Otherwise, set *ppFile to 0 and return an SQLite error code. -*/ -static int vdbeSorterOpenTempFile(sqlite3 *db, sqlite3_file **ppFile){ - int dummy; - return sqlite3OsOpenMalloc(db->pVfs, 0, ppFile, - SQLITE_OPEN_TEMP_JOURNAL | - SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | - SQLITE_OPEN_EXCLUSIVE | SQLITE_OPEN_DELETEONCLOSE, &dummy - ); -} - -/* -** Merge the two sorted lists p1 and p2 into a single list. -** Set *ppOut to the head of the new list. -*/ -static void vdbeSorterMerge( - const VdbeCursor *pCsr, /* For pKeyInfo */ - SorterRecord *p1, /* First list to merge */ - SorterRecord *p2, /* Second list to merge */ - SorterRecord **ppOut /* OUT: Head of merged list */ -){ - SorterRecord *pFinal = 0; - SorterRecord **pp = &pFinal; - void *pVal2 = p2 ? p2->pVal : 0; - - while( p1 && p2 ){ - int res; - vdbeSorterCompare(pCsr, 0, p1->pVal, p1->nVal, pVal2, p2->nVal, &res); - if( res<=0 ){ - *pp = p1; - pp = &p1->pNext; - p1 = p1->pNext; - pVal2 = 0; - }else{ - *pp = p2; - pp = &p2->pNext; - p2 = p2->pNext; - if( p2==0 ) break; - pVal2 = p2->pVal; - } - } - *pp = p1 ? p1 : p2; - *ppOut = pFinal; -} - -/* -** Sort the linked list of records headed at pCsr->pRecord. Return SQLITE_OK -** if successful, or an SQLite error code (i.e. SQLITE_NOMEM) if an error -** occurs. -*/ -static int vdbeSorterSort(const VdbeCursor *pCsr){ - int i; - SorterRecord **aSlot; - SorterRecord *p; - VdbeSorter *pSorter = pCsr->pSorter; - - aSlot = (SorterRecord **)sqlite3MallocZero(64 * sizeof(SorterRecord *)); - if( !aSlot ){ - return SQLITE_NOMEM; - } - - p = pSorter->pRecord; - while( p ){ - SorterRecord *pNext = p->pNext; - p->pNext = 0; - for(i=0; aSlot[i]; i++){ - vdbeSorterMerge(pCsr, p, aSlot[i], &p); - aSlot[i] = 0; - } - aSlot[i] = p; - p = pNext; - } - - p = 0; - for(i=0; i<64; i++){ - vdbeSorterMerge(pCsr, p, aSlot[i], &p); - } - pSorter->pRecord = p; - - sqlite3_free(aSlot); - return SQLITE_OK; -} - -/* -** Initialize a file-writer object. -*/ -static void fileWriterInit( - sqlite3 *db, /* Database (for malloc) */ - sqlite3_file *pFile, /* File to write to */ - FileWriter *p, /* Object to populate */ - i64 iStart /* Offset of pFile to begin writing at */ -){ - int nBuf = sqlite3BtreeGetPageSize(db->aDb[0].pBt); - - memset(p, 0, sizeof(FileWriter)); - p->aBuffer = (u8 *)sqlite3DbMallocRaw(db, nBuf); - if( !p->aBuffer ){ - p->eFWErr = SQLITE_NOMEM; - }else{ - p->iBufEnd = p->iBufStart = (iStart % nBuf); - p->iWriteOff = iStart - p->iBufStart; - p->nBuffer = nBuf; - p->pFile = pFile; - } -} - -/* -** Write nData bytes of data to the file-write object. Return SQLITE_OK -** if successful, or an SQLite error code if an error occurs. -*/ -static void fileWriterWrite(FileWriter *p, u8 *pData, int nData){ - int nRem = nData; - while( nRem>0 && p->eFWErr==0 ){ - int nCopy = nRem; - if( nCopy>(p->nBuffer - p->iBufEnd) ){ - nCopy = p->nBuffer - p->iBufEnd; - } - - memcpy(&p->aBuffer[p->iBufEnd], &pData[nData-nRem], nCopy); - p->iBufEnd += nCopy; - if( p->iBufEnd==p->nBuffer ){ - p->eFWErr = sqlite3OsWrite(p->pFile, - &p->aBuffer[p->iBufStart], p->iBufEnd - p->iBufStart, - p->iWriteOff + p->iBufStart - ); - p->iBufStart = p->iBufEnd = 0; - p->iWriteOff += p->nBuffer; - } - assert( p->iBufEndnBuffer ); - - nRem -= nCopy; - } -} - -/* -** Flush any buffered data to disk and clean up the file-writer object. -** The results of using the file-writer after this call are undefined. -** Return SQLITE_OK if flushing the buffered data succeeds or is not -** required. Otherwise, return an SQLite error code. -** -** Before returning, set *piEof to the offset immediately following the -** last byte written to the file. -*/ -static int fileWriterFinish(sqlite3 *db, FileWriter *p, i64 *piEof){ - int rc; - if( p->eFWErr==0 && ALWAYS(p->aBuffer) && p->iBufEnd>p->iBufStart ){ - p->eFWErr = sqlite3OsWrite(p->pFile, - &p->aBuffer[p->iBufStart], p->iBufEnd - p->iBufStart, - p->iWriteOff + p->iBufStart - ); - } - *piEof = (p->iWriteOff + p->iBufEnd); - sqlite3DbFree(db, p->aBuffer); - rc = p->eFWErr; - memset(p, 0, sizeof(FileWriter)); - return rc; -} - -/* -** Write value iVal encoded as a varint to the file-write object. Return -** SQLITE_OK if successful, or an SQLite error code if an error occurs. -*/ -static void fileWriterWriteVarint(FileWriter *p, u64 iVal){ - int nByte; - u8 aByte[10]; - nByte = sqlite3PutVarint(aByte, iVal); - fileWriterWrite(p, aByte, nByte); -} - -/* -** Write the current contents of the in-memory linked-list to a PMA. Return -** SQLITE_OK if successful, or an SQLite error code otherwise. -** -** The format of a PMA is: -** -** * A varint. This varint contains the total number of bytes of content -** in the PMA (not including the varint itself). -** -** * One or more records packed end-to-end in order of ascending keys. -** Each record consists of a varint followed by a blob of data (the -** key). The varint is the number of bytes in the blob of data. -*/ -static int vdbeSorterListToPMA(sqlite3 *db, const VdbeCursor *pCsr){ - int rc = SQLITE_OK; /* Return code */ - VdbeSorter *pSorter = pCsr->pSorter; - FileWriter writer; - - memset(&writer, 0, sizeof(FileWriter)); - - if( pSorter->nInMemory==0 ){ - assert( pSorter->pRecord==0 ); - return rc; - } - - rc = vdbeSorterSort(pCsr); - - /* If the first temporary PMA file has not been opened, open it now. */ - if( rc==SQLITE_OK && pSorter->pTemp1==0 ){ - rc = vdbeSorterOpenTempFile(db, &pSorter->pTemp1); - assert( rc!=SQLITE_OK || pSorter->pTemp1 ); - assert( pSorter->iWriteOff==0 ); - assert( pSorter->nPMA==0 ); - } - - if( rc==SQLITE_OK ){ - SorterRecord *p; - SorterRecord *pNext = 0; - - fileWriterInit(db, pSorter->pTemp1, &writer, pSorter->iWriteOff); - pSorter->nPMA++; - fileWriterWriteVarint(&writer, pSorter->nInMemory); - for(p=pSorter->pRecord; p; p=pNext){ - pNext = p->pNext; - fileWriterWriteVarint(&writer, p->nVal); - fileWriterWrite(&writer, p->pVal, p->nVal); - sqlite3DbFree(db, p); - } - pSorter->pRecord = p; - rc = fileWriterFinish(db, &writer, &pSorter->iWriteOff); - } - - return rc; -} - -/* -** Add a record to the sorter. -*/ -SQLITE_PRIVATE int sqlite3VdbeSorterWrite( - sqlite3 *db, /* Database handle */ - const VdbeCursor *pCsr, /* Sorter cursor */ - Mem *pVal /* Memory cell containing record */ -){ - VdbeSorter *pSorter = pCsr->pSorter; - int rc = SQLITE_OK; /* Return Code */ - SorterRecord *pNew; /* New list element */ - - assert( pSorter ); - pSorter->nInMemory += sqlite3VarintLen(pVal->n) + pVal->n; - - pNew = (SorterRecord *)sqlite3DbMallocRaw(db, pVal->n + sizeof(SorterRecord)); - if( pNew==0 ){ - rc = SQLITE_NOMEM; - }else{ - pNew->pVal = (void *)&pNew[1]; - memcpy(pNew->pVal, pVal->z, pVal->n); - pNew->nVal = pVal->n; - pNew->pNext = pSorter->pRecord; - pSorter->pRecord = pNew; - } - - /* See if the contents of the sorter should now be written out. They - ** are written out when either of the following are true: - ** - ** * The total memory allocated for the in-memory list is greater - ** than (page-size * cache-size), or - ** - ** * The total memory allocated for the in-memory list is greater - ** than (page-size * 10) and sqlite3HeapNearlyFull() returns true. - */ - if( rc==SQLITE_OK && pSorter->mxPmaSize>0 && ( - (pSorter->nInMemory>pSorter->mxPmaSize) - || (pSorter->nInMemory>pSorter->mnPmaSize && sqlite3HeapNearlyFull()) - )){ -#ifdef SQLITE_DEBUG - i64 nExpect = pSorter->iWriteOff - + sqlite3VarintLen(pSorter->nInMemory) - + pSorter->nInMemory; -#endif - rc = vdbeSorterListToPMA(db, pCsr); - pSorter->nInMemory = 0; - assert( rc!=SQLITE_OK || (nExpect==pSorter->iWriteOff) ); - } - - return rc; -} - -/* -** Helper function for sqlite3VdbeSorterRewind(). -*/ -static int vdbeSorterInitMerge( - sqlite3 *db, /* Database handle */ - const VdbeCursor *pCsr, /* Cursor handle for this sorter */ - i64 *pnByte /* Sum of bytes in all opened PMAs */ -){ - VdbeSorter *pSorter = pCsr->pSorter; - int rc = SQLITE_OK; /* Return code */ - int i; /* Used to iterator through aIter[] */ - i64 nByte = 0; /* Total bytes in all opened PMAs */ - - /* Initialize the iterators. */ - for(i=0; iaIter[i]; - rc = vdbeSorterIterInit(db, pSorter, pSorter->iReadOff, pIter, &nByte); - pSorter->iReadOff = pIter->iEof; - assert( rc!=SQLITE_OK || pSorter->iReadOff<=pSorter->iWriteOff ); - if( rc!=SQLITE_OK || pSorter->iReadOff>=pSorter->iWriteOff ) break; - } - - /* Initialize the aTree[] array. */ - for(i=pSorter->nTree-1; rc==SQLITE_OK && i>0; i--){ - rc = vdbeSorterDoCompare(pCsr, i); - } - - *pnByte = nByte; - return rc; -} - -/* -** Once the sorter has been populated, this function is called to prepare -** for iterating through its contents in sorted order. -*/ -SQLITE_PRIVATE int sqlite3VdbeSorterRewind(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){ - VdbeSorter *pSorter = pCsr->pSorter; - int rc; /* Return code */ - sqlite3_file *pTemp2 = 0; /* Second temp file to use */ - i64 iWrite2 = 0; /* Write offset for pTemp2 */ - int nIter; /* Number of iterators used */ - int nByte; /* Bytes of space required for aIter/aTree */ - int N = 2; /* Power of 2 >= nIter */ - - assert( pSorter ); - - /* If no data has been written to disk, then do not do so now. Instead, - ** sort the VdbeSorter.pRecord list. The vdbe layer will read data directly - ** from the in-memory list. */ - if( pSorter->nPMA==0 ){ - *pbEof = !pSorter->pRecord; - assert( pSorter->aTree==0 ); - return vdbeSorterSort(pCsr); - } - - /* Write the current in-memory list to a PMA. */ - rc = vdbeSorterListToPMA(db, pCsr); - if( rc!=SQLITE_OK ) return rc; - - /* Allocate space for aIter[] and aTree[]. */ - nIter = pSorter->nPMA; - if( nIter>SORTER_MAX_MERGE_COUNT ) nIter = SORTER_MAX_MERGE_COUNT; - assert( nIter>0 ); - while( NaIter = (VdbeSorterIter *)sqlite3DbMallocZero(db, nByte); - if( !pSorter->aIter ) return SQLITE_NOMEM; - pSorter->aTree = (int *)&pSorter->aIter[N]; - pSorter->nTree = N; - - do { - int iNew; /* Index of new, merged, PMA */ - - for(iNew=0; - rc==SQLITE_OK && iNew*SORTER_MAX_MERGE_COUNTnPMA; - iNew++ - ){ - int rc2; /* Return code from fileWriterFinish() */ - FileWriter writer; /* Object used to write to disk */ - i64 nWrite; /* Number of bytes in new PMA */ - - memset(&writer, 0, sizeof(FileWriter)); - - /* If there are SORTER_MAX_MERGE_COUNT or less PMAs in file pTemp1, - ** initialize an iterator for each of them and break out of the loop. - ** These iterators will be incrementally merged as the VDBE layer calls - ** sqlite3VdbeSorterNext(). - ** - ** Otherwise, if pTemp1 contains more than SORTER_MAX_MERGE_COUNT PMAs, - ** initialize interators for SORTER_MAX_MERGE_COUNT of them. These PMAs - ** are merged into a single PMA that is written to file pTemp2. - */ - rc = vdbeSorterInitMerge(db, pCsr, &nWrite); - assert( rc!=SQLITE_OK || pSorter->aIter[ pSorter->aTree[1] ].pFile ); - if( rc!=SQLITE_OK || pSorter->nPMA<=SORTER_MAX_MERGE_COUNT ){ - break; - } - - /* Open the second temp file, if it is not already open. */ - if( pTemp2==0 ){ - assert( iWrite2==0 ); - rc = vdbeSorterOpenTempFile(db, &pTemp2); - } - - if( rc==SQLITE_OK ){ - int bEof = 0; - fileWriterInit(db, pTemp2, &writer, iWrite2); - fileWriterWriteVarint(&writer, nWrite); - while( rc==SQLITE_OK && bEof==0 ){ - VdbeSorterIter *pIter = &pSorter->aIter[ pSorter->aTree[1] ]; - assert( pIter->pFile ); - - fileWriterWriteVarint(&writer, pIter->nKey); - fileWriterWrite(&writer, pIter->aKey, pIter->nKey); - rc = sqlite3VdbeSorterNext(db, pCsr, &bEof); - } - rc2 = fileWriterFinish(db, &writer, &iWrite2); - if( rc==SQLITE_OK ) rc = rc2; - } - } - - if( pSorter->nPMA<=SORTER_MAX_MERGE_COUNT ){ - break; - }else{ - sqlite3_file *pTmp = pSorter->pTemp1; - pSorter->nPMA = iNew; - pSorter->pTemp1 = pTemp2; - pTemp2 = pTmp; - pSorter->iWriteOff = iWrite2; - pSorter->iReadOff = 0; - iWrite2 = 0; - } - }while( rc==SQLITE_OK ); - - if( pTemp2 ){ - sqlite3OsCloseFree(pTemp2); - } - *pbEof = (pSorter->aIter[pSorter->aTree[1]].pFile==0); - return rc; -} - -/* -** Advance to the next element in the sorter. -*/ -SQLITE_PRIVATE int sqlite3VdbeSorterNext(sqlite3 *db, const VdbeCursor *pCsr, int *pbEof){ - VdbeSorter *pSorter = pCsr->pSorter; - int rc; /* Return code */ - - if( pSorter->aTree ){ - int iPrev = pSorter->aTree[1];/* Index of iterator to advance */ - int i; /* Index of aTree[] to recalculate */ - - rc = vdbeSorterIterNext(db, &pSorter->aIter[iPrev]); - for(i=(pSorter->nTree+iPrev)/2; rc==SQLITE_OK && i>0; i=i/2){ - rc = vdbeSorterDoCompare(pCsr, i); - } - - *pbEof = (pSorter->aIter[pSorter->aTree[1]].pFile==0); - }else{ - SorterRecord *pFree = pSorter->pRecord; - pSorter->pRecord = pFree->pNext; - pFree->pNext = 0; - vdbeSorterRecordFree(db, pFree); - *pbEof = !pSorter->pRecord; - rc = SQLITE_OK; - } - return rc; -} - -/* -** Return a pointer to a buffer owned by the sorter that contains the -** current key. -*/ -static void *vdbeSorterRowkey( - const VdbeSorter *pSorter, /* Sorter object */ - int *pnKey /* OUT: Size of current key in bytes */ -){ - void *pKey; - if( pSorter->aTree ){ - VdbeSorterIter *pIter; - pIter = &pSorter->aIter[ pSorter->aTree[1] ]; - *pnKey = pIter->nKey; - pKey = pIter->aKey; - }else{ - *pnKey = pSorter->pRecord->nVal; - pKey = pSorter->pRecord->pVal; - } - return pKey; -} - -/* -** Copy the current sorter key into the memory cell pOut. -*/ -SQLITE_PRIVATE int sqlite3VdbeSorterRowkey(const VdbeCursor *pCsr, Mem *pOut){ - VdbeSorter *pSorter = pCsr->pSorter; - void *pKey; int nKey; /* Sorter key to copy into pOut */ - - pKey = vdbeSorterRowkey(pSorter, &nKey); - if( sqlite3VdbeMemGrow(pOut, nKey, 0) ){ - return SQLITE_NOMEM; - } - pOut->n = nKey; - MemSetTypeFlag(pOut, MEM_Blob); - memcpy(pOut->z, pKey, nKey); - - return SQLITE_OK; -} - -/* -** Compare the key in memory cell pVal with the key that the sorter cursor -** passed as the first argument currently points to. For the purposes of -** the comparison, ignore the rowid field at the end of each record. -** -** If an error occurs, return an SQLite error code (i.e. SQLITE_NOMEM). -** Otherwise, set *pRes to a negative, zero or positive value if the -** key in pVal is smaller than, equal to or larger than the current sorter -** key. -*/ -SQLITE_PRIVATE int sqlite3VdbeSorterCompare( - const VdbeCursor *pCsr, /* Sorter cursor */ - Mem *pVal, /* Value to compare to current sorter key */ - int nIgnore, /* Ignore this many fields at the end */ - int *pRes /* OUT: Result of comparison */ -){ - VdbeSorter *pSorter = pCsr->pSorter; - void *pKey; int nKey; /* Sorter key to compare pVal with */ - - pKey = vdbeSorterRowkey(pSorter, &nKey); - vdbeSorterCompare(pCsr, nIgnore, pVal->z, pVal->n, pKey, nKey, pRes); - return SQLITE_OK; -} - -/************** End of vdbesort.c ********************************************/ -/************** Begin file journal.c *****************************************/ -/* -** 2007 August 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file implements a special kind of sqlite3_file object used -** by SQLite to create journal files if the atomic-write optimization -** is enabled. -** -** The distinctive characteristic of this sqlite3_file is that the -** actual on disk file is created lazily. When the file is created, -** the caller specifies a buffer size for an in-memory buffer to -** be used to service read() and write() requests. The actual file -** on disk is not created or populated until either: -** -** 1) The in-memory representation grows too large for the allocated -** buffer, or -** 2) The sqlite3JournalCreate() function is called. -*/ -#ifdef SQLITE_ENABLE_ATOMIC_WRITE - - -/* -** A JournalFile object is a subclass of sqlite3_file used by -** as an open file handle for journal files. -*/ -struct JournalFile { - sqlite3_io_methods *pMethod; /* I/O methods on journal files */ - int nBuf; /* Size of zBuf[] in bytes */ - char *zBuf; /* Space to buffer journal writes */ - int iSize; /* Amount of zBuf[] currently used */ - int flags; /* xOpen flags */ - sqlite3_vfs *pVfs; /* The "real" underlying VFS */ - sqlite3_file *pReal; /* The "real" underlying file descriptor */ - const char *zJournal; /* Name of the journal file */ -}; -typedef struct JournalFile JournalFile; - -/* -** If it does not already exists, create and populate the on-disk file -** for JournalFile p. -*/ -static int createFile(JournalFile *p){ - int rc = SQLITE_OK; - if( !p->pReal ){ - sqlite3_file *pReal = (sqlite3_file *)&p[1]; - rc = sqlite3OsOpen(p->pVfs, p->zJournal, pReal, p->flags, 0); - if( rc==SQLITE_OK ){ - p->pReal = pReal; - if( p->iSize>0 ){ - assert(p->iSize<=p->nBuf); - rc = sqlite3OsWrite(p->pReal, p->zBuf, p->iSize, 0); - } - if( rc!=SQLITE_OK ){ - /* If an error occurred while writing to the file, close it before - ** returning. This way, SQLite uses the in-memory journal data to - ** roll back changes made to the internal page-cache before this - ** function was called. */ - sqlite3OsClose(pReal); - p->pReal = 0; - } - } - } - return rc; -} - -/* -** Close the file. -*/ -static int jrnlClose(sqlite3_file *pJfd){ - JournalFile *p = (JournalFile *)pJfd; - if( p->pReal ){ - sqlite3OsClose(p->pReal); - } - sqlite3_free(p->zBuf); - return SQLITE_OK; -} - -/* -** Read data from the file. -*/ -static int jrnlRead( - sqlite3_file *pJfd, /* The journal file from which to read */ - void *zBuf, /* Put the results here */ - int iAmt, /* Number of bytes to read */ - sqlite_int64 iOfst /* Begin reading at this offset */ -){ - int rc = SQLITE_OK; - JournalFile *p = (JournalFile *)pJfd; - if( p->pReal ){ - rc = sqlite3OsRead(p->pReal, zBuf, iAmt, iOfst); - }else if( (iAmt+iOfst)>p->iSize ){ - rc = SQLITE_IOERR_SHORT_READ; - }else{ - memcpy(zBuf, &p->zBuf[iOfst], iAmt); - } - return rc; -} - -/* -** Write data to the file. -*/ -static int jrnlWrite( - sqlite3_file *pJfd, /* The journal file into which to write */ - const void *zBuf, /* Take data to be written from here */ - int iAmt, /* Number of bytes to write */ - sqlite_int64 iOfst /* Begin writing at this offset into the file */ -){ - int rc = SQLITE_OK; - JournalFile *p = (JournalFile *)pJfd; - if( !p->pReal && (iOfst+iAmt)>p->nBuf ){ - rc = createFile(p); - } - if( rc==SQLITE_OK ){ - if( p->pReal ){ - rc = sqlite3OsWrite(p->pReal, zBuf, iAmt, iOfst); - }else{ - memcpy(&p->zBuf[iOfst], zBuf, iAmt); - if( p->iSize<(iOfst+iAmt) ){ - p->iSize = (iOfst+iAmt); - } - } - } - return rc; -} - -/* -** Truncate the file. -*/ -static int jrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ - int rc = SQLITE_OK; - JournalFile *p = (JournalFile *)pJfd; - if( p->pReal ){ - rc = sqlite3OsTruncate(p->pReal, size); - }else if( sizeiSize ){ - p->iSize = size; - } - return rc; -} - -/* -** Sync the file. -*/ -static int jrnlSync(sqlite3_file *pJfd, int flags){ - int rc; - JournalFile *p = (JournalFile *)pJfd; - if( p->pReal ){ - rc = sqlite3OsSync(p->pReal, flags); - }else{ - rc = SQLITE_OK; - } - return rc; -} - -/* -** Query the size of the file in bytes. -*/ -static int jrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){ - int rc = SQLITE_OK; - JournalFile *p = (JournalFile *)pJfd; - if( p->pReal ){ - rc = sqlite3OsFileSize(p->pReal, pSize); - }else{ - *pSize = (sqlite_int64) p->iSize; - } - return rc; -} - -/* -** Table of methods for JournalFile sqlite3_file object. -*/ -static struct sqlite3_io_methods JournalFileMethods = { - 1, /* iVersion */ - jrnlClose, /* xClose */ - jrnlRead, /* xRead */ - jrnlWrite, /* xWrite */ - jrnlTruncate, /* xTruncate */ - jrnlSync, /* xSync */ - jrnlFileSize, /* xFileSize */ - 0, /* xLock */ - 0, /* xUnlock */ - 0, /* xCheckReservedLock */ - 0, /* xFileControl */ - 0, /* xSectorSize */ - 0, /* xDeviceCharacteristics */ - 0, /* xShmMap */ - 0, /* xShmLock */ - 0, /* xShmBarrier */ - 0 /* xShmUnmap */ -}; - -/* -** Open a journal file. -*/ -SQLITE_PRIVATE int sqlite3JournalOpen( - sqlite3_vfs *pVfs, /* The VFS to use for actual file I/O */ - const char *zName, /* Name of the journal file */ - sqlite3_file *pJfd, /* Preallocated, blank file handle */ - int flags, /* Opening flags */ - int nBuf /* Bytes buffered before opening the file */ -){ - JournalFile *p = (JournalFile *)pJfd; - memset(p, 0, sqlite3JournalSize(pVfs)); - if( nBuf>0 ){ - p->zBuf = sqlite3MallocZero(nBuf); - if( !p->zBuf ){ - return SQLITE_NOMEM; - } - }else{ - return sqlite3OsOpen(pVfs, zName, pJfd, flags, 0); - } - p->pMethod = &JournalFileMethods; - p->nBuf = nBuf; - p->flags = flags; - p->zJournal = zName; - p->pVfs = pVfs; - return SQLITE_OK; -} - -/* -** If the argument p points to a JournalFile structure, and the underlying -** file has not yet been created, create it now. -*/ -SQLITE_PRIVATE int sqlite3JournalCreate(sqlite3_file *p){ - if( p->pMethods!=&JournalFileMethods ){ - return SQLITE_OK; - } - return createFile((JournalFile *)p); -} - -/* -** The file-handle passed as the only argument is guaranteed to be an open -** file. It may or may not be of class JournalFile. If the file is a -** JournalFile, and the underlying file on disk has not yet been opened, -** return 0. Otherwise, return 1. -*/ -SQLITE_PRIVATE int sqlite3JournalExists(sqlite3_file *p){ - return (p->pMethods!=&JournalFileMethods || ((JournalFile *)p)->pReal!=0); -} - -/* -** Return the number of bytes required to store a JournalFile that uses vfs -** pVfs to create the underlying on-disk files. -*/ -SQLITE_PRIVATE int sqlite3JournalSize(sqlite3_vfs *pVfs){ - return (pVfs->szOsFile+sizeof(JournalFile)); -} -#endif - -/************** End of journal.c *********************************************/ -/************** Begin file memjournal.c **************************************/ -/* -** 2008 October 7 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains code use to implement an in-memory rollback journal. -** The in-memory rollback journal is used to journal transactions for -** ":memory:" databases and when the journal_mode=MEMORY pragma is used. -*/ - -/* Forward references to internal structures */ -typedef struct MemJournal MemJournal; -typedef struct FilePoint FilePoint; -typedef struct FileChunk FileChunk; - -/* Space to hold the rollback journal is allocated in increments of -** this many bytes. -** -** The size chosen is a little less than a power of two. That way, -** the FileChunk object will have a size that almost exactly fills -** a power-of-two allocation. This mimimizes wasted space in power-of-two -** memory allocators. -*/ -#define JOURNAL_CHUNKSIZE ((int)(1024-sizeof(FileChunk*))) - -/* -** The rollback journal is composed of a linked list of these structures. -*/ -struct FileChunk { - FileChunk *pNext; /* Next chunk in the journal */ - u8 zChunk[JOURNAL_CHUNKSIZE]; /* Content of this chunk */ -}; - -/* -** An instance of this object serves as a cursor into the rollback journal. -** The cursor can be either for reading or writing. -*/ -struct FilePoint { - sqlite3_int64 iOffset; /* Offset from the beginning of the file */ - FileChunk *pChunk; /* Specific chunk into which cursor points */ -}; - -/* -** This subclass is a subclass of sqlite3_file. Each open memory-journal -** is an instance of this class. -*/ -struct MemJournal { - sqlite3_io_methods *pMethod; /* Parent class. MUST BE FIRST */ - FileChunk *pFirst; /* Head of in-memory chunk-list */ - FilePoint endpoint; /* Pointer to the end of the file */ - FilePoint readpoint; /* Pointer to the end of the last xRead() */ -}; - -/* -** Read data from the in-memory journal file. This is the implementation -** of the sqlite3_vfs.xRead method. -*/ -static int memjrnlRead( - sqlite3_file *pJfd, /* The journal file from which to read */ - void *zBuf, /* Put the results here */ - int iAmt, /* Number of bytes to read */ - sqlite_int64 iOfst /* Begin reading at this offset */ -){ - MemJournal *p = (MemJournal *)pJfd; - u8 *zOut = zBuf; - int nRead = iAmt; - int iChunkOffset; - FileChunk *pChunk; - - /* SQLite never tries to read past the end of a rollback journal file */ - assert( iOfst+iAmt<=p->endpoint.iOffset ); - - if( p->readpoint.iOffset!=iOfst || iOfst==0 ){ - sqlite3_int64 iOff = 0; - for(pChunk=p->pFirst; - ALWAYS(pChunk) && (iOff+JOURNAL_CHUNKSIZE)<=iOfst; - pChunk=pChunk->pNext - ){ - iOff += JOURNAL_CHUNKSIZE; - } - }else{ - pChunk = p->readpoint.pChunk; - } - - iChunkOffset = (int)(iOfst%JOURNAL_CHUNKSIZE); - do { - int iSpace = JOURNAL_CHUNKSIZE - iChunkOffset; - int nCopy = MIN(nRead, (JOURNAL_CHUNKSIZE - iChunkOffset)); - memcpy(zOut, &pChunk->zChunk[iChunkOffset], nCopy); - zOut += nCopy; - nRead -= iSpace; - iChunkOffset = 0; - } while( nRead>=0 && (pChunk=pChunk->pNext)!=0 && nRead>0 ); - p->readpoint.iOffset = iOfst+iAmt; - p->readpoint.pChunk = pChunk; - - return SQLITE_OK; -} - -/* -** Write data to the file. -*/ -static int memjrnlWrite( - sqlite3_file *pJfd, /* The journal file into which to write */ - const void *zBuf, /* Take data to be written from here */ - int iAmt, /* Number of bytes to write */ - sqlite_int64 iOfst /* Begin writing at this offset into the file */ -){ - MemJournal *p = (MemJournal *)pJfd; - int nWrite = iAmt; - u8 *zWrite = (u8 *)zBuf; - - /* An in-memory journal file should only ever be appended to. Random - ** access writes are not required by sqlite. - */ - assert( iOfst==p->endpoint.iOffset ); - UNUSED_PARAMETER(iOfst); - - while( nWrite>0 ){ - FileChunk *pChunk = p->endpoint.pChunk; - int iChunkOffset = (int)(p->endpoint.iOffset%JOURNAL_CHUNKSIZE); - int iSpace = MIN(nWrite, JOURNAL_CHUNKSIZE - iChunkOffset); - - if( iChunkOffset==0 ){ - /* New chunk is required to extend the file. */ - FileChunk *pNew = sqlite3_malloc(sizeof(FileChunk)); - if( !pNew ){ - return SQLITE_IOERR_NOMEM; - } - pNew->pNext = 0; - if( pChunk ){ - assert( p->pFirst ); - pChunk->pNext = pNew; - }else{ - assert( !p->pFirst ); - p->pFirst = pNew; - } - p->endpoint.pChunk = pNew; - } - - memcpy(&p->endpoint.pChunk->zChunk[iChunkOffset], zWrite, iSpace); - zWrite += iSpace; - nWrite -= iSpace; - p->endpoint.iOffset += iSpace; - } - - return SQLITE_OK; -} - -/* -** Truncate the file. -*/ -static int memjrnlTruncate(sqlite3_file *pJfd, sqlite_int64 size){ - MemJournal *p = (MemJournal *)pJfd; - FileChunk *pChunk; - assert(size==0); - UNUSED_PARAMETER(size); - pChunk = p->pFirst; - while( pChunk ){ - FileChunk *pTmp = pChunk; - pChunk = pChunk->pNext; - sqlite3_free(pTmp); - } - sqlite3MemJournalOpen(pJfd); - return SQLITE_OK; -} - -/* -** Close the file. -*/ -static int memjrnlClose(sqlite3_file *pJfd){ - memjrnlTruncate(pJfd, 0); - return SQLITE_OK; -} - - -/* -** Sync the file. -** -** Syncing an in-memory journal is a no-op. And, in fact, this routine -** is never called in a working implementation. This implementation -** exists purely as a contingency, in case some malfunction in some other -** part of SQLite causes Sync to be called by mistake. -*/ -static int memjrnlSync(sqlite3_file *NotUsed, int NotUsed2){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - return SQLITE_OK; -} - -/* -** Query the size of the file in bytes. -*/ -static int memjrnlFileSize(sqlite3_file *pJfd, sqlite_int64 *pSize){ - MemJournal *p = (MemJournal *)pJfd; - *pSize = (sqlite_int64) p->endpoint.iOffset; - return SQLITE_OK; -} - -/* -** Table of methods for MemJournal sqlite3_file object. -*/ -static const struct sqlite3_io_methods MemJournalMethods = { - 1, /* iVersion */ - memjrnlClose, /* xClose */ - memjrnlRead, /* xRead */ - memjrnlWrite, /* xWrite */ - memjrnlTruncate, /* xTruncate */ - memjrnlSync, /* xSync */ - memjrnlFileSize, /* xFileSize */ - 0, /* xLock */ - 0, /* xUnlock */ - 0, /* xCheckReservedLock */ - 0, /* xFileControl */ - 0, /* xSectorSize */ - 0, /* xDeviceCharacteristics */ - 0, /* xShmMap */ - 0, /* xShmLock */ - 0, /* xShmBarrier */ - 0, /* xShmUnmap */ - 0, /* xFetch */ - 0 /* xUnfetch */ -}; - -/* -** Open a journal file. -*/ -SQLITE_PRIVATE void sqlite3MemJournalOpen(sqlite3_file *pJfd){ - MemJournal *p = (MemJournal *)pJfd; - assert( EIGHT_BYTE_ALIGNMENT(p) ); - memset(p, 0, sqlite3MemJournalSize()); - p->pMethod = (sqlite3_io_methods*)&MemJournalMethods; -} - -/* -** Return true if the file-handle passed as an argument is -** an in-memory journal -*/ -SQLITE_PRIVATE int sqlite3IsMemJournal(sqlite3_file *pJfd){ - return pJfd->pMethods==&MemJournalMethods; -} - -/* -** Return the number of bytes required to store a MemJournal file descriptor. -*/ -SQLITE_PRIVATE int sqlite3MemJournalSize(void){ - return sizeof(MemJournal); -} - -/************** End of memjournal.c ******************************************/ -/************** Begin file walker.c ******************************************/ -/* -** 2008 August 16 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains routines used for walking the parser tree for -** an SQL statement. -*/ -/* #include */ -/* #include */ - - -/* -** Walk an expression tree. Invoke the callback once for each node -** of the expression, while decending. (In other words, the callback -** is invoked before visiting children.) -** -** The return value from the callback should be one of the WRC_* -** constants to specify how to proceed with the walk. -** -** WRC_Continue Continue descending down the tree. -** -** WRC_Prune Do not descend into child nodes. But allow -** the walk to continue with sibling nodes. -** -** WRC_Abort Do no more callbacks. Unwind the stack and -** return the top-level walk call. -** -** The return value from this routine is WRC_Abort to abandon the tree walk -** and WRC_Continue to continue. -*/ -SQLITE_PRIVATE int sqlite3WalkExpr(Walker *pWalker, Expr *pExpr){ - int rc; - if( pExpr==0 ) return WRC_Continue; - testcase( ExprHasProperty(pExpr, EP_TokenOnly) ); - testcase( ExprHasProperty(pExpr, EP_Reduced) ); - rc = pWalker->xExprCallback(pWalker, pExpr); - if( rc==WRC_Continue - && !ExprHasProperty(pExpr,EP_TokenOnly) ){ - if( sqlite3WalkExpr(pWalker, pExpr->pLeft) ) return WRC_Abort; - if( sqlite3WalkExpr(pWalker, pExpr->pRight) ) return WRC_Abort; - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - if( sqlite3WalkSelect(pWalker, pExpr->x.pSelect) ) return WRC_Abort; - }else{ - if( sqlite3WalkExprList(pWalker, pExpr->x.pList) ) return WRC_Abort; - } - } - return rc & WRC_Abort; -} - -/* -** Call sqlite3WalkExpr() for every expression in list p or until -** an abort request is seen. -*/ -SQLITE_PRIVATE int sqlite3WalkExprList(Walker *pWalker, ExprList *p){ - int i; - struct ExprList_item *pItem; - if( p ){ - for(i=p->nExpr, pItem=p->a; i>0; i--, pItem++){ - if( sqlite3WalkExpr(pWalker, pItem->pExpr) ) return WRC_Abort; - } - } - return WRC_Continue; -} - -/* -** Walk all expressions associated with SELECT statement p. Do -** not invoke the SELECT callback on p, but do (of course) invoke -** any expr callbacks and SELECT callbacks that come from subqueries. -** Return WRC_Abort or WRC_Continue. -*/ -SQLITE_PRIVATE int sqlite3WalkSelectExpr(Walker *pWalker, Select *p){ - if( sqlite3WalkExprList(pWalker, p->pEList) ) return WRC_Abort; - if( sqlite3WalkExpr(pWalker, p->pWhere) ) return WRC_Abort; - if( sqlite3WalkExprList(pWalker, p->pGroupBy) ) return WRC_Abort; - if( sqlite3WalkExpr(pWalker, p->pHaving) ) return WRC_Abort; - if( sqlite3WalkExprList(pWalker, p->pOrderBy) ) return WRC_Abort; - if( sqlite3WalkExpr(pWalker, p->pLimit) ) return WRC_Abort; - if( sqlite3WalkExpr(pWalker, p->pOffset) ) return WRC_Abort; - return WRC_Continue; -} - -/* -** Walk the parse trees associated with all subqueries in the -** FROM clause of SELECT statement p. Do not invoke the select -** callback on p, but do invoke it on each FROM clause subquery -** and on any subqueries further down in the tree. Return -** WRC_Abort or WRC_Continue; -*/ -SQLITE_PRIVATE int sqlite3WalkSelectFrom(Walker *pWalker, Select *p){ - SrcList *pSrc; - int i; - struct SrcList_item *pItem; - - pSrc = p->pSrc; - if( ALWAYS(pSrc) ){ - for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){ - if( sqlite3WalkSelect(pWalker, pItem->pSelect) ){ - return WRC_Abort; - } - } - } - return WRC_Continue; -} - -/* -** Call sqlite3WalkExpr() for every expression in Select statement p. -** Invoke sqlite3WalkSelect() for subqueries in the FROM clause and -** on the compound select chain, p->pPrior. -** -** If it is not NULL, the xSelectCallback() callback is invoked before -** the walk of the expressions and FROM clause. The xSelectCallback2() -** method, if it is not NULL, is invoked following the walk of the -** expressions and FROM clause. -** -** Return WRC_Continue under normal conditions. Return WRC_Abort if -** there is an abort request. -** -** If the Walker does not have an xSelectCallback() then this routine -** is a no-op returning WRC_Continue. -*/ -SQLITE_PRIVATE int sqlite3WalkSelect(Walker *pWalker, Select *p){ - int rc; - if( p==0 || (pWalker->xSelectCallback==0 && pWalker->xSelectCallback2==0) ){ - return WRC_Continue; - } - rc = WRC_Continue; - pWalker->walkerDepth++; - while( p ){ - if( pWalker->xSelectCallback ){ - rc = pWalker->xSelectCallback(pWalker, p); - if( rc ) break; - } - if( sqlite3WalkSelectExpr(pWalker, p) - || sqlite3WalkSelectFrom(pWalker, p) - ){ - pWalker->walkerDepth--; - return WRC_Abort; - } - if( pWalker->xSelectCallback2 ){ - pWalker->xSelectCallback2(pWalker, p); - } - p = p->pPrior; - } - pWalker->walkerDepth--; - return rc & WRC_Abort; -} - -/************** End of walker.c **********************************************/ -/************** Begin file resolve.c *****************************************/ -/* -** 2008 August 18 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains routines used for walking the parser tree and -** resolve all identifiers by associating them with a particular -** table and column. -*/ -/* #include */ -/* #include */ - -/* -** Walk the expression tree pExpr and increase the aggregate function -** depth (the Expr.op2 field) by N on every TK_AGG_FUNCTION node. -** This needs to occur when copying a TK_AGG_FUNCTION node from an -** outer query into an inner subquery. -** -** incrAggFunctionDepth(pExpr,n) is the main routine. incrAggDepth(..) -** is a helper function - a callback for the tree walker. -*/ -static int incrAggDepth(Walker *pWalker, Expr *pExpr){ - if( pExpr->op==TK_AGG_FUNCTION ) pExpr->op2 += pWalker->u.i; - return WRC_Continue; -} -static void incrAggFunctionDepth(Expr *pExpr, int N){ - if( N>0 ){ - Walker w; - memset(&w, 0, sizeof(w)); - w.xExprCallback = incrAggDepth; - w.u.i = N; - sqlite3WalkExpr(&w, pExpr); - } -} - -/* -** Turn the pExpr expression into an alias for the iCol-th column of the -** result set in pEList. -** -** If the result set column is a simple column reference, then this routine -** makes an exact copy. But for any other kind of expression, this -** routine make a copy of the result set column as the argument to the -** TK_AS operator. The TK_AS operator causes the expression to be -** evaluated just once and then reused for each alias. -** -** The reason for suppressing the TK_AS term when the expression is a simple -** column reference is so that the column reference will be recognized as -** usable by indices within the WHERE clause processing logic. -** -** The TK_AS operator is inhibited if zType[0]=='G'. This means -** that in a GROUP BY clause, the expression is evaluated twice. Hence: -** -** SELECT random()%5 AS x, count(*) FROM tab GROUP BY x -** -** Is equivalent to: -** -** SELECT random()%5 AS x, count(*) FROM tab GROUP BY random()%5 -** -** The result of random()%5 in the GROUP BY clause is probably different -** from the result in the result-set. On the other hand Standard SQL does -** not allow the GROUP BY clause to contain references to result-set columns. -** So this should never come up in well-formed queries. -** -** If the reference is followed by a COLLATE operator, then make sure -** the COLLATE operator is preserved. For example: -** -** SELECT a+b, c+d FROM t1 ORDER BY 1 COLLATE nocase; -** -** Should be transformed into: -** -** SELECT a+b, c+d FROM t1 ORDER BY (a+b) COLLATE nocase; -** -** The nSubquery parameter specifies how many levels of subquery the -** alias is removed from the original expression. The usually value is -** zero but it might be more if the alias is contained within a subquery -** of the original expression. The Expr.op2 field of TK_AGG_FUNCTION -** structures must be increased by the nSubquery amount. -*/ -static void resolveAlias( - Parse *pParse, /* Parsing context */ - ExprList *pEList, /* A result set */ - int iCol, /* A column in the result set. 0..pEList->nExpr-1 */ - Expr *pExpr, /* Transform this into an alias to the result set */ - const char *zType, /* "GROUP" or "ORDER" or "" */ - int nSubquery /* Number of subqueries that the label is moving */ -){ - Expr *pOrig; /* The iCol-th column of the result set */ - Expr *pDup; /* Copy of pOrig */ - sqlite3 *db; /* The database connection */ - - assert( iCol>=0 && iColnExpr ); - pOrig = pEList->a[iCol].pExpr; - assert( pOrig!=0 ); - assert( pOrig->flags & EP_Resolved ); - db = pParse->db; - pDup = sqlite3ExprDup(db, pOrig, 0); - if( pDup==0 ) return; - if( pOrig->op!=TK_COLUMN && zType[0]!='G' ){ - incrAggFunctionDepth(pDup, nSubquery); - pDup = sqlite3PExpr(pParse, TK_AS, pDup, 0, 0); - if( pDup==0 ) return; - ExprSetProperty(pDup, EP_Skip); - if( pEList->a[iCol].u.x.iAlias==0 ){ - pEList->a[iCol].u.x.iAlias = (u16)(++pParse->nAlias); - } - pDup->iTable = pEList->a[iCol].u.x.iAlias; - } - if( pExpr->op==TK_COLLATE ){ - pDup = sqlite3ExprAddCollateString(pParse, pDup, pExpr->u.zToken); - } - - /* Before calling sqlite3ExprDelete(), set the EP_Static flag. This - ** prevents ExprDelete() from deleting the Expr structure itself, - ** allowing it to be repopulated by the memcpy() on the following line. - ** The pExpr->u.zToken might point into memory that will be freed by the - ** sqlite3DbFree(db, pDup) on the last line of this block, so be sure to - ** make a copy of the token before doing the sqlite3DbFree(). - */ - ExprSetProperty(pExpr, EP_Static); - sqlite3ExprDelete(db, pExpr); - memcpy(pExpr, pDup, sizeof(*pExpr)); - if( !ExprHasProperty(pExpr, EP_IntValue) && pExpr->u.zToken!=0 ){ - assert( (pExpr->flags & (EP_Reduced|EP_TokenOnly))==0 ); - pExpr->u.zToken = sqlite3DbStrDup(db, pExpr->u.zToken); - pExpr->flags |= EP_MemToken; - } - sqlite3DbFree(db, pDup); -} - - -/* -** Return TRUE if the name zCol occurs anywhere in the USING clause. -** -** Return FALSE if the USING clause is NULL or if it does not contain -** zCol. -*/ -static int nameInUsingClause(IdList *pUsing, const char *zCol){ - if( pUsing ){ - int k; - for(k=0; knId; k++){ - if( sqlite3StrICmp(pUsing->a[k].zName, zCol)==0 ) return 1; - } - } - return 0; -} - -/* -** Subqueries stores the original database, table and column names for their -** result sets in ExprList.a[].zSpan, in the form "DATABASE.TABLE.COLUMN". -** Check to see if the zSpan given to this routine matches the zDb, zTab, -** and zCol. If any of zDb, zTab, and zCol are NULL then those fields will -** match anything. -*/ -SQLITE_PRIVATE int sqlite3MatchSpanName( - const char *zSpan, - const char *zCol, - const char *zTab, - const char *zDb -){ - int n; - for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){} - if( zDb && (sqlite3StrNICmp(zSpan, zDb, n)!=0 || zDb[n]!=0) ){ - return 0; - } - zSpan += n+1; - for(n=0; ALWAYS(zSpan[n]) && zSpan[n]!='.'; n++){} - if( zTab && (sqlite3StrNICmp(zSpan, zTab, n)!=0 || zTab[n]!=0) ){ - return 0; - } - zSpan += n+1; - if( zCol && sqlite3StrICmp(zSpan, zCol)!=0 ){ - return 0; - } - return 1; -} - -/* -** Given the name of a column of the form X.Y.Z or Y.Z or just Z, look up -** that name in the set of source tables in pSrcList and make the pExpr -** expression node refer back to that source column. The following changes -** are made to pExpr: -** -** pExpr->iDb Set the index in db->aDb[] of the database X -** (even if X is implied). -** pExpr->iTable Set to the cursor number for the table obtained -** from pSrcList. -** pExpr->pTab Points to the Table structure of X.Y (even if -** X and/or Y are implied.) -** pExpr->iColumn Set to the column number within the table. -** pExpr->op Set to TK_COLUMN. -** pExpr->pLeft Any expression this points to is deleted -** pExpr->pRight Any expression this points to is deleted. -** -** The zDb variable is the name of the database (the "X"). This value may be -** NULL meaning that name is of the form Y.Z or Z. Any available database -** can be used. The zTable variable is the name of the table (the "Y"). This -** value can be NULL if zDb is also NULL. If zTable is NULL it -** means that the form of the name is Z and that columns from any table -** can be used. -** -** If the name cannot be resolved unambiguously, leave an error message -** in pParse and return WRC_Abort. Return WRC_Prune on success. -*/ -static int lookupName( - Parse *pParse, /* The parsing context */ - const char *zDb, /* Name of the database containing table, or NULL */ - const char *zTab, /* Name of table containing column, or NULL */ - const char *zCol, /* Name of the column. */ - NameContext *pNC, /* The name context used to resolve the name */ - Expr *pExpr /* Make this EXPR node point to the selected column */ -){ - int i, j; /* Loop counters */ - int cnt = 0; /* Number of matching column names */ - int cntTab = 0; /* Number of matching table names */ - int nSubquery = 0; /* How many levels of subquery */ - sqlite3 *db = pParse->db; /* The database connection */ - struct SrcList_item *pItem; /* Use for looping over pSrcList items */ - struct SrcList_item *pMatch = 0; /* The matching pSrcList item */ - NameContext *pTopNC = pNC; /* First namecontext in the list */ - Schema *pSchema = 0; /* Schema of the expression */ - int isTrigger = 0; /* True if resolved to a trigger column */ - Table *pTab = 0; /* Table hold the row */ - Column *pCol; /* A column of pTab */ - - assert( pNC ); /* the name context cannot be NULL. */ - assert( zCol ); /* The Z in X.Y.Z cannot be NULL */ - assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); - - /* Initialize the node to no-match */ - pExpr->iTable = -1; - pExpr->pTab = 0; - ExprSetVVAProperty(pExpr, EP_NoReduce); - - /* Translate the schema name in zDb into a pointer to the corresponding - ** schema. If not found, pSchema will remain NULL and nothing will match - ** resulting in an appropriate error message toward the end of this routine - */ - if( zDb ){ - testcase( pNC->ncFlags & NC_PartIdx ); - testcase( pNC->ncFlags & NC_IsCheck ); - if( (pNC->ncFlags & (NC_PartIdx|NC_IsCheck))!=0 ){ - /* Silently ignore database qualifiers inside CHECK constraints and partial - ** indices. Do not raise errors because that might break legacy and - ** because it does not hurt anything to just ignore the database name. */ - zDb = 0; - }else{ - for(i=0; inDb; i++){ - assert( db->aDb[i].zName ); - if( sqlite3StrICmp(db->aDb[i].zName,zDb)==0 ){ - pSchema = db->aDb[i].pSchema; - break; - } - } - } - } - - /* Start at the inner-most context and move outward until a match is found */ - while( pNC && cnt==0 ){ - ExprList *pEList; - SrcList *pSrcList = pNC->pSrcList; - - if( pSrcList ){ - for(i=0, pItem=pSrcList->a; inSrc; i++, pItem++){ - pTab = pItem->pTab; - assert( pTab!=0 && pTab->zName!=0 ); - assert( pTab->nCol>0 ); - if( pItem->pSelect && (pItem->pSelect->selFlags & SF_NestedFrom)!=0 ){ - int hit = 0; - pEList = pItem->pSelect->pEList; - for(j=0; jnExpr; j++){ - if( sqlite3MatchSpanName(pEList->a[j].zSpan, zCol, zTab, zDb) ){ - cnt++; - cntTab = 2; - pMatch = pItem; - pExpr->iColumn = j; - hit = 1; - } - } - if( hit || zTab==0 ) continue; - } - if( zDb && pTab->pSchema!=pSchema ){ - continue; - } - if( zTab ){ - const char *zTabName = pItem->zAlias ? pItem->zAlias : pTab->zName; - assert( zTabName!=0 ); - if( sqlite3StrICmp(zTabName, zTab)!=0 ){ - continue; - } - } - if( 0==(cntTab++) ){ - pMatch = pItem; - } - for(j=0, pCol=pTab->aCol; jnCol; j++, pCol++){ - if( sqlite3StrICmp(pCol->zName, zCol)==0 ){ - /* If there has been exactly one prior match and this match - ** is for the right-hand table of a NATURAL JOIN or is in a - ** USING clause, then skip this match. - */ - if( cnt==1 ){ - if( pItem->jointype & JT_NATURAL ) continue; - if( nameInUsingClause(pItem->pUsing, zCol) ) continue; - } - cnt++; - pMatch = pItem; - /* Substitute the rowid (column -1) for the INTEGER PRIMARY KEY */ - pExpr->iColumn = j==pTab->iPKey ? -1 : (i16)j; - break; - } - } - } - if( pMatch ){ - pExpr->iTable = pMatch->iCursor; - pExpr->pTab = pMatch->pTab; - pSchema = pExpr->pTab->pSchema; - } - } /* if( pSrcList ) */ - -#ifndef SQLITE_OMIT_TRIGGER - /* If we have not already resolved the name, then maybe - ** it is a new.* or old.* trigger argument reference - */ - if( zDb==0 && zTab!=0 && cntTab==0 && pParse->pTriggerTab!=0 ){ - int op = pParse->eTriggerOp; - assert( op==TK_DELETE || op==TK_UPDATE || op==TK_INSERT ); - if( op!=TK_DELETE && sqlite3StrICmp("new",zTab) == 0 ){ - pExpr->iTable = 1; - pTab = pParse->pTriggerTab; - }else if( op!=TK_INSERT && sqlite3StrICmp("old",zTab)==0 ){ - pExpr->iTable = 0; - pTab = pParse->pTriggerTab; - } - - if( pTab ){ - int iCol; - pSchema = pTab->pSchema; - cntTab++; - for(iCol=0, pCol=pTab->aCol; iColnCol; iCol++, pCol++){ - if( sqlite3StrICmp(pCol->zName, zCol)==0 ){ - if( iCol==pTab->iPKey ){ - iCol = -1; - } - break; - } - } - if( iCol>=pTab->nCol && sqlite3IsRowid(zCol) && HasRowid(pTab) ){ - /* IMP: R-24309-18625 */ - /* IMP: R-44911-55124 */ - iCol = -1; - } - if( iColnCol ){ - cnt++; - if( iCol<0 ){ - pExpr->affinity = SQLITE_AFF_INTEGER; - }else if( pExpr->iTable==0 ){ - testcase( iCol==31 ); - testcase( iCol==32 ); - pParse->oldmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<newmask |= (iCol>=32 ? 0xffffffff : (((u32)1)<iColumn = (i16)iCol; - pExpr->pTab = pTab; - isTrigger = 1; - } - } - } -#endif /* !defined(SQLITE_OMIT_TRIGGER) */ - - /* - ** Perhaps the name is a reference to the ROWID - */ - assert( pTab!=0 || cntTab==0 ); - if( cnt==0 && cntTab==1 && sqlite3IsRowid(zCol) && HasRowid(pTab) ){ - cnt = 1; - pExpr->iColumn = -1; /* IMP: R-44911-55124 */ - pExpr->affinity = SQLITE_AFF_INTEGER; - } - - /* - ** If the input is of the form Z (not Y.Z or X.Y.Z) then the name Z - ** might refer to an result-set alias. This happens, for example, when - ** we are resolving names in the WHERE clause of the following command: - ** - ** SELECT a+b AS x FROM table WHERE x<10; - ** - ** In cases like this, replace pExpr with a copy of the expression that - ** forms the result set entry ("a+b" in the example) and return immediately. - ** Note that the expression in the result set should have already been - ** resolved by the time the WHERE clause is resolved. - ** - ** The ability to use an output result-set column in the WHERE, GROUP BY, - ** or HAVING clauses, or as part of a larger expression in the ORDRE BY - ** clause is not standard SQL. This is a (goofy) SQLite extension, that - ** is supported for backwards compatibility only. TO DO: Issue a warning - ** on sqlite3_log() whenever the capability is used. - */ - if( (pEList = pNC->pEList)!=0 - && zTab==0 - && cnt==0 - ){ - for(j=0; jnExpr; j++){ - char *zAs = pEList->a[j].zName; - if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){ - Expr *pOrig; - assert( pExpr->pLeft==0 && pExpr->pRight==0 ); - assert( pExpr->x.pList==0 ); - assert( pExpr->x.pSelect==0 ); - pOrig = pEList->a[j].pExpr; - if( (pNC->ncFlags&NC_AllowAgg)==0 && ExprHasProperty(pOrig, EP_Agg) ){ - sqlite3ErrorMsg(pParse, "misuse of aliased aggregate %s", zAs); - return WRC_Abort; - } - resolveAlias(pParse, pEList, j, pExpr, "", nSubquery); - cnt = 1; - pMatch = 0; - assert( zTab==0 && zDb==0 ); - goto lookupname_end; - } - } - } - - /* Advance to the next name context. The loop will exit when either - ** we have a match (cnt>0) or when we run out of name contexts. - */ - if( cnt==0 ){ - pNC = pNC->pNext; - nSubquery++; - } - } - - /* - ** If X and Y are NULL (in other words if only the column name Z is - ** supplied) and the value of Z is enclosed in double-quotes, then - ** Z is a string literal if it doesn't match any column names. In that - ** case, we need to return right away and not make any changes to - ** pExpr. - ** - ** Because no reference was made to outer contexts, the pNC->nRef - ** fields are not changed in any context. - */ - if( cnt==0 && zTab==0 && ExprHasProperty(pExpr,EP_DblQuoted) ){ - pExpr->op = TK_STRING; - pExpr->pTab = 0; - return WRC_Prune; - } - - /* - ** cnt==0 means there was not match. cnt>1 means there were two or - ** more matches. Either way, we have an error. - */ - if( cnt!=1 ){ - const char *zErr; - zErr = cnt==0 ? "no such column" : "ambiguous column name"; - if( zDb ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s.%s", zErr, zDb, zTab, zCol); - }else if( zTab ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s", zErr, zTab, zCol); - }else{ - sqlite3ErrorMsg(pParse, "%s: %s", zErr, zCol); - } - pParse->checkSchema = 1; - pTopNC->nErr++; - } - - /* If a column from a table in pSrcList is referenced, then record - ** this fact in the pSrcList.a[].colUsed bitmask. Column 0 causes - ** bit 0 to be set. Column 1 sets bit 1. And so forth. If the - ** column number is greater than the number of bits in the bitmask - ** then set the high-order bit of the bitmask. - */ - if( pExpr->iColumn>=0 && pMatch!=0 ){ - int n = pExpr->iColumn; - testcase( n==BMS-1 ); - if( n>=BMS ){ - n = BMS-1; - } - assert( pMatch->iCursor==pExpr->iTable ); - pMatch->colUsed |= ((Bitmask)1)<pLeft); - pExpr->pLeft = 0; - sqlite3ExprDelete(db, pExpr->pRight); - pExpr->pRight = 0; - pExpr->op = (isTrigger ? TK_TRIGGER : TK_COLUMN); -lookupname_end: - if( cnt==1 ){ - assert( pNC!=0 ); - if( pExpr->op!=TK_AS ){ - sqlite3AuthRead(pParse, pExpr, pSchema, pNC->pSrcList); - } - /* Increment the nRef value on all name contexts from TopNC up to - ** the point where the name matched. */ - for(;;){ - assert( pTopNC!=0 ); - pTopNC->nRef++; - if( pTopNC==pNC ) break; - pTopNC = pTopNC->pNext; - } - return WRC_Prune; - } else { - return WRC_Abort; - } -} - -/* -** Allocate and return a pointer to an expression to load the column iCol -** from datasource iSrc in SrcList pSrc. -*/ -SQLITE_PRIVATE Expr *sqlite3CreateColumnExpr(sqlite3 *db, SrcList *pSrc, int iSrc, int iCol){ - Expr *p = sqlite3ExprAlloc(db, TK_COLUMN, 0, 0); - if( p ){ - struct SrcList_item *pItem = &pSrc->a[iSrc]; - p->pTab = pItem->pTab; - p->iTable = pItem->iCursor; - if( p->pTab->iPKey==iCol ){ - p->iColumn = -1; - }else{ - p->iColumn = (ynVar)iCol; - testcase( iCol==BMS ); - testcase( iCol==BMS-1 ); - pItem->colUsed |= ((Bitmask)1)<<(iCol>=BMS ? BMS-1 : iCol); - } - ExprSetProperty(p, EP_Resolved); - } - return p; -} - -/* -** Report an error that an expression is not valid for a partial index WHERE -** clause. -*/ -static void notValidPartIdxWhere( - Parse *pParse, /* Leave error message here */ - NameContext *pNC, /* The name context */ - const char *zMsg /* Type of error */ -){ - if( (pNC->ncFlags & NC_PartIdx)!=0 ){ - sqlite3ErrorMsg(pParse, "%s prohibited in partial index WHERE clauses", - zMsg); - } -} - -#ifndef SQLITE_OMIT_CHECK -/* -** Report an error that an expression is not valid for a CHECK constraint. -*/ -static void notValidCheckConstraint( - Parse *pParse, /* Leave error message here */ - NameContext *pNC, /* The name context */ - const char *zMsg /* Type of error */ -){ - if( (pNC->ncFlags & NC_IsCheck)!=0 ){ - sqlite3ErrorMsg(pParse,"%s prohibited in CHECK constraints", zMsg); - } -} -#else -# define notValidCheckConstraint(P,N,M) -#endif - -/* -** Expression p should encode a floating point value between 1.0 and 0.0. -** Return 1024 times this value. Or return -1 if p is not a floating point -** value between 1.0 and 0.0. -*/ -static int exprProbability(Expr *p){ - double r = -1.0; - if( p->op!=TK_FLOAT ) return -1; - sqlite3AtoF(p->u.zToken, &r, sqlite3Strlen30(p->u.zToken), SQLITE_UTF8); - assert( r>=0.0 ); - if( r>1.0 ) return -1; - return (int)(r*1000.0); -} - -/* -** This routine is callback for sqlite3WalkExpr(). -** -** Resolve symbolic names into TK_COLUMN operators for the current -** node in the expression tree. Return 0 to continue the search down -** the tree or 2 to abort the tree walk. -** -** This routine also does error checking and name resolution for -** function names. The operator for aggregate functions is changed -** to TK_AGG_FUNCTION. -*/ -static int resolveExprStep(Walker *pWalker, Expr *pExpr){ - NameContext *pNC; - Parse *pParse; - - pNC = pWalker->u.pNC; - assert( pNC!=0 ); - pParse = pNC->pParse; - assert( pParse==pWalker->pParse ); - - if( ExprHasProperty(pExpr, EP_Resolved) ) return WRC_Prune; - ExprSetProperty(pExpr, EP_Resolved); -#ifndef NDEBUG - if( pNC->pSrcList && pNC->pSrcList->nAlloc>0 ){ - SrcList *pSrcList = pNC->pSrcList; - int i; - for(i=0; ipSrcList->nSrc; i++){ - assert( pSrcList->a[i].iCursor>=0 && pSrcList->a[i].iCursornTab); - } - } -#endif - switch( pExpr->op ){ - -#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) - /* The special operator TK_ROW means use the rowid for the first - ** column in the FROM clause. This is used by the LIMIT and ORDER BY - ** clause processing on UPDATE and DELETE statements. - */ - case TK_ROW: { - SrcList *pSrcList = pNC->pSrcList; - struct SrcList_item *pItem; - assert( pSrcList && pSrcList->nSrc==1 ); - pItem = pSrcList->a; - pExpr->op = TK_COLUMN; - pExpr->pTab = pItem->pTab; - pExpr->iTable = pItem->iCursor; - pExpr->iColumn = -1; - pExpr->affinity = SQLITE_AFF_INTEGER; - break; - } -#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) */ - - /* A lone identifier is the name of a column. - */ - case TK_ID: { - return lookupName(pParse, 0, 0, pExpr->u.zToken, pNC, pExpr); - } - - /* A table name and column name: ID.ID - ** Or a database, table and column: ID.ID.ID - */ - case TK_DOT: { - const char *zColumn; - const char *zTable; - const char *zDb; - Expr *pRight; - - /* if( pSrcList==0 ) break; */ - pRight = pExpr->pRight; - if( pRight->op==TK_ID ){ - zDb = 0; - zTable = pExpr->pLeft->u.zToken; - zColumn = pRight->u.zToken; - }else{ - assert( pRight->op==TK_DOT ); - zDb = pExpr->pLeft->u.zToken; - zTable = pRight->pLeft->u.zToken; - zColumn = pRight->pRight->u.zToken; - } - return lookupName(pParse, zDb, zTable, zColumn, pNC, pExpr); - } - - /* Resolve function names - */ - case TK_FUNCTION: { - ExprList *pList = pExpr->x.pList; /* The argument list */ - int n = pList ? pList->nExpr : 0; /* Number of arguments */ - int no_such_func = 0; /* True if no such function exists */ - int wrong_num_args = 0; /* True if wrong number of arguments */ - int is_agg = 0; /* True if is an aggregate function */ - int auth; /* Authorization to use the function */ - int nId; /* Number of characters in function name */ - const char *zId; /* The function name. */ - FuncDef *pDef; /* Information about the function */ - u8 enc = ENC(pParse->db); /* The database encoding */ - - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); - notValidPartIdxWhere(pParse, pNC, "functions"); - zId = pExpr->u.zToken; - nId = sqlite3Strlen30(zId); - pDef = sqlite3FindFunction(pParse->db, zId, nId, n, enc, 0); - if( pDef==0 ){ - pDef = sqlite3FindFunction(pParse->db, zId, nId, -2, enc, 0); - if( pDef==0 ){ - no_such_func = 1; - }else{ - wrong_num_args = 1; - } - }else{ - is_agg = pDef->xFunc==0; - if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){ - ExprSetProperty(pExpr, EP_Unlikely|EP_Skip); - if( n==2 ){ - pExpr->iTable = exprProbability(pList->a[1].pExpr); - if( pExpr->iTable<0 ){ - sqlite3ErrorMsg(pParse, "second argument to likelihood() must be a " - "constant between 0.0 and 1.0"); - pNC->nErr++; - } - }else{ - /* EVIDENCE-OF: R-61304-29449 The unlikely(X) function is equivalent to - ** likelihood(X, 0.0625). - ** EVIDENCE-OF: R-01283-11636 The unlikely(X) function is short-hand for - ** likelihood(X,0.0625). */ - pExpr->iTable = 62; /* TUNING: Default 2nd arg to unlikely() is 0.0625 */ - } - } - } -#ifndef SQLITE_OMIT_AUTHORIZATION - if( pDef ){ - auth = sqlite3AuthCheck(pParse, SQLITE_FUNCTION, 0, pDef->zName, 0); - if( auth!=SQLITE_OK ){ - if( auth==SQLITE_DENY ){ - sqlite3ErrorMsg(pParse, "not authorized to use function: %s", - pDef->zName); - pNC->nErr++; - } - pExpr->op = TK_NULL; - return WRC_Prune; - } - if( pDef->funcFlags & SQLITE_FUNC_CONSTANT ) ExprSetProperty(pExpr,EP_Constant); - } -#endif - if( is_agg && (pNC->ncFlags & NC_AllowAgg)==0 ){ - sqlite3ErrorMsg(pParse, "misuse of aggregate function %.*s()", nId,zId); - pNC->nErr++; - is_agg = 0; - }else if( no_such_func && pParse->db->init.busy==0 ){ - sqlite3ErrorMsg(pParse, "no such function: %.*s", nId, zId); - pNC->nErr++; - }else if( wrong_num_args ){ - sqlite3ErrorMsg(pParse,"wrong number of arguments to function %.*s()", - nId, zId); - pNC->nErr++; - } - if( is_agg ) pNC->ncFlags &= ~NC_AllowAgg; - sqlite3WalkExprList(pWalker, pList); - if( is_agg ){ - NameContext *pNC2 = pNC; - pExpr->op = TK_AGG_FUNCTION; - pExpr->op2 = 0; - while( pNC2 && !sqlite3FunctionUsesThisSrc(pExpr, pNC2->pSrcList) ){ - pExpr->op2++; - pNC2 = pNC2->pNext; - } - if( pNC2 ) pNC2->ncFlags |= NC_HasAgg; - pNC->ncFlags |= NC_AllowAgg; - } - /* FIX ME: Compute pExpr->affinity based on the expected return - ** type of the function - */ - return WRC_Prune; - } -#ifndef SQLITE_OMIT_SUBQUERY - case TK_SELECT: - case TK_EXISTS: testcase( pExpr->op==TK_EXISTS ); -#endif - case TK_IN: { - testcase( pExpr->op==TK_IN ); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - int nRef = pNC->nRef; - notValidCheckConstraint(pParse, pNC, "subqueries"); - notValidPartIdxWhere(pParse, pNC, "subqueries"); - sqlite3WalkSelect(pWalker, pExpr->x.pSelect); - assert( pNC->nRef>=nRef ); - if( nRef!=pNC->nRef ){ - ExprSetProperty(pExpr, EP_VarSelect); - } - } - break; - } - case TK_VARIABLE: { - notValidCheckConstraint(pParse, pNC, "parameters"); - notValidPartIdxWhere(pParse, pNC, "parameters"); - break; - } - } - return (pParse->nErr || pParse->db->mallocFailed) ? WRC_Abort : WRC_Continue; -} - -/* -** pEList is a list of expressions which are really the result set of the -** a SELECT statement. pE is a term in an ORDER BY or GROUP BY clause. -** This routine checks to see if pE is a simple identifier which corresponds -** to the AS-name of one of the terms of the expression list. If it is, -** this routine return an integer between 1 and N where N is the number of -** elements in pEList, corresponding to the matching entry. If there is -** no match, or if pE is not a simple identifier, then this routine -** return 0. -** -** pEList has been resolved. pE has not. -*/ -static int resolveAsName( - Parse *pParse, /* Parsing context for error messages */ - ExprList *pEList, /* List of expressions to scan */ - Expr *pE /* Expression we are trying to match */ -){ - int i; /* Loop counter */ - - UNUSED_PARAMETER(pParse); - - if( pE->op==TK_ID ){ - char *zCol = pE->u.zToken; - for(i=0; inExpr; i++){ - char *zAs = pEList->a[i].zName; - if( zAs!=0 && sqlite3StrICmp(zAs, zCol)==0 ){ - return i+1; - } - } - } - return 0; -} - -/* -** pE is a pointer to an expression which is a single term in the -** ORDER BY of a compound SELECT. The expression has not been -** name resolved. -** -** At the point this routine is called, we already know that the -** ORDER BY term is not an integer index into the result set. That -** case is handled by the calling routine. -** -** Attempt to match pE against result set columns in the left-most -** SELECT statement. Return the index i of the matching column, -** as an indication to the caller that it should sort by the i-th column. -** The left-most column is 1. In other words, the value returned is the -** same integer value that would be used in the SQL statement to indicate -** the column. -** -** If there is no match, return 0. Return -1 if an error occurs. -*/ -static int resolveOrderByTermToExprList( - Parse *pParse, /* Parsing context for error messages */ - Select *pSelect, /* The SELECT statement with the ORDER BY clause */ - Expr *pE /* The specific ORDER BY term */ -){ - int i; /* Loop counter */ - ExprList *pEList; /* The columns of the result set */ - NameContext nc; /* Name context for resolving pE */ - sqlite3 *db; /* Database connection */ - int rc; /* Return code from subprocedures */ - u8 savedSuppErr; /* Saved value of db->suppressErr */ - - assert( sqlite3ExprIsInteger(pE, &i)==0 ); - pEList = pSelect->pEList; - - /* Resolve all names in the ORDER BY term expression - */ - memset(&nc, 0, sizeof(nc)); - nc.pParse = pParse; - nc.pSrcList = pSelect->pSrc; - nc.pEList = pEList; - nc.ncFlags = NC_AllowAgg; - nc.nErr = 0; - db = pParse->db; - savedSuppErr = db->suppressErr; - db->suppressErr = 1; - rc = sqlite3ResolveExprNames(&nc, pE); - db->suppressErr = savedSuppErr; - if( rc ) return 0; - - /* Try to match the ORDER BY expression against an expression - ** in the result set. Return an 1-based index of the matching - ** result-set entry. - */ - for(i=0; inExpr; i++){ - if( sqlite3ExprCompare(pEList->a[i].pExpr, pE, -1)<2 ){ - return i+1; - } - } - - /* If no match, return 0. */ - return 0; -} - -/* -** Generate an ORDER BY or GROUP BY term out-of-range error. -*/ -static void resolveOutOfRangeError( - Parse *pParse, /* The error context into which to write the error */ - const char *zType, /* "ORDER" or "GROUP" */ - int i, /* The index (1-based) of the term out of range */ - int mx /* Largest permissible value of i */ -){ - sqlite3ErrorMsg(pParse, - "%r %s BY term out of range - should be " - "between 1 and %d", i, zType, mx); -} - -/* -** Analyze the ORDER BY clause in a compound SELECT statement. Modify -** each term of the ORDER BY clause is a constant integer between 1 -** and N where N is the number of columns in the compound SELECT. -** -** ORDER BY terms that are already an integer between 1 and N are -** unmodified. ORDER BY terms that are integers outside the range of -** 1 through N generate an error. ORDER BY terms that are expressions -** are matched against result set expressions of compound SELECT -** beginning with the left-most SELECT and working toward the right. -** At the first match, the ORDER BY expression is transformed into -** the integer column number. -** -** Return the number of errors seen. -*/ -static int resolveCompoundOrderBy( - Parse *pParse, /* Parsing context. Leave error messages here */ - Select *pSelect /* The SELECT statement containing the ORDER BY */ -){ - int i; - ExprList *pOrderBy; - ExprList *pEList; - sqlite3 *db; - int moreToDo = 1; - - pOrderBy = pSelect->pOrderBy; - if( pOrderBy==0 ) return 0; - db = pParse->db; -#if SQLITE_MAX_COLUMN - if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many terms in ORDER BY clause"); - return 1; - } -#endif - for(i=0; inExpr; i++){ - pOrderBy->a[i].done = 0; - } - pSelect->pNext = 0; - while( pSelect->pPrior ){ - pSelect->pPrior->pNext = pSelect; - pSelect = pSelect->pPrior; - } - while( pSelect && moreToDo ){ - struct ExprList_item *pItem; - moreToDo = 0; - pEList = pSelect->pEList; - assert( pEList!=0 ); - for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){ - int iCol = -1; - Expr *pE, *pDup; - if( pItem->done ) continue; - pE = sqlite3ExprSkipCollate(pItem->pExpr); - if( sqlite3ExprIsInteger(pE, &iCol) ){ - if( iCol<=0 || iCol>pEList->nExpr ){ - resolveOutOfRangeError(pParse, "ORDER", i+1, pEList->nExpr); - return 1; - } - }else{ - iCol = resolveAsName(pParse, pEList, pE); - if( iCol==0 ){ - pDup = sqlite3ExprDup(db, pE, 0); - if( !db->mallocFailed ){ - assert(pDup); - iCol = resolveOrderByTermToExprList(pParse, pSelect, pDup); - } - sqlite3ExprDelete(db, pDup); - } - } - if( iCol>0 ){ - /* Convert the ORDER BY term into an integer column number iCol, - ** taking care to preserve the COLLATE clause if it exists */ - Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0); - if( pNew==0 ) return 1; - pNew->flags |= EP_IntValue; - pNew->u.iValue = iCol; - if( pItem->pExpr==pE ){ - pItem->pExpr = pNew; - }else{ - assert( pItem->pExpr->op==TK_COLLATE ); - assert( pItem->pExpr->pLeft==pE ); - pItem->pExpr->pLeft = pNew; - } - sqlite3ExprDelete(db, pE); - pItem->u.x.iOrderByCol = (u16)iCol; - pItem->done = 1; - }else{ - moreToDo = 1; - } - } - pSelect = pSelect->pNext; - } - for(i=0; inExpr; i++){ - if( pOrderBy->a[i].done==0 ){ - sqlite3ErrorMsg(pParse, "%r ORDER BY term does not match any " - "column in the result set", i+1); - return 1; - } - } - return 0; -} - -/* -** Check every term in the ORDER BY or GROUP BY clause pOrderBy of -** the SELECT statement pSelect. If any term is reference to a -** result set expression (as determined by the ExprList.a.u.x.iOrderByCol -** field) then convert that term into a copy of the corresponding result set -** column. -** -** If any errors are detected, add an error message to pParse and -** return non-zero. Return zero if no errors are seen. -*/ -SQLITE_PRIVATE int sqlite3ResolveOrderGroupBy( - Parse *pParse, /* Parsing context. Leave error messages here */ - Select *pSelect, /* The SELECT statement containing the clause */ - ExprList *pOrderBy, /* The ORDER BY or GROUP BY clause to be processed */ - const char *zType /* "ORDER" or "GROUP" */ -){ - int i; - sqlite3 *db = pParse->db; - ExprList *pEList; - struct ExprList_item *pItem; - - if( pOrderBy==0 || pParse->db->mallocFailed ) return 0; -#if SQLITE_MAX_COLUMN - if( pOrderBy->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many terms in %s BY clause", zType); - return 1; - } -#endif - pEList = pSelect->pEList; - assert( pEList!=0 ); /* sqlite3SelectNew() guarantees this */ - for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){ - if( pItem->u.x.iOrderByCol ){ - if( pItem->u.x.iOrderByCol>pEList->nExpr ){ - resolveOutOfRangeError(pParse, zType, i+1, pEList->nExpr); - return 1; - } - resolveAlias(pParse, pEList, pItem->u.x.iOrderByCol-1, pItem->pExpr, zType,0); - } - } - return 0; -} - -/* -** pOrderBy is an ORDER BY or GROUP BY clause in SELECT statement pSelect. -** The Name context of the SELECT statement is pNC. zType is either -** "ORDER" or "GROUP" depending on which type of clause pOrderBy is. -** -** This routine resolves each term of the clause into an expression. -** If the order-by term is an integer I between 1 and N (where N is the -** number of columns in the result set of the SELECT) then the expression -** in the resolution is a copy of the I-th result-set expression. If -** the order-by term is an identifier that corresponds to the AS-name of -** a result-set expression, then the term resolves to a copy of the -** result-set expression. Otherwise, the expression is resolved in -** the usual way - using sqlite3ResolveExprNames(). -** -** This routine returns the number of errors. If errors occur, then -** an appropriate error message might be left in pParse. (OOM errors -** excepted.) -*/ -static int resolveOrderGroupBy( - NameContext *pNC, /* The name context of the SELECT statement */ - Select *pSelect, /* The SELECT statement holding pOrderBy */ - ExprList *pOrderBy, /* An ORDER BY or GROUP BY clause to resolve */ - const char *zType /* Either "ORDER" or "GROUP", as appropriate */ -){ - int i, j; /* Loop counters */ - int iCol; /* Column number */ - struct ExprList_item *pItem; /* A term of the ORDER BY clause */ - Parse *pParse; /* Parsing context */ - int nResult; /* Number of terms in the result set */ - - if( pOrderBy==0 ) return 0; - nResult = pSelect->pEList->nExpr; - pParse = pNC->pParse; - for(i=0, pItem=pOrderBy->a; inExpr; i++, pItem++){ - Expr *pE = pItem->pExpr; - Expr *pE2 = sqlite3ExprSkipCollate(pE); - if( zType[0]!='G' ){ - iCol = resolveAsName(pParse, pSelect->pEList, pE2); - if( iCol>0 ){ - /* If an AS-name match is found, mark this ORDER BY column as being - ** a copy of the iCol-th result-set column. The subsequent call to - ** sqlite3ResolveOrderGroupBy() will convert the expression to a - ** copy of the iCol-th result-set expression. */ - pItem->u.x.iOrderByCol = (u16)iCol; - continue; - } - } - if( sqlite3ExprIsInteger(pE2, &iCol) ){ - /* The ORDER BY term is an integer constant. Again, set the column - ** number so that sqlite3ResolveOrderGroupBy() will convert the - ** order-by term to a copy of the result-set expression */ - if( iCol<1 || iCol>0xffff ){ - resolveOutOfRangeError(pParse, zType, i+1, nResult); - return 1; - } - pItem->u.x.iOrderByCol = (u16)iCol; - continue; - } - - /* Otherwise, treat the ORDER BY term as an ordinary expression */ - pItem->u.x.iOrderByCol = 0; - if( sqlite3ResolveExprNames(pNC, pE) ){ - return 1; - } - for(j=0; jpEList->nExpr; j++){ - if( sqlite3ExprCompare(pE, pSelect->pEList->a[j].pExpr, -1)==0 ){ - pItem->u.x.iOrderByCol = j+1; - } - } - } - return sqlite3ResolveOrderGroupBy(pParse, pSelect, pOrderBy, zType); -} - -/* -** Resolve names in the SELECT statement p and all of its descendents. -*/ -static int resolveSelectStep(Walker *pWalker, Select *p){ - NameContext *pOuterNC; /* Context that contains this SELECT */ - NameContext sNC; /* Name context of this SELECT */ - int isCompound; /* True if p is a compound select */ - int nCompound; /* Number of compound terms processed so far */ - Parse *pParse; /* Parsing context */ - ExprList *pEList; /* Result set expression list */ - int i; /* Loop counter */ - ExprList *pGroupBy; /* The GROUP BY clause */ - Select *pLeftmost; /* Left-most of SELECT of a compound */ - sqlite3 *db; /* Database connection */ - - - assert( p!=0 ); - if( p->selFlags & SF_Resolved ){ - return WRC_Prune; - } - pOuterNC = pWalker->u.pNC; - pParse = pWalker->pParse; - db = pParse->db; - - /* Normally sqlite3SelectExpand() will be called first and will have - ** already expanded this SELECT. However, if this is a subquery within - ** an expression, sqlite3ResolveExprNames() will be called without a - ** prior call to sqlite3SelectExpand(). When that happens, let - ** sqlite3SelectPrep() do all of the processing for this SELECT. - ** sqlite3SelectPrep() will invoke both sqlite3SelectExpand() and - ** this routine in the correct order. - */ - if( (p->selFlags & SF_Expanded)==0 ){ - sqlite3SelectPrep(pParse, p, pOuterNC); - return (pParse->nErr || db->mallocFailed) ? WRC_Abort : WRC_Prune; - } - - isCompound = p->pPrior!=0; - nCompound = 0; - pLeftmost = p; - while( p ){ - assert( (p->selFlags & SF_Expanded)!=0 ); - assert( (p->selFlags & SF_Resolved)==0 ); - p->selFlags |= SF_Resolved; - - /* Resolve the expressions in the LIMIT and OFFSET clauses. These - ** are not allowed to refer to any names, so pass an empty NameContext. - */ - memset(&sNC, 0, sizeof(sNC)); - sNC.pParse = pParse; - if( sqlite3ResolveExprNames(&sNC, p->pLimit) || - sqlite3ResolveExprNames(&sNC, p->pOffset) ){ - return WRC_Abort; - } - - /* Recursively resolve names in all subqueries - */ - for(i=0; ipSrc->nSrc; i++){ - struct SrcList_item *pItem = &p->pSrc->a[i]; - if( pItem->pSelect ){ - NameContext *pNC; /* Used to iterate name contexts */ - int nRef = 0; /* Refcount for pOuterNC and outer contexts */ - const char *zSavedContext = pParse->zAuthContext; - - /* Count the total number of references to pOuterNC and all of its - ** parent contexts. After resolving references to expressions in - ** pItem->pSelect, check if this value has changed. If so, then - ** SELECT statement pItem->pSelect must be correlated. Set the - ** pItem->isCorrelated flag if this is the case. */ - for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef += pNC->nRef; - - if( pItem->zName ) pParse->zAuthContext = pItem->zName; - sqlite3ResolveSelectNames(pParse, pItem->pSelect, pOuterNC); - pParse->zAuthContext = zSavedContext; - if( pParse->nErr || db->mallocFailed ) return WRC_Abort; - - for(pNC=pOuterNC; pNC; pNC=pNC->pNext) nRef -= pNC->nRef; - assert( pItem->isCorrelated==0 && nRef<=0 ); - pItem->isCorrelated = (nRef!=0); - } - } - - /* Set up the local name-context to pass to sqlite3ResolveExprNames() to - ** resolve the result-set expression list. - */ - sNC.ncFlags = NC_AllowAgg; - sNC.pSrcList = p->pSrc; - sNC.pNext = pOuterNC; - - /* Resolve names in the result set. */ - pEList = p->pEList; - assert( pEList!=0 ); - for(i=0; inExpr; i++){ - Expr *pX = pEList->a[i].pExpr; - if( sqlite3ResolveExprNames(&sNC, pX) ){ - return WRC_Abort; - } - } - - /* If there are no aggregate functions in the result-set, and no GROUP BY - ** expression, do not allow aggregates in any of the other expressions. - */ - assert( (p->selFlags & SF_Aggregate)==0 ); - pGroupBy = p->pGroupBy; - if( pGroupBy || (sNC.ncFlags & NC_HasAgg)!=0 ){ - p->selFlags |= SF_Aggregate; - }else{ - sNC.ncFlags &= ~NC_AllowAgg; - } - - /* If a HAVING clause is present, then there must be a GROUP BY clause. - */ - if( p->pHaving && !pGroupBy ){ - sqlite3ErrorMsg(pParse, "a GROUP BY clause is required before HAVING"); - return WRC_Abort; - } - - /* Add the output column list to the name-context before parsing the - ** other expressions in the SELECT statement. This is so that - ** expressions in the WHERE clause (etc.) can refer to expressions by - ** aliases in the result set. - ** - ** Minor point: If this is the case, then the expression will be - ** re-evaluated for each reference to it. - */ - sNC.pEList = p->pEList; - if( sqlite3ResolveExprNames(&sNC, p->pHaving) ) return WRC_Abort; - if( sqlite3ResolveExprNames(&sNC, p->pWhere) ) return WRC_Abort; - - /* The ORDER BY and GROUP BY clauses may not refer to terms in - ** outer queries - */ - sNC.pNext = 0; - sNC.ncFlags |= NC_AllowAgg; - - /* Process the ORDER BY clause for singleton SELECT statements. - ** The ORDER BY clause for compounds SELECT statements is handled - ** below, after all of the result-sets for all of the elements of - ** the compound have been resolved. - */ - if( !isCompound && resolveOrderGroupBy(&sNC, p, p->pOrderBy, "ORDER") ){ - return WRC_Abort; - } - if( db->mallocFailed ){ - return WRC_Abort; - } - - /* Resolve the GROUP BY clause. At the same time, make sure - ** the GROUP BY clause does not contain aggregate functions. - */ - if( pGroupBy ){ - struct ExprList_item *pItem; - - if( resolveOrderGroupBy(&sNC, p, pGroupBy, "GROUP") || db->mallocFailed ){ - return WRC_Abort; - } - for(i=0, pItem=pGroupBy->a; inExpr; i++, pItem++){ - if( ExprHasProperty(pItem->pExpr, EP_Agg) ){ - sqlite3ErrorMsg(pParse, "aggregate functions are not allowed in " - "the GROUP BY clause"); - return WRC_Abort; - } - } - } - - /* Advance to the next term of the compound - */ - p = p->pPrior; - nCompound++; - } - - /* Resolve the ORDER BY on a compound SELECT after all terms of - ** the compound have been resolved. - */ - if( isCompound && resolveCompoundOrderBy(pParse, pLeftmost) ){ - return WRC_Abort; - } - - return WRC_Prune; -} - -/* -** This routine walks an expression tree and resolves references to -** table columns and result-set columns. At the same time, do error -** checking on function usage and set a flag if any aggregate functions -** are seen. -** -** To resolve table columns references we look for nodes (or subtrees) of the -** form X.Y.Z or Y.Z or just Z where -** -** X: The name of a database. Ex: "main" or "temp" or -** the symbolic name assigned to an ATTACH-ed database. -** -** Y: The name of a table in a FROM clause. Or in a trigger -** one of the special names "old" or "new". -** -** Z: The name of a column in table Y. -** -** The node at the root of the subtree is modified as follows: -** -** Expr.op Changed to TK_COLUMN -** Expr.pTab Points to the Table object for X.Y -** Expr.iColumn The column index in X.Y. -1 for the rowid. -** Expr.iTable The VDBE cursor number for X.Y -** -** -** To resolve result-set references, look for expression nodes of the -** form Z (with no X and Y prefix) where the Z matches the right-hand -** size of an AS clause in the result-set of a SELECT. The Z expression -** is replaced by a copy of the left-hand side of the result-set expression. -** Table-name and function resolution occurs on the substituted expression -** tree. For example, in: -** -** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY x; -** -** The "x" term of the order by is replaced by "a+b" to render: -** -** SELECT a+b AS x, c+d AS y FROM t1 ORDER BY a+b; -** -** Function calls are checked to make sure that the function is -** defined and that the correct number of arguments are specified. -** If the function is an aggregate function, then the NC_HasAgg flag is -** set and the opcode is changed from TK_FUNCTION to TK_AGG_FUNCTION. -** If an expression contains aggregate functions then the EP_Agg -** property on the expression is set. -** -** An error message is left in pParse if anything is amiss. The number -** if errors is returned. -*/ -SQLITE_PRIVATE int sqlite3ResolveExprNames( - NameContext *pNC, /* Namespace to resolve expressions in. */ - Expr *pExpr /* The expression to be analyzed. */ -){ - u8 savedHasAgg; - Walker w; - - if( pExpr==0 ) return 0; -#if SQLITE_MAX_EXPR_DEPTH>0 - { - Parse *pParse = pNC->pParse; - if( sqlite3ExprCheckHeight(pParse, pExpr->nHeight+pNC->pParse->nHeight) ){ - return 1; - } - pParse->nHeight += pExpr->nHeight; - } -#endif - savedHasAgg = pNC->ncFlags & NC_HasAgg; - pNC->ncFlags &= ~NC_HasAgg; - memset(&w, 0, sizeof(w)); - w.xExprCallback = resolveExprStep; - w.xSelectCallback = resolveSelectStep; - w.pParse = pNC->pParse; - w.u.pNC = pNC; - sqlite3WalkExpr(&w, pExpr); -#if SQLITE_MAX_EXPR_DEPTH>0 - pNC->pParse->nHeight -= pExpr->nHeight; -#endif - if( pNC->nErr>0 || w.pParse->nErr>0 ){ - ExprSetProperty(pExpr, EP_Error); - } - if( pNC->ncFlags & NC_HasAgg ){ - ExprSetProperty(pExpr, EP_Agg); - }else if( savedHasAgg ){ - pNC->ncFlags |= NC_HasAgg; - } - return ExprHasProperty(pExpr, EP_Error); -} - - -/* -** Resolve all names in all expressions of a SELECT and in all -** decendents of the SELECT, including compounds off of p->pPrior, -** subqueries in expressions, and subqueries used as FROM clause -** terms. -** -** See sqlite3ResolveExprNames() for a description of the kinds of -** transformations that occur. -** -** All SELECT statements should have been expanded using -** sqlite3SelectExpand() prior to invoking this routine. -*/ -SQLITE_PRIVATE void sqlite3ResolveSelectNames( - Parse *pParse, /* The parser context */ - Select *p, /* The SELECT statement being coded. */ - NameContext *pOuterNC /* Name context for parent SELECT statement */ -){ - Walker w; - - assert( p!=0 ); - memset(&w, 0, sizeof(w)); - w.xExprCallback = resolveExprStep; - w.xSelectCallback = resolveSelectStep; - w.pParse = pParse; - w.u.pNC = pOuterNC; - sqlite3WalkSelect(&w, p); -} - -/* -** Resolve names in expressions that can only reference a single table: -** -** * CHECK constraints -** * WHERE clauses on partial indices -** -** The Expr.iTable value for Expr.op==TK_COLUMN nodes of the expression -** is set to -1 and the Expr.iColumn value is set to the column number. -** -** Any errors cause an error message to be set in pParse. -*/ -SQLITE_PRIVATE void sqlite3ResolveSelfReference( - Parse *pParse, /* Parsing context */ - Table *pTab, /* The table being referenced */ - int type, /* NC_IsCheck or NC_PartIdx */ - Expr *pExpr, /* Expression to resolve. May be NULL. */ - ExprList *pList /* Expression list to resolve. May be NUL. */ -){ - SrcList sSrc; /* Fake SrcList for pParse->pNewTable */ - NameContext sNC; /* Name context for pParse->pNewTable */ - int i; /* Loop counter */ - - assert( type==NC_IsCheck || type==NC_PartIdx ); - memset(&sNC, 0, sizeof(sNC)); - memset(&sSrc, 0, sizeof(sSrc)); - sSrc.nSrc = 1; - sSrc.a[0].zName = pTab->zName; - sSrc.a[0].pTab = pTab; - sSrc.a[0].iCursor = -1; - sNC.pParse = pParse; - sNC.pSrcList = &sSrc; - sNC.ncFlags = type; - if( sqlite3ResolveExprNames(&sNC, pExpr) ) return; - if( pList ){ - for(i=0; inExpr; i++){ - if( sqlite3ResolveExprNames(&sNC, pList->a[i].pExpr) ){ - return; - } - } - } -} - -/************** End of resolve.c *********************************************/ -/************** Begin file expr.c ********************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains routines used for analyzing expressions and -** for generating VDBE code that evaluates expressions in SQLite. -*/ - -/* -** Return the 'affinity' of the expression pExpr if any. -** -** If pExpr is a column, a reference to a column via an 'AS' alias, -** or a sub-select with a column as the return value, then the -** affinity of that column is returned. Otherwise, 0x00 is returned, -** indicating no affinity for the expression. -** -** i.e. the WHERE clause expresssions in the following statements all -** have an affinity: -** -** CREATE TABLE t1(a); -** SELECT * FROM t1 WHERE a; -** SELECT a AS b FROM t1 WHERE b; -** SELECT * FROM t1 WHERE (select a from t1); -*/ -SQLITE_PRIVATE char sqlite3ExprAffinity(Expr *pExpr){ - int op; - pExpr = sqlite3ExprSkipCollate(pExpr); - op = pExpr->op; - if( op==TK_SELECT ){ - assert( pExpr->flags&EP_xIsSelect ); - return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr); - } -#ifndef SQLITE_OMIT_CAST - if( op==TK_CAST ){ - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - return sqlite3AffinityType(pExpr->u.zToken, 0); - } -#endif - if( (op==TK_AGG_COLUMN || op==TK_COLUMN || op==TK_REGISTER) - && pExpr->pTab!=0 - ){ - /* op==TK_REGISTER && pExpr->pTab!=0 happens when pExpr was originally - ** a TK_COLUMN but was previously evaluated and cached in a register */ - int j = pExpr->iColumn; - if( j<0 ) return SQLITE_AFF_INTEGER; - assert( pExpr->pTab && jpTab->nCol ); - return pExpr->pTab->aCol[j].affinity; - } - return pExpr->affinity; -} - -/* -** Set the collating sequence for expression pExpr to be the collating -** sequence named by pToken. Return a pointer to a new Expr node that -** implements the COLLATE operator. -** -** If a memory allocation error occurs, that fact is recorded in pParse->db -** and the pExpr parameter is returned unchanged. -*/ -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateToken(Parse *pParse, Expr *pExpr, Token *pCollName){ - if( pCollName->n>0 ){ - Expr *pNew = sqlite3ExprAlloc(pParse->db, TK_COLLATE, pCollName, 1); - if( pNew ){ - pNew->pLeft = pExpr; - pNew->flags |= EP_Collate|EP_Skip; - pExpr = pNew; - } - } - return pExpr; -} -SQLITE_PRIVATE Expr *sqlite3ExprAddCollateString(Parse *pParse, Expr *pExpr, const char *zC){ - Token s; - assert( zC!=0 ); - s.z = zC; - s.n = sqlite3Strlen30(s.z); - return sqlite3ExprAddCollateToken(pParse, pExpr, &s); -} - -/* -** Skip over any TK_COLLATE or TK_AS operators and any unlikely() -** or likelihood() function at the root of an expression. -*/ -SQLITE_PRIVATE Expr *sqlite3ExprSkipCollate(Expr *pExpr){ - while( pExpr && ExprHasProperty(pExpr, EP_Skip) ){ - if( ExprHasProperty(pExpr, EP_Unlikely) ){ - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); - assert( pExpr->x.pList->nExpr>0 ); - assert( pExpr->op==TK_FUNCTION ); - pExpr = pExpr->x.pList->a[0].pExpr; - }else{ - assert( pExpr->op==TK_COLLATE || pExpr->op==TK_AS ); - pExpr = pExpr->pLeft; - } - } - return pExpr; -} - -/* -** Return the collation sequence for the expression pExpr. If -** there is no defined collating sequence, return NULL. -** -** The collating sequence might be determined by a COLLATE operator -** or by the presence of a column with a defined collating sequence. -** COLLATE operators take first precedence. Left operands take -** precedence over right operands. -*/ -SQLITE_PRIVATE CollSeq *sqlite3ExprCollSeq(Parse *pParse, Expr *pExpr){ - sqlite3 *db = pParse->db; - CollSeq *pColl = 0; - Expr *p = pExpr; - while( p ){ - int op = p->op; - if( op==TK_CAST || op==TK_UPLUS ){ - p = p->pLeft; - continue; - } - if( op==TK_COLLATE || (op==TK_REGISTER && p->op2==TK_COLLATE) ){ - pColl = sqlite3GetCollSeq(pParse, ENC(db), 0, p->u.zToken); - break; - } - if( p->pTab!=0 - && (op==TK_AGG_COLUMN || op==TK_COLUMN - || op==TK_REGISTER || op==TK_TRIGGER) - ){ - /* op==TK_REGISTER && p->pTab!=0 happens when pExpr was originally - ** a TK_COLUMN but was previously evaluated and cached in a register */ - int j = p->iColumn; - if( j>=0 ){ - const char *zColl = p->pTab->aCol[j].zColl; - pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0); - } - break; - } - if( p->flags & EP_Collate ){ - if( ALWAYS(p->pLeft) && (p->pLeft->flags & EP_Collate)!=0 ){ - p = p->pLeft; - }else{ - p = p->pRight; - } - }else{ - break; - } - } - if( sqlite3CheckCollSeq(pParse, pColl) ){ - pColl = 0; - } - return pColl; -} - -/* -** pExpr is an operand of a comparison operator. aff2 is the -** type affinity of the other operand. This routine returns the -** type affinity that should be used for the comparison operator. -*/ -SQLITE_PRIVATE char sqlite3CompareAffinity(Expr *pExpr, char aff2){ - char aff1 = sqlite3ExprAffinity(pExpr); - if( aff1 && aff2 ){ - /* Both sides of the comparison are columns. If one has numeric - ** affinity, use that. Otherwise use no affinity. - */ - if( sqlite3IsNumericAffinity(aff1) || sqlite3IsNumericAffinity(aff2) ){ - return SQLITE_AFF_NUMERIC; - }else{ - return SQLITE_AFF_NONE; - } - }else if( !aff1 && !aff2 ){ - /* Neither side of the comparison is a column. Compare the - ** results directly. - */ - return SQLITE_AFF_NONE; - }else{ - /* One side is a column, the other is not. Use the columns affinity. */ - assert( aff1==0 || aff2==0 ); - return (aff1 + aff2); - } -} - -/* -** pExpr is a comparison operator. Return the type affinity that should -** be applied to both operands prior to doing the comparison. -*/ -static char comparisonAffinity(Expr *pExpr){ - char aff; - assert( pExpr->op==TK_EQ || pExpr->op==TK_IN || pExpr->op==TK_LT || - pExpr->op==TK_GT || pExpr->op==TK_GE || pExpr->op==TK_LE || - pExpr->op==TK_NE || pExpr->op==TK_IS || pExpr->op==TK_ISNOT ); - assert( pExpr->pLeft ); - aff = sqlite3ExprAffinity(pExpr->pLeft); - if( pExpr->pRight ){ - aff = sqlite3CompareAffinity(pExpr->pRight, aff); - }else if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - aff = sqlite3CompareAffinity(pExpr->x.pSelect->pEList->a[0].pExpr, aff); - }else if( !aff ){ - aff = SQLITE_AFF_NONE; - } - return aff; -} - -/* -** pExpr is a comparison expression, eg. '=', '<', IN(...) etc. -** idx_affinity is the affinity of an indexed column. Return true -** if the index with affinity idx_affinity may be used to implement -** the comparison in pExpr. -*/ -SQLITE_PRIVATE int sqlite3IndexAffinityOk(Expr *pExpr, char idx_affinity){ - char aff = comparisonAffinity(pExpr); - switch( aff ){ - case SQLITE_AFF_NONE: - return 1; - case SQLITE_AFF_TEXT: - return idx_affinity==SQLITE_AFF_TEXT; - default: - return sqlite3IsNumericAffinity(idx_affinity); - } -} - -/* -** Return the P5 value that should be used for a binary comparison -** opcode (OP_Eq, OP_Ge etc.) used to compare pExpr1 and pExpr2. -*/ -static u8 binaryCompareP5(Expr *pExpr1, Expr *pExpr2, int jumpIfNull){ - u8 aff = (char)sqlite3ExprAffinity(pExpr2); - aff = (u8)sqlite3CompareAffinity(pExpr1, aff) | (u8)jumpIfNull; - return aff; -} - -/* -** Return a pointer to the collation sequence that should be used by -** a binary comparison operator comparing pLeft and pRight. -** -** If the left hand expression has a collating sequence type, then it is -** used. Otherwise the collation sequence for the right hand expression -** is used, or the default (BINARY) if neither expression has a collating -** type. -** -** Argument pRight (but not pLeft) may be a null pointer. In this case, -** it is not considered. -*/ -SQLITE_PRIVATE CollSeq *sqlite3BinaryCompareCollSeq( - Parse *pParse, - Expr *pLeft, - Expr *pRight -){ - CollSeq *pColl; - assert( pLeft ); - if( pLeft->flags & EP_Collate ){ - pColl = sqlite3ExprCollSeq(pParse, pLeft); - }else if( pRight && (pRight->flags & EP_Collate)!=0 ){ - pColl = sqlite3ExprCollSeq(pParse, pRight); - }else{ - pColl = sqlite3ExprCollSeq(pParse, pLeft); - if( !pColl ){ - pColl = sqlite3ExprCollSeq(pParse, pRight); - } - } - return pColl; -} - -/* -** Generate code for a comparison operator. -*/ -static int codeCompare( - Parse *pParse, /* The parsing (and code generating) context */ - Expr *pLeft, /* The left operand */ - Expr *pRight, /* The right operand */ - int opcode, /* The comparison opcode */ - int in1, int in2, /* Register holding operands */ - int dest, /* Jump here if true. */ - int jumpIfNull /* If true, jump if either operand is NULL */ -){ - int p5; - int addr; - CollSeq *p4; - - p4 = sqlite3BinaryCompareCollSeq(pParse, pLeft, pRight); - p5 = binaryCompareP5(pLeft, pRight, jumpIfNull); - addr = sqlite3VdbeAddOp4(pParse->pVdbe, opcode, in2, dest, in1, - (void*)p4, P4_COLLSEQ); - sqlite3VdbeChangeP5(pParse->pVdbe, (u8)p5); - return addr; -} - -#if SQLITE_MAX_EXPR_DEPTH>0 -/* -** Check that argument nHeight is less than or equal to the maximum -** expression depth allowed. If it is not, leave an error message in -** pParse. -*/ -SQLITE_PRIVATE int sqlite3ExprCheckHeight(Parse *pParse, int nHeight){ - int rc = SQLITE_OK; - int mxHeight = pParse->db->aLimit[SQLITE_LIMIT_EXPR_DEPTH]; - if( nHeight>mxHeight ){ - sqlite3ErrorMsg(pParse, - "Expression tree is too large (maximum depth %d)", mxHeight - ); - rc = SQLITE_ERROR; - } - return rc; -} - -/* The following three functions, heightOfExpr(), heightOfExprList() -** and heightOfSelect(), are used to determine the maximum height -** of any expression tree referenced by the structure passed as the -** first argument. -** -** If this maximum height is greater than the current value pointed -** to by pnHeight, the second parameter, then set *pnHeight to that -** value. -*/ -static void heightOfExpr(Expr *p, int *pnHeight){ - if( p ){ - if( p->nHeight>*pnHeight ){ - *pnHeight = p->nHeight; - } - } -} -static void heightOfExprList(ExprList *p, int *pnHeight){ - if( p ){ - int i; - for(i=0; inExpr; i++){ - heightOfExpr(p->a[i].pExpr, pnHeight); - } - } -} -static void heightOfSelect(Select *p, int *pnHeight){ - if( p ){ - heightOfExpr(p->pWhere, pnHeight); - heightOfExpr(p->pHaving, pnHeight); - heightOfExpr(p->pLimit, pnHeight); - heightOfExpr(p->pOffset, pnHeight); - heightOfExprList(p->pEList, pnHeight); - heightOfExprList(p->pGroupBy, pnHeight); - heightOfExprList(p->pOrderBy, pnHeight); - heightOfSelect(p->pPrior, pnHeight); - } -} - -/* -** Set the Expr.nHeight variable in the structure passed as an -** argument. An expression with no children, Expr.pList or -** Expr.pSelect member has a height of 1. Any other expression -** has a height equal to the maximum height of any other -** referenced Expr plus one. -*/ -static void exprSetHeight(Expr *p){ - int nHeight = 0; - heightOfExpr(p->pLeft, &nHeight); - heightOfExpr(p->pRight, &nHeight); - if( ExprHasProperty(p, EP_xIsSelect) ){ - heightOfSelect(p->x.pSelect, &nHeight); - }else{ - heightOfExprList(p->x.pList, &nHeight); - } - p->nHeight = nHeight + 1; -} - -/* -** Set the Expr.nHeight variable using the exprSetHeight() function. If -** the height is greater than the maximum allowed expression depth, -** leave an error in pParse. -*/ -SQLITE_PRIVATE void sqlite3ExprSetHeight(Parse *pParse, Expr *p){ - exprSetHeight(p); - sqlite3ExprCheckHeight(pParse, p->nHeight); -} - -/* -** Return the maximum height of any expression tree referenced -** by the select statement passed as an argument. -*/ -SQLITE_PRIVATE int sqlite3SelectExprHeight(Select *p){ - int nHeight = 0; - heightOfSelect(p, &nHeight); - return nHeight; -} -#else - #define exprSetHeight(y) -#endif /* SQLITE_MAX_EXPR_DEPTH>0 */ - -/* -** This routine is the core allocator for Expr nodes. -** -** Construct a new expression node and return a pointer to it. Memory -** for this node and for the pToken argument is a single allocation -** obtained from sqlite3DbMalloc(). The calling function -** is responsible for making sure the node eventually gets freed. -** -** If dequote is true, then the token (if it exists) is dequoted. -** If dequote is false, no dequoting is performance. The deQuote -** parameter is ignored if pToken is NULL or if the token does not -** appear to be quoted. If the quotes were of the form "..." (double-quotes) -** then the EP_DblQuoted flag is set on the expression node. -** -** Special case: If op==TK_INTEGER and pToken points to a string that -** can be translated into a 32-bit integer, then the token is not -** stored in u.zToken. Instead, the integer values is written -** into u.iValue and the EP_IntValue flag is set. No extra storage -** is allocated to hold the integer text and the dequote flag is ignored. -*/ -SQLITE_PRIVATE Expr *sqlite3ExprAlloc( - sqlite3 *db, /* Handle for sqlite3DbMallocZero() (may be null) */ - int op, /* Expression opcode */ - const Token *pToken, /* Token argument. Might be NULL */ - int dequote /* True to dequote */ -){ - Expr *pNew; - int nExtra = 0; - int iValue = 0; - - if( pToken ){ - if( op!=TK_INTEGER || pToken->z==0 - || sqlite3GetInt32(pToken->z, &iValue)==0 ){ - nExtra = pToken->n+1; - assert( iValue>=0 ); - } - } - pNew = sqlite3DbMallocZero(db, sizeof(Expr)+nExtra); - if( pNew ){ - pNew->op = (u8)op; - pNew->iAgg = -1; - if( pToken ){ - if( nExtra==0 ){ - pNew->flags |= EP_IntValue; - pNew->u.iValue = iValue; - }else{ - int c; - pNew->u.zToken = (char*)&pNew[1]; - assert( pToken->z!=0 || pToken->n==0 ); - if( pToken->n ) memcpy(pNew->u.zToken, pToken->z, pToken->n); - pNew->u.zToken[pToken->n] = 0; - if( dequote && nExtra>=3 - && ((c = pToken->z[0])=='\'' || c=='"' || c=='[' || c=='`') ){ - sqlite3Dequote(pNew->u.zToken); - if( c=='"' ) pNew->flags |= EP_DblQuoted; - } - } - } -#if SQLITE_MAX_EXPR_DEPTH>0 - pNew->nHeight = 1; -#endif - } - return pNew; -} - -/* -** Allocate a new expression node from a zero-terminated token that has -** already been dequoted. -*/ -SQLITE_PRIVATE Expr *sqlite3Expr( - sqlite3 *db, /* Handle for sqlite3DbMallocZero() (may be null) */ - int op, /* Expression opcode */ - const char *zToken /* Token argument. Might be NULL */ -){ - Token x; - x.z = zToken; - x.n = zToken ? sqlite3Strlen30(zToken) : 0; - return sqlite3ExprAlloc(db, op, &x, 0); -} - -/* -** Attach subtrees pLeft and pRight to the Expr node pRoot. -** -** If pRoot==NULL that means that a memory allocation error has occurred. -** In that case, delete the subtrees pLeft and pRight. -*/ -SQLITE_PRIVATE void sqlite3ExprAttachSubtrees( - sqlite3 *db, - Expr *pRoot, - Expr *pLeft, - Expr *pRight -){ - if( pRoot==0 ){ - assert( db->mallocFailed ); - sqlite3ExprDelete(db, pLeft); - sqlite3ExprDelete(db, pRight); - }else{ - if( pRight ){ - pRoot->pRight = pRight; - pRoot->flags |= EP_Collate & pRight->flags; - } - if( pLeft ){ - pRoot->pLeft = pLeft; - pRoot->flags |= EP_Collate & pLeft->flags; - } - exprSetHeight(pRoot); - } -} - -/* -** Allocate a Expr node which joins as many as two subtrees. -** -** One or both of the subtrees can be NULL. Return a pointer to the new -** Expr node. Or, if an OOM error occurs, set pParse->db->mallocFailed, -** free the subtrees and return NULL. -*/ -SQLITE_PRIVATE Expr *sqlite3PExpr( - Parse *pParse, /* Parsing context */ - int op, /* Expression opcode */ - Expr *pLeft, /* Left operand */ - Expr *pRight, /* Right operand */ - const Token *pToken /* Argument token */ -){ - Expr *p; - if( op==TK_AND && pLeft && pRight ){ - /* Take advantage of short-circuit false optimization for AND */ - p = sqlite3ExprAnd(pParse->db, pLeft, pRight); - }else{ - p = sqlite3ExprAlloc(pParse->db, op, pToken, 1); - sqlite3ExprAttachSubtrees(pParse->db, p, pLeft, pRight); - } - if( p ) { - sqlite3ExprCheckHeight(pParse, p->nHeight); - } - return p; -} - -/* -** If the expression is always either TRUE or FALSE (respectively), -** then return 1. If one cannot determine the truth value of the -** expression at compile-time return 0. -** -** This is an optimization. If is OK to return 0 here even if -** the expression really is always false or false (a false negative). -** But it is a bug to return 1 if the expression might have different -** boolean values in different circumstances (a false positive.) -** -** Note that if the expression is part of conditional for a -** LEFT JOIN, then we cannot determine at compile-time whether or not -** is it true or false, so always return 0. -*/ -static int exprAlwaysTrue(Expr *p){ - int v = 0; - if( ExprHasProperty(p, EP_FromJoin) ) return 0; - if( !sqlite3ExprIsInteger(p, &v) ) return 0; - return v!=0; -} -static int exprAlwaysFalse(Expr *p){ - int v = 0; - if( ExprHasProperty(p, EP_FromJoin) ) return 0; - if( !sqlite3ExprIsInteger(p, &v) ) return 0; - return v==0; -} - -/* -** Join two expressions using an AND operator. If either expression is -** NULL, then just return the other expression. -** -** If one side or the other of the AND is known to be false, then instead -** of returning an AND expression, just return a constant expression with -** a value of false. -*/ -SQLITE_PRIVATE Expr *sqlite3ExprAnd(sqlite3 *db, Expr *pLeft, Expr *pRight){ - if( pLeft==0 ){ - return pRight; - }else if( pRight==0 ){ - return pLeft; - }else if( exprAlwaysFalse(pLeft) || exprAlwaysFalse(pRight) ){ - sqlite3ExprDelete(db, pLeft); - sqlite3ExprDelete(db, pRight); - return sqlite3ExprAlloc(db, TK_INTEGER, &sqlite3IntTokens[0], 0); - }else{ - Expr *pNew = sqlite3ExprAlloc(db, TK_AND, 0, 0); - sqlite3ExprAttachSubtrees(db, pNew, pLeft, pRight); - return pNew; - } -} - -/* -** Construct a new expression node for a function with multiple -** arguments. -*/ -SQLITE_PRIVATE Expr *sqlite3ExprFunction(Parse *pParse, ExprList *pList, Token *pToken){ - Expr *pNew; - sqlite3 *db = pParse->db; - assert( pToken ); - pNew = sqlite3ExprAlloc(db, TK_FUNCTION, pToken, 1); - if( pNew==0 ){ - sqlite3ExprListDelete(db, pList); /* Avoid memory leak when malloc fails */ - return 0; - } - pNew->x.pList = pList; - assert( !ExprHasProperty(pNew, EP_xIsSelect) ); - sqlite3ExprSetHeight(pParse, pNew); - return pNew; -} - -/* -** Assign a variable number to an expression that encodes a wildcard -** in the original SQL statement. -** -** Wildcards consisting of a single "?" are assigned the next sequential -** variable number. -** -** Wildcards of the form "?nnn" are assigned the number "nnn". We make -** sure "nnn" is not too be to avoid a denial of service attack when -** the SQL statement comes from an external source. -** -** Wildcards of the form ":aaa", "@aaa", or "$aaa" are assigned the same number -** as the previous instance of the same wildcard. Or if this is the first -** instance of the wildcard, the next sequenial variable number is -** assigned. -*/ -SQLITE_PRIVATE void sqlite3ExprAssignVarNumber(Parse *pParse, Expr *pExpr){ - sqlite3 *db = pParse->db; - const char *z; - - if( pExpr==0 ) return; - assert( !ExprHasProperty(pExpr, EP_IntValue|EP_Reduced|EP_TokenOnly) ); - z = pExpr->u.zToken; - assert( z!=0 ); - assert( z[0]!=0 ); - if( z[1]==0 ){ - /* Wildcard of the form "?". Assign the next variable number */ - assert( z[0]=='?' ); - pExpr->iColumn = (ynVar)(++pParse->nVar); - }else{ - ynVar x = 0; - u32 n = sqlite3Strlen30(z); - if( z[0]=='?' ){ - /* Wildcard of the form "?nnn". Convert "nnn" to an integer and - ** use it as the variable number */ - i64 i; - int bOk = 0==sqlite3Atoi64(&z[1], &i, n-1, SQLITE_UTF8); - pExpr->iColumn = x = (ynVar)i; - testcase( i==0 ); - testcase( i==1 ); - testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]-1 ); - testcase( i==db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ); - if( bOk==0 || i<1 || i>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ - sqlite3ErrorMsg(pParse, "variable number must be between ?1 and ?%d", - db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER]); - x = 0; - } - if( i>pParse->nVar ){ - pParse->nVar = (int)i; - } - }else{ - /* Wildcards like ":aaa", "$aaa" or "@aaa". Reuse the same variable - ** number as the prior appearance of the same name, or if the name - ** has never appeared before, reuse the same variable number - */ - ynVar i; - for(i=0; inzVar; i++){ - if( pParse->azVar[i] && strcmp(pParse->azVar[i],z)==0 ){ - pExpr->iColumn = x = (ynVar)i+1; - break; - } - } - if( x==0 ) x = pExpr->iColumn = (ynVar)(++pParse->nVar); - } - if( x>0 ){ - if( x>pParse->nzVar ){ - char **a; - a = sqlite3DbRealloc(db, pParse->azVar, x*sizeof(a[0])); - if( a==0 ) return; /* Error reported through db->mallocFailed */ - pParse->azVar = a; - memset(&a[pParse->nzVar], 0, (x-pParse->nzVar)*sizeof(a[0])); - pParse->nzVar = x; - } - if( z[0]!='?' || pParse->azVar[x-1]==0 ){ - sqlite3DbFree(db, pParse->azVar[x-1]); - pParse->azVar[x-1] = sqlite3DbStrNDup(db, z, n); - } - } - } - if( !pParse->nErr && pParse->nVar>db->aLimit[SQLITE_LIMIT_VARIABLE_NUMBER] ){ - sqlite3ErrorMsg(pParse, "too many SQL variables"); - } -} - -/* -** Recursively delete an expression tree. -*/ -SQLITE_PRIVATE void sqlite3ExprDelete(sqlite3 *db, Expr *p){ - if( p==0 ) return; - /* Sanity check: Assert that the IntValue is non-negative if it exists */ - assert( !ExprHasProperty(p, EP_IntValue) || p->u.iValue>=0 ); - if( !ExprHasProperty(p, EP_TokenOnly) ){ - /* The Expr.x union is never used at the same time as Expr.pRight */ - assert( p->x.pList==0 || p->pRight==0 ); - sqlite3ExprDelete(db, p->pLeft); - sqlite3ExprDelete(db, p->pRight); - if( ExprHasProperty(p, EP_MemToken) ) sqlite3DbFree(db, p->u.zToken); - if( ExprHasProperty(p, EP_xIsSelect) ){ - sqlite3SelectDelete(db, p->x.pSelect); - }else{ - sqlite3ExprListDelete(db, p->x.pList); - } - } - if( !ExprHasProperty(p, EP_Static) ){ - sqlite3DbFree(db, p); - } -} - -/* -** Return the number of bytes allocated for the expression structure -** passed as the first argument. This is always one of EXPR_FULLSIZE, -** EXPR_REDUCEDSIZE or EXPR_TOKENONLYSIZE. -*/ -static int exprStructSize(Expr *p){ - if( ExprHasProperty(p, EP_TokenOnly) ) return EXPR_TOKENONLYSIZE; - if( ExprHasProperty(p, EP_Reduced) ) return EXPR_REDUCEDSIZE; - return EXPR_FULLSIZE; -} - -/* -** The dupedExpr*Size() routines each return the number of bytes required -** to store a copy of an expression or expression tree. They differ in -** how much of the tree is measured. -** -** dupedExprStructSize() Size of only the Expr structure -** dupedExprNodeSize() Size of Expr + space for token -** dupedExprSize() Expr + token + subtree components -** -*************************************************************************** -** -** The dupedExprStructSize() function returns two values OR-ed together: -** (1) the space required for a copy of the Expr structure only and -** (2) the EP_xxx flags that indicate what the structure size should be. -** The return values is always one of: -** -** EXPR_FULLSIZE -** EXPR_REDUCEDSIZE | EP_Reduced -** EXPR_TOKENONLYSIZE | EP_TokenOnly -** -** The size of the structure can be found by masking the return value -** of this routine with 0xfff. The flags can be found by masking the -** return value with EP_Reduced|EP_TokenOnly. -** -** Note that with flags==EXPRDUP_REDUCE, this routines works on full-size -** (unreduced) Expr objects as they or originally constructed by the parser. -** During expression analysis, extra information is computed and moved into -** later parts of teh Expr object and that extra information might get chopped -** off if the expression is reduced. Note also that it does not work to -** make a EXPRDUP_REDUCE copy of a reduced expression. It is only legal -** to reduce a pristine expression tree from the parser. The implementation -** of dupedExprStructSize() contain multiple assert() statements that attempt -** to enforce this constraint. -*/ -static int dupedExprStructSize(Expr *p, int flags){ - int nSize; - assert( flags==EXPRDUP_REDUCE || flags==0 ); /* Only one flag value allowed */ - assert( EXPR_FULLSIZE<=0xfff ); - assert( (0xfff & (EP_Reduced|EP_TokenOnly))==0 ); - if( 0==(flags&EXPRDUP_REDUCE) ){ - nSize = EXPR_FULLSIZE; - }else{ - assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); - assert( !ExprHasProperty(p, EP_FromJoin) ); - assert( !ExprHasProperty(p, EP_MemToken) ); - assert( !ExprHasProperty(p, EP_NoReduce) ); - if( p->pLeft || p->x.pList ){ - nSize = EXPR_REDUCEDSIZE | EP_Reduced; - }else{ - assert( p->pRight==0 ); - nSize = EXPR_TOKENONLYSIZE | EP_TokenOnly; - } - } - return nSize; -} - -/* -** This function returns the space in bytes required to store the copy -** of the Expr structure and a copy of the Expr.u.zToken string (if that -** string is defined.) -*/ -static int dupedExprNodeSize(Expr *p, int flags){ - int nByte = dupedExprStructSize(p, flags) & 0xfff; - if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ - nByte += sqlite3Strlen30(p->u.zToken)+1; - } - return ROUND8(nByte); -} - -/* -** Return the number of bytes required to create a duplicate of the -** expression passed as the first argument. The second argument is a -** mask containing EXPRDUP_XXX flags. -** -** The value returned includes space to create a copy of the Expr struct -** itself and the buffer referred to by Expr.u.zToken, if any. -** -** If the EXPRDUP_REDUCE flag is set, then the return value includes -** space to duplicate all Expr nodes in the tree formed by Expr.pLeft -** and Expr.pRight variables (but not for any structures pointed to or -** descended from the Expr.x.pList or Expr.x.pSelect variables). -*/ -static int dupedExprSize(Expr *p, int flags){ - int nByte = 0; - if( p ){ - nByte = dupedExprNodeSize(p, flags); - if( flags&EXPRDUP_REDUCE ){ - nByte += dupedExprSize(p->pLeft, flags) + dupedExprSize(p->pRight, flags); - } - } - return nByte; -} - -/* -** This function is similar to sqlite3ExprDup(), except that if pzBuffer -** is not NULL then *pzBuffer is assumed to point to a buffer large enough -** to store the copy of expression p, the copies of p->u.zToken -** (if applicable), and the copies of the p->pLeft and p->pRight expressions, -** if any. Before returning, *pzBuffer is set to the first byte passed the -** portion of the buffer copied into by this function. -*/ -static Expr *exprDup(sqlite3 *db, Expr *p, int flags, u8 **pzBuffer){ - Expr *pNew = 0; /* Value to return */ - if( p ){ - const int isReduced = (flags&EXPRDUP_REDUCE); - u8 *zAlloc; - u32 staticFlag = 0; - - assert( pzBuffer==0 || isReduced ); - - /* Figure out where to write the new Expr structure. */ - if( pzBuffer ){ - zAlloc = *pzBuffer; - staticFlag = EP_Static; - }else{ - zAlloc = sqlite3DbMallocRaw(db, dupedExprSize(p, flags)); - } - pNew = (Expr *)zAlloc; - - if( pNew ){ - /* Set nNewSize to the size allocated for the structure pointed to - ** by pNew. This is either EXPR_FULLSIZE, EXPR_REDUCEDSIZE or - ** EXPR_TOKENONLYSIZE. nToken is set to the number of bytes consumed - ** by the copy of the p->u.zToken string (if any). - */ - const unsigned nStructSize = dupedExprStructSize(p, flags); - const int nNewSize = nStructSize & 0xfff; - int nToken; - if( !ExprHasProperty(p, EP_IntValue) && p->u.zToken ){ - nToken = sqlite3Strlen30(p->u.zToken) + 1; - }else{ - nToken = 0; - } - if( isReduced ){ - assert( ExprHasProperty(p, EP_Reduced)==0 ); - memcpy(zAlloc, p, nNewSize); - }else{ - int nSize = exprStructSize(p); - memcpy(zAlloc, p, nSize); - memset(&zAlloc[nSize], 0, EXPR_FULLSIZE-nSize); - } - - /* Set the EP_Reduced, EP_TokenOnly, and EP_Static flags appropriately. */ - pNew->flags &= ~(EP_Reduced|EP_TokenOnly|EP_Static|EP_MemToken); - pNew->flags |= nStructSize & (EP_Reduced|EP_TokenOnly); - pNew->flags |= staticFlag; - - /* Copy the p->u.zToken string, if any. */ - if( nToken ){ - char *zToken = pNew->u.zToken = (char*)&zAlloc[nNewSize]; - memcpy(zToken, p->u.zToken, nToken); - } - - if( 0==((p->flags|pNew->flags) & EP_TokenOnly) ){ - /* Fill in the pNew->x.pSelect or pNew->x.pList member. */ - if( ExprHasProperty(p, EP_xIsSelect) ){ - pNew->x.pSelect = sqlite3SelectDup(db, p->x.pSelect, isReduced); - }else{ - pNew->x.pList = sqlite3ExprListDup(db, p->x.pList, isReduced); - } - } - - /* Fill in pNew->pLeft and pNew->pRight. */ - if( ExprHasProperty(pNew, EP_Reduced|EP_TokenOnly) ){ - zAlloc += dupedExprNodeSize(p, flags); - if( ExprHasProperty(pNew, EP_Reduced) ){ - pNew->pLeft = exprDup(db, p->pLeft, EXPRDUP_REDUCE, &zAlloc); - pNew->pRight = exprDup(db, p->pRight, EXPRDUP_REDUCE, &zAlloc); - } - if( pzBuffer ){ - *pzBuffer = zAlloc; - } - }else{ - if( !ExprHasProperty(p, EP_TokenOnly) ){ - pNew->pLeft = sqlite3ExprDup(db, p->pLeft, 0); - pNew->pRight = sqlite3ExprDup(db, p->pRight, 0); - } - } - - } - } - return pNew; -} - -/* -** Create and return a deep copy of the object passed as the second -** argument. If an OOM condition is encountered, NULL is returned -** and the db->mallocFailed flag set. -*/ -#ifndef SQLITE_OMIT_CTE -static With *withDup(sqlite3 *db, With *p){ - With *pRet = 0; - if( p ){ - int nByte = sizeof(*p) + sizeof(p->a[0]) * (p->nCte-1); - pRet = sqlite3DbMallocZero(db, nByte); - if( pRet ){ - int i; - pRet->nCte = p->nCte; - for(i=0; inCte; i++){ - pRet->a[i].pSelect = sqlite3SelectDup(db, p->a[i].pSelect, 0); - pRet->a[i].pCols = sqlite3ExprListDup(db, p->a[i].pCols, 0); - pRet->a[i].zName = sqlite3DbStrDup(db, p->a[i].zName); - } - } - } - return pRet; -} -#else -# define withDup(x,y) 0 -#endif - -/* -** The following group of routines make deep copies of expressions, -** expression lists, ID lists, and select statements. The copies can -** be deleted (by being passed to their respective ...Delete() routines) -** without effecting the originals. -** -** The expression list, ID, and source lists return by sqlite3ExprListDup(), -** sqlite3IdListDup(), and sqlite3SrcListDup() can not be further expanded -** by subsequent calls to sqlite*ListAppend() routines. -** -** Any tables that the SrcList might point to are not duplicated. -** -** The flags parameter contains a combination of the EXPRDUP_XXX flags. -** If the EXPRDUP_REDUCE flag is set, then the structure returned is a -** truncated version of the usual Expr structure that will be stored as -** part of the in-memory representation of the database schema. -*/ -SQLITE_PRIVATE Expr *sqlite3ExprDup(sqlite3 *db, Expr *p, int flags){ - return exprDup(db, p, flags, 0); -} -SQLITE_PRIVATE ExprList *sqlite3ExprListDup(sqlite3 *db, ExprList *p, int flags){ - ExprList *pNew; - struct ExprList_item *pItem, *pOldItem; - int i; - if( p==0 ) return 0; - pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) ); - if( pNew==0 ) return 0; - pNew->iECursor = 0; - pNew->nExpr = i = p->nExpr; - if( (flags & EXPRDUP_REDUCE)==0 ) for(i=1; inExpr; i+=i){} - pNew->a = pItem = sqlite3DbMallocRaw(db, i*sizeof(p->a[0]) ); - if( pItem==0 ){ - sqlite3DbFree(db, pNew); - return 0; - } - pOldItem = p->a; - for(i=0; inExpr; i++, pItem++, pOldItem++){ - Expr *pOldExpr = pOldItem->pExpr; - pItem->pExpr = sqlite3ExprDup(db, pOldExpr, flags); - pItem->zName = sqlite3DbStrDup(db, pOldItem->zName); - pItem->zSpan = sqlite3DbStrDup(db, pOldItem->zSpan); - pItem->sortOrder = pOldItem->sortOrder; - pItem->done = 0; - pItem->bSpanIsTab = pOldItem->bSpanIsTab; - pItem->u = pOldItem->u; - } - return pNew; -} - -/* -** If cursors, triggers, views and subqueries are all omitted from -** the build, then none of the following routines, except for -** sqlite3SelectDup(), can be called. sqlite3SelectDup() is sometimes -** called with a NULL argument. -*/ -#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) \ - || !defined(SQLITE_OMIT_SUBQUERY) -SQLITE_PRIVATE SrcList *sqlite3SrcListDup(sqlite3 *db, SrcList *p, int flags){ - SrcList *pNew; - int i; - int nByte; - if( p==0 ) return 0; - nByte = sizeof(*p) + (p->nSrc>0 ? sizeof(p->a[0]) * (p->nSrc-1) : 0); - pNew = sqlite3DbMallocRaw(db, nByte ); - if( pNew==0 ) return 0; - pNew->nSrc = pNew->nAlloc = p->nSrc; - for(i=0; inSrc; i++){ - struct SrcList_item *pNewItem = &pNew->a[i]; - struct SrcList_item *pOldItem = &p->a[i]; - Table *pTab; - pNewItem->pSchema = pOldItem->pSchema; - pNewItem->zDatabase = sqlite3DbStrDup(db, pOldItem->zDatabase); - pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName); - pNewItem->zAlias = sqlite3DbStrDup(db, pOldItem->zAlias); - pNewItem->jointype = pOldItem->jointype; - pNewItem->iCursor = pOldItem->iCursor; - pNewItem->addrFillSub = pOldItem->addrFillSub; - pNewItem->regReturn = pOldItem->regReturn; - pNewItem->isCorrelated = pOldItem->isCorrelated; - pNewItem->viaCoroutine = pOldItem->viaCoroutine; - pNewItem->isRecursive = pOldItem->isRecursive; - pNewItem->zIndex = sqlite3DbStrDup(db, pOldItem->zIndex); - pNewItem->notIndexed = pOldItem->notIndexed; - pNewItem->pIndex = pOldItem->pIndex; - pTab = pNewItem->pTab = pOldItem->pTab; - if( pTab ){ - pTab->nRef++; - } - pNewItem->pSelect = sqlite3SelectDup(db, pOldItem->pSelect, flags); - pNewItem->pOn = sqlite3ExprDup(db, pOldItem->pOn, flags); - pNewItem->pUsing = sqlite3IdListDup(db, pOldItem->pUsing); - pNewItem->colUsed = pOldItem->colUsed; - } - return pNew; -} -SQLITE_PRIVATE IdList *sqlite3IdListDup(sqlite3 *db, IdList *p){ - IdList *pNew; - int i; - if( p==0 ) return 0; - pNew = sqlite3DbMallocRaw(db, sizeof(*pNew) ); - if( pNew==0 ) return 0; - pNew->nId = p->nId; - pNew->a = sqlite3DbMallocRaw(db, p->nId*sizeof(p->a[0]) ); - if( pNew->a==0 ){ - sqlite3DbFree(db, pNew); - return 0; - } - /* Note that because the size of the allocation for p->a[] is not - ** necessarily a power of two, sqlite3IdListAppend() may not be called - ** on the duplicate created by this function. */ - for(i=0; inId; i++){ - struct IdList_item *pNewItem = &pNew->a[i]; - struct IdList_item *pOldItem = &p->a[i]; - pNewItem->zName = sqlite3DbStrDup(db, pOldItem->zName); - pNewItem->idx = pOldItem->idx; - } - return pNew; -} -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){ - Select *pNew, *pPrior; - if( p==0 ) return 0; - pNew = sqlite3DbMallocRaw(db, sizeof(*p) ); - if( pNew==0 ) return 0; - pNew->pEList = sqlite3ExprListDup(db, p->pEList, flags); - pNew->pSrc = sqlite3SrcListDup(db, p->pSrc, flags); - pNew->pWhere = sqlite3ExprDup(db, p->pWhere, flags); - pNew->pGroupBy = sqlite3ExprListDup(db, p->pGroupBy, flags); - pNew->pHaving = sqlite3ExprDup(db, p->pHaving, flags); - pNew->pOrderBy = sqlite3ExprListDup(db, p->pOrderBy, flags); - pNew->op = p->op; - pNew->pPrior = pPrior = sqlite3SelectDup(db, p->pPrior, flags); - if( pPrior ) pPrior->pNext = pNew; - pNew->pNext = 0; - pNew->pLimit = sqlite3ExprDup(db, p->pLimit, flags); - pNew->pOffset = sqlite3ExprDup(db, p->pOffset, flags); - pNew->iLimit = 0; - pNew->iOffset = 0; - pNew->selFlags = p->selFlags & ~SF_UsesEphemeral; - pNew->pRightmost = 0; - pNew->addrOpenEphm[0] = -1; - pNew->addrOpenEphm[1] = -1; - pNew->addrOpenEphm[2] = -1; - pNew->nSelectRow = p->nSelectRow; - pNew->pWith = withDup(db, p->pWith); - return pNew; -} -#else -SQLITE_PRIVATE Select *sqlite3SelectDup(sqlite3 *db, Select *p, int flags){ - assert( p==0 ); - return 0; -} -#endif - - -/* -** Add a new element to the end of an expression list. If pList is -** initially NULL, then create a new expression list. -** -** If a memory allocation error occurs, the entire list is freed and -** NULL is returned. If non-NULL is returned, then it is guaranteed -** that the new entry was successfully appended. -*/ -SQLITE_PRIVATE ExprList *sqlite3ExprListAppend( - Parse *pParse, /* Parsing context */ - ExprList *pList, /* List to which to append. Might be NULL */ - Expr *pExpr /* Expression to be appended. Might be NULL */ -){ - sqlite3 *db = pParse->db; - if( pList==0 ){ - pList = sqlite3DbMallocZero(db, sizeof(ExprList) ); - if( pList==0 ){ - goto no_mem; - } - pList->a = sqlite3DbMallocRaw(db, sizeof(pList->a[0])); - if( pList->a==0 ) goto no_mem; - }else if( (pList->nExpr & (pList->nExpr-1))==0 ){ - struct ExprList_item *a; - assert( pList->nExpr>0 ); - a = sqlite3DbRealloc(db, pList->a, pList->nExpr*2*sizeof(pList->a[0])); - if( a==0 ){ - goto no_mem; - } - pList->a = a; - } - assert( pList->a!=0 ); - if( 1 ){ - struct ExprList_item *pItem = &pList->a[pList->nExpr++]; - memset(pItem, 0, sizeof(*pItem)); - pItem->pExpr = pExpr; - } - return pList; - -no_mem: - /* Avoid leaking memory if malloc has failed. */ - sqlite3ExprDelete(db, pExpr); - sqlite3ExprListDelete(db, pList); - return 0; -} - -/* -** Set the ExprList.a[].zName element of the most recently added item -** on the expression list. -** -** pList might be NULL following an OOM error. But pName should never be -** NULL. If a memory allocation fails, the pParse->db->mallocFailed flag -** is set. -*/ -SQLITE_PRIVATE void sqlite3ExprListSetName( - Parse *pParse, /* Parsing context */ - ExprList *pList, /* List to which to add the span. */ - Token *pName, /* Name to be added */ - int dequote /* True to cause the name to be dequoted */ -){ - assert( pList!=0 || pParse->db->mallocFailed!=0 ); - if( pList ){ - struct ExprList_item *pItem; - assert( pList->nExpr>0 ); - pItem = &pList->a[pList->nExpr-1]; - assert( pItem->zName==0 ); - pItem->zName = sqlite3DbStrNDup(pParse->db, pName->z, pName->n); - if( dequote && pItem->zName ) sqlite3Dequote(pItem->zName); - } -} - -/* -** Set the ExprList.a[].zSpan element of the most recently added item -** on the expression list. -** -** pList might be NULL following an OOM error. But pSpan should never be -** NULL. If a memory allocation fails, the pParse->db->mallocFailed flag -** is set. -*/ -SQLITE_PRIVATE void sqlite3ExprListSetSpan( - Parse *pParse, /* Parsing context */ - ExprList *pList, /* List to which to add the span. */ - ExprSpan *pSpan /* The span to be added */ -){ - sqlite3 *db = pParse->db; - assert( pList!=0 || db->mallocFailed!=0 ); - if( pList ){ - struct ExprList_item *pItem = &pList->a[pList->nExpr-1]; - assert( pList->nExpr>0 ); - assert( db->mallocFailed || pItem->pExpr==pSpan->pExpr ); - sqlite3DbFree(db, pItem->zSpan); - pItem->zSpan = sqlite3DbStrNDup(db, (char*)pSpan->zStart, - (int)(pSpan->zEnd - pSpan->zStart)); - } -} - -/* -** If the expression list pEList contains more than iLimit elements, -** leave an error message in pParse. -*/ -SQLITE_PRIVATE void sqlite3ExprListCheckLength( - Parse *pParse, - ExprList *pEList, - const char *zObject -){ - int mx = pParse->db->aLimit[SQLITE_LIMIT_COLUMN]; - testcase( pEList && pEList->nExpr==mx ); - testcase( pEList && pEList->nExpr==mx+1 ); - if( pEList && pEList->nExpr>mx ){ - sqlite3ErrorMsg(pParse, "too many columns in %s", zObject); - } -} - -/* -** Delete an entire expression list. -*/ -SQLITE_PRIVATE void sqlite3ExprListDelete(sqlite3 *db, ExprList *pList){ - int i; - struct ExprList_item *pItem; - if( pList==0 ) return; - assert( pList->a!=0 || pList->nExpr==0 ); - for(pItem=pList->a, i=0; inExpr; i++, pItem++){ - sqlite3ExprDelete(db, pItem->pExpr); - sqlite3DbFree(db, pItem->zName); - sqlite3DbFree(db, pItem->zSpan); - } - sqlite3DbFree(db, pList->a); - sqlite3DbFree(db, pList); -} - -/* -** These routines are Walker callbacks. Walker.u.pi is a pointer -** to an integer. These routines are checking an expression to see -** if it is a constant. Set *Walker.u.pi to 0 if the expression is -** not constant. -** -** These callback routines are used to implement the following: -** -** sqlite3ExprIsConstant() -** sqlite3ExprIsConstantNotJoin() -** sqlite3ExprIsConstantOrFunction() -** -*/ -static int exprNodeIsConstant(Walker *pWalker, Expr *pExpr){ - - /* If pWalker->u.i is 3 then any term of the expression that comes from - ** the ON or USING clauses of a join disqualifies the expression - ** from being considered constant. */ - if( pWalker->u.i==3 && ExprHasProperty(pExpr, EP_FromJoin) ){ - pWalker->u.i = 0; - return WRC_Abort; - } - - switch( pExpr->op ){ - /* Consider functions to be constant if all their arguments are constant - ** and either pWalker->u.i==2 or the function as the SQLITE_FUNC_CONST - ** flag. */ - case TK_FUNCTION: - if( pWalker->u.i==2 || ExprHasProperty(pExpr,EP_Constant) ){ - return WRC_Continue; - } - /* Fall through */ - case TK_ID: - case TK_COLUMN: - case TK_AGG_FUNCTION: - case TK_AGG_COLUMN: - testcase( pExpr->op==TK_ID ); - testcase( pExpr->op==TK_COLUMN ); - testcase( pExpr->op==TK_AGG_FUNCTION ); - testcase( pExpr->op==TK_AGG_COLUMN ); - pWalker->u.i = 0; - return WRC_Abort; - default: - testcase( pExpr->op==TK_SELECT ); /* selectNodeIsConstant will disallow */ - testcase( pExpr->op==TK_EXISTS ); /* selectNodeIsConstant will disallow */ - return WRC_Continue; - } -} -static int selectNodeIsConstant(Walker *pWalker, Select *NotUsed){ - UNUSED_PARAMETER(NotUsed); - pWalker->u.i = 0; - return WRC_Abort; -} -static int exprIsConst(Expr *p, int initFlag){ - Walker w; - memset(&w, 0, sizeof(w)); - w.u.i = initFlag; - w.xExprCallback = exprNodeIsConstant; - w.xSelectCallback = selectNodeIsConstant; - sqlite3WalkExpr(&w, p); - return w.u.i; -} - -/* -** Walk an expression tree. Return 1 if the expression is constant -** and 0 if it involves variables or function calls. -** -** For the purposes of this function, a double-quoted string (ex: "abc") -** is considered a variable but a single-quoted string (ex: 'abc') is -** a constant. -*/ -SQLITE_PRIVATE int sqlite3ExprIsConstant(Expr *p){ - return exprIsConst(p, 1); -} - -/* -** Walk an expression tree. Return 1 if the expression is constant -** that does no originate from the ON or USING clauses of a join. -** Return 0 if it involves variables or function calls or terms from -** an ON or USING clause. -*/ -SQLITE_PRIVATE int sqlite3ExprIsConstantNotJoin(Expr *p){ - return exprIsConst(p, 3); -} - -/* -** Walk an expression tree. Return 1 if the expression is constant -** or a function call with constant arguments. Return and 0 if there -** are any variables. -** -** For the purposes of this function, a double-quoted string (ex: "abc") -** is considered a variable but a single-quoted string (ex: 'abc') is -** a constant. -*/ -SQLITE_PRIVATE int sqlite3ExprIsConstantOrFunction(Expr *p){ - return exprIsConst(p, 2); -} - -/* -** If the expression p codes a constant integer that is small enough -** to fit in a 32-bit integer, return 1 and put the value of the integer -** in *pValue. If the expression is not an integer or if it is too big -** to fit in a signed 32-bit integer, return 0 and leave *pValue unchanged. -*/ -SQLITE_PRIVATE int sqlite3ExprIsInteger(Expr *p, int *pValue){ - int rc = 0; - - /* If an expression is an integer literal that fits in a signed 32-bit - ** integer, then the EP_IntValue flag will have already been set */ - assert( p->op!=TK_INTEGER || (p->flags & EP_IntValue)!=0 - || sqlite3GetInt32(p->u.zToken, &rc)==0 ); - - if( p->flags & EP_IntValue ){ - *pValue = p->u.iValue; - return 1; - } - switch( p->op ){ - case TK_UPLUS: { - rc = sqlite3ExprIsInteger(p->pLeft, pValue); - break; - } - case TK_UMINUS: { - int v; - if( sqlite3ExprIsInteger(p->pLeft, &v) ){ - assert( v!=(-2147483647-1) ); - *pValue = -v; - rc = 1; - } - break; - } - default: break; - } - return rc; -} - -/* -** Return FALSE if there is no chance that the expression can be NULL. -** -** If the expression might be NULL or if the expression is too complex -** to tell return TRUE. -** -** This routine is used as an optimization, to skip OP_IsNull opcodes -** when we know that a value cannot be NULL. Hence, a false positive -** (returning TRUE when in fact the expression can never be NULL) might -** be a small performance hit but is otherwise harmless. On the other -** hand, a false negative (returning FALSE when the result could be NULL) -** will likely result in an incorrect answer. So when in doubt, return -** TRUE. -*/ -SQLITE_PRIVATE int sqlite3ExprCanBeNull(const Expr *p){ - u8 op; - while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; } - op = p->op; - if( op==TK_REGISTER ) op = p->op2; - switch( op ){ - case TK_INTEGER: - case TK_STRING: - case TK_FLOAT: - case TK_BLOB: - return 0; - default: - return 1; - } -} - -/* -** Generate an OP_IsNull instruction that tests register iReg and jumps -** to location iDest if the value in iReg is NULL. The value in iReg -** was computed by pExpr. If we can look at pExpr at compile-time and -** determine that it can never generate a NULL, then the OP_IsNull operation -** can be omitted. -*/ -SQLITE_PRIVATE void sqlite3ExprCodeIsNullJump( - Vdbe *v, /* The VDBE under construction */ - const Expr *pExpr, /* Only generate OP_IsNull if this expr can be NULL */ - int iReg, /* Test the value in this register for NULL */ - int iDest /* Jump here if the value is null */ -){ - if( sqlite3ExprCanBeNull(pExpr) ){ - sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iDest); - } -} - -/* -** Return TRUE if the given expression is a constant which would be -** unchanged by OP_Affinity with the affinity given in the second -** argument. -** -** This routine is used to determine if the OP_Affinity operation -** can be omitted. When in doubt return FALSE. A false negative -** is harmless. A false positive, however, can result in the wrong -** answer. -*/ -SQLITE_PRIVATE int sqlite3ExprNeedsNoAffinityChange(const Expr *p, char aff){ - u8 op; - if( aff==SQLITE_AFF_NONE ) return 1; - while( p->op==TK_UPLUS || p->op==TK_UMINUS ){ p = p->pLeft; } - op = p->op; - if( op==TK_REGISTER ) op = p->op2; - switch( op ){ - case TK_INTEGER: { - return aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC; - } - case TK_FLOAT: { - return aff==SQLITE_AFF_REAL || aff==SQLITE_AFF_NUMERIC; - } - case TK_STRING: { - return aff==SQLITE_AFF_TEXT; - } - case TK_BLOB: { - return 1; - } - case TK_COLUMN: { - assert( p->iTable>=0 ); /* p cannot be part of a CHECK constraint */ - return p->iColumn<0 - && (aff==SQLITE_AFF_INTEGER || aff==SQLITE_AFF_NUMERIC); - } - default: { - return 0; - } - } -} - -/* -** Return TRUE if the given string is a row-id column name. -*/ -SQLITE_PRIVATE int sqlite3IsRowid(const char *z){ - if( sqlite3StrICmp(z, "_ROWID_")==0 ) return 1; - if( sqlite3StrICmp(z, "ROWID")==0 ) return 1; - if( sqlite3StrICmp(z, "OID")==0 ) return 1; - return 0; -} - -/* -** Return true if we are able to the IN operator optimization on a -** query of the form -** -** x IN (SELECT ...) -** -** Where the SELECT... clause is as specified by the parameter to this -** routine. -** -** The Select object passed in has already been preprocessed and no -** errors have been found. -*/ -#ifndef SQLITE_OMIT_SUBQUERY -static int isCandidateForInOpt(Select *p){ - SrcList *pSrc; - ExprList *pEList; - Table *pTab; - if( p==0 ) return 0; /* right-hand side of IN is SELECT */ - if( p->pPrior ) return 0; /* Not a compound SELECT */ - if( p->selFlags & (SF_Distinct|SF_Aggregate) ){ - testcase( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct ); - testcase( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate ); - return 0; /* No DISTINCT keyword and no aggregate functions */ - } - assert( p->pGroupBy==0 ); /* Has no GROUP BY clause */ - if( p->pLimit ) return 0; /* Has no LIMIT clause */ - assert( p->pOffset==0 ); /* No LIMIT means no OFFSET */ - if( p->pWhere ) return 0; /* Has no WHERE clause */ - pSrc = p->pSrc; - assert( pSrc!=0 ); - if( pSrc->nSrc!=1 ) return 0; /* Single term in FROM clause */ - if( pSrc->a[0].pSelect ) return 0; /* FROM is not a subquery or view */ - pTab = pSrc->a[0].pTab; - if( NEVER(pTab==0) ) return 0; - assert( pTab->pSelect==0 ); /* FROM clause is not a view */ - if( IsVirtual(pTab) ) return 0; /* FROM clause not a virtual table */ - pEList = p->pEList; - if( pEList->nExpr!=1 ) return 0; /* One column in the result set */ - if( pEList->a[0].pExpr->op!=TK_COLUMN ) return 0; /* Result is a column */ - return 1; -} -#endif /* SQLITE_OMIT_SUBQUERY */ - -/* -** Code an OP_Once instruction and allocate space for its flag. Return the -** address of the new instruction. -*/ -SQLITE_PRIVATE int sqlite3CodeOnce(Parse *pParse){ - Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */ - return sqlite3VdbeAddOp1(v, OP_Once, pParse->nOnce++); -} - -/* -** This function is used by the implementation of the IN (...) operator. -** The pX parameter is the expression on the RHS of the IN operator, which -** might be either a list of expressions or a subquery. -** -** The job of this routine is to find or create a b-tree object that can -** be used either to test for membership in the RHS set or to iterate through -** all members of the RHS set, skipping duplicates. -** -** A cursor is opened on the b-tree object that the RHS of the IN operator -** and pX->iTable is set to the index of that cursor. -** -** The returned value of this function indicates the b-tree type, as follows: -** -** IN_INDEX_ROWID - The cursor was opened on a database table. -** IN_INDEX_INDEX_ASC - The cursor was opened on an ascending index. -** IN_INDEX_INDEX_DESC - The cursor was opened on a descending index. -** IN_INDEX_EPH - The cursor was opened on a specially created and -** populated epheremal table. -** -** An existing b-tree might be used if the RHS expression pX is a simple -** subquery such as: -** -** SELECT FROM -** -** If the RHS of the IN operator is a list or a more complex subquery, then -** an ephemeral table might need to be generated from the RHS and then -** pX->iTable made to point to the ephermeral table instead of an -** existing table. -** -** If the prNotFound parameter is 0, then the b-tree will be used to iterate -** through the set members, skipping any duplicates. In this case an -** epheremal table must be used unless the selected is guaranteed -** to be unique - either because it is an INTEGER PRIMARY KEY or it -** has a UNIQUE constraint or UNIQUE index. -** -** If the prNotFound parameter is not 0, then the b-tree will be used -** for fast set membership tests. In this case an epheremal table must -** be used unless is an INTEGER PRIMARY KEY or an index can -** be found with as its left-most column. -** -** When the b-tree is being used for membership tests, the calling function -** needs to know whether or not the structure contains an SQL NULL -** value in order to correctly evaluate expressions like "X IN (Y, Z)". -** If there is any chance that the (...) might contain a NULL value at -** runtime, then a register is allocated and the register number written -** to *prNotFound. If there is no chance that the (...) contains a -** NULL value, then *prNotFound is left unchanged. -** -** If a register is allocated and its location stored in *prNotFound, then -** its initial value is NULL. If the (...) does not remain constant -** for the duration of the query (i.e. the SELECT within the (...) -** is a correlated subquery) then the value of the allocated register is -** reset to NULL each time the subquery is rerun. This allows the -** caller to use vdbe code equivalent to the following: -** -** if( register==NULL ){ -** has_null = -** register = 1 -** } -** -** in order to avoid running the -** test more often than is necessary. -*/ -#ifndef SQLITE_OMIT_SUBQUERY -SQLITE_PRIVATE int sqlite3FindInIndex(Parse *pParse, Expr *pX, int *prNotFound){ - Select *p; /* SELECT to the right of IN operator */ - int eType = 0; /* Type of RHS table. IN_INDEX_* */ - int iTab = pParse->nTab++; /* Cursor of the RHS table */ - int mustBeUnique = (prNotFound==0); /* True if RHS must be unique */ - Vdbe *v = sqlite3GetVdbe(pParse); /* Virtual machine being coded */ - - assert( pX->op==TK_IN ); - - /* Check to see if an existing table or index can be used to - ** satisfy the query. This is preferable to generating a new - ** ephemeral table. - */ - p = (ExprHasProperty(pX, EP_xIsSelect) ? pX->x.pSelect : 0); - if( ALWAYS(pParse->nErr==0) && isCandidateForInOpt(p) ){ - sqlite3 *db = pParse->db; /* Database connection */ - Table *pTab; /* Table
    . */ - Expr *pExpr; /* Expression */ - i16 iCol; /* Index of column */ - i16 iDb; /* Database idx for pTab */ - - assert( p ); /* Because of isCandidateForInOpt(p) */ - assert( p->pEList!=0 ); /* Because of isCandidateForInOpt(p) */ - assert( p->pEList->a[0].pExpr!=0 ); /* Because of isCandidateForInOpt(p) */ - assert( p->pSrc!=0 ); /* Because of isCandidateForInOpt(p) */ - pTab = p->pSrc->a[0].pTab; - pExpr = p->pEList->a[0].pExpr; - iCol = (i16)pExpr->iColumn; - - /* Code an OP_VerifyCookie and OP_TableLock for
    . */ - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); - - /* This function is only called from two places. In both cases the vdbe - ** has already been allocated. So assume sqlite3GetVdbe() is always - ** successful here. - */ - assert(v); - if( iCol<0 ){ - int iAddr; - - iAddr = sqlite3CodeOnce(pParse); - - sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); - eType = IN_INDEX_ROWID; - - sqlite3VdbeJumpHere(v, iAddr); - }else{ - Index *pIdx; /* Iterator variable */ - - /* The collation sequence used by the comparison. If an index is to - ** be used in place of a temp-table, it must be ordered according - ** to this collation sequence. */ - CollSeq *pReq = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pExpr); - - /* Check that the affinity that will be used to perform the - ** comparison is the same as the affinity of the column. If - ** it is not, it is not possible to use any index. - */ - int affinity_ok = sqlite3IndexAffinityOk(pX, pTab->aCol[iCol].affinity); - - for(pIdx=pTab->pIndex; pIdx && eType==0 && affinity_ok; pIdx=pIdx->pNext){ - if( (pIdx->aiColumn[0]==iCol) - && sqlite3FindCollSeq(db, ENC(db), pIdx->azColl[0], 0)==pReq - && (!mustBeUnique || (pIdx->nKeyCol==1 && pIdx->onError!=OE_None)) - ){ - int iAddr = sqlite3CodeOnce(pParse); - sqlite3VdbeAddOp3(v, OP_OpenRead, iTab, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); - VdbeComment((v, "%s", pIdx->zName)); - assert( IN_INDEX_INDEX_DESC == IN_INDEX_INDEX_ASC+1 ); - eType = IN_INDEX_INDEX_ASC + pIdx->aSortOrder[0]; - - sqlite3VdbeJumpHere(v, iAddr); - if( prNotFound && !pTab->aCol[iCol].notNull ){ - *prNotFound = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Null, 0, *prNotFound); - } - } - } - } - } - - if( eType==0 ){ - /* Could not found an existing table or index to use as the RHS b-tree. - ** We will have to generate an ephemeral table to do the job. - */ - u32 savedNQueryLoop = pParse->nQueryLoop; - int rMayHaveNull = 0; - eType = IN_INDEX_EPH; - if( prNotFound ){ - *prNotFound = rMayHaveNull = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Null, 0, *prNotFound); - }else{ - testcase( pParse->nQueryLoop>0 ); - pParse->nQueryLoop = 0; - if( pX->pLeft->iColumn<0 && !ExprHasProperty(pX, EP_xIsSelect) ){ - eType = IN_INDEX_ROWID; - } - } - sqlite3CodeSubselect(pParse, pX, rMayHaveNull, eType==IN_INDEX_ROWID); - pParse->nQueryLoop = savedNQueryLoop; - }else{ - pX->iTable = iTab; - } - return eType; -} -#endif - -/* -** Generate code for scalar subqueries used as a subquery expression, EXISTS, -** or IN operators. Examples: -** -** (SELECT a FROM b) -- subquery -** EXISTS (SELECT a FROM b) -- EXISTS subquery -** x IN (4,5,11) -- IN operator with list on right-hand side -** x IN (SELECT a FROM b) -- IN operator with subquery on the right -** -** The pExpr parameter describes the expression that contains the IN -** operator or subquery. -** -** If parameter isRowid is non-zero, then expression pExpr is guaranteed -** to be of the form " IN (?, ?, ?)", where is a reference -** to some integer key column of a table B-Tree. In this case, use an -** intkey B-Tree to store the set of IN(...) values instead of the usual -** (slower) variable length keys B-Tree. -** -** If rMayHaveNull is non-zero, that means that the operation is an IN -** (not a SELECT or EXISTS) and that the RHS might contains NULLs. -** Furthermore, the IN is in a WHERE clause and that we really want -** to iterate over the RHS of the IN operator in order to quickly locate -** all corresponding LHS elements. All this routine does is initialize -** the register given by rMayHaveNull to NULL. Calling routines will take -** care of changing this register value to non-NULL if the RHS is NULL-free. -** -** If rMayHaveNull is zero, that means that the subquery is being used -** for membership testing only. There is no need to initialize any -** registers to indicate the presence or absence of NULLs on the RHS. -** -** For a SELECT or EXISTS operator, return the register that holds the -** result. For IN operators or if an error occurs, the return value is 0. -*/ -#ifndef SQLITE_OMIT_SUBQUERY -SQLITE_PRIVATE int sqlite3CodeSubselect( - Parse *pParse, /* Parsing context */ - Expr *pExpr, /* The IN, SELECT, or EXISTS operator */ - int rMayHaveNull, /* Register that records whether NULLs exist in RHS */ - int isRowid /* If true, LHS of IN operator is a rowid */ -){ - int testAddr = -1; /* One-time test address */ - int rReg = 0; /* Register storing resulting */ - Vdbe *v = sqlite3GetVdbe(pParse); - if( NEVER(v==0) ) return 0; - sqlite3ExprCachePush(pParse); - - /* This code must be run in its entirety every time it is encountered - ** if any of the following is true: - ** - ** * The right-hand side is a correlated subquery - ** * The right-hand side is an expression list containing variables - ** * We are inside a trigger - ** - ** If all of the above are false, then we can run this code just once - ** save the results, and reuse the same result on subsequent invocations. - */ - if( !ExprHasProperty(pExpr, EP_VarSelect) ){ - testAddr = sqlite3CodeOnce(pParse); - } - -#ifndef SQLITE_OMIT_EXPLAIN - if( pParse->explain==2 ){ - char *zMsg = sqlite3MPrintf( - pParse->db, "EXECUTE %s%s SUBQUERY %d", testAddr>=0?"":"CORRELATED ", - pExpr->op==TK_IN?"LIST":"SCALAR", pParse->iNextSelectId - ); - sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC); - } -#endif - - switch( pExpr->op ){ - case TK_IN: { - char affinity; /* Affinity of the LHS of the IN */ - int addr; /* Address of OP_OpenEphemeral instruction */ - Expr *pLeft = pExpr->pLeft; /* the LHS of the IN operator */ - KeyInfo *pKeyInfo = 0; /* Key information */ - - if( rMayHaveNull ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, rMayHaveNull); - } - - affinity = sqlite3ExprAffinity(pLeft); - - /* Whether this is an 'x IN(SELECT...)' or an 'x IN()' - ** expression it is handled the same way. An ephemeral table is - ** filled with single-field index keys representing the results - ** from the SELECT or the . - ** - ** If the 'x' expression is a column value, or the SELECT... - ** statement returns a column value, then the affinity of that - ** column is used to build the index keys. If both 'x' and the - ** SELECT... statement are columns, then numeric affinity is used - ** if either column has NUMERIC or INTEGER affinity. If neither - ** 'x' nor the SELECT... statement are columns, then numeric affinity - ** is used. - */ - pExpr->iTable = pParse->nTab++; - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pExpr->iTable, !isRowid); - if( rMayHaveNull==0 ) sqlite3VdbeChangeP5(v, BTREE_UNORDERED); - pKeyInfo = isRowid ? 0 : sqlite3KeyInfoAlloc(pParse->db, 1, 1); - - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - /* Case 1: expr IN (SELECT ...) - ** - ** Generate code to write the results of the select into the temporary - ** table allocated and opened above. - */ - SelectDest dest; - ExprList *pEList; - - assert( !isRowid ); - sqlite3SelectDestInit(&dest, SRT_Set, pExpr->iTable); - dest.affSdst = (u8)affinity; - assert( (pExpr->iTable&0x0000FFFF)==pExpr->iTable ); - pExpr->x.pSelect->iLimit = 0; - testcase( pKeyInfo==0 ); /* Caused by OOM in sqlite3KeyInfoAlloc() */ - if( sqlite3Select(pParse, pExpr->x.pSelect, &dest) ){ - sqlite3KeyInfoUnref(pKeyInfo); - return 0; - } - pEList = pExpr->x.pSelect->pEList; - assert( pKeyInfo!=0 ); /* OOM will cause exit after sqlite3Select() */ - assert( pEList!=0 ); - assert( pEList->nExpr>0 ); - assert( sqlite3KeyInfoIsWriteable(pKeyInfo) ); - pKeyInfo->aColl[0] = sqlite3BinaryCompareCollSeq(pParse, pExpr->pLeft, - pEList->a[0].pExpr); - }else if( ALWAYS(pExpr->x.pList!=0) ){ - /* Case 2: expr IN (exprlist) - ** - ** For each expression, build an index key from the evaluation and - ** store it in the temporary table. If is a column, then use - ** that columns affinity when building index keys. If is not - ** a column, use numeric affinity. - */ - int i; - ExprList *pList = pExpr->x.pList; - struct ExprList_item *pItem; - int r1, r2, r3; - - if( !affinity ){ - affinity = SQLITE_AFF_NONE; - } - if( pKeyInfo ){ - assert( sqlite3KeyInfoIsWriteable(pKeyInfo) ); - pKeyInfo->aColl[0] = sqlite3ExprCollSeq(pParse, pExpr->pLeft); - } - - /* Loop through each expression in . */ - r1 = sqlite3GetTempReg(pParse); - r2 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_Null, 0, r2); - for(i=pList->nExpr, pItem=pList->a; i>0; i--, pItem++){ - Expr *pE2 = pItem->pExpr; - int iValToIns; - - /* If the expression is not constant then we will need to - ** disable the test that was generated above that makes sure - ** this code only executes once. Because for a non-constant - ** expression we need to rerun this code each time. - */ - if( testAddr>=0 && !sqlite3ExprIsConstant(pE2) ){ - sqlite3VdbeChangeToNoop(v, testAddr); - testAddr = -1; - } - - /* Evaluate the expression and insert it into the temp table */ - if( isRowid && sqlite3ExprIsInteger(pE2, &iValToIns) ){ - sqlite3VdbeAddOp3(v, OP_InsertInt, pExpr->iTable, r2, iValToIns); - }else{ - r3 = sqlite3ExprCodeTarget(pParse, pE2, r1); - if( isRowid ){ - sqlite3VdbeAddOp2(v, OP_MustBeInt, r3, - sqlite3VdbeCurrentAddr(v)+2); - sqlite3VdbeAddOp3(v, OP_Insert, pExpr->iTable, r2, r3); - }else{ - sqlite3VdbeAddOp4(v, OP_MakeRecord, r3, 1, r2, &affinity, 1); - sqlite3ExprCacheAffinityChange(pParse, r3, 1); - sqlite3VdbeAddOp2(v, OP_IdxInsert, pExpr->iTable, r2); - } - } - } - sqlite3ReleaseTempReg(pParse, r1); - sqlite3ReleaseTempReg(pParse, r2); - } - if( pKeyInfo ){ - sqlite3VdbeChangeP4(v, addr, (void *)pKeyInfo, P4_KEYINFO); - } - break; - } - - case TK_EXISTS: - case TK_SELECT: - default: { - /* If this has to be a scalar SELECT. Generate code to put the - ** value of this select in a memory cell and record the number - ** of the memory cell in iColumn. If this is an EXISTS, write - ** an integer 0 (not exists) or 1 (exists) into a memory cell - ** and record that memory cell in iColumn. - */ - Select *pSel; /* SELECT statement to encode */ - SelectDest dest; /* How to deal with SELECt result */ - - testcase( pExpr->op==TK_EXISTS ); - testcase( pExpr->op==TK_SELECT ); - assert( pExpr->op==TK_EXISTS || pExpr->op==TK_SELECT ); - - assert( ExprHasProperty(pExpr, EP_xIsSelect) ); - pSel = pExpr->x.pSelect; - sqlite3SelectDestInit(&dest, 0, ++pParse->nMem); - if( pExpr->op==TK_SELECT ){ - dest.eDest = SRT_Mem; - sqlite3VdbeAddOp2(v, OP_Null, 0, dest.iSDParm); - VdbeComment((v, "Init subquery result")); - }else{ - dest.eDest = SRT_Exists; - sqlite3VdbeAddOp2(v, OP_Integer, 0, dest.iSDParm); - VdbeComment((v, "Init EXISTS result")); - } - sqlite3ExprDelete(pParse->db, pSel->pLimit); - pSel->pLimit = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, - &sqlite3IntTokens[1]); - pSel->iLimit = 0; - if( sqlite3Select(pParse, pSel, &dest) ){ - return 0; - } - rReg = dest.iSDParm; - ExprSetVVAProperty(pExpr, EP_NoReduce); - break; - } - } - - if( testAddr>=0 ){ - sqlite3VdbeJumpHere(v, testAddr); - } - sqlite3ExprCachePop(pParse, 1); - - return rReg; -} -#endif /* SQLITE_OMIT_SUBQUERY */ - -#ifndef SQLITE_OMIT_SUBQUERY -/* -** Generate code for an IN expression. -** -** x IN (SELECT ...) -** x IN (value, value, ...) -** -** The left-hand side (LHS) is a scalar expression. The right-hand side (RHS) -** is an array of zero or more values. The expression is true if the LHS is -** contained within the RHS. The value of the expression is unknown (NULL) -** if the LHS is NULL or if the LHS is not contained within the RHS and the -** RHS contains one or more NULL values. -** -** This routine generates code will jump to destIfFalse if the LHS is not -** contained within the RHS. If due to NULLs we cannot determine if the LHS -** is contained in the RHS then jump to destIfNull. If the LHS is contained -** within the RHS then fall through. -*/ -static void sqlite3ExprCodeIN( - Parse *pParse, /* Parsing and code generating context */ - Expr *pExpr, /* The IN expression */ - int destIfFalse, /* Jump here if LHS is not contained in the RHS */ - int destIfNull /* Jump here if the results are unknown due to NULLs */ -){ - int rRhsHasNull = 0; /* Register that is true if RHS contains NULL values */ - char affinity; /* Comparison affinity to use */ - int eType; /* Type of the RHS */ - int r1; /* Temporary use register */ - Vdbe *v; /* Statement under construction */ - - /* Compute the RHS. After this step, the table with cursor - ** pExpr->iTable will contains the values that make up the RHS. - */ - v = pParse->pVdbe; - assert( v!=0 ); /* OOM detected prior to this routine */ - VdbeNoopComment((v, "begin IN expr")); - eType = sqlite3FindInIndex(pParse, pExpr, &rRhsHasNull); - - /* Figure out the affinity to use to create a key from the results - ** of the expression. affinityStr stores a static string suitable for - ** P4 of OP_MakeRecord. - */ - affinity = comparisonAffinity(pExpr); - - /* Code the LHS, the from " IN (...)". - */ - sqlite3ExprCachePush(pParse); - r1 = sqlite3GetTempReg(pParse); - sqlite3ExprCode(pParse, pExpr->pLeft, r1); - - /* If the LHS is NULL, then the result is either false or NULL depending - ** on whether the RHS is empty or not, respectively. - */ - if( destIfNull==destIfFalse ){ - /* Shortcut for the common case where the false and NULL outcomes are - ** the same. */ - sqlite3VdbeAddOp2(v, OP_IsNull, r1, destIfNull); - }else{ - int addr1 = sqlite3VdbeAddOp1(v, OP_NotNull, r1); - sqlite3VdbeAddOp2(v, OP_Rewind, pExpr->iTable, destIfFalse); - sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfNull); - sqlite3VdbeJumpHere(v, addr1); - } - - if( eType==IN_INDEX_ROWID ){ - /* In this case, the RHS is the ROWID of table b-tree - */ - sqlite3VdbeAddOp2(v, OP_MustBeInt, r1, destIfFalse); - sqlite3VdbeAddOp3(v, OP_NotExists, pExpr->iTable, destIfFalse, r1); - }else{ - /* In this case, the RHS is an index b-tree. - */ - sqlite3VdbeAddOp4(v, OP_Affinity, r1, 1, 0, &affinity, 1); - - /* If the set membership test fails, then the result of the - ** "x IN (...)" expression must be either 0 or NULL. If the set - ** contains no NULL values, then the result is 0. If the set - ** contains one or more NULL values, then the result of the - ** expression is also NULL. - */ - if( rRhsHasNull==0 || destIfFalse==destIfNull ){ - /* This branch runs if it is known at compile time that the RHS - ** cannot contain NULL values. This happens as the result - ** of a "NOT NULL" constraint in the database schema. - ** - ** Also run this branch if NULL is equivalent to FALSE - ** for this particular IN operator. - */ - sqlite3VdbeAddOp4Int(v, OP_NotFound, pExpr->iTable, destIfFalse, r1, 1); - - }else{ - /* In this branch, the RHS of the IN might contain a NULL and - ** the presence of a NULL on the RHS makes a difference in the - ** outcome. - */ - int j1, j2, j3; - - /* First check to see if the LHS is contained in the RHS. If so, - ** then the presence of NULLs in the RHS does not matter, so jump - ** over all of the code that follows. - */ - j1 = sqlite3VdbeAddOp4Int(v, OP_Found, pExpr->iTable, 0, r1, 1); - - /* Here we begin generating code that runs if the LHS is not - ** contained within the RHS. Generate additional code that - ** tests the RHS for NULLs. If the RHS contains a NULL then - ** jump to destIfNull. If there are no NULLs in the RHS then - ** jump to destIfFalse. - */ - j2 = sqlite3VdbeAddOp1(v, OP_NotNull, rRhsHasNull); - j3 = sqlite3VdbeAddOp4Int(v, OP_Found, pExpr->iTable, 0, rRhsHasNull, 1); - sqlite3VdbeAddOp2(v, OP_Integer, -1, rRhsHasNull); - sqlite3VdbeJumpHere(v, j3); - sqlite3VdbeAddOp2(v, OP_AddImm, rRhsHasNull, 1); - sqlite3VdbeJumpHere(v, j2); - - /* Jump to the appropriate target depending on whether or not - ** the RHS contains a NULL - */ - sqlite3VdbeAddOp2(v, OP_If, rRhsHasNull, destIfNull); - sqlite3VdbeAddOp2(v, OP_Goto, 0, destIfFalse); - - /* The OP_Found at the top of this branch jumps here when true, - ** causing the overall IN expression evaluation to fall through. - */ - sqlite3VdbeJumpHere(v, j1); - } - } - sqlite3ReleaseTempReg(pParse, r1); - sqlite3ExprCachePop(pParse, 1); - VdbeComment((v, "end IN expr")); -} -#endif /* SQLITE_OMIT_SUBQUERY */ - -/* -** Duplicate an 8-byte value -*/ -static char *dup8bytes(Vdbe *v, const char *in){ - char *out = sqlite3DbMallocRaw(sqlite3VdbeDb(v), 8); - if( out ){ - memcpy(out, in, 8); - } - return out; -} - -#ifndef SQLITE_OMIT_FLOATING_POINT -/* -** Generate an instruction that will put the floating point -** value described by z[0..n-1] into register iMem. -** -** The z[] string will probably not be zero-terminated. But the -** z[n] character is guaranteed to be something that does not look -** like the continuation of the number. -*/ -static void codeReal(Vdbe *v, const char *z, int negateFlag, int iMem){ - if( ALWAYS(z!=0) ){ - double value; - char *zV; - sqlite3AtoF(z, &value, sqlite3Strlen30(z), SQLITE_UTF8); - assert( !sqlite3IsNaN(value) ); /* The new AtoF never returns NaN */ - if( negateFlag ) value = -value; - zV = dup8bytes(v, (char*)&value); - sqlite3VdbeAddOp4(v, OP_Real, 0, iMem, 0, zV, P4_REAL); - } -} -#endif - - -/* -** Generate an instruction that will put the integer describe by -** text z[0..n-1] into register iMem. -** -** Expr.u.zToken is always UTF8 and zero-terminated. -*/ -static void codeInteger(Parse *pParse, Expr *pExpr, int negFlag, int iMem){ - Vdbe *v = pParse->pVdbe; - if( pExpr->flags & EP_IntValue ){ - int i = pExpr->u.iValue; - assert( i>=0 ); - if( negFlag ) i = -i; - sqlite3VdbeAddOp2(v, OP_Integer, i, iMem); - }else{ - int c; - i64 value; - const char *z = pExpr->u.zToken; - assert( z!=0 ); - c = sqlite3Atoi64(z, &value, sqlite3Strlen30(z), SQLITE_UTF8); - if( c==0 || (c==2 && negFlag) ){ - char *zV; - if( negFlag ){ value = c==2 ? SMALLEST_INT64 : -value; } - zV = dup8bytes(v, (char*)&value); - sqlite3VdbeAddOp4(v, OP_Int64, 0, iMem, 0, zV, P4_INT64); - }else{ -#ifdef SQLITE_OMIT_FLOATING_POINT - sqlite3ErrorMsg(pParse, "oversized integer: %s%s", negFlag ? "-" : "", z); -#else - codeReal(v, z, negFlag, iMem); -#endif - } - } -} - -/* -** Clear a cache entry. -*/ -static void cacheEntryClear(Parse *pParse, struct yColCache *p){ - if( p->tempReg ){ - if( pParse->nTempRegaTempReg) ){ - pParse->aTempReg[pParse->nTempReg++] = p->iReg; - } - p->tempReg = 0; - } -} - - -/* -** Record in the column cache that a particular column from a -** particular table is stored in a particular register. -*/ -SQLITE_PRIVATE void sqlite3ExprCacheStore(Parse *pParse, int iTab, int iCol, int iReg){ - int i; - int minLru; - int idxLru; - struct yColCache *p; - - assert( iReg>0 ); /* Register numbers are always positive */ - assert( iCol>=-1 && iCol<32768 ); /* Finite column numbers */ - - /* The SQLITE_ColumnCache flag disables the column cache. This is used - ** for testing only - to verify that SQLite always gets the same answer - ** with and without the column cache. - */ - if( OptimizationDisabled(pParse->db, SQLITE_ColumnCache) ) return; - - /* First replace any existing entry. - ** - ** Actually, the way the column cache is currently used, we are guaranteed - ** that the object will never already be in cache. Verify this guarantee. - */ -#ifndef NDEBUG - for(i=0, p=pParse->aColCache; iiReg==0 || p->iTable!=iTab || p->iColumn!=iCol ); - } -#endif - - /* Find an empty slot and replace it */ - for(i=0, p=pParse->aColCache; iiReg==0 ){ - p->iLevel = pParse->iCacheLevel; - p->iTable = iTab; - p->iColumn = iCol; - p->iReg = iReg; - p->tempReg = 0; - p->lru = pParse->iCacheCnt++; - return; - } - } - - /* Replace the last recently used */ - minLru = 0x7fffffff; - idxLru = -1; - for(i=0, p=pParse->aColCache; ilrulru; - } - } - if( ALWAYS(idxLru>=0) ){ - p = &pParse->aColCache[idxLru]; - p->iLevel = pParse->iCacheLevel; - p->iTable = iTab; - p->iColumn = iCol; - p->iReg = iReg; - p->tempReg = 0; - p->lru = pParse->iCacheCnt++; - return; - } -} - -/* -** Indicate that registers between iReg..iReg+nReg-1 are being overwritten. -** Purge the range of registers from the column cache. -*/ -SQLITE_PRIVATE void sqlite3ExprCacheRemove(Parse *pParse, int iReg, int nReg){ - int i; - int iLast = iReg + nReg - 1; - struct yColCache *p; - for(i=0, p=pParse->aColCache; iiReg; - if( r>=iReg && r<=iLast ){ - cacheEntryClear(pParse, p); - p->iReg = 0; - } - } -} - -/* -** Remember the current column cache context. Any new entries added -** added to the column cache after this call are removed when the -** corresponding pop occurs. -*/ -SQLITE_PRIVATE void sqlite3ExprCachePush(Parse *pParse){ - pParse->iCacheLevel++; -#ifdef SQLITE_DEBUG - if( pParse->db->flags & SQLITE_VdbeAddopTrace ){ - printf("PUSH to %d\n", pParse->iCacheLevel); - } -#endif -} - -/* -** Remove from the column cache any entries that were added since the -** the previous N Push operations. In other words, restore the cache -** to the state it was in N Pushes ago. -*/ -SQLITE_PRIVATE void sqlite3ExprCachePop(Parse *pParse, int N){ - int i; - struct yColCache *p; - assert( N>0 ); - assert( pParse->iCacheLevel>=N ); - pParse->iCacheLevel -= N; -#ifdef SQLITE_DEBUG - if( pParse->db->flags & SQLITE_VdbeAddopTrace ){ - printf("POP to %d\n", pParse->iCacheLevel); - } -#endif - for(i=0, p=pParse->aColCache; iiReg && p->iLevel>pParse->iCacheLevel ){ - cacheEntryClear(pParse, p); - p->iReg = 0; - } - } -} - -/* -** When a cached column is reused, make sure that its register is -** no longer available as a temp register. ticket #3879: that same -** register might be in the cache in multiple places, so be sure to -** get them all. -*/ -static void sqlite3ExprCachePinRegister(Parse *pParse, int iReg){ - int i; - struct yColCache *p; - for(i=0, p=pParse->aColCache; iiReg==iReg ){ - p->tempReg = 0; - } - } -} - -/* -** Generate code to extract the value of the iCol-th column of a table. -*/ -SQLITE_PRIVATE void sqlite3ExprCodeGetColumnOfTable( - Vdbe *v, /* The VDBE under construction */ - Table *pTab, /* The table containing the value */ - int iTabCur, /* The table cursor. Or the PK cursor for WITHOUT ROWID */ - int iCol, /* Index of the column to extract */ - int regOut /* Extract the value into this register */ -){ - if( iCol<0 || iCol==pTab->iPKey ){ - sqlite3VdbeAddOp2(v, OP_Rowid, iTabCur, regOut); - }else{ - int op = IsVirtual(pTab) ? OP_VColumn : OP_Column; - int x = iCol; - if( !HasRowid(pTab) ){ - x = sqlite3ColumnOfIndex(sqlite3PrimaryKeyIndex(pTab), iCol); - } - sqlite3VdbeAddOp3(v, op, iTabCur, x, regOut); - } - if( iCol>=0 ){ - sqlite3ColumnDefault(v, pTab, iCol, regOut); - } -} - -/* -** Generate code that will extract the iColumn-th column from -** table pTab and store the column value in a register. An effort -** is made to store the column value in register iReg, but this is -** not guaranteed. The location of the column value is returned. -** -** There must be an open cursor to pTab in iTable when this routine -** is called. If iColumn<0 then code is generated that extracts the rowid. -*/ -SQLITE_PRIVATE int sqlite3ExprCodeGetColumn( - Parse *pParse, /* Parsing and code generating context */ - Table *pTab, /* Description of the table we are reading from */ - int iColumn, /* Index of the table column */ - int iTable, /* The cursor pointing to the table */ - int iReg, /* Store results here */ - u8 p5 /* P5 value for OP_Column */ -){ - Vdbe *v = pParse->pVdbe; - int i; - struct yColCache *p; - - for(i=0, p=pParse->aColCache; iiReg>0 && p->iTable==iTable && p->iColumn==iColumn ){ - p->lru = pParse->iCacheCnt++; - sqlite3ExprCachePinRegister(pParse, p->iReg); - return p->iReg; - } - } - assert( v!=0 ); - sqlite3ExprCodeGetColumnOfTable(v, pTab, iTable, iColumn, iReg); - if( p5 ){ - sqlite3VdbeChangeP5(v, p5); - }else{ - sqlite3ExprCacheStore(pParse, iTable, iColumn, iReg); - } - return iReg; -} - -/* -** Clear all column cache entries. -*/ -SQLITE_PRIVATE void sqlite3ExprCacheClear(Parse *pParse){ - int i; - struct yColCache *p; - -#if SQLITE_DEBUG - if( pParse->db->flags & SQLITE_VdbeAddopTrace ){ - printf("CLEAR\n"); - } -#endif - for(i=0, p=pParse->aColCache; iiReg ){ - cacheEntryClear(pParse, p); - p->iReg = 0; - } - } -} - -/* -** Record the fact that an affinity change has occurred on iCount -** registers starting with iStart. -*/ -SQLITE_PRIVATE void sqlite3ExprCacheAffinityChange(Parse *pParse, int iStart, int iCount){ - sqlite3ExprCacheRemove(pParse, iStart, iCount); -} - -/* -** Generate code to move content from registers iFrom...iFrom+nReg-1 -** over to iTo..iTo+nReg-1. Keep the column cache up-to-date. -*/ -SQLITE_PRIVATE void sqlite3ExprCodeMove(Parse *pParse, int iFrom, int iTo, int nReg){ - int i; - struct yColCache *p; - assert( iFrom>=iTo+nReg || iFrom+nReg<=iTo ); - sqlite3VdbeAddOp3(pParse->pVdbe, OP_Move, iFrom, iTo, nReg-1); - for(i=0, p=pParse->aColCache; iiReg; - if( x>=iFrom && xiReg += iTo-iFrom; - } - } -} - -#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) -/* -** Return true if any register in the range iFrom..iTo (inclusive) -** is used as part of the column cache. -** -** This routine is used within assert() and testcase() macros only -** and does not appear in a normal build. -*/ -static int usedAsColumnCache(Parse *pParse, int iFrom, int iTo){ - int i; - struct yColCache *p; - for(i=0, p=pParse->aColCache; iiReg; - if( r>=iFrom && r<=iTo ) return 1; /*NO_TEST*/ - } - return 0; -} -#endif /* SQLITE_DEBUG || SQLITE_COVERAGE_TEST */ - -/* -** Convert an expression node to a TK_REGISTER -*/ -static void exprToRegister(Expr *p, int iReg){ - p->op2 = p->op; - p->op = TK_REGISTER; - p->iTable = iReg; - ExprClearProperty(p, EP_Skip); -} - -/* -** Generate code into the current Vdbe to evaluate the given -** expression. Attempt to store the results in register "target". -** Return the register where results are stored. -** -** With this routine, there is no guarantee that results will -** be stored in target. The result might be stored in some other -** register if it is convenient to do so. The calling function -** must check the return code and move the results to the desired -** register. -*/ -SQLITE_PRIVATE int sqlite3ExprCodeTarget(Parse *pParse, Expr *pExpr, int target){ - Vdbe *v = pParse->pVdbe; /* The VM under construction */ - int op; /* The opcode being coded */ - int inReg = target; /* Results stored in register inReg */ - int regFree1 = 0; /* If non-zero free this temporary register */ - int regFree2 = 0; /* If non-zero free this temporary register */ - int r1, r2, r3, r4; /* Various register numbers */ - sqlite3 *db = pParse->db; /* The database connection */ - Expr tempX; /* Temporary expression node */ - - assert( target>0 && target<=pParse->nMem ); - if( v==0 ){ - assert( pParse->db->mallocFailed ); - return 0; - } - - if( pExpr==0 ){ - op = TK_NULL; - }else{ - op = pExpr->op; - } - switch( op ){ - case TK_AGG_COLUMN: { - AggInfo *pAggInfo = pExpr->pAggInfo; - struct AggInfo_col *pCol = &pAggInfo->aCol[pExpr->iAgg]; - if( !pAggInfo->directMode ){ - assert( pCol->iMem>0 ); - inReg = pCol->iMem; - break; - }else if( pAggInfo->useSortingIdx ){ - sqlite3VdbeAddOp3(v, OP_Column, pAggInfo->sortingIdxPTab, - pCol->iSorterColumn, target); - break; - } - /* Otherwise, fall thru into the TK_COLUMN case */ - } - case TK_COLUMN: { - int iTab = pExpr->iTable; - if( iTab<0 ){ - if( pParse->ckBase>0 ){ - /* Generating CHECK constraints or inserting into partial index */ - inReg = pExpr->iColumn + pParse->ckBase; - break; - }else{ - /* Deleting from a partial index */ - iTab = pParse->iPartIdxTab; - } - } - inReg = sqlite3ExprCodeGetColumn(pParse, pExpr->pTab, - pExpr->iColumn, iTab, target, - pExpr->op2); - break; - } - case TK_INTEGER: { - codeInteger(pParse, pExpr, 0, target); - break; - } -#ifndef SQLITE_OMIT_FLOATING_POINT - case TK_FLOAT: { - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - codeReal(v, pExpr->u.zToken, 0, target); - break; - } -#endif - case TK_STRING: { - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - sqlite3VdbeAddOp4(v, OP_String8, 0, target, 0, pExpr->u.zToken, 0); - break; - } - case TK_NULL: { - sqlite3VdbeAddOp2(v, OP_Null, 0, target); - break; - } -#ifndef SQLITE_OMIT_BLOB_LITERAL - case TK_BLOB: { - int n; - const char *z; - char *zBlob; - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - assert( pExpr->u.zToken[0]=='x' || pExpr->u.zToken[0]=='X' ); - assert( pExpr->u.zToken[1]=='\'' ); - z = &pExpr->u.zToken[2]; - n = sqlite3Strlen30(z) - 1; - assert( z[n]=='\'' ); - zBlob = sqlite3HexToBlob(sqlite3VdbeDb(v), z, n); - sqlite3VdbeAddOp4(v, OP_Blob, n/2, target, 0, zBlob, P4_DYNAMIC); - break; - } -#endif - case TK_VARIABLE: { - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - assert( pExpr->u.zToken!=0 ); - assert( pExpr->u.zToken[0]!=0 ); - sqlite3VdbeAddOp2(v, OP_Variable, pExpr->iColumn, target); - if( pExpr->u.zToken[1]!=0 ){ - assert( pExpr->u.zToken[0]=='?' - || strcmp(pExpr->u.zToken, pParse->azVar[pExpr->iColumn-1])==0 ); - sqlite3VdbeChangeP4(v, -1, pParse->azVar[pExpr->iColumn-1], P4_STATIC); - } - break; - } - case TK_REGISTER: { - inReg = pExpr->iTable; - break; - } - case TK_AS: { - inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); - break; - } -#ifndef SQLITE_OMIT_CAST - case TK_CAST: { - /* Expressions of the form: CAST(pLeft AS token) */ - int aff, to_op; - inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - aff = sqlite3AffinityType(pExpr->u.zToken, 0); - to_op = aff - SQLITE_AFF_TEXT + OP_ToText; - assert( to_op==OP_ToText || aff!=SQLITE_AFF_TEXT ); - assert( to_op==OP_ToBlob || aff!=SQLITE_AFF_NONE ); - assert( to_op==OP_ToNumeric || aff!=SQLITE_AFF_NUMERIC ); - assert( to_op==OP_ToInt || aff!=SQLITE_AFF_INTEGER ); - assert( to_op==OP_ToReal || aff!=SQLITE_AFF_REAL ); - testcase( to_op==OP_ToText ); - testcase( to_op==OP_ToBlob ); - testcase( to_op==OP_ToNumeric ); - testcase( to_op==OP_ToInt ); - testcase( to_op==OP_ToReal ); - if( inReg!=target ){ - sqlite3VdbeAddOp2(v, OP_SCopy, inReg, target); - inReg = target; - } - sqlite3VdbeAddOp1(v, to_op, inReg); - testcase( usedAsColumnCache(pParse, inReg, inReg) ); - sqlite3ExprCacheAffinityChange(pParse, inReg, 1); - break; - } -#endif /* SQLITE_OMIT_CAST */ - case TK_LT: - case TK_LE: - case TK_GT: - case TK_GE: - case TK_NE: - case TK_EQ: { - assert( TK_LT==OP_Lt ); - assert( TK_LE==OP_Le ); - assert( TK_GT==OP_Gt ); - assert( TK_GE==OP_Ge ); - assert( TK_EQ==OP_Eq ); - assert( TK_NE==OP_Ne ); - testcase( op==TK_LT ); - testcase( op==TK_LE ); - testcase( op==TK_GT ); - testcase( op==TK_GE ); - testcase( op==TK_EQ ); - testcase( op==TK_NE ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, - r1, r2, inReg, SQLITE_STOREP2); - testcase( regFree1==0 ); - testcase( regFree2==0 ); - break; - } - case TK_IS: - case TK_ISNOT: { - testcase( op==TK_IS ); - testcase( op==TK_ISNOT ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - op = (op==TK_IS) ? TK_EQ : TK_NE; - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, - r1, r2, inReg, SQLITE_STOREP2 | SQLITE_NULLEQ); - testcase( regFree1==0 ); - testcase( regFree2==0 ); - break; - } - case TK_AND: - case TK_OR: - case TK_PLUS: - case TK_STAR: - case TK_MINUS: - case TK_REM: - case TK_BITAND: - case TK_BITOR: - case TK_SLASH: - case TK_LSHIFT: - case TK_RSHIFT: - case TK_CONCAT: { - assert( TK_AND==OP_And ); - assert( TK_OR==OP_Or ); - assert( TK_PLUS==OP_Add ); - assert( TK_MINUS==OP_Subtract ); - assert( TK_REM==OP_Remainder ); - assert( TK_BITAND==OP_BitAnd ); - assert( TK_BITOR==OP_BitOr ); - assert( TK_SLASH==OP_Divide ); - assert( TK_LSHIFT==OP_ShiftLeft ); - assert( TK_RSHIFT==OP_ShiftRight ); - assert( TK_CONCAT==OP_Concat ); - testcase( op==TK_AND ); - testcase( op==TK_OR ); - testcase( op==TK_PLUS ); - testcase( op==TK_MINUS ); - testcase( op==TK_REM ); - testcase( op==TK_BITAND ); - testcase( op==TK_BITOR ); - testcase( op==TK_SLASH ); - testcase( op==TK_LSHIFT ); - testcase( op==TK_RSHIFT ); - testcase( op==TK_CONCAT ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - sqlite3VdbeAddOp3(v, op, r2, r1, target); - testcase( regFree1==0 ); - testcase( regFree2==0 ); - break; - } - case TK_UMINUS: { - Expr *pLeft = pExpr->pLeft; - assert( pLeft ); - if( pLeft->op==TK_INTEGER ){ - codeInteger(pParse, pLeft, 1, target); -#ifndef SQLITE_OMIT_FLOATING_POINT - }else if( pLeft->op==TK_FLOAT ){ - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - codeReal(v, pLeft->u.zToken, 1, target); -#endif - }else{ - tempX.op = TK_INTEGER; - tempX.flags = EP_IntValue|EP_TokenOnly; - tempX.u.iValue = 0; - r1 = sqlite3ExprCodeTemp(pParse, &tempX, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free2); - sqlite3VdbeAddOp3(v, OP_Subtract, r2, r1, target); - testcase( regFree2==0 ); - } - inReg = target; - break; - } - case TK_BITNOT: - case TK_NOT: { - assert( TK_BITNOT==OP_BitNot ); - assert( TK_NOT==OP_Not ); - testcase( op==TK_BITNOT ); - testcase( op==TK_NOT ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - testcase( regFree1==0 ); - inReg = target; - sqlite3VdbeAddOp2(v, op, r1, inReg); - break; - } - case TK_ISNULL: - case TK_NOTNULL: { - int addr; - assert( TK_ISNULL==OP_IsNull ); - assert( TK_NOTNULL==OP_NotNull ); - testcase( op==TK_ISNULL ); - testcase( op==TK_NOTNULL ); - sqlite3VdbeAddOp2(v, OP_Integer, 1, target); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - testcase( regFree1==0 ); - addr = sqlite3VdbeAddOp1(v, op, r1); - sqlite3VdbeAddOp2(v, OP_AddImm, target, -1); - sqlite3VdbeJumpHere(v, addr); - break; - } - case TK_AGG_FUNCTION: { - AggInfo *pInfo = pExpr->pAggInfo; - if( pInfo==0 ){ - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - sqlite3ErrorMsg(pParse, "misuse of aggregate: %s()", pExpr->u.zToken); - }else{ - inReg = pInfo->aFunc[pExpr->iAgg].iMem; - } - break; - } - case TK_FUNCTION: { - ExprList *pFarg; /* List of function arguments */ - int nFarg; /* Number of function arguments */ - FuncDef *pDef; /* The function definition object */ - int nId; /* Length of the function name in bytes */ - const char *zId; /* The function name */ - u32 constMask = 0; /* Mask of function arguments that are constant */ - int i; /* Loop counter */ - u8 enc = ENC(db); /* The text encoding used by this database */ - CollSeq *pColl = 0; /* A collating sequence */ - - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); - if( ExprHasProperty(pExpr, EP_TokenOnly) ){ - pFarg = 0; - }else{ - pFarg = pExpr->x.pList; - } - nFarg = pFarg ? pFarg->nExpr : 0; - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - zId = pExpr->u.zToken; - nId = sqlite3Strlen30(zId); - pDef = sqlite3FindFunction(db, zId, nId, nFarg, enc, 0); - if( pDef==0 ){ - sqlite3ErrorMsg(pParse, "unknown function: %.*s()", nId, zId); - break; - } - - /* Attempt a direct implementation of the built-in COALESCE() and - ** IFNULL() functions. This avoids unnecessary evalation of - ** arguments past the first non-NULL argument. - */ - if( pDef->funcFlags & SQLITE_FUNC_COALESCE ){ - int endCoalesce = sqlite3VdbeMakeLabel(v); - assert( nFarg>=2 ); - sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target); - for(i=1; ia[i].pExpr, target); - sqlite3ExprCachePop(pParse, 1); - } - sqlite3VdbeResolveLabel(v, endCoalesce); - break; - } - - /* The UNLIKELY() function is a no-op. The result is the value - ** of the first argument. - */ - if( pDef->funcFlags & SQLITE_FUNC_UNLIKELY ){ - assert( nFarg>=1 ); - sqlite3ExprCode(pParse, pFarg->a[0].pExpr, target); - break; - } - - for(i=0; ia[i].pExpr) ){ - testcase( i==31 ); - constMask |= MASKBIT32(i); - } - if( (pDef->funcFlags & SQLITE_FUNC_NEEDCOLL)!=0 && !pColl ){ - pColl = sqlite3ExprCollSeq(pParse, pFarg->a[i].pExpr); - } - } - if( pFarg ){ - if( constMask ){ - r1 = pParse->nMem+1; - pParse->nMem += nFarg; - }else{ - r1 = sqlite3GetTempRange(pParse, nFarg); - } - - /* For length() and typeof() functions with a column argument, - ** set the P5 parameter to the OP_Column opcode to OPFLAG_LENGTHARG - ** or OPFLAG_TYPEOFARG respectively, to avoid unnecessary data - ** loading. - */ - if( (pDef->funcFlags & (SQLITE_FUNC_LENGTH|SQLITE_FUNC_TYPEOF))!=0 ){ - u8 exprOp; - assert( nFarg==1 ); - assert( pFarg->a[0].pExpr!=0 ); - exprOp = pFarg->a[0].pExpr->op; - if( exprOp==TK_COLUMN || exprOp==TK_AGG_COLUMN ){ - assert( SQLITE_FUNC_LENGTH==OPFLAG_LENGTHARG ); - assert( SQLITE_FUNC_TYPEOF==OPFLAG_TYPEOFARG ); - testcase( pDef->funcFlags & OPFLAG_LENGTHARG ); - pFarg->a[0].pExpr->op2 = - pDef->funcFlags & (OPFLAG_LENGTHARG|OPFLAG_TYPEOFARG); - } - } - - sqlite3ExprCachePush(pParse); /* Ticket 2ea2425d34be */ - sqlite3ExprCodeExprList(pParse, pFarg, r1, - SQLITE_ECEL_DUP|SQLITE_ECEL_FACTOR); - sqlite3ExprCachePop(pParse, 1); /* Ticket 2ea2425d34be */ - }else{ - r1 = 0; - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - /* Possibly overload the function if the first argument is - ** a virtual table column. - ** - ** For infix functions (LIKE, GLOB, REGEXP, and MATCH) use the - ** second argument, not the first, as the argument to test to - ** see if it is a column in a virtual table. This is done because - ** the left operand of infix functions (the operand we want to - ** control overloading) ends up as the second argument to the - ** function. The expression "A glob B" is equivalent to - ** "glob(B,A). We want to use the A in "A glob B" to test - ** for function overloading. But we use the B term in "glob(B,A)". - */ - if( nFarg>=2 && (pExpr->flags & EP_InfixFunc) ){ - pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[1].pExpr); - }else if( nFarg>0 ){ - pDef = sqlite3VtabOverloadFunction(db, pDef, nFarg, pFarg->a[0].pExpr); - } -#endif - if( pDef->funcFlags & SQLITE_FUNC_NEEDCOLL ){ - if( !pColl ) pColl = db->pDfltColl; - sqlite3VdbeAddOp4(v, OP_CollSeq, 0, 0, 0, (char *)pColl, P4_COLLSEQ); - } - sqlite3VdbeAddOp4(v, OP_Function, constMask, r1, target, - (char*)pDef, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, (u8)nFarg); - if( nFarg && constMask==0 ){ - sqlite3ReleaseTempRange(pParse, r1, nFarg); - } - break; - } -#ifndef SQLITE_OMIT_SUBQUERY - case TK_EXISTS: - case TK_SELECT: { - testcase( op==TK_EXISTS ); - testcase( op==TK_SELECT ); - inReg = sqlite3CodeSubselect(pParse, pExpr, 0, 0); - break; - } - case TK_IN: { - int destIfFalse = sqlite3VdbeMakeLabel(v); - int destIfNull = sqlite3VdbeMakeLabel(v); - sqlite3VdbeAddOp2(v, OP_Null, 0, target); - sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull); - sqlite3VdbeAddOp2(v, OP_Integer, 1, target); - sqlite3VdbeResolveLabel(v, destIfFalse); - sqlite3VdbeAddOp2(v, OP_AddImm, target, 0); - sqlite3VdbeResolveLabel(v, destIfNull); - break; - } -#endif /* SQLITE_OMIT_SUBQUERY */ - - - /* - ** x BETWEEN y AND z - ** - ** This is equivalent to - ** - ** x>=y AND x<=z - ** - ** X is stored in pExpr->pLeft. - ** Y is stored in pExpr->pList->a[0].pExpr. - ** Z is stored in pExpr->pList->a[1].pExpr. - */ - case TK_BETWEEN: { - Expr *pLeft = pExpr->pLeft; - struct ExprList_item *pLItem = pExpr->x.pList->a; - Expr *pRight = pLItem->pExpr; - - r1 = sqlite3ExprCodeTemp(pParse, pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pRight, ®Free2); - testcase( regFree1==0 ); - testcase( regFree2==0 ); - r3 = sqlite3GetTempReg(pParse); - r4 = sqlite3GetTempReg(pParse); - codeCompare(pParse, pLeft, pRight, OP_Ge, - r1, r2, r3, SQLITE_STOREP2); - pLItem++; - pRight = pLItem->pExpr; - sqlite3ReleaseTempReg(pParse, regFree2); - r2 = sqlite3ExprCodeTemp(pParse, pRight, ®Free2); - testcase( regFree2==0 ); - codeCompare(pParse, pLeft, pRight, OP_Le, r1, r2, r4, SQLITE_STOREP2); - sqlite3VdbeAddOp3(v, OP_And, r3, r4, target); - sqlite3ReleaseTempReg(pParse, r3); - sqlite3ReleaseTempReg(pParse, r4); - break; - } - case TK_COLLATE: - case TK_UPLUS: { - inReg = sqlite3ExprCodeTarget(pParse, pExpr->pLeft, target); - break; - } - - case TK_TRIGGER: { - /* If the opcode is TK_TRIGGER, then the expression is a reference - ** to a column in the new.* or old.* pseudo-tables available to - ** trigger programs. In this case Expr.iTable is set to 1 for the - ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn - ** is set to the column of the pseudo-table to read, or to -1 to - ** read the rowid field. - ** - ** The expression is implemented using an OP_Param opcode. The p1 - ** parameter is set to 0 for an old.rowid reference, or to (i+1) - ** to reference another column of the old.* pseudo-table, where - ** i is the index of the column. For a new.rowid reference, p1 is - ** set to (n+1), where n is the number of columns in each pseudo-table. - ** For a reference to any other column in the new.* pseudo-table, p1 - ** is set to (n+2+i), where n and i are as defined previously. For - ** example, if the table on which triggers are being fired is - ** declared as: - ** - ** CREATE TABLE t1(a, b); - ** - ** Then p1 is interpreted as follows: - ** - ** p1==0 -> old.rowid p1==3 -> new.rowid - ** p1==1 -> old.a p1==4 -> new.a - ** p1==2 -> old.b p1==5 -> new.b - */ - Table *pTab = pExpr->pTab; - int p1 = pExpr->iTable * (pTab->nCol+1) + 1 + pExpr->iColumn; - - assert( pExpr->iTable==0 || pExpr->iTable==1 ); - assert( pExpr->iColumn>=-1 && pExpr->iColumnnCol ); - assert( pTab->iPKey<0 || pExpr->iColumn!=pTab->iPKey ); - assert( p1>=0 && p1<(pTab->nCol*2+2) ); - - sqlite3VdbeAddOp2(v, OP_Param, p1, target); - VdbeComment((v, "%s.%s -> $%d", - (pExpr->iTable ? "new" : "old"), - (pExpr->iColumn<0 ? "rowid" : pExpr->pTab->aCol[pExpr->iColumn].zName), - target - )); - -#ifndef SQLITE_OMIT_FLOATING_POINT - /* If the column has REAL affinity, it may currently be stored as an - ** integer. Use OP_RealAffinity to make sure it is really real. */ - if( pExpr->iColumn>=0 - && pTab->aCol[pExpr->iColumn].affinity==SQLITE_AFF_REAL - ){ - sqlite3VdbeAddOp1(v, OP_RealAffinity, target); - } -#endif - break; - } - - - /* - ** Form A: - ** CASE x WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END - ** - ** Form B: - ** CASE WHEN e1 THEN r1 WHEN e2 THEN r2 ... WHEN eN THEN rN ELSE y END - ** - ** Form A is can be transformed into the equivalent form B as follows: - ** CASE WHEN x=e1 THEN r1 WHEN x=e2 THEN r2 ... - ** WHEN x=eN THEN rN ELSE y END - ** - ** X (if it exists) is in pExpr->pLeft. - ** Y is in the last element of pExpr->x.pList if pExpr->x.pList->nExpr is - ** odd. The Y is also optional. If the number of elements in x.pList - ** is even, then Y is omitted and the "otherwise" result is NULL. - ** Ei is in pExpr->pList->a[i*2] and Ri is pExpr->pList->a[i*2+1]. - ** - ** The result of the expression is the Ri for the first matching Ei, - ** or if there is no matching Ei, the ELSE term Y, or if there is - ** no ELSE term, NULL. - */ - default: assert( op==TK_CASE ); { - int endLabel; /* GOTO label for end of CASE stmt */ - int nextCase; /* GOTO label for next WHEN clause */ - int nExpr; /* 2x number of WHEN terms */ - int i; /* Loop counter */ - ExprList *pEList; /* List of WHEN terms */ - struct ExprList_item *aListelem; /* Array of WHEN terms */ - Expr opCompare; /* The X==Ei expression */ - Expr *pX; /* The X expression */ - Expr *pTest = 0; /* X==Ei (form A) or just Ei (form B) */ - VVA_ONLY( int iCacheLevel = pParse->iCacheLevel; ) - - assert( !ExprHasProperty(pExpr, EP_xIsSelect) && pExpr->x.pList ); - assert(pExpr->x.pList->nExpr > 0); - pEList = pExpr->x.pList; - aListelem = pEList->a; - nExpr = pEList->nExpr; - endLabel = sqlite3VdbeMakeLabel(v); - if( (pX = pExpr->pLeft)!=0 ){ - tempX = *pX; - testcase( pX->op==TK_COLUMN ); - exprToRegister(&tempX, sqlite3ExprCodeTemp(pParse, pX, ®Free1)); - testcase( regFree1==0 ); - opCompare.op = TK_EQ; - opCompare.pLeft = &tempX; - pTest = &opCompare; - /* Ticket b351d95f9cd5ef17e9d9dbae18f5ca8611190001: - ** The value in regFree1 might get SCopy-ed into the file result. - ** So make sure that the regFree1 register is not reused for other - ** purposes and possibly overwritten. */ - regFree1 = 0; - } - for(i=0; iop==TK_COLUMN ); - sqlite3ExprIfFalse(pParse, pTest, nextCase, SQLITE_JUMPIFNULL); - testcase( aListelem[i+1].pExpr->op==TK_COLUMN ); - sqlite3ExprCode(pParse, aListelem[i+1].pExpr, target); - sqlite3VdbeAddOp2(v, OP_Goto, 0, endLabel); - sqlite3ExprCachePop(pParse, 1); - sqlite3VdbeResolveLabel(v, nextCase); - } - if( (nExpr&1)!=0 ){ - sqlite3ExprCachePush(pParse); - sqlite3ExprCode(pParse, pEList->a[nExpr-1].pExpr, target); - sqlite3ExprCachePop(pParse, 1); - }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, target); - } - assert( db->mallocFailed || pParse->nErr>0 - || pParse->iCacheLevel==iCacheLevel ); - sqlite3VdbeResolveLabel(v, endLabel); - break; - } -#ifndef SQLITE_OMIT_TRIGGER - case TK_RAISE: { - assert( pExpr->affinity==OE_Rollback - || pExpr->affinity==OE_Abort - || pExpr->affinity==OE_Fail - || pExpr->affinity==OE_Ignore - ); - if( !pParse->pTriggerTab ){ - sqlite3ErrorMsg(pParse, - "RAISE() may only be used within a trigger-program"); - return 0; - } - if( pExpr->affinity==OE_Abort ){ - sqlite3MayAbort(pParse); - } - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - if( pExpr->affinity==OE_Ignore ){ - sqlite3VdbeAddOp4( - v, OP_Halt, SQLITE_OK, OE_Ignore, 0, pExpr->u.zToken,0); - }else{ - sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_TRIGGER, - pExpr->affinity, pExpr->u.zToken, 0, 0); - } - - break; - } -#endif - } - sqlite3ReleaseTempReg(pParse, regFree1); - sqlite3ReleaseTempReg(pParse, regFree2); - return inReg; -} - -/* -** Factor out the code of the given expression to initialization time. -*/ -SQLITE_PRIVATE void sqlite3ExprCodeAtInit( - Parse *pParse, /* Parsing context */ - Expr *pExpr, /* The expression to code when the VDBE initializes */ - int regDest, /* Store the value in this register */ - u8 reusable /* True if this expression is reusable */ -){ - ExprList *p; - assert( ConstFactorOk(pParse) ); - p = pParse->pConstExpr; - pExpr = sqlite3ExprDup(pParse->db, pExpr, 0); - p = sqlite3ExprListAppend(pParse, p, pExpr); - if( p ){ - struct ExprList_item *pItem = &p->a[p->nExpr-1]; - pItem->u.iConstExprReg = regDest; - pItem->reusable = reusable; - } - pParse->pConstExpr = p; -} - -/* -** Generate code to evaluate an expression and store the results -** into a register. Return the register number where the results -** are stored. -** -** If the register is a temporary register that can be deallocated, -** then write its number into *pReg. If the result register is not -** a temporary, then set *pReg to zero. -** -** If pExpr is a constant, then this routine might generate this -** code to fill the register in the initialization section of the -** VDBE program, in order to factor it out of the evaluation loop. -*/ -SQLITE_PRIVATE int sqlite3ExprCodeTemp(Parse *pParse, Expr *pExpr, int *pReg){ - int r2; - pExpr = sqlite3ExprSkipCollate(pExpr); - if( ConstFactorOk(pParse) - && pExpr->op!=TK_REGISTER - && sqlite3ExprIsConstantNotJoin(pExpr) - ){ - ExprList *p = pParse->pConstExpr; - int i; - *pReg = 0; - if( p ){ - struct ExprList_item *pItem; - for(pItem=p->a, i=p->nExpr; i>0; pItem++, i--){ - if( pItem->reusable && sqlite3ExprCompare(pItem->pExpr,pExpr,-1)==0 ){ - return pItem->u.iConstExprReg; - } - } - } - r2 = ++pParse->nMem; - sqlite3ExprCodeAtInit(pParse, pExpr, r2, 1); - }else{ - int r1 = sqlite3GetTempReg(pParse); - r2 = sqlite3ExprCodeTarget(pParse, pExpr, r1); - if( r2==r1 ){ - *pReg = r1; - }else{ - sqlite3ReleaseTempReg(pParse, r1); - *pReg = 0; - } - } - return r2; -} - -/* -** Generate code that will evaluate expression pExpr and store the -** results in register target. The results are guaranteed to appear -** in register target. -*/ -SQLITE_PRIVATE int sqlite3ExprCode(Parse *pParse, Expr *pExpr, int target){ - int inReg; - - assert( target>0 && target<=pParse->nMem ); - if( pExpr && pExpr->op==TK_REGISTER ){ - sqlite3VdbeAddOp2(pParse->pVdbe, OP_Copy, pExpr->iTable, target); - }else{ - inReg = sqlite3ExprCodeTarget(pParse, pExpr, target); - assert( pParse->pVdbe || pParse->db->mallocFailed ); - if( inReg!=target && pParse->pVdbe ){ - sqlite3VdbeAddOp2(pParse->pVdbe, OP_SCopy, inReg, target); - } - } - return target; -} - -/* -** Generate code that evalutes the given expression and puts the result -** in register target. -** -** Also make a copy of the expression results into another "cache" register -** and modify the expression so that the next time it is evaluated, -** the result is a copy of the cache register. -** -** This routine is used for expressions that are used multiple -** times. They are evaluated once and the results of the expression -** are reused. -*/ -SQLITE_PRIVATE int sqlite3ExprCodeAndCache(Parse *pParse, Expr *pExpr, int target){ - Vdbe *v = pParse->pVdbe; - int inReg; - inReg = sqlite3ExprCode(pParse, pExpr, target); - assert( target>0 ); - /* The only place, other than this routine, where expressions can be - ** converted to TK_REGISTER is internal subexpressions in BETWEEN and - ** CASE operators. Neither ever calls this routine. And this routine - ** is never called twice on the same expression. Hence it is impossible - ** for the input to this routine to already be a register. Nevertheless, - ** it seems prudent to keep the ALWAYS() in case the conditions above - ** change with future modifications or enhancements. */ - if( ALWAYS(pExpr->op!=TK_REGISTER) ){ - int iMem; - iMem = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Copy, inReg, iMem); - exprToRegister(pExpr, iMem); - } - return inReg; -} - -#if defined(SQLITE_ENABLE_TREE_EXPLAIN) -/* -** Generate a human-readable explanation of an expression tree. -*/ -SQLITE_PRIVATE void sqlite3ExplainExpr(Vdbe *pOut, Expr *pExpr){ - int op; /* The opcode being coded */ - const char *zBinOp = 0; /* Binary operator */ - const char *zUniOp = 0; /* Unary operator */ - if( pExpr==0 ){ - op = TK_NULL; - }else{ - op = pExpr->op; - } - switch( op ){ - case TK_AGG_COLUMN: { - sqlite3ExplainPrintf(pOut, "AGG{%d:%d}", - pExpr->iTable, pExpr->iColumn); - break; - } - case TK_COLUMN: { - if( pExpr->iTable<0 ){ - /* This only happens when coding check constraints */ - sqlite3ExplainPrintf(pOut, "COLUMN(%d)", pExpr->iColumn); - }else{ - sqlite3ExplainPrintf(pOut, "{%d:%d}", - pExpr->iTable, pExpr->iColumn); - } - break; - } - case TK_INTEGER: { - if( pExpr->flags & EP_IntValue ){ - sqlite3ExplainPrintf(pOut, "%d", pExpr->u.iValue); - }else{ - sqlite3ExplainPrintf(pOut, "%s", pExpr->u.zToken); - } - break; - } -#ifndef SQLITE_OMIT_FLOATING_POINT - case TK_FLOAT: { - sqlite3ExplainPrintf(pOut,"%s", pExpr->u.zToken); - break; - } -#endif - case TK_STRING: { - sqlite3ExplainPrintf(pOut,"%Q", pExpr->u.zToken); - break; - } - case TK_NULL: { - sqlite3ExplainPrintf(pOut,"NULL"); - break; - } -#ifndef SQLITE_OMIT_BLOB_LITERAL - case TK_BLOB: { - sqlite3ExplainPrintf(pOut,"%s", pExpr->u.zToken); - break; - } -#endif - case TK_VARIABLE: { - sqlite3ExplainPrintf(pOut,"VARIABLE(%s,%d)", - pExpr->u.zToken, pExpr->iColumn); - break; - } - case TK_REGISTER: { - sqlite3ExplainPrintf(pOut,"REGISTER(%d)", pExpr->iTable); - break; - } - case TK_AS: { - sqlite3ExplainExpr(pOut, pExpr->pLeft); - break; - } -#ifndef SQLITE_OMIT_CAST - case TK_CAST: { - /* Expressions of the form: CAST(pLeft AS token) */ - const char *zAff = "unk"; - switch( sqlite3AffinityType(pExpr->u.zToken, 0) ){ - case SQLITE_AFF_TEXT: zAff = "TEXT"; break; - case SQLITE_AFF_NONE: zAff = "NONE"; break; - case SQLITE_AFF_NUMERIC: zAff = "NUMERIC"; break; - case SQLITE_AFF_INTEGER: zAff = "INTEGER"; break; - case SQLITE_AFF_REAL: zAff = "REAL"; break; - } - sqlite3ExplainPrintf(pOut, "CAST-%s(", zAff); - sqlite3ExplainExpr(pOut, pExpr->pLeft); - sqlite3ExplainPrintf(pOut, ")"); - break; - } -#endif /* SQLITE_OMIT_CAST */ - case TK_LT: zBinOp = "LT"; break; - case TK_LE: zBinOp = "LE"; break; - case TK_GT: zBinOp = "GT"; break; - case TK_GE: zBinOp = "GE"; break; - case TK_NE: zBinOp = "NE"; break; - case TK_EQ: zBinOp = "EQ"; break; - case TK_IS: zBinOp = "IS"; break; - case TK_ISNOT: zBinOp = "ISNOT"; break; - case TK_AND: zBinOp = "AND"; break; - case TK_OR: zBinOp = "OR"; break; - case TK_PLUS: zBinOp = "ADD"; break; - case TK_STAR: zBinOp = "MUL"; break; - case TK_MINUS: zBinOp = "SUB"; break; - case TK_REM: zBinOp = "REM"; break; - case TK_BITAND: zBinOp = "BITAND"; break; - case TK_BITOR: zBinOp = "BITOR"; break; - case TK_SLASH: zBinOp = "DIV"; break; - case TK_LSHIFT: zBinOp = "LSHIFT"; break; - case TK_RSHIFT: zBinOp = "RSHIFT"; break; - case TK_CONCAT: zBinOp = "CONCAT"; break; - - case TK_UMINUS: zUniOp = "UMINUS"; break; - case TK_UPLUS: zUniOp = "UPLUS"; break; - case TK_BITNOT: zUniOp = "BITNOT"; break; - case TK_NOT: zUniOp = "NOT"; break; - case TK_ISNULL: zUniOp = "ISNULL"; break; - case TK_NOTNULL: zUniOp = "NOTNULL"; break; - - case TK_COLLATE: { - sqlite3ExplainExpr(pOut, pExpr->pLeft); - sqlite3ExplainPrintf(pOut,".COLLATE(%s)",pExpr->u.zToken); - break; - } - - case TK_AGG_FUNCTION: - case TK_FUNCTION: { - ExprList *pFarg; /* List of function arguments */ - if( ExprHasProperty(pExpr, EP_TokenOnly) ){ - pFarg = 0; - }else{ - pFarg = pExpr->x.pList; - } - if( op==TK_AGG_FUNCTION ){ - sqlite3ExplainPrintf(pOut, "AGG_FUNCTION%d:%s(", - pExpr->op2, pExpr->u.zToken); - }else{ - sqlite3ExplainPrintf(pOut, "FUNCTION:%s(", pExpr->u.zToken); - } - if( pFarg ){ - sqlite3ExplainExprList(pOut, pFarg); - } - sqlite3ExplainPrintf(pOut, ")"); - break; - } -#ifndef SQLITE_OMIT_SUBQUERY - case TK_EXISTS: { - sqlite3ExplainPrintf(pOut, "EXISTS("); - sqlite3ExplainSelect(pOut, pExpr->x.pSelect); - sqlite3ExplainPrintf(pOut,")"); - break; - } - case TK_SELECT: { - sqlite3ExplainPrintf(pOut, "("); - sqlite3ExplainSelect(pOut, pExpr->x.pSelect); - sqlite3ExplainPrintf(pOut, ")"); - break; - } - case TK_IN: { - sqlite3ExplainPrintf(pOut, "IN("); - sqlite3ExplainExpr(pOut, pExpr->pLeft); - sqlite3ExplainPrintf(pOut, ","); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - sqlite3ExplainSelect(pOut, pExpr->x.pSelect); - }else{ - sqlite3ExplainExprList(pOut, pExpr->x.pList); - } - sqlite3ExplainPrintf(pOut, ")"); - break; - } -#endif /* SQLITE_OMIT_SUBQUERY */ - - /* - ** x BETWEEN y AND z - ** - ** This is equivalent to - ** - ** x>=y AND x<=z - ** - ** X is stored in pExpr->pLeft. - ** Y is stored in pExpr->pList->a[0].pExpr. - ** Z is stored in pExpr->pList->a[1].pExpr. - */ - case TK_BETWEEN: { - Expr *pX = pExpr->pLeft; - Expr *pY = pExpr->x.pList->a[0].pExpr; - Expr *pZ = pExpr->x.pList->a[1].pExpr; - sqlite3ExplainPrintf(pOut, "BETWEEN("); - sqlite3ExplainExpr(pOut, pX); - sqlite3ExplainPrintf(pOut, ","); - sqlite3ExplainExpr(pOut, pY); - sqlite3ExplainPrintf(pOut, ","); - sqlite3ExplainExpr(pOut, pZ); - sqlite3ExplainPrintf(pOut, ")"); - break; - } - case TK_TRIGGER: { - /* If the opcode is TK_TRIGGER, then the expression is a reference - ** to a column in the new.* or old.* pseudo-tables available to - ** trigger programs. In this case Expr.iTable is set to 1 for the - ** new.* pseudo-table, or 0 for the old.* pseudo-table. Expr.iColumn - ** is set to the column of the pseudo-table to read, or to -1 to - ** read the rowid field. - */ - sqlite3ExplainPrintf(pOut, "%s(%d)", - pExpr->iTable ? "NEW" : "OLD", pExpr->iColumn); - break; - } - case TK_CASE: { - sqlite3ExplainPrintf(pOut, "CASE("); - sqlite3ExplainExpr(pOut, pExpr->pLeft); - sqlite3ExplainPrintf(pOut, ","); - sqlite3ExplainExprList(pOut, pExpr->x.pList); - break; - } -#ifndef SQLITE_OMIT_TRIGGER - case TK_RAISE: { - const char *zType = "unk"; - switch( pExpr->affinity ){ - case OE_Rollback: zType = "rollback"; break; - case OE_Abort: zType = "abort"; break; - case OE_Fail: zType = "fail"; break; - case OE_Ignore: zType = "ignore"; break; - } - sqlite3ExplainPrintf(pOut, "RAISE-%s(%s)", zType, pExpr->u.zToken); - break; - } -#endif - } - if( zBinOp ){ - sqlite3ExplainPrintf(pOut,"%s(", zBinOp); - sqlite3ExplainExpr(pOut, pExpr->pLeft); - sqlite3ExplainPrintf(pOut,","); - sqlite3ExplainExpr(pOut, pExpr->pRight); - sqlite3ExplainPrintf(pOut,")"); - }else if( zUniOp ){ - sqlite3ExplainPrintf(pOut,"%s(", zUniOp); - sqlite3ExplainExpr(pOut, pExpr->pLeft); - sqlite3ExplainPrintf(pOut,")"); - } -} -#endif /* defined(SQLITE_ENABLE_TREE_EXPLAIN) */ - -#if defined(SQLITE_ENABLE_TREE_EXPLAIN) -/* -** Generate a human-readable explanation of an expression list. -*/ -SQLITE_PRIVATE void sqlite3ExplainExprList(Vdbe *pOut, ExprList *pList){ - int i; - if( pList==0 || pList->nExpr==0 ){ - sqlite3ExplainPrintf(pOut, "(empty-list)"); - return; - }else if( pList->nExpr==1 ){ - sqlite3ExplainExpr(pOut, pList->a[0].pExpr); - }else{ - sqlite3ExplainPush(pOut); - for(i=0; inExpr; i++){ - sqlite3ExplainPrintf(pOut, "item[%d] = ", i); - sqlite3ExplainPush(pOut); - sqlite3ExplainExpr(pOut, pList->a[i].pExpr); - sqlite3ExplainPop(pOut); - if( pList->a[i].zName ){ - sqlite3ExplainPrintf(pOut, " AS %s", pList->a[i].zName); - } - if( pList->a[i].bSpanIsTab ){ - sqlite3ExplainPrintf(pOut, " (%s)", pList->a[i].zSpan); - } - if( inExpr-1 ){ - sqlite3ExplainNL(pOut); - } - } - sqlite3ExplainPop(pOut); - } -} -#endif /* SQLITE_DEBUG */ - -/* -** Generate code that pushes the value of every element of the given -** expression list into a sequence of registers beginning at target. -** -** Return the number of elements evaluated. -** -** The SQLITE_ECEL_DUP flag prevents the arguments from being -** filled using OP_SCopy. OP_Copy must be used instead. -** -** The SQLITE_ECEL_FACTOR argument allows constant arguments to be -** factored out into initialization code. -*/ -SQLITE_PRIVATE int sqlite3ExprCodeExprList( - Parse *pParse, /* Parsing context */ - ExprList *pList, /* The expression list to be coded */ - int target, /* Where to write results */ - u8 flags /* SQLITE_ECEL_* flags */ -){ - struct ExprList_item *pItem; - int i, n; - u8 copyOp = (flags & SQLITE_ECEL_DUP) ? OP_Copy : OP_SCopy; - assert( pList!=0 ); - assert( target>0 ); - assert( pParse->pVdbe!=0 ); /* Never gets this far otherwise */ - n = pList->nExpr; - if( !ConstFactorOk(pParse) ) flags &= ~SQLITE_ECEL_FACTOR; - for(pItem=pList->a, i=0; ipExpr; - if( (flags & SQLITE_ECEL_FACTOR)!=0 && sqlite3ExprIsConstant(pExpr) ){ - sqlite3ExprCodeAtInit(pParse, pExpr, target+i, 0); - }else{ - int inReg = sqlite3ExprCodeTarget(pParse, pExpr, target+i); - if( inReg!=target+i ){ - VdbeOp *pOp; - Vdbe *v = pParse->pVdbe; - if( copyOp==OP_Copy - && (pOp=sqlite3VdbeGetOp(v, -1))->opcode==OP_Copy - && pOp->p1+pOp->p3+1==inReg - && pOp->p2+pOp->p3+1==target+i - ){ - pOp->p3++; - }else{ - sqlite3VdbeAddOp2(v, copyOp, inReg, target+i); - } - } - } - } - return n; -} - -/* -** Generate code for a BETWEEN operator. -** -** x BETWEEN y AND z -** -** The above is equivalent to -** -** x>=y AND x<=z -** -** Code it as such, taking care to do the common subexpression -** elementation of x. -*/ -static void exprCodeBetween( - Parse *pParse, /* Parsing and code generating context */ - Expr *pExpr, /* The BETWEEN expression */ - int dest, /* Jump here if the jump is taken */ - int jumpIfTrue, /* Take the jump if the BETWEEN is true */ - int jumpIfNull /* Take the jump if the BETWEEN is NULL */ -){ - Expr exprAnd; /* The AND operator in x>=y AND x<=z */ - Expr compLeft; /* The x>=y term */ - Expr compRight; /* The x<=z term */ - Expr exprX; /* The x subexpression */ - int regFree1 = 0; /* Temporary use register */ - - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); - exprX = *pExpr->pLeft; - exprAnd.op = TK_AND; - exprAnd.pLeft = &compLeft; - exprAnd.pRight = &compRight; - compLeft.op = TK_GE; - compLeft.pLeft = &exprX; - compLeft.pRight = pExpr->x.pList->a[0].pExpr; - compRight.op = TK_LE; - compRight.pLeft = &exprX; - compRight.pRight = pExpr->x.pList->a[1].pExpr; - exprToRegister(&exprX, sqlite3ExprCodeTemp(pParse, &exprX, ®Free1)); - if( jumpIfTrue ){ - sqlite3ExprIfTrue(pParse, &exprAnd, dest, jumpIfNull); - }else{ - sqlite3ExprIfFalse(pParse, &exprAnd, dest, jumpIfNull); - } - sqlite3ReleaseTempReg(pParse, regFree1); - - /* Ensure adequate test coverage */ - testcase( jumpIfTrue==0 && jumpIfNull==0 && regFree1==0 ); - testcase( jumpIfTrue==0 && jumpIfNull==0 && regFree1!=0 ); - testcase( jumpIfTrue==0 && jumpIfNull!=0 && regFree1==0 ); - testcase( jumpIfTrue==0 && jumpIfNull!=0 && regFree1!=0 ); - testcase( jumpIfTrue!=0 && jumpIfNull==0 && regFree1==0 ); - testcase( jumpIfTrue!=0 && jumpIfNull==0 && regFree1!=0 ); - testcase( jumpIfTrue!=0 && jumpIfNull!=0 && regFree1==0 ); - testcase( jumpIfTrue!=0 && jumpIfNull!=0 && regFree1!=0 ); -} - -/* -** Generate code for a boolean expression such that a jump is made -** to the label "dest" if the expression is true but execution -** continues straight thru if the expression is false. -** -** If the expression evaluates to NULL (neither true nor false), then -** take the jump if the jumpIfNull flag is SQLITE_JUMPIFNULL. -** -** This code depends on the fact that certain token values (ex: TK_EQ) -** are the same as opcode values (ex: OP_Eq) that implement the corresponding -** operation. Special comments in vdbe.c and the mkopcodeh.awk script in -** the make process cause these values to align. Assert()s in the code -** below verify that the numbers are aligned correctly. -*/ -SQLITE_PRIVATE void sqlite3ExprIfTrue(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ - Vdbe *v = pParse->pVdbe; - int op = 0; - int regFree1 = 0; - int regFree2 = 0; - int r1, r2; - - assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 ); - if( NEVER(v==0) ) return; /* Existence of VDBE checked by caller */ - if( NEVER(pExpr==0) ) return; /* No way this can happen */ - op = pExpr->op; - switch( op ){ - case TK_AND: { - int d2 = sqlite3VdbeMakeLabel(v); - testcase( jumpIfNull==0 ); - sqlite3ExprIfFalse(pParse, pExpr->pLeft, d2,jumpIfNull^SQLITE_JUMPIFNULL); - sqlite3ExprCachePush(pParse); - sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); - sqlite3VdbeResolveLabel(v, d2); - sqlite3ExprCachePop(pParse, 1); - break; - } - case TK_OR: { - testcase( jumpIfNull==0 ); - sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); - sqlite3ExprCachePush(pParse); - sqlite3ExprIfTrue(pParse, pExpr->pRight, dest, jumpIfNull); - sqlite3ExprCachePop(pParse, 1); - break; - } - case TK_NOT: { - testcase( jumpIfNull==0 ); - sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); - break; - } - case TK_LT: - case TK_LE: - case TK_GT: - case TK_GE: - case TK_NE: - case TK_EQ: { - assert( TK_LT==OP_Lt ); - assert( TK_LE==OP_Le ); - assert( TK_GT==OP_Gt ); - assert( TK_GE==OP_Ge ); - assert( TK_EQ==OP_Eq ); - assert( TK_NE==OP_Ne ); - testcase( op==TK_LT ); - testcase( op==TK_LE ); - testcase( op==TK_GT ); - testcase( op==TK_GE ); - testcase( op==TK_EQ ); - testcase( op==TK_NE ); - testcase( jumpIfNull==0 ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, - r1, r2, dest, jumpIfNull); - testcase( regFree1==0 ); - testcase( regFree2==0 ); - break; - } - case TK_IS: - case TK_ISNOT: { - testcase( op==TK_IS ); - testcase( op==TK_ISNOT ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - op = (op==TK_IS) ? TK_EQ : TK_NE; - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, - r1, r2, dest, SQLITE_NULLEQ); - testcase( regFree1==0 ); - testcase( regFree2==0 ); - break; - } - case TK_ISNULL: - case TK_NOTNULL: { - assert( TK_ISNULL==OP_IsNull ); - assert( TK_NOTNULL==OP_NotNull ); - testcase( op==TK_ISNULL ); - testcase( op==TK_NOTNULL ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - sqlite3VdbeAddOp2(v, op, r1, dest); - testcase( regFree1==0 ); - break; - } - case TK_BETWEEN: { - testcase( jumpIfNull==0 ); - exprCodeBetween(pParse, pExpr, dest, 1, jumpIfNull); - break; - } -#ifndef SQLITE_OMIT_SUBQUERY - case TK_IN: { - int destIfFalse = sqlite3VdbeMakeLabel(v); - int destIfNull = jumpIfNull ? dest : destIfFalse; - sqlite3ExprCodeIN(pParse, pExpr, destIfFalse, destIfNull); - sqlite3VdbeAddOp2(v, OP_Goto, 0, dest); - sqlite3VdbeResolveLabel(v, destIfFalse); - break; - } -#endif - default: { - if( exprAlwaysTrue(pExpr) ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, dest); - }else if( exprAlwaysFalse(pExpr) ){ - /* No-op */ - }else{ - r1 = sqlite3ExprCodeTemp(pParse, pExpr, ®Free1); - sqlite3VdbeAddOp3(v, OP_If, r1, dest, jumpIfNull!=0); - testcase( regFree1==0 ); - testcase( jumpIfNull==0 ); - } - break; - } - } - sqlite3ReleaseTempReg(pParse, regFree1); - sqlite3ReleaseTempReg(pParse, regFree2); -} - -/* -** Generate code for a boolean expression such that a jump is made -** to the label "dest" if the expression is false but execution -** continues straight thru if the expression is true. -** -** If the expression evaluates to NULL (neither true nor false) then -** jump if jumpIfNull is SQLITE_JUMPIFNULL or fall through if jumpIfNull -** is 0. -*/ -SQLITE_PRIVATE void sqlite3ExprIfFalse(Parse *pParse, Expr *pExpr, int dest, int jumpIfNull){ - Vdbe *v = pParse->pVdbe; - int op = 0; - int regFree1 = 0; - int regFree2 = 0; - int r1, r2; - - assert( jumpIfNull==SQLITE_JUMPIFNULL || jumpIfNull==0 ); - if( NEVER(v==0) ) return; /* Existence of VDBE checked by caller */ - if( pExpr==0 ) return; - - /* The value of pExpr->op and op are related as follows: - ** - ** pExpr->op op - ** --------- ---------- - ** TK_ISNULL OP_NotNull - ** TK_NOTNULL OP_IsNull - ** TK_NE OP_Eq - ** TK_EQ OP_Ne - ** TK_GT OP_Le - ** TK_LE OP_Gt - ** TK_GE OP_Lt - ** TK_LT OP_Ge - ** - ** For other values of pExpr->op, op is undefined and unused. - ** The value of TK_ and OP_ constants are arranged such that we - ** can compute the mapping above using the following expression. - ** Assert()s verify that the computation is correct. - */ - op = ((pExpr->op+(TK_ISNULL&1))^1)-(TK_ISNULL&1); - - /* Verify correct alignment of TK_ and OP_ constants - */ - assert( pExpr->op!=TK_ISNULL || op==OP_NotNull ); - assert( pExpr->op!=TK_NOTNULL || op==OP_IsNull ); - assert( pExpr->op!=TK_NE || op==OP_Eq ); - assert( pExpr->op!=TK_EQ || op==OP_Ne ); - assert( pExpr->op!=TK_LT || op==OP_Ge ); - assert( pExpr->op!=TK_LE || op==OP_Gt ); - assert( pExpr->op!=TK_GT || op==OP_Le ); - assert( pExpr->op!=TK_GE || op==OP_Lt ); - - switch( pExpr->op ){ - case TK_AND: { - testcase( jumpIfNull==0 ); - sqlite3ExprIfFalse(pParse, pExpr->pLeft, dest, jumpIfNull); - sqlite3ExprCachePush(pParse); - sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); - sqlite3ExprCachePop(pParse, 1); - break; - } - case TK_OR: { - int d2 = sqlite3VdbeMakeLabel(v); - testcase( jumpIfNull==0 ); - sqlite3ExprIfTrue(pParse, pExpr->pLeft, d2, jumpIfNull^SQLITE_JUMPIFNULL); - sqlite3ExprCachePush(pParse); - sqlite3ExprIfFalse(pParse, pExpr->pRight, dest, jumpIfNull); - sqlite3VdbeResolveLabel(v, d2); - sqlite3ExprCachePop(pParse, 1); - break; - } - case TK_NOT: { - testcase( jumpIfNull==0 ); - sqlite3ExprIfTrue(pParse, pExpr->pLeft, dest, jumpIfNull); - break; - } - case TK_LT: - case TK_LE: - case TK_GT: - case TK_GE: - case TK_NE: - case TK_EQ: { - testcase( op==TK_LT ); - testcase( op==TK_LE ); - testcase( op==TK_GT ); - testcase( op==TK_GE ); - testcase( op==TK_EQ ); - testcase( op==TK_NE ); - testcase( jumpIfNull==0 ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, - r1, r2, dest, jumpIfNull); - testcase( regFree1==0 ); - testcase( regFree2==0 ); - break; - } - case TK_IS: - case TK_ISNOT: { - testcase( pExpr->op==TK_IS ); - testcase( pExpr->op==TK_ISNOT ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - r2 = sqlite3ExprCodeTemp(pParse, pExpr->pRight, ®Free2); - op = (pExpr->op==TK_IS) ? TK_NE : TK_EQ; - codeCompare(pParse, pExpr->pLeft, pExpr->pRight, op, - r1, r2, dest, SQLITE_NULLEQ); - testcase( regFree1==0 ); - testcase( regFree2==0 ); - break; - } - case TK_ISNULL: - case TK_NOTNULL: { - testcase( op==TK_ISNULL ); - testcase( op==TK_NOTNULL ); - r1 = sqlite3ExprCodeTemp(pParse, pExpr->pLeft, ®Free1); - sqlite3VdbeAddOp2(v, op, r1, dest); - testcase( regFree1==0 ); - break; - } - case TK_BETWEEN: { - testcase( jumpIfNull==0 ); - exprCodeBetween(pParse, pExpr, dest, 0, jumpIfNull); - break; - } -#ifndef SQLITE_OMIT_SUBQUERY - case TK_IN: { - if( jumpIfNull ){ - sqlite3ExprCodeIN(pParse, pExpr, dest, dest); - }else{ - int destIfNull = sqlite3VdbeMakeLabel(v); - sqlite3ExprCodeIN(pParse, pExpr, dest, destIfNull); - sqlite3VdbeResolveLabel(v, destIfNull); - } - break; - } -#endif - default: { - if( exprAlwaysFalse(pExpr) ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, dest); - }else if( exprAlwaysTrue(pExpr) ){ - /* no-op */ - }else{ - r1 = sqlite3ExprCodeTemp(pParse, pExpr, ®Free1); - sqlite3VdbeAddOp3(v, OP_IfNot, r1, dest, jumpIfNull!=0); - testcase( regFree1==0 ); - testcase( jumpIfNull==0 ); - } - break; - } - } - sqlite3ReleaseTempReg(pParse, regFree1); - sqlite3ReleaseTempReg(pParse, regFree2); -} - -/* -** Do a deep comparison of two expression trees. Return 0 if the two -** expressions are completely identical. Return 1 if they differ only -** by a COLLATE operator at the top level. Return 2 if there are differences -** other than the top-level COLLATE operator. -** -** If any subelement of pB has Expr.iTable==(-1) then it is allowed -** to compare equal to an equivalent element in pA with Expr.iTable==iTab. -** -** The pA side might be using TK_REGISTER. If that is the case and pB is -** not using TK_REGISTER but is otherwise equivalent, then still return 0. -** -** Sometimes this routine will return 2 even if the two expressions -** really are equivalent. If we cannot prove that the expressions are -** identical, we return 2 just to be safe. So if this routine -** returns 2, then you do not really know for certain if the two -** expressions are the same. But if you get a 0 or 1 return, then you -** can be sure the expressions are the same. In the places where -** this routine is used, it does not hurt to get an extra 2 - that -** just might result in some slightly slower code. But returning -** an incorrect 0 or 1 could lead to a malfunction. -*/ -SQLITE_PRIVATE int sqlite3ExprCompare(Expr *pA, Expr *pB, int iTab){ - u32 combinedFlags; - if( pA==0 || pB==0 ){ - return pB==pA ? 0 : 2; - } - combinedFlags = pA->flags | pB->flags; - if( combinedFlags & EP_IntValue ){ - if( (pA->flags&pB->flags&EP_IntValue)!=0 && pA->u.iValue==pB->u.iValue ){ - return 0; - } - return 2; - } - if( pA->op!=pB->op ){ - if( pA->op==TK_COLLATE && sqlite3ExprCompare(pA->pLeft, pB, iTab)<2 ){ - return 1; - } - if( pB->op==TK_COLLATE && sqlite3ExprCompare(pA, pB->pLeft, iTab)<2 ){ - return 1; - } - return 2; - } - if( pA->op!=TK_COLUMN && ALWAYS(pA->op!=TK_AGG_COLUMN) && pA->u.zToken ){ - if( strcmp(pA->u.zToken,pB->u.zToken)!=0 ){ - return pA->op==TK_COLLATE ? 1 : 2; - } - } - if( (pA->flags & EP_Distinct)!=(pB->flags & EP_Distinct) ) return 2; - if( ALWAYS((combinedFlags & EP_TokenOnly)==0) ){ - if( combinedFlags & EP_xIsSelect ) return 2; - if( sqlite3ExprCompare(pA->pLeft, pB->pLeft, iTab) ) return 2; - if( sqlite3ExprCompare(pA->pRight, pB->pRight, iTab) ) return 2; - if( sqlite3ExprListCompare(pA->x.pList, pB->x.pList, iTab) ) return 2; - if( ALWAYS((combinedFlags & EP_Reduced)==0) ){ - if( pA->iColumn!=pB->iColumn ) return 2; - if( pA->iTable!=pB->iTable - && (pA->iTable!=iTab || NEVER(pB->iTable>=0)) ) return 2; - } - } - return 0; -} - -/* -** Compare two ExprList objects. Return 0 if they are identical and -** non-zero if they differ in any way. -** -** If any subelement of pB has Expr.iTable==(-1) then it is allowed -** to compare equal to an equivalent element in pA with Expr.iTable==iTab. -** -** This routine might return non-zero for equivalent ExprLists. The -** only consequence will be disabled optimizations. But this routine -** must never return 0 if the two ExprList objects are different, or -** a malfunction will result. -** -** Two NULL pointers are considered to be the same. But a NULL pointer -** always differs from a non-NULL pointer. -*/ -SQLITE_PRIVATE int sqlite3ExprListCompare(ExprList *pA, ExprList *pB, int iTab){ - int i; - if( pA==0 && pB==0 ) return 0; - if( pA==0 || pB==0 ) return 1; - if( pA->nExpr!=pB->nExpr ) return 1; - for(i=0; inExpr; i++){ - Expr *pExprA = pA->a[i].pExpr; - Expr *pExprB = pB->a[i].pExpr; - if( pA->a[i].sortOrder!=pB->a[i].sortOrder ) return 1; - if( sqlite3ExprCompare(pExprA, pExprB, iTab) ) return 1; - } - return 0; -} - -/* -** Return true if we can prove the pE2 will always be true if pE1 is -** true. Return false if we cannot complete the proof or if pE2 might -** be false. Examples: -** -** pE1: x==5 pE2: x==5 Result: true -** pE1: x>0 pE2: x==5 Result: false -** pE1: x=21 pE2: x=21 OR y=43 Result: true -** pE1: x!=123 pE2: x IS NOT NULL Result: true -** pE1: x!=?1 pE2: x IS NOT NULL Result: true -** pE1: x IS NULL pE2: x IS NOT NULL Result: false -** pE1: x IS ?2 pE2: x IS NOT NULL Reuslt: false -** -** When comparing TK_COLUMN nodes between pE1 and pE2, if pE2 has -** Expr.iTable<0 then assume a table number given by iTab. -** -** When in doubt, return false. Returning true might give a performance -** improvement. Returning false might cause a performance reduction, but -** it will always give the correct answer and is hence always safe. -*/ -SQLITE_PRIVATE int sqlite3ExprImpliesExpr(Expr *pE1, Expr *pE2, int iTab){ - if( sqlite3ExprCompare(pE1, pE2, iTab)==0 ){ - return 1; - } - if( pE2->op==TK_OR - && (sqlite3ExprImpliesExpr(pE1, pE2->pLeft, iTab) - || sqlite3ExprImpliesExpr(pE1, pE2->pRight, iTab) ) - ){ - return 1; - } - if( pE2->op==TK_NOTNULL - && sqlite3ExprCompare(pE1->pLeft, pE2->pLeft, iTab)==0 - && (pE1->op!=TK_ISNULL && pE1->op!=TK_IS) - ){ - return 1; - } - return 0; -} - -/* -** An instance of the following structure is used by the tree walker -** to count references to table columns in the arguments of an -** aggregate function, in order to implement the -** sqlite3FunctionThisSrc() routine. -*/ -struct SrcCount { - SrcList *pSrc; /* One particular FROM clause in a nested query */ - int nThis; /* Number of references to columns in pSrcList */ - int nOther; /* Number of references to columns in other FROM clauses */ -}; - -/* -** Count the number of references to columns. -*/ -static int exprSrcCount(Walker *pWalker, Expr *pExpr){ - /* The NEVER() on the second term is because sqlite3FunctionUsesThisSrc() - ** is always called before sqlite3ExprAnalyzeAggregates() and so the - ** TK_COLUMNs have not yet been converted into TK_AGG_COLUMN. If - ** sqlite3FunctionUsesThisSrc() is used differently in the future, the - ** NEVER() will need to be removed. */ - if( pExpr->op==TK_COLUMN || NEVER(pExpr->op==TK_AGG_COLUMN) ){ - int i; - struct SrcCount *p = pWalker->u.pSrcCount; - SrcList *pSrc = p->pSrc; - for(i=0; inSrc; i++){ - if( pExpr->iTable==pSrc->a[i].iCursor ) break; - } - if( inSrc ){ - p->nThis++; - }else{ - p->nOther++; - } - } - return WRC_Continue; -} - -/* -** Determine if any of the arguments to the pExpr Function reference -** pSrcList. Return true if they do. Also return true if the function -** has no arguments or has only constant arguments. Return false if pExpr -** references columns but not columns of tables found in pSrcList. -*/ -SQLITE_PRIVATE int sqlite3FunctionUsesThisSrc(Expr *pExpr, SrcList *pSrcList){ - Walker w; - struct SrcCount cnt; - assert( pExpr->op==TK_AGG_FUNCTION ); - memset(&w, 0, sizeof(w)); - w.xExprCallback = exprSrcCount; - w.u.pSrcCount = &cnt; - cnt.pSrc = pSrcList; - cnt.nThis = 0; - cnt.nOther = 0; - sqlite3WalkExprList(&w, pExpr->x.pList); - return cnt.nThis>0 || cnt.nOther==0; -} - -/* -** Add a new element to the pAggInfo->aCol[] array. Return the index of -** the new element. Return a negative number if malloc fails. -*/ -static int addAggInfoColumn(sqlite3 *db, AggInfo *pInfo){ - int i; - pInfo->aCol = sqlite3ArrayAllocate( - db, - pInfo->aCol, - sizeof(pInfo->aCol[0]), - &pInfo->nColumn, - &i - ); - return i; -} - -/* -** Add a new element to the pAggInfo->aFunc[] array. Return the index of -** the new element. Return a negative number if malloc fails. -*/ -static int addAggInfoFunc(sqlite3 *db, AggInfo *pInfo){ - int i; - pInfo->aFunc = sqlite3ArrayAllocate( - db, - pInfo->aFunc, - sizeof(pInfo->aFunc[0]), - &pInfo->nFunc, - &i - ); - return i; -} - -/* -** This is the xExprCallback for a tree walker. It is used to -** implement sqlite3ExprAnalyzeAggregates(). See sqlite3ExprAnalyzeAggregates -** for additional information. -*/ -static int analyzeAggregate(Walker *pWalker, Expr *pExpr){ - int i; - NameContext *pNC = pWalker->u.pNC; - Parse *pParse = pNC->pParse; - SrcList *pSrcList = pNC->pSrcList; - AggInfo *pAggInfo = pNC->pAggInfo; - - switch( pExpr->op ){ - case TK_AGG_COLUMN: - case TK_COLUMN: { - testcase( pExpr->op==TK_AGG_COLUMN ); - testcase( pExpr->op==TK_COLUMN ); - /* Check to see if the column is in one of the tables in the FROM - ** clause of the aggregate query */ - if( ALWAYS(pSrcList!=0) ){ - struct SrcList_item *pItem = pSrcList->a; - for(i=0; inSrc; i++, pItem++){ - struct AggInfo_col *pCol; - assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); - if( pExpr->iTable==pItem->iCursor ){ - /* If we reach this point, it means that pExpr refers to a table - ** that is in the FROM clause of the aggregate query. - ** - ** Make an entry for the column in pAggInfo->aCol[] if there - ** is not an entry there already. - */ - int k; - pCol = pAggInfo->aCol; - for(k=0; knColumn; k++, pCol++){ - if( pCol->iTable==pExpr->iTable && - pCol->iColumn==pExpr->iColumn ){ - break; - } - } - if( (k>=pAggInfo->nColumn) - && (k = addAggInfoColumn(pParse->db, pAggInfo))>=0 - ){ - pCol = &pAggInfo->aCol[k]; - pCol->pTab = pExpr->pTab; - pCol->iTable = pExpr->iTable; - pCol->iColumn = pExpr->iColumn; - pCol->iMem = ++pParse->nMem; - pCol->iSorterColumn = -1; - pCol->pExpr = pExpr; - if( pAggInfo->pGroupBy ){ - int j, n; - ExprList *pGB = pAggInfo->pGroupBy; - struct ExprList_item *pTerm = pGB->a; - n = pGB->nExpr; - for(j=0; jpExpr; - if( pE->op==TK_COLUMN && pE->iTable==pExpr->iTable && - pE->iColumn==pExpr->iColumn ){ - pCol->iSorterColumn = j; - break; - } - } - } - if( pCol->iSorterColumn<0 ){ - pCol->iSorterColumn = pAggInfo->nSortingColumn++; - } - } - /* There is now an entry for pExpr in pAggInfo->aCol[] (either - ** because it was there before or because we just created it). - ** Convert the pExpr to be a TK_AGG_COLUMN referring to that - ** pAggInfo->aCol[] entry. - */ - ExprSetVVAProperty(pExpr, EP_NoReduce); - pExpr->pAggInfo = pAggInfo; - pExpr->op = TK_AGG_COLUMN; - pExpr->iAgg = (i16)k; - break; - } /* endif pExpr->iTable==pItem->iCursor */ - } /* end loop over pSrcList */ - } - return WRC_Prune; - } - case TK_AGG_FUNCTION: { - if( (pNC->ncFlags & NC_InAggFunc)==0 - && pWalker->walkerDepth==pExpr->op2 - ){ - /* Check to see if pExpr is a duplicate of another aggregate - ** function that is already in the pAggInfo structure - */ - struct AggInfo_func *pItem = pAggInfo->aFunc; - for(i=0; inFunc; i++, pItem++){ - if( sqlite3ExprCompare(pItem->pExpr, pExpr, -1)==0 ){ - break; - } - } - if( i>=pAggInfo->nFunc ){ - /* pExpr is original. Make a new entry in pAggInfo->aFunc[] - */ - u8 enc = ENC(pParse->db); - i = addAggInfoFunc(pParse->db, pAggInfo); - if( i>=0 ){ - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); - pItem = &pAggInfo->aFunc[i]; - pItem->pExpr = pExpr; - pItem->iMem = ++pParse->nMem; - assert( !ExprHasProperty(pExpr, EP_IntValue) ); - pItem->pFunc = sqlite3FindFunction(pParse->db, - pExpr->u.zToken, sqlite3Strlen30(pExpr->u.zToken), - pExpr->x.pList ? pExpr->x.pList->nExpr : 0, enc, 0); - if( pExpr->flags & EP_Distinct ){ - pItem->iDistinct = pParse->nTab++; - }else{ - pItem->iDistinct = -1; - } - } - } - /* Make pExpr point to the appropriate pAggInfo->aFunc[] entry - */ - assert( !ExprHasProperty(pExpr, EP_TokenOnly|EP_Reduced) ); - ExprSetVVAProperty(pExpr, EP_NoReduce); - pExpr->iAgg = (i16)i; - pExpr->pAggInfo = pAggInfo; - return WRC_Prune; - }else{ - return WRC_Continue; - } - } - } - return WRC_Continue; -} -static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){ - UNUSED_PARAMETER(pWalker); - UNUSED_PARAMETER(pSelect); - return WRC_Continue; -} - -/* -** Analyze the pExpr expression looking for aggregate functions and -** for variables that need to be added to AggInfo object that pNC->pAggInfo -** points to. Additional entries are made on the AggInfo object as -** necessary. -** -** This routine should only be called after the expression has been -** analyzed by sqlite3ResolveExprNames(). -*/ -SQLITE_PRIVATE void sqlite3ExprAnalyzeAggregates(NameContext *pNC, Expr *pExpr){ - Walker w; - memset(&w, 0, sizeof(w)); - w.xExprCallback = analyzeAggregate; - w.xSelectCallback = analyzeAggregatesInSelect; - w.u.pNC = pNC; - assert( pNC->pSrcList!=0 ); - sqlite3WalkExpr(&w, pExpr); -} - -/* -** Call sqlite3ExprAnalyzeAggregates() for every expression in an -** expression list. Return the number of errors. -** -** If an error is found, the analysis is cut short. -*/ -SQLITE_PRIVATE void sqlite3ExprAnalyzeAggList(NameContext *pNC, ExprList *pList){ - struct ExprList_item *pItem; - int i; - if( pList ){ - for(pItem=pList->a, i=0; inExpr; i++, pItem++){ - sqlite3ExprAnalyzeAggregates(pNC, pItem->pExpr); - } - } -} - -/* -** Allocate a single new register for use to hold some intermediate result. -*/ -SQLITE_PRIVATE int sqlite3GetTempReg(Parse *pParse){ - if( pParse->nTempReg==0 ){ - return ++pParse->nMem; - } - return pParse->aTempReg[--pParse->nTempReg]; -} - -/* -** Deallocate a register, making available for reuse for some other -** purpose. -** -** If a register is currently being used by the column cache, then -** the dallocation is deferred until the column cache line that uses -** the register becomes stale. -*/ -SQLITE_PRIVATE void sqlite3ReleaseTempReg(Parse *pParse, int iReg){ - if( iReg && pParse->nTempRegaTempReg) ){ - int i; - struct yColCache *p; - for(i=0, p=pParse->aColCache; iiReg==iReg ){ - p->tempReg = 1; - return; - } - } - pParse->aTempReg[pParse->nTempReg++] = iReg; - } -} - -/* -** Allocate or deallocate a block of nReg consecutive registers -*/ -SQLITE_PRIVATE int sqlite3GetTempRange(Parse *pParse, int nReg){ - int i, n; - i = pParse->iRangeReg; - n = pParse->nRangeReg; - if( nReg<=n ){ - assert( !usedAsColumnCache(pParse, i, i+n-1) ); - pParse->iRangeReg += nReg; - pParse->nRangeReg -= nReg; - }else{ - i = pParse->nMem+1; - pParse->nMem += nReg; - } - return i; -} -SQLITE_PRIVATE void sqlite3ReleaseTempRange(Parse *pParse, int iReg, int nReg){ - sqlite3ExprCacheRemove(pParse, iReg, nReg); - if( nReg>pParse->nRangeReg ){ - pParse->nRangeReg = nReg; - pParse->iRangeReg = iReg; - } -} - -/* -** Mark all temporary registers as being unavailable for reuse. -*/ -SQLITE_PRIVATE void sqlite3ClearTempRegCache(Parse *pParse){ - pParse->nTempReg = 0; - pParse->nRangeReg = 0; -} - -/************** End of expr.c ************************************************/ -/************** Begin file alter.c *******************************************/ -/* -** 2005 February 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains C code routines that used to generate VDBE code -** that implements the ALTER TABLE command. -*/ - -/* -** The code in this file only exists if we are not omitting the -** ALTER TABLE logic from the build. -*/ -#ifndef SQLITE_OMIT_ALTERTABLE - - -/* -** This function is used by SQL generated to implement the -** ALTER TABLE command. The first argument is the text of a CREATE TABLE or -** CREATE INDEX command. The second is a table name. The table name in -** the CREATE TABLE or CREATE INDEX statement is replaced with the third -** argument and the result returned. Examples: -** -** sqlite_rename_table('CREATE TABLE abc(a, b, c)', 'def') -** -> 'CREATE TABLE def(a, b, c)' -** -** sqlite_rename_table('CREATE INDEX i ON abc(a)', 'def') -** -> 'CREATE INDEX i ON def(a, b, c)' -*/ -static void renameTableFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **argv -){ - unsigned char const *zSql = sqlite3_value_text(argv[0]); - unsigned char const *zTableName = sqlite3_value_text(argv[1]); - - int token; - Token tname; - unsigned char const *zCsr = zSql; - int len = 0; - char *zRet; - - sqlite3 *db = sqlite3_context_db_handle(context); - - UNUSED_PARAMETER(NotUsed); - - /* The principle used to locate the table name in the CREATE TABLE - ** statement is that the table name is the first non-space token that - ** is immediately followed by a TK_LP or TK_USING token. - */ - if( zSql ){ - do { - if( !*zCsr ){ - /* Ran out of input before finding an opening bracket. Return NULL. */ - return; - } - - /* Store the token that zCsr points to in tname. */ - tname.z = (char*)zCsr; - tname.n = len; - - /* Advance zCsr to the next token. Store that token type in 'token', - ** and its length in 'len' (to be used next iteration of this loop). - */ - do { - zCsr += len; - len = sqlite3GetToken(zCsr, &token); - } while( token==TK_SPACE ); - assert( len>0 ); - } while( token!=TK_LP && token!=TK_USING ); - - zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", ((u8*)tname.z) - zSql, zSql, - zTableName, tname.z+tname.n); - sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC); - } -} - -/* -** This C function implements an SQL user function that is used by SQL code -** generated by the ALTER TABLE ... RENAME command to modify the definition -** of any foreign key constraints that use the table being renamed as the -** parent table. It is passed three arguments: -** -** 1) The complete text of the CREATE TABLE statement being modified, -** 2) The old name of the table being renamed, and -** 3) The new name of the table being renamed. -** -** It returns the new CREATE TABLE statement. For example: -** -** sqlite_rename_parent('CREATE TABLE t1(a REFERENCES t2)', 't2', 't3') -** -> 'CREATE TABLE t1(a REFERENCES t3)' -*/ -#ifndef SQLITE_OMIT_FOREIGN_KEY -static void renameParentFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **argv -){ - sqlite3 *db = sqlite3_context_db_handle(context); - char *zOutput = 0; - char *zResult; - unsigned char const *zInput = sqlite3_value_text(argv[0]); - unsigned char const *zOld = sqlite3_value_text(argv[1]); - unsigned char const *zNew = sqlite3_value_text(argv[2]); - - unsigned const char *z; /* Pointer to token */ - int n; /* Length of token z */ - int token; /* Type of token */ - - UNUSED_PARAMETER(NotUsed); - for(z=zInput; *z; z=z+n){ - n = sqlite3GetToken(z, &token); - if( token==TK_REFERENCES ){ - char *zParent; - do { - z += n; - n = sqlite3GetToken(z, &token); - }while( token==TK_SPACE ); - - zParent = sqlite3DbStrNDup(db, (const char *)z, n); - if( zParent==0 ) break; - sqlite3Dequote(zParent); - if( 0==sqlite3StrICmp((const char *)zOld, zParent) ){ - char *zOut = sqlite3MPrintf(db, "%s%.*s\"%w\"", - (zOutput?zOutput:""), z-zInput, zInput, (const char *)zNew - ); - sqlite3DbFree(db, zOutput); - zOutput = zOut; - zInput = &z[n]; - } - sqlite3DbFree(db, zParent); - } - } - - zResult = sqlite3MPrintf(db, "%s%s", (zOutput?zOutput:""), zInput), - sqlite3_result_text(context, zResult, -1, SQLITE_DYNAMIC); - sqlite3DbFree(db, zOutput); -} -#endif - -#ifndef SQLITE_OMIT_TRIGGER -/* This function is used by SQL generated to implement the -** ALTER TABLE command. The first argument is the text of a CREATE TRIGGER -** statement. The second is a table name. The table name in the CREATE -** TRIGGER statement is replaced with the third argument and the result -** returned. This is analagous to renameTableFunc() above, except for CREATE -** TRIGGER, not CREATE INDEX and CREATE TABLE. -*/ -static void renameTriggerFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **argv -){ - unsigned char const *zSql = sqlite3_value_text(argv[0]); - unsigned char const *zTableName = sqlite3_value_text(argv[1]); - - int token; - Token tname; - int dist = 3; - unsigned char const *zCsr = zSql; - int len = 0; - char *zRet; - sqlite3 *db = sqlite3_context_db_handle(context); - - UNUSED_PARAMETER(NotUsed); - - /* The principle used to locate the table name in the CREATE TRIGGER - ** statement is that the table name is the first token that is immediatedly - ** preceded by either TK_ON or TK_DOT and immediatedly followed by one - ** of TK_WHEN, TK_BEGIN or TK_FOR. - */ - if( zSql ){ - do { - - if( !*zCsr ){ - /* Ran out of input before finding the table name. Return NULL. */ - return; - } - - /* Store the token that zCsr points to in tname. */ - tname.z = (char*)zCsr; - tname.n = len; - - /* Advance zCsr to the next token. Store that token type in 'token', - ** and its length in 'len' (to be used next iteration of this loop). - */ - do { - zCsr += len; - len = sqlite3GetToken(zCsr, &token); - }while( token==TK_SPACE ); - assert( len>0 ); - - /* Variable 'dist' stores the number of tokens read since the most - ** recent TK_DOT or TK_ON. This means that when a WHEN, FOR or BEGIN - ** token is read and 'dist' equals 2, the condition stated above - ** to be met. - ** - ** Note that ON cannot be a database, table or column name, so - ** there is no need to worry about syntax like - ** "CREATE TRIGGER ... ON ON.ON BEGIN ..." etc. - */ - dist++; - if( token==TK_DOT || token==TK_ON ){ - dist = 0; - } - } while( dist!=2 || (token!=TK_WHEN && token!=TK_FOR && token!=TK_BEGIN) ); - - /* Variable tname now contains the token that is the old table-name - ** in the CREATE TRIGGER statement. - */ - zRet = sqlite3MPrintf(db, "%.*s\"%w\"%s", ((u8*)tname.z) - zSql, zSql, - zTableName, tname.z+tname.n); - sqlite3_result_text(context, zRet, -1, SQLITE_DYNAMIC); - } -} -#endif /* !SQLITE_OMIT_TRIGGER */ - -/* -** Register built-in functions used to help implement ALTER TABLE -*/ -SQLITE_PRIVATE void sqlite3AlterFunctions(void){ - static SQLITE_WSD FuncDef aAlterTableFuncs[] = { - FUNCTION(sqlite_rename_table, 2, 0, 0, renameTableFunc), -#ifndef SQLITE_OMIT_TRIGGER - FUNCTION(sqlite_rename_trigger, 2, 0, 0, renameTriggerFunc), -#endif -#ifndef SQLITE_OMIT_FOREIGN_KEY - FUNCTION(sqlite_rename_parent, 3, 0, 0, renameParentFunc), -#endif - }; - int i; - FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions); - FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aAlterTableFuncs); - - for(i=0; i OR name= OR ... -** -** If argument zWhere is NULL, then a pointer string containing the text -** "name=" is returned, where is the quoted version -** of the string passed as argument zConstant. The returned buffer is -** allocated using sqlite3DbMalloc(). It is the responsibility of the -** caller to ensure that it is eventually freed. -** -** If argument zWhere is not NULL, then the string returned is -** " OR name=", where is the contents of zWhere. -** In this case zWhere is passed to sqlite3DbFree() before returning. -** -*/ -static char *whereOrName(sqlite3 *db, char *zWhere, char *zConstant){ - char *zNew; - if( !zWhere ){ - zNew = sqlite3MPrintf(db, "name=%Q", zConstant); - }else{ - zNew = sqlite3MPrintf(db, "%s OR name=%Q", zWhere, zConstant); - sqlite3DbFree(db, zWhere); - } - return zNew; -} - -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) -/* -** Generate the text of a WHERE expression which can be used to select all -** tables that have foreign key constraints that refer to table pTab (i.e. -** constraints for which pTab is the parent table) from the sqlite_master -** table. -*/ -static char *whereForeignKeys(Parse *pParse, Table *pTab){ - FKey *p; - char *zWhere = 0; - for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ - zWhere = whereOrName(pParse->db, zWhere, p->pFrom->zName); - } - return zWhere; -} -#endif - -/* -** Generate the text of a WHERE expression which can be used to select all -** temporary triggers on table pTab from the sqlite_temp_master table. If -** table pTab has no temporary triggers, or is itself stored in the -** temporary database, NULL is returned. -*/ -static char *whereTempTriggers(Parse *pParse, Table *pTab){ - Trigger *pTrig; - char *zWhere = 0; - const Schema *pTempSchema = pParse->db->aDb[1].pSchema; /* Temp db schema */ - - /* If the table is not located in the temp-db (in which case NULL is - ** returned, loop through the tables list of triggers. For each trigger - ** that is not part of the temp-db schema, add a clause to the WHERE - ** expression being built up in zWhere. - */ - if( pTab->pSchema!=pTempSchema ){ - sqlite3 *db = pParse->db; - for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){ - if( pTrig->pSchema==pTempSchema ){ - zWhere = whereOrName(db, zWhere, pTrig->zName); - } - } - } - if( zWhere ){ - char *zNew = sqlite3MPrintf(pParse->db, "type='trigger' AND (%s)", zWhere); - sqlite3DbFree(pParse->db, zWhere); - zWhere = zNew; - } - return zWhere; -} - -/* -** Generate code to drop and reload the internal representation of table -** pTab from the database, including triggers and temporary triggers. -** Argument zName is the name of the table in the database schema at -** the time the generated code is executed. This can be different from -** pTab->zName if this function is being called to code part of an -** "ALTER TABLE RENAME TO" statement. -*/ -static void reloadTableSchema(Parse *pParse, Table *pTab, const char *zName){ - Vdbe *v; - char *zWhere; - int iDb; /* Index of database containing pTab */ -#ifndef SQLITE_OMIT_TRIGGER - Trigger *pTrig; -#endif - - v = sqlite3GetVdbe(pParse); - if( NEVER(v==0) ) return; - assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - assert( iDb>=0 ); - -#ifndef SQLITE_OMIT_TRIGGER - /* Drop any table triggers from the internal schema. */ - for(pTrig=sqlite3TriggerList(pParse, pTab); pTrig; pTrig=pTrig->pNext){ - int iTrigDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema); - assert( iTrigDb==iDb || iTrigDb==1 ); - sqlite3VdbeAddOp4(v, OP_DropTrigger, iTrigDb, 0, 0, pTrig->zName, 0); - } -#endif - - /* Drop the table and index from the internal schema. */ - sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0); - - /* Reload the table, index and permanent trigger schemas. */ - zWhere = sqlite3MPrintf(pParse->db, "tbl_name=%Q", zName); - if( !zWhere ) return; - sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere); - -#ifndef SQLITE_OMIT_TRIGGER - /* Now, if the table is not stored in the temp database, reload any temp - ** triggers. Don't use IN(...) in case SQLITE_OMIT_SUBQUERY is defined. - */ - if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){ - sqlite3VdbeAddParseSchemaOp(v, 1, zWhere); - } -#endif -} - -/* -** Parameter zName is the name of a table that is about to be altered -** (either with ALTER TABLE ... RENAME TO or ALTER TABLE ... ADD COLUMN). -** If the table is a system table, this function leaves an error message -** in pParse->zErr (system tables may not be altered) and returns non-zero. -** -** Or, if zName is not a system table, zero is returned. -*/ -static int isSystemTable(Parse *pParse, const char *zName){ - if( sqlite3Strlen30(zName)>6 && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){ - sqlite3ErrorMsg(pParse, "table %s may not be altered", zName); - return 1; - } - return 0; -} - -/* -** Generate code to implement the "ALTER TABLE xxx RENAME TO yyy" -** command. -*/ -SQLITE_PRIVATE void sqlite3AlterRenameTable( - Parse *pParse, /* Parser context. */ - SrcList *pSrc, /* The table to rename. */ - Token *pName /* The new table name. */ -){ - int iDb; /* Database that contains the table */ - char *zDb; /* Name of database iDb */ - Table *pTab; /* Table being renamed */ - char *zName = 0; /* NULL-terminated version of pName */ - sqlite3 *db = pParse->db; /* Database connection */ - int nTabName; /* Number of UTF-8 characters in zTabName */ - const char *zTabName; /* Original name of the table */ - Vdbe *v; -#ifndef SQLITE_OMIT_TRIGGER - char *zWhere = 0; /* Where clause to locate temp triggers */ -#endif - VTable *pVTab = 0; /* Non-zero if this is a v-tab with an xRename() */ - int savedDbFlags; /* Saved value of db->flags */ - - savedDbFlags = db->flags; - if( NEVER(db->mallocFailed) ) goto exit_rename_table; - assert( pSrc->nSrc==1 ); - assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); - - pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); - if( !pTab ) goto exit_rename_table; - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - zDb = db->aDb[iDb].zName; - db->flags |= SQLITE_PreferBuiltin; - - /* Get a NULL terminated version of the new table name. */ - zName = sqlite3NameFromToken(db, pName); - if( !zName ) goto exit_rename_table; - - /* Check that a table or index named 'zName' does not already exist - ** in database iDb. If so, this is an error. - */ - if( sqlite3FindTable(db, zName, zDb) || sqlite3FindIndex(db, zName, zDb) ){ - sqlite3ErrorMsg(pParse, - "there is already another table or index with this name: %s", zName); - goto exit_rename_table; - } - - /* Make sure it is not a system table being altered, or a reserved name - ** that the table is being renamed to. - */ - if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){ - goto exit_rename_table; - } - if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ goto - exit_rename_table; - } - -#ifndef SQLITE_OMIT_VIEW - if( pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "view %s may not be altered", pTab->zName); - goto exit_rename_table; - } -#endif - -#ifndef SQLITE_OMIT_AUTHORIZATION - /* Invoke the authorization callback. */ - if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ - goto exit_rename_table; - } -#endif - -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( sqlite3ViewGetColumnNames(pParse, pTab) ){ - goto exit_rename_table; - } - if( IsVirtual(pTab) ){ - pVTab = sqlite3GetVTable(db, pTab); - if( pVTab->pVtab->pModule->xRename==0 ){ - pVTab = 0; - } - } -#endif - - /* Begin a transaction and code the VerifyCookie for database iDb. - ** Then modify the schema cookie (since the ALTER TABLE modifies the - ** schema). Open a statement transaction if the table is a virtual - ** table. - */ - v = sqlite3GetVdbe(pParse); - if( v==0 ){ - goto exit_rename_table; - } - sqlite3BeginWriteOperation(pParse, pVTab!=0, iDb); - sqlite3ChangeCookie(pParse, iDb); - - /* If this is a virtual table, invoke the xRename() function if - ** one is defined. The xRename() callback will modify the names - ** of any resources used by the v-table implementation (including other - ** SQLite tables) that are identified by the name of the virtual table. - */ -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( pVTab ){ - int i = ++pParse->nMem; - sqlite3VdbeAddOp4(v, OP_String8, 0, i, 0, zName, 0); - sqlite3VdbeAddOp4(v, OP_VRename, i, 0, 0,(const char*)pVTab, P4_VTAB); - sqlite3MayAbort(pParse); - } -#endif - - /* figure out how many UTF-8 characters are in zName */ - zTabName = pTab->zName; - nTabName = sqlite3Utf8CharLen(zTabName, -1); - -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - if( db->flags&SQLITE_ForeignKeys ){ - /* If foreign-key support is enabled, rewrite the CREATE TABLE - ** statements corresponding to all child tables of foreign key constraints - ** for which the renamed table is the parent table. */ - if( (zWhere=whereForeignKeys(pParse, pTab))!=0 ){ - sqlite3NestedParse(pParse, - "UPDATE \"%w\".%s SET " - "sql = sqlite_rename_parent(sql, %Q, %Q) " - "WHERE %s;", zDb, SCHEMA_TABLE(iDb), zTabName, zName, zWhere); - sqlite3DbFree(db, zWhere); - } - } -#endif - - /* Modify the sqlite_master table to use the new table name. */ - sqlite3NestedParse(pParse, - "UPDATE %Q.%s SET " -#ifdef SQLITE_OMIT_TRIGGER - "sql = sqlite_rename_table(sql, %Q), " -#else - "sql = CASE " - "WHEN type = 'trigger' THEN sqlite_rename_trigger(sql, %Q)" - "ELSE sqlite_rename_table(sql, %Q) END, " -#endif - "tbl_name = %Q, " - "name = CASE " - "WHEN type='table' THEN %Q " - "WHEN name LIKE 'sqlite_autoindex%%' AND type='index' THEN " - "'sqlite_autoindex_' || %Q || substr(name,%d+18) " - "ELSE name END " - "WHERE tbl_name=%Q COLLATE nocase AND " - "(type='table' OR type='index' OR type='trigger');", - zDb, SCHEMA_TABLE(iDb), zName, zName, zName, -#ifndef SQLITE_OMIT_TRIGGER - zName, -#endif - zName, nTabName, zTabName - ); - -#ifndef SQLITE_OMIT_AUTOINCREMENT - /* If the sqlite_sequence table exists in this database, then update - ** it with the new table name. - */ - if( sqlite3FindTable(db, "sqlite_sequence", zDb) ){ - sqlite3NestedParse(pParse, - "UPDATE \"%w\".sqlite_sequence set name = %Q WHERE name = %Q", - zDb, zName, pTab->zName); - } -#endif - -#ifndef SQLITE_OMIT_TRIGGER - /* If there are TEMP triggers on this table, modify the sqlite_temp_master - ** table. Don't do this if the table being ALTERed is itself located in - ** the temp database. - */ - if( (zWhere=whereTempTriggers(pParse, pTab))!=0 ){ - sqlite3NestedParse(pParse, - "UPDATE sqlite_temp_master SET " - "sql = sqlite_rename_trigger(sql, %Q), " - "tbl_name = %Q " - "WHERE %s;", zName, zName, zWhere); - sqlite3DbFree(db, zWhere); - } -#endif - -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - if( db->flags&SQLITE_ForeignKeys ){ - FKey *p; - for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ - Table *pFrom = p->pFrom; - if( pFrom!=pTab ){ - reloadTableSchema(pParse, p->pFrom, pFrom->zName); - } - } - } -#endif - - /* Drop and reload the internal table schema. */ - reloadTableSchema(pParse, pTab, zName); - -exit_rename_table: - sqlite3SrcListDelete(db, pSrc); - sqlite3DbFree(db, zName); - db->flags = savedDbFlags; -} - - -/* -** Generate code to make sure the file format number is at least minFormat. -** The generated code will increase the file format number if necessary. -*/ -SQLITE_PRIVATE void sqlite3MinimumFileFormat(Parse *pParse, int iDb, int minFormat){ - Vdbe *v; - v = sqlite3GetVdbe(pParse); - /* The VDBE should have been allocated before this routine is called. - ** If that allocation failed, we would have quit before reaching this - ** point */ - if( ALWAYS(v) ){ - int r1 = sqlite3GetTempReg(pParse); - int r2 = sqlite3GetTempReg(pParse); - int j1; - sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, r1, BTREE_FILE_FORMAT); - sqlite3VdbeUsesBtree(v, iDb); - sqlite3VdbeAddOp2(v, OP_Integer, minFormat, r2); - j1 = sqlite3VdbeAddOp3(v, OP_Ge, r2, 0, r1); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, r2); - sqlite3VdbeJumpHere(v, j1); - sqlite3ReleaseTempReg(pParse, r1); - sqlite3ReleaseTempReg(pParse, r2); - } -} - -/* -** This function is called after an "ALTER TABLE ... ADD" statement -** has been parsed. Argument pColDef contains the text of the new -** column definition. -** -** The Table structure pParse->pNewTable was extended to include -** the new column during parsing. -*/ -SQLITE_PRIVATE void sqlite3AlterFinishAddColumn(Parse *pParse, Token *pColDef){ - Table *pNew; /* Copy of pParse->pNewTable */ - Table *pTab; /* Table being altered */ - int iDb; /* Database number */ - const char *zDb; /* Database name */ - const char *zTab; /* Table name */ - char *zCol; /* Null-terminated column definition */ - Column *pCol; /* The new column */ - Expr *pDflt; /* Default value for the new column */ - sqlite3 *db; /* The database connection; */ - - db = pParse->db; - if( pParse->nErr || db->mallocFailed ) return; - pNew = pParse->pNewTable; - assert( pNew ); - - assert( sqlite3BtreeHoldsAllMutexes(db) ); - iDb = sqlite3SchemaToIndex(db, pNew->pSchema); - zDb = db->aDb[iDb].zName; - zTab = &pNew->zName[16]; /* Skip the "sqlite_altertab_" prefix on the name */ - pCol = &pNew->aCol[pNew->nCol-1]; - pDflt = pCol->pDflt; - pTab = sqlite3FindTable(db, zTab, zDb); - assert( pTab ); - -#ifndef SQLITE_OMIT_AUTHORIZATION - /* Invoke the authorization callback. */ - if( sqlite3AuthCheck(pParse, SQLITE_ALTER_TABLE, zDb, pTab->zName, 0) ){ - return; - } -#endif - - /* If the default value for the new column was specified with a - ** literal NULL, then set pDflt to 0. This simplifies checking - ** for an SQL NULL default below. - */ - if( pDflt && pDflt->op==TK_NULL ){ - pDflt = 0; - } - - /* Check that the new column is not specified as PRIMARY KEY or UNIQUE. - ** If there is a NOT NULL constraint, then the default value for the - ** column must not be NULL. - */ - if( pCol->colFlags & COLFLAG_PRIMKEY ){ - sqlite3ErrorMsg(pParse, "Cannot add a PRIMARY KEY column"); - return; - } - if( pNew->pIndex ){ - sqlite3ErrorMsg(pParse, "Cannot add a UNIQUE column"); - return; - } - if( (db->flags&SQLITE_ForeignKeys) && pNew->pFKey && pDflt ){ - sqlite3ErrorMsg(pParse, - "Cannot add a REFERENCES column with non-NULL default value"); - return; - } - if( pCol->notNull && !pDflt ){ - sqlite3ErrorMsg(pParse, - "Cannot add a NOT NULL column with default value NULL"); - return; - } - - /* Ensure the default expression is something that sqlite3ValueFromExpr() - ** can handle (i.e. not CURRENT_TIME etc.) - */ - if( pDflt ){ - sqlite3_value *pVal = 0; - if( sqlite3ValueFromExpr(db, pDflt, SQLITE_UTF8, SQLITE_AFF_NONE, &pVal) ){ - db->mallocFailed = 1; - return; - } - if( !pVal ){ - sqlite3ErrorMsg(pParse, "Cannot add a column with non-constant default"); - return; - } - sqlite3ValueFree(pVal); - } - - /* Modify the CREATE TABLE statement. */ - zCol = sqlite3DbStrNDup(db, (char*)pColDef->z, pColDef->n); - if( zCol ){ - char *zEnd = &zCol[pColDef->n-1]; - int savedDbFlags = db->flags; - while( zEnd>zCol && (*zEnd==';' || sqlite3Isspace(*zEnd)) ){ - *zEnd-- = '\0'; - } - db->flags |= SQLITE_PreferBuiltin; - sqlite3NestedParse(pParse, - "UPDATE \"%w\".%s SET " - "sql = substr(sql,1,%d) || ', ' || %Q || substr(sql,%d) " - "WHERE type = 'table' AND name = %Q", - zDb, SCHEMA_TABLE(iDb), pNew->addColOffset, zCol, pNew->addColOffset+1, - zTab - ); - sqlite3DbFree(db, zCol); - db->flags = savedDbFlags; - } - - /* If the default value of the new column is NULL, then set the file - ** format to 2. If the default value of the new column is not NULL, - ** the file format becomes 3. - */ - sqlite3MinimumFileFormat(pParse, iDb, pDflt ? 3 : 2); - - /* Reload the schema of the modified table. */ - reloadTableSchema(pParse, pTab, pTab->zName); -} - -/* -** This function is called by the parser after the table-name in -** an "ALTER TABLE ADD" statement is parsed. Argument -** pSrc is the full-name of the table being altered. -** -** This routine makes a (partial) copy of the Table structure -** for the table being altered and sets Parse.pNewTable to point -** to it. Routines called by the parser as the column definition -** is parsed (i.e. sqlite3AddColumn()) add the new Column data to -** the copy. The copy of the Table structure is deleted by tokenize.c -** after parsing is finished. -** -** Routine sqlite3AlterFinishAddColumn() will be called to complete -** coding the "ALTER TABLE ... ADD" statement. -*/ -SQLITE_PRIVATE void sqlite3AlterBeginAddColumn(Parse *pParse, SrcList *pSrc){ - Table *pNew; - Table *pTab; - Vdbe *v; - int iDb; - int i; - int nAlloc; - sqlite3 *db = pParse->db; - - /* Look up the table being altered. */ - assert( pParse->pNewTable==0 ); - assert( sqlite3BtreeHoldsAllMutexes(db) ); - if( db->mallocFailed ) goto exit_begin_add_column; - pTab = sqlite3LocateTableItem(pParse, 0, &pSrc->a[0]); - if( !pTab ) goto exit_begin_add_column; - -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( IsVirtual(pTab) ){ - sqlite3ErrorMsg(pParse, "virtual tables may not be altered"); - goto exit_begin_add_column; - } -#endif - - /* Make sure this is not an attempt to ALTER a view. */ - if( pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "Cannot add a column to a view"); - goto exit_begin_add_column; - } - if( SQLITE_OK!=isSystemTable(pParse, pTab->zName) ){ - goto exit_begin_add_column; - } - - assert( pTab->addColOffset>0 ); - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - - /* Put a copy of the Table struct in Parse.pNewTable for the - ** sqlite3AddColumn() function and friends to modify. But modify - ** the name by adding an "sqlite_altertab_" prefix. By adding this - ** prefix, we insure that the name will not collide with an existing - ** table because user table are not allowed to have the "sqlite_" - ** prefix on their name. - */ - pNew = (Table*)sqlite3DbMallocZero(db, sizeof(Table)); - if( !pNew ) goto exit_begin_add_column; - pParse->pNewTable = pNew; - pNew->nRef = 1; - pNew->nCol = pTab->nCol; - assert( pNew->nCol>0 ); - nAlloc = (((pNew->nCol-1)/8)*8)+8; - assert( nAlloc>=pNew->nCol && nAlloc%8==0 && nAlloc-pNew->nCol<8 ); - pNew->aCol = (Column*)sqlite3DbMallocZero(db, sizeof(Column)*nAlloc); - pNew->zName = sqlite3MPrintf(db, "sqlite_altertab_%s", pTab->zName); - if( !pNew->aCol || !pNew->zName ){ - db->mallocFailed = 1; - goto exit_begin_add_column; - } - memcpy(pNew->aCol, pTab->aCol, sizeof(Column)*pNew->nCol); - for(i=0; inCol; i++){ - Column *pCol = &pNew->aCol[i]; - pCol->zName = sqlite3DbStrDup(db, pCol->zName); - pCol->zColl = 0; - pCol->zType = 0; - pCol->pDflt = 0; - pCol->zDflt = 0; - } - pNew->pSchema = db->aDb[iDb].pSchema; - pNew->addColOffset = pTab->addColOffset; - pNew->nRef = 1; - - /* Begin a transaction and increment the schema cookie. */ - sqlite3BeginWriteOperation(pParse, 0, iDb); - v = sqlite3GetVdbe(pParse); - if( !v ) goto exit_begin_add_column; - sqlite3ChangeCookie(pParse, iDb); - -exit_begin_add_column: - sqlite3SrcListDelete(db, pSrc); - return; -} -#endif /* SQLITE_ALTER_TABLE */ - -/************** End of alter.c ***********************************************/ -/************** Begin file analyze.c *****************************************/ -/* -** 2005-07-08 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code associated with the ANALYZE command. -** -** The ANALYZE command gather statistics about the content of tables -** and indices. These statistics are made available to the query planner -** to help it make better decisions about how to perform queries. -** -** The following system tables are or have been supported: -** -** CREATE TABLE sqlite_stat1(tbl, idx, stat); -** CREATE TABLE sqlite_stat2(tbl, idx, sampleno, sample); -** CREATE TABLE sqlite_stat3(tbl, idx, nEq, nLt, nDLt, sample); -** CREATE TABLE sqlite_stat4(tbl, idx, nEq, nLt, nDLt, sample); -** -** Additional tables might be added in future releases of SQLite. -** The sqlite_stat2 table is not created or used unless the SQLite version -** is between 3.6.18 and 3.7.8, inclusive, and unless SQLite is compiled -** with SQLITE_ENABLE_STAT2. The sqlite_stat2 table is deprecated. -** The sqlite_stat2 table is superseded by sqlite_stat3, which is only -** created and used by SQLite versions 3.7.9 and later and with -** SQLITE_ENABLE_STAT3 defined. The functionality of sqlite_stat3 -** is a superset of sqlite_stat2. The sqlite_stat4 is an enhanced -** version of sqlite_stat3 and is only available when compiled with -** SQLITE_ENABLE_STAT4 and in SQLite versions 3.8.1 and later. It is -** not possible to enable both STAT3 and STAT4 at the same time. If they -** are both enabled, then STAT4 takes precedence. -** -** For most applications, sqlite_stat1 provides all the statisics required -** for the query planner to make good choices. -** -** Format of sqlite_stat1: -** -** There is normally one row per index, with the index identified by the -** name in the idx column. The tbl column is the name of the table to -** which the index belongs. In each such row, the stat column will be -** a string consisting of a list of integers. The first integer in this -** list is the number of rows in the index. (This is the same as the -** number of rows in the table, except for partial indices.) The second -** integer is the average number of rows in the index that have the same -** value in the first column of the index. The third integer is the average -** number of rows in the index that have the same value for the first two -** columns. The N-th integer (for N>1) is the average number of rows in -** the index which have the same value for the first N-1 columns. For -** a K-column index, there will be K+1 integers in the stat column. If -** the index is unique, then the last integer will be 1. -** -** The list of integers in the stat column can optionally be followed -** by the keyword "unordered". The "unordered" keyword, if it is present, -** must be separated from the last integer by a single space. If the -** "unordered" keyword is present, then the query planner assumes that -** the index is unordered and will not use the index for a range query. -** -** If the sqlite_stat1.idx column is NULL, then the sqlite_stat1.stat -** column contains a single integer which is the (estimated) number of -** rows in the table identified by sqlite_stat1.tbl. -** -** Format of sqlite_stat2: -** -** The sqlite_stat2 is only created and is only used if SQLite is compiled -** with SQLITE_ENABLE_STAT2 and if the SQLite version number is between -** 3.6.18 and 3.7.8. The "stat2" table contains additional information -** about the distribution of keys within an index. The index is identified by -** the "idx" column and the "tbl" column is the name of the table to which -** the index belongs. There are usually 10 rows in the sqlite_stat2 -** table for each index. -** -** The sqlite_stat2 entries for an index that have sampleno between 0 and 9 -** inclusive are samples of the left-most key value in the index taken at -** evenly spaced points along the index. Let the number of samples be S -** (10 in the standard build) and let C be the number of rows in the index. -** Then the sampled rows are given by: -** -** rownumber = (i*C*2 + C)/(S*2) -** -** For i between 0 and S-1. Conceptually, the index space is divided into -** S uniform buckets and the samples are the middle row from each bucket. -** -** The format for sqlite_stat2 is recorded here for legacy reference. This -** version of SQLite does not support sqlite_stat2. It neither reads nor -** writes the sqlite_stat2 table. This version of SQLite only supports -** sqlite_stat3. -** -** Format for sqlite_stat3: -** -** The sqlite_stat3 format is a subset of sqlite_stat4. Hence, the -** sqlite_stat4 format will be described first. Further information -** about sqlite_stat3 follows the sqlite_stat4 description. -** -** Format for sqlite_stat4: -** -** As with sqlite_stat2, the sqlite_stat4 table contains histogram data -** to aid the query planner in choosing good indices based on the values -** that indexed columns are compared against in the WHERE clauses of -** queries. -** -** The sqlite_stat4 table contains multiple entries for each index. -** The idx column names the index and the tbl column is the table of the -** index. If the idx and tbl columns are the same, then the sample is -** of the INTEGER PRIMARY KEY. The sample column is a blob which is the -** binary encoding of a key from the index. The nEq column is a -** list of integers. The first integer is the approximate number -** of entries in the index whose left-most column exactly matches -** the left-most column of the sample. The second integer in nEq -** is the approximate number of entries in the index where the -** first two columns match the first two columns of the sample. -** And so forth. nLt is another list of integers that show the approximate -** number of entries that are strictly less than the sample. The first -** integer in nLt contains the number of entries in the index where the -** left-most column is less than the left-most column of the sample. -** The K-th integer in the nLt entry is the number of index entries -** where the first K columns are less than the first K columns of the -** sample. The nDLt column is like nLt except that it contains the -** number of distinct entries in the index that are less than the -** sample. -** -** There can be an arbitrary number of sqlite_stat4 entries per index. -** The ANALYZE command will typically generate sqlite_stat4 tables -** that contain between 10 and 40 samples which are distributed across -** the key space, though not uniformly, and which include samples with -** large nEq values. -** -** Format for sqlite_stat3 redux: -** -** The sqlite_stat3 table is like sqlite_stat4 except that it only -** looks at the left-most column of the index. The sqlite_stat3.sample -** column contains the actual value of the left-most column instead -** of a blob encoding of the complete index key as is found in -** sqlite_stat4.sample. The nEq, nLt, and nDLt entries of sqlite_stat3 -** all contain just a single integer which is the same as the first -** integer in the equivalent columns in sqlite_stat4. -*/ -#ifndef SQLITE_OMIT_ANALYZE - -#if defined(SQLITE_ENABLE_STAT4) -# define IsStat4 1 -# define IsStat3 0 -#elif defined(SQLITE_ENABLE_STAT3) -# define IsStat4 0 -# define IsStat3 1 -#else -# define IsStat4 0 -# define IsStat3 0 -# undef SQLITE_STAT4_SAMPLES -# define SQLITE_STAT4_SAMPLES 1 -#endif -#define IsStat34 (IsStat3+IsStat4) /* 1 for STAT3 or STAT4. 0 otherwise */ - -/* -** This routine generates code that opens the sqlite_statN tables. -** The sqlite_stat1 table is always relevant. sqlite_stat2 is now -** obsolete. sqlite_stat3 and sqlite_stat4 are only opened when -** appropriate compile-time options are provided. -** -** If the sqlite_statN tables do not previously exist, it is created. -** -** Argument zWhere may be a pointer to a buffer containing a table name, -** or it may be a NULL pointer. If it is not NULL, then all entries in -** the sqlite_statN tables associated with the named table are deleted. -** If zWhere==0, then code is generated to delete all stat table entries. -*/ -static void openStatTable( - Parse *pParse, /* Parsing context */ - int iDb, /* The database we are looking in */ - int iStatCur, /* Open the sqlite_stat1 table on this cursor */ - const char *zWhere, /* Delete entries for this table or index */ - const char *zWhereType /* Either "tbl" or "idx" */ -){ - static const struct { - const char *zName; - const char *zCols; - } aTable[] = { - { "sqlite_stat1", "tbl,idx,stat" }, -#if defined(SQLITE_ENABLE_STAT4) - { "sqlite_stat4", "tbl,idx,neq,nlt,ndlt,sample" }, - { "sqlite_stat3", 0 }, -#elif defined(SQLITE_ENABLE_STAT3) - { "sqlite_stat3", "tbl,idx,neq,nlt,ndlt,sample" }, - { "sqlite_stat4", 0 }, -#else - { "sqlite_stat3", 0 }, - { "sqlite_stat4", 0 }, -#endif - }; - int i; - sqlite3 *db = pParse->db; - Db *pDb; - Vdbe *v = sqlite3GetVdbe(pParse); - int aRoot[ArraySize(aTable)]; - u8 aCreateTbl[ArraySize(aTable)]; - - if( v==0 ) return; - assert( sqlite3BtreeHoldsAllMutexes(db) ); - assert( sqlite3VdbeDb(v)==db ); - pDb = &db->aDb[iDb]; - - /* Create new statistic tables if they do not exist, or clear them - ** if they do already exist. - */ - for(i=0; izName))==0 ){ - if( aTable[i].zCols ){ - /* The sqlite_statN table does not exist. Create it. Note that a - ** side-effect of the CREATE TABLE statement is to leave the rootpage - ** of the new table in register pParse->regRoot. This is important - ** because the OpenWrite opcode below will be needing it. */ - sqlite3NestedParse(pParse, - "CREATE TABLE %Q.%s(%s)", pDb->zName, zTab, aTable[i].zCols - ); - aRoot[i] = pParse->regRoot; - aCreateTbl[i] = OPFLAG_P2ISREG; - } - }else{ - /* The table already exists. If zWhere is not NULL, delete all entries - ** associated with the table zWhere. If zWhere is NULL, delete the - ** entire contents of the table. */ - aRoot[i] = pStat->tnum; - aCreateTbl[i] = 0; - sqlite3TableLock(pParse, iDb, aRoot[i], 1, zTab); - if( zWhere ){ - sqlite3NestedParse(pParse, - "DELETE FROM %Q.%s WHERE %s=%Q", - pDb->zName, zTab, zWhereType, zWhere - ); - }else{ - /* The sqlite_stat[134] table already exists. Delete all rows. */ - sqlite3VdbeAddOp2(v, OP_Clear, aRoot[i], iDb); - } - } - } - - /* Open the sqlite_stat[134] tables for writing. */ - for(i=0; aTable[i].zCols; i++){ - assert( inRowid ){ - sqlite3DbFree(db, p->u.aRowid); - p->nRowid = 0; - } -} -#endif - -/* Initialize the BLOB value of a ROWID -*/ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -static void sampleSetRowid(sqlite3 *db, Stat4Sample *p, int n, const u8 *pData){ - assert( db!=0 ); - if( p->nRowid ) sqlite3DbFree(db, p->u.aRowid); - p->u.aRowid = sqlite3DbMallocRaw(db, n); - if( p->u.aRowid ){ - p->nRowid = n; - memcpy(p->u.aRowid, pData, n); - }else{ - p->nRowid = 0; - } -} -#endif - -/* Initialize the INTEGER value of a ROWID. -*/ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -static void sampleSetRowidInt64(sqlite3 *db, Stat4Sample *p, i64 iRowid){ - assert( db!=0 ); - if( p->nRowid ) sqlite3DbFree(db, p->u.aRowid); - p->nRowid = 0; - p->u.iRowid = iRowid; -} -#endif - - -/* -** Copy the contents of object (*pFrom) into (*pTo). -*/ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -static void sampleCopy(Stat4Accum *p, Stat4Sample *pTo, Stat4Sample *pFrom){ - pTo->isPSample = pFrom->isPSample; - pTo->iCol = pFrom->iCol; - pTo->iHash = pFrom->iHash; - memcpy(pTo->anEq, pFrom->anEq, sizeof(tRowcnt)*p->nCol); - memcpy(pTo->anLt, pFrom->anLt, sizeof(tRowcnt)*p->nCol); - memcpy(pTo->anDLt, pFrom->anDLt, sizeof(tRowcnt)*p->nCol); - if( pFrom->nRowid ){ - sampleSetRowid(p->db, pTo, pFrom->nRowid, pFrom->u.aRowid); - }else{ - sampleSetRowidInt64(p->db, pTo, pFrom->u.iRowid); - } -} -#endif - -/* -** Reclaim all memory of a Stat4Accum structure. -*/ -static void stat4Destructor(void *pOld){ - Stat4Accum *p = (Stat4Accum*)pOld; -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - int i; - for(i=0; inCol; i++) sampleClear(p->db, p->aBest+i); - for(i=0; imxSample; i++) sampleClear(p->db, p->a+i); - sampleClear(p->db, &p->current); -#endif - sqlite3DbFree(p->db, p); -} - -/* -** Implementation of the stat_init(N,C) SQL function. The two parameters -** are the number of rows in the table or index (C) and the number of columns -** in the index (N). The second argument (C) is only used for STAT3 and STAT4. -** -** This routine allocates the Stat4Accum object in heap memory. The return -** value is a pointer to the the Stat4Accum object encoded as a blob (i.e. -** the size of the blob is sizeof(void*) bytes). -*/ -static void statInit( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - Stat4Accum *p; - int nCol; /* Number of columns in index being sampled */ - int nColUp; /* nCol rounded up for alignment */ - int n; /* Bytes of space to allocate */ - sqlite3 *db; /* Database connection */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - int mxSample = SQLITE_STAT4_SAMPLES; -#endif - - /* Decode the three function arguments */ - UNUSED_PARAMETER(argc); - nCol = sqlite3_value_int(argv[0]); - assert( nCol>1 ); /* >1 because it includes the rowid column */ - nColUp = sizeof(tRowcnt)<8 ? (nCol+1)&~1 : nCol; - - /* Allocate the space required for the Stat4Accum object */ - n = sizeof(*p) - + sizeof(tRowcnt)*nColUp /* Stat4Accum.anEq */ - + sizeof(tRowcnt)*nColUp /* Stat4Accum.anDLt */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - + sizeof(tRowcnt)*nColUp /* Stat4Accum.anLt */ - + sizeof(Stat4Sample)*(nCol+mxSample) /* Stat4Accum.aBest[], a[] */ - + sizeof(tRowcnt)*3*nColUp*(nCol+mxSample) -#endif - ; - db = sqlite3_context_db_handle(context); - p = sqlite3DbMallocZero(db, n); - if( p==0 ){ - sqlite3_result_error_nomem(context); - return; - } - - p->db = db; - p->nRow = 0; - p->nCol = nCol; - p->current.anDLt = (tRowcnt*)&p[1]; - p->current.anEq = &p->current.anDLt[nColUp]; - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - { - u8 *pSpace; /* Allocated space not yet assigned */ - int i; /* Used to iterate through p->aSample[] */ - - p->iGet = -1; - p->mxSample = mxSample; - p->nPSample = (tRowcnt)(sqlite3_value_int64(argv[1])/(mxSample/3+1) + 1); - p->current.anLt = &p->current.anEq[nColUp]; - p->iPrn = nCol*0x689e962d ^ sqlite3_value_int(argv[1])*0xd0944565; - - /* Set up the Stat4Accum.a[] and aBest[] arrays */ - p->a = (struct Stat4Sample*)&p->current.anLt[nColUp]; - p->aBest = &p->a[mxSample]; - pSpace = (u8*)(&p->a[mxSample+nCol]); - for(i=0; i<(mxSample+nCol); i++){ - p->a[i].anEq = (tRowcnt *)pSpace; pSpace += (sizeof(tRowcnt) * nColUp); - p->a[i].anLt = (tRowcnt *)pSpace; pSpace += (sizeof(tRowcnt) * nColUp); - p->a[i].anDLt = (tRowcnt *)pSpace; pSpace += (sizeof(tRowcnt) * nColUp); - } - assert( (pSpace - (u8*)p)==n ); - - for(i=0; iaBest[i].iCol = i; - } - } -#endif - - /* Return a pointer to the allocated object to the caller */ - sqlite3_result_blob(context, p, sizeof(p), stat4Destructor); -} -static const FuncDef statInitFuncdef = { - 1+IsStat34, /* nArg */ - SQLITE_UTF8, /* funcFlags */ - 0, /* pUserData */ - 0, /* pNext */ - statInit, /* xFunc */ - 0, /* xStep */ - 0, /* xFinalize */ - "stat_init", /* zName */ - 0, /* pHash */ - 0 /* pDestructor */ -}; - -#ifdef SQLITE_ENABLE_STAT4 -/* -** pNew and pOld are both candidate non-periodic samples selected for -** the same column (pNew->iCol==pOld->iCol). Ignoring this column and -** considering only any trailing columns and the sample hash value, this -** function returns true if sample pNew is to be preferred over pOld. -** In other words, if we assume that the cardinalities of the selected -** column for pNew and pOld are equal, is pNew to be preferred over pOld. -** -** This function assumes that for each argument sample, the contents of -** the anEq[] array from pSample->anEq[pSample->iCol+1] onwards are valid. -*/ -static int sampleIsBetterPost( - Stat4Accum *pAccum, - Stat4Sample *pNew, - Stat4Sample *pOld -){ - int nCol = pAccum->nCol; - int i; - assert( pNew->iCol==pOld->iCol ); - for(i=pNew->iCol+1; ianEq[i]>pOld->anEq[i] ) return 1; - if( pNew->anEq[i]anEq[i] ) return 0; - } - if( pNew->iHash>pOld->iHash ) return 1; - return 0; -} -#endif - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -/* -** Return true if pNew is to be preferred over pOld. -** -** This function assumes that for each argument sample, the contents of -** the anEq[] array from pSample->anEq[pSample->iCol] onwards are valid. -*/ -static int sampleIsBetter( - Stat4Accum *pAccum, - Stat4Sample *pNew, - Stat4Sample *pOld -){ - tRowcnt nEqNew = pNew->anEq[pNew->iCol]; - tRowcnt nEqOld = pOld->anEq[pOld->iCol]; - - assert( pOld->isPSample==0 && pNew->isPSample==0 ); - assert( IsStat4 || (pNew->iCol==0 && pOld->iCol==0) ); - - if( (nEqNew>nEqOld) ) return 1; -#ifdef SQLITE_ENABLE_STAT4 - if( nEqNew==nEqOld ){ - if( pNew->iColiCol ) return 1; - return (pNew->iCol==pOld->iCol && sampleIsBetterPost(pAccum, pNew, pOld)); - } - return 0; -#else - return (nEqNew==nEqOld && pNew->iHash>pOld->iHash); -#endif -} - -/* -** Copy the contents of sample *pNew into the p->a[] array. If necessary, -** remove the least desirable sample from p->a[] to make room. -*/ -static void sampleInsert(Stat4Accum *p, Stat4Sample *pNew, int nEqZero){ - Stat4Sample *pSample = 0; - int i; - - assert( IsStat4 || nEqZero==0 ); - -#ifdef SQLITE_ENABLE_STAT4 - if( pNew->isPSample==0 ){ - Stat4Sample *pUpgrade = 0; - assert( pNew->anEq[pNew->iCol]>0 ); - - /* This sample is being added because the prefix that ends in column - ** iCol occurs many times in the table. However, if we have already - ** added a sample that shares this prefix, there is no need to add - ** this one. Instead, upgrade the priority of the highest priority - ** existing sample that shares this prefix. */ - for(i=p->nSample-1; i>=0; i--){ - Stat4Sample *pOld = &p->a[i]; - if( pOld->anEq[pNew->iCol]==0 ){ - if( pOld->isPSample ) return; - assert( pOld->iCol>pNew->iCol ); - assert( sampleIsBetter(p, pNew, pOld) ); - if( pUpgrade==0 || sampleIsBetter(p, pOld, pUpgrade) ){ - pUpgrade = pOld; - } - } - } - if( pUpgrade ){ - pUpgrade->iCol = pNew->iCol; - pUpgrade->anEq[pUpgrade->iCol] = pNew->anEq[pUpgrade->iCol]; - goto find_new_min; - } - } -#endif - - /* If necessary, remove sample iMin to make room for the new sample. */ - if( p->nSample>=p->mxSample ){ - Stat4Sample *pMin = &p->a[p->iMin]; - tRowcnt *anEq = pMin->anEq; - tRowcnt *anLt = pMin->anLt; - tRowcnt *anDLt = pMin->anDLt; - sampleClear(p->db, pMin); - memmove(pMin, &pMin[1], sizeof(p->a[0])*(p->nSample-p->iMin-1)); - pSample = &p->a[p->nSample-1]; - pSample->nRowid = 0; - pSample->anEq = anEq; - pSample->anDLt = anDLt; - pSample->anLt = anLt; - p->nSample = p->mxSample-1; - } - - /* The "rows less-than" for the rowid column must be greater than that - ** for the last sample in the p->a[] array. Otherwise, the samples would - ** be out of order. */ -#ifdef SQLITE_ENABLE_STAT4 - assert( p->nSample==0 - || pNew->anLt[p->nCol-1] > p->a[p->nSample-1].anLt[p->nCol-1] ); -#endif - - /* Insert the new sample */ - pSample = &p->a[p->nSample]; - sampleCopy(p, pSample, pNew); - p->nSample++; - - /* Zero the first nEqZero entries in the anEq[] array. */ - memset(pSample->anEq, 0, sizeof(tRowcnt)*nEqZero); - -#ifdef SQLITE_ENABLE_STAT4 - find_new_min: -#endif - if( p->nSample>=p->mxSample ){ - int iMin = -1; - for(i=0; imxSample; i++){ - if( p->a[i].isPSample ) continue; - if( iMin<0 || sampleIsBetter(p, &p->a[iMin], &p->a[i]) ){ - iMin = i; - } - } - assert( iMin>=0 ); - p->iMin = iMin; - } -} -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ - -/* -** Field iChng of the index being scanned has changed. So at this point -** p->current contains a sample that reflects the previous row of the -** index. The value of anEq[iChng] and subsequent anEq[] elements are -** correct at this point. -*/ -static void samplePushPrevious(Stat4Accum *p, int iChng){ -#ifdef SQLITE_ENABLE_STAT4 - int i; - - /* Check if any samples from the aBest[] array should be pushed - ** into IndexSample.a[] at this point. */ - for(i=(p->nCol-2); i>=iChng; i--){ - Stat4Sample *pBest = &p->aBest[i]; - pBest->anEq[i] = p->current.anEq[i]; - if( p->nSamplemxSample || sampleIsBetter(p, pBest, &p->a[p->iMin]) ){ - sampleInsert(p, pBest, i); - } - } - - /* Update the anEq[] fields of any samples already collected. */ - for(i=p->nSample-1; i>=0; i--){ - int j; - for(j=iChng; jnCol; j++){ - if( p->a[i].anEq[j]==0 ) p->a[i].anEq[j] = p->current.anEq[j]; - } - } -#endif - -#if defined(SQLITE_ENABLE_STAT3) && !defined(SQLITE_ENABLE_STAT4) - if( iChng==0 ){ - tRowcnt nLt = p->current.anLt[0]; - tRowcnt nEq = p->current.anEq[0]; - - /* Check if this is to be a periodic sample. If so, add it. */ - if( (nLt/p->nPSample)!=(nLt+nEq)/p->nPSample ){ - p->current.isPSample = 1; - sampleInsert(p, &p->current, 0); - p->current.isPSample = 0; - }else - - /* Or if it is a non-periodic sample. Add it in this case too. */ - if( p->nSamplemxSample - || sampleIsBetter(p, &p->current, &p->a[p->iMin]) - ){ - sampleInsert(p, &p->current, 0); - } - } -#endif - -#ifndef SQLITE_ENABLE_STAT3_OR_STAT4 - UNUSED_PARAMETER( p ); - UNUSED_PARAMETER( iChng ); -#endif -} - -/* -** Implementation of the stat_push SQL function: stat_push(P,C,R) -** Arguments: -** -** P Pointer to the Stat4Accum object created by stat_init() -** C Index of left-most column to differ from previous row -** R Rowid for the current row. Might be a key record for -** WITHOUT ROWID tables. -** -** The SQL function always returns NULL. -** -** The R parameter is only used for STAT3 and STAT4 -*/ -static void statPush( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - int i; - - /* The three function arguments */ - Stat4Accum *p = (Stat4Accum*)sqlite3_value_blob(argv[0]); - int iChng = sqlite3_value_int(argv[1]); - - UNUSED_PARAMETER( argc ); - UNUSED_PARAMETER( context ); - assert( p->nCol>1 ); /* Includes rowid field */ - assert( iChngnCol ); - - if( p->nRow==0 ){ - /* This is the first call to this function. Do initialization. */ - for(i=0; inCol; i++) p->current.anEq[i] = 1; - }else{ - /* Second and subsequent calls get processed here */ - samplePushPrevious(p, iChng); - - /* Update anDLt[], anLt[] and anEq[] to reflect the values that apply - ** to the current row of the index. */ - for(i=0; icurrent.anEq[i]++; - } - for(i=iChng; inCol; i++){ - p->current.anDLt[i]++; -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - p->current.anLt[i] += p->current.anEq[i]; -#endif - p->current.anEq[i] = 1; - } - } - p->nRow++; -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - if( sqlite3_value_type(argv[2])==SQLITE_INTEGER ){ - sampleSetRowidInt64(p->db, &p->current, sqlite3_value_int64(argv[2])); - }else{ - sampleSetRowid(p->db, &p->current, sqlite3_value_bytes(argv[2]), - sqlite3_value_blob(argv[2])); - } - p->current.iHash = p->iPrn = p->iPrn*1103515245 + 12345; -#endif - -#ifdef SQLITE_ENABLE_STAT4 - { - tRowcnt nLt = p->current.anLt[p->nCol-1]; - - /* Check if this is to be a periodic sample. If so, add it. */ - if( (nLt/p->nPSample)!=(nLt+1)/p->nPSample ){ - p->current.isPSample = 1; - p->current.iCol = 0; - sampleInsert(p, &p->current, p->nCol-1); - p->current.isPSample = 0; - } - - /* Update the aBest[] array. */ - for(i=0; i<(p->nCol-1); i++){ - p->current.iCol = i; - if( i>=iChng || sampleIsBetterPost(p, &p->current, &p->aBest[i]) ){ - sampleCopy(p, &p->aBest[i], &p->current); - } - } - } -#endif -} -static const FuncDef statPushFuncdef = { - 2+IsStat34, /* nArg */ - SQLITE_UTF8, /* funcFlags */ - 0, /* pUserData */ - 0, /* pNext */ - statPush, /* xFunc */ - 0, /* xStep */ - 0, /* xFinalize */ - "stat_push", /* zName */ - 0, /* pHash */ - 0 /* pDestructor */ -}; - -#define STAT_GET_STAT1 0 /* "stat" column of stat1 table */ -#define STAT_GET_ROWID 1 /* "rowid" column of stat[34] entry */ -#define STAT_GET_NEQ 2 /* "neq" column of stat[34] entry */ -#define STAT_GET_NLT 3 /* "nlt" column of stat[34] entry */ -#define STAT_GET_NDLT 4 /* "ndlt" column of stat[34] entry */ - -/* -** Implementation of the stat_get(P,J) SQL function. This routine is -** used to query the results. Content is returned for parameter J -** which is one of the STAT_GET_xxxx values defined above. -** -** If neither STAT3 nor STAT4 are enabled, then J is always -** STAT_GET_STAT1 and is hence omitted and this routine becomes -** a one-parameter function, stat_get(P), that always returns the -** stat1 table entry information. -*/ -static void statGet( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - Stat4Accum *p = (Stat4Accum*)sqlite3_value_blob(argv[0]); -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - /* STAT3 and STAT4 have a parameter on this routine. */ - int eCall = sqlite3_value_int(argv[1]); - assert( argc==2 ); - assert( eCall==STAT_GET_STAT1 || eCall==STAT_GET_NEQ - || eCall==STAT_GET_ROWID || eCall==STAT_GET_NLT - || eCall==STAT_GET_NDLT - ); - if( eCall==STAT_GET_STAT1 ) -#else - assert( argc==1 ); -#endif - { - /* Return the value to store in the "stat" column of the sqlite_stat1 - ** table for this index. - ** - ** The value is a string composed of a list of integers describing - ** the index. The first integer in the list is the total number of - ** entries in the index. There is one additional integer in the list - ** for each indexed column. This additional integer is an estimate of - ** the number of rows matched by a stabbing query on the index using - ** a key with the corresponding number of fields. In other words, - ** if the index is on columns (a,b) and the sqlite_stat1 value is - ** "100 10 2", then SQLite estimates that: - ** - ** * the index contains 100 rows, - ** * "WHERE a=?" matches 10 rows, and - ** * "WHERE a=? AND b=?" matches 2 rows. - ** - ** If D is the count of distinct values and K is the total number of - ** rows, then each estimate is computed as: - ** - ** I = (K+D-1)/D - */ - char *z; - int i; - - char *zRet = sqlite3MallocZero(p->nCol * 25); - if( zRet==0 ){ - sqlite3_result_error_nomem(context); - return; - } - - sqlite3_snprintf(24, zRet, "%llu", (u64)p->nRow); - z = zRet + sqlite3Strlen30(zRet); - for(i=0; i<(p->nCol-1); i++){ - u64 nDistinct = p->current.anDLt[i] + 1; - u64 iVal = (p->nRow + nDistinct - 1) / nDistinct; - sqlite3_snprintf(24, z, " %llu", iVal); - z += sqlite3Strlen30(z); - assert( p->current.anEq[i] ); - } - assert( z[0]=='\0' && z>zRet ); - - sqlite3_result_text(context, zRet, -1, sqlite3_free); - } -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - else if( eCall==STAT_GET_ROWID ){ - if( p->iGet<0 ){ - samplePushPrevious(p, 0); - p->iGet = 0; - } - if( p->iGetnSample ){ - Stat4Sample *pS = p->a + p->iGet; - if( pS->nRowid==0 ){ - sqlite3_result_int64(context, pS->u.iRowid); - }else{ - sqlite3_result_blob(context, pS->u.aRowid, pS->nRowid, - SQLITE_TRANSIENT); - } - } - }else{ - tRowcnt *aCnt = 0; - - assert( p->iGetnSample ); - switch( eCall ){ - case STAT_GET_NEQ: aCnt = p->a[p->iGet].anEq; break; - case STAT_GET_NLT: aCnt = p->a[p->iGet].anLt; break; - default: { - aCnt = p->a[p->iGet].anDLt; - p->iGet++; - break; - } - } - - if( IsStat3 ){ - sqlite3_result_int64(context, (i64)aCnt[0]); - }else{ - char *zRet = sqlite3MallocZero(p->nCol * 25); - if( zRet==0 ){ - sqlite3_result_error_nomem(context); - }else{ - int i; - char *z = zRet; - for(i=0; inCol; i++){ - sqlite3_snprintf(24, z, "%llu ", (u64)aCnt[i]); - z += sqlite3Strlen30(z); - } - assert( z[0]=='\0' && z>zRet ); - z[-1] = '\0'; - sqlite3_result_text(context, zRet, -1, sqlite3_free); - } - } - } -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ -#ifndef SQLITE_DEBUG - UNUSED_PARAMETER( argc ); -#endif -} -static const FuncDef statGetFuncdef = { - 1+IsStat34, /* nArg */ - SQLITE_UTF8, /* funcFlags */ - 0, /* pUserData */ - 0, /* pNext */ - statGet, /* xFunc */ - 0, /* xStep */ - 0, /* xFinalize */ - "stat_get", /* zName */ - 0, /* pHash */ - 0 /* pDestructor */ -}; - -static void callStatGet(Vdbe *v, int regStat4, int iParam, int regOut){ - assert( regOut!=regStat4 && regOut!=regStat4+1 ); -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - sqlite3VdbeAddOp2(v, OP_Integer, iParam, regStat4+1); -#elif SQLITE_DEBUG - assert( iParam==STAT_GET_STAT1 ); -#else - UNUSED_PARAMETER( iParam ); -#endif - sqlite3VdbeAddOp3(v, OP_Function, 0, regStat4, regOut); - sqlite3VdbeChangeP4(v, -1, (char*)&statGetFuncdef, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, 1 + IsStat34); -} - -/* -** Generate code to do an analysis of all indices associated with -** a single table. -*/ -static void analyzeOneTable( - Parse *pParse, /* Parser context */ - Table *pTab, /* Table whose indices are to be analyzed */ - Index *pOnlyIdx, /* If not NULL, only analyze this one index */ - int iStatCur, /* Index of VdbeCursor that writes the sqlite_stat1 table */ - int iMem, /* Available memory locations begin here */ - int iTab /* Next available cursor */ -){ - sqlite3 *db = pParse->db; /* Database handle */ - Index *pIdx; /* An index to being analyzed */ - int iIdxCur; /* Cursor open on index being analyzed */ - int iTabCur; /* Table cursor */ - Vdbe *v; /* The virtual machine being built up */ - int i; /* Loop counter */ - int jZeroRows = -1; /* Jump from here if number of rows is zero */ - int iDb; /* Index of database containing pTab */ - u8 needTableCnt = 1; /* True to count the table */ - int regNewRowid = iMem++; /* Rowid for the inserted record */ - int regStat4 = iMem++; /* Register to hold Stat4Accum object */ - int regChng = iMem++; /* Index of changed index field */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - int regRowid = iMem++; /* Rowid argument passed to stat_push() */ -#endif - int regTemp = iMem++; /* Temporary use register */ - int regTabname = iMem++; /* Register containing table name */ - int regIdxname = iMem++; /* Register containing index name */ - int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */ - int regPrev = iMem; /* MUST BE LAST (see below) */ - - pParse->nMem = MAX(pParse->nMem, iMem); - v = sqlite3GetVdbe(pParse); - if( v==0 || NEVER(pTab==0) ){ - return; - } - if( pTab->tnum==0 ){ - /* Do not gather statistics on views or virtual tables */ - return; - } - if( sqlite3_strnicmp(pTab->zName, "sqlite_", 7)==0 ){ - /* Do not gather statistics on system tables */ - return; - } - assert( sqlite3BtreeHoldsAllMutexes(db) ); - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - assert( iDb>=0 ); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); -#ifndef SQLITE_OMIT_AUTHORIZATION - if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0, - db->aDb[iDb].zName ) ){ - return; - } -#endif - - /* Establish a read-lock on the table at the shared-cache level. - ** Open a read-only cursor on the table. Also allocate a cursor number - ** to use for scanning indexes (iIdxCur). No index cursor is opened at - ** this time though. */ - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); - iTabCur = iTab++; - iIdxCur = iTab++; - pParse->nTab = MAX(pParse->nTab, iTab); - sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); - sqlite3VdbeAddOp4(v, OP_String8, 0, regTabname, 0, pTab->zName, 0); - - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - int nCol; /* Number of columns indexed by pIdx */ - int *aGotoChng; /* Array of jump instruction addresses */ - int addrRewind; /* Address of "OP_Rewind iIdxCur" */ - int addrGotoChng0; /* Address of "Goto addr_chng_0" */ - int addrNextRow; /* Address of "next_row:" */ - const char *zIdxName; /* Name of the index */ - - if( pOnlyIdx && pOnlyIdx!=pIdx ) continue; - if( pIdx->pPartIdxWhere==0 ) needTableCnt = 0; - VdbeNoopComment((v, "Begin analysis of %s", pIdx->zName)); - nCol = pIdx->nKeyCol; - aGotoChng = sqlite3DbMallocRaw(db, sizeof(int)*(nCol+1)); - if( aGotoChng==0 ) continue; - - /* Populate the register containing the index name. */ - if( pIdx->autoIndex==2 && !HasRowid(pTab) ){ - zIdxName = pTab->zName; - }else{ - zIdxName = pIdx->zName; - } - sqlite3VdbeAddOp4(v, OP_String8, 0, regIdxname, 0, zIdxName, 0); - - /* - ** Pseudo-code for loop that calls stat_push(): - ** - ** Rewind csr - ** if eof(csr) goto end_of_scan; - ** regChng = 0 - ** goto chng_addr_0; - ** - ** next_row: - ** regChng = 0 - ** if( idx(0) != regPrev(0) ) goto chng_addr_0 - ** regChng = 1 - ** if( idx(1) != regPrev(1) ) goto chng_addr_1 - ** ... - ** regChng = N - ** goto chng_addr_N - ** - ** chng_addr_0: - ** regPrev(0) = idx(0) - ** chng_addr_1: - ** regPrev(1) = idx(1) - ** ... - ** - ** chng_addr_N: - ** regRowid = idx(rowid) - ** stat_push(P, regChng, regRowid) - ** Next csr - ** if !eof(csr) goto next_row; - ** - ** end_of_scan: - */ - - /* Make sure there are enough memory cells allocated to accommodate - ** the regPrev array and a trailing rowid (the rowid slot is required - ** when building a record to insert into the sample column of - ** the sqlite_stat4 table. */ - pParse->nMem = MAX(pParse->nMem, regPrev+nCol); - - /* Open a read-only cursor on the index being analyzed. */ - assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) ); - sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); - VdbeComment((v, "%s", pIdx->zName)); - - /* Invoke the stat_init() function. The arguments are: - ** - ** (1) the number of columns in the index including the rowid, - ** (2) the number of rows in the index, - ** - ** The second argument is only used for STAT3 and STAT4 - */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+2); -#endif - sqlite3VdbeAddOp2(v, OP_Integer, nCol+1, regStat4+1); - sqlite3VdbeAddOp3(v, OP_Function, 0, regStat4+1, regStat4); - sqlite3VdbeChangeP4(v, -1, (char*)&statInitFuncdef, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, 1+IsStat34); - - /* Implementation of the following: - ** - ** Rewind csr - ** if eof(csr) goto end_of_scan; - ** regChng = 0 - ** goto next_push_0; - ** - */ - addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); - sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng); - addrGotoChng0 = sqlite3VdbeAddOp0(v, OP_Goto); - - /* - ** next_row: - ** regChng = 0 - ** if( idx(0) != regPrev(0) ) goto chng_addr_0 - ** regChng = 1 - ** if( idx(1) != regPrev(1) ) goto chng_addr_1 - ** ... - ** regChng = N - ** goto chng_addr_N - */ - addrNextRow = sqlite3VdbeCurrentAddr(v); - for(i=0; iazColl[i]); - sqlite3VdbeAddOp2(v, OP_Integer, i, regChng); - sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regTemp); - aGotoChng[i] = - sqlite3VdbeAddOp4(v, OP_Ne, regTemp, 0, regPrev+i, pColl, P4_COLLSEQ); - sqlite3VdbeChangeP5(v, SQLITE_NULLEQ); - } - sqlite3VdbeAddOp2(v, OP_Integer, nCol, regChng); - aGotoChng[nCol] = sqlite3VdbeAddOp0(v, OP_Goto); - - /* - ** chng_addr_0: - ** regPrev(0) = idx(0) - ** chng_addr_1: - ** regPrev(1) = idx(1) - ** ... - */ - sqlite3VdbeJumpHere(v, addrGotoChng0); - for(i=0; ipTable); - int j, k, regKey; - regKey = sqlite3GetTempRange(pParse, pPk->nKeyCol); - for(j=0; jnKeyCol; j++){ - k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]); - sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, regKey+j); - VdbeComment((v, "%s", pTab->aCol[pPk->aiColumn[j]].zName)); - } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regKey, pPk->nKeyCol, regRowid); - sqlite3ReleaseTempRange(pParse, regKey, pPk->nKeyCol); - } -#endif - assert( regChng==(regStat4+1) ); - sqlite3VdbeAddOp3(v, OP_Function, 1, regStat4, regTemp); - sqlite3VdbeChangeP4(v, -1, (char*)&statPushFuncdef, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, 2+IsStat34); - sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, addrNextRow); - - /* Add the entry to the stat1 table. */ - callStatGet(v, regStat4, STAT_GET_STAT1, regStat1); - sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "aaa", 0); - sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); - sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - - /* Add the entries to the stat3 or stat4 table. */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - { - int regEq = regStat1; - int regLt = regStat1+1; - int regDLt = regStat1+2; - int regSample = regStat1+3; - int regCol = regStat1+4; - int regSampleRowid = regCol + nCol; - int addrNext; - int addrIsNull; - u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound; - - pParse->nMem = MAX(pParse->nMem, regCol+nCol+1); - - addrNext = sqlite3VdbeCurrentAddr(v); - callStatGet(v, regStat4, STAT_GET_ROWID, regSampleRowid); - addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid); - callStatGet(v, regStat4, STAT_GET_NEQ, regEq); - callStatGet(v, regStat4, STAT_GET_NLT, regLt); - callStatGet(v, regStat4, STAT_GET_NDLT, regDLt); - sqlite3VdbeAddOp4Int(v, seekOp, iTabCur, addrNext, regSampleRowid, 0); -#ifdef SQLITE_ENABLE_STAT3 - sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, - pIdx->aiColumn[0], regSample); -#else - for(i=0; iaiColumn[i]; - sqlite3ExprCodeGetColumnOfTable(v, pTab, iTabCur, iCol, regCol+i); - } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regCol, nCol+1, regSample); -#endif - sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 6, regTemp, "bbbbbb", 0); - sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur+1, regNewRowid); - sqlite3VdbeAddOp3(v, OP_Insert, iStatCur+1, regTemp, regNewRowid); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrNext); - sqlite3VdbeJumpHere(v, addrIsNull); - } -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ - - /* End of analysis */ - sqlite3VdbeJumpHere(v, addrRewind); - sqlite3DbFree(db, aGotoChng); - } - - - /* Create a single sqlite_stat1 entry containing NULL as the index - ** name and the row count as the content. - */ - if( pOnlyIdx==0 && needTableCnt ){ - VdbeComment((v, "%s", pTab->zName)); - sqlite3VdbeAddOp2(v, OP_Count, iTabCur, regStat1); - jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1); - sqlite3VdbeAddOp2(v, OP_Null, 0, regIdxname); - sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, "aaa", 0); - sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); - sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - sqlite3VdbeJumpHere(v, jZeroRows); - } -} - - -/* -** Generate code that will cause the most recent index analysis to -** be loaded into internal hash tables where is can be used. -*/ -static void loadAnalysis(Parse *pParse, int iDb){ - Vdbe *v = sqlite3GetVdbe(pParse); - if( v ){ - sqlite3VdbeAddOp1(v, OP_LoadAnalysis, iDb); - } -} - -/* -** Generate code that will do an analysis of an entire database -*/ -static void analyzeDatabase(Parse *pParse, int iDb){ - sqlite3 *db = pParse->db; - Schema *pSchema = db->aDb[iDb].pSchema; /* Schema of database iDb */ - HashElem *k; - int iStatCur; - int iMem; - int iTab; - - sqlite3BeginWriteOperation(pParse, 0, iDb); - iStatCur = pParse->nTab; - pParse->nTab += 3; - openStatTable(pParse, iDb, iStatCur, 0, 0); - iMem = pParse->nMem+1; - iTab = pParse->nTab; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - for(k=sqliteHashFirst(&pSchema->tblHash); k; k=sqliteHashNext(k)){ - Table *pTab = (Table*)sqliteHashData(k); - analyzeOneTable(pParse, pTab, 0, iStatCur, iMem, iTab); - } - loadAnalysis(pParse, iDb); -} - -/* -** Generate code that will do an analysis of a single table in -** a database. If pOnlyIdx is not NULL then it is a single index -** in pTab that should be analyzed. -*/ -static void analyzeTable(Parse *pParse, Table *pTab, Index *pOnlyIdx){ - int iDb; - int iStatCur; - - assert( pTab!=0 ); - assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - sqlite3BeginWriteOperation(pParse, 0, iDb); - iStatCur = pParse->nTab; - pParse->nTab += 3; - if( pOnlyIdx ){ - openStatTable(pParse, iDb, iStatCur, pOnlyIdx->zName, "idx"); - }else{ - openStatTable(pParse, iDb, iStatCur, pTab->zName, "tbl"); - } - analyzeOneTable(pParse, pTab, pOnlyIdx, iStatCur,pParse->nMem+1,pParse->nTab); - loadAnalysis(pParse, iDb); -} - -/* -** Generate code for the ANALYZE command. The parser calls this routine -** when it recognizes an ANALYZE command. -** -** ANALYZE -- 1 -** ANALYZE -- 2 -** ANALYZE ?.? -- 3 -** -** Form 1 causes all indices in all attached databases to be analyzed. -** Form 2 analyzes all indices the single database named. -** Form 3 analyzes all indices associated with the named table. -*/ -SQLITE_PRIVATE void sqlite3Analyze(Parse *pParse, Token *pName1, Token *pName2){ - sqlite3 *db = pParse->db; - int iDb; - int i; - char *z, *zDb; - Table *pTab; - Index *pIdx; - Token *pTableName; - - /* Read the database schema. If an error occurs, leave an error message - ** and code in pParse and return NULL. */ - assert( sqlite3BtreeHoldsAllMutexes(pParse->db) ); - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ - return; - } - - assert( pName2!=0 || pName1==0 ); - if( pName1==0 ){ - /* Form 1: Analyze everything */ - for(i=0; inDb; i++){ - if( i==1 ) continue; /* Do not analyze the TEMP database */ - analyzeDatabase(pParse, i); - } - }else if( pName2->n==0 ){ - /* Form 2: Analyze the database or table named */ - iDb = sqlite3FindDb(db, pName1); - if( iDb>=0 ){ - analyzeDatabase(pParse, iDb); - }else{ - z = sqlite3NameFromToken(db, pName1); - if( z ){ - if( (pIdx = sqlite3FindIndex(db, z, 0))!=0 ){ - analyzeTable(pParse, pIdx->pTable, pIdx); - }else if( (pTab = sqlite3LocateTable(pParse, 0, z, 0))!=0 ){ - analyzeTable(pParse, pTab, 0); - } - sqlite3DbFree(db, z); - } - } - }else{ - /* Form 3: Analyze the fully qualified table name */ - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pTableName); - if( iDb>=0 ){ - zDb = db->aDb[iDb].zName; - z = sqlite3NameFromToken(db, pTableName); - if( z ){ - if( (pIdx = sqlite3FindIndex(db, z, zDb))!=0 ){ - analyzeTable(pParse, pIdx->pTable, pIdx); - }else if( (pTab = sqlite3LocateTable(pParse, 0, z, zDb))!=0 ){ - analyzeTable(pParse, pTab, 0); - } - sqlite3DbFree(db, z); - } - } - } -} - -/* -** Used to pass information from the analyzer reader through to the -** callback routine. -*/ -typedef struct analysisInfo analysisInfo; -struct analysisInfo { - sqlite3 *db; - const char *zDatabase; -}; - -/* -** The first argument points to a nul-terminated string containing a -** list of space separated integers. Read the first nOut of these into -** the array aOut[]. -*/ -static void decodeIntArray( - char *zIntArray, /* String containing int array to decode */ - int nOut, /* Number of slots in aOut[] */ - tRowcnt *aOut, /* Store integers here */ - Index *pIndex /* Handle extra flags for this index, if not NULL */ -){ - char *z = zIntArray; - int c; - int i; - tRowcnt v; - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - if( z==0 ) z = ""; -#else - if( NEVER(z==0) ) z = ""; -#endif - for(i=0; *z && i='0' && c<='9' ){ - v = v*10 + c - '0'; - z++; - } - aOut[i] = v; - if( *z==' ' ) z++; - } -#ifndef SQLITE_ENABLE_STAT3_OR_STAT4 - assert( pIndex!=0 ); -#else - if( pIndex ) -#endif - { - if( strcmp(z, "unordered")==0 ){ - pIndex->bUnordered = 1; - }else if( sqlite3_strglob("sz=[0-9]*", z)==0 ){ - int v32 = 0; - sqlite3GetInt32(z+3, &v32); - pIndex->szIdxRow = sqlite3LogEst(v32); - } - } -} - -/* -** This callback is invoked once for each index when reading the -** sqlite_stat1 table. -** -** argv[0] = name of the table -** argv[1] = name of the index (might be NULL) -** argv[2] = results of analysis - on integer for each column -** -** Entries for which argv[1]==NULL simply record the number of rows in -** the table. -*/ -static int analysisLoader(void *pData, int argc, char **argv, char **NotUsed){ - analysisInfo *pInfo = (analysisInfo*)pData; - Index *pIndex; - Table *pTable; - const char *z; - - assert( argc==3 ); - UNUSED_PARAMETER2(NotUsed, argc); - - if( argv==0 || argv[0]==0 || argv[2]==0 ){ - return 0; - } - pTable = sqlite3FindTable(pInfo->db, argv[0], pInfo->zDatabase); - if( pTable==0 ){ - return 0; - } - if( argv[1]==0 ){ - pIndex = 0; - }else if( sqlite3_stricmp(argv[0],argv[1])==0 ){ - pIndex = sqlite3PrimaryKeyIndex(pTable); - }else{ - pIndex = sqlite3FindIndex(pInfo->db, argv[1], pInfo->zDatabase); - } - z = argv[2]; - - if( pIndex ){ - decodeIntArray((char*)z, pIndex->nKeyCol+1, pIndex->aiRowEst, pIndex); - if( pIndex->pPartIdxWhere==0 ) pTable->nRowEst = pIndex->aiRowEst[0]; - }else{ - Index fakeIdx; - fakeIdx.szIdxRow = pTable->szTabRow; - decodeIntArray((char*)z, 1, &pTable->nRowEst, &fakeIdx); - pTable->szTabRow = fakeIdx.szIdxRow; - } - - return 0; -} - -/* -** If the Index.aSample variable is not NULL, delete the aSample[] array -** and its contents. -*/ -SQLITE_PRIVATE void sqlite3DeleteIndexSamples(sqlite3 *db, Index *pIdx){ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - if( pIdx->aSample ){ - int j; - for(j=0; jnSample; j++){ - IndexSample *p = &pIdx->aSample[j]; - sqlite3DbFree(db, p->p); - } - sqlite3DbFree(db, pIdx->aSample); - } - if( db && db->pnBytesFreed==0 ){ - pIdx->nSample = 0; - pIdx->aSample = 0; - } -#else - UNUSED_PARAMETER(db); - UNUSED_PARAMETER(pIdx); -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ -} - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -/* -** Populate the pIdx->aAvgEq[] array based on the samples currently -** stored in pIdx->aSample[]. -*/ -static void initAvgEq(Index *pIdx){ - if( pIdx ){ - IndexSample *aSample = pIdx->aSample; - IndexSample *pFinal = &aSample[pIdx->nSample-1]; - int iCol; - for(iCol=0; iColnKeyCol; iCol++){ - int i; /* Used to iterate through samples */ - tRowcnt sumEq = 0; /* Sum of the nEq values */ - tRowcnt nSum = 0; /* Number of terms contributing to sumEq */ - tRowcnt avgEq = 0; - tRowcnt nDLt = pFinal->anDLt[iCol]; - - /* Set nSum to the number of distinct (iCol+1) field prefixes that - ** occur in the stat4 table for this index before pFinal. Set - ** sumEq to the sum of the nEq values for column iCol for the same - ** set (adding the value only once where there exist dupicate - ** prefixes). */ - for(i=0; i<(pIdx->nSample-1); i++){ - if( aSample[i].anDLt[iCol]!=aSample[i+1].anDLt[iCol] ){ - sumEq += aSample[i].anEq[iCol]; - nSum++; - } - } - if( nDLt>nSum ){ - avgEq = (pFinal->anLt[iCol] - sumEq)/(nDLt - nSum); - } - if( avgEq==0 ) avgEq = 1; - pIdx->aAvgEq[iCol] = avgEq; - if( pIdx->nSampleCol==1 ) break; - } - } -} - -/* -** Look up an index by name. Or, if the name of a WITHOUT ROWID table -** is supplied instead, find the PRIMARY KEY index for that table. -*/ -static Index *findIndexOrPrimaryKey( - sqlite3 *db, - const char *zName, - const char *zDb -){ - Index *pIdx = sqlite3FindIndex(db, zName, zDb); - if( pIdx==0 ){ - Table *pTab = sqlite3FindTable(db, zName, zDb); - if( pTab && !HasRowid(pTab) ) pIdx = sqlite3PrimaryKeyIndex(pTab); - } - return pIdx; -} - -/* -** Load the content from either the sqlite_stat4 or sqlite_stat3 table -** into the relevant Index.aSample[] arrays. -** -** Arguments zSql1 and zSql2 must point to SQL statements that return -** data equivalent to the following (statements are different for stat3, -** see the caller of this function for details): -** -** zSql1: SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx -** zSql2: SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4 -** -** where %Q is replaced with the database name before the SQL is executed. -*/ -static int loadStatTbl( - sqlite3 *db, /* Database handle */ - int bStat3, /* Assume single column records only */ - const char *zSql1, /* SQL statement 1 (see above) */ - const char *zSql2, /* SQL statement 2 (see above) */ - const char *zDb /* Database name (e.g. "main") */ -){ - int rc; /* Result codes from subroutines */ - sqlite3_stmt *pStmt = 0; /* An SQL statement being run */ - char *zSql; /* Text of the SQL statement */ - Index *pPrevIdx = 0; /* Previous index in the loop */ - IndexSample *pSample; /* A slot in pIdx->aSample[] */ - - assert( db->lookaside.bEnabled==0 ); - zSql = sqlite3MPrintf(db, zSql1, zDb); - if( !zSql ){ - return SQLITE_NOMEM; - } - rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); - sqlite3DbFree(db, zSql); - if( rc ) return rc; - - while( sqlite3_step(pStmt)==SQLITE_ROW ){ - int nIdxCol = 1; /* Number of columns in stat4 records */ - int nAvgCol = 1; /* Number of entries in Index.aAvgEq */ - - char *zIndex; /* Index name */ - Index *pIdx; /* Pointer to the index object */ - int nSample; /* Number of samples */ - int nByte; /* Bytes of space required */ - int i; /* Bytes of space required */ - tRowcnt *pSpace; - - zIndex = (char *)sqlite3_column_text(pStmt, 0); - if( zIndex==0 ) continue; - nSample = sqlite3_column_int(pStmt, 1); - pIdx = findIndexOrPrimaryKey(db, zIndex, zDb); - assert( pIdx==0 || bStat3 || pIdx->nSample==0 ); - /* Index.nSample is non-zero at this point if data has already been - ** loaded from the stat4 table. In this case ignore stat3 data. */ - if( pIdx==0 || pIdx->nSample ) continue; - if( bStat3==0 ){ - nIdxCol = pIdx->nKeyCol+1; - nAvgCol = pIdx->nKeyCol; - } - pIdx->nSampleCol = nIdxCol; - nByte = sizeof(IndexSample) * nSample; - nByte += sizeof(tRowcnt) * nIdxCol * 3 * nSample; - nByte += nAvgCol * sizeof(tRowcnt); /* Space for Index.aAvgEq[] */ - - pIdx->aSample = sqlite3DbMallocZero(db, nByte); - if( pIdx->aSample==0 ){ - sqlite3_finalize(pStmt); - return SQLITE_NOMEM; - } - pSpace = (tRowcnt*)&pIdx->aSample[nSample]; - pIdx->aAvgEq = pSpace; pSpace += nAvgCol; - for(i=0; iaSample[i].anEq = pSpace; pSpace += nIdxCol; - pIdx->aSample[i].anLt = pSpace; pSpace += nIdxCol; - pIdx->aSample[i].anDLt = pSpace; pSpace += nIdxCol; - } - assert( ((u8*)pSpace)-nByte==(u8*)(pIdx->aSample) ); - } - rc = sqlite3_finalize(pStmt); - if( rc ) return rc; - - zSql = sqlite3MPrintf(db, zSql2, zDb); - if( !zSql ){ - return SQLITE_NOMEM; - } - rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); - sqlite3DbFree(db, zSql); - if( rc ) return rc; - - while( sqlite3_step(pStmt)==SQLITE_ROW ){ - char *zIndex; /* Index name */ - Index *pIdx; /* Pointer to the index object */ - int nCol = 1; /* Number of columns in index */ - - zIndex = (char *)sqlite3_column_text(pStmt, 0); - if( zIndex==0 ) continue; - pIdx = findIndexOrPrimaryKey(db, zIndex, zDb); - if( pIdx==0 ) continue; - /* This next condition is true if data has already been loaded from - ** the sqlite_stat4 table. In this case ignore stat3 data. */ - nCol = pIdx->nSampleCol; - if( bStat3 && nCol>1 ) continue; - if( pIdx!=pPrevIdx ){ - initAvgEq(pPrevIdx); - pPrevIdx = pIdx; - } - pSample = &pIdx->aSample[pIdx->nSample]; - decodeIntArray((char*)sqlite3_column_text(pStmt,1), nCol, pSample->anEq, 0); - decodeIntArray((char*)sqlite3_column_text(pStmt,2), nCol, pSample->anLt, 0); - decodeIntArray((char*)sqlite3_column_text(pStmt,3), nCol, pSample->anDLt,0); - - /* Take a copy of the sample. Add two 0x00 bytes the end of the buffer. - ** This is in case the sample record is corrupted. In that case, the - ** sqlite3VdbeRecordCompare() may read up to two varints past the - ** end of the allocated buffer before it realizes it is dealing with - ** a corrupt record. Adding the two 0x00 bytes prevents this from causing - ** a buffer overread. */ - pSample->n = sqlite3_column_bytes(pStmt, 4); - pSample->p = sqlite3DbMallocZero(db, pSample->n + 2); - if( pSample->p==0 ){ - sqlite3_finalize(pStmt); - return SQLITE_NOMEM; - } - memcpy(pSample->p, sqlite3_column_blob(pStmt, 4), pSample->n); - pIdx->nSample++; - } - rc = sqlite3_finalize(pStmt); - if( rc==SQLITE_OK ) initAvgEq(pPrevIdx); - return rc; -} - -/* -** Load content from the sqlite_stat4 and sqlite_stat3 tables into -** the Index.aSample[] arrays of all indices. -*/ -static int loadStat4(sqlite3 *db, const char *zDb){ - int rc = SQLITE_OK; /* Result codes from subroutines */ - - assert( db->lookaside.bEnabled==0 ); - if( sqlite3FindTable(db, "sqlite_stat4", zDb) ){ - rc = loadStatTbl(db, 0, - "SELECT idx,count(*) FROM %Q.sqlite_stat4 GROUP BY idx", - "SELECT idx,neq,nlt,ndlt,sample FROM %Q.sqlite_stat4", - zDb - ); - } - - if( rc==SQLITE_OK && sqlite3FindTable(db, "sqlite_stat3", zDb) ){ - rc = loadStatTbl(db, 1, - "SELECT idx,count(*) FROM %Q.sqlite_stat3 GROUP BY idx", - "SELECT idx,neq,nlt,ndlt,sqlite_record(sample) FROM %Q.sqlite_stat3", - zDb - ); - } - - return rc; -} -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ - -/* -** Load the content of the sqlite_stat1 and sqlite_stat3/4 tables. The -** contents of sqlite_stat1 are used to populate the Index.aiRowEst[] -** arrays. The contents of sqlite_stat3/4 are used to populate the -** Index.aSample[] arrays. -** -** If the sqlite_stat1 table is not present in the database, SQLITE_ERROR -** is returned. In this case, even if SQLITE_ENABLE_STAT3/4 was defined -** during compilation and the sqlite_stat3/4 table is present, no data is -** read from it. -** -** If SQLITE_ENABLE_STAT3/4 was defined during compilation and the -** sqlite_stat4 table is not present in the database, SQLITE_ERROR is -** returned. However, in this case, data is read from the sqlite_stat1 -** table (if it is present) before returning. -** -** If an OOM error occurs, this function always sets db->mallocFailed. -** This means if the caller does not care about other errors, the return -** code may be ignored. -*/ -SQLITE_PRIVATE int sqlite3AnalysisLoad(sqlite3 *db, int iDb){ - analysisInfo sInfo; - HashElem *i; - char *zSql; - int rc; - - assert( iDb>=0 && iDbnDb ); - assert( db->aDb[iDb].pBt!=0 ); - - /* Clear any prior statistics */ - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - for(i=sqliteHashFirst(&db->aDb[iDb].pSchema->idxHash);i;i=sqliteHashNext(i)){ - Index *pIdx = sqliteHashData(i); - sqlite3DefaultRowEst(pIdx); -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - sqlite3DeleteIndexSamples(db, pIdx); - pIdx->aSample = 0; -#endif - } - - /* Check to make sure the sqlite_stat1 table exists */ - sInfo.db = db; - sInfo.zDatabase = db->aDb[iDb].zName; - if( sqlite3FindTable(db, "sqlite_stat1", sInfo.zDatabase)==0 ){ - return SQLITE_ERROR; - } - - /* Load new statistics out of the sqlite_stat1 table */ - zSql = sqlite3MPrintf(db, - "SELECT tbl,idx,stat FROM %Q.sqlite_stat1", sInfo.zDatabase); - if( zSql==0 ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_exec(db, zSql, analysisLoader, &sInfo, 0); - sqlite3DbFree(db, zSql); - } - - - /* Load the statistics from the sqlite_stat4 table. */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - if( rc==SQLITE_OK ){ - int lookasideEnabled = db->lookaside.bEnabled; - db->lookaside.bEnabled = 0; - rc = loadStat4(db, sInfo.zDatabase); - db->lookaside.bEnabled = lookasideEnabled; - } -#endif - - if( rc==SQLITE_NOMEM ){ - db->mallocFailed = 1; - } - return rc; -} - - -#endif /* SQLITE_OMIT_ANALYZE */ - -/************** End of analyze.c *********************************************/ -/************** Begin file attach.c ******************************************/ -/* -** 2003 April 6 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code used to implement the ATTACH and DETACH commands. -*/ - -#ifndef SQLITE_OMIT_ATTACH -/* -** Resolve an expression that was part of an ATTACH or DETACH statement. This -** is slightly different from resolving a normal SQL expression, because simple -** identifiers are treated as strings, not possible column names or aliases. -** -** i.e. if the parser sees: -** -** ATTACH DATABASE abc AS def -** -** it treats the two expressions as literal strings 'abc' and 'def' instead of -** looking for columns of the same name. -** -** This only applies to the root node of pExpr, so the statement: -** -** ATTACH DATABASE abc||def AS 'db2' -** -** will fail because neither abc or def can be resolved. -*/ -static int resolveAttachExpr(NameContext *pName, Expr *pExpr) -{ - int rc = SQLITE_OK; - if( pExpr ){ - if( pExpr->op!=TK_ID ){ - rc = sqlite3ResolveExprNames(pName, pExpr); - }else{ - pExpr->op = TK_STRING; - } - } - return rc; -} - -/* -** An SQL user-function registered to do the work of an ATTACH statement. The -** three arguments to the function come directly from an attach statement: -** -** ATTACH DATABASE x AS y KEY z -** -** SELECT sqlite_attach(x, y, z) -** -** If the optional "KEY z" syntax is omitted, an SQL NULL is passed as the -** third argument. -*/ -static void attachFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **argv -){ - int i; - int rc = 0; - sqlite3 *db = sqlite3_context_db_handle(context); - const char *zName; - const char *zFile; - char *zPath = 0; - char *zErr = 0; - unsigned int flags; - Db *aNew; - char *zErrDyn = 0; - sqlite3_vfs *pVfs; - - UNUSED_PARAMETER(NotUsed); - - zFile = (const char *)sqlite3_value_text(argv[0]); - zName = (const char *)sqlite3_value_text(argv[1]); - if( zFile==0 ) zFile = ""; - if( zName==0 ) zName = ""; - - /* Check for the following errors: - ** - ** * Too many attached databases, - ** * Transaction currently open - ** * Specified database name already being used. - */ - if( db->nDb>=db->aLimit[SQLITE_LIMIT_ATTACHED]+2 ){ - zErrDyn = sqlite3MPrintf(db, "too many attached databases - max %d", - db->aLimit[SQLITE_LIMIT_ATTACHED] - ); - goto attach_error; - } - if( !db->autoCommit ){ - zErrDyn = sqlite3MPrintf(db, "cannot ATTACH database within transaction"); - goto attach_error; - } - for(i=0; inDb; i++){ - char *z = db->aDb[i].zName; - assert( z && zName ); - if( sqlite3StrICmp(z, zName)==0 ){ - zErrDyn = sqlite3MPrintf(db, "database %s is already in use", zName); - goto attach_error; - } - } - - /* Allocate the new entry in the db->aDb[] array and initialize the schema - ** hash tables. - */ - if( db->aDb==db->aDbStatic ){ - aNew = sqlite3DbMallocRaw(db, sizeof(db->aDb[0])*3 ); - if( aNew==0 ) return; - memcpy(aNew, db->aDb, sizeof(db->aDb[0])*2); - }else{ - aNew = sqlite3DbRealloc(db, db->aDb, sizeof(db->aDb[0])*(db->nDb+1) ); - if( aNew==0 ) return; - } - db->aDb = aNew; - aNew = &db->aDb[db->nDb]; - memset(aNew, 0, sizeof(*aNew)); - - /* Open the database file. If the btree is successfully opened, use - ** it to obtain the database schema. At this point the schema may - ** or may not be initialized. - */ - flags = db->openFlags; - rc = sqlite3ParseUri(db->pVfs->zName, zFile, &flags, &pVfs, &zPath, &zErr); - if( rc!=SQLITE_OK ){ - if( rc==SQLITE_NOMEM ) db->mallocFailed = 1; - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); - return; - } - assert( pVfs ); - flags |= SQLITE_OPEN_MAIN_DB; - rc = sqlite3BtreeOpen(pVfs, zPath, db, &aNew->pBt, 0, flags); - sqlite3_free( zPath ); - db->nDb++; - if( rc==SQLITE_CONSTRAINT ){ - rc = SQLITE_ERROR; - zErrDyn = sqlite3MPrintf(db, "database is already attached"); - }else if( rc==SQLITE_OK ){ - Pager *pPager; - aNew->pSchema = sqlite3SchemaGet(db, aNew->pBt); - if( !aNew->pSchema ){ - rc = SQLITE_NOMEM; - }else if( aNew->pSchema->file_format && aNew->pSchema->enc!=ENC(db) ){ - zErrDyn = sqlite3MPrintf(db, - "attached databases must use the same text encoding as main database"); - rc = SQLITE_ERROR; - } - pPager = sqlite3BtreePager(aNew->pBt); - sqlite3PagerLockingMode(pPager, db->dfltLockMode); - sqlite3BtreeSecureDelete(aNew->pBt, - sqlite3BtreeSecureDelete(db->aDb[0].pBt,-1) ); -#ifndef SQLITE_OMIT_PAGER_PRAGMAS - sqlite3BtreeSetPagerFlags(aNew->pBt, 3 | (db->flags & PAGER_FLAGS_MASK)); -#endif - } - aNew->safety_level = 3; - aNew->zName = sqlite3DbStrDup(db, zName); - if( rc==SQLITE_OK && aNew->zName==0 ){ - rc = SQLITE_NOMEM; - } - - -#ifdef SQLITE_HAS_CODEC - if( rc==SQLITE_OK ){ - extern int sqlite3CodecAttach(sqlite3*, int, const void*, int); - extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*); - int nKey; - char *zKey; - int t = sqlite3_value_type(argv[2]); - switch( t ){ - case SQLITE_INTEGER: - case SQLITE_FLOAT: - zErrDyn = sqlite3DbStrDup(db, "Invalid key value"); - rc = SQLITE_ERROR; - break; - - case SQLITE_TEXT: - case SQLITE_BLOB: - nKey = sqlite3_value_bytes(argv[2]); - zKey = (char *)sqlite3_value_blob(argv[2]); - rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey); - break; - - case SQLITE_NULL: - /* No key specified. Use the key from the main database */ - sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey); - if( nKey>0 || sqlite3BtreeGetReserve(db->aDb[0].pBt)>0 ){ - rc = sqlite3CodecAttach(db, db->nDb-1, zKey, nKey); - } - break; - } - } -#endif - - /* If the file was opened successfully, read the schema for the new database. - ** If this fails, or if opening the file failed, then close the file and - ** remove the entry from the db->aDb[] array. i.e. put everything back the way - ** we found it. - */ - if( rc==SQLITE_OK ){ - sqlite3BtreeEnterAll(db); - rc = sqlite3Init(db, &zErrDyn); - sqlite3BtreeLeaveAll(db); - } - if( rc ){ - int iDb = db->nDb - 1; - assert( iDb>=2 ); - if( db->aDb[iDb].pBt ){ - sqlite3BtreeClose(db->aDb[iDb].pBt); - db->aDb[iDb].pBt = 0; - db->aDb[iDb].pSchema = 0; - } - sqlite3ResetAllSchemasOfConnection(db); - db->nDb = iDb; - if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){ - db->mallocFailed = 1; - sqlite3DbFree(db, zErrDyn); - zErrDyn = sqlite3MPrintf(db, "out of memory"); - }else if( zErrDyn==0 ){ - zErrDyn = sqlite3MPrintf(db, "unable to open database: %s", zFile); - } - goto attach_error; - } - - return; - -attach_error: - /* Return an error if we get here */ - if( zErrDyn ){ - sqlite3_result_error(context, zErrDyn, -1); - sqlite3DbFree(db, zErrDyn); - } - if( rc ) sqlite3_result_error_code(context, rc); -} - -/* -** An SQL user-function registered to do the work of an DETACH statement. The -** three arguments to the function come directly from a detach statement: -** -** DETACH DATABASE x -** -** SELECT sqlite_detach(x) -*/ -static void detachFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **argv -){ - const char *zName = (const char *)sqlite3_value_text(argv[0]); - sqlite3 *db = sqlite3_context_db_handle(context); - int i; - Db *pDb = 0; - char zErr[128]; - - UNUSED_PARAMETER(NotUsed); - - if( zName==0 ) zName = ""; - for(i=0; inDb; i++){ - pDb = &db->aDb[i]; - if( pDb->pBt==0 ) continue; - if( sqlite3StrICmp(pDb->zName, zName)==0 ) break; - } - - if( i>=db->nDb ){ - sqlite3_snprintf(sizeof(zErr),zErr, "no such database: %s", zName); - goto detach_error; - } - if( i<2 ){ - sqlite3_snprintf(sizeof(zErr),zErr, "cannot detach database %s", zName); - goto detach_error; - } - if( !db->autoCommit ){ - sqlite3_snprintf(sizeof(zErr), zErr, - "cannot DETACH database within transaction"); - goto detach_error; - } - if( sqlite3BtreeIsInReadTrans(pDb->pBt) || sqlite3BtreeIsInBackup(pDb->pBt) ){ - sqlite3_snprintf(sizeof(zErr),zErr, "database %s is locked", zName); - goto detach_error; - } - - sqlite3BtreeClose(pDb->pBt); - pDb->pBt = 0; - pDb->pSchema = 0; - sqlite3ResetAllSchemasOfConnection(db); - return; - -detach_error: - sqlite3_result_error(context, zErr, -1); -} - -/* -** This procedure generates VDBE code for a single invocation of either the -** sqlite_detach() or sqlite_attach() SQL user functions. -*/ -static void codeAttach( - Parse *pParse, /* The parser context */ - int type, /* Either SQLITE_ATTACH or SQLITE_DETACH */ - FuncDef const *pFunc,/* FuncDef wrapper for detachFunc() or attachFunc() */ - Expr *pAuthArg, /* Expression to pass to authorization callback */ - Expr *pFilename, /* Name of database file */ - Expr *pDbname, /* Name of the database to use internally */ - Expr *pKey /* Database key for encryption extension */ -){ - int rc; - NameContext sName; - Vdbe *v; - sqlite3* db = pParse->db; - int regArgs; - - memset(&sName, 0, sizeof(NameContext)); - sName.pParse = pParse; - - if( - SQLITE_OK!=(rc = resolveAttachExpr(&sName, pFilename)) || - SQLITE_OK!=(rc = resolveAttachExpr(&sName, pDbname)) || - SQLITE_OK!=(rc = resolveAttachExpr(&sName, pKey)) - ){ - pParse->nErr++; - goto attach_end; - } - -#ifndef SQLITE_OMIT_AUTHORIZATION - if( pAuthArg ){ - char *zAuthArg; - if( pAuthArg->op==TK_STRING ){ - zAuthArg = pAuthArg->u.zToken; - }else{ - zAuthArg = 0; - } - rc = sqlite3AuthCheck(pParse, type, zAuthArg, 0, 0); - if(rc!=SQLITE_OK ){ - goto attach_end; - } - } -#endif /* SQLITE_OMIT_AUTHORIZATION */ - - - v = sqlite3GetVdbe(pParse); - regArgs = sqlite3GetTempRange(pParse, 4); - sqlite3ExprCode(pParse, pFilename, regArgs); - sqlite3ExprCode(pParse, pDbname, regArgs+1); - sqlite3ExprCode(pParse, pKey, regArgs+2); - - assert( v || db->mallocFailed ); - if( v ){ - sqlite3VdbeAddOp3(v, OP_Function, 0, regArgs+3-pFunc->nArg, regArgs+3); - assert( pFunc->nArg==-1 || (pFunc->nArg&0xff)==pFunc->nArg ); - sqlite3VdbeChangeP5(v, (u8)(pFunc->nArg)); - sqlite3VdbeChangeP4(v, -1, (char *)pFunc, P4_FUNCDEF); - - /* Code an OP_Expire. For an ATTACH statement, set P1 to true (expire this - ** statement only). For DETACH, set it to false (expire all existing - ** statements). - */ - sqlite3VdbeAddOp1(v, OP_Expire, (type==SQLITE_ATTACH)); - } - -attach_end: - sqlite3ExprDelete(db, pFilename); - sqlite3ExprDelete(db, pDbname); - sqlite3ExprDelete(db, pKey); -} - -/* -** Called by the parser to compile a DETACH statement. -** -** DETACH pDbname -*/ -SQLITE_PRIVATE void sqlite3Detach(Parse *pParse, Expr *pDbname){ - static const FuncDef detach_func = { - 1, /* nArg */ - SQLITE_UTF8, /* funcFlags */ - 0, /* pUserData */ - 0, /* pNext */ - detachFunc, /* xFunc */ - 0, /* xStep */ - 0, /* xFinalize */ - "sqlite_detach", /* zName */ - 0, /* pHash */ - 0 /* pDestructor */ - }; - codeAttach(pParse, SQLITE_DETACH, &detach_func, pDbname, 0, 0, pDbname); -} - -/* -** Called by the parser to compile an ATTACH statement. -** -** ATTACH p AS pDbname KEY pKey -*/ -SQLITE_PRIVATE void sqlite3Attach(Parse *pParse, Expr *p, Expr *pDbname, Expr *pKey){ - static const FuncDef attach_func = { - 3, /* nArg */ - SQLITE_UTF8, /* funcFlags */ - 0, /* pUserData */ - 0, /* pNext */ - attachFunc, /* xFunc */ - 0, /* xStep */ - 0, /* xFinalize */ - "sqlite_attach", /* zName */ - 0, /* pHash */ - 0 /* pDestructor */ - }; - codeAttach(pParse, SQLITE_ATTACH, &attach_func, p, p, pDbname, pKey); -} -#endif /* SQLITE_OMIT_ATTACH */ - -/* -** Initialize a DbFixer structure. This routine must be called prior -** to passing the structure to one of the sqliteFixAAAA() routines below. -*/ -SQLITE_PRIVATE void sqlite3FixInit( - DbFixer *pFix, /* The fixer to be initialized */ - Parse *pParse, /* Error messages will be written here */ - int iDb, /* This is the database that must be used */ - const char *zType, /* "view", "trigger", or "index" */ - const Token *pName /* Name of the view, trigger, or index */ -){ - sqlite3 *db; - - db = pParse->db; - assert( db->nDb>iDb ); - pFix->pParse = pParse; - pFix->zDb = db->aDb[iDb].zName; - pFix->pSchema = db->aDb[iDb].pSchema; - pFix->zType = zType; - pFix->pName = pName; - pFix->bVarOnly = (iDb==1); -} - -/* -** The following set of routines walk through the parse tree and assign -** a specific database to all table references where the database name -** was left unspecified in the original SQL statement. The pFix structure -** must have been initialized by a prior call to sqlite3FixInit(). -** -** These routines are used to make sure that an index, trigger, or -** view in one database does not refer to objects in a different database. -** (Exception: indices, triggers, and views in the TEMP database are -** allowed to refer to anything.) If a reference is explicitly made -** to an object in a different database, an error message is added to -** pParse->zErrMsg and these routines return non-zero. If everything -** checks out, these routines return 0. -*/ -SQLITE_PRIVATE int sqlite3FixSrcList( - DbFixer *pFix, /* Context of the fixation */ - SrcList *pList /* The Source list to check and modify */ -){ - int i; - const char *zDb; - struct SrcList_item *pItem; - - if( NEVER(pList==0) ) return 0; - zDb = pFix->zDb; - for(i=0, pItem=pList->a; inSrc; i++, pItem++){ - if( pFix->bVarOnly==0 ){ - if( pItem->zDatabase && sqlite3StrICmp(pItem->zDatabase, zDb) ){ - sqlite3ErrorMsg(pFix->pParse, - "%s %T cannot reference objects in database %s", - pFix->zType, pFix->pName, pItem->zDatabase); - return 1; - } - sqlite3DbFree(pFix->pParse->db, pItem->zDatabase); - pItem->zDatabase = 0; - pItem->pSchema = pFix->pSchema; - } -#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) - if( sqlite3FixSelect(pFix, pItem->pSelect) ) return 1; - if( sqlite3FixExpr(pFix, pItem->pOn) ) return 1; -#endif - } - return 0; -} -#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_TRIGGER) -SQLITE_PRIVATE int sqlite3FixSelect( - DbFixer *pFix, /* Context of the fixation */ - Select *pSelect /* The SELECT statement to be fixed to one database */ -){ - while( pSelect ){ - if( sqlite3FixExprList(pFix, pSelect->pEList) ){ - return 1; - } - if( sqlite3FixSrcList(pFix, pSelect->pSrc) ){ - return 1; - } - if( sqlite3FixExpr(pFix, pSelect->pWhere) ){ - return 1; - } - if( sqlite3FixExprList(pFix, pSelect->pGroupBy) ){ - return 1; - } - if( sqlite3FixExpr(pFix, pSelect->pHaving) ){ - return 1; - } - if( sqlite3FixExprList(pFix, pSelect->pOrderBy) ){ - return 1; - } - if( sqlite3FixExpr(pFix, pSelect->pLimit) ){ - return 1; - } - if( sqlite3FixExpr(pFix, pSelect->pOffset) ){ - return 1; - } - pSelect = pSelect->pPrior; - } - return 0; -} -SQLITE_PRIVATE int sqlite3FixExpr( - DbFixer *pFix, /* Context of the fixation */ - Expr *pExpr /* The expression to be fixed to one database */ -){ - while( pExpr ){ - if( pExpr->op==TK_VARIABLE ){ - if( pFix->pParse->db->init.busy ){ - pExpr->op = TK_NULL; - }else{ - sqlite3ErrorMsg(pFix->pParse, "%s cannot use variables", pFix->zType); - return 1; - } - } - if( ExprHasProperty(pExpr, EP_TokenOnly) ) break; - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - if( sqlite3FixSelect(pFix, pExpr->x.pSelect) ) return 1; - }else{ - if( sqlite3FixExprList(pFix, pExpr->x.pList) ) return 1; - } - if( sqlite3FixExpr(pFix, pExpr->pRight) ){ - return 1; - } - pExpr = pExpr->pLeft; - } - return 0; -} -SQLITE_PRIVATE int sqlite3FixExprList( - DbFixer *pFix, /* Context of the fixation */ - ExprList *pList /* The expression to be fixed to one database */ -){ - int i; - struct ExprList_item *pItem; - if( pList==0 ) return 0; - for(i=0, pItem=pList->a; inExpr; i++, pItem++){ - if( sqlite3FixExpr(pFix, pItem->pExpr) ){ - return 1; - } - } - return 0; -} -#endif - -#ifndef SQLITE_OMIT_TRIGGER -SQLITE_PRIVATE int sqlite3FixTriggerStep( - DbFixer *pFix, /* Context of the fixation */ - TriggerStep *pStep /* The trigger step be fixed to one database */ -){ - while( pStep ){ - if( sqlite3FixSelect(pFix, pStep->pSelect) ){ - return 1; - } - if( sqlite3FixExpr(pFix, pStep->pWhere) ){ - return 1; - } - if( sqlite3FixExprList(pFix, pStep->pExprList) ){ - return 1; - } - pStep = pStep->pNext; - } - return 0; -} -#endif - -/************** End of attach.c **********************************************/ -/************** Begin file auth.c ********************************************/ -/* -** 2003 January 11 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code used to implement the sqlite3_set_authorizer() -** API. This facility is an optional feature of the library. Embedded -** systems that do not need this facility may omit it by recompiling -** the library with -DSQLITE_OMIT_AUTHORIZATION=1 -*/ - -/* -** All of the code in this file may be omitted by defining a single -** macro. -*/ -#ifndef SQLITE_OMIT_AUTHORIZATION - -/* -** Set or clear the access authorization function. -** -** The access authorization function is be called during the compilation -** phase to verify that the user has read and/or write access permission on -** various fields of the database. The first argument to the auth function -** is a copy of the 3rd argument to this routine. The second argument -** to the auth function is one of these constants: -** -** SQLITE_CREATE_INDEX -** SQLITE_CREATE_TABLE -** SQLITE_CREATE_TEMP_INDEX -** SQLITE_CREATE_TEMP_TABLE -** SQLITE_CREATE_TEMP_TRIGGER -** SQLITE_CREATE_TEMP_VIEW -** SQLITE_CREATE_TRIGGER -** SQLITE_CREATE_VIEW -** SQLITE_DELETE -** SQLITE_DROP_INDEX -** SQLITE_DROP_TABLE -** SQLITE_DROP_TEMP_INDEX -** SQLITE_DROP_TEMP_TABLE -** SQLITE_DROP_TEMP_TRIGGER -** SQLITE_DROP_TEMP_VIEW -** SQLITE_DROP_TRIGGER -** SQLITE_DROP_VIEW -** SQLITE_INSERT -** SQLITE_PRAGMA -** SQLITE_READ -** SQLITE_SELECT -** SQLITE_TRANSACTION -** SQLITE_UPDATE -** -** The third and fourth arguments to the auth function are the name of -** the table and the column that are being accessed. The auth function -** should return either SQLITE_OK, SQLITE_DENY, or SQLITE_IGNORE. If -** SQLITE_OK is returned, it means that access is allowed. SQLITE_DENY -** means that the SQL statement will never-run - the sqlite3_exec() call -** will return with an error. SQLITE_IGNORE means that the SQL statement -** should run but attempts to read the specified column will return NULL -** and attempts to write the column will be ignored. -** -** Setting the auth function to NULL disables this hook. The default -** setting of the auth function is NULL. -*/ -SQLITE_API int sqlite3_set_authorizer( - sqlite3 *db, - int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), - void *pArg -){ - sqlite3_mutex_enter(db->mutex); - db->xAuth = xAuth; - db->pAuthArg = pArg; - sqlite3ExpirePreparedStatements(db); - sqlite3_mutex_leave(db->mutex); - return SQLITE_OK; -} - -/* -** Write an error message into pParse->zErrMsg that explains that the -** user-supplied authorization function returned an illegal value. -*/ -static void sqliteAuthBadReturnCode(Parse *pParse){ - sqlite3ErrorMsg(pParse, "authorizer malfunction"); - pParse->rc = SQLITE_ERROR; -} - -/* -** Invoke the authorization callback for permission to read column zCol from -** table zTab in database zDb. This function assumes that an authorization -** callback has been registered (i.e. that sqlite3.xAuth is not NULL). -** -** If SQLITE_IGNORE is returned and pExpr is not NULL, then pExpr is changed -** to an SQL NULL expression. Otherwise, if pExpr is NULL, then SQLITE_IGNORE -** is treated as SQLITE_DENY. In this case an error is left in pParse. -*/ -SQLITE_PRIVATE int sqlite3AuthReadCol( - Parse *pParse, /* The parser context */ - const char *zTab, /* Table name */ - const char *zCol, /* Column name */ - int iDb /* Index of containing database. */ -){ - sqlite3 *db = pParse->db; /* Database handle */ - char *zDb = db->aDb[iDb].zName; /* Name of attached database */ - int rc; /* Auth callback return code */ - - rc = db->xAuth(db->pAuthArg, SQLITE_READ, zTab,zCol,zDb,pParse->zAuthContext); - if( rc==SQLITE_DENY ){ - if( db->nDb>2 || iDb!=0 ){ - sqlite3ErrorMsg(pParse, "access to %s.%s.%s is prohibited",zDb,zTab,zCol); - }else{ - sqlite3ErrorMsg(pParse, "access to %s.%s is prohibited", zTab, zCol); - } - pParse->rc = SQLITE_AUTH; - }else if( rc!=SQLITE_IGNORE && rc!=SQLITE_OK ){ - sqliteAuthBadReturnCode(pParse); - } - return rc; -} - -/* -** The pExpr should be a TK_COLUMN expression. The table referred to -** is in pTabList or else it is the NEW or OLD table of a trigger. -** Check to see if it is OK to read this particular column. -** -** If the auth function returns SQLITE_IGNORE, change the TK_COLUMN -** instruction into a TK_NULL. If the auth function returns SQLITE_DENY, -** then generate an error. -*/ -SQLITE_PRIVATE void sqlite3AuthRead( - Parse *pParse, /* The parser context */ - Expr *pExpr, /* The expression to check authorization on */ - Schema *pSchema, /* The schema of the expression */ - SrcList *pTabList /* All table that pExpr might refer to */ -){ - sqlite3 *db = pParse->db; - Table *pTab = 0; /* The table being read */ - const char *zCol; /* Name of the column of the table */ - int iSrc; /* Index in pTabList->a[] of table being read */ - int iDb; /* The index of the database the expression refers to */ - int iCol; /* Index of column in table */ - - if( db->xAuth==0 ) return; - iDb = sqlite3SchemaToIndex(pParse->db, pSchema); - if( iDb<0 ){ - /* An attempt to read a column out of a subquery or other - ** temporary table. */ - return; - } - - assert( pExpr->op==TK_COLUMN || pExpr->op==TK_TRIGGER ); - if( pExpr->op==TK_TRIGGER ){ - pTab = pParse->pTriggerTab; - }else{ - assert( pTabList ); - for(iSrc=0; ALWAYS(iSrcnSrc); iSrc++){ - if( pExpr->iTable==pTabList->a[iSrc].iCursor ){ - pTab = pTabList->a[iSrc].pTab; - break; - } - } - } - iCol = pExpr->iColumn; - if( NEVER(pTab==0) ) return; - - if( iCol>=0 ){ - assert( iColnCol ); - zCol = pTab->aCol[iCol].zName; - }else if( pTab->iPKey>=0 ){ - assert( pTab->iPKeynCol ); - zCol = pTab->aCol[pTab->iPKey].zName; - }else{ - zCol = "ROWID"; - } - assert( iDb>=0 && iDbnDb ); - if( SQLITE_IGNORE==sqlite3AuthReadCol(pParse, pTab->zName, zCol, iDb) ){ - pExpr->op = TK_NULL; - } -} - -/* -** Do an authorization check using the code and arguments given. Return -** either SQLITE_OK (zero) or SQLITE_IGNORE or SQLITE_DENY. If SQLITE_DENY -** is returned, then the error count and error message in pParse are -** modified appropriately. -*/ -SQLITE_PRIVATE int sqlite3AuthCheck( - Parse *pParse, - int code, - const char *zArg1, - const char *zArg2, - const char *zArg3 -){ - sqlite3 *db = pParse->db; - int rc; - - /* Don't do any authorization checks if the database is initialising - ** or if the parser is being invoked from within sqlite3_declare_vtab. - */ - if( db->init.busy || IN_DECLARE_VTAB ){ - return SQLITE_OK; - } - - if( db->xAuth==0 ){ - return SQLITE_OK; - } - rc = db->xAuth(db->pAuthArg, code, zArg1, zArg2, zArg3, pParse->zAuthContext); - if( rc==SQLITE_DENY ){ - sqlite3ErrorMsg(pParse, "not authorized"); - pParse->rc = SQLITE_AUTH; - }else if( rc!=SQLITE_OK && rc!=SQLITE_IGNORE ){ - rc = SQLITE_DENY; - sqliteAuthBadReturnCode(pParse); - } - return rc; -} - -/* -** Push an authorization context. After this routine is called, the -** zArg3 argument to authorization callbacks will be zContext until -** popped. Or if pParse==0, this routine is a no-op. -*/ -SQLITE_PRIVATE void sqlite3AuthContextPush( - Parse *pParse, - AuthContext *pContext, - const char *zContext -){ - assert( pParse ); - pContext->pParse = pParse; - pContext->zAuthContext = pParse->zAuthContext; - pParse->zAuthContext = zContext; -} - -/* -** Pop an authorization context that was previously pushed -** by sqlite3AuthContextPush -*/ -SQLITE_PRIVATE void sqlite3AuthContextPop(AuthContext *pContext){ - if( pContext->pParse ){ - pContext->pParse->zAuthContext = pContext->zAuthContext; - pContext->pParse = 0; - } -} - -#endif /* SQLITE_OMIT_AUTHORIZATION */ - -/************** End of auth.c ************************************************/ -/************** Begin file build.c *******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains C code routines that are called by the SQLite parser -** when syntax rules are reduced. The routines in this file handle the -** following kinds of SQL syntax: -** -** CREATE TABLE -** DROP TABLE -** CREATE INDEX -** DROP INDEX -** creating ID lists -** BEGIN TRANSACTION -** COMMIT -** ROLLBACK -*/ - -/* -** This routine is called when a new SQL statement is beginning to -** be parsed. Initialize the pParse structure as needed. -*/ -SQLITE_PRIVATE void sqlite3BeginParse(Parse *pParse, int explainFlag){ - pParse->explain = (u8)explainFlag; - pParse->nVar = 0; -} - -#ifndef SQLITE_OMIT_SHARED_CACHE -/* -** The TableLock structure is only used by the sqlite3TableLock() and -** codeTableLocks() functions. -*/ -struct TableLock { - int iDb; /* The database containing the table to be locked */ - int iTab; /* The root page of the table to be locked */ - u8 isWriteLock; /* True for write lock. False for a read lock */ - const char *zName; /* Name of the table */ -}; - -/* -** Record the fact that we want to lock a table at run-time. -** -** The table to be locked has root page iTab and is found in database iDb. -** A read or a write lock can be taken depending on isWritelock. -** -** This routine just records the fact that the lock is desired. The -** code to make the lock occur is generated by a later call to -** codeTableLocks() which occurs during sqlite3FinishCoding(). -*/ -SQLITE_PRIVATE void sqlite3TableLock( - Parse *pParse, /* Parsing context */ - int iDb, /* Index of the database containing the table to lock */ - int iTab, /* Root page number of the table to be locked */ - u8 isWriteLock, /* True for a write lock */ - const char *zName /* Name of the table to be locked */ -){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - int i; - int nBytes; - TableLock *p; - assert( iDb>=0 ); - - for(i=0; inTableLock; i++){ - p = &pToplevel->aTableLock[i]; - if( p->iDb==iDb && p->iTab==iTab ){ - p->isWriteLock = (p->isWriteLock || isWriteLock); - return; - } - } - - nBytes = sizeof(TableLock) * (pToplevel->nTableLock+1); - pToplevel->aTableLock = - sqlite3DbReallocOrFree(pToplevel->db, pToplevel->aTableLock, nBytes); - if( pToplevel->aTableLock ){ - p = &pToplevel->aTableLock[pToplevel->nTableLock++]; - p->iDb = iDb; - p->iTab = iTab; - p->isWriteLock = isWriteLock; - p->zName = zName; - }else{ - pToplevel->nTableLock = 0; - pToplevel->db->mallocFailed = 1; - } -} - -/* -** Code an OP_TableLock instruction for each table locked by the -** statement (configured by calls to sqlite3TableLock()). -*/ -static void codeTableLocks(Parse *pParse){ - int i; - Vdbe *pVdbe; - - pVdbe = sqlite3GetVdbe(pParse); - assert( pVdbe!=0 ); /* sqlite3GetVdbe cannot fail: VDBE already allocated */ - - for(i=0; inTableLock; i++){ - TableLock *p = &pParse->aTableLock[i]; - int p1 = p->iDb; - sqlite3VdbeAddOp4(pVdbe, OP_TableLock, p1, p->iTab, p->isWriteLock, - p->zName, P4_STATIC); - } -} -#else - #define codeTableLocks(x) -#endif - -/* -** This routine is called after a single SQL statement has been -** parsed and a VDBE program to execute that statement has been -** prepared. This routine puts the finishing touches on the -** VDBE program and resets the pParse structure for the next -** parse. -** -** Note that if an error occurred, it might be the case that -** no VDBE code was generated. -*/ -SQLITE_PRIVATE void sqlite3FinishCoding(Parse *pParse){ - sqlite3 *db; - Vdbe *v; - - assert( pParse->pToplevel==0 ); - db = pParse->db; - if( db->mallocFailed ) return; - if( pParse->nested ) return; - if( pParse->nErr ) return; - - /* Begin by generating some termination code at the end of the - ** vdbe program - */ - v = sqlite3GetVdbe(pParse); - assert( !pParse->isMultiWrite - || sqlite3VdbeAssertMayAbort(v, pParse->mayAbort)); - if( v ){ - while( sqlite3VdbeDeletePriorOpcode(v, OP_Close) ){} - sqlite3VdbeAddOp0(v, OP_Halt); - - /* The cookie mask contains one bit for each database file open. - ** (Bit 0 is for main, bit 1 is for temp, and so forth.) Bits are - ** set for each database that is used. Generate code to start a - ** transaction on each used database and to verify the schema cookie - ** on each used database. - */ - if( pParse->cookieGoto>0 ){ - yDbMask mask; - int iDb, i, addr; - sqlite3VdbeJumpHere(v, pParse->cookieGoto-1); - for(iDb=0, mask=1; iDbnDb; mask<<=1, iDb++){ - if( (mask & pParse->cookieMask)==0 ) continue; - sqlite3VdbeUsesBtree(v, iDb); - sqlite3VdbeAddOp2(v,OP_Transaction, iDb, (mask & pParse->writeMask)!=0); - if( db->init.busy==0 ){ - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - sqlite3VdbeAddOp3(v, OP_VerifyCookie, - iDb, pParse->cookieValue[iDb], - db->aDb[iDb].pSchema->iGeneration); - } - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - for(i=0; inVtabLock; i++){ - char *vtab = (char *)sqlite3GetVTable(db, pParse->apVtabLock[i]); - sqlite3VdbeAddOp4(v, OP_VBegin, 0, 0, 0, vtab, P4_VTAB); - } - pParse->nVtabLock = 0; -#endif - - /* Once all the cookies have been verified and transactions opened, - ** obtain the required table-locks. This is a no-op unless the - ** shared-cache feature is enabled. - */ - codeTableLocks(pParse); - - /* Initialize any AUTOINCREMENT data structures required. - */ - sqlite3AutoincrementBegin(pParse); - - /* Code constant expressions that where factored out of inner loops */ - addr = pParse->cookieGoto; - if( pParse->pConstExpr ){ - ExprList *pEL = pParse->pConstExpr; - pParse->cookieGoto = 0; - for(i=0; inExpr; i++){ - sqlite3ExprCode(pParse, pEL->a[i].pExpr, pEL->a[i].u.iConstExprReg); - } - } - - /* Finally, jump back to the beginning of the executable code. */ - sqlite3VdbeAddOp2(v, OP_Goto, 0, addr); - } - } - - - /* Get the VDBE program ready for execution - */ - if( v && ALWAYS(pParse->nErr==0) && !db->mallocFailed ){ - assert( pParse->iCacheLevel==0 ); /* Disables and re-enables match */ - /* A minimum of one cursor is required if autoincrement is used - * See ticket [a696379c1f08866] */ - if( pParse->pAinc!=0 && pParse->nTab==0 ) pParse->nTab = 1; - sqlite3VdbeMakeReady(v, pParse); - pParse->rc = SQLITE_DONE; - pParse->colNamesSet = 0; - }else{ - pParse->rc = SQLITE_ERROR; - } - pParse->nTab = 0; - pParse->nMem = 0; - pParse->nSet = 0; - pParse->nVar = 0; - pParse->cookieMask = 0; - pParse->cookieGoto = 0; -} - -/* -** Run the parser and code generator recursively in order to generate -** code for the SQL statement given onto the end of the pParse context -** currently under construction. When the parser is run recursively -** this way, the final OP_Halt is not appended and other initialization -** and finalization steps are omitted because those are handling by the -** outermost parser. -** -** Not everything is nestable. This facility is designed to permit -** INSERT, UPDATE, and DELETE operations against SQLITE_MASTER. Use -** care if you decide to try to use this routine for some other purposes. -*/ -SQLITE_PRIVATE void sqlite3NestedParse(Parse *pParse, const char *zFormat, ...){ - va_list ap; - char *zSql; - char *zErrMsg = 0; - sqlite3 *db = pParse->db; -# define SAVE_SZ (sizeof(Parse) - offsetof(Parse,nVar)) - char saveBuf[SAVE_SZ]; - - if( pParse->nErr ) return; - assert( pParse->nested<10 ); /* Nesting should only be of limited depth */ - va_start(ap, zFormat); - zSql = sqlite3VMPrintf(db, zFormat, ap); - va_end(ap); - if( zSql==0 ){ - return; /* A malloc must have failed */ - } - pParse->nested++; - memcpy(saveBuf, &pParse->nVar, SAVE_SZ); - memset(&pParse->nVar, 0, SAVE_SZ); - sqlite3RunParser(pParse, zSql, &zErrMsg); - sqlite3DbFree(db, zErrMsg); - sqlite3DbFree(db, zSql); - memcpy(&pParse->nVar, saveBuf, SAVE_SZ); - pParse->nested--; -} - -/* -** Locate the in-memory structure that describes a particular database -** table given the name of that table and (optionally) the name of the -** database containing the table. Return NULL if not found. -** -** If zDatabase is 0, all databases are searched for the table and the -** first matching table is returned. (No checking for duplicate table -** names is done.) The search order is TEMP first, then MAIN, then any -** auxiliary databases added using the ATTACH command. -** -** See also sqlite3LocateTable(). -*/ -SQLITE_PRIVATE Table *sqlite3FindTable(sqlite3 *db, const char *zName, const char *zDatabase){ - Table *p = 0; - int i; - int nName; - assert( zName!=0 ); - nName = sqlite3Strlen30(zName); - /* All mutexes are required for schema access. Make sure we hold them. */ - assert( zDatabase!=0 || sqlite3BtreeHoldsAllMutexes(db) ); - for(i=OMIT_TEMPDB; inDb; i++){ - int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ - if( zDatabase!=0 && sqlite3StrICmp(zDatabase, db->aDb[j].zName) ) continue; - assert( sqlite3SchemaMutexHeld(db, j, 0) ); - p = sqlite3HashFind(&db->aDb[j].pSchema->tblHash, zName, nName); - if( p ) break; - } - return p; -} - -/* -** Locate the in-memory structure that describes a particular database -** table given the name of that table and (optionally) the name of the -** database containing the table. Return NULL if not found. Also leave an -** error message in pParse->zErrMsg. -** -** The difference between this routine and sqlite3FindTable() is that this -** routine leaves an error message in pParse->zErrMsg where -** sqlite3FindTable() does not. -*/ -SQLITE_PRIVATE Table *sqlite3LocateTable( - Parse *pParse, /* context in which to report errors */ - int isView, /* True if looking for a VIEW rather than a TABLE */ - const char *zName, /* Name of the table we are looking for */ - const char *zDbase /* Name of the database. Might be NULL */ -){ - Table *p; - - /* Read the database schema. If an error occurs, leave an error message - ** and code in pParse and return NULL. */ - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ - return 0; - } - - p = sqlite3FindTable(pParse->db, zName, zDbase); - if( p==0 ){ - const char *zMsg = isView ? "no such view" : "no such table"; - if( zDbase ){ - sqlite3ErrorMsg(pParse, "%s: %s.%s", zMsg, zDbase, zName); - }else{ - sqlite3ErrorMsg(pParse, "%s: %s", zMsg, zName); - } - pParse->checkSchema = 1; - } - return p; -} - -/* -** Locate the table identified by *p. -** -** This is a wrapper around sqlite3LocateTable(). The difference between -** sqlite3LocateTable() and this function is that this function restricts -** the search to schema (p->pSchema) if it is not NULL. p->pSchema may be -** non-NULL if it is part of a view or trigger program definition. See -** sqlite3FixSrcList() for details. -*/ -SQLITE_PRIVATE Table *sqlite3LocateTableItem( - Parse *pParse, - int isView, - struct SrcList_item *p -){ - const char *zDb; - assert( p->pSchema==0 || p->zDatabase==0 ); - if( p->pSchema ){ - int iDb = sqlite3SchemaToIndex(pParse->db, p->pSchema); - zDb = pParse->db->aDb[iDb].zName; - }else{ - zDb = p->zDatabase; - } - return sqlite3LocateTable(pParse, isView, p->zName, zDb); -} - -/* -** Locate the in-memory structure that describes -** a particular index given the name of that index -** and the name of the database that contains the index. -** Return NULL if not found. -** -** If zDatabase is 0, all databases are searched for the -** table and the first matching index is returned. (No checking -** for duplicate index names is done.) The search order is -** TEMP first, then MAIN, then any auxiliary databases added -** using the ATTACH command. -*/ -SQLITE_PRIVATE Index *sqlite3FindIndex(sqlite3 *db, const char *zName, const char *zDb){ - Index *p = 0; - int i; - int nName = sqlite3Strlen30(zName); - /* All mutexes are required for schema access. Make sure we hold them. */ - assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) ); - for(i=OMIT_TEMPDB; inDb; i++){ - int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ - Schema *pSchema = db->aDb[j].pSchema; - assert( pSchema ); - if( zDb && sqlite3StrICmp(zDb, db->aDb[j].zName) ) continue; - assert( sqlite3SchemaMutexHeld(db, j, 0) ); - p = sqlite3HashFind(&pSchema->idxHash, zName, nName); - if( p ) break; - } - return p; -} - -/* -** Reclaim the memory used by an index -*/ -static void freeIndex(sqlite3 *db, Index *p){ -#ifndef SQLITE_OMIT_ANALYZE - sqlite3DeleteIndexSamples(db, p); -#endif - if( db==0 || db->pnBytesFreed==0 ) sqlite3KeyInfoUnref(p->pKeyInfo); - sqlite3ExprDelete(db, p->pPartIdxWhere); - sqlite3DbFree(db, p->zColAff); - if( p->isResized ) sqlite3DbFree(db, p->azColl); - sqlite3DbFree(db, p); -} - -/* -** For the index called zIdxName which is found in the database iDb, -** unlike that index from its Table then remove the index from -** the index hash table and free all memory structures associated -** with the index. -*/ -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteIndex(sqlite3 *db, int iDb, const char *zIdxName){ - Index *pIndex; - int len; - Hash *pHash; - - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - pHash = &db->aDb[iDb].pSchema->idxHash; - len = sqlite3Strlen30(zIdxName); - pIndex = sqlite3HashInsert(pHash, zIdxName, len, 0); - if( ALWAYS(pIndex) ){ - if( pIndex->pTable->pIndex==pIndex ){ - pIndex->pTable->pIndex = pIndex->pNext; - }else{ - Index *p; - /* Justification of ALWAYS(); The index must be on the list of - ** indices. */ - p = pIndex->pTable->pIndex; - while( ALWAYS(p) && p->pNext!=pIndex ){ p = p->pNext; } - if( ALWAYS(p && p->pNext==pIndex) ){ - p->pNext = pIndex->pNext; - } - } - freeIndex(db, pIndex); - } - db->flags |= SQLITE_InternChanges; -} - -/* -** Look through the list of open database files in db->aDb[] and if -** any have been closed, remove them from the list. Reallocate the -** db->aDb[] structure to a smaller size, if possible. -** -** Entry 0 (the "main" database) and entry 1 (the "temp" database) -** are never candidates for being collapsed. -*/ -SQLITE_PRIVATE void sqlite3CollapseDatabaseArray(sqlite3 *db){ - int i, j; - for(i=j=2; inDb; i++){ - struct Db *pDb = &db->aDb[i]; - if( pDb->pBt==0 ){ - sqlite3DbFree(db, pDb->zName); - pDb->zName = 0; - continue; - } - if( jaDb[j] = db->aDb[i]; - } - j++; - } - memset(&db->aDb[j], 0, (db->nDb-j)*sizeof(db->aDb[j])); - db->nDb = j; - if( db->nDb<=2 && db->aDb!=db->aDbStatic ){ - memcpy(db->aDbStatic, db->aDb, 2*sizeof(db->aDb[0])); - sqlite3DbFree(db, db->aDb); - db->aDb = db->aDbStatic; - } -} - -/* -** Reset the schema for the database at index iDb. Also reset the -** TEMP schema. -*/ -SQLITE_PRIVATE void sqlite3ResetOneSchema(sqlite3 *db, int iDb){ - Db *pDb; - assert( iDbnDb ); - - /* Case 1: Reset the single schema identified by iDb */ - pDb = &db->aDb[iDb]; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - assert( pDb->pSchema!=0 ); - sqlite3SchemaClear(pDb->pSchema); - - /* If any database other than TEMP is reset, then also reset TEMP - ** since TEMP might be holding triggers that reference tables in the - ** other database. - */ - if( iDb!=1 ){ - pDb = &db->aDb[1]; - assert( pDb->pSchema!=0 ); - sqlite3SchemaClear(pDb->pSchema); - } - return; -} - -/* -** Erase all schema information from all attached databases (including -** "main" and "temp") for a single database connection. -*/ -SQLITE_PRIVATE void sqlite3ResetAllSchemasOfConnection(sqlite3 *db){ - int i; - sqlite3BtreeEnterAll(db); - for(i=0; inDb; i++){ - Db *pDb = &db->aDb[i]; - if( pDb->pSchema ){ - sqlite3SchemaClear(pDb->pSchema); - } - } - db->flags &= ~SQLITE_InternChanges; - sqlite3VtabUnlockList(db); - sqlite3BtreeLeaveAll(db); - sqlite3CollapseDatabaseArray(db); -} - -/* -** This routine is called when a commit occurs. -*/ -SQLITE_PRIVATE void sqlite3CommitInternalChanges(sqlite3 *db){ - db->flags &= ~SQLITE_InternChanges; -} - -/* -** Delete memory allocated for the column names of a table or view (the -** Table.aCol[] array). -*/ -static void sqliteDeleteColumnNames(sqlite3 *db, Table *pTable){ - int i; - Column *pCol; - assert( pTable!=0 ); - if( (pCol = pTable->aCol)!=0 ){ - for(i=0; inCol; i++, pCol++){ - sqlite3DbFree(db, pCol->zName); - sqlite3ExprDelete(db, pCol->pDflt); - sqlite3DbFree(db, pCol->zDflt); - sqlite3DbFree(db, pCol->zType); - sqlite3DbFree(db, pCol->zColl); - } - sqlite3DbFree(db, pTable->aCol); - } -} - -/* -** Remove the memory data structures associated with the given -** Table. No changes are made to disk by this routine. -** -** This routine just deletes the data structure. It does not unlink -** the table data structure from the hash table. But it does destroy -** memory structures of the indices and foreign keys associated with -** the table. -** -** The db parameter is optional. It is needed if the Table object -** contains lookaside memory. (Table objects in the schema do not use -** lookaside memory, but some ephemeral Table objects do.) Or the -** db parameter can be used with db->pnBytesFreed to measure the memory -** used by the Table object. -*/ -SQLITE_PRIVATE void sqlite3DeleteTable(sqlite3 *db, Table *pTable){ - Index *pIndex, *pNext; - TESTONLY( int nLookaside; ) /* Used to verify lookaside not used for schema */ - - assert( !pTable || pTable->nRef>0 ); - - /* Do not delete the table until the reference count reaches zero. */ - if( !pTable ) return; - if( ((!db || db->pnBytesFreed==0) && (--pTable->nRef)>0) ) return; - - /* Record the number of outstanding lookaside allocations in schema Tables - ** prior to doing any free() operations. Since schema Tables do not use - ** lookaside, this number should not change. */ - TESTONLY( nLookaside = (db && (pTable->tabFlags & TF_Ephemeral)==0) ? - db->lookaside.nOut : 0 ); - - /* Delete all indices associated with this table. */ - for(pIndex = pTable->pIndex; pIndex; pIndex=pNext){ - pNext = pIndex->pNext; - assert( pIndex->pSchema==pTable->pSchema ); - if( !db || db->pnBytesFreed==0 ){ - char *zName = pIndex->zName; - TESTONLY ( Index *pOld = ) sqlite3HashInsert( - &pIndex->pSchema->idxHash, zName, sqlite3Strlen30(zName), 0 - ); - assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); - assert( pOld==pIndex || pOld==0 ); - } - freeIndex(db, pIndex); - } - - /* Delete any foreign keys attached to this table. */ - sqlite3FkDelete(db, pTable); - - /* Delete the Table structure itself. - */ - sqliteDeleteColumnNames(db, pTable); - sqlite3DbFree(db, pTable->zName); - sqlite3DbFree(db, pTable->zColAff); - sqlite3SelectDelete(db, pTable->pSelect); -#ifndef SQLITE_OMIT_CHECK - sqlite3ExprListDelete(db, pTable->pCheck); -#endif -#ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3VtabClear(db, pTable); -#endif - sqlite3DbFree(db, pTable); - - /* Verify that no lookaside memory was used by schema tables */ - assert( nLookaside==0 || nLookaside==db->lookaside.nOut ); -} - -/* -** Unlink the given table from the hash tables and the delete the -** table structure with all its indices and foreign keys. -*/ -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTable(sqlite3 *db, int iDb, const char *zTabName){ - Table *p; - Db *pDb; - - assert( db!=0 ); - assert( iDb>=0 && iDbnDb ); - assert( zTabName ); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - testcase( zTabName[0]==0 ); /* Zero-length table names are allowed */ - pDb = &db->aDb[iDb]; - p = sqlite3HashInsert(&pDb->pSchema->tblHash, zTabName, - sqlite3Strlen30(zTabName),0); - sqlite3DeleteTable(db, p); - db->flags |= SQLITE_InternChanges; -} - -/* -** Given a token, return a string that consists of the text of that -** token. Space to hold the returned string -** is obtained from sqliteMalloc() and must be freed by the calling -** function. -** -** Any quotation marks (ex: "name", 'name', [name], or `name`) that -** surround the body of the token are removed. -** -** Tokens are often just pointers into the original SQL text and so -** are not \000 terminated and are not persistent. The returned string -** is \000 terminated and is persistent. -*/ -SQLITE_PRIVATE char *sqlite3NameFromToken(sqlite3 *db, Token *pName){ - char *zName; - if( pName ){ - zName = sqlite3DbStrNDup(db, (char*)pName->z, pName->n); - sqlite3Dequote(zName); - }else{ - zName = 0; - } - return zName; -} - -/* -** Open the sqlite_master table stored in database number iDb for -** writing. The table is opened using cursor 0. -*/ -SQLITE_PRIVATE void sqlite3OpenMasterTable(Parse *p, int iDb){ - Vdbe *v = sqlite3GetVdbe(p); - sqlite3TableLock(p, iDb, MASTER_ROOT, 1, SCHEMA_TABLE(iDb)); - sqlite3VdbeAddOp4Int(v, OP_OpenWrite, 0, MASTER_ROOT, iDb, 5); - if( p->nTab==0 ){ - p->nTab = 1; - } -} - -/* -** Parameter zName points to a nul-terminated buffer containing the name -** of a database ("main", "temp" or the name of an attached db). This -** function returns the index of the named database in db->aDb[], or -** -1 if the named db cannot be found. -*/ -SQLITE_PRIVATE int sqlite3FindDbName(sqlite3 *db, const char *zName){ - int i = -1; /* Database number */ - if( zName ){ - Db *pDb; - int n = sqlite3Strlen30(zName); - for(i=(db->nDb-1), pDb=&db->aDb[i]; i>=0; i--, pDb--){ - if( (!OMIT_TEMPDB || i!=1 ) && n==sqlite3Strlen30(pDb->zName) && - 0==sqlite3StrICmp(pDb->zName, zName) ){ - break; - } - } - } - return i; -} - -/* -** The token *pName contains the name of a database (either "main" or -** "temp" or the name of an attached db). This routine returns the -** index of the named database in db->aDb[], or -1 if the named db -** does not exist. -*/ -SQLITE_PRIVATE int sqlite3FindDb(sqlite3 *db, Token *pName){ - int i; /* Database number */ - char *zName; /* Name we are searching for */ - zName = sqlite3NameFromToken(db, pName); - i = sqlite3FindDbName(db, zName); - sqlite3DbFree(db, zName); - return i; -} - -/* The table or view or trigger name is passed to this routine via tokens -** pName1 and pName2. If the table name was fully qualified, for example: -** -** CREATE TABLE xxx.yyy (...); -** -** Then pName1 is set to "xxx" and pName2 "yyy". On the other hand if -** the table name is not fully qualified, i.e.: -** -** CREATE TABLE yyy(...); -** -** Then pName1 is set to "yyy" and pName2 is "". -** -** This routine sets the *ppUnqual pointer to point at the token (pName1 or -** pName2) that stores the unqualified table name. The index of the -** database "xxx" is returned. -*/ -SQLITE_PRIVATE int sqlite3TwoPartName( - Parse *pParse, /* Parsing and code generating context */ - Token *pName1, /* The "xxx" in the name "xxx.yyy" or "xxx" */ - Token *pName2, /* The "yyy" in the name "xxx.yyy" */ - Token **pUnqual /* Write the unqualified object name here */ -){ - int iDb; /* Database holding the object */ - sqlite3 *db = pParse->db; - - if( ALWAYS(pName2!=0) && pName2->n>0 ){ - if( db->init.busy ) { - sqlite3ErrorMsg(pParse, "corrupt database"); - pParse->nErr++; - return -1; - } - *pUnqual = pName2; - iDb = sqlite3FindDb(db, pName1); - if( iDb<0 ){ - sqlite3ErrorMsg(pParse, "unknown database %T", pName1); - pParse->nErr++; - return -1; - } - }else{ - assert( db->init.iDb==0 || db->init.busy ); - iDb = db->init.iDb; - *pUnqual = pName1; - } - return iDb; -} - -/* -** This routine is used to check if the UTF-8 string zName is a legal -** unqualified name for a new schema object (table, index, view or -** trigger). All names are legal except those that begin with the string -** "sqlite_" (in upper, lower or mixed case). This portion of the namespace -** is reserved for internal use. -*/ -SQLITE_PRIVATE int sqlite3CheckObjectName(Parse *pParse, const char *zName){ - if( !pParse->db->init.busy && pParse->nested==0 - && (pParse->db->flags & SQLITE_WriteSchema)==0 - && 0==sqlite3StrNICmp(zName, "sqlite_", 7) ){ - sqlite3ErrorMsg(pParse, "object name reserved for internal use: %s", zName); - return SQLITE_ERROR; - } - return SQLITE_OK; -} - -/* -** Return the PRIMARY KEY index of a table -*/ -SQLITE_PRIVATE Index *sqlite3PrimaryKeyIndex(Table *pTab){ - Index *p; - for(p=pTab->pIndex; p && p->autoIndex!=2; p=p->pNext){} - return p; -} - -/* -** Return the column of index pIdx that corresponds to table -** column iCol. Return -1 if not found. -*/ -SQLITE_PRIVATE i16 sqlite3ColumnOfIndex(Index *pIdx, i16 iCol){ - int i; - for(i=0; inColumn; i++){ - if( iCol==pIdx->aiColumn[i] ) return i; - } - return -1; -} - -/* -** Begin constructing a new table representation in memory. This is -** the first of several action routines that get called in response -** to a CREATE TABLE statement. In particular, this routine is called -** after seeing tokens "CREATE" and "TABLE" and the table name. The isTemp -** flag is true if the table should be stored in the auxiliary database -** file instead of in the main database file. This is normally the case -** when the "TEMP" or "TEMPORARY" keyword occurs in between -** CREATE and TABLE. -** -** The new table record is initialized and put in pParse->pNewTable. -** As more of the CREATE TABLE statement is parsed, additional action -** routines will be called to add more information to this record. -** At the end of the CREATE TABLE statement, the sqlite3EndTable() routine -** is called to complete the construction of the new table record. -*/ -SQLITE_PRIVATE void sqlite3StartTable( - Parse *pParse, /* Parser context */ - Token *pName1, /* First part of the name of the table or view */ - Token *pName2, /* Second part of the name of the table or view */ - int isTemp, /* True if this is a TEMP table */ - int isView, /* True if this is a VIEW */ - int isVirtual, /* True if this is a VIRTUAL table */ - int noErr /* Do nothing if table already exists */ -){ - Table *pTable; - char *zName = 0; /* The name of the new table */ - sqlite3 *db = pParse->db; - Vdbe *v; - int iDb; /* Database number to create the table in */ - Token *pName; /* Unqualified name of the table to create */ - - /* The table or view name to create is passed to this routine via tokens - ** pName1 and pName2. If the table name was fully qualified, for example: - ** - ** CREATE TABLE xxx.yyy (...); - ** - ** Then pName1 is set to "xxx" and pName2 "yyy". On the other hand if - ** the table name is not fully qualified, i.e.: - ** - ** CREATE TABLE yyy(...); - ** - ** Then pName1 is set to "yyy" and pName2 is "". - ** - ** The call below sets the pName pointer to point at the token (pName1 or - ** pName2) that stores the unqualified table name. The variable iDb is - ** set to the index of the database that the table or view is to be - ** created in. - */ - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName); - if( iDb<0 ) return; - if( !OMIT_TEMPDB && isTemp && pName2->n>0 && iDb!=1 ){ - /* If creating a temp table, the name may not be qualified. Unless - ** the database name is "temp" anyway. */ - sqlite3ErrorMsg(pParse, "temporary table name must be unqualified"); - return; - } - if( !OMIT_TEMPDB && isTemp ) iDb = 1; - - pParse->sNameToken = *pName; - zName = sqlite3NameFromToken(db, pName); - if( zName==0 ) return; - if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ - goto begin_table_error; - } - if( db->init.iDb==1 ) isTemp = 1; -#ifndef SQLITE_OMIT_AUTHORIZATION - assert( (isTemp & 1)==isTemp ); - { - int code; - char *zDb = db->aDb[iDb].zName; - if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(isTemp), 0, zDb) ){ - goto begin_table_error; - } - if( isView ){ - if( !OMIT_TEMPDB && isTemp ){ - code = SQLITE_CREATE_TEMP_VIEW; - }else{ - code = SQLITE_CREATE_VIEW; - } - }else{ - if( !OMIT_TEMPDB && isTemp ){ - code = SQLITE_CREATE_TEMP_TABLE; - }else{ - code = SQLITE_CREATE_TABLE; - } - } - if( !isVirtual && sqlite3AuthCheck(pParse, code, zName, 0, zDb) ){ - goto begin_table_error; - } - } -#endif - - /* Make sure the new table name does not collide with an existing - ** index or table name in the same database. Issue an error message if - ** it does. The exception is if the statement being parsed was passed - ** to an sqlite3_declare_vtab() call. In that case only the column names - ** and types will be used, so there is no need to test for namespace - ** collisions. - */ - if( !IN_DECLARE_VTAB ){ - char *zDb = db->aDb[iDb].zName; - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ - goto begin_table_error; - } - pTable = sqlite3FindTable(db, zName, zDb); - if( pTable ){ - if( !noErr ){ - sqlite3ErrorMsg(pParse, "table %T already exists", pName); - }else{ - assert( !db->init.busy ); - sqlite3CodeVerifySchema(pParse, iDb); - } - goto begin_table_error; - } - if( sqlite3FindIndex(db, zName, zDb)!=0 ){ - sqlite3ErrorMsg(pParse, "there is already an index named %s", zName); - goto begin_table_error; - } - } - - pTable = sqlite3DbMallocZero(db, sizeof(Table)); - if( pTable==0 ){ - db->mallocFailed = 1; - pParse->rc = SQLITE_NOMEM; - pParse->nErr++; - goto begin_table_error; - } - pTable->zName = zName; - pTable->iPKey = -1; - pTable->pSchema = db->aDb[iDb].pSchema; - pTable->nRef = 1; - pTable->nRowEst = 1048576; - assert( pParse->pNewTable==0 ); - pParse->pNewTable = pTable; - - /* If this is the magic sqlite_sequence table used by autoincrement, - ** then record a pointer to this table in the main database structure - ** so that INSERT can find the table easily. - */ -#ifndef SQLITE_OMIT_AUTOINCREMENT - if( !pParse->nested && strcmp(zName, "sqlite_sequence")==0 ){ - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - pTable->pSchema->pSeqTab = pTable; - } -#endif - - /* Begin generating the code that will insert the table record into - ** the SQLITE_MASTER table. Note in particular that we must go ahead - ** and allocate the record number for the table entry now. Before any - ** PRIMARY KEY or UNIQUE keywords are parsed. Those keywords will cause - ** indices to be created and the table record must come before the - ** indices. Hence, the record number for the table must be allocated - ** now. - */ - if( !db->init.busy && (v = sqlite3GetVdbe(pParse))!=0 ){ - int j1; - int fileFormat; - int reg1, reg2, reg3; - sqlite3BeginWriteOperation(pParse, 0, iDb); - -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( isVirtual ){ - sqlite3VdbeAddOp0(v, OP_VBegin); - } -#endif - - /* If the file format and encoding in the database have not been set, - ** set them now. - */ - reg1 = pParse->regRowid = ++pParse->nMem; - reg2 = pParse->regRoot = ++pParse->nMem; - reg3 = ++pParse->nMem; - sqlite3VdbeAddOp3(v, OP_ReadCookie, iDb, reg3, BTREE_FILE_FORMAT); - sqlite3VdbeUsesBtree(v, iDb); - j1 = sqlite3VdbeAddOp1(v, OP_If, reg3); - fileFormat = (db->flags & SQLITE_LegacyFileFmt)!=0 ? - 1 : SQLITE_MAX_FILE_FORMAT; - sqlite3VdbeAddOp2(v, OP_Integer, fileFormat, reg3); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_FILE_FORMAT, reg3); - sqlite3VdbeAddOp2(v, OP_Integer, ENC(db), reg3); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_TEXT_ENCODING, reg3); - sqlite3VdbeJumpHere(v, j1); - - /* This just creates a place-holder record in the sqlite_master table. - ** The record created does not contain anything yet. It will be replaced - ** by the real entry in code generated at sqlite3EndTable(). - ** - ** The rowid for the new entry is left in register pParse->regRowid. - ** The root page number of the new table is left in reg pParse->regRoot. - ** The rowid and root page number values are needed by the code that - ** sqlite3EndTable will generate. - */ -#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) - if( isView || isVirtual ){ - sqlite3VdbeAddOp2(v, OP_Integer, 0, reg2); - }else -#endif - { - pParse->addrCrTab = sqlite3VdbeAddOp2(v, OP_CreateTable, iDb, reg2); - } - sqlite3OpenMasterTable(pParse, iDb); - sqlite3VdbeAddOp2(v, OP_NewRowid, 0, reg1); - sqlite3VdbeAddOp2(v, OP_Null, 0, reg3); - sqlite3VdbeAddOp3(v, OP_Insert, 0, reg3, reg1); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - sqlite3VdbeAddOp0(v, OP_Close); - } - - /* Normal (non-error) return. */ - return; - - /* If an error occurs, we jump here */ -begin_table_error: - sqlite3DbFree(db, zName); - return; -} - -/* -** This macro is used to compare two strings in a case-insensitive manner. -** It is slightly faster than calling sqlite3StrICmp() directly, but -** produces larger code. -** -** WARNING: This macro is not compatible with the strcmp() family. It -** returns true if the two strings are equal, otherwise false. -*/ -#define STRICMP(x, y) (\ -sqlite3UpperToLower[*(unsigned char *)(x)]== \ -sqlite3UpperToLower[*(unsigned char *)(y)] \ -&& sqlite3StrICmp((x)+1,(y)+1)==0 ) - -/* -** Add a new column to the table currently being constructed. -** -** The parser calls this routine once for each column declaration -** in a CREATE TABLE statement. sqlite3StartTable() gets called -** first to get things going. Then this routine is called for each -** column. -*/ -SQLITE_PRIVATE void sqlite3AddColumn(Parse *pParse, Token *pName){ - Table *p; - int i; - char *z; - Column *pCol; - sqlite3 *db = pParse->db; - if( (p = pParse->pNewTable)==0 ) return; -#if SQLITE_MAX_COLUMN - if( p->nCol+1>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many columns on %s", p->zName); - return; - } -#endif - z = sqlite3NameFromToken(db, pName); - if( z==0 ) return; - for(i=0; inCol; i++){ - if( STRICMP(z, p->aCol[i].zName) ){ - sqlite3ErrorMsg(pParse, "duplicate column name: %s", z); - sqlite3DbFree(db, z); - return; - } - } - if( (p->nCol & 0x7)==0 ){ - Column *aNew; - aNew = sqlite3DbRealloc(db,p->aCol,(p->nCol+8)*sizeof(p->aCol[0])); - if( aNew==0 ){ - sqlite3DbFree(db, z); - return; - } - p->aCol = aNew; - } - pCol = &p->aCol[p->nCol]; - memset(pCol, 0, sizeof(p->aCol[0])); - pCol->zName = z; - - /* If there is no type specified, columns have the default affinity - ** 'NONE'. If there is a type specified, then sqlite3AddColumnType() will - ** be called next to set pCol->affinity correctly. - */ - pCol->affinity = SQLITE_AFF_NONE; - pCol->szEst = 1; - p->nCol++; -} - -/* -** This routine is called by the parser while in the middle of -** parsing a CREATE TABLE statement. A "NOT NULL" constraint has -** been seen on a column. This routine sets the notNull flag on -** the column currently under construction. -*/ -SQLITE_PRIVATE void sqlite3AddNotNull(Parse *pParse, int onError){ - Table *p; - p = pParse->pNewTable; - if( p==0 || NEVER(p->nCol<1) ) return; - p->aCol[p->nCol-1].notNull = (u8)onError; -} - -/* -** Scan the column type name zType (length nType) and return the -** associated affinity type. -** -** This routine does a case-independent search of zType for the -** substrings in the following table. If one of the substrings is -** found, the corresponding affinity is returned. If zType contains -** more than one of the substrings, entries toward the top of -** the table take priority. For example, if zType is 'BLOBINT', -** SQLITE_AFF_INTEGER is returned. -** -** Substring | Affinity -** -------------------------------- -** 'INT' | SQLITE_AFF_INTEGER -** 'CHAR' | SQLITE_AFF_TEXT -** 'CLOB' | SQLITE_AFF_TEXT -** 'TEXT' | SQLITE_AFF_TEXT -** 'BLOB' | SQLITE_AFF_NONE -** 'REAL' | SQLITE_AFF_REAL -** 'FLOA' | SQLITE_AFF_REAL -** 'DOUB' | SQLITE_AFF_REAL -** -** If none of the substrings in the above table are found, -** SQLITE_AFF_NUMERIC is returned. -*/ -SQLITE_PRIVATE char sqlite3AffinityType(const char *zIn, u8 *pszEst){ - u32 h = 0; - char aff = SQLITE_AFF_NUMERIC; - const char *zChar = 0; - - if( zIn==0 ) return aff; - while( zIn[0] ){ - h = (h<<8) + sqlite3UpperToLower[(*zIn)&0xff]; - zIn++; - if( h==(('c'<<24)+('h'<<16)+('a'<<8)+'r') ){ /* CHAR */ - aff = SQLITE_AFF_TEXT; - zChar = zIn; - }else if( h==(('c'<<24)+('l'<<16)+('o'<<8)+'b') ){ /* CLOB */ - aff = SQLITE_AFF_TEXT; - }else if( h==(('t'<<24)+('e'<<16)+('x'<<8)+'t') ){ /* TEXT */ - aff = SQLITE_AFF_TEXT; - }else if( h==(('b'<<24)+('l'<<16)+('o'<<8)+'b') /* BLOB */ - && (aff==SQLITE_AFF_NUMERIC || aff==SQLITE_AFF_REAL) ){ - aff = SQLITE_AFF_NONE; - if( zIn[0]=='(' ) zChar = zIn; -#ifndef SQLITE_OMIT_FLOATING_POINT - }else if( h==(('r'<<24)+('e'<<16)+('a'<<8)+'l') /* REAL */ - && aff==SQLITE_AFF_NUMERIC ){ - aff = SQLITE_AFF_REAL; - }else if( h==(('f'<<24)+('l'<<16)+('o'<<8)+'a') /* FLOA */ - && aff==SQLITE_AFF_NUMERIC ){ - aff = SQLITE_AFF_REAL; - }else if( h==(('d'<<24)+('o'<<16)+('u'<<8)+'b') /* DOUB */ - && aff==SQLITE_AFF_NUMERIC ){ - aff = SQLITE_AFF_REAL; -#endif - }else if( (h&0x00FFFFFF)==(('i'<<16)+('n'<<8)+'t') ){ /* INT */ - aff = SQLITE_AFF_INTEGER; - break; - } - } - - /* If pszEst is not NULL, store an estimate of the field size. The - ** estimate is scaled so that the size of an integer is 1. */ - if( pszEst ){ - *pszEst = 1; /* default size is approx 4 bytes */ - if( aff<=SQLITE_AFF_NONE ){ - if( zChar ){ - while( zChar[0] ){ - if( sqlite3Isdigit(zChar[0]) ){ - int v = 0; - sqlite3GetInt32(zChar, &v); - v = v/4 + 1; - if( v>255 ) v = 255; - *pszEst = v; /* BLOB(k), VARCHAR(k), CHAR(k) -> r=(k/4+1) */ - break; - } - zChar++; - } - }else{ - *pszEst = 5; /* BLOB, TEXT, CLOB -> r=5 (approx 20 bytes)*/ - } - } - } - return aff; -} - -/* -** This routine is called by the parser while in the middle of -** parsing a CREATE TABLE statement. The pFirst token is the first -** token in the sequence of tokens that describe the type of the -** column currently under construction. pLast is the last token -** in the sequence. Use this information to construct a string -** that contains the typename of the column and store that string -** in zType. -*/ -SQLITE_PRIVATE void sqlite3AddColumnType(Parse *pParse, Token *pType){ - Table *p; - Column *pCol; - - p = pParse->pNewTable; - if( p==0 || NEVER(p->nCol<1) ) return; - pCol = &p->aCol[p->nCol-1]; - assert( pCol->zType==0 ); - pCol->zType = sqlite3NameFromToken(pParse->db, pType); - pCol->affinity = sqlite3AffinityType(pCol->zType, &pCol->szEst); -} - -/* -** The expression is the default value for the most recently added column -** of the table currently under construction. -** -** Default value expressions must be constant. Raise an exception if this -** is not the case. -** -** This routine is called by the parser while in the middle of -** parsing a CREATE TABLE statement. -*/ -SQLITE_PRIVATE void sqlite3AddDefaultValue(Parse *pParse, ExprSpan *pSpan){ - Table *p; - Column *pCol; - sqlite3 *db = pParse->db; - p = pParse->pNewTable; - if( p!=0 ){ - pCol = &(p->aCol[p->nCol-1]); - if( !sqlite3ExprIsConstantOrFunction(pSpan->pExpr) ){ - sqlite3ErrorMsg(pParse, "default value of column [%s] is not constant", - pCol->zName); - }else{ - /* A copy of pExpr is used instead of the original, as pExpr contains - ** tokens that point to volatile memory. The 'span' of the expression - ** is required by pragma table_info. - */ - sqlite3ExprDelete(db, pCol->pDflt); - pCol->pDflt = sqlite3ExprDup(db, pSpan->pExpr, EXPRDUP_REDUCE); - sqlite3DbFree(db, pCol->zDflt); - pCol->zDflt = sqlite3DbStrNDup(db, (char*)pSpan->zStart, - (int)(pSpan->zEnd - pSpan->zStart)); - } - } - sqlite3ExprDelete(db, pSpan->pExpr); -} - -/* -** Designate the PRIMARY KEY for the table. pList is a list of names -** of columns that form the primary key. If pList is NULL, then the -** most recently added column of the table is the primary key. -** -** A table can have at most one primary key. If the table already has -** a primary key (and this is the second primary key) then create an -** error. -** -** If the PRIMARY KEY is on a single column whose datatype is INTEGER, -** then we will try to use that column as the rowid. Set the Table.iPKey -** field of the table under construction to be the index of the -** INTEGER PRIMARY KEY column. Table.iPKey is set to -1 if there is -** no INTEGER PRIMARY KEY. -** -** If the key is not an INTEGER PRIMARY KEY, then create a unique -** index for the key. No index is created for INTEGER PRIMARY KEYs. -*/ -SQLITE_PRIVATE void sqlite3AddPrimaryKey( - Parse *pParse, /* Parsing context */ - ExprList *pList, /* List of field names to be indexed */ - int onError, /* What to do with a uniqueness conflict */ - int autoInc, /* True if the AUTOINCREMENT keyword is present */ - int sortOrder /* SQLITE_SO_ASC or SQLITE_SO_DESC */ -){ - Table *pTab = pParse->pNewTable; - char *zType = 0; - int iCol = -1, i; - int nTerm; - if( pTab==0 || IN_DECLARE_VTAB ) goto primary_key_exit; - if( pTab->tabFlags & TF_HasPrimaryKey ){ - sqlite3ErrorMsg(pParse, - "table \"%s\" has more than one primary key", pTab->zName); - goto primary_key_exit; - } - pTab->tabFlags |= TF_HasPrimaryKey; - if( pList==0 ){ - iCol = pTab->nCol - 1; - pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; - zType = pTab->aCol[iCol].zType; - nTerm = 1; - }else{ - nTerm = pList->nExpr; - for(i=0; inCol; iCol++){ - if( sqlite3StrICmp(pList->a[i].zName, pTab->aCol[iCol].zName)==0 ){ - pTab->aCol[iCol].colFlags |= COLFLAG_PRIMKEY; - zType = pTab->aCol[iCol].zType; - break; - } - } - } - } - if( nTerm==1 - && zType && sqlite3StrICmp(zType, "INTEGER")==0 - && sortOrder==SQLITE_SO_ASC - ){ - pTab->iPKey = iCol; - pTab->keyConf = (u8)onError; - assert( autoInc==0 || autoInc==1 ); - pTab->tabFlags |= autoInc*TF_Autoincrement; - if( pList ) pParse->iPkSortOrder = pList->a[0].sortOrder; - }else if( autoInc ){ -#ifndef SQLITE_OMIT_AUTOINCREMENT - sqlite3ErrorMsg(pParse, "AUTOINCREMENT is only allowed on an " - "INTEGER PRIMARY KEY"); -#endif - }else{ - Vdbe *v = pParse->pVdbe; - Index *p; - if( v ) pParse->addrSkipPK = sqlite3VdbeAddOp0(v, OP_Noop); - p = sqlite3CreateIndex(pParse, 0, 0, 0, pList, onError, 0, - 0, sortOrder, 0); - if( p ){ - p->autoIndex = 2; - if( v ) sqlite3VdbeJumpHere(v, pParse->addrSkipPK); - } - pList = 0; - } - -primary_key_exit: - sqlite3ExprListDelete(pParse->db, pList); - return; -} - -/* -** Add a new CHECK constraint to the table currently under construction. -*/ -SQLITE_PRIVATE void sqlite3AddCheckConstraint( - Parse *pParse, /* Parsing context */ - Expr *pCheckExpr /* The check expression */ -){ -#ifndef SQLITE_OMIT_CHECK - Table *pTab = pParse->pNewTable; - if( pTab && !IN_DECLARE_VTAB ){ - pTab->pCheck = sqlite3ExprListAppend(pParse, pTab->pCheck, pCheckExpr); - if( pParse->constraintName.n ){ - sqlite3ExprListSetName(pParse, pTab->pCheck, &pParse->constraintName, 1); - } - }else -#endif - { - sqlite3ExprDelete(pParse->db, pCheckExpr); - } -} - -/* -** Set the collation function of the most recently parsed table column -** to the CollSeq given. -*/ -SQLITE_PRIVATE void sqlite3AddCollateType(Parse *pParse, Token *pToken){ - Table *p; - int i; - char *zColl; /* Dequoted name of collation sequence */ - sqlite3 *db; - - if( (p = pParse->pNewTable)==0 ) return; - i = p->nCol-1; - db = pParse->db; - zColl = sqlite3NameFromToken(db, pToken); - if( !zColl ) return; - - if( sqlite3LocateCollSeq(pParse, zColl) ){ - Index *pIdx; - sqlite3DbFree(db, p->aCol[i].zColl); - p->aCol[i].zColl = zColl; - - /* If the column is declared as " PRIMARY KEY COLLATE ", - ** then an index may have been created on this column before the - ** collation type was added. Correct this if it is the case. - */ - for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){ - assert( pIdx->nKeyCol==1 ); - if( pIdx->aiColumn[0]==i ){ - pIdx->azColl[0] = p->aCol[i].zColl; - } - } - }else{ - sqlite3DbFree(db, zColl); - } -} - -/* -** This function returns the collation sequence for database native text -** encoding identified by the string zName, length nName. -** -** If the requested collation sequence is not available, or not available -** in the database native encoding, the collation factory is invoked to -** request it. If the collation factory does not supply such a sequence, -** and the sequence is available in another text encoding, then that is -** returned instead. -** -** If no versions of the requested collations sequence are available, or -** another error occurs, NULL is returned and an error message written into -** pParse. -** -** This routine is a wrapper around sqlite3FindCollSeq(). This routine -** invokes the collation factory if the named collation cannot be found -** and generates an error message. -** -** See also: sqlite3FindCollSeq(), sqlite3GetCollSeq() -*/ -SQLITE_PRIVATE CollSeq *sqlite3LocateCollSeq(Parse *pParse, const char *zName){ - sqlite3 *db = pParse->db; - u8 enc = ENC(db); - u8 initbusy = db->init.busy; - CollSeq *pColl; - - pColl = sqlite3FindCollSeq(db, enc, zName, initbusy); - if( !initbusy && (!pColl || !pColl->xCmp) ){ - pColl = sqlite3GetCollSeq(pParse, enc, pColl, zName); - } - - return pColl; -} - - -/* -** Generate code that will increment the schema cookie. -** -** The schema cookie is used to determine when the schema for the -** database changes. After each schema change, the cookie value -** changes. When a process first reads the schema it records the -** cookie. Thereafter, whenever it goes to access the database, -** it checks the cookie to make sure the schema has not changed -** since it was last read. -** -** This plan is not completely bullet-proof. It is possible for -** the schema to change multiple times and for the cookie to be -** set back to prior value. But schema changes are infrequent -** and the probability of hitting the same cookie value is only -** 1 chance in 2^32. So we're safe enough. -*/ -SQLITE_PRIVATE void sqlite3ChangeCookie(Parse *pParse, int iDb){ - int r1 = sqlite3GetTempReg(pParse); - sqlite3 *db = pParse->db; - Vdbe *v = pParse->pVdbe; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - sqlite3VdbeAddOp2(v, OP_Integer, db->aDb[iDb].pSchema->schema_cookie+1, r1); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_SCHEMA_VERSION, r1); - sqlite3ReleaseTempReg(pParse, r1); -} - -/* -** Measure the number of characters needed to output the given -** identifier. The number returned includes any quotes used -** but does not include the null terminator. -** -** The estimate is conservative. It might be larger that what is -** really needed. -*/ -static int identLength(const char *z){ - int n; - for(n=0; *z; n++, z++){ - if( *z=='"' ){ n++; } - } - return n + 2; -} - -/* -** The first parameter is a pointer to an output buffer. The second -** parameter is a pointer to an integer that contains the offset at -** which to write into the output buffer. This function copies the -** nul-terminated string pointed to by the third parameter, zSignedIdent, -** to the specified offset in the buffer and updates *pIdx to refer -** to the first byte after the last byte written before returning. -** -** If the string zSignedIdent consists entirely of alpha-numeric -** characters, does not begin with a digit and is not an SQL keyword, -** then it is copied to the output buffer exactly as it is. Otherwise, -** it is quoted using double-quotes. -*/ -static void identPut(char *z, int *pIdx, char *zSignedIdent){ - unsigned char *zIdent = (unsigned char*)zSignedIdent; - int i, j, needQuote; - i = *pIdx; - - for(j=0; zIdent[j]; j++){ - if( !sqlite3Isalnum(zIdent[j]) && zIdent[j]!='_' ) break; - } - needQuote = sqlite3Isdigit(zIdent[0]) - || sqlite3KeywordCode(zIdent, j)!=TK_ID - || zIdent[j]!=0 - || j==0; - - if( needQuote ) z[i++] = '"'; - for(j=0; zIdent[j]; j++){ - z[i++] = zIdent[j]; - if( zIdent[j]=='"' ) z[i++] = '"'; - } - if( needQuote ) z[i++] = '"'; - z[i] = 0; - *pIdx = i; -} - -/* -** Generate a CREATE TABLE statement appropriate for the given -** table. Memory to hold the text of the statement is obtained -** from sqliteMalloc() and must be freed by the calling function. -*/ -static char *createTableStmt(sqlite3 *db, Table *p){ - int i, k, n; - char *zStmt; - char *zSep, *zSep2, *zEnd; - Column *pCol; - n = 0; - for(pCol = p->aCol, i=0; inCol; i++, pCol++){ - n += identLength(pCol->zName) + 5; - } - n += identLength(p->zName); - if( n<50 ){ - zSep = ""; - zSep2 = ","; - zEnd = ")"; - }else{ - zSep = "\n "; - zSep2 = ",\n "; - zEnd = "\n)"; - } - n += 35 + 6*p->nCol; - zStmt = sqlite3DbMallocRaw(0, n); - if( zStmt==0 ){ - db->mallocFailed = 1; - return 0; - } - sqlite3_snprintf(n, zStmt, "CREATE TABLE "); - k = sqlite3Strlen30(zStmt); - identPut(zStmt, &k, p->zName); - zStmt[k++] = '('; - for(pCol=p->aCol, i=0; inCol; i++, pCol++){ - static const char * const azType[] = { - /* SQLITE_AFF_TEXT */ " TEXT", - /* SQLITE_AFF_NONE */ "", - /* SQLITE_AFF_NUMERIC */ " NUM", - /* SQLITE_AFF_INTEGER */ " INT", - /* SQLITE_AFF_REAL */ " REAL" - }; - int len; - const char *zType; - - sqlite3_snprintf(n-k, &zStmt[k], zSep); - k += sqlite3Strlen30(&zStmt[k]); - zSep = zSep2; - identPut(zStmt, &k, pCol->zName); - assert( pCol->affinity-SQLITE_AFF_TEXT >= 0 ); - assert( pCol->affinity-SQLITE_AFF_TEXT < ArraySize(azType) ); - testcase( pCol->affinity==SQLITE_AFF_TEXT ); - testcase( pCol->affinity==SQLITE_AFF_NONE ); - testcase( pCol->affinity==SQLITE_AFF_NUMERIC ); - testcase( pCol->affinity==SQLITE_AFF_INTEGER ); - testcase( pCol->affinity==SQLITE_AFF_REAL ); - - zType = azType[pCol->affinity - SQLITE_AFF_TEXT]; - len = sqlite3Strlen30(zType); - assert( pCol->affinity==SQLITE_AFF_NONE - || pCol->affinity==sqlite3AffinityType(zType, 0) ); - memcpy(&zStmt[k], zType, len); - k += len; - assert( k<=n ); - } - sqlite3_snprintf(n-k, &zStmt[k], "%s", zEnd); - return zStmt; -} - -/* -** Resize an Index object to hold N columns total. Return SQLITE_OK -** on success and SQLITE_NOMEM on an OOM error. -*/ -static int resizeIndexObject(sqlite3 *db, Index *pIdx, int N){ - char *zExtra; - int nByte; - if( pIdx->nColumn>=N ) return SQLITE_OK; - assert( pIdx->isResized==0 ); - nByte = (sizeof(char*) + sizeof(i16) + 1)*N; - zExtra = sqlite3DbMallocZero(db, nByte); - if( zExtra==0 ) return SQLITE_NOMEM; - memcpy(zExtra, pIdx->azColl, sizeof(char*)*pIdx->nColumn); - pIdx->azColl = (char**)zExtra; - zExtra += sizeof(char*)*N; - memcpy(zExtra, pIdx->aiColumn, sizeof(i16)*pIdx->nColumn); - pIdx->aiColumn = (i16*)zExtra; - zExtra += sizeof(i16)*N; - memcpy(zExtra, pIdx->aSortOrder, pIdx->nColumn); - pIdx->aSortOrder = (u8*)zExtra; - pIdx->nColumn = N; - pIdx->isResized = 1; - return SQLITE_OK; -} - -/* -** Estimate the total row width for a table. -*/ -static void estimateTableWidth(Table *pTab){ - unsigned wTable = 0; - const Column *pTabCol; - int i; - for(i=pTab->nCol, pTabCol=pTab->aCol; i>0; i--, pTabCol++){ - wTable += pTabCol->szEst; - } - if( pTab->iPKey<0 ) wTable++; - pTab->szTabRow = sqlite3LogEst(wTable*4); -} - -/* -** Estimate the average size of a row for an index. -*/ -static void estimateIndexWidth(Index *pIdx){ - unsigned wIndex = 0; - int i; - const Column *aCol = pIdx->pTable->aCol; - for(i=0; inColumn; i++){ - i16 x = pIdx->aiColumn[i]; - assert( xpTable->nCol ); - wIndex += x<0 ? 1 : aCol[pIdx->aiColumn[i]].szEst; - } - pIdx->szIdxRow = sqlite3LogEst(wIndex*4); -} - -/* Return true if value x is found any of the first nCol entries of aiCol[] -*/ -static int hasColumn(const i16 *aiCol, int nCol, int x){ - while( nCol-- > 0 ) if( x==*(aiCol++) ) return 1; - return 0; -} - -/* -** This routine runs at the end of parsing a CREATE TABLE statement that -** has a WITHOUT ROWID clause. The job of this routine is to convert both -** internal schema data structures and the generated VDBE code so that they -** are appropriate for a WITHOUT ROWID table instead of a rowid table. -** Changes include: -** -** (1) Convert the OP_CreateTable into an OP_CreateIndex. There is -** no rowid btree for a WITHOUT ROWID. Instead, the canonical -** data storage is a covering index btree. -** (2) Bypass the creation of the sqlite_master table entry -** for the PRIMARY KEY as the the primary key index is now -** identified by the sqlite_master table entry of the table itself. -** (3) Set the Index.tnum of the PRIMARY KEY Index object in the -** schema to the rootpage from the main table. -** (4) Set all columns of the PRIMARY KEY schema object to be NOT NULL. -** (5) Add all table columns to the PRIMARY KEY Index object -** so that the PRIMARY KEY is a covering index. The surplus -** columns are part of KeyInfo.nXField and are not used for -** sorting or lookup or uniqueness checks. -** (6) Replace the rowid tail on all automatically generated UNIQUE -** indices with the PRIMARY KEY columns. -*/ -static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ - Index *pIdx; - Index *pPk; - int nPk; - int i, j; - sqlite3 *db = pParse->db; - Vdbe *v = pParse->pVdbe; - - /* Convert the OP_CreateTable opcode that would normally create the - ** root-page for the table into a OP_CreateIndex opcode. The index - ** created will become the PRIMARY KEY index. - */ - if( pParse->addrCrTab ){ - assert( v ); - sqlite3VdbeGetOp(v, pParse->addrCrTab)->opcode = OP_CreateIndex; - } - - /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master - ** table entry. - */ - if( pParse->addrSkipPK ){ - assert( v ); - sqlite3VdbeGetOp(v, pParse->addrSkipPK)->opcode = OP_Goto; - } - - /* Locate the PRIMARY KEY index. Or, if this table was originally - ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. - */ - if( pTab->iPKey>=0 ){ - ExprList *pList; - pList = sqlite3ExprListAppend(pParse, 0, 0); - if( pList==0 ) return; - pList->a[0].zName = sqlite3DbStrDup(pParse->db, - pTab->aCol[pTab->iPKey].zName); - pList->a[0].sortOrder = pParse->iPkSortOrder; - assert( pParse->pNewTable==pTab ); - pPk = sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0); - if( pPk==0 ) return; - pPk->autoIndex = 2; - pTab->iPKey = -1; - }else{ - pPk = sqlite3PrimaryKeyIndex(pTab); - } - pPk->isCovering = 1; - assert( pPk!=0 ); - nPk = pPk->nKeyCol; - - /* Make sure every column of the PRIMARY KEY is NOT NULL */ - for(i=0; iaCol[pPk->aiColumn[i]].notNull = 1; - } - pPk->uniqNotNull = 1; - - /* The root page of the PRIMARY KEY is the table root page */ - pPk->tnum = pTab->tnum; - - /* Update the in-memory representation of all UNIQUE indices by converting - ** the final rowid column into one or more columns of the PRIMARY KEY. - */ - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - int n; - if( pIdx->autoIndex==2 ) continue; - for(i=n=0; iaiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++; - } - if( n==0 ){ - /* This index is a superset of the primary key */ - pIdx->nColumn = pIdx->nKeyCol; - continue; - } - if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; - for(i=0, j=pIdx->nKeyCol; iaiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){ - pIdx->aiColumn[j] = pPk->aiColumn[i]; - pIdx->azColl[j] = pPk->azColl[i]; - j++; - } - } - assert( pIdx->nColumn>=pIdx->nKeyCol+n ); - assert( pIdx->nColumn>=j ); - } - - /* Add all table columns to the PRIMARY KEY index - */ - if( nPknCol ){ - if( resizeIndexObject(db, pPk, pTab->nCol) ) return; - for(i=0, j=nPk; inCol; i++){ - if( !hasColumn(pPk->aiColumn, j, i) ){ - assert( jnColumn ); - pPk->aiColumn[j] = i; - pPk->azColl[j] = "BINARY"; - j++; - } - } - assert( pPk->nColumn==j ); - assert( pTab->nCol==j ); - }else{ - pPk->nColumn = pTab->nCol; - } -} - -/* -** This routine is called to report the final ")" that terminates -** a CREATE TABLE statement. -** -** The table structure that other action routines have been building -** is added to the internal hash tables, assuming no errors have -** occurred. -** -** An entry for the table is made in the master table on disk, unless -** this is a temporary table or db->init.busy==1. When db->init.busy==1 -** it means we are reading the sqlite_master table because we just -** connected to the database or because the sqlite_master table has -** recently changed, so the entry for this table already exists in -** the sqlite_master table. We do not want to create it again. -** -** If the pSelect argument is not NULL, it means that this routine -** was called to create a table generated from a -** "CREATE TABLE ... AS SELECT ..." statement. The column names of -** the new table will match the result set of the SELECT. -*/ -SQLITE_PRIVATE void sqlite3EndTable( - Parse *pParse, /* Parse context */ - Token *pCons, /* The ',' token after the last column defn. */ - Token *pEnd, /* The ')' before options in the CREATE TABLE */ - u8 tabOpts, /* Extra table options. Usually 0. */ - Select *pSelect /* Select from a "CREATE ... AS SELECT" */ -){ - Table *p; /* The new table */ - sqlite3 *db = pParse->db; /* The database connection */ - int iDb; /* Database in which the table lives */ - Index *pIdx; /* An implied index of the table */ - - if( (pEnd==0 && pSelect==0) || db->mallocFailed ){ - return; - } - p = pParse->pNewTable; - if( p==0 ) return; - - assert( !db->init.busy || !pSelect ); - - /* If the db->init.busy is 1 it means we are reading the SQL off the - ** "sqlite_master" or "sqlite_temp_master" table on the disk. - ** So do not write to the disk again. Extract the root page number - ** for the table from the db->init.newTnum field. (The page number - ** should have been put there by the sqliteOpenCb routine.) - */ - if( db->init.busy ){ - p->tnum = db->init.newTnum; - } - - /* Special processing for WITHOUT ROWID Tables */ - if( tabOpts & TF_WithoutRowid ){ - if( (p->tabFlags & TF_Autoincrement) ){ - sqlite3ErrorMsg(pParse, - "AUTOINCREMENT not allowed on WITHOUT ROWID tables"); - return; - } - if( (p->tabFlags & TF_HasPrimaryKey)==0 ){ - sqlite3ErrorMsg(pParse, "PRIMARY KEY missing on table %s", p->zName); - }else{ - p->tabFlags |= TF_WithoutRowid; - convertToWithoutRowidTable(pParse, p); - } - } - - iDb = sqlite3SchemaToIndex(db, p->pSchema); - -#ifndef SQLITE_OMIT_CHECK - /* Resolve names in all CHECK constraint expressions. - */ - if( p->pCheck ){ - sqlite3ResolveSelfReference(pParse, p, NC_IsCheck, 0, p->pCheck); - } -#endif /* !defined(SQLITE_OMIT_CHECK) */ - - /* Estimate the average row size for the table and for all implied indices */ - estimateTableWidth(p); - for(pIdx=p->pIndex; pIdx; pIdx=pIdx->pNext){ - estimateIndexWidth(pIdx); - } - - /* If not initializing, then create a record for the new table - ** in the SQLITE_MASTER table of the database. - ** - ** If this is a TEMPORARY table, write the entry into the auxiliary - ** file instead of into the main database file. - */ - if( !db->init.busy ){ - int n; - Vdbe *v; - char *zType; /* "view" or "table" */ - char *zType2; /* "VIEW" or "TABLE" */ - char *zStmt; /* Text of the CREATE TABLE or CREATE VIEW statement */ - - v = sqlite3GetVdbe(pParse); - if( NEVER(v==0) ) return; - - sqlite3VdbeAddOp1(v, OP_Close, 0); - - /* - ** Initialize zType for the new view or table. - */ - if( p->pSelect==0 ){ - /* A regular table */ - zType = "table"; - zType2 = "TABLE"; -#ifndef SQLITE_OMIT_VIEW - }else{ - /* A view */ - zType = "view"; - zType2 = "VIEW"; -#endif - } - - /* If this is a CREATE TABLE xx AS SELECT ..., execute the SELECT - ** statement to populate the new table. The root-page number for the - ** new table is in register pParse->regRoot. - ** - ** Once the SELECT has been coded by sqlite3Select(), it is in a - ** suitable state to query for the column names and types to be used - ** by the new table. - ** - ** A shared-cache write-lock is not required to write to the new table, - ** as a schema-lock must have already been obtained to create it. Since - ** a schema-lock excludes all other database users, the write-lock would - ** be redundant. - */ - if( pSelect ){ - SelectDest dest; - Table *pSelTab; - - assert(pParse->nTab==1); - sqlite3VdbeAddOp3(v, OP_OpenWrite, 1, pParse->regRoot, iDb); - sqlite3VdbeChangeP5(v, OPFLAG_P2ISREG); - pParse->nTab = 2; - sqlite3SelectDestInit(&dest, SRT_Table, 1); - sqlite3Select(pParse, pSelect, &dest); - sqlite3VdbeAddOp1(v, OP_Close, 1); - if( pParse->nErr==0 ){ - pSelTab = sqlite3ResultSetOfSelect(pParse, pSelect); - if( pSelTab==0 ) return; - assert( p->aCol==0 ); - p->nCol = pSelTab->nCol; - p->aCol = pSelTab->aCol; - pSelTab->nCol = 0; - pSelTab->aCol = 0; - sqlite3DeleteTable(db, pSelTab); - } - } - - /* Compute the complete text of the CREATE statement */ - if( pSelect ){ - zStmt = createTableStmt(db, p); - }else{ - Token *pEnd2 = tabOpts ? &pParse->sLastToken : pEnd; - n = (int)(pEnd2->z - pParse->sNameToken.z); - if( pEnd2->z[0]!=';' ) n += pEnd2->n; - zStmt = sqlite3MPrintf(db, - "CREATE %s %.*s", zType2, n, pParse->sNameToken.z - ); - } - - /* A slot for the record has already been allocated in the - ** SQLITE_MASTER table. We just need to update that slot with all - ** the information we've collected. - */ - sqlite3NestedParse(pParse, - "UPDATE %Q.%s " - "SET type='%s', name=%Q, tbl_name=%Q, rootpage=#%d, sql=%Q " - "WHERE rowid=#%d", - db->aDb[iDb].zName, SCHEMA_TABLE(iDb), - zType, - p->zName, - p->zName, - pParse->regRoot, - zStmt, - pParse->regRowid - ); - sqlite3DbFree(db, zStmt); - sqlite3ChangeCookie(pParse, iDb); - -#ifndef SQLITE_OMIT_AUTOINCREMENT - /* Check to see if we need to create an sqlite_sequence table for - ** keeping track of autoincrement keys. - */ - if( p->tabFlags & TF_Autoincrement ){ - Db *pDb = &db->aDb[iDb]; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - if( pDb->pSchema->pSeqTab==0 ){ - sqlite3NestedParse(pParse, - "CREATE TABLE %Q.sqlite_sequence(name,seq)", - pDb->zName - ); - } - } -#endif - - /* Reparse everything to update our internal data structures */ - sqlite3VdbeAddParseSchemaOp(v, iDb, - sqlite3MPrintf(db, "tbl_name='%q' AND type!='trigger'", p->zName)); - } - - - /* Add the table to the in-memory representation of the database. - */ - if( db->init.busy ){ - Table *pOld; - Schema *pSchema = p->pSchema; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - pOld = sqlite3HashInsert(&pSchema->tblHash, p->zName, - sqlite3Strlen30(p->zName),p); - if( pOld ){ - assert( p==pOld ); /* Malloc must have failed inside HashInsert() */ - db->mallocFailed = 1; - return; - } - pParse->pNewTable = 0; - db->flags |= SQLITE_InternChanges; - -#ifndef SQLITE_OMIT_ALTERTABLE - if( !p->pSelect ){ - const char *zName = (const char *)pParse->sNameToken.z; - int nName; - assert( !pSelect && pCons && pEnd ); - if( pCons->z==0 ){ - pCons = pEnd; - } - nName = (int)((const char *)pCons->z - zName); - p->addColOffset = 13 + sqlite3Utf8CharLen(zName, nName); - } -#endif - } -} - -#ifndef SQLITE_OMIT_VIEW -/* -** The parser calls this routine in order to create a new VIEW -*/ -SQLITE_PRIVATE void sqlite3CreateView( - Parse *pParse, /* The parsing context */ - Token *pBegin, /* The CREATE token that begins the statement */ - Token *pName1, /* The token that holds the name of the view */ - Token *pName2, /* The token that holds the name of the view */ - Select *pSelect, /* A SELECT statement that will become the new view */ - int isTemp, /* TRUE for a TEMPORARY view */ - int noErr /* Suppress error messages if VIEW already exists */ -){ - Table *p; - int n; - const char *z; - Token sEnd; - DbFixer sFix; - Token *pName = 0; - int iDb; - sqlite3 *db = pParse->db; - - if( pParse->nVar>0 ){ - sqlite3ErrorMsg(pParse, "parameters are not allowed in views"); - sqlite3SelectDelete(db, pSelect); - return; - } - sqlite3StartTable(pParse, pName1, pName2, isTemp, 1, 0, noErr); - p = pParse->pNewTable; - if( p==0 || pParse->nErr ){ - sqlite3SelectDelete(db, pSelect); - return; - } - sqlite3TwoPartName(pParse, pName1, pName2, &pName); - iDb = sqlite3SchemaToIndex(db, p->pSchema); - sqlite3FixInit(&sFix, pParse, iDb, "view", pName); - if( sqlite3FixSelect(&sFix, pSelect) ){ - sqlite3SelectDelete(db, pSelect); - return; - } - - /* Make a copy of the entire SELECT statement that defines the view. - ** This will force all the Expr.token.z values to be dynamically - ** allocated rather than point to the input string - which means that - ** they will persist after the current sqlite3_exec() call returns. - */ - p->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); - sqlite3SelectDelete(db, pSelect); - if( db->mallocFailed ){ - return; - } - if( !db->init.busy ){ - sqlite3ViewGetColumnNames(pParse, p); - } - - /* Locate the end of the CREATE VIEW statement. Make sEnd point to - ** the end. - */ - sEnd = pParse->sLastToken; - if( ALWAYS(sEnd.z[0]!=0) && sEnd.z[0]!=';' ){ - sEnd.z += sEnd.n; - } - sEnd.n = 0; - n = (int)(sEnd.z - pBegin->z); - z = pBegin->z; - while( ALWAYS(n>0) && sqlite3Isspace(z[n-1]) ){ n--; } - sEnd.z = &z[n-1]; - sEnd.n = 1; - - /* Use sqlite3EndTable() to add the view to the SQLITE_MASTER table */ - sqlite3EndTable(pParse, 0, &sEnd, 0, 0); - return; -} -#endif /* SQLITE_OMIT_VIEW */ - -#if !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) -/* -** The Table structure pTable is really a VIEW. Fill in the names of -** the columns of the view in the pTable structure. Return the number -** of errors. If an error is seen leave an error message in pParse->zErrMsg. -*/ -SQLITE_PRIVATE int sqlite3ViewGetColumnNames(Parse *pParse, Table *pTable){ - Table *pSelTab; /* A fake table from which we get the result set */ - Select *pSel; /* Copy of the SELECT that implements the view */ - int nErr = 0; /* Number of errors encountered */ - int n; /* Temporarily holds the number of cursors assigned */ - sqlite3 *db = pParse->db; /* Database connection for malloc errors */ - int (*xAuth)(void*,int,const char*,const char*,const char*,const char*); - - assert( pTable ); - -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( sqlite3VtabCallConnect(pParse, pTable) ){ - return SQLITE_ERROR; - } - if( IsVirtual(pTable) ) return 0; -#endif - -#ifndef SQLITE_OMIT_VIEW - /* A positive nCol means the columns names for this view are - ** already known. - */ - if( pTable->nCol>0 ) return 0; - - /* A negative nCol is a special marker meaning that we are currently - ** trying to compute the column names. If we enter this routine with - ** a negative nCol, it means two or more views form a loop, like this: - ** - ** CREATE VIEW one AS SELECT * FROM two; - ** CREATE VIEW two AS SELECT * FROM one; - ** - ** Actually, the error above is now caught prior to reaching this point. - ** But the following test is still important as it does come up - ** in the following: - ** - ** CREATE TABLE main.ex1(a); - ** CREATE TEMP VIEW ex1 AS SELECT a FROM ex1; - ** SELECT * FROM temp.ex1; - */ - if( pTable->nCol<0 ){ - sqlite3ErrorMsg(pParse, "view %s is circularly defined", pTable->zName); - return 1; - } - assert( pTable->nCol>=0 ); - - /* If we get this far, it means we need to compute the table names. - ** Note that the call to sqlite3ResultSetOfSelect() will expand any - ** "*" elements in the results set of the view and will assign cursors - ** to the elements of the FROM clause. But we do not want these changes - ** to be permanent. So the computation is done on a copy of the SELECT - ** statement that defines the view. - */ - assert( pTable->pSelect ); - pSel = sqlite3SelectDup(db, pTable->pSelect, 0); - if( pSel ){ - u8 enableLookaside = db->lookaside.bEnabled; - n = pParse->nTab; - sqlite3SrcListAssignCursors(pParse, pSel->pSrc); - pTable->nCol = -1; - db->lookaside.bEnabled = 0; -#ifndef SQLITE_OMIT_AUTHORIZATION - xAuth = db->xAuth; - db->xAuth = 0; - pSelTab = sqlite3ResultSetOfSelect(pParse, pSel); - db->xAuth = xAuth; -#else - pSelTab = sqlite3ResultSetOfSelect(pParse, pSel); -#endif - db->lookaside.bEnabled = enableLookaside; - pParse->nTab = n; - if( pSelTab ){ - assert( pTable->aCol==0 ); - pTable->nCol = pSelTab->nCol; - pTable->aCol = pSelTab->aCol; - pSelTab->nCol = 0; - pSelTab->aCol = 0; - sqlite3DeleteTable(db, pSelTab); - assert( sqlite3SchemaMutexHeld(db, 0, pTable->pSchema) ); - pTable->pSchema->flags |= DB_UnresetViews; - }else{ - pTable->nCol = 0; - nErr++; - } - sqlite3SelectDelete(db, pSel); - } else { - nErr++; - } -#endif /* SQLITE_OMIT_VIEW */ - return nErr; -} -#endif /* !defined(SQLITE_OMIT_VIEW) || !defined(SQLITE_OMIT_VIRTUALTABLE) */ - -#ifndef SQLITE_OMIT_VIEW -/* -** Clear the column names from every VIEW in database idx. -*/ -static void sqliteViewResetAll(sqlite3 *db, int idx){ - HashElem *i; - assert( sqlite3SchemaMutexHeld(db, idx, 0) ); - if( !DbHasProperty(db, idx, DB_UnresetViews) ) return; - for(i=sqliteHashFirst(&db->aDb[idx].pSchema->tblHash); i;i=sqliteHashNext(i)){ - Table *pTab = sqliteHashData(i); - if( pTab->pSelect ){ - sqliteDeleteColumnNames(db, pTab); - pTab->aCol = 0; - pTab->nCol = 0; - } - } - DbClearProperty(db, idx, DB_UnresetViews); -} -#else -# define sqliteViewResetAll(A,B) -#endif /* SQLITE_OMIT_VIEW */ - -/* -** This function is called by the VDBE to adjust the internal schema -** used by SQLite when the btree layer moves a table root page. The -** root-page of a table or index in database iDb has changed from iFrom -** to iTo. -** -** Ticket #1728: The symbol table might still contain information -** on tables and/or indices that are the process of being deleted. -** If you are unlucky, one of those deleted indices or tables might -** have the same rootpage number as the real table or index that is -** being moved. So we cannot stop searching after the first match -** because the first match might be for one of the deleted indices -** or tables and not the table/index that is actually being moved. -** We must continue looping until all tables and indices with -** rootpage==iFrom have been converted to have a rootpage of iTo -** in order to be certain that we got the right one. -*/ -#ifndef SQLITE_OMIT_AUTOVACUUM -SQLITE_PRIVATE void sqlite3RootPageMoved(sqlite3 *db, int iDb, int iFrom, int iTo){ - HashElem *pElem; - Hash *pHash; - Db *pDb; - - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - pDb = &db->aDb[iDb]; - pHash = &pDb->pSchema->tblHash; - for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){ - Table *pTab = sqliteHashData(pElem); - if( pTab->tnum==iFrom ){ - pTab->tnum = iTo; - } - } - pHash = &pDb->pSchema->idxHash; - for(pElem=sqliteHashFirst(pHash); pElem; pElem=sqliteHashNext(pElem)){ - Index *pIdx = sqliteHashData(pElem); - if( pIdx->tnum==iFrom ){ - pIdx->tnum = iTo; - } - } -} -#endif - -/* -** Write code to erase the table with root-page iTable from database iDb. -** Also write code to modify the sqlite_master table and internal schema -** if a root-page of another table is moved by the btree-layer whilst -** erasing iTable (this can happen with an auto-vacuum database). -*/ -static void destroyRootPage(Parse *pParse, int iTable, int iDb){ - Vdbe *v = sqlite3GetVdbe(pParse); - int r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_Destroy, iTable, r1, iDb); - sqlite3MayAbort(pParse); -#ifndef SQLITE_OMIT_AUTOVACUUM - /* OP_Destroy stores an in integer r1. If this integer - ** is non-zero, then it is the root page number of a table moved to - ** location iTable. The following code modifies the sqlite_master table to - ** reflect this. - ** - ** The "#NNN" in the SQL is a special constant that means whatever value - ** is in register NNN. See grammar rules associated with the TK_REGISTER - ** token for additional information. - */ - sqlite3NestedParse(pParse, - "UPDATE %Q.%s SET rootpage=%d WHERE #%d AND rootpage=#%d", - pParse->db->aDb[iDb].zName, SCHEMA_TABLE(iDb), iTable, r1, r1); -#endif - sqlite3ReleaseTempReg(pParse, r1); -} - -/* -** Write VDBE code to erase table pTab and all associated indices on disk. -** Code to update the sqlite_master tables and internal schema definitions -** in case a root-page belonging to another table is moved by the btree layer -** is also added (this can happen with an auto-vacuum database). -*/ -static void destroyTable(Parse *pParse, Table *pTab){ -#ifdef SQLITE_OMIT_AUTOVACUUM - Index *pIdx; - int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - destroyRootPage(pParse, pTab->tnum, iDb); - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - destroyRootPage(pParse, pIdx->tnum, iDb); - } -#else - /* If the database may be auto-vacuum capable (if SQLITE_OMIT_AUTOVACUUM - ** is not defined), then it is important to call OP_Destroy on the - ** table and index root-pages in order, starting with the numerically - ** largest root-page number. This guarantees that none of the root-pages - ** to be destroyed is relocated by an earlier OP_Destroy. i.e. if the - ** following were coded: - ** - ** OP_Destroy 4 0 - ** ... - ** OP_Destroy 5 0 - ** - ** and root page 5 happened to be the largest root-page number in the - ** database, then root page 5 would be moved to page 4 by the - ** "OP_Destroy 4 0" opcode. The subsequent "OP_Destroy 5 0" would hit - ** a free-list page. - */ - int iTab = pTab->tnum; - int iDestroyed = 0; - - while( 1 ){ - Index *pIdx; - int iLargest = 0; - - if( iDestroyed==0 || iTabpIndex; pIdx; pIdx=pIdx->pNext){ - int iIdx = pIdx->tnum; - assert( pIdx->pSchema==pTab->pSchema ); - if( (iDestroyed==0 || (iIdxiLargest ){ - iLargest = iIdx; - } - } - if( iLargest==0 ){ - return; - }else{ - int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - assert( iDb>=0 && iDbdb->nDb ); - destroyRootPage(pParse, iLargest, iDb); - iDestroyed = iLargest; - } - } -#endif -} - -/* -** Remove entries from the sqlite_statN tables (for N in (1,2,3)) -** after a DROP INDEX or DROP TABLE command. -*/ -static void sqlite3ClearStatTables( - Parse *pParse, /* The parsing context */ - int iDb, /* The database number */ - const char *zType, /* "idx" or "tbl" */ - const char *zName /* Name of index or table */ -){ - int i; - const char *zDbName = pParse->db->aDb[iDb].zName; - for(i=1; i<=4; i++){ - char zTab[24]; - sqlite3_snprintf(sizeof(zTab),zTab,"sqlite_stat%d",i); - if( sqlite3FindTable(pParse->db, zTab, zDbName) ){ - sqlite3NestedParse(pParse, - "DELETE FROM %Q.%s WHERE %s=%Q", - zDbName, zTab, zType, zName - ); - } - } -} - -/* -** Generate code to drop a table. -*/ -SQLITE_PRIVATE void sqlite3CodeDropTable(Parse *pParse, Table *pTab, int iDb, int isView){ - Vdbe *v; - sqlite3 *db = pParse->db; - Trigger *pTrigger; - Db *pDb = &db->aDb[iDb]; - - v = sqlite3GetVdbe(pParse); - assert( v!=0 ); - sqlite3BeginWriteOperation(pParse, 1, iDb); - -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( IsVirtual(pTab) ){ - sqlite3VdbeAddOp0(v, OP_VBegin); - } -#endif - - /* Drop all triggers associated with the table being dropped. Code - ** is generated to remove entries from sqlite_master and/or - ** sqlite_temp_master if required. - */ - pTrigger = sqlite3TriggerList(pParse, pTab); - while( pTrigger ){ - assert( pTrigger->pSchema==pTab->pSchema || - pTrigger->pSchema==db->aDb[1].pSchema ); - sqlite3DropTriggerPtr(pParse, pTrigger); - pTrigger = pTrigger->pNext; - } - -#ifndef SQLITE_OMIT_AUTOINCREMENT - /* Remove any entries of the sqlite_sequence table associated with - ** the table being dropped. This is done before the table is dropped - ** at the btree level, in case the sqlite_sequence table needs to - ** move as a result of the drop (can happen in auto-vacuum mode). - */ - if( pTab->tabFlags & TF_Autoincrement ){ - sqlite3NestedParse(pParse, - "DELETE FROM %Q.sqlite_sequence WHERE name=%Q", - pDb->zName, pTab->zName - ); - } -#endif - - /* Drop all SQLITE_MASTER table and index entries that refer to the - ** table. The program name loops through the master table and deletes - ** every row that refers to a table of the same name as the one being - ** dropped. Triggers are handled separately because a trigger can be - ** created in the temp database that refers to a table in another - ** database. - */ - sqlite3NestedParse(pParse, - "DELETE FROM %Q.%s WHERE tbl_name=%Q and type!='trigger'", - pDb->zName, SCHEMA_TABLE(iDb), pTab->zName); - if( !isView && !IsVirtual(pTab) ){ - destroyTable(pParse, pTab); - } - - /* Remove the table entry from SQLite's internal schema and modify - ** the schema cookie. - */ - if( IsVirtual(pTab) ){ - sqlite3VdbeAddOp4(v, OP_VDestroy, iDb, 0, 0, pTab->zName, 0); - } - sqlite3VdbeAddOp4(v, OP_DropTable, iDb, 0, 0, pTab->zName, 0); - sqlite3ChangeCookie(pParse, iDb); - sqliteViewResetAll(db, iDb); -} - -/* -** This routine is called to do the work of a DROP TABLE statement. -** pName is the name of the table to be dropped. -*/ -SQLITE_PRIVATE void sqlite3DropTable(Parse *pParse, SrcList *pName, int isView, int noErr){ - Table *pTab; - Vdbe *v; - sqlite3 *db = pParse->db; - int iDb; - - if( db->mallocFailed ){ - goto exit_drop_table; - } - assert( pParse->nErr==0 ); - assert( pName->nSrc==1 ); - if( noErr ) db->suppressErr++; - pTab = sqlite3LocateTableItem(pParse, isView, &pName->a[0]); - if( noErr ) db->suppressErr--; - - if( pTab==0 ){ - if( noErr ) sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase); - goto exit_drop_table; - } - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - assert( iDb>=0 && iDbnDb ); - - /* If pTab is a virtual table, call ViewGetColumnNames() to ensure - ** it is initialized. - */ - if( IsVirtual(pTab) && sqlite3ViewGetColumnNames(pParse, pTab) ){ - goto exit_drop_table; - } -#ifndef SQLITE_OMIT_AUTHORIZATION - { - int code; - const char *zTab = SCHEMA_TABLE(iDb); - const char *zDb = db->aDb[iDb].zName; - const char *zArg2 = 0; - if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb)){ - goto exit_drop_table; - } - if( isView ){ - if( !OMIT_TEMPDB && iDb==1 ){ - code = SQLITE_DROP_TEMP_VIEW; - }else{ - code = SQLITE_DROP_VIEW; - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - }else if( IsVirtual(pTab) ){ - code = SQLITE_DROP_VTABLE; - zArg2 = sqlite3GetVTable(db, pTab)->pMod->zName; -#endif - }else{ - if( !OMIT_TEMPDB && iDb==1 ){ - code = SQLITE_DROP_TEMP_TABLE; - }else{ - code = SQLITE_DROP_TABLE; - } - } - if( sqlite3AuthCheck(pParse, code, pTab->zName, zArg2, zDb) ){ - goto exit_drop_table; - } - if( sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb) ){ - goto exit_drop_table; - } - } -#endif - if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 - && sqlite3StrNICmp(pTab->zName, "sqlite_stat", 11)!=0 ){ - sqlite3ErrorMsg(pParse, "table %s may not be dropped", pTab->zName); - goto exit_drop_table; - } - -#ifndef SQLITE_OMIT_VIEW - /* Ensure DROP TABLE is not used on a view, and DROP VIEW is not used - ** on a table. - */ - if( isView && pTab->pSelect==0 ){ - sqlite3ErrorMsg(pParse, "use DROP TABLE to delete table %s", pTab->zName); - goto exit_drop_table; - } - if( !isView && pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "use DROP VIEW to delete view %s", pTab->zName); - goto exit_drop_table; - } -#endif - - /* Generate code to remove the table from the master table - ** on disk. - */ - v = sqlite3GetVdbe(pParse); - if( v ){ - sqlite3BeginWriteOperation(pParse, 1, iDb); - sqlite3ClearStatTables(pParse, iDb, "tbl", pTab->zName); - sqlite3FkDropTable(pParse, pName, pTab); - sqlite3CodeDropTable(pParse, pTab, iDb, isView); - } - -exit_drop_table: - sqlite3SrcListDelete(db, pName); -} - -/* -** This routine is called to create a new foreign key on the table -** currently under construction. pFromCol determines which columns -** in the current table point to the foreign key. If pFromCol==0 then -** connect the key to the last column inserted. pTo is the name of -** the table referred to (a.k.a the "parent" table). pToCol is a list -** of tables in the parent pTo table. flags contains all -** information about the conflict resolution algorithms specified -** in the ON DELETE, ON UPDATE and ON INSERT clauses. -** -** An FKey structure is created and added to the table currently -** under construction in the pParse->pNewTable field. -** -** The foreign key is set for IMMEDIATE processing. A subsequent call -** to sqlite3DeferForeignKey() might change this to DEFERRED. -*/ -SQLITE_PRIVATE void sqlite3CreateForeignKey( - Parse *pParse, /* Parsing context */ - ExprList *pFromCol, /* Columns in this table that point to other table */ - Token *pTo, /* Name of the other table */ - ExprList *pToCol, /* Columns in the other table */ - int flags /* Conflict resolution algorithms. */ -){ - sqlite3 *db = pParse->db; -#ifndef SQLITE_OMIT_FOREIGN_KEY - FKey *pFKey = 0; - FKey *pNextTo; - Table *p = pParse->pNewTable; - int nByte; - int i; - int nCol; - char *z; - - assert( pTo!=0 ); - if( p==0 || IN_DECLARE_VTAB ) goto fk_end; - if( pFromCol==0 ){ - int iCol = p->nCol-1; - if( NEVER(iCol<0) ) goto fk_end; - if( pToCol && pToCol->nExpr!=1 ){ - sqlite3ErrorMsg(pParse, "foreign key on %s" - " should reference only one column of table %T", - p->aCol[iCol].zName, pTo); - goto fk_end; - } - nCol = 1; - }else if( pToCol && pToCol->nExpr!=pFromCol->nExpr ){ - sqlite3ErrorMsg(pParse, - "number of columns in foreign key does not match the number of " - "columns in the referenced table"); - goto fk_end; - }else{ - nCol = pFromCol->nExpr; - } - nByte = sizeof(*pFKey) + (nCol-1)*sizeof(pFKey->aCol[0]) + pTo->n + 1; - if( pToCol ){ - for(i=0; inExpr; i++){ - nByte += sqlite3Strlen30(pToCol->a[i].zName) + 1; - } - } - pFKey = sqlite3DbMallocZero(db, nByte ); - if( pFKey==0 ){ - goto fk_end; - } - pFKey->pFrom = p; - pFKey->pNextFrom = p->pFKey; - z = (char*)&pFKey->aCol[nCol]; - pFKey->zTo = z; - memcpy(z, pTo->z, pTo->n); - z[pTo->n] = 0; - sqlite3Dequote(z); - z += pTo->n+1; - pFKey->nCol = nCol; - if( pFromCol==0 ){ - pFKey->aCol[0].iFrom = p->nCol-1; - }else{ - for(i=0; inCol; j++){ - if( sqlite3StrICmp(p->aCol[j].zName, pFromCol->a[i].zName)==0 ){ - pFKey->aCol[i].iFrom = j; - break; - } - } - if( j>=p->nCol ){ - sqlite3ErrorMsg(pParse, - "unknown column \"%s\" in foreign key definition", - pFromCol->a[i].zName); - goto fk_end; - } - } - } - if( pToCol ){ - for(i=0; ia[i].zName); - pFKey->aCol[i].zCol = z; - memcpy(z, pToCol->a[i].zName, n); - z[n] = 0; - z += n+1; - } - } - pFKey->isDeferred = 0; - pFKey->aAction[0] = (u8)(flags & 0xff); /* ON DELETE action */ - pFKey->aAction[1] = (u8)((flags >> 8 ) & 0xff); /* ON UPDATE action */ - - assert( sqlite3SchemaMutexHeld(db, 0, p->pSchema) ); - pNextTo = (FKey *)sqlite3HashInsert(&p->pSchema->fkeyHash, - pFKey->zTo, sqlite3Strlen30(pFKey->zTo), (void *)pFKey - ); - if( pNextTo==pFKey ){ - db->mallocFailed = 1; - goto fk_end; - } - if( pNextTo ){ - assert( pNextTo->pPrevTo==0 ); - pFKey->pNextTo = pNextTo; - pNextTo->pPrevTo = pFKey; - } - - /* Link the foreign key to the table as the last step. - */ - p->pFKey = pFKey; - pFKey = 0; - -fk_end: - sqlite3DbFree(db, pFKey); -#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */ - sqlite3ExprListDelete(db, pFromCol); - sqlite3ExprListDelete(db, pToCol); -} - -/* -** This routine is called when an INITIALLY IMMEDIATE or INITIALLY DEFERRED -** clause is seen as part of a foreign key definition. The isDeferred -** parameter is 1 for INITIALLY DEFERRED and 0 for INITIALLY IMMEDIATE. -** The behavior of the most recently created foreign key is adjusted -** accordingly. -*/ -SQLITE_PRIVATE void sqlite3DeferForeignKey(Parse *pParse, int isDeferred){ -#ifndef SQLITE_OMIT_FOREIGN_KEY - Table *pTab; - FKey *pFKey; - if( (pTab = pParse->pNewTable)==0 || (pFKey = pTab->pFKey)==0 ) return; - assert( isDeferred==0 || isDeferred==1 ); /* EV: R-30323-21917 */ - pFKey->isDeferred = (u8)isDeferred; -#endif -} - -/* -** Generate code that will erase and refill index *pIdx. This is -** used to initialize a newly created index or to recompute the -** content of an index in response to a REINDEX command. -** -** if memRootPage is not negative, it means that the index is newly -** created. The register specified by memRootPage contains the -** root page number of the index. If memRootPage is negative, then -** the index already exists and must be cleared before being refilled and -** the root page number of the index is taken from pIndex->tnum. -*/ -static void sqlite3RefillIndex(Parse *pParse, Index *pIndex, int memRootPage){ - Table *pTab = pIndex->pTable; /* The table that is indexed */ - int iTab = pParse->nTab++; /* Btree cursor used for pTab */ - int iIdx = pParse->nTab++; /* Btree cursor used for pIndex */ - int iSorter; /* Cursor opened by OpenSorter (if in use) */ - int addr1; /* Address of top of loop */ - int addr2; /* Address to jump to for next iteration */ - int tnum; /* Root page of index */ - int iPartIdxLabel; /* Jump to this label to skip a row */ - Vdbe *v; /* Generate code into this virtual machine */ - KeyInfo *pKey; /* KeyInfo for index */ - int regRecord; /* Register holding assemblied index record */ - sqlite3 *db = pParse->db; /* The database connection */ - int iDb = sqlite3SchemaToIndex(db, pIndex->pSchema); - -#ifndef SQLITE_OMIT_AUTHORIZATION - if( sqlite3AuthCheck(pParse, SQLITE_REINDEX, pIndex->zName, 0, - db->aDb[iDb].zName ) ){ - return; - } -#endif - - /* Require a write-lock on the table to perform this operation */ - sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName); - - v = sqlite3GetVdbe(pParse); - if( v==0 ) return; - if( memRootPage>=0 ){ - tnum = memRootPage; - }else{ - tnum = pIndex->tnum; - } - pKey = sqlite3KeyInfoOfIndex(pParse, pIndex); - - /* Open the sorter cursor if we are to use one. */ - iSorter = pParse->nTab++; - sqlite3VdbeAddOp4(v, OP_SorterOpen, iSorter, 0, 0, (char*) - sqlite3KeyInfoRef(pKey), P4_KEYINFO); - - /* Open the table. Loop through all rows of the table, inserting index - ** records into the sorter. */ - sqlite3OpenTable(pParse, iTab, iDb, pTab, OP_OpenRead); - addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iTab, 0); - regRecord = sqlite3GetTempReg(pParse); - - sqlite3GenerateIndexKey(pParse,pIndex,iTab,regRecord,0,&iPartIdxLabel,0,0); - sqlite3VdbeAddOp2(v, OP_SorterInsert, iSorter, regRecord); - sqlite3VdbeResolveLabel(v, iPartIdxLabel); - sqlite3VdbeAddOp2(v, OP_Next, iTab, addr1+1); - sqlite3VdbeJumpHere(v, addr1); - if( memRootPage<0 ) sqlite3VdbeAddOp2(v, OP_Clear, tnum, iDb); - sqlite3VdbeAddOp4(v, OP_OpenWrite, iIdx, tnum, iDb, - (char *)pKey, P4_KEYINFO); - sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR|((memRootPage>=0)?OPFLAG_P2ISREG:0)); - - addr1 = sqlite3VdbeAddOp2(v, OP_SorterSort, iSorter, 0); - assert( pKey!=0 || db->mallocFailed || pParse->nErr ); - if( pIndex->onError!=OE_None && pKey!=0 ){ - int j2 = sqlite3VdbeCurrentAddr(v) + 3; - sqlite3VdbeAddOp2(v, OP_Goto, 0, j2); - addr2 = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp4Int(v, OP_SorterCompare, iSorter, j2, regRecord, - pKey->nField - pIndex->nKeyCol); - sqlite3UniqueConstraint(pParse, OE_Abort, pIndex); - }else{ - addr2 = sqlite3VdbeCurrentAddr(v); - } - sqlite3VdbeAddOp2(v, OP_SorterData, iSorter, regRecord); - sqlite3VdbeAddOp3(v, OP_IdxInsert, iIdx, regRecord, 1); - sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); - sqlite3ReleaseTempReg(pParse, regRecord); - sqlite3VdbeAddOp2(v, OP_SorterNext, iSorter, addr2); - sqlite3VdbeJumpHere(v, addr1); - - sqlite3VdbeAddOp1(v, OP_Close, iTab); - sqlite3VdbeAddOp1(v, OP_Close, iIdx); - sqlite3VdbeAddOp1(v, OP_Close, iSorter); -} - -/* -** Allocate heap space to hold an Index object with nCol columns. -** -** Increase the allocation size to provide an extra nExtra bytes -** of 8-byte aligned space after the Index object and return a -** pointer to this extra space in *ppExtra. -*/ -SQLITE_PRIVATE Index *sqlite3AllocateIndexObject( - sqlite3 *db, /* Database connection */ - i16 nCol, /* Total number of columns in the index */ - int nExtra, /* Number of bytes of extra space to alloc */ - char **ppExtra /* Pointer to the "extra" space */ -){ - Index *p; /* Allocated index object */ - int nByte; /* Bytes of space for Index object + arrays */ - - nByte = ROUND8(sizeof(Index)) + /* Index structure */ - ROUND8(sizeof(char*)*nCol) + /* Index.azColl */ - ROUND8(sizeof(tRowcnt)*(nCol+1) + /* Index.aiRowEst */ - sizeof(i16)*nCol + /* Index.aiColumn */ - sizeof(u8)*nCol); /* Index.aSortOrder */ - p = sqlite3DbMallocZero(db, nByte + nExtra); - if( p ){ - char *pExtra = ((char*)p)+ROUND8(sizeof(Index)); - p->azColl = (char**)pExtra; pExtra += ROUND8(sizeof(char*)*nCol); - p->aiRowEst = (tRowcnt*)pExtra; pExtra += sizeof(tRowcnt)*(nCol+1); - p->aiColumn = (i16*)pExtra; pExtra += sizeof(i16)*nCol; - p->aSortOrder = (u8*)pExtra; - p->nColumn = nCol; - p->nKeyCol = nCol - 1; - *ppExtra = ((char*)p) + nByte; - } - return p; -} - -/* -** Create a new index for an SQL table. pName1.pName2 is the name of the index -** and pTblList is the name of the table that is to be indexed. Both will -** be NULL for a primary key or an index that is created to satisfy a -** UNIQUE constraint. If pTable and pIndex are NULL, use pParse->pNewTable -** as the table to be indexed. pParse->pNewTable is a table that is -** currently being constructed by a CREATE TABLE statement. -** -** pList is a list of columns to be indexed. pList will be NULL if this -** is a primary key or unique-constraint on the most recent column added -** to the table currently under construction. -** -** If the index is created successfully, return a pointer to the new Index -** structure. This is used by sqlite3AddPrimaryKey() to mark the index -** as the tables primary key (Index.autoIndex==2). -*/ -SQLITE_PRIVATE Index *sqlite3CreateIndex( - Parse *pParse, /* All information about this parse */ - Token *pName1, /* First part of index name. May be NULL */ - Token *pName2, /* Second part of index name. May be NULL */ - SrcList *pTblName, /* Table to index. Use pParse->pNewTable if 0 */ - ExprList *pList, /* A list of columns to be indexed */ - int onError, /* OE_Abort, OE_Ignore, OE_Replace, or OE_None */ - Token *pStart, /* The CREATE token that begins this statement */ - Expr *pPIWhere, /* WHERE clause for partial indices */ - int sortOrder, /* Sort order of primary key when pList==NULL */ - int ifNotExist /* Omit error if index already exists */ -){ - Index *pRet = 0; /* Pointer to return */ - Table *pTab = 0; /* Table to be indexed */ - Index *pIndex = 0; /* The index to be created */ - char *zName = 0; /* Name of the index */ - int nName; /* Number of characters in zName */ - int i, j; - DbFixer sFix; /* For assigning database names to pTable */ - int sortOrderMask; /* 1 to honor DESC in index. 0 to ignore. */ - sqlite3 *db = pParse->db; - Db *pDb; /* The specific table containing the indexed database */ - int iDb; /* Index of the database that is being written */ - Token *pName = 0; /* Unqualified name of the index to create */ - struct ExprList_item *pListItem; /* For looping over pList */ - const Column *pTabCol; /* A column in the table */ - int nExtra = 0; /* Space allocated for zExtra[] */ - int nExtraCol; /* Number of extra columns needed */ - char *zExtra = 0; /* Extra space after the Index object */ - Index *pPk = 0; /* PRIMARY KEY index for WITHOUT ROWID tables */ - - assert( pParse->nErr==0 ); /* Never called with prior errors */ - if( db->mallocFailed || IN_DECLARE_VTAB ){ - goto exit_create_index; - } - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ - goto exit_create_index; - } - - /* - ** Find the table that is to be indexed. Return early if not found. - */ - if( pTblName!=0 ){ - - /* Use the two-part index name to determine the database - ** to search for the table. 'Fix' the table name to this db - ** before looking up the table. - */ - assert( pName1 && pName2 ); - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName); - if( iDb<0 ) goto exit_create_index; - assert( pName && pName->z ); - -#ifndef SQLITE_OMIT_TEMPDB - /* If the index name was unqualified, check if the table - ** is a temp table. If so, set the database to 1. Do not do this - ** if initialising a database schema. - */ - if( !db->init.busy ){ - pTab = sqlite3SrcListLookup(pParse, pTblName); - if( pName2->n==0 && pTab && pTab->pSchema==db->aDb[1].pSchema ){ - iDb = 1; - } - } -#endif - - sqlite3FixInit(&sFix, pParse, iDb, "index", pName); - if( sqlite3FixSrcList(&sFix, pTblName) ){ - /* Because the parser constructs pTblName from a single identifier, - ** sqlite3FixSrcList can never fail. */ - assert(0); - } - pTab = sqlite3LocateTableItem(pParse, 0, &pTblName->a[0]); - assert( db->mallocFailed==0 || pTab==0 ); - if( pTab==0 ) goto exit_create_index; - if( iDb==1 && db->aDb[iDb].pSchema!=pTab->pSchema ){ - sqlite3ErrorMsg(pParse, - "cannot create a TEMP index on non-TEMP table \"%s\"", - pTab->zName); - goto exit_create_index; - } - if( !HasRowid(pTab) ) pPk = sqlite3PrimaryKeyIndex(pTab); - }else{ - assert( pName==0 ); - assert( pStart==0 ); - pTab = pParse->pNewTable; - if( !pTab ) goto exit_create_index; - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - } - pDb = &db->aDb[iDb]; - - assert( pTab!=0 ); - assert( pParse->nErr==0 ); - if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 - && sqlite3StrNICmp(&pTab->zName[7],"altertab_",9)!=0 ){ - sqlite3ErrorMsg(pParse, "table %s may not be indexed", pTab->zName); - goto exit_create_index; - } -#ifndef SQLITE_OMIT_VIEW - if( pTab->pSelect ){ - sqlite3ErrorMsg(pParse, "views may not be indexed"); - goto exit_create_index; - } -#endif -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( IsVirtual(pTab) ){ - sqlite3ErrorMsg(pParse, "virtual tables may not be indexed"); - goto exit_create_index; - } -#endif - - /* - ** Find the name of the index. Make sure there is not already another - ** index or table with the same name. - ** - ** Exception: If we are reading the names of permanent indices from the - ** sqlite_master table (because some other process changed the schema) and - ** one of the index names collides with the name of a temporary table or - ** index, then we will continue to process this index. - ** - ** If pName==0 it means that we are - ** dealing with a primary key or UNIQUE constraint. We have to invent our - ** own name. - */ - if( pName ){ - zName = sqlite3NameFromToken(db, pName); - if( zName==0 ) goto exit_create_index; - assert( pName->z!=0 ); - if( SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ - goto exit_create_index; - } - if( !db->init.busy ){ - if( sqlite3FindTable(db, zName, 0)!=0 ){ - sqlite3ErrorMsg(pParse, "there is already a table named %s", zName); - goto exit_create_index; - } - } - if( sqlite3FindIndex(db, zName, pDb->zName)!=0 ){ - if( !ifNotExist ){ - sqlite3ErrorMsg(pParse, "index %s already exists", zName); - }else{ - assert( !db->init.busy ); - sqlite3CodeVerifySchema(pParse, iDb); - } - goto exit_create_index; - } - }else{ - int n; - Index *pLoop; - for(pLoop=pTab->pIndex, n=1; pLoop; pLoop=pLoop->pNext, n++){} - zName = sqlite3MPrintf(db, "sqlite_autoindex_%s_%d", pTab->zName, n); - if( zName==0 ){ - goto exit_create_index; - } - } - - /* Check for authorization to create an index. - */ -#ifndef SQLITE_OMIT_AUTHORIZATION - { - const char *zDb = pDb->zName; - if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iDb), 0, zDb) ){ - goto exit_create_index; - } - i = SQLITE_CREATE_INDEX; - if( !OMIT_TEMPDB && iDb==1 ) i = SQLITE_CREATE_TEMP_INDEX; - if( sqlite3AuthCheck(pParse, i, zName, pTab->zName, zDb) ){ - goto exit_create_index; - } - } -#endif - - /* If pList==0, it means this routine was called to make a primary - ** key out of the last column added to the table under construction. - ** So create a fake list to simulate this. - */ - if( pList==0 ){ - pList = sqlite3ExprListAppend(pParse, 0, 0); - if( pList==0 ) goto exit_create_index; - pList->a[0].zName = sqlite3DbStrDup(pParse->db, - pTab->aCol[pTab->nCol-1].zName); - pList->a[0].sortOrder = (u8)sortOrder; - } - - /* Figure out how many bytes of space are required to store explicitly - ** specified collation sequence names. - */ - for(i=0; inExpr; i++){ - Expr *pExpr = pList->a[i].pExpr; - if( pExpr ){ - assert( pExpr->op==TK_COLLATE ); - nExtra += (1 + sqlite3Strlen30(pExpr->u.zToken)); - } - } - - /* - ** Allocate the index structure. - */ - nName = sqlite3Strlen30(zName); - nExtraCol = pPk ? pPk->nKeyCol : 1; - pIndex = sqlite3AllocateIndexObject(db, pList->nExpr + nExtraCol, - nName + nExtra + 1, &zExtra); - if( db->mallocFailed ){ - goto exit_create_index; - } - assert( EIGHT_BYTE_ALIGNMENT(pIndex->aiRowEst) ); - assert( EIGHT_BYTE_ALIGNMENT(pIndex->azColl) ); - pIndex->zName = zExtra; - zExtra += nName + 1; - memcpy(pIndex->zName, zName, nName+1); - pIndex->pTable = pTab; - pIndex->onError = (u8)onError; - pIndex->uniqNotNull = onError!=OE_None; - pIndex->autoIndex = (u8)(pName==0); - pIndex->pSchema = db->aDb[iDb].pSchema; - pIndex->nKeyCol = pList->nExpr; - if( pPIWhere ){ - sqlite3ResolveSelfReference(pParse, pTab, NC_PartIdx, pPIWhere, 0); - pIndex->pPartIdxWhere = pPIWhere; - pPIWhere = 0; - } - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - - /* Check to see if we should honor DESC requests on index columns - */ - if( pDb->pSchema->file_format>=4 ){ - sortOrderMask = -1; /* Honor DESC */ - }else{ - sortOrderMask = 0; /* Ignore DESC */ - } - - /* Scan the names of the columns of the table to be indexed and - ** load the column indices into the Index structure. Report an error - ** if any column is not found. - ** - ** TODO: Add a test to make sure that the same column is not named - ** more than once within the same index. Only the first instance of - ** the column will ever be used by the optimizer. Note that using the - ** same column more than once cannot be an error because that would - ** break backwards compatibility - it needs to be a warning. - */ - for(i=0, pListItem=pList->a; inExpr; i++, pListItem++){ - const char *zColName = pListItem->zName; - int requestedSortOrder; - char *zColl; /* Collation sequence name */ - - for(j=0, pTabCol=pTab->aCol; jnCol; j++, pTabCol++){ - if( sqlite3StrICmp(zColName, pTabCol->zName)==0 ) break; - } - if( j>=pTab->nCol ){ - sqlite3ErrorMsg(pParse, "table %s has no column named %s", - pTab->zName, zColName); - pParse->checkSchema = 1; - goto exit_create_index; - } - assert( pTab->nCol<=0x7fff && j<=0x7fff ); - pIndex->aiColumn[i] = (i16)j; - if( pListItem->pExpr ){ - int nColl; - assert( pListItem->pExpr->op==TK_COLLATE ); - zColl = pListItem->pExpr->u.zToken; - nColl = sqlite3Strlen30(zColl) + 1; - assert( nExtra>=nColl ); - memcpy(zExtra, zColl, nColl); - zColl = zExtra; - zExtra += nColl; - nExtra -= nColl; - }else{ - zColl = pTab->aCol[j].zColl; - if( !zColl ) zColl = "BINARY"; - } - if( !db->init.busy && !sqlite3LocateCollSeq(pParse, zColl) ){ - goto exit_create_index; - } - pIndex->azColl[i] = zColl; - requestedSortOrder = pListItem->sortOrder & sortOrderMask; - pIndex->aSortOrder[i] = (u8)requestedSortOrder; - if( pTab->aCol[j].notNull==0 ) pIndex->uniqNotNull = 0; - } - if( pPk ){ - for(j=0; jnKeyCol; j++){ - int x = pPk->aiColumn[j]; - if( hasColumn(pIndex->aiColumn, pIndex->nKeyCol, x) ){ - pIndex->nColumn--; - }else{ - pIndex->aiColumn[i] = x; - pIndex->azColl[i] = pPk->azColl[j]; - pIndex->aSortOrder[i] = pPk->aSortOrder[j]; - i++; - } - } - assert( i==pIndex->nColumn ); - }else{ - pIndex->aiColumn[i] = -1; - pIndex->azColl[i] = "BINARY"; - } - sqlite3DefaultRowEst(pIndex); - if( pParse->pNewTable==0 ) estimateIndexWidth(pIndex); - - if( pTab==pParse->pNewTable ){ - /* This routine has been called to create an automatic index as a - ** result of a PRIMARY KEY or UNIQUE clause on a column definition, or - ** a PRIMARY KEY or UNIQUE clause following the column definitions. - ** i.e. one of: - ** - ** CREATE TABLE t(x PRIMARY KEY, y); - ** CREATE TABLE t(x, y, UNIQUE(x, y)); - ** - ** Either way, check to see if the table already has such an index. If - ** so, don't bother creating this one. This only applies to - ** automatically created indices. Users can do as they wish with - ** explicit indices. - ** - ** Two UNIQUE or PRIMARY KEY constraints are considered equivalent - ** (and thus suppressing the second one) even if they have different - ** sort orders. - ** - ** If there are different collating sequences or if the columns of - ** the constraint occur in different orders, then the constraints are - ** considered distinct and both result in separate indices. - */ - Index *pIdx; - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - int k; - assert( pIdx->onError!=OE_None ); - assert( pIdx->autoIndex ); - assert( pIndex->onError!=OE_None ); - - if( pIdx->nKeyCol!=pIndex->nKeyCol ) continue; - for(k=0; knKeyCol; k++){ - const char *z1; - const char *z2; - if( pIdx->aiColumn[k]!=pIndex->aiColumn[k] ) break; - z1 = pIdx->azColl[k]; - z2 = pIndex->azColl[k]; - if( z1!=z2 && sqlite3StrICmp(z1, z2) ) break; - } - if( k==pIdx->nKeyCol ){ - if( pIdx->onError!=pIndex->onError ){ - /* This constraint creates the same index as a previous - ** constraint specified somewhere in the CREATE TABLE statement. - ** However the ON CONFLICT clauses are different. If both this - ** constraint and the previous equivalent constraint have explicit - ** ON CONFLICT clauses this is an error. Otherwise, use the - ** explicitly specified behavior for the index. - */ - if( !(pIdx->onError==OE_Default || pIndex->onError==OE_Default) ){ - sqlite3ErrorMsg(pParse, - "conflicting ON CONFLICT clauses specified", 0); - } - if( pIdx->onError==OE_Default ){ - pIdx->onError = pIndex->onError; - } - } - goto exit_create_index; - } - } - } - - /* Link the new Index structure to its table and to the other - ** in-memory database structures. - */ - if( db->init.busy ){ - Index *p; - assert( sqlite3SchemaMutexHeld(db, 0, pIndex->pSchema) ); - p = sqlite3HashInsert(&pIndex->pSchema->idxHash, - pIndex->zName, sqlite3Strlen30(pIndex->zName), - pIndex); - if( p ){ - assert( p==pIndex ); /* Malloc must have failed */ - db->mallocFailed = 1; - goto exit_create_index; - } - db->flags |= SQLITE_InternChanges; - if( pTblName!=0 ){ - pIndex->tnum = db->init.newTnum; - } - } - - /* If this is the initial CREATE INDEX statement (or CREATE TABLE if the - ** index is an implied index for a UNIQUE or PRIMARY KEY constraint) then - ** emit code to allocate the index rootpage on disk and make an entry for - ** the index in the sqlite_master table and populate the index with - ** content. But, do not do this if we are simply reading the sqlite_master - ** table to parse the schema, or if this index is the PRIMARY KEY index - ** of a WITHOUT ROWID table. - ** - ** If pTblName==0 it means this index is generated as an implied PRIMARY KEY - ** or UNIQUE index in a CREATE TABLE statement. Since the table - ** has just been created, it contains no data and the index initialization - ** step can be skipped. - */ - else if( pParse->nErr==0 && (HasRowid(pTab) || pTblName!=0) ){ - Vdbe *v; - char *zStmt; - int iMem = ++pParse->nMem; - - v = sqlite3GetVdbe(pParse); - if( v==0 ) goto exit_create_index; - - - /* Create the rootpage for the index - */ - sqlite3BeginWriteOperation(pParse, 1, iDb); - sqlite3VdbeAddOp2(v, OP_CreateIndex, iDb, iMem); - - /* Gather the complete text of the CREATE INDEX statement into - ** the zStmt variable - */ - if( pStart ){ - int n = (int)(pParse->sLastToken.z - pName->z) + pParse->sLastToken.n; - if( pName->z[n-1]==';' ) n--; - /* A named index with an explicit CREATE INDEX statement */ - zStmt = sqlite3MPrintf(db, "CREATE%s INDEX %.*s", - onError==OE_None ? "" : " UNIQUE", n, pName->z); - }else{ - /* An automatic index created by a PRIMARY KEY or UNIQUE constraint */ - /* zStmt = sqlite3MPrintf(""); */ - zStmt = 0; - } - - /* Add an entry in sqlite_master for this index - */ - sqlite3NestedParse(pParse, - "INSERT INTO %Q.%s VALUES('index',%Q,%Q,#%d,%Q);", - db->aDb[iDb].zName, SCHEMA_TABLE(iDb), - pIndex->zName, - pTab->zName, - iMem, - zStmt - ); - sqlite3DbFree(db, zStmt); - - /* Fill the index with data and reparse the schema. Code an OP_Expire - ** to invalidate all pre-compiled statements. - */ - if( pTblName ){ - sqlite3RefillIndex(pParse, pIndex, iMem); - sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddParseSchemaOp(v, iDb, - sqlite3MPrintf(db, "name='%q' AND type='index'", pIndex->zName)); - sqlite3VdbeAddOp1(v, OP_Expire, 0); - } - } - - /* When adding an index to the list of indices for a table, make - ** sure all indices labeled OE_Replace come after all those labeled - ** OE_Ignore. This is necessary for the correct constraint check - ** processing (in sqlite3GenerateConstraintChecks()) as part of - ** UPDATE and INSERT statements. - */ - if( db->init.busy || pTblName==0 ){ - if( onError!=OE_Replace || pTab->pIndex==0 - || pTab->pIndex->onError==OE_Replace){ - pIndex->pNext = pTab->pIndex; - pTab->pIndex = pIndex; - }else{ - Index *pOther = pTab->pIndex; - while( pOther->pNext && pOther->pNext->onError!=OE_Replace ){ - pOther = pOther->pNext; - } - pIndex->pNext = pOther->pNext; - pOther->pNext = pIndex; - } - pRet = pIndex; - pIndex = 0; - } - - /* Clean up before exiting */ -exit_create_index: - if( pIndex ) freeIndex(db, pIndex); - sqlite3ExprDelete(db, pPIWhere); - sqlite3ExprListDelete(db, pList); - sqlite3SrcListDelete(db, pTblName); - sqlite3DbFree(db, zName); - return pRet; -} - -/* -** Fill the Index.aiRowEst[] array with default information - information -** to be used when we have not run the ANALYZE command. -** -** aiRowEst[0] is suppose to contain the number of elements in the index. -** Since we do not know, guess 1 million. aiRowEst[1] is an estimate of the -** number of rows in the table that match any particular value of the -** first column of the index. aiRowEst[2] is an estimate of the number -** of rows that match any particular combiniation of the first 2 columns -** of the index. And so forth. It must always be the case that -* -** aiRowEst[N]<=aiRowEst[N-1] -** aiRowEst[N]>=1 -** -** Apart from that, we have little to go on besides intuition as to -** how aiRowEst[] should be initialized. The numbers generated here -** are based on typical values found in actual indices. -*/ -SQLITE_PRIVATE void sqlite3DefaultRowEst(Index *pIdx){ - tRowcnt *a = pIdx->aiRowEst; - int i; - tRowcnt n; - assert( a!=0 ); - a[0] = pIdx->pTable->nRowEst; - if( a[0]<10 ) a[0] = 10; - n = 10; - for(i=1; i<=pIdx->nKeyCol; i++){ - a[i] = n; - if( n>5 ) n--; - } - if( pIdx->onError!=OE_None ){ - a[pIdx->nKeyCol] = 1; - } -} - -/* -** This routine will drop an existing named index. This routine -** implements the DROP INDEX statement. -*/ -SQLITE_PRIVATE void sqlite3DropIndex(Parse *pParse, SrcList *pName, int ifExists){ - Index *pIndex; - Vdbe *v; - sqlite3 *db = pParse->db; - int iDb; - - assert( pParse->nErr==0 ); /* Never called with prior errors */ - if( db->mallocFailed ){ - goto exit_drop_index; - } - assert( pName->nSrc==1 ); - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ - goto exit_drop_index; - } - pIndex = sqlite3FindIndex(db, pName->a[0].zName, pName->a[0].zDatabase); - if( pIndex==0 ){ - if( !ifExists ){ - sqlite3ErrorMsg(pParse, "no such index: %S", pName, 0); - }else{ - sqlite3CodeVerifyNamedSchema(pParse, pName->a[0].zDatabase); - } - pParse->checkSchema = 1; - goto exit_drop_index; - } - if( pIndex->autoIndex ){ - sqlite3ErrorMsg(pParse, "index associated with UNIQUE " - "or PRIMARY KEY constraint cannot be dropped", 0); - goto exit_drop_index; - } - iDb = sqlite3SchemaToIndex(db, pIndex->pSchema); -#ifndef SQLITE_OMIT_AUTHORIZATION - { - int code = SQLITE_DROP_INDEX; - Table *pTab = pIndex->pTable; - const char *zDb = db->aDb[iDb].zName; - const char *zTab = SCHEMA_TABLE(iDb); - if( sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ - goto exit_drop_index; - } - if( !OMIT_TEMPDB && iDb ) code = SQLITE_DROP_TEMP_INDEX; - if( sqlite3AuthCheck(pParse, code, pIndex->zName, pTab->zName, zDb) ){ - goto exit_drop_index; - } - } -#endif - - /* Generate code to remove the index and from the master table */ - v = sqlite3GetVdbe(pParse); - if( v ){ - sqlite3BeginWriteOperation(pParse, 1, iDb); - sqlite3NestedParse(pParse, - "DELETE FROM %Q.%s WHERE name=%Q AND type='index'", - db->aDb[iDb].zName, SCHEMA_TABLE(iDb), pIndex->zName - ); - sqlite3ClearStatTables(pParse, iDb, "idx", pIndex->zName); - sqlite3ChangeCookie(pParse, iDb); - destroyRootPage(pParse, pIndex->tnum, iDb); - sqlite3VdbeAddOp4(v, OP_DropIndex, iDb, 0, 0, pIndex->zName, 0); - } - -exit_drop_index: - sqlite3SrcListDelete(db, pName); -} - -/* -** pArray is a pointer to an array of objects. Each object in the -** array is szEntry bytes in size. This routine uses sqlite3DbRealloc() -** to extend the array so that there is space for a new object at the end. -** -** When this function is called, *pnEntry contains the current size of -** the array (in entries - so the allocation is ((*pnEntry) * szEntry) bytes -** in total). -** -** If the realloc() is successful (i.e. if no OOM condition occurs), the -** space allocated for the new object is zeroed, *pnEntry updated to -** reflect the new size of the array and a pointer to the new allocation -** returned. *pIdx is set to the index of the new array entry in this case. -** -** Otherwise, if the realloc() fails, *pIdx is set to -1, *pnEntry remains -** unchanged and a copy of pArray returned. -*/ -SQLITE_PRIVATE void *sqlite3ArrayAllocate( - sqlite3 *db, /* Connection to notify of malloc failures */ - void *pArray, /* Array of objects. Might be reallocated */ - int szEntry, /* Size of each object in the array */ - int *pnEntry, /* Number of objects currently in use */ - int *pIdx /* Write the index of a new slot here */ -){ - char *z; - int n = *pnEntry; - if( (n & (n-1))==0 ){ - int sz = (n==0) ? 1 : 2*n; - void *pNew = sqlite3DbRealloc(db, pArray, sz*szEntry); - if( pNew==0 ){ - *pIdx = -1; - return pArray; - } - pArray = pNew; - } - z = (char*)pArray; - memset(&z[n * szEntry], 0, szEntry); - *pIdx = n; - ++*pnEntry; - return pArray; -} - -/* -** Append a new element to the given IdList. Create a new IdList if -** need be. -** -** A new IdList is returned, or NULL if malloc() fails. -*/ -SQLITE_PRIVATE IdList *sqlite3IdListAppend(sqlite3 *db, IdList *pList, Token *pToken){ - int i; - if( pList==0 ){ - pList = sqlite3DbMallocZero(db, sizeof(IdList) ); - if( pList==0 ) return 0; - } - pList->a = sqlite3ArrayAllocate( - db, - pList->a, - sizeof(pList->a[0]), - &pList->nId, - &i - ); - if( i<0 ){ - sqlite3IdListDelete(db, pList); - return 0; - } - pList->a[i].zName = sqlite3NameFromToken(db, pToken); - return pList; -} - -/* -** Delete an IdList. -*/ -SQLITE_PRIVATE void sqlite3IdListDelete(sqlite3 *db, IdList *pList){ - int i; - if( pList==0 ) return; - for(i=0; inId; i++){ - sqlite3DbFree(db, pList->a[i].zName); - } - sqlite3DbFree(db, pList->a); - sqlite3DbFree(db, pList); -} - -/* -** Return the index in pList of the identifier named zId. Return -1 -** if not found. -*/ -SQLITE_PRIVATE int sqlite3IdListIndex(IdList *pList, const char *zName){ - int i; - if( pList==0 ) return -1; - for(i=0; inId; i++){ - if( sqlite3StrICmp(pList->a[i].zName, zName)==0 ) return i; - } - return -1; -} - -/* -** Expand the space allocated for the given SrcList object by -** creating nExtra new slots beginning at iStart. iStart is zero based. -** New slots are zeroed. -** -** For example, suppose a SrcList initially contains two entries: A,B. -** To append 3 new entries onto the end, do this: -** -** sqlite3SrcListEnlarge(db, pSrclist, 3, 2); -** -** After the call above it would contain: A, B, nil, nil, nil. -** If the iStart argument had been 1 instead of 2, then the result -** would have been: A, nil, nil, nil, B. To prepend the new slots, -** the iStart value would be 0. The result then would -** be: nil, nil, nil, A, B. -** -** If a memory allocation fails the SrcList is unchanged. The -** db->mallocFailed flag will be set to true. -*/ -SQLITE_PRIVATE SrcList *sqlite3SrcListEnlarge( - sqlite3 *db, /* Database connection to notify of OOM errors */ - SrcList *pSrc, /* The SrcList to be enlarged */ - int nExtra, /* Number of new slots to add to pSrc->a[] */ - int iStart /* Index in pSrc->a[] of first new slot */ -){ - int i; - - /* Sanity checking on calling parameters */ - assert( iStart>=0 ); - assert( nExtra>=1 ); - assert( pSrc!=0 ); - assert( iStart<=pSrc->nSrc ); - - /* Allocate additional space if needed */ - if( pSrc->nSrc+nExtra>pSrc->nAlloc ){ - SrcList *pNew; - int nAlloc = pSrc->nSrc+nExtra; - int nGot; - pNew = sqlite3DbRealloc(db, pSrc, - sizeof(*pSrc) + (nAlloc-1)*sizeof(pSrc->a[0]) ); - if( pNew==0 ){ - assert( db->mallocFailed ); - return pSrc; - } - pSrc = pNew; - nGot = (sqlite3DbMallocSize(db, pNew) - sizeof(*pSrc))/sizeof(pSrc->a[0])+1; - pSrc->nAlloc = (u8)nGot; - } - - /* Move existing slots that come after the newly inserted slots - ** out of the way */ - for(i=pSrc->nSrc-1; i>=iStart; i--){ - pSrc->a[i+nExtra] = pSrc->a[i]; - } - pSrc->nSrc += (i8)nExtra; - - /* Zero the newly allocated slots */ - memset(&pSrc->a[iStart], 0, sizeof(pSrc->a[0])*nExtra); - for(i=iStart; ia[i].iCursor = -1; - } - - /* Return a pointer to the enlarged SrcList */ - return pSrc; -} - - -/* -** Append a new table name to the given SrcList. Create a new SrcList if -** need be. A new entry is created in the SrcList even if pTable is NULL. -** -** A SrcList is returned, or NULL if there is an OOM error. The returned -** SrcList might be the same as the SrcList that was input or it might be -** a new one. If an OOM error does occurs, then the prior value of pList -** that is input to this routine is automatically freed. -** -** If pDatabase is not null, it means that the table has an optional -** database name prefix. Like this: "database.table". The pDatabase -** points to the table name and the pTable points to the database name. -** The SrcList.a[].zName field is filled with the table name which might -** come from pTable (if pDatabase is NULL) or from pDatabase. -** SrcList.a[].zDatabase is filled with the database name from pTable, -** or with NULL if no database is specified. -** -** In other words, if call like this: -** -** sqlite3SrcListAppend(D,A,B,0); -** -** Then B is a table name and the database name is unspecified. If called -** like this: -** -** sqlite3SrcListAppend(D,A,B,C); -** -** Then C is the table name and B is the database name. If C is defined -** then so is B. In other words, we never have a case where: -** -** sqlite3SrcListAppend(D,A,0,C); -** -** Both pTable and pDatabase are assumed to be quoted. They are dequoted -** before being added to the SrcList. -*/ -SQLITE_PRIVATE SrcList *sqlite3SrcListAppend( - sqlite3 *db, /* Connection to notify of malloc failures */ - SrcList *pList, /* Append to this SrcList. NULL creates a new SrcList */ - Token *pTable, /* Table to append */ - Token *pDatabase /* Database of the table */ -){ - struct SrcList_item *pItem; - assert( pDatabase==0 || pTable!=0 ); /* Cannot have C without B */ - if( pList==0 ){ - pList = sqlite3DbMallocZero(db, sizeof(SrcList) ); - if( pList==0 ) return 0; - pList->nAlloc = 1; - } - pList = sqlite3SrcListEnlarge(db, pList, 1, pList->nSrc); - if( db->mallocFailed ){ - sqlite3SrcListDelete(db, pList); - return 0; - } - pItem = &pList->a[pList->nSrc-1]; - if( pDatabase && pDatabase->z==0 ){ - pDatabase = 0; - } - if( pDatabase ){ - Token *pTemp = pDatabase; - pDatabase = pTable; - pTable = pTemp; - } - pItem->zName = sqlite3NameFromToken(db, pTable); - pItem->zDatabase = sqlite3NameFromToken(db, pDatabase); - return pList; -} - -/* -** Assign VdbeCursor index numbers to all tables in a SrcList -*/ -SQLITE_PRIVATE void sqlite3SrcListAssignCursors(Parse *pParse, SrcList *pList){ - int i; - struct SrcList_item *pItem; - assert(pList || pParse->db->mallocFailed ); - if( pList ){ - for(i=0, pItem=pList->a; inSrc; i++, pItem++){ - if( pItem->iCursor>=0 ) break; - pItem->iCursor = pParse->nTab++; - if( pItem->pSelect ){ - sqlite3SrcListAssignCursors(pParse, pItem->pSelect->pSrc); - } - } - } -} - -/* -** Delete an entire SrcList including all its substructure. -*/ -SQLITE_PRIVATE void sqlite3SrcListDelete(sqlite3 *db, SrcList *pList){ - int i; - struct SrcList_item *pItem; - if( pList==0 ) return; - for(pItem=pList->a, i=0; inSrc; i++, pItem++){ - sqlite3DbFree(db, pItem->zDatabase); - sqlite3DbFree(db, pItem->zName); - sqlite3DbFree(db, pItem->zAlias); - sqlite3DbFree(db, pItem->zIndex); - sqlite3DeleteTable(db, pItem->pTab); - sqlite3SelectDelete(db, pItem->pSelect); - sqlite3ExprDelete(db, pItem->pOn); - sqlite3IdListDelete(db, pItem->pUsing); - } - sqlite3DbFree(db, pList); -} - -/* -** This routine is called by the parser to add a new term to the -** end of a growing FROM clause. The "p" parameter is the part of -** the FROM clause that has already been constructed. "p" is NULL -** if this is the first term of the FROM clause. pTable and pDatabase -** are the name of the table and database named in the FROM clause term. -** pDatabase is NULL if the database name qualifier is missing - the -** usual case. If the term has a alias, then pAlias points to the -** alias token. If the term is a subquery, then pSubquery is the -** SELECT statement that the subquery encodes. The pTable and -** pDatabase parameters are NULL for subqueries. The pOn and pUsing -** parameters are the content of the ON and USING clauses. -** -** Return a new SrcList which encodes is the FROM with the new -** term added. -*/ -SQLITE_PRIVATE SrcList *sqlite3SrcListAppendFromTerm( - Parse *pParse, /* Parsing context */ - SrcList *p, /* The left part of the FROM clause already seen */ - Token *pTable, /* Name of the table to add to the FROM clause */ - Token *pDatabase, /* Name of the database containing pTable */ - Token *pAlias, /* The right-hand side of the AS subexpression */ - Select *pSubquery, /* A subquery used in place of a table name */ - Expr *pOn, /* The ON clause of a join */ - IdList *pUsing /* The USING clause of a join */ -){ - struct SrcList_item *pItem; - sqlite3 *db = pParse->db; - if( !p && (pOn || pUsing) ){ - sqlite3ErrorMsg(pParse, "a JOIN clause is required before %s", - (pOn ? "ON" : "USING") - ); - goto append_from_error; - } - p = sqlite3SrcListAppend(db, p, pTable, pDatabase); - if( p==0 || NEVER(p->nSrc==0) ){ - goto append_from_error; - } - pItem = &p->a[p->nSrc-1]; - assert( pAlias!=0 ); - if( pAlias->n ){ - pItem->zAlias = sqlite3NameFromToken(db, pAlias); - } - pItem->pSelect = pSubquery; - pItem->pOn = pOn; - pItem->pUsing = pUsing; - return p; - - append_from_error: - assert( p==0 ); - sqlite3ExprDelete(db, pOn); - sqlite3IdListDelete(db, pUsing); - sqlite3SelectDelete(db, pSubquery); - return 0; -} - -/* -** Add an INDEXED BY or NOT INDEXED clause to the most recently added -** element of the source-list passed as the second argument. -*/ -SQLITE_PRIVATE void sqlite3SrcListIndexedBy(Parse *pParse, SrcList *p, Token *pIndexedBy){ - assert( pIndexedBy!=0 ); - if( p && ALWAYS(p->nSrc>0) ){ - struct SrcList_item *pItem = &p->a[p->nSrc-1]; - assert( pItem->notIndexed==0 && pItem->zIndex==0 ); - if( pIndexedBy->n==1 && !pIndexedBy->z ){ - /* A "NOT INDEXED" clause was supplied. See parse.y - ** construct "indexed_opt" for details. */ - pItem->notIndexed = 1; - }else{ - pItem->zIndex = sqlite3NameFromToken(pParse->db, pIndexedBy); - } - } -} - -/* -** When building up a FROM clause in the parser, the join operator -** is initially attached to the left operand. But the code generator -** expects the join operator to be on the right operand. This routine -** Shifts all join operators from left to right for an entire FROM -** clause. -** -** Example: Suppose the join is like this: -** -** A natural cross join B -** -** The operator is "natural cross join". The A and B operands are stored -** in p->a[0] and p->a[1], respectively. The parser initially stores the -** operator with A. This routine shifts that operator over to B. -*/ -SQLITE_PRIVATE void sqlite3SrcListShiftJoinType(SrcList *p){ - if( p ){ - int i; - assert( p->a || p->nSrc==0 ); - for(i=p->nSrc-1; i>0; i--){ - p->a[i].jointype = p->a[i-1].jointype; - } - p->a[0].jointype = 0; - } -} - -/* -** Begin a transaction -*/ -SQLITE_PRIVATE void sqlite3BeginTransaction(Parse *pParse, int type){ - sqlite3 *db; - Vdbe *v; - int i; - - assert( pParse!=0 ); - db = pParse->db; - assert( db!=0 ); -/* if( db->aDb[0].pBt==0 ) return; */ - if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "BEGIN", 0, 0) ){ - return; - } - v = sqlite3GetVdbe(pParse); - if( !v ) return; - if( type!=TK_DEFERRED ){ - for(i=0; inDb; i++){ - sqlite3VdbeAddOp2(v, OP_Transaction, i, (type==TK_EXCLUSIVE)+1); - sqlite3VdbeUsesBtree(v, i); - } - } - sqlite3VdbeAddOp2(v, OP_AutoCommit, 0, 0); -} - -/* -** Commit a transaction -*/ -SQLITE_PRIVATE void sqlite3CommitTransaction(Parse *pParse){ - Vdbe *v; - - assert( pParse!=0 ); - assert( pParse->db!=0 ); - if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "COMMIT", 0, 0) ){ - return; - } - v = sqlite3GetVdbe(pParse); - if( v ){ - sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 0); - } -} - -/* -** Rollback a transaction -*/ -SQLITE_PRIVATE void sqlite3RollbackTransaction(Parse *pParse){ - Vdbe *v; - - assert( pParse!=0 ); - assert( pParse->db!=0 ); - if( sqlite3AuthCheck(pParse, SQLITE_TRANSACTION, "ROLLBACK", 0, 0) ){ - return; - } - v = sqlite3GetVdbe(pParse); - if( v ){ - sqlite3VdbeAddOp2(v, OP_AutoCommit, 1, 1); - } -} - -/* -** This function is called by the parser when it parses a command to create, -** release or rollback an SQL savepoint. -*/ -SQLITE_PRIVATE void sqlite3Savepoint(Parse *pParse, int op, Token *pName){ - char *zName = sqlite3NameFromToken(pParse->db, pName); - if( zName ){ - Vdbe *v = sqlite3GetVdbe(pParse); -#ifndef SQLITE_OMIT_AUTHORIZATION - static const char * const az[] = { "BEGIN", "RELEASE", "ROLLBACK" }; - assert( !SAVEPOINT_BEGIN && SAVEPOINT_RELEASE==1 && SAVEPOINT_ROLLBACK==2 ); -#endif - if( !v || sqlite3AuthCheck(pParse, SQLITE_SAVEPOINT, az[op], zName, 0) ){ - sqlite3DbFree(pParse->db, zName); - return; - } - sqlite3VdbeAddOp4(v, OP_Savepoint, op, 0, 0, zName, P4_DYNAMIC); - } -} - -/* -** Make sure the TEMP database is open and available for use. Return -** the number of errors. Leave any error messages in the pParse structure. -*/ -SQLITE_PRIVATE int sqlite3OpenTempDatabase(Parse *pParse){ - sqlite3 *db = pParse->db; - if( db->aDb[1].pBt==0 && !pParse->explain ){ - int rc; - Btree *pBt; - static const int flags = - SQLITE_OPEN_READWRITE | - SQLITE_OPEN_CREATE | - SQLITE_OPEN_EXCLUSIVE | - SQLITE_OPEN_DELETEONCLOSE | - SQLITE_OPEN_TEMP_DB; - - rc = sqlite3BtreeOpen(db->pVfs, 0, db, &pBt, 0, flags); - if( rc!=SQLITE_OK ){ - sqlite3ErrorMsg(pParse, "unable to open a temporary database " - "file for storing temporary tables"); - pParse->rc = rc; - return 1; - } - db->aDb[1].pBt = pBt; - assert( db->aDb[1].pSchema ); - if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize, -1, 0) ){ - db->mallocFailed = 1; - return 1; - } - } - return 0; -} - -/* -** Generate VDBE code that will verify the schema cookie and start -** a read-transaction for all named database files. -** -** It is important that all schema cookies be verified and all -** read transactions be started before anything else happens in -** the VDBE program. But this routine can be called after much other -** code has been generated. So here is what we do: -** -** The first time this routine is called, we code an OP_Goto that -** will jump to a subroutine at the end of the program. Then we -** record every database that needs its schema verified in the -** pParse->cookieMask field. Later, after all other code has been -** generated, the subroutine that does the cookie verifications and -** starts the transactions will be coded and the OP_Goto P2 value -** will be made to point to that subroutine. The generation of the -** cookie verification subroutine code happens in sqlite3FinishCoding(). -** -** If iDb<0 then code the OP_Goto only - don't set flag to verify the -** schema on any databases. This can be used to position the OP_Goto -** early in the code, before we know if any database tables will be used. -*/ -SQLITE_PRIVATE void sqlite3CodeVerifySchema(Parse *pParse, int iDb){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - -#ifndef SQLITE_OMIT_TRIGGER - if( pToplevel!=pParse ){ - /* This branch is taken if a trigger is currently being coded. In this - ** case, set cookieGoto to a non-zero value to show that this function - ** has been called. This is used by the sqlite3ExprCodeConstants() - ** function. */ - pParse->cookieGoto = -1; - } -#endif - if( pToplevel->cookieGoto==0 ){ - Vdbe *v = sqlite3GetVdbe(pToplevel); - if( v==0 ) return; /* This only happens if there was a prior error */ - pToplevel->cookieGoto = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0)+1; - } - if( iDb>=0 ){ - sqlite3 *db = pToplevel->db; - yDbMask mask; - - assert( iDbnDb ); - assert( db->aDb[iDb].pBt!=0 || iDb==1 ); - assert( iDbcookieMask & mask)==0 ){ - pToplevel->cookieMask |= mask; - pToplevel->cookieValue[iDb] = db->aDb[iDb].pSchema->schema_cookie; - if( !OMIT_TEMPDB && iDb==1 ){ - sqlite3OpenTempDatabase(pToplevel); - } - } - } -} - -/* -** If argument zDb is NULL, then call sqlite3CodeVerifySchema() for each -** attached database. Otherwise, invoke it for the database named zDb only. -*/ -SQLITE_PRIVATE void sqlite3CodeVerifyNamedSchema(Parse *pParse, const char *zDb){ - sqlite3 *db = pParse->db; - int i; - for(i=0; inDb; i++){ - Db *pDb = &db->aDb[i]; - if( pDb->pBt && (!zDb || 0==sqlite3StrICmp(zDb, pDb->zName)) ){ - sqlite3CodeVerifySchema(pParse, i); - } - } -} - -/* -** Generate VDBE code that prepares for doing an operation that -** might change the database. -** -** This routine starts a new transaction if we are not already within -** a transaction. If we are already within a transaction, then a checkpoint -** is set if the setStatement parameter is true. A checkpoint should -** be set for operations that might fail (due to a constraint) part of -** the way through and which will need to undo some writes without having to -** rollback the whole transaction. For operations where all constraints -** can be checked before any changes are made to the database, it is never -** necessary to undo a write and the checkpoint should not be set. -*/ -SQLITE_PRIVATE void sqlite3BeginWriteOperation(Parse *pParse, int setStatement, int iDb){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - sqlite3CodeVerifySchema(pParse, iDb); - pToplevel->writeMask |= ((yDbMask)1)<isMultiWrite |= setStatement; -} - -/* -** Indicate that the statement currently under construction might write -** more than one entry (example: deleting one row then inserting another, -** inserting multiple rows in a table, or inserting a row and index entries.) -** If an abort occurs after some of these writes have completed, then it will -** be necessary to undo the completed writes. -*/ -SQLITE_PRIVATE void sqlite3MultiWrite(Parse *pParse){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - pToplevel->isMultiWrite = 1; -} - -/* -** The code generator calls this routine if is discovers that it is -** possible to abort a statement prior to completion. In order to -** perform this abort without corrupting the database, we need to make -** sure that the statement is protected by a statement transaction. -** -** Technically, we only need to set the mayAbort flag if the -** isMultiWrite flag was previously set. There is a time dependency -** such that the abort must occur after the multiwrite. This makes -** some statements involving the REPLACE conflict resolution algorithm -** go a little faster. But taking advantage of this time dependency -** makes it more difficult to prove that the code is correct (in -** particular, it prevents us from writing an effective -** implementation of sqlite3AssertMayAbort()) and so we have chosen -** to take the safe route and skip the optimization. -*/ -SQLITE_PRIVATE void sqlite3MayAbort(Parse *pParse){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - pToplevel->mayAbort = 1; -} - -/* -** Code an OP_Halt that causes the vdbe to return an SQLITE_CONSTRAINT -** error. The onError parameter determines which (if any) of the statement -** and/or current transaction is rolled back. -*/ -SQLITE_PRIVATE void sqlite3HaltConstraint( - Parse *pParse, /* Parsing context */ - int errCode, /* extended error code */ - int onError, /* Constraint type */ - char *p4, /* Error message */ - i8 p4type, /* P4_STATIC or P4_TRANSIENT */ - u8 p5Errmsg /* P5_ErrMsg type */ -){ - Vdbe *v = sqlite3GetVdbe(pParse); - assert( (errCode&0xff)==SQLITE_CONSTRAINT ); - if( onError==OE_Abort ){ - sqlite3MayAbort(pParse); - } - sqlite3VdbeAddOp4(v, OP_Halt, errCode, onError, 0, p4, p4type); - if( p5Errmsg ) sqlite3VdbeChangeP5(v, p5Errmsg); -} - -/* -** Code an OP_Halt due to UNIQUE or PRIMARY KEY constraint violation. -*/ -SQLITE_PRIVATE void sqlite3UniqueConstraint( - Parse *pParse, /* Parsing context */ - int onError, /* Constraint type */ - Index *pIdx /* The index that triggers the constraint */ -){ - char *zErr; - int j; - StrAccum errMsg; - Table *pTab = pIdx->pTable; - - sqlite3StrAccumInit(&errMsg, 0, 0, 200); - errMsg.db = pParse->db; - for(j=0; jnKeyCol; j++){ - char *zCol = pTab->aCol[pIdx->aiColumn[j]].zName; - if( j ) sqlite3StrAccumAppend(&errMsg, ", ", 2); - sqlite3StrAccumAppendAll(&errMsg, pTab->zName); - sqlite3StrAccumAppend(&errMsg, ".", 1); - sqlite3StrAccumAppendAll(&errMsg, zCol); - } - zErr = sqlite3StrAccumFinish(&errMsg); - sqlite3HaltConstraint(pParse, - (pIdx->autoIndex==2)?SQLITE_CONSTRAINT_PRIMARYKEY:SQLITE_CONSTRAINT_UNIQUE, - onError, zErr, P4_DYNAMIC, P5_ConstraintUnique); -} - - -/* -** Code an OP_Halt due to non-unique rowid. -*/ -SQLITE_PRIVATE void sqlite3RowidConstraint( - Parse *pParse, /* Parsing context */ - int onError, /* Conflict resolution algorithm */ - Table *pTab /* The table with the non-unique rowid */ -){ - char *zMsg; - int rc; - if( pTab->iPKey>=0 ){ - zMsg = sqlite3MPrintf(pParse->db, "%s.%s", pTab->zName, - pTab->aCol[pTab->iPKey].zName); - rc = SQLITE_CONSTRAINT_PRIMARYKEY; - }else{ - zMsg = sqlite3MPrintf(pParse->db, "%s.rowid", pTab->zName); - rc = SQLITE_CONSTRAINT_ROWID; - } - sqlite3HaltConstraint(pParse, rc, onError, zMsg, P4_DYNAMIC, - P5_ConstraintUnique); -} - -/* -** Check to see if pIndex uses the collating sequence pColl. Return -** true if it does and false if it does not. -*/ -#ifndef SQLITE_OMIT_REINDEX -static int collationMatch(const char *zColl, Index *pIndex){ - int i; - assert( zColl!=0 ); - for(i=0; inColumn; i++){ - const char *z = pIndex->azColl[i]; - assert( z!=0 || pIndex->aiColumn[i]<0 ); - if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){ - return 1; - } - } - return 0; -} -#endif - -/* -** Recompute all indices of pTab that use the collating sequence pColl. -** If pColl==0 then recompute all indices of pTab. -*/ -#ifndef SQLITE_OMIT_REINDEX -static void reindexTable(Parse *pParse, Table *pTab, char const *zColl){ - Index *pIndex; /* An index associated with pTab */ - - for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){ - if( zColl==0 || collationMatch(zColl, pIndex) ){ - int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3RefillIndex(pParse, pIndex, -1); - } - } -} -#endif - -/* -** Recompute all indices of all tables in all databases where the -** indices use the collating sequence pColl. If pColl==0 then recompute -** all indices everywhere. -*/ -#ifndef SQLITE_OMIT_REINDEX -static void reindexDatabases(Parse *pParse, char const *zColl){ - Db *pDb; /* A single database */ - int iDb; /* The database index number */ - sqlite3 *db = pParse->db; /* The database connection */ - HashElem *k; /* For looping over tables in pDb */ - Table *pTab; /* A table in the database */ - - assert( sqlite3BtreeHoldsAllMutexes(db) ); /* Needed for schema access */ - for(iDb=0, pDb=db->aDb; iDbnDb; iDb++, pDb++){ - assert( pDb!=0 ); - for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){ - pTab = (Table*)sqliteHashData(k); - reindexTable(pParse, pTab, zColl); - } - } -} -#endif - -/* -** Generate code for the REINDEX command. -** -** REINDEX -- 1 -** REINDEX -- 2 -** REINDEX ?.? -- 3 -** REINDEX ?.? -- 4 -** -** Form 1 causes all indices in all attached databases to be rebuilt. -** Form 2 rebuilds all indices in all databases that use the named -** collating function. Forms 3 and 4 rebuild the named index or all -** indices associated with the named table. -*/ -#ifndef SQLITE_OMIT_REINDEX -SQLITE_PRIVATE void sqlite3Reindex(Parse *pParse, Token *pName1, Token *pName2){ - CollSeq *pColl; /* Collating sequence to be reindexed, or NULL */ - char *z; /* Name of a table or index */ - const char *zDb; /* Name of the database */ - Table *pTab; /* A table in the database */ - Index *pIndex; /* An index associated with pTab */ - int iDb; /* The database index number */ - sqlite3 *db = pParse->db; /* The database connection */ - Token *pObjName; /* Name of the table or index to be reindexed */ - - /* Read the database schema. If an error occurs, leave an error message - ** and code in pParse and return NULL. */ - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ - return; - } - - if( pName1==0 ){ - reindexDatabases(pParse, 0); - return; - }else if( NEVER(pName2==0) || pName2->z==0 ){ - char *zColl; - assert( pName1->z ); - zColl = sqlite3NameFromToken(pParse->db, pName1); - if( !zColl ) return; - pColl = sqlite3FindCollSeq(db, ENC(db), zColl, 0); - if( pColl ){ - reindexDatabases(pParse, zColl); - sqlite3DbFree(db, zColl); - return; - } - sqlite3DbFree(db, zColl); - } - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pObjName); - if( iDb<0 ) return; - z = sqlite3NameFromToken(db, pObjName); - if( z==0 ) return; - zDb = db->aDb[iDb].zName; - pTab = sqlite3FindTable(db, z, zDb); - if( pTab ){ - reindexTable(pParse, pTab, 0); - sqlite3DbFree(db, z); - return; - } - pIndex = sqlite3FindIndex(db, z, zDb); - sqlite3DbFree(db, z); - if( pIndex ){ - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3RefillIndex(pParse, pIndex, -1); - return; - } - sqlite3ErrorMsg(pParse, "unable to identify the object to be reindexed"); -} -#endif - -/* -** Return a KeyInfo structure that is appropriate for the given Index. -** -** The KeyInfo structure for an index is cached in the Index object. -** So there might be multiple references to the returned pointer. The -** caller should not try to modify the KeyInfo object. -** -** The caller should invoke sqlite3KeyInfoUnref() on the returned object -** when it has finished using it. -*/ -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoOfIndex(Parse *pParse, Index *pIdx){ - if( pParse->nErr ) return 0; -#ifndef SQLITE_OMIT_SHARED_CACHE - if( pIdx->pKeyInfo && pIdx->pKeyInfo->db!=pParse->db ){ - sqlite3KeyInfoUnref(pIdx->pKeyInfo); - pIdx->pKeyInfo = 0; - } -#endif - if( pIdx->pKeyInfo==0 ){ - int i; - int nCol = pIdx->nColumn; - int nKey = pIdx->nKeyCol; - KeyInfo *pKey; - if( pIdx->uniqNotNull ){ - pKey = sqlite3KeyInfoAlloc(pParse->db, nKey, nCol-nKey); - }else{ - pKey = sqlite3KeyInfoAlloc(pParse->db, nCol, 0); - } - if( pKey ){ - assert( sqlite3KeyInfoIsWriteable(pKey) ); - for(i=0; iazColl[i]; - assert( zColl!=0 ); - pKey->aColl[i] = strcmp(zColl,"BINARY")==0 ? 0 : - sqlite3LocateCollSeq(pParse, zColl); - pKey->aSortOrder[i] = pIdx->aSortOrder[i]; - } - if( pParse->nErr ){ - sqlite3KeyInfoUnref(pKey); - }else{ - pIdx->pKeyInfo = pKey; - } - } - } - return sqlite3KeyInfoRef(pIdx->pKeyInfo); -} - -#ifndef SQLITE_OMIT_CTE -/* -** This routine is invoked once per CTE by the parser while parsing a -** WITH clause. -*/ -SQLITE_PRIVATE With *sqlite3WithAdd( - Parse *pParse, /* Parsing context */ - With *pWith, /* Existing WITH clause, or NULL */ - Token *pName, /* Name of the common-table */ - ExprList *pArglist, /* Optional column name list for the table */ - Select *pQuery /* Query used to initialize the table */ -){ - sqlite3 *db = pParse->db; - With *pNew; - char *zName; - - /* Check that the CTE name is unique within this WITH clause. If - ** not, store an error in the Parse structure. */ - zName = sqlite3NameFromToken(pParse->db, pName); - if( zName && pWith ){ - int i; - for(i=0; inCte; i++){ - if( sqlite3StrICmp(zName, pWith->a[i].zName)==0 ){ - sqlite3ErrorMsg(pParse, "duplicate WITH table name: %s", zName); - } - } - } - - if( pWith ){ - int nByte = sizeof(*pWith) + (sizeof(pWith->a[1]) * pWith->nCte); - pNew = sqlite3DbRealloc(db, pWith, nByte); - }else{ - pNew = sqlite3DbMallocZero(db, sizeof(*pWith)); - } - assert( zName!=0 || pNew==0 ); - assert( db->mallocFailed==0 || pNew==0 ); - - if( pNew==0 ){ - sqlite3ExprListDelete(db, pArglist); - sqlite3SelectDelete(db, pQuery); - sqlite3DbFree(db, zName); - pNew = pWith; - }else{ - pNew->a[pNew->nCte].pSelect = pQuery; - pNew->a[pNew->nCte].pCols = pArglist; - pNew->a[pNew->nCte].zName = zName; - pNew->a[pNew->nCte].zErr = 0; - pNew->nCte++; - } - - return pNew; -} - -/* -** Free the contents of the With object passed as the second argument. -*/ -SQLITE_PRIVATE void sqlite3WithDelete(sqlite3 *db, With *pWith){ - if( pWith ){ - int i; - for(i=0; inCte; i++){ - struct Cte *pCte = &pWith->a[i]; - sqlite3ExprListDelete(db, pCte->pCols); - sqlite3SelectDelete(db, pCte->pSelect); - sqlite3DbFree(db, pCte->zName); - } - sqlite3DbFree(db, pWith); - } -} -#endif /* !defined(SQLITE_OMIT_CTE) */ - -/************** End of build.c ***********************************************/ -/************** Begin file callback.c ****************************************/ -/* -** 2005 May 23 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains functions used to access the internal hash tables -** of user defined functions and collation sequences. -*/ - - -/* -** Invoke the 'collation needed' callback to request a collation sequence -** in the encoding enc of name zName, length nName. -*/ -static void callCollNeeded(sqlite3 *db, int enc, const char *zName){ - assert( !db->xCollNeeded || !db->xCollNeeded16 ); - if( db->xCollNeeded ){ - char *zExternal = sqlite3DbStrDup(db, zName); - if( !zExternal ) return; - db->xCollNeeded(db->pCollNeededArg, db, enc, zExternal); - sqlite3DbFree(db, zExternal); - } -#ifndef SQLITE_OMIT_UTF16 - if( db->xCollNeeded16 ){ - char const *zExternal; - sqlite3_value *pTmp = sqlite3ValueNew(db); - sqlite3ValueSetStr(pTmp, -1, zName, SQLITE_UTF8, SQLITE_STATIC); - zExternal = sqlite3ValueText(pTmp, SQLITE_UTF16NATIVE); - if( zExternal ){ - db->xCollNeeded16(db->pCollNeededArg, db, (int)ENC(db), zExternal); - } - sqlite3ValueFree(pTmp); - } -#endif -} - -/* -** This routine is called if the collation factory fails to deliver a -** collation function in the best encoding but there may be other versions -** of this collation function (for other text encodings) available. Use one -** of these instead if they exist. Avoid a UTF-8 <-> UTF-16 conversion if -** possible. -*/ -static int synthCollSeq(sqlite3 *db, CollSeq *pColl){ - CollSeq *pColl2; - char *z = pColl->zName; - int i; - static const u8 aEnc[] = { SQLITE_UTF16BE, SQLITE_UTF16LE, SQLITE_UTF8 }; - for(i=0; i<3; i++){ - pColl2 = sqlite3FindCollSeq(db, aEnc[i], z, 0); - if( pColl2->xCmp!=0 ){ - memcpy(pColl, pColl2, sizeof(CollSeq)); - pColl->xDel = 0; /* Do not copy the destructor */ - return SQLITE_OK; - } - } - return SQLITE_ERROR; -} - -/* -** This function is responsible for invoking the collation factory callback -** or substituting a collation sequence of a different encoding when the -** requested collation sequence is not available in the desired encoding. -** -** If it is not NULL, then pColl must point to the database native encoding -** collation sequence with name zName, length nName. -** -** The return value is either the collation sequence to be used in database -** db for collation type name zName, length nName, or NULL, if no collation -** sequence can be found. If no collation is found, leave an error message. -** -** See also: sqlite3LocateCollSeq(), sqlite3FindCollSeq() -*/ -SQLITE_PRIVATE CollSeq *sqlite3GetCollSeq( - Parse *pParse, /* Parsing context */ - u8 enc, /* The desired encoding for the collating sequence */ - CollSeq *pColl, /* Collating sequence with native encoding, or NULL */ - const char *zName /* Collating sequence name */ -){ - CollSeq *p; - sqlite3 *db = pParse->db; - - p = pColl; - if( !p ){ - p = sqlite3FindCollSeq(db, enc, zName, 0); - } - if( !p || !p->xCmp ){ - /* No collation sequence of this type for this encoding is registered. - ** Call the collation factory to see if it can supply us with one. - */ - callCollNeeded(db, enc, zName); - p = sqlite3FindCollSeq(db, enc, zName, 0); - } - if( p && !p->xCmp && synthCollSeq(db, p) ){ - p = 0; - } - assert( !p || p->xCmp ); - if( p==0 ){ - sqlite3ErrorMsg(pParse, "no such collation sequence: %s", zName); - } - return p; -} - -/* -** This routine is called on a collation sequence before it is used to -** check that it is defined. An undefined collation sequence exists when -** a database is loaded that contains references to collation sequences -** that have not been defined by sqlite3_create_collation() etc. -** -** If required, this routine calls the 'collation needed' callback to -** request a definition of the collating sequence. If this doesn't work, -** an equivalent collating sequence that uses a text encoding different -** from the main database is substituted, if one is available. -*/ -SQLITE_PRIVATE int sqlite3CheckCollSeq(Parse *pParse, CollSeq *pColl){ - if( pColl ){ - const char *zName = pColl->zName; - sqlite3 *db = pParse->db; - CollSeq *p = sqlite3GetCollSeq(pParse, ENC(db), pColl, zName); - if( !p ){ - return SQLITE_ERROR; - } - assert( p==pColl ); - } - return SQLITE_OK; -} - - - -/* -** Locate and return an entry from the db.aCollSeq hash table. If the entry -** specified by zName and nName is not found and parameter 'create' is -** true, then create a new entry. Otherwise return NULL. -** -** Each pointer stored in the sqlite3.aCollSeq hash table contains an -** array of three CollSeq structures. The first is the collation sequence -** prefferred for UTF-8, the second UTF-16le, and the third UTF-16be. -** -** Stored immediately after the three collation sequences is a copy of -** the collation sequence name. A pointer to this string is stored in -** each collation sequence structure. -*/ -static CollSeq *findCollSeqEntry( - sqlite3 *db, /* Database connection */ - const char *zName, /* Name of the collating sequence */ - int create /* Create a new entry if true */ -){ - CollSeq *pColl; - int nName = sqlite3Strlen30(zName); - pColl = sqlite3HashFind(&db->aCollSeq, zName, nName); - - if( 0==pColl && create ){ - pColl = sqlite3DbMallocZero(db, 3*sizeof(*pColl) + nName + 1 ); - if( pColl ){ - CollSeq *pDel = 0; - pColl[0].zName = (char*)&pColl[3]; - pColl[0].enc = SQLITE_UTF8; - pColl[1].zName = (char*)&pColl[3]; - pColl[1].enc = SQLITE_UTF16LE; - pColl[2].zName = (char*)&pColl[3]; - pColl[2].enc = SQLITE_UTF16BE; - memcpy(pColl[0].zName, zName, nName); - pColl[0].zName[nName] = 0; - pDel = sqlite3HashInsert(&db->aCollSeq, pColl[0].zName, nName, pColl); - - /* If a malloc() failure occurred in sqlite3HashInsert(), it will - ** return the pColl pointer to be deleted (because it wasn't added - ** to the hash table). - */ - assert( pDel==0 || pDel==pColl ); - if( pDel!=0 ){ - db->mallocFailed = 1; - sqlite3DbFree(db, pDel); - pColl = 0; - } - } - } - return pColl; -} - -/* -** Parameter zName points to a UTF-8 encoded string nName bytes long. -** Return the CollSeq* pointer for the collation sequence named zName -** for the encoding 'enc' from the database 'db'. -** -** If the entry specified is not found and 'create' is true, then create a -** new entry. Otherwise return NULL. -** -** A separate function sqlite3LocateCollSeq() is a wrapper around -** this routine. sqlite3LocateCollSeq() invokes the collation factory -** if necessary and generates an error message if the collating sequence -** cannot be found. -** -** See also: sqlite3LocateCollSeq(), sqlite3GetCollSeq() -*/ -SQLITE_PRIVATE CollSeq *sqlite3FindCollSeq( - sqlite3 *db, - u8 enc, - const char *zName, - int create -){ - CollSeq *pColl; - if( zName ){ - pColl = findCollSeqEntry(db, zName, create); - }else{ - pColl = db->pDfltColl; - } - assert( SQLITE_UTF8==1 && SQLITE_UTF16LE==2 && SQLITE_UTF16BE==3 ); - assert( enc>=SQLITE_UTF8 && enc<=SQLITE_UTF16BE ); - if( pColl ) pColl += enc-1; - return pColl; -} - -/* During the search for the best function definition, this procedure -** is called to test how well the function passed as the first argument -** matches the request for a function with nArg arguments in a system -** that uses encoding enc. The value returned indicates how well the -** request is matched. A higher value indicates a better match. -** -** If nArg is -1 that means to only return a match (non-zero) if p->nArg -** is also -1. In other words, we are searching for a function that -** takes a variable number of arguments. -** -** If nArg is -2 that means that we are searching for any function -** regardless of the number of arguments it uses, so return a positive -** match score for any -** -** The returned value is always between 0 and 6, as follows: -** -** 0: Not a match. -** 1: UTF8/16 conversion required and function takes any number of arguments. -** 2: UTF16 byte order change required and function takes any number of args. -** 3: encoding matches and function takes any number of arguments -** 4: UTF8/16 conversion required - argument count matches exactly -** 5: UTF16 byte order conversion required - argument count matches exactly -** 6: Perfect match: encoding and argument count match exactly. -** -** If nArg==(-2) then any function with a non-null xStep or xFunc is -** a perfect match and any function with both xStep and xFunc NULL is -** a non-match. -*/ -#define FUNC_PERFECT_MATCH 6 /* The score for a perfect match */ -static int matchQuality( - FuncDef *p, /* The function we are evaluating for match quality */ - int nArg, /* Desired number of arguments. (-1)==any */ - u8 enc /* Desired text encoding */ -){ - int match; - - /* nArg of -2 is a special case */ - if( nArg==(-2) ) return (p->xFunc==0 && p->xStep==0) ? 0 : FUNC_PERFECT_MATCH; - - /* Wrong number of arguments means "no match" */ - if( p->nArg!=nArg && p->nArg>=0 ) return 0; - - /* Give a better score to a function with a specific number of arguments - ** than to function that accepts any number of arguments. */ - if( p->nArg==nArg ){ - match = 4; - }else{ - match = 1; - } - - /* Bonus points if the text encoding matches */ - if( enc==(p->funcFlags & SQLITE_FUNC_ENCMASK) ){ - match += 2; /* Exact encoding match */ - }else if( (enc & p->funcFlags & 2)!=0 ){ - match += 1; /* Both are UTF16, but with different byte orders */ - } - - return match; -} - -/* -** Search a FuncDefHash for a function with the given name. Return -** a pointer to the matching FuncDef if found, or 0 if there is no match. -*/ -static FuncDef *functionSearch( - FuncDefHash *pHash, /* Hash table to search */ - int h, /* Hash of the name */ - const char *zFunc, /* Name of function */ - int nFunc /* Number of bytes in zFunc */ -){ - FuncDef *p; - for(p=pHash->a[h]; p; p=p->pHash){ - if( sqlite3StrNICmp(p->zName, zFunc, nFunc)==0 && p->zName[nFunc]==0 ){ - return p; - } - } - return 0; -} - -/* -** Insert a new FuncDef into a FuncDefHash hash table. -*/ -SQLITE_PRIVATE void sqlite3FuncDefInsert( - FuncDefHash *pHash, /* The hash table into which to insert */ - FuncDef *pDef /* The function definition to insert */ -){ - FuncDef *pOther; - int nName = sqlite3Strlen30(pDef->zName); - u8 c1 = (u8)pDef->zName[0]; - int h = (sqlite3UpperToLower[c1] + nName) % ArraySize(pHash->a); - pOther = functionSearch(pHash, h, pDef->zName, nName); - if( pOther ){ - assert( pOther!=pDef && pOther->pNext!=pDef ); - pDef->pNext = pOther->pNext; - pOther->pNext = pDef; - }else{ - pDef->pNext = 0; - pDef->pHash = pHash->a[h]; - pHash->a[h] = pDef; - } -} - - - -/* -** Locate a user function given a name, a number of arguments and a flag -** indicating whether the function prefers UTF-16 over UTF-8. Return a -** pointer to the FuncDef structure that defines that function, or return -** NULL if the function does not exist. -** -** If the createFlag argument is true, then a new (blank) FuncDef -** structure is created and liked into the "db" structure if a -** no matching function previously existed. -** -** If nArg is -2, then the first valid function found is returned. A -** function is valid if either xFunc or xStep is non-zero. The nArg==(-2) -** case is used to see if zName is a valid function name for some number -** of arguments. If nArg is -2, then createFlag must be 0. -** -** If createFlag is false, then a function with the required name and -** number of arguments may be returned even if the eTextRep flag does not -** match that requested. -*/ -SQLITE_PRIVATE FuncDef *sqlite3FindFunction( - sqlite3 *db, /* An open database */ - const char *zName, /* Name of the function. Not null-terminated */ - int nName, /* Number of characters in the name */ - int nArg, /* Number of arguments. -1 means any number */ - u8 enc, /* Preferred text encoding */ - u8 createFlag /* Create new entry if true and does not otherwise exist */ -){ - FuncDef *p; /* Iterator variable */ - FuncDef *pBest = 0; /* Best match found so far */ - int bestScore = 0; /* Score of best match */ - int h; /* Hash value */ - - assert( nArg>=(-2) ); - assert( nArg>=(-1) || createFlag==0 ); - h = (sqlite3UpperToLower[(u8)zName[0]] + nName) % ArraySize(db->aFunc.a); - - /* First search for a match amongst the application-defined functions. - */ - p = functionSearch(&db->aFunc, h, zName, nName); - while( p ){ - int score = matchQuality(p, nArg, enc); - if( score>bestScore ){ - pBest = p; - bestScore = score; - } - p = p->pNext; - } - - /* If no match is found, search the built-in functions. - ** - ** If the SQLITE_PreferBuiltin flag is set, then search the built-in - ** functions even if a prior app-defined function was found. And give - ** priority to built-in functions. - ** - ** Except, if createFlag is true, that means that we are trying to - ** install a new function. Whatever FuncDef structure is returned it will - ** have fields overwritten with new information appropriate for the - ** new function. But the FuncDefs for built-in functions are read-only. - ** So we must not search for built-ins when creating a new function. - */ - if( !createFlag && (pBest==0 || (db->flags & SQLITE_PreferBuiltin)!=0) ){ - FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions); - bestScore = 0; - p = functionSearch(pHash, h, zName, nName); - while( p ){ - int score = matchQuality(p, nArg, enc); - if( score>bestScore ){ - pBest = p; - bestScore = score; - } - p = p->pNext; - } - } - - /* If the createFlag parameter is true and the search did not reveal an - ** exact match for the name, number of arguments and encoding, then add a - ** new entry to the hash table and return it. - */ - if( createFlag && bestScorezName = (char *)&pBest[1]; - pBest->nArg = (u16)nArg; - pBest->funcFlags = enc; - memcpy(pBest->zName, zName, nName); - pBest->zName[nName] = 0; - sqlite3FuncDefInsert(&db->aFunc, pBest); - } - - if( pBest && (pBest->xStep || pBest->xFunc || createFlag) ){ - return pBest; - } - return 0; -} - -/* -** Free all resources held by the schema structure. The void* argument points -** at a Schema struct. This function does not call sqlite3DbFree(db, ) on the -** pointer itself, it just cleans up subsidiary resources (i.e. the contents -** of the schema hash tables). -** -** The Schema.cache_size variable is not cleared. -*/ -SQLITE_PRIVATE void sqlite3SchemaClear(void *p){ - Hash temp1; - Hash temp2; - HashElem *pElem; - Schema *pSchema = (Schema *)p; - - temp1 = pSchema->tblHash; - temp2 = pSchema->trigHash; - sqlite3HashInit(&pSchema->trigHash); - sqlite3HashClear(&pSchema->idxHash); - for(pElem=sqliteHashFirst(&temp2); pElem; pElem=sqliteHashNext(pElem)){ - sqlite3DeleteTrigger(0, (Trigger*)sqliteHashData(pElem)); - } - sqlite3HashClear(&temp2); - sqlite3HashInit(&pSchema->tblHash); - for(pElem=sqliteHashFirst(&temp1); pElem; pElem=sqliteHashNext(pElem)){ - Table *pTab = sqliteHashData(pElem); - sqlite3DeleteTable(0, pTab); - } - sqlite3HashClear(&temp1); - sqlite3HashClear(&pSchema->fkeyHash); - pSchema->pSeqTab = 0; - if( pSchema->flags & DB_SchemaLoaded ){ - pSchema->iGeneration++; - pSchema->flags &= ~DB_SchemaLoaded; - } -} - -/* -** Find and return the schema associated with a BTree. Create -** a new one if necessary. -*/ -SQLITE_PRIVATE Schema *sqlite3SchemaGet(sqlite3 *db, Btree *pBt){ - Schema * p; - if( pBt ){ - p = (Schema *)sqlite3BtreeSchema(pBt, sizeof(Schema), sqlite3SchemaClear); - }else{ - p = (Schema *)sqlite3DbMallocZero(0, sizeof(Schema)); - } - if( !p ){ - db->mallocFailed = 1; - }else if ( 0==p->file_format ){ - sqlite3HashInit(&p->tblHash); - sqlite3HashInit(&p->idxHash); - sqlite3HashInit(&p->trigHash); - sqlite3HashInit(&p->fkeyHash); - p->enc = SQLITE_UTF8; - } - return p; -} - -/************** End of callback.c ********************************************/ -/************** Begin file delete.c ******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains C code routines that are called by the parser -** in order to generate code for DELETE FROM statements. -*/ - -/* -** While a SrcList can in general represent multiple tables and subqueries -** (as in the FROM clause of a SELECT statement) in this case it contains -** the name of a single table, as one might find in an INSERT, DELETE, -** or UPDATE statement. Look up that table in the symbol table and -** return a pointer. Set an error message and return NULL if the table -** name is not found or if any other error occurs. -** -** The following fields are initialized appropriate in pSrc: -** -** pSrc->a[0].pTab Pointer to the Table object -** pSrc->a[0].pIndex Pointer to the INDEXED BY index, if there is one -** -*/ -SQLITE_PRIVATE Table *sqlite3SrcListLookup(Parse *pParse, SrcList *pSrc){ - struct SrcList_item *pItem = pSrc->a; - Table *pTab; - assert( pItem && pSrc->nSrc==1 ); - pTab = sqlite3LocateTableItem(pParse, 0, pItem); - sqlite3DeleteTable(pParse->db, pItem->pTab); - pItem->pTab = pTab; - if( pTab ){ - pTab->nRef++; - } - if( sqlite3IndexedByLookup(pParse, pItem) ){ - pTab = 0; - } - return pTab; -} - -/* -** Check to make sure the given table is writable. If it is not -** writable, generate an error message and return 1. If it is -** writable return 0; -*/ -SQLITE_PRIVATE int sqlite3IsReadOnly(Parse *pParse, Table *pTab, int viewOk){ - /* A table is not writable under the following circumstances: - ** - ** 1) It is a virtual table and no implementation of the xUpdate method - ** has been provided, or - ** 2) It is a system table (i.e. sqlite_master), this call is not - ** part of a nested parse and writable_schema pragma has not - ** been specified. - ** - ** In either case leave an error message in pParse and return non-zero. - */ - if( ( IsVirtual(pTab) - && sqlite3GetVTable(pParse->db, pTab)->pMod->pModule->xUpdate==0 ) - || ( (pTab->tabFlags & TF_Readonly)!=0 - && (pParse->db->flags & SQLITE_WriteSchema)==0 - && pParse->nested==0 ) - ){ - sqlite3ErrorMsg(pParse, "table %s may not be modified", pTab->zName); - return 1; - } - -#ifndef SQLITE_OMIT_VIEW - if( !viewOk && pTab->pSelect ){ - sqlite3ErrorMsg(pParse,"cannot modify %s because it is a view",pTab->zName); - return 1; - } -#endif - return 0; -} - - -#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) -/* -** Evaluate a view and store its result in an ephemeral table. The -** pWhere argument is an optional WHERE clause that restricts the -** set of rows in the view that are to be added to the ephemeral table. -*/ -SQLITE_PRIVATE void sqlite3MaterializeView( - Parse *pParse, /* Parsing context */ - Table *pView, /* View definition */ - Expr *pWhere, /* Optional WHERE clause to be added */ - int iCur /* Cursor number for ephemerial table */ -){ - SelectDest dest; - Select *pSel; - SrcList *pFrom; - sqlite3 *db = pParse->db; - int iDb = sqlite3SchemaToIndex(db, pView->pSchema); - - pWhere = sqlite3ExprDup(db, pWhere, 0); - pFrom = sqlite3SrcListAppend(db, 0, 0, 0); - - if( pFrom ){ - assert( pFrom->nSrc==1 ); - pFrom->a[0].zName = sqlite3DbStrDup(db, pView->zName); - pFrom->a[0].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zName); - assert( pFrom->a[0].pOn==0 ); - assert( pFrom->a[0].pUsing==0 ); - } - - pSel = sqlite3SelectNew(pParse, 0, pFrom, pWhere, 0, 0, 0, 0, 0, 0); - if( pSel ) pSel->selFlags |= SF_Materialize; - - sqlite3SelectDestInit(&dest, SRT_EphemTab, iCur); - sqlite3Select(pParse, pSel, &dest); - sqlite3SelectDelete(db, pSel); -} -#endif /* !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) */ - -#if defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) && !defined(SQLITE_OMIT_SUBQUERY) -/* -** Generate an expression tree to implement the WHERE, ORDER BY, -** and LIMIT/OFFSET portion of DELETE and UPDATE statements. -** -** DELETE FROM table_wxyz WHERE a<5 ORDER BY a LIMIT 1; -** \__________________________/ -** pLimitWhere (pInClause) -*/ -SQLITE_PRIVATE Expr *sqlite3LimitWhere( - Parse *pParse, /* The parser context */ - SrcList *pSrc, /* the FROM clause -- which tables to scan */ - Expr *pWhere, /* The WHERE clause. May be null */ - ExprList *pOrderBy, /* The ORDER BY clause. May be null */ - Expr *pLimit, /* The LIMIT clause. May be null */ - Expr *pOffset, /* The OFFSET clause. May be null */ - char *zStmtType /* Either DELETE or UPDATE. For err msgs. */ -){ - Expr *pWhereRowid = NULL; /* WHERE rowid .. */ - Expr *pInClause = NULL; /* WHERE rowid IN ( select ) */ - Expr *pSelectRowid = NULL; /* SELECT rowid ... */ - ExprList *pEList = NULL; /* Expression list contaning only pSelectRowid */ - SrcList *pSelectSrc = NULL; /* SELECT rowid FROM x ... (dup of pSrc) */ - Select *pSelect = NULL; /* Complete SELECT tree */ - - /* Check that there isn't an ORDER BY without a LIMIT clause. - */ - if( pOrderBy && (pLimit == 0) ) { - sqlite3ErrorMsg(pParse, "ORDER BY without LIMIT on %s", zStmtType); - goto limit_where_cleanup_2; - } - - /* We only need to generate a select expression if there - ** is a limit/offset term to enforce. - */ - if( pLimit == 0 ) { - /* if pLimit is null, pOffset will always be null as well. */ - assert( pOffset == 0 ); - return pWhere; - } - - /* Generate a select expression tree to enforce the limit/offset - ** term for the DELETE or UPDATE statement. For example: - ** DELETE FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1 - ** becomes: - ** DELETE FROM table_a WHERE rowid IN ( - ** SELECT rowid FROM table_a WHERE col1=1 ORDER BY col2 LIMIT 1 OFFSET 1 - ** ); - */ - - pSelectRowid = sqlite3PExpr(pParse, TK_ROW, 0, 0, 0); - if( pSelectRowid == 0 ) goto limit_where_cleanup_2; - pEList = sqlite3ExprListAppend(pParse, 0, pSelectRowid); - if( pEList == 0 ) goto limit_where_cleanup_2; - - /* duplicate the FROM clause as it is needed by both the DELETE/UPDATE tree - ** and the SELECT subtree. */ - pSelectSrc = sqlite3SrcListDup(pParse->db, pSrc, 0); - if( pSelectSrc == 0 ) { - sqlite3ExprListDelete(pParse->db, pEList); - goto limit_where_cleanup_2; - } - - /* generate the SELECT expression tree. */ - pSelect = sqlite3SelectNew(pParse,pEList,pSelectSrc,pWhere,0,0, - pOrderBy,0,pLimit,pOffset); - if( pSelect == 0 ) return 0; - - /* now generate the new WHERE rowid IN clause for the DELETE/UDPATE */ - pWhereRowid = sqlite3PExpr(pParse, TK_ROW, 0, 0, 0); - if( pWhereRowid == 0 ) goto limit_where_cleanup_1; - pInClause = sqlite3PExpr(pParse, TK_IN, pWhereRowid, 0, 0); - if( pInClause == 0 ) goto limit_where_cleanup_1; - - pInClause->x.pSelect = pSelect; - pInClause->flags |= EP_xIsSelect; - sqlite3ExprSetHeight(pParse, pInClause); - return pInClause; - - /* something went wrong. clean up anything allocated. */ -limit_where_cleanup_1: - sqlite3SelectDelete(pParse->db, pSelect); - return 0; - -limit_where_cleanup_2: - sqlite3ExprDelete(pParse->db, pWhere); - sqlite3ExprListDelete(pParse->db, pOrderBy); - sqlite3ExprDelete(pParse->db, pLimit); - sqlite3ExprDelete(pParse->db, pOffset); - return 0; -} -#endif /* defined(SQLITE_ENABLE_UPDATE_DELETE_LIMIT) */ - /* && !defined(SQLITE_OMIT_SUBQUERY) */ - -/* -** Generate code for a DELETE FROM statement. -** -** DELETE FROM table_wxyz WHERE a<5 AND b NOT NULL; -** \________/ \________________/ -** pTabList pWhere -*/ -SQLITE_PRIVATE void sqlite3DeleteFrom( - Parse *pParse, /* The parser context */ - SrcList *pTabList, /* The table from which we should delete things */ - Expr *pWhere /* The WHERE clause. May be null */ -){ - Vdbe *v; /* The virtual database engine */ - Table *pTab; /* The table from which records will be deleted */ - const char *zDb; /* Name of database holding pTab */ - int i; /* Loop counter */ - WhereInfo *pWInfo; /* Information about the WHERE clause */ - Index *pIdx; /* For looping over indices of the table */ - int iTabCur; /* Cursor number for the table */ - int iDataCur; /* VDBE cursor for the canonical data source */ - int iIdxCur; /* Cursor number of the first index */ - int nIdx; /* Number of indices */ - sqlite3 *db; /* Main database structure */ - AuthContext sContext; /* Authorization context */ - NameContext sNC; /* Name context to resolve expressions in */ - int iDb; /* Database number */ - int memCnt = -1; /* Memory cell used for change counting */ - int rcauth; /* Value returned by authorization callback */ - int okOnePass; /* True for one-pass algorithm without the FIFO */ - int aiCurOnePass[2]; /* The write cursors opened by WHERE_ONEPASS */ - u8 *aToOpen = 0; /* Open cursor iTabCur+j if aToOpen[j] is true */ - Index *pPk; /* The PRIMARY KEY index on the table */ - int iPk = 0; /* First of nPk registers holding PRIMARY KEY value */ - i16 nPk = 1; /* Number of columns in the PRIMARY KEY */ - int iKey; /* Memory cell holding key of row to be deleted */ - i16 nKey; /* Number of memory cells in the row key */ - int iEphCur = 0; /* Ephemeral table holding all primary key values */ - int iRowSet = 0; /* Register for rowset of rows to delete */ - int addrBypass = 0; /* Address of jump over the delete logic */ - int addrLoop = 0; /* Top of the delete loop */ - int addrDelete = 0; /* Jump directly to the delete logic */ - int addrEphOpen = 0; /* Instruction to open the Ephermeral table */ - -#ifndef SQLITE_OMIT_TRIGGER - int isView; /* True if attempting to delete from a view */ - Trigger *pTrigger; /* List of table triggers, if required */ -#endif - - memset(&sContext, 0, sizeof(sContext)); - db = pParse->db; - if( pParse->nErr || db->mallocFailed ){ - goto delete_from_cleanup; - } - assert( pTabList->nSrc==1 ); - - /* Locate the table which we want to delete. This table has to be - ** put in an SrcList structure because some of the subroutines we - ** will be calling are designed to work with multiple tables and expect - ** an SrcList* parameter instead of just a Table* parameter. - */ - pTab = sqlite3SrcListLookup(pParse, pTabList); - if( pTab==0 ) goto delete_from_cleanup; - - /* Figure out if we have any triggers and if the table being - ** deleted from is a view - */ -#ifndef SQLITE_OMIT_TRIGGER - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); - isView = pTab->pSelect!=0; -#else -# define pTrigger 0 -# define isView 0 -#endif -#ifdef SQLITE_OMIT_VIEW -# undef isView -# define isView 0 -#endif - - /* If pTab is really a view, make sure it has been initialized. - */ - if( sqlite3ViewGetColumnNames(pParse, pTab) ){ - goto delete_from_cleanup; - } - - if( sqlite3IsReadOnly(pParse, pTab, (pTrigger?1:0)) ){ - goto delete_from_cleanup; - } - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - assert( iDbnDb ); - zDb = db->aDb[iDb].zName; - rcauth = sqlite3AuthCheck(pParse, SQLITE_DELETE, pTab->zName, 0, zDb); - assert( rcauth==SQLITE_OK || rcauth==SQLITE_DENY || rcauth==SQLITE_IGNORE ); - if( rcauth==SQLITE_DENY ){ - goto delete_from_cleanup; - } - assert(!isView || pTrigger); - - /* Assign cursor numbers to the table and all its indices. - */ - assert( pTabList->nSrc==1 ); - iTabCur = pTabList->a[0].iCursor = pParse->nTab++; - for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ - pParse->nTab++; - } - - /* Start the view context - */ - if( isView ){ - sqlite3AuthContextPush(pParse, &sContext, pTab->zName); - } - - /* Begin generating code. - */ - v = sqlite3GetVdbe(pParse); - if( v==0 ){ - goto delete_from_cleanup; - } - if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); - sqlite3BeginWriteOperation(pParse, 1, iDb); - - /* If we are trying to delete from a view, realize that view into - ** a ephemeral table. - */ -#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) - if( isView ){ - sqlite3MaterializeView(pParse, pTab, pWhere, iTabCur); - iDataCur = iIdxCur = iTabCur; - } -#endif - - /* Resolve the column names in the WHERE clause. - */ - memset(&sNC, 0, sizeof(sNC)); - sNC.pParse = pParse; - sNC.pSrcList = pTabList; - if( sqlite3ResolveExprNames(&sNC, pWhere) ){ - goto delete_from_cleanup; - } - - /* Initialize the counter of the number of rows deleted, if - ** we are counting rows. - */ - if( db->flags & SQLITE_CountRows ){ - memCnt = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, memCnt); - } - -#ifndef SQLITE_OMIT_TRUNCATE_OPTIMIZATION - /* Special case: A DELETE without a WHERE clause deletes everything. - ** It is easier just to erase the whole table. Prior to version 3.6.5, - ** this optimization caused the row change count (the value returned by - ** API function sqlite3_count_changes) to be set incorrectly. */ - if( rcauth==SQLITE_OK && pWhere==0 && !pTrigger && !IsVirtual(pTab) - && 0==sqlite3FkRequired(pParse, pTab, 0, 0) - ){ - assert( !isView ); - sqlite3TableLock(pParse, iDb, pTab->tnum, 1, pTab->zName); - if( HasRowid(pTab) ){ - sqlite3VdbeAddOp4(v, OP_Clear, pTab->tnum, iDb, memCnt, - pTab->zName, P4_STATIC); - } - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - assert( pIdx->pSchema==pTab->pSchema ); - sqlite3VdbeAddOp2(v, OP_Clear, pIdx->tnum, iDb); - } - }else -#endif /* SQLITE_OMIT_TRUNCATE_OPTIMIZATION */ - { - if( HasRowid(pTab) ){ - /* For a rowid table, initialize the RowSet to an empty set */ - pPk = 0; - nPk = 1; - iRowSet = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Null, 0, iRowSet); - }else{ - /* For a WITHOUT ROWID table, create an ephermeral table used to - ** hold all primary keys for rows to be deleted. */ - pPk = sqlite3PrimaryKeyIndex(pTab); - assert( pPk!=0 ); - nPk = pPk->nKeyCol; - iPk = pParse->nMem+1; - pParse->nMem += nPk; - iEphCur = pParse->nTab++; - addrEphOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEphCur, nPk); - sqlite3VdbeSetP4KeyInfo(pParse, pPk); - } - - /* Construct a query to find the rowid or primary key for every row - ** to be deleted, based on the WHERE clause. - */ - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, - WHERE_ONEPASS_DESIRED|WHERE_DUPLICATES_OK, - iTabCur+1); - if( pWInfo==0 ) goto delete_from_cleanup; - okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); - - /* Keep track of the number of rows to be deleted */ - if( db->flags & SQLITE_CountRows ){ - sqlite3VdbeAddOp2(v, OP_AddImm, memCnt, 1); - } - - /* Extract the rowid or primary key for the current row */ - if( pPk ){ - for(i=0; iaiColumn[i], iPk+i); - } - iKey = iPk; - }else{ - iKey = pParse->nMem + 1; - iKey = sqlite3ExprCodeGetColumn(pParse, pTab, -1, iTabCur, iKey, 0); - if( iKey>pParse->nMem ) pParse->nMem = iKey; - } - - if( okOnePass ){ - /* For ONEPASS, no need to store the rowid/primary-key. There is only - ** one, so just keep it in its register(s) and fall through to the - ** delete code. - */ - nKey = nPk; /* OP_Found will use an unpacked key */ - aToOpen = sqlite3DbMallocRaw(db, nIdx+2); - if( aToOpen==0 ){ - sqlite3WhereEnd(pWInfo); - goto delete_from_cleanup; - } - memset(aToOpen, 1, nIdx+1); - aToOpen[nIdx+1] = 0; - if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iTabCur] = 0; - if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iTabCur] = 0; - if( addrEphOpen ) sqlite3VdbeChangeToNoop(v, addrEphOpen); - addrDelete = sqlite3VdbeAddOp0(v, OP_Goto); /* Jump to DELETE logic */ - }else if( pPk ){ - /* Construct a composite key for the row to be deleted and remember it */ - iKey = ++pParse->nMem; - nKey = 0; /* Zero tells OP_Found to use a composite key */ - sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, iKey, - sqlite3IndexAffinityStr(v, pPk), P4_TRANSIENT); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iEphCur, iKey); - }else{ - /* Get the rowid of the row to be deleted and remember it in the RowSet */ - nKey = 1; /* OP_Seek always uses a single rowid */ - sqlite3VdbeAddOp2(v, OP_RowSetAdd, iRowSet, iKey); - } - - /* End of the WHERE loop */ - sqlite3WhereEnd(pWInfo); - if( okOnePass ){ - /* Bypass the delete logic below if the WHERE loop found zero rows */ - addrBypass = sqlite3VdbeMakeLabel(v); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrBypass); - sqlite3VdbeJumpHere(v, addrDelete); - } - - /* Unless this is a view, open cursors for the table we are - ** deleting from and all its indices. If this is a view, then the - ** only effect this statement has is to fire the INSTEAD OF - ** triggers. - */ - if( !isView ){ - sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, iTabCur, aToOpen, - &iDataCur, &iIdxCur); - assert( pPk || iDataCur==iTabCur ); - assert( pPk || iIdxCur==iDataCur+1 ); - } - - /* Set up a loop over the rowids/primary-keys that were found in the - ** where-clause loop above. - */ - if( okOnePass ){ - /* Just one row. Hence the top-of-loop is a no-op */ - assert( nKey==nPk ); /* OP_Found will use an unpacked key */ - if( aToOpen[iDataCur-iTabCur] ){ - assert( pPk!=0 ); - sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, addrBypass, iKey, nKey); - } - }else if( pPk ){ - addrLoop = sqlite3VdbeAddOp1(v, OP_Rewind, iEphCur); - sqlite3VdbeAddOp2(v, OP_RowKey, iEphCur, iKey); - assert( nKey==0 ); /* OP_Found will use a composite key */ - }else{ - addrLoop = sqlite3VdbeAddOp3(v, OP_RowSetRead, iRowSet, 0, iKey); - assert( nKey==1 ); - } - - /* Delete the row */ -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( IsVirtual(pTab) ){ - const char *pVTab = (const char *)sqlite3GetVTable(db, pTab); - sqlite3VtabMakeWritable(pParse, pTab); - sqlite3VdbeAddOp4(v, OP_VUpdate, 0, 1, iKey, pVTab, P4_VTAB); - sqlite3VdbeChangeP5(v, OE_Abort); - sqlite3MayAbort(pParse); - }else -#endif - { - int count = (pParse->nested==0); /* True to count changes */ - sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, - iKey, nKey, count, OE_Default, okOnePass); - } - - /* End of the loop over all rowids/primary-keys. */ - if( okOnePass ){ - sqlite3VdbeResolveLabel(v, addrBypass); - }else if( pPk ){ - sqlite3VdbeAddOp2(v, OP_Next, iEphCur, addrLoop+1); - sqlite3VdbeJumpHere(v, addrLoop); - }else{ - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrLoop); - sqlite3VdbeJumpHere(v, addrLoop); - } - - /* Close the cursors open on the table and its indexes. */ - if( !isView && !IsVirtual(pTab) ){ - if( !pPk ) sqlite3VdbeAddOp1(v, OP_Close, iDataCur); - for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){ - sqlite3VdbeAddOp1(v, OP_Close, iIdxCur + i); - } - } - } /* End non-truncate path */ - - /* Update the sqlite_sequence table by storing the content of the - ** maximum rowid counter values recorded while inserting into - ** autoincrement tables. - */ - if( pParse->nested==0 && pParse->pTriggerTab==0 ){ - sqlite3AutoincrementEnd(pParse); - } - - /* Return the number of rows that were deleted. If this routine is - ** generating code because of a call to sqlite3NestedParse(), do not - ** invoke the callback function. - */ - if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){ - sqlite3VdbeAddOp2(v, OP_ResultRow, memCnt, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows deleted", SQLITE_STATIC); - } - -delete_from_cleanup: - sqlite3AuthContextPop(&sContext); - sqlite3SrcListDelete(db, pTabList); - sqlite3ExprDelete(db, pWhere); - sqlite3DbFree(db, aToOpen); - return; -} -/* Make sure "isView" and other macros defined above are undefined. Otherwise -** thely may interfere with compilation of other functions in this file -** (or in another file, if this file becomes part of the amalgamation). */ -#ifdef isView - #undef isView -#endif -#ifdef pTrigger - #undef pTrigger -#endif - -/* -** This routine generates VDBE code that causes a single row of a -** single table to be deleted. Both the original table entry and -** all indices are removed. -** -** Preconditions: -** -** 1. iDataCur is an open cursor on the btree that is the canonical data -** store for the table. (This will be either the table itself, -** in the case of a rowid table, or the PRIMARY KEY index in the case -** of a WITHOUT ROWID table.) -** -** 2. Read/write cursors for all indices of pTab must be open as -** cursor number iIdxCur+i for the i-th index. -** -** 3. The primary key for the row to be deleted must be stored in a -** sequence of nPk memory cells starting at iPk. If nPk==0 that means -** that a search record formed from OP_MakeRecord is contained in the -** single memory location iPk. -*/ -SQLITE_PRIVATE void sqlite3GenerateRowDelete( - Parse *pParse, /* Parsing context */ - Table *pTab, /* Table containing the row to be deleted */ - Trigger *pTrigger, /* List of triggers to (potentially) fire */ - int iDataCur, /* Cursor from which column data is extracted */ - int iIdxCur, /* First index cursor */ - int iPk, /* First memory cell containing the PRIMARY KEY */ - i16 nPk, /* Number of PRIMARY KEY memory cells */ - u8 count, /* If non-zero, increment the row change counter */ - u8 onconf, /* Default ON CONFLICT policy for triggers */ - u8 bNoSeek /* iDataCur is already pointing to the row to delete */ -){ - Vdbe *v = pParse->pVdbe; /* Vdbe */ - int iOld = 0; /* First register in OLD.* array */ - int iLabel; /* Label resolved to end of generated code */ - u8 opSeek; /* Seek opcode */ - - /* Vdbe is guaranteed to have been allocated by this stage. */ - assert( v ); - VdbeModuleComment((v, "BEGIN: GenRowDel(%d,%d,%d,%d)", - iDataCur, iIdxCur, iPk, (int)nPk)); - - /* Seek cursor iCur to the row to delete. If this row no longer exists - ** (this can happen if a trigger program has already deleted it), do - ** not attempt to delete it or fire any DELETE triggers. */ - iLabel = sqlite3VdbeMakeLabel(v); - opSeek = HasRowid(pTab) ? OP_NotExists : OP_NotFound; - if( !bNoSeek ) sqlite3VdbeAddOp4Int(v, opSeek, iDataCur, iLabel, iPk, nPk); - - /* If there are any triggers to fire, allocate a range of registers to - ** use for the old.* references in the triggers. */ - if( sqlite3FkRequired(pParse, pTab, 0, 0) || pTrigger ){ - u32 mask; /* Mask of OLD.* columns in use */ - int iCol; /* Iterator used while populating OLD.* */ - int addrStart; /* Start of BEFORE trigger programs */ - - /* TODO: Could use temporary registers here. Also could attempt to - ** avoid copying the contents of the rowid register. */ - mask = sqlite3TriggerColmask( - pParse, pTrigger, 0, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onconf - ); - mask |= sqlite3FkOldmask(pParse, pTab); - iOld = pParse->nMem+1; - pParse->nMem += (1 + pTab->nCol); - - /* Populate the OLD.* pseudo-table register array. These values will be - ** used by any BEFORE and AFTER triggers that exist. */ - sqlite3VdbeAddOp2(v, OP_Copy, iPk, iOld); - for(iCol=0; iColnCol; iCol++){ - testcase( mask!=0xffffffff && iCol==31 ); - testcase( mask!=0xffffffff && iCol==32 ); - if( mask==0xffffffff || (iCol<=31 && (mask & MASKBIT32(iCol))!=0) ){ - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, iCol, iOld+iCol+1); - } - } - - /* Invoke BEFORE DELETE trigger programs. */ - addrStart = sqlite3VdbeCurrentAddr(v); - sqlite3CodeRowTrigger(pParse, pTrigger, - TK_DELETE, 0, TRIGGER_BEFORE, pTab, iOld, onconf, iLabel - ); - - /* If any BEFORE triggers were coded, then seek the cursor to the - ** row to be deleted again. It may be that the BEFORE triggers moved - ** the cursor or of already deleted the row that the cursor was - ** pointing to. - */ - if( addrStartpSelect==0 ){ - sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, 0); - sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, (count?OPFLAG_NCHANGE:0)); - if( count ){ - sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT); - } - } - - /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to - ** handle rows (possibly in other tables) that refer via a foreign key - ** to the row just deleted. */ - sqlite3FkActions(pParse, pTab, 0, iOld, 0, 0); - - /* Invoke AFTER DELETE trigger programs. */ - sqlite3CodeRowTrigger(pParse, pTrigger, - TK_DELETE, 0, TRIGGER_AFTER, pTab, iOld, onconf, iLabel - ); - - /* Jump here if the row had already been deleted before any BEFORE - ** trigger programs were invoked. Or if a trigger program throws a - ** RAISE(IGNORE) exception. */ - sqlite3VdbeResolveLabel(v, iLabel); - VdbeModuleComment((v, "END: GenRowDel()")); -} - -/* -** This routine generates VDBE code that causes the deletion of all -** index entries associated with a single row of a single table, pTab -** -** Preconditions: -** -** 1. A read/write cursor "iDataCur" must be open on the canonical storage -** btree for the table pTab. (This will be either the table itself -** for rowid tables or to the primary key index for WITHOUT ROWID -** tables.) -** -** 2. Read/write cursors for all indices of pTab must be open as -** cursor number iIdxCur+i for the i-th index. (The pTab->pIndex -** index is the 0-th index.) -** -** 3. The "iDataCur" cursor must be already be positioned on the row -** that is to be deleted. -*/ -SQLITE_PRIVATE void sqlite3GenerateRowIndexDelete( - Parse *pParse, /* Parsing and code generating context */ - Table *pTab, /* Table containing the row to be deleted */ - int iDataCur, /* Cursor of table holding data. */ - int iIdxCur, /* First index cursor */ - int *aRegIdx /* Only delete if aRegIdx!=0 && aRegIdx[i]>0 */ -){ - int i; /* Index loop counter */ - int r1 = -1; /* Register holding an index key */ - int iPartIdxLabel; /* Jump destination for skipping partial index entries */ - Index *pIdx; /* Current index */ - Index *pPrior = 0; /* Prior index */ - Vdbe *v; /* The prepared statement under construction */ - Index *pPk; /* PRIMARY KEY index, or NULL for rowid tables */ - - v = pParse->pVdbe; - pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); - for(i=0, pIdx=pTab->pIndex; pIdx; i++, pIdx=pIdx->pNext){ - assert( iIdxCur+i!=iDataCur || pPk==pIdx ); - if( aRegIdx!=0 && aRegIdx[i]==0 ) continue; - if( pIdx==pPk ) continue; - VdbeModuleComment((v, "GenRowIdxDel for %s", pIdx->zName)); - r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 1, - &iPartIdxLabel, pPrior, r1); - sqlite3VdbeAddOp3(v, OP_IdxDelete, iIdxCur+i, r1, - pIdx->uniqNotNull ? pIdx->nKeyCol : pIdx->nColumn); - sqlite3VdbeResolveLabel(v, iPartIdxLabel); - pPrior = pIdx; - } -} - -/* -** Generate code that will assemble an index key and stores it in register -** regOut. The key with be for index pIdx which is an index on pTab. -** iCur is the index of a cursor open on the pTab table and pointing to -** the entry that needs indexing. If pTab is a WITHOUT ROWID table, then -** iCur must be the cursor of the PRIMARY KEY index. -** -** Return a register number which is the first in a block of -** registers that holds the elements of the index key. The -** block of registers has already been deallocated by the time -** this routine returns. -** -** If *piPartIdxLabel is not NULL, fill it in with a label and jump -** to that label if pIdx is a partial index that should be skipped. -** A partial index should be skipped if its WHERE clause evaluates -** to false or null. If pIdx is not a partial index, *piPartIdxLabel -** will be set to zero which is an empty label that is ignored by -** sqlite3VdbeResolveLabel(). -** -** The pPrior and regPrior parameters are used to implement a cache to -** avoid unnecessary register loads. If pPrior is not NULL, then it is -** a pointer to a different index for which an index key has just been -** computed into register regPrior. If the current pIdx index is generating -** its key into the same sequence of registers and if pPrior and pIdx share -** a column in common, then the register corresponding to that column already -** holds the correct value and the loading of that register is skipped. -** This optimization is helpful when doing a DELETE or an INTEGRITY_CHECK -** on a table with multiple indices, and especially with the ROWID or -** PRIMARY KEY columns of the index. -*/ -SQLITE_PRIVATE int sqlite3GenerateIndexKey( - Parse *pParse, /* Parsing context */ - Index *pIdx, /* The index for which to generate a key */ - int iDataCur, /* Cursor number from which to take column data */ - int regOut, /* Put the new key into this register if not 0 */ - int prefixOnly, /* Compute only a unique prefix of the key */ - int *piPartIdxLabel, /* OUT: Jump to this label to skip partial index */ - Index *pPrior, /* Previously generated index key */ - int regPrior /* Register holding previous generated key */ -){ - Vdbe *v = pParse->pVdbe; - int j; - Table *pTab = pIdx->pTable; - int regBase; - int nCol; - - if( piPartIdxLabel ){ - if( pIdx->pPartIdxWhere ){ - *piPartIdxLabel = sqlite3VdbeMakeLabel(v); - pParse->iPartIdxTab = iDataCur; - sqlite3ExprIfFalse(pParse, pIdx->pPartIdxWhere, *piPartIdxLabel, - SQLITE_JUMPIFNULL); - }else{ - *piPartIdxLabel = 0; - } - } - nCol = (prefixOnly && pIdx->uniqNotNull) ? pIdx->nKeyCol : pIdx->nColumn; - regBase = sqlite3GetTempRange(pParse, nCol); - if( pPrior && (regBase!=regPrior || pPrior->pPartIdxWhere) ) pPrior = 0; - for(j=0; jaiColumn[j]==pIdx->aiColumn[j] ) continue; - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, pIdx->aiColumn[j], - regBase+j); - /* If the column affinity is REAL but the number is an integer, then it - ** might be stored in the table as an integer (using a compact - ** representation) then converted to REAL by an OP_RealAffinity opcode. - ** But we are getting ready to store this value back into an index, where - ** it should be converted by to INTEGER again. So omit the OP_RealAffinity - ** opcode if it is present */ - sqlite3VdbeDeletePriorOpcode(v, OP_RealAffinity); - } - if( regOut ){ - sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regOut); - } - sqlite3ReleaseTempRange(pParse, regBase, nCol); - return regBase; -} - -/************** End of delete.c **********************************************/ -/************** Begin file func.c ********************************************/ -/* -** 2002 February 23 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the C functions that implement various SQL -** functions of SQLite. -** -** There is only one exported symbol in this file - the function -** sqliteRegisterBuildinFunctions() found at the bottom of the file. -** All other code has file scope. -*/ -/* #include */ -/* #include */ - -/* -** Return the collating function associated with a function. -*/ -static CollSeq *sqlite3GetFuncCollSeq(sqlite3_context *context){ - return context->pColl; -} - -/* -** Indicate that the accumulator load should be skipped on this -** iteration of the aggregate loop. -*/ -static void sqlite3SkipAccumulatorLoad(sqlite3_context *context){ - context->skipFlag = 1; -} - -/* -** Implementation of the non-aggregate min() and max() functions -*/ -static void minmaxFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - int i; - int mask; /* 0 for min() or 0xffffffff for max() */ - int iBest; - CollSeq *pColl; - - assert( argc>1 ); - mask = sqlite3_user_data(context)==0 ? 0 : -1; - pColl = sqlite3GetFuncCollSeq(context); - assert( pColl ); - assert( mask==-1 || mask==0 ); - iBest = 0; - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - for(i=1; i=0 ){ - testcase( mask==0 ); - iBest = i; - } - } - sqlite3_result_value(context, argv[iBest]); -} - -/* -** Return the type of the argument. -*/ -static void typeofFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **argv -){ - const char *z = 0; - UNUSED_PARAMETER(NotUsed); - switch( sqlite3_value_type(argv[0]) ){ - case SQLITE_INTEGER: z = "integer"; break; - case SQLITE_TEXT: z = "text"; break; - case SQLITE_FLOAT: z = "real"; break; - case SQLITE_BLOB: z = "blob"; break; - default: z = "null"; break; - } - sqlite3_result_text(context, z, -1, SQLITE_STATIC); -} - - -/* -** Implementation of the length() function -*/ -static void lengthFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - int len; - - assert( argc==1 ); - UNUSED_PARAMETER(argc); - switch( sqlite3_value_type(argv[0]) ){ - case SQLITE_BLOB: - case SQLITE_INTEGER: - case SQLITE_FLOAT: { - sqlite3_result_int(context, sqlite3_value_bytes(argv[0])); - break; - } - case SQLITE_TEXT: { - const unsigned char *z = sqlite3_value_text(argv[0]); - if( z==0 ) return; - len = 0; - while( *z ){ - len++; - SQLITE_SKIP_UTF8(z); - } - sqlite3_result_int(context, len); - break; - } - default: { - sqlite3_result_null(context); - break; - } - } -} - -/* -** Implementation of the abs() function. -** -** IMP: R-23979-26855 The abs(X) function returns the absolute value of -** the numeric argument X. -*/ -static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ - assert( argc==1 ); - UNUSED_PARAMETER(argc); - switch( sqlite3_value_type(argv[0]) ){ - case SQLITE_INTEGER: { - i64 iVal = sqlite3_value_int64(argv[0]); - if( iVal<0 ){ - if( iVal==SMALLEST_INT64 ){ - /* IMP: R-31676-45509 If X is the integer -9223372036854775808 - ** then abs(X) throws an integer overflow error since there is no - ** equivalent positive 64-bit two complement value. */ - sqlite3_result_error(context, "integer overflow", -1); - return; - } - iVal = -iVal; - } - sqlite3_result_int64(context, iVal); - break; - } - case SQLITE_NULL: { - /* IMP: R-37434-19929 Abs(X) returns NULL if X is NULL. */ - sqlite3_result_null(context); - break; - } - default: { - /* Because sqlite3_value_double() returns 0.0 if the argument is not - ** something that can be converted into a number, we have: - ** IMP: R-57326-31541 Abs(X) return 0.0 if X is a string or blob that - ** cannot be converted to a numeric value. - */ - double rVal = sqlite3_value_double(argv[0]); - if( rVal<0 ) rVal = -rVal; - sqlite3_result_double(context, rVal); - break; - } - } -} - -/* -** Implementation of the instr() function. -** -** instr(haystack,needle) finds the first occurrence of needle -** in haystack and returns the number of previous characters plus 1, -** or 0 if needle does not occur within haystack. -** -** If both haystack and needle are BLOBs, then the result is one more than -** the number of bytes in haystack prior to the first occurrence of needle, -** or 0 if needle never occurs in haystack. -*/ -static void instrFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const unsigned char *zHaystack; - const unsigned char *zNeedle; - int nHaystack; - int nNeedle; - int typeHaystack, typeNeedle; - int N = 1; - int isText; - - UNUSED_PARAMETER(argc); - typeHaystack = sqlite3_value_type(argv[0]); - typeNeedle = sqlite3_value_type(argv[1]); - if( typeHaystack==SQLITE_NULL || typeNeedle==SQLITE_NULL ) return; - nHaystack = sqlite3_value_bytes(argv[0]); - nNeedle = sqlite3_value_bytes(argv[1]); - if( typeHaystack==SQLITE_BLOB && typeNeedle==SQLITE_BLOB ){ - zHaystack = sqlite3_value_blob(argv[0]); - zNeedle = sqlite3_value_blob(argv[1]); - isText = 0; - }else{ - zHaystack = sqlite3_value_text(argv[0]); - zNeedle = sqlite3_value_text(argv[1]); - isText = 1; - } - while( nNeedle<=nHaystack && memcmp(zHaystack, zNeedle, nNeedle)!=0 ){ - N++; - do{ - nHaystack--; - zHaystack++; - }while( isText && (zHaystack[0]&0xc0)==0x80 ); - } - if( nNeedle>nHaystack ) N = 0; - sqlite3_result_int(context, N); -} - -/* -** Implementation of the printf() function. -*/ -static void printfFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - PrintfArguments x; - StrAccum str; - const char *zFormat; - int n; - - if( argc>=1 && (zFormat = (const char*)sqlite3_value_text(argv[0]))!=0 ){ - x.nArg = argc-1; - x.nUsed = 0; - x.apArg = argv+1; - sqlite3StrAccumInit(&str, 0, 0, SQLITE_MAX_LENGTH); - str.db = sqlite3_context_db_handle(context); - sqlite3XPrintf(&str, SQLITE_PRINTF_SQLFUNC, zFormat, &x); - n = str.nChar; - sqlite3_result_text(context, sqlite3StrAccumFinish(&str), n, - SQLITE_DYNAMIC); - } -} - -/* -** Implementation of the substr() function. -** -** substr(x,p1,p2) returns p2 characters of x[] beginning with p1. -** p1 is 1-indexed. So substr(x,1,1) returns the first character -** of x. If x is text, then we actually count UTF-8 characters. -** If x is a blob, then we count bytes. -** -** If p1 is negative, then we begin abs(p1) from the end of x[]. -** -** If p2 is negative, return the p2 characters preceding p1. -*/ -static void substrFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const unsigned char *z; - const unsigned char *z2; - int len; - int p0type; - i64 p1, p2; - int negP2 = 0; - - assert( argc==3 || argc==2 ); - if( sqlite3_value_type(argv[1])==SQLITE_NULL - || (argc==3 && sqlite3_value_type(argv[2])==SQLITE_NULL) - ){ - return; - } - p0type = sqlite3_value_type(argv[0]); - p1 = sqlite3_value_int(argv[1]); - if( p0type==SQLITE_BLOB ){ - len = sqlite3_value_bytes(argv[0]); - z = sqlite3_value_blob(argv[0]); - if( z==0 ) return; - assert( len==sqlite3_value_bytes(argv[0]) ); - }else{ - z = sqlite3_value_text(argv[0]); - if( z==0 ) return; - len = 0; - if( p1<0 ){ - for(z2=z; *z2; len++){ - SQLITE_SKIP_UTF8(z2); - } - } - } - if( argc==3 ){ - p2 = sqlite3_value_int(argv[2]); - if( p2<0 ){ - p2 = -p2; - negP2 = 1; - } - }else{ - p2 = sqlite3_context_db_handle(context)->aLimit[SQLITE_LIMIT_LENGTH]; - } - if( p1<0 ){ - p1 += len; - if( p1<0 ){ - p2 += p1; - if( p2<0 ) p2 = 0; - p1 = 0; - } - }else if( p1>0 ){ - p1--; - }else if( p2>0 ){ - p2--; - } - if( negP2 ){ - p1 -= p2; - if( p1<0 ){ - p2 += p1; - p1 = 0; - } - } - assert( p1>=0 && p2>=0 ); - if( p0type!=SQLITE_BLOB ){ - while( *z && p1 ){ - SQLITE_SKIP_UTF8(z); - p1--; - } - for(z2=z; *z2 && p2; p2--){ - SQLITE_SKIP_UTF8(z2); - } - sqlite3_result_text(context, (char*)z, (int)(z2-z), SQLITE_TRANSIENT); - }else{ - if( p1+p2>len ){ - p2 = len-p1; - if( p2<0 ) p2 = 0; - } - sqlite3_result_blob(context, (char*)&z[p1], (int)p2, SQLITE_TRANSIENT); - } -} - -/* -** Implementation of the round() function -*/ -#ifndef SQLITE_OMIT_FLOATING_POINT -static void roundFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ - int n = 0; - double r; - char *zBuf; - assert( argc==1 || argc==2 ); - if( argc==2 ){ - if( SQLITE_NULL==sqlite3_value_type(argv[1]) ) return; - n = sqlite3_value_int(argv[1]); - if( n>30 ) n = 30; - if( n<0 ) n = 0; - } - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - r = sqlite3_value_double(argv[0]); - /* If Y==0 and X will fit in a 64-bit int, - ** handle the rounding directly, - ** otherwise use printf. - */ - if( n==0 && r>=0 && r0 ); - testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH] ); - testcase( nByte==db->aLimit[SQLITE_LIMIT_LENGTH]+1 ); - if( nByte>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - sqlite3_result_error_toobig(context); - z = 0; - }else{ - z = sqlite3Malloc((int)nByte); - if( !z ){ - sqlite3_result_error_nomem(context); - } - } - return z; -} - -/* -** Implementation of the upper() and lower() SQL functions. -*/ -static void upperFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ - char *z1; - const char *z2; - int i, n; - UNUSED_PARAMETER(argc); - z2 = (char*)sqlite3_value_text(argv[0]); - n = sqlite3_value_bytes(argv[0]); - /* Verify that the call to _bytes() does not invalidate the _text() pointer */ - assert( z2==(char*)sqlite3_value_text(argv[0]) ); - if( z2 ){ - z1 = contextMalloc(context, ((i64)n)+1); - if( z1 ){ - for(i=0; imatchOne; - u8 matchAll = pInfo->matchAll; - u8 matchSet = pInfo->matchSet; - u8 noCase = pInfo->noCase; - int prevEscape = 0; /* True if the previous character was 'escape' */ - - while( (c = sqlite3Utf8Read(&zPattern))!=0 ){ - if( c==matchAll && !prevEscape ){ - while( (c=sqlite3Utf8Read(&zPattern)) == matchAll - || c == matchOne ){ - if( c==matchOne && sqlite3Utf8Read(&zString)==0 ){ - return 0; - } - } - if( c==0 ){ - return 1; - }else if( c==esc ){ - c = sqlite3Utf8Read(&zPattern); - if( c==0 ){ - return 0; - } - }else if( c==matchSet ){ - assert( esc==0 ); /* This is GLOB, not LIKE */ - assert( matchSet<0x80 ); /* '[' is a single-byte character */ - while( *zString && patternCompare(&zPattern[-1],zString,pInfo,esc)==0 ){ - SQLITE_SKIP_UTF8(zString); - } - return *zString!=0; - } - while( (c2 = sqlite3Utf8Read(&zString))!=0 ){ - if( noCase ){ - GlobUpperToLower(c2); - GlobUpperToLower(c); - while( c2 != 0 && c2 != c ){ - c2 = sqlite3Utf8Read(&zString); - GlobUpperToLower(c2); - } - }else{ - while( c2 != 0 && c2 != c ){ - c2 = sqlite3Utf8Read(&zString); - } - } - if( c2==0 ) return 0; - if( patternCompare(zPattern,zString,pInfo,esc) ) return 1; - } - return 0; - }else if( c==matchOne && !prevEscape ){ - if( sqlite3Utf8Read(&zString)==0 ){ - return 0; - } - }else if( c==matchSet ){ - u32 prior_c = 0; - assert( esc==0 ); /* This only occurs for GLOB, not LIKE */ - seen = 0; - invert = 0; - c = sqlite3Utf8Read(&zString); - if( c==0 ) return 0; - c2 = sqlite3Utf8Read(&zPattern); - if( c2=='^' ){ - invert = 1; - c2 = sqlite3Utf8Read(&zPattern); - } - if( c2==']' ){ - if( c==']' ) seen = 1; - c2 = sqlite3Utf8Read(&zPattern); - } - while( c2 && c2!=']' ){ - if( c2=='-' && zPattern[0]!=']' && zPattern[0]!=0 && prior_c>0 ){ - c2 = sqlite3Utf8Read(&zPattern); - if( c>=prior_c && c<=c2 ) seen = 1; - prior_c = 0; - }else{ - if( c==c2 ){ - seen = 1; - } - prior_c = c2; - } - c2 = sqlite3Utf8Read(&zPattern); - } - if( c2==0 || (seen ^ invert)==0 ){ - return 0; - } - }else if( esc==c && !prevEscape ){ - prevEscape = 1; - }else{ - c2 = sqlite3Utf8Read(&zString); - if( noCase ){ - GlobUpperToLower(c); - GlobUpperToLower(c2); - } - if( c!=c2 ){ - return 0; - } - prevEscape = 0; - } - } - return *zString==0; -} - -/* -** The sqlite3_strglob() interface. -*/ -SQLITE_API int sqlite3_strglob(const char *zGlobPattern, const char *zString){ - return patternCompare((u8*)zGlobPattern, (u8*)zString, &globInfo, 0)==0; -} - -/* -** Count the number of times that the LIKE operator (or GLOB which is -** just a variation of LIKE) gets called. This is used for testing -** only. -*/ -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_like_count = 0; -#endif - - -/* -** Implementation of the like() SQL function. This function implements -** the build-in LIKE operator. The first argument to the function is the -** pattern and the second argument is the string. So, the SQL statements: -** -** A LIKE B -** -** is implemented as like(B,A). -** -** This same function (with a different compareInfo structure) computes -** the GLOB operator. -*/ -static void likeFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const unsigned char *zA, *zB; - u32 escape = 0; - int nPat; - sqlite3 *db = sqlite3_context_db_handle(context); - - zB = sqlite3_value_text(argv[0]); - zA = sqlite3_value_text(argv[1]); - - /* Limit the length of the LIKE or GLOB pattern to avoid problems - ** of deep recursion and N*N behavior in patternCompare(). - */ - nPat = sqlite3_value_bytes(argv[0]); - testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ); - testcase( nPat==db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]+1 ); - if( nPat > db->aLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH] ){ - sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1); - return; - } - assert( zB==sqlite3_value_text(argv[0]) ); /* Encoding did not change */ - - if( argc==3 ){ - /* The escape character string must consist of a single UTF-8 character. - ** Otherwise, return an error. - */ - const unsigned char *zEsc = sqlite3_value_text(argv[2]); - if( zEsc==0 ) return; - if( sqlite3Utf8CharLen((char*)zEsc, -1)!=1 ){ - sqlite3_result_error(context, - "ESCAPE expression must be a single character", -1); - return; - } - escape = sqlite3Utf8Read(&zEsc); - } - if( zA && zB ){ - struct compareInfo *pInfo = sqlite3_user_data(context); -#ifdef SQLITE_TEST - sqlite3_like_count++; -#endif - - sqlite3_result_int(context, patternCompare(zB, zA, pInfo, escape)); - } -} - -/* -** Implementation of the NULLIF(x,y) function. The result is the first -** argument if the arguments are different. The result is NULL if the -** arguments are equal to each other. -*/ -static void nullifFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **argv -){ - CollSeq *pColl = sqlite3GetFuncCollSeq(context); - UNUSED_PARAMETER(NotUsed); - if( sqlite3MemCompare(argv[0], argv[1], pColl)!=0 ){ - sqlite3_result_value(context, argv[0]); - } -} - -/* -** Implementation of the sqlite_version() function. The result is the version -** of the SQLite library that is running. -*/ -static void versionFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **NotUsed2 -){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - /* IMP: R-48699-48617 This function is an SQL wrapper around the - ** sqlite3_libversion() C-interface. */ - sqlite3_result_text(context, sqlite3_libversion(), -1, SQLITE_STATIC); -} - -/* -** Implementation of the sqlite_source_id() function. The result is a string -** that identifies the particular version of the source code used to build -** SQLite. -*/ -static void sourceidFunc( - sqlite3_context *context, - int NotUsed, - sqlite3_value **NotUsed2 -){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - /* IMP: R-24470-31136 This function is an SQL wrapper around the - ** sqlite3_sourceid() C interface. */ - sqlite3_result_text(context, sqlite3_sourceid(), -1, SQLITE_STATIC); -} - -/* -** Implementation of the sqlite_log() function. This is a wrapper around -** sqlite3_log(). The return value is NULL. The function exists purely for -** its side-effects. -*/ -static void errlogFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(context); - sqlite3_log(sqlite3_value_int(argv[0]), "%s", sqlite3_value_text(argv[1])); -} - -/* -** Implementation of the sqlite_compileoption_used() function. -** The result is an integer that identifies if the compiler option -** was used to build SQLite. -*/ -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS -static void compileoptionusedFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const char *zOptName; - assert( argc==1 ); - UNUSED_PARAMETER(argc); - /* IMP: R-39564-36305 The sqlite_compileoption_used() SQL - ** function is a wrapper around the sqlite3_compileoption_used() C/C++ - ** function. - */ - if( (zOptName = (const char*)sqlite3_value_text(argv[0]))!=0 ){ - sqlite3_result_int(context, sqlite3_compileoption_used(zOptName)); - } -} -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ - -/* -** Implementation of the sqlite_compileoption_get() function. -** The result is a string that identifies the compiler options -** used to build SQLite. -*/ -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS -static void compileoptiongetFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - int n; - assert( argc==1 ); - UNUSED_PARAMETER(argc); - /* IMP: R-04922-24076 The sqlite_compileoption_get() SQL function - ** is a wrapper around the sqlite3_compileoption_get() C/C++ function. - */ - n = sqlite3_value_int(argv[0]); - sqlite3_result_text(context, sqlite3_compileoption_get(n), -1, SQLITE_STATIC); -} -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ - -/* Array for converting from half-bytes (nybbles) into ASCII hex -** digits. */ -static const char hexdigits[] = { - '0', '1', '2', '3', '4', '5', '6', '7', - '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' -}; - -/* -** Implementation of the QUOTE() function. This function takes a single -** argument. If the argument is numeric, the return value is the same as -** the argument. If the argument is NULL, the return value is the string -** "NULL". Otherwise, the argument is enclosed in single quotes with -** single-quote escapes. -*/ -static void quoteFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ - assert( argc==1 ); - UNUSED_PARAMETER(argc); - switch( sqlite3_value_type(argv[0]) ){ - case SQLITE_FLOAT: { - double r1, r2; - char zBuf[50]; - r1 = sqlite3_value_double(argv[0]); - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.15g", r1); - sqlite3AtoF(zBuf, &r2, 20, SQLITE_UTF8); - if( r1!=r2 ){ - sqlite3_snprintf(sizeof(zBuf), zBuf, "%!.20e", r1); - } - sqlite3_result_text(context, zBuf, -1, SQLITE_TRANSIENT); - break; - } - case SQLITE_INTEGER: { - sqlite3_result_value(context, argv[0]); - break; - } - case SQLITE_BLOB: { - char *zText = 0; - char const *zBlob = sqlite3_value_blob(argv[0]); - int nBlob = sqlite3_value_bytes(argv[0]); - assert( zBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */ - zText = (char *)contextMalloc(context, (2*(i64)nBlob)+4); - if( zText ){ - int i; - for(i=0; i>4)&0x0F]; - zText[(i*2)+3] = hexdigits[(zBlob[i])&0x0F]; - } - zText[(nBlob*2)+2] = '\''; - zText[(nBlob*2)+3] = '\0'; - zText[0] = 'X'; - zText[1] = '\''; - sqlite3_result_text(context, zText, -1, SQLITE_TRANSIENT); - sqlite3_free(zText); - } - break; - } - case SQLITE_TEXT: { - int i,j; - u64 n; - const unsigned char *zArg = sqlite3_value_text(argv[0]); - char *z; - - if( zArg==0 ) return; - for(i=0, n=0; zArg[i]; i++){ if( zArg[i]=='\'' ) n++; } - z = contextMalloc(context, ((i64)i)+((i64)n)+3); - if( z ){ - z[0] = '\''; - for(i=0, j=1; zArg[i]; i++){ - z[j++] = zArg[i]; - if( zArg[i]=='\'' ){ - z[j++] = '\''; - } - } - z[j++] = '\''; - z[j] = 0; - sqlite3_result_text(context, z, j, sqlite3_free); - } - break; - } - default: { - assert( sqlite3_value_type(argv[0])==SQLITE_NULL ); - sqlite3_result_text(context, "NULL", 4, SQLITE_STATIC); - break; - } - } -} - -/* -** The unicode() function. Return the integer unicode code-point value -** for the first character of the input string. -*/ -static void unicodeFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const unsigned char *z = sqlite3_value_text(argv[0]); - (void)argc; - if( z && z[0] ) sqlite3_result_int(context, sqlite3Utf8Read(&z)); -} - -/* -** The char() function takes zero or more arguments, each of which is -** an integer. It constructs a string where each character of the string -** is the unicode character for the corresponding integer argument. -*/ -static void charFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - unsigned char *z, *zOut; - int i; - zOut = z = sqlite3_malloc( argc*4 ); - if( z==0 ){ - sqlite3_result_error_nomem(context); - return; - } - for(i=0; i0x10ffff ) x = 0xfffd; - c = (unsigned)(x & 0x1fffff); - if( c<0x00080 ){ - *zOut++ = (u8)(c&0xFF); - }else if( c<0x00800 ){ - *zOut++ = 0xC0 + (u8)((c>>6)&0x1F); - *zOut++ = 0x80 + (u8)(c & 0x3F); - }else if( c<0x10000 ){ - *zOut++ = 0xE0 + (u8)((c>>12)&0x0F); - *zOut++ = 0x80 + (u8)((c>>6) & 0x3F); - *zOut++ = 0x80 + (u8)(c & 0x3F); - }else{ - *zOut++ = 0xF0 + (u8)((c>>18) & 0x07); - *zOut++ = 0x80 + (u8)((c>>12) & 0x3F); - *zOut++ = 0x80 + (u8)((c>>6) & 0x3F); - *zOut++ = 0x80 + (u8)(c & 0x3F); - } \ - } - sqlite3_result_text(context, (char*)z, (int)(zOut-z), sqlite3_free); -} - -/* -** The hex() function. Interpret the argument as a blob. Return -** a hexadecimal rendering as text. -*/ -static void hexFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - int i, n; - const unsigned char *pBlob; - char *zHex, *z; - assert( argc==1 ); - UNUSED_PARAMETER(argc); - pBlob = sqlite3_value_blob(argv[0]); - n = sqlite3_value_bytes(argv[0]); - assert( pBlob==sqlite3_value_blob(argv[0]) ); /* No encoding change */ - z = zHex = contextMalloc(context, ((i64)n)*2 + 1); - if( zHex ){ - for(i=0; i>4)&0xf]; - *(z++) = hexdigits[c&0xf]; - } - *z = 0; - sqlite3_result_text(context, zHex, n*2, sqlite3_free); - } -} - -/* -** The zeroblob(N) function returns a zero-filled blob of size N bytes. -*/ -static void zeroblobFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - i64 n; - sqlite3 *db = sqlite3_context_db_handle(context); - assert( argc==1 ); - UNUSED_PARAMETER(argc); - n = sqlite3_value_int64(argv[0]); - testcase( n==db->aLimit[SQLITE_LIMIT_LENGTH] ); - testcase( n==db->aLimit[SQLITE_LIMIT_LENGTH]+1 ); - if( n>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - sqlite3_result_error_toobig(context); - }else{ - sqlite3_result_zeroblob(context, (int)n); /* IMP: R-00293-64994 */ - } -} - -/* -** The replace() function. Three arguments are all strings: call -** them A, B, and C. The result is also a string which is derived -** from A by replacing every occurrence of B with C. The match -** must be exact. Collating sequences are not used. -*/ -static void replaceFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const unsigned char *zStr; /* The input string A */ - const unsigned char *zPattern; /* The pattern string B */ - const unsigned char *zRep; /* The replacement string C */ - unsigned char *zOut; /* The output */ - int nStr; /* Size of zStr */ - int nPattern; /* Size of zPattern */ - int nRep; /* Size of zRep */ - i64 nOut; /* Maximum size of zOut */ - int loopLimit; /* Last zStr[] that might match zPattern[] */ - int i, j; /* Loop counters */ - - assert( argc==3 ); - UNUSED_PARAMETER(argc); - zStr = sqlite3_value_text(argv[0]); - if( zStr==0 ) return; - nStr = sqlite3_value_bytes(argv[0]); - assert( zStr==sqlite3_value_text(argv[0]) ); /* No encoding change */ - zPattern = sqlite3_value_text(argv[1]); - if( zPattern==0 ){ - assert( sqlite3_value_type(argv[1])==SQLITE_NULL - || sqlite3_context_db_handle(context)->mallocFailed ); - return; - } - if( zPattern[0]==0 ){ - assert( sqlite3_value_type(argv[1])!=SQLITE_NULL ); - sqlite3_result_value(context, argv[0]); - return; - } - nPattern = sqlite3_value_bytes(argv[1]); - assert( zPattern==sqlite3_value_text(argv[1]) ); /* No encoding change */ - zRep = sqlite3_value_text(argv[2]); - if( zRep==0 ) return; - nRep = sqlite3_value_bytes(argv[2]); - assert( zRep==sqlite3_value_text(argv[2]) ); - nOut = nStr + 1; - assert( nOutaLimit[SQLITE_LIMIT_LENGTH] ); - testcase( nOut-2==db->aLimit[SQLITE_LIMIT_LENGTH] ); - if( nOut-1>db->aLimit[SQLITE_LIMIT_LENGTH] ){ - sqlite3_result_error_toobig(context); - sqlite3_free(zOut); - return; - } - zOld = zOut; - zOut = sqlite3_realloc(zOut, (int)nOut); - if( zOut==0 ){ - sqlite3_result_error_nomem(context); - sqlite3_free(zOld); - return; - } - memcpy(&zOut[j], zRep, nRep); - j += nRep; - i += nPattern-1; - } - } - assert( j+nStr-i+1==nOut ); - memcpy(&zOut[j], &zStr[i], nStr-i); - j += nStr - i; - assert( j<=nOut ); - zOut[j] = 0; - sqlite3_result_text(context, (char*)zOut, j, sqlite3_free); -} - -/* -** Implementation of the TRIM(), LTRIM(), and RTRIM() functions. -** The userdata is 0x1 for left trim, 0x2 for right trim, 0x3 for both. -*/ -static void trimFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const unsigned char *zIn; /* Input string */ - const unsigned char *zCharSet; /* Set of characters to trim */ - int nIn; /* Number of bytes in input */ - int flags; /* 1: trimleft 2: trimright 3: trim */ - int i; /* Loop counter */ - unsigned char *aLen = 0; /* Length of each character in zCharSet */ - unsigned char **azChar = 0; /* Individual characters in zCharSet */ - int nChar; /* Number of characters in zCharSet */ - - if( sqlite3_value_type(argv[0])==SQLITE_NULL ){ - return; - } - zIn = sqlite3_value_text(argv[0]); - if( zIn==0 ) return; - nIn = sqlite3_value_bytes(argv[0]); - assert( zIn==sqlite3_value_text(argv[0]) ); - if( argc==1 ){ - static const unsigned char lenOne[] = { 1 }; - static unsigned char * const azOne[] = { (u8*)" " }; - nChar = 1; - aLen = (u8*)lenOne; - azChar = (unsigned char **)azOne; - zCharSet = 0; - }else if( (zCharSet = sqlite3_value_text(argv[1]))==0 ){ - return; - }else{ - const unsigned char *z; - for(z=zCharSet, nChar=0; *z; nChar++){ - SQLITE_SKIP_UTF8(z); - } - if( nChar>0 ){ - azChar = contextMalloc(context, ((i64)nChar)*(sizeof(char*)+1)); - if( azChar==0 ){ - return; - } - aLen = (unsigned char*)&azChar[nChar]; - for(z=zCharSet, nChar=0; *z; nChar++){ - azChar[nChar] = (unsigned char *)z; - SQLITE_SKIP_UTF8(z); - aLen[nChar] = (u8)(z - azChar[nChar]); - } - } - } - if( nChar>0 ){ - flags = SQLITE_PTR_TO_INT(sqlite3_user_data(context)); - if( flags & 1 ){ - while( nIn>0 ){ - int len = 0; - for(i=0; i=nChar ) break; - zIn += len; - nIn -= len; - } - } - if( flags & 2 ){ - while( nIn>0 ){ - int len = 0; - for(i=0; i=nChar ) break; - nIn -= len; - } - } - if( zCharSet ){ - sqlite3_free(azChar); - } - } - sqlite3_result_text(context, (char*)zIn, nIn, SQLITE_TRANSIENT); -} - - -/* IMP: R-25361-16150 This function is omitted from SQLite by default. It -** is only available if the SQLITE_SOUNDEX compile-time option is used -** when SQLite is built. -*/ -#ifdef SQLITE_SOUNDEX -/* -** Compute the soundex encoding of a word. -** -** IMP: R-59782-00072 The soundex(X) function returns a string that is the -** soundex encoding of the string X. -*/ -static void soundexFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - char zResult[8]; - const u8 *zIn; - int i, j; - static const unsigned char iCode[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0, - 1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0, - 0, 0, 1, 2, 3, 0, 1, 2, 0, 0, 2, 2, 4, 5, 5, 0, - 1, 2, 6, 2, 3, 0, 1, 0, 2, 0, 2, 0, 0, 0, 0, 0, - }; - assert( argc==1 ); - zIn = (u8*)sqlite3_value_text(argv[0]); - if( zIn==0 ) zIn = (u8*)""; - for(i=0; zIn[i] && !sqlite3Isalpha(zIn[i]); i++){} - if( zIn[i] ){ - u8 prevcode = iCode[zIn[i]&0x7f]; - zResult[0] = sqlite3Toupper(zIn[i]); - for(j=1; j<4 && zIn[i]; i++){ - int code = iCode[zIn[i]&0x7f]; - if( code>0 ){ - if( code!=prevcode ){ - prevcode = code; - zResult[j++] = code + '0'; - } - }else{ - prevcode = 0; - } - } - while( j<4 ){ - zResult[j++] = '0'; - } - zResult[j] = 0; - sqlite3_result_text(context, zResult, 4, SQLITE_TRANSIENT); - }else{ - /* IMP: R-64894-50321 The string "?000" is returned if the argument - ** is NULL or contains no ASCII alphabetic characters. */ - sqlite3_result_text(context, "?000", 4, SQLITE_STATIC); - } -} -#endif /* SQLITE_SOUNDEX */ - -#ifndef SQLITE_OMIT_LOAD_EXTENSION -/* -** A function that loads a shared-library extension then returns NULL. -*/ -static void loadExt(sqlite3_context *context, int argc, sqlite3_value **argv){ - const char *zFile = (const char *)sqlite3_value_text(argv[0]); - const char *zProc; - sqlite3 *db = sqlite3_context_db_handle(context); - char *zErrMsg = 0; - - if( argc==2 ){ - zProc = (const char *)sqlite3_value_text(argv[1]); - }else{ - zProc = 0; - } - if( zFile && sqlite3_load_extension(db, zFile, zProc, &zErrMsg) ){ - sqlite3_result_error(context, zErrMsg, -1); - sqlite3_free(zErrMsg); - } -} -#endif - - -/* -** An instance of the following structure holds the context of a -** sum() or avg() aggregate computation. -*/ -typedef struct SumCtx SumCtx; -struct SumCtx { - double rSum; /* Floating point sum */ - i64 iSum; /* Integer sum */ - i64 cnt; /* Number of elements summed */ - u8 overflow; /* True if integer overflow seen */ - u8 approx; /* True if non-integer value was input to the sum */ -}; - -/* -** Routines used to compute the sum, average, and total. -** -** The SUM() function follows the (broken) SQL standard which means -** that it returns NULL if it sums over no inputs. TOTAL returns -** 0.0 in that case. In addition, TOTAL always returns a float where -** SUM might return an integer if it never encounters a floating point -** value. TOTAL never fails, but SUM might through an exception if -** it overflows an integer. -*/ -static void sumStep(sqlite3_context *context, int argc, sqlite3_value **argv){ - SumCtx *p; - int type; - assert( argc==1 ); - UNUSED_PARAMETER(argc); - p = sqlite3_aggregate_context(context, sizeof(*p)); - type = sqlite3_value_numeric_type(argv[0]); - if( p && type!=SQLITE_NULL ){ - p->cnt++; - if( type==SQLITE_INTEGER ){ - i64 v = sqlite3_value_int64(argv[0]); - p->rSum += v; - if( (p->approx|p->overflow)==0 && sqlite3AddInt64(&p->iSum, v) ){ - p->overflow = 1; - } - }else{ - p->rSum += sqlite3_value_double(argv[0]); - p->approx = 1; - } - } -} -static void sumFinalize(sqlite3_context *context){ - SumCtx *p; - p = sqlite3_aggregate_context(context, 0); - if( p && p->cnt>0 ){ - if( p->overflow ){ - sqlite3_result_error(context,"integer overflow",-1); - }else if( p->approx ){ - sqlite3_result_double(context, p->rSum); - }else{ - sqlite3_result_int64(context, p->iSum); - } - } -} -static void avgFinalize(sqlite3_context *context){ - SumCtx *p; - p = sqlite3_aggregate_context(context, 0); - if( p && p->cnt>0 ){ - sqlite3_result_double(context, p->rSum/(double)p->cnt); - } -} -static void totalFinalize(sqlite3_context *context){ - SumCtx *p; - p = sqlite3_aggregate_context(context, 0); - /* (double)0 In case of SQLITE_OMIT_FLOATING_POINT... */ - sqlite3_result_double(context, p ? p->rSum : (double)0); -} - -/* -** The following structure keeps track of state information for the -** count() aggregate function. -*/ -typedef struct CountCtx CountCtx; -struct CountCtx { - i64 n; -}; - -/* -** Routines to implement the count() aggregate function. -*/ -static void countStep(sqlite3_context *context, int argc, sqlite3_value **argv){ - CountCtx *p; - p = sqlite3_aggregate_context(context, sizeof(*p)); - if( (argc==0 || SQLITE_NULL!=sqlite3_value_type(argv[0])) && p ){ - p->n++; - } - -#ifndef SQLITE_OMIT_DEPRECATED - /* The sqlite3_aggregate_count() function is deprecated. But just to make - ** sure it still operates correctly, verify that its count agrees with our - ** internal count when using count(*) and when the total count can be - ** expressed as a 32-bit integer. */ - assert( argc==1 || p==0 || p->n>0x7fffffff - || p->n==sqlite3_aggregate_count(context) ); -#endif -} -static void countFinalize(sqlite3_context *context){ - CountCtx *p; - p = sqlite3_aggregate_context(context, 0); - sqlite3_result_int64(context, p ? p->n : 0); -} - -/* -** Routines to implement min() and max() aggregate functions. -*/ -static void minmaxStep( - sqlite3_context *context, - int NotUsed, - sqlite3_value **argv -){ - Mem *pArg = (Mem *)argv[0]; - Mem *pBest; - UNUSED_PARAMETER(NotUsed); - - pBest = (Mem *)sqlite3_aggregate_context(context, sizeof(*pBest)); - if( !pBest ) return; - - if( sqlite3_value_type(argv[0])==SQLITE_NULL ){ - if( pBest->flags ) sqlite3SkipAccumulatorLoad(context); - }else if( pBest->flags ){ - int max; - int cmp; - CollSeq *pColl = sqlite3GetFuncCollSeq(context); - /* This step function is used for both the min() and max() aggregates, - ** the only difference between the two being that the sense of the - ** comparison is inverted. For the max() aggregate, the - ** sqlite3_user_data() function returns (void *)-1. For min() it - ** returns (void *)db, where db is the sqlite3* database pointer. - ** Therefore the next statement sets variable 'max' to 1 for the max() - ** aggregate, or 0 for min(). - */ - max = sqlite3_user_data(context)!=0; - cmp = sqlite3MemCompare(pBest, pArg, pColl); - if( (max && cmp<0) || (!max && cmp>0) ){ - sqlite3VdbeMemCopy(pBest, pArg); - }else{ - sqlite3SkipAccumulatorLoad(context); - } - }else{ - sqlite3VdbeMemCopy(pBest, pArg); - } -} -static void minMaxFinalize(sqlite3_context *context){ - sqlite3_value *pRes; - pRes = (sqlite3_value *)sqlite3_aggregate_context(context, 0); - if( pRes ){ - if( pRes->flags ){ - sqlite3_result_value(context, pRes); - } - sqlite3VdbeMemRelease(pRes); - } -} - -/* -** group_concat(EXPR, ?SEPARATOR?) -*/ -static void groupConcatStep( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const char *zVal; - StrAccum *pAccum; - const char *zSep; - int nVal, nSep; - assert( argc==1 || argc==2 ); - if( sqlite3_value_type(argv[0])==SQLITE_NULL ) return; - pAccum = (StrAccum*)sqlite3_aggregate_context(context, sizeof(*pAccum)); - - if( pAccum ){ - sqlite3 *db = sqlite3_context_db_handle(context); - int firstTerm = pAccum->useMalloc==0; - pAccum->useMalloc = 2; - pAccum->mxAlloc = db->aLimit[SQLITE_LIMIT_LENGTH]; - if( !firstTerm ){ - if( argc==2 ){ - zSep = (char*)sqlite3_value_text(argv[1]); - nSep = sqlite3_value_bytes(argv[1]); - }else{ - zSep = ","; - nSep = 1; - } - if( nSep ) sqlite3StrAccumAppend(pAccum, zSep, nSep); - } - zVal = (char*)sqlite3_value_text(argv[0]); - nVal = sqlite3_value_bytes(argv[0]); - if( nVal ) sqlite3StrAccumAppend(pAccum, zVal, nVal); - } -} -static void groupConcatFinalize(sqlite3_context *context){ - StrAccum *pAccum; - pAccum = sqlite3_aggregate_context(context, 0); - if( pAccum ){ - if( pAccum->accError==STRACCUM_TOOBIG ){ - sqlite3_result_error_toobig(context); - }else if( pAccum->accError==STRACCUM_NOMEM ){ - sqlite3_result_error_nomem(context); - }else{ - sqlite3_result_text(context, sqlite3StrAccumFinish(pAccum), -1, - sqlite3_free); - } - } -} - -/* -** This routine does per-connection function registration. Most -** of the built-in functions above are part of the global function set. -** This routine only deals with those that are not global. -*/ -SQLITE_PRIVATE void sqlite3RegisterBuiltinFunctions(sqlite3 *db){ - int rc = sqlite3_overload_function(db, "MATCH", 2); - assert( rc==SQLITE_NOMEM || rc==SQLITE_OK ); - if( rc==SQLITE_NOMEM ){ - db->mallocFailed = 1; - } -} - -/* -** Set the LIKEOPT flag on the 2-argument function with the given name. -*/ -static void setLikeOptFlag(sqlite3 *db, const char *zName, u8 flagVal){ - FuncDef *pDef; - pDef = sqlite3FindFunction(db, zName, sqlite3Strlen30(zName), - 2, SQLITE_UTF8, 0); - if( ALWAYS(pDef) ){ - pDef->funcFlags |= flagVal; - } -} - -/* -** Register the built-in LIKE and GLOB functions. The caseSensitive -** parameter determines whether or not the LIKE operator is case -** sensitive. GLOB is always case sensitive. -*/ -SQLITE_PRIVATE void sqlite3RegisterLikeFunctions(sqlite3 *db, int caseSensitive){ - struct compareInfo *pInfo; - if( caseSensitive ){ - pInfo = (struct compareInfo*)&likeInfoAlt; - }else{ - pInfo = (struct compareInfo*)&likeInfoNorm; - } - sqlite3CreateFunc(db, "like", 2, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0); - sqlite3CreateFunc(db, "like", 3, SQLITE_UTF8, pInfo, likeFunc, 0, 0, 0); - sqlite3CreateFunc(db, "glob", 2, SQLITE_UTF8, - (struct compareInfo*)&globInfo, likeFunc, 0, 0, 0); - setLikeOptFlag(db, "glob", SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE); - setLikeOptFlag(db, "like", - caseSensitive ? (SQLITE_FUNC_LIKE | SQLITE_FUNC_CASE) : SQLITE_FUNC_LIKE); -} - -/* -** pExpr points to an expression which implements a function. If -** it is appropriate to apply the LIKE optimization to that function -** then set aWc[0] through aWc[2] to the wildcard characters and -** return TRUE. If the function is not a LIKE-style function then -** return FALSE. -*/ -SQLITE_PRIVATE int sqlite3IsLikeFunction(sqlite3 *db, Expr *pExpr, int *pIsNocase, char *aWc){ - FuncDef *pDef; - if( pExpr->op!=TK_FUNCTION - || !pExpr->x.pList - || pExpr->x.pList->nExpr!=2 - ){ - return 0; - } - assert( !ExprHasProperty(pExpr, EP_xIsSelect) ); - pDef = sqlite3FindFunction(db, pExpr->u.zToken, - sqlite3Strlen30(pExpr->u.zToken), - 2, SQLITE_UTF8, 0); - if( NEVER(pDef==0) || (pDef->funcFlags & SQLITE_FUNC_LIKE)==0 ){ - return 0; - } - - /* The memcpy() statement assumes that the wildcard characters are - ** the first three statements in the compareInfo structure. The - ** asserts() that follow verify that assumption - */ - memcpy(aWc, pDef->pUserData, 3); - assert( (char*)&likeInfoAlt == (char*)&likeInfoAlt.matchAll ); - assert( &((char*)&likeInfoAlt)[1] == (char*)&likeInfoAlt.matchOne ); - assert( &((char*)&likeInfoAlt)[2] == (char*)&likeInfoAlt.matchSet ); - *pIsNocase = (pDef->funcFlags & SQLITE_FUNC_CASE)==0; - return 1; -} - -/* -** All all of the FuncDef structures in the aBuiltinFunc[] array above -** to the global function hash table. This occurs at start-time (as -** a consequence of calling sqlite3_initialize()). -** -** After this routine runs -*/ -SQLITE_PRIVATE void sqlite3RegisterGlobalFunctions(void){ - /* - ** The following array holds FuncDef structures for all of the functions - ** defined in this file. - ** - ** The array cannot be constant since changes are made to the - ** FuncDef.pHash elements at start-time. The elements of this array - ** are read-only after initialization is complete. - */ - static SQLITE_WSD FuncDef aBuiltinFunc[] = { - FUNCTION(ltrim, 1, 1, 0, trimFunc ), - FUNCTION(ltrim, 2, 1, 0, trimFunc ), - FUNCTION(rtrim, 1, 2, 0, trimFunc ), - FUNCTION(rtrim, 2, 2, 0, trimFunc ), - FUNCTION(trim, 1, 3, 0, trimFunc ), - FUNCTION(trim, 2, 3, 0, trimFunc ), - FUNCTION(min, -1, 0, 1, minmaxFunc ), - FUNCTION(min, 0, 0, 1, 0 ), - AGGREGATE(min, 1, 0, 1, minmaxStep, minMaxFinalize ), - FUNCTION(max, -1, 1, 1, minmaxFunc ), - FUNCTION(max, 0, 1, 1, 0 ), - AGGREGATE(max, 1, 1, 1, minmaxStep, minMaxFinalize ), - FUNCTION2(typeof, 1, 0, 0, typeofFunc, SQLITE_FUNC_TYPEOF), - FUNCTION2(length, 1, 0, 0, lengthFunc, SQLITE_FUNC_LENGTH), - FUNCTION(instr, 2, 0, 0, instrFunc ), - FUNCTION(substr, 2, 0, 0, substrFunc ), - FUNCTION(substr, 3, 0, 0, substrFunc ), - FUNCTION(printf, -1, 0, 0, printfFunc ), - FUNCTION(unicode, 1, 0, 0, unicodeFunc ), - FUNCTION(char, -1, 0, 0, charFunc ), - FUNCTION(abs, 1, 0, 0, absFunc ), -#ifndef SQLITE_OMIT_FLOATING_POINT - FUNCTION(round, 1, 0, 0, roundFunc ), - FUNCTION(round, 2, 0, 0, roundFunc ), -#endif - FUNCTION(upper, 1, 0, 0, upperFunc ), - FUNCTION(lower, 1, 0, 0, lowerFunc ), - FUNCTION(coalesce, 1, 0, 0, 0 ), - FUNCTION(coalesce, 0, 0, 0, 0 ), - FUNCTION2(coalesce, -1, 0, 0, noopFunc, SQLITE_FUNC_COALESCE), - FUNCTION(hex, 1, 0, 0, hexFunc ), - FUNCTION2(ifnull, 2, 0, 0, noopFunc, SQLITE_FUNC_COALESCE), - FUNCTION2(unlikely, 1, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY), - FUNCTION2(likelihood, 2, 0, 0, noopFunc, SQLITE_FUNC_UNLIKELY), - VFUNCTION(random, 0, 0, 0, randomFunc ), - VFUNCTION(randomblob, 1, 0, 0, randomBlob ), - FUNCTION(nullif, 2, 0, 1, nullifFunc ), - FUNCTION(sqlite_version, 0, 0, 0, versionFunc ), - FUNCTION(sqlite_source_id, 0, 0, 0, sourceidFunc ), - FUNCTION(sqlite_log, 2, 0, 0, errlogFunc ), -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS - FUNCTION(sqlite_compileoption_used,1, 0, 0, compileoptionusedFunc ), - FUNCTION(sqlite_compileoption_get, 1, 0, 0, compileoptiongetFunc ), -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ - FUNCTION(quote, 1, 0, 0, quoteFunc ), - VFUNCTION(last_insert_rowid, 0, 0, 0, last_insert_rowid), - VFUNCTION(changes, 0, 0, 0, changes ), - VFUNCTION(total_changes, 0, 0, 0, total_changes ), - FUNCTION(replace, 3, 0, 0, replaceFunc ), - FUNCTION(zeroblob, 1, 0, 0, zeroblobFunc ), - #ifdef SQLITE_SOUNDEX - FUNCTION(soundex, 1, 0, 0, soundexFunc ), - #endif - #ifndef SQLITE_OMIT_LOAD_EXTENSION - FUNCTION(load_extension, 1, 0, 0, loadExt ), - FUNCTION(load_extension, 2, 0, 0, loadExt ), - #endif - AGGREGATE(sum, 1, 0, 0, sumStep, sumFinalize ), - AGGREGATE(total, 1, 0, 0, sumStep, totalFinalize ), - AGGREGATE(avg, 1, 0, 0, sumStep, avgFinalize ), - /* AGGREGATE(count, 0, 0, 0, countStep, countFinalize ), */ - {0,SQLITE_UTF8|SQLITE_FUNC_COUNT,0,0,0,countStep,countFinalize,"count",0,0}, - AGGREGATE(count, 1, 0, 0, countStep, countFinalize ), - AGGREGATE(group_concat, 1, 0, 0, groupConcatStep, groupConcatFinalize), - AGGREGATE(group_concat, 2, 0, 0, groupConcatStep, groupConcatFinalize), - - LIKEFUNC(glob, 2, &globInfo, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), - #ifdef SQLITE_CASE_SENSITIVE_LIKE - LIKEFUNC(like, 2, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), - LIKEFUNC(like, 3, &likeInfoAlt, SQLITE_FUNC_LIKE|SQLITE_FUNC_CASE), - #else - LIKEFUNC(like, 2, &likeInfoNorm, SQLITE_FUNC_LIKE), - LIKEFUNC(like, 3, &likeInfoNorm, SQLITE_FUNC_LIKE), - #endif - }; - - int i; - FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions); - FuncDef *aFunc = (FuncDef*)&GLOBAL(FuncDef, aBuiltinFunc); - - for(i=0; idb->mallocFailed flag is set. -*/ -SQLITE_PRIVATE int sqlite3FkLocateIndex( - Parse *pParse, /* Parse context to store any error in */ - Table *pParent, /* Parent table of FK constraint pFKey */ - FKey *pFKey, /* Foreign key to find index for */ - Index **ppIdx, /* OUT: Unique index on parent table */ - int **paiCol /* OUT: Map of index columns in pFKey */ -){ - Index *pIdx = 0; /* Value to return via *ppIdx */ - int *aiCol = 0; /* Value to return via *paiCol */ - int nCol = pFKey->nCol; /* Number of columns in parent key */ - char *zKey = pFKey->aCol[0].zCol; /* Name of left-most parent key column */ - - /* The caller is responsible for zeroing output parameters. */ - assert( ppIdx && *ppIdx==0 ); - assert( !paiCol || *paiCol==0 ); - assert( pParse ); - - /* If this is a non-composite (single column) foreign key, check if it - ** maps to the INTEGER PRIMARY KEY of table pParent. If so, leave *ppIdx - ** and *paiCol set to zero and return early. - ** - ** Otherwise, for a composite foreign key (more than one column), allocate - ** space for the aiCol array (returned via output parameter *paiCol). - ** Non-composite foreign keys do not require the aiCol array. - */ - if( nCol==1 ){ - /* The FK maps to the IPK if any of the following are true: - ** - ** 1) There is an INTEGER PRIMARY KEY column and the FK is implicitly - ** mapped to the primary key of table pParent, or - ** 2) The FK is explicitly mapped to a column declared as INTEGER - ** PRIMARY KEY. - */ - if( pParent->iPKey>=0 ){ - if( !zKey ) return 0; - if( !sqlite3StrICmp(pParent->aCol[pParent->iPKey].zName, zKey) ) return 0; - } - }else if( paiCol ){ - assert( nCol>1 ); - aiCol = (int *)sqlite3DbMallocRaw(pParse->db, nCol*sizeof(int)); - if( !aiCol ) return 1; - *paiCol = aiCol; - } - - for(pIdx=pParent->pIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->nKeyCol==nCol && pIdx->onError!=OE_None ){ - /* pIdx is a UNIQUE index (or a PRIMARY KEY) and has the right number - ** of columns. If each indexed column corresponds to a foreign key - ** column of pFKey, then this index is a winner. */ - - if( zKey==0 ){ - /* If zKey is NULL, then this foreign key is implicitly mapped to - ** the PRIMARY KEY of table pParent. The PRIMARY KEY index may be - ** identified by the test (Index.autoIndex==2). */ - if( pIdx->autoIndex==2 ){ - if( aiCol ){ - int i; - for(i=0; iaCol[i].iFrom; - } - break; - } - }else{ - /* If zKey is non-NULL, then this foreign key was declared to - ** map to an explicit list of columns in table pParent. Check if this - ** index matches those columns. Also, check that the index uses - ** the default collation sequences for each column. */ - int i, j; - for(i=0; iaiColumn[i]; /* Index of column in parent tbl */ - char *zDfltColl; /* Def. collation for column */ - char *zIdxCol; /* Name of indexed column */ - - /* If the index uses a collation sequence that is different from - ** the default collation sequence for the column, this index is - ** unusable. Bail out early in this case. */ - zDfltColl = pParent->aCol[iCol].zColl; - if( !zDfltColl ){ - zDfltColl = "BINARY"; - } - if( sqlite3StrICmp(pIdx->azColl[i], zDfltColl) ) break; - - zIdxCol = pParent->aCol[iCol].zName; - for(j=0; jaCol[j].zCol, zIdxCol)==0 ){ - if( aiCol ) aiCol[i] = pFKey->aCol[j].iFrom; - break; - } - } - if( j==nCol ) break; - } - if( i==nCol ) break; /* pIdx is usable */ - } - } - } - - if( !pIdx ){ - if( !pParse->disableTriggers ){ - sqlite3ErrorMsg(pParse, - "foreign key mismatch - \"%w\" referencing \"%w\"", - pFKey->pFrom->zName, pFKey->zTo); - } - sqlite3DbFree(pParse->db, aiCol); - return 1; - } - - *ppIdx = pIdx; - return 0; -} - -/* -** This function is called when a row is inserted into or deleted from the -** child table of foreign key constraint pFKey. If an SQL UPDATE is executed -** on the child table of pFKey, this function is invoked twice for each row -** affected - once to "delete" the old row, and then again to "insert" the -** new row. -** -** Each time it is called, this function generates VDBE code to locate the -** row in the parent table that corresponds to the row being inserted into -** or deleted from the child table. If the parent row can be found, no -** special action is taken. Otherwise, if the parent row can *not* be -** found in the parent table: -** -** Operation | FK type | Action taken -** -------------------------------------------------------------------------- -** INSERT immediate Increment the "immediate constraint counter". -** -** DELETE immediate Decrement the "immediate constraint counter". -** -** INSERT deferred Increment the "deferred constraint counter". -** -** DELETE deferred Decrement the "deferred constraint counter". -** -** These operations are identified in the comment at the top of this file -** (fkey.c) as "I.1" and "D.1". -*/ -static void fkLookupParent( - Parse *pParse, /* Parse context */ - int iDb, /* Index of database housing pTab */ - Table *pTab, /* Parent table of FK pFKey */ - Index *pIdx, /* Unique index on parent key columns in pTab */ - FKey *pFKey, /* Foreign key constraint */ - int *aiCol, /* Map from parent key columns to child table columns */ - int regData, /* Address of array containing child table row */ - int nIncr, /* Increment constraint counter by this */ - int isIgnore /* If true, pretend pTab contains all NULL values */ -){ - int i; /* Iterator variable */ - Vdbe *v = sqlite3GetVdbe(pParse); /* Vdbe to add code to */ - int iCur = pParse->nTab - 1; /* Cursor number to use */ - int iOk = sqlite3VdbeMakeLabel(v); /* jump here if parent key found */ - - /* If nIncr is less than zero, then check at runtime if there are any - ** outstanding constraints to resolve. If there are not, there is no need - ** to check if deleting this row resolves any outstanding violations. - ** - ** Check if any of the key columns in the child table row are NULL. If - ** any are, then the constraint is considered satisfied. No need to - ** search for a matching row in the parent table. */ - if( nIncr<0 ){ - sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, iOk); - } - for(i=0; inCol; i++){ - int iReg = aiCol[i] + regData + 1; - sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iOk); - } - - if( isIgnore==0 ){ - if( pIdx==0 ){ - /* If pIdx is NULL, then the parent key is the INTEGER PRIMARY KEY - ** column of the parent table (table pTab). */ - int iMustBeInt; /* Address of MustBeInt instruction */ - int regTemp = sqlite3GetTempReg(pParse); - - /* Invoke MustBeInt to coerce the child key value to an integer (i.e. - ** apply the affinity of the parent key). If this fails, then there - ** is no matching parent key. Before using MustBeInt, make a copy of - ** the value. Otherwise, the value inserted into the child key column - ** will have INTEGER affinity applied to it, which may not be correct. */ - sqlite3VdbeAddOp2(v, OP_SCopy, aiCol[0]+1+regData, regTemp); - iMustBeInt = sqlite3VdbeAddOp2(v, OP_MustBeInt, regTemp, 0); - - /* If the parent table is the same as the child table, and we are about - ** to increment the constraint-counter (i.e. this is an INSERT operation), - ** then check if the row being inserted matches itself. If so, do not - ** increment the constraint-counter. */ - if( pTab==pFKey->pFrom && nIncr==1 ){ - sqlite3VdbeAddOp3(v, OP_Eq, regData, iOk, regTemp); - } - - sqlite3OpenTable(pParse, iCur, iDb, pTab, OP_OpenRead); - sqlite3VdbeAddOp3(v, OP_NotExists, iCur, 0, regTemp); - sqlite3VdbeAddOp2(v, OP_Goto, 0, iOk); - sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); - sqlite3VdbeJumpHere(v, iMustBeInt); - sqlite3ReleaseTempReg(pParse, regTemp); - }else{ - int nCol = pFKey->nCol; - int regTemp = sqlite3GetTempRange(pParse, nCol); - int regRec = sqlite3GetTempReg(pParse); - - sqlite3VdbeAddOp3(v, OP_OpenRead, iCur, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); - for(i=0; ipFrom && nIncr==1 ){ - int iJump = sqlite3VdbeCurrentAddr(v) + nCol + 1; - for(i=0; iaiColumn[i]+1+regData; - assert( aiCol[i]!=pTab->iPKey ); - if( pIdx->aiColumn[i]==pTab->iPKey ){ - /* The parent key is a composite key that includes the IPK column */ - iParent = regData; - } - sqlite3VdbeAddOp3(v, OP_Ne, iChild, iJump, iParent); - sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL); - } - sqlite3VdbeAddOp2(v, OP_Goto, 0, iOk); - } - - sqlite3VdbeAddOp3(v, OP_MakeRecord, regTemp, nCol, regRec); - sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v,pIdx), P4_TRANSIENT); - sqlite3VdbeAddOp4Int(v, OP_Found, iCur, iOk, regRec, 0); - - sqlite3ReleaseTempReg(pParse, regRec); - sqlite3ReleaseTempRange(pParse, regTemp, nCol); - } - } - - if( !pFKey->isDeferred && !(pParse->db->flags & SQLITE_DeferFKs) - && !pParse->pToplevel - && !pParse->isMultiWrite - ){ - /* Special case: If this is an INSERT statement that will insert exactly - ** one row into the table, raise a constraint immediately instead of - ** incrementing a counter. This is necessary as the VM code is being - ** generated for will not open a statement transaction. */ - assert( nIncr==1 ); - sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY, - OE_Abort, 0, P4_STATIC, P5_ConstraintFK); - }else{ - if( nIncr>0 && pFKey->isDeferred==0 ){ - sqlite3ParseToplevel(pParse)->mayAbort = 1; - } - sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); - } - - sqlite3VdbeResolveLabel(v, iOk); - sqlite3VdbeAddOp1(v, OP_Close, iCur); -} - - -/* -** Return an Expr object that refers to a memory register corresponding -** to column iCol of table pTab. -** -** regBase is the first of an array of register that contains the data -** for pTab. regBase itself holds the rowid. regBase+1 holds the first -** column. regBase+2 holds the second column, and so forth. -*/ -static Expr *exprTableRegister( - Parse *pParse, /* Parsing and code generating context */ - Table *pTab, /* The table whose content is at r[regBase]... */ - int regBase, /* Contents of table pTab */ - i16 iCol /* Which column of pTab is desired */ -){ - Expr *pExpr; - Column *pCol; - const char *zColl; - sqlite3 *db = pParse->db; - - pExpr = sqlite3Expr(db, TK_REGISTER, 0); - if( pExpr ){ - if( iCol>=0 && iCol!=pTab->iPKey ){ - pCol = &pTab->aCol[iCol]; - pExpr->iTable = regBase + iCol + 1; - pExpr->affinity = pCol->affinity; - zColl = pCol->zColl; - if( zColl==0 ) zColl = db->pDfltColl->zName; - pExpr = sqlite3ExprAddCollateString(pParse, pExpr, zColl); - }else{ - pExpr->iTable = regBase; - pExpr->affinity = SQLITE_AFF_INTEGER; - } - } - return pExpr; -} - -/* -** Return an Expr object that refers to column iCol of table pTab which -** has cursor iCur. -*/ -static Expr *exprTableColumn( - sqlite3 *db, /* The database connection */ - Table *pTab, /* The table whose column is desired */ - int iCursor, /* The open cursor on the table */ - i16 iCol /* The column that is wanted */ -){ - Expr *pExpr = sqlite3Expr(db, TK_COLUMN, 0); - if( pExpr ){ - pExpr->pTab = pTab; - pExpr->iTable = iCursor; - pExpr->iColumn = iCol; - } - return pExpr; -} - -/* -** This function is called to generate code executed when a row is deleted -** from the parent table of foreign key constraint pFKey and, if pFKey is -** deferred, when a row is inserted into the same table. When generating -** code for an SQL UPDATE operation, this function may be called twice - -** once to "delete" the old row and once to "insert" the new row. -** -** The code generated by this function scans through the rows in the child -** table that correspond to the parent table row being deleted or inserted. -** For each child row found, one of the following actions is taken: -** -** Operation | FK type | Action taken -** -------------------------------------------------------------------------- -** DELETE immediate Increment the "immediate constraint counter". -** Or, if the ON (UPDATE|DELETE) action is RESTRICT, -** throw a "FOREIGN KEY constraint failed" exception. -** -** INSERT immediate Decrement the "immediate constraint counter". -** -** DELETE deferred Increment the "deferred constraint counter". -** Or, if the ON (UPDATE|DELETE) action is RESTRICT, -** throw a "FOREIGN KEY constraint failed" exception. -** -** INSERT deferred Decrement the "deferred constraint counter". -** -** These operations are identified in the comment at the top of this file -** (fkey.c) as "I.2" and "D.2". -*/ -static void fkScanChildren( - Parse *pParse, /* Parse context */ - SrcList *pSrc, /* The child table to be scanned */ - Table *pTab, /* The parent table */ - Index *pIdx, /* Index on parent covering the foreign key */ - FKey *pFKey, /* The foreign key linking pSrc to pTab */ - int *aiCol, /* Map from pIdx cols to child table cols */ - int regData, /* Parent row data starts here */ - int nIncr /* Amount to increment deferred counter by */ -){ - sqlite3 *db = pParse->db; /* Database handle */ - int i; /* Iterator variable */ - Expr *pWhere = 0; /* WHERE clause to scan with */ - NameContext sNameContext; /* Context used to resolve WHERE clause */ - WhereInfo *pWInfo; /* Context used by sqlite3WhereXXX() */ - int iFkIfZero = 0; /* Address of OP_FkIfZero */ - Vdbe *v = sqlite3GetVdbe(pParse); - - assert( pIdx==0 || pIdx->pTable==pTab ); - assert( pIdx==0 || pIdx->nKeyCol==pFKey->nCol ); - assert( pIdx!=0 || pFKey->nCol==1 ); - assert( pIdx!=0 || HasRowid(pTab) ); - - if( nIncr<0 ){ - iFkIfZero = sqlite3VdbeAddOp2(v, OP_FkIfZero, pFKey->isDeferred, 0); - } - - /* Create an Expr object representing an SQL expression like: - ** - ** = AND = ... - ** - ** The collation sequence used for the comparison should be that of - ** the parent key columns. The affinity of the parent key column should - ** be applied to each child key value before the comparison takes place. - */ - for(i=0; inCol; i++){ - Expr *pLeft; /* Value from parent table row */ - Expr *pRight; /* Column ref to child table */ - Expr *pEq; /* Expression (pLeft = pRight) */ - i16 iCol; /* Index of column in child table */ - const char *zCol; /* Name of column in child table */ - - iCol = pIdx ? pIdx->aiColumn[i] : -1; - pLeft = exprTableRegister(pParse, pTab, regData, iCol); - iCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom; - assert( iCol>=0 ); - zCol = pFKey->pFrom->aCol[iCol].zName; - pRight = sqlite3Expr(db, TK_ID, zCol); - pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight, 0); - pWhere = sqlite3ExprAnd(db, pWhere, pEq); - } - - /* If the child table is the same as the parent table, then add terms - ** to the WHERE clause that prevent this entry from being scanned. - ** The added WHERE clause terms are like this: - ** - ** $current_rowid!=rowid - ** NOT( $current_a==a AND $current_b==b AND ... ) - ** - ** The first form is used for rowid tables. The second form is used - ** for WITHOUT ROWID tables. In the second form, the primary key is - ** (a,b,...) - */ - if( pTab==pFKey->pFrom && nIncr>0 ){ - Expr *pNe; /* Expression (pLeft != pRight) */ - Expr *pLeft; /* Value from parent table row */ - Expr *pRight; /* Column ref to child table */ - if( HasRowid(pTab) ){ - pLeft = exprTableRegister(pParse, pTab, regData, -1); - pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, -1); - pNe = sqlite3PExpr(pParse, TK_NE, pLeft, pRight, 0); - }else{ - Expr *pEq, *pAll = 0; - Index *pPk = sqlite3PrimaryKeyIndex(pTab); - assert( pIdx!=0 ); - for(i=0; inKeyCol; i++){ - i16 iCol = pIdx->aiColumn[i]; - pLeft = exprTableRegister(pParse, pTab, regData, iCol); - pRight = exprTableColumn(db, pTab, pSrc->a[0].iCursor, iCol); - pEq = sqlite3PExpr(pParse, TK_EQ, pLeft, pRight, 0); - pAll = sqlite3ExprAnd(db, pAll, pEq); - } - pNe = sqlite3PExpr(pParse, TK_NOT, pAll, 0, 0); - } - pWhere = sqlite3ExprAnd(db, pWhere, pNe); - } - - /* Resolve the references in the WHERE clause. */ - memset(&sNameContext, 0, sizeof(NameContext)); - sNameContext.pSrcList = pSrc; - sNameContext.pParse = pParse; - sqlite3ResolveExprNames(&sNameContext, pWhere); - - /* Create VDBE to loop through the entries in pSrc that match the WHERE - ** clause. If the constraint is not deferred, throw an exception for - ** each row found. Otherwise, for deferred constraints, increment the - ** deferred constraint counter by nIncr for each row selected. */ - pWInfo = sqlite3WhereBegin(pParse, pSrc, pWhere, 0, 0, 0, 0); - if( nIncr>0 && pFKey->isDeferred==0 ){ - sqlite3ParseToplevel(pParse)->mayAbort = 1; - } - sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, nIncr); - if( pWInfo ){ - sqlite3WhereEnd(pWInfo); - } - - /* Clean up the WHERE clause constructed above. */ - sqlite3ExprDelete(db, pWhere); - if( iFkIfZero ){ - sqlite3VdbeJumpHere(v, iFkIfZero); - } -} - -/* -** This function returns a linked list of FKey objects (connected by -** FKey.pNextTo) holding all children of table pTab. For example, -** given the following schema: -** -** CREATE TABLE t1(a PRIMARY KEY); -** CREATE TABLE t2(b REFERENCES t1(a); -** -** Calling this function with table "t1" as an argument returns a pointer -** to the FKey structure representing the foreign key constraint on table -** "t2". Calling this function with "t2" as the argument would return a -** NULL pointer (as there are no FK constraints for which t2 is the parent -** table). -*/ -SQLITE_PRIVATE FKey *sqlite3FkReferences(Table *pTab){ - int nName = sqlite3Strlen30(pTab->zName); - return (FKey *)sqlite3HashFind(&pTab->pSchema->fkeyHash, pTab->zName, nName); -} - -/* -** The second argument is a Trigger structure allocated by the -** fkActionTrigger() routine. This function deletes the Trigger structure -** and all of its sub-components. -** -** The Trigger structure or any of its sub-components may be allocated from -** the lookaside buffer belonging to database handle dbMem. -*/ -static void fkTriggerDelete(sqlite3 *dbMem, Trigger *p){ - if( p ){ - TriggerStep *pStep = p->step_list; - sqlite3ExprDelete(dbMem, pStep->pWhere); - sqlite3ExprListDelete(dbMem, pStep->pExprList); - sqlite3SelectDelete(dbMem, pStep->pSelect); - sqlite3ExprDelete(dbMem, p->pWhen); - sqlite3DbFree(dbMem, p); - } -} - -/* -** This function is called to generate code that runs when table pTab is -** being dropped from the database. The SrcList passed as the second argument -** to this function contains a single entry guaranteed to resolve to -** table pTab. -** -** Normally, no code is required. However, if either -** -** (a) The table is the parent table of a FK constraint, or -** (b) The table is the child table of a deferred FK constraint and it is -** determined at runtime that there are outstanding deferred FK -** constraint violations in the database, -** -** then the equivalent of "DELETE FROM " is executed before dropping -** the table from the database. Triggers are disabled while running this -** DELETE, but foreign key actions are not. -*/ -SQLITE_PRIVATE void sqlite3FkDropTable(Parse *pParse, SrcList *pName, Table *pTab){ - sqlite3 *db = pParse->db; - if( (db->flags&SQLITE_ForeignKeys) && !IsVirtual(pTab) && !pTab->pSelect ){ - int iSkip = 0; - Vdbe *v = sqlite3GetVdbe(pParse); - - assert( v ); /* VDBE has already been allocated */ - if( sqlite3FkReferences(pTab)==0 ){ - /* Search for a deferred foreign key constraint for which this table - ** is the child table. If one cannot be found, return without - ** generating any VDBE code. If one can be found, then jump over - ** the entire DELETE if there are no outstanding deferred constraints - ** when this statement is run. */ - FKey *p; - for(p=pTab->pFKey; p; p=p->pNextFrom){ - if( p->isDeferred || (db->flags & SQLITE_DeferFKs) ) break; - } - if( !p ) return; - iSkip = sqlite3VdbeMakeLabel(v); - sqlite3VdbeAddOp2(v, OP_FkIfZero, 1, iSkip); - } - - pParse->disableTriggers = 1; - sqlite3DeleteFrom(pParse, sqlite3SrcListDup(db, pName, 0), 0); - pParse->disableTriggers = 0; - - /* If the DELETE has generated immediate foreign key constraint - ** violations, halt the VDBE and return an error at this point, before - ** any modifications to the schema are made. This is because statement - ** transactions are not able to rollback schema changes. - ** - ** If the SQLITE_DeferFKs flag is set, then this is not required, as - ** the statement transaction will not be rolled back even if FK - ** constraints are violated. - */ - if( (db->flags & SQLITE_DeferFKs)==0 ){ - sqlite3VdbeAddOp2(v, OP_FkIfZero, 0, sqlite3VdbeCurrentAddr(v)+2); - sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_FOREIGNKEY, - OE_Abort, 0, P4_STATIC, P5_ConstraintFK); - } - - if( iSkip ){ - sqlite3VdbeResolveLabel(v, iSkip); - } - } -} - - -/* -** The second argument points to an FKey object representing a foreign key -** for which pTab is the child table. An UPDATE statement against pTab -** is currently being processed. For each column of the table that is -** actually updated, the corresponding element in the aChange[] array -** is zero or greater (if a column is unmodified the corresponding element -** is set to -1). If the rowid column is modified by the UPDATE statement -** the bChngRowid argument is non-zero. -** -** This function returns true if any of the columns that are part of the -** child key for FK constraint *p are modified. -*/ -static int fkChildIsModified( - Table *pTab, /* Table being updated */ - FKey *p, /* Foreign key for which pTab is the child */ - int *aChange, /* Array indicating modified columns */ - int bChngRowid /* True if rowid is modified by this update */ -){ - int i; - for(i=0; inCol; i++){ - int iChildKey = p->aCol[i].iFrom; - if( aChange[iChildKey]>=0 ) return 1; - if( iChildKey==pTab->iPKey && bChngRowid ) return 1; - } - return 0; -} - -/* -** The second argument points to an FKey object representing a foreign key -** for which pTab is the parent table. An UPDATE statement against pTab -** is currently being processed. For each column of the table that is -** actually updated, the corresponding element in the aChange[] array -** is zero or greater (if a column is unmodified the corresponding element -** is set to -1). If the rowid column is modified by the UPDATE statement -** the bChngRowid argument is non-zero. -** -** This function returns true if any of the columns that are part of the -** parent key for FK constraint *p are modified. -*/ -static int fkParentIsModified( - Table *pTab, - FKey *p, - int *aChange, - int bChngRowid -){ - int i; - for(i=0; inCol; i++){ - char *zKey = p->aCol[i].zCol; - int iKey; - for(iKey=0; iKeynCol; iKey++){ - if( aChange[iKey]>=0 || (iKey==pTab->iPKey && bChngRowid) ){ - Column *pCol = &pTab->aCol[iKey]; - if( zKey ){ - if( 0==sqlite3StrICmp(pCol->zName, zKey) ) return 1; - }else if( pCol->colFlags & COLFLAG_PRIMKEY ){ - return 1; - } - } - } - } - return 0; -} - -/* -** This function is called when inserting, deleting or updating a row of -** table pTab to generate VDBE code to perform foreign key constraint -** processing for the operation. -** -** For a DELETE operation, parameter regOld is passed the index of the -** first register in an array of (pTab->nCol+1) registers containing the -** rowid of the row being deleted, followed by each of the column values -** of the row being deleted, from left to right. Parameter regNew is passed -** zero in this case. -** -** For an INSERT operation, regOld is passed zero and regNew is passed the -** first register of an array of (pTab->nCol+1) registers containing the new -** row data. -** -** For an UPDATE operation, this function is called twice. Once before -** the original record is deleted from the table using the calling convention -** described for DELETE. Then again after the original record is deleted -** but before the new record is inserted using the INSERT convention. -*/ -SQLITE_PRIVATE void sqlite3FkCheck( - Parse *pParse, /* Parse context */ - Table *pTab, /* Row is being deleted from this table */ - int regOld, /* Previous row data is stored here */ - int regNew, /* New row data is stored here */ - int *aChange, /* Array indicating UPDATEd columns (or 0) */ - int bChngRowid /* True if rowid is UPDATEd */ -){ - sqlite3 *db = pParse->db; /* Database handle */ - FKey *pFKey; /* Used to iterate through FKs */ - int iDb; /* Index of database containing pTab */ - const char *zDb; /* Name of database containing pTab */ - int isIgnoreErrors = pParse->disableTriggers; - - /* Exactly one of regOld and regNew should be non-zero. */ - assert( (regOld==0)!=(regNew==0) ); - - /* If foreign-keys are disabled, this function is a no-op. */ - if( (db->flags&SQLITE_ForeignKeys)==0 ) return; - - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - zDb = db->aDb[iDb].zName; - - /* Loop through all the foreign key constraints for which pTab is the - ** child table (the table that the foreign key definition is part of). */ - for(pFKey=pTab->pFKey; pFKey; pFKey=pFKey->pNextFrom){ - Table *pTo; /* Parent table of foreign key pFKey */ - Index *pIdx = 0; /* Index on key columns in pTo */ - int *aiFree = 0; - int *aiCol; - int iCol; - int i; - int isIgnore = 0; - - if( aChange - && sqlite3_stricmp(pTab->zName, pFKey->zTo)!=0 - && fkChildIsModified(pTab, pFKey, aChange, bChngRowid)==0 - ){ - continue; - } - - /* Find the parent table of this foreign key. Also find a unique index - ** on the parent key columns in the parent table. If either of these - ** schema items cannot be located, set an error in pParse and return - ** early. */ - if( pParse->disableTriggers ){ - pTo = sqlite3FindTable(db, pFKey->zTo, zDb); - }else{ - pTo = sqlite3LocateTable(pParse, 0, pFKey->zTo, zDb); - } - if( !pTo || sqlite3FkLocateIndex(pParse, pTo, pFKey, &pIdx, &aiFree) ){ - assert( isIgnoreErrors==0 || (regOld!=0 && regNew==0) ); - if( !isIgnoreErrors || db->mallocFailed ) return; - if( pTo==0 ){ - /* If isIgnoreErrors is true, then a table is being dropped. In this - ** case SQLite runs a "DELETE FROM xxx" on the table being dropped - ** before actually dropping it in order to check FK constraints. - ** If the parent table of an FK constraint on the current table is - ** missing, behave as if it is empty. i.e. decrement the relevant - ** FK counter for each row of the current table with non-NULL keys. - */ - Vdbe *v = sqlite3GetVdbe(pParse); - int iJump = sqlite3VdbeCurrentAddr(v) + pFKey->nCol + 1; - for(i=0; inCol; i++){ - int iReg = pFKey->aCol[i].iFrom + regOld + 1; - sqlite3VdbeAddOp2(v, OP_IsNull, iReg, iJump); - } - sqlite3VdbeAddOp2(v, OP_FkCounter, pFKey->isDeferred, -1); - } - continue; - } - assert( pFKey->nCol==1 || (aiFree && pIdx) ); - - if( aiFree ){ - aiCol = aiFree; - }else{ - iCol = pFKey->aCol[0].iFrom; - aiCol = &iCol; - } - for(i=0; inCol; i++){ - if( aiCol[i]==pTab->iPKey ){ - aiCol[i] = -1; - } -#ifndef SQLITE_OMIT_AUTHORIZATION - /* Request permission to read the parent key columns. If the - ** authorization callback returns SQLITE_IGNORE, behave as if any - ** values read from the parent table are NULL. */ - if( db->xAuth ){ - int rcauth; - char *zCol = pTo->aCol[pIdx ? pIdx->aiColumn[i] : pTo->iPKey].zName; - rcauth = sqlite3AuthReadCol(pParse, pTo->zName, zCol, iDb); - isIgnore = (rcauth==SQLITE_IGNORE); - } -#endif - } - - /* Take a shared-cache advisory read-lock on the parent table. Allocate - ** a cursor to use to search the unique index on the parent key columns - ** in the parent table. */ - sqlite3TableLock(pParse, iDb, pTo->tnum, 0, pTo->zName); - pParse->nTab++; - - if( regOld!=0 ){ - /* A row is being removed from the child table. Search for the parent. - ** If the parent does not exist, removing the child row resolves an - ** outstanding foreign key constraint violation. */ - fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regOld, -1,isIgnore); - } - if( regNew!=0 ){ - /* A row is being added to the child table. If a parent row cannot - ** be found, adding the child row has violated the FK constraint. */ - fkLookupParent(pParse, iDb, pTo, pIdx, pFKey, aiCol, regNew, +1,isIgnore); - } - - sqlite3DbFree(db, aiFree); - } - - /* Loop through all the foreign key constraints that refer to this table. - ** (the "child" constraints) */ - for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){ - Index *pIdx = 0; /* Foreign key index for pFKey */ - SrcList *pSrc; - int *aiCol = 0; - - if( aChange && fkParentIsModified(pTab, pFKey, aChange, bChngRowid)==0 ){ - continue; - } - - if( !pFKey->isDeferred && !(db->flags & SQLITE_DeferFKs) - && !pParse->pToplevel && !pParse->isMultiWrite - ){ - assert( regOld==0 && regNew!=0 ); - /* Inserting a single row into a parent table cannot cause an immediate - ** foreign key violation. So do nothing in this case. */ - continue; - } - - if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ){ - if( !isIgnoreErrors || db->mallocFailed ) return; - continue; - } - assert( aiCol || pFKey->nCol==1 ); - - /* Create a SrcList structure containing the child table. We need the - ** child table as a SrcList for sqlite3WhereBegin() */ - pSrc = sqlite3SrcListAppend(db, 0, 0, 0); - if( pSrc ){ - struct SrcList_item *pItem = pSrc->a; - pItem->pTab = pFKey->pFrom; - pItem->zName = pFKey->pFrom->zName; - pItem->pTab->nRef++; - pItem->iCursor = pParse->nTab++; - - if( regNew!=0 ){ - fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regNew, -1); - } - if( regOld!=0 ){ - /* If there is a RESTRICT action configured for the current operation - ** on the parent table of this FK, then throw an exception - ** immediately if the FK constraint is violated, even if this is a - ** deferred trigger. That's what RESTRICT means. To defer checking - ** the constraint, the FK should specify NO ACTION (represented - ** using OE_None). NO ACTION is the default. */ - fkScanChildren(pParse, pSrc, pTab, pIdx, pFKey, aiCol, regOld, 1); - } - pItem->zName = 0; - sqlite3SrcListDelete(db, pSrc); - } - sqlite3DbFree(db, aiCol); - } -} - -#define COLUMN_MASK(x) (((x)>31) ? 0xffffffff : ((u32)1<<(x))) - -/* -** This function is called before generating code to update or delete a -** row contained in table pTab. -*/ -SQLITE_PRIVATE u32 sqlite3FkOldmask( - Parse *pParse, /* Parse context */ - Table *pTab /* Table being modified */ -){ - u32 mask = 0; - if( pParse->db->flags&SQLITE_ForeignKeys ){ - FKey *p; - int i; - for(p=pTab->pFKey; p; p=p->pNextFrom){ - for(i=0; inCol; i++) mask |= COLUMN_MASK(p->aCol[i].iFrom); - } - for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ - Index *pIdx = 0; - sqlite3FkLocateIndex(pParse, pTab, p, &pIdx, 0); - if( pIdx ){ - for(i=0; inKeyCol; i++) mask |= COLUMN_MASK(pIdx->aiColumn[i]); - } - } - } - return mask; -} - - -/* -** This function is called before generating code to update or delete a -** row contained in table pTab. If the operation is a DELETE, then -** parameter aChange is passed a NULL value. For an UPDATE, aChange points -** to an array of size N, where N is the number of columns in table pTab. -** If the i'th column is not modified by the UPDATE, then the corresponding -** entry in the aChange[] array is set to -1. If the column is modified, -** the value is 0 or greater. Parameter chngRowid is set to true if the -** UPDATE statement modifies the rowid fields of the table. -** -** If any foreign key processing will be required, this function returns -** true. If there is no foreign key related processing, this function -** returns false. -*/ -SQLITE_PRIVATE int sqlite3FkRequired( - Parse *pParse, /* Parse context */ - Table *pTab, /* Table being modified */ - int *aChange, /* Non-NULL for UPDATE operations */ - int chngRowid /* True for UPDATE that affects rowid */ -){ - if( pParse->db->flags&SQLITE_ForeignKeys ){ - if( !aChange ){ - /* A DELETE operation. Foreign key processing is required if the - ** table in question is either the child or parent table for any - ** foreign key constraint. */ - return (sqlite3FkReferences(pTab) || pTab->pFKey); - }else{ - /* This is an UPDATE. Foreign key processing is only required if the - ** operation modifies one or more child or parent key columns. */ - FKey *p; - - /* Check if any child key columns are being modified. */ - for(p=pTab->pFKey; p; p=p->pNextFrom){ - if( fkChildIsModified(pTab, p, aChange, chngRowid) ) return 1; - } - - /* Check if any parent key columns are being modified. */ - for(p=sqlite3FkReferences(pTab); p; p=p->pNextTo){ - if( fkParentIsModified(pTab, p, aChange, chngRowid) ) return 1; - } - } - } - return 0; -} - -/* -** This function is called when an UPDATE or DELETE operation is being -** compiled on table pTab, which is the parent table of foreign-key pFKey. -** If the current operation is an UPDATE, then the pChanges parameter is -** passed a pointer to the list of columns being modified. If it is a -** DELETE, pChanges is passed a NULL pointer. -** -** It returns a pointer to a Trigger structure containing a trigger -** equivalent to the ON UPDATE or ON DELETE action specified by pFKey. -** If the action is "NO ACTION" or "RESTRICT", then a NULL pointer is -** returned (these actions require no special handling by the triggers -** sub-system, code for them is created by fkScanChildren()). -** -** For example, if pFKey is the foreign key and pTab is table "p" in -** the following schema: -** -** CREATE TABLE p(pk PRIMARY KEY); -** CREATE TABLE c(ck REFERENCES p ON DELETE CASCADE); -** -** then the returned trigger structure is equivalent to: -** -** CREATE TRIGGER ... DELETE ON p BEGIN -** DELETE FROM c WHERE ck = old.pk; -** END; -** -** The returned pointer is cached as part of the foreign key object. It -** is eventually freed along with the rest of the foreign key object by -** sqlite3FkDelete(). -*/ -static Trigger *fkActionTrigger( - Parse *pParse, /* Parse context */ - Table *pTab, /* Table being updated or deleted from */ - FKey *pFKey, /* Foreign key to get action for */ - ExprList *pChanges /* Change-list for UPDATE, NULL for DELETE */ -){ - sqlite3 *db = pParse->db; /* Database handle */ - int action; /* One of OE_None, OE_Cascade etc. */ - Trigger *pTrigger; /* Trigger definition to return */ - int iAction = (pChanges!=0); /* 1 for UPDATE, 0 for DELETE */ - - action = pFKey->aAction[iAction]; - pTrigger = pFKey->apTrigger[iAction]; - - if( action!=OE_None && !pTrigger ){ - u8 enableLookaside; /* Copy of db->lookaside.bEnabled */ - char const *zFrom; /* Name of child table */ - int nFrom; /* Length in bytes of zFrom */ - Index *pIdx = 0; /* Parent key index for this FK */ - int *aiCol = 0; /* child table cols -> parent key cols */ - TriggerStep *pStep = 0; /* First (only) step of trigger program */ - Expr *pWhere = 0; /* WHERE clause of trigger step */ - ExprList *pList = 0; /* Changes list if ON UPDATE CASCADE */ - Select *pSelect = 0; /* If RESTRICT, "SELECT RAISE(...)" */ - int i; /* Iterator variable */ - Expr *pWhen = 0; /* WHEN clause for the trigger */ - - if( sqlite3FkLocateIndex(pParse, pTab, pFKey, &pIdx, &aiCol) ) return 0; - assert( aiCol || pFKey->nCol==1 ); - - for(i=0; inCol; i++){ - Token tOld = { "old", 3 }; /* Literal "old" token */ - Token tNew = { "new", 3 }; /* Literal "new" token */ - Token tFromCol; /* Name of column in child table */ - Token tToCol; /* Name of column in parent table */ - int iFromCol; /* Idx of column in child table */ - Expr *pEq; /* tFromCol = OLD.tToCol */ - - iFromCol = aiCol ? aiCol[i] : pFKey->aCol[0].iFrom; - assert( iFromCol>=0 ); - tToCol.z = pIdx ? pTab->aCol[pIdx->aiColumn[i]].zName : "oid"; - tFromCol.z = pFKey->pFrom->aCol[iFromCol].zName; - - tToCol.n = sqlite3Strlen30(tToCol.z); - tFromCol.n = sqlite3Strlen30(tFromCol.z); - - /* Create the expression "OLD.zToCol = zFromCol". It is important - ** that the "OLD.zToCol" term is on the LHS of the = operator, so - ** that the affinity and collation sequence associated with the - ** parent table are used for the comparison. */ - pEq = sqlite3PExpr(pParse, TK_EQ, - sqlite3PExpr(pParse, TK_DOT, - sqlite3PExpr(pParse, TK_ID, 0, 0, &tOld), - sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol) - , 0), - sqlite3PExpr(pParse, TK_ID, 0, 0, &tFromCol) - , 0); - pWhere = sqlite3ExprAnd(db, pWhere, pEq); - - /* For ON UPDATE, construct the next term of the WHEN clause. - ** The final WHEN clause will be like this: - ** - ** WHEN NOT(old.col1 IS new.col1 AND ... AND old.colN IS new.colN) - */ - if( pChanges ){ - pEq = sqlite3PExpr(pParse, TK_IS, - sqlite3PExpr(pParse, TK_DOT, - sqlite3PExpr(pParse, TK_ID, 0, 0, &tOld), - sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol), - 0), - sqlite3PExpr(pParse, TK_DOT, - sqlite3PExpr(pParse, TK_ID, 0, 0, &tNew), - sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol), - 0), - 0); - pWhen = sqlite3ExprAnd(db, pWhen, pEq); - } - - if( action!=OE_Restrict && (action!=OE_Cascade || pChanges) ){ - Expr *pNew; - if( action==OE_Cascade ){ - pNew = sqlite3PExpr(pParse, TK_DOT, - sqlite3PExpr(pParse, TK_ID, 0, 0, &tNew), - sqlite3PExpr(pParse, TK_ID, 0, 0, &tToCol) - , 0); - }else if( action==OE_SetDflt ){ - Expr *pDflt = pFKey->pFrom->aCol[iFromCol].pDflt; - if( pDflt ){ - pNew = sqlite3ExprDup(db, pDflt, 0); - }else{ - pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0); - } - }else{ - pNew = sqlite3PExpr(pParse, TK_NULL, 0, 0, 0); - } - pList = sqlite3ExprListAppend(pParse, pList, pNew); - sqlite3ExprListSetName(pParse, pList, &tFromCol, 0); - } - } - sqlite3DbFree(db, aiCol); - - zFrom = pFKey->pFrom->zName; - nFrom = sqlite3Strlen30(zFrom); - - if( action==OE_Restrict ){ - Token tFrom; - Expr *pRaise; - - tFrom.z = zFrom; - tFrom.n = nFrom; - pRaise = sqlite3Expr(db, TK_RAISE, "FOREIGN KEY constraint failed"); - if( pRaise ){ - pRaise->affinity = OE_Abort; - } - pSelect = sqlite3SelectNew(pParse, - sqlite3ExprListAppend(pParse, 0, pRaise), - sqlite3SrcListAppend(db, 0, &tFrom, 0), - pWhere, - 0, 0, 0, 0, 0, 0 - ); - pWhere = 0; - } - - /* Disable lookaside memory allocation */ - enableLookaside = db->lookaside.bEnabled; - db->lookaside.bEnabled = 0; - - pTrigger = (Trigger *)sqlite3DbMallocZero(db, - sizeof(Trigger) + /* struct Trigger */ - sizeof(TriggerStep) + /* Single step in trigger program */ - nFrom + 1 /* Space for pStep->target.z */ - ); - if( pTrigger ){ - pStep = pTrigger->step_list = (TriggerStep *)&pTrigger[1]; - pStep->target.z = (char *)&pStep[1]; - pStep->target.n = nFrom; - memcpy((char *)pStep->target.z, zFrom, nFrom); - - pStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); - pStep->pExprList = sqlite3ExprListDup(db, pList, EXPRDUP_REDUCE); - pStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); - if( pWhen ){ - pWhen = sqlite3PExpr(pParse, TK_NOT, pWhen, 0, 0); - pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); - } - } - - /* Re-enable the lookaside buffer, if it was disabled earlier. */ - db->lookaside.bEnabled = enableLookaside; - - sqlite3ExprDelete(db, pWhere); - sqlite3ExprDelete(db, pWhen); - sqlite3ExprListDelete(db, pList); - sqlite3SelectDelete(db, pSelect); - if( db->mallocFailed==1 ){ - fkTriggerDelete(db, pTrigger); - return 0; - } - assert( pStep!=0 ); - - switch( action ){ - case OE_Restrict: - pStep->op = TK_SELECT; - break; - case OE_Cascade: - if( !pChanges ){ - pStep->op = TK_DELETE; - break; - } - default: - pStep->op = TK_UPDATE; - } - pStep->pTrig = pTrigger; - pTrigger->pSchema = pTab->pSchema; - pTrigger->pTabSchema = pTab->pSchema; - pFKey->apTrigger[iAction] = pTrigger; - pTrigger->op = (pChanges ? TK_UPDATE : TK_DELETE); - } - - return pTrigger; -} - -/* -** This function is called when deleting or updating a row to implement -** any required CASCADE, SET NULL or SET DEFAULT actions. -*/ -SQLITE_PRIVATE void sqlite3FkActions( - Parse *pParse, /* Parse context */ - Table *pTab, /* Table being updated or deleted from */ - ExprList *pChanges, /* Change-list for UPDATE, NULL for DELETE */ - int regOld, /* Address of array containing old row */ - int *aChange, /* Array indicating UPDATEd columns (or 0) */ - int bChngRowid /* True if rowid is UPDATEd */ -){ - /* If foreign-key support is enabled, iterate through all FKs that - ** refer to table pTab. If there is an action associated with the FK - ** for this operation (either update or delete), invoke the associated - ** trigger sub-program. */ - if( pParse->db->flags&SQLITE_ForeignKeys ){ - FKey *pFKey; /* Iterator variable */ - for(pFKey = sqlite3FkReferences(pTab); pFKey; pFKey=pFKey->pNextTo){ - if( aChange==0 || fkParentIsModified(pTab, pFKey, aChange, bChngRowid) ){ - Trigger *pAct = fkActionTrigger(pParse, pTab, pFKey, pChanges); - if( pAct ){ - sqlite3CodeRowTriggerDirect(pParse, pAct, pTab, regOld, OE_Abort, 0); - } - } - } - } -} - -#endif /* ifndef SQLITE_OMIT_TRIGGER */ - -/* -** Free all memory associated with foreign key definitions attached to -** table pTab. Remove the deleted foreign keys from the Schema.fkeyHash -** hash table. -*/ -SQLITE_PRIVATE void sqlite3FkDelete(sqlite3 *db, Table *pTab){ - FKey *pFKey; /* Iterator variable */ - FKey *pNext; /* Copy of pFKey->pNextFrom */ - - assert( db==0 || sqlite3SchemaMutexHeld(db, 0, pTab->pSchema) ); - for(pFKey=pTab->pFKey; pFKey; pFKey=pNext){ - - /* Remove the FK from the fkeyHash hash table. */ - if( !db || db->pnBytesFreed==0 ){ - if( pFKey->pPrevTo ){ - pFKey->pPrevTo->pNextTo = pFKey->pNextTo; - }else{ - void *p = (void *)pFKey->pNextTo; - const char *z = (p ? pFKey->pNextTo->zTo : pFKey->zTo); - sqlite3HashInsert(&pTab->pSchema->fkeyHash, z, sqlite3Strlen30(z), p); - } - if( pFKey->pNextTo ){ - pFKey->pNextTo->pPrevTo = pFKey->pPrevTo; - } - } - - /* EV: R-30323-21917 Each foreign key constraint in SQLite is - ** classified as either immediate or deferred. - */ - assert( pFKey->isDeferred==0 || pFKey->isDeferred==1 ); - - /* Delete any triggers created to implement actions for this FK. */ -#ifndef SQLITE_OMIT_TRIGGER - fkTriggerDelete(db, pFKey->apTrigger[0]); - fkTriggerDelete(db, pFKey->apTrigger[1]); -#endif - - pNext = pFKey->pNextFrom; - sqlite3DbFree(db, pFKey); - } -} -#endif /* ifndef SQLITE_OMIT_FOREIGN_KEY */ - -/************** End of fkey.c ************************************************/ -/************** Begin file insert.c ******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains C code routines that are called by the parser -** to handle INSERT statements in SQLite. -*/ - -/* -** Generate code that will -** -** (1) acquire a lock for table pTab then -** (2) open pTab as cursor iCur. -** -** If pTab is a WITHOUT ROWID table, then it is the PRIMARY KEY index -** for that table that is actually opened. -*/ -SQLITE_PRIVATE void sqlite3OpenTable( - Parse *pParse, /* Generate code into this VDBE */ - int iCur, /* The cursor number of the table */ - int iDb, /* The database index in sqlite3.aDb[] */ - Table *pTab, /* The table to be opened */ - int opcode /* OP_OpenRead or OP_OpenWrite */ -){ - Vdbe *v; - assert( !IsVirtual(pTab) ); - v = sqlite3GetVdbe(pParse); - assert( opcode==OP_OpenWrite || opcode==OP_OpenRead ); - sqlite3TableLock(pParse, iDb, pTab->tnum, - (opcode==OP_OpenWrite)?1:0, pTab->zName); - if( HasRowid(pTab) ){ - sqlite3VdbeAddOp4Int(v, opcode, iCur, pTab->tnum, iDb, pTab->nCol); - VdbeComment((v, "%s", pTab->zName)); - }else{ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); - assert( pPk!=0 ); - assert( pPk->tnum=pTab->tnum ); - sqlite3VdbeAddOp3(v, opcode, iCur, pPk->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pPk); - VdbeComment((v, "%s", pTab->zName)); - } -} - -/* -** Return a pointer to the column affinity string associated with index -** pIdx. A column affinity string has one character for each column in -** the table, according to the affinity of the column: -** -** Character Column affinity -** ------------------------------ -** 'a' TEXT -** 'b' NONE -** 'c' NUMERIC -** 'd' INTEGER -** 'e' REAL -** -** An extra 'd' is appended to the end of the string to cover the -** rowid that appears as the last column in every index. -** -** Memory for the buffer containing the column index affinity string -** is managed along with the rest of the Index structure. It will be -** released when sqlite3DeleteIndex() is called. -*/ -SQLITE_PRIVATE const char *sqlite3IndexAffinityStr(Vdbe *v, Index *pIdx){ - if( !pIdx->zColAff ){ - /* The first time a column affinity string for a particular index is - ** required, it is allocated and populated here. It is then stored as - ** a member of the Index structure for subsequent use. - ** - ** The column affinity string will eventually be deleted by - ** sqliteDeleteIndex() when the Index structure itself is cleaned - ** up. - */ - int n; - Table *pTab = pIdx->pTable; - sqlite3 *db = sqlite3VdbeDb(v); - pIdx->zColAff = (char *)sqlite3DbMallocRaw(0, pIdx->nColumn+1); - if( !pIdx->zColAff ){ - db->mallocFailed = 1; - return 0; - } - for(n=0; nnColumn; n++){ - i16 x = pIdx->aiColumn[n]; - pIdx->zColAff[n] = x<0 ? SQLITE_AFF_INTEGER : pTab->aCol[x].affinity; - } - pIdx->zColAff[n] = 0; - } - - return pIdx->zColAff; -} - -/* -** Set P4 of the most recently inserted opcode to a column affinity -** string for table pTab. A column affinity string has one character -** for each column indexed by the index, according to the affinity of the -** column: -** -** Character Column affinity -** ------------------------------ -** 'a' TEXT -** 'b' NONE -** 'c' NUMERIC -** 'd' INTEGER -** 'e' REAL -*/ -SQLITE_PRIVATE void sqlite3TableAffinityStr(Vdbe *v, Table *pTab){ - /* The first time a column affinity string for a particular table - ** is required, it is allocated and populated here. It is then - ** stored as a member of the Table structure for subsequent use. - ** - ** The column affinity string will eventually be deleted by - ** sqlite3DeleteTable() when the Table structure itself is cleaned up. - */ - if( !pTab->zColAff ){ - char *zColAff; - int i; - sqlite3 *db = sqlite3VdbeDb(v); - - zColAff = (char *)sqlite3DbMallocRaw(0, pTab->nCol+1); - if( !zColAff ){ - db->mallocFailed = 1; - return; - } - - for(i=0; inCol; i++){ - zColAff[i] = pTab->aCol[i].affinity; - } - zColAff[pTab->nCol] = '\0'; - - pTab->zColAff = zColAff; - } - - sqlite3VdbeChangeP4(v, -1, pTab->zColAff, P4_TRANSIENT); -} - -/* -** Return non-zero if the table pTab in database iDb or any of its indices -** have been opened at any point in the VDBE program beginning at location -** iStartAddr throught the end of the program. This is used to see if -** a statement of the form "INSERT INTO SELECT ..." can -** run without using temporary table for the results of the SELECT. -*/ -static int readsTable(Parse *p, int iStartAddr, int iDb, Table *pTab){ - Vdbe *v = sqlite3GetVdbe(p); - int i; - int iEnd = sqlite3VdbeCurrentAddr(v); -#ifndef SQLITE_OMIT_VIRTUALTABLE - VTable *pVTab = IsVirtual(pTab) ? sqlite3GetVTable(p->db, pTab) : 0; -#endif - - for(i=iStartAddr; iopcode==OP_OpenRead && pOp->p3==iDb ){ - Index *pIndex; - int tnum = pOp->p2; - if( tnum==pTab->tnum ){ - return 1; - } - for(pIndex=pTab->pIndex; pIndex; pIndex=pIndex->pNext){ - if( tnum==pIndex->tnum ){ - return 1; - } - } - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( pOp->opcode==OP_VOpen && pOp->p4.pVtab==pVTab ){ - assert( pOp->p4.pVtab!=0 ); - assert( pOp->p4type==P4_VTAB ); - return 1; - } -#endif - } - return 0; -} - -#ifndef SQLITE_OMIT_AUTOINCREMENT -/* -** Locate or create an AutoincInfo structure associated with table pTab -** which is in database iDb. Return the register number for the register -** that holds the maximum rowid. -** -** There is at most one AutoincInfo structure per table even if the -** same table is autoincremented multiple times due to inserts within -** triggers. A new AutoincInfo structure is created if this is the -** first use of table pTab. On 2nd and subsequent uses, the original -** AutoincInfo structure is used. -** -** Three memory locations are allocated: -** -** (1) Register to hold the name of the pTab table. -** (2) Register to hold the maximum ROWID of pTab. -** (3) Register to hold the rowid in sqlite_sequence of pTab -** -** The 2nd register is the one that is returned. That is all the -** insert routine needs to know about. -*/ -static int autoIncBegin( - Parse *pParse, /* Parsing context */ - int iDb, /* Index of the database holding pTab */ - Table *pTab /* The table we are writing to */ -){ - int memId = 0; /* Register holding maximum rowid */ - if( pTab->tabFlags & TF_Autoincrement ){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - AutoincInfo *pInfo; - - pInfo = pToplevel->pAinc; - while( pInfo && pInfo->pTab!=pTab ){ pInfo = pInfo->pNext; } - if( pInfo==0 ){ - pInfo = sqlite3DbMallocRaw(pParse->db, sizeof(*pInfo)); - if( pInfo==0 ) return 0; - pInfo->pNext = pToplevel->pAinc; - pToplevel->pAinc = pInfo; - pInfo->pTab = pTab; - pInfo->iDb = iDb; - pToplevel->nMem++; /* Register to hold name of table */ - pInfo->regCtr = ++pToplevel->nMem; /* Max rowid register */ - pToplevel->nMem++; /* Rowid in sqlite_sequence */ - } - memId = pInfo->regCtr; - } - return memId; -} - -/* -** This routine generates code that will initialize all of the -** register used by the autoincrement tracker. -*/ -SQLITE_PRIVATE void sqlite3AutoincrementBegin(Parse *pParse){ - AutoincInfo *p; /* Information about an AUTOINCREMENT */ - sqlite3 *db = pParse->db; /* The database connection */ - Db *pDb; /* Database only autoinc table */ - int memId; /* Register holding max rowid */ - int addr; /* A VDBE address */ - Vdbe *v = pParse->pVdbe; /* VDBE under construction */ - - /* This routine is never called during trigger-generation. It is - ** only called from the top-level */ - assert( pParse->pTriggerTab==0 ); - assert( pParse==sqlite3ParseToplevel(pParse) ); - - assert( v ); /* We failed long ago if this is not so */ - for(p = pParse->pAinc; p; p = p->pNext){ - pDb = &db->aDb[p->iDb]; - memId = p->regCtr; - assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) ); - sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenRead); - sqlite3VdbeAddOp3(v, OP_Null, 0, memId, memId+1); - addr = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp4(v, OP_String8, 0, memId-1, 0, p->pTab->zName, 0); - sqlite3VdbeAddOp2(v, OP_Rewind, 0, addr+9); - sqlite3VdbeAddOp3(v, OP_Column, 0, 0, memId); - sqlite3VdbeAddOp3(v, OP_Ne, memId-1, addr+7, memId); - sqlite3VdbeChangeP5(v, SQLITE_JUMPIFNULL); - sqlite3VdbeAddOp2(v, OP_Rowid, 0, memId+1); - sqlite3VdbeAddOp3(v, OP_Column, 0, 1, memId); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addr+9); - sqlite3VdbeAddOp2(v, OP_Next, 0, addr+2); - sqlite3VdbeAddOp2(v, OP_Integer, 0, memId); - sqlite3VdbeAddOp0(v, OP_Close); - } -} - -/* -** Update the maximum rowid for an autoincrement calculation. -** -** This routine should be called when the top of the stack holds a -** new rowid that is about to be inserted. If that new rowid is -** larger than the maximum rowid in the memId memory cell, then the -** memory cell is updated. The stack is unchanged. -*/ -static void autoIncStep(Parse *pParse, int memId, int regRowid){ - if( memId>0 ){ - sqlite3VdbeAddOp2(pParse->pVdbe, OP_MemMax, memId, regRowid); - } -} - -/* -** This routine generates the code needed to write autoincrement -** maximum rowid values back into the sqlite_sequence register. -** Every statement that might do an INSERT into an autoincrement -** table (either directly or through triggers) needs to call this -** routine just before the "exit" code. -*/ -SQLITE_PRIVATE void sqlite3AutoincrementEnd(Parse *pParse){ - AutoincInfo *p; - Vdbe *v = pParse->pVdbe; - sqlite3 *db = pParse->db; - - assert( v ); - for(p = pParse->pAinc; p; p = p->pNext){ - Db *pDb = &db->aDb[p->iDb]; - int j1, j2, j3, j4, j5; - int iRec; - int memId = p->regCtr; - - iRec = sqlite3GetTempReg(pParse); - assert( sqlite3SchemaMutexHeld(db, 0, pDb->pSchema) ); - sqlite3OpenTable(pParse, 0, p->iDb, pDb->pSchema->pSeqTab, OP_OpenWrite); - j1 = sqlite3VdbeAddOp1(v, OP_NotNull, memId+1); - j2 = sqlite3VdbeAddOp0(v, OP_Rewind); - j3 = sqlite3VdbeAddOp3(v, OP_Column, 0, 0, iRec); - j4 = sqlite3VdbeAddOp3(v, OP_Eq, memId-1, 0, iRec); - sqlite3VdbeAddOp2(v, OP_Next, 0, j3); - sqlite3VdbeJumpHere(v, j2); - sqlite3VdbeAddOp2(v, OP_NewRowid, 0, memId+1); - j5 = sqlite3VdbeAddOp0(v, OP_Goto); - sqlite3VdbeJumpHere(v, j4); - sqlite3VdbeAddOp2(v, OP_Rowid, 0, memId+1); - sqlite3VdbeJumpHere(v, j1); - sqlite3VdbeJumpHere(v, j5); - sqlite3VdbeAddOp3(v, OP_MakeRecord, memId-1, 2, iRec); - sqlite3VdbeAddOp3(v, OP_Insert, 0, iRec, memId+1); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - sqlite3VdbeAddOp0(v, OP_Close); - sqlite3ReleaseTempReg(pParse, iRec); - } -} -#else -/* -** If SQLITE_OMIT_AUTOINCREMENT is defined, then the three routines -** above are all no-ops -*/ -# define autoIncBegin(A,B,C) (0) -# define autoIncStep(A,B,C) -#endif /* SQLITE_OMIT_AUTOINCREMENT */ - - -/* -** Generate code for a co-routine that will evaluate a subquery one -** row at a time. -** -** The pSelect parameter is the subquery that the co-routine will evaluation. -** Information about the location of co-routine and the registers it will use -** is returned by filling in the pDest object. -** -** Registers are allocated as follows: -** -** pDest->iSDParm The register holding the next entry-point of the -** co-routine. Run the co-routine to its next breakpoint -** by calling "OP_Yield $X" where $X is pDest->iSDParm. -** -** pDest->iSDParm+1 The register holding the "completed" flag for the -** co-routine. This register is 0 if the previous Yield -** generated a new result row, or 1 if the subquery -** has completed. If the Yield is called again -** after this register becomes 1, then the VDBE will -** halt with an SQLITE_INTERNAL error. -** -** pDest->iSdst First result register. -** -** pDest->nSdst Number of result registers. -** -** This routine handles all of the register allocation and fills in the -** pDest structure appropriately. -** -** Here is a schematic of the generated code assuming that X is the -** co-routine entry-point register reg[pDest->iSDParm], that EOF is the -** completed flag reg[pDest->iSDParm+1], and R and S are the range of -** registers that hold the result set, reg[pDest->iSdst] through -** reg[pDest->iSdst+pDest->nSdst-1]: -** -** X <- A -** EOF <- 0 -** goto B -** A: setup for the SELECT -** loop rows in the SELECT -** load results into registers R..S -** yield X -** end loop -** cleanup after the SELECT -** EOF <- 1 -** yield X -** halt-error -** B: -** -** To use this subroutine, the caller generates code as follows: -** -** [ Co-routine generated by this subroutine, shown above ] -** S: yield X -** if EOF goto E -** if skip this row, goto C -** if terminate loop, goto E -** deal with this row -** C: goto S -** E: -*/ -SQLITE_PRIVATE int sqlite3CodeCoroutine(Parse *pParse, Select *pSelect, SelectDest *pDest){ - int regYield; /* Register holding co-routine entry-point */ - int regEof; /* Register holding co-routine completion flag */ - int addrTop; /* Top of the co-routine */ - int j1; /* Jump instruction */ - int rc; /* Result code */ - Vdbe *v; /* VDBE under construction */ - - regYield = ++pParse->nMem; - regEof = ++pParse->nMem; - v = sqlite3GetVdbe(pParse); - addrTop = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_Integer, addrTop+2, regYield); /* X <- A */ - VdbeComment((v, "Co-routine entry point")); - sqlite3VdbeAddOp2(v, OP_Integer, 0, regEof); /* EOF <- 0 */ - VdbeComment((v, "Co-routine completion flag")); - sqlite3SelectDestInit(pDest, SRT_Coroutine, regYield); - j1 = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0); - rc = sqlite3Select(pParse, pSelect, pDest); - assert( pParse->nErr==0 || rc ); - if( pParse->db->mallocFailed && rc==SQLITE_OK ) rc = SQLITE_NOMEM; - if( rc ) return rc; - sqlite3VdbeAddOp2(v, OP_Integer, 1, regEof); /* EOF <- 1 */ - sqlite3VdbeAddOp1(v, OP_Yield, regYield); /* yield X */ - sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_INTERNAL, OE_Abort); - VdbeComment((v, "End of coroutine")); - sqlite3VdbeJumpHere(v, j1); /* label B: */ - return rc; -} - - - -/* Forward declaration */ -static int xferOptimization( - Parse *pParse, /* Parser context */ - Table *pDest, /* The table we are inserting into */ - Select *pSelect, /* A SELECT statement to use as the data source */ - int onError, /* How to handle constraint errors */ - int iDbDest /* The database of pDest */ -); - -/* -** This routine is called to handle SQL of the following forms: -** -** insert into TABLE (IDLIST) values(EXPRLIST) -** insert into TABLE (IDLIST) select -** -** The IDLIST following the table name is always optional. If omitted, -** then a list of all columns for the table is substituted. The IDLIST -** appears in the pColumn parameter. pColumn is NULL if IDLIST is omitted. -** -** The pList parameter holds EXPRLIST in the first form of the INSERT -** statement above, and pSelect is NULL. For the second form, pList is -** NULL and pSelect is a pointer to the select statement used to generate -** data for the insert. -** -** The code generated follows one of four templates. For a simple -** insert with data coming from a VALUES clause, the code executes -** once straight down through. Pseudo-code follows (we call this -** the "1st template"): -** -** open write cursor to
    and its indices -** put VALUES clause expressions into registers -** write the resulting record into
    -** cleanup -** -** The three remaining templates assume the statement is of the form -** -** INSERT INTO
    SELECT ... -** -** If the SELECT clause is of the restricted form "SELECT * FROM " - -** in other words if the SELECT pulls all columns from a single table -** and there is no WHERE or LIMIT or GROUP BY or ORDER BY clauses, and -** if and are distinct tables but have identical -** schemas, including all the same indices, then a special optimization -** is invoked that copies raw records from over to . -** See the xferOptimization() function for the implementation of this -** template. This is the 2nd template. -** -** open a write cursor to
    -** open read cursor on -** transfer all records in over to
    -** close cursors -** foreach index on
    -** open a write cursor on the
    index -** open a read cursor on the corresponding index -** transfer all records from the read to the write cursors -** close cursors -** end foreach -** -** The 3rd template is for when the second template does not apply -** and the SELECT clause does not read from
    at any time. -** The generated code follows this template: -** -** EOF <- 0 -** X <- A -** goto B -** A: setup for the SELECT -** loop over the rows in the SELECT -** load values into registers R..R+n -** yield X -** end loop -** cleanup after the SELECT -** EOF <- 1 -** yield X -** goto A -** B: open write cursor to
    and its indices -** C: yield X -** if EOF goto D -** insert the select result into
    from R..R+n -** goto C -** D: cleanup -** -** The 4th template is used if the insert statement takes its -** values from a SELECT but the data is being inserted into a table -** that is also read as part of the SELECT. In the third form, -** we have to use a intermediate table to store the results of -** the select. The template is like this: -** -** EOF <- 0 -** X <- A -** goto B -** A: setup for the SELECT -** loop over the tables in the SELECT -** load value into register R..R+n -** yield X -** end loop -** cleanup after the SELECT -** EOF <- 1 -** yield X -** halt-error -** B: open temp table -** L: yield X -** if EOF goto M -** insert row from R..R+n into temp table -** goto L -** M: open write cursor to
    and its indices -** rewind temp table -** C: loop over rows of intermediate table -** transfer values form intermediate table into
    -** end loop -** D: cleanup -*/ -SQLITE_PRIVATE void sqlite3Insert( - Parse *pParse, /* Parser context */ - SrcList *pTabList, /* Name of table into which we are inserting */ - Select *pSelect, /* A SELECT statement to use as the data source */ - IdList *pColumn, /* Column names corresponding to IDLIST. */ - int onError /* How to handle constraint errors */ -){ - sqlite3 *db; /* The main database structure */ - Table *pTab; /* The table to insert into. aka TABLE */ - char *zTab; /* Name of the table into which we are inserting */ - const char *zDb; /* Name of the database holding this table */ - int i, j, idx; /* Loop counters */ - Vdbe *v; /* Generate code into this virtual machine */ - Index *pIdx; /* For looping over indices of the table */ - int nColumn; /* Number of columns in the data */ - int nHidden = 0; /* Number of hidden columns if TABLE is virtual */ - int iDataCur = 0; /* VDBE cursor that is the main data repository */ - int iIdxCur = 0; /* First index cursor */ - int ipkColumn = -1; /* Column that is the INTEGER PRIMARY KEY */ - int endOfLoop; /* Label for the end of the insertion loop */ - int useTempTable = 0; /* Store SELECT results in intermediate table */ - int srcTab = 0; /* Data comes from this temporary cursor if >=0 */ - int addrInsTop = 0; /* Jump to label "D" */ - int addrCont = 0; /* Top of insert loop. Label "C" in templates 3 and 4 */ - int addrSelect = 0; /* Address of coroutine that implements the SELECT */ - SelectDest dest; /* Destination for SELECT on rhs of INSERT */ - int iDb; /* Index of database holding TABLE */ - Db *pDb; /* The database containing table being inserted into */ - int appendFlag = 0; /* True if the insert is likely to be an append */ - int withoutRowid; /* 0 for normal table. 1 for WITHOUT ROWID table */ - ExprList *pList = 0; /* List of VALUES() to be inserted */ - - /* Register allocations */ - int regFromSelect = 0;/* Base register for data coming from SELECT */ - int regAutoinc = 0; /* Register holding the AUTOINCREMENT counter */ - int regRowCount = 0; /* Memory cell used for the row counter */ - int regIns; /* Block of regs holding rowid+data being inserted */ - int regRowid; /* registers holding insert rowid */ - int regData; /* register holding first column to insert */ - int regEof = 0; /* Register recording end of SELECT data */ - int *aRegIdx = 0; /* One register allocated to each index */ - -#ifndef SQLITE_OMIT_TRIGGER - int isView; /* True if attempting to insert into a view */ - Trigger *pTrigger; /* List of triggers on pTab, if required */ - int tmask; /* Mask of trigger times */ -#endif - - db = pParse->db; - memset(&dest, 0, sizeof(dest)); - if( pParse->nErr || db->mallocFailed ){ - goto insert_cleanup; - } - - /* If the Select object is really just a simple VALUES() list with a - ** single row values (the common case) then keep that one row of values - ** and go ahead and discard the Select object - */ - if( pSelect && (pSelect->selFlags & SF_Values)!=0 && pSelect->pPrior==0 ){ - pList = pSelect->pEList; - pSelect->pEList = 0; - sqlite3SelectDelete(db, pSelect); - pSelect = 0; - } - - /* Locate the table into which we will be inserting new information. - */ - assert( pTabList->nSrc==1 ); - zTab = pTabList->a[0].zName; - if( NEVER(zTab==0) ) goto insert_cleanup; - pTab = sqlite3SrcListLookup(pParse, pTabList); - if( pTab==0 ){ - goto insert_cleanup; - } - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - assert( iDbnDb ); - pDb = &db->aDb[iDb]; - zDb = pDb->zName; - if( sqlite3AuthCheck(pParse, SQLITE_INSERT, pTab->zName, 0, zDb) ){ - goto insert_cleanup; - } - withoutRowid = !HasRowid(pTab); - - /* Figure out if we have any triggers and if the table being - ** inserted into is a view - */ -#ifndef SQLITE_OMIT_TRIGGER - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_INSERT, 0, &tmask); - isView = pTab->pSelect!=0; -#else -# define pTrigger 0 -# define tmask 0 -# define isView 0 -#endif -#ifdef SQLITE_OMIT_VIEW -# undef isView -# define isView 0 -#endif - assert( (pTrigger && tmask) || (pTrigger==0 && tmask==0) ); - - /* If pTab is really a view, make sure it has been initialized. - ** ViewGetColumnNames() is a no-op if pTab is not a view. - */ - if( sqlite3ViewGetColumnNames(pParse, pTab) ){ - goto insert_cleanup; - } - - /* Cannot insert into a read-only table. - */ - if( sqlite3IsReadOnly(pParse, pTab, tmask) ){ - goto insert_cleanup; - } - - /* Allocate a VDBE - */ - v = sqlite3GetVdbe(pParse); - if( v==0 ) goto insert_cleanup; - if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); - sqlite3BeginWriteOperation(pParse, pSelect || pTrigger, iDb); - -#ifndef SQLITE_OMIT_XFER_OPT - /* If the statement is of the form - ** - ** INSERT INTO SELECT * FROM ; - ** - ** Then special optimizations can be applied that make the transfer - ** very fast and which reduce fragmentation of indices. - ** - ** This is the 2nd template. - */ - if( pColumn==0 && xferOptimization(pParse, pTab, pSelect, onError, iDb) ){ - assert( !pTrigger ); - assert( pList==0 ); - goto insert_end; - } -#endif /* SQLITE_OMIT_XFER_OPT */ - - /* If this is an AUTOINCREMENT table, look up the sequence number in the - ** sqlite_sequence table and store it in memory cell regAutoinc. - */ - regAutoinc = autoIncBegin(pParse, iDb, pTab); - - /* Figure out how many columns of data are supplied. If the data - ** is coming from a SELECT statement, then generate a co-routine that - ** produces a single row of the SELECT on each invocation. The - ** co-routine is the common header to the 3rd and 4th templates. - */ - if( pSelect ){ - /* Data is coming from a SELECT. Generate a co-routine to run the SELECT */ - int rc = sqlite3CodeCoroutine(pParse, pSelect, &dest); - if( rc ) goto insert_cleanup; - - regEof = dest.iSDParm + 1; - regFromSelect = dest.iSdst; - assert( pSelect->pEList ); - nColumn = pSelect->pEList->nExpr; - assert( dest.nSdst==nColumn ); - - /* Set useTempTable to TRUE if the result of the SELECT statement - ** should be written into a temporary table (template 4). Set to - ** FALSE if each output row of the SELECT can be written directly into - ** the destination table (template 3). - ** - ** A temp table must be used if the table being updated is also one - ** of the tables being read by the SELECT statement. Also use a - ** temp table in the case of row triggers. - */ - if( pTrigger || readsTable(pParse, addrSelect, iDb, pTab) ){ - useTempTable = 1; - } - - if( useTempTable ){ - /* Invoke the coroutine to extract information from the SELECT - ** and add it to a transient table srcTab. The code generated - ** here is from the 4th template: - ** - ** B: open temp table - ** L: yield X - ** if EOF goto M - ** insert row from R..R+n into temp table - ** goto L - ** M: ... - */ - int regRec; /* Register to hold packed record */ - int regTempRowid; /* Register to hold temp table ROWID */ - int addrTop; /* Label "L" */ - int addrIf; /* Address of jump to M */ - - srcTab = pParse->nTab++; - regRec = sqlite3GetTempReg(pParse); - regTempRowid = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, srcTab, nColumn); - addrTop = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); - addrIf = sqlite3VdbeAddOp1(v, OP_If, regEof); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regFromSelect, nColumn, regRec); - sqlite3VdbeAddOp2(v, OP_NewRowid, srcTab, regTempRowid); - sqlite3VdbeAddOp3(v, OP_Insert, srcTab, regRec, regTempRowid); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrTop); - sqlite3VdbeJumpHere(v, addrIf); - sqlite3ReleaseTempReg(pParse, regRec); - sqlite3ReleaseTempReg(pParse, regTempRowid); - } - }else{ - /* This is the case if the data for the INSERT is coming from a VALUES - ** clause - */ - NameContext sNC; - memset(&sNC, 0, sizeof(sNC)); - sNC.pParse = pParse; - srcTab = -1; - assert( useTempTable==0 ); - nColumn = pList ? pList->nExpr : 0; - for(i=0; ia[i].pExpr) ){ - goto insert_cleanup; - } - } - } - - /* Make sure the number of columns in the source data matches the number - ** of columns to be inserted into the table. - */ - if( IsVirtual(pTab) ){ - for(i=0; inCol; i++){ - nHidden += (IsHiddenColumn(&pTab->aCol[i]) ? 1 : 0); - } - } - if( pColumn==0 && nColumn && nColumn!=(pTab->nCol-nHidden) ){ - sqlite3ErrorMsg(pParse, - "table %S has %d columns but %d values were supplied", - pTabList, 0, pTab->nCol-nHidden, nColumn); - goto insert_cleanup; - } - if( pColumn!=0 && nColumn!=pColumn->nId ){ - sqlite3ErrorMsg(pParse, "%d values for %d columns", nColumn, pColumn->nId); - goto insert_cleanup; - } - - /* If the INSERT statement included an IDLIST term, then make sure - ** all elements of the IDLIST really are columns of the table and - ** remember the column indices. - ** - ** If the table has an INTEGER PRIMARY KEY column and that column - ** is named in the IDLIST, then record in the ipkColumn variable - ** the index into IDLIST of the primary key column. ipkColumn is - ** the index of the primary key as it appears in IDLIST, not as - ** is appears in the original table. (The index of the INTEGER - ** PRIMARY KEY in the original table is pTab->iPKey.) - */ - if( pColumn ){ - for(i=0; inId; i++){ - pColumn->a[i].idx = -1; - } - for(i=0; inId; i++){ - for(j=0; jnCol; j++){ - if( sqlite3StrICmp(pColumn->a[i].zName, pTab->aCol[j].zName)==0 ){ - pColumn->a[i].idx = j; - if( j==pTab->iPKey ){ - ipkColumn = i; assert( !withoutRowid ); - } - break; - } - } - if( j>=pTab->nCol ){ - if( sqlite3IsRowid(pColumn->a[i].zName) && !withoutRowid ){ - ipkColumn = i; - }else{ - sqlite3ErrorMsg(pParse, "table %S has no column named %s", - pTabList, 0, pColumn->a[i].zName); - pParse->checkSchema = 1; - goto insert_cleanup; - } - } - } - } - - /* If there is no IDLIST term but the table has an integer primary - ** key, the set the ipkColumn variable to the integer primary key - ** column index in the original table definition. - */ - if( pColumn==0 && nColumn>0 ){ - ipkColumn = pTab->iPKey; - } - - /* Initialize the count of rows to be inserted - */ - if( db->flags & SQLITE_CountRows ){ - regRowCount = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount); - } - - /* If this is not a view, open the table and and all indices */ - if( !isView ){ - int nIdx; - nIdx = sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, -1, 0, - &iDataCur, &iIdxCur); - aRegIdx = sqlite3DbMallocRaw(db, sizeof(int)*(nIdx+1)); - if( aRegIdx==0 ){ - goto insert_cleanup; - } - for(i=0; inMem; - } - } - - /* This is the top of the main insertion loop */ - if( useTempTable ){ - /* This block codes the top of loop only. The complete loop is the - ** following pseudocode (template 4): - ** - ** rewind temp table - ** C: loop over rows of intermediate table - ** transfer values form intermediate table into
    - ** end loop - ** D: ... - */ - addrInsTop = sqlite3VdbeAddOp1(v, OP_Rewind, srcTab); - addrCont = sqlite3VdbeCurrentAddr(v); - }else if( pSelect ){ - /* This block codes the top of loop only. The complete loop is the - ** following pseudocode (template 3): - ** - ** C: yield X - ** if EOF goto D - ** insert the select result into
    from R..R+n - ** goto C - ** D: ... - */ - addrCont = sqlite3VdbeAddOp1(v, OP_Yield, dest.iSDParm); - addrInsTop = sqlite3VdbeAddOp1(v, OP_If, regEof); - } - - /* Allocate registers for holding the rowid of the new row, - ** the content of the new row, and the assemblied row record. - */ - regRowid = regIns = pParse->nMem+1; - pParse->nMem += pTab->nCol + 1; - if( IsVirtual(pTab) ){ - regRowid++; - pParse->nMem++; - } - regData = regRowid+1; - - /* Run the BEFORE and INSTEAD OF triggers, if there are any - */ - endOfLoop = sqlite3VdbeMakeLabel(v); - if( tmask & TRIGGER_BEFORE ){ - int regCols = sqlite3GetTempRange(pParse, pTab->nCol+1); - - /* build the NEW.* reference row. Note that if there is an INTEGER - ** PRIMARY KEY into which a NULL is being inserted, that NULL will be - ** translated into a unique ID for the row. But on a BEFORE trigger, - ** we do not know what the unique ID will be (because the insert has - ** not happened yet) so we substitute a rowid of -1 - */ - if( ipkColumn<0 ){ - sqlite3VdbeAddOp2(v, OP_Integer, -1, regCols); - }else{ - int j1; - assert( !withoutRowid ); - if( useTempTable ){ - sqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regCols); - }else{ - assert( pSelect==0 ); /* Otherwise useTempTable is true */ - sqlite3ExprCode(pParse, pList->a[ipkColumn].pExpr, regCols); - } - j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regCols); - sqlite3VdbeAddOp2(v, OP_Integer, -1, regCols); - sqlite3VdbeJumpHere(v, j1); - sqlite3VdbeAddOp1(v, OP_MustBeInt, regCols); - } - - /* Cannot have triggers on a virtual table. If it were possible, - ** this block would have to account for hidden column. - */ - assert( !IsVirtual(pTab) ); - - /* Create the new column data - */ - for(i=0; inCol; i++){ - if( pColumn==0 ){ - j = i; - }else{ - for(j=0; jnId; j++){ - if( pColumn->a[j].idx==i ) break; - } - } - if( (!useTempTable && !pList) || (pColumn && j>=pColumn->nId) ){ - sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regCols+i+1); - }else if( useTempTable ){ - sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, regCols+i+1); - }else{ - assert( pSelect==0 ); /* Otherwise useTempTable is true */ - sqlite3ExprCodeAndCache(pParse, pList->a[j].pExpr, regCols+i+1); - } - } - - /* If this is an INSERT on a view with an INSTEAD OF INSERT trigger, - ** do not attempt any conversions before assembling the record. - ** If this is a real table, attempt conversions as required by the - ** table column affinities. - */ - if( !isView ){ - sqlite3VdbeAddOp2(v, OP_Affinity, regCols+1, pTab->nCol); - sqlite3TableAffinityStr(v, pTab); - } - - /* Fire BEFORE or INSTEAD OF triggers */ - sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_BEFORE, - pTab, regCols-pTab->nCol-1, onError, endOfLoop); - - sqlite3ReleaseTempRange(pParse, regCols, pTab->nCol+1); - } - - /* Compute the content of the next row to insert into a range of - ** registers beginning at regIns. - */ - if( !isView ){ - if( IsVirtual(pTab) ){ - /* The row that the VUpdate opcode will delete: none */ - sqlite3VdbeAddOp2(v, OP_Null, 0, regIns); - } - if( ipkColumn>=0 ){ - if( useTempTable ){ - sqlite3VdbeAddOp3(v, OP_Column, srcTab, ipkColumn, regRowid); - }else if( pSelect ){ - sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+ipkColumn, regRowid); - }else{ - VdbeOp *pOp; - sqlite3ExprCode(pParse, pList->a[ipkColumn].pExpr, regRowid); - pOp = sqlite3VdbeGetOp(v, -1); - if( ALWAYS(pOp) && pOp->opcode==OP_Null && !IsVirtual(pTab) ){ - appendFlag = 1; - pOp->opcode = OP_NewRowid; - pOp->p1 = iDataCur; - pOp->p2 = regRowid; - pOp->p3 = regAutoinc; - } - } - /* If the PRIMARY KEY expression is NULL, then use OP_NewRowid - ** to generate a unique primary key value. - */ - if( !appendFlag ){ - int j1; - if( !IsVirtual(pTab) ){ - j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regRowid); - sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); - sqlite3VdbeJumpHere(v, j1); - }else{ - j1 = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_IsNull, regRowid, j1+2); - } - sqlite3VdbeAddOp1(v, OP_MustBeInt, regRowid); - } - }else if( IsVirtual(pTab) || withoutRowid ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, regRowid); - }else{ - sqlite3VdbeAddOp3(v, OP_NewRowid, iDataCur, regRowid, regAutoinc); - appendFlag = 1; - } - autoIncStep(pParse, regAutoinc, regRowid); - - /* Compute data for all columns of the new entry, beginning - ** with the first column. - */ - nHidden = 0; - for(i=0; inCol; i++){ - int iRegStore = regRowid+1+i; - if( i==pTab->iPKey ){ - /* The value of the INTEGER PRIMARY KEY column is always a NULL. - ** Whenever this column is read, the rowid will be substituted - ** in its place. Hence, fill this column with a NULL to avoid - ** taking up data space with information that will never be used. */ - sqlite3VdbeAddOp2(v, OP_Null, 0, iRegStore); - continue; - } - if( pColumn==0 ){ - if( IsHiddenColumn(&pTab->aCol[i]) ){ - assert( IsVirtual(pTab) ); - j = -1; - nHidden++; - }else{ - j = i - nHidden; - } - }else{ - for(j=0; jnId; j++){ - if( pColumn->a[j].idx==i ) break; - } - } - if( j<0 || nColumn==0 || (pColumn && j>=pColumn->nId) ){ - sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, iRegStore); - }else if( useTempTable ){ - sqlite3VdbeAddOp3(v, OP_Column, srcTab, j, iRegStore); - }else if( pSelect ){ - sqlite3VdbeAddOp2(v, OP_SCopy, regFromSelect+j, iRegStore); - }else{ - sqlite3ExprCode(pParse, pList->a[j].pExpr, iRegStore); - } - } - - /* Generate code to check constraints and generate index keys and - ** do the insertion. - */ -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( IsVirtual(pTab) ){ - const char *pVTab = (const char *)sqlite3GetVTable(db, pTab); - sqlite3VtabMakeWritable(pParse, pTab); - sqlite3VdbeAddOp4(v, OP_VUpdate, 1, pTab->nCol+2, regIns, pVTab, P4_VTAB); - sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError); - sqlite3MayAbort(pParse); - }else -#endif - { - int isReplace; /* Set to true if constraints may cause a replace */ - sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, - regIns, 0, ipkColumn>=0, onError, endOfLoop, &isReplace - ); - sqlite3FkCheck(pParse, pTab, 0, regIns, 0, 0); - sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur, - regIns, aRegIdx, 0, appendFlag, isReplace==0); - } - } - - /* Update the count of rows that are inserted - */ - if( (db->flags & SQLITE_CountRows)!=0 ){ - sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1); - } - - if( pTrigger ){ - /* Code AFTER triggers */ - sqlite3CodeRowTrigger(pParse, pTrigger, TK_INSERT, 0, TRIGGER_AFTER, - pTab, regData-2-pTab->nCol, onError, endOfLoop); - } - - /* The bottom of the main insertion loop, if the data source - ** is a SELECT statement. - */ - sqlite3VdbeResolveLabel(v, endOfLoop); - if( useTempTable ){ - sqlite3VdbeAddOp2(v, OP_Next, srcTab, addrCont); - sqlite3VdbeJumpHere(v, addrInsTop); - sqlite3VdbeAddOp1(v, OP_Close, srcTab); - }else if( pSelect ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrCont); - sqlite3VdbeJumpHere(v, addrInsTop); - } - - if( !IsVirtual(pTab) && !isView ){ - /* Close all tables opened */ - if( iDataCurpIndex; pIdx; pIdx=pIdx->pNext, idx++){ - sqlite3VdbeAddOp1(v, OP_Close, idx+iIdxCur); - } - } - -insert_end: - /* Update the sqlite_sequence table by storing the content of the - ** maximum rowid counter values recorded while inserting into - ** autoincrement tables. - */ - if( pParse->nested==0 && pParse->pTriggerTab==0 ){ - sqlite3AutoincrementEnd(pParse); - } - - /* - ** Return the number of rows inserted. If this routine is - ** generating code because of a call to sqlite3NestedParse(), do not - ** invoke the callback function. - */ - if( (db->flags&SQLITE_CountRows) && !pParse->nested && !pParse->pTriggerTab ){ - sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows inserted", SQLITE_STATIC); - } - -insert_cleanup: - sqlite3SrcListDelete(db, pTabList); - sqlite3ExprListDelete(db, pList); - sqlite3SelectDelete(db, pSelect); - sqlite3IdListDelete(db, pColumn); - sqlite3DbFree(db, aRegIdx); -} - -/* Make sure "isView" and other macros defined above are undefined. Otherwise -** thely may interfere with compilation of other functions in this file -** (or in another file, if this file becomes part of the amalgamation). */ -#ifdef isView - #undef isView -#endif -#ifdef pTrigger - #undef pTrigger -#endif -#ifdef tmask - #undef tmask -#endif - -/* -** Generate code to do constraint checks prior to an INSERT or an UPDATE -** on table pTab. -** -** The regNewData parameter is the first register in a range that contains -** the data to be inserted or the data after the update. There will be -** pTab->nCol+1 registers in this range. The first register (the one -** that regNewData points to) will contain the new rowid, or NULL in the -** case of a WITHOUT ROWID table. The second register in the range will -** contain the content of the first table column. The third register will -** contain the content of the second table column. And so forth. -** -** The regOldData parameter is similar to regNewData except that it contains -** the data prior to an UPDATE rather than afterwards. regOldData is zero -** for an INSERT. This routine can distinguish between UPDATE and INSERT by -** checking regOldData for zero. -** -** For an UPDATE, the pkChng boolean is true if the true primary key (the -** rowid for a normal table or the PRIMARY KEY for a WITHOUT ROWID table) -** might be modified by the UPDATE. If pkChng is false, then the key of -** the iDataCur content table is guaranteed to be unchanged by the UPDATE. -** -** For an INSERT, the pkChng boolean indicates whether or not the rowid -** was explicitly specified as part of the INSERT statement. If pkChng -** is zero, it means that the either rowid is computed automatically or -** that the table is a WITHOUT ROWID table and has no rowid. On an INSERT, -** pkChng will only be true if the INSERT statement provides an integer -** value for either the rowid column or its INTEGER PRIMARY KEY alias. -** -** The code generated by this routine will store new index entries into -** registers identified by aRegIdx[]. No index entry is created for -** indices where aRegIdx[i]==0. The order of indices in aRegIdx[] is -** the same as the order of indices on the linked list of indices -** at pTab->pIndex. -** -** The caller must have already opened writeable cursors on the main -** table and all applicable indices (that is to say, all indices for which -** aRegIdx[] is not zero). iDataCur is the cursor for the main table when -** inserting or updating a rowid table, or the cursor for the PRIMARY KEY -** index when operating on a WITHOUT ROWID table. iIdxCur is the cursor -** for the first index in the pTab->pIndex list. Cursors for other indices -** are at iIdxCur+N for the N-th element of the pTab->pIndex list. -** -** This routine also generates code to check constraints. NOT NULL, -** CHECK, and UNIQUE constraints are all checked. If a constraint fails, -** then the appropriate action is performed. There are five possible -** actions: ROLLBACK, ABORT, FAIL, REPLACE, and IGNORE. -** -** Constraint type Action What Happens -** --------------- ---------- ---------------------------------------- -** any ROLLBACK The current transaction is rolled back and -** sqlite3_step() returns immediately with a -** return code of SQLITE_CONSTRAINT. -** -** any ABORT Back out changes from the current command -** only (do not do a complete rollback) then -** cause sqlite3_step() to return immediately -** with SQLITE_CONSTRAINT. -** -** any FAIL Sqlite3_step() returns immediately with a -** return code of SQLITE_CONSTRAINT. The -** transaction is not rolled back and any -** changes to prior rows are retained. -** -** any IGNORE The attempt in insert or update the current -** row is skipped, without throwing an error. -** Processing continues with the next row. -** (There is an immediate jump to ignoreDest.) -** -** NOT NULL REPLACE The NULL value is replace by the default -** value for that column. If the default value -** is NULL, the action is the same as ABORT. -** -** UNIQUE REPLACE The other row that conflicts with the row -** being inserted is removed. -** -** CHECK REPLACE Illegal. The results in an exception. -** -** Which action to take is determined by the overrideError parameter. -** Or if overrideError==OE_Default, then the pParse->onError parameter -** is used. Or if pParse->onError==OE_Default then the onError value -** for the constraint is used. -*/ -SQLITE_PRIVATE void sqlite3GenerateConstraintChecks( - Parse *pParse, /* The parser context */ - Table *pTab, /* The table being inserted or updated */ - int *aRegIdx, /* Use register aRegIdx[i] for index i. 0 for unused */ - int iDataCur, /* Canonical data cursor (main table or PK index) */ - int iIdxCur, /* First index cursor */ - int regNewData, /* First register in a range holding values to insert */ - int regOldData, /* Previous content. 0 for INSERTs */ - u8 pkChng, /* Non-zero if the rowid or PRIMARY KEY changed */ - u8 overrideError, /* Override onError to this if not OE_Default */ - int ignoreDest, /* Jump to this label on an OE_Ignore resolution */ - int *pbMayReplace /* OUT: Set to true if constraint may cause a replace */ -){ - Vdbe *v; /* VDBE under constrution */ - Index *pIdx; /* Pointer to one of the indices */ - Index *pPk = 0; /* The PRIMARY KEY index */ - sqlite3 *db; /* Database connection */ - int i; /* loop counter */ - int ix; /* Index loop counter */ - int nCol; /* Number of columns */ - int onError; /* Conflict resolution strategy */ - int j1; /* Addresss of jump instruction */ - int seenReplace = 0; /* True if REPLACE is used to resolve INT PK conflict */ - int nPkField; /* Number of fields in PRIMARY KEY. 1 for ROWID tables */ - int ipkTop = 0; /* Top of the rowid change constraint check */ - int ipkBottom = 0; /* Bottom of the rowid change constraint check */ - u8 isUpdate; /* True if this is an UPDATE operation */ - int regRowid = -1; /* Register holding ROWID value */ - - isUpdate = regOldData!=0; - db = pParse->db; - v = sqlite3GetVdbe(pParse); - assert( v!=0 ); - assert( pTab->pSelect==0 ); /* This table is not a VIEW */ - nCol = pTab->nCol; - - /* pPk is the PRIMARY KEY index for WITHOUT ROWID tables and NULL for - ** normal rowid tables. nPkField is the number of key fields in the - ** pPk index or 1 for a rowid table. In other words, nPkField is the - ** number of fields in the true primary key of the table. */ - if( HasRowid(pTab) ){ - pPk = 0; - nPkField = 1; - }else{ - pPk = sqlite3PrimaryKeyIndex(pTab); - nPkField = pPk->nKeyCol; - } - - /* Record that this module has started */ - VdbeModuleComment((v, "BEGIN: GenCnstCks(%d,%d,%d,%d,%d)", - iDataCur, iIdxCur, regNewData, regOldData, pkChng)); - - /* Test all NOT NULL constraints. - */ - for(i=0; iiPKey ){ - continue; - } - onError = pTab->aCol[i].notNull; - if( onError==OE_None ) continue; - if( overrideError!=OE_Default ){ - onError = overrideError; - }else if( onError==OE_Default ){ - onError = OE_Abort; - } - if( onError==OE_Replace && pTab->aCol[i].pDflt==0 ){ - onError = OE_Abort; - } - assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail - || onError==OE_Ignore || onError==OE_Replace ); - switch( onError ){ - case OE_Abort: - sqlite3MayAbort(pParse); - /* Fall through */ - case OE_Rollback: - case OE_Fail: { - char *zMsg = sqlite3MPrintf(db, "%s.%s", pTab->zName, - pTab->aCol[i].zName); - sqlite3VdbeAddOp4(v, OP_HaltIfNull, SQLITE_CONSTRAINT_NOTNULL, onError, - regNewData+1+i, zMsg, P4_DYNAMIC); - sqlite3VdbeChangeP5(v, P5_ConstraintNotNull); - break; - } - case OE_Ignore: { - sqlite3VdbeAddOp2(v, OP_IsNull, regNewData+1+i, ignoreDest); - break; - } - default: { - assert( onError==OE_Replace ); - j1 = sqlite3VdbeAddOp1(v, OP_NotNull, regNewData+1+i); - sqlite3ExprCode(pParse, pTab->aCol[i].pDflt, regNewData+1+i); - sqlite3VdbeJumpHere(v, j1); - break; - } - } - } - - /* Test all CHECK constraints - */ -#ifndef SQLITE_OMIT_CHECK - if( pTab->pCheck && (db->flags & SQLITE_IgnoreChecks)==0 ){ - ExprList *pCheck = pTab->pCheck; - pParse->ckBase = regNewData+1; - onError = overrideError!=OE_Default ? overrideError : OE_Abort; - for(i=0; inExpr; i++){ - int allOk = sqlite3VdbeMakeLabel(v); - sqlite3ExprIfTrue(pParse, pCheck->a[i].pExpr, allOk, SQLITE_JUMPIFNULL); - if( onError==OE_Ignore ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); - }else{ - char *zName = pCheck->a[i].zName; - if( zName==0 ) zName = pTab->zName; - if( onError==OE_Replace ) onError = OE_Abort; /* IMP: R-15569-63625 */ - sqlite3HaltConstraint(pParse, SQLITE_CONSTRAINT_CHECK, - onError, zName, P4_TRANSIENT, - P5_ConstraintCheck); - } - sqlite3VdbeResolveLabel(v, allOk); - } - } -#endif /* !defined(SQLITE_OMIT_CHECK) */ - - /* If rowid is changing, make sure the new rowid does not previously - ** exist in the table. - */ - if( pkChng && pPk==0 ){ - int addrRowidOk = sqlite3VdbeMakeLabel(v); - - /* Figure out what action to take in case of a rowid collision */ - onError = pTab->keyConf; - if( overrideError!=OE_Default ){ - onError = overrideError; - }else if( onError==OE_Default ){ - onError = OE_Abort; - } - - if( isUpdate ){ - /* pkChng!=0 does not mean that the rowid has change, only that - ** it might have changed. Skip the conflict logic below if the rowid - ** is unchanged. */ - sqlite3VdbeAddOp3(v, OP_Eq, regNewData, addrRowidOk, regOldData); - } - - /* If the response to a rowid conflict is REPLACE but the response - ** to some other UNIQUE constraint is FAIL or IGNORE, then we need - ** to defer the running of the rowid conflict checking until after - ** the UNIQUE constraints have run. - */ - if( onError==OE_Replace && overrideError!=OE_Replace ){ - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->onError==OE_Ignore || pIdx->onError==OE_Fail ){ - ipkTop = sqlite3VdbeAddOp0(v, OP_Goto); - break; - } - } - } - - /* Check to see if the new rowid already exists in the table. Skip - ** the following conflict logic if it does not. */ - sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, addrRowidOk, regNewData); - - /* Generate code that deals with a rowid collision */ - switch( onError ){ - default: { - onError = OE_Abort; - /* Fall thru into the next case */ - } - case OE_Rollback: - case OE_Abort: - case OE_Fail: { - sqlite3RowidConstraint(pParse, onError, pTab); - break; - } - case OE_Replace: { - /* If there are DELETE triggers on this table and the - ** recursive-triggers flag is set, call GenerateRowDelete() to - ** remove the conflicting row from the table. This will fire - ** the triggers and remove both the table and index b-tree entries. - ** - ** Otherwise, if there are no triggers or the recursive-triggers - ** flag is not set, but the table has one or more indexes, call - ** GenerateRowIndexDelete(). This removes the index b-tree entries - ** only. The table b-tree entry will be replaced by the new entry - ** when it is inserted. - ** - ** If either GenerateRowDelete() or GenerateRowIndexDelete() is called, - ** also invoke MultiWrite() to indicate that this VDBE may require - ** statement rollback (if the statement is aborted after the delete - ** takes place). Earlier versions called sqlite3MultiWrite() regardless, - ** but being more selective here allows statements like: - ** - ** REPLACE INTO t(rowid) VALUES($newrowid) - ** - ** to run without a statement journal if there are no indexes on the - ** table. - */ - Trigger *pTrigger = 0; - if( db->flags&SQLITE_RecTriggers ){ - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); - } - if( pTrigger || sqlite3FkRequired(pParse, pTab, 0, 0) ){ - sqlite3MultiWrite(pParse); - sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, - regNewData, 1, 0, OE_Replace, 1); - }else if( pTab->pIndex ){ - sqlite3MultiWrite(pParse); - sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, 0); - } - seenReplace = 1; - break; - } - case OE_Ignore: { - /*assert( seenReplace==0 );*/ - sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); - break; - } - } - sqlite3VdbeResolveLabel(v, addrRowidOk); - if( ipkTop ){ - ipkBottom = sqlite3VdbeAddOp0(v, OP_Goto); - sqlite3VdbeJumpHere(v, ipkTop); - } - } - - /* Test all UNIQUE constraints by creating entries for each UNIQUE - ** index and making sure that duplicate entries do not already exist. - ** Compute the revised record entries for indices as we go. - ** - ** This loop also handles the case of the PRIMARY KEY index for a - ** WITHOUT ROWID table. - */ - for(ix=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, ix++){ - int regIdx; /* Range of registers hold conent for pIdx */ - int regR; /* Range of registers holding conflicting PK */ - int iThisCur; /* Cursor for this UNIQUE index */ - int addrUniqueOk; /* Jump here if the UNIQUE constraint is satisfied */ - - if( aRegIdx[ix]==0 ) continue; /* Skip indices that do not change */ - iThisCur = iIdxCur+ix; - addrUniqueOk = sqlite3VdbeMakeLabel(v); - - /* Skip partial indices for which the WHERE clause is not true */ - if( pIdx->pPartIdxWhere ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, aRegIdx[ix]); - pParse->ckBase = regNewData+1; - sqlite3ExprIfFalse(pParse, pIdx->pPartIdxWhere, addrUniqueOk, - SQLITE_JUMPIFNULL); - pParse->ckBase = 0; - } - - /* Create a record for this index entry as it should appear after - ** the insert or update. Store that record in the aRegIdx[ix] register - */ - regIdx = sqlite3GetTempRange(pParse, pIdx->nColumn); - for(i=0; inColumn; i++){ - int iField = pIdx->aiColumn[i]; - int x; - if( iField<0 || iField==pTab->iPKey ){ - if( regRowid==regIdx+i ) continue; /* ROWID already in regIdx+i */ - x = regNewData; - regRowid = pIdx->pPartIdxWhere ? -1 : regIdx+i; - }else{ - x = iField + regNewData + 1; - } - sqlite3VdbeAddOp2(v, OP_SCopy, x, regIdx+i); - VdbeComment((v, "%s", iField<0 ? "rowid" : pTab->aCol[iField].zName)); - } - sqlite3VdbeAddOp3(v, OP_MakeRecord, regIdx, pIdx->nColumn, aRegIdx[ix]); - sqlite3VdbeChangeP4(v, -1, sqlite3IndexAffinityStr(v, pIdx), P4_TRANSIENT); - VdbeComment((v, "for %s", pIdx->zName)); - sqlite3ExprCacheAffinityChange(pParse, regIdx, pIdx->nColumn); - - /* In an UPDATE operation, if this index is the PRIMARY KEY index - ** of a WITHOUT ROWID table and there has been no change the - ** primary key, then no collision is possible. The collision detection - ** logic below can all be skipped. */ - if( isUpdate && pPk==pIdx && pkChng==0 ){ - sqlite3VdbeResolveLabel(v, addrUniqueOk); - continue; - } - - /* Find out what action to take in case there is a uniqueness conflict */ - onError = pIdx->onError; - if( onError==OE_None ){ - sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn); - sqlite3VdbeResolveLabel(v, addrUniqueOk); - continue; /* pIdx is not a UNIQUE index */ - } - if( overrideError!=OE_Default ){ - onError = overrideError; - }else if( onError==OE_Default ){ - onError = OE_Abort; - } - - /* Check to see if the new index entry will be unique */ - sqlite3VdbeAddOp4Int(v, OP_NoConflict, iThisCur, addrUniqueOk, - regIdx, pIdx->nKeyCol); - - /* Generate code to handle collisions */ - regR = (pIdx==pPk) ? regIdx : sqlite3GetTempRange(pParse, nPkField); - if( isUpdate || onError==OE_Replace ){ - if( HasRowid(pTab) ){ - sqlite3VdbeAddOp2(v, OP_IdxRowid, iThisCur, regR); - /* Conflict only if the rowid of the existing index entry - ** is different from old-rowid */ - if( isUpdate ){ - sqlite3VdbeAddOp3(v, OP_Eq, regR, addrUniqueOk, regOldData); - } - }else{ - int x; - /* Extract the PRIMARY KEY from the end of the index entry and - ** store it in registers regR..regR+nPk-1 */ - if( pIdx!=pPk ){ - for(i=0; inKeyCol; i++){ - x = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[i]); - sqlite3VdbeAddOp3(v, OP_Column, iThisCur, x, regR+i); - VdbeComment((v, "%s.%s", pTab->zName, - pTab->aCol[pPk->aiColumn[i]].zName)); - } - } - if( isUpdate ){ - /* If currently processing the PRIMARY KEY of a WITHOUT ROWID - ** table, only conflict if the new PRIMARY KEY values are actually - ** different from the old. - ** - ** For a UNIQUE index, only conflict if the PRIMARY KEY values - ** of the matched index row are different from the original PRIMARY - ** KEY values of this row before the update. */ - int addrJump = sqlite3VdbeCurrentAddr(v)+pPk->nKeyCol; - int op = OP_Ne; - int regCmp = (pIdx->autoIndex==2 ? regIdx : regR); - - for(i=0; inKeyCol; i++){ - char *p4 = (char*)sqlite3LocateCollSeq(pParse, pPk->azColl[i]); - x = pPk->aiColumn[i]; - if( i==(pPk->nKeyCol-1) ){ - addrJump = addrUniqueOk; - op = OP_Eq; - } - sqlite3VdbeAddOp4(v, op, - regOldData+1+x, addrJump, regCmp+i, p4, P4_COLLSEQ - ); - } - } - } - } - - /* Generate code that executes if the new index entry is not unique */ - assert( onError==OE_Rollback || onError==OE_Abort || onError==OE_Fail - || onError==OE_Ignore || onError==OE_Replace ); - switch( onError ){ - case OE_Rollback: - case OE_Abort: - case OE_Fail: { - sqlite3UniqueConstraint(pParse, onError, pIdx); - break; - } - case OE_Ignore: { - sqlite3VdbeAddOp2(v, OP_Goto, 0, ignoreDest); - break; - } - default: { - Trigger *pTrigger = 0; - assert( onError==OE_Replace ); - sqlite3MultiWrite(pParse); - if( db->flags&SQLITE_RecTriggers ){ - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_DELETE, 0, 0); - } - sqlite3GenerateRowDelete(pParse, pTab, pTrigger, iDataCur, iIdxCur, - regR, nPkField, 0, OE_Replace, pIdx==pPk); - seenReplace = 1; - break; - } - } - sqlite3VdbeResolveLabel(v, addrUniqueOk); - sqlite3ReleaseTempRange(pParse, regIdx, pIdx->nColumn); - if( regR!=regIdx ) sqlite3ReleaseTempRange(pParse, regR, nPkField); - } - if( ipkTop ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, ipkTop+1); - sqlite3VdbeJumpHere(v, ipkBottom); - } - - *pbMayReplace = seenReplace; - VdbeModuleComment((v, "END: GenCnstCks(%d)", seenReplace)); -} - -/* -** This routine generates code to finish the INSERT or UPDATE operation -** that was started by a prior call to sqlite3GenerateConstraintChecks. -** A consecutive range of registers starting at regNewData contains the -** rowid and the content to be inserted. -** -** The arguments to this routine should be the same as the first six -** arguments to sqlite3GenerateConstraintChecks. -*/ -SQLITE_PRIVATE void sqlite3CompleteInsertion( - Parse *pParse, /* The parser context */ - Table *pTab, /* the table into which we are inserting */ - int iDataCur, /* Cursor of the canonical data source */ - int iIdxCur, /* First index cursor */ - int regNewData, /* Range of content */ - int *aRegIdx, /* Register used by each index. 0 for unused indices */ - int isUpdate, /* True for UPDATE, False for INSERT */ - int appendBias, /* True if this is likely to be an append */ - int useSeekResult /* True to set the USESEEKRESULT flag on OP_[Idx]Insert */ -){ - Vdbe *v; /* Prepared statements under construction */ - Index *pIdx; /* An index being inserted or updated */ - u8 pik_flags; /* flag values passed to the btree insert */ - int regData; /* Content registers (after the rowid) */ - int regRec; /* Register holding assemblied record for the table */ - int i; /* Loop counter */ - - v = sqlite3GetVdbe(pParse); - assert( v!=0 ); - assert( pTab->pSelect==0 ); /* This table is not a VIEW */ - for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ - if( aRegIdx[i]==0 ) continue; - if( pIdx->pPartIdxWhere ){ - sqlite3VdbeAddOp2(v, OP_IsNull, aRegIdx[i], sqlite3VdbeCurrentAddr(v)+2); - } - sqlite3VdbeAddOp2(v, OP_IdxInsert, iIdxCur+i, aRegIdx[i]); - pik_flags = 0; - if( useSeekResult ) pik_flags = OPFLAG_USESEEKRESULT; - if( pIdx->autoIndex==2 && !HasRowid(pTab) ){ - assert( pParse->nested==0 ); - pik_flags |= OPFLAG_NCHANGE; - } - if( pik_flags ) sqlite3VdbeChangeP5(v, pik_flags); - } - if( !HasRowid(pTab) ) return; - regData = regNewData + 1; - regRec = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regData, pTab->nCol, regRec); - sqlite3TableAffinityStr(v, pTab); - sqlite3ExprCacheAffinityChange(pParse, regData, pTab->nCol); - if( pParse->nested ){ - pik_flags = 0; - }else{ - pik_flags = OPFLAG_NCHANGE; - pik_flags |= (isUpdate?OPFLAG_ISUPDATE:OPFLAG_LASTROWID); - } - if( appendBias ){ - pik_flags |= OPFLAG_APPEND; - } - if( useSeekResult ){ - pik_flags |= OPFLAG_USESEEKRESULT; - } - sqlite3VdbeAddOp3(v, OP_Insert, iDataCur, regRec, regNewData); - if( !pParse->nested ){ - sqlite3VdbeChangeP4(v, -1, pTab->zName, P4_TRANSIENT); - } - sqlite3VdbeChangeP5(v, pik_flags); -} - -/* -** Allocate cursors for the pTab table and all its indices and generate -** code to open and initialized those cursors. -** -** The cursor for the object that contains the complete data (normally -** the table itself, but the PRIMARY KEY index in the case of a WITHOUT -** ROWID table) is returned in *piDataCur. The first index cursor is -** returned in *piIdxCur. The number of indices is returned. -** -** Use iBase as the first cursor (either the *piDataCur for rowid tables -** or the first index for WITHOUT ROWID tables) if it is non-negative. -** If iBase is negative, then allocate the next available cursor. -** -** For a rowid table, *piDataCur will be exactly one less than *piIdxCur. -** For a WITHOUT ROWID table, *piDataCur will be somewhere in the range -** of *piIdxCurs, depending on where the PRIMARY KEY index appears on the -** pTab->pIndex list. -*/ -SQLITE_PRIVATE int sqlite3OpenTableAndIndices( - Parse *pParse, /* Parsing context */ - Table *pTab, /* Table to be opened */ - int op, /* OP_OpenRead or OP_OpenWrite */ - int iBase, /* Use this for the table cursor, if there is one */ - u8 *aToOpen, /* If not NULL: boolean for each table and index */ - int *piDataCur, /* Write the database source cursor number here */ - int *piIdxCur /* Write the first index cursor number here */ -){ - int i; - int iDb; - int iDataCur; - Index *pIdx; - Vdbe *v; - - assert( op==OP_OpenRead || op==OP_OpenWrite ); - if( IsVirtual(pTab) ){ - assert( aToOpen==0 ); - *piDataCur = 0; - *piIdxCur = 1; - return 0; - } - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - v = sqlite3GetVdbe(pParse); - assert( v!=0 ); - if( iBase<0 ) iBase = pParse->nTab; - iDataCur = iBase++; - if( piDataCur ) *piDataCur = iDataCur; - if( HasRowid(pTab) && (aToOpen==0 || aToOpen[0]) ){ - sqlite3OpenTable(pParse, iDataCur, iDb, pTab, op); - }else{ - sqlite3TableLock(pParse, iDb, pTab->tnum, op==OP_OpenWrite, pTab->zName); - } - if( piIdxCur ) *piIdxCur = iBase; - for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ - int iIdxCur = iBase++; - assert( pIdx->pSchema==pTab->pSchema ); - if( pIdx->autoIndex==2 && !HasRowid(pTab) && piDataCur ){ - *piDataCur = iIdxCur; - } - if( aToOpen==0 || aToOpen[i+1] ){ - sqlite3VdbeAddOp3(v, op, iIdxCur, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); - VdbeComment((v, "%s", pIdx->zName)); - } - } - if( iBase>pParse->nTab ) pParse->nTab = iBase; - return i; -} - - -#ifdef SQLITE_TEST -/* -** The following global variable is incremented whenever the -** transfer optimization is used. This is used for testing -** purposes only - to make sure the transfer optimization really -** is happening when it is suppose to. -*/ -SQLITE_API int sqlite3_xferopt_count; -#endif /* SQLITE_TEST */ - - -#ifndef SQLITE_OMIT_XFER_OPT -/* -** Check to collation names to see if they are compatible. -*/ -static int xferCompatibleCollation(const char *z1, const char *z2){ - if( z1==0 ){ - return z2==0; - } - if( z2==0 ){ - return 0; - } - return sqlite3StrICmp(z1, z2)==0; -} - - -/* -** Check to see if index pSrc is compatible as a source of data -** for index pDest in an insert transfer optimization. The rules -** for a compatible index: -** -** * The index is over the same set of columns -** * The same DESC and ASC markings occurs on all columns -** * The same onError processing (OE_Abort, OE_Ignore, etc) -** * The same collating sequence on each column -** * The index has the exact same WHERE clause -*/ -static int xferCompatibleIndex(Index *pDest, Index *pSrc){ - int i; - assert( pDest && pSrc ); - assert( pDest->pTable!=pSrc->pTable ); - if( pDest->nKeyCol!=pSrc->nKeyCol ){ - return 0; /* Different number of columns */ - } - if( pDest->onError!=pSrc->onError ){ - return 0; /* Different conflict resolution strategies */ - } - for(i=0; inKeyCol; i++){ - if( pSrc->aiColumn[i]!=pDest->aiColumn[i] ){ - return 0; /* Different columns indexed */ - } - if( pSrc->aSortOrder[i]!=pDest->aSortOrder[i] ){ - return 0; /* Different sort orders */ - } - if( !xferCompatibleCollation(pSrc->azColl[i],pDest->azColl[i]) ){ - return 0; /* Different collating sequences */ - } - } - if( sqlite3ExprCompare(pSrc->pPartIdxWhere, pDest->pPartIdxWhere, -1) ){ - return 0; /* Different WHERE clauses */ - } - - /* If no test above fails then the indices must be compatible */ - return 1; -} - -/* -** Attempt the transfer optimization on INSERTs of the form -** -** INSERT INTO tab1 SELECT * FROM tab2; -** -** The xfer optimization transfers raw records from tab2 over to tab1. -** Columns are not decoded and reassemblied, which greatly improves -** performance. Raw index records are transferred in the same way. -** -** The xfer optimization is only attempted if tab1 and tab2 are compatible. -** There are lots of rules for determining compatibility - see comments -** embedded in the code for details. -** -** This routine returns TRUE if the optimization is guaranteed to be used. -** Sometimes the xfer optimization will only work if the destination table -** is empty - a factor that can only be determined at run-time. In that -** case, this routine generates code for the xfer optimization but also -** does a test to see if the destination table is empty and jumps over the -** xfer optimization code if the test fails. In that case, this routine -** returns FALSE so that the caller will know to go ahead and generate -** an unoptimized transfer. This routine also returns FALSE if there -** is no chance that the xfer optimization can be applied. -** -** This optimization is particularly useful at making VACUUM run faster. -*/ -static int xferOptimization( - Parse *pParse, /* Parser context */ - Table *pDest, /* The table we are inserting into */ - Select *pSelect, /* A SELECT statement to use as the data source */ - int onError, /* How to handle constraint errors */ - int iDbDest /* The database of pDest */ -){ - ExprList *pEList; /* The result set of the SELECT */ - Table *pSrc; /* The table in the FROM clause of SELECT */ - Index *pSrcIdx, *pDestIdx; /* Source and destination indices */ - struct SrcList_item *pItem; /* An element of pSelect->pSrc */ - int i; /* Loop counter */ - int iDbSrc; /* The database of pSrc */ - int iSrc, iDest; /* Cursors from source and destination */ - int addr1, addr2; /* Loop addresses */ - int emptyDestTest = 0; /* Address of test for empty pDest */ - int emptySrcTest = 0; /* Address of test for empty pSrc */ - Vdbe *v; /* The VDBE we are building */ - int regAutoinc; /* Memory register used by AUTOINC */ - int destHasUniqueIdx = 0; /* True if pDest has a UNIQUE index */ - int regData, regRowid; /* Registers holding data and rowid */ - - if( pSelect==0 ){ - return 0; /* Must be of the form INSERT INTO ... SELECT ... */ - } - if( pParse->pWith || pSelect->pWith ){ - /* Do not attempt to process this query if there are an WITH clauses - ** attached to it. Proceeding may generate a false "no such table: xxx" - ** error if pSelect reads from a CTE named "xxx". */ - return 0; - } - if( sqlite3TriggerList(pParse, pDest) ){ - return 0; /* tab1 must not have triggers */ - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( pDest->tabFlags & TF_Virtual ){ - return 0; /* tab1 must not be a virtual table */ - } -#endif - if( onError==OE_Default ){ - if( pDest->iPKey>=0 ) onError = pDest->keyConf; - if( onError==OE_Default ) onError = OE_Abort; - } - assert(pSelect->pSrc); /* allocated even if there is no FROM clause */ - if( pSelect->pSrc->nSrc!=1 ){ - return 0; /* FROM clause must have exactly one term */ - } - if( pSelect->pSrc->a[0].pSelect ){ - return 0; /* FROM clause cannot contain a subquery */ - } - if( pSelect->pWhere ){ - return 0; /* SELECT may not have a WHERE clause */ - } - if( pSelect->pOrderBy ){ - return 0; /* SELECT may not have an ORDER BY clause */ - } - /* Do not need to test for a HAVING clause. If HAVING is present but - ** there is no ORDER BY, we will get an error. */ - if( pSelect->pGroupBy ){ - return 0; /* SELECT may not have a GROUP BY clause */ - } - if( pSelect->pLimit ){ - return 0; /* SELECT may not have a LIMIT clause */ - } - assert( pSelect->pOffset==0 ); /* Must be so if pLimit==0 */ - if( pSelect->pPrior ){ - return 0; /* SELECT may not be a compound query */ - } - if( pSelect->selFlags & SF_Distinct ){ - return 0; /* SELECT may not be DISTINCT */ - } - pEList = pSelect->pEList; - assert( pEList!=0 ); - if( pEList->nExpr!=1 ){ - return 0; /* The result set must have exactly one column */ - } - assert( pEList->a[0].pExpr ); - if( pEList->a[0].pExpr->op!=TK_ALL ){ - return 0; /* The result set must be the special operator "*" */ - } - - /* At this point we have established that the statement is of the - ** correct syntactic form to participate in this optimization. Now - ** we have to check the semantics. - */ - pItem = pSelect->pSrc->a; - pSrc = sqlite3LocateTableItem(pParse, 0, pItem); - if( pSrc==0 ){ - return 0; /* FROM clause does not contain a real table */ - } - if( pSrc==pDest ){ - return 0; /* tab1 and tab2 may not be the same table */ - } - if( HasRowid(pDest)!=HasRowid(pSrc) ){ - return 0; /* source and destination must both be WITHOUT ROWID or not */ - } -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( pSrc->tabFlags & TF_Virtual ){ - return 0; /* tab2 must not be a virtual table */ - } -#endif - if( pSrc->pSelect ){ - return 0; /* tab2 may not be a view */ - } - if( pDest->nCol!=pSrc->nCol ){ - return 0; /* Number of columns must be the same in tab1 and tab2 */ - } - if( pDest->iPKey!=pSrc->iPKey ){ - return 0; /* Both tables must have the same INTEGER PRIMARY KEY */ - } - for(i=0; inCol; i++){ - if( pDest->aCol[i].affinity!=pSrc->aCol[i].affinity ){ - return 0; /* Affinity must be the same on all columns */ - } - if( !xferCompatibleCollation(pDest->aCol[i].zColl, pSrc->aCol[i].zColl) ){ - return 0; /* Collating sequence must be the same on all columns */ - } - if( pDest->aCol[i].notNull && !pSrc->aCol[i].notNull ){ - return 0; /* tab2 must be NOT NULL if tab1 is */ - } - } - for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){ - if( pDestIdx->onError!=OE_None ){ - destHasUniqueIdx = 1; - } - for(pSrcIdx=pSrc->pIndex; pSrcIdx; pSrcIdx=pSrcIdx->pNext){ - if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break; - } - if( pSrcIdx==0 ){ - return 0; /* pDestIdx has no corresponding index in pSrc */ - } - } -#ifndef SQLITE_OMIT_CHECK - if( pDest->pCheck && sqlite3ExprListCompare(pSrc->pCheck,pDest->pCheck,-1) ){ - return 0; /* Tables have different CHECK constraints. Ticket #2252 */ - } -#endif -#ifndef SQLITE_OMIT_FOREIGN_KEY - /* Disallow the transfer optimization if the destination table constains - ** any foreign key constraints. This is more restrictive than necessary. - ** But the main beneficiary of the transfer optimization is the VACUUM - ** command, and the VACUUM command disables foreign key constraints. So - ** the extra complication to make this rule less restrictive is probably - ** not worth the effort. Ticket [6284df89debdfa61db8073e062908af0c9b6118e] - */ - if( (pParse->db->flags & SQLITE_ForeignKeys)!=0 && pDest->pFKey!=0 ){ - return 0; - } -#endif - if( (pParse->db->flags & SQLITE_CountRows)!=0 ){ - return 0; /* xfer opt does not play well with PRAGMA count_changes */ - } - - /* If we get this far, it means that the xfer optimization is at - ** least a possibility, though it might only work if the destination - ** table (tab1) is initially empty. - */ -#ifdef SQLITE_TEST - sqlite3_xferopt_count++; -#endif - iDbSrc = sqlite3SchemaToIndex(pParse->db, pSrc->pSchema); - v = sqlite3GetVdbe(pParse); - sqlite3CodeVerifySchema(pParse, iDbSrc); - iSrc = pParse->nTab++; - iDest = pParse->nTab++; - regAutoinc = autoIncBegin(pParse, iDbDest, pDest); - regData = sqlite3GetTempReg(pParse); - regRowid = sqlite3GetTempReg(pParse); - sqlite3OpenTable(pParse, iDest, iDbDest, pDest, OP_OpenWrite); - assert( HasRowid(pDest) || destHasUniqueIdx ); - if( (pDest->iPKey<0 && pDest->pIndex!=0) /* (1) */ - || destHasUniqueIdx /* (2) */ - || (onError!=OE_Abort && onError!=OE_Rollback) /* (3) */ - ){ - /* In some circumstances, we are able to run the xfer optimization - ** only if the destination table is initially empty. This code makes - ** that determination. Conditions under which the destination must - ** be empty: - ** - ** (1) There is no INTEGER PRIMARY KEY but there are indices. - ** (If the destination is not initially empty, the rowid fields - ** of index entries might need to change.) - ** - ** (2) The destination has a unique index. (The xfer optimization - ** is unable to test uniqueness.) - ** - ** (3) onError is something other than OE_Abort and OE_Rollback. - */ - addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iDest, 0); - emptyDestTest = sqlite3VdbeAddOp2(v, OP_Goto, 0, 0); - sqlite3VdbeJumpHere(v, addr1); - } - if( HasRowid(pSrc) ){ - sqlite3OpenTable(pParse, iSrc, iDbSrc, pSrc, OP_OpenRead); - emptySrcTest = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); - if( pDest->iPKey>=0 ){ - addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid); - addr2 = sqlite3VdbeAddOp3(v, OP_NotExists, iDest, 0, regRowid); - sqlite3RowidConstraint(pParse, onError, pDest); - sqlite3VdbeJumpHere(v, addr2); - autoIncStep(pParse, regAutoinc, regRowid); - }else if( pDest->pIndex==0 ){ - addr1 = sqlite3VdbeAddOp2(v, OP_NewRowid, iDest, regRowid); - }else{ - addr1 = sqlite3VdbeAddOp2(v, OP_Rowid, iSrc, regRowid); - assert( (pDest->tabFlags & TF_Autoincrement)==0 ); - } - sqlite3VdbeAddOp2(v, OP_RowData, iSrc, regData); - sqlite3VdbeAddOp3(v, OP_Insert, iDest, regData, regRowid); - sqlite3VdbeChangeP5(v, OPFLAG_NCHANGE|OPFLAG_LASTROWID|OPFLAG_APPEND); - sqlite3VdbeChangeP4(v, -1, pDest->zName, 0); - sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1); - sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0); - sqlite3VdbeAddOp2(v, OP_Close, iDest, 0); - }else{ - sqlite3TableLock(pParse, iDbDest, pDest->tnum, 1, pDest->zName); - sqlite3TableLock(pParse, iDbSrc, pSrc->tnum, 0, pSrc->zName); - } - for(pDestIdx=pDest->pIndex; pDestIdx; pDestIdx=pDestIdx->pNext){ - for(pSrcIdx=pSrc->pIndex; ALWAYS(pSrcIdx); pSrcIdx=pSrcIdx->pNext){ - if( xferCompatibleIndex(pDestIdx, pSrcIdx) ) break; - } - assert( pSrcIdx ); - sqlite3VdbeAddOp3(v, OP_OpenRead, iSrc, pSrcIdx->tnum, iDbSrc); - sqlite3VdbeSetP4KeyInfo(pParse, pSrcIdx); - VdbeComment((v, "%s", pSrcIdx->zName)); - sqlite3VdbeAddOp3(v, OP_OpenWrite, iDest, pDestIdx->tnum, iDbDest); - sqlite3VdbeSetP4KeyInfo(pParse, pDestIdx); - sqlite3VdbeChangeP5(v, OPFLAG_BULKCSR); - VdbeComment((v, "%s", pDestIdx->zName)); - addr1 = sqlite3VdbeAddOp2(v, OP_Rewind, iSrc, 0); - sqlite3VdbeAddOp2(v, OP_RowKey, iSrc, regData); - sqlite3VdbeAddOp3(v, OP_IdxInsert, iDest, regData, 1); - sqlite3VdbeAddOp2(v, OP_Next, iSrc, addr1+1); - sqlite3VdbeJumpHere(v, addr1); - sqlite3VdbeAddOp2(v, OP_Close, iSrc, 0); - sqlite3VdbeAddOp2(v, OP_Close, iDest, 0); - } - sqlite3VdbeJumpHere(v, emptySrcTest); - sqlite3ReleaseTempReg(pParse, regRowid); - sqlite3ReleaseTempReg(pParse, regData); - if( emptyDestTest ){ - sqlite3VdbeAddOp2(v, OP_Halt, SQLITE_OK, 0); - sqlite3VdbeJumpHere(v, emptyDestTest); - sqlite3VdbeAddOp2(v, OP_Close, iDest, 0); - return 0; - }else{ - return 1; - } -} -#endif /* SQLITE_OMIT_XFER_OPT */ - -/************** End of insert.c **********************************************/ -/************** Begin file legacy.c ******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Main file for the SQLite library. The routines in this file -** implement the programmer interface to the library. Routines in -** other files are for internal use by SQLite and should not be -** accessed by users of the library. -*/ - - -/* -** Execute SQL code. Return one of the SQLITE_ success/failure -** codes. Also write an error message into memory obtained from -** malloc() and make *pzErrMsg point to that message. -** -** If the SQL is a query, then for each row in the query result -** the xCallback() function is called. pArg becomes the first -** argument to xCallback(). If xCallback=NULL then no callback -** is invoked, even for queries. -*/ -SQLITE_API int sqlite3_exec( - sqlite3 *db, /* The database on which the SQL executes */ - const char *zSql, /* The SQL to be executed */ - sqlite3_callback xCallback, /* Invoke this callback routine */ - void *pArg, /* First argument to xCallback() */ - char **pzErrMsg /* Write error messages here */ -){ - int rc = SQLITE_OK; /* Return code */ - const char *zLeftover; /* Tail of unprocessed SQL */ - sqlite3_stmt *pStmt = 0; /* The current SQL statement */ - char **azCols = 0; /* Names of result columns */ - int callbackIsInit; /* True if callback data is initialized */ - - if( !sqlite3SafetyCheckOk(db) ) return SQLITE_MISUSE_BKPT; - if( zSql==0 ) zSql = ""; - - sqlite3_mutex_enter(db->mutex); - sqlite3Error(db, SQLITE_OK, 0); - while( rc==SQLITE_OK && zSql[0] ){ - int nCol; - char **azVals = 0; - - pStmt = 0; - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover); - assert( rc==SQLITE_OK || pStmt==0 ); - if( rc!=SQLITE_OK ){ - continue; - } - if( !pStmt ){ - /* this happens for a comment or white-space */ - zSql = zLeftover; - continue; - } - - callbackIsInit = 0; - nCol = sqlite3_column_count(pStmt); - - while( 1 ){ - int i; - rc = sqlite3_step(pStmt); - - /* Invoke the callback function if required */ - if( xCallback && (SQLITE_ROW==rc || - (SQLITE_DONE==rc && !callbackIsInit - && db->flags&SQLITE_NullCallback)) ){ - if( !callbackIsInit ){ - azCols = sqlite3DbMallocZero(db, 2*nCol*sizeof(const char*) + 1); - if( azCols==0 ){ - goto exec_out; - } - for(i=0; imallocFailed = 1; - goto exec_out; - } - } - } - if( xCallback(pArg, nCol, azVals, azCols) ){ - rc = SQLITE_ABORT; - sqlite3VdbeFinalize((Vdbe *)pStmt); - pStmt = 0; - sqlite3Error(db, SQLITE_ABORT, 0); - goto exec_out; - } - } - - if( rc!=SQLITE_ROW ){ - rc = sqlite3VdbeFinalize((Vdbe *)pStmt); - pStmt = 0; - zSql = zLeftover; - while( sqlite3Isspace(zSql[0]) ) zSql++; - break; - } - } - - sqlite3DbFree(db, azCols); - azCols = 0; - } - -exec_out: - if( pStmt ) sqlite3VdbeFinalize((Vdbe *)pStmt); - sqlite3DbFree(db, azCols); - - rc = sqlite3ApiExit(db, rc); - if( rc!=SQLITE_OK && ALWAYS(rc==sqlite3_errcode(db)) && pzErrMsg ){ - int nErrMsg = 1 + sqlite3Strlen30(sqlite3_errmsg(db)); - *pzErrMsg = sqlite3Malloc(nErrMsg); - if( *pzErrMsg ){ - memcpy(*pzErrMsg, sqlite3_errmsg(db), nErrMsg); - }else{ - rc = SQLITE_NOMEM; - sqlite3Error(db, SQLITE_NOMEM, 0); - } - }else if( pzErrMsg ){ - *pzErrMsg = 0; - } - - assert( (rc&db->errMask)==rc ); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/************** End of legacy.c **********************************************/ -/************** Begin file loadext.c *****************************************/ -/* -** 2006 June 7 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code used to dynamically load extensions into -** the SQLite library. -*/ - -#ifndef SQLITE_CORE - #define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */ -#endif -/************** Include sqlite3ext.h in the middle of loadext.c **************/ -/************** Begin file sqlite3ext.h **************************************/ -/* -** 2006 June 7 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the SQLite interface for use by -** shared libraries that want to be imported as extensions into -** an SQLite instance. Shared libraries that intend to be loaded -** as extensions by SQLite should #include this file instead of -** sqlite3.h. -*/ -#ifndef _SQLITE3EXT_H_ -#define _SQLITE3EXT_H_ - -typedef struct sqlite3_api_routines sqlite3_api_routines; - -/* -** The following structure holds pointers to all of the SQLite API -** routines. -** -** WARNING: In order to maintain backwards compatibility, add new -** interfaces to the end of this structure only. If you insert new -** interfaces in the middle of this structure, then older different -** versions of SQLite will not be able to load each others' shared -** libraries! -*/ -struct sqlite3_api_routines { - void * (*aggregate_context)(sqlite3_context*,int nBytes); - int (*aggregate_count)(sqlite3_context*); - int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*)); - int (*bind_double)(sqlite3_stmt*,int,double); - int (*bind_int)(sqlite3_stmt*,int,int); - int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64); - int (*bind_null)(sqlite3_stmt*,int); - int (*bind_parameter_count)(sqlite3_stmt*); - int (*bind_parameter_index)(sqlite3_stmt*,const char*zName); - const char * (*bind_parameter_name)(sqlite3_stmt*,int); - int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*)); - int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*)); - int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); - int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); - int (*busy_timeout)(sqlite3*,int ms); - int (*changes)(sqlite3*); - int (*close)(sqlite3*); - int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, - int eTextRep,const char*)); - int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, - int eTextRep,const void*)); - const void * (*column_blob)(sqlite3_stmt*,int iCol); - int (*column_bytes)(sqlite3_stmt*,int iCol); - int (*column_bytes16)(sqlite3_stmt*,int iCol); - int (*column_count)(sqlite3_stmt*pStmt); - const char * (*column_database_name)(sqlite3_stmt*,int); - const void * (*column_database_name16)(sqlite3_stmt*,int); - const char * (*column_decltype)(sqlite3_stmt*,int i); - const void * (*column_decltype16)(sqlite3_stmt*,int); - double (*column_double)(sqlite3_stmt*,int iCol); - int (*column_int)(sqlite3_stmt*,int iCol); - sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol); - const char * (*column_name)(sqlite3_stmt*,int); - const void * (*column_name16)(sqlite3_stmt*,int); - const char * (*column_origin_name)(sqlite3_stmt*,int); - const void * (*column_origin_name16)(sqlite3_stmt*,int); - const char * (*column_table_name)(sqlite3_stmt*,int); - const void * (*column_table_name16)(sqlite3_stmt*,int); - const unsigned char * (*column_text)(sqlite3_stmt*,int iCol); - const void * (*column_text16)(sqlite3_stmt*,int iCol); - int (*column_type)(sqlite3_stmt*,int iCol); - sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); - void * (*commit_hook)(sqlite3*,int(*)(void*),void*); - int (*complete)(const char*sql); - int (*complete16)(const void*sql); - int (*create_collation)(sqlite3*,const char*,int,void*, - int(*)(void*,int,const void*,int,const void*)); - int (*create_collation16)(sqlite3*,const void*,int,void*, - int(*)(void*,int,const void*,int,const void*)); - int (*create_function)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_function16)(sqlite3*,const void*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); - int (*data_count)(sqlite3_stmt*pStmt); - sqlite3 * (*db_handle)(sqlite3_stmt*); - int (*declare_vtab)(sqlite3*,const char*); - int (*enable_shared_cache)(int); - int (*errcode)(sqlite3*db); - const char * (*errmsg)(sqlite3*); - const void * (*errmsg16)(sqlite3*); - int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**); - int (*expired)(sqlite3_stmt*); - int (*finalize)(sqlite3_stmt*pStmt); - void (*free)(void*); - void (*free_table)(char**result); - int (*get_autocommit)(sqlite3*); - void * (*get_auxdata)(sqlite3_context*,int); - int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**); - int (*global_recover)(void); - void (*interruptx)(sqlite3*); - sqlite_int64 (*last_insert_rowid)(sqlite3*); - const char * (*libversion)(void); - int (*libversion_number)(void); - void *(*malloc)(int); - char * (*mprintf)(const char*,...); - int (*open)(const char*,sqlite3**); - int (*open16)(const void*,sqlite3**); - int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); - void (*progress_handler)(sqlite3*,int,int(*)(void*),void*); - void *(*realloc)(void*,int); - int (*reset)(sqlite3_stmt*pStmt); - void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_double)(sqlite3_context*,double); - void (*result_error)(sqlite3_context*,const char*,int); - void (*result_error16)(sqlite3_context*,const void*,int); - void (*result_int)(sqlite3_context*,int); - void (*result_int64)(sqlite3_context*,sqlite_int64); - void (*result_null)(sqlite3_context*); - void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*)); - void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_value)(sqlite3_context*,sqlite3_value*); - void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); - int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, - const char*,const char*),void*); - void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); - char * (*snprintf)(int,char*,const char*,...); - int (*step)(sqlite3_stmt*); - int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, - char const**,char const**,int*,int*,int*); - void (*thread_cleanup)(void); - int (*total_changes)(sqlite3*); - void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); - int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); - void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, - sqlite_int64),void*); - void * (*user_data)(sqlite3_context*); - const void * (*value_blob)(sqlite3_value*); - int (*value_bytes)(sqlite3_value*); - int (*value_bytes16)(sqlite3_value*); - double (*value_double)(sqlite3_value*); - int (*value_int)(sqlite3_value*); - sqlite_int64 (*value_int64)(sqlite3_value*); - int (*value_numeric_type)(sqlite3_value*); - const unsigned char * (*value_text)(sqlite3_value*); - const void * (*value_text16)(sqlite3_value*); - const void * (*value_text16be)(sqlite3_value*); - const void * (*value_text16le)(sqlite3_value*); - int (*value_type)(sqlite3_value*); - char *(*vmprintf)(const char*,va_list); - /* Added ??? */ - int (*overload_function)(sqlite3*, const char *zFuncName, int nArg); - /* Added by 3.3.13 */ - int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - int (*clear_bindings)(sqlite3_stmt*); - /* Added by 3.4.1 */ - int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, - void (*xDestroy)(void *)); - /* Added by 3.5.0 */ - int (*bind_zeroblob)(sqlite3_stmt*,int,int); - int (*blob_bytes)(sqlite3_blob*); - int (*blob_close)(sqlite3_blob*); - int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, - int,sqlite3_blob**); - int (*blob_read)(sqlite3_blob*,void*,int,int); - int (*blob_write)(sqlite3_blob*,const void*,int,int); - int (*create_collation_v2)(sqlite3*,const char*,int,void*, - int(*)(void*,int,const void*,int,const void*), - void(*)(void*)); - int (*file_control)(sqlite3*,const char*,int,void*); - sqlite3_int64 (*memory_highwater)(int); - sqlite3_int64 (*memory_used)(void); - sqlite3_mutex *(*mutex_alloc)(int); - void (*mutex_enter)(sqlite3_mutex*); - void (*mutex_free)(sqlite3_mutex*); - void (*mutex_leave)(sqlite3_mutex*); - int (*mutex_try)(sqlite3_mutex*); - int (*open_v2)(const char*,sqlite3**,int,const char*); - int (*release_memory)(int); - void (*result_error_nomem)(sqlite3_context*); - void (*result_error_toobig)(sqlite3_context*); - int (*sleep)(int); - void (*soft_heap_limit)(int); - sqlite3_vfs *(*vfs_find)(const char*); - int (*vfs_register)(sqlite3_vfs*,int); - int (*vfs_unregister)(sqlite3_vfs*); - int (*xthreadsafe)(void); - void (*result_zeroblob)(sqlite3_context*,int); - void (*result_error_code)(sqlite3_context*,int); - int (*test_control)(int, ...); - void (*randomness)(int,void*); - sqlite3 *(*context_db_handle)(sqlite3_context*); - int (*extended_result_codes)(sqlite3*,int); - int (*limit)(sqlite3*,int,int); - sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*); - const char *(*sql)(sqlite3_stmt*); - int (*status)(int,int*,int*,int); - int (*backup_finish)(sqlite3_backup*); - sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*); - int (*backup_pagecount)(sqlite3_backup*); - int (*backup_remaining)(sqlite3_backup*); - int (*backup_step)(sqlite3_backup*,int); - const char *(*compileoption_get)(int); - int (*compileoption_used)(const char*); - int (*create_function_v2)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void(*xDestroy)(void*)); - int (*db_config)(sqlite3*,int,...); - sqlite3_mutex *(*db_mutex)(sqlite3*); - int (*db_status)(sqlite3*,int,int*,int*,int); - int (*extended_errcode)(sqlite3*); - void (*log)(int,const char*,...); - sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64); - const char *(*sourceid)(void); - int (*stmt_status)(sqlite3_stmt*,int,int); - int (*strnicmp)(const char*,const char*,int); - int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*); - int (*wal_autocheckpoint)(sqlite3*,int); - int (*wal_checkpoint)(sqlite3*,const char*); - void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); - int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); - int (*vtab_config)(sqlite3*,int op,...); - int (*vtab_on_conflict)(sqlite3*); - /* Version 3.7.16 and later */ - int (*close_v2)(sqlite3*); - const char *(*db_filename)(sqlite3*,const char*); - int (*db_readonly)(sqlite3*,const char*); - int (*db_release_memory)(sqlite3*); - const char *(*errstr)(int); - int (*stmt_busy)(sqlite3_stmt*); - int (*stmt_readonly)(sqlite3_stmt*); - int (*stricmp)(const char*,const char*); - int (*uri_boolean)(const char*,const char*,int); - sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); - const char *(*uri_parameter)(const char*,const char*); - char *(*vsnprintf)(int,char*,const char*,va_list); - int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); -}; - -/* -** The following macros redefine the API routines so that they are -** redirected throught the global sqlite3_api structure. -** -** This header file is also used by the loadext.c source file -** (part of the main SQLite library - not an extension) so that -** it can get access to the sqlite3_api_routines structure -** definition. But the main library does not want to redefine -** the API. So the redefinition macros are only valid if the -** SQLITE_CORE macros is undefined. -*/ -#ifndef SQLITE_CORE -#define sqlite3_aggregate_context sqlite3_api->aggregate_context -#ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_aggregate_count sqlite3_api->aggregate_count -#endif -#define sqlite3_bind_blob sqlite3_api->bind_blob -#define sqlite3_bind_double sqlite3_api->bind_double -#define sqlite3_bind_int sqlite3_api->bind_int -#define sqlite3_bind_int64 sqlite3_api->bind_int64 -#define sqlite3_bind_null sqlite3_api->bind_null -#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count -#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index -#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name -#define sqlite3_bind_text sqlite3_api->bind_text -#define sqlite3_bind_text16 sqlite3_api->bind_text16 -#define sqlite3_bind_value sqlite3_api->bind_value -#define sqlite3_busy_handler sqlite3_api->busy_handler -#define sqlite3_busy_timeout sqlite3_api->busy_timeout -#define sqlite3_changes sqlite3_api->changes -#define sqlite3_close sqlite3_api->close -#define sqlite3_collation_needed sqlite3_api->collation_needed -#define sqlite3_collation_needed16 sqlite3_api->collation_needed16 -#define sqlite3_column_blob sqlite3_api->column_blob -#define sqlite3_column_bytes sqlite3_api->column_bytes -#define sqlite3_column_bytes16 sqlite3_api->column_bytes16 -#define sqlite3_column_count sqlite3_api->column_count -#define sqlite3_column_database_name sqlite3_api->column_database_name -#define sqlite3_column_database_name16 sqlite3_api->column_database_name16 -#define sqlite3_column_decltype sqlite3_api->column_decltype -#define sqlite3_column_decltype16 sqlite3_api->column_decltype16 -#define sqlite3_column_double sqlite3_api->column_double -#define sqlite3_column_int sqlite3_api->column_int -#define sqlite3_column_int64 sqlite3_api->column_int64 -#define sqlite3_column_name sqlite3_api->column_name -#define sqlite3_column_name16 sqlite3_api->column_name16 -#define sqlite3_column_origin_name sqlite3_api->column_origin_name -#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16 -#define sqlite3_column_table_name sqlite3_api->column_table_name -#define sqlite3_column_table_name16 sqlite3_api->column_table_name16 -#define sqlite3_column_text sqlite3_api->column_text -#define sqlite3_column_text16 sqlite3_api->column_text16 -#define sqlite3_column_type sqlite3_api->column_type -#define sqlite3_column_value sqlite3_api->column_value -#define sqlite3_commit_hook sqlite3_api->commit_hook -#define sqlite3_complete sqlite3_api->complete -#define sqlite3_complete16 sqlite3_api->complete16 -#define sqlite3_create_collation sqlite3_api->create_collation -#define sqlite3_create_collation16 sqlite3_api->create_collation16 -#define sqlite3_create_function sqlite3_api->create_function -#define sqlite3_create_function16 sqlite3_api->create_function16 -#define sqlite3_create_module sqlite3_api->create_module -#define sqlite3_create_module_v2 sqlite3_api->create_module_v2 -#define sqlite3_data_count sqlite3_api->data_count -#define sqlite3_db_handle sqlite3_api->db_handle -#define sqlite3_declare_vtab sqlite3_api->declare_vtab -#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache -#define sqlite3_errcode sqlite3_api->errcode -#define sqlite3_errmsg sqlite3_api->errmsg -#define sqlite3_errmsg16 sqlite3_api->errmsg16 -#define sqlite3_exec sqlite3_api->exec -#ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_expired sqlite3_api->expired -#endif -#define sqlite3_finalize sqlite3_api->finalize -#define sqlite3_free sqlite3_api->free -#define sqlite3_free_table sqlite3_api->free_table -#define sqlite3_get_autocommit sqlite3_api->get_autocommit -#define sqlite3_get_auxdata sqlite3_api->get_auxdata -#define sqlite3_get_table sqlite3_api->get_table -#ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_global_recover sqlite3_api->global_recover -#endif -#define sqlite3_interrupt sqlite3_api->interruptx -#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid -#define sqlite3_libversion sqlite3_api->libversion -#define sqlite3_libversion_number sqlite3_api->libversion_number -#define sqlite3_malloc sqlite3_api->malloc -#define sqlite3_mprintf sqlite3_api->mprintf -#define sqlite3_open sqlite3_api->open -#define sqlite3_open16 sqlite3_api->open16 -#define sqlite3_prepare sqlite3_api->prepare -#define sqlite3_prepare16 sqlite3_api->prepare16 -#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 -#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 -#define sqlite3_profile sqlite3_api->profile -#define sqlite3_progress_handler sqlite3_api->progress_handler -#define sqlite3_realloc sqlite3_api->realloc -#define sqlite3_reset sqlite3_api->reset -#define sqlite3_result_blob sqlite3_api->result_blob -#define sqlite3_result_double sqlite3_api->result_double -#define sqlite3_result_error sqlite3_api->result_error -#define sqlite3_result_error16 sqlite3_api->result_error16 -#define sqlite3_result_int sqlite3_api->result_int -#define sqlite3_result_int64 sqlite3_api->result_int64 -#define sqlite3_result_null sqlite3_api->result_null -#define sqlite3_result_text sqlite3_api->result_text -#define sqlite3_result_text16 sqlite3_api->result_text16 -#define sqlite3_result_text16be sqlite3_api->result_text16be -#define sqlite3_result_text16le sqlite3_api->result_text16le -#define sqlite3_result_value sqlite3_api->result_value -#define sqlite3_rollback_hook sqlite3_api->rollback_hook -#define sqlite3_set_authorizer sqlite3_api->set_authorizer -#define sqlite3_set_auxdata sqlite3_api->set_auxdata -#define sqlite3_snprintf sqlite3_api->snprintf -#define sqlite3_step sqlite3_api->step -#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata -#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup -#define sqlite3_total_changes sqlite3_api->total_changes -#define sqlite3_trace sqlite3_api->trace -#ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings -#endif -#define sqlite3_update_hook sqlite3_api->update_hook -#define sqlite3_user_data sqlite3_api->user_data -#define sqlite3_value_blob sqlite3_api->value_blob -#define sqlite3_value_bytes sqlite3_api->value_bytes -#define sqlite3_value_bytes16 sqlite3_api->value_bytes16 -#define sqlite3_value_double sqlite3_api->value_double -#define sqlite3_value_int sqlite3_api->value_int -#define sqlite3_value_int64 sqlite3_api->value_int64 -#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type -#define sqlite3_value_text sqlite3_api->value_text -#define sqlite3_value_text16 sqlite3_api->value_text16 -#define sqlite3_value_text16be sqlite3_api->value_text16be -#define sqlite3_value_text16le sqlite3_api->value_text16le -#define sqlite3_value_type sqlite3_api->value_type -#define sqlite3_vmprintf sqlite3_api->vmprintf -#define sqlite3_overload_function sqlite3_api->overload_function -#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 -#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 -#define sqlite3_clear_bindings sqlite3_api->clear_bindings -#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob -#define sqlite3_blob_bytes sqlite3_api->blob_bytes -#define sqlite3_blob_close sqlite3_api->blob_close -#define sqlite3_blob_open sqlite3_api->blob_open -#define sqlite3_blob_read sqlite3_api->blob_read -#define sqlite3_blob_write sqlite3_api->blob_write -#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2 -#define sqlite3_file_control sqlite3_api->file_control -#define sqlite3_memory_highwater sqlite3_api->memory_highwater -#define sqlite3_memory_used sqlite3_api->memory_used -#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc -#define sqlite3_mutex_enter sqlite3_api->mutex_enter -#define sqlite3_mutex_free sqlite3_api->mutex_free -#define sqlite3_mutex_leave sqlite3_api->mutex_leave -#define sqlite3_mutex_try sqlite3_api->mutex_try -#define sqlite3_open_v2 sqlite3_api->open_v2 -#define sqlite3_release_memory sqlite3_api->release_memory -#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem -#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig -#define sqlite3_sleep sqlite3_api->sleep -#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit -#define sqlite3_vfs_find sqlite3_api->vfs_find -#define sqlite3_vfs_register sqlite3_api->vfs_register -#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister -#define sqlite3_threadsafe sqlite3_api->xthreadsafe -#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob -#define sqlite3_result_error_code sqlite3_api->result_error_code -#define sqlite3_test_control sqlite3_api->test_control -#define sqlite3_randomness sqlite3_api->randomness -#define sqlite3_context_db_handle sqlite3_api->context_db_handle -#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes -#define sqlite3_limit sqlite3_api->limit -#define sqlite3_next_stmt sqlite3_api->next_stmt -#define sqlite3_sql sqlite3_api->sql -#define sqlite3_status sqlite3_api->status -#define sqlite3_backup_finish sqlite3_api->backup_finish -#define sqlite3_backup_init sqlite3_api->backup_init -#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount -#define sqlite3_backup_remaining sqlite3_api->backup_remaining -#define sqlite3_backup_step sqlite3_api->backup_step -#define sqlite3_compileoption_get sqlite3_api->compileoption_get -#define sqlite3_compileoption_used sqlite3_api->compileoption_used -#define sqlite3_create_function_v2 sqlite3_api->create_function_v2 -#define sqlite3_db_config sqlite3_api->db_config -#define sqlite3_db_mutex sqlite3_api->db_mutex -#define sqlite3_db_status sqlite3_api->db_status -#define sqlite3_extended_errcode sqlite3_api->extended_errcode -#define sqlite3_log sqlite3_api->log -#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64 -#define sqlite3_sourceid sqlite3_api->sourceid -#define sqlite3_stmt_status sqlite3_api->stmt_status -#define sqlite3_strnicmp sqlite3_api->strnicmp -#define sqlite3_unlock_notify sqlite3_api->unlock_notify -#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint -#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint -#define sqlite3_wal_hook sqlite3_api->wal_hook -#define sqlite3_blob_reopen sqlite3_api->blob_reopen -#define sqlite3_vtab_config sqlite3_api->vtab_config -#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict -/* Version 3.7.16 and later */ -#define sqlite3_close_v2 sqlite3_api->close_v2 -#define sqlite3_db_filename sqlite3_api->db_filename -#define sqlite3_db_readonly sqlite3_api->db_readonly -#define sqlite3_db_release_memory sqlite3_api->db_release_memory -#define sqlite3_errstr sqlite3_api->errstr -#define sqlite3_stmt_busy sqlite3_api->stmt_busy -#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly -#define sqlite3_stricmp sqlite3_api->stricmp -#define sqlite3_uri_boolean sqlite3_api->uri_boolean -#define sqlite3_uri_int64 sqlite3_api->uri_int64 -#define sqlite3_uri_parameter sqlite3_api->uri_parameter -#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf -#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2 -#endif /* SQLITE_CORE */ - -#ifndef SQLITE_CORE - /* This case when the file really is being compiled as a loadable - ** extension */ -# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; -# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; -# define SQLITE_EXTENSION_INIT3 \ - extern const sqlite3_api_routines *sqlite3_api; -#else - /* This case when the file is being statically linked into the - ** application */ -# define SQLITE_EXTENSION_INIT1 /*no-op*/ -# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ -# define SQLITE_EXTENSION_INIT3 /*no-op*/ -#endif - -#endif /* _SQLITE3EXT_H_ */ - -/************** End of sqlite3ext.h ******************************************/ -/************** Continuing where we left off in loadext.c ********************/ -/* #include */ - -#ifndef SQLITE_OMIT_LOAD_EXTENSION - -/* -** Some API routines are omitted when various features are -** excluded from a build of SQLite. Substitute a NULL pointer -** for any missing APIs. -*/ -#ifndef SQLITE_ENABLE_COLUMN_METADATA -# define sqlite3_column_database_name 0 -# define sqlite3_column_database_name16 0 -# define sqlite3_column_table_name 0 -# define sqlite3_column_table_name16 0 -# define sqlite3_column_origin_name 0 -# define sqlite3_column_origin_name16 0 -# define sqlite3_table_column_metadata 0 -#endif - -#ifdef SQLITE_OMIT_AUTHORIZATION -# define sqlite3_set_authorizer 0 -#endif - -#ifdef SQLITE_OMIT_UTF16 -# define sqlite3_bind_text16 0 -# define sqlite3_collation_needed16 0 -# define sqlite3_column_decltype16 0 -# define sqlite3_column_name16 0 -# define sqlite3_column_text16 0 -# define sqlite3_complete16 0 -# define sqlite3_create_collation16 0 -# define sqlite3_create_function16 0 -# define sqlite3_errmsg16 0 -# define sqlite3_open16 0 -# define sqlite3_prepare16 0 -# define sqlite3_prepare16_v2 0 -# define sqlite3_result_error16 0 -# define sqlite3_result_text16 0 -# define sqlite3_result_text16be 0 -# define sqlite3_result_text16le 0 -# define sqlite3_value_text16 0 -# define sqlite3_value_text16be 0 -# define sqlite3_value_text16le 0 -# define sqlite3_column_database_name16 0 -# define sqlite3_column_table_name16 0 -# define sqlite3_column_origin_name16 0 -#endif - -#ifdef SQLITE_OMIT_COMPLETE -# define sqlite3_complete 0 -# define sqlite3_complete16 0 -#endif - -#ifdef SQLITE_OMIT_DECLTYPE -# define sqlite3_column_decltype16 0 -# define sqlite3_column_decltype 0 -#endif - -#ifdef SQLITE_OMIT_PROGRESS_CALLBACK -# define sqlite3_progress_handler 0 -#endif - -#ifdef SQLITE_OMIT_VIRTUALTABLE -# define sqlite3_create_module 0 -# define sqlite3_create_module_v2 0 -# define sqlite3_declare_vtab 0 -# define sqlite3_vtab_config 0 -# define sqlite3_vtab_on_conflict 0 -#endif - -#ifdef SQLITE_OMIT_SHARED_CACHE -# define sqlite3_enable_shared_cache 0 -#endif - -#ifdef SQLITE_OMIT_TRACE -# define sqlite3_profile 0 -# define sqlite3_trace 0 -#endif - -#ifdef SQLITE_OMIT_GET_TABLE -# define sqlite3_free_table 0 -# define sqlite3_get_table 0 -#endif - -#ifdef SQLITE_OMIT_INCRBLOB -#define sqlite3_bind_zeroblob 0 -#define sqlite3_blob_bytes 0 -#define sqlite3_blob_close 0 -#define sqlite3_blob_open 0 -#define sqlite3_blob_read 0 -#define sqlite3_blob_write 0 -#define sqlite3_blob_reopen 0 -#endif - -/* -** The following structure contains pointers to all SQLite API routines. -** A pointer to this structure is passed into extensions when they are -** loaded so that the extension can make calls back into the SQLite -** library. -** -** When adding new APIs, add them to the bottom of this structure -** in order to preserve backwards compatibility. -** -** Extensions that use newer APIs should first call the -** sqlite3_libversion_number() to make sure that the API they -** intend to use is supported by the library. Extensions should -** also check to make sure that the pointer to the function is -** not NULL before calling it. -*/ -static const sqlite3_api_routines sqlite3Apis = { - sqlite3_aggregate_context, -#ifndef SQLITE_OMIT_DEPRECATED - sqlite3_aggregate_count, -#else - 0, -#endif - sqlite3_bind_blob, - sqlite3_bind_double, - sqlite3_bind_int, - sqlite3_bind_int64, - sqlite3_bind_null, - sqlite3_bind_parameter_count, - sqlite3_bind_parameter_index, - sqlite3_bind_parameter_name, - sqlite3_bind_text, - sqlite3_bind_text16, - sqlite3_bind_value, - sqlite3_busy_handler, - sqlite3_busy_timeout, - sqlite3_changes, - sqlite3_close, - sqlite3_collation_needed, - sqlite3_collation_needed16, - sqlite3_column_blob, - sqlite3_column_bytes, - sqlite3_column_bytes16, - sqlite3_column_count, - sqlite3_column_database_name, - sqlite3_column_database_name16, - sqlite3_column_decltype, - sqlite3_column_decltype16, - sqlite3_column_double, - sqlite3_column_int, - sqlite3_column_int64, - sqlite3_column_name, - sqlite3_column_name16, - sqlite3_column_origin_name, - sqlite3_column_origin_name16, - sqlite3_column_table_name, - sqlite3_column_table_name16, - sqlite3_column_text, - sqlite3_column_text16, - sqlite3_column_type, - sqlite3_column_value, - sqlite3_commit_hook, - sqlite3_complete, - sqlite3_complete16, - sqlite3_create_collation, - sqlite3_create_collation16, - sqlite3_create_function, - sqlite3_create_function16, - sqlite3_create_module, - sqlite3_data_count, - sqlite3_db_handle, - sqlite3_declare_vtab, - sqlite3_enable_shared_cache, - sqlite3_errcode, - sqlite3_errmsg, - sqlite3_errmsg16, - sqlite3_exec, -#ifndef SQLITE_OMIT_DEPRECATED - sqlite3_expired, -#else - 0, -#endif - sqlite3_finalize, - sqlite3_free, - sqlite3_free_table, - sqlite3_get_autocommit, - sqlite3_get_auxdata, - sqlite3_get_table, - 0, /* Was sqlite3_global_recover(), but that function is deprecated */ - sqlite3_interrupt, - sqlite3_last_insert_rowid, - sqlite3_libversion, - sqlite3_libversion_number, - sqlite3_malloc, - sqlite3_mprintf, - sqlite3_open, - sqlite3_open16, - sqlite3_prepare, - sqlite3_prepare16, - sqlite3_profile, - sqlite3_progress_handler, - sqlite3_realloc, - sqlite3_reset, - sqlite3_result_blob, - sqlite3_result_double, - sqlite3_result_error, - sqlite3_result_error16, - sqlite3_result_int, - sqlite3_result_int64, - sqlite3_result_null, - sqlite3_result_text, - sqlite3_result_text16, - sqlite3_result_text16be, - sqlite3_result_text16le, - sqlite3_result_value, - sqlite3_rollback_hook, - sqlite3_set_authorizer, - sqlite3_set_auxdata, - sqlite3_snprintf, - sqlite3_step, - sqlite3_table_column_metadata, -#ifndef SQLITE_OMIT_DEPRECATED - sqlite3_thread_cleanup, -#else - 0, -#endif - sqlite3_total_changes, - sqlite3_trace, -#ifndef SQLITE_OMIT_DEPRECATED - sqlite3_transfer_bindings, -#else - 0, -#endif - sqlite3_update_hook, - sqlite3_user_data, - sqlite3_value_blob, - sqlite3_value_bytes, - sqlite3_value_bytes16, - sqlite3_value_double, - sqlite3_value_int, - sqlite3_value_int64, - sqlite3_value_numeric_type, - sqlite3_value_text, - sqlite3_value_text16, - sqlite3_value_text16be, - sqlite3_value_text16le, - sqlite3_value_type, - sqlite3_vmprintf, - /* - ** The original API set ends here. All extensions can call any - ** of the APIs above provided that the pointer is not NULL. But - ** before calling APIs that follow, extension should check the - ** sqlite3_libversion_number() to make sure they are dealing with - ** a library that is new enough to support that API. - ************************************************************************* - */ - sqlite3_overload_function, - - /* - ** Added after 3.3.13 - */ - sqlite3_prepare_v2, - sqlite3_prepare16_v2, - sqlite3_clear_bindings, - - /* - ** Added for 3.4.1 - */ - sqlite3_create_module_v2, - - /* - ** Added for 3.5.0 - */ - sqlite3_bind_zeroblob, - sqlite3_blob_bytes, - sqlite3_blob_close, - sqlite3_blob_open, - sqlite3_blob_read, - sqlite3_blob_write, - sqlite3_create_collation_v2, - sqlite3_file_control, - sqlite3_memory_highwater, - sqlite3_memory_used, -#ifdef SQLITE_MUTEX_OMIT - 0, - 0, - 0, - 0, - 0, -#else - sqlite3_mutex_alloc, - sqlite3_mutex_enter, - sqlite3_mutex_free, - sqlite3_mutex_leave, - sqlite3_mutex_try, -#endif - sqlite3_open_v2, - sqlite3_release_memory, - sqlite3_result_error_nomem, - sqlite3_result_error_toobig, - sqlite3_sleep, - sqlite3_soft_heap_limit, - sqlite3_vfs_find, - sqlite3_vfs_register, - sqlite3_vfs_unregister, - - /* - ** Added for 3.5.8 - */ - sqlite3_threadsafe, - sqlite3_result_zeroblob, - sqlite3_result_error_code, - sqlite3_test_control, - sqlite3_randomness, - sqlite3_context_db_handle, - - /* - ** Added for 3.6.0 - */ - sqlite3_extended_result_codes, - sqlite3_limit, - sqlite3_next_stmt, - sqlite3_sql, - sqlite3_status, - - /* - ** Added for 3.7.4 - */ - sqlite3_backup_finish, - sqlite3_backup_init, - sqlite3_backup_pagecount, - sqlite3_backup_remaining, - sqlite3_backup_step, -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS - sqlite3_compileoption_get, - sqlite3_compileoption_used, -#else - 0, - 0, -#endif - sqlite3_create_function_v2, - sqlite3_db_config, - sqlite3_db_mutex, - sqlite3_db_status, - sqlite3_extended_errcode, - sqlite3_log, - sqlite3_soft_heap_limit64, - sqlite3_sourceid, - sqlite3_stmt_status, - sqlite3_strnicmp, -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY - sqlite3_unlock_notify, -#else - 0, -#endif -#ifndef SQLITE_OMIT_WAL - sqlite3_wal_autocheckpoint, - sqlite3_wal_checkpoint, - sqlite3_wal_hook, -#else - 0, - 0, - 0, -#endif - sqlite3_blob_reopen, - sqlite3_vtab_config, - sqlite3_vtab_on_conflict, - sqlite3_close_v2, - sqlite3_db_filename, - sqlite3_db_readonly, - sqlite3_db_release_memory, - sqlite3_errstr, - sqlite3_stmt_busy, - sqlite3_stmt_readonly, - sqlite3_stricmp, - sqlite3_uri_boolean, - sqlite3_uri_int64, - sqlite3_uri_parameter, - sqlite3_vsnprintf, - sqlite3_wal_checkpoint_v2 -}; - -/* -** Attempt to load an SQLite extension library contained in the file -** zFile. The entry point is zProc. zProc may be 0 in which case a -** default entry point name (sqlite3_extension_init) is used. Use -** of the default name is recommended. -** -** Return SQLITE_OK on success and SQLITE_ERROR if something goes wrong. -** -** If an error occurs and pzErrMsg is not 0, then fill *pzErrMsg with -** error message text. The calling function should free this memory -** by calling sqlite3DbFree(db, ). -*/ -static int sqlite3LoadExtension( - sqlite3 *db, /* Load the extension into this database connection */ - const char *zFile, /* Name of the shared library containing extension */ - const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */ - char **pzErrMsg /* Put error message here if not 0 */ -){ - sqlite3_vfs *pVfs = db->pVfs; - void *handle; - int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*); - char *zErrmsg = 0; - const char *zEntry; - char *zAltEntry = 0; - void **aHandle; - int nMsg = 300 + sqlite3Strlen30(zFile); - int ii; - - /* Shared library endings to try if zFile cannot be loaded as written */ - static const char *azEndings[] = { -#if SQLITE_OS_WIN - "dll" -#elif defined(__APPLE__) - "dylib" -#else - "so" -#endif - }; - - - if( pzErrMsg ) *pzErrMsg = 0; - - /* Ticket #1863. To avoid a creating security problems for older - ** applications that relink against newer versions of SQLite, the - ** ability to run load_extension is turned off by default. One - ** must call sqlite3_enable_load_extension() to turn on extension - ** loading. Otherwise you get the following error. - */ - if( (db->flags & SQLITE_LoadExtension)==0 ){ - if( pzErrMsg ){ - *pzErrMsg = sqlite3_mprintf("not authorized"); - } - return SQLITE_ERROR; - } - - zEntry = zProc ? zProc : "sqlite3_extension_init"; - - handle = sqlite3OsDlOpen(pVfs, zFile); -#if SQLITE_OS_UNIX || SQLITE_OS_WIN - for(ii=0; ii sqlite3_example_init - ** C:/lib/mathfuncs.dll ==> sqlite3_mathfuncs_init - */ - if( xInit==0 && zProc==0 ){ - int iFile, iEntry, c; - int ncFile = sqlite3Strlen30(zFile); - zAltEntry = sqlite3_malloc(ncFile+30); - if( zAltEntry==0 ){ - sqlite3OsDlClose(pVfs, handle); - return SQLITE_NOMEM; - } - memcpy(zAltEntry, "sqlite3_", 8); - for(iFile=ncFile-1; iFile>=0 && zFile[iFile]!='/'; iFile--){} - iFile++; - if( sqlite3_strnicmp(zFile+iFile, "lib", 3)==0 ) iFile += 3; - for(iEntry=8; (c = zFile[iFile])!=0 && c!='.'; iFile++){ - if( sqlite3Isalpha(c) ){ - zAltEntry[iEntry++] = (char)sqlite3UpperToLower[(unsigned)c]; - } - } - memcpy(zAltEntry+iEntry, "_init", 6); - zEntry = zAltEntry; - xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) - sqlite3OsDlSym(pVfs, handle, zEntry); - } - if( xInit==0 ){ - if( pzErrMsg ){ - nMsg += sqlite3Strlen30(zEntry); - *pzErrMsg = zErrmsg = sqlite3_malloc(nMsg); - if( zErrmsg ){ - sqlite3_snprintf(nMsg, zErrmsg, - "no entry point [%s] in shared library [%s]", zEntry, zFile); - sqlite3OsDlError(pVfs, nMsg-1, zErrmsg); - } - } - sqlite3OsDlClose(pVfs, handle); - sqlite3_free(zAltEntry); - return SQLITE_ERROR; - } - sqlite3_free(zAltEntry); - if( xInit(db, &zErrmsg, &sqlite3Apis) ){ - if( pzErrMsg ){ - *pzErrMsg = sqlite3_mprintf("error during initialization: %s", zErrmsg); - } - sqlite3_free(zErrmsg); - sqlite3OsDlClose(pVfs, handle); - return SQLITE_ERROR; - } - - /* Append the new shared library handle to the db->aExtension array. */ - aHandle = sqlite3DbMallocZero(db, sizeof(handle)*(db->nExtension+1)); - if( aHandle==0 ){ - return SQLITE_NOMEM; - } - if( db->nExtension>0 ){ - memcpy(aHandle, db->aExtension, sizeof(handle)*db->nExtension); - } - sqlite3DbFree(db, db->aExtension); - db->aExtension = aHandle; - - db->aExtension[db->nExtension++] = handle; - return SQLITE_OK; -} -SQLITE_API int sqlite3_load_extension( - sqlite3 *db, /* Load the extension into this database connection */ - const char *zFile, /* Name of the shared library containing extension */ - const char *zProc, /* Entry point. Use "sqlite3_extension_init" if 0 */ - char **pzErrMsg /* Put error message here if not 0 */ -){ - int rc; - sqlite3_mutex_enter(db->mutex); - rc = sqlite3LoadExtension(db, zFile, zProc, pzErrMsg); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/* -** Call this routine when the database connection is closing in order -** to clean up loaded extensions -*/ -SQLITE_PRIVATE void sqlite3CloseExtensions(sqlite3 *db){ - int i; - assert( sqlite3_mutex_held(db->mutex) ); - for(i=0; inExtension; i++){ - sqlite3OsDlClose(db->pVfs, db->aExtension[i]); - } - sqlite3DbFree(db, db->aExtension); -} - -/* -** Enable or disable extension loading. Extension loading is disabled by -** default so as not to open security holes in older applications. -*/ -SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff){ - sqlite3_mutex_enter(db->mutex); - if( onoff ){ - db->flags |= SQLITE_LoadExtension; - }else{ - db->flags &= ~SQLITE_LoadExtension; - } - sqlite3_mutex_leave(db->mutex); - return SQLITE_OK; -} - -#endif /* SQLITE_OMIT_LOAD_EXTENSION */ - -/* -** The auto-extension code added regardless of whether or not extension -** loading is supported. We need a dummy sqlite3Apis pointer for that -** code if regular extension loading is not available. This is that -** dummy pointer. -*/ -#ifdef SQLITE_OMIT_LOAD_EXTENSION -static const sqlite3_api_routines sqlite3Apis = { 0 }; -#endif - - -/* -** The following object holds the list of automatically loaded -** extensions. -** -** This list is shared across threads. The SQLITE_MUTEX_STATIC_MASTER -** mutex must be held while accessing this list. -*/ -typedef struct sqlite3AutoExtList sqlite3AutoExtList; -static SQLITE_WSD struct sqlite3AutoExtList { - int nExt; /* Number of entries in aExt[] */ - void (**aExt)(void); /* Pointers to the extension init functions */ -} sqlite3Autoext = { 0, 0 }; - -/* The "wsdAutoext" macro will resolve to the autoextension -** state vector. If writable static data is unsupported on the target, -** we have to locate the state vector at run-time. In the more common -** case where writable static data is supported, wsdStat can refer directly -** to the "sqlite3Autoext" state vector declared above. -*/ -#ifdef SQLITE_OMIT_WSD -# define wsdAutoextInit \ - sqlite3AutoExtList *x = &GLOBAL(sqlite3AutoExtList,sqlite3Autoext) -# define wsdAutoext x[0] -#else -# define wsdAutoextInit -# define wsdAutoext sqlite3Autoext -#endif - - -/* -** Register a statically linked extension that is automatically -** loaded by every new database connection. -*/ -SQLITE_API int sqlite3_auto_extension(void (*xInit)(void)){ - int rc = SQLITE_OK; -#ifndef SQLITE_OMIT_AUTOINIT - rc = sqlite3_initialize(); - if( rc ){ - return rc; - }else -#endif - { - int i; -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); -#endif - wsdAutoextInit; - sqlite3_mutex_enter(mutex); - for(i=0; i=0; i--){ - if( wsdAutoext.aExt[i]==xInit ){ - wsdAutoext.nExt--; - wsdAutoext.aExt[i] = wsdAutoext.aExt[wsdAutoext.nExt]; - n++; - break; - } - } - sqlite3_mutex_leave(mutex); - return n; -} - -/* -** Reset the automatic extension loading mechanism. -*/ -SQLITE_API void sqlite3_reset_auto_extension(void){ -#ifndef SQLITE_OMIT_AUTOINIT - if( sqlite3_initialize()==SQLITE_OK ) -#endif - { -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); -#endif - wsdAutoextInit; - sqlite3_mutex_enter(mutex); - sqlite3_free(wsdAutoext.aExt); - wsdAutoext.aExt = 0; - wsdAutoext.nExt = 0; - sqlite3_mutex_leave(mutex); - } -} - -/* -** Load all automatic extensions. -** -** If anything goes wrong, set an error in the database connection. -*/ -SQLITE_PRIVATE void sqlite3AutoLoadExtensions(sqlite3 *db){ - int i; - int go = 1; - int rc; - int (*xInit)(sqlite3*,char**,const sqlite3_api_routines*); - - wsdAutoextInit; - if( wsdAutoext.nExt==0 ){ - /* Common case: early out without every having to acquire a mutex */ - return; - } - for(i=0; go; i++){ - char *zErrmsg; -#if SQLITE_THREADSAFE - sqlite3_mutex *mutex = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); -#endif - sqlite3_mutex_enter(mutex); - if( i>=wsdAutoext.nExt ){ - xInit = 0; - go = 0; - }else{ - xInit = (int(*)(sqlite3*,char**,const sqlite3_api_routines*)) - wsdAutoext.aExt[i]; - } - sqlite3_mutex_leave(mutex); - zErrmsg = 0; - if( xInit && (rc = xInit(db, &zErrmsg, &sqlite3Apis))!=0 ){ - sqlite3Error(db, rc, - "automatic extension loading failed: %s", zErrmsg); - go = 0; - } - sqlite3_free(zErrmsg); - } -} - -/************** End of loadext.c *********************************************/ -/************** Begin file pragma.c ******************************************/ -/* -** 2003 April 6 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code used to implement the PRAGMA command. -*/ - -#if !defined(SQLITE_ENABLE_LOCKING_STYLE) -# if defined(__APPLE__) -# define SQLITE_ENABLE_LOCKING_STYLE 1 -# else -# define SQLITE_ENABLE_LOCKING_STYLE 0 -# endif -#endif - -/*************************************************************************** -** The next block of code, including the PragTyp_XXXX macro definitions and -** the aPragmaName[] object is composed of generated code. DO NOT EDIT. -** -** To add new pragmas, edit the code in ../tool/mkpragmatab.tcl and rerun -** that script. Then copy/paste the output in place of the following: -*/ -#define PragTyp_HEADER_VALUE 0 -#define PragTyp_AUTO_VACUUM 1 -#define PragTyp_FLAG 2 -#define PragTyp_BUSY_TIMEOUT 3 -#define PragTyp_CACHE_SIZE 4 -#define PragTyp_CASE_SENSITIVE_LIKE 5 -#define PragTyp_COLLATION_LIST 6 -#define PragTyp_COMPILE_OPTIONS 7 -#define PragTyp_DATA_STORE_DIRECTORY 8 -#define PragTyp_DATABASE_LIST 9 -#define PragTyp_DEFAULT_CACHE_SIZE 10 -#define PragTyp_ENCODING 11 -#define PragTyp_FOREIGN_KEY_CHECK 12 -#define PragTyp_FOREIGN_KEY_LIST 13 -#define PragTyp_INCREMENTAL_VACUUM 14 -#define PragTyp_INDEX_INFO 15 -#define PragTyp_INDEX_LIST 16 -#define PragTyp_INTEGRITY_CHECK 17 -#define PragTyp_JOURNAL_MODE 18 -#define PragTyp_JOURNAL_SIZE_LIMIT 19 -#define PragTyp_LOCK_PROXY_FILE 20 -#define PragTyp_LOCKING_MODE 21 -#define PragTyp_PAGE_COUNT 22 -#define PragTyp_MMAP_SIZE 23 -#define PragTyp_PAGE_SIZE 24 -#define PragTyp_SECURE_DELETE 25 -#define PragTyp_SHRINK_MEMORY 26 -#define PragTyp_SOFT_HEAP_LIMIT 27 -#define PragTyp_STATS 28 -#define PragTyp_SYNCHRONOUS 29 -#define PragTyp_TABLE_INFO 30 -#define PragTyp_TEMP_STORE 31 -#define PragTyp_TEMP_STORE_DIRECTORY 32 -#define PragTyp_WAL_AUTOCHECKPOINT 33 -#define PragTyp_WAL_CHECKPOINT 34 -#define PragTyp_ACTIVATE_EXTENSIONS 35 -#define PragTyp_HEXKEY 36 -#define PragTyp_KEY 37 -#define PragTyp_REKEY 38 -#define PragTyp_LOCK_STATUS 39 -#define PragTyp_PARSER_TRACE 40 -#define PragFlag_NeedSchema 0x01 -static const struct sPragmaNames { - const char *const zName; /* Name of pragma */ - u8 ePragTyp; /* PragTyp_XXX value */ - u8 mPragFlag; /* Zero or more PragFlag_XXX values */ - u32 iArg; /* Extra argument */ -} aPragmaNames[] = { -#if defined(SQLITE_HAS_CODEC) || defined(SQLITE_ENABLE_CEROD) - { /* zName: */ "activate_extensions", - /* ePragTyp: */ PragTyp_ACTIVATE_EXTENSIONS, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - { /* zName: */ "application_id", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_AUTOVACUUM) - { /* zName: */ "auto_vacuum", - /* ePragTyp: */ PragTyp_AUTO_VACUUM, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_AUTOMATIC_INDEX) - { /* zName: */ "automatic_index", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_AutoIndex }, -#endif -#endif - { /* zName: */ "busy_timeout", - /* ePragTyp: */ PragTyp_BUSY_TIMEOUT, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - { /* zName: */ "cache_size", - /* ePragTyp: */ PragTyp_CACHE_SIZE, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "cache_spill", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_CacheSpill }, -#endif - { /* zName: */ "case_sensitive_like", - /* ePragTyp: */ PragTyp_CASE_SENSITIVE_LIKE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "checkpoint_fullfsync", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_CkptFullFSync }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - { /* zName: */ "collation_list", - /* ePragTyp: */ PragTyp_COLLATION_LIST, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_COMPILEOPTION_DIAGS) - { /* zName: */ "compile_options", - /* ePragTyp: */ PragTyp_COMPILE_OPTIONS, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "count_changes", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_CountRows }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_OS_WIN - { /* zName: */ "data_store_directory", - /* ePragTyp: */ PragTyp_DATA_STORE_DIRECTORY, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - { /* zName: */ "database_list", - /* ePragTyp: */ PragTyp_DATABASE_LIST, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED) - { /* zName: */ "default_cache_size", - /* ePragTyp: */ PragTyp_DEFAULT_CACHE_SIZE, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - { /* zName: */ "defer_foreign_keys", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_DeferFKs }, -#endif -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "empty_result_callbacks", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_NullCallback }, -#endif -#if !defined(SQLITE_OMIT_UTF16) - { /* zName: */ "encoding", - /* ePragTyp: */ PragTyp_ENCODING, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - { /* zName: */ "foreign_key_check", - /* ePragTyp: */ PragTyp_FOREIGN_KEY_CHECK, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FOREIGN_KEY) - { /* zName: */ "foreign_key_list", - /* ePragTyp: */ PragTyp_FOREIGN_KEY_LIST, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_FOREIGN_KEY) && !defined(SQLITE_OMIT_TRIGGER) - { /* zName: */ "foreign_keys", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_ForeignKeys }, -#endif -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - { /* zName: */ "freelist_count", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "full_column_names", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_FullColNames }, - { /* zName: */ "fullfsync", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_FullFSync }, -#endif -#if defined(SQLITE_HAS_CODEC) - { /* zName: */ "hexkey", - /* ePragTyp: */ PragTyp_HEXKEY, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, - { /* zName: */ "hexrekey", - /* ePragTyp: */ PragTyp_HEXKEY, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if !defined(SQLITE_OMIT_CHECK) - { /* zName: */ "ignore_check_constraints", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_IgnoreChecks }, -#endif -#endif -#if !defined(SQLITE_OMIT_AUTOVACUUM) - { /* zName: */ "incremental_vacuum", - /* ePragTyp: */ PragTyp_INCREMENTAL_VACUUM, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - { /* zName: */ "index_info", - /* ePragTyp: */ PragTyp_INDEX_INFO, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, - { /* zName: */ "index_list", - /* ePragTyp: */ PragTyp_INDEX_LIST, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_INTEGRITY_CHECK) - { /* zName: */ "integrity_check", - /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - { /* zName: */ "journal_mode", - /* ePragTyp: */ PragTyp_JOURNAL_MODE, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, - { /* zName: */ "journal_size_limit", - /* ePragTyp: */ PragTyp_JOURNAL_SIZE_LIMIT, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if defined(SQLITE_HAS_CODEC) - { /* zName: */ "key", - /* ePragTyp: */ PragTyp_KEY, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "legacy_file_format", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_LegacyFileFmt }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && SQLITE_ENABLE_LOCKING_STYLE - { /* zName: */ "lock_proxy_file", - /* ePragTyp: */ PragTyp_LOCK_PROXY_FILE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) - { /* zName: */ "lock_status", - /* ePragTyp: */ PragTyp_LOCK_STATUS, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - { /* zName: */ "locking_mode", - /* ePragTyp: */ PragTyp_LOCKING_MODE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, - { /* zName: */ "max_page_count", - /* ePragTyp: */ PragTyp_PAGE_COUNT, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, - { /* zName: */ "mmap_size", - /* ePragTyp: */ PragTyp_MMAP_SIZE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, - { /* zName: */ "page_count", - /* ePragTyp: */ PragTyp_PAGE_COUNT, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, - { /* zName: */ "page_size", - /* ePragTyp: */ PragTyp_PAGE_SIZE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if defined(SQLITE_DEBUG) - { /* zName: */ "parser_trace", - /* ePragTyp: */ PragTyp_PARSER_TRACE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "query_only", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_QueryOnly }, -#endif -#if !defined(SQLITE_OMIT_INTEGRITY_CHECK) - { /* zName: */ "quick_check", - /* ePragTyp: */ PragTyp_INTEGRITY_CHECK, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "read_uncommitted", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_ReadUncommitted }, - { /* zName: */ "recursive_triggers", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_RecTriggers }, -#endif -#if defined(SQLITE_HAS_CODEC) - { /* zName: */ "rekey", - /* ePragTyp: */ PragTyp_REKEY, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "reverse_unordered_selects", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_ReverseOrder }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - { /* zName: */ "schema_version", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - { /* zName: */ "secure_delete", - /* ePragTyp: */ PragTyp_SECURE_DELETE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "short_column_names", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_ShortColNames }, -#endif - { /* zName: */ "shrink_memory", - /* ePragTyp: */ PragTyp_SHRINK_MEMORY, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, - { /* zName: */ "soft_heap_limit", - /* ePragTyp: */ PragTyp_SOFT_HEAP_LIMIT, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if defined(SQLITE_DEBUG) - { /* zName: */ "sql_trace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_SqlTrace }, -#endif -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - { /* zName: */ "stats", - /* ePragTyp: */ PragTyp_STATS, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - { /* zName: */ "synchronous", - /* ePragTyp: */ PragTyp_SYNCHRONOUS, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_PRAGMAS) - { /* zName: */ "table_info", - /* ePragTyp: */ PragTyp_TABLE_INFO, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - { /* zName: */ "temp_store", - /* ePragTyp: */ PragTyp_TEMP_STORE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, - { /* zName: */ "temp_store_directory", - /* ePragTyp: */ PragTyp_TEMP_STORE_DIRECTORY, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS) - { /* zName: */ "user_version", - /* ePragTyp: */ PragTyp_HEADER_VALUE, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) -#if defined(SQLITE_DEBUG) - { /* zName: */ "vdbe_addoptrace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_VdbeAddopTrace }, - { /* zName: */ "vdbe_debug", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_SqlTrace|SQLITE_VdbeListing|SQLITE_VdbeTrace }, - { /* zName: */ "vdbe_eqp", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_VdbeEQP }, - { /* zName: */ "vdbe_listing", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_VdbeListing }, - { /* zName: */ "vdbe_trace", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_VdbeTrace }, -#endif -#endif -#if !defined(SQLITE_OMIT_WAL) - { /* zName: */ "wal_autocheckpoint", - /* ePragTyp: */ PragTyp_WAL_AUTOCHECKPOINT, - /* ePragFlag: */ 0, - /* iArg: */ 0 }, - { /* zName: */ "wal_checkpoint", - /* ePragTyp: */ PragTyp_WAL_CHECKPOINT, - /* ePragFlag: */ PragFlag_NeedSchema, - /* iArg: */ 0 }, -#endif -#if !defined(SQLITE_OMIT_FLAG_PRAGMAS) - { /* zName: */ "writable_schema", - /* ePragTyp: */ PragTyp_FLAG, - /* ePragFlag: */ 0, - /* iArg: */ SQLITE_WriteSchema|SQLITE_RecoveryMode }, -#endif -}; -/* Number of pragmas: 56 on by default, 69 total. */ -/* End of the automatically generated pragma table. -***************************************************************************/ - -/* -** Interpret the given string as a safety level. Return 0 for OFF, -** 1 for ON or NORMAL and 2 for FULL. Return 1 for an empty or -** unrecognized string argument. The FULL option is disallowed -** if the omitFull parameter it 1. -** -** Note that the values returned are one less that the values that -** should be passed into sqlite3BtreeSetSafetyLevel(). The is done -** to support legacy SQL code. The safety level used to be boolean -** and older scripts may have used numbers 0 for OFF and 1 for ON. -*/ -static u8 getSafetyLevel(const char *z, int omitFull, int dflt){ - /* 123456789 123456789 */ - static const char zText[] = "onoffalseyestruefull"; - static const u8 iOffset[] = {0, 1, 2, 4, 9, 12, 16}; - static const u8 iLength[] = {2, 2, 3, 5, 3, 4, 4}; - static const u8 iValue[] = {1, 0, 0, 0, 1, 1, 2}; - int i, n; - if( sqlite3Isdigit(*z) ){ - return (u8)sqlite3Atoi(z); - } - n = sqlite3Strlen30(z); - for(i=0; i=0&&i<=2)?i:0); -} -#endif /* ifndef SQLITE_OMIT_AUTOVACUUM */ - -#ifndef SQLITE_OMIT_PAGER_PRAGMAS -/* -** Interpret the given string as a temp db location. Return 1 for file -** backed temporary databases, 2 for the Red-Black tree in memory database -** and 0 to use the compile-time default. -*/ -static int getTempStore(const char *z){ - if( z[0]>='0' && z[0]<='2' ){ - return z[0] - '0'; - }else if( sqlite3StrICmp(z, "file")==0 ){ - return 1; - }else if( sqlite3StrICmp(z, "memory")==0 ){ - return 2; - }else{ - return 0; - } -} -#endif /* SQLITE_PAGER_PRAGMAS */ - -#ifndef SQLITE_OMIT_PAGER_PRAGMAS -/* -** Invalidate temp storage, either when the temp storage is changed -** from default, or when 'file' and the temp_store_directory has changed -*/ -static int invalidateTempStorage(Parse *pParse){ - sqlite3 *db = pParse->db; - if( db->aDb[1].pBt!=0 ){ - if( !db->autoCommit || sqlite3BtreeIsInReadTrans(db->aDb[1].pBt) ){ - sqlite3ErrorMsg(pParse, "temporary storage cannot be changed " - "from within a transaction"); - return SQLITE_ERROR; - } - sqlite3BtreeClose(db->aDb[1].pBt); - db->aDb[1].pBt = 0; - sqlite3ResetAllSchemasOfConnection(db); - } - return SQLITE_OK; -} -#endif /* SQLITE_PAGER_PRAGMAS */ - -#ifndef SQLITE_OMIT_PAGER_PRAGMAS -/* -** If the TEMP database is open, close it and mark the database schema -** as needing reloading. This must be done when using the SQLITE_TEMP_STORE -** or DEFAULT_TEMP_STORE pragmas. -*/ -static int changeTempStorage(Parse *pParse, const char *zStorageType){ - int ts = getTempStore(zStorageType); - sqlite3 *db = pParse->db; - if( db->temp_store==ts ) return SQLITE_OK; - if( invalidateTempStorage( pParse ) != SQLITE_OK ){ - return SQLITE_ERROR; - } - db->temp_store = (u8)ts; - return SQLITE_OK; -} -#endif /* SQLITE_PAGER_PRAGMAS */ - -/* -** Generate code to return a single integer value. -*/ -static void returnSingleInt(Parse *pParse, const char *zLabel, i64 value){ - Vdbe *v = sqlite3GetVdbe(pParse); - int mem = ++pParse->nMem; - i64 *pI64 = sqlite3DbMallocRaw(pParse->db, sizeof(value)); - if( pI64 ){ - memcpy(pI64, &value, sizeof(value)); - } - sqlite3VdbeAddOp4(v, OP_Int64, 0, mem, 0, (char*)pI64, P4_INT64); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLabel, SQLITE_STATIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1); -} - - -/* -** Set the safety_level and pager flags for pager iDb. Or if iDb<0 -** set these values for all pagers. -*/ -#ifndef SQLITE_OMIT_PAGER_PRAGMAS -static void setAllPagerFlags(sqlite3 *db){ - if( db->autoCommit ){ - Db *pDb = db->aDb; - int n = db->nDb; - assert( SQLITE_FullFSync==PAGER_FULLFSYNC ); - assert( SQLITE_CkptFullFSync==PAGER_CKPT_FULLFSYNC ); - assert( SQLITE_CacheSpill==PAGER_CACHESPILL ); - assert( (PAGER_FULLFSYNC | PAGER_CKPT_FULLFSYNC | PAGER_CACHESPILL) - == PAGER_FLAGS_MASK ); - assert( (pDb->safety_level & PAGER_SYNCHRONOUS_MASK)==pDb->safety_level ); - while( (n--) > 0 ){ - if( pDb->pBt ){ - sqlite3BtreeSetPagerFlags(pDb->pBt, - pDb->safety_level | (db->flags & PAGER_FLAGS_MASK) ); - } - pDb++; - } - } -} -#else -# define setAllPagerFlags(X) /* no-op */ -#endif - - -/* -** Return a human-readable name for a constraint resolution action. -*/ -#ifndef SQLITE_OMIT_FOREIGN_KEY -static const char *actionName(u8 action){ - const char *zName; - switch( action ){ - case OE_SetNull: zName = "SET NULL"; break; - case OE_SetDflt: zName = "SET DEFAULT"; break; - case OE_Cascade: zName = "CASCADE"; break; - case OE_Restrict: zName = "RESTRICT"; break; - default: zName = "NO ACTION"; - assert( action==OE_None ); break; - } - return zName; -} -#endif - - -/* -** Parameter eMode must be one of the PAGER_JOURNALMODE_XXX constants -** defined in pager.h. This function returns the associated lowercase -** journal-mode name. -*/ -SQLITE_PRIVATE const char *sqlite3JournalModename(int eMode){ - static char * const azModeName[] = { - "delete", "persist", "off", "truncate", "memory" -#ifndef SQLITE_OMIT_WAL - , "wal" -#endif - }; - assert( PAGER_JOURNALMODE_DELETE==0 ); - assert( PAGER_JOURNALMODE_PERSIST==1 ); - assert( PAGER_JOURNALMODE_OFF==2 ); - assert( PAGER_JOURNALMODE_TRUNCATE==3 ); - assert( PAGER_JOURNALMODE_MEMORY==4 ); - assert( PAGER_JOURNALMODE_WAL==5 ); - assert( eMode>=0 && eMode<=ArraySize(azModeName) ); - - if( eMode==ArraySize(azModeName) ) return 0; - return azModeName[eMode]; -} - -/* -** Process a pragma statement. -** -** Pragmas are of this form: -** -** PRAGMA [database.]id [= value] -** -** The identifier might also be a string. The value is a string, and -** identifier, or a number. If minusFlag is true, then the value is -** a number that was preceded by a minus sign. -** -** If the left side is "database.id" then pId1 is the database name -** and pId2 is the id. If the left side is just "id" then pId1 is the -** id and pId2 is any empty string. -*/ -SQLITE_PRIVATE void sqlite3Pragma( - Parse *pParse, - Token *pId1, /* First part of [database.]id field */ - Token *pId2, /* Second part of [database.]id field, or NULL */ - Token *pValue, /* Token for , or NULL */ - int minusFlag /* True if a '-' sign preceded */ -){ - char *zLeft = 0; /* Nul-terminated UTF-8 string */ - char *zRight = 0; /* Nul-terminated UTF-8 string , or NULL */ - const char *zDb = 0; /* The database name */ - Token *pId; /* Pointer to token */ - char *aFcntl[4]; /* Argument to SQLITE_FCNTL_PRAGMA */ - int iDb; /* Database index for */ - int lwr, upr, mid; /* Binary search bounds */ - int rc; /* return value form SQLITE_FCNTL_PRAGMA */ - sqlite3 *db = pParse->db; /* The database connection */ - Db *pDb; /* The specific database being pragmaed */ - Vdbe *v = sqlite3GetVdbe(pParse); /* Prepared statement */ - - if( v==0 ) return; - sqlite3VdbeRunOnlyOnce(v); - pParse->nMem = 2; - - /* Interpret the [database.] part of the pragma statement. iDb is the - ** index of the database this pragma is being applied to in db.aDb[]. */ - iDb = sqlite3TwoPartName(pParse, pId1, pId2, &pId); - if( iDb<0 ) return; - pDb = &db->aDb[iDb]; - - /* If the temp database has been explicitly named as part of the - ** pragma, make sure it is open. - */ - if( iDb==1 && sqlite3OpenTempDatabase(pParse) ){ - return; - } - - zLeft = sqlite3NameFromToken(db, pId); - if( !zLeft ) return; - if( minusFlag ){ - zRight = sqlite3MPrintf(db, "-%T", pValue); - }else{ - zRight = sqlite3NameFromToken(db, pValue); - } - - assert( pId2 ); - zDb = pId2->n>0 ? pDb->zName : 0; - if( sqlite3AuthCheck(pParse, SQLITE_PRAGMA, zLeft, zRight, zDb) ){ - goto pragma_out; - } - - /* Send an SQLITE_FCNTL_PRAGMA file-control to the underlying VFS - ** connection. If it returns SQLITE_OK, then assume that the VFS - ** handled the pragma and generate a no-op prepared statement. - */ - aFcntl[0] = 0; - aFcntl[1] = zLeft; - aFcntl[2] = zRight; - aFcntl[3] = 0; - db->busyHandler.nBusy = 0; - rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_PRAGMA, (void*)aFcntl); - if( rc==SQLITE_OK ){ - if( aFcntl[0] ){ - int mem = ++pParse->nMem; - sqlite3VdbeAddOp4(v, OP_String8, 0, mem, 0, aFcntl[0], 0); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "result", SQLITE_STATIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, mem, 1); - sqlite3_free(aFcntl[0]); - } - goto pragma_out; - } - if( rc!=SQLITE_NOTFOUND ){ - if( aFcntl[0] ){ - sqlite3ErrorMsg(pParse, "%s", aFcntl[0]); - sqlite3_free(aFcntl[0]); - } - pParse->nErr++; - pParse->rc = rc; - goto pragma_out; - } - - /* Locate the pragma in the lookup table */ - lwr = 0; - upr = ArraySize(aPragmaNames)-1; - while( lwr<=upr ){ - mid = (lwr+upr)/2; - rc = sqlite3_stricmp(zLeft, aPragmaNames[mid].zName); - if( rc==0 ) break; - if( rc<0 ){ - upr = mid - 1; - }else{ - lwr = mid + 1; - } - } - if( lwr>upr ) goto pragma_out; - - /* Make sure the database schema is loaded if the pragma requires that */ - if( (aPragmaNames[mid].mPragFlag & PragFlag_NeedSchema)!=0 ){ - if( sqlite3ReadSchema(pParse) ) goto pragma_out; - } - - /* Jump to the appropriate pragma handler */ - switch( aPragmaNames[mid].ePragTyp ){ - -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) && !defined(SQLITE_OMIT_DEPRECATED) - /* - ** PRAGMA [database.]default_cache_size - ** PRAGMA [database.]default_cache_size=N - ** - ** The first form reports the current persistent setting for the - ** page cache size. The value returned is the maximum number of - ** pages in the page cache. The second form sets both the current - ** page cache size value and the persistent page cache size value - ** stored in the database file. - ** - ** Older versions of SQLite would set the default cache size to a - ** negative number to indicate synchronous=OFF. These days, synchronous - ** is always on by default regardless of the sign of the default cache - ** size. But continue to take the absolute value of the default cache - ** size of historical compatibility. - */ - case PragTyp_DEFAULT_CACHE_SIZE: { - static const VdbeOpList getCacheSize[] = { - { OP_Transaction, 0, 0, 0}, /* 0 */ - { OP_ReadCookie, 0, 1, BTREE_DEFAULT_CACHE_SIZE}, /* 1 */ - { OP_IfPos, 1, 8, 0}, - { OP_Integer, 0, 2, 0}, - { OP_Subtract, 1, 2, 1}, - { OP_IfPos, 1, 8, 0}, - { OP_Integer, 0, 1, 0}, /* 6 */ - { OP_Noop, 0, 0, 0}, - { OP_ResultRow, 1, 1, 0}, - }; - int addr; - sqlite3VdbeUsesBtree(v, iDb); - if( !zRight ){ - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "cache_size", SQLITE_STATIC); - pParse->nMem += 2; - addr = sqlite3VdbeAddOpList(v, ArraySize(getCacheSize), getCacheSize); - sqlite3VdbeChangeP1(v, addr, iDb); - sqlite3VdbeChangeP1(v, addr+1, iDb); - sqlite3VdbeChangeP1(v, addr+6, SQLITE_DEFAULT_CACHE_SIZE); - }else{ - int size = sqlite3AbsInt32(sqlite3Atoi(zRight)); - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3VdbeAddOp2(v, OP_Integer, size, 1); - sqlite3VdbeAddOp3(v, OP_SetCookie, iDb, BTREE_DEFAULT_CACHE_SIZE, 1); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - pDb->pSchema->cache_size = size; - sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); - } - break; - } -#endif /* !SQLITE_OMIT_PAGER_PRAGMAS && !SQLITE_OMIT_DEPRECATED */ - -#if !defined(SQLITE_OMIT_PAGER_PRAGMAS) - /* - ** PRAGMA [database.]page_size - ** PRAGMA [database.]page_size=N - ** - ** The first form reports the current setting for the - ** database page size in bytes. The second form sets the - ** database page size value. The value can only be set if - ** the database has not yet been created. - */ - case PragTyp_PAGE_SIZE: { - Btree *pBt = pDb->pBt; - assert( pBt!=0 ); - if( !zRight ){ - int size = ALWAYS(pBt) ? sqlite3BtreeGetPageSize(pBt) : 0; - returnSingleInt(pParse, "page_size", size); - }else{ - /* Malloc may fail when setting the page-size, as there is an internal - ** buffer that the pager module resizes using sqlite3_realloc(). - */ - db->nextPagesize = sqlite3Atoi(zRight); - if( SQLITE_NOMEM==sqlite3BtreeSetPageSize(pBt, db->nextPagesize,-1,0) ){ - db->mallocFailed = 1; - } - } - break; - } - - /* - ** PRAGMA [database.]secure_delete - ** PRAGMA [database.]secure_delete=ON/OFF - ** - ** The first form reports the current setting for the - ** secure_delete flag. The second form changes the secure_delete - ** flag setting and reports thenew value. - */ - case PragTyp_SECURE_DELETE: { - Btree *pBt = pDb->pBt; - int b = -1; - assert( pBt!=0 ); - if( zRight ){ - b = sqlite3GetBoolean(zRight, 0); - } - if( pId2->n==0 && b>=0 ){ - int ii; - for(ii=0; iinDb; ii++){ - sqlite3BtreeSecureDelete(db->aDb[ii].pBt, b); - } - } - b = sqlite3BtreeSecureDelete(pBt, b); - returnSingleInt(pParse, "secure_delete", b); - break; - } - - /* - ** PRAGMA [database.]max_page_count - ** PRAGMA [database.]max_page_count=N - ** - ** The first form reports the current setting for the - ** maximum number of pages in the database file. The - ** second form attempts to change this setting. Both - ** forms return the current setting. - ** - ** The absolute value of N is used. This is undocumented and might - ** change. The only purpose is to provide an easy way to test - ** the sqlite3AbsInt32() function. - ** - ** PRAGMA [database.]page_count - ** - ** Return the number of pages in the specified database. - */ - case PragTyp_PAGE_COUNT: { - int iReg; - sqlite3CodeVerifySchema(pParse, iDb); - iReg = ++pParse->nMem; - if( sqlite3Tolower(zLeft[0])=='p' ){ - sqlite3VdbeAddOp2(v, OP_Pagecount, iDb, iReg); - }else{ - sqlite3VdbeAddOp3(v, OP_MaxPgcnt, iDb, iReg, - sqlite3AbsInt32(sqlite3Atoi(zRight))); - } - sqlite3VdbeAddOp2(v, OP_ResultRow, iReg, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT); - break; - } - - /* - ** PRAGMA [database.]locking_mode - ** PRAGMA [database.]locking_mode = (normal|exclusive) - */ - case PragTyp_LOCKING_MODE: { - const char *zRet = "normal"; - int eMode = getLockingMode(zRight); - - if( pId2->n==0 && eMode==PAGER_LOCKINGMODE_QUERY ){ - /* Simple "PRAGMA locking_mode;" statement. This is a query for - ** the current default locking mode (which may be different to - ** the locking-mode of the main database). - */ - eMode = db->dfltLockMode; - }else{ - Pager *pPager; - if( pId2->n==0 ){ - /* This indicates that no database name was specified as part - ** of the PRAGMA command. In this case the locking-mode must be - ** set on all attached databases, as well as the main db file. - ** - ** Also, the sqlite3.dfltLockMode variable is set so that - ** any subsequently attached databases also use the specified - ** locking mode. - */ - int ii; - assert(pDb==&db->aDb[0]); - for(ii=2; iinDb; ii++){ - pPager = sqlite3BtreePager(db->aDb[ii].pBt); - sqlite3PagerLockingMode(pPager, eMode); - } - db->dfltLockMode = (u8)eMode; - } - pPager = sqlite3BtreePager(pDb->pBt); - eMode = sqlite3PagerLockingMode(pPager, eMode); - } - - assert( eMode==PAGER_LOCKINGMODE_NORMAL - || eMode==PAGER_LOCKINGMODE_EXCLUSIVE ); - if( eMode==PAGER_LOCKINGMODE_EXCLUSIVE ){ - zRet = "exclusive"; - } - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "locking_mode", SQLITE_STATIC); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, zRet, 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); - break; - } - - /* - ** PRAGMA [database.]journal_mode - ** PRAGMA [database.]journal_mode = - ** (delete|persist|off|truncate|memory|wal|off) - */ - case PragTyp_JOURNAL_MODE: { - int eMode; /* One of the PAGER_JOURNALMODE_XXX symbols */ - int ii; /* Loop counter */ - - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "journal_mode", SQLITE_STATIC); - - if( zRight==0 ){ - /* If there is no "=MODE" part of the pragma, do a query for the - ** current mode */ - eMode = PAGER_JOURNALMODE_QUERY; - }else{ - const char *zMode; - int n = sqlite3Strlen30(zRight); - for(eMode=0; (zMode = sqlite3JournalModename(eMode))!=0; eMode++){ - if( sqlite3StrNICmp(zRight, zMode, n)==0 ) break; - } - if( !zMode ){ - /* If the "=MODE" part does not match any known journal mode, - ** then do a query */ - eMode = PAGER_JOURNALMODE_QUERY; - } - } - if( eMode==PAGER_JOURNALMODE_QUERY && pId2->n==0 ){ - /* Convert "PRAGMA journal_mode" into "PRAGMA main.journal_mode" */ - iDb = 0; - pId2->n = 1; - } - for(ii=db->nDb-1; ii>=0; ii--){ - if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){ - sqlite3VdbeUsesBtree(v, ii); - sqlite3VdbeAddOp3(v, OP_JournalMode, ii, 1, eMode); - } - } - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); - break; - } - - /* - ** PRAGMA [database.]journal_size_limit - ** PRAGMA [database.]journal_size_limit=N - ** - ** Get or set the size limit on rollback journal files. - */ - case PragTyp_JOURNAL_SIZE_LIMIT: { - Pager *pPager = sqlite3BtreePager(pDb->pBt); - i64 iLimit = -2; - if( zRight ){ - sqlite3Atoi64(zRight, &iLimit, sqlite3Strlen30(zRight), SQLITE_UTF8); - if( iLimit<-1 ) iLimit = -1; - } - iLimit = sqlite3PagerJournalSizeLimit(pPager, iLimit); - returnSingleInt(pParse, "journal_size_limit", iLimit); - break; - } - -#endif /* SQLITE_OMIT_PAGER_PRAGMAS */ - - /* - ** PRAGMA [database.]auto_vacuum - ** PRAGMA [database.]auto_vacuum=N - ** - ** Get or set the value of the database 'auto-vacuum' parameter. - ** The value is one of: 0 NONE 1 FULL 2 INCREMENTAL - */ -#ifndef SQLITE_OMIT_AUTOVACUUM - case PragTyp_AUTO_VACUUM: { - Btree *pBt = pDb->pBt; - assert( pBt!=0 ); - if( !zRight ){ - returnSingleInt(pParse, "auto_vacuum", sqlite3BtreeGetAutoVacuum(pBt)); - }else{ - int eAuto = getAutoVacuum(zRight); - assert( eAuto>=0 && eAuto<=2 ); - db->nextAutovac = (u8)eAuto; - /* Call SetAutoVacuum() to set initialize the internal auto and - ** incr-vacuum flags. This is required in case this connection - ** creates the database file. It is important that it is created - ** as an auto-vacuum capable db. - */ - rc = sqlite3BtreeSetAutoVacuum(pBt, eAuto); - if( rc==SQLITE_OK && (eAuto==1 || eAuto==2) ){ - /* When setting the auto_vacuum mode to either "full" or - ** "incremental", write the value of meta[6] in the database - ** file. Before writing to meta[6], check that meta[3] indicates - ** that this really is an auto-vacuum capable database. - */ - static const VdbeOpList setMeta6[] = { - { OP_Transaction, 0, 1, 0}, /* 0 */ - { OP_ReadCookie, 0, 1, BTREE_LARGEST_ROOT_PAGE}, - { OP_If, 1, 0, 0}, /* 2 */ - { OP_Halt, SQLITE_OK, OE_Abort, 0}, /* 3 */ - { OP_Integer, 0, 1, 0}, /* 4 */ - { OP_SetCookie, 0, BTREE_INCR_VACUUM, 1}, /* 5 */ - }; - int iAddr; - iAddr = sqlite3VdbeAddOpList(v, ArraySize(setMeta6), setMeta6); - sqlite3VdbeChangeP1(v, iAddr, iDb); - sqlite3VdbeChangeP1(v, iAddr+1, iDb); - sqlite3VdbeChangeP2(v, iAddr+2, iAddr+4); - sqlite3VdbeChangeP1(v, iAddr+4, eAuto-1); - sqlite3VdbeChangeP1(v, iAddr+5, iDb); - sqlite3VdbeUsesBtree(v, iDb); - } - } - break; - } -#endif - - /* - ** PRAGMA [database.]incremental_vacuum(N) - ** - ** Do N steps of incremental vacuuming on a database. - */ -#ifndef SQLITE_OMIT_AUTOVACUUM - case PragTyp_INCREMENTAL_VACUUM: { - int iLimit, addr; - if( zRight==0 || !sqlite3GetInt32(zRight, &iLimit) || iLimit<=0 ){ - iLimit = 0x7fffffff; - } - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3VdbeAddOp2(v, OP_Integer, iLimit, 1); - addr = sqlite3VdbeAddOp1(v, OP_IncrVacuum, iDb); - sqlite3VdbeAddOp1(v, OP_ResultRow, 1); - sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); - sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr); - sqlite3VdbeJumpHere(v, addr); - break; - } -#endif - -#ifndef SQLITE_OMIT_PAGER_PRAGMAS - /* - ** PRAGMA [database.]cache_size - ** PRAGMA [database.]cache_size=N - ** - ** The first form reports the current local setting for the - ** page cache size. The second form sets the local - ** page cache size value. If N is positive then that is the - ** number of pages in the cache. If N is negative, then the - ** number of pages is adjusted so that the cache uses -N kibibytes - ** of memory. - */ - case PragTyp_CACHE_SIZE: { - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - if( !zRight ){ - returnSingleInt(pParse, "cache_size", pDb->pSchema->cache_size); - }else{ - int size = sqlite3Atoi(zRight); - pDb->pSchema->cache_size = size; - sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); - } - break; - } - - /* - ** PRAGMA [database.]mmap_size(N) - ** - ** Used to set mapping size limit. The mapping size limit is - ** used to limit the aggregate size of all memory mapped regions of the - ** database file. If this parameter is set to zero, then memory mapping - ** is not used at all. If N is negative, then the default memory map - ** limit determined by sqlite3_config(SQLITE_CONFIG_MMAP_SIZE) is set. - ** The parameter N is measured in bytes. - ** - ** This value is advisory. The underlying VFS is free to memory map - ** as little or as much as it wants. Except, if N is set to 0 then the - ** upper layers will never invoke the xFetch interfaces to the VFS. - */ - case PragTyp_MMAP_SIZE: { - sqlite3_int64 sz; -#if SQLITE_MAX_MMAP_SIZE>0 - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - if( zRight ){ - int ii; - sqlite3Atoi64(zRight, &sz, sqlite3Strlen30(zRight), SQLITE_UTF8); - if( sz<0 ) sz = sqlite3GlobalConfig.szMmap; - if( pId2->n==0 ) db->szMmap = sz; - for(ii=db->nDb-1; ii>=0; ii--){ - if( db->aDb[ii].pBt && (ii==iDb || pId2->n==0) ){ - sqlite3BtreeSetMmapLimit(db->aDb[ii].pBt, sz); - } - } - } - sz = -1; - rc = sqlite3_file_control(db, zDb, SQLITE_FCNTL_MMAP_SIZE, &sz); -#else - sz = 0; - rc = SQLITE_OK; -#endif - if( rc==SQLITE_OK ){ - returnSingleInt(pParse, "mmap_size", sz); - }else if( rc!=SQLITE_NOTFOUND ){ - pParse->nErr++; - pParse->rc = rc; - } - break; - } - - /* - ** PRAGMA temp_store - ** PRAGMA temp_store = "default"|"memory"|"file" - ** - ** Return or set the local value of the temp_store flag. Changing - ** the local value does not make changes to the disk file and the default - ** value will be restored the next time the database is opened. - ** - ** Note that it is possible for the library compile-time options to - ** override this setting - */ - case PragTyp_TEMP_STORE: { - if( !zRight ){ - returnSingleInt(pParse, "temp_store", db->temp_store); - }else{ - changeTempStorage(pParse, zRight); - } - break; - } - - /* - ** PRAGMA temp_store_directory - ** PRAGMA temp_store_directory = ""|"directory_name" - ** - ** Return or set the local value of the temp_store_directory flag. Changing - ** the value sets a specific directory to be used for temporary files. - ** Setting to a null string reverts to the default temporary directory search. - ** If temporary directory is changed, then invalidateTempStorage. - ** - */ - case PragTyp_TEMP_STORE_DIRECTORY: { - if( !zRight ){ - if( sqlite3_temp_directory ){ - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, - "temp_store_directory", SQLITE_STATIC); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, sqlite3_temp_directory, 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); - } - }else{ -#ifndef SQLITE_OMIT_WSD - if( zRight[0] ){ - int res; - rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); - if( rc!=SQLITE_OK || res==0 ){ - sqlite3ErrorMsg(pParse, "not a writable directory"); - goto pragma_out; - } - } - if( SQLITE_TEMP_STORE==0 - || (SQLITE_TEMP_STORE==1 && db->temp_store<=1) - || (SQLITE_TEMP_STORE==2 && db->temp_store==1) - ){ - invalidateTempStorage(pParse); - } - sqlite3_free(sqlite3_temp_directory); - if( zRight[0] ){ - sqlite3_temp_directory = sqlite3_mprintf("%s", zRight); - }else{ - sqlite3_temp_directory = 0; - } -#endif /* SQLITE_OMIT_WSD */ - } - break; - } - -#if SQLITE_OS_WIN - /* - ** PRAGMA data_store_directory - ** PRAGMA data_store_directory = ""|"directory_name" - ** - ** Return or set the local value of the data_store_directory flag. Changing - ** the value sets a specific directory to be used for database files that - ** were specified with a relative pathname. Setting to a null string reverts - ** to the default database directory, which for database files specified with - ** a relative path will probably be based on the current directory for the - ** process. Database file specified with an absolute path are not impacted - ** by this setting, regardless of its value. - ** - */ - case PragTyp_DATA_STORE_DIRECTORY: { - if( !zRight ){ - if( sqlite3_data_directory ){ - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, - "data_store_directory", SQLITE_STATIC); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, sqlite3_data_directory, 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); - } - }else{ -#ifndef SQLITE_OMIT_WSD - if( zRight[0] ){ - int res; - rc = sqlite3OsAccess(db->pVfs, zRight, SQLITE_ACCESS_READWRITE, &res); - if( rc!=SQLITE_OK || res==0 ){ - sqlite3ErrorMsg(pParse, "not a writable directory"); - goto pragma_out; - } - } - sqlite3_free(sqlite3_data_directory); - if( zRight[0] ){ - sqlite3_data_directory = sqlite3_mprintf("%s", zRight); - }else{ - sqlite3_data_directory = 0; - } -#endif /* SQLITE_OMIT_WSD */ - } - break; - } -#endif - -#if SQLITE_ENABLE_LOCKING_STYLE - /* - ** PRAGMA [database.]lock_proxy_file - ** PRAGMA [database.]lock_proxy_file = ":auto:"|"lock_file_path" - ** - ** Return or set the value of the lock_proxy_file flag. Changing - ** the value sets a specific file to be used for database access locks. - ** - */ - case PragTyp_LOCK_PROXY_FILE: { - if( !zRight ){ - Pager *pPager = sqlite3BtreePager(pDb->pBt); - char *proxy_file_path = NULL; - sqlite3_file *pFile = sqlite3PagerFile(pPager); - sqlite3OsFileControlHint(pFile, SQLITE_GET_LOCKPROXYFILE, - &proxy_file_path); - - if( proxy_file_path ){ - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, - "lock_proxy_file", SQLITE_STATIC); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, proxy_file_path, 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); - } - }else{ - Pager *pPager = sqlite3BtreePager(pDb->pBt); - sqlite3_file *pFile = sqlite3PagerFile(pPager); - int res; - if( zRight[0] ){ - res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, - zRight); - } else { - res=sqlite3OsFileControl(pFile, SQLITE_SET_LOCKPROXYFILE, - NULL); - } - if( res!=SQLITE_OK ){ - sqlite3ErrorMsg(pParse, "failed to set lock proxy file"); - goto pragma_out; - } - } - break; - } -#endif /* SQLITE_ENABLE_LOCKING_STYLE */ - - /* - ** PRAGMA [database.]synchronous - ** PRAGMA [database.]synchronous=OFF|ON|NORMAL|FULL - ** - ** Return or set the local value of the synchronous flag. Changing - ** the local value does not make changes to the disk file and the - ** default value will be restored the next time the database is - ** opened. - */ - case PragTyp_SYNCHRONOUS: { - if( !zRight ){ - returnSingleInt(pParse, "synchronous", pDb->safety_level-1); - }else{ - if( !db->autoCommit ){ - sqlite3ErrorMsg(pParse, - "Safety level may not be changed inside a transaction"); - }else{ - pDb->safety_level = getSafetyLevel(zRight,0,1)+1; - setAllPagerFlags(db); - } - } - break; - } -#endif /* SQLITE_OMIT_PAGER_PRAGMAS */ - -#ifndef SQLITE_OMIT_FLAG_PRAGMAS - case PragTyp_FLAG: { - if( zRight==0 ){ - returnSingleInt(pParse, aPragmaNames[mid].zName, - (db->flags & aPragmaNames[mid].iArg)!=0 ); - }else{ - int mask = aPragmaNames[mid].iArg; /* Mask of bits to set or clear. */ - if( db->autoCommit==0 ){ - /* Foreign key support may not be enabled or disabled while not - ** in auto-commit mode. */ - mask &= ~(SQLITE_ForeignKeys); - } - - if( sqlite3GetBoolean(zRight, 0) ){ - db->flags |= mask; - }else{ - db->flags &= ~mask; - if( mask==SQLITE_DeferFKs ) db->nDeferredImmCons = 0; - } - - /* Many of the flag-pragmas modify the code generated by the SQL - ** compiler (eg. count_changes). So add an opcode to expire all - ** compiled SQL statements after modifying a pragma value. - */ - sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); - setAllPagerFlags(db); - } - break; - } -#endif /* SQLITE_OMIT_FLAG_PRAGMAS */ - -#ifndef SQLITE_OMIT_SCHEMA_PRAGMAS - /* - ** PRAGMA table_info(
    ) - ** - ** Return a single row for each column of the named table. The columns of - ** the returned data set are: - ** - ** cid: Column id (numbered from left to right, starting at 0) - ** name: Column name - ** type: Column declaration type. - ** notnull: True if 'NOT NULL' is part of column declaration - ** dflt_value: The default value for the column, if any. - */ - case PragTyp_TABLE_INFO: if( zRight ){ - Table *pTab; - pTab = sqlite3FindTable(db, zRight, zDb); - if( pTab ){ - int i, k; - int nHidden = 0; - Column *pCol; - Index *pPk = sqlite3PrimaryKeyIndex(pTab); - sqlite3VdbeSetNumCols(v, 6); - pParse->nMem = 6; - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "cid", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "type", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "notnull", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 4, COLNAME_NAME, "dflt_value", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 5, COLNAME_NAME, "pk", SQLITE_STATIC); - sqlite3ViewGetColumnNames(pParse, pTab); - for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ - if( IsHiddenColumn(pCol) ){ - nHidden++; - continue; - } - sqlite3VdbeAddOp2(v, OP_Integer, i-nHidden, 1); - sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pCol->zName, 0); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, - pCol->zType ? pCol->zType : "", 0); - sqlite3VdbeAddOp2(v, OP_Integer, (pCol->notNull ? 1 : 0), 4); - if( pCol->zDflt ){ - sqlite3VdbeAddOp4(v, OP_String8, 0, 5, 0, (char*)pCol->zDflt, 0); - }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, 5); - } - if( (pCol->colFlags & COLFLAG_PRIMKEY)==0 ){ - k = 0; - }else if( pPk==0 ){ - k = 1; - }else{ - for(k=1; ALWAYS(k<=pTab->nCol) && pPk->aiColumn[k-1]!=i; k++){} - } - sqlite3VdbeAddOp2(v, OP_Integer, k, 6); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 6); - } - } - } - break; - - case PragTyp_STATS: { - Index *pIdx; - HashElem *i; - v = sqlite3GetVdbe(pParse); - sqlite3VdbeSetNumCols(v, 4); - pParse->nMem = 4; - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "table", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "index", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "width", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "height", SQLITE_STATIC); - for(i=sqliteHashFirst(&pDb->pSchema->tblHash); i; i=sqliteHashNext(i)){ - Table *pTab = sqliteHashData(i); - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, pTab->zName, 0); - sqlite3VdbeAddOp2(v, OP_Null, 0, 2); - sqlite3VdbeAddOp2(v, OP_Integer, - (int)sqlite3LogEstToInt(pTab->szTabRow), 3); - sqlite3VdbeAddOp2(v, OP_Integer, (int)pTab->nRowEst, 4); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4); - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pIdx->zName, 0); - sqlite3VdbeAddOp2(v, OP_Integer, - (int)sqlite3LogEstToInt(pIdx->szIdxRow), 3); - sqlite3VdbeAddOp2(v, OP_Integer, (int)pIdx->aiRowEst[0], 4); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 4); - } - } - } - break; - - case PragTyp_INDEX_INFO: if( zRight ){ - Index *pIdx; - Table *pTab; - pIdx = sqlite3FindIndex(db, zRight, zDb); - if( pIdx ){ - int i; - pTab = pIdx->pTable; - sqlite3VdbeSetNumCols(v, 3); - pParse->nMem = 3; - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seqno", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "cid", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "name", SQLITE_STATIC); - for(i=0; inKeyCol; i++){ - i16 cnum = pIdx->aiColumn[i]; - sqlite3VdbeAddOp2(v, OP_Integer, i, 1); - sqlite3VdbeAddOp2(v, OP_Integer, cnum, 2); - assert( pTab->nCol>cnum ); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, pTab->aCol[cnum].zName, 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3); - } - } - } - break; - - case PragTyp_INDEX_LIST: if( zRight ){ - Index *pIdx; - Table *pTab; - int i; - pTab = sqlite3FindTable(db, zRight, zDb); - if( pTab ){ - v = sqlite3GetVdbe(pParse); - sqlite3VdbeSetNumCols(v, 3); - pParse->nMem = 3; - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "unique", SQLITE_STATIC); - for(pIdx=pTab->pIndex, i=0; pIdx; pIdx=pIdx->pNext, i++){ - sqlite3VdbeAddOp2(v, OP_Integer, i, 1); - sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pIdx->zName, 0); - sqlite3VdbeAddOp2(v, OP_Integer, pIdx->onError!=OE_None, 3); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3); - } - } - } - break; - - case PragTyp_DATABASE_LIST: { - int i; - sqlite3VdbeSetNumCols(v, 3); - pParse->nMem = 3; - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "file", SQLITE_STATIC); - for(i=0; inDb; i++){ - if( db->aDb[i].pBt==0 ) continue; - assert( db->aDb[i].zName!=0 ); - sqlite3VdbeAddOp2(v, OP_Integer, i, 1); - sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, db->aDb[i].zName, 0); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, - sqlite3BtreeGetFilename(db->aDb[i].pBt), 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3); - } - } - break; - - case PragTyp_COLLATION_LIST: { - int i = 0; - HashElem *p; - sqlite3VdbeSetNumCols(v, 2); - pParse->nMem = 2; - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "seq", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "name", SQLITE_STATIC); - for(p=sqliteHashFirst(&db->aCollSeq); p; p=sqliteHashNext(p)){ - CollSeq *pColl = (CollSeq *)sqliteHashData(p); - sqlite3VdbeAddOp2(v, OP_Integer, i++, 1); - sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, pColl->zName, 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2); - } - } - break; -#endif /* SQLITE_OMIT_SCHEMA_PRAGMAS */ - -#ifndef SQLITE_OMIT_FOREIGN_KEY - case PragTyp_FOREIGN_KEY_LIST: if( zRight ){ - FKey *pFK; - Table *pTab; - pTab = sqlite3FindTable(db, zRight, zDb); - if( pTab ){ - v = sqlite3GetVdbe(pParse); - pFK = pTab->pFKey; - if( pFK ){ - int i = 0; - sqlite3VdbeSetNumCols(v, 8); - pParse->nMem = 8; - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "id", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "seq", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "table", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "from", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 4, COLNAME_NAME, "to", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 5, COLNAME_NAME, "on_update", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 6, COLNAME_NAME, "on_delete", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 7, COLNAME_NAME, "match", SQLITE_STATIC); - while(pFK){ - int j; - for(j=0; jnCol; j++){ - char *zCol = pFK->aCol[j].zCol; - char *zOnDelete = (char *)actionName(pFK->aAction[0]); - char *zOnUpdate = (char *)actionName(pFK->aAction[1]); - sqlite3VdbeAddOp2(v, OP_Integer, i, 1); - sqlite3VdbeAddOp2(v, OP_Integer, j, 2); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, pFK->zTo, 0); - sqlite3VdbeAddOp4(v, OP_String8, 0, 4, 0, - pTab->aCol[pFK->aCol[j].iFrom].zName, 0); - sqlite3VdbeAddOp4(v, zCol ? OP_String8 : OP_Null, 0, 5, 0, zCol, 0); - sqlite3VdbeAddOp4(v, OP_String8, 0, 6, 0, zOnUpdate, 0); - sqlite3VdbeAddOp4(v, OP_String8, 0, 7, 0, zOnDelete, 0); - sqlite3VdbeAddOp4(v, OP_String8, 0, 8, 0, "NONE", 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 8); - } - ++i; - pFK = pFK->pNextFrom; - } - } - } - } - break; -#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */ - -#ifndef SQLITE_OMIT_FOREIGN_KEY -#ifndef SQLITE_OMIT_TRIGGER - case PragTyp_FOREIGN_KEY_CHECK: { - FKey *pFK; /* A foreign key constraint */ - Table *pTab; /* Child table contain "REFERENCES" keyword */ - Table *pParent; /* Parent table that child points to */ - Index *pIdx; /* Index in the parent table */ - int i; /* Loop counter: Foreign key number for pTab */ - int j; /* Loop counter: Field of the foreign key */ - HashElem *k; /* Loop counter: Next table in schema */ - int x; /* result variable */ - int regResult; /* 3 registers to hold a result row */ - int regKey; /* Register to hold key for checking the FK */ - int regRow; /* Registers to hold a row from pTab */ - int addrTop; /* Top of a loop checking foreign keys */ - int addrOk; /* Jump here if the key is OK */ - int *aiCols; /* child to parent column mapping */ - - regResult = pParse->nMem+1; - pParse->nMem += 4; - regKey = ++pParse->nMem; - regRow = ++pParse->nMem; - v = sqlite3GetVdbe(pParse); - sqlite3VdbeSetNumCols(v, 4); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "table", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "rowid", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "parent", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 3, COLNAME_NAME, "fkid", SQLITE_STATIC); - sqlite3CodeVerifySchema(pParse, iDb); - k = sqliteHashFirst(&db->aDb[iDb].pSchema->tblHash); - while( k ){ - if( zRight ){ - pTab = sqlite3LocateTable(pParse, 0, zRight, zDb); - k = 0; - }else{ - pTab = (Table*)sqliteHashData(k); - k = sqliteHashNext(k); - } - if( pTab==0 || pTab->pFKey==0 ) continue; - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); - if( pTab->nCol+regRow>pParse->nMem ) pParse->nMem = pTab->nCol + regRow; - sqlite3OpenTable(pParse, 0, iDb, pTab, OP_OpenRead); - sqlite3VdbeAddOp4(v, OP_String8, 0, regResult, 0, pTab->zName, - P4_TRANSIENT); - for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){ - pParent = sqlite3FindTable(db, pFK->zTo, zDb); - if( pParent==0 ) continue; - pIdx = 0; - sqlite3TableLock(pParse, iDb, pParent->tnum, 0, pParent->zName); - x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, 0); - if( x==0 ){ - if( pIdx==0 ){ - sqlite3OpenTable(pParse, i, iDb, pParent, OP_OpenRead); - }else{ - sqlite3VdbeAddOp3(v, OP_OpenRead, i, pIdx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); - } - }else{ - k = 0; - break; - } - } - assert( pParse->nErr>0 || pFK==0 ); - if( pFK ) break; - if( pParse->nTabnTab = i; - addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, 0); - for(i=1, pFK=pTab->pFKey; pFK; i++, pFK=pFK->pNextFrom){ - pParent = sqlite3FindTable(db, pFK->zTo, zDb); - pIdx = 0; - aiCols = 0; - if( pParent ){ - x = sqlite3FkLocateIndex(pParse, pParent, pFK, &pIdx, &aiCols); - assert( x==0 ); - } - addrOk = sqlite3VdbeMakeLabel(v); - if( pParent && pIdx==0 ){ - int iKey = pFK->aCol[0].iFrom; - assert( iKey>=0 && iKeynCol ); - if( iKey!=pTab->iPKey ){ - sqlite3VdbeAddOp3(v, OP_Column, 0, iKey, regRow); - sqlite3ColumnDefault(v, pTab, iKey, regRow); - sqlite3VdbeAddOp2(v, OP_IsNull, regRow, addrOk); - sqlite3VdbeAddOp2(v, OP_MustBeInt, regRow, - sqlite3VdbeCurrentAddr(v)+3); - }else{ - sqlite3VdbeAddOp2(v, OP_Rowid, 0, regRow); - } - sqlite3VdbeAddOp3(v, OP_NotExists, i, 0, regRow); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrOk); - sqlite3VdbeJumpHere(v, sqlite3VdbeCurrentAddr(v)-2); - }else{ - for(j=0; jnCol; j++){ - sqlite3ExprCodeGetColumnOfTable(v, pTab, 0, - aiCols ? aiCols[j] : pFK->aCol[j].iFrom, regRow+j); - sqlite3VdbeAddOp2(v, OP_IsNull, regRow+j, addrOk); - } - if( pParent ){ - sqlite3VdbeAddOp3(v, OP_MakeRecord, regRow, pFK->nCol, regKey); - sqlite3VdbeChangeP4(v, -1, - sqlite3IndexAffinityStr(v,pIdx), P4_TRANSIENT); - sqlite3VdbeAddOp4Int(v, OP_Found, i, addrOk, regKey, 0); - } - } - sqlite3VdbeAddOp2(v, OP_Rowid, 0, regResult+1); - sqlite3VdbeAddOp4(v, OP_String8, 0, regResult+2, 0, - pFK->zTo, P4_TRANSIENT); - sqlite3VdbeAddOp2(v, OP_Integer, i-1, regResult+3); - sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, 4); - sqlite3VdbeResolveLabel(v, addrOk); - sqlite3DbFree(db, aiCols); - } - sqlite3VdbeAddOp2(v, OP_Next, 0, addrTop+1); - sqlite3VdbeJumpHere(v, addrTop); - } - } - break; -#endif /* !defined(SQLITE_OMIT_TRIGGER) */ -#endif /* !defined(SQLITE_OMIT_FOREIGN_KEY) */ - -#ifndef NDEBUG - case PragTyp_PARSER_TRACE: { - if( zRight ){ - if( sqlite3GetBoolean(zRight, 0) ){ - sqlite3ParserTrace(stderr, "parser: "); - }else{ - sqlite3ParserTrace(0, 0); - } - } - } - break; -#endif - - /* Reinstall the LIKE and GLOB functions. The variant of LIKE - ** used will be case sensitive or not depending on the RHS. - */ - case PragTyp_CASE_SENSITIVE_LIKE: { - if( zRight ){ - sqlite3RegisterLikeFunctions(db, sqlite3GetBoolean(zRight, 0)); - } - } - break; - -#ifndef SQLITE_INTEGRITY_CHECK_ERROR_MAX -# define SQLITE_INTEGRITY_CHECK_ERROR_MAX 100 -#endif - -#ifndef SQLITE_OMIT_INTEGRITY_CHECK - /* Pragma "quick_check" is reduced version of - ** integrity_check designed to detect most database corruption - ** without most of the overhead of a full integrity-check. - */ - case PragTyp_INTEGRITY_CHECK: { - int i, j, addr, mxErr; - - /* Code that appears at the end of the integrity check. If no error - ** messages have been generated, output OK. Otherwise output the - ** error message - */ - static const VdbeOpList endCode[] = { - { OP_AddImm, 1, 0, 0}, /* 0 */ - { OP_IfNeg, 1, 0, 0}, /* 1 */ - { OP_String8, 0, 3, 0}, /* 2 */ - { OP_ResultRow, 3, 1, 0}, - }; - - int isQuick = (sqlite3Tolower(zLeft[0])=='q'); - - /* If the PRAGMA command was of the form "PRAGMA .integrity_check", - ** then iDb is set to the index of the database identified by . - ** In this case, the integrity of database iDb only is verified by - ** the VDBE created below. - ** - ** Otherwise, if the command was simply "PRAGMA integrity_check" (or - ** "PRAGMA quick_check"), then iDb is set to 0. In this case, set iDb - ** to -1 here, to indicate that the VDBE should verify the integrity - ** of all attached databases. */ - assert( iDb>=0 ); - assert( iDb==0 || pId2->z ); - if( pId2->z==0 ) iDb = -1; - - /* Initialize the VDBE program */ - pParse->nMem = 6; - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "integrity_check", SQLITE_STATIC); - - /* Set the maximum error count */ - mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX; - if( zRight ){ - sqlite3GetInt32(zRight, &mxErr); - if( mxErr<=0 ){ - mxErr = SQLITE_INTEGRITY_CHECK_ERROR_MAX; - } - } - sqlite3VdbeAddOp2(v, OP_Integer, mxErr, 1); /* reg[1] holds errors left */ - - /* Do an integrity check on each database file */ - for(i=0; inDb; i++){ - HashElem *x; - Hash *pTbls; - int cnt = 0; - - if( OMIT_TEMPDB && i==1 ) continue; - if( iDb>=0 && i!=iDb ) continue; - - sqlite3CodeVerifySchema(pParse, i); - addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Halt if out of errors */ - sqlite3VdbeAddOp2(v, OP_Halt, 0, 0); - sqlite3VdbeJumpHere(v, addr); - - /* Do an integrity check of the B-Tree - ** - ** Begin by filling registers 2, 3, ... with the root pages numbers - ** for all tables and indices in the database. - */ - assert( sqlite3SchemaMutexHeld(db, i, 0) ); - pTbls = &db->aDb[i].pSchema->tblHash; - for(x=sqliteHashFirst(pTbls); x; x=sqliteHashNext(x)){ - Table *pTab = sqliteHashData(x); - Index *pIdx; - if( HasRowid(pTab) ){ - sqlite3VdbeAddOp2(v, OP_Integer, pTab->tnum, 2+cnt); - VdbeComment((v, "%s", pTab->zName)); - cnt++; - } - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - sqlite3VdbeAddOp2(v, OP_Integer, pIdx->tnum, 2+cnt); - VdbeComment((v, "%s", pIdx->zName)); - cnt++; - } - } - - /* Make sure sufficient number of registers have been allocated */ - pParse->nMem = MAX( pParse->nMem, cnt+8 ); - - /* Do the b-tree integrity checks */ - sqlite3VdbeAddOp3(v, OP_IntegrityCk, 2, cnt, 1); - sqlite3VdbeChangeP5(v, (u8)i); - addr = sqlite3VdbeAddOp1(v, OP_IsNull, 2); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, - sqlite3MPrintf(db, "*** in database %s ***\n", db->aDb[i].zName), - P4_DYNAMIC); - sqlite3VdbeAddOp2(v, OP_Move, 2, 4); - sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 2); - sqlite3VdbeAddOp2(v, OP_ResultRow, 2, 1); - sqlite3VdbeJumpHere(v, addr); - - /* Make sure all the indices are constructed correctly. - */ - for(x=sqliteHashFirst(pTbls); x && !isQuick; x=sqliteHashNext(x)){ - Table *pTab = sqliteHashData(x); - Index *pIdx, *pPk; - Index *pPrior = 0; - int loopTop; - int iDataCur, iIdxCur; - int r1 = -1; - - if( pTab->pIndex==0 ) continue; - pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); - addr = sqlite3VdbeAddOp1(v, OP_IfPos, 1); /* Stop if out of errors */ - sqlite3VdbeAddOp2(v, OP_Halt, 0, 0); - sqlite3VdbeJumpHere(v, addr); - sqlite3ExprCacheClear(pParse); - sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenRead, - 1, 0, &iDataCur, &iIdxCur); - sqlite3VdbeAddOp2(v, OP_Integer, 0, 7); - for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ - sqlite3VdbeAddOp2(v, OP_Integer, 0, 8+j); /* index entries counter */ - } - pParse->nMem = MAX(pParse->nMem, 8+j); - sqlite3VdbeAddOp2(v, OP_Rewind, iDataCur, 0); - loopTop = sqlite3VdbeAddOp2(v, OP_AddImm, 7, 1); - for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ - int jmp2, jmp3, jmp4; - if( pPk==pIdx ) continue; - r1 = sqlite3GenerateIndexKey(pParse, pIdx, iDataCur, 0, 0, &jmp3, - pPrior, r1); - pPrior = pIdx; - sqlite3VdbeAddOp2(v, OP_AddImm, 8+j, 1); /* increment entry count */ - jmp2 = sqlite3VdbeAddOp4Int(v, OP_Found, iIdxCur+j, 0, r1, - pIdx->nColumn); - sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); /* Decrement error limit */ - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, "row ", P4_STATIC); - sqlite3VdbeAddOp3(v, OP_Concat, 7, 3, 3); - sqlite3VdbeAddOp4(v, OP_String8, 0, 4, 0, " missing from index ", - P4_STATIC); - sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3); - sqlite3VdbeAddOp4(v, OP_String8, 0, 4, 0, pIdx->zName, P4_TRANSIENT); - sqlite3VdbeAddOp3(v, OP_Concat, 4, 3, 3); - sqlite3VdbeAddOp2(v, OP_ResultRow, 3, 1); - jmp4 = sqlite3VdbeAddOp1(v, OP_IfPos, 1); - sqlite3VdbeAddOp0(v, OP_Halt); - sqlite3VdbeJumpHere(v, jmp4); - sqlite3VdbeJumpHere(v, jmp2); - sqlite3VdbeResolveLabel(v, jmp3); - } - sqlite3VdbeAddOp2(v, OP_Next, iDataCur, loopTop); - sqlite3VdbeJumpHere(v, loopTop-1); -#ifndef SQLITE_OMIT_BTREECOUNT - sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, - "wrong # of entries in index ", P4_STATIC); - for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ - if( pPk==pIdx ) continue; - addr = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_IfPos, 1, addr+2); - sqlite3VdbeAddOp2(v, OP_Halt, 0, 0); - sqlite3VdbeAddOp2(v, OP_Count, iIdxCur+j, 3); - sqlite3VdbeAddOp3(v, OP_Eq, 8+j, addr+8, 3); - sqlite3VdbeAddOp2(v, OP_AddImm, 1, -1); - sqlite3VdbeAddOp4(v, OP_String8, 0, 3, 0, pIdx->zName, P4_TRANSIENT); - sqlite3VdbeAddOp3(v, OP_Concat, 3, 2, 7); - sqlite3VdbeAddOp2(v, OP_ResultRow, 7, 1); - } -#endif /* SQLITE_OMIT_BTREECOUNT */ - } - } - addr = sqlite3VdbeAddOpList(v, ArraySize(endCode), endCode); - sqlite3VdbeChangeP2(v, addr, -mxErr); - sqlite3VdbeJumpHere(v, addr+1); - sqlite3VdbeChangeP4(v, addr+2, "ok", P4_STATIC); - } - break; -#endif /* SQLITE_OMIT_INTEGRITY_CHECK */ - -#ifndef SQLITE_OMIT_UTF16 - /* - ** PRAGMA encoding - ** PRAGMA encoding = "utf-8"|"utf-16"|"utf-16le"|"utf-16be" - ** - ** In its first form, this pragma returns the encoding of the main - ** database. If the database is not initialized, it is initialized now. - ** - ** The second form of this pragma is a no-op if the main database file - ** has not already been initialized. In this case it sets the default - ** encoding that will be used for the main database file if a new file - ** is created. If an existing main database file is opened, then the - ** default text encoding for the existing database is used. - ** - ** In all cases new databases created using the ATTACH command are - ** created to use the same default text encoding as the main database. If - ** the main database has not been initialized and/or created when ATTACH - ** is executed, this is done before the ATTACH operation. - ** - ** In the second form this pragma sets the text encoding to be used in - ** new database files created using this database handle. It is only - ** useful if invoked immediately after the main database i - */ - case PragTyp_ENCODING: { - static const struct EncName { - char *zName; - u8 enc; - } encnames[] = { - { "UTF8", SQLITE_UTF8 }, - { "UTF-8", SQLITE_UTF8 }, /* Must be element [1] */ - { "UTF-16le", SQLITE_UTF16LE }, /* Must be element [2] */ - { "UTF-16be", SQLITE_UTF16BE }, /* Must be element [3] */ - { "UTF16le", SQLITE_UTF16LE }, - { "UTF16be", SQLITE_UTF16BE }, - { "UTF-16", 0 }, /* SQLITE_UTF16NATIVE */ - { "UTF16", 0 }, /* SQLITE_UTF16NATIVE */ - { 0, 0 } - }; - const struct EncName *pEnc; - if( !zRight ){ /* "PRAGMA encoding" */ - if( sqlite3ReadSchema(pParse) ) goto pragma_out; - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "encoding", SQLITE_STATIC); - sqlite3VdbeAddOp2(v, OP_String8, 0, 1); - assert( encnames[SQLITE_UTF8].enc==SQLITE_UTF8 ); - assert( encnames[SQLITE_UTF16LE].enc==SQLITE_UTF16LE ); - assert( encnames[SQLITE_UTF16BE].enc==SQLITE_UTF16BE ); - sqlite3VdbeChangeP4(v, -1, encnames[ENC(pParse->db)].zName, P4_STATIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); - }else{ /* "PRAGMA encoding = XXX" */ - /* Only change the value of sqlite.enc if the database handle is not - ** initialized. If the main database exists, the new sqlite.enc value - ** will be overwritten when the schema is next loaded. If it does not - ** already exists, it will be created to use the new encoding value. - */ - if( - !(DbHasProperty(db, 0, DB_SchemaLoaded)) || - DbHasProperty(db, 0, DB_Empty) - ){ - for(pEnc=&encnames[0]; pEnc->zName; pEnc++){ - if( 0==sqlite3StrICmp(zRight, pEnc->zName) ){ - ENC(pParse->db) = pEnc->enc ? pEnc->enc : SQLITE_UTF16NATIVE; - break; - } - } - if( !pEnc->zName ){ - sqlite3ErrorMsg(pParse, "unsupported encoding: %s", zRight); - } - } - } - } - break; -#endif /* SQLITE_OMIT_UTF16 */ - -#ifndef SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS - /* - ** PRAGMA [database.]schema_version - ** PRAGMA [database.]schema_version = - ** - ** PRAGMA [database.]user_version - ** PRAGMA [database.]user_version = - ** - ** PRAGMA [database.]freelist_count = - ** - ** PRAGMA [database.]application_id - ** PRAGMA [database.]application_id = - ** - ** The pragma's schema_version and user_version are used to set or get - ** the value of the schema-version and user-version, respectively. Both - ** the schema-version and the user-version are 32-bit signed integers - ** stored in the database header. - ** - ** The schema-cookie is usually only manipulated internally by SQLite. It - ** is incremented by SQLite whenever the database schema is modified (by - ** creating or dropping a table or index). The schema version is used by - ** SQLite each time a query is executed to ensure that the internal cache - ** of the schema used when compiling the SQL query matches the schema of - ** the database against which the compiled query is actually executed. - ** Subverting this mechanism by using "PRAGMA schema_version" to modify - ** the schema-version is potentially dangerous and may lead to program - ** crashes or database corruption. Use with caution! - ** - ** The user-version is not used internally by SQLite. It may be used by - ** applications for any purpose. - */ - case PragTyp_HEADER_VALUE: { - int iCookie; /* Cookie index. 1 for schema-cookie, 6 for user-cookie. */ - sqlite3VdbeUsesBtree(v, iDb); - switch( zLeft[0] ){ - case 'a': case 'A': - iCookie = BTREE_APPLICATION_ID; - break; - case 'f': case 'F': - iCookie = BTREE_FREE_PAGE_COUNT; - break; - case 's': case 'S': - iCookie = BTREE_SCHEMA_VERSION; - break; - default: - iCookie = BTREE_USER_VERSION; - break; - } - - if( zRight && iCookie!=BTREE_FREE_PAGE_COUNT ){ - /* Write the specified cookie value */ - static const VdbeOpList setCookie[] = { - { OP_Transaction, 0, 1, 0}, /* 0 */ - { OP_Integer, 0, 1, 0}, /* 1 */ - { OP_SetCookie, 0, 0, 1}, /* 2 */ - }; - int addr = sqlite3VdbeAddOpList(v, ArraySize(setCookie), setCookie); - sqlite3VdbeChangeP1(v, addr, iDb); - sqlite3VdbeChangeP1(v, addr+1, sqlite3Atoi(zRight)); - sqlite3VdbeChangeP1(v, addr+2, iDb); - sqlite3VdbeChangeP2(v, addr+2, iCookie); - }else{ - /* Read the specified cookie value */ - static const VdbeOpList readCookie[] = { - { OP_Transaction, 0, 0, 0}, /* 0 */ - { OP_ReadCookie, 0, 1, 0}, /* 1 */ - { OP_ResultRow, 1, 1, 0} - }; - int addr = sqlite3VdbeAddOpList(v, ArraySize(readCookie), readCookie); - sqlite3VdbeChangeP1(v, addr, iDb); - sqlite3VdbeChangeP1(v, addr+1, iDb); - sqlite3VdbeChangeP3(v, addr+1, iCookie); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, zLeft, SQLITE_TRANSIENT); - } - } - break; -#endif /* SQLITE_OMIT_SCHEMA_VERSION_PRAGMAS */ - -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS - /* - ** PRAGMA compile_options - ** - ** Return the names of all compile-time options used in this build, - ** one option per row. - */ - case PragTyp_COMPILE_OPTIONS: { - int i = 0; - const char *zOpt; - sqlite3VdbeSetNumCols(v, 1); - pParse->nMem = 1; - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "compile_option", SQLITE_STATIC); - while( (zOpt = sqlite3_compileoption_get(i++))!=0 ){ - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, zOpt, 0); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 1); - } - } - break; -#endif /* SQLITE_OMIT_COMPILEOPTION_DIAGS */ - -#ifndef SQLITE_OMIT_WAL - /* - ** PRAGMA [database.]wal_checkpoint = passive|full|restart - ** - ** Checkpoint the database. - */ - case PragTyp_WAL_CHECKPOINT: { - int iBt = (pId2->z?iDb:SQLITE_MAX_ATTACHED); - int eMode = SQLITE_CHECKPOINT_PASSIVE; - if( zRight ){ - if( sqlite3StrICmp(zRight, "full")==0 ){ - eMode = SQLITE_CHECKPOINT_FULL; - }else if( sqlite3StrICmp(zRight, "restart")==0 ){ - eMode = SQLITE_CHECKPOINT_RESTART; - } - } - sqlite3VdbeSetNumCols(v, 3); - pParse->nMem = 3; - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "busy", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "log", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 2, COLNAME_NAME, "checkpointed", SQLITE_STATIC); - - sqlite3VdbeAddOp3(v, OP_Checkpoint, iBt, eMode, 1); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 3); - } - break; - - /* - ** PRAGMA wal_autocheckpoint - ** PRAGMA wal_autocheckpoint = N - ** - ** Configure a database connection to automatically checkpoint a database - ** after accumulating N frames in the log. Or query for the current value - ** of N. - */ - case PragTyp_WAL_AUTOCHECKPOINT: { - if( zRight ){ - sqlite3_wal_autocheckpoint(db, sqlite3Atoi(zRight)); - } - returnSingleInt(pParse, "wal_autocheckpoint", - db->xWalCallback==sqlite3WalDefaultHook ? - SQLITE_PTR_TO_INT(db->pWalArg) : 0); - } - break; -#endif - - /* - ** PRAGMA shrink_memory - ** - ** This pragma attempts to free as much memory as possible from the - ** current database connection. - */ - case PragTyp_SHRINK_MEMORY: { - sqlite3_db_release_memory(db); - break; - } - - /* - ** PRAGMA busy_timeout - ** PRAGMA busy_timeout = N - ** - ** Call sqlite3_busy_timeout(db, N). Return the current timeout value - ** if one is set. If no busy handler or a different busy handler is set - ** then 0 is returned. Setting the busy_timeout to 0 or negative - ** disables the timeout. - */ - /*case PragTyp_BUSY_TIMEOUT*/ default: { - assert( aPragmaNames[mid].ePragTyp==PragTyp_BUSY_TIMEOUT ); - if( zRight ){ - sqlite3_busy_timeout(db, sqlite3Atoi(zRight)); - } - returnSingleInt(pParse, "timeout", db->busyTimeout); - break; - } - - /* - ** PRAGMA soft_heap_limit - ** PRAGMA soft_heap_limit = N - ** - ** Call sqlite3_soft_heap_limit64(N). Return the result. If N is omitted, - ** use -1. - */ - case PragTyp_SOFT_HEAP_LIMIT: { - sqlite3_int64 N; - if( zRight && sqlite3Atoi64(zRight, &N, 1000000, SQLITE_UTF8)==SQLITE_OK ){ - sqlite3_soft_heap_limit64(N); - } - returnSingleInt(pParse, "soft_heap_limit", sqlite3_soft_heap_limit64(-1)); - break; - } - -#if defined(SQLITE_DEBUG) || defined(SQLITE_TEST) - /* - ** Report the current state of file logs for all databases - */ - case PragTyp_LOCK_STATUS: { - static const char *const azLockName[] = { - "unlocked", "shared", "reserved", "pending", "exclusive" - }; - int i; - sqlite3VdbeSetNumCols(v, 2); - pParse->nMem = 2; - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "database", SQLITE_STATIC); - sqlite3VdbeSetColName(v, 1, COLNAME_NAME, "status", SQLITE_STATIC); - for(i=0; inDb; i++){ - Btree *pBt; - const char *zState = "unknown"; - int j; - if( db->aDb[i].zName==0 ) continue; - sqlite3VdbeAddOp4(v, OP_String8, 0, 1, 0, db->aDb[i].zName, P4_STATIC); - pBt = db->aDb[i].pBt; - if( pBt==0 || sqlite3BtreePager(pBt)==0 ){ - zState = "closed"; - }else if( sqlite3_file_control(db, i ? db->aDb[i].zName : 0, - SQLITE_FCNTL_LOCKSTATE, &j)==SQLITE_OK ){ - zState = azLockName[j]; - } - sqlite3VdbeAddOp4(v, OP_String8, 0, 2, 0, zState, P4_STATIC); - sqlite3VdbeAddOp2(v, OP_ResultRow, 1, 2); - } - break; - } -#endif - -#ifdef SQLITE_HAS_CODEC - case PragTyp_KEY: { - if( zRight ) sqlite3_key_v2(db, zDb, zRight, sqlite3Strlen30(zRight)); - break; - } - case PragTyp_REKEY: { - if( zRight ) sqlite3_rekey_v2(db, zDb, zRight, sqlite3Strlen30(zRight)); - break; - } - case PragTyp_HEXKEY: { - if( zRight ){ - u8 iByte; - int i; - char zKey[40]; - for(i=0, iByte=0; idb; - if( !db->mallocFailed && (db->flags & SQLITE_RecoveryMode)==0 ){ - if( zObj==0 ) zObj = "?"; - sqlite3SetString(pData->pzErrMsg, db, - "malformed database schema (%s)", zObj); - if( zExtra ){ - *pData->pzErrMsg = sqlite3MAppendf(db, *pData->pzErrMsg, - "%s - %s", *pData->pzErrMsg, zExtra); - } - } - pData->rc = db->mallocFailed ? SQLITE_NOMEM : SQLITE_CORRUPT_BKPT; -} - -/* -** This is the callback routine for the code that initializes the -** database. See sqlite3Init() below for additional information. -** This routine is also called from the OP_ParseSchema opcode of the VDBE. -** -** Each callback contains the following information: -** -** argv[0] = name of thing being created -** argv[1] = root page number for table or index. 0 for trigger or view. -** argv[2] = SQL text for the CREATE statement. -** -*/ -SQLITE_PRIVATE int sqlite3InitCallback(void *pInit, int argc, char **argv, char **NotUsed){ - InitData *pData = (InitData*)pInit; - sqlite3 *db = pData->db; - int iDb = pData->iDb; - - assert( argc==3 ); - UNUSED_PARAMETER2(NotUsed, argc); - assert( sqlite3_mutex_held(db->mutex) ); - DbClearProperty(db, iDb, DB_Empty); - if( db->mallocFailed ){ - corruptSchema(pData, argv[0], 0); - return 1; - } - - assert( iDb>=0 && iDbnDb ); - if( argv==0 ) return 0; /* Might happen if EMPTY_RESULT_CALLBACKS are on */ - if( argv[1]==0 ){ - corruptSchema(pData, argv[0], 0); - }else if( argv[2] && argv[2][0] ){ - /* Call the parser to process a CREATE TABLE, INDEX or VIEW. - ** But because db->init.busy is set to 1, no VDBE code is generated - ** or executed. All the parser does is build the internal data - ** structures that describe the table, index, or view. - */ - int rc; - sqlite3_stmt *pStmt; - TESTONLY(int rcp); /* Return code from sqlite3_prepare() */ - - assert( db->init.busy ); - db->init.iDb = iDb; - db->init.newTnum = sqlite3Atoi(argv[1]); - db->init.orphanTrigger = 0; - TESTONLY(rcp = ) sqlite3_prepare(db, argv[2], -1, &pStmt, 0); - rc = db->errCode; - assert( (rc&0xFF)==(rcp&0xFF) ); - db->init.iDb = 0; - if( SQLITE_OK!=rc ){ - if( db->init.orphanTrigger ){ - assert( iDb==1 ); - }else{ - pData->rc = rc; - if( rc==SQLITE_NOMEM ){ - db->mallocFailed = 1; - }else if( rc!=SQLITE_INTERRUPT && (rc&0xFF)!=SQLITE_LOCKED ){ - corruptSchema(pData, argv[0], sqlite3_errmsg(db)); - } - } - } - sqlite3_finalize(pStmt); - }else if( argv[0]==0 ){ - corruptSchema(pData, 0, 0); - }else{ - /* If the SQL column is blank it means this is an index that - ** was created to be the PRIMARY KEY or to fulfill a UNIQUE - ** constraint for a CREATE TABLE. The index should have already - ** been created when we processed the CREATE TABLE. All we have - ** to do here is record the root page number for that index. - */ - Index *pIndex; - pIndex = sqlite3FindIndex(db, argv[0], db->aDb[iDb].zName); - if( pIndex==0 ){ - /* This can occur if there exists an index on a TEMP table which - ** has the same name as another index on a permanent index. Since - ** the permanent table is hidden by the TEMP table, we can also - ** safely ignore the index on the permanent table. - */ - /* Do Nothing */; - }else if( sqlite3GetInt32(argv[1], &pIndex->tnum)==0 ){ - corruptSchema(pData, argv[0], "invalid rootpage"); - } - } - return 0; -} - -/* -** Attempt to read the database schema and initialize internal -** data structures for a single database file. The index of the -** database file is given by iDb. iDb==0 is used for the main -** database. iDb==1 should never be used. iDb>=2 is used for -** auxiliary databases. Return one of the SQLITE_ error codes to -** indicate success or failure. -*/ -static int sqlite3InitOne(sqlite3 *db, int iDb, char **pzErrMsg){ - int rc; - int i; -#ifndef SQLITE_OMIT_DEPRECATED - int size; -#endif - Table *pTab; - Db *pDb; - char const *azArg[4]; - int meta[5]; - InitData initData; - char const *zMasterSchema; - char const *zMasterName; - int openedTransaction = 0; - - /* - ** The master database table has a structure like this - */ - static const char master_schema[] = - "CREATE TABLE sqlite_master(\n" - " type text,\n" - " name text,\n" - " tbl_name text,\n" - " rootpage integer,\n" - " sql text\n" - ")" - ; -#ifndef SQLITE_OMIT_TEMPDB - static const char temp_master_schema[] = - "CREATE TEMP TABLE sqlite_temp_master(\n" - " type text,\n" - " name text,\n" - " tbl_name text,\n" - " rootpage integer,\n" - " sql text\n" - ")" - ; -#else - #define temp_master_schema 0 -#endif - - assert( iDb>=0 && iDbnDb ); - assert( db->aDb[iDb].pSchema ); - assert( sqlite3_mutex_held(db->mutex) ); - assert( iDb==1 || sqlite3BtreeHoldsMutex(db->aDb[iDb].pBt) ); - - /* zMasterSchema and zInitScript are set to point at the master schema - ** and initialisation script appropriate for the database being - ** initialized. zMasterName is the name of the master table. - */ - if( !OMIT_TEMPDB && iDb==1 ){ - zMasterSchema = temp_master_schema; - }else{ - zMasterSchema = master_schema; - } - zMasterName = SCHEMA_TABLE(iDb); - - /* Construct the schema tables. */ - azArg[0] = zMasterName; - azArg[1] = "1"; - azArg[2] = zMasterSchema; - azArg[3] = 0; - initData.db = db; - initData.iDb = iDb; - initData.rc = SQLITE_OK; - initData.pzErrMsg = pzErrMsg; - sqlite3InitCallback(&initData, 3, (char **)azArg, 0); - if( initData.rc ){ - rc = initData.rc; - goto error_out; - } - pTab = sqlite3FindTable(db, zMasterName, db->aDb[iDb].zName); - if( ALWAYS(pTab) ){ - pTab->tabFlags |= TF_Readonly; - } - - /* Create a cursor to hold the database open - */ - pDb = &db->aDb[iDb]; - if( pDb->pBt==0 ){ - if( !OMIT_TEMPDB && ALWAYS(iDb==1) ){ - DbSetProperty(db, 1, DB_SchemaLoaded); - } - return SQLITE_OK; - } - - /* If there is not already a read-only (or read-write) transaction opened - ** on the b-tree database, open one now. If a transaction is opened, it - ** will be closed before this function returns. */ - sqlite3BtreeEnter(pDb->pBt); - if( !sqlite3BtreeIsInReadTrans(pDb->pBt) ){ - rc = sqlite3BtreeBeginTrans(pDb->pBt, 0); - if( rc!=SQLITE_OK ){ - sqlite3SetString(pzErrMsg, db, "%s", sqlite3ErrStr(rc)); - goto initone_error_out; - } - openedTransaction = 1; - } - - /* Get the database meta information. - ** - ** Meta values are as follows: - ** meta[0] Schema cookie. Changes with each schema change. - ** meta[1] File format of schema layer. - ** meta[2] Size of the page cache. - ** meta[3] Largest rootpage (auto/incr_vacuum mode) - ** meta[4] Db text encoding. 1:UTF-8 2:UTF-16LE 3:UTF-16BE - ** meta[5] User version - ** meta[6] Incremental vacuum mode - ** meta[7] unused - ** meta[8] unused - ** meta[9] unused - ** - ** Note: The #defined SQLITE_UTF* symbols in sqliteInt.h correspond to - ** the possible values of meta[4]. - */ - for(i=0; ipBt, i+1, (u32 *)&meta[i]); - } - pDb->pSchema->schema_cookie = meta[BTREE_SCHEMA_VERSION-1]; - - /* If opening a non-empty database, check the text encoding. For the - ** main database, set sqlite3.enc to the encoding of the main database. - ** For an attached db, it is an error if the encoding is not the same - ** as sqlite3.enc. - */ - if( meta[BTREE_TEXT_ENCODING-1] ){ /* text encoding */ - if( iDb==0 ){ -#ifndef SQLITE_OMIT_UTF16 - u8 encoding; - /* If opening the main database, set ENC(db). */ - encoding = (u8)meta[BTREE_TEXT_ENCODING-1] & 3; - if( encoding==0 ) encoding = SQLITE_UTF8; - ENC(db) = encoding; -#else - ENC(db) = SQLITE_UTF8; -#endif - }else{ - /* If opening an attached database, the encoding much match ENC(db) */ - if( meta[BTREE_TEXT_ENCODING-1]!=ENC(db) ){ - sqlite3SetString(pzErrMsg, db, "attached databases must use the same" - " text encoding as main database"); - rc = SQLITE_ERROR; - goto initone_error_out; - } - } - }else{ - DbSetProperty(db, iDb, DB_Empty); - } - pDb->pSchema->enc = ENC(db); - - if( pDb->pSchema->cache_size==0 ){ -#ifndef SQLITE_OMIT_DEPRECATED - size = sqlite3AbsInt32(meta[BTREE_DEFAULT_CACHE_SIZE-1]); - if( size==0 ){ size = SQLITE_DEFAULT_CACHE_SIZE; } - pDb->pSchema->cache_size = size; -#else - pDb->pSchema->cache_size = SQLITE_DEFAULT_CACHE_SIZE; -#endif - sqlite3BtreeSetCacheSize(pDb->pBt, pDb->pSchema->cache_size); - } - - /* - ** file_format==1 Version 3.0.0. - ** file_format==2 Version 3.1.3. // ALTER TABLE ADD COLUMN - ** file_format==3 Version 3.1.4. // ditto but with non-NULL defaults - ** file_format==4 Version 3.3.0. // DESC indices. Boolean constants - */ - pDb->pSchema->file_format = (u8)meta[BTREE_FILE_FORMAT-1]; - if( pDb->pSchema->file_format==0 ){ - pDb->pSchema->file_format = 1; - } - if( pDb->pSchema->file_format>SQLITE_MAX_FILE_FORMAT ){ - sqlite3SetString(pzErrMsg, db, "unsupported file format"); - rc = SQLITE_ERROR; - goto initone_error_out; - } - - /* Ticket #2804: When we open a database in the newer file format, - ** clear the legacy_file_format pragma flag so that a VACUUM will - ** not downgrade the database and thus invalidate any descending - ** indices that the user might have created. - */ - if( iDb==0 && meta[BTREE_FILE_FORMAT-1]>=4 ){ - db->flags &= ~SQLITE_LegacyFileFmt; - } - - /* Read the schema information out of the schema tables - */ - assert( db->init.busy ); - { - char *zSql; - zSql = sqlite3MPrintf(db, - "SELECT name, rootpage, sql FROM '%q'.%s ORDER BY rowid", - db->aDb[iDb].zName, zMasterName); -#ifndef SQLITE_OMIT_AUTHORIZATION - { - int (*xAuth)(void*,int,const char*,const char*,const char*,const char*); - xAuth = db->xAuth; - db->xAuth = 0; -#endif - rc = sqlite3_exec(db, zSql, sqlite3InitCallback, &initData, 0); -#ifndef SQLITE_OMIT_AUTHORIZATION - db->xAuth = xAuth; - } -#endif - if( rc==SQLITE_OK ) rc = initData.rc; - sqlite3DbFree(db, zSql); -#ifndef SQLITE_OMIT_ANALYZE - if( rc==SQLITE_OK ){ - sqlite3AnalysisLoad(db, iDb); - } -#endif - } - if( db->mallocFailed ){ - rc = SQLITE_NOMEM; - sqlite3ResetAllSchemasOfConnection(db); - } - if( rc==SQLITE_OK || (db->flags&SQLITE_RecoveryMode)){ - /* Black magic: If the SQLITE_RecoveryMode flag is set, then consider - ** the schema loaded, even if errors occurred. In this situation the - ** current sqlite3_prepare() operation will fail, but the following one - ** will attempt to compile the supplied statement against whatever subset - ** of the schema was loaded before the error occurred. The primary - ** purpose of this is to allow access to the sqlite_master table - ** even when its contents have been corrupted. - */ - DbSetProperty(db, iDb, DB_SchemaLoaded); - rc = SQLITE_OK; - } - - /* Jump here for an error that occurs after successfully allocating - ** curMain and calling sqlite3BtreeEnter(). For an error that occurs - ** before that point, jump to error_out. - */ -initone_error_out: - if( openedTransaction ){ - sqlite3BtreeCommit(pDb->pBt); - } - sqlite3BtreeLeave(pDb->pBt); - -error_out: - if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){ - db->mallocFailed = 1; - } - return rc; -} - -/* -** Initialize all database files - the main database file, the file -** used to store temporary tables, and any additional database files -** created using ATTACH statements. Return a success code. If an -** error occurs, write an error message into *pzErrMsg. -** -** After a database is initialized, the DB_SchemaLoaded bit is set -** bit is set in the flags field of the Db structure. If the database -** file was of zero-length, then the DB_Empty flag is also set. -*/ -SQLITE_PRIVATE int sqlite3Init(sqlite3 *db, char **pzErrMsg){ - int i, rc; - int commit_internal = !(db->flags&SQLITE_InternChanges); - - assert( sqlite3_mutex_held(db->mutex) ); - rc = SQLITE_OK; - db->init.busy = 1; - for(i=0; rc==SQLITE_OK && inDb; i++){ - if( DbHasProperty(db, i, DB_SchemaLoaded) || i==1 ) continue; - rc = sqlite3InitOne(db, i, pzErrMsg); - if( rc ){ - sqlite3ResetOneSchema(db, i); - } - } - - /* Once all the other databases have been initialized, load the schema - ** for the TEMP database. This is loaded last, as the TEMP database - ** schema may contain references to objects in other databases. - */ -#ifndef SQLITE_OMIT_TEMPDB - if( rc==SQLITE_OK && ALWAYS(db->nDb>1) - && !DbHasProperty(db, 1, DB_SchemaLoaded) ){ - rc = sqlite3InitOne(db, 1, pzErrMsg); - if( rc ){ - sqlite3ResetOneSchema(db, 1); - } - } -#endif - - db->init.busy = 0; - if( rc==SQLITE_OK && commit_internal ){ - sqlite3CommitInternalChanges(db); - } - - return rc; -} - -/* -** This routine is a no-op if the database schema is already initialized. -** Otherwise, the schema is loaded. An error code is returned. -*/ -SQLITE_PRIVATE int sqlite3ReadSchema(Parse *pParse){ - int rc = SQLITE_OK; - sqlite3 *db = pParse->db; - assert( sqlite3_mutex_held(db->mutex) ); - if( !db->init.busy ){ - rc = sqlite3Init(db, &pParse->zErrMsg); - } - if( rc!=SQLITE_OK ){ - pParse->rc = rc; - pParse->nErr++; - } - return rc; -} - - -/* -** Check schema cookies in all databases. If any cookie is out -** of date set pParse->rc to SQLITE_SCHEMA. If all schema cookies -** make no changes to pParse->rc. -*/ -static void schemaIsValid(Parse *pParse){ - sqlite3 *db = pParse->db; - int iDb; - int rc; - int cookie; - - assert( pParse->checkSchema ); - assert( sqlite3_mutex_held(db->mutex) ); - for(iDb=0; iDbnDb; iDb++){ - int openedTransaction = 0; /* True if a transaction is opened */ - Btree *pBt = db->aDb[iDb].pBt; /* Btree database to read cookie from */ - if( pBt==0 ) continue; - - /* If there is not already a read-only (or read-write) transaction opened - ** on the b-tree database, open one now. If a transaction is opened, it - ** will be closed immediately after reading the meta-value. */ - if( !sqlite3BtreeIsInReadTrans(pBt) ){ - rc = sqlite3BtreeBeginTrans(pBt, 0); - if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ){ - db->mallocFailed = 1; - } - if( rc!=SQLITE_OK ) return; - openedTransaction = 1; - } - - /* Read the schema cookie from the database. If it does not match the - ** value stored as part of the in-memory schema representation, - ** set Parse.rc to SQLITE_SCHEMA. */ - sqlite3BtreeGetMeta(pBt, BTREE_SCHEMA_VERSION, (u32 *)&cookie); - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - if( cookie!=db->aDb[iDb].pSchema->schema_cookie ){ - sqlite3ResetOneSchema(db, iDb); - pParse->rc = SQLITE_SCHEMA; - } - - /* Close the transaction, if one was opened. */ - if( openedTransaction ){ - sqlite3BtreeCommit(pBt); - } - } -} - -/* -** Convert a schema pointer into the iDb index that indicates -** which database file in db->aDb[] the schema refers to. -** -** If the same database is attached more than once, the first -** attached database is returned. -*/ -SQLITE_PRIVATE int sqlite3SchemaToIndex(sqlite3 *db, Schema *pSchema){ - int i = -1000000; - - /* If pSchema is NULL, then return -1000000. This happens when code in - ** expr.c is trying to resolve a reference to a transient table (i.e. one - ** created by a sub-select). In this case the return value of this - ** function should never be used. - ** - ** We return -1000000 instead of the more usual -1 simply because using - ** -1000000 as the incorrect index into db->aDb[] is much - ** more likely to cause a segfault than -1 (of course there are assert() - ** statements too, but it never hurts to play the odds). - */ - assert( sqlite3_mutex_held(db->mutex) ); - if( pSchema ){ - for(i=0; ALWAYS(inDb); i++){ - if( db->aDb[i].pSchema==pSchema ){ - break; - } - } - assert( i>=0 && inDb ); - } - return i; -} - -/* -** Free all memory allocations in the pParse object -*/ -SQLITE_PRIVATE void sqlite3ParserReset(Parse *pParse){ - if( pParse ){ - sqlite3 *db = pParse->db; - sqlite3DbFree(db, pParse->aLabel); - sqlite3ExprListDelete(db, pParse->pConstExpr); - } -} - -/* -** Compile the UTF-8 encoded SQL statement zSql into a statement handle. -*/ -static int sqlite3Prepare( - sqlite3 *db, /* Database handle. */ - const char *zSql, /* UTF-8 encoded SQL statement. */ - int nBytes, /* Length of zSql in bytes. */ - int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */ - Vdbe *pReprepare, /* VM being reprepared */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ - const char **pzTail /* OUT: End of parsed string */ -){ - Parse *pParse; /* Parsing context */ - char *zErrMsg = 0; /* Error message */ - int rc = SQLITE_OK; /* Result code */ - int i; /* Loop counter */ - - /* Allocate the parsing context */ - pParse = sqlite3StackAllocZero(db, sizeof(*pParse)); - if( pParse==0 ){ - rc = SQLITE_NOMEM; - goto end_prepare; - } - pParse->pReprepare = pReprepare; - assert( ppStmt && *ppStmt==0 ); - assert( !db->mallocFailed ); - assert( sqlite3_mutex_held(db->mutex) ); - - /* Check to verify that it is possible to get a read lock on all - ** database schemas. The inability to get a read lock indicates that - ** some other database connection is holding a write-lock, which in - ** turn means that the other connection has made uncommitted changes - ** to the schema. - ** - ** Were we to proceed and prepare the statement against the uncommitted - ** schema changes and if those schema changes are subsequently rolled - ** back and different changes are made in their place, then when this - ** prepared statement goes to run the schema cookie would fail to detect - ** the schema change. Disaster would follow. - ** - ** This thread is currently holding mutexes on all Btrees (because - ** of the sqlite3BtreeEnterAll() in sqlite3LockAndPrepare()) so it - ** is not possible for another thread to start a new schema change - ** while this routine is running. Hence, we do not need to hold - ** locks on the schema, we just need to make sure nobody else is - ** holding them. - ** - ** Note that setting READ_UNCOMMITTED overrides most lock detection, - ** but it does *not* override schema lock detection, so this all still - ** works even if READ_UNCOMMITTED is set. - */ - for(i=0; inDb; i++) { - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - assert( sqlite3BtreeHoldsMutex(pBt) ); - rc = sqlite3BtreeSchemaLocked(pBt); - if( rc ){ - const char *zDb = db->aDb[i].zName; - sqlite3Error(db, rc, "database schema is locked: %s", zDb); - testcase( db->flags & SQLITE_ReadUncommitted ); - goto end_prepare; - } - } - } - - sqlite3VtabUnlockList(db); - - pParse->db = db; - pParse->nQueryLoop = 0; /* Logarithmic, so 0 really means 1 */ - if( nBytes>=0 && (nBytes==0 || zSql[nBytes-1]!=0) ){ - char *zSqlCopy; - int mxLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; - testcase( nBytes==mxLen ); - testcase( nBytes==mxLen+1 ); - if( nBytes>mxLen ){ - sqlite3Error(db, SQLITE_TOOBIG, "statement too long"); - rc = sqlite3ApiExit(db, SQLITE_TOOBIG); - goto end_prepare; - } - zSqlCopy = sqlite3DbStrNDup(db, zSql, nBytes); - if( zSqlCopy ){ - sqlite3RunParser(pParse, zSqlCopy, &zErrMsg); - sqlite3DbFree(db, zSqlCopy); - pParse->zTail = &zSql[pParse->zTail-zSqlCopy]; - }else{ - pParse->zTail = &zSql[nBytes]; - } - }else{ - sqlite3RunParser(pParse, zSql, &zErrMsg); - } - assert( 0==pParse->nQueryLoop ); - - if( db->mallocFailed ){ - pParse->rc = SQLITE_NOMEM; - } - if( pParse->rc==SQLITE_DONE ) pParse->rc = SQLITE_OK; - if( pParse->checkSchema ){ - schemaIsValid(pParse); - } - if( db->mallocFailed ){ - pParse->rc = SQLITE_NOMEM; - } - if( pzTail ){ - *pzTail = pParse->zTail; - } - rc = pParse->rc; - -#ifndef SQLITE_OMIT_EXPLAIN - if( rc==SQLITE_OK && pParse->pVdbe && pParse->explain ){ - static const char * const azColName[] = { - "addr", "opcode", "p1", "p2", "p3", "p4", "p5", "comment", - "selectid", "order", "from", "detail" - }; - int iFirst, mx; - if( pParse->explain==2 ){ - sqlite3VdbeSetNumCols(pParse->pVdbe, 4); - iFirst = 8; - mx = 12; - }else{ - sqlite3VdbeSetNumCols(pParse->pVdbe, 8); - iFirst = 0; - mx = 8; - } - for(i=iFirst; ipVdbe, i-iFirst, COLNAME_NAME, - azColName[i], SQLITE_STATIC); - } - } -#endif - - if( db->init.busy==0 ){ - Vdbe *pVdbe = pParse->pVdbe; - sqlite3VdbeSetSql(pVdbe, zSql, (int)(pParse->zTail-zSql), saveSqlFlag); - } - if( pParse->pVdbe && (rc!=SQLITE_OK || db->mallocFailed) ){ - sqlite3VdbeFinalize(pParse->pVdbe); - assert(!(*ppStmt)); - }else{ - *ppStmt = (sqlite3_stmt*)pParse->pVdbe; - } - - if( zErrMsg ){ - sqlite3Error(db, rc, "%s", zErrMsg); - sqlite3DbFree(db, zErrMsg); - }else{ - sqlite3Error(db, rc, 0); - } - - /* Delete any TriggerPrg structures allocated while parsing this statement. */ - while( pParse->pTriggerPrg ){ - TriggerPrg *pT = pParse->pTriggerPrg; - pParse->pTriggerPrg = pT->pNext; - sqlite3DbFree(db, pT); - } - -end_prepare: - - sqlite3ParserReset(pParse); - sqlite3StackFree(db, pParse); - rc = sqlite3ApiExit(db, rc); - assert( (rc&db->errMask)==rc ); - return rc; -} -static int sqlite3LockAndPrepare( - sqlite3 *db, /* Database handle. */ - const char *zSql, /* UTF-8 encoded SQL statement. */ - int nBytes, /* Length of zSql in bytes. */ - int saveSqlFlag, /* True to copy SQL text into the sqlite3_stmt */ - Vdbe *pOld, /* VM being reprepared */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ - const char **pzTail /* OUT: End of parsed string */ -){ - int rc; - assert( ppStmt!=0 ); - *ppStmt = 0; - if( !sqlite3SafetyCheckOk(db) ){ - return SQLITE_MISUSE_BKPT; - } - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeEnterAll(db); - rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail); - if( rc==SQLITE_SCHEMA ){ - sqlite3_finalize(*ppStmt); - rc = sqlite3Prepare(db, zSql, nBytes, saveSqlFlag, pOld, ppStmt, pzTail); - } - sqlite3BtreeLeaveAll(db); - sqlite3_mutex_leave(db->mutex); - assert( rc==SQLITE_OK || *ppStmt==0 ); - return rc; -} - -/* -** Rerun the compilation of a statement after a schema change. -** -** If the statement is successfully recompiled, return SQLITE_OK. Otherwise, -** if the statement cannot be recompiled because another connection has -** locked the sqlite3_master table, return SQLITE_LOCKED. If any other error -** occurs, return SQLITE_SCHEMA. -*/ -SQLITE_PRIVATE int sqlite3Reprepare(Vdbe *p){ - int rc; - sqlite3_stmt *pNew; - const char *zSql; - sqlite3 *db; - - assert( sqlite3_mutex_held(sqlite3VdbeDb(p)->mutex) ); - zSql = sqlite3_sql((sqlite3_stmt *)p); - assert( zSql!=0 ); /* Reprepare only called for prepare_v2() statements */ - db = sqlite3VdbeDb(p); - assert( sqlite3_mutex_held(db->mutex) ); - rc = sqlite3LockAndPrepare(db, zSql, -1, 0, p, &pNew, 0); - if( rc ){ - if( rc==SQLITE_NOMEM ){ - db->mallocFailed = 1; - } - assert( pNew==0 ); - return rc; - }else{ - assert( pNew!=0 ); - } - sqlite3VdbeSwap((Vdbe*)pNew, p); - sqlite3TransferBindings(pNew, (sqlite3_stmt*)p); - sqlite3VdbeResetStepResult((Vdbe*)pNew); - sqlite3VdbeFinalize((Vdbe*)pNew); - return SQLITE_OK; -} - - -/* -** Two versions of the official API. Legacy and new use. In the legacy -** version, the original SQL text is not saved in the prepared statement -** and so if a schema change occurs, SQLITE_SCHEMA is returned by -** sqlite3_step(). In the new version, the original SQL text is retained -** and the statement is automatically recompiled if an schema change -** occurs. -*/ -SQLITE_API int sqlite3_prepare( - sqlite3 *db, /* Database handle. */ - const char *zSql, /* UTF-8 encoded SQL statement. */ - int nBytes, /* Length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ - const char **pzTail /* OUT: End of parsed string */ -){ - int rc; - rc = sqlite3LockAndPrepare(db,zSql,nBytes,0,0,ppStmt,pzTail); - assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ - return rc; -} -SQLITE_API int sqlite3_prepare_v2( - sqlite3 *db, /* Database handle. */ - const char *zSql, /* UTF-8 encoded SQL statement. */ - int nBytes, /* Length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ - const char **pzTail /* OUT: End of parsed string */ -){ - int rc; - rc = sqlite3LockAndPrepare(db,zSql,nBytes,1,0,ppStmt,pzTail); - assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ - return rc; -} - - -#ifndef SQLITE_OMIT_UTF16 -/* -** Compile the UTF-16 encoded SQL statement zSql into a statement handle. -*/ -static int sqlite3Prepare16( - sqlite3 *db, /* Database handle. */ - const void *zSql, /* UTF-16 encoded SQL statement. */ - int nBytes, /* Length of zSql in bytes. */ - int saveSqlFlag, /* True to save SQL text into the sqlite3_stmt */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ - const void **pzTail /* OUT: End of parsed string */ -){ - /* This function currently works by first transforming the UTF-16 - ** encoded string to UTF-8, then invoking sqlite3_prepare(). The - ** tricky bit is figuring out the pointer to return in *pzTail. - */ - char *zSql8; - const char *zTail8 = 0; - int rc = SQLITE_OK; - - assert( ppStmt ); - *ppStmt = 0; - if( !sqlite3SafetyCheckOk(db) ){ - return SQLITE_MISUSE_BKPT; - } - if( nBytes>=0 ){ - int sz; - const char *z = (const char*)zSql; - for(sz=0; szmutex); - zSql8 = sqlite3Utf16to8(db, zSql, nBytes, SQLITE_UTF16NATIVE); - if( zSql8 ){ - rc = sqlite3LockAndPrepare(db, zSql8, -1, saveSqlFlag, 0, ppStmt, &zTail8); - } - - if( zTail8 && pzTail ){ - /* If sqlite3_prepare returns a tail pointer, we calculate the - ** equivalent pointer into the UTF-16 string by counting the unicode - ** characters between zSql8 and zTail8, and then returning a pointer - ** the same number of characters into the UTF-16 string. - */ - int chars_parsed = sqlite3Utf8CharLen(zSql8, (int)(zTail8-zSql8)); - *pzTail = (u8 *)zSql + sqlite3Utf16ByteLen(zSql, chars_parsed); - } - sqlite3DbFree(db, zSql8); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/* -** Two versions of the official API. Legacy and new use. In the legacy -** version, the original SQL text is not saved in the prepared statement -** and so if a schema change occurs, SQLITE_SCHEMA is returned by -** sqlite3_step(). In the new version, the original SQL text is retained -** and the statement is automatically recompiled if an schema change -** occurs. -*/ -SQLITE_API int sqlite3_prepare16( - sqlite3 *db, /* Database handle. */ - const void *zSql, /* UTF-16 encoded SQL statement. */ - int nBytes, /* Length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ - const void **pzTail /* OUT: End of parsed string */ -){ - int rc; - rc = sqlite3Prepare16(db,zSql,nBytes,0,ppStmt,pzTail); - assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ - return rc; -} -SQLITE_API int sqlite3_prepare16_v2( - sqlite3 *db, /* Database handle. */ - const void *zSql, /* UTF-16 encoded SQL statement. */ - int nBytes, /* Length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: A pointer to the prepared statement */ - const void **pzTail /* OUT: End of parsed string */ -){ - int rc; - rc = sqlite3Prepare16(db,zSql,nBytes,1,ppStmt,pzTail); - assert( rc==SQLITE_OK || ppStmt==0 || *ppStmt==0 ); /* VERIFY: F13021 */ - return rc; -} - -#endif /* SQLITE_OMIT_UTF16 */ - -/************** End of prepare.c *********************************************/ -/************** Begin file select.c ******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains C code routines that are called by the parser -** to handle SELECT statements in SQLite. -*/ - - -/* -** Delete all the content of a Select structure but do not deallocate -** the select structure itself. -*/ -static void clearSelect(sqlite3 *db, Select *p){ - sqlite3ExprListDelete(db, p->pEList); - sqlite3SrcListDelete(db, p->pSrc); - sqlite3ExprDelete(db, p->pWhere); - sqlite3ExprListDelete(db, p->pGroupBy); - sqlite3ExprDelete(db, p->pHaving); - sqlite3ExprListDelete(db, p->pOrderBy); - sqlite3SelectDelete(db, p->pPrior); - sqlite3ExprDelete(db, p->pLimit); - sqlite3ExprDelete(db, p->pOffset); - sqlite3WithDelete(db, p->pWith); -} - -/* -** Initialize a SelectDest structure. -*/ -SQLITE_PRIVATE void sqlite3SelectDestInit(SelectDest *pDest, int eDest, int iParm){ - pDest->eDest = (u8)eDest; - pDest->iSDParm = iParm; - pDest->affSdst = 0; - pDest->iSdst = 0; - pDest->nSdst = 0; -} - - -/* -** Allocate a new Select structure and return a pointer to that -** structure. -*/ -SQLITE_PRIVATE Select *sqlite3SelectNew( - Parse *pParse, /* Parsing context */ - ExprList *pEList, /* which columns to include in the result */ - SrcList *pSrc, /* the FROM clause -- which tables to scan */ - Expr *pWhere, /* the WHERE clause */ - ExprList *pGroupBy, /* the GROUP BY clause */ - Expr *pHaving, /* the HAVING clause */ - ExprList *pOrderBy, /* the ORDER BY clause */ - u16 selFlags, /* Flag parameters, such as SF_Distinct */ - Expr *pLimit, /* LIMIT value. NULL means not used */ - Expr *pOffset /* OFFSET value. NULL means no offset */ -){ - Select *pNew; - Select standin; - sqlite3 *db = pParse->db; - pNew = sqlite3DbMallocZero(db, sizeof(*pNew) ); - assert( db->mallocFailed || !pOffset || pLimit ); /* OFFSET implies LIMIT */ - if( pNew==0 ){ - assert( db->mallocFailed ); - pNew = &standin; - memset(pNew, 0, sizeof(*pNew)); - } - if( pEList==0 ){ - pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db,TK_ALL,0)); - } - pNew->pEList = pEList; - if( pSrc==0 ) pSrc = sqlite3DbMallocZero(db, sizeof(*pSrc)); - pNew->pSrc = pSrc; - pNew->pWhere = pWhere; - pNew->pGroupBy = pGroupBy; - pNew->pHaving = pHaving; - pNew->pOrderBy = pOrderBy; - pNew->selFlags = selFlags; - pNew->op = TK_SELECT; - pNew->pLimit = pLimit; - pNew->pOffset = pOffset; - assert( pOffset==0 || pLimit!=0 ); - pNew->addrOpenEphm[0] = -1; - pNew->addrOpenEphm[1] = -1; - pNew->addrOpenEphm[2] = -1; - if( db->mallocFailed ) { - clearSelect(db, pNew); - if( pNew!=&standin ) sqlite3DbFree(db, pNew); - pNew = 0; - }else{ - assert( pNew->pSrc!=0 || pParse->nErr>0 ); - } - assert( pNew!=&standin ); - return pNew; -} - -/* -** Delete the given Select structure and all of its substructures. -*/ -SQLITE_PRIVATE void sqlite3SelectDelete(sqlite3 *db, Select *p){ - if( p ){ - clearSelect(db, p); - sqlite3DbFree(db, p); - } -} - -/* -** Given 1 to 3 identifiers preceding the JOIN keyword, determine the -** type of join. Return an integer constant that expresses that type -** in terms of the following bit values: -** -** JT_INNER -** JT_CROSS -** JT_OUTER -** JT_NATURAL -** JT_LEFT -** JT_RIGHT -** -** A full outer join is the combination of JT_LEFT and JT_RIGHT. -** -** If an illegal or unsupported join type is seen, then still return -** a join type, but put an error in the pParse structure. -*/ -SQLITE_PRIVATE int sqlite3JoinType(Parse *pParse, Token *pA, Token *pB, Token *pC){ - int jointype = 0; - Token *apAll[3]; - Token *p; - /* 0123456789 123456789 123456789 123 */ - static const char zKeyText[] = "naturaleftouterightfullinnercross"; - static const struct { - u8 i; /* Beginning of keyword text in zKeyText[] */ - u8 nChar; /* Length of the keyword in characters */ - u8 code; /* Join type mask */ - } aKeyword[] = { - /* natural */ { 0, 7, JT_NATURAL }, - /* left */ { 6, 4, JT_LEFT|JT_OUTER }, - /* outer */ { 10, 5, JT_OUTER }, - /* right */ { 14, 5, JT_RIGHT|JT_OUTER }, - /* full */ { 19, 4, JT_LEFT|JT_RIGHT|JT_OUTER }, - /* inner */ { 23, 5, JT_INNER }, - /* cross */ { 28, 5, JT_INNER|JT_CROSS }, - }; - int i, j; - apAll[0] = pA; - apAll[1] = pB; - apAll[2] = pC; - for(i=0; i<3 && apAll[i]; i++){ - p = apAll[i]; - for(j=0; jn==aKeyword[j].nChar - && sqlite3StrNICmp((char*)p->z, &zKeyText[aKeyword[j].i], p->n)==0 ){ - jointype |= aKeyword[j].code; - break; - } - } - testcase( j==0 || j==1 || j==2 || j==3 || j==4 || j==5 || j==6 ); - if( j>=ArraySize(aKeyword) ){ - jointype |= JT_ERROR; - break; - } - } - if( - (jointype & (JT_INNER|JT_OUTER))==(JT_INNER|JT_OUTER) || - (jointype & JT_ERROR)!=0 - ){ - const char *zSp = " "; - assert( pB!=0 ); - if( pC==0 ){ zSp++; } - sqlite3ErrorMsg(pParse, "unknown or unsupported join type: " - "%T %T%s%T", pA, pB, zSp, pC); - jointype = JT_INNER; - }else if( (jointype & JT_OUTER)!=0 - && (jointype & (JT_LEFT|JT_RIGHT))!=JT_LEFT ){ - sqlite3ErrorMsg(pParse, - "RIGHT and FULL OUTER JOINs are not currently supported"); - jointype = JT_INNER; - } - return jointype; -} - -/* -** Return the index of a column in a table. Return -1 if the column -** is not contained in the table. -*/ -static int columnIndex(Table *pTab, const char *zCol){ - int i; - for(i=0; inCol; i++){ - if( sqlite3StrICmp(pTab->aCol[i].zName, zCol)==0 ) return i; - } - return -1; -} - -/* -** Search the first N tables in pSrc, from left to right, looking for a -** table that has a column named zCol. -** -** When found, set *piTab and *piCol to the table index and column index -** of the matching column and return TRUE. -** -** If not found, return FALSE. -*/ -static int tableAndColumnIndex( - SrcList *pSrc, /* Array of tables to search */ - int N, /* Number of tables in pSrc->a[] to search */ - const char *zCol, /* Name of the column we are looking for */ - int *piTab, /* Write index of pSrc->a[] here */ - int *piCol /* Write index of pSrc->a[*piTab].pTab->aCol[] here */ -){ - int i; /* For looping over tables in pSrc */ - int iCol; /* Index of column matching zCol */ - - assert( (piTab==0)==(piCol==0) ); /* Both or neither are NULL */ - for(i=0; ia[i].pTab, zCol); - if( iCol>=0 ){ - if( piTab ){ - *piTab = i; - *piCol = iCol; - } - return 1; - } - } - return 0; -} - -/* -** This function is used to add terms implied by JOIN syntax to the -** WHERE clause expression of a SELECT statement. The new term, which -** is ANDed with the existing WHERE clause, is of the form: -** -** (tab1.col1 = tab2.col2) -** -** where tab1 is the iSrc'th table in SrcList pSrc and tab2 is the -** (iSrc+1)'th. Column col1 is column iColLeft of tab1, and col2 is -** column iColRight of tab2. -*/ -static void addWhereTerm( - Parse *pParse, /* Parsing context */ - SrcList *pSrc, /* List of tables in FROM clause */ - int iLeft, /* Index of first table to join in pSrc */ - int iColLeft, /* Index of column in first table */ - int iRight, /* Index of second table in pSrc */ - int iColRight, /* Index of column in second table */ - int isOuterJoin, /* True if this is an OUTER join */ - Expr **ppWhere /* IN/OUT: The WHERE clause to add to */ -){ - sqlite3 *db = pParse->db; - Expr *pE1; - Expr *pE2; - Expr *pEq; - - assert( iLeftnSrc>iRight ); - assert( pSrc->a[iLeft].pTab ); - assert( pSrc->a[iRight].pTab ); - - pE1 = sqlite3CreateColumnExpr(db, pSrc, iLeft, iColLeft); - pE2 = sqlite3CreateColumnExpr(db, pSrc, iRight, iColRight); - - pEq = sqlite3PExpr(pParse, TK_EQ, pE1, pE2, 0); - if( pEq && isOuterJoin ){ - ExprSetProperty(pEq, EP_FromJoin); - assert( !ExprHasProperty(pEq, EP_TokenOnly|EP_Reduced) ); - ExprSetVVAProperty(pEq, EP_NoReduce); - pEq->iRightJoinTable = (i16)pE2->iTable; - } - *ppWhere = sqlite3ExprAnd(db, *ppWhere, pEq); -} - -/* -** Set the EP_FromJoin property on all terms of the given expression. -** And set the Expr.iRightJoinTable to iTable for every term in the -** expression. -** -** The EP_FromJoin property is used on terms of an expression to tell -** the LEFT OUTER JOIN processing logic that this term is part of the -** join restriction specified in the ON or USING clause and not a part -** of the more general WHERE clause. These terms are moved over to the -** WHERE clause during join processing but we need to remember that they -** originated in the ON or USING clause. -** -** The Expr.iRightJoinTable tells the WHERE clause processing that the -** expression depends on table iRightJoinTable even if that table is not -** explicitly mentioned in the expression. That information is needed -** for cases like this: -** -** SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.b AND t1.x=5 -** -** The where clause needs to defer the handling of the t1.x=5 -** term until after the t2 loop of the join. In that way, a -** NULL t2 row will be inserted whenever t1.x!=5. If we do not -** defer the handling of t1.x=5, it will be processed immediately -** after the t1 loop and rows with t1.x!=5 will never appear in -** the output, which is incorrect. -*/ -static void setJoinExpr(Expr *p, int iTable){ - while( p ){ - ExprSetProperty(p, EP_FromJoin); - assert( !ExprHasProperty(p, EP_TokenOnly|EP_Reduced) ); - ExprSetVVAProperty(p, EP_NoReduce); - p->iRightJoinTable = (i16)iTable; - setJoinExpr(p->pLeft, iTable); - p = p->pRight; - } -} - -/* -** This routine processes the join information for a SELECT statement. -** ON and USING clauses are converted into extra terms of the WHERE clause. -** NATURAL joins also create extra WHERE clause terms. -** -** The terms of a FROM clause are contained in the Select.pSrc structure. -** The left most table is the first entry in Select.pSrc. The right-most -** table is the last entry. The join operator is held in the entry to -** the left. Thus entry 0 contains the join operator for the join between -** entries 0 and 1. Any ON or USING clauses associated with the join are -** also attached to the left entry. -** -** This routine returns the number of errors encountered. -*/ -static int sqliteProcessJoin(Parse *pParse, Select *p){ - SrcList *pSrc; /* All tables in the FROM clause */ - int i, j; /* Loop counters */ - struct SrcList_item *pLeft; /* Left table being joined */ - struct SrcList_item *pRight; /* Right table being joined */ - - pSrc = p->pSrc; - pLeft = &pSrc->a[0]; - pRight = &pLeft[1]; - for(i=0; inSrc-1; i++, pRight++, pLeft++){ - Table *pLeftTab = pLeft->pTab; - Table *pRightTab = pRight->pTab; - int isOuter; - - if( NEVER(pLeftTab==0 || pRightTab==0) ) continue; - isOuter = (pRight->jointype & JT_OUTER)!=0; - - /* When the NATURAL keyword is present, add WHERE clause terms for - ** every column that the two tables have in common. - */ - if( pRight->jointype & JT_NATURAL ){ - if( pRight->pOn || pRight->pUsing ){ - sqlite3ErrorMsg(pParse, "a NATURAL join may not have " - "an ON or USING clause", 0); - return 1; - } - for(j=0; jnCol; j++){ - char *zName; /* Name of column in the right table */ - int iLeft; /* Matching left table */ - int iLeftCol; /* Matching column in the left table */ - - zName = pRightTab->aCol[j].zName; - if( tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol) ){ - addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, j, - isOuter, &p->pWhere); - } - } - } - - /* Disallow both ON and USING clauses in the same join - */ - if( pRight->pOn && pRight->pUsing ){ - sqlite3ErrorMsg(pParse, "cannot have both ON and USING " - "clauses in the same join"); - return 1; - } - - /* Add the ON clause to the end of the WHERE clause, connected by - ** an AND operator. - */ - if( pRight->pOn ){ - if( isOuter ) setJoinExpr(pRight->pOn, pRight->iCursor); - p->pWhere = sqlite3ExprAnd(pParse->db, p->pWhere, pRight->pOn); - pRight->pOn = 0; - } - - /* Create extra terms on the WHERE clause for each column named - ** in the USING clause. Example: If the two tables to be joined are - ** A and B and the USING clause names X, Y, and Z, then add this - ** to the WHERE clause: A.X=B.X AND A.Y=B.Y AND A.Z=B.Z - ** Report an error if any column mentioned in the USING clause is - ** not contained in both tables to be joined. - */ - if( pRight->pUsing ){ - IdList *pList = pRight->pUsing; - for(j=0; jnId; j++){ - char *zName; /* Name of the term in the USING clause */ - int iLeft; /* Table on the left with matching column name */ - int iLeftCol; /* Column number of matching column on the left */ - int iRightCol; /* Column number of matching column on the right */ - - zName = pList->a[j].zName; - iRightCol = columnIndex(pRightTab, zName); - if( iRightCol<0 - || !tableAndColumnIndex(pSrc, i+1, zName, &iLeft, &iLeftCol) - ){ - sqlite3ErrorMsg(pParse, "cannot join using column %s - column " - "not present in both tables", zName); - return 1; - } - addWhereTerm(pParse, pSrc, iLeft, iLeftCol, i+1, iRightCol, - isOuter, &p->pWhere); - } - } - } - return 0; -} - -/* -** Insert code into "v" that will push the record on the top of the -** stack into the sorter. -*/ -static void pushOntoSorter( - Parse *pParse, /* Parser context */ - ExprList *pOrderBy, /* The ORDER BY clause */ - Select *pSelect, /* The whole SELECT statement */ - int regData /* Register holding data to be sorted */ -){ - Vdbe *v = pParse->pVdbe; - int nExpr = pOrderBy->nExpr; - int regBase = sqlite3GetTempRange(pParse, nExpr+2); - int regRecord = sqlite3GetTempReg(pParse); - int op; - sqlite3ExprCacheClear(pParse); - sqlite3ExprCodeExprList(pParse, pOrderBy, regBase, 0); - sqlite3VdbeAddOp2(v, OP_Sequence, pOrderBy->iECursor, regBase+nExpr); - sqlite3ExprCodeMove(pParse, regData, regBase+nExpr+1, 1); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nExpr + 2, regRecord); - if( pSelect->selFlags & SF_UseSorter ){ - op = OP_SorterInsert; - }else{ - op = OP_IdxInsert; - } - sqlite3VdbeAddOp2(v, op, pOrderBy->iECursor, regRecord); - sqlite3ReleaseTempReg(pParse, regRecord); - sqlite3ReleaseTempRange(pParse, regBase, nExpr+2); - if( pSelect->iLimit ){ - int addr1, addr2; - int iLimit; - if( pSelect->iOffset ){ - iLimit = pSelect->iOffset+1; - }else{ - iLimit = pSelect->iLimit; - } - addr1 = sqlite3VdbeAddOp1(v, OP_IfZero, iLimit); - sqlite3VdbeAddOp2(v, OP_AddImm, iLimit, -1); - addr2 = sqlite3VdbeAddOp0(v, OP_Goto); - sqlite3VdbeJumpHere(v, addr1); - sqlite3VdbeAddOp1(v, OP_Last, pOrderBy->iECursor); - sqlite3VdbeAddOp1(v, OP_Delete, pOrderBy->iECursor); - sqlite3VdbeJumpHere(v, addr2); - } -} - -/* -** Add code to implement the OFFSET -*/ -static void codeOffset( - Vdbe *v, /* Generate code into this VM */ - int iOffset, /* Register holding the offset counter */ - int iContinue /* Jump here to skip the current record */ -){ - if( iOffset>0 && iContinue!=0 ){ - int addr; - sqlite3VdbeAddOp2(v, OP_AddImm, iOffset, -1); - addr = sqlite3VdbeAddOp1(v, OP_IfNeg, iOffset); - sqlite3VdbeAddOp2(v, OP_Goto, 0, iContinue); - VdbeComment((v, "skip OFFSET records")); - sqlite3VdbeJumpHere(v, addr); - } -} - -/* -** Add code that will check to make sure the N registers starting at iMem -** form a distinct entry. iTab is a sorting index that holds previously -** seen combinations of the N values. A new entry is made in iTab -** if the current N values are new. -** -** A jump to addrRepeat is made and the N+1 values are popped from the -** stack if the top N elements are not distinct. -*/ -static void codeDistinct( - Parse *pParse, /* Parsing and code generating context */ - int iTab, /* A sorting index used to test for distinctness */ - int addrRepeat, /* Jump to here if not distinct */ - int N, /* Number of elements */ - int iMem /* First element */ -){ - Vdbe *v; - int r1; - - v = pParse->pVdbe; - r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp4Int(v, OP_Found, iTab, addrRepeat, iMem, N); - sqlite3VdbeAddOp3(v, OP_MakeRecord, iMem, N, r1); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iTab, r1); - sqlite3ReleaseTempReg(pParse, r1); -} - -#ifndef SQLITE_OMIT_SUBQUERY -/* -** Generate an error message when a SELECT is used within a subexpression -** (example: "a IN (SELECT * FROM table)") but it has more than 1 result -** column. We do this in a subroutine because the error used to occur -** in multiple places. (The error only occurs in one place now, but we -** retain the subroutine to minimize code disruption.) -*/ -static int checkForMultiColumnSelectError( - Parse *pParse, /* Parse context. */ - SelectDest *pDest, /* Destination of SELECT results */ - int nExpr /* Number of result columns returned by SELECT */ -){ - int eDest = pDest->eDest; - if( nExpr>1 && (eDest==SRT_Mem || eDest==SRT_Set) ){ - sqlite3ErrorMsg(pParse, "only a single result allowed for " - "a SELECT that is part of an expression"); - return 1; - }else{ - return 0; - } -} -#endif - -/* -** An instance of the following object is used to record information about -** how to process the DISTINCT keyword, to simplify passing that information -** into the selectInnerLoop() routine. -*/ -typedef struct DistinctCtx DistinctCtx; -struct DistinctCtx { - u8 isTnct; /* True if the DISTINCT keyword is present */ - u8 eTnctType; /* One of the WHERE_DISTINCT_* operators */ - int tabTnct; /* Ephemeral table used for DISTINCT processing */ - int addrTnct; /* Address of OP_OpenEphemeral opcode for tabTnct */ -}; - -/* -** This routine generates the code for the inside of the inner loop -** of a SELECT. -** -** If srcTab is negative, then the pEList expressions -** are evaluated in order to get the data for this row. If srcTab is -** zero or more, then data is pulled from srcTab and pEList is used only -** to get number columns and the datatype for each column. -*/ -static void selectInnerLoop( - Parse *pParse, /* The parser context */ - Select *p, /* The complete select statement being coded */ - ExprList *pEList, /* List of values being extracted */ - int srcTab, /* Pull data from this table */ - ExprList *pOrderBy, /* If not NULL, sort results using this key */ - DistinctCtx *pDistinct, /* If not NULL, info on how to process DISTINCT */ - SelectDest *pDest, /* How to dispose of the results */ - int iContinue, /* Jump here to continue with next row */ - int iBreak /* Jump here to break out of the inner loop */ -){ - Vdbe *v = pParse->pVdbe; - int i; - int hasDistinct; /* True if the DISTINCT keyword is present */ - int regResult; /* Start of memory holding result set */ - int eDest = pDest->eDest; /* How to dispose of results */ - int iParm = pDest->iSDParm; /* First argument to disposal method */ - int nResultCol; /* Number of result columns */ - - assert( v ); - assert( pEList!=0 ); - hasDistinct = pDistinct ? pDistinct->eTnctType : WHERE_DISTINCT_NOOP; - if( pOrderBy==0 && !hasDistinct ){ - codeOffset(v, p->iOffset, iContinue); - } - - /* Pull the requested columns. - */ - nResultCol = pEList->nExpr; - if( pDest->iSdst==0 ){ - pDest->iSdst = pParse->nMem+1; - pDest->nSdst = nResultCol; - pParse->nMem += nResultCol; - }else{ - assert( pDest->nSdst==nResultCol ); - } - regResult = pDest->iSdst; - if( srcTab>=0 ){ - for(i=0; ia[i].zName)); - } - }else if( eDest!=SRT_Exists ){ - /* If the destination is an EXISTS(...) expression, the actual - ** values returned by the SELECT are not required. - */ - sqlite3ExprCodeExprList(pParse, pEList, regResult, - (eDest==SRT_Output)?SQLITE_ECEL_DUP:0); - } - - /* If the DISTINCT keyword was present on the SELECT statement - ** and this row has been seen before, then do not make this row - ** part of the result. - */ - if( hasDistinct ){ - switch( pDistinct->eTnctType ){ - case WHERE_DISTINCT_ORDERED: { - VdbeOp *pOp; /* No longer required OpenEphemeral instr. */ - int iJump; /* Jump destination */ - int regPrev; /* Previous row content */ - - /* Allocate space for the previous row */ - regPrev = pParse->nMem+1; - pParse->nMem += nResultCol; - - /* Change the OP_OpenEphemeral coded earlier to an OP_Null - ** sets the MEM_Cleared bit on the first register of the - ** previous value. This will cause the OP_Ne below to always - ** fail on the first iteration of the loop even if the first - ** row is all NULLs. - */ - sqlite3VdbeChangeToNoop(v, pDistinct->addrTnct); - pOp = sqlite3VdbeGetOp(v, pDistinct->addrTnct); - pOp->opcode = OP_Null; - pOp->p1 = 1; - pOp->p2 = regPrev; - - iJump = sqlite3VdbeCurrentAddr(v) + nResultCol; - for(i=0; ia[i].pExpr); - if( iaddrTnct); - break; - } - - default: { - assert( pDistinct->eTnctType==WHERE_DISTINCT_UNORDERED ); - codeDistinct(pParse, pDistinct->tabTnct, iContinue, nResultCol, regResult); - break; - } - } - if( pOrderBy==0 ){ - codeOffset(v, p->iOffset, iContinue); - } - } - - switch( eDest ){ - /* In this mode, write each query result to the key of the temporary - ** table iParm. - */ -#ifndef SQLITE_OMIT_COMPOUND_SELECT - case SRT_Union: { - int r1; - r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1); - sqlite3ReleaseTempReg(pParse, r1); - break; - } - - /* Construct a record from the query result, but instead of - ** saving that record, use it as a key to delete elements from - ** the temporary table iParm. - */ - case SRT_Except: { - sqlite3VdbeAddOp3(v, OP_IdxDelete, iParm, regResult, nResultCol); - break; - } -#endif /* SQLITE_OMIT_COMPOUND_SELECT */ - - /* Store the result as data using a unique key. - */ - case SRT_DistTable: - case SRT_Table: - case SRT_EphemTab: { - int r1 = sqlite3GetTempReg(pParse); - testcase( eDest==SRT_Table ); - testcase( eDest==SRT_EphemTab ); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1); -#ifndef SQLITE_OMIT_CTE - if( eDest==SRT_DistTable ){ - /* If the destination is DistTable, then cursor (iParm+1) is open - ** on an ephemeral index. If the current row is already present - ** in the index, do not write it to the output. If not, add the - ** current row to the index and proceed with writing it to the - ** output table as well. */ - int addr = sqlite3VdbeCurrentAddr(v) + 4; - sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, addr, r1, 0); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm+1, r1); - assert( pOrderBy==0 ); - } -#endif - if( pOrderBy ){ - pushOntoSorter(pParse, pOrderBy, p, r1); - }else{ - int r2 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, r2); - sqlite3VdbeAddOp3(v, OP_Insert, iParm, r1, r2); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - sqlite3ReleaseTempReg(pParse, r2); - } - sqlite3ReleaseTempReg(pParse, r1); - break; - } - -#ifndef SQLITE_OMIT_SUBQUERY - /* If we are creating a set for an "expr IN (SELECT ...)" construct, - ** then there should be a single item on the stack. Write this - ** item into the set table with bogus data. - */ - case SRT_Set: { - assert( nResultCol==1 ); - pDest->affSdst = - sqlite3CompareAffinity(pEList->a[0].pExpr, pDest->affSdst); - if( pOrderBy ){ - /* At first glance you would think we could optimize out the - ** ORDER BY in this case since the order of entries in the set - ** does not matter. But there might be a LIMIT clause, in which - ** case the order does matter */ - pushOntoSorter(pParse, pOrderBy, p, regResult); - }else{ - int r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp4(v, OP_MakeRecord, regResult,1,r1, &pDest->affSdst, 1); - sqlite3ExprCacheAffinityChange(pParse, regResult, 1); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1); - sqlite3ReleaseTempReg(pParse, r1); - } - break; - } - - /* If any row exist in the result set, record that fact and abort. - */ - case SRT_Exists: { - sqlite3VdbeAddOp2(v, OP_Integer, 1, iParm); - /* The LIMIT clause will terminate the loop for us */ - break; - } - - /* If this is a scalar select that is part of an expression, then - ** store the results in the appropriate memory cell and break out - ** of the scan loop. - */ - case SRT_Mem: { - assert( nResultCol==1 ); - if( pOrderBy ){ - pushOntoSorter(pParse, pOrderBy, p, regResult); - }else{ - sqlite3ExprCodeMove(pParse, regResult, iParm, 1); - /* The LIMIT clause will jump out of the loop for us */ - } - break; - } -#endif /* #ifndef SQLITE_OMIT_SUBQUERY */ - - /* Send the data to the callback function or to a subroutine. In the - ** case of a subroutine, the subroutine itself is responsible for - ** popping the data from the stack. - */ - case SRT_Coroutine: - case SRT_Output: { - testcase( eDest==SRT_Coroutine ); - testcase( eDest==SRT_Output ); - if( pOrderBy ){ - int r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r1); - pushOntoSorter(pParse, pOrderBy, p, r1); - sqlite3ReleaseTempReg(pParse, r1); - }else if( eDest==SRT_Coroutine ){ - sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); - }else{ - sqlite3VdbeAddOp2(v, OP_ResultRow, regResult, nResultCol); - sqlite3ExprCacheAffinityChange(pParse, regResult, nResultCol); - } - break; - } - -#ifndef SQLITE_OMIT_CTE - /* Write the results into a priority queue that is order according to - ** pDest->pOrderBy (in pSO). pDest->iSDParm (in iParm) is the cursor for an - ** index with pSO->nExpr+2 columns. Build a key using pSO for the first - ** pSO->nExpr columns, then make sure all keys are unique by adding a - ** final OP_Sequence column. The last column is the record as a blob. - */ - case SRT_DistQueue: - case SRT_Queue: { - int nKey; - int r1, r2, r3; - int addrTest = 0; - ExprList *pSO; - pSO = pDest->pOrderBy; - assert( pSO ); - nKey = pSO->nExpr; - r1 = sqlite3GetTempReg(pParse); - r2 = sqlite3GetTempRange(pParse, nKey+2); - r3 = r2+nKey+1; - sqlite3VdbeAddOp3(v, OP_MakeRecord, regResult, nResultCol, r3); - if( eDest==SRT_DistQueue ){ - /* If the destination is DistQueue, then cursor (iParm+1) is open - ** on a second ephemeral index that holds all values every previously - ** added to the queue. Only add this new value if it has never before - ** been added */ - addrTest = sqlite3VdbeAddOp4Int(v, OP_Found, iParm+1, 0, r3, 0); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm+1, r3); - sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); - } - for(i=0; ia[i].u.x.iOrderByCol - 1, - r2+i); - } - sqlite3VdbeAddOp2(v, OP_Sequence, iParm, r2+nKey); - sqlite3VdbeAddOp3(v, OP_MakeRecord, r2, nKey+2, r1); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, r1); - if( addrTest ) sqlite3VdbeJumpHere(v, addrTest); - sqlite3ReleaseTempReg(pParse, r1); - sqlite3ReleaseTempRange(pParse, r2, nKey+2); - break; - } -#endif /* SQLITE_OMIT_CTE */ - - - -#if !defined(SQLITE_OMIT_TRIGGER) - /* Discard the results. This is used for SELECT statements inside - ** the body of a TRIGGER. The purpose of such selects is to call - ** user-defined functions that have side effects. We do not care - ** about the actual results of the select. - */ - default: { - assert( eDest==SRT_Discard ); - break; - } -#endif - } - - /* Jump to the end of the loop if the LIMIT is reached. Except, if - ** there is a sorter, in which case the sorter has already limited - ** the output for us. - */ - if( pOrderBy==0 && p->iLimit ){ - sqlite3VdbeAddOp3(v, OP_IfZero, p->iLimit, iBreak, -1); - } -} - -/* -** Allocate a KeyInfo object sufficient for an index of N key columns and -** X extra columns. -*/ -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoAlloc(sqlite3 *db, int N, int X){ - KeyInfo *p = sqlite3DbMallocZero(0, - sizeof(KeyInfo) + (N+X)*(sizeof(CollSeq*)+1)); - if( p ){ - p->aSortOrder = (u8*)&p->aColl[N+X]; - p->nField = (u16)N; - p->nXField = (u16)X; - p->enc = ENC(db); - p->db = db; - p->nRef = 1; - }else{ - db->mallocFailed = 1; - } - return p; -} - -/* -** Deallocate a KeyInfo object -*/ -SQLITE_PRIVATE void sqlite3KeyInfoUnref(KeyInfo *p){ - if( p ){ - assert( p->nRef>0 ); - p->nRef--; - if( p->nRef==0 ) sqlite3DbFree(0, p); - } -} - -/* -** Make a new pointer to a KeyInfo object -*/ -SQLITE_PRIVATE KeyInfo *sqlite3KeyInfoRef(KeyInfo *p){ - if( p ){ - assert( p->nRef>0 ); - p->nRef++; - } - return p; -} - -#ifdef SQLITE_DEBUG -/* -** Return TRUE if a KeyInfo object can be change. The KeyInfo object -** can only be changed if this is just a single reference to the object. -** -** This routine is used only inside of assert() statements. -*/ -SQLITE_PRIVATE int sqlite3KeyInfoIsWriteable(KeyInfo *p){ return p->nRef==1; } -#endif /* SQLITE_DEBUG */ - -/* -** Given an expression list, generate a KeyInfo structure that records -** the collating sequence for each expression in that expression list. -** -** If the ExprList is an ORDER BY or GROUP BY clause then the resulting -** KeyInfo structure is appropriate for initializing a virtual index to -** implement that clause. If the ExprList is the result set of a SELECT -** then the KeyInfo structure is appropriate for initializing a virtual -** index to implement a DISTINCT test. -** -** Space to hold the KeyInfo structure is obtain from malloc. The calling -** function is responsible for seeing that this structure is eventually -** freed. -*/ -static KeyInfo *keyInfoFromExprList(Parse *pParse, ExprList *pList, int nExtra){ - int nExpr; - KeyInfo *pInfo; - struct ExprList_item *pItem; - sqlite3 *db = pParse->db; - int i; - - nExpr = pList->nExpr; - pInfo = sqlite3KeyInfoAlloc(db, nExpr+nExtra, 1); - if( pInfo ){ - assert( sqlite3KeyInfoIsWriteable(pInfo) ); - for(i=0, pItem=pList->a; ipExpr); - if( !pColl ) pColl = db->pDfltColl; - pInfo->aColl[i] = pColl; - pInfo->aSortOrder[i] = pItem->sortOrder; - } - } - return pInfo; -} - -#ifndef SQLITE_OMIT_COMPOUND_SELECT -/* -** Name of the connection operator, used for error messages. -*/ -static const char *selectOpName(int id){ - char *z; - switch( id ){ - case TK_ALL: z = "UNION ALL"; break; - case TK_INTERSECT: z = "INTERSECT"; break; - case TK_EXCEPT: z = "EXCEPT"; break; - default: z = "UNION"; break; - } - return z; -} -#endif /* SQLITE_OMIT_COMPOUND_SELECT */ - -#ifndef SQLITE_OMIT_EXPLAIN -/* -** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function -** is a no-op. Otherwise, it adds a single row of output to the EQP result, -** where the caption is of the form: -** -** "USE TEMP B-TREE FOR xxx" -** -** where xxx is one of "DISTINCT", "ORDER BY" or "GROUP BY". Exactly which -** is determined by the zUsage argument. -*/ -static void explainTempTable(Parse *pParse, const char *zUsage){ - if( pParse->explain==2 ){ - Vdbe *v = pParse->pVdbe; - char *zMsg = sqlite3MPrintf(pParse->db, "USE TEMP B-TREE FOR %s", zUsage); - sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC); - } -} - -/* -** Assign expression b to lvalue a. A second, no-op, version of this macro -** is provided when SQLITE_OMIT_EXPLAIN is defined. This allows the code -** in sqlite3Select() to assign values to structure member variables that -** only exist if SQLITE_OMIT_EXPLAIN is not defined without polluting the -** code with #ifndef directives. -*/ -# define explainSetInteger(a, b) a = b - -#else -/* No-op versions of the explainXXX() functions and macros. */ -# define explainTempTable(y,z) -# define explainSetInteger(y,z) -#endif - -#if !defined(SQLITE_OMIT_EXPLAIN) && !defined(SQLITE_OMIT_COMPOUND_SELECT) -/* -** Unless an "EXPLAIN QUERY PLAN" command is being processed, this function -** is a no-op. Otherwise, it adds a single row of output to the EQP result, -** where the caption is of one of the two forms: -** -** "COMPOSITE SUBQUERIES iSub1 and iSub2 (op)" -** "COMPOSITE SUBQUERIES iSub1 and iSub2 USING TEMP B-TREE (op)" -** -** where iSub1 and iSub2 are the integers passed as the corresponding -** function parameters, and op is the text representation of the parameter -** of the same name. The parameter "op" must be one of TK_UNION, TK_EXCEPT, -** TK_INTERSECT or TK_ALL. The first form is used if argument bUseTmp is -** false, or the second form if it is true. -*/ -static void explainComposite( - Parse *pParse, /* Parse context */ - int op, /* One of TK_UNION, TK_EXCEPT etc. */ - int iSub1, /* Subquery id 1 */ - int iSub2, /* Subquery id 2 */ - int bUseTmp /* True if a temp table was used */ -){ - assert( op==TK_UNION || op==TK_EXCEPT || op==TK_INTERSECT || op==TK_ALL ); - if( pParse->explain==2 ){ - Vdbe *v = pParse->pVdbe; - char *zMsg = sqlite3MPrintf( - pParse->db, "COMPOUND SUBQUERIES %d AND %d %s(%s)", iSub1, iSub2, - bUseTmp?"USING TEMP B-TREE ":"", selectOpName(op) - ); - sqlite3VdbeAddOp4(v, OP_Explain, pParse->iSelectId, 0, 0, zMsg, P4_DYNAMIC); - } -} -#else -/* No-op versions of the explainXXX() functions and macros. */ -# define explainComposite(v,w,x,y,z) -#endif - -/* -** If the inner loop was generated using a non-null pOrderBy argument, -** then the results were placed in a sorter. After the loop is terminated -** we need to run the sorter and output the results. The following -** routine generates the code needed to do that. -*/ -static void generateSortTail( - Parse *pParse, /* Parsing context */ - Select *p, /* The SELECT statement */ - Vdbe *v, /* Generate code into this VDBE */ - int nColumn, /* Number of columns of data */ - SelectDest *pDest /* Write the sorted results here */ -){ - int addrBreak = sqlite3VdbeMakeLabel(v); /* Jump here to exit loop */ - int addrContinue = sqlite3VdbeMakeLabel(v); /* Jump here for next cycle */ - int addr; - int iTab; - int pseudoTab = 0; - ExprList *pOrderBy = p->pOrderBy; - - int eDest = pDest->eDest; - int iParm = pDest->iSDParm; - - int regRow; - int regRowid; - - iTab = pOrderBy->iECursor; - regRow = sqlite3GetTempReg(pParse); - if( eDest==SRT_Output || eDest==SRT_Coroutine ){ - pseudoTab = pParse->nTab++; - sqlite3VdbeAddOp3(v, OP_OpenPseudo, pseudoTab, regRow, nColumn); - regRowid = 0; - }else{ - regRowid = sqlite3GetTempReg(pParse); - } - if( p->selFlags & SF_UseSorter ){ - int regSortOut = ++pParse->nMem; - int ptab2 = pParse->nTab++; - sqlite3VdbeAddOp3(v, OP_OpenPseudo, ptab2, regSortOut, pOrderBy->nExpr+2); - addr = 1 + sqlite3VdbeAddOp2(v, OP_SorterSort, iTab, addrBreak); - codeOffset(v, p->iOffset, addrContinue); - sqlite3VdbeAddOp2(v, OP_SorterData, iTab, regSortOut); - sqlite3VdbeAddOp3(v, OP_Column, ptab2, pOrderBy->nExpr+1, regRow); - sqlite3VdbeChangeP5(v, OPFLAG_CLEARCACHE); - }else{ - addr = 1 + sqlite3VdbeAddOp2(v, OP_Sort, iTab, addrBreak); - codeOffset(v, p->iOffset, addrContinue); - sqlite3VdbeAddOp3(v, OP_Column, iTab, pOrderBy->nExpr+1, regRow); - } - switch( eDest ){ - case SRT_Table: - case SRT_EphemTab: { - testcase( eDest==SRT_Table ); - testcase( eDest==SRT_EphemTab ); - sqlite3VdbeAddOp2(v, OP_NewRowid, iParm, regRowid); - sqlite3VdbeAddOp3(v, OP_Insert, iParm, regRow, regRowid); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - break; - } -#ifndef SQLITE_OMIT_SUBQUERY - case SRT_Set: { - assert( nColumn==1 ); - sqlite3VdbeAddOp4(v, OP_MakeRecord, regRow, 1, regRowid, - &pDest->affSdst, 1); - sqlite3ExprCacheAffinityChange(pParse, regRow, 1); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iParm, regRowid); - break; - } - case SRT_Mem: { - assert( nColumn==1 ); - sqlite3ExprCodeMove(pParse, regRow, iParm, 1); - /* The LIMIT clause will terminate the loop for us */ - break; - } -#endif - default: { - int i; - assert( eDest==SRT_Output || eDest==SRT_Coroutine ); - testcase( eDest==SRT_Output ); - testcase( eDest==SRT_Coroutine ); - for(i=0; iiSdst+i ); - sqlite3VdbeAddOp3(v, OP_Column, pseudoTab, i, pDest->iSdst+i); - if( i==0 ){ - sqlite3VdbeChangeP5(v, OPFLAG_CLEARCACHE); - } - } - if( eDest==SRT_Output ){ - sqlite3VdbeAddOp2(v, OP_ResultRow, pDest->iSdst, nColumn); - sqlite3ExprCacheAffinityChange(pParse, pDest->iSdst, nColumn); - }else{ - sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); - } - break; - } - } - sqlite3ReleaseTempReg(pParse, regRow); - sqlite3ReleaseTempReg(pParse, regRowid); - - /* The bottom of the loop - */ - sqlite3VdbeResolveLabel(v, addrContinue); - if( p->selFlags & SF_UseSorter ){ - sqlite3VdbeAddOp2(v, OP_SorterNext, iTab, addr); - }else{ - sqlite3VdbeAddOp2(v, OP_Next, iTab, addr); - } - sqlite3VdbeResolveLabel(v, addrBreak); - if( eDest==SRT_Output || eDest==SRT_Coroutine ){ - sqlite3VdbeAddOp2(v, OP_Close, pseudoTab, 0); - } -} - -/* -** Return a pointer to a string containing the 'declaration type' of the -** expression pExpr. The string may be treated as static by the caller. -** -** Also try to estimate the size of the returned value and return that -** result in *pEstWidth. -** -** The declaration type is the exact datatype definition extracted from the -** original CREATE TABLE statement if the expression is a column. The -** declaration type for a ROWID field is INTEGER. Exactly when an expression -** is considered a column can be complex in the presence of subqueries. The -** result-set expression in all of the following SELECT statements is -** considered a column by this function. -** -** SELECT col FROM tbl; -** SELECT (SELECT col FROM tbl; -** SELECT (SELECT col FROM tbl); -** SELECT abc FROM (SELECT col AS abc FROM tbl); -** -** The declaration type for any expression other than a column is NULL. -** -** This routine has either 3 or 6 parameters depending on whether or not -** the SQLITE_ENABLE_COLUMN_METADATA compile-time option is used. -*/ -#ifdef SQLITE_ENABLE_COLUMN_METADATA -# define columnType(A,B,C,D,E,F) columnTypeImpl(A,B,C,D,E,F) -static const char *columnTypeImpl( - NameContext *pNC, - Expr *pExpr, - const char **pzOrigDb, - const char **pzOrigTab, - const char **pzOrigCol, - u8 *pEstWidth -){ - char const *zOrigDb = 0; - char const *zOrigTab = 0; - char const *zOrigCol = 0; -#else /* if !defined(SQLITE_ENABLE_COLUMN_METADATA) */ -# define columnType(A,B,C,D,E,F) columnTypeImpl(A,B,F) -static const char *columnTypeImpl( - NameContext *pNC, - Expr *pExpr, - u8 *pEstWidth -){ -#endif /* !defined(SQLITE_ENABLE_COLUMN_METADATA) */ - char const *zType = 0; - int j; - u8 estWidth = 1; - - if( NEVER(pExpr==0) || pNC->pSrcList==0 ) return 0; - switch( pExpr->op ){ - case TK_AGG_COLUMN: - case TK_COLUMN: { - /* The expression is a column. Locate the table the column is being - ** extracted from in NameContext.pSrcList. This table may be real - ** database table or a subquery. - */ - Table *pTab = 0; /* Table structure column is extracted from */ - Select *pS = 0; /* Select the column is extracted from */ - int iCol = pExpr->iColumn; /* Index of column in pTab */ - testcase( pExpr->op==TK_AGG_COLUMN ); - testcase( pExpr->op==TK_COLUMN ); - while( pNC && !pTab ){ - SrcList *pTabList = pNC->pSrcList; - for(j=0;jnSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++); - if( jnSrc ){ - pTab = pTabList->a[j].pTab; - pS = pTabList->a[j].pSelect; - }else{ - pNC = pNC->pNext; - } - } - - if( pTab==0 ){ - /* At one time, code such as "SELECT new.x" within a trigger would - ** cause this condition to run. Since then, we have restructured how - ** trigger code is generated and so this condition is no longer - ** possible. However, it can still be true for statements like - ** the following: - ** - ** CREATE TABLE t1(col INTEGER); - ** SELECT (SELECT t1.col) FROM FROM t1; - ** - ** when columnType() is called on the expression "t1.col" in the - ** sub-select. In this case, set the column type to NULL, even - ** though it should really be "INTEGER". - ** - ** This is not a problem, as the column type of "t1.col" is never - ** used. When columnType() is called on the expression - ** "(SELECT t1.col)", the correct type is returned (see the TK_SELECT - ** branch below. */ - break; - } - - assert( pTab && pExpr->pTab==pTab ); - if( pS ){ - /* The "table" is actually a sub-select or a view in the FROM clause - ** of the SELECT statement. Return the declaration type and origin - ** data for the result-set column of the sub-select. - */ - if( iCol>=0 && ALWAYS(iColpEList->nExpr) ){ - /* If iCol is less than zero, then the expression requests the - ** rowid of the sub-select or view. This expression is legal (see - ** test case misc2.2.2) - it always evaluates to NULL. - */ - NameContext sNC; - Expr *p = pS->pEList->a[iCol].pExpr; - sNC.pSrcList = pS->pSrc; - sNC.pNext = pNC; - sNC.pParse = pNC->pParse; - zType = columnType(&sNC, p,&zOrigDb,&zOrigTab,&zOrigCol, &estWidth); - } - }else if( pTab->pSchema ){ - /* A real table */ - assert( !pS ); - if( iCol<0 ) iCol = pTab->iPKey; - assert( iCol==-1 || (iCol>=0 && iColnCol) ); -#ifdef SQLITE_ENABLE_COLUMN_METADATA - if( iCol<0 ){ - zType = "INTEGER"; - zOrigCol = "rowid"; - }else{ - zType = pTab->aCol[iCol].zType; - zOrigCol = pTab->aCol[iCol].zName; - estWidth = pTab->aCol[iCol].szEst; - } - zOrigTab = pTab->zName; - if( pNC->pParse ){ - int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema); - zOrigDb = pNC->pParse->db->aDb[iDb].zName; - } -#else - if( iCol<0 ){ - zType = "INTEGER"; - }else{ - zType = pTab->aCol[iCol].zType; - estWidth = pTab->aCol[iCol].szEst; - } -#endif - } - break; - } -#ifndef SQLITE_OMIT_SUBQUERY - case TK_SELECT: { - /* The expression is a sub-select. Return the declaration type and - ** origin info for the single column in the result set of the SELECT - ** statement. - */ - NameContext sNC; - Select *pS = pExpr->x.pSelect; - Expr *p = pS->pEList->a[0].pExpr; - assert( ExprHasProperty(pExpr, EP_xIsSelect) ); - sNC.pSrcList = pS->pSrc; - sNC.pNext = pNC; - sNC.pParse = pNC->pParse; - zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol, &estWidth); - break; - } -#endif - } - -#ifdef SQLITE_ENABLE_COLUMN_METADATA - if( pzOrigDb ){ - assert( pzOrigTab && pzOrigCol ); - *pzOrigDb = zOrigDb; - *pzOrigTab = zOrigTab; - *pzOrigCol = zOrigCol; - } -#endif - if( pEstWidth ) *pEstWidth = estWidth; - return zType; -} - -/* -** Generate code that will tell the VDBE the declaration types of columns -** in the result set. -*/ -static void generateColumnTypes( - Parse *pParse, /* Parser context */ - SrcList *pTabList, /* List of tables */ - ExprList *pEList /* Expressions defining the result set */ -){ -#ifndef SQLITE_OMIT_DECLTYPE - Vdbe *v = pParse->pVdbe; - int i; - NameContext sNC; - sNC.pSrcList = pTabList; - sNC.pParse = pParse; - for(i=0; inExpr; i++){ - Expr *p = pEList->a[i].pExpr; - const char *zType; -#ifdef SQLITE_ENABLE_COLUMN_METADATA - const char *zOrigDb = 0; - const char *zOrigTab = 0; - const char *zOrigCol = 0; - zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol, 0); - - /* The vdbe must make its own copy of the column-type and other - ** column specific strings, in case the schema is reset before this - ** virtual machine is deleted. - */ - sqlite3VdbeSetColName(v, i, COLNAME_DATABASE, zOrigDb, SQLITE_TRANSIENT); - sqlite3VdbeSetColName(v, i, COLNAME_TABLE, zOrigTab, SQLITE_TRANSIENT); - sqlite3VdbeSetColName(v, i, COLNAME_COLUMN, zOrigCol, SQLITE_TRANSIENT); -#else - zType = columnType(&sNC, p, 0, 0, 0, 0); -#endif - sqlite3VdbeSetColName(v, i, COLNAME_DECLTYPE, zType, SQLITE_TRANSIENT); - } -#endif /* !defined(SQLITE_OMIT_DECLTYPE) */ -} - -/* -** Generate code that will tell the VDBE the names of columns -** in the result set. This information is used to provide the -** azCol[] values in the callback. -*/ -static void generateColumnNames( - Parse *pParse, /* Parser context */ - SrcList *pTabList, /* List of tables */ - ExprList *pEList /* Expressions defining the result set */ -){ - Vdbe *v = pParse->pVdbe; - int i, j; - sqlite3 *db = pParse->db; - int fullNames, shortNames; - -#ifndef SQLITE_OMIT_EXPLAIN - /* If this is an EXPLAIN, skip this step */ - if( pParse->explain ){ - return; - } -#endif - - if( pParse->colNamesSet || NEVER(v==0) || db->mallocFailed ) return; - pParse->colNamesSet = 1; - fullNames = (db->flags & SQLITE_FullColNames)!=0; - shortNames = (db->flags & SQLITE_ShortColNames)!=0; - sqlite3VdbeSetNumCols(v, pEList->nExpr); - for(i=0; inExpr; i++){ - Expr *p; - p = pEList->a[i].pExpr; - if( NEVER(p==0) ) continue; - if( pEList->a[i].zName ){ - char *zName = pEList->a[i].zName; - sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_TRANSIENT); - }else if( (p->op==TK_COLUMN || p->op==TK_AGG_COLUMN) && pTabList ){ - Table *pTab; - char *zCol; - int iCol = p->iColumn; - for(j=0; ALWAYS(jnSrc); j++){ - if( pTabList->a[j].iCursor==p->iTable ) break; - } - assert( jnSrc ); - pTab = pTabList->a[j].pTab; - if( iCol<0 ) iCol = pTab->iPKey; - assert( iCol==-1 || (iCol>=0 && iColnCol) ); - if( iCol<0 ){ - zCol = "rowid"; - }else{ - zCol = pTab->aCol[iCol].zName; - } - if( !shortNames && !fullNames ){ - sqlite3VdbeSetColName(v, i, COLNAME_NAME, - sqlite3DbStrDup(db, pEList->a[i].zSpan), SQLITE_DYNAMIC); - }else if( fullNames ){ - char *zName = 0; - zName = sqlite3MPrintf(db, "%s.%s", pTab->zName, zCol); - sqlite3VdbeSetColName(v, i, COLNAME_NAME, zName, SQLITE_DYNAMIC); - }else{ - sqlite3VdbeSetColName(v, i, COLNAME_NAME, zCol, SQLITE_TRANSIENT); - } - }else{ - const char *z = pEList->a[i].zSpan; - z = z==0 ? sqlite3MPrintf(db, "column%d", i+1) : sqlite3DbStrDup(db, z); - sqlite3VdbeSetColName(v, i, COLNAME_NAME, z, SQLITE_DYNAMIC); - } - } - generateColumnTypes(pParse, pTabList, pEList); -} - -/* -** Given a an expression list (which is really the list of expressions -** that form the result set of a SELECT statement) compute appropriate -** column names for a table that would hold the expression list. -** -** All column names will be unique. -** -** Only the column names are computed. Column.zType, Column.zColl, -** and other fields of Column are zeroed. -** -** Return SQLITE_OK on success. If a memory allocation error occurs, -** store NULL in *paCol and 0 in *pnCol and return SQLITE_NOMEM. -*/ -static int selectColumnsFromExprList( - Parse *pParse, /* Parsing context */ - ExprList *pEList, /* Expr list from which to derive column names */ - i16 *pnCol, /* Write the number of columns here */ - Column **paCol /* Write the new column list here */ -){ - sqlite3 *db = pParse->db; /* Database connection */ - int i, j; /* Loop counters */ - int cnt; /* Index added to make the name unique */ - Column *aCol, *pCol; /* For looping over result columns */ - int nCol; /* Number of columns in the result set */ - Expr *p; /* Expression for a single result column */ - char *zName; /* Column name */ - int nName; /* Size of name in zName[] */ - - if( pEList ){ - nCol = pEList->nExpr; - aCol = sqlite3DbMallocZero(db, sizeof(aCol[0])*nCol); - testcase( aCol==0 ); - }else{ - nCol = 0; - aCol = 0; - } - *pnCol = nCol; - *paCol = aCol; - - for(i=0, pCol=aCol; ia[i].pExpr); - if( (zName = pEList->a[i].zName)!=0 ){ - /* If the column contains an "AS " phrase, use as the name */ - zName = sqlite3DbStrDup(db, zName); - }else{ - Expr *pColExpr = p; /* The expression that is the result column name */ - Table *pTab; /* Table associated with this expression */ - while( pColExpr->op==TK_DOT ){ - pColExpr = pColExpr->pRight; - assert( pColExpr!=0 ); - } - if( pColExpr->op==TK_COLUMN && ALWAYS(pColExpr->pTab!=0) ){ - /* For columns use the column name name */ - int iCol = pColExpr->iColumn; - pTab = pColExpr->pTab; - if( iCol<0 ) iCol = pTab->iPKey; - zName = sqlite3MPrintf(db, "%s", - iCol>=0 ? pTab->aCol[iCol].zName : "rowid"); - }else if( pColExpr->op==TK_ID ){ - assert( !ExprHasProperty(pColExpr, EP_IntValue) ); - zName = sqlite3MPrintf(db, "%s", pColExpr->u.zToken); - }else{ - /* Use the original text of the column expression as its name */ - zName = sqlite3MPrintf(db, "%s", pEList->a[i].zSpan); - } - } - if( db->mallocFailed ){ - sqlite3DbFree(db, zName); - break; - } - - /* Make sure the column name is unique. If the name is not unique, - ** append a integer to the name so that it becomes unique. - */ - nName = sqlite3Strlen30(zName); - for(j=cnt=0; j1 && sqlite3Isdigit(zName[k]); k--){} - if( zName[k]==':' ) nName = k; - zName[nName] = 0; - zNewName = sqlite3MPrintf(db, "%s:%d", zName, ++cnt); - sqlite3DbFree(db, zName); - zName = zNewName; - j = -1; - if( zName==0 ) break; - } - } - pCol->zName = zName; - } - if( db->mallocFailed ){ - for(j=0; jdb; - NameContext sNC; - Column *pCol; - CollSeq *pColl; - int i; - Expr *p; - struct ExprList_item *a; - u64 szAll = 0; - - assert( pSelect!=0 ); - assert( (pSelect->selFlags & SF_Resolved)!=0 ); - assert( pTab->nCol==pSelect->pEList->nExpr || db->mallocFailed ); - if( db->mallocFailed ) return; - memset(&sNC, 0, sizeof(sNC)); - sNC.pSrcList = pSelect->pSrc; - a = pSelect->pEList->a; - for(i=0, pCol=pTab->aCol; inCol; i++, pCol++){ - p = a[i].pExpr; - pCol->zType = sqlite3DbStrDup(db, columnType(&sNC, p,0,0,0, &pCol->szEst)); - szAll += pCol->szEst; - pCol->affinity = sqlite3ExprAffinity(p); - if( pCol->affinity==0 ) pCol->affinity = SQLITE_AFF_NONE; - pColl = sqlite3ExprCollSeq(pParse, p); - if( pColl ){ - pCol->zColl = sqlite3DbStrDup(db, pColl->zName); - } - } - pTab->szTabRow = sqlite3LogEst(szAll*4); -} - -/* -** Given a SELECT statement, generate a Table structure that describes -** the result set of that SELECT. -*/ -SQLITE_PRIVATE Table *sqlite3ResultSetOfSelect(Parse *pParse, Select *pSelect){ - Table *pTab; - sqlite3 *db = pParse->db; - int savedFlags; - - savedFlags = db->flags; - db->flags &= ~SQLITE_FullColNames; - db->flags |= SQLITE_ShortColNames; - sqlite3SelectPrep(pParse, pSelect, 0); - if( pParse->nErr ) return 0; - while( pSelect->pPrior ) pSelect = pSelect->pPrior; - db->flags = savedFlags; - pTab = sqlite3DbMallocZero(db, sizeof(Table) ); - if( pTab==0 ){ - return 0; - } - /* The sqlite3ResultSetOfSelect() is only used n contexts where lookaside - ** is disabled */ - assert( db->lookaside.bEnabled==0 ); - pTab->nRef = 1; - pTab->zName = 0; - pTab->nRowEst = 1048576; - selectColumnsFromExprList(pParse, pSelect->pEList, &pTab->nCol, &pTab->aCol); - selectAddColumnTypeAndCollation(pParse, pTab, pSelect); - pTab->iPKey = -1; - if( db->mallocFailed ){ - sqlite3DeleteTable(db, pTab); - return 0; - } - return pTab; -} - -/* -** Get a VDBE for the given parser context. Create a new one if necessary. -** If an error occurs, return NULL and leave a message in pParse. -*/ -SQLITE_PRIVATE Vdbe *sqlite3GetVdbe(Parse *pParse){ - Vdbe *v = pParse->pVdbe; - if( v==0 ){ - v = pParse->pVdbe = sqlite3VdbeCreate(pParse); -#ifndef SQLITE_OMIT_TRACE - if( v ){ - sqlite3VdbeAddOp0(v, OP_Trace); - } -#endif - } - return v; -} - - -/* -** Compute the iLimit and iOffset fields of the SELECT based on the -** pLimit and pOffset expressions. pLimit and pOffset hold the expressions -** that appear in the original SQL statement after the LIMIT and OFFSET -** keywords. Or NULL if those keywords are omitted. iLimit and iOffset -** are the integer memory register numbers for counters used to compute -** the limit and offset. If there is no limit and/or offset, then -** iLimit and iOffset are negative. -** -** This routine changes the values of iLimit and iOffset only if -** a limit or offset is defined by pLimit and pOffset. iLimit and -** iOffset should have been preset to appropriate default values (zero) -** prior to calling this routine. -** -** The iOffset register (if it exists) is initialized to the value -** of the OFFSET. The iLimit register is initialized to LIMIT. Register -** iOffset+1 is initialized to LIMIT+OFFSET. -** -** Only if pLimit!=0 or pOffset!=0 do the limit registers get -** redefined. The UNION ALL operator uses this property to force -** the reuse of the same limit and offset registers across multiple -** SELECT statements. -*/ -static void computeLimitRegisters(Parse *pParse, Select *p, int iBreak){ - Vdbe *v = 0; - int iLimit = 0; - int iOffset; - int addr1, n; - if( p->iLimit ) return; - - /* - ** "LIMIT -1" always shows all rows. There is some - ** controversy about what the correct behavior should be. - ** The current implementation interprets "LIMIT 0" to mean - ** no rows. - */ - sqlite3ExprCacheClear(pParse); - assert( p->pOffset==0 || p->pLimit!=0 ); - if( p->pLimit ){ - p->iLimit = iLimit = ++pParse->nMem; - v = sqlite3GetVdbe(pParse); - assert( v!=0 ); - if( sqlite3ExprIsInteger(p->pLimit, &n) ){ - sqlite3VdbeAddOp2(v, OP_Integer, n, iLimit); - VdbeComment((v, "LIMIT counter")); - if( n==0 ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, iBreak); - }else if( n>=0 && p->nSelectRow>(u64)n ){ - p->nSelectRow = n; - } - }else{ - sqlite3ExprCode(pParse, p->pLimit, iLimit); - sqlite3VdbeAddOp1(v, OP_MustBeInt, iLimit); - VdbeComment((v, "LIMIT counter")); - sqlite3VdbeAddOp2(v, OP_IfZero, iLimit, iBreak); - } - if( p->pOffset ){ - p->iOffset = iOffset = ++pParse->nMem; - pParse->nMem++; /* Allocate an extra register for limit+offset */ - sqlite3ExprCode(pParse, p->pOffset, iOffset); - sqlite3VdbeAddOp1(v, OP_MustBeInt, iOffset); - VdbeComment((v, "OFFSET counter")); - addr1 = sqlite3VdbeAddOp1(v, OP_IfPos, iOffset); - sqlite3VdbeAddOp2(v, OP_Integer, 0, iOffset); - sqlite3VdbeJumpHere(v, addr1); - sqlite3VdbeAddOp3(v, OP_Add, iLimit, iOffset, iOffset+1); - VdbeComment((v, "LIMIT+OFFSET")); - addr1 = sqlite3VdbeAddOp1(v, OP_IfPos, iLimit); - sqlite3VdbeAddOp2(v, OP_Integer, -1, iOffset+1); - sqlite3VdbeJumpHere(v, addr1); - } - } -} - -#ifndef SQLITE_OMIT_COMPOUND_SELECT -/* -** Return the appropriate collating sequence for the iCol-th column of -** the result set for the compound-select statement "p". Return NULL if -** the column has no default collating sequence. -** -** The collating sequence for the compound select is taken from the -** left-most term of the select that has a collating sequence. -*/ -static CollSeq *multiSelectCollSeq(Parse *pParse, Select *p, int iCol){ - CollSeq *pRet; - if( p->pPrior ){ - pRet = multiSelectCollSeq(pParse, p->pPrior, iCol); - }else{ - pRet = 0; - } - assert( iCol>=0 ); - if( pRet==0 && iColpEList->nExpr ){ - pRet = sqlite3ExprCollSeq(pParse, p->pEList->a[iCol].pExpr); - } - return pRet; -} - -/* -** The select statement passed as the second parameter is a compound SELECT -** with an ORDER BY clause. This function allocates and returns a KeyInfo -** structure suitable for implementing the ORDER BY. -** -** Space to hold the KeyInfo structure is obtained from malloc. The calling -** function is responsible for ensuring that this structure is eventually -** freed. -*/ -static KeyInfo *multiSelectOrderByKeyInfo(Parse *pParse, Select *p, int nExtra){ - ExprList *pOrderBy = p->pOrderBy; - int nOrderBy = p->pOrderBy->nExpr; - sqlite3 *db = pParse->db; - KeyInfo *pRet = sqlite3KeyInfoAlloc(db, nOrderBy+nExtra, 1); - if( pRet ){ - int i; - for(i=0; ia[i]; - Expr *pTerm = pItem->pExpr; - CollSeq *pColl; - - if( pTerm->flags & EP_Collate ){ - pColl = sqlite3ExprCollSeq(pParse, pTerm); - }else{ - pColl = multiSelectCollSeq(pParse, p, pItem->u.x.iOrderByCol-1); - if( pColl==0 ) pColl = db->pDfltColl; - pOrderBy->a[i].pExpr = - sqlite3ExprAddCollateString(pParse, pTerm, pColl->zName); - } - assert( sqlite3KeyInfoIsWriteable(pRet) ); - pRet->aColl[i] = pColl; - pRet->aSortOrder[i] = pOrderBy->a[i].sortOrder; - } - } - - return pRet; -} - -#ifndef SQLITE_OMIT_CTE -/* -** This routine generates VDBE code to compute the content of a WITH RECURSIVE -** query of the form: -** -** AS ( UNION [ALL] ) -** \___________/ \_______________/ -** p->pPrior p -** -** -** There is exactly one reference to the recursive-table in the FROM clause -** of recursive-query, marked with the SrcList->a[].isRecursive flag. -** -** The setup-query runs once to generate an initial set of rows that go -** into a Queue table. Rows are extracted from the Queue table one by -** one. Each row extracted from Queue is output to pDest. Then the single -** extracted row (now in the iCurrent table) becomes the content of the -** recursive-table for a recursive-query run. The output of the recursive-query -** is added back into the Queue table. Then another row is extracted from Queue -** and the iteration continues until the Queue table is empty. -** -** If the compound query operator is UNION then no duplicate rows are ever -** inserted into the Queue table. The iDistinct table keeps a copy of all rows -** that have ever been inserted into Queue and causes duplicates to be -** discarded. If the operator is UNION ALL, then duplicates are allowed. -** -** If the query has an ORDER BY, then entries in the Queue table are kept in -** ORDER BY order and the first entry is extracted for each cycle. Without -** an ORDER BY, the Queue table is just a FIFO. -** -** If a LIMIT clause is provided, then the iteration stops after LIMIT rows -** have been output to pDest. A LIMIT of zero means to output no rows and a -** negative LIMIT means to output all rows. If there is also an OFFSET clause -** with a positive value, then the first OFFSET outputs are discarded rather -** than being sent to pDest. The LIMIT count does not begin until after OFFSET -** rows have been skipped. -*/ -static void generateWithRecursiveQuery( - Parse *pParse, /* Parsing context */ - Select *p, /* The recursive SELECT to be coded */ - SelectDest *pDest /* What to do with query results */ -){ - SrcList *pSrc = p->pSrc; /* The FROM clause of the recursive query */ - int nCol = p->pEList->nExpr; /* Number of columns in the recursive table */ - Vdbe *v = pParse->pVdbe; /* The prepared statement under construction */ - Select *pSetup = p->pPrior; /* The setup query */ - int addrTop; /* Top of the loop */ - int addrCont, addrBreak; /* CONTINUE and BREAK addresses */ - int iCurrent = 0; /* The Current table */ - int regCurrent; /* Register holding Current table */ - int iQueue; /* The Queue table */ - int iDistinct = 0; /* To ensure unique results if UNION */ - int eDest = SRT_Table; /* How to write to Queue */ - SelectDest destQueue; /* SelectDest targetting the Queue table */ - int i; /* Loop counter */ - int rc; /* Result code */ - ExprList *pOrderBy; /* The ORDER BY clause */ - Expr *pLimit, *pOffset; /* Saved LIMIT and OFFSET */ - int regLimit, regOffset; /* Registers used by LIMIT and OFFSET */ - - /* Obtain authorization to do a recursive query */ - if( sqlite3AuthCheck(pParse, SQLITE_RECURSIVE, 0, 0, 0) ) return; - - /* Process the LIMIT and OFFSET clauses, if they exist */ - addrBreak = sqlite3VdbeMakeLabel(v); - computeLimitRegisters(pParse, p, addrBreak); - pLimit = p->pLimit; - pOffset = p->pOffset; - regLimit = p->iLimit; - regOffset = p->iOffset; - p->pLimit = p->pOffset = 0; - p->iLimit = p->iOffset = 0; - pOrderBy = p->pOrderBy; - - /* Locate the cursor number of the Current table */ - for(i=0; ALWAYS(inSrc); i++){ - if( pSrc->a[i].isRecursive ){ - iCurrent = pSrc->a[i].iCursor; - break; - } - } - - /* Allocate cursors numbers for Queue and Distinct. The cursor number for - ** the Distinct table must be exactly one greater than Queue in order - ** for the SRT_DistTable and SRT_DistQueue destinations to work. */ - iQueue = pParse->nTab++; - if( p->op==TK_UNION ){ - eDest = pOrderBy ? SRT_DistQueue : SRT_DistTable; - iDistinct = pParse->nTab++; - }else{ - eDest = pOrderBy ? SRT_Queue : SRT_Table; - } - sqlite3SelectDestInit(&destQueue, eDest, iQueue); - - /* Allocate cursors for Current, Queue, and Distinct. */ - regCurrent = ++pParse->nMem; - sqlite3VdbeAddOp3(v, OP_OpenPseudo, iCurrent, regCurrent, nCol); - if( pOrderBy ){ - KeyInfo *pKeyInfo = multiSelectOrderByKeyInfo(pParse, p, 1); - sqlite3VdbeAddOp4(v, OP_OpenEphemeral, iQueue, pOrderBy->nExpr+2, 0, - (char*)pKeyInfo, P4_KEYINFO); - destQueue.pOrderBy = pOrderBy; - }else{ - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iQueue, nCol); - } - VdbeComment((v, "Queue table")); - if( iDistinct ){ - p->addrOpenEphm[0] = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iDistinct, 0); - p->selFlags |= SF_UsesEphemeral; - } - - /* Detach the ORDER BY clause from the compound SELECT */ - p->pOrderBy = 0; - - /* Store the results of the setup-query in Queue. */ - rc = sqlite3Select(pParse, pSetup, &destQueue); - if( rc ) goto end_of_recursive_query; - - /* Find the next row in the Queue and output that row */ - addrTop = sqlite3VdbeAddOp2(v, OP_Rewind, iQueue, addrBreak); - - /* Transfer the next row in Queue over to Current */ - sqlite3VdbeAddOp1(v, OP_NullRow, iCurrent); /* To reset column cache */ - if( pOrderBy ){ - sqlite3VdbeAddOp3(v, OP_Column, iQueue, pOrderBy->nExpr+1, regCurrent); - }else{ - sqlite3VdbeAddOp2(v, OP_RowData, iQueue, regCurrent); - } - sqlite3VdbeAddOp1(v, OP_Delete, iQueue); - - /* Output the single row in Current */ - addrCont = sqlite3VdbeMakeLabel(v); - codeOffset(v, regOffset, addrCont); - selectInnerLoop(pParse, p, p->pEList, iCurrent, - 0, 0, pDest, addrCont, addrBreak); - if( regLimit ) sqlite3VdbeAddOp3(v, OP_IfZero, regLimit, addrBreak, -1); - sqlite3VdbeResolveLabel(v, addrCont); - - /* Execute the recursive SELECT taking the single row in Current as - ** the value for the recursive-table. Store the results in the Queue. - */ - p->pPrior = 0; - sqlite3Select(pParse, p, &destQueue); - assert( p->pPrior==0 ); - p->pPrior = pSetup; - - /* Keep running the loop until the Queue is empty */ - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrTop); - sqlite3VdbeResolveLabel(v, addrBreak); - -end_of_recursive_query: - p->pOrderBy = pOrderBy; - p->pLimit = pLimit; - p->pOffset = pOffset; - return; -} -#endif /* SQLITE_OMIT_CTE */ - -/* Forward references */ -static int multiSelectOrderBy( - Parse *pParse, /* Parsing context */ - Select *p, /* The right-most of SELECTs to be coded */ - SelectDest *pDest /* What to do with query results */ -); - - -/* -** This routine is called to process a compound query form from -** two or more separate queries using UNION, UNION ALL, EXCEPT, or -** INTERSECT -** -** "p" points to the right-most of the two queries. the query on the -** left is p->pPrior. The left query could also be a compound query -** in which case this routine will be called recursively. -** -** The results of the total query are to be written into a destination -** of type eDest with parameter iParm. -** -** Example 1: Consider a three-way compound SQL statement. -** -** SELECT a FROM t1 UNION SELECT b FROM t2 UNION SELECT c FROM t3 -** -** This statement is parsed up as follows: -** -** SELECT c FROM t3 -** | -** `-----> SELECT b FROM t2 -** | -** `------> SELECT a FROM t1 -** -** The arrows in the diagram above represent the Select.pPrior pointer. -** So if this routine is called with p equal to the t3 query, then -** pPrior will be the t2 query. p->op will be TK_UNION in this case. -** -** Notice that because of the way SQLite parses compound SELECTs, the -** individual selects always group from left to right. -*/ -static int multiSelect( - Parse *pParse, /* Parsing context */ - Select *p, /* The right-most of SELECTs to be coded */ - SelectDest *pDest /* What to do with query results */ -){ - int rc = SQLITE_OK; /* Success code from a subroutine */ - Select *pPrior; /* Another SELECT immediately to our left */ - Vdbe *v; /* Generate code to this VDBE */ - SelectDest dest; /* Alternative data destination */ - Select *pDelete = 0; /* Chain of simple selects to delete */ - sqlite3 *db; /* Database connection */ -#ifndef SQLITE_OMIT_EXPLAIN - int iSub1 = 0; /* EQP id of left-hand query */ - int iSub2 = 0; /* EQP id of right-hand query */ -#endif - - /* Make sure there is no ORDER BY or LIMIT clause on prior SELECTs. Only - ** the last (right-most) SELECT in the series may have an ORDER BY or LIMIT. - */ - assert( p && p->pPrior ); /* Calling function guarantees this much */ - assert( (p->selFlags & SF_Recursive)==0 || p->op==TK_ALL || p->op==TK_UNION ); - db = pParse->db; - pPrior = p->pPrior; - assert( pPrior->pRightmost!=pPrior ); - assert( pPrior->pRightmost==p->pRightmost ); - dest = *pDest; - if( pPrior->pOrderBy ){ - sqlite3ErrorMsg(pParse,"ORDER BY clause should come after %s not before", - selectOpName(p->op)); - rc = 1; - goto multi_select_end; - } - if( pPrior->pLimit ){ - sqlite3ErrorMsg(pParse,"LIMIT clause should come after %s not before", - selectOpName(p->op)); - rc = 1; - goto multi_select_end; - } - - v = sqlite3GetVdbe(pParse); - assert( v!=0 ); /* The VDBE already created by calling function */ - - /* Create the destination temporary table if necessary - */ - if( dest.eDest==SRT_EphemTab ){ - assert( p->pEList ); - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, dest.iSDParm, p->pEList->nExpr); - sqlite3VdbeChangeP5(v, BTREE_UNORDERED); - dest.eDest = SRT_Table; - } - - /* Make sure all SELECTs in the statement have the same number of elements - ** in their result sets. - */ - assert( p->pEList && pPrior->pEList ); - if( p->pEList->nExpr!=pPrior->pEList->nExpr ){ - if( p->selFlags & SF_Values ){ - sqlite3ErrorMsg(pParse, "all VALUES must have the same number of terms"); - }else{ - sqlite3ErrorMsg(pParse, "SELECTs to the left and right of %s" - " do not have the same number of result columns", selectOpName(p->op)); - } - rc = 1; - goto multi_select_end; - } - -#ifndef SQLITE_OMIT_CTE - if( p->selFlags & SF_Recursive ){ - generateWithRecursiveQuery(pParse, p, &dest); - }else -#endif - - /* Compound SELECTs that have an ORDER BY clause are handled separately. - */ - if( p->pOrderBy ){ - return multiSelectOrderBy(pParse, p, pDest); - }else - - /* Generate code for the left and right SELECT statements. - */ - switch( p->op ){ - case TK_ALL: { - int addr = 0; - int nLimit; - assert( !pPrior->pLimit ); - pPrior->iLimit = p->iLimit; - pPrior->iOffset = p->iOffset; - pPrior->pLimit = p->pLimit; - pPrior->pOffset = p->pOffset; - explainSetInteger(iSub1, pParse->iNextSelectId); - rc = sqlite3Select(pParse, pPrior, &dest); - p->pLimit = 0; - p->pOffset = 0; - if( rc ){ - goto multi_select_end; - } - p->pPrior = 0; - p->iLimit = pPrior->iLimit; - p->iOffset = pPrior->iOffset; - if( p->iLimit ){ - addr = sqlite3VdbeAddOp1(v, OP_IfZero, p->iLimit); - VdbeComment((v, "Jump ahead if LIMIT reached")); - } - explainSetInteger(iSub2, pParse->iNextSelectId); - rc = sqlite3Select(pParse, p, &dest); - testcase( rc!=SQLITE_OK ); - pDelete = p->pPrior; - p->pPrior = pPrior; - p->nSelectRow += pPrior->nSelectRow; - if( pPrior->pLimit - && sqlite3ExprIsInteger(pPrior->pLimit, &nLimit) - && nLimit>0 && p->nSelectRow > (u64)nLimit - ){ - p->nSelectRow = nLimit; - } - if( addr ){ - sqlite3VdbeJumpHere(v, addr); - } - break; - } - case TK_EXCEPT: - case TK_UNION: { - int unionTab; /* Cursor number of the temporary table holding result */ - u8 op = 0; /* One of the SRT_ operations to apply to self */ - int priorOp; /* The SRT_ operation to apply to prior selects */ - Expr *pLimit, *pOffset; /* Saved values of p->nLimit and p->nOffset */ - int addr; - SelectDest uniondest; - - testcase( p->op==TK_EXCEPT ); - testcase( p->op==TK_UNION ); - priorOp = SRT_Union; - if( dest.eDest==priorOp && ALWAYS(!p->pLimit &&!p->pOffset) ){ - /* We can reuse a temporary table generated by a SELECT to our - ** right. - */ - assert( p->pRightmost!=p ); /* Can only happen for leftward elements - ** of a 3-way or more compound */ - assert( p->pLimit==0 ); /* Not allowed on leftward elements */ - assert( p->pOffset==0 ); /* Not allowed on leftward elements */ - unionTab = dest.iSDParm; - }else{ - /* We will need to create our own temporary table to hold the - ** intermediate results. - */ - unionTab = pParse->nTab++; - assert( p->pOrderBy==0 ); - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, unionTab, 0); - assert( p->addrOpenEphm[0] == -1 ); - p->addrOpenEphm[0] = addr; - p->pRightmost->selFlags |= SF_UsesEphemeral; - assert( p->pEList ); - } - - /* Code the SELECT statements to our left - */ - assert( !pPrior->pOrderBy ); - sqlite3SelectDestInit(&uniondest, priorOp, unionTab); - explainSetInteger(iSub1, pParse->iNextSelectId); - rc = sqlite3Select(pParse, pPrior, &uniondest); - if( rc ){ - goto multi_select_end; - } - - /* Code the current SELECT statement - */ - if( p->op==TK_EXCEPT ){ - op = SRT_Except; - }else{ - assert( p->op==TK_UNION ); - op = SRT_Union; - } - p->pPrior = 0; - pLimit = p->pLimit; - p->pLimit = 0; - pOffset = p->pOffset; - p->pOffset = 0; - uniondest.eDest = op; - explainSetInteger(iSub2, pParse->iNextSelectId); - rc = sqlite3Select(pParse, p, &uniondest); - testcase( rc!=SQLITE_OK ); - /* Query flattening in sqlite3Select() might refill p->pOrderBy. - ** Be sure to delete p->pOrderBy, therefore, to avoid a memory leak. */ - sqlite3ExprListDelete(db, p->pOrderBy); - pDelete = p->pPrior; - p->pPrior = pPrior; - p->pOrderBy = 0; - if( p->op==TK_UNION ) p->nSelectRow += pPrior->nSelectRow; - sqlite3ExprDelete(db, p->pLimit); - p->pLimit = pLimit; - p->pOffset = pOffset; - p->iLimit = 0; - p->iOffset = 0; - - /* Convert the data in the temporary table into whatever form - ** it is that we currently need. - */ - assert( unionTab==dest.iSDParm || dest.eDest!=priorOp ); - if( dest.eDest!=priorOp ){ - int iCont, iBreak, iStart; - assert( p->pEList ); - if( dest.eDest==SRT_Output ){ - Select *pFirst = p; - while( pFirst->pPrior ) pFirst = pFirst->pPrior; - generateColumnNames(pParse, 0, pFirst->pEList); - } - iBreak = sqlite3VdbeMakeLabel(v); - iCont = sqlite3VdbeMakeLabel(v); - computeLimitRegisters(pParse, p, iBreak); - sqlite3VdbeAddOp2(v, OP_Rewind, unionTab, iBreak); - iStart = sqlite3VdbeCurrentAddr(v); - selectInnerLoop(pParse, p, p->pEList, unionTab, - 0, 0, &dest, iCont, iBreak); - sqlite3VdbeResolveLabel(v, iCont); - sqlite3VdbeAddOp2(v, OP_Next, unionTab, iStart); - sqlite3VdbeResolveLabel(v, iBreak); - sqlite3VdbeAddOp2(v, OP_Close, unionTab, 0); - } - break; - } - default: assert( p->op==TK_INTERSECT ); { - int tab1, tab2; - int iCont, iBreak, iStart; - Expr *pLimit, *pOffset; - int addr; - SelectDest intersectdest; - int r1; - - /* INTERSECT is different from the others since it requires - ** two temporary tables. Hence it has its own case. Begin - ** by allocating the tables we will need. - */ - tab1 = pParse->nTab++; - tab2 = pParse->nTab++; - assert( p->pOrderBy==0 ); - - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab1, 0); - assert( p->addrOpenEphm[0] == -1 ); - p->addrOpenEphm[0] = addr; - p->pRightmost->selFlags |= SF_UsesEphemeral; - assert( p->pEList ); - - /* Code the SELECTs to our left into temporary table "tab1". - */ - sqlite3SelectDestInit(&intersectdest, SRT_Union, tab1); - explainSetInteger(iSub1, pParse->iNextSelectId); - rc = sqlite3Select(pParse, pPrior, &intersectdest); - if( rc ){ - goto multi_select_end; - } - - /* Code the current SELECT into temporary table "tab2" - */ - addr = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, tab2, 0); - assert( p->addrOpenEphm[1] == -1 ); - p->addrOpenEphm[1] = addr; - p->pPrior = 0; - pLimit = p->pLimit; - p->pLimit = 0; - pOffset = p->pOffset; - p->pOffset = 0; - intersectdest.iSDParm = tab2; - explainSetInteger(iSub2, pParse->iNextSelectId); - rc = sqlite3Select(pParse, p, &intersectdest); - testcase( rc!=SQLITE_OK ); - pDelete = p->pPrior; - p->pPrior = pPrior; - if( p->nSelectRow>pPrior->nSelectRow ) p->nSelectRow = pPrior->nSelectRow; - sqlite3ExprDelete(db, p->pLimit); - p->pLimit = pLimit; - p->pOffset = pOffset; - - /* Generate code to take the intersection of the two temporary - ** tables. - */ - assert( p->pEList ); - if( dest.eDest==SRT_Output ){ - Select *pFirst = p; - while( pFirst->pPrior ) pFirst = pFirst->pPrior; - generateColumnNames(pParse, 0, pFirst->pEList); - } - iBreak = sqlite3VdbeMakeLabel(v); - iCont = sqlite3VdbeMakeLabel(v); - computeLimitRegisters(pParse, p, iBreak); - sqlite3VdbeAddOp2(v, OP_Rewind, tab1, iBreak); - r1 = sqlite3GetTempReg(pParse); - iStart = sqlite3VdbeAddOp2(v, OP_RowKey, tab1, r1); - sqlite3VdbeAddOp4Int(v, OP_NotFound, tab2, iCont, r1, 0); - sqlite3ReleaseTempReg(pParse, r1); - selectInnerLoop(pParse, p, p->pEList, tab1, - 0, 0, &dest, iCont, iBreak); - sqlite3VdbeResolveLabel(v, iCont); - sqlite3VdbeAddOp2(v, OP_Next, tab1, iStart); - sqlite3VdbeResolveLabel(v, iBreak); - sqlite3VdbeAddOp2(v, OP_Close, tab2, 0); - sqlite3VdbeAddOp2(v, OP_Close, tab1, 0); - break; - } - } - - explainComposite(pParse, p->op, iSub1, iSub2, p->op!=TK_ALL); - - /* Compute collating sequences used by - ** temporary tables needed to implement the compound select. - ** Attach the KeyInfo structure to all temporary tables. - ** - ** This section is run by the right-most SELECT statement only. - ** SELECT statements to the left always skip this part. The right-most - ** SELECT might also skip this part if it has no ORDER BY clause and - ** no temp tables are required. - */ - if( p->selFlags & SF_UsesEphemeral ){ - int i; /* Loop counter */ - KeyInfo *pKeyInfo; /* Collating sequence for the result set */ - Select *pLoop; /* For looping through SELECT statements */ - CollSeq **apColl; /* For looping through pKeyInfo->aColl[] */ - int nCol; /* Number of columns in result set */ - - assert( p->pRightmost==p ); - nCol = p->pEList->nExpr; - pKeyInfo = sqlite3KeyInfoAlloc(db, nCol, 1); - if( !pKeyInfo ){ - rc = SQLITE_NOMEM; - goto multi_select_end; - } - for(i=0, apColl=pKeyInfo->aColl; ipDfltColl; - } - } - - for(pLoop=p; pLoop; pLoop=pLoop->pPrior){ - for(i=0; i<2; i++){ - int addr = pLoop->addrOpenEphm[i]; - if( addr<0 ){ - /* If [0] is unused then [1] is also unused. So we can - ** always safely abort as soon as the first unused slot is found */ - assert( pLoop->addrOpenEphm[1]<0 ); - break; - } - sqlite3VdbeChangeP2(v, addr, nCol); - sqlite3VdbeChangeP4(v, addr, (char*)sqlite3KeyInfoRef(pKeyInfo), - P4_KEYINFO); - pLoop->addrOpenEphm[i] = -1; - } - } - sqlite3KeyInfoUnref(pKeyInfo); - } - -multi_select_end: - pDest->iSdst = dest.iSdst; - pDest->nSdst = dest.nSdst; - sqlite3SelectDelete(db, pDelete); - return rc; -} -#endif /* SQLITE_OMIT_COMPOUND_SELECT */ - -/* -** Code an output subroutine for a coroutine implementation of a -** SELECT statment. -** -** The data to be output is contained in pIn->iSdst. There are -** pIn->nSdst columns to be output. pDest is where the output should -** be sent. -** -** regReturn is the number of the register holding the subroutine -** return address. -** -** If regPrev>0 then it is the first register in a vector that -** records the previous output. mem[regPrev] is a flag that is false -** if there has been no previous output. If regPrev>0 then code is -** generated to suppress duplicates. pKeyInfo is used for comparing -** keys. -** -** If the LIMIT found in p->iLimit is reached, jump immediately to -** iBreak. -*/ -static int generateOutputSubroutine( - Parse *pParse, /* Parsing context */ - Select *p, /* The SELECT statement */ - SelectDest *pIn, /* Coroutine supplying data */ - SelectDest *pDest, /* Where to send the data */ - int regReturn, /* The return address register */ - int regPrev, /* Previous result register. No uniqueness if 0 */ - KeyInfo *pKeyInfo, /* For comparing with previous entry */ - int iBreak /* Jump here if we hit the LIMIT */ -){ - Vdbe *v = pParse->pVdbe; - int iContinue; - int addr; - - addr = sqlite3VdbeCurrentAddr(v); - iContinue = sqlite3VdbeMakeLabel(v); - - /* Suppress duplicates for UNION, EXCEPT, and INTERSECT - */ - if( regPrev ){ - int j1, j2; - j1 = sqlite3VdbeAddOp1(v, OP_IfNot, regPrev); - j2 = sqlite3VdbeAddOp4(v, OP_Compare, pIn->iSdst, regPrev+1, pIn->nSdst, - (char*)sqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO); - sqlite3VdbeAddOp3(v, OP_Jump, j2+2, iContinue, j2+2); - sqlite3VdbeJumpHere(v, j1); - sqlite3VdbeAddOp3(v, OP_Copy, pIn->iSdst, regPrev+1, pIn->nSdst-1); - sqlite3VdbeAddOp2(v, OP_Integer, 1, regPrev); - } - if( pParse->db->mallocFailed ) return 0; - - /* Suppress the first OFFSET entries if there is an OFFSET clause - */ - codeOffset(v, p->iOffset, iContinue); - - switch( pDest->eDest ){ - /* Store the result as data using a unique key. - */ - case SRT_Table: - case SRT_EphemTab: { - int r1 = sqlite3GetTempReg(pParse); - int r2 = sqlite3GetTempReg(pParse); - testcase( pDest->eDest==SRT_Table ); - testcase( pDest->eDest==SRT_EphemTab ); - sqlite3VdbeAddOp3(v, OP_MakeRecord, pIn->iSdst, pIn->nSdst, r1); - sqlite3VdbeAddOp2(v, OP_NewRowid, pDest->iSDParm, r2); - sqlite3VdbeAddOp3(v, OP_Insert, pDest->iSDParm, r1, r2); - sqlite3VdbeChangeP5(v, OPFLAG_APPEND); - sqlite3ReleaseTempReg(pParse, r2); - sqlite3ReleaseTempReg(pParse, r1); - break; - } - -#ifndef SQLITE_OMIT_SUBQUERY - /* If we are creating a set for an "expr IN (SELECT ...)" construct, - ** then there should be a single item on the stack. Write this - ** item into the set table with bogus data. - */ - case SRT_Set: { - int r1; - assert( pIn->nSdst==1 ); - pDest->affSdst = - sqlite3CompareAffinity(p->pEList->a[0].pExpr, pDest->affSdst); - r1 = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp4(v, OP_MakeRecord, pIn->iSdst, 1, r1, &pDest->affSdst,1); - sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, 1); - sqlite3VdbeAddOp2(v, OP_IdxInsert, pDest->iSDParm, r1); - sqlite3ReleaseTempReg(pParse, r1); - break; - } - -#if 0 /* Never occurs on an ORDER BY query */ - /* If any row exist in the result set, record that fact and abort. - */ - case SRT_Exists: { - sqlite3VdbeAddOp2(v, OP_Integer, 1, pDest->iSDParm); - /* The LIMIT clause will terminate the loop for us */ - break; - } -#endif - - /* If this is a scalar select that is part of an expression, then - ** store the results in the appropriate memory cell and break out - ** of the scan loop. - */ - case SRT_Mem: { - assert( pIn->nSdst==1 ); - sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSDParm, 1); - /* The LIMIT clause will jump out of the loop for us */ - break; - } -#endif /* #ifndef SQLITE_OMIT_SUBQUERY */ - - /* The results are stored in a sequence of registers - ** starting at pDest->iSdst. Then the co-routine yields. - */ - case SRT_Coroutine: { - if( pDest->iSdst==0 ){ - pDest->iSdst = sqlite3GetTempRange(pParse, pIn->nSdst); - pDest->nSdst = pIn->nSdst; - } - sqlite3ExprCodeMove(pParse, pIn->iSdst, pDest->iSdst, pDest->nSdst); - sqlite3VdbeAddOp1(v, OP_Yield, pDest->iSDParm); - break; - } - - /* If none of the above, then the result destination must be - ** SRT_Output. This routine is never called with any other - ** destination other than the ones handled above or SRT_Output. - ** - ** For SRT_Output, results are stored in a sequence of registers. - ** Then the OP_ResultRow opcode is used to cause sqlite3_step() to - ** return the next row of result. - */ - default: { - assert( pDest->eDest==SRT_Output ); - sqlite3VdbeAddOp2(v, OP_ResultRow, pIn->iSdst, pIn->nSdst); - sqlite3ExprCacheAffinityChange(pParse, pIn->iSdst, pIn->nSdst); - break; - } - } - - /* Jump to the end of the loop if the LIMIT is reached. - */ - if( p->iLimit ){ - sqlite3VdbeAddOp3(v, OP_IfZero, p->iLimit, iBreak, -1); - } - - /* Generate the subroutine return - */ - sqlite3VdbeResolveLabel(v, iContinue); - sqlite3VdbeAddOp1(v, OP_Return, regReturn); - - return addr; -} - -/* -** Alternative compound select code generator for cases when there -** is an ORDER BY clause. -** -** We assume a query of the following form: -** -** ORDER BY -** -** is one of UNION ALL, UNION, EXCEPT, or INTERSECT. The idea -** is to code both and with the ORDER BY clause as -** co-routines. Then run the co-routines in parallel and merge the results -** into the output. In addition to the two coroutines (called selectA and -** selectB) there are 7 subroutines: -** -** outA: Move the output of the selectA coroutine into the output -** of the compound query. -** -** outB: Move the output of the selectB coroutine into the output -** of the compound query. (Only generated for UNION and -** UNION ALL. EXCEPT and INSERTSECT never output a row that -** appears only in B.) -** -** AltB: Called when there is data from both coroutines and AB. -** -** EofA: Called when data is exhausted from selectA. -** -** EofB: Called when data is exhausted from selectB. -** -** The implementation of the latter five subroutines depend on which -** is used: -** -** -** UNION ALL UNION EXCEPT INTERSECT -** ------------- ----------------- -------------- ----------------- -** AltB: outA, nextA outA, nextA outA, nextA nextA -** -** AeqB: outA, nextA nextA nextA outA, nextA -** -** AgtB: outB, nextB outB, nextB nextB nextB -** -** EofA: outB, nextB outB, nextB halt halt -** -** EofB: outA, nextA outA, nextA outA, nextA halt -** -** In the AltB, AeqB, and AgtB subroutines, an EOF on A following nextA -** causes an immediate jump to EofA and an EOF on B following nextB causes -** an immediate jump to EofB. Within EofA and EofB, and EOF on entry or -** following nextX causes a jump to the end of the select processing. -** -** Duplicate removal in the UNION, EXCEPT, and INTERSECT cases is handled -** within the output subroutine. The regPrev register set holds the previously -** output value. A comparison is made against this value and the output -** is skipped if the next results would be the same as the previous. -** -** The implementation plan is to implement the two coroutines and seven -** subroutines first, then put the control logic at the bottom. Like this: -** -** goto Init -** coA: coroutine for left query (A) -** coB: coroutine for right query (B) -** outA: output one row of A -** outB: output one row of B (UNION and UNION ALL only) -** EofA: ... -** EofB: ... -** AltB: ... -** AeqB: ... -** AgtB: ... -** Init: initialize coroutine registers -** yield coA -** if eof(A) goto EofA -** yield coB -** if eof(B) goto EofB -** Cmpr: Compare A, B -** Jump AltB, AeqB, AgtB -** End: ... -** -** We call AltB, AeqB, AgtB, EofA, and EofB "subroutines" but they are not -** actually called using Gosub and they do not Return. EofA and EofB loop -** until all data is exhausted then jump to the "end" labe. AltB, AeqB, -** and AgtB jump to either L2 or to one of EofA or EofB. -*/ -#ifndef SQLITE_OMIT_COMPOUND_SELECT -static int multiSelectOrderBy( - Parse *pParse, /* Parsing context */ - Select *p, /* The right-most of SELECTs to be coded */ - SelectDest *pDest /* What to do with query results */ -){ - int i, j; /* Loop counters */ - Select *pPrior; /* Another SELECT immediately to our left */ - Vdbe *v; /* Generate code to this VDBE */ - SelectDest destA; /* Destination for coroutine A */ - SelectDest destB; /* Destination for coroutine B */ - int regAddrA; /* Address register for select-A coroutine */ - int regEofA; /* Flag to indicate when select-A is complete */ - int regAddrB; /* Address register for select-B coroutine */ - int regEofB; /* Flag to indicate when select-B is complete */ - int addrSelectA; /* Address of the select-A coroutine */ - int addrSelectB; /* Address of the select-B coroutine */ - int regOutA; /* Address register for the output-A subroutine */ - int regOutB; /* Address register for the output-B subroutine */ - int addrOutA; /* Address of the output-A subroutine */ - int addrOutB = 0; /* Address of the output-B subroutine */ - int addrEofA; /* Address of the select-A-exhausted subroutine */ - int addrEofB; /* Address of the select-B-exhausted subroutine */ - int addrAltB; /* Address of the AB subroutine */ - int regLimitA; /* Limit register for select-A */ - int regLimitB; /* Limit register for select-A */ - int regPrev; /* A range of registers to hold previous output */ - int savedLimit; /* Saved value of p->iLimit */ - int savedOffset; /* Saved value of p->iOffset */ - int labelCmpr; /* Label for the start of the merge algorithm */ - int labelEnd; /* Label for the end of the overall SELECT stmt */ - int j1; /* Jump instructions that get retargetted */ - int op; /* One of TK_ALL, TK_UNION, TK_EXCEPT, TK_INTERSECT */ - KeyInfo *pKeyDup = 0; /* Comparison information for duplicate removal */ - KeyInfo *pKeyMerge; /* Comparison information for merging rows */ - sqlite3 *db; /* Database connection */ - ExprList *pOrderBy; /* The ORDER BY clause */ - int nOrderBy; /* Number of terms in the ORDER BY clause */ - int *aPermute; /* Mapping from ORDER BY terms to result set columns */ -#ifndef SQLITE_OMIT_EXPLAIN - int iSub1; /* EQP id of left-hand query */ - int iSub2; /* EQP id of right-hand query */ -#endif - - assert( p->pOrderBy!=0 ); - assert( pKeyDup==0 ); /* "Managed" code needs this. Ticket #3382. */ - db = pParse->db; - v = pParse->pVdbe; - assert( v!=0 ); /* Already thrown the error if VDBE alloc failed */ - labelEnd = sqlite3VdbeMakeLabel(v); - labelCmpr = sqlite3VdbeMakeLabel(v); - - - /* Patch up the ORDER BY clause - */ - op = p->op; - pPrior = p->pPrior; - assert( pPrior->pOrderBy==0 ); - pOrderBy = p->pOrderBy; - assert( pOrderBy ); - nOrderBy = pOrderBy->nExpr; - - /* For operators other than UNION ALL we have to make sure that - ** the ORDER BY clause covers every term of the result set. Add - ** terms to the ORDER BY clause as necessary. - */ - if( op!=TK_ALL ){ - for(i=1; db->mallocFailed==0 && i<=p->pEList->nExpr; i++){ - struct ExprList_item *pItem; - for(j=0, pItem=pOrderBy->a; ju.x.iOrderByCol>0 ); - if( pItem->u.x.iOrderByCol==i ) break; - } - if( j==nOrderBy ){ - Expr *pNew = sqlite3Expr(db, TK_INTEGER, 0); - if( pNew==0 ) return SQLITE_NOMEM; - pNew->flags |= EP_IntValue; - pNew->u.iValue = i; - pOrderBy = sqlite3ExprListAppend(pParse, pOrderBy, pNew); - if( pOrderBy ) pOrderBy->a[nOrderBy++].u.x.iOrderByCol = (u16)i; - } - } - } - - /* Compute the comparison permutation and keyinfo that is used with - ** the permutation used to determine if the next - ** row of results comes from selectA or selectB. Also add explicit - ** collations to the ORDER BY clause terms so that when the subqueries - ** to the right and the left are evaluated, they use the correct - ** collation. - */ - aPermute = sqlite3DbMallocRaw(db, sizeof(int)*nOrderBy); - if( aPermute ){ - struct ExprList_item *pItem; - for(i=0, pItem=pOrderBy->a; iu.x.iOrderByCol>0 - && pItem->u.x.iOrderByCol<=p->pEList->nExpr ); - aPermute[i] = pItem->u.x.iOrderByCol - 1; - } - pKeyMerge = multiSelectOrderByKeyInfo(pParse, p, 1); - }else{ - pKeyMerge = 0; - } - - /* Reattach the ORDER BY clause to the query. - */ - p->pOrderBy = pOrderBy; - pPrior->pOrderBy = sqlite3ExprListDup(pParse->db, pOrderBy, 0); - - /* Allocate a range of temporary registers and the KeyInfo needed - ** for the logic that removes duplicate result rows when the - ** operator is UNION, EXCEPT, or INTERSECT (but not UNION ALL). - */ - if( op==TK_ALL ){ - regPrev = 0; - }else{ - int nExpr = p->pEList->nExpr; - assert( nOrderBy>=nExpr || db->mallocFailed ); - regPrev = pParse->nMem+1; - pParse->nMem += nExpr+1; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regPrev); - pKeyDup = sqlite3KeyInfoAlloc(db, nExpr, 1); - if( pKeyDup ){ - assert( sqlite3KeyInfoIsWriteable(pKeyDup) ); - for(i=0; iaColl[i] = multiSelectCollSeq(pParse, p, i); - pKeyDup->aSortOrder[i] = 0; - } - } - } - - /* Separate the left and the right query from one another - */ - p->pPrior = 0; - sqlite3ResolveOrderGroupBy(pParse, p, p->pOrderBy, "ORDER"); - if( pPrior->pPrior==0 ){ - sqlite3ResolveOrderGroupBy(pParse, pPrior, pPrior->pOrderBy, "ORDER"); - } - - /* Compute the limit registers */ - computeLimitRegisters(pParse, p, labelEnd); - if( p->iLimit && op==TK_ALL ){ - regLimitA = ++pParse->nMem; - regLimitB = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Copy, p->iOffset ? p->iOffset+1 : p->iLimit, - regLimitA); - sqlite3VdbeAddOp2(v, OP_Copy, regLimitA, regLimitB); - }else{ - regLimitA = regLimitB = 0; - } - sqlite3ExprDelete(db, p->pLimit); - p->pLimit = 0; - sqlite3ExprDelete(db, p->pOffset); - p->pOffset = 0; - - regAddrA = ++pParse->nMem; - regEofA = ++pParse->nMem; - regAddrB = ++pParse->nMem; - regEofB = ++pParse->nMem; - regOutA = ++pParse->nMem; - regOutB = ++pParse->nMem; - sqlite3SelectDestInit(&destA, SRT_Coroutine, regAddrA); - sqlite3SelectDestInit(&destB, SRT_Coroutine, regAddrB); - - /* Jump past the various subroutines and coroutines to the main - ** merge loop - */ - j1 = sqlite3VdbeAddOp0(v, OP_Goto); - addrSelectA = sqlite3VdbeCurrentAddr(v); - - - /* Generate a coroutine to evaluate the SELECT statement to the - ** left of the compound operator - the "A" select. - */ - VdbeNoopComment((v, "Begin coroutine for left SELECT")); - pPrior->iLimit = regLimitA; - explainSetInteger(iSub1, pParse->iNextSelectId); - sqlite3Select(pParse, pPrior, &destA); - sqlite3VdbeAddOp2(v, OP_Integer, 1, regEofA); - sqlite3VdbeAddOp1(v, OP_Yield, regAddrA); - VdbeNoopComment((v, "End coroutine for left SELECT")); - - /* Generate a coroutine to evaluate the SELECT statement on - ** the right - the "B" select - */ - addrSelectB = sqlite3VdbeCurrentAddr(v); - VdbeNoopComment((v, "Begin coroutine for right SELECT")); - savedLimit = p->iLimit; - savedOffset = p->iOffset; - p->iLimit = regLimitB; - p->iOffset = 0; - explainSetInteger(iSub2, pParse->iNextSelectId); - sqlite3Select(pParse, p, &destB); - p->iLimit = savedLimit; - p->iOffset = savedOffset; - sqlite3VdbeAddOp2(v, OP_Integer, 1, regEofB); - sqlite3VdbeAddOp1(v, OP_Yield, regAddrB); - VdbeNoopComment((v, "End coroutine for right SELECT")); - - /* Generate a subroutine that outputs the current row of the A - ** select as the next output row of the compound select. - */ - VdbeNoopComment((v, "Output routine for A")); - addrOutA = generateOutputSubroutine(pParse, - p, &destA, pDest, regOutA, - regPrev, pKeyDup, labelEnd); - - /* Generate a subroutine that outputs the current row of the B - ** select as the next output row of the compound select. - */ - if( op==TK_ALL || op==TK_UNION ){ - VdbeNoopComment((v, "Output routine for B")); - addrOutB = generateOutputSubroutine(pParse, - p, &destB, pDest, regOutB, - regPrev, pKeyDup, labelEnd); - } - sqlite3KeyInfoUnref(pKeyDup); - - /* Generate a subroutine to run when the results from select A - ** are exhausted and only data in select B remains. - */ - VdbeNoopComment((v, "eof-A subroutine")); - if( op==TK_EXCEPT || op==TK_INTERSECT ){ - addrEofA = sqlite3VdbeAddOp2(v, OP_Goto, 0, labelEnd); - }else{ - addrEofA = sqlite3VdbeAddOp2(v, OP_If, regEofB, labelEnd); - sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB); - sqlite3VdbeAddOp1(v, OP_Yield, regAddrB); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrEofA); - p->nSelectRow += pPrior->nSelectRow; - } - - /* Generate a subroutine to run when the results from select B - ** are exhausted and only data in select A remains. - */ - if( op==TK_INTERSECT ){ - addrEofB = addrEofA; - if( p->nSelectRow > pPrior->nSelectRow ) p->nSelectRow = pPrior->nSelectRow; - }else{ - VdbeNoopComment((v, "eof-B subroutine")); - addrEofB = sqlite3VdbeAddOp2(v, OP_If, regEofA, labelEnd); - sqlite3VdbeAddOp2(v, OP_Gosub, regOutA, addrOutA); - sqlite3VdbeAddOp1(v, OP_Yield, regAddrA); - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrEofB); - } - - /* Generate code to handle the case of AB - */ - VdbeNoopComment((v, "A-gt-B subroutine")); - addrAgtB = sqlite3VdbeCurrentAddr(v); - if( op==TK_ALL || op==TK_UNION ){ - sqlite3VdbeAddOp2(v, OP_Gosub, regOutB, addrOutB); - } - sqlite3VdbeAddOp1(v, OP_Yield, regAddrB); - sqlite3VdbeAddOp2(v, OP_If, regEofB, addrEofB); - sqlite3VdbeAddOp2(v, OP_Goto, 0, labelCmpr); - - /* This code runs once to initialize everything. - */ - sqlite3VdbeJumpHere(v, j1); - sqlite3VdbeAddOp2(v, OP_Integer, 0, regEofA); - sqlite3VdbeAddOp2(v, OP_Integer, 0, regEofB); - sqlite3VdbeAddOp2(v, OP_Gosub, regAddrA, addrSelectA); - sqlite3VdbeAddOp2(v, OP_Gosub, regAddrB, addrSelectB); - sqlite3VdbeAddOp2(v, OP_If, regEofA, addrEofA); - sqlite3VdbeAddOp2(v, OP_If, regEofB, addrEofB); - - /* Implement the main merge loop - */ - sqlite3VdbeResolveLabel(v, labelCmpr); - sqlite3VdbeAddOp4(v, OP_Permutation, 0, 0, 0, (char*)aPermute, P4_INTARRAY); - sqlite3VdbeAddOp4(v, OP_Compare, destA.iSdst, destB.iSdst, nOrderBy, - (char*)pKeyMerge, P4_KEYINFO); - sqlite3VdbeChangeP5(v, OPFLAG_PERMUTE); - sqlite3VdbeAddOp3(v, OP_Jump, addrAltB, addrAeqB, addrAgtB); - - /* Jump to the this point in order to terminate the query. - */ - sqlite3VdbeResolveLabel(v, labelEnd); - - /* Set the number of output columns - */ - if( pDest->eDest==SRT_Output ){ - Select *pFirst = pPrior; - while( pFirst->pPrior ) pFirst = pFirst->pPrior; - generateColumnNames(pParse, 0, pFirst->pEList); - } - - /* Reassembly the compound query so that it will be freed correctly - ** by the calling function */ - if( p->pPrior ){ - sqlite3SelectDelete(db, p->pPrior); - } - p->pPrior = pPrior; - - /*** TBD: Insert subroutine calls to close cursors on incomplete - **** subqueries ****/ - explainComposite(pParse, p->op, iSub1, iSub2, 0); - return SQLITE_OK; -} -#endif - -#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) -/* Forward Declarations */ -static void substExprList(sqlite3*, ExprList*, int, ExprList*); -static void substSelect(sqlite3*, Select *, int, ExprList *); - -/* -** Scan through the expression pExpr. Replace every reference to -** a column in table number iTable with a copy of the iColumn-th -** entry in pEList. (But leave references to the ROWID column -** unchanged.) -** -** This routine is part of the flattening procedure. A subquery -** whose result set is defined by pEList appears as entry in the -** FROM clause of a SELECT such that the VDBE cursor assigned to that -** FORM clause entry is iTable. This routine make the necessary -** changes to pExpr so that it refers directly to the source table -** of the subquery rather the result set of the subquery. -*/ -static Expr *substExpr( - sqlite3 *db, /* Report malloc errors to this connection */ - Expr *pExpr, /* Expr in which substitution occurs */ - int iTable, /* Table to be substituted */ - ExprList *pEList /* Substitute expressions */ -){ - if( pExpr==0 ) return 0; - if( pExpr->op==TK_COLUMN && pExpr->iTable==iTable ){ - if( pExpr->iColumn<0 ){ - pExpr->op = TK_NULL; - }else{ - Expr *pNew; - assert( pEList!=0 && pExpr->iColumnnExpr ); - assert( pExpr->pLeft==0 && pExpr->pRight==0 ); - pNew = sqlite3ExprDup(db, pEList->a[pExpr->iColumn].pExpr, 0); - sqlite3ExprDelete(db, pExpr); - pExpr = pNew; - } - }else{ - pExpr->pLeft = substExpr(db, pExpr->pLeft, iTable, pEList); - pExpr->pRight = substExpr(db, pExpr->pRight, iTable, pEList); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - substSelect(db, pExpr->x.pSelect, iTable, pEList); - }else{ - substExprList(db, pExpr->x.pList, iTable, pEList); - } - } - return pExpr; -} -static void substExprList( - sqlite3 *db, /* Report malloc errors here */ - ExprList *pList, /* List to scan and in which to make substitutes */ - int iTable, /* Table to be substituted */ - ExprList *pEList /* Substitute values */ -){ - int i; - if( pList==0 ) return; - for(i=0; inExpr; i++){ - pList->a[i].pExpr = substExpr(db, pList->a[i].pExpr, iTable, pEList); - } -} -static void substSelect( - sqlite3 *db, /* Report malloc errors here */ - Select *p, /* SELECT statement in which to make substitutions */ - int iTable, /* Table to be replaced */ - ExprList *pEList /* Substitute values */ -){ - SrcList *pSrc; - struct SrcList_item *pItem; - int i; - if( !p ) return; - substExprList(db, p->pEList, iTable, pEList); - substExprList(db, p->pGroupBy, iTable, pEList); - substExprList(db, p->pOrderBy, iTable, pEList); - p->pHaving = substExpr(db, p->pHaving, iTable, pEList); - p->pWhere = substExpr(db, p->pWhere, iTable, pEList); - substSelect(db, p->pPrior, iTable, pEList); - pSrc = p->pSrc; - assert( pSrc ); /* Even for (SELECT 1) we have: pSrc!=0 but pSrc->nSrc==0 */ - if( ALWAYS(pSrc) ){ - for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){ - substSelect(db, pItem->pSelect, iTable, pEList); - } - } -} -#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ - -#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) -/* -** This routine attempts to flatten subqueries as a performance optimization. -** This routine returns 1 if it makes changes and 0 if no flattening occurs. -** -** To understand the concept of flattening, consider the following -** query: -** -** SELECT a FROM (SELECT x+y AS a FROM t1 WHERE z<100) WHERE a>5 -** -** The default way of implementing this query is to execute the -** subquery first and store the results in a temporary table, then -** run the outer query on that temporary table. This requires two -** passes over the data. Furthermore, because the temporary table -** has no indices, the WHERE clause on the outer query cannot be -** optimized. -** -** This routine attempts to rewrite queries such as the above into -** a single flat select, like this: -** -** SELECT x+y AS a FROM t1 WHERE z<100 AND a>5 -** -** The code generated for this simpification gives the same result -** but only has to scan the data once. And because indices might -** exist on the table t1, a complete scan of the data might be -** avoided. -** -** Flattening is only attempted if all of the following are true: -** -** (1) The subquery and the outer query do not both use aggregates. -** -** (2) The subquery is not an aggregate or the outer query is not a join. -** -** (3) The subquery is not the right operand of a left outer join -** (Originally ticket #306. Strengthened by ticket #3300) -** -** (4) The subquery is not DISTINCT. -** -** (**) At one point restrictions (4) and (5) defined a subset of DISTINCT -** sub-queries that were excluded from this optimization. Restriction -** (4) has since been expanded to exclude all DISTINCT subqueries. -** -** (6) The subquery does not use aggregates or the outer query is not -** DISTINCT. -** -** (7) The subquery has a FROM clause. TODO: For subqueries without -** A FROM clause, consider adding a FROM close with the special -** table sqlite_once that consists of a single row containing a -** single NULL. -** -** (8) The subquery does not use LIMIT or the outer query is not a join. -** -** (9) The subquery does not use LIMIT or the outer query does not use -** aggregates. -** -** (10) The subquery does not use aggregates or the outer query does not -** use LIMIT. -** -** (11) The subquery and the outer query do not both have ORDER BY clauses. -** -** (**) Not implemented. Subsumed into restriction (3). Was previously -** a separate restriction deriving from ticket #350. -** -** (13) The subquery and outer query do not both use LIMIT. -** -** (14) The subquery does not use OFFSET. -** -** (15) The outer query is not part of a compound select or the -** subquery does not have a LIMIT clause. -** (See ticket #2339 and ticket [02a8e81d44]). -** -** (16) The outer query is not an aggregate or the subquery does -** not contain ORDER BY. (Ticket #2942) This used to not matter -** until we introduced the group_concat() function. -** -** (17) The sub-query is not a compound select, or it is a UNION ALL -** compound clause made up entirely of non-aggregate queries, and -** the parent query: -** -** * is not itself part of a compound select, -** * is not an aggregate or DISTINCT query, and -** * is not a join -** -** The parent and sub-query may contain WHERE clauses. Subject to -** rules (11), (13) and (14), they may also contain ORDER BY, -** LIMIT and OFFSET clauses. The subquery cannot use any compound -** operator other than UNION ALL because all the other compound -** operators have an implied DISTINCT which is disallowed by -** restriction (4). -** -** Also, each component of the sub-query must return the same number -** of result columns. This is actually a requirement for any compound -** SELECT statement, but all the code here does is make sure that no -** such (illegal) sub-query is flattened. The caller will detect the -** syntax error and return a detailed message. -** -** (18) If the sub-query is a compound select, then all terms of the -** ORDER by clause of the parent must be simple references to -** columns of the sub-query. -** -** (19) The subquery does not use LIMIT or the outer query does not -** have a WHERE clause. -** -** (20) If the sub-query is a compound select, then it must not use -** an ORDER BY clause. Ticket #3773. We could relax this constraint -** somewhat by saying that the terms of the ORDER BY clause must -** appear as unmodified result columns in the outer query. But we -** have other optimizations in mind to deal with that case. -** -** (21) The subquery does not use LIMIT or the outer query is not -** DISTINCT. (See ticket [752e1646fc]). -** -** (22) The subquery is not a recursive CTE. -** -** (23) The parent is not a recursive CTE, or the sub-query is not a -** compound query. This restriction is because transforming the -** parent to a compound query confuses the code that handles -** recursive queries in multiSelect(). -** -** -** In this routine, the "p" parameter is a pointer to the outer query. -** The subquery is p->pSrc->a[iFrom]. isAgg is true if the outer query -** uses aggregates and subqueryIsAgg is true if the subquery uses aggregates. -** -** If flattening is not attempted, this routine is a no-op and returns 0. -** If flattening is attempted this routine returns 1. -** -** All of the expression analysis must occur on both the outer query and -** the subquery before this routine runs. -*/ -static int flattenSubquery( - Parse *pParse, /* Parsing context */ - Select *p, /* The parent or outer SELECT statement */ - int iFrom, /* Index in p->pSrc->a[] of the inner subquery */ - int isAgg, /* True if outer SELECT uses aggregate functions */ - int subqueryIsAgg /* True if the subquery uses aggregate functions */ -){ - const char *zSavedAuthContext = pParse->zAuthContext; - Select *pParent; - Select *pSub; /* The inner query or "subquery" */ - Select *pSub1; /* Pointer to the rightmost select in sub-query */ - SrcList *pSrc; /* The FROM clause of the outer query */ - SrcList *pSubSrc; /* The FROM clause of the subquery */ - ExprList *pList; /* The result set of the outer query */ - int iParent; /* VDBE cursor number of the pSub result set temp table */ - int i; /* Loop counter */ - Expr *pWhere; /* The WHERE clause */ - struct SrcList_item *pSubitem; /* The subquery */ - sqlite3 *db = pParse->db; - - /* Check to see if flattening is permitted. Return 0 if not. - */ - assert( p!=0 ); - assert( p->pPrior==0 ); /* Unable to flatten compound queries */ - if( OptimizationDisabled(db, SQLITE_QueryFlattener) ) return 0; - pSrc = p->pSrc; - assert( pSrc && iFrom>=0 && iFromnSrc ); - pSubitem = &pSrc->a[iFrom]; - iParent = pSubitem->iCursor; - pSub = pSubitem->pSelect; - assert( pSub!=0 ); - if( isAgg && subqueryIsAgg ) return 0; /* Restriction (1) */ - if( subqueryIsAgg && pSrc->nSrc>1 ) return 0; /* Restriction (2) */ - pSubSrc = pSub->pSrc; - assert( pSubSrc ); - /* Prior to version 3.1.2, when LIMIT and OFFSET had to be simple constants, - ** not arbitrary expresssions, we allowed some combining of LIMIT and OFFSET - ** because they could be computed at compile-time. But when LIMIT and OFFSET - ** became arbitrary expressions, we were forced to add restrictions (13) - ** and (14). */ - if( pSub->pLimit && p->pLimit ) return 0; /* Restriction (13) */ - if( pSub->pOffset ) return 0; /* Restriction (14) */ - if( p->pRightmost && pSub->pLimit ){ - return 0; /* Restriction (15) */ - } - if( pSubSrc->nSrc==0 ) return 0; /* Restriction (7) */ - if( pSub->selFlags & SF_Distinct ) return 0; /* Restriction (5) */ - if( pSub->pLimit && (pSrc->nSrc>1 || isAgg) ){ - return 0; /* Restrictions (8)(9) */ - } - if( (p->selFlags & SF_Distinct)!=0 && subqueryIsAgg ){ - return 0; /* Restriction (6) */ - } - if( p->pOrderBy && pSub->pOrderBy ){ - return 0; /* Restriction (11) */ - } - if( isAgg && pSub->pOrderBy ) return 0; /* Restriction (16) */ - if( pSub->pLimit && p->pWhere ) return 0; /* Restriction (19) */ - if( pSub->pLimit && (p->selFlags & SF_Distinct)!=0 ){ - return 0; /* Restriction (21) */ - } - if( pSub->selFlags & SF_Recursive ) return 0; /* Restriction (22) */ - if( (p->selFlags & SF_Recursive) && pSub->pPrior ) return 0; /* (23) */ - - /* OBSOLETE COMMENT 1: - ** Restriction 3: If the subquery is a join, make sure the subquery is - ** not used as the right operand of an outer join. Examples of why this - ** is not allowed: - ** - ** t1 LEFT OUTER JOIN (t2 JOIN t3) - ** - ** If we flatten the above, we would get - ** - ** (t1 LEFT OUTER JOIN t2) JOIN t3 - ** - ** which is not at all the same thing. - ** - ** OBSOLETE COMMENT 2: - ** Restriction 12: If the subquery is the right operand of a left outer - ** join, make sure the subquery has no WHERE clause. - ** An examples of why this is not allowed: - ** - ** t1 LEFT OUTER JOIN (SELECT * FROM t2 WHERE t2.x>0) - ** - ** If we flatten the above, we would get - ** - ** (t1 LEFT OUTER JOIN t2) WHERE t2.x>0 - ** - ** But the t2.x>0 test will always fail on a NULL row of t2, which - ** effectively converts the OUTER JOIN into an INNER JOIN. - ** - ** THIS OVERRIDES OBSOLETE COMMENTS 1 AND 2 ABOVE: - ** Ticket #3300 shows that flattening the right term of a LEFT JOIN - ** is fraught with danger. Best to avoid the whole thing. If the - ** subquery is the right term of a LEFT JOIN, then do not flatten. - */ - if( (pSubitem->jointype & JT_OUTER)!=0 ){ - return 0; - } - - /* Restriction 17: If the sub-query is a compound SELECT, then it must - ** use only the UNION ALL operator. And none of the simple select queries - ** that make up the compound SELECT are allowed to be aggregate or distinct - ** queries. - */ - if( pSub->pPrior ){ - if( pSub->pOrderBy ){ - return 0; /* Restriction 20 */ - } - if( isAgg || (p->selFlags & SF_Distinct)!=0 || pSrc->nSrc!=1 ){ - return 0; - } - for(pSub1=pSub; pSub1; pSub1=pSub1->pPrior){ - testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct ); - testcase( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))==SF_Aggregate ); - assert( pSub->pSrc!=0 ); - if( (pSub1->selFlags & (SF_Distinct|SF_Aggregate))!=0 - || (pSub1->pPrior && pSub1->op!=TK_ALL) - || pSub1->pSrc->nSrc<1 - || pSub->pEList->nExpr!=pSub1->pEList->nExpr - ){ - return 0; - } - testcase( pSub1->pSrc->nSrc>1 ); - } - - /* Restriction 18. */ - if( p->pOrderBy ){ - int ii; - for(ii=0; iipOrderBy->nExpr; ii++){ - if( p->pOrderBy->a[ii].u.x.iOrderByCol==0 ) return 0; - } - } - } - - /***** If we reach this point, flattening is permitted. *****/ - - /* Authorize the subquery */ - pParse->zAuthContext = pSubitem->zName; - TESTONLY(i =) sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0); - testcase( i==SQLITE_DENY ); - pParse->zAuthContext = zSavedAuthContext; - - /* If the sub-query is a compound SELECT statement, then (by restrictions - ** 17 and 18 above) it must be a UNION ALL and the parent query must - ** be of the form: - ** - ** SELECT FROM () - ** - ** followed by any ORDER BY, LIMIT and/or OFFSET clauses. This block - ** creates N-1 copies of the parent query without any ORDER BY, LIMIT or - ** OFFSET clauses and joins them to the left-hand-side of the original - ** using UNION ALL operators. In this case N is the number of simple - ** select statements in the compound sub-query. - ** - ** Example: - ** - ** SELECT a+1 FROM ( - ** SELECT x FROM tab - ** UNION ALL - ** SELECT y FROM tab - ** UNION ALL - ** SELECT abs(z*2) FROM tab2 - ** ) WHERE a!=5 ORDER BY 1 - ** - ** Transformed into: - ** - ** SELECT x+1 FROM tab WHERE x+1!=5 - ** UNION ALL - ** SELECT y+1 FROM tab WHERE y+1!=5 - ** UNION ALL - ** SELECT abs(z*2)+1 FROM tab2 WHERE abs(z*2)+1!=5 - ** ORDER BY 1 - ** - ** We call this the "compound-subquery flattening". - */ - for(pSub=pSub->pPrior; pSub; pSub=pSub->pPrior){ - Select *pNew; - ExprList *pOrderBy = p->pOrderBy; - Expr *pLimit = p->pLimit; - Expr *pOffset = p->pOffset; - Select *pPrior = p->pPrior; - p->pOrderBy = 0; - p->pSrc = 0; - p->pPrior = 0; - p->pLimit = 0; - p->pOffset = 0; - pNew = sqlite3SelectDup(db, p, 0); - p->pOffset = pOffset; - p->pLimit = pLimit; - p->pOrderBy = pOrderBy; - p->pSrc = pSrc; - p->op = TK_ALL; - p->pRightmost = 0; - if( pNew==0 ){ - pNew = pPrior; - }else{ - pNew->pPrior = pPrior; - pNew->pRightmost = 0; - } - p->pPrior = pNew; - if( db->mallocFailed ) return 1; - } - - /* Begin flattening the iFrom-th entry of the FROM clause - ** in the outer query. - */ - pSub = pSub1 = pSubitem->pSelect; - - /* Delete the transient table structure associated with the - ** subquery - */ - sqlite3DbFree(db, pSubitem->zDatabase); - sqlite3DbFree(db, pSubitem->zName); - sqlite3DbFree(db, pSubitem->zAlias); - pSubitem->zDatabase = 0; - pSubitem->zName = 0; - pSubitem->zAlias = 0; - pSubitem->pSelect = 0; - - /* Defer deleting the Table object associated with the - ** subquery until code generation is - ** complete, since there may still exist Expr.pTab entries that - ** refer to the subquery even after flattening. Ticket #3346. - ** - ** pSubitem->pTab is always non-NULL by test restrictions and tests above. - */ - if( ALWAYS(pSubitem->pTab!=0) ){ - Table *pTabToDel = pSubitem->pTab; - if( pTabToDel->nRef==1 ){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - pTabToDel->pNextZombie = pToplevel->pZombieTab; - pToplevel->pZombieTab = pTabToDel; - }else{ - pTabToDel->nRef--; - } - pSubitem->pTab = 0; - } - - /* The following loop runs once for each term in a compound-subquery - ** flattening (as described above). If we are doing a different kind - ** of flattening - a flattening other than a compound-subquery flattening - - ** then this loop only runs once. - ** - ** This loop moves all of the FROM elements of the subquery into the - ** the FROM clause of the outer query. Before doing this, remember - ** the cursor number for the original outer query FROM element in - ** iParent. The iParent cursor will never be used. Subsequent code - ** will scan expressions looking for iParent references and replace - ** those references with expressions that resolve to the subquery FROM - ** elements we are now copying in. - */ - for(pParent=p; pParent; pParent=pParent->pPrior, pSub=pSub->pPrior){ - int nSubSrc; - u8 jointype = 0; - pSubSrc = pSub->pSrc; /* FROM clause of subquery */ - nSubSrc = pSubSrc->nSrc; /* Number of terms in subquery FROM clause */ - pSrc = pParent->pSrc; /* FROM clause of the outer query */ - - if( pSrc ){ - assert( pParent==p ); /* First time through the loop */ - jointype = pSubitem->jointype; - }else{ - assert( pParent!=p ); /* 2nd and subsequent times through the loop */ - pSrc = pParent->pSrc = sqlite3SrcListAppend(db, 0, 0, 0); - if( pSrc==0 ){ - assert( db->mallocFailed ); - break; - } - } - - /* The subquery uses a single slot of the FROM clause of the outer - ** query. If the subquery has more than one element in its FROM clause, - ** then expand the outer query to make space for it to hold all elements - ** of the subquery. - ** - ** Example: - ** - ** SELECT * FROM tabA, (SELECT * FROM sub1, sub2), tabB; - ** - ** The outer query has 3 slots in its FROM clause. One slot of the - ** outer query (the middle slot) is used by the subquery. The next - ** block of code will expand the out query to 4 slots. The middle - ** slot is expanded to two slots in order to make space for the - ** two elements in the FROM clause of the subquery. - */ - if( nSubSrc>1 ){ - pParent->pSrc = pSrc = sqlite3SrcListEnlarge(db, pSrc, nSubSrc-1,iFrom+1); - if( db->mallocFailed ){ - break; - } - } - - /* Transfer the FROM clause terms from the subquery into the - ** outer query. - */ - for(i=0; ia[i+iFrom].pUsing); - pSrc->a[i+iFrom] = pSubSrc->a[i]; - memset(&pSubSrc->a[i], 0, sizeof(pSubSrc->a[i])); - } - pSrc->a[iFrom].jointype = jointype; - - /* Now begin substituting subquery result set expressions for - ** references to the iParent in the outer query. - ** - ** Example: - ** - ** SELECT a+5, b*10 FROM (SELECT x*3 AS a, y+10 AS b FROM t1) WHERE a>b; - ** \ \_____________ subquery __________/ / - ** \_____________________ outer query ______________________________/ - ** - ** We look at every expression in the outer query and every place we see - ** "a" we substitute "x*3" and every place we see "b" we substitute "y+10". - */ - pList = pParent->pEList; - for(i=0; inExpr; i++){ - if( pList->a[i].zName==0 ){ - char *zName = sqlite3DbStrDup(db, pList->a[i].zSpan); - sqlite3Dequote(zName); - pList->a[i].zName = zName; - } - } - substExprList(db, pParent->pEList, iParent, pSub->pEList); - if( isAgg ){ - substExprList(db, pParent->pGroupBy, iParent, pSub->pEList); - pParent->pHaving = substExpr(db, pParent->pHaving, iParent, pSub->pEList); - } - if( pSub->pOrderBy ){ - assert( pParent->pOrderBy==0 ); - pParent->pOrderBy = pSub->pOrderBy; - pSub->pOrderBy = 0; - }else if( pParent->pOrderBy ){ - substExprList(db, pParent->pOrderBy, iParent, pSub->pEList); - } - if( pSub->pWhere ){ - pWhere = sqlite3ExprDup(db, pSub->pWhere, 0); - }else{ - pWhere = 0; - } - if( subqueryIsAgg ){ - assert( pParent->pHaving==0 ); - pParent->pHaving = pParent->pWhere; - pParent->pWhere = pWhere; - pParent->pHaving = substExpr(db, pParent->pHaving, iParent, pSub->pEList); - pParent->pHaving = sqlite3ExprAnd(db, pParent->pHaving, - sqlite3ExprDup(db, pSub->pHaving, 0)); - assert( pParent->pGroupBy==0 ); - pParent->pGroupBy = sqlite3ExprListDup(db, pSub->pGroupBy, 0); - }else{ - pParent->pWhere = substExpr(db, pParent->pWhere, iParent, pSub->pEList); - pParent->pWhere = sqlite3ExprAnd(db, pParent->pWhere, pWhere); - } - - /* The flattened query is distinct if either the inner or the - ** outer query is distinct. - */ - pParent->selFlags |= pSub->selFlags & SF_Distinct; - - /* - ** SELECT ... FROM (SELECT ... LIMIT a OFFSET b) LIMIT x OFFSET y; - ** - ** One is tempted to try to add a and b to combine the limits. But this - ** does not work if either limit is negative. - */ - if( pSub->pLimit ){ - pParent->pLimit = pSub->pLimit; - pSub->pLimit = 0; - } - } - - /* Finially, delete what is left of the subquery and return - ** success. - */ - sqlite3SelectDelete(db, pSub1); - - return 1; -} -#endif /* !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) */ - -/* -** Based on the contents of the AggInfo structure indicated by the first -** argument, this function checks if the following are true: -** -** * the query contains just a single aggregate function, -** * the aggregate function is either min() or max(), and -** * the argument to the aggregate function is a column value. -** -** If all of the above are true, then WHERE_ORDERBY_MIN or WHERE_ORDERBY_MAX -** is returned as appropriate. Also, *ppMinMax is set to point to the -** list of arguments passed to the aggregate before returning. -** -** Or, if the conditions above are not met, *ppMinMax is set to 0 and -** WHERE_ORDERBY_NORMAL is returned. -*/ -static u8 minMaxQuery(AggInfo *pAggInfo, ExprList **ppMinMax){ - int eRet = WHERE_ORDERBY_NORMAL; /* Return value */ - - *ppMinMax = 0; - if( pAggInfo->nFunc==1 ){ - Expr *pExpr = pAggInfo->aFunc[0].pExpr; /* Aggregate function */ - ExprList *pEList = pExpr->x.pList; /* Arguments to agg function */ - - assert( pExpr->op==TK_AGG_FUNCTION ); - if( pEList && pEList->nExpr==1 && pEList->a[0].pExpr->op==TK_AGG_COLUMN ){ - const char *zFunc = pExpr->u.zToken; - if( sqlite3StrICmp(zFunc, "min")==0 ){ - eRet = WHERE_ORDERBY_MIN; - *ppMinMax = pEList; - }else if( sqlite3StrICmp(zFunc, "max")==0 ){ - eRet = WHERE_ORDERBY_MAX; - *ppMinMax = pEList; - } - } - } - - assert( *ppMinMax==0 || (*ppMinMax)->nExpr==1 ); - return eRet; -} - -/* -** The select statement passed as the first argument is an aggregate query. -** The second argment is the associated aggregate-info object. This -** function tests if the SELECT is of the form: -** -** SELECT count(*) FROM -** -** where table is a database table, not a sub-select or view. If the query -** does match this pattern, then a pointer to the Table object representing -** is returned. Otherwise, 0 is returned. -*/ -static Table *isSimpleCount(Select *p, AggInfo *pAggInfo){ - Table *pTab; - Expr *pExpr; - - assert( !p->pGroupBy ); - - if( p->pWhere || p->pEList->nExpr!=1 - || p->pSrc->nSrc!=1 || p->pSrc->a[0].pSelect - ){ - return 0; - } - pTab = p->pSrc->a[0].pTab; - pExpr = p->pEList->a[0].pExpr; - assert( pTab && !pTab->pSelect && pExpr ); - - if( IsVirtual(pTab) ) return 0; - if( pExpr->op!=TK_AGG_FUNCTION ) return 0; - if( NEVER(pAggInfo->nFunc==0) ) return 0; - if( (pAggInfo->aFunc[0].pFunc->funcFlags&SQLITE_FUNC_COUNT)==0 ) return 0; - if( pExpr->flags&EP_Distinct ) return 0; - - return pTab; -} - -/* -** If the source-list item passed as an argument was augmented with an -** INDEXED BY clause, then try to locate the specified index. If there -** was such a clause and the named index cannot be found, return -** SQLITE_ERROR and leave an error in pParse. Otherwise, populate -** pFrom->pIndex and return SQLITE_OK. -*/ -SQLITE_PRIVATE int sqlite3IndexedByLookup(Parse *pParse, struct SrcList_item *pFrom){ - if( pFrom->pTab && pFrom->zIndex ){ - Table *pTab = pFrom->pTab; - char *zIndex = pFrom->zIndex; - Index *pIdx; - for(pIdx=pTab->pIndex; - pIdx && sqlite3StrICmp(pIdx->zName, zIndex); - pIdx=pIdx->pNext - ); - if( !pIdx ){ - sqlite3ErrorMsg(pParse, "no such index: %s", zIndex, 0); - pParse->checkSchema = 1; - return SQLITE_ERROR; - } - pFrom->pIndex = pIdx; - } - return SQLITE_OK; -} -/* -** Detect compound SELECT statements that use an ORDER BY clause with -** an alternative collating sequence. -** -** SELECT ... FROM t1 EXCEPT SELECT ... FROM t2 ORDER BY .. COLLATE ... -** -** These are rewritten as a subquery: -** -** SELECT * FROM (SELECT ... FROM t1 EXCEPT SELECT ... FROM t2) -** ORDER BY ... COLLATE ... -** -** This transformation is necessary because the multiSelectOrderBy() routine -** above that generates the code for a compound SELECT with an ORDER BY clause -** uses a merge algorithm that requires the same collating sequence on the -** result columns as on the ORDER BY clause. See ticket -** http://www.sqlite.org/src/info/6709574d2a -** -** This transformation is only needed for EXCEPT, INTERSECT, and UNION. -** The UNION ALL operator works fine with multiSelectOrderBy() even when -** there are COLLATE terms in the ORDER BY. -*/ -static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){ - int i; - Select *pNew; - Select *pX; - sqlite3 *db; - struct ExprList_item *a; - SrcList *pNewSrc; - Parse *pParse; - Token dummy; - - if( p->pPrior==0 ) return WRC_Continue; - if( p->pOrderBy==0 ) return WRC_Continue; - for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){} - if( pX==0 ) return WRC_Continue; - a = p->pOrderBy->a; - for(i=p->pOrderBy->nExpr-1; i>=0; i--){ - if( a[i].pExpr->flags & EP_Collate ) break; - } - if( i<0 ) return WRC_Continue; - - /* If we reach this point, that means the transformation is required. */ - - pParse = pWalker->pParse; - db = pParse->db; - pNew = sqlite3DbMallocZero(db, sizeof(*pNew) ); - if( pNew==0 ) return WRC_Abort; - memset(&dummy, 0, sizeof(dummy)); - pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0); - if( pNewSrc==0 ) return WRC_Abort; - *pNew = *p; - p->pSrc = pNewSrc; - p->pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ALL, 0)); - p->op = TK_SELECT; - p->pWhere = 0; - pNew->pGroupBy = 0; - pNew->pHaving = 0; - pNew->pOrderBy = 0; - p->pPrior = 0; - pNew->pLimit = 0; - pNew->pOffset = 0; - return WRC_Continue; -} - -#ifndef SQLITE_OMIT_CTE -/* -** Argument pWith (which may be NULL) points to a linked list of nested -** WITH contexts, from inner to outermost. If the table identified by -** FROM clause element pItem is really a common-table-expression (CTE) -** then return a pointer to the CTE definition for that table. Otherwise -** return NULL. -** -** If a non-NULL value is returned, set *ppContext to point to the With -** object that the returned CTE belongs to. -*/ -static struct Cte *searchWith( - With *pWith, /* Current outermost WITH clause */ - struct SrcList_item *pItem, /* FROM clause element to resolve */ - With **ppContext /* OUT: WITH clause return value belongs to */ -){ - const char *zName; - if( pItem->zDatabase==0 && (zName = pItem->zName)!=0 ){ - With *p; - for(p=pWith; p; p=p->pOuter){ - int i; - for(i=0; inCte; i++){ - if( sqlite3StrICmp(zName, p->a[i].zName)==0 ){ - *ppContext = p; - return &p->a[i]; - } - } - } - } - return 0; -} - -/* The code generator maintains a stack of active WITH clauses -** with the inner-most WITH clause being at the top of the stack. -** -** This routine pushes the WITH clause passed as the second argument -** onto the top of the stack. If argument bFree is true, then this -** WITH clause will never be popped from the stack. In this case it -** should be freed along with the Parse object. In other cases, when -** bFree==0, the With object will be freed along with the SELECT -** statement with which it is associated. -*/ -SQLITE_PRIVATE void sqlite3WithPush(Parse *pParse, With *pWith, u8 bFree){ - assert( bFree==0 || pParse->pWith==0 ); - if( pWith ){ - pWith->pOuter = pParse->pWith; - pParse->pWith = pWith; - pParse->bFreeWith = bFree; - } -} - -/* -** This function checks if argument pFrom refers to a CTE declared by -** a WITH clause on the stack currently maintained by the parser. And, -** if currently processing a CTE expression, if it is a recursive -** reference to the current CTE. -** -** If pFrom falls into either of the two categories above, pFrom->pTab -** and other fields are populated accordingly. The caller should check -** (pFrom->pTab!=0) to determine whether or not a successful match -** was found. -** -** Whether or not a match is found, SQLITE_OK is returned if no error -** occurs. If an error does occur, an error message is stored in the -** parser and some error code other than SQLITE_OK returned. -*/ -static int withExpand( - Walker *pWalker, - struct SrcList_item *pFrom -){ - Parse *pParse = pWalker->pParse; - sqlite3 *db = pParse->db; - struct Cte *pCte; /* Matched CTE (or NULL if no match) */ - With *pWith; /* WITH clause that pCte belongs to */ - - assert( pFrom->pTab==0 ); - - pCte = searchWith(pParse->pWith, pFrom, &pWith); - if( pCte ){ - Table *pTab; - ExprList *pEList; - Select *pSel; - Select *pLeft; /* Left-most SELECT statement */ - int bMayRecursive; /* True if compound joined by UNION [ALL] */ - With *pSavedWith; /* Initial value of pParse->pWith */ - - /* If pCte->zErr is non-NULL at this point, then this is an illegal - ** recursive reference to CTE pCte. Leave an error in pParse and return - ** early. If pCte->zErr is NULL, then this is not a recursive reference. - ** In this case, proceed. */ - if( pCte->zErr ){ - sqlite3ErrorMsg(pParse, pCte->zErr, pCte->zName); - return SQLITE_ERROR; - } - - assert( pFrom->pTab==0 ); - pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table)); - if( pTab==0 ) return WRC_Abort; - pTab->nRef = 1; - pTab->zName = sqlite3DbStrDup(db, pCte->zName); - pTab->iPKey = -1; - pTab->nRowEst = 1048576; - pTab->tabFlags |= TF_Ephemeral; - pFrom->pSelect = sqlite3SelectDup(db, pCte->pSelect, 0); - if( db->mallocFailed ) return SQLITE_NOMEM; - assert( pFrom->pSelect ); - - /* Check if this is a recursive CTE. */ - pSel = pFrom->pSelect; - bMayRecursive = ( pSel->op==TK_ALL || pSel->op==TK_UNION ); - if( bMayRecursive ){ - int i; - SrcList *pSrc = pFrom->pSelect->pSrc; - for(i=0; inSrc; i++){ - struct SrcList_item *pItem = &pSrc->a[i]; - if( pItem->zDatabase==0 - && pItem->zName!=0 - && 0==sqlite3StrICmp(pItem->zName, pCte->zName) - ){ - pItem->pTab = pTab; - pItem->isRecursive = 1; - pTab->nRef++; - pSel->selFlags |= SF_Recursive; - } - } - } - - /* Only one recursive reference is permitted. */ - if( pTab->nRef>2 ){ - sqlite3ErrorMsg( - pParse, "multiple references to recursive table: %s", pCte->zName - ); - return SQLITE_ERROR; - } - assert( pTab->nRef==1 || ((pSel->selFlags&SF_Recursive) && pTab->nRef==2 )); - - pCte->zErr = "circular reference: %s"; - pSavedWith = pParse->pWith; - pParse->pWith = pWith; - sqlite3WalkSelect(pWalker, bMayRecursive ? pSel->pPrior : pSel); - - for(pLeft=pSel; pLeft->pPrior; pLeft=pLeft->pPrior); - pEList = pLeft->pEList; - if( pCte->pCols ){ - if( pEList->nExpr!=pCte->pCols->nExpr ){ - sqlite3ErrorMsg(pParse, "table %s has %d values for %d columns", - pCte->zName, pEList->nExpr, pCte->pCols->nExpr - ); - pParse->pWith = pSavedWith; - return SQLITE_ERROR; - } - pEList = pCte->pCols; - } - - selectColumnsFromExprList(pParse, pEList, &pTab->nCol, &pTab->aCol); - if( bMayRecursive ){ - if( pSel->selFlags & SF_Recursive ){ - pCte->zErr = "multiple recursive references: %s"; - }else{ - pCte->zErr = "recursive reference in a subquery: %s"; - } - sqlite3WalkSelect(pWalker, pSel); - } - pCte->zErr = 0; - pParse->pWith = pSavedWith; - } - - return SQLITE_OK; -} -#endif - -#ifndef SQLITE_OMIT_CTE -/* -** If the SELECT passed as the second argument has an associated WITH -** clause, pop it from the stack stored as part of the Parse object. -** -** This function is used as the xSelectCallback2() callback by -** sqlite3SelectExpand() when walking a SELECT tree to resolve table -** names and other FROM clause elements. -*/ -static void selectPopWith(Walker *pWalker, Select *p){ - Parse *pParse = pWalker->pParse; - if( p->pWith ){ - assert( pParse->pWith==p->pWith ); - pParse->pWith = p->pWith->pOuter; - } -} -#else -#define selectPopWith 0 -#endif - -/* -** This routine is a Walker callback for "expanding" a SELECT statement. -** "Expanding" means to do the following: -** -** (1) Make sure VDBE cursor numbers have been assigned to every -** element of the FROM clause. -** -** (2) Fill in the pTabList->a[].pTab fields in the SrcList that -** defines FROM clause. When views appear in the FROM clause, -** fill pTabList->a[].pSelect with a copy of the SELECT statement -** that implements the view. A copy is made of the view's SELECT -** statement so that we can freely modify or delete that statement -** without worrying about messing up the presistent representation -** of the view. -** -** (3) Add terms to the WHERE clause to accomodate the NATURAL keyword -** on joins and the ON and USING clause of joins. -** -** (4) Scan the list of columns in the result set (pEList) looking -** for instances of the "*" operator or the TABLE.* operator. -** If found, expand each "*" to be every column in every table -** and TABLE.* to be every column in TABLE. -** -*/ -static int selectExpander(Walker *pWalker, Select *p){ - Parse *pParse = pWalker->pParse; - int i, j, k; - SrcList *pTabList; - ExprList *pEList; - struct SrcList_item *pFrom; - sqlite3 *db = pParse->db; - Expr *pE, *pRight, *pExpr; - u16 selFlags = p->selFlags; - - p->selFlags |= SF_Expanded; - if( db->mallocFailed ){ - return WRC_Abort; - } - if( NEVER(p->pSrc==0) || (selFlags & SF_Expanded)!=0 ){ - return WRC_Prune; - } - pTabList = p->pSrc; - pEList = p->pEList; - sqlite3WithPush(pParse, p->pWith, 0); - - /* Make sure cursor numbers have been assigned to all entries in - ** the FROM clause of the SELECT statement. - */ - sqlite3SrcListAssignCursors(pParse, pTabList); - - /* Look up every table named in the FROM clause of the select. If - ** an entry of the FROM clause is a subquery instead of a table or view, - ** then create a transient table structure to describe the subquery. - */ - for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){ - Table *pTab; - assert( pFrom->isRecursive==0 || pFrom->pTab ); - if( pFrom->isRecursive ) continue; - if( pFrom->pTab!=0 ){ - /* This statement has already been prepared. There is no need - ** to go further. */ - assert( i==0 ); -#ifndef SQLITE_OMIT_CTE - selectPopWith(pWalker, p); -#endif - return WRC_Prune; - } -#ifndef SQLITE_OMIT_CTE - if( withExpand(pWalker, pFrom) ) return WRC_Abort; - if( pFrom->pTab ) {} else -#endif - if( pFrom->zName==0 ){ -#ifndef SQLITE_OMIT_SUBQUERY - Select *pSel = pFrom->pSelect; - /* A sub-query in the FROM clause of a SELECT */ - assert( pSel!=0 ); - assert( pFrom->pTab==0 ); - sqlite3WalkSelect(pWalker, pSel); - pFrom->pTab = pTab = sqlite3DbMallocZero(db, sizeof(Table)); - if( pTab==0 ) return WRC_Abort; - pTab->nRef = 1; - pTab->zName = sqlite3MPrintf(db, "sqlite_sq_%p", (void*)pTab); - while( pSel->pPrior ){ pSel = pSel->pPrior; } - selectColumnsFromExprList(pParse, pSel->pEList, &pTab->nCol, &pTab->aCol); - pTab->iPKey = -1; - pTab->nRowEst = 1048576; - pTab->tabFlags |= TF_Ephemeral; -#endif - }else{ - /* An ordinary table or view name in the FROM clause */ - assert( pFrom->pTab==0 ); - pFrom->pTab = pTab = sqlite3LocateTableItem(pParse, 0, pFrom); - if( pTab==0 ) return WRC_Abort; - if( pTab->nRef==0xffff ){ - sqlite3ErrorMsg(pParse, "too many references to \"%s\": max 65535", - pTab->zName); - pFrom->pTab = 0; - return WRC_Abort; - } - pTab->nRef++; -#if !defined(SQLITE_OMIT_VIEW) || !defined (SQLITE_OMIT_VIRTUALTABLE) - if( pTab->pSelect || IsVirtual(pTab) ){ - /* We reach here if the named table is a really a view */ - if( sqlite3ViewGetColumnNames(pParse, pTab) ) return WRC_Abort; - assert( pFrom->pSelect==0 ); - pFrom->pSelect = sqlite3SelectDup(db, pTab->pSelect, 0); - sqlite3WalkSelect(pWalker, pFrom->pSelect); - } -#endif - } - - /* Locate the index named by the INDEXED BY clause, if any. */ - if( sqlite3IndexedByLookup(pParse, pFrom) ){ - return WRC_Abort; - } - } - - /* Process NATURAL keywords, and ON and USING clauses of joins. - */ - if( db->mallocFailed || sqliteProcessJoin(pParse, p) ){ - return WRC_Abort; - } - - /* For every "*" that occurs in the column list, insert the names of - ** all columns in all tables. And for every TABLE.* insert the names - ** of all columns in TABLE. The parser inserted a special expression - ** with the TK_ALL operator for each "*" that it found in the column list. - ** The following code just has to locate the TK_ALL expressions and expand - ** each one to the list of all columns in all tables. - ** - ** The first loop just checks to see if there are any "*" operators - ** that need expanding. - */ - for(k=0; knExpr; k++){ - pE = pEList->a[k].pExpr; - if( pE->op==TK_ALL ) break; - assert( pE->op!=TK_DOT || pE->pRight!=0 ); - assert( pE->op!=TK_DOT || (pE->pLeft!=0 && pE->pLeft->op==TK_ID) ); - if( pE->op==TK_DOT && pE->pRight->op==TK_ALL ) break; - } - if( knExpr ){ - /* - ** If we get here it means the result set contains one or more "*" - ** operators that need to be expanded. Loop through each expression - ** in the result set and expand them one by one. - */ - struct ExprList_item *a = pEList->a; - ExprList *pNew = 0; - int flags = pParse->db->flags; - int longNames = (flags & SQLITE_FullColNames)!=0 - && (flags & SQLITE_ShortColNames)==0; - - /* When processing FROM-clause subqueries, it is always the case - ** that full_column_names=OFF and short_column_names=ON. The - ** sqlite3ResultSetOfSelect() routine makes it so. */ - assert( (p->selFlags & SF_NestedFrom)==0 - || ((flags & SQLITE_FullColNames)==0 && - (flags & SQLITE_ShortColNames)!=0) ); - - for(k=0; knExpr; k++){ - pE = a[k].pExpr; - pRight = pE->pRight; - assert( pE->op!=TK_DOT || pRight!=0 ); - if( pE->op!=TK_ALL && (pE->op!=TK_DOT || pRight->op!=TK_ALL) ){ - /* This particular expression does not need to be expanded. - */ - pNew = sqlite3ExprListAppend(pParse, pNew, a[k].pExpr); - if( pNew ){ - pNew->a[pNew->nExpr-1].zName = a[k].zName; - pNew->a[pNew->nExpr-1].zSpan = a[k].zSpan; - a[k].zName = 0; - a[k].zSpan = 0; - } - a[k].pExpr = 0; - }else{ - /* This expression is a "*" or a "TABLE.*" and needs to be - ** expanded. */ - int tableSeen = 0; /* Set to 1 when TABLE matches */ - char *zTName = 0; /* text of name of TABLE */ - if( pE->op==TK_DOT ){ - assert( pE->pLeft!=0 ); - assert( !ExprHasProperty(pE->pLeft, EP_IntValue) ); - zTName = pE->pLeft->u.zToken; - } - for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){ - Table *pTab = pFrom->pTab; - Select *pSub = pFrom->pSelect; - char *zTabName = pFrom->zAlias; - const char *zSchemaName = 0; - int iDb; - if( zTabName==0 ){ - zTabName = pTab->zName; - } - if( db->mallocFailed ) break; - if( pSub==0 || (pSub->selFlags & SF_NestedFrom)==0 ){ - pSub = 0; - if( zTName && sqlite3StrICmp(zTName, zTabName)!=0 ){ - continue; - } - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - zSchemaName = iDb>=0 ? db->aDb[iDb].zName : "*"; - } - for(j=0; jnCol; j++){ - char *zName = pTab->aCol[j].zName; - char *zColname; /* The computed column name */ - char *zToFree; /* Malloced string that needs to be freed */ - Token sColname; /* Computed column name as a token */ - - assert( zName ); - if( zTName && pSub - && sqlite3MatchSpanName(pSub->pEList->a[j].zSpan, 0, zTName, 0)==0 - ){ - continue; - } - - /* If a column is marked as 'hidden' (currently only possible - ** for virtual tables), do not include it in the expanded - ** result-set list. - */ - if( IsHiddenColumn(&pTab->aCol[j]) ){ - assert(IsVirtual(pTab)); - continue; - } - tableSeen = 1; - - if( i>0 && zTName==0 ){ - if( (pFrom->jointype & JT_NATURAL)!=0 - && tableAndColumnIndex(pTabList, i, zName, 0, 0) - ){ - /* In a NATURAL join, omit the join columns from the - ** table to the right of the join */ - continue; - } - if( sqlite3IdListIndex(pFrom->pUsing, zName)>=0 ){ - /* In a join with a USING clause, omit columns in the - ** using clause from the table on the right. */ - continue; - } - } - pRight = sqlite3Expr(db, TK_ID, zName); - zColname = zName; - zToFree = 0; - if( longNames || pTabList->nSrc>1 ){ - Expr *pLeft; - pLeft = sqlite3Expr(db, TK_ID, zTabName); - pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); - if( zSchemaName ){ - pLeft = sqlite3Expr(db, TK_ID, zSchemaName); - pExpr = sqlite3PExpr(pParse, TK_DOT, pLeft, pExpr, 0); - } - if( longNames ){ - zColname = sqlite3MPrintf(db, "%s.%s", zTabName, zName); - zToFree = zColname; - } - }else{ - pExpr = pRight; - } - pNew = sqlite3ExprListAppend(pParse, pNew, pExpr); - sColname.z = zColname; - sColname.n = sqlite3Strlen30(zColname); - sqlite3ExprListSetName(pParse, pNew, &sColname, 0); - if( pNew && (p->selFlags & SF_NestedFrom)!=0 ){ - struct ExprList_item *pX = &pNew->a[pNew->nExpr-1]; - if( pSub ){ - pX->zSpan = sqlite3DbStrDup(db, pSub->pEList->a[j].zSpan); - testcase( pX->zSpan==0 ); - }else{ - pX->zSpan = sqlite3MPrintf(db, "%s.%s.%s", - zSchemaName, zTabName, zColname); - testcase( pX->zSpan==0 ); - } - pX->bSpanIsTab = 1; - } - sqlite3DbFree(db, zToFree); - } - } - if( !tableSeen ){ - if( zTName ){ - sqlite3ErrorMsg(pParse, "no such table: %s", zTName); - }else{ - sqlite3ErrorMsg(pParse, "no tables specified"); - } - } - } - } - sqlite3ExprListDelete(db, pEList); - p->pEList = pNew; - } -#if SQLITE_MAX_COLUMN - if( p->pEList && p->pEList->nExpr>db->aLimit[SQLITE_LIMIT_COLUMN] ){ - sqlite3ErrorMsg(pParse, "too many columns in result set"); - } -#endif - return WRC_Continue; -} - -/* -** No-op routine for the parse-tree walker. -** -** When this routine is the Walker.xExprCallback then expression trees -** are walked without any actions being taken at each node. Presumably, -** when this routine is used for Walker.xExprCallback then -** Walker.xSelectCallback is set to do something useful for every -** subquery in the parser tree. -*/ -static int exprWalkNoop(Walker *NotUsed, Expr *NotUsed2){ - UNUSED_PARAMETER2(NotUsed, NotUsed2); - return WRC_Continue; -} - -/* -** This routine "expands" a SELECT statement and all of its subqueries. -** For additional information on what it means to "expand" a SELECT -** statement, see the comment on the selectExpand worker callback above. -** -** Expanding a SELECT statement is the first step in processing a -** SELECT statement. The SELECT statement must be expanded before -** name resolution is performed. -** -** If anything goes wrong, an error message is written into pParse. -** The calling function can detect the problem by looking at pParse->nErr -** and/or pParse->db->mallocFailed. -*/ -static void sqlite3SelectExpand(Parse *pParse, Select *pSelect){ - Walker w; - memset(&w, 0, sizeof(w)); - w.xExprCallback = exprWalkNoop; - w.pParse = pParse; - if( pParse->hasCompound ){ - w.xSelectCallback = convertCompoundSelectToSubquery; - sqlite3WalkSelect(&w, pSelect); - } - w.xSelectCallback = selectExpander; - w.xSelectCallback2 = selectPopWith; - sqlite3WalkSelect(&w, pSelect); -} - - -#ifndef SQLITE_OMIT_SUBQUERY -/* -** This is a Walker.xSelectCallback callback for the sqlite3SelectTypeInfo() -** interface. -** -** For each FROM-clause subquery, add Column.zType and Column.zColl -** information to the Table structure that represents the result set -** of that subquery. -** -** The Table structure that represents the result set was constructed -** by selectExpander() but the type and collation information was omitted -** at that point because identifiers had not yet been resolved. This -** routine is called after identifier resolution. -*/ -static void selectAddSubqueryTypeInfo(Walker *pWalker, Select *p){ - Parse *pParse; - int i; - SrcList *pTabList; - struct SrcList_item *pFrom; - - assert( p->selFlags & SF_Resolved ); - if( (p->selFlags & SF_HasTypeInfo)==0 ){ - p->selFlags |= SF_HasTypeInfo; - pParse = pWalker->pParse; - pTabList = p->pSrc; - for(i=0, pFrom=pTabList->a; inSrc; i++, pFrom++){ - Table *pTab = pFrom->pTab; - if( ALWAYS(pTab!=0) && (pTab->tabFlags & TF_Ephemeral)!=0 ){ - /* A sub-query in the FROM clause of a SELECT */ - Select *pSel = pFrom->pSelect; - if( pSel ){ - while( pSel->pPrior ) pSel = pSel->pPrior; - selectAddColumnTypeAndCollation(pParse, pTab, pSel); - } - } - } - } -} -#endif - - -/* -** This routine adds datatype and collating sequence information to -** the Table structures of all FROM-clause subqueries in a -** SELECT statement. -** -** Use this routine after name resolution. -*/ -static void sqlite3SelectAddTypeInfo(Parse *pParse, Select *pSelect){ -#ifndef SQLITE_OMIT_SUBQUERY - Walker w; - memset(&w, 0, sizeof(w)); - w.xSelectCallback2 = selectAddSubqueryTypeInfo; - w.xExprCallback = exprWalkNoop; - w.pParse = pParse; - sqlite3WalkSelect(&w, pSelect); -#endif -} - - -/* -** This routine sets up a SELECT statement for processing. The -** following is accomplished: -** -** * VDBE Cursor numbers are assigned to all FROM-clause terms. -** * Ephemeral Table objects are created for all FROM-clause subqueries. -** * ON and USING clauses are shifted into WHERE statements -** * Wildcards "*" and "TABLE.*" in result sets are expanded. -** * Identifiers in expression are matched to tables. -** -** This routine acts recursively on all subqueries within the SELECT. -*/ -SQLITE_PRIVATE void sqlite3SelectPrep( - Parse *pParse, /* The parser context */ - Select *p, /* The SELECT statement being coded. */ - NameContext *pOuterNC /* Name context for container */ -){ - sqlite3 *db; - if( NEVER(p==0) ) return; - db = pParse->db; - if( db->mallocFailed ) return; - if( p->selFlags & SF_HasTypeInfo ) return; - sqlite3SelectExpand(pParse, p); - if( pParse->nErr || db->mallocFailed ) return; - sqlite3ResolveSelectNames(pParse, p, pOuterNC); - if( pParse->nErr || db->mallocFailed ) return; - sqlite3SelectAddTypeInfo(pParse, p); -} - -/* -** Reset the aggregate accumulator. -** -** The aggregate accumulator is a set of memory cells that hold -** intermediate results while calculating an aggregate. This -** routine generates code that stores NULLs in all of those memory -** cells. -*/ -static void resetAccumulator(Parse *pParse, AggInfo *pAggInfo){ - Vdbe *v = pParse->pVdbe; - int i; - struct AggInfo_func *pFunc; - int nReg = pAggInfo->nFunc + pAggInfo->nColumn; - if( nReg==0 ) return; -#ifdef SQLITE_DEBUG - /* Verify that all AggInfo registers are within the range specified by - ** AggInfo.mnReg..AggInfo.mxReg */ - assert( nReg==pAggInfo->mxReg-pAggInfo->mnReg+1 ); - for(i=0; inColumn; i++){ - assert( pAggInfo->aCol[i].iMem>=pAggInfo->mnReg - && pAggInfo->aCol[i].iMem<=pAggInfo->mxReg ); - } - for(i=0; inFunc; i++){ - assert( pAggInfo->aFunc[i].iMem>=pAggInfo->mnReg - && pAggInfo->aFunc[i].iMem<=pAggInfo->mxReg ); - } -#endif - sqlite3VdbeAddOp3(v, OP_Null, 0, pAggInfo->mnReg, pAggInfo->mxReg); - for(pFunc=pAggInfo->aFunc, i=0; inFunc; i++, pFunc++){ - if( pFunc->iDistinct>=0 ){ - Expr *pE = pFunc->pExpr; - assert( !ExprHasProperty(pE, EP_xIsSelect) ); - if( pE->x.pList==0 || pE->x.pList->nExpr!=1 ){ - sqlite3ErrorMsg(pParse, "DISTINCT aggregates must have exactly one " - "argument"); - pFunc->iDistinct = -1; - }else{ - KeyInfo *pKeyInfo = keyInfoFromExprList(pParse, pE->x.pList, 0); - sqlite3VdbeAddOp4(v, OP_OpenEphemeral, pFunc->iDistinct, 0, 0, - (char*)pKeyInfo, P4_KEYINFO); - } - } - } -} - -/* -** Invoke the OP_AggFinalize opcode for every aggregate function -** in the AggInfo structure. -*/ -static void finalizeAggFunctions(Parse *pParse, AggInfo *pAggInfo){ - Vdbe *v = pParse->pVdbe; - int i; - struct AggInfo_func *pF; - for(i=0, pF=pAggInfo->aFunc; inFunc; i++, pF++){ - ExprList *pList = pF->pExpr->x.pList; - assert( !ExprHasProperty(pF->pExpr, EP_xIsSelect) ); - sqlite3VdbeAddOp4(v, OP_AggFinal, pF->iMem, pList ? pList->nExpr : 0, 0, - (void*)pF->pFunc, P4_FUNCDEF); - } -} - -/* -** Update the accumulator memory cells for an aggregate based on -** the current cursor position. -*/ -static void updateAccumulator(Parse *pParse, AggInfo *pAggInfo){ - Vdbe *v = pParse->pVdbe; - int i; - int regHit = 0; - int addrHitTest = 0; - struct AggInfo_func *pF; - struct AggInfo_col *pC; - - pAggInfo->directMode = 1; - for(i=0, pF=pAggInfo->aFunc; inFunc; i++, pF++){ - int nArg; - int addrNext = 0; - int regAgg; - ExprList *pList = pF->pExpr->x.pList; - assert( !ExprHasProperty(pF->pExpr, EP_xIsSelect) ); - if( pList ){ - nArg = pList->nExpr; - regAgg = sqlite3GetTempRange(pParse, nArg); - sqlite3ExprCodeExprList(pParse, pList, regAgg, SQLITE_ECEL_DUP); - }else{ - nArg = 0; - regAgg = 0; - } - if( pF->iDistinct>=0 ){ - addrNext = sqlite3VdbeMakeLabel(v); - assert( nArg==1 ); - codeDistinct(pParse, pF->iDistinct, addrNext, 1, regAgg); - } - if( pF->pFunc->funcFlags & SQLITE_FUNC_NEEDCOLL ){ - CollSeq *pColl = 0; - struct ExprList_item *pItem; - int j; - assert( pList!=0 ); /* pList!=0 if pF->pFunc has NEEDCOLL */ - for(j=0, pItem=pList->a; !pColl && jpExpr); - } - if( !pColl ){ - pColl = pParse->db->pDfltColl; - } - if( regHit==0 && pAggInfo->nAccumulator ) regHit = ++pParse->nMem; - sqlite3VdbeAddOp4(v, OP_CollSeq, regHit, 0, 0, (char *)pColl, P4_COLLSEQ); - } - sqlite3VdbeAddOp4(v, OP_AggStep, 0, regAgg, pF->iMem, - (void*)pF->pFunc, P4_FUNCDEF); - sqlite3VdbeChangeP5(v, (u8)nArg); - sqlite3ExprCacheAffinityChange(pParse, regAgg, nArg); - sqlite3ReleaseTempRange(pParse, regAgg, nArg); - if( addrNext ){ - sqlite3VdbeResolveLabel(v, addrNext); - sqlite3ExprCacheClear(pParse); - } - } - - /* Before populating the accumulator registers, clear the column cache. - ** Otherwise, if any of the required column values are already present - ** in registers, sqlite3ExprCode() may use OP_SCopy to copy the value - ** to pC->iMem. But by the time the value is used, the original register - ** may have been used, invalidating the underlying buffer holding the - ** text or blob value. See ticket [883034dcb5]. - ** - ** Another solution would be to change the OP_SCopy used to copy cached - ** values to an OP_Copy. - */ - if( regHit ){ - addrHitTest = sqlite3VdbeAddOp1(v, OP_If, regHit); - } - sqlite3ExprCacheClear(pParse); - for(i=0, pC=pAggInfo->aCol; inAccumulator; i++, pC++){ - sqlite3ExprCode(pParse, pC->pExpr, pC->iMem); - } - pAggInfo->directMode = 0; - sqlite3ExprCacheClear(pParse); - if( addrHitTest ){ - sqlite3VdbeJumpHere(v, addrHitTest); - } -} - -/* -** Add a single OP_Explain instruction to the VDBE to explain a simple -** count(*) query ("SELECT count(*) FROM pTab"). -*/ -#ifndef SQLITE_OMIT_EXPLAIN -static void explainSimpleCount( - Parse *pParse, /* Parse context */ - Table *pTab, /* Table being queried */ - Index *pIdx /* Index used to optimize scan, or NULL */ -){ - if( pParse->explain==2 ){ - char *zEqp = sqlite3MPrintf(pParse->db, "SCAN TABLE %s%s%s", - pTab->zName, - pIdx ? " USING COVERING INDEX " : "", - pIdx ? pIdx->zName : "" - ); - sqlite3VdbeAddOp4( - pParse->pVdbe, OP_Explain, pParse->iSelectId, 0, 0, zEqp, P4_DYNAMIC - ); - } -} -#else -# define explainSimpleCount(a,b,c) -#endif - -/* -** Generate code for the SELECT statement given in the p argument. -** -** The results are returned according to the SelectDest structure. -** See comments in sqliteInt.h for further information. -** -** This routine returns the number of errors. If any errors are -** encountered, then an appropriate error message is left in -** pParse->zErrMsg. -** -** This routine does NOT free the Select structure passed in. The -** calling function needs to do that. -*/ -SQLITE_PRIVATE int sqlite3Select( - Parse *pParse, /* The parser context */ - Select *p, /* The SELECT statement being coded. */ - SelectDest *pDest /* What to do with the query results */ -){ - int i, j; /* Loop counters */ - WhereInfo *pWInfo; /* Return from sqlite3WhereBegin() */ - Vdbe *v; /* The virtual machine under construction */ - int isAgg; /* True for select lists like "count(*)" */ - ExprList *pEList; /* List of columns to extract. */ - SrcList *pTabList; /* List of tables to select from */ - Expr *pWhere; /* The WHERE clause. May be NULL */ - ExprList *pOrderBy; /* The ORDER BY clause. May be NULL */ - ExprList *pGroupBy; /* The GROUP BY clause. May be NULL */ - Expr *pHaving; /* The HAVING clause. May be NULL */ - int rc = 1; /* Value to return from this function */ - int addrSortIndex; /* Address of an OP_OpenEphemeral instruction */ - DistinctCtx sDistinct; /* Info on how to code the DISTINCT keyword */ - AggInfo sAggInfo; /* Information used by aggregate queries */ - int iEnd; /* Address of the end of the query */ - sqlite3 *db; /* The database connection */ - -#ifndef SQLITE_OMIT_EXPLAIN - int iRestoreSelectId = pParse->iSelectId; - pParse->iSelectId = pParse->iNextSelectId++; -#endif - - db = pParse->db; - if( p==0 || db->mallocFailed || pParse->nErr ){ - return 1; - } - if( sqlite3AuthCheck(pParse, SQLITE_SELECT, 0, 0, 0) ) return 1; - memset(&sAggInfo, 0, sizeof(sAggInfo)); - - if( IgnorableOrderby(pDest) ){ - assert(pDest->eDest==SRT_Exists || pDest->eDest==SRT_Union || - pDest->eDest==SRT_Except || pDest->eDest==SRT_Discard); - /* If ORDER BY makes no difference in the output then neither does - ** DISTINCT so it can be removed too. */ - sqlite3ExprListDelete(db, p->pOrderBy); - p->pOrderBy = 0; - p->selFlags &= ~SF_Distinct; - } - sqlite3SelectPrep(pParse, p, 0); - pOrderBy = p->pOrderBy; - pTabList = p->pSrc; - pEList = p->pEList; - if( pParse->nErr || db->mallocFailed ){ - goto select_end; - } - isAgg = (p->selFlags & SF_Aggregate)!=0; - assert( pEList!=0 ); - - /* Begin generating code. - */ - v = sqlite3GetVdbe(pParse); - if( v==0 ) goto select_end; - - /* If writing to memory or generating a set - ** only a single column may be output. - */ -#ifndef SQLITE_OMIT_SUBQUERY - if( checkForMultiColumnSelectError(pParse, pDest, pEList->nExpr) ){ - goto select_end; - } -#endif - - /* Generate code for all sub-queries in the FROM clause - */ -#if !defined(SQLITE_OMIT_SUBQUERY) || !defined(SQLITE_OMIT_VIEW) - for(i=0; !p->pPrior && inSrc; i++){ - struct SrcList_item *pItem = &pTabList->a[i]; - SelectDest dest; - Select *pSub = pItem->pSelect; - int isAggSub; - - if( pSub==0 ) continue; - - /* Sometimes the code for a subquery will be generated more than - ** once, if the subquery is part of the WHERE clause in a LEFT JOIN, - ** for example. In that case, do not regenerate the code to manifest - ** a view or the co-routine to implement a view. The first instance - ** is sufficient, though the subroutine to manifest the view does need - ** to be invoked again. */ - if( pItem->addrFillSub ){ - if( pItem->viaCoroutine==0 ){ - sqlite3VdbeAddOp2(v, OP_Gosub, pItem->regReturn, pItem->addrFillSub); - } - continue; - } - - /* Increment Parse.nHeight by the height of the largest expression - ** tree referred to by this, the parent select. The child select - ** may contain expression trees of at most - ** (SQLITE_MAX_EXPR_DEPTH-Parse.nHeight) height. This is a bit - ** more conservative than necessary, but much easier than enforcing - ** an exact limit. - */ - pParse->nHeight += sqlite3SelectExprHeight(p); - - isAggSub = (pSub->selFlags & SF_Aggregate)!=0; - if( flattenSubquery(pParse, p, i, isAgg, isAggSub) ){ - /* This subquery can be absorbed into its parent. */ - if( isAggSub ){ - isAgg = 1; - p->selFlags |= SF_Aggregate; - } - i = -1; - }else if( pTabList->nSrc==1 && (p->selFlags & SF_Materialize)==0 - && OptimizationEnabled(db, SQLITE_SubqCoroutine) - ){ - /* Implement a co-routine that will return a single row of the result - ** set on each invocation. - */ - int addrTop; - int addrEof; - pItem->regReturn = ++pParse->nMem; - addrEof = ++pParse->nMem; - /* Before coding the OP_Goto to jump to the start of the main routine, - ** ensure that the jump to the verify-schema routine has already - ** been coded. Otherwise, the verify-schema would likely be coded as - ** part of the co-routine. If the main routine then accessed the - ** database before invoking the co-routine for the first time (for - ** example to initialize a LIMIT register from a sub-select), it would - ** be doing so without having verified the schema version and obtained - ** the required db locks. See ticket d6b36be38. */ - sqlite3CodeVerifySchema(pParse, -1); - sqlite3VdbeAddOp0(v, OP_Goto); - addrTop = sqlite3VdbeAddOp1(v, OP_OpenPseudo, pItem->iCursor); - sqlite3VdbeChangeP5(v, 1); - VdbeComment((v, "coroutine for %s", pItem->pTab->zName)); - pItem->addrFillSub = addrTop; - sqlite3VdbeAddOp2(v, OP_Integer, 0, addrEof); - sqlite3VdbeChangeP5(v, 1); - sqlite3SelectDestInit(&dest, SRT_Coroutine, pItem->regReturn); - explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId); - sqlite3Select(pParse, pSub, &dest); - pItem->pTab->nRowEst = (unsigned)pSub->nSelectRow; - pItem->viaCoroutine = 1; - sqlite3VdbeChangeP2(v, addrTop, dest.iSdst); - sqlite3VdbeChangeP3(v, addrTop, dest.nSdst); - sqlite3VdbeAddOp2(v, OP_Integer, 1, addrEof); - sqlite3VdbeAddOp1(v, OP_Yield, pItem->regReturn); - VdbeComment((v, "end %s", pItem->pTab->zName)); - sqlite3VdbeJumpHere(v, addrTop-1); - sqlite3ClearTempRegCache(pParse); - }else{ - /* Generate a subroutine that will fill an ephemeral table with - ** the content of this subquery. pItem->addrFillSub will point - ** to the address of the generated subroutine. pItem->regReturn - ** is a register allocated to hold the subroutine return address - */ - int topAddr; - int onceAddr = 0; - int retAddr; - assert( pItem->addrFillSub==0 ); - pItem->regReturn = ++pParse->nMem; - topAddr = sqlite3VdbeAddOp2(v, OP_Integer, 0, pItem->regReturn); - pItem->addrFillSub = topAddr+1; - VdbeNoopComment((v, "materialize %s", pItem->pTab->zName)); - if( pItem->isCorrelated==0 ){ - /* If the subquery is not correlated and if we are not inside of - ** a trigger, then we only need to compute the value of the subquery - ** once. */ - onceAddr = sqlite3CodeOnce(pParse); - } - sqlite3SelectDestInit(&dest, SRT_EphemTab, pItem->iCursor); - explainSetInteger(pItem->iSelectId, (u8)pParse->iNextSelectId); - sqlite3Select(pParse, pSub, &dest); - pItem->pTab->nRowEst = (unsigned)pSub->nSelectRow; - if( onceAddr ) sqlite3VdbeJumpHere(v, onceAddr); - retAddr = sqlite3VdbeAddOp1(v, OP_Return, pItem->regReturn); - VdbeComment((v, "end %s", pItem->pTab->zName)); - sqlite3VdbeChangeP1(v, topAddr, retAddr); - sqlite3ClearTempRegCache(pParse); - } - if( /*pParse->nErr ||*/ db->mallocFailed ){ - goto select_end; - } - pParse->nHeight -= sqlite3SelectExprHeight(p); - pTabList = p->pSrc; - if( !IgnorableOrderby(pDest) ){ - pOrderBy = p->pOrderBy; - } - } - pEList = p->pEList; -#endif - pWhere = p->pWhere; - pGroupBy = p->pGroupBy; - pHaving = p->pHaving; - sDistinct.isTnct = (p->selFlags & SF_Distinct)!=0; - -#ifndef SQLITE_OMIT_COMPOUND_SELECT - /* If there is are a sequence of queries, do the earlier ones first. - */ - if( p->pPrior ){ - if( p->pRightmost==0 ){ - Select *pLoop, *pRight = 0; - int cnt = 0; - int mxSelect; - for(pLoop=p; pLoop; pLoop=pLoop->pPrior, cnt++){ - pLoop->pRightmost = p; - pLoop->pNext = pRight; - pRight = pLoop; - } - mxSelect = db->aLimit[SQLITE_LIMIT_COMPOUND_SELECT]; - if( mxSelect && cnt>mxSelect ){ - sqlite3ErrorMsg(pParse, "too many terms in compound SELECT"); - goto select_end; - } - } - rc = multiSelect(pParse, p, pDest); - explainSetInteger(pParse->iSelectId, iRestoreSelectId); - return rc; - } -#endif - - /* If there is both a GROUP BY and an ORDER BY clause and they are - ** identical, then disable the ORDER BY clause since the GROUP BY - ** will cause elements to come out in the correct order. This is - ** an optimization - the correct answer should result regardless. - ** Use the SQLITE_GroupByOrder flag with SQLITE_TESTCTRL_OPTIMIZER - ** to disable this optimization for testing purposes. - */ - if( sqlite3ExprListCompare(p->pGroupBy, pOrderBy, -1)==0 - && OptimizationEnabled(db, SQLITE_GroupByOrder) ){ - pOrderBy = 0; - } - - /* If the query is DISTINCT with an ORDER BY but is not an aggregate, and - ** if the select-list is the same as the ORDER BY list, then this query - ** can be rewritten as a GROUP BY. In other words, this: - ** - ** SELECT DISTINCT xyz FROM ... ORDER BY xyz - ** - ** is transformed to: - ** - ** SELECT xyz FROM ... GROUP BY xyz - ** - ** The second form is preferred as a single index (or temp-table) may be - ** used for both the ORDER BY and DISTINCT processing. As originally - ** written the query must use a temp-table for at least one of the ORDER - ** BY and DISTINCT, and an index or separate temp-table for the other. - */ - if( (p->selFlags & (SF_Distinct|SF_Aggregate))==SF_Distinct - && sqlite3ExprListCompare(pOrderBy, p->pEList, -1)==0 - ){ - p->selFlags &= ~SF_Distinct; - p->pGroupBy = sqlite3ExprListDup(db, p->pEList, 0); - pGroupBy = p->pGroupBy; - pOrderBy = 0; - /* Notice that even thought SF_Distinct has been cleared from p->selFlags, - ** the sDistinct.isTnct is still set. Hence, isTnct represents the - ** original setting of the SF_Distinct flag, not the current setting */ - assert( sDistinct.isTnct ); - } - - /* If there is an ORDER BY clause, then this sorting - ** index might end up being unused if the data can be - ** extracted in pre-sorted order. If that is the case, then the - ** OP_OpenEphemeral instruction will be changed to an OP_Noop once - ** we figure out that the sorting index is not needed. The addrSortIndex - ** variable is used to facilitate that change. - */ - if( pOrderBy ){ - KeyInfo *pKeyInfo; - pKeyInfo = keyInfoFromExprList(pParse, pOrderBy, 0); - pOrderBy->iECursor = pParse->nTab++; - p->addrOpenEphm[2] = addrSortIndex = - sqlite3VdbeAddOp4(v, OP_OpenEphemeral, - pOrderBy->iECursor, pOrderBy->nExpr+2, 0, - (char*)pKeyInfo, P4_KEYINFO); - }else{ - addrSortIndex = -1; - } - - /* If the output is destined for a temporary table, open that table. - */ - if( pDest->eDest==SRT_EphemTab ){ - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, pDest->iSDParm, pEList->nExpr); - } - - /* Set the limiter. - */ - iEnd = sqlite3VdbeMakeLabel(v); - p->nSelectRow = LARGEST_INT64; - computeLimitRegisters(pParse, p, iEnd); - if( p->iLimit==0 && addrSortIndex>=0 ){ - sqlite3VdbeGetOp(v, addrSortIndex)->opcode = OP_SorterOpen; - p->selFlags |= SF_UseSorter; - } - - /* Open a virtual index to use for the distinct set. - */ - if( p->selFlags & SF_Distinct ){ - sDistinct.tabTnct = pParse->nTab++; - sDistinct.addrTnct = sqlite3VdbeAddOp4(v, OP_OpenEphemeral, - sDistinct.tabTnct, 0, 0, - (char*)keyInfoFromExprList(pParse, p->pEList, 0), - P4_KEYINFO); - sqlite3VdbeChangeP5(v, BTREE_UNORDERED); - sDistinct.eTnctType = WHERE_DISTINCT_UNORDERED; - }else{ - sDistinct.eTnctType = WHERE_DISTINCT_NOOP; - } - - if( !isAgg && pGroupBy==0 ){ - /* No aggregate functions and no GROUP BY clause */ - u16 wctrlFlags = (sDistinct.isTnct ? WHERE_WANT_DISTINCT : 0); - - /* Begin the database scan. */ - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pOrderBy, p->pEList, - wctrlFlags, 0); - if( pWInfo==0 ) goto select_end; - if( sqlite3WhereOutputRowCount(pWInfo) < p->nSelectRow ){ - p->nSelectRow = sqlite3WhereOutputRowCount(pWInfo); - } - if( sDistinct.isTnct && sqlite3WhereIsDistinct(pWInfo) ){ - sDistinct.eTnctType = sqlite3WhereIsDistinct(pWInfo); - } - if( pOrderBy && sqlite3WhereIsOrdered(pWInfo) ) pOrderBy = 0; - - /* If sorting index that was created by a prior OP_OpenEphemeral - ** instruction ended up not being needed, then change the OP_OpenEphemeral - ** into an OP_Noop. - */ - if( addrSortIndex>=0 && pOrderBy==0 ){ - sqlite3VdbeChangeToNoop(v, addrSortIndex); - p->addrOpenEphm[2] = -1; - } - - /* Use the standard inner loop. */ - selectInnerLoop(pParse, p, pEList, -1, pOrderBy, &sDistinct, pDest, - sqlite3WhereContinueLabel(pWInfo), - sqlite3WhereBreakLabel(pWInfo)); - - /* End the database scan loop. - */ - sqlite3WhereEnd(pWInfo); - }else{ - /* This case when there exist aggregate functions or a GROUP BY clause - ** or both */ - NameContext sNC; /* Name context for processing aggregate information */ - int iAMem; /* First Mem address for storing current GROUP BY */ - int iBMem; /* First Mem address for previous GROUP BY */ - int iUseFlag; /* Mem address holding flag indicating that at least - ** one row of the input to the aggregator has been - ** processed */ - int iAbortFlag; /* Mem address which causes query abort if positive */ - int groupBySort; /* Rows come from source in GROUP BY order */ - int addrEnd; /* End of processing for this SELECT */ - int sortPTab = 0; /* Pseudotable used to decode sorting results */ - int sortOut = 0; /* Output register from the sorter */ - - /* Remove any and all aliases between the result set and the - ** GROUP BY clause. - */ - if( pGroupBy ){ - int k; /* Loop counter */ - struct ExprList_item *pItem; /* For looping over expression in a list */ - - for(k=p->pEList->nExpr, pItem=p->pEList->a; k>0; k--, pItem++){ - pItem->u.x.iAlias = 0; - } - for(k=pGroupBy->nExpr, pItem=pGroupBy->a; k>0; k--, pItem++){ - pItem->u.x.iAlias = 0; - } - if( p->nSelectRow>100 ) p->nSelectRow = 100; - }else{ - p->nSelectRow = 1; - } - - - /* Create a label to jump to when we want to abort the query */ - addrEnd = sqlite3VdbeMakeLabel(v); - - /* Convert TK_COLUMN nodes into TK_AGG_COLUMN and make entries in - ** sAggInfo for all TK_AGG_FUNCTION nodes in expressions of the - ** SELECT statement. - */ - memset(&sNC, 0, sizeof(sNC)); - sNC.pParse = pParse; - sNC.pSrcList = pTabList; - sNC.pAggInfo = &sAggInfo; - sAggInfo.mnReg = pParse->nMem+1; - sAggInfo.nSortingColumn = pGroupBy ? pGroupBy->nExpr+1 : 0; - sAggInfo.pGroupBy = pGroupBy; - sqlite3ExprAnalyzeAggList(&sNC, pEList); - sqlite3ExprAnalyzeAggList(&sNC, pOrderBy); - if( pHaving ){ - sqlite3ExprAnalyzeAggregates(&sNC, pHaving); - } - sAggInfo.nAccumulator = sAggInfo.nColumn; - for(i=0; ix.pList); - sNC.ncFlags &= ~NC_InAggFunc; - } - sAggInfo.mxReg = pParse->nMem; - if( db->mallocFailed ) goto select_end; - - /* Processing for aggregates with GROUP BY is very different and - ** much more complex than aggregates without a GROUP BY. - */ - if( pGroupBy ){ - KeyInfo *pKeyInfo; /* Keying information for the group by clause */ - int j1; /* A-vs-B comparision jump */ - int addrOutputRow; /* Start of subroutine that outputs a result row */ - int regOutputRow; /* Return address register for output subroutine */ - int addrSetAbort; /* Set the abort flag and return */ - int addrTopOfLoop; /* Top of the input loop */ - int addrSortingIdx; /* The OP_OpenEphemeral for the sorting index */ - int addrReset; /* Subroutine for resetting the accumulator */ - int regReset; /* Return address register for reset subroutine */ - - /* If there is a GROUP BY clause we might need a sorting index to - ** implement it. Allocate that sorting index now. If it turns out - ** that we do not need it after all, the OP_SorterOpen instruction - ** will be converted into a Noop. - */ - sAggInfo.sortingIdx = pParse->nTab++; - pKeyInfo = keyInfoFromExprList(pParse, pGroupBy, 0); - addrSortingIdx = sqlite3VdbeAddOp4(v, OP_SorterOpen, - sAggInfo.sortingIdx, sAggInfo.nSortingColumn, - 0, (char*)pKeyInfo, P4_KEYINFO); - - /* Initialize memory locations used by GROUP BY aggregate processing - */ - iUseFlag = ++pParse->nMem; - iAbortFlag = ++pParse->nMem; - regOutputRow = ++pParse->nMem; - addrOutputRow = sqlite3VdbeMakeLabel(v); - regReset = ++pParse->nMem; - addrReset = sqlite3VdbeMakeLabel(v); - iAMem = pParse->nMem + 1; - pParse->nMem += pGroupBy->nExpr; - iBMem = pParse->nMem + 1; - pParse->nMem += pGroupBy->nExpr; - sqlite3VdbeAddOp2(v, OP_Integer, 0, iAbortFlag); - VdbeComment((v, "clear abort flag")); - sqlite3VdbeAddOp2(v, OP_Integer, 0, iUseFlag); - VdbeComment((v, "indicate accumulator empty")); - sqlite3VdbeAddOp3(v, OP_Null, 0, iAMem, iAMem+pGroupBy->nExpr-1); - - /* Begin a loop that will extract all source rows in GROUP BY order. - ** This might involve two separate loops with an OP_Sort in between, or - ** it might be a single loop that uses an index to extract information - ** in the right order to begin with. - */ - sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pGroupBy, 0, - WHERE_GROUPBY, 0); - if( pWInfo==0 ) goto select_end; - if( sqlite3WhereIsOrdered(pWInfo) ){ - /* The optimizer is able to deliver rows in group by order so - ** we do not have to sort. The OP_OpenEphemeral table will be - ** cancelled later because we still need to use the pKeyInfo - */ - groupBySort = 0; - }else{ - /* Rows are coming out in undetermined order. We have to push - ** each row into a sorting index, terminate the first loop, - ** then loop over the sorting index in order to get the output - ** in sorted order - */ - int regBase; - int regRecord; - int nCol; - int nGroupBy; - - explainTempTable(pParse, - (sDistinct.isTnct && (p->selFlags&SF_Distinct)==0) ? - "DISTINCT" : "GROUP BY"); - - groupBySort = 1; - nGroupBy = pGroupBy->nExpr; - nCol = nGroupBy + 1; - j = nGroupBy+1; - for(i=0; i=j ){ - nCol++; - j++; - } - } - regBase = sqlite3GetTempRange(pParse, nCol); - sqlite3ExprCacheClear(pParse); - sqlite3ExprCodeExprList(pParse, pGroupBy, regBase, 0); - sqlite3VdbeAddOp2(v, OP_Sequence, sAggInfo.sortingIdx,regBase+nGroupBy); - j = nGroupBy+1; - for(i=0; iiSorterColumn>=j ){ - int r1 = j + regBase; - int r2; - - r2 = sqlite3ExprCodeGetColumn(pParse, - pCol->pTab, pCol->iColumn, pCol->iTable, r1, 0); - if( r1!=r2 ){ - sqlite3VdbeAddOp2(v, OP_SCopy, r2, r1); - } - j++; - } - } - regRecord = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_MakeRecord, regBase, nCol, regRecord); - sqlite3VdbeAddOp2(v, OP_SorterInsert, sAggInfo.sortingIdx, regRecord); - sqlite3ReleaseTempReg(pParse, regRecord); - sqlite3ReleaseTempRange(pParse, regBase, nCol); - sqlite3WhereEnd(pWInfo); - sAggInfo.sortingIdxPTab = sortPTab = pParse->nTab++; - sortOut = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp3(v, OP_OpenPseudo, sortPTab, sortOut, nCol); - sqlite3VdbeAddOp2(v, OP_SorterSort, sAggInfo.sortingIdx, addrEnd); - VdbeComment((v, "GROUP BY sort")); - sAggInfo.useSortingIdx = 1; - sqlite3ExprCacheClear(pParse); - } - - /* Evaluate the current GROUP BY terms and store in b0, b1, b2... - ** (b0 is memory location iBMem+0, b1 is iBMem+1, and so forth) - ** Then compare the current GROUP BY terms against the GROUP BY terms - ** from the previous row currently stored in a0, a1, a2... - */ - addrTopOfLoop = sqlite3VdbeCurrentAddr(v); - sqlite3ExprCacheClear(pParse); - if( groupBySort ){ - sqlite3VdbeAddOp2(v, OP_SorterData, sAggInfo.sortingIdx, sortOut); - } - for(j=0; jnExpr; j++){ - if( groupBySort ){ - sqlite3VdbeAddOp3(v, OP_Column, sortPTab, j, iBMem+j); - if( j==0 ) sqlite3VdbeChangeP5(v, OPFLAG_CLEARCACHE); - }else{ - sAggInfo.directMode = 1; - sqlite3ExprCode(pParse, pGroupBy->a[j].pExpr, iBMem+j); - } - } - sqlite3VdbeAddOp4(v, OP_Compare, iAMem, iBMem, pGroupBy->nExpr, - (char*)sqlite3KeyInfoRef(pKeyInfo), P4_KEYINFO); - j1 = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp3(v, OP_Jump, j1+1, 0, j1+1); - - /* Generate code that runs whenever the GROUP BY changes. - ** Changes in the GROUP BY are detected by the previous code - ** block. If there were no changes, this block is skipped. - ** - ** This code copies current group by terms in b0,b1,b2,... - ** over to a0,a1,a2. It then calls the output subroutine - ** and resets the aggregate accumulator registers in preparation - ** for the next GROUP BY batch. - */ - sqlite3ExprCodeMove(pParse, iBMem, iAMem, pGroupBy->nExpr); - sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow); - VdbeComment((v, "output one row")); - sqlite3VdbeAddOp2(v, OP_IfPos, iAbortFlag, addrEnd); - VdbeComment((v, "check abort flag")); - sqlite3VdbeAddOp2(v, OP_Gosub, regReset, addrReset); - VdbeComment((v, "reset accumulator")); - - /* Update the aggregate accumulators based on the content of - ** the current row - */ - sqlite3VdbeJumpHere(v, j1); - updateAccumulator(pParse, &sAggInfo); - sqlite3VdbeAddOp2(v, OP_Integer, 1, iUseFlag); - VdbeComment((v, "indicate data in accumulator")); - - /* End of the loop - */ - if( groupBySort ){ - sqlite3VdbeAddOp2(v, OP_SorterNext, sAggInfo.sortingIdx, addrTopOfLoop); - }else{ - sqlite3WhereEnd(pWInfo); - sqlite3VdbeChangeToNoop(v, addrSortingIdx); - } - - /* Output the final row of result - */ - sqlite3VdbeAddOp2(v, OP_Gosub, regOutputRow, addrOutputRow); - VdbeComment((v, "output final row")); - - /* Jump over the subroutines - */ - sqlite3VdbeAddOp2(v, OP_Goto, 0, addrEnd); - - /* Generate a subroutine that outputs a single row of the result - ** set. This subroutine first looks at the iUseFlag. If iUseFlag - ** is less than or equal to zero, the subroutine is a no-op. If - ** the processing calls for the query to abort, this subroutine - ** increments the iAbortFlag memory location before returning in - ** order to signal the caller to abort. - */ - addrSetAbort = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_Integer, 1, iAbortFlag); - VdbeComment((v, "set abort flag")); - sqlite3VdbeAddOp1(v, OP_Return, regOutputRow); - sqlite3VdbeResolveLabel(v, addrOutputRow); - addrOutputRow = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_IfPos, iUseFlag, addrOutputRow+2); - VdbeComment((v, "Groupby result generator entry point")); - sqlite3VdbeAddOp1(v, OP_Return, regOutputRow); - finalizeAggFunctions(pParse, &sAggInfo); - sqlite3ExprIfFalse(pParse, pHaving, addrOutputRow+1, SQLITE_JUMPIFNULL); - selectInnerLoop(pParse, p, p->pEList, -1, pOrderBy, - &sDistinct, pDest, - addrOutputRow+1, addrSetAbort); - sqlite3VdbeAddOp1(v, OP_Return, regOutputRow); - VdbeComment((v, "end groupby result generator")); - - /* Generate a subroutine that will reset the group-by accumulator - */ - sqlite3VdbeResolveLabel(v, addrReset); - resetAccumulator(pParse, &sAggInfo); - sqlite3VdbeAddOp1(v, OP_Return, regReset); - - } /* endif pGroupBy. Begin aggregate queries without GROUP BY: */ - else { - ExprList *pDel = 0; -#ifndef SQLITE_OMIT_BTREECOUNT - Table *pTab; - if( (pTab = isSimpleCount(p, &sAggInfo))!=0 ){ - /* If isSimpleCount() returns a pointer to a Table structure, then - ** the SQL statement is of the form: - ** - ** SELECT count(*) FROM - ** - ** where the Table structure returned represents table . - ** - ** This statement is so common that it is optimized specially. The - ** OP_Count instruction is executed either on the intkey table that - ** contains the data for table or on one of its indexes. It - ** is better to execute the op on an index, as indexes are almost - ** always spread across less pages than their corresponding tables. - */ - const int iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - const int iCsr = pParse->nTab++; /* Cursor to scan b-tree */ - Index *pIdx; /* Iterator variable */ - KeyInfo *pKeyInfo = 0; /* Keyinfo for scanned index */ - Index *pBest = 0; /* Best index found so far */ - int iRoot = pTab->tnum; /* Root page of scanned b-tree */ - - sqlite3CodeVerifySchema(pParse, iDb); - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); - - /* Search for the index that has the lowest scan cost. - ** - ** (2011-04-15) Do not do a full scan of an unordered index. - ** - ** (2013-10-03) Do not count the entries in a partial index. - ** - ** In practice the KeyInfo structure will not be used. It is only - ** passed to keep OP_OpenRead happy. - */ - if( !HasRowid(pTab) ) pBest = sqlite3PrimaryKeyIndex(pTab); - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->bUnordered==0 - && pIdx->szIdxRowszTabRow - && pIdx->pPartIdxWhere==0 - && (!pBest || pIdx->szIdxRowszIdxRow) - ){ - pBest = pIdx; - } - } - if( pBest ){ - iRoot = pBest->tnum; - pKeyInfo = sqlite3KeyInfoOfIndex(pParse, pBest); - } - - /* Open a read-only cursor, execute the OP_Count, close the cursor. */ - sqlite3VdbeAddOp4Int(v, OP_OpenRead, iCsr, iRoot, iDb, 1); - if( pKeyInfo ){ - sqlite3VdbeChangeP4(v, -1, (char *)pKeyInfo, P4_KEYINFO); - } - sqlite3VdbeAddOp2(v, OP_Count, iCsr, sAggInfo.aFunc[0].iMem); - sqlite3VdbeAddOp1(v, OP_Close, iCsr); - explainSimpleCount(pParse, pTab, pBest); - }else -#endif /* SQLITE_OMIT_BTREECOUNT */ - { - /* Check if the query is of one of the following forms: - ** - ** SELECT min(x) FROM ... - ** SELECT max(x) FROM ... - ** - ** If it is, then ask the code in where.c to attempt to sort results - ** as if there was an "ORDER ON x" or "ORDER ON x DESC" clause. - ** If where.c is able to produce results sorted in this order, then - ** add vdbe code to break out of the processing loop after the - ** first iteration (since the first iteration of the loop is - ** guaranteed to operate on the row with the minimum or maximum - ** value of x, the only row required). - ** - ** A special flag must be passed to sqlite3WhereBegin() to slightly - ** modify behavior as follows: - ** - ** + If the query is a "SELECT min(x)", then the loop coded by - ** where.c should not iterate over any values with a NULL value - ** for x. - ** - ** + The optimizer code in where.c (the thing that decides which - ** index or indices to use) should place a different priority on - ** satisfying the 'ORDER BY' clause than it does in other cases. - ** Refer to code and comments in where.c for details. - */ - ExprList *pMinMax = 0; - u8 flag = WHERE_ORDERBY_NORMAL; - - assert( p->pGroupBy==0 ); - assert( flag==0 ); - if( p->pHaving==0 ){ - flag = minMaxQuery(&sAggInfo, &pMinMax); - } - assert( flag==0 || (pMinMax!=0 && pMinMax->nExpr==1) ); - - if( flag ){ - pMinMax = sqlite3ExprListDup(db, pMinMax, 0); - pDel = pMinMax; - if( pMinMax && !db->mallocFailed ){ - pMinMax->a[0].sortOrder = flag!=WHERE_ORDERBY_MIN ?1:0; - pMinMax->a[0].pExpr->op = TK_COLUMN; - } - } - - /* This case runs if the aggregate has no GROUP BY clause. The - ** processing is much simpler since there is only a single row - ** of output. - */ - resetAccumulator(pParse, &sAggInfo); - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, pMinMax,0,flag,0); - if( pWInfo==0 ){ - sqlite3ExprListDelete(db, pDel); - goto select_end; - } - updateAccumulator(pParse, &sAggInfo); - assert( pMinMax==0 || pMinMax->nExpr==1 ); - if( sqlite3WhereIsOrdered(pWInfo) ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, sqlite3WhereBreakLabel(pWInfo)); - VdbeComment((v, "%s() by index", - (flag==WHERE_ORDERBY_MIN?"min":"max"))); - } - sqlite3WhereEnd(pWInfo); - finalizeAggFunctions(pParse, &sAggInfo); - } - - pOrderBy = 0; - sqlite3ExprIfFalse(pParse, pHaving, addrEnd, SQLITE_JUMPIFNULL); - selectInnerLoop(pParse, p, p->pEList, -1, 0, 0, - pDest, addrEnd, addrEnd); - sqlite3ExprListDelete(db, pDel); - } - sqlite3VdbeResolveLabel(v, addrEnd); - - } /* endif aggregate query */ - - if( sDistinct.eTnctType==WHERE_DISTINCT_UNORDERED ){ - explainTempTable(pParse, "DISTINCT"); - } - - /* If there is an ORDER BY clause, then we need to sort the results - ** and send them to the callback one by one. - */ - if( pOrderBy ){ - explainTempTable(pParse, "ORDER BY"); - generateSortTail(pParse, p, v, pEList->nExpr, pDest); - } - - /* Jump here to skip this query - */ - sqlite3VdbeResolveLabel(v, iEnd); - - /* The SELECT was successfully coded. Set the return code to 0 - ** to indicate no errors. - */ - rc = 0; - - /* Control jumps to here if an error is encountered above, or upon - ** successful coding of the SELECT. - */ -select_end: - explainSetInteger(pParse->iSelectId, iRestoreSelectId); - - /* Identify column names if results of the SELECT are to be output. - */ - if( rc==SQLITE_OK && pDest->eDest==SRT_Output ){ - generateColumnNames(pParse, pTabList, pEList); - } - - sqlite3DbFree(db, sAggInfo.aCol); - sqlite3DbFree(db, sAggInfo.aFunc); - return rc; -} - -#if defined(SQLITE_ENABLE_TREE_EXPLAIN) -/* -** Generate a human-readable description of a the Select object. -*/ -static void explainOneSelect(Vdbe *pVdbe, Select *p){ - sqlite3ExplainPrintf(pVdbe, "SELECT "); - if( p->selFlags & (SF_Distinct|SF_Aggregate) ){ - if( p->selFlags & SF_Distinct ){ - sqlite3ExplainPrintf(pVdbe, "DISTINCT "); - } - if( p->selFlags & SF_Aggregate ){ - sqlite3ExplainPrintf(pVdbe, "agg_flag "); - } - sqlite3ExplainNL(pVdbe); - sqlite3ExplainPrintf(pVdbe, " "); - } - sqlite3ExplainExprList(pVdbe, p->pEList); - sqlite3ExplainNL(pVdbe); - if( p->pSrc && p->pSrc->nSrc ){ - int i; - sqlite3ExplainPrintf(pVdbe, "FROM "); - sqlite3ExplainPush(pVdbe); - for(i=0; ipSrc->nSrc; i++){ - struct SrcList_item *pItem = &p->pSrc->a[i]; - sqlite3ExplainPrintf(pVdbe, "{%d,*} = ", pItem->iCursor); - if( pItem->pSelect ){ - sqlite3ExplainSelect(pVdbe, pItem->pSelect); - if( pItem->pTab ){ - sqlite3ExplainPrintf(pVdbe, " (tabname=%s)", pItem->pTab->zName); - } - }else if( pItem->zName ){ - sqlite3ExplainPrintf(pVdbe, "%s", pItem->zName); - } - if( pItem->zAlias ){ - sqlite3ExplainPrintf(pVdbe, " (AS %s)", pItem->zAlias); - } - if( pItem->jointype & JT_LEFT ){ - sqlite3ExplainPrintf(pVdbe, " LEFT-JOIN"); - } - sqlite3ExplainNL(pVdbe); - } - sqlite3ExplainPop(pVdbe); - } - if( p->pWhere ){ - sqlite3ExplainPrintf(pVdbe, "WHERE "); - sqlite3ExplainExpr(pVdbe, p->pWhere); - sqlite3ExplainNL(pVdbe); - } - if( p->pGroupBy ){ - sqlite3ExplainPrintf(pVdbe, "GROUPBY "); - sqlite3ExplainExprList(pVdbe, p->pGroupBy); - sqlite3ExplainNL(pVdbe); - } - if( p->pHaving ){ - sqlite3ExplainPrintf(pVdbe, "HAVING "); - sqlite3ExplainExpr(pVdbe, p->pHaving); - sqlite3ExplainNL(pVdbe); - } - if( p->pOrderBy ){ - sqlite3ExplainPrintf(pVdbe, "ORDERBY "); - sqlite3ExplainExprList(pVdbe, p->pOrderBy); - sqlite3ExplainNL(pVdbe); - } - if( p->pLimit ){ - sqlite3ExplainPrintf(pVdbe, "LIMIT "); - sqlite3ExplainExpr(pVdbe, p->pLimit); - sqlite3ExplainNL(pVdbe); - } - if( p->pOffset ){ - sqlite3ExplainPrintf(pVdbe, "OFFSET "); - sqlite3ExplainExpr(pVdbe, p->pOffset); - sqlite3ExplainNL(pVdbe); - } -} -SQLITE_PRIVATE void sqlite3ExplainSelect(Vdbe *pVdbe, Select *p){ - if( p==0 ){ - sqlite3ExplainPrintf(pVdbe, "(null-select)"); - return; - } - while( p->pPrior ){ - p->pPrior->pNext = p; - p = p->pPrior; - } - sqlite3ExplainPush(pVdbe); - while( p ){ - explainOneSelect(pVdbe, p); - p = p->pNext; - if( p==0 ) break; - sqlite3ExplainNL(pVdbe); - sqlite3ExplainPrintf(pVdbe, "%s\n", selectOpName(p->op)); - } - sqlite3ExplainPrintf(pVdbe, "END"); - sqlite3ExplainPop(pVdbe); -} - -/* End of the structure debug printing code -*****************************************************************************/ -#endif /* defined(SQLITE_ENABLE_TREE_EXPLAIN) */ - -/************** End of select.c **********************************************/ -/************** Begin file table.c *******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains the sqlite3_get_table() and sqlite3_free_table() -** interface routines. These are just wrappers around the main -** interface routine of sqlite3_exec(). -** -** These routines are in a separate files so that they will not be linked -** if they are not used. -*/ -/* #include */ -/* #include */ - -#ifndef SQLITE_OMIT_GET_TABLE - -/* -** This structure is used to pass data from sqlite3_get_table() through -** to the callback function is uses to build the result. -*/ -typedef struct TabResult { - char **azResult; /* Accumulated output */ - char *zErrMsg; /* Error message text, if an error occurs */ - int nAlloc; /* Slots allocated for azResult[] */ - int nRow; /* Number of rows in the result */ - int nColumn; /* Number of columns in the result */ - int nData; /* Slots used in azResult[]. (nRow+1)*nColumn */ - int rc; /* Return code from sqlite3_exec() */ -} TabResult; - -/* -** This routine is called once for each row in the result table. Its job -** is to fill in the TabResult structure appropriately, allocating new -** memory as necessary. -*/ -static int sqlite3_get_table_cb(void *pArg, int nCol, char **argv, char **colv){ - TabResult *p = (TabResult*)pArg; /* Result accumulator */ - int need; /* Slots needed in p->azResult[] */ - int i; /* Loop counter */ - char *z; /* A single column of result */ - - /* Make sure there is enough space in p->azResult to hold everything - ** we need to remember from this invocation of the callback. - */ - if( p->nRow==0 && argv!=0 ){ - need = nCol*2; - }else{ - need = nCol; - } - if( p->nData + need > p->nAlloc ){ - char **azNew; - p->nAlloc = p->nAlloc*2 + need; - azNew = sqlite3_realloc( p->azResult, sizeof(char*)*p->nAlloc ); - if( azNew==0 ) goto malloc_failed; - p->azResult = azNew; - } - - /* If this is the first row, then generate an extra row containing - ** the names of all columns. - */ - if( p->nRow==0 ){ - p->nColumn = nCol; - for(i=0; iazResult[p->nData++] = z; - } - }else if( p->nColumn!=nCol ){ - sqlite3_free(p->zErrMsg); - p->zErrMsg = sqlite3_mprintf( - "sqlite3_get_table() called with two or more incompatible queries" - ); - p->rc = SQLITE_ERROR; - return 1; - } - - /* Copy over the row data - */ - if( argv!=0 ){ - for(i=0; iazResult[p->nData++] = z; - } - p->nRow++; - } - return 0; - -malloc_failed: - p->rc = SQLITE_NOMEM; - return 1; -} - -/* -** Query the database. But instead of invoking a callback for each row, -** malloc() for space to hold the result and return the entire results -** at the conclusion of the call. -** -** The result that is written to ***pazResult is held in memory obtained -** from malloc(). But the caller cannot free this memory directly. -** Instead, the entire table should be passed to sqlite3_free_table() when -** the calling procedure is finished using it. -*/ -SQLITE_API int sqlite3_get_table( - sqlite3 *db, /* The database on which the SQL executes */ - const char *zSql, /* The SQL to be executed */ - char ***pazResult, /* Write the result table here */ - int *pnRow, /* Write the number of rows in the result here */ - int *pnColumn, /* Write the number of columns of result here */ - char **pzErrMsg /* Write error messages here */ -){ - int rc; - TabResult res; - - *pazResult = 0; - if( pnColumn ) *pnColumn = 0; - if( pnRow ) *pnRow = 0; - if( pzErrMsg ) *pzErrMsg = 0; - res.zErrMsg = 0; - res.nRow = 0; - res.nColumn = 0; - res.nData = 1; - res.nAlloc = 20; - res.rc = SQLITE_OK; - res.azResult = sqlite3_malloc(sizeof(char*)*res.nAlloc ); - if( res.azResult==0 ){ - db->errCode = SQLITE_NOMEM; - return SQLITE_NOMEM; - } - res.azResult[0] = 0; - rc = sqlite3_exec(db, zSql, sqlite3_get_table_cb, &res, pzErrMsg); - assert( sizeof(res.azResult[0])>= sizeof(res.nData) ); - res.azResult[0] = SQLITE_INT_TO_PTR(res.nData); - if( (rc&0xff)==SQLITE_ABORT ){ - sqlite3_free_table(&res.azResult[1]); - if( res.zErrMsg ){ - if( pzErrMsg ){ - sqlite3_free(*pzErrMsg); - *pzErrMsg = sqlite3_mprintf("%s",res.zErrMsg); - } - sqlite3_free(res.zErrMsg); - } - db->errCode = res.rc; /* Assume 32-bit assignment is atomic */ - return res.rc; - } - sqlite3_free(res.zErrMsg); - if( rc!=SQLITE_OK ){ - sqlite3_free_table(&res.azResult[1]); - return rc; - } - if( res.nAlloc>res.nData ){ - char **azNew; - azNew = sqlite3_realloc( res.azResult, sizeof(char*)*res.nData ); - if( azNew==0 ){ - sqlite3_free_table(&res.azResult[1]); - db->errCode = SQLITE_NOMEM; - return SQLITE_NOMEM; - } - res.azResult = azNew; - } - *pazResult = &res.azResult[1]; - if( pnColumn ) *pnColumn = res.nColumn; - if( pnRow ) *pnRow = res.nRow; - return rc; -} - -/* -** This routine frees the space the sqlite3_get_table() malloced. -*/ -SQLITE_API void sqlite3_free_table( - char **azResult /* Result returned from from sqlite3_get_table() */ -){ - if( azResult ){ - int i, n; - azResult--; - assert( azResult!=0 ); - n = SQLITE_PTR_TO_INT(azResult[0]); - for(i=1; ipNext; - - sqlite3ExprDelete(db, pTmp->pWhere); - sqlite3ExprListDelete(db, pTmp->pExprList); - sqlite3SelectDelete(db, pTmp->pSelect); - sqlite3IdListDelete(db, pTmp->pIdList); - - sqlite3DbFree(db, pTmp); - } -} - -/* -** Given table pTab, return a list of all the triggers attached to -** the table. The list is connected by Trigger.pNext pointers. -** -** All of the triggers on pTab that are in the same database as pTab -** are already attached to pTab->pTrigger. But there might be additional -** triggers on pTab in the TEMP schema. This routine prepends all -** TEMP triggers on pTab to the beginning of the pTab->pTrigger list -** and returns the combined list. -** -** To state it another way: This routine returns a list of all triggers -** that fire off of pTab. The list will include any TEMP triggers on -** pTab as well as the triggers lised in pTab->pTrigger. -*/ -SQLITE_PRIVATE Trigger *sqlite3TriggerList(Parse *pParse, Table *pTab){ - Schema * const pTmpSchema = pParse->db->aDb[1].pSchema; - Trigger *pList = 0; /* List of triggers to return */ - - if( pParse->disableTriggers ){ - return 0; - } - - if( pTmpSchema!=pTab->pSchema ){ - HashElem *p; - assert( sqlite3SchemaMutexHeld(pParse->db, 0, pTmpSchema) ); - for(p=sqliteHashFirst(&pTmpSchema->trigHash); p; p=sqliteHashNext(p)){ - Trigger *pTrig = (Trigger *)sqliteHashData(p); - if( pTrig->pTabSchema==pTab->pSchema - && 0==sqlite3StrICmp(pTrig->table, pTab->zName) - ){ - pTrig->pNext = (pList ? pList : pTab->pTrigger); - pList = pTrig; - } - } - } - - return (pList ? pList : pTab->pTrigger); -} - -/* -** This is called by the parser when it sees a CREATE TRIGGER statement -** up to the point of the BEGIN before the trigger actions. A Trigger -** structure is generated based on the information available and stored -** in pParse->pNewTrigger. After the trigger actions have been parsed, the -** sqlite3FinishTrigger() function is called to complete the trigger -** construction process. -*/ -SQLITE_PRIVATE void sqlite3BeginTrigger( - Parse *pParse, /* The parse context of the CREATE TRIGGER statement */ - Token *pName1, /* The name of the trigger */ - Token *pName2, /* The name of the trigger */ - int tr_tm, /* One of TK_BEFORE, TK_AFTER, TK_INSTEAD */ - int op, /* One of TK_INSERT, TK_UPDATE, TK_DELETE */ - IdList *pColumns, /* column list if this is an UPDATE OF trigger */ - SrcList *pTableName,/* The name of the table/view the trigger applies to */ - Expr *pWhen, /* WHEN clause */ - int isTemp, /* True if the TEMPORARY keyword is present */ - int noErr /* Suppress errors if the trigger already exists */ -){ - Trigger *pTrigger = 0; /* The new trigger */ - Table *pTab; /* Table that the trigger fires off of */ - char *zName = 0; /* Name of the trigger */ - sqlite3 *db = pParse->db; /* The database connection */ - int iDb; /* The database to store the trigger in */ - Token *pName; /* The unqualified db name */ - DbFixer sFix; /* State vector for the DB fixer */ - int iTabDb; /* Index of the database holding pTab */ - - assert( pName1!=0 ); /* pName1->z might be NULL, but not pName1 itself */ - assert( pName2!=0 ); - assert( op==TK_INSERT || op==TK_UPDATE || op==TK_DELETE ); - assert( op>0 && op<0xff ); - if( isTemp ){ - /* If TEMP was specified, then the trigger name may not be qualified. */ - if( pName2->n>0 ){ - sqlite3ErrorMsg(pParse, "temporary trigger may not have qualified name"); - goto trigger_cleanup; - } - iDb = 1; - pName = pName1; - }else{ - /* Figure out the db that the trigger will be created in */ - iDb = sqlite3TwoPartName(pParse, pName1, pName2, &pName); - if( iDb<0 ){ - goto trigger_cleanup; - } - } - if( !pTableName || db->mallocFailed ){ - goto trigger_cleanup; - } - - /* A long-standing parser bug is that this syntax was allowed: - ** - ** CREATE TRIGGER attached.demo AFTER INSERT ON attached.tab .... - ** ^^^^^^^^ - ** - ** To maintain backwards compatibility, ignore the database - ** name on pTableName if we are reparsing our of SQLITE_MASTER. - */ - if( db->init.busy && iDb!=1 ){ - sqlite3DbFree(db, pTableName->a[0].zDatabase); - pTableName->a[0].zDatabase = 0; - } - - /* If the trigger name was unqualified, and the table is a temp table, - ** then set iDb to 1 to create the trigger in the temporary database. - ** If sqlite3SrcListLookup() returns 0, indicating the table does not - ** exist, the error is caught by the block below. - */ - pTab = sqlite3SrcListLookup(pParse, pTableName); - if( db->init.busy==0 && pName2->n==0 && pTab - && pTab->pSchema==db->aDb[1].pSchema ){ - iDb = 1; - } - - /* Ensure the table name matches database name and that the table exists */ - if( db->mallocFailed ) goto trigger_cleanup; - assert( pTableName->nSrc==1 ); - sqlite3FixInit(&sFix, pParse, iDb, "trigger", pName); - if( sqlite3FixSrcList(&sFix, pTableName) ){ - goto trigger_cleanup; - } - pTab = sqlite3SrcListLookup(pParse, pTableName); - if( !pTab ){ - /* The table does not exist. */ - if( db->init.iDb==1 ){ - /* Ticket #3810. - ** Normally, whenever a table is dropped, all associated triggers are - ** dropped too. But if a TEMP trigger is created on a non-TEMP table - ** and the table is dropped by a different database connection, the - ** trigger is not visible to the database connection that does the - ** drop so the trigger cannot be dropped. This results in an - ** "orphaned trigger" - a trigger whose associated table is missing. - */ - db->init.orphanTrigger = 1; - } - goto trigger_cleanup; - } - if( IsVirtual(pTab) ){ - sqlite3ErrorMsg(pParse, "cannot create triggers on virtual tables"); - goto trigger_cleanup; - } - - /* Check that the trigger name is not reserved and that no trigger of the - ** specified name exists */ - zName = sqlite3NameFromToken(db, pName); - if( !zName || SQLITE_OK!=sqlite3CheckObjectName(pParse, zName) ){ - goto trigger_cleanup; - } - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - if( sqlite3HashFind(&(db->aDb[iDb].pSchema->trigHash), - zName, sqlite3Strlen30(zName)) ){ - if( !noErr ){ - sqlite3ErrorMsg(pParse, "trigger %T already exists", pName); - }else{ - assert( !db->init.busy ); - sqlite3CodeVerifySchema(pParse, iDb); - } - goto trigger_cleanup; - } - - /* Do not create a trigger on a system table */ - if( sqlite3StrNICmp(pTab->zName, "sqlite_", 7)==0 ){ - sqlite3ErrorMsg(pParse, "cannot create trigger on system table"); - pParse->nErr++; - goto trigger_cleanup; - } - - /* INSTEAD of triggers are only for views and views only support INSTEAD - ** of triggers. - */ - if( pTab->pSelect && tr_tm!=TK_INSTEAD ){ - sqlite3ErrorMsg(pParse, "cannot create %s trigger on view: %S", - (tr_tm == TK_BEFORE)?"BEFORE":"AFTER", pTableName, 0); - goto trigger_cleanup; - } - if( !pTab->pSelect && tr_tm==TK_INSTEAD ){ - sqlite3ErrorMsg(pParse, "cannot create INSTEAD OF" - " trigger on table: %S", pTableName, 0); - goto trigger_cleanup; - } - iTabDb = sqlite3SchemaToIndex(db, pTab->pSchema); - -#ifndef SQLITE_OMIT_AUTHORIZATION - { - int code = SQLITE_CREATE_TRIGGER; - const char *zDb = db->aDb[iTabDb].zName; - const char *zDbTrig = isTemp ? db->aDb[1].zName : zDb; - if( iTabDb==1 || isTemp ) code = SQLITE_CREATE_TEMP_TRIGGER; - if( sqlite3AuthCheck(pParse, code, zName, pTab->zName, zDbTrig) ){ - goto trigger_cleanup; - } - if( sqlite3AuthCheck(pParse, SQLITE_INSERT, SCHEMA_TABLE(iTabDb),0,zDb)){ - goto trigger_cleanup; - } - } -#endif - - /* INSTEAD OF triggers can only appear on views and BEFORE triggers - ** cannot appear on views. So we might as well translate every - ** INSTEAD OF trigger into a BEFORE trigger. It simplifies code - ** elsewhere. - */ - if (tr_tm == TK_INSTEAD){ - tr_tm = TK_BEFORE; - } - - /* Build the Trigger object */ - pTrigger = (Trigger*)sqlite3DbMallocZero(db, sizeof(Trigger)); - if( pTrigger==0 ) goto trigger_cleanup; - pTrigger->zName = zName; - zName = 0; - pTrigger->table = sqlite3DbStrDup(db, pTableName->a[0].zName); - pTrigger->pSchema = db->aDb[iDb].pSchema; - pTrigger->pTabSchema = pTab->pSchema; - pTrigger->op = (u8)op; - pTrigger->tr_tm = tr_tm==TK_BEFORE ? TRIGGER_BEFORE : TRIGGER_AFTER; - pTrigger->pWhen = sqlite3ExprDup(db, pWhen, EXPRDUP_REDUCE); - pTrigger->pColumns = sqlite3IdListDup(db, pColumns); - assert( pParse->pNewTrigger==0 ); - pParse->pNewTrigger = pTrigger; - -trigger_cleanup: - sqlite3DbFree(db, zName); - sqlite3SrcListDelete(db, pTableName); - sqlite3IdListDelete(db, pColumns); - sqlite3ExprDelete(db, pWhen); - if( !pParse->pNewTrigger ){ - sqlite3DeleteTrigger(db, pTrigger); - }else{ - assert( pParse->pNewTrigger==pTrigger ); - } -} - -/* -** This routine is called after all of the trigger actions have been parsed -** in order to complete the process of building the trigger. -*/ -SQLITE_PRIVATE void sqlite3FinishTrigger( - Parse *pParse, /* Parser context */ - TriggerStep *pStepList, /* The triggered program */ - Token *pAll /* Token that describes the complete CREATE TRIGGER */ -){ - Trigger *pTrig = pParse->pNewTrigger; /* Trigger being finished */ - char *zName; /* Name of trigger */ - sqlite3 *db = pParse->db; /* The database */ - DbFixer sFix; /* Fixer object */ - int iDb; /* Database containing the trigger */ - Token nameToken; /* Trigger name for error reporting */ - - pParse->pNewTrigger = 0; - if( NEVER(pParse->nErr) || !pTrig ) goto triggerfinish_cleanup; - zName = pTrig->zName; - iDb = sqlite3SchemaToIndex(pParse->db, pTrig->pSchema); - pTrig->step_list = pStepList; - while( pStepList ){ - pStepList->pTrig = pTrig; - pStepList = pStepList->pNext; - } - nameToken.z = pTrig->zName; - nameToken.n = sqlite3Strlen30(nameToken.z); - sqlite3FixInit(&sFix, pParse, iDb, "trigger", &nameToken); - if( sqlite3FixTriggerStep(&sFix, pTrig->step_list) - || sqlite3FixExpr(&sFix, pTrig->pWhen) - ){ - goto triggerfinish_cleanup; - } - - /* if we are not initializing, - ** build the sqlite_master entry - */ - if( !db->init.busy ){ - Vdbe *v; - char *z; - - /* Make an entry in the sqlite_master table */ - v = sqlite3GetVdbe(pParse); - if( v==0 ) goto triggerfinish_cleanup; - sqlite3BeginWriteOperation(pParse, 0, iDb); - z = sqlite3DbStrNDup(db, (char*)pAll->z, pAll->n); - sqlite3NestedParse(pParse, - "INSERT INTO %Q.%s VALUES('trigger',%Q,%Q,0,'CREATE TRIGGER %q')", - db->aDb[iDb].zName, SCHEMA_TABLE(iDb), zName, - pTrig->table, z); - sqlite3DbFree(db, z); - sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddParseSchemaOp(v, iDb, - sqlite3MPrintf(db, "type='trigger' AND name='%q'", zName)); - } - - if( db->init.busy ){ - Trigger *pLink = pTrig; - Hash *pHash = &db->aDb[iDb].pSchema->trigHash; - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - pTrig = sqlite3HashInsert(pHash, zName, sqlite3Strlen30(zName), pTrig); - if( pTrig ){ - db->mallocFailed = 1; - }else if( pLink->pSchema==pLink->pTabSchema ){ - Table *pTab; - int n = sqlite3Strlen30(pLink->table); - pTab = sqlite3HashFind(&pLink->pTabSchema->tblHash, pLink->table, n); - assert( pTab!=0 ); - pLink->pNext = pTab->pTrigger; - pTab->pTrigger = pLink; - } - } - -triggerfinish_cleanup: - sqlite3DeleteTrigger(db, pTrig); - assert( !pParse->pNewTrigger ); - sqlite3DeleteTriggerStep(db, pStepList); -} - -/* -** Turn a SELECT statement (that the pSelect parameter points to) into -** a trigger step. Return a pointer to a TriggerStep structure. -** -** The parser calls this routine when it finds a SELECT statement in -** body of a TRIGGER. -*/ -SQLITE_PRIVATE TriggerStep *sqlite3TriggerSelectStep(sqlite3 *db, Select *pSelect){ - TriggerStep *pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep)); - if( pTriggerStep==0 ) { - sqlite3SelectDelete(db, pSelect); - return 0; - } - pTriggerStep->op = TK_SELECT; - pTriggerStep->pSelect = pSelect; - pTriggerStep->orconf = OE_Default; - return pTriggerStep; -} - -/* -** Allocate space to hold a new trigger step. The allocated space -** holds both the TriggerStep object and the TriggerStep.target.z string. -** -** If an OOM error occurs, NULL is returned and db->mallocFailed is set. -*/ -static TriggerStep *triggerStepAllocate( - sqlite3 *db, /* Database connection */ - u8 op, /* Trigger opcode */ - Token *pName /* The target name */ -){ - TriggerStep *pTriggerStep; - - pTriggerStep = sqlite3DbMallocZero(db, sizeof(TriggerStep) + pName->n); - if( pTriggerStep ){ - char *z = (char*)&pTriggerStep[1]; - memcpy(z, pName->z, pName->n); - pTriggerStep->target.z = z; - pTriggerStep->target.n = pName->n; - pTriggerStep->op = op; - } - return pTriggerStep; -} - -/* -** Build a trigger step out of an INSERT statement. Return a pointer -** to the new trigger step. -** -** The parser calls this routine when it sees an INSERT inside the -** body of a trigger. -*/ -SQLITE_PRIVATE TriggerStep *sqlite3TriggerInsertStep( - sqlite3 *db, /* The database connection */ - Token *pTableName, /* Name of the table into which we insert */ - IdList *pColumn, /* List of columns in pTableName to insert into */ - Select *pSelect, /* A SELECT statement that supplies values */ - u8 orconf /* The conflict algorithm (OE_Abort, OE_Replace, etc.) */ -){ - TriggerStep *pTriggerStep; - - assert(pSelect != 0 || db->mallocFailed); - - pTriggerStep = triggerStepAllocate(db, TK_INSERT, pTableName); - if( pTriggerStep ){ - pTriggerStep->pSelect = sqlite3SelectDup(db, pSelect, EXPRDUP_REDUCE); - pTriggerStep->pIdList = pColumn; - pTriggerStep->orconf = orconf; - }else{ - sqlite3IdListDelete(db, pColumn); - } - sqlite3SelectDelete(db, pSelect); - - return pTriggerStep; -} - -/* -** Construct a trigger step that implements an UPDATE statement and return -** a pointer to that trigger step. The parser calls this routine when it -** sees an UPDATE statement inside the body of a CREATE TRIGGER. -*/ -SQLITE_PRIVATE TriggerStep *sqlite3TriggerUpdateStep( - sqlite3 *db, /* The database connection */ - Token *pTableName, /* Name of the table to be updated */ - ExprList *pEList, /* The SET clause: list of column and new values */ - Expr *pWhere, /* The WHERE clause */ - u8 orconf /* The conflict algorithm. (OE_Abort, OE_Ignore, etc) */ -){ - TriggerStep *pTriggerStep; - - pTriggerStep = triggerStepAllocate(db, TK_UPDATE, pTableName); - if( pTriggerStep ){ - pTriggerStep->pExprList = sqlite3ExprListDup(db, pEList, EXPRDUP_REDUCE); - pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); - pTriggerStep->orconf = orconf; - } - sqlite3ExprListDelete(db, pEList); - sqlite3ExprDelete(db, pWhere); - return pTriggerStep; -} - -/* -** Construct a trigger step that implements a DELETE statement and return -** a pointer to that trigger step. The parser calls this routine when it -** sees a DELETE statement inside the body of a CREATE TRIGGER. -*/ -SQLITE_PRIVATE TriggerStep *sqlite3TriggerDeleteStep( - sqlite3 *db, /* Database connection */ - Token *pTableName, /* The table from which rows are deleted */ - Expr *pWhere /* The WHERE clause */ -){ - TriggerStep *pTriggerStep; - - pTriggerStep = triggerStepAllocate(db, TK_DELETE, pTableName); - if( pTriggerStep ){ - pTriggerStep->pWhere = sqlite3ExprDup(db, pWhere, EXPRDUP_REDUCE); - pTriggerStep->orconf = OE_Default; - } - sqlite3ExprDelete(db, pWhere); - return pTriggerStep; -} - -/* -** Recursively delete a Trigger structure -*/ -SQLITE_PRIVATE void sqlite3DeleteTrigger(sqlite3 *db, Trigger *pTrigger){ - if( pTrigger==0 ) return; - sqlite3DeleteTriggerStep(db, pTrigger->step_list); - sqlite3DbFree(db, pTrigger->zName); - sqlite3DbFree(db, pTrigger->table); - sqlite3ExprDelete(db, pTrigger->pWhen); - sqlite3IdListDelete(db, pTrigger->pColumns); - sqlite3DbFree(db, pTrigger); -} - -/* -** This function is called to drop a trigger from the database schema. -** -** This may be called directly from the parser and therefore identifies -** the trigger by name. The sqlite3DropTriggerPtr() routine does the -** same job as this routine except it takes a pointer to the trigger -** instead of the trigger name. -**/ -SQLITE_PRIVATE void sqlite3DropTrigger(Parse *pParse, SrcList *pName, int noErr){ - Trigger *pTrigger = 0; - int i; - const char *zDb; - const char *zName; - int nName; - sqlite3 *db = pParse->db; - - if( db->mallocFailed ) goto drop_trigger_cleanup; - if( SQLITE_OK!=sqlite3ReadSchema(pParse) ){ - goto drop_trigger_cleanup; - } - - assert( pName->nSrc==1 ); - zDb = pName->a[0].zDatabase; - zName = pName->a[0].zName; - nName = sqlite3Strlen30(zName); - assert( zDb!=0 || sqlite3BtreeHoldsAllMutexes(db) ); - for(i=OMIT_TEMPDB; inDb; i++){ - int j = (i<2) ? i^1 : i; /* Search TEMP before MAIN */ - if( zDb && sqlite3StrICmp(db->aDb[j].zName, zDb) ) continue; - assert( sqlite3SchemaMutexHeld(db, j, 0) ); - pTrigger = sqlite3HashFind(&(db->aDb[j].pSchema->trigHash), zName, nName); - if( pTrigger ) break; - } - if( !pTrigger ){ - if( !noErr ){ - sqlite3ErrorMsg(pParse, "no such trigger: %S", pName, 0); - }else{ - sqlite3CodeVerifyNamedSchema(pParse, zDb); - } - pParse->checkSchema = 1; - goto drop_trigger_cleanup; - } - sqlite3DropTriggerPtr(pParse, pTrigger); - -drop_trigger_cleanup: - sqlite3SrcListDelete(db, pName); -} - -/* -** Return a pointer to the Table structure for the table that a trigger -** is set on. -*/ -static Table *tableOfTrigger(Trigger *pTrigger){ - int n = sqlite3Strlen30(pTrigger->table); - return sqlite3HashFind(&pTrigger->pTabSchema->tblHash, pTrigger->table, n); -} - - -/* -** Drop a trigger given a pointer to that trigger. -*/ -SQLITE_PRIVATE void sqlite3DropTriggerPtr(Parse *pParse, Trigger *pTrigger){ - Table *pTable; - Vdbe *v; - sqlite3 *db = pParse->db; - int iDb; - - iDb = sqlite3SchemaToIndex(pParse->db, pTrigger->pSchema); - assert( iDb>=0 && iDbnDb ); - pTable = tableOfTrigger(pTrigger); - assert( pTable ); - assert( pTable->pSchema==pTrigger->pSchema || iDb==1 ); -#ifndef SQLITE_OMIT_AUTHORIZATION - { - int code = SQLITE_DROP_TRIGGER; - const char *zDb = db->aDb[iDb].zName; - const char *zTab = SCHEMA_TABLE(iDb); - if( iDb==1 ) code = SQLITE_DROP_TEMP_TRIGGER; - if( sqlite3AuthCheck(pParse, code, pTrigger->zName, pTable->zName, zDb) || - sqlite3AuthCheck(pParse, SQLITE_DELETE, zTab, 0, zDb) ){ - return; - } - } -#endif - - /* Generate code to destroy the database record of the trigger. - */ - assert( pTable!=0 ); - if( (v = sqlite3GetVdbe(pParse))!=0 ){ - int base; - static const VdbeOpList dropTrigger[] = { - { OP_Rewind, 0, ADDR(9), 0}, - { OP_String8, 0, 1, 0}, /* 1 */ - { OP_Column, 0, 1, 2}, - { OP_Ne, 2, ADDR(8), 1}, - { OP_String8, 0, 1, 0}, /* 4: "trigger" */ - { OP_Column, 0, 0, 2}, - { OP_Ne, 2, ADDR(8), 1}, - { OP_Delete, 0, 0, 0}, - { OP_Next, 0, ADDR(1), 0}, /* 8 */ - }; - - sqlite3BeginWriteOperation(pParse, 0, iDb); - sqlite3OpenMasterTable(pParse, iDb); - base = sqlite3VdbeAddOpList(v, ArraySize(dropTrigger), dropTrigger); - sqlite3VdbeChangeP4(v, base+1, pTrigger->zName, P4_TRANSIENT); - sqlite3VdbeChangeP4(v, base+4, "trigger", P4_STATIC); - sqlite3ChangeCookie(pParse, iDb); - sqlite3VdbeAddOp2(v, OP_Close, 0, 0); - sqlite3VdbeAddOp4(v, OP_DropTrigger, iDb, 0, 0, pTrigger->zName, 0); - if( pParse->nMem<3 ){ - pParse->nMem = 3; - } - } -} - -/* -** Remove a trigger from the hash tables of the sqlite* pointer. -*/ -SQLITE_PRIVATE void sqlite3UnlinkAndDeleteTrigger(sqlite3 *db, int iDb, const char *zName){ - Trigger *pTrigger; - Hash *pHash; - - assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); - pHash = &(db->aDb[iDb].pSchema->trigHash); - pTrigger = sqlite3HashInsert(pHash, zName, sqlite3Strlen30(zName), 0); - if( ALWAYS(pTrigger) ){ - if( pTrigger->pSchema==pTrigger->pTabSchema ){ - Table *pTab = tableOfTrigger(pTrigger); - Trigger **pp; - for(pp=&pTab->pTrigger; *pp!=pTrigger; pp=&((*pp)->pNext)); - *pp = (*pp)->pNext; - } - sqlite3DeleteTrigger(db, pTrigger); - db->flags |= SQLITE_InternChanges; - } -} - -/* -** pEList is the SET clause of an UPDATE statement. Each entry -** in pEList is of the format =. If any of the entries -** in pEList have an which matches an identifier in pIdList, -** then return TRUE. If pIdList==NULL, then it is considered a -** wildcard that matches anything. Likewise if pEList==NULL then -** it matches anything so always return true. Return false only -** if there is no match. -*/ -static int checkColumnOverlap(IdList *pIdList, ExprList *pEList){ - int e; - if( pIdList==0 || NEVER(pEList==0) ) return 1; - for(e=0; enExpr; e++){ - if( sqlite3IdListIndex(pIdList, pEList->a[e].zName)>=0 ) return 1; - } - return 0; -} - -/* -** Return a list of all triggers on table pTab if there exists at least -** one trigger that must be fired when an operation of type 'op' is -** performed on the table, and, if that operation is an UPDATE, if at -** least one of the columns in pChanges is being modified. -*/ -SQLITE_PRIVATE Trigger *sqlite3TriggersExist( - Parse *pParse, /* Parse context */ - Table *pTab, /* The table the contains the triggers */ - int op, /* one of TK_DELETE, TK_INSERT, TK_UPDATE */ - ExprList *pChanges, /* Columns that change in an UPDATE statement */ - int *pMask /* OUT: Mask of TRIGGER_BEFORE|TRIGGER_AFTER */ -){ - int mask = 0; - Trigger *pList = 0; - Trigger *p; - - if( (pParse->db->flags & SQLITE_EnableTrigger)!=0 ){ - pList = sqlite3TriggerList(pParse, pTab); - } - assert( pList==0 || IsVirtual(pTab)==0 ); - for(p=pList; p; p=p->pNext){ - if( p->op==op && checkColumnOverlap(p->pColumns, pChanges) ){ - mask |= p->tr_tm; - } - } - if( pMask ){ - *pMask = mask; - } - return (mask ? pList : 0); -} - -/* -** Convert the pStep->target token into a SrcList and return a pointer -** to that SrcList. -** -** This routine adds a specific database name, if needed, to the target when -** forming the SrcList. This prevents a trigger in one database from -** referring to a target in another database. An exception is when the -** trigger is in TEMP in which case it can refer to any other database it -** wants. -*/ -static SrcList *targetSrcList( - Parse *pParse, /* The parsing context */ - TriggerStep *pStep /* The trigger containing the target token */ -){ - int iDb; /* Index of the database to use */ - SrcList *pSrc; /* SrcList to be returned */ - - pSrc = sqlite3SrcListAppend(pParse->db, 0, &pStep->target, 0); - if( pSrc ){ - assert( pSrc->nSrc>0 ); - assert( pSrc->a!=0 ); - iDb = sqlite3SchemaToIndex(pParse->db, pStep->pTrig->pSchema); - if( iDb==0 || iDb>=2 ){ - sqlite3 *db = pParse->db; - assert( iDbdb->nDb ); - pSrc->a[pSrc->nSrc-1].zDatabase = sqlite3DbStrDup(db, db->aDb[iDb].zName); - } - } - return pSrc; -} - -/* -** Generate VDBE code for the statements inside the body of a single -** trigger. -*/ -static int codeTriggerProgram( - Parse *pParse, /* The parser context */ - TriggerStep *pStepList, /* List of statements inside the trigger body */ - int orconf /* Conflict algorithm. (OE_Abort, etc) */ -){ - TriggerStep *pStep; - Vdbe *v = pParse->pVdbe; - sqlite3 *db = pParse->db; - - assert( pParse->pTriggerTab && pParse->pToplevel ); - assert( pStepList ); - assert( v!=0 ); - for(pStep=pStepList; pStep; pStep=pStep->pNext){ - /* Figure out the ON CONFLICT policy that will be used for this step - ** of the trigger program. If the statement that caused this trigger - ** to fire had an explicit ON CONFLICT, then use it. Otherwise, use - ** the ON CONFLICT policy that was specified as part of the trigger - ** step statement. Example: - ** - ** CREATE TRIGGER AFTER INSERT ON t1 BEGIN; - ** INSERT OR REPLACE INTO t2 VALUES(new.a, new.b); - ** END; - ** - ** INSERT INTO t1 ... ; -- insert into t2 uses REPLACE policy - ** INSERT OR IGNORE INTO t1 ... ; -- insert into t2 uses IGNORE policy - */ - pParse->eOrconf = (orconf==OE_Default)?pStep->orconf:(u8)orconf; - - /* Clear the cookieGoto flag. When coding triggers, the cookieGoto - ** variable is used as a flag to indicate to sqlite3ExprCodeConstants() - ** that it is not safe to refactor constants (this happens after the - ** start of the first loop in the SQL statement is coded - at that - ** point code may be conditionally executed, so it is no longer safe to - ** initialize constant register values). */ - assert( pParse->cookieGoto==0 || pParse->cookieGoto==-1 ); - pParse->cookieGoto = 0; - - switch( pStep->op ){ - case TK_UPDATE: { - sqlite3Update(pParse, - targetSrcList(pParse, pStep), - sqlite3ExprListDup(db, pStep->pExprList, 0), - sqlite3ExprDup(db, pStep->pWhere, 0), - pParse->eOrconf - ); - break; - } - case TK_INSERT: { - sqlite3Insert(pParse, - targetSrcList(pParse, pStep), - sqlite3SelectDup(db, pStep->pSelect, 0), - sqlite3IdListDup(db, pStep->pIdList), - pParse->eOrconf - ); - break; - } - case TK_DELETE: { - sqlite3DeleteFrom(pParse, - targetSrcList(pParse, pStep), - sqlite3ExprDup(db, pStep->pWhere, 0) - ); - break; - } - default: assert( pStep->op==TK_SELECT ); { - SelectDest sDest; - Select *pSelect = sqlite3SelectDup(db, pStep->pSelect, 0); - sqlite3SelectDestInit(&sDest, SRT_Discard, 0); - sqlite3Select(pParse, pSelect, &sDest); - sqlite3SelectDelete(db, pSelect); - break; - } - } - if( pStep->op!=TK_SELECT ){ - sqlite3VdbeAddOp0(v, OP_ResetCount); - } - } - - return 0; -} - -#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS -/* -** This function is used to add VdbeComment() annotations to a VDBE -** program. It is not used in production code, only for debugging. -*/ -static const char *onErrorText(int onError){ - switch( onError ){ - case OE_Abort: return "abort"; - case OE_Rollback: return "rollback"; - case OE_Fail: return "fail"; - case OE_Replace: return "replace"; - case OE_Ignore: return "ignore"; - case OE_Default: return "default"; - } - return "n/a"; -} -#endif - -/* -** Parse context structure pFrom has just been used to create a sub-vdbe -** (trigger program). If an error has occurred, transfer error information -** from pFrom to pTo. -*/ -static void transferParseError(Parse *pTo, Parse *pFrom){ - assert( pFrom->zErrMsg==0 || pFrom->nErr ); - assert( pTo->zErrMsg==0 || pTo->nErr ); - if( pTo->nErr==0 ){ - pTo->zErrMsg = pFrom->zErrMsg; - pTo->nErr = pFrom->nErr; - }else{ - sqlite3DbFree(pFrom->db, pFrom->zErrMsg); - } -} - -/* -** Create and populate a new TriggerPrg object with a sub-program -** implementing trigger pTrigger with ON CONFLICT policy orconf. -*/ -static TriggerPrg *codeRowTrigger( - Parse *pParse, /* Current parse context */ - Trigger *pTrigger, /* Trigger to code */ - Table *pTab, /* The table pTrigger is attached to */ - int orconf /* ON CONFLICT policy to code trigger program with */ -){ - Parse *pTop = sqlite3ParseToplevel(pParse); - sqlite3 *db = pParse->db; /* Database handle */ - TriggerPrg *pPrg; /* Value to return */ - Expr *pWhen = 0; /* Duplicate of trigger WHEN expression */ - Vdbe *v; /* Temporary VM */ - NameContext sNC; /* Name context for sub-vdbe */ - SubProgram *pProgram = 0; /* Sub-vdbe for trigger program */ - Parse *pSubParse; /* Parse context for sub-vdbe */ - int iEndTrigger = 0; /* Label to jump to if WHEN is false */ - - assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) ); - assert( pTop->pVdbe ); - - /* Allocate the TriggerPrg and SubProgram objects. To ensure that they - ** are freed if an error occurs, link them into the Parse.pTriggerPrg - ** list of the top-level Parse object sooner rather than later. */ - pPrg = sqlite3DbMallocZero(db, sizeof(TriggerPrg)); - if( !pPrg ) return 0; - pPrg->pNext = pTop->pTriggerPrg; - pTop->pTriggerPrg = pPrg; - pPrg->pProgram = pProgram = sqlite3DbMallocZero(db, sizeof(SubProgram)); - if( !pProgram ) return 0; - sqlite3VdbeLinkSubProgram(pTop->pVdbe, pProgram); - pPrg->pTrigger = pTrigger; - pPrg->orconf = orconf; - pPrg->aColmask[0] = 0xffffffff; - pPrg->aColmask[1] = 0xffffffff; - - /* Allocate and populate a new Parse context to use for coding the - ** trigger sub-program. */ - pSubParse = sqlite3StackAllocZero(db, sizeof(Parse)); - if( !pSubParse ) return 0; - memset(&sNC, 0, sizeof(sNC)); - sNC.pParse = pSubParse; - pSubParse->db = db; - pSubParse->pTriggerTab = pTab; - pSubParse->pToplevel = pTop; - pSubParse->zAuthContext = pTrigger->zName; - pSubParse->eTriggerOp = pTrigger->op; - pSubParse->nQueryLoop = pParse->nQueryLoop; - - v = sqlite3GetVdbe(pSubParse); - if( v ){ - VdbeComment((v, "Start: %s.%s (%s %s%s%s ON %s)", - pTrigger->zName, onErrorText(orconf), - (pTrigger->tr_tm==TRIGGER_BEFORE ? "BEFORE" : "AFTER"), - (pTrigger->op==TK_UPDATE ? "UPDATE" : ""), - (pTrigger->op==TK_INSERT ? "INSERT" : ""), - (pTrigger->op==TK_DELETE ? "DELETE" : ""), - pTab->zName - )); -#ifndef SQLITE_OMIT_TRACE - sqlite3VdbeChangeP4(v, -1, - sqlite3MPrintf(db, "-- TRIGGER %s", pTrigger->zName), P4_DYNAMIC - ); -#endif - - /* If one was specified, code the WHEN clause. If it evaluates to false - ** (or NULL) the sub-vdbe is immediately halted by jumping to the - ** OP_Halt inserted at the end of the program. */ - if( pTrigger->pWhen ){ - pWhen = sqlite3ExprDup(db, pTrigger->pWhen, 0); - if( SQLITE_OK==sqlite3ResolveExprNames(&sNC, pWhen) - && db->mallocFailed==0 - ){ - iEndTrigger = sqlite3VdbeMakeLabel(v); - sqlite3ExprIfFalse(pSubParse, pWhen, iEndTrigger, SQLITE_JUMPIFNULL); - } - sqlite3ExprDelete(db, pWhen); - } - - /* Code the trigger program into the sub-vdbe. */ - codeTriggerProgram(pSubParse, pTrigger->step_list, orconf); - - /* Insert an OP_Halt at the end of the sub-program. */ - if( iEndTrigger ){ - sqlite3VdbeResolveLabel(v, iEndTrigger); - } - sqlite3VdbeAddOp0(v, OP_Halt); - VdbeComment((v, "End: %s.%s", pTrigger->zName, onErrorText(orconf))); - - transferParseError(pParse, pSubParse); - if( db->mallocFailed==0 ){ - pProgram->aOp = sqlite3VdbeTakeOpArray(v, &pProgram->nOp, &pTop->nMaxArg); - } - pProgram->nMem = pSubParse->nMem; - pProgram->nCsr = pSubParse->nTab; - pProgram->nOnce = pSubParse->nOnce; - pProgram->token = (void *)pTrigger; - pPrg->aColmask[0] = pSubParse->oldmask; - pPrg->aColmask[1] = pSubParse->newmask; - sqlite3VdbeDelete(v); - } - - assert( !pSubParse->pAinc && !pSubParse->pZombieTab ); - assert( !pSubParse->pTriggerPrg && !pSubParse->nMaxArg ); - sqlite3ParserReset(pSubParse); - sqlite3StackFree(db, pSubParse); - - return pPrg; -} - -/* -** Return a pointer to a TriggerPrg object containing the sub-program for -** trigger pTrigger with default ON CONFLICT algorithm orconf. If no such -** TriggerPrg object exists, a new object is allocated and populated before -** being returned. -*/ -static TriggerPrg *getRowTrigger( - Parse *pParse, /* Current parse context */ - Trigger *pTrigger, /* Trigger to code */ - Table *pTab, /* The table trigger pTrigger is attached to */ - int orconf /* ON CONFLICT algorithm. */ -){ - Parse *pRoot = sqlite3ParseToplevel(pParse); - TriggerPrg *pPrg; - - assert( pTrigger->zName==0 || pTab==tableOfTrigger(pTrigger) ); - - /* It may be that this trigger has already been coded (or is in the - ** process of being coded). If this is the case, then an entry with - ** a matching TriggerPrg.pTrigger field will be present somewhere - ** in the Parse.pTriggerPrg list. Search for such an entry. */ - for(pPrg=pRoot->pTriggerPrg; - pPrg && (pPrg->pTrigger!=pTrigger || pPrg->orconf!=orconf); - pPrg=pPrg->pNext - ); - - /* If an existing TriggerPrg could not be located, create a new one. */ - if( !pPrg ){ - pPrg = codeRowTrigger(pParse, pTrigger, pTab, orconf); - } - - return pPrg; -} - -/* -** Generate code for the trigger program associated with trigger p on -** table pTab. The reg, orconf and ignoreJump parameters passed to this -** function are the same as those described in the header function for -** sqlite3CodeRowTrigger() -*/ -SQLITE_PRIVATE void sqlite3CodeRowTriggerDirect( - Parse *pParse, /* Parse context */ - Trigger *p, /* Trigger to code */ - Table *pTab, /* The table to code triggers from */ - int reg, /* Reg array containing OLD.* and NEW.* values */ - int orconf, /* ON CONFLICT policy */ - int ignoreJump /* Instruction to jump to for RAISE(IGNORE) */ -){ - Vdbe *v = sqlite3GetVdbe(pParse); /* Main VM */ - TriggerPrg *pPrg; - pPrg = getRowTrigger(pParse, p, pTab, orconf); - assert( pPrg || pParse->nErr || pParse->db->mallocFailed ); - - /* Code the OP_Program opcode in the parent VDBE. P4 of the OP_Program - ** is a pointer to the sub-vdbe containing the trigger program. */ - if( pPrg ){ - int bRecursive = (p->zName && 0==(pParse->db->flags&SQLITE_RecTriggers)); - - sqlite3VdbeAddOp3(v, OP_Program, reg, ignoreJump, ++pParse->nMem); - sqlite3VdbeChangeP4(v, -1, (const char *)pPrg->pProgram, P4_SUBPROGRAM); - VdbeComment( - (v, "Call: %s.%s", (p->zName?p->zName:"fkey"), onErrorText(orconf))); - - /* Set the P5 operand of the OP_Program instruction to non-zero if - ** recursive invocation of this trigger program is disallowed. Recursive - ** invocation is disallowed if (a) the sub-program is really a trigger, - ** not a foreign key action, and (b) the flag to enable recursive triggers - ** is clear. */ - sqlite3VdbeChangeP5(v, (u8)bRecursive); - } -} - -/* -** This is called to code the required FOR EACH ROW triggers for an operation -** on table pTab. The operation to code triggers for (INSERT, UPDATE or DELETE) -** is given by the op parameter. The tr_tm parameter determines whether the -** BEFORE or AFTER triggers are coded. If the operation is an UPDATE, then -** parameter pChanges is passed the list of columns being modified. -** -** If there are no triggers that fire at the specified time for the specified -** operation on pTab, this function is a no-op. -** -** The reg argument is the address of the first in an array of registers -** that contain the values substituted for the new.* and old.* references -** in the trigger program. If N is the number of columns in table pTab -** (a copy of pTab->nCol), then registers are populated as follows: -** -** Register Contains -** ------------------------------------------------------ -** reg+0 OLD.rowid -** reg+1 OLD.* value of left-most column of pTab -** ... ... -** reg+N OLD.* value of right-most column of pTab -** reg+N+1 NEW.rowid -** reg+N+2 OLD.* value of left-most column of pTab -** ... ... -** reg+N+N+1 NEW.* value of right-most column of pTab -** -** For ON DELETE triggers, the registers containing the NEW.* values will -** never be accessed by the trigger program, so they are not allocated or -** populated by the caller (there is no data to populate them with anyway). -** Similarly, for ON INSERT triggers the values stored in the OLD.* registers -** are never accessed, and so are not allocated by the caller. So, for an -** ON INSERT trigger, the value passed to this function as parameter reg -** is not a readable register, although registers (reg+N) through -** (reg+N+N+1) are. -** -** Parameter orconf is the default conflict resolution algorithm for the -** trigger program to use (REPLACE, IGNORE etc.). Parameter ignoreJump -** is the instruction that control should jump to if a trigger program -** raises an IGNORE exception. -*/ -SQLITE_PRIVATE void sqlite3CodeRowTrigger( - Parse *pParse, /* Parse context */ - Trigger *pTrigger, /* List of triggers on table pTab */ - int op, /* One of TK_UPDATE, TK_INSERT, TK_DELETE */ - ExprList *pChanges, /* Changes list for any UPDATE OF triggers */ - int tr_tm, /* One of TRIGGER_BEFORE, TRIGGER_AFTER */ - Table *pTab, /* The table to code triggers from */ - int reg, /* The first in an array of registers (see above) */ - int orconf, /* ON CONFLICT policy */ - int ignoreJump /* Instruction to jump to for RAISE(IGNORE) */ -){ - Trigger *p; /* Used to iterate through pTrigger list */ - - assert( op==TK_UPDATE || op==TK_INSERT || op==TK_DELETE ); - assert( tr_tm==TRIGGER_BEFORE || tr_tm==TRIGGER_AFTER ); - assert( (op==TK_UPDATE)==(pChanges!=0) ); - - for(p=pTrigger; p; p=p->pNext){ - - /* Sanity checking: The schema for the trigger and for the table are - ** always defined. The trigger must be in the same schema as the table - ** or else it must be a TEMP trigger. */ - assert( p->pSchema!=0 ); - assert( p->pTabSchema!=0 ); - assert( p->pSchema==p->pTabSchema - || p->pSchema==pParse->db->aDb[1].pSchema ); - - /* Determine whether we should code this trigger */ - if( p->op==op - && p->tr_tm==tr_tm - && checkColumnOverlap(p->pColumns, pChanges) - ){ - sqlite3CodeRowTriggerDirect(pParse, p, pTab, reg, orconf, ignoreJump); - } - } -} - -/* -** Triggers may access values stored in the old.* or new.* pseudo-table. -** This function returns a 32-bit bitmask indicating which columns of the -** old.* or new.* tables actually are used by triggers. This information -** may be used by the caller, for example, to avoid having to load the entire -** old.* record into memory when executing an UPDATE or DELETE command. -** -** Bit 0 of the returned mask is set if the left-most column of the -** table may be accessed using an [old|new].reference. Bit 1 is set if -** the second leftmost column value is required, and so on. If there -** are more than 32 columns in the table, and at least one of the columns -** with an index greater than 32 may be accessed, 0xffffffff is returned. -** -** It is not possible to determine if the old.rowid or new.rowid column is -** accessed by triggers. The caller must always assume that it is. -** -** Parameter isNew must be either 1 or 0. If it is 0, then the mask returned -** applies to the old.* table. If 1, the new.* table. -** -** Parameter tr_tm must be a mask with one or both of the TRIGGER_BEFORE -** and TRIGGER_AFTER bits set. Values accessed by BEFORE triggers are only -** included in the returned mask if the TRIGGER_BEFORE bit is set in the -** tr_tm parameter. Similarly, values accessed by AFTER triggers are only -** included in the returned mask if the TRIGGER_AFTER bit is set in tr_tm. -*/ -SQLITE_PRIVATE u32 sqlite3TriggerColmask( - Parse *pParse, /* Parse context */ - Trigger *pTrigger, /* List of triggers on table pTab */ - ExprList *pChanges, /* Changes list for any UPDATE OF triggers */ - int isNew, /* 1 for new.* ref mask, 0 for old.* ref mask */ - int tr_tm, /* Mask of TRIGGER_BEFORE|TRIGGER_AFTER */ - Table *pTab, /* The table to code triggers from */ - int orconf /* Default ON CONFLICT policy for trigger steps */ -){ - const int op = pChanges ? TK_UPDATE : TK_DELETE; - u32 mask = 0; - Trigger *p; - - assert( isNew==1 || isNew==0 ); - for(p=pTrigger; p; p=p->pNext){ - if( p->op==op && (tr_tm&p->tr_tm) - && checkColumnOverlap(p->pColumns,pChanges) - ){ - TriggerPrg *pPrg; - pPrg = getRowTrigger(pParse, p, pTab, orconf); - if( pPrg ){ - mask |= pPrg->aColmask[isNew]; - } - } - } - - return mask; -} - -#endif /* !defined(SQLITE_OMIT_TRIGGER) */ - -/************** End of trigger.c *********************************************/ -/************** Begin file update.c ******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains C code routines that are called by the parser -** to handle UPDATE statements. -*/ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* Forward declaration */ -static void updateVirtualTable( - Parse *pParse, /* The parsing context */ - SrcList *pSrc, /* The virtual table to be modified */ - Table *pTab, /* The virtual table */ - ExprList *pChanges, /* The columns to change in the UPDATE statement */ - Expr *pRowidExpr, /* Expression used to recompute the rowid */ - int *aXRef, /* Mapping from columns of pTab to entries in pChanges */ - Expr *pWhere, /* WHERE clause of the UPDATE statement */ - int onError /* ON CONFLICT strategy */ -); -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/* -** The most recently coded instruction was an OP_Column to retrieve the -** i-th column of table pTab. This routine sets the P4 parameter of the -** OP_Column to the default value, if any. -** -** The default value of a column is specified by a DEFAULT clause in the -** column definition. This was either supplied by the user when the table -** was created, or added later to the table definition by an ALTER TABLE -** command. If the latter, then the row-records in the table btree on disk -** may not contain a value for the column and the default value, taken -** from the P4 parameter of the OP_Column instruction, is returned instead. -** If the former, then all row-records are guaranteed to include a value -** for the column and the P4 value is not required. -** -** Column definitions created by an ALTER TABLE command may only have -** literal default values specified: a number, null or a string. (If a more -** complicated default expression value was provided, it is evaluated -** when the ALTER TABLE is executed and one of the literal values written -** into the sqlite_master table.) -** -** Therefore, the P4 parameter is only required if the default value for -** the column is a literal number, string or null. The sqlite3ValueFromExpr() -** function is capable of transforming these types of expressions into -** sqlite3_value objects. -** -** If parameter iReg is not negative, code an OP_RealAffinity instruction -** on register iReg. This is used when an equivalent integer value is -** stored in place of an 8-byte floating point value in order to save -** space. -*/ -SQLITE_PRIVATE void sqlite3ColumnDefault(Vdbe *v, Table *pTab, int i, int iReg){ - assert( pTab!=0 ); - if( !pTab->pSelect ){ - sqlite3_value *pValue = 0; - u8 enc = ENC(sqlite3VdbeDb(v)); - Column *pCol = &pTab->aCol[i]; - VdbeComment((v, "%s.%s", pTab->zName, pCol->zName)); - assert( inCol ); - sqlite3ValueFromExpr(sqlite3VdbeDb(v), pCol->pDflt, enc, - pCol->affinity, &pValue); - if( pValue ){ - sqlite3VdbeChangeP4(v, -1, (const char *)pValue, P4_MEM); - } -#ifndef SQLITE_OMIT_FLOATING_POINT - if( pTab->aCol[i].affinity==SQLITE_AFF_REAL ){ - sqlite3VdbeAddOp1(v, OP_RealAffinity, iReg); - } -#endif - } -} - -/* -** Process an UPDATE statement. -** -** UPDATE OR IGNORE table_wxyz SET a=b, c=d WHERE e<5 AND f NOT NULL; -** \_______/ \________/ \______/ \________________/ -* onError pTabList pChanges pWhere -*/ -SQLITE_PRIVATE void sqlite3Update( - Parse *pParse, /* The parser context */ - SrcList *pTabList, /* The table in which we should change things */ - ExprList *pChanges, /* Things to be changed */ - Expr *pWhere, /* The WHERE clause. May be null */ - int onError /* How to handle constraint errors */ -){ - int i, j; /* Loop counters */ - Table *pTab; /* The table to be updated */ - int addrTop = 0; /* VDBE instruction address of the start of the loop */ - WhereInfo *pWInfo; /* Information about the WHERE clause */ - Vdbe *v; /* The virtual database engine */ - Index *pIdx; /* For looping over indices */ - Index *pPk; /* The PRIMARY KEY index for WITHOUT ROWID tables */ - int nIdx; /* Number of indices that need updating */ - int iBaseCur; /* Base cursor number */ - int iDataCur; /* Cursor for the canonical data btree */ - int iIdxCur; /* Cursor for the first index */ - sqlite3 *db; /* The database structure */ - int *aRegIdx = 0; /* One register assigned to each index to be updated */ - int *aXRef = 0; /* aXRef[i] is the index in pChanges->a[] of the - ** an expression for the i-th column of the table. - ** aXRef[i]==-1 if the i-th column is not changed. */ - u8 *aToOpen; /* 1 for tables and indices to be opened */ - u8 chngPk; /* PRIMARY KEY changed in a WITHOUT ROWID table */ - u8 chngRowid; /* Rowid changed in a normal table */ - u8 chngKey; /* Either chngPk or chngRowid */ - Expr *pRowidExpr = 0; /* Expression defining the new record number */ - AuthContext sContext; /* The authorization context */ - NameContext sNC; /* The name-context to resolve expressions in */ - int iDb; /* Database containing the table being updated */ - int okOnePass; /* True for one-pass algorithm without the FIFO */ - int hasFK; /* True if foreign key processing is required */ - int labelBreak; /* Jump here to break out of UPDATE loop */ - int labelContinue; /* Jump here to continue next step of UPDATE loop */ - -#ifndef SQLITE_OMIT_TRIGGER - int isView; /* True when updating a view (INSTEAD OF trigger) */ - Trigger *pTrigger; /* List of triggers on pTab, if required */ - int tmask; /* Mask of TRIGGER_BEFORE|TRIGGER_AFTER */ -#endif - int newmask; /* Mask of NEW.* columns accessed by BEFORE triggers */ - int iEph = 0; /* Ephemeral table holding all primary key values */ - int nKey = 0; /* Number of elements in regKey for WITHOUT ROWID */ - int aiCurOnePass[2]; /* The write cursors opened by WHERE_ONEPASS */ - - /* Register Allocations */ - int regRowCount = 0; /* A count of rows changed */ - int regOldRowid; /* The old rowid */ - int regNewRowid; /* The new rowid */ - int regNew; /* Content of the NEW.* table in triggers */ - int regOld = 0; /* Content of OLD.* table in triggers */ - int regRowSet = 0; /* Rowset of rows to be updated */ - int regKey = 0; /* composite PRIMARY KEY value */ - - memset(&sContext, 0, sizeof(sContext)); - db = pParse->db; - if( pParse->nErr || db->mallocFailed ){ - goto update_cleanup; - } - assert( pTabList->nSrc==1 ); - - /* Locate the table which we want to update. - */ - pTab = sqlite3SrcListLookup(pParse, pTabList); - if( pTab==0 ) goto update_cleanup; - iDb = sqlite3SchemaToIndex(pParse->db, pTab->pSchema); - - /* Figure out if we have any triggers and if the table being - ** updated is a view. - */ -#ifndef SQLITE_OMIT_TRIGGER - pTrigger = sqlite3TriggersExist(pParse, pTab, TK_UPDATE, pChanges, &tmask); - isView = pTab->pSelect!=0; - assert( pTrigger || tmask==0 ); -#else -# define pTrigger 0 -# define isView 0 -# define tmask 0 -#endif -#ifdef SQLITE_OMIT_VIEW -# undef isView -# define isView 0 -#endif - - if( sqlite3ViewGetColumnNames(pParse, pTab) ){ - goto update_cleanup; - } - if( sqlite3IsReadOnly(pParse, pTab, tmask) ){ - goto update_cleanup; - } - - /* Allocate a cursors for the main database table and for all indices. - ** The index cursors might not be used, but if they are used they - ** need to occur right after the database cursor. So go ahead and - ** allocate enough space, just in case. - */ - pTabList->a[0].iCursor = iBaseCur = iDataCur = pParse->nTab++; - iIdxCur = iDataCur+1; - pPk = HasRowid(pTab) ? 0 : sqlite3PrimaryKeyIndex(pTab); - for(nIdx=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, nIdx++){ - if( pIdx->autoIndex==2 && pPk!=0 ){ - iDataCur = pParse->nTab; - pTabList->a[0].iCursor = iDataCur; - } - pParse->nTab++; - } - - /* Allocate space for aXRef[], aRegIdx[], and aToOpen[]. - ** Initialize aXRef[] and aToOpen[] to their default values. - */ - aXRef = sqlite3DbMallocRaw(db, sizeof(int) * (pTab->nCol+nIdx) + nIdx+2 ); - if( aXRef==0 ) goto update_cleanup; - aRegIdx = aXRef+pTab->nCol; - aToOpen = (u8*)(aRegIdx+nIdx); - memset(aToOpen, 1, nIdx+1); - aToOpen[nIdx+1] = 0; - for(i=0; inCol; i++) aXRef[i] = -1; - - /* Initialize the name-context */ - memset(&sNC, 0, sizeof(sNC)); - sNC.pParse = pParse; - sNC.pSrcList = pTabList; - - /* Resolve the column names in all the expressions of the - ** of the UPDATE statement. Also find the column index - ** for each column to be updated in the pChanges array. For each - ** column to be updated, make sure we have authorization to change - ** that column. - */ - chngRowid = chngPk = 0; - for(i=0; inExpr; i++){ - if( sqlite3ResolveExprNames(&sNC, pChanges->a[i].pExpr) ){ - goto update_cleanup; - } - for(j=0; jnCol; j++){ - if( sqlite3StrICmp(pTab->aCol[j].zName, pChanges->a[i].zName)==0 ){ - if( j==pTab->iPKey ){ - chngRowid = 1; - pRowidExpr = pChanges->a[i].pExpr; - }else if( pPk && (pTab->aCol[j].colFlags & COLFLAG_PRIMKEY)!=0 ){ - chngPk = 1; - } - aXRef[j] = i; - break; - } - } - if( j>=pTab->nCol ){ - if( pPk==0 && sqlite3IsRowid(pChanges->a[i].zName) ){ - j = -1; - chngRowid = 1; - pRowidExpr = pChanges->a[i].pExpr; - }else{ - sqlite3ErrorMsg(pParse, "no such column: %s", pChanges->a[i].zName); - pParse->checkSchema = 1; - goto update_cleanup; - } - } -#ifndef SQLITE_OMIT_AUTHORIZATION - { - int rc; - rc = sqlite3AuthCheck(pParse, SQLITE_UPDATE, pTab->zName, - j<0 ? "ROWID" : pTab->aCol[j].zName, - db->aDb[iDb].zName); - if( rc==SQLITE_DENY ){ - goto update_cleanup; - }else if( rc==SQLITE_IGNORE ){ - aXRef[j] = -1; - } - } -#endif - } - assert( (chngRowid & chngPk)==0 ); - assert( chngRowid==0 || chngRowid==1 ); - assert( chngPk==0 || chngPk==1 ); - chngKey = chngRowid + chngPk; - - /* The SET expressions are not actually used inside the WHERE loop. - ** So reset the colUsed mask - */ - pTabList->a[0].colUsed = 0; - - hasFK = sqlite3FkRequired(pParse, pTab, aXRef, chngKey); - - /* There is one entry in the aRegIdx[] array for each index on the table - ** being updated. Fill in aRegIdx[] with a register number that will hold - ** the key for accessing each index. - */ - for(j=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, j++){ - int reg; - if( chngKey || hasFK || pIdx->pPartIdxWhere || pIdx==pPk ){ - reg = ++pParse->nMem; - }else{ - reg = 0; - for(i=0; inKeyCol; i++){ - if( aXRef[pIdx->aiColumn[i]]>=0 ){ - reg = ++pParse->nMem; - break; - } - } - } - if( reg==0 ) aToOpen[j+1] = 0; - aRegIdx[j] = reg; - } - - /* Begin generating code. */ - v = sqlite3GetVdbe(pParse); - if( v==0 ) goto update_cleanup; - if( pParse->nested==0 ) sqlite3VdbeCountChanges(v); - sqlite3BeginWriteOperation(pParse, 1, iDb); - -#ifndef SQLITE_OMIT_VIRTUALTABLE - /* Virtual tables must be handled separately */ - if( IsVirtual(pTab) ){ - updateVirtualTable(pParse, pTabList, pTab, pChanges, pRowidExpr, aXRef, - pWhere, onError); - pWhere = 0; - pTabList = 0; - goto update_cleanup; - } -#endif - - /* Allocate required registers. */ - regRowSet = ++pParse->nMem; - regOldRowid = regNewRowid = ++pParse->nMem; - if( chngPk || pTrigger || hasFK ){ - regOld = pParse->nMem + 1; - pParse->nMem += pTab->nCol; - } - if( chngKey || pTrigger || hasFK ){ - regNewRowid = ++pParse->nMem; - } - regNew = pParse->nMem + 1; - pParse->nMem += pTab->nCol; - - /* Start the view context. */ - if( isView ){ - sqlite3AuthContextPush(pParse, &sContext, pTab->zName); - } - - /* If we are trying to update a view, realize that view into - ** a ephemeral table. - */ -#if !defined(SQLITE_OMIT_VIEW) && !defined(SQLITE_OMIT_TRIGGER) - if( isView ){ - sqlite3MaterializeView(pParse, pTab, pWhere, iDataCur); - } -#endif - - /* Resolve the column names in all the expressions in the - ** WHERE clause. - */ - if( sqlite3ResolveExprNames(&sNC, pWhere) ){ - goto update_cleanup; - } - - /* Begin the database scan - */ - if( HasRowid(pTab) ){ - sqlite3VdbeAddOp3(v, OP_Null, 0, regRowSet, regOldRowid); - pWInfo = sqlite3WhereBegin( - pParse, pTabList, pWhere, 0, 0, WHERE_ONEPASS_DESIRED, iIdxCur - ); - if( pWInfo==0 ) goto update_cleanup; - okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); - - /* Remember the rowid of every item to be updated. - */ - sqlite3VdbeAddOp2(v, OP_Rowid, iDataCur, regOldRowid); - if( !okOnePass ){ - sqlite3VdbeAddOp2(v, OP_RowSetAdd, regRowSet, regOldRowid); - } - - /* End the database scan loop. - */ - sqlite3WhereEnd(pWInfo); - }else{ - int iPk; /* First of nPk memory cells holding PRIMARY KEY value */ - i16 nPk; /* Number of components of the PRIMARY KEY */ - int addrOpen; /* Address of the OpenEphemeral instruction */ - - assert( pPk!=0 ); - nPk = pPk->nKeyCol; - iPk = pParse->nMem+1; - pParse->nMem += nPk; - regKey = ++pParse->nMem; - iEph = pParse->nTab++; - sqlite3VdbeAddOp2(v, OP_Null, 0, iPk); - addrOpen = sqlite3VdbeAddOp2(v, OP_OpenEphemeral, iEph, nPk); - sqlite3VdbeSetP4KeyInfo(pParse, pPk); - pWInfo = sqlite3WhereBegin(pParse, pTabList, pWhere, 0, 0, - WHERE_ONEPASS_DESIRED, iIdxCur); - if( pWInfo==0 ) goto update_cleanup; - okOnePass = sqlite3WhereOkOnePass(pWInfo, aiCurOnePass); - for(i=0; iaiColumn[i], - iPk+i); - } - if( okOnePass ){ - sqlite3VdbeChangeToNoop(v, addrOpen); - nKey = nPk; - regKey = iPk; - }else{ - sqlite3VdbeAddOp4(v, OP_MakeRecord, iPk, nPk, regKey, - sqlite3IndexAffinityStr(v, pPk), P4_TRANSIENT); - sqlite3VdbeAddOp2(v, OP_IdxInsert, iEph, regKey); - } - sqlite3WhereEnd(pWInfo); - } - - /* Initialize the count of updated rows - */ - if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab ){ - regRowCount = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, regRowCount); - } - - labelBreak = sqlite3VdbeMakeLabel(v); - if( !isView ){ - /* - ** Open every index that needs updating. Note that if any - ** index could potentially invoke a REPLACE conflict resolution - ** action, then we need to open all indices because we might need - ** to be deleting some records. - */ - if( onError==OE_Replace ){ - memset(aToOpen, 1, nIdx+1); - }else{ - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->onError==OE_Replace ){ - memset(aToOpen, 1, nIdx+1); - break; - } - } - } - if( okOnePass ){ - if( aiCurOnePass[0]>=0 ) aToOpen[aiCurOnePass[0]-iBaseCur] = 0; - if( aiCurOnePass[1]>=0 ) aToOpen[aiCurOnePass[1]-iBaseCur] = 0; - } - sqlite3OpenTableAndIndices(pParse, pTab, OP_OpenWrite, iBaseCur, aToOpen, - 0, 0); - } - - /* Top of the update loop */ - if( okOnePass ){ - if( aToOpen[iDataCur-iBaseCur] ){ - assert( pPk!=0 ); - sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelBreak, regKey, nKey); - } - labelContinue = labelBreak; - sqlite3VdbeAddOp2(v, OP_IsNull, pPk ? regKey : regOldRowid, labelBreak); - }else if( pPk ){ - labelContinue = sqlite3VdbeMakeLabel(v); - sqlite3VdbeAddOp2(v, OP_Rewind, iEph, labelBreak); - addrTop = sqlite3VdbeAddOp2(v, OP_RowKey, iEph, regKey); - sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue, regKey, 0); - }else{ - labelContinue = sqlite3VdbeAddOp3(v, OP_RowSetRead, regRowSet, labelBreak, - regOldRowid); - sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid); - } - - /* If the record number will change, set register regNewRowid to - ** contain the new value. If the record number is not being modified, - ** then regNewRowid is the same register as regOldRowid, which is - ** already populated. */ - assert( chngKey || pTrigger || hasFK || regOldRowid==regNewRowid ); - if( chngRowid ){ - sqlite3ExprCode(pParse, pRowidExpr, regNewRowid); - sqlite3VdbeAddOp1(v, OP_MustBeInt, regNewRowid); - } - - /* Compute the old pre-UPDATE content of the row being changed, if that - ** information is needed */ - if( chngPk || hasFK || pTrigger ){ - u32 oldmask = (hasFK ? sqlite3FkOldmask(pParse, pTab) : 0); - oldmask |= sqlite3TriggerColmask(pParse, - pTrigger, pChanges, 0, TRIGGER_BEFORE|TRIGGER_AFTER, pTab, onError - ); - for(i=0; inCol; i++){ - if( oldmask==0xffffffff - || (i<32 && (oldmask & MASKBIT32(i))!=0) - || (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 - ){ - testcase( oldmask!=0xffffffff && i==31 ); - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regOld+i); - }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, regOld+i); - } - } - if( chngRowid==0 && pPk==0 ){ - sqlite3VdbeAddOp2(v, OP_Copy, regOldRowid, regNewRowid); - } - } - - /* Populate the array of registers beginning at regNew with the new - ** row data. This array is used to check constaints, create the new - ** table and index records, and as the values for any new.* references - ** made by triggers. - ** - ** If there are one or more BEFORE triggers, then do not populate the - ** registers associated with columns that are (a) not modified by - ** this UPDATE statement and (b) not accessed by new.* references. The - ** values for registers not modified by the UPDATE must be reloaded from - ** the database after the BEFORE triggers are fired anyway (as the trigger - ** may have modified them). So not loading those that are not going to - ** be used eliminates some redundant opcodes. - */ - newmask = sqlite3TriggerColmask( - pParse, pTrigger, pChanges, 1, TRIGGER_BEFORE, pTab, onError - ); - /*sqlite3VdbeAddOp3(v, OP_Null, 0, regNew, regNew+pTab->nCol-1);*/ - for(i=0; inCol; i++){ - if( i==pTab->iPKey ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i); - }else{ - j = aXRef[i]; - if( j>=0 ){ - sqlite3ExprCode(pParse, pChanges->a[j].pExpr, regNew+i); - }else if( 0==(tmask&TRIGGER_BEFORE) || i>31 || (newmask & MASKBIT32(i)) ){ - /* This branch loads the value of a column that will not be changed - ** into a register. This is done if there are no BEFORE triggers, or - ** if there are one or more BEFORE triggers that use this value via - ** a new.* reference in a trigger program. - */ - testcase( i==31 ); - testcase( i==32 ); - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i); - }else{ - sqlite3VdbeAddOp2(v, OP_Null, 0, regNew+i); - } - } - } - - /* Fire any BEFORE UPDATE triggers. This happens before constraints are - ** verified. One could argue that this is wrong. - */ - if( tmask&TRIGGER_BEFORE ){ - sqlite3VdbeAddOp2(v, OP_Affinity, regNew, pTab->nCol); - sqlite3TableAffinityStr(v, pTab); - sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, - TRIGGER_BEFORE, pTab, regOldRowid, onError, labelContinue); - - /* The row-trigger may have deleted the row being updated. In this - ** case, jump to the next row. No updates or AFTER triggers are - ** required. This behavior - what happens when the row being updated - ** is deleted or renamed by a BEFORE trigger - is left undefined in the - ** documentation. - */ - if( pPk ){ - sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, labelContinue,regKey,nKey); - }else{ - sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, labelContinue, regOldRowid); - } - - /* If it did not delete it, the row-trigger may still have modified - ** some of the columns of the row being updated. Load the values for - ** all columns not modified by the update statement into their - ** registers in case this has happened. - */ - for(i=0; inCol; i++){ - if( aXRef[i]<0 && i!=pTab->iPKey ){ - sqlite3ExprCodeGetColumnOfTable(v, pTab, iDataCur, i, regNew+i); - } - } - } - - if( !isView ){ - int j1 = 0; /* Address of jump instruction */ - int bReplace = 0; /* True if REPLACE conflict resolution might happen */ - - /* Do constraint checks. */ - assert( regOldRowid>0 ); - sqlite3GenerateConstraintChecks(pParse, pTab, aRegIdx, iDataCur, iIdxCur, - regNewRowid, regOldRowid, chngKey, onError, labelContinue, &bReplace); - - /* Do FK constraint checks. */ - if( hasFK ){ - sqlite3FkCheck(pParse, pTab, regOldRowid, 0, aXRef, chngKey); - } - - /* Delete the index entries associated with the current record. */ - if( bReplace || chngKey ){ - if( pPk ){ - j1 = sqlite3VdbeAddOp4Int(v, OP_NotFound, iDataCur, 0, regKey, nKey); - }else{ - j1 = sqlite3VdbeAddOp3(v, OP_NotExists, iDataCur, 0, regOldRowid); - } - } - sqlite3GenerateRowIndexDelete(pParse, pTab, iDataCur, iIdxCur, aRegIdx); - - /* If changing the record number, delete the old record. */ - if( hasFK || chngKey || pPk!=0 ){ - sqlite3VdbeAddOp2(v, OP_Delete, iDataCur, 0); - } - if( bReplace || chngKey ){ - sqlite3VdbeJumpHere(v, j1); - } - - if( hasFK ){ - sqlite3FkCheck(pParse, pTab, 0, regNewRowid, aXRef, chngKey); - } - - /* Insert the new index entries and the new record. */ - sqlite3CompleteInsertion(pParse, pTab, iDataCur, iIdxCur, - regNewRowid, aRegIdx, 1, 0, 0); - - /* Do any ON CASCADE, SET NULL or SET DEFAULT operations required to - ** handle rows (possibly in other tables) that refer via a foreign key - ** to the row just updated. */ - if( hasFK ){ - sqlite3FkActions(pParse, pTab, pChanges, regOldRowid, aXRef, chngKey); - } - } - - /* Increment the row counter - */ - if( (db->flags & SQLITE_CountRows) && !pParse->pTriggerTab){ - sqlite3VdbeAddOp2(v, OP_AddImm, regRowCount, 1); - } - - sqlite3CodeRowTrigger(pParse, pTrigger, TK_UPDATE, pChanges, - TRIGGER_AFTER, pTab, regOldRowid, onError, labelContinue); - - /* Repeat the above with the next record to be updated, until - ** all record selected by the WHERE clause have been updated. - */ - if( okOnePass ){ - /* Nothing to do at end-of-loop for a single-pass */ - }else if( pPk ){ - sqlite3VdbeResolveLabel(v, labelContinue); - sqlite3VdbeAddOp2(v, OP_Next, iEph, addrTop); - }else{ - sqlite3VdbeAddOp2(v, OP_Goto, 0, labelContinue); - } - sqlite3VdbeResolveLabel(v, labelBreak); - - /* Close all tables */ - for(i=0, pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext, i++){ - assert( aRegIdx ); - if( aToOpen[i+1] ){ - sqlite3VdbeAddOp2(v, OP_Close, iIdxCur+i, 0); - } - } - if( iDataCurnested==0 && pParse->pTriggerTab==0 ){ - sqlite3AutoincrementEnd(pParse); - } - - /* - ** Return the number of rows that were changed. If this routine is - ** generating code because of a call to sqlite3NestedParse(), do not - ** invoke the callback function. - */ - if( (db->flags&SQLITE_CountRows) && !pParse->pTriggerTab && !pParse->nested ){ - sqlite3VdbeAddOp2(v, OP_ResultRow, regRowCount, 1); - sqlite3VdbeSetNumCols(v, 1); - sqlite3VdbeSetColName(v, 0, COLNAME_NAME, "rows updated", SQLITE_STATIC); - } - -update_cleanup: - sqlite3AuthContextPop(&sContext); - sqlite3DbFree(db, aXRef); /* Also frees aRegIdx[] and aToOpen[] */ - sqlite3SrcListDelete(db, pTabList); - sqlite3ExprListDelete(db, pChanges); - sqlite3ExprDelete(db, pWhere); - return; -} -/* Make sure "isView" and other macros defined above are undefined. Otherwise -** thely may interfere with compilation of other functions in this file -** (or in another file, if this file becomes part of the amalgamation). */ -#ifdef isView - #undef isView -#endif -#ifdef pTrigger - #undef pTrigger -#endif - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* -** Generate code for an UPDATE of a virtual table. -** -** The strategy is that we create an ephemerial table that contains -** for each row to be changed: -** -** (A) The original rowid of that row. -** (B) The revised rowid for the row. (note1) -** (C) The content of every column in the row. -** -** Then we loop over this ephemeral table and for each row in -** the ephermeral table call VUpdate. -** -** When finished, drop the ephemeral table. -** -** (note1) Actually, if we know in advance that (A) is always the same -** as (B) we only store (A), then duplicate (A) when pulling -** it out of the ephemeral table before calling VUpdate. -*/ -static void updateVirtualTable( - Parse *pParse, /* The parsing context */ - SrcList *pSrc, /* The virtual table to be modified */ - Table *pTab, /* The virtual table */ - ExprList *pChanges, /* The columns to change in the UPDATE statement */ - Expr *pRowid, /* Expression used to recompute the rowid */ - int *aXRef, /* Mapping from columns of pTab to entries in pChanges */ - Expr *pWhere, /* WHERE clause of the UPDATE statement */ - int onError /* ON CONFLICT strategy */ -){ - Vdbe *v = pParse->pVdbe; /* Virtual machine under construction */ - ExprList *pEList = 0; /* The result set of the SELECT statement */ - Select *pSelect = 0; /* The SELECT statement */ - Expr *pExpr; /* Temporary expression */ - int ephemTab; /* Table holding the result of the SELECT */ - int i; /* Loop counter */ - int addr; /* Address of top of loop */ - int iReg; /* First register in set passed to OP_VUpdate */ - sqlite3 *db = pParse->db; /* Database connection */ - const char *pVTab = (const char*)sqlite3GetVTable(db, pTab); - SelectDest dest; - - /* Construct the SELECT statement that will find the new values for - ** all updated rows. - */ - pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ID, "_rowid_")); - if( pRowid ){ - pEList = sqlite3ExprListAppend(pParse, pEList, - sqlite3ExprDup(db, pRowid, 0)); - } - assert( pTab->iPKey<0 ); - for(i=0; inCol; i++){ - if( aXRef[i]>=0 ){ - pExpr = sqlite3ExprDup(db, pChanges->a[aXRef[i]].pExpr, 0); - }else{ - pExpr = sqlite3Expr(db, TK_ID, pTab->aCol[i].zName); - } - pEList = sqlite3ExprListAppend(pParse, pEList, pExpr); - } - pSelect = sqlite3SelectNew(pParse, pEList, pSrc, pWhere, 0, 0, 0, 0, 0, 0); - - /* Create the ephemeral table into which the update results will - ** be stored. - */ - assert( v ); - ephemTab = pParse->nTab++; - sqlite3VdbeAddOp2(v, OP_OpenEphemeral, ephemTab, pTab->nCol+1+(pRowid!=0)); - sqlite3VdbeChangeP5(v, BTREE_UNORDERED); - - /* fill the ephemeral table - */ - sqlite3SelectDestInit(&dest, SRT_Table, ephemTab); - sqlite3Select(pParse, pSelect, &dest); - - /* Generate code to scan the ephemeral table and call VUpdate. */ - iReg = ++pParse->nMem; - pParse->nMem += pTab->nCol+1; - addr = sqlite3VdbeAddOp2(v, OP_Rewind, ephemTab, 0); - sqlite3VdbeAddOp3(v, OP_Column, ephemTab, 0, iReg); - sqlite3VdbeAddOp3(v, OP_Column, ephemTab, (pRowid?1:0), iReg+1); - for(i=0; inCol; i++){ - sqlite3VdbeAddOp3(v, OP_Column, ephemTab, i+1+(pRowid!=0), iReg+2+i); - } - sqlite3VtabMakeWritable(pParse, pTab); - sqlite3VdbeAddOp4(v, OP_VUpdate, 0, pTab->nCol+2, iReg, pVTab, P4_VTAB); - sqlite3VdbeChangeP5(v, onError==OE_Default ? OE_Abort : onError); - sqlite3MayAbort(pParse); - sqlite3VdbeAddOp2(v, OP_Next, ephemTab, addr+1); - sqlite3VdbeJumpHere(v, addr); - sqlite3VdbeAddOp2(v, OP_Close, ephemTab, 0); - - /* Cleanup */ - sqlite3SelectDelete(db, pSelect); -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/************** End of update.c **********************************************/ -/************** Begin file vacuum.c ******************************************/ -/* -** 2003 April 6 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code used to implement the VACUUM command. -** -** Most of the code in this file may be omitted by defining the -** SQLITE_OMIT_VACUUM macro. -*/ - -#if !defined(SQLITE_OMIT_VACUUM) && !defined(SQLITE_OMIT_ATTACH) -/* -** Finalize a prepared statement. If there was an error, store the -** text of the error message in *pzErrMsg. Return the result code. -*/ -static int vacuumFinalize(sqlite3 *db, sqlite3_stmt *pStmt, char **pzErrMsg){ - int rc; - rc = sqlite3VdbeFinalize((Vdbe*)pStmt); - if( rc ){ - sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db)); - } - return rc; -} - -/* -** Execute zSql on database db. Return an error code. -*/ -static int execSql(sqlite3 *db, char **pzErrMsg, const char *zSql){ - sqlite3_stmt *pStmt; - VVA_ONLY( int rc; ) - if( !zSql ){ - return SQLITE_NOMEM; - } - if( SQLITE_OK!=sqlite3_prepare(db, zSql, -1, &pStmt, 0) ){ - sqlite3SetString(pzErrMsg, db, sqlite3_errmsg(db)); - return sqlite3_errcode(db); - } - VVA_ONLY( rc = ) sqlite3_step(pStmt); - assert( rc!=SQLITE_ROW || (db->flags&SQLITE_CountRows) ); - return vacuumFinalize(db, pStmt, pzErrMsg); -} - -/* -** Execute zSql on database db. The statement returns exactly -** one column. Execute this as SQL on the same database. -*/ -static int execExecSql(sqlite3 *db, char **pzErrMsg, const char *zSql){ - sqlite3_stmt *pStmt; - int rc; - - rc = sqlite3_prepare(db, zSql, -1, &pStmt, 0); - if( rc!=SQLITE_OK ) return rc; - - while( SQLITE_ROW==sqlite3_step(pStmt) ){ - rc = execSql(db, pzErrMsg, (char*)sqlite3_column_text(pStmt, 0)); - if( rc!=SQLITE_OK ){ - vacuumFinalize(db, pStmt, pzErrMsg); - return rc; - } - } - - return vacuumFinalize(db, pStmt, pzErrMsg); -} - -/* -** The VACUUM command is used to clean up the database, -** collapse free space, etc. It is modelled after the VACUUM command -** in PostgreSQL. The VACUUM command works as follows: -** -** (1) Create a new transient database file -** (2) Copy all content from the database being vacuumed into -** the new transient database file -** (3) Copy content from the transient database back into the -** original database. -** -** The transient database requires temporary disk space approximately -** equal to the size of the original database. The copy operation of -** step (3) requires additional temporary disk space approximately equal -** to the size of the original database for the rollback journal. -** Hence, temporary disk space that is approximately 2x the size of the -** orginal database is required. Every page of the database is written -** approximately 3 times: Once for step (2) and twice for step (3). -** Two writes per page are required in step (3) because the original -** database content must be written into the rollback journal prior to -** overwriting the database with the vacuumed content. -** -** Only 1x temporary space and only 1x writes would be required if -** the copy of step (3) were replace by deleting the original database -** and renaming the transient database as the original. But that will -** not work if other processes are attached to the original database. -** And a power loss in between deleting the original and renaming the -** transient would cause the database file to appear to be deleted -** following reboot. -*/ -SQLITE_PRIVATE void sqlite3Vacuum(Parse *pParse){ - Vdbe *v = sqlite3GetVdbe(pParse); - if( v ){ - sqlite3VdbeAddOp2(v, OP_Vacuum, 0, 0); - sqlite3VdbeUsesBtree(v, 0); - } - return; -} - -/* -** This routine implements the OP_Vacuum opcode of the VDBE. -*/ -SQLITE_PRIVATE int sqlite3RunVacuum(char **pzErrMsg, sqlite3 *db){ - int rc = SQLITE_OK; /* Return code from service routines */ - Btree *pMain; /* The database being vacuumed */ - Btree *pTemp; /* The temporary database we vacuum into */ - char *zSql = 0; /* SQL statements */ - int saved_flags; /* Saved value of the db->flags */ - int saved_nChange; /* Saved value of db->nChange */ - int saved_nTotalChange; /* Saved value of db->nTotalChange */ - void (*saved_xTrace)(void*,const char*); /* Saved db->xTrace */ - Db *pDb = 0; /* Database to detach at end of vacuum */ - int isMemDb; /* True if vacuuming a :memory: database */ - int nRes; /* Bytes of reserved space at the end of each page */ - int nDb; /* Number of attached databases */ - - if( !db->autoCommit ){ - sqlite3SetString(pzErrMsg, db, "cannot VACUUM from within a transaction"); - return SQLITE_ERROR; - } - if( db->nVdbeActive>1 ){ - sqlite3SetString(pzErrMsg, db,"cannot VACUUM - SQL statements in progress"); - return SQLITE_ERROR; - } - - /* Save the current value of the database flags so that it can be - ** restored before returning. Then set the writable-schema flag, and - ** disable CHECK and foreign key constraints. */ - saved_flags = db->flags; - saved_nChange = db->nChange; - saved_nTotalChange = db->nTotalChange; - saved_xTrace = db->xTrace; - db->flags |= SQLITE_WriteSchema | SQLITE_IgnoreChecks | SQLITE_PreferBuiltin; - db->flags &= ~(SQLITE_ForeignKeys | SQLITE_ReverseOrder); - db->xTrace = 0; - - pMain = db->aDb[0].pBt; - isMemDb = sqlite3PagerIsMemdb(sqlite3BtreePager(pMain)); - - /* Attach the temporary database as 'vacuum_db'. The synchronous pragma - ** can be set to 'off' for this file, as it is not recovered if a crash - ** occurs anyway. The integrity of the database is maintained by a - ** (possibly synchronous) transaction opened on the main database before - ** sqlite3BtreeCopyFile() is called. - ** - ** An optimisation would be to use a non-journaled pager. - ** (Later:) I tried setting "PRAGMA vacuum_db.journal_mode=OFF" but - ** that actually made the VACUUM run slower. Very little journalling - ** actually occurs when doing a vacuum since the vacuum_db is initially - ** empty. Only the journal header is written. Apparently it takes more - ** time to parse and run the PRAGMA to turn journalling off than it does - ** to write the journal header file. - */ - nDb = db->nDb; - if( sqlite3TempInMemory(db) ){ - zSql = "ATTACH ':memory:' AS vacuum_db;"; - }else{ - zSql = "ATTACH '' AS vacuum_db;"; - } - rc = execSql(db, pzErrMsg, zSql); - if( db->nDb>nDb ){ - pDb = &db->aDb[db->nDb-1]; - assert( strcmp(pDb->zName,"vacuum_db")==0 ); - } - if( rc!=SQLITE_OK ) goto end_of_vacuum; - pTemp = db->aDb[db->nDb-1].pBt; - - /* The call to execSql() to attach the temp database has left the file - ** locked (as there was more than one active statement when the transaction - ** to read the schema was concluded. Unlock it here so that this doesn't - ** cause problems for the call to BtreeSetPageSize() below. */ - sqlite3BtreeCommit(pTemp); - - nRes = sqlite3BtreeGetReserve(pMain); - - /* A VACUUM cannot change the pagesize of an encrypted database. */ -#ifdef SQLITE_HAS_CODEC - if( db->nextPagesize ){ - extern void sqlite3CodecGetKey(sqlite3*, int, void**, int*); - int nKey; - char *zKey; - sqlite3CodecGetKey(db, 0, (void**)&zKey, &nKey); - if( nKey ) db->nextPagesize = 0; - } -#endif - - rc = execSql(db, pzErrMsg, "PRAGMA vacuum_db.synchronous=OFF"); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - - /* Begin a transaction and take an exclusive lock on the main database - ** file. This is done before the sqlite3BtreeGetPageSize(pMain) call below, - ** to ensure that we do not try to change the page-size on a WAL database. - */ - rc = execSql(db, pzErrMsg, "BEGIN;"); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - rc = sqlite3BtreeBeginTrans(pMain, 2); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - - /* Do not attempt to change the page size for a WAL database */ - if( sqlite3PagerGetJournalMode(sqlite3BtreePager(pMain)) - ==PAGER_JOURNALMODE_WAL ){ - db->nextPagesize = 0; - } - - if( sqlite3BtreeSetPageSize(pTemp, sqlite3BtreeGetPageSize(pMain), nRes, 0) - || (!isMemDb && sqlite3BtreeSetPageSize(pTemp, db->nextPagesize, nRes, 0)) - || NEVER(db->mallocFailed) - ){ - rc = SQLITE_NOMEM; - goto end_of_vacuum; - } - -#ifndef SQLITE_OMIT_AUTOVACUUM - sqlite3BtreeSetAutoVacuum(pTemp, db->nextAutovac>=0 ? db->nextAutovac : - sqlite3BtreeGetAutoVacuum(pMain)); -#endif - - /* Query the schema of the main database. Create a mirror schema - ** in the temporary database. - */ - rc = execExecSql(db, pzErrMsg, - "SELECT 'CREATE TABLE vacuum_db.' || substr(sql,14) " - " FROM sqlite_master WHERE type='table' AND name!='sqlite_sequence'" - " AND coalesce(rootpage,1)>0" - ); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - rc = execExecSql(db, pzErrMsg, - "SELECT 'CREATE INDEX vacuum_db.' || substr(sql,14)" - " FROM sqlite_master WHERE sql LIKE 'CREATE INDEX %' "); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - rc = execExecSql(db, pzErrMsg, - "SELECT 'CREATE UNIQUE INDEX vacuum_db.' || substr(sql,21) " - " FROM sqlite_master WHERE sql LIKE 'CREATE UNIQUE INDEX %'"); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - - /* Loop through the tables in the main database. For each, do - ** an "INSERT INTO vacuum_db.xxx SELECT * FROM main.xxx;" to copy - ** the contents to the temporary database. - */ - rc = execExecSql(db, pzErrMsg, - "SELECT 'INSERT INTO vacuum_db.' || quote(name) " - "|| ' SELECT * FROM main.' || quote(name) || ';'" - "FROM main.sqlite_master " - "WHERE type = 'table' AND name!='sqlite_sequence' " - " AND coalesce(rootpage,1)>0" - ); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - - /* Copy over the sequence table - */ - rc = execExecSql(db, pzErrMsg, - "SELECT 'DELETE FROM vacuum_db.' || quote(name) || ';' " - "FROM vacuum_db.sqlite_master WHERE name='sqlite_sequence' " - ); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - rc = execExecSql(db, pzErrMsg, - "SELECT 'INSERT INTO vacuum_db.' || quote(name) " - "|| ' SELECT * FROM main.' || quote(name) || ';' " - "FROM vacuum_db.sqlite_master WHERE name=='sqlite_sequence';" - ); - if( rc!=SQLITE_OK ) goto end_of_vacuum; - - - /* Copy the triggers, views, and virtual tables from the main database - ** over to the temporary database. None of these objects has any - ** associated storage, so all we have to do is copy their entries - ** from the SQLITE_MASTER table. - */ - rc = execSql(db, pzErrMsg, - "INSERT INTO vacuum_db.sqlite_master " - " SELECT type, name, tbl_name, rootpage, sql" - " FROM main.sqlite_master" - " WHERE type='view' OR type='trigger'" - " OR (type='table' AND rootpage=0)" - ); - if( rc ) goto end_of_vacuum; - - /* At this point, there is a write transaction open on both the - ** vacuum database and the main database. Assuming no error occurs, - ** both transactions are closed by this block - the main database - ** transaction by sqlite3BtreeCopyFile() and the other by an explicit - ** call to sqlite3BtreeCommit(). - */ - { - u32 meta; - int i; - - /* This array determines which meta meta values are preserved in the - ** vacuum. Even entries are the meta value number and odd entries - ** are an increment to apply to the meta value after the vacuum. - ** The increment is used to increase the schema cookie so that other - ** connections to the same database will know to reread the schema. - */ - static const unsigned char aCopy[] = { - BTREE_SCHEMA_VERSION, 1, /* Add one to the old schema cookie */ - BTREE_DEFAULT_CACHE_SIZE, 0, /* Preserve the default page cache size */ - BTREE_TEXT_ENCODING, 0, /* Preserve the text encoding */ - BTREE_USER_VERSION, 0, /* Preserve the user version */ - BTREE_APPLICATION_ID, 0, /* Preserve the application id */ - }; - - assert( 1==sqlite3BtreeIsInTrans(pTemp) ); - assert( 1==sqlite3BtreeIsInTrans(pMain) ); - - /* Copy Btree meta values */ - for(i=0; iflags */ - db->flags = saved_flags; - db->nChange = saved_nChange; - db->nTotalChange = saved_nTotalChange; - db->xTrace = saved_xTrace; - sqlite3BtreeSetPageSize(pMain, -1, -1, 1); - - /* Currently there is an SQL level transaction open on the vacuum - ** database. No locks are held on any other files (since the main file - ** was committed at the btree level). So it safe to end the transaction - ** by manually setting the autoCommit flag to true and detaching the - ** vacuum database. The vacuum_db journal file is deleted when the pager - ** is closed by the DETACH. - */ - db->autoCommit = 1; - - if( pDb ){ - sqlite3BtreeClose(pDb->pBt); - pDb->pBt = 0; - pDb->pSchema = 0; - } - - /* This both clears the schemas and reduces the size of the db->aDb[] - ** array. */ - sqlite3ResetAllSchemasOfConnection(db); - - return rc; -} - -#endif /* SQLITE_OMIT_VACUUM && SQLITE_OMIT_ATTACH */ - -/************** End of vacuum.c **********************************************/ -/************** Begin file vtab.c ********************************************/ -/* -** 2006 June 10 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code used to help implement virtual tables. -*/ -#ifndef SQLITE_OMIT_VIRTUALTABLE - -/* -** Before a virtual table xCreate() or xConnect() method is invoked, the -** sqlite3.pVtabCtx member variable is set to point to an instance of -** this struct allocated on the stack. It is used by the implementation of -** the sqlite3_declare_vtab() and sqlite3_vtab_config() APIs, both of which -** are invoked only from within xCreate and xConnect methods. -*/ -struct VtabCtx { - VTable *pVTable; /* The virtual table being constructed */ - Table *pTab; /* The Table object to which the virtual table belongs */ -}; - -/* -** The actual function that does the work of creating a new module. -** This function implements the sqlite3_create_module() and -** sqlite3_create_module_v2() interfaces. -*/ -static int createModule( - sqlite3 *db, /* Database in which module is registered */ - const char *zName, /* Name assigned to this module */ - const sqlite3_module *pModule, /* The definition of the module */ - void *pAux, /* Context pointer for xCreate/xConnect */ - void (*xDestroy)(void *) /* Module destructor function */ -){ - int rc = SQLITE_OK; - int nName; - - sqlite3_mutex_enter(db->mutex); - nName = sqlite3Strlen30(zName); - if( sqlite3HashFind(&db->aModule, zName, nName) ){ - rc = SQLITE_MISUSE_BKPT; - }else{ - Module *pMod; - pMod = (Module *)sqlite3DbMallocRaw(db, sizeof(Module) + nName + 1); - if( pMod ){ - Module *pDel; - char *zCopy = (char *)(&pMod[1]); - memcpy(zCopy, zName, nName+1); - pMod->zName = zCopy; - pMod->pModule = pModule; - pMod->pAux = pAux; - pMod->xDestroy = xDestroy; - pDel = (Module *)sqlite3HashInsert(&db->aModule,zCopy,nName,(void*)pMod); - assert( pDel==0 || pDel==pMod ); - if( pDel ){ - db->mallocFailed = 1; - sqlite3DbFree(db, pDel); - } - } - } - rc = sqlite3ApiExit(db, rc); - if( rc!=SQLITE_OK && xDestroy ) xDestroy(pAux); - - sqlite3_mutex_leave(db->mutex); - return rc; -} - - -/* -** External API function used to create a new virtual-table module. -*/ -SQLITE_API int sqlite3_create_module( - sqlite3 *db, /* Database in which module is registered */ - const char *zName, /* Name assigned to this module */ - const sqlite3_module *pModule, /* The definition of the module */ - void *pAux /* Context pointer for xCreate/xConnect */ -){ - return createModule(db, zName, pModule, pAux, 0); -} - -/* -** External API function used to create a new virtual-table module. -*/ -SQLITE_API int sqlite3_create_module_v2( - sqlite3 *db, /* Database in which module is registered */ - const char *zName, /* Name assigned to this module */ - const sqlite3_module *pModule, /* The definition of the module */ - void *pAux, /* Context pointer for xCreate/xConnect */ - void (*xDestroy)(void *) /* Module destructor function */ -){ - return createModule(db, zName, pModule, pAux, xDestroy); -} - -/* -** Lock the virtual table so that it cannot be disconnected. -** Locks nest. Every lock should have a corresponding unlock. -** If an unlock is omitted, resources leaks will occur. -** -** If a disconnect is attempted while a virtual table is locked, -** the disconnect is deferred until all locks have been removed. -*/ -SQLITE_PRIVATE void sqlite3VtabLock(VTable *pVTab){ - pVTab->nRef++; -} - - -/* -** pTab is a pointer to a Table structure representing a virtual-table. -** Return a pointer to the VTable object used by connection db to access -** this virtual-table, if one has been created, or NULL otherwise. -*/ -SQLITE_PRIVATE VTable *sqlite3GetVTable(sqlite3 *db, Table *pTab){ - VTable *pVtab; - assert( IsVirtual(pTab) ); - for(pVtab=pTab->pVTable; pVtab && pVtab->db!=db; pVtab=pVtab->pNext); - return pVtab; -} - -/* -** Decrement the ref-count on a virtual table object. When the ref-count -** reaches zero, call the xDisconnect() method to delete the object. -*/ -SQLITE_PRIVATE void sqlite3VtabUnlock(VTable *pVTab){ - sqlite3 *db = pVTab->db; - - assert( db ); - assert( pVTab->nRef>0 ); - assert( db->magic==SQLITE_MAGIC_OPEN || db->magic==SQLITE_MAGIC_ZOMBIE ); - - pVTab->nRef--; - if( pVTab->nRef==0 ){ - sqlite3_vtab *p = pVTab->pVtab; - if( p ){ - p->pModule->xDisconnect(p); - } - sqlite3DbFree(db, pVTab); - } -} - -/* -** Table p is a virtual table. This function moves all elements in the -** p->pVTable list to the sqlite3.pDisconnect lists of their associated -** database connections to be disconnected at the next opportunity. -** Except, if argument db is not NULL, then the entry associated with -** connection db is left in the p->pVTable list. -*/ -static VTable *vtabDisconnectAll(sqlite3 *db, Table *p){ - VTable *pRet = 0; - VTable *pVTable = p->pVTable; - p->pVTable = 0; - - /* Assert that the mutex (if any) associated with the BtShared database - ** that contains table p is held by the caller. See header comments - ** above function sqlite3VtabUnlockList() for an explanation of why - ** this makes it safe to access the sqlite3.pDisconnect list of any - ** database connection that may have an entry in the p->pVTable list. - */ - assert( db==0 || sqlite3SchemaMutexHeld(db, 0, p->pSchema) ); - - while( pVTable ){ - sqlite3 *db2 = pVTable->db; - VTable *pNext = pVTable->pNext; - assert( db2 ); - if( db2==db ){ - pRet = pVTable; - p->pVTable = pRet; - pRet->pNext = 0; - }else{ - pVTable->pNext = db2->pDisconnect; - db2->pDisconnect = pVTable; - } - pVTable = pNext; - } - - assert( !db || pRet ); - return pRet; -} - -/* -** Table *p is a virtual table. This function removes the VTable object -** for table *p associated with database connection db from the linked -** list in p->pVTab. It also decrements the VTable ref count. This is -** used when closing database connection db to free all of its VTable -** objects without disturbing the rest of the Schema object (which may -** be being used by other shared-cache connections). -*/ -SQLITE_PRIVATE void sqlite3VtabDisconnect(sqlite3 *db, Table *p){ - VTable **ppVTab; - - assert( IsVirtual(p) ); - assert( sqlite3BtreeHoldsAllMutexes(db) ); - assert( sqlite3_mutex_held(db->mutex) ); - - for(ppVTab=&p->pVTable; *ppVTab; ppVTab=&(*ppVTab)->pNext){ - if( (*ppVTab)->db==db ){ - VTable *pVTab = *ppVTab; - *ppVTab = pVTab->pNext; - sqlite3VtabUnlock(pVTab); - break; - } - } -} - - -/* -** Disconnect all the virtual table objects in the sqlite3.pDisconnect list. -** -** This function may only be called when the mutexes associated with all -** shared b-tree databases opened using connection db are held by the -** caller. This is done to protect the sqlite3.pDisconnect list. The -** sqlite3.pDisconnect list is accessed only as follows: -** -** 1) By this function. In this case, all BtShared mutexes and the mutex -** associated with the database handle itself must be held. -** -** 2) By function vtabDisconnectAll(), when it adds a VTable entry to -** the sqlite3.pDisconnect list. In this case either the BtShared mutex -** associated with the database the virtual table is stored in is held -** or, if the virtual table is stored in a non-sharable database, then -** the database handle mutex is held. -** -** As a result, a sqlite3.pDisconnect cannot be accessed simultaneously -** by multiple threads. It is thread-safe. -*/ -SQLITE_PRIVATE void sqlite3VtabUnlockList(sqlite3 *db){ - VTable *p = db->pDisconnect; - db->pDisconnect = 0; - - assert( sqlite3BtreeHoldsAllMutexes(db) ); - assert( sqlite3_mutex_held(db->mutex) ); - - if( p ){ - sqlite3ExpirePreparedStatements(db); - do { - VTable *pNext = p->pNext; - sqlite3VtabUnlock(p); - p = pNext; - }while( p ); - } -} - -/* -** Clear any and all virtual-table information from the Table record. -** This routine is called, for example, just before deleting the Table -** record. -** -** Since it is a virtual-table, the Table structure contains a pointer -** to the head of a linked list of VTable structures. Each VTable -** structure is associated with a single sqlite3* user of the schema. -** The reference count of the VTable structure associated with database -** connection db is decremented immediately (which may lead to the -** structure being xDisconnected and free). Any other VTable structures -** in the list are moved to the sqlite3.pDisconnect list of the associated -** database connection. -*/ -SQLITE_PRIVATE void sqlite3VtabClear(sqlite3 *db, Table *p){ - if( !db || db->pnBytesFreed==0 ) vtabDisconnectAll(0, p); - if( p->azModuleArg ){ - int i; - for(i=0; inModuleArg; i++){ - if( i!=1 ) sqlite3DbFree(db, p->azModuleArg[i]); - } - sqlite3DbFree(db, p->azModuleArg); - } -} - -/* -** Add a new module argument to pTable->azModuleArg[]. -** The string is not copied - the pointer is stored. The -** string will be freed automatically when the table is -** deleted. -*/ -static void addModuleArgument(sqlite3 *db, Table *pTable, char *zArg){ - int i = pTable->nModuleArg++; - int nBytes = sizeof(char *)*(1+pTable->nModuleArg); - char **azModuleArg; - azModuleArg = sqlite3DbRealloc(db, pTable->azModuleArg, nBytes); - if( azModuleArg==0 ){ - int j; - for(j=0; jazModuleArg[j]); - } - sqlite3DbFree(db, zArg); - sqlite3DbFree(db, pTable->azModuleArg); - pTable->nModuleArg = 0; - }else{ - azModuleArg[i] = zArg; - azModuleArg[i+1] = 0; - } - pTable->azModuleArg = azModuleArg; -} - -/* -** The parser calls this routine when it first sees a CREATE VIRTUAL TABLE -** statement. The module name has been parsed, but the optional list -** of parameters that follow the module name are still pending. -*/ -SQLITE_PRIVATE void sqlite3VtabBeginParse( - Parse *pParse, /* Parsing context */ - Token *pName1, /* Name of new table, or database name */ - Token *pName2, /* Name of new table or NULL */ - Token *pModuleName, /* Name of the module for the virtual table */ - int ifNotExists /* No error if the table already exists */ -){ - int iDb; /* The database the table is being created in */ - Table *pTable; /* The new virtual table */ - sqlite3 *db; /* Database connection */ - - sqlite3StartTable(pParse, pName1, pName2, 0, 0, 1, ifNotExists); - pTable = pParse->pNewTable; - if( pTable==0 ) return; - assert( 0==pTable->pIndex ); - - db = pParse->db; - iDb = sqlite3SchemaToIndex(db, pTable->pSchema); - assert( iDb>=0 ); - - pTable->tabFlags |= TF_Virtual; - pTable->nModuleArg = 0; - addModuleArgument(db, pTable, sqlite3NameFromToken(db, pModuleName)); - addModuleArgument(db, pTable, 0); - addModuleArgument(db, pTable, sqlite3DbStrDup(db, pTable->zName)); - pParse->sNameToken.n = (int)(&pModuleName->z[pModuleName->n] - pName1->z); - -#ifndef SQLITE_OMIT_AUTHORIZATION - /* Creating a virtual table invokes the authorization callback twice. - ** The first invocation, to obtain permission to INSERT a row into the - ** sqlite_master table, has already been made by sqlite3StartTable(). - ** The second call, to obtain permission to create the table, is made now. - */ - if( pTable->azModuleArg ){ - sqlite3AuthCheck(pParse, SQLITE_CREATE_VTABLE, pTable->zName, - pTable->azModuleArg[0], pParse->db->aDb[iDb].zName); - } -#endif -} - -/* -** This routine takes the module argument that has been accumulating -** in pParse->zArg[] and appends it to the list of arguments on the -** virtual table currently under construction in pParse->pTable. -*/ -static void addArgumentToVtab(Parse *pParse){ - if( pParse->sArg.z && pParse->pNewTable ){ - const char *z = (const char*)pParse->sArg.z; - int n = pParse->sArg.n; - sqlite3 *db = pParse->db; - addModuleArgument(db, pParse->pNewTable, sqlite3DbStrNDup(db, z, n)); - } -} - -/* -** The parser calls this routine after the CREATE VIRTUAL TABLE statement -** has been completely parsed. -*/ -SQLITE_PRIVATE void sqlite3VtabFinishParse(Parse *pParse, Token *pEnd){ - Table *pTab = pParse->pNewTable; /* The table being constructed */ - sqlite3 *db = pParse->db; /* The database connection */ - - if( pTab==0 ) return; - addArgumentToVtab(pParse); - pParse->sArg.z = 0; - if( pTab->nModuleArg<1 ) return; - - /* If the CREATE VIRTUAL TABLE statement is being entered for the - ** first time (in other words if the virtual table is actually being - ** created now instead of just being read out of sqlite_master) then - ** do additional initialization work and store the statement text - ** in the sqlite_master table. - */ - if( !db->init.busy ){ - char *zStmt; - char *zWhere; - int iDb; - Vdbe *v; - - /* Compute the complete text of the CREATE VIRTUAL TABLE statement */ - if( pEnd ){ - pParse->sNameToken.n = (int)(pEnd->z - pParse->sNameToken.z) + pEnd->n; - } - zStmt = sqlite3MPrintf(db, "CREATE VIRTUAL TABLE %T", &pParse->sNameToken); - - /* A slot for the record has already been allocated in the - ** SQLITE_MASTER table. We just need to update that slot with all - ** the information we've collected. - ** - ** The VM register number pParse->regRowid holds the rowid of an - ** entry in the sqlite_master table tht was created for this vtab - ** by sqlite3StartTable(). - */ - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - sqlite3NestedParse(pParse, - "UPDATE %Q.%s " - "SET type='table', name=%Q, tbl_name=%Q, rootpage=0, sql=%Q " - "WHERE rowid=#%d", - db->aDb[iDb].zName, SCHEMA_TABLE(iDb), - pTab->zName, - pTab->zName, - zStmt, - pParse->regRowid - ); - sqlite3DbFree(db, zStmt); - v = sqlite3GetVdbe(pParse); - sqlite3ChangeCookie(pParse, iDb); - - sqlite3VdbeAddOp2(v, OP_Expire, 0, 0); - zWhere = sqlite3MPrintf(db, "name='%q' AND type='table'", pTab->zName); - sqlite3VdbeAddParseSchemaOp(v, iDb, zWhere); - sqlite3VdbeAddOp4(v, OP_VCreate, iDb, 0, 0, - pTab->zName, sqlite3Strlen30(pTab->zName) + 1); - } - - /* If we are rereading the sqlite_master table create the in-memory - ** record of the table. The xConnect() method is not called until - ** the first time the virtual table is used in an SQL statement. This - ** allows a schema that contains virtual tables to be loaded before - ** the required virtual table implementations are registered. */ - else { - Table *pOld; - Schema *pSchema = pTab->pSchema; - const char *zName = pTab->zName; - int nName = sqlite3Strlen30(zName); - assert( sqlite3SchemaMutexHeld(db, 0, pSchema) ); - pOld = sqlite3HashInsert(&pSchema->tblHash, zName, nName, pTab); - if( pOld ){ - db->mallocFailed = 1; - assert( pTab==pOld ); /* Malloc must have failed inside HashInsert() */ - return; - } - pParse->pNewTable = 0; - } -} - -/* -** The parser calls this routine when it sees the first token -** of an argument to the module name in a CREATE VIRTUAL TABLE statement. -*/ -SQLITE_PRIVATE void sqlite3VtabArgInit(Parse *pParse){ - addArgumentToVtab(pParse); - pParse->sArg.z = 0; - pParse->sArg.n = 0; -} - -/* -** The parser calls this routine for each token after the first token -** in an argument to the module name in a CREATE VIRTUAL TABLE statement. -*/ -SQLITE_PRIVATE void sqlite3VtabArgExtend(Parse *pParse, Token *p){ - Token *pArg = &pParse->sArg; - if( pArg->z==0 ){ - pArg->z = p->z; - pArg->n = p->n; - }else{ - assert(pArg->z < p->z); - pArg->n = (int)(&p->z[p->n] - pArg->z); - } -} - -/* -** Invoke a virtual table constructor (either xCreate or xConnect). The -** pointer to the function to invoke is passed as the fourth parameter -** to this procedure. -*/ -static int vtabCallConstructor( - sqlite3 *db, - Table *pTab, - Module *pMod, - int (*xConstruct)(sqlite3*,void*,int,const char*const*,sqlite3_vtab**,char**), - char **pzErr -){ - VtabCtx sCtx, *pPriorCtx; - VTable *pVTable; - int rc; - const char *const*azArg = (const char *const*)pTab->azModuleArg; - int nArg = pTab->nModuleArg; - char *zErr = 0; - char *zModuleName = sqlite3MPrintf(db, "%s", pTab->zName); - int iDb; - - if( !zModuleName ){ - return SQLITE_NOMEM; - } - - pVTable = sqlite3DbMallocZero(db, sizeof(VTable)); - if( !pVTable ){ - sqlite3DbFree(db, zModuleName); - return SQLITE_NOMEM; - } - pVTable->db = db; - pVTable->pMod = pMod; - - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - pTab->azModuleArg[1] = db->aDb[iDb].zName; - - /* Invoke the virtual table constructor */ - assert( &db->pVtabCtx ); - assert( xConstruct ); - sCtx.pTab = pTab; - sCtx.pVTable = pVTable; - pPriorCtx = db->pVtabCtx; - db->pVtabCtx = &sCtx; - rc = xConstruct(db, pMod->pAux, nArg, azArg, &pVTable->pVtab, &zErr); - db->pVtabCtx = pPriorCtx; - if( rc==SQLITE_NOMEM ) db->mallocFailed = 1; - - if( SQLITE_OK!=rc ){ - if( zErr==0 ){ - *pzErr = sqlite3MPrintf(db, "vtable constructor failed: %s", zModuleName); - }else { - *pzErr = sqlite3MPrintf(db, "%s", zErr); - sqlite3_free(zErr); - } - sqlite3DbFree(db, pVTable); - }else if( ALWAYS(pVTable->pVtab) ){ - /* Justification of ALWAYS(): A correct vtab constructor must allocate - ** the sqlite3_vtab object if successful. */ - pVTable->pVtab->pModule = pMod->pModule; - pVTable->nRef = 1; - if( sCtx.pTab ){ - const char *zFormat = "vtable constructor did not declare schema: %s"; - *pzErr = sqlite3MPrintf(db, zFormat, pTab->zName); - sqlite3VtabUnlock(pVTable); - rc = SQLITE_ERROR; - }else{ - int iCol; - /* If everything went according to plan, link the new VTable structure - ** into the linked list headed by pTab->pVTable. Then loop through the - ** columns of the table to see if any of them contain the token "hidden". - ** If so, set the Column COLFLAG_HIDDEN flag and remove the token from - ** the type string. */ - pVTable->pNext = pTab->pVTable; - pTab->pVTable = pVTable; - - for(iCol=0; iColnCol; iCol++){ - char *zType = pTab->aCol[iCol].zType; - int nType; - int i = 0; - if( !zType ) continue; - nType = sqlite3Strlen30(zType); - if( sqlite3StrNICmp("hidden", zType, 6)||(zType[6] && zType[6]!=' ') ){ - for(i=0; i0 ){ - assert(zType[i-1]==' '); - zType[i-1] = '\0'; - } - pTab->aCol[iCol].colFlags |= COLFLAG_HIDDEN; - } - } - } - } - - sqlite3DbFree(db, zModuleName); - return rc; -} - -/* -** This function is invoked by the parser to call the xConnect() method -** of the virtual table pTab. If an error occurs, an error code is returned -** and an error left in pParse. -** -** This call is a no-op if table pTab is not a virtual table. -*/ -SQLITE_PRIVATE int sqlite3VtabCallConnect(Parse *pParse, Table *pTab){ - sqlite3 *db = pParse->db; - const char *zMod; - Module *pMod; - int rc; - - assert( pTab ); - if( (pTab->tabFlags & TF_Virtual)==0 || sqlite3GetVTable(db, pTab) ){ - return SQLITE_OK; - } - - /* Locate the required virtual table module */ - zMod = pTab->azModuleArg[0]; - pMod = (Module*)sqlite3HashFind(&db->aModule, zMod, sqlite3Strlen30(zMod)); - - if( !pMod ){ - const char *zModule = pTab->azModuleArg[0]; - sqlite3ErrorMsg(pParse, "no such module: %s", zModule); - rc = SQLITE_ERROR; - }else{ - char *zErr = 0; - rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xConnect, &zErr); - if( rc!=SQLITE_OK ){ - sqlite3ErrorMsg(pParse, "%s", zErr); - } - sqlite3DbFree(db, zErr); - } - - return rc; -} -/* -** Grow the db->aVTrans[] array so that there is room for at least one -** more v-table. Return SQLITE_NOMEM if a malloc fails, or SQLITE_OK otherwise. -*/ -static int growVTrans(sqlite3 *db){ - const int ARRAY_INCR = 5; - - /* Grow the sqlite3.aVTrans array if required */ - if( (db->nVTrans%ARRAY_INCR)==0 ){ - VTable **aVTrans; - int nBytes = sizeof(sqlite3_vtab *) * (db->nVTrans + ARRAY_INCR); - aVTrans = sqlite3DbRealloc(db, (void *)db->aVTrans, nBytes); - if( !aVTrans ){ - return SQLITE_NOMEM; - } - memset(&aVTrans[db->nVTrans], 0, sizeof(sqlite3_vtab *)*ARRAY_INCR); - db->aVTrans = aVTrans; - } - - return SQLITE_OK; -} - -/* -** Add the virtual table pVTab to the array sqlite3.aVTrans[]. Space should -** have already been reserved using growVTrans(). -*/ -static void addToVTrans(sqlite3 *db, VTable *pVTab){ - /* Add pVtab to the end of sqlite3.aVTrans */ - db->aVTrans[db->nVTrans++] = pVTab; - sqlite3VtabLock(pVTab); -} - -/* -** This function is invoked by the vdbe to call the xCreate method -** of the virtual table named zTab in database iDb. -** -** If an error occurs, *pzErr is set to point an an English language -** description of the error and an SQLITE_XXX error code is returned. -** In this case the caller must call sqlite3DbFree(db, ) on *pzErr. -*/ -SQLITE_PRIVATE int sqlite3VtabCallCreate(sqlite3 *db, int iDb, const char *zTab, char **pzErr){ - int rc = SQLITE_OK; - Table *pTab; - Module *pMod; - const char *zMod; - - pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName); - assert( pTab && (pTab->tabFlags & TF_Virtual)!=0 && !pTab->pVTable ); - - /* Locate the required virtual table module */ - zMod = pTab->azModuleArg[0]; - pMod = (Module*)sqlite3HashFind(&db->aModule, zMod, sqlite3Strlen30(zMod)); - - /* If the module has been registered and includes a Create method, - ** invoke it now. If the module has not been registered, return an - ** error. Otherwise, do nothing. - */ - if( !pMod ){ - *pzErr = sqlite3MPrintf(db, "no such module: %s", zMod); - rc = SQLITE_ERROR; - }else{ - rc = vtabCallConstructor(db, pTab, pMod, pMod->pModule->xCreate, pzErr); - } - - /* Justification of ALWAYS(): The xConstructor method is required to - ** create a valid sqlite3_vtab if it returns SQLITE_OK. */ - if( rc==SQLITE_OK && ALWAYS(sqlite3GetVTable(db, pTab)) ){ - rc = growVTrans(db); - if( rc==SQLITE_OK ){ - addToVTrans(db, sqlite3GetVTable(db, pTab)); - } - } - - return rc; -} - -/* -** This function is used to set the schema of a virtual table. It is only -** valid to call this function from within the xCreate() or xConnect() of a -** virtual table module. -*/ -SQLITE_API int sqlite3_declare_vtab(sqlite3 *db, const char *zCreateTable){ - Parse *pParse; - - int rc = SQLITE_OK; - Table *pTab; - char *zErr = 0; - - sqlite3_mutex_enter(db->mutex); - if( !db->pVtabCtx || !(pTab = db->pVtabCtx->pTab) ){ - sqlite3Error(db, SQLITE_MISUSE, 0); - sqlite3_mutex_leave(db->mutex); - return SQLITE_MISUSE_BKPT; - } - assert( (pTab->tabFlags & TF_Virtual)!=0 ); - - pParse = sqlite3StackAllocZero(db, sizeof(*pParse)); - if( pParse==0 ){ - rc = SQLITE_NOMEM; - }else{ - pParse->declareVtab = 1; - pParse->db = db; - pParse->nQueryLoop = 1; - - if( SQLITE_OK==sqlite3RunParser(pParse, zCreateTable, &zErr) - && pParse->pNewTable - && !db->mallocFailed - && !pParse->pNewTable->pSelect - && (pParse->pNewTable->tabFlags & TF_Virtual)==0 - ){ - if( !pTab->aCol ){ - pTab->aCol = pParse->pNewTable->aCol; - pTab->nCol = pParse->pNewTable->nCol; - pParse->pNewTable->nCol = 0; - pParse->pNewTable->aCol = 0; - } - db->pVtabCtx->pTab = 0; - }else{ - sqlite3Error(db, SQLITE_ERROR, (zErr ? "%s" : 0), zErr); - sqlite3DbFree(db, zErr); - rc = SQLITE_ERROR; - } - pParse->declareVtab = 0; - - if( pParse->pVdbe ){ - sqlite3VdbeFinalize(pParse->pVdbe); - } - sqlite3DeleteTable(db, pParse->pNewTable); - sqlite3ParserReset(pParse); - sqlite3StackFree(db, pParse); - } - - assert( (rc&0xff)==rc ); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/* -** This function is invoked by the vdbe to call the xDestroy method -** of the virtual table named zTab in database iDb. This occurs -** when a DROP TABLE is mentioned. -** -** This call is a no-op if zTab is not a virtual table. -*/ -SQLITE_PRIVATE int sqlite3VtabCallDestroy(sqlite3 *db, int iDb, const char *zTab){ - int rc = SQLITE_OK; - Table *pTab; - - pTab = sqlite3FindTable(db, zTab, db->aDb[iDb].zName); - if( ALWAYS(pTab!=0 && pTab->pVTable!=0) ){ - VTable *p = vtabDisconnectAll(db, pTab); - - assert( rc==SQLITE_OK ); - rc = p->pMod->pModule->xDestroy(p->pVtab); - - /* Remove the sqlite3_vtab* from the aVTrans[] array, if applicable */ - if( rc==SQLITE_OK ){ - assert( pTab->pVTable==p && p->pNext==0 ); - p->pVtab = 0; - pTab->pVTable = 0; - sqlite3VtabUnlock(p); - } - } - - return rc; -} - -/* -** This function invokes either the xRollback or xCommit method -** of each of the virtual tables in the sqlite3.aVTrans array. The method -** called is identified by the second argument, "offset", which is -** the offset of the method to call in the sqlite3_module structure. -** -** The array is cleared after invoking the callbacks. -*/ -static void callFinaliser(sqlite3 *db, int offset){ - int i; - if( db->aVTrans ){ - for(i=0; inVTrans; i++){ - VTable *pVTab = db->aVTrans[i]; - sqlite3_vtab *p = pVTab->pVtab; - if( p ){ - int (*x)(sqlite3_vtab *); - x = *(int (**)(sqlite3_vtab *))((char *)p->pModule + offset); - if( x ) x(p); - } - pVTab->iSavepoint = 0; - sqlite3VtabUnlock(pVTab); - } - sqlite3DbFree(db, db->aVTrans); - db->nVTrans = 0; - db->aVTrans = 0; - } -} - -/* -** Invoke the xSync method of all virtual tables in the sqlite3.aVTrans -** array. Return the error code for the first error that occurs, or -** SQLITE_OK if all xSync operations are successful. -** -** If an error message is available, leave it in p->zErrMsg. -*/ -SQLITE_PRIVATE int sqlite3VtabSync(sqlite3 *db, Vdbe *p){ - int i; - int rc = SQLITE_OK; - VTable **aVTrans = db->aVTrans; - - db->aVTrans = 0; - for(i=0; rc==SQLITE_OK && inVTrans; i++){ - int (*x)(sqlite3_vtab *); - sqlite3_vtab *pVtab = aVTrans[i]->pVtab; - if( pVtab && (x = pVtab->pModule->xSync)!=0 ){ - rc = x(pVtab); - sqlite3VtabImportErrmsg(p, pVtab); - } - } - db->aVTrans = aVTrans; - return rc; -} - -/* -** Invoke the xRollback method of all virtual tables in the -** sqlite3.aVTrans array. Then clear the array itself. -*/ -SQLITE_PRIVATE int sqlite3VtabRollback(sqlite3 *db){ - callFinaliser(db, offsetof(sqlite3_module,xRollback)); - return SQLITE_OK; -} - -/* -** Invoke the xCommit method of all virtual tables in the -** sqlite3.aVTrans array. Then clear the array itself. -*/ -SQLITE_PRIVATE int sqlite3VtabCommit(sqlite3 *db){ - callFinaliser(db, offsetof(sqlite3_module,xCommit)); - return SQLITE_OK; -} - -/* -** If the virtual table pVtab supports the transaction interface -** (xBegin/xRollback/xCommit and optionally xSync) and a transaction is -** not currently open, invoke the xBegin method now. -** -** If the xBegin call is successful, place the sqlite3_vtab pointer -** in the sqlite3.aVTrans array. -*/ -SQLITE_PRIVATE int sqlite3VtabBegin(sqlite3 *db, VTable *pVTab){ - int rc = SQLITE_OK; - const sqlite3_module *pModule; - - /* Special case: If db->aVTrans is NULL and db->nVTrans is greater - ** than zero, then this function is being called from within a - ** virtual module xSync() callback. It is illegal to write to - ** virtual module tables in this case, so return SQLITE_LOCKED. - */ - if( sqlite3VtabInSync(db) ){ - return SQLITE_LOCKED; - } - if( !pVTab ){ - return SQLITE_OK; - } - pModule = pVTab->pVtab->pModule; - - if( pModule->xBegin ){ - int i; - - /* If pVtab is already in the aVTrans array, return early */ - for(i=0; inVTrans; i++){ - if( db->aVTrans[i]==pVTab ){ - return SQLITE_OK; - } - } - - /* Invoke the xBegin method. If successful, add the vtab to the - ** sqlite3.aVTrans[] array. */ - rc = growVTrans(db); - if( rc==SQLITE_OK ){ - rc = pModule->xBegin(pVTab->pVtab); - if( rc==SQLITE_OK ){ - addToVTrans(db, pVTab); - } - } - } - return rc; -} - -/* -** Invoke either the xSavepoint, xRollbackTo or xRelease method of all -** virtual tables that currently have an open transaction. Pass iSavepoint -** as the second argument to the virtual table method invoked. -** -** If op is SAVEPOINT_BEGIN, the xSavepoint method is invoked. If it is -** SAVEPOINT_ROLLBACK, the xRollbackTo method. Otherwise, if op is -** SAVEPOINT_RELEASE, then the xRelease method of each virtual table with -** an open transaction is invoked. -** -** If any virtual table method returns an error code other than SQLITE_OK, -** processing is abandoned and the error returned to the caller of this -** function immediately. If all calls to virtual table methods are successful, -** SQLITE_OK is returned. -*/ -SQLITE_PRIVATE int sqlite3VtabSavepoint(sqlite3 *db, int op, int iSavepoint){ - int rc = SQLITE_OK; - - assert( op==SAVEPOINT_RELEASE||op==SAVEPOINT_ROLLBACK||op==SAVEPOINT_BEGIN ); - assert( iSavepoint>=0 ); - if( db->aVTrans ){ - int i; - for(i=0; rc==SQLITE_OK && inVTrans; i++){ - VTable *pVTab = db->aVTrans[i]; - const sqlite3_module *pMod = pVTab->pMod->pModule; - if( pVTab->pVtab && pMod->iVersion>=2 ){ - int (*xMethod)(sqlite3_vtab *, int); - switch( op ){ - case SAVEPOINT_BEGIN: - xMethod = pMod->xSavepoint; - pVTab->iSavepoint = iSavepoint+1; - break; - case SAVEPOINT_ROLLBACK: - xMethod = pMod->xRollbackTo; - break; - default: - xMethod = pMod->xRelease; - break; - } - if( xMethod && pVTab->iSavepoint>iSavepoint ){ - rc = xMethod(pVTab->pVtab, iSavepoint); - } - } - } - } - return rc; -} - -/* -** The first parameter (pDef) is a function implementation. The -** second parameter (pExpr) is the first argument to this function. -** If pExpr is a column in a virtual table, then let the virtual -** table implementation have an opportunity to overload the function. -** -** This routine is used to allow virtual table implementations to -** overload MATCH, LIKE, GLOB, and REGEXP operators. -** -** Return either the pDef argument (indicating no change) or a -** new FuncDef structure that is marked as ephemeral using the -** SQLITE_FUNC_EPHEM flag. -*/ -SQLITE_PRIVATE FuncDef *sqlite3VtabOverloadFunction( - sqlite3 *db, /* Database connection for reporting malloc problems */ - FuncDef *pDef, /* Function to possibly overload */ - int nArg, /* Number of arguments to the function */ - Expr *pExpr /* First argument to the function */ -){ - Table *pTab; - sqlite3_vtab *pVtab; - sqlite3_module *pMod; - void (*xFunc)(sqlite3_context*,int,sqlite3_value**) = 0; - void *pArg = 0; - FuncDef *pNew; - int rc = 0; - char *zLowerName; - unsigned char *z; - - - /* Check to see the left operand is a column in a virtual table */ - if( NEVER(pExpr==0) ) return pDef; - if( pExpr->op!=TK_COLUMN ) return pDef; - pTab = pExpr->pTab; - if( NEVER(pTab==0) ) return pDef; - if( (pTab->tabFlags & TF_Virtual)==0 ) return pDef; - pVtab = sqlite3GetVTable(db, pTab)->pVtab; - assert( pVtab!=0 ); - assert( pVtab->pModule!=0 ); - pMod = (sqlite3_module *)pVtab->pModule; - if( pMod->xFindFunction==0 ) return pDef; - - /* Call the xFindFunction method on the virtual table implementation - ** to see if the implementation wants to overload this function - */ - zLowerName = sqlite3DbStrDup(db, pDef->zName); - if( zLowerName ){ - for(z=(unsigned char*)zLowerName; *z; z++){ - *z = sqlite3UpperToLower[*z]; - } - rc = pMod->xFindFunction(pVtab, nArg, zLowerName, &xFunc, &pArg); - sqlite3DbFree(db, zLowerName); - } - if( rc==0 ){ - return pDef; - } - - /* Create a new ephemeral function definition for the overloaded - ** function */ - pNew = sqlite3DbMallocZero(db, sizeof(*pNew) - + sqlite3Strlen30(pDef->zName) + 1); - if( pNew==0 ){ - return pDef; - } - *pNew = *pDef; - pNew->zName = (char *)&pNew[1]; - memcpy(pNew->zName, pDef->zName, sqlite3Strlen30(pDef->zName)+1); - pNew->xFunc = xFunc; - pNew->pUserData = pArg; - pNew->funcFlags |= SQLITE_FUNC_EPHEM; - return pNew; -} - -/* -** Make sure virtual table pTab is contained in the pParse->apVirtualLock[] -** array so that an OP_VBegin will get generated for it. Add pTab to the -** array if it is missing. If pTab is already in the array, this routine -** is a no-op. -*/ -SQLITE_PRIVATE void sqlite3VtabMakeWritable(Parse *pParse, Table *pTab){ - Parse *pToplevel = sqlite3ParseToplevel(pParse); - int i, n; - Table **apVtabLock; - - assert( IsVirtual(pTab) ); - for(i=0; inVtabLock; i++){ - if( pTab==pToplevel->apVtabLock[i] ) return; - } - n = (pToplevel->nVtabLock+1)*sizeof(pToplevel->apVtabLock[0]); - apVtabLock = sqlite3_realloc(pToplevel->apVtabLock, n); - if( apVtabLock ){ - pToplevel->apVtabLock = apVtabLock; - pToplevel->apVtabLock[pToplevel->nVtabLock++] = pTab; - }else{ - pToplevel->db->mallocFailed = 1; - } -} - -/* -** Return the ON CONFLICT resolution mode in effect for the virtual -** table update operation currently in progress. -** -** The results of this routine are undefined unless it is called from -** within an xUpdate method. -*/ -SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *db){ - static const unsigned char aMap[] = { - SQLITE_ROLLBACK, SQLITE_ABORT, SQLITE_FAIL, SQLITE_IGNORE, SQLITE_REPLACE - }; - assert( OE_Rollback==1 && OE_Abort==2 && OE_Fail==3 ); - assert( OE_Ignore==4 && OE_Replace==5 ); - assert( db->vtabOnConflict>=1 && db->vtabOnConflict<=5 ); - return (int)aMap[db->vtabOnConflict-1]; -} - -/* -** Call from within the xCreate() or xConnect() methods to provide -** the SQLite core with additional information about the behavior -** of the virtual table being implemented. -*/ -SQLITE_API int sqlite3_vtab_config(sqlite3 *db, int op, ...){ - va_list ap; - int rc = SQLITE_OK; - - sqlite3_mutex_enter(db->mutex); - - va_start(ap, op); - switch( op ){ - case SQLITE_VTAB_CONSTRAINT_SUPPORT: { - VtabCtx *p = db->pVtabCtx; - if( !p ){ - rc = SQLITE_MISUSE_BKPT; - }else{ - assert( p->pTab==0 || (p->pTab->tabFlags & TF_Virtual)!=0 ); - p->pVTable->bConstraint = (u8)va_arg(ap, int); - } - break; - } - default: - rc = SQLITE_MISUSE_BKPT; - break; - } - va_end(ap); - - if( rc!=SQLITE_OK ) sqlite3Error(db, rc, 0); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/************** End of vtab.c ************************************************/ -/************** Begin file where.c *******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This module contains C code that generates VDBE code used to process -** the WHERE clause of SQL statements. This module is responsible for -** generating the code that loops through a table looking for applicable -** rows. Indices are selected and used to speed the search when doing -** so is applicable. Because this module is responsible for selecting -** indices, you might also think of this module as the "query optimizer". -*/ -/************** Include whereInt.h in the middle of where.c ******************/ -/************** Begin file whereInt.h ****************************************/ -/* -** 2013-11-12 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains structure and macro definitions for the query -** planner logic in "where.c". These definitions are broken out into -** a separate source file for easier editing. -*/ - -/* -** Trace output macros -*/ -#if defined(SQLITE_TEST) || defined(SQLITE_DEBUG) -/***/ int sqlite3WhereTrace = 0; -#endif -#if defined(SQLITE_DEBUG) \ - && (defined(SQLITE_TEST) || defined(SQLITE_ENABLE_WHERETRACE)) -# define WHERETRACE(K,X) if(sqlite3WhereTrace&(K)) sqlite3DebugPrintf X -# define WHERETRACE_ENABLED 1 -#else -# define WHERETRACE(K,X) -#endif - -/* Forward references -*/ -typedef struct WhereClause WhereClause; -typedef struct WhereMaskSet WhereMaskSet; -typedef struct WhereOrInfo WhereOrInfo; -typedef struct WhereAndInfo WhereAndInfo; -typedef struct WhereLevel WhereLevel; -typedef struct WhereLoop WhereLoop; -typedef struct WherePath WherePath; -typedef struct WhereTerm WhereTerm; -typedef struct WhereLoopBuilder WhereLoopBuilder; -typedef struct WhereScan WhereScan; -typedef struct WhereOrCost WhereOrCost; -typedef struct WhereOrSet WhereOrSet; - -/* -** This object contains information needed to implement a single nested -** loop in WHERE clause. -** -** Contrast this object with WhereLoop. This object describes the -** implementation of the loop. WhereLoop describes the algorithm. -** This object contains a pointer to the WhereLoop algorithm as one of -** its elements. -** -** The WhereInfo object contains a single instance of this object for -** each term in the FROM clause (which is to say, for each of the -** nested loops as implemented). The order of WhereLevel objects determines -** the loop nested order, with WhereInfo.a[0] being the outer loop and -** WhereInfo.a[WhereInfo.nLevel-1] being the inner loop. -*/ -struct WhereLevel { - int iLeftJoin; /* Memory cell used to implement LEFT OUTER JOIN */ - int iTabCur; /* The VDBE cursor used to access the table */ - int iIdxCur; /* The VDBE cursor used to access pIdx */ - int addrBrk; /* Jump here to break out of the loop */ - int addrNxt; /* Jump here to start the next IN combination */ - int addrSkip; /* Jump here for next iteration of skip-scan */ - int addrCont; /* Jump here to continue with the next loop cycle */ - int addrFirst; /* First instruction of interior of the loop */ - int addrBody; /* Beginning of the body of this loop */ - u8 iFrom; /* Which entry in the FROM clause */ - u8 op, p5; /* Opcode and P5 of the opcode that ends the loop */ - int p1, p2; /* Operands of the opcode used to ends the loop */ - union { /* Information that depends on pWLoop->wsFlags */ - struct { - int nIn; /* Number of entries in aInLoop[] */ - struct InLoop { - int iCur; /* The VDBE cursor used by this IN operator */ - int addrInTop; /* Top of the IN loop */ - u8 eEndLoopOp; /* IN Loop terminator. OP_Next or OP_Prev */ - } *aInLoop; /* Information about each nested IN operator */ - } in; /* Used when pWLoop->wsFlags&WHERE_IN_ABLE */ - Index *pCovidx; /* Possible covering index for WHERE_MULTI_OR */ - } u; - struct WhereLoop *pWLoop; /* The selected WhereLoop object */ - Bitmask notReady; /* FROM entries not usable at this level */ -}; - -/* -** Each instance of this object represents an algorithm for evaluating one -** term of a join. Every term of the FROM clause will have at least -** one corresponding WhereLoop object (unless INDEXED BY constraints -** prevent a query solution - which is an error) and many terms of the -** FROM clause will have multiple WhereLoop objects, each describing a -** potential way of implementing that FROM-clause term, together with -** dependencies and cost estimates for using the chosen algorithm. -** -** Query planning consists of building up a collection of these WhereLoop -** objects, then computing a particular sequence of WhereLoop objects, with -** one WhereLoop object per FROM clause term, that satisfy all dependencies -** and that minimize the overall cost. -*/ -struct WhereLoop { - Bitmask prereq; /* Bitmask of other loops that must run first */ - Bitmask maskSelf; /* Bitmask identifying table iTab */ -#ifdef SQLITE_DEBUG - char cId; /* Symbolic ID of this loop for debugging use */ -#endif - u8 iTab; /* Position in FROM clause of table for this loop */ - u8 iSortIdx; /* Sorting index number. 0==None */ - LogEst rSetup; /* One-time setup cost (ex: create transient index) */ - LogEst rRun; /* Cost of running each loop */ - LogEst nOut; /* Estimated number of output rows */ - union { - struct { /* Information for internal btree tables */ - u16 nEq; /* Number of equality constraints */ - u16 nSkip; /* Number of initial index columns to skip */ - Index *pIndex; /* Index used, or NULL */ - } btree; - struct { /* Information for virtual tables */ - int idxNum; /* Index number */ - u8 needFree; /* True if sqlite3_free(idxStr) is needed */ - u8 isOrdered; /* True if satisfies ORDER BY */ - u16 omitMask; /* Terms that may be omitted */ - char *idxStr; /* Index identifier string */ - } vtab; - } u; - u32 wsFlags; /* WHERE_* flags describing the plan */ - u16 nLTerm; /* Number of entries in aLTerm[] */ - /**** whereLoopXfer() copies fields above ***********************/ -# define WHERE_LOOP_XFER_SZ offsetof(WhereLoop,nLSlot) - u16 nLSlot; /* Number of slots allocated for aLTerm[] */ - WhereTerm **aLTerm; /* WhereTerms used */ - WhereLoop *pNextLoop; /* Next WhereLoop object in the WhereClause */ - WhereTerm *aLTermSpace[4]; /* Initial aLTerm[] space */ -}; - -/* This object holds the prerequisites and the cost of running a -** subquery on one operand of an OR operator in the WHERE clause. -** See WhereOrSet for additional information -*/ -struct WhereOrCost { - Bitmask prereq; /* Prerequisites */ - LogEst rRun; /* Cost of running this subquery */ - LogEst nOut; /* Number of outputs for this subquery */ -}; - -/* The WhereOrSet object holds a set of possible WhereOrCosts that -** correspond to the subquery(s) of OR-clause processing. Only the -** best N_OR_COST elements are retained. -*/ -#define N_OR_COST 3 -struct WhereOrSet { - u16 n; /* Number of valid a[] entries */ - WhereOrCost a[N_OR_COST]; /* Set of best costs */ -}; - - -/* Forward declaration of methods */ -static int whereLoopResize(sqlite3*, WhereLoop*, int); - -/* -** Each instance of this object holds a sequence of WhereLoop objects -** that implement some or all of a query plan. -** -** Think of each WhereLoop object as a node in a graph with arcs -** showing dependencies and costs for travelling between nodes. (That is -** not a completely accurate description because WhereLoop costs are a -** vector, not a scalar, and because dependencies are many-to-one, not -** one-to-one as are graph nodes. But it is a useful visualization aid.) -** Then a WherePath object is a path through the graph that visits some -** or all of the WhereLoop objects once. -** -** The "solver" works by creating the N best WherePath objects of length -** 1. Then using those as a basis to compute the N best WherePath objects -** of length 2. And so forth until the length of WherePaths equals the -** number of nodes in the FROM clause. The best (lowest cost) WherePath -** at the end is the choosen query plan. -*/ -struct WherePath { - Bitmask maskLoop; /* Bitmask of all WhereLoop objects in this path */ - Bitmask revLoop; /* aLoop[]s that should be reversed for ORDER BY */ - LogEst nRow; /* Estimated number of rows generated by this path */ - LogEst rCost; /* Total cost of this path */ - u8 isOrdered; /* True if this path satisfies ORDER BY */ - u8 isOrderedValid; /* True if the isOrdered field is valid */ - WhereLoop **aLoop; /* Array of WhereLoop objects implementing this path */ -}; - -/* -** The query generator uses an array of instances of this structure to -** help it analyze the subexpressions of the WHERE clause. Each WHERE -** clause subexpression is separated from the others by AND operators, -** usually, or sometimes subexpressions separated by OR. -** -** All WhereTerms are collected into a single WhereClause structure. -** The following identity holds: -** -** WhereTerm.pWC->a[WhereTerm.idx] == WhereTerm -** -** When a term is of the form: -** -** X -** -** where X is a column name and is one of certain operators, -** then WhereTerm.leftCursor and WhereTerm.u.leftColumn record the -** cursor number and column number for X. WhereTerm.eOperator records -** the using a bitmask encoding defined by WO_xxx below. The -** use of a bitmask encoding for the operator allows us to search -** quickly for terms that match any of several different operators. -** -** A WhereTerm might also be two or more subterms connected by OR: -** -** (t1.X ) OR (t1.Y ) OR .... -** -** In this second case, wtFlag has the TERM_ORINFO bit set and eOperator==WO_OR -** and the WhereTerm.u.pOrInfo field points to auxiliary information that -** is collected about the OR clause. -** -** If a term in the WHERE clause does not match either of the two previous -** categories, then eOperator==0. The WhereTerm.pExpr field is still set -** to the original subexpression content and wtFlags is set up appropriately -** but no other fields in the WhereTerm object are meaningful. -** -** When eOperator!=0, prereqRight and prereqAll record sets of cursor numbers, -** but they do so indirectly. A single WhereMaskSet structure translates -** cursor number into bits and the translated bit is stored in the prereq -** fields. The translation is used in order to maximize the number of -** bits that will fit in a Bitmask. The VDBE cursor numbers might be -** spread out over the non-negative integers. For example, the cursor -** numbers might be 3, 8, 9, 10, 20, 23, 41, and 45. The WhereMaskSet -** translates these sparse cursor numbers into consecutive integers -** beginning with 0 in order to make the best possible use of the available -** bits in the Bitmask. So, in the example above, the cursor numbers -** would be mapped into integers 0 through 7. -** -** The number of terms in a join is limited by the number of bits -** in prereqRight and prereqAll. The default is 64 bits, hence SQLite -** is only able to process joins with 64 or fewer tables. -*/ -struct WhereTerm { - Expr *pExpr; /* Pointer to the subexpression that is this term */ - int iParent; /* Disable pWC->a[iParent] when this term disabled */ - int leftCursor; /* Cursor number of X in "X " */ - union { - int leftColumn; /* Column number of X in "X " */ - WhereOrInfo *pOrInfo; /* Extra information if (eOperator & WO_OR)!=0 */ - WhereAndInfo *pAndInfo; /* Extra information if (eOperator& WO_AND)!=0 */ - } u; - LogEst truthProb; /* Probability of truth for this expression */ - u16 eOperator; /* A WO_xx value describing */ - u8 wtFlags; /* TERM_xxx bit flags. See below */ - u8 nChild; /* Number of children that must disable us */ - WhereClause *pWC; /* The clause this term is part of */ - Bitmask prereqRight; /* Bitmask of tables used by pExpr->pRight */ - Bitmask prereqAll; /* Bitmask of tables referenced by pExpr */ -}; - -/* -** Allowed values of WhereTerm.wtFlags -*/ -#define TERM_DYNAMIC 0x01 /* Need to call sqlite3ExprDelete(db, pExpr) */ -#define TERM_VIRTUAL 0x02 /* Added by the optimizer. Do not code */ -#define TERM_CODED 0x04 /* This term is already coded */ -#define TERM_COPIED 0x08 /* Has a child */ -#define TERM_ORINFO 0x10 /* Need to free the WhereTerm.u.pOrInfo object */ -#define TERM_ANDINFO 0x20 /* Need to free the WhereTerm.u.pAndInfo obj */ -#define TERM_OR_OK 0x40 /* Used during OR-clause processing */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -# define TERM_VNULL 0x80 /* Manufactured x>NULL or x<=NULL term */ -#else -# define TERM_VNULL 0x00 /* Disabled if not using stat3 */ -#endif - -/* -** An instance of the WhereScan object is used as an iterator for locating -** terms in the WHERE clause that are useful to the query planner. -*/ -struct WhereScan { - WhereClause *pOrigWC; /* Original, innermost WhereClause */ - WhereClause *pWC; /* WhereClause currently being scanned */ - char *zCollName; /* Required collating sequence, if not NULL */ - char idxaff; /* Must match this affinity, if zCollName!=NULL */ - unsigned char nEquiv; /* Number of entries in aEquiv[] */ - unsigned char iEquiv; /* Next unused slot in aEquiv[] */ - u32 opMask; /* Acceptable operators */ - int k; /* Resume scanning at this->pWC->a[this->k] */ - int aEquiv[22]; /* Cursor,Column pairs for equivalence classes */ -}; - -/* -** An instance of the following structure holds all information about a -** WHERE clause. Mostly this is a container for one or more WhereTerms. -** -** Explanation of pOuter: For a WHERE clause of the form -** -** a AND ((b AND c) OR (d AND e)) AND f -** -** There are separate WhereClause objects for the whole clause and for -** the subclauses "(b AND c)" and "(d AND e)". The pOuter field of the -** subclauses points to the WhereClause object for the whole clause. -*/ -struct WhereClause { - WhereInfo *pWInfo; /* WHERE clause processing context */ - WhereClause *pOuter; /* Outer conjunction */ - u8 op; /* Split operator. TK_AND or TK_OR */ - int nTerm; /* Number of terms */ - int nSlot; /* Number of entries in a[] */ - WhereTerm *a; /* Each a[] describes a term of the WHERE cluase */ -#if defined(SQLITE_SMALL_STACK) - WhereTerm aStatic[1]; /* Initial static space for a[] */ -#else - WhereTerm aStatic[8]; /* Initial static space for a[] */ -#endif -}; - -/* -** A WhereTerm with eOperator==WO_OR has its u.pOrInfo pointer set to -** a dynamically allocated instance of the following structure. -*/ -struct WhereOrInfo { - WhereClause wc; /* Decomposition into subterms */ - Bitmask indexable; /* Bitmask of all indexable tables in the clause */ -}; - -/* -** A WhereTerm with eOperator==WO_AND has its u.pAndInfo pointer set to -** a dynamically allocated instance of the following structure. -*/ -struct WhereAndInfo { - WhereClause wc; /* The subexpression broken out */ -}; - -/* -** An instance of the following structure keeps track of a mapping -** between VDBE cursor numbers and bits of the bitmasks in WhereTerm. -** -** The VDBE cursor numbers are small integers contained in -** SrcList_item.iCursor and Expr.iTable fields. For any given WHERE -** clause, the cursor numbers might not begin with 0 and they might -** contain gaps in the numbering sequence. But we want to make maximum -** use of the bits in our bitmasks. This structure provides a mapping -** from the sparse cursor numbers into consecutive integers beginning -** with 0. -** -** If WhereMaskSet.ix[A]==B it means that The A-th bit of a Bitmask -** corresponds VDBE cursor number B. The A-th bit of a bitmask is 1<3, 5->1, 8->2, 29->0, -** 57->5, 73->4. Or one of 719 other combinations might be used. It -** does not really matter. What is important is that sparse cursor -** numbers all get mapped into bit numbers that begin with 0 and contain -** no gaps. -*/ -struct WhereMaskSet { - int n; /* Number of assigned cursor values */ - int ix[BMS]; /* Cursor assigned to each bit */ -}; - -/* -** This object is a convenience wrapper holding all information needed -** to construct WhereLoop objects for a particular query. -*/ -struct WhereLoopBuilder { - WhereInfo *pWInfo; /* Information about this WHERE */ - WhereClause *pWC; /* WHERE clause terms */ - ExprList *pOrderBy; /* ORDER BY clause */ - WhereLoop *pNew; /* Template WhereLoop */ - WhereOrSet *pOrSet; /* Record best loops here, if not NULL */ -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - UnpackedRecord *pRec; /* Probe for stat4 (if required) */ - int nRecValid; /* Number of valid fields currently in pRec */ -#endif -}; - -/* -** The WHERE clause processing routine has two halves. The -** first part does the start of the WHERE loop and the second -** half does the tail of the WHERE loop. An instance of -** this structure is returned by the first half and passed -** into the second half to give some continuity. -** -** An instance of this object holds the complete state of the query -** planner. -*/ -struct WhereInfo { - Parse *pParse; /* Parsing and code generating context */ - SrcList *pTabList; /* List of tables in the join */ - ExprList *pOrderBy; /* The ORDER BY clause or NULL */ - ExprList *pResultSet; /* Result set. DISTINCT operates on these */ - WhereLoop *pLoops; /* List of all WhereLoop objects */ - Bitmask revMask; /* Mask of ORDER BY terms that need reversing */ - LogEst nRowOut; /* Estimated number of output rows */ - u16 wctrlFlags; /* Flags originally passed to sqlite3WhereBegin() */ - u8 bOBSat; /* ORDER BY satisfied by indices */ - u8 okOnePass; /* Ok to use one-pass algorithm for UPDATE/DELETE */ - u8 untestedTerms; /* Not all WHERE terms resolved by outer loop */ - u8 eDistinct; /* One of the WHERE_DISTINCT_* values below */ - u8 nLevel; /* Number of nested loop */ - int iTop; /* The very beginning of the WHERE loop */ - int iContinue; /* Jump here to continue with next record */ - int iBreak; /* Jump here to break out of the loop */ - int savedNQueryLoop; /* pParse->nQueryLoop outside the WHERE loop */ - int aiCurOnePass[2]; /* OP_OpenWrite cursors for the ONEPASS opt */ - WhereMaskSet sMaskSet; /* Map cursor numbers to bitmasks */ - WhereClause sWC; /* Decomposition of the WHERE clause */ - WhereLevel a[1]; /* Information about each nest loop in WHERE */ -}; - -/* -** Bitmasks for the operators on WhereTerm objects. These are all -** operators that are of interest to the query planner. An -** OR-ed combination of these values can be used when searching for -** particular WhereTerms within a WhereClause. -*/ -#define WO_IN 0x001 -#define WO_EQ 0x002 -#define WO_LT (WO_EQ<<(TK_LT-TK_EQ)) -#define WO_LE (WO_EQ<<(TK_LE-TK_EQ)) -#define WO_GT (WO_EQ<<(TK_GT-TK_EQ)) -#define WO_GE (WO_EQ<<(TK_GE-TK_EQ)) -#define WO_MATCH 0x040 -#define WO_ISNULL 0x080 -#define WO_OR 0x100 /* Two or more OR-connected terms */ -#define WO_AND 0x200 /* Two or more AND-connected terms */ -#define WO_EQUIV 0x400 /* Of the form A==B, both columns */ -#define WO_NOOP 0x800 /* This term does not restrict search space */ - -#define WO_ALL 0xfff /* Mask of all possible WO_* values */ -#define WO_SINGLE 0x0ff /* Mask of all non-compound WO_* values */ - -/* -** These are definitions of bits in the WhereLoop.wsFlags field. -** The particular combination of bits in each WhereLoop help to -** determine the algorithm that WhereLoop represents. -*/ -#define WHERE_COLUMN_EQ 0x00000001 /* x=EXPR */ -#define WHERE_COLUMN_RANGE 0x00000002 /* xEXPR */ -#define WHERE_COLUMN_IN 0x00000004 /* x IN (...) */ -#define WHERE_COLUMN_NULL 0x00000008 /* x IS NULL */ -#define WHERE_CONSTRAINT 0x0000000f /* Any of the WHERE_COLUMN_xxx values */ -#define WHERE_TOP_LIMIT 0x00000010 /* xEXPR or x>=EXPR constraint */ -#define WHERE_BOTH_LIMIT 0x00000030 /* Both x>EXPR and xnRowOut); -} - -/* -** Return one of the WHERE_DISTINCT_xxxxx values to indicate how this -** WHERE clause returns outputs for DISTINCT processing. -*/ -SQLITE_PRIVATE int sqlite3WhereIsDistinct(WhereInfo *pWInfo){ - return pWInfo->eDistinct; -} - -/* -** Return TRUE if the WHERE clause returns rows in ORDER BY order. -** Return FALSE if the output needs to be sorted. -*/ -SQLITE_PRIVATE int sqlite3WhereIsOrdered(WhereInfo *pWInfo){ - return pWInfo->bOBSat!=0; -} - -/* -** Return the VDBE address or label to jump to in order to continue -** immediately with the next row of a WHERE clause. -*/ -SQLITE_PRIVATE int sqlite3WhereContinueLabel(WhereInfo *pWInfo){ - return pWInfo->iContinue; -} - -/* -** Return the VDBE address or label to jump to in order to break -** out of a WHERE loop. -*/ -SQLITE_PRIVATE int sqlite3WhereBreakLabel(WhereInfo *pWInfo){ - return pWInfo->iBreak; -} - -/* -** Return TRUE if an UPDATE or DELETE statement can operate directly on -** the rowids returned by a WHERE clause. Return FALSE if doing an -** UPDATE or DELETE might change subsequent WHERE clause results. -** -** If the ONEPASS optimization is used (if this routine returns true) -** then also write the indices of open cursors used by ONEPASS -** into aiCur[0] and aiCur[1]. iaCur[0] gets the cursor of the data -** table and iaCur[1] gets the cursor used by an auxiliary index. -** Either value may be -1, indicating that cursor is not used. -** Any cursors returned will have been opened for writing. -** -** aiCur[0] and aiCur[1] both get -1 if the where-clause logic is -** unable to use the ONEPASS optimization. -*/ -SQLITE_PRIVATE int sqlite3WhereOkOnePass(WhereInfo *pWInfo, int *aiCur){ - memcpy(aiCur, pWInfo->aiCurOnePass, sizeof(int)*2); - return pWInfo->okOnePass; -} - -/* -** Move the content of pSrc into pDest -*/ -static void whereOrMove(WhereOrSet *pDest, WhereOrSet *pSrc){ - pDest->n = pSrc->n; - memcpy(pDest->a, pSrc->a, pDest->n*sizeof(pDest->a[0])); -} - -/* -** Try to insert a new prerequisite/cost entry into the WhereOrSet pSet. -** -** The new entry might overwrite an existing entry, or it might be -** appended, or it might be discarded. Do whatever is the right thing -** so that pSet keeps the N_OR_COST best entries seen so far. -*/ -static int whereOrInsert( - WhereOrSet *pSet, /* The WhereOrSet to be updated */ - Bitmask prereq, /* Prerequisites of the new entry */ - LogEst rRun, /* Run-cost of the new entry */ - LogEst nOut /* Number of outputs for the new entry */ -){ - u16 i; - WhereOrCost *p; - for(i=pSet->n, p=pSet->a; i>0; i--, p++){ - if( rRun<=p->rRun && (prereq & p->prereq)==prereq ){ - goto whereOrInsert_done; - } - if( p->rRun<=rRun && (p->prereq & prereq)==p->prereq ){ - return 0; - } - } - if( pSet->na[pSet->n++]; - p->nOut = nOut; - }else{ - p = pSet->a; - for(i=1; in; i++){ - if( p->rRun>pSet->a[i].rRun ) p = pSet->a + i; - } - if( p->rRun<=rRun ) return 0; - } -whereOrInsert_done: - p->prereq = prereq; - p->rRun = rRun; - if( p->nOut>nOut ) p->nOut = nOut; - return 1; -} - -/* -** Initialize a preallocated WhereClause structure. -*/ -static void whereClauseInit( - WhereClause *pWC, /* The WhereClause to be initialized */ - WhereInfo *pWInfo /* The WHERE processing context */ -){ - pWC->pWInfo = pWInfo; - pWC->pOuter = 0; - pWC->nTerm = 0; - pWC->nSlot = ArraySize(pWC->aStatic); - pWC->a = pWC->aStatic; -} - -/* Forward reference */ -static void whereClauseClear(WhereClause*); - -/* -** Deallocate all memory associated with a WhereOrInfo object. -*/ -static void whereOrInfoDelete(sqlite3 *db, WhereOrInfo *p){ - whereClauseClear(&p->wc); - sqlite3DbFree(db, p); -} - -/* -** Deallocate all memory associated with a WhereAndInfo object. -*/ -static void whereAndInfoDelete(sqlite3 *db, WhereAndInfo *p){ - whereClauseClear(&p->wc); - sqlite3DbFree(db, p); -} - -/* -** Deallocate a WhereClause structure. The WhereClause structure -** itself is not freed. This routine is the inverse of whereClauseInit(). -*/ -static void whereClauseClear(WhereClause *pWC){ - int i; - WhereTerm *a; - sqlite3 *db = pWC->pWInfo->pParse->db; - for(i=pWC->nTerm-1, a=pWC->a; i>=0; i--, a++){ - if( a->wtFlags & TERM_DYNAMIC ){ - sqlite3ExprDelete(db, a->pExpr); - } - if( a->wtFlags & TERM_ORINFO ){ - whereOrInfoDelete(db, a->u.pOrInfo); - }else if( a->wtFlags & TERM_ANDINFO ){ - whereAndInfoDelete(db, a->u.pAndInfo); - } - } - if( pWC->a!=pWC->aStatic ){ - sqlite3DbFree(db, pWC->a); - } -} - -/* -** Add a single new WhereTerm entry to the WhereClause object pWC. -** The new WhereTerm object is constructed from Expr p and with wtFlags. -** The index in pWC->a[] of the new WhereTerm is returned on success. -** 0 is returned if the new WhereTerm could not be added due to a memory -** allocation error. The memory allocation failure will be recorded in -** the db->mallocFailed flag so that higher-level functions can detect it. -** -** This routine will increase the size of the pWC->a[] array as necessary. -** -** If the wtFlags argument includes TERM_DYNAMIC, then responsibility -** for freeing the expression p is assumed by the WhereClause object pWC. -** This is true even if this routine fails to allocate a new WhereTerm. -** -** WARNING: This routine might reallocate the space used to store -** WhereTerms. All pointers to WhereTerms should be invalidated after -** calling this routine. Such pointers may be reinitialized by referencing -** the pWC->a[] array. -*/ -static int whereClauseInsert(WhereClause *pWC, Expr *p, u8 wtFlags){ - WhereTerm *pTerm; - int idx; - testcase( wtFlags & TERM_VIRTUAL ); - if( pWC->nTerm>=pWC->nSlot ){ - WhereTerm *pOld = pWC->a; - sqlite3 *db = pWC->pWInfo->pParse->db; - pWC->a = sqlite3DbMallocRaw(db, sizeof(pWC->a[0])*pWC->nSlot*2 ); - if( pWC->a==0 ){ - if( wtFlags & TERM_DYNAMIC ){ - sqlite3ExprDelete(db, p); - } - pWC->a = pOld; - return 0; - } - memcpy(pWC->a, pOld, sizeof(pWC->a[0])*pWC->nTerm); - if( pOld!=pWC->aStatic ){ - sqlite3DbFree(db, pOld); - } - pWC->nSlot = sqlite3DbMallocSize(db, pWC->a)/sizeof(pWC->a[0]); - } - pTerm = &pWC->a[idx = pWC->nTerm++]; - if( p && ExprHasProperty(p, EP_Unlikely) ){ - pTerm->truthProb = sqlite3LogEst(p->iTable) - 99; - }else{ - pTerm->truthProb = -1; - } - pTerm->pExpr = sqlite3ExprSkipCollate(p); - pTerm->wtFlags = wtFlags; - pTerm->pWC = pWC; - pTerm->iParent = -1; - return idx; -} - -/* -** This routine identifies subexpressions in the WHERE clause where -** each subexpression is separated by the AND operator or some other -** operator specified in the op parameter. The WhereClause structure -** is filled with pointers to subexpressions. For example: -** -** WHERE a=='hello' AND coalesce(b,11)<10 AND (c+12!=d OR c==22) -** \________/ \_______________/ \________________/ -** slot[0] slot[1] slot[2] -** -** The original WHERE clause in pExpr is unaltered. All this routine -** does is make slot[] entries point to substructure within pExpr. -** -** In the previous sentence and in the diagram, "slot[]" refers to -** the WhereClause.a[] array. The slot[] array grows as needed to contain -** all terms of the WHERE clause. -*/ -static void whereSplit(WhereClause *pWC, Expr *pExpr, u8 op){ - pWC->op = op; - if( pExpr==0 ) return; - if( pExpr->op!=op ){ - whereClauseInsert(pWC, pExpr, 0); - }else{ - whereSplit(pWC, pExpr->pLeft, op); - whereSplit(pWC, pExpr->pRight, op); - } -} - -/* -** Initialize a WhereMaskSet object -*/ -#define initMaskSet(P) (P)->n=0 - -/* -** Return the bitmask for the given cursor number. Return 0 if -** iCursor is not in the set. -*/ -static Bitmask getMask(WhereMaskSet *pMaskSet, int iCursor){ - int i; - assert( pMaskSet->n<=(int)sizeof(Bitmask)*8 ); - for(i=0; in; i++){ - if( pMaskSet->ix[i]==iCursor ){ - return MASKBIT(i); - } - } - return 0; -} - -/* -** Create a new mask for cursor iCursor. -** -** There is one cursor per table in the FROM clause. The number of -** tables in the FROM clause is limited by a test early in the -** sqlite3WhereBegin() routine. So we know that the pMaskSet->ix[] -** array will never overflow. -*/ -static void createMask(WhereMaskSet *pMaskSet, int iCursor){ - assert( pMaskSet->n < ArraySize(pMaskSet->ix) ); - pMaskSet->ix[pMaskSet->n++] = iCursor; -} - -/* -** These routines walk (recursively) an expression tree and generate -** a bitmask indicating which tables are used in that expression -** tree. -*/ -static Bitmask exprListTableUsage(WhereMaskSet*, ExprList*); -static Bitmask exprSelectTableUsage(WhereMaskSet*, Select*); -static Bitmask exprTableUsage(WhereMaskSet *pMaskSet, Expr *p){ - Bitmask mask = 0; - if( p==0 ) return 0; - if( p->op==TK_COLUMN ){ - mask = getMask(pMaskSet, p->iTable); - return mask; - } - mask = exprTableUsage(pMaskSet, p->pRight); - mask |= exprTableUsage(pMaskSet, p->pLeft); - if( ExprHasProperty(p, EP_xIsSelect) ){ - mask |= exprSelectTableUsage(pMaskSet, p->x.pSelect); - }else{ - mask |= exprListTableUsage(pMaskSet, p->x.pList); - } - return mask; -} -static Bitmask exprListTableUsage(WhereMaskSet *pMaskSet, ExprList *pList){ - int i; - Bitmask mask = 0; - if( pList ){ - for(i=0; inExpr; i++){ - mask |= exprTableUsage(pMaskSet, pList->a[i].pExpr); - } - } - return mask; -} -static Bitmask exprSelectTableUsage(WhereMaskSet *pMaskSet, Select *pS){ - Bitmask mask = 0; - while( pS ){ - SrcList *pSrc = pS->pSrc; - mask |= exprListTableUsage(pMaskSet, pS->pEList); - mask |= exprListTableUsage(pMaskSet, pS->pGroupBy); - mask |= exprListTableUsage(pMaskSet, pS->pOrderBy); - mask |= exprTableUsage(pMaskSet, pS->pWhere); - mask |= exprTableUsage(pMaskSet, pS->pHaving); - if( ALWAYS(pSrc!=0) ){ - int i; - for(i=0; inSrc; i++){ - mask |= exprSelectTableUsage(pMaskSet, pSrc->a[i].pSelect); - mask |= exprTableUsage(pMaskSet, pSrc->a[i].pOn); - } - } - pS = pS->pPrior; - } - return mask; -} - -/* -** Return TRUE if the given operator is one of the operators that is -** allowed for an indexable WHERE clause term. The allowed operators are -** "=", "<", ">", "<=", ">=", "IN", and "IS NULL" -*/ -static int allowedOp(int op){ - assert( TK_GT>TK_EQ && TK_GTTK_EQ && TK_LTTK_EQ && TK_LE=TK_EQ && op<=TK_GE) || op==TK_ISNULL; -} - -/* -** Swap two objects of type TYPE. -*/ -#define SWAP(TYPE,A,B) {TYPE t=A; A=B; B=t;} - -/* -** Commute a comparison operator. Expressions of the form "X op Y" -** are converted into "Y op X". -** -** If left/right precedence rules come into play when determining the -** collating sequence, then COLLATE operators are adjusted to ensure -** that the collating sequence does not change. For example: -** "Y collate NOCASE op X" becomes "X op Y" because any collation sequence on -** the left hand side of a comparison overrides any collation sequence -** attached to the right. For the same reason the EP_Collate flag -** is not commuted. -*/ -static void exprCommute(Parse *pParse, Expr *pExpr){ - u16 expRight = (pExpr->pRight->flags & EP_Collate); - u16 expLeft = (pExpr->pLeft->flags & EP_Collate); - assert( allowedOp(pExpr->op) && pExpr->op!=TK_IN ); - if( expRight==expLeft ){ - /* Either X and Y both have COLLATE operator or neither do */ - if( expRight ){ - /* Both X and Y have COLLATE operators. Make sure X is always - ** used by clearing the EP_Collate flag from Y. */ - pExpr->pRight->flags &= ~EP_Collate; - }else if( sqlite3ExprCollSeq(pParse, pExpr->pLeft)!=0 ){ - /* Neither X nor Y have COLLATE operators, but X has a non-default - ** collating sequence. So add the EP_Collate marker on X to cause - ** it to be searched first. */ - pExpr->pLeft->flags |= EP_Collate; - } - } - SWAP(Expr*,pExpr->pRight,pExpr->pLeft); - if( pExpr->op>=TK_GT ){ - assert( TK_LT==TK_GT+2 ); - assert( TK_GE==TK_LE+2 ); - assert( TK_GT>TK_EQ ); - assert( TK_GTop>=TK_GT && pExpr->op<=TK_GE ); - pExpr->op = ((pExpr->op-TK_GT)^2)+TK_GT; - } -} - -/* -** Translate from TK_xx operator to WO_xx bitmask. -*/ -static u16 operatorMask(int op){ - u16 c; - assert( allowedOp(op) ); - if( op==TK_IN ){ - c = WO_IN; - }else if( op==TK_ISNULL ){ - c = WO_ISNULL; - }else{ - assert( (WO_EQ<<(op-TK_EQ)) < 0x7fff ); - c = (u16)(WO_EQ<<(op-TK_EQ)); - } - assert( op!=TK_ISNULL || c==WO_ISNULL ); - assert( op!=TK_IN || c==WO_IN ); - assert( op!=TK_EQ || c==WO_EQ ); - assert( op!=TK_LT || c==WO_LT ); - assert( op!=TK_LE || c==WO_LE ); - assert( op!=TK_GT || c==WO_GT ); - assert( op!=TK_GE || c==WO_GE ); - return c; -} - -/* -** Advance to the next WhereTerm that matches according to the criteria -** established when the pScan object was initialized by whereScanInit(). -** Return NULL if there are no more matching WhereTerms. -*/ -static WhereTerm *whereScanNext(WhereScan *pScan){ - int iCur; /* The cursor on the LHS of the term */ - int iColumn; /* The column on the LHS of the term. -1 for IPK */ - Expr *pX; /* An expression being tested */ - WhereClause *pWC; /* Shorthand for pScan->pWC */ - WhereTerm *pTerm; /* The term being tested */ - int k = pScan->k; /* Where to start scanning */ - - while( pScan->iEquiv<=pScan->nEquiv ){ - iCur = pScan->aEquiv[pScan->iEquiv-2]; - iColumn = pScan->aEquiv[pScan->iEquiv-1]; - while( (pWC = pScan->pWC)!=0 ){ - for(pTerm=pWC->a+k; knTerm; k++, pTerm++){ - if( pTerm->leftCursor==iCur - && pTerm->u.leftColumn==iColumn - && (pScan->iEquiv<=2 || !ExprHasProperty(pTerm->pExpr, EP_FromJoin)) - ){ - if( (pTerm->eOperator & WO_EQUIV)!=0 - && pScan->nEquivaEquiv) - ){ - int j; - pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight); - assert( pX->op==TK_COLUMN ); - for(j=0; jnEquiv; j+=2){ - if( pScan->aEquiv[j]==pX->iTable - && pScan->aEquiv[j+1]==pX->iColumn ){ - break; - } - } - if( j==pScan->nEquiv ){ - pScan->aEquiv[j] = pX->iTable; - pScan->aEquiv[j+1] = pX->iColumn; - pScan->nEquiv += 2; - } - } - if( (pTerm->eOperator & pScan->opMask)!=0 ){ - /* Verify the affinity and collating sequence match */ - if( pScan->zCollName && (pTerm->eOperator & WO_ISNULL)==0 ){ - CollSeq *pColl; - Parse *pParse = pWC->pWInfo->pParse; - pX = pTerm->pExpr; - if( !sqlite3IndexAffinityOk(pX, pScan->idxaff) ){ - continue; - } - assert(pX->pLeft); - pColl = sqlite3BinaryCompareCollSeq(pParse, - pX->pLeft, pX->pRight); - if( pColl==0 ) pColl = pParse->db->pDfltColl; - if( sqlite3StrICmp(pColl->zName, pScan->zCollName) ){ - continue; - } - } - if( (pTerm->eOperator & WO_EQ)!=0 - && (pX = pTerm->pExpr->pRight)->op==TK_COLUMN - && pX->iTable==pScan->aEquiv[0] - && pX->iColumn==pScan->aEquiv[1] - ){ - continue; - } - pScan->k = k+1; - return pTerm; - } - } - } - pScan->pWC = pScan->pWC->pOuter; - k = 0; - } - pScan->pWC = pScan->pOrigWC; - k = 0; - pScan->iEquiv += 2; - } - return 0; -} - -/* -** Initialize a WHERE clause scanner object. Return a pointer to the -** first match. Return NULL if there are no matches. -** -** The scanner will be searching the WHERE clause pWC. It will look -** for terms of the form "X " where X is column iColumn of table -** iCur. The must be one of the operators described by opMask. -** -** If the search is for X and the WHERE clause contains terms of the -** form X=Y then this routine might also return terms of the form -** "Y ". The number of levels of transitivity is limited, -** but is enough to handle most commonly occurring SQL statements. -** -** If X is not the INTEGER PRIMARY KEY then X must be compatible with -** index pIdx. -*/ -static WhereTerm *whereScanInit( - WhereScan *pScan, /* The WhereScan object being initialized */ - WhereClause *pWC, /* The WHERE clause to be scanned */ - int iCur, /* Cursor to scan for */ - int iColumn, /* Column to scan for */ - u32 opMask, /* Operator(s) to scan for */ - Index *pIdx /* Must be compatible with this index */ -){ - int j; - - /* memset(pScan, 0, sizeof(*pScan)); */ - pScan->pOrigWC = pWC; - pScan->pWC = pWC; - if( pIdx && iColumn>=0 ){ - pScan->idxaff = pIdx->pTable->aCol[iColumn].affinity; - for(j=0; pIdx->aiColumn[j]!=iColumn; j++){ - if( NEVER(j>=pIdx->nKeyCol) ) return 0; - } - pScan->zCollName = pIdx->azColl[j]; - }else{ - pScan->idxaff = 0; - pScan->zCollName = 0; - } - pScan->opMask = opMask; - pScan->k = 0; - pScan->aEquiv[0] = iCur; - pScan->aEquiv[1] = iColumn; - pScan->nEquiv = 2; - pScan->iEquiv = 2; - return whereScanNext(pScan); -} - -/* -** Search for a term in the WHERE clause that is of the form "X " -** where X is a reference to the iColumn of table iCur and is one of -** the WO_xx operator codes specified by the op parameter. -** Return a pointer to the term. Return 0 if not found. -** -** The term returned might by Y= if there is another constraint in -** the WHERE clause that specifies that X=Y. Any such constraints will be -** identified by the WO_EQUIV bit in the pTerm->eOperator field. The -** aEquiv[] array holds X and all its equivalents, with each SQL variable -** taking up two slots in aEquiv[]. The first slot is for the cursor number -** and the second is for the column number. There are 22 slots in aEquiv[] -** so that means we can look for X plus up to 10 other equivalent values. -** Hence a search for X will return if X=A1 and A1=A2 and A2=A3 -** and ... and A9=A10 and A10=. -** -** If there are multiple terms in the WHERE clause of the form "X " -** then try for the one with no dependencies on - in other words where -** is a constant expression of some kind. Only return entries of -** the form "X Y" where Y is a column in another table if no terms of -** the form "X " exist. If no terms with a constant RHS -** exist, try to return a term that does not use WO_EQUIV. -*/ -static WhereTerm *findTerm( - WhereClause *pWC, /* The WHERE clause to be searched */ - int iCur, /* Cursor number of LHS */ - int iColumn, /* Column number of LHS */ - Bitmask notReady, /* RHS must not overlap with this mask */ - u32 op, /* Mask of WO_xx values describing operator */ - Index *pIdx /* Must be compatible with this index, if not NULL */ -){ - WhereTerm *pResult = 0; - WhereTerm *p; - WhereScan scan; - - p = whereScanInit(&scan, pWC, iCur, iColumn, op, pIdx); - while( p ){ - if( (p->prereqRight & notReady)==0 ){ - if( p->prereqRight==0 && (p->eOperator&WO_EQ)!=0 ){ - return p; - } - if( pResult==0 ) pResult = p; - } - p = whereScanNext(&scan); - } - return pResult; -} - -/* Forward reference */ -static void exprAnalyze(SrcList*, WhereClause*, int); - -/* -** Call exprAnalyze on all terms in a WHERE clause. -*/ -static void exprAnalyzeAll( - SrcList *pTabList, /* the FROM clause */ - WhereClause *pWC /* the WHERE clause to be analyzed */ -){ - int i; - for(i=pWC->nTerm-1; i>=0; i--){ - exprAnalyze(pTabList, pWC, i); - } -} - -#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION -/* -** Check to see if the given expression is a LIKE or GLOB operator that -** can be optimized using inequality constraints. Return TRUE if it is -** so and false if not. -** -** In order for the operator to be optimizible, the RHS must be a string -** literal that does not begin with a wildcard. -*/ -static int isLikeOrGlob( - Parse *pParse, /* Parsing and code generating context */ - Expr *pExpr, /* Test this expression */ - Expr **ppPrefix, /* Pointer to TK_STRING expression with pattern prefix */ - int *pisComplete, /* True if the only wildcard is % in the last character */ - int *pnoCase /* True if uppercase is equivalent to lowercase */ -){ - const char *z = 0; /* String on RHS of LIKE operator */ - Expr *pRight, *pLeft; /* Right and left size of LIKE operator */ - ExprList *pList; /* List of operands to the LIKE operator */ - int c; /* One character in z[] */ - int cnt; /* Number of non-wildcard prefix characters */ - char wc[3]; /* Wildcard characters */ - sqlite3 *db = pParse->db; /* Database connection */ - sqlite3_value *pVal = 0; - int op; /* Opcode of pRight */ - - if( !sqlite3IsLikeFunction(db, pExpr, pnoCase, wc) ){ - return 0; - } -#ifdef SQLITE_EBCDIC - if( *pnoCase ) return 0; -#endif - pList = pExpr->x.pList; - pLeft = pList->a[1].pExpr; - if( pLeft->op!=TK_COLUMN - || sqlite3ExprAffinity(pLeft)!=SQLITE_AFF_TEXT - || IsVirtual(pLeft->pTab) - ){ - /* IMP: R-02065-49465 The left-hand side of the LIKE or GLOB operator must - ** be the name of an indexed column with TEXT affinity. */ - return 0; - } - assert( pLeft->iColumn!=(-1) ); /* Because IPK never has AFF_TEXT */ - - pRight = sqlite3ExprSkipCollate(pList->a[0].pExpr); - op = pRight->op; - if( op==TK_VARIABLE ){ - Vdbe *pReprepare = pParse->pReprepare; - int iCol = pRight->iColumn; - pVal = sqlite3VdbeGetBoundValue(pReprepare, iCol, SQLITE_AFF_NONE); - if( pVal && sqlite3_value_type(pVal)==SQLITE_TEXT ){ - z = (char *)sqlite3_value_text(pVal); - } - sqlite3VdbeSetVarmask(pParse->pVdbe, iCol); - assert( pRight->op==TK_VARIABLE || pRight->op==TK_REGISTER ); - }else if( op==TK_STRING ){ - z = pRight->u.zToken; - } - if( z ){ - cnt = 0; - while( (c=z[cnt])!=0 && c!=wc[0] && c!=wc[1] && c!=wc[2] ){ - cnt++; - } - if( cnt!=0 && 255!=(u8)z[cnt-1] ){ - Expr *pPrefix; - *pisComplete = c==wc[0] && z[cnt+1]==0; - pPrefix = sqlite3Expr(db, TK_STRING, z); - if( pPrefix ) pPrefix->u.zToken[cnt] = 0; - *ppPrefix = pPrefix; - if( op==TK_VARIABLE ){ - Vdbe *v = pParse->pVdbe; - sqlite3VdbeSetVarmask(v, pRight->iColumn); - if( *pisComplete && pRight->u.zToken[1] ){ - /* If the rhs of the LIKE expression is a variable, and the current - ** value of the variable means there is no need to invoke the LIKE - ** function, then no OP_Variable will be added to the program. - ** This causes problems for the sqlite3_bind_parameter_name() - ** API. To workaround them, add a dummy OP_Variable here. - */ - int r1 = sqlite3GetTempReg(pParse); - sqlite3ExprCodeTarget(pParse, pRight, r1); - sqlite3VdbeChangeP3(v, sqlite3VdbeCurrentAddr(v)-1, 0); - sqlite3ReleaseTempReg(pParse, r1); - } - } - }else{ - z = 0; - } - } - - sqlite3ValueFree(pVal); - return (z!=0); -} -#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */ - - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* -** Check to see if the given expression is of the form -** -** column MATCH expr -** -** If it is then return TRUE. If not, return FALSE. -*/ -static int isMatchOfColumn( - Expr *pExpr /* Test this expression */ -){ - ExprList *pList; - - if( pExpr->op!=TK_FUNCTION ){ - return 0; - } - if( sqlite3StrICmp(pExpr->u.zToken,"match")!=0 ){ - return 0; - } - pList = pExpr->x.pList; - if( pList->nExpr!=2 ){ - return 0; - } - if( pList->a[1].pExpr->op != TK_COLUMN ){ - return 0; - } - return 1; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/* -** If the pBase expression originated in the ON or USING clause of -** a join, then transfer the appropriate markings over to derived. -*/ -static void transferJoinMarkings(Expr *pDerived, Expr *pBase){ - if( pDerived ){ - pDerived->flags |= pBase->flags & EP_FromJoin; - pDerived->iRightJoinTable = pBase->iRightJoinTable; - } -} - -#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY) -/* -** Analyze a term that consists of two or more OR-connected -** subterms. So in: -** -** ... WHERE (a=5) AND (b=7 OR c=9 OR d=13) AND (d=13) -** ^^^^^^^^^^^^^^^^^^^^ -** -** This routine analyzes terms such as the middle term in the above example. -** A WhereOrTerm object is computed and attached to the term under -** analysis, regardless of the outcome of the analysis. Hence: -** -** WhereTerm.wtFlags |= TERM_ORINFO -** WhereTerm.u.pOrInfo = a dynamically allocated WhereOrTerm object -** -** The term being analyzed must have two or more of OR-connected subterms. -** A single subterm might be a set of AND-connected sub-subterms. -** Examples of terms under analysis: -** -** (A) t1.x=t2.y OR t1.x=t2.z OR t1.y=15 OR t1.z=t3.a+5 -** (B) x=expr1 OR expr2=x OR x=expr3 -** (C) t1.x=t2.y OR (t1.x=t2.z AND t1.y=15) -** (D) x=expr1 OR (y>11 AND y<22 AND z LIKE '*hello*') -** (E) (p.a=1 AND q.b=2 AND r.c=3) OR (p.x=4 AND q.y=5 AND r.z=6) -** -** CASE 1: -** -** If all subterms are of the form T.C=expr for some single column of C and -** a single table T (as shown in example B above) then create a new virtual -** term that is an equivalent IN expression. In other words, if the term -** being analyzed is: -** -** x = expr1 OR expr2 = x OR x = expr3 -** -** then create a new virtual term like this: -** -** x IN (expr1,expr2,expr3) -** -** CASE 2: -** -** If all subterms are indexable by a single table T, then set -** -** WhereTerm.eOperator = WO_OR -** WhereTerm.u.pOrInfo->indexable |= the cursor number for table T -** -** A subterm is "indexable" if it is of the form -** "T.C " where C is any column of table T and -** is one of "=", "<", "<=", ">", ">=", "IS NULL", or "IN". -** A subterm is also indexable if it is an AND of two or more -** subsubterms at least one of which is indexable. Indexable AND -** subterms have their eOperator set to WO_AND and they have -** u.pAndInfo set to a dynamically allocated WhereAndTerm object. -** -** From another point of view, "indexable" means that the subterm could -** potentially be used with an index if an appropriate index exists. -** This analysis does not consider whether or not the index exists; that -** is decided elsewhere. This analysis only looks at whether subterms -** appropriate for indexing exist. -** -** All examples A through E above satisfy case 2. But if a term -** also statisfies case 1 (such as B) we know that the optimizer will -** always prefer case 1, so in that case we pretend that case 2 is not -** satisfied. -** -** It might be the case that multiple tables are indexable. For example, -** (E) above is indexable on tables P, Q, and R. -** -** Terms that satisfy case 2 are candidates for lookup by using -** separate indices to find rowids for each subterm and composing -** the union of all rowids using a RowSet object. This is similar -** to "bitmap indices" in other database engines. -** -** OTHERWISE: -** -** If neither case 1 nor case 2 apply, then leave the eOperator set to -** zero. This term is not useful for search. -*/ -static void exprAnalyzeOrTerm( - SrcList *pSrc, /* the FROM clause */ - WhereClause *pWC, /* the complete WHERE clause */ - int idxTerm /* Index of the OR-term to be analyzed */ -){ - WhereInfo *pWInfo = pWC->pWInfo; /* WHERE clause processing context */ - Parse *pParse = pWInfo->pParse; /* Parser context */ - sqlite3 *db = pParse->db; /* Database connection */ - WhereTerm *pTerm = &pWC->a[idxTerm]; /* The term to be analyzed */ - Expr *pExpr = pTerm->pExpr; /* The expression of the term */ - int i; /* Loop counters */ - WhereClause *pOrWc; /* Breakup of pTerm into subterms */ - WhereTerm *pOrTerm; /* A Sub-term within the pOrWc */ - WhereOrInfo *pOrInfo; /* Additional information associated with pTerm */ - Bitmask chngToIN; /* Tables that might satisfy case 1 */ - Bitmask indexable; /* Tables that are indexable, satisfying case 2 */ - - /* - ** Break the OR clause into its separate subterms. The subterms are - ** stored in a WhereClause structure containing within the WhereOrInfo - ** object that is attached to the original OR clause term. - */ - assert( (pTerm->wtFlags & (TERM_DYNAMIC|TERM_ORINFO|TERM_ANDINFO))==0 ); - assert( pExpr->op==TK_OR ); - pTerm->u.pOrInfo = pOrInfo = sqlite3DbMallocZero(db, sizeof(*pOrInfo)); - if( pOrInfo==0 ) return; - pTerm->wtFlags |= TERM_ORINFO; - pOrWc = &pOrInfo->wc; - whereClauseInit(pOrWc, pWInfo); - whereSplit(pOrWc, pExpr, TK_OR); - exprAnalyzeAll(pSrc, pOrWc); - if( db->mallocFailed ) return; - assert( pOrWc->nTerm>=2 ); - - /* - ** Compute the set of tables that might satisfy cases 1 or 2. - */ - indexable = ~(Bitmask)0; - chngToIN = ~(Bitmask)0; - for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0 && indexable; i--, pOrTerm++){ - if( (pOrTerm->eOperator & WO_SINGLE)==0 ){ - WhereAndInfo *pAndInfo; - assert( (pOrTerm->wtFlags & (TERM_ANDINFO|TERM_ORINFO))==0 ); - chngToIN = 0; - pAndInfo = sqlite3DbMallocRaw(db, sizeof(*pAndInfo)); - if( pAndInfo ){ - WhereClause *pAndWC; - WhereTerm *pAndTerm; - int j; - Bitmask b = 0; - pOrTerm->u.pAndInfo = pAndInfo; - pOrTerm->wtFlags |= TERM_ANDINFO; - pOrTerm->eOperator = WO_AND; - pAndWC = &pAndInfo->wc; - whereClauseInit(pAndWC, pWC->pWInfo); - whereSplit(pAndWC, pOrTerm->pExpr, TK_AND); - exprAnalyzeAll(pSrc, pAndWC); - pAndWC->pOuter = pWC; - testcase( db->mallocFailed ); - if( !db->mallocFailed ){ - for(j=0, pAndTerm=pAndWC->a; jnTerm; j++, pAndTerm++){ - assert( pAndTerm->pExpr ); - if( allowedOp(pAndTerm->pExpr->op) ){ - b |= getMask(&pWInfo->sMaskSet, pAndTerm->leftCursor); - } - } - } - indexable &= b; - } - }else if( pOrTerm->wtFlags & TERM_COPIED ){ - /* Skip this term for now. We revisit it when we process the - ** corresponding TERM_VIRTUAL term */ - }else{ - Bitmask b; - b = getMask(&pWInfo->sMaskSet, pOrTerm->leftCursor); - if( pOrTerm->wtFlags & TERM_VIRTUAL ){ - WhereTerm *pOther = &pOrWc->a[pOrTerm->iParent]; - b |= getMask(&pWInfo->sMaskSet, pOther->leftCursor); - } - indexable &= b; - if( (pOrTerm->eOperator & WO_EQ)==0 ){ - chngToIN = 0; - }else{ - chngToIN &= b; - } - } - } - - /* - ** Record the set of tables that satisfy case 2. The set might be - ** empty. - */ - pOrInfo->indexable = indexable; - pTerm->eOperator = indexable==0 ? 0 : WO_OR; - - /* - ** chngToIN holds a set of tables that *might* satisfy case 1. But - ** we have to do some additional checking to see if case 1 really - ** is satisfied. - ** - ** chngToIN will hold either 0, 1, or 2 bits. The 0-bit case means - ** that there is no possibility of transforming the OR clause into an - ** IN operator because one or more terms in the OR clause contain - ** something other than == on a column in the single table. The 1-bit - ** case means that every term of the OR clause is of the form - ** "table.column=expr" for some single table. The one bit that is set - ** will correspond to the common table. We still need to check to make - ** sure the same column is used on all terms. The 2-bit case is when - ** the all terms are of the form "table1.column=table2.column". It - ** might be possible to form an IN operator with either table1.column - ** or table2.column as the LHS if either is common to every term of - ** the OR clause. - ** - ** Note that terms of the form "table.column1=table.column2" (the - ** same table on both sizes of the ==) cannot be optimized. - */ - if( chngToIN ){ - int okToChngToIN = 0; /* True if the conversion to IN is valid */ - int iColumn = -1; /* Column index on lhs of IN operator */ - int iCursor = -1; /* Table cursor common to all terms */ - int j = 0; /* Loop counter */ - - /* Search for a table and column that appears on one side or the - ** other of the == operator in every subterm. That table and column - ** will be recorded in iCursor and iColumn. There might not be any - ** such table and column. Set okToChngToIN if an appropriate table - ** and column is found but leave okToChngToIN false if not found. - */ - for(j=0; j<2 && !okToChngToIN; j++){ - pOrTerm = pOrWc->a; - for(i=pOrWc->nTerm-1; i>=0; i--, pOrTerm++){ - assert( pOrTerm->eOperator & WO_EQ ); - pOrTerm->wtFlags &= ~TERM_OR_OK; - if( pOrTerm->leftCursor==iCursor ){ - /* This is the 2-bit case and we are on the second iteration and - ** current term is from the first iteration. So skip this term. */ - assert( j==1 ); - continue; - } - if( (chngToIN & getMask(&pWInfo->sMaskSet, pOrTerm->leftCursor))==0 ){ - /* This term must be of the form t1.a==t2.b where t2 is in the - ** chngToIN set but t1 is not. This term will be either preceeded - ** or follwed by an inverted copy (t2.b==t1.a). Skip this term - ** and use its inversion. */ - testcase( pOrTerm->wtFlags & TERM_COPIED ); - testcase( pOrTerm->wtFlags & TERM_VIRTUAL ); - assert( pOrTerm->wtFlags & (TERM_COPIED|TERM_VIRTUAL) ); - continue; - } - iColumn = pOrTerm->u.leftColumn; - iCursor = pOrTerm->leftCursor; - break; - } - if( i<0 ){ - /* No candidate table+column was found. This can only occur - ** on the second iteration */ - assert( j==1 ); - assert( IsPowerOfTwo(chngToIN) ); - assert( chngToIN==getMask(&pWInfo->sMaskSet, iCursor) ); - break; - } - testcase( j==1 ); - - /* We have found a candidate table and column. Check to see if that - ** table and column is common to every term in the OR clause */ - okToChngToIN = 1; - for(; i>=0 && okToChngToIN; i--, pOrTerm++){ - assert( pOrTerm->eOperator & WO_EQ ); - if( pOrTerm->leftCursor!=iCursor ){ - pOrTerm->wtFlags &= ~TERM_OR_OK; - }else if( pOrTerm->u.leftColumn!=iColumn ){ - okToChngToIN = 0; - }else{ - int affLeft, affRight; - /* If the right-hand side is also a column, then the affinities - ** of both right and left sides must be such that no type - ** conversions are required on the right. (Ticket #2249) - */ - affRight = sqlite3ExprAffinity(pOrTerm->pExpr->pRight); - affLeft = sqlite3ExprAffinity(pOrTerm->pExpr->pLeft); - if( affRight!=0 && affRight!=affLeft ){ - okToChngToIN = 0; - }else{ - pOrTerm->wtFlags |= TERM_OR_OK; - } - } - } - } - - /* At this point, okToChngToIN is true if original pTerm satisfies - ** case 1. In that case, construct a new virtual term that is - ** pTerm converted into an IN operator. - */ - if( okToChngToIN ){ - Expr *pDup; /* A transient duplicate expression */ - ExprList *pList = 0; /* The RHS of the IN operator */ - Expr *pLeft = 0; /* The LHS of the IN operator */ - Expr *pNew; /* The complete IN operator */ - - for(i=pOrWc->nTerm-1, pOrTerm=pOrWc->a; i>=0; i--, pOrTerm++){ - if( (pOrTerm->wtFlags & TERM_OR_OK)==0 ) continue; - assert( pOrTerm->eOperator & WO_EQ ); - assert( pOrTerm->leftCursor==iCursor ); - assert( pOrTerm->u.leftColumn==iColumn ); - pDup = sqlite3ExprDup(db, pOrTerm->pExpr->pRight, 0); - pList = sqlite3ExprListAppend(pWInfo->pParse, pList, pDup); - pLeft = pOrTerm->pExpr->pLeft; - } - assert( pLeft!=0 ); - pDup = sqlite3ExprDup(db, pLeft, 0); - pNew = sqlite3PExpr(pParse, TK_IN, pDup, 0, 0); - if( pNew ){ - int idxNew; - transferJoinMarkings(pNew, pExpr); - assert( !ExprHasProperty(pNew, EP_xIsSelect) ); - pNew->x.pList = pList; - idxNew = whereClauseInsert(pWC, pNew, TERM_VIRTUAL|TERM_DYNAMIC); - testcase( idxNew==0 ); - exprAnalyze(pSrc, pWC, idxNew); - pTerm = &pWC->a[idxTerm]; - pWC->a[idxNew].iParent = idxTerm; - pTerm->nChild = 1; - }else{ - sqlite3ExprListDelete(db, pList); - } - pTerm->eOperator = WO_NOOP; /* case 1 trumps case 2 */ - } - } -} -#endif /* !SQLITE_OMIT_OR_OPTIMIZATION && !SQLITE_OMIT_SUBQUERY */ - -/* -** The input to this routine is an WhereTerm structure with only the -** "pExpr" field filled in. The job of this routine is to analyze the -** subexpression and populate all the other fields of the WhereTerm -** structure. -** -** If the expression is of the form " X" it gets commuted -** to the standard form of "X ". -** -** If the expression is of the form "X Y" where both X and Y are -** columns, then the original expression is unchanged and a new virtual -** term of the form "Y X" is added to the WHERE clause and -** analyzed separately. The original term is marked with TERM_COPIED -** and the new term is marked with TERM_DYNAMIC (because it's pExpr -** needs to be freed with the WhereClause) and TERM_VIRTUAL (because it -** is a commuted copy of a prior term.) The original term has nChild=1 -** and the copy has idxParent set to the index of the original term. -*/ -static void exprAnalyze( - SrcList *pSrc, /* the FROM clause */ - WhereClause *pWC, /* the WHERE clause */ - int idxTerm /* Index of the term to be analyzed */ -){ - WhereInfo *pWInfo = pWC->pWInfo; /* WHERE clause processing context */ - WhereTerm *pTerm; /* The term to be analyzed */ - WhereMaskSet *pMaskSet; /* Set of table index masks */ - Expr *pExpr; /* The expression to be analyzed */ - Bitmask prereqLeft; /* Prerequesites of the pExpr->pLeft */ - Bitmask prereqAll; /* Prerequesites of pExpr */ - Bitmask extraRight = 0; /* Extra dependencies on LEFT JOIN */ - Expr *pStr1 = 0; /* RHS of LIKE/GLOB operator */ - int isComplete = 0; /* RHS of LIKE/GLOB ends with wildcard */ - int noCase = 0; /* LIKE/GLOB distinguishes case */ - int op; /* Top-level operator. pExpr->op */ - Parse *pParse = pWInfo->pParse; /* Parsing context */ - sqlite3 *db = pParse->db; /* Database connection */ - - if( db->mallocFailed ){ - return; - } - pTerm = &pWC->a[idxTerm]; - pMaskSet = &pWInfo->sMaskSet; - pExpr = pTerm->pExpr; - assert( pExpr->op!=TK_AS && pExpr->op!=TK_COLLATE ); - prereqLeft = exprTableUsage(pMaskSet, pExpr->pLeft); - op = pExpr->op; - if( op==TK_IN ){ - assert( pExpr->pRight==0 ); - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - pTerm->prereqRight = exprSelectTableUsage(pMaskSet, pExpr->x.pSelect); - }else{ - pTerm->prereqRight = exprListTableUsage(pMaskSet, pExpr->x.pList); - } - }else if( op==TK_ISNULL ){ - pTerm->prereqRight = 0; - }else{ - pTerm->prereqRight = exprTableUsage(pMaskSet, pExpr->pRight); - } - prereqAll = exprTableUsage(pMaskSet, pExpr); - if( ExprHasProperty(pExpr, EP_FromJoin) ){ - Bitmask x = getMask(pMaskSet, pExpr->iRightJoinTable); - prereqAll |= x; - extraRight = x-1; /* ON clause terms may not be used with an index - ** on left table of a LEFT JOIN. Ticket #3015 */ - } - pTerm->prereqAll = prereqAll; - pTerm->leftCursor = -1; - pTerm->iParent = -1; - pTerm->eOperator = 0; - if( allowedOp(op) ){ - Expr *pLeft = sqlite3ExprSkipCollate(pExpr->pLeft); - Expr *pRight = sqlite3ExprSkipCollate(pExpr->pRight); - u16 opMask = (pTerm->prereqRight & prereqLeft)==0 ? WO_ALL : WO_EQUIV; - if( pLeft->op==TK_COLUMN ){ - pTerm->leftCursor = pLeft->iTable; - pTerm->u.leftColumn = pLeft->iColumn; - pTerm->eOperator = operatorMask(op) & opMask; - } - if( pRight && pRight->op==TK_COLUMN ){ - WhereTerm *pNew; - Expr *pDup; - u16 eExtraOp = 0; /* Extra bits for pNew->eOperator */ - if( pTerm->leftCursor>=0 ){ - int idxNew; - pDup = sqlite3ExprDup(db, pExpr, 0); - if( db->mallocFailed ){ - sqlite3ExprDelete(db, pDup); - return; - } - idxNew = whereClauseInsert(pWC, pDup, TERM_VIRTUAL|TERM_DYNAMIC); - if( idxNew==0 ) return; - pNew = &pWC->a[idxNew]; - pNew->iParent = idxTerm; - pTerm = &pWC->a[idxTerm]; - pTerm->nChild = 1; - pTerm->wtFlags |= TERM_COPIED; - if( pExpr->op==TK_EQ - && !ExprHasProperty(pExpr, EP_FromJoin) - && OptimizationEnabled(db, SQLITE_Transitive) - ){ - pTerm->eOperator |= WO_EQUIV; - eExtraOp = WO_EQUIV; - } - }else{ - pDup = pExpr; - pNew = pTerm; - } - exprCommute(pParse, pDup); - pLeft = sqlite3ExprSkipCollate(pDup->pLeft); - pNew->leftCursor = pLeft->iTable; - pNew->u.leftColumn = pLeft->iColumn; - testcase( (prereqLeft | extraRight) != prereqLeft ); - pNew->prereqRight = prereqLeft | extraRight; - pNew->prereqAll = prereqAll; - pNew->eOperator = (operatorMask(pDup->op) + eExtraOp) & opMask; - } - } - -#ifndef SQLITE_OMIT_BETWEEN_OPTIMIZATION - /* If a term is the BETWEEN operator, create two new virtual terms - ** that define the range that the BETWEEN implements. For example: - ** - ** a BETWEEN b AND c - ** - ** is converted into: - ** - ** (a BETWEEN b AND c) AND (a>=b) AND (a<=c) - ** - ** The two new terms are added onto the end of the WhereClause object. - ** The new terms are "dynamic" and are children of the original BETWEEN - ** term. That means that if the BETWEEN term is coded, the children are - ** skipped. Or, if the children are satisfied by an index, the original - ** BETWEEN term is skipped. - */ - else if( pExpr->op==TK_BETWEEN && pWC->op==TK_AND ){ - ExprList *pList = pExpr->x.pList; - int i; - static const u8 ops[] = {TK_GE, TK_LE}; - assert( pList!=0 ); - assert( pList->nExpr==2 ); - for(i=0; i<2; i++){ - Expr *pNewExpr; - int idxNew; - pNewExpr = sqlite3PExpr(pParse, ops[i], - sqlite3ExprDup(db, pExpr->pLeft, 0), - sqlite3ExprDup(db, pList->a[i].pExpr, 0), 0); - transferJoinMarkings(pNewExpr, pExpr); - idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); - testcase( idxNew==0 ); - exprAnalyze(pSrc, pWC, idxNew); - pTerm = &pWC->a[idxTerm]; - pWC->a[idxNew].iParent = idxTerm; - } - pTerm->nChild = 2; - } -#endif /* SQLITE_OMIT_BETWEEN_OPTIMIZATION */ - -#if !defined(SQLITE_OMIT_OR_OPTIMIZATION) && !defined(SQLITE_OMIT_SUBQUERY) - /* Analyze a term that is composed of two or more subterms connected by - ** an OR operator. - */ - else if( pExpr->op==TK_OR ){ - assert( pWC->op==TK_AND ); - exprAnalyzeOrTerm(pSrc, pWC, idxTerm); - pTerm = &pWC->a[idxTerm]; - } -#endif /* SQLITE_OMIT_OR_OPTIMIZATION */ - -#ifndef SQLITE_OMIT_LIKE_OPTIMIZATION - /* Add constraints to reduce the search space on a LIKE or GLOB - ** operator. - ** - ** A like pattern of the form "x LIKE 'abc%'" is changed into constraints - ** - ** x>='abc' AND x<'abd' AND x LIKE 'abc%' - ** - ** The last character of the prefix "abc" is incremented to form the - ** termination condition "abd". - */ - if( pWC->op==TK_AND - && isLikeOrGlob(pParse, pExpr, &pStr1, &isComplete, &noCase) - ){ - Expr *pLeft; /* LHS of LIKE/GLOB operator */ - Expr *pStr2; /* Copy of pStr1 - RHS of LIKE/GLOB operator */ - Expr *pNewExpr1; - Expr *pNewExpr2; - int idxNew1; - int idxNew2; - Token sCollSeqName; /* Name of collating sequence */ - - pLeft = pExpr->x.pList->a[1].pExpr; - pStr2 = sqlite3ExprDup(db, pStr1, 0); - if( !db->mallocFailed ){ - u8 c, *pC; /* Last character before the first wildcard */ - pC = (u8*)&pStr2->u.zToken[sqlite3Strlen30(pStr2->u.zToken)-1]; - c = *pC; - if( noCase ){ - /* The point is to increment the last character before the first - ** wildcard. But if we increment '@', that will push it into the - ** alphabetic range where case conversions will mess up the - ** inequality. To avoid this, make sure to also run the full - ** LIKE on all candidate expressions by clearing the isComplete flag - */ - if( c=='A'-1 ) isComplete = 0; - c = sqlite3UpperToLower[c]; - } - *pC = c + 1; - } - sCollSeqName.z = noCase ? "NOCASE" : "BINARY"; - sCollSeqName.n = 6; - pNewExpr1 = sqlite3ExprDup(db, pLeft, 0); - pNewExpr1 = sqlite3PExpr(pParse, TK_GE, - sqlite3ExprAddCollateToken(pParse,pNewExpr1,&sCollSeqName), - pStr1, 0); - transferJoinMarkings(pNewExpr1, pExpr); - idxNew1 = whereClauseInsert(pWC, pNewExpr1, TERM_VIRTUAL|TERM_DYNAMIC); - testcase( idxNew1==0 ); - exprAnalyze(pSrc, pWC, idxNew1); - pNewExpr2 = sqlite3ExprDup(db, pLeft, 0); - pNewExpr2 = sqlite3PExpr(pParse, TK_LT, - sqlite3ExprAddCollateToken(pParse,pNewExpr2,&sCollSeqName), - pStr2, 0); - transferJoinMarkings(pNewExpr2, pExpr); - idxNew2 = whereClauseInsert(pWC, pNewExpr2, TERM_VIRTUAL|TERM_DYNAMIC); - testcase( idxNew2==0 ); - exprAnalyze(pSrc, pWC, idxNew2); - pTerm = &pWC->a[idxTerm]; - if( isComplete ){ - pWC->a[idxNew1].iParent = idxTerm; - pWC->a[idxNew2].iParent = idxTerm; - pTerm->nChild = 2; - } - } -#endif /* SQLITE_OMIT_LIKE_OPTIMIZATION */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE - /* Add a WO_MATCH auxiliary term to the constraint set if the - ** current expression is of the form: column MATCH expr. - ** This information is used by the xBestIndex methods of - ** virtual tables. The native query optimizer does not attempt - ** to do anything with MATCH functions. - */ - if( isMatchOfColumn(pExpr) ){ - int idxNew; - Expr *pRight, *pLeft; - WhereTerm *pNewTerm; - Bitmask prereqColumn, prereqExpr; - - pRight = pExpr->x.pList->a[0].pExpr; - pLeft = pExpr->x.pList->a[1].pExpr; - prereqExpr = exprTableUsage(pMaskSet, pRight); - prereqColumn = exprTableUsage(pMaskSet, pLeft); - if( (prereqExpr & prereqColumn)==0 ){ - Expr *pNewExpr; - pNewExpr = sqlite3PExpr(pParse, TK_MATCH, - 0, sqlite3ExprDup(db, pRight, 0), 0); - idxNew = whereClauseInsert(pWC, pNewExpr, TERM_VIRTUAL|TERM_DYNAMIC); - testcase( idxNew==0 ); - pNewTerm = &pWC->a[idxNew]; - pNewTerm->prereqRight = prereqExpr; - pNewTerm->leftCursor = pLeft->iTable; - pNewTerm->u.leftColumn = pLeft->iColumn; - pNewTerm->eOperator = WO_MATCH; - pNewTerm->iParent = idxTerm; - pTerm = &pWC->a[idxTerm]; - pTerm->nChild = 1; - pTerm->wtFlags |= TERM_COPIED; - pNewTerm->prereqAll = pTerm->prereqAll; - } - } -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - /* When sqlite_stat3 histogram data is available an operator of the - ** form "x IS NOT NULL" can sometimes be evaluated more efficiently - ** as "x>NULL" if x is not an INTEGER PRIMARY KEY. So construct a - ** virtual term of that form. - ** - ** Note that the virtual term must be tagged with TERM_VNULL. This - ** TERM_VNULL tag will suppress the not-null check at the beginning - ** of the loop. Without the TERM_VNULL flag, the not-null check at - ** the start of the loop will prevent any results from being returned. - */ - if( pExpr->op==TK_NOTNULL - && pExpr->pLeft->op==TK_COLUMN - && pExpr->pLeft->iColumn>=0 - && OptimizationEnabled(db, SQLITE_Stat3) - ){ - Expr *pNewExpr; - Expr *pLeft = pExpr->pLeft; - int idxNew; - WhereTerm *pNewTerm; - - pNewExpr = sqlite3PExpr(pParse, TK_GT, - sqlite3ExprDup(db, pLeft, 0), - sqlite3PExpr(pParse, TK_NULL, 0, 0, 0), 0); - - idxNew = whereClauseInsert(pWC, pNewExpr, - TERM_VIRTUAL|TERM_DYNAMIC|TERM_VNULL); - if( idxNew ){ - pNewTerm = &pWC->a[idxNew]; - pNewTerm->prereqRight = 0; - pNewTerm->leftCursor = pLeft->iTable; - pNewTerm->u.leftColumn = pLeft->iColumn; - pNewTerm->eOperator = WO_GT; - pNewTerm->iParent = idxTerm; - pTerm = &pWC->a[idxTerm]; - pTerm->nChild = 1; - pTerm->wtFlags |= TERM_COPIED; - pNewTerm->prereqAll = pTerm->prereqAll; - } - } -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ - - /* Prevent ON clause terms of a LEFT JOIN from being used to drive - ** an index for tables to the left of the join. - */ - pTerm->prereqRight |= extraRight; -} - -/* -** This function searches pList for a entry that matches the iCol-th column -** of index pIdx. -** -** If such an expression is found, its index in pList->a[] is returned. If -** no expression is found, -1 is returned. -*/ -static int findIndexCol( - Parse *pParse, /* Parse context */ - ExprList *pList, /* Expression list to search */ - int iBase, /* Cursor for table associated with pIdx */ - Index *pIdx, /* Index to match column of */ - int iCol /* Column of index to match */ -){ - int i; - const char *zColl = pIdx->azColl[iCol]; - - for(i=0; inExpr; i++){ - Expr *p = sqlite3ExprSkipCollate(pList->a[i].pExpr); - if( p->op==TK_COLUMN - && p->iColumn==pIdx->aiColumn[iCol] - && p->iTable==iBase - ){ - CollSeq *pColl = sqlite3ExprCollSeq(pParse, pList->a[i].pExpr); - if( ALWAYS(pColl) && 0==sqlite3StrICmp(pColl->zName, zColl) ){ - return i; - } - } - } - - return -1; -} - -/* -** Return true if the DISTINCT expression-list passed as the third argument -** is redundant. -** -** A DISTINCT list is redundant if the database contains some subset of -** columns that are unique and non-null. -*/ -static int isDistinctRedundant( - Parse *pParse, /* Parsing context */ - SrcList *pTabList, /* The FROM clause */ - WhereClause *pWC, /* The WHERE clause */ - ExprList *pDistinct /* The result set that needs to be DISTINCT */ -){ - Table *pTab; - Index *pIdx; - int i; - int iBase; - - /* If there is more than one table or sub-select in the FROM clause of - ** this query, then it will not be possible to show that the DISTINCT - ** clause is redundant. */ - if( pTabList->nSrc!=1 ) return 0; - iBase = pTabList->a[0].iCursor; - pTab = pTabList->a[0].pTab; - - /* If any of the expressions is an IPK column on table iBase, then return - ** true. Note: The (p->iTable==iBase) part of this test may be false if the - ** current SELECT is a correlated sub-query. - */ - for(i=0; inExpr; i++){ - Expr *p = sqlite3ExprSkipCollate(pDistinct->a[i].pExpr); - if( p->op==TK_COLUMN && p->iTable==iBase && p->iColumn<0 ) return 1; - } - - /* Loop through all indices on the table, checking each to see if it makes - ** the DISTINCT qualifier redundant. It does so if: - ** - ** 1. The index is itself UNIQUE, and - ** - ** 2. All of the columns in the index are either part of the pDistinct - ** list, or else the WHERE clause contains a term of the form "col=X", - ** where X is a constant value. The collation sequences of the - ** comparison and select-list expressions must match those of the index. - ** - ** 3. All of those index columns for which the WHERE clause does not - ** contain a "col=X" term are subject to a NOT NULL constraint. - */ - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->onError==OE_None ) continue; - for(i=0; inKeyCol; i++){ - i16 iCol = pIdx->aiColumn[i]; - if( 0==findTerm(pWC, iBase, iCol, ~(Bitmask)0, WO_EQ, pIdx) ){ - int iIdxCol = findIndexCol(pParse, pDistinct, iBase, pIdx, i); - if( iIdxCol<0 || pTab->aCol[iCol].notNull==0 ){ - break; - } - } - } - if( i==pIdx->nKeyCol ){ - /* This index implies that the DISTINCT qualifier is redundant. */ - return 1; - } - } - - return 0; -} - - -/* -** Estimate the logarithm of the input value to base 2. -*/ -static LogEst estLog(LogEst N){ - LogEst x = sqlite3LogEst(N); - return x>33 ? x - 33 : 0; -} - -/* -** Two routines for printing the content of an sqlite3_index_info -** structure. Used for testing and debugging only. If neither -** SQLITE_TEST or SQLITE_DEBUG are defined, then these routines -** are no-ops. -*/ -#if !defined(SQLITE_OMIT_VIRTUALTABLE) && defined(WHERETRACE_ENABLED) -static void TRACE_IDX_INPUTS(sqlite3_index_info *p){ - int i; - if( !sqlite3WhereTrace ) return; - for(i=0; inConstraint; i++){ - sqlite3DebugPrintf(" constraint[%d]: col=%d termid=%d op=%d usabled=%d\n", - i, - p->aConstraint[i].iColumn, - p->aConstraint[i].iTermOffset, - p->aConstraint[i].op, - p->aConstraint[i].usable); - } - for(i=0; inOrderBy; i++){ - sqlite3DebugPrintf(" orderby[%d]: col=%d desc=%d\n", - i, - p->aOrderBy[i].iColumn, - p->aOrderBy[i].desc); - } -} -static void TRACE_IDX_OUTPUTS(sqlite3_index_info *p){ - int i; - if( !sqlite3WhereTrace ) return; - for(i=0; inConstraint; i++){ - sqlite3DebugPrintf(" usage[%d]: argvIdx=%d omit=%d\n", - i, - p->aConstraintUsage[i].argvIndex, - p->aConstraintUsage[i].omit); - } - sqlite3DebugPrintf(" idxNum=%d\n", p->idxNum); - sqlite3DebugPrintf(" idxStr=%s\n", p->idxStr); - sqlite3DebugPrintf(" orderByConsumed=%d\n", p->orderByConsumed); - sqlite3DebugPrintf(" estimatedCost=%g\n", p->estimatedCost); - sqlite3DebugPrintf(" estimatedRows=%lld\n", p->estimatedRows); -} -#else -#define TRACE_IDX_INPUTS(A) -#define TRACE_IDX_OUTPUTS(A) -#endif - -#ifndef SQLITE_OMIT_AUTOMATIC_INDEX -/* -** Return TRUE if the WHERE clause term pTerm is of a form where it -** could be used with an index to access pSrc, assuming an appropriate -** index existed. -*/ -static int termCanDriveIndex( - WhereTerm *pTerm, /* WHERE clause term to check */ - struct SrcList_item *pSrc, /* Table we are trying to access */ - Bitmask notReady /* Tables in outer loops of the join */ -){ - char aff; - if( pTerm->leftCursor!=pSrc->iCursor ) return 0; - if( (pTerm->eOperator & WO_EQ)==0 ) return 0; - if( (pTerm->prereqRight & notReady)!=0 ) return 0; - if( pTerm->u.leftColumn<0 ) return 0; - aff = pSrc->pTab->aCol[pTerm->u.leftColumn].affinity; - if( !sqlite3IndexAffinityOk(pTerm->pExpr, aff) ) return 0; - return 1; -} -#endif - - -#ifndef SQLITE_OMIT_AUTOMATIC_INDEX -/* -** Generate code to construct the Index object for an automatic index -** and to set up the WhereLevel object pLevel so that the code generator -** makes use of the automatic index. -*/ -static void constructAutomaticIndex( - Parse *pParse, /* The parsing context */ - WhereClause *pWC, /* The WHERE clause */ - struct SrcList_item *pSrc, /* The FROM clause term to get the next index */ - Bitmask notReady, /* Mask of cursors that are not available */ - WhereLevel *pLevel /* Write new index here */ -){ - int nKeyCol; /* Number of columns in the constructed index */ - WhereTerm *pTerm; /* A single term of the WHERE clause */ - WhereTerm *pWCEnd; /* End of pWC->a[] */ - Index *pIdx; /* Object describing the transient index */ - Vdbe *v; /* Prepared statement under construction */ - int addrInit; /* Address of the initialization bypass jump */ - Table *pTable; /* The table being indexed */ - int addrTop; /* Top of the index fill loop */ - int regRecord; /* Register holding an index record */ - int n; /* Column counter */ - int i; /* Loop counter */ - int mxBitCol; /* Maximum column in pSrc->colUsed */ - CollSeq *pColl; /* Collating sequence to on a column */ - WhereLoop *pLoop; /* The Loop object */ - char *zNotUsed; /* Extra space on the end of pIdx */ - Bitmask idxCols; /* Bitmap of columns used for indexing */ - Bitmask extraCols; /* Bitmap of additional columns */ - u8 sentWarning = 0; /* True if a warnning has been issued */ - - /* Generate code to skip over the creation and initialization of the - ** transient index on 2nd and subsequent iterations of the loop. */ - v = pParse->pVdbe; - assert( v!=0 ); - addrInit = sqlite3CodeOnce(pParse); - - /* Count the number of columns that will be added to the index - ** and used to match WHERE clause constraints */ - nKeyCol = 0; - pTable = pSrc->pTab; - pWCEnd = &pWC->a[pWC->nTerm]; - pLoop = pLevel->pWLoop; - idxCols = 0; - for(pTerm=pWC->a; pTermu.leftColumn; - Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); - testcase( iCol==BMS ); - testcase( iCol==BMS-1 ); - if( !sentWarning ){ - sqlite3_log(SQLITE_WARNING_AUTOINDEX, - "automatic index on %s(%s)", pTable->zName, - pTable->aCol[iCol].zName); - sentWarning = 1; - } - if( (idxCols & cMask)==0 ){ - if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ) return; - pLoop->aLTerm[nKeyCol++] = pTerm; - idxCols |= cMask; - } - } - } - assert( nKeyCol>0 ); - pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol; - pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED - | WHERE_AUTO_INDEX; - - /* Count the number of additional columns needed to create a - ** covering index. A "covering index" is an index that contains all - ** columns that are needed by the query. With a covering index, the - ** original table never needs to be accessed. Automatic indices must - ** be a covering index because the index will not be updated if the - ** original table changes and the index and table cannot both be used - ** if they go out of sync. - */ - extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1)); - mxBitCol = (pTable->nCol >= BMS-1) ? BMS-1 : pTable->nCol; - testcase( pTable->nCol==BMS-1 ); - testcase( pTable->nCol==BMS-2 ); - for(i=0; icolUsed & MASKBIT(BMS-1) ){ - nKeyCol += pTable->nCol - BMS + 1; - } - pLoop->wsFlags |= WHERE_COLUMN_EQ | WHERE_IDX_ONLY; - - /* Construct the Index object to describe this index */ - pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed); - if( pIdx==0 ) return; - pLoop->u.btree.pIndex = pIdx; - pIdx->zName = "auto-index"; - pIdx->pTable = pTable; - n = 0; - idxCols = 0; - for(pTerm=pWC->a; pTermu.leftColumn; - Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol); - testcase( iCol==BMS-1 ); - testcase( iCol==BMS ); - if( (idxCols & cMask)==0 ){ - Expr *pX = pTerm->pExpr; - idxCols |= cMask; - pIdx->aiColumn[n] = pTerm->u.leftColumn; - pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight); - pIdx->azColl[n] = ALWAYS(pColl) ? pColl->zName : "BINARY"; - n++; - } - } - } - assert( (u32)n==pLoop->u.btree.nEq ); - - /* Add additional columns needed to make the automatic index into - ** a covering index */ - for(i=0; iaiColumn[n] = i; - pIdx->azColl[n] = "BINARY"; - n++; - } - } - if( pSrc->colUsed & MASKBIT(BMS-1) ){ - for(i=BMS-1; inCol; i++){ - pIdx->aiColumn[n] = i; - pIdx->azColl[n] = "BINARY"; - n++; - } - } - assert( n==nKeyCol ); - pIdx->aiColumn[n] = -1; - pIdx->azColl[n] = "BINARY"; - - /* Create the automatic index */ - assert( pLevel->iIdxCur>=0 ); - pLevel->iIdxCur = pParse->nTab++; - sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1); - sqlite3VdbeSetP4KeyInfo(pParse, pIdx); - VdbeComment((v, "for %s", pTable->zName)); - - /* Fill the automatic index with content */ - addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); - regRecord = sqlite3GetTempReg(pParse); - sqlite3GenerateIndexKey(pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0); - sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord); - sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT); - sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); - sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX); - sqlite3VdbeJumpHere(v, addrTop); - sqlite3ReleaseTempReg(pParse, regRecord); - - /* Jump here when skipping the initialization */ - sqlite3VdbeJumpHere(v, addrInit); -} -#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */ - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* -** Allocate and populate an sqlite3_index_info structure. It is the -** responsibility of the caller to eventually release the structure -** by passing the pointer returned by this function to sqlite3_free(). -*/ -static sqlite3_index_info *allocateIndexInfo( - Parse *pParse, - WhereClause *pWC, - struct SrcList_item *pSrc, - ExprList *pOrderBy -){ - int i, j; - int nTerm; - struct sqlite3_index_constraint *pIdxCons; - struct sqlite3_index_orderby *pIdxOrderBy; - struct sqlite3_index_constraint_usage *pUsage; - WhereTerm *pTerm; - int nOrderBy; - sqlite3_index_info *pIdxInfo; - - /* Count the number of possible WHERE clause constraints referring - ** to this virtual table */ - for(i=nTerm=0, pTerm=pWC->a; inTerm; i++, pTerm++){ - if( pTerm->leftCursor != pSrc->iCursor ) continue; - assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); - testcase( pTerm->eOperator & WO_IN ); - testcase( pTerm->eOperator & WO_ISNULL ); - testcase( pTerm->eOperator & WO_ALL ); - if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV))==0 ) continue; - if( pTerm->wtFlags & TERM_VNULL ) continue; - nTerm++; - } - - /* If the ORDER BY clause contains only columns in the current - ** virtual table then allocate space for the aOrderBy part of - ** the sqlite3_index_info structure. - */ - nOrderBy = 0; - if( pOrderBy ){ - int n = pOrderBy->nExpr; - for(i=0; ia[i].pExpr; - if( pExpr->op!=TK_COLUMN || pExpr->iTable!=pSrc->iCursor ) break; - } - if( i==n){ - nOrderBy = n; - } - } - - /* Allocate the sqlite3_index_info structure - */ - pIdxInfo = sqlite3DbMallocZero(pParse->db, sizeof(*pIdxInfo) - + (sizeof(*pIdxCons) + sizeof(*pUsage))*nTerm - + sizeof(*pIdxOrderBy)*nOrderBy ); - if( pIdxInfo==0 ){ - sqlite3ErrorMsg(pParse, "out of memory"); - return 0; - } - - /* Initialize the structure. The sqlite3_index_info structure contains - ** many fields that are declared "const" to prevent xBestIndex from - ** changing them. We have to do some funky casting in order to - ** initialize those fields. - */ - pIdxCons = (struct sqlite3_index_constraint*)&pIdxInfo[1]; - pIdxOrderBy = (struct sqlite3_index_orderby*)&pIdxCons[nTerm]; - pUsage = (struct sqlite3_index_constraint_usage*)&pIdxOrderBy[nOrderBy]; - *(int*)&pIdxInfo->nConstraint = nTerm; - *(int*)&pIdxInfo->nOrderBy = nOrderBy; - *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint = pIdxCons; - *(struct sqlite3_index_orderby**)&pIdxInfo->aOrderBy = pIdxOrderBy; - *(struct sqlite3_index_constraint_usage**)&pIdxInfo->aConstraintUsage = - pUsage; - - for(i=j=0, pTerm=pWC->a; inTerm; i++, pTerm++){ - u8 op; - if( pTerm->leftCursor != pSrc->iCursor ) continue; - assert( IsPowerOfTwo(pTerm->eOperator & ~WO_EQUIV) ); - testcase( pTerm->eOperator & WO_IN ); - testcase( pTerm->eOperator & WO_ISNULL ); - testcase( pTerm->eOperator & WO_ALL ); - if( (pTerm->eOperator & ~(WO_ISNULL|WO_EQUIV))==0 ) continue; - if( pTerm->wtFlags & TERM_VNULL ) continue; - pIdxCons[j].iColumn = pTerm->u.leftColumn; - pIdxCons[j].iTermOffset = i; - op = (u8)pTerm->eOperator & WO_ALL; - if( op==WO_IN ) op = WO_EQ; - pIdxCons[j].op = op; - /* The direct assignment in the previous line is possible only because - ** the WO_ and SQLITE_INDEX_CONSTRAINT_ codes are identical. The - ** following asserts verify this fact. */ - assert( WO_EQ==SQLITE_INDEX_CONSTRAINT_EQ ); - assert( WO_LT==SQLITE_INDEX_CONSTRAINT_LT ); - assert( WO_LE==SQLITE_INDEX_CONSTRAINT_LE ); - assert( WO_GT==SQLITE_INDEX_CONSTRAINT_GT ); - assert( WO_GE==SQLITE_INDEX_CONSTRAINT_GE ); - assert( WO_MATCH==SQLITE_INDEX_CONSTRAINT_MATCH ); - assert( pTerm->eOperator & (WO_IN|WO_EQ|WO_LT|WO_LE|WO_GT|WO_GE|WO_MATCH) ); - j++; - } - for(i=0; ia[i].pExpr; - pIdxOrderBy[i].iColumn = pExpr->iColumn; - pIdxOrderBy[i].desc = pOrderBy->a[i].sortOrder; - } - - return pIdxInfo; -} - -/* -** The table object reference passed as the second argument to this function -** must represent a virtual table. This function invokes the xBestIndex() -** method of the virtual table with the sqlite3_index_info object that -** comes in as the 3rd argument to this function. -** -** If an error occurs, pParse is populated with an error message and a -** non-zero value is returned. Otherwise, 0 is returned and the output -** part of the sqlite3_index_info structure is left populated. -** -** Whether or not an error is returned, it is the responsibility of the -** caller to eventually free p->idxStr if p->needToFreeIdxStr indicates -** that this is required. -*/ -static int vtabBestIndex(Parse *pParse, Table *pTab, sqlite3_index_info *p){ - sqlite3_vtab *pVtab = sqlite3GetVTable(pParse->db, pTab)->pVtab; - int i; - int rc; - - TRACE_IDX_INPUTS(p); - rc = pVtab->pModule->xBestIndex(pVtab, p); - TRACE_IDX_OUTPUTS(p); - - if( rc!=SQLITE_OK ){ - if( rc==SQLITE_NOMEM ){ - pParse->db->mallocFailed = 1; - }else if( !pVtab->zErrMsg ){ - sqlite3ErrorMsg(pParse, "%s", sqlite3ErrStr(rc)); - }else{ - sqlite3ErrorMsg(pParse, "%s", pVtab->zErrMsg); - } - } - sqlite3_free(pVtab->zErrMsg); - pVtab->zErrMsg = 0; - - for(i=0; inConstraint; i++){ - if( !p->aConstraint[i].usable && p->aConstraintUsage[i].argvIndex>0 ){ - sqlite3ErrorMsg(pParse, - "table %s: xBestIndex returned an invalid plan", pTab->zName); - } - } - - return pParse->nErr; -} -#endif /* !defined(SQLITE_OMIT_VIRTUALTABLE) */ - - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -/* -** Estimate the location of a particular key among all keys in an -** index. Store the results in aStat as follows: -** -** aStat[0] Est. number of rows less than pVal -** aStat[1] Est. number of rows equal to pVal -** -** Return SQLITE_OK on success. -*/ -static void whereKeyStats( - Parse *pParse, /* Database connection */ - Index *pIdx, /* Index to consider domain of */ - UnpackedRecord *pRec, /* Vector of values to consider */ - int roundUp, /* Round up if true. Round down if false */ - tRowcnt *aStat /* OUT: stats written here */ -){ - IndexSample *aSample = pIdx->aSample; - int iCol; /* Index of required stats in anEq[] etc. */ - int iMin = 0; /* Smallest sample not yet tested */ - int i = pIdx->nSample; /* Smallest sample larger than or equal to pRec */ - int iTest; /* Next sample to test */ - int res; /* Result of comparison operation */ - -#ifndef SQLITE_DEBUG - UNUSED_PARAMETER( pParse ); -#endif - assert( pRec!=0 ); - iCol = pRec->nField - 1; - assert( pIdx->nSample>0 ); - assert( pRec->nField>0 && iColnSampleCol ); - do{ - iTest = (iMin+i)/2; - res = sqlite3VdbeRecordCompare(aSample[iTest].n, aSample[iTest].p, pRec); - if( res<0 ){ - iMin = iTest+1; - }else{ - i = iTest; - } - }while( res && iMinnSample ); - assert( 0==sqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec) - || pParse->db->mallocFailed ); - }else{ - /* Otherwise, pRec must be smaller than sample $i and larger than - ** sample ($i-1). */ - assert( i==pIdx->nSample - || sqlite3VdbeRecordCompare(aSample[i].n, aSample[i].p, pRec)>0 - || pParse->db->mallocFailed ); - assert( i==0 - || sqlite3VdbeRecordCompare(aSample[i-1].n, aSample[i-1].p, pRec)<0 - || pParse->db->mallocFailed ); - } -#endif /* ifdef SQLITE_DEBUG */ - - /* At this point, aSample[i] is the first sample that is greater than - ** or equal to pVal. Or if i==pIdx->nSample, then all samples are less - ** than pVal. If aSample[i]==pVal, then res==0. - */ - if( res==0 ){ - aStat[0] = aSample[i].anLt[iCol]; - aStat[1] = aSample[i].anEq[iCol]; - }else{ - tRowcnt iLower, iUpper, iGap; - if( i==0 ){ - iLower = 0; - iUpper = aSample[0].anLt[iCol]; - }else{ - iUpper = i>=pIdx->nSample ? pIdx->aiRowEst[0] : aSample[i].anLt[iCol]; - iLower = aSample[i-1].anEq[iCol] + aSample[i-1].anLt[iCol]; - } - aStat[1] = (pIdx->nKeyCol>iCol ? pIdx->aAvgEq[iCol] : 1); - if( iLower>=iUpper ){ - iGap = 0; - }else{ - iGap = iUpper - iLower; - } - if( roundUp ){ - iGap = (iGap*2)/3; - }else{ - iGap = iGap/3; - } - aStat[0] = iLower + iGap; - } -} -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ - -/* -** This function is used to estimate the number of rows that will be visited -** by scanning an index for a range of values. The range may have an upper -** bound, a lower bound, or both. The WHERE clause terms that set the upper -** and lower bounds are represented by pLower and pUpper respectively. For -** example, assuming that index p is on t1(a): -** -** ... FROM t1 WHERE a > ? AND a < ? ... -** |_____| |_____| -** | | -** pLower pUpper -** -** If either of the upper or lower bound is not present, then NULL is passed in -** place of the corresponding WhereTerm. -** -** The value in (pBuilder->pNew->u.btree.nEq) is the index of the index -** column subject to the range constraint. Or, equivalently, the number of -** equality constraints optimized by the proposed index scan. For example, -** assuming index p is on t1(a, b), and the SQL query is: -** -** ... FROM t1 WHERE a = ? AND b > ? AND b < ? ... -** -** then nEq is set to 1 (as the range restricted column, b, is the second -** left-most column of the index). Or, if the query is: -** -** ... FROM t1 WHERE a > ? AND a < ? ... -** -** then nEq is set to 0. -** -** When this function is called, *pnOut is set to the sqlite3LogEst() of the -** number of rows that the index scan is expected to visit without -** considering the range constraints. If nEq is 0, this is the number of -** rows in the index. Assuming no error occurs, *pnOut is adjusted (reduced) -** to account for the range contraints pLower and pUpper. -** -** In the absence of sqlite_stat4 ANALYZE data, or if such data cannot be -** used, each range inequality reduces the search space by a factor of 4. -** Hence a pair of constraints (x>? AND x123" Might be NULL */ - WhereTerm *pUpper, /* Upper bound on the range. ex: "x<455" Might be NULL */ - WhereLoop *pLoop /* Modify the .nOut and maybe .rRun fields */ -){ - int rc = SQLITE_OK; - int nOut = pLoop->nOut; - LogEst nNew; - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - Index *p = pLoop->u.btree.pIndex; - int nEq = pLoop->u.btree.nEq; - - if( p->nSample>0 - && nEq==pBuilder->nRecValid - && nEqnSampleCol - && OptimizationEnabled(pParse->db, SQLITE_Stat3) - ){ - UnpackedRecord *pRec = pBuilder->pRec; - tRowcnt a[2]; - u8 aff; - - /* Variable iLower will be set to the estimate of the number of rows in - ** the index that are less than the lower bound of the range query. The - ** lower bound being the concatenation of $P and $L, where $P is the - ** key-prefix formed by the nEq values matched against the nEq left-most - ** columns of the index, and $L is the value in pLower. - ** - ** Or, if pLower is NULL or $L cannot be extracted from it (because it - ** is not a simple variable or literal value), the lower bound of the - ** range is $P. Due to a quirk in the way whereKeyStats() works, even - ** if $L is available, whereKeyStats() is called for both ($P) and - ** ($P:$L) and the larger of the two returned values used. - ** - ** Similarly, iUpper is to be set to the estimate of the number of rows - ** less than the upper bound of the range query. Where the upper bound - ** is either ($P) or ($P:$U). Again, even if $U is available, both values - ** of iUpper are requested of whereKeyStats() and the smaller used. - */ - tRowcnt iLower; - tRowcnt iUpper; - - if( nEq==p->nKeyCol ){ - aff = SQLITE_AFF_INTEGER; - }else{ - aff = p->pTable->aCol[p->aiColumn[nEq]].affinity; - } - /* Determine iLower and iUpper using ($P) only. */ - if( nEq==0 ){ - iLower = 0; - iUpper = p->aiRowEst[0]; - }else{ - /* Note: this call could be optimized away - since the same values must - ** have been requested when testing key $P in whereEqualScanEst(). */ - whereKeyStats(pParse, p, pRec, 0, a); - iLower = a[0]; - iUpper = a[0] + a[1]; - } - - /* If possible, improve on the iLower estimate using ($P:$L). */ - if( pLower ){ - int bOk; /* True if value is extracted from pExpr */ - Expr *pExpr = pLower->pExpr->pRight; - assert( (pLower->eOperator & (WO_GT|WO_GE))!=0 ); - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk); - if( rc==SQLITE_OK && bOk ){ - tRowcnt iNew; - whereKeyStats(pParse, p, pRec, 0, a); - iNew = a[0] + ((pLower->eOperator & WO_GT) ? a[1] : 0); - if( iNew>iLower ) iLower = iNew; - nOut--; - } - } - - /* If possible, improve on the iUpper estimate using ($P:$U). */ - if( pUpper ){ - int bOk; /* True if value is extracted from pExpr */ - Expr *pExpr = pUpper->pExpr->pRight; - assert( (pUpper->eOperator & (WO_LT|WO_LE))!=0 ); - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq, &bOk); - if( rc==SQLITE_OK && bOk ){ - tRowcnt iNew; - whereKeyStats(pParse, p, pRec, 1, a); - iNew = a[0] + ((pUpper->eOperator & WO_LE) ? a[1] : 0); - if( iNewpRec = pRec; - if( rc==SQLITE_OK ){ - if( iUpper>iLower ){ - nNew = sqlite3LogEst(iUpper - iLower); - }else{ - nNew = 10; assert( 10==sqlite3LogEst(2) ); - } - if( nNewnOut = (LogEst)nOut; - WHERETRACE(0x10, ("range scan regions: %u..%u est=%d\n", - (u32)iLower, (u32)iUpper, nOut)); - return SQLITE_OK; - } - } -#else - UNUSED_PARAMETER(pParse); - UNUSED_PARAMETER(pBuilder); -#endif - assert( pLower || pUpper ); - /* TUNING: Each inequality constraint reduces the search space 4-fold. - ** A BETWEEN operator, therefore, reduces the search space 16-fold */ - nNew = nOut; - if( pLower && (pLower->wtFlags & TERM_VNULL)==0 ){ - nNew -= 20; assert( 20==sqlite3LogEst(4) ); - nOut--; - } - if( pUpper ){ - nNew -= 20; assert( 20==sqlite3LogEst(4) ); - nOut--; - } - if( nNew<10 ) nNew = 10; - if( nNewnOut = (LogEst)nOut; - return rc; -} - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -/* -** Estimate the number of rows that will be returned based on -** an equality constraint x=VALUE and where that VALUE occurs in -** the histogram data. This only works when x is the left-most -** column of an index and sqlite_stat3 histogram data is available -** for that index. When pExpr==NULL that means the constraint is -** "x IS NULL" instead of "x=VALUE". -** -** Write the estimated row count into *pnRow and return SQLITE_OK. -** If unable to make an estimate, leave *pnRow unchanged and return -** non-zero. -** -** This routine can fail if it is unable to load a collating sequence -** required for string comparison, or if unable to allocate memory -** for a UTF conversion required for comparison. The error is stored -** in the pParse structure. -*/ -static int whereEqualScanEst( - Parse *pParse, /* Parsing & code generating context */ - WhereLoopBuilder *pBuilder, - Expr *pExpr, /* Expression for VALUE in the x=VALUE constraint */ - tRowcnt *pnRow /* Write the revised row estimate here */ -){ - Index *p = pBuilder->pNew->u.btree.pIndex; - int nEq = pBuilder->pNew->u.btree.nEq; - UnpackedRecord *pRec = pBuilder->pRec; - u8 aff; /* Column affinity */ - int rc; /* Subfunction return code */ - tRowcnt a[2]; /* Statistics */ - int bOk; - - assert( nEq>=1 ); - assert( nEq<=(p->nKeyCol+1) ); - assert( p->aSample!=0 ); - assert( p->nSample>0 ); - assert( pBuilder->nRecValidnRecValid<(nEq-1) ){ - return SQLITE_NOTFOUND; - } - - /* This is an optimization only. The call to sqlite3Stat4ProbeSetValue() - ** below would return the same value. */ - if( nEq>p->nKeyCol ){ - *pnRow = 1; - return SQLITE_OK; - } - - aff = p->pTable->aCol[p->aiColumn[nEq-1]].affinity; - rc = sqlite3Stat4ProbeSetValue(pParse, p, &pRec, pExpr, aff, nEq-1, &bOk); - pBuilder->pRec = pRec; - if( rc!=SQLITE_OK ) return rc; - if( bOk==0 ) return SQLITE_NOTFOUND; - pBuilder->nRecValid = nEq; - - whereKeyStats(pParse, p, pRec, 0, a); - WHERETRACE(0x10,("equality scan regions: %d\n", (int)a[1])); - *pnRow = a[1]; - - return rc; -} -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ - -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 -/* -** Estimate the number of rows that will be returned based on -** an IN constraint where the right-hand side of the IN operator -** is a list of values. Example: -** -** WHERE x IN (1,2,3,4) -** -** Write the estimated row count into *pnRow and return SQLITE_OK. -** If unable to make an estimate, leave *pnRow unchanged and return -** non-zero. -** -** This routine can fail if it is unable to load a collating sequence -** required for string comparison, or if unable to allocate memory -** for a UTF conversion required for comparison. The error is stored -** in the pParse structure. -*/ -static int whereInScanEst( - Parse *pParse, /* Parsing & code generating context */ - WhereLoopBuilder *pBuilder, - ExprList *pList, /* The value list on the RHS of "x IN (v1,v2,v3,...)" */ - tRowcnt *pnRow /* Write the revised row estimate here */ -){ - Index *p = pBuilder->pNew->u.btree.pIndex; - int nRecValid = pBuilder->nRecValid; - int rc = SQLITE_OK; /* Subfunction return code */ - tRowcnt nEst; /* Number of rows for a single term */ - tRowcnt nRowEst = 0; /* New estimate of the number of rows */ - int i; /* Loop counter */ - - assert( p->aSample!=0 ); - for(i=0; rc==SQLITE_OK && inExpr; i++){ - nEst = p->aiRowEst[0]; - rc = whereEqualScanEst(pParse, pBuilder, pList->a[i].pExpr, &nEst); - nRowEst += nEst; - pBuilder->nRecValid = nRecValid; - } - - if( rc==SQLITE_OK ){ - if( nRowEst > p->aiRowEst[0] ) nRowEst = p->aiRowEst[0]; - *pnRow = nRowEst; - WHERETRACE(0x10,("IN row estimate: est=%g\n", nRowEst)); - } - assert( pBuilder->nRecValid==nRecValid ); - return rc; -} -#endif /* SQLITE_ENABLE_STAT3_OR_STAT4 */ - -/* -** Disable a term in the WHERE clause. Except, do not disable the term -** if it controls a LEFT OUTER JOIN and it did not originate in the ON -** or USING clause of that join. -** -** Consider the term t2.z='ok' in the following queries: -** -** (1) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x WHERE t2.z='ok' -** (2) SELECT * FROM t1 LEFT JOIN t2 ON t1.a=t2.x AND t2.z='ok' -** (3) SELECT * FROM t1, t2 WHERE t1.a=t2.x AND t2.z='ok' -** -** The t2.z='ok' is disabled in the in (2) because it originates -** in the ON clause. The term is disabled in (3) because it is not part -** of a LEFT OUTER JOIN. In (1), the term is not disabled. -** -** Disabling a term causes that term to not be tested in the inner loop -** of the join. Disabling is an optimization. When terms are satisfied -** by indices, we disable them to prevent redundant tests in the inner -** loop. We would get the correct results if nothing were ever disabled, -** but joins might run a little slower. The trick is to disable as much -** as we can without disabling too much. If we disabled in (1), we'd get -** the wrong answer. See ticket #813. -*/ -static void disableTerm(WhereLevel *pLevel, WhereTerm *pTerm){ - if( pTerm - && (pTerm->wtFlags & TERM_CODED)==0 - && (pLevel->iLeftJoin==0 || ExprHasProperty(pTerm->pExpr, EP_FromJoin)) - && (pLevel->notReady & pTerm->prereqAll)==0 - ){ - pTerm->wtFlags |= TERM_CODED; - if( pTerm->iParent>=0 ){ - WhereTerm *pOther = &pTerm->pWC->a[pTerm->iParent]; - if( (--pOther->nChild)==0 ){ - disableTerm(pLevel, pOther); - } - } - } -} - -/* -** Code an OP_Affinity opcode to apply the column affinity string zAff -** to the n registers starting at base. -** -** As an optimization, SQLITE_AFF_NONE entries (which are no-ops) at the -** beginning and end of zAff are ignored. If all entries in zAff are -** SQLITE_AFF_NONE, then no code gets generated. -** -** This routine makes its own copy of zAff so that the caller is free -** to modify zAff after this routine returns. -*/ -static void codeApplyAffinity(Parse *pParse, int base, int n, char *zAff){ - Vdbe *v = pParse->pVdbe; - if( zAff==0 ){ - assert( pParse->db->mallocFailed ); - return; - } - assert( v!=0 ); - - /* Adjust base and n to skip over SQLITE_AFF_NONE entries at the beginning - ** and end of the affinity string. - */ - while( n>0 && zAff[0]==SQLITE_AFF_NONE ){ - n--; - base++; - zAff++; - } - while( n>1 && zAff[n-1]==SQLITE_AFF_NONE ){ - n--; - } - - /* Code the OP_Affinity opcode if there is anything left to do. */ - if( n>0 ){ - sqlite3VdbeAddOp2(v, OP_Affinity, base, n); - sqlite3VdbeChangeP4(v, -1, zAff, n); - sqlite3ExprCacheAffinityChange(pParse, base, n); - } -} - - -/* -** Generate code for a single equality term of the WHERE clause. An equality -** term can be either X=expr or X IN (...). pTerm is the term to be -** coded. -** -** The current value for the constraint is left in register iReg. -** -** For a constraint of the form X=expr, the expression is evaluated and its -** result is left on the stack. For constraints of the form X IN (...) -** this routine sets up a loop that will iterate over all values of X. -*/ -static int codeEqualityTerm( - Parse *pParse, /* The parsing context */ - WhereTerm *pTerm, /* The term of the WHERE clause to be coded */ - WhereLevel *pLevel, /* The level of the FROM clause we are working on */ - int iEq, /* Index of the equality term within this level */ - int bRev, /* True for reverse-order IN operations */ - int iTarget /* Attempt to leave results in this register */ -){ - Expr *pX = pTerm->pExpr; - Vdbe *v = pParse->pVdbe; - int iReg; /* Register holding results */ - - assert( iTarget>0 ); - if( pX->op==TK_EQ ){ - iReg = sqlite3ExprCodeTarget(pParse, pX->pRight, iTarget); - }else if( pX->op==TK_ISNULL ){ - iReg = iTarget; - sqlite3VdbeAddOp2(v, OP_Null, 0, iReg); -#ifndef SQLITE_OMIT_SUBQUERY - }else{ - int eType; - int iTab; - struct InLoop *pIn; - WhereLoop *pLoop = pLevel->pWLoop; - - if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 - && pLoop->u.btree.pIndex!=0 - && pLoop->u.btree.pIndex->aSortOrder[iEq] - ){ - testcase( iEq==0 ); - testcase( bRev ); - bRev = !bRev; - } - assert( pX->op==TK_IN ); - iReg = iTarget; - eType = sqlite3FindInIndex(pParse, pX, 0); - if( eType==IN_INDEX_INDEX_DESC ){ - testcase( bRev ); - bRev = !bRev; - } - iTab = pX->iTable; - sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iTab, 0); - assert( (pLoop->wsFlags & WHERE_MULTI_OR)==0 ); - pLoop->wsFlags |= WHERE_IN_ABLE; - if( pLevel->u.in.nIn==0 ){ - pLevel->addrNxt = sqlite3VdbeMakeLabel(v); - } - pLevel->u.in.nIn++; - pLevel->u.in.aInLoop = - sqlite3DbReallocOrFree(pParse->db, pLevel->u.in.aInLoop, - sizeof(pLevel->u.in.aInLoop[0])*pLevel->u.in.nIn); - pIn = pLevel->u.in.aInLoop; - if( pIn ){ - pIn += pLevel->u.in.nIn - 1; - pIn->iCur = iTab; - if( eType==IN_INDEX_ROWID ){ - pIn->addrInTop = sqlite3VdbeAddOp2(v, OP_Rowid, iTab, iReg); - }else{ - pIn->addrInTop = sqlite3VdbeAddOp3(v, OP_Column, iTab, 0, iReg); - } - pIn->eEndLoopOp = bRev ? OP_PrevIfOpen : OP_NextIfOpen; - sqlite3VdbeAddOp1(v, OP_IsNull, iReg); - }else{ - pLevel->u.in.nIn = 0; - } -#endif - } - disableTerm(pLevel, pTerm); - return iReg; -} - -/* -** Generate code that will evaluate all == and IN constraints for an -** index scan. -** -** For example, consider table t1(a,b,c,d,e,f) with index i1(a,b,c). -** Suppose the WHERE clause is this: a==5 AND b IN (1,2,3) AND c>5 AND c<10 -** The index has as many as three equality constraints, but in this -** example, the third "c" value is an inequality. So only two -** constraints are coded. This routine will generate code to evaluate -** a==5 and b IN (1,2,3). The current values for a and b will be stored -** in consecutive registers and the index of the first register is returned. -** -** In the example above nEq==2. But this subroutine works for any value -** of nEq including 0. If nEq==0, this routine is nearly a no-op. -** The only thing it does is allocate the pLevel->iMem memory cell and -** compute the affinity string. -** -** The nExtraReg parameter is 0 or 1. It is 0 if all WHERE clause constraints -** are == or IN and are covered by the nEq. nExtraReg is 1 if there is -** an inequality constraint (such as the "c>=5 AND c<10" in the example) that -** occurs after the nEq quality constraints. -** -** This routine allocates a range of nEq+nExtraReg memory cells and returns -** the index of the first memory cell in that range. The code that -** calls this routine will use that memory range to store keys for -** start and termination conditions of the loop. -** key value of the loop. If one or more IN operators appear, then -** this routine allocates an additional nEq memory cells for internal -** use. -** -** Before returning, *pzAff is set to point to a buffer containing a -** copy of the column affinity string of the index allocated using -** sqlite3DbMalloc(). Except, entries in the copy of the string associated -** with equality constraints that use NONE affinity are set to -** SQLITE_AFF_NONE. This is to deal with SQL such as the following: -** -** CREATE TABLE t1(a TEXT PRIMARY KEY, b); -** SELECT ... FROM t1 AS t2, t1 WHERE t1.a = t2.b; -** -** In the example above, the index on t1(a) has TEXT affinity. But since -** the right hand side of the equality constraint (t2.b) has NONE affinity, -** no conversion should be attempted before using a t2.b value as part of -** a key to search the index. Hence the first byte in the returned affinity -** string in this example would be set to SQLITE_AFF_NONE. -*/ -static int codeAllEqualityTerms( - Parse *pParse, /* Parsing context */ - WhereLevel *pLevel, /* Which nested loop of the FROM we are coding */ - int bRev, /* Reverse the order of IN operators */ - int nExtraReg, /* Number of extra registers to allocate */ - char **pzAff /* OUT: Set to point to affinity string */ -){ - u16 nEq; /* The number of == or IN constraints to code */ - u16 nSkip; /* Number of left-most columns to skip */ - Vdbe *v = pParse->pVdbe; /* The vm under construction */ - Index *pIdx; /* The index being used for this loop */ - WhereTerm *pTerm; /* A single constraint term */ - WhereLoop *pLoop; /* The WhereLoop object */ - int j; /* Loop counter */ - int regBase; /* Base register */ - int nReg; /* Number of registers to allocate */ - char *zAff; /* Affinity string to return */ - - /* This module is only called on query plans that use an index. */ - pLoop = pLevel->pWLoop; - assert( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ); - nEq = pLoop->u.btree.nEq; - nSkip = pLoop->u.btree.nSkip; - pIdx = pLoop->u.btree.pIndex; - assert( pIdx!=0 ); - - /* Figure out how many memory cells we will need then allocate them. - */ - regBase = pParse->nMem + 1; - nReg = pLoop->u.btree.nEq + nExtraReg; - pParse->nMem += nReg; - - zAff = sqlite3DbStrDup(pParse->db, sqlite3IndexAffinityStr(v, pIdx)); - if( !zAff ){ - pParse->db->mallocFailed = 1; - } - - if( nSkip ){ - int iIdxCur = pLevel->iIdxCur; - sqlite3VdbeAddOp1(v, (bRev?OP_Last:OP_Rewind), iIdxCur); - VdbeComment((v, "begin skip-scan on %s", pIdx->zName)); - j = sqlite3VdbeAddOp0(v, OP_Goto); - pLevel->addrSkip = sqlite3VdbeAddOp4Int(v, (bRev?OP_SeekLt:OP_SeekGt), - iIdxCur, 0, regBase, nSkip); - sqlite3VdbeJumpHere(v, j); - for(j=0; jaiColumn[j]>=0 ); - VdbeComment((v, "%s", pIdx->pTable->aCol[pIdx->aiColumn[j]].zName)); - } - } - - /* Evaluate the equality constraints - */ - assert( zAff==0 || (int)strlen(zAff)>=nEq ); - for(j=nSkip; jaLTerm[j]; - assert( pTerm!=0 ); - /* The following testcase is true for indices with redundant columns. - ** Ex: CREATE INDEX i1 ON t1(a,b,a); SELECT * FROM t1 WHERE a=0 AND b=0; */ - testcase( (pTerm->wtFlags & TERM_CODED)!=0 ); - testcase( pTerm->wtFlags & TERM_VIRTUAL ); - r1 = codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, regBase+j); - if( r1!=regBase+j ){ - if( nReg==1 ){ - sqlite3ReleaseTempReg(pParse, regBase); - regBase = r1; - }else{ - sqlite3VdbeAddOp2(v, OP_SCopy, r1, regBase+j); - } - } - testcase( pTerm->eOperator & WO_ISNULL ); - testcase( pTerm->eOperator & WO_IN ); - if( (pTerm->eOperator & (WO_ISNULL|WO_IN))==0 ){ - Expr *pRight = pTerm->pExpr->pRight; - sqlite3ExprCodeIsNullJump(v, pRight, regBase+j, pLevel->addrBrk); - if( zAff ){ - if( sqlite3CompareAffinity(pRight, zAff[j])==SQLITE_AFF_NONE ){ - zAff[j] = SQLITE_AFF_NONE; - } - if( sqlite3ExprNeedsNoAffinityChange(pRight, zAff[j]) ){ - zAff[j] = SQLITE_AFF_NONE; - } - } - } - } - *pzAff = zAff; - return regBase; -} - -#ifndef SQLITE_OMIT_EXPLAIN -/* -** This routine is a helper for explainIndexRange() below -** -** pStr holds the text of an expression that we are building up one term -** at a time. This routine adds a new term to the end of the expression. -** Terms are separated by AND so add the "AND" text for second and subsequent -** terms only. -*/ -static void explainAppendTerm( - StrAccum *pStr, /* The text expression being built */ - int iTerm, /* Index of this term. First is zero */ - const char *zColumn, /* Name of the column */ - const char *zOp /* Name of the operator */ -){ - if( iTerm ) sqlite3StrAccumAppend(pStr, " AND ", 5); - sqlite3StrAccumAppendAll(pStr, zColumn); - sqlite3StrAccumAppend(pStr, zOp, 1); - sqlite3StrAccumAppend(pStr, "?", 1); -} - -/* -** Argument pLevel describes a strategy for scanning table pTab. This -** function returns a pointer to a string buffer containing a description -** of the subset of table rows scanned by the strategy in the form of an -** SQL expression. Or, if all rows are scanned, NULL is returned. -** -** For example, if the query: -** -** SELECT * FROM t1 WHERE a=1 AND b>2; -** -** is run and there is an index on (a, b), then this function returns a -** string similar to: -** -** "a=? AND b>?" -** -** The returned pointer points to memory obtained from sqlite3DbMalloc(). -** It is the responsibility of the caller to free the buffer when it is -** no longer required. -*/ -static char *explainIndexRange(sqlite3 *db, WhereLoop *pLoop, Table *pTab){ - Index *pIndex = pLoop->u.btree.pIndex; - u16 nEq = pLoop->u.btree.nEq; - u16 nSkip = pLoop->u.btree.nSkip; - int i, j; - Column *aCol = pTab->aCol; - i16 *aiColumn = pIndex->aiColumn; - StrAccum txt; - - if( nEq==0 && (pLoop->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))==0 ){ - return 0; - } - sqlite3StrAccumInit(&txt, 0, 0, SQLITE_MAX_LENGTH); - txt.db = db; - sqlite3StrAccumAppend(&txt, " (", 2); - for(i=0; inKeyCol ) ? "rowid" : aCol[aiColumn[i]].zName; - if( i>=nSkip ){ - explainAppendTerm(&txt, i, z, "="); - }else{ - if( i ) sqlite3StrAccumAppend(&txt, " AND ", 5); - sqlite3StrAccumAppend(&txt, "ANY(", 4); - sqlite3StrAccumAppendAll(&txt, z); - sqlite3StrAccumAppend(&txt, ")", 1); - } - } - - j = i; - if( pLoop->wsFlags&WHERE_BTM_LIMIT ){ - char *z = (j==pIndex->nKeyCol ) ? "rowid" : aCol[aiColumn[j]].zName; - explainAppendTerm(&txt, i++, z, ">"); - } - if( pLoop->wsFlags&WHERE_TOP_LIMIT ){ - char *z = (j==pIndex->nKeyCol ) ? "rowid" : aCol[aiColumn[j]].zName; - explainAppendTerm(&txt, i, z, "<"); - } - sqlite3StrAccumAppend(&txt, ")", 1); - return sqlite3StrAccumFinish(&txt); -} - -/* -** This function is a no-op unless currently processing an EXPLAIN QUERY PLAN -** command. If the query being compiled is an EXPLAIN QUERY PLAN, a single -** record is added to the output to describe the table scan strategy in -** pLevel. -*/ -static void explainOneScan( - Parse *pParse, /* Parse context */ - SrcList *pTabList, /* Table list this loop refers to */ - WhereLevel *pLevel, /* Scan to write OP_Explain opcode for */ - int iLevel, /* Value for "level" column of output */ - int iFrom, /* Value for "from" column of output */ - u16 wctrlFlags /* Flags passed to sqlite3WhereBegin() */ -){ -#ifndef SQLITE_DEBUG - if( pParse->explain==2 ) -#endif - { - struct SrcList_item *pItem = &pTabList->a[pLevel->iFrom]; - Vdbe *v = pParse->pVdbe; /* VM being constructed */ - sqlite3 *db = pParse->db; /* Database handle */ - char *zMsg; /* Text to add to EQP output */ - int iId = pParse->iSelectId; /* Select id (left-most output column) */ - int isSearch; /* True for a SEARCH. False for SCAN. */ - WhereLoop *pLoop; /* The controlling WhereLoop object */ - u32 flags; /* Flags that describe this loop */ - - pLoop = pLevel->pWLoop; - flags = pLoop->wsFlags; - if( (flags&WHERE_MULTI_OR) || (wctrlFlags&WHERE_ONETABLE_ONLY) ) return; - - isSearch = (flags&(WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 - || ((flags&WHERE_VIRTUALTABLE)==0 && (pLoop->u.btree.nEq>0)) - || (wctrlFlags&(WHERE_ORDERBY_MIN|WHERE_ORDERBY_MAX)); - - zMsg = sqlite3MPrintf(db, "%s", isSearch?"SEARCH":"SCAN"); - if( pItem->pSelect ){ - zMsg = sqlite3MAppendf(db, zMsg, "%s SUBQUERY %d", zMsg,pItem->iSelectId); - }else{ - zMsg = sqlite3MAppendf(db, zMsg, "%s TABLE %s", zMsg, pItem->zName); - } - - if( pItem->zAlias ){ - zMsg = sqlite3MAppendf(db, zMsg, "%s AS %s", zMsg, pItem->zAlias); - } - if( (flags & (WHERE_IPK|WHERE_VIRTUALTABLE))==0 - && ALWAYS(pLoop->u.btree.pIndex!=0) - ){ - char *zWhere = explainIndexRange(db, pLoop, pItem->pTab); - zMsg = sqlite3MAppendf(db, zMsg, - ((flags & WHERE_AUTO_INDEX) ? - "%s USING AUTOMATIC %sINDEX%.0s%s" : - "%s USING %sINDEX %s%s"), - zMsg, ((flags & WHERE_IDX_ONLY) ? "COVERING " : ""), - pLoop->u.btree.pIndex->zName, zWhere); - sqlite3DbFree(db, zWhere); - }else if( (flags & WHERE_IPK)!=0 && (flags & WHERE_CONSTRAINT)!=0 ){ - zMsg = sqlite3MAppendf(db, zMsg, "%s USING INTEGER PRIMARY KEY", zMsg); - - if( flags&(WHERE_COLUMN_EQ|WHERE_COLUMN_IN) ){ - zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid=?)", zMsg); - }else if( (flags&WHERE_BOTH_LIMIT)==WHERE_BOTH_LIMIT ){ - zMsg = sqlite3MAppendf(db, zMsg, "%s (rowid>? AND rowid?)", zMsg); - }else if( ALWAYS(flags&WHERE_TOP_LIMIT) ){ - zMsg = sqlite3MAppendf(db, zMsg, "%s (rowidu.vtab.idxNum, pLoop->u.vtab.idxStr); - } -#endif - zMsg = sqlite3MAppendf(db, zMsg, "%s", zMsg); - sqlite3VdbeAddOp4(v, OP_Explain, iId, iLevel, iFrom, zMsg, P4_DYNAMIC); - } -} -#else -# define explainOneScan(u,v,w,x,y,z) -#endif /* SQLITE_OMIT_EXPLAIN */ - - -/* -** Generate code for the start of the iLevel-th loop in the WHERE clause -** implementation described by pWInfo. -*/ -static Bitmask codeOneLoopStart( - WhereInfo *pWInfo, /* Complete information about the WHERE clause */ - int iLevel, /* Which level of pWInfo->a[] should be coded */ - Bitmask notReady /* Which tables are currently available */ -){ - int j, k; /* Loop counters */ - int iCur; /* The VDBE cursor for the table */ - int addrNxt; /* Where to jump to continue with the next IN case */ - int omitTable; /* True if we use the index only */ - int bRev; /* True if we need to scan in reverse order */ - WhereLevel *pLevel; /* The where level to be coded */ - WhereLoop *pLoop; /* The WhereLoop object being coded */ - WhereClause *pWC; /* Decomposition of the entire WHERE clause */ - WhereTerm *pTerm; /* A WHERE clause term */ - Parse *pParse; /* Parsing context */ - sqlite3 *db; /* Database connection */ - Vdbe *v; /* The prepared stmt under constructions */ - struct SrcList_item *pTabItem; /* FROM clause term being coded */ - int addrBrk; /* Jump here to break out of the loop */ - int addrCont; /* Jump here to continue with next cycle */ - int iRowidReg = 0; /* Rowid is stored in this register, if not zero */ - int iReleaseReg = 0; /* Temp register to free before returning */ - - pParse = pWInfo->pParse; - v = pParse->pVdbe; - pWC = &pWInfo->sWC; - db = pParse->db; - pLevel = &pWInfo->a[iLevel]; - pLoop = pLevel->pWLoop; - pTabItem = &pWInfo->pTabList->a[pLevel->iFrom]; - iCur = pTabItem->iCursor; - pLevel->notReady = notReady & ~getMask(&pWInfo->sMaskSet, iCur); - bRev = (pWInfo->revMask>>iLevel)&1; - omitTable = (pLoop->wsFlags & WHERE_IDX_ONLY)!=0 - && (pWInfo->wctrlFlags & WHERE_FORCE_TABLE)==0; - VdbeModuleComment((v, "Begin WHERE-loop%d: %s",iLevel,pTabItem->pTab->zName)); - - /* Create labels for the "break" and "continue" instructions - ** for the current loop. Jump to addrBrk to break out of a loop. - ** Jump to cont to go immediately to the next iteration of the - ** loop. - ** - ** When there is an IN operator, we also have a "addrNxt" label that - ** means to continue with the next IN value combination. When - ** there are no IN operators in the constraints, the "addrNxt" label - ** is the same as "addrBrk". - */ - addrBrk = pLevel->addrBrk = pLevel->addrNxt = sqlite3VdbeMakeLabel(v); - addrCont = pLevel->addrCont = sqlite3VdbeMakeLabel(v); - - /* If this is the right table of a LEFT OUTER JOIN, allocate and - ** initialize a memory cell that records if this table matches any - ** row of the left table of the join. - */ - if( pLevel->iFrom>0 && (pTabItem[0].jointype & JT_LEFT)!=0 ){ - pLevel->iLeftJoin = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Integer, 0, pLevel->iLeftJoin); - VdbeComment((v, "init LEFT JOIN no-match flag")); - } - - /* Special case of a FROM clause subquery implemented as a co-routine */ - if( pTabItem->viaCoroutine ){ - int regYield = pTabItem->regReturn; - sqlite3VdbeAddOp2(v, OP_Integer, pTabItem->addrFillSub-1, regYield); - pLevel->p2 = sqlite3VdbeAddOp1(v, OP_Yield, regYield); - VdbeComment((v, "next row of co-routine %s", pTabItem->pTab->zName)); - sqlite3VdbeAddOp2(v, OP_If, regYield+1, addrBrk); - pLevel->op = OP_Goto; - }else - -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 ){ - /* Case 1: The table is a virtual-table. Use the VFilter and VNext - ** to access the data. - */ - int iReg; /* P3 Value for OP_VFilter */ - int addrNotFound; - int nConstraint = pLoop->nLTerm; - - sqlite3ExprCachePush(pParse); - iReg = sqlite3GetTempRange(pParse, nConstraint+2); - addrNotFound = pLevel->addrBrk; - for(j=0; jaLTerm[j]; - if( pTerm==0 ) continue; - if( pTerm->eOperator & WO_IN ){ - codeEqualityTerm(pParse, pTerm, pLevel, j, bRev, iTarget); - addrNotFound = pLevel->addrNxt; - }else{ - sqlite3ExprCode(pParse, pTerm->pExpr->pRight, iTarget); - } - } - sqlite3VdbeAddOp2(v, OP_Integer, pLoop->u.vtab.idxNum, iReg); - sqlite3VdbeAddOp2(v, OP_Integer, nConstraint, iReg+1); - sqlite3VdbeAddOp4(v, OP_VFilter, iCur, addrNotFound, iReg, - pLoop->u.vtab.idxStr, - pLoop->u.vtab.needFree ? P4_MPRINTF : P4_STATIC); - pLoop->u.vtab.needFree = 0; - for(j=0; ju.vtab.omitMask>>j)&1 ){ - disableTerm(pLevel, pLoop->aLTerm[j]); - } - } - pLevel->op = OP_VNext; - pLevel->p1 = iCur; - pLevel->p2 = sqlite3VdbeCurrentAddr(v); - sqlite3ReleaseTempRange(pParse, iReg, nConstraint+2); - sqlite3ExprCachePop(pParse, 1); - }else -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - - if( (pLoop->wsFlags & WHERE_IPK)!=0 - && (pLoop->wsFlags & (WHERE_COLUMN_IN|WHERE_COLUMN_EQ))!=0 - ){ - /* Case 2: We can directly reference a single row using an - ** equality comparison against the ROWID field. Or - ** we reference multiple rows using a "rowid IN (...)" - ** construct. - */ - assert( pLoop->u.btree.nEq==1 ); - iReleaseReg = sqlite3GetTempReg(pParse); - pTerm = pLoop->aLTerm[0]; - assert( pTerm!=0 ); - assert( pTerm->pExpr!=0 ); - assert( omitTable==0 ); - testcase( pTerm->wtFlags & TERM_VIRTUAL ); - iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, 0, bRev, iReleaseReg); - addrNxt = pLevel->addrNxt; - sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt); - sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg); - sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1); - sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); - VdbeComment((v, "pk")); - pLevel->op = OP_Noop; - }else if( (pLoop->wsFlags & WHERE_IPK)!=0 - && (pLoop->wsFlags & WHERE_COLUMN_RANGE)!=0 - ){ - /* Case 3: We have an inequality comparison against the ROWID field. - */ - int testOp = OP_Noop; - int start; - int memEndValue = 0; - WhereTerm *pStart, *pEnd; - - assert( omitTable==0 ); - j = 0; - pStart = pEnd = 0; - if( pLoop->wsFlags & WHERE_BTM_LIMIT ) pStart = pLoop->aLTerm[j++]; - if( pLoop->wsFlags & WHERE_TOP_LIMIT ) pEnd = pLoop->aLTerm[j++]; - assert( pStart!=0 || pEnd!=0 ); - if( bRev ){ - pTerm = pStart; - pStart = pEnd; - pEnd = pTerm; - } - if( pStart ){ - Expr *pX; /* The expression that defines the start bound */ - int r1, rTemp; /* Registers for holding the start boundary */ - - /* The following constant maps TK_xx codes into corresponding - ** seek opcodes. It depends on a particular ordering of TK_xx - */ - const u8 aMoveOp[] = { - /* TK_GT */ OP_SeekGt, - /* TK_LE */ OP_SeekLe, - /* TK_LT */ OP_SeekLt, - /* TK_GE */ OP_SeekGe - }; - assert( TK_LE==TK_GT+1 ); /* Make sure the ordering.. */ - assert( TK_LT==TK_GT+2 ); /* ... of the TK_xx values... */ - assert( TK_GE==TK_GT+3 ); /* ... is correcct. */ - - assert( (pStart->wtFlags & TERM_VNULL)==0 ); - testcase( pStart->wtFlags & TERM_VIRTUAL ); - pX = pStart->pExpr; - assert( pX!=0 ); - testcase( pStart->leftCursor!=iCur ); /* transitive constraints */ - r1 = sqlite3ExprCodeTemp(pParse, pX->pRight, &rTemp); - sqlite3VdbeAddOp3(v, aMoveOp[pX->op-TK_GT], iCur, addrBrk, r1); - VdbeComment((v, "pk")); - sqlite3ExprCacheAffinityChange(pParse, r1, 1); - sqlite3ReleaseTempReg(pParse, rTemp); - disableTerm(pLevel, pStart); - }else{ - sqlite3VdbeAddOp2(v, bRev ? OP_Last : OP_Rewind, iCur, addrBrk); - } - if( pEnd ){ - Expr *pX; - pX = pEnd->pExpr; - assert( pX!=0 ); - assert( (pEnd->wtFlags & TERM_VNULL)==0 ); - testcase( pEnd->leftCursor!=iCur ); /* Transitive constraints */ - testcase( pEnd->wtFlags & TERM_VIRTUAL ); - memEndValue = ++pParse->nMem; - sqlite3ExprCode(pParse, pX->pRight, memEndValue); - if( pX->op==TK_LT || pX->op==TK_GT ){ - testOp = bRev ? OP_Le : OP_Ge; - }else{ - testOp = bRev ? OP_Lt : OP_Gt; - } - disableTerm(pLevel, pEnd); - } - start = sqlite3VdbeCurrentAddr(v); - pLevel->op = bRev ? OP_Prev : OP_Next; - pLevel->p1 = iCur; - pLevel->p2 = start; - assert( pLevel->p5==0 ); - if( testOp!=OP_Noop ){ - iRowidReg = iReleaseReg = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_Rowid, iCur, iRowidReg); - sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); - sqlite3VdbeAddOp3(v, testOp, memEndValue, addrBrk, iRowidReg); - sqlite3VdbeChangeP5(v, SQLITE_AFF_NUMERIC | SQLITE_JUMPIFNULL); - } - }else if( pLoop->wsFlags & WHERE_INDEXED ){ - /* Case 4: A scan using an index. - ** - ** The WHERE clause may contain zero or more equality - ** terms ("==" or "IN" operators) that refer to the N - ** left-most columns of the index. It may also contain - ** inequality constraints (>, <, >= or <=) on the indexed - ** column that immediately follows the N equalities. Only - ** the right-most column can be an inequality - the rest must - ** use the "==" and "IN" operators. For example, if the - ** index is on (x,y,z), then the following clauses are all - ** optimized: - ** - ** x=5 - ** x=5 AND y=10 - ** x=5 AND y<10 - ** x=5 AND y>5 AND y<10 - ** x=5 AND y=5 AND z<=10 - ** - ** The z<10 term of the following cannot be used, only - ** the x=5 term: - ** - ** x=5 AND z<10 - ** - ** N may be zero if there are inequality constraints. - ** If there are no inequality constraints, then N is at - ** least one. - ** - ** This case is also used when there are no WHERE clause - ** constraints but an index is selected anyway, in order - ** to force the output order to conform to an ORDER BY. - */ - static const u8 aStartOp[] = { - 0, - 0, - OP_Rewind, /* 2: (!start_constraints && startEq && !bRev) */ - OP_Last, /* 3: (!start_constraints && startEq && bRev) */ - OP_SeekGt, /* 4: (start_constraints && !startEq && !bRev) */ - OP_SeekLt, /* 5: (start_constraints && !startEq && bRev) */ - OP_SeekGe, /* 6: (start_constraints && startEq && !bRev) */ - OP_SeekLe /* 7: (start_constraints && startEq && bRev) */ - }; - static const u8 aEndOp[] = { - OP_Noop, /* 0: (!end_constraints) */ - OP_IdxGE, /* 1: (end_constraints && !bRev) */ - OP_IdxLT /* 2: (end_constraints && bRev) */ - }; - u16 nEq = pLoop->u.btree.nEq; /* Number of == or IN terms */ - int isMinQuery = 0; /* If this is an optimized SELECT min(x).. */ - int regBase; /* Base register holding constraint values */ - int r1; /* Temp register */ - WhereTerm *pRangeStart = 0; /* Inequality constraint at range start */ - WhereTerm *pRangeEnd = 0; /* Inequality constraint at range end */ - int startEq; /* True if range start uses ==, >= or <= */ - int endEq; /* True if range end uses ==, >= or <= */ - int start_constraints; /* Start of range is constrained */ - int nConstraint; /* Number of constraint terms */ - Index *pIdx; /* The index we will be using */ - int iIdxCur; /* The VDBE cursor for the index */ - int nExtraReg = 0; /* Number of extra registers needed */ - int op; /* Instruction opcode */ - char *zStartAff; /* Affinity for start of range constraint */ - char cEndAff = 0; /* Affinity for end of range constraint */ - - pIdx = pLoop->u.btree.pIndex; - iIdxCur = pLevel->iIdxCur; - assert( nEq>=pLoop->u.btree.nSkip ); - - /* If this loop satisfies a sort order (pOrderBy) request that - ** was passed to this function to implement a "SELECT min(x) ..." - ** query, then the caller will only allow the loop to run for - ** a single iteration. This means that the first row returned - ** should not have a NULL value stored in 'x'. If column 'x' is - ** the first one after the nEq equality constraints in the index, - ** this requires some special handling. - */ - if( (pWInfo->wctrlFlags&WHERE_ORDERBY_MIN)!=0 - && (pWInfo->bOBSat!=0) - && (pIdx->nKeyCol>nEq) - ){ - assert( pLoop->u.btree.nSkip==0 ); - isMinQuery = 1; - nExtraReg = 1; - } - - /* Find any inequality constraint terms for the start and end - ** of the range. - */ - j = nEq; - if( pLoop->wsFlags & WHERE_BTM_LIMIT ){ - pRangeStart = pLoop->aLTerm[j++]; - nExtraReg = 1; - } - if( pLoop->wsFlags & WHERE_TOP_LIMIT ){ - pRangeEnd = pLoop->aLTerm[j++]; - nExtraReg = 1; - } - - /* Generate code to evaluate all constraint terms using == or IN - ** and store the values of those terms in an array of registers - ** starting at regBase. - */ - regBase = codeAllEqualityTerms(pParse,pLevel,bRev,nExtraReg,&zStartAff); - assert( zStartAff==0 || sqlite3Strlen30(zStartAff)>=nEq ); - if( zStartAff ) cEndAff = zStartAff[nEq]; - addrNxt = pLevel->addrNxt; - - /* If we are doing a reverse order scan on an ascending index, or - ** a forward order scan on a descending index, interchange the - ** start and end terms (pRangeStart and pRangeEnd). - */ - if( (nEqnKeyCol && bRev==(pIdx->aSortOrder[nEq]==SQLITE_SO_ASC)) - || (bRev && pIdx->nKeyCol==nEq) - ){ - SWAP(WhereTerm *, pRangeEnd, pRangeStart); - } - - testcase( pRangeStart && (pRangeStart->eOperator & WO_LE)!=0 ); - testcase( pRangeStart && (pRangeStart->eOperator & WO_GE)!=0 ); - testcase( pRangeEnd && (pRangeEnd->eOperator & WO_LE)!=0 ); - testcase( pRangeEnd && (pRangeEnd->eOperator & WO_GE)!=0 ); - startEq = !pRangeStart || pRangeStart->eOperator & (WO_LE|WO_GE); - endEq = !pRangeEnd || pRangeEnd->eOperator & (WO_LE|WO_GE); - start_constraints = pRangeStart || nEq>0; - - /* Seek the index cursor to the start of the range. */ - nConstraint = nEq; - if( pRangeStart ){ - Expr *pRight = pRangeStart->pExpr->pRight; - sqlite3ExprCode(pParse, pRight, regBase+nEq); - if( (pRangeStart->wtFlags & TERM_VNULL)==0 ){ - sqlite3ExprCodeIsNullJump(v, pRight, regBase+nEq, addrNxt); - } - if( zStartAff ){ - if( sqlite3CompareAffinity(pRight, zStartAff[nEq])==SQLITE_AFF_NONE){ - /* Since the comparison is to be performed with no conversions - ** applied to the operands, set the affinity to apply to pRight to - ** SQLITE_AFF_NONE. */ - zStartAff[nEq] = SQLITE_AFF_NONE; - } - if( sqlite3ExprNeedsNoAffinityChange(pRight, zStartAff[nEq]) ){ - zStartAff[nEq] = SQLITE_AFF_NONE; - } - } - nConstraint++; - testcase( pRangeStart->wtFlags & TERM_VIRTUAL ); - }else if( isMinQuery ){ - sqlite3VdbeAddOp2(v, OP_Null, 0, regBase+nEq); - nConstraint++; - startEq = 0; - start_constraints = 1; - } - codeApplyAffinity(pParse, regBase, nConstraint, zStartAff); - op = aStartOp[(start_constraints<<2) + (startEq<<1) + bRev]; - assert( op!=0 ); - testcase( op==OP_Rewind ); - testcase( op==OP_Last ); - testcase( op==OP_SeekGt ); - testcase( op==OP_SeekGe ); - testcase( op==OP_SeekLe ); - testcase( op==OP_SeekLt ); - sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); - - /* Load the value for the inequality constraint at the end of the - ** range (if any). - */ - nConstraint = nEq; - if( pRangeEnd ){ - Expr *pRight = pRangeEnd->pExpr->pRight; - sqlite3ExprCacheRemove(pParse, regBase+nEq, 1); - sqlite3ExprCode(pParse, pRight, regBase+nEq); - if( (pRangeEnd->wtFlags & TERM_VNULL)==0 ){ - sqlite3ExprCodeIsNullJump(v, pRight, regBase+nEq, addrNxt); - } - if( sqlite3CompareAffinity(pRight, cEndAff)!=SQLITE_AFF_NONE - && !sqlite3ExprNeedsNoAffinityChange(pRight, cEndAff) - ){ - codeApplyAffinity(pParse, regBase+nEq, 1, &cEndAff); - } - nConstraint++; - testcase( pRangeEnd->wtFlags & TERM_VIRTUAL ); - } - sqlite3DbFree(db, zStartAff); - - /* Top of the loop body */ - pLevel->p2 = sqlite3VdbeCurrentAddr(v); - - /* Check if the index cursor is past the end of the range. */ - op = aEndOp[(pRangeEnd || nEq) * (1 + bRev)]; - testcase( op==OP_Noop ); - testcase( op==OP_IdxGE ); - testcase( op==OP_IdxLT ); - if( op!=OP_Noop ){ - sqlite3VdbeAddOp4Int(v, op, iIdxCur, addrNxt, regBase, nConstraint); - sqlite3VdbeChangeP5(v, endEq!=bRev ?1:0); - } - - /* If there are inequality constraints, check that the value - ** of the table column that the inequality contrains is not NULL. - ** If it is, jump to the next iteration of the loop. - */ - r1 = sqlite3GetTempReg(pParse); - testcase( pLoop->wsFlags & WHERE_BTM_LIMIT ); - testcase( pLoop->wsFlags & WHERE_TOP_LIMIT ); - if( (pLoop->wsFlags & (WHERE_BTM_LIMIT|WHERE_TOP_LIMIT))!=0 - && (j = pIdx->aiColumn[nEq])>=0 - && pIdx->pTable->aCol[j].notNull==0 - && (nEq || (pLoop->wsFlags & WHERE_BTM_LIMIT)==0) - ){ - sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, nEq, r1); - VdbeComment((v, "%s", pIdx->pTable->aCol[j].zName)); - sqlite3VdbeAddOp2(v, OP_IsNull, r1, addrCont); - } - sqlite3ReleaseTempReg(pParse, r1); - - /* Seek the table cursor, if required */ - disableTerm(pLevel, pRangeStart); - disableTerm(pLevel, pRangeEnd); - if( omitTable ){ - /* pIdx is a covering index. No need to access the main table. */ - }else if( HasRowid(pIdx->pTable) ){ - iRowidReg = iReleaseReg = sqlite3GetTempReg(pParse); - sqlite3VdbeAddOp2(v, OP_IdxRowid, iIdxCur, iRowidReg); - sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); - sqlite3VdbeAddOp2(v, OP_Seek, iCur, iRowidReg); /* Deferred seek */ - }else{ - Index *pPk = sqlite3PrimaryKeyIndex(pIdx->pTable); - iRowidReg = sqlite3GetTempRange(pParse, pPk->nKeyCol); - for(j=0; jnKeyCol; j++){ - k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]); - sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, iRowidReg+j); - } - sqlite3VdbeAddOp4Int(v, OP_NotFound, iCur, addrCont, - iRowidReg, pPk->nKeyCol); - } - - /* Record the instruction used to terminate the loop. Disable - ** WHERE clause terms made redundant by the index range scan. - */ - if( pLoop->wsFlags & WHERE_ONEROW ){ - pLevel->op = OP_Noop; - }else if( bRev ){ - pLevel->op = OP_Prev; - }else{ - pLevel->op = OP_Next; - } - pLevel->p1 = iIdxCur; - if( (pLoop->wsFlags & WHERE_CONSTRAINT)==0 ){ - pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP; - }else{ - assert( pLevel->p5==0 ); - } - }else - -#ifndef SQLITE_OMIT_OR_OPTIMIZATION - if( pLoop->wsFlags & WHERE_MULTI_OR ){ - /* Case 5: Two or more separately indexed terms connected by OR - ** - ** Example: - ** - ** CREATE TABLE t1(a,b,c,d); - ** CREATE INDEX i1 ON t1(a); - ** CREATE INDEX i2 ON t1(b); - ** CREATE INDEX i3 ON t1(c); - ** - ** SELECT * FROM t1 WHERE a=5 OR b=7 OR (c=11 AND d=13) - ** - ** In the example, there are three indexed terms connected by OR. - ** The top of the loop looks like this: - ** - ** Null 1 # Zero the rowset in reg 1 - ** - ** Then, for each indexed term, the following. The arguments to - ** RowSetTest are such that the rowid of the current row is inserted - ** into the RowSet. If it is already present, control skips the - ** Gosub opcode and jumps straight to the code generated by WhereEnd(). - ** - ** sqlite3WhereBegin() - ** RowSetTest # Insert rowid into rowset - ** Gosub 2 A - ** sqlite3WhereEnd() - ** - ** Following the above, code to terminate the loop. Label A, the target - ** of the Gosub above, jumps to the instruction right after the Goto. - ** - ** Null 1 # Zero the rowset in reg 1 - ** Goto B # The loop is finished. - ** - ** A: # Return data, whatever. - ** - ** Return 2 # Jump back to the Gosub - ** - ** B: - ** - */ - WhereClause *pOrWc; /* The OR-clause broken out into subterms */ - SrcList *pOrTab; /* Shortened table list or OR-clause generation */ - Index *pCov = 0; /* Potential covering index (or NULL) */ - int iCovCur = pParse->nTab++; /* Cursor used for index scans (if any) */ - - int regReturn = ++pParse->nMem; /* Register used with OP_Gosub */ - int regRowset = 0; /* Register for RowSet object */ - int regRowid = 0; /* Register holding rowid */ - int iLoopBody = sqlite3VdbeMakeLabel(v); /* Start of loop body */ - int iRetInit; /* Address of regReturn init */ - int untestedTerms = 0; /* Some terms not completely tested */ - int ii; /* Loop counter */ - Expr *pAndExpr = 0; /* An ".. AND (...)" expression */ - - pTerm = pLoop->aLTerm[0]; - assert( pTerm!=0 ); - assert( pTerm->eOperator & WO_OR ); - assert( (pTerm->wtFlags & TERM_ORINFO)!=0 ); - pOrWc = &pTerm->u.pOrInfo->wc; - pLevel->op = OP_Return; - pLevel->p1 = regReturn; - - /* Set up a new SrcList in pOrTab containing the table being scanned - ** by this loop in the a[0] slot and all notReady tables in a[1..] slots. - ** This becomes the SrcList in the recursive call to sqlite3WhereBegin(). - */ - if( pWInfo->nLevel>1 ){ - int nNotReady; /* The number of notReady tables */ - struct SrcList_item *origSrc; /* Original list of tables */ - nNotReady = pWInfo->nLevel - iLevel - 1; - pOrTab = sqlite3StackAllocRaw(db, - sizeof(*pOrTab)+ nNotReady*sizeof(pOrTab->a[0])); - if( pOrTab==0 ) return notReady; - pOrTab->nAlloc = (u8)(nNotReady + 1); - pOrTab->nSrc = pOrTab->nAlloc; - memcpy(pOrTab->a, pTabItem, sizeof(*pTabItem)); - origSrc = pWInfo->pTabList->a; - for(k=1; k<=nNotReady; k++){ - memcpy(&pOrTab->a[k], &origSrc[pLevel[k].iFrom], sizeof(pOrTab->a[k])); - } - }else{ - pOrTab = pWInfo->pTabList; - } - - /* Initialize the rowset register to contain NULL. An SQL NULL is - ** equivalent to an empty rowset. - ** - ** Also initialize regReturn to contain the address of the instruction - ** immediately following the OP_Return at the bottom of the loop. This - ** is required in a few obscure LEFT JOIN cases where control jumps - ** over the top of the loop into the body of it. In this case the - ** correct response for the end-of-loop code (the OP_Return) is to - ** fall through to the next instruction, just as an OP_Next does if - ** called on an uninitialized cursor. - */ - if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){ - regRowset = ++pParse->nMem; - regRowid = ++pParse->nMem; - sqlite3VdbeAddOp2(v, OP_Null, 0, regRowset); - } - iRetInit = sqlite3VdbeAddOp2(v, OP_Integer, 0, regReturn); - - /* If the original WHERE clause is z of the form: (x1 OR x2 OR ...) AND y - ** Then for every term xN, evaluate as the subexpression: xN AND z - ** That way, terms in y that are factored into the disjunction will - ** be picked up by the recursive calls to sqlite3WhereBegin() below. - ** - ** Actually, each subexpression is converted to "xN AND w" where w is - ** the "interesting" terms of z - terms that did not originate in the - ** ON or USING clause of a LEFT JOIN, and terms that are usable as - ** indices. - ** - ** This optimization also only applies if the (x1 OR x2 OR ...) term - ** is not contained in the ON clause of a LEFT JOIN. - ** See ticket http://www.sqlite.org/src/info/f2369304e4 - */ - if( pWC->nTerm>1 ){ - int iTerm; - for(iTerm=0; iTermnTerm; iTerm++){ - Expr *pExpr = pWC->a[iTerm].pExpr; - if( &pWC->a[iTerm] == pTerm ) continue; - if( ExprHasProperty(pExpr, EP_FromJoin) ) continue; - testcase( pWC->a[iTerm].wtFlags & TERM_ORINFO ); - testcase( pWC->a[iTerm].wtFlags & TERM_VIRTUAL ); - if( pWC->a[iTerm].wtFlags & (TERM_ORINFO|TERM_VIRTUAL) ) continue; - if( (pWC->a[iTerm].eOperator & WO_ALL)==0 ) continue; - pExpr = sqlite3ExprDup(db, pExpr, 0); - pAndExpr = sqlite3ExprAnd(db, pAndExpr, pExpr); - } - if( pAndExpr ){ - pAndExpr = sqlite3PExpr(pParse, TK_AND, 0, pAndExpr, 0); - } - } - - for(ii=0; iinTerm; ii++){ - WhereTerm *pOrTerm = &pOrWc->a[ii]; - if( pOrTerm->leftCursor==iCur || (pOrTerm->eOperator & WO_AND)!=0 ){ - WhereInfo *pSubWInfo; /* Info for single OR-term scan */ - Expr *pOrExpr = pOrTerm->pExpr; - if( pAndExpr && !ExprHasProperty(pOrExpr, EP_FromJoin) ){ - pAndExpr->pLeft = pOrExpr; - pOrExpr = pAndExpr; - } - /* Loop through table entries that match term pOrTerm. */ - pSubWInfo = sqlite3WhereBegin(pParse, pOrTab, pOrExpr, 0, 0, - WHERE_OMIT_OPEN_CLOSE | WHERE_AND_ONLY | - WHERE_FORCE_TABLE | WHERE_ONETABLE_ONLY, iCovCur); - assert( pSubWInfo || pParse->nErr || db->mallocFailed ); - if( pSubWInfo ){ - WhereLoop *pSubLoop; - explainOneScan( - pParse, pOrTab, &pSubWInfo->a[0], iLevel, pLevel->iFrom, 0 - ); - if( (pWInfo->wctrlFlags & WHERE_DUPLICATES_OK)==0 ){ - int iSet = ((ii==pOrWc->nTerm-1)?-1:ii); - int r; - r = sqlite3ExprCodeGetColumn(pParse, pTabItem->pTab, -1, iCur, - regRowid, 0); - sqlite3VdbeAddOp4Int(v, OP_RowSetTest, regRowset, - sqlite3VdbeCurrentAddr(v)+2, r, iSet); - } - sqlite3VdbeAddOp2(v, OP_Gosub, regReturn, iLoopBody); - - /* The pSubWInfo->untestedTerms flag means that this OR term - ** contained one or more AND term from a notReady table. The - ** terms from the notReady table could not be tested and will - ** need to be tested later. - */ - if( pSubWInfo->untestedTerms ) untestedTerms = 1; - - /* If all of the OR-connected terms are optimized using the same - ** index, and the index is opened using the same cursor number - ** by each call to sqlite3WhereBegin() made by this loop, it may - ** be possible to use that index as a covering index. - ** - ** If the call to sqlite3WhereBegin() above resulted in a scan that - ** uses an index, and this is either the first OR-connected term - ** processed or the index is the same as that used by all previous - ** terms, set pCov to the candidate covering index. Otherwise, set - ** pCov to NULL to indicate that no candidate covering index will - ** be available. - */ - pSubLoop = pSubWInfo->a[0].pWLoop; - assert( (pSubLoop->wsFlags & WHERE_AUTO_INDEX)==0 ); - if( (pSubLoop->wsFlags & WHERE_INDEXED)!=0 - && (ii==0 || pSubLoop->u.btree.pIndex==pCov) - ){ - assert( pSubWInfo->a[0].iIdxCur==iCovCur ); - pCov = pSubLoop->u.btree.pIndex; - }else{ - pCov = 0; - } - - /* Finish the loop through table entries that match term pOrTerm. */ - sqlite3WhereEnd(pSubWInfo); - } - } - } - pLevel->u.pCovidx = pCov; - if( pCov ) pLevel->iIdxCur = iCovCur; - if( pAndExpr ){ - pAndExpr->pLeft = 0; - sqlite3ExprDelete(db, pAndExpr); - } - sqlite3VdbeChangeP1(v, iRetInit, sqlite3VdbeCurrentAddr(v)); - sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrBrk); - sqlite3VdbeResolveLabel(v, iLoopBody); - - if( pWInfo->nLevel>1 ) sqlite3StackFree(db, pOrTab); - if( !untestedTerms ) disableTerm(pLevel, pTerm); - }else -#endif /* SQLITE_OMIT_OR_OPTIMIZATION */ - - { - /* Case 6: There is no usable index. We must do a complete - ** scan of the entire table. - */ - static const u8 aStep[] = { OP_Next, OP_Prev }; - static const u8 aStart[] = { OP_Rewind, OP_Last }; - assert( bRev==0 || bRev==1 ); - if( pTabItem->isRecursive ){ - /* Tables marked isRecursive have only a single row that is stored in - ** a pseudo-cursor. No need to Rewind or Next such cursors. */ - pLevel->op = OP_Noop; - }else{ - pLevel->op = aStep[bRev]; - pLevel->p1 = iCur; - pLevel->p2 = 1 + sqlite3VdbeAddOp2(v, aStart[bRev], iCur, addrBrk); - pLevel->p5 = SQLITE_STMTSTATUS_FULLSCAN_STEP; - } - } - - /* Insert code to test every subexpression that can be completely - ** computed using the current set of tables. - */ - for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ - Expr *pE; - testcase( pTerm->wtFlags & TERM_VIRTUAL ); - testcase( pTerm->wtFlags & TERM_CODED ); - if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; - if( (pTerm->prereqAll & pLevel->notReady)!=0 ){ - testcase( pWInfo->untestedTerms==0 - && (pWInfo->wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ); - pWInfo->untestedTerms = 1; - continue; - } - pE = pTerm->pExpr; - assert( pE!=0 ); - if( pLevel->iLeftJoin && !ExprHasProperty(pE, EP_FromJoin) ){ - continue; - } - sqlite3ExprIfFalse(pParse, pE, addrCont, SQLITE_JUMPIFNULL); - pTerm->wtFlags |= TERM_CODED; - } - - /* Insert code to test for implied constraints based on transitivity - ** of the "==" operator. - ** - ** Example: If the WHERE clause contains "t1.a=t2.b" and "t2.b=123" - ** and we are coding the t1 loop and the t2 loop has not yet coded, - ** then we cannot use the "t1.a=t2.b" constraint, but we can code - ** the implied "t1.a=123" constraint. - */ - for(pTerm=pWC->a, j=pWC->nTerm; j>0; j--, pTerm++){ - Expr *pE, *pEAlt; - WhereTerm *pAlt; - if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; - if( pTerm->eOperator!=(WO_EQUIV|WO_EQ) ) continue; - if( pTerm->leftCursor!=iCur ) continue; - if( pLevel->iLeftJoin ) continue; - pE = pTerm->pExpr; - assert( !ExprHasProperty(pE, EP_FromJoin) ); - assert( (pTerm->prereqRight & pLevel->notReady)!=0 ); - pAlt = findTerm(pWC, iCur, pTerm->u.leftColumn, notReady, WO_EQ|WO_IN, 0); - if( pAlt==0 ) continue; - if( pAlt->wtFlags & (TERM_CODED) ) continue; - testcase( pAlt->eOperator & WO_EQ ); - testcase( pAlt->eOperator & WO_IN ); - VdbeModuleComment((v, "begin transitive constraint")); - pEAlt = sqlite3StackAllocRaw(db, sizeof(*pEAlt)); - if( pEAlt ){ - *pEAlt = *pAlt->pExpr; - pEAlt->pLeft = pE->pLeft; - sqlite3ExprIfFalse(pParse, pEAlt, addrCont, SQLITE_JUMPIFNULL); - sqlite3StackFree(db, pEAlt); - } - } - - /* For a LEFT OUTER JOIN, generate code that will record the fact that - ** at least one row of the right table has matched the left table. - */ - if( pLevel->iLeftJoin ){ - pLevel->addrFirst = sqlite3VdbeCurrentAddr(v); - sqlite3VdbeAddOp2(v, OP_Integer, 1, pLevel->iLeftJoin); - VdbeComment((v, "record LEFT JOIN hit")); - sqlite3ExprCacheClear(pParse); - for(pTerm=pWC->a, j=0; jnTerm; j++, pTerm++){ - testcase( pTerm->wtFlags & TERM_VIRTUAL ); - testcase( pTerm->wtFlags & TERM_CODED ); - if( pTerm->wtFlags & (TERM_VIRTUAL|TERM_CODED) ) continue; - if( (pTerm->prereqAll & pLevel->notReady)!=0 ){ - assert( pWInfo->untestedTerms ); - continue; - } - assert( pTerm->pExpr ); - sqlite3ExprIfFalse(pParse, pTerm->pExpr, addrCont, SQLITE_JUMPIFNULL); - pTerm->wtFlags |= TERM_CODED; - } - } - sqlite3ReleaseTempReg(pParse, iReleaseReg); - - return pLevel->notReady; -} - -#if defined(WHERETRACE_ENABLED) && defined(SQLITE_ENABLE_TREE_EXPLAIN) -/* -** Generate "Explanation" text for a WhereTerm. -*/ -static void whereExplainTerm(Vdbe *v, WhereTerm *pTerm){ - char zType[4]; - memcpy(zType, "...", 4); - if( pTerm->wtFlags & TERM_VIRTUAL ) zType[0] = 'V'; - if( pTerm->eOperator & WO_EQUIV ) zType[1] = 'E'; - if( ExprHasProperty(pTerm->pExpr, EP_FromJoin) ) zType[2] = 'L'; - sqlite3ExplainPrintf(v, "%s ", zType); - sqlite3ExplainExpr(v, pTerm->pExpr); -} -#endif /* WHERETRACE_ENABLED && SQLITE_ENABLE_TREE_EXPLAIN */ - - -#ifdef WHERETRACE_ENABLED -/* -** Print a WhereLoop object for debugging purposes -*/ -static void whereLoopPrint(WhereLoop *p, WhereClause *pWC){ - WhereInfo *pWInfo = pWC->pWInfo; - int nb = 1+(pWInfo->pTabList->nSrc+7)/8; - struct SrcList_item *pItem = pWInfo->pTabList->a + p->iTab; - Table *pTab = pItem->pTab; - sqlite3DebugPrintf("%c%2d.%0*llx.%0*llx", p->cId, - p->iTab, nb, p->maskSelf, nb, p->prereq); - sqlite3DebugPrintf(" %12s", - pItem->zAlias ? pItem->zAlias : pTab->zName); - if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){ - const char *zName; - if( p->u.btree.pIndex && (zName = p->u.btree.pIndex->zName)!=0 ){ - if( strncmp(zName, "sqlite_autoindex_", 17)==0 ){ - int i = sqlite3Strlen30(zName) - 1; - while( zName[i]!='_' ) i--; - zName += i; - } - sqlite3DebugPrintf(".%-16s %2d", zName, p->u.btree.nEq); - }else{ - sqlite3DebugPrintf("%20s",""); - } - }else{ - char *z; - if( p->u.vtab.idxStr ){ - z = sqlite3_mprintf("(%d,\"%s\",%x)", - p->u.vtab.idxNum, p->u.vtab.idxStr, p->u.vtab.omitMask); - }else{ - z = sqlite3_mprintf("(%d,%x)", p->u.vtab.idxNum, p->u.vtab.omitMask); - } - sqlite3DebugPrintf(" %-19s", z); - sqlite3_free(z); - } - sqlite3DebugPrintf(" f %04x N %d", p->wsFlags, p->nLTerm); - sqlite3DebugPrintf(" cost %d,%d,%d\n", p->rSetup, p->rRun, p->nOut); -#ifdef SQLITE_ENABLE_TREE_EXPLAIN - /* If the 0x100 bit of wheretracing is set, then show all of the constraint - ** expressions in the WhereLoop.aLTerm[] array. - */ - if( p->nLTerm && (sqlite3WhereTrace & 0x100)!=0 ){ /* WHERETRACE 0x100 */ - int i; - Vdbe *v = pWInfo->pParse->pVdbe; - sqlite3ExplainBegin(v); - for(i=0; inLTerm; i++){ - WhereTerm *pTerm = p->aLTerm[i]; - if( pTerm==0 ) continue; - sqlite3ExplainPrintf(v, " (%d) #%-2d ", i+1, (int)(pTerm-pWC->a)); - sqlite3ExplainPush(v); - whereExplainTerm(v, pTerm); - sqlite3ExplainPop(v); - sqlite3ExplainNL(v); - } - sqlite3ExplainFinish(v); - sqlite3DebugPrintf("%s", sqlite3VdbeExplanation(v)); - } -#endif -} -#endif - -/* -** Convert bulk memory into a valid WhereLoop that can be passed -** to whereLoopClear harmlessly. -*/ -static void whereLoopInit(WhereLoop *p){ - p->aLTerm = p->aLTermSpace; - p->nLTerm = 0; - p->nLSlot = ArraySize(p->aLTermSpace); - p->wsFlags = 0; -} - -/* -** Clear the WhereLoop.u union. Leave WhereLoop.pLTerm intact. -*/ -static void whereLoopClearUnion(sqlite3 *db, WhereLoop *p){ - if( p->wsFlags & (WHERE_VIRTUALTABLE|WHERE_AUTO_INDEX) ){ - if( (p->wsFlags & WHERE_VIRTUALTABLE)!=0 && p->u.vtab.needFree ){ - sqlite3_free(p->u.vtab.idxStr); - p->u.vtab.needFree = 0; - p->u.vtab.idxStr = 0; - }else if( (p->wsFlags & WHERE_AUTO_INDEX)!=0 && p->u.btree.pIndex!=0 ){ - sqlite3DbFree(db, p->u.btree.pIndex->zColAff); - sqlite3KeyInfoUnref(p->u.btree.pIndex->pKeyInfo); - sqlite3DbFree(db, p->u.btree.pIndex); - p->u.btree.pIndex = 0; - } - } -} - -/* -** Deallocate internal memory used by a WhereLoop object -*/ -static void whereLoopClear(sqlite3 *db, WhereLoop *p){ - if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFree(db, p->aLTerm); - whereLoopClearUnion(db, p); - whereLoopInit(p); -} - -/* -** Increase the memory allocation for pLoop->aLTerm[] to be at least n. -*/ -static int whereLoopResize(sqlite3 *db, WhereLoop *p, int n){ - WhereTerm **paNew; - if( p->nLSlot>=n ) return SQLITE_OK; - n = (n+7)&~7; - paNew = sqlite3DbMallocRaw(db, sizeof(p->aLTerm[0])*n); - if( paNew==0 ) return SQLITE_NOMEM; - memcpy(paNew, p->aLTerm, sizeof(p->aLTerm[0])*p->nLSlot); - if( p->aLTerm!=p->aLTermSpace ) sqlite3DbFree(db, p->aLTerm); - p->aLTerm = paNew; - p->nLSlot = n; - return SQLITE_OK; -} - -/* -** Transfer content from the second pLoop into the first. -*/ -static int whereLoopXfer(sqlite3 *db, WhereLoop *pTo, WhereLoop *pFrom){ - whereLoopClearUnion(db, pTo); - if( whereLoopResize(db, pTo, pFrom->nLTerm) ){ - memset(&pTo->u, 0, sizeof(pTo->u)); - return SQLITE_NOMEM; - } - memcpy(pTo, pFrom, WHERE_LOOP_XFER_SZ); - memcpy(pTo->aLTerm, pFrom->aLTerm, pTo->nLTerm*sizeof(pTo->aLTerm[0])); - if( pFrom->wsFlags & WHERE_VIRTUALTABLE ){ - pFrom->u.vtab.needFree = 0; - }else if( (pFrom->wsFlags & WHERE_AUTO_INDEX)!=0 ){ - pFrom->u.btree.pIndex = 0; - } - return SQLITE_OK; -} - -/* -** Delete a WhereLoop object -*/ -static void whereLoopDelete(sqlite3 *db, WhereLoop *p){ - whereLoopClear(db, p); - sqlite3DbFree(db, p); -} - -/* -** Free a WhereInfo structure -*/ -static void whereInfoFree(sqlite3 *db, WhereInfo *pWInfo){ - if( ALWAYS(pWInfo) ){ - whereClauseClear(&pWInfo->sWC); - while( pWInfo->pLoops ){ - WhereLoop *p = pWInfo->pLoops; - pWInfo->pLoops = p->pNextLoop; - whereLoopDelete(db, p); - } - sqlite3DbFree(db, pWInfo); - } -} - -/* -** Insert or replace a WhereLoop entry using the template supplied. -** -** An existing WhereLoop entry might be overwritten if the new template -** is better and has fewer dependencies. Or the template will be ignored -** and no insert will occur if an existing WhereLoop is faster and has -** fewer dependencies than the template. Otherwise a new WhereLoop is -** added based on the template. -** -** If pBuilder->pOrSet is not NULL then we only care about only the -** prerequisites and rRun and nOut costs of the N best loops. That -** information is gathered in the pBuilder->pOrSet object. This special -** processing mode is used only for OR clause processing. -** -** When accumulating multiple loops (when pBuilder->pOrSet is NULL) we -** still might overwrite similar loops with the new template if the -** template is better. Loops may be overwritten if the following -** conditions are met: -** -** (1) They have the same iTab. -** (2) They have the same iSortIdx. -** (3) The template has same or fewer dependencies than the current loop -** (4) The template has the same or lower cost than the current loop -** (5) The template uses more terms of the same index but has no additional -** dependencies -*/ -static int whereLoopInsert(WhereLoopBuilder *pBuilder, WhereLoop *pTemplate){ - WhereLoop **ppPrev, *p, *pNext = 0; - WhereInfo *pWInfo = pBuilder->pWInfo; - sqlite3 *db = pWInfo->pParse->db; - - /* If pBuilder->pOrSet is defined, then only keep track of the costs - ** and prereqs. - */ - if( pBuilder->pOrSet!=0 ){ -#if WHERETRACE_ENABLED - u16 n = pBuilder->pOrSet->n; - int x = -#endif - whereOrInsert(pBuilder->pOrSet, pTemplate->prereq, pTemplate->rRun, - pTemplate->nOut); -#if WHERETRACE_ENABLED /* 0x8 */ - if( sqlite3WhereTrace & 0x8 ){ - sqlite3DebugPrintf(x?" or-%d: ":" or-X: ", n); - whereLoopPrint(pTemplate, pBuilder->pWC); - } -#endif - return SQLITE_OK; - } - - /* Search for an existing WhereLoop to overwrite, or which takes - ** priority over pTemplate. - */ - for(ppPrev=&pWInfo->pLoops, p=*ppPrev; p; ppPrev=&p->pNextLoop, p=*ppPrev){ - if( p->iTab!=pTemplate->iTab || p->iSortIdx!=pTemplate->iSortIdx ){ - /* If either the iTab or iSortIdx values for two WhereLoop are different - ** then those WhereLoops need to be considered separately. Neither is - ** a candidate to replace the other. */ - continue; - } - /* In the current implementation, the rSetup value is either zero - ** or the cost of building an automatic index (NlogN) and the NlogN - ** is the same for compatible WhereLoops. */ - assert( p->rSetup==0 || pTemplate->rSetup==0 - || p->rSetup==pTemplate->rSetup ); - - /* whereLoopAddBtree() always generates and inserts the automatic index - ** case first. Hence compatible candidate WhereLoops never have a larger - ** rSetup. Call this SETUP-INVARIANT */ - assert( p->rSetup>=pTemplate->rSetup ); - - if( (p->prereq & pTemplate->prereq)==p->prereq - && p->rSetup<=pTemplate->rSetup - && p->rRun<=pTemplate->rRun - && p->nOut<=pTemplate->nOut - ){ - /* This branch taken when p is equal or better than pTemplate in - ** all of (1) dependencies (2) setup-cost, (3) run-cost, and - ** (4) number of output rows. */ - assert( p->rSetup==pTemplate->rSetup ); - if( p->prereq==pTemplate->prereq - && p->nLTermnLTerm - && (p->wsFlags & pTemplate->wsFlags & WHERE_INDEXED)!=0 - && (p->u.btree.pIndex==pTemplate->u.btree.pIndex - || pTemplate->rRun+p->nLTerm<=p->rRun+pTemplate->nLTerm) - ){ - /* Overwrite an existing WhereLoop with an similar one that uses - ** more terms of the index */ - pNext = p->pNextLoop; - break; - }else{ - /* pTemplate is not helpful. - ** Return without changing or adding anything */ - goto whereLoopInsert_noop; - } - } - if( (p->prereq & pTemplate->prereq)==pTemplate->prereq - && p->rRun>=pTemplate->rRun - && p->nOut>=pTemplate->nOut - ){ - /* Overwrite an existing WhereLoop with a better one: one that is - ** better at one of (1) dependencies, (2) setup-cost, (3) run-cost - ** or (4) number of output rows, and is no worse in any of those - ** categories. */ - assert( p->rSetup>=pTemplate->rSetup ); /* SETUP-INVARIANT above */ - pNext = p->pNextLoop; - break; - } - } - - /* If we reach this point it means that either p[] should be overwritten - ** with pTemplate[] if p[] exists, or if p==NULL then allocate a new - ** WhereLoop and insert it. - */ -#if WHERETRACE_ENABLED /* 0x8 */ - if( sqlite3WhereTrace & 0x8 ){ - if( p!=0 ){ - sqlite3DebugPrintf("ins-del: "); - whereLoopPrint(p, pBuilder->pWC); - } - sqlite3DebugPrintf("ins-new: "); - whereLoopPrint(pTemplate, pBuilder->pWC); - } -#endif - if( p==0 ){ - p = sqlite3DbMallocRaw(db, sizeof(WhereLoop)); - if( p==0 ) return SQLITE_NOMEM; - whereLoopInit(p); - } - whereLoopXfer(db, p, pTemplate); - p->pNextLoop = pNext; - *ppPrev = p; - if( (p->wsFlags & WHERE_VIRTUALTABLE)==0 ){ - Index *pIndex = p->u.btree.pIndex; - if( pIndex && pIndex->tnum==0 ){ - p->u.btree.pIndex = 0; - } - } - return SQLITE_OK; - - /* Jump here if the insert is a no-op */ -whereLoopInsert_noop: -#if WHERETRACE_ENABLED /* 0x8 */ - if( sqlite3WhereTrace & 0x8 ){ - sqlite3DebugPrintf("ins-noop: "); - whereLoopPrint(pTemplate, pBuilder->pWC); - } -#endif - return SQLITE_OK; -} - -/* -** Adjust the WhereLoop.nOut value downward to account for terms of the -** WHERE clause that reference the loop but which are not used by an -** index. -** -** In the current implementation, the first extra WHERE clause term reduces -** the number of output rows by a factor of 10 and each additional term -** reduces the number of output rows by sqrt(2). -*/ -static void whereLoopOutputAdjust(WhereClause *pWC, WhereLoop *pLoop){ - WhereTerm *pTerm, *pX; - Bitmask notAllowed = ~(pLoop->prereq|pLoop->maskSelf); - int i, j; - - if( !OptimizationEnabled(pWC->pWInfo->pParse->db, SQLITE_AdjustOutEst) ){ - return; - } - for(i=pWC->nTerm, pTerm=pWC->a; i>0; i--, pTerm++){ - if( (pTerm->wtFlags & TERM_VIRTUAL)!=0 ) break; - if( (pTerm->prereqAll & pLoop->maskSelf)==0 ) continue; - if( (pTerm->prereqAll & notAllowed)!=0 ) continue; - for(j=pLoop->nLTerm-1; j>=0; j--){ - pX = pLoop->aLTerm[j]; - if( pX==0 ) continue; - if( pX==pTerm ) break; - if( pX->iParent>=0 && (&pWC->a[pX->iParent])==pTerm ) break; - } - if( j<0 ) pLoop->nOut += pTerm->truthProb; - } -} - -/* -** We have so far matched pBuilder->pNew->u.btree.nEq terms of the index pIndex. -** Try to match one more. -** -** If pProbe->tnum==0, that means pIndex is a fake index used for the -** INTEGER PRIMARY KEY. -*/ -static int whereLoopAddBtreeIndex( - WhereLoopBuilder *pBuilder, /* The WhereLoop factory */ - struct SrcList_item *pSrc, /* FROM clause term being analyzed */ - Index *pProbe, /* An index on pSrc */ - LogEst nInMul /* log(Number of iterations due to IN) */ -){ - WhereInfo *pWInfo = pBuilder->pWInfo; /* WHERE analyse context */ - Parse *pParse = pWInfo->pParse; /* Parsing context */ - sqlite3 *db = pParse->db; /* Database connection malloc context */ - WhereLoop *pNew; /* Template WhereLoop under construction */ - WhereTerm *pTerm; /* A WhereTerm under consideration */ - int opMask; /* Valid operators for constraints */ - WhereScan scan; /* Iterator for WHERE terms */ - Bitmask saved_prereq; /* Original value of pNew->prereq */ - u16 saved_nLTerm; /* Original value of pNew->nLTerm */ - u16 saved_nEq; /* Original value of pNew->u.btree.nEq */ - u16 saved_nSkip; /* Original value of pNew->u.btree.nSkip */ - u32 saved_wsFlags; /* Original value of pNew->wsFlags */ - LogEst saved_nOut; /* Original value of pNew->nOut */ - int iCol; /* Index of the column in the table */ - int rc = SQLITE_OK; /* Return code */ - LogEst nRowEst; /* Estimated index selectivity */ - LogEst rLogSize; /* Logarithm of table size */ - WhereTerm *pTop = 0, *pBtm = 0; /* Top and bottom range constraints */ - - pNew = pBuilder->pNew; - if( db->mallocFailed ) return SQLITE_NOMEM; - - assert( (pNew->wsFlags & WHERE_VIRTUALTABLE)==0 ); - assert( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 ); - if( pNew->wsFlags & WHERE_BTM_LIMIT ){ - opMask = WO_LT|WO_LE; - }else if( pProbe->tnum<=0 || (pSrc->jointype & JT_LEFT)!=0 ){ - opMask = WO_EQ|WO_IN|WO_GT|WO_GE|WO_LT|WO_LE; - }else{ - opMask = WO_EQ|WO_IN|WO_ISNULL|WO_GT|WO_GE|WO_LT|WO_LE; - } - if( pProbe->bUnordered ) opMask &= ~(WO_GT|WO_GE|WO_LT|WO_LE); - - assert( pNew->u.btree.nEq<=pProbe->nKeyCol ); - if( pNew->u.btree.nEq < pProbe->nKeyCol ){ - iCol = pProbe->aiColumn[pNew->u.btree.nEq]; - nRowEst = sqlite3LogEst(pProbe->aiRowEst[pNew->u.btree.nEq+1]); - if( nRowEst==0 && pProbe->onError==OE_None ) nRowEst = 1; - }else{ - iCol = -1; - nRowEst = 0; - } - pTerm = whereScanInit(&scan, pBuilder->pWC, pSrc->iCursor, iCol, - opMask, pProbe); - saved_nEq = pNew->u.btree.nEq; - saved_nSkip = pNew->u.btree.nSkip; - saved_nLTerm = pNew->nLTerm; - saved_wsFlags = pNew->wsFlags; - saved_prereq = pNew->prereq; - saved_nOut = pNew->nOut; - pNew->rSetup = 0; - rLogSize = estLog(sqlite3LogEst(pProbe->aiRowEst[0])); - - /* Consider using a skip-scan if there are no WHERE clause constraints - ** available for the left-most terms of the index, and if the average - ** number of repeats in the left-most terms is at least 18. The magic - ** number 18 was found by experimentation to be the payoff point where - ** skip-scan become faster than a full-scan. - */ - if( pTerm==0 - && saved_nEq==saved_nSkip - && saved_nEq+1nKeyCol - && pProbe->aiRowEst[saved_nEq+1]>=18 /* TUNING: Minimum for skip-scan */ - && (rc = whereLoopResize(db, pNew, pNew->nLTerm+1))==SQLITE_OK - ){ - LogEst nIter; - pNew->u.btree.nEq++; - pNew->u.btree.nSkip++; - pNew->aLTerm[pNew->nLTerm++] = 0; - pNew->wsFlags |= WHERE_SKIPSCAN; - nIter = sqlite3LogEst(pProbe->aiRowEst[0]/pProbe->aiRowEst[saved_nEq+1]); - whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nIter); - } - for(; rc==SQLITE_OK && pTerm!=0; pTerm = whereScanNext(&scan)){ - int nIn = 0; -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - int nRecValid = pBuilder->nRecValid; -#endif - if( (pTerm->eOperator==WO_ISNULL || (pTerm->wtFlags&TERM_VNULL)!=0) - && (iCol<0 || pSrc->pTab->aCol[iCol].notNull) - ){ - continue; /* ignore IS [NOT] NULL constraints on NOT NULL columns */ - } - if( pTerm->prereqRight & pNew->maskSelf ) continue; - - assert( pNew->nOut==saved_nOut ); - - pNew->wsFlags = saved_wsFlags; - pNew->u.btree.nEq = saved_nEq; - pNew->nLTerm = saved_nLTerm; - if( whereLoopResize(db, pNew, pNew->nLTerm+1) ) break; /* OOM */ - pNew->aLTerm[pNew->nLTerm++] = pTerm; - pNew->prereq = (saved_prereq | pTerm->prereqRight) & ~pNew->maskSelf; - pNew->rRun = rLogSize; /* Baseline cost is log2(N). Adjustments below */ - if( pTerm->eOperator & WO_IN ){ - Expr *pExpr = pTerm->pExpr; - pNew->wsFlags |= WHERE_COLUMN_IN; - if( ExprHasProperty(pExpr, EP_xIsSelect) ){ - /* "x IN (SELECT ...)": TUNING: the SELECT returns 25 rows */ - nIn = 46; assert( 46==sqlite3LogEst(25) ); - }else if( ALWAYS(pExpr->x.pList && pExpr->x.pList->nExpr) ){ - /* "x IN (value, value, ...)" */ - nIn = sqlite3LogEst(pExpr->x.pList->nExpr); - } - pNew->rRun += nIn; - pNew->u.btree.nEq++; - pNew->nOut = nRowEst + nInMul + nIn; - }else if( pTerm->eOperator & (WO_EQ) ){ - assert( - (pNew->wsFlags & (WHERE_COLUMN_NULL|WHERE_COLUMN_IN|WHERE_SKIPSCAN))!=0 - || nInMul==0 - ); - pNew->wsFlags |= WHERE_COLUMN_EQ; - if( iCol<0 - || (pProbe->onError!=OE_None && nInMul==0 - && pNew->u.btree.nEq==pProbe->nKeyCol-1) - ){ - assert( (pNew->wsFlags & WHERE_COLUMN_IN)==0 || iCol<0 ); - pNew->wsFlags |= WHERE_ONEROW; - } - pNew->u.btree.nEq++; - pNew->nOut = nRowEst + nInMul; - }else if( pTerm->eOperator & (WO_ISNULL) ){ - pNew->wsFlags |= WHERE_COLUMN_NULL; - pNew->u.btree.nEq++; - /* TUNING: IS NULL selects 2 rows */ - nIn = 10; assert( 10==sqlite3LogEst(2) ); - pNew->nOut = nRowEst + nInMul + nIn; - }else if( pTerm->eOperator & (WO_GT|WO_GE) ){ - testcase( pTerm->eOperator & WO_GT ); - testcase( pTerm->eOperator & WO_GE ); - pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_BTM_LIMIT; - pBtm = pTerm; - pTop = 0; - }else{ - assert( pTerm->eOperator & (WO_LT|WO_LE) ); - testcase( pTerm->eOperator & WO_LT ); - testcase( pTerm->eOperator & WO_LE ); - pNew->wsFlags |= WHERE_COLUMN_RANGE|WHERE_TOP_LIMIT; - pTop = pTerm; - pBtm = (pNew->wsFlags & WHERE_BTM_LIMIT)!=0 ? - pNew->aLTerm[pNew->nLTerm-2] : 0; - } - if( pNew->wsFlags & WHERE_COLUMN_RANGE ){ - /* Adjust nOut and rRun for STAT3 range values */ - assert( pNew->nOut==saved_nOut ); - whereRangeScanEst(pParse, pBuilder, pBtm, pTop, pNew); - } -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - if( nInMul==0 - && pProbe->nSample - && pNew->u.btree.nEq<=pProbe->nSampleCol - && OptimizationEnabled(db, SQLITE_Stat3) - ){ - Expr *pExpr = pTerm->pExpr; - tRowcnt nOut = 0; - if( (pTerm->eOperator & (WO_EQ|WO_ISNULL))!=0 ){ - testcase( pTerm->eOperator & WO_EQ ); - testcase( pTerm->eOperator & WO_ISNULL ); - rc = whereEqualScanEst(pParse, pBuilder, pExpr->pRight, &nOut); - }else if( (pTerm->eOperator & WO_IN) - && !ExprHasProperty(pExpr, EP_xIsSelect) ){ - rc = whereInScanEst(pParse, pBuilder, pExpr->x.pList, &nOut); - } - assert( nOut==0 || rc==SQLITE_OK ); - if( nOut ){ - pNew->nOut = sqlite3LogEst(nOut); - if( pNew->nOut>saved_nOut ) pNew->nOut = saved_nOut; - } - } -#endif - if( (pNew->wsFlags & (WHERE_IDX_ONLY|WHERE_IPK))==0 ){ - /* Each row involves a step of the index, then a binary search of - ** the main table */ - pNew->rRun = sqlite3LogEstAdd(pNew->rRun,rLogSize>27 ? rLogSize-17 : 10); - } - /* Step cost for each output row */ - pNew->rRun = sqlite3LogEstAdd(pNew->rRun, pNew->nOut); - whereLoopOutputAdjust(pBuilder->pWC, pNew); - rc = whereLoopInsert(pBuilder, pNew); - if( (pNew->wsFlags & WHERE_TOP_LIMIT)==0 - && pNew->u.btree.nEq<(pProbe->nKeyCol + (pProbe->zName!=0)) - ){ - whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, nInMul+nIn); - } - pNew->nOut = saved_nOut; -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - pBuilder->nRecValid = nRecValid; -#endif - } - pNew->prereq = saved_prereq; - pNew->u.btree.nEq = saved_nEq; - pNew->u.btree.nSkip = saved_nSkip; - pNew->wsFlags = saved_wsFlags; - pNew->nOut = saved_nOut; - pNew->nLTerm = saved_nLTerm; - return rc; -} - -/* -** Return True if it is possible that pIndex might be useful in -** implementing the ORDER BY clause in pBuilder. -** -** Return False if pBuilder does not contain an ORDER BY clause or -** if there is no way for pIndex to be useful in implementing that -** ORDER BY clause. -*/ -static int indexMightHelpWithOrderBy( - WhereLoopBuilder *pBuilder, - Index *pIndex, - int iCursor -){ - ExprList *pOB; - int ii, jj; - - if( pIndex->bUnordered ) return 0; - if( (pOB = pBuilder->pWInfo->pOrderBy)==0 ) return 0; - for(ii=0; iinExpr; ii++){ - Expr *pExpr = sqlite3ExprSkipCollate(pOB->a[ii].pExpr); - if( pExpr->op!=TK_COLUMN ) return 0; - if( pExpr->iTable==iCursor ){ - for(jj=0; jjnKeyCol; jj++){ - if( pExpr->iColumn==pIndex->aiColumn[jj] ) return 1; - } - } - } - return 0; -} - -/* -** Return a bitmask where 1s indicate that the corresponding column of -** the table is used by an index. Only the first 63 columns are considered. -*/ -static Bitmask columnsInIndex(Index *pIdx){ - Bitmask m = 0; - int j; - for(j=pIdx->nColumn-1; j>=0; j--){ - int x = pIdx->aiColumn[j]; - if( x>=0 ){ - testcase( x==BMS-1 ); - testcase( x==BMS-2 ); - if( xa; inTerm; i++, pTerm++){ - if( sqlite3ExprImpliesExpr(pTerm->pExpr, pWhere, iTab) ) return 1; - } - return 0; -} - -/* -** Add all WhereLoop objects for a single table of the join where the table -** is idenfied by pBuilder->pNew->iTab. That table is guaranteed to be -** a b-tree table, not a virtual table. -*/ -static int whereLoopAddBtree( - WhereLoopBuilder *pBuilder, /* WHERE clause information */ - Bitmask mExtra /* Extra prerequesites for using this table */ -){ - WhereInfo *pWInfo; /* WHERE analysis context */ - Index *pProbe; /* An index we are evaluating */ - Index sPk; /* A fake index object for the primary key */ - tRowcnt aiRowEstPk[2]; /* The aiRowEst[] value for the sPk index */ - i16 aiColumnPk = -1; /* The aColumn[] value for the sPk index */ - SrcList *pTabList; /* The FROM clause */ - struct SrcList_item *pSrc; /* The FROM clause btree term to add */ - WhereLoop *pNew; /* Template WhereLoop object */ - int rc = SQLITE_OK; /* Return code */ - int iSortIdx = 1; /* Index number */ - int b; /* A boolean value */ - LogEst rSize; /* number of rows in the table */ - LogEst rLogSize; /* Logarithm of the number of rows in the table */ - WhereClause *pWC; /* The parsed WHERE clause */ - Table *pTab; /* Table being queried */ - - pNew = pBuilder->pNew; - pWInfo = pBuilder->pWInfo; - pTabList = pWInfo->pTabList; - pSrc = pTabList->a + pNew->iTab; - pTab = pSrc->pTab; - pWC = pBuilder->pWC; - assert( !IsVirtual(pSrc->pTab) ); - - if( pSrc->pIndex ){ - /* An INDEXED BY clause specifies a particular index to use */ - pProbe = pSrc->pIndex; - }else if( !HasRowid(pTab) ){ - pProbe = pTab->pIndex; - }else{ - /* There is no INDEXED BY clause. Create a fake Index object in local - ** variable sPk to represent the rowid primary key index. Make this - ** fake index the first in a chain of Index objects with all of the real - ** indices to follow */ - Index *pFirst; /* First of real indices on the table */ - memset(&sPk, 0, sizeof(Index)); - sPk.nKeyCol = 1; - sPk.aiColumn = &aiColumnPk; - sPk.aiRowEst = aiRowEstPk; - sPk.onError = OE_Replace; - sPk.pTable = pTab; - aiRowEstPk[0] = pTab->nRowEst; - aiRowEstPk[1] = 1; - pFirst = pSrc->pTab->pIndex; - if( pSrc->notIndexed==0 ){ - /* The real indices of the table are only considered if the - ** NOT INDEXED qualifier is omitted from the FROM clause */ - sPk.pNext = pFirst; - } - pProbe = &sPk; - } - rSize = sqlite3LogEst(pTab->nRowEst); - rLogSize = estLog(rSize); - -#ifndef SQLITE_OMIT_AUTOMATIC_INDEX - /* Automatic indexes */ - if( !pBuilder->pOrSet - && (pWInfo->pParse->db->flags & SQLITE_AutoIndex)!=0 - && pSrc->pIndex==0 - && !pSrc->viaCoroutine - && !pSrc->notIndexed - && HasRowid(pTab) - && !pSrc->isCorrelated - && !pSrc->isRecursive - ){ - /* Generate auto-index WhereLoops */ - WhereTerm *pTerm; - WhereTerm *pWCEnd = pWC->a + pWC->nTerm; - for(pTerm=pWC->a; rc==SQLITE_OK && pTermprereqRight & pNew->maskSelf ) continue; - if( termCanDriveIndex(pTerm, pSrc, 0) ){ - pNew->u.btree.nEq = 1; - pNew->u.btree.nSkip = 0; - pNew->u.btree.pIndex = 0; - pNew->nLTerm = 1; - pNew->aLTerm[0] = pTerm; - /* TUNING: One-time cost for computing the automatic index is - ** approximately 7*N*log2(N) where N is the number of rows in - ** the table being indexed. */ - pNew->rSetup = rLogSize + rSize + 28; assert( 28==sqlite3LogEst(7) ); - /* TUNING: Each index lookup yields 20 rows in the table. This - ** is more than the usual guess of 10 rows, since we have no way - ** of knowning how selective the index will ultimately be. It would - ** not be unreasonable to make this value much larger. */ - pNew->nOut = 43; assert( 43==sqlite3LogEst(20) ); - pNew->rRun = sqlite3LogEstAdd(rLogSize,pNew->nOut); - pNew->wsFlags = WHERE_AUTO_INDEX; - pNew->prereq = mExtra | pTerm->prereqRight; - rc = whereLoopInsert(pBuilder, pNew); - } - } - } -#endif /* SQLITE_OMIT_AUTOMATIC_INDEX */ - - /* Loop over all indices - */ - for(; rc==SQLITE_OK && pProbe; pProbe=pProbe->pNext, iSortIdx++){ - if( pProbe->pPartIdxWhere!=0 - && !whereUsablePartialIndex(pNew->iTab, pWC, pProbe->pPartIdxWhere) ){ - continue; /* Partial index inappropriate for this query */ - } - pNew->u.btree.nEq = 0; - pNew->u.btree.nSkip = 0; - pNew->nLTerm = 0; - pNew->iSortIdx = 0; - pNew->rSetup = 0; - pNew->prereq = mExtra; - pNew->nOut = rSize; - pNew->u.btree.pIndex = pProbe; - b = indexMightHelpWithOrderBy(pBuilder, pProbe, pSrc->iCursor); - /* The ONEPASS_DESIRED flags never occurs together with ORDER BY */ - assert( (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 || b==0 ); - if( pProbe->tnum<=0 ){ - /* Integer primary key index */ - pNew->wsFlags = WHERE_IPK; - - /* Full table scan */ - pNew->iSortIdx = b ? iSortIdx : 0; - /* TUNING: Cost of full table scan is 3*(N + log2(N)). - ** + The extra 3 factor is to encourage the use of indexed lookups - ** over full scans. FIXME */ - pNew->rRun = sqlite3LogEstAdd(rSize,rLogSize) + 16; - whereLoopOutputAdjust(pWC, pNew); - rc = whereLoopInsert(pBuilder, pNew); - pNew->nOut = rSize; - if( rc ) break; - }else{ - Bitmask m; - if( pProbe->isCovering ){ - pNew->wsFlags = WHERE_IDX_ONLY | WHERE_INDEXED; - m = 0; - }else{ - m = pSrc->colUsed & ~columnsInIndex(pProbe); - pNew->wsFlags = (m==0) ? (WHERE_IDX_ONLY|WHERE_INDEXED) : WHERE_INDEXED; - } - - /* Full scan via index */ - if( b - || !HasRowid(pTab) - || ( m==0 - && pProbe->bUnordered==0 - && (pProbe->szIdxRowszTabRow) - && (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 - && sqlite3GlobalConfig.bUseCis - && OptimizationEnabled(pWInfo->pParse->db, SQLITE_CoverIdxScan) - ) - ){ - pNew->iSortIdx = b ? iSortIdx : 0; - if( m==0 ){ - /* TUNING: Cost of a covering index scan is K*(N + log2(N)). - ** + The extra factor K of between 1.1 and 3.0 that depends - ** on the relative sizes of the table and the index. K - ** is smaller for smaller indices, thus favoring them. - */ - pNew->rRun = sqlite3LogEstAdd(rSize,rLogSize) + 1 + - (15*pProbe->szIdxRow)/pTab->szTabRow; - }else{ - /* TUNING: Cost of scanning a non-covering index is (N+1)*log2(N) - ** which we will simplify to just N*log2(N) */ - pNew->rRun = rSize + rLogSize; - } - whereLoopOutputAdjust(pWC, pNew); - rc = whereLoopInsert(pBuilder, pNew); - pNew->nOut = rSize; - if( rc ) break; - } - } - - rc = whereLoopAddBtreeIndex(pBuilder, pSrc, pProbe, 0); -#ifdef SQLITE_ENABLE_STAT3_OR_STAT4 - sqlite3Stat4ProbeFree(pBuilder->pRec); - pBuilder->nRecValid = 0; - pBuilder->pRec = 0; -#endif - - /* If there was an INDEXED BY clause, then only that one index is - ** considered. */ - if( pSrc->pIndex ) break; - } - return rc; -} - -#ifndef SQLITE_OMIT_VIRTUALTABLE -/* -** Add all WhereLoop objects for a table of the join identified by -** pBuilder->pNew->iTab. That table is guaranteed to be a virtual table. -*/ -static int whereLoopAddVirtual( - WhereLoopBuilder *pBuilder, /* WHERE clause information */ - Bitmask mExtra -){ - WhereInfo *pWInfo; /* WHERE analysis context */ - Parse *pParse; /* The parsing context */ - WhereClause *pWC; /* The WHERE clause */ - struct SrcList_item *pSrc; /* The FROM clause term to search */ - Table *pTab; - sqlite3 *db; - sqlite3_index_info *pIdxInfo; - struct sqlite3_index_constraint *pIdxCons; - struct sqlite3_index_constraint_usage *pUsage; - WhereTerm *pTerm; - int i, j; - int iTerm, mxTerm; - int nConstraint; - int seenIn = 0; /* True if an IN operator is seen */ - int seenVar = 0; /* True if a non-constant constraint is seen */ - int iPhase; /* 0: const w/o IN, 1: const, 2: no IN, 2: IN */ - WhereLoop *pNew; - int rc = SQLITE_OK; - - pWInfo = pBuilder->pWInfo; - pParse = pWInfo->pParse; - db = pParse->db; - pWC = pBuilder->pWC; - pNew = pBuilder->pNew; - pSrc = &pWInfo->pTabList->a[pNew->iTab]; - pTab = pSrc->pTab; - assert( IsVirtual(pTab) ); - pIdxInfo = allocateIndexInfo(pParse, pWC, pSrc, pBuilder->pOrderBy); - if( pIdxInfo==0 ) return SQLITE_NOMEM; - pNew->prereq = 0; - pNew->rSetup = 0; - pNew->wsFlags = WHERE_VIRTUALTABLE; - pNew->nLTerm = 0; - pNew->u.vtab.needFree = 0; - pUsage = pIdxInfo->aConstraintUsage; - nConstraint = pIdxInfo->nConstraint; - if( whereLoopResize(db, pNew, nConstraint) ){ - sqlite3DbFree(db, pIdxInfo); - return SQLITE_NOMEM; - } - - for(iPhase=0; iPhase<=3; iPhase++){ - if( !seenIn && (iPhase&1)!=0 ){ - iPhase++; - if( iPhase>3 ) break; - } - if( !seenVar && iPhase>1 ) break; - pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; - for(i=0; inConstraint; i++, pIdxCons++){ - j = pIdxCons->iTermOffset; - pTerm = &pWC->a[j]; - switch( iPhase ){ - case 0: /* Constants without IN operator */ - pIdxCons->usable = 0; - if( (pTerm->eOperator & WO_IN)!=0 ){ - seenIn = 1; - } - if( pTerm->prereqRight!=0 ){ - seenVar = 1; - }else if( (pTerm->eOperator & WO_IN)==0 ){ - pIdxCons->usable = 1; - } - break; - case 1: /* Constants with IN operators */ - assert( seenIn ); - pIdxCons->usable = (pTerm->prereqRight==0); - break; - case 2: /* Variables without IN */ - assert( seenVar ); - pIdxCons->usable = (pTerm->eOperator & WO_IN)==0; - break; - default: /* Variables with IN */ - assert( seenVar && seenIn ); - pIdxCons->usable = 1; - break; - } - } - memset(pUsage, 0, sizeof(pUsage[0])*pIdxInfo->nConstraint); - if( pIdxInfo->needToFreeIdxStr ) sqlite3_free(pIdxInfo->idxStr); - pIdxInfo->idxStr = 0; - pIdxInfo->idxNum = 0; - pIdxInfo->needToFreeIdxStr = 0; - pIdxInfo->orderByConsumed = 0; - pIdxInfo->estimatedCost = SQLITE_BIG_DBL / (double)2; - pIdxInfo->estimatedRows = 25; - rc = vtabBestIndex(pParse, pTab, pIdxInfo); - if( rc ) goto whereLoopAddVtab_exit; - pIdxCons = *(struct sqlite3_index_constraint**)&pIdxInfo->aConstraint; - pNew->prereq = mExtra; - mxTerm = -1; - assert( pNew->nLSlot>=nConstraint ); - for(i=0; iaLTerm[i] = 0; - pNew->u.vtab.omitMask = 0; - for(i=0; i=0 ){ - j = pIdxCons->iTermOffset; - if( iTerm>=nConstraint - || j<0 - || j>=pWC->nTerm - || pNew->aLTerm[iTerm]!=0 - ){ - rc = SQLITE_ERROR; - sqlite3ErrorMsg(pParse, "%s.xBestIndex() malfunction", pTab->zName); - goto whereLoopAddVtab_exit; - } - testcase( iTerm==nConstraint-1 ); - testcase( j==0 ); - testcase( j==pWC->nTerm-1 ); - pTerm = &pWC->a[j]; - pNew->prereq |= pTerm->prereqRight; - assert( iTermnLSlot ); - pNew->aLTerm[iTerm] = pTerm; - if( iTerm>mxTerm ) mxTerm = iTerm; - testcase( iTerm==15 ); - testcase( iTerm==16 ); - if( iTerm<16 && pUsage[i].omit ) pNew->u.vtab.omitMask |= 1<eOperator & WO_IN)!=0 ){ - if( pUsage[i].omit==0 ){ - /* Do not attempt to use an IN constraint if the virtual table - ** says that the equivalent EQ constraint cannot be safely omitted. - ** If we do attempt to use such a constraint, some rows might be - ** repeated in the output. */ - break; - } - /* A virtual table that is constrained by an IN clause may not - ** consume the ORDER BY clause because (1) the order of IN terms - ** is not necessarily related to the order of output terms and - ** (2) Multiple outputs from a single IN value will not merge - ** together. */ - pIdxInfo->orderByConsumed = 0; - } - } - } - if( i>=nConstraint ){ - pNew->nLTerm = mxTerm+1; - assert( pNew->nLTerm<=pNew->nLSlot ); - pNew->u.vtab.idxNum = pIdxInfo->idxNum; - pNew->u.vtab.needFree = pIdxInfo->needToFreeIdxStr; - pIdxInfo->needToFreeIdxStr = 0; - pNew->u.vtab.idxStr = pIdxInfo->idxStr; - pNew->u.vtab.isOrdered = (u8)((pIdxInfo->nOrderBy!=0) - && pIdxInfo->orderByConsumed); - pNew->rSetup = 0; - pNew->rRun = sqlite3LogEstFromDouble(pIdxInfo->estimatedCost); - pNew->nOut = sqlite3LogEst(pIdxInfo->estimatedRows); - whereLoopInsert(pBuilder, pNew); - if( pNew->u.vtab.needFree ){ - sqlite3_free(pNew->u.vtab.idxStr); - pNew->u.vtab.needFree = 0; - } - } - } - -whereLoopAddVtab_exit: - if( pIdxInfo->needToFreeIdxStr ) sqlite3_free(pIdxInfo->idxStr); - sqlite3DbFree(db, pIdxInfo); - return rc; -} -#endif /* SQLITE_OMIT_VIRTUALTABLE */ - -/* -** Add WhereLoop entries to handle OR terms. This works for either -** btrees or virtual tables. -*/ -static int whereLoopAddOr(WhereLoopBuilder *pBuilder, Bitmask mExtra){ - WhereInfo *pWInfo = pBuilder->pWInfo; - WhereClause *pWC; - WhereLoop *pNew; - WhereTerm *pTerm, *pWCEnd; - int rc = SQLITE_OK; - int iCur; - WhereClause tempWC; - WhereLoopBuilder sSubBuild; - WhereOrSet sSum, sCur, sPrev; - struct SrcList_item *pItem; - - pWC = pBuilder->pWC; - if( pWInfo->wctrlFlags & WHERE_AND_ONLY ) return SQLITE_OK; - pWCEnd = pWC->a + pWC->nTerm; - pNew = pBuilder->pNew; - memset(&sSum, 0, sizeof(sSum)); - pItem = pWInfo->pTabList->a + pNew->iTab; - if( !HasRowid(pItem->pTab) ) return SQLITE_OK; - iCur = pItem->iCursor; - - for(pTerm=pWC->a; pTermeOperator & WO_OR)!=0 - && (pTerm->u.pOrInfo->indexable & pNew->maskSelf)!=0 - ){ - WhereClause * const pOrWC = &pTerm->u.pOrInfo->wc; - WhereTerm * const pOrWCEnd = &pOrWC->a[pOrWC->nTerm]; - WhereTerm *pOrTerm; - int once = 1; - int i, j; - - sSubBuild = *pBuilder; - sSubBuild.pOrderBy = 0; - sSubBuild.pOrSet = &sCur; - - for(pOrTerm=pOrWC->a; pOrTermeOperator & WO_AND)!=0 ){ - sSubBuild.pWC = &pOrTerm->u.pAndInfo->wc; - }else if( pOrTerm->leftCursor==iCur ){ - tempWC.pWInfo = pWC->pWInfo; - tempWC.pOuter = pWC; - tempWC.op = TK_AND; - tempWC.nTerm = 1; - tempWC.a = pOrTerm; - sSubBuild.pWC = &tempWC; - }else{ - continue; - } - sCur.n = 0; -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( IsVirtual(pItem->pTab) ){ - rc = whereLoopAddVirtual(&sSubBuild, mExtra); - }else -#endif - { - rc = whereLoopAddBtree(&sSubBuild, mExtra); - } - assert( rc==SQLITE_OK || sCur.n==0 ); - if( sCur.n==0 ){ - sSum.n = 0; - break; - }else if( once ){ - whereOrMove(&sSum, &sCur); - once = 0; - }else{ - whereOrMove(&sPrev, &sSum); - sSum.n = 0; - for(i=0; inLTerm = 1; - pNew->aLTerm[0] = pTerm; - pNew->wsFlags = WHERE_MULTI_OR; - pNew->rSetup = 0; - pNew->iSortIdx = 0; - memset(&pNew->u, 0, sizeof(pNew->u)); - for(i=0; rc==SQLITE_OK && irRun = sSum.a[i].rRun + 18; - pNew->nOut = sSum.a[i].nOut; - pNew->prereq = sSum.a[i].prereq; - rc = whereLoopInsert(pBuilder, pNew); - } - } - } - return rc; -} - -/* -** Add all WhereLoop objects for all tables -*/ -static int whereLoopAddAll(WhereLoopBuilder *pBuilder){ - WhereInfo *pWInfo = pBuilder->pWInfo; - Bitmask mExtra = 0; - Bitmask mPrior = 0; - int iTab; - SrcList *pTabList = pWInfo->pTabList; - struct SrcList_item *pItem; - sqlite3 *db = pWInfo->pParse->db; - int nTabList = pWInfo->nLevel; - int rc = SQLITE_OK; - u8 priorJoinType = 0; - WhereLoop *pNew; - - /* Loop over the tables in the join, from left to right */ - pNew = pBuilder->pNew; - whereLoopInit(pNew); - for(iTab=0, pItem=pTabList->a; iTabiTab = iTab; - pNew->maskSelf = getMask(&pWInfo->sMaskSet, pItem->iCursor); - if( ((pItem->jointype|priorJoinType) & (JT_LEFT|JT_CROSS))!=0 ){ - mExtra = mPrior; - } - priorJoinType = pItem->jointype; - if( IsVirtual(pItem->pTab) ){ - rc = whereLoopAddVirtual(pBuilder, mExtra); - }else{ - rc = whereLoopAddBtree(pBuilder, mExtra); - } - if( rc==SQLITE_OK ){ - rc = whereLoopAddOr(pBuilder, mExtra); - } - mPrior |= pNew->maskSelf; - if( rc || db->mallocFailed ) break; - } - whereLoopClear(db, pNew); - return rc; -} - -/* -** Examine a WherePath (with the addition of the extra WhereLoop of the 5th -** parameters) to see if it outputs rows in the requested ORDER BY -** (or GROUP BY) without requiring a separate sort operation. Return: -** -** 0: ORDER BY is not satisfied. Sorting required -** 1: ORDER BY is satisfied. Omit sorting -** -1: Unknown at this time -** -** Note that processing for WHERE_GROUPBY and WHERE_DISTINCTBY is not as -** strict. With GROUP BY and DISTINCT the only requirement is that -** equivalent rows appear immediately adjacent to one another. GROUP BY -** and DISTINT do not require rows to appear in any particular order as long -** as equivelent rows are grouped together. Thus for GROUP BY and DISTINCT -** the pOrderBy terms can be matched in any order. With ORDER BY, the -** pOrderBy terms must be matched in strict left-to-right order. -*/ -static int wherePathSatisfiesOrderBy( - WhereInfo *pWInfo, /* The WHERE clause */ - ExprList *pOrderBy, /* ORDER BY or GROUP BY or DISTINCT clause to check */ - WherePath *pPath, /* The WherePath to check */ - u16 wctrlFlags, /* Might contain WHERE_GROUPBY or WHERE_DISTINCTBY */ - u16 nLoop, /* Number of entries in pPath->aLoop[] */ - WhereLoop *pLast, /* Add this WhereLoop to the end of pPath->aLoop[] */ - Bitmask *pRevMask /* OUT: Mask of WhereLoops to run in reverse order */ -){ - u8 revSet; /* True if rev is known */ - u8 rev; /* Composite sort order */ - u8 revIdx; /* Index sort order */ - u8 isOrderDistinct; /* All prior WhereLoops are order-distinct */ - u8 distinctColumns; /* True if the loop has UNIQUE NOT NULL columns */ - u8 isMatch; /* iColumn matches a term of the ORDER BY clause */ - u16 nKeyCol; /* Number of key columns in pIndex */ - u16 nColumn; /* Total number of ordered columns in the index */ - u16 nOrderBy; /* Number terms in the ORDER BY clause */ - int iLoop; /* Index of WhereLoop in pPath being processed */ - int i, j; /* Loop counters */ - int iCur; /* Cursor number for current WhereLoop */ - int iColumn; /* A column number within table iCur */ - WhereLoop *pLoop = 0; /* Current WhereLoop being processed. */ - WhereTerm *pTerm; /* A single term of the WHERE clause */ - Expr *pOBExpr; /* An expression from the ORDER BY clause */ - CollSeq *pColl; /* COLLATE function from an ORDER BY clause term */ - Index *pIndex; /* The index associated with pLoop */ - sqlite3 *db = pWInfo->pParse->db; /* Database connection */ - Bitmask obSat = 0; /* Mask of ORDER BY terms satisfied so far */ - Bitmask obDone; /* Mask of all ORDER BY terms */ - Bitmask orderDistinctMask; /* Mask of all well-ordered loops */ - Bitmask ready; /* Mask of inner loops */ - - /* - ** We say the WhereLoop is "one-row" if it generates no more than one - ** row of output. A WhereLoop is one-row if all of the following are true: - ** (a) All index columns match with WHERE_COLUMN_EQ. - ** (b) The index is unique - ** Any WhereLoop with an WHERE_COLUMN_EQ constraint on the rowid is one-row. - ** Every one-row WhereLoop will have the WHERE_ONEROW bit set in wsFlags. - ** - ** We say the WhereLoop is "order-distinct" if the set of columns from - ** that WhereLoop that are in the ORDER BY clause are different for every - ** row of the WhereLoop. Every one-row WhereLoop is automatically - ** order-distinct. A WhereLoop that has no columns in the ORDER BY clause - ** is not order-distinct. To be order-distinct is not quite the same as being - ** UNIQUE since a UNIQUE column or index can have multiple rows that - ** are NULL and NULL values are equivalent for the purpose of order-distinct. - ** To be order-distinct, the columns must be UNIQUE and NOT NULL. - ** - ** The rowid for a table is always UNIQUE and NOT NULL so whenever the - ** rowid appears in the ORDER BY clause, the corresponding WhereLoop is - ** automatically order-distinct. - */ - - assert( pOrderBy!=0 ); - - /* Sortability of virtual tables is determined by the xBestIndex method - ** of the virtual table itself */ - if( pLast->wsFlags & WHERE_VIRTUALTABLE ){ - testcase( nLoop>0 ); /* True when outer loops are one-row and match - ** no ORDER BY terms */ - return pLast->u.vtab.isOrdered; - } - if( nLoop && OptimizationDisabled(db, SQLITE_OrderByIdxJoin) ) return 0; - - nOrderBy = pOrderBy->nExpr; - testcase( nOrderBy==BMS-1 ); - if( nOrderBy>BMS-1 ) return 0; /* Cannot optimize overly large ORDER BYs */ - isOrderDistinct = 1; - obDone = MASKBIT(nOrderBy)-1; - orderDistinctMask = 0; - ready = 0; - for(iLoop=0; isOrderDistinct && obSat0 ) ready |= pLoop->maskSelf; - pLoop = iLoopaLoop[iLoop] : pLast; - assert( (pLoop->wsFlags & WHERE_VIRTUALTABLE)==0 ); - iCur = pWInfo->pTabList->a[pLoop->iTab].iCursor; - - /* Mark off any ORDER BY term X that is a column in the table of - ** the current loop for which there is term in the WHERE - ** clause of the form X IS NULL or X=? that reference only outer - ** loops. - */ - for(i=0; ia[i].pExpr); - if( pOBExpr->op!=TK_COLUMN ) continue; - if( pOBExpr->iTable!=iCur ) continue; - pTerm = findTerm(&pWInfo->sWC, iCur, pOBExpr->iColumn, - ~ready, WO_EQ|WO_ISNULL, 0); - if( pTerm==0 ) continue; - if( (pTerm->eOperator&WO_EQ)!=0 && pOBExpr->iColumn>=0 ){ - const char *z1, *z2; - pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); - if( !pColl ) pColl = db->pDfltColl; - z1 = pColl->zName; - pColl = sqlite3ExprCollSeq(pWInfo->pParse, pTerm->pExpr); - if( !pColl ) pColl = db->pDfltColl; - z2 = pColl->zName; - if( sqlite3StrICmp(z1, z2)!=0 ) continue; - } - obSat |= MASKBIT(i); - } - - if( (pLoop->wsFlags & WHERE_ONEROW)==0 ){ - if( pLoop->wsFlags & WHERE_IPK ){ - pIndex = 0; - nKeyCol = 0; - nColumn = 1; - }else if( (pIndex = pLoop->u.btree.pIndex)==0 || pIndex->bUnordered ){ - return 0; - }else{ - nKeyCol = pIndex->nKeyCol; - nColumn = pIndex->nColumn; - assert( nColumn==nKeyCol+1 || !HasRowid(pIndex->pTable) ); - assert( pIndex->aiColumn[nColumn-1]==(-1) || !HasRowid(pIndex->pTable)); - isOrderDistinct = pIndex->onError!=OE_None; - } - - /* Loop through all columns of the index and deal with the ones - ** that are not constrained by == or IN. - */ - rev = revSet = 0; - distinctColumns = 0; - for(j=0; ju.btree.nEq - && pLoop->u.btree.nSkip==0 - && ((i = pLoop->aLTerm[j]->eOperator) & (WO_EQ|WO_ISNULL))!=0 - ){ - if( i & WO_ISNULL ){ - testcase( isOrderDistinct ); - isOrderDistinct = 0; - } - continue; - } - - /* Get the column number in the table (iColumn) and sort order - ** (revIdx) for the j-th column of the index. - */ - if( pIndex ){ - iColumn = pIndex->aiColumn[j]; - revIdx = pIndex->aSortOrder[j]; - if( iColumn==pIndex->pTable->iPKey ) iColumn = -1; - }else{ - iColumn = -1; - revIdx = 0; - } - - /* An unconstrained column that might be NULL means that this - ** WhereLoop is not well-ordered - */ - if( isOrderDistinct - && iColumn>=0 - && j>=pLoop->u.btree.nEq - && pIndex->pTable->aCol[iColumn].notNull==0 - ){ - isOrderDistinct = 0; - } - - /* Find the ORDER BY term that corresponds to the j-th column - ** of the index and and mark that ORDER BY term off - */ - bOnce = 1; - isMatch = 0; - for(i=0; bOnce && ia[i].pExpr); - testcase( wctrlFlags & WHERE_GROUPBY ); - testcase( wctrlFlags & WHERE_DISTINCTBY ); - if( (wctrlFlags & (WHERE_GROUPBY|WHERE_DISTINCTBY))==0 ) bOnce = 0; - if( pOBExpr->op!=TK_COLUMN ) continue; - if( pOBExpr->iTable!=iCur ) continue; - if( pOBExpr->iColumn!=iColumn ) continue; - if( iColumn>=0 ){ - pColl = sqlite3ExprCollSeq(pWInfo->pParse, pOrderBy->a[i].pExpr); - if( !pColl ) pColl = db->pDfltColl; - if( sqlite3StrICmp(pColl->zName, pIndex->azColl[j])!=0 ) continue; - } - isMatch = 1; - break; - } - if( isMatch ){ - if( iColumn<0 ){ - testcase( distinctColumns==0 ); - distinctColumns = 1; - } - obSat |= MASKBIT(i); - if( (pWInfo->wctrlFlags & WHERE_GROUPBY)==0 ){ - /* Make sure the sort order is compatible in an ORDER BY clause. - ** Sort order is irrelevant for a GROUP BY clause. */ - if( revSet ){ - if( (rev ^ revIdx)!=pOrderBy->a[i].sortOrder ) return 0; - }else{ - rev = revIdx ^ pOrderBy->a[i].sortOrder; - if( rev ) *pRevMask |= MASKBIT(iLoop); - revSet = 1; - } - } - }else{ - /* No match found */ - if( j==0 || jmaskSelf; - for(i=0; ia[i].pExpr; - if( (exprTableUsage(&pWInfo->sMaskSet, p)&~orderDistinctMask)==0 ){ - obSat |= MASKBIT(i); - } - } - } - } /* End the loop over all WhereLoops from outer-most down to inner-most */ - if( obSat==obDone ) return 1; - if( !isOrderDistinct ) return 0; - return -1; -} - -#ifdef WHERETRACE_ENABLED -/* For debugging use only: */ -static const char *wherePathName(WherePath *pPath, int nLoop, WhereLoop *pLast){ - static char zName[65]; - int i; - for(i=0; iaLoop[i]->cId; } - if( pLast ) zName[i++] = pLast->cId; - zName[i] = 0; - return zName; -} -#endif - - -/* -** Given the list of WhereLoop objects at pWInfo->pLoops, this routine -** attempts to find the lowest cost path that visits each WhereLoop -** once. This path is then loaded into the pWInfo->a[].pWLoop fields. -** -** Assume that the total number of output rows that will need to be sorted -** will be nRowEst (in the 10*log2 representation). Or, ignore sorting -** costs if nRowEst==0. -** -** Return SQLITE_OK on success or SQLITE_NOMEM of a memory allocation -** error occurs. -*/ -static int wherePathSolver(WhereInfo *pWInfo, LogEst nRowEst){ - int mxChoice; /* Maximum number of simultaneous paths tracked */ - int nLoop; /* Number of terms in the join */ - Parse *pParse; /* Parsing context */ - sqlite3 *db; /* The database connection */ - int iLoop; /* Loop counter over the terms of the join */ - int ii, jj; /* Loop counters */ - int mxI = 0; /* Index of next entry to replace */ - LogEst rCost; /* Cost of a path */ - LogEst nOut; /* Number of outputs */ - LogEst mxCost = 0; /* Maximum cost of a set of paths */ - LogEst mxOut = 0; /* Maximum nOut value on the set of paths */ - LogEst rSortCost; /* Cost to do a sort */ - int nTo, nFrom; /* Number of valid entries in aTo[] and aFrom[] */ - WherePath *aFrom; /* All nFrom paths at the previous level */ - WherePath *aTo; /* The nTo best paths at the current level */ - WherePath *pFrom; /* An element of aFrom[] that we are working on */ - WherePath *pTo; /* An element of aTo[] that we are working on */ - WhereLoop *pWLoop; /* One of the WhereLoop objects */ - WhereLoop **pX; /* Used to divy up the pSpace memory */ - char *pSpace; /* Temporary memory used by this routine */ - - pParse = pWInfo->pParse; - db = pParse->db; - nLoop = pWInfo->nLevel; - /* TUNING: For simple queries, only the best path is tracked. - ** For 2-way joins, the 5 best paths are followed. - ** For joins of 3 or more tables, track the 10 best paths */ - mxChoice = (nLoop==1) ? 1 : (nLoop==2 ? 5 : 10); - assert( nLoop<=pWInfo->pTabList->nSrc ); - WHERETRACE(0x002, ("---- begin solver\n")); - - /* Allocate and initialize space for aTo and aFrom */ - ii = (sizeof(WherePath)+sizeof(WhereLoop*)*nLoop)*mxChoice*2; - pSpace = sqlite3DbMallocRaw(db, ii); - if( pSpace==0 ) return SQLITE_NOMEM; - aTo = (WherePath*)pSpace; - aFrom = aTo+mxChoice; - memset(aFrom, 0, sizeof(aFrom[0])); - pX = (WhereLoop**)(aFrom+mxChoice); - for(ii=mxChoice*2, pFrom=aTo; ii>0; ii--, pFrom++, pX += nLoop){ - pFrom->aLoop = pX; - } - - /* Seed the search with a single WherePath containing zero WhereLoops. - ** - ** TUNING: Do not let the number of iterations go above 25. If the cost - ** of computing an automatic index is not paid back within the first 25 - ** rows, then do not use the automatic index. */ - aFrom[0].nRow = MIN(pParse->nQueryLoop, 46); assert( 46==sqlite3LogEst(25) ); - nFrom = 1; - - /* Precompute the cost of sorting the final result set, if the caller - ** to sqlite3WhereBegin() was concerned about sorting */ - rSortCost = 0; - if( pWInfo->pOrderBy==0 || nRowEst==0 ){ - aFrom[0].isOrderedValid = 1; - }else{ - /* TUNING: Estimated cost of sorting is 48*N*log2(N) where N is the - ** number of output rows. The 48 is the expected size of a row to sort. - ** FIXME: compute a better estimate of the 48 multiplier based on the - ** result set expressions. */ - rSortCost = nRowEst + estLog(nRowEst); - WHERETRACE(0x002,("---- sort cost=%-3d\n", rSortCost)); - } - - /* Compute successively longer WherePaths using the previous generation - ** of WherePaths as the basis for the next. Keep track of the mxChoice - ** best paths at each generation */ - for(iLoop=0; iLooppLoops; pWLoop; pWLoop=pWLoop->pNextLoop){ - Bitmask maskNew; - Bitmask revMask = 0; - u8 isOrderedValid = pFrom->isOrderedValid; - u8 isOrdered = pFrom->isOrdered; - if( (pWLoop->prereq & ~pFrom->maskLoop)!=0 ) continue; - if( (pWLoop->maskSelf & pFrom->maskLoop)!=0 ) continue; - /* At this point, pWLoop is a candidate to be the next loop. - ** Compute its cost */ - rCost = sqlite3LogEstAdd(pWLoop->rSetup,pWLoop->rRun + pFrom->nRow); - rCost = sqlite3LogEstAdd(rCost, pFrom->rCost); - nOut = pFrom->nRow + pWLoop->nOut; - maskNew = pFrom->maskLoop | pWLoop->maskSelf; - if( !isOrderedValid ){ - switch( wherePathSatisfiesOrderBy(pWInfo, - pWInfo->pOrderBy, pFrom, pWInfo->wctrlFlags, - iLoop, pWLoop, &revMask) ){ - case 1: /* Yes. pFrom+pWLoop does satisfy the ORDER BY clause */ - isOrdered = 1; - isOrderedValid = 1; - break; - case 0: /* No. pFrom+pWLoop will require a separate sort */ - isOrdered = 0; - isOrderedValid = 1; - rCost = sqlite3LogEstAdd(rCost, rSortCost); - break; - default: /* Cannot tell yet. Try again on the next iteration */ - break; - } - }else{ - revMask = pFrom->revLoop; - } - /* Check to see if pWLoop should be added to the mxChoice best so far */ - for(jj=0, pTo=aTo; jjmaskLoop==maskNew - && pTo->isOrderedValid==isOrderedValid - && ((pTo->rCost<=rCost && pTo->nRow<=nOut) || - (pTo->rCost>=rCost && pTo->nRow>=nOut)) - ){ - testcase( jj==nTo-1 ); - break; - } - } - if( jj>=nTo ){ - if( nTo>=mxChoice && rCost>=mxCost ){ -#ifdef WHERETRACE_ENABLED /* 0x4 */ - if( sqlite3WhereTrace&0x4 ){ - sqlite3DebugPrintf("Skip %s cost=%-3d,%3d order=%c\n", - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, - isOrderedValid ? (isOrdered ? 'Y' : 'N') : '?'); - } -#endif - continue; - } - /* Add a new Path to the aTo[] set */ - if( nTorCost<=rCost && pTo->nRow<=nOut ){ -#ifdef WHERETRACE_ENABLED /* 0x4 */ - if( sqlite3WhereTrace&0x4 ){ - sqlite3DebugPrintf( - "Skip %s cost=%-3d,%3d order=%c", - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, - isOrderedValid ? (isOrdered ? 'Y' : 'N') : '?'); - sqlite3DebugPrintf(" vs %s cost=%-3d,%d order=%c\n", - wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow, - pTo->isOrderedValid ? (pTo->isOrdered ? 'Y' : 'N') : '?'); - } -#endif - testcase( pTo->rCost==rCost ); - continue; - } - testcase( pTo->rCost==rCost+1 ); - /* A new and better score for a previously created equivalent path */ -#ifdef WHERETRACE_ENABLED /* 0x4 */ - if( sqlite3WhereTrace&0x4 ){ - sqlite3DebugPrintf( - "Update %s cost=%-3d,%3d order=%c", - wherePathName(pFrom, iLoop, pWLoop), rCost, nOut, - isOrderedValid ? (isOrdered ? 'Y' : 'N') : '?'); - sqlite3DebugPrintf(" was %s cost=%-3d,%3d order=%c\n", - wherePathName(pTo, iLoop+1, 0), pTo->rCost, pTo->nRow, - pTo->isOrderedValid ? (pTo->isOrdered ? 'Y' : 'N') : '?'); - } -#endif - } - /* pWLoop is a winner. Add it to the set of best so far */ - pTo->maskLoop = pFrom->maskLoop | pWLoop->maskSelf; - pTo->revLoop = revMask; - pTo->nRow = nOut; - pTo->rCost = rCost; - pTo->isOrderedValid = isOrderedValid; - pTo->isOrdered = isOrdered; - memcpy(pTo->aLoop, pFrom->aLoop, sizeof(WhereLoop*)*iLoop); - pTo->aLoop[iLoop] = pWLoop; - if( nTo>=mxChoice ){ - mxI = 0; - mxCost = aTo[0].rCost; - mxOut = aTo[0].nRow; - for(jj=1, pTo=&aTo[1]; jjrCost>mxCost || (pTo->rCost==mxCost && pTo->nRow>mxOut) ){ - mxCost = pTo->rCost; - mxOut = pTo->nRow; - mxI = jj; - } - } - } - } - } - -#ifdef WHERETRACE_ENABLED /* >=2 */ - if( sqlite3WhereTrace>=2 ){ - sqlite3DebugPrintf("---- after round %d ----\n", iLoop); - for(ii=0, pTo=aTo; iirCost, pTo->nRow, - pTo->isOrderedValid ? (pTo->isOrdered ? 'Y' : 'N') : '?'); - if( pTo->isOrderedValid && pTo->isOrdered ){ - sqlite3DebugPrintf(" rev=0x%llx\n", pTo->revLoop); - }else{ - sqlite3DebugPrintf("\n"); - } - } - } -#endif - - /* Swap the roles of aFrom and aTo for the next generation */ - pFrom = aTo; - aTo = aFrom; - aFrom = pFrom; - nFrom = nTo; - } - - if( nFrom==0 ){ - sqlite3ErrorMsg(pParse, "no query solution"); - sqlite3DbFree(db, pSpace); - return SQLITE_ERROR; - } - - /* Find the lowest cost path. pFrom will be left pointing to that path */ - pFrom = aFrom; - for(ii=1; iirCost>aFrom[ii].rCost ) pFrom = &aFrom[ii]; - } - assert( pWInfo->nLevel==nLoop ); - /* Load the lowest cost path into pWInfo */ - for(iLoop=0; iLoopa + iLoop; - pLevel->pWLoop = pWLoop = pFrom->aLoop[iLoop]; - pLevel->iFrom = pWLoop->iTab; - pLevel->iTabCur = pWInfo->pTabList->a[pLevel->iFrom].iCursor; - } - if( (pWInfo->wctrlFlags & WHERE_WANT_DISTINCT)!=0 - && (pWInfo->wctrlFlags & WHERE_DISTINCTBY)==0 - && pWInfo->eDistinct==WHERE_DISTINCT_NOOP - && nRowEst - ){ - Bitmask notUsed; - int rc = wherePathSatisfiesOrderBy(pWInfo, pWInfo->pResultSet, pFrom, - WHERE_DISTINCTBY, nLoop-1, pFrom->aLoop[nLoop-1], ¬Used); - if( rc==1 ) pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; - } - if( pFrom->isOrdered ){ - if( pWInfo->wctrlFlags & WHERE_DISTINCTBY ){ - pWInfo->eDistinct = WHERE_DISTINCT_ORDERED; - }else{ - pWInfo->bOBSat = 1; - pWInfo->revMask = pFrom->revLoop; - } - } - pWInfo->nRowOut = pFrom->nRow; - - /* Free temporary memory and return success */ - sqlite3DbFree(db, pSpace); - return SQLITE_OK; -} - -/* -** Most queries use only a single table (they are not joins) and have -** simple == constraints against indexed fields. This routine attempts -** to plan those simple cases using much less ceremony than the -** general-purpose query planner, and thereby yield faster sqlite3_prepare() -** times for the common case. -** -** Return non-zero on success, if this query can be handled by this -** no-frills query planner. Return zero if this query needs the -** general-purpose query planner. -*/ -static int whereShortCut(WhereLoopBuilder *pBuilder){ - WhereInfo *pWInfo; - struct SrcList_item *pItem; - WhereClause *pWC; - WhereTerm *pTerm; - WhereLoop *pLoop; - int iCur; - int j; - Table *pTab; - Index *pIdx; - - pWInfo = pBuilder->pWInfo; - if( pWInfo->wctrlFlags & WHERE_FORCE_TABLE ) return 0; - assert( pWInfo->pTabList->nSrc>=1 ); - pItem = pWInfo->pTabList->a; - pTab = pItem->pTab; - if( IsVirtual(pTab) ) return 0; - if( pItem->zIndex ) return 0; - iCur = pItem->iCursor; - pWC = &pWInfo->sWC; - pLoop = pBuilder->pNew; - pLoop->wsFlags = 0; - pLoop->u.btree.nSkip = 0; - pTerm = findTerm(pWC, iCur, -1, 0, WO_EQ, 0); - if( pTerm ){ - pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_IPK|WHERE_ONEROW; - pLoop->aLTerm[0] = pTerm; - pLoop->nLTerm = 1; - pLoop->u.btree.nEq = 1; - /* TUNING: Cost of a rowid lookup is 10 */ - pLoop->rRun = 33; /* 33==sqlite3LogEst(10) */ - }else{ - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - assert( pLoop->aLTermSpace==pLoop->aLTerm ); - assert( ArraySize(pLoop->aLTermSpace)==4 ); - if( pIdx->onError==OE_None - || pIdx->pPartIdxWhere!=0 - || pIdx->nKeyCol>ArraySize(pLoop->aLTermSpace) - ) continue; - for(j=0; jnKeyCol; j++){ - pTerm = findTerm(pWC, iCur, pIdx->aiColumn[j], 0, WO_EQ, pIdx); - if( pTerm==0 ) break; - pLoop->aLTerm[j] = pTerm; - } - if( j!=pIdx->nKeyCol ) continue; - pLoop->wsFlags = WHERE_COLUMN_EQ|WHERE_ONEROW|WHERE_INDEXED; - if( pIdx->isCovering || (pItem->colUsed & ~columnsInIndex(pIdx))==0 ){ - pLoop->wsFlags |= WHERE_IDX_ONLY; - } - pLoop->nLTerm = j; - pLoop->u.btree.nEq = j; - pLoop->u.btree.pIndex = pIdx; - /* TUNING: Cost of a unique index lookup is 15 */ - pLoop->rRun = 39; /* 39==sqlite3LogEst(15) */ - break; - } - } - if( pLoop->wsFlags ){ - pLoop->nOut = (LogEst)1; - pWInfo->a[0].pWLoop = pLoop; - pLoop->maskSelf = getMask(&pWInfo->sMaskSet, iCur); - pWInfo->a[0].iTabCur = iCur; - pWInfo->nRowOut = 1; - if( pWInfo->pOrderBy ) pWInfo->bOBSat = 1; - if( pWInfo->wctrlFlags & WHERE_WANT_DISTINCT ){ - pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; - } -#ifdef SQLITE_DEBUG - pLoop->cId = '0'; -#endif - return 1; - } - return 0; -} - -/* -** Generate the beginning of the loop used for WHERE clause processing. -** The return value is a pointer to an opaque structure that contains -** information needed to terminate the loop. Later, the calling routine -** should invoke sqlite3WhereEnd() with the return value of this function -** in order to complete the WHERE clause processing. -** -** If an error occurs, this routine returns NULL. -** -** The basic idea is to do a nested loop, one loop for each table in -** the FROM clause of a select. (INSERT and UPDATE statements are the -** same as a SELECT with only a single table in the FROM clause.) For -** example, if the SQL is this: -** -** SELECT * FROM t1, t2, t3 WHERE ...; -** -** Then the code generated is conceptually like the following: -** -** foreach row1 in t1 do \ Code generated -** foreach row2 in t2 do |-- by sqlite3WhereBegin() -** foreach row3 in t3 do / -** ... -** end \ Code generated -** end |-- by sqlite3WhereEnd() -** end / -** -** Note that the loops might not be nested in the order in which they -** appear in the FROM clause if a different order is better able to make -** use of indices. Note also that when the IN operator appears in -** the WHERE clause, it might result in additional nested loops for -** scanning through all values on the right-hand side of the IN. -** -** There are Btree cursors associated with each table. t1 uses cursor -** number pTabList->a[0].iCursor. t2 uses the cursor pTabList->a[1].iCursor. -** And so forth. This routine generates code to open those VDBE cursors -** and sqlite3WhereEnd() generates the code to close them. -** -** The code that sqlite3WhereBegin() generates leaves the cursors named -** in pTabList pointing at their appropriate entries. The [...] code -** can use OP_Column and OP_Rowid opcodes on these cursors to extract -** data from the various tables of the loop. -** -** If the WHERE clause is empty, the foreach loops must each scan their -** entire tables. Thus a three-way join is an O(N^3) operation. But if -** the tables have indices and there are terms in the WHERE clause that -** refer to those indices, a complete table scan can be avoided and the -** code will run much faster. Most of the work of this routine is checking -** to see if there are indices that can be used to speed up the loop. -** -** Terms of the WHERE clause are also used to limit which rows actually -** make it to the "..." in the middle of the loop. After each "foreach", -** terms of the WHERE clause that use only terms in that loop and outer -** loops are evaluated and if false a jump is made around all subsequent -** inner loops (or around the "..." if the test occurs within the inner- -** most loop) -** -** OUTER JOINS -** -** An outer join of tables t1 and t2 is conceptally coded as follows: -** -** foreach row1 in t1 do -** flag = 0 -** foreach row2 in t2 do -** start: -** ... -** flag = 1 -** end -** if flag==0 then -** move the row2 cursor to a null row -** goto start -** fi -** end -** -** ORDER BY CLAUSE PROCESSING -** -** pOrderBy is a pointer to the ORDER BY clause (or the GROUP BY clause -** if the WHERE_GROUPBY flag is set in wctrlFlags) of a SELECT statement -** if there is one. If there is no ORDER BY clause or if this routine -** is called from an UPDATE or DELETE statement, then pOrderBy is NULL. -** -** The iIdxCur parameter is the cursor number of an index. If -** WHERE_ONETABLE_ONLY is set, iIdxCur is the cursor number of an index -** to use for OR clause processing. The WHERE clause should use this -** specific cursor. If WHERE_ONEPASS_DESIRED is set, then iIdxCur is -** the first cursor in an array of cursors for all indices. iIdxCur should -** be used to compute the appropriate cursor depending on which index is -** used. -*/ -SQLITE_PRIVATE WhereInfo *sqlite3WhereBegin( - Parse *pParse, /* The parser context */ - SrcList *pTabList, /* FROM clause: A list of all tables to be scanned */ - Expr *pWhere, /* The WHERE clause */ - ExprList *pOrderBy, /* An ORDER BY clause, or NULL */ - ExprList *pResultSet, /* Result set of the query */ - u16 wctrlFlags, /* One of the WHERE_* flags defined in sqliteInt.h */ - int iIdxCur /* If WHERE_ONETABLE_ONLY is set, index cursor number */ -){ - int nByteWInfo; /* Num. bytes allocated for WhereInfo struct */ - int nTabList; /* Number of elements in pTabList */ - WhereInfo *pWInfo; /* Will become the return value of this function */ - Vdbe *v = pParse->pVdbe; /* The virtual database engine */ - Bitmask notReady; /* Cursors that are not yet positioned */ - WhereLoopBuilder sWLB; /* The WhereLoop builder */ - WhereMaskSet *pMaskSet; /* The expression mask set */ - WhereLevel *pLevel; /* A single level in pWInfo->a[] */ - WhereLoop *pLoop; /* Pointer to a single WhereLoop object */ - int ii; /* Loop counter */ - sqlite3 *db; /* Database connection */ - int rc; /* Return code */ - - - /* Variable initialization */ - db = pParse->db; - memset(&sWLB, 0, sizeof(sWLB)); - sWLB.pOrderBy = pOrderBy; - - /* Disable the DISTINCT optimization if SQLITE_DistinctOpt is set via - ** sqlite3_test_ctrl(SQLITE_TESTCTRL_OPTIMIZATIONS,...) */ - if( OptimizationDisabled(db, SQLITE_DistinctOpt) ){ - wctrlFlags &= ~WHERE_WANT_DISTINCT; - } - - /* The number of tables in the FROM clause is limited by the number of - ** bits in a Bitmask - */ - testcase( pTabList->nSrc==BMS ); - if( pTabList->nSrc>BMS ){ - sqlite3ErrorMsg(pParse, "at most %d tables in a join", BMS); - return 0; - } - - /* This function normally generates a nested loop for all tables in - ** pTabList. But if the WHERE_ONETABLE_ONLY flag is set, then we should - ** only generate code for the first table in pTabList and assume that - ** any cursors associated with subsequent tables are uninitialized. - */ - nTabList = (wctrlFlags & WHERE_ONETABLE_ONLY) ? 1 : pTabList->nSrc; - - /* Allocate and initialize the WhereInfo structure that will become the - ** return value. A single allocation is used to store the WhereInfo - ** struct, the contents of WhereInfo.a[], the WhereClause structure - ** and the WhereMaskSet structure. Since WhereClause contains an 8-byte - ** field (type Bitmask) it must be aligned on an 8-byte boundary on - ** some architectures. Hence the ROUND8() below. - */ - nByteWInfo = ROUND8(sizeof(WhereInfo)+(nTabList-1)*sizeof(WhereLevel)); - pWInfo = sqlite3DbMallocZero(db, nByteWInfo + sizeof(WhereLoop)); - if( db->mallocFailed ){ - sqlite3DbFree(db, pWInfo); - pWInfo = 0; - goto whereBeginError; - } - pWInfo->aiCurOnePass[0] = pWInfo->aiCurOnePass[1] = -1; - pWInfo->nLevel = nTabList; - pWInfo->pParse = pParse; - pWInfo->pTabList = pTabList; - pWInfo->pOrderBy = pOrderBy; - pWInfo->pResultSet = pResultSet; - pWInfo->iBreak = sqlite3VdbeMakeLabel(v); - pWInfo->wctrlFlags = wctrlFlags; - pWInfo->savedNQueryLoop = pParse->nQueryLoop; - pMaskSet = &pWInfo->sMaskSet; - sWLB.pWInfo = pWInfo; - sWLB.pWC = &pWInfo->sWC; - sWLB.pNew = (WhereLoop*)(((char*)pWInfo)+nByteWInfo); - assert( EIGHT_BYTE_ALIGNMENT(sWLB.pNew) ); - whereLoopInit(sWLB.pNew); -#ifdef SQLITE_DEBUG - sWLB.pNew->cId = '*'; -#endif - - /* Split the WHERE clause into separate subexpressions where each - ** subexpression is separated by an AND operator. - */ - initMaskSet(pMaskSet); - whereClauseInit(&pWInfo->sWC, pWInfo); - whereSplit(&pWInfo->sWC, pWhere, TK_AND); - sqlite3CodeVerifySchema(pParse, -1); /* Insert the cookie verifier Goto */ - - /* Special case: a WHERE clause that is constant. Evaluate the - ** expression and either jump over all of the code or fall thru. - */ - for(ii=0; iinTerm; ii++){ - if( nTabList==0 || sqlite3ExprIsConstantNotJoin(sWLB.pWC->a[ii].pExpr) ){ - sqlite3ExprIfFalse(pParse, sWLB.pWC->a[ii].pExpr, pWInfo->iBreak, - SQLITE_JUMPIFNULL); - sWLB.pWC->a[ii].wtFlags |= TERM_CODED; - } - } - - /* Special case: No FROM clause - */ - if( nTabList==0 ){ - if( pOrderBy ) pWInfo->bOBSat = 1; - if( wctrlFlags & WHERE_WANT_DISTINCT ){ - pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; - } - } - - /* Assign a bit from the bitmask to every term in the FROM clause. - ** - ** When assigning bitmask values to FROM clause cursors, it must be - ** the case that if X is the bitmask for the N-th FROM clause term then - ** the bitmask for all FROM clause terms to the left of the N-th term - ** is (X-1). An expression from the ON clause of a LEFT JOIN can use - ** its Expr.iRightJoinTable value to find the bitmask of the right table - ** of the join. Subtracting one from the right table bitmask gives a - ** bitmask for all tables to the left of the join. Knowing the bitmask - ** for all tables to the left of a left join is important. Ticket #3015. - ** - ** Note that bitmasks are created for all pTabList->nSrc tables in - ** pTabList, not just the first nTabList tables. nTabList is normally - ** equal to pTabList->nSrc but might be shortened to 1 if the - ** WHERE_ONETABLE_ONLY flag is set. - */ - for(ii=0; iinSrc; ii++){ - createMask(pMaskSet, pTabList->a[ii].iCursor); - } -#ifndef NDEBUG - { - Bitmask toTheLeft = 0; - for(ii=0; iinSrc; ii++){ - Bitmask m = getMask(pMaskSet, pTabList->a[ii].iCursor); - assert( (m-1)==toTheLeft ); - toTheLeft |= m; - } - } -#endif - - /* Analyze all of the subexpressions. Note that exprAnalyze() might - ** add new virtual terms onto the end of the WHERE clause. We do not - ** want to analyze these virtual terms, so start analyzing at the end - ** and work forward so that the added virtual terms are never processed. - */ - exprAnalyzeAll(pTabList, &pWInfo->sWC); - if( db->mallocFailed ){ - goto whereBeginError; - } - - /* If the ORDER BY (or GROUP BY) clause contains references to general - ** expressions, then we won't be able to satisfy it using indices, so - ** go ahead and disable it now. - */ - if( pOrderBy && (wctrlFlags & WHERE_WANT_DISTINCT)!=0 ){ - for(ii=0; iinExpr; ii++){ - Expr *pExpr = sqlite3ExprSkipCollate(pOrderBy->a[ii].pExpr); - if( pExpr->op!=TK_COLUMN ){ - pWInfo->pOrderBy = pOrderBy = 0; - break; - }else if( pExpr->iColumn<0 ){ - break; - } - } - } - - if( wctrlFlags & WHERE_WANT_DISTINCT ){ - if( isDistinctRedundant(pParse, pTabList, &pWInfo->sWC, pResultSet) ){ - /* The DISTINCT marking is pointless. Ignore it. */ - pWInfo->eDistinct = WHERE_DISTINCT_UNIQUE; - }else if( pOrderBy==0 ){ - /* Try to ORDER BY the result set to make distinct processing easier */ - pWInfo->wctrlFlags |= WHERE_DISTINCTBY; - pWInfo->pOrderBy = pResultSet; - } - } - - /* Construct the WhereLoop objects */ - WHERETRACE(0xffff,("*** Optimizer Start ***\n")); - /* Display all terms of the WHERE clause */ -#if defined(WHERETRACE_ENABLED) && defined(SQLITE_ENABLE_TREE_EXPLAIN) - if( sqlite3WhereTrace & 0x100 ){ - int i; - Vdbe *v = pParse->pVdbe; - sqlite3ExplainBegin(v); - for(i=0; inTerm; i++){ - sqlite3ExplainPrintf(v, "#%-2d ", i); - sqlite3ExplainPush(v); - whereExplainTerm(v, &sWLB.pWC->a[i]); - sqlite3ExplainPop(v); - sqlite3ExplainNL(v); - } - sqlite3ExplainFinish(v); - sqlite3DebugPrintf("%s", sqlite3VdbeExplanation(v)); - } -#endif - if( nTabList!=1 || whereShortCut(&sWLB)==0 ){ - rc = whereLoopAddAll(&sWLB); - if( rc ) goto whereBeginError; - - /* Display all of the WhereLoop objects if wheretrace is enabled */ -#ifdef WHERETRACE_ENABLED /* !=0 */ - if( sqlite3WhereTrace ){ - WhereLoop *p; - int i; - static char zLabel[] = "0123456789abcdefghijklmnopqrstuvwyxz" - "ABCDEFGHIJKLMNOPQRSTUVWYXZ"; - for(p=pWInfo->pLoops, i=0; p; p=p->pNextLoop, i++){ - p->cId = zLabel[i%sizeof(zLabel)]; - whereLoopPrint(p, sWLB.pWC); - } - } -#endif - - wherePathSolver(pWInfo, 0); - if( db->mallocFailed ) goto whereBeginError; - if( pWInfo->pOrderBy ){ - wherePathSolver(pWInfo, pWInfo->nRowOut+1); - if( db->mallocFailed ) goto whereBeginError; - } - } - if( pWInfo->pOrderBy==0 && (db->flags & SQLITE_ReverseOrder)!=0 ){ - pWInfo->revMask = (Bitmask)(-1); - } - if( pParse->nErr || NEVER(db->mallocFailed) ){ - goto whereBeginError; - } -#ifdef WHERETRACE_ENABLED /* !=0 */ - if( sqlite3WhereTrace ){ - int ii; - sqlite3DebugPrintf("---- Solution nRow=%d", pWInfo->nRowOut); - if( pWInfo->bOBSat ){ - sqlite3DebugPrintf(" ORDERBY=0x%llx", pWInfo->revMask); - } - switch( pWInfo->eDistinct ){ - case WHERE_DISTINCT_UNIQUE: { - sqlite3DebugPrintf(" DISTINCT=unique"); - break; - } - case WHERE_DISTINCT_ORDERED: { - sqlite3DebugPrintf(" DISTINCT=ordered"); - break; - } - case WHERE_DISTINCT_UNORDERED: { - sqlite3DebugPrintf(" DISTINCT=unordered"); - break; - } - } - sqlite3DebugPrintf("\n"); - for(ii=0; iinLevel; ii++){ - whereLoopPrint(pWInfo->a[ii].pWLoop, sWLB.pWC); - } - } -#endif - /* Attempt to omit tables from the join that do not effect the result */ - if( pWInfo->nLevel>=2 - && pResultSet!=0 - && OptimizationEnabled(db, SQLITE_OmitNoopJoin) - ){ - Bitmask tabUsed = exprListTableUsage(pMaskSet, pResultSet); - if( sWLB.pOrderBy ) tabUsed |= exprListTableUsage(pMaskSet, sWLB.pOrderBy); - while( pWInfo->nLevel>=2 ){ - WhereTerm *pTerm, *pEnd; - pLoop = pWInfo->a[pWInfo->nLevel-1].pWLoop; - if( (pWInfo->pTabList->a[pLoop->iTab].jointype & JT_LEFT)==0 ) break; - if( (wctrlFlags & WHERE_WANT_DISTINCT)==0 - && (pLoop->wsFlags & WHERE_ONEROW)==0 - ){ - break; - } - if( (tabUsed & pLoop->maskSelf)!=0 ) break; - pEnd = sWLB.pWC->a + sWLB.pWC->nTerm; - for(pTerm=sWLB.pWC->a; pTermprereqAll & pLoop->maskSelf)!=0 - && !ExprHasProperty(pTerm->pExpr, EP_FromJoin) - ){ - break; - } - } - if( pTerm drop loop %c not used\n", pLoop->cId)); - pWInfo->nLevel--; - nTabList--; - } - } - WHERETRACE(0xffff,("*** Optimizer Finished ***\n")); - pWInfo->pParse->nQueryLoop += pWInfo->nRowOut; - - /* If the caller is an UPDATE or DELETE statement that is requesting - ** to use a one-pass algorithm, determine if this is appropriate. - ** The one-pass algorithm only works if the WHERE clause constrains - ** the statement to update a single row. - */ - assert( (wctrlFlags & WHERE_ONEPASS_DESIRED)==0 || pWInfo->nLevel==1 ); - if( (wctrlFlags & WHERE_ONEPASS_DESIRED)!=0 - && (pWInfo->a[0].pWLoop->wsFlags & WHERE_ONEROW)!=0 ){ - pWInfo->okOnePass = 1; - if( HasRowid(pTabList->a[0].pTab) ){ - pWInfo->a[0].pWLoop->wsFlags &= ~WHERE_IDX_ONLY; - } - } - - /* Open all tables in the pTabList and any indices selected for - ** searching those tables. - */ - notReady = ~(Bitmask)0; - for(ii=0, pLevel=pWInfo->a; iia[pLevel->iFrom]; - pTab = pTabItem->pTab; - iDb = sqlite3SchemaToIndex(db, pTab->pSchema); - pLoop = pLevel->pWLoop; - if( (pTab->tabFlags & TF_Ephemeral)!=0 || pTab->pSelect ){ - /* Do nothing */ - }else -#ifndef SQLITE_OMIT_VIRTUALTABLE - if( (pLoop->wsFlags & WHERE_VIRTUALTABLE)!=0 ){ - const char *pVTab = (const char *)sqlite3GetVTable(db, pTab); - int iCur = pTabItem->iCursor; - sqlite3VdbeAddOp4(v, OP_VOpen, iCur, 0, 0, pVTab, P4_VTAB); - }else if( IsVirtual(pTab) ){ - /* noop */ - }else -#endif - if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 - && (wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 ){ - int op = OP_OpenRead; - if( pWInfo->okOnePass ){ - op = OP_OpenWrite; - pWInfo->aiCurOnePass[0] = pTabItem->iCursor; - }; - sqlite3OpenTable(pParse, pTabItem->iCursor, iDb, pTab, op); - assert( pTabItem->iCursor==pLevel->iTabCur ); - testcase( !pWInfo->okOnePass && pTab->nCol==BMS-1 ); - testcase( !pWInfo->okOnePass && pTab->nCol==BMS ); - if( !pWInfo->okOnePass && pTab->nColcolUsed; - int n = 0; - for(; b; b=b>>1, n++){} - sqlite3VdbeChangeP4(v, sqlite3VdbeCurrentAddr(v)-1, - SQLITE_INT_TO_PTR(n), P4_INT32); - assert( n<=pTab->nCol ); - } - }else{ - sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); - } - if( pLoop->wsFlags & WHERE_INDEXED ){ - Index *pIx = pLoop->u.btree.pIndex; - int iIndexCur; - int op = OP_OpenRead; - /* iIdxCur is always set if to a positive value if ONEPASS is possible */ - assert( iIdxCur!=0 || (pWInfo->wctrlFlags & WHERE_ONEPASS_DESIRED)==0 ); - if( pWInfo->okOnePass ){ - Index *pJ = pTabItem->pTab->pIndex; - iIndexCur = iIdxCur; - assert( wctrlFlags & WHERE_ONEPASS_DESIRED ); - while( ALWAYS(pJ) && pJ!=pIx ){ - iIndexCur++; - pJ = pJ->pNext; - } - op = OP_OpenWrite; - pWInfo->aiCurOnePass[1] = iIndexCur; - }else if( iIdxCur && (wctrlFlags & WHERE_ONETABLE_ONLY)!=0 ){ - iIndexCur = iIdxCur; - }else{ - iIndexCur = pParse->nTab++; - } - pLevel->iIdxCur = iIndexCur; - assert( pIx->pSchema==pTab->pSchema ); - assert( iIndexCur>=0 ); - sqlite3VdbeAddOp3(v, op, iIndexCur, pIx->tnum, iDb); - sqlite3VdbeSetP4KeyInfo(pParse, pIx); - VdbeComment((v, "%s", pIx->zName)); - } - sqlite3CodeVerifySchema(pParse, iDb); - notReady &= ~getMask(&pWInfo->sMaskSet, pTabItem->iCursor); - } - pWInfo->iTop = sqlite3VdbeCurrentAddr(v); - if( db->mallocFailed ) goto whereBeginError; - - /* Generate the code to do the search. Each iteration of the for - ** loop below generates code for a single nested loop of the VM - ** program. - */ - notReady = ~(Bitmask)0; - for(ii=0; iia[ii]; -#ifndef SQLITE_OMIT_AUTOMATIC_INDEX - if( (pLevel->pWLoop->wsFlags & WHERE_AUTO_INDEX)!=0 ){ - constructAutomaticIndex(pParse, &pWInfo->sWC, - &pTabList->a[pLevel->iFrom], notReady, pLevel); - if( db->mallocFailed ) goto whereBeginError; - } -#endif - explainOneScan(pParse, pTabList, pLevel, ii, pLevel->iFrom, wctrlFlags); - pLevel->addrBody = sqlite3VdbeCurrentAddr(v); - notReady = codeOneLoopStart(pWInfo, ii, notReady); - pWInfo->iContinue = pLevel->addrCont; - } - - /* Done. */ - VdbeModuleComment((v, "Begin WHERE-core")); - return pWInfo; - - /* Jump here if malloc fails */ -whereBeginError: - if( pWInfo ){ - pParse->nQueryLoop = pWInfo->savedNQueryLoop; - whereInfoFree(db, pWInfo); - } - return 0; -} - -/* -** Generate the end of the WHERE loop. See comments on -** sqlite3WhereBegin() for additional information. -*/ -SQLITE_PRIVATE void sqlite3WhereEnd(WhereInfo *pWInfo){ - Parse *pParse = pWInfo->pParse; - Vdbe *v = pParse->pVdbe; - int i; - WhereLevel *pLevel; - WhereLoop *pLoop; - SrcList *pTabList = pWInfo->pTabList; - sqlite3 *db = pParse->db; - - /* Generate loop termination code. - */ - VdbeModuleComment((v, "End WHERE-core")); - sqlite3ExprCacheClear(pParse); - for(i=pWInfo->nLevel-1; i>=0; i--){ - int addr; - pLevel = &pWInfo->a[i]; - pLoop = pLevel->pWLoop; - sqlite3VdbeResolveLabel(v, pLevel->addrCont); - if( pLevel->op!=OP_Noop ){ - sqlite3VdbeAddOp2(v, pLevel->op, pLevel->p1, pLevel->p2); - sqlite3VdbeChangeP5(v, pLevel->p5); - } - if( pLoop->wsFlags & WHERE_IN_ABLE && pLevel->u.in.nIn>0 ){ - struct InLoop *pIn; - int j; - sqlite3VdbeResolveLabel(v, pLevel->addrNxt); - for(j=pLevel->u.in.nIn, pIn=&pLevel->u.in.aInLoop[j-1]; j>0; j--, pIn--){ - sqlite3VdbeJumpHere(v, pIn->addrInTop+1); - sqlite3VdbeAddOp2(v, pIn->eEndLoopOp, pIn->iCur, pIn->addrInTop); - sqlite3VdbeJumpHere(v, pIn->addrInTop-1); - } - sqlite3DbFree(db, pLevel->u.in.aInLoop); - } - sqlite3VdbeResolveLabel(v, pLevel->addrBrk); - if( pLevel->addrSkip ){ - sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrSkip); - VdbeComment((v, "next skip-scan on %s", pLoop->u.btree.pIndex->zName)); - sqlite3VdbeJumpHere(v, pLevel->addrSkip); - sqlite3VdbeJumpHere(v, pLevel->addrSkip-2); - } - if( pLevel->iLeftJoin ){ - addr = sqlite3VdbeAddOp1(v, OP_IfPos, pLevel->iLeftJoin); - assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 - || (pLoop->wsFlags & WHERE_INDEXED)!=0 ); - if( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 ){ - sqlite3VdbeAddOp1(v, OP_NullRow, pTabList->a[i].iCursor); - } - if( pLoop->wsFlags & WHERE_INDEXED ){ - sqlite3VdbeAddOp1(v, OP_NullRow, pLevel->iIdxCur); - } - if( pLevel->op==OP_Return ){ - sqlite3VdbeAddOp2(v, OP_Gosub, pLevel->p1, pLevel->addrFirst); - }else{ - sqlite3VdbeAddOp2(v, OP_Goto, 0, pLevel->addrFirst); - } - sqlite3VdbeJumpHere(v, addr); - } - VdbeModuleComment((v, "End WHERE-loop%d: %s", i, - pWInfo->pTabList->a[pLevel->iFrom].pTab->zName)); - } - - /* The "break" point is here, just past the end of the outer loop. - ** Set it. - */ - sqlite3VdbeResolveLabel(v, pWInfo->iBreak); - - assert( pWInfo->nLevel<=pTabList->nSrc ); - for(i=0, pLevel=pWInfo->a; inLevel; i++, pLevel++){ - Index *pIdx = 0; - struct SrcList_item *pTabItem = &pTabList->a[pLevel->iFrom]; - Table *pTab = pTabItem->pTab; - assert( pTab!=0 ); - pLoop = pLevel->pWLoop; - - /* Close all of the cursors that were opened by sqlite3WhereBegin. - ** Except, do not close cursors that will be reused by the OR optimization - ** (WHERE_OMIT_OPEN_CLOSE). And do not close the OP_OpenWrite cursors - ** created for the ONEPASS optimization. - */ - if( (pTab->tabFlags & TF_Ephemeral)==0 - && pTab->pSelect==0 - && (pWInfo->wctrlFlags & WHERE_OMIT_OPEN_CLOSE)==0 - ){ - int ws = pLoop->wsFlags; - if( !pWInfo->okOnePass && (ws & WHERE_IDX_ONLY)==0 ){ - sqlite3VdbeAddOp1(v, OP_Close, pTabItem->iCursor); - } - if( (ws & WHERE_INDEXED)!=0 - && (ws & (WHERE_IPK|WHERE_AUTO_INDEX))==0 - && pLevel->iIdxCur!=pWInfo->aiCurOnePass[1] - ){ - sqlite3VdbeAddOp1(v, OP_Close, pLevel->iIdxCur); - } - } - - /* If this scan uses an index, make VDBE code substitutions to read data - ** from the index instead of from the table where possible. In some cases - ** this optimization prevents the table from ever being read, which can - ** yield a significant performance boost. - ** - ** Calls to the code generator in between sqlite3WhereBegin and - ** sqlite3WhereEnd will have created code that references the table - ** directly. This loop scans all that code looking for opcodes - ** that reference the table and converts them into opcodes that - ** reference the index. - */ - if( pLoop->wsFlags & (WHERE_INDEXED|WHERE_IDX_ONLY) ){ - pIdx = pLoop->u.btree.pIndex; - }else if( pLoop->wsFlags & WHERE_MULTI_OR ){ - pIdx = pLevel->u.pCovidx; - } - if( pIdx && !db->mallocFailed ){ - int k, last; - VdbeOp *pOp; - - last = sqlite3VdbeCurrentAddr(v); - k = pLevel->addrBody; - pOp = sqlite3VdbeGetOp(v, k); - for(; kp1!=pLevel->iTabCur ) continue; - if( pOp->opcode==OP_Column ){ - int x = pOp->p2; - assert( pIdx->pTable==pTab ); - if( !HasRowid(pTab) ){ - Index *pPk = sqlite3PrimaryKeyIndex(pTab); - x = pPk->aiColumn[x]; - } - x = sqlite3ColumnOfIndex(pIdx, x); - if( x>=0 ){ - pOp->p2 = x; - pOp->p1 = pLevel->iIdxCur; - } - assert( (pLoop->wsFlags & WHERE_IDX_ONLY)==0 || x>=0 ); - }else if( pOp->opcode==OP_Rowid ){ - pOp->p1 = pLevel->iIdxCur; - pOp->opcode = OP_IdxRowid; - } - } - } - } - - /* Final cleanup - */ - pParse->nQueryLoop = pWInfo->savedNQueryLoop; - whereInfoFree(db, pWInfo); - return; -} - -/************** End of where.c ***********************************************/ -/************** Begin file parse.c *******************************************/ -/* Driver template for the LEMON parser generator. -** The author disclaims copyright to this source code. -** -** This version of "lempar.c" is modified, slightly, for use by SQLite. -** The only modifications are the addition of a couple of NEVER() -** macros to disable tests that are needed in the case of a general -** LALR(1) grammar but which are always false in the -** specific grammar used by SQLite. -*/ -/* First off, code is included that follows the "include" declaration -** in the input grammar file. */ -/* #include */ - - -/* -** Disable all error recovery processing in the parser push-down -** automaton. -*/ -#define YYNOERRORRECOVERY 1 - -/* -** Make yytestcase() the same as testcase() -*/ -#define yytestcase(X) testcase(X) - -/* -** An instance of this structure holds information about the -** LIMIT clause of a SELECT statement. -*/ -struct LimitVal { - Expr *pLimit; /* The LIMIT expression. NULL if there is no limit */ - Expr *pOffset; /* The OFFSET expression. NULL if there is none */ -}; - -/* -** An instance of this structure is used to store the LIKE, -** GLOB, NOT LIKE, and NOT GLOB operators. -*/ -struct LikeOp { - Token eOperator; /* "like" or "glob" or "regexp" */ - int bNot; /* True if the NOT keyword is present */ -}; - -/* -** An instance of the following structure describes the event of a -** TRIGGER. "a" is the event type, one of TK_UPDATE, TK_INSERT, -** TK_DELETE, or TK_INSTEAD. If the event is of the form -** -** UPDATE ON (a,b,c) -** -** Then the "b" IdList records the list "a,b,c". -*/ -struct TrigEvent { int a; IdList * b; }; - -/* -** An instance of this structure holds the ATTACH key and the key type. -*/ -struct AttachKey { int type; Token key; }; - - - /* This is a utility routine used to set the ExprSpan.zStart and - ** ExprSpan.zEnd values of pOut so that the span covers the complete - ** range of text beginning with pStart and going to the end of pEnd. - */ - static void spanSet(ExprSpan *pOut, Token *pStart, Token *pEnd){ - pOut->zStart = pStart->z; - pOut->zEnd = &pEnd->z[pEnd->n]; - } - - /* Construct a new Expr object from a single identifier. Use the - ** new Expr to populate pOut. Set the span of pOut to be the identifier - ** that created the expression. - */ - static void spanExpr(ExprSpan *pOut, Parse *pParse, int op, Token *pValue){ - pOut->pExpr = sqlite3PExpr(pParse, op, 0, 0, pValue); - pOut->zStart = pValue->z; - pOut->zEnd = &pValue->z[pValue->n]; - } - - /* This routine constructs a binary expression node out of two ExprSpan - ** objects and uses the result to populate a new ExprSpan object. - */ - static void spanBinaryExpr( - ExprSpan *pOut, /* Write the result here */ - Parse *pParse, /* The parsing context. Errors accumulate here */ - int op, /* The binary operation */ - ExprSpan *pLeft, /* The left operand */ - ExprSpan *pRight /* The right operand */ - ){ - pOut->pExpr = sqlite3PExpr(pParse, op, pLeft->pExpr, pRight->pExpr, 0); - pOut->zStart = pLeft->zStart; - pOut->zEnd = pRight->zEnd; - } - - /* Construct an expression node for a unary postfix operator - */ - static void spanUnaryPostfix( - ExprSpan *pOut, /* Write the new expression node here */ - Parse *pParse, /* Parsing context to record errors */ - int op, /* The operator */ - ExprSpan *pOperand, /* The operand */ - Token *pPostOp /* The operand token for setting the span */ - ){ - pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0); - pOut->zStart = pOperand->zStart; - pOut->zEnd = &pPostOp->z[pPostOp->n]; - } - - /* A routine to convert a binary TK_IS or TK_ISNOT expression into a - ** unary TK_ISNULL or TK_NOTNULL expression. */ - static void binaryToUnaryIfNull(Parse *pParse, Expr *pY, Expr *pA, int op){ - sqlite3 *db = pParse->db; - if( db->mallocFailed==0 && pY->op==TK_NULL ){ - pA->op = (u8)op; - sqlite3ExprDelete(db, pA->pRight); - pA->pRight = 0; - } - } - - /* Construct an expression node for a unary prefix operator - */ - static void spanUnaryPrefix( - ExprSpan *pOut, /* Write the new expression node here */ - Parse *pParse, /* Parsing context to record errors */ - int op, /* The operator */ - ExprSpan *pOperand, /* The operand */ - Token *pPreOp /* The operand token for setting the span */ - ){ - pOut->pExpr = sqlite3PExpr(pParse, op, pOperand->pExpr, 0, 0); - pOut->zStart = pPreOp->z; - pOut->zEnd = pOperand->zEnd; - } -/* Next is all token values, in a form suitable for use by makeheaders. -** This section will be null unless lemon is run with the -m switch. -*/ -/* -** These constants (all generated automatically by the parser generator) -** specify the various kinds of tokens (terminals) that the parser -** understands. -** -** Each symbol here is a terminal symbol in the grammar. -*/ -/* Make sure the INTERFACE macro is defined. -*/ -#ifndef INTERFACE -# define INTERFACE 1 -#endif -/* The next thing included is series of defines which control -** various aspects of the generated parser. -** YYCODETYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 terminals -** and nonterminals. "int" is used otherwise. -** YYNOCODE is a number of type YYCODETYPE which corresponds -** to no legal terminal or nonterminal number. This -** number is used to fill in empty slots of the hash -** table. -** YYFALLBACK If defined, this indicates that one or more tokens -** have fall-back values which should be used if the -** original value of the token will not parse. -** YYACTIONTYPE is the data type used for storing terminal -** and nonterminal numbers. "unsigned char" is -** used if there are fewer than 250 rules and -** states combined. "int" is used otherwise. -** sqlite3ParserTOKENTYPE is the data type used for minor tokens given -** directly to the parser from the tokenizer. -** YYMINORTYPE is the data type used for all minor tokens. -** This is typically a union of many types, one of -** which is sqlite3ParserTOKENTYPE. The entry in the union -** for base tokens is called "yy0". -** YYSTACKDEPTH is the maximum depth of the parser's stack. If -** zero the stack is dynamically sized using realloc() -** sqlite3ParserARG_SDECL A static variable declaration for the %extra_argument -** sqlite3ParserARG_PDECL A parameter declaration for the %extra_argument -** sqlite3ParserARG_STORE Code to store %extra_argument into yypParser -** sqlite3ParserARG_FETCH Code to extract %extra_argument from yypParser -** YYNSTATE the combined number of states. -** YYNRULE the number of rules in the grammar -** YYERRORSYMBOL is the code number of the error symbol. If not -** defined, then do no error processing. -*/ -#define YYCODETYPE unsigned char -#define YYNOCODE 254 -#define YYACTIONTYPE unsigned short int -#define YYWILDCARD 70 -#define sqlite3ParserTOKENTYPE Token -typedef union { - int yyinit; - sqlite3ParserTOKENTYPE yy0; - Select* yy3; - ExprList* yy14; - With* yy59; - SrcList* yy65; - struct LikeOp yy96; - Expr* yy132; - u8 yy186; - int yy328; - ExprSpan yy346; - struct TrigEvent yy378; - u16 yy381; - IdList* yy408; - struct {int value; int mask;} yy429; - TriggerStep* yy473; - struct LimitVal yy476; -} YYMINORTYPE; -#ifndef YYSTACKDEPTH -#define YYSTACKDEPTH 100 -#endif -#define sqlite3ParserARG_SDECL Parse *pParse; -#define sqlite3ParserARG_PDECL ,Parse *pParse -#define sqlite3ParserARG_FETCH Parse *pParse = yypParser->pParse -#define sqlite3ParserARG_STORE yypParser->pParse = pParse -#define YYNSTATE 642 -#define YYNRULE 327 -#define YYFALLBACK 1 -#define YY_NO_ACTION (YYNSTATE+YYNRULE+2) -#define YY_ACCEPT_ACTION (YYNSTATE+YYNRULE+1) -#define YY_ERROR_ACTION (YYNSTATE+YYNRULE) - -/* The yyzerominor constant is used to initialize instances of -** YYMINORTYPE objects to zero. */ -static const YYMINORTYPE yyzerominor = { 0 }; - -/* Define the yytestcase() macro to be a no-op if is not already defined -** otherwise. -** -** Applications can choose to define yytestcase() in the %include section -** to a macro that can assist in verifying code coverage. For production -** code the yytestcase() macro should be turned off. But it is useful -** for testing. -*/ -#ifndef yytestcase -# define yytestcase(X) -#endif - - -/* Next are the tables used to determine what action to take based on the -** current state and lookahead token. These tables are used to implement -** functions that take a state number and lookahead value and return an -** action integer. -** -** Suppose the action integer is N. Then the action is determined as -** follows -** -** 0 <= N < YYNSTATE Shift N. That is, push the lookahead -** token onto the stack and goto state N. -** -** YYNSTATE <= N < YYNSTATE+YYNRULE Reduce by rule N-YYNSTATE. -** -** N == YYNSTATE+YYNRULE A syntax error has occurred. -** -** N == YYNSTATE+YYNRULE+1 The parser accepts its input. -** -** N == YYNSTATE+YYNRULE+2 No such action. Denotes unused -** slots in the yy_action[] table. -** -** The action table is constructed as a single large table named yy_action[]. -** Given state S and lookahead X, the action is computed as -** -** yy_action[ yy_shift_ofst[S] + X ] -** -** If the index value yy_shift_ofst[S]+X is out of range or if the value -** yy_lookahead[yy_shift_ofst[S]+X] is not equal to X or if yy_shift_ofst[S] -** is equal to YY_SHIFT_USE_DFLT, it means that the action is not in the table -** and that yy_default[S] should be used instead. -** -** The formula above is for computing the action when the lookahead is -** a terminal symbol. If the lookahead is a non-terminal (as occurs after -** a reduce action) then the yy_reduce_ofst[] array is used in place of -** the yy_shift_ofst[] array and YY_REDUCE_USE_DFLT is used in place of -** YY_SHIFT_USE_DFLT. -** -** The following are the tables generated in this section: -** -** yy_action[] A single table containing all actions. -** yy_lookahead[] A table containing the lookahead for each entry in -** yy_action. Used to detect hash collisions. -** yy_shift_ofst[] For each state, the offset into yy_action for -** shifting terminals. -** yy_reduce_ofst[] For each state, the offset into yy_action for -** shifting non-terminals after a reduce. -** yy_default[] Default action for each state. -*/ -#define YY_ACTTAB_COUNT (1497) -static const YYACTIONTYPE yy_action[] = { - /* 0 */ 306, 212, 432, 955, 639, 191, 955, 295, 559, 88, - /* 10 */ 88, 88, 88, 81, 86, 86, 86, 86, 85, 85, - /* 20 */ 84, 84, 84, 83, 330, 185, 184, 183, 635, 635, - /* 30 */ 292, 606, 606, 88, 88, 88, 88, 683, 86, 86, - /* 40 */ 86, 86, 85, 85, 84, 84, 84, 83, 330, 16, - /* 50 */ 436, 597, 89, 90, 80, 600, 599, 601, 601, 87, - /* 60 */ 87, 88, 88, 88, 88, 684, 86, 86, 86, 86, - /* 70 */ 85, 85, 84, 84, 84, 83, 330, 306, 559, 84, - /* 80 */ 84, 84, 83, 330, 65, 86, 86, 86, 86, 85, - /* 90 */ 85, 84, 84, 84, 83, 330, 635, 635, 634, 633, - /* 100 */ 182, 682, 550, 379, 376, 375, 17, 322, 606, 606, - /* 110 */ 371, 198, 479, 91, 374, 82, 79, 165, 85, 85, - /* 120 */ 84, 84, 84, 83, 330, 598, 635, 635, 107, 89, - /* 130 */ 90, 80, 600, 599, 601, 601, 87, 87, 88, 88, - /* 140 */ 88, 88, 186, 86, 86, 86, 86, 85, 85, 84, - /* 150 */ 84, 84, 83, 330, 306, 594, 594, 142, 328, 327, - /* 160 */ 484, 249, 344, 238, 635, 635, 634, 633, 585, 448, - /* 170 */ 526, 525, 229, 388, 1, 394, 450, 584, 449, 635, - /* 180 */ 635, 635, 635, 319, 395, 606, 606, 199, 157, 273, - /* 190 */ 382, 268, 381, 187, 635, 635, 634, 633, 311, 555, - /* 200 */ 266, 593, 593, 266, 347, 588, 89, 90, 80, 600, - /* 210 */ 599, 601, 601, 87, 87, 88, 88, 88, 88, 478, - /* 220 */ 86, 86, 86, 86, 85, 85, 84, 84, 84, 83, - /* 230 */ 330, 306, 272, 536, 634, 633, 146, 610, 197, 310, - /* 240 */ 575, 182, 482, 271, 379, 376, 375, 506, 21, 634, - /* 250 */ 633, 634, 633, 635, 635, 374, 611, 574, 548, 440, - /* 260 */ 111, 563, 606, 606, 634, 633, 324, 479, 608, 608, - /* 270 */ 608, 300, 435, 573, 119, 407, 210, 162, 562, 883, - /* 280 */ 592, 592, 306, 89, 90, 80, 600, 599, 601, 601, - /* 290 */ 87, 87, 88, 88, 88, 88, 506, 86, 86, 86, - /* 300 */ 86, 85, 85, 84, 84, 84, 83, 330, 620, 111, - /* 310 */ 635, 635, 361, 606, 606, 358, 249, 349, 248, 433, - /* 320 */ 243, 479, 586, 634, 633, 195, 611, 93, 119, 221, - /* 330 */ 575, 497, 534, 534, 89, 90, 80, 600, 599, 601, - /* 340 */ 601, 87, 87, 88, 88, 88, 88, 574, 86, 86, - /* 350 */ 86, 86, 85, 85, 84, 84, 84, 83, 330, 306, - /* 360 */ 77, 429, 638, 573, 589, 530, 240, 230, 242, 105, - /* 370 */ 249, 349, 248, 515, 588, 208, 460, 529, 564, 173, - /* 380 */ 634, 633, 970, 144, 430, 2, 424, 228, 380, 557, - /* 390 */ 606, 606, 190, 153, 159, 158, 514, 51, 632, 631, - /* 400 */ 630, 71, 536, 432, 954, 196, 610, 954, 614, 45, - /* 410 */ 18, 89, 90, 80, 600, 599, 601, 601, 87, 87, - /* 420 */ 88, 88, 88, 88, 261, 86, 86, 86, 86, 85, - /* 430 */ 85, 84, 84, 84, 83, 330, 306, 608, 608, 608, - /* 440 */ 542, 424, 402, 385, 241, 506, 451, 320, 211, 543, - /* 450 */ 164, 436, 386, 293, 451, 587, 108, 496, 111, 334, - /* 460 */ 391, 591, 424, 614, 27, 452, 453, 606, 606, 72, - /* 470 */ 257, 70, 259, 452, 339, 342, 564, 582, 68, 415, - /* 480 */ 469, 328, 327, 62, 614, 45, 110, 393, 89, 90, - /* 490 */ 80, 600, 599, 601, 601, 87, 87, 88, 88, 88, - /* 500 */ 88, 152, 86, 86, 86, 86, 85, 85, 84, 84, - /* 510 */ 84, 83, 330, 306, 110, 499, 520, 538, 402, 389, - /* 520 */ 424, 110, 566, 500, 593, 593, 454, 82, 79, 165, - /* 530 */ 424, 591, 384, 564, 340, 615, 188, 162, 424, 350, - /* 540 */ 616, 424, 614, 44, 606, 606, 445, 582, 300, 434, - /* 550 */ 151, 19, 614, 9, 568, 580, 348, 615, 469, 567, - /* 560 */ 614, 26, 616, 614, 45, 89, 90, 80, 600, 599, - /* 570 */ 601, 601, 87, 87, 88, 88, 88, 88, 411, 86, - /* 580 */ 86, 86, 86, 85, 85, 84, 84, 84, 83, 330, - /* 590 */ 306, 579, 110, 578, 521, 282, 433, 398, 400, 255, - /* 600 */ 486, 82, 79, 165, 487, 164, 82, 79, 165, 488, - /* 610 */ 488, 364, 387, 424, 544, 544, 509, 350, 362, 155, - /* 620 */ 191, 606, 606, 559, 642, 640, 333, 82, 79, 165, - /* 630 */ 305, 564, 507, 312, 357, 614, 45, 329, 596, 595, - /* 640 */ 194, 337, 89, 90, 80, 600, 599, 601, 601, 87, - /* 650 */ 87, 88, 88, 88, 88, 424, 86, 86, 86, 86, - /* 660 */ 85, 85, 84, 84, 84, 83, 330, 306, 20, 323, - /* 670 */ 150, 263, 211, 543, 421, 596, 595, 614, 22, 424, - /* 680 */ 193, 424, 284, 424, 391, 424, 509, 424, 577, 424, - /* 690 */ 186, 335, 424, 559, 424, 313, 120, 546, 606, 606, - /* 700 */ 67, 614, 47, 614, 50, 614, 48, 614, 100, 614, - /* 710 */ 99, 614, 101, 576, 614, 102, 614, 109, 326, 89, - /* 720 */ 90, 80, 600, 599, 601, 601, 87, 87, 88, 88, - /* 730 */ 88, 88, 424, 86, 86, 86, 86, 85, 85, 84, - /* 740 */ 84, 84, 83, 330, 306, 424, 311, 424, 585, 54, - /* 750 */ 424, 516, 517, 590, 614, 112, 424, 584, 424, 572, - /* 760 */ 424, 195, 424, 571, 424, 67, 424, 614, 94, 614, - /* 770 */ 98, 424, 614, 97, 264, 606, 606, 195, 614, 46, - /* 780 */ 614, 96, 614, 30, 614, 49, 614, 115, 614, 114, - /* 790 */ 418, 229, 388, 614, 113, 306, 89, 90, 80, 600, - /* 800 */ 599, 601, 601, 87, 87, 88, 88, 88, 88, 424, - /* 810 */ 86, 86, 86, 86, 85, 85, 84, 84, 84, 83, - /* 820 */ 330, 119, 424, 590, 110, 372, 606, 606, 195, 53, - /* 830 */ 250, 614, 29, 195, 472, 438, 729, 190, 302, 498, - /* 840 */ 14, 523, 641, 2, 614, 43, 306, 89, 90, 80, - /* 850 */ 600, 599, 601, 601, 87, 87, 88, 88, 88, 88, - /* 860 */ 424, 86, 86, 86, 86, 85, 85, 84, 84, 84, - /* 870 */ 83, 330, 424, 613, 964, 964, 354, 606, 606, 420, - /* 880 */ 312, 64, 614, 42, 391, 355, 283, 437, 301, 255, - /* 890 */ 414, 410, 495, 492, 614, 28, 471, 306, 89, 90, - /* 900 */ 80, 600, 599, 601, 601, 87, 87, 88, 88, 88, - /* 910 */ 88, 424, 86, 86, 86, 86, 85, 85, 84, 84, - /* 920 */ 84, 83, 330, 424, 110, 110, 110, 110, 606, 606, - /* 930 */ 110, 254, 13, 614, 41, 532, 531, 283, 481, 531, - /* 940 */ 457, 284, 119, 561, 356, 614, 40, 284, 306, 89, - /* 950 */ 78, 80, 600, 599, 601, 601, 87, 87, 88, 88, - /* 960 */ 88, 88, 424, 86, 86, 86, 86, 85, 85, 84, - /* 970 */ 84, 84, 83, 330, 110, 424, 341, 220, 555, 606, - /* 980 */ 606, 351, 555, 318, 614, 95, 413, 255, 83, 330, - /* 990 */ 284, 284, 255, 640, 333, 356, 255, 614, 39, 306, - /* 1000 */ 356, 90, 80, 600, 599, 601, 601, 87, 87, 88, - /* 1010 */ 88, 88, 88, 424, 86, 86, 86, 86, 85, 85, - /* 1020 */ 84, 84, 84, 83, 330, 424, 317, 316, 141, 465, - /* 1030 */ 606, 606, 219, 619, 463, 614, 10, 417, 462, 255, - /* 1040 */ 189, 510, 553, 351, 207, 363, 161, 614, 38, 315, - /* 1050 */ 218, 255, 255, 80, 600, 599, 601, 601, 87, 87, - /* 1060 */ 88, 88, 88, 88, 424, 86, 86, 86, 86, 85, - /* 1070 */ 85, 84, 84, 84, 83, 330, 76, 419, 255, 3, - /* 1080 */ 878, 461, 424, 247, 331, 331, 614, 37, 217, 76, - /* 1090 */ 419, 390, 3, 216, 215, 422, 4, 331, 331, 424, - /* 1100 */ 547, 12, 424, 545, 614, 36, 424, 541, 422, 424, - /* 1110 */ 540, 424, 214, 424, 408, 424, 539, 403, 605, 605, - /* 1120 */ 237, 614, 25, 119, 614, 24, 588, 408, 614, 45, - /* 1130 */ 118, 614, 35, 614, 34, 614, 33, 614, 23, 588, - /* 1140 */ 60, 223, 603, 602, 513, 378, 73, 74, 140, 139, - /* 1150 */ 424, 110, 265, 75, 426, 425, 59, 424, 610, 73, - /* 1160 */ 74, 549, 402, 404, 424, 373, 75, 426, 425, 604, - /* 1170 */ 138, 610, 614, 11, 392, 76, 419, 181, 3, 614, - /* 1180 */ 32, 271, 369, 331, 331, 493, 614, 31, 149, 608, - /* 1190 */ 608, 608, 607, 15, 422, 365, 614, 8, 137, 489, - /* 1200 */ 136, 190, 608, 608, 608, 607, 15, 485, 176, 135, - /* 1210 */ 7, 252, 477, 408, 174, 133, 175, 474, 57, 56, - /* 1220 */ 132, 130, 119, 76, 419, 588, 3, 468, 245, 464, - /* 1230 */ 171, 331, 331, 125, 123, 456, 447, 122, 446, 104, - /* 1240 */ 336, 231, 422, 166, 154, 73, 74, 332, 116, 431, - /* 1250 */ 121, 309, 75, 426, 425, 222, 106, 610, 308, 637, - /* 1260 */ 204, 408, 629, 627, 628, 6, 200, 428, 427, 290, - /* 1270 */ 203, 622, 201, 588, 62, 63, 289, 66, 419, 399, - /* 1280 */ 3, 401, 288, 92, 143, 331, 331, 287, 608, 608, - /* 1290 */ 608, 607, 15, 73, 74, 227, 422, 325, 69, 416, - /* 1300 */ 75, 426, 425, 612, 412, 610, 192, 61, 569, 209, - /* 1310 */ 396, 226, 278, 225, 383, 408, 527, 558, 276, 533, - /* 1320 */ 552, 528, 321, 523, 370, 508, 180, 588, 494, 179, - /* 1330 */ 366, 117, 253, 269, 522, 503, 608, 608, 608, 607, - /* 1340 */ 15, 551, 502, 58, 274, 524, 178, 73, 74, 304, - /* 1350 */ 501, 368, 303, 206, 75, 426, 425, 491, 360, 610, - /* 1360 */ 213, 177, 483, 131, 345, 298, 297, 296, 202, 294, - /* 1370 */ 480, 490, 466, 134, 172, 129, 444, 346, 470, 128, - /* 1380 */ 314, 459, 103, 127, 126, 148, 124, 167, 443, 235, - /* 1390 */ 608, 608, 608, 607, 15, 442, 439, 623, 234, 299, - /* 1400 */ 145, 583, 291, 377, 581, 160, 119, 156, 270, 636, - /* 1410 */ 971, 169, 279, 626, 520, 625, 473, 624, 170, 621, - /* 1420 */ 618, 119, 168, 55, 409, 423, 537, 609, 286, 285, - /* 1430 */ 405, 570, 560, 556, 5, 52, 458, 554, 147, 267, - /* 1440 */ 519, 504, 518, 406, 262, 239, 260, 512, 343, 511, - /* 1450 */ 258, 353, 565, 256, 224, 251, 359, 277, 275, 476, - /* 1460 */ 475, 246, 352, 244, 467, 455, 236, 233, 232, 307, - /* 1470 */ 441, 281, 205, 163, 397, 280, 535, 505, 330, 617, - /* 1480 */ 971, 971, 971, 971, 367, 971, 971, 971, 971, 971, - /* 1490 */ 971, 971, 971, 971, 971, 971, 338, -}; -static const YYCODETYPE yy_lookahead[] = { - /* 0 */ 19, 22, 22, 23, 1, 24, 26, 15, 27, 80, - /* 10 */ 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, - /* 20 */ 91, 92, 93, 94, 95, 108, 109, 110, 27, 28, - /* 30 */ 23, 50, 51, 80, 81, 82, 83, 122, 85, 86, - /* 40 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 22, - /* 50 */ 70, 23, 71, 72, 73, 74, 75, 76, 77, 78, - /* 60 */ 79, 80, 81, 82, 83, 122, 85, 86, 87, 88, - /* 70 */ 89, 90, 91, 92, 93, 94, 95, 19, 97, 91, - /* 80 */ 92, 93, 94, 95, 26, 85, 86, 87, 88, 89, - /* 90 */ 90, 91, 92, 93, 94, 95, 27, 28, 97, 98, - /* 100 */ 99, 122, 211, 102, 103, 104, 79, 19, 50, 51, - /* 110 */ 19, 122, 59, 55, 113, 224, 225, 226, 89, 90, - /* 120 */ 91, 92, 93, 94, 95, 23, 27, 28, 26, 71, - /* 130 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - /* 140 */ 82, 83, 51, 85, 86, 87, 88, 89, 90, 91, - /* 150 */ 92, 93, 94, 95, 19, 132, 133, 58, 89, 90, - /* 160 */ 21, 108, 109, 110, 27, 28, 97, 98, 33, 100, - /* 170 */ 7, 8, 119, 120, 22, 19, 107, 42, 109, 27, - /* 180 */ 28, 27, 28, 95, 28, 50, 51, 99, 100, 101, - /* 190 */ 102, 103, 104, 105, 27, 28, 97, 98, 107, 152, - /* 200 */ 112, 132, 133, 112, 65, 69, 71, 72, 73, 74, - /* 210 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 11, - /* 220 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - /* 230 */ 95, 19, 101, 97, 97, 98, 24, 101, 122, 157, - /* 240 */ 12, 99, 103, 112, 102, 103, 104, 152, 22, 97, - /* 250 */ 98, 97, 98, 27, 28, 113, 27, 29, 91, 164, - /* 260 */ 165, 124, 50, 51, 97, 98, 219, 59, 132, 133, - /* 270 */ 134, 22, 23, 45, 66, 47, 212, 213, 124, 140, - /* 280 */ 132, 133, 19, 71, 72, 73, 74, 75, 76, 77, - /* 290 */ 78, 79, 80, 81, 82, 83, 152, 85, 86, 87, - /* 300 */ 88, 89, 90, 91, 92, 93, 94, 95, 164, 165, - /* 310 */ 27, 28, 230, 50, 51, 233, 108, 109, 110, 70, - /* 320 */ 16, 59, 23, 97, 98, 26, 97, 22, 66, 185, - /* 330 */ 12, 187, 27, 28, 71, 72, 73, 74, 75, 76, - /* 340 */ 77, 78, 79, 80, 81, 82, 83, 29, 85, 86, - /* 350 */ 87, 88, 89, 90, 91, 92, 93, 94, 95, 19, - /* 360 */ 22, 148, 149, 45, 23, 47, 62, 154, 64, 156, - /* 370 */ 108, 109, 110, 37, 69, 23, 163, 59, 26, 26, - /* 380 */ 97, 98, 144, 145, 146, 147, 152, 200, 52, 23, - /* 390 */ 50, 51, 26, 22, 89, 90, 60, 210, 7, 8, - /* 400 */ 9, 138, 97, 22, 23, 26, 101, 26, 174, 175, - /* 410 */ 197, 71, 72, 73, 74, 75, 76, 77, 78, 79, - /* 420 */ 80, 81, 82, 83, 16, 85, 86, 87, 88, 89, - /* 430 */ 90, 91, 92, 93, 94, 95, 19, 132, 133, 134, - /* 440 */ 23, 152, 208, 209, 140, 152, 152, 111, 195, 196, - /* 450 */ 98, 70, 163, 160, 152, 23, 22, 164, 165, 246, - /* 460 */ 207, 27, 152, 174, 175, 171, 172, 50, 51, 137, - /* 470 */ 62, 139, 64, 171, 172, 222, 124, 27, 138, 24, - /* 480 */ 163, 89, 90, 130, 174, 175, 197, 163, 71, 72, - /* 490 */ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - /* 500 */ 83, 22, 85, 86, 87, 88, 89, 90, 91, 92, - /* 510 */ 93, 94, 95, 19, 197, 181, 182, 23, 208, 209, - /* 520 */ 152, 197, 26, 189, 132, 133, 232, 224, 225, 226, - /* 530 */ 152, 97, 91, 26, 232, 116, 212, 213, 152, 222, - /* 540 */ 121, 152, 174, 175, 50, 51, 243, 97, 22, 23, - /* 550 */ 22, 234, 174, 175, 177, 23, 239, 116, 163, 177, - /* 560 */ 174, 175, 121, 174, 175, 71, 72, 73, 74, 75, - /* 570 */ 76, 77, 78, 79, 80, 81, 82, 83, 24, 85, - /* 580 */ 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, - /* 590 */ 19, 23, 197, 11, 23, 227, 70, 208, 220, 152, - /* 600 */ 31, 224, 225, 226, 35, 98, 224, 225, 226, 108, - /* 610 */ 109, 110, 115, 152, 117, 118, 27, 222, 49, 123, - /* 620 */ 24, 50, 51, 27, 0, 1, 2, 224, 225, 226, - /* 630 */ 166, 124, 168, 169, 239, 174, 175, 170, 171, 172, - /* 640 */ 22, 194, 71, 72, 73, 74, 75, 76, 77, 78, - /* 650 */ 79, 80, 81, 82, 83, 152, 85, 86, 87, 88, - /* 660 */ 89, 90, 91, 92, 93, 94, 95, 19, 22, 208, - /* 670 */ 24, 23, 195, 196, 170, 171, 172, 174, 175, 152, - /* 680 */ 26, 152, 152, 152, 207, 152, 97, 152, 23, 152, - /* 690 */ 51, 244, 152, 97, 152, 247, 248, 23, 50, 51, - /* 700 */ 26, 174, 175, 174, 175, 174, 175, 174, 175, 174, - /* 710 */ 175, 174, 175, 23, 174, 175, 174, 175, 188, 71, - /* 720 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - /* 730 */ 82, 83, 152, 85, 86, 87, 88, 89, 90, 91, - /* 740 */ 92, 93, 94, 95, 19, 152, 107, 152, 33, 24, - /* 750 */ 152, 100, 101, 27, 174, 175, 152, 42, 152, 23, - /* 760 */ 152, 26, 152, 23, 152, 26, 152, 174, 175, 174, - /* 770 */ 175, 152, 174, 175, 23, 50, 51, 26, 174, 175, - /* 780 */ 174, 175, 174, 175, 174, 175, 174, 175, 174, 175, - /* 790 */ 163, 119, 120, 174, 175, 19, 71, 72, 73, 74, - /* 800 */ 75, 76, 77, 78, 79, 80, 81, 82, 83, 152, - /* 810 */ 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, - /* 820 */ 95, 66, 152, 97, 197, 23, 50, 51, 26, 53, - /* 830 */ 23, 174, 175, 26, 23, 23, 23, 26, 26, 26, - /* 840 */ 36, 106, 146, 147, 174, 175, 19, 71, 72, 73, - /* 850 */ 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, - /* 860 */ 152, 85, 86, 87, 88, 89, 90, 91, 92, 93, - /* 870 */ 94, 95, 152, 196, 119, 120, 19, 50, 51, 168, - /* 880 */ 169, 26, 174, 175, 207, 28, 152, 249, 250, 152, - /* 890 */ 163, 163, 163, 163, 174, 175, 163, 19, 71, 72, - /* 900 */ 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, - /* 910 */ 83, 152, 85, 86, 87, 88, 89, 90, 91, 92, - /* 920 */ 93, 94, 95, 152, 197, 197, 197, 197, 50, 51, - /* 930 */ 197, 194, 36, 174, 175, 191, 192, 152, 191, 192, - /* 940 */ 163, 152, 66, 124, 152, 174, 175, 152, 19, 71, - /* 950 */ 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, - /* 960 */ 82, 83, 152, 85, 86, 87, 88, 89, 90, 91, - /* 970 */ 92, 93, 94, 95, 197, 152, 100, 188, 152, 50, - /* 980 */ 51, 152, 152, 188, 174, 175, 252, 152, 94, 95, - /* 990 */ 152, 152, 152, 1, 2, 152, 152, 174, 175, 19, - /* 1000 */ 152, 72, 73, 74, 75, 76, 77, 78, 79, 80, - /* 1010 */ 81, 82, 83, 152, 85, 86, 87, 88, 89, 90, - /* 1020 */ 91, 92, 93, 94, 95, 152, 188, 188, 22, 194, - /* 1030 */ 50, 51, 240, 173, 194, 174, 175, 252, 194, 152, - /* 1040 */ 36, 181, 28, 152, 23, 219, 122, 174, 175, 219, - /* 1050 */ 221, 152, 152, 73, 74, 75, 76, 77, 78, 79, - /* 1060 */ 80, 81, 82, 83, 152, 85, 86, 87, 88, 89, - /* 1070 */ 90, 91, 92, 93, 94, 95, 19, 20, 152, 22, - /* 1080 */ 23, 194, 152, 240, 27, 28, 174, 175, 240, 19, - /* 1090 */ 20, 26, 22, 194, 194, 38, 22, 27, 28, 152, - /* 1100 */ 23, 22, 152, 116, 174, 175, 152, 23, 38, 152, - /* 1110 */ 23, 152, 221, 152, 57, 152, 23, 163, 50, 51, - /* 1120 */ 194, 174, 175, 66, 174, 175, 69, 57, 174, 175, - /* 1130 */ 40, 174, 175, 174, 175, 174, 175, 174, 175, 69, - /* 1140 */ 22, 53, 74, 75, 30, 53, 89, 90, 22, 22, - /* 1150 */ 152, 197, 23, 96, 97, 98, 22, 152, 101, 89, - /* 1160 */ 90, 91, 208, 209, 152, 53, 96, 97, 98, 101, - /* 1170 */ 22, 101, 174, 175, 152, 19, 20, 105, 22, 174, - /* 1180 */ 175, 112, 19, 27, 28, 20, 174, 175, 24, 132, - /* 1190 */ 133, 134, 135, 136, 38, 44, 174, 175, 107, 61, - /* 1200 */ 54, 26, 132, 133, 134, 135, 136, 54, 107, 22, - /* 1210 */ 5, 140, 1, 57, 36, 111, 122, 28, 79, 79, - /* 1220 */ 131, 123, 66, 19, 20, 69, 22, 1, 16, 20, - /* 1230 */ 125, 27, 28, 123, 111, 120, 23, 131, 23, 16, - /* 1240 */ 68, 142, 38, 15, 22, 89, 90, 3, 167, 4, - /* 1250 */ 248, 251, 96, 97, 98, 180, 180, 101, 251, 151, - /* 1260 */ 6, 57, 151, 13, 151, 26, 25, 151, 161, 202, - /* 1270 */ 153, 162, 153, 69, 130, 128, 203, 19, 20, 127, - /* 1280 */ 22, 126, 204, 129, 22, 27, 28, 205, 132, 133, - /* 1290 */ 134, 135, 136, 89, 90, 231, 38, 95, 137, 179, - /* 1300 */ 96, 97, 98, 206, 179, 101, 122, 107, 159, 159, - /* 1310 */ 125, 231, 216, 228, 107, 57, 184, 217, 216, 176, - /* 1320 */ 217, 176, 48, 106, 18, 184, 158, 69, 159, 158, - /* 1330 */ 46, 71, 237, 176, 176, 176, 132, 133, 134, 135, - /* 1340 */ 136, 217, 176, 137, 216, 178, 158, 89, 90, 179, - /* 1350 */ 176, 159, 179, 159, 96, 97, 98, 159, 159, 101, - /* 1360 */ 5, 158, 202, 22, 18, 10, 11, 12, 13, 14, - /* 1370 */ 190, 238, 17, 190, 158, 193, 41, 159, 202, 193, - /* 1380 */ 159, 202, 245, 193, 193, 223, 190, 32, 159, 34, - /* 1390 */ 132, 133, 134, 135, 136, 159, 39, 155, 43, 150, - /* 1400 */ 223, 177, 201, 178, 177, 186, 66, 199, 177, 152, - /* 1410 */ 253, 56, 215, 152, 182, 152, 202, 152, 63, 152, - /* 1420 */ 152, 66, 67, 242, 229, 152, 174, 152, 152, 152, - /* 1430 */ 152, 152, 152, 152, 199, 242, 202, 152, 198, 152, - /* 1440 */ 152, 152, 183, 192, 152, 215, 152, 183, 215, 183, - /* 1450 */ 152, 241, 214, 152, 211, 152, 152, 211, 211, 152, - /* 1460 */ 152, 241, 152, 152, 152, 152, 152, 152, 152, 114, - /* 1470 */ 152, 152, 235, 152, 152, 152, 174, 187, 95, 174, - /* 1480 */ 253, 253, 253, 253, 236, 253, 253, 253, 253, 253, - /* 1490 */ 253, 253, 253, 253, 253, 253, 141, -}; -#define YY_SHIFT_USE_DFLT (-86) -#define YY_SHIFT_COUNT (429) -#define YY_SHIFT_MIN (-85) -#define YY_SHIFT_MAX (1383) -static const short yy_shift_ofst[] = { - /* 0 */ 992, 1057, 1355, 1156, 1204, 1204, 1, 262, -19, 135, - /* 10 */ 135, 776, 1204, 1204, 1204, 1204, 69, 69, 53, 208, - /* 20 */ 283, 755, 58, 725, 648, 571, 494, 417, 340, 263, - /* 30 */ 212, 827, 827, 827, 827, 827, 827, 827, 827, 827, - /* 40 */ 827, 827, 827, 827, 827, 827, 878, 827, 929, 980, - /* 50 */ 980, 1070, 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, - /* 60 */ 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, - /* 70 */ 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, - /* 80 */ 1258, 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, 1204, - /* 90 */ 1204, 1204, 1204, 1204, -71, -47, -47, -47, -47, -47, - /* 100 */ 0, 29, -12, 283, 283, 139, 91, 392, 392, 894, - /* 110 */ 672, 726, 1383, -86, -86, -86, 88, 318, 318, 99, - /* 120 */ 381, -20, 283, 283, 283, 283, 283, 283, 283, 283, - /* 130 */ 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - /* 140 */ 283, 283, 283, 283, 624, 876, 726, 672, 1340, 1340, - /* 150 */ 1340, 1340, 1340, 1340, -86, -86, -86, 305, 136, 136, - /* 160 */ 142, 167, 226, 154, 137, 152, 283, 283, 283, 283, - /* 170 */ 283, 283, 283, 283, 283, 283, 283, 283, 283, 283, - /* 180 */ 283, 283, 283, 336, 336, 336, 283, 283, 352, 283, - /* 190 */ 283, 283, 283, 283, 228, 283, 283, 283, 283, 283, - /* 200 */ 283, 283, 283, 283, 283, 501, 569, 596, 596, 596, - /* 210 */ 507, 497, 441, 391, 353, 156, 156, 857, 353, 857, - /* 220 */ 735, 813, 639, 715, 156, 332, 715, 715, 496, 419, - /* 230 */ 646, 1357, 1184, 1184, 1335, 1335, 1184, 1341, 1260, 1144, - /* 240 */ 1346, 1346, 1346, 1346, 1184, 1306, 1144, 1341, 1260, 1260, - /* 250 */ 1144, 1184, 1306, 1206, 1284, 1184, 1184, 1306, 1184, 1306, - /* 260 */ 1184, 1306, 1262, 1207, 1207, 1207, 1274, 1262, 1207, 1217, - /* 270 */ 1207, 1274, 1207, 1207, 1185, 1200, 1185, 1200, 1185, 1200, - /* 280 */ 1184, 1184, 1161, 1262, 1202, 1202, 1262, 1154, 1155, 1147, - /* 290 */ 1152, 1144, 1241, 1239, 1250, 1250, 1254, 1254, 1254, 1254, - /* 300 */ -86, -86, -86, -86, -86, -86, 1068, 304, 526, 249, - /* 310 */ 408, -83, 434, 812, 27, 811, 807, 802, 751, 589, - /* 320 */ 651, 163, 131, 674, 366, 450, 299, 148, 23, 102, - /* 330 */ 229, -21, 1245, 1244, 1222, 1099, 1228, 1172, 1223, 1215, - /* 340 */ 1213, 1115, 1106, 1123, 1110, 1209, 1105, 1212, 1226, 1098, - /* 350 */ 1089, 1140, 1139, 1104, 1189, 1178, 1094, 1211, 1205, 1187, - /* 360 */ 1101, 1071, 1153, 1175, 1146, 1138, 1151, 1091, 1164, 1165, - /* 370 */ 1163, 1069, 1072, 1148, 1112, 1134, 1127, 1129, 1126, 1092, - /* 380 */ 1114, 1118, 1088, 1090, 1093, 1087, 1084, 987, 1079, 1077, - /* 390 */ 1074, 1065, 924, 1021, 1014, 1004, 1006, 819, 739, 896, - /* 400 */ 855, 804, 739, 740, 736, 690, 654, 665, 618, 582, - /* 410 */ 568, 528, 554, 379, 532, 479, 455, 379, 432, 371, - /* 420 */ 341, 28, 338, 116, -11, -57, -85, 7, -8, 3, -}; -#define YY_REDUCE_USE_DFLT (-110) -#define YY_REDUCE_COUNT (305) -#define YY_REDUCE_MIN (-109) -#define YY_REDUCE_MAX (1323) -static const short yy_reduce_ofst[] = { - /* 0 */ 238, 954, 213, 289, 310, 234, 144, 317, -109, 382, - /* 10 */ 377, 303, 461, 389, 378, 368, 302, 294, 253, 395, - /* 20 */ 293, 324, 403, 403, 403, 403, 403, 403, 403, 403, - /* 30 */ 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - /* 40 */ 403, 403, 403, 403, 403, 403, 403, 403, 403, 403, - /* 50 */ 403, 1022, 1012, 1005, 998, 963, 961, 959, 957, 950, - /* 60 */ 947, 930, 912, 873, 861, 823, 810, 771, 759, 720, - /* 70 */ 708, 670, 657, 619, 614, 612, 610, 608, 606, 604, - /* 80 */ 598, 595, 593, 580, 542, 540, 537, 535, 533, 531, - /* 90 */ 529, 527, 503, 386, 403, 403, 403, 403, 403, 403, - /* 100 */ 403, 403, 403, 95, 447, 82, 334, 504, 467, 403, - /* 110 */ 477, 464, 403, 403, 403, 403, 860, 747, 744, 785, - /* 120 */ 638, 638, 926, 891, 900, 899, 887, 844, 840, 835, - /* 130 */ 848, 830, 843, 829, 792, 839, 826, 737, 838, 795, - /* 140 */ 789, 47, 734, 530, 696, 777, 711, 677, 733, 730, - /* 150 */ 729, 728, 727, 627, 448, 64, 187, 1305, 1302, 1252, - /* 160 */ 1290, 1273, 1323, 1322, 1321, 1319, 1318, 1316, 1315, 1314, - /* 170 */ 1313, 1312, 1311, 1310, 1308, 1307, 1304, 1303, 1301, 1298, - /* 180 */ 1294, 1292, 1289, 1266, 1264, 1259, 1288, 1287, 1238, 1285, - /* 190 */ 1281, 1280, 1279, 1278, 1251, 1277, 1276, 1275, 1273, 1268, - /* 200 */ 1267, 1265, 1263, 1261, 1257, 1248, 1237, 1247, 1246, 1243, - /* 210 */ 1238, 1240, 1235, 1249, 1234, 1233, 1230, 1220, 1214, 1210, - /* 220 */ 1225, 1219, 1232, 1231, 1197, 1195, 1227, 1224, 1201, 1208, - /* 230 */ 1242, 1137, 1236, 1229, 1193, 1181, 1221, 1177, 1196, 1179, - /* 240 */ 1191, 1190, 1186, 1182, 1218, 1216, 1176, 1162, 1183, 1180, - /* 250 */ 1160, 1199, 1203, 1133, 1095, 1198, 1194, 1188, 1192, 1171, - /* 260 */ 1169, 1168, 1173, 1174, 1166, 1159, 1141, 1170, 1158, 1167, - /* 270 */ 1157, 1132, 1145, 1143, 1124, 1128, 1103, 1102, 1100, 1096, - /* 280 */ 1150, 1149, 1085, 1125, 1080, 1064, 1120, 1097, 1082, 1078, - /* 290 */ 1073, 1067, 1109, 1107, 1119, 1117, 1116, 1113, 1111, 1108, - /* 300 */ 1007, 1000, 1002, 1076, 1075, 1081, -}; -static const YYACTIONTYPE yy_default[] = { - /* 0 */ 647, 964, 964, 964, 878, 878, 969, 964, 774, 802, - /* 10 */ 802, 938, 969, 969, 969, 876, 969, 969, 969, 964, - /* 20 */ 969, 778, 808, 969, 969, 969, 969, 969, 969, 969, - /* 30 */ 969, 937, 939, 816, 815, 918, 789, 813, 806, 810, - /* 40 */ 879, 872, 873, 871, 875, 880, 969, 809, 841, 856, - /* 50 */ 840, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 60 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 70 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 80 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 90 */ 969, 969, 969, 969, 850, 855, 862, 854, 851, 843, - /* 100 */ 842, 844, 845, 969, 969, 673, 739, 969, 969, 846, - /* 110 */ 969, 685, 847, 859, 858, 857, 680, 969, 969, 969, - /* 120 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 130 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 140 */ 969, 969, 969, 969, 647, 964, 969, 969, 964, 964, - /* 150 */ 964, 964, 964, 964, 956, 778, 768, 969, 969, 969, - /* 160 */ 969, 969, 969, 969, 969, 969, 969, 944, 942, 969, - /* 170 */ 891, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 180 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 190 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 200 */ 969, 969, 969, 969, 653, 969, 911, 774, 774, 774, - /* 210 */ 776, 754, 766, 655, 812, 791, 791, 923, 812, 923, - /* 220 */ 710, 733, 707, 802, 791, 874, 802, 802, 775, 766, - /* 230 */ 969, 949, 782, 782, 941, 941, 782, 821, 743, 812, - /* 240 */ 750, 750, 750, 750, 782, 670, 812, 821, 743, 743, - /* 250 */ 812, 782, 670, 917, 915, 782, 782, 670, 782, 670, - /* 260 */ 782, 670, 884, 741, 741, 741, 725, 884, 741, 710, - /* 270 */ 741, 725, 741, 741, 795, 790, 795, 790, 795, 790, - /* 280 */ 782, 782, 969, 884, 888, 888, 884, 807, 796, 805, - /* 290 */ 803, 812, 676, 728, 663, 663, 652, 652, 652, 652, - /* 300 */ 961, 961, 956, 712, 712, 695, 969, 969, 969, 969, - /* 310 */ 969, 969, 687, 969, 893, 969, 969, 969, 969, 969, - /* 320 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 330 */ 969, 828, 969, 648, 951, 969, 969, 948, 969, 969, - /* 340 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 350 */ 969, 969, 969, 969, 969, 969, 921, 969, 969, 969, - /* 360 */ 969, 969, 969, 914, 913, 969, 969, 969, 969, 969, - /* 370 */ 969, 969, 969, 969, 969, 969, 969, 969, 969, 969, - /* 380 */ 969, 969, 969, 969, 969, 969, 969, 757, 969, 969, - /* 390 */ 969, 761, 969, 969, 969, 969, 969, 969, 804, 969, - /* 400 */ 797, 969, 877, 969, 969, 969, 969, 969, 969, 969, - /* 410 */ 969, 969, 969, 966, 969, 969, 969, 965, 969, 969, - /* 420 */ 969, 969, 969, 830, 969, 829, 833, 969, 661, 969, - /* 430 */ 644, 649, 960, 963, 962, 959, 958, 957, 952, 950, - /* 440 */ 947, 946, 945, 943, 940, 936, 897, 895, 902, 901, - /* 450 */ 900, 899, 898, 896, 894, 892, 818, 817, 814, 811, - /* 460 */ 753, 935, 890, 752, 749, 748, 669, 953, 920, 929, - /* 470 */ 928, 927, 822, 926, 925, 924, 922, 919, 906, 820, - /* 480 */ 819, 744, 882, 881, 672, 910, 909, 908, 912, 916, - /* 490 */ 907, 784, 751, 671, 668, 675, 679, 731, 732, 740, - /* 500 */ 738, 737, 736, 735, 734, 730, 681, 686, 724, 709, - /* 510 */ 708, 717, 716, 722, 721, 720, 719, 718, 715, 714, - /* 520 */ 713, 706, 705, 711, 704, 727, 726, 723, 703, 747, - /* 530 */ 746, 745, 742, 702, 701, 700, 833, 699, 698, 838, - /* 540 */ 837, 866, 826, 755, 759, 758, 762, 763, 771, 770, - /* 550 */ 769, 780, 781, 793, 792, 824, 823, 794, 779, 773, - /* 560 */ 772, 788, 787, 786, 785, 777, 767, 799, 798, 868, - /* 570 */ 783, 867, 865, 934, 933, 932, 931, 930, 870, 967, - /* 580 */ 968, 887, 889, 886, 801, 800, 885, 869, 839, 836, - /* 590 */ 690, 691, 905, 904, 903, 693, 692, 689, 688, 863, - /* 600 */ 860, 852, 864, 861, 853, 849, 848, 834, 832, 831, - /* 610 */ 827, 835, 760, 756, 825, 765, 764, 697, 696, 694, - /* 620 */ 678, 677, 674, 667, 665, 664, 666, 662, 660, 659, - /* 630 */ 658, 657, 656, 684, 683, 682, 654, 651, 650, 646, - /* 640 */ 645, 643, -}; - -/* The next table maps tokens into fallback tokens. If a construct -** like the following: -** -** %fallback ID X Y Z. -** -** appears in the grammar, then ID becomes a fallback token for X, Y, -** and Z. Whenever one of the tokens X, Y, or Z is input to the parser -** but it does not parse, the type of the token is changed to ID and -** the parse is retried before an error is thrown. -*/ -#ifdef YYFALLBACK -static const YYCODETYPE yyFallback[] = { - 0, /* $ => nothing */ - 0, /* SEMI => nothing */ - 27, /* EXPLAIN => ID */ - 27, /* QUERY => ID */ - 27, /* PLAN => ID */ - 27, /* BEGIN => ID */ - 0, /* TRANSACTION => nothing */ - 27, /* DEFERRED => ID */ - 27, /* IMMEDIATE => ID */ - 27, /* EXCLUSIVE => ID */ - 0, /* COMMIT => nothing */ - 27, /* END => ID */ - 27, /* ROLLBACK => ID */ - 27, /* SAVEPOINT => ID */ - 27, /* RELEASE => ID */ - 0, /* TO => nothing */ - 0, /* TABLE => nothing */ - 0, /* CREATE => nothing */ - 27, /* IF => ID */ - 0, /* NOT => nothing */ - 0, /* EXISTS => nothing */ - 27, /* TEMP => ID */ - 0, /* LP => nothing */ - 0, /* RP => nothing */ - 0, /* AS => nothing */ - 27, /* WITHOUT => ID */ - 0, /* COMMA => nothing */ - 0, /* ID => nothing */ - 0, /* INDEXED => nothing */ - 27, /* ABORT => ID */ - 27, /* ACTION => ID */ - 27, /* AFTER => ID */ - 27, /* ANALYZE => ID */ - 27, /* ASC => ID */ - 27, /* ATTACH => ID */ - 27, /* BEFORE => ID */ - 27, /* BY => ID */ - 27, /* CASCADE => ID */ - 27, /* CAST => ID */ - 27, /* COLUMNKW => ID */ - 27, /* CONFLICT => ID */ - 27, /* DATABASE => ID */ - 27, /* DESC => ID */ - 27, /* DETACH => ID */ - 27, /* EACH => ID */ - 27, /* FAIL => ID */ - 27, /* FOR => ID */ - 27, /* IGNORE => ID */ - 27, /* INITIALLY => ID */ - 27, /* INSTEAD => ID */ - 27, /* LIKE_KW => ID */ - 27, /* MATCH => ID */ - 27, /* NO => ID */ - 27, /* KEY => ID */ - 27, /* OF => ID */ - 27, /* OFFSET => ID */ - 27, /* PRAGMA => ID */ - 27, /* RAISE => ID */ - 27, /* RECURSIVE => ID */ - 27, /* REPLACE => ID */ - 27, /* RESTRICT => ID */ - 27, /* ROW => ID */ - 27, /* TRIGGER => ID */ - 27, /* VACUUM => ID */ - 27, /* VIEW => ID */ - 27, /* VIRTUAL => ID */ - 27, /* WITH => ID */ - 27, /* REINDEX => ID */ - 27, /* RENAME => ID */ - 27, /* CTIME_KW => ID */ -}; -#endif /* YYFALLBACK */ - -/* The following structure represents a single element of the -** parser's stack. Information stored includes: -** -** + The state number for the parser at this level of the stack. -** -** + The value of the token stored at this level of the stack. -** (In other words, the "major" token.) -** -** + The semantic value stored at this level of the stack. This is -** the information used by the action routines in the grammar. -** It is sometimes called the "minor" token. -*/ -struct yyStackEntry { - YYACTIONTYPE stateno; /* The state-number */ - YYCODETYPE major; /* The major token value. This is the code - ** number for the token at this stack level */ - YYMINORTYPE minor; /* The user-supplied minor token value. This - ** is the value of the token */ -}; -typedef struct yyStackEntry yyStackEntry; - -/* The state of the parser is completely contained in an instance of -** the following structure */ -struct yyParser { - int yyidx; /* Index of top element in stack */ -#ifdef YYTRACKMAXSTACKDEPTH - int yyidxMax; /* Maximum value of yyidx */ -#endif - int yyerrcnt; /* Shifts left before out of the error */ - sqlite3ParserARG_SDECL /* A place to hold %extra_argument */ -#if YYSTACKDEPTH<=0 - int yystksz; /* Current side of the stack */ - yyStackEntry *yystack; /* The parser's stack */ -#else - yyStackEntry yystack[YYSTACKDEPTH]; /* The parser's stack */ -#endif -}; -typedef struct yyParser yyParser; - -#ifndef NDEBUG -/* #include */ -static FILE *yyTraceFILE = 0; -static char *yyTracePrompt = 0; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* -** Turn parser tracing on by giving a stream to which to write the trace -** and a prompt to preface each trace message. Tracing is turned off -** by making either argument NULL -** -** Inputs: -**
      -**
    • A FILE* to which trace output should be written. -** If NULL, then tracing is turned off. -**
    • A prefix string written at the beginning of every -** line of trace output. If NULL, then tracing is -** turned off. -**
    -** -** Outputs: -** None. -*/ -SQLITE_PRIVATE void sqlite3ParserTrace(FILE *TraceFILE, char *zTracePrompt){ - yyTraceFILE = TraceFILE; - yyTracePrompt = zTracePrompt; - if( yyTraceFILE==0 ) yyTracePrompt = 0; - else if( yyTracePrompt==0 ) yyTraceFILE = 0; -} -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing shifts, the names of all terminals and nonterminals -** are required. The following table supplies these names */ -static const char *const yyTokenName[] = { - "$", "SEMI", "EXPLAIN", "QUERY", - "PLAN", "BEGIN", "TRANSACTION", "DEFERRED", - "IMMEDIATE", "EXCLUSIVE", "COMMIT", "END", - "ROLLBACK", "SAVEPOINT", "RELEASE", "TO", - "TABLE", "CREATE", "IF", "NOT", - "EXISTS", "TEMP", "LP", "RP", - "AS", "WITHOUT", "COMMA", "ID", - "INDEXED", "ABORT", "ACTION", "AFTER", - "ANALYZE", "ASC", "ATTACH", "BEFORE", - "BY", "CASCADE", "CAST", "COLUMNKW", - "CONFLICT", "DATABASE", "DESC", "DETACH", - "EACH", "FAIL", "FOR", "IGNORE", - "INITIALLY", "INSTEAD", "LIKE_KW", "MATCH", - "NO", "KEY", "OF", "OFFSET", - "PRAGMA", "RAISE", "RECURSIVE", "REPLACE", - "RESTRICT", "ROW", "TRIGGER", "VACUUM", - "VIEW", "VIRTUAL", "WITH", "REINDEX", - "RENAME", "CTIME_KW", "ANY", "OR", - "AND", "IS", "BETWEEN", "IN", - "ISNULL", "NOTNULL", "NE", "EQ", - "GT", "LE", "LT", "GE", - "ESCAPE", "BITAND", "BITOR", "LSHIFT", - "RSHIFT", "PLUS", "MINUS", "STAR", - "SLASH", "REM", "CONCAT", "COLLATE", - "BITNOT", "STRING", "JOIN_KW", "CONSTRAINT", - "DEFAULT", "NULL", "PRIMARY", "UNIQUE", - "CHECK", "REFERENCES", "AUTOINCR", "ON", - "INSERT", "DELETE", "UPDATE", "SET", - "DEFERRABLE", "FOREIGN", "DROP", "UNION", - "ALL", "EXCEPT", "INTERSECT", "SELECT", - "VALUES", "DISTINCT", "DOT", "FROM", - "JOIN", "USING", "ORDER", "GROUP", - "HAVING", "LIMIT", "WHERE", "INTO", - "INTEGER", "FLOAT", "BLOB", "VARIABLE", - "CASE", "WHEN", "THEN", "ELSE", - "INDEX", "ALTER", "ADD", "error", - "input", "cmdlist", "ecmd", "explain", - "cmdx", "cmd", "transtype", "trans_opt", - "nm", "savepoint_opt", "create_table", "create_table_args", - "createkw", "temp", "ifnotexists", "dbnm", - "columnlist", "conslist_opt", "table_options", "select", - "column", "columnid", "type", "carglist", - "typetoken", "typename", "signed", "plus_num", - "minus_num", "ccons", "term", "expr", - "onconf", "sortorder", "autoinc", "idxlist_opt", - "refargs", "defer_subclause", "refarg", "refact", - "init_deferred_pred_opt", "conslist", "tconscomma", "tcons", - "idxlist", "defer_subclause_opt", "orconf", "resolvetype", - "raisetype", "ifexists", "fullname", "selectnowith", - "oneselect", "with", "multiselect_op", "distinct", - "selcollist", "from", "where_opt", "groupby_opt", - "having_opt", "orderby_opt", "limit_opt", "values", - "nexprlist", "exprlist", "sclp", "as", - "seltablist", "stl_prefix", "joinop", "indexed_opt", - "on_opt", "using_opt", "joinop2", "idlist", - "sortlist", "setlist", "insert_cmd", "inscollist_opt", - "likeop", "between_op", "in_op", "case_operand", - "case_exprlist", "case_else", "uniqueflag", "collate", - "nmnum", "trigger_decl", "trigger_cmd_list", "trigger_time", - "trigger_event", "foreach_clause", "when_clause", "trigger_cmd", - "trnm", "tridxby", "database_kw_opt", "key_opt", - "add_column_fullname", "kwcolumn_opt", "create_vtab", "vtabarglist", - "vtabarg", "vtabargtoken", "lp", "anylist", - "wqlist", -}; -#endif /* NDEBUG */ - -#ifndef NDEBUG -/* For tracing reduce actions, the names of all rules are required. -*/ -static const char *const yyRuleName[] = { - /* 0 */ "input ::= cmdlist", - /* 1 */ "cmdlist ::= cmdlist ecmd", - /* 2 */ "cmdlist ::= ecmd", - /* 3 */ "ecmd ::= SEMI", - /* 4 */ "ecmd ::= explain cmdx SEMI", - /* 5 */ "explain ::=", - /* 6 */ "explain ::= EXPLAIN", - /* 7 */ "explain ::= EXPLAIN QUERY PLAN", - /* 8 */ "cmdx ::= cmd", - /* 9 */ "cmd ::= BEGIN transtype trans_opt", - /* 10 */ "trans_opt ::=", - /* 11 */ "trans_opt ::= TRANSACTION", - /* 12 */ "trans_opt ::= TRANSACTION nm", - /* 13 */ "transtype ::=", - /* 14 */ "transtype ::= DEFERRED", - /* 15 */ "transtype ::= IMMEDIATE", - /* 16 */ "transtype ::= EXCLUSIVE", - /* 17 */ "cmd ::= COMMIT trans_opt", - /* 18 */ "cmd ::= END trans_opt", - /* 19 */ "cmd ::= ROLLBACK trans_opt", - /* 20 */ "savepoint_opt ::= SAVEPOINT", - /* 21 */ "savepoint_opt ::=", - /* 22 */ "cmd ::= SAVEPOINT nm", - /* 23 */ "cmd ::= RELEASE savepoint_opt nm", - /* 24 */ "cmd ::= ROLLBACK trans_opt TO savepoint_opt nm", - /* 25 */ "cmd ::= create_table create_table_args", - /* 26 */ "create_table ::= createkw temp TABLE ifnotexists nm dbnm", - /* 27 */ "createkw ::= CREATE", - /* 28 */ "ifnotexists ::=", - /* 29 */ "ifnotexists ::= IF NOT EXISTS", - /* 30 */ "temp ::= TEMP", - /* 31 */ "temp ::=", - /* 32 */ "create_table_args ::= LP columnlist conslist_opt RP table_options", - /* 33 */ "create_table_args ::= AS select", - /* 34 */ "table_options ::=", - /* 35 */ "table_options ::= WITHOUT nm", - /* 36 */ "columnlist ::= columnlist COMMA column", - /* 37 */ "columnlist ::= column", - /* 38 */ "column ::= columnid type carglist", - /* 39 */ "columnid ::= nm", - /* 40 */ "nm ::= ID|INDEXED", - /* 41 */ "nm ::= STRING", - /* 42 */ "nm ::= JOIN_KW", - /* 43 */ "type ::=", - /* 44 */ "type ::= typetoken", - /* 45 */ "typetoken ::= typename", - /* 46 */ "typetoken ::= typename LP signed RP", - /* 47 */ "typetoken ::= typename LP signed COMMA signed RP", - /* 48 */ "typename ::= ID|STRING", - /* 49 */ "typename ::= typename ID|STRING", - /* 50 */ "signed ::= plus_num", - /* 51 */ "signed ::= minus_num", - /* 52 */ "carglist ::= carglist ccons", - /* 53 */ "carglist ::=", - /* 54 */ "ccons ::= CONSTRAINT nm", - /* 55 */ "ccons ::= DEFAULT term", - /* 56 */ "ccons ::= DEFAULT LP expr RP", - /* 57 */ "ccons ::= DEFAULT PLUS term", - /* 58 */ "ccons ::= DEFAULT MINUS term", - /* 59 */ "ccons ::= DEFAULT ID|INDEXED", - /* 60 */ "ccons ::= NULL onconf", - /* 61 */ "ccons ::= NOT NULL onconf", - /* 62 */ "ccons ::= PRIMARY KEY sortorder onconf autoinc", - /* 63 */ "ccons ::= UNIQUE onconf", - /* 64 */ "ccons ::= CHECK LP expr RP", - /* 65 */ "ccons ::= REFERENCES nm idxlist_opt refargs", - /* 66 */ "ccons ::= defer_subclause", - /* 67 */ "ccons ::= COLLATE ID|STRING", - /* 68 */ "autoinc ::=", - /* 69 */ "autoinc ::= AUTOINCR", - /* 70 */ "refargs ::=", - /* 71 */ "refargs ::= refargs refarg", - /* 72 */ "refarg ::= MATCH nm", - /* 73 */ "refarg ::= ON INSERT refact", - /* 74 */ "refarg ::= ON DELETE refact", - /* 75 */ "refarg ::= ON UPDATE refact", - /* 76 */ "refact ::= SET NULL", - /* 77 */ "refact ::= SET DEFAULT", - /* 78 */ "refact ::= CASCADE", - /* 79 */ "refact ::= RESTRICT", - /* 80 */ "refact ::= NO ACTION", - /* 81 */ "defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt", - /* 82 */ "defer_subclause ::= DEFERRABLE init_deferred_pred_opt", - /* 83 */ "init_deferred_pred_opt ::=", - /* 84 */ "init_deferred_pred_opt ::= INITIALLY DEFERRED", - /* 85 */ "init_deferred_pred_opt ::= INITIALLY IMMEDIATE", - /* 86 */ "conslist_opt ::=", - /* 87 */ "conslist_opt ::= COMMA conslist", - /* 88 */ "conslist ::= conslist tconscomma tcons", - /* 89 */ "conslist ::= tcons", - /* 90 */ "tconscomma ::= COMMA", - /* 91 */ "tconscomma ::=", - /* 92 */ "tcons ::= CONSTRAINT nm", - /* 93 */ "tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf", - /* 94 */ "tcons ::= UNIQUE LP idxlist RP onconf", - /* 95 */ "tcons ::= CHECK LP expr RP onconf", - /* 96 */ "tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt", - /* 97 */ "defer_subclause_opt ::=", - /* 98 */ "defer_subclause_opt ::= defer_subclause", - /* 99 */ "onconf ::=", - /* 100 */ "onconf ::= ON CONFLICT resolvetype", - /* 101 */ "orconf ::=", - /* 102 */ "orconf ::= OR resolvetype", - /* 103 */ "resolvetype ::= raisetype", - /* 104 */ "resolvetype ::= IGNORE", - /* 105 */ "resolvetype ::= REPLACE", - /* 106 */ "cmd ::= DROP TABLE ifexists fullname", - /* 107 */ "ifexists ::= IF EXISTS", - /* 108 */ "ifexists ::=", - /* 109 */ "cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select", - /* 110 */ "cmd ::= DROP VIEW ifexists fullname", - /* 111 */ "cmd ::= select", - /* 112 */ "select ::= with selectnowith", - /* 113 */ "selectnowith ::= oneselect", - /* 114 */ "selectnowith ::= selectnowith multiselect_op oneselect", - /* 115 */ "multiselect_op ::= UNION", - /* 116 */ "multiselect_op ::= UNION ALL", - /* 117 */ "multiselect_op ::= EXCEPT|INTERSECT", - /* 118 */ "oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt", - /* 119 */ "oneselect ::= values", - /* 120 */ "values ::= VALUES LP nexprlist RP", - /* 121 */ "values ::= values COMMA LP exprlist RP", - /* 122 */ "distinct ::= DISTINCT", - /* 123 */ "distinct ::= ALL", - /* 124 */ "distinct ::=", - /* 125 */ "sclp ::= selcollist COMMA", - /* 126 */ "sclp ::=", - /* 127 */ "selcollist ::= sclp expr as", - /* 128 */ "selcollist ::= sclp STAR", - /* 129 */ "selcollist ::= sclp nm DOT STAR", - /* 130 */ "as ::= AS nm", - /* 131 */ "as ::= ID|STRING", - /* 132 */ "as ::=", - /* 133 */ "from ::=", - /* 134 */ "from ::= FROM seltablist", - /* 135 */ "stl_prefix ::= seltablist joinop", - /* 136 */ "stl_prefix ::=", - /* 137 */ "seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt", - /* 138 */ "seltablist ::= stl_prefix LP select RP as on_opt using_opt", - /* 139 */ "seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt", - /* 140 */ "dbnm ::=", - /* 141 */ "dbnm ::= DOT nm", - /* 142 */ "fullname ::= nm dbnm", - /* 143 */ "joinop ::= COMMA|JOIN", - /* 144 */ "joinop ::= JOIN_KW JOIN", - /* 145 */ "joinop ::= JOIN_KW nm JOIN", - /* 146 */ "joinop ::= JOIN_KW nm nm JOIN", - /* 147 */ "on_opt ::= ON expr", - /* 148 */ "on_opt ::=", - /* 149 */ "indexed_opt ::=", - /* 150 */ "indexed_opt ::= INDEXED BY nm", - /* 151 */ "indexed_opt ::= NOT INDEXED", - /* 152 */ "using_opt ::= USING LP idlist RP", - /* 153 */ "using_opt ::=", - /* 154 */ "orderby_opt ::=", - /* 155 */ "orderby_opt ::= ORDER BY sortlist", - /* 156 */ "sortlist ::= sortlist COMMA expr sortorder", - /* 157 */ "sortlist ::= expr sortorder", - /* 158 */ "sortorder ::= ASC", - /* 159 */ "sortorder ::= DESC", - /* 160 */ "sortorder ::=", - /* 161 */ "groupby_opt ::=", - /* 162 */ "groupby_opt ::= GROUP BY nexprlist", - /* 163 */ "having_opt ::=", - /* 164 */ "having_opt ::= HAVING expr", - /* 165 */ "limit_opt ::=", - /* 166 */ "limit_opt ::= LIMIT expr", - /* 167 */ "limit_opt ::= LIMIT expr OFFSET expr", - /* 168 */ "limit_opt ::= LIMIT expr COMMA expr", - /* 169 */ "cmd ::= with DELETE FROM fullname indexed_opt where_opt", - /* 170 */ "where_opt ::=", - /* 171 */ "where_opt ::= WHERE expr", - /* 172 */ "cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt", - /* 173 */ "setlist ::= setlist COMMA nm EQ expr", - /* 174 */ "setlist ::= nm EQ expr", - /* 175 */ "cmd ::= with insert_cmd INTO fullname inscollist_opt select", - /* 176 */ "cmd ::= with insert_cmd INTO fullname inscollist_opt DEFAULT VALUES", - /* 177 */ "insert_cmd ::= INSERT orconf", - /* 178 */ "insert_cmd ::= REPLACE", - /* 179 */ "inscollist_opt ::=", - /* 180 */ "inscollist_opt ::= LP idlist RP", - /* 181 */ "idlist ::= idlist COMMA nm", - /* 182 */ "idlist ::= nm", - /* 183 */ "expr ::= term", - /* 184 */ "expr ::= LP expr RP", - /* 185 */ "term ::= NULL", - /* 186 */ "expr ::= ID|INDEXED", - /* 187 */ "expr ::= JOIN_KW", - /* 188 */ "expr ::= nm DOT nm", - /* 189 */ "expr ::= nm DOT nm DOT nm", - /* 190 */ "term ::= INTEGER|FLOAT|BLOB", - /* 191 */ "term ::= STRING", - /* 192 */ "expr ::= VARIABLE", - /* 193 */ "expr ::= expr COLLATE ID|STRING", - /* 194 */ "expr ::= CAST LP expr AS typetoken RP", - /* 195 */ "expr ::= ID|INDEXED LP distinct exprlist RP", - /* 196 */ "expr ::= ID|INDEXED LP STAR RP", - /* 197 */ "term ::= CTIME_KW", - /* 198 */ "expr ::= expr AND expr", - /* 199 */ "expr ::= expr OR expr", - /* 200 */ "expr ::= expr LT|GT|GE|LE expr", - /* 201 */ "expr ::= expr EQ|NE expr", - /* 202 */ "expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr", - /* 203 */ "expr ::= expr PLUS|MINUS expr", - /* 204 */ "expr ::= expr STAR|SLASH|REM expr", - /* 205 */ "expr ::= expr CONCAT expr", - /* 206 */ "likeop ::= LIKE_KW|MATCH", - /* 207 */ "likeop ::= NOT LIKE_KW|MATCH", - /* 208 */ "expr ::= expr likeop expr", - /* 209 */ "expr ::= expr likeop expr ESCAPE expr", - /* 210 */ "expr ::= expr ISNULL|NOTNULL", - /* 211 */ "expr ::= expr NOT NULL", - /* 212 */ "expr ::= expr IS expr", - /* 213 */ "expr ::= expr IS NOT expr", - /* 214 */ "expr ::= NOT expr", - /* 215 */ "expr ::= BITNOT expr", - /* 216 */ "expr ::= MINUS expr", - /* 217 */ "expr ::= PLUS expr", - /* 218 */ "between_op ::= BETWEEN", - /* 219 */ "between_op ::= NOT BETWEEN", - /* 220 */ "expr ::= expr between_op expr AND expr", - /* 221 */ "in_op ::= IN", - /* 222 */ "in_op ::= NOT IN", - /* 223 */ "expr ::= expr in_op LP exprlist RP", - /* 224 */ "expr ::= LP select RP", - /* 225 */ "expr ::= expr in_op LP select RP", - /* 226 */ "expr ::= expr in_op nm dbnm", - /* 227 */ "expr ::= EXISTS LP select RP", - /* 228 */ "expr ::= CASE case_operand case_exprlist case_else END", - /* 229 */ "case_exprlist ::= case_exprlist WHEN expr THEN expr", - /* 230 */ "case_exprlist ::= WHEN expr THEN expr", - /* 231 */ "case_else ::= ELSE expr", - /* 232 */ "case_else ::=", - /* 233 */ "case_operand ::= expr", - /* 234 */ "case_operand ::=", - /* 235 */ "exprlist ::= nexprlist", - /* 236 */ "exprlist ::=", - /* 237 */ "nexprlist ::= nexprlist COMMA expr", - /* 238 */ "nexprlist ::= expr", - /* 239 */ "cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP where_opt", - /* 240 */ "uniqueflag ::= UNIQUE", - /* 241 */ "uniqueflag ::=", - /* 242 */ "idxlist_opt ::=", - /* 243 */ "idxlist_opt ::= LP idxlist RP", - /* 244 */ "idxlist ::= idxlist COMMA nm collate sortorder", - /* 245 */ "idxlist ::= nm collate sortorder", - /* 246 */ "collate ::=", - /* 247 */ "collate ::= COLLATE ID|STRING", - /* 248 */ "cmd ::= DROP INDEX ifexists fullname", - /* 249 */ "cmd ::= VACUUM", - /* 250 */ "cmd ::= VACUUM nm", - /* 251 */ "cmd ::= PRAGMA nm dbnm", - /* 252 */ "cmd ::= PRAGMA nm dbnm EQ nmnum", - /* 253 */ "cmd ::= PRAGMA nm dbnm LP nmnum RP", - /* 254 */ "cmd ::= PRAGMA nm dbnm EQ minus_num", - /* 255 */ "cmd ::= PRAGMA nm dbnm LP minus_num RP", - /* 256 */ "nmnum ::= plus_num", - /* 257 */ "nmnum ::= nm", - /* 258 */ "nmnum ::= ON", - /* 259 */ "nmnum ::= DELETE", - /* 260 */ "nmnum ::= DEFAULT", - /* 261 */ "plus_num ::= PLUS INTEGER|FLOAT", - /* 262 */ "plus_num ::= INTEGER|FLOAT", - /* 263 */ "minus_num ::= MINUS INTEGER|FLOAT", - /* 264 */ "cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END", - /* 265 */ "trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause", - /* 266 */ "trigger_time ::= BEFORE", - /* 267 */ "trigger_time ::= AFTER", - /* 268 */ "trigger_time ::= INSTEAD OF", - /* 269 */ "trigger_time ::=", - /* 270 */ "trigger_event ::= DELETE|INSERT", - /* 271 */ "trigger_event ::= UPDATE", - /* 272 */ "trigger_event ::= UPDATE OF idlist", - /* 273 */ "foreach_clause ::=", - /* 274 */ "foreach_clause ::= FOR EACH ROW", - /* 275 */ "when_clause ::=", - /* 276 */ "when_clause ::= WHEN expr", - /* 277 */ "trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI", - /* 278 */ "trigger_cmd_list ::= trigger_cmd SEMI", - /* 279 */ "trnm ::= nm", - /* 280 */ "trnm ::= nm DOT nm", - /* 281 */ "tridxby ::=", - /* 282 */ "tridxby ::= INDEXED BY nm", - /* 283 */ "tridxby ::= NOT INDEXED", - /* 284 */ "trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt", - /* 285 */ "trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select", - /* 286 */ "trigger_cmd ::= DELETE FROM trnm tridxby where_opt", - /* 287 */ "trigger_cmd ::= select", - /* 288 */ "expr ::= RAISE LP IGNORE RP", - /* 289 */ "expr ::= RAISE LP raisetype COMMA nm RP", - /* 290 */ "raisetype ::= ROLLBACK", - /* 291 */ "raisetype ::= ABORT", - /* 292 */ "raisetype ::= FAIL", - /* 293 */ "cmd ::= DROP TRIGGER ifexists fullname", - /* 294 */ "cmd ::= ATTACH database_kw_opt expr AS expr key_opt", - /* 295 */ "cmd ::= DETACH database_kw_opt expr", - /* 296 */ "key_opt ::=", - /* 297 */ "key_opt ::= KEY expr", - /* 298 */ "database_kw_opt ::= DATABASE", - /* 299 */ "database_kw_opt ::=", - /* 300 */ "cmd ::= REINDEX", - /* 301 */ "cmd ::= REINDEX nm dbnm", - /* 302 */ "cmd ::= ANALYZE", - /* 303 */ "cmd ::= ANALYZE nm dbnm", - /* 304 */ "cmd ::= ALTER TABLE fullname RENAME TO nm", - /* 305 */ "cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column", - /* 306 */ "add_column_fullname ::= fullname", - /* 307 */ "kwcolumn_opt ::=", - /* 308 */ "kwcolumn_opt ::= COLUMNKW", - /* 309 */ "cmd ::= create_vtab", - /* 310 */ "cmd ::= create_vtab LP vtabarglist RP", - /* 311 */ "create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm", - /* 312 */ "vtabarglist ::= vtabarg", - /* 313 */ "vtabarglist ::= vtabarglist COMMA vtabarg", - /* 314 */ "vtabarg ::=", - /* 315 */ "vtabarg ::= vtabarg vtabargtoken", - /* 316 */ "vtabargtoken ::= ANY", - /* 317 */ "vtabargtoken ::= lp anylist RP", - /* 318 */ "lp ::= LP", - /* 319 */ "anylist ::=", - /* 320 */ "anylist ::= anylist LP anylist RP", - /* 321 */ "anylist ::= anylist ANY", - /* 322 */ "with ::=", - /* 323 */ "with ::= WITH wqlist", - /* 324 */ "with ::= WITH RECURSIVE wqlist", - /* 325 */ "wqlist ::= nm idxlist_opt AS LP select RP", - /* 326 */ "wqlist ::= wqlist COMMA nm idxlist_opt AS LP select RP", -}; -#endif /* NDEBUG */ - - -#if YYSTACKDEPTH<=0 -/* -** Try to increase the size of the parser stack. -*/ -static void yyGrowStack(yyParser *p){ - int newSize; - yyStackEntry *pNew; - - newSize = p->yystksz*2 + 100; - pNew = realloc(p->yystack, newSize*sizeof(pNew[0])); - if( pNew ){ - p->yystack = pNew; - p->yystksz = newSize; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack grows to %d entries!\n", - yyTracePrompt, p->yystksz); - } -#endif - } -} -#endif - -/* -** This function allocates a new parser. -** The only argument is a pointer to a function which works like -** malloc. -** -** Inputs: -** A pointer to the function used to allocate memory. -** -** Outputs: -** A pointer to a parser. This pointer is used in subsequent calls -** to sqlite3Parser and sqlite3ParserFree. -*/ -SQLITE_PRIVATE void *sqlite3ParserAlloc(void *(*mallocProc)(size_t)){ - yyParser *pParser; - pParser = (yyParser*)(*mallocProc)( (size_t)sizeof(yyParser) ); - if( pParser ){ - pParser->yyidx = -1; -#ifdef YYTRACKMAXSTACKDEPTH - pParser->yyidxMax = 0; -#endif -#if YYSTACKDEPTH<=0 - pParser->yystack = NULL; - pParser->yystksz = 0; - yyGrowStack(pParser); -#endif - } - return pParser; -} - -/* The following function deletes the value associated with a -** symbol. The symbol can be either a terminal or nonterminal. -** "yymajor" is the symbol code, and "yypminor" is a pointer to -** the value. -*/ -static void yy_destructor( - yyParser *yypParser, /* The parser */ - YYCODETYPE yymajor, /* Type code for object to destroy */ - YYMINORTYPE *yypminor /* The object to be destroyed */ -){ - sqlite3ParserARG_FETCH; - switch( yymajor ){ - /* Here is inserted the actions which take place when a - ** terminal or non-terminal is destroyed. This can happen - ** when the symbol is popped from the stack during a - ** reduce or during error processing or when a parser is - ** being destroyed before it is finished parsing. - ** - ** Note: during a reduce, the only symbols destroyed are those - ** which appear on the RHS of the rule, but which are not used - ** inside the C code. - */ - case 163: /* select */ - case 195: /* selectnowith */ - case 196: /* oneselect */ - case 207: /* values */ -{ -sqlite3SelectDelete(pParse->db, (yypminor->yy3)); -} - break; - case 174: /* term */ - case 175: /* expr */ -{ -sqlite3ExprDelete(pParse->db, (yypminor->yy346).pExpr); -} - break; - case 179: /* idxlist_opt */ - case 188: /* idxlist */ - case 200: /* selcollist */ - case 203: /* groupby_opt */ - case 205: /* orderby_opt */ - case 208: /* nexprlist */ - case 209: /* exprlist */ - case 210: /* sclp */ - case 220: /* sortlist */ - case 221: /* setlist */ - case 228: /* case_exprlist */ -{ -sqlite3ExprListDelete(pParse->db, (yypminor->yy14)); -} - break; - case 194: /* fullname */ - case 201: /* from */ - case 212: /* seltablist */ - case 213: /* stl_prefix */ -{ -sqlite3SrcListDelete(pParse->db, (yypminor->yy65)); -} - break; - case 197: /* with */ - case 252: /* wqlist */ -{ -sqlite3WithDelete(pParse->db, (yypminor->yy59)); -} - break; - case 202: /* where_opt */ - case 204: /* having_opt */ - case 216: /* on_opt */ - case 227: /* case_operand */ - case 229: /* case_else */ - case 238: /* when_clause */ - case 243: /* key_opt */ -{ -sqlite3ExprDelete(pParse->db, (yypminor->yy132)); -} - break; - case 217: /* using_opt */ - case 219: /* idlist */ - case 223: /* inscollist_opt */ -{ -sqlite3IdListDelete(pParse->db, (yypminor->yy408)); -} - break; - case 234: /* trigger_cmd_list */ - case 239: /* trigger_cmd */ -{ -sqlite3DeleteTriggerStep(pParse->db, (yypminor->yy473)); -} - break; - case 236: /* trigger_event */ -{ -sqlite3IdListDelete(pParse->db, (yypminor->yy378).b); -} - break; - default: break; /* If no destructor action specified: do nothing */ - } -} - -/* -** Pop the parser's stack once. -** -** If there is a destructor routine associated with the token which -** is popped from the stack, then call it. -** -** Return the major token number for the symbol popped. -*/ -static int yy_pop_parser_stack(yyParser *pParser){ - YYCODETYPE yymajor; - yyStackEntry *yytos = &pParser->yystack[pParser->yyidx]; - - /* There is no mechanism by which the parser stack can be popped below - ** empty in SQLite. */ - if( NEVER(pParser->yyidx<0) ) return 0; -#ifndef NDEBUG - if( yyTraceFILE && pParser->yyidx>=0 ){ - fprintf(yyTraceFILE,"%sPopping %s\n", - yyTracePrompt, - yyTokenName[yytos->major]); - } -#endif - yymajor = yytos->major; - yy_destructor(pParser, yymajor, &yytos->minor); - pParser->yyidx--; - return yymajor; -} - -/* -** Deallocate and destroy a parser. Destructors are all called for -** all stack elements before shutting the parser down. -** -** Inputs: -**
      -**
    • A pointer to the parser. This should be a pointer -** obtained from sqlite3ParserAlloc. -**
    • A pointer to a function used to reclaim memory obtained -** from malloc. -**
    -*/ -SQLITE_PRIVATE void sqlite3ParserFree( - void *p, /* The parser to be deleted */ - void (*freeProc)(void*) /* Function used to reclaim memory */ -){ - yyParser *pParser = (yyParser*)p; - /* In SQLite, we never try to destroy a parser that was not successfully - ** created in the first place. */ - if( NEVER(pParser==0) ) return; - while( pParser->yyidx>=0 ) yy_pop_parser_stack(pParser); -#if YYSTACKDEPTH<=0 - free(pParser->yystack); -#endif - (*freeProc)((void*)pParser); -} - -/* -** Return the peak depth of the stack for a parser. -*/ -#ifdef YYTRACKMAXSTACKDEPTH -SQLITE_PRIVATE int sqlite3ParserStackPeak(void *p){ - yyParser *pParser = (yyParser*)p; - return pParser->yyidxMax; -} -#endif - -/* -** Find the appropriate action for a parser given the terminal -** look-ahead token iLookAhead. -** -** If the look-ahead token is YYNOCODE, then check to see if the action is -** independent of the look-ahead. If it is, return the action, otherwise -** return YY_NO_ACTION. -*/ -static int yy_find_shift_action( - yyParser *pParser, /* The parser */ - YYCODETYPE iLookAhead /* The look-ahead token */ -){ - int i; - int stateno = pParser->yystack[pParser->yyidx].stateno; - - if( stateno>YY_SHIFT_COUNT - || (i = yy_shift_ofst[stateno])==YY_SHIFT_USE_DFLT ){ - return yy_default[stateno]; - } - assert( iLookAhead!=YYNOCODE ); - i += iLookAhead; - if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ - if( iLookAhead>0 ){ -#ifdef YYFALLBACK - YYCODETYPE iFallback; /* Fallback token */ - if( iLookAhead %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[iFallback]); - } -#endif - return yy_find_shift_action(pParser, iFallback); - } -#endif -#ifdef YYWILDCARD - { - int j = i - iLookAhead + YYWILDCARD; - if( -#if YY_SHIFT_MIN+YYWILDCARD<0 - j>=0 && -#endif -#if YY_SHIFT_MAX+YYWILDCARD>=YY_ACTTAB_COUNT - j %s\n", - yyTracePrompt, yyTokenName[iLookAhead], yyTokenName[YYWILDCARD]); - } -#endif /* NDEBUG */ - return yy_action[j]; - } - } -#endif /* YYWILDCARD */ - } - return yy_default[stateno]; - }else{ - return yy_action[i]; - } -} - -/* -** Find the appropriate action for a parser given the non-terminal -** look-ahead token iLookAhead. -** -** If the look-ahead token is YYNOCODE, then check to see if the action is -** independent of the look-ahead. If it is, return the action, otherwise -** return YY_NO_ACTION. -*/ -static int yy_find_reduce_action( - int stateno, /* Current state number */ - YYCODETYPE iLookAhead /* The look-ahead token */ -){ - int i; -#ifdef YYERRORSYMBOL - if( stateno>YY_REDUCE_COUNT ){ - return yy_default[stateno]; - } -#else - assert( stateno<=YY_REDUCE_COUNT ); -#endif - i = yy_reduce_ofst[stateno]; - assert( i!=YY_REDUCE_USE_DFLT ); - assert( iLookAhead!=YYNOCODE ); - i += iLookAhead; -#ifdef YYERRORSYMBOL - if( i<0 || i>=YY_ACTTAB_COUNT || yy_lookahead[i]!=iLookAhead ){ - return yy_default[stateno]; - } -#else - assert( i>=0 && iyyidx--; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sStack Overflow!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will execute if the parser - ** stack every overflows */ - - UNUSED_PARAMETER(yypMinor); /* Silence some compiler warnings */ - sqlite3ErrorMsg(pParse, "parser stack overflow"); - sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument var */ -} - -/* -** Perform a shift action. -*/ -static void yy_shift( - yyParser *yypParser, /* The parser to be shifted */ - int yyNewState, /* The new state to shift in */ - int yyMajor, /* The major token to shift in */ - YYMINORTYPE *yypMinor /* Pointer to the minor token to shift in */ -){ - yyStackEntry *yytos; - yypParser->yyidx++; -#ifdef YYTRACKMAXSTACKDEPTH - if( yypParser->yyidx>yypParser->yyidxMax ){ - yypParser->yyidxMax = yypParser->yyidx; - } -#endif -#if YYSTACKDEPTH>0 - if( yypParser->yyidx>=YYSTACKDEPTH ){ - yyStackOverflow(yypParser, yypMinor); - return; - } -#else - if( yypParser->yyidx>=yypParser->yystksz ){ - yyGrowStack(yypParser); - if( yypParser->yyidx>=yypParser->yystksz ){ - yyStackOverflow(yypParser, yypMinor); - return; - } - } -#endif - yytos = &yypParser->yystack[yypParser->yyidx]; - yytos->stateno = (YYACTIONTYPE)yyNewState; - yytos->major = (YYCODETYPE)yyMajor; - yytos->minor = *yypMinor; -#ifndef NDEBUG - if( yyTraceFILE && yypParser->yyidx>0 ){ - int i; - fprintf(yyTraceFILE,"%sShift %d\n",yyTracePrompt,yyNewState); - fprintf(yyTraceFILE,"%sStack:",yyTracePrompt); - for(i=1; i<=yypParser->yyidx; i++) - fprintf(yyTraceFILE," %s",yyTokenName[yypParser->yystack[i].major]); - fprintf(yyTraceFILE,"\n"); - } -#endif -} - -/* The following table contains information about every rule that -** is used during the reduce. -*/ -static const struct { - YYCODETYPE lhs; /* Symbol on the left-hand side of the rule */ - unsigned char nrhs; /* Number of right-hand side symbols in the rule */ -} yyRuleInfo[] = { - { 144, 1 }, - { 145, 2 }, - { 145, 1 }, - { 146, 1 }, - { 146, 3 }, - { 147, 0 }, - { 147, 1 }, - { 147, 3 }, - { 148, 1 }, - { 149, 3 }, - { 151, 0 }, - { 151, 1 }, - { 151, 2 }, - { 150, 0 }, - { 150, 1 }, - { 150, 1 }, - { 150, 1 }, - { 149, 2 }, - { 149, 2 }, - { 149, 2 }, - { 153, 1 }, - { 153, 0 }, - { 149, 2 }, - { 149, 3 }, - { 149, 5 }, - { 149, 2 }, - { 154, 6 }, - { 156, 1 }, - { 158, 0 }, - { 158, 3 }, - { 157, 1 }, - { 157, 0 }, - { 155, 5 }, - { 155, 2 }, - { 162, 0 }, - { 162, 2 }, - { 160, 3 }, - { 160, 1 }, - { 164, 3 }, - { 165, 1 }, - { 152, 1 }, - { 152, 1 }, - { 152, 1 }, - { 166, 0 }, - { 166, 1 }, - { 168, 1 }, - { 168, 4 }, - { 168, 6 }, - { 169, 1 }, - { 169, 2 }, - { 170, 1 }, - { 170, 1 }, - { 167, 2 }, - { 167, 0 }, - { 173, 2 }, - { 173, 2 }, - { 173, 4 }, - { 173, 3 }, - { 173, 3 }, - { 173, 2 }, - { 173, 2 }, - { 173, 3 }, - { 173, 5 }, - { 173, 2 }, - { 173, 4 }, - { 173, 4 }, - { 173, 1 }, - { 173, 2 }, - { 178, 0 }, - { 178, 1 }, - { 180, 0 }, - { 180, 2 }, - { 182, 2 }, - { 182, 3 }, - { 182, 3 }, - { 182, 3 }, - { 183, 2 }, - { 183, 2 }, - { 183, 1 }, - { 183, 1 }, - { 183, 2 }, - { 181, 3 }, - { 181, 2 }, - { 184, 0 }, - { 184, 2 }, - { 184, 2 }, - { 161, 0 }, - { 161, 2 }, - { 185, 3 }, - { 185, 1 }, - { 186, 1 }, - { 186, 0 }, - { 187, 2 }, - { 187, 7 }, - { 187, 5 }, - { 187, 5 }, - { 187, 10 }, - { 189, 0 }, - { 189, 1 }, - { 176, 0 }, - { 176, 3 }, - { 190, 0 }, - { 190, 2 }, - { 191, 1 }, - { 191, 1 }, - { 191, 1 }, - { 149, 4 }, - { 193, 2 }, - { 193, 0 }, - { 149, 8 }, - { 149, 4 }, - { 149, 1 }, - { 163, 2 }, - { 195, 1 }, - { 195, 3 }, - { 198, 1 }, - { 198, 2 }, - { 198, 1 }, - { 196, 9 }, - { 196, 1 }, - { 207, 4 }, - { 207, 5 }, - { 199, 1 }, - { 199, 1 }, - { 199, 0 }, - { 210, 2 }, - { 210, 0 }, - { 200, 3 }, - { 200, 2 }, - { 200, 4 }, - { 211, 2 }, - { 211, 1 }, - { 211, 0 }, - { 201, 0 }, - { 201, 2 }, - { 213, 2 }, - { 213, 0 }, - { 212, 7 }, - { 212, 7 }, - { 212, 7 }, - { 159, 0 }, - { 159, 2 }, - { 194, 2 }, - { 214, 1 }, - { 214, 2 }, - { 214, 3 }, - { 214, 4 }, - { 216, 2 }, - { 216, 0 }, - { 215, 0 }, - { 215, 3 }, - { 215, 2 }, - { 217, 4 }, - { 217, 0 }, - { 205, 0 }, - { 205, 3 }, - { 220, 4 }, - { 220, 2 }, - { 177, 1 }, - { 177, 1 }, - { 177, 0 }, - { 203, 0 }, - { 203, 3 }, - { 204, 0 }, - { 204, 2 }, - { 206, 0 }, - { 206, 2 }, - { 206, 4 }, - { 206, 4 }, - { 149, 6 }, - { 202, 0 }, - { 202, 2 }, - { 149, 8 }, - { 221, 5 }, - { 221, 3 }, - { 149, 6 }, - { 149, 7 }, - { 222, 2 }, - { 222, 1 }, - { 223, 0 }, - { 223, 3 }, - { 219, 3 }, - { 219, 1 }, - { 175, 1 }, - { 175, 3 }, - { 174, 1 }, - { 175, 1 }, - { 175, 1 }, - { 175, 3 }, - { 175, 5 }, - { 174, 1 }, - { 174, 1 }, - { 175, 1 }, - { 175, 3 }, - { 175, 6 }, - { 175, 5 }, - { 175, 4 }, - { 174, 1 }, - { 175, 3 }, - { 175, 3 }, - { 175, 3 }, - { 175, 3 }, - { 175, 3 }, - { 175, 3 }, - { 175, 3 }, - { 175, 3 }, - { 224, 1 }, - { 224, 2 }, - { 175, 3 }, - { 175, 5 }, - { 175, 2 }, - { 175, 3 }, - { 175, 3 }, - { 175, 4 }, - { 175, 2 }, - { 175, 2 }, - { 175, 2 }, - { 175, 2 }, - { 225, 1 }, - { 225, 2 }, - { 175, 5 }, - { 226, 1 }, - { 226, 2 }, - { 175, 5 }, - { 175, 3 }, - { 175, 5 }, - { 175, 4 }, - { 175, 4 }, - { 175, 5 }, - { 228, 5 }, - { 228, 4 }, - { 229, 2 }, - { 229, 0 }, - { 227, 1 }, - { 227, 0 }, - { 209, 1 }, - { 209, 0 }, - { 208, 3 }, - { 208, 1 }, - { 149, 12 }, - { 230, 1 }, - { 230, 0 }, - { 179, 0 }, - { 179, 3 }, - { 188, 5 }, - { 188, 3 }, - { 231, 0 }, - { 231, 2 }, - { 149, 4 }, - { 149, 1 }, - { 149, 2 }, - { 149, 3 }, - { 149, 5 }, - { 149, 6 }, - { 149, 5 }, - { 149, 6 }, - { 232, 1 }, - { 232, 1 }, - { 232, 1 }, - { 232, 1 }, - { 232, 1 }, - { 171, 2 }, - { 171, 1 }, - { 172, 2 }, - { 149, 5 }, - { 233, 11 }, - { 235, 1 }, - { 235, 1 }, - { 235, 2 }, - { 235, 0 }, - { 236, 1 }, - { 236, 1 }, - { 236, 3 }, - { 237, 0 }, - { 237, 3 }, - { 238, 0 }, - { 238, 2 }, - { 234, 3 }, - { 234, 2 }, - { 240, 1 }, - { 240, 3 }, - { 241, 0 }, - { 241, 3 }, - { 241, 2 }, - { 239, 7 }, - { 239, 5 }, - { 239, 5 }, - { 239, 1 }, - { 175, 4 }, - { 175, 6 }, - { 192, 1 }, - { 192, 1 }, - { 192, 1 }, - { 149, 4 }, - { 149, 6 }, - { 149, 3 }, - { 243, 0 }, - { 243, 2 }, - { 242, 1 }, - { 242, 0 }, - { 149, 1 }, - { 149, 3 }, - { 149, 1 }, - { 149, 3 }, - { 149, 6 }, - { 149, 6 }, - { 244, 1 }, - { 245, 0 }, - { 245, 1 }, - { 149, 1 }, - { 149, 4 }, - { 246, 8 }, - { 247, 1 }, - { 247, 3 }, - { 248, 0 }, - { 248, 2 }, - { 249, 1 }, - { 249, 3 }, - { 250, 1 }, - { 251, 0 }, - { 251, 4 }, - { 251, 2 }, - { 197, 0 }, - { 197, 2 }, - { 197, 3 }, - { 252, 6 }, - { 252, 8 }, -}; - -static void yy_accept(yyParser*); /* Forward Declaration */ - -/* -** Perform a reduce action and the shift that must immediately -** follow the reduce. -*/ -static void yy_reduce( - yyParser *yypParser, /* The parser */ - int yyruleno /* Number of the rule by which to reduce */ -){ - int yygoto; /* The next state */ - int yyact; /* The next action */ - YYMINORTYPE yygotominor; /* The LHS of the rule reduced */ - yyStackEntry *yymsp; /* The top of the parser's stack */ - int yysize; /* Amount to pop the stack */ - sqlite3ParserARG_FETCH; - yymsp = &yypParser->yystack[yypParser->yyidx]; -#ifndef NDEBUG - if( yyTraceFILE && yyruleno>=0 - && yyruleno<(int)(sizeof(yyRuleName)/sizeof(yyRuleName[0])) ){ - fprintf(yyTraceFILE, "%sReduce [%s].\n", yyTracePrompt, - yyRuleName[yyruleno]); - } -#endif /* NDEBUG */ - - /* Silence complaints from purify about yygotominor being uninitialized - ** in some cases when it is copied into the stack after the following - ** switch. yygotominor is uninitialized when a rule reduces that does - ** not set the value of its left-hand side nonterminal. Leaving the - ** value of the nonterminal uninitialized is utterly harmless as long - ** as the value is never used. So really the only thing this code - ** accomplishes is to quieten purify. - ** - ** 2007-01-16: The wireshark project (www.wireshark.org) reports that - ** without this code, their parser segfaults. I'm not sure what there - ** parser is doing to make this happen. This is the second bug report - ** from wireshark this week. Clearly they are stressing Lemon in ways - ** that it has not been previously stressed... (SQLite ticket #2172) - */ - /*memset(&yygotominor, 0, sizeof(yygotominor));*/ - yygotominor = yyzerominor; - - - switch( yyruleno ){ - /* Beginning here are the reduction cases. A typical example - ** follows: - ** case 0: - ** #line - ** { ... } // User supplied code - ** #line - ** break; - */ - case 5: /* explain ::= */ -{ sqlite3BeginParse(pParse, 0); } - break; - case 6: /* explain ::= EXPLAIN */ -{ sqlite3BeginParse(pParse, 1); } - break; - case 7: /* explain ::= EXPLAIN QUERY PLAN */ -{ sqlite3BeginParse(pParse, 2); } - break; - case 8: /* cmdx ::= cmd */ -{ sqlite3FinishCoding(pParse); } - break; - case 9: /* cmd ::= BEGIN transtype trans_opt */ -{sqlite3BeginTransaction(pParse, yymsp[-1].minor.yy328);} - break; - case 13: /* transtype ::= */ -{yygotominor.yy328 = TK_DEFERRED;} - break; - case 14: /* transtype ::= DEFERRED */ - case 15: /* transtype ::= IMMEDIATE */ yytestcase(yyruleno==15); - case 16: /* transtype ::= EXCLUSIVE */ yytestcase(yyruleno==16); - case 115: /* multiselect_op ::= UNION */ yytestcase(yyruleno==115); - case 117: /* multiselect_op ::= EXCEPT|INTERSECT */ yytestcase(yyruleno==117); -{yygotominor.yy328 = yymsp[0].major;} - break; - case 17: /* cmd ::= COMMIT trans_opt */ - case 18: /* cmd ::= END trans_opt */ yytestcase(yyruleno==18); -{sqlite3CommitTransaction(pParse);} - break; - case 19: /* cmd ::= ROLLBACK trans_opt */ -{sqlite3RollbackTransaction(pParse);} - break; - case 22: /* cmd ::= SAVEPOINT nm */ -{ - sqlite3Savepoint(pParse, SAVEPOINT_BEGIN, &yymsp[0].minor.yy0); -} - break; - case 23: /* cmd ::= RELEASE savepoint_opt nm */ -{ - sqlite3Savepoint(pParse, SAVEPOINT_RELEASE, &yymsp[0].minor.yy0); -} - break; - case 24: /* cmd ::= ROLLBACK trans_opt TO savepoint_opt nm */ -{ - sqlite3Savepoint(pParse, SAVEPOINT_ROLLBACK, &yymsp[0].minor.yy0); -} - break; - case 26: /* create_table ::= createkw temp TABLE ifnotexists nm dbnm */ -{ - sqlite3StartTable(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,yymsp[-4].minor.yy328,0,0,yymsp[-2].minor.yy328); -} - break; - case 27: /* createkw ::= CREATE */ -{ - pParse->db->lookaside.bEnabled = 0; - yygotominor.yy0 = yymsp[0].minor.yy0; -} - break; - case 28: /* ifnotexists ::= */ - case 31: /* temp ::= */ yytestcase(yyruleno==31); - case 68: /* autoinc ::= */ yytestcase(yyruleno==68); - case 81: /* defer_subclause ::= NOT DEFERRABLE init_deferred_pred_opt */ yytestcase(yyruleno==81); - case 83: /* init_deferred_pred_opt ::= */ yytestcase(yyruleno==83); - case 85: /* init_deferred_pred_opt ::= INITIALLY IMMEDIATE */ yytestcase(yyruleno==85); - case 97: /* defer_subclause_opt ::= */ yytestcase(yyruleno==97); - case 108: /* ifexists ::= */ yytestcase(yyruleno==108); - case 218: /* between_op ::= BETWEEN */ yytestcase(yyruleno==218); - case 221: /* in_op ::= IN */ yytestcase(yyruleno==221); -{yygotominor.yy328 = 0;} - break; - case 29: /* ifnotexists ::= IF NOT EXISTS */ - case 30: /* temp ::= TEMP */ yytestcase(yyruleno==30); - case 69: /* autoinc ::= AUTOINCR */ yytestcase(yyruleno==69); - case 84: /* init_deferred_pred_opt ::= INITIALLY DEFERRED */ yytestcase(yyruleno==84); - case 107: /* ifexists ::= IF EXISTS */ yytestcase(yyruleno==107); - case 219: /* between_op ::= NOT BETWEEN */ yytestcase(yyruleno==219); - case 222: /* in_op ::= NOT IN */ yytestcase(yyruleno==222); -{yygotominor.yy328 = 1;} - break; - case 32: /* create_table_args ::= LP columnlist conslist_opt RP table_options */ -{ - sqlite3EndTable(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,yymsp[0].minor.yy186,0); -} - break; - case 33: /* create_table_args ::= AS select */ -{ - sqlite3EndTable(pParse,0,0,0,yymsp[0].minor.yy3); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy3); -} - break; - case 34: /* table_options ::= */ -{yygotominor.yy186 = 0;} - break; - case 35: /* table_options ::= WITHOUT nm */ -{ - if( yymsp[0].minor.yy0.n==5 && sqlite3_strnicmp(yymsp[0].minor.yy0.z,"rowid",5)==0 ){ - yygotominor.yy186 = TF_WithoutRowid; - }else{ - yygotominor.yy186 = 0; - sqlite3ErrorMsg(pParse, "unknown table option: %.*s", yymsp[0].minor.yy0.n, yymsp[0].minor.yy0.z); - } -} - break; - case 38: /* column ::= columnid type carglist */ -{ - yygotominor.yy0.z = yymsp[-2].minor.yy0.z; - yygotominor.yy0.n = (int)(pParse->sLastToken.z-yymsp[-2].minor.yy0.z) + pParse->sLastToken.n; -} - break; - case 39: /* columnid ::= nm */ -{ - sqlite3AddColumn(pParse,&yymsp[0].minor.yy0); - yygotominor.yy0 = yymsp[0].minor.yy0; - pParse->constraintName.n = 0; -} - break; - case 40: /* nm ::= ID|INDEXED */ - case 41: /* nm ::= STRING */ yytestcase(yyruleno==41); - case 42: /* nm ::= JOIN_KW */ yytestcase(yyruleno==42); - case 45: /* typetoken ::= typename */ yytestcase(yyruleno==45); - case 48: /* typename ::= ID|STRING */ yytestcase(yyruleno==48); - case 130: /* as ::= AS nm */ yytestcase(yyruleno==130); - case 131: /* as ::= ID|STRING */ yytestcase(yyruleno==131); - case 141: /* dbnm ::= DOT nm */ yytestcase(yyruleno==141); - case 150: /* indexed_opt ::= INDEXED BY nm */ yytestcase(yyruleno==150); - case 247: /* collate ::= COLLATE ID|STRING */ yytestcase(yyruleno==247); - case 256: /* nmnum ::= plus_num */ yytestcase(yyruleno==256); - case 257: /* nmnum ::= nm */ yytestcase(yyruleno==257); - case 258: /* nmnum ::= ON */ yytestcase(yyruleno==258); - case 259: /* nmnum ::= DELETE */ yytestcase(yyruleno==259); - case 260: /* nmnum ::= DEFAULT */ yytestcase(yyruleno==260); - case 261: /* plus_num ::= PLUS INTEGER|FLOAT */ yytestcase(yyruleno==261); - case 262: /* plus_num ::= INTEGER|FLOAT */ yytestcase(yyruleno==262); - case 263: /* minus_num ::= MINUS INTEGER|FLOAT */ yytestcase(yyruleno==263); - case 279: /* trnm ::= nm */ yytestcase(yyruleno==279); -{yygotominor.yy0 = yymsp[0].minor.yy0;} - break; - case 44: /* type ::= typetoken */ -{sqlite3AddColumnType(pParse,&yymsp[0].minor.yy0);} - break; - case 46: /* typetoken ::= typename LP signed RP */ -{ - yygotominor.yy0.z = yymsp[-3].minor.yy0.z; - yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-3].minor.yy0.z); -} - break; - case 47: /* typetoken ::= typename LP signed COMMA signed RP */ -{ - yygotominor.yy0.z = yymsp[-5].minor.yy0.z; - yygotominor.yy0.n = (int)(&yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] - yymsp[-5].minor.yy0.z); -} - break; - case 49: /* typename ::= typename ID|STRING */ -{yygotominor.yy0.z=yymsp[-1].minor.yy0.z; yygotominor.yy0.n=yymsp[0].minor.yy0.n+(int)(yymsp[0].minor.yy0.z-yymsp[-1].minor.yy0.z);} - break; - case 54: /* ccons ::= CONSTRAINT nm */ - case 92: /* tcons ::= CONSTRAINT nm */ yytestcase(yyruleno==92); -{pParse->constraintName = yymsp[0].minor.yy0;} - break; - case 55: /* ccons ::= DEFAULT term */ - case 57: /* ccons ::= DEFAULT PLUS term */ yytestcase(yyruleno==57); -{sqlite3AddDefaultValue(pParse,&yymsp[0].minor.yy346);} - break; - case 56: /* ccons ::= DEFAULT LP expr RP */ -{sqlite3AddDefaultValue(pParse,&yymsp[-1].minor.yy346);} - break; - case 58: /* ccons ::= DEFAULT MINUS term */ -{ - ExprSpan v; - v.pExpr = sqlite3PExpr(pParse, TK_UMINUS, yymsp[0].minor.yy346.pExpr, 0, 0); - v.zStart = yymsp[-1].minor.yy0.z; - v.zEnd = yymsp[0].minor.yy346.zEnd; - sqlite3AddDefaultValue(pParse,&v); -} - break; - case 59: /* ccons ::= DEFAULT ID|INDEXED */ -{ - ExprSpan v; - spanExpr(&v, pParse, TK_STRING, &yymsp[0].minor.yy0); - sqlite3AddDefaultValue(pParse,&v); -} - break; - case 61: /* ccons ::= NOT NULL onconf */ -{sqlite3AddNotNull(pParse, yymsp[0].minor.yy328);} - break; - case 62: /* ccons ::= PRIMARY KEY sortorder onconf autoinc */ -{sqlite3AddPrimaryKey(pParse,0,yymsp[-1].minor.yy328,yymsp[0].minor.yy328,yymsp[-2].minor.yy328);} - break; - case 63: /* ccons ::= UNIQUE onconf */ -{sqlite3CreateIndex(pParse,0,0,0,0,yymsp[0].minor.yy328,0,0,0,0);} - break; - case 64: /* ccons ::= CHECK LP expr RP */ -{sqlite3AddCheckConstraint(pParse,yymsp[-1].minor.yy346.pExpr);} - break; - case 65: /* ccons ::= REFERENCES nm idxlist_opt refargs */ -{sqlite3CreateForeignKey(pParse,0,&yymsp[-2].minor.yy0,yymsp[-1].minor.yy14,yymsp[0].minor.yy328);} - break; - case 66: /* ccons ::= defer_subclause */ -{sqlite3DeferForeignKey(pParse,yymsp[0].minor.yy328);} - break; - case 67: /* ccons ::= COLLATE ID|STRING */ -{sqlite3AddCollateType(pParse, &yymsp[0].minor.yy0);} - break; - case 70: /* refargs ::= */ -{ yygotominor.yy328 = OE_None*0x0101; /* EV: R-19803-45884 */} - break; - case 71: /* refargs ::= refargs refarg */ -{ yygotominor.yy328 = (yymsp[-1].minor.yy328 & ~yymsp[0].minor.yy429.mask) | yymsp[0].minor.yy429.value; } - break; - case 72: /* refarg ::= MATCH nm */ - case 73: /* refarg ::= ON INSERT refact */ yytestcase(yyruleno==73); -{ yygotominor.yy429.value = 0; yygotominor.yy429.mask = 0x000000; } - break; - case 74: /* refarg ::= ON DELETE refact */ -{ yygotominor.yy429.value = yymsp[0].minor.yy328; yygotominor.yy429.mask = 0x0000ff; } - break; - case 75: /* refarg ::= ON UPDATE refact */ -{ yygotominor.yy429.value = yymsp[0].minor.yy328<<8; yygotominor.yy429.mask = 0x00ff00; } - break; - case 76: /* refact ::= SET NULL */ -{ yygotominor.yy328 = OE_SetNull; /* EV: R-33326-45252 */} - break; - case 77: /* refact ::= SET DEFAULT */ -{ yygotominor.yy328 = OE_SetDflt; /* EV: R-33326-45252 */} - break; - case 78: /* refact ::= CASCADE */ -{ yygotominor.yy328 = OE_Cascade; /* EV: R-33326-45252 */} - break; - case 79: /* refact ::= RESTRICT */ -{ yygotominor.yy328 = OE_Restrict; /* EV: R-33326-45252 */} - break; - case 80: /* refact ::= NO ACTION */ -{ yygotominor.yy328 = OE_None; /* EV: R-33326-45252 */} - break; - case 82: /* defer_subclause ::= DEFERRABLE init_deferred_pred_opt */ - case 98: /* defer_subclause_opt ::= defer_subclause */ yytestcase(yyruleno==98); - case 100: /* onconf ::= ON CONFLICT resolvetype */ yytestcase(yyruleno==100); - case 103: /* resolvetype ::= raisetype */ yytestcase(yyruleno==103); -{yygotominor.yy328 = yymsp[0].minor.yy328;} - break; - case 86: /* conslist_opt ::= */ -{yygotominor.yy0.n = 0; yygotominor.yy0.z = 0;} - break; - case 87: /* conslist_opt ::= COMMA conslist */ -{yygotominor.yy0 = yymsp[-1].minor.yy0;} - break; - case 90: /* tconscomma ::= COMMA */ -{pParse->constraintName.n = 0;} - break; - case 93: /* tcons ::= PRIMARY KEY LP idxlist autoinc RP onconf */ -{sqlite3AddPrimaryKey(pParse,yymsp[-3].minor.yy14,yymsp[0].minor.yy328,yymsp[-2].minor.yy328,0);} - break; - case 94: /* tcons ::= UNIQUE LP idxlist RP onconf */ -{sqlite3CreateIndex(pParse,0,0,0,yymsp[-2].minor.yy14,yymsp[0].minor.yy328,0,0,0,0);} - break; - case 95: /* tcons ::= CHECK LP expr RP onconf */ -{sqlite3AddCheckConstraint(pParse,yymsp[-2].minor.yy346.pExpr);} - break; - case 96: /* tcons ::= FOREIGN KEY LP idxlist RP REFERENCES nm idxlist_opt refargs defer_subclause_opt */ -{ - sqlite3CreateForeignKey(pParse, yymsp[-6].minor.yy14, &yymsp[-3].minor.yy0, yymsp[-2].minor.yy14, yymsp[-1].minor.yy328); - sqlite3DeferForeignKey(pParse, yymsp[0].minor.yy328); -} - break; - case 99: /* onconf ::= */ -{yygotominor.yy328 = OE_Default;} - break; - case 101: /* orconf ::= */ -{yygotominor.yy186 = OE_Default;} - break; - case 102: /* orconf ::= OR resolvetype */ -{yygotominor.yy186 = (u8)yymsp[0].minor.yy328;} - break; - case 104: /* resolvetype ::= IGNORE */ -{yygotominor.yy328 = OE_Ignore;} - break; - case 105: /* resolvetype ::= REPLACE */ -{yygotominor.yy328 = OE_Replace;} - break; - case 106: /* cmd ::= DROP TABLE ifexists fullname */ -{ - sqlite3DropTable(pParse, yymsp[0].minor.yy65, 0, yymsp[-1].minor.yy328); -} - break; - case 109: /* cmd ::= createkw temp VIEW ifnotexists nm dbnm AS select */ -{ - sqlite3CreateView(pParse, &yymsp[-7].minor.yy0, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, yymsp[0].minor.yy3, yymsp[-6].minor.yy328, yymsp[-4].minor.yy328); -} - break; - case 110: /* cmd ::= DROP VIEW ifexists fullname */ -{ - sqlite3DropTable(pParse, yymsp[0].minor.yy65, 1, yymsp[-1].minor.yy328); -} - break; - case 111: /* cmd ::= select */ -{ - SelectDest dest = {SRT_Output, 0, 0, 0, 0, 0}; - sqlite3Select(pParse, yymsp[0].minor.yy3, &dest); - sqlite3ExplainBegin(pParse->pVdbe); - sqlite3ExplainSelect(pParse->pVdbe, yymsp[0].minor.yy3); - sqlite3ExplainFinish(pParse->pVdbe); - sqlite3SelectDelete(pParse->db, yymsp[0].minor.yy3); -} - break; - case 112: /* select ::= with selectnowith */ -{ - if( yymsp[0].minor.yy3 ){ - yymsp[0].minor.yy3->pWith = yymsp[-1].minor.yy59; - }else{ - sqlite3WithDelete(pParse->db, yymsp[-1].minor.yy59); - } - yygotominor.yy3 = yymsp[0].minor.yy3; -} - break; - case 113: /* selectnowith ::= oneselect */ - case 119: /* oneselect ::= values */ yytestcase(yyruleno==119); -{yygotominor.yy3 = yymsp[0].minor.yy3;} - break; - case 114: /* selectnowith ::= selectnowith multiselect_op oneselect */ -{ - if( yymsp[0].minor.yy3 ){ - yymsp[0].minor.yy3->op = (u8)yymsp[-1].minor.yy328; - yymsp[0].minor.yy3->pPrior = yymsp[-2].minor.yy3; - if( yymsp[-1].minor.yy328!=TK_ALL ) pParse->hasCompound = 1; - }else{ - sqlite3SelectDelete(pParse->db, yymsp[-2].minor.yy3); - } - yygotominor.yy3 = yymsp[0].minor.yy3; -} - break; - case 116: /* multiselect_op ::= UNION ALL */ -{yygotominor.yy328 = TK_ALL;} - break; - case 118: /* oneselect ::= SELECT distinct selcollist from where_opt groupby_opt having_opt orderby_opt limit_opt */ -{ - yygotominor.yy3 = sqlite3SelectNew(pParse,yymsp[-6].minor.yy14,yymsp[-5].minor.yy65,yymsp[-4].minor.yy132,yymsp[-3].minor.yy14,yymsp[-2].minor.yy132,yymsp[-1].minor.yy14,yymsp[-7].minor.yy381,yymsp[0].minor.yy476.pLimit,yymsp[0].minor.yy476.pOffset); -} - break; - case 120: /* values ::= VALUES LP nexprlist RP */ -{ - yygotominor.yy3 = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0,0); -} - break; - case 121: /* values ::= values COMMA LP exprlist RP */ -{ - Select *pRight = sqlite3SelectNew(pParse,yymsp[-1].minor.yy14,0,0,0,0,0,SF_Values,0,0); - if( pRight ){ - pRight->op = TK_ALL; - pRight->pPrior = yymsp[-4].minor.yy3; - yygotominor.yy3 = pRight; - }else{ - yygotominor.yy3 = yymsp[-4].minor.yy3; - } -} - break; - case 122: /* distinct ::= DISTINCT */ -{yygotominor.yy381 = SF_Distinct;} - break; - case 123: /* distinct ::= ALL */ - case 124: /* distinct ::= */ yytestcase(yyruleno==124); -{yygotominor.yy381 = 0;} - break; - case 125: /* sclp ::= selcollist COMMA */ - case 243: /* idxlist_opt ::= LP idxlist RP */ yytestcase(yyruleno==243); -{yygotominor.yy14 = yymsp[-1].minor.yy14;} - break; - case 126: /* sclp ::= */ - case 154: /* orderby_opt ::= */ yytestcase(yyruleno==154); - case 161: /* groupby_opt ::= */ yytestcase(yyruleno==161); - case 236: /* exprlist ::= */ yytestcase(yyruleno==236); - case 242: /* idxlist_opt ::= */ yytestcase(yyruleno==242); -{yygotominor.yy14 = 0;} - break; - case 127: /* selcollist ::= sclp expr as */ -{ - yygotominor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-2].minor.yy14, yymsp[-1].minor.yy346.pExpr); - if( yymsp[0].minor.yy0.n>0 ) sqlite3ExprListSetName(pParse, yygotominor.yy14, &yymsp[0].minor.yy0, 1); - sqlite3ExprListSetSpan(pParse,yygotominor.yy14,&yymsp[-1].minor.yy346); -} - break; - case 128: /* selcollist ::= sclp STAR */ -{ - Expr *p = sqlite3Expr(pParse->db, TK_ALL, 0); - yygotominor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-1].minor.yy14, p); -} - break; - case 129: /* selcollist ::= sclp nm DOT STAR */ -{ - Expr *pRight = sqlite3PExpr(pParse, TK_ALL, 0, 0, &yymsp[0].minor.yy0); - Expr *pLeft = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); - Expr *pDot = sqlite3PExpr(pParse, TK_DOT, pLeft, pRight, 0); - yygotominor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14, pDot); -} - break; - case 132: /* as ::= */ -{yygotominor.yy0.n = 0;} - break; - case 133: /* from ::= */ -{yygotominor.yy65 = sqlite3DbMallocZero(pParse->db, sizeof(*yygotominor.yy65));} - break; - case 134: /* from ::= FROM seltablist */ -{ - yygotominor.yy65 = yymsp[0].minor.yy65; - sqlite3SrcListShiftJoinType(yygotominor.yy65); -} - break; - case 135: /* stl_prefix ::= seltablist joinop */ -{ - yygotominor.yy65 = yymsp[-1].minor.yy65; - if( ALWAYS(yygotominor.yy65 && yygotominor.yy65->nSrc>0) ) yygotominor.yy65->a[yygotominor.yy65->nSrc-1].jointype = (u8)yymsp[0].minor.yy328; -} - break; - case 136: /* stl_prefix ::= */ -{yygotominor.yy65 = 0;} - break; - case 137: /* seltablist ::= stl_prefix nm dbnm as indexed_opt on_opt using_opt */ -{ - yygotominor.yy65 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy65,&yymsp[-5].minor.yy0,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,0,yymsp[-1].minor.yy132,yymsp[0].minor.yy408); - sqlite3SrcListIndexedBy(pParse, yygotominor.yy65, &yymsp[-2].minor.yy0); -} - break; - case 138: /* seltablist ::= stl_prefix LP select RP as on_opt using_opt */ -{ - yygotominor.yy65 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy65,0,0,&yymsp[-2].minor.yy0,yymsp[-4].minor.yy3,yymsp[-1].minor.yy132,yymsp[0].minor.yy408); - } - break; - case 139: /* seltablist ::= stl_prefix LP seltablist RP as on_opt using_opt */ -{ - if( yymsp[-6].minor.yy65==0 && yymsp[-2].minor.yy0.n==0 && yymsp[-1].minor.yy132==0 && yymsp[0].minor.yy408==0 ){ - yygotominor.yy65 = yymsp[-4].minor.yy65; - }else if( yymsp[-4].minor.yy65->nSrc==1 ){ - yygotominor.yy65 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy65,0,0,&yymsp[-2].minor.yy0,0,yymsp[-1].minor.yy132,yymsp[0].minor.yy408); - if( yygotominor.yy65 ){ - struct SrcList_item *pNew = &yygotominor.yy65->a[yygotominor.yy65->nSrc-1]; - struct SrcList_item *pOld = yymsp[-4].minor.yy65->a; - pNew->zName = pOld->zName; - pNew->zDatabase = pOld->zDatabase; - pNew->pSelect = pOld->pSelect; - pOld->zName = pOld->zDatabase = 0; - pOld->pSelect = 0; - } - sqlite3SrcListDelete(pParse->db, yymsp[-4].minor.yy65); - }else{ - Select *pSubquery; - sqlite3SrcListShiftJoinType(yymsp[-4].minor.yy65); - pSubquery = sqlite3SelectNew(pParse,0,yymsp[-4].minor.yy65,0,0,0,0,SF_NestedFrom,0,0); - yygotominor.yy65 = sqlite3SrcListAppendFromTerm(pParse,yymsp[-6].minor.yy65,0,0,&yymsp[-2].minor.yy0,pSubquery,yymsp[-1].minor.yy132,yymsp[0].minor.yy408); - } - } - break; - case 140: /* dbnm ::= */ - case 149: /* indexed_opt ::= */ yytestcase(yyruleno==149); -{yygotominor.yy0.z=0; yygotominor.yy0.n=0;} - break; - case 142: /* fullname ::= nm dbnm */ -{yygotominor.yy65 = sqlite3SrcListAppend(pParse->db,0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0);} - break; - case 143: /* joinop ::= COMMA|JOIN */ -{ yygotominor.yy328 = JT_INNER; } - break; - case 144: /* joinop ::= JOIN_KW JOIN */ -{ yygotominor.yy328 = sqlite3JoinType(pParse,&yymsp[-1].minor.yy0,0,0); } - break; - case 145: /* joinop ::= JOIN_KW nm JOIN */ -{ yygotominor.yy328 = sqlite3JoinType(pParse,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0,0); } - break; - case 146: /* joinop ::= JOIN_KW nm nm JOIN */ -{ yygotominor.yy328 = sqlite3JoinType(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[-1].minor.yy0); } - break; - case 147: /* on_opt ::= ON expr */ - case 164: /* having_opt ::= HAVING expr */ yytestcase(yyruleno==164); - case 171: /* where_opt ::= WHERE expr */ yytestcase(yyruleno==171); - case 231: /* case_else ::= ELSE expr */ yytestcase(yyruleno==231); - case 233: /* case_operand ::= expr */ yytestcase(yyruleno==233); -{yygotominor.yy132 = yymsp[0].minor.yy346.pExpr;} - break; - case 148: /* on_opt ::= */ - case 163: /* having_opt ::= */ yytestcase(yyruleno==163); - case 170: /* where_opt ::= */ yytestcase(yyruleno==170); - case 232: /* case_else ::= */ yytestcase(yyruleno==232); - case 234: /* case_operand ::= */ yytestcase(yyruleno==234); -{yygotominor.yy132 = 0;} - break; - case 151: /* indexed_opt ::= NOT INDEXED */ -{yygotominor.yy0.z=0; yygotominor.yy0.n=1;} - break; - case 152: /* using_opt ::= USING LP idlist RP */ - case 180: /* inscollist_opt ::= LP idlist RP */ yytestcase(yyruleno==180); -{yygotominor.yy408 = yymsp[-1].minor.yy408;} - break; - case 153: /* using_opt ::= */ - case 179: /* inscollist_opt ::= */ yytestcase(yyruleno==179); -{yygotominor.yy408 = 0;} - break; - case 155: /* orderby_opt ::= ORDER BY sortlist */ - case 162: /* groupby_opt ::= GROUP BY nexprlist */ yytestcase(yyruleno==162); - case 235: /* exprlist ::= nexprlist */ yytestcase(yyruleno==235); -{yygotominor.yy14 = yymsp[0].minor.yy14;} - break; - case 156: /* sortlist ::= sortlist COMMA expr sortorder */ -{ - yygotominor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-3].minor.yy14,yymsp[-1].minor.yy346.pExpr); - if( yygotominor.yy14 ) yygotominor.yy14->a[yygotominor.yy14->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy328; -} - break; - case 157: /* sortlist ::= expr sortorder */ -{ - yygotominor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[-1].minor.yy346.pExpr); - if( yygotominor.yy14 && ALWAYS(yygotominor.yy14->a) ) yygotominor.yy14->a[0].sortOrder = (u8)yymsp[0].minor.yy328; -} - break; - case 158: /* sortorder ::= ASC */ - case 160: /* sortorder ::= */ yytestcase(yyruleno==160); -{yygotominor.yy328 = SQLITE_SO_ASC;} - break; - case 159: /* sortorder ::= DESC */ -{yygotominor.yy328 = SQLITE_SO_DESC;} - break; - case 165: /* limit_opt ::= */ -{yygotominor.yy476.pLimit = 0; yygotominor.yy476.pOffset = 0;} - break; - case 166: /* limit_opt ::= LIMIT expr */ -{yygotominor.yy476.pLimit = yymsp[0].minor.yy346.pExpr; yygotominor.yy476.pOffset = 0;} - break; - case 167: /* limit_opt ::= LIMIT expr OFFSET expr */ -{yygotominor.yy476.pLimit = yymsp[-2].minor.yy346.pExpr; yygotominor.yy476.pOffset = yymsp[0].minor.yy346.pExpr;} - break; - case 168: /* limit_opt ::= LIMIT expr COMMA expr */ -{yygotominor.yy476.pOffset = yymsp[-2].minor.yy346.pExpr; yygotominor.yy476.pLimit = yymsp[0].minor.yy346.pExpr;} - break; - case 169: /* cmd ::= with DELETE FROM fullname indexed_opt where_opt */ -{ - sqlite3WithPush(pParse, yymsp[-5].minor.yy59, 1); - sqlite3SrcListIndexedBy(pParse, yymsp[-2].minor.yy65, &yymsp[-1].minor.yy0); - sqlite3DeleteFrom(pParse,yymsp[-2].minor.yy65,yymsp[0].minor.yy132); -} - break; - case 172: /* cmd ::= with UPDATE orconf fullname indexed_opt SET setlist where_opt */ -{ - sqlite3WithPush(pParse, yymsp[-7].minor.yy59, 1); - sqlite3SrcListIndexedBy(pParse, yymsp[-4].minor.yy65, &yymsp[-3].minor.yy0); - sqlite3ExprListCheckLength(pParse,yymsp[-1].minor.yy14,"set list"); - sqlite3Update(pParse,yymsp[-4].minor.yy65,yymsp[-1].minor.yy14,yymsp[0].minor.yy132,yymsp[-5].minor.yy186); -} - break; - case 173: /* setlist ::= setlist COMMA nm EQ expr */ -{ - yygotominor.yy14 = sqlite3ExprListAppend(pParse, yymsp[-4].minor.yy14, yymsp[0].minor.yy346.pExpr); - sqlite3ExprListSetName(pParse, yygotominor.yy14, &yymsp[-2].minor.yy0, 1); -} - break; - case 174: /* setlist ::= nm EQ expr */ -{ - yygotominor.yy14 = sqlite3ExprListAppend(pParse, 0, yymsp[0].minor.yy346.pExpr); - sqlite3ExprListSetName(pParse, yygotominor.yy14, &yymsp[-2].minor.yy0, 1); -} - break; - case 175: /* cmd ::= with insert_cmd INTO fullname inscollist_opt select */ -{ - sqlite3WithPush(pParse, yymsp[-5].minor.yy59, 1); - sqlite3Insert(pParse, yymsp[-2].minor.yy65, yymsp[0].minor.yy3, yymsp[-1].minor.yy408, yymsp[-4].minor.yy186); -} - break; - case 176: /* cmd ::= with insert_cmd INTO fullname inscollist_opt DEFAULT VALUES */ -{ - sqlite3WithPush(pParse, yymsp[-6].minor.yy59, 1); - sqlite3Insert(pParse, yymsp[-3].minor.yy65, 0, yymsp[-2].minor.yy408, yymsp[-5].minor.yy186); -} - break; - case 177: /* insert_cmd ::= INSERT orconf */ -{yygotominor.yy186 = yymsp[0].minor.yy186;} - break; - case 178: /* insert_cmd ::= REPLACE */ -{yygotominor.yy186 = OE_Replace;} - break; - case 181: /* idlist ::= idlist COMMA nm */ -{yygotominor.yy408 = sqlite3IdListAppend(pParse->db,yymsp[-2].minor.yy408,&yymsp[0].minor.yy0);} - break; - case 182: /* idlist ::= nm */ -{yygotominor.yy408 = sqlite3IdListAppend(pParse->db,0,&yymsp[0].minor.yy0);} - break; - case 183: /* expr ::= term */ -{yygotominor.yy346 = yymsp[0].minor.yy346;} - break; - case 184: /* expr ::= LP expr RP */ -{yygotominor.yy346.pExpr = yymsp[-1].minor.yy346.pExpr; spanSet(&yygotominor.yy346,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0);} - break; - case 185: /* term ::= NULL */ - case 190: /* term ::= INTEGER|FLOAT|BLOB */ yytestcase(yyruleno==190); - case 191: /* term ::= STRING */ yytestcase(yyruleno==191); -{spanExpr(&yygotominor.yy346, pParse, yymsp[0].major, &yymsp[0].minor.yy0);} - break; - case 186: /* expr ::= ID|INDEXED */ - case 187: /* expr ::= JOIN_KW */ yytestcase(yyruleno==187); -{spanExpr(&yygotominor.yy346, pParse, TK_ID, &yymsp[0].minor.yy0);} - break; - case 188: /* expr ::= nm DOT nm */ -{ - Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); - Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp2, 0); - spanSet(&yygotominor.yy346,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0); -} - break; - case 189: /* expr ::= nm DOT nm DOT nm */ -{ - Expr *temp1 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-4].minor.yy0); - Expr *temp2 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[-2].minor.yy0); - Expr *temp3 = sqlite3PExpr(pParse, TK_ID, 0, 0, &yymsp[0].minor.yy0); - Expr *temp4 = sqlite3PExpr(pParse, TK_DOT, temp2, temp3, 0); - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_DOT, temp1, temp4, 0); - spanSet(&yygotominor.yy346,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); -} - break; - case 192: /* expr ::= VARIABLE */ -{ - if( yymsp[0].minor.yy0.n>=2 && yymsp[0].minor.yy0.z[0]=='#' && sqlite3Isdigit(yymsp[0].minor.yy0.z[1]) ){ - /* When doing a nested parse, one can include terms in an expression - ** that look like this: #1 #2 ... These terms refer to registers - ** in the virtual machine. #N is the N-th register. */ - if( pParse->nested==0 ){ - sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &yymsp[0].minor.yy0); - yygotominor.yy346.pExpr = 0; - }else{ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_REGISTER, 0, 0, &yymsp[0].minor.yy0); - if( yygotominor.yy346.pExpr ) sqlite3GetInt32(&yymsp[0].minor.yy0.z[1], &yygotominor.yy346.pExpr->iTable); - } - }else{ - spanExpr(&yygotominor.yy346, pParse, TK_VARIABLE, &yymsp[0].minor.yy0); - sqlite3ExprAssignVarNumber(pParse, yygotominor.yy346.pExpr); - } - spanSet(&yygotominor.yy346, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); -} - break; - case 193: /* expr ::= expr COLLATE ID|STRING */ -{ - yygotominor.yy346.pExpr = sqlite3ExprAddCollateToken(pParse, yymsp[-2].minor.yy346.pExpr, &yymsp[0].minor.yy0); - yygotominor.yy346.zStart = yymsp[-2].minor.yy346.zStart; - yygotominor.yy346.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; -} - break; - case 194: /* expr ::= CAST LP expr AS typetoken RP */ -{ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_CAST, yymsp[-3].minor.yy346.pExpr, 0, &yymsp[-1].minor.yy0); - spanSet(&yygotominor.yy346,&yymsp[-5].minor.yy0,&yymsp[0].minor.yy0); -} - break; - case 195: /* expr ::= ID|INDEXED LP distinct exprlist RP */ -{ - if( yymsp[-1].minor.yy14 && yymsp[-1].minor.yy14->nExpr>pParse->db->aLimit[SQLITE_LIMIT_FUNCTION_ARG] ){ - sqlite3ErrorMsg(pParse, "too many arguments on function %T", &yymsp[-4].minor.yy0); - } - yygotominor.yy346.pExpr = sqlite3ExprFunction(pParse, yymsp[-1].minor.yy14, &yymsp[-4].minor.yy0); - spanSet(&yygotominor.yy346,&yymsp[-4].minor.yy0,&yymsp[0].minor.yy0); - if( yymsp[-2].minor.yy381 && yygotominor.yy346.pExpr ){ - yygotominor.yy346.pExpr->flags |= EP_Distinct; - } -} - break; - case 196: /* expr ::= ID|INDEXED LP STAR RP */ -{ - yygotominor.yy346.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[-3].minor.yy0); - spanSet(&yygotominor.yy346,&yymsp[-3].minor.yy0,&yymsp[0].minor.yy0); -} - break; - case 197: /* term ::= CTIME_KW */ -{ - yygotominor.yy346.pExpr = sqlite3ExprFunction(pParse, 0, &yymsp[0].minor.yy0); - spanSet(&yygotominor.yy346, &yymsp[0].minor.yy0, &yymsp[0].minor.yy0); -} - break; - case 198: /* expr ::= expr AND expr */ - case 199: /* expr ::= expr OR expr */ yytestcase(yyruleno==199); - case 200: /* expr ::= expr LT|GT|GE|LE expr */ yytestcase(yyruleno==200); - case 201: /* expr ::= expr EQ|NE expr */ yytestcase(yyruleno==201); - case 202: /* expr ::= expr BITAND|BITOR|LSHIFT|RSHIFT expr */ yytestcase(yyruleno==202); - case 203: /* expr ::= expr PLUS|MINUS expr */ yytestcase(yyruleno==203); - case 204: /* expr ::= expr STAR|SLASH|REM expr */ yytestcase(yyruleno==204); - case 205: /* expr ::= expr CONCAT expr */ yytestcase(yyruleno==205); -{spanBinaryExpr(&yygotominor.yy346,pParse,yymsp[-1].major,&yymsp[-2].minor.yy346,&yymsp[0].minor.yy346);} - break; - case 206: /* likeop ::= LIKE_KW|MATCH */ -{yygotominor.yy96.eOperator = yymsp[0].minor.yy0; yygotominor.yy96.bNot = 0;} - break; - case 207: /* likeop ::= NOT LIKE_KW|MATCH */ -{yygotominor.yy96.eOperator = yymsp[0].minor.yy0; yygotominor.yy96.bNot = 1;} - break; - case 208: /* expr ::= expr likeop expr */ -{ - ExprList *pList; - pList = sqlite3ExprListAppend(pParse,0, yymsp[0].minor.yy346.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-2].minor.yy346.pExpr); - yygotominor.yy346.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-1].minor.yy96.eOperator); - if( yymsp[-1].minor.yy96.bNot ) yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy346.pExpr, 0, 0); - yygotominor.yy346.zStart = yymsp[-2].minor.yy346.zStart; - yygotominor.yy346.zEnd = yymsp[0].minor.yy346.zEnd; - if( yygotominor.yy346.pExpr ) yygotominor.yy346.pExpr->flags |= EP_InfixFunc; -} - break; - case 209: /* expr ::= expr likeop expr ESCAPE expr */ -{ - ExprList *pList; - pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy346.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[-4].minor.yy346.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy346.pExpr); - yygotominor.yy346.pExpr = sqlite3ExprFunction(pParse, pList, &yymsp[-3].minor.yy96.eOperator); - if( yymsp[-3].minor.yy96.bNot ) yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy346.pExpr, 0, 0); - yygotominor.yy346.zStart = yymsp[-4].minor.yy346.zStart; - yygotominor.yy346.zEnd = yymsp[0].minor.yy346.zEnd; - if( yygotominor.yy346.pExpr ) yygotominor.yy346.pExpr->flags |= EP_InfixFunc; -} - break; - case 210: /* expr ::= expr ISNULL|NOTNULL */ -{spanUnaryPostfix(&yygotominor.yy346,pParse,yymsp[0].major,&yymsp[-1].minor.yy346,&yymsp[0].minor.yy0);} - break; - case 211: /* expr ::= expr NOT NULL */ -{spanUnaryPostfix(&yygotominor.yy346,pParse,TK_NOTNULL,&yymsp[-2].minor.yy346,&yymsp[0].minor.yy0);} - break; - case 212: /* expr ::= expr IS expr */ -{ - spanBinaryExpr(&yygotominor.yy346,pParse,TK_IS,&yymsp[-2].minor.yy346,&yymsp[0].minor.yy346); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy346.pExpr, yygotominor.yy346.pExpr, TK_ISNULL); -} - break; - case 213: /* expr ::= expr IS NOT expr */ -{ - spanBinaryExpr(&yygotominor.yy346,pParse,TK_ISNOT,&yymsp[-3].minor.yy346,&yymsp[0].minor.yy346); - binaryToUnaryIfNull(pParse, yymsp[0].minor.yy346.pExpr, yygotominor.yy346.pExpr, TK_NOTNULL); -} - break; - case 214: /* expr ::= NOT expr */ - case 215: /* expr ::= BITNOT expr */ yytestcase(yyruleno==215); -{spanUnaryPrefix(&yygotominor.yy346,pParse,yymsp[-1].major,&yymsp[0].minor.yy346,&yymsp[-1].minor.yy0);} - break; - case 216: /* expr ::= MINUS expr */ -{spanUnaryPrefix(&yygotominor.yy346,pParse,TK_UMINUS,&yymsp[0].minor.yy346,&yymsp[-1].minor.yy0);} - break; - case 217: /* expr ::= PLUS expr */ -{spanUnaryPrefix(&yygotominor.yy346,pParse,TK_UPLUS,&yymsp[0].minor.yy346,&yymsp[-1].minor.yy0);} - break; - case 220: /* expr ::= expr between_op expr AND expr */ -{ - ExprList *pList = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy346.pExpr); - pList = sqlite3ExprListAppend(pParse,pList, yymsp[0].minor.yy346.pExpr); - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_BETWEEN, yymsp[-4].minor.yy346.pExpr, 0, 0); - if( yygotominor.yy346.pExpr ){ - yygotominor.yy346.pExpr->x.pList = pList; - }else{ - sqlite3ExprListDelete(pParse->db, pList); - } - if( yymsp[-3].minor.yy328 ) yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy346.pExpr, 0, 0); - yygotominor.yy346.zStart = yymsp[-4].minor.yy346.zStart; - yygotominor.yy346.zEnd = yymsp[0].minor.yy346.zEnd; -} - break; - case 223: /* expr ::= expr in_op LP exprlist RP */ -{ - if( yymsp[-1].minor.yy14==0 ){ - /* Expressions of the form - ** - ** expr1 IN () - ** expr1 NOT IN () - ** - ** simplify to constants 0 (false) and 1 (true), respectively, - ** regardless of the value of expr1. - */ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_INTEGER, 0, 0, &sqlite3IntTokens[yymsp[-3].minor.yy328]); - sqlite3ExprDelete(pParse->db, yymsp[-4].minor.yy346.pExpr); - }else{ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy346.pExpr, 0, 0); - if( yygotominor.yy346.pExpr ){ - yygotominor.yy346.pExpr->x.pList = yymsp[-1].minor.yy14; - sqlite3ExprSetHeight(pParse, yygotominor.yy346.pExpr); - }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-1].minor.yy14); - } - if( yymsp[-3].minor.yy328 ) yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy346.pExpr, 0, 0); - } - yygotominor.yy346.zStart = yymsp[-4].minor.yy346.zStart; - yygotominor.yy346.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; - } - break; - case 224: /* expr ::= LP select RP */ -{ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_SELECT, 0, 0, 0); - if( yygotominor.yy346.pExpr ){ - yygotominor.yy346.pExpr->x.pSelect = yymsp[-1].minor.yy3; - ExprSetProperty(yygotominor.yy346.pExpr, EP_xIsSelect); - sqlite3ExprSetHeight(pParse, yygotominor.yy346.pExpr); - }else{ - sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy3); - } - yygotominor.yy346.zStart = yymsp[-2].minor.yy0.z; - yygotominor.yy346.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; - } - break; - case 225: /* expr ::= expr in_op LP select RP */ -{ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-4].minor.yy346.pExpr, 0, 0); - if( yygotominor.yy346.pExpr ){ - yygotominor.yy346.pExpr->x.pSelect = yymsp[-1].minor.yy3; - ExprSetProperty(yygotominor.yy346.pExpr, EP_xIsSelect); - sqlite3ExprSetHeight(pParse, yygotominor.yy346.pExpr); - }else{ - sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy3); - } - if( yymsp[-3].minor.yy328 ) yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy346.pExpr, 0, 0); - yygotominor.yy346.zStart = yymsp[-4].minor.yy346.zStart; - yygotominor.yy346.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; - } - break; - case 226: /* expr ::= expr in_op nm dbnm */ -{ - SrcList *pSrc = sqlite3SrcListAppend(pParse->db, 0,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0); - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_IN, yymsp[-3].minor.yy346.pExpr, 0, 0); - if( yygotominor.yy346.pExpr ){ - yygotominor.yy346.pExpr->x.pSelect = sqlite3SelectNew(pParse, 0,pSrc,0,0,0,0,0,0,0); - ExprSetProperty(yygotominor.yy346.pExpr, EP_xIsSelect); - sqlite3ExprSetHeight(pParse, yygotominor.yy346.pExpr); - }else{ - sqlite3SrcListDelete(pParse->db, pSrc); - } - if( yymsp[-2].minor.yy328 ) yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_NOT, yygotominor.yy346.pExpr, 0, 0); - yygotominor.yy346.zStart = yymsp[-3].minor.yy346.zStart; - yygotominor.yy346.zEnd = yymsp[0].minor.yy0.z ? &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n] : &yymsp[-1].minor.yy0.z[yymsp[-1].minor.yy0.n]; - } - break; - case 227: /* expr ::= EXISTS LP select RP */ -{ - Expr *p = yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_EXISTS, 0, 0, 0); - if( p ){ - p->x.pSelect = yymsp[-1].minor.yy3; - ExprSetProperty(p, EP_xIsSelect); - sqlite3ExprSetHeight(pParse, p); - }else{ - sqlite3SelectDelete(pParse->db, yymsp[-1].minor.yy3); - } - yygotominor.yy346.zStart = yymsp[-3].minor.yy0.z; - yygotominor.yy346.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; - } - break; - case 228: /* expr ::= CASE case_operand case_exprlist case_else END */ -{ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_CASE, yymsp[-3].minor.yy132, 0, 0); - if( yygotominor.yy346.pExpr ){ - yygotominor.yy346.pExpr->x.pList = yymsp[-1].minor.yy132 ? sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[-1].minor.yy132) : yymsp[-2].minor.yy14; - sqlite3ExprSetHeight(pParse, yygotominor.yy346.pExpr); - }else{ - sqlite3ExprListDelete(pParse->db, yymsp[-2].minor.yy14); - sqlite3ExprDelete(pParse->db, yymsp[-1].minor.yy132); - } - yygotominor.yy346.zStart = yymsp[-4].minor.yy0.z; - yygotominor.yy346.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; -} - break; - case 229: /* case_exprlist ::= case_exprlist WHEN expr THEN expr */ -{ - yygotominor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, yymsp[-2].minor.yy346.pExpr); - yygotominor.yy14 = sqlite3ExprListAppend(pParse,yygotominor.yy14, yymsp[0].minor.yy346.pExpr); -} - break; - case 230: /* case_exprlist ::= WHEN expr THEN expr */ -{ - yygotominor.yy14 = sqlite3ExprListAppend(pParse,0, yymsp[-2].minor.yy346.pExpr); - yygotominor.yy14 = sqlite3ExprListAppend(pParse,yygotominor.yy14, yymsp[0].minor.yy346.pExpr); -} - break; - case 237: /* nexprlist ::= nexprlist COMMA expr */ -{yygotominor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-2].minor.yy14,yymsp[0].minor.yy346.pExpr);} - break; - case 238: /* nexprlist ::= expr */ -{yygotominor.yy14 = sqlite3ExprListAppend(pParse,0,yymsp[0].minor.yy346.pExpr);} - break; - case 239: /* cmd ::= createkw uniqueflag INDEX ifnotexists nm dbnm ON nm LP idxlist RP where_opt */ -{ - sqlite3CreateIndex(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, - sqlite3SrcListAppend(pParse->db,0,&yymsp[-4].minor.yy0,0), yymsp[-2].minor.yy14, yymsp[-10].minor.yy328, - &yymsp[-11].minor.yy0, yymsp[0].minor.yy132, SQLITE_SO_ASC, yymsp[-8].minor.yy328); -} - break; - case 240: /* uniqueflag ::= UNIQUE */ - case 291: /* raisetype ::= ABORT */ yytestcase(yyruleno==291); -{yygotominor.yy328 = OE_Abort;} - break; - case 241: /* uniqueflag ::= */ -{yygotominor.yy328 = OE_None;} - break; - case 244: /* idxlist ::= idxlist COMMA nm collate sortorder */ -{ - Expr *p = sqlite3ExprAddCollateToken(pParse, 0, &yymsp[-1].minor.yy0); - yygotominor.yy14 = sqlite3ExprListAppend(pParse,yymsp[-4].minor.yy14, p); - sqlite3ExprListSetName(pParse,yygotominor.yy14,&yymsp[-2].minor.yy0,1); - sqlite3ExprListCheckLength(pParse, yygotominor.yy14, "index"); - if( yygotominor.yy14 ) yygotominor.yy14->a[yygotominor.yy14->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy328; -} - break; - case 245: /* idxlist ::= nm collate sortorder */ -{ - Expr *p = sqlite3ExprAddCollateToken(pParse, 0, &yymsp[-1].minor.yy0); - yygotominor.yy14 = sqlite3ExprListAppend(pParse,0, p); - sqlite3ExprListSetName(pParse, yygotominor.yy14, &yymsp[-2].minor.yy0, 1); - sqlite3ExprListCheckLength(pParse, yygotominor.yy14, "index"); - if( yygotominor.yy14 ) yygotominor.yy14->a[yygotominor.yy14->nExpr-1].sortOrder = (u8)yymsp[0].minor.yy328; -} - break; - case 246: /* collate ::= */ -{yygotominor.yy0.z = 0; yygotominor.yy0.n = 0;} - break; - case 248: /* cmd ::= DROP INDEX ifexists fullname */ -{sqlite3DropIndex(pParse, yymsp[0].minor.yy65, yymsp[-1].minor.yy328);} - break; - case 249: /* cmd ::= VACUUM */ - case 250: /* cmd ::= VACUUM nm */ yytestcase(yyruleno==250); -{sqlite3Vacuum(pParse);} - break; - case 251: /* cmd ::= PRAGMA nm dbnm */ -{sqlite3Pragma(pParse,&yymsp[-1].minor.yy0,&yymsp[0].minor.yy0,0,0);} - break; - case 252: /* cmd ::= PRAGMA nm dbnm EQ nmnum */ -{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,0);} - break; - case 253: /* cmd ::= PRAGMA nm dbnm LP nmnum RP */ -{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,0);} - break; - case 254: /* cmd ::= PRAGMA nm dbnm EQ minus_num */ -{sqlite3Pragma(pParse,&yymsp[-3].minor.yy0,&yymsp[-2].minor.yy0,&yymsp[0].minor.yy0,1);} - break; - case 255: /* cmd ::= PRAGMA nm dbnm LP minus_num RP */ -{sqlite3Pragma(pParse,&yymsp[-4].minor.yy0,&yymsp[-3].minor.yy0,&yymsp[-1].minor.yy0,1);} - break; - case 264: /* cmd ::= createkw trigger_decl BEGIN trigger_cmd_list END */ -{ - Token all; - all.z = yymsp[-3].minor.yy0.z; - all.n = (int)(yymsp[0].minor.yy0.z - yymsp[-3].minor.yy0.z) + yymsp[0].minor.yy0.n; - sqlite3FinishTrigger(pParse, yymsp[-1].minor.yy473, &all); -} - break; - case 265: /* trigger_decl ::= temp TRIGGER ifnotexists nm dbnm trigger_time trigger_event ON fullname foreach_clause when_clause */ -{ - sqlite3BeginTrigger(pParse, &yymsp[-7].minor.yy0, &yymsp[-6].minor.yy0, yymsp[-5].minor.yy328, yymsp[-4].minor.yy378.a, yymsp[-4].minor.yy378.b, yymsp[-2].minor.yy65, yymsp[0].minor.yy132, yymsp[-10].minor.yy328, yymsp[-8].minor.yy328); - yygotominor.yy0 = (yymsp[-6].minor.yy0.n==0?yymsp[-7].minor.yy0:yymsp[-6].minor.yy0); -} - break; - case 266: /* trigger_time ::= BEFORE */ - case 269: /* trigger_time ::= */ yytestcase(yyruleno==269); -{ yygotominor.yy328 = TK_BEFORE; } - break; - case 267: /* trigger_time ::= AFTER */ -{ yygotominor.yy328 = TK_AFTER; } - break; - case 268: /* trigger_time ::= INSTEAD OF */ -{ yygotominor.yy328 = TK_INSTEAD;} - break; - case 270: /* trigger_event ::= DELETE|INSERT */ - case 271: /* trigger_event ::= UPDATE */ yytestcase(yyruleno==271); -{yygotominor.yy378.a = yymsp[0].major; yygotominor.yy378.b = 0;} - break; - case 272: /* trigger_event ::= UPDATE OF idlist */ -{yygotominor.yy378.a = TK_UPDATE; yygotominor.yy378.b = yymsp[0].minor.yy408;} - break; - case 275: /* when_clause ::= */ - case 296: /* key_opt ::= */ yytestcase(yyruleno==296); -{ yygotominor.yy132 = 0; } - break; - case 276: /* when_clause ::= WHEN expr */ - case 297: /* key_opt ::= KEY expr */ yytestcase(yyruleno==297); -{ yygotominor.yy132 = yymsp[0].minor.yy346.pExpr; } - break; - case 277: /* trigger_cmd_list ::= trigger_cmd_list trigger_cmd SEMI */ -{ - assert( yymsp[-2].minor.yy473!=0 ); - yymsp[-2].minor.yy473->pLast->pNext = yymsp[-1].minor.yy473; - yymsp[-2].minor.yy473->pLast = yymsp[-1].minor.yy473; - yygotominor.yy473 = yymsp[-2].minor.yy473; -} - break; - case 278: /* trigger_cmd_list ::= trigger_cmd SEMI */ -{ - assert( yymsp[-1].minor.yy473!=0 ); - yymsp[-1].minor.yy473->pLast = yymsp[-1].minor.yy473; - yygotominor.yy473 = yymsp[-1].minor.yy473; -} - break; - case 280: /* trnm ::= nm DOT nm */ -{ - yygotominor.yy0 = yymsp[0].minor.yy0; - sqlite3ErrorMsg(pParse, - "qualified table names are not allowed on INSERT, UPDATE, and DELETE " - "statements within triggers"); -} - break; - case 282: /* tridxby ::= INDEXED BY nm */ -{ - sqlite3ErrorMsg(pParse, - "the INDEXED BY clause is not allowed on UPDATE or DELETE statements " - "within triggers"); -} - break; - case 283: /* tridxby ::= NOT INDEXED */ -{ - sqlite3ErrorMsg(pParse, - "the NOT INDEXED clause is not allowed on UPDATE or DELETE statements " - "within triggers"); -} - break; - case 284: /* trigger_cmd ::= UPDATE orconf trnm tridxby SET setlist where_opt */ -{ yygotominor.yy473 = sqlite3TriggerUpdateStep(pParse->db, &yymsp[-4].minor.yy0, yymsp[-1].minor.yy14, yymsp[0].minor.yy132, yymsp[-5].minor.yy186); } - break; - case 285: /* trigger_cmd ::= insert_cmd INTO trnm inscollist_opt select */ -{yygotominor.yy473 = sqlite3TriggerInsertStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[-1].minor.yy408, yymsp[0].minor.yy3, yymsp[-4].minor.yy186);} - break; - case 286: /* trigger_cmd ::= DELETE FROM trnm tridxby where_opt */ -{yygotominor.yy473 = sqlite3TriggerDeleteStep(pParse->db, &yymsp[-2].minor.yy0, yymsp[0].minor.yy132);} - break; - case 287: /* trigger_cmd ::= select */ -{yygotominor.yy473 = sqlite3TriggerSelectStep(pParse->db, yymsp[0].minor.yy3); } - break; - case 288: /* expr ::= RAISE LP IGNORE RP */ -{ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, 0); - if( yygotominor.yy346.pExpr ){ - yygotominor.yy346.pExpr->affinity = OE_Ignore; - } - yygotominor.yy346.zStart = yymsp[-3].minor.yy0.z; - yygotominor.yy346.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; -} - break; - case 289: /* expr ::= RAISE LP raisetype COMMA nm RP */ -{ - yygotominor.yy346.pExpr = sqlite3PExpr(pParse, TK_RAISE, 0, 0, &yymsp[-1].minor.yy0); - if( yygotominor.yy346.pExpr ) { - yygotominor.yy346.pExpr->affinity = (char)yymsp[-3].minor.yy328; - } - yygotominor.yy346.zStart = yymsp[-5].minor.yy0.z; - yygotominor.yy346.zEnd = &yymsp[0].minor.yy0.z[yymsp[0].minor.yy0.n]; -} - break; - case 290: /* raisetype ::= ROLLBACK */ -{yygotominor.yy328 = OE_Rollback;} - break; - case 292: /* raisetype ::= FAIL */ -{yygotominor.yy328 = OE_Fail;} - break; - case 293: /* cmd ::= DROP TRIGGER ifexists fullname */ -{ - sqlite3DropTrigger(pParse,yymsp[0].minor.yy65,yymsp[-1].minor.yy328); -} - break; - case 294: /* cmd ::= ATTACH database_kw_opt expr AS expr key_opt */ -{ - sqlite3Attach(pParse, yymsp[-3].minor.yy346.pExpr, yymsp[-1].minor.yy346.pExpr, yymsp[0].minor.yy132); -} - break; - case 295: /* cmd ::= DETACH database_kw_opt expr */ -{ - sqlite3Detach(pParse, yymsp[0].minor.yy346.pExpr); -} - break; - case 300: /* cmd ::= REINDEX */ -{sqlite3Reindex(pParse, 0, 0);} - break; - case 301: /* cmd ::= REINDEX nm dbnm */ -{sqlite3Reindex(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} - break; - case 302: /* cmd ::= ANALYZE */ -{sqlite3Analyze(pParse, 0, 0);} - break; - case 303: /* cmd ::= ANALYZE nm dbnm */ -{sqlite3Analyze(pParse, &yymsp[-1].minor.yy0, &yymsp[0].minor.yy0);} - break; - case 304: /* cmd ::= ALTER TABLE fullname RENAME TO nm */ -{ - sqlite3AlterRenameTable(pParse,yymsp[-3].minor.yy65,&yymsp[0].minor.yy0); -} - break; - case 305: /* cmd ::= ALTER TABLE add_column_fullname ADD kwcolumn_opt column */ -{ - sqlite3AlterFinishAddColumn(pParse, &yymsp[0].minor.yy0); -} - break; - case 306: /* add_column_fullname ::= fullname */ -{ - pParse->db->lookaside.bEnabled = 0; - sqlite3AlterBeginAddColumn(pParse, yymsp[0].minor.yy65); -} - break; - case 309: /* cmd ::= create_vtab */ -{sqlite3VtabFinishParse(pParse,0);} - break; - case 310: /* cmd ::= create_vtab LP vtabarglist RP */ -{sqlite3VtabFinishParse(pParse,&yymsp[0].minor.yy0);} - break; - case 311: /* create_vtab ::= createkw VIRTUAL TABLE ifnotexists nm dbnm USING nm */ -{ - sqlite3VtabBeginParse(pParse, &yymsp[-3].minor.yy0, &yymsp[-2].minor.yy0, &yymsp[0].minor.yy0, yymsp[-4].minor.yy328); -} - break; - case 314: /* vtabarg ::= */ -{sqlite3VtabArgInit(pParse);} - break; - case 316: /* vtabargtoken ::= ANY */ - case 317: /* vtabargtoken ::= lp anylist RP */ yytestcase(yyruleno==317); - case 318: /* lp ::= LP */ yytestcase(yyruleno==318); -{sqlite3VtabArgExtend(pParse,&yymsp[0].minor.yy0);} - break; - case 322: /* with ::= */ -{yygotominor.yy59 = 0;} - break; - case 323: /* with ::= WITH wqlist */ - case 324: /* with ::= WITH RECURSIVE wqlist */ yytestcase(yyruleno==324); -{ yygotominor.yy59 = yymsp[0].minor.yy59; } - break; - case 325: /* wqlist ::= nm idxlist_opt AS LP select RP */ -{ - yygotominor.yy59 = sqlite3WithAdd(pParse, 0, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy3); -} - break; - case 326: /* wqlist ::= wqlist COMMA nm idxlist_opt AS LP select RP */ -{ - yygotominor.yy59 = sqlite3WithAdd(pParse, yymsp[-7].minor.yy59, &yymsp[-5].minor.yy0, yymsp[-4].minor.yy14, yymsp[-1].minor.yy3); -} - break; - default: - /* (0) input ::= cmdlist */ yytestcase(yyruleno==0); - /* (1) cmdlist ::= cmdlist ecmd */ yytestcase(yyruleno==1); - /* (2) cmdlist ::= ecmd */ yytestcase(yyruleno==2); - /* (3) ecmd ::= SEMI */ yytestcase(yyruleno==3); - /* (4) ecmd ::= explain cmdx SEMI */ yytestcase(yyruleno==4); - /* (10) trans_opt ::= */ yytestcase(yyruleno==10); - /* (11) trans_opt ::= TRANSACTION */ yytestcase(yyruleno==11); - /* (12) trans_opt ::= TRANSACTION nm */ yytestcase(yyruleno==12); - /* (20) savepoint_opt ::= SAVEPOINT */ yytestcase(yyruleno==20); - /* (21) savepoint_opt ::= */ yytestcase(yyruleno==21); - /* (25) cmd ::= create_table create_table_args */ yytestcase(yyruleno==25); - /* (36) columnlist ::= columnlist COMMA column */ yytestcase(yyruleno==36); - /* (37) columnlist ::= column */ yytestcase(yyruleno==37); - /* (43) type ::= */ yytestcase(yyruleno==43); - /* (50) signed ::= plus_num */ yytestcase(yyruleno==50); - /* (51) signed ::= minus_num */ yytestcase(yyruleno==51); - /* (52) carglist ::= carglist ccons */ yytestcase(yyruleno==52); - /* (53) carglist ::= */ yytestcase(yyruleno==53); - /* (60) ccons ::= NULL onconf */ yytestcase(yyruleno==60); - /* (88) conslist ::= conslist tconscomma tcons */ yytestcase(yyruleno==88); - /* (89) conslist ::= tcons */ yytestcase(yyruleno==89); - /* (91) tconscomma ::= */ yytestcase(yyruleno==91); - /* (273) foreach_clause ::= */ yytestcase(yyruleno==273); - /* (274) foreach_clause ::= FOR EACH ROW */ yytestcase(yyruleno==274); - /* (281) tridxby ::= */ yytestcase(yyruleno==281); - /* (298) database_kw_opt ::= DATABASE */ yytestcase(yyruleno==298); - /* (299) database_kw_opt ::= */ yytestcase(yyruleno==299); - /* (307) kwcolumn_opt ::= */ yytestcase(yyruleno==307); - /* (308) kwcolumn_opt ::= COLUMNKW */ yytestcase(yyruleno==308); - /* (312) vtabarglist ::= vtabarg */ yytestcase(yyruleno==312); - /* (313) vtabarglist ::= vtabarglist COMMA vtabarg */ yytestcase(yyruleno==313); - /* (315) vtabarg ::= vtabarg vtabargtoken */ yytestcase(yyruleno==315); - /* (319) anylist ::= */ yytestcase(yyruleno==319); - /* (320) anylist ::= anylist LP anylist RP */ yytestcase(yyruleno==320); - /* (321) anylist ::= anylist ANY */ yytestcase(yyruleno==321); - break; - }; - assert( yyruleno>=0 && yyrulenoyyidx -= yysize; - yyact = yy_find_reduce_action(yymsp[-yysize].stateno,(YYCODETYPE)yygoto); - if( yyact < YYNSTATE ){ -#ifdef NDEBUG - /* If we are not debugging and the reduce action popped at least - ** one element off the stack, then we can push the new element back - ** onto the stack here, and skip the stack overflow test in yy_shift(). - ** That gives a significant speed improvement. */ - if( yysize ){ - yypParser->yyidx++; - yymsp -= yysize-1; - yymsp->stateno = (YYACTIONTYPE)yyact; - yymsp->major = (YYCODETYPE)yygoto; - yymsp->minor = yygotominor; - }else -#endif - { - yy_shift(yypParser,yyact,yygoto,&yygotominor); - } - }else{ - assert( yyact == YYNSTATE + YYNRULE + 1 ); - yy_accept(yypParser); - } -} - -/* -** The following code executes when the parse fails -*/ -#ifndef YYNOERRORRECOVERY -static void yy_parse_failed( - yyParser *yypParser /* The parser */ -){ - sqlite3ParserARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sFail!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser fails */ - sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} -#endif /* YYNOERRORRECOVERY */ - -/* -** The following code executes when a syntax error first occurs. -*/ -static void yy_syntax_error( - yyParser *yypParser, /* The parser */ - int yymajor, /* The major type of the error token */ - YYMINORTYPE yyminor /* The minor type of the error token */ -){ - sqlite3ParserARG_FETCH; -#define TOKEN (yyminor.yy0) - - UNUSED_PARAMETER(yymajor); /* Silence some compiler warnings */ - assert( TOKEN.z[0] ); /* The tokenizer always gives us a token */ - sqlite3ErrorMsg(pParse, "near \"%T\": syntax error", &TOKEN); - sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* -** The following is executed when the parser accepts -*/ -static void yy_accept( - yyParser *yypParser /* The parser */ -){ - sqlite3ParserARG_FETCH; -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sAccept!\n",yyTracePrompt); - } -#endif - while( yypParser->yyidx>=0 ) yy_pop_parser_stack(yypParser); - /* Here code is inserted which will be executed whenever the - ** parser accepts */ - sqlite3ParserARG_STORE; /* Suppress warning about unused %extra_argument variable */ -} - -/* The main parser program. -** The first argument is a pointer to a structure obtained from -** "sqlite3ParserAlloc" which describes the current state of the parser. -** The second argument is the major token number. The third is -** the minor token. The fourth optional argument is whatever the -** user wants (and specified in the grammar) and is available for -** use by the action routines. -** -** Inputs: -**
      -**
    • A pointer to the parser (an opaque structure.) -**
    • The major token number. -**
    • The minor token number. -**
    • An option argument of a grammar-specified type. -**
    -** -** Outputs: -** None. -*/ -SQLITE_PRIVATE void sqlite3Parser( - void *yyp, /* The parser */ - int yymajor, /* The major token code number */ - sqlite3ParserTOKENTYPE yyminor /* The value for the token */ - sqlite3ParserARG_PDECL /* Optional %extra_argument parameter */ -){ - YYMINORTYPE yyminorunion; - int yyact; /* The parser action. */ -#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) - int yyendofinput; /* True if we are at the end of input */ -#endif -#ifdef YYERRORSYMBOL - int yyerrorhit = 0; /* True if yymajor has invoked an error */ -#endif - yyParser *yypParser; /* The parser */ - - /* (re)initialize the parser, if necessary */ - yypParser = (yyParser*)yyp; - if( yypParser->yyidx<0 ){ -#if YYSTACKDEPTH<=0 - if( yypParser->yystksz <=0 ){ - /*memset(&yyminorunion, 0, sizeof(yyminorunion));*/ - yyminorunion = yyzerominor; - yyStackOverflow(yypParser, &yyminorunion); - return; - } -#endif - yypParser->yyidx = 0; - yypParser->yyerrcnt = -1; - yypParser->yystack[0].stateno = 0; - yypParser->yystack[0].major = 0; - } - yyminorunion.yy0 = yyminor; -#if !defined(YYERRORSYMBOL) && !defined(YYNOERRORRECOVERY) - yyendofinput = (yymajor==0); -#endif - sqlite3ParserARG_STORE; - -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sInput %s\n",yyTracePrompt,yyTokenName[yymajor]); - } -#endif - - do{ - yyact = yy_find_shift_action(yypParser,(YYCODETYPE)yymajor); - if( yyactyyerrcnt--; - yymajor = YYNOCODE; - }else if( yyact < YYNSTATE + YYNRULE ){ - yy_reduce(yypParser,yyact-YYNSTATE); - }else{ - assert( yyact == YY_ERROR_ACTION ); -#ifdef YYERRORSYMBOL - int yymx; -#endif -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sSyntax Error!\n",yyTracePrompt); - } -#endif -#ifdef YYERRORSYMBOL - /* A syntax error has occurred. - ** The response to an error depends upon whether or not the - ** grammar defines an error token "ERROR". - ** - ** This is what we do if the grammar does define ERROR: - ** - ** * Call the %syntax_error function. - ** - ** * Begin popping the stack until we enter a state where - ** it is legal to shift the error symbol, then shift - ** the error symbol. - ** - ** * Set the error count to three. - ** - ** * Begin accepting and shifting new tokens. No new error - ** processing will occur until three tokens have been - ** shifted successfully. - ** - */ - if( yypParser->yyerrcnt<0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yymx = yypParser->yystack[yypParser->yyidx].major; - if( yymx==YYERRORSYMBOL || yyerrorhit ){ -#ifndef NDEBUG - if( yyTraceFILE ){ - fprintf(yyTraceFILE,"%sDiscard input token %s\n", - yyTracePrompt,yyTokenName[yymajor]); - } -#endif - yy_destructor(yypParser, (YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - }else{ - while( - yypParser->yyidx >= 0 && - yymx != YYERRORSYMBOL && - (yyact = yy_find_reduce_action( - yypParser->yystack[yypParser->yyidx].stateno, - YYERRORSYMBOL)) >= YYNSTATE - ){ - yy_pop_parser_stack(yypParser); - } - if( yypParser->yyidx < 0 || yymajor==0 ){ - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yy_parse_failed(yypParser); - yymajor = YYNOCODE; - }else if( yymx!=YYERRORSYMBOL ){ - YYMINORTYPE u2; - u2.YYERRSYMDT = 0; - yy_shift(yypParser,yyact,YYERRORSYMBOL,&u2); - } - } - yypParser->yyerrcnt = 3; - yyerrorhit = 1; -#elif defined(YYNOERRORRECOVERY) - /* If the YYNOERRORRECOVERY macro is defined, then do not attempt to - ** do any kind of error recovery. Instead, simply invoke the syntax - ** error routine and continue going as if nothing had happened. - ** - ** Applications can set this macro (for example inside %include) if - ** they intend to abandon the parse upon the first syntax error seen. - */ - yy_syntax_error(yypParser,yymajor,yyminorunion); - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - yymajor = YYNOCODE; - -#else /* YYERRORSYMBOL is not defined */ - /* This is what we do if the grammar does not define ERROR: - ** - ** * Report an error message, and throw away the input token. - ** - ** * If the input token is $, then fail the parse. - ** - ** As before, subsequent error messages are suppressed until - ** three input tokens have been successfully shifted. - */ - if( yypParser->yyerrcnt<=0 ){ - yy_syntax_error(yypParser,yymajor,yyminorunion); - } - yypParser->yyerrcnt = 3; - yy_destructor(yypParser,(YYCODETYPE)yymajor,&yyminorunion); - if( yyendofinput ){ - yy_parse_failed(yypParser); - } - yymajor = YYNOCODE; -#endif - } - }while( yymajor!=YYNOCODE && yypParser->yyidx>=0 ); - return; -} - -/************** End of parse.c ***********************************************/ -/************** Begin file tokenize.c ****************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** An tokenizer for SQL -** -** This file contains C code that splits an SQL input string up into -** individual tokens and sends those tokens one-by-one over to the -** parser for analysis. -*/ -/* #include */ - -/* -** The charMap() macro maps alphabetic characters into their -** lower-case ASCII equivalent. On ASCII machines, this is just -** an upper-to-lower case map. On EBCDIC machines we also need -** to adjust the encoding. Only alphabetic characters and underscores -** need to be translated. -*/ -#ifdef SQLITE_ASCII -# define charMap(X) sqlite3UpperToLower[(unsigned char)X] -#endif -#ifdef SQLITE_EBCDIC -# define charMap(X) ebcdicToAscii[(unsigned char)X] -const unsigned char ebcdicToAscii[] = { -/* 0 1 2 3 4 5 6 7 8 9 A B C D E F */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2x */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 3x */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 4x */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 5x */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 95, 0, 0, /* 6x */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 7x */ - 0, 97, 98, 99,100,101,102,103,104,105, 0, 0, 0, 0, 0, 0, /* 8x */ - 0,106,107,108,109,110,111,112,113,114, 0, 0, 0, 0, 0, 0, /* 9x */ - 0, 0,115,116,117,118,119,120,121,122, 0, 0, 0, 0, 0, 0, /* Ax */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Bx */ - 0, 97, 98, 99,100,101,102,103,104,105, 0, 0, 0, 0, 0, 0, /* Cx */ - 0,106,107,108,109,110,111,112,113,114, 0, 0, 0, 0, 0, 0, /* Dx */ - 0, 0,115,116,117,118,119,120,121,122, 0, 0, 0, 0, 0, 0, /* Ex */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Fx */ -}; -#endif - -/* -** The sqlite3KeywordCode function looks up an identifier to determine if -** it is a keyword. If it is a keyword, the token code of that keyword is -** returned. If the input is not a keyword, TK_ID is returned. -** -** The implementation of this routine was generated by a program, -** mkkeywordhash.h, located in the tool subdirectory of the distribution. -** The output of the mkkeywordhash.c program is written into a file -** named keywordhash.h and then included into this source file by -** the #include below. -*/ -/************** Include keywordhash.h in the middle of tokenize.c ************/ -/************** Begin file keywordhash.h *************************************/ -/***** This file contains automatically generated code ****** -** -** The code in this file has been automatically generated by -** -** sqlite/tool/mkkeywordhash.c -** -** The code in this file implements a function that determines whether -** or not a given identifier is really an SQL keyword. The same thing -** might be implemented more directly using a hand-written hash table. -** But by using this automatically generated code, the size of the code -** is substantially reduced. This is important for embedded applications -** on platforms with limited memory. -*/ -/* Hash score: 182 */ -static int keywordCode(const char *z, int n){ - /* zText[] encodes 834 bytes of keywords in 554 bytes */ - /* REINDEXEDESCAPEACHECKEYBEFOREIGNOREGEXPLAINSTEADDATABASELECT */ - /* ABLEFTHENDEFERRABLELSEXCEPTRANSACTIONATURALTERAISEXCLUSIVE */ - /* XISTSAVEPOINTERSECTRIGGEREFERENCESCONSTRAINTOFFSETEMPORARY */ - /* UNIQUERYWITHOUTERELEASEATTACHAVINGROUPDATEBEGINNERECURSIVE */ - /* BETWEENOTNULLIKECASCADELETECASECOLLATECREATECURRENT_DATEDETACH */ - /* IMMEDIATEJOINSERTMATCHPLANALYZEPRAGMABORTVALUESVIRTUALIMITWHEN */ - /* WHERENAMEAFTEREPLACEANDEFAULTAUTOINCREMENTCASTCOLUMNCOMMIT */ - /* CONFLICTCROSSCURRENT_TIMESTAMPRIMARYDEFERREDISTINCTDROPFAIL */ - /* FROMFULLGLOBYIFISNULLORDERESTRICTRIGHTROLLBACKROWUNIONUSING */ - /* VACUUMVIEWINITIALLY */ - static const char zText[553] = { - 'R','E','I','N','D','E','X','E','D','E','S','C','A','P','E','A','C','H', - 'E','C','K','E','Y','B','E','F','O','R','E','I','G','N','O','R','E','G', - 'E','X','P','L','A','I','N','S','T','E','A','D','D','A','T','A','B','A', - 'S','E','L','E','C','T','A','B','L','E','F','T','H','E','N','D','E','F', - 'E','R','R','A','B','L','E','L','S','E','X','C','E','P','T','R','A','N', - 'S','A','C','T','I','O','N','A','T','U','R','A','L','T','E','R','A','I', - 'S','E','X','C','L','U','S','I','V','E','X','I','S','T','S','A','V','E', - 'P','O','I','N','T','E','R','S','E','C','T','R','I','G','G','E','R','E', - 'F','E','R','E','N','C','E','S','C','O','N','S','T','R','A','I','N','T', - 'O','F','F','S','E','T','E','M','P','O','R','A','R','Y','U','N','I','Q', - 'U','E','R','Y','W','I','T','H','O','U','T','E','R','E','L','E','A','S', - 'E','A','T','T','A','C','H','A','V','I','N','G','R','O','U','P','D','A', - 'T','E','B','E','G','I','N','N','E','R','E','C','U','R','S','I','V','E', - 'B','E','T','W','E','E','N','O','T','N','U','L','L','I','K','E','C','A', - 'S','C','A','D','E','L','E','T','E','C','A','S','E','C','O','L','L','A', - 'T','E','C','R','E','A','T','E','C','U','R','R','E','N','T','_','D','A', - 'T','E','D','E','T','A','C','H','I','M','M','E','D','I','A','T','E','J', - 'O','I','N','S','E','R','T','M','A','T','C','H','P','L','A','N','A','L', - 'Y','Z','E','P','R','A','G','M','A','B','O','R','T','V','A','L','U','E', - 'S','V','I','R','T','U','A','L','I','M','I','T','W','H','E','N','W','H', - 'E','R','E','N','A','M','E','A','F','T','E','R','E','P','L','A','C','E', - 'A','N','D','E','F','A','U','L','T','A','U','T','O','I','N','C','R','E', - 'M','E','N','T','C','A','S','T','C','O','L','U','M','N','C','O','M','M', - 'I','T','C','O','N','F','L','I','C','T','C','R','O','S','S','C','U','R', - 'R','E','N','T','_','T','I','M','E','S','T','A','M','P','R','I','M','A', - 'R','Y','D','E','F','E','R','R','E','D','I','S','T','I','N','C','T','D', - 'R','O','P','F','A','I','L','F','R','O','M','F','U','L','L','G','L','O', - 'B','Y','I','F','I','S','N','U','L','L','O','R','D','E','R','E','S','T', - 'R','I','C','T','R','I','G','H','T','R','O','L','L','B','A','C','K','R', - 'O','W','U','N','I','O','N','U','S','I','N','G','V','A','C','U','U','M', - 'V','I','E','W','I','N','I','T','I','A','L','L','Y', - }; - static const unsigned char aHash[127] = { - 76, 105, 117, 74, 0, 45, 0, 0, 82, 0, 77, 0, 0, - 42, 12, 78, 15, 0, 116, 85, 54, 112, 0, 19, 0, 0, - 121, 0, 119, 115, 0, 22, 93, 0, 9, 0, 0, 70, 71, - 0, 69, 6, 0, 48, 90, 102, 0, 118, 101, 0, 0, 44, - 0, 103, 24, 0, 17, 0, 122, 53, 23, 0, 5, 110, 25, - 96, 0, 0, 124, 106, 60, 123, 57, 28, 55, 0, 91, 0, - 100, 26, 0, 99, 0, 0, 0, 95, 92, 97, 88, 109, 14, - 39, 108, 0, 81, 0, 18, 89, 111, 32, 0, 120, 80, 113, - 62, 46, 84, 0, 0, 94, 40, 59, 114, 0, 36, 0, 0, - 29, 0, 86, 63, 64, 0, 20, 61, 0, 56, - }; - static const unsigned char aNext[124] = { - 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 2, 0, 0, 0, 0, 0, 0, 13, 0, 0, 0, 0, - 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 33, 0, 21, 0, 0, 0, 0, 0, 50, - 0, 43, 3, 47, 0, 0, 0, 0, 30, 0, 58, 0, 38, - 0, 0, 0, 1, 66, 0, 0, 67, 0, 41, 0, 0, 0, - 0, 0, 0, 49, 65, 0, 0, 0, 0, 31, 52, 16, 34, - 10, 0, 0, 0, 0, 0, 0, 0, 11, 72, 79, 0, 8, - 0, 104, 98, 0, 107, 0, 87, 0, 75, 51, 0, 27, 37, - 73, 83, 0, 35, 68, 0, 0, - }; - static const unsigned char aLen[124] = { - 7, 7, 5, 4, 6, 4, 5, 3, 6, 7, 3, 6, 6, - 7, 7, 3, 8, 2, 6, 5, 4, 4, 3, 10, 4, 6, - 11, 6, 2, 7, 5, 5, 9, 6, 9, 9, 7, 10, 10, - 4, 6, 2, 3, 9, 4, 2, 6, 5, 7, 4, 5, 7, - 6, 6, 5, 6, 5, 5, 9, 7, 7, 3, 2, 4, 4, - 7, 3, 6, 4, 7, 6, 12, 6, 9, 4, 6, 5, 4, - 7, 6, 5, 6, 7, 5, 4, 5, 6, 5, 7, 3, 7, - 13, 2, 2, 4, 6, 6, 8, 5, 17, 12, 7, 8, 8, - 2, 4, 4, 4, 4, 4, 2, 2, 6, 5, 8, 5, 8, - 3, 5, 5, 6, 4, 9, 3, - }; - static const unsigned short int aOffset[124] = { - 0, 2, 2, 8, 9, 14, 16, 20, 23, 25, 25, 29, 33, - 36, 41, 46, 48, 53, 54, 59, 62, 65, 67, 69, 78, 81, - 86, 91, 95, 96, 101, 105, 109, 117, 122, 128, 136, 142, 152, - 159, 162, 162, 165, 167, 167, 171, 176, 179, 184, 184, 188, 192, - 199, 204, 209, 212, 218, 221, 225, 234, 240, 240, 240, 243, 246, - 250, 251, 255, 261, 265, 272, 278, 290, 296, 305, 307, 313, 318, - 320, 327, 332, 337, 343, 349, 354, 358, 361, 367, 371, 378, 380, - 387, 389, 391, 400, 404, 410, 416, 424, 429, 429, 445, 452, 459, - 460, 467, 471, 475, 479, 483, 486, 488, 490, 496, 500, 508, 513, - 521, 524, 529, 534, 540, 544, 549, - }; - static const unsigned char aCode[124] = { - TK_REINDEX, TK_INDEXED, TK_INDEX, TK_DESC, TK_ESCAPE, - TK_EACH, TK_CHECK, TK_KEY, TK_BEFORE, TK_FOREIGN, - TK_FOR, TK_IGNORE, TK_LIKE_KW, TK_EXPLAIN, TK_INSTEAD, - TK_ADD, TK_DATABASE, TK_AS, TK_SELECT, TK_TABLE, - TK_JOIN_KW, TK_THEN, TK_END, TK_DEFERRABLE, TK_ELSE, - TK_EXCEPT, TK_TRANSACTION,TK_ACTION, TK_ON, TK_JOIN_KW, - TK_ALTER, TK_RAISE, TK_EXCLUSIVE, TK_EXISTS, TK_SAVEPOINT, - TK_INTERSECT, TK_TRIGGER, TK_REFERENCES, TK_CONSTRAINT, TK_INTO, - TK_OFFSET, TK_OF, TK_SET, TK_TEMP, TK_TEMP, - TK_OR, TK_UNIQUE, TK_QUERY, TK_WITHOUT, TK_WITH, - TK_JOIN_KW, TK_RELEASE, TK_ATTACH, TK_HAVING, TK_GROUP, - TK_UPDATE, TK_BEGIN, TK_JOIN_KW, TK_RECURSIVE, TK_BETWEEN, - TK_NOTNULL, TK_NOT, TK_NO, TK_NULL, TK_LIKE_KW, - TK_CASCADE, TK_ASC, TK_DELETE, TK_CASE, TK_COLLATE, - TK_CREATE, TK_CTIME_KW, TK_DETACH, TK_IMMEDIATE, TK_JOIN, - TK_INSERT, TK_MATCH, TK_PLAN, TK_ANALYZE, TK_PRAGMA, - TK_ABORT, TK_VALUES, TK_VIRTUAL, TK_LIMIT, TK_WHEN, - TK_WHERE, TK_RENAME, TK_AFTER, TK_REPLACE, TK_AND, - TK_DEFAULT, TK_AUTOINCR, TK_TO, TK_IN, TK_CAST, - TK_COLUMNKW, TK_COMMIT, TK_CONFLICT, TK_JOIN_KW, TK_CTIME_KW, - TK_CTIME_KW, TK_PRIMARY, TK_DEFERRED, TK_DISTINCT, TK_IS, - TK_DROP, TK_FAIL, TK_FROM, TK_JOIN_KW, TK_LIKE_KW, - TK_BY, TK_IF, TK_ISNULL, TK_ORDER, TK_RESTRICT, - TK_JOIN_KW, TK_ROLLBACK, TK_ROW, TK_UNION, TK_USING, - TK_VACUUM, TK_VIEW, TK_INITIALLY, TK_ALL, - }; - int h, i; - if( n<2 ) return TK_ID; - h = ((charMap(z[0])*4) ^ - (charMap(z[n-1])*3) ^ - n) % 127; - for(i=((int)aHash[h])-1; i>=0; i=((int)aNext[i])-1){ - if( aLen[i]==n && sqlite3StrNICmp(&zText[aOffset[i]],z,n)==0 ){ - testcase( i==0 ); /* REINDEX */ - testcase( i==1 ); /* INDEXED */ - testcase( i==2 ); /* INDEX */ - testcase( i==3 ); /* DESC */ - testcase( i==4 ); /* ESCAPE */ - testcase( i==5 ); /* EACH */ - testcase( i==6 ); /* CHECK */ - testcase( i==7 ); /* KEY */ - testcase( i==8 ); /* BEFORE */ - testcase( i==9 ); /* FOREIGN */ - testcase( i==10 ); /* FOR */ - testcase( i==11 ); /* IGNORE */ - testcase( i==12 ); /* REGEXP */ - testcase( i==13 ); /* EXPLAIN */ - testcase( i==14 ); /* INSTEAD */ - testcase( i==15 ); /* ADD */ - testcase( i==16 ); /* DATABASE */ - testcase( i==17 ); /* AS */ - testcase( i==18 ); /* SELECT */ - testcase( i==19 ); /* TABLE */ - testcase( i==20 ); /* LEFT */ - testcase( i==21 ); /* THEN */ - testcase( i==22 ); /* END */ - testcase( i==23 ); /* DEFERRABLE */ - testcase( i==24 ); /* ELSE */ - testcase( i==25 ); /* EXCEPT */ - testcase( i==26 ); /* TRANSACTION */ - testcase( i==27 ); /* ACTION */ - testcase( i==28 ); /* ON */ - testcase( i==29 ); /* NATURAL */ - testcase( i==30 ); /* ALTER */ - testcase( i==31 ); /* RAISE */ - testcase( i==32 ); /* EXCLUSIVE */ - testcase( i==33 ); /* EXISTS */ - testcase( i==34 ); /* SAVEPOINT */ - testcase( i==35 ); /* INTERSECT */ - testcase( i==36 ); /* TRIGGER */ - testcase( i==37 ); /* REFERENCES */ - testcase( i==38 ); /* CONSTRAINT */ - testcase( i==39 ); /* INTO */ - testcase( i==40 ); /* OFFSET */ - testcase( i==41 ); /* OF */ - testcase( i==42 ); /* SET */ - testcase( i==43 ); /* TEMPORARY */ - testcase( i==44 ); /* TEMP */ - testcase( i==45 ); /* OR */ - testcase( i==46 ); /* UNIQUE */ - testcase( i==47 ); /* QUERY */ - testcase( i==48 ); /* WITHOUT */ - testcase( i==49 ); /* WITH */ - testcase( i==50 ); /* OUTER */ - testcase( i==51 ); /* RELEASE */ - testcase( i==52 ); /* ATTACH */ - testcase( i==53 ); /* HAVING */ - testcase( i==54 ); /* GROUP */ - testcase( i==55 ); /* UPDATE */ - testcase( i==56 ); /* BEGIN */ - testcase( i==57 ); /* INNER */ - testcase( i==58 ); /* RECURSIVE */ - testcase( i==59 ); /* BETWEEN */ - testcase( i==60 ); /* NOTNULL */ - testcase( i==61 ); /* NOT */ - testcase( i==62 ); /* NO */ - testcase( i==63 ); /* NULL */ - testcase( i==64 ); /* LIKE */ - testcase( i==65 ); /* CASCADE */ - testcase( i==66 ); /* ASC */ - testcase( i==67 ); /* DELETE */ - testcase( i==68 ); /* CASE */ - testcase( i==69 ); /* COLLATE */ - testcase( i==70 ); /* CREATE */ - testcase( i==71 ); /* CURRENT_DATE */ - testcase( i==72 ); /* DETACH */ - testcase( i==73 ); /* IMMEDIATE */ - testcase( i==74 ); /* JOIN */ - testcase( i==75 ); /* INSERT */ - testcase( i==76 ); /* MATCH */ - testcase( i==77 ); /* PLAN */ - testcase( i==78 ); /* ANALYZE */ - testcase( i==79 ); /* PRAGMA */ - testcase( i==80 ); /* ABORT */ - testcase( i==81 ); /* VALUES */ - testcase( i==82 ); /* VIRTUAL */ - testcase( i==83 ); /* LIMIT */ - testcase( i==84 ); /* WHEN */ - testcase( i==85 ); /* WHERE */ - testcase( i==86 ); /* RENAME */ - testcase( i==87 ); /* AFTER */ - testcase( i==88 ); /* REPLACE */ - testcase( i==89 ); /* AND */ - testcase( i==90 ); /* DEFAULT */ - testcase( i==91 ); /* AUTOINCREMENT */ - testcase( i==92 ); /* TO */ - testcase( i==93 ); /* IN */ - testcase( i==94 ); /* CAST */ - testcase( i==95 ); /* COLUMN */ - testcase( i==96 ); /* COMMIT */ - testcase( i==97 ); /* CONFLICT */ - testcase( i==98 ); /* CROSS */ - testcase( i==99 ); /* CURRENT_TIMESTAMP */ - testcase( i==100 ); /* CURRENT_TIME */ - testcase( i==101 ); /* PRIMARY */ - testcase( i==102 ); /* DEFERRED */ - testcase( i==103 ); /* DISTINCT */ - testcase( i==104 ); /* IS */ - testcase( i==105 ); /* DROP */ - testcase( i==106 ); /* FAIL */ - testcase( i==107 ); /* FROM */ - testcase( i==108 ); /* FULL */ - testcase( i==109 ); /* GLOB */ - testcase( i==110 ); /* BY */ - testcase( i==111 ); /* IF */ - testcase( i==112 ); /* ISNULL */ - testcase( i==113 ); /* ORDER */ - testcase( i==114 ); /* RESTRICT */ - testcase( i==115 ); /* RIGHT */ - testcase( i==116 ); /* ROLLBACK */ - testcase( i==117 ); /* ROW */ - testcase( i==118 ); /* UNION */ - testcase( i==119 ); /* USING */ - testcase( i==120 ); /* VACUUM */ - testcase( i==121 ); /* VIEW */ - testcase( i==122 ); /* INITIALLY */ - testcase( i==123 ); /* ALL */ - return aCode[i]; - } - } - return TK_ID; -} -SQLITE_PRIVATE int sqlite3KeywordCode(const unsigned char *z, int n){ - return keywordCode((char*)z, n); -} -#define SQLITE_N_KEYWORD 124 - -/************** End of keywordhash.h *****************************************/ -/************** Continuing where we left off in tokenize.c *******************/ - - -/* -** If X is a character that can be used in an identifier then -** IdChar(X) will be true. Otherwise it is false. -** -** For ASCII, any character with the high-order bit set is -** allowed in an identifier. For 7-bit characters, -** sqlite3IsIdChar[X] must be 1. -** -** For EBCDIC, the rules are more complex but have the same -** end result. -** -** Ticket #1066. the SQL standard does not allow '$' in the -** middle of identfiers. But many SQL implementations do. -** SQLite will allow '$' in identifiers for compatibility. -** But the feature is undocumented. -*/ -#ifdef SQLITE_ASCII -#define IdChar(C) ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0) -#endif -#ifdef SQLITE_EBCDIC -SQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[] = { -/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 4x */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, /* 5x */ - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, /* 6x */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, /* 7x */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, /* 8x */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 0, /* 9x */ - 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, /* Ax */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* Bx */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Cx */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Dx */ - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, /* Ex */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, /* Fx */ -}; -#define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40])) -#endif - - -/* -** Return the length of the token that begins at z[0]. -** Store the token type in *tokenType before returning. -*/ -SQLITE_PRIVATE int sqlite3GetToken(const unsigned char *z, int *tokenType){ - int i, c; - switch( *z ){ - case ' ': case '\t': case '\n': case '\f': case '\r': { - testcase( z[0]==' ' ); - testcase( z[0]=='\t' ); - testcase( z[0]=='\n' ); - testcase( z[0]=='\f' ); - testcase( z[0]=='\r' ); - for(i=1; sqlite3Isspace(z[i]); i++){} - *tokenType = TK_SPACE; - return i; - } - case '-': { - if( z[1]=='-' ){ - for(i=2; (c=z[i])!=0 && c!='\n'; i++){} - *tokenType = TK_SPACE; /* IMP: R-22934-25134 */ - return i; - } - *tokenType = TK_MINUS; - return 1; - } - case '(': { - *tokenType = TK_LP; - return 1; - } - case ')': { - *tokenType = TK_RP; - return 1; - } - case ';': { - *tokenType = TK_SEMI; - return 1; - } - case '+': { - *tokenType = TK_PLUS; - return 1; - } - case '*': { - *tokenType = TK_STAR; - return 1; - } - case '/': { - if( z[1]!='*' || z[2]==0 ){ - *tokenType = TK_SLASH; - return 1; - } - for(i=3, c=z[2]; (c!='*' || z[i]!='/') && (c=z[i])!=0; i++){} - if( c ) i++; - *tokenType = TK_SPACE; /* IMP: R-22934-25134 */ - return i; - } - case '%': { - *tokenType = TK_REM; - return 1; - } - case '=': { - *tokenType = TK_EQ; - return 1 + (z[1]=='='); - } - case '<': { - if( (c=z[1])=='=' ){ - *tokenType = TK_LE; - return 2; - }else if( c=='>' ){ - *tokenType = TK_NE; - return 2; - }else if( c=='<' ){ - *tokenType = TK_LSHIFT; - return 2; - }else{ - *tokenType = TK_LT; - return 1; - } - } - case '>': { - if( (c=z[1])=='=' ){ - *tokenType = TK_GE; - return 2; - }else if( c=='>' ){ - *tokenType = TK_RSHIFT; - return 2; - }else{ - *tokenType = TK_GT; - return 1; - } - } - case '!': { - if( z[1]!='=' ){ - *tokenType = TK_ILLEGAL; - return 2; - }else{ - *tokenType = TK_NE; - return 2; - } - } - case '|': { - if( z[1]!='|' ){ - *tokenType = TK_BITOR; - return 1; - }else{ - *tokenType = TK_CONCAT; - return 2; - } - } - case ',': { - *tokenType = TK_COMMA; - return 1; - } - case '&': { - *tokenType = TK_BITAND; - return 1; - } - case '~': { - *tokenType = TK_BITNOT; - return 1; - } - case '`': - case '\'': - case '"': { - int delim = z[0]; - testcase( delim=='`' ); - testcase( delim=='\'' ); - testcase( delim=='"' ); - for(i=1; (c=z[i])!=0; i++){ - if( c==delim ){ - if( z[i+1]==delim ){ - i++; - }else{ - break; - } - } - } - if( c=='\'' ){ - *tokenType = TK_STRING; - return i+1; - }else if( c!=0 ){ - *tokenType = TK_ID; - return i+1; - }else{ - *tokenType = TK_ILLEGAL; - return i; - } - } - case '.': { -#ifndef SQLITE_OMIT_FLOATING_POINT - if( !sqlite3Isdigit(z[1]) ) -#endif - { - *tokenType = TK_DOT; - return 1; - } - /* If the next character is a digit, this is a floating point - ** number that begins with ".". Fall thru into the next case */ - } - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': { - testcase( z[0]=='0' ); testcase( z[0]=='1' ); testcase( z[0]=='2' ); - testcase( z[0]=='3' ); testcase( z[0]=='4' ); testcase( z[0]=='5' ); - testcase( z[0]=='6' ); testcase( z[0]=='7' ); testcase( z[0]=='8' ); - testcase( z[0]=='9' ); - *tokenType = TK_INTEGER; - for(i=0; sqlite3Isdigit(z[i]); i++){} -#ifndef SQLITE_OMIT_FLOATING_POINT - if( z[i]=='.' ){ - i++; - while( sqlite3Isdigit(z[i]) ){ i++; } - *tokenType = TK_FLOAT; - } - if( (z[i]=='e' || z[i]=='E') && - ( sqlite3Isdigit(z[i+1]) - || ((z[i+1]=='+' || z[i+1]=='-') && sqlite3Isdigit(z[i+2])) - ) - ){ - i += 2; - while( sqlite3Isdigit(z[i]) ){ i++; } - *tokenType = TK_FLOAT; - } -#endif - while( IdChar(z[i]) ){ - *tokenType = TK_ILLEGAL; - i++; - } - return i; - } - case '[': { - for(i=1, c=z[0]; c!=']' && (c=z[i])!=0; i++){} - *tokenType = c==']' ? TK_ID : TK_ILLEGAL; - return i; - } - case '?': { - *tokenType = TK_VARIABLE; - for(i=1; sqlite3Isdigit(z[i]); i++){} - return i; - } -#ifndef SQLITE_OMIT_TCL_VARIABLE - case '$': -#endif - case '@': /* For compatibility with MS SQL Server */ - case '#': - case ':': { - int n = 0; - testcase( z[0]=='$' ); testcase( z[0]=='@' ); - testcase( z[0]==':' ); testcase( z[0]=='#' ); - *tokenType = TK_VARIABLE; - for(i=1; (c=z[i])!=0; i++){ - if( IdChar(c) ){ - n++; -#ifndef SQLITE_OMIT_TCL_VARIABLE - }else if( c=='(' && n>0 ){ - do{ - i++; - }while( (c=z[i])!=0 && !sqlite3Isspace(c) && c!=')' ); - if( c==')' ){ - i++; - }else{ - *tokenType = TK_ILLEGAL; - } - break; - }else if( c==':' && z[i+1]==':' ){ - i++; -#endif - }else{ - break; - } - } - if( n==0 ) *tokenType = TK_ILLEGAL; - return i; - } -#ifndef SQLITE_OMIT_BLOB_LITERAL - case 'x': case 'X': { - testcase( z[0]=='x' ); testcase( z[0]=='X' ); - if( z[1]=='\'' ){ - *tokenType = TK_BLOB; - for(i=2; sqlite3Isxdigit(z[i]); i++){} - if( z[i]!='\'' || i%2 ){ - *tokenType = TK_ILLEGAL; - while( z[i] && z[i]!='\'' ){ i++; } - } - if( z[i] ) i++; - return i; - } - /* Otherwise fall through to the next case */ - } -#endif - default: { - if( !IdChar(*z) ){ - break; - } - for(i=1; IdChar(z[i]); i++){} - *tokenType = keywordCode((char*)z, i); - return i; - } - } - *tokenType = TK_ILLEGAL; - return 1; -} - -/* -** Run the parser on the given SQL string. The parser structure is -** passed in. An SQLITE_ status code is returned. If an error occurs -** then an and attempt is made to write an error message into -** memory obtained from sqlite3_malloc() and to make *pzErrMsg point to that -** error message. -*/ -SQLITE_PRIVATE int sqlite3RunParser(Parse *pParse, const char *zSql, char **pzErrMsg){ - int nErr = 0; /* Number of errors encountered */ - int i; /* Loop counter */ - void *pEngine; /* The LEMON-generated LALR(1) parser */ - int tokenType; /* type of the next token */ - int lastTokenParsed = -1; /* type of the previous token */ - u8 enableLookaside; /* Saved value of db->lookaside.bEnabled */ - sqlite3 *db = pParse->db; /* The database connection */ - int mxSqlLen; /* Max length of an SQL string */ - - - mxSqlLen = db->aLimit[SQLITE_LIMIT_SQL_LENGTH]; - if( db->nVdbeActive==0 ){ - db->u1.isInterrupted = 0; - } - pParse->rc = SQLITE_OK; - pParse->zTail = zSql; - i = 0; - assert( pzErrMsg!=0 ); - pEngine = sqlite3ParserAlloc((void*(*)(size_t))sqlite3Malloc); - if( pEngine==0 ){ - db->mallocFailed = 1; - return SQLITE_NOMEM; - } - assert( pParse->pNewTable==0 ); - assert( pParse->pNewTrigger==0 ); - assert( pParse->nVar==0 ); - assert( pParse->nzVar==0 ); - assert( pParse->azVar==0 ); - enableLookaside = db->lookaside.bEnabled; - if( db->lookaside.pStart ) db->lookaside.bEnabled = 1; - while( !db->mallocFailed && zSql[i]!=0 ){ - assert( i>=0 ); - pParse->sLastToken.z = &zSql[i]; - pParse->sLastToken.n = sqlite3GetToken((unsigned char*)&zSql[i],&tokenType); - i += pParse->sLastToken.n; - if( i>mxSqlLen ){ - pParse->rc = SQLITE_TOOBIG; - break; - } - switch( tokenType ){ - case TK_SPACE: { - if( db->u1.isInterrupted ){ - sqlite3ErrorMsg(pParse, "interrupt"); - pParse->rc = SQLITE_INTERRUPT; - goto abort_parse; - } - break; - } - case TK_ILLEGAL: { - sqlite3DbFree(db, *pzErrMsg); - *pzErrMsg = sqlite3MPrintf(db, "unrecognized token: \"%T\"", - &pParse->sLastToken); - nErr++; - goto abort_parse; - } - case TK_SEMI: { - pParse->zTail = &zSql[i]; - /* Fall thru into the default case */ - } - default: { - sqlite3Parser(pEngine, tokenType, pParse->sLastToken, pParse); - lastTokenParsed = tokenType; - if( pParse->rc!=SQLITE_OK ){ - goto abort_parse; - } - break; - } - } - } -abort_parse: - if( zSql[i]==0 && nErr==0 && pParse->rc==SQLITE_OK ){ - if( lastTokenParsed!=TK_SEMI ){ - sqlite3Parser(pEngine, TK_SEMI, pParse->sLastToken, pParse); - pParse->zTail = &zSql[i]; - } - sqlite3Parser(pEngine, 0, pParse->sLastToken, pParse); - } -#ifdef YYTRACKMAXSTACKDEPTH - sqlite3StatusSet(SQLITE_STATUS_PARSER_STACK, - sqlite3ParserStackPeak(pEngine) - ); -#endif /* YYDEBUG */ - sqlite3ParserFree(pEngine, sqlite3_free); - db->lookaside.bEnabled = enableLookaside; - if( db->mallocFailed ){ - pParse->rc = SQLITE_NOMEM; - } - if( pParse->rc!=SQLITE_OK && pParse->rc!=SQLITE_DONE && pParse->zErrMsg==0 ){ - sqlite3SetString(&pParse->zErrMsg, db, "%s", sqlite3ErrStr(pParse->rc)); - } - assert( pzErrMsg!=0 ); - if( pParse->zErrMsg ){ - *pzErrMsg = pParse->zErrMsg; - sqlite3_log(pParse->rc, "%s", *pzErrMsg); - pParse->zErrMsg = 0; - nErr++; - } - if( pParse->pVdbe && pParse->nErr>0 && pParse->nested==0 ){ - sqlite3VdbeDelete(pParse->pVdbe); - pParse->pVdbe = 0; - } -#ifndef SQLITE_OMIT_SHARED_CACHE - if( pParse->nested==0 ){ - sqlite3DbFree(db, pParse->aTableLock); - pParse->aTableLock = 0; - pParse->nTableLock = 0; - } -#endif -#ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3_free(pParse->apVtabLock); -#endif - - if( !IN_DECLARE_VTAB ){ - /* If the pParse->declareVtab flag is set, do not delete any table - ** structure built up in pParse->pNewTable. The calling code (see vtab.c) - ** will take responsibility for freeing the Table structure. - */ - sqlite3DeleteTable(db, pParse->pNewTable); - } - - if( pParse->bFreeWith ) sqlite3WithDelete(db, pParse->pWith); - sqlite3DeleteTrigger(db, pParse->pNewTrigger); - for(i=pParse->nzVar-1; i>=0; i--) sqlite3DbFree(db, pParse->azVar[i]); - sqlite3DbFree(db, pParse->azVar); - while( pParse->pAinc ){ - AutoincInfo *p = pParse->pAinc; - pParse->pAinc = p->pNext; - sqlite3DbFree(db, p); - } - while( pParse->pZombieTab ){ - Table *p = pParse->pZombieTab; - pParse->pZombieTab = p->pNextZombie; - sqlite3DeleteTable(db, p); - } - if( nErr>0 && pParse->rc==SQLITE_OK ){ - pParse->rc = SQLITE_ERROR; - } - return nErr; -} - -/************** End of tokenize.c ********************************************/ -/************** Begin file complete.c ****************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** An tokenizer for SQL -** -** This file contains C code that implements the sqlite3_complete() API. -** This code used to be part of the tokenizer.c source file. But by -** separating it out, the code will be automatically omitted from -** static links that do not use it. -*/ -#ifndef SQLITE_OMIT_COMPLETE - -/* -** This is defined in tokenize.c. We just have to import the definition. -*/ -#ifndef SQLITE_AMALGAMATION -#ifdef SQLITE_ASCII -#define IdChar(C) ((sqlite3CtypeMap[(unsigned char)C]&0x46)!=0) -#endif -#ifdef SQLITE_EBCDIC -SQLITE_PRIVATE const char sqlite3IsEbcdicIdChar[]; -#define IdChar(C) (((c=C)>=0x42 && sqlite3IsEbcdicIdChar[c-0x40])) -#endif -#endif /* SQLITE_AMALGAMATION */ - - -/* -** Token types used by the sqlite3_complete() routine. See the header -** comments on that procedure for additional information. -*/ -#define tkSEMI 0 -#define tkWS 1 -#define tkOTHER 2 -#ifndef SQLITE_OMIT_TRIGGER -#define tkEXPLAIN 3 -#define tkCREATE 4 -#define tkTEMP 5 -#define tkTRIGGER 6 -#define tkEND 7 -#endif - -/* -** Return TRUE if the given SQL string ends in a semicolon. -** -** Special handling is require for CREATE TRIGGER statements. -** Whenever the CREATE TRIGGER keywords are seen, the statement -** must end with ";END;". -** -** This implementation uses a state machine with 8 states: -** -** (0) INVALID We have not yet seen a non-whitespace character. -** -** (1) START At the beginning or end of an SQL statement. This routine -** returns 1 if it ends in the START state and 0 if it ends -** in any other state. -** -** (2) NORMAL We are in the middle of statement which ends with a single -** semicolon. -** -** (3) EXPLAIN The keyword EXPLAIN has been seen at the beginning of -** a statement. -** -** (4) CREATE The keyword CREATE has been seen at the beginning of a -** statement, possibly preceeded by EXPLAIN and/or followed by -** TEMP or TEMPORARY -** -** (5) TRIGGER We are in the middle of a trigger definition that must be -** ended by a semicolon, the keyword END, and another semicolon. -** -** (6) SEMI We've seen the first semicolon in the ";END;" that occurs at -** the end of a trigger definition. -** -** (7) END We've seen the ";END" of the ";END;" that occurs at the end -** of a trigger difinition. -** -** Transitions between states above are determined by tokens extracted -** from the input. The following tokens are significant: -** -** (0) tkSEMI A semicolon. -** (1) tkWS Whitespace. -** (2) tkOTHER Any other SQL token. -** (3) tkEXPLAIN The "explain" keyword. -** (4) tkCREATE The "create" keyword. -** (5) tkTEMP The "temp" or "temporary" keyword. -** (6) tkTRIGGER The "trigger" keyword. -** (7) tkEND The "end" keyword. -** -** Whitespace never causes a state transition and is always ignored. -** This means that a SQL string of all whitespace is invalid. -** -** If we compile with SQLITE_OMIT_TRIGGER, all of the computation needed -** to recognize the end of a trigger can be omitted. All we have to do -** is look for a semicolon that is not part of an string or comment. -*/ -SQLITE_API int sqlite3_complete(const char *zSql){ - u8 state = 0; /* Current state, using numbers defined in header comment */ - u8 token; /* Value of the next token */ - -#ifndef SQLITE_OMIT_TRIGGER - /* A complex statement machine used to detect the end of a CREATE TRIGGER - ** statement. This is the normal case. - */ - static const u8 trans[8][8] = { - /* Token: */ - /* State: ** SEMI WS OTHER EXPLAIN CREATE TEMP TRIGGER END */ - /* 0 INVALID: */ { 1, 0, 2, 3, 4, 2, 2, 2, }, - /* 1 START: */ { 1, 1, 2, 3, 4, 2, 2, 2, }, - /* 2 NORMAL: */ { 1, 2, 2, 2, 2, 2, 2, 2, }, - /* 3 EXPLAIN: */ { 1, 3, 3, 2, 4, 2, 2, 2, }, - /* 4 CREATE: */ { 1, 4, 2, 2, 2, 4, 5, 2, }, - /* 5 TRIGGER: */ { 6, 5, 5, 5, 5, 5, 5, 5, }, - /* 6 SEMI: */ { 6, 6, 5, 5, 5, 5, 5, 7, }, - /* 7 END: */ { 1, 7, 5, 5, 5, 5, 5, 5, }, - }; -#else - /* If triggers are not supported by this compile then the statement machine - ** used to detect the end of a statement is much simplier - */ - static const u8 trans[3][3] = { - /* Token: */ - /* State: ** SEMI WS OTHER */ - /* 0 INVALID: */ { 1, 0, 2, }, - /* 1 START: */ { 1, 1, 2, }, - /* 2 NORMAL: */ { 1, 2, 2, }, - }; -#endif /* SQLITE_OMIT_TRIGGER */ - - while( *zSql ){ - switch( *zSql ){ - case ';': { /* A semicolon */ - token = tkSEMI; - break; - } - case ' ': - case '\r': - case '\t': - case '\n': - case '\f': { /* White space is ignored */ - token = tkWS; - break; - } - case '/': { /* C-style comments */ - if( zSql[1]!='*' ){ - token = tkOTHER; - break; - } - zSql += 2; - while( zSql[0] && (zSql[0]!='*' || zSql[1]!='/') ){ zSql++; } - if( zSql[0]==0 ) return 0; - zSql++; - token = tkWS; - break; - } - case '-': { /* SQL-style comments from "--" to end of line */ - if( zSql[1]!='-' ){ - token = tkOTHER; - break; - } - while( *zSql && *zSql!='\n' ){ zSql++; } - if( *zSql==0 ) return state==1; - token = tkWS; - break; - } - case '[': { /* Microsoft-style identifiers in [...] */ - zSql++; - while( *zSql && *zSql!=']' ){ zSql++; } - if( *zSql==0 ) return 0; - token = tkOTHER; - break; - } - case '`': /* Grave-accent quoted symbols used by MySQL */ - case '"': /* single- and double-quoted strings */ - case '\'': { - int c = *zSql; - zSql++; - while( *zSql && *zSql!=c ){ zSql++; } - if( *zSql==0 ) return 0; - token = tkOTHER; - break; - } - default: { -#ifdef SQLITE_EBCDIC - unsigned char c; -#endif - if( IdChar((u8)*zSql) ){ - /* Keywords and unquoted identifiers */ - int nId; - for(nId=1; IdChar(zSql[nId]); nId++){} -#ifdef SQLITE_OMIT_TRIGGER - token = tkOTHER; -#else - switch( *zSql ){ - case 'c': case 'C': { - if( nId==6 && sqlite3StrNICmp(zSql, "create", 6)==0 ){ - token = tkCREATE; - }else{ - token = tkOTHER; - } - break; - } - case 't': case 'T': { - if( nId==7 && sqlite3StrNICmp(zSql, "trigger", 7)==0 ){ - token = tkTRIGGER; - }else if( nId==4 && sqlite3StrNICmp(zSql, "temp", 4)==0 ){ - token = tkTEMP; - }else if( nId==9 && sqlite3StrNICmp(zSql, "temporary", 9)==0 ){ - token = tkTEMP; - }else{ - token = tkOTHER; - } - break; - } - case 'e': case 'E': { - if( nId==3 && sqlite3StrNICmp(zSql, "end", 3)==0 ){ - token = tkEND; - }else -#ifndef SQLITE_OMIT_EXPLAIN - if( nId==7 && sqlite3StrNICmp(zSql, "explain", 7)==0 ){ - token = tkEXPLAIN; - }else -#endif - { - token = tkOTHER; - } - break; - } - default: { - token = tkOTHER; - break; - } - } -#endif /* SQLITE_OMIT_TRIGGER */ - zSql += nId-1; - }else{ - /* Operators and special symbols */ - token = tkOTHER; - } - break; - } - } - state = trans[state][token]; - zSql++; - } - return state==1; -} - -#ifndef SQLITE_OMIT_UTF16 -/* -** This routine is the same as the sqlite3_complete() routine described -** above, except that the parameter is required to be UTF-16 encoded, not -** UTF-8. -*/ -SQLITE_API int sqlite3_complete16(const void *zSql){ - sqlite3_value *pVal; - char const *zSql8; - int rc = SQLITE_NOMEM; - -#ifndef SQLITE_OMIT_AUTOINIT - rc = sqlite3_initialize(); - if( rc ) return rc; -#endif - pVal = sqlite3ValueNew(0); - sqlite3ValueSetStr(pVal, -1, zSql, SQLITE_UTF16NATIVE, SQLITE_STATIC); - zSql8 = sqlite3ValueText(pVal, SQLITE_UTF8); - if( zSql8 ){ - rc = sqlite3_complete(zSql8); - }else{ - rc = SQLITE_NOMEM; - } - sqlite3ValueFree(pVal); - return sqlite3ApiExit(0, rc); -} -#endif /* SQLITE_OMIT_UTF16 */ -#endif /* SQLITE_OMIT_COMPLETE */ - -/************** End of complete.c ********************************************/ -/************** Begin file main.c ********************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Main file for the SQLite library. The routines in this file -** implement the programmer interface to the library. Routines in -** other files are for internal use by SQLite and should not be -** accessed by users of the library. -*/ - -#ifdef SQLITE_ENABLE_FTS3 -/************** Include fts3.h in the middle of main.c ***********************/ -/************** Begin file fts3.h ********************************************/ -/* -** 2006 Oct 10 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This header file is used by programs that want to link against the -** FTS3 library. All it does is declare the sqlite3Fts3Init() interface. -*/ - -#if 0 -extern "C" { -#endif /* __cplusplus */ - -SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db); - -#if 0 -} /* extern "C" */ -#endif /* __cplusplus */ - -/************** End of fts3.h ************************************************/ -/************** Continuing where we left off in main.c ***********************/ -#endif -#ifdef SQLITE_ENABLE_RTREE -/************** Include rtree.h in the middle of main.c **********************/ -/************** Begin file rtree.h *******************************************/ -/* -** 2008 May 26 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This header file is used by programs that want to link against the -** RTREE library. All it does is declare the sqlite3RtreeInit() interface. -*/ - -#if 0 -extern "C" { -#endif /* __cplusplus */ - -SQLITE_PRIVATE int sqlite3RtreeInit(sqlite3 *db); - -#if 0 -} /* extern "C" */ -#endif /* __cplusplus */ - -/************** End of rtree.h ***********************************************/ -/************** Continuing where we left off in main.c ***********************/ -#endif -#ifdef SQLITE_ENABLE_ICU -/************** Include sqliteicu.h in the middle of main.c ******************/ -/************** Begin file sqliteicu.h ***************************************/ -/* -** 2008 May 26 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This header file is used by programs that want to link against the -** ICU extension. All it does is declare the sqlite3IcuInit() interface. -*/ - -#if 0 -extern "C" { -#endif /* __cplusplus */ - -SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db); - -#if 0 -} /* extern "C" */ -#endif /* __cplusplus */ - - -/************** End of sqliteicu.h *******************************************/ -/************** Continuing where we left off in main.c ***********************/ -#endif - -#ifndef SQLITE_AMALGAMATION -/* IMPLEMENTATION-OF: R-46656-45156 The sqlite3_version[] string constant -** contains the text of SQLITE_VERSION macro. -*/ -SQLITE_API const char sqlite3_version[] = SQLITE_VERSION; -#endif - -/* IMPLEMENTATION-OF: R-53536-42575 The sqlite3_libversion() function returns -** a pointer to the to the sqlite3_version[] string constant. -*/ -SQLITE_API const char *sqlite3_libversion(void){ return sqlite3_version; } - -/* IMPLEMENTATION-OF: R-63124-39300 The sqlite3_sourceid() function returns a -** pointer to a string constant whose value is the same as the -** SQLITE_SOURCE_ID C preprocessor macro. -*/ -SQLITE_API const char *sqlite3_sourceid(void){ return SQLITE_SOURCE_ID; } - -/* IMPLEMENTATION-OF: R-35210-63508 The sqlite3_libversion_number() function -** returns an integer equal to SQLITE_VERSION_NUMBER. -*/ -SQLITE_API int sqlite3_libversion_number(void){ return SQLITE_VERSION_NUMBER; } - -/* IMPLEMENTATION-OF: R-20790-14025 The sqlite3_threadsafe() function returns -** zero if and only if SQLite was compiled with mutexing code omitted due to -** the SQLITE_THREADSAFE compile-time option being set to 0. -*/ -SQLITE_API int sqlite3_threadsafe(void){ return SQLITE_THREADSAFE; } - -#if !defined(SQLITE_OMIT_TRACE) && defined(SQLITE_ENABLE_IOTRACE) -/* -** If the following function pointer is not NULL and if -** SQLITE_ENABLE_IOTRACE is enabled, then messages describing -** I/O active are written using this function. These messages -** are intended for debugging activity only. -*/ -SQLITE_PRIVATE void (*sqlite3IoTrace)(const char*, ...) = 0; -#endif - -/* -** If the following global variable points to a string which is the -** name of a directory, then that directory will be used to store -** temporary files. -** -** See also the "PRAGMA temp_store_directory" SQL command. -*/ -SQLITE_API char *sqlite3_temp_directory = 0; - -/* -** If the following global variable points to a string which is the -** name of a directory, then that directory will be used to store -** all database files specified with a relative pathname. -** -** See also the "PRAGMA data_store_directory" SQL command. -*/ -SQLITE_API char *sqlite3_data_directory = 0; - -/* -** Initialize SQLite. -** -** This routine must be called to initialize the memory allocation, -** VFS, and mutex subsystems prior to doing any serious work with -** SQLite. But as long as you do not compile with SQLITE_OMIT_AUTOINIT -** this routine will be called automatically by key routines such as -** sqlite3_open(). -** -** This routine is a no-op except on its very first call for the process, -** or for the first call after a call to sqlite3_shutdown. -** -** The first thread to call this routine runs the initialization to -** completion. If subsequent threads call this routine before the first -** thread has finished the initialization process, then the subsequent -** threads must block until the first thread finishes with the initialization. -** -** The first thread might call this routine recursively. Recursive -** calls to this routine should not block, of course. Otherwise the -** initialization process would never complete. -** -** Let X be the first thread to enter this routine. Let Y be some other -** thread. Then while the initial invocation of this routine by X is -** incomplete, it is required that: -** -** * Calls to this routine from Y must block until the outer-most -** call by X completes. -** -** * Recursive calls to this routine from thread X return immediately -** without blocking. -*/ -SQLITE_API int sqlite3_initialize(void){ - MUTEX_LOGIC( sqlite3_mutex *pMaster; ) /* The main static mutex */ - int rc; /* Result code */ -#ifdef SQLITE_EXTRA_INIT - int bRunExtraInit = 0; /* Extra initialization needed */ -#endif - -#ifdef SQLITE_OMIT_WSD - rc = sqlite3_wsd_init(4096, 24); - if( rc!=SQLITE_OK ){ - return rc; - } -#endif - - /* If SQLite is already completely initialized, then this call - ** to sqlite3_initialize() should be a no-op. But the initialization - ** must be complete. So isInit must not be set until the very end - ** of this routine. - */ - if( sqlite3GlobalConfig.isInit ) return SQLITE_OK; - - /* Make sure the mutex subsystem is initialized. If unable to - ** initialize the mutex subsystem, return early with the error. - ** If the system is so sick that we are unable to allocate a mutex, - ** there is not much SQLite is going to be able to do. - ** - ** The mutex subsystem must take care of serializing its own - ** initialization. - */ - rc = sqlite3MutexInit(); - if( rc ) return rc; - - /* Initialize the malloc() system and the recursive pInitMutex mutex. - ** This operation is protected by the STATIC_MASTER mutex. Note that - ** MutexAlloc() is called for a static mutex prior to initializing the - ** malloc subsystem - this implies that the allocation of a static - ** mutex must not require support from the malloc subsystem. - */ - MUTEX_LOGIC( pMaster = sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER); ) - sqlite3_mutex_enter(pMaster); - sqlite3GlobalConfig.isMutexInit = 1; - if( !sqlite3GlobalConfig.isMallocInit ){ - rc = sqlite3MallocInit(); - } - if( rc==SQLITE_OK ){ - sqlite3GlobalConfig.isMallocInit = 1; - if( !sqlite3GlobalConfig.pInitMutex ){ - sqlite3GlobalConfig.pInitMutex = - sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); - if( sqlite3GlobalConfig.bCoreMutex && !sqlite3GlobalConfig.pInitMutex ){ - rc = SQLITE_NOMEM; - } - } - } - if( rc==SQLITE_OK ){ - sqlite3GlobalConfig.nRefInitMutex++; - } - sqlite3_mutex_leave(pMaster); - - /* If rc is not SQLITE_OK at this point, then either the malloc - ** subsystem could not be initialized or the system failed to allocate - ** the pInitMutex mutex. Return an error in either case. */ - if( rc!=SQLITE_OK ){ - return rc; - } - - /* Do the rest of the initialization under the recursive mutex so - ** that we will be able to handle recursive calls into - ** sqlite3_initialize(). The recursive calls normally come through - ** sqlite3_os_init() when it invokes sqlite3_vfs_register(), but other - ** recursive calls might also be possible. - ** - ** IMPLEMENTATION-OF: R-00140-37445 SQLite automatically serializes calls - ** to the xInit method, so the xInit method need not be threadsafe. - ** - ** The following mutex is what serializes access to the appdef pcache xInit - ** methods. The sqlite3_pcache_methods.xInit() all is embedded in the - ** call to sqlite3PcacheInitialize(). - */ - sqlite3_mutex_enter(sqlite3GlobalConfig.pInitMutex); - if( sqlite3GlobalConfig.isInit==0 && sqlite3GlobalConfig.inProgress==0 ){ - FuncDefHash *pHash = &GLOBAL(FuncDefHash, sqlite3GlobalFunctions); - sqlite3GlobalConfig.inProgress = 1; - memset(pHash, 0, sizeof(sqlite3GlobalFunctions)); - sqlite3RegisterGlobalFunctions(); - if( sqlite3GlobalConfig.isPCacheInit==0 ){ - rc = sqlite3PcacheInitialize(); - } - if( rc==SQLITE_OK ){ - sqlite3GlobalConfig.isPCacheInit = 1; - rc = sqlite3OsInit(); - } - if( rc==SQLITE_OK ){ - sqlite3PCacheBufferSetup( sqlite3GlobalConfig.pPage, - sqlite3GlobalConfig.szPage, sqlite3GlobalConfig.nPage); - sqlite3GlobalConfig.isInit = 1; -#ifdef SQLITE_EXTRA_INIT - bRunExtraInit = 1; -#endif - } - sqlite3GlobalConfig.inProgress = 0; - } - sqlite3_mutex_leave(sqlite3GlobalConfig.pInitMutex); - - /* Go back under the static mutex and clean up the recursive - ** mutex to prevent a resource leak. - */ - sqlite3_mutex_enter(pMaster); - sqlite3GlobalConfig.nRefInitMutex--; - if( sqlite3GlobalConfig.nRefInitMutex<=0 ){ - assert( sqlite3GlobalConfig.nRefInitMutex==0 ); - sqlite3_mutex_free(sqlite3GlobalConfig.pInitMutex); - sqlite3GlobalConfig.pInitMutex = 0; - } - sqlite3_mutex_leave(pMaster); - - /* The following is just a sanity check to make sure SQLite has - ** been compiled correctly. It is important to run this code, but - ** we don't want to run it too often and soak up CPU cycles for no - ** reason. So we run it once during initialization. - */ -#ifndef NDEBUG -#ifndef SQLITE_OMIT_FLOATING_POINT - /* This section of code's only "output" is via assert() statements. */ - if ( rc==SQLITE_OK ){ - u64 x = (((u64)1)<<63)-1; - double y; - assert(sizeof(x)==8); - assert(sizeof(x)==sizeof(y)); - memcpy(&y, &x, 8); - assert( sqlite3IsNaN(y) ); - } -#endif -#endif - - /* Do extra initialization steps requested by the SQLITE_EXTRA_INIT - ** compile-time option. - */ -#ifdef SQLITE_EXTRA_INIT - if( bRunExtraInit ){ - int SQLITE_EXTRA_INIT(const char*); - rc = SQLITE_EXTRA_INIT(0); - } -#endif - - return rc; -} - -/* -** Undo the effects of sqlite3_initialize(). Must not be called while -** there are outstanding database connections or memory allocations or -** while any part of SQLite is otherwise in use in any thread. This -** routine is not threadsafe. But it is safe to invoke this routine -** on when SQLite is already shut down. If SQLite is already shut down -** when this routine is invoked, then this routine is a harmless no-op. -*/ -SQLITE_API int sqlite3_shutdown(void){ - if( sqlite3GlobalConfig.isInit ){ -#ifdef SQLITE_EXTRA_SHUTDOWN - void SQLITE_EXTRA_SHUTDOWN(void); - SQLITE_EXTRA_SHUTDOWN(); -#endif - sqlite3_os_end(); - sqlite3_reset_auto_extension(); - sqlite3GlobalConfig.isInit = 0; - } - if( sqlite3GlobalConfig.isPCacheInit ){ - sqlite3PcacheShutdown(); - sqlite3GlobalConfig.isPCacheInit = 0; - } - if( sqlite3GlobalConfig.isMallocInit ){ - sqlite3MallocEnd(); - sqlite3GlobalConfig.isMallocInit = 0; - -#ifndef SQLITE_OMIT_SHUTDOWN_DIRECTORIES - /* The heap subsystem has now been shutdown and these values are supposed - ** to be NULL or point to memory that was obtained from sqlite3_malloc(), - ** which would rely on that heap subsystem; therefore, make sure these - ** values cannot refer to heap memory that was just invalidated when the - ** heap subsystem was shutdown. This is only done if the current call to - ** this function resulted in the heap subsystem actually being shutdown. - */ - sqlite3_data_directory = 0; - sqlite3_temp_directory = 0; -#endif - } - if( sqlite3GlobalConfig.isMutexInit ){ - sqlite3MutexEnd(); - sqlite3GlobalConfig.isMutexInit = 0; - } - - return SQLITE_OK; -} - -/* -** This API allows applications to modify the global configuration of -** the SQLite library at run-time. -** -** This routine should only be called when there are no outstanding -** database connections or memory allocations. This routine is not -** threadsafe. Failure to heed these warnings can lead to unpredictable -** behavior. -*/ -SQLITE_API int sqlite3_config(int op, ...){ - va_list ap; - int rc = SQLITE_OK; - - /* sqlite3_config() shall return SQLITE_MISUSE if it is invoked while - ** the SQLite library is in use. */ - if( sqlite3GlobalConfig.isInit ) return SQLITE_MISUSE_BKPT; - - va_start(ap, op); - switch( op ){ - - /* Mutex configuration options are only available in a threadsafe - ** compile. - */ -#if defined(SQLITE_THREADSAFE) && SQLITE_THREADSAFE>0 - case SQLITE_CONFIG_SINGLETHREAD: { - /* Disable all mutexing */ - sqlite3GlobalConfig.bCoreMutex = 0; - sqlite3GlobalConfig.bFullMutex = 0; - break; - } - case SQLITE_CONFIG_MULTITHREAD: { - /* Disable mutexing of database connections */ - /* Enable mutexing of core data structures */ - sqlite3GlobalConfig.bCoreMutex = 1; - sqlite3GlobalConfig.bFullMutex = 0; - break; - } - case SQLITE_CONFIG_SERIALIZED: { - /* Enable all mutexing */ - sqlite3GlobalConfig.bCoreMutex = 1; - sqlite3GlobalConfig.bFullMutex = 1; - break; - } - case SQLITE_CONFIG_MUTEX: { - /* Specify an alternative mutex implementation */ - sqlite3GlobalConfig.mutex = *va_arg(ap, sqlite3_mutex_methods*); - break; - } - case SQLITE_CONFIG_GETMUTEX: { - /* Retrieve the current mutex implementation */ - *va_arg(ap, sqlite3_mutex_methods*) = sqlite3GlobalConfig.mutex; - break; - } -#endif - - - case SQLITE_CONFIG_MALLOC: { - /* Specify an alternative malloc implementation */ - sqlite3GlobalConfig.m = *va_arg(ap, sqlite3_mem_methods*); - break; - } - case SQLITE_CONFIG_GETMALLOC: { - /* Retrieve the current malloc() implementation */ - if( sqlite3GlobalConfig.m.xMalloc==0 ) sqlite3MemSetDefault(); - *va_arg(ap, sqlite3_mem_methods*) = sqlite3GlobalConfig.m; - break; - } - case SQLITE_CONFIG_MEMSTATUS: { - /* Enable or disable the malloc status collection */ - sqlite3GlobalConfig.bMemstat = va_arg(ap, int); - break; - } - case SQLITE_CONFIG_SCRATCH: { - /* Designate a buffer for scratch memory space */ - sqlite3GlobalConfig.pScratch = va_arg(ap, void*); - sqlite3GlobalConfig.szScratch = va_arg(ap, int); - sqlite3GlobalConfig.nScratch = va_arg(ap, int); - break; - } - case SQLITE_CONFIG_PAGECACHE: { - /* Designate a buffer for page cache memory space */ - sqlite3GlobalConfig.pPage = va_arg(ap, void*); - sqlite3GlobalConfig.szPage = va_arg(ap, int); - sqlite3GlobalConfig.nPage = va_arg(ap, int); - break; - } - - case SQLITE_CONFIG_PCACHE: { - /* no-op */ - break; - } - case SQLITE_CONFIG_GETPCACHE: { - /* now an error */ - rc = SQLITE_ERROR; - break; - } - - case SQLITE_CONFIG_PCACHE2: { - /* Specify an alternative page cache implementation */ - sqlite3GlobalConfig.pcache2 = *va_arg(ap, sqlite3_pcache_methods2*); - break; - } - case SQLITE_CONFIG_GETPCACHE2: { - if( sqlite3GlobalConfig.pcache2.xInit==0 ){ - sqlite3PCacheSetDefault(); - } - *va_arg(ap, sqlite3_pcache_methods2*) = sqlite3GlobalConfig.pcache2; - break; - } - -#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5) - case SQLITE_CONFIG_HEAP: { - /* Designate a buffer for heap memory space */ - sqlite3GlobalConfig.pHeap = va_arg(ap, void*); - sqlite3GlobalConfig.nHeap = va_arg(ap, int); - sqlite3GlobalConfig.mnReq = va_arg(ap, int); - - if( sqlite3GlobalConfig.mnReq<1 ){ - sqlite3GlobalConfig.mnReq = 1; - }else if( sqlite3GlobalConfig.mnReq>(1<<12) ){ - /* cap min request size at 2^12 */ - sqlite3GlobalConfig.mnReq = (1<<12); - } - - if( sqlite3GlobalConfig.pHeap==0 ){ - /* If the heap pointer is NULL, then restore the malloc implementation - ** back to NULL pointers too. This will cause the malloc to go - ** back to its default implementation when sqlite3_initialize() is - ** run. - */ - memset(&sqlite3GlobalConfig.m, 0, sizeof(sqlite3GlobalConfig.m)); - }else{ - /* The heap pointer is not NULL, then install one of the - ** mem5.c/mem3.c methods. The enclosing #if guarantees at - ** least one of these methods is currently enabled. - */ -#ifdef SQLITE_ENABLE_MEMSYS3 - sqlite3GlobalConfig.m = *sqlite3MemGetMemsys3(); -#endif -#ifdef SQLITE_ENABLE_MEMSYS5 - sqlite3GlobalConfig.m = *sqlite3MemGetMemsys5(); -#endif - } - break; - } -#endif - - case SQLITE_CONFIG_LOOKASIDE: { - sqlite3GlobalConfig.szLookaside = va_arg(ap, int); - sqlite3GlobalConfig.nLookaside = va_arg(ap, int); - break; - } - - /* Record a pointer to the logger function and its first argument. - ** The default is NULL. Logging is disabled if the function pointer is - ** NULL. - */ - case SQLITE_CONFIG_LOG: { - /* MSVC is picky about pulling func ptrs from va lists. - ** http://support.microsoft.com/kb/47961 - ** sqlite3GlobalConfig.xLog = va_arg(ap, void(*)(void*,int,const char*)); - */ - typedef void(*LOGFUNC_t)(void*,int,const char*); - sqlite3GlobalConfig.xLog = va_arg(ap, LOGFUNC_t); - sqlite3GlobalConfig.pLogArg = va_arg(ap, void*); - break; - } - - case SQLITE_CONFIG_URI: { - sqlite3GlobalConfig.bOpenUri = va_arg(ap, int); - break; - } - - case SQLITE_CONFIG_COVERING_INDEX_SCAN: { - sqlite3GlobalConfig.bUseCis = va_arg(ap, int); - break; - } - -#ifdef SQLITE_ENABLE_SQLLOG - case SQLITE_CONFIG_SQLLOG: { - typedef void(*SQLLOGFUNC_t)(void*, sqlite3*, const char*, int); - sqlite3GlobalConfig.xSqllog = va_arg(ap, SQLLOGFUNC_t); - sqlite3GlobalConfig.pSqllogArg = va_arg(ap, void *); - break; - } -#endif - - case SQLITE_CONFIG_MMAP_SIZE: { - sqlite3_int64 szMmap = va_arg(ap, sqlite3_int64); - sqlite3_int64 mxMmap = va_arg(ap, sqlite3_int64); - if( mxMmap<0 || mxMmap>SQLITE_MAX_MMAP_SIZE ){ - mxMmap = SQLITE_MAX_MMAP_SIZE; - } - sqlite3GlobalConfig.mxMmap = mxMmap; - if( szMmap<0 ) szMmap = SQLITE_DEFAULT_MMAP_SIZE; - if( szMmap>mxMmap) szMmap = mxMmap; - sqlite3GlobalConfig.szMmap = szMmap; - break; - } - -#if SQLITE_OS_WIN && defined(SQLITE_WIN32_MALLOC) - case SQLITE_CONFIG_WIN32_HEAPSIZE: { - sqlite3GlobalConfig.nHeap = va_arg(ap, int); - break; - } -#endif - - default: { - rc = SQLITE_ERROR; - break; - } - } - va_end(ap); - return rc; -} - -/* -** Set up the lookaside buffers for a database connection. -** Return SQLITE_OK on success. -** If lookaside is already active, return SQLITE_BUSY. -** -** The sz parameter is the number of bytes in each lookaside slot. -** The cnt parameter is the number of slots. If pStart is NULL the -** space for the lookaside memory is obtained from sqlite3_malloc(). -** If pStart is not NULL then it is sz*cnt bytes of memory to use for -** the lookaside memory. -*/ -static int setupLookaside(sqlite3 *db, void *pBuf, int sz, int cnt){ - void *pStart; - if( db->lookaside.nOut ){ - return SQLITE_BUSY; - } - /* Free any existing lookaside buffer for this handle before - ** allocating a new one so we don't have to have space for - ** both at the same time. - */ - if( db->lookaside.bMalloced ){ - sqlite3_free(db->lookaside.pStart); - } - /* The size of a lookaside slot after ROUNDDOWN8 needs to be larger - ** than a pointer to be useful. - */ - sz = ROUNDDOWN8(sz); /* IMP: R-33038-09382 */ - if( sz<=(int)sizeof(LookasideSlot*) ) sz = 0; - if( cnt<0 ) cnt = 0; - if( sz==0 || cnt==0 ){ - sz = 0; - pStart = 0; - }else if( pBuf==0 ){ - sqlite3BeginBenignMalloc(); - pStart = sqlite3Malloc( sz*cnt ); /* IMP: R-61949-35727 */ - sqlite3EndBenignMalloc(); - if( pStart ) cnt = sqlite3MallocSize(pStart)/sz; - }else{ - pStart = pBuf; - } - db->lookaside.pStart = pStart; - db->lookaside.pFree = 0; - db->lookaside.sz = (u16)sz; - if( pStart ){ - int i; - LookasideSlot *p; - assert( sz > (int)sizeof(LookasideSlot*) ); - p = (LookasideSlot*)pStart; - for(i=cnt-1; i>=0; i--){ - p->pNext = db->lookaside.pFree; - db->lookaside.pFree = p; - p = (LookasideSlot*)&((u8*)p)[sz]; - } - db->lookaside.pEnd = p; - db->lookaside.bEnabled = 1; - db->lookaside.bMalloced = pBuf==0 ?1:0; - }else{ - db->lookaside.pStart = db; - db->lookaside.pEnd = db; - db->lookaside.bEnabled = 0; - db->lookaside.bMalloced = 0; - } - return SQLITE_OK; -} - -/* -** Return the mutex associated with a database connection. -*/ -SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3 *db){ - return db->mutex; -} - -/* -** Free up as much memory as we can from the given database -** connection. -*/ -SQLITE_API int sqlite3_db_release_memory(sqlite3 *db){ - int i; - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeEnterAll(db); - for(i=0; inDb; i++){ - Btree *pBt = db->aDb[i].pBt; - if( pBt ){ - Pager *pPager = sqlite3BtreePager(pBt); - sqlite3PagerShrink(pPager); - } - } - sqlite3BtreeLeaveAll(db); - sqlite3_mutex_leave(db->mutex); - return SQLITE_OK; -} - -/* -** Configuration settings for an individual database connection -*/ -SQLITE_API int sqlite3_db_config(sqlite3 *db, int op, ...){ - va_list ap; - int rc; - va_start(ap, op); - switch( op ){ - case SQLITE_DBCONFIG_LOOKASIDE: { - void *pBuf = va_arg(ap, void*); /* IMP: R-26835-10964 */ - int sz = va_arg(ap, int); /* IMP: R-47871-25994 */ - int cnt = va_arg(ap, int); /* IMP: R-04460-53386 */ - rc = setupLookaside(db, pBuf, sz, cnt); - break; - } - default: { - static const struct { - int op; /* The opcode */ - u32 mask; /* Mask of the bit in sqlite3.flags to set/clear */ - } aFlagOp[] = { - { SQLITE_DBCONFIG_ENABLE_FKEY, SQLITE_ForeignKeys }, - { SQLITE_DBCONFIG_ENABLE_TRIGGER, SQLITE_EnableTrigger }, - }; - unsigned int i; - rc = SQLITE_ERROR; /* IMP: R-42790-23372 */ - for(i=0; iflags; - if( onoff>0 ){ - db->flags |= aFlagOp[i].mask; - }else if( onoff==0 ){ - db->flags &= ~aFlagOp[i].mask; - } - if( oldFlags!=db->flags ){ - sqlite3ExpirePreparedStatements(db); - } - if( pRes ){ - *pRes = (db->flags & aFlagOp[i].mask)!=0; - } - rc = SQLITE_OK; - break; - } - } - break; - } - } - va_end(ap); - return rc; -} - - -/* -** Return true if the buffer z[0..n-1] contains all spaces. -*/ -static int allSpaces(const char *z, int n){ - while( n>0 && z[n-1]==' ' ){ n--; } - return n==0; -} - -/* -** This is the default collating function named "BINARY" which is always -** available. -** -** If the padFlag argument is not NULL then space padding at the end -** of strings is ignored. This implements the RTRIM collation. -*/ -static int binCollFunc( - void *padFlag, - int nKey1, const void *pKey1, - int nKey2, const void *pKey2 -){ - int rc, n; - n = nKey1lastRowid; -} - -/* -** Return the number of changes in the most recent call to sqlite3_exec(). -*/ -SQLITE_API int sqlite3_changes(sqlite3 *db){ - return db->nChange; -} - -/* -** Return the number of changes since the database handle was opened. -*/ -SQLITE_API int sqlite3_total_changes(sqlite3 *db){ - return db->nTotalChange; -} - -/* -** Close all open savepoints. This function only manipulates fields of the -** database handle object, it does not close any savepoints that may be open -** at the b-tree/pager level. -*/ -SQLITE_PRIVATE void sqlite3CloseSavepoints(sqlite3 *db){ - while( db->pSavepoint ){ - Savepoint *pTmp = db->pSavepoint; - db->pSavepoint = pTmp->pNext; - sqlite3DbFree(db, pTmp); - } - db->nSavepoint = 0; - db->nStatement = 0; - db->isTransactionSavepoint = 0; -} - -/* -** Invoke the destructor function associated with FuncDef p, if any. Except, -** if this is not the last copy of the function, do not invoke it. Multiple -** copies of a single function are created when create_function() is called -** with SQLITE_ANY as the encoding. -*/ -static void functionDestroy(sqlite3 *db, FuncDef *p){ - FuncDestructor *pDestructor = p->pDestructor; - if( pDestructor ){ - pDestructor->nRef--; - if( pDestructor->nRef==0 ){ - pDestructor->xDestroy(pDestructor->pUserData); - sqlite3DbFree(db, pDestructor); - } - } -} - -/* -** Disconnect all sqlite3_vtab objects that belong to database connection -** db. This is called when db is being closed. -*/ -static void disconnectAllVtab(sqlite3 *db){ -#ifndef SQLITE_OMIT_VIRTUALTABLE - int i; - sqlite3BtreeEnterAll(db); - for(i=0; inDb; i++){ - Schema *pSchema = db->aDb[i].pSchema; - if( db->aDb[i].pSchema ){ - HashElem *p; - for(p=sqliteHashFirst(&pSchema->tblHash); p; p=sqliteHashNext(p)){ - Table *pTab = (Table *)sqliteHashData(p); - if( IsVirtual(pTab) ) sqlite3VtabDisconnect(db, pTab); - } - } - } - sqlite3BtreeLeaveAll(db); -#else - UNUSED_PARAMETER(db); -#endif -} - -/* -** Return TRUE if database connection db has unfinalized prepared -** statements or unfinished sqlite3_backup objects. -*/ -static int connectionIsBusy(sqlite3 *db){ - int j; - assert( sqlite3_mutex_held(db->mutex) ); - if( db->pVdbe ) return 1; - for(j=0; jnDb; j++){ - Btree *pBt = db->aDb[j].pBt; - if( pBt && sqlite3BtreeIsInBackup(pBt) ) return 1; - } - return 0; -} - -/* -** Close an existing SQLite database -*/ -static int sqlite3Close(sqlite3 *db, int forceZombie){ - if( !db ){ - return SQLITE_OK; - } - if( !sqlite3SafetyCheckSickOrOk(db) ){ - return SQLITE_MISUSE_BKPT; - } - sqlite3_mutex_enter(db->mutex); - - /* Force xDisconnect calls on all virtual tables */ - disconnectAllVtab(db); - - /* If a transaction is open, the disconnectAllVtab() call above - ** will not have called the xDisconnect() method on any virtual - ** tables in the db->aVTrans[] array. The following sqlite3VtabRollback() - ** call will do so. We need to do this before the check for active - ** SQL statements below, as the v-table implementation may be storing - ** some prepared statements internally. - */ - sqlite3VtabRollback(db); - - /* Legacy behavior (sqlite3_close() behavior) is to return - ** SQLITE_BUSY if the connection can not be closed immediately. - */ - if( !forceZombie && connectionIsBusy(db) ){ - sqlite3Error(db, SQLITE_BUSY, "unable to close due to unfinalized " - "statements or unfinished backups"); - sqlite3_mutex_leave(db->mutex); - return SQLITE_BUSY; - } - -#ifdef SQLITE_ENABLE_SQLLOG - if( sqlite3GlobalConfig.xSqllog ){ - /* Closing the handle. Fourth parameter is passed the value 2. */ - sqlite3GlobalConfig.xSqllog(sqlite3GlobalConfig.pSqllogArg, db, 0, 2); - } -#endif - - /* Convert the connection into a zombie and then close it. - */ - db->magic = SQLITE_MAGIC_ZOMBIE; - sqlite3LeaveMutexAndCloseZombie(db); - return SQLITE_OK; -} - -/* -** Two variations on the public interface for closing a database -** connection. The sqlite3_close() version returns SQLITE_BUSY and -** leaves the connection option if there are unfinalized prepared -** statements or unfinished sqlite3_backups. The sqlite3_close_v2() -** version forces the connection to become a zombie if there are -** unclosed resources, and arranges for deallocation when the last -** prepare statement or sqlite3_backup closes. -*/ -SQLITE_API int sqlite3_close(sqlite3 *db){ return sqlite3Close(db,0); } -SQLITE_API int sqlite3_close_v2(sqlite3 *db){ return sqlite3Close(db,1); } - - -/* -** Close the mutex on database connection db. -** -** Furthermore, if database connection db is a zombie (meaning that there -** has been a prior call to sqlite3_close(db) or sqlite3_close_v2(db)) and -** every sqlite3_stmt has now been finalized and every sqlite3_backup has -** finished, then free all resources. -*/ -SQLITE_PRIVATE void sqlite3LeaveMutexAndCloseZombie(sqlite3 *db){ - HashElem *i; /* Hash table iterator */ - int j; - - /* If there are outstanding sqlite3_stmt or sqlite3_backup objects - ** or if the connection has not yet been closed by sqlite3_close_v2(), - ** then just leave the mutex and return. - */ - if( db->magic!=SQLITE_MAGIC_ZOMBIE || connectionIsBusy(db) ){ - sqlite3_mutex_leave(db->mutex); - return; - } - - /* If we reach this point, it means that the database connection has - ** closed all sqlite3_stmt and sqlite3_backup objects and has been - ** passed to sqlite3_close (meaning that it is a zombie). Therefore, - ** go ahead and free all resources. - */ - - /* If a transaction is open, roll it back. This also ensures that if - ** any database schemas have been modified by an uncommitted transaction - ** they are reset. And that the required b-tree mutex is held to make - ** the pager rollback and schema reset an atomic operation. */ - sqlite3RollbackAll(db, SQLITE_OK); - - /* Free any outstanding Savepoint structures. */ - sqlite3CloseSavepoints(db); - - /* Close all database connections */ - for(j=0; jnDb; j++){ - struct Db *pDb = &db->aDb[j]; - if( pDb->pBt ){ - sqlite3BtreeClose(pDb->pBt); - pDb->pBt = 0; - if( j!=1 ){ - pDb->pSchema = 0; - } - } - } - /* Clear the TEMP schema separately and last */ - if( db->aDb[1].pSchema ){ - sqlite3SchemaClear(db->aDb[1].pSchema); - } - sqlite3VtabUnlockList(db); - - /* Free up the array of auxiliary databases */ - sqlite3CollapseDatabaseArray(db); - assert( db->nDb<=2 ); - assert( db->aDb==db->aDbStatic ); - - /* Tell the code in notify.c that the connection no longer holds any - ** locks and does not require any further unlock-notify callbacks. - */ - sqlite3ConnectionClosed(db); - - for(j=0; jaFunc.a); j++){ - FuncDef *pNext, *pHash, *p; - for(p=db->aFunc.a[j]; p; p=pHash){ - pHash = p->pHash; - while( p ){ - functionDestroy(db, p); - pNext = p->pNext; - sqlite3DbFree(db, p); - p = pNext; - } - } - } - for(i=sqliteHashFirst(&db->aCollSeq); i; i=sqliteHashNext(i)){ - CollSeq *pColl = (CollSeq *)sqliteHashData(i); - /* Invoke any destructors registered for collation sequence user data. */ - for(j=0; j<3; j++){ - if( pColl[j].xDel ){ - pColl[j].xDel(pColl[j].pUser); - } - } - sqlite3DbFree(db, pColl); - } - sqlite3HashClear(&db->aCollSeq); -#ifndef SQLITE_OMIT_VIRTUALTABLE - for(i=sqliteHashFirst(&db->aModule); i; i=sqliteHashNext(i)){ - Module *pMod = (Module *)sqliteHashData(i); - if( pMod->xDestroy ){ - pMod->xDestroy(pMod->pAux); - } - sqlite3DbFree(db, pMod); - } - sqlite3HashClear(&db->aModule); -#endif - - sqlite3Error(db, SQLITE_OK, 0); /* Deallocates any cached error strings. */ - sqlite3ValueFree(db->pErr); - sqlite3CloseExtensions(db); - - db->magic = SQLITE_MAGIC_ERROR; - - /* The temp-database schema is allocated differently from the other schema - ** objects (using sqliteMalloc() directly, instead of sqlite3BtreeSchema()). - ** So it needs to be freed here. Todo: Why not roll the temp schema into - ** the same sqliteMalloc() as the one that allocates the database - ** structure? - */ - sqlite3DbFree(db, db->aDb[1].pSchema); - sqlite3_mutex_leave(db->mutex); - db->magic = SQLITE_MAGIC_CLOSED; - sqlite3_mutex_free(db->mutex); - assert( db->lookaside.nOut==0 ); /* Fails on a lookaside memory leak */ - if( db->lookaside.bMalloced ){ - sqlite3_free(db->lookaside.pStart); - } - sqlite3_free(db); -} - -/* -** Rollback all database files. If tripCode is not SQLITE_OK, then -** any open cursors are invalidated ("tripped" - as in "tripping a circuit -** breaker") and made to return tripCode if there are any further -** attempts to use that cursor. -*/ -SQLITE_PRIVATE void sqlite3RollbackAll(sqlite3 *db, int tripCode){ - int i; - int inTrans = 0; - assert( sqlite3_mutex_held(db->mutex) ); - sqlite3BeginBenignMalloc(); - - /* Obtain all b-tree mutexes before making any calls to BtreeRollback(). - ** This is important in case the transaction being rolled back has - ** modified the database schema. If the b-tree mutexes are not taken - ** here, then another shared-cache connection might sneak in between - ** the database rollback and schema reset, which can cause false - ** corruption reports in some cases. */ - sqlite3BtreeEnterAll(db); - - for(i=0; inDb; i++){ - Btree *p = db->aDb[i].pBt; - if( p ){ - if( sqlite3BtreeIsInTrans(p) ){ - inTrans = 1; - } - sqlite3BtreeRollback(p, tripCode); - } - } - sqlite3VtabRollback(db); - sqlite3EndBenignMalloc(); - - if( (db->flags&SQLITE_InternChanges)!=0 && db->init.busy==0 ){ - sqlite3ExpirePreparedStatements(db); - sqlite3ResetAllSchemasOfConnection(db); - } - sqlite3BtreeLeaveAll(db); - - /* Any deferred constraint violations have now been resolved. */ - db->nDeferredCons = 0; - db->nDeferredImmCons = 0; - db->flags &= ~SQLITE_DeferFKs; - - /* If one has been configured, invoke the rollback-hook callback */ - if( db->xRollbackCallback && (inTrans || !db->autoCommit) ){ - db->xRollbackCallback(db->pRollbackArg); - } -} - -/* -** Return a static string containing the name corresponding to the error code -** specified in the argument. -*/ -#if defined(SQLITE_TEST) -SQLITE_PRIVATE const char *sqlite3ErrName(int rc){ - const char *zName = 0; - int i, origRc = rc; - for(i=0; i<2 && zName==0; i++, rc &= 0xff){ - switch( rc ){ - case SQLITE_OK: zName = "SQLITE_OK"; break; - case SQLITE_ERROR: zName = "SQLITE_ERROR"; break; - case SQLITE_INTERNAL: zName = "SQLITE_INTERNAL"; break; - case SQLITE_PERM: zName = "SQLITE_PERM"; break; - case SQLITE_ABORT: zName = "SQLITE_ABORT"; break; - case SQLITE_ABORT_ROLLBACK: zName = "SQLITE_ABORT_ROLLBACK"; break; - case SQLITE_BUSY: zName = "SQLITE_BUSY"; break; - case SQLITE_BUSY_RECOVERY: zName = "SQLITE_BUSY_RECOVERY"; break; - case SQLITE_BUSY_SNAPSHOT: zName = "SQLITE_BUSY_SNAPSHOT"; break; - case SQLITE_LOCKED: zName = "SQLITE_LOCKED"; break; - case SQLITE_LOCKED_SHAREDCACHE: zName = "SQLITE_LOCKED_SHAREDCACHE";break; - case SQLITE_NOMEM: zName = "SQLITE_NOMEM"; break; - case SQLITE_READONLY: zName = "SQLITE_READONLY"; break; - case SQLITE_READONLY_RECOVERY: zName = "SQLITE_READONLY_RECOVERY"; break; - case SQLITE_READONLY_CANTLOCK: zName = "SQLITE_READONLY_CANTLOCK"; break; - case SQLITE_READONLY_ROLLBACK: zName = "SQLITE_READONLY_ROLLBACK"; break; - case SQLITE_READONLY_DBMOVED: zName = "SQLITE_READONLY_DBMOVED"; break; - case SQLITE_INTERRUPT: zName = "SQLITE_INTERRUPT"; break; - case SQLITE_IOERR: zName = "SQLITE_IOERR"; break; - case SQLITE_IOERR_READ: zName = "SQLITE_IOERR_READ"; break; - case SQLITE_IOERR_SHORT_READ: zName = "SQLITE_IOERR_SHORT_READ"; break; - case SQLITE_IOERR_WRITE: zName = "SQLITE_IOERR_WRITE"; break; - case SQLITE_IOERR_FSYNC: zName = "SQLITE_IOERR_FSYNC"; break; - case SQLITE_IOERR_DIR_FSYNC: zName = "SQLITE_IOERR_DIR_FSYNC"; break; - case SQLITE_IOERR_TRUNCATE: zName = "SQLITE_IOERR_TRUNCATE"; break; - case SQLITE_IOERR_FSTAT: zName = "SQLITE_IOERR_FSTAT"; break; - case SQLITE_IOERR_UNLOCK: zName = "SQLITE_IOERR_UNLOCK"; break; - case SQLITE_IOERR_RDLOCK: zName = "SQLITE_IOERR_RDLOCK"; break; - case SQLITE_IOERR_DELETE: zName = "SQLITE_IOERR_DELETE"; break; - case SQLITE_IOERR_BLOCKED: zName = "SQLITE_IOERR_BLOCKED"; break; - case SQLITE_IOERR_NOMEM: zName = "SQLITE_IOERR_NOMEM"; break; - case SQLITE_IOERR_ACCESS: zName = "SQLITE_IOERR_ACCESS"; break; - case SQLITE_IOERR_CHECKRESERVEDLOCK: - zName = "SQLITE_IOERR_CHECKRESERVEDLOCK"; break; - case SQLITE_IOERR_LOCK: zName = "SQLITE_IOERR_LOCK"; break; - case SQLITE_IOERR_CLOSE: zName = "SQLITE_IOERR_CLOSE"; break; - case SQLITE_IOERR_DIR_CLOSE: zName = "SQLITE_IOERR_DIR_CLOSE"; break; - case SQLITE_IOERR_SHMOPEN: zName = "SQLITE_IOERR_SHMOPEN"; break; - case SQLITE_IOERR_SHMSIZE: zName = "SQLITE_IOERR_SHMSIZE"; break; - case SQLITE_IOERR_SHMLOCK: zName = "SQLITE_IOERR_SHMLOCK"; break; - case SQLITE_IOERR_SHMMAP: zName = "SQLITE_IOERR_SHMMAP"; break; - case SQLITE_IOERR_SEEK: zName = "SQLITE_IOERR_SEEK"; break; - case SQLITE_IOERR_DELETE_NOENT: zName = "SQLITE_IOERR_DELETE_NOENT";break; - case SQLITE_IOERR_MMAP: zName = "SQLITE_IOERR_MMAP"; break; - case SQLITE_IOERR_GETTEMPPATH: zName = "SQLITE_IOERR_GETTEMPPATH"; break; - case SQLITE_IOERR_CONVPATH: zName = "SQLITE_IOERR_CONVPATH"; break; - case SQLITE_CORRUPT: zName = "SQLITE_CORRUPT"; break; - case SQLITE_CORRUPT_VTAB: zName = "SQLITE_CORRUPT_VTAB"; break; - case SQLITE_NOTFOUND: zName = "SQLITE_NOTFOUND"; break; - case SQLITE_FULL: zName = "SQLITE_FULL"; break; - case SQLITE_CANTOPEN: zName = "SQLITE_CANTOPEN"; break; - case SQLITE_CANTOPEN_NOTEMPDIR: zName = "SQLITE_CANTOPEN_NOTEMPDIR";break; - case SQLITE_CANTOPEN_ISDIR: zName = "SQLITE_CANTOPEN_ISDIR"; break; - case SQLITE_CANTOPEN_FULLPATH: zName = "SQLITE_CANTOPEN_FULLPATH"; break; - case SQLITE_CANTOPEN_CONVPATH: zName = "SQLITE_CANTOPEN_CONVPATH"; break; - case SQLITE_PROTOCOL: zName = "SQLITE_PROTOCOL"; break; - case SQLITE_EMPTY: zName = "SQLITE_EMPTY"; break; - case SQLITE_SCHEMA: zName = "SQLITE_SCHEMA"; break; - case SQLITE_TOOBIG: zName = "SQLITE_TOOBIG"; break; - case SQLITE_CONSTRAINT: zName = "SQLITE_CONSTRAINT"; break; - case SQLITE_CONSTRAINT_UNIQUE: zName = "SQLITE_CONSTRAINT_UNIQUE"; break; - case SQLITE_CONSTRAINT_TRIGGER: zName = "SQLITE_CONSTRAINT_TRIGGER";break; - case SQLITE_CONSTRAINT_FOREIGNKEY: - zName = "SQLITE_CONSTRAINT_FOREIGNKEY"; break; - case SQLITE_CONSTRAINT_CHECK: zName = "SQLITE_CONSTRAINT_CHECK"; break; - case SQLITE_CONSTRAINT_PRIMARYKEY: - zName = "SQLITE_CONSTRAINT_PRIMARYKEY"; break; - case SQLITE_CONSTRAINT_NOTNULL: zName = "SQLITE_CONSTRAINT_NOTNULL";break; - case SQLITE_CONSTRAINT_COMMITHOOK: - zName = "SQLITE_CONSTRAINT_COMMITHOOK"; break; - case SQLITE_CONSTRAINT_VTAB: zName = "SQLITE_CONSTRAINT_VTAB"; break; - case SQLITE_CONSTRAINT_FUNCTION: - zName = "SQLITE_CONSTRAINT_FUNCTION"; break; - case SQLITE_CONSTRAINT_ROWID: zName = "SQLITE_CONSTRAINT_ROWID"; break; - case SQLITE_MISMATCH: zName = "SQLITE_MISMATCH"; break; - case SQLITE_MISUSE: zName = "SQLITE_MISUSE"; break; - case SQLITE_NOLFS: zName = "SQLITE_NOLFS"; break; - case SQLITE_AUTH: zName = "SQLITE_AUTH"; break; - case SQLITE_FORMAT: zName = "SQLITE_FORMAT"; break; - case SQLITE_RANGE: zName = "SQLITE_RANGE"; break; - case SQLITE_NOTADB: zName = "SQLITE_NOTADB"; break; - case SQLITE_ROW: zName = "SQLITE_ROW"; break; - case SQLITE_NOTICE: zName = "SQLITE_NOTICE"; break; - case SQLITE_NOTICE_RECOVER_WAL: zName = "SQLITE_NOTICE_RECOVER_WAL";break; - case SQLITE_NOTICE_RECOVER_ROLLBACK: - zName = "SQLITE_NOTICE_RECOVER_ROLLBACK"; break; - case SQLITE_WARNING: zName = "SQLITE_WARNING"; break; - case SQLITE_WARNING_AUTOINDEX: zName = "SQLITE_WARNING_AUTOINDEX"; break; - case SQLITE_DONE: zName = "SQLITE_DONE"; break; - } - } - if( zName==0 ){ - static char zBuf[50]; - sqlite3_snprintf(sizeof(zBuf), zBuf, "SQLITE_UNKNOWN(%d)", origRc); - zName = zBuf; - } - return zName; -} -#endif - -/* -** Return a static string that describes the kind of error specified in the -** argument. -*/ -SQLITE_PRIVATE const char *sqlite3ErrStr(int rc){ - static const char* const aMsg[] = { - /* SQLITE_OK */ "not an error", - /* SQLITE_ERROR */ "SQL logic error or missing database", - /* SQLITE_INTERNAL */ 0, - /* SQLITE_PERM */ "access permission denied", - /* SQLITE_ABORT */ "callback requested query abort", - /* SQLITE_BUSY */ "database is locked", - /* SQLITE_LOCKED */ "database table is locked", - /* SQLITE_NOMEM */ "out of memory", - /* SQLITE_READONLY */ "attempt to write a readonly database", - /* SQLITE_INTERRUPT */ "interrupted", - /* SQLITE_IOERR */ "disk I/O error", - /* SQLITE_CORRUPT */ "database disk image is malformed", - /* SQLITE_NOTFOUND */ "unknown operation", - /* SQLITE_FULL */ "database or disk is full", - /* SQLITE_CANTOPEN */ "unable to open database file", - /* SQLITE_PROTOCOL */ "locking protocol", - /* SQLITE_EMPTY */ "table contains no data", - /* SQLITE_SCHEMA */ "database schema has changed", - /* SQLITE_TOOBIG */ "string or blob too big", - /* SQLITE_CONSTRAINT */ "constraint failed", - /* SQLITE_MISMATCH */ "datatype mismatch", - /* SQLITE_MISUSE */ "library routine called out of sequence", - /* SQLITE_NOLFS */ "large file support is disabled", - /* SQLITE_AUTH */ "authorization denied", - /* SQLITE_FORMAT */ "auxiliary database format error", - /* SQLITE_RANGE */ "bind or column index out of range", - /* SQLITE_NOTADB */ "file is encrypted or is not a database", - }; - const char *zErr = "unknown error"; - switch( rc ){ - case SQLITE_ABORT_ROLLBACK: { - zErr = "abort due to ROLLBACK"; - break; - } - default: { - rc &= 0xff; - if( ALWAYS(rc>=0) && rcbusyTimeout; - int delay, prior; - - assert( count>=0 ); - if( count < NDELAY ){ - delay = delays[count]; - prior = totals[count]; - }else{ - delay = delays[NDELAY-1]; - prior = totals[NDELAY-1] + delay*(count-(NDELAY-1)); - } - if( prior + delay > timeout ){ - delay = timeout - prior; - if( delay<=0 ) return 0; - } - sqlite3OsSleep(db->pVfs, delay*1000); - return 1; -#else - sqlite3 *db = (sqlite3 *)ptr; - int timeout = ((sqlite3 *)ptr)->busyTimeout; - if( (count+1)*1000 > timeout ){ - return 0; - } - sqlite3OsSleep(db->pVfs, 1000000); - return 1; -#endif -} - -/* -** Invoke the given busy handler. -** -** This routine is called when an operation failed with a lock. -** If this routine returns non-zero, the lock is retried. If it -** returns 0, the operation aborts with an SQLITE_BUSY error. -*/ -SQLITE_PRIVATE int sqlite3InvokeBusyHandler(BusyHandler *p){ - int rc; - if( NEVER(p==0) || p->xFunc==0 || p->nBusy<0 ) return 0; - rc = p->xFunc(p->pArg, p->nBusy); - if( rc==0 ){ - p->nBusy = -1; - }else{ - p->nBusy++; - } - return rc; -} - -/* -** This routine sets the busy callback for an Sqlite database to the -** given callback function with the given argument. -*/ -SQLITE_API int sqlite3_busy_handler( - sqlite3 *db, - int (*xBusy)(void*,int), - void *pArg -){ - sqlite3_mutex_enter(db->mutex); - db->busyHandler.xFunc = xBusy; - db->busyHandler.pArg = pArg; - db->busyHandler.nBusy = 0; - db->busyTimeout = 0; - sqlite3_mutex_leave(db->mutex); - return SQLITE_OK; -} - -#ifndef SQLITE_OMIT_PROGRESS_CALLBACK -/* -** This routine sets the progress callback for an Sqlite database to the -** given callback function with the given argument. The progress callback will -** be invoked every nOps opcodes. -*/ -SQLITE_API void sqlite3_progress_handler( - sqlite3 *db, - int nOps, - int (*xProgress)(void*), - void *pArg -){ - sqlite3_mutex_enter(db->mutex); - if( nOps>0 ){ - db->xProgress = xProgress; - db->nProgressOps = (unsigned)nOps; - db->pProgressArg = pArg; - }else{ - db->xProgress = 0; - db->nProgressOps = 0; - db->pProgressArg = 0; - } - sqlite3_mutex_leave(db->mutex); -} -#endif - - -/* -** This routine installs a default busy handler that waits for the -** specified number of milliseconds before returning 0. -*/ -SQLITE_API int sqlite3_busy_timeout(sqlite3 *db, int ms){ - if( ms>0 ){ - sqlite3_busy_handler(db, sqliteDefaultBusyCallback, (void*)db); - db->busyTimeout = ms; - }else{ - sqlite3_busy_handler(db, 0, 0); - } - return SQLITE_OK; -} - -/* -** Cause any pending operation to stop at its earliest opportunity. -*/ -SQLITE_API void sqlite3_interrupt(sqlite3 *db){ - db->u1.isInterrupted = 1; -} - - -/* -** This function is exactly the same as sqlite3_create_function(), except -** that it is designed to be called by internal code. The difference is -** that if a malloc() fails in sqlite3_create_function(), an error code -** is returned and the mallocFailed flag cleared. -*/ -SQLITE_PRIVATE int sqlite3CreateFunc( - sqlite3 *db, - const char *zFunctionName, - int nArg, - int enc, - void *pUserData, - void (*xFunc)(sqlite3_context*,int,sqlite3_value **), - void (*xStep)(sqlite3_context*,int,sqlite3_value **), - void (*xFinal)(sqlite3_context*), - FuncDestructor *pDestructor -){ - FuncDef *p; - int nName; - int extraFlags; - - assert( sqlite3_mutex_held(db->mutex) ); - if( zFunctionName==0 || - (xFunc && (xFinal || xStep)) || - (!xFunc && (xFinal && !xStep)) || - (!xFunc && (!xFinal && xStep)) || - (nArg<-1 || nArg>SQLITE_MAX_FUNCTION_ARG) || - (255<(nName = sqlite3Strlen30( zFunctionName))) ){ - return SQLITE_MISUSE_BKPT; - } - - assert( SQLITE_FUNC_CONSTANT==SQLITE_DETERMINISTIC ); - extraFlags = enc & SQLITE_DETERMINISTIC; - enc &= (SQLITE_FUNC_ENCMASK|SQLITE_ANY); - -#ifndef SQLITE_OMIT_UTF16 - /* If SQLITE_UTF16 is specified as the encoding type, transform this - ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the - ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. - ** - ** If SQLITE_ANY is specified, add three versions of the function - ** to the hash table. - */ - if( enc==SQLITE_UTF16 ){ - enc = SQLITE_UTF16NATIVE; - }else if( enc==SQLITE_ANY ){ - int rc; - rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF8|extraFlags, - pUserData, xFunc, xStep, xFinal, pDestructor); - if( rc==SQLITE_OK ){ - rc = sqlite3CreateFunc(db, zFunctionName, nArg, SQLITE_UTF16LE|extraFlags, - pUserData, xFunc, xStep, xFinal, pDestructor); - } - if( rc!=SQLITE_OK ){ - return rc; - } - enc = SQLITE_UTF16BE; - } -#else - enc = SQLITE_UTF8; -#endif - - /* Check if an existing function is being overridden or deleted. If so, - ** and there are active VMs, then return SQLITE_BUSY. If a function - ** is being overridden/deleted but there are no active VMs, allow the - ** operation to continue but invalidate all precompiled statements. - */ - p = sqlite3FindFunction(db, zFunctionName, nName, nArg, (u8)enc, 0); - if( p && (p->funcFlags & SQLITE_FUNC_ENCMASK)==enc && p->nArg==nArg ){ - if( db->nVdbeActive ){ - sqlite3Error(db, SQLITE_BUSY, - "unable to delete/modify user-function due to active statements"); - assert( !db->mallocFailed ); - return SQLITE_BUSY; - }else{ - sqlite3ExpirePreparedStatements(db); - } - } - - p = sqlite3FindFunction(db, zFunctionName, nName, nArg, (u8)enc, 1); - assert(p || db->mallocFailed); - if( !p ){ - return SQLITE_NOMEM; - } - - /* If an older version of the function with a configured destructor is - ** being replaced invoke the destructor function here. */ - functionDestroy(db, p); - - if( pDestructor ){ - pDestructor->nRef++; - } - p->pDestructor = pDestructor; - p->funcFlags = (p->funcFlags & SQLITE_FUNC_ENCMASK) | extraFlags; - testcase( p->funcFlags & SQLITE_DETERMINISTIC ); - p->xFunc = xFunc; - p->xStep = xStep; - p->xFinalize = xFinal; - p->pUserData = pUserData; - p->nArg = (u16)nArg; - return SQLITE_OK; -} - -/* -** Create new user functions. -*/ -SQLITE_API int sqlite3_create_function( - sqlite3 *db, - const char *zFunc, - int nArg, - int enc, - void *p, - void (*xFunc)(sqlite3_context*,int,sqlite3_value **), - void (*xStep)(sqlite3_context*,int,sqlite3_value **), - void (*xFinal)(sqlite3_context*) -){ - return sqlite3_create_function_v2(db, zFunc, nArg, enc, p, xFunc, xStep, - xFinal, 0); -} - -SQLITE_API int sqlite3_create_function_v2( - sqlite3 *db, - const char *zFunc, - int nArg, - int enc, - void *p, - void (*xFunc)(sqlite3_context*,int,sqlite3_value **), - void (*xStep)(sqlite3_context*,int,sqlite3_value **), - void (*xFinal)(sqlite3_context*), - void (*xDestroy)(void *) -){ - int rc = SQLITE_ERROR; - FuncDestructor *pArg = 0; - sqlite3_mutex_enter(db->mutex); - if( xDestroy ){ - pArg = (FuncDestructor *)sqlite3DbMallocZero(db, sizeof(FuncDestructor)); - if( !pArg ){ - xDestroy(p); - goto out; - } - pArg->xDestroy = xDestroy; - pArg->pUserData = p; - } - rc = sqlite3CreateFunc(db, zFunc, nArg, enc, p, xFunc, xStep, xFinal, pArg); - if( pArg && pArg->nRef==0 ){ - assert( rc!=SQLITE_OK ); - xDestroy(p); - sqlite3DbFree(db, pArg); - } - - out: - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -#ifndef SQLITE_OMIT_UTF16 -SQLITE_API int sqlite3_create_function16( - sqlite3 *db, - const void *zFunctionName, - int nArg, - int eTextRep, - void *p, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) -){ - int rc; - char *zFunc8; - sqlite3_mutex_enter(db->mutex); - assert( !db->mallocFailed ); - zFunc8 = sqlite3Utf16to8(db, zFunctionName, -1, SQLITE_UTF16NATIVE); - rc = sqlite3CreateFunc(db, zFunc8, nArg, eTextRep, p, xFunc, xStep, xFinal,0); - sqlite3DbFree(db, zFunc8); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} -#endif - - -/* -** Declare that a function has been overloaded by a virtual table. -** -** If the function already exists as a regular global function, then -** this routine is a no-op. If the function does not exist, then create -** a new one that always throws a run-time error. -** -** When virtual tables intend to provide an overloaded function, they -** should call this routine to make sure the global function exists. -** A global function must exist in order for name resolution to work -** properly. -*/ -SQLITE_API int sqlite3_overload_function( - sqlite3 *db, - const char *zName, - int nArg -){ - int nName = sqlite3Strlen30(zName); - int rc = SQLITE_OK; - sqlite3_mutex_enter(db->mutex); - if( sqlite3FindFunction(db, zName, nName, nArg, SQLITE_UTF8, 0)==0 ){ - rc = sqlite3CreateFunc(db, zName, nArg, SQLITE_UTF8, - 0, sqlite3InvalidFunction, 0, 0, 0); - } - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -#ifndef SQLITE_OMIT_TRACE -/* -** Register a trace function. The pArg from the previously registered trace -** is returned. -** -** A NULL trace function means that no tracing is executes. A non-NULL -** trace is a pointer to a function that is invoked at the start of each -** SQL statement. -*/ -SQLITE_API void *sqlite3_trace(sqlite3 *db, void (*xTrace)(void*,const char*), void *pArg){ - void *pOld; - sqlite3_mutex_enter(db->mutex); - pOld = db->pTraceArg; - db->xTrace = xTrace; - db->pTraceArg = pArg; - sqlite3_mutex_leave(db->mutex); - return pOld; -} -/* -** Register a profile function. The pArg from the previously registered -** profile function is returned. -** -** A NULL profile function means that no profiling is executes. A non-NULL -** profile is a pointer to a function that is invoked at the conclusion of -** each SQL statement that is run. -*/ -SQLITE_API void *sqlite3_profile( - sqlite3 *db, - void (*xProfile)(void*,const char*,sqlite_uint64), - void *pArg -){ - void *pOld; - sqlite3_mutex_enter(db->mutex); - pOld = db->pProfileArg; - db->xProfile = xProfile; - db->pProfileArg = pArg; - sqlite3_mutex_leave(db->mutex); - return pOld; -} -#endif /* SQLITE_OMIT_TRACE */ - -/* -** Register a function to be invoked when a transaction commits. -** If the invoked function returns non-zero, then the commit becomes a -** rollback. -*/ -SQLITE_API void *sqlite3_commit_hook( - sqlite3 *db, /* Attach the hook to this database */ - int (*xCallback)(void*), /* Function to invoke on each commit */ - void *pArg /* Argument to the function */ -){ - void *pOld; - sqlite3_mutex_enter(db->mutex); - pOld = db->pCommitArg; - db->xCommitCallback = xCallback; - db->pCommitArg = pArg; - sqlite3_mutex_leave(db->mutex); - return pOld; -} - -/* -** Register a callback to be invoked each time a row is updated, -** inserted or deleted using this database connection. -*/ -SQLITE_API void *sqlite3_update_hook( - sqlite3 *db, /* Attach the hook to this database */ - void (*xCallback)(void*,int,char const *,char const *,sqlite_int64), - void *pArg /* Argument to the function */ -){ - void *pRet; - sqlite3_mutex_enter(db->mutex); - pRet = db->pUpdateArg; - db->xUpdateCallback = xCallback; - db->pUpdateArg = pArg; - sqlite3_mutex_leave(db->mutex); - return pRet; -} - -/* -** Register a callback to be invoked each time a transaction is rolled -** back by this database connection. -*/ -SQLITE_API void *sqlite3_rollback_hook( - sqlite3 *db, /* Attach the hook to this database */ - void (*xCallback)(void*), /* Callback function */ - void *pArg /* Argument to the function */ -){ - void *pRet; - sqlite3_mutex_enter(db->mutex); - pRet = db->pRollbackArg; - db->xRollbackCallback = xCallback; - db->pRollbackArg = pArg; - sqlite3_mutex_leave(db->mutex); - return pRet; -} - -#ifndef SQLITE_OMIT_WAL -/* -** The sqlite3_wal_hook() callback registered by sqlite3_wal_autocheckpoint(). -** Invoke sqlite3_wal_checkpoint if the number of frames in the log file -** is greater than sqlite3.pWalArg cast to an integer (the value configured by -** wal_autocheckpoint()). -*/ -SQLITE_PRIVATE int sqlite3WalDefaultHook( - void *pClientData, /* Argument */ - sqlite3 *db, /* Connection */ - const char *zDb, /* Database */ - int nFrame /* Size of WAL */ -){ - if( nFrame>=SQLITE_PTR_TO_INT(pClientData) ){ - sqlite3BeginBenignMalloc(); - sqlite3_wal_checkpoint(db, zDb); - sqlite3EndBenignMalloc(); - } - return SQLITE_OK; -} -#endif /* SQLITE_OMIT_WAL */ - -/* -** Configure an sqlite3_wal_hook() callback to automatically checkpoint -** a database after committing a transaction if there are nFrame or -** more frames in the log file. Passing zero or a negative value as the -** nFrame parameter disables automatic checkpoints entirely. -** -** The callback registered by this function replaces any existing callback -** registered using sqlite3_wal_hook(). Likewise, registering a callback -** using sqlite3_wal_hook() disables the automatic checkpoint mechanism -** configured by this function. -*/ -SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int nFrame){ -#ifdef SQLITE_OMIT_WAL - UNUSED_PARAMETER(db); - UNUSED_PARAMETER(nFrame); -#else - if( nFrame>0 ){ - sqlite3_wal_hook(db, sqlite3WalDefaultHook, SQLITE_INT_TO_PTR(nFrame)); - }else{ - sqlite3_wal_hook(db, 0, 0); - } -#endif - return SQLITE_OK; -} - -/* -** Register a callback to be invoked each time a transaction is written -** into the write-ahead-log by this database connection. -*/ -SQLITE_API void *sqlite3_wal_hook( - sqlite3 *db, /* Attach the hook to this db handle */ - int(*xCallback)(void *, sqlite3*, const char*, int), - void *pArg /* First argument passed to xCallback() */ -){ -#ifndef SQLITE_OMIT_WAL - void *pRet; - sqlite3_mutex_enter(db->mutex); - pRet = db->pWalArg; - db->xWalCallback = xCallback; - db->pWalArg = pArg; - sqlite3_mutex_leave(db->mutex); - return pRet; -#else - return 0; -#endif -} - -/* -** Checkpoint database zDb. -*/ -SQLITE_API int sqlite3_wal_checkpoint_v2( - sqlite3 *db, /* Database handle */ - const char *zDb, /* Name of attached database (or NULL) */ - int eMode, /* SQLITE_CHECKPOINT_* value */ - int *pnLog, /* OUT: Size of WAL log in frames */ - int *pnCkpt /* OUT: Total number of frames checkpointed */ -){ -#ifdef SQLITE_OMIT_WAL - return SQLITE_OK; -#else - int rc; /* Return code */ - int iDb = SQLITE_MAX_ATTACHED; /* sqlite3.aDb[] index of db to checkpoint */ - - /* Initialize the output variables to -1 in case an error occurs. */ - if( pnLog ) *pnLog = -1; - if( pnCkpt ) *pnCkpt = -1; - - assert( SQLITE_CHECKPOINT_FULL>SQLITE_CHECKPOINT_PASSIVE ); - assert( SQLITE_CHECKPOINT_FULLSQLITE_CHECKPOINT_RESTART ){ - return SQLITE_MISUSE; - } - - sqlite3_mutex_enter(db->mutex); - if( zDb && zDb[0] ){ - iDb = sqlite3FindDbName(db, zDb); - } - if( iDb<0 ){ - rc = SQLITE_ERROR; - sqlite3Error(db, SQLITE_ERROR, "unknown database: %s", zDb); - }else{ - rc = sqlite3Checkpoint(db, iDb, eMode, pnLog, pnCkpt); - sqlite3Error(db, rc, 0); - } - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -#endif -} - - -/* -** Checkpoint database zDb. If zDb is NULL, or if the buffer zDb points -** to contains a zero-length string, all attached databases are -** checkpointed. -*/ -SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb){ - return sqlite3_wal_checkpoint_v2(db, zDb, SQLITE_CHECKPOINT_PASSIVE, 0, 0); -} - -#ifndef SQLITE_OMIT_WAL -/* -** Run a checkpoint on database iDb. This is a no-op if database iDb is -** not currently open in WAL mode. -** -** If a transaction is open on the database being checkpointed, this -** function returns SQLITE_LOCKED and a checkpoint is not attempted. If -** an error occurs while running the checkpoint, an SQLite error code is -** returned (i.e. SQLITE_IOERR). Otherwise, SQLITE_OK. -** -** The mutex on database handle db should be held by the caller. The mutex -** associated with the specific b-tree being checkpointed is taken by -** this function while the checkpoint is running. -** -** If iDb is passed SQLITE_MAX_ATTACHED, then all attached databases are -** checkpointed. If an error is encountered it is returned immediately - -** no attempt is made to checkpoint any remaining databases. -** -** Parameter eMode is one of SQLITE_CHECKPOINT_PASSIVE, FULL or RESTART. -*/ -SQLITE_PRIVATE int sqlite3Checkpoint(sqlite3 *db, int iDb, int eMode, int *pnLog, int *pnCkpt){ - int rc = SQLITE_OK; /* Return code */ - int i; /* Used to iterate through attached dbs */ - int bBusy = 0; /* True if SQLITE_BUSY has been encountered */ - - assert( sqlite3_mutex_held(db->mutex) ); - assert( !pnLog || *pnLog==-1 ); - assert( !pnCkpt || *pnCkpt==-1 ); - - for(i=0; inDb && rc==SQLITE_OK; i++){ - if( i==iDb || iDb==SQLITE_MAX_ATTACHED ){ - rc = sqlite3BtreeCheckpoint(db->aDb[i].pBt, eMode, pnLog, pnCkpt); - pnLog = 0; - pnCkpt = 0; - if( rc==SQLITE_BUSY ){ - bBusy = 1; - rc = SQLITE_OK; - } - } - } - - return (rc==SQLITE_OK && bBusy) ? SQLITE_BUSY : rc; -} -#endif /* SQLITE_OMIT_WAL */ - -/* -** This function returns true if main-memory should be used instead of -** a temporary file for transient pager files and statement journals. -** The value returned depends on the value of db->temp_store (runtime -** parameter) and the compile time value of SQLITE_TEMP_STORE. The -** following table describes the relationship between these two values -** and this functions return value. -** -** SQLITE_TEMP_STORE db->temp_store Location of temporary database -** ----------------- -------------- ------------------------------ -** 0 any file (return 0) -** 1 1 file (return 0) -** 1 2 memory (return 1) -** 1 0 file (return 0) -** 2 1 file (return 0) -** 2 2 memory (return 1) -** 2 0 memory (return 1) -** 3 any memory (return 1) -*/ -SQLITE_PRIVATE int sqlite3TempInMemory(const sqlite3 *db){ -#if SQLITE_TEMP_STORE==1 - return ( db->temp_store==2 ); -#endif -#if SQLITE_TEMP_STORE==2 - return ( db->temp_store!=1 ); -#endif -#if SQLITE_TEMP_STORE==3 - return 1; -#endif -#if SQLITE_TEMP_STORE<1 || SQLITE_TEMP_STORE>3 - return 0; -#endif -} - -/* -** Return UTF-8 encoded English language explanation of the most recent -** error. -*/ -SQLITE_API const char *sqlite3_errmsg(sqlite3 *db){ - const char *z; - if( !db ){ - return sqlite3ErrStr(SQLITE_NOMEM); - } - if( !sqlite3SafetyCheckSickOrOk(db) ){ - return sqlite3ErrStr(SQLITE_MISUSE_BKPT); - } - sqlite3_mutex_enter(db->mutex); - if( db->mallocFailed ){ - z = sqlite3ErrStr(SQLITE_NOMEM); - }else{ - testcase( db->pErr==0 ); - z = (char*)sqlite3_value_text(db->pErr); - assert( !db->mallocFailed ); - if( z==0 ){ - z = sqlite3ErrStr(db->errCode); - } - } - sqlite3_mutex_leave(db->mutex); - return z; -} - -#ifndef SQLITE_OMIT_UTF16 -/* -** Return UTF-16 encoded English language explanation of the most recent -** error. -*/ -SQLITE_API const void *sqlite3_errmsg16(sqlite3 *db){ - static const u16 outOfMem[] = { - 'o', 'u', 't', ' ', 'o', 'f', ' ', 'm', 'e', 'm', 'o', 'r', 'y', 0 - }; - static const u16 misuse[] = { - 'l', 'i', 'b', 'r', 'a', 'r', 'y', ' ', - 'r', 'o', 'u', 't', 'i', 'n', 'e', ' ', - 'c', 'a', 'l', 'l', 'e', 'd', ' ', - 'o', 'u', 't', ' ', - 'o', 'f', ' ', - 's', 'e', 'q', 'u', 'e', 'n', 'c', 'e', 0 - }; - - const void *z; - if( !db ){ - return (void *)outOfMem; - } - if( !sqlite3SafetyCheckSickOrOk(db) ){ - return (void *)misuse; - } - sqlite3_mutex_enter(db->mutex); - if( db->mallocFailed ){ - z = (void *)outOfMem; - }else{ - z = sqlite3_value_text16(db->pErr); - if( z==0 ){ - sqlite3Error(db, db->errCode, sqlite3ErrStr(db->errCode)); - z = sqlite3_value_text16(db->pErr); - } - /* A malloc() may have failed within the call to sqlite3_value_text16() - ** above. If this is the case, then the db->mallocFailed flag needs to - ** be cleared before returning. Do this directly, instead of via - ** sqlite3ApiExit(), to avoid setting the database handle error message. - */ - db->mallocFailed = 0; - } - sqlite3_mutex_leave(db->mutex); - return z; -} -#endif /* SQLITE_OMIT_UTF16 */ - -/* -** Return the most recent error code generated by an SQLite routine. If NULL is -** passed to this function, we assume a malloc() failed during sqlite3_open(). -*/ -SQLITE_API int sqlite3_errcode(sqlite3 *db){ - if( db && !sqlite3SafetyCheckSickOrOk(db) ){ - return SQLITE_MISUSE_BKPT; - } - if( !db || db->mallocFailed ){ - return SQLITE_NOMEM; - } - return db->errCode & db->errMask; -} -SQLITE_API int sqlite3_extended_errcode(sqlite3 *db){ - if( db && !sqlite3SafetyCheckSickOrOk(db) ){ - return SQLITE_MISUSE_BKPT; - } - if( !db || db->mallocFailed ){ - return SQLITE_NOMEM; - } - return db->errCode; -} - -/* -** Return a string that describes the kind of error specified in the -** argument. For now, this simply calls the internal sqlite3ErrStr() -** function. -*/ -SQLITE_API const char *sqlite3_errstr(int rc){ - return sqlite3ErrStr(rc); -} - -/* -** Invalidate all cached KeyInfo objects for database connection "db" -*/ -static void invalidateCachedKeyInfo(sqlite3 *db){ - Db *pDb; /* A single database */ - int iDb; /* The database index number */ - HashElem *k; /* For looping over tables in pDb */ - Table *pTab; /* A table in the database */ - Index *pIdx; /* Each index */ - - for(iDb=0, pDb=db->aDb; iDbnDb; iDb++, pDb++){ - if( pDb->pBt==0 ) continue; - sqlite3BtreeEnter(pDb->pBt); - for(k=sqliteHashFirst(&pDb->pSchema->tblHash); k; k=sqliteHashNext(k)){ - pTab = (Table*)sqliteHashData(k); - for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ - if( pIdx->pKeyInfo && pIdx->pKeyInfo->db==db ){ - sqlite3KeyInfoUnref(pIdx->pKeyInfo); - pIdx->pKeyInfo = 0; - } - } - } - sqlite3BtreeLeave(pDb->pBt); - } -} - -/* -** Create a new collating function for database "db". The name is zName -** and the encoding is enc. -*/ -static int createCollation( - sqlite3* db, - const char *zName, - u8 enc, - void* pCtx, - int(*xCompare)(void*,int,const void*,int,const void*), - void(*xDel)(void*) -){ - CollSeq *pColl; - int enc2; - int nName = sqlite3Strlen30(zName); - - assert( sqlite3_mutex_held(db->mutex) ); - - /* If SQLITE_UTF16 is specified as the encoding type, transform this - ** to one of SQLITE_UTF16LE or SQLITE_UTF16BE using the - ** SQLITE_UTF16NATIVE macro. SQLITE_UTF16 is not used internally. - */ - enc2 = enc; - testcase( enc2==SQLITE_UTF16 ); - testcase( enc2==SQLITE_UTF16_ALIGNED ); - if( enc2==SQLITE_UTF16 || enc2==SQLITE_UTF16_ALIGNED ){ - enc2 = SQLITE_UTF16NATIVE; - } - if( enc2SQLITE_UTF16BE ){ - return SQLITE_MISUSE_BKPT; - } - - /* Check if this call is removing or replacing an existing collation - ** sequence. If so, and there are active VMs, return busy. If there - ** are no active VMs, invalidate any pre-compiled statements. - */ - pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 0); - if( pColl && pColl->xCmp ){ - if( db->nVdbeActive ){ - sqlite3Error(db, SQLITE_BUSY, - "unable to delete/modify collation sequence due to active statements"); - return SQLITE_BUSY; - } - sqlite3ExpirePreparedStatements(db); - invalidateCachedKeyInfo(db); - - /* If collation sequence pColl was created directly by a call to - ** sqlite3_create_collation, and not generated by synthCollSeq(), - ** then any copies made by synthCollSeq() need to be invalidated. - ** Also, collation destructor - CollSeq.xDel() - function may need - ** to be called. - */ - if( (pColl->enc & ~SQLITE_UTF16_ALIGNED)==enc2 ){ - CollSeq *aColl = sqlite3HashFind(&db->aCollSeq, zName, nName); - int j; - for(j=0; j<3; j++){ - CollSeq *p = &aColl[j]; - if( p->enc==pColl->enc ){ - if( p->xDel ){ - p->xDel(p->pUser); - } - p->xCmp = 0; - } - } - } - } - - pColl = sqlite3FindCollSeq(db, (u8)enc2, zName, 1); - if( pColl==0 ) return SQLITE_NOMEM; - pColl->xCmp = xCompare; - pColl->pUser = pCtx; - pColl->xDel = xDel; - pColl->enc = (u8)(enc2 | (enc & SQLITE_UTF16_ALIGNED)); - sqlite3Error(db, SQLITE_OK, 0); - return SQLITE_OK; -} - - -/* -** This array defines hard upper bounds on limit values. The -** initializer must be kept in sync with the SQLITE_LIMIT_* -** #defines in sqlite3.h. -*/ -static const int aHardLimit[] = { - SQLITE_MAX_LENGTH, - SQLITE_MAX_SQL_LENGTH, - SQLITE_MAX_COLUMN, - SQLITE_MAX_EXPR_DEPTH, - SQLITE_MAX_COMPOUND_SELECT, - SQLITE_MAX_VDBE_OP, - SQLITE_MAX_FUNCTION_ARG, - SQLITE_MAX_ATTACHED, - SQLITE_MAX_LIKE_PATTERN_LENGTH, - SQLITE_MAX_VARIABLE_NUMBER, - SQLITE_MAX_TRIGGER_DEPTH, -}; - -/* -** Make sure the hard limits are set to reasonable values -*/ -#if SQLITE_MAX_LENGTH<100 -# error SQLITE_MAX_LENGTH must be at least 100 -#endif -#if SQLITE_MAX_SQL_LENGTH<100 -# error SQLITE_MAX_SQL_LENGTH must be at least 100 -#endif -#if SQLITE_MAX_SQL_LENGTH>SQLITE_MAX_LENGTH -# error SQLITE_MAX_SQL_LENGTH must not be greater than SQLITE_MAX_LENGTH -#endif -#if SQLITE_MAX_COMPOUND_SELECT<2 -# error SQLITE_MAX_COMPOUND_SELECT must be at least 2 -#endif -#if SQLITE_MAX_VDBE_OP<40 -# error SQLITE_MAX_VDBE_OP must be at least 40 -#endif -#if SQLITE_MAX_FUNCTION_ARG<0 || SQLITE_MAX_FUNCTION_ARG>1000 -# error SQLITE_MAX_FUNCTION_ARG must be between 0 and 1000 -#endif -#if SQLITE_MAX_ATTACHED<0 || SQLITE_MAX_ATTACHED>62 -# error SQLITE_MAX_ATTACHED must be between 0 and 62 -#endif -#if SQLITE_MAX_LIKE_PATTERN_LENGTH<1 -# error SQLITE_MAX_LIKE_PATTERN_LENGTH must be at least 1 -#endif -#if SQLITE_MAX_COLUMN>32767 -# error SQLITE_MAX_COLUMN must not exceed 32767 -#endif -#if SQLITE_MAX_TRIGGER_DEPTH<1 -# error SQLITE_MAX_TRIGGER_DEPTH must be at least 1 -#endif - - -/* -** Change the value of a limit. Report the old value. -** If an invalid limit index is supplied, report -1. -** Make no changes but still report the old value if the -** new limit is negative. -** -** A new lower limit does not shrink existing constructs. -** It merely prevents new constructs that exceed the limit -** from forming. -*/ -SQLITE_API int sqlite3_limit(sqlite3 *db, int limitId, int newLimit){ - int oldLimit; - - - /* EVIDENCE-OF: R-30189-54097 For each limit category SQLITE_LIMIT_NAME - ** there is a hard upper bound set at compile-time by a C preprocessor - ** macro called SQLITE_MAX_NAME. (The "_LIMIT_" in the name is changed to - ** "_MAX_".) - */ - assert( aHardLimit[SQLITE_LIMIT_LENGTH]==SQLITE_MAX_LENGTH ); - assert( aHardLimit[SQLITE_LIMIT_SQL_LENGTH]==SQLITE_MAX_SQL_LENGTH ); - assert( aHardLimit[SQLITE_LIMIT_COLUMN]==SQLITE_MAX_COLUMN ); - assert( aHardLimit[SQLITE_LIMIT_EXPR_DEPTH]==SQLITE_MAX_EXPR_DEPTH ); - assert( aHardLimit[SQLITE_LIMIT_COMPOUND_SELECT]==SQLITE_MAX_COMPOUND_SELECT); - assert( aHardLimit[SQLITE_LIMIT_VDBE_OP]==SQLITE_MAX_VDBE_OP ); - assert( aHardLimit[SQLITE_LIMIT_FUNCTION_ARG]==SQLITE_MAX_FUNCTION_ARG ); - assert( aHardLimit[SQLITE_LIMIT_ATTACHED]==SQLITE_MAX_ATTACHED ); - assert( aHardLimit[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]== - SQLITE_MAX_LIKE_PATTERN_LENGTH ); - assert( aHardLimit[SQLITE_LIMIT_VARIABLE_NUMBER]==SQLITE_MAX_VARIABLE_NUMBER); - assert( aHardLimit[SQLITE_LIMIT_TRIGGER_DEPTH]==SQLITE_MAX_TRIGGER_DEPTH ); - assert( SQLITE_LIMIT_TRIGGER_DEPTH==(SQLITE_N_LIMIT-1) ); - - - if( limitId<0 || limitId>=SQLITE_N_LIMIT ){ - return -1; - } - oldLimit = db->aLimit[limitId]; - if( newLimit>=0 ){ /* IMP: R-52476-28732 */ - if( newLimit>aHardLimit[limitId] ){ - newLimit = aHardLimit[limitId]; /* IMP: R-51463-25634 */ - } - db->aLimit[limitId] = newLimit; - } - return oldLimit; /* IMP: R-53341-35419 */ -} - -/* -** This function is used to parse both URIs and non-URI filenames passed by the -** user to API functions sqlite3_open() or sqlite3_open_v2(), and for database -** URIs specified as part of ATTACH statements. -** -** The first argument to this function is the name of the VFS to use (or -** a NULL to signify the default VFS) if the URI does not contain a "vfs=xxx" -** query parameter. The second argument contains the URI (or non-URI filename) -** itself. When this function is called the *pFlags variable should contain -** the default flags to open the database handle with. The value stored in -** *pFlags may be updated before returning if the URI filename contains -** "cache=xxx" or "mode=xxx" query parameters. -** -** If successful, SQLITE_OK is returned. In this case *ppVfs is set to point to -** the VFS that should be used to open the database file. *pzFile is set to -** point to a buffer containing the name of the file to open. It is the -** responsibility of the caller to eventually call sqlite3_free() to release -** this buffer. -** -** If an error occurs, then an SQLite error code is returned and *pzErrMsg -** may be set to point to a buffer containing an English language error -** message. It is the responsibility of the caller to eventually release -** this buffer by calling sqlite3_free(). -*/ -SQLITE_PRIVATE int sqlite3ParseUri( - const char *zDefaultVfs, /* VFS to use if no "vfs=xxx" query option */ - const char *zUri, /* Nul-terminated URI to parse */ - unsigned int *pFlags, /* IN/OUT: SQLITE_OPEN_XXX flags */ - sqlite3_vfs **ppVfs, /* OUT: VFS to use */ - char **pzFile, /* OUT: Filename component of URI */ - char **pzErrMsg /* OUT: Error message (if rc!=SQLITE_OK) */ -){ - int rc = SQLITE_OK; - unsigned int flags = *pFlags; - const char *zVfs = zDefaultVfs; - char *zFile; - char c; - int nUri = sqlite3Strlen30(zUri); - - assert( *pzErrMsg==0 ); - - if( ((flags & SQLITE_OPEN_URI) || sqlite3GlobalConfig.bOpenUri) - && nUri>=5 && memcmp(zUri, "file:", 5)==0 - ){ - char *zOpt; - int eState; /* Parser state when parsing URI */ - int iIn; /* Input character index */ - int iOut = 0; /* Output character index */ - int nByte = nUri+2; /* Bytes of space to allocate */ - - /* Make sure the SQLITE_OPEN_URI flag is set to indicate to the VFS xOpen - ** method that there may be extra parameters following the file-name. */ - flags |= SQLITE_OPEN_URI; - - for(iIn=0; iIn=0 && octet<256 ); - if( octet==0 ){ - /* This branch is taken when "%00" appears within the URI. In this - ** case we ignore all text in the remainder of the path, name or - ** value currently being parsed. So ignore the current character - ** and skip to the next "?", "=" or "&", as appropriate. */ - while( (c = zUri[iIn])!=0 && c!='#' - && (eState!=0 || c!='?') - && (eState!=1 || (c!='=' && c!='&')) - && (eState!=2 || c!='&') - ){ - iIn++; - } - continue; - } - c = octet; - }else if( eState==1 && (c=='&' || c=='=') ){ - if( zFile[iOut-1]==0 ){ - /* An empty option name. Ignore this option altogether. */ - while( zUri[iIn] && zUri[iIn]!='#' && zUri[iIn-1]!='&' ) iIn++; - continue; - } - if( c=='&' ){ - zFile[iOut++] = '\0'; - }else{ - eState = 2; - } - c = 0; - }else if( (eState==0 && c=='?') || (eState==2 && c=='&') ){ - c = 0; - eState = 1; - } - zFile[iOut++] = c; - } - if( eState==1 ) zFile[iOut++] = '\0'; - zFile[iOut++] = '\0'; - zFile[iOut++] = '\0'; - - /* Check if there were any options specified that should be interpreted - ** here. Options that are interpreted here include "vfs" and those that - ** correspond to flags that may be passed to the sqlite3_open_v2() - ** method. */ - zOpt = &zFile[sqlite3Strlen30(zFile)+1]; - while( zOpt[0] ){ - int nOpt = sqlite3Strlen30(zOpt); - char *zVal = &zOpt[nOpt+1]; - int nVal = sqlite3Strlen30(zVal); - - if( nOpt==3 && memcmp("vfs", zOpt, 3)==0 ){ - zVfs = zVal; - }else{ - struct OpenMode { - const char *z; - int mode; - } *aMode = 0; - char *zModeType = 0; - int mask = 0; - int limit = 0; - - if( nOpt==5 && memcmp("cache", zOpt, 5)==0 ){ - static struct OpenMode aCacheMode[] = { - { "shared", SQLITE_OPEN_SHAREDCACHE }, - { "private", SQLITE_OPEN_PRIVATECACHE }, - { 0, 0 } - }; - - mask = SQLITE_OPEN_SHAREDCACHE|SQLITE_OPEN_PRIVATECACHE; - aMode = aCacheMode; - limit = mask; - zModeType = "cache"; - } - if( nOpt==4 && memcmp("mode", zOpt, 4)==0 ){ - static struct OpenMode aOpenMode[] = { - { "ro", SQLITE_OPEN_READONLY }, - { "rw", SQLITE_OPEN_READWRITE }, - { "rwc", SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE }, - { "memory", SQLITE_OPEN_MEMORY }, - { 0, 0 } - }; - - mask = SQLITE_OPEN_READONLY | SQLITE_OPEN_READWRITE - | SQLITE_OPEN_CREATE | SQLITE_OPEN_MEMORY; - aMode = aOpenMode; - limit = mask & flags; - zModeType = "access"; - } - - if( aMode ){ - int i; - int mode = 0; - for(i=0; aMode[i].z; i++){ - const char *z = aMode[i].z; - if( nVal==sqlite3Strlen30(z) && 0==memcmp(zVal, z, nVal) ){ - mode = aMode[i].mode; - break; - } - } - if( mode==0 ){ - *pzErrMsg = sqlite3_mprintf("no such %s mode: %s", zModeType, zVal); - rc = SQLITE_ERROR; - goto parse_uri_out; - } - if( (mode & ~SQLITE_OPEN_MEMORY)>limit ){ - *pzErrMsg = sqlite3_mprintf("%s mode not allowed: %s", - zModeType, zVal); - rc = SQLITE_PERM; - goto parse_uri_out; - } - flags = (flags & ~mask) | mode; - } - } - - zOpt = &zVal[nVal+1]; - } - - }else{ - zFile = sqlite3_malloc(nUri+2); - if( !zFile ) return SQLITE_NOMEM; - memcpy(zFile, zUri, nUri); - zFile[nUri] = '\0'; - zFile[nUri+1] = '\0'; - flags &= ~SQLITE_OPEN_URI; - } - - *ppVfs = sqlite3_vfs_find(zVfs); - if( *ppVfs==0 ){ - *pzErrMsg = sqlite3_mprintf("no such vfs: %s", zVfs); - rc = SQLITE_ERROR; - } - parse_uri_out: - if( rc!=SQLITE_OK ){ - sqlite3_free(zFile); - zFile = 0; - } - *pFlags = flags; - *pzFile = zFile; - return rc; -} - - -/* -** This routine does the work of opening a database on behalf of -** sqlite3_open() and sqlite3_open16(). The database filename "zFilename" -** is UTF-8 encoded. -*/ -static int openDatabase( - const char *zFilename, /* Database filename UTF-8 encoded */ - sqlite3 **ppDb, /* OUT: Returned database handle */ - unsigned int flags, /* Operational flags */ - const char *zVfs /* Name of the VFS to use */ -){ - sqlite3 *db; /* Store allocated handle here */ - int rc; /* Return code */ - int isThreadsafe; /* True for threadsafe connections */ - char *zOpen = 0; /* Filename argument to pass to BtreeOpen() */ - char *zErrMsg = 0; /* Error message from sqlite3ParseUri() */ - - *ppDb = 0; -#ifndef SQLITE_OMIT_AUTOINIT - rc = sqlite3_initialize(); - if( rc ) return rc; -#endif - - /* Only allow sensible combinations of bits in the flags argument. - ** Throw an error if any non-sense combination is used. If we - ** do not block illegal combinations here, it could trigger - ** assert() statements in deeper layers. Sensible combinations - ** are: - ** - ** 1: SQLITE_OPEN_READONLY - ** 2: SQLITE_OPEN_READWRITE - ** 6: SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE - */ - assert( SQLITE_OPEN_READONLY == 0x01 ); - assert( SQLITE_OPEN_READWRITE == 0x02 ); - assert( SQLITE_OPEN_CREATE == 0x04 ); - testcase( (1<<(flags&7))==0x02 ); /* READONLY */ - testcase( (1<<(flags&7))==0x04 ); /* READWRITE */ - testcase( (1<<(flags&7))==0x40 ); /* READWRITE | CREATE */ - if( ((1<<(flags&7)) & 0x46)==0 ) return SQLITE_MISUSE_BKPT; - - if( sqlite3GlobalConfig.bCoreMutex==0 ){ - isThreadsafe = 0; - }else if( flags & SQLITE_OPEN_NOMUTEX ){ - isThreadsafe = 0; - }else if( flags & SQLITE_OPEN_FULLMUTEX ){ - isThreadsafe = 1; - }else{ - isThreadsafe = sqlite3GlobalConfig.bFullMutex; - } - if( flags & SQLITE_OPEN_PRIVATECACHE ){ - flags &= ~SQLITE_OPEN_SHAREDCACHE; - }else if( sqlite3GlobalConfig.sharedCacheEnabled ){ - flags |= SQLITE_OPEN_SHAREDCACHE; - } - - /* Remove harmful bits from the flags parameter - ** - ** The SQLITE_OPEN_NOMUTEX and SQLITE_OPEN_FULLMUTEX flags were - ** dealt with in the previous code block. Besides these, the only - ** valid input flags for sqlite3_open_v2() are SQLITE_OPEN_READONLY, - ** SQLITE_OPEN_READWRITE, SQLITE_OPEN_CREATE, SQLITE_OPEN_SHAREDCACHE, - ** SQLITE_OPEN_PRIVATECACHE, and some reserved bits. Silently mask - ** off all other flags. - */ - flags &= ~( SQLITE_OPEN_DELETEONCLOSE | - SQLITE_OPEN_EXCLUSIVE | - SQLITE_OPEN_MAIN_DB | - SQLITE_OPEN_TEMP_DB | - SQLITE_OPEN_TRANSIENT_DB | - SQLITE_OPEN_MAIN_JOURNAL | - SQLITE_OPEN_TEMP_JOURNAL | - SQLITE_OPEN_SUBJOURNAL | - SQLITE_OPEN_MASTER_JOURNAL | - SQLITE_OPEN_NOMUTEX | - SQLITE_OPEN_FULLMUTEX | - SQLITE_OPEN_WAL - ); - - /* Allocate the sqlite data structure */ - db = sqlite3MallocZero( sizeof(sqlite3) ); - if( db==0 ) goto opendb_out; - if( isThreadsafe ){ - db->mutex = sqlite3MutexAlloc(SQLITE_MUTEX_RECURSIVE); - if( db->mutex==0 ){ - sqlite3_free(db); - db = 0; - goto opendb_out; - } - } - sqlite3_mutex_enter(db->mutex); - db->errMask = 0xff; - db->nDb = 2; - db->magic = SQLITE_MAGIC_BUSY; - db->aDb = db->aDbStatic; - - assert( sizeof(db->aLimit)==sizeof(aHardLimit) ); - memcpy(db->aLimit, aHardLimit, sizeof(db->aLimit)); - db->autoCommit = 1; - db->nextAutovac = -1; - db->szMmap = sqlite3GlobalConfig.szMmap; - db->nextPagesize = 0; - db->flags |= SQLITE_ShortColNames | SQLITE_EnableTrigger | SQLITE_CacheSpill -#if !defined(SQLITE_DEFAULT_AUTOMATIC_INDEX) || SQLITE_DEFAULT_AUTOMATIC_INDEX - | SQLITE_AutoIndex -#endif -#if SQLITE_DEFAULT_FILE_FORMAT<4 - | SQLITE_LegacyFileFmt -#endif -#ifdef SQLITE_ENABLE_LOAD_EXTENSION - | SQLITE_LoadExtension -#endif -#if SQLITE_DEFAULT_RECURSIVE_TRIGGERS - | SQLITE_RecTriggers -#endif -#if defined(SQLITE_DEFAULT_FOREIGN_KEYS) && SQLITE_DEFAULT_FOREIGN_KEYS - | SQLITE_ForeignKeys -#endif - ; - sqlite3HashInit(&db->aCollSeq); -#ifndef SQLITE_OMIT_VIRTUALTABLE - sqlite3HashInit(&db->aModule); -#endif - - /* Add the default collation sequence BINARY. BINARY works for both UTF-8 - ** and UTF-16, so add a version for each to avoid any unnecessary - ** conversions. The only error that can occur here is a malloc() failure. - */ - createCollation(db, "BINARY", SQLITE_UTF8, 0, binCollFunc, 0); - createCollation(db, "BINARY", SQLITE_UTF16BE, 0, binCollFunc, 0); - createCollation(db, "BINARY", SQLITE_UTF16LE, 0, binCollFunc, 0); - createCollation(db, "RTRIM", SQLITE_UTF8, (void*)1, binCollFunc, 0); - if( db->mallocFailed ){ - goto opendb_out; - } - db->pDfltColl = sqlite3FindCollSeq(db, SQLITE_UTF8, "BINARY", 0); - assert( db->pDfltColl!=0 ); - - /* Also add a UTF-8 case-insensitive collation sequence. */ - createCollation(db, "NOCASE", SQLITE_UTF8, 0, nocaseCollatingFunc, 0); - - /* Parse the filename/URI argument. */ - db->openFlags = flags; - rc = sqlite3ParseUri(zVfs, zFilename, &flags, &db->pVfs, &zOpen, &zErrMsg); - if( rc!=SQLITE_OK ){ - if( rc==SQLITE_NOMEM ) db->mallocFailed = 1; - sqlite3Error(db, rc, zErrMsg ? "%s" : 0, zErrMsg); - sqlite3_free(zErrMsg); - goto opendb_out; - } - - /* Open the backend database driver */ - rc = sqlite3BtreeOpen(db->pVfs, zOpen, db, &db->aDb[0].pBt, 0, - flags | SQLITE_OPEN_MAIN_DB); - if( rc!=SQLITE_OK ){ - if( rc==SQLITE_IOERR_NOMEM ){ - rc = SQLITE_NOMEM; - } - sqlite3Error(db, rc, 0); - goto opendb_out; - } - db->aDb[0].pSchema = sqlite3SchemaGet(db, db->aDb[0].pBt); - db->aDb[1].pSchema = sqlite3SchemaGet(db, 0); - - - /* The default safety_level for the main database is 'full'; for the temp - ** database it is 'NONE'. This matches the pager layer defaults. - */ - db->aDb[0].zName = "main"; - db->aDb[0].safety_level = 3; - db->aDb[1].zName = "temp"; - db->aDb[1].safety_level = 1; - - db->magic = SQLITE_MAGIC_OPEN; - if( db->mallocFailed ){ - goto opendb_out; - } - - /* Register all built-in functions, but do not attempt to read the - ** database schema yet. This is delayed until the first time the database - ** is accessed. - */ - sqlite3Error(db, SQLITE_OK, 0); - sqlite3RegisterBuiltinFunctions(db); - - /* Load automatic extensions - extensions that have been registered - ** using the sqlite3_automatic_extension() API. - */ - rc = sqlite3_errcode(db); - if( rc==SQLITE_OK ){ - sqlite3AutoLoadExtensions(db); - rc = sqlite3_errcode(db); - if( rc!=SQLITE_OK ){ - goto opendb_out; - } - } - -#ifdef SQLITE_ENABLE_FTS1 - if( !db->mallocFailed ){ - extern int sqlite3Fts1Init(sqlite3*); - rc = sqlite3Fts1Init(db); - } -#endif - -#ifdef SQLITE_ENABLE_FTS2 - if( !db->mallocFailed && rc==SQLITE_OK ){ - extern int sqlite3Fts2Init(sqlite3*); - rc = sqlite3Fts2Init(db); - } -#endif - -#ifdef SQLITE_ENABLE_FTS3 - if( !db->mallocFailed && rc==SQLITE_OK ){ - rc = sqlite3Fts3Init(db); - } -#endif - -#ifdef SQLITE_ENABLE_ICU - if( !db->mallocFailed && rc==SQLITE_OK ){ - rc = sqlite3IcuInit(db); - } -#endif - -#ifdef SQLITE_ENABLE_RTREE - if( !db->mallocFailed && rc==SQLITE_OK){ - rc = sqlite3RtreeInit(db); - } -#endif - - /* -DSQLITE_DEFAULT_LOCKING_MODE=1 makes EXCLUSIVE the default locking - ** mode. -DSQLITE_DEFAULT_LOCKING_MODE=0 make NORMAL the default locking - ** mode. Doing nothing at all also makes NORMAL the default. - */ -#ifdef SQLITE_DEFAULT_LOCKING_MODE - db->dfltLockMode = SQLITE_DEFAULT_LOCKING_MODE; - sqlite3PagerLockingMode(sqlite3BtreePager(db->aDb[0].pBt), - SQLITE_DEFAULT_LOCKING_MODE); -#endif - - if( rc ) sqlite3Error(db, rc, 0); - - /* Enable the lookaside-malloc subsystem */ - setupLookaside(db, 0, sqlite3GlobalConfig.szLookaside, - sqlite3GlobalConfig.nLookaside); - - sqlite3_wal_autocheckpoint(db, SQLITE_DEFAULT_WAL_AUTOCHECKPOINT); - -opendb_out: - sqlite3_free(zOpen); - if( db ){ - assert( db->mutex!=0 || isThreadsafe==0 || sqlite3GlobalConfig.bFullMutex==0 ); - sqlite3_mutex_leave(db->mutex); - } - rc = sqlite3_errcode(db); - assert( db!=0 || rc==SQLITE_NOMEM ); - if( rc==SQLITE_NOMEM ){ - sqlite3_close(db); - db = 0; - }else if( rc!=SQLITE_OK ){ - db->magic = SQLITE_MAGIC_SICK; - } - *ppDb = db; -#ifdef SQLITE_ENABLE_SQLLOG - if( sqlite3GlobalConfig.xSqllog ){ - /* Opening a db handle. Fourth parameter is passed 0. */ - void *pArg = sqlite3GlobalConfig.pSqllogArg; - sqlite3GlobalConfig.xSqllog(pArg, db, zFilename, 0); - } -#endif - return sqlite3ApiExit(0, rc); -} - -/* -** Open a new database handle. -*/ -SQLITE_API int sqlite3_open( - const char *zFilename, - sqlite3 **ppDb -){ - return openDatabase(zFilename, ppDb, - SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); -} -SQLITE_API int sqlite3_open_v2( - const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb, /* OUT: SQLite db handle */ - int flags, /* Flags */ - const char *zVfs /* Name of VFS module to use */ -){ - return openDatabase(filename, ppDb, (unsigned int)flags, zVfs); -} - -#ifndef SQLITE_OMIT_UTF16 -/* -** Open a new database handle. -*/ -SQLITE_API int sqlite3_open16( - const void *zFilename, - sqlite3 **ppDb -){ - char const *zFilename8; /* zFilename encoded in UTF-8 instead of UTF-16 */ - sqlite3_value *pVal; - int rc; - - assert( zFilename ); - assert( ppDb ); - *ppDb = 0; -#ifndef SQLITE_OMIT_AUTOINIT - rc = sqlite3_initialize(); - if( rc ) return rc; -#endif - pVal = sqlite3ValueNew(0); - sqlite3ValueSetStr(pVal, -1, zFilename, SQLITE_UTF16NATIVE, SQLITE_STATIC); - zFilename8 = sqlite3ValueText(pVal, SQLITE_UTF8); - if( zFilename8 ){ - rc = openDatabase(zFilename8, ppDb, - SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE, 0); - assert( *ppDb || rc==SQLITE_NOMEM ); - if( rc==SQLITE_OK && !DbHasProperty(*ppDb, 0, DB_SchemaLoaded) ){ - ENC(*ppDb) = SQLITE_UTF16NATIVE; - } - }else{ - rc = SQLITE_NOMEM; - } - sqlite3ValueFree(pVal); - - return sqlite3ApiExit(0, rc); -} -#endif /* SQLITE_OMIT_UTF16 */ - -/* -** Register a new collation sequence with the database handle db. -*/ -SQLITE_API int sqlite3_create_collation( - sqlite3* db, - const char *zName, - int enc, - void* pCtx, - int(*xCompare)(void*,int,const void*,int,const void*) -){ - int rc; - sqlite3_mutex_enter(db->mutex); - assert( !db->mallocFailed ); - rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, 0); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/* -** Register a new collation sequence with the database handle db. -*/ -SQLITE_API int sqlite3_create_collation_v2( - sqlite3* db, - const char *zName, - int enc, - void* pCtx, - int(*xCompare)(void*,int,const void*,int,const void*), - void(*xDel)(void*) -){ - int rc; - sqlite3_mutex_enter(db->mutex); - assert( !db->mallocFailed ); - rc = createCollation(db, zName, (u8)enc, pCtx, xCompare, xDel); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -#ifndef SQLITE_OMIT_UTF16 -/* -** Register a new collation sequence with the database handle db. -*/ -SQLITE_API int sqlite3_create_collation16( - sqlite3* db, - const void *zName, - int enc, - void* pCtx, - int(*xCompare)(void*,int,const void*,int,const void*) -){ - int rc = SQLITE_OK; - char *zName8; - sqlite3_mutex_enter(db->mutex); - assert( !db->mallocFailed ); - zName8 = sqlite3Utf16to8(db, zName, -1, SQLITE_UTF16NATIVE); - if( zName8 ){ - rc = createCollation(db, zName8, (u8)enc, pCtx, xCompare, 0); - sqlite3DbFree(db, zName8); - } - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} -#endif /* SQLITE_OMIT_UTF16 */ - -/* -** Register a collation sequence factory callback with the database handle -** db. Replace any previously installed collation sequence factory. -*/ -SQLITE_API int sqlite3_collation_needed( - sqlite3 *db, - void *pCollNeededArg, - void(*xCollNeeded)(void*,sqlite3*,int eTextRep,const char*) -){ - sqlite3_mutex_enter(db->mutex); - db->xCollNeeded = xCollNeeded; - db->xCollNeeded16 = 0; - db->pCollNeededArg = pCollNeededArg; - sqlite3_mutex_leave(db->mutex); - return SQLITE_OK; -} - -#ifndef SQLITE_OMIT_UTF16 -/* -** Register a collation sequence factory callback with the database handle -** db. Replace any previously installed collation sequence factory. -*/ -SQLITE_API int sqlite3_collation_needed16( - sqlite3 *db, - void *pCollNeededArg, - void(*xCollNeeded16)(void*,sqlite3*,int eTextRep,const void*) -){ - sqlite3_mutex_enter(db->mutex); - db->xCollNeeded = 0; - db->xCollNeeded16 = xCollNeeded16; - db->pCollNeededArg = pCollNeededArg; - sqlite3_mutex_leave(db->mutex); - return SQLITE_OK; -} -#endif /* SQLITE_OMIT_UTF16 */ - -#ifndef SQLITE_OMIT_DEPRECATED -/* -** This function is now an anachronism. It used to be used to recover from a -** malloc() failure, but SQLite now does this automatically. -*/ -SQLITE_API int sqlite3_global_recover(void){ - return SQLITE_OK; -} -#endif - -/* -** Test to see whether or not the database connection is in autocommit -** mode. Return TRUE if it is and FALSE if not. Autocommit mode is on -** by default. Autocommit is disabled by a BEGIN statement and reenabled -** by the next COMMIT or ROLLBACK. -*/ -SQLITE_API int sqlite3_get_autocommit(sqlite3 *db){ - return db->autoCommit; -} - -/* -** The following routines are subtitutes for constants SQLITE_CORRUPT, -** SQLITE_MISUSE, SQLITE_CANTOPEN, SQLITE_IOERR and possibly other error -** constants. They server two purposes: -** -** 1. Serve as a convenient place to set a breakpoint in a debugger -** to detect when version error conditions occurs. -** -** 2. Invoke sqlite3_log() to provide the source code location where -** a low-level error is first detected. -*/ -SQLITE_PRIVATE int sqlite3CorruptError(int lineno){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_CORRUPT, - "database corruption at line %d of [%.10s]", - lineno, 20+sqlite3_sourceid()); - return SQLITE_CORRUPT; -} -SQLITE_PRIVATE int sqlite3MisuseError(int lineno){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_MISUSE, - "misuse at line %d of [%.10s]", - lineno, 20+sqlite3_sourceid()); - return SQLITE_MISUSE; -} -SQLITE_PRIVATE int sqlite3CantopenError(int lineno){ - testcase( sqlite3GlobalConfig.xLog!=0 ); - sqlite3_log(SQLITE_CANTOPEN, - "cannot open file at line %d of [%.10s]", - lineno, 20+sqlite3_sourceid()); - return SQLITE_CANTOPEN; -} - - -#ifndef SQLITE_OMIT_DEPRECATED -/* -** This is a convenience routine that makes sure that all thread-specific -** data for this thread has been deallocated. -** -** SQLite no longer uses thread-specific data so this routine is now a -** no-op. It is retained for historical compatibility. -*/ -SQLITE_API void sqlite3_thread_cleanup(void){ -} -#endif - -/* -** Return meta information about a specific column of a database table. -** See comment in sqlite3.h (sqlite.h.in) for details. -*/ -#ifdef SQLITE_ENABLE_COLUMN_METADATA -SQLITE_API int sqlite3_table_column_metadata( - sqlite3 *db, /* Connection handle */ - const char *zDbName, /* Database name or NULL */ - const char *zTableName, /* Table name */ - const char *zColumnName, /* Column name */ - char const **pzDataType, /* OUTPUT: Declared data type */ - char const **pzCollSeq, /* OUTPUT: Collation sequence name */ - int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ - int *pPrimaryKey, /* OUTPUT: True if column part of PK */ - int *pAutoinc /* OUTPUT: True if column is auto-increment */ -){ - int rc; - char *zErrMsg = 0; - Table *pTab = 0; - Column *pCol = 0; - int iCol; - - char const *zDataType = 0; - char const *zCollSeq = 0; - int notnull = 0; - int primarykey = 0; - int autoinc = 0; - - /* Ensure the database schema has been loaded */ - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeEnterAll(db); - rc = sqlite3Init(db, &zErrMsg); - if( SQLITE_OK!=rc ){ - goto error_out; - } - - /* Locate the table in question */ - pTab = sqlite3FindTable(db, zTableName, zDbName); - if( !pTab || pTab->pSelect ){ - pTab = 0; - goto error_out; - } - - /* Find the column for which info is requested */ - if( sqlite3IsRowid(zColumnName) ){ - iCol = pTab->iPKey; - if( iCol>=0 ){ - pCol = &pTab->aCol[iCol]; - } - }else{ - for(iCol=0; iColnCol; iCol++){ - pCol = &pTab->aCol[iCol]; - if( 0==sqlite3StrICmp(pCol->zName, zColumnName) ){ - break; - } - } - if( iCol==pTab->nCol ){ - pTab = 0; - goto error_out; - } - } - - /* The following block stores the meta information that will be returned - ** to the caller in local variables zDataType, zCollSeq, notnull, primarykey - ** and autoinc. At this point there are two possibilities: - ** - ** 1. The specified column name was rowid", "oid" or "_rowid_" - ** and there is no explicitly declared IPK column. - ** - ** 2. The table is not a view and the column name identified an - ** explicitly declared column. Copy meta information from *pCol. - */ - if( pCol ){ - zDataType = pCol->zType; - zCollSeq = pCol->zColl; - notnull = pCol->notNull!=0; - primarykey = (pCol->colFlags & COLFLAG_PRIMKEY)!=0; - autoinc = pTab->iPKey==iCol && (pTab->tabFlags & TF_Autoincrement)!=0; - }else{ - zDataType = "INTEGER"; - primarykey = 1; - } - if( !zCollSeq ){ - zCollSeq = "BINARY"; - } - -error_out: - sqlite3BtreeLeaveAll(db); - - /* Whether the function call succeeded or failed, set the output parameters - ** to whatever their local counterparts contain. If an error did occur, - ** this has the effect of zeroing all output parameters. - */ - if( pzDataType ) *pzDataType = zDataType; - if( pzCollSeq ) *pzCollSeq = zCollSeq; - if( pNotNull ) *pNotNull = notnull; - if( pPrimaryKey ) *pPrimaryKey = primarykey; - if( pAutoinc ) *pAutoinc = autoinc; - - if( SQLITE_OK==rc && !pTab ){ - sqlite3DbFree(db, zErrMsg); - zErrMsg = sqlite3MPrintf(db, "no such table column: %s.%s", zTableName, - zColumnName); - rc = SQLITE_ERROR; - } - sqlite3Error(db, rc, (zErrMsg?"%s":0), zErrMsg); - sqlite3DbFree(db, zErrMsg); - rc = sqlite3ApiExit(db, rc); - sqlite3_mutex_leave(db->mutex); - return rc; -} -#endif - -/* -** Sleep for a little while. Return the amount of time slept. -*/ -SQLITE_API int sqlite3_sleep(int ms){ - sqlite3_vfs *pVfs; - int rc; - pVfs = sqlite3_vfs_find(0); - if( pVfs==0 ) return 0; - - /* This function works in milliseconds, but the underlying OsSleep() - ** API uses microseconds. Hence the 1000's. - */ - rc = (sqlite3OsSleep(pVfs, 1000*ms)/1000); - return rc; -} - -/* -** Enable or disable the extended result codes. -*/ -SQLITE_API int sqlite3_extended_result_codes(sqlite3 *db, int onoff){ - sqlite3_mutex_enter(db->mutex); - db->errMask = onoff ? 0xffffffff : 0xff; - sqlite3_mutex_leave(db->mutex); - return SQLITE_OK; -} - -/* -** Invoke the xFileControl method on a particular database. -*/ -SQLITE_API int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){ - int rc = SQLITE_ERROR; - Btree *pBtree; - - sqlite3_mutex_enter(db->mutex); - pBtree = sqlite3DbNameToBtree(db, zDbName); - if( pBtree ){ - Pager *pPager; - sqlite3_file *fd; - sqlite3BtreeEnter(pBtree); - pPager = sqlite3BtreePager(pBtree); - assert( pPager!=0 ); - fd = sqlite3PagerFile(pPager); - assert( fd!=0 ); - if( op==SQLITE_FCNTL_FILE_POINTER ){ - *(sqlite3_file**)pArg = fd; - rc = SQLITE_OK; - }else if( fd->pMethods ){ - rc = sqlite3OsFileControl(fd, op, pArg); - }else{ - rc = SQLITE_NOTFOUND; - } - sqlite3BtreeLeave(pBtree); - } - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/* -** Interface to the testing logic. -*/ -SQLITE_API int sqlite3_test_control(int op, ...){ - int rc = 0; -#ifndef SQLITE_OMIT_BUILTIN_TEST - va_list ap; - va_start(ap, op); - switch( op ){ - - /* - ** Save the current state of the PRNG. - */ - case SQLITE_TESTCTRL_PRNG_SAVE: { - sqlite3PrngSaveState(); - break; - } - - /* - ** Restore the state of the PRNG to the last state saved using - ** PRNG_SAVE. If PRNG_SAVE has never before been called, then - ** this verb acts like PRNG_RESET. - */ - case SQLITE_TESTCTRL_PRNG_RESTORE: { - sqlite3PrngRestoreState(); - break; - } - - /* - ** Reset the PRNG back to its uninitialized state. The next call - ** to sqlite3_randomness() will reseed the PRNG using a single call - ** to the xRandomness method of the default VFS. - */ - case SQLITE_TESTCTRL_PRNG_RESET: { - sqlite3_randomness(0,0); - break; - } - - /* - ** sqlite3_test_control(BITVEC_TEST, size, program) - ** - ** Run a test against a Bitvec object of size. The program argument - ** is an array of integers that defines the test. Return -1 on a - ** memory allocation error, 0 on success, or non-zero for an error. - ** See the sqlite3BitvecBuiltinTest() for additional information. - */ - case SQLITE_TESTCTRL_BITVEC_TEST: { - int sz = va_arg(ap, int); - int *aProg = va_arg(ap, int*); - rc = sqlite3BitvecBuiltinTest(sz, aProg); - break; - } - - /* - ** sqlite3_test_control(BENIGN_MALLOC_HOOKS, xBegin, xEnd) - ** - ** Register hooks to call to indicate which malloc() failures - ** are benign. - */ - case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: { - typedef void (*void_function)(void); - void_function xBenignBegin; - void_function xBenignEnd; - xBenignBegin = va_arg(ap, void_function); - xBenignEnd = va_arg(ap, void_function); - sqlite3BenignMallocHooks(xBenignBegin, xBenignEnd); - break; - } - - /* - ** sqlite3_test_control(SQLITE_TESTCTRL_PENDING_BYTE, unsigned int X) - ** - ** Set the PENDING byte to the value in the argument, if X>0. - ** Make no changes if X==0. Return the value of the pending byte - ** as it existing before this routine was called. - ** - ** IMPORTANT: Changing the PENDING byte from 0x40000000 results in - ** an incompatible database file format. Changing the PENDING byte - ** while any database connection is open results in undefined and - ** dileterious behavior. - */ - case SQLITE_TESTCTRL_PENDING_BYTE: { - rc = PENDING_BYTE; -#ifndef SQLITE_OMIT_WSD - { - unsigned int newVal = va_arg(ap, unsigned int); - if( newVal ) sqlite3PendingByte = newVal; - } -#endif - break; - } - - /* - ** sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, int X) - ** - ** This action provides a run-time test to see whether or not - ** assert() was enabled at compile-time. If X is true and assert() - ** is enabled, then the return value is true. If X is true and - ** assert() is disabled, then the return value is zero. If X is - ** false and assert() is enabled, then the assertion fires and the - ** process aborts. If X is false and assert() is disabled, then the - ** return value is zero. - */ - case SQLITE_TESTCTRL_ASSERT: { - volatile int x = 0; - assert( (x = va_arg(ap,int))!=0 ); - rc = x; - break; - } - - - /* - ** sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, int X) - ** - ** This action provides a run-time test to see how the ALWAYS and - ** NEVER macros were defined at compile-time. - ** - ** The return value is ALWAYS(X). - ** - ** The recommended test is X==2. If the return value is 2, that means - ** ALWAYS() and NEVER() are both no-op pass-through macros, which is the - ** default setting. If the return value is 1, then ALWAYS() is either - ** hard-coded to true or else it asserts if its argument is false. - ** The first behavior (hard-coded to true) is the case if - ** SQLITE_TESTCTRL_ASSERT shows that assert() is disabled and the second - ** behavior (assert if the argument to ALWAYS() is false) is the case if - ** SQLITE_TESTCTRL_ASSERT shows that assert() is enabled. - ** - ** The run-time test procedure might look something like this: - ** - ** if( sqlite3_test_control(SQLITE_TESTCTRL_ALWAYS, 2)==2 ){ - ** // ALWAYS() and NEVER() are no-op pass-through macros - ** }else if( sqlite3_test_control(SQLITE_TESTCTRL_ASSERT, 1) ){ - ** // ALWAYS(x) asserts that x is true. NEVER(x) asserts x is false. - ** }else{ - ** // ALWAYS(x) is a constant 1. NEVER(x) is a constant 0. - ** } - */ - case SQLITE_TESTCTRL_ALWAYS: { - int x = va_arg(ap,int); - rc = ALWAYS(x); - break; - } - - /* sqlite3_test_control(SQLITE_TESTCTRL_RESERVE, sqlite3 *db, int N) - ** - ** Set the nReserve size to N for the main database on the database - ** connection db. - */ - case SQLITE_TESTCTRL_RESERVE: { - sqlite3 *db = va_arg(ap, sqlite3*); - int x = va_arg(ap,int); - sqlite3_mutex_enter(db->mutex); - sqlite3BtreeSetPageSize(db->aDb[0].pBt, 0, x, 0); - sqlite3_mutex_leave(db->mutex); - break; - } - - /* sqlite3_test_control(SQLITE_TESTCTRL_OPTIMIZATIONS, sqlite3 *db, int N) - ** - ** Enable or disable various optimizations for testing purposes. The - ** argument N is a bitmask of optimizations to be disabled. For normal - ** operation N should be 0. The idea is that a test program (like the - ** SQL Logic Test or SLT test module) can run the same SQL multiple times - ** with various optimizations disabled to verify that the same answer - ** is obtained in every case. - */ - case SQLITE_TESTCTRL_OPTIMIZATIONS: { - sqlite3 *db = va_arg(ap, sqlite3*); - db->dbOptFlags = (u16)(va_arg(ap, int) & 0xffff); - break; - } - -#ifdef SQLITE_N_KEYWORD - /* sqlite3_test_control(SQLITE_TESTCTRL_ISKEYWORD, const char *zWord) - ** - ** If zWord is a keyword recognized by the parser, then return the - ** number of keywords. Or if zWord is not a keyword, return 0. - ** - ** This test feature is only available in the amalgamation since - ** the SQLITE_N_KEYWORD macro is not defined in this file if SQLite - ** is built using separate source files. - */ - case SQLITE_TESTCTRL_ISKEYWORD: { - const char *zWord = va_arg(ap, const char*); - int n = sqlite3Strlen30(zWord); - rc = (sqlite3KeywordCode((u8*)zWord, n)!=TK_ID) ? SQLITE_N_KEYWORD : 0; - break; - } -#endif - - /* sqlite3_test_control(SQLITE_TESTCTRL_SCRATCHMALLOC, sz, &pNew, pFree); - ** - ** Pass pFree into sqlite3ScratchFree(). - ** If sz>0 then allocate a scratch buffer into pNew. - */ - case SQLITE_TESTCTRL_SCRATCHMALLOC: { - void *pFree, **ppNew; - int sz; - sz = va_arg(ap, int); - ppNew = va_arg(ap, void**); - pFree = va_arg(ap, void*); - if( sz ) *ppNew = sqlite3ScratchMalloc(sz); - sqlite3ScratchFree(pFree); - break; - } - - /* sqlite3_test_control(SQLITE_TESTCTRL_LOCALTIME_FAULT, int onoff); - ** - ** If parameter onoff is non-zero, configure the wrappers so that all - ** subsequent calls to localtime() and variants fail. If onoff is zero, - ** undo this setting. - */ - case SQLITE_TESTCTRL_LOCALTIME_FAULT: { - sqlite3GlobalConfig.bLocaltimeFault = va_arg(ap, int); - break; - } - -#if defined(SQLITE_ENABLE_TREE_EXPLAIN) - /* sqlite3_test_control(SQLITE_TESTCTRL_EXPLAIN_STMT, - ** sqlite3_stmt*,const char**); - ** - ** If compiled with SQLITE_ENABLE_TREE_EXPLAIN, each sqlite3_stmt holds - ** a string that describes the optimized parse tree. This test-control - ** returns a pointer to that string. - */ - case SQLITE_TESTCTRL_EXPLAIN_STMT: { - sqlite3_stmt *pStmt = va_arg(ap, sqlite3_stmt*); - const char **pzRet = va_arg(ap, const char**); - *pzRet = sqlite3VdbeExplanation((Vdbe*)pStmt); - break; - } -#endif - - /* sqlite3_test_control(SQLITE_TESTCTRL_NEVER_CORRUPT, int); - ** - ** Set or clear a flag that indicates that the database file is always well- - ** formed and never corrupt. This flag is clear by default, indicating that - ** database files might have arbitrary corruption. Setting the flag during - ** testing causes certain assert() statements in the code to be activated - ** that demonstrat invariants on well-formed database files. - */ - case SQLITE_TESTCTRL_NEVER_CORRUPT: { - sqlite3GlobalConfig.neverCorrupt = va_arg(ap, int); - break; - } - - } - va_end(ap); -#endif /* SQLITE_OMIT_BUILTIN_TEST */ - return rc; -} - -/* -** This is a utility routine, useful to VFS implementations, that checks -** to see if a database file was a URI that contained a specific query -** parameter, and if so obtains the value of the query parameter. -** -** The zFilename argument is the filename pointer passed into the xOpen() -** method of a VFS implementation. The zParam argument is the name of the -** query parameter we seek. This routine returns the value of the zParam -** parameter if it exists. If the parameter does not exist, this routine -** returns a NULL pointer. -*/ -SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam){ - if( zFilename==0 ) return 0; - zFilename += sqlite3Strlen30(zFilename) + 1; - while( zFilename[0] ){ - int x = strcmp(zFilename, zParam); - zFilename += sqlite3Strlen30(zFilename) + 1; - if( x==0 ) return zFilename; - zFilename += sqlite3Strlen30(zFilename) + 1; - } - return 0; -} - -/* -** Return a boolean value for a query parameter. -*/ -SQLITE_API int sqlite3_uri_boolean(const char *zFilename, const char *zParam, int bDflt){ - const char *z = sqlite3_uri_parameter(zFilename, zParam); - bDflt = bDflt!=0; - return z ? sqlite3GetBoolean(z, bDflt) : bDflt; -} - -/* -** Return a 64-bit integer value for a query parameter. -*/ -SQLITE_API sqlite3_int64 sqlite3_uri_int64( - const char *zFilename, /* Filename as passed to xOpen */ - const char *zParam, /* URI parameter sought */ - sqlite3_int64 bDflt /* return if parameter is missing */ -){ - const char *z = sqlite3_uri_parameter(zFilename, zParam); - sqlite3_int64 v; - if( z && sqlite3Atoi64(z, &v, sqlite3Strlen30(z), SQLITE_UTF8)==SQLITE_OK ){ - bDflt = v; - } - return bDflt; -} - -/* -** Return the Btree pointer identified by zDbName. Return NULL if not found. -*/ -SQLITE_PRIVATE Btree *sqlite3DbNameToBtree(sqlite3 *db, const char *zDbName){ - int i; - for(i=0; inDb; i++){ - if( db->aDb[i].pBt - && (zDbName==0 || sqlite3StrICmp(zDbName, db->aDb[i].zName)==0) - ){ - return db->aDb[i].pBt; - } - } - return 0; -} - -/* -** Return the filename of the database associated with a database -** connection. -*/ -SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName){ - Btree *pBt = sqlite3DbNameToBtree(db, zDbName); - return pBt ? sqlite3BtreeGetFilename(pBt) : 0; -} - -/* -** Return 1 if database is read-only or 0 if read/write. Return -1 if -** no such database exists. -*/ -SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName){ - Btree *pBt = sqlite3DbNameToBtree(db, zDbName); - return pBt ? sqlite3PagerIsreadonly(sqlite3BtreePager(pBt)) : -1; -} - -/************** End of main.c ************************************************/ -/************** Begin file notify.c ******************************************/ -/* -** 2009 March 3 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** -** This file contains the implementation of the sqlite3_unlock_notify() -** API method and its associated functionality. -*/ - -/* Omit this entire file if SQLITE_ENABLE_UNLOCK_NOTIFY is not defined. */ -#ifdef SQLITE_ENABLE_UNLOCK_NOTIFY - -/* -** Public interfaces: -** -** sqlite3ConnectionBlocked() -** sqlite3ConnectionUnlocked() -** sqlite3ConnectionClosed() -** sqlite3_unlock_notify() -*/ - -#define assertMutexHeld() \ - assert( sqlite3_mutex_held(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)) ) - -/* -** Head of a linked list of all sqlite3 objects created by this process -** for which either sqlite3.pBlockingConnection or sqlite3.pUnlockConnection -** is not NULL. This variable may only accessed while the STATIC_MASTER -** mutex is held. -*/ -static sqlite3 *SQLITE_WSD sqlite3BlockedList = 0; - -#ifndef NDEBUG -/* -** This function is a complex assert() that verifies the following -** properties of the blocked connections list: -** -** 1) Each entry in the list has a non-NULL value for either -** pUnlockConnection or pBlockingConnection, or both. -** -** 2) All entries in the list that share a common value for -** xUnlockNotify are grouped together. -** -** 3) If the argument db is not NULL, then none of the entries in the -** blocked connections list have pUnlockConnection or pBlockingConnection -** set to db. This is used when closing connection db. -*/ -static void checkListProperties(sqlite3 *db){ - sqlite3 *p; - for(p=sqlite3BlockedList; p; p=p->pNextBlocked){ - int seen = 0; - sqlite3 *p2; - - /* Verify property (1) */ - assert( p->pUnlockConnection || p->pBlockingConnection ); - - /* Verify property (2) */ - for(p2=sqlite3BlockedList; p2!=p; p2=p2->pNextBlocked){ - if( p2->xUnlockNotify==p->xUnlockNotify ) seen = 1; - assert( p2->xUnlockNotify==p->xUnlockNotify || !seen ); - assert( db==0 || p->pUnlockConnection!=db ); - assert( db==0 || p->pBlockingConnection!=db ); - } - } -} -#else -# define checkListProperties(x) -#endif - -/* -** Remove connection db from the blocked connections list. If connection -** db is not currently a part of the list, this function is a no-op. -*/ -static void removeFromBlockedList(sqlite3 *db){ - sqlite3 **pp; - assertMutexHeld(); - for(pp=&sqlite3BlockedList; *pp; pp = &(*pp)->pNextBlocked){ - if( *pp==db ){ - *pp = (*pp)->pNextBlocked; - break; - } - } -} - -/* -** Add connection db to the blocked connections list. It is assumed -** that it is not already a part of the list. -*/ -static void addToBlockedList(sqlite3 *db){ - sqlite3 **pp; - assertMutexHeld(); - for( - pp=&sqlite3BlockedList; - *pp && (*pp)->xUnlockNotify!=db->xUnlockNotify; - pp=&(*pp)->pNextBlocked - ); - db->pNextBlocked = *pp; - *pp = db; -} - -/* -** Obtain the STATIC_MASTER mutex. -*/ -static void enterMutex(void){ - sqlite3_mutex_enter(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); - checkListProperties(0); -} - -/* -** Release the STATIC_MASTER mutex. -*/ -static void leaveMutex(void){ - assertMutexHeld(); - checkListProperties(0); - sqlite3_mutex_leave(sqlite3MutexAlloc(SQLITE_MUTEX_STATIC_MASTER)); -} - -/* -** Register an unlock-notify callback. -** -** This is called after connection "db" has attempted some operation -** but has received an SQLITE_LOCKED error because another connection -** (call it pOther) in the same process was busy using the same shared -** cache. pOther is found by looking at db->pBlockingConnection. -** -** If there is no blocking connection, the callback is invoked immediately, -** before this routine returns. -** -** If pOther is already blocked on db, then report SQLITE_LOCKED, to indicate -** a deadlock. -** -** Otherwise, make arrangements to invoke xNotify when pOther drops -** its locks. -** -** Each call to this routine overrides any prior callbacks registered -** on the same "db". If xNotify==0 then any prior callbacks are immediately -** cancelled. -*/ -SQLITE_API int sqlite3_unlock_notify( - sqlite3 *db, - void (*xNotify)(void **, int), - void *pArg -){ - int rc = SQLITE_OK; - - sqlite3_mutex_enter(db->mutex); - enterMutex(); - - if( xNotify==0 ){ - removeFromBlockedList(db); - db->pBlockingConnection = 0; - db->pUnlockConnection = 0; - db->xUnlockNotify = 0; - db->pUnlockArg = 0; - }else if( 0==db->pBlockingConnection ){ - /* The blocking transaction has been concluded. Or there never was a - ** blocking transaction. In either case, invoke the notify callback - ** immediately. - */ - xNotify(&pArg, 1); - }else{ - sqlite3 *p; - - for(p=db->pBlockingConnection; p && p!=db; p=p->pUnlockConnection){} - if( p ){ - rc = SQLITE_LOCKED; /* Deadlock detected. */ - }else{ - db->pUnlockConnection = db->pBlockingConnection; - db->xUnlockNotify = xNotify; - db->pUnlockArg = pArg; - removeFromBlockedList(db); - addToBlockedList(db); - } - } - - leaveMutex(); - assert( !db->mallocFailed ); - sqlite3Error(db, rc, (rc?"database is deadlocked":0)); - sqlite3_mutex_leave(db->mutex); - return rc; -} - -/* -** This function is called while stepping or preparing a statement -** associated with connection db. The operation will return SQLITE_LOCKED -** to the user because it requires a lock that will not be available -** until connection pBlocker concludes its current transaction. -*/ -SQLITE_PRIVATE void sqlite3ConnectionBlocked(sqlite3 *db, sqlite3 *pBlocker){ - enterMutex(); - if( db->pBlockingConnection==0 && db->pUnlockConnection==0 ){ - addToBlockedList(db); - } - db->pBlockingConnection = pBlocker; - leaveMutex(); -} - -/* -** This function is called when -** the transaction opened by database db has just finished. Locks held -** by database connection db have been released. -** -** This function loops through each entry in the blocked connections -** list and does the following: -** -** 1) If the sqlite3.pBlockingConnection member of a list entry is -** set to db, then set pBlockingConnection=0. -** -** 2) If the sqlite3.pUnlockConnection member of a list entry is -** set to db, then invoke the configured unlock-notify callback and -** set pUnlockConnection=0. -** -** 3) If the two steps above mean that pBlockingConnection==0 and -** pUnlockConnection==0, remove the entry from the blocked connections -** list. -*/ -SQLITE_PRIVATE void sqlite3ConnectionUnlocked(sqlite3 *db){ - void (*xUnlockNotify)(void **, int) = 0; /* Unlock-notify cb to invoke */ - int nArg = 0; /* Number of entries in aArg[] */ - sqlite3 **pp; /* Iterator variable */ - void **aArg; /* Arguments to the unlock callback */ - void **aDyn = 0; /* Dynamically allocated space for aArg[] */ - void *aStatic[16]; /* Starter space for aArg[]. No malloc required */ - - aArg = aStatic; - enterMutex(); /* Enter STATIC_MASTER mutex */ - - /* This loop runs once for each entry in the blocked-connections list. */ - for(pp=&sqlite3BlockedList; *pp; /* no-op */ ){ - sqlite3 *p = *pp; - - /* Step 1. */ - if( p->pBlockingConnection==db ){ - p->pBlockingConnection = 0; - } - - /* Step 2. */ - if( p->pUnlockConnection==db ){ - assert( p->xUnlockNotify ); - if( p->xUnlockNotify!=xUnlockNotify && nArg!=0 ){ - xUnlockNotify(aArg, nArg); - nArg = 0; - } - - sqlite3BeginBenignMalloc(); - assert( aArg==aDyn || (aDyn==0 && aArg==aStatic) ); - assert( nArg<=(int)ArraySize(aStatic) || aArg==aDyn ); - if( (!aDyn && nArg==(int)ArraySize(aStatic)) - || (aDyn && nArg==(int)(sqlite3MallocSize(aDyn)/sizeof(void*))) - ){ - /* The aArg[] array needs to grow. */ - void **pNew = (void **)sqlite3Malloc(nArg*sizeof(void *)*2); - if( pNew ){ - memcpy(pNew, aArg, nArg*sizeof(void *)); - sqlite3_free(aDyn); - aDyn = aArg = pNew; - }else{ - /* This occurs when the array of context pointers that need to - ** be passed to the unlock-notify callback is larger than the - ** aStatic[] array allocated on the stack and the attempt to - ** allocate a larger array from the heap has failed. - ** - ** This is a difficult situation to handle. Returning an error - ** code to the caller is insufficient, as even if an error code - ** is returned the transaction on connection db will still be - ** closed and the unlock-notify callbacks on blocked connections - ** will go unissued. This might cause the application to wait - ** indefinitely for an unlock-notify callback that will never - ** arrive. - ** - ** Instead, invoke the unlock-notify callback with the context - ** array already accumulated. We can then clear the array and - ** begin accumulating any further context pointers without - ** requiring any dynamic allocation. This is sub-optimal because - ** it means that instead of one callback with a large array of - ** context pointers the application will receive two or more - ** callbacks with smaller arrays of context pointers, which will - ** reduce the applications ability to prioritize multiple - ** connections. But it is the best that can be done under the - ** circumstances. - */ - xUnlockNotify(aArg, nArg); - nArg = 0; - } - } - sqlite3EndBenignMalloc(); - - aArg[nArg++] = p->pUnlockArg; - xUnlockNotify = p->xUnlockNotify; - p->pUnlockConnection = 0; - p->xUnlockNotify = 0; - p->pUnlockArg = 0; - } - - /* Step 3. */ - if( p->pBlockingConnection==0 && p->pUnlockConnection==0 ){ - /* Remove connection p from the blocked connections list. */ - *pp = p->pNextBlocked; - p->pNextBlocked = 0; - }else{ - pp = &p->pNextBlocked; - } - } - - if( nArg!=0 ){ - xUnlockNotify(aArg, nArg); - } - sqlite3_free(aDyn); - leaveMutex(); /* Leave STATIC_MASTER mutex */ -} - -/* -** This is called when the database connection passed as an argument is -** being closed. The connection is removed from the blocked list. -*/ -SQLITE_PRIVATE void sqlite3ConnectionClosed(sqlite3 *db){ - sqlite3ConnectionUnlocked(db); - enterMutex(); - removeFromBlockedList(db); - checkListProperties(db); - leaveMutex(); -} -#endif - -/************** End of notify.c **********************************************/ -/************** Begin file fts3.c ********************************************/ -/* -** 2006 Oct 10 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This is an SQLite module implementing full-text search. -*/ - -/* -** The code in this file is only compiled if: -** -** * The FTS3 module is being built as an extension -** (in which case SQLITE_CORE is not defined), or -** -** * The FTS3 module is being built into the core of -** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). -*/ - -/* The full-text index is stored in a series of b+tree (-like) -** structures called segments which map terms to doclists. The -** structures are like b+trees in layout, but are constructed from the -** bottom up in optimal fashion and are not updatable. Since trees -** are built from the bottom up, things will be described from the -** bottom up. -** -** -**** Varints **** -** The basic unit of encoding is a variable-length integer called a -** varint. We encode variable-length integers in little-endian order -** using seven bits * per byte as follows: -** -** KEY: -** A = 0xxxxxxx 7 bits of data and one flag bit -** B = 1xxxxxxx 7 bits of data and one flag bit -** -** 7 bits - A -** 14 bits - BA -** 21 bits - BBA -** and so on. -** -** This is similar in concept to how sqlite encodes "varints" but -** the encoding is not the same. SQLite varints are big-endian -** are are limited to 9 bytes in length whereas FTS3 varints are -** little-endian and can be up to 10 bytes in length (in theory). -** -** Example encodings: -** -** 1: 0x01 -** 127: 0x7f -** 128: 0x81 0x00 -** -** -**** Document lists **** -** A doclist (document list) holds a docid-sorted list of hits for a -** given term. Doclists hold docids and associated token positions. -** A docid is the unique integer identifier for a single document. -** A position is the index of a word within the document. The first -** word of the document has a position of 0. -** -** FTS3 used to optionally store character offsets using a compile-time -** option. But that functionality is no longer supported. -** -** A doclist is stored like this: -** -** array { -** varint docid; (delta from previous doclist) -** array { (position list for column 0) -** varint position; (2 more than the delta from previous position) -** } -** array { -** varint POS_COLUMN; (marks start of position list for new column) -** varint column; (index of new column) -** array { -** varint position; (2 more than the delta from previous position) -** } -** } -** varint POS_END; (marks end of positions for this document. -** } -** -** Here, array { X } means zero or more occurrences of X, adjacent in -** memory. A "position" is an index of a token in the token stream -** generated by the tokenizer. Note that POS_END and POS_COLUMN occur -** in the same logical place as the position element, and act as sentinals -** ending a position list array. POS_END is 0. POS_COLUMN is 1. -** The positions numbers are not stored literally but rather as two more -** than the difference from the prior position, or the just the position plus -** 2 for the first position. Example: -** -** label: A B C D E F G H I J K -** value: 123 5 9 1 1 14 35 0 234 72 0 -** -** The 123 value is the first docid. For column zero in this document -** there are two matches at positions 3 and 10 (5-2 and 9-2+3). The 1 -** at D signals the start of a new column; the 1 at E indicates that the -** new column is column number 1. There are two positions at 12 and 45 -** (14-2 and 35-2+12). The 0 at H indicate the end-of-document. The -** 234 at I is the delta to next docid (357). It has one position 70 -** (72-2) and then terminates with the 0 at K. -** -** A "position-list" is the list of positions for multiple columns for -** a single docid. A "column-list" is the set of positions for a single -** column. Hence, a position-list consists of one or more column-lists, -** a document record consists of a docid followed by a position-list and -** a doclist consists of one or more document records. -** -** A bare doclist omits the position information, becoming an -** array of varint-encoded docids. -** -**** Segment leaf nodes **** -** Segment leaf nodes store terms and doclists, ordered by term. Leaf -** nodes are written using LeafWriter, and read using LeafReader (to -** iterate through a single leaf node's data) and LeavesReader (to -** iterate through a segment's entire leaf layer). Leaf nodes have -** the format: -** -** varint iHeight; (height from leaf level, always 0) -** varint nTerm; (length of first term) -** char pTerm[nTerm]; (content of first term) -** varint nDoclist; (length of term's associated doclist) -** char pDoclist[nDoclist]; (content of doclist) -** array { -** (further terms are delta-encoded) -** varint nPrefix; (length of prefix shared with previous term) -** varint nSuffix; (length of unshared suffix) -** char pTermSuffix[nSuffix];(unshared suffix of next term) -** varint nDoclist; (length of term's associated doclist) -** char pDoclist[nDoclist]; (content of doclist) -** } -** -** Here, array { X } means zero or more occurrences of X, adjacent in -** memory. -** -** Leaf nodes are broken into blocks which are stored contiguously in -** the %_segments table in sorted order. This means that when the end -** of a node is reached, the next term is in the node with the next -** greater node id. -** -** New data is spilled to a new leaf node when the current node -** exceeds LEAF_MAX bytes (default 2048). New data which itself is -** larger than STANDALONE_MIN (default 1024) is placed in a standalone -** node (a leaf node with a single term and doclist). The goal of -** these settings is to pack together groups of small doclists while -** making it efficient to directly access large doclists. The -** assumption is that large doclists represent terms which are more -** likely to be query targets. -** -** TODO(shess) It may be useful for blocking decisions to be more -** dynamic. For instance, it may make more sense to have a 2.5k leaf -** node rather than splitting into 2k and .5k nodes. My intuition is -** that this might extend through 2x or 4x the pagesize. -** -** -**** Segment interior nodes **** -** Segment interior nodes store blockids for subtree nodes and terms -** to describe what data is stored by the each subtree. Interior -** nodes are written using InteriorWriter, and read using -** InteriorReader. InteriorWriters are created as needed when -** SegmentWriter creates new leaf nodes, or when an interior node -** itself grows too big and must be split. The format of interior -** nodes: -** -** varint iHeight; (height from leaf level, always >0) -** varint iBlockid; (block id of node's leftmost subtree) -** optional { -** varint nTerm; (length of first term) -** char pTerm[nTerm]; (content of first term) -** array { -** (further terms are delta-encoded) -** varint nPrefix; (length of shared prefix with previous term) -** varint nSuffix; (length of unshared suffix) -** char pTermSuffix[nSuffix]; (unshared suffix of next term) -** } -** } -** -** Here, optional { X } means an optional element, while array { X } -** means zero or more occurrences of X, adjacent in memory. -** -** An interior node encodes n terms separating n+1 subtrees. The -** subtree blocks are contiguous, so only the first subtree's blockid -** is encoded. The subtree at iBlockid will contain all terms less -** than the first term encoded (or all terms if no term is encoded). -** Otherwise, for terms greater than or equal to pTerm[i] but less -** than pTerm[i+1], the subtree for that term will be rooted at -** iBlockid+i. Interior nodes only store enough term data to -** distinguish adjacent children (if the rightmost term of the left -** child is "something", and the leftmost term of the right child is -** "wicked", only "w" is stored). -** -** New data is spilled to a new interior node at the same height when -** the current node exceeds INTERIOR_MAX bytes (default 2048). -** INTERIOR_MIN_TERMS (default 7) keeps large terms from monopolizing -** interior nodes and making the tree too skinny. The interior nodes -** at a given height are naturally tracked by interior nodes at -** height+1, and so on. -** -** -**** Segment directory **** -** The segment directory in table %_segdir stores meta-information for -** merging and deleting segments, and also the root node of the -** segment's tree. -** -** The root node is the top node of the segment's tree after encoding -** the entire segment, restricted to ROOT_MAX bytes (default 1024). -** This could be either a leaf node or an interior node. If the top -** node requires more than ROOT_MAX bytes, it is flushed to %_segments -** and a new root interior node is generated (which should always fit -** within ROOT_MAX because it only needs space for 2 varints, the -** height and the blockid of the previous root). -** -** The meta-information in the segment directory is: -** level - segment level (see below) -** idx - index within level -** - (level,idx uniquely identify a segment) -** start_block - first leaf node -** leaves_end_block - last leaf node -** end_block - last block (including interior nodes) -** root - contents of root node -** -** If the root node is a leaf node, then start_block, -** leaves_end_block, and end_block are all 0. -** -** -**** Segment merging **** -** To amortize update costs, segments are grouped into levels and -** merged in batches. Each increase in level represents exponentially -** more documents. -** -** New documents (actually, document updates) are tokenized and -** written individually (using LeafWriter) to a level 0 segment, with -** incrementing idx. When idx reaches MERGE_COUNT (default 16), all -** level 0 segments are merged into a single level 1 segment. Level 1 -** is populated like level 0, and eventually MERGE_COUNT level 1 -** segments are merged to a single level 2 segment (representing -** MERGE_COUNT^2 updates), and so on. -** -** A segment merge traverses all segments at a given level in -** parallel, performing a straightforward sorted merge. Since segment -** leaf nodes are written in to the %_segments table in order, this -** merge traverses the underlying sqlite disk structures efficiently. -** After the merge, all segment blocks from the merged level are -** deleted. -** -** MERGE_COUNT controls how often we merge segments. 16 seems to be -** somewhat of a sweet spot for insertion performance. 32 and 64 show -** very similar performance numbers to 16 on insertion, though they're -** a tiny bit slower (perhaps due to more overhead in merge-time -** sorting). 8 is about 20% slower than 16, 4 about 50% slower than -** 16, 2 about 66% slower than 16. -** -** At query time, high MERGE_COUNT increases the number of segments -** which need to be scanned and merged. For instance, with 100k docs -** inserted: -** -** MERGE_COUNT segments -** 16 25 -** 8 12 -** 4 10 -** 2 6 -** -** This appears to have only a moderate impact on queries for very -** frequent terms (which are somewhat dominated by segment merge -** costs), and infrequent and non-existent terms still seem to be fast -** even with many segments. -** -** TODO(shess) That said, it would be nice to have a better query-side -** argument for MERGE_COUNT of 16. Also, it is possible/likely that -** optimizations to things like doclist merging will swing the sweet -** spot around. -** -** -** -**** Handling of deletions and updates **** -** Since we're using a segmented structure, with no docid-oriented -** index into the term index, we clearly cannot simply update the term -** index when a document is deleted or updated. For deletions, we -** write an empty doclist (varint(docid) varint(POS_END)), for updates -** we simply write the new doclist. Segment merges overwrite older -** data for a particular docid with newer data, so deletes or updates -** will eventually overtake the earlier data and knock it out. The -** query logic likewise merges doclists so that newer data knocks out -** older data. -*/ - -/************** Include fts3Int.h in the middle of fts3.c ********************/ -/************** Begin file fts3Int.h *****************************************/ -/* -** 2009 Nov 12 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -*/ -#ifndef _FTSINT_H -#define _FTSINT_H - -#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) -# define NDEBUG 1 -#endif - -/* -** FTS4 is really an extension for FTS3. It is enabled using the -** SQLITE_ENABLE_FTS3 macro. But to avoid confusion we also all -** the SQLITE_ENABLE_FTS4 macro to serve as an alisse for SQLITE_ENABLE_FTS3. -*/ -#if defined(SQLITE_ENABLE_FTS4) && !defined(SQLITE_ENABLE_FTS3) -# define SQLITE_ENABLE_FTS3 -#endif - -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* If not building as part of the core, include sqlite3ext.h. */ -#ifndef SQLITE_CORE -SQLITE_EXTENSION_INIT3 -#endif - -/************** Include fts3_tokenizer.h in the middle of fts3Int.h **********/ -/************** Begin file fts3_tokenizer.h **********************************/ -/* -** 2006 July 10 -** -** The author disclaims copyright to this source code. -** -************************************************************************* -** Defines the interface to tokenizers used by fulltext-search. There -** are three basic components: -** -** sqlite3_tokenizer_module is a singleton defining the tokenizer -** interface functions. This is essentially the class structure for -** tokenizers. -** -** sqlite3_tokenizer is used to define a particular tokenizer, perhaps -** including customization information defined at creation time. -** -** sqlite3_tokenizer_cursor is generated by a tokenizer to generate -** tokens from a particular input. -*/ -#ifndef _FTS3_TOKENIZER_H_ -#define _FTS3_TOKENIZER_H_ - -/* TODO(shess) Only used for SQLITE_OK and SQLITE_DONE at this time. -** If tokenizers are to be allowed to call sqlite3_*() functions, then -** we will need a way to register the API consistently. -*/ - -/* -** Structures used by the tokenizer interface. When a new tokenizer -** implementation is registered, the caller provides a pointer to -** an sqlite3_tokenizer_module containing pointers to the callback -** functions that make up an implementation. -** -** When an fts3 table is created, it passes any arguments passed to -** the tokenizer clause of the CREATE VIRTUAL TABLE statement to the -** sqlite3_tokenizer_module.xCreate() function of the requested tokenizer -** implementation. The xCreate() function in turn returns an -** sqlite3_tokenizer structure representing the specific tokenizer to -** be used for the fts3 table (customized by the tokenizer clause arguments). -** -** To tokenize an input buffer, the sqlite3_tokenizer_module.xOpen() -** method is called. It returns an sqlite3_tokenizer_cursor object -** that may be used to tokenize a specific input buffer based on -** the tokenization rules supplied by a specific sqlite3_tokenizer -** object. -*/ -typedef struct sqlite3_tokenizer_module sqlite3_tokenizer_module; -typedef struct sqlite3_tokenizer sqlite3_tokenizer; -typedef struct sqlite3_tokenizer_cursor sqlite3_tokenizer_cursor; - -struct sqlite3_tokenizer_module { - - /* - ** Structure version. Should always be set to 0 or 1. - */ - int iVersion; - - /* - ** Create a new tokenizer. The values in the argv[] array are the - ** arguments passed to the "tokenizer" clause of the CREATE VIRTUAL - ** TABLE statement that created the fts3 table. For example, if - ** the following SQL is executed: - ** - ** CREATE .. USING fts3( ... , tokenizer arg1 arg2) - ** - ** then argc is set to 2, and the argv[] array contains pointers - ** to the strings "arg1" and "arg2". - ** - ** This method should return either SQLITE_OK (0), or an SQLite error - ** code. If SQLITE_OK is returned, then *ppTokenizer should be set - ** to point at the newly created tokenizer structure. The generic - ** sqlite3_tokenizer.pModule variable should not be initialized by - ** this callback. The caller will do so. - */ - int (*xCreate)( - int argc, /* Size of argv array */ - const char *const*argv, /* Tokenizer argument strings */ - sqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */ - ); - - /* - ** Destroy an existing tokenizer. The fts3 module calls this method - ** exactly once for each successful call to xCreate(). - */ - int (*xDestroy)(sqlite3_tokenizer *pTokenizer); - - /* - ** Create a tokenizer cursor to tokenize an input buffer. The caller - ** is responsible for ensuring that the input buffer remains valid - ** until the cursor is closed (using the xClose() method). - */ - int (*xOpen)( - sqlite3_tokenizer *pTokenizer, /* Tokenizer object */ - const char *pInput, int nBytes, /* Input buffer */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Created tokenizer cursor */ - ); - - /* - ** Destroy an existing tokenizer cursor. The fts3 module calls this - ** method exactly once for each successful call to xOpen(). - */ - int (*xClose)(sqlite3_tokenizer_cursor *pCursor); - - /* - ** Retrieve the next token from the tokenizer cursor pCursor. This - ** method should either return SQLITE_OK and set the values of the - ** "OUT" variables identified below, or SQLITE_DONE to indicate that - ** the end of the buffer has been reached, or an SQLite error code. - ** - ** *ppToken should be set to point at a buffer containing the - ** normalized version of the token (i.e. after any case-folding and/or - ** stemming has been performed). *pnBytes should be set to the length - ** of this buffer in bytes. The input text that generated the token is - ** identified by the byte offsets returned in *piStartOffset and - ** *piEndOffset. *piStartOffset should be set to the index of the first - ** byte of the token in the input buffer. *piEndOffset should be set - ** to the index of the first byte just past the end of the token in - ** the input buffer. - ** - ** The buffer *ppToken is set to point at is managed by the tokenizer - ** implementation. It is only required to be valid until the next call - ** to xNext() or xClose(). - */ - /* TODO(shess) current implementation requires pInput to be - ** nul-terminated. This should either be fixed, or pInput/nBytes - ** should be converted to zInput. - */ - int (*xNext)( - sqlite3_tokenizer_cursor *pCursor, /* Tokenizer cursor */ - const char **ppToken, int *pnBytes, /* OUT: Normalized text for token */ - int *piStartOffset, /* OUT: Byte offset of token in input buffer */ - int *piEndOffset, /* OUT: Byte offset of end of token in input buffer */ - int *piPosition /* OUT: Number of tokens returned before this one */ - ); - - /*********************************************************************** - ** Methods below this point are only available if iVersion>=1. - */ - - /* - ** Configure the language id of a tokenizer cursor. - */ - int (*xLanguageid)(sqlite3_tokenizer_cursor *pCsr, int iLangid); -}; - -struct sqlite3_tokenizer { - const sqlite3_tokenizer_module *pModule; /* The module for this tokenizer */ - /* Tokenizer implementations will typically add additional fields */ -}; - -struct sqlite3_tokenizer_cursor { - sqlite3_tokenizer *pTokenizer; /* Tokenizer for this cursor. */ - /* Tokenizer implementations will typically add additional fields */ -}; - -int fts3_global_term_cnt(int iTerm, int iCol); -int fts3_term_cnt(int iTerm, int iCol); - - -#endif /* _FTS3_TOKENIZER_H_ */ - -/************** End of fts3_tokenizer.h **************************************/ -/************** Continuing where we left off in fts3Int.h ********************/ -/************** Include fts3_hash.h in the middle of fts3Int.h ***************/ -/************** Begin file fts3_hash.h ***************************************/ -/* -** 2001 September 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This is the header file for the generic hash-table implementation -** used in SQLite. We've modified it slightly to serve as a standalone -** hash table implementation for the full-text indexing module. -** -*/ -#ifndef _FTS3_HASH_H_ -#define _FTS3_HASH_H_ - -/* Forward declarations of structures. */ -typedef struct Fts3Hash Fts3Hash; -typedef struct Fts3HashElem Fts3HashElem; - -/* A complete hash table is an instance of the following structure. -** The internals of this structure are intended to be opaque -- client -** code should not attempt to access or modify the fields of this structure -** directly. Change this structure only by using the routines below. -** However, many of the "procedures" and "functions" for modifying and -** accessing this structure are really macros, so we can't really make -** this structure opaque. -*/ -struct Fts3Hash { - char keyClass; /* HASH_INT, _POINTER, _STRING, _BINARY */ - char copyKey; /* True if copy of key made on insert */ - int count; /* Number of entries in this table */ - Fts3HashElem *first; /* The first element of the array */ - int htsize; /* Number of buckets in the hash table */ - struct _fts3ht { /* the hash table */ - int count; /* Number of entries with this hash */ - Fts3HashElem *chain; /* Pointer to first entry with this hash */ - } *ht; -}; - -/* Each element in the hash table is an instance of the following -** structure. All elements are stored on a single doubly-linked list. -** -** Again, this structure is intended to be opaque, but it can't really -** be opaque because it is used by macros. -*/ -struct Fts3HashElem { - Fts3HashElem *next, *prev; /* Next and previous elements in the table */ - void *data; /* Data associated with this element */ - void *pKey; int nKey; /* Key associated with this element */ -}; - -/* -** There are 2 different modes of operation for a hash table: -** -** FTS3_HASH_STRING pKey points to a string that is nKey bytes long -** (including the null-terminator, if any). Case -** is respected in comparisons. -** -** FTS3_HASH_BINARY pKey points to binary data nKey bytes long. -** memcmp() is used to compare keys. -** -** A copy of the key is made if the copyKey parameter to fts3HashInit is 1. -*/ -#define FTS3_HASH_STRING 1 -#define FTS3_HASH_BINARY 2 - -/* -** Access routines. To delete, insert a NULL pointer. -*/ -SQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey); -SQLITE_PRIVATE void *sqlite3Fts3HashInsert(Fts3Hash*, const void *pKey, int nKey, void *pData); -SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash*, const void *pKey, int nKey); -SQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash*); -SQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem(const Fts3Hash *, const void *, int); - -/* -** Shorthand for the functions above -*/ -#define fts3HashInit sqlite3Fts3HashInit -#define fts3HashInsert sqlite3Fts3HashInsert -#define fts3HashFind sqlite3Fts3HashFind -#define fts3HashClear sqlite3Fts3HashClear -#define fts3HashFindElem sqlite3Fts3HashFindElem - -/* -** Macros for looping over all elements of a hash table. The idiom is -** like this: -** -** Fts3Hash h; -** Fts3HashElem *p; -** ... -** for(p=fts3HashFirst(&h); p; p=fts3HashNext(p)){ -** SomeStructure *pData = fts3HashData(p); -** // do something with pData -** } -*/ -#define fts3HashFirst(H) ((H)->first) -#define fts3HashNext(E) ((E)->next) -#define fts3HashData(E) ((E)->data) -#define fts3HashKey(E) ((E)->pKey) -#define fts3HashKeysize(E) ((E)->nKey) - -/* -** Number of entries in a hash table -*/ -#define fts3HashCount(H) ((H)->count) - -#endif /* _FTS3_HASH_H_ */ - -/************** End of fts3_hash.h *******************************************/ -/************** Continuing where we left off in fts3Int.h ********************/ - -/* -** This constant determines the maximum depth of an FTS expression tree -** that the library will create and use. FTS uses recursion to perform -** various operations on the query tree, so the disadvantage of a large -** limit is that it may allow very large queries to use large amounts -** of stack space (perhaps causing a stack overflow). -*/ -#ifndef SQLITE_FTS3_MAX_EXPR_DEPTH -# define SQLITE_FTS3_MAX_EXPR_DEPTH 12 -#endif - - -/* -** This constant controls how often segments are merged. Once there are -** FTS3_MERGE_COUNT segments of level N, they are merged into a single -** segment of level N+1. -*/ -#define FTS3_MERGE_COUNT 16 - -/* -** This is the maximum amount of data (in bytes) to store in the -** Fts3Table.pendingTerms hash table. Normally, the hash table is -** populated as documents are inserted/updated/deleted in a transaction -** and used to create a new segment when the transaction is committed. -** However if this limit is reached midway through a transaction, a new -** segment is created and the hash table cleared immediately. -*/ -#define FTS3_MAX_PENDING_DATA (1*1024*1024) - -/* -** Macro to return the number of elements in an array. SQLite has a -** similar macro called ArraySize(). Use a different name to avoid -** a collision when building an amalgamation with built-in FTS3. -*/ -#define SizeofArray(X) ((int)(sizeof(X)/sizeof(X[0]))) - - -#ifndef MIN -# define MIN(x,y) ((x)<(y)?(x):(y)) -#endif -#ifndef MAX -# define MAX(x,y) ((x)>(y)?(x):(y)) -#endif - -/* -** Maximum length of a varint encoded integer. The varint format is different -** from that used by SQLite, so the maximum length is 10, not 9. -*/ -#define FTS3_VARINT_MAX 10 - -/* -** FTS4 virtual tables may maintain multiple indexes - one index of all terms -** in the document set and zero or more prefix indexes. All indexes are stored -** as one or more b+-trees in the %_segments and %_segdir tables. -** -** It is possible to determine which index a b+-tree belongs to based on the -** value stored in the "%_segdir.level" column. Given this value L, the index -** that the b+-tree belongs to is (L<<10). In other words, all b+-trees with -** level values between 0 and 1023 (inclusive) belong to index 0, all levels -** between 1024 and 2047 to index 1, and so on. -** -** It is considered impossible for an index to use more than 1024 levels. In -** theory though this may happen, but only after at least -** (FTS3_MERGE_COUNT^1024) separate flushes of the pending-terms tables. -*/ -#define FTS3_SEGDIR_MAXLEVEL 1024 -#define FTS3_SEGDIR_MAXLEVEL_STR "1024" - -/* -** The testcase() macro is only used by the amalgamation. If undefined, -** make it a no-op. -*/ -#ifndef testcase -# define testcase(X) -#endif - -/* -** Terminator values for position-lists and column-lists. -*/ -#define POS_COLUMN (1) /* Column-list terminator */ -#define POS_END (0) /* Position-list terminator */ - -/* -** This section provides definitions to allow the -** FTS3 extension to be compiled outside of the -** amalgamation. -*/ -#ifndef SQLITE_AMALGAMATION -/* -** Macros indicating that conditional expressions are always true or -** false. -*/ -#ifdef SQLITE_COVERAGE_TEST -# define ALWAYS(x) (1) -# define NEVER(X) (0) -#else -# define ALWAYS(x) (x) -# define NEVER(x) (x) -#endif - -/* -** Internal types used by SQLite. -*/ -typedef unsigned char u8; /* 1-byte (or larger) unsigned integer */ -typedef short int i16; /* 2-byte (or larger) signed integer */ -typedef unsigned int u32; /* 4-byte unsigned integer */ -typedef sqlite3_uint64 u64; /* 8-byte unsigned integer */ -typedef sqlite3_int64 i64; /* 8-byte signed integer */ - -/* -** Macro used to suppress compiler warnings for unused parameters. -*/ -#define UNUSED_PARAMETER(x) (void)(x) - -/* -** Activate assert() only if SQLITE_TEST is enabled. -*/ -#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) -# define NDEBUG 1 -#endif - -/* -** The TESTONLY macro is used to enclose variable declarations or -** other bits of code that are needed to support the arguments -** within testcase() and assert() macros. -*/ -#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) -# define TESTONLY(X) X -#else -# define TESTONLY(X) -#endif - -#endif /* SQLITE_AMALGAMATION */ - -#ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3Fts3Corrupt(void); -# define FTS_CORRUPT_VTAB sqlite3Fts3Corrupt() -#else -# define FTS_CORRUPT_VTAB SQLITE_CORRUPT_VTAB -#endif - -typedef struct Fts3Table Fts3Table; -typedef struct Fts3Cursor Fts3Cursor; -typedef struct Fts3Expr Fts3Expr; -typedef struct Fts3Phrase Fts3Phrase; -typedef struct Fts3PhraseToken Fts3PhraseToken; - -typedef struct Fts3Doclist Fts3Doclist; -typedef struct Fts3SegFilter Fts3SegFilter; -typedef struct Fts3DeferredToken Fts3DeferredToken; -typedef struct Fts3SegReader Fts3SegReader; -typedef struct Fts3MultiSegReader Fts3MultiSegReader; - -/* -** A connection to a fulltext index is an instance of the following -** structure. The xCreate and xConnect methods create an instance -** of this structure and xDestroy and xDisconnect free that instance. -** All other methods receive a pointer to the structure as one of their -** arguments. -*/ -struct Fts3Table { - sqlite3_vtab base; /* Base class used by SQLite core */ - sqlite3 *db; /* The database connection */ - const char *zDb; /* logical database name */ - const char *zName; /* virtual table name */ - int nColumn; /* number of named columns in virtual table */ - char **azColumn; /* column names. malloced */ - u8 *abNotindexed; /* True for 'notindexed' columns */ - sqlite3_tokenizer *pTokenizer; /* tokenizer for inserts and queries */ - char *zContentTbl; /* content=xxx option, or NULL */ - char *zLanguageid; /* languageid=xxx option, or NULL */ - u8 bAutoincrmerge; /* True if automerge=1 */ - u32 nLeafAdd; /* Number of leaf blocks added this trans */ - - /* Precompiled statements used by the implementation. Each of these - ** statements is run and reset within a single virtual table API call. - */ - sqlite3_stmt *aStmt[37]; - - char *zReadExprlist; - char *zWriteExprlist; - - int nNodeSize; /* Soft limit for node size */ - u8 bFts4; /* True for FTS4, false for FTS3 */ - u8 bHasStat; /* True if %_stat table exists */ - u8 bHasDocsize; /* True if %_docsize table exists */ - u8 bDescIdx; /* True if doclists are in reverse order */ - u8 bIgnoreSavepoint; /* True to ignore xSavepoint invocations */ - int nPgsz; /* Page size for host database */ - char *zSegmentsTbl; /* Name of %_segments table */ - sqlite3_blob *pSegments; /* Blob handle open on %_segments table */ - - /* - ** The following array of hash tables is used to buffer pending index - ** updates during transactions. All pending updates buffered at any one - ** time must share a common language-id (see the FTS4 langid= feature). - ** The current language id is stored in variable iPrevLangid. - ** - ** A single FTS4 table may have multiple full-text indexes. For each index - ** there is an entry in the aIndex[] array. Index 0 is an index of all the - ** terms that appear in the document set. Each subsequent index in aIndex[] - ** is an index of prefixes of a specific length. - ** - ** Variable nPendingData contains an estimate the memory consumed by the - ** pending data structures, including hash table overhead, but not including - ** malloc overhead. When nPendingData exceeds nMaxPendingData, all hash - ** tables are flushed to disk. Variable iPrevDocid is the docid of the most - ** recently inserted record. - */ - int nIndex; /* Size of aIndex[] */ - struct Fts3Index { - int nPrefix; /* Prefix length (0 for main terms index) */ - Fts3Hash hPending; /* Pending terms table for this index */ - } *aIndex; - int nMaxPendingData; /* Max pending data before flush to disk */ - int nPendingData; /* Current bytes of pending data */ - sqlite_int64 iPrevDocid; /* Docid of most recently inserted document */ - int iPrevLangid; /* Langid of recently inserted document */ - -#if defined(SQLITE_DEBUG) || defined(SQLITE_COVERAGE_TEST) - /* State variables used for validating that the transaction control - ** methods of the virtual table are called at appropriate times. These - ** values do not contribute to FTS functionality; they are used for - ** verifying the operation of the SQLite core. - */ - int inTransaction; /* True after xBegin but before xCommit/xRollback */ - int mxSavepoint; /* Largest valid xSavepoint integer */ -#endif - -#ifdef SQLITE_TEST - /* True to disable the incremental doclist optimization. This is controled - ** by special insert command 'test-no-incr-doclist'. */ - int bNoIncrDoclist; -#endif -}; - -/* -** When the core wants to read from the virtual table, it creates a -** virtual table cursor (an instance of the following structure) using -** the xOpen method. Cursors are destroyed using the xClose method. -*/ -struct Fts3Cursor { - sqlite3_vtab_cursor base; /* Base class used by SQLite core */ - i16 eSearch; /* Search strategy (see below) */ - u8 isEof; /* True if at End Of Results */ - u8 isRequireSeek; /* True if must seek pStmt to %_content row */ - sqlite3_stmt *pStmt; /* Prepared statement in use by the cursor */ - Fts3Expr *pExpr; /* Parsed MATCH query string */ - int iLangid; /* Language being queried for */ - int nPhrase; /* Number of matchable phrases in query */ - Fts3DeferredToken *pDeferred; /* Deferred search tokens, if any */ - sqlite3_int64 iPrevId; /* Previous id read from aDoclist */ - char *pNextId; /* Pointer into the body of aDoclist */ - char *aDoclist; /* List of docids for full-text queries */ - int nDoclist; /* Size of buffer at aDoclist */ - u8 bDesc; /* True to sort in descending order */ - int eEvalmode; /* An FTS3_EVAL_XX constant */ - int nRowAvg; /* Average size of database rows, in pages */ - sqlite3_int64 nDoc; /* Documents in table */ - i64 iMinDocid; /* Minimum docid to return */ - i64 iMaxDocid; /* Maximum docid to return */ - int isMatchinfoNeeded; /* True when aMatchinfo[] needs filling in */ - u32 *aMatchinfo; /* Information about most recent match */ - int nMatchinfo; /* Number of elements in aMatchinfo[] */ - char *zMatchinfo; /* Matchinfo specification */ -}; - -#define FTS3_EVAL_FILTER 0 -#define FTS3_EVAL_NEXT 1 -#define FTS3_EVAL_MATCHINFO 2 - -/* -** The Fts3Cursor.eSearch member is always set to one of the following. -** Actualy, Fts3Cursor.eSearch can be greater than or equal to -** FTS3_FULLTEXT_SEARCH. If so, then Fts3Cursor.eSearch - 2 is the index -** of the column to be searched. For example, in -** -** CREATE VIRTUAL TABLE ex1 USING fts3(a,b,c,d); -** SELECT docid FROM ex1 WHERE b MATCH 'one two three'; -** -** Because the LHS of the MATCH operator is 2nd column "b", -** Fts3Cursor.eSearch will be set to FTS3_FULLTEXT_SEARCH+1. (+0 for a, -** +1 for b, +2 for c, +3 for d.) If the LHS of MATCH were "ex1" -** indicating that all columns should be searched, -** then eSearch would be set to FTS3_FULLTEXT_SEARCH+4. -*/ -#define FTS3_FULLSCAN_SEARCH 0 /* Linear scan of %_content table */ -#define FTS3_DOCID_SEARCH 1 /* Lookup by rowid on %_content table */ -#define FTS3_FULLTEXT_SEARCH 2 /* Full-text index search */ - -/* -** The lower 16-bits of the sqlite3_index_info.idxNum value set by -** the xBestIndex() method contains the Fts3Cursor.eSearch value described -** above. The upper 16-bits contain a combination of the following -** bits, used to describe extra constraints on full-text searches. -*/ -#define FTS3_HAVE_LANGID 0x00010000 /* languageid=? */ -#define FTS3_HAVE_DOCID_GE 0x00020000 /* docid>=? */ -#define FTS3_HAVE_DOCID_LE 0x00040000 /* docid<=? */ - -struct Fts3Doclist { - char *aAll; /* Array containing doclist (or NULL) */ - int nAll; /* Size of a[] in bytes */ - char *pNextDocid; /* Pointer to next docid */ - - sqlite3_int64 iDocid; /* Current docid (if pList!=0) */ - int bFreeList; /* True if pList should be sqlite3_free()d */ - char *pList; /* Pointer to position list following iDocid */ - int nList; /* Length of position list */ -}; - -/* -** A "phrase" is a sequence of one or more tokens that must match in -** sequence. A single token is the base case and the most common case. -** For a sequence of tokens contained in double-quotes (i.e. "one two three") -** nToken will be the number of tokens in the string. -*/ -struct Fts3PhraseToken { - char *z; /* Text of the token */ - int n; /* Number of bytes in buffer z */ - int isPrefix; /* True if token ends with a "*" character */ - int bFirst; /* True if token must appear at position 0 */ - - /* Variables above this point are populated when the expression is - ** parsed (by code in fts3_expr.c). Below this point the variables are - ** used when evaluating the expression. */ - Fts3DeferredToken *pDeferred; /* Deferred token object for this token */ - Fts3MultiSegReader *pSegcsr; /* Segment-reader for this token */ -}; - -struct Fts3Phrase { - /* Cache of doclist for this phrase. */ - Fts3Doclist doclist; - int bIncr; /* True if doclist is loaded incrementally */ - int iDoclistToken; - - /* Variables below this point are populated by fts3_expr.c when parsing - ** a MATCH expression. Everything above is part of the evaluation phase. - */ - int nToken; /* Number of tokens in the phrase */ - int iColumn; /* Index of column this phrase must match */ - Fts3PhraseToken aToken[1]; /* One entry for each token in the phrase */ -}; - -/* -** A tree of these objects forms the RHS of a MATCH operator. -** -** If Fts3Expr.eType is FTSQUERY_PHRASE and isLoaded is true, then aDoclist -** points to a malloced buffer, size nDoclist bytes, containing the results -** of this phrase query in FTS3 doclist format. As usual, the initial -** "Length" field found in doclists stored on disk is omitted from this -** buffer. -** -** Variable aMI is used only for FTSQUERY_NEAR nodes to store the global -** matchinfo data. If it is not NULL, it points to an array of size nCol*3, -** where nCol is the number of columns in the queried FTS table. The array -** is populated as follows: -** -** aMI[iCol*3 + 0] = Undefined -** aMI[iCol*3 + 1] = Number of occurrences -** aMI[iCol*3 + 2] = Number of rows containing at least one instance -** -** The aMI array is allocated using sqlite3_malloc(). It should be freed -** when the expression node is. -*/ -struct Fts3Expr { - int eType; /* One of the FTSQUERY_XXX values defined below */ - int nNear; /* Valid if eType==FTSQUERY_NEAR */ - Fts3Expr *pParent; /* pParent->pLeft==this or pParent->pRight==this */ - Fts3Expr *pLeft; /* Left operand */ - Fts3Expr *pRight; /* Right operand */ - Fts3Phrase *pPhrase; /* Valid if eType==FTSQUERY_PHRASE */ - - /* The following are used by the fts3_eval.c module. */ - sqlite3_int64 iDocid; /* Current docid */ - u8 bEof; /* True this expression is at EOF already */ - u8 bStart; /* True if iDocid is valid */ - u8 bDeferred; /* True if this expression is entirely deferred */ - - u32 *aMI; -}; - -/* -** Candidate values for Fts3Query.eType. Note that the order of the first -** four values is in order of precedence when parsing expressions. For -** example, the following: -** -** "a OR b AND c NOT d NEAR e" -** -** is equivalent to: -** -** "a OR (b AND (c NOT (d NEAR e)))" -*/ -#define FTSQUERY_NEAR 1 -#define FTSQUERY_NOT 2 -#define FTSQUERY_AND 3 -#define FTSQUERY_OR 4 -#define FTSQUERY_PHRASE 5 - - -/* fts3_write.c */ -SQLITE_PRIVATE int sqlite3Fts3UpdateMethod(sqlite3_vtab*,int,sqlite3_value**,sqlite3_int64*); -SQLITE_PRIVATE int sqlite3Fts3PendingTermsFlush(Fts3Table *); -SQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *); -SQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *); -SQLITE_PRIVATE int sqlite3Fts3SegReaderNew(int, int, sqlite3_int64, - sqlite3_int64, sqlite3_int64, const char *, int, Fts3SegReader**); -SQLITE_PRIVATE int sqlite3Fts3SegReaderPending( - Fts3Table*,int,const char*,int,int,Fts3SegReader**); -SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *); -SQLITE_PRIVATE int sqlite3Fts3AllSegdirs(Fts3Table*, int, int, int, sqlite3_stmt **); -SQLITE_PRIVATE int sqlite3Fts3ReadBlock(Fts3Table*, sqlite3_int64, char **, int*, int*); - -SQLITE_PRIVATE int sqlite3Fts3SelectDoctotal(Fts3Table *, sqlite3_stmt **); -SQLITE_PRIVATE int sqlite3Fts3SelectDocsize(Fts3Table *, sqlite3_int64, sqlite3_stmt **); - -#ifndef SQLITE_DISABLE_FTS4_DEFERRED -SQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *); -SQLITE_PRIVATE int sqlite3Fts3DeferToken(Fts3Cursor *, Fts3PhraseToken *, int); -SQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *); -SQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *); -SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList(Fts3DeferredToken *, char **, int *); -#else -# define sqlite3Fts3FreeDeferredTokens(x) -# define sqlite3Fts3DeferToken(x,y,z) SQLITE_OK -# define sqlite3Fts3CacheDeferredDoclists(x) SQLITE_OK -# define sqlite3Fts3FreeDeferredDoclists(x) -# define sqlite3Fts3DeferredTokenList(x,y,z) SQLITE_OK -#endif - -SQLITE_PRIVATE void sqlite3Fts3SegmentsClose(Fts3Table *); -SQLITE_PRIVATE int sqlite3Fts3MaxLevel(Fts3Table *, int *); - -/* Special values interpreted by sqlite3SegReaderCursor() */ -#define FTS3_SEGCURSOR_PENDING -1 -#define FTS3_SEGCURSOR_ALL -2 - -SQLITE_PRIVATE int sqlite3Fts3SegReaderStart(Fts3Table*, Fts3MultiSegReader*, Fts3SegFilter*); -SQLITE_PRIVATE int sqlite3Fts3SegReaderStep(Fts3Table *, Fts3MultiSegReader *); -SQLITE_PRIVATE void sqlite3Fts3SegReaderFinish(Fts3MultiSegReader *); - -SQLITE_PRIVATE int sqlite3Fts3SegReaderCursor(Fts3Table *, - int, int, int, const char *, int, int, int, Fts3MultiSegReader *); - -/* Flags allowed as part of the 4th argument to SegmentReaderIterate() */ -#define FTS3_SEGMENT_REQUIRE_POS 0x00000001 -#define FTS3_SEGMENT_IGNORE_EMPTY 0x00000002 -#define FTS3_SEGMENT_COLUMN_FILTER 0x00000004 -#define FTS3_SEGMENT_PREFIX 0x00000008 -#define FTS3_SEGMENT_SCAN 0x00000010 -#define FTS3_SEGMENT_FIRST 0x00000020 - -/* Type passed as 4th argument to SegmentReaderIterate() */ -struct Fts3SegFilter { - const char *zTerm; - int nTerm; - int iCol; - int flags; -}; - -struct Fts3MultiSegReader { - /* Used internally by sqlite3Fts3SegReaderXXX() calls */ - Fts3SegReader **apSegment; /* Array of Fts3SegReader objects */ - int nSegment; /* Size of apSegment array */ - int nAdvance; /* How many seg-readers to advance */ - Fts3SegFilter *pFilter; /* Pointer to filter object */ - char *aBuffer; /* Buffer to merge doclists in */ - int nBuffer; /* Allocated size of aBuffer[] in bytes */ - - int iColFilter; /* If >=0, filter for this column */ - int bRestart; - - /* Used by fts3.c only. */ - int nCost; /* Cost of running iterator */ - int bLookup; /* True if a lookup of a single entry. */ - - /* Output values. Valid only after Fts3SegReaderStep() returns SQLITE_ROW. */ - char *zTerm; /* Pointer to term buffer */ - int nTerm; /* Size of zTerm in bytes */ - char *aDoclist; /* Pointer to doclist buffer */ - int nDoclist; /* Size of aDoclist[] in bytes */ -}; - -SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table*,int,int); - -#define fts3GetVarint32(p, piVal) ( \ - (*(u8*)(p)&0x80) ? sqlite3Fts3GetVarint32(p, piVal) : (*piVal=*(u8*)(p), 1) \ -) - -/* fts3.c */ -SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *, sqlite3_int64); -SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *, sqlite_int64 *); -SQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *, int *); -SQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64); -SQLITE_PRIVATE void sqlite3Fts3Dequote(char *); -SQLITE_PRIVATE void sqlite3Fts3DoclistPrev(int,char*,int,char**,sqlite3_int64*,int*,u8*); -SQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats(Fts3Cursor *, Fts3Expr *, u32 *); -SQLITE_PRIVATE int sqlite3Fts3FirstFilter(sqlite3_int64, char *, int, char *); -SQLITE_PRIVATE void sqlite3Fts3CreateStatTable(int*, Fts3Table*); - -/* fts3_tokenizer.c */ -SQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *, int *); -SQLITE_PRIVATE int sqlite3Fts3InitHashTable(sqlite3 *, Fts3Hash *, const char *); -SQLITE_PRIVATE int sqlite3Fts3InitTokenizer(Fts3Hash *pHash, const char *, - sqlite3_tokenizer **, char ** -); -SQLITE_PRIVATE int sqlite3Fts3IsIdChar(char); - -/* fts3_snippet.c */ -SQLITE_PRIVATE void sqlite3Fts3Offsets(sqlite3_context*, Fts3Cursor*); -SQLITE_PRIVATE void sqlite3Fts3Snippet(sqlite3_context *, Fts3Cursor *, const char *, - const char *, const char *, int, int -); -SQLITE_PRIVATE void sqlite3Fts3Matchinfo(sqlite3_context *, Fts3Cursor *, const char *); - -/* fts3_expr.c */ -SQLITE_PRIVATE int sqlite3Fts3ExprParse(sqlite3_tokenizer *, int, - char **, int, int, int, const char *, int, Fts3Expr **, char ** -); -SQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *); -#ifdef SQLITE_TEST -SQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3 *db); -SQLITE_PRIVATE int sqlite3Fts3InitTerm(sqlite3 *db); -#endif - -SQLITE_PRIVATE int sqlite3Fts3OpenTokenizer(sqlite3_tokenizer *, int, const char *, int, - sqlite3_tokenizer_cursor ** -); - -/* fts3_aux.c */ -SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db); - -SQLITE_PRIVATE void sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *); - -SQLITE_PRIVATE int sqlite3Fts3MsrIncrStart( - Fts3Table*, Fts3MultiSegReader*, int, const char*, int); -SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( - Fts3Table *, Fts3MultiSegReader *, sqlite3_int64 *, char **, int *); -SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist(Fts3Cursor *, Fts3Expr *, int iCol, char **); -SQLITE_PRIVATE int sqlite3Fts3MsrOvfl(Fts3Cursor *, Fts3MultiSegReader *, int *); -SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr); - -/* fts3_tokenize_vtab.c */ -SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3*, Fts3Hash *); - -/* fts3_unicode2.c (functions generated by parsing unicode text files) */ -#ifdef SQLITE_ENABLE_FTS4_UNICODE61 -SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int, int); -SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int); -SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int); -#endif - -#endif /* !SQLITE_CORE || SQLITE_ENABLE_FTS3 */ -#endif /* _FTSINT_H */ - -/************** End of fts3Int.h *********************************************/ -/************** Continuing where we left off in fts3.c ***********************/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -#if defined(SQLITE_ENABLE_FTS3) && !defined(SQLITE_CORE) -# define SQLITE_CORE 1 -#endif - -/* #include */ -/* #include */ -/* #include */ -/* #include */ -/* #include */ -/* #include */ - -#ifndef SQLITE_CORE - SQLITE_EXTENSION_INIT1 -#endif - -static int fts3EvalNext(Fts3Cursor *pCsr); -static int fts3EvalStart(Fts3Cursor *pCsr); -static int fts3TermSegReaderCursor( - Fts3Cursor *, const char *, int, int, Fts3MultiSegReader **); - -/* -** Write a 64-bit variable-length integer to memory starting at p[0]. -** The length of data written will be between 1 and FTS3_VARINT_MAX bytes. -** The number of bytes written is returned. -*/ -SQLITE_PRIVATE int sqlite3Fts3PutVarint(char *p, sqlite_int64 v){ - unsigned char *q = (unsigned char *) p; - sqlite_uint64 vu = v; - do{ - *q++ = (unsigned char) ((vu & 0x7f) | 0x80); - vu >>= 7; - }while( vu!=0 ); - q[-1] &= 0x7f; /* turn off high bit in final byte */ - assert( q - (unsigned char *)p <= FTS3_VARINT_MAX ); - return (int) (q - (unsigned char *)p); -} - -#define GETVARINT_STEP(v, ptr, shift, mask1, mask2, var, ret) \ - v = (v & mask1) | ( (*ptr++) << shift ); \ - if( (v & mask2)==0 ){ var = v; return ret; } -#define GETVARINT_INIT(v, ptr, shift, mask1, mask2, var, ret) \ - v = (*ptr++); \ - if( (v & mask2)==0 ){ var = v; return ret; } - -/* -** Read a 64-bit variable-length integer from memory starting at p[0]. -** Return the number of bytes read, or 0 on error. -** The value is stored in *v. -*/ -SQLITE_PRIVATE int sqlite3Fts3GetVarint(const char *p, sqlite_int64 *v){ - const char *pStart = p; - u32 a; - u64 b; - int shift; - - GETVARINT_INIT(a, p, 0, 0x00, 0x80, *v, 1); - GETVARINT_STEP(a, p, 7, 0x7F, 0x4000, *v, 2); - GETVARINT_STEP(a, p, 14, 0x3FFF, 0x200000, *v, 3); - GETVARINT_STEP(a, p, 21, 0x1FFFFF, 0x10000000, *v, 4); - b = (a & 0x0FFFFFFF ); - - for(shift=28; shift<=63; shift+=7){ - u64 c = *p++; - b += (c&0x7F) << shift; - if( (c & 0x80)==0 ) break; - } - *v = b; - return (int)(p - pStart); -} - -/* -** Similar to sqlite3Fts3GetVarint(), except that the output is truncated to a -** 32-bit integer before it is returned. -*/ -SQLITE_PRIVATE int sqlite3Fts3GetVarint32(const char *p, int *pi){ - u32 a; - -#ifndef fts3GetVarint32 - GETVARINT_INIT(a, p, 0, 0x00, 0x80, *pi, 1); -#else - a = (*p++); - assert( a & 0x80 ); -#endif - - GETVARINT_STEP(a, p, 7, 0x7F, 0x4000, *pi, 2); - GETVARINT_STEP(a, p, 14, 0x3FFF, 0x200000, *pi, 3); - GETVARINT_STEP(a, p, 21, 0x1FFFFF, 0x10000000, *pi, 4); - a = (a & 0x0FFFFFFF ); - *pi = (int)(a | ((u32)(*p & 0x0F) << 28)); - return 5; -} - -/* -** Return the number of bytes required to encode v as a varint -*/ -SQLITE_PRIVATE int sqlite3Fts3VarintLen(sqlite3_uint64 v){ - int i = 0; - do{ - i++; - v >>= 7; - }while( v!=0 ); - return i; -} - -/* -** Convert an SQL-style quoted string into a normal string by removing -** the quote characters. The conversion is done in-place. If the -** input does not begin with a quote character, then this routine -** is a no-op. -** -** Examples: -** -** "abc" becomes abc -** 'xyz' becomes xyz -** [pqr] becomes pqr -** `mno` becomes mno -** -*/ -SQLITE_PRIVATE void sqlite3Fts3Dequote(char *z){ - char quote; /* Quote character (if any ) */ - - quote = z[0]; - if( quote=='[' || quote=='\'' || quote=='"' || quote=='`' ){ - int iIn = 1; /* Index of next byte to read from input */ - int iOut = 0; /* Index of next byte to write to output */ - - /* If the first byte was a '[', then the close-quote character is a ']' */ - if( quote=='[' ) quote = ']'; - - while( ALWAYS(z[iIn]) ){ - if( z[iIn]==quote ){ - if( z[iIn+1]!=quote ) break; - z[iOut++] = quote; - iIn += 2; - }else{ - z[iOut++] = z[iIn++]; - } - } - z[iOut] = '\0'; - } -} - -/* -** Read a single varint from the doclist at *pp and advance *pp to point -** to the first byte past the end of the varint. Add the value of the varint -** to *pVal. -*/ -static void fts3GetDeltaVarint(char **pp, sqlite3_int64 *pVal){ - sqlite3_int64 iVal; - *pp += sqlite3Fts3GetVarint(*pp, &iVal); - *pVal += iVal; -} - -/* -** When this function is called, *pp points to the first byte following a -** varint that is part of a doclist (or position-list, or any other list -** of varints). This function moves *pp to point to the start of that varint, -** and sets *pVal by the varint value. -** -** Argument pStart points to the first byte of the doclist that the -** varint is part of. -*/ -static void fts3GetReverseVarint( - char **pp, - char *pStart, - sqlite3_int64 *pVal -){ - sqlite3_int64 iVal; - char *p; - - /* Pointer p now points at the first byte past the varint we are - ** interested in. So, unless the doclist is corrupt, the 0x80 bit is - ** clear on character p[-1]. */ - for(p = (*pp)-2; p>=pStart && *p&0x80; p--); - p++; - *pp = p; - - sqlite3Fts3GetVarint(p, &iVal); - *pVal = iVal; -} - -/* -** The xDisconnect() virtual table method. -*/ -static int fts3DisconnectMethod(sqlite3_vtab *pVtab){ - Fts3Table *p = (Fts3Table *)pVtab; - int i; - - assert( p->nPendingData==0 ); - assert( p->pSegments==0 ); - - /* Free any prepared statements held */ - for(i=0; iaStmt); i++){ - sqlite3_finalize(p->aStmt[i]); - } - sqlite3_free(p->zSegmentsTbl); - sqlite3_free(p->zReadExprlist); - sqlite3_free(p->zWriteExprlist); - sqlite3_free(p->zContentTbl); - sqlite3_free(p->zLanguageid); - - /* Invoke the tokenizer destructor to free the tokenizer. */ - p->pTokenizer->pModule->xDestroy(p->pTokenizer); - - sqlite3_free(p); - return SQLITE_OK; -} - -/* -** Construct one or more SQL statements from the format string given -** and then evaluate those statements. The success code is written -** into *pRc. -** -** If *pRc is initially non-zero then this routine is a no-op. -*/ -static void fts3DbExec( - int *pRc, /* Success code */ - sqlite3 *db, /* Database in which to run SQL */ - const char *zFormat, /* Format string for SQL */ - ... /* Arguments to the format string */ -){ - va_list ap; - char *zSql; - if( *pRc ) return; - va_start(ap, zFormat); - zSql = sqlite3_vmprintf(zFormat, ap); - va_end(ap); - if( zSql==0 ){ - *pRc = SQLITE_NOMEM; - }else{ - *pRc = sqlite3_exec(db, zSql, 0, 0, 0); - sqlite3_free(zSql); - } -} - -/* -** The xDestroy() virtual table method. -*/ -static int fts3DestroyMethod(sqlite3_vtab *pVtab){ - Fts3Table *p = (Fts3Table *)pVtab; - int rc = SQLITE_OK; /* Return code */ - const char *zDb = p->zDb; /* Name of database (e.g. "main", "temp") */ - sqlite3 *db = p->db; /* Database handle */ - - /* Drop the shadow tables */ - if( p->zContentTbl==0 ){ - fts3DbExec(&rc, db, "DROP TABLE IF EXISTS %Q.'%q_content'", zDb, p->zName); - } - fts3DbExec(&rc, db, "DROP TABLE IF EXISTS %Q.'%q_segments'", zDb,p->zName); - fts3DbExec(&rc, db, "DROP TABLE IF EXISTS %Q.'%q_segdir'", zDb, p->zName); - fts3DbExec(&rc, db, "DROP TABLE IF EXISTS %Q.'%q_docsize'", zDb, p->zName); - fts3DbExec(&rc, db, "DROP TABLE IF EXISTS %Q.'%q_stat'", zDb, p->zName); - - /* If everything has worked, invoke fts3DisconnectMethod() to free the - ** memory associated with the Fts3Table structure and return SQLITE_OK. - ** Otherwise, return an SQLite error code. - */ - return (rc==SQLITE_OK ? fts3DisconnectMethod(pVtab) : rc); -} - - -/* -** Invoke sqlite3_declare_vtab() to declare the schema for the FTS3 table -** passed as the first argument. This is done as part of the xConnect() -** and xCreate() methods. -** -** If *pRc is non-zero when this function is called, it is a no-op. -** Otherwise, if an error occurs, an SQLite error code is stored in *pRc -** before returning. -*/ -static void fts3DeclareVtab(int *pRc, Fts3Table *p){ - if( *pRc==SQLITE_OK ){ - int i; /* Iterator variable */ - int rc; /* Return code */ - char *zSql; /* SQL statement passed to declare_vtab() */ - char *zCols; /* List of user defined columns */ - const char *zLanguageid; - - zLanguageid = (p->zLanguageid ? p->zLanguageid : "__langid"); - sqlite3_vtab_config(p->db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); - - /* Create a list of user columns for the virtual table */ - zCols = sqlite3_mprintf("%Q, ", p->azColumn[0]); - for(i=1; zCols && inColumn; i++){ - zCols = sqlite3_mprintf("%z%Q, ", zCols, p->azColumn[i]); - } - - /* Create the whole "CREATE TABLE" statement to pass to SQLite */ - zSql = sqlite3_mprintf( - "CREATE TABLE x(%s %Q HIDDEN, docid HIDDEN, %Q HIDDEN)", - zCols, p->zName, zLanguageid - ); - if( !zCols || !zSql ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_declare_vtab(p->db, zSql); - } - - sqlite3_free(zSql); - sqlite3_free(zCols); - *pRc = rc; - } -} - -/* -** Create the %_stat table if it does not already exist. -*/ -SQLITE_PRIVATE void sqlite3Fts3CreateStatTable(int *pRc, Fts3Table *p){ - fts3DbExec(pRc, p->db, - "CREATE TABLE IF NOT EXISTS %Q.'%q_stat'" - "(id INTEGER PRIMARY KEY, value BLOB);", - p->zDb, p->zName - ); - if( (*pRc)==SQLITE_OK ) p->bHasStat = 1; -} - -/* -** Create the backing store tables (%_content, %_segments and %_segdir) -** required by the FTS3 table passed as the only argument. This is done -** as part of the vtab xCreate() method. -** -** If the p->bHasDocsize boolean is true (indicating that this is an -** FTS4 table, not an FTS3 table) then also create the %_docsize and -** %_stat tables required by FTS4. -*/ -static int fts3CreateTables(Fts3Table *p){ - int rc = SQLITE_OK; /* Return code */ - int i; /* Iterator variable */ - sqlite3 *db = p->db; /* The database connection */ - - if( p->zContentTbl==0 ){ - const char *zLanguageid = p->zLanguageid; - char *zContentCols; /* Columns of %_content table */ - - /* Create a list of user columns for the content table */ - zContentCols = sqlite3_mprintf("docid INTEGER PRIMARY KEY"); - for(i=0; zContentCols && inColumn; i++){ - char *z = p->azColumn[i]; - zContentCols = sqlite3_mprintf("%z, 'c%d%q'", zContentCols, i, z); - } - if( zLanguageid && zContentCols ){ - zContentCols = sqlite3_mprintf("%z, langid", zContentCols, zLanguageid); - } - if( zContentCols==0 ) rc = SQLITE_NOMEM; - - /* Create the content table */ - fts3DbExec(&rc, db, - "CREATE TABLE %Q.'%q_content'(%s)", - p->zDb, p->zName, zContentCols - ); - sqlite3_free(zContentCols); - } - - /* Create other tables */ - fts3DbExec(&rc, db, - "CREATE TABLE %Q.'%q_segments'(blockid INTEGER PRIMARY KEY, block BLOB);", - p->zDb, p->zName - ); - fts3DbExec(&rc, db, - "CREATE TABLE %Q.'%q_segdir'(" - "level INTEGER," - "idx INTEGER," - "start_block INTEGER," - "leaves_end_block INTEGER," - "end_block INTEGER," - "root BLOB," - "PRIMARY KEY(level, idx)" - ");", - p->zDb, p->zName - ); - if( p->bHasDocsize ){ - fts3DbExec(&rc, db, - "CREATE TABLE %Q.'%q_docsize'(docid INTEGER PRIMARY KEY, size BLOB);", - p->zDb, p->zName - ); - } - assert( p->bHasStat==p->bFts4 ); - if( p->bHasStat ){ - sqlite3Fts3CreateStatTable(&rc, p); - } - return rc; -} - -/* -** Store the current database page-size in bytes in p->nPgsz. -** -** If *pRc is non-zero when this function is called, it is a no-op. -** Otherwise, if an error occurs, an SQLite error code is stored in *pRc -** before returning. -*/ -static void fts3DatabasePageSize(int *pRc, Fts3Table *p){ - if( *pRc==SQLITE_OK ){ - int rc; /* Return code */ - char *zSql; /* SQL text "PRAGMA %Q.page_size" */ - sqlite3_stmt *pStmt; /* Compiled "PRAGMA %Q.page_size" statement */ - - zSql = sqlite3_mprintf("PRAGMA %Q.page_size", p->zDb); - if( !zSql ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0); - if( rc==SQLITE_OK ){ - sqlite3_step(pStmt); - p->nPgsz = sqlite3_column_int(pStmt, 0); - rc = sqlite3_finalize(pStmt); - }else if( rc==SQLITE_AUTH ){ - p->nPgsz = 1024; - rc = SQLITE_OK; - } - } - assert( p->nPgsz>0 || rc!=SQLITE_OK ); - sqlite3_free(zSql); - *pRc = rc; - } -} - -/* -** "Special" FTS4 arguments are column specifications of the following form: -** -** = -** -** There may not be whitespace surrounding the "=" character. The -** term may be quoted, but the may not. -*/ -static int fts3IsSpecialColumn( - const char *z, - int *pnKey, - char **pzValue -){ - char *zValue; - const char *zCsr = z; - - while( *zCsr!='=' ){ - if( *zCsr=='\0' ) return 0; - zCsr++; - } - - *pnKey = (int)(zCsr-z); - zValue = sqlite3_mprintf("%s", &zCsr[1]); - if( zValue ){ - sqlite3Fts3Dequote(zValue); - } - *pzValue = zValue; - return 1; -} - -/* -** Append the output of a printf() style formatting to an existing string. -*/ -static void fts3Appendf( - int *pRc, /* IN/OUT: Error code */ - char **pz, /* IN/OUT: Pointer to string buffer */ - const char *zFormat, /* Printf format string to append */ - ... /* Arguments for printf format string */ -){ - if( *pRc==SQLITE_OK ){ - va_list ap; - char *z; - va_start(ap, zFormat); - z = sqlite3_vmprintf(zFormat, ap); - va_end(ap); - if( z && *pz ){ - char *z2 = sqlite3_mprintf("%s%s", *pz, z); - sqlite3_free(z); - z = z2; - } - if( z==0 ) *pRc = SQLITE_NOMEM; - sqlite3_free(*pz); - *pz = z; - } -} - -/* -** Return a copy of input string zInput enclosed in double-quotes (") and -** with all double quote characters escaped. For example: -** -** fts3QuoteId("un \"zip\"") -> "un \"\"zip\"\"" -** -** The pointer returned points to memory obtained from sqlite3_malloc(). It -** is the callers responsibility to call sqlite3_free() to release this -** memory. -*/ -static char *fts3QuoteId(char const *zInput){ - int nRet; - char *zRet; - nRet = 2 + (int)strlen(zInput)*2 + 1; - zRet = sqlite3_malloc(nRet); - if( zRet ){ - int i; - char *z = zRet; - *(z++) = '"'; - for(i=0; zInput[i]; i++){ - if( zInput[i]=='"' ) *(z++) = '"'; - *(z++) = zInput[i]; - } - *(z++) = '"'; - *(z++) = '\0'; - } - return zRet; -} - -/* -** Return a list of comma separated SQL expressions and a FROM clause that -** could be used in a SELECT statement such as the following: -** -** SELECT FROM %_content AS x ... -** -** to return the docid, followed by each column of text data in order -** from left to write. If parameter zFunc is not NULL, then instead of -** being returned directly each column of text data is passed to an SQL -** function named zFunc first. For example, if zFunc is "unzip" and the -** table has the three user-defined columns "a", "b", and "c", the following -** string is returned: -** -** "docid, unzip(x.'a'), unzip(x.'b'), unzip(x.'c') FROM %_content AS x" -** -** The pointer returned points to a buffer allocated by sqlite3_malloc(). It -** is the responsibility of the caller to eventually free it. -** -** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and -** a NULL pointer is returned). Otherwise, if an OOM error is encountered -** by this function, NULL is returned and *pRc is set to SQLITE_NOMEM. If -** no error occurs, *pRc is left unmodified. -*/ -static char *fts3ReadExprList(Fts3Table *p, const char *zFunc, int *pRc){ - char *zRet = 0; - char *zFree = 0; - char *zFunction; - int i; - - if( p->zContentTbl==0 ){ - if( !zFunc ){ - zFunction = ""; - }else{ - zFree = zFunction = fts3QuoteId(zFunc); - } - fts3Appendf(pRc, &zRet, "docid"); - for(i=0; inColumn; i++){ - fts3Appendf(pRc, &zRet, ",%s(x.'c%d%q')", zFunction, i, p->azColumn[i]); - } - if( p->zLanguageid ){ - fts3Appendf(pRc, &zRet, ", x.%Q", "langid"); - } - sqlite3_free(zFree); - }else{ - fts3Appendf(pRc, &zRet, "rowid"); - for(i=0; inColumn; i++){ - fts3Appendf(pRc, &zRet, ", x.'%q'", p->azColumn[i]); - } - if( p->zLanguageid ){ - fts3Appendf(pRc, &zRet, ", x.%Q", p->zLanguageid); - } - } - fts3Appendf(pRc, &zRet, " FROM '%q'.'%q%s' AS x", - p->zDb, - (p->zContentTbl ? p->zContentTbl : p->zName), - (p->zContentTbl ? "" : "_content") - ); - return zRet; -} - -/* -** Return a list of N comma separated question marks, where N is the number -** of columns in the %_content table (one for the docid plus one for each -** user-defined text column). -** -** If argument zFunc is not NULL, then all but the first question mark -** is preceded by zFunc and an open bracket, and followed by a closed -** bracket. For example, if zFunc is "zip" and the FTS3 table has three -** user-defined text columns, the following string is returned: -** -** "?, zip(?), zip(?), zip(?)" -** -** The pointer returned points to a buffer allocated by sqlite3_malloc(). It -** is the responsibility of the caller to eventually free it. -** -** If *pRc is not SQLITE_OK when this function is called, it is a no-op (and -** a NULL pointer is returned). Otherwise, if an OOM error is encountered -** by this function, NULL is returned and *pRc is set to SQLITE_NOMEM. If -** no error occurs, *pRc is left unmodified. -*/ -static char *fts3WriteExprList(Fts3Table *p, const char *zFunc, int *pRc){ - char *zRet = 0; - char *zFree = 0; - char *zFunction; - int i; - - if( !zFunc ){ - zFunction = ""; - }else{ - zFree = zFunction = fts3QuoteId(zFunc); - } - fts3Appendf(pRc, &zRet, "?"); - for(i=0; inColumn; i++){ - fts3Appendf(pRc, &zRet, ",%s(?)", zFunction); - } - if( p->zLanguageid ){ - fts3Appendf(pRc, &zRet, ", ?"); - } - sqlite3_free(zFree); - return zRet; -} - -/* -** This function interprets the string at (*pp) as a non-negative integer -** value. It reads the integer and sets *pnOut to the value read, then -** sets *pp to point to the byte immediately following the last byte of -** the integer value. -** -** Only decimal digits ('0'..'9') may be part of an integer value. -** -** If *pp does not being with a decimal digit SQLITE_ERROR is returned and -** the output value undefined. Otherwise SQLITE_OK is returned. -** -** This function is used when parsing the "prefix=" FTS4 parameter. -*/ -static int fts3GobbleInt(const char **pp, int *pnOut){ - const char *p; /* Iterator pointer */ - int nInt = 0; /* Output value */ - - for(p=*pp; p[0]>='0' && p[0]<='9'; p++){ - nInt = nInt * 10 + (p[0] - '0'); - } - if( p==*pp ) return SQLITE_ERROR; - *pnOut = nInt; - *pp = p; - return SQLITE_OK; -} - -/* -** This function is called to allocate an array of Fts3Index structures -** representing the indexes maintained by the current FTS table. FTS tables -** always maintain the main "terms" index, but may also maintain one or -** more "prefix" indexes, depending on the value of the "prefix=" parameter -** (if any) specified as part of the CREATE VIRTUAL TABLE statement. -** -** Argument zParam is passed the value of the "prefix=" option if one was -** specified, or NULL otherwise. -** -** If no error occurs, SQLITE_OK is returned and *apIndex set to point to -** the allocated array. *pnIndex is set to the number of elements in the -** array. If an error does occur, an SQLite error code is returned. -** -** Regardless of whether or not an error is returned, it is the responsibility -** of the caller to call sqlite3_free() on the output array to free it. -*/ -static int fts3PrefixParameter( - const char *zParam, /* ABC in prefix=ABC parameter to parse */ - int *pnIndex, /* OUT: size of *apIndex[] array */ - struct Fts3Index **apIndex /* OUT: Array of indexes for this table */ -){ - struct Fts3Index *aIndex; /* Allocated array */ - int nIndex = 1; /* Number of entries in array */ - - if( zParam && zParam[0] ){ - const char *p; - nIndex++; - for(p=zParam; *p; p++){ - if( *p==',' ) nIndex++; - } - } - - aIndex = sqlite3_malloc(sizeof(struct Fts3Index) * nIndex); - *apIndex = aIndex; - *pnIndex = nIndex; - if( !aIndex ){ - return SQLITE_NOMEM; - } - - memset(aIndex, 0, sizeof(struct Fts3Index) * nIndex); - if( zParam ){ - const char *p = zParam; - int i; - for(i=1; i module name ("fts3" or "fts4") -** argv[1] -> database name -** argv[2] -> table name -** argv[...] -> "column name" and other module argument fields. -*/ -static int fts3InitVtab( - int isCreate, /* True for xCreate, false for xConnect */ - sqlite3 *db, /* The SQLite database connection */ - void *pAux, /* Hash table containing tokenizers */ - int argc, /* Number of elements in argv array */ - const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVTab, /* Write the resulting vtab structure here */ - char **pzErr /* Write any error message here */ -){ - Fts3Hash *pHash = (Fts3Hash *)pAux; - Fts3Table *p = 0; /* Pointer to allocated vtab */ - int rc = SQLITE_OK; /* Return code */ - int i; /* Iterator variable */ - int nByte; /* Size of allocation used for *p */ - int iCol; /* Column index */ - int nString = 0; /* Bytes required to hold all column names */ - int nCol = 0; /* Number of columns in the FTS table */ - char *zCsr; /* Space for holding column names */ - int nDb; /* Bytes required to hold database name */ - int nName; /* Bytes required to hold table name */ - int isFts4 = (argv[0][3]=='4'); /* True for FTS4, false for FTS3 */ - const char **aCol; /* Array of column names */ - sqlite3_tokenizer *pTokenizer = 0; /* Tokenizer for this table */ - - int nIndex; /* Size of aIndex[] array */ - struct Fts3Index *aIndex = 0; /* Array of indexes for this table */ - - /* The results of parsing supported FTS4 key=value options: */ - int bNoDocsize = 0; /* True to omit %_docsize table */ - int bDescIdx = 0; /* True to store descending indexes */ - char *zPrefix = 0; /* Prefix parameter value (or NULL) */ - char *zCompress = 0; /* compress=? parameter (or NULL) */ - char *zUncompress = 0; /* uncompress=? parameter (or NULL) */ - char *zContent = 0; /* content=? parameter (or NULL) */ - char *zLanguageid = 0; /* languageid=? parameter (or NULL) */ - char **azNotindexed = 0; /* The set of notindexed= columns */ - int nNotindexed = 0; /* Size of azNotindexed[] array */ - - assert( strlen(argv[0])==4 ); - assert( (sqlite3_strnicmp(argv[0], "fts4", 4)==0 && isFts4) - || (sqlite3_strnicmp(argv[0], "fts3", 4)==0 && !isFts4) - ); - - nDb = (int)strlen(argv[1]) + 1; - nName = (int)strlen(argv[2]) + 1; - - nByte = sizeof(const char *) * (argc-2); - aCol = (const char **)sqlite3_malloc(nByte); - if( aCol ){ - memset((void*)aCol, 0, nByte); - azNotindexed = (char **)sqlite3_malloc(nByte); - } - if( azNotindexed ){ - memset(azNotindexed, 0, nByte); - } - if( !aCol || !azNotindexed ){ - rc = SQLITE_NOMEM; - goto fts3_init_out; - } - - /* Loop through all of the arguments passed by the user to the FTS3/4 - ** module (i.e. all the column names and special arguments). This loop - ** does the following: - ** - ** + Figures out the number of columns the FTSX table will have, and - ** the number of bytes of space that must be allocated to store copies - ** of the column names. - ** - ** + If there is a tokenizer specification included in the arguments, - ** initializes the tokenizer pTokenizer. - */ - for(i=3; rc==SQLITE_OK && i8 - && 0==sqlite3_strnicmp(z, "tokenize", 8) - && 0==sqlite3Fts3IsIdChar(z[8]) - ){ - rc = sqlite3Fts3InitTokenizer(pHash, &z[9], &pTokenizer, pzErr); - } - - /* Check if it is an FTS4 special argument. */ - else if( isFts4 && fts3IsSpecialColumn(z, &nKey, &zVal) ){ - struct Fts4Option { - const char *zOpt; - int nOpt; - } aFts4Opt[] = { - { "matchinfo", 9 }, /* 0 -> MATCHINFO */ - { "prefix", 6 }, /* 1 -> PREFIX */ - { "compress", 8 }, /* 2 -> COMPRESS */ - { "uncompress", 10 }, /* 3 -> UNCOMPRESS */ - { "order", 5 }, /* 4 -> ORDER */ - { "content", 7 }, /* 5 -> CONTENT */ - { "languageid", 10 }, /* 6 -> LANGUAGEID */ - { "notindexed", 10 } /* 7 -> NOTINDEXED */ - }; - - int iOpt; - if( !zVal ){ - rc = SQLITE_NOMEM; - }else{ - for(iOpt=0; iOptnOpt && !sqlite3_strnicmp(z, pOp->zOpt, pOp->nOpt) ){ - break; - } - } - if( iOpt==SizeofArray(aFts4Opt) ){ - *pzErr = sqlite3_mprintf("unrecognized parameter: %s", z); - rc = SQLITE_ERROR; - }else{ - switch( iOpt ){ - case 0: /* MATCHINFO */ - if( strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "fts3", 4) ){ - *pzErr = sqlite3_mprintf("unrecognized matchinfo: %s", zVal); - rc = SQLITE_ERROR; - } - bNoDocsize = 1; - break; - - case 1: /* PREFIX */ - sqlite3_free(zPrefix); - zPrefix = zVal; - zVal = 0; - break; - - case 2: /* COMPRESS */ - sqlite3_free(zCompress); - zCompress = zVal; - zVal = 0; - break; - - case 3: /* UNCOMPRESS */ - sqlite3_free(zUncompress); - zUncompress = zVal; - zVal = 0; - break; - - case 4: /* ORDER */ - if( (strlen(zVal)!=3 || sqlite3_strnicmp(zVal, "asc", 3)) - && (strlen(zVal)!=4 || sqlite3_strnicmp(zVal, "desc", 4)) - ){ - *pzErr = sqlite3_mprintf("unrecognized order: %s", zVal); - rc = SQLITE_ERROR; - } - bDescIdx = (zVal[0]=='d' || zVal[0]=='D'); - break; - - case 5: /* CONTENT */ - sqlite3_free(zContent); - zContent = zVal; - zVal = 0; - break; - - case 6: /* LANGUAGEID */ - assert( iOpt==6 ); - sqlite3_free(zLanguageid); - zLanguageid = zVal; - zVal = 0; - break; - - case 7: /* NOTINDEXED */ - azNotindexed[nNotindexed++] = zVal; - zVal = 0; - break; - } - } - sqlite3_free(zVal); - } - } - - /* Otherwise, the argument is a column name. */ - else { - nString += (int)(strlen(z) + 1); - aCol[nCol++] = z; - } - } - - /* If a content=xxx option was specified, the following: - ** - ** 1. Ignore any compress= and uncompress= options. - ** - ** 2. If no column names were specified as part of the CREATE VIRTUAL - ** TABLE statement, use all columns from the content table. - */ - if( rc==SQLITE_OK && zContent ){ - sqlite3_free(zCompress); - sqlite3_free(zUncompress); - zCompress = 0; - zUncompress = 0; - if( nCol==0 ){ - sqlite3_free((void*)aCol); - aCol = 0; - rc = fts3ContentColumns(db, argv[1], zContent, &aCol, &nCol, &nString); - - /* If a languageid= option was specified, remove the language id - ** column from the aCol[] array. */ - if( rc==SQLITE_OK && zLanguageid ){ - int j; - for(j=0; jdb = db; - p->nColumn = nCol; - p->nPendingData = 0; - p->azColumn = (char **)&p[1]; - p->pTokenizer = pTokenizer; - p->nMaxPendingData = FTS3_MAX_PENDING_DATA; - p->bHasDocsize = (isFts4 && bNoDocsize==0); - p->bHasStat = isFts4; - p->bFts4 = isFts4; - p->bDescIdx = bDescIdx; - p->bAutoincrmerge = 0xff; /* 0xff means setting unknown */ - p->zContentTbl = zContent; - p->zLanguageid = zLanguageid; - zContent = 0; - zLanguageid = 0; - TESTONLY( p->inTransaction = -1 ); - TESTONLY( p->mxSavepoint = -1 ); - - p->aIndex = (struct Fts3Index *)&p->azColumn[nCol]; - memcpy(p->aIndex, aIndex, sizeof(struct Fts3Index) * nIndex); - p->nIndex = nIndex; - for(i=0; iaIndex[i].hPending, FTS3_HASH_STRING, 1); - } - p->abNotindexed = (u8 *)&p->aIndex[nIndex]; - - /* Fill in the zName and zDb fields of the vtab structure. */ - zCsr = (char *)&p->abNotindexed[nCol]; - p->zName = zCsr; - memcpy(zCsr, argv[2], nName); - zCsr += nName; - p->zDb = zCsr; - memcpy(zCsr, argv[1], nDb); - zCsr += nDb; - - /* Fill in the azColumn array */ - for(iCol=0; iColazColumn[iCol] = zCsr; - zCsr += n+1; - assert( zCsr <= &((char *)p)[nByte] ); - } - - /* Fill in the abNotindexed array */ - for(iCol=0; iColazColumn[iCol]); - for(i=0; iazColumn[iCol], zNot, n) ){ - p->abNotindexed[iCol] = 1; - sqlite3_free(zNot); - azNotindexed[i] = 0; - } - } - } - for(i=0; izReadExprlist = fts3ReadExprList(p, zUncompress, &rc); - p->zWriteExprlist = fts3WriteExprList(p, zCompress, &rc); - if( rc!=SQLITE_OK ) goto fts3_init_out; - - /* If this is an xCreate call, create the underlying tables in the - ** database. TODO: For xConnect(), it could verify that said tables exist. - */ - if( isCreate ){ - rc = fts3CreateTables(p); - } - - /* Check to see if a legacy fts3 table has been "upgraded" by the - ** addition of a %_stat table so that it can use incremental merge. - */ - if( !isFts4 && !isCreate ){ - int rc2 = SQLITE_OK; - fts3DbExec(&rc2, db, "SELECT 1 FROM %Q.'%q_stat' WHERE id=2", - p->zDb, p->zName); - if( rc2==SQLITE_OK ) p->bHasStat = 1; - } - - /* Figure out the page-size for the database. This is required in order to - ** estimate the cost of loading large doclists from the database. */ - fts3DatabasePageSize(&rc, p); - p->nNodeSize = p->nPgsz-35; - - /* Declare the table schema to SQLite. */ - fts3DeclareVtab(&rc, p); - -fts3_init_out: - sqlite3_free(zPrefix); - sqlite3_free(aIndex); - sqlite3_free(zCompress); - sqlite3_free(zUncompress); - sqlite3_free(zContent); - sqlite3_free(zLanguageid); - for(i=0; ipModule->xDestroy(pTokenizer); - } - }else{ - assert( p->pSegments==0 ); - *ppVTab = &p->base; - } - return rc; -} - -/* -** The xConnect() and xCreate() methods for the virtual table. All the -** work is done in function fts3InitVtab(). -*/ -static int fts3ConnectMethod( - sqlite3 *db, /* Database connection */ - void *pAux, /* Pointer to tokenizer hash table */ - int argc, /* Number of elements in argv array */ - const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ -){ - return fts3InitVtab(0, db, pAux, argc, argv, ppVtab, pzErr); -} -static int fts3CreateMethod( - sqlite3 *db, /* Database connection */ - void *pAux, /* Pointer to tokenizer hash table */ - int argc, /* Number of elements in argv array */ - const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ -){ - return fts3InitVtab(1, db, pAux, argc, argv, ppVtab, pzErr); -} - -/* -** Set the pIdxInfo->estimatedRows variable to nRow. Unless this -** extension is currently being used by a version of SQLite too old to -** support estimatedRows. In that case this function is a no-op. -*/ -static void fts3SetEstimatedRows(sqlite3_index_info *pIdxInfo, i64 nRow){ -#if SQLITE_VERSION_NUMBER>=3008002 - if( sqlite3_libversion_number()>=3008002 ){ - pIdxInfo->estimatedRows = nRow; - } -#endif -} - -/* -** Implementation of the xBestIndex method for FTS3 tables. There -** are three possible strategies, in order of preference: -** -** 1. Direct lookup by rowid or docid. -** 2. Full-text search using a MATCH operator on a non-docid column. -** 3. Linear scan of %_content table. -*/ -static int fts3BestIndexMethod(sqlite3_vtab *pVTab, sqlite3_index_info *pInfo){ - Fts3Table *p = (Fts3Table *)pVTab; - int i; /* Iterator variable */ - int iCons = -1; /* Index of constraint to use */ - - int iLangidCons = -1; /* Index of langid=x constraint, if present */ - int iDocidGe = -1; /* Index of docid>=x constraint, if present */ - int iDocidLe = -1; /* Index of docid<=x constraint, if present */ - int iIdx; - - /* By default use a full table scan. This is an expensive option, - ** so search through the constraints to see if a more efficient - ** strategy is possible. - */ - pInfo->idxNum = FTS3_FULLSCAN_SEARCH; - pInfo->estimatedCost = 5000000; - for(i=0; inConstraint; i++){ - int bDocid; /* True if this constraint is on docid */ - struct sqlite3_index_constraint *pCons = &pInfo->aConstraint[i]; - if( pCons->usable==0 ){ - if( pCons->op==SQLITE_INDEX_CONSTRAINT_MATCH ){ - /* There exists an unusable MATCH constraint. This means that if - ** the planner does elect to use the results of this call as part - ** of the overall query plan the user will see an "unable to use - ** function MATCH in the requested context" error. To discourage - ** this, return a very high cost here. */ - pInfo->idxNum = FTS3_FULLSCAN_SEARCH; - pInfo->estimatedCost = SQLITE_HUGE_COST; - fts3SetEstimatedRows(pInfo, ((sqlite3_int64)1) << 50); - return SQLITE_OK; - } - continue; - } - - bDocid = (pCons->iColumn<0 || pCons->iColumn==p->nColumn+1); - - /* A direct lookup on the rowid or docid column. Assign a cost of 1.0. */ - if( iCons<0 && pCons->op==SQLITE_INDEX_CONSTRAINT_EQ && bDocid ){ - pInfo->idxNum = FTS3_DOCID_SEARCH; - pInfo->estimatedCost = 1.0; - iCons = i; - } - - /* A MATCH constraint. Use a full-text search. - ** - ** If there is more than one MATCH constraint available, use the first - ** one encountered. If there is both a MATCH constraint and a direct - ** rowid/docid lookup, prefer the MATCH strategy. This is done even - ** though the rowid/docid lookup is faster than a MATCH query, selecting - ** it would lead to an "unable to use function MATCH in the requested - ** context" error. - */ - if( pCons->op==SQLITE_INDEX_CONSTRAINT_MATCH - && pCons->iColumn>=0 && pCons->iColumn<=p->nColumn - ){ - pInfo->idxNum = FTS3_FULLTEXT_SEARCH + pCons->iColumn; - pInfo->estimatedCost = 2.0; - iCons = i; - } - - /* Equality constraint on the langid column */ - if( pCons->op==SQLITE_INDEX_CONSTRAINT_EQ - && pCons->iColumn==p->nColumn + 2 - ){ - iLangidCons = i; - } - - if( bDocid ){ - switch( pCons->op ){ - case SQLITE_INDEX_CONSTRAINT_GE: - case SQLITE_INDEX_CONSTRAINT_GT: - iDocidGe = i; - break; - - case SQLITE_INDEX_CONSTRAINT_LE: - case SQLITE_INDEX_CONSTRAINT_LT: - iDocidLe = i; - break; - } - } - } - - iIdx = 1; - if( iCons>=0 ){ - pInfo->aConstraintUsage[iCons].argvIndex = iIdx++; - pInfo->aConstraintUsage[iCons].omit = 1; - } - if( iLangidCons>=0 ){ - pInfo->idxNum |= FTS3_HAVE_LANGID; - pInfo->aConstraintUsage[iLangidCons].argvIndex = iIdx++; - } - if( iDocidGe>=0 ){ - pInfo->idxNum |= FTS3_HAVE_DOCID_GE; - pInfo->aConstraintUsage[iDocidGe].argvIndex = iIdx++; - } - if( iDocidLe>=0 ){ - pInfo->idxNum |= FTS3_HAVE_DOCID_LE; - pInfo->aConstraintUsage[iDocidLe].argvIndex = iIdx++; - } - - /* Regardless of the strategy selected, FTS can deliver rows in rowid (or - ** docid) order. Both ascending and descending are possible. - */ - if( pInfo->nOrderBy==1 ){ - struct sqlite3_index_orderby *pOrder = &pInfo->aOrderBy[0]; - if( pOrder->iColumn<0 || pOrder->iColumn==p->nColumn+1 ){ - if( pOrder->desc ){ - pInfo->idxStr = "DESC"; - }else{ - pInfo->idxStr = "ASC"; - } - pInfo->orderByConsumed = 1; - } - } - - assert( p->pSegments==0 ); - return SQLITE_OK; -} - -/* -** Implementation of xOpen method. -*/ -static int fts3OpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ - sqlite3_vtab_cursor *pCsr; /* Allocated cursor */ - - UNUSED_PARAMETER(pVTab); - - /* Allocate a buffer large enough for an Fts3Cursor structure. If the - ** allocation succeeds, zero it and return SQLITE_OK. Otherwise, - ** if the allocation fails, return SQLITE_NOMEM. - */ - *ppCsr = pCsr = (sqlite3_vtab_cursor *)sqlite3_malloc(sizeof(Fts3Cursor)); - if( !pCsr ){ - return SQLITE_NOMEM; - } - memset(pCsr, 0, sizeof(Fts3Cursor)); - return SQLITE_OK; -} - -/* -** Close the cursor. For additional information see the documentation -** on the xClose method of the virtual table interface. -*/ -static int fts3CloseMethod(sqlite3_vtab_cursor *pCursor){ - Fts3Cursor *pCsr = (Fts3Cursor *)pCursor; - assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 ); - sqlite3_finalize(pCsr->pStmt); - sqlite3Fts3ExprFree(pCsr->pExpr); - sqlite3Fts3FreeDeferredTokens(pCsr); - sqlite3_free(pCsr->aDoclist); - sqlite3_free(pCsr->aMatchinfo); - assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 ); - sqlite3_free(pCsr); - return SQLITE_OK; -} - -/* -** If pCsr->pStmt has not been prepared (i.e. if pCsr->pStmt==0), then -** compose and prepare an SQL statement of the form: -** -** "SELECT FROM %_content WHERE rowid = ?" -** -** (or the equivalent for a content=xxx table) and set pCsr->pStmt to -** it. If an error occurs, return an SQLite error code. -** -** Otherwise, set *ppStmt to point to pCsr->pStmt and return SQLITE_OK. -*/ -static int fts3CursorSeekStmt(Fts3Cursor *pCsr, sqlite3_stmt **ppStmt){ - int rc = SQLITE_OK; - if( pCsr->pStmt==0 ){ - Fts3Table *p = (Fts3Table *)pCsr->base.pVtab; - char *zSql; - zSql = sqlite3_mprintf("SELECT %s WHERE rowid = ?", p->zReadExprlist); - if( !zSql ) return SQLITE_NOMEM; - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0); - sqlite3_free(zSql); - } - *ppStmt = pCsr->pStmt; - return rc; -} - -/* -** Position the pCsr->pStmt statement so that it is on the row -** of the %_content table that contains the last match. Return -** SQLITE_OK on success. -*/ -static int fts3CursorSeek(sqlite3_context *pContext, Fts3Cursor *pCsr){ - int rc = SQLITE_OK; - if( pCsr->isRequireSeek ){ - sqlite3_stmt *pStmt = 0; - - rc = fts3CursorSeekStmt(pCsr, &pStmt); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pCsr->pStmt, 1, pCsr->iPrevId); - pCsr->isRequireSeek = 0; - if( SQLITE_ROW==sqlite3_step(pCsr->pStmt) ){ - return SQLITE_OK; - }else{ - rc = sqlite3_reset(pCsr->pStmt); - if( rc==SQLITE_OK && ((Fts3Table *)pCsr->base.pVtab)->zContentTbl==0 ){ - /* If no row was found and no error has occurred, then the %_content - ** table is missing a row that is present in the full-text index. - ** The data structures are corrupt. */ - rc = FTS_CORRUPT_VTAB; - pCsr->isEof = 1; - } - } - } - } - - if( rc!=SQLITE_OK && pContext ){ - sqlite3_result_error_code(pContext, rc); - } - return rc; -} - -/* -** This function is used to process a single interior node when searching -** a b-tree for a term or term prefix. The node data is passed to this -** function via the zNode/nNode parameters. The term to search for is -** passed in zTerm/nTerm. -** -** If piFirst is not NULL, then this function sets *piFirst to the blockid -** of the child node that heads the sub-tree that may contain the term. -** -** If piLast is not NULL, then *piLast is set to the right-most child node -** that heads a sub-tree that may contain a term for which zTerm/nTerm is -** a prefix. -** -** If an OOM error occurs, SQLITE_NOMEM is returned. Otherwise, SQLITE_OK. -*/ -static int fts3ScanInteriorNode( - const char *zTerm, /* Term to select leaves for */ - int nTerm, /* Size of term zTerm in bytes */ - const char *zNode, /* Buffer containing segment interior node */ - int nNode, /* Size of buffer at zNode */ - sqlite3_int64 *piFirst, /* OUT: Selected child node */ - sqlite3_int64 *piLast /* OUT: Selected child node */ -){ - int rc = SQLITE_OK; /* Return code */ - const char *zCsr = zNode; /* Cursor to iterate through node */ - const char *zEnd = &zCsr[nNode];/* End of interior node buffer */ - char *zBuffer = 0; /* Buffer to load terms into */ - int nAlloc = 0; /* Size of allocated buffer */ - int isFirstTerm = 1; /* True when processing first term on page */ - sqlite3_int64 iChild; /* Block id of child node to descend to */ - - /* Skip over the 'height' varint that occurs at the start of every - ** interior node. Then load the blockid of the left-child of the b-tree - ** node into variable iChild. - ** - ** Even if the data structure on disk is corrupted, this (reading two - ** varints from the buffer) does not risk an overread. If zNode is a - ** root node, then the buffer comes from a SELECT statement. SQLite does - ** not make this guarantee explicitly, but in practice there are always - ** either more than 20 bytes of allocated space following the nNode bytes of - ** contents, or two zero bytes. Or, if the node is read from the %_segments - ** table, then there are always 20 bytes of zeroed padding following the - ** nNode bytes of content (see sqlite3Fts3ReadBlock() for details). - */ - zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); - zCsr += sqlite3Fts3GetVarint(zCsr, &iChild); - if( zCsr>zEnd ){ - return FTS_CORRUPT_VTAB; - } - - while( zCsrzEnd ){ - rc = FTS_CORRUPT_VTAB; - goto finish_scan; - } - if( nPrefix+nSuffix>nAlloc ){ - char *zNew; - nAlloc = (nPrefix+nSuffix) * 2; - zNew = (char *)sqlite3_realloc(zBuffer, nAlloc); - if( !zNew ){ - rc = SQLITE_NOMEM; - goto finish_scan; - } - zBuffer = zNew; - } - assert( zBuffer ); - memcpy(&zBuffer[nPrefix], zCsr, nSuffix); - nBuffer = nPrefix + nSuffix; - zCsr += nSuffix; - - /* Compare the term we are searching for with the term just loaded from - ** the interior node. If the specified term is greater than or equal - ** to the term from the interior node, then all terms on the sub-tree - ** headed by node iChild are smaller than zTerm. No need to search - ** iChild. - ** - ** If the interior node term is larger than the specified term, then - ** the tree headed by iChild may contain the specified term. - */ - cmp = memcmp(zTerm, zBuffer, (nBuffer>nTerm ? nTerm : nBuffer)); - if( piFirst && (cmp<0 || (cmp==0 && nBuffer>nTerm)) ){ - *piFirst = iChild; - piFirst = 0; - } - - if( piLast && cmp<0 ){ - *piLast = iChild; - piLast = 0; - } - - iChild++; - }; - - if( piFirst ) *piFirst = iChild; - if( piLast ) *piLast = iChild; - - finish_scan: - sqlite3_free(zBuffer); - return rc; -} - - -/* -** The buffer pointed to by argument zNode (size nNode bytes) contains an -** interior node of a b-tree segment. The zTerm buffer (size nTerm bytes) -** contains a term. This function searches the sub-tree headed by the zNode -** node for the range of leaf nodes that may contain the specified term -** or terms for which the specified term is a prefix. -** -** If piLeaf is not NULL, then *piLeaf is set to the blockid of the -** left-most leaf node in the tree that may contain the specified term. -** If piLeaf2 is not NULL, then *piLeaf2 is set to the blockid of the -** right-most leaf node that may contain a term for which the specified -** term is a prefix. -** -** It is possible that the range of returned leaf nodes does not contain -** the specified term or any terms for which it is a prefix. However, if the -** segment does contain any such terms, they are stored within the identified -** range. Because this function only inspects interior segment nodes (and -** never loads leaf nodes into memory), it is not possible to be sure. -** -** If an error occurs, an error code other than SQLITE_OK is returned. -*/ -static int fts3SelectLeaf( - Fts3Table *p, /* Virtual table handle */ - const char *zTerm, /* Term to select leaves for */ - int nTerm, /* Size of term zTerm in bytes */ - const char *zNode, /* Buffer containing segment interior node */ - int nNode, /* Size of buffer at zNode */ - sqlite3_int64 *piLeaf, /* Selected leaf node */ - sqlite3_int64 *piLeaf2 /* Selected leaf node */ -){ - int rc; /* Return code */ - int iHeight; /* Height of this node in tree */ - - assert( piLeaf || piLeaf2 ); - - fts3GetVarint32(zNode, &iHeight); - rc = fts3ScanInteriorNode(zTerm, nTerm, zNode, nNode, piLeaf, piLeaf2); - assert( !piLeaf2 || !piLeaf || rc!=SQLITE_OK || (*piLeaf<=*piLeaf2) ); - - if( rc==SQLITE_OK && iHeight>1 ){ - char *zBlob = 0; /* Blob read from %_segments table */ - int nBlob; /* Size of zBlob in bytes */ - - if( piLeaf && piLeaf2 && (*piLeaf!=*piLeaf2) ){ - rc = sqlite3Fts3ReadBlock(p, *piLeaf, &zBlob, &nBlob, 0); - if( rc==SQLITE_OK ){ - rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, 0); - } - sqlite3_free(zBlob); - piLeaf = 0; - zBlob = 0; - } - - if( rc==SQLITE_OK ){ - rc = sqlite3Fts3ReadBlock(p, piLeaf?*piLeaf:*piLeaf2, &zBlob, &nBlob, 0); - } - if( rc==SQLITE_OK ){ - rc = fts3SelectLeaf(p, zTerm, nTerm, zBlob, nBlob, piLeaf, piLeaf2); - } - sqlite3_free(zBlob); - } - - return rc; -} - -/* -** This function is used to create delta-encoded serialized lists of FTS3 -** varints. Each call to this function appends a single varint to a list. -*/ -static void fts3PutDeltaVarint( - char **pp, /* IN/OUT: Output pointer */ - sqlite3_int64 *piPrev, /* IN/OUT: Previous value written to list */ - sqlite3_int64 iVal /* Write this value to the list */ -){ - assert( iVal-*piPrev > 0 || (*piPrev==0 && iVal==0) ); - *pp += sqlite3Fts3PutVarint(*pp, iVal-*piPrev); - *piPrev = iVal; -} - -/* -** When this function is called, *ppPoslist is assumed to point to the -** start of a position-list. After it returns, *ppPoslist points to the -** first byte after the position-list. -** -** A position list is list of positions (delta encoded) and columns for -** a single document record of a doclist. So, in other words, this -** routine advances *ppPoslist so that it points to the next docid in -** the doclist, or to the first byte past the end of the doclist. -** -** If pp is not NULL, then the contents of the position list are copied -** to *pp. *pp is set to point to the first byte past the last byte copied -** before this function returns. -*/ -static void fts3PoslistCopy(char **pp, char **ppPoslist){ - char *pEnd = *ppPoslist; - char c = 0; - - /* The end of a position list is marked by a zero encoded as an FTS3 - ** varint. A single POS_END (0) byte. Except, if the 0 byte is preceded by - ** a byte with the 0x80 bit set, then it is not a varint 0, but the tail - ** of some other, multi-byte, value. - ** - ** The following while-loop moves pEnd to point to the first byte that is not - ** immediately preceded by a byte with the 0x80 bit set. Then increments - ** pEnd once more so that it points to the byte immediately following the - ** last byte in the position-list. - */ - while( *pEnd | c ){ - c = *pEnd++ & 0x80; - testcase( c!=0 && (*pEnd)==0 ); - } - pEnd++; /* Advance past the POS_END terminator byte */ - - if( pp ){ - int n = (int)(pEnd - *ppPoslist); - char *p = *pp; - memcpy(p, *ppPoslist, n); - p += n; - *pp = p; - } - *ppPoslist = pEnd; -} - -/* -** When this function is called, *ppPoslist is assumed to point to the -** start of a column-list. After it returns, *ppPoslist points to the -** to the terminator (POS_COLUMN or POS_END) byte of the column-list. -** -** A column-list is list of delta-encoded positions for a single column -** within a single document within a doclist. -** -** The column-list is terminated either by a POS_COLUMN varint (1) or -** a POS_END varint (0). This routine leaves *ppPoslist pointing to -** the POS_COLUMN or POS_END that terminates the column-list. -** -** If pp is not NULL, then the contents of the column-list are copied -** to *pp. *pp is set to point to the first byte past the last byte copied -** before this function returns. The POS_COLUMN or POS_END terminator -** is not copied into *pp. -*/ -static void fts3ColumnlistCopy(char **pp, char **ppPoslist){ - char *pEnd = *ppPoslist; - char c = 0; - - /* A column-list is terminated by either a 0x01 or 0x00 byte that is - ** not part of a multi-byte varint. - */ - while( 0xFE & (*pEnd | c) ){ - c = *pEnd++ & 0x80; - testcase( c!=0 && ((*pEnd)&0xfe)==0 ); - } - if( pp ){ - int n = (int)(pEnd - *ppPoslist); - char *p = *pp; - memcpy(p, *ppPoslist, n); - p += n; - *pp = p; - } - *ppPoslist = pEnd; -} - -/* -** Value used to signify the end of an position-list. This is safe because -** it is not possible to have a document with 2^31 terms. -*/ -#define POSITION_LIST_END 0x7fffffff - -/* -** This function is used to help parse position-lists. When this function is -** called, *pp may point to the start of the next varint in the position-list -** being parsed, or it may point to 1 byte past the end of the position-list -** (in which case **pp will be a terminator bytes POS_END (0) or -** (1)). -** -** If *pp points past the end of the current position-list, set *pi to -** POSITION_LIST_END and return. Otherwise, read the next varint from *pp, -** increment the current value of *pi by the value read, and set *pp to -** point to the next value before returning. -** -** Before calling this routine *pi must be initialized to the value of -** the previous position, or zero if we are reading the first position -** in the position-list. Because positions are delta-encoded, the value -** of the previous position is needed in order to compute the value of -** the next position. -*/ -static void fts3ReadNextPos( - char **pp, /* IN/OUT: Pointer into position-list buffer */ - sqlite3_int64 *pi /* IN/OUT: Value read from position-list */ -){ - if( (**pp)&0xFE ){ - fts3GetDeltaVarint(pp, pi); - *pi -= 2; - }else{ - *pi = POSITION_LIST_END; - } -} - -/* -** If parameter iCol is not 0, write an POS_COLUMN (1) byte followed by -** the value of iCol encoded as a varint to *pp. This will start a new -** column list. -** -** Set *pp to point to the byte just after the last byte written before -** returning (do not modify it if iCol==0). Return the total number of bytes -** written (0 if iCol==0). -*/ -static int fts3PutColNumber(char **pp, int iCol){ - int n = 0; /* Number of bytes written */ - if( iCol ){ - char *p = *pp; /* Output pointer */ - n = 1 + sqlite3Fts3PutVarint(&p[1], iCol); - *p = 0x01; - *pp = &p[n]; - } - return n; -} - -/* -** Compute the union of two position lists. The output written -** into *pp contains all positions of both *pp1 and *pp2 in sorted -** order and with any duplicates removed. All pointers are -** updated appropriately. The caller is responsible for insuring -** that there is enough space in *pp to hold the complete output. -*/ -static void fts3PoslistMerge( - char **pp, /* Output buffer */ - char **pp1, /* Left input list */ - char **pp2 /* Right input list */ -){ - char *p = *pp; - char *p1 = *pp1; - char *p2 = *pp2; - - while( *p1 || *p2 ){ - int iCol1; /* The current column index in pp1 */ - int iCol2; /* The current column index in pp2 */ - - if( *p1==POS_COLUMN ) fts3GetVarint32(&p1[1], &iCol1); - else if( *p1==POS_END ) iCol1 = POSITION_LIST_END; - else iCol1 = 0; - - if( *p2==POS_COLUMN ) fts3GetVarint32(&p2[1], &iCol2); - else if( *p2==POS_END ) iCol2 = POSITION_LIST_END; - else iCol2 = 0; - - if( iCol1==iCol2 ){ - sqlite3_int64 i1 = 0; /* Last position from pp1 */ - sqlite3_int64 i2 = 0; /* Last position from pp2 */ - sqlite3_int64 iPrev = 0; - int n = fts3PutColNumber(&p, iCol1); - p1 += n; - p2 += n; - - /* At this point, both p1 and p2 point to the start of column-lists - ** for the same column (the column with index iCol1 and iCol2). - ** A column-list is a list of non-negative delta-encoded varints, each - ** incremented by 2 before being stored. Each list is terminated by a - ** POS_END (0) or POS_COLUMN (1). The following block merges the two lists - ** and writes the results to buffer p. p is left pointing to the byte - ** after the list written. No terminator (POS_END or POS_COLUMN) is - ** written to the output. - */ - fts3GetDeltaVarint(&p1, &i1); - fts3GetDeltaVarint(&p2, &i2); - do { - fts3PutDeltaVarint(&p, &iPrev, (i1pos(*pp1) && pos(*pp2)-pos(*pp1)<=nToken). i.e. -** when the *pp1 token appears before the *pp2 token, but not more than nToken -** slots before it. -** -** e.g. nToken==1 searches for adjacent positions. -*/ -static int fts3PoslistPhraseMerge( - char **pp, /* IN/OUT: Preallocated output buffer */ - int nToken, /* Maximum difference in token positions */ - int isSaveLeft, /* Save the left position */ - int isExact, /* If *pp1 is exactly nTokens before *pp2 */ - char **pp1, /* IN/OUT: Left input list */ - char **pp2 /* IN/OUT: Right input list */ -){ - char *p = *pp; - char *p1 = *pp1; - char *p2 = *pp2; - int iCol1 = 0; - int iCol2 = 0; - - /* Never set both isSaveLeft and isExact for the same invocation. */ - assert( isSaveLeft==0 || isExact==0 ); - - assert( p!=0 && *p1!=0 && *p2!=0 ); - if( *p1==POS_COLUMN ){ - p1++; - p1 += fts3GetVarint32(p1, &iCol1); - } - if( *p2==POS_COLUMN ){ - p2++; - p2 += fts3GetVarint32(p2, &iCol2); - } - - while( 1 ){ - if( iCol1==iCol2 ){ - char *pSave = p; - sqlite3_int64 iPrev = 0; - sqlite3_int64 iPos1 = 0; - sqlite3_int64 iPos2 = 0; - - if( iCol1 ){ - *p++ = POS_COLUMN; - p += sqlite3Fts3PutVarint(p, iCol1); - } - - assert( *p1!=POS_END && *p1!=POS_COLUMN ); - assert( *p2!=POS_END && *p2!=POS_COLUMN ); - fts3GetDeltaVarint(&p1, &iPos1); iPos1 -= 2; - fts3GetDeltaVarint(&p2, &iPos2); iPos2 -= 2; - - while( 1 ){ - if( iPos2==iPos1+nToken - || (isExact==0 && iPos2>iPos1 && iPos2<=iPos1+nToken) - ){ - sqlite3_int64 iSave; - iSave = isSaveLeft ? iPos1 : iPos2; - fts3PutDeltaVarint(&p, &iPrev, iSave+2); iPrev -= 2; - pSave = 0; - assert( p ); - } - if( (!isSaveLeft && iPos2<=(iPos1+nToken)) || iPos2<=iPos1 ){ - if( (*p2&0xFE)==0 ) break; - fts3GetDeltaVarint(&p2, &iPos2); iPos2 -= 2; - }else{ - if( (*p1&0xFE)==0 ) break; - fts3GetDeltaVarint(&p1, &iPos1); iPos1 -= 2; - } - } - - if( pSave ){ - assert( pp && p ); - p = pSave; - } - - fts3ColumnlistCopy(0, &p1); - fts3ColumnlistCopy(0, &p2); - assert( (*p1&0xFE)==0 && (*p2&0xFE)==0 ); - if( 0==*p1 || 0==*p2 ) break; - - p1++; - p1 += fts3GetVarint32(p1, &iCol1); - p2++; - p2 += fts3GetVarint32(p2, &iCol2); - } - - /* Advance pointer p1 or p2 (whichever corresponds to the smaller of - ** iCol1 and iCol2) so that it points to either the 0x00 that marks the - ** end of the position list, or the 0x01 that precedes the next - ** column-number in the position list. - */ - else if( iCol1=pEnd ){ - *pp = 0; - }else{ - sqlite3_int64 iVal; - *pp += sqlite3Fts3GetVarint(*pp, &iVal); - if( bDescIdx ){ - *pVal -= iVal; - }else{ - *pVal += iVal; - } - } -} - -/* -** This function is used to write a single varint to a buffer. The varint -** is written to *pp. Before returning, *pp is set to point 1 byte past the -** end of the value written. -** -** If *pbFirst is zero when this function is called, the value written to -** the buffer is that of parameter iVal. -** -** If *pbFirst is non-zero when this function is called, then the value -** written is either (iVal-*piPrev) (if bDescIdx is zero) or (*piPrev-iVal) -** (if bDescIdx is non-zero). -** -** Before returning, this function always sets *pbFirst to 1 and *piPrev -** to the value of parameter iVal. -*/ -static void fts3PutDeltaVarint3( - char **pp, /* IN/OUT: Output pointer */ - int bDescIdx, /* True for descending docids */ - sqlite3_int64 *piPrev, /* IN/OUT: Previous value written to list */ - int *pbFirst, /* IN/OUT: True after first int written */ - sqlite3_int64 iVal /* Write this value to the list */ -){ - sqlite3_int64 iWrite; - if( bDescIdx==0 || *pbFirst==0 ){ - iWrite = iVal - *piPrev; - }else{ - iWrite = *piPrev - iVal; - } - assert( *pbFirst || *piPrev==0 ); - assert( *pbFirst==0 || iWrite>0 ); - *pp += sqlite3Fts3PutVarint(*pp, iWrite); - *piPrev = iVal; - *pbFirst = 1; -} - - -/* -** This macro is used by various functions that merge doclists. The two -** arguments are 64-bit docid values. If the value of the stack variable -** bDescDoclist is 0 when this macro is invoked, then it returns (i1-i2). -** Otherwise, (i2-i1). -** -** Using this makes it easier to write code that can merge doclists that are -** sorted in either ascending or descending order. -*/ -#define DOCID_CMP(i1, i2) ((bDescDoclist?-1:1) * (i1-i2)) - -/* -** This function does an "OR" merge of two doclists (output contains all -** positions contained in either argument doclist). If the docids in the -** input doclists are sorted in ascending order, parameter bDescDoclist -** should be false. If they are sorted in ascending order, it should be -** passed a non-zero value. -** -** If no error occurs, *paOut is set to point at an sqlite3_malloc'd buffer -** containing the output doclist and SQLITE_OK is returned. In this case -** *pnOut is set to the number of bytes in the output doclist. -** -** If an error occurs, an SQLite error code is returned. The output values -** are undefined in this case. -*/ -static int fts3DoclistOrMerge( - int bDescDoclist, /* True if arguments are desc */ - char *a1, int n1, /* First doclist */ - char *a2, int n2, /* Second doclist */ - char **paOut, int *pnOut /* OUT: Malloc'd doclist */ -){ - sqlite3_int64 i1 = 0; - sqlite3_int64 i2 = 0; - sqlite3_int64 iPrev = 0; - char *pEnd1 = &a1[n1]; - char *pEnd2 = &a2[n2]; - char *p1 = a1; - char *p2 = a2; - char *p; - char *aOut; - int bFirstOut = 0; - - *paOut = 0; - *pnOut = 0; - - /* Allocate space for the output. Both the input and output doclists - ** are delta encoded. If they are in ascending order (bDescDoclist==0), - ** then the first docid in each list is simply encoded as a varint. For - ** each subsequent docid, the varint stored is the difference between the - ** current and previous docid (a positive number - since the list is in - ** ascending order). - ** - ** The first docid written to the output is therefore encoded using the - ** same number of bytes as it is in whichever of the input lists it is - ** read from. And each subsequent docid read from the same input list - ** consumes either the same or less bytes as it did in the input (since - ** the difference between it and the previous value in the output must - ** be a positive value less than or equal to the delta value read from - ** the input list). The same argument applies to all but the first docid - ** read from the 'other' list. And to the contents of all position lists - ** that will be copied and merged from the input to the output. - ** - ** However, if the first docid copied to the output is a negative number, - ** then the encoding of the first docid from the 'other' input list may - ** be larger in the output than it was in the input (since the delta value - ** may be a larger positive integer than the actual docid). - ** - ** The space required to store the output is therefore the sum of the - ** sizes of the two inputs, plus enough space for exactly one of the input - ** docids to grow. - ** - ** A symetric argument may be made if the doclists are in descending - ** order. - */ - aOut = sqlite3_malloc(n1+n2+FTS3_VARINT_MAX-1); - if( !aOut ) return SQLITE_NOMEM; - - p = aOut; - fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1); - fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2); - while( p1 || p2 ){ - sqlite3_int64 iDiff = DOCID_CMP(i1, i2); - - if( p2 && p1 && iDiff==0 ){ - fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1); - fts3PoslistMerge(&p, &p1, &p2); - fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1); - fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2); - }else if( !p2 || (p1 && iDiff<0) ){ - fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1); - fts3PoslistCopy(&p, &p1); - fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1); - }else{ - fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i2); - fts3PoslistCopy(&p, &p2); - fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2); - } - } - - *paOut = aOut; - *pnOut = (int)(p-aOut); - assert( *pnOut<=n1+n2+FTS3_VARINT_MAX-1 ); - return SQLITE_OK; -} - -/* -** This function does a "phrase" merge of two doclists. In a phrase merge, -** the output contains a copy of each position from the right-hand input -** doclist for which there is a position in the left-hand input doclist -** exactly nDist tokens before it. -** -** If the docids in the input doclists are sorted in ascending order, -** parameter bDescDoclist should be false. If they are sorted in ascending -** order, it should be passed a non-zero value. -** -** The right-hand input doclist is overwritten by this function. -*/ -static void fts3DoclistPhraseMerge( - int bDescDoclist, /* True if arguments are desc */ - int nDist, /* Distance from left to right (1=adjacent) */ - char *aLeft, int nLeft, /* Left doclist */ - char *aRight, int *pnRight /* IN/OUT: Right/output doclist */ -){ - sqlite3_int64 i1 = 0; - sqlite3_int64 i2 = 0; - sqlite3_int64 iPrev = 0; - char *pEnd1 = &aLeft[nLeft]; - char *pEnd2 = &aRight[*pnRight]; - char *p1 = aLeft; - char *p2 = aRight; - char *p; - int bFirstOut = 0; - char *aOut = aRight; - - assert( nDist>0 ); - - p = aOut; - fts3GetDeltaVarint3(&p1, pEnd1, 0, &i1); - fts3GetDeltaVarint3(&p2, pEnd2, 0, &i2); - - while( p1 && p2 ){ - sqlite3_int64 iDiff = DOCID_CMP(i1, i2); - if( iDiff==0 ){ - char *pSave = p; - sqlite3_int64 iPrevSave = iPrev; - int bFirstOutSave = bFirstOut; - - fts3PutDeltaVarint3(&p, bDescDoclist, &iPrev, &bFirstOut, i1); - if( 0==fts3PoslistPhraseMerge(&p, nDist, 0, 1, &p1, &p2) ){ - p = pSave; - iPrev = iPrevSave; - bFirstOut = bFirstOutSave; - } - fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1); - fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2); - }else if( iDiff<0 ){ - fts3PoslistCopy(0, &p1); - fts3GetDeltaVarint3(&p1, pEnd1, bDescDoclist, &i1); - }else{ - fts3PoslistCopy(0, &p2); - fts3GetDeltaVarint3(&p2, pEnd2, bDescDoclist, &i2); - } - } - - *pnRight = (int)(p - aOut); -} - -/* -** Argument pList points to a position list nList bytes in size. This -** function checks to see if the position list contains any entries for -** a token in position 0 (of any column). If so, it writes argument iDelta -** to the output buffer pOut, followed by a position list consisting only -** of the entries from pList at position 0, and terminated by an 0x00 byte. -** The value returned is the number of bytes written to pOut (if any). -*/ -SQLITE_PRIVATE int sqlite3Fts3FirstFilter( - sqlite3_int64 iDelta, /* Varint that may be written to pOut */ - char *pList, /* Position list (no 0x00 term) */ - int nList, /* Size of pList in bytes */ - char *pOut /* Write output here */ -){ - int nOut = 0; - int bWritten = 0; /* True once iDelta has been written */ - char *p = pList; - char *pEnd = &pList[nList]; - - if( *p!=0x01 ){ - if( *p==0x02 ){ - nOut += sqlite3Fts3PutVarint(&pOut[nOut], iDelta); - pOut[nOut++] = 0x02; - bWritten = 1; - } - fts3ColumnlistCopy(0, &p); - } - - while( paaOutput); i++){ - if( pTS->aaOutput[i] ){ - if( !aOut ){ - aOut = pTS->aaOutput[i]; - nOut = pTS->anOutput[i]; - pTS->aaOutput[i] = 0; - }else{ - int nNew; - char *aNew; - - int rc = fts3DoclistOrMerge(p->bDescIdx, - pTS->aaOutput[i], pTS->anOutput[i], aOut, nOut, &aNew, &nNew - ); - if( rc!=SQLITE_OK ){ - sqlite3_free(aOut); - return rc; - } - - sqlite3_free(pTS->aaOutput[i]); - sqlite3_free(aOut); - pTS->aaOutput[i] = 0; - aOut = aNew; - nOut = nNew; - } - } - } - - pTS->aaOutput[0] = aOut; - pTS->anOutput[0] = nOut; - return SQLITE_OK; -} - -/* -** Merge the doclist aDoclist/nDoclist into the TermSelect object passed -** as the first argument. The merge is an "OR" merge (see function -** fts3DoclistOrMerge() for details). -** -** This function is called with the doclist for each term that matches -** a queried prefix. It merges all these doclists into one, the doclist -** for the specified prefix. Since there can be a very large number of -** doclists to merge, the merging is done pair-wise using the TermSelect -** object. -** -** This function returns SQLITE_OK if the merge is successful, or an -** SQLite error code (SQLITE_NOMEM) if an error occurs. -*/ -static int fts3TermSelectMerge( - Fts3Table *p, /* FTS table handle */ - TermSelect *pTS, /* TermSelect object to merge into */ - char *aDoclist, /* Pointer to doclist */ - int nDoclist /* Size of aDoclist in bytes */ -){ - if( pTS->aaOutput[0]==0 ){ - /* If this is the first term selected, copy the doclist to the output - ** buffer using memcpy(). */ - pTS->aaOutput[0] = sqlite3_malloc(nDoclist); - pTS->anOutput[0] = nDoclist; - if( pTS->aaOutput[0] ){ - memcpy(pTS->aaOutput[0], aDoclist, nDoclist); - }else{ - return SQLITE_NOMEM; - } - }else{ - char *aMerge = aDoclist; - int nMerge = nDoclist; - int iOut; - - for(iOut=0; iOutaaOutput); iOut++){ - if( pTS->aaOutput[iOut]==0 ){ - assert( iOut>0 ); - pTS->aaOutput[iOut] = aMerge; - pTS->anOutput[iOut] = nMerge; - break; - }else{ - char *aNew; - int nNew; - - int rc = fts3DoclistOrMerge(p->bDescIdx, aMerge, nMerge, - pTS->aaOutput[iOut], pTS->anOutput[iOut], &aNew, &nNew - ); - if( rc!=SQLITE_OK ){ - if( aMerge!=aDoclist ) sqlite3_free(aMerge); - return rc; - } - - if( aMerge!=aDoclist ) sqlite3_free(aMerge); - sqlite3_free(pTS->aaOutput[iOut]); - pTS->aaOutput[iOut] = 0; - - aMerge = aNew; - nMerge = nNew; - if( (iOut+1)==SizeofArray(pTS->aaOutput) ){ - pTS->aaOutput[iOut] = aMerge; - pTS->anOutput[iOut] = nMerge; - } - } - } - } - return SQLITE_OK; -} - -/* -** Append SegReader object pNew to the end of the pCsr->apSegment[] array. -*/ -static int fts3SegReaderCursorAppend( - Fts3MultiSegReader *pCsr, - Fts3SegReader *pNew -){ - if( (pCsr->nSegment%16)==0 ){ - Fts3SegReader **apNew; - int nByte = (pCsr->nSegment + 16)*sizeof(Fts3SegReader*); - apNew = (Fts3SegReader **)sqlite3_realloc(pCsr->apSegment, nByte); - if( !apNew ){ - sqlite3Fts3SegReaderFree(pNew); - return SQLITE_NOMEM; - } - pCsr->apSegment = apNew; - } - pCsr->apSegment[pCsr->nSegment++] = pNew; - return SQLITE_OK; -} - -/* -** Add seg-reader objects to the Fts3MultiSegReader object passed as the -** 8th argument. -** -** This function returns SQLITE_OK if successful, or an SQLite error code -** otherwise. -*/ -static int fts3SegReaderCursor( - Fts3Table *p, /* FTS3 table handle */ - int iLangid, /* Language id */ - int iIndex, /* Index to search (from 0 to p->nIndex-1) */ - int iLevel, /* Level of segments to scan */ - const char *zTerm, /* Term to query for */ - int nTerm, /* Size of zTerm in bytes */ - int isPrefix, /* True for a prefix search */ - int isScan, /* True to scan from zTerm to EOF */ - Fts3MultiSegReader *pCsr /* Cursor object to populate */ -){ - int rc = SQLITE_OK; /* Error code */ - sqlite3_stmt *pStmt = 0; /* Statement to iterate through segments */ - int rc2; /* Result of sqlite3_reset() */ - - /* If iLevel is less than 0 and this is not a scan, include a seg-reader - ** for the pending-terms. If this is a scan, then this call must be being - ** made by an fts4aux module, not an FTS table. In this case calling - ** Fts3SegReaderPending might segfault, as the data structures used by - ** fts4aux are not completely populated. So it's easiest to filter these - ** calls out here. */ - if( iLevel<0 && p->aIndex ){ - Fts3SegReader *pSeg = 0; - rc = sqlite3Fts3SegReaderPending(p, iIndex, zTerm, nTerm, isPrefix, &pSeg); - if( rc==SQLITE_OK && pSeg ){ - rc = fts3SegReaderCursorAppend(pCsr, pSeg); - } - } - - if( iLevel!=FTS3_SEGCURSOR_PENDING ){ - if( rc==SQLITE_OK ){ - rc = sqlite3Fts3AllSegdirs(p, iLangid, iIndex, iLevel, &pStmt); - } - - while( rc==SQLITE_OK && SQLITE_ROW==(rc = sqlite3_step(pStmt)) ){ - Fts3SegReader *pSeg = 0; - - /* Read the values returned by the SELECT into local variables. */ - sqlite3_int64 iStartBlock = sqlite3_column_int64(pStmt, 1); - sqlite3_int64 iLeavesEndBlock = sqlite3_column_int64(pStmt, 2); - sqlite3_int64 iEndBlock = sqlite3_column_int64(pStmt, 3); - int nRoot = sqlite3_column_bytes(pStmt, 4); - char const *zRoot = sqlite3_column_blob(pStmt, 4); - - /* If zTerm is not NULL, and this segment is not stored entirely on its - ** root node, the range of leaves scanned can be reduced. Do this. */ - if( iStartBlock && zTerm ){ - sqlite3_int64 *pi = (isPrefix ? &iLeavesEndBlock : 0); - rc = fts3SelectLeaf(p, zTerm, nTerm, zRoot, nRoot, &iStartBlock, pi); - if( rc!=SQLITE_OK ) goto finished; - if( isPrefix==0 && isScan==0 ) iLeavesEndBlock = iStartBlock; - } - - rc = sqlite3Fts3SegReaderNew(pCsr->nSegment+1, - (isPrefix==0 && isScan==0), - iStartBlock, iLeavesEndBlock, - iEndBlock, zRoot, nRoot, &pSeg - ); - if( rc!=SQLITE_OK ) goto finished; - rc = fts3SegReaderCursorAppend(pCsr, pSeg); - } - } - - finished: - rc2 = sqlite3_reset(pStmt); - if( rc==SQLITE_DONE ) rc = rc2; - - return rc; -} - -/* -** Set up a cursor object for iterating through a full-text index or a -** single level therein. -*/ -SQLITE_PRIVATE int sqlite3Fts3SegReaderCursor( - Fts3Table *p, /* FTS3 table handle */ - int iLangid, /* Language-id to search */ - int iIndex, /* Index to search (from 0 to p->nIndex-1) */ - int iLevel, /* Level of segments to scan */ - const char *zTerm, /* Term to query for */ - int nTerm, /* Size of zTerm in bytes */ - int isPrefix, /* True for a prefix search */ - int isScan, /* True to scan from zTerm to EOF */ - Fts3MultiSegReader *pCsr /* Cursor object to populate */ -){ - assert( iIndex>=0 && iIndexnIndex ); - assert( iLevel==FTS3_SEGCURSOR_ALL - || iLevel==FTS3_SEGCURSOR_PENDING - || iLevel>=0 - ); - assert( iLevelbase.pVtab; - - if( isPrefix ){ - for(i=1; bFound==0 && inIndex; i++){ - if( p->aIndex[i].nPrefix==nTerm ){ - bFound = 1; - rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, - i, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 0, 0, pSegcsr - ); - pSegcsr->bLookup = 1; - } - } - - for(i=1; bFound==0 && inIndex; i++){ - if( p->aIndex[i].nPrefix==nTerm+1 ){ - bFound = 1; - rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, - i, FTS3_SEGCURSOR_ALL, zTerm, nTerm, 1, 0, pSegcsr - ); - if( rc==SQLITE_OK ){ - rc = fts3SegReaderCursorAddZero( - p, pCsr->iLangid, zTerm, nTerm, pSegcsr - ); - } - } - } - } - - if( bFound==0 ){ - rc = sqlite3Fts3SegReaderCursor(p, pCsr->iLangid, - 0, FTS3_SEGCURSOR_ALL, zTerm, nTerm, isPrefix, 0, pSegcsr - ); - pSegcsr->bLookup = !isPrefix; - } - } - - *ppSegcsr = pSegcsr; - return rc; -} - -/* -** Free an Fts3MultiSegReader allocated by fts3TermSegReaderCursor(). -*/ -static void fts3SegReaderCursorFree(Fts3MultiSegReader *pSegcsr){ - sqlite3Fts3SegReaderFinish(pSegcsr); - sqlite3_free(pSegcsr); -} - -/* -** This function retrieves the doclist for the specified term (or term -** prefix) from the database. -*/ -static int fts3TermSelect( - Fts3Table *p, /* Virtual table handle */ - Fts3PhraseToken *pTok, /* Token to query for */ - int iColumn, /* Column to query (or -ve for all columns) */ - int *pnOut, /* OUT: Size of buffer at *ppOut */ - char **ppOut /* OUT: Malloced result buffer */ -){ - int rc; /* Return code */ - Fts3MultiSegReader *pSegcsr; /* Seg-reader cursor for this term */ - TermSelect tsc; /* Object for pair-wise doclist merging */ - Fts3SegFilter filter; /* Segment term filter configuration */ - - pSegcsr = pTok->pSegcsr; - memset(&tsc, 0, sizeof(TermSelect)); - - filter.flags = FTS3_SEGMENT_IGNORE_EMPTY | FTS3_SEGMENT_REQUIRE_POS - | (pTok->isPrefix ? FTS3_SEGMENT_PREFIX : 0) - | (pTok->bFirst ? FTS3_SEGMENT_FIRST : 0) - | (iColumnnColumn ? FTS3_SEGMENT_COLUMN_FILTER : 0); - filter.iCol = iColumn; - filter.zTerm = pTok->z; - filter.nTerm = pTok->n; - - rc = sqlite3Fts3SegReaderStart(p, pSegcsr, &filter); - while( SQLITE_OK==rc - && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pSegcsr)) - ){ - rc = fts3TermSelectMerge(p, &tsc, pSegcsr->aDoclist, pSegcsr->nDoclist); - } - - if( rc==SQLITE_OK ){ - rc = fts3TermSelectFinishMerge(p, &tsc); - } - if( rc==SQLITE_OK ){ - *ppOut = tsc.aaOutput[0]; - *pnOut = tsc.anOutput[0]; - }else{ - int i; - for(i=0; ipSegcsr = 0; - return rc; -} - -/* -** This function counts the total number of docids in the doclist stored -** in buffer aList[], size nList bytes. -** -** If the isPoslist argument is true, then it is assumed that the doclist -** contains a position-list following each docid. Otherwise, it is assumed -** that the doclist is simply a list of docids stored as delta encoded -** varints. -*/ -static int fts3DoclistCountDocids(char *aList, int nList){ - int nDoc = 0; /* Return value */ - if( aList ){ - char *aEnd = &aList[nList]; /* Pointer to one byte after EOF */ - char *p = aList; /* Cursor */ - while( peSearch==FTS3_DOCID_SEARCH || pCsr->eSearch==FTS3_FULLSCAN_SEARCH ){ - if( SQLITE_ROW!=sqlite3_step(pCsr->pStmt) ){ - pCsr->isEof = 1; - rc = sqlite3_reset(pCsr->pStmt); - }else{ - pCsr->iPrevId = sqlite3_column_int64(pCsr->pStmt, 0); - rc = SQLITE_OK; - } - }else{ - rc = fts3EvalNext((Fts3Cursor *)pCursor); - } - assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 ); - return rc; -} - -/* -** The following are copied from sqliteInt.h. -** -** Constants for the largest and smallest possible 64-bit signed integers. -** These macros are designed to work correctly on both 32-bit and 64-bit -** compilers. -*/ -#ifndef SQLITE_AMALGAMATION -# define LARGEST_INT64 (0xffffffff|(((sqlite3_int64)0x7fffffff)<<32)) -# define SMALLEST_INT64 (((sqlite3_int64)-1) - LARGEST_INT64) -#endif - -/* -** If the numeric type of argument pVal is "integer", then return it -** converted to a 64-bit signed integer. Otherwise, return a copy of -** the second parameter, iDefault. -*/ -static sqlite3_int64 fts3DocidRange(sqlite3_value *pVal, i64 iDefault){ - if( pVal ){ - int eType = sqlite3_value_numeric_type(pVal); - if( eType==SQLITE_INTEGER ){ - return sqlite3_value_int64(pVal); - } - } - return iDefault; -} - -/* -** This is the xFilter interface for the virtual table. See -** the virtual table xFilter method documentation for additional -** information. -** -** If idxNum==FTS3_FULLSCAN_SEARCH then do a full table scan against -** the %_content table. -** -** If idxNum==FTS3_DOCID_SEARCH then do a docid lookup for a single entry -** in the %_content table. -** -** If idxNum>=FTS3_FULLTEXT_SEARCH then use the full text index. The -** column on the left-hand side of the MATCH operator is column -** number idxNum-FTS3_FULLTEXT_SEARCH, 0 indexed. argv[0] is the right-hand -** side of the MATCH operator. -*/ -static int fts3FilterMethod( - sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ - int idxNum, /* Strategy index */ - const char *idxStr, /* Unused */ - int nVal, /* Number of elements in apVal */ - sqlite3_value **apVal /* Arguments for the indexing scheme */ -){ - int rc; - char *zSql; /* SQL statement used to access %_content */ - int eSearch; - Fts3Table *p = (Fts3Table *)pCursor->pVtab; - Fts3Cursor *pCsr = (Fts3Cursor *)pCursor; - - sqlite3_value *pCons = 0; /* The MATCH or rowid constraint, if any */ - sqlite3_value *pLangid = 0; /* The "langid = ?" constraint, if any */ - sqlite3_value *pDocidGe = 0; /* The "docid >= ?" constraint, if any */ - sqlite3_value *pDocidLe = 0; /* The "docid <= ?" constraint, if any */ - int iIdx; - - UNUSED_PARAMETER(idxStr); - UNUSED_PARAMETER(nVal); - - eSearch = (idxNum & 0x0000FFFF); - assert( eSearch>=0 && eSearch<=(FTS3_FULLTEXT_SEARCH+p->nColumn) ); - assert( p->pSegments==0 ); - - /* Collect arguments into local variables */ - iIdx = 0; - if( eSearch!=FTS3_FULLSCAN_SEARCH ) pCons = apVal[iIdx++]; - if( idxNum & FTS3_HAVE_LANGID ) pLangid = apVal[iIdx++]; - if( idxNum & FTS3_HAVE_DOCID_GE ) pDocidGe = apVal[iIdx++]; - if( idxNum & FTS3_HAVE_DOCID_LE ) pDocidLe = apVal[iIdx++]; - assert( iIdx==nVal ); - - /* In case the cursor has been used before, clear it now. */ - sqlite3_finalize(pCsr->pStmt); - sqlite3_free(pCsr->aDoclist); - sqlite3Fts3ExprFree(pCsr->pExpr); - memset(&pCursor[1], 0, sizeof(Fts3Cursor)-sizeof(sqlite3_vtab_cursor)); - - /* Set the lower and upper bounds on docids to return */ - pCsr->iMinDocid = fts3DocidRange(pDocidGe, SMALLEST_INT64); - pCsr->iMaxDocid = fts3DocidRange(pDocidLe, LARGEST_INT64); - - if( idxStr ){ - pCsr->bDesc = (idxStr[0]=='D'); - }else{ - pCsr->bDesc = p->bDescIdx; - } - pCsr->eSearch = (i16)eSearch; - - if( eSearch!=FTS3_DOCID_SEARCH && eSearch!=FTS3_FULLSCAN_SEARCH ){ - int iCol = eSearch-FTS3_FULLTEXT_SEARCH; - const char *zQuery = (const char *)sqlite3_value_text(pCons); - - if( zQuery==0 && sqlite3_value_type(pCons)!=SQLITE_NULL ){ - return SQLITE_NOMEM; - } - - pCsr->iLangid = 0; - if( pLangid ) pCsr->iLangid = sqlite3_value_int(pLangid); - - assert( p->base.zErrMsg==0 ); - rc = sqlite3Fts3ExprParse(p->pTokenizer, pCsr->iLangid, - p->azColumn, p->bFts4, p->nColumn, iCol, zQuery, -1, &pCsr->pExpr, - &p->base.zErrMsg - ); - if( rc!=SQLITE_OK ){ - return rc; - } - - rc = fts3EvalStart(pCsr); - sqlite3Fts3SegmentsClose(p); - if( rc!=SQLITE_OK ) return rc; - pCsr->pNextId = pCsr->aDoclist; - pCsr->iPrevId = 0; - } - - /* Compile a SELECT statement for this cursor. For a full-table-scan, the - ** statement loops through all rows of the %_content table. For a - ** full-text query or docid lookup, the statement retrieves a single - ** row by docid. - */ - if( eSearch==FTS3_FULLSCAN_SEARCH ){ - zSql = sqlite3_mprintf( - "SELECT %s ORDER BY rowid %s", - p->zReadExprlist, (pCsr->bDesc ? "DESC" : "ASC") - ); - if( zSql ){ - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pCsr->pStmt, 0); - sqlite3_free(zSql); - }else{ - rc = SQLITE_NOMEM; - } - }else if( eSearch==FTS3_DOCID_SEARCH ){ - rc = fts3CursorSeekStmt(pCsr, &pCsr->pStmt); - if( rc==SQLITE_OK ){ - rc = sqlite3_bind_value(pCsr->pStmt, 1, pCons); - } - } - if( rc!=SQLITE_OK ) return rc; - - return fts3NextMethod(pCursor); -} - -/* -** This is the xEof method of the virtual table. SQLite calls this -** routine to find out if it has reached the end of a result set. -*/ -static int fts3EofMethod(sqlite3_vtab_cursor *pCursor){ - return ((Fts3Cursor *)pCursor)->isEof; -} - -/* -** This is the xRowid method. The SQLite core calls this routine to -** retrieve the rowid for the current row of the result set. fts3 -** exposes %_content.docid as the rowid for the virtual table. The -** rowid should be written to *pRowid. -*/ -static int fts3RowidMethod(sqlite3_vtab_cursor *pCursor, sqlite_int64 *pRowid){ - Fts3Cursor *pCsr = (Fts3Cursor *) pCursor; - *pRowid = pCsr->iPrevId; - return SQLITE_OK; -} - -/* -** This is the xColumn method, called by SQLite to request a value from -** the row that the supplied cursor currently points to. -** -** If: -** -** (iCol < p->nColumn) -> The value of the iCol'th user column. -** (iCol == p->nColumn) -> Magic column with the same name as the table. -** (iCol == p->nColumn+1) -> Docid column -** (iCol == p->nColumn+2) -> Langid column -*/ -static int fts3ColumnMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */ - int iCol /* Index of column to read value from */ -){ - int rc = SQLITE_OK; /* Return Code */ - Fts3Cursor *pCsr = (Fts3Cursor *) pCursor; - Fts3Table *p = (Fts3Table *)pCursor->pVtab; - - /* The column value supplied by SQLite must be in range. */ - assert( iCol>=0 && iCol<=p->nColumn+2 ); - - if( iCol==p->nColumn+1 ){ - /* This call is a request for the "docid" column. Since "docid" is an - ** alias for "rowid", use the xRowid() method to obtain the value. - */ - sqlite3_result_int64(pCtx, pCsr->iPrevId); - }else if( iCol==p->nColumn ){ - /* The extra column whose name is the same as the table. - ** Return a blob which is a pointer to the cursor. */ - sqlite3_result_blob(pCtx, &pCsr, sizeof(pCsr), SQLITE_TRANSIENT); - }else if( iCol==p->nColumn+2 && pCsr->pExpr ){ - sqlite3_result_int64(pCtx, pCsr->iLangid); - }else{ - /* The requested column is either a user column (one that contains - ** indexed data), or the language-id column. */ - rc = fts3CursorSeek(0, pCsr); - - if( rc==SQLITE_OK ){ - if( iCol==p->nColumn+2 ){ - int iLangid = 0; - if( p->zLanguageid ){ - iLangid = sqlite3_column_int(pCsr->pStmt, p->nColumn+1); - } - sqlite3_result_int(pCtx, iLangid); - }else if( sqlite3_data_count(pCsr->pStmt)>(iCol+1) ){ - sqlite3_result_value(pCtx, sqlite3_column_value(pCsr->pStmt, iCol+1)); - } - } - } - - assert( ((Fts3Table *)pCsr->base.pVtab)->pSegments==0 ); - return rc; -} - -/* -** This function is the implementation of the xUpdate callback used by -** FTS3 virtual tables. It is invoked by SQLite each time a row is to be -** inserted, updated or deleted. -*/ -static int fts3UpdateMethod( - sqlite3_vtab *pVtab, /* Virtual table handle */ - int nArg, /* Size of argument array */ - sqlite3_value **apVal, /* Array of arguments */ - sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */ -){ - return sqlite3Fts3UpdateMethod(pVtab, nArg, apVal, pRowid); -} - -/* -** Implementation of xSync() method. Flush the contents of the pending-terms -** hash-table to the database. -*/ -static int fts3SyncMethod(sqlite3_vtab *pVtab){ - - /* Following an incremental-merge operation, assuming that the input - ** segments are not completely consumed (the usual case), they are updated - ** in place to remove the entries that have already been merged. This - ** involves updating the leaf block that contains the smallest unmerged - ** entry and each block (if any) between the leaf and the root node. So - ** if the height of the input segment b-trees is N, and input segments - ** are merged eight at a time, updating the input segments at the end - ** of an incremental-merge requires writing (8*(1+N)) blocks. N is usually - ** small - often between 0 and 2. So the overhead of the incremental - ** merge is somewhere between 8 and 24 blocks. To avoid this overhead - ** dwarfing the actual productive work accomplished, the incremental merge - ** is only attempted if it will write at least 64 leaf blocks. Hence - ** nMinMerge. - ** - ** Of course, updating the input segments also involves deleting a bunch - ** of blocks from the segments table. But this is not considered overhead - ** as it would also be required by a crisis-merge that used the same input - ** segments. - */ - const u32 nMinMerge = 64; /* Minimum amount of incr-merge work to do */ - - Fts3Table *p = (Fts3Table*)pVtab; - int rc = sqlite3Fts3PendingTermsFlush(p); - - if( rc==SQLITE_OK && p->bAutoincrmerge==1 && p->nLeafAdd>(nMinMerge/16) ){ - int mxLevel = 0; /* Maximum relative level value in db */ - int A; /* Incr-merge parameter A */ - - rc = sqlite3Fts3MaxLevel(p, &mxLevel); - assert( rc==SQLITE_OK || mxLevel==0 ); - A = p->nLeafAdd * mxLevel; - A += (A/2); - if( A>(int)nMinMerge ) rc = sqlite3Fts3Incrmerge(p, A, 8); - } - sqlite3Fts3SegmentsClose(p); - return rc; -} - -/* -** Implementation of xBegin() method. This is a no-op. -*/ -static int fts3BeginMethod(sqlite3_vtab *pVtab){ - Fts3Table *p = (Fts3Table*)pVtab; - UNUSED_PARAMETER(pVtab); - assert( p->pSegments==0 ); - assert( p->nPendingData==0 ); - assert( p->inTransaction!=1 ); - TESTONLY( p->inTransaction = 1 ); - TESTONLY( p->mxSavepoint = -1; ); - p->nLeafAdd = 0; - return SQLITE_OK; -} - -/* -** Implementation of xCommit() method. This is a no-op. The contents of -** the pending-terms hash-table have already been flushed into the database -** by fts3SyncMethod(). -*/ -static int fts3CommitMethod(sqlite3_vtab *pVtab){ - TESTONLY( Fts3Table *p = (Fts3Table*)pVtab ); - UNUSED_PARAMETER(pVtab); - assert( p->nPendingData==0 ); - assert( p->inTransaction!=0 ); - assert( p->pSegments==0 ); - TESTONLY( p->inTransaction = 0 ); - TESTONLY( p->mxSavepoint = -1; ); - return SQLITE_OK; -} - -/* -** Implementation of xRollback(). Discard the contents of the pending-terms -** hash-table. Any changes made to the database are reverted by SQLite. -*/ -static int fts3RollbackMethod(sqlite3_vtab *pVtab){ - Fts3Table *p = (Fts3Table*)pVtab; - sqlite3Fts3PendingTermsClear(p); - assert( p->inTransaction!=0 ); - TESTONLY( p->inTransaction = 0 ); - TESTONLY( p->mxSavepoint = -1; ); - return SQLITE_OK; -} - -/* -** When called, *ppPoslist must point to the byte immediately following the -** end of a position-list. i.e. ( (*ppPoslist)[-1]==POS_END ). This function -** moves *ppPoslist so that it instead points to the first byte of the -** same position list. -*/ -static void fts3ReversePoslist(char *pStart, char **ppPoslist){ - char *p = &(*ppPoslist)[-2]; - char c = 0; - - while( p>pStart && (c=*p--)==0 ); - while( p>pStart && (*p & 0x80) | c ){ - c = *p--; - } - if( p>pStart ){ p = &p[2]; } - while( *p++&0x80 ); - *ppPoslist = p; -} - -/* -** Helper function used by the implementation of the overloaded snippet(), -** offsets() and optimize() SQL functions. -** -** If the value passed as the third argument is a blob of size -** sizeof(Fts3Cursor*), then the blob contents are copied to the -** output variable *ppCsr and SQLITE_OK is returned. Otherwise, an error -** message is written to context pContext and SQLITE_ERROR returned. The -** string passed via zFunc is used as part of the error message. -*/ -static int fts3FunctionArg( - sqlite3_context *pContext, /* SQL function call context */ - const char *zFunc, /* Function name */ - sqlite3_value *pVal, /* argv[0] passed to function */ - Fts3Cursor **ppCsr /* OUT: Store cursor handle here */ -){ - Fts3Cursor *pRet; - if( sqlite3_value_type(pVal)!=SQLITE_BLOB - || sqlite3_value_bytes(pVal)!=sizeof(Fts3Cursor *) - ){ - char *zErr = sqlite3_mprintf("illegal first argument to %s", zFunc); - sqlite3_result_error(pContext, zErr, -1); - sqlite3_free(zErr); - return SQLITE_ERROR; - } - memcpy(&pRet, sqlite3_value_blob(pVal), sizeof(Fts3Cursor *)); - *ppCsr = pRet; - return SQLITE_OK; -} - -/* -** Implementation of the snippet() function for FTS3 -*/ -static void fts3SnippetFunc( - sqlite3_context *pContext, /* SQLite function call context */ - int nVal, /* Size of apVal[] array */ - sqlite3_value **apVal /* Array of arguments */ -){ - Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */ - const char *zStart = ""; - const char *zEnd = ""; - const char *zEllipsis = "..."; - int iCol = -1; - int nToken = 15; /* Default number of tokens in snippet */ - - /* There must be at least one argument passed to this function (otherwise - ** the non-overloaded version would have been called instead of this one). - */ - assert( nVal>=1 ); - - if( nVal>6 ){ - sqlite3_result_error(pContext, - "wrong number of arguments to function snippet()", -1); - return; - } - if( fts3FunctionArg(pContext, "snippet", apVal[0], &pCsr) ) return; - - switch( nVal ){ - case 6: nToken = sqlite3_value_int(apVal[5]); - case 5: iCol = sqlite3_value_int(apVal[4]); - case 4: zEllipsis = (const char*)sqlite3_value_text(apVal[3]); - case 3: zEnd = (const char*)sqlite3_value_text(apVal[2]); - case 2: zStart = (const char*)sqlite3_value_text(apVal[1]); - } - if( !zEllipsis || !zEnd || !zStart ){ - sqlite3_result_error_nomem(pContext); - }else if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){ - sqlite3Fts3Snippet(pContext, pCsr, zStart, zEnd, zEllipsis, iCol, nToken); - } -} - -/* -** Implementation of the offsets() function for FTS3 -*/ -static void fts3OffsetsFunc( - sqlite3_context *pContext, /* SQLite function call context */ - int nVal, /* Size of argument array */ - sqlite3_value **apVal /* Array of arguments */ -){ - Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */ - - UNUSED_PARAMETER(nVal); - - assert( nVal==1 ); - if( fts3FunctionArg(pContext, "offsets", apVal[0], &pCsr) ) return; - assert( pCsr ); - if( SQLITE_OK==fts3CursorSeek(pContext, pCsr) ){ - sqlite3Fts3Offsets(pContext, pCsr); - } -} - -/* -** Implementation of the special optimize() function for FTS3. This -** function merges all segments in the database to a single segment. -** Example usage is: -** -** SELECT optimize(t) FROM t LIMIT 1; -** -** where 't' is the name of an FTS3 table. -*/ -static void fts3OptimizeFunc( - sqlite3_context *pContext, /* SQLite function call context */ - int nVal, /* Size of argument array */ - sqlite3_value **apVal /* Array of arguments */ -){ - int rc; /* Return code */ - Fts3Table *p; /* Virtual table handle */ - Fts3Cursor *pCursor; /* Cursor handle passed through apVal[0] */ - - UNUSED_PARAMETER(nVal); - - assert( nVal==1 ); - if( fts3FunctionArg(pContext, "optimize", apVal[0], &pCursor) ) return; - p = (Fts3Table *)pCursor->base.pVtab; - assert( p ); - - rc = sqlite3Fts3Optimize(p); - - switch( rc ){ - case SQLITE_OK: - sqlite3_result_text(pContext, "Index optimized", -1, SQLITE_STATIC); - break; - case SQLITE_DONE: - sqlite3_result_text(pContext, "Index already optimal", -1, SQLITE_STATIC); - break; - default: - sqlite3_result_error_code(pContext, rc); - break; - } -} - -/* -** Implementation of the matchinfo() function for FTS3 -*/ -static void fts3MatchinfoFunc( - sqlite3_context *pContext, /* SQLite function call context */ - int nVal, /* Size of argument array */ - sqlite3_value **apVal /* Array of arguments */ -){ - Fts3Cursor *pCsr; /* Cursor handle passed through apVal[0] */ - assert( nVal==1 || nVal==2 ); - if( SQLITE_OK==fts3FunctionArg(pContext, "matchinfo", apVal[0], &pCsr) ){ - const char *zArg = 0; - if( nVal>1 ){ - zArg = (const char *)sqlite3_value_text(apVal[1]); - } - sqlite3Fts3Matchinfo(pContext, pCsr, zArg); - } -} - -/* -** This routine implements the xFindFunction method for the FTS3 -** virtual table. -*/ -static int fts3FindFunctionMethod( - sqlite3_vtab *pVtab, /* Virtual table handle */ - int nArg, /* Number of SQL function arguments */ - const char *zName, /* Name of SQL function */ - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), /* OUT: Result */ - void **ppArg /* Unused */ -){ - struct Overloaded { - const char *zName; - void (*xFunc)(sqlite3_context*,int,sqlite3_value**); - } aOverload[] = { - { "snippet", fts3SnippetFunc }, - { "offsets", fts3OffsetsFunc }, - { "optimize", fts3OptimizeFunc }, - { "matchinfo", fts3MatchinfoFunc }, - }; - int i; /* Iterator variable */ - - UNUSED_PARAMETER(pVtab); - UNUSED_PARAMETER(nArg); - UNUSED_PARAMETER(ppArg); - - for(i=0; idb; /* Database connection */ - int rc; /* Return Code */ - - /* As it happens, the pending terms table is always empty here. This is - ** because an "ALTER TABLE RENAME TABLE" statement inside a transaction - ** always opens a savepoint transaction. And the xSavepoint() method - ** flushes the pending terms table. But leave the (no-op) call to - ** PendingTermsFlush() in in case that changes. - */ - assert( p->nPendingData==0 ); - rc = sqlite3Fts3PendingTermsFlush(p); - - if( p->zContentTbl==0 ){ - fts3DbExec(&rc, db, - "ALTER TABLE %Q.'%q_content' RENAME TO '%q_content';", - p->zDb, p->zName, zName - ); - } - - if( p->bHasDocsize ){ - fts3DbExec(&rc, db, - "ALTER TABLE %Q.'%q_docsize' RENAME TO '%q_docsize';", - p->zDb, p->zName, zName - ); - } - if( p->bHasStat ){ - fts3DbExec(&rc, db, - "ALTER TABLE %Q.'%q_stat' RENAME TO '%q_stat';", - p->zDb, p->zName, zName - ); - } - fts3DbExec(&rc, db, - "ALTER TABLE %Q.'%q_segments' RENAME TO '%q_segments';", - p->zDb, p->zName, zName - ); - fts3DbExec(&rc, db, - "ALTER TABLE %Q.'%q_segdir' RENAME TO '%q_segdir';", - p->zDb, p->zName, zName - ); - return rc; -} - -/* -** The xSavepoint() method. -** -** Flush the contents of the pending-terms table to disk. -*/ -static int fts3SavepointMethod(sqlite3_vtab *pVtab, int iSavepoint){ - int rc = SQLITE_OK; - UNUSED_PARAMETER(iSavepoint); - assert( ((Fts3Table *)pVtab)->inTransaction ); - assert( ((Fts3Table *)pVtab)->mxSavepoint < iSavepoint ); - TESTONLY( ((Fts3Table *)pVtab)->mxSavepoint = iSavepoint ); - if( ((Fts3Table *)pVtab)->bIgnoreSavepoint==0 ){ - rc = fts3SyncMethod(pVtab); - } - return rc; -} - -/* -** The xRelease() method. -** -** This is a no-op. -*/ -static int fts3ReleaseMethod(sqlite3_vtab *pVtab, int iSavepoint){ - TESTONLY( Fts3Table *p = (Fts3Table*)pVtab ); - UNUSED_PARAMETER(iSavepoint); - UNUSED_PARAMETER(pVtab); - assert( p->inTransaction ); - assert( p->mxSavepoint >= iSavepoint ); - TESTONLY( p->mxSavepoint = iSavepoint-1 ); - return SQLITE_OK; -} - -/* -** The xRollbackTo() method. -** -** Discard the contents of the pending terms table. -*/ -static int fts3RollbackToMethod(sqlite3_vtab *pVtab, int iSavepoint){ - Fts3Table *p = (Fts3Table*)pVtab; - UNUSED_PARAMETER(iSavepoint); - assert( p->inTransaction ); - assert( p->mxSavepoint >= iSavepoint ); - TESTONLY( p->mxSavepoint = iSavepoint ); - sqlite3Fts3PendingTermsClear(p); - return SQLITE_OK; -} - -static const sqlite3_module fts3Module = { - /* iVersion */ 2, - /* xCreate */ fts3CreateMethod, - /* xConnect */ fts3ConnectMethod, - /* xBestIndex */ fts3BestIndexMethod, - /* xDisconnect */ fts3DisconnectMethod, - /* xDestroy */ fts3DestroyMethod, - /* xOpen */ fts3OpenMethod, - /* xClose */ fts3CloseMethod, - /* xFilter */ fts3FilterMethod, - /* xNext */ fts3NextMethod, - /* xEof */ fts3EofMethod, - /* xColumn */ fts3ColumnMethod, - /* xRowid */ fts3RowidMethod, - /* xUpdate */ fts3UpdateMethod, - /* xBegin */ fts3BeginMethod, - /* xSync */ fts3SyncMethod, - /* xCommit */ fts3CommitMethod, - /* xRollback */ fts3RollbackMethod, - /* xFindFunction */ fts3FindFunctionMethod, - /* xRename */ fts3RenameMethod, - /* xSavepoint */ fts3SavepointMethod, - /* xRelease */ fts3ReleaseMethod, - /* xRollbackTo */ fts3RollbackToMethod, -}; - -/* -** This function is registered as the module destructor (called when an -** FTS3 enabled database connection is closed). It frees the memory -** allocated for the tokenizer hash table. -*/ -static void hashDestroy(void *p){ - Fts3Hash *pHash = (Fts3Hash *)p; - sqlite3Fts3HashClear(pHash); - sqlite3_free(pHash); -} - -/* -** The fts3 built-in tokenizers - "simple", "porter" and "icu"- are -** implemented in files fts3_tokenizer1.c, fts3_porter.c and fts3_icu.c -** respectively. The following three forward declarations are for functions -** declared in these files used to retrieve the respective implementations. -** -** Calling sqlite3Fts3SimpleTokenizerModule() sets the value pointed -** to by the argument to point to the "simple" tokenizer implementation. -** And so on. -*/ -SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule); -SQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule(sqlite3_tokenizer_module const**ppModule); -#ifdef SQLITE_ENABLE_FTS4_UNICODE61 -SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const**ppModule); -#endif -#ifdef SQLITE_ENABLE_ICU -SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule(sqlite3_tokenizer_module const**ppModule); -#endif - -/* -** Initialize the fts3 extension. If this extension is built as part -** of the sqlite library, then this function is called directly by -** SQLite. If fts3 is built as a dynamically loadable extension, this -** function is called by the sqlite3_extension_init() entry point. -*/ -SQLITE_PRIVATE int sqlite3Fts3Init(sqlite3 *db){ - int rc = SQLITE_OK; - Fts3Hash *pHash = 0; - const sqlite3_tokenizer_module *pSimple = 0; - const sqlite3_tokenizer_module *pPorter = 0; -#ifdef SQLITE_ENABLE_FTS4_UNICODE61 - const sqlite3_tokenizer_module *pUnicode = 0; -#endif - -#ifdef SQLITE_ENABLE_ICU - const sqlite3_tokenizer_module *pIcu = 0; - sqlite3Fts3IcuTokenizerModule(&pIcu); -#endif - -#ifdef SQLITE_ENABLE_FTS4_UNICODE61 - sqlite3Fts3UnicodeTokenizer(&pUnicode); -#endif - -#ifdef SQLITE_TEST - rc = sqlite3Fts3InitTerm(db); - if( rc!=SQLITE_OK ) return rc; -#endif - - rc = sqlite3Fts3InitAux(db); - if( rc!=SQLITE_OK ) return rc; - - sqlite3Fts3SimpleTokenizerModule(&pSimple); - sqlite3Fts3PorterTokenizerModule(&pPorter); - - /* Allocate and initialize the hash-table used to store tokenizers. */ - pHash = sqlite3_malloc(sizeof(Fts3Hash)); - if( !pHash ){ - rc = SQLITE_NOMEM; - }else{ - sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1); - } - - /* Load the built-in tokenizers into the hash table */ - if( rc==SQLITE_OK ){ - if( sqlite3Fts3HashInsert(pHash, "simple", 7, (void *)pSimple) - || sqlite3Fts3HashInsert(pHash, "porter", 7, (void *)pPorter) - -#ifdef SQLITE_ENABLE_FTS4_UNICODE61 - || sqlite3Fts3HashInsert(pHash, "unicode61", 10, (void *)pUnicode) -#endif -#ifdef SQLITE_ENABLE_ICU - || (pIcu && sqlite3Fts3HashInsert(pHash, "icu", 4, (void *)pIcu)) -#endif - ){ - rc = SQLITE_NOMEM; - } - } - -#ifdef SQLITE_TEST - if( rc==SQLITE_OK ){ - rc = sqlite3Fts3ExprInitTestInterface(db); - } -#endif - - /* Create the virtual table wrapper around the hash-table and overload - ** the two scalar functions. If this is successful, register the - ** module with sqlite. - */ - if( SQLITE_OK==rc - && SQLITE_OK==(rc = sqlite3Fts3InitHashTable(db, pHash, "fts3_tokenizer")) - && SQLITE_OK==(rc = sqlite3_overload_function(db, "snippet", -1)) - && SQLITE_OK==(rc = sqlite3_overload_function(db, "offsets", 1)) - && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 1)) - && SQLITE_OK==(rc = sqlite3_overload_function(db, "matchinfo", 2)) - && SQLITE_OK==(rc = sqlite3_overload_function(db, "optimize", 1)) - ){ - rc = sqlite3_create_module_v2( - db, "fts3", &fts3Module, (void *)pHash, hashDestroy - ); - if( rc==SQLITE_OK ){ - rc = sqlite3_create_module_v2( - db, "fts4", &fts3Module, (void *)pHash, 0 - ); - } - if( rc==SQLITE_OK ){ - rc = sqlite3Fts3InitTok(db, (void *)pHash); - } - return rc; - } - - - /* An error has occurred. Delete the hash table and return the error code. */ - assert( rc!=SQLITE_OK ); - if( pHash ){ - sqlite3Fts3HashClear(pHash); - sqlite3_free(pHash); - } - return rc; -} - -/* -** Allocate an Fts3MultiSegReader for each token in the expression headed -** by pExpr. -** -** An Fts3SegReader object is a cursor that can seek or scan a range of -** entries within a single segment b-tree. An Fts3MultiSegReader uses multiple -** Fts3SegReader objects internally to provide an interface to seek or scan -** within the union of all segments of a b-tree. Hence the name. -** -** If the allocated Fts3MultiSegReader just seeks to a single entry in a -** segment b-tree (if the term is not a prefix or it is a prefix for which -** there exists prefix b-tree of the right length) then it may be traversed -** and merged incrementally. Otherwise, it has to be merged into an in-memory -** doclist and then traversed. -*/ -static void fts3EvalAllocateReaders( - Fts3Cursor *pCsr, /* FTS cursor handle */ - Fts3Expr *pExpr, /* Allocate readers for this expression */ - int *pnToken, /* OUT: Total number of tokens in phrase. */ - int *pnOr, /* OUT: Total number of OR nodes in expr. */ - int *pRc /* IN/OUT: Error code */ -){ - if( pExpr && SQLITE_OK==*pRc ){ - if( pExpr->eType==FTSQUERY_PHRASE ){ - int i; - int nToken = pExpr->pPhrase->nToken; - *pnToken += nToken; - for(i=0; ipPhrase->aToken[i]; - int rc = fts3TermSegReaderCursor(pCsr, - pToken->z, pToken->n, pToken->isPrefix, &pToken->pSegcsr - ); - if( rc!=SQLITE_OK ){ - *pRc = rc; - return; - } - } - assert( pExpr->pPhrase->iDoclistToken==0 ); - pExpr->pPhrase->iDoclistToken = -1; - }else{ - *pnOr += (pExpr->eType==FTSQUERY_OR); - fts3EvalAllocateReaders(pCsr, pExpr->pLeft, pnToken, pnOr, pRc); - fts3EvalAllocateReaders(pCsr, pExpr->pRight, pnToken, pnOr, pRc); - } - } -} - -/* -** Arguments pList/nList contain the doclist for token iToken of phrase p. -** It is merged into the main doclist stored in p->doclist.aAll/nAll. -** -** This function assumes that pList points to a buffer allocated using -** sqlite3_malloc(). This function takes responsibility for eventually -** freeing the buffer. -*/ -static void fts3EvalPhraseMergeToken( - Fts3Table *pTab, /* FTS Table pointer */ - Fts3Phrase *p, /* Phrase to merge pList/nList into */ - int iToken, /* Token pList/nList corresponds to */ - char *pList, /* Pointer to doclist */ - int nList /* Number of bytes in pList */ -){ - assert( iToken!=p->iDoclistToken ); - - if( pList==0 ){ - sqlite3_free(p->doclist.aAll); - p->doclist.aAll = 0; - p->doclist.nAll = 0; - } - - else if( p->iDoclistToken<0 ){ - p->doclist.aAll = pList; - p->doclist.nAll = nList; - } - - else if( p->doclist.aAll==0 ){ - sqlite3_free(pList); - } - - else { - char *pLeft; - char *pRight; - int nLeft; - int nRight; - int nDiff; - - if( p->iDoclistTokendoclist.aAll; - nLeft = p->doclist.nAll; - pRight = pList; - nRight = nList; - nDiff = iToken - p->iDoclistToken; - }else{ - pRight = p->doclist.aAll; - nRight = p->doclist.nAll; - pLeft = pList; - nLeft = nList; - nDiff = p->iDoclistToken - iToken; - } - - fts3DoclistPhraseMerge(pTab->bDescIdx, nDiff, pLeft, nLeft, pRight,&nRight); - sqlite3_free(pLeft); - p->doclist.aAll = pRight; - p->doclist.nAll = nRight; - } - - if( iToken>p->iDoclistToken ) p->iDoclistToken = iToken; -} - -/* -** Load the doclist for phrase p into p->doclist.aAll/nAll. The loaded doclist -** does not take deferred tokens into account. -** -** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code. -*/ -static int fts3EvalPhraseLoad( - Fts3Cursor *pCsr, /* FTS Cursor handle */ - Fts3Phrase *p /* Phrase object */ -){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int iToken; - int rc = SQLITE_OK; - - for(iToken=0; rc==SQLITE_OK && iTokennToken; iToken++){ - Fts3PhraseToken *pToken = &p->aToken[iToken]; - assert( pToken->pDeferred==0 || pToken->pSegcsr==0 ); - - if( pToken->pSegcsr ){ - int nThis = 0; - char *pThis = 0; - rc = fts3TermSelect(pTab, pToken, p->iColumn, &nThis, &pThis); - if( rc==SQLITE_OK ){ - fts3EvalPhraseMergeToken(pTab, p, iToken, pThis, nThis); - } - } - assert( pToken->pSegcsr==0 ); - } - - return rc; -} - -/* -** This function is called on each phrase after the position lists for -** any deferred tokens have been loaded into memory. It updates the phrases -** current position list to include only those positions that are really -** instances of the phrase (after considering deferred tokens). If this -** means that the phrase does not appear in the current row, doclist.pList -** and doclist.nList are both zeroed. -** -** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code. -*/ -static int fts3EvalDeferredPhrase(Fts3Cursor *pCsr, Fts3Phrase *pPhrase){ - int iToken; /* Used to iterate through phrase tokens */ - char *aPoslist = 0; /* Position list for deferred tokens */ - int nPoslist = 0; /* Number of bytes in aPoslist */ - int iPrev = -1; /* Token number of previous deferred token */ - - assert( pPhrase->doclist.bFreeList==0 ); - - for(iToken=0; iTokennToken; iToken++){ - Fts3PhraseToken *pToken = &pPhrase->aToken[iToken]; - Fts3DeferredToken *pDeferred = pToken->pDeferred; - - if( pDeferred ){ - char *pList; - int nList; - int rc = sqlite3Fts3DeferredTokenList(pDeferred, &pList, &nList); - if( rc!=SQLITE_OK ) return rc; - - if( pList==0 ){ - sqlite3_free(aPoslist); - pPhrase->doclist.pList = 0; - pPhrase->doclist.nList = 0; - return SQLITE_OK; - - }else if( aPoslist==0 ){ - aPoslist = pList; - nPoslist = nList; - - }else{ - char *aOut = pList; - char *p1 = aPoslist; - char *p2 = aOut; - - assert( iPrev>=0 ); - fts3PoslistPhraseMerge(&aOut, iToken-iPrev, 0, 1, &p1, &p2); - sqlite3_free(aPoslist); - aPoslist = pList; - nPoslist = (int)(aOut - aPoslist); - if( nPoslist==0 ){ - sqlite3_free(aPoslist); - pPhrase->doclist.pList = 0; - pPhrase->doclist.nList = 0; - return SQLITE_OK; - } - } - iPrev = iToken; - } - } - - if( iPrev>=0 ){ - int nMaxUndeferred = pPhrase->iDoclistToken; - if( nMaxUndeferred<0 ){ - pPhrase->doclist.pList = aPoslist; - pPhrase->doclist.nList = nPoslist; - pPhrase->doclist.iDocid = pCsr->iPrevId; - pPhrase->doclist.bFreeList = 1; - }else{ - int nDistance; - char *p1; - char *p2; - char *aOut; - - if( nMaxUndeferred>iPrev ){ - p1 = aPoslist; - p2 = pPhrase->doclist.pList; - nDistance = nMaxUndeferred - iPrev; - }else{ - p1 = pPhrase->doclist.pList; - p2 = aPoslist; - nDistance = iPrev - nMaxUndeferred; - } - - aOut = (char *)sqlite3_malloc(nPoslist+8); - if( !aOut ){ - sqlite3_free(aPoslist); - return SQLITE_NOMEM; - } - - pPhrase->doclist.pList = aOut; - if( fts3PoslistPhraseMerge(&aOut, nDistance, 0, 1, &p1, &p2) ){ - pPhrase->doclist.bFreeList = 1; - pPhrase->doclist.nList = (int)(aOut - pPhrase->doclist.pList); - }else{ - sqlite3_free(aOut); - pPhrase->doclist.pList = 0; - pPhrase->doclist.nList = 0; - } - sqlite3_free(aPoslist); - } - } - - return SQLITE_OK; -} - -/* -** Maximum number of tokens a phrase may have to be considered for the -** incremental doclists strategy. -*/ -#define MAX_INCR_PHRASE_TOKENS 4 - -/* -** This function is called for each Fts3Phrase in a full-text query -** expression to initialize the mechanism for returning rows. Once this -** function has been called successfully on an Fts3Phrase, it may be -** used with fts3EvalPhraseNext() to iterate through the matching docids. -** -** If parameter bOptOk is true, then the phrase may (or may not) use the -** incremental loading strategy. Otherwise, the entire doclist is loaded into -** memory within this call. -** -** SQLITE_OK is returned if no error occurs, otherwise an SQLite error code. -*/ -static int fts3EvalPhraseStart(Fts3Cursor *pCsr, int bOptOk, Fts3Phrase *p){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int rc = SQLITE_OK; /* Error code */ - int i; - - /* Determine if doclists may be loaded from disk incrementally. This is - ** possible if the bOptOk argument is true, the FTS doclists will be - ** scanned in forward order, and the phrase consists of - ** MAX_INCR_PHRASE_TOKENS or fewer tokens, none of which are are "^first" - ** tokens or prefix tokens that cannot use a prefix-index. */ - int bHaveIncr = 0; - int bIncrOk = (bOptOk - && pCsr->bDesc==pTab->bDescIdx - && p->nToken<=MAX_INCR_PHRASE_TOKENS && p->nToken>0 - && p->nToken<=MAX_INCR_PHRASE_TOKENS && p->nToken>0 -#ifdef SQLITE_TEST - && pTab->bNoIncrDoclist==0 -#endif - ); - for(i=0; bIncrOk==1 && inToken; i++){ - Fts3PhraseToken *pToken = &p->aToken[i]; - if( pToken->bFirst || (pToken->pSegcsr!=0 && !pToken->pSegcsr->bLookup) ){ - bIncrOk = 0; - } - if( pToken->pSegcsr ) bHaveIncr = 1; - } - - if( bIncrOk && bHaveIncr ){ - /* Use the incremental approach. */ - int iCol = (p->iColumn >= pTab->nColumn ? -1 : p->iColumn); - for(i=0; rc==SQLITE_OK && inToken; i++){ - Fts3PhraseToken *pToken = &p->aToken[i]; - Fts3MultiSegReader *pSegcsr = pToken->pSegcsr; - if( pSegcsr ){ - rc = sqlite3Fts3MsrIncrStart(pTab, pSegcsr, iCol, pToken->z, pToken->n); - } - } - p->bIncr = 1; - }else{ - /* Load the full doclist for the phrase into memory. */ - rc = fts3EvalPhraseLoad(pCsr, p); - p->bIncr = 0; - } - - assert( rc!=SQLITE_OK || p->nToken<1 || p->aToken[0].pSegcsr==0 || p->bIncr ); - return rc; -} - -/* -** This function is used to iterate backwards (from the end to start) -** through doclists. It is used by this module to iterate through phrase -** doclists in reverse and by the fts3_write.c module to iterate through -** pending-terms lists when writing to databases with "order=desc". -** -** The doclist may be sorted in ascending (parameter bDescIdx==0) or -** descending (parameter bDescIdx==1) order of docid. Regardless, this -** function iterates from the end of the doclist to the beginning. -*/ -SQLITE_PRIVATE void sqlite3Fts3DoclistPrev( - int bDescIdx, /* True if the doclist is desc */ - char *aDoclist, /* Pointer to entire doclist */ - int nDoclist, /* Length of aDoclist in bytes */ - char **ppIter, /* IN/OUT: Iterator pointer */ - sqlite3_int64 *piDocid, /* IN/OUT: Docid pointer */ - int *pnList, /* OUT: List length pointer */ - u8 *pbEof /* OUT: End-of-file flag */ -){ - char *p = *ppIter; - - assert( nDoclist>0 ); - assert( *pbEof==0 ); - assert( p || *piDocid==0 ); - assert( !p || (p>aDoclist && p<&aDoclist[nDoclist]) ); - - if( p==0 ){ - sqlite3_int64 iDocid = 0; - char *pNext = 0; - char *pDocid = aDoclist; - char *pEnd = &aDoclist[nDoclist]; - int iMul = 1; - - while( pDocid0 ); - assert( *pbEof==0 ); - assert( p || *piDocid==0 ); - assert( !p || (p>=aDoclist && p<=&aDoclist[nDoclist]) ); - - if( p==0 ){ - p = aDoclist; - p += sqlite3Fts3GetVarint(p, piDocid); - }else{ - fts3PoslistCopy(0, &p); - if( p>=&aDoclist[nDoclist] ){ - *pbEof = 1; - }else{ - sqlite3_int64 iVar; - p += sqlite3Fts3GetVarint(p, &iVar); - *piDocid += ((bDescIdx ? -1 : 1) * iVar); - } - } - - *ppIter = p; -} - -/* -** Advance the iterator pDL to the next entry in pDL->aAll/nAll. Set *pbEof -** to true if EOF is reached. -*/ -static void fts3EvalDlPhraseNext( - Fts3Table *pTab, - Fts3Doclist *pDL, - u8 *pbEof -){ - char *pIter; /* Used to iterate through aAll */ - char *pEnd = &pDL->aAll[pDL->nAll]; /* 1 byte past end of aAll */ - - if( pDL->pNextDocid ){ - pIter = pDL->pNextDocid; - }else{ - pIter = pDL->aAll; - } - - if( pIter>=pEnd ){ - /* We have already reached the end of this doclist. EOF. */ - *pbEof = 1; - }else{ - sqlite3_int64 iDelta; - pIter += sqlite3Fts3GetVarint(pIter, &iDelta); - if( pTab->bDescIdx==0 || pDL->pNextDocid==0 ){ - pDL->iDocid += iDelta; - }else{ - pDL->iDocid -= iDelta; - } - pDL->pList = pIter; - fts3PoslistCopy(0, &pIter); - pDL->nList = (int)(pIter - pDL->pList); - - /* pIter now points just past the 0x00 that terminates the position- - ** list for document pDL->iDocid. However, if this position-list was - ** edited in place by fts3EvalNearTrim(), then pIter may not actually - ** point to the start of the next docid value. The following line deals - ** with this case by advancing pIter past the zero-padding added by - ** fts3EvalNearTrim(). */ - while( pIterpNextDocid = pIter; - assert( pIter>=&pDL->aAll[pDL->nAll] || *pIter ); - *pbEof = 0; - } -} - -/* -** Helper type used by fts3EvalIncrPhraseNext() and incrPhraseTokenNext(). -*/ -typedef struct TokenDoclist TokenDoclist; -struct TokenDoclist { - int bIgnore; - sqlite3_int64 iDocid; - char *pList; - int nList; -}; - -/* -** Token pToken is an incrementally loaded token that is part of a -** multi-token phrase. Advance it to the next matching document in the -** database and populate output variable *p with the details of the new -** entry. Or, if the iterator has reached EOF, set *pbEof to true. -** -** If an error occurs, return an SQLite error code. Otherwise, return -** SQLITE_OK. -*/ -static int incrPhraseTokenNext( - Fts3Table *pTab, /* Virtual table handle */ - Fts3Phrase *pPhrase, /* Phrase to advance token of */ - int iToken, /* Specific token to advance */ - TokenDoclist *p, /* OUT: Docid and doclist for new entry */ - u8 *pbEof /* OUT: True if iterator is at EOF */ -){ - int rc = SQLITE_OK; - - if( pPhrase->iDoclistToken==iToken ){ - assert( p->bIgnore==0 ); - assert( pPhrase->aToken[iToken].pSegcsr==0 ); - fts3EvalDlPhraseNext(pTab, &pPhrase->doclist, pbEof); - p->pList = pPhrase->doclist.pList; - p->nList = pPhrase->doclist.nList; - p->iDocid = pPhrase->doclist.iDocid; - }else{ - Fts3PhraseToken *pToken = &pPhrase->aToken[iToken]; - assert( pToken->pDeferred==0 ); - assert( pToken->pSegcsr || pPhrase->iDoclistToken>=0 ); - if( pToken->pSegcsr ){ - assert( p->bIgnore==0 ); - rc = sqlite3Fts3MsrIncrNext( - pTab, pToken->pSegcsr, &p->iDocid, &p->pList, &p->nList - ); - if( p->pList==0 ) *pbEof = 1; - }else{ - p->bIgnore = 1; - } - } - - return rc; -} - - -/* -** The phrase iterator passed as the second argument: -** -** * features at least one token that uses an incremental doclist, and -** -** * does not contain any deferred tokens. -** -** Advance it to the next matching documnent in the database and populate -** the Fts3Doclist.pList and nList fields. -** -** If there is no "next" entry and no error occurs, then *pbEof is set to -** 1 before returning. Otherwise, if no error occurs and the iterator is -** successfully advanced, *pbEof is set to 0. -** -** If an error occurs, return an SQLite error code. Otherwise, return -** SQLITE_OK. -*/ -static int fts3EvalIncrPhraseNext( - Fts3Cursor *pCsr, /* FTS Cursor handle */ - Fts3Phrase *p, /* Phrase object to advance to next docid */ - u8 *pbEof /* OUT: Set to 1 if EOF */ -){ - int rc = SQLITE_OK; - Fts3Doclist *pDL = &p->doclist; - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - u8 bEof = 0; - - /* This is only called if it is guaranteed that the phrase has at least - ** one incremental token. In which case the bIncr flag is set. */ - assert( p->bIncr==1 ); - - if( p->nToken==1 && p->bIncr ){ - rc = sqlite3Fts3MsrIncrNext(pTab, p->aToken[0].pSegcsr, - &pDL->iDocid, &pDL->pList, &pDL->nList - ); - if( pDL->pList==0 ) bEof = 1; - }else{ - int bDescDoclist = pCsr->bDesc; - struct TokenDoclist a[MAX_INCR_PHRASE_TOKENS]; - - memset(a, 0, sizeof(a)); - assert( p->nToken<=MAX_INCR_PHRASE_TOKENS ); - assert( p->iDoclistTokennToken && bEof==0; i++){ - rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof); - if( a[i].bIgnore==0 && (bMaxSet==0 || DOCID_CMP(iMax, a[i].iDocid)<0) ){ - iMax = a[i].iDocid; - bMaxSet = 1; - } - } - assert( rc!=SQLITE_OK || a[p->nToken-1].bIgnore==0 ); - assert( rc!=SQLITE_OK || bMaxSet ); - - /* Keep advancing iterators until they all point to the same document */ - for(i=0; inToken; i++){ - while( rc==SQLITE_OK && bEof==0 - && a[i].bIgnore==0 && DOCID_CMP(a[i].iDocid, iMax)<0 - ){ - rc = incrPhraseTokenNext(pTab, p, i, &a[i], &bEof); - if( DOCID_CMP(a[i].iDocid, iMax)>0 ){ - iMax = a[i].iDocid; - i = 0; - } - } - } - - /* Check if the current entries really are a phrase match */ - if( bEof==0 ){ - int nList = 0; - int nByte = a[p->nToken-1].nList; - char *aDoclist = sqlite3_malloc(nByte+1); - if( !aDoclist ) return SQLITE_NOMEM; - memcpy(aDoclist, a[p->nToken-1].pList, nByte+1); - - for(i=0; i<(p->nToken-1); i++){ - if( a[i].bIgnore==0 ){ - char *pL = a[i].pList; - char *pR = aDoclist; - char *pOut = aDoclist; - int nDist = p->nToken-1-i; - int res = fts3PoslistPhraseMerge(&pOut, nDist, 0, 1, &pL, &pR); - if( res==0 ) break; - nList = (int)(pOut - aDoclist); - } - } - if( i==(p->nToken-1) ){ - pDL->iDocid = iMax; - pDL->pList = aDoclist; - pDL->nList = nList; - pDL->bFreeList = 1; - break; - } - sqlite3_free(aDoclist); - } - } - } - - *pbEof = bEof; - return rc; -} - -/* -** Attempt to move the phrase iterator to point to the next matching docid. -** If an error occurs, return an SQLite error code. Otherwise, return -** SQLITE_OK. -** -** If there is no "next" entry and no error occurs, then *pbEof is set to -** 1 before returning. Otherwise, if no error occurs and the iterator is -** successfully advanced, *pbEof is set to 0. -*/ -static int fts3EvalPhraseNext( - Fts3Cursor *pCsr, /* FTS Cursor handle */ - Fts3Phrase *p, /* Phrase object to advance to next docid */ - u8 *pbEof /* OUT: Set to 1 if EOF */ -){ - int rc = SQLITE_OK; - Fts3Doclist *pDL = &p->doclist; - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - - if( p->bIncr ){ - rc = fts3EvalIncrPhraseNext(pCsr, p, pbEof); - }else if( pCsr->bDesc!=pTab->bDescIdx && pDL->nAll ){ - sqlite3Fts3DoclistPrev(pTab->bDescIdx, pDL->aAll, pDL->nAll, - &pDL->pNextDocid, &pDL->iDocid, &pDL->nList, pbEof - ); - pDL->pList = pDL->pNextDocid; - }else{ - fts3EvalDlPhraseNext(pTab, pDL, pbEof); - } - - return rc; -} - -/* -** -** If *pRc is not SQLITE_OK when this function is called, it is a no-op. -** Otherwise, fts3EvalPhraseStart() is called on all phrases within the -** expression. Also the Fts3Expr.bDeferred variable is set to true for any -** expressions for which all descendent tokens are deferred. -** -** If parameter bOptOk is zero, then it is guaranteed that the -** Fts3Phrase.doclist.aAll/nAll variables contain the entire doclist for -** each phrase in the expression (subject to deferred token processing). -** Or, if bOptOk is non-zero, then one or more tokens within the expression -** may be loaded incrementally, meaning doclist.aAll/nAll is not available. -** -** If an error occurs within this function, *pRc is set to an SQLite error -** code before returning. -*/ -static void fts3EvalStartReaders( - Fts3Cursor *pCsr, /* FTS Cursor handle */ - Fts3Expr *pExpr, /* Expression to initialize phrases in */ - int *pRc /* IN/OUT: Error code */ -){ - if( pExpr && SQLITE_OK==*pRc ){ - if( pExpr->eType==FTSQUERY_PHRASE ){ - int i; - int nToken = pExpr->pPhrase->nToken; - for(i=0; ipPhrase->aToken[i].pDeferred==0 ) break; - } - pExpr->bDeferred = (i==nToken); - *pRc = fts3EvalPhraseStart(pCsr, 1, pExpr->pPhrase); - }else{ - fts3EvalStartReaders(pCsr, pExpr->pLeft, pRc); - fts3EvalStartReaders(pCsr, pExpr->pRight, pRc); - pExpr->bDeferred = (pExpr->pLeft->bDeferred && pExpr->pRight->bDeferred); - } - } -} - -/* -** An array of the following structures is assembled as part of the process -** of selecting tokens to defer before the query starts executing (as part -** of the xFilter() method). There is one element in the array for each -** token in the FTS expression. -** -** Tokens are divided into AND/NEAR clusters. All tokens in a cluster belong -** to phrases that are connected only by AND and NEAR operators (not OR or -** NOT). When determining tokens to defer, each AND/NEAR cluster is considered -** separately. The root of a tokens AND/NEAR cluster is stored in -** Fts3TokenAndCost.pRoot. -*/ -typedef struct Fts3TokenAndCost Fts3TokenAndCost; -struct Fts3TokenAndCost { - Fts3Phrase *pPhrase; /* The phrase the token belongs to */ - int iToken; /* Position of token in phrase */ - Fts3PhraseToken *pToken; /* The token itself */ - Fts3Expr *pRoot; /* Root of NEAR/AND cluster */ - int nOvfl; /* Number of overflow pages to load doclist */ - int iCol; /* The column the token must match */ -}; - -/* -** This function is used to populate an allocated Fts3TokenAndCost array. -** -** If *pRc is not SQLITE_OK when this function is called, it is a no-op. -** Otherwise, if an error occurs during execution, *pRc is set to an -** SQLite error code. -*/ -static void fts3EvalTokenCosts( - Fts3Cursor *pCsr, /* FTS Cursor handle */ - Fts3Expr *pRoot, /* Root of current AND/NEAR cluster */ - Fts3Expr *pExpr, /* Expression to consider */ - Fts3TokenAndCost **ppTC, /* Write new entries to *(*ppTC)++ */ - Fts3Expr ***ppOr, /* Write new OR root to *(*ppOr)++ */ - int *pRc /* IN/OUT: Error code */ -){ - if( *pRc==SQLITE_OK ){ - if( pExpr->eType==FTSQUERY_PHRASE ){ - Fts3Phrase *pPhrase = pExpr->pPhrase; - int i; - for(i=0; *pRc==SQLITE_OK && inToken; i++){ - Fts3TokenAndCost *pTC = (*ppTC)++; - pTC->pPhrase = pPhrase; - pTC->iToken = i; - pTC->pRoot = pRoot; - pTC->pToken = &pPhrase->aToken[i]; - pTC->iCol = pPhrase->iColumn; - *pRc = sqlite3Fts3MsrOvfl(pCsr, pTC->pToken->pSegcsr, &pTC->nOvfl); - } - }else if( pExpr->eType!=FTSQUERY_NOT ){ - assert( pExpr->eType==FTSQUERY_OR - || pExpr->eType==FTSQUERY_AND - || pExpr->eType==FTSQUERY_NEAR - ); - assert( pExpr->pLeft && pExpr->pRight ); - if( pExpr->eType==FTSQUERY_OR ){ - pRoot = pExpr->pLeft; - **ppOr = pRoot; - (*ppOr)++; - } - fts3EvalTokenCosts(pCsr, pRoot, pExpr->pLeft, ppTC, ppOr, pRc); - if( pExpr->eType==FTSQUERY_OR ){ - pRoot = pExpr->pRight; - **ppOr = pRoot; - (*ppOr)++; - } - fts3EvalTokenCosts(pCsr, pRoot, pExpr->pRight, ppTC, ppOr, pRc); - } - } -} - -/* -** Determine the average document (row) size in pages. If successful, -** write this value to *pnPage and return SQLITE_OK. Otherwise, return -** an SQLite error code. -** -** The average document size in pages is calculated by first calculating -** determining the average size in bytes, B. If B is less than the amount -** of data that will fit on a single leaf page of an intkey table in -** this database, then the average docsize is 1. Otherwise, it is 1 plus -** the number of overflow pages consumed by a record B bytes in size. -*/ -static int fts3EvalAverageDocsize(Fts3Cursor *pCsr, int *pnPage){ - if( pCsr->nRowAvg==0 ){ - /* The average document size, which is required to calculate the cost - ** of each doclist, has not yet been determined. Read the required - ** data from the %_stat table to calculate it. - ** - ** Entry 0 of the %_stat table is a blob containing (nCol+1) FTS3 - ** varints, where nCol is the number of columns in the FTS3 table. - ** The first varint is the number of documents currently stored in - ** the table. The following nCol varints contain the total amount of - ** data stored in all rows of each column of the table, from left - ** to right. - */ - int rc; - Fts3Table *p = (Fts3Table*)pCsr->base.pVtab; - sqlite3_stmt *pStmt; - sqlite3_int64 nDoc = 0; - sqlite3_int64 nByte = 0; - const char *pEnd; - const char *a; - - rc = sqlite3Fts3SelectDoctotal(p, &pStmt); - if( rc!=SQLITE_OK ) return rc; - a = sqlite3_column_blob(pStmt, 0); - assert( a ); - - pEnd = &a[sqlite3_column_bytes(pStmt, 0)]; - a += sqlite3Fts3GetVarint(a, &nDoc); - while( anDoc = nDoc; - pCsr->nRowAvg = (int)(((nByte / nDoc) + p->nPgsz) / p->nPgsz); - assert( pCsr->nRowAvg>0 ); - rc = sqlite3_reset(pStmt); - if( rc!=SQLITE_OK ) return rc; - } - - *pnPage = pCsr->nRowAvg; - return SQLITE_OK; -} - -/* -** This function is called to select the tokens (if any) that will be -** deferred. The array aTC[] has already been populated when this is -** called. -** -** This function is called once for each AND/NEAR cluster in the -** expression. Each invocation determines which tokens to defer within -** the cluster with root node pRoot. See comments above the definition -** of struct Fts3TokenAndCost for more details. -** -** If no error occurs, SQLITE_OK is returned and sqlite3Fts3DeferToken() -** called on each token to defer. Otherwise, an SQLite error code is -** returned. -*/ -static int fts3EvalSelectDeferred( - Fts3Cursor *pCsr, /* FTS Cursor handle */ - Fts3Expr *pRoot, /* Consider tokens with this root node */ - Fts3TokenAndCost *aTC, /* Array of expression tokens and costs */ - int nTC /* Number of entries in aTC[] */ -){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int nDocSize = 0; /* Number of pages per doc loaded */ - int rc = SQLITE_OK; /* Return code */ - int ii; /* Iterator variable for various purposes */ - int nOvfl = 0; /* Total overflow pages used by doclists */ - int nToken = 0; /* Total number of tokens in cluster */ - - int nMinEst = 0; /* The minimum count for any phrase so far. */ - int nLoad4 = 1; /* (Phrases that will be loaded)^4. */ - - /* Tokens are never deferred for FTS tables created using the content=xxx - ** option. The reason being that it is not guaranteed that the content - ** table actually contains the same data as the index. To prevent this from - ** causing any problems, the deferred token optimization is completely - ** disabled for content=xxx tables. */ - if( pTab->zContentTbl ){ - return SQLITE_OK; - } - - /* Count the tokens in this AND/NEAR cluster. If none of the doclists - ** associated with the tokens spill onto overflow pages, or if there is - ** only 1 token, exit early. No tokens to defer in this case. */ - for(ii=0; ii0 ); - - - /* Iterate through all tokens in this AND/NEAR cluster, in ascending order - ** of the number of overflow pages that will be loaded by the pager layer - ** to retrieve the entire doclist for the token from the full-text index. - ** Load the doclists for tokens that are either: - ** - ** a. The cheapest token in the entire query (i.e. the one visited by the - ** first iteration of this loop), or - ** - ** b. Part of a multi-token phrase. - ** - ** After each token doclist is loaded, merge it with the others from the - ** same phrase and count the number of documents that the merged doclist - ** contains. Set variable "nMinEst" to the smallest number of documents in - ** any phrase doclist for which 1 or more token doclists have been loaded. - ** Let nOther be the number of other phrases for which it is certain that - ** one or more tokens will not be deferred. - ** - ** Then, for each token, defer it if loading the doclist would result in - ** loading N or more overflow pages into memory, where N is computed as: - ** - ** (nMinEst + 4^nOther - 1) / (4^nOther) - */ - for(ii=0; iinOvfl) - ){ - pTC = &aTC[iTC]; - } - } - assert( pTC ); - - if( ii && pTC->nOvfl>=((nMinEst+(nLoad4/4)-1)/(nLoad4/4))*nDocSize ){ - /* The number of overflow pages to load for this (and therefore all - ** subsequent) tokens is greater than the estimated number of pages - ** that will be loaded if all subsequent tokens are deferred. - */ - Fts3PhraseToken *pToken = pTC->pToken; - rc = sqlite3Fts3DeferToken(pCsr, pToken, pTC->iCol); - fts3SegReaderCursorFree(pToken->pSegcsr); - pToken->pSegcsr = 0; - }else{ - /* Set nLoad4 to the value of (4^nOther) for the next iteration of the - ** for-loop. Except, limit the value to 2^24 to prevent it from - ** overflowing the 32-bit integer it is stored in. */ - if( ii<12 ) nLoad4 = nLoad4*4; - - if( ii==0 || (pTC->pPhrase->nToken>1 && ii!=nToken-1) ){ - /* Either this is the cheapest token in the entire query, or it is - ** part of a multi-token phrase. Either way, the entire doclist will - ** (eventually) be loaded into memory. It may as well be now. */ - Fts3PhraseToken *pToken = pTC->pToken; - int nList = 0; - char *pList = 0; - rc = fts3TermSelect(pTab, pToken, pTC->iCol, &nList, &pList); - assert( rc==SQLITE_OK || pList==0 ); - if( rc==SQLITE_OK ){ - int nCount; - fts3EvalPhraseMergeToken(pTab, pTC->pPhrase, pTC->iToken,pList,nList); - nCount = fts3DoclistCountDocids( - pTC->pPhrase->doclist.aAll, pTC->pPhrase->doclist.nAll - ); - if( ii==0 || nCountpToken = 0; - } - - return rc; -} - -/* -** This function is called from within the xFilter method. It initializes -** the full-text query currently stored in pCsr->pExpr. To iterate through -** the results of a query, the caller does: -** -** fts3EvalStart(pCsr); -** while( 1 ){ -** fts3EvalNext(pCsr); -** if( pCsr->bEof ) break; -** ... return row pCsr->iPrevId to the caller ... -** } -*/ -static int fts3EvalStart(Fts3Cursor *pCsr){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int rc = SQLITE_OK; - int nToken = 0; - int nOr = 0; - - /* Allocate a MultiSegReader for each token in the expression. */ - fts3EvalAllocateReaders(pCsr, pCsr->pExpr, &nToken, &nOr, &rc); - - /* Determine which, if any, tokens in the expression should be deferred. */ -#ifndef SQLITE_DISABLE_FTS4_DEFERRED - if( rc==SQLITE_OK && nToken>1 && pTab->bFts4 ){ - Fts3TokenAndCost *aTC; - Fts3Expr **apOr; - aTC = (Fts3TokenAndCost *)sqlite3_malloc( - sizeof(Fts3TokenAndCost) * nToken - + sizeof(Fts3Expr *) * nOr * 2 - ); - apOr = (Fts3Expr **)&aTC[nToken]; - - if( !aTC ){ - rc = SQLITE_NOMEM; - }else{ - int ii; - Fts3TokenAndCost *pTC = aTC; - Fts3Expr **ppOr = apOr; - - fts3EvalTokenCosts(pCsr, 0, pCsr->pExpr, &pTC, &ppOr, &rc); - nToken = (int)(pTC-aTC); - nOr = (int)(ppOr-apOr); - - if( rc==SQLITE_OK ){ - rc = fts3EvalSelectDeferred(pCsr, 0, aTC, nToken); - for(ii=0; rc==SQLITE_OK && iipExpr, &rc); - return rc; -} - -/* -** Invalidate the current position list for phrase pPhrase. -*/ -static void fts3EvalInvalidatePoslist(Fts3Phrase *pPhrase){ - if( pPhrase->doclist.bFreeList ){ - sqlite3_free(pPhrase->doclist.pList); - } - pPhrase->doclist.pList = 0; - pPhrase->doclist.nList = 0; - pPhrase->doclist.bFreeList = 0; -} - -/* -** This function is called to edit the position list associated with -** the phrase object passed as the fifth argument according to a NEAR -** condition. For example: -** -** abc NEAR/5 "def ghi" -** -** Parameter nNear is passed the NEAR distance of the expression (5 in -** the example above). When this function is called, *paPoslist points to -** the position list, and *pnToken is the number of phrase tokens in, the -** phrase on the other side of the NEAR operator to pPhrase. For example, -** if pPhrase refers to the "def ghi" phrase, then *paPoslist points to -** the position list associated with phrase "abc". -** -** All positions in the pPhrase position list that are not sufficiently -** close to a position in the *paPoslist position list are removed. If this -** leaves 0 positions, zero is returned. Otherwise, non-zero. -** -** Before returning, *paPoslist is set to point to the position lsit -** associated with pPhrase. And *pnToken is set to the number of tokens in -** pPhrase. -*/ -static int fts3EvalNearTrim( - int nNear, /* NEAR distance. As in "NEAR/nNear". */ - char *aTmp, /* Temporary space to use */ - char **paPoslist, /* IN/OUT: Position list */ - int *pnToken, /* IN/OUT: Tokens in phrase of *paPoslist */ - Fts3Phrase *pPhrase /* The phrase object to trim the doclist of */ -){ - int nParam1 = nNear + pPhrase->nToken; - int nParam2 = nNear + *pnToken; - int nNew; - char *p2; - char *pOut; - int res; - - assert( pPhrase->doclist.pList ); - - p2 = pOut = pPhrase->doclist.pList; - res = fts3PoslistNearMerge( - &pOut, aTmp, nParam1, nParam2, paPoslist, &p2 - ); - if( res ){ - nNew = (int)(pOut - pPhrase->doclist.pList) - 1; - assert( pPhrase->doclist.pList[nNew]=='\0' ); - assert( nNew<=pPhrase->doclist.nList && nNew>0 ); - memset(&pPhrase->doclist.pList[nNew], 0, pPhrase->doclist.nList - nNew); - pPhrase->doclist.nList = nNew; - *paPoslist = pPhrase->doclist.pList; - *pnToken = pPhrase->nToken; - } - - return res; -} - -/* -** This function is a no-op if *pRc is other than SQLITE_OK when it is called. -** Otherwise, it advances the expression passed as the second argument to -** point to the next matching row in the database. Expressions iterate through -** matching rows in docid order. Ascending order if Fts3Cursor.bDesc is zero, -** or descending if it is non-zero. -** -** If an error occurs, *pRc is set to an SQLite error code. Otherwise, if -** successful, the following variables in pExpr are set: -** -** Fts3Expr.bEof (non-zero if EOF - there is no next row) -** Fts3Expr.iDocid (valid if bEof==0. The docid of the next row) -** -** If the expression is of type FTSQUERY_PHRASE, and the expression is not -** at EOF, then the following variables are populated with the position list -** for the phrase for the visited row: -** -** FTs3Expr.pPhrase->doclist.nList (length of pList in bytes) -** FTs3Expr.pPhrase->doclist.pList (pointer to position list) -** -** It says above that this function advances the expression to the next -** matching row. This is usually true, but there are the following exceptions: -** -** 1. Deferred tokens are not taken into account. If a phrase consists -** entirely of deferred tokens, it is assumed to match every row in -** the db. In this case the position-list is not populated at all. -** -** Or, if a phrase contains one or more deferred tokens and one or -** more non-deferred tokens, then the expression is advanced to the -** next possible match, considering only non-deferred tokens. In other -** words, if the phrase is "A B C", and "B" is deferred, the expression -** is advanced to the next row that contains an instance of "A * C", -** where "*" may match any single token. The position list in this case -** is populated as for "A * C" before returning. -** -** 2. NEAR is treated as AND. If the expression is "x NEAR y", it is -** advanced to point to the next row that matches "x AND y". -** -** See fts3EvalTestDeferredAndNear() for details on testing if a row is -** really a match, taking into account deferred tokens and NEAR operators. -*/ -static void fts3EvalNextRow( - Fts3Cursor *pCsr, /* FTS Cursor handle */ - Fts3Expr *pExpr, /* Expr. to advance to next matching row */ - int *pRc /* IN/OUT: Error code */ -){ - if( *pRc==SQLITE_OK ){ - int bDescDoclist = pCsr->bDesc; /* Used by DOCID_CMP() macro */ - assert( pExpr->bEof==0 ); - pExpr->bStart = 1; - - switch( pExpr->eType ){ - case FTSQUERY_NEAR: - case FTSQUERY_AND: { - Fts3Expr *pLeft = pExpr->pLeft; - Fts3Expr *pRight = pExpr->pRight; - assert( !pLeft->bDeferred || !pRight->bDeferred ); - - if( pLeft->bDeferred ){ - /* LHS is entirely deferred. So we assume it matches every row. - ** Advance the RHS iterator to find the next row visited. */ - fts3EvalNextRow(pCsr, pRight, pRc); - pExpr->iDocid = pRight->iDocid; - pExpr->bEof = pRight->bEof; - }else if( pRight->bDeferred ){ - /* RHS is entirely deferred. So we assume it matches every row. - ** Advance the LHS iterator to find the next row visited. */ - fts3EvalNextRow(pCsr, pLeft, pRc); - pExpr->iDocid = pLeft->iDocid; - pExpr->bEof = pLeft->bEof; - }else{ - /* Neither the RHS or LHS are deferred. */ - fts3EvalNextRow(pCsr, pLeft, pRc); - fts3EvalNextRow(pCsr, pRight, pRc); - while( !pLeft->bEof && !pRight->bEof && *pRc==SQLITE_OK ){ - sqlite3_int64 iDiff = DOCID_CMP(pLeft->iDocid, pRight->iDocid); - if( iDiff==0 ) break; - if( iDiff<0 ){ - fts3EvalNextRow(pCsr, pLeft, pRc); - }else{ - fts3EvalNextRow(pCsr, pRight, pRc); - } - } - pExpr->iDocid = pLeft->iDocid; - pExpr->bEof = (pLeft->bEof || pRight->bEof); - } - break; - } - - case FTSQUERY_OR: { - Fts3Expr *pLeft = pExpr->pLeft; - Fts3Expr *pRight = pExpr->pRight; - sqlite3_int64 iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid); - - assert( pLeft->bStart || pLeft->iDocid==pRight->iDocid ); - assert( pRight->bStart || pLeft->iDocid==pRight->iDocid ); - - if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){ - fts3EvalNextRow(pCsr, pLeft, pRc); - }else if( pLeft->bEof || (pRight->bEof==0 && iCmp>0) ){ - fts3EvalNextRow(pCsr, pRight, pRc); - }else{ - fts3EvalNextRow(pCsr, pLeft, pRc); - fts3EvalNextRow(pCsr, pRight, pRc); - } - - pExpr->bEof = (pLeft->bEof && pRight->bEof); - iCmp = DOCID_CMP(pLeft->iDocid, pRight->iDocid); - if( pRight->bEof || (pLeft->bEof==0 && iCmp<0) ){ - pExpr->iDocid = pLeft->iDocid; - }else{ - pExpr->iDocid = pRight->iDocid; - } - - break; - } - - case FTSQUERY_NOT: { - Fts3Expr *pLeft = pExpr->pLeft; - Fts3Expr *pRight = pExpr->pRight; - - if( pRight->bStart==0 ){ - fts3EvalNextRow(pCsr, pRight, pRc); - assert( *pRc!=SQLITE_OK || pRight->bStart ); - } - - fts3EvalNextRow(pCsr, pLeft, pRc); - if( pLeft->bEof==0 ){ - while( !*pRc - && !pRight->bEof - && DOCID_CMP(pLeft->iDocid, pRight->iDocid)>0 - ){ - fts3EvalNextRow(pCsr, pRight, pRc); - } - } - pExpr->iDocid = pLeft->iDocid; - pExpr->bEof = pLeft->bEof; - break; - } - - default: { - Fts3Phrase *pPhrase = pExpr->pPhrase; - fts3EvalInvalidatePoslist(pPhrase); - *pRc = fts3EvalPhraseNext(pCsr, pPhrase, &pExpr->bEof); - pExpr->iDocid = pPhrase->doclist.iDocid; - break; - } - } - } -} - -/* -** If *pRc is not SQLITE_OK, or if pExpr is not the root node of a NEAR -** cluster, then this function returns 1 immediately. -** -** Otherwise, it checks if the current row really does match the NEAR -** expression, using the data currently stored in the position lists -** (Fts3Expr->pPhrase.doclist.pList/nList) for each phrase in the expression. -** -** If the current row is a match, the position list associated with each -** phrase in the NEAR expression is edited in place to contain only those -** phrase instances sufficiently close to their peers to satisfy all NEAR -** constraints. In this case it returns 1. If the NEAR expression does not -** match the current row, 0 is returned. The position lists may or may not -** be edited if 0 is returned. -*/ -static int fts3EvalNearTest(Fts3Expr *pExpr, int *pRc){ - int res = 1; - - /* The following block runs if pExpr is the root of a NEAR query. - ** For example, the query: - ** - ** "w" NEAR "x" NEAR "y" NEAR "z" - ** - ** which is represented in tree form as: - ** - ** | - ** +--NEAR--+ <-- root of NEAR query - ** | | - ** +--NEAR--+ "z" - ** | | - ** +--NEAR--+ "y" - ** | | - ** "w" "x" - ** - ** The right-hand child of a NEAR node is always a phrase. The - ** left-hand child may be either a phrase or a NEAR node. There are - ** no exceptions to this - it's the way the parser in fts3_expr.c works. - */ - if( *pRc==SQLITE_OK - && pExpr->eType==FTSQUERY_NEAR - && pExpr->bEof==0 - && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR) - ){ - Fts3Expr *p; - int nTmp = 0; /* Bytes of temp space */ - char *aTmp; /* Temp space for PoslistNearMerge() */ - - /* Allocate temporary working space. */ - for(p=pExpr; p->pLeft; p=p->pLeft){ - nTmp += p->pRight->pPhrase->doclist.nList; - } - nTmp += p->pPhrase->doclist.nList; - if( nTmp==0 ){ - res = 0; - }else{ - aTmp = sqlite3_malloc(nTmp*2); - if( !aTmp ){ - *pRc = SQLITE_NOMEM; - res = 0; - }else{ - char *aPoslist = p->pPhrase->doclist.pList; - int nToken = p->pPhrase->nToken; - - for(p=p->pParent;res && p && p->eType==FTSQUERY_NEAR; p=p->pParent){ - Fts3Phrase *pPhrase = p->pRight->pPhrase; - int nNear = p->nNear; - res = fts3EvalNearTrim(nNear, aTmp, &aPoslist, &nToken, pPhrase); - } - - aPoslist = pExpr->pRight->pPhrase->doclist.pList; - nToken = pExpr->pRight->pPhrase->nToken; - for(p=pExpr->pLeft; p && res; p=p->pLeft){ - int nNear; - Fts3Phrase *pPhrase; - assert( p->pParent && p->pParent->pLeft==p ); - nNear = p->pParent->nNear; - pPhrase = ( - p->eType==FTSQUERY_NEAR ? p->pRight->pPhrase : p->pPhrase - ); - res = fts3EvalNearTrim(nNear, aTmp, &aPoslist, &nToken, pPhrase); - } - } - - sqlite3_free(aTmp); - } - } - - return res; -} - -/* -** This function is a helper function for fts3EvalTestDeferredAndNear(). -** Assuming no error occurs or has occurred, It returns non-zero if the -** expression passed as the second argument matches the row that pCsr -** currently points to, or zero if it does not. -** -** If *pRc is not SQLITE_OK when this function is called, it is a no-op. -** If an error occurs during execution of this function, *pRc is set to -** the appropriate SQLite error code. In this case the returned value is -** undefined. -*/ -static int fts3EvalTestExpr( - Fts3Cursor *pCsr, /* FTS cursor handle */ - Fts3Expr *pExpr, /* Expr to test. May or may not be root. */ - int *pRc /* IN/OUT: Error code */ -){ - int bHit = 1; /* Return value */ - if( *pRc==SQLITE_OK ){ - switch( pExpr->eType ){ - case FTSQUERY_NEAR: - case FTSQUERY_AND: - bHit = ( - fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc) - && fts3EvalTestExpr(pCsr, pExpr->pRight, pRc) - && fts3EvalNearTest(pExpr, pRc) - ); - - /* If the NEAR expression does not match any rows, zero the doclist for - ** all phrases involved in the NEAR. This is because the snippet(), - ** offsets() and matchinfo() functions are not supposed to recognize - ** any instances of phrases that are part of unmatched NEAR queries. - ** For example if this expression: - ** - ** ... MATCH 'a OR (b NEAR c)' - ** - ** is matched against a row containing: - ** - ** 'a b d e' - ** - ** then any snippet() should ony highlight the "a" term, not the "b" - ** (as "b" is part of a non-matching NEAR clause). - */ - if( bHit==0 - && pExpr->eType==FTSQUERY_NEAR - && (pExpr->pParent==0 || pExpr->pParent->eType!=FTSQUERY_NEAR) - ){ - Fts3Expr *p; - for(p=pExpr; p->pPhrase==0; p=p->pLeft){ - if( p->pRight->iDocid==pCsr->iPrevId ){ - fts3EvalInvalidatePoslist(p->pRight->pPhrase); - } - } - if( p->iDocid==pCsr->iPrevId ){ - fts3EvalInvalidatePoslist(p->pPhrase); - } - } - - break; - - case FTSQUERY_OR: { - int bHit1 = fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc); - int bHit2 = fts3EvalTestExpr(pCsr, pExpr->pRight, pRc); - bHit = bHit1 || bHit2; - break; - } - - case FTSQUERY_NOT: - bHit = ( - fts3EvalTestExpr(pCsr, pExpr->pLeft, pRc) - && !fts3EvalTestExpr(pCsr, pExpr->pRight, pRc) - ); - break; - - default: { -#ifndef SQLITE_DISABLE_FTS4_DEFERRED - if( pCsr->pDeferred - && (pExpr->iDocid==pCsr->iPrevId || pExpr->bDeferred) - ){ - Fts3Phrase *pPhrase = pExpr->pPhrase; - assert( pExpr->bDeferred || pPhrase->doclist.bFreeList==0 ); - if( pExpr->bDeferred ){ - fts3EvalInvalidatePoslist(pPhrase); - } - *pRc = fts3EvalDeferredPhrase(pCsr, pPhrase); - bHit = (pPhrase->doclist.pList!=0); - pExpr->iDocid = pCsr->iPrevId; - }else -#endif - { - bHit = (pExpr->bEof==0 && pExpr->iDocid==pCsr->iPrevId); - } - break; - } - } - } - return bHit; -} - -/* -** This function is called as the second part of each xNext operation when -** iterating through the results of a full-text query. At this point the -** cursor points to a row that matches the query expression, with the -** following caveats: -** -** * Up until this point, "NEAR" operators in the expression have been -** treated as "AND". -** -** * Deferred tokens have not yet been considered. -** -** If *pRc is not SQLITE_OK when this function is called, it immediately -** returns 0. Otherwise, it tests whether or not after considering NEAR -** operators and deferred tokens the current row is still a match for the -** expression. It returns 1 if both of the following are true: -** -** 1. *pRc is SQLITE_OK when this function returns, and -** -** 2. After scanning the current FTS table row for the deferred tokens, -** it is determined that the row does *not* match the query. -** -** Or, if no error occurs and it seems the current row does match the FTS -** query, return 0. -*/ -static int fts3EvalTestDeferredAndNear(Fts3Cursor *pCsr, int *pRc){ - int rc = *pRc; - int bMiss = 0; - if( rc==SQLITE_OK ){ - - /* If there are one or more deferred tokens, load the current row into - ** memory and scan it to determine the position list for each deferred - ** token. Then, see if this row is really a match, considering deferred - ** tokens and NEAR operators (neither of which were taken into account - ** earlier, by fts3EvalNextRow()). - */ - if( pCsr->pDeferred ){ - rc = fts3CursorSeek(0, pCsr); - if( rc==SQLITE_OK ){ - rc = sqlite3Fts3CacheDeferredDoclists(pCsr); - } - } - bMiss = (0==fts3EvalTestExpr(pCsr, pCsr->pExpr, &rc)); - - /* Free the position-lists accumulated for each deferred token above. */ - sqlite3Fts3FreeDeferredDoclists(pCsr); - *pRc = rc; - } - return (rc==SQLITE_OK && bMiss); -} - -/* -** Advance to the next document that matches the FTS expression in -** Fts3Cursor.pExpr. -*/ -static int fts3EvalNext(Fts3Cursor *pCsr){ - int rc = SQLITE_OK; /* Return Code */ - Fts3Expr *pExpr = pCsr->pExpr; - assert( pCsr->isEof==0 ); - if( pExpr==0 ){ - pCsr->isEof = 1; - }else{ - do { - if( pCsr->isRequireSeek==0 ){ - sqlite3_reset(pCsr->pStmt); - } - assert( sqlite3_data_count(pCsr->pStmt)==0 ); - fts3EvalNextRow(pCsr, pExpr, &rc); - pCsr->isEof = pExpr->bEof; - pCsr->isRequireSeek = 1; - pCsr->isMatchinfoNeeded = 1; - pCsr->iPrevId = pExpr->iDocid; - }while( pCsr->isEof==0 && fts3EvalTestDeferredAndNear(pCsr, &rc) ); - } - - /* Check if the cursor is past the end of the docid range specified - ** by Fts3Cursor.iMinDocid/iMaxDocid. If so, set the EOF flag. */ - if( rc==SQLITE_OK && ( - (pCsr->bDesc==0 && pCsr->iPrevId>pCsr->iMaxDocid) - || (pCsr->bDesc!=0 && pCsr->iPrevIdiMinDocid) - )){ - pCsr->isEof = 1; - } - - return rc; -} - -/* -** Restart interation for expression pExpr so that the next call to -** fts3EvalNext() visits the first row. Do not allow incremental -** loading or merging of phrase doclists for this iteration. -** -** If *pRc is other than SQLITE_OK when this function is called, it is -** a no-op. If an error occurs within this function, *pRc is set to an -** SQLite error code before returning. -*/ -static void fts3EvalRestart( - Fts3Cursor *pCsr, - Fts3Expr *pExpr, - int *pRc -){ - if( pExpr && *pRc==SQLITE_OK ){ - Fts3Phrase *pPhrase = pExpr->pPhrase; - - if( pPhrase ){ - fts3EvalInvalidatePoslist(pPhrase); - if( pPhrase->bIncr ){ - int i; - for(i=0; inToken; i++){ - Fts3PhraseToken *pToken = &pPhrase->aToken[i]; - assert( pToken->pDeferred==0 ); - if( pToken->pSegcsr ){ - sqlite3Fts3MsrIncrRestart(pToken->pSegcsr); - } - } - *pRc = fts3EvalPhraseStart(pCsr, 0, pPhrase); - } - pPhrase->doclist.pNextDocid = 0; - pPhrase->doclist.iDocid = 0; - } - - pExpr->iDocid = 0; - pExpr->bEof = 0; - pExpr->bStart = 0; - - fts3EvalRestart(pCsr, pExpr->pLeft, pRc); - fts3EvalRestart(pCsr, pExpr->pRight, pRc); - } -} - -/* -** After allocating the Fts3Expr.aMI[] array for each phrase in the -** expression rooted at pExpr, the cursor iterates through all rows matched -** by pExpr, calling this function for each row. This function increments -** the values in Fts3Expr.aMI[] according to the position-list currently -** found in Fts3Expr.pPhrase->doclist.pList for each of the phrase -** expression nodes. -*/ -static void fts3EvalUpdateCounts(Fts3Expr *pExpr){ - if( pExpr ){ - Fts3Phrase *pPhrase = pExpr->pPhrase; - if( pPhrase && pPhrase->doclist.pList ){ - int iCol = 0; - char *p = pPhrase->doclist.pList; - - assert( *p ); - while( 1 ){ - u8 c = 0; - int iCnt = 0; - while( 0xFE & (*p | c) ){ - if( (c&0x80)==0 ) iCnt++; - c = *p++ & 0x80; - } - - /* aMI[iCol*3 + 1] = Number of occurrences - ** aMI[iCol*3 + 2] = Number of rows containing at least one instance - */ - pExpr->aMI[iCol*3 + 1] += iCnt; - pExpr->aMI[iCol*3 + 2] += (iCnt>0); - if( *p==0x00 ) break; - p++; - p += fts3GetVarint32(p, &iCol); - } - } - - fts3EvalUpdateCounts(pExpr->pLeft); - fts3EvalUpdateCounts(pExpr->pRight); - } -} - -/* -** Expression pExpr must be of type FTSQUERY_PHRASE. -** -** If it is not already allocated and populated, this function allocates and -** populates the Fts3Expr.aMI[] array for expression pExpr. If pExpr is part -** of a NEAR expression, then it also allocates and populates the same array -** for all other phrases that are part of the NEAR expression. -** -** SQLITE_OK is returned if the aMI[] array is successfully allocated and -** populated. Otherwise, if an error occurs, an SQLite error code is returned. -*/ -static int fts3EvalGatherStats( - Fts3Cursor *pCsr, /* Cursor object */ - Fts3Expr *pExpr /* FTSQUERY_PHRASE expression */ -){ - int rc = SQLITE_OK; /* Return code */ - - assert( pExpr->eType==FTSQUERY_PHRASE ); - if( pExpr->aMI==0 ){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - Fts3Expr *pRoot; /* Root of NEAR expression */ - Fts3Expr *p; /* Iterator used for several purposes */ - - sqlite3_int64 iPrevId = pCsr->iPrevId; - sqlite3_int64 iDocid; - u8 bEof; - - /* Find the root of the NEAR expression */ - pRoot = pExpr; - while( pRoot->pParent && pRoot->pParent->eType==FTSQUERY_NEAR ){ - pRoot = pRoot->pParent; - } - iDocid = pRoot->iDocid; - bEof = pRoot->bEof; - assert( pRoot->bStart ); - - /* Allocate space for the aMSI[] array of each FTSQUERY_PHRASE node */ - for(p=pRoot; p; p=p->pLeft){ - Fts3Expr *pE = (p->eType==FTSQUERY_PHRASE?p:p->pRight); - assert( pE->aMI==0 ); - pE->aMI = (u32 *)sqlite3_malloc(pTab->nColumn * 3 * sizeof(u32)); - if( !pE->aMI ) return SQLITE_NOMEM; - memset(pE->aMI, 0, pTab->nColumn * 3 * sizeof(u32)); - } - - fts3EvalRestart(pCsr, pRoot, &rc); - - while( pCsr->isEof==0 && rc==SQLITE_OK ){ - - do { - /* Ensure the %_content statement is reset. */ - if( pCsr->isRequireSeek==0 ) sqlite3_reset(pCsr->pStmt); - assert( sqlite3_data_count(pCsr->pStmt)==0 ); - - /* Advance to the next document */ - fts3EvalNextRow(pCsr, pRoot, &rc); - pCsr->isEof = pRoot->bEof; - pCsr->isRequireSeek = 1; - pCsr->isMatchinfoNeeded = 1; - pCsr->iPrevId = pRoot->iDocid; - }while( pCsr->isEof==0 - && pRoot->eType==FTSQUERY_NEAR - && fts3EvalTestDeferredAndNear(pCsr, &rc) - ); - - if( rc==SQLITE_OK && pCsr->isEof==0 ){ - fts3EvalUpdateCounts(pRoot); - } - } - - pCsr->isEof = 0; - pCsr->iPrevId = iPrevId; - - if( bEof ){ - pRoot->bEof = bEof; - }else{ - /* Caution: pRoot may iterate through docids in ascending or descending - ** order. For this reason, even though it seems more defensive, the - ** do loop can not be written: - ** - ** do {...} while( pRoot->iDocidbEof==0 ); - }while( pRoot->iDocid!=iDocid && rc==SQLITE_OK ); - fts3EvalTestDeferredAndNear(pCsr, &rc); - } - } - return rc; -} - -/* -** This function is used by the matchinfo() module to query a phrase -** expression node for the following information: -** -** 1. The total number of occurrences of the phrase in each column of -** the FTS table (considering all rows), and -** -** 2. For each column, the number of rows in the table for which the -** column contains at least one instance of the phrase. -** -** If no error occurs, SQLITE_OK is returned and the values for each column -** written into the array aiOut as follows: -** -** aiOut[iCol*3 + 1] = Number of occurrences -** aiOut[iCol*3 + 2] = Number of rows containing at least one instance -** -** Caveats: -** -** * If a phrase consists entirely of deferred tokens, then all output -** values are set to the number of documents in the table. In other -** words we assume that very common tokens occur exactly once in each -** column of each row of the table. -** -** * If a phrase contains some deferred tokens (and some non-deferred -** tokens), count the potential occurrence identified by considering -** the non-deferred tokens instead of actual phrase occurrences. -** -** * If the phrase is part of a NEAR expression, then only phrase instances -** that meet the NEAR constraint are included in the counts. -*/ -SQLITE_PRIVATE int sqlite3Fts3EvalPhraseStats( - Fts3Cursor *pCsr, /* FTS cursor handle */ - Fts3Expr *pExpr, /* Phrase expression */ - u32 *aiOut /* Array to write results into (see above) */ -){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int rc = SQLITE_OK; - int iCol; - - if( pExpr->bDeferred && pExpr->pParent->eType!=FTSQUERY_NEAR ){ - assert( pCsr->nDoc>0 ); - for(iCol=0; iColnColumn; iCol++){ - aiOut[iCol*3 + 1] = (u32)pCsr->nDoc; - aiOut[iCol*3 + 2] = (u32)pCsr->nDoc; - } - }else{ - rc = fts3EvalGatherStats(pCsr, pExpr); - if( rc==SQLITE_OK ){ - assert( pExpr->aMI ); - for(iCol=0; iColnColumn; iCol++){ - aiOut[iCol*3 + 1] = pExpr->aMI[iCol*3 + 1]; - aiOut[iCol*3 + 2] = pExpr->aMI[iCol*3 + 2]; - } - } - } - - return rc; -} - -/* -** The expression pExpr passed as the second argument to this function -** must be of type FTSQUERY_PHRASE. -** -** The returned value is either NULL or a pointer to a buffer containing -** a position-list indicating the occurrences of the phrase in column iCol -** of the current row. -** -** More specifically, the returned buffer contains 1 varint for each -** occurrence of the phrase in the column, stored using the normal (delta+2) -** compression and is terminated by either an 0x01 or 0x00 byte. For example, -** if the requested column contains "a b X c d X X" and the position-list -** for 'X' is requested, the buffer returned may contain: -** -** 0x04 0x05 0x03 0x01 or 0x04 0x05 0x03 0x00 -** -** This function works regardless of whether or not the phrase is deferred, -** incremental, or neither. -*/ -SQLITE_PRIVATE int sqlite3Fts3EvalPhrasePoslist( - Fts3Cursor *pCsr, /* FTS3 cursor object */ - Fts3Expr *pExpr, /* Phrase to return doclist for */ - int iCol, /* Column to return position list for */ - char **ppOut /* OUT: Pointer to position list */ -){ - Fts3Phrase *pPhrase = pExpr->pPhrase; - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - char *pIter; - int iThis; - sqlite3_int64 iDocid; - - /* If this phrase is applies specifically to some column other than - ** column iCol, return a NULL pointer. */ - *ppOut = 0; - assert( iCol>=0 && iColnColumn ); - if( (pPhrase->iColumnnColumn && pPhrase->iColumn!=iCol) ){ - return SQLITE_OK; - } - - iDocid = pExpr->iDocid; - pIter = pPhrase->doclist.pList; - if( iDocid!=pCsr->iPrevId || pExpr->bEof ){ - int bDescDoclist = pTab->bDescIdx; /* For DOCID_CMP macro */ - int iMul; /* +1 if csr dir matches index dir, else -1 */ - int bOr = 0; - u8 bEof = 0; - u8 bTreeEof = 0; - Fts3Expr *p; /* Used to iterate from pExpr to root */ - Fts3Expr *pNear; /* Most senior NEAR ancestor (or pExpr) */ - - /* Check if this phrase descends from an OR expression node. If not, - ** return NULL. Otherwise, the entry that corresponds to docid - ** pCsr->iPrevId may lie earlier in the doclist buffer. Or, if the - ** tree that the node is part of has been marked as EOF, but the node - ** itself is not EOF, then it may point to an earlier entry. */ - pNear = pExpr; - for(p=pExpr->pParent; p; p=p->pParent){ - if( p->eType==FTSQUERY_OR ) bOr = 1; - if( p->eType==FTSQUERY_NEAR ) pNear = p; - if( p->bEof ) bTreeEof = 1; - } - if( bOr==0 ) return SQLITE_OK; - - /* This is the descendent of an OR node. In this case we cannot use - ** an incremental phrase. Load the entire doclist for the phrase - ** into memory in this case. */ - if( pPhrase->bIncr ){ - int rc = SQLITE_OK; - int bEofSave = pExpr->bEof; - fts3EvalRestart(pCsr, pExpr, &rc); - while( rc==SQLITE_OK && !pExpr->bEof ){ - fts3EvalNextRow(pCsr, pExpr, &rc); - if( bEofSave==0 && pExpr->iDocid==iDocid ) break; - } - pIter = pPhrase->doclist.pList; - assert( rc!=SQLITE_OK || pPhrase->bIncr==0 ); - if( rc!=SQLITE_OK ) return rc; - } - - iMul = ((pCsr->bDesc==bDescDoclist) ? 1 : -1); - while( bTreeEof==1 - && pNear->bEof==0 - && (DOCID_CMP(pNear->iDocid, pCsr->iPrevId) * iMul)<0 - ){ - int rc = SQLITE_OK; - fts3EvalNextRow(pCsr, pExpr, &rc); - if( rc!=SQLITE_OK ) return rc; - iDocid = pExpr->iDocid; - pIter = pPhrase->doclist.pList; - } - - bEof = (pPhrase->doclist.nAll==0); - assert( bDescDoclist==0 || bDescDoclist==1 ); - assert( pCsr->bDesc==0 || pCsr->bDesc==1 ); - - if( bEof==0 ){ - if( pCsr->bDesc==bDescDoclist ){ - int dummy; - if( pNear->bEof ){ - /* This expression is already at EOF. So position it to point to the - ** last entry in the doclist at pPhrase->doclist.aAll[]. Variable - ** iDocid is already set for this entry, so all that is required is - ** to set pIter to point to the first byte of the last position-list - ** in the doclist. - ** - ** It would also be correct to set pIter and iDocid to zero. In - ** this case, the first call to sqltie3Fts4DoclistPrev() below - ** would also move the iterator to point to the last entry in the - ** doclist. However, this is expensive, as to do so it has to - ** iterate through the entire doclist from start to finish (since - ** it does not know the docid for the last entry). */ - pIter = &pPhrase->doclist.aAll[pPhrase->doclist.nAll-1]; - fts3ReversePoslist(pPhrase->doclist.aAll, &pIter); - } - while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)>0 ) && bEof==0 ){ - sqlite3Fts3DoclistPrev( - bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll, - &pIter, &iDocid, &dummy, &bEof - ); - } - }else{ - if( pNear->bEof ){ - pIter = 0; - iDocid = 0; - } - while( (pIter==0 || DOCID_CMP(iDocid, pCsr->iPrevId)<0 ) && bEof==0 ){ - sqlite3Fts3DoclistNext( - bDescDoclist, pPhrase->doclist.aAll, pPhrase->doclist.nAll, - &pIter, &iDocid, &bEof - ); - } - } - } - - if( bEof || iDocid!=pCsr->iPrevId ) pIter = 0; - } - if( pIter==0 ) return SQLITE_OK; - - if( *pIter==0x01 ){ - pIter++; - pIter += fts3GetVarint32(pIter, &iThis); - }else{ - iThis = 0; - } - while( iThisdoclist, and -** * any Fts3MultiSegReader objects held by phrase tokens. -*/ -SQLITE_PRIVATE void sqlite3Fts3EvalPhraseCleanup(Fts3Phrase *pPhrase){ - if( pPhrase ){ - int i; - sqlite3_free(pPhrase->doclist.aAll); - fts3EvalInvalidatePoslist(pPhrase); - memset(&pPhrase->doclist, 0, sizeof(Fts3Doclist)); - for(i=0; inToken; i++){ - fts3SegReaderCursorFree(pPhrase->aToken[i].pSegcsr); - pPhrase->aToken[i].pSegcsr = 0; - } - } -} - - -/* -** Return SQLITE_CORRUPT_VTAB. -*/ -#ifdef SQLITE_DEBUG -SQLITE_PRIVATE int sqlite3Fts3Corrupt(){ - return SQLITE_CORRUPT_VTAB; -} -#endif - -#if !SQLITE_CORE -/* -** Initialize API pointer table, if required. -*/ -#ifdef _WIN32 -__declspec(dllexport) -#endif -SQLITE_API int sqlite3_fts3_init( - sqlite3 *db, - char **pzErrMsg, - const sqlite3_api_routines *pApi -){ - SQLITE_EXTENSION_INIT2(pApi) - return sqlite3Fts3Init(db); -} -#endif - -#endif - -/************** End of fts3.c ************************************************/ -/************** Begin file fts3_aux.c ****************************************/ -/* -** 2011 Jan 27 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -*/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ - -typedef struct Fts3auxTable Fts3auxTable; -typedef struct Fts3auxCursor Fts3auxCursor; - -struct Fts3auxTable { - sqlite3_vtab base; /* Base class used by SQLite core */ - Fts3Table *pFts3Tab; -}; - -struct Fts3auxCursor { - sqlite3_vtab_cursor base; /* Base class used by SQLite core */ - Fts3MultiSegReader csr; /* Must be right after "base" */ - Fts3SegFilter filter; - char *zStop; - int nStop; /* Byte-length of string zStop */ - int iLangid; /* Language id to query */ - int isEof; /* True if cursor is at EOF */ - sqlite3_int64 iRowid; /* Current rowid */ - - int iCol; /* Current value of 'col' column */ - int nStat; /* Size of aStat[] array */ - struct Fts3auxColstats { - sqlite3_int64 nDoc; /* 'documents' values for current csr row */ - sqlite3_int64 nOcc; /* 'occurrences' values for current csr row */ - } *aStat; -}; - -/* -** Schema of the terms table. -*/ -#define FTS3_AUX_SCHEMA \ - "CREATE TABLE x(term, col, documents, occurrences, languageid HIDDEN)" - -/* -** This function does all the work for both the xConnect and xCreate methods. -** These tables have no persistent representation of their own, so xConnect -** and xCreate are identical operations. -*/ -static int fts3auxConnectMethod( - sqlite3 *db, /* Database connection */ - void *pUnused, /* Unused */ - int argc, /* Number of elements in argv array */ - const char * const *argv, /* xCreate/xConnect argument array */ - sqlite3_vtab **ppVtab, /* OUT: New sqlite3_vtab object */ - char **pzErr /* OUT: sqlite3_malloc'd error message */ -){ - char const *zDb; /* Name of database (e.g. "main") */ - char const *zFts3; /* Name of fts3 table */ - int nDb; /* Result of strlen(zDb) */ - int nFts3; /* Result of strlen(zFts3) */ - int nByte; /* Bytes of space to allocate here */ - int rc; /* value returned by declare_vtab() */ - Fts3auxTable *p; /* Virtual table object to return */ - - UNUSED_PARAMETER(pUnused); - - /* The user should invoke this in one of two forms: - ** - ** CREATE VIRTUAL TABLE xxx USING fts4aux(fts4-table); - ** CREATE VIRTUAL TABLE xxx USING fts4aux(fts4-table-db, fts4-table); - */ - if( argc!=4 && argc!=5 ) goto bad_args; - - zDb = argv[1]; - nDb = (int)strlen(zDb); - if( argc==5 ){ - if( nDb==4 && 0==sqlite3_strnicmp("temp", zDb, 4) ){ - zDb = argv[3]; - nDb = (int)strlen(zDb); - zFts3 = argv[4]; - }else{ - goto bad_args; - } - }else{ - zFts3 = argv[3]; - } - nFts3 = (int)strlen(zFts3); - - rc = sqlite3_declare_vtab(db, FTS3_AUX_SCHEMA); - if( rc!=SQLITE_OK ) return rc; - - nByte = sizeof(Fts3auxTable) + sizeof(Fts3Table) + nDb + nFts3 + 2; - p = (Fts3auxTable *)sqlite3_malloc(nByte); - if( !p ) return SQLITE_NOMEM; - memset(p, 0, nByte); - - p->pFts3Tab = (Fts3Table *)&p[1]; - p->pFts3Tab->zDb = (char *)&p->pFts3Tab[1]; - p->pFts3Tab->zName = &p->pFts3Tab->zDb[nDb+1]; - p->pFts3Tab->db = db; - p->pFts3Tab->nIndex = 1; - - memcpy((char *)p->pFts3Tab->zDb, zDb, nDb); - memcpy((char *)p->pFts3Tab->zName, zFts3, nFts3); - sqlite3Fts3Dequote((char *)p->pFts3Tab->zName); - - *ppVtab = (sqlite3_vtab *)p; - return SQLITE_OK; - - bad_args: - *pzErr = sqlite3_mprintf("invalid arguments to fts4aux constructor"); - return SQLITE_ERROR; -} - -/* -** This function does the work for both the xDisconnect and xDestroy methods. -** These tables have no persistent representation of their own, so xDisconnect -** and xDestroy are identical operations. -*/ -static int fts3auxDisconnectMethod(sqlite3_vtab *pVtab){ - Fts3auxTable *p = (Fts3auxTable *)pVtab; - Fts3Table *pFts3 = p->pFts3Tab; - int i; - - /* Free any prepared statements held */ - for(i=0; iaStmt); i++){ - sqlite3_finalize(pFts3->aStmt[i]); - } - sqlite3_free(pFts3->zSegmentsTbl); - sqlite3_free(p); - return SQLITE_OK; -} - -#define FTS4AUX_EQ_CONSTRAINT 1 -#define FTS4AUX_GE_CONSTRAINT 2 -#define FTS4AUX_LE_CONSTRAINT 4 - -/* -** xBestIndex - Analyze a WHERE and ORDER BY clause. -*/ -static int fts3auxBestIndexMethod( - sqlite3_vtab *pVTab, - sqlite3_index_info *pInfo -){ - int i; - int iEq = -1; - int iGe = -1; - int iLe = -1; - int iLangid = -1; - int iNext = 1; /* Next free argvIndex value */ - - UNUSED_PARAMETER(pVTab); - - /* This vtab delivers always results in "ORDER BY term ASC" order. */ - if( pInfo->nOrderBy==1 - && pInfo->aOrderBy[0].iColumn==0 - && pInfo->aOrderBy[0].desc==0 - ){ - pInfo->orderByConsumed = 1; - } - - /* Search for equality and range constraints on the "term" column. - ** And equality constraints on the hidden "languageid" column. */ - for(i=0; inConstraint; i++){ - if( pInfo->aConstraint[i].usable ){ - int op = pInfo->aConstraint[i].op; - int iCol = pInfo->aConstraint[i].iColumn; - - if( iCol==0 ){ - if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iEq = i; - if( op==SQLITE_INDEX_CONSTRAINT_LT ) iLe = i; - if( op==SQLITE_INDEX_CONSTRAINT_LE ) iLe = i; - if( op==SQLITE_INDEX_CONSTRAINT_GT ) iGe = i; - if( op==SQLITE_INDEX_CONSTRAINT_GE ) iGe = i; - } - if( iCol==4 ){ - if( op==SQLITE_INDEX_CONSTRAINT_EQ ) iLangid = i; - } - } - } - - if( iEq>=0 ){ - pInfo->idxNum = FTS4AUX_EQ_CONSTRAINT; - pInfo->aConstraintUsage[iEq].argvIndex = iNext++; - pInfo->estimatedCost = 5; - }else{ - pInfo->idxNum = 0; - pInfo->estimatedCost = 20000; - if( iGe>=0 ){ - pInfo->idxNum += FTS4AUX_GE_CONSTRAINT; - pInfo->aConstraintUsage[iGe].argvIndex = iNext++; - pInfo->estimatedCost /= 2; - } - if( iLe>=0 ){ - pInfo->idxNum += FTS4AUX_LE_CONSTRAINT; - pInfo->aConstraintUsage[iLe].argvIndex = iNext++; - pInfo->estimatedCost /= 2; - } - } - if( iLangid>=0 ){ - pInfo->aConstraintUsage[iLangid].argvIndex = iNext++; - pInfo->estimatedCost--; - } - - return SQLITE_OK; -} - -/* -** xOpen - Open a cursor. -*/ -static int fts3auxOpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ - Fts3auxCursor *pCsr; /* Pointer to cursor object to return */ - - UNUSED_PARAMETER(pVTab); - - pCsr = (Fts3auxCursor *)sqlite3_malloc(sizeof(Fts3auxCursor)); - if( !pCsr ) return SQLITE_NOMEM; - memset(pCsr, 0, sizeof(Fts3auxCursor)); - - *ppCsr = (sqlite3_vtab_cursor *)pCsr; - return SQLITE_OK; -} - -/* -** xClose - Close a cursor. -*/ -static int fts3auxCloseMethod(sqlite3_vtab_cursor *pCursor){ - Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab; - Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; - - sqlite3Fts3SegmentsClose(pFts3); - sqlite3Fts3SegReaderFinish(&pCsr->csr); - sqlite3_free((void *)pCsr->filter.zTerm); - sqlite3_free(pCsr->zStop); - sqlite3_free(pCsr->aStat); - sqlite3_free(pCsr); - return SQLITE_OK; -} - -static int fts3auxGrowStatArray(Fts3auxCursor *pCsr, int nSize){ - if( nSize>pCsr->nStat ){ - struct Fts3auxColstats *aNew; - aNew = (struct Fts3auxColstats *)sqlite3_realloc(pCsr->aStat, - sizeof(struct Fts3auxColstats) * nSize - ); - if( aNew==0 ) return SQLITE_NOMEM; - memset(&aNew[pCsr->nStat], 0, - sizeof(struct Fts3auxColstats) * (nSize - pCsr->nStat) - ); - pCsr->aStat = aNew; - pCsr->nStat = nSize; - } - return SQLITE_OK; -} - -/* -** xNext - Advance the cursor to the next row, if any. -*/ -static int fts3auxNextMethod(sqlite3_vtab_cursor *pCursor){ - Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; - Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab; - int rc; - - /* Increment our pretend rowid value. */ - pCsr->iRowid++; - - for(pCsr->iCol++; pCsr->iColnStat; pCsr->iCol++){ - if( pCsr->aStat[pCsr->iCol].nDoc>0 ) return SQLITE_OK; - } - - rc = sqlite3Fts3SegReaderStep(pFts3, &pCsr->csr); - if( rc==SQLITE_ROW ){ - int i = 0; - int nDoclist = pCsr->csr.nDoclist; - char *aDoclist = pCsr->csr.aDoclist; - int iCol; - - int eState = 0; - - if( pCsr->zStop ){ - int n = (pCsr->nStopcsr.nTerm) ? pCsr->nStop : pCsr->csr.nTerm; - int mc = memcmp(pCsr->zStop, pCsr->csr.zTerm, n); - if( mc<0 || (mc==0 && pCsr->csr.nTerm>pCsr->nStop) ){ - pCsr->isEof = 1; - return SQLITE_OK; - } - } - - if( fts3auxGrowStatArray(pCsr, 2) ) return SQLITE_NOMEM; - memset(pCsr->aStat, 0, sizeof(struct Fts3auxColstats) * pCsr->nStat); - iCol = 0; - - while( iaStat[0].nDoc++; - eState = 1; - iCol = 0; - break; - - /* State 1. In this state we are expecting either a 1, indicating - ** that the following integer will be a column number, or the - ** start of a position list for column 0. - ** - ** The only difference between state 1 and state 2 is that if the - ** integer encountered in state 1 is not 0 or 1, then we need to - ** increment the column 0 "nDoc" count for this term. - */ - case 1: - assert( iCol==0 ); - if( v>1 ){ - pCsr->aStat[1].nDoc++; - } - eState = 2; - /* fall through */ - - case 2: - if( v==0 ){ /* 0x00. Next integer will be a docid. */ - eState = 0; - }else if( v==1 ){ /* 0x01. Next integer will be a column number. */ - eState = 3; - }else{ /* 2 or greater. A position. */ - pCsr->aStat[iCol+1].nOcc++; - pCsr->aStat[0].nOcc++; - } - break; - - /* State 3. The integer just read is a column number. */ - default: assert( eState==3 ); - iCol = (int)v; - if( fts3auxGrowStatArray(pCsr, iCol+2) ) return SQLITE_NOMEM; - pCsr->aStat[iCol+1].nDoc++; - eState = 2; - break; - } - } - - pCsr->iCol = 0; - rc = SQLITE_OK; - }else{ - pCsr->isEof = 1; - } - return rc; -} - -/* -** xFilter - Initialize a cursor to point at the start of its data. -*/ -static int fts3auxFilterMethod( - sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ - int idxNum, /* Strategy index */ - const char *idxStr, /* Unused */ - int nVal, /* Number of elements in apVal */ - sqlite3_value **apVal /* Arguments for the indexing scheme */ -){ - Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; - Fts3Table *pFts3 = ((Fts3auxTable *)pCursor->pVtab)->pFts3Tab; - int rc; - int isScan = 0; - int iLangVal = 0; /* Language id to query */ - - int iEq = -1; /* Index of term=? value in apVal */ - int iGe = -1; /* Index of term>=? value in apVal */ - int iLe = -1; /* Index of term<=? value in apVal */ - int iLangid = -1; /* Index of languageid=? value in apVal */ - int iNext = 0; - - UNUSED_PARAMETER(nVal); - UNUSED_PARAMETER(idxStr); - - assert( idxStr==0 ); - assert( idxNum==FTS4AUX_EQ_CONSTRAINT || idxNum==0 - || idxNum==FTS4AUX_LE_CONSTRAINT || idxNum==FTS4AUX_GE_CONSTRAINT - || idxNum==(FTS4AUX_LE_CONSTRAINT|FTS4AUX_GE_CONSTRAINT) - ); - - if( idxNum==FTS4AUX_EQ_CONSTRAINT ){ - iEq = iNext++; - }else{ - isScan = 1; - if( idxNum & FTS4AUX_GE_CONSTRAINT ){ - iGe = iNext++; - } - if( idxNum & FTS4AUX_LE_CONSTRAINT ){ - iLe = iNext++; - } - } - if( iNextfilter.zTerm); - sqlite3Fts3SegReaderFinish(&pCsr->csr); - sqlite3_free((void *)pCsr->filter.zTerm); - sqlite3_free(pCsr->aStat); - memset(&pCsr->csr, 0, ((u8*)&pCsr[1]) - (u8*)&pCsr->csr); - - pCsr->filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY; - if( isScan ) pCsr->filter.flags |= FTS3_SEGMENT_SCAN; - - if( iEq>=0 || iGe>=0 ){ - const unsigned char *zStr = sqlite3_value_text(apVal[0]); - assert( (iEq==0 && iGe==-1) || (iEq==-1 && iGe==0) ); - if( zStr ){ - pCsr->filter.zTerm = sqlite3_mprintf("%s", zStr); - pCsr->filter.nTerm = sqlite3_value_bytes(apVal[0]); - if( pCsr->filter.zTerm==0 ) return SQLITE_NOMEM; - } - } - - if( iLe>=0 ){ - pCsr->zStop = sqlite3_mprintf("%s", sqlite3_value_text(apVal[iLe])); - pCsr->nStop = sqlite3_value_bytes(apVal[iLe]); - if( pCsr->zStop==0 ) return SQLITE_NOMEM; - } - - if( iLangid>=0 ){ - iLangVal = sqlite3_value_int(apVal[iLangid]); - - /* If the user specified a negative value for the languageid, use zero - ** instead. This works, as the "languageid=?" constraint will also - ** be tested by the VDBE layer. The test will always be false (since - ** this module will not return a row with a negative languageid), and - ** so the overall query will return zero rows. */ - if( iLangVal<0 ) iLangVal = 0; - } - pCsr->iLangid = iLangVal; - - rc = sqlite3Fts3SegReaderCursor(pFts3, iLangVal, 0, FTS3_SEGCURSOR_ALL, - pCsr->filter.zTerm, pCsr->filter.nTerm, 0, isScan, &pCsr->csr - ); - if( rc==SQLITE_OK ){ - rc = sqlite3Fts3SegReaderStart(pFts3, &pCsr->csr, &pCsr->filter); - } - - if( rc==SQLITE_OK ) rc = fts3auxNextMethod(pCursor); - return rc; -} - -/* -** xEof - Return true if the cursor is at EOF, or false otherwise. -*/ -static int fts3auxEofMethod(sqlite3_vtab_cursor *pCursor){ - Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; - return pCsr->isEof; -} - -/* -** xColumn - Return a column value. -*/ -static int fts3auxColumnMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */ - int iCol /* Index of column to read value from */ -){ - Fts3auxCursor *p = (Fts3auxCursor *)pCursor; - - assert( p->isEof==0 ); - switch( iCol ){ - case 0: /* term */ - sqlite3_result_text(pCtx, p->csr.zTerm, p->csr.nTerm, SQLITE_TRANSIENT); - break; - - case 1: /* col */ - if( p->iCol ){ - sqlite3_result_int(pCtx, p->iCol-1); - }else{ - sqlite3_result_text(pCtx, "*", -1, SQLITE_STATIC); - } - break; - - case 2: /* documents */ - sqlite3_result_int64(pCtx, p->aStat[p->iCol].nDoc); - break; - - case 3: /* occurrences */ - sqlite3_result_int64(pCtx, p->aStat[p->iCol].nOcc); - break; - - default: /* languageid */ - assert( iCol==4 ); - sqlite3_result_int(pCtx, p->iLangid); - break; - } - - return SQLITE_OK; -} - -/* -** xRowid - Return the current rowid for the cursor. -*/ -static int fts3auxRowidMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite_int64 *pRowid /* OUT: Rowid value */ -){ - Fts3auxCursor *pCsr = (Fts3auxCursor *)pCursor; - *pRowid = pCsr->iRowid; - return SQLITE_OK; -} - -/* -** Register the fts3aux module with database connection db. Return SQLITE_OK -** if successful or an error code if sqlite3_create_module() fails. -*/ -SQLITE_PRIVATE int sqlite3Fts3InitAux(sqlite3 *db){ - static const sqlite3_module fts3aux_module = { - 0, /* iVersion */ - fts3auxConnectMethod, /* xCreate */ - fts3auxConnectMethod, /* xConnect */ - fts3auxBestIndexMethod, /* xBestIndex */ - fts3auxDisconnectMethod, /* xDisconnect */ - fts3auxDisconnectMethod, /* xDestroy */ - fts3auxOpenMethod, /* xOpen */ - fts3auxCloseMethod, /* xClose */ - fts3auxFilterMethod, /* xFilter */ - fts3auxNextMethod, /* xNext */ - fts3auxEofMethod, /* xEof */ - fts3auxColumnMethod, /* xColumn */ - fts3auxRowidMethod, /* xRowid */ - 0, /* xUpdate */ - 0, /* xBegin */ - 0, /* xSync */ - 0, /* xCommit */ - 0, /* xRollback */ - 0, /* xFindFunction */ - 0, /* xRename */ - 0, /* xSavepoint */ - 0, /* xRelease */ - 0 /* xRollbackTo */ - }; - int rc; /* Return code */ - - rc = sqlite3_create_module(db, "fts4aux", &fts3aux_module, 0); - return rc; -} - -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ - -/************** End of fts3_aux.c ********************************************/ -/************** Begin file fts3_expr.c ***************************************/ -/* -** 2008 Nov 28 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This module contains code that implements a parser for fts3 query strings -** (the right-hand argument to the MATCH operator). Because the supported -** syntax is relatively simple, the whole tokenizer/parser system is -** hand-coded. -*/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* -** By default, this module parses the legacy syntax that has been -** traditionally used by fts3. Or, if SQLITE_ENABLE_FTS3_PARENTHESIS -** is defined, then it uses the new syntax. The differences between -** the new and the old syntaxes are: -** -** a) The new syntax supports parenthesis. The old does not. -** -** b) The new syntax supports the AND and NOT operators. The old does not. -** -** c) The old syntax supports the "-" token qualifier. This is not -** supported by the new syntax (it is replaced by the NOT operator). -** -** d) When using the old syntax, the OR operator has a greater precedence -** than an implicit AND. When using the new, both implicity and explicit -** AND operators have a higher precedence than OR. -** -** If compiled with SQLITE_TEST defined, then this module exports the -** symbol "int sqlite3_fts3_enable_parentheses". Setting this variable -** to zero causes the module to use the old syntax. If it is set to -** non-zero the new syntax is activated. This is so both syntaxes can -** be tested using a single build of testfixture. -** -** The following describes the syntax supported by the fts3 MATCH -** operator in a similar format to that used by the lemon parser -** generator. This module does not use actually lemon, it uses a -** custom parser. -** -** query ::= andexpr (OR andexpr)*. -** -** andexpr ::= notexpr (AND? notexpr)*. -** -** notexpr ::= nearexpr (NOT nearexpr|-TOKEN)*. -** notexpr ::= LP query RP. -** -** nearexpr ::= phrase (NEAR distance_opt nearexpr)*. -** -** distance_opt ::= . -** distance_opt ::= / INTEGER. -** -** phrase ::= TOKEN. -** phrase ::= COLUMN:TOKEN. -** phrase ::= "TOKEN TOKEN TOKEN...". -*/ - -#ifdef SQLITE_TEST -SQLITE_API int sqlite3_fts3_enable_parentheses = 0; -#else -# ifdef SQLITE_ENABLE_FTS3_PARENTHESIS -# define sqlite3_fts3_enable_parentheses 1 -# else -# define sqlite3_fts3_enable_parentheses 0 -# endif -#endif - -/* -** Default span for NEAR operators. -*/ -#define SQLITE_FTS3_DEFAULT_NEAR_PARAM 10 - -/* #include */ -/* #include */ - -/* -** isNot: -** This variable is used by function getNextNode(). When getNextNode() is -** called, it sets ParseContext.isNot to true if the 'next node' is a -** FTSQUERY_PHRASE with a unary "-" attached to it. i.e. "mysql" in the -** FTS3 query "sqlite -mysql". Otherwise, ParseContext.isNot is set to -** zero. -*/ -typedef struct ParseContext ParseContext; -struct ParseContext { - sqlite3_tokenizer *pTokenizer; /* Tokenizer module */ - int iLangid; /* Language id used with tokenizer */ - const char **azCol; /* Array of column names for fts3 table */ - int bFts4; /* True to allow FTS4-only syntax */ - int nCol; /* Number of entries in azCol[] */ - int iDefaultCol; /* Default column to query */ - int isNot; /* True if getNextNode() sees a unary - */ - sqlite3_context *pCtx; /* Write error message here */ - int nNest; /* Number of nested brackets */ -}; - -/* -** This function is equivalent to the standard isspace() function. -** -** The standard isspace() can be awkward to use safely, because although it -** is defined to accept an argument of type int, its behavior when passed -** an integer that falls outside of the range of the unsigned char type -** is undefined (and sometimes, "undefined" means segfault). This wrapper -** is defined to accept an argument of type char, and always returns 0 for -** any values that fall outside of the range of the unsigned char type (i.e. -** negative values). -*/ -static int fts3isspace(char c){ - return c==' ' || c=='\t' || c=='\n' || c=='\r' || c=='\v' || c=='\f'; -} - -/* -** Allocate nByte bytes of memory using sqlite3_malloc(). If successful, -** zero the memory before returning a pointer to it. If unsuccessful, -** return NULL. -*/ -static void *fts3MallocZero(int nByte){ - void *pRet = sqlite3_malloc(nByte); - if( pRet ) memset(pRet, 0, nByte); - return pRet; -} - -SQLITE_PRIVATE int sqlite3Fts3OpenTokenizer( - sqlite3_tokenizer *pTokenizer, - int iLangid, - const char *z, - int n, - sqlite3_tokenizer_cursor **ppCsr -){ - sqlite3_tokenizer_module const *pModule = pTokenizer->pModule; - sqlite3_tokenizer_cursor *pCsr = 0; - int rc; - - rc = pModule->xOpen(pTokenizer, z, n, &pCsr); - assert( rc==SQLITE_OK || pCsr==0 ); - if( rc==SQLITE_OK ){ - pCsr->pTokenizer = pTokenizer; - if( pModule->iVersion>=1 ){ - rc = pModule->xLanguageid(pCsr, iLangid); - if( rc!=SQLITE_OK ){ - pModule->xClose(pCsr); - pCsr = 0; - } - } - } - *ppCsr = pCsr; - return rc; -} - -/* -** Function getNextNode(), which is called by fts3ExprParse(), may itself -** call fts3ExprParse(). So this forward declaration is required. -*/ -static int fts3ExprParse(ParseContext *, const char *, int, Fts3Expr **, int *); - -/* -** Extract the next token from buffer z (length n) using the tokenizer -** and other information (column names etc.) in pParse. Create an Fts3Expr -** structure of type FTSQUERY_PHRASE containing a phrase consisting of this -** single token and set *ppExpr to point to it. If the end of the buffer is -** reached before a token is found, set *ppExpr to zero. It is the -** responsibility of the caller to eventually deallocate the allocated -** Fts3Expr structure (if any) by passing it to sqlite3_free(). -** -** Return SQLITE_OK if successful, or SQLITE_NOMEM if a memory allocation -** fails. -*/ -static int getNextToken( - ParseContext *pParse, /* fts3 query parse context */ - int iCol, /* Value for Fts3Phrase.iColumn */ - const char *z, int n, /* Input string */ - Fts3Expr **ppExpr, /* OUT: expression */ - int *pnConsumed /* OUT: Number of bytes consumed */ -){ - sqlite3_tokenizer *pTokenizer = pParse->pTokenizer; - sqlite3_tokenizer_module const *pModule = pTokenizer->pModule; - int rc; - sqlite3_tokenizer_cursor *pCursor; - Fts3Expr *pRet = 0; - int nConsumed = 0; - - rc = sqlite3Fts3OpenTokenizer(pTokenizer, pParse->iLangid, z, n, &pCursor); - if( rc==SQLITE_OK ){ - const char *zToken; - int nToken = 0, iStart = 0, iEnd = 0, iPosition = 0; - int nByte; /* total space to allocate */ - - rc = pModule->xNext(pCursor, &zToken, &nToken, &iStart, &iEnd, &iPosition); - - if( (rc==SQLITE_OK || rc==SQLITE_DONE) && sqlite3_fts3_enable_parentheses ){ - int i; - if( rc==SQLITE_DONE ) iStart = n; - for(i=0; inNest++; - rc = fts3ExprParse(pParse, &z[i+1], n-i-1, &pRet, &nConsumed); - if( rc==SQLITE_OK && !pRet ){ - rc = SQLITE_DONE; - } - nConsumed = (int)(i + 1 + nConsumed); - break; - } - - if( z[i]==')' ){ - rc = SQLITE_DONE; - pParse->nNest--; - nConsumed = i+1; - break; - } - } - } - - if( nConsumed==0 && rc==SQLITE_OK ){ - nByte = sizeof(Fts3Expr) + sizeof(Fts3Phrase) + nToken; - pRet = (Fts3Expr *)fts3MallocZero(nByte); - if( !pRet ){ - rc = SQLITE_NOMEM; - }else{ - pRet->eType = FTSQUERY_PHRASE; - pRet->pPhrase = (Fts3Phrase *)&pRet[1]; - pRet->pPhrase->nToken = 1; - pRet->pPhrase->iColumn = iCol; - pRet->pPhrase->aToken[0].n = nToken; - pRet->pPhrase->aToken[0].z = (char *)&pRet->pPhrase[1]; - memcpy(pRet->pPhrase->aToken[0].z, zToken, nToken); - - if( iEndpPhrase->aToken[0].isPrefix = 1; - iEnd++; - } - - while( 1 ){ - if( !sqlite3_fts3_enable_parentheses - && iStart>0 && z[iStart-1]=='-' - ){ - pParse->isNot = 1; - iStart--; - }else if( pParse->bFts4 && iStart>0 && z[iStart-1]=='^' ){ - pRet->pPhrase->aToken[0].bFirst = 1; - iStart--; - }else{ - break; - } - } - - } - nConsumed = iEnd; - } - - pModule->xClose(pCursor); - } - - *pnConsumed = nConsumed; - *ppExpr = pRet; - return rc; -} - - -/* -** Enlarge a memory allocation. If an out-of-memory allocation occurs, -** then free the old allocation. -*/ -static void *fts3ReallocOrFree(void *pOrig, int nNew){ - void *pRet = sqlite3_realloc(pOrig, nNew); - if( !pRet ){ - sqlite3_free(pOrig); - } - return pRet; -} - -/* -** Buffer zInput, length nInput, contains the contents of a quoted string -** that appeared as part of an fts3 query expression. Neither quote character -** is included in the buffer. This function attempts to tokenize the entire -** input buffer and create an Fts3Expr structure of type FTSQUERY_PHRASE -** containing the results. -** -** If successful, SQLITE_OK is returned and *ppExpr set to point at the -** allocated Fts3Expr structure. Otherwise, either SQLITE_NOMEM (out of memory -** error) or SQLITE_ERROR (tokenization error) is returned and *ppExpr set -** to 0. -*/ -static int getNextString( - ParseContext *pParse, /* fts3 query parse context */ - const char *zInput, int nInput, /* Input string */ - Fts3Expr **ppExpr /* OUT: expression */ -){ - sqlite3_tokenizer *pTokenizer = pParse->pTokenizer; - sqlite3_tokenizer_module const *pModule = pTokenizer->pModule; - int rc; - Fts3Expr *p = 0; - sqlite3_tokenizer_cursor *pCursor = 0; - char *zTemp = 0; - int nTemp = 0; - - const int nSpace = sizeof(Fts3Expr) + sizeof(Fts3Phrase); - int nToken = 0; - - /* The final Fts3Expr data structure, including the Fts3Phrase, - ** Fts3PhraseToken structures token buffers are all stored as a single - ** allocation so that the expression can be freed with a single call to - ** sqlite3_free(). Setting this up requires a two pass approach. - ** - ** The first pass, in the block below, uses a tokenizer cursor to iterate - ** through the tokens in the expression. This pass uses fts3ReallocOrFree() - ** to assemble data in two dynamic buffers: - ** - ** Buffer p: Points to the Fts3Expr structure, followed by the Fts3Phrase - ** structure, followed by the array of Fts3PhraseToken - ** structures. This pass only populates the Fts3PhraseToken array. - ** - ** Buffer zTemp: Contains copies of all tokens. - ** - ** The second pass, in the block that begins "if( rc==SQLITE_DONE )" below, - ** appends buffer zTemp to buffer p, and fills in the Fts3Expr and Fts3Phrase - ** structures. - */ - rc = sqlite3Fts3OpenTokenizer( - pTokenizer, pParse->iLangid, zInput, nInput, &pCursor); - if( rc==SQLITE_OK ){ - int ii; - for(ii=0; rc==SQLITE_OK; ii++){ - const char *zByte; - int nByte = 0, iBegin = 0, iEnd = 0, iPos = 0; - rc = pModule->xNext(pCursor, &zByte, &nByte, &iBegin, &iEnd, &iPos); - if( rc==SQLITE_OK ){ - Fts3PhraseToken *pToken; - - p = fts3ReallocOrFree(p, nSpace + ii*sizeof(Fts3PhraseToken)); - if( !p ) goto no_mem; - - zTemp = fts3ReallocOrFree(zTemp, nTemp + nByte); - if( !zTemp ) goto no_mem; - - assert( nToken==ii ); - pToken = &((Fts3Phrase *)(&p[1]))->aToken[ii]; - memset(pToken, 0, sizeof(Fts3PhraseToken)); - - memcpy(&zTemp[nTemp], zByte, nByte); - nTemp += nByte; - - pToken->n = nByte; - pToken->isPrefix = (iEndbFirst = (iBegin>0 && zInput[iBegin-1]=='^'); - nToken = ii+1; - } - } - - pModule->xClose(pCursor); - pCursor = 0; - } - - if( rc==SQLITE_DONE ){ - int jj; - char *zBuf = 0; - - p = fts3ReallocOrFree(p, nSpace + nToken*sizeof(Fts3PhraseToken) + nTemp); - if( !p ) goto no_mem; - memset(p, 0, (char *)&(((Fts3Phrase *)&p[1])->aToken[0])-(char *)p); - p->eType = FTSQUERY_PHRASE; - p->pPhrase = (Fts3Phrase *)&p[1]; - p->pPhrase->iColumn = pParse->iDefaultCol; - p->pPhrase->nToken = nToken; - - zBuf = (char *)&p->pPhrase->aToken[nToken]; - if( zTemp ){ - memcpy(zBuf, zTemp, nTemp); - sqlite3_free(zTemp); - }else{ - assert( nTemp==0 ); - } - - for(jj=0; jjpPhrase->nToken; jj++){ - p->pPhrase->aToken[jj].z = zBuf; - zBuf += p->pPhrase->aToken[jj].n; - } - rc = SQLITE_OK; - } - - *ppExpr = p; - return rc; -no_mem: - - if( pCursor ){ - pModule->xClose(pCursor); - } - sqlite3_free(zTemp); - sqlite3_free(p); - *ppExpr = 0; - return SQLITE_NOMEM; -} - -/* -** The output variable *ppExpr is populated with an allocated Fts3Expr -** structure, or set to 0 if the end of the input buffer is reached. -** -** Returns an SQLite error code. SQLITE_OK if everything works, SQLITE_NOMEM -** if a malloc failure occurs, or SQLITE_ERROR if a parse error is encountered. -** If SQLITE_ERROR is returned, pContext is populated with an error message. -*/ -static int getNextNode( - ParseContext *pParse, /* fts3 query parse context */ - const char *z, int n, /* Input string */ - Fts3Expr **ppExpr, /* OUT: expression */ - int *pnConsumed /* OUT: Number of bytes consumed */ -){ - static const struct Fts3Keyword { - char *z; /* Keyword text */ - unsigned char n; /* Length of the keyword */ - unsigned char parenOnly; /* Only valid in paren mode */ - unsigned char eType; /* Keyword code */ - } aKeyword[] = { - { "OR" , 2, 0, FTSQUERY_OR }, - { "AND", 3, 1, FTSQUERY_AND }, - { "NOT", 3, 1, FTSQUERY_NOT }, - { "NEAR", 4, 0, FTSQUERY_NEAR } - }; - int ii; - int iCol; - int iColLen; - int rc; - Fts3Expr *pRet = 0; - - const char *zInput = z; - int nInput = n; - - pParse->isNot = 0; - - /* Skip over any whitespace before checking for a keyword, an open or - ** close bracket, or a quoted string. - */ - while( nInput>0 && fts3isspace(*zInput) ){ - nInput--; - zInput++; - } - if( nInput==0 ){ - return SQLITE_DONE; - } - - /* See if we are dealing with a keyword. */ - for(ii=0; ii<(int)(sizeof(aKeyword)/sizeof(struct Fts3Keyword)); ii++){ - const struct Fts3Keyword *pKey = &aKeyword[ii]; - - if( (pKey->parenOnly & ~sqlite3_fts3_enable_parentheses)!=0 ){ - continue; - } - - if( nInput>=pKey->n && 0==memcmp(zInput, pKey->z, pKey->n) ){ - int nNear = SQLITE_FTS3_DEFAULT_NEAR_PARAM; - int nKey = pKey->n; - char cNext; - - /* If this is a "NEAR" keyword, check for an explicit nearness. */ - if( pKey->eType==FTSQUERY_NEAR ){ - assert( nKey==4 ); - if( zInput[4]=='/' && zInput[5]>='0' && zInput[5]<='9' ){ - nNear = 0; - for(nKey=5; zInput[nKey]>='0' && zInput[nKey]<='9'; nKey++){ - nNear = nNear * 10 + (zInput[nKey] - '0'); - } - } - } - - /* At this point this is probably a keyword. But for that to be true, - ** the next byte must contain either whitespace, an open or close - ** parenthesis, a quote character, or EOF. - */ - cNext = zInput[nKey]; - if( fts3isspace(cNext) - || cNext=='"' || cNext=='(' || cNext==')' || cNext==0 - ){ - pRet = (Fts3Expr *)fts3MallocZero(sizeof(Fts3Expr)); - if( !pRet ){ - return SQLITE_NOMEM; - } - pRet->eType = pKey->eType; - pRet->nNear = nNear; - *ppExpr = pRet; - *pnConsumed = (int)((zInput - z) + nKey); - return SQLITE_OK; - } - - /* Turns out that wasn't a keyword after all. This happens if the - ** user has supplied a token such as "ORacle". Continue. - */ - } - } - - /* See if we are dealing with a quoted phrase. If this is the case, then - ** search for the closing quote and pass the whole string to getNextString() - ** for processing. This is easy to do, as fts3 has no syntax for escaping - ** a quote character embedded in a string. - */ - if( *zInput=='"' ){ - for(ii=1; iiiDefaultCol; - iColLen = 0; - for(ii=0; iinCol; ii++){ - const char *zStr = pParse->azCol[ii]; - int nStr = (int)strlen(zStr); - if( nInput>nStr && zInput[nStr]==':' - && sqlite3_strnicmp(zStr, zInput, nStr)==0 - ){ - iCol = ii; - iColLen = (int)((zInput - z) + nStr + 1); - break; - } - } - rc = getNextToken(pParse, iCol, &z[iColLen], n-iColLen, ppExpr, pnConsumed); - *pnConsumed += iColLen; - return rc; -} - -/* -** The argument is an Fts3Expr structure for a binary operator (any type -** except an FTSQUERY_PHRASE). Return an integer value representing the -** precedence of the operator. Lower values have a higher precedence (i.e. -** group more tightly). For example, in the C language, the == operator -** groups more tightly than ||, and would therefore have a higher precedence. -** -** When using the new fts3 query syntax (when SQLITE_ENABLE_FTS3_PARENTHESIS -** is defined), the order of the operators in precedence from highest to -** lowest is: -** -** NEAR -** NOT -** AND (including implicit ANDs) -** OR -** -** Note that when using the old query syntax, the OR operator has a higher -** precedence than the AND operator. -*/ -static int opPrecedence(Fts3Expr *p){ - assert( p->eType!=FTSQUERY_PHRASE ); - if( sqlite3_fts3_enable_parentheses ){ - return p->eType; - }else if( p->eType==FTSQUERY_NEAR ){ - return 1; - }else if( p->eType==FTSQUERY_OR ){ - return 2; - } - assert( p->eType==FTSQUERY_AND ); - return 3; -} - -/* -** Argument ppHead contains a pointer to the current head of a query -** expression tree being parsed. pPrev is the expression node most recently -** inserted into the tree. This function adds pNew, which is always a binary -** operator node, into the expression tree based on the relative precedence -** of pNew and the existing nodes of the tree. This may result in the head -** of the tree changing, in which case *ppHead is set to the new root node. -*/ -static void insertBinaryOperator( - Fts3Expr **ppHead, /* Pointer to the root node of a tree */ - Fts3Expr *pPrev, /* Node most recently inserted into the tree */ - Fts3Expr *pNew /* New binary node to insert into expression tree */ -){ - Fts3Expr *pSplit = pPrev; - while( pSplit->pParent && opPrecedence(pSplit->pParent)<=opPrecedence(pNew) ){ - pSplit = pSplit->pParent; - } - - if( pSplit->pParent ){ - assert( pSplit->pParent->pRight==pSplit ); - pSplit->pParent->pRight = pNew; - pNew->pParent = pSplit->pParent; - }else{ - *ppHead = pNew; - } - pNew->pLeft = pSplit; - pSplit->pParent = pNew; -} - -/* -** Parse the fts3 query expression found in buffer z, length n. This function -** returns either when the end of the buffer is reached or an unmatched -** closing bracket - ')' - is encountered. -** -** If successful, SQLITE_OK is returned, *ppExpr is set to point to the -** parsed form of the expression and *pnConsumed is set to the number of -** bytes read from buffer z. Otherwise, *ppExpr is set to 0 and SQLITE_NOMEM -** (out of memory error) or SQLITE_ERROR (parse error) is returned. -*/ -static int fts3ExprParse( - ParseContext *pParse, /* fts3 query parse context */ - const char *z, int n, /* Text of MATCH query */ - Fts3Expr **ppExpr, /* OUT: Parsed query structure */ - int *pnConsumed /* OUT: Number of bytes consumed */ -){ - Fts3Expr *pRet = 0; - Fts3Expr *pPrev = 0; - Fts3Expr *pNotBranch = 0; /* Only used in legacy parse mode */ - int nIn = n; - const char *zIn = z; - int rc = SQLITE_OK; - int isRequirePhrase = 1; - - while( rc==SQLITE_OK ){ - Fts3Expr *p = 0; - int nByte = 0; - rc = getNextNode(pParse, zIn, nIn, &p, &nByte); - if( rc==SQLITE_OK ){ - int isPhrase; - - if( !sqlite3_fts3_enable_parentheses - && p->eType==FTSQUERY_PHRASE && pParse->isNot - ){ - /* Create an implicit NOT operator. */ - Fts3Expr *pNot = fts3MallocZero(sizeof(Fts3Expr)); - if( !pNot ){ - sqlite3Fts3ExprFree(p); - rc = SQLITE_NOMEM; - goto exprparse_out; - } - pNot->eType = FTSQUERY_NOT; - pNot->pRight = p; - p->pParent = pNot; - if( pNotBranch ){ - pNot->pLeft = pNotBranch; - pNotBranch->pParent = pNot; - } - pNotBranch = pNot; - p = pPrev; - }else{ - int eType = p->eType; - isPhrase = (eType==FTSQUERY_PHRASE || p->pLeft); - - /* The isRequirePhrase variable is set to true if a phrase or - ** an expression contained in parenthesis is required. If a - ** binary operator (AND, OR, NOT or NEAR) is encounted when - ** isRequirePhrase is set, this is a syntax error. - */ - if( !isPhrase && isRequirePhrase ){ - sqlite3Fts3ExprFree(p); - rc = SQLITE_ERROR; - goto exprparse_out; - } - - if( isPhrase && !isRequirePhrase ){ - /* Insert an implicit AND operator. */ - Fts3Expr *pAnd; - assert( pRet && pPrev ); - pAnd = fts3MallocZero(sizeof(Fts3Expr)); - if( !pAnd ){ - sqlite3Fts3ExprFree(p); - rc = SQLITE_NOMEM; - goto exprparse_out; - } - pAnd->eType = FTSQUERY_AND; - insertBinaryOperator(&pRet, pPrev, pAnd); - pPrev = pAnd; - } - - /* This test catches attempts to make either operand of a NEAR - ** operator something other than a phrase. For example, either of - ** the following: - ** - ** (bracketed expression) NEAR phrase - ** phrase NEAR (bracketed expression) - ** - ** Return an error in either case. - */ - if( pPrev && ( - (eType==FTSQUERY_NEAR && !isPhrase && pPrev->eType!=FTSQUERY_PHRASE) - || (eType!=FTSQUERY_PHRASE && isPhrase && pPrev->eType==FTSQUERY_NEAR) - )){ - sqlite3Fts3ExprFree(p); - rc = SQLITE_ERROR; - goto exprparse_out; - } - - if( isPhrase ){ - if( pRet ){ - assert( pPrev && pPrev->pLeft && pPrev->pRight==0 ); - pPrev->pRight = p; - p->pParent = pPrev; - }else{ - pRet = p; - } - }else{ - insertBinaryOperator(&pRet, pPrev, p); - } - isRequirePhrase = !isPhrase; - } - assert( nByte>0 ); - } - assert( rc!=SQLITE_OK || (nByte>0 && nByte<=nIn) ); - nIn -= nByte; - zIn += nByte; - pPrev = p; - } - - if( rc==SQLITE_DONE && pRet && isRequirePhrase ){ - rc = SQLITE_ERROR; - } - - if( rc==SQLITE_DONE ){ - rc = SQLITE_OK; - if( !sqlite3_fts3_enable_parentheses && pNotBranch ){ - if( !pRet ){ - rc = SQLITE_ERROR; - }else{ - Fts3Expr *pIter = pNotBranch; - while( pIter->pLeft ){ - pIter = pIter->pLeft; - } - pIter->pLeft = pRet; - pRet->pParent = pIter; - pRet = pNotBranch; - } - } - } - *pnConsumed = n - nIn; - -exprparse_out: - if( rc!=SQLITE_OK ){ - sqlite3Fts3ExprFree(pRet); - sqlite3Fts3ExprFree(pNotBranch); - pRet = 0; - } - *ppExpr = pRet; - return rc; -} - -/* -** Return SQLITE_ERROR if the maximum depth of the expression tree passed -** as the only argument is more than nMaxDepth. -*/ -static int fts3ExprCheckDepth(Fts3Expr *p, int nMaxDepth){ - int rc = SQLITE_OK; - if( p ){ - if( nMaxDepth<0 ){ - rc = SQLITE_TOOBIG; - }else{ - rc = fts3ExprCheckDepth(p->pLeft, nMaxDepth-1); - if( rc==SQLITE_OK ){ - rc = fts3ExprCheckDepth(p->pRight, nMaxDepth-1); - } - } - } - return rc; -} - -/* -** This function attempts to transform the expression tree at (*pp) to -** an equivalent but more balanced form. The tree is modified in place. -** If successful, SQLITE_OK is returned and (*pp) set to point to the -** new root expression node. -** -** nMaxDepth is the maximum allowable depth of the balanced sub-tree. -** -** Otherwise, if an error occurs, an SQLite error code is returned and -** expression (*pp) freed. -*/ -static int fts3ExprBalance(Fts3Expr **pp, int nMaxDepth){ - int rc = SQLITE_OK; /* Return code */ - Fts3Expr *pRoot = *pp; /* Initial root node */ - Fts3Expr *pFree = 0; /* List of free nodes. Linked by pParent. */ - int eType = pRoot->eType; /* Type of node in this tree */ - - if( nMaxDepth==0 ){ - rc = SQLITE_ERROR; - } - - if( rc==SQLITE_OK && (eType==FTSQUERY_AND || eType==FTSQUERY_OR) ){ - Fts3Expr **apLeaf; - apLeaf = (Fts3Expr **)sqlite3_malloc(sizeof(Fts3Expr *) * nMaxDepth); - if( 0==apLeaf ){ - rc = SQLITE_NOMEM; - }else{ - memset(apLeaf, 0, sizeof(Fts3Expr *) * nMaxDepth); - } - - if( rc==SQLITE_OK ){ - int i; - Fts3Expr *p; - - /* Set $p to point to the left-most leaf in the tree of eType nodes. */ - for(p=pRoot; p->eType==eType; p=p->pLeft){ - assert( p->pParent==0 || p->pParent->pLeft==p ); - assert( p->pLeft && p->pRight ); - } - - /* This loop runs once for each leaf in the tree of eType nodes. */ - while( 1 ){ - int iLvl; - Fts3Expr *pParent = p->pParent; /* Current parent of p */ - - assert( pParent==0 || pParent->pLeft==p ); - p->pParent = 0; - if( pParent ){ - pParent->pLeft = 0; - }else{ - pRoot = 0; - } - rc = fts3ExprBalance(&p, nMaxDepth-1); - if( rc!=SQLITE_OK ) break; - - for(iLvl=0; p && iLvlpLeft = apLeaf[iLvl]; - pFree->pRight = p; - pFree->pLeft->pParent = pFree; - pFree->pRight->pParent = pFree; - - p = pFree; - pFree = pFree->pParent; - p->pParent = 0; - apLeaf[iLvl] = 0; - } - } - if( p ){ - sqlite3Fts3ExprFree(p); - rc = SQLITE_TOOBIG; - break; - } - - /* If that was the last leaf node, break out of the loop */ - if( pParent==0 ) break; - - /* Set $p to point to the next leaf in the tree of eType nodes */ - for(p=pParent->pRight; p->eType==eType; p=p->pLeft); - - /* Remove pParent from the original tree. */ - assert( pParent->pParent==0 || pParent->pParent->pLeft==pParent ); - pParent->pRight->pParent = pParent->pParent; - if( pParent->pParent ){ - pParent->pParent->pLeft = pParent->pRight; - }else{ - assert( pParent==pRoot ); - pRoot = pParent->pRight; - } - - /* Link pParent into the free node list. It will be used as an - ** internal node of the new tree. */ - pParent->pParent = pFree; - pFree = pParent; - } - - if( rc==SQLITE_OK ){ - p = 0; - for(i=0; ipParent = 0; - }else{ - assert( pFree!=0 ); - pFree->pRight = p; - pFree->pLeft = apLeaf[i]; - pFree->pLeft->pParent = pFree; - pFree->pRight->pParent = pFree; - - p = pFree; - pFree = pFree->pParent; - p->pParent = 0; - } - } - } - pRoot = p; - }else{ - /* An error occurred. Delete the contents of the apLeaf[] array - ** and pFree list. Everything else is cleaned up by the call to - ** sqlite3Fts3ExprFree(pRoot) below. */ - Fts3Expr *pDel; - for(i=0; ipParent; - sqlite3_free(pDel); - } - } - - assert( pFree==0 ); - sqlite3_free( apLeaf ); - } - } - - if( rc!=SQLITE_OK ){ - sqlite3Fts3ExprFree(pRoot); - pRoot = 0; - } - *pp = pRoot; - return rc; -} - -/* -** This function is similar to sqlite3Fts3ExprParse(), with the following -** differences: -** -** 1. It does not do expression rebalancing. -** 2. It does not check that the expression does not exceed the -** maximum allowable depth. -** 3. Even if it fails, *ppExpr may still be set to point to an -** expression tree. It should be deleted using sqlite3Fts3ExprFree() -** in this case. -*/ -static int fts3ExprParseUnbalanced( - sqlite3_tokenizer *pTokenizer, /* Tokenizer module */ - int iLangid, /* Language id for tokenizer */ - char **azCol, /* Array of column names for fts3 table */ - int bFts4, /* True to allow FTS4-only syntax */ - int nCol, /* Number of entries in azCol[] */ - int iDefaultCol, /* Default column to query */ - const char *z, int n, /* Text of MATCH query */ - Fts3Expr **ppExpr /* OUT: Parsed query structure */ -){ - int nParsed; - int rc; - ParseContext sParse; - - memset(&sParse, 0, sizeof(ParseContext)); - sParse.pTokenizer = pTokenizer; - sParse.iLangid = iLangid; - sParse.azCol = (const char **)azCol; - sParse.nCol = nCol; - sParse.iDefaultCol = iDefaultCol; - sParse.bFts4 = bFts4; - if( z==0 ){ - *ppExpr = 0; - return SQLITE_OK; - } - if( n<0 ){ - n = (int)strlen(z); - } - rc = fts3ExprParse(&sParse, z, n, ppExpr, &nParsed); - assert( rc==SQLITE_OK || *ppExpr==0 ); - - /* Check for mismatched parenthesis */ - if( rc==SQLITE_OK && sParse.nNest ){ - rc = SQLITE_ERROR; - } - - return rc; -} - -/* -** Parameters z and n contain a pointer to and length of a buffer containing -** an fts3 query expression, respectively. This function attempts to parse the -** query expression and create a tree of Fts3Expr structures representing the -** parsed expression. If successful, *ppExpr is set to point to the head -** of the parsed expression tree and SQLITE_OK is returned. If an error -** occurs, either SQLITE_NOMEM (out-of-memory error) or SQLITE_ERROR (parse -** error) is returned and *ppExpr is set to 0. -** -** If parameter n is a negative number, then z is assumed to point to a -** nul-terminated string and the length is determined using strlen(). -** -** The first parameter, pTokenizer, is passed the fts3 tokenizer module to -** use to normalize query tokens while parsing the expression. The azCol[] -** array, which is assumed to contain nCol entries, should contain the names -** of each column in the target fts3 table, in order from left to right. -** Column names must be nul-terminated strings. -** -** The iDefaultCol parameter should be passed the index of the table column -** that appears on the left-hand-side of the MATCH operator (the default -** column to match against for tokens for which a column name is not explicitly -** specified as part of the query string), or -1 if tokens may by default -** match any table column. -*/ -SQLITE_PRIVATE int sqlite3Fts3ExprParse( - sqlite3_tokenizer *pTokenizer, /* Tokenizer module */ - int iLangid, /* Language id for tokenizer */ - char **azCol, /* Array of column names for fts3 table */ - int bFts4, /* True to allow FTS4-only syntax */ - int nCol, /* Number of entries in azCol[] */ - int iDefaultCol, /* Default column to query */ - const char *z, int n, /* Text of MATCH query */ - Fts3Expr **ppExpr, /* OUT: Parsed query structure */ - char **pzErr /* OUT: Error message (sqlite3_malloc) */ -){ - int rc = fts3ExprParseUnbalanced( - pTokenizer, iLangid, azCol, bFts4, nCol, iDefaultCol, z, n, ppExpr - ); - - /* Rebalance the expression. And check that its depth does not exceed - ** SQLITE_FTS3_MAX_EXPR_DEPTH. */ - if( rc==SQLITE_OK && *ppExpr ){ - rc = fts3ExprBalance(ppExpr, SQLITE_FTS3_MAX_EXPR_DEPTH); - if( rc==SQLITE_OK ){ - rc = fts3ExprCheckDepth(*ppExpr, SQLITE_FTS3_MAX_EXPR_DEPTH); - } - } - - if( rc!=SQLITE_OK ){ - sqlite3Fts3ExprFree(*ppExpr); - *ppExpr = 0; - if( rc==SQLITE_TOOBIG ){ - *pzErr = sqlite3_mprintf( - "FTS expression tree is too large (maximum depth %d)", - SQLITE_FTS3_MAX_EXPR_DEPTH - ); - rc = SQLITE_ERROR; - }else if( rc==SQLITE_ERROR ){ - *pzErr = sqlite3_mprintf("malformed MATCH expression: [%s]", z); - } - } - - return rc; -} - -/* -** Free a single node of an expression tree. -*/ -static void fts3FreeExprNode(Fts3Expr *p){ - assert( p->eType==FTSQUERY_PHRASE || p->pPhrase==0 ); - sqlite3Fts3EvalPhraseCleanup(p->pPhrase); - sqlite3_free(p->aMI); - sqlite3_free(p); -} - -/* -** Free a parsed fts3 query expression allocated by sqlite3Fts3ExprParse(). -** -** This function would be simpler if it recursively called itself. But -** that would mean passing a sufficiently large expression to ExprParse() -** could cause a stack overflow. -*/ -SQLITE_PRIVATE void sqlite3Fts3ExprFree(Fts3Expr *pDel){ - Fts3Expr *p; - assert( pDel==0 || pDel->pParent==0 ); - for(p=pDel; p && (p->pLeft||p->pRight); p=(p->pLeft ? p->pLeft : p->pRight)){ - assert( p->pParent==0 || p==p->pParent->pRight || p==p->pParent->pLeft ); - } - while( p ){ - Fts3Expr *pParent = p->pParent; - fts3FreeExprNode(p); - if( pParent && p==pParent->pLeft && pParent->pRight ){ - p = pParent->pRight; - while( p && (p->pLeft || p->pRight) ){ - assert( p==p->pParent->pRight || p==p->pParent->pLeft ); - p = (p->pLeft ? p->pLeft : p->pRight); - } - }else{ - p = pParent; - } - } -} - -/**************************************************************************** -***************************************************************************** -** Everything after this point is just test code. -*/ - -#ifdef SQLITE_TEST - -/* #include */ - -/* -** Function to query the hash-table of tokenizers (see README.tokenizers). -*/ -static int queryTestTokenizer( - sqlite3 *db, - const char *zName, - const sqlite3_tokenizer_module **pp -){ - int rc; - sqlite3_stmt *pStmt; - const char zSql[] = "SELECT fts3_tokenizer(?)"; - - *pp = 0; - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - - sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){ - memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp)); - } - } - - return sqlite3_finalize(pStmt); -} - -/* -** Return a pointer to a buffer containing a text representation of the -** expression passed as the first argument. The buffer is obtained from -** sqlite3_malloc(). It is the responsibility of the caller to use -** sqlite3_free() to release the memory. If an OOM condition is encountered, -** NULL is returned. -** -** If the second argument is not NULL, then its contents are prepended to -** the returned expression text and then freed using sqlite3_free(). -*/ -static char *exprToString(Fts3Expr *pExpr, char *zBuf){ - if( pExpr==0 ){ - return sqlite3_mprintf(""); - } - switch( pExpr->eType ){ - case FTSQUERY_PHRASE: { - Fts3Phrase *pPhrase = pExpr->pPhrase; - int i; - zBuf = sqlite3_mprintf( - "%zPHRASE %d 0", zBuf, pPhrase->iColumn); - for(i=0; zBuf && inToken; i++){ - zBuf = sqlite3_mprintf("%z %.*s%s", zBuf, - pPhrase->aToken[i].n, pPhrase->aToken[i].z, - (pPhrase->aToken[i].isPrefix?"+":"") - ); - } - return zBuf; - } - - case FTSQUERY_NEAR: - zBuf = sqlite3_mprintf("%zNEAR/%d ", zBuf, pExpr->nNear); - break; - case FTSQUERY_NOT: - zBuf = sqlite3_mprintf("%zNOT ", zBuf); - break; - case FTSQUERY_AND: - zBuf = sqlite3_mprintf("%zAND ", zBuf); - break; - case FTSQUERY_OR: - zBuf = sqlite3_mprintf("%zOR ", zBuf); - break; - } - - if( zBuf ) zBuf = sqlite3_mprintf("%z{", zBuf); - if( zBuf ) zBuf = exprToString(pExpr->pLeft, zBuf); - if( zBuf ) zBuf = sqlite3_mprintf("%z} {", zBuf); - - if( zBuf ) zBuf = exprToString(pExpr->pRight, zBuf); - if( zBuf ) zBuf = sqlite3_mprintf("%z}", zBuf); - - return zBuf; -} - -/* -** This is the implementation of a scalar SQL function used to test the -** expression parser. It should be called as follows: -** -** fts3_exprtest(, , , ...); -** -** The first argument, , is the name of the fts3 tokenizer used -** to parse the query expression (see README.tokenizers). The second argument -** is the query expression to parse. Each subsequent argument is the name -** of a column of the fts3 table that the query expression may refer to. -** For example: -** -** SELECT fts3_exprtest('simple', 'Bill col2:Bloggs', 'col1', 'col2'); -*/ -static void fts3ExprTest( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - sqlite3_tokenizer_module const *pModule = 0; - sqlite3_tokenizer *pTokenizer = 0; - int rc; - char **azCol = 0; - const char *zExpr; - int nExpr; - int nCol; - int ii; - Fts3Expr *pExpr; - char *zBuf = 0; - sqlite3 *db = sqlite3_context_db_handle(context); - - if( argc<3 ){ - sqlite3_result_error(context, - "Usage: fts3_exprtest(tokenizer, expr, col1, ...", -1 - ); - return; - } - - rc = queryTestTokenizer(db, - (const char *)sqlite3_value_text(argv[0]), &pModule); - if( rc==SQLITE_NOMEM ){ - sqlite3_result_error_nomem(context); - goto exprtest_out; - }else if( !pModule ){ - sqlite3_result_error(context, "No such tokenizer module", -1); - goto exprtest_out; - } - - rc = pModule->xCreate(0, 0, &pTokenizer); - assert( rc==SQLITE_NOMEM || rc==SQLITE_OK ); - if( rc==SQLITE_NOMEM ){ - sqlite3_result_error_nomem(context); - goto exprtest_out; - } - pTokenizer->pModule = pModule; - - zExpr = (const char *)sqlite3_value_text(argv[1]); - nExpr = sqlite3_value_bytes(argv[1]); - nCol = argc-2; - azCol = (char **)sqlite3_malloc(nCol*sizeof(char *)); - if( !azCol ){ - sqlite3_result_error_nomem(context); - goto exprtest_out; - } - for(ii=0; iixDestroy(pTokenizer); - } - sqlite3_free(azCol); -} - -/* -** Register the query expression parser test function fts3_exprtest() -** with database connection db. -*/ -SQLITE_PRIVATE int sqlite3Fts3ExprInitTestInterface(sqlite3* db){ - int rc = sqlite3_create_function( - db, "fts3_exprtest", -1, SQLITE_UTF8, 0, fts3ExprTest, 0, 0 - ); - if( rc==SQLITE_OK ){ - rc = sqlite3_create_function(db, "fts3_exprtest_rebalance", - -1, SQLITE_UTF8, (void *)1, fts3ExprTest, 0, 0 - ); - } - return rc; -} - -#endif -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ - -/************** End of fts3_expr.c *******************************************/ -/************** Begin file fts3_hash.c ***************************************/ -/* -** 2001 September 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This is the implementation of generic hash-tables used in SQLite. -** We've modified it slightly to serve as a standalone hash table -** implementation for the full-text indexing module. -*/ - -/* -** The code in this file is only compiled if: -** -** * The FTS3 module is being built as an extension -** (in which case SQLITE_CORE is not defined), or -** -** * The FTS3 module is being built into the core of -** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). -*/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ -/* #include */ - - -/* -** Malloc and Free functions -*/ -static void *fts3HashMalloc(int n){ - void *p = sqlite3_malloc(n); - if( p ){ - memset(p, 0, n); - } - return p; -} -static void fts3HashFree(void *p){ - sqlite3_free(p); -} - -/* Turn bulk memory into a hash table object by initializing the -** fields of the Hash structure. -** -** "pNew" is a pointer to the hash table that is to be initialized. -** keyClass is one of the constants -** FTS3_HASH_BINARY or FTS3_HASH_STRING. The value of keyClass -** determines what kind of key the hash table will use. "copyKey" is -** true if the hash table should make its own private copy of keys and -** false if it should just use the supplied pointer. -*/ -SQLITE_PRIVATE void sqlite3Fts3HashInit(Fts3Hash *pNew, char keyClass, char copyKey){ - assert( pNew!=0 ); - assert( keyClass>=FTS3_HASH_STRING && keyClass<=FTS3_HASH_BINARY ); - pNew->keyClass = keyClass; - pNew->copyKey = copyKey; - pNew->first = 0; - pNew->count = 0; - pNew->htsize = 0; - pNew->ht = 0; -} - -/* Remove all entries from a hash table. Reclaim all memory. -** Call this routine to delete a hash table or to reset a hash table -** to the empty state. -*/ -SQLITE_PRIVATE void sqlite3Fts3HashClear(Fts3Hash *pH){ - Fts3HashElem *elem; /* For looping over all elements of the table */ - - assert( pH!=0 ); - elem = pH->first; - pH->first = 0; - fts3HashFree(pH->ht); - pH->ht = 0; - pH->htsize = 0; - while( elem ){ - Fts3HashElem *next_elem = elem->next; - if( pH->copyKey && elem->pKey ){ - fts3HashFree(elem->pKey); - } - fts3HashFree(elem); - elem = next_elem; - } - pH->count = 0; -} - -/* -** Hash and comparison functions when the mode is FTS3_HASH_STRING -*/ -static int fts3StrHash(const void *pKey, int nKey){ - const char *z = (const char *)pKey; - unsigned h = 0; - if( nKey<=0 ) nKey = (int) strlen(z); - while( nKey > 0 ){ - h = (h<<3) ^ h ^ *z++; - nKey--; - } - return (int)(h & 0x7fffffff); -} -static int fts3StrCompare(const void *pKey1, int n1, const void *pKey2, int n2){ - if( n1!=n2 ) return 1; - return strncmp((const char*)pKey1,(const char*)pKey2,n1); -} - -/* -** Hash and comparison functions when the mode is FTS3_HASH_BINARY -*/ -static int fts3BinHash(const void *pKey, int nKey){ - int h = 0; - const char *z = (const char *)pKey; - while( nKey-- > 0 ){ - h = (h<<3) ^ h ^ *(z++); - } - return h & 0x7fffffff; -} -static int fts3BinCompare(const void *pKey1, int n1, const void *pKey2, int n2){ - if( n1!=n2 ) return 1; - return memcmp(pKey1,pKey2,n1); -} - -/* -** Return a pointer to the appropriate hash function given the key class. -** -** The C syntax in this function definition may be unfamilar to some -** programmers, so we provide the following additional explanation: -** -** The name of the function is "ftsHashFunction". The function takes a -** single parameter "keyClass". The return value of ftsHashFunction() -** is a pointer to another function. Specifically, the return value -** of ftsHashFunction() is a pointer to a function that takes two parameters -** with types "const void*" and "int" and returns an "int". -*/ -static int (*ftsHashFunction(int keyClass))(const void*,int){ - if( keyClass==FTS3_HASH_STRING ){ - return &fts3StrHash; - }else{ - assert( keyClass==FTS3_HASH_BINARY ); - return &fts3BinHash; - } -} - -/* -** Return a pointer to the appropriate hash function given the key class. -** -** For help in interpreted the obscure C code in the function definition, -** see the header comment on the previous function. -*/ -static int (*ftsCompareFunction(int keyClass))(const void*,int,const void*,int){ - if( keyClass==FTS3_HASH_STRING ){ - return &fts3StrCompare; - }else{ - assert( keyClass==FTS3_HASH_BINARY ); - return &fts3BinCompare; - } -} - -/* Link an element into the hash table -*/ -static void fts3HashInsertElement( - Fts3Hash *pH, /* The complete hash table */ - struct _fts3ht *pEntry, /* The entry into which pNew is inserted */ - Fts3HashElem *pNew /* The element to be inserted */ -){ - Fts3HashElem *pHead; /* First element already in pEntry */ - pHead = pEntry->chain; - if( pHead ){ - pNew->next = pHead; - pNew->prev = pHead->prev; - if( pHead->prev ){ pHead->prev->next = pNew; } - else { pH->first = pNew; } - pHead->prev = pNew; - }else{ - pNew->next = pH->first; - if( pH->first ){ pH->first->prev = pNew; } - pNew->prev = 0; - pH->first = pNew; - } - pEntry->count++; - pEntry->chain = pNew; -} - - -/* Resize the hash table so that it cantains "new_size" buckets. -** "new_size" must be a power of 2. The hash table might fail -** to resize if sqliteMalloc() fails. -** -** Return non-zero if a memory allocation error occurs. -*/ -static int fts3Rehash(Fts3Hash *pH, int new_size){ - struct _fts3ht *new_ht; /* The new hash table */ - Fts3HashElem *elem, *next_elem; /* For looping over existing elements */ - int (*xHash)(const void*,int); /* The hash function */ - - assert( (new_size & (new_size-1))==0 ); - new_ht = (struct _fts3ht *)fts3HashMalloc( new_size*sizeof(struct _fts3ht) ); - if( new_ht==0 ) return 1; - fts3HashFree(pH->ht); - pH->ht = new_ht; - pH->htsize = new_size; - xHash = ftsHashFunction(pH->keyClass); - for(elem=pH->first, pH->first=0; elem; elem = next_elem){ - int h = (*xHash)(elem->pKey, elem->nKey) & (new_size-1); - next_elem = elem->next; - fts3HashInsertElement(pH, &new_ht[h], elem); - } - return 0; -} - -/* This function (for internal use only) locates an element in an -** hash table that matches the given key. The hash for this key has -** already been computed and is passed as the 4th parameter. -*/ -static Fts3HashElem *fts3FindElementByHash( - const Fts3Hash *pH, /* The pH to be searched */ - const void *pKey, /* The key we are searching for */ - int nKey, - int h /* The hash for this key. */ -){ - Fts3HashElem *elem; /* Used to loop thru the element list */ - int count; /* Number of elements left to test */ - int (*xCompare)(const void*,int,const void*,int); /* comparison function */ - - if( pH->ht ){ - struct _fts3ht *pEntry = &pH->ht[h]; - elem = pEntry->chain; - count = pEntry->count; - xCompare = ftsCompareFunction(pH->keyClass); - while( count-- && elem ){ - if( (*xCompare)(elem->pKey,elem->nKey,pKey,nKey)==0 ){ - return elem; - } - elem = elem->next; - } - } - return 0; -} - -/* Remove a single entry from the hash table given a pointer to that -** element and a hash on the element's key. -*/ -static void fts3RemoveElementByHash( - Fts3Hash *pH, /* The pH containing "elem" */ - Fts3HashElem* elem, /* The element to be removed from the pH */ - int h /* Hash value for the element */ -){ - struct _fts3ht *pEntry; - if( elem->prev ){ - elem->prev->next = elem->next; - }else{ - pH->first = elem->next; - } - if( elem->next ){ - elem->next->prev = elem->prev; - } - pEntry = &pH->ht[h]; - if( pEntry->chain==elem ){ - pEntry->chain = elem->next; - } - pEntry->count--; - if( pEntry->count<=0 ){ - pEntry->chain = 0; - } - if( pH->copyKey && elem->pKey ){ - fts3HashFree(elem->pKey); - } - fts3HashFree( elem ); - pH->count--; - if( pH->count<=0 ){ - assert( pH->first==0 ); - assert( pH->count==0 ); - fts3HashClear(pH); - } -} - -SQLITE_PRIVATE Fts3HashElem *sqlite3Fts3HashFindElem( - const Fts3Hash *pH, - const void *pKey, - int nKey -){ - int h; /* A hash on key */ - int (*xHash)(const void*,int); /* The hash function */ - - if( pH==0 || pH->ht==0 ) return 0; - xHash = ftsHashFunction(pH->keyClass); - assert( xHash!=0 ); - h = (*xHash)(pKey,nKey); - assert( (pH->htsize & (pH->htsize-1))==0 ); - return fts3FindElementByHash(pH,pKey,nKey, h & (pH->htsize-1)); -} - -/* -** Attempt to locate an element of the hash table pH with a key -** that matches pKey,nKey. Return the data for this element if it is -** found, or NULL if there is no match. -*/ -SQLITE_PRIVATE void *sqlite3Fts3HashFind(const Fts3Hash *pH, const void *pKey, int nKey){ - Fts3HashElem *pElem; /* The element that matches key (if any) */ - - pElem = sqlite3Fts3HashFindElem(pH, pKey, nKey); - return pElem ? pElem->data : 0; -} - -/* Insert an element into the hash table pH. The key is pKey,nKey -** and the data is "data". -** -** If no element exists with a matching key, then a new -** element is created. A copy of the key is made if the copyKey -** flag is set. NULL is returned. -** -** If another element already exists with the same key, then the -** new data replaces the old data and the old data is returned. -** The key is not copied in this instance. If a malloc fails, then -** the new data is returned and the hash table is unchanged. -** -** If the "data" parameter to this function is NULL, then the -** element corresponding to "key" is removed from the hash table. -*/ -SQLITE_PRIVATE void *sqlite3Fts3HashInsert( - Fts3Hash *pH, /* The hash table to insert into */ - const void *pKey, /* The key */ - int nKey, /* Number of bytes in the key */ - void *data /* The data */ -){ - int hraw; /* Raw hash value of the key */ - int h; /* the hash of the key modulo hash table size */ - Fts3HashElem *elem; /* Used to loop thru the element list */ - Fts3HashElem *new_elem; /* New element added to the pH */ - int (*xHash)(const void*,int); /* The hash function */ - - assert( pH!=0 ); - xHash = ftsHashFunction(pH->keyClass); - assert( xHash!=0 ); - hraw = (*xHash)(pKey, nKey); - assert( (pH->htsize & (pH->htsize-1))==0 ); - h = hraw & (pH->htsize-1); - elem = fts3FindElementByHash(pH,pKey,nKey,h); - if( elem ){ - void *old_data = elem->data; - if( data==0 ){ - fts3RemoveElementByHash(pH,elem,h); - }else{ - elem->data = data; - } - return old_data; - } - if( data==0 ) return 0; - if( (pH->htsize==0 && fts3Rehash(pH,8)) - || (pH->count>=pH->htsize && fts3Rehash(pH, pH->htsize*2)) - ){ - pH->count = 0; - return data; - } - assert( pH->htsize>0 ); - new_elem = (Fts3HashElem*)fts3HashMalloc( sizeof(Fts3HashElem) ); - if( new_elem==0 ) return data; - if( pH->copyKey && pKey!=0 ){ - new_elem->pKey = fts3HashMalloc( nKey ); - if( new_elem->pKey==0 ){ - fts3HashFree(new_elem); - return data; - } - memcpy((void*)new_elem->pKey, pKey, nKey); - }else{ - new_elem->pKey = (void*)pKey; - } - new_elem->nKey = nKey; - pH->count++; - assert( pH->htsize>0 ); - assert( (pH->htsize & (pH->htsize-1))==0 ); - h = hraw & (pH->htsize-1); - fts3HashInsertElement(pH, &pH->ht[h], new_elem); - new_elem->data = data; - return 0; -} - -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ - -/************** End of fts3_hash.c *******************************************/ -/************** Begin file fts3_porter.c *************************************/ -/* -** 2006 September 30 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Implementation of the full-text-search tokenizer that implements -** a Porter stemmer. -*/ - -/* -** The code in this file is only compiled if: -** -** * The FTS3 module is being built as an extension -** (in which case SQLITE_CORE is not defined), or -** -** * The FTS3 module is being built into the core of -** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). -*/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ -/* #include */ -/* #include */ - - -/* -** Class derived from sqlite3_tokenizer -*/ -typedef struct porter_tokenizer { - sqlite3_tokenizer base; /* Base class */ -} porter_tokenizer; - -/* -** Class derived from sqlite3_tokenizer_cursor -*/ -typedef struct porter_tokenizer_cursor { - sqlite3_tokenizer_cursor base; - const char *zInput; /* input we are tokenizing */ - int nInput; /* size of the input */ - int iOffset; /* current position in zInput */ - int iToken; /* index of next token to be returned */ - char *zToken; /* storage for current token */ - int nAllocated; /* space allocated to zToken buffer */ -} porter_tokenizer_cursor; - - -/* -** Create a new tokenizer instance. -*/ -static int porterCreate( - int argc, const char * const *argv, - sqlite3_tokenizer **ppTokenizer -){ - porter_tokenizer *t; - - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(argv); - - t = (porter_tokenizer *) sqlite3_malloc(sizeof(*t)); - if( t==NULL ) return SQLITE_NOMEM; - memset(t, 0, sizeof(*t)); - *ppTokenizer = &t->base; - return SQLITE_OK; -} - -/* -** Destroy a tokenizer -*/ -static int porterDestroy(sqlite3_tokenizer *pTokenizer){ - sqlite3_free(pTokenizer); - return SQLITE_OK; -} - -/* -** Prepare to begin tokenizing a particular string. The input -** string to be tokenized is zInput[0..nInput-1]. A cursor -** used to incrementally tokenize this string is returned in -** *ppCursor. -*/ -static int porterOpen( - sqlite3_tokenizer *pTokenizer, /* The tokenizer */ - const char *zInput, int nInput, /* String to be tokenized */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ -){ - porter_tokenizer_cursor *c; - - UNUSED_PARAMETER(pTokenizer); - - c = (porter_tokenizer_cursor *) sqlite3_malloc(sizeof(*c)); - if( c==NULL ) return SQLITE_NOMEM; - - c->zInput = zInput; - if( zInput==0 ){ - c->nInput = 0; - }else if( nInput<0 ){ - c->nInput = (int)strlen(zInput); - }else{ - c->nInput = nInput; - } - c->iOffset = 0; /* start tokenizing at the beginning */ - c->iToken = 0; - c->zToken = NULL; /* no space allocated, yet. */ - c->nAllocated = 0; - - *ppCursor = &c->base; - return SQLITE_OK; -} - -/* -** Close a tokenization cursor previously opened by a call to -** porterOpen() above. -*/ -static int porterClose(sqlite3_tokenizer_cursor *pCursor){ - porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor; - sqlite3_free(c->zToken); - sqlite3_free(c); - return SQLITE_OK; -} -/* -** Vowel or consonant -*/ -static const char cType[] = { - 0, 1, 1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 0, - 1, 1, 1, 2, 1 -}; - -/* -** isConsonant() and isVowel() determine if their first character in -** the string they point to is a consonant or a vowel, according -** to Porter ruls. -** -** A consonate is any letter other than 'a', 'e', 'i', 'o', or 'u'. -** 'Y' is a consonant unless it follows another consonant, -** in which case it is a vowel. -** -** In these routine, the letters are in reverse order. So the 'y' rule -** is that 'y' is a consonant unless it is followed by another -** consonent. -*/ -static int isVowel(const char*); -static int isConsonant(const char *z){ - int j; - char x = *z; - if( x==0 ) return 0; - assert( x>='a' && x<='z' ); - j = cType[x-'a']; - if( j<2 ) return j; - return z[1]==0 || isVowel(z + 1); -} -static int isVowel(const char *z){ - int j; - char x = *z; - if( x==0 ) return 0; - assert( x>='a' && x<='z' ); - j = cType[x-'a']; - if( j<2 ) return 1-j; - return isConsonant(z + 1); -} - -/* -** Let any sequence of one or more vowels be represented by V and let -** C be sequence of one or more consonants. Then every word can be -** represented as: -** -** [C] (VC){m} [V] -** -** In prose: A word is an optional consonant followed by zero or -** vowel-consonant pairs followed by an optional vowel. "m" is the -** number of vowel consonant pairs. This routine computes the value -** of m for the first i bytes of a word. -** -** Return true if the m-value for z is 1 or more. In other words, -** return true if z contains at least one vowel that is followed -** by a consonant. -** -** In this routine z[] is in reverse order. So we are really looking -** for an instance of of a consonant followed by a vowel. -*/ -static int m_gt_0(const char *z){ - while( isVowel(z) ){ z++; } - if( *z==0 ) return 0; - while( isConsonant(z) ){ z++; } - return *z!=0; -} - -/* Like mgt0 above except we are looking for a value of m which is -** exactly 1 -*/ -static int m_eq_1(const char *z){ - while( isVowel(z) ){ z++; } - if( *z==0 ) return 0; - while( isConsonant(z) ){ z++; } - if( *z==0 ) return 0; - while( isVowel(z) ){ z++; } - if( *z==0 ) return 1; - while( isConsonant(z) ){ z++; } - return *z==0; -} - -/* Like mgt0 above except we are looking for a value of m>1 instead -** or m>0 -*/ -static int m_gt_1(const char *z){ - while( isVowel(z) ){ z++; } - if( *z==0 ) return 0; - while( isConsonant(z) ){ z++; } - if( *z==0 ) return 0; - while( isVowel(z) ){ z++; } - if( *z==0 ) return 0; - while( isConsonant(z) ){ z++; } - return *z!=0; -} - -/* -** Return TRUE if there is a vowel anywhere within z[0..n-1] -*/ -static int hasVowel(const char *z){ - while( isConsonant(z) ){ z++; } - return *z!=0; -} - -/* -** Return TRUE if the word ends in a double consonant. -** -** The text is reversed here. So we are really looking at -** the first two characters of z[]. -*/ -static int doubleConsonant(const char *z){ - return isConsonant(z) && z[0]==z[1]; -} - -/* -** Return TRUE if the word ends with three letters which -** are consonant-vowel-consonent and where the final consonant -** is not 'w', 'x', or 'y'. -** -** The word is reversed here. So we are really checking the -** first three letters and the first one cannot be in [wxy]. -*/ -static int star_oh(const char *z){ - return - isConsonant(z) && - z[0]!='w' && z[0]!='x' && z[0]!='y' && - isVowel(z+1) && - isConsonant(z+2); -} - -/* -** If the word ends with zFrom and xCond() is true for the stem -** of the word that preceeds the zFrom ending, then change the -** ending to zTo. -** -** The input word *pz and zFrom are both in reverse order. zTo -** is in normal order. -** -** Return TRUE if zFrom matches. Return FALSE if zFrom does not -** match. Not that TRUE is returned even if xCond() fails and -** no substitution occurs. -*/ -static int stem( - char **pz, /* The word being stemmed (Reversed) */ - const char *zFrom, /* If the ending matches this... (Reversed) */ - const char *zTo, /* ... change the ending to this (not reversed) */ - int (*xCond)(const char*) /* Condition that must be true */ -){ - char *z = *pz; - while( *zFrom && *zFrom==*z ){ z++; zFrom++; } - if( *zFrom!=0 ) return 0; - if( xCond && !xCond(z) ) return 1; - while( *zTo ){ - *(--z) = *(zTo++); - } - *pz = z; - return 1; -} - -/* -** This is the fallback stemmer used when the porter stemmer is -** inappropriate. The input word is copied into the output with -** US-ASCII case folding. If the input word is too long (more -** than 20 bytes if it contains no digits or more than 6 bytes if -** it contains digits) then word is truncated to 20 or 6 bytes -** by taking 10 or 3 bytes from the beginning and end. -*/ -static void copy_stemmer(const char *zIn, int nIn, char *zOut, int *pnOut){ - int i, mx, j; - int hasDigit = 0; - for(i=0; i='A' && c<='Z' ){ - zOut[i] = c - 'A' + 'a'; - }else{ - if( c>='0' && c<='9' ) hasDigit = 1; - zOut[i] = c; - } - } - mx = hasDigit ? 3 : 10; - if( nIn>mx*2 ){ - for(j=mx, i=nIn-mx; i=(int)sizeof(zReverse)-7 ){ - /* The word is too big or too small for the porter stemmer. - ** Fallback to the copy stemmer */ - copy_stemmer(zIn, nIn, zOut, pnOut); - return; - } - for(i=0, j=sizeof(zReverse)-6; i='A' && c<='Z' ){ - zReverse[j] = c + 'a' - 'A'; - }else if( c>='a' && c<='z' ){ - zReverse[j] = c; - }else{ - /* The use of a character not in [a-zA-Z] means that we fallback - ** to the copy stemmer */ - copy_stemmer(zIn, nIn, zOut, pnOut); - return; - } - } - memset(&zReverse[sizeof(zReverse)-5], 0, 5); - z = &zReverse[j+1]; - - - /* Step 1a */ - if( z[0]=='s' ){ - if( - !stem(&z, "sess", "ss", 0) && - !stem(&z, "sei", "i", 0) && - !stem(&z, "ss", "ss", 0) - ){ - z++; - } - } - - /* Step 1b */ - z2 = z; - if( stem(&z, "dee", "ee", m_gt_0) ){ - /* Do nothing. The work was all in the test */ - }else if( - (stem(&z, "gni", "", hasVowel) || stem(&z, "de", "", hasVowel)) - && z!=z2 - ){ - if( stem(&z, "ta", "ate", 0) || - stem(&z, "lb", "ble", 0) || - stem(&z, "zi", "ize", 0) ){ - /* Do nothing. The work was all in the test */ - }else if( doubleConsonant(z) && (*z!='l' && *z!='s' && *z!='z') ){ - z++; - }else if( m_eq_1(z) && star_oh(z) ){ - *(--z) = 'e'; - } - } - - /* Step 1c */ - if( z[0]=='y' && hasVowel(z+1) ){ - z[0] = 'i'; - } - - /* Step 2 */ - switch( z[1] ){ - case 'a': - if( !stem(&z, "lanoita", "ate", m_gt_0) ){ - stem(&z, "lanoit", "tion", m_gt_0); - } - break; - case 'c': - if( !stem(&z, "icne", "ence", m_gt_0) ){ - stem(&z, "icna", "ance", m_gt_0); - } - break; - case 'e': - stem(&z, "rezi", "ize", m_gt_0); - break; - case 'g': - stem(&z, "igol", "log", m_gt_0); - break; - case 'l': - if( !stem(&z, "ilb", "ble", m_gt_0) - && !stem(&z, "illa", "al", m_gt_0) - && !stem(&z, "iltne", "ent", m_gt_0) - && !stem(&z, "ile", "e", m_gt_0) - ){ - stem(&z, "ilsuo", "ous", m_gt_0); - } - break; - case 'o': - if( !stem(&z, "noitazi", "ize", m_gt_0) - && !stem(&z, "noita", "ate", m_gt_0) - ){ - stem(&z, "rota", "ate", m_gt_0); - } - break; - case 's': - if( !stem(&z, "msila", "al", m_gt_0) - && !stem(&z, "ssenevi", "ive", m_gt_0) - && !stem(&z, "ssenluf", "ful", m_gt_0) - ){ - stem(&z, "ssensuo", "ous", m_gt_0); - } - break; - case 't': - if( !stem(&z, "itila", "al", m_gt_0) - && !stem(&z, "itivi", "ive", m_gt_0) - ){ - stem(&z, "itilib", "ble", m_gt_0); - } - break; - } - - /* Step 3 */ - switch( z[0] ){ - case 'e': - if( !stem(&z, "etaci", "ic", m_gt_0) - && !stem(&z, "evita", "", m_gt_0) - ){ - stem(&z, "ezila", "al", m_gt_0); - } - break; - case 'i': - stem(&z, "itici", "ic", m_gt_0); - break; - case 'l': - if( !stem(&z, "laci", "ic", m_gt_0) ){ - stem(&z, "luf", "", m_gt_0); - } - break; - case 's': - stem(&z, "ssen", "", m_gt_0); - break; - } - - /* Step 4 */ - switch( z[1] ){ - case 'a': - if( z[0]=='l' && m_gt_1(z+2) ){ - z += 2; - } - break; - case 'c': - if( z[0]=='e' && z[2]=='n' && (z[3]=='a' || z[3]=='e') && m_gt_1(z+4) ){ - z += 4; - } - break; - case 'e': - if( z[0]=='r' && m_gt_1(z+2) ){ - z += 2; - } - break; - case 'i': - if( z[0]=='c' && m_gt_1(z+2) ){ - z += 2; - } - break; - case 'l': - if( z[0]=='e' && z[2]=='b' && (z[3]=='a' || z[3]=='i') && m_gt_1(z+4) ){ - z += 4; - } - break; - case 'n': - if( z[0]=='t' ){ - if( z[2]=='a' ){ - if( m_gt_1(z+3) ){ - z += 3; - } - }else if( z[2]=='e' ){ - if( !stem(&z, "tneme", "", m_gt_1) - && !stem(&z, "tnem", "", m_gt_1) - ){ - stem(&z, "tne", "", m_gt_1); - } - } - } - break; - case 'o': - if( z[0]=='u' ){ - if( m_gt_1(z+2) ){ - z += 2; - } - }else if( z[3]=='s' || z[3]=='t' ){ - stem(&z, "noi", "", m_gt_1); - } - break; - case 's': - if( z[0]=='m' && z[2]=='i' && m_gt_1(z+3) ){ - z += 3; - } - break; - case 't': - if( !stem(&z, "eta", "", m_gt_1) ){ - stem(&z, "iti", "", m_gt_1); - } - break; - case 'u': - if( z[0]=='s' && z[2]=='o' && m_gt_1(z+3) ){ - z += 3; - } - break; - case 'v': - case 'z': - if( z[0]=='e' && z[2]=='i' && m_gt_1(z+3) ){ - z += 3; - } - break; - } - - /* Step 5a */ - if( z[0]=='e' ){ - if( m_gt_1(z+1) ){ - z++; - }else if( m_eq_1(z+1) && !star_oh(z+1) ){ - z++; - } - } - - /* Step 5b */ - if( m_gt_1(z) && z[0]=='l' && z[1]=='l' ){ - z++; - } - - /* z[] is now the stemmed word in reverse order. Flip it back - ** around into forward order and return. - */ - *pnOut = i = (int)strlen(z); - zOut[i] = 0; - while( *z ){ - zOut[--i] = *(z++); - } -} - -/* -** Characters that can be part of a token. We assume any character -** whose value is greater than 0x80 (any UTF character) can be -** part of a token. In other words, delimiters all must have -** values of 0x7f or lower. -*/ -static const char porterIdChar[] = { -/* x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xA xB xC xD xE xF */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 3x */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4x */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* 5x */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6x */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 7x */ -}; -#define isDelim(C) (((ch=C)&0x80)==0 && (ch<0x30 || !porterIdChar[ch-0x30])) - -/* -** Extract the next token from a tokenization cursor. The cursor must -** have been opened by a prior call to porterOpen(). -*/ -static int porterNext( - sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by porterOpen */ - const char **pzToken, /* OUT: *pzToken is the token text */ - int *pnBytes, /* OUT: Number of bytes in token */ - int *piStartOffset, /* OUT: Starting offset of token */ - int *piEndOffset, /* OUT: Ending offset of token */ - int *piPosition /* OUT: Position integer of token */ -){ - porter_tokenizer_cursor *c = (porter_tokenizer_cursor *) pCursor; - const char *z = c->zInput; - - while( c->iOffsetnInput ){ - int iStartOffset, ch; - - /* Scan past delimiter characters */ - while( c->iOffsetnInput && isDelim(z[c->iOffset]) ){ - c->iOffset++; - } - - /* Count non-delimiter characters. */ - iStartOffset = c->iOffset; - while( c->iOffsetnInput && !isDelim(z[c->iOffset]) ){ - c->iOffset++; - } - - if( c->iOffset>iStartOffset ){ - int n = c->iOffset-iStartOffset; - if( n>c->nAllocated ){ - char *pNew; - c->nAllocated = n+20; - pNew = sqlite3_realloc(c->zToken, c->nAllocated); - if( !pNew ) return SQLITE_NOMEM; - c->zToken = pNew; - } - porter_stemmer(&z[iStartOffset], n, c->zToken, pnBytes); - *pzToken = c->zToken; - *piStartOffset = iStartOffset; - *piEndOffset = c->iOffset; - *piPosition = c->iToken++; - return SQLITE_OK; - } - } - return SQLITE_DONE; -} - -/* -** The set of routines that implement the porter-stemmer tokenizer -*/ -static const sqlite3_tokenizer_module porterTokenizerModule = { - 0, - porterCreate, - porterDestroy, - porterOpen, - porterClose, - porterNext, - 0 -}; - -/* -** Allocate a new porter tokenizer. Return a pointer to the new -** tokenizer in *ppModule -*/ -SQLITE_PRIVATE void sqlite3Fts3PorterTokenizerModule( - sqlite3_tokenizer_module const**ppModule -){ - *ppModule = &porterTokenizerModule; -} - -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ - -/************** End of fts3_porter.c *****************************************/ -/************** Begin file fts3_tokenizer.c **********************************/ -/* -** 2007 June 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This is part of an SQLite module implementing full-text search. -** This particular file implements the generic tokenizer interface. -*/ - -/* -** The code in this file is only compiled if: -** -** * The FTS3 module is being built as an extension -** (in which case SQLITE_CORE is not defined), or -** -** * The FTS3 module is being built into the core of -** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). -*/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ - -/* -** Implementation of the SQL scalar function for accessing the underlying -** hash table. This function may be called as follows: -** -** SELECT (); -** SELECT (, ); -** -** where is the name passed as the second argument -** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer'). -** -** If the argument is specified, it must be a blob value -** containing a pointer to be stored as the hash data corresponding -** to the string . If is not specified, then -** the string must already exist in the has table. Otherwise, -** an error is returned. -** -** Whether or not the argument is specified, the value returned -** is a blob containing the pointer stored as the hash data corresponding -** to string (after the hash-table is updated, if applicable). -*/ -static void scalarFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - Fts3Hash *pHash; - void *pPtr = 0; - const unsigned char *zName; - int nName; - - assert( argc==1 || argc==2 ); - - pHash = (Fts3Hash *)sqlite3_user_data(context); - - zName = sqlite3_value_text(argv[0]); - nName = sqlite3_value_bytes(argv[0])+1; - - if( argc==2 ){ - void *pOld; - int n = sqlite3_value_bytes(argv[1]); - if( n!=sizeof(pPtr) ){ - sqlite3_result_error(context, "argument type mismatch", -1); - return; - } - pPtr = *(void **)sqlite3_value_blob(argv[1]); - pOld = sqlite3Fts3HashInsert(pHash, (void *)zName, nName, pPtr); - if( pOld==pPtr ){ - sqlite3_result_error(context, "out of memory", -1); - return; - } - }else{ - pPtr = sqlite3Fts3HashFind(pHash, zName, nName); - if( !pPtr ){ - char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName); - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); - return; - } - } - - sqlite3_result_blob(context, (void *)&pPtr, sizeof(pPtr), SQLITE_TRANSIENT); -} - -SQLITE_PRIVATE int sqlite3Fts3IsIdChar(char c){ - static const char isFtsIdChar[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 1x */ - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 2x */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 3x */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 4x */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, /* 5x */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 6x */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* 7x */ - }; - return (c&0x80 || isFtsIdChar[(int)(c)]); -} - -SQLITE_PRIVATE const char *sqlite3Fts3NextToken(const char *zStr, int *pn){ - const char *z1; - const char *z2 = 0; - - /* Find the start of the next token. */ - z1 = zStr; - while( z2==0 ){ - char c = *z1; - switch( c ){ - case '\0': return 0; /* No more tokens here */ - case '\'': - case '"': - case '`': { - z2 = z1; - while( *++z2 && (*z2!=c || *++z2==c) ); - break; - } - case '[': - z2 = &z1[1]; - while( *z2 && z2[0]!=']' ) z2++; - if( *z2 ) z2++; - break; - - default: - if( sqlite3Fts3IsIdChar(*z1) ){ - z2 = &z1[1]; - while( sqlite3Fts3IsIdChar(*z2) ) z2++; - }else{ - z1++; - } - } - } - - *pn = (int)(z2-z1); - return z1; -} - -SQLITE_PRIVATE int sqlite3Fts3InitTokenizer( - Fts3Hash *pHash, /* Tokenizer hash table */ - const char *zArg, /* Tokenizer name */ - sqlite3_tokenizer **ppTok, /* OUT: Tokenizer (if applicable) */ - char **pzErr /* OUT: Set to malloced error message */ -){ - int rc; - char *z = (char *)zArg; - int n = 0; - char *zCopy; - char *zEnd; /* Pointer to nul-term of zCopy */ - sqlite3_tokenizer_module *m; - - zCopy = sqlite3_mprintf("%s", zArg); - if( !zCopy ) return SQLITE_NOMEM; - zEnd = &zCopy[strlen(zCopy)]; - - z = (char *)sqlite3Fts3NextToken(zCopy, &n); - z[n] = '\0'; - sqlite3Fts3Dequote(z); - - m = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash,z,(int)strlen(z)+1); - if( !m ){ - *pzErr = sqlite3_mprintf("unknown tokenizer: %s", z); - rc = SQLITE_ERROR; - }else{ - char const **aArg = 0; - int iArg = 0; - z = &z[n+1]; - while( zxCreate(iArg, aArg, ppTok); - assert( rc!=SQLITE_OK || *ppTok ); - if( rc!=SQLITE_OK ){ - *pzErr = sqlite3_mprintf("unknown tokenizer"); - }else{ - (*ppTok)->pModule = m; - } - sqlite3_free((void *)aArg); - } - - sqlite3_free(zCopy); - return rc; -} - - -#ifdef SQLITE_TEST - -#include -/* #include */ - -/* -** Implementation of a special SQL scalar function for testing tokenizers -** designed to be used in concert with the Tcl testing framework. This -** function must be called with two or more arguments: -** -** SELECT (, ..., ); -** -** where is the name passed as the second argument -** to the sqlite3Fts3InitHashTable() function (e.g. 'fts3_tokenizer') -** concatenated with the string '_test' (e.g. 'fts3_tokenizer_test'). -** -** The return value is a string that may be interpreted as a Tcl -** list. For each token in the , three elements are -** added to the returned list. The first is the token position, the -** second is the token text (folded, stemmed, etc.) and the third is the -** substring of associated with the token. For example, -** using the built-in "simple" tokenizer: -** -** SELECT fts_tokenizer_test('simple', 'I don't see how'); -** -** will return the string: -** -** "{0 i I 1 dont don't 2 see see 3 how how}" -** -*/ -static void testFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - Fts3Hash *pHash; - sqlite3_tokenizer_module *p; - sqlite3_tokenizer *pTokenizer = 0; - sqlite3_tokenizer_cursor *pCsr = 0; - - const char *zErr = 0; - - const char *zName; - int nName; - const char *zInput; - int nInput; - - const char *azArg[64]; - - const char *zToken; - int nToken = 0; - int iStart = 0; - int iEnd = 0; - int iPos = 0; - int i; - - Tcl_Obj *pRet; - - if( argc<2 ){ - sqlite3_result_error(context, "insufficient arguments", -1); - return; - } - - nName = sqlite3_value_bytes(argv[0]); - zName = (const char *)sqlite3_value_text(argv[0]); - nInput = sqlite3_value_bytes(argv[argc-1]); - zInput = (const char *)sqlite3_value_text(argv[argc-1]); - - pHash = (Fts3Hash *)sqlite3_user_data(context); - p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1); - - if( !p ){ - char *zErr = sqlite3_mprintf("unknown tokenizer: %s", zName); - sqlite3_result_error(context, zErr, -1); - sqlite3_free(zErr); - return; - } - - pRet = Tcl_NewObj(); - Tcl_IncrRefCount(pRet); - - for(i=1; ixCreate(argc-2, azArg, &pTokenizer) ){ - zErr = "error in xCreate()"; - goto finish; - } - pTokenizer->pModule = p; - if( sqlite3Fts3OpenTokenizer(pTokenizer, 0, zInput, nInput, &pCsr) ){ - zErr = "error in xOpen()"; - goto finish; - } - - while( SQLITE_OK==p->xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos) ){ - Tcl_ListObjAppendElement(0, pRet, Tcl_NewIntObj(iPos)); - Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken)); - zToken = &zInput[iStart]; - nToken = iEnd-iStart; - Tcl_ListObjAppendElement(0, pRet, Tcl_NewStringObj(zToken, nToken)); - } - - if( SQLITE_OK!=p->xClose(pCsr) ){ - zErr = "error in xClose()"; - goto finish; - } - if( SQLITE_OK!=p->xDestroy(pTokenizer) ){ - zErr = "error in xDestroy()"; - goto finish; - } - -finish: - if( zErr ){ - sqlite3_result_error(context, zErr, -1); - }else{ - sqlite3_result_text(context, Tcl_GetString(pRet), -1, SQLITE_TRANSIENT); - } - Tcl_DecrRefCount(pRet); -} - -static -int registerTokenizer( - sqlite3 *db, - char *zName, - const sqlite3_tokenizer_module *p -){ - int rc; - sqlite3_stmt *pStmt; - const char zSql[] = "SELECT fts3_tokenizer(?, ?)"; - - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - - sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); - sqlite3_bind_blob(pStmt, 2, &p, sizeof(p), SQLITE_STATIC); - sqlite3_step(pStmt); - - return sqlite3_finalize(pStmt); -} - -static -int queryTokenizer( - sqlite3 *db, - char *zName, - const sqlite3_tokenizer_module **pp -){ - int rc; - sqlite3_stmt *pStmt; - const char zSql[] = "SELECT fts3_tokenizer(?)"; - - *pp = 0; - rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - - sqlite3_bind_text(pStmt, 1, zName, -1, SQLITE_STATIC); - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - if( sqlite3_column_type(pStmt, 0)==SQLITE_BLOB ){ - memcpy((void *)pp, sqlite3_column_blob(pStmt, 0), sizeof(*pp)); - } - } - - return sqlite3_finalize(pStmt); -} - -SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule(sqlite3_tokenizer_module const**ppModule); - -/* -** Implementation of the scalar function fts3_tokenizer_internal_test(). -** This function is used for testing only, it is not included in the -** build unless SQLITE_TEST is defined. -** -** The purpose of this is to test that the fts3_tokenizer() function -** can be used as designed by the C-code in the queryTokenizer and -** registerTokenizer() functions above. These two functions are repeated -** in the README.tokenizer file as an example, so it is important to -** test them. -** -** To run the tests, evaluate the fts3_tokenizer_internal_test() scalar -** function with no arguments. An assert() will fail if a problem is -** detected. i.e.: -** -** SELECT fts3_tokenizer_internal_test(); -** -*/ -static void intTestFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - int rc; - const sqlite3_tokenizer_module *p1; - const sqlite3_tokenizer_module *p2; - sqlite3 *db = (sqlite3 *)sqlite3_user_data(context); - - UNUSED_PARAMETER(argc); - UNUSED_PARAMETER(argv); - - /* Test the query function */ - sqlite3Fts3SimpleTokenizerModule(&p1); - rc = queryTokenizer(db, "simple", &p2); - assert( rc==SQLITE_OK ); - assert( p1==p2 ); - rc = queryTokenizer(db, "nosuchtokenizer", &p2); - assert( rc==SQLITE_ERROR ); - assert( p2==0 ); - assert( 0==strcmp(sqlite3_errmsg(db), "unknown tokenizer: nosuchtokenizer") ); - - /* Test the storage function */ - rc = registerTokenizer(db, "nosuchtokenizer", p1); - assert( rc==SQLITE_OK ); - rc = queryTokenizer(db, "nosuchtokenizer", &p2); - assert( rc==SQLITE_OK ); - assert( p2==p1 ); - - sqlite3_result_text(context, "ok", -1, SQLITE_STATIC); -} - -#endif - -/* -** Set up SQL objects in database db used to access the contents of -** the hash table pointed to by argument pHash. The hash table must -** been initialized to use string keys, and to take a private copy -** of the key when a value is inserted. i.e. by a call similar to: -** -** sqlite3Fts3HashInit(pHash, FTS3_HASH_STRING, 1); -** -** This function adds a scalar function (see header comment above -** scalarFunc() in this file for details) and, if ENABLE_TABLE is -** defined at compilation time, a temporary virtual table (see header -** comment above struct HashTableVtab) to the database schema. Both -** provide read/write access to the contents of *pHash. -** -** The third argument to this function, zName, is used as the name -** of both the scalar and, if created, the virtual table. -*/ -SQLITE_PRIVATE int sqlite3Fts3InitHashTable( - sqlite3 *db, - Fts3Hash *pHash, - const char *zName -){ - int rc = SQLITE_OK; - void *p = (void *)pHash; - const int any = SQLITE_ANY; - -#ifdef SQLITE_TEST - char *zTest = 0; - char *zTest2 = 0; - void *pdb = (void *)db; - zTest = sqlite3_mprintf("%s_test", zName); - zTest2 = sqlite3_mprintf("%s_internal_test", zName); - if( !zTest || !zTest2 ){ - rc = SQLITE_NOMEM; - } -#endif - - if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zName, 1, any, p, scalarFunc, 0, 0); - } - if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zName, 2, any, p, scalarFunc, 0, 0); - } -#ifdef SQLITE_TEST - if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zTest, -1, any, p, testFunc, 0, 0); - } - if( SQLITE_OK==rc ){ - rc = sqlite3_create_function(db, zTest2, 0, any, pdb, intTestFunc, 0, 0); - } -#endif - -#ifdef SQLITE_TEST - sqlite3_free(zTest); - sqlite3_free(zTest2); -#endif - - return rc; -} - -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ - -/************** End of fts3_tokenizer.c **************************************/ -/************** Begin file fts3_tokenizer1.c *********************************/ -/* -** 2006 Oct 10 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** Implementation of the "simple" full-text-search tokenizer. -*/ - -/* -** The code in this file is only compiled if: -** -** * The FTS3 module is being built as an extension -** (in which case SQLITE_CORE is not defined), or -** -** * The FTS3 module is being built into the core of -** SQLite (in which case SQLITE_ENABLE_FTS3 is defined). -*/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ -/* #include */ -/* #include */ - - -typedef struct simple_tokenizer { - sqlite3_tokenizer base; - char delim[128]; /* flag ASCII delimiters */ -} simple_tokenizer; - -typedef struct simple_tokenizer_cursor { - sqlite3_tokenizer_cursor base; - const char *pInput; /* input we are tokenizing */ - int nBytes; /* size of the input */ - int iOffset; /* current position in pInput */ - int iToken; /* index of next token to be returned */ - char *pToken; /* storage for current token */ - int nTokenAllocated; /* space allocated to zToken buffer */ -} simple_tokenizer_cursor; - - -static int simpleDelim(simple_tokenizer *t, unsigned char c){ - return c<0x80 && t->delim[c]; -} -static int fts3_isalnum(int x){ - return (x>='0' && x<='9') || (x>='A' && x<='Z') || (x>='a' && x<='z'); -} - -/* -** Create a new tokenizer instance. -*/ -static int simpleCreate( - int argc, const char * const *argv, - sqlite3_tokenizer **ppTokenizer -){ - simple_tokenizer *t; - - t = (simple_tokenizer *) sqlite3_malloc(sizeof(*t)); - if( t==NULL ) return SQLITE_NOMEM; - memset(t, 0, sizeof(*t)); - - /* TODO(shess) Delimiters need to remain the same from run to run, - ** else we need to reindex. One solution would be a meta-table to - ** track such information in the database, then we'd only want this - ** information on the initial create. - */ - if( argc>1 ){ - int i, n = (int)strlen(argv[1]); - for(i=0; i=0x80 ){ - sqlite3_free(t); - return SQLITE_ERROR; - } - t->delim[ch] = 1; - } - } else { - /* Mark non-alphanumeric ASCII characters as delimiters */ - int i; - for(i=1; i<0x80; i++){ - t->delim[i] = !fts3_isalnum(i) ? -1 : 0; - } - } - - *ppTokenizer = &t->base; - return SQLITE_OK; -} - -/* -** Destroy a tokenizer -*/ -static int simpleDestroy(sqlite3_tokenizer *pTokenizer){ - sqlite3_free(pTokenizer); - return SQLITE_OK; -} - -/* -** Prepare to begin tokenizing a particular string. The input -** string to be tokenized is pInput[0..nBytes-1]. A cursor -** used to incrementally tokenize this string is returned in -** *ppCursor. -*/ -static int simpleOpen( - sqlite3_tokenizer *pTokenizer, /* The tokenizer */ - const char *pInput, int nBytes, /* String to be tokenized */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ -){ - simple_tokenizer_cursor *c; - - UNUSED_PARAMETER(pTokenizer); - - c = (simple_tokenizer_cursor *) sqlite3_malloc(sizeof(*c)); - if( c==NULL ) return SQLITE_NOMEM; - - c->pInput = pInput; - if( pInput==0 ){ - c->nBytes = 0; - }else if( nBytes<0 ){ - c->nBytes = (int)strlen(pInput); - }else{ - c->nBytes = nBytes; - } - c->iOffset = 0; /* start tokenizing at the beginning */ - c->iToken = 0; - c->pToken = NULL; /* no space allocated, yet. */ - c->nTokenAllocated = 0; - - *ppCursor = &c->base; - return SQLITE_OK; -} - -/* -** Close a tokenization cursor previously opened by a call to -** simpleOpen() above. -*/ -static int simpleClose(sqlite3_tokenizer_cursor *pCursor){ - simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor; - sqlite3_free(c->pToken); - sqlite3_free(c); - return SQLITE_OK; -} - -/* -** Extract the next token from a tokenization cursor. The cursor must -** have been opened by a prior call to simpleOpen(). -*/ -static int simpleNext( - sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by simpleOpen */ - const char **ppToken, /* OUT: *ppToken is the token text */ - int *pnBytes, /* OUT: Number of bytes in token */ - int *piStartOffset, /* OUT: Starting offset of token */ - int *piEndOffset, /* OUT: Ending offset of token */ - int *piPosition /* OUT: Position integer of token */ -){ - simple_tokenizer_cursor *c = (simple_tokenizer_cursor *) pCursor; - simple_tokenizer *t = (simple_tokenizer *) pCursor->pTokenizer; - unsigned char *p = (unsigned char *)c->pInput; - - while( c->iOffsetnBytes ){ - int iStartOffset; - - /* Scan past delimiter characters */ - while( c->iOffsetnBytes && simpleDelim(t, p[c->iOffset]) ){ - c->iOffset++; - } - - /* Count non-delimiter characters. */ - iStartOffset = c->iOffset; - while( c->iOffsetnBytes && !simpleDelim(t, p[c->iOffset]) ){ - c->iOffset++; - } - - if( c->iOffset>iStartOffset ){ - int i, n = c->iOffset-iStartOffset; - if( n>c->nTokenAllocated ){ - char *pNew; - c->nTokenAllocated = n+20; - pNew = sqlite3_realloc(c->pToken, c->nTokenAllocated); - if( !pNew ) return SQLITE_NOMEM; - c->pToken = pNew; - } - for(i=0; ipToken[i] = (char)((ch>='A' && ch<='Z') ? ch-'A'+'a' : ch); - } - *ppToken = c->pToken; - *pnBytes = n; - *piStartOffset = iStartOffset; - *piEndOffset = c->iOffset; - *piPosition = c->iToken++; - - return SQLITE_OK; - } - } - return SQLITE_DONE; -} - -/* -** The set of routines that implement the simple tokenizer -*/ -static const sqlite3_tokenizer_module simpleTokenizerModule = { - 0, - simpleCreate, - simpleDestroy, - simpleOpen, - simpleClose, - simpleNext, - 0, -}; - -/* -** Allocate a new simple tokenizer. Return a pointer to the new -** tokenizer in *ppModule -*/ -SQLITE_PRIVATE void sqlite3Fts3SimpleTokenizerModule( - sqlite3_tokenizer_module const**ppModule -){ - *ppModule = &simpleTokenizerModule; -} - -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ - -/************** End of fts3_tokenizer1.c *************************************/ -/************** Begin file fts3_tokenize_vtab.c ******************************/ -/* -** 2013 Apr 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file contains code for the "fts3tokenize" virtual table module. -** An fts3tokenize virtual table is created as follows: -** -** CREATE VIRTUAL TABLE USING fts3tokenize( -** , , ... -** ); -** -** The table created has the following schema: -** -** CREATE TABLE (input, token, start, end, position) -** -** When queried, the query must include a WHERE clause of type: -** -** input = -** -** The virtual table module tokenizes this , using the FTS3 -** tokenizer specified by the arguments to the CREATE VIRTUAL TABLE -** statement and returns one row for each token in the result. With -** fields set as follows: -** -** input: Always set to a copy of -** token: A token from the input. -** start: Byte offset of the token within the input . -** end: Byte offset of the byte immediately following the end of the -** token within the input string. -** pos: Token offset of token within input. -** -*/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ - -typedef struct Fts3tokTable Fts3tokTable; -typedef struct Fts3tokCursor Fts3tokCursor; - -/* -** Virtual table structure. -*/ -struct Fts3tokTable { - sqlite3_vtab base; /* Base class used by SQLite core */ - const sqlite3_tokenizer_module *pMod; - sqlite3_tokenizer *pTok; -}; - -/* -** Virtual table cursor structure. -*/ -struct Fts3tokCursor { - sqlite3_vtab_cursor base; /* Base class used by SQLite core */ - char *zInput; /* Input string */ - sqlite3_tokenizer_cursor *pCsr; /* Cursor to iterate through zInput */ - int iRowid; /* Current 'rowid' value */ - const char *zToken; /* Current 'token' value */ - int nToken; /* Size of zToken in bytes */ - int iStart; /* Current 'start' value */ - int iEnd; /* Current 'end' value */ - int iPos; /* Current 'pos' value */ -}; - -/* -** Query FTS for the tokenizer implementation named zName. -*/ -static int fts3tokQueryTokenizer( - Fts3Hash *pHash, - const char *zName, - const sqlite3_tokenizer_module **pp, - char **pzErr -){ - sqlite3_tokenizer_module *p; - int nName = (int)strlen(zName); - - p = (sqlite3_tokenizer_module *)sqlite3Fts3HashFind(pHash, zName, nName+1); - if( !p ){ - *pzErr = sqlite3_mprintf("unknown tokenizer: %s", zName); - return SQLITE_ERROR; - } - - *pp = p; - return SQLITE_OK; -} - -/* -** The second argument, argv[], is an array of pointers to nul-terminated -** strings. This function makes a copy of the array and strings into a -** single block of memory. It then dequotes any of the strings that appear -** to be quoted. -** -** If successful, output parameter *pazDequote is set to point at the -** array of dequoted strings and SQLITE_OK is returned. The caller is -** responsible for eventually calling sqlite3_free() to free the array -** in this case. Or, if an error occurs, an SQLite error code is returned. -** The final value of *pazDequote is undefined in this case. -*/ -static int fts3tokDequoteArray( - int argc, /* Number of elements in argv[] */ - const char * const *argv, /* Input array */ - char ***pazDequote /* Output array */ -){ - int rc = SQLITE_OK; /* Return code */ - if( argc==0 ){ - *pazDequote = 0; - }else{ - int i; - int nByte = 0; - char **azDequote; - - for(i=0; ixCreate((nDequote>1 ? nDequote-1 : 0), azArg, &pTok); - } - - if( rc==SQLITE_OK ){ - pTab = (Fts3tokTable *)sqlite3_malloc(sizeof(Fts3tokTable)); - if( pTab==0 ){ - rc = SQLITE_NOMEM; - } - } - - if( rc==SQLITE_OK ){ - memset(pTab, 0, sizeof(Fts3tokTable)); - pTab->pMod = pMod; - pTab->pTok = pTok; - *ppVtab = &pTab->base; - }else{ - if( pTok ){ - pMod->xDestroy(pTok); - } - } - - sqlite3_free(azDequote); - return rc; -} - -/* -** This function does the work for both the xDisconnect and xDestroy methods. -** These tables have no persistent representation of their own, so xDisconnect -** and xDestroy are identical operations. -*/ -static int fts3tokDisconnectMethod(sqlite3_vtab *pVtab){ - Fts3tokTable *pTab = (Fts3tokTable *)pVtab; - - pTab->pMod->xDestroy(pTab->pTok); - sqlite3_free(pTab); - return SQLITE_OK; -} - -/* -** xBestIndex - Analyze a WHERE and ORDER BY clause. -*/ -static int fts3tokBestIndexMethod( - sqlite3_vtab *pVTab, - sqlite3_index_info *pInfo -){ - int i; - UNUSED_PARAMETER(pVTab); - - for(i=0; inConstraint; i++){ - if( pInfo->aConstraint[i].usable - && pInfo->aConstraint[i].iColumn==0 - && pInfo->aConstraint[i].op==SQLITE_INDEX_CONSTRAINT_EQ - ){ - pInfo->idxNum = 1; - pInfo->aConstraintUsage[i].argvIndex = 1; - pInfo->aConstraintUsage[i].omit = 1; - pInfo->estimatedCost = 1; - return SQLITE_OK; - } - } - - pInfo->idxNum = 0; - assert( pInfo->estimatedCost>1000000.0 ); - - return SQLITE_OK; -} - -/* -** xOpen - Open a cursor. -*/ -static int fts3tokOpenMethod(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCsr){ - Fts3tokCursor *pCsr; - UNUSED_PARAMETER(pVTab); - - pCsr = (Fts3tokCursor *)sqlite3_malloc(sizeof(Fts3tokCursor)); - if( pCsr==0 ){ - return SQLITE_NOMEM; - } - memset(pCsr, 0, sizeof(Fts3tokCursor)); - - *ppCsr = (sqlite3_vtab_cursor *)pCsr; - return SQLITE_OK; -} - -/* -** Reset the tokenizer cursor passed as the only argument. As if it had -** just been returned by fts3tokOpenMethod(). -*/ -static void fts3tokResetCursor(Fts3tokCursor *pCsr){ - if( pCsr->pCsr ){ - Fts3tokTable *pTab = (Fts3tokTable *)(pCsr->base.pVtab); - pTab->pMod->xClose(pCsr->pCsr); - pCsr->pCsr = 0; - } - sqlite3_free(pCsr->zInput); - pCsr->zInput = 0; - pCsr->zToken = 0; - pCsr->nToken = 0; - pCsr->iStart = 0; - pCsr->iEnd = 0; - pCsr->iPos = 0; - pCsr->iRowid = 0; -} - -/* -** xClose - Close a cursor. -*/ -static int fts3tokCloseMethod(sqlite3_vtab_cursor *pCursor){ - Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; - - fts3tokResetCursor(pCsr); - sqlite3_free(pCsr); - return SQLITE_OK; -} - -/* -** xNext - Advance the cursor to the next row, if any. -*/ -static int fts3tokNextMethod(sqlite3_vtab_cursor *pCursor){ - Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; - Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab); - int rc; /* Return code */ - - pCsr->iRowid++; - rc = pTab->pMod->xNext(pCsr->pCsr, - &pCsr->zToken, &pCsr->nToken, - &pCsr->iStart, &pCsr->iEnd, &pCsr->iPos - ); - - if( rc!=SQLITE_OK ){ - fts3tokResetCursor(pCsr); - if( rc==SQLITE_DONE ) rc = SQLITE_OK; - } - - return rc; -} - -/* -** xFilter - Initialize a cursor to point at the start of its data. -*/ -static int fts3tokFilterMethod( - sqlite3_vtab_cursor *pCursor, /* The cursor used for this query */ - int idxNum, /* Strategy index */ - const char *idxStr, /* Unused */ - int nVal, /* Number of elements in apVal */ - sqlite3_value **apVal /* Arguments for the indexing scheme */ -){ - int rc = SQLITE_ERROR; - Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; - Fts3tokTable *pTab = (Fts3tokTable *)(pCursor->pVtab); - UNUSED_PARAMETER(idxStr); - UNUSED_PARAMETER(nVal); - - fts3tokResetCursor(pCsr); - if( idxNum==1 ){ - const char *zByte = (const char *)sqlite3_value_text(apVal[0]); - int nByte = sqlite3_value_bytes(apVal[0]); - pCsr->zInput = sqlite3_malloc(nByte+1); - if( pCsr->zInput==0 ){ - rc = SQLITE_NOMEM; - }else{ - memcpy(pCsr->zInput, zByte, nByte); - pCsr->zInput[nByte] = 0; - rc = pTab->pMod->xOpen(pTab->pTok, pCsr->zInput, nByte, &pCsr->pCsr); - if( rc==SQLITE_OK ){ - pCsr->pCsr->pTokenizer = pTab->pTok; - } - } - } - - if( rc!=SQLITE_OK ) return rc; - return fts3tokNextMethod(pCursor); -} - -/* -** xEof - Return true if the cursor is at EOF, or false otherwise. -*/ -static int fts3tokEofMethod(sqlite3_vtab_cursor *pCursor){ - Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; - return (pCsr->zToken==0); -} - -/* -** xColumn - Return a column value. -*/ -static int fts3tokColumnMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite3_context *pCtx, /* Context for sqlite3_result_xxx() calls */ - int iCol /* Index of column to read value from */ -){ - Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; - - /* CREATE TABLE x(input, token, start, end, position) */ - switch( iCol ){ - case 0: - sqlite3_result_text(pCtx, pCsr->zInput, -1, SQLITE_TRANSIENT); - break; - case 1: - sqlite3_result_text(pCtx, pCsr->zToken, pCsr->nToken, SQLITE_TRANSIENT); - break; - case 2: - sqlite3_result_int(pCtx, pCsr->iStart); - break; - case 3: - sqlite3_result_int(pCtx, pCsr->iEnd); - break; - default: - assert( iCol==4 ); - sqlite3_result_int(pCtx, pCsr->iPos); - break; - } - return SQLITE_OK; -} - -/* -** xRowid - Return the current rowid for the cursor. -*/ -static int fts3tokRowidMethod( - sqlite3_vtab_cursor *pCursor, /* Cursor to retrieve value from */ - sqlite_int64 *pRowid /* OUT: Rowid value */ -){ - Fts3tokCursor *pCsr = (Fts3tokCursor *)pCursor; - *pRowid = (sqlite3_int64)pCsr->iRowid; - return SQLITE_OK; -} - -/* -** Register the fts3tok module with database connection db. Return SQLITE_OK -** if successful or an error code if sqlite3_create_module() fails. -*/ -SQLITE_PRIVATE int sqlite3Fts3InitTok(sqlite3 *db, Fts3Hash *pHash){ - static const sqlite3_module fts3tok_module = { - 0, /* iVersion */ - fts3tokConnectMethod, /* xCreate */ - fts3tokConnectMethod, /* xConnect */ - fts3tokBestIndexMethod, /* xBestIndex */ - fts3tokDisconnectMethod, /* xDisconnect */ - fts3tokDisconnectMethod, /* xDestroy */ - fts3tokOpenMethod, /* xOpen */ - fts3tokCloseMethod, /* xClose */ - fts3tokFilterMethod, /* xFilter */ - fts3tokNextMethod, /* xNext */ - fts3tokEofMethod, /* xEof */ - fts3tokColumnMethod, /* xColumn */ - fts3tokRowidMethod, /* xRowid */ - 0, /* xUpdate */ - 0, /* xBegin */ - 0, /* xSync */ - 0, /* xCommit */ - 0, /* xRollback */ - 0, /* xFindFunction */ - 0, /* xRename */ - 0, /* xSavepoint */ - 0, /* xRelease */ - 0 /* xRollbackTo */ - }; - int rc; /* Return code */ - - rc = sqlite3_create_module(db, "fts3tokenize", &fts3tok_module, (void*)pHash); - return rc; -} - -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ - -/************** End of fts3_tokenize_vtab.c **********************************/ -/************** Begin file fts3_write.c **************************************/ -/* -** 2009 Oct 23 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** This file is part of the SQLite FTS3 extension module. Specifically, -** this file contains code to insert, update and delete rows from FTS3 -** tables. It also contains code to merge FTS3 b-tree segments. Some -** of the sub-routines used to merge segments are also used by the query -** code in fts3.c. -*/ - -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ -/* #include */ - - -#define FTS_MAX_APPENDABLE_HEIGHT 16 - -/* -** When full-text index nodes are loaded from disk, the buffer that they -** are loaded into has the following number of bytes of padding at the end -** of it. i.e. if a full-text index node is 900 bytes in size, then a buffer -** of 920 bytes is allocated for it. -** -** This means that if we have a pointer into a buffer containing node data, -** it is always safe to read up to two varints from it without risking an -** overread, even if the node data is corrupted. -*/ -#define FTS3_NODE_PADDING (FTS3_VARINT_MAX*2) - -/* -** Under certain circumstances, b-tree nodes (doclists) can be loaded into -** memory incrementally instead of all at once. This can be a big performance -** win (reduced IO and CPU) if SQLite stops calling the virtual table xNext() -** method before retrieving all query results (as may happen, for example, -** if a query has a LIMIT clause). -** -** Incremental loading is used for b-tree nodes FTS3_NODE_CHUNK_THRESHOLD -** bytes and larger. Nodes are loaded in chunks of FTS3_NODE_CHUNKSIZE bytes. -** The code is written so that the hard lower-limit for each of these values -** is 1. Clearly such small values would be inefficient, but can be useful -** for testing purposes. -** -** If this module is built with SQLITE_TEST defined, these constants may -** be overridden at runtime for testing purposes. File fts3_test.c contains -** a Tcl interface to read and write the values. -*/ -#ifdef SQLITE_TEST -int test_fts3_node_chunksize = (4*1024); -int test_fts3_node_chunk_threshold = (4*1024)*4; -# define FTS3_NODE_CHUNKSIZE test_fts3_node_chunksize -# define FTS3_NODE_CHUNK_THRESHOLD test_fts3_node_chunk_threshold -#else -# define FTS3_NODE_CHUNKSIZE (4*1024) -# define FTS3_NODE_CHUNK_THRESHOLD (FTS3_NODE_CHUNKSIZE*4) -#endif - -/* -** The two values that may be meaningfully bound to the :1 parameter in -** statements SQL_REPLACE_STAT and SQL_SELECT_STAT. -*/ -#define FTS_STAT_DOCTOTAL 0 -#define FTS_STAT_INCRMERGEHINT 1 -#define FTS_STAT_AUTOINCRMERGE 2 - -/* -** If FTS_LOG_MERGES is defined, call sqlite3_log() to report each automatic -** and incremental merge operation that takes place. This is used for -** debugging FTS only, it should not usually be turned on in production -** systems. -*/ -#ifdef FTS3_LOG_MERGES -static void fts3LogMerge(int nMerge, sqlite3_int64 iAbsLevel){ - sqlite3_log(SQLITE_OK, "%d-way merge from level %d", nMerge, (int)iAbsLevel); -} -#else -#define fts3LogMerge(x, y) -#endif - - -typedef struct PendingList PendingList; -typedef struct SegmentNode SegmentNode; -typedef struct SegmentWriter SegmentWriter; - -/* -** An instance of the following data structure is used to build doclists -** incrementally. See function fts3PendingListAppend() for details. -*/ -struct PendingList { - int nData; - char *aData; - int nSpace; - sqlite3_int64 iLastDocid; - sqlite3_int64 iLastCol; - sqlite3_int64 iLastPos; -}; - - -/* -** Each cursor has a (possibly empty) linked list of the following objects. -*/ -struct Fts3DeferredToken { - Fts3PhraseToken *pToken; /* Pointer to corresponding expr token */ - int iCol; /* Column token must occur in */ - Fts3DeferredToken *pNext; /* Next in list of deferred tokens */ - PendingList *pList; /* Doclist is assembled here */ -}; - -/* -** An instance of this structure is used to iterate through the terms on -** a contiguous set of segment b-tree leaf nodes. Although the details of -** this structure are only manipulated by code in this file, opaque handles -** of type Fts3SegReader* are also used by code in fts3.c to iterate through -** terms when querying the full-text index. See functions: -** -** sqlite3Fts3SegReaderNew() -** sqlite3Fts3SegReaderFree() -** sqlite3Fts3SegReaderIterate() -** -** Methods used to manipulate Fts3SegReader structures: -** -** fts3SegReaderNext() -** fts3SegReaderFirstDocid() -** fts3SegReaderNextDocid() -*/ -struct Fts3SegReader { - int iIdx; /* Index within level, or 0x7FFFFFFF for PT */ - u8 bLookup; /* True for a lookup only */ - u8 rootOnly; /* True for a root-only reader */ - - sqlite3_int64 iStartBlock; /* Rowid of first leaf block to traverse */ - sqlite3_int64 iLeafEndBlock; /* Rowid of final leaf block to traverse */ - sqlite3_int64 iEndBlock; /* Rowid of final block in segment (or 0) */ - sqlite3_int64 iCurrentBlock; /* Current leaf block (or 0) */ - - char *aNode; /* Pointer to node data (or NULL) */ - int nNode; /* Size of buffer at aNode (or 0) */ - int nPopulate; /* If >0, bytes of buffer aNode[] loaded */ - sqlite3_blob *pBlob; /* If not NULL, blob handle to read node */ - - Fts3HashElem **ppNextElem; - - /* Variables set by fts3SegReaderNext(). These may be read directly - ** by the caller. They are valid from the time SegmentReaderNew() returns - ** until SegmentReaderNext() returns something other than SQLITE_OK - ** (i.e. SQLITE_DONE). - */ - int nTerm; /* Number of bytes in current term */ - char *zTerm; /* Pointer to current term */ - int nTermAlloc; /* Allocated size of zTerm buffer */ - char *aDoclist; /* Pointer to doclist of current entry */ - int nDoclist; /* Size of doclist in current entry */ - - /* The following variables are used by fts3SegReaderNextDocid() to iterate - ** through the current doclist (aDoclist/nDoclist). - */ - char *pOffsetList; - int nOffsetList; /* For descending pending seg-readers only */ - sqlite3_int64 iDocid; -}; - -#define fts3SegReaderIsPending(p) ((p)->ppNextElem!=0) -#define fts3SegReaderIsRootOnly(p) ((p)->rootOnly!=0) - -/* -** An instance of this structure is used to create a segment b-tree in the -** database. The internal details of this type are only accessed by the -** following functions: -** -** fts3SegWriterAdd() -** fts3SegWriterFlush() -** fts3SegWriterFree() -*/ -struct SegmentWriter { - SegmentNode *pTree; /* Pointer to interior tree structure */ - sqlite3_int64 iFirst; /* First slot in %_segments written */ - sqlite3_int64 iFree; /* Next free slot in %_segments */ - char *zTerm; /* Pointer to previous term buffer */ - int nTerm; /* Number of bytes in zTerm */ - int nMalloc; /* Size of malloc'd buffer at zMalloc */ - char *zMalloc; /* Malloc'd space (possibly) used for zTerm */ - int nSize; /* Size of allocation at aData */ - int nData; /* Bytes of data in aData */ - char *aData; /* Pointer to block from malloc() */ -}; - -/* -** Type SegmentNode is used by the following three functions to create -** the interior part of the segment b+-tree structures (everything except -** the leaf nodes). These functions and type are only ever used by code -** within the fts3SegWriterXXX() family of functions described above. -** -** fts3NodeAddTerm() -** fts3NodeWrite() -** fts3NodeFree() -** -** When a b+tree is written to the database (either as a result of a merge -** or the pending-terms table being flushed), leaves are written into the -** database file as soon as they are completely populated. The interior of -** the tree is assembled in memory and written out only once all leaves have -** been populated and stored. This is Ok, as the b+-tree fanout is usually -** very large, meaning that the interior of the tree consumes relatively -** little memory. -*/ -struct SegmentNode { - SegmentNode *pParent; /* Parent node (or NULL for root node) */ - SegmentNode *pRight; /* Pointer to right-sibling */ - SegmentNode *pLeftmost; /* Pointer to left-most node of this depth */ - int nEntry; /* Number of terms written to node so far */ - char *zTerm; /* Pointer to previous term buffer */ - int nTerm; /* Number of bytes in zTerm */ - int nMalloc; /* Size of malloc'd buffer at zMalloc */ - char *zMalloc; /* Malloc'd space (possibly) used for zTerm */ - int nData; /* Bytes of valid data so far */ - char *aData; /* Node data */ -}; - -/* -** Valid values for the second argument to fts3SqlStmt(). -*/ -#define SQL_DELETE_CONTENT 0 -#define SQL_IS_EMPTY 1 -#define SQL_DELETE_ALL_CONTENT 2 -#define SQL_DELETE_ALL_SEGMENTS 3 -#define SQL_DELETE_ALL_SEGDIR 4 -#define SQL_DELETE_ALL_DOCSIZE 5 -#define SQL_DELETE_ALL_STAT 6 -#define SQL_SELECT_CONTENT_BY_ROWID 7 -#define SQL_NEXT_SEGMENT_INDEX 8 -#define SQL_INSERT_SEGMENTS 9 -#define SQL_NEXT_SEGMENTS_ID 10 -#define SQL_INSERT_SEGDIR 11 -#define SQL_SELECT_LEVEL 12 -#define SQL_SELECT_LEVEL_RANGE 13 -#define SQL_SELECT_LEVEL_COUNT 14 -#define SQL_SELECT_SEGDIR_MAX_LEVEL 15 -#define SQL_DELETE_SEGDIR_LEVEL 16 -#define SQL_DELETE_SEGMENTS_RANGE 17 -#define SQL_CONTENT_INSERT 18 -#define SQL_DELETE_DOCSIZE 19 -#define SQL_REPLACE_DOCSIZE 20 -#define SQL_SELECT_DOCSIZE 21 -#define SQL_SELECT_STAT 22 -#define SQL_REPLACE_STAT 23 - -#define SQL_SELECT_ALL_PREFIX_LEVEL 24 -#define SQL_DELETE_ALL_TERMS_SEGDIR 25 -#define SQL_DELETE_SEGDIR_RANGE 26 -#define SQL_SELECT_ALL_LANGID 27 -#define SQL_FIND_MERGE_LEVEL 28 -#define SQL_MAX_LEAF_NODE_ESTIMATE 29 -#define SQL_DELETE_SEGDIR_ENTRY 30 -#define SQL_SHIFT_SEGDIR_ENTRY 31 -#define SQL_SELECT_SEGDIR 32 -#define SQL_CHOMP_SEGDIR 33 -#define SQL_SEGMENT_IS_APPENDABLE 34 -#define SQL_SELECT_INDEXES 35 -#define SQL_SELECT_MXLEVEL 36 - -/* -** This function is used to obtain an SQLite prepared statement handle -** for the statement identified by the second argument. If successful, -** *pp is set to the requested statement handle and SQLITE_OK returned. -** Otherwise, an SQLite error code is returned and *pp is set to 0. -** -** If argument apVal is not NULL, then it must point to an array with -** at least as many entries as the requested statement has bound -** parameters. The values are bound to the statements parameters before -** returning. -*/ -static int fts3SqlStmt( - Fts3Table *p, /* Virtual table handle */ - int eStmt, /* One of the SQL_XXX constants above */ - sqlite3_stmt **pp, /* OUT: Statement handle */ - sqlite3_value **apVal /* Values to bind to statement */ -){ - const char *azSql[] = { -/* 0 */ "DELETE FROM %Q.'%q_content' WHERE rowid = ?", -/* 1 */ "SELECT NOT EXISTS(SELECT docid FROM %Q.'%q_content' WHERE rowid!=?)", -/* 2 */ "DELETE FROM %Q.'%q_content'", -/* 3 */ "DELETE FROM %Q.'%q_segments'", -/* 4 */ "DELETE FROM %Q.'%q_segdir'", -/* 5 */ "DELETE FROM %Q.'%q_docsize'", -/* 6 */ "DELETE FROM %Q.'%q_stat'", -/* 7 */ "SELECT %s WHERE rowid=?", -/* 8 */ "SELECT (SELECT max(idx) FROM %Q.'%q_segdir' WHERE level = ?) + 1", -/* 9 */ "REPLACE INTO %Q.'%q_segments'(blockid, block) VALUES(?, ?)", -/* 10 */ "SELECT coalesce((SELECT max(blockid) FROM %Q.'%q_segments') + 1, 1)", -/* 11 */ "REPLACE INTO %Q.'%q_segdir' VALUES(?,?,?,?,?,?)", - - /* Return segments in order from oldest to newest.*/ -/* 12 */ "SELECT idx, start_block, leaves_end_block, end_block, root " - "FROM %Q.'%q_segdir' WHERE level = ? ORDER BY idx ASC", -/* 13 */ "SELECT idx, start_block, leaves_end_block, end_block, root " - "FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?" - "ORDER BY level DESC, idx ASC", - -/* 14 */ "SELECT count(*) FROM %Q.'%q_segdir' WHERE level = ?", -/* 15 */ "SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?", - -/* 16 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ?", -/* 17 */ "DELETE FROM %Q.'%q_segments' WHERE blockid BETWEEN ? AND ?", -/* 18 */ "INSERT INTO %Q.'%q_content' VALUES(%s)", -/* 19 */ "DELETE FROM %Q.'%q_docsize' WHERE docid = ?", -/* 20 */ "REPLACE INTO %Q.'%q_docsize' VALUES(?,?)", -/* 21 */ "SELECT size FROM %Q.'%q_docsize' WHERE docid=?", -/* 22 */ "SELECT value FROM %Q.'%q_stat' WHERE id=?", -/* 23 */ "REPLACE INTO %Q.'%q_stat' VALUES(?,?)", -/* 24 */ "", -/* 25 */ "", - -/* 26 */ "DELETE FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ?", -/* 27 */ "SELECT DISTINCT level / (1024 * ?) FROM %Q.'%q_segdir'", - -/* This statement is used to determine which level to read the input from -** when performing an incremental merge. It returns the absolute level number -** of the oldest level in the db that contains at least ? segments. Or, -** if no level in the FTS index contains more than ? segments, the statement -** returns zero rows. */ -/* 28 */ "SELECT level FROM %Q.'%q_segdir' GROUP BY level HAVING count(*)>=?" - " ORDER BY (level %% 1024) ASC LIMIT 1", - -/* Estimate the upper limit on the number of leaf nodes in a new segment -** created by merging the oldest :2 segments from absolute level :1. See -** function sqlite3Fts3Incrmerge() for details. */ -/* 29 */ "SELECT 2 * total(1 + leaves_end_block - start_block) " - " FROM %Q.'%q_segdir' WHERE level = ? AND idx < ?", - -/* SQL_DELETE_SEGDIR_ENTRY -** Delete the %_segdir entry on absolute level :1 with index :2. */ -/* 30 */ "DELETE FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?", - -/* SQL_SHIFT_SEGDIR_ENTRY -** Modify the idx value for the segment with idx=:3 on absolute level :2 -** to :1. */ -/* 31 */ "UPDATE %Q.'%q_segdir' SET idx = ? WHERE level=? AND idx=?", - -/* SQL_SELECT_SEGDIR -** Read a single entry from the %_segdir table. The entry from absolute -** level :1 with index value :2. */ -/* 32 */ "SELECT idx, start_block, leaves_end_block, end_block, root " - "FROM %Q.'%q_segdir' WHERE level = ? AND idx = ?", - -/* SQL_CHOMP_SEGDIR -** Update the start_block (:1) and root (:2) fields of the %_segdir -** entry located on absolute level :3 with index :4. */ -/* 33 */ "UPDATE %Q.'%q_segdir' SET start_block = ?, root = ?" - "WHERE level = ? AND idx = ?", - -/* SQL_SEGMENT_IS_APPENDABLE -** Return a single row if the segment with end_block=? is appendable. Or -** no rows otherwise. */ -/* 34 */ "SELECT 1 FROM %Q.'%q_segments' WHERE blockid=? AND block IS NULL", - -/* SQL_SELECT_INDEXES -** Return the list of valid segment indexes for absolute level ? */ -/* 35 */ "SELECT idx FROM %Q.'%q_segdir' WHERE level=? ORDER BY 1 ASC", - -/* SQL_SELECT_MXLEVEL -** Return the largest relative level in the FTS index or indexes. */ -/* 36 */ "SELECT max( level %% 1024 ) FROM %Q.'%q_segdir'" - }; - int rc = SQLITE_OK; - sqlite3_stmt *pStmt; - - assert( SizeofArray(azSql)==SizeofArray(p->aStmt) ); - assert( eStmt=0 ); - - pStmt = p->aStmt[eStmt]; - if( !pStmt ){ - char *zSql; - if( eStmt==SQL_CONTENT_INSERT ){ - zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName, p->zWriteExprlist); - }else if( eStmt==SQL_SELECT_CONTENT_BY_ROWID ){ - zSql = sqlite3_mprintf(azSql[eStmt], p->zReadExprlist); - }else{ - zSql = sqlite3_mprintf(azSql[eStmt], p->zDb, p->zName); - } - if( !zSql ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, NULL); - sqlite3_free(zSql); - assert( rc==SQLITE_OK || pStmt==0 ); - p->aStmt[eStmt] = pStmt; - } - } - if( apVal ){ - int i; - int nParam = sqlite3_bind_parameter_count(pStmt); - for(i=0; rc==SQLITE_OK && inPendingData==0 ){ - sqlite3_stmt *pStmt; - rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pStmt, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_null(pStmt, 1); - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); - } - } - - return rc; -} - -/* -** FTS maintains a separate indexes for each language-id (a 32-bit integer). -** Within each language id, a separate index is maintained to store the -** document terms, and each configured prefix size (configured the FTS -** "prefix=" option). And each index consists of multiple levels ("relative -** levels"). -** -** All three of these values (the language id, the specific index and the -** level within the index) are encoded in 64-bit integer values stored -** in the %_segdir table on disk. This function is used to convert three -** separate component values into the single 64-bit integer value that -** can be used to query the %_segdir table. -** -** Specifically, each language-id/index combination is allocated 1024 -** 64-bit integer level values ("absolute levels"). The main terms index -** for language-id 0 is allocate values 0-1023. The first prefix index -** (if any) for language-id 0 is allocated values 1024-2047. And so on. -** Language 1 indexes are allocated immediately following language 0. -** -** So, for a system with nPrefix prefix indexes configured, the block of -** absolute levels that corresponds to language-id iLangid and index -** iIndex starts at absolute level ((iLangid * (nPrefix+1) + iIndex) * 1024). -*/ -static sqlite3_int64 getAbsoluteLevel( - Fts3Table *p, /* FTS3 table handle */ - int iLangid, /* Language id */ - int iIndex, /* Index in p->aIndex[] */ - int iLevel /* Level of segments */ -){ - sqlite3_int64 iBase; /* First absolute level for iLangid/iIndex */ - assert( iLangid>=0 ); - assert( p->nIndex>0 ); - assert( iIndex>=0 && iIndexnIndex ); - - iBase = ((sqlite3_int64)iLangid * p->nIndex + iIndex) * FTS3_SEGDIR_MAXLEVEL; - return iBase + iLevel; -} - -/* -** Set *ppStmt to a statement handle that may be used to iterate through -** all rows in the %_segdir table, from oldest to newest. If successful, -** return SQLITE_OK. If an error occurs while preparing the statement, -** return an SQLite error code. -** -** There is only ever one instance of this SQL statement compiled for -** each FTS3 table. -** -** The statement returns the following columns from the %_segdir table: -** -** 0: idx -** 1: start_block -** 2: leaves_end_block -** 3: end_block -** 4: root -*/ -SQLITE_PRIVATE int sqlite3Fts3AllSegdirs( - Fts3Table *p, /* FTS3 table */ - int iLangid, /* Language being queried */ - int iIndex, /* Index for p->aIndex[] */ - int iLevel, /* Level to select (relative level) */ - sqlite3_stmt **ppStmt /* OUT: Compiled statement */ -){ - int rc; - sqlite3_stmt *pStmt = 0; - - assert( iLevel==FTS3_SEGCURSOR_ALL || iLevel>=0 ); - assert( iLevel=0 && iIndexnIndex ); - - if( iLevel<0 ){ - /* "SELECT * FROM %_segdir WHERE level BETWEEN ? AND ? ORDER BY ..." */ - rc = fts3SqlStmt(p, SQL_SELECT_LEVEL_RANGE, &pStmt, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); - sqlite3_bind_int64(pStmt, 2, - getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) - ); - } - }else{ - /* "SELECT * FROM %_segdir WHERE level = ? ORDER BY ..." */ - rc = fts3SqlStmt(p, SQL_SELECT_LEVEL, &pStmt, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex,iLevel)); - } - } - *ppStmt = pStmt; - return rc; -} - - -/* -** Append a single varint to a PendingList buffer. SQLITE_OK is returned -** if successful, or an SQLite error code otherwise. -** -** This function also serves to allocate the PendingList structure itself. -** For example, to create a new PendingList structure containing two -** varints: -** -** PendingList *p = 0; -** fts3PendingListAppendVarint(&p, 1); -** fts3PendingListAppendVarint(&p, 2); -*/ -static int fts3PendingListAppendVarint( - PendingList **pp, /* IN/OUT: Pointer to PendingList struct */ - sqlite3_int64 i /* Value to append to data */ -){ - PendingList *p = *pp; - - /* Allocate or grow the PendingList as required. */ - if( !p ){ - p = sqlite3_malloc(sizeof(*p) + 100); - if( !p ){ - return SQLITE_NOMEM; - } - p->nSpace = 100; - p->aData = (char *)&p[1]; - p->nData = 0; - } - else if( p->nData+FTS3_VARINT_MAX+1>p->nSpace ){ - int nNew = p->nSpace * 2; - p = sqlite3_realloc(p, sizeof(*p) + nNew); - if( !p ){ - sqlite3_free(*pp); - *pp = 0; - return SQLITE_NOMEM; - } - p->nSpace = nNew; - p->aData = (char *)&p[1]; - } - - /* Append the new serialized varint to the end of the list. */ - p->nData += sqlite3Fts3PutVarint(&p->aData[p->nData], i); - p->aData[p->nData] = '\0'; - *pp = p; - return SQLITE_OK; -} - -/* -** Add a docid/column/position entry to a PendingList structure. Non-zero -** is returned if the structure is sqlite3_realloced as part of adding -** the entry. Otherwise, zero. -** -** If an OOM error occurs, *pRc is set to SQLITE_NOMEM before returning. -** Zero is always returned in this case. Otherwise, if no OOM error occurs, -** it is set to SQLITE_OK. -*/ -static int fts3PendingListAppend( - PendingList **pp, /* IN/OUT: PendingList structure */ - sqlite3_int64 iDocid, /* Docid for entry to add */ - sqlite3_int64 iCol, /* Column for entry to add */ - sqlite3_int64 iPos, /* Position of term for entry to add */ - int *pRc /* OUT: Return code */ -){ - PendingList *p = *pp; - int rc = SQLITE_OK; - - assert( !p || p->iLastDocid<=iDocid ); - - if( !p || p->iLastDocid!=iDocid ){ - sqlite3_int64 iDelta = iDocid - (p ? p->iLastDocid : 0); - if( p ){ - assert( p->nDatanSpace ); - assert( p->aData[p->nData]==0 ); - p->nData++; - } - if( SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, iDelta)) ){ - goto pendinglistappend_out; - } - p->iLastCol = -1; - p->iLastPos = 0; - p->iLastDocid = iDocid; - } - if( iCol>0 && p->iLastCol!=iCol ){ - if( SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, 1)) - || SQLITE_OK!=(rc = fts3PendingListAppendVarint(&p, iCol)) - ){ - goto pendinglistappend_out; - } - p->iLastCol = iCol; - p->iLastPos = 0; - } - if( iCol>=0 ){ - assert( iPos>p->iLastPos || (iPos==0 && p->iLastPos==0) ); - rc = fts3PendingListAppendVarint(&p, 2+iPos-p->iLastPos); - if( rc==SQLITE_OK ){ - p->iLastPos = iPos; - } - } - - pendinglistappend_out: - *pRc = rc; - if( p!=*pp ){ - *pp = p; - return 1; - } - return 0; -} - -/* -** Free a PendingList object allocated by fts3PendingListAppend(). -*/ -static void fts3PendingListDelete(PendingList *pList){ - sqlite3_free(pList); -} - -/* -** Add an entry to one of the pending-terms hash tables. -*/ -static int fts3PendingTermsAddOne( - Fts3Table *p, - int iCol, - int iPos, - Fts3Hash *pHash, /* Pending terms hash table to add entry to */ - const char *zToken, - int nToken -){ - PendingList *pList; - int rc = SQLITE_OK; - - pList = (PendingList *)fts3HashFind(pHash, zToken, nToken); - if( pList ){ - p->nPendingData -= (pList->nData + nToken + sizeof(Fts3HashElem)); - } - if( fts3PendingListAppend(&pList, p->iPrevDocid, iCol, iPos, &rc) ){ - if( pList==fts3HashInsert(pHash, zToken, nToken, pList) ){ - /* Malloc failed while inserting the new entry. This can only - ** happen if there was no previous entry for this token. - */ - assert( 0==fts3HashFind(pHash, zToken, nToken) ); - sqlite3_free(pList); - rc = SQLITE_NOMEM; - } - } - if( rc==SQLITE_OK ){ - p->nPendingData += (pList->nData + nToken + sizeof(Fts3HashElem)); - } - return rc; -} - -/* -** Tokenize the nul-terminated string zText and add all tokens to the -** pending-terms hash-table. The docid used is that currently stored in -** p->iPrevDocid, and the column is specified by argument iCol. -** -** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. -*/ -static int fts3PendingTermsAdd( - Fts3Table *p, /* Table into which text will be inserted */ - int iLangid, /* Language id to use */ - const char *zText, /* Text of document to be inserted */ - int iCol, /* Column into which text is being inserted */ - u32 *pnWord /* IN/OUT: Incr. by number tokens inserted */ -){ - int rc; - int iStart = 0; - int iEnd = 0; - int iPos = 0; - int nWord = 0; - - char const *zToken; - int nToken = 0; - - sqlite3_tokenizer *pTokenizer = p->pTokenizer; - sqlite3_tokenizer_module const *pModule = pTokenizer->pModule; - sqlite3_tokenizer_cursor *pCsr; - int (*xNext)(sqlite3_tokenizer_cursor *pCursor, - const char**,int*,int*,int*,int*); - - assert( pTokenizer && pModule ); - - /* If the user has inserted a NULL value, this function may be called with - ** zText==0. In this case, add zero token entries to the hash table and - ** return early. */ - if( zText==0 ){ - *pnWord = 0; - return SQLITE_OK; - } - - rc = sqlite3Fts3OpenTokenizer(pTokenizer, iLangid, zText, -1, &pCsr); - if( rc!=SQLITE_OK ){ - return rc; - } - - xNext = pModule->xNext; - while( SQLITE_OK==rc - && SQLITE_OK==(rc = xNext(pCsr, &zToken, &nToken, &iStart, &iEnd, &iPos)) - ){ - int i; - if( iPos>=nWord ) nWord = iPos+1; - - /* Positions cannot be negative; we use -1 as a terminator internally. - ** Tokens must have a non-zero length. - */ - if( iPos<0 || !zToken || nToken<=0 ){ - rc = SQLITE_ERROR; - break; - } - - /* Add the term to the terms index */ - rc = fts3PendingTermsAddOne( - p, iCol, iPos, &p->aIndex[0].hPending, zToken, nToken - ); - - /* Add the term to each of the prefix indexes that it is not too - ** short for. */ - for(i=1; rc==SQLITE_OK && inIndex; i++){ - struct Fts3Index *pIndex = &p->aIndex[i]; - if( nTokennPrefix ) continue; - rc = fts3PendingTermsAddOne( - p, iCol, iPos, &pIndex->hPending, zToken, pIndex->nPrefix - ); - } - } - - pModule->xClose(pCsr); - *pnWord += nWord; - return (rc==SQLITE_DONE ? SQLITE_OK : rc); -} - -/* -** Calling this function indicates that subsequent calls to -** fts3PendingTermsAdd() are to add term/position-list pairs for the -** contents of the document with docid iDocid. -*/ -static int fts3PendingTermsDocid( - Fts3Table *p, /* Full-text table handle */ - int iLangid, /* Language id of row being written */ - sqlite_int64 iDocid /* Docid of row being written */ -){ - assert( iLangid>=0 ); - - /* TODO(shess) Explore whether partially flushing the buffer on - ** forced-flush would provide better performance. I suspect that if - ** we ordered the doclists by size and flushed the largest until the - ** buffer was half empty, that would let the less frequent terms - ** generate longer doclists. - */ - if( iDocid<=p->iPrevDocid - || p->iPrevLangid!=iLangid - || p->nPendingData>p->nMaxPendingData - ){ - int rc = sqlite3Fts3PendingTermsFlush(p); - if( rc!=SQLITE_OK ) return rc; - } - p->iPrevDocid = iDocid; - p->iPrevLangid = iLangid; - return SQLITE_OK; -} - -/* -** Discard the contents of the pending-terms hash tables. -*/ -SQLITE_PRIVATE void sqlite3Fts3PendingTermsClear(Fts3Table *p){ - int i; - for(i=0; inIndex; i++){ - Fts3HashElem *pElem; - Fts3Hash *pHash = &p->aIndex[i].hPending; - for(pElem=fts3HashFirst(pHash); pElem; pElem=fts3HashNext(pElem)){ - PendingList *pList = (PendingList *)fts3HashData(pElem); - fts3PendingListDelete(pList); - } - fts3HashClear(pHash); - } - p->nPendingData = 0; -} - -/* -** This function is called by the xUpdate() method as part of an INSERT -** operation. It adds entries for each term in the new record to the -** pendingTerms hash table. -** -** Argument apVal is the same as the similarly named argument passed to -** fts3InsertData(). Parameter iDocid is the docid of the new row. -*/ -static int fts3InsertTerms( - Fts3Table *p, - int iLangid, - sqlite3_value **apVal, - u32 *aSz -){ - int i; /* Iterator variable */ - for(i=2; inColumn+2; i++){ - int iCol = i-2; - if( p->abNotindexed[iCol]==0 ){ - const char *zText = (const char *)sqlite3_value_text(apVal[i]); - int rc = fts3PendingTermsAdd(p, iLangid, zText, iCol, &aSz[iCol]); - if( rc!=SQLITE_OK ){ - return rc; - } - aSz[p->nColumn] += sqlite3_value_bytes(apVal[i]); - } - } - return SQLITE_OK; -} - -/* -** This function is called by the xUpdate() method for an INSERT operation. -** The apVal parameter is passed a copy of the apVal argument passed by -** SQLite to the xUpdate() method. i.e: -** -** apVal[0] Not used for INSERT. -** apVal[1] rowid -** apVal[2] Left-most user-defined column -** ... -** apVal[p->nColumn+1] Right-most user-defined column -** apVal[p->nColumn+2] Hidden column with same name as table -** apVal[p->nColumn+3] Hidden "docid" column (alias for rowid) -** apVal[p->nColumn+4] Hidden languageid column -*/ -static int fts3InsertData( - Fts3Table *p, /* Full-text table */ - sqlite3_value **apVal, /* Array of values to insert */ - sqlite3_int64 *piDocid /* OUT: Docid for row just inserted */ -){ - int rc; /* Return code */ - sqlite3_stmt *pContentInsert; /* INSERT INTO %_content VALUES(...) */ - - if( p->zContentTbl ){ - sqlite3_value *pRowid = apVal[p->nColumn+3]; - if( sqlite3_value_type(pRowid)==SQLITE_NULL ){ - pRowid = apVal[1]; - } - if( sqlite3_value_type(pRowid)!=SQLITE_INTEGER ){ - return SQLITE_CONSTRAINT; - } - *piDocid = sqlite3_value_int64(pRowid); - return SQLITE_OK; - } - - /* Locate the statement handle used to insert data into the %_content - ** table. The SQL for this statement is: - ** - ** INSERT INTO %_content VALUES(?, ?, ?, ...) - ** - ** The statement features N '?' variables, where N is the number of user - ** defined columns in the FTS3 table, plus one for the docid field. - */ - rc = fts3SqlStmt(p, SQL_CONTENT_INSERT, &pContentInsert, &apVal[1]); - if( rc==SQLITE_OK && p->zLanguageid ){ - rc = sqlite3_bind_int( - pContentInsert, p->nColumn+2, - sqlite3_value_int(apVal[p->nColumn+4]) - ); - } - if( rc!=SQLITE_OK ) return rc; - - /* There is a quirk here. The users INSERT statement may have specified - ** a value for the "rowid" field, for the "docid" field, or for both. - ** Which is a problem, since "rowid" and "docid" are aliases for the - ** same value. For example: - ** - ** INSERT INTO fts3tbl(rowid, docid) VALUES(1, 2); - ** - ** In FTS3, this is an error. It is an error to specify non-NULL values - ** for both docid and some other rowid alias. - */ - if( SQLITE_NULL!=sqlite3_value_type(apVal[3+p->nColumn]) ){ - if( SQLITE_NULL==sqlite3_value_type(apVal[0]) - && SQLITE_NULL!=sqlite3_value_type(apVal[1]) - ){ - /* A rowid/docid conflict. */ - return SQLITE_ERROR; - } - rc = sqlite3_bind_value(pContentInsert, 1, apVal[3+p->nColumn]); - if( rc!=SQLITE_OK ) return rc; - } - - /* Execute the statement to insert the record. Set *piDocid to the - ** new docid value. - */ - sqlite3_step(pContentInsert); - rc = sqlite3_reset(pContentInsert); - - *piDocid = sqlite3_last_insert_rowid(p->db); - return rc; -} - - - -/* -** Remove all data from the FTS3 table. Clear the hash table containing -** pending terms. -*/ -static int fts3DeleteAll(Fts3Table *p, int bContent){ - int rc = SQLITE_OK; /* Return code */ - - /* Discard the contents of the pending-terms hash table. */ - sqlite3Fts3PendingTermsClear(p); - - /* Delete everything from the shadow tables. Except, leave %_content as - ** is if bContent is false. */ - assert( p->zContentTbl==0 || bContent==0 ); - if( bContent ) fts3SqlExec(&rc, p, SQL_DELETE_ALL_CONTENT, 0); - fts3SqlExec(&rc, p, SQL_DELETE_ALL_SEGMENTS, 0); - fts3SqlExec(&rc, p, SQL_DELETE_ALL_SEGDIR, 0); - if( p->bHasDocsize ){ - fts3SqlExec(&rc, p, SQL_DELETE_ALL_DOCSIZE, 0); - } - if( p->bHasStat ){ - fts3SqlExec(&rc, p, SQL_DELETE_ALL_STAT, 0); - } - return rc; -} - -/* -** -*/ -static int langidFromSelect(Fts3Table *p, sqlite3_stmt *pSelect){ - int iLangid = 0; - if( p->zLanguageid ) iLangid = sqlite3_column_int(pSelect, p->nColumn+1); - return iLangid; -} - -/* -** The first element in the apVal[] array is assumed to contain the docid -** (an integer) of a row about to be deleted. Remove all terms from the -** full-text index. -*/ -static void fts3DeleteTerms( - int *pRC, /* Result code */ - Fts3Table *p, /* The FTS table to delete from */ - sqlite3_value *pRowid, /* The docid to be deleted */ - u32 *aSz, /* Sizes of deleted document written here */ - int *pbFound /* OUT: Set to true if row really does exist */ -){ - int rc; - sqlite3_stmt *pSelect; - - assert( *pbFound==0 ); - if( *pRC ) return; - rc = fts3SqlStmt(p, SQL_SELECT_CONTENT_BY_ROWID, &pSelect, &pRowid); - if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pSelect) ){ - int i; - int iLangid = langidFromSelect(p, pSelect); - rc = fts3PendingTermsDocid(p, iLangid, sqlite3_column_int64(pSelect, 0)); - for(i=1; rc==SQLITE_OK && i<=p->nColumn; i++){ - int iCol = i-1; - if( p->abNotindexed[iCol]==0 ){ - const char *zText = (const char *)sqlite3_column_text(pSelect, i); - rc = fts3PendingTermsAdd(p, iLangid, zText, -1, &aSz[iCol]); - aSz[p->nColumn] += sqlite3_column_bytes(pSelect, i); - } - } - if( rc!=SQLITE_OK ){ - sqlite3_reset(pSelect); - *pRC = rc; - return; - } - *pbFound = 1; - } - rc = sqlite3_reset(pSelect); - }else{ - sqlite3_reset(pSelect); - } - *pRC = rc; -} - -/* -** Forward declaration to account for the circular dependency between -** functions fts3SegmentMerge() and fts3AllocateSegdirIdx(). -*/ -static int fts3SegmentMerge(Fts3Table *, int, int, int); - -/* -** This function allocates a new level iLevel index in the segdir table. -** Usually, indexes are allocated within a level sequentially starting -** with 0, so the allocated index is one greater than the value returned -** by: -** -** SELECT max(idx) FROM %_segdir WHERE level = :iLevel -** -** However, if there are already FTS3_MERGE_COUNT indexes at the requested -** level, they are merged into a single level (iLevel+1) segment and the -** allocated index is 0. -** -** If successful, *piIdx is set to the allocated index slot and SQLITE_OK -** returned. Otherwise, an SQLite error code is returned. -*/ -static int fts3AllocateSegdirIdx( - Fts3Table *p, - int iLangid, /* Language id */ - int iIndex, /* Index for p->aIndex */ - int iLevel, - int *piIdx -){ - int rc; /* Return Code */ - sqlite3_stmt *pNextIdx; /* Query for next idx at level iLevel */ - int iNext = 0; /* Result of query pNextIdx */ - - assert( iLangid>=0 ); - assert( p->nIndex>=1 ); - - /* Set variable iNext to the next available segdir index at level iLevel. */ - rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pNextIdx, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64( - pNextIdx, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel) - ); - if( SQLITE_ROW==sqlite3_step(pNextIdx) ){ - iNext = sqlite3_column_int(pNextIdx, 0); - } - rc = sqlite3_reset(pNextIdx); - } - - if( rc==SQLITE_OK ){ - /* If iNext is FTS3_MERGE_COUNT, indicating that level iLevel is already - ** full, merge all segments in level iLevel into a single iLevel+1 - ** segment and allocate (newly freed) index 0 at level iLevel. Otherwise, - ** if iNext is less than FTS3_MERGE_COUNT, allocate index iNext. - */ - if( iNext>=FTS3_MERGE_COUNT ){ - fts3LogMerge(16, getAbsoluteLevel(p, iLangid, iIndex, iLevel)); - rc = fts3SegmentMerge(p, iLangid, iIndex, iLevel); - *piIdx = 0; - }else{ - *piIdx = iNext; - } - } - - return rc; -} - -/* -** The %_segments table is declared as follows: -** -** CREATE TABLE %_segments(blockid INTEGER PRIMARY KEY, block BLOB) -** -** This function reads data from a single row of the %_segments table. The -** specific row is identified by the iBlockid parameter. If paBlob is not -** NULL, then a buffer is allocated using sqlite3_malloc() and populated -** with the contents of the blob stored in the "block" column of the -** identified table row is. Whether or not paBlob is NULL, *pnBlob is set -** to the size of the blob in bytes before returning. -** -** If an error occurs, or the table does not contain the specified row, -** an SQLite error code is returned. Otherwise, SQLITE_OK is returned. If -** paBlob is non-NULL, then it is the responsibility of the caller to -** eventually free the returned buffer. -** -** This function may leave an open sqlite3_blob* handle in the -** Fts3Table.pSegments variable. This handle is reused by subsequent calls -** to this function. The handle may be closed by calling the -** sqlite3Fts3SegmentsClose() function. Reusing a blob handle is a handy -** performance improvement, but the blob handle should always be closed -** before control is returned to the user (to prevent a lock being held -** on the database file for longer than necessary). Thus, any virtual table -** method (xFilter etc.) that may directly or indirectly call this function -** must call sqlite3Fts3SegmentsClose() before returning. -*/ -SQLITE_PRIVATE int sqlite3Fts3ReadBlock( - Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iBlockid, /* Access the row with blockid=$iBlockid */ - char **paBlob, /* OUT: Blob data in malloc'd buffer */ - int *pnBlob, /* OUT: Size of blob data */ - int *pnLoad /* OUT: Bytes actually loaded */ -){ - int rc; /* Return code */ - - /* pnBlob must be non-NULL. paBlob may be NULL or non-NULL. */ - assert( pnBlob ); - - if( p->pSegments ){ - rc = sqlite3_blob_reopen(p->pSegments, iBlockid); - }else{ - if( 0==p->zSegmentsTbl ){ - p->zSegmentsTbl = sqlite3_mprintf("%s_segments", p->zName); - if( 0==p->zSegmentsTbl ) return SQLITE_NOMEM; - } - rc = sqlite3_blob_open( - p->db, p->zDb, p->zSegmentsTbl, "block", iBlockid, 0, &p->pSegments - ); - } - - if( rc==SQLITE_OK ){ - int nByte = sqlite3_blob_bytes(p->pSegments); - *pnBlob = nByte; - if( paBlob ){ - char *aByte = sqlite3_malloc(nByte + FTS3_NODE_PADDING); - if( !aByte ){ - rc = SQLITE_NOMEM; - }else{ - if( pnLoad && nByte>(FTS3_NODE_CHUNK_THRESHOLD) ){ - nByte = FTS3_NODE_CHUNKSIZE; - *pnLoad = nByte; - } - rc = sqlite3_blob_read(p->pSegments, aByte, nByte, 0); - memset(&aByte[nByte], 0, FTS3_NODE_PADDING); - if( rc!=SQLITE_OK ){ - sqlite3_free(aByte); - aByte = 0; - } - } - *paBlob = aByte; - } - } - - return rc; -} - -/* -** Close the blob handle at p->pSegments, if it is open. See comments above -** the sqlite3Fts3ReadBlock() function for details. -*/ -SQLITE_PRIVATE void sqlite3Fts3SegmentsClose(Fts3Table *p){ - sqlite3_blob_close(p->pSegments); - p->pSegments = 0; -} - -static int fts3SegReaderIncrRead(Fts3SegReader *pReader){ - int nRead; /* Number of bytes to read */ - int rc; /* Return code */ - - nRead = MIN(pReader->nNode - pReader->nPopulate, FTS3_NODE_CHUNKSIZE); - rc = sqlite3_blob_read( - pReader->pBlob, - &pReader->aNode[pReader->nPopulate], - nRead, - pReader->nPopulate - ); - - if( rc==SQLITE_OK ){ - pReader->nPopulate += nRead; - memset(&pReader->aNode[pReader->nPopulate], 0, FTS3_NODE_PADDING); - if( pReader->nPopulate==pReader->nNode ){ - sqlite3_blob_close(pReader->pBlob); - pReader->pBlob = 0; - pReader->nPopulate = 0; - } - } - return rc; -} - -static int fts3SegReaderRequire(Fts3SegReader *pReader, char *pFrom, int nByte){ - int rc = SQLITE_OK; - assert( !pReader->pBlob - || (pFrom>=pReader->aNode && pFrom<&pReader->aNode[pReader->nNode]) - ); - while( pReader->pBlob && rc==SQLITE_OK - && (pFrom - pReader->aNode + nByte)>pReader->nPopulate - ){ - rc = fts3SegReaderIncrRead(pReader); - } - return rc; -} - -/* -** Set an Fts3SegReader cursor to point at EOF. -*/ -static void fts3SegReaderSetEof(Fts3SegReader *pSeg){ - if( !fts3SegReaderIsRootOnly(pSeg) ){ - sqlite3_free(pSeg->aNode); - sqlite3_blob_close(pSeg->pBlob); - pSeg->pBlob = 0; - } - pSeg->aNode = 0; -} - -/* -** Move the iterator passed as the first argument to the next term in the -** segment. If successful, SQLITE_OK is returned. If there is no next term, -** SQLITE_DONE. Otherwise, an SQLite error code. -*/ -static int fts3SegReaderNext( - Fts3Table *p, - Fts3SegReader *pReader, - int bIncr -){ - int rc; /* Return code of various sub-routines */ - char *pNext; /* Cursor variable */ - int nPrefix; /* Number of bytes in term prefix */ - int nSuffix; /* Number of bytes in term suffix */ - - if( !pReader->aDoclist ){ - pNext = pReader->aNode; - }else{ - pNext = &pReader->aDoclist[pReader->nDoclist]; - } - - if( !pNext || pNext>=&pReader->aNode[pReader->nNode] ){ - - if( fts3SegReaderIsPending(pReader) ){ - Fts3HashElem *pElem = *(pReader->ppNextElem); - if( pElem==0 ){ - pReader->aNode = 0; - }else{ - PendingList *pList = (PendingList *)fts3HashData(pElem); - pReader->zTerm = (char *)fts3HashKey(pElem); - pReader->nTerm = fts3HashKeysize(pElem); - pReader->nNode = pReader->nDoclist = pList->nData + 1; - pReader->aNode = pReader->aDoclist = pList->aData; - pReader->ppNextElem++; - assert( pReader->aNode ); - } - return SQLITE_OK; - } - - fts3SegReaderSetEof(pReader); - - /* If iCurrentBlock>=iLeafEndBlock, this is an EOF condition. All leaf - ** blocks have already been traversed. */ - assert( pReader->iCurrentBlock<=pReader->iLeafEndBlock ); - if( pReader->iCurrentBlock>=pReader->iLeafEndBlock ){ - return SQLITE_OK; - } - - rc = sqlite3Fts3ReadBlock( - p, ++pReader->iCurrentBlock, &pReader->aNode, &pReader->nNode, - (bIncr ? &pReader->nPopulate : 0) - ); - if( rc!=SQLITE_OK ) return rc; - assert( pReader->pBlob==0 ); - if( bIncr && pReader->nPopulatenNode ){ - pReader->pBlob = p->pSegments; - p->pSegments = 0; - } - pNext = pReader->aNode; - } - - assert( !fts3SegReaderIsPending(pReader) ); - - rc = fts3SegReaderRequire(pReader, pNext, FTS3_VARINT_MAX*2); - if( rc!=SQLITE_OK ) return rc; - - /* Because of the FTS3_NODE_PADDING bytes of padding, the following is - ** safe (no risk of overread) even if the node data is corrupted. */ - pNext += fts3GetVarint32(pNext, &nPrefix); - pNext += fts3GetVarint32(pNext, &nSuffix); - if( nPrefix<0 || nSuffix<=0 - || &pNext[nSuffix]>&pReader->aNode[pReader->nNode] - ){ - return FTS_CORRUPT_VTAB; - } - - if( nPrefix+nSuffix>pReader->nTermAlloc ){ - int nNew = (nPrefix+nSuffix)*2; - char *zNew = sqlite3_realloc(pReader->zTerm, nNew); - if( !zNew ){ - return SQLITE_NOMEM; - } - pReader->zTerm = zNew; - pReader->nTermAlloc = nNew; - } - - rc = fts3SegReaderRequire(pReader, pNext, nSuffix+FTS3_VARINT_MAX); - if( rc!=SQLITE_OK ) return rc; - - memcpy(&pReader->zTerm[nPrefix], pNext, nSuffix); - pReader->nTerm = nPrefix+nSuffix; - pNext += nSuffix; - pNext += fts3GetVarint32(pNext, &pReader->nDoclist); - pReader->aDoclist = pNext; - pReader->pOffsetList = 0; - - /* Check that the doclist does not appear to extend past the end of the - ** b-tree node. And that the final byte of the doclist is 0x00. If either - ** of these statements is untrue, then the data structure is corrupt. - */ - if( &pReader->aDoclist[pReader->nDoclist]>&pReader->aNode[pReader->nNode] - || (pReader->nPopulate==0 && pReader->aDoclist[pReader->nDoclist-1]) - ){ - return FTS_CORRUPT_VTAB; - } - return SQLITE_OK; -} - -/* -** Set the SegReader to point to the first docid in the doclist associated -** with the current term. -*/ -static int fts3SegReaderFirstDocid(Fts3Table *pTab, Fts3SegReader *pReader){ - int rc = SQLITE_OK; - assert( pReader->aDoclist ); - assert( !pReader->pOffsetList ); - if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){ - u8 bEof = 0; - pReader->iDocid = 0; - pReader->nOffsetList = 0; - sqlite3Fts3DoclistPrev(0, - pReader->aDoclist, pReader->nDoclist, &pReader->pOffsetList, - &pReader->iDocid, &pReader->nOffsetList, &bEof - ); - }else{ - rc = fts3SegReaderRequire(pReader, pReader->aDoclist, FTS3_VARINT_MAX); - if( rc==SQLITE_OK ){ - int n = sqlite3Fts3GetVarint(pReader->aDoclist, &pReader->iDocid); - pReader->pOffsetList = &pReader->aDoclist[n]; - } - } - return rc; -} - -/* -** Advance the SegReader to point to the next docid in the doclist -** associated with the current term. -** -** If arguments ppOffsetList and pnOffsetList are not NULL, then -** *ppOffsetList is set to point to the first column-offset list -** in the doclist entry (i.e. immediately past the docid varint). -** *pnOffsetList is set to the length of the set of column-offset -** lists, not including the nul-terminator byte. For example: -*/ -static int fts3SegReaderNextDocid( - Fts3Table *pTab, - Fts3SegReader *pReader, /* Reader to advance to next docid */ - char **ppOffsetList, /* OUT: Pointer to current position-list */ - int *pnOffsetList /* OUT: Length of *ppOffsetList in bytes */ -){ - int rc = SQLITE_OK; - char *p = pReader->pOffsetList; - char c = 0; - - assert( p ); - - if( pTab->bDescIdx && fts3SegReaderIsPending(pReader) ){ - /* A pending-terms seg-reader for an FTS4 table that uses order=desc. - ** Pending-terms doclists are always built up in ascending order, so - ** we have to iterate through them backwards here. */ - u8 bEof = 0; - if( ppOffsetList ){ - *ppOffsetList = pReader->pOffsetList; - *pnOffsetList = pReader->nOffsetList - 1; - } - sqlite3Fts3DoclistPrev(0, - pReader->aDoclist, pReader->nDoclist, &p, &pReader->iDocid, - &pReader->nOffsetList, &bEof - ); - if( bEof ){ - pReader->pOffsetList = 0; - }else{ - pReader->pOffsetList = p; - } - }else{ - char *pEnd = &pReader->aDoclist[pReader->nDoclist]; - - /* Pointer p currently points at the first byte of an offset list. The - ** following block advances it to point one byte past the end of - ** the same offset list. */ - while( 1 ){ - - /* The following line of code (and the "p++" below the while() loop) is - ** normally all that is required to move pointer p to the desired - ** position. The exception is if this node is being loaded from disk - ** incrementally and pointer "p" now points to the first byte past - ** the populated part of pReader->aNode[]. - */ - while( *p | c ) c = *p++ & 0x80; - assert( *p==0 ); - - if( pReader->pBlob==0 || p<&pReader->aNode[pReader->nPopulate] ) break; - rc = fts3SegReaderIncrRead(pReader); - if( rc!=SQLITE_OK ) return rc; - } - p++; - - /* If required, populate the output variables with a pointer to and the - ** size of the previous offset-list. - */ - if( ppOffsetList ){ - *ppOffsetList = pReader->pOffsetList; - *pnOffsetList = (int)(p - pReader->pOffsetList - 1); - } - - /* List may have been edited in place by fts3EvalNearTrim() */ - while( p=pEnd ){ - pReader->pOffsetList = 0; - }else{ - rc = fts3SegReaderRequire(pReader, p, FTS3_VARINT_MAX); - if( rc==SQLITE_OK ){ - sqlite3_int64 iDelta; - pReader->pOffsetList = p + sqlite3Fts3GetVarint(p, &iDelta); - if( pTab->bDescIdx ){ - pReader->iDocid -= iDelta; - }else{ - pReader->iDocid += iDelta; - } - } - } - } - - return SQLITE_OK; -} - - -SQLITE_PRIVATE int sqlite3Fts3MsrOvfl( - Fts3Cursor *pCsr, - Fts3MultiSegReader *pMsr, - int *pnOvfl -){ - Fts3Table *p = (Fts3Table*)pCsr->base.pVtab; - int nOvfl = 0; - int ii; - int rc = SQLITE_OK; - int pgsz = p->nPgsz; - - assert( p->bFts4 ); - assert( pgsz>0 ); - - for(ii=0; rc==SQLITE_OK && iinSegment; ii++){ - Fts3SegReader *pReader = pMsr->apSegment[ii]; - if( !fts3SegReaderIsPending(pReader) - && !fts3SegReaderIsRootOnly(pReader) - ){ - sqlite3_int64 jj; - for(jj=pReader->iStartBlock; jj<=pReader->iLeafEndBlock; jj++){ - int nBlob; - rc = sqlite3Fts3ReadBlock(p, jj, 0, &nBlob, 0); - if( rc!=SQLITE_OK ) break; - if( (nBlob+35)>pgsz ){ - nOvfl += (nBlob + 34)/pgsz; - } - } - } - } - *pnOvfl = nOvfl; - return rc; -} - -/* -** Free all allocations associated with the iterator passed as the -** second argument. -*/ -SQLITE_PRIVATE void sqlite3Fts3SegReaderFree(Fts3SegReader *pReader){ - if( pReader && !fts3SegReaderIsPending(pReader) ){ - sqlite3_free(pReader->zTerm); - if( !fts3SegReaderIsRootOnly(pReader) ){ - sqlite3_free(pReader->aNode); - sqlite3_blob_close(pReader->pBlob); - } - } - sqlite3_free(pReader); -} - -/* -** Allocate a new SegReader object. -*/ -SQLITE_PRIVATE int sqlite3Fts3SegReaderNew( - int iAge, /* Segment "age". */ - int bLookup, /* True for a lookup only */ - sqlite3_int64 iStartLeaf, /* First leaf to traverse */ - sqlite3_int64 iEndLeaf, /* Final leaf to traverse */ - sqlite3_int64 iEndBlock, /* Final block of segment */ - const char *zRoot, /* Buffer containing root node */ - int nRoot, /* Size of buffer containing root node */ - Fts3SegReader **ppReader /* OUT: Allocated Fts3SegReader */ -){ - Fts3SegReader *pReader; /* Newly allocated SegReader object */ - int nExtra = 0; /* Bytes to allocate segment root node */ - - assert( iStartLeaf<=iEndLeaf ); - if( iStartLeaf==0 ){ - nExtra = nRoot + FTS3_NODE_PADDING; - } - - pReader = (Fts3SegReader *)sqlite3_malloc(sizeof(Fts3SegReader) + nExtra); - if( !pReader ){ - return SQLITE_NOMEM; - } - memset(pReader, 0, sizeof(Fts3SegReader)); - pReader->iIdx = iAge; - pReader->bLookup = bLookup!=0; - pReader->iStartBlock = iStartLeaf; - pReader->iLeafEndBlock = iEndLeaf; - pReader->iEndBlock = iEndBlock; - - if( nExtra ){ - /* The entire segment is stored in the root node. */ - pReader->aNode = (char *)&pReader[1]; - pReader->rootOnly = 1; - pReader->nNode = nRoot; - memcpy(pReader->aNode, zRoot, nRoot); - memset(&pReader->aNode[nRoot], 0, FTS3_NODE_PADDING); - }else{ - pReader->iCurrentBlock = iStartLeaf-1; - } - *ppReader = pReader; - return SQLITE_OK; -} - -/* -** This is a comparison function used as a qsort() callback when sorting -** an array of pending terms by term. This occurs as part of flushing -** the contents of the pending-terms hash table to the database. -*/ -static int fts3CompareElemByTerm(const void *lhs, const void *rhs){ - char *z1 = fts3HashKey(*(Fts3HashElem **)lhs); - char *z2 = fts3HashKey(*(Fts3HashElem **)rhs); - int n1 = fts3HashKeysize(*(Fts3HashElem **)lhs); - int n2 = fts3HashKeysize(*(Fts3HashElem **)rhs); - - int n = (n1aIndex */ - const char *zTerm, /* Term to search for */ - int nTerm, /* Size of buffer zTerm */ - int bPrefix, /* True for a prefix iterator */ - Fts3SegReader **ppReader /* OUT: SegReader for pending-terms */ -){ - Fts3SegReader *pReader = 0; /* Fts3SegReader object to return */ - Fts3HashElem *pE; /* Iterator variable */ - Fts3HashElem **aElem = 0; /* Array of term hash entries to scan */ - int nElem = 0; /* Size of array at aElem */ - int rc = SQLITE_OK; /* Return Code */ - Fts3Hash *pHash; - - pHash = &p->aIndex[iIndex].hPending; - if( bPrefix ){ - int nAlloc = 0; /* Size of allocated array at aElem */ - - for(pE=fts3HashFirst(pHash); pE; pE=fts3HashNext(pE)){ - char *zKey = (char *)fts3HashKey(pE); - int nKey = fts3HashKeysize(pE); - if( nTerm==0 || (nKey>=nTerm && 0==memcmp(zKey, zTerm, nTerm)) ){ - if( nElem==nAlloc ){ - Fts3HashElem **aElem2; - nAlloc += 16; - aElem2 = (Fts3HashElem **)sqlite3_realloc( - aElem, nAlloc*sizeof(Fts3HashElem *) - ); - if( !aElem2 ){ - rc = SQLITE_NOMEM; - nElem = 0; - break; - } - aElem = aElem2; - } - - aElem[nElem++] = pE; - } - } - - /* If more than one term matches the prefix, sort the Fts3HashElem - ** objects in term order using qsort(). This uses the same comparison - ** callback as is used when flushing terms to disk. - */ - if( nElem>1 ){ - qsort(aElem, nElem, sizeof(Fts3HashElem *), fts3CompareElemByTerm); - } - - }else{ - /* The query is a simple term lookup that matches at most one term in - ** the index. All that is required is a straight hash-lookup. - ** - ** Because the stack address of pE may be accessed via the aElem pointer - ** below, the "Fts3HashElem *pE" must be declared so that it is valid - ** within this entire function, not just this "else{...}" block. - */ - pE = fts3HashFindElem(pHash, zTerm, nTerm); - if( pE ){ - aElem = &pE; - nElem = 1; - } - } - - if( nElem>0 ){ - int nByte = sizeof(Fts3SegReader) + (nElem+1)*sizeof(Fts3HashElem *); - pReader = (Fts3SegReader *)sqlite3_malloc(nByte); - if( !pReader ){ - rc = SQLITE_NOMEM; - }else{ - memset(pReader, 0, nByte); - pReader->iIdx = 0x7FFFFFFF; - pReader->ppNextElem = (Fts3HashElem **)&pReader[1]; - memcpy(pReader->ppNextElem, aElem, nElem*sizeof(Fts3HashElem *)); - } - } - - if( bPrefix ){ - sqlite3_free(aElem); - } - *ppReader = pReader; - return rc; -} - -/* -** Compare the entries pointed to by two Fts3SegReader structures. -** Comparison is as follows: -** -** 1) EOF is greater than not EOF. -** -** 2) The current terms (if any) are compared using memcmp(). If one -** term is a prefix of another, the longer term is considered the -** larger. -** -** 3) By segment age. An older segment is considered larger. -*/ -static int fts3SegReaderCmp(Fts3SegReader *pLhs, Fts3SegReader *pRhs){ - int rc; - if( pLhs->aNode && pRhs->aNode ){ - int rc2 = pLhs->nTerm - pRhs->nTerm; - if( rc2<0 ){ - rc = memcmp(pLhs->zTerm, pRhs->zTerm, pLhs->nTerm); - }else{ - rc = memcmp(pLhs->zTerm, pRhs->zTerm, pRhs->nTerm); - } - if( rc==0 ){ - rc = rc2; - } - }else{ - rc = (pLhs->aNode==0) - (pRhs->aNode==0); - } - if( rc==0 ){ - rc = pRhs->iIdx - pLhs->iIdx; - } - assert( rc!=0 ); - return rc; -} - -/* -** A different comparison function for SegReader structures. In this -** version, it is assumed that each SegReader points to an entry in -** a doclist for identical terms. Comparison is made as follows: -** -** 1) EOF (end of doclist in this case) is greater than not EOF. -** -** 2) By current docid. -** -** 3) By segment age. An older segment is considered larger. -*/ -static int fts3SegReaderDoclistCmp(Fts3SegReader *pLhs, Fts3SegReader *pRhs){ - int rc = (pLhs->pOffsetList==0)-(pRhs->pOffsetList==0); - if( rc==0 ){ - if( pLhs->iDocid==pRhs->iDocid ){ - rc = pRhs->iIdx - pLhs->iIdx; - }else{ - rc = (pLhs->iDocid > pRhs->iDocid) ? 1 : -1; - } - } - assert( pLhs->aNode && pRhs->aNode ); - return rc; -} -static int fts3SegReaderDoclistCmpRev(Fts3SegReader *pLhs, Fts3SegReader *pRhs){ - int rc = (pLhs->pOffsetList==0)-(pRhs->pOffsetList==0); - if( rc==0 ){ - if( pLhs->iDocid==pRhs->iDocid ){ - rc = pRhs->iIdx - pLhs->iIdx; - }else{ - rc = (pLhs->iDocid < pRhs->iDocid) ? 1 : -1; - } - } - assert( pLhs->aNode && pRhs->aNode ); - return rc; -} - -/* -** Compare the term that the Fts3SegReader object passed as the first argument -** points to with the term specified by arguments zTerm and nTerm. -** -** If the pSeg iterator is already at EOF, return 0. Otherwise, return -** -ve if the pSeg term is less than zTerm/nTerm, 0 if the two terms are -** equal, or +ve if the pSeg term is greater than zTerm/nTerm. -*/ -static int fts3SegReaderTermCmp( - Fts3SegReader *pSeg, /* Segment reader object */ - const char *zTerm, /* Term to compare to */ - int nTerm /* Size of term zTerm in bytes */ -){ - int res = 0; - if( pSeg->aNode ){ - if( pSeg->nTerm>nTerm ){ - res = memcmp(pSeg->zTerm, zTerm, nTerm); - }else{ - res = memcmp(pSeg->zTerm, zTerm, pSeg->nTerm); - } - if( res==0 ){ - res = pSeg->nTerm-nTerm; - } - } - return res; -} - -/* -** Argument apSegment is an array of nSegment elements. It is known that -** the final (nSegment-nSuspect) members are already in sorted order -** (according to the comparison function provided). This function shuffles -** the array around until all entries are in sorted order. -*/ -static void fts3SegReaderSort( - Fts3SegReader **apSegment, /* Array to sort entries of */ - int nSegment, /* Size of apSegment array */ - int nSuspect, /* Unsorted entry count */ - int (*xCmp)(Fts3SegReader *, Fts3SegReader *) /* Comparison function */ -){ - int i; /* Iterator variable */ - - assert( nSuspect<=nSegment ); - - if( nSuspect==nSegment ) nSuspect--; - for(i=nSuspect-1; i>=0; i--){ - int j; - for(j=i; j<(nSegment-1); j++){ - Fts3SegReader *pTmp; - if( xCmp(apSegment[j], apSegment[j+1])<0 ) break; - pTmp = apSegment[j+1]; - apSegment[j+1] = apSegment[j]; - apSegment[j] = pTmp; - } - } - -#ifndef NDEBUG - /* Check that the list really is sorted now. */ - for(i=0; i<(nSuspect-1); i++){ - assert( xCmp(apSegment[i], apSegment[i+1])<0 ); - } -#endif -} - -/* -** Insert a record into the %_segments table. -*/ -static int fts3WriteSegment( - Fts3Table *p, /* Virtual table handle */ - sqlite3_int64 iBlock, /* Block id for new block */ - char *z, /* Pointer to buffer containing block data */ - int n /* Size of buffer z in bytes */ -){ - sqlite3_stmt *pStmt; - int rc = fts3SqlStmt(p, SQL_INSERT_SEGMENTS, &pStmt, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pStmt, 1, iBlock); - sqlite3_bind_blob(pStmt, 2, z, n, SQLITE_STATIC); - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); - } - return rc; -} - -/* -** Find the largest relative level number in the table. If successful, set -** *pnMax to this value and return SQLITE_OK. Otherwise, if an error occurs, -** set *pnMax to zero and return an SQLite error code. -*/ -SQLITE_PRIVATE int sqlite3Fts3MaxLevel(Fts3Table *p, int *pnMax){ - int rc; - int mxLevel = 0; - sqlite3_stmt *pStmt = 0; - - rc = fts3SqlStmt(p, SQL_SELECT_MXLEVEL, &pStmt, 0); - if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - mxLevel = sqlite3_column_int(pStmt, 0); - } - rc = sqlite3_reset(pStmt); - } - *pnMax = mxLevel; - return rc; -} - -/* -** Insert a record into the %_segdir table. -*/ -static int fts3WriteSegdir( - Fts3Table *p, /* Virtual table handle */ - sqlite3_int64 iLevel, /* Value for "level" field (absolute level) */ - int iIdx, /* Value for "idx" field */ - sqlite3_int64 iStartBlock, /* Value for "start_block" field */ - sqlite3_int64 iLeafEndBlock, /* Value for "leaves_end_block" field */ - sqlite3_int64 iEndBlock, /* Value for "end_block" field */ - char *zRoot, /* Blob value for "root" field */ - int nRoot /* Number of bytes in buffer zRoot */ -){ - sqlite3_stmt *pStmt; - int rc = fts3SqlStmt(p, SQL_INSERT_SEGDIR, &pStmt, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pStmt, 1, iLevel); - sqlite3_bind_int(pStmt, 2, iIdx); - sqlite3_bind_int64(pStmt, 3, iStartBlock); - sqlite3_bind_int64(pStmt, 4, iLeafEndBlock); - sqlite3_bind_int64(pStmt, 5, iEndBlock); - sqlite3_bind_blob(pStmt, 6, zRoot, nRoot, SQLITE_STATIC); - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); - } - return rc; -} - -/* -** Return the size of the common prefix (if any) shared by zPrev and -** zNext, in bytes. For example, -** -** fts3PrefixCompress("abc", 3, "abcdef", 6) // returns 3 -** fts3PrefixCompress("abX", 3, "abcdef", 6) // returns 2 -** fts3PrefixCompress("abX", 3, "Xbcdef", 6) // returns 0 -*/ -static int fts3PrefixCompress( - const char *zPrev, /* Buffer containing previous term */ - int nPrev, /* Size of buffer zPrev in bytes */ - const char *zNext, /* Buffer containing next term */ - int nNext /* Size of buffer zNext in bytes */ -){ - int n; - UNUSED_PARAMETER(nNext); - for(n=0; nnData; /* Current size of node in bytes */ - int nReq = nData; /* Required space after adding zTerm */ - int nPrefix; /* Number of bytes of prefix compression */ - int nSuffix; /* Suffix length */ - - nPrefix = fts3PrefixCompress(pTree->zTerm, pTree->nTerm, zTerm, nTerm); - nSuffix = nTerm-nPrefix; - - nReq += sqlite3Fts3VarintLen(nPrefix)+sqlite3Fts3VarintLen(nSuffix)+nSuffix; - if( nReq<=p->nNodeSize || !pTree->zTerm ){ - - if( nReq>p->nNodeSize ){ - /* An unusual case: this is the first term to be added to the node - ** and the static node buffer (p->nNodeSize bytes) is not large - ** enough. Use a separately malloced buffer instead This wastes - ** p->nNodeSize bytes, but since this scenario only comes about when - ** the database contain two terms that share a prefix of almost 2KB, - ** this is not expected to be a serious problem. - */ - assert( pTree->aData==(char *)&pTree[1] ); - pTree->aData = (char *)sqlite3_malloc(nReq); - if( !pTree->aData ){ - return SQLITE_NOMEM; - } - } - - if( pTree->zTerm ){ - /* There is no prefix-length field for first term in a node */ - nData += sqlite3Fts3PutVarint(&pTree->aData[nData], nPrefix); - } - - nData += sqlite3Fts3PutVarint(&pTree->aData[nData], nSuffix); - memcpy(&pTree->aData[nData], &zTerm[nPrefix], nSuffix); - pTree->nData = nData + nSuffix; - pTree->nEntry++; - - if( isCopyTerm ){ - if( pTree->nMalloczMalloc, nTerm*2); - if( !zNew ){ - return SQLITE_NOMEM; - } - pTree->nMalloc = nTerm*2; - pTree->zMalloc = zNew; - } - pTree->zTerm = pTree->zMalloc; - memcpy(pTree->zTerm, zTerm, nTerm); - pTree->nTerm = nTerm; - }else{ - pTree->zTerm = (char *)zTerm; - pTree->nTerm = nTerm; - } - return SQLITE_OK; - } - } - - /* If control flows to here, it was not possible to append zTerm to the - ** current node. Create a new node (a right-sibling of the current node). - ** If this is the first node in the tree, the term is added to it. - ** - ** Otherwise, the term is not added to the new node, it is left empty for - ** now. Instead, the term is inserted into the parent of pTree. If pTree - ** has no parent, one is created here. - */ - pNew = (SegmentNode *)sqlite3_malloc(sizeof(SegmentNode) + p->nNodeSize); - if( !pNew ){ - return SQLITE_NOMEM; - } - memset(pNew, 0, sizeof(SegmentNode)); - pNew->nData = 1 + FTS3_VARINT_MAX; - pNew->aData = (char *)&pNew[1]; - - if( pTree ){ - SegmentNode *pParent = pTree->pParent; - rc = fts3NodeAddTerm(p, &pParent, isCopyTerm, zTerm, nTerm); - if( pTree->pParent==0 ){ - pTree->pParent = pParent; - } - pTree->pRight = pNew; - pNew->pLeftmost = pTree->pLeftmost; - pNew->pParent = pParent; - pNew->zMalloc = pTree->zMalloc; - pNew->nMalloc = pTree->nMalloc; - pTree->zMalloc = 0; - }else{ - pNew->pLeftmost = pNew; - rc = fts3NodeAddTerm(p, &pNew, isCopyTerm, zTerm, nTerm); - } - - *ppTree = pNew; - return rc; -} - -/* -** Helper function for fts3NodeWrite(). -*/ -static int fts3TreeFinishNode( - SegmentNode *pTree, - int iHeight, - sqlite3_int64 iLeftChild -){ - int nStart; - assert( iHeight>=1 && iHeight<128 ); - nStart = FTS3_VARINT_MAX - sqlite3Fts3VarintLen(iLeftChild); - pTree->aData[nStart] = (char)iHeight; - sqlite3Fts3PutVarint(&pTree->aData[nStart+1], iLeftChild); - return nStart; -} - -/* -** Write the buffer for the segment node pTree and all of its peers to the -** database. Then call this function recursively to write the parent of -** pTree and its peers to the database. -** -** Except, if pTree is a root node, do not write it to the database. Instead, -** set output variables *paRoot and *pnRoot to contain the root node. -** -** If successful, SQLITE_OK is returned and output variable *piLast is -** set to the largest blockid written to the database (or zero if no -** blocks were written to the db). Otherwise, an SQLite error code is -** returned. -*/ -static int fts3NodeWrite( - Fts3Table *p, /* Virtual table handle */ - SegmentNode *pTree, /* SegmentNode handle */ - int iHeight, /* Height of this node in tree */ - sqlite3_int64 iLeaf, /* Block id of first leaf node */ - sqlite3_int64 iFree, /* Block id of next free slot in %_segments */ - sqlite3_int64 *piLast, /* OUT: Block id of last entry written */ - char **paRoot, /* OUT: Data for root node */ - int *pnRoot /* OUT: Size of root node in bytes */ -){ - int rc = SQLITE_OK; - - if( !pTree->pParent ){ - /* Root node of the tree. */ - int nStart = fts3TreeFinishNode(pTree, iHeight, iLeaf); - *piLast = iFree-1; - *pnRoot = pTree->nData - nStart; - *paRoot = &pTree->aData[nStart]; - }else{ - SegmentNode *pIter; - sqlite3_int64 iNextFree = iFree; - sqlite3_int64 iNextLeaf = iLeaf; - for(pIter=pTree->pLeftmost; pIter && rc==SQLITE_OK; pIter=pIter->pRight){ - int nStart = fts3TreeFinishNode(pIter, iHeight, iNextLeaf); - int nWrite = pIter->nData - nStart; - - rc = fts3WriteSegment(p, iNextFree, &pIter->aData[nStart], nWrite); - iNextFree++; - iNextLeaf += (pIter->nEntry+1); - } - if( rc==SQLITE_OK ){ - assert( iNextLeaf==iFree ); - rc = fts3NodeWrite( - p, pTree->pParent, iHeight+1, iFree, iNextFree, piLast, paRoot, pnRoot - ); - } - } - - return rc; -} - -/* -** Free all memory allocations associated with the tree pTree. -*/ -static void fts3NodeFree(SegmentNode *pTree){ - if( pTree ){ - SegmentNode *p = pTree->pLeftmost; - fts3NodeFree(p->pParent); - while( p ){ - SegmentNode *pRight = p->pRight; - if( p->aData!=(char *)&p[1] ){ - sqlite3_free(p->aData); - } - assert( pRight==0 || p->zMalloc==0 ); - sqlite3_free(p->zMalloc); - sqlite3_free(p); - p = pRight; - } - } -} - -/* -** Add a term to the segment being constructed by the SegmentWriter object -** *ppWriter. When adding the first term to a segment, *ppWriter should -** be passed NULL. This function will allocate a new SegmentWriter object -** and return it via the input/output variable *ppWriter in this case. -** -** If successful, SQLITE_OK is returned. Otherwise, an SQLite error code. -*/ -static int fts3SegWriterAdd( - Fts3Table *p, /* Virtual table handle */ - SegmentWriter **ppWriter, /* IN/OUT: SegmentWriter handle */ - int isCopyTerm, /* True if buffer zTerm must be copied */ - const char *zTerm, /* Pointer to buffer containing term */ - int nTerm, /* Size of term in bytes */ - const char *aDoclist, /* Pointer to buffer containing doclist */ - int nDoclist /* Size of doclist in bytes */ -){ - int nPrefix; /* Size of term prefix in bytes */ - int nSuffix; /* Size of term suffix in bytes */ - int nReq; /* Number of bytes required on leaf page */ - int nData; - SegmentWriter *pWriter = *ppWriter; - - if( !pWriter ){ - int rc; - sqlite3_stmt *pStmt; - - /* Allocate the SegmentWriter structure */ - pWriter = (SegmentWriter *)sqlite3_malloc(sizeof(SegmentWriter)); - if( !pWriter ) return SQLITE_NOMEM; - memset(pWriter, 0, sizeof(SegmentWriter)); - *ppWriter = pWriter; - - /* Allocate a buffer in which to accumulate data */ - pWriter->aData = (char *)sqlite3_malloc(p->nNodeSize); - if( !pWriter->aData ) return SQLITE_NOMEM; - pWriter->nSize = p->nNodeSize; - - /* Find the next free blockid in the %_segments table */ - rc = fts3SqlStmt(p, SQL_NEXT_SEGMENTS_ID, &pStmt, 0); - if( rc!=SQLITE_OK ) return rc; - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - pWriter->iFree = sqlite3_column_int64(pStmt, 0); - pWriter->iFirst = pWriter->iFree; - } - rc = sqlite3_reset(pStmt); - if( rc!=SQLITE_OK ) return rc; - } - nData = pWriter->nData; - - nPrefix = fts3PrefixCompress(pWriter->zTerm, pWriter->nTerm, zTerm, nTerm); - nSuffix = nTerm-nPrefix; - - /* Figure out how many bytes are required by this new entry */ - nReq = sqlite3Fts3VarintLen(nPrefix) + /* varint containing prefix size */ - sqlite3Fts3VarintLen(nSuffix) + /* varint containing suffix size */ - nSuffix + /* Term suffix */ - sqlite3Fts3VarintLen(nDoclist) + /* Size of doclist */ - nDoclist; /* Doclist data */ - - if( nData>0 && nData+nReq>p->nNodeSize ){ - int rc; - - /* The current leaf node is full. Write it out to the database. */ - rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, nData); - if( rc!=SQLITE_OK ) return rc; - p->nLeafAdd++; - - /* Add the current term to the interior node tree. The term added to - ** the interior tree must: - ** - ** a) be greater than the largest term on the leaf node just written - ** to the database (still available in pWriter->zTerm), and - ** - ** b) be less than or equal to the term about to be added to the new - ** leaf node (zTerm/nTerm). - ** - ** In other words, it must be the prefix of zTerm 1 byte longer than - ** the common prefix (if any) of zTerm and pWriter->zTerm. - */ - assert( nPrefixpTree, isCopyTerm, zTerm, nPrefix+1); - if( rc!=SQLITE_OK ) return rc; - - nData = 0; - pWriter->nTerm = 0; - - nPrefix = 0; - nSuffix = nTerm; - nReq = 1 + /* varint containing prefix size */ - sqlite3Fts3VarintLen(nTerm) + /* varint containing suffix size */ - nTerm + /* Term suffix */ - sqlite3Fts3VarintLen(nDoclist) + /* Size of doclist */ - nDoclist; /* Doclist data */ - } - - /* If the buffer currently allocated is too small for this entry, realloc - ** the buffer to make it large enough. - */ - if( nReq>pWriter->nSize ){ - char *aNew = sqlite3_realloc(pWriter->aData, nReq); - if( !aNew ) return SQLITE_NOMEM; - pWriter->aData = aNew; - pWriter->nSize = nReq; - } - assert( nData+nReq<=pWriter->nSize ); - - /* Append the prefix-compressed term and doclist to the buffer. */ - nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nPrefix); - nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nSuffix); - memcpy(&pWriter->aData[nData], &zTerm[nPrefix], nSuffix); - nData += nSuffix; - nData += sqlite3Fts3PutVarint(&pWriter->aData[nData], nDoclist); - memcpy(&pWriter->aData[nData], aDoclist, nDoclist); - pWriter->nData = nData + nDoclist; - - /* Save the current term so that it can be used to prefix-compress the next. - ** If the isCopyTerm parameter is true, then the buffer pointed to by - ** zTerm is transient, so take a copy of the term data. Otherwise, just - ** store a copy of the pointer. - */ - if( isCopyTerm ){ - if( nTerm>pWriter->nMalloc ){ - char *zNew = sqlite3_realloc(pWriter->zMalloc, nTerm*2); - if( !zNew ){ - return SQLITE_NOMEM; - } - pWriter->nMalloc = nTerm*2; - pWriter->zMalloc = zNew; - pWriter->zTerm = zNew; - } - assert( pWriter->zTerm==pWriter->zMalloc ); - memcpy(pWriter->zTerm, zTerm, nTerm); - }else{ - pWriter->zTerm = (char *)zTerm; - } - pWriter->nTerm = nTerm; - - return SQLITE_OK; -} - -/* -** Flush all data associated with the SegmentWriter object pWriter to the -** database. This function must be called after all terms have been added -** to the segment using fts3SegWriterAdd(). If successful, SQLITE_OK is -** returned. Otherwise, an SQLite error code. -*/ -static int fts3SegWriterFlush( - Fts3Table *p, /* Virtual table handle */ - SegmentWriter *pWriter, /* SegmentWriter to flush to the db */ - sqlite3_int64 iLevel, /* Value for 'level' column of %_segdir */ - int iIdx /* Value for 'idx' column of %_segdir */ -){ - int rc; /* Return code */ - if( pWriter->pTree ){ - sqlite3_int64 iLast = 0; /* Largest block id written to database */ - sqlite3_int64 iLastLeaf; /* Largest leaf block id written to db */ - char *zRoot = NULL; /* Pointer to buffer containing root node */ - int nRoot = 0; /* Size of buffer zRoot */ - - iLastLeaf = pWriter->iFree; - rc = fts3WriteSegment(p, pWriter->iFree++, pWriter->aData, pWriter->nData); - if( rc==SQLITE_OK ){ - rc = fts3NodeWrite(p, pWriter->pTree, 1, - pWriter->iFirst, pWriter->iFree, &iLast, &zRoot, &nRoot); - } - if( rc==SQLITE_OK ){ - rc = fts3WriteSegdir( - p, iLevel, iIdx, pWriter->iFirst, iLastLeaf, iLast, zRoot, nRoot); - } - }else{ - /* The entire tree fits on the root node. Write it to the segdir table. */ - rc = fts3WriteSegdir( - p, iLevel, iIdx, 0, 0, 0, pWriter->aData, pWriter->nData); - } - p->nLeafAdd++; - return rc; -} - -/* -** Release all memory held by the SegmentWriter object passed as the -** first argument. -*/ -static void fts3SegWriterFree(SegmentWriter *pWriter){ - if( pWriter ){ - sqlite3_free(pWriter->aData); - sqlite3_free(pWriter->zMalloc); - fts3NodeFree(pWriter->pTree); - sqlite3_free(pWriter); - } -} - -/* -** The first value in the apVal[] array is assumed to contain an integer. -** This function tests if there exist any documents with docid values that -** are different from that integer. i.e. if deleting the document with docid -** pRowid would mean the FTS3 table were empty. -** -** If successful, *pisEmpty is set to true if the table is empty except for -** document pRowid, or false otherwise, and SQLITE_OK is returned. If an -** error occurs, an SQLite error code is returned. -*/ -static int fts3IsEmpty(Fts3Table *p, sqlite3_value *pRowid, int *pisEmpty){ - sqlite3_stmt *pStmt; - int rc; - if( p->zContentTbl ){ - /* If using the content=xxx option, assume the table is never empty */ - *pisEmpty = 0; - rc = SQLITE_OK; - }else{ - rc = fts3SqlStmt(p, SQL_IS_EMPTY, &pStmt, &pRowid); - if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - *pisEmpty = sqlite3_column_int(pStmt, 0); - } - rc = sqlite3_reset(pStmt); - } - } - return rc; -} - -/* -** Set *pnMax to the largest segment level in the database for the index -** iIndex. -** -** Segment levels are stored in the 'level' column of the %_segdir table. -** -** Return SQLITE_OK if successful, or an SQLite error code if not. -*/ -static int fts3SegmentMaxLevel( - Fts3Table *p, - int iLangid, - int iIndex, - sqlite3_int64 *pnMax -){ - sqlite3_stmt *pStmt; - int rc; - assert( iIndex>=0 && iIndexnIndex ); - - /* Set pStmt to the compiled version of: - ** - ** SELECT max(level) FROM %Q.'%q_segdir' WHERE level BETWEEN ? AND ? - ** - ** (1024 is actually the value of macro FTS3_SEGDIR_PREFIXLEVEL_STR). - */ - rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR_MAX_LEVEL, &pStmt, 0); - if( rc!=SQLITE_OK ) return rc; - sqlite3_bind_int64(pStmt, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); - sqlite3_bind_int64(pStmt, 2, - getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) - ); - if( SQLITE_ROW==sqlite3_step(pStmt) ){ - *pnMax = sqlite3_column_int64(pStmt, 0); - } - return sqlite3_reset(pStmt); -} - -/* -** Delete all entries in the %_segments table associated with the segment -** opened with seg-reader pSeg. This function does not affect the contents -** of the %_segdir table. -*/ -static int fts3DeleteSegment( - Fts3Table *p, /* FTS table handle */ - Fts3SegReader *pSeg /* Segment to delete */ -){ - int rc = SQLITE_OK; /* Return code */ - if( pSeg->iStartBlock ){ - sqlite3_stmt *pDelete; /* SQL statement to delete rows */ - rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDelete, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDelete, 1, pSeg->iStartBlock); - sqlite3_bind_int64(pDelete, 2, pSeg->iEndBlock); - sqlite3_step(pDelete); - rc = sqlite3_reset(pDelete); - } - } - return rc; -} - -/* -** This function is used after merging multiple segments into a single large -** segment to delete the old, now redundant, segment b-trees. Specifically, -** it: -** -** 1) Deletes all %_segments entries for the segments associated with -** each of the SegReader objects in the array passed as the third -** argument, and -** -** 2) deletes all %_segdir entries with level iLevel, or all %_segdir -** entries regardless of level if (iLevel<0). -** -** SQLITE_OK is returned if successful, otherwise an SQLite error code. -*/ -static int fts3DeleteSegdir( - Fts3Table *p, /* Virtual table handle */ - int iLangid, /* Language id */ - int iIndex, /* Index for p->aIndex */ - int iLevel, /* Level of %_segdir entries to delete */ - Fts3SegReader **apSegment, /* Array of SegReader objects */ - int nReader /* Size of array apSegment */ -){ - int rc = SQLITE_OK; /* Return Code */ - int i; /* Iterator variable */ - sqlite3_stmt *pDelete = 0; /* SQL statement to delete rows */ - - for(i=0; rc==SQLITE_OK && i=0 || iLevel==FTS3_SEGCURSOR_ALL ); - if( iLevel==FTS3_SEGCURSOR_ALL ){ - rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_RANGE, &pDelete, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, 0)); - sqlite3_bind_int64(pDelete, 2, - getAbsoluteLevel(p, iLangid, iIndex, FTS3_SEGDIR_MAXLEVEL-1) - ); - } - }else{ - rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_LEVEL, &pDelete, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64( - pDelete, 1, getAbsoluteLevel(p, iLangid, iIndex, iLevel) - ); - } - } - - if( rc==SQLITE_OK ){ - sqlite3_step(pDelete); - rc = sqlite3_reset(pDelete); - } - - return rc; -} - -/* -** When this function is called, buffer *ppList (size *pnList bytes) contains -** a position list that may (or may not) feature multiple columns. This -** function adjusts the pointer *ppList and the length *pnList so that they -** identify the subset of the position list that corresponds to column iCol. -** -** If there are no entries in the input position list for column iCol, then -** *pnList is set to zero before returning. -** -** If parameter bZero is non-zero, then any part of the input list following -** the end of the output list is zeroed before returning. -*/ -static void fts3ColumnFilter( - int iCol, /* Column to filter on */ - int bZero, /* Zero out anything following *ppList */ - char **ppList, /* IN/OUT: Pointer to position list */ - int *pnList /* IN/OUT: Size of buffer *ppList in bytes */ -){ - char *pList = *ppList; - int nList = *pnList; - char *pEnd = &pList[nList]; - int iCurrent = 0; - char *p = pList; - - assert( iCol>=0 ); - while( 1 ){ - char c = 0; - while( ppMsr->nBuffer ){ - char *pNew; - pMsr->nBuffer = nList*2; - pNew = (char *)sqlite3_realloc(pMsr->aBuffer, pMsr->nBuffer); - if( !pNew ) return SQLITE_NOMEM; - pMsr->aBuffer = pNew; - } - - memcpy(pMsr->aBuffer, pList, nList); - return SQLITE_OK; -} - -SQLITE_PRIVATE int sqlite3Fts3MsrIncrNext( - Fts3Table *p, /* Virtual table handle */ - Fts3MultiSegReader *pMsr, /* Multi-segment-reader handle */ - sqlite3_int64 *piDocid, /* OUT: Docid value */ - char **paPoslist, /* OUT: Pointer to position list */ - int *pnPoslist /* OUT: Size of position list in bytes */ -){ - int nMerge = pMsr->nAdvance; - Fts3SegReader **apSegment = pMsr->apSegment; - int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = ( - p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp - ); - - if( nMerge==0 ){ - *paPoslist = 0; - return SQLITE_OK; - } - - while( 1 ){ - Fts3SegReader *pSeg; - pSeg = pMsr->apSegment[0]; - - if( pSeg->pOffsetList==0 ){ - *paPoslist = 0; - break; - }else{ - int rc; - char *pList; - int nList; - int j; - sqlite3_int64 iDocid = apSegment[0]->iDocid; - - rc = fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList); - j = 1; - while( rc==SQLITE_OK - && jpOffsetList - && apSegment[j]->iDocid==iDocid - ){ - rc = fts3SegReaderNextDocid(p, apSegment[j], 0, 0); - j++; - } - if( rc!=SQLITE_OK ) return rc; - fts3SegReaderSort(pMsr->apSegment, nMerge, j, xCmp); - - if( nList>0 && fts3SegReaderIsPending(apSegment[0]) ){ - rc = fts3MsrBufferData(pMsr, pList, nList+1); - if( rc!=SQLITE_OK ) return rc; - assert( (pMsr->aBuffer[nList] & 0xFE)==0x00 ); - pList = pMsr->aBuffer; - } - - if( pMsr->iColFilter>=0 ){ - fts3ColumnFilter(pMsr->iColFilter, 1, &pList, &nList); - } - - if( nList>0 ){ - *paPoslist = pList; - *piDocid = iDocid; - *pnPoslist = nList; - break; - } - } - } - - return SQLITE_OK; -} - -static int fts3SegReaderStart( - Fts3Table *p, /* Virtual table handle */ - Fts3MultiSegReader *pCsr, /* Cursor object */ - const char *zTerm, /* Term searched for (or NULL) */ - int nTerm /* Length of zTerm in bytes */ -){ - int i; - int nSeg = pCsr->nSegment; - - /* If the Fts3SegFilter defines a specific term (or term prefix) to search - ** for, then advance each segment iterator until it points to a term of - ** equal or greater value than the specified term. This prevents many - ** unnecessary merge/sort operations for the case where single segment - ** b-tree leaf nodes contain more than one term. - */ - for(i=0; pCsr->bRestart==0 && inSegment; i++){ - int res = 0; - Fts3SegReader *pSeg = pCsr->apSegment[i]; - do { - int rc = fts3SegReaderNext(p, pSeg, 0); - if( rc!=SQLITE_OK ) return rc; - }while( zTerm && (res = fts3SegReaderTermCmp(pSeg, zTerm, nTerm))<0 ); - - if( pSeg->bLookup && res!=0 ){ - fts3SegReaderSetEof(pSeg); - } - } - fts3SegReaderSort(pCsr->apSegment, nSeg, nSeg, fts3SegReaderCmp); - - return SQLITE_OK; -} - -SQLITE_PRIVATE int sqlite3Fts3SegReaderStart( - Fts3Table *p, /* Virtual table handle */ - Fts3MultiSegReader *pCsr, /* Cursor object */ - Fts3SegFilter *pFilter /* Restrictions on range of iteration */ -){ - pCsr->pFilter = pFilter; - return fts3SegReaderStart(p, pCsr, pFilter->zTerm, pFilter->nTerm); -} - -SQLITE_PRIVATE int sqlite3Fts3MsrIncrStart( - Fts3Table *p, /* Virtual table handle */ - Fts3MultiSegReader *pCsr, /* Cursor object */ - int iCol, /* Column to match on. */ - const char *zTerm, /* Term to iterate through a doclist for */ - int nTerm /* Number of bytes in zTerm */ -){ - int i; - int rc; - int nSegment = pCsr->nSegment; - int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = ( - p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp - ); - - assert( pCsr->pFilter==0 ); - assert( zTerm && nTerm>0 ); - - /* Advance each segment iterator until it points to the term zTerm/nTerm. */ - rc = fts3SegReaderStart(p, pCsr, zTerm, nTerm); - if( rc!=SQLITE_OK ) return rc; - - /* Determine how many of the segments actually point to zTerm/nTerm. */ - for(i=0; iapSegment[i]; - if( !pSeg->aNode || fts3SegReaderTermCmp(pSeg, zTerm, nTerm) ){ - break; - } - } - pCsr->nAdvance = i; - - /* Advance each of the segments to point to the first docid. */ - for(i=0; inAdvance; i++){ - rc = fts3SegReaderFirstDocid(p, pCsr->apSegment[i]); - if( rc!=SQLITE_OK ) return rc; - } - fts3SegReaderSort(pCsr->apSegment, i, i, xCmp); - - assert( iCol<0 || iColnColumn ); - pCsr->iColFilter = iCol; - - return SQLITE_OK; -} - -/* -** This function is called on a MultiSegReader that has been started using -** sqlite3Fts3MsrIncrStart(). One or more calls to MsrIncrNext() may also -** have been made. Calling this function puts the MultiSegReader in such -** a state that if the next two calls are: -** -** sqlite3Fts3SegReaderStart() -** sqlite3Fts3SegReaderStep() -** -** then the entire doclist for the term is available in -** MultiSegReader.aDoclist/nDoclist. -*/ -SQLITE_PRIVATE int sqlite3Fts3MsrIncrRestart(Fts3MultiSegReader *pCsr){ - int i; /* Used to iterate through segment-readers */ - - assert( pCsr->zTerm==0 ); - assert( pCsr->nTerm==0 ); - assert( pCsr->aDoclist==0 ); - assert( pCsr->nDoclist==0 ); - - pCsr->nAdvance = 0; - pCsr->bRestart = 1; - for(i=0; inSegment; i++){ - pCsr->apSegment[i]->pOffsetList = 0; - pCsr->apSegment[i]->nOffsetList = 0; - pCsr->apSegment[i]->iDocid = 0; - } - - return SQLITE_OK; -} - - -SQLITE_PRIVATE int sqlite3Fts3SegReaderStep( - Fts3Table *p, /* Virtual table handle */ - Fts3MultiSegReader *pCsr /* Cursor object */ -){ - int rc = SQLITE_OK; - - int isIgnoreEmpty = (pCsr->pFilter->flags & FTS3_SEGMENT_IGNORE_EMPTY); - int isRequirePos = (pCsr->pFilter->flags & FTS3_SEGMENT_REQUIRE_POS); - int isColFilter = (pCsr->pFilter->flags & FTS3_SEGMENT_COLUMN_FILTER); - int isPrefix = (pCsr->pFilter->flags & FTS3_SEGMENT_PREFIX); - int isScan = (pCsr->pFilter->flags & FTS3_SEGMENT_SCAN); - int isFirst = (pCsr->pFilter->flags & FTS3_SEGMENT_FIRST); - - Fts3SegReader **apSegment = pCsr->apSegment; - int nSegment = pCsr->nSegment; - Fts3SegFilter *pFilter = pCsr->pFilter; - int (*xCmp)(Fts3SegReader *, Fts3SegReader *) = ( - p->bDescIdx ? fts3SegReaderDoclistCmpRev : fts3SegReaderDoclistCmp - ); - - if( pCsr->nSegment==0 ) return SQLITE_OK; - - do { - int nMerge; - int i; - - /* Advance the first pCsr->nAdvance entries in the apSegment[] array - ** forward. Then sort the list in order of current term again. - */ - for(i=0; inAdvance; i++){ - Fts3SegReader *pSeg = apSegment[i]; - if( pSeg->bLookup ){ - fts3SegReaderSetEof(pSeg); - }else{ - rc = fts3SegReaderNext(p, pSeg, 0); - } - if( rc!=SQLITE_OK ) return rc; - } - fts3SegReaderSort(apSegment, nSegment, pCsr->nAdvance, fts3SegReaderCmp); - pCsr->nAdvance = 0; - - /* If all the seg-readers are at EOF, we're finished. return SQLITE_OK. */ - assert( rc==SQLITE_OK ); - if( apSegment[0]->aNode==0 ) break; - - pCsr->nTerm = apSegment[0]->nTerm; - pCsr->zTerm = apSegment[0]->zTerm; - - /* If this is a prefix-search, and if the term that apSegment[0] points - ** to does not share a suffix with pFilter->zTerm/nTerm, then all - ** required callbacks have been made. In this case exit early. - ** - ** Similarly, if this is a search for an exact match, and the first term - ** of segment apSegment[0] is not a match, exit early. - */ - if( pFilter->zTerm && !isScan ){ - if( pCsr->nTermnTerm - || (!isPrefix && pCsr->nTerm>pFilter->nTerm) - || memcmp(pCsr->zTerm, pFilter->zTerm, pFilter->nTerm) - ){ - break; - } - } - - nMerge = 1; - while( nMergeaNode - && apSegment[nMerge]->nTerm==pCsr->nTerm - && 0==memcmp(pCsr->zTerm, apSegment[nMerge]->zTerm, pCsr->nTerm) - ){ - nMerge++; - } - - assert( isIgnoreEmpty || (isRequirePos && !isColFilter) ); - if( nMerge==1 - && !isIgnoreEmpty - && !isFirst - && (p->bDescIdx==0 || fts3SegReaderIsPending(apSegment[0])==0) - ){ - pCsr->nDoclist = apSegment[0]->nDoclist; - if( fts3SegReaderIsPending(apSegment[0]) ){ - rc = fts3MsrBufferData(pCsr, apSegment[0]->aDoclist, pCsr->nDoclist); - pCsr->aDoclist = pCsr->aBuffer; - }else{ - pCsr->aDoclist = apSegment[0]->aDoclist; - } - if( rc==SQLITE_OK ) rc = SQLITE_ROW; - }else{ - int nDoclist = 0; /* Size of doclist */ - sqlite3_int64 iPrev = 0; /* Previous docid stored in doclist */ - - /* The current term of the first nMerge entries in the array - ** of Fts3SegReader objects is the same. The doclists must be merged - ** and a single term returned with the merged doclist. - */ - for(i=0; ipOffsetList ){ - int j; /* Number of segments that share a docid */ - char *pList = 0; - int nList = 0; - int nByte; - sqlite3_int64 iDocid = apSegment[0]->iDocid; - fts3SegReaderNextDocid(p, apSegment[0], &pList, &nList); - j = 1; - while( jpOffsetList - && apSegment[j]->iDocid==iDocid - ){ - fts3SegReaderNextDocid(p, apSegment[j], 0, 0); - j++; - } - - if( isColFilter ){ - fts3ColumnFilter(pFilter->iCol, 0, &pList, &nList); - } - - if( !isIgnoreEmpty || nList>0 ){ - - /* Calculate the 'docid' delta value to write into the merged - ** doclist. */ - sqlite3_int64 iDelta; - if( p->bDescIdx && nDoclist>0 ){ - iDelta = iPrev - iDocid; - }else{ - iDelta = iDocid - iPrev; - } - assert( iDelta>0 || (nDoclist==0 && iDelta==iDocid) ); - assert( nDoclist>0 || iDelta==iDocid ); - - nByte = sqlite3Fts3VarintLen(iDelta) + (isRequirePos?nList+1:0); - if( nDoclist+nByte>pCsr->nBuffer ){ - char *aNew; - pCsr->nBuffer = (nDoclist+nByte)*2; - aNew = sqlite3_realloc(pCsr->aBuffer, pCsr->nBuffer); - if( !aNew ){ - return SQLITE_NOMEM; - } - pCsr->aBuffer = aNew; - } - - if( isFirst ){ - char *a = &pCsr->aBuffer[nDoclist]; - int nWrite; - - nWrite = sqlite3Fts3FirstFilter(iDelta, pList, nList, a); - if( nWrite ){ - iPrev = iDocid; - nDoclist += nWrite; - } - }else{ - nDoclist += sqlite3Fts3PutVarint(&pCsr->aBuffer[nDoclist], iDelta); - iPrev = iDocid; - if( isRequirePos ){ - memcpy(&pCsr->aBuffer[nDoclist], pList, nList); - nDoclist += nList; - pCsr->aBuffer[nDoclist++] = '\0'; - } - } - } - - fts3SegReaderSort(apSegment, nMerge, j, xCmp); - } - if( nDoclist>0 ){ - pCsr->aDoclist = pCsr->aBuffer; - pCsr->nDoclist = nDoclist; - rc = SQLITE_ROW; - } - } - pCsr->nAdvance = nMerge; - }while( rc==SQLITE_OK ); - - return rc; -} - - -SQLITE_PRIVATE void sqlite3Fts3SegReaderFinish( - Fts3MultiSegReader *pCsr /* Cursor object */ -){ - if( pCsr ){ - int i; - for(i=0; inSegment; i++){ - sqlite3Fts3SegReaderFree(pCsr->apSegment[i]); - } - sqlite3_free(pCsr->apSegment); - sqlite3_free(pCsr->aBuffer); - - pCsr->nSegment = 0; - pCsr->apSegment = 0; - pCsr->aBuffer = 0; - } -} - -/* -** Merge all level iLevel segments in the database into a single -** iLevel+1 segment. Or, if iLevel<0, merge all segments into a -** single segment with a level equal to the numerically largest level -** currently present in the database. -** -** If this function is called with iLevel<0, but there is only one -** segment in the database, SQLITE_DONE is returned immediately. -** Otherwise, if successful, SQLITE_OK is returned. If an error occurs, -** an SQLite error code is returned. -*/ -static int fts3SegmentMerge( - Fts3Table *p, - int iLangid, /* Language id to merge */ - int iIndex, /* Index in p->aIndex[] to merge */ - int iLevel /* Level to merge */ -){ - int rc; /* Return code */ - int iIdx = 0; /* Index of new segment */ - sqlite3_int64 iNewLevel = 0; /* Level/index to create new segment at */ - SegmentWriter *pWriter = 0; /* Used to write the new, merged, segment */ - Fts3SegFilter filter; /* Segment term filter condition */ - Fts3MultiSegReader csr; /* Cursor to iterate through level(s) */ - int bIgnoreEmpty = 0; /* True to ignore empty segments */ - - assert( iLevel==FTS3_SEGCURSOR_ALL - || iLevel==FTS3_SEGCURSOR_PENDING - || iLevel>=0 - ); - assert( iLevel=0 && iIndexnIndex ); - - rc = sqlite3Fts3SegReaderCursor(p, iLangid, iIndex, iLevel, 0, 0, 1, 0, &csr); - if( rc!=SQLITE_OK || csr.nSegment==0 ) goto finished; - - if( iLevel==FTS3_SEGCURSOR_ALL ){ - /* This call is to merge all segments in the database to a single - ** segment. The level of the new segment is equal to the numerically - ** greatest segment level currently present in the database for this - ** index. The idx of the new segment is always 0. */ - if( csr.nSegment==1 ){ - rc = SQLITE_DONE; - goto finished; - } - rc = fts3SegmentMaxLevel(p, iLangid, iIndex, &iNewLevel); - bIgnoreEmpty = 1; - - }else if( iLevel==FTS3_SEGCURSOR_PENDING ){ - iNewLevel = getAbsoluteLevel(p, iLangid, iIndex, 0); - rc = fts3AllocateSegdirIdx(p, iLangid, iIndex, 0, &iIdx); - }else{ - /* This call is to merge all segments at level iLevel. find the next - ** available segment index at level iLevel+1. The call to - ** fts3AllocateSegdirIdx() will merge the segments at level iLevel+1 to - ** a single iLevel+2 segment if necessary. */ - rc = fts3AllocateSegdirIdx(p, iLangid, iIndex, iLevel+1, &iIdx); - iNewLevel = getAbsoluteLevel(p, iLangid, iIndex, iLevel+1); - } - if( rc!=SQLITE_OK ) goto finished; - assert( csr.nSegment>0 ); - assert( iNewLevel>=getAbsoluteLevel(p, iLangid, iIndex, 0) ); - assert( iNewLevelnIndex; i++){ - rc = fts3SegmentMerge(p, p->iPrevLangid, i, FTS3_SEGCURSOR_PENDING); - if( rc==SQLITE_DONE ) rc = SQLITE_OK; - } - sqlite3Fts3PendingTermsClear(p); - - /* Determine the auto-incr-merge setting if unknown. If enabled, - ** estimate the number of leaf blocks of content to be written - */ - if( rc==SQLITE_OK && p->bHasStat - && p->bAutoincrmerge==0xff && p->nLeafAdd>0 - ){ - sqlite3_stmt *pStmt = 0; - rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pStmt, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE); - rc = sqlite3_step(pStmt); - p->bAutoincrmerge = (rc==SQLITE_ROW && sqlite3_column_int(pStmt, 0)); - rc = sqlite3_reset(pStmt); - } - } - return rc; -} - -/* -** Encode N integers as varints into a blob. -*/ -static void fts3EncodeIntArray( - int N, /* The number of integers to encode */ - u32 *a, /* The integer values */ - char *zBuf, /* Write the BLOB here */ - int *pNBuf /* Write number of bytes if zBuf[] used here */ -){ - int i, j; - for(i=j=0; iiPrevDocid. The sizes are encoded as -** a blob of varints. -*/ -static void fts3InsertDocsize( - int *pRC, /* Result code */ - Fts3Table *p, /* Table into which to insert */ - u32 *aSz /* Sizes of each column, in tokens */ -){ - char *pBlob; /* The BLOB encoding of the document size */ - int nBlob; /* Number of bytes in the BLOB */ - sqlite3_stmt *pStmt; /* Statement used to insert the encoding */ - int rc; /* Result code from subfunctions */ - - if( *pRC ) return; - pBlob = sqlite3_malloc( 10*p->nColumn ); - if( pBlob==0 ){ - *pRC = SQLITE_NOMEM; - return; - } - fts3EncodeIntArray(p->nColumn, aSz, pBlob, &nBlob); - rc = fts3SqlStmt(p, SQL_REPLACE_DOCSIZE, &pStmt, 0); - if( rc ){ - sqlite3_free(pBlob); - *pRC = rc; - return; - } - sqlite3_bind_int64(pStmt, 1, p->iPrevDocid); - sqlite3_bind_blob(pStmt, 2, pBlob, nBlob, sqlite3_free); - sqlite3_step(pStmt); - *pRC = sqlite3_reset(pStmt); -} - -/* -** Record 0 of the %_stat table contains a blob consisting of N varints, -** where N is the number of user defined columns in the fts3 table plus -** two. If nCol is the number of user defined columns, then values of the -** varints are set as follows: -** -** Varint 0: Total number of rows in the table. -** -** Varint 1..nCol: For each column, the total number of tokens stored in -** the column for all rows of the table. -** -** Varint 1+nCol: The total size, in bytes, of all text values in all -** columns of all rows of the table. -** -*/ -static void fts3UpdateDocTotals( - int *pRC, /* The result code */ - Fts3Table *p, /* Table being updated */ - u32 *aSzIns, /* Size increases */ - u32 *aSzDel, /* Size decreases */ - int nChng /* Change in the number of documents */ -){ - char *pBlob; /* Storage for BLOB written into %_stat */ - int nBlob; /* Size of BLOB written into %_stat */ - u32 *a; /* Array of integers that becomes the BLOB */ - sqlite3_stmt *pStmt; /* Statement for reading and writing */ - int i; /* Loop counter */ - int rc; /* Result code from subfunctions */ - - const int nStat = p->nColumn+2; - - if( *pRC ) return; - a = sqlite3_malloc( (sizeof(u32)+10)*nStat ); - if( a==0 ){ - *pRC = SQLITE_NOMEM; - return; - } - pBlob = (char*)&a[nStat]; - rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pStmt, 0); - if( rc ){ - sqlite3_free(a); - *pRC = rc; - return; - } - sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); - if( sqlite3_step(pStmt)==SQLITE_ROW ){ - fts3DecodeIntArray(nStat, a, - sqlite3_column_blob(pStmt, 0), - sqlite3_column_bytes(pStmt, 0)); - }else{ - memset(a, 0, sizeof(u32)*(nStat) ); - } - rc = sqlite3_reset(pStmt); - if( rc!=SQLITE_OK ){ - sqlite3_free(a); - *pRC = rc; - return; - } - if( nChng<0 && a[0]<(u32)(-nChng) ){ - a[0] = 0; - }else{ - a[0] += nChng; - } - for(i=0; inColumn+1; i++){ - u32 x = a[i+1]; - if( x+aSzIns[i] < aSzDel[i] ){ - x = 0; - }else{ - x = x + aSzIns[i] - aSzDel[i]; - } - a[i+1] = x; - } - fts3EncodeIntArray(nStat, a, pBlob, &nBlob); - rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pStmt, 0); - if( rc ){ - sqlite3_free(a); - *pRC = rc; - return; - } - sqlite3_bind_int(pStmt, 1, FTS_STAT_DOCTOTAL); - sqlite3_bind_blob(pStmt, 2, pBlob, nBlob, SQLITE_STATIC); - sqlite3_step(pStmt); - *pRC = sqlite3_reset(pStmt); - sqlite3_free(a); -} - -/* -** Merge the entire database so that there is one segment for each -** iIndex/iLangid combination. -*/ -static int fts3DoOptimize(Fts3Table *p, int bReturnDone){ - int bSeenDone = 0; - int rc; - sqlite3_stmt *pAllLangid = 0; - - rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0); - if( rc==SQLITE_OK ){ - int rc2; - sqlite3_bind_int(pAllLangid, 1, p->nIndex); - while( sqlite3_step(pAllLangid)==SQLITE_ROW ){ - int i; - int iLangid = sqlite3_column_int(pAllLangid, 0); - for(i=0; rc==SQLITE_OK && inIndex; i++){ - rc = fts3SegmentMerge(p, iLangid, i, FTS3_SEGCURSOR_ALL); - if( rc==SQLITE_DONE ){ - bSeenDone = 1; - rc = SQLITE_OK; - } - } - } - rc2 = sqlite3_reset(pAllLangid); - if( rc==SQLITE_OK ) rc = rc2; - } - - sqlite3Fts3SegmentsClose(p); - sqlite3Fts3PendingTermsClear(p); - - return (rc==SQLITE_OK && bReturnDone && bSeenDone) ? SQLITE_DONE : rc; -} - -/* -** This function is called when the user executes the following statement: -** -** INSERT INTO () VALUES('rebuild'); -** -** The entire FTS index is discarded and rebuilt. If the table is one -** created using the content=xxx option, then the new index is based on -** the current contents of the xxx table. Otherwise, it is rebuilt based -** on the contents of the %_content table. -*/ -static int fts3DoRebuild(Fts3Table *p){ - int rc; /* Return Code */ - - rc = fts3DeleteAll(p, 0); - if( rc==SQLITE_OK ){ - u32 *aSz = 0; - u32 *aSzIns = 0; - u32 *aSzDel = 0; - sqlite3_stmt *pStmt = 0; - int nEntry = 0; - - /* Compose and prepare an SQL statement to loop through the content table */ - char *zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist); - if( !zSql ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); - } - - if( rc==SQLITE_OK ){ - int nByte = sizeof(u32) * (p->nColumn+1)*3; - aSz = (u32 *)sqlite3_malloc(nByte); - if( aSz==0 ){ - rc = SQLITE_NOMEM; - }else{ - memset(aSz, 0, nByte); - aSzIns = &aSz[p->nColumn+1]; - aSzDel = &aSzIns[p->nColumn+1]; - } - } - - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ - int iCol; - int iLangid = langidFromSelect(p, pStmt); - rc = fts3PendingTermsDocid(p, iLangid, sqlite3_column_int64(pStmt, 0)); - memset(aSz, 0, sizeof(aSz[0]) * (p->nColumn+1)); - for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){ - if( p->abNotindexed[iCol]==0 ){ - const char *z = (const char *) sqlite3_column_text(pStmt, iCol+1); - rc = fts3PendingTermsAdd(p, iLangid, z, iCol, &aSz[iCol]); - aSz[p->nColumn] += sqlite3_column_bytes(pStmt, iCol+1); - } - } - if( p->bHasDocsize ){ - fts3InsertDocsize(&rc, p, aSz); - } - if( rc!=SQLITE_OK ){ - sqlite3_finalize(pStmt); - pStmt = 0; - }else{ - nEntry++; - for(iCol=0; iCol<=p->nColumn; iCol++){ - aSzIns[iCol] += aSz[iCol]; - } - } - } - if( p->bFts4 ){ - fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nEntry); - } - sqlite3_free(aSz); - - if( pStmt ){ - int rc2 = sqlite3_finalize(pStmt); - if( rc==SQLITE_OK ){ - rc = rc2; - } - } - } - - return rc; -} - - -/* -** This function opens a cursor used to read the input data for an -** incremental merge operation. Specifically, it opens a cursor to scan -** the oldest nSeg segments (idx=0 through idx=(nSeg-1)) in absolute -** level iAbsLevel. -*/ -static int fts3IncrmergeCsr( - Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level to open */ - int nSeg, /* Number of segments to merge */ - Fts3MultiSegReader *pCsr /* Cursor object to populate */ -){ - int rc; /* Return Code */ - sqlite3_stmt *pStmt = 0; /* Statement used to read %_segdir entry */ - int nByte; /* Bytes allocated at pCsr->apSegment[] */ - - /* Allocate space for the Fts3MultiSegReader.aCsr[] array */ - memset(pCsr, 0, sizeof(*pCsr)); - nByte = sizeof(Fts3SegReader *) * nSeg; - pCsr->apSegment = (Fts3SegReader **)sqlite3_malloc(nByte); - - if( pCsr->apSegment==0 ){ - rc = SQLITE_NOMEM; - }else{ - memset(pCsr->apSegment, 0, nByte); - rc = fts3SqlStmt(p, SQL_SELECT_LEVEL, &pStmt, 0); - } - if( rc==SQLITE_OK ){ - int i; - int rc2; - sqlite3_bind_int64(pStmt, 1, iAbsLevel); - assert( pCsr->nSegment==0 ); - for(i=0; rc==SQLITE_OK && sqlite3_step(pStmt)==SQLITE_ROW && iapSegment[i] - ); - pCsr->nSegment++; - } - rc2 = sqlite3_reset(pStmt); - if( rc==SQLITE_OK ) rc = rc2; - } - - return rc; -} - -typedef struct IncrmergeWriter IncrmergeWriter; -typedef struct NodeWriter NodeWriter; -typedef struct Blob Blob; -typedef struct NodeReader NodeReader; - -/* -** An instance of the following structure is used as a dynamic buffer -** to build up nodes or other blobs of data in. -** -** The function blobGrowBuffer() is used to extend the allocation. -*/ -struct Blob { - char *a; /* Pointer to allocation */ - int n; /* Number of valid bytes of data in a[] */ - int nAlloc; /* Allocated size of a[] (nAlloc>=n) */ -}; - -/* -** This structure is used to build up buffers containing segment b-tree -** nodes (blocks). -*/ -struct NodeWriter { - sqlite3_int64 iBlock; /* Current block id */ - Blob key; /* Last key written to the current block */ - Blob block; /* Current block image */ -}; - -/* -** An object of this type contains the state required to create or append -** to an appendable b-tree segment. -*/ -struct IncrmergeWriter { - int nLeafEst; /* Space allocated for leaf blocks */ - int nWork; /* Number of leaf pages flushed */ - sqlite3_int64 iAbsLevel; /* Absolute level of input segments */ - int iIdx; /* Index of *output* segment in iAbsLevel+1 */ - sqlite3_int64 iStart; /* Block number of first allocated block */ - sqlite3_int64 iEnd; /* Block number of last allocated block */ - NodeWriter aNodeWriter[FTS_MAX_APPENDABLE_HEIGHT]; -}; - -/* -** An object of the following type is used to read data from a single -** FTS segment node. See the following functions: -** -** nodeReaderInit() -** nodeReaderNext() -** nodeReaderRelease() -*/ -struct NodeReader { - const char *aNode; - int nNode; - int iOff; /* Current offset within aNode[] */ - - /* Output variables. Containing the current node entry. */ - sqlite3_int64 iChild; /* Pointer to child node */ - Blob term; /* Current term */ - const char *aDoclist; /* Pointer to doclist */ - int nDoclist; /* Size of doclist in bytes */ -}; - -/* -** If *pRc is not SQLITE_OK when this function is called, it is a no-op. -** Otherwise, if the allocation at pBlob->a is not already at least nMin -** bytes in size, extend (realloc) it to be so. -** -** If an OOM error occurs, set *pRc to SQLITE_NOMEM and leave pBlob->a -** unmodified. Otherwise, if the allocation succeeds, update pBlob->nAlloc -** to reflect the new size of the pBlob->a[] buffer. -*/ -static void blobGrowBuffer(Blob *pBlob, int nMin, int *pRc){ - if( *pRc==SQLITE_OK && nMin>pBlob->nAlloc ){ - int nAlloc = nMin; - char *a = (char *)sqlite3_realloc(pBlob->a, nAlloc); - if( a ){ - pBlob->nAlloc = nAlloc; - pBlob->a = a; - }else{ - *pRc = SQLITE_NOMEM; - } - } -} - -/* -** Attempt to advance the node-reader object passed as the first argument to -** the next entry on the node. -** -** Return an error code if an error occurs (SQLITE_NOMEM is possible). -** Otherwise return SQLITE_OK. If there is no next entry on the node -** (e.g. because the current entry is the last) set NodeReader->aNode to -** NULL to indicate EOF. Otherwise, populate the NodeReader structure output -** variables for the new entry. -*/ -static int nodeReaderNext(NodeReader *p){ - int bFirst = (p->term.n==0); /* True for first term on the node */ - int nPrefix = 0; /* Bytes to copy from previous term */ - int nSuffix = 0; /* Bytes to append to the prefix */ - int rc = SQLITE_OK; /* Return code */ - - assert( p->aNode ); - if( p->iChild && bFirst==0 ) p->iChild++; - if( p->iOff>=p->nNode ){ - /* EOF */ - p->aNode = 0; - }else{ - if( bFirst==0 ){ - p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nPrefix); - } - p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &nSuffix); - - blobGrowBuffer(&p->term, nPrefix+nSuffix, &rc); - if( rc==SQLITE_OK ){ - memcpy(&p->term.a[nPrefix], &p->aNode[p->iOff], nSuffix); - p->term.n = nPrefix+nSuffix; - p->iOff += nSuffix; - if( p->iChild==0 ){ - p->iOff += fts3GetVarint32(&p->aNode[p->iOff], &p->nDoclist); - p->aDoclist = &p->aNode[p->iOff]; - p->iOff += p->nDoclist; - } - } - } - - assert( p->iOff<=p->nNode ); - - return rc; -} - -/* -** Release all dynamic resources held by node-reader object *p. -*/ -static void nodeReaderRelease(NodeReader *p){ - sqlite3_free(p->term.a); -} - -/* -** Initialize a node-reader object to read the node in buffer aNode/nNode. -** -** If successful, SQLITE_OK is returned and the NodeReader object set to -** point to the first entry on the node (if any). Otherwise, an SQLite -** error code is returned. -*/ -static int nodeReaderInit(NodeReader *p, const char *aNode, int nNode){ - memset(p, 0, sizeof(NodeReader)); - p->aNode = aNode; - p->nNode = nNode; - - /* Figure out if this is a leaf or an internal node. */ - if( p->aNode[0] ){ - /* An internal node. */ - p->iOff = 1 + sqlite3Fts3GetVarint(&p->aNode[1], &p->iChild); - }else{ - p->iOff = 1; - } - - return nodeReaderNext(p); -} - -/* -** This function is called while writing an FTS segment each time a leaf o -** node is finished and written to disk. The key (zTerm/nTerm) is guaranteed -** to be greater than the largest key on the node just written, but smaller -** than or equal to the first key that will be written to the next leaf -** node. -** -** The block id of the leaf node just written to disk may be found in -** (pWriter->aNodeWriter[0].iBlock) when this function is called. -*/ -static int fts3IncrmergePush( - Fts3Table *p, /* Fts3 table handle */ - IncrmergeWriter *pWriter, /* Writer object */ - const char *zTerm, /* Term to write to internal node */ - int nTerm /* Bytes at zTerm */ -){ - sqlite3_int64 iPtr = pWriter->aNodeWriter[0].iBlock; - int iLayer; - - assert( nTerm>0 ); - for(iLayer=1; ALWAYS(iLayeraNodeWriter[iLayer]; - int rc = SQLITE_OK; - int nPrefix; - int nSuffix; - int nSpace; - - /* Figure out how much space the key will consume if it is written to - ** the current node of layer iLayer. Due to the prefix compression, - ** the space required changes depending on which node the key is to - ** be added to. */ - nPrefix = fts3PrefixCompress(pNode->key.a, pNode->key.n, zTerm, nTerm); - nSuffix = nTerm - nPrefix; - nSpace = sqlite3Fts3VarintLen(nPrefix); - nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix; - - if( pNode->key.n==0 || (pNode->block.n + nSpace)<=p->nNodeSize ){ - /* If the current node of layer iLayer contains zero keys, or if adding - ** the key to it will not cause it to grow to larger than nNodeSize - ** bytes in size, write the key here. */ - - Blob *pBlk = &pNode->block; - if( pBlk->n==0 ){ - blobGrowBuffer(pBlk, p->nNodeSize, &rc); - if( rc==SQLITE_OK ){ - pBlk->a[0] = (char)iLayer; - pBlk->n = 1 + sqlite3Fts3PutVarint(&pBlk->a[1], iPtr); - } - } - blobGrowBuffer(pBlk, pBlk->n + nSpace, &rc); - blobGrowBuffer(&pNode->key, nTerm, &rc); - - if( rc==SQLITE_OK ){ - if( pNode->key.n ){ - pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nPrefix); - } - pBlk->n += sqlite3Fts3PutVarint(&pBlk->a[pBlk->n], nSuffix); - memcpy(&pBlk->a[pBlk->n], &zTerm[nPrefix], nSuffix); - pBlk->n += nSuffix; - - memcpy(pNode->key.a, zTerm, nTerm); - pNode->key.n = nTerm; - } - }else{ - /* Otherwise, flush the current node of layer iLayer to disk. - ** Then allocate a new, empty sibling node. The key will be written - ** into the parent of this node. */ - rc = fts3WriteSegment(p, pNode->iBlock, pNode->block.a, pNode->block.n); - - assert( pNode->block.nAlloc>=p->nNodeSize ); - pNode->block.a[0] = (char)iLayer; - pNode->block.n = 1 + sqlite3Fts3PutVarint(&pNode->block.a[1], iPtr+1); - - iNextPtr = pNode->iBlock; - pNode->iBlock++; - pNode->key.n = 0; - } - - if( rc!=SQLITE_OK || iNextPtr==0 ) return rc; - iPtr = iNextPtr; - } - - assert( 0 ); - return 0; -} - -/* -** Append a term and (optionally) doclist to the FTS segment node currently -** stored in blob *pNode. The node need not contain any terms, but the -** header must be written before this function is called. -** -** A node header is a single 0x00 byte for a leaf node, or a height varint -** followed by the left-hand-child varint for an internal node. -** -** The term to be appended is passed via arguments zTerm/nTerm. For a -** leaf node, the doclist is passed as aDoclist/nDoclist. For an internal -** node, both aDoclist and nDoclist must be passed 0. -** -** If the size of the value in blob pPrev is zero, then this is the first -** term written to the node. Otherwise, pPrev contains a copy of the -** previous term. Before this function returns, it is updated to contain a -** copy of zTerm/nTerm. -** -** It is assumed that the buffer associated with pNode is already large -** enough to accommodate the new entry. The buffer associated with pPrev -** is extended by this function if requrired. -** -** If an error (i.e. OOM condition) occurs, an SQLite error code is -** returned. Otherwise, SQLITE_OK. -*/ -static int fts3AppendToNode( - Blob *pNode, /* Current node image to append to */ - Blob *pPrev, /* Buffer containing previous term written */ - const char *zTerm, /* New term to write */ - int nTerm, /* Size of zTerm in bytes */ - const char *aDoclist, /* Doclist (or NULL) to write */ - int nDoclist /* Size of aDoclist in bytes */ -){ - int rc = SQLITE_OK; /* Return code */ - int bFirst = (pPrev->n==0); /* True if this is the first term written */ - int nPrefix; /* Size of term prefix in bytes */ - int nSuffix; /* Size of term suffix in bytes */ - - /* Node must have already been started. There must be a doclist for a - ** leaf node, and there must not be a doclist for an internal node. */ - assert( pNode->n>0 ); - assert( (pNode->a[0]=='\0')==(aDoclist!=0) ); - - blobGrowBuffer(pPrev, nTerm, &rc); - if( rc!=SQLITE_OK ) return rc; - - nPrefix = fts3PrefixCompress(pPrev->a, pPrev->n, zTerm, nTerm); - nSuffix = nTerm - nPrefix; - memcpy(pPrev->a, zTerm, nTerm); - pPrev->n = nTerm; - - if( bFirst==0 ){ - pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nPrefix); - } - pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nSuffix); - memcpy(&pNode->a[pNode->n], &zTerm[nPrefix], nSuffix); - pNode->n += nSuffix; - - if( aDoclist ){ - pNode->n += sqlite3Fts3PutVarint(&pNode->a[pNode->n], nDoclist); - memcpy(&pNode->a[pNode->n], aDoclist, nDoclist); - pNode->n += nDoclist; - } - - assert( pNode->n<=pNode->nAlloc ); - - return SQLITE_OK; -} - -/* -** Append the current term and doclist pointed to by cursor pCsr to the -** appendable b-tree segment opened for writing by pWriter. -** -** Return SQLITE_OK if successful, or an SQLite error code otherwise. -*/ -static int fts3IncrmergeAppend( - Fts3Table *p, /* Fts3 table handle */ - IncrmergeWriter *pWriter, /* Writer object */ - Fts3MultiSegReader *pCsr /* Cursor containing term and doclist */ -){ - const char *zTerm = pCsr->zTerm; - int nTerm = pCsr->nTerm; - const char *aDoclist = pCsr->aDoclist; - int nDoclist = pCsr->nDoclist; - int rc = SQLITE_OK; /* Return code */ - int nSpace; /* Total space in bytes required on leaf */ - int nPrefix; /* Size of prefix shared with previous term */ - int nSuffix; /* Size of suffix (nTerm - nPrefix) */ - NodeWriter *pLeaf; /* Object used to write leaf nodes */ - - pLeaf = &pWriter->aNodeWriter[0]; - nPrefix = fts3PrefixCompress(pLeaf->key.a, pLeaf->key.n, zTerm, nTerm); - nSuffix = nTerm - nPrefix; - - nSpace = sqlite3Fts3VarintLen(nPrefix); - nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix; - nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist; - - /* If the current block is not empty, and if adding this term/doclist - ** to the current block would make it larger than Fts3Table.nNodeSize - ** bytes, write this block out to the database. */ - if( pLeaf->block.n>0 && (pLeaf->block.n + nSpace)>p->nNodeSize ){ - rc = fts3WriteSegment(p, pLeaf->iBlock, pLeaf->block.a, pLeaf->block.n); - pWriter->nWork++; - - /* Add the current term to the parent node. The term added to the - ** parent must: - ** - ** a) be greater than the largest term on the leaf node just written - ** to the database (still available in pLeaf->key), and - ** - ** b) be less than or equal to the term about to be added to the new - ** leaf node (zTerm/nTerm). - ** - ** In other words, it must be the prefix of zTerm 1 byte longer than - ** the common prefix (if any) of zTerm and pWriter->zTerm. - */ - if( rc==SQLITE_OK ){ - rc = fts3IncrmergePush(p, pWriter, zTerm, nPrefix+1); - } - - /* Advance to the next output block */ - pLeaf->iBlock++; - pLeaf->key.n = 0; - pLeaf->block.n = 0; - - nSuffix = nTerm; - nSpace = 1; - nSpace += sqlite3Fts3VarintLen(nSuffix) + nSuffix; - nSpace += sqlite3Fts3VarintLen(nDoclist) + nDoclist; - } - - blobGrowBuffer(&pLeaf->block, pLeaf->block.n + nSpace, &rc); - - if( rc==SQLITE_OK ){ - if( pLeaf->block.n==0 ){ - pLeaf->block.n = 1; - pLeaf->block.a[0] = '\0'; - } - rc = fts3AppendToNode( - &pLeaf->block, &pLeaf->key, zTerm, nTerm, aDoclist, nDoclist - ); - } - - return rc; -} - -/* -** This function is called to release all dynamic resources held by the -** merge-writer object pWriter, and if no error has occurred, to flush -** all outstanding node buffers held by pWriter to disk. -** -** If *pRc is not SQLITE_OK when this function is called, then no attempt -** is made to write any data to disk. Instead, this function serves only -** to release outstanding resources. -** -** Otherwise, if *pRc is initially SQLITE_OK and an error occurs while -** flushing buffers to disk, *pRc is set to an SQLite error code before -** returning. -*/ -static void fts3IncrmergeRelease( - Fts3Table *p, /* FTS3 table handle */ - IncrmergeWriter *pWriter, /* Merge-writer object */ - int *pRc /* IN/OUT: Error code */ -){ - int i; /* Used to iterate through non-root layers */ - int iRoot; /* Index of root in pWriter->aNodeWriter */ - NodeWriter *pRoot; /* NodeWriter for root node */ - int rc = *pRc; /* Error code */ - - /* Set iRoot to the index in pWriter->aNodeWriter[] of the output segment - ** root node. If the segment fits entirely on a single leaf node, iRoot - ** will be set to 0. If the root node is the parent of the leaves, iRoot - ** will be 1. And so on. */ - for(iRoot=FTS_MAX_APPENDABLE_HEIGHT-1; iRoot>=0; iRoot--){ - NodeWriter *pNode = &pWriter->aNodeWriter[iRoot]; - if( pNode->block.n>0 ) break; - assert( *pRc || pNode->block.nAlloc==0 ); - assert( *pRc || pNode->key.nAlloc==0 ); - sqlite3_free(pNode->block.a); - sqlite3_free(pNode->key.a); - } - - /* Empty output segment. This is a no-op. */ - if( iRoot<0 ) return; - - /* The entire output segment fits on a single node. Normally, this means - ** the node would be stored as a blob in the "root" column of the %_segdir - ** table. However, this is not permitted in this case. The problem is that - ** space has already been reserved in the %_segments table, and so the - ** start_block and end_block fields of the %_segdir table must be populated. - ** And, by design or by accident, released versions of FTS cannot handle - ** segments that fit entirely on the root node with start_block!=0. - ** - ** Instead, create a synthetic root node that contains nothing but a - ** pointer to the single content node. So that the segment consists of a - ** single leaf and a single interior (root) node. - ** - ** Todo: Better might be to defer allocating space in the %_segments - ** table until we are sure it is needed. - */ - if( iRoot==0 ){ - Blob *pBlock = &pWriter->aNodeWriter[1].block; - blobGrowBuffer(pBlock, 1 + FTS3_VARINT_MAX, &rc); - if( rc==SQLITE_OK ){ - pBlock->a[0] = 0x01; - pBlock->n = 1 + sqlite3Fts3PutVarint( - &pBlock->a[1], pWriter->aNodeWriter[0].iBlock - ); - } - iRoot = 1; - } - pRoot = &pWriter->aNodeWriter[iRoot]; - - /* Flush all currently outstanding nodes to disk. */ - for(i=0; iaNodeWriter[i]; - if( pNode->block.n>0 && rc==SQLITE_OK ){ - rc = fts3WriteSegment(p, pNode->iBlock, pNode->block.a, pNode->block.n); - } - sqlite3_free(pNode->block.a); - sqlite3_free(pNode->key.a); - } - - /* Write the %_segdir record. */ - if( rc==SQLITE_OK ){ - rc = fts3WriteSegdir(p, - pWriter->iAbsLevel+1, /* level */ - pWriter->iIdx, /* idx */ - pWriter->iStart, /* start_block */ - pWriter->aNodeWriter[0].iBlock, /* leaves_end_block */ - pWriter->iEnd, /* end_block */ - pRoot->block.a, pRoot->block.n /* root */ - ); - } - sqlite3_free(pRoot->block.a); - sqlite3_free(pRoot->key.a); - - *pRc = rc; -} - -/* -** Compare the term in buffer zLhs (size in bytes nLhs) with that in -** zRhs (size in bytes nRhs) using memcmp. If one term is a prefix of -** the other, it is considered to be smaller than the other. -** -** Return -ve if zLhs is smaller than zRhs, 0 if it is equal, or +ve -** if it is greater. -*/ -static int fts3TermCmp( - const char *zLhs, int nLhs, /* LHS of comparison */ - const char *zRhs, int nRhs /* RHS of comparison */ -){ - int nCmp = MIN(nLhs, nRhs); - int res; - - res = memcmp(zLhs, zRhs, nCmp); - if( res==0 ) res = nLhs - nRhs; - - return res; -} - - -/* -** Query to see if the entry in the %_segments table with blockid iEnd is -** NULL. If no error occurs and the entry is NULL, set *pbRes 1 before -** returning. Otherwise, set *pbRes to 0. -** -** Or, if an error occurs while querying the database, return an SQLite -** error code. The final value of *pbRes is undefined in this case. -** -** This is used to test if a segment is an "appendable" segment. If it -** is, then a NULL entry has been inserted into the %_segments table -** with blockid %_segdir.end_block. -*/ -static int fts3IsAppendable(Fts3Table *p, sqlite3_int64 iEnd, int *pbRes){ - int bRes = 0; /* Result to set *pbRes to */ - sqlite3_stmt *pCheck = 0; /* Statement to query database with */ - int rc; /* Return code */ - - rc = fts3SqlStmt(p, SQL_SEGMENT_IS_APPENDABLE, &pCheck, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pCheck, 1, iEnd); - if( SQLITE_ROW==sqlite3_step(pCheck) ) bRes = 1; - rc = sqlite3_reset(pCheck); - } - - *pbRes = bRes; - return rc; -} - -/* -** This function is called when initializing an incremental-merge operation. -** It checks if the existing segment with index value iIdx at absolute level -** (iAbsLevel+1) can be appended to by the incremental merge. If it can, the -** merge-writer object *pWriter is initialized to write to it. -** -** An existing segment can be appended to by an incremental merge if: -** -** * It was initially created as an appendable segment (with all required -** space pre-allocated), and -** -** * The first key read from the input (arguments zKey and nKey) is -** greater than the largest key currently stored in the potential -** output segment. -*/ -static int fts3IncrmergeLoad( - Fts3Table *p, /* Fts3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level of input segments */ - int iIdx, /* Index of candidate output segment */ - const char *zKey, /* First key to write */ - int nKey, /* Number of bytes in nKey */ - IncrmergeWriter *pWriter /* Populate this object */ -){ - int rc; /* Return code */ - sqlite3_stmt *pSelect = 0; /* SELECT to read %_segdir entry */ - - rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR, &pSelect, 0); - if( rc==SQLITE_OK ){ - sqlite3_int64 iStart = 0; /* Value of %_segdir.start_block */ - sqlite3_int64 iLeafEnd = 0; /* Value of %_segdir.leaves_end_block */ - sqlite3_int64 iEnd = 0; /* Value of %_segdir.end_block */ - const char *aRoot = 0; /* Pointer to %_segdir.root buffer */ - int nRoot = 0; /* Size of aRoot[] in bytes */ - int rc2; /* Return code from sqlite3_reset() */ - int bAppendable = 0; /* Set to true if segment is appendable */ - - /* Read the %_segdir entry for index iIdx absolute level (iAbsLevel+1) */ - sqlite3_bind_int64(pSelect, 1, iAbsLevel+1); - sqlite3_bind_int(pSelect, 2, iIdx); - if( sqlite3_step(pSelect)==SQLITE_ROW ){ - iStart = sqlite3_column_int64(pSelect, 1); - iLeafEnd = sqlite3_column_int64(pSelect, 2); - iEnd = sqlite3_column_int64(pSelect, 3); - nRoot = sqlite3_column_bytes(pSelect, 4); - aRoot = sqlite3_column_blob(pSelect, 4); - }else{ - return sqlite3_reset(pSelect); - } - - /* Check for the zero-length marker in the %_segments table */ - rc = fts3IsAppendable(p, iEnd, &bAppendable); - - /* Check that zKey/nKey is larger than the largest key the candidate */ - if( rc==SQLITE_OK && bAppendable ){ - char *aLeaf = 0; - int nLeaf = 0; - - rc = sqlite3Fts3ReadBlock(p, iLeafEnd, &aLeaf, &nLeaf, 0); - if( rc==SQLITE_OK ){ - NodeReader reader; - for(rc = nodeReaderInit(&reader, aLeaf, nLeaf); - rc==SQLITE_OK && reader.aNode; - rc = nodeReaderNext(&reader) - ){ - assert( reader.aNode ); - } - if( fts3TermCmp(zKey, nKey, reader.term.a, reader.term.n)<=0 ){ - bAppendable = 0; - } - nodeReaderRelease(&reader); - } - sqlite3_free(aLeaf); - } - - if( rc==SQLITE_OK && bAppendable ){ - /* It is possible to append to this segment. Set up the IncrmergeWriter - ** object to do so. */ - int i; - int nHeight = (int)aRoot[0]; - NodeWriter *pNode; - - pWriter->nLeafEst = (int)((iEnd - iStart) + 1)/FTS_MAX_APPENDABLE_HEIGHT; - pWriter->iStart = iStart; - pWriter->iEnd = iEnd; - pWriter->iAbsLevel = iAbsLevel; - pWriter->iIdx = iIdx; - - for(i=nHeight+1; iaNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst; - } - - pNode = &pWriter->aNodeWriter[nHeight]; - pNode->iBlock = pWriter->iStart + pWriter->nLeafEst*nHeight; - blobGrowBuffer(&pNode->block, MAX(nRoot, p->nNodeSize), &rc); - if( rc==SQLITE_OK ){ - memcpy(pNode->block.a, aRoot, nRoot); - pNode->block.n = nRoot; - } - - for(i=nHeight; i>=0 && rc==SQLITE_OK; i--){ - NodeReader reader; - pNode = &pWriter->aNodeWriter[i]; - - rc = nodeReaderInit(&reader, pNode->block.a, pNode->block.n); - while( reader.aNode && rc==SQLITE_OK ) rc = nodeReaderNext(&reader); - blobGrowBuffer(&pNode->key, reader.term.n, &rc); - if( rc==SQLITE_OK ){ - memcpy(pNode->key.a, reader.term.a, reader.term.n); - pNode->key.n = reader.term.n; - if( i>0 ){ - char *aBlock = 0; - int nBlock = 0; - pNode = &pWriter->aNodeWriter[i-1]; - pNode->iBlock = reader.iChild; - rc = sqlite3Fts3ReadBlock(p, reader.iChild, &aBlock, &nBlock, 0); - blobGrowBuffer(&pNode->block, MAX(nBlock, p->nNodeSize), &rc); - if( rc==SQLITE_OK ){ - memcpy(pNode->block.a, aBlock, nBlock); - pNode->block.n = nBlock; - } - sqlite3_free(aBlock); - } - } - nodeReaderRelease(&reader); - } - } - - rc2 = sqlite3_reset(pSelect); - if( rc==SQLITE_OK ) rc = rc2; - } - - return rc; -} - -/* -** Determine the largest segment index value that exists within absolute -** level iAbsLevel+1. If no error occurs, set *piIdx to this value plus -** one before returning SQLITE_OK. Or, if there are no segments at all -** within level iAbsLevel, set *piIdx to zero. -** -** If an error occurs, return an SQLite error code. The final value of -** *piIdx is undefined in this case. -*/ -static int fts3IncrmergeOutputIdx( - Fts3Table *p, /* FTS Table handle */ - sqlite3_int64 iAbsLevel, /* Absolute index of input segments */ - int *piIdx /* OUT: Next free index at iAbsLevel+1 */ -){ - int rc; - sqlite3_stmt *pOutputIdx = 0; /* SQL used to find output index */ - - rc = fts3SqlStmt(p, SQL_NEXT_SEGMENT_INDEX, &pOutputIdx, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pOutputIdx, 1, iAbsLevel+1); - sqlite3_step(pOutputIdx); - *piIdx = sqlite3_column_int(pOutputIdx, 0); - rc = sqlite3_reset(pOutputIdx); - } - - return rc; -} - -/* -** Allocate an appendable output segment on absolute level iAbsLevel+1 -** with idx value iIdx. -** -** In the %_segdir table, a segment is defined by the values in three -** columns: -** -** start_block -** leaves_end_block -** end_block -** -** When an appendable segment is allocated, it is estimated that the -** maximum number of leaf blocks that may be required is the sum of the -** number of leaf blocks consumed by the input segments, plus the number -** of input segments, multiplied by two. This value is stored in stack -** variable nLeafEst. -** -** A total of 16*nLeafEst blocks are allocated when an appendable segment -** is created ((1 + end_block - start_block)==16*nLeafEst). The contiguous -** array of leaf nodes starts at the first block allocated. The array -** of interior nodes that are parents of the leaf nodes start at block -** (start_block + (1 + end_block - start_block) / 16). And so on. -** -** In the actual code below, the value "16" is replaced with the -** pre-processor macro FTS_MAX_APPENDABLE_HEIGHT. -*/ -static int fts3IncrmergeWriter( - Fts3Table *p, /* Fts3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level of input segments */ - int iIdx, /* Index of new output segment */ - Fts3MultiSegReader *pCsr, /* Cursor that data will be read from */ - IncrmergeWriter *pWriter /* Populate this object */ -){ - int rc; /* Return Code */ - int i; /* Iterator variable */ - int nLeafEst = 0; /* Blocks allocated for leaf nodes */ - sqlite3_stmt *pLeafEst = 0; /* SQL used to determine nLeafEst */ - sqlite3_stmt *pFirstBlock = 0; /* SQL used to determine first block */ - - /* Calculate nLeafEst. */ - rc = fts3SqlStmt(p, SQL_MAX_LEAF_NODE_ESTIMATE, &pLeafEst, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pLeafEst, 1, iAbsLevel); - sqlite3_bind_int64(pLeafEst, 2, pCsr->nSegment); - if( SQLITE_ROW==sqlite3_step(pLeafEst) ){ - nLeafEst = sqlite3_column_int(pLeafEst, 0); - } - rc = sqlite3_reset(pLeafEst); - } - if( rc!=SQLITE_OK ) return rc; - - /* Calculate the first block to use in the output segment */ - rc = fts3SqlStmt(p, SQL_NEXT_SEGMENTS_ID, &pFirstBlock, 0); - if( rc==SQLITE_OK ){ - if( SQLITE_ROW==sqlite3_step(pFirstBlock) ){ - pWriter->iStart = sqlite3_column_int64(pFirstBlock, 0); - pWriter->iEnd = pWriter->iStart - 1; - pWriter->iEnd += nLeafEst * FTS_MAX_APPENDABLE_HEIGHT; - } - rc = sqlite3_reset(pFirstBlock); - } - if( rc!=SQLITE_OK ) return rc; - - /* Insert the marker in the %_segments table to make sure nobody tries - ** to steal the space just allocated. This is also used to identify - ** appendable segments. */ - rc = fts3WriteSegment(p, pWriter->iEnd, 0, 0); - if( rc!=SQLITE_OK ) return rc; - - pWriter->iAbsLevel = iAbsLevel; - pWriter->nLeafEst = nLeafEst; - pWriter->iIdx = iIdx; - - /* Set up the array of NodeWriter objects */ - for(i=0; iaNodeWriter[i].iBlock = pWriter->iStart + i*pWriter->nLeafEst; - } - return SQLITE_OK; -} - -/* -** Remove an entry from the %_segdir table. This involves running the -** following two statements: -** -** DELETE FROM %_segdir WHERE level = :iAbsLevel AND idx = :iIdx -** UPDATE %_segdir SET idx = idx - 1 WHERE level = :iAbsLevel AND idx > :iIdx -** -** The DELETE statement removes the specific %_segdir level. The UPDATE -** statement ensures that the remaining segments have contiguously allocated -** idx values. -*/ -static int fts3RemoveSegdirEntry( - Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level to delete from */ - int iIdx /* Index of %_segdir entry to delete */ -){ - int rc; /* Return code */ - sqlite3_stmt *pDelete = 0; /* DELETE statement */ - - rc = fts3SqlStmt(p, SQL_DELETE_SEGDIR_ENTRY, &pDelete, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDelete, 1, iAbsLevel); - sqlite3_bind_int(pDelete, 2, iIdx); - sqlite3_step(pDelete); - rc = sqlite3_reset(pDelete); - } - - return rc; -} - -/* -** One or more segments have just been removed from absolute level iAbsLevel. -** Update the 'idx' values of the remaining segments in the level so that -** the idx values are a contiguous sequence starting from 0. -*/ -static int fts3RepackSegdirLevel( - Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iAbsLevel /* Absolute level to repack */ -){ - int rc; /* Return code */ - int *aIdx = 0; /* Array of remaining idx values */ - int nIdx = 0; /* Valid entries in aIdx[] */ - int nAlloc = 0; /* Allocated size of aIdx[] */ - int i; /* Iterator variable */ - sqlite3_stmt *pSelect = 0; /* Select statement to read idx values */ - sqlite3_stmt *pUpdate = 0; /* Update statement to modify idx values */ - - rc = fts3SqlStmt(p, SQL_SELECT_INDEXES, &pSelect, 0); - if( rc==SQLITE_OK ){ - int rc2; - sqlite3_bind_int64(pSelect, 1, iAbsLevel); - while( SQLITE_ROW==sqlite3_step(pSelect) ){ - if( nIdx>=nAlloc ){ - int *aNew; - nAlloc += 16; - aNew = sqlite3_realloc(aIdx, nAlloc*sizeof(int)); - if( !aNew ){ - rc = SQLITE_NOMEM; - break; - } - aIdx = aNew; - } - aIdx[nIdx++] = sqlite3_column_int(pSelect, 0); - } - rc2 = sqlite3_reset(pSelect); - if( rc==SQLITE_OK ) rc = rc2; - } - - if( rc==SQLITE_OK ){ - rc = fts3SqlStmt(p, SQL_SHIFT_SEGDIR_ENTRY, &pUpdate, 0); - } - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pUpdate, 2, iAbsLevel); - } - - assert( p->bIgnoreSavepoint==0 ); - p->bIgnoreSavepoint = 1; - for(i=0; rc==SQLITE_OK && ibIgnoreSavepoint = 0; - - sqlite3_free(aIdx); - return rc; -} - -static void fts3StartNode(Blob *pNode, int iHeight, sqlite3_int64 iChild){ - pNode->a[0] = (char)iHeight; - if( iChild ){ - assert( pNode->nAlloc>=1+sqlite3Fts3VarintLen(iChild) ); - pNode->n = 1 + sqlite3Fts3PutVarint(&pNode->a[1], iChild); - }else{ - assert( pNode->nAlloc>=1 ); - pNode->n = 1; - } -} - -/* -** The first two arguments are a pointer to and the size of a segment b-tree -** node. The node may be a leaf or an internal node. -** -** This function creates a new node image in blob object *pNew by copying -** all terms that are greater than or equal to zTerm/nTerm (for leaf nodes) -** or greater than zTerm/nTerm (for internal nodes) from aNode/nNode. -*/ -static int fts3TruncateNode( - const char *aNode, /* Current node image */ - int nNode, /* Size of aNode in bytes */ - Blob *pNew, /* OUT: Write new node image here */ - const char *zTerm, /* Omit all terms smaller than this */ - int nTerm, /* Size of zTerm in bytes */ - sqlite3_int64 *piBlock /* OUT: Block number in next layer down */ -){ - NodeReader reader; /* Reader object */ - Blob prev = {0, 0, 0}; /* Previous term written to new node */ - int rc = SQLITE_OK; /* Return code */ - int bLeaf = aNode[0]=='\0'; /* True for a leaf node */ - - /* Allocate required output space */ - blobGrowBuffer(pNew, nNode, &rc); - if( rc!=SQLITE_OK ) return rc; - pNew->n = 0; - - /* Populate new node buffer */ - for(rc = nodeReaderInit(&reader, aNode, nNode); - rc==SQLITE_OK && reader.aNode; - rc = nodeReaderNext(&reader) - ){ - if( pNew->n==0 ){ - int res = fts3TermCmp(reader.term.a, reader.term.n, zTerm, nTerm); - if( res<0 || (bLeaf==0 && res==0) ) continue; - fts3StartNode(pNew, (int)aNode[0], reader.iChild); - *piBlock = reader.iChild; - } - rc = fts3AppendToNode( - pNew, &prev, reader.term.a, reader.term.n, - reader.aDoclist, reader.nDoclist - ); - if( rc!=SQLITE_OK ) break; - } - if( pNew->n==0 ){ - fts3StartNode(pNew, (int)aNode[0], reader.iChild); - *piBlock = reader.iChild; - } - assert( pNew->n<=pNew->nAlloc ); - - nodeReaderRelease(&reader); - sqlite3_free(prev.a); - return rc; -} - -/* -** Remove all terms smaller than zTerm/nTerm from segment iIdx in absolute -** level iAbsLevel. This may involve deleting entries from the %_segments -** table, and modifying existing entries in both the %_segments and %_segdir -** tables. -** -** SQLITE_OK is returned if the segment is updated successfully. Or an -** SQLite error code otherwise. -*/ -static int fts3TruncateSegment( - Fts3Table *p, /* FTS3 table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level of segment to modify */ - int iIdx, /* Index within level of segment to modify */ - const char *zTerm, /* Remove terms smaller than this */ - int nTerm /* Number of bytes in buffer zTerm */ -){ - int rc = SQLITE_OK; /* Return code */ - Blob root = {0,0,0}; /* New root page image */ - Blob block = {0,0,0}; /* Buffer used for any other block */ - sqlite3_int64 iBlock = 0; /* Block id */ - sqlite3_int64 iNewStart = 0; /* New value for iStartBlock */ - sqlite3_int64 iOldStart = 0; /* Old value for iStartBlock */ - sqlite3_stmt *pFetch = 0; /* Statement used to fetch segdir */ - - rc = fts3SqlStmt(p, SQL_SELECT_SEGDIR, &pFetch, 0); - if( rc==SQLITE_OK ){ - int rc2; /* sqlite3_reset() return code */ - sqlite3_bind_int64(pFetch, 1, iAbsLevel); - sqlite3_bind_int(pFetch, 2, iIdx); - if( SQLITE_ROW==sqlite3_step(pFetch) ){ - const char *aRoot = sqlite3_column_blob(pFetch, 4); - int nRoot = sqlite3_column_bytes(pFetch, 4); - iOldStart = sqlite3_column_int64(pFetch, 1); - rc = fts3TruncateNode(aRoot, nRoot, &root, zTerm, nTerm, &iBlock); - } - rc2 = sqlite3_reset(pFetch); - if( rc==SQLITE_OK ) rc = rc2; - } - - while( rc==SQLITE_OK && iBlock ){ - char *aBlock = 0; - int nBlock = 0; - iNewStart = iBlock; - - rc = sqlite3Fts3ReadBlock(p, iBlock, &aBlock, &nBlock, 0); - if( rc==SQLITE_OK ){ - rc = fts3TruncateNode(aBlock, nBlock, &block, zTerm, nTerm, &iBlock); - } - if( rc==SQLITE_OK ){ - rc = fts3WriteSegment(p, iNewStart, block.a, block.n); - } - sqlite3_free(aBlock); - } - - /* Variable iNewStart now contains the first valid leaf node. */ - if( rc==SQLITE_OK && iNewStart ){ - sqlite3_stmt *pDel = 0; - rc = fts3SqlStmt(p, SQL_DELETE_SEGMENTS_RANGE, &pDel, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pDel, 1, iOldStart); - sqlite3_bind_int64(pDel, 2, iNewStart-1); - sqlite3_step(pDel); - rc = sqlite3_reset(pDel); - } - } - - if( rc==SQLITE_OK ){ - sqlite3_stmt *pChomp = 0; - rc = fts3SqlStmt(p, SQL_CHOMP_SEGDIR, &pChomp, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pChomp, 1, iNewStart); - sqlite3_bind_blob(pChomp, 2, root.a, root.n, SQLITE_STATIC); - sqlite3_bind_int64(pChomp, 3, iAbsLevel); - sqlite3_bind_int(pChomp, 4, iIdx); - sqlite3_step(pChomp); - rc = sqlite3_reset(pChomp); - } - } - - sqlite3_free(root.a); - sqlite3_free(block.a); - return rc; -} - -/* -** This function is called after an incrmental-merge operation has run to -** merge (or partially merge) two or more segments from absolute level -** iAbsLevel. -** -** Each input segment is either removed from the db completely (if all of -** its data was copied to the output segment by the incrmerge operation) -** or modified in place so that it no longer contains those entries that -** have been duplicated in the output segment. -*/ -static int fts3IncrmergeChomp( - Fts3Table *p, /* FTS table handle */ - sqlite3_int64 iAbsLevel, /* Absolute level containing segments */ - Fts3MultiSegReader *pCsr, /* Chomp all segments opened by this cursor */ - int *pnRem /* Number of segments not deleted */ -){ - int i; - int nRem = 0; - int rc = SQLITE_OK; - - for(i=pCsr->nSegment-1; i>=0 && rc==SQLITE_OK; i--){ - Fts3SegReader *pSeg = 0; - int j; - - /* Find the Fts3SegReader object with Fts3SegReader.iIdx==i. It is hiding - ** somewhere in the pCsr->apSegment[] array. */ - for(j=0; ALWAYS(jnSegment); j++){ - pSeg = pCsr->apSegment[j]; - if( pSeg->iIdx==i ) break; - } - assert( jnSegment && pSeg->iIdx==i ); - - if( pSeg->aNode==0 ){ - /* Seg-reader is at EOF. Remove the entire input segment. */ - rc = fts3DeleteSegment(p, pSeg); - if( rc==SQLITE_OK ){ - rc = fts3RemoveSegdirEntry(p, iAbsLevel, pSeg->iIdx); - } - *pnRem = 0; - }else{ - /* The incremental merge did not copy all the data from this - ** segment to the upper level. The segment is modified in place - ** so that it contains no keys smaller than zTerm/nTerm. */ - const char *zTerm = pSeg->zTerm; - int nTerm = pSeg->nTerm; - rc = fts3TruncateSegment(p, iAbsLevel, pSeg->iIdx, zTerm, nTerm); - nRem++; - } - } - - if( rc==SQLITE_OK && nRem!=pCsr->nSegment ){ - rc = fts3RepackSegdirLevel(p, iAbsLevel); - } - - *pnRem = nRem; - return rc; -} - -/* -** Store an incr-merge hint in the database. -*/ -static int fts3IncrmergeHintStore(Fts3Table *p, Blob *pHint){ - sqlite3_stmt *pReplace = 0; - int rc; /* Return code */ - - rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pReplace, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_int(pReplace, 1, FTS_STAT_INCRMERGEHINT); - sqlite3_bind_blob(pReplace, 2, pHint->a, pHint->n, SQLITE_STATIC); - sqlite3_step(pReplace); - rc = sqlite3_reset(pReplace); - } - - return rc; -} - -/* -** Load an incr-merge hint from the database. The incr-merge hint, if one -** exists, is stored in the rowid==1 row of the %_stat table. -** -** If successful, populate blob *pHint with the value read from the %_stat -** table and return SQLITE_OK. Otherwise, if an error occurs, return an -** SQLite error code. -*/ -static int fts3IncrmergeHintLoad(Fts3Table *p, Blob *pHint){ - sqlite3_stmt *pSelect = 0; - int rc; - - pHint->n = 0; - rc = fts3SqlStmt(p, SQL_SELECT_STAT, &pSelect, 0); - if( rc==SQLITE_OK ){ - int rc2; - sqlite3_bind_int(pSelect, 1, FTS_STAT_INCRMERGEHINT); - if( SQLITE_ROW==sqlite3_step(pSelect) ){ - const char *aHint = sqlite3_column_blob(pSelect, 0); - int nHint = sqlite3_column_bytes(pSelect, 0); - if( aHint ){ - blobGrowBuffer(pHint, nHint, &rc); - if( rc==SQLITE_OK ){ - memcpy(pHint->a, aHint, nHint); - pHint->n = nHint; - } - } - } - rc2 = sqlite3_reset(pSelect); - if( rc==SQLITE_OK ) rc = rc2; - } - - return rc; -} - -/* -** If *pRc is not SQLITE_OK when this function is called, it is a no-op. -** Otherwise, append an entry to the hint stored in blob *pHint. Each entry -** consists of two varints, the absolute level number of the input segments -** and the number of input segments. -** -** If successful, leave *pRc set to SQLITE_OK and return. If an error occurs, -** set *pRc to an SQLite error code before returning. -*/ -static void fts3IncrmergeHintPush( - Blob *pHint, /* Hint blob to append to */ - i64 iAbsLevel, /* First varint to store in hint */ - int nInput, /* Second varint to store in hint */ - int *pRc /* IN/OUT: Error code */ -){ - blobGrowBuffer(pHint, pHint->n + 2*FTS3_VARINT_MAX, pRc); - if( *pRc==SQLITE_OK ){ - pHint->n += sqlite3Fts3PutVarint(&pHint->a[pHint->n], iAbsLevel); - pHint->n += sqlite3Fts3PutVarint(&pHint->a[pHint->n], (i64)nInput); - } -} - -/* -** Read the last entry (most recently pushed) from the hint blob *pHint -** and then remove the entry. Write the two values read to *piAbsLevel and -** *pnInput before returning. -** -** If no error occurs, return SQLITE_OK. If the hint blob in *pHint does -** not contain at least two valid varints, return SQLITE_CORRUPT_VTAB. -*/ -static int fts3IncrmergeHintPop(Blob *pHint, i64 *piAbsLevel, int *pnInput){ - const int nHint = pHint->n; - int i; - - i = pHint->n-2; - while( i>0 && (pHint->a[i-1] & 0x80) ) i--; - while( i>0 && (pHint->a[i-1] & 0x80) ) i--; - - pHint->n = i; - i += sqlite3Fts3GetVarint(&pHint->a[i], piAbsLevel); - i += fts3GetVarint32(&pHint->a[i], pnInput); - if( i!=nHint ) return SQLITE_CORRUPT_VTAB; - - return SQLITE_OK; -} - - -/* -** Attempt an incremental merge that writes nMerge leaf blocks. -** -** Incremental merges happen nMin segments at a time. The two -** segments to be merged are the nMin oldest segments (the ones with -** the smallest indexes) in the highest level that contains at least -** nMin segments. Multiple merges might occur in an attempt to write the -** quota of nMerge leaf blocks. -*/ -SQLITE_PRIVATE int sqlite3Fts3Incrmerge(Fts3Table *p, int nMerge, int nMin){ - int rc; /* Return code */ - int nRem = nMerge; /* Number of leaf pages yet to be written */ - Fts3MultiSegReader *pCsr; /* Cursor used to read input data */ - Fts3SegFilter *pFilter; /* Filter used with cursor pCsr */ - IncrmergeWriter *pWriter; /* Writer object */ - int nSeg = 0; /* Number of input segments */ - sqlite3_int64 iAbsLevel = 0; /* Absolute level number to work on */ - Blob hint = {0, 0, 0}; /* Hint read from %_stat table */ - int bDirtyHint = 0; /* True if blob 'hint' has been modified */ - - /* Allocate space for the cursor, filter and writer objects */ - const int nAlloc = sizeof(*pCsr) + sizeof(*pFilter) + sizeof(*pWriter); - pWriter = (IncrmergeWriter *)sqlite3_malloc(nAlloc); - if( !pWriter ) return SQLITE_NOMEM; - pFilter = (Fts3SegFilter *)&pWriter[1]; - pCsr = (Fts3MultiSegReader *)&pFilter[1]; - - rc = fts3IncrmergeHintLoad(p, &hint); - while( rc==SQLITE_OK && nRem>0 ){ - const i64 nMod = FTS3_SEGDIR_MAXLEVEL * p->nIndex; - sqlite3_stmt *pFindLevel = 0; /* SQL used to determine iAbsLevel */ - int bUseHint = 0; /* True if attempting to append */ - - /* Search the %_segdir table for the absolute level with the smallest - ** relative level number that contains at least nMin segments, if any. - ** If one is found, set iAbsLevel to the absolute level number and - ** nSeg to nMin. If no level with at least nMin segments can be found, - ** set nSeg to -1. - */ - rc = fts3SqlStmt(p, SQL_FIND_MERGE_LEVEL, &pFindLevel, 0); - sqlite3_bind_int(pFindLevel, 1, nMin); - if( sqlite3_step(pFindLevel)==SQLITE_ROW ){ - iAbsLevel = sqlite3_column_int64(pFindLevel, 0); - nSeg = nMin; - }else{ - nSeg = -1; - } - rc = sqlite3_reset(pFindLevel); - - /* If the hint read from the %_stat table is not empty, check if the - ** last entry in it specifies a relative level smaller than or equal - ** to the level identified by the block above (if any). If so, this - ** iteration of the loop will work on merging at the hinted level. - */ - if( rc==SQLITE_OK && hint.n ){ - int nHint = hint.n; - sqlite3_int64 iHintAbsLevel = 0; /* Hint level */ - int nHintSeg = 0; /* Hint number of segments */ - - rc = fts3IncrmergeHintPop(&hint, &iHintAbsLevel, &nHintSeg); - if( nSeg<0 || (iAbsLevel % nMod) >= (iHintAbsLevel % nMod) ){ - iAbsLevel = iHintAbsLevel; - nSeg = nHintSeg; - bUseHint = 1; - bDirtyHint = 1; - }else{ - /* This undoes the effect of the HintPop() above - so that no entry - ** is removed from the hint blob. */ - hint.n = nHint; - } - } - - /* If nSeg is less that zero, then there is no level with at least - ** nMin segments and no hint in the %_stat table. No work to do. - ** Exit early in this case. */ - if( nSeg<0 ) break; - - /* Open a cursor to iterate through the contents of the oldest nSeg - ** indexes of absolute level iAbsLevel. If this cursor is opened using - ** the 'hint' parameters, it is possible that there are less than nSeg - ** segments available in level iAbsLevel. In this case, no work is - ** done on iAbsLevel - fall through to the next iteration of the loop - ** to start work on some other level. */ - memset(pWriter, 0, nAlloc); - pFilter->flags = FTS3_SEGMENT_REQUIRE_POS; - if( rc==SQLITE_OK ){ - rc = fts3IncrmergeCsr(p, iAbsLevel, nSeg, pCsr); - } - if( SQLITE_OK==rc && pCsr->nSegment==nSeg - && SQLITE_OK==(rc = sqlite3Fts3SegReaderStart(p, pCsr, pFilter)) - && SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, pCsr)) - ){ - int iIdx = 0; /* Largest idx in level (iAbsLevel+1) */ - rc = fts3IncrmergeOutputIdx(p, iAbsLevel, &iIdx); - if( rc==SQLITE_OK ){ - if( bUseHint && iIdx>0 ){ - const char *zKey = pCsr->zTerm; - int nKey = pCsr->nTerm; - rc = fts3IncrmergeLoad(p, iAbsLevel, iIdx-1, zKey, nKey, pWriter); - }else{ - rc = fts3IncrmergeWriter(p, iAbsLevel, iIdx, pCsr, pWriter); - } - } - - if( rc==SQLITE_OK && pWriter->nLeafEst ){ - fts3LogMerge(nSeg, iAbsLevel); - do { - rc = fts3IncrmergeAppend(p, pWriter, pCsr); - if( rc==SQLITE_OK ) rc = sqlite3Fts3SegReaderStep(p, pCsr); - if( pWriter->nWork>=nRem && rc==SQLITE_ROW ) rc = SQLITE_OK; - }while( rc==SQLITE_ROW ); - - /* Update or delete the input segments */ - if( rc==SQLITE_OK ){ - nRem -= (1 + pWriter->nWork); - rc = fts3IncrmergeChomp(p, iAbsLevel, pCsr, &nSeg); - if( nSeg!=0 ){ - bDirtyHint = 1; - fts3IncrmergeHintPush(&hint, iAbsLevel, nSeg, &rc); - } - } - } - - fts3IncrmergeRelease(p, pWriter, &rc); - } - - sqlite3Fts3SegReaderFinish(pCsr); - } - - /* Write the hint values into the %_stat table for the next incr-merger */ - if( bDirtyHint && rc==SQLITE_OK ){ - rc = fts3IncrmergeHintStore(p, &hint); - } - - sqlite3_free(pWriter); - sqlite3_free(hint.a); - return rc; -} - -/* -** Convert the text beginning at *pz into an integer and return -** its value. Advance *pz to point to the first character past -** the integer. -*/ -static int fts3Getint(const char **pz){ - const char *z = *pz; - int i = 0; - while( (*z)>='0' && (*z)<='9' ) i = 10*i + *(z++) - '0'; - *pz = z; - return i; -} - -/* -** Process statements of the form: -** -** INSERT INTO table(table) VALUES('merge=A,B'); -** -** A and B are integers that decode to be the number of leaf pages -** written for the merge, and the minimum number of segments on a level -** before it will be selected for a merge, respectively. -*/ -static int fts3DoIncrmerge( - Fts3Table *p, /* FTS3 table handle */ - const char *zParam /* Nul-terminated string containing "A,B" */ -){ - int rc; - int nMin = (FTS3_MERGE_COUNT / 2); - int nMerge = 0; - const char *z = zParam; - - /* Read the first integer value */ - nMerge = fts3Getint(&z); - - /* If the first integer value is followed by a ',', read the second - ** integer value. */ - if( z[0]==',' && z[1]!='\0' ){ - z++; - nMin = fts3Getint(&z); - } - - if( z[0]!='\0' || nMin<2 ){ - rc = SQLITE_ERROR; - }else{ - rc = SQLITE_OK; - if( !p->bHasStat ){ - assert( p->bFts4==0 ); - sqlite3Fts3CreateStatTable(&rc, p); - } - if( rc==SQLITE_OK ){ - rc = sqlite3Fts3Incrmerge(p, nMerge, nMin); - } - sqlite3Fts3SegmentsClose(p); - } - return rc; -} - -/* -** Process statements of the form: -** -** INSERT INTO table(table) VALUES('automerge=X'); -** -** where X is an integer. X==0 means to turn automerge off. X!=0 means -** turn it on. The setting is persistent. -*/ -static int fts3DoAutoincrmerge( - Fts3Table *p, /* FTS3 table handle */ - const char *zParam /* Nul-terminated string containing boolean */ -){ - int rc = SQLITE_OK; - sqlite3_stmt *pStmt = 0; - p->bAutoincrmerge = fts3Getint(&zParam)!=0; - if( !p->bHasStat ){ - assert( p->bFts4==0 ); - sqlite3Fts3CreateStatTable(&rc, p); - if( rc ) return rc; - } - rc = fts3SqlStmt(p, SQL_REPLACE_STAT, &pStmt, 0); - if( rc ) return rc; - sqlite3_bind_int(pStmt, 1, FTS_STAT_AUTOINCRMERGE); - sqlite3_bind_int(pStmt, 2, p->bAutoincrmerge); - sqlite3_step(pStmt); - rc = sqlite3_reset(pStmt); - return rc; -} - -/* -** Return a 64-bit checksum for the FTS index entry specified by the -** arguments to this function. -*/ -static u64 fts3ChecksumEntry( - const char *zTerm, /* Pointer to buffer containing term */ - int nTerm, /* Size of zTerm in bytes */ - int iLangid, /* Language id for current row */ - int iIndex, /* Index (0..Fts3Table.nIndex-1) */ - i64 iDocid, /* Docid for current row. */ - int iCol, /* Column number */ - int iPos /* Position */ -){ - int i; - u64 ret = (u64)iDocid; - - ret += (ret<<3) + iLangid; - ret += (ret<<3) + iIndex; - ret += (ret<<3) + iCol; - ret += (ret<<3) + iPos; - for(i=0; inIndex-1) */ - int *pRc /* OUT: Return code */ -){ - Fts3SegFilter filter; - Fts3MultiSegReader csr; - int rc; - u64 cksum = 0; - - assert( *pRc==SQLITE_OK ); - - memset(&filter, 0, sizeof(filter)); - memset(&csr, 0, sizeof(csr)); - filter.flags = FTS3_SEGMENT_REQUIRE_POS|FTS3_SEGMENT_IGNORE_EMPTY; - filter.flags |= FTS3_SEGMENT_SCAN; - - rc = sqlite3Fts3SegReaderCursor( - p, iLangid, iIndex, FTS3_SEGCURSOR_ALL, 0, 0, 0, 1,&csr - ); - if( rc==SQLITE_OK ){ - rc = sqlite3Fts3SegReaderStart(p, &csr, &filter); - } - - if( rc==SQLITE_OK ){ - while( SQLITE_ROW==(rc = sqlite3Fts3SegReaderStep(p, &csr)) ){ - char *pCsr = csr.aDoclist; - char *pEnd = &pCsr[csr.nDoclist]; - - i64 iDocid = 0; - i64 iCol = 0; - i64 iPos = 0; - - pCsr += sqlite3Fts3GetVarint(pCsr, &iDocid); - while( pCsrnIndex); - while( rc==SQLITE_OK && sqlite3_step(pAllLangid)==SQLITE_ROW ){ - int iLangid = sqlite3_column_int(pAllLangid, 0); - int i; - for(i=0; inIndex; i++){ - cksum1 = cksum1 ^ fts3ChecksumIndex(p, iLangid, i, &rc); - } - } - rc2 = sqlite3_reset(pAllLangid); - if( rc==SQLITE_OK ) rc = rc2; - } - - /* This block calculates the checksum according to the %_content table */ - rc = fts3SqlStmt(p, SQL_SELECT_ALL_LANGID, &pAllLangid, 0); - if( rc==SQLITE_OK ){ - sqlite3_tokenizer_module const *pModule = p->pTokenizer->pModule; - sqlite3_stmt *pStmt = 0; - char *zSql; - - zSql = sqlite3_mprintf("SELECT %s" , p->zReadExprlist); - if( !zSql ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_prepare_v2(p->db, zSql, -1, &pStmt, 0); - sqlite3_free(zSql); - } - - while( rc==SQLITE_OK && SQLITE_ROW==sqlite3_step(pStmt) ){ - i64 iDocid = sqlite3_column_int64(pStmt, 0); - int iLang = langidFromSelect(p, pStmt); - int iCol; - - for(iCol=0; rc==SQLITE_OK && iColnColumn; iCol++){ - const char *zText = (const char *)sqlite3_column_text(pStmt, iCol+1); - int nText = sqlite3_column_bytes(pStmt, iCol+1); - sqlite3_tokenizer_cursor *pT = 0; - - rc = sqlite3Fts3OpenTokenizer(p->pTokenizer, iLang, zText, nText, &pT); - while( rc==SQLITE_OK ){ - char const *zToken; /* Buffer containing token */ - int nToken = 0; /* Number of bytes in token */ - int iDum1 = 0, iDum2 = 0; /* Dummy variables */ - int iPos = 0; /* Position of token in zText */ - - rc = pModule->xNext(pT, &zToken, &nToken, &iDum1, &iDum2, &iPos); - if( rc==SQLITE_OK ){ - int i; - cksum2 = cksum2 ^ fts3ChecksumEntry( - zToken, nToken, iLang, 0, iDocid, iCol, iPos - ); - for(i=1; inIndex; i++){ - if( p->aIndex[i].nPrefix<=nToken ){ - cksum2 = cksum2 ^ fts3ChecksumEntry( - zToken, p->aIndex[i].nPrefix, iLang, i, iDocid, iCol, iPos - ); - } - } - } - } - if( pT ) pModule->xClose(pT); - if( rc==SQLITE_DONE ) rc = SQLITE_OK; - } - } - - sqlite3_finalize(pStmt); - } - - *pbOk = (cksum1==cksum2); - return rc; -} - -/* -** Run the integrity-check. If no error occurs and the current contents of -** the FTS index are correct, return SQLITE_OK. Or, if the contents of the -** FTS index are incorrect, return SQLITE_CORRUPT_VTAB. -** -** Or, if an error (e.g. an OOM or IO error) occurs, return an SQLite -** error code. -** -** The integrity-check works as follows. For each token and indexed token -** prefix in the document set, a 64-bit checksum is calculated (by code -** in fts3ChecksumEntry()) based on the following: -** -** + The index number (0 for the main index, 1 for the first prefix -** index etc.), -** + The token (or token prefix) text itself, -** + The language-id of the row it appears in, -** + The docid of the row it appears in, -** + The column it appears in, and -** + The tokens position within that column. -** -** The checksums for all entries in the index are XORed together to create -** a single checksum for the entire index. -** -** The integrity-check code calculates the same checksum in two ways: -** -** 1. By scanning the contents of the FTS index, and -** 2. By scanning and tokenizing the content table. -** -** If the two checksums are identical, the integrity-check is deemed to have -** passed. -*/ -static int fts3DoIntegrityCheck( - Fts3Table *p /* FTS3 table handle */ -){ - int rc; - int bOk = 0; - rc = fts3IntegrityCheck(p, &bOk); - if( rc==SQLITE_OK && bOk==0 ) rc = SQLITE_CORRUPT_VTAB; - return rc; -} - -/* -** Handle a 'special' INSERT of the form: -** -** "INSERT INTO tbl(tbl) VALUES()" -** -** Argument pVal contains the result of . Currently the only -** meaningful value to insert is the text 'optimize'. -*/ -static int fts3SpecialInsert(Fts3Table *p, sqlite3_value *pVal){ - int rc; /* Return Code */ - const char *zVal = (const char *)sqlite3_value_text(pVal); - int nVal = sqlite3_value_bytes(pVal); - - if( !zVal ){ - return SQLITE_NOMEM; - }else if( nVal==8 && 0==sqlite3_strnicmp(zVal, "optimize", 8) ){ - rc = fts3DoOptimize(p, 0); - }else if( nVal==7 && 0==sqlite3_strnicmp(zVal, "rebuild", 7) ){ - rc = fts3DoRebuild(p); - }else if( nVal==15 && 0==sqlite3_strnicmp(zVal, "integrity-check", 15) ){ - rc = fts3DoIntegrityCheck(p); - }else if( nVal>6 && 0==sqlite3_strnicmp(zVal, "merge=", 6) ){ - rc = fts3DoIncrmerge(p, &zVal[6]); - }else if( nVal>10 && 0==sqlite3_strnicmp(zVal, "automerge=", 10) ){ - rc = fts3DoAutoincrmerge(p, &zVal[10]); -#ifdef SQLITE_TEST - }else if( nVal>9 && 0==sqlite3_strnicmp(zVal, "nodesize=", 9) ){ - p->nNodeSize = atoi(&zVal[9]); - rc = SQLITE_OK; - }else if( nVal>11 && 0==sqlite3_strnicmp(zVal, "maxpending=", 9) ){ - p->nMaxPendingData = atoi(&zVal[11]); - rc = SQLITE_OK; - }else if( nVal>21 && 0==sqlite3_strnicmp(zVal, "test-no-incr-doclist=", 21) ){ - p->bNoIncrDoclist = atoi(&zVal[21]); - rc = SQLITE_OK; -#endif - }else{ - rc = SQLITE_ERROR; - } - - return rc; -} - -#ifndef SQLITE_DISABLE_FTS4_DEFERRED -/* -** Delete all cached deferred doclists. Deferred doclists are cached -** (allocated) by the sqlite3Fts3CacheDeferredDoclists() function. -*/ -SQLITE_PRIVATE void sqlite3Fts3FreeDeferredDoclists(Fts3Cursor *pCsr){ - Fts3DeferredToken *pDef; - for(pDef=pCsr->pDeferred; pDef; pDef=pDef->pNext){ - fts3PendingListDelete(pDef->pList); - pDef->pList = 0; - } -} - -/* -** Free all entries in the pCsr->pDeffered list. Entries are added to -** this list using sqlite3Fts3DeferToken(). -*/ -SQLITE_PRIVATE void sqlite3Fts3FreeDeferredTokens(Fts3Cursor *pCsr){ - Fts3DeferredToken *pDef; - Fts3DeferredToken *pNext; - for(pDef=pCsr->pDeferred; pDef; pDef=pNext){ - pNext = pDef->pNext; - fts3PendingListDelete(pDef->pList); - sqlite3_free(pDef); - } - pCsr->pDeferred = 0; -} - -/* -** Generate deferred-doclists for all tokens in the pCsr->pDeferred list -** based on the row that pCsr currently points to. -** -** A deferred-doclist is like any other doclist with position information -** included, except that it only contains entries for a single row of the -** table, not for all rows. -*/ -SQLITE_PRIVATE int sqlite3Fts3CacheDeferredDoclists(Fts3Cursor *pCsr){ - int rc = SQLITE_OK; /* Return code */ - if( pCsr->pDeferred ){ - int i; /* Used to iterate through table columns */ - sqlite3_int64 iDocid; /* Docid of the row pCsr points to */ - Fts3DeferredToken *pDef; /* Used to iterate through deferred tokens */ - - Fts3Table *p = (Fts3Table *)pCsr->base.pVtab; - sqlite3_tokenizer *pT = p->pTokenizer; - sqlite3_tokenizer_module const *pModule = pT->pModule; - - assert( pCsr->isRequireSeek==0 ); - iDocid = sqlite3_column_int64(pCsr->pStmt, 0); - - for(i=0; inColumn && rc==SQLITE_OK; i++){ - if( p->abNotindexed[i]==0 ){ - const char *zText = (const char *)sqlite3_column_text(pCsr->pStmt, i+1); - sqlite3_tokenizer_cursor *pTC = 0; - - rc = sqlite3Fts3OpenTokenizer(pT, pCsr->iLangid, zText, -1, &pTC); - while( rc==SQLITE_OK ){ - char const *zToken; /* Buffer containing token */ - int nToken = 0; /* Number of bytes in token */ - int iDum1 = 0, iDum2 = 0; /* Dummy variables */ - int iPos = 0; /* Position of token in zText */ - - rc = pModule->xNext(pTC, &zToken, &nToken, &iDum1, &iDum2, &iPos); - for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){ - Fts3PhraseToken *pPT = pDef->pToken; - if( (pDef->iCol>=p->nColumn || pDef->iCol==i) - && (pPT->bFirst==0 || iPos==0) - && (pPT->n==nToken || (pPT->isPrefix && pPT->nz, pPT->n)) - ){ - fts3PendingListAppend(&pDef->pList, iDocid, i, iPos, &rc); - } - } - } - if( pTC ) pModule->xClose(pTC); - if( rc==SQLITE_DONE ) rc = SQLITE_OK; - } - } - - for(pDef=pCsr->pDeferred; pDef && rc==SQLITE_OK; pDef=pDef->pNext){ - if( pDef->pList ){ - rc = fts3PendingListAppendVarint(&pDef->pList, 0); - } - } - } - - return rc; -} - -SQLITE_PRIVATE int sqlite3Fts3DeferredTokenList( - Fts3DeferredToken *p, - char **ppData, - int *pnData -){ - char *pRet; - int nSkip; - sqlite3_int64 dummy; - - *ppData = 0; - *pnData = 0; - - if( p->pList==0 ){ - return SQLITE_OK; - } - - pRet = (char *)sqlite3_malloc(p->pList->nData); - if( !pRet ) return SQLITE_NOMEM; - - nSkip = sqlite3Fts3GetVarint(p->pList->aData, &dummy); - *pnData = p->pList->nData - nSkip; - *ppData = pRet; - - memcpy(pRet, &p->pList->aData[nSkip], *pnData); - return SQLITE_OK; -} - -/* -** Add an entry for token pToken to the pCsr->pDeferred list. -*/ -SQLITE_PRIVATE int sqlite3Fts3DeferToken( - Fts3Cursor *pCsr, /* Fts3 table cursor */ - Fts3PhraseToken *pToken, /* Token to defer */ - int iCol /* Column that token must appear in (or -1) */ -){ - Fts3DeferredToken *pDeferred; - pDeferred = sqlite3_malloc(sizeof(*pDeferred)); - if( !pDeferred ){ - return SQLITE_NOMEM; - } - memset(pDeferred, 0, sizeof(*pDeferred)); - pDeferred->pToken = pToken; - pDeferred->pNext = pCsr->pDeferred; - pDeferred->iCol = iCol; - pCsr->pDeferred = pDeferred; - - assert( pToken->pDeferred==0 ); - pToken->pDeferred = pDeferred; - - return SQLITE_OK; -} -#endif - -/* -** SQLite value pRowid contains the rowid of a row that may or may not be -** present in the FTS3 table. If it is, delete it and adjust the contents -** of subsiduary data structures accordingly. -*/ -static int fts3DeleteByRowid( - Fts3Table *p, - sqlite3_value *pRowid, - int *pnChng, /* IN/OUT: Decrement if row is deleted */ - u32 *aSzDel -){ - int rc = SQLITE_OK; /* Return code */ - int bFound = 0; /* True if *pRowid really is in the table */ - - fts3DeleteTerms(&rc, p, pRowid, aSzDel, &bFound); - if( bFound && rc==SQLITE_OK ){ - int isEmpty = 0; /* Deleting *pRowid leaves the table empty */ - rc = fts3IsEmpty(p, pRowid, &isEmpty); - if( rc==SQLITE_OK ){ - if( isEmpty ){ - /* Deleting this row means the whole table is empty. In this case - ** delete the contents of all three tables and throw away any - ** data in the pendingTerms hash table. */ - rc = fts3DeleteAll(p, 1); - *pnChng = 0; - memset(aSzDel, 0, sizeof(u32) * (p->nColumn+1) * 2); - }else{ - *pnChng = *pnChng - 1; - if( p->zContentTbl==0 ){ - fts3SqlExec(&rc, p, SQL_DELETE_CONTENT, &pRowid); - } - if( p->bHasDocsize ){ - fts3SqlExec(&rc, p, SQL_DELETE_DOCSIZE, &pRowid); - } - } - } - } - - return rc; -} - -/* -** This function does the work for the xUpdate method of FTS3 virtual -** tables. The schema of the virtual table being: -** -** CREATE TABLE
    ( -** , -**
    HIDDEN, -** docid HIDDEN, -** HIDDEN -** ); -** -** -*/ -SQLITE_PRIVATE int sqlite3Fts3UpdateMethod( - sqlite3_vtab *pVtab, /* FTS3 vtab object */ - int nArg, /* Size of argument array */ - sqlite3_value **apVal, /* Array of arguments */ - sqlite_int64 *pRowid /* OUT: The affected (or effected) rowid */ -){ - Fts3Table *p = (Fts3Table *)pVtab; - int rc = SQLITE_OK; /* Return Code */ - int isRemove = 0; /* True for an UPDATE or DELETE */ - u32 *aSzIns = 0; /* Sizes of inserted documents */ - u32 *aSzDel = 0; /* Sizes of deleted documents */ - int nChng = 0; /* Net change in number of documents */ - int bInsertDone = 0; - - assert( p->pSegments==0 ); - assert( - nArg==1 /* DELETE operations */ - || nArg==(2 + p->nColumn + 3) /* INSERT or UPDATE operations */ - ); - - /* Check for a "special" INSERT operation. One of the form: - ** - ** INSERT INTO xyz(xyz) VALUES('command'); - */ - if( nArg>1 - && sqlite3_value_type(apVal[0])==SQLITE_NULL - && sqlite3_value_type(apVal[p->nColumn+2])!=SQLITE_NULL - ){ - rc = fts3SpecialInsert(p, apVal[p->nColumn+2]); - goto update_out; - } - - if( nArg>1 && sqlite3_value_int(apVal[2 + p->nColumn + 2])<0 ){ - rc = SQLITE_CONSTRAINT; - goto update_out; - } - - /* Allocate space to hold the change in document sizes */ - aSzDel = sqlite3_malloc( sizeof(aSzDel[0])*(p->nColumn+1)*2 ); - if( aSzDel==0 ){ - rc = SQLITE_NOMEM; - goto update_out; - } - aSzIns = &aSzDel[p->nColumn+1]; - memset(aSzDel, 0, sizeof(aSzDel[0])*(p->nColumn+1)*2); - - rc = fts3Writelock(p); - if( rc!=SQLITE_OK ) goto update_out; - - /* If this is an INSERT operation, or an UPDATE that modifies the rowid - ** value, then this operation requires constraint handling. - ** - ** If the on-conflict mode is REPLACE, this means that the existing row - ** should be deleted from the database before inserting the new row. Or, - ** if the on-conflict mode is other than REPLACE, then this method must - ** detect the conflict and return SQLITE_CONSTRAINT before beginning to - ** modify the database file. - */ - if( nArg>1 && p->zContentTbl==0 ){ - /* Find the value object that holds the new rowid value. */ - sqlite3_value *pNewRowid = apVal[3+p->nColumn]; - if( sqlite3_value_type(pNewRowid)==SQLITE_NULL ){ - pNewRowid = apVal[1]; - } - - if( sqlite3_value_type(pNewRowid)!=SQLITE_NULL && ( - sqlite3_value_type(apVal[0])==SQLITE_NULL - || sqlite3_value_int64(apVal[0])!=sqlite3_value_int64(pNewRowid) - )){ - /* The new rowid is not NULL (in this case the rowid will be - ** automatically assigned and there is no chance of a conflict), and - ** the statement is either an INSERT or an UPDATE that modifies the - ** rowid column. So if the conflict mode is REPLACE, then delete any - ** existing row with rowid=pNewRowid. - ** - ** Or, if the conflict mode is not REPLACE, insert the new record into - ** the %_content table. If we hit the duplicate rowid constraint (or any - ** other error) while doing so, return immediately. - ** - ** This branch may also run if pNewRowid contains a value that cannot - ** be losslessly converted to an integer. In this case, the eventual - ** call to fts3InsertData() (either just below or further on in this - ** function) will return SQLITE_MISMATCH. If fts3DeleteByRowid is - ** invoked, it will delete zero rows (since no row will have - ** docid=$pNewRowid if $pNewRowid is not an integer value). - */ - if( sqlite3_vtab_on_conflict(p->db)==SQLITE_REPLACE ){ - rc = fts3DeleteByRowid(p, pNewRowid, &nChng, aSzDel); - }else{ - rc = fts3InsertData(p, apVal, pRowid); - bInsertDone = 1; - } - } - } - if( rc!=SQLITE_OK ){ - goto update_out; - } - - /* If this is a DELETE or UPDATE operation, remove the old record. */ - if( sqlite3_value_type(apVal[0])!=SQLITE_NULL ){ - assert( sqlite3_value_type(apVal[0])==SQLITE_INTEGER ); - rc = fts3DeleteByRowid(p, apVal[0], &nChng, aSzDel); - isRemove = 1; - } - - /* If this is an INSERT or UPDATE operation, insert the new record. */ - if( nArg>1 && rc==SQLITE_OK ){ - int iLangid = sqlite3_value_int(apVal[2 + p->nColumn + 2]); - if( bInsertDone==0 ){ - rc = fts3InsertData(p, apVal, pRowid); - if( rc==SQLITE_CONSTRAINT && p->zContentTbl==0 ){ - rc = FTS_CORRUPT_VTAB; - } - } - if( rc==SQLITE_OK && (!isRemove || *pRowid!=p->iPrevDocid ) ){ - rc = fts3PendingTermsDocid(p, iLangid, *pRowid); - } - if( rc==SQLITE_OK ){ - assert( p->iPrevDocid==*pRowid ); - rc = fts3InsertTerms(p, iLangid, apVal, aSzIns); - } - if( p->bHasDocsize ){ - fts3InsertDocsize(&rc, p, aSzIns); - } - nChng++; - } - - if( p->bFts4 ){ - fts3UpdateDocTotals(&rc, p, aSzIns, aSzDel, nChng); - } - - update_out: - sqlite3_free(aSzDel); - sqlite3Fts3SegmentsClose(p); - return rc; -} - -/* -** Flush any data in the pending-terms hash table to disk. If successful, -** merge all segments in the database (including the new segment, if -** there was any data to flush) into a single segment. -*/ -SQLITE_PRIVATE int sqlite3Fts3Optimize(Fts3Table *p){ - int rc; - rc = sqlite3_exec(p->db, "SAVEPOINT fts3", 0, 0, 0); - if( rc==SQLITE_OK ){ - rc = fts3DoOptimize(p, 1); - if( rc==SQLITE_OK || rc==SQLITE_DONE ){ - int rc2 = sqlite3_exec(p->db, "RELEASE fts3", 0, 0, 0); - if( rc2!=SQLITE_OK ) rc = rc2; - }else{ - sqlite3_exec(p->db, "ROLLBACK TO fts3", 0, 0, 0); - sqlite3_exec(p->db, "RELEASE fts3", 0, 0, 0); - } - } - sqlite3Fts3SegmentsClose(p); - return rc; -} - -#endif - -/************** End of fts3_write.c ******************************************/ -/************** Begin file fts3_snippet.c ************************************/ -/* -** 2009 Oct 23 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -*/ - -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ - -/* -** Characters that may appear in the second argument to matchinfo(). -*/ -#define FTS3_MATCHINFO_NPHRASE 'p' /* 1 value */ -#define FTS3_MATCHINFO_NCOL 'c' /* 1 value */ -#define FTS3_MATCHINFO_NDOC 'n' /* 1 value */ -#define FTS3_MATCHINFO_AVGLENGTH 'a' /* nCol values */ -#define FTS3_MATCHINFO_LENGTH 'l' /* nCol values */ -#define FTS3_MATCHINFO_LCS 's' /* nCol values */ -#define FTS3_MATCHINFO_HITS 'x' /* 3*nCol*nPhrase values */ - -/* -** The default value for the second argument to matchinfo(). -*/ -#define FTS3_MATCHINFO_DEFAULT "pcx" - - -/* -** Used as an fts3ExprIterate() context when loading phrase doclists to -** Fts3Expr.aDoclist[]/nDoclist. -*/ -typedef struct LoadDoclistCtx LoadDoclistCtx; -struct LoadDoclistCtx { - Fts3Cursor *pCsr; /* FTS3 Cursor */ - int nPhrase; /* Number of phrases seen so far */ - int nToken; /* Number of tokens seen so far */ -}; - -/* -** The following types are used as part of the implementation of the -** fts3BestSnippet() routine. -*/ -typedef struct SnippetIter SnippetIter; -typedef struct SnippetPhrase SnippetPhrase; -typedef struct SnippetFragment SnippetFragment; - -struct SnippetIter { - Fts3Cursor *pCsr; /* Cursor snippet is being generated from */ - int iCol; /* Extract snippet from this column */ - int nSnippet; /* Requested snippet length (in tokens) */ - int nPhrase; /* Number of phrases in query */ - SnippetPhrase *aPhrase; /* Array of size nPhrase */ - int iCurrent; /* First token of current snippet */ -}; - -struct SnippetPhrase { - int nToken; /* Number of tokens in phrase */ - char *pList; /* Pointer to start of phrase position list */ - int iHead; /* Next value in position list */ - char *pHead; /* Position list data following iHead */ - int iTail; /* Next value in trailing position list */ - char *pTail; /* Position list data following iTail */ -}; - -struct SnippetFragment { - int iCol; /* Column snippet is extracted from */ - int iPos; /* Index of first token in snippet */ - u64 covered; /* Mask of query phrases covered */ - u64 hlmask; /* Mask of snippet terms to highlight */ -}; - -/* -** This type is used as an fts3ExprIterate() context object while -** accumulating the data returned by the matchinfo() function. -*/ -typedef struct MatchInfo MatchInfo; -struct MatchInfo { - Fts3Cursor *pCursor; /* FTS3 Cursor */ - int nCol; /* Number of columns in table */ - int nPhrase; /* Number of matchable phrases in query */ - sqlite3_int64 nDoc; /* Number of docs in database */ - u32 *aMatchinfo; /* Pre-allocated buffer */ -}; - - - -/* -** The snippet() and offsets() functions both return text values. An instance -** of the following structure is used to accumulate those values while the -** functions are running. See fts3StringAppend() for details. -*/ -typedef struct StrBuffer StrBuffer; -struct StrBuffer { - char *z; /* Pointer to buffer containing string */ - int n; /* Length of z in bytes (excl. nul-term) */ - int nAlloc; /* Allocated size of buffer z in bytes */ -}; - - -/* -** This function is used to help iterate through a position-list. A position -** list is a list of unique integers, sorted from smallest to largest. Each -** element of the list is represented by an FTS3 varint that takes the value -** of the difference between the current element and the previous one plus -** two. For example, to store the position-list: -** -** 4 9 113 -** -** the three varints: -** -** 6 7 106 -** -** are encoded. -** -** When this function is called, *pp points to the start of an element of -** the list. *piPos contains the value of the previous entry in the list. -** After it returns, *piPos contains the value of the next element of the -** list and *pp is advanced to the following varint. -*/ -static void fts3GetDeltaPosition(char **pp, int *piPos){ - int iVal; - *pp += fts3GetVarint32(*pp, &iVal); - *piPos += (iVal-2); -} - -/* -** Helper function for fts3ExprIterate() (see below). -*/ -static int fts3ExprIterate2( - Fts3Expr *pExpr, /* Expression to iterate phrases of */ - int *piPhrase, /* Pointer to phrase counter */ - int (*x)(Fts3Expr*,int,void*), /* Callback function to invoke for phrases */ - void *pCtx /* Second argument to pass to callback */ -){ - int rc; /* Return code */ - int eType = pExpr->eType; /* Type of expression node pExpr */ - - if( eType!=FTSQUERY_PHRASE ){ - assert( pExpr->pLeft && pExpr->pRight ); - rc = fts3ExprIterate2(pExpr->pLeft, piPhrase, x, pCtx); - if( rc==SQLITE_OK && eType!=FTSQUERY_NOT ){ - rc = fts3ExprIterate2(pExpr->pRight, piPhrase, x, pCtx); - } - }else{ - rc = x(pExpr, *piPhrase, pCtx); - (*piPhrase)++; - } - return rc; -} - -/* -** Iterate through all phrase nodes in an FTS3 query, except those that -** are part of a sub-tree that is the right-hand-side of a NOT operator. -** For each phrase node found, the supplied callback function is invoked. -** -** If the callback function returns anything other than SQLITE_OK, -** the iteration is abandoned and the error code returned immediately. -** Otherwise, SQLITE_OK is returned after a callback has been made for -** all eligible phrase nodes. -*/ -static int fts3ExprIterate( - Fts3Expr *pExpr, /* Expression to iterate phrases of */ - int (*x)(Fts3Expr*,int,void*), /* Callback function to invoke for phrases */ - void *pCtx /* Second argument to pass to callback */ -){ - int iPhrase = 0; /* Variable used as the phrase counter */ - return fts3ExprIterate2(pExpr, &iPhrase, x, pCtx); -} - -/* -** This is an fts3ExprIterate() callback used while loading the doclists -** for each phrase into Fts3Expr.aDoclist[]/nDoclist. See also -** fts3ExprLoadDoclists(). -*/ -static int fts3ExprLoadDoclistsCb(Fts3Expr *pExpr, int iPhrase, void *ctx){ - int rc = SQLITE_OK; - Fts3Phrase *pPhrase = pExpr->pPhrase; - LoadDoclistCtx *p = (LoadDoclistCtx *)ctx; - - UNUSED_PARAMETER(iPhrase); - - p->nPhrase++; - p->nToken += pPhrase->nToken; - - return rc; -} - -/* -** Load the doclists for each phrase in the query associated with FTS3 cursor -** pCsr. -** -** If pnPhrase is not NULL, then *pnPhrase is set to the number of matchable -** phrases in the expression (all phrases except those directly or -** indirectly descended from the right-hand-side of a NOT operator). If -** pnToken is not NULL, then it is set to the number of tokens in all -** matchable phrases of the expression. -*/ -static int fts3ExprLoadDoclists( - Fts3Cursor *pCsr, /* Fts3 cursor for current query */ - int *pnPhrase, /* OUT: Number of phrases in query */ - int *pnToken /* OUT: Number of tokens in query */ -){ - int rc; /* Return Code */ - LoadDoclistCtx sCtx = {0,0,0}; /* Context for fts3ExprIterate() */ - sCtx.pCsr = pCsr; - rc = fts3ExprIterate(pCsr->pExpr, fts3ExprLoadDoclistsCb, (void *)&sCtx); - if( pnPhrase ) *pnPhrase = sCtx.nPhrase; - if( pnToken ) *pnToken = sCtx.nToken; - return rc; -} - -static int fts3ExprPhraseCountCb(Fts3Expr *pExpr, int iPhrase, void *ctx){ - (*(int *)ctx)++; - UNUSED_PARAMETER(pExpr); - UNUSED_PARAMETER(iPhrase); - return SQLITE_OK; -} -static int fts3ExprPhraseCount(Fts3Expr *pExpr){ - int nPhrase = 0; - (void)fts3ExprIterate(pExpr, fts3ExprPhraseCountCb, (void *)&nPhrase); - return nPhrase; -} - -/* -** Advance the position list iterator specified by the first two -** arguments so that it points to the first element with a value greater -** than or equal to parameter iNext. -*/ -static void fts3SnippetAdvance(char **ppIter, int *piIter, int iNext){ - char *pIter = *ppIter; - if( pIter ){ - int iIter = *piIter; - - while( iIteriCurrent<0 ){ - /* The SnippetIter object has just been initialized. The first snippet - ** candidate always starts at offset 0 (even if this candidate has a - ** score of 0.0). - */ - pIter->iCurrent = 0; - - /* Advance the 'head' iterator of each phrase to the first offset that - ** is greater than or equal to (iNext+nSnippet). - */ - for(i=0; inPhrase; i++){ - SnippetPhrase *pPhrase = &pIter->aPhrase[i]; - fts3SnippetAdvance(&pPhrase->pHead, &pPhrase->iHead, pIter->nSnippet); - } - }else{ - int iStart; - int iEnd = 0x7FFFFFFF; - - for(i=0; inPhrase; i++){ - SnippetPhrase *pPhrase = &pIter->aPhrase[i]; - if( pPhrase->pHead && pPhrase->iHeadiHead; - } - } - if( iEnd==0x7FFFFFFF ){ - return 1; - } - - pIter->iCurrent = iStart = iEnd - pIter->nSnippet + 1; - for(i=0; inPhrase; i++){ - SnippetPhrase *pPhrase = &pIter->aPhrase[i]; - fts3SnippetAdvance(&pPhrase->pHead, &pPhrase->iHead, iEnd+1); - fts3SnippetAdvance(&pPhrase->pTail, &pPhrase->iTail, iStart); - } - } - - return 0; -} - -/* -** Retrieve information about the current candidate snippet of snippet -** iterator pIter. -*/ -static void fts3SnippetDetails( - SnippetIter *pIter, /* Snippet iterator */ - u64 mCovered, /* Bitmask of phrases already covered */ - int *piToken, /* OUT: First token of proposed snippet */ - int *piScore, /* OUT: "Score" for this snippet */ - u64 *pmCover, /* OUT: Bitmask of phrases covered */ - u64 *pmHighlight /* OUT: Bitmask of terms to highlight */ -){ - int iStart = pIter->iCurrent; /* First token of snippet */ - int iScore = 0; /* Score of this snippet */ - int i; /* Loop counter */ - u64 mCover = 0; /* Mask of phrases covered by this snippet */ - u64 mHighlight = 0; /* Mask of tokens to highlight in snippet */ - - for(i=0; inPhrase; i++){ - SnippetPhrase *pPhrase = &pIter->aPhrase[i]; - if( pPhrase->pTail ){ - char *pCsr = pPhrase->pTail; - int iCsr = pPhrase->iTail; - - while( iCsr<(iStart+pIter->nSnippet) ){ - int j; - u64 mPhrase = (u64)1 << i; - u64 mPos = (u64)1 << (iCsr - iStart); - assert( iCsr>=iStart ); - if( (mCover|mCovered)&mPhrase ){ - iScore++; - }else{ - iScore += 1000; - } - mCover |= mPhrase; - - for(j=0; jnToken; j++){ - mHighlight |= (mPos>>j); - } - - if( 0==(*pCsr & 0x0FE) ) break; - fts3GetDeltaPosition(&pCsr, &iCsr); - } - } - } - - /* Set the output variables before returning. */ - *piToken = iStart; - *piScore = iScore; - *pmCover = mCover; - *pmHighlight = mHighlight; -} - -/* -** This function is an fts3ExprIterate() callback used by fts3BestSnippet(). -** Each invocation populates an element of the SnippetIter.aPhrase[] array. -*/ -static int fts3SnippetFindPositions(Fts3Expr *pExpr, int iPhrase, void *ctx){ - SnippetIter *p = (SnippetIter *)ctx; - SnippetPhrase *pPhrase = &p->aPhrase[iPhrase]; - char *pCsr; - int rc; - - pPhrase->nToken = pExpr->pPhrase->nToken; - rc = sqlite3Fts3EvalPhrasePoslist(p->pCsr, pExpr, p->iCol, &pCsr); - assert( rc==SQLITE_OK || pCsr==0 ); - if( pCsr ){ - int iFirst = 0; - pPhrase->pList = pCsr; - fts3GetDeltaPosition(&pCsr, &iFirst); - assert( iFirst>=0 ); - pPhrase->pHead = pCsr; - pPhrase->pTail = pCsr; - pPhrase->iHead = iFirst; - pPhrase->iTail = iFirst; - }else{ - assert( rc!=SQLITE_OK || ( - pPhrase->pList==0 && pPhrase->pHead==0 && pPhrase->pTail==0 - )); - } - - return rc; -} - -/* -** Select the fragment of text consisting of nFragment contiguous tokens -** from column iCol that represent the "best" snippet. The best snippet -** is the snippet with the highest score, where scores are calculated -** by adding: -** -** (a) +1 point for each occurrence of a matchable phrase in the snippet. -** -** (b) +1000 points for the first occurrence of each matchable phrase in -** the snippet for which the corresponding mCovered bit is not set. -** -** The selected snippet parameters are stored in structure *pFragment before -** returning. The score of the selected snippet is stored in *piScore -** before returning. -*/ -static int fts3BestSnippet( - int nSnippet, /* Desired snippet length */ - Fts3Cursor *pCsr, /* Cursor to create snippet for */ - int iCol, /* Index of column to create snippet from */ - u64 mCovered, /* Mask of phrases already covered */ - u64 *pmSeen, /* IN/OUT: Mask of phrases seen */ - SnippetFragment *pFragment, /* OUT: Best snippet found */ - int *piScore /* OUT: Score of snippet pFragment */ -){ - int rc; /* Return Code */ - int nList; /* Number of phrases in expression */ - SnippetIter sIter; /* Iterates through snippet candidates */ - int nByte; /* Number of bytes of space to allocate */ - int iBestScore = -1; /* Best snippet score found so far */ - int i; /* Loop counter */ - - memset(&sIter, 0, sizeof(sIter)); - - /* Iterate through the phrases in the expression to count them. The same - ** callback makes sure the doclists are loaded for each phrase. - */ - rc = fts3ExprLoadDoclists(pCsr, &nList, 0); - if( rc!=SQLITE_OK ){ - return rc; - } - - /* Now that it is known how many phrases there are, allocate and zero - ** the required space using malloc(). - */ - nByte = sizeof(SnippetPhrase) * nList; - sIter.aPhrase = (SnippetPhrase *)sqlite3_malloc(nByte); - if( !sIter.aPhrase ){ - return SQLITE_NOMEM; - } - memset(sIter.aPhrase, 0, nByte); - - /* Initialize the contents of the SnippetIter object. Then iterate through - ** the set of phrases in the expression to populate the aPhrase[] array. - */ - sIter.pCsr = pCsr; - sIter.iCol = iCol; - sIter.nSnippet = nSnippet; - sIter.nPhrase = nList; - sIter.iCurrent = -1; - (void)fts3ExprIterate(pCsr->pExpr, fts3SnippetFindPositions, (void *)&sIter); - - /* Set the *pmSeen output variable. */ - for(i=0; iiCol = iCol; - while( !fts3SnippetNextCandidate(&sIter) ){ - int iPos; - int iScore; - u64 mCover; - u64 mHighlight; - fts3SnippetDetails(&sIter, mCovered, &iPos, &iScore, &mCover, &mHighlight); - assert( iScore>=0 ); - if( iScore>iBestScore ){ - pFragment->iPos = iPos; - pFragment->hlmask = mHighlight; - pFragment->covered = mCover; - iBestScore = iScore; - } - } - - sqlite3_free(sIter.aPhrase); - *piScore = iBestScore; - return SQLITE_OK; -} - - -/* -** Append a string to the string-buffer passed as the first argument. -** -** If nAppend is negative, then the length of the string zAppend is -** determined using strlen(). -*/ -static int fts3StringAppend( - StrBuffer *pStr, /* Buffer to append to */ - const char *zAppend, /* Pointer to data to append to buffer */ - int nAppend /* Size of zAppend in bytes (or -1) */ -){ - if( nAppend<0 ){ - nAppend = (int)strlen(zAppend); - } - - /* If there is insufficient space allocated at StrBuffer.z, use realloc() - ** to grow the buffer until so that it is big enough to accomadate the - ** appended data. - */ - if( pStr->n+nAppend+1>=pStr->nAlloc ){ - int nAlloc = pStr->nAlloc+nAppend+100; - char *zNew = sqlite3_realloc(pStr->z, nAlloc); - if( !zNew ){ - return SQLITE_NOMEM; - } - pStr->z = zNew; - pStr->nAlloc = nAlloc; - } - assert( pStr->z!=0 && (pStr->nAlloc >= pStr->n+nAppend+1) ); - - /* Append the data to the string buffer. */ - memcpy(&pStr->z[pStr->n], zAppend, nAppend); - pStr->n += nAppend; - pStr->z[pStr->n] = '\0'; - - return SQLITE_OK; -} - -/* -** The fts3BestSnippet() function often selects snippets that end with a -** query term. That is, the final term of the snippet is always a term -** that requires highlighting. For example, if 'X' is a highlighted term -** and '.' is a non-highlighted term, BestSnippet() may select: -** -** ........X.....X -** -** This function "shifts" the beginning of the snippet forward in the -** document so that there are approximately the same number of -** non-highlighted terms to the right of the final highlighted term as there -** are to the left of the first highlighted term. For example, to this: -** -** ....X.....X.... -** -** This is done as part of extracting the snippet text, not when selecting -** the snippet. Snippet selection is done based on doclists only, so there -** is no way for fts3BestSnippet() to know whether or not the document -** actually contains terms that follow the final highlighted term. -*/ -static int fts3SnippetShift( - Fts3Table *pTab, /* FTS3 table snippet comes from */ - int iLangid, /* Language id to use in tokenizing */ - int nSnippet, /* Number of tokens desired for snippet */ - const char *zDoc, /* Document text to extract snippet from */ - int nDoc, /* Size of buffer zDoc in bytes */ - int *piPos, /* IN/OUT: First token of snippet */ - u64 *pHlmask /* IN/OUT: Mask of tokens to highlight */ -){ - u64 hlmask = *pHlmask; /* Local copy of initial highlight-mask */ - - if( hlmask ){ - int nLeft; /* Tokens to the left of first highlight */ - int nRight; /* Tokens to the right of last highlight */ - int nDesired; /* Ideal number of tokens to shift forward */ - - for(nLeft=0; !(hlmask & ((u64)1 << nLeft)); nLeft++); - for(nRight=0; !(hlmask & ((u64)1 << (nSnippet-1-nRight))); nRight++); - nDesired = (nLeft-nRight)/2; - - /* Ideally, the start of the snippet should be pushed forward in the - ** document nDesired tokens. This block checks if there are actually - ** nDesired tokens to the right of the snippet. If so, *piPos and - ** *pHlMask are updated to shift the snippet nDesired tokens to the - ** right. Otherwise, the snippet is shifted by the number of tokens - ** available. - */ - if( nDesired>0 ){ - int nShift; /* Number of tokens to shift snippet by */ - int iCurrent = 0; /* Token counter */ - int rc; /* Return Code */ - sqlite3_tokenizer_module *pMod; - sqlite3_tokenizer_cursor *pC; - pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule; - - /* Open a cursor on zDoc/nDoc. Check if there are (nSnippet+nDesired) - ** or more tokens in zDoc/nDoc. - */ - rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, iLangid, zDoc, nDoc, &pC); - if( rc!=SQLITE_OK ){ - return rc; - } - while( rc==SQLITE_OK && iCurrent<(nSnippet+nDesired) ){ - const char *ZDUMMY; int DUMMY1 = 0, DUMMY2 = 0, DUMMY3 = 0; - rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &DUMMY2, &DUMMY3, &iCurrent); - } - pMod->xClose(pC); - if( rc!=SQLITE_OK && rc!=SQLITE_DONE ){ return rc; } - - nShift = (rc==SQLITE_DONE)+iCurrent-nSnippet; - assert( nShift<=nDesired ); - if( nShift>0 ){ - *piPos += nShift; - *pHlmask = hlmask >> nShift; - } - } - } - return SQLITE_OK; -} - -/* -** Extract the snippet text for fragment pFragment from cursor pCsr and -** append it to string buffer pOut. -*/ -static int fts3SnippetText( - Fts3Cursor *pCsr, /* FTS3 Cursor */ - SnippetFragment *pFragment, /* Snippet to extract */ - int iFragment, /* Fragment number */ - int isLast, /* True for final fragment in snippet */ - int nSnippet, /* Number of tokens in extracted snippet */ - const char *zOpen, /* String inserted before highlighted term */ - const char *zClose, /* String inserted after highlighted term */ - const char *zEllipsis, /* String inserted between snippets */ - StrBuffer *pOut /* Write output here */ -){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int rc; /* Return code */ - const char *zDoc; /* Document text to extract snippet from */ - int nDoc; /* Size of zDoc in bytes */ - int iCurrent = 0; /* Current token number of document */ - int iEnd = 0; /* Byte offset of end of current token */ - int isShiftDone = 0; /* True after snippet is shifted */ - int iPos = pFragment->iPos; /* First token of snippet */ - u64 hlmask = pFragment->hlmask; /* Highlight-mask for snippet */ - int iCol = pFragment->iCol+1; /* Query column to extract text from */ - sqlite3_tokenizer_module *pMod; /* Tokenizer module methods object */ - sqlite3_tokenizer_cursor *pC; /* Tokenizer cursor open on zDoc/nDoc */ - - zDoc = (const char *)sqlite3_column_text(pCsr->pStmt, iCol); - if( zDoc==0 ){ - if( sqlite3_column_type(pCsr->pStmt, iCol)!=SQLITE_NULL ){ - return SQLITE_NOMEM; - } - return SQLITE_OK; - } - nDoc = sqlite3_column_bytes(pCsr->pStmt, iCol); - - /* Open a token cursor on the document. */ - pMod = (sqlite3_tokenizer_module *)pTab->pTokenizer->pModule; - rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, zDoc,nDoc,&pC); - if( rc!=SQLITE_OK ){ - return rc; - } - - while( rc==SQLITE_OK ){ - const char *ZDUMMY; /* Dummy argument used with tokenizer */ - int DUMMY1 = -1; /* Dummy argument used with tokenizer */ - int iBegin = 0; /* Offset in zDoc of start of token */ - int iFin = 0; /* Offset in zDoc of end of token */ - int isHighlight = 0; /* True for highlighted terms */ - - /* Variable DUMMY1 is initialized to a negative value above. Elsewhere - ** in the FTS code the variable that the third argument to xNext points to - ** is initialized to zero before the first (*but not necessarily - ** subsequent*) call to xNext(). This is done for a particular application - ** that needs to know whether or not the tokenizer is being used for - ** snippet generation or for some other purpose. - ** - ** Extreme care is required when writing code to depend on this - ** initialization. It is not a documented part of the tokenizer interface. - ** If a tokenizer is used directly by any code outside of FTS, this - ** convention might not be respected. */ - rc = pMod->xNext(pC, &ZDUMMY, &DUMMY1, &iBegin, &iFin, &iCurrent); - if( rc!=SQLITE_OK ){ - if( rc==SQLITE_DONE ){ - /* Special case - the last token of the snippet is also the last token - ** of the column. Append any punctuation that occurred between the end - ** of the previous token and the end of the document to the output. - ** Then break out of the loop. */ - rc = fts3StringAppend(pOut, &zDoc[iEnd], -1); - } - break; - } - if( iCurrentiLangid, nSnippet, &zDoc[iBegin], n, &iPos, &hlmask - ); - isShiftDone = 1; - - /* Now that the shift has been done, check if the initial "..." are - ** required. They are required if (a) this is not the first fragment, - ** or (b) this fragment does not begin at position 0 of its column. - */ - if( rc==SQLITE_OK && (iPos>0 || iFragment>0) ){ - rc = fts3StringAppend(pOut, zEllipsis, -1); - } - if( rc!=SQLITE_OK || iCurrent=(iPos+nSnippet) ){ - if( isLast ){ - rc = fts3StringAppend(pOut, zEllipsis, -1); - } - break; - } - - /* Set isHighlight to true if this term should be highlighted. */ - isHighlight = (hlmask & ((u64)1 << (iCurrent-iPos)))!=0; - - if( iCurrent>iPos ) rc = fts3StringAppend(pOut, &zDoc[iEnd], iBegin-iEnd); - if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zOpen, -1); - if( rc==SQLITE_OK ) rc = fts3StringAppend(pOut, &zDoc[iBegin], iFin-iBegin); - if( rc==SQLITE_OK && isHighlight ) rc = fts3StringAppend(pOut, zClose, -1); - - iEnd = iFin; - } - - pMod->xClose(pC); - return rc; -} - - -/* -** This function is used to count the entries in a column-list (a -** delta-encoded list of term offsets within a single column of a single -** row). When this function is called, *ppCollist should point to the -** beginning of the first varint in the column-list (the varint that -** contains the position of the first matching term in the column data). -** Before returning, *ppCollist is set to point to the first byte after -** the last varint in the column-list (either the 0x00 signifying the end -** of the position-list, or the 0x01 that precedes the column number of -** the next column in the position-list). -** -** The number of elements in the column-list is returned. -*/ -static int fts3ColumnlistCount(char **ppCollist){ - char *pEnd = *ppCollist; - char c = 0; - int nEntry = 0; - - /* A column-list is terminated by either a 0x01 or 0x00. */ - while( 0xFE & (*pEnd | c) ){ - c = *pEnd++ & 0x80; - if( !c ) nEntry++; - } - - *ppCollist = pEnd; - return nEntry; -} - -/* -** fts3ExprIterate() callback used to collect the "global" matchinfo stats -** for a single query. -** -** fts3ExprIterate() callback to load the 'global' elements of a -** FTS3_MATCHINFO_HITS matchinfo array. The global stats are those elements -** of the matchinfo array that are constant for all rows returned by the -** current query. -** -** Argument pCtx is actually a pointer to a struct of type MatchInfo. This -** function populates Matchinfo.aMatchinfo[] as follows: -** -** for(iCol=0; iColpCursor, pExpr, &p->aMatchinfo[3*iPhrase*p->nCol] - ); -} - -/* -** fts3ExprIterate() callback used to collect the "local" part of the -** FTS3_MATCHINFO_HITS array. The local stats are those elements of the -** array that are different for each row returned by the query. -*/ -static int fts3ExprLocalHitsCb( - Fts3Expr *pExpr, /* Phrase expression node */ - int iPhrase, /* Phrase number */ - void *pCtx /* Pointer to MatchInfo structure */ -){ - int rc = SQLITE_OK; - MatchInfo *p = (MatchInfo *)pCtx; - int iStart = iPhrase * p->nCol * 3; - int i; - - for(i=0; inCol && rc==SQLITE_OK; i++){ - char *pCsr; - rc = sqlite3Fts3EvalPhrasePoslist(p->pCursor, pExpr, i, &pCsr); - if( pCsr ){ - p->aMatchinfo[iStart+i*3] = fts3ColumnlistCount(&pCsr); - }else{ - p->aMatchinfo[iStart+i*3] = 0; - } - } - - return rc; -} - -static int fts3MatchinfoCheck( - Fts3Table *pTab, - char cArg, - char **pzErr -){ - if( (cArg==FTS3_MATCHINFO_NPHRASE) - || (cArg==FTS3_MATCHINFO_NCOL) - || (cArg==FTS3_MATCHINFO_NDOC && pTab->bFts4) - || (cArg==FTS3_MATCHINFO_AVGLENGTH && pTab->bFts4) - || (cArg==FTS3_MATCHINFO_LENGTH && pTab->bHasDocsize) - || (cArg==FTS3_MATCHINFO_LCS) - || (cArg==FTS3_MATCHINFO_HITS) - ){ - return SQLITE_OK; - } - *pzErr = sqlite3_mprintf("unrecognized matchinfo request: %c", cArg); - return SQLITE_ERROR; -} - -static int fts3MatchinfoSize(MatchInfo *pInfo, char cArg){ - int nVal; /* Number of integers output by cArg */ - - switch( cArg ){ - case FTS3_MATCHINFO_NDOC: - case FTS3_MATCHINFO_NPHRASE: - case FTS3_MATCHINFO_NCOL: - nVal = 1; - break; - - case FTS3_MATCHINFO_AVGLENGTH: - case FTS3_MATCHINFO_LENGTH: - case FTS3_MATCHINFO_LCS: - nVal = pInfo->nCol; - break; - - default: - assert( cArg==FTS3_MATCHINFO_HITS ); - nVal = pInfo->nCol * pInfo->nPhrase * 3; - break; - } - - return nVal; -} - -static int fts3MatchinfoSelectDoctotal( - Fts3Table *pTab, - sqlite3_stmt **ppStmt, - sqlite3_int64 *pnDoc, - const char **paLen -){ - sqlite3_stmt *pStmt; - const char *a; - sqlite3_int64 nDoc; - - if( !*ppStmt ){ - int rc = sqlite3Fts3SelectDoctotal(pTab, ppStmt); - if( rc!=SQLITE_OK ) return rc; - } - pStmt = *ppStmt; - assert( sqlite3_data_count(pStmt)==1 ); - - a = sqlite3_column_blob(pStmt, 0); - a += sqlite3Fts3GetVarint(a, &nDoc); - if( nDoc==0 ) return FTS_CORRUPT_VTAB; - *pnDoc = (u32)nDoc; - - if( paLen ) *paLen = a; - return SQLITE_OK; -} - -/* -** An instance of the following structure is used to store state while -** iterating through a multi-column position-list corresponding to the -** hits for a single phrase on a single row in order to calculate the -** values for a matchinfo() FTS3_MATCHINFO_LCS request. -*/ -typedef struct LcsIterator LcsIterator; -struct LcsIterator { - Fts3Expr *pExpr; /* Pointer to phrase expression */ - int iPosOffset; /* Tokens count up to end of this phrase */ - char *pRead; /* Cursor used to iterate through aDoclist */ - int iPos; /* Current position */ -}; - -/* -** If LcsIterator.iCol is set to the following value, the iterator has -** finished iterating through all offsets for all columns. -*/ -#define LCS_ITERATOR_FINISHED 0x7FFFFFFF; - -static int fts3MatchinfoLcsCb( - Fts3Expr *pExpr, /* Phrase expression node */ - int iPhrase, /* Phrase number (numbered from zero) */ - void *pCtx /* Pointer to MatchInfo structure */ -){ - LcsIterator *aIter = (LcsIterator *)pCtx; - aIter[iPhrase].pExpr = pExpr; - return SQLITE_OK; -} - -/* -** Advance the iterator passed as an argument to the next position. Return -** 1 if the iterator is at EOF or if it now points to the start of the -** position list for the next column. -*/ -static int fts3LcsIteratorAdvance(LcsIterator *pIter){ - char *pRead = pIter->pRead; - sqlite3_int64 iRead; - int rc = 0; - - pRead += sqlite3Fts3GetVarint(pRead, &iRead); - if( iRead==0 || iRead==1 ){ - pRead = 0; - rc = 1; - }else{ - pIter->iPos += (int)(iRead-2); - } - - pIter->pRead = pRead; - return rc; -} - -/* -** This function implements the FTS3_MATCHINFO_LCS matchinfo() flag. -** -** If the call is successful, the longest-common-substring lengths for each -** column are written into the first nCol elements of the pInfo->aMatchinfo[] -** array before returning. SQLITE_OK is returned in this case. -** -** Otherwise, if an error occurs, an SQLite error code is returned and the -** data written to the first nCol elements of pInfo->aMatchinfo[] is -** undefined. -*/ -static int fts3MatchinfoLcs(Fts3Cursor *pCsr, MatchInfo *pInfo){ - LcsIterator *aIter; - int i; - int iCol; - int nToken = 0; - - /* Allocate and populate the array of LcsIterator objects. The array - ** contains one element for each matchable phrase in the query. - **/ - aIter = sqlite3_malloc(sizeof(LcsIterator) * pCsr->nPhrase); - if( !aIter ) return SQLITE_NOMEM; - memset(aIter, 0, sizeof(LcsIterator) * pCsr->nPhrase); - (void)fts3ExprIterate(pCsr->pExpr, fts3MatchinfoLcsCb, (void*)aIter); - - for(i=0; inPhrase; i++){ - LcsIterator *pIter = &aIter[i]; - nToken -= pIter->pExpr->pPhrase->nToken; - pIter->iPosOffset = nToken; - } - - for(iCol=0; iColnCol; iCol++){ - int nLcs = 0; /* LCS value for this column */ - int nLive = 0; /* Number of iterators in aIter not at EOF */ - - for(i=0; inPhrase; i++){ - int rc; - LcsIterator *pIt = &aIter[i]; - rc = sqlite3Fts3EvalPhrasePoslist(pCsr, pIt->pExpr, iCol, &pIt->pRead); - if( rc!=SQLITE_OK ) return rc; - if( pIt->pRead ){ - pIt->iPos = pIt->iPosOffset; - fts3LcsIteratorAdvance(&aIter[i]); - nLive++; - } - } - - while( nLive>0 ){ - LcsIterator *pAdv = 0; /* The iterator to advance by one position */ - int nThisLcs = 0; /* LCS for the current iterator positions */ - - for(i=0; inPhrase; i++){ - LcsIterator *pIter = &aIter[i]; - if( pIter->pRead==0 ){ - /* This iterator is already at EOF for this column. */ - nThisLcs = 0; - }else{ - if( pAdv==0 || pIter->iPosiPos ){ - pAdv = pIter; - } - if( nThisLcs==0 || pIter->iPos==pIter[-1].iPos ){ - nThisLcs++; - }else{ - nThisLcs = 1; - } - if( nThisLcs>nLcs ) nLcs = nThisLcs; - } - } - if( fts3LcsIteratorAdvance(pAdv) ) nLive--; - } - - pInfo->aMatchinfo[iCol] = nLcs; - } - - sqlite3_free(aIter); - return SQLITE_OK; -} - -/* -** Populate the buffer pInfo->aMatchinfo[] with an array of integers to -** be returned by the matchinfo() function. Argument zArg contains the -** format string passed as the second argument to matchinfo (or the -** default value "pcx" if no second argument was specified). The format -** string has already been validated and the pInfo->aMatchinfo[] array -** is guaranteed to be large enough for the output. -** -** If bGlobal is true, then populate all fields of the matchinfo() output. -** If it is false, then assume that those fields that do not change between -** rows (i.e. FTS3_MATCHINFO_NPHRASE, NCOL, NDOC, AVGLENGTH and part of HITS) -** have already been populated. -** -** Return SQLITE_OK if successful, or an SQLite error code if an error -** occurs. If a value other than SQLITE_OK is returned, the state the -** pInfo->aMatchinfo[] buffer is left in is undefined. -*/ -static int fts3MatchinfoValues( - Fts3Cursor *pCsr, /* FTS3 cursor object */ - int bGlobal, /* True to grab the global stats */ - MatchInfo *pInfo, /* Matchinfo context object */ - const char *zArg /* Matchinfo format string */ -){ - int rc = SQLITE_OK; - int i; - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - sqlite3_stmt *pSelect = 0; - - for(i=0; rc==SQLITE_OK && zArg[i]; i++){ - - switch( zArg[i] ){ - case FTS3_MATCHINFO_NPHRASE: - if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nPhrase; - break; - - case FTS3_MATCHINFO_NCOL: - if( bGlobal ) pInfo->aMatchinfo[0] = pInfo->nCol; - break; - - case FTS3_MATCHINFO_NDOC: - if( bGlobal ){ - sqlite3_int64 nDoc = 0; - rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, 0); - pInfo->aMatchinfo[0] = (u32)nDoc; - } - break; - - case FTS3_MATCHINFO_AVGLENGTH: - if( bGlobal ){ - sqlite3_int64 nDoc; /* Number of rows in table */ - const char *a; /* Aggregate column length array */ - - rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &nDoc, &a); - if( rc==SQLITE_OK ){ - int iCol; - for(iCol=0; iColnCol; iCol++){ - u32 iVal; - sqlite3_int64 nToken; - a += sqlite3Fts3GetVarint(a, &nToken); - iVal = (u32)(((u32)(nToken&0xffffffff)+nDoc/2)/nDoc); - pInfo->aMatchinfo[iCol] = iVal; - } - } - } - break; - - case FTS3_MATCHINFO_LENGTH: { - sqlite3_stmt *pSelectDocsize = 0; - rc = sqlite3Fts3SelectDocsize(pTab, pCsr->iPrevId, &pSelectDocsize); - if( rc==SQLITE_OK ){ - int iCol; - const char *a = sqlite3_column_blob(pSelectDocsize, 0); - for(iCol=0; iColnCol; iCol++){ - sqlite3_int64 nToken; - a += sqlite3Fts3GetVarint(a, &nToken); - pInfo->aMatchinfo[iCol] = (u32)nToken; - } - } - sqlite3_reset(pSelectDocsize); - break; - } - - case FTS3_MATCHINFO_LCS: - rc = fts3ExprLoadDoclists(pCsr, 0, 0); - if( rc==SQLITE_OK ){ - rc = fts3MatchinfoLcs(pCsr, pInfo); - } - break; - - default: { - Fts3Expr *pExpr; - assert( zArg[i]==FTS3_MATCHINFO_HITS ); - pExpr = pCsr->pExpr; - rc = fts3ExprLoadDoclists(pCsr, 0, 0); - if( rc!=SQLITE_OK ) break; - if( bGlobal ){ - if( pCsr->pDeferred ){ - rc = fts3MatchinfoSelectDoctotal(pTab, &pSelect, &pInfo->nDoc, 0); - if( rc!=SQLITE_OK ) break; - } - rc = fts3ExprIterate(pExpr, fts3ExprGlobalHitsCb,(void*)pInfo); - if( rc!=SQLITE_OK ) break; - } - (void)fts3ExprIterate(pExpr, fts3ExprLocalHitsCb,(void*)pInfo); - break; - } - } - - pInfo->aMatchinfo += fts3MatchinfoSize(pInfo, zArg[i]); - } - - sqlite3_reset(pSelect); - return rc; -} - - -/* -** Populate pCsr->aMatchinfo[] with data for the current row. The -** 'matchinfo' data is an array of 32-bit unsigned integers (C type u32). -*/ -static int fts3GetMatchinfo( - Fts3Cursor *pCsr, /* FTS3 Cursor object */ - const char *zArg /* Second argument to matchinfo() function */ -){ - MatchInfo sInfo; - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int rc = SQLITE_OK; - int bGlobal = 0; /* Collect 'global' stats as well as local */ - - memset(&sInfo, 0, sizeof(MatchInfo)); - sInfo.pCursor = pCsr; - sInfo.nCol = pTab->nColumn; - - /* If there is cached matchinfo() data, but the format string for the - ** cache does not match the format string for this request, discard - ** the cached data. */ - if( pCsr->zMatchinfo && strcmp(pCsr->zMatchinfo, zArg) ){ - assert( pCsr->aMatchinfo ); - sqlite3_free(pCsr->aMatchinfo); - pCsr->zMatchinfo = 0; - pCsr->aMatchinfo = 0; - } - - /* If Fts3Cursor.aMatchinfo[] is NULL, then this is the first time the - ** matchinfo function has been called for this query. In this case - ** allocate the array used to accumulate the matchinfo data and - ** initialize those elements that are constant for every row. - */ - if( pCsr->aMatchinfo==0 ){ - int nMatchinfo = 0; /* Number of u32 elements in match-info */ - int nArg; /* Bytes in zArg */ - int i; /* Used to iterate through zArg */ - - /* Determine the number of phrases in the query */ - pCsr->nPhrase = fts3ExprPhraseCount(pCsr->pExpr); - sInfo.nPhrase = pCsr->nPhrase; - - /* Determine the number of integers in the buffer returned by this call. */ - for(i=0; zArg[i]; i++){ - nMatchinfo += fts3MatchinfoSize(&sInfo, zArg[i]); - } - - /* Allocate space for Fts3Cursor.aMatchinfo[] and Fts3Cursor.zMatchinfo. */ - nArg = (int)strlen(zArg); - pCsr->aMatchinfo = (u32 *)sqlite3_malloc(sizeof(u32)*nMatchinfo + nArg + 1); - if( !pCsr->aMatchinfo ) return SQLITE_NOMEM; - - pCsr->zMatchinfo = (char *)&pCsr->aMatchinfo[nMatchinfo]; - pCsr->nMatchinfo = nMatchinfo; - memcpy(pCsr->zMatchinfo, zArg, nArg+1); - memset(pCsr->aMatchinfo, 0, sizeof(u32)*nMatchinfo); - pCsr->isMatchinfoNeeded = 1; - bGlobal = 1; - } - - sInfo.aMatchinfo = pCsr->aMatchinfo; - sInfo.nPhrase = pCsr->nPhrase; - if( pCsr->isMatchinfoNeeded ){ - rc = fts3MatchinfoValues(pCsr, bGlobal, &sInfo, zArg); - pCsr->isMatchinfoNeeded = 0; - } - - return rc; -} - -/* -** Implementation of snippet() function. -*/ -SQLITE_PRIVATE void sqlite3Fts3Snippet( - sqlite3_context *pCtx, /* SQLite function call context */ - Fts3Cursor *pCsr, /* Cursor object */ - const char *zStart, /* Snippet start text - "" */ - const char *zEnd, /* Snippet end text - "" */ - const char *zEllipsis, /* Snippet ellipsis text - "..." */ - int iCol, /* Extract snippet from this column */ - int nToken /* Approximate number of tokens in snippet */ -){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int rc = SQLITE_OK; - int i; - StrBuffer res = {0, 0, 0}; - - /* The returned text includes up to four fragments of text extracted from - ** the data in the current row. The first iteration of the for(...) loop - ** below attempts to locate a single fragment of text nToken tokens in - ** size that contains at least one instance of all phrases in the query - ** expression that appear in the current row. If such a fragment of text - ** cannot be found, the second iteration of the loop attempts to locate - ** a pair of fragments, and so on. - */ - int nSnippet = 0; /* Number of fragments in this snippet */ - SnippetFragment aSnippet[4]; /* Maximum of 4 fragments per snippet */ - int nFToken = -1; /* Number of tokens in each fragment */ - - if( !pCsr->pExpr ){ - sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC); - return; - } - - for(nSnippet=1; 1; nSnippet++){ - - int iSnip; /* Loop counter 0..nSnippet-1 */ - u64 mCovered = 0; /* Bitmask of phrases covered by snippet */ - u64 mSeen = 0; /* Bitmask of phrases seen by BestSnippet() */ - - if( nToken>=0 ){ - nFToken = (nToken+nSnippet-1) / nSnippet; - }else{ - nFToken = -1 * nToken; - } - - for(iSnip=0; iSnipnColumn; iRead++){ - SnippetFragment sF = {0, 0, 0, 0}; - int iS; -#if defined(__minix) - iS = 0; /* LSC: Fix -Os compilation: -Werror=maybe-uninitialized */ -#endif /* defined(__minix) */ - if( iCol>=0 && iRead!=iCol ) continue; - - /* Find the best snippet of nFToken tokens in column iRead. */ - rc = fts3BestSnippet(nFToken, pCsr, iRead, mCovered, &mSeen, &sF, &iS); - if( rc!=SQLITE_OK ){ - goto snippet_out; - } - if( iS>iBestScore ){ - *pFragment = sF; - iBestScore = iS; - } - } - - mCovered |= pFragment->covered; - } - - /* If all query phrases seen by fts3BestSnippet() are present in at least - ** one of the nSnippet snippet fragments, break out of the loop. - */ - assert( (mCovered&mSeen)==mCovered ); - if( mSeen==mCovered || nSnippet==SizeofArray(aSnippet) ) break; - } - - assert( nFToken>0 ); - - for(i=0; ipCsr, pExpr, p->iCol, &pList); - nTerm = pExpr->pPhrase->nToken; - if( pList ){ - fts3GetDeltaPosition(&pList, &iPos); - assert( iPos>=0 ); - } - - for(iTerm=0; iTermaTerm[p->iTerm++]; - pT->iOff = nTerm-iTerm-1; - pT->pList = pList; - pT->iPos = iPos; - } - - return rc; -} - -/* -** Implementation of offsets() function. -*/ -SQLITE_PRIVATE void sqlite3Fts3Offsets( - sqlite3_context *pCtx, /* SQLite function call context */ - Fts3Cursor *pCsr /* Cursor object */ -){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - sqlite3_tokenizer_module const *pMod = pTab->pTokenizer->pModule; - int rc; /* Return Code */ - int nToken; /* Number of tokens in query */ - int iCol; /* Column currently being processed */ - StrBuffer res = {0, 0, 0}; /* Result string */ - TermOffsetCtx sCtx; /* Context for fts3ExprTermOffsetInit() */ - - if( !pCsr->pExpr ){ - sqlite3_result_text(pCtx, "", 0, SQLITE_STATIC); - return; - } - - memset(&sCtx, 0, sizeof(sCtx)); - assert( pCsr->isRequireSeek==0 ); - - /* Count the number of terms in the query */ - rc = fts3ExprLoadDoclists(pCsr, 0, &nToken); - if( rc!=SQLITE_OK ) goto offsets_out; - - /* Allocate the array of TermOffset iterators. */ - sCtx.aTerm = (TermOffset *)sqlite3_malloc(sizeof(TermOffset)*nToken); - if( 0==sCtx.aTerm ){ - rc = SQLITE_NOMEM; - goto offsets_out; - } - sCtx.iDocid = pCsr->iPrevId; - sCtx.pCsr = pCsr; - - /* Loop through the table columns, appending offset information to - ** string-buffer res for each column. - */ - for(iCol=0; iColnColumn; iCol++){ - sqlite3_tokenizer_cursor *pC; /* Tokenizer cursor */ - const char *ZDUMMY; /* Dummy argument used with xNext() */ - int NDUMMY = 0; /* Dummy argument used with xNext() */ - int iStart = 0; - int iEnd = 0; - int iCurrent = 0; - const char *zDoc; - int nDoc; - - /* Initialize the contents of sCtx.aTerm[] for column iCol. There is - ** no way that this operation can fail, so the return code from - ** fts3ExprIterate() can be discarded. - */ - sCtx.iCol = iCol; - sCtx.iTerm = 0; - (void)fts3ExprIterate(pCsr->pExpr, fts3ExprTermOffsetInit, (void *)&sCtx); - - /* Retreive the text stored in column iCol. If an SQL NULL is stored - ** in column iCol, jump immediately to the next iteration of the loop. - ** If an OOM occurs while retrieving the data (this can happen if SQLite - ** needs to transform the data from utf-16 to utf-8), return SQLITE_NOMEM - ** to the caller. - */ - zDoc = (const char *)sqlite3_column_text(pCsr->pStmt, iCol+1); - nDoc = sqlite3_column_bytes(pCsr->pStmt, iCol+1); - if( zDoc==0 ){ - if( sqlite3_column_type(pCsr->pStmt, iCol+1)==SQLITE_NULL ){ - continue; - } - rc = SQLITE_NOMEM; - goto offsets_out; - } - - /* Initialize a tokenizer iterator to iterate through column iCol. */ - rc = sqlite3Fts3OpenTokenizer(pTab->pTokenizer, pCsr->iLangid, - zDoc, nDoc, &pC - ); - if( rc!=SQLITE_OK ) goto offsets_out; - - rc = pMod->xNext(pC, &ZDUMMY, &NDUMMY, &iStart, &iEnd, &iCurrent); - while( rc==SQLITE_OK ){ - int i; /* Used to loop through terms */ - int iMinPos = 0x7FFFFFFF; /* Position of next token */ - TermOffset *pTerm = 0; /* TermOffset associated with next token */ - - for(i=0; ipList && (pT->iPos-pT->iOff)iPos-pT->iOff; - pTerm = pT; - } - } - - if( !pTerm ){ - /* All offsets for this column have been gathered. */ - rc = SQLITE_DONE; - }else{ - assert( iCurrent<=iMinPos ); - if( 0==(0xFE&*pTerm->pList) ){ - pTerm->pList = 0; - }else{ - fts3GetDeltaPosition(&pTerm->pList, &pTerm->iPos); - } - while( rc==SQLITE_OK && iCurrentxNext(pC, &ZDUMMY, &NDUMMY, &iStart, &iEnd, &iCurrent); - } - if( rc==SQLITE_OK ){ - char aBuffer[64]; - sqlite3_snprintf(sizeof(aBuffer), aBuffer, - "%d %d %d %d ", iCol, pTerm-sCtx.aTerm, iStart, iEnd-iStart - ); - rc = fts3StringAppend(&res, aBuffer, -1); - }else if( rc==SQLITE_DONE && pTab->zContentTbl==0 ){ - rc = FTS_CORRUPT_VTAB; - } - } - } - if( rc==SQLITE_DONE ){ - rc = SQLITE_OK; - } - - pMod->xClose(pC); - if( rc!=SQLITE_OK ) goto offsets_out; - } - - offsets_out: - sqlite3_free(sCtx.aTerm); - assert( rc!=SQLITE_DONE ); - sqlite3Fts3SegmentsClose(pTab); - if( rc!=SQLITE_OK ){ - sqlite3_result_error_code(pCtx, rc); - sqlite3_free(res.z); - }else{ - sqlite3_result_text(pCtx, res.z, res.n-1, sqlite3_free); - } - return; -} - -/* -** Implementation of matchinfo() function. -*/ -SQLITE_PRIVATE void sqlite3Fts3Matchinfo( - sqlite3_context *pContext, /* Function call context */ - Fts3Cursor *pCsr, /* FTS3 table cursor */ - const char *zArg /* Second arg to matchinfo() function */ -){ - Fts3Table *pTab = (Fts3Table *)pCsr->base.pVtab; - int rc; - int i; - const char *zFormat; - - if( zArg ){ - for(i=0; zArg[i]; i++){ - char *zErr = 0; - if( fts3MatchinfoCheck(pTab, zArg[i], &zErr) ){ - sqlite3_result_error(pContext, zErr, -1); - sqlite3_free(zErr); - return; - } - } - zFormat = zArg; - }else{ - zFormat = FTS3_MATCHINFO_DEFAULT; - } - - if( !pCsr->pExpr ){ - sqlite3_result_blob(pContext, "", 0, SQLITE_STATIC); - return; - } - - /* Retrieve matchinfo() data. */ - rc = fts3GetMatchinfo(pCsr, zFormat); - sqlite3Fts3SegmentsClose(pTab); - - if( rc!=SQLITE_OK ){ - sqlite3_result_error_code(pContext, rc); - }else{ - int n = pCsr->nMatchinfo * sizeof(u32); - sqlite3_result_blob(pContext, pCsr->aMatchinfo, n, SQLITE_TRANSIENT); - } -} - -#endif - -/************** End of fts3_snippet.c ****************************************/ -/************** Begin file fts3_unicode.c ************************************/ -/* -** 2012 May 24 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -** -** Implementation of the "unicode" full-text-search tokenizer. -*/ - -#ifdef SQLITE_ENABLE_FTS4_UNICODE61 - -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) - -/* #include */ -/* #include */ -/* #include */ -/* #include */ - - -/* -** The following two macros - READ_UTF8 and WRITE_UTF8 - have been copied -** from the sqlite3 source file utf.c. If this file is compiled as part -** of the amalgamation, they are not required. -*/ -#ifndef SQLITE_AMALGAMATION - -static const unsigned char sqlite3Utf8Trans1[] = { - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, - 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, - 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, - 0x00, 0x01, 0x02, 0x03, 0x00, 0x01, 0x00, 0x00, -}; - -#define READ_UTF8(zIn, zTerm, c) \ - c = *(zIn++); \ - if( c>=0xc0 ){ \ - c = sqlite3Utf8Trans1[c-0xc0]; \ - while( zIn!=zTerm && (*zIn & 0xc0)==0x80 ){ \ - c = (c<<6) + (0x3f & *(zIn++)); \ - } \ - if( c<0x80 \ - || (c&0xFFFFF800)==0xD800 \ - || (c&0xFFFFFFFE)==0xFFFE ){ c = 0xFFFD; } \ - } - -#define WRITE_UTF8(zOut, c) { \ - if( c<0x00080 ){ \ - *zOut++ = (u8)(c&0xFF); \ - } \ - else if( c<0x00800 ){ \ - *zOut++ = 0xC0 + (u8)((c>>6)&0x1F); \ - *zOut++ = 0x80 + (u8)(c & 0x3F); \ - } \ - else if( c<0x10000 ){ \ - *zOut++ = 0xE0 + (u8)((c>>12)&0x0F); \ - *zOut++ = 0x80 + (u8)((c>>6) & 0x3F); \ - *zOut++ = 0x80 + (u8)(c & 0x3F); \ - }else{ \ - *zOut++ = 0xF0 + (u8)((c>>18) & 0x07); \ - *zOut++ = 0x80 + (u8)((c>>12) & 0x3F); \ - *zOut++ = 0x80 + (u8)((c>>6) & 0x3F); \ - *zOut++ = 0x80 + (u8)(c & 0x3F); \ - } \ -} - -#endif /* ifndef SQLITE_AMALGAMATION */ - -typedef struct unicode_tokenizer unicode_tokenizer; -typedef struct unicode_cursor unicode_cursor; - -struct unicode_tokenizer { - sqlite3_tokenizer base; - int bRemoveDiacritic; - int nException; - int *aiException; -}; - -struct unicode_cursor { - sqlite3_tokenizer_cursor base; - const unsigned char *aInput; /* Input text being tokenized */ - int nInput; /* Size of aInput[] in bytes */ - int iOff; /* Current offset within aInput[] */ - int iToken; /* Index of next token to be returned */ - char *zToken; /* storage for current token */ - int nAlloc; /* space allocated at zToken */ -}; - - -/* -** Destroy a tokenizer allocated by unicodeCreate(). -*/ -static int unicodeDestroy(sqlite3_tokenizer *pTokenizer){ - if( pTokenizer ){ - unicode_tokenizer *p = (unicode_tokenizer *)pTokenizer; - sqlite3_free(p->aiException); - sqlite3_free(p); - } - return SQLITE_OK; -} - -/* -** As part of a tokenchars= or separators= option, the CREATE VIRTUAL TABLE -** statement has specified that the tokenizer for this table shall consider -** all characters in string zIn/nIn to be separators (if bAlnum==0) or -** token characters (if bAlnum==1). -** -** For each codepoint in the zIn/nIn string, this function checks if the -** sqlite3FtsUnicodeIsalnum() function already returns the desired result. -** If so, no action is taken. Otherwise, the codepoint is added to the -** unicode_tokenizer.aiException[] array. For the purposes of tokenization, -** the return value of sqlite3FtsUnicodeIsalnum() is inverted for all -** codepoints in the aiException[] array. -** -** If a standalone diacritic mark (one that sqlite3FtsUnicodeIsdiacritic() -** identifies as a diacritic) occurs in the zIn/nIn string it is ignored. -** It is not possible to change the behavior of the tokenizer with respect -** to these codepoints. -*/ -static int unicodeAddExceptions( - unicode_tokenizer *p, /* Tokenizer to add exceptions to */ - int bAlnum, /* Replace Isalnum() return value with this */ - const char *zIn, /* Array of characters to make exceptions */ - int nIn /* Length of z in bytes */ -){ - const unsigned char *z = (const unsigned char *)zIn; - const unsigned char *zTerm = &z[nIn]; - int iCode; - int nEntry = 0; - - assert( bAlnum==0 || bAlnum==1 ); - - while( zaiException, (p->nException+nEntry)*sizeof(int)); - if( aNew==0 ) return SQLITE_NOMEM; - nNew = p->nException; - - z = (const unsigned char *)zIn; - while( zi; j--) aNew[j] = aNew[j-1]; - aNew[i] = iCode; - nNew++; - } - } - p->aiException = aNew; - p->nException = nNew; - } - - return SQLITE_OK; -} - -/* -** Return true if the p->aiException[] array contains the value iCode. -*/ -static int unicodeIsException(unicode_tokenizer *p, int iCode){ - if( p->nException>0 ){ - int *a = p->aiException; - int iLo = 0; - int iHi = p->nException-1; - - while( iHi>=iLo ){ - int iTest = (iHi + iLo) / 2; - if( iCode==a[iTest] ){ - return 1; - }else if( iCode>a[iTest] ){ - iLo = iTest+1; - }else{ - iHi = iTest-1; - } - } - } - - return 0; -} - -/* -** Return true if, for the purposes of tokenization, codepoint iCode is -** considered a token character (not a separator). -*/ -static int unicodeIsAlnum(unicode_tokenizer *p, int iCode){ - assert( (sqlite3FtsUnicodeIsalnum(iCode) & 0xFFFFFFFE)==0 ); - return sqlite3FtsUnicodeIsalnum(iCode) ^ unicodeIsException(p, iCode); -} - -/* -** Create a new tokenizer instance. -*/ -static int unicodeCreate( - int nArg, /* Size of array argv[] */ - const char * const *azArg, /* Tokenizer creation arguments */ - sqlite3_tokenizer **pp /* OUT: New tokenizer handle */ -){ - unicode_tokenizer *pNew; /* New tokenizer object */ - int i; - int rc = SQLITE_OK; - - pNew = (unicode_tokenizer *) sqlite3_malloc(sizeof(unicode_tokenizer)); - if( pNew==NULL ) return SQLITE_NOMEM; - memset(pNew, 0, sizeof(unicode_tokenizer)); - pNew->bRemoveDiacritic = 1; - - for(i=0; rc==SQLITE_OK && ibRemoveDiacritic = 1; - } - else if( n==19 && memcmp("remove_diacritics=0", z, 19)==0 ){ - pNew->bRemoveDiacritic = 0; - } - else if( n>=11 && memcmp("tokenchars=", z, 11)==0 ){ - rc = unicodeAddExceptions(pNew, 1, &z[11], n-11); - } - else if( n>=11 && memcmp("separators=", z, 11)==0 ){ - rc = unicodeAddExceptions(pNew, 0, &z[11], n-11); - } - else{ - /* Unrecognized argument */ - rc = SQLITE_ERROR; - } - } - - if( rc!=SQLITE_OK ){ - unicodeDestroy((sqlite3_tokenizer *)pNew); - pNew = 0; - } - *pp = (sqlite3_tokenizer *)pNew; - return rc; -} - -/* -** Prepare to begin tokenizing a particular string. The input -** string to be tokenized is pInput[0..nBytes-1]. A cursor -** used to incrementally tokenize this string is returned in -** *ppCursor. -*/ -static int unicodeOpen( - sqlite3_tokenizer *p, /* The tokenizer */ - const char *aInput, /* Input string */ - int nInput, /* Size of string aInput in bytes */ - sqlite3_tokenizer_cursor **pp /* OUT: New cursor object */ -){ - unicode_cursor *pCsr; - - pCsr = (unicode_cursor *)sqlite3_malloc(sizeof(unicode_cursor)); - if( pCsr==0 ){ - return SQLITE_NOMEM; - } - memset(pCsr, 0, sizeof(unicode_cursor)); - - pCsr->aInput = (const unsigned char *)aInput; - if( aInput==0 ){ - pCsr->nInput = 0; - }else if( nInput<0 ){ - pCsr->nInput = (int)strlen(aInput); - }else{ - pCsr->nInput = nInput; - } - - *pp = &pCsr->base; - UNUSED_PARAMETER(p); - return SQLITE_OK; -} - -/* -** Close a tokenization cursor previously opened by a call to -** simpleOpen() above. -*/ -static int unicodeClose(sqlite3_tokenizer_cursor *pCursor){ - unicode_cursor *pCsr = (unicode_cursor *) pCursor; - sqlite3_free(pCsr->zToken); - sqlite3_free(pCsr); - return SQLITE_OK; -} - -/* -** Extract the next token from a tokenization cursor. The cursor must -** have been opened by a prior call to simpleOpen(). -*/ -static int unicodeNext( - sqlite3_tokenizer_cursor *pC, /* Cursor returned by simpleOpen */ - const char **paToken, /* OUT: Token text */ - int *pnToken, /* OUT: Number of bytes at *paToken */ - int *piStart, /* OUT: Starting offset of token */ - int *piEnd, /* OUT: Ending offset of token */ - int *piPos /* OUT: Position integer of token */ -){ - unicode_cursor *pCsr = (unicode_cursor *)pC; - unicode_tokenizer *p = ((unicode_tokenizer *)pCsr->base.pTokenizer); - int iCode; - char *zOut; - const unsigned char *z = &pCsr->aInput[pCsr->iOff]; - const unsigned char *zStart = z; - const unsigned char *zEnd; - const unsigned char *zTerm = &pCsr->aInput[pCsr->nInput]; - - /* Scan past any delimiter characters before the start of the next token. - ** Return SQLITE_DONE early if this takes us all the way to the end of - ** the input. */ - while( z=zTerm ) return SQLITE_DONE; - - zOut = pCsr->zToken; - do { - int iOut; - - /* Grow the output buffer if required. */ - if( (zOut-pCsr->zToken)>=(pCsr->nAlloc-4) ){ - char *zNew = sqlite3_realloc(pCsr->zToken, pCsr->nAlloc+64); - if( !zNew ) return SQLITE_NOMEM; - zOut = &zNew[zOut - pCsr->zToken]; - pCsr->zToken = zNew; - pCsr->nAlloc += 64; - } - - /* Write the folded case of the last character read to the output */ - zEnd = z; - iOut = sqlite3FtsUnicodeFold(iCode, p->bRemoveDiacritic); - if( iOut ){ - WRITE_UTF8(zOut, iOut); - } - - /* If the cursor is not at EOF, read the next character */ - if( z>=zTerm ) break; - READ_UTF8(z, zTerm, iCode); - }while( unicodeIsAlnum(p, iCode) - || sqlite3FtsUnicodeIsdiacritic(iCode) - ); - - /* Set the output variables and return. */ - pCsr->iOff = (z - pCsr->aInput); - *paToken = pCsr->zToken; - *pnToken = zOut - pCsr->zToken; - *piStart = (zStart - pCsr->aInput); - *piEnd = (zEnd - pCsr->aInput); - *piPos = pCsr->iToken++; - return SQLITE_OK; -} - -/* -** Set *ppModule to a pointer to the sqlite3_tokenizer_module -** structure for the unicode tokenizer. -*/ -SQLITE_PRIVATE void sqlite3Fts3UnicodeTokenizer(sqlite3_tokenizer_module const **ppModule){ - static const sqlite3_tokenizer_module module = { - 0, - unicodeCreate, - unicodeDestroy, - unicodeOpen, - unicodeClose, - unicodeNext, - 0, - }; - *ppModule = &module; -} - -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ -#endif /* ifndef SQLITE_ENABLE_FTS4_UNICODE61 */ - -/************** End of fts3_unicode.c ****************************************/ -/************** Begin file fts3_unicode2.c ***********************************/ -/* -** 2012 May 25 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -****************************************************************************** -*/ - -/* -** DO NOT EDIT THIS MACHINE GENERATED FILE. -*/ - -#if defined(SQLITE_ENABLE_FTS4_UNICODE61) -#if defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) - -/* #include */ - -/* -** Return true if the argument corresponds to a unicode codepoint -** classified as either a letter or a number. Otherwise false. -** -** The results are undefined if the value passed to this function -** is less than zero. -*/ -SQLITE_PRIVATE int sqlite3FtsUnicodeIsalnum(int c){ - /* Each unsigned integer in the following array corresponds to a contiguous - ** range of unicode codepoints that are not either letters or numbers (i.e. - ** codepoints for which this function should return 0). - ** - ** The most significant 22 bits in each 32-bit value contain the first - ** codepoint in the range. The least significant 10 bits are used to store - ** the size of the range (always at least 1). In other words, the value - ** ((C<<22) + N) represents a range of N codepoints starting with codepoint - ** C. It is not possible to represent a range larger than 1023 codepoints - ** using this format. - */ - const static unsigned int aEntry[] = { - 0x00000030, 0x0000E807, 0x00016C06, 0x0001EC2F, 0x0002AC07, - 0x0002D001, 0x0002D803, 0x0002EC01, 0x0002FC01, 0x00035C01, - 0x0003DC01, 0x000B0804, 0x000B480E, 0x000B9407, 0x000BB401, - 0x000BBC81, 0x000DD401, 0x000DF801, 0x000E1002, 0x000E1C01, - 0x000FD801, 0x00120808, 0x00156806, 0x00162402, 0x00163C01, - 0x00164437, 0x0017CC02, 0x00180005, 0x00181816, 0x00187802, - 0x00192C15, 0x0019A804, 0x0019C001, 0x001B5001, 0x001B580F, - 0x001B9C07, 0x001BF402, 0x001C000E, 0x001C3C01, 0x001C4401, - 0x001CC01B, 0x001E980B, 0x001FAC09, 0x001FD804, 0x00205804, - 0x00206C09, 0x00209403, 0x0020A405, 0x0020C00F, 0x00216403, - 0x00217801, 0x0023901B, 0x00240004, 0x0024E803, 0x0024F812, - 0x00254407, 0x00258804, 0x0025C001, 0x00260403, 0x0026F001, - 0x0026F807, 0x00271C02, 0x00272C03, 0x00275C01, 0x00278802, - 0x0027C802, 0x0027E802, 0x00280403, 0x0028F001, 0x0028F805, - 0x00291C02, 0x00292C03, 0x00294401, 0x0029C002, 0x0029D401, - 0x002A0403, 0x002AF001, 0x002AF808, 0x002B1C03, 0x002B2C03, - 0x002B8802, 0x002BC002, 0x002C0403, 0x002CF001, 0x002CF807, - 0x002D1C02, 0x002D2C03, 0x002D5802, 0x002D8802, 0x002DC001, - 0x002E0801, 0x002EF805, 0x002F1803, 0x002F2804, 0x002F5C01, - 0x002FCC08, 0x00300403, 0x0030F807, 0x00311803, 0x00312804, - 0x00315402, 0x00318802, 0x0031FC01, 0x00320802, 0x0032F001, - 0x0032F807, 0x00331803, 0x00332804, 0x00335402, 0x00338802, - 0x00340802, 0x0034F807, 0x00351803, 0x00352804, 0x00355C01, - 0x00358802, 0x0035E401, 0x00360802, 0x00372801, 0x00373C06, - 0x00375801, 0x00376008, 0x0037C803, 0x0038C401, 0x0038D007, - 0x0038FC01, 0x00391C09, 0x00396802, 0x003AC401, 0x003AD006, - 0x003AEC02, 0x003B2006, 0x003C041F, 0x003CD00C, 0x003DC417, - 0x003E340B, 0x003E6424, 0x003EF80F, 0x003F380D, 0x0040AC14, - 0x00412806, 0x00415804, 0x00417803, 0x00418803, 0x00419C07, - 0x0041C404, 0x0042080C, 0x00423C01, 0x00426806, 0x0043EC01, - 0x004D740C, 0x004E400A, 0x00500001, 0x0059B402, 0x005A0001, - 0x005A6C02, 0x005BAC03, 0x005C4803, 0x005CC805, 0x005D4802, - 0x005DC802, 0x005ED023, 0x005F6004, 0x005F7401, 0x0060000F, - 0x0062A401, 0x0064800C, 0x0064C00C, 0x00650001, 0x00651002, - 0x0066C011, 0x00672002, 0x00677822, 0x00685C05, 0x00687802, - 0x0069540A, 0x0069801D, 0x0069FC01, 0x006A8007, 0x006AA006, - 0x006C0005, 0x006CD011, 0x006D6823, 0x006E0003, 0x006E840D, - 0x006F980E, 0x006FF004, 0x00709014, 0x0070EC05, 0x0071F802, - 0x00730008, 0x00734019, 0x0073B401, 0x0073C803, 0x00770027, - 0x0077F004, 0x007EF401, 0x007EFC03, 0x007F3403, 0x007F7403, - 0x007FB403, 0x007FF402, 0x00800065, 0x0081A806, 0x0081E805, - 0x00822805, 0x0082801A, 0x00834021, 0x00840002, 0x00840C04, - 0x00842002, 0x00845001, 0x00845803, 0x00847806, 0x00849401, - 0x00849C01, 0x0084A401, 0x0084B801, 0x0084E802, 0x00850005, - 0x00852804, 0x00853C01, 0x00864264, 0x00900027, 0x0091000B, - 0x0092704E, 0x00940200, 0x009C0475, 0x009E53B9, 0x00AD400A, - 0x00B39406, 0x00B3BC03, 0x00B3E404, 0x00B3F802, 0x00B5C001, - 0x00B5FC01, 0x00B7804F, 0x00B8C00C, 0x00BA001A, 0x00BA6C59, - 0x00BC00D6, 0x00BFC00C, 0x00C00005, 0x00C02019, 0x00C0A807, - 0x00C0D802, 0x00C0F403, 0x00C26404, 0x00C28001, 0x00C3EC01, - 0x00C64002, 0x00C6580A, 0x00C70024, 0x00C8001F, 0x00C8A81E, - 0x00C94001, 0x00C98020, 0x00CA2827, 0x00CB003F, 0x00CC0100, - 0x01370040, 0x02924037, 0x0293F802, 0x02983403, 0x0299BC10, - 0x029A7C01, 0x029BC008, 0x029C0017, 0x029C8002, 0x029E2402, - 0x02A00801, 0x02A01801, 0x02A02C01, 0x02A08C09, 0x02A0D804, - 0x02A1D004, 0x02A20002, 0x02A2D011, 0x02A33802, 0x02A38012, - 0x02A3E003, 0x02A4980A, 0x02A51C0D, 0x02A57C01, 0x02A60004, - 0x02A6CC1B, 0x02A77802, 0x02A8A40E, 0x02A90C01, 0x02A93002, - 0x02A97004, 0x02A9DC03, 0x02A9EC01, 0x02AAC001, 0x02AAC803, - 0x02AADC02, 0x02AAF802, 0x02AB0401, 0x02AB7802, 0x02ABAC07, - 0x02ABD402, 0x02AF8C0B, 0x03600001, 0x036DFC02, 0x036FFC02, - 0x037FFC01, 0x03EC7801, 0x03ECA401, 0x03EEC810, 0x03F4F802, - 0x03F7F002, 0x03F8001A, 0x03F88007, 0x03F8C023, 0x03F95013, - 0x03F9A004, 0x03FBFC01, 0x03FC040F, 0x03FC6807, 0x03FCEC06, - 0x03FD6C0B, 0x03FF8007, 0x03FFA007, 0x03FFE405, 0x04040003, - 0x0404DC09, 0x0405E411, 0x0406400C, 0x0407402E, 0x040E7C01, - 0x040F4001, 0x04215C01, 0x04247C01, 0x0424FC01, 0x04280403, - 0x04281402, 0x04283004, 0x0428E003, 0x0428FC01, 0x04294009, - 0x0429FC01, 0x042CE407, 0x04400003, 0x0440E016, 0x04420003, - 0x0442C012, 0x04440003, 0x04449C0E, 0x04450004, 0x04460003, - 0x0446CC0E, 0x04471404, 0x045AAC0D, 0x0491C004, 0x05BD442E, - 0x05BE3C04, 0x074000F6, 0x07440027, 0x0744A4B5, 0x07480046, - 0x074C0057, 0x075B0401, 0x075B6C01, 0x075BEC01, 0x075C5401, - 0x075CD401, 0x075D3C01, 0x075DBC01, 0x075E2401, 0x075EA401, - 0x075F0C01, 0x07BBC002, 0x07C0002C, 0x07C0C064, 0x07C2800F, - 0x07C2C40E, 0x07C3040F, 0x07C3440F, 0x07C4401F, 0x07C4C03C, - 0x07C5C02B, 0x07C7981D, 0x07C8402B, 0x07C90009, 0x07C94002, - 0x07CC0021, 0x07CCC006, 0x07CCDC46, 0x07CE0014, 0x07CE8025, - 0x07CF1805, 0x07CF8011, 0x07D0003F, 0x07D10001, 0x07D108B6, - 0x07D3E404, 0x07D4003E, 0x07D50004, 0x07D54018, 0x07D7EC46, - 0x07D9140B, 0x07DA0046, 0x07DC0074, 0x38000401, 0x38008060, - 0x380400F0, - }; - static const unsigned int aAscii[4] = { - 0xFFFFFFFF, 0xFC00FFFF, 0xF8000001, 0xF8000001, - }; - - if( c<128 ){ - return ( (aAscii[c >> 5] & (1 << (c & 0x001F)))==0 ); - }else if( c<(1<<22) ){ - unsigned int key = (((unsigned int)c)<<10) | 0x000003FF; - int iRes; - int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1; - int iLo = 0; - while( iHi>=iLo ){ - int iTest = (iHi + iLo) / 2; - if( key >= aEntry[iTest] ){ - iRes = iTest; - iLo = iTest+1; - }else{ - iHi = iTest-1; - } - } - assert( aEntry[0]=aEntry[iRes] ); - return (((unsigned int)c) >= ((aEntry[iRes]>>10) + (aEntry[iRes]&0x3FF))); - } - return 1; -} - - -/* -** If the argument is a codepoint corresponding to a lowercase letter -** in the ASCII range with a diacritic added, return the codepoint -** of the ASCII letter only. For example, if passed 235 - "LATIN -** SMALL LETTER E WITH DIAERESIS" - return 65 ("LATIN SMALL LETTER -** E"). The resuls of passing a codepoint that corresponds to an -** uppercase letter are undefined. -*/ -static int remove_diacritic(int c){ - unsigned short aDia[] = { - 0, 1797, 1848, 1859, 1891, 1928, 1940, 1995, - 2024, 2040, 2060, 2110, 2168, 2206, 2264, 2286, - 2344, 2383, 2472, 2488, 2516, 2596, 2668, 2732, - 2782, 2842, 2894, 2954, 2984, 3000, 3028, 3336, - 3456, 3696, 3712, 3728, 3744, 3896, 3912, 3928, - 3968, 4008, 4040, 4106, 4138, 4170, 4202, 4234, - 4266, 4296, 4312, 4344, 4408, 4424, 4472, 4504, - 6148, 6198, 6264, 6280, 6360, 6429, 6505, 6529, - 61448, 61468, 61534, 61592, 61642, 61688, 61704, 61726, - 61784, 61800, 61836, 61880, 61914, 61948, 61998, 62122, - 62154, 62200, 62218, 62302, 62364, 62442, 62478, 62536, - 62554, 62584, 62604, 62640, 62648, 62656, 62664, 62730, - 62924, 63050, 63082, 63274, 63390, - }; - char aChar[] = { - '\0', 'a', 'c', 'e', 'i', 'n', 'o', 'u', 'y', 'y', 'a', 'c', - 'd', 'e', 'e', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'o', 'r', - 's', 't', 'u', 'u', 'w', 'y', 'z', 'o', 'u', 'a', 'i', 'o', - 'u', 'g', 'k', 'o', 'j', 'g', 'n', 'a', 'e', 'i', 'o', 'r', - 'u', 's', 't', 'h', 'a', 'e', 'o', 'y', '\0', '\0', '\0', '\0', - '\0', '\0', '\0', '\0', 'a', 'b', 'd', 'd', 'e', 'f', 'g', 'h', - 'h', 'i', 'k', 'l', 'l', 'm', 'n', 'p', 'r', 'r', 's', 't', - 'u', 'v', 'w', 'w', 'x', 'y', 'z', 'h', 't', 'w', 'y', 'a', - 'e', 'i', 'o', 'u', 'y', - }; - - unsigned int key = (((unsigned int)c)<<3) | 0x00000007; - int iRes = 0; - int iHi = sizeof(aDia)/sizeof(aDia[0]) - 1; - int iLo = 0; - while( iHi>=iLo ){ - int iTest = (iHi + iLo) / 2; - if( key >= aDia[iTest] ){ - iRes = iTest; - iLo = iTest+1; - }else{ - iHi = iTest-1; - } - } - assert( key>=aDia[iRes] ); - return ((c > (aDia[iRes]>>3) + (aDia[iRes]&0x07)) ? c : (int)aChar[iRes]); -}; - - -/* -** Return true if the argument interpreted as a unicode codepoint -** is a diacritical modifier character. -*/ -SQLITE_PRIVATE int sqlite3FtsUnicodeIsdiacritic(int c){ - unsigned int mask0 = 0x08029FDF; - unsigned int mask1 = 0x000361F8; - if( c<768 || c>817 ) return 0; - return (c < 768+32) ? - (mask0 & (1 << (c-768))) : - (mask1 & (1 << (c-768-32))); -} - - -/* -** Interpret the argument as a unicode codepoint. If the codepoint -** is an upper case character that has a lower case equivalent, -** return the codepoint corresponding to the lower case version. -** Otherwise, return a copy of the argument. -** -** The results are undefined if the value passed to this function -** is less than zero. -*/ -SQLITE_PRIVATE int sqlite3FtsUnicodeFold(int c, int bRemoveDiacritic){ - /* Each entry in the following array defines a rule for folding a range - ** of codepoints to lower case. The rule applies to a range of nRange - ** codepoints starting at codepoint iCode. - ** - ** If the least significant bit in flags is clear, then the rule applies - ** to all nRange codepoints (i.e. all nRange codepoints are upper case and - ** need to be folded). Or, if it is set, then the rule only applies to - ** every second codepoint in the range, starting with codepoint C. - ** - ** The 7 most significant bits in flags are an index into the aiOff[] - ** array. If a specific codepoint C does require folding, then its lower - ** case equivalent is ((C + aiOff[flags>>1]) & 0xFFFF). - ** - ** The contents of this array are generated by parsing the CaseFolding.txt - ** file distributed as part of the "Unicode Character Database". See - ** http://www.unicode.org for details. - */ - static const struct TableEntry { - unsigned short iCode; - unsigned char flags; - unsigned char nRange; - } aEntry[] = { - {65, 14, 26}, {181, 64, 1}, {192, 14, 23}, - {216, 14, 7}, {256, 1, 48}, {306, 1, 6}, - {313, 1, 16}, {330, 1, 46}, {376, 116, 1}, - {377, 1, 6}, {383, 104, 1}, {385, 50, 1}, - {386, 1, 4}, {390, 44, 1}, {391, 0, 1}, - {393, 42, 2}, {395, 0, 1}, {398, 32, 1}, - {399, 38, 1}, {400, 40, 1}, {401, 0, 1}, - {403, 42, 1}, {404, 46, 1}, {406, 52, 1}, - {407, 48, 1}, {408, 0, 1}, {412, 52, 1}, - {413, 54, 1}, {415, 56, 1}, {416, 1, 6}, - {422, 60, 1}, {423, 0, 1}, {425, 60, 1}, - {428, 0, 1}, {430, 60, 1}, {431, 0, 1}, - {433, 58, 2}, {435, 1, 4}, {439, 62, 1}, - {440, 0, 1}, {444, 0, 1}, {452, 2, 1}, - {453, 0, 1}, {455, 2, 1}, {456, 0, 1}, - {458, 2, 1}, {459, 1, 18}, {478, 1, 18}, - {497, 2, 1}, {498, 1, 4}, {502, 122, 1}, - {503, 134, 1}, {504, 1, 40}, {544, 110, 1}, - {546, 1, 18}, {570, 70, 1}, {571, 0, 1}, - {573, 108, 1}, {574, 68, 1}, {577, 0, 1}, - {579, 106, 1}, {580, 28, 1}, {581, 30, 1}, - {582, 1, 10}, {837, 36, 1}, {880, 1, 4}, - {886, 0, 1}, {902, 18, 1}, {904, 16, 3}, - {908, 26, 1}, {910, 24, 2}, {913, 14, 17}, - {931, 14, 9}, {962, 0, 1}, {975, 4, 1}, - {976, 140, 1}, {977, 142, 1}, {981, 146, 1}, - {982, 144, 1}, {984, 1, 24}, {1008, 136, 1}, - {1009, 138, 1}, {1012, 130, 1}, {1013, 128, 1}, - {1015, 0, 1}, {1017, 152, 1}, {1018, 0, 1}, - {1021, 110, 3}, {1024, 34, 16}, {1040, 14, 32}, - {1120, 1, 34}, {1162, 1, 54}, {1216, 6, 1}, - {1217, 1, 14}, {1232, 1, 88}, {1329, 22, 38}, - {4256, 66, 38}, {4295, 66, 1}, {4301, 66, 1}, - {7680, 1, 150}, {7835, 132, 1}, {7838, 96, 1}, - {7840, 1, 96}, {7944, 150, 8}, {7960, 150, 6}, - {7976, 150, 8}, {7992, 150, 8}, {8008, 150, 6}, - {8025, 151, 8}, {8040, 150, 8}, {8072, 150, 8}, - {8088, 150, 8}, {8104, 150, 8}, {8120, 150, 2}, - {8122, 126, 2}, {8124, 148, 1}, {8126, 100, 1}, - {8136, 124, 4}, {8140, 148, 1}, {8152, 150, 2}, - {8154, 120, 2}, {8168, 150, 2}, {8170, 118, 2}, - {8172, 152, 1}, {8184, 112, 2}, {8186, 114, 2}, - {8188, 148, 1}, {8486, 98, 1}, {8490, 92, 1}, - {8491, 94, 1}, {8498, 12, 1}, {8544, 8, 16}, - {8579, 0, 1}, {9398, 10, 26}, {11264, 22, 47}, - {11360, 0, 1}, {11362, 88, 1}, {11363, 102, 1}, - {11364, 90, 1}, {11367, 1, 6}, {11373, 84, 1}, - {11374, 86, 1}, {11375, 80, 1}, {11376, 82, 1}, - {11378, 0, 1}, {11381, 0, 1}, {11390, 78, 2}, - {11392, 1, 100}, {11499, 1, 4}, {11506, 0, 1}, - {42560, 1, 46}, {42624, 1, 24}, {42786, 1, 14}, - {42802, 1, 62}, {42873, 1, 4}, {42877, 76, 1}, - {42878, 1, 10}, {42891, 0, 1}, {42893, 74, 1}, - {42896, 1, 4}, {42912, 1, 10}, {42922, 72, 1}, - {65313, 14, 26}, - }; - static const unsigned short aiOff[] = { - 1, 2, 8, 15, 16, 26, 28, 32, - 37, 38, 40, 48, 63, 64, 69, 71, - 79, 80, 116, 202, 203, 205, 206, 207, - 209, 210, 211, 213, 214, 217, 218, 219, - 775, 7264, 10792, 10795, 23228, 23256, 30204, 54721, - 54753, 54754, 54756, 54787, 54793, 54809, 57153, 57274, - 57921, 58019, 58363, 61722, 65268, 65341, 65373, 65406, - 65408, 65410, 65415, 65424, 65436, 65439, 65450, 65462, - 65472, 65476, 65478, 65480, 65482, 65488, 65506, 65511, - 65514, 65521, 65527, 65528, 65529, - }; - - int ret = c; - - assert( c>=0 ); - assert( sizeof(unsigned short)==2 && sizeof(unsigned char)==1 ); - - if( c<128 ){ - if( c>='A' && c<='Z' ) ret = c + ('a' - 'A'); - }else if( c<65536 ){ - int iHi = sizeof(aEntry)/sizeof(aEntry[0]) - 1; - int iLo = 0; - int iRes = -1; - - while( iHi>=iLo ){ - int iTest = (iHi + iLo) / 2; - int cmp = (c - aEntry[iTest].iCode); - if( cmp>=0 ){ - iRes = iTest; - iLo = iTest+1; - }else{ - iHi = iTest-1; - } - } - assert( iRes<0 || c>=aEntry[iRes].iCode ); - - if( iRes>=0 ){ - const struct TableEntry *p = &aEntry[iRes]; - if( c<(p->iCode + p->nRange) && 0==(0x01 & p->flags & (p->iCode ^ c)) ){ - ret = (c + (aiOff[p->flags>>1])) & 0x0000FFFF; - assert( ret>0 ); - } - } - - if( bRemoveDiacritic ) ret = remove_diacritic(ret); - } - - else if( c>=66560 && c<66600 ){ - ret = c + 40; - } - - return ret; -} -#endif /* defined(SQLITE_ENABLE_FTS3) || defined(SQLITE_ENABLE_FTS4) */ -#endif /* !defined(SQLITE_ENABLE_FTS4_UNICODE61) */ - -/************** End of fts3_unicode2.c ***************************************/ -/************** Begin file rtree.c *******************************************/ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file contains code for implementations of the r-tree and r*-tree -** algorithms packaged as an SQLite virtual table module. -*/ - -/* -** Database Format of R-Tree Tables -** -------------------------------- -** -** The data structure for a single virtual r-tree table is stored in three -** native SQLite tables declared as follows. In each case, the '%' character -** in the table name is replaced with the user-supplied name of the r-tree -** table. -** -** CREATE TABLE %_node(nodeno INTEGER PRIMARY KEY, data BLOB) -** CREATE TABLE %_parent(nodeno INTEGER PRIMARY KEY, parentnode INTEGER) -** CREATE TABLE %_rowid(rowid INTEGER PRIMARY KEY, nodeno INTEGER) -** -** The data for each node of the r-tree structure is stored in the %_node -** table. For each node that is not the root node of the r-tree, there is -** an entry in the %_parent table associating the node with its parent. -** And for each row of data in the table, there is an entry in the %_rowid -** table that maps from the entries rowid to the id of the node that it -** is stored on. -** -** The root node of an r-tree always exists, even if the r-tree table is -** empty. The nodeno of the root node is always 1. All other nodes in the -** table must be the same size as the root node. The content of each node -** is formatted as follows: -** -** 1. If the node is the root node (node 1), then the first 2 bytes -** of the node contain the tree depth as a big-endian integer. -** For non-root nodes, the first 2 bytes are left unused. -** -** 2. The next 2 bytes contain the number of entries currently -** stored in the node. -** -** 3. The remainder of the node contains the node entries. Each entry -** consists of a single 8-byte integer followed by an even number -** of 4-byte coordinates. For leaf nodes the integer is the rowid -** of a record. For internal nodes it is the node number of a -** child page. -*/ - -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_RTREE) - -/* -** This file contains an implementation of a couple of different variants -** of the r-tree algorithm. See the README file for further details. The -** same data-structure is used for all, but the algorithms for insert and -** delete operations vary. The variants used are selected at compile time -** by defining the following symbols: -*/ - -/* Either, both or none of the following may be set to activate -** r*tree variant algorithms. -*/ -#define VARIANT_RSTARTREE_CHOOSESUBTREE 0 -#define VARIANT_RSTARTREE_REINSERT 1 - -/* -** Exactly one of the following must be set to 1. -*/ -#define VARIANT_GUTTMAN_QUADRATIC_SPLIT 0 -#define VARIANT_GUTTMAN_LINEAR_SPLIT 0 -#define VARIANT_RSTARTREE_SPLIT 1 - -#define VARIANT_GUTTMAN_SPLIT \ - (VARIANT_GUTTMAN_LINEAR_SPLIT||VARIANT_GUTTMAN_QUADRATIC_SPLIT) - -#if VARIANT_GUTTMAN_QUADRATIC_SPLIT - #define PickNext QuadraticPickNext - #define PickSeeds QuadraticPickSeeds - #define AssignCells splitNodeGuttman -#endif -#if VARIANT_GUTTMAN_LINEAR_SPLIT - #define PickNext LinearPickNext - #define PickSeeds LinearPickSeeds - #define AssignCells splitNodeGuttman -#endif -#if VARIANT_RSTARTREE_SPLIT - #define AssignCells splitNodeStartree -#endif - -#if !defined(NDEBUG) && !defined(SQLITE_DEBUG) -# define NDEBUG 1 -#endif - -#ifndef SQLITE_CORE - SQLITE_EXTENSION_INIT1 -#else -#endif - -/* #include */ -/* #include */ - -#ifndef SQLITE_AMALGAMATION -#include "sqlite3rtree.h" -typedef sqlite3_int64 i64; -typedef unsigned char u8; -typedef unsigned int u32; -#endif - -/* The following macro is used to suppress compiler warnings. -*/ -#ifndef UNUSED_PARAMETER -# define UNUSED_PARAMETER(x) (void)(x) -#endif - -typedef struct Rtree Rtree; -typedef struct RtreeCursor RtreeCursor; -typedef struct RtreeNode RtreeNode; -typedef struct RtreeCell RtreeCell; -typedef struct RtreeConstraint RtreeConstraint; -typedef struct RtreeMatchArg RtreeMatchArg; -typedef struct RtreeGeomCallback RtreeGeomCallback; -typedef union RtreeCoord RtreeCoord; - -/* The rtree may have between 1 and RTREE_MAX_DIMENSIONS dimensions. */ -#define RTREE_MAX_DIMENSIONS 5 - -/* Size of hash table Rtree.aHash. This hash table is not expected to -** ever contain very many entries, so a fixed number of buckets is -** used. -*/ -#define HASHSIZE 128 - -/* The xBestIndex method of this virtual table requires an estimate of -** the number of rows in the virtual table to calculate the costs of -** various strategies. If possible, this estimate is loaded from the -** sqlite_stat1 table (with RTREE_MIN_ROWEST as a hard-coded minimum). -** Otherwise, if no sqlite_stat1 entry is available, use -** RTREE_DEFAULT_ROWEST. -*/ -#define RTREE_DEFAULT_ROWEST 1048576 -#define RTREE_MIN_ROWEST 100 - -/* -** An rtree virtual-table object. -*/ -struct Rtree { - sqlite3_vtab base; - sqlite3 *db; /* Host database connection */ - int iNodeSize; /* Size in bytes of each node in the node table */ - int nDim; /* Number of dimensions */ - int nBytesPerCell; /* Bytes consumed per cell */ - int iDepth; /* Current depth of the r-tree structure */ - char *zDb; /* Name of database containing r-tree table */ - char *zName; /* Name of r-tree table */ - RtreeNode *aHash[HASHSIZE]; /* Hash table of in-memory nodes. */ - int nBusy; /* Current number of users of this structure */ - i64 nRowEst; /* Estimated number of rows in this table */ - - /* List of nodes removed during a CondenseTree operation. List is - ** linked together via the pointer normally used for hash chains - - ** RtreeNode.pNext. RtreeNode.iNode stores the depth of the sub-tree - ** headed by the node (leaf nodes have RtreeNode.iNode==0). - */ - RtreeNode *pDeleted; - int iReinsertHeight; /* Height of sub-trees Reinsert() has run on */ - - /* Statements to read/write/delete a record from xxx_node */ - sqlite3_stmt *pReadNode; - sqlite3_stmt *pWriteNode; - sqlite3_stmt *pDeleteNode; - - /* Statements to read/write/delete a record from xxx_rowid */ - sqlite3_stmt *pReadRowid; - sqlite3_stmt *pWriteRowid; - sqlite3_stmt *pDeleteRowid; - - /* Statements to read/write/delete a record from xxx_parent */ - sqlite3_stmt *pReadParent; - sqlite3_stmt *pWriteParent; - sqlite3_stmt *pDeleteParent; - - int eCoordType; -}; - -/* Possible values for eCoordType: */ -#define RTREE_COORD_REAL32 0 -#define RTREE_COORD_INT32 1 - -/* -** If SQLITE_RTREE_INT_ONLY is defined, then this virtual table will -** only deal with integer coordinates. No floating point operations -** will be done. -*/ -#ifdef SQLITE_RTREE_INT_ONLY - typedef sqlite3_int64 RtreeDValue; /* High accuracy coordinate */ - typedef int RtreeValue; /* Low accuracy coordinate */ -#else - typedef double RtreeDValue; /* High accuracy coordinate */ - typedef float RtreeValue; /* Low accuracy coordinate */ -#endif - -/* -** The minimum number of cells allowed for a node is a third of the -** maximum. In Gutman's notation: -** -** m = M/3 -** -** If an R*-tree "Reinsert" operation is required, the same number of -** cells are removed from the overfull node and reinserted into the tree. -*/ -#define RTREE_MINCELLS(p) ((((p)->iNodeSize-4)/(p)->nBytesPerCell)/3) -#define RTREE_REINSERT(p) RTREE_MINCELLS(p) -#define RTREE_MAXCELLS 51 - -/* -** The smallest possible node-size is (512-64)==448 bytes. And the largest -** supported cell size is 48 bytes (8 byte rowid + ten 4 byte coordinates). -** Therefore all non-root nodes must contain at least 3 entries. Since -** 2^40 is greater than 2^64, an r-tree structure always has a depth of -** 40 or less. -*/ -#define RTREE_MAX_DEPTH 40 - -/* -** An rtree cursor object. -*/ -struct RtreeCursor { - sqlite3_vtab_cursor base; - RtreeNode *pNode; /* Node cursor is currently pointing at */ - int iCell; /* Index of current cell in pNode */ - int iStrategy; /* Copy of idxNum search parameter */ - int nConstraint; /* Number of entries in aConstraint */ - RtreeConstraint *aConstraint; /* Search constraints. */ -}; - -union RtreeCoord { - RtreeValue f; - int i; -}; - -/* -** The argument is an RtreeCoord. Return the value stored within the RtreeCoord -** formatted as a RtreeDValue (double or int64). This macro assumes that local -** variable pRtree points to the Rtree structure associated with the -** RtreeCoord. -*/ -#ifdef SQLITE_RTREE_INT_ONLY -# define DCOORD(coord) ((RtreeDValue)coord.i) -#else -# define DCOORD(coord) ( \ - (pRtree->eCoordType==RTREE_COORD_REAL32) ? \ - ((double)coord.f) : \ - ((double)coord.i) \ - ) -#endif - -/* -** A search constraint. -*/ -struct RtreeConstraint { - int iCoord; /* Index of constrained coordinate */ - int op; /* Constraining operation */ - RtreeDValue rValue; /* Constraint value. */ - int (*xGeom)(sqlite3_rtree_geometry*, int, RtreeDValue*, int*); - sqlite3_rtree_geometry *pGeom; /* Constraint callback argument for a MATCH */ -}; - -/* Possible values for RtreeConstraint.op */ -#define RTREE_EQ 0x41 -#define RTREE_LE 0x42 -#define RTREE_LT 0x43 -#define RTREE_GE 0x44 -#define RTREE_GT 0x45 -#define RTREE_MATCH 0x46 - -/* -** An rtree structure node. -*/ -struct RtreeNode { - RtreeNode *pParent; /* Parent node */ - i64 iNode; - int nRef; - int isDirty; - u8 *zData; - RtreeNode *pNext; /* Next node in this hash chain */ -}; -#define NCELL(pNode) readInt16(&(pNode)->zData[2]) - -/* -** Structure to store a deserialized rtree record. -*/ -struct RtreeCell { - i64 iRowid; - RtreeCoord aCoord[RTREE_MAX_DIMENSIONS*2]; -}; - - -/* -** Value for the first field of every RtreeMatchArg object. The MATCH -** operator tests that the first field of a blob operand matches this -** value to avoid operating on invalid blobs (which could cause a segfault). -*/ -#define RTREE_GEOMETRY_MAGIC 0x891245AB - -/* -** An instance of this structure must be supplied as a blob argument to -** the right-hand-side of an SQL MATCH operator used to constrain an -** r-tree query. -*/ -struct RtreeMatchArg { - u32 magic; /* Always RTREE_GEOMETRY_MAGIC */ - int (*xGeom)(sqlite3_rtree_geometry *, int, RtreeDValue*, int *); - void *pContext; - int nParam; - RtreeDValue aParam[1]; -}; - -/* -** When a geometry callback is created (see sqlite3_rtree_geometry_callback), -** a single instance of the following structure is allocated. It is used -** as the context for the user-function created by by s_r_g_c(). The object -** is eventually deleted by the destructor mechanism provided by -** sqlite3_create_function_v2() (which is called by s_r_g_c() to create -** the geometry callback function). -*/ -struct RtreeGeomCallback { - int (*xGeom)(sqlite3_rtree_geometry*, int, RtreeDValue*, int*); - void *pContext; -}; - -#ifndef MAX -# define MAX(x,y) ((x) < (y) ? (y) : (x)) -#endif -#ifndef MIN -# define MIN(x,y) ((x) > (y) ? (y) : (x)) -#endif - -/* -** Functions to deserialize a 16 bit integer, 32 bit real number and -** 64 bit integer. The deserialized value is returned. -*/ -static int readInt16(u8 *p){ - return (p[0]<<8) + p[1]; -} -static void readCoord(u8 *p, RtreeCoord *pCoord){ - u32 i = ( - (((u32)p[0]) << 24) + - (((u32)p[1]) << 16) + - (((u32)p[2]) << 8) + - (((u32)p[3]) << 0) - ); - *(u32 *)pCoord = i; -} -static i64 readInt64(u8 *p){ - return ( - (((i64)p[0]) << 56) + - (((i64)p[1]) << 48) + - (((i64)p[2]) << 40) + - (((i64)p[3]) << 32) + - (((i64)p[4]) << 24) + - (((i64)p[5]) << 16) + - (((i64)p[6]) << 8) + - (((i64)p[7]) << 0) - ); -} - -/* -** Functions to serialize a 16 bit integer, 32 bit real number and -** 64 bit integer. The value returned is the number of bytes written -** to the argument buffer (always 2, 4 and 8 respectively). -*/ -static int writeInt16(u8 *p, int i){ - p[0] = (i>> 8)&0xFF; - p[1] = (i>> 0)&0xFF; - return 2; -} -static int writeCoord(u8 *p, RtreeCoord *pCoord){ - u32 i; - assert( sizeof(RtreeCoord)==4 ); - assert( sizeof(u32)==4 ); - i = *(u32 *)pCoord; - p[0] = (i>>24)&0xFF; - p[1] = (i>>16)&0xFF; - p[2] = (i>> 8)&0xFF; - p[3] = (i>> 0)&0xFF; - return 4; -} -static int writeInt64(u8 *p, i64 i){ - p[0] = (i>>56)&0xFF; - p[1] = (i>>48)&0xFF; - p[2] = (i>>40)&0xFF; - p[3] = (i>>32)&0xFF; - p[4] = (i>>24)&0xFF; - p[5] = (i>>16)&0xFF; - p[6] = (i>> 8)&0xFF; - p[7] = (i>> 0)&0xFF; - return 8; -} - -/* -** Increment the reference count of node p. -*/ -static void nodeReference(RtreeNode *p){ - if( p ){ - p->nRef++; - } -} - -/* -** Clear the content of node p (set all bytes to 0x00). -*/ -static void nodeZero(Rtree *pRtree, RtreeNode *p){ - memset(&p->zData[2], 0, pRtree->iNodeSize-2); - p->isDirty = 1; -} - -/* -** Given a node number iNode, return the corresponding key to use -** in the Rtree.aHash table. -*/ -static int nodeHash(i64 iNode){ - return ( - (iNode>>56) ^ (iNode>>48) ^ (iNode>>40) ^ (iNode>>32) ^ - (iNode>>24) ^ (iNode>>16) ^ (iNode>> 8) ^ (iNode>> 0) - ) % HASHSIZE; -} - -/* -** Search the node hash table for node iNode. If found, return a pointer -** to it. Otherwise, return 0. -*/ -static RtreeNode *nodeHashLookup(Rtree *pRtree, i64 iNode){ - RtreeNode *p; - for(p=pRtree->aHash[nodeHash(iNode)]; p && p->iNode!=iNode; p=p->pNext); - return p; -} - -/* -** Add node pNode to the node hash table. -*/ -static void nodeHashInsert(Rtree *pRtree, RtreeNode *pNode){ - int iHash; - assert( pNode->pNext==0 ); - iHash = nodeHash(pNode->iNode); - pNode->pNext = pRtree->aHash[iHash]; - pRtree->aHash[iHash] = pNode; -} - -/* -** Remove node pNode from the node hash table. -*/ -static void nodeHashDelete(Rtree *pRtree, RtreeNode *pNode){ - RtreeNode **pp; - if( pNode->iNode!=0 ){ - pp = &pRtree->aHash[nodeHash(pNode->iNode)]; - for( ; (*pp)!=pNode; pp = &(*pp)->pNext){ assert(*pp); } - *pp = pNode->pNext; - pNode->pNext = 0; - } -} - -/* -** Allocate and return new r-tree node. Initially, (RtreeNode.iNode==0), -** indicating that node has not yet been assigned a node number. It is -** assigned a node number when nodeWrite() is called to write the -** node contents out to the database. -*/ -static RtreeNode *nodeNew(Rtree *pRtree, RtreeNode *pParent){ - RtreeNode *pNode; - pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode) + pRtree->iNodeSize); - if( pNode ){ - memset(pNode, 0, sizeof(RtreeNode) + pRtree->iNodeSize); - pNode->zData = (u8 *)&pNode[1]; - pNode->nRef = 1; - pNode->pParent = pParent; - pNode->isDirty = 1; - nodeReference(pParent); - } - return pNode; -} - -/* -** Obtain a reference to an r-tree node. -*/ -static int -nodeAcquire( - Rtree *pRtree, /* R-tree structure */ - i64 iNode, /* Node number to load */ - RtreeNode *pParent, /* Either the parent node or NULL */ - RtreeNode **ppNode /* OUT: Acquired node */ -){ - int rc; - int rc2 = SQLITE_OK; - RtreeNode *pNode; - - /* Check if the requested node is already in the hash table. If so, - ** increase its reference count and return it. - */ - if( (pNode = nodeHashLookup(pRtree, iNode)) ){ - assert( !pParent || !pNode->pParent || pNode->pParent==pParent ); - if( pParent && !pNode->pParent ){ - nodeReference(pParent); - pNode->pParent = pParent; - } - pNode->nRef++; - *ppNode = pNode; - return SQLITE_OK; - } - - sqlite3_bind_int64(pRtree->pReadNode, 1, iNode); - rc = sqlite3_step(pRtree->pReadNode); - if( rc==SQLITE_ROW ){ - const u8 *zBlob = sqlite3_column_blob(pRtree->pReadNode, 0); - if( pRtree->iNodeSize==sqlite3_column_bytes(pRtree->pReadNode, 0) ){ - pNode = (RtreeNode *)sqlite3_malloc(sizeof(RtreeNode)+pRtree->iNodeSize); - if( !pNode ){ - rc2 = SQLITE_NOMEM; - }else{ - pNode->pParent = pParent; - pNode->zData = (u8 *)&pNode[1]; - pNode->nRef = 1; - pNode->iNode = iNode; - pNode->isDirty = 0; - pNode->pNext = 0; - memcpy(pNode->zData, zBlob, pRtree->iNodeSize); - nodeReference(pParent); - } - } - } - rc = sqlite3_reset(pRtree->pReadNode); - if( rc==SQLITE_OK ) rc = rc2; - - /* If the root node was just loaded, set pRtree->iDepth to the height - ** of the r-tree structure. A height of zero means all data is stored on - ** the root node. A height of one means the children of the root node - ** are the leaves, and so on. If the depth as specified on the root node - ** is greater than RTREE_MAX_DEPTH, the r-tree structure must be corrupt. - */ - if( pNode && iNode==1 ){ - pRtree->iDepth = readInt16(pNode->zData); - if( pRtree->iDepth>RTREE_MAX_DEPTH ){ - rc = SQLITE_CORRUPT_VTAB; - } - } - - /* If no error has occurred so far, check if the "number of entries" - ** field on the node is too large. If so, set the return code to - ** SQLITE_CORRUPT_VTAB. - */ - if( pNode && rc==SQLITE_OK ){ - if( NCELL(pNode)>((pRtree->iNodeSize-4)/pRtree->nBytesPerCell) ){ - rc = SQLITE_CORRUPT_VTAB; - } - } - - if( rc==SQLITE_OK ){ - if( pNode!=0 ){ - nodeHashInsert(pRtree, pNode); - }else{ - rc = SQLITE_CORRUPT_VTAB; - } - *ppNode = pNode; - }else{ - sqlite3_free(pNode); - *ppNode = 0; - } - - return rc; -} - -/* -** Overwrite cell iCell of node pNode with the contents of pCell. -*/ -static void nodeOverwriteCell( - Rtree *pRtree, - RtreeNode *pNode, - RtreeCell *pCell, - int iCell -){ - int ii; - u8 *p = &pNode->zData[4 + pRtree->nBytesPerCell*iCell]; - p += writeInt64(p, pCell->iRowid); - for(ii=0; ii<(pRtree->nDim*2); ii++){ - p += writeCoord(p, &pCell->aCoord[ii]); - } - pNode->isDirty = 1; -} - -/* -** Remove cell the cell with index iCell from node pNode. -*/ -static void nodeDeleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell){ - u8 *pDst = &pNode->zData[4 + pRtree->nBytesPerCell*iCell]; - u8 *pSrc = &pDst[pRtree->nBytesPerCell]; - int nByte = (NCELL(pNode) - iCell - 1) * pRtree->nBytesPerCell; - memmove(pDst, pSrc, nByte); - writeInt16(&pNode->zData[2], NCELL(pNode)-1); - pNode->isDirty = 1; -} - -/* -** Insert the contents of cell pCell into node pNode. If the insert -** is successful, return SQLITE_OK. -** -** If there is not enough free space in pNode, return SQLITE_FULL. -*/ -static int -nodeInsertCell( - Rtree *pRtree, - RtreeNode *pNode, - RtreeCell *pCell -){ - int nCell; /* Current number of cells in pNode */ - int nMaxCell; /* Maximum number of cells for pNode */ - - nMaxCell = (pRtree->iNodeSize-4)/pRtree->nBytesPerCell; - nCell = NCELL(pNode); - - assert( nCell<=nMaxCell ); - if( nCellzData[2], nCell+1); - pNode->isDirty = 1; - } - - return (nCell==nMaxCell); -} - -/* -** If the node is dirty, write it out to the database. -*/ -static int -nodeWrite(Rtree *pRtree, RtreeNode *pNode){ - int rc = SQLITE_OK; - if( pNode->isDirty ){ - sqlite3_stmt *p = pRtree->pWriteNode; - if( pNode->iNode ){ - sqlite3_bind_int64(p, 1, pNode->iNode); - }else{ - sqlite3_bind_null(p, 1); - } - sqlite3_bind_blob(p, 2, pNode->zData, pRtree->iNodeSize, SQLITE_STATIC); - sqlite3_step(p); - pNode->isDirty = 0; - rc = sqlite3_reset(p); - if( pNode->iNode==0 && rc==SQLITE_OK ){ - pNode->iNode = sqlite3_last_insert_rowid(pRtree->db); - nodeHashInsert(pRtree, pNode); - } - } - return rc; -} - -/* -** Release a reference to a node. If the node is dirty and the reference -** count drops to zero, the node data is written to the database. -*/ -static int -nodeRelease(Rtree *pRtree, RtreeNode *pNode){ - int rc = SQLITE_OK; - if( pNode ){ - assert( pNode->nRef>0 ); - pNode->nRef--; - if( pNode->nRef==0 ){ - if( pNode->iNode==1 ){ - pRtree->iDepth = -1; - } - if( pNode->pParent ){ - rc = nodeRelease(pRtree, pNode->pParent); - } - if( rc==SQLITE_OK ){ - rc = nodeWrite(pRtree, pNode); - } - nodeHashDelete(pRtree, pNode); - sqlite3_free(pNode); - } - } - return rc; -} - -/* -** Return the 64-bit integer value associated with cell iCell of -** node pNode. If pNode is a leaf node, this is a rowid. If it is -** an internal node, then the 64-bit integer is a child page number. -*/ -static i64 nodeGetRowid( - Rtree *pRtree, - RtreeNode *pNode, - int iCell -){ - assert( iCellzData[4 + pRtree->nBytesPerCell*iCell]); -} - -/* -** Return coordinate iCoord from cell iCell in node pNode. -*/ -static void nodeGetCoord( - Rtree *pRtree, - RtreeNode *pNode, - int iCell, - int iCoord, - RtreeCoord *pCoord /* Space to write result to */ -){ - readCoord(&pNode->zData[12 + pRtree->nBytesPerCell*iCell + 4*iCoord], pCoord); -} - -/* -** Deserialize cell iCell of node pNode. Populate the structure pointed -** to by pCell with the results. -*/ -static void nodeGetCell( - Rtree *pRtree, - RtreeNode *pNode, - int iCell, - RtreeCell *pCell -){ - int ii; - pCell->iRowid = nodeGetRowid(pRtree, pNode, iCell); - for(ii=0; iinDim*2; ii++){ - nodeGetCoord(pRtree, pNode, iCell, ii, &pCell->aCoord[ii]); - } -} - - -/* Forward declaration for the function that does the work of -** the virtual table module xCreate() and xConnect() methods. -*/ -static int rtreeInit( - sqlite3 *, void *, int, const char *const*, sqlite3_vtab **, char **, int -); - -/* -** Rtree virtual table module xCreate method. -*/ -static int rtreeCreate( - sqlite3 *db, - void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVtab, - char **pzErr -){ - return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 1); -} - -/* -** Rtree virtual table module xConnect method. -*/ -static int rtreeConnect( - sqlite3 *db, - void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVtab, - char **pzErr -){ - return rtreeInit(db, pAux, argc, argv, ppVtab, pzErr, 0); -} - -/* -** Increment the r-tree reference count. -*/ -static void rtreeReference(Rtree *pRtree){ - pRtree->nBusy++; -} - -/* -** Decrement the r-tree reference count. When the reference count reaches -** zero the structure is deleted. -*/ -static void rtreeRelease(Rtree *pRtree){ - pRtree->nBusy--; - if( pRtree->nBusy==0 ){ - sqlite3_finalize(pRtree->pReadNode); - sqlite3_finalize(pRtree->pWriteNode); - sqlite3_finalize(pRtree->pDeleteNode); - sqlite3_finalize(pRtree->pReadRowid); - sqlite3_finalize(pRtree->pWriteRowid); - sqlite3_finalize(pRtree->pDeleteRowid); - sqlite3_finalize(pRtree->pReadParent); - sqlite3_finalize(pRtree->pWriteParent); - sqlite3_finalize(pRtree->pDeleteParent); - sqlite3_free(pRtree); - } -} - -/* -** Rtree virtual table module xDisconnect method. -*/ -static int rtreeDisconnect(sqlite3_vtab *pVtab){ - rtreeRelease((Rtree *)pVtab); - return SQLITE_OK; -} - -/* -** Rtree virtual table module xDestroy method. -*/ -static int rtreeDestroy(sqlite3_vtab *pVtab){ - Rtree *pRtree = (Rtree *)pVtab; - int rc; - char *zCreate = sqlite3_mprintf( - "DROP TABLE '%q'.'%q_node';" - "DROP TABLE '%q'.'%q_rowid';" - "DROP TABLE '%q'.'%q_parent';", - pRtree->zDb, pRtree->zName, - pRtree->zDb, pRtree->zName, - pRtree->zDb, pRtree->zName - ); - if( !zCreate ){ - rc = SQLITE_NOMEM; - }else{ - rc = sqlite3_exec(pRtree->db, zCreate, 0, 0, 0); - sqlite3_free(zCreate); - } - if( rc==SQLITE_OK ){ - rtreeRelease(pRtree); - } - - return rc; -} - -/* -** Rtree virtual table module xOpen method. -*/ -static int rtreeOpen(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor){ - int rc = SQLITE_NOMEM; - RtreeCursor *pCsr; - - pCsr = (RtreeCursor *)sqlite3_malloc(sizeof(RtreeCursor)); - if( pCsr ){ - memset(pCsr, 0, sizeof(RtreeCursor)); - pCsr->base.pVtab = pVTab; - rc = SQLITE_OK; - } - *ppCursor = (sqlite3_vtab_cursor *)pCsr; - - return rc; -} - - -/* -** Free the RtreeCursor.aConstraint[] array and its contents. -*/ -static void freeCursorConstraints(RtreeCursor *pCsr){ - if( pCsr->aConstraint ){ - int i; /* Used to iterate through constraint array */ - for(i=0; inConstraint; i++){ - sqlite3_rtree_geometry *pGeom = pCsr->aConstraint[i].pGeom; - if( pGeom ){ - if( pGeom->xDelUser ) pGeom->xDelUser(pGeom->pUser); - sqlite3_free(pGeom); - } - } - sqlite3_free(pCsr->aConstraint); - pCsr->aConstraint = 0; - } -} - -/* -** Rtree virtual table module xClose method. -*/ -static int rtreeClose(sqlite3_vtab_cursor *cur){ - Rtree *pRtree = (Rtree *)(cur->pVtab); - int rc; - RtreeCursor *pCsr = (RtreeCursor *)cur; - freeCursorConstraints(pCsr); - rc = nodeRelease(pRtree, pCsr->pNode); - sqlite3_free(pCsr); - return rc; -} - -/* -** Rtree virtual table module xEof method. -** -** Return non-zero if the cursor does not currently point to a valid -** record (i.e if the scan has finished), or zero otherwise. -*/ -static int rtreeEof(sqlite3_vtab_cursor *cur){ - RtreeCursor *pCsr = (RtreeCursor *)cur; - return (pCsr->pNode==0); -} - -/* -** The r-tree constraint passed as the second argument to this function is -** guaranteed to be a MATCH constraint. -*/ -static int testRtreeGeom( - Rtree *pRtree, /* R-Tree object */ - RtreeConstraint *pConstraint, /* MATCH constraint to test */ - RtreeCell *pCell, /* Cell to test */ - int *pbRes /* OUT: Test result */ -){ - int i; - RtreeDValue aCoord[RTREE_MAX_DIMENSIONS*2]; - int nCoord = pRtree->nDim*2; - - assert( pConstraint->op==RTREE_MATCH ); - assert( pConstraint->pGeom ); - - for(i=0; iaCoord[i]); - } - return pConstraint->xGeom(pConstraint->pGeom, nCoord, aCoord, pbRes); -} - -/* -** Cursor pCursor currently points to a cell in a non-leaf page. -** Set *pbEof to true if the sub-tree headed by the cell is filtered -** (excluded) by the constraints in the pCursor->aConstraint[] -** array, or false otherwise. -** -** Return SQLITE_OK if successful or an SQLite error code if an error -** occurs within a geometry callback. -*/ -static int testRtreeCell(Rtree *pRtree, RtreeCursor *pCursor, int *pbEof){ - RtreeCell cell; - int ii; - int bRes = 0; - int rc = SQLITE_OK; - - nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell); - for(ii=0; bRes==0 && iinConstraint; ii++){ - RtreeConstraint *p = &pCursor->aConstraint[ii]; - RtreeDValue cell_min = DCOORD(cell.aCoord[(p->iCoord>>1)*2]); - RtreeDValue cell_max = DCOORD(cell.aCoord[(p->iCoord>>1)*2+1]); - - assert(p->op==RTREE_LE || p->op==RTREE_LT || p->op==RTREE_GE - || p->op==RTREE_GT || p->op==RTREE_EQ || p->op==RTREE_MATCH - ); - - switch( p->op ){ - case RTREE_LE: case RTREE_LT: - bRes = p->rValuerValue>cell_max; - break; - - case RTREE_EQ: - bRes = (p->rValue>cell_max || p->rValueop==RTREE_MATCH ); - rc = testRtreeGeom(pRtree, p, &cell, &bRes); - bRes = !bRes; - break; - } - } - } - - *pbEof = bRes; - return rc; -} - -/* -** Test if the cell that cursor pCursor currently points to -** would be filtered (excluded) by the constraints in the -** pCursor->aConstraint[] array. If so, set *pbEof to true before -** returning. If the cell is not filtered (excluded) by the constraints, -** set pbEof to zero. -** -** Return SQLITE_OK if successful or an SQLite error code if an error -** occurs within a geometry callback. -** -** This function assumes that the cell is part of a leaf node. -*/ -static int testRtreeEntry(Rtree *pRtree, RtreeCursor *pCursor, int *pbEof){ - RtreeCell cell; - int ii; - *pbEof = 0; - - nodeGetCell(pRtree, pCursor->pNode, pCursor->iCell, &cell); - for(ii=0; iinConstraint; ii++){ - RtreeConstraint *p = &pCursor->aConstraint[ii]; - RtreeDValue coord = DCOORD(cell.aCoord[p->iCoord]); - int res; - assert(p->op==RTREE_LE || p->op==RTREE_LT || p->op==RTREE_GE - || p->op==RTREE_GT || p->op==RTREE_EQ || p->op==RTREE_MATCH - ); - switch( p->op ){ - case RTREE_LE: res = (coord<=p->rValue); break; - case RTREE_LT: res = (coordrValue); break; - case RTREE_GE: res = (coord>=p->rValue); break; - case RTREE_GT: res = (coord>p->rValue); break; - case RTREE_EQ: res = (coord==p->rValue); break; - default: { - int rc; - assert( p->op==RTREE_MATCH ); - rc = testRtreeGeom(pRtree, p, &cell, &res); - if( rc!=SQLITE_OK ){ - return rc; - } - break; - } - } - - if( !res ){ - *pbEof = 1; - return SQLITE_OK; - } - } - - return SQLITE_OK; -} - -/* -** Cursor pCursor currently points at a node that heads a sub-tree of -** height iHeight (if iHeight==0, then the node is a leaf). Descend -** to point to the left-most cell of the sub-tree that matches the -** configured constraints. -*/ -static int descendToCell( - Rtree *pRtree, - RtreeCursor *pCursor, - int iHeight, - int *pEof /* OUT: Set to true if cannot descend */ -){ - int isEof; - int rc; - int ii; - RtreeNode *pChild; - sqlite3_int64 iRowid; - - RtreeNode *pSavedNode = pCursor->pNode; - int iSavedCell = pCursor->iCell; - - assert( iHeight>=0 ); - - if( iHeight==0 ){ - rc = testRtreeEntry(pRtree, pCursor, &isEof); - }else{ - rc = testRtreeCell(pRtree, pCursor, &isEof); - } - if( rc!=SQLITE_OK || isEof || iHeight==0 ){ - goto descend_to_cell_out; - } - - iRowid = nodeGetRowid(pRtree, pCursor->pNode, pCursor->iCell); - rc = nodeAcquire(pRtree, iRowid, pCursor->pNode, &pChild); - if( rc!=SQLITE_OK ){ - goto descend_to_cell_out; - } - - nodeRelease(pRtree, pCursor->pNode); - pCursor->pNode = pChild; - isEof = 1; - for(ii=0; isEof && iiiCell = ii; - rc = descendToCell(pRtree, pCursor, iHeight-1, &isEof); - if( rc!=SQLITE_OK ){ - goto descend_to_cell_out; - } - } - - if( isEof ){ - assert( pCursor->pNode==pChild ); - nodeReference(pSavedNode); - nodeRelease(pRtree, pChild); - pCursor->pNode = pSavedNode; - pCursor->iCell = iSavedCell; - } - -descend_to_cell_out: - *pEof = isEof; - return rc; -} - -/* -** One of the cells in node pNode is guaranteed to have a 64-bit -** integer value equal to iRowid. Return the index of this cell. -*/ -static int nodeRowidIndex( - Rtree *pRtree, - RtreeNode *pNode, - i64 iRowid, - int *piIndex -){ - int ii; - int nCell = NCELL(pNode); - for(ii=0; iipParent; - if( pParent ){ - return nodeRowidIndex(pRtree, pParent, pNode->iNode, piIndex); - } - *piIndex = -1; - return SQLITE_OK; -} - -/* -** Rtree virtual table module xNext method. -*/ -static int rtreeNext(sqlite3_vtab_cursor *pVtabCursor){ - Rtree *pRtree = (Rtree *)(pVtabCursor->pVtab); - RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor; - int rc = SQLITE_OK; - - /* RtreeCursor.pNode must not be NULL. If is is NULL, then this cursor is - ** already at EOF. It is against the rules to call the xNext() method of - ** a cursor that has already reached EOF. - */ - assert( pCsr->pNode ); - - if( pCsr->iStrategy==1 ){ - /* This "scan" is a direct lookup by rowid. There is no next entry. */ - nodeRelease(pRtree, pCsr->pNode); - pCsr->pNode = 0; - }else{ - /* Move to the next entry that matches the configured constraints. */ - int iHeight = 0; - while( pCsr->pNode ){ - RtreeNode *pNode = pCsr->pNode; - int nCell = NCELL(pNode); - for(pCsr->iCell++; pCsr->iCelliCell++){ - int isEof; - rc = descendToCell(pRtree, pCsr, iHeight, &isEof); - if( rc!=SQLITE_OK || !isEof ){ - return rc; - } - } - pCsr->pNode = pNode->pParent; - rc = nodeParentIndex(pRtree, pNode, &pCsr->iCell); - if( rc!=SQLITE_OK ){ - return rc; - } - nodeReference(pCsr->pNode); - nodeRelease(pRtree, pNode); - iHeight++; - } - } - - return rc; -} - -/* -** Rtree virtual table module xRowid method. -*/ -static int rtreeRowid(sqlite3_vtab_cursor *pVtabCursor, sqlite_int64 *pRowid){ - Rtree *pRtree = (Rtree *)pVtabCursor->pVtab; - RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor; - - assert(pCsr->pNode); - *pRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell); - - return SQLITE_OK; -} - -/* -** Rtree virtual table module xColumn method. -*/ -static int rtreeColumn(sqlite3_vtab_cursor *cur, sqlite3_context *ctx, int i){ - Rtree *pRtree = (Rtree *)cur->pVtab; - RtreeCursor *pCsr = (RtreeCursor *)cur; - - if( i==0 ){ - i64 iRowid = nodeGetRowid(pRtree, pCsr->pNode, pCsr->iCell); - sqlite3_result_int64(ctx, iRowid); - }else{ - RtreeCoord c; - nodeGetCoord(pRtree, pCsr->pNode, pCsr->iCell, i-1, &c); -#ifndef SQLITE_RTREE_INT_ONLY - if( pRtree->eCoordType==RTREE_COORD_REAL32 ){ - sqlite3_result_double(ctx, c.f); - }else -#endif - { - assert( pRtree->eCoordType==RTREE_COORD_INT32 ); - sqlite3_result_int(ctx, c.i); - } - } - - return SQLITE_OK; -} - -/* -** Use nodeAcquire() to obtain the leaf node containing the record with -** rowid iRowid. If successful, set *ppLeaf to point to the node and -** return SQLITE_OK. If there is no such record in the table, set -** *ppLeaf to 0 and return SQLITE_OK. If an error occurs, set *ppLeaf -** to zero and return an SQLite error code. -*/ -static int findLeafNode(Rtree *pRtree, i64 iRowid, RtreeNode **ppLeaf){ - int rc; - *ppLeaf = 0; - sqlite3_bind_int64(pRtree->pReadRowid, 1, iRowid); - if( sqlite3_step(pRtree->pReadRowid)==SQLITE_ROW ){ - i64 iNode = sqlite3_column_int64(pRtree->pReadRowid, 0); - rc = nodeAcquire(pRtree, iNode, 0, ppLeaf); - sqlite3_reset(pRtree->pReadRowid); - }else{ - rc = sqlite3_reset(pRtree->pReadRowid); - } - return rc; -} - -/* -** This function is called to configure the RtreeConstraint object passed -** as the second argument for a MATCH constraint. The value passed as the -** first argument to this function is the right-hand operand to the MATCH -** operator. -*/ -static int deserializeGeometry(sqlite3_value *pValue, RtreeConstraint *pCons){ - RtreeMatchArg *p; - sqlite3_rtree_geometry *pGeom; - int nBlob; - - /* Check that value is actually a blob. */ - if( sqlite3_value_type(pValue)!=SQLITE_BLOB ) return SQLITE_ERROR; - - /* Check that the blob is roughly the right size. */ - nBlob = sqlite3_value_bytes(pValue); - if( nBlob<(int)sizeof(RtreeMatchArg) - || ((nBlob-sizeof(RtreeMatchArg))%sizeof(RtreeDValue))!=0 - ){ - return SQLITE_ERROR; - } - - pGeom = (sqlite3_rtree_geometry *)sqlite3_malloc( - sizeof(sqlite3_rtree_geometry) + nBlob - ); - if( !pGeom ) return SQLITE_NOMEM; - memset(pGeom, 0, sizeof(sqlite3_rtree_geometry)); - p = (RtreeMatchArg *)&pGeom[1]; - - memcpy(p, sqlite3_value_blob(pValue), nBlob); - if( p->magic!=RTREE_GEOMETRY_MAGIC - || nBlob!=(int)(sizeof(RtreeMatchArg) + (p->nParam-1)*sizeof(RtreeDValue)) - ){ - sqlite3_free(pGeom); - return SQLITE_ERROR; - } - - pGeom->pContext = p->pContext; - pGeom->nParam = p->nParam; - pGeom->aParam = p->aParam; - - pCons->xGeom = p->xGeom; - pCons->pGeom = pGeom; - return SQLITE_OK; -} - -/* -** Rtree virtual table module xFilter method. -*/ -static int rtreeFilter( - sqlite3_vtab_cursor *pVtabCursor, - int idxNum, const char *idxStr, - int argc, sqlite3_value **argv -){ - Rtree *pRtree = (Rtree *)pVtabCursor->pVtab; - RtreeCursor *pCsr = (RtreeCursor *)pVtabCursor; - - RtreeNode *pRoot = 0; - int ii; - int rc = SQLITE_OK; - - rtreeReference(pRtree); - - freeCursorConstraints(pCsr); - pCsr->iStrategy = idxNum; - - if( idxNum==1 ){ - /* Special case - lookup by rowid. */ - RtreeNode *pLeaf; /* Leaf on which the required cell resides */ - i64 iRowid = sqlite3_value_int64(argv[0]); - rc = findLeafNode(pRtree, iRowid, &pLeaf); - pCsr->pNode = pLeaf; - if( pLeaf ){ - assert( rc==SQLITE_OK ); - rc = nodeRowidIndex(pRtree, pLeaf, iRowid, &pCsr->iCell); - } - }else{ - /* Normal case - r-tree scan. Set up the RtreeCursor.aConstraint array - ** with the configured constraints. - */ - if( argc>0 ){ - pCsr->aConstraint = sqlite3_malloc(sizeof(RtreeConstraint)*argc); - pCsr->nConstraint = argc; - if( !pCsr->aConstraint ){ - rc = SQLITE_NOMEM; - }else{ - memset(pCsr->aConstraint, 0, sizeof(RtreeConstraint)*argc); - assert( (idxStr==0 && argc==0) - || (idxStr && (int)strlen(idxStr)==argc*2) ); - for(ii=0; iiaConstraint[ii]; - p->op = idxStr[ii*2]; - p->iCoord = idxStr[ii*2+1]-'a'; - if( p->op==RTREE_MATCH ){ - /* A MATCH operator. The right-hand-side must be a blob that - ** can be cast into an RtreeMatchArg object. One created using - ** an sqlite3_rtree_geometry_callback() SQL user function. - */ - rc = deserializeGeometry(argv[ii], p); - if( rc!=SQLITE_OK ){ - break; - } - }else{ -#ifdef SQLITE_RTREE_INT_ONLY - p->rValue = sqlite3_value_int64(argv[ii]); -#else - p->rValue = sqlite3_value_double(argv[ii]); -#endif - } - } - } - } - - if( rc==SQLITE_OK ){ - pCsr->pNode = 0; - rc = nodeAcquire(pRtree, 1, 0, &pRoot); - } - if( rc==SQLITE_OK ){ - int isEof = 1; - int nCell = NCELL(pRoot); - pCsr->pNode = pRoot; - for(pCsr->iCell=0; rc==SQLITE_OK && pCsr->iCelliCell++){ - assert( pCsr->pNode==pRoot ); - rc = descendToCell(pRtree, pCsr, pRtree->iDepth, &isEof); - if( !isEof ){ - break; - } - } - if( rc==SQLITE_OK && isEof ){ - assert( pCsr->pNode==pRoot ); - nodeRelease(pRtree, pRoot); - pCsr->pNode = 0; - } - assert( rc!=SQLITE_OK || !pCsr->pNode || pCsr->iCellpNode) ); - } - } - - rtreeRelease(pRtree); - return rc; -} - -/* -** Set the pIdxInfo->estimatedRows variable to nRow. Unless this -** extension is currently being used by a version of SQLite too old to -** support estimatedRows. In that case this function is a no-op. -*/ -static void setEstimatedRows(sqlite3_index_info *pIdxInfo, i64 nRow){ -#if SQLITE_VERSION_NUMBER>=3008002 - if( sqlite3_libversion_number()>=3008002 ){ - pIdxInfo->estimatedRows = nRow; - } -#endif -} - -/* -** Rtree virtual table module xBestIndex method. There are three -** table scan strategies to choose from (in order from most to -** least desirable): -** -** idxNum idxStr Strategy -** ------------------------------------------------ -** 1 Unused Direct lookup by rowid. -** 2 See below R-tree query or full-table scan. -** ------------------------------------------------ -** -** If strategy 1 is used, then idxStr is not meaningful. If strategy -** 2 is used, idxStr is formatted to contain 2 bytes for each -** constraint used. The first two bytes of idxStr correspond to -** the constraint in sqlite3_index_info.aConstraintUsage[] with -** (argvIndex==1) etc. -** -** The first of each pair of bytes in idxStr identifies the constraint -** operator as follows: -** -** Operator Byte Value -** ---------------------- -** = 0x41 ('A') -** <= 0x42 ('B') -** < 0x43 ('C') -** >= 0x44 ('D') -** > 0x45 ('E') -** MATCH 0x46 ('F') -** ---------------------- -** -** The second of each pair of bytes identifies the coordinate column -** to which the constraint applies. The leftmost coordinate column -** is 'a', the second from the left 'b' etc. -*/ -static int rtreeBestIndex(sqlite3_vtab *tab, sqlite3_index_info *pIdxInfo){ - Rtree *pRtree = (Rtree*)tab; - int rc = SQLITE_OK; - int ii; - i64 nRow; /* Estimated rows returned by this scan */ - - int iIdx = 0; - char zIdxStr[RTREE_MAX_DIMENSIONS*8+1]; - memset(zIdxStr, 0, sizeof(zIdxStr)); - - assert( pIdxInfo->idxStr==0 ); - for(ii=0; iinConstraint && iIdx<(int)(sizeof(zIdxStr)-1); ii++){ - struct sqlite3_index_constraint *p = &pIdxInfo->aConstraint[ii]; - - if( p->usable && p->iColumn==0 && p->op==SQLITE_INDEX_CONSTRAINT_EQ ){ - /* We have an equality constraint on the rowid. Use strategy 1. */ - int jj; - for(jj=0; jjaConstraintUsage[jj].argvIndex = 0; - pIdxInfo->aConstraintUsage[jj].omit = 0; - } - pIdxInfo->idxNum = 1; - pIdxInfo->aConstraintUsage[ii].argvIndex = 1; - pIdxInfo->aConstraintUsage[jj].omit = 1; - - /* This strategy involves a two rowid lookups on an B-Tree structures - ** and then a linear search of an R-Tree node. This should be - ** considered almost as quick as a direct rowid lookup (for which - ** sqlite uses an internal cost of 0.0). It is expected to return - ** a single row. - */ - pIdxInfo->estimatedCost = 30.0; - setEstimatedRows(pIdxInfo, 1); - return SQLITE_OK; - } - - if( p->usable && (p->iColumn>0 || p->op==SQLITE_INDEX_CONSTRAINT_MATCH) ){ - u8 op; - switch( p->op ){ - case SQLITE_INDEX_CONSTRAINT_EQ: op = RTREE_EQ; break; - case SQLITE_INDEX_CONSTRAINT_GT: op = RTREE_GT; break; - case SQLITE_INDEX_CONSTRAINT_LE: op = RTREE_LE; break; - case SQLITE_INDEX_CONSTRAINT_LT: op = RTREE_LT; break; - case SQLITE_INDEX_CONSTRAINT_GE: op = RTREE_GE; break; - default: - assert( p->op==SQLITE_INDEX_CONSTRAINT_MATCH ); - op = RTREE_MATCH; - break; - } - zIdxStr[iIdx++] = op; - zIdxStr[iIdx++] = p->iColumn - 1 + 'a'; - pIdxInfo->aConstraintUsage[ii].argvIndex = (iIdx/2); - pIdxInfo->aConstraintUsage[ii].omit = 1; - } - } - - pIdxInfo->idxNum = 2; - pIdxInfo->needToFreeIdxStr = 1; - if( iIdx>0 && 0==(pIdxInfo->idxStr = sqlite3_mprintf("%s", zIdxStr)) ){ - return SQLITE_NOMEM; - } - - nRow = pRtree->nRowEst / (iIdx + 1); - pIdxInfo->estimatedCost = (double)6.0 * (double)nRow; - setEstimatedRows(pIdxInfo, nRow); - - return rc; -} - -/* -** Return the N-dimensional volumn of the cell stored in *p. -*/ -static RtreeDValue cellArea(Rtree *pRtree, RtreeCell *p){ - RtreeDValue area = (RtreeDValue)1; - int ii; - for(ii=0; ii<(pRtree->nDim*2); ii+=2){ - area = (area * (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii]))); - } - return area; -} - -/* -** Return the margin length of cell p. The margin length is the sum -** of the objects size in each dimension. -*/ -static RtreeDValue cellMargin(Rtree *pRtree, RtreeCell *p){ - RtreeDValue margin = (RtreeDValue)0; - int ii; - for(ii=0; ii<(pRtree->nDim*2); ii+=2){ - margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii])); - } - return margin; -} - -/* -** Store the union of cells p1 and p2 in p1. -*/ -static void cellUnion(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){ - int ii; - if( pRtree->eCoordType==RTREE_COORD_REAL32 ){ - for(ii=0; ii<(pRtree->nDim*2); ii+=2){ - p1->aCoord[ii].f = MIN(p1->aCoord[ii].f, p2->aCoord[ii].f); - p1->aCoord[ii+1].f = MAX(p1->aCoord[ii+1].f, p2->aCoord[ii+1].f); - } - }else{ - for(ii=0; ii<(pRtree->nDim*2); ii+=2){ - p1->aCoord[ii].i = MIN(p1->aCoord[ii].i, p2->aCoord[ii].i); - p1->aCoord[ii+1].i = MAX(p1->aCoord[ii+1].i, p2->aCoord[ii+1].i); - } - } -} - -/* -** Return true if the area covered by p2 is a subset of the area covered -** by p1. False otherwise. -*/ -static int cellContains(Rtree *pRtree, RtreeCell *p1, RtreeCell *p2){ - int ii; - int isInt = (pRtree->eCoordType==RTREE_COORD_INT32); - for(ii=0; ii<(pRtree->nDim*2); ii+=2){ - RtreeCoord *a1 = &p1->aCoord[ii]; - RtreeCoord *a2 = &p2->aCoord[ii]; - if( (!isInt && (a2[0].fa1[1].f)) - || ( isInt && (a2[0].ia1[1].i)) - ){ - return 0; - } - } - return 1; -} - -/* -** Return the amount cell p would grow by if it were unioned with pCell. -*/ -static RtreeDValue cellGrowth(Rtree *pRtree, RtreeCell *p, RtreeCell *pCell){ - RtreeDValue area; - RtreeCell cell; - memcpy(&cell, p, sizeof(RtreeCell)); - area = cellArea(pRtree, &cell); - cellUnion(pRtree, &cell, pCell); - return (cellArea(pRtree, &cell)-area); -} - -#if VARIANT_RSTARTREE_CHOOSESUBTREE || VARIANT_RSTARTREE_SPLIT -static RtreeDValue cellOverlap( - Rtree *pRtree, - RtreeCell *p, - RtreeCell *aCell, - int nCell, - int iExclude -){ - int ii; - RtreeDValue overlap = 0.0; - for(ii=0; iinDim*2); jj+=2){ - RtreeDValue x1, x2; - - x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj])); - x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1])); - - if( x2iDepth-iHeight); ii++){ - int iCell; - sqlite3_int64 iBest = 0; - - RtreeDValue fMinGrowth = 0.0; - RtreeDValue fMinArea = 0.0; -#if VARIANT_RSTARTREE_CHOOSESUBTREE - RtreeDValue fMinOverlap = 0.0; - RtreeDValue overlap; -#endif - - int nCell = NCELL(pNode); - RtreeCell cell; - RtreeNode *pChild; - - RtreeCell *aCell = 0; - -#if VARIANT_RSTARTREE_CHOOSESUBTREE - if( ii==(pRtree->iDepth-1) ){ - int jj; - aCell = sqlite3_malloc(sizeof(RtreeCell)*nCell); - if( !aCell ){ - rc = SQLITE_NOMEM; - nodeRelease(pRtree, pNode); - pNode = 0; - continue; - } - for(jj=0; jjiDepth-1) ){ - overlap = cellOverlapEnlargement(pRtree,&cell,pCell,aCell,nCell,iCell); - }else{ - overlap = 0.0; - } - if( (iCell==0) - || (overlappParent ){ - RtreeNode *pParent = p->pParent; - RtreeCell cell; - int iCell; - - if( nodeParentIndex(pRtree, p, &iCell) ){ - return SQLITE_CORRUPT_VTAB; - } - - nodeGetCell(pRtree, pParent, iCell, &cell); - if( !cellContains(pRtree, &cell, pCell) ){ - cellUnion(pRtree, &cell, pCell); - nodeOverwriteCell(pRtree, pParent, &cell, iCell); - } - - p = pParent; - } - return SQLITE_OK; -} - -/* -** Write mapping (iRowid->iNode) to the _rowid table. -*/ -static int rowidWrite(Rtree *pRtree, sqlite3_int64 iRowid, sqlite3_int64 iNode){ - sqlite3_bind_int64(pRtree->pWriteRowid, 1, iRowid); - sqlite3_bind_int64(pRtree->pWriteRowid, 2, iNode); - sqlite3_step(pRtree->pWriteRowid); - return sqlite3_reset(pRtree->pWriteRowid); -} - -/* -** Write mapping (iNode->iPar) to the _parent table. -*/ -static int parentWrite(Rtree *pRtree, sqlite3_int64 iNode, sqlite3_int64 iPar){ - sqlite3_bind_int64(pRtree->pWriteParent, 1, iNode); - sqlite3_bind_int64(pRtree->pWriteParent, 2, iPar); - sqlite3_step(pRtree->pWriteParent); - return sqlite3_reset(pRtree->pWriteParent); -} - -static int rtreeInsertCell(Rtree *, RtreeNode *, RtreeCell *, int); - -#if VARIANT_GUTTMAN_LINEAR_SPLIT -/* -** Implementation of the linear variant of the PickNext() function from -** Guttman[84]. -*/ -static RtreeCell *LinearPickNext( - Rtree *pRtree, - RtreeCell *aCell, - int nCell, - RtreeCell *pLeftBox, - RtreeCell *pRightBox, - int *aiUsed -){ - int ii; - for(ii=0; aiUsed[ii]; ii++); - aiUsed[ii] = 1; - return &aCell[ii]; -} - -/* -** Implementation of the linear variant of the PickSeeds() function from -** Guttman[84]. -*/ -static void LinearPickSeeds( - Rtree *pRtree, - RtreeCell *aCell, - int nCell, - int *piLeftSeed, - int *piRightSeed -){ - int i; - int iLeftSeed = 0; - int iRightSeed = 1; - RtreeDValue maxNormalInnerWidth = (RtreeDValue)0; - - /* Pick two "seed" cells from the array of cells. The algorithm used - ** here is the LinearPickSeeds algorithm from Gutman[1984]. The - ** indices of the two seed cells in the array are stored in local - ** variables iLeftSeek and iRightSeed. - */ - for(i=0; inDim; i++){ - RtreeDValue x1 = DCOORD(aCell[0].aCoord[i*2]); - RtreeDValue x2 = DCOORD(aCell[0].aCoord[i*2+1]); - RtreeDValue x3 = x1; - RtreeDValue x4 = x2; - int jj; - - int iCellLeft = 0; - int iCellRight = 0; - - for(jj=1; jjx4 ) x4 = right; - if( left>x3 ){ - x3 = left; - iCellRight = jj; - } - if( rightmaxNormalInnerWidth ){ - iLeftSeed = iCellLeft; - iRightSeed = iCellRight; - } - } - } - - *piLeftSeed = iLeftSeed; - *piRightSeed = iRightSeed; -} -#endif /* VARIANT_GUTTMAN_LINEAR_SPLIT */ - -#if VARIANT_GUTTMAN_QUADRATIC_SPLIT -/* -** Implementation of the quadratic variant of the PickNext() function from -** Guttman[84]. -*/ -static RtreeCell *QuadraticPickNext( - Rtree *pRtree, - RtreeCell *aCell, - int nCell, - RtreeCell *pLeftBox, - RtreeCell *pRightBox, - int *aiUsed -){ - #define FABS(a) ((a)<0.0?-1.0*(a):(a)) - - int iSelect = -1; - RtreeDValue fDiff; - int ii; - for(ii=0; iifDiff ){ - fDiff = diff; - iSelect = ii; - } - } - } - aiUsed[iSelect] = 1; - return &aCell[iSelect]; -} - -/* -** Implementation of the quadratic variant of the PickSeeds() function from -** Guttman[84]. -*/ -static void QuadraticPickSeeds( - Rtree *pRtree, - RtreeCell *aCell, - int nCell, - int *piLeftSeed, - int *piRightSeed -){ - int ii; - int jj; - - int iLeftSeed = 0; - int iRightSeed = 1; - RtreeDValue fWaste = 0.0; - - for(ii=0; iifWaste ){ - iLeftSeed = ii; - iRightSeed = jj; - fWaste = waste; - } - } - } - - *piLeftSeed = iLeftSeed; - *piRightSeed = iRightSeed; -} -#endif /* VARIANT_GUTTMAN_QUADRATIC_SPLIT */ - -/* -** Arguments aIdx, aDistance and aSpare all point to arrays of size -** nIdx. The aIdx array contains the set of integers from 0 to -** (nIdx-1) in no particular order. This function sorts the values -** in aIdx according to the indexed values in aDistance. For -** example, assuming the inputs: -** -** aIdx = { 0, 1, 2, 3 } -** aDistance = { 5.0, 2.0, 7.0, 6.0 } -** -** this function sets the aIdx array to contain: -** -** aIdx = { 0, 1, 2, 3 } -** -** The aSpare array is used as temporary working space by the -** sorting algorithm. -*/ -static void SortByDistance( - int *aIdx, - int nIdx, - RtreeDValue *aDistance, - int *aSpare -){ - if( nIdx>1 ){ - int iLeft = 0; - int iRight = 0; - - int nLeft = nIdx/2; - int nRight = nIdx-nLeft; - int *aLeft = aIdx; - int *aRight = &aIdx[nLeft]; - - SortByDistance(aLeft, nLeft, aDistance, aSpare); - SortByDistance(aRight, nRight, aDistance, aSpare); - - memcpy(aSpare, aLeft, sizeof(int)*nLeft); - aLeft = aSpare; - - while( iLeft1 ){ - - int iLeft = 0; - int iRight = 0; - - int nLeft = nIdx/2; - int nRight = nIdx-nLeft; - int *aLeft = aIdx; - int *aRight = &aIdx[nLeft]; - - SortByDimension(pRtree, aLeft, nLeft, iDim, aCell, aSpare); - SortByDimension(pRtree, aRight, nRight, iDim, aCell, aSpare); - - memcpy(aSpare, aLeft, sizeof(int)*nLeft); - aLeft = aSpare; - while( iLeftnDim+1)*(sizeof(int*)+nCell*sizeof(int)); - - aaSorted = (int **)sqlite3_malloc(nByte); - if( !aaSorted ){ - return SQLITE_NOMEM; - } - - aSpare = &((int *)&aaSorted[pRtree->nDim])[pRtree->nDim*nCell]; - memset(aaSorted, 0, nByte); - for(ii=0; iinDim; ii++){ - int jj; - aaSorted[ii] = &((int *)&aaSorted[pRtree->nDim])[ii*nCell]; - for(jj=0; jjnDim; ii++){ - RtreeDValue margin = 0.0; - RtreeDValue fBestOverlap = 0.0; - RtreeDValue fBestArea = 0.0; - int iBestLeft = 0; - int nLeft; - - for( - nLeft=RTREE_MINCELLS(pRtree); - nLeft<=(nCell-RTREE_MINCELLS(pRtree)); - nLeft++ - ){ - RtreeCell left; - RtreeCell right; - int kk; - RtreeDValue overlap; - RtreeDValue area; - - memcpy(&left, &aCell[aaSorted[ii][0]], sizeof(RtreeCell)); - memcpy(&right, &aCell[aaSorted[ii][nCell-1]], sizeof(RtreeCell)); - for(kk=1; kk<(nCell-1); kk++){ - if( kk0; i--){ - RtreeCell *pNext; - pNext = PickNext(pRtree, aCell, nCell, pBboxLeft, pBboxRight, aiUsed); - RtreeDValue diff = - cellGrowth(pRtree, pBboxLeft, pNext) - - cellGrowth(pRtree, pBboxRight, pNext) - ; - if( (RTREE_MINCELLS(pRtree)-NCELL(pRight)==i) - || (diff>0.0 && (RTREE_MINCELLS(pRtree)-NCELL(pLeft)!=i)) - ){ - nodeInsertCell(pRtree, pRight, pNext); - cellUnion(pRtree, pBboxRight, pNext); - }else{ - nodeInsertCell(pRtree, pLeft, pNext); - cellUnion(pRtree, pBboxLeft, pNext); - } - } - - sqlite3_free(aiUsed); - return SQLITE_OK; -} -#endif - -static int updateMapping( - Rtree *pRtree, - i64 iRowid, - RtreeNode *pNode, - int iHeight -){ - int (*xSetMapping)(Rtree *, sqlite3_int64, sqlite3_int64); - xSetMapping = ((iHeight==0)?rowidWrite:parentWrite); - if( iHeight>0 ){ - RtreeNode *pChild = nodeHashLookup(pRtree, iRowid); - if( pChild ){ - nodeRelease(pRtree, pChild->pParent); - nodeReference(pNode); - pChild->pParent = pNode; - } - } - return xSetMapping(pRtree, iRowid, pNode->iNode); -} - -static int SplitNode( - Rtree *pRtree, - RtreeNode *pNode, - RtreeCell *pCell, - int iHeight -){ - int i; - int newCellIsRight = 0; - - int rc = SQLITE_OK; - int nCell = NCELL(pNode); - RtreeCell *aCell; - int *aiUsed; - - RtreeNode *pLeft = 0; - RtreeNode *pRight = 0; - - RtreeCell leftbbox; - RtreeCell rightbbox; - - /* Allocate an array and populate it with a copy of pCell and - ** all cells from node pLeft. Then zero the original node. - */ - aCell = sqlite3_malloc((sizeof(RtreeCell)+sizeof(int))*(nCell+1)); - if( !aCell ){ - rc = SQLITE_NOMEM; - goto splitnode_out; - } - aiUsed = (int *)&aCell[nCell+1]; - memset(aiUsed, 0, sizeof(int)*(nCell+1)); - for(i=0; iiNode==1 ){ - pRight = nodeNew(pRtree, pNode); - pLeft = nodeNew(pRtree, pNode); - pRtree->iDepth++; - pNode->isDirty = 1; - writeInt16(pNode->zData, pRtree->iDepth); - }else{ - pLeft = pNode; - pRight = nodeNew(pRtree, pLeft->pParent); - nodeReference(pLeft); - } - - if( !pLeft || !pRight ){ - rc = SQLITE_NOMEM; - goto splitnode_out; - } - - memset(pLeft->zData, 0, pRtree->iNodeSize); - memset(pRight->zData, 0, pRtree->iNodeSize); - - rc = AssignCells(pRtree, aCell, nCell, pLeft, pRight, &leftbbox, &rightbbox); - if( rc!=SQLITE_OK ){ - goto splitnode_out; - } - - /* Ensure both child nodes have node numbers assigned to them by calling - ** nodeWrite(). Node pRight always needs a node number, as it was created - ** by nodeNew() above. But node pLeft sometimes already has a node number. - ** In this case avoid the all to nodeWrite(). - */ - if( SQLITE_OK!=(rc = nodeWrite(pRtree, pRight)) - || (0==pLeft->iNode && SQLITE_OK!=(rc = nodeWrite(pRtree, pLeft))) - ){ - goto splitnode_out; - } - - rightbbox.iRowid = pRight->iNode; - leftbbox.iRowid = pLeft->iNode; - - if( pNode->iNode==1 ){ - rc = rtreeInsertCell(pRtree, pLeft->pParent, &leftbbox, iHeight+1); - if( rc!=SQLITE_OK ){ - goto splitnode_out; - } - }else{ - RtreeNode *pParent = pLeft->pParent; - int iCell; - rc = nodeParentIndex(pRtree, pLeft, &iCell); - if( rc==SQLITE_OK ){ - nodeOverwriteCell(pRtree, pParent, &leftbbox, iCell); - rc = AdjustTree(pRtree, pParent, &leftbbox); - } - if( rc!=SQLITE_OK ){ - goto splitnode_out; - } - } - if( (rc = rtreeInsertCell(pRtree, pRight->pParent, &rightbbox, iHeight+1)) ){ - goto splitnode_out; - } - - for(i=0; iiRowid ){ - newCellIsRight = 1; - } - if( rc!=SQLITE_OK ){ - goto splitnode_out; - } - } - if( pNode->iNode==1 ){ - for(i=0; iiRowid, pLeft, iHeight); - } - - if( rc==SQLITE_OK ){ - rc = nodeRelease(pRtree, pRight); - pRight = 0; - } - if( rc==SQLITE_OK ){ - rc = nodeRelease(pRtree, pLeft); - pLeft = 0; - } - -splitnode_out: - nodeRelease(pRtree, pRight); - nodeRelease(pRtree, pLeft); - sqlite3_free(aCell); - return rc; -} - -/* -** If node pLeaf is not the root of the r-tree and its pParent pointer is -** still NULL, load all ancestor nodes of pLeaf into memory and populate -** the pLeaf->pParent chain all the way up to the root node. -** -** This operation is required when a row is deleted (or updated - an update -** is implemented as a delete followed by an insert). SQLite provides the -** rowid of the row to delete, which can be used to find the leaf on which -** the entry resides (argument pLeaf). Once the leaf is located, this -** function is called to determine its ancestry. -*/ -static int fixLeafParent(Rtree *pRtree, RtreeNode *pLeaf){ - int rc = SQLITE_OK; - RtreeNode *pChild = pLeaf; - while( rc==SQLITE_OK && pChild->iNode!=1 && pChild->pParent==0 ){ - int rc2 = SQLITE_OK; /* sqlite3_reset() return code */ - sqlite3_bind_int64(pRtree->pReadParent, 1, pChild->iNode); - rc = sqlite3_step(pRtree->pReadParent); - if( rc==SQLITE_ROW ){ - RtreeNode *pTest; /* Used to test for reference loops */ - i64 iNode; /* Node number of parent node */ - - /* Before setting pChild->pParent, test that we are not creating a - ** loop of references (as we would if, say, pChild==pParent). We don't - ** want to do this as it leads to a memory leak when trying to delete - ** the referenced counted node structures. - */ - iNode = sqlite3_column_int64(pRtree->pReadParent, 0); - for(pTest=pLeaf; pTest && pTest->iNode!=iNode; pTest=pTest->pParent); - if( !pTest ){ - rc2 = nodeAcquire(pRtree, iNode, 0, &pChild->pParent); - } - } - rc = sqlite3_reset(pRtree->pReadParent); - if( rc==SQLITE_OK ) rc = rc2; - if( rc==SQLITE_OK && !pChild->pParent ) rc = SQLITE_CORRUPT_VTAB; - pChild = pChild->pParent; - } - return rc; -} - -static int deleteCell(Rtree *, RtreeNode *, int, int); - -static int removeNode(Rtree *pRtree, RtreeNode *pNode, int iHeight){ - int rc; - int rc2; - RtreeNode *pParent = 0; - int iCell; - - assert( pNode->nRef==1 ); - - /* Remove the entry in the parent cell. */ - rc = nodeParentIndex(pRtree, pNode, &iCell); - if( rc==SQLITE_OK ){ - pParent = pNode->pParent; - pNode->pParent = 0; - rc = deleteCell(pRtree, pParent, iCell, iHeight+1); - } - rc2 = nodeRelease(pRtree, pParent); - if( rc==SQLITE_OK ){ - rc = rc2; - } - if( rc!=SQLITE_OK ){ - return rc; - } - - /* Remove the xxx_node entry. */ - sqlite3_bind_int64(pRtree->pDeleteNode, 1, pNode->iNode); - sqlite3_step(pRtree->pDeleteNode); - if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteNode)) ){ - return rc; - } - - /* Remove the xxx_parent entry. */ - sqlite3_bind_int64(pRtree->pDeleteParent, 1, pNode->iNode); - sqlite3_step(pRtree->pDeleteParent); - if( SQLITE_OK!=(rc = sqlite3_reset(pRtree->pDeleteParent)) ){ - return rc; - } - - /* Remove the node from the in-memory hash table and link it into - ** the Rtree.pDeleted list. Its contents will be re-inserted later on. - */ - nodeHashDelete(pRtree, pNode); - pNode->iNode = iHeight; - pNode->pNext = pRtree->pDeleted; - pNode->nRef++; - pRtree->pDeleted = pNode; - - return SQLITE_OK; -} - -static int fixBoundingBox(Rtree *pRtree, RtreeNode *pNode){ - RtreeNode *pParent = pNode->pParent; - int rc = SQLITE_OK; - if( pParent ){ - int ii; - int nCell = NCELL(pNode); - RtreeCell box; /* Bounding box for pNode */ - nodeGetCell(pRtree, pNode, 0, &box); - for(ii=1; iiiNode; - rc = nodeParentIndex(pRtree, pNode, &ii); - if( rc==SQLITE_OK ){ - nodeOverwriteCell(pRtree, pParent, &box, ii); - rc = fixBoundingBox(pRtree, pParent); - } - } - return rc; -} - -/* -** Delete the cell at index iCell of node pNode. After removing the -** cell, adjust the r-tree data structure if required. -*/ -static int deleteCell(Rtree *pRtree, RtreeNode *pNode, int iCell, int iHeight){ - RtreeNode *pParent; - int rc; - - if( SQLITE_OK!=(rc = fixLeafParent(pRtree, pNode)) ){ - return rc; - } - - /* Remove the cell from the node. This call just moves bytes around - ** the in-memory node image, so it cannot fail. - */ - nodeDeleteCell(pRtree, pNode, iCell); - - /* If the node is not the tree root and now has less than the minimum - ** number of cells, remove it from the tree. Otherwise, update the - ** cell in the parent node so that it tightly contains the updated - ** node. - */ - pParent = pNode->pParent; - assert( pParent || pNode->iNode==1 ); - if( pParent ){ - if( NCELL(pNode)nDim; iDim++){ - aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2]); - aCenterCoord[iDim] += DCOORD(aCell[ii].aCoord[iDim*2+1]); - } - } - for(iDim=0; iDimnDim; iDim++){ - aCenterCoord[iDim] = (aCenterCoord[iDim]/(nCell*(RtreeDValue)2)); - } - - for(ii=0; iinDim; iDim++){ - RtreeDValue coord = (DCOORD(aCell[ii].aCoord[iDim*2+1]) - - DCOORD(aCell[ii].aCoord[iDim*2])); - aDistance[ii] += (coord-aCenterCoord[iDim])*(coord-aCenterCoord[iDim]); - } - } - - SortByDistance(aOrder, nCell, aDistance, aSpare); - nodeZero(pRtree, pNode); - - for(ii=0; rc==SQLITE_OK && ii<(nCell-(RTREE_MINCELLS(pRtree)+1)); ii++){ - RtreeCell *p = &aCell[aOrder[ii]]; - nodeInsertCell(pRtree, pNode, p); - if( p->iRowid==pCell->iRowid ){ - if( iHeight==0 ){ - rc = rowidWrite(pRtree, p->iRowid, pNode->iNode); - }else{ - rc = parentWrite(pRtree, p->iRowid, pNode->iNode); - } - } - } - if( rc==SQLITE_OK ){ - rc = fixBoundingBox(pRtree, pNode); - } - for(; rc==SQLITE_OK && iiiNode currently contains - ** the height of the sub-tree headed by the cell. - */ - RtreeNode *pInsert; - RtreeCell *p = &aCell[aOrder[ii]]; - rc = ChooseLeaf(pRtree, p, iHeight, &pInsert); - if( rc==SQLITE_OK ){ - int rc2; - rc = rtreeInsertCell(pRtree, pInsert, p, iHeight); - rc2 = nodeRelease(pRtree, pInsert); - if( rc==SQLITE_OK ){ - rc = rc2; - } - } - } - - sqlite3_free(aCell); - return rc; -} - -/* -** Insert cell pCell into node pNode. Node pNode is the head of a -** subtree iHeight high (leaf nodes have iHeight==0). -*/ -static int rtreeInsertCell( - Rtree *pRtree, - RtreeNode *pNode, - RtreeCell *pCell, - int iHeight -){ - int rc = SQLITE_OK; - if( iHeight>0 ){ - RtreeNode *pChild = nodeHashLookup(pRtree, pCell->iRowid); - if( pChild ){ - nodeRelease(pRtree, pChild->pParent); - nodeReference(pNode); - pChild->pParent = pNode; - } - } - if( nodeInsertCell(pRtree, pNode, pCell) ){ -#if VARIANT_RSTARTREE_REINSERT - if( iHeight<=pRtree->iReinsertHeight || pNode->iNode==1){ - rc = SplitNode(pRtree, pNode, pCell, iHeight); - }else{ - pRtree->iReinsertHeight = iHeight; - rc = Reinsert(pRtree, pNode, pCell, iHeight); - } -#else - rc = SplitNode(pRtree, pNode, pCell, iHeight); -#endif - }else{ - rc = AdjustTree(pRtree, pNode, pCell); - if( rc==SQLITE_OK ){ - if( iHeight==0 ){ - rc = rowidWrite(pRtree, pCell->iRowid, pNode->iNode); - }else{ - rc = parentWrite(pRtree, pCell->iRowid, pNode->iNode); - } - } - } - return rc; -} - -static int reinsertNodeContent(Rtree *pRtree, RtreeNode *pNode){ - int ii; - int rc = SQLITE_OK; - int nCell = NCELL(pNode); - - for(ii=0; rc==SQLITE_OK && iiiNode currently contains - ** the height of the sub-tree headed by the cell. - */ - rc = ChooseLeaf(pRtree, &cell, (int)pNode->iNode, &pInsert); - if( rc==SQLITE_OK ){ - int rc2; - rc = rtreeInsertCell(pRtree, pInsert, &cell, (int)pNode->iNode); - rc2 = nodeRelease(pRtree, pInsert); - if( rc==SQLITE_OK ){ - rc = rc2; - } - } - } - return rc; -} - -/* -** Select a currently unused rowid for a new r-tree record. -*/ -static int newRowid(Rtree *pRtree, i64 *piRowid){ - int rc; - sqlite3_bind_null(pRtree->pWriteRowid, 1); - sqlite3_bind_null(pRtree->pWriteRowid, 2); - sqlite3_step(pRtree->pWriteRowid); - rc = sqlite3_reset(pRtree->pWriteRowid); - *piRowid = sqlite3_last_insert_rowid(pRtree->db); - return rc; -} - -/* -** Remove the entry with rowid=iDelete from the r-tree structure. -*/ -static int rtreeDeleteRowid(Rtree *pRtree, sqlite3_int64 iDelete){ - int rc; /* Return code */ - RtreeNode *pLeaf = 0; /* Leaf node containing record iDelete */ - int iCell; /* Index of iDelete cell in pLeaf */ - RtreeNode *pRoot; /* Root node of rtree structure */ - - - /* Obtain a reference to the root node to initialize Rtree.iDepth */ - rc = nodeAcquire(pRtree, 1, 0, &pRoot); - - /* Obtain a reference to the leaf node that contains the entry - ** about to be deleted. - */ - if( rc==SQLITE_OK ){ - rc = findLeafNode(pRtree, iDelete, &pLeaf); - } - - /* Delete the cell in question from the leaf node. */ - if( rc==SQLITE_OK ){ - int rc2; - rc = nodeRowidIndex(pRtree, pLeaf, iDelete, &iCell); - if( rc==SQLITE_OK ){ - rc = deleteCell(pRtree, pLeaf, iCell, 0); - } - rc2 = nodeRelease(pRtree, pLeaf); - if( rc==SQLITE_OK ){ - rc = rc2; - } - } - - /* Delete the corresponding entry in the _rowid table. */ - if( rc==SQLITE_OK ){ - sqlite3_bind_int64(pRtree->pDeleteRowid, 1, iDelete); - sqlite3_step(pRtree->pDeleteRowid); - rc = sqlite3_reset(pRtree->pDeleteRowid); - } - - /* Check if the root node now has exactly one child. If so, remove - ** it, schedule the contents of the child for reinsertion and - ** reduce the tree height by one. - ** - ** This is equivalent to copying the contents of the child into - ** the root node (the operation that Gutman's paper says to perform - ** in this scenario). - */ - if( rc==SQLITE_OK && pRtree->iDepth>0 && NCELL(pRoot)==1 ){ - int rc2; - RtreeNode *pChild; - i64 iChild = nodeGetRowid(pRtree, pRoot, 0); - rc = nodeAcquire(pRtree, iChild, pRoot, &pChild); - if( rc==SQLITE_OK ){ - rc = removeNode(pRtree, pChild, pRtree->iDepth-1); - } - rc2 = nodeRelease(pRtree, pChild); - if( rc==SQLITE_OK ) rc = rc2; - if( rc==SQLITE_OK ){ - pRtree->iDepth--; - writeInt16(pRoot->zData, pRtree->iDepth); - pRoot->isDirty = 1; - } - } - - /* Re-insert the contents of any underfull nodes removed from the tree. */ - for(pLeaf=pRtree->pDeleted; pLeaf; pLeaf=pRtree->pDeleted){ - if( rc==SQLITE_OK ){ - rc = reinsertNodeContent(pRtree, pLeaf); - } - pRtree->pDeleted = pLeaf->pNext; - sqlite3_free(pLeaf); - } - - /* Release the reference to the root node. */ - if( rc==SQLITE_OK ){ - rc = nodeRelease(pRtree, pRoot); - }else{ - nodeRelease(pRtree, pRoot); - } - - return rc; -} - -/* -** Rounding constants for float->double conversion. -*/ -#define RNDTOWARDS (1.0 - 1.0/8388608.0) /* Round towards zero */ -#define RNDAWAY (1.0 + 1.0/8388608.0) /* Round away from zero */ - -#if !defined(SQLITE_RTREE_INT_ONLY) -/* -** Convert an sqlite3_value into an RtreeValue (presumably a float) -** while taking care to round toward negative or positive, respectively. -*/ -static RtreeValue rtreeValueDown(sqlite3_value *v){ - double d = sqlite3_value_double(v); - float f = (float)d; - if( f>d ){ - f = (float)(d*(d<0 ? RNDAWAY : RNDTOWARDS)); - } - return f; -} -static RtreeValue rtreeValueUp(sqlite3_value *v){ - double d = sqlite3_value_double(v); - float f = (float)d; - if( f1 */ - int bHaveRowid = 0; /* Set to 1 after new rowid is determined */ - - rtreeReference(pRtree); - assert(nData>=1); - - /* Constraint handling. A write operation on an r-tree table may return - ** SQLITE_CONSTRAINT for two reasons: - ** - ** 1. A duplicate rowid value, or - ** 2. The supplied data violates the "x2>=x1" constraint. - ** - ** In the first case, if the conflict-handling mode is REPLACE, then - ** the conflicting row can be removed before proceeding. In the second - ** case, SQLITE_CONSTRAINT must be returned regardless of the - ** conflict-handling mode specified by the user. - */ - if( nData>1 ){ - int ii; - - /* Populate the cell.aCoord[] array. The first coordinate is azData[3]. */ - assert( nData==(pRtree->nDim*2 + 3) ); -#ifndef SQLITE_RTREE_INT_ONLY - if( pRtree->eCoordType==RTREE_COORD_REAL32 ){ - for(ii=0; ii<(pRtree->nDim*2); ii+=2){ - cell.aCoord[ii].f = rtreeValueDown(azData[ii+3]); - cell.aCoord[ii+1].f = rtreeValueUp(azData[ii+4]); - if( cell.aCoord[ii].f>cell.aCoord[ii+1].f ){ - rc = SQLITE_CONSTRAINT; - goto constraint; - } - } - }else -#endif - { - for(ii=0; ii<(pRtree->nDim*2); ii+=2){ - cell.aCoord[ii].i = sqlite3_value_int(azData[ii+3]); - cell.aCoord[ii+1].i = sqlite3_value_int(azData[ii+4]); - if( cell.aCoord[ii].i>cell.aCoord[ii+1].i ){ - rc = SQLITE_CONSTRAINT; - goto constraint; - } - } - } - - /* If a rowid value was supplied, check if it is already present in - ** the table. If so, the constraint has failed. */ - if( sqlite3_value_type(azData[2])!=SQLITE_NULL ){ - cell.iRowid = sqlite3_value_int64(azData[2]); - if( sqlite3_value_type(azData[0])==SQLITE_NULL - || sqlite3_value_int64(azData[0])!=cell.iRowid - ){ - int steprc; - sqlite3_bind_int64(pRtree->pReadRowid, 1, cell.iRowid); - steprc = sqlite3_step(pRtree->pReadRowid); - rc = sqlite3_reset(pRtree->pReadRowid); - if( SQLITE_ROW==steprc ){ - if( sqlite3_vtab_on_conflict(pRtree->db)==SQLITE_REPLACE ){ - rc = rtreeDeleteRowid(pRtree, cell.iRowid); - }else{ - rc = SQLITE_CONSTRAINT; - goto constraint; - } - } - } - bHaveRowid = 1; - } - } - - /* If azData[0] is not an SQL NULL value, it is the rowid of a - ** record to delete from the r-tree table. The following block does - ** just that. - */ - if( sqlite3_value_type(azData[0])!=SQLITE_NULL ){ - rc = rtreeDeleteRowid(pRtree, sqlite3_value_int64(azData[0])); - } - - /* If the azData[] array contains more than one element, elements - ** (azData[2]..azData[argc-1]) contain a new record to insert into - ** the r-tree structure. - */ - if( rc==SQLITE_OK && nData>1 ){ - /* Insert the new record into the r-tree */ - RtreeNode *pLeaf = 0; - - /* Figure out the rowid of the new row. */ - if( bHaveRowid==0 ){ - rc = newRowid(pRtree, &cell.iRowid); - } - *pRowid = cell.iRowid; - - if( rc==SQLITE_OK ){ - rc = ChooseLeaf(pRtree, &cell, 0, &pLeaf); - } - if( rc==SQLITE_OK ){ - int rc2; - pRtree->iReinsertHeight = -1; - rc = rtreeInsertCell(pRtree, pLeaf, &cell, 0); - rc2 = nodeRelease(pRtree, pLeaf); - if( rc==SQLITE_OK ){ - rc = rc2; - } - } - } - -constraint: - rtreeRelease(pRtree); - return rc; -} - -/* -** The xRename method for rtree module virtual tables. -*/ -static int rtreeRename(sqlite3_vtab *pVtab, const char *zNewName){ - Rtree *pRtree = (Rtree *)pVtab; - int rc = SQLITE_NOMEM; - char *zSql = sqlite3_mprintf( - "ALTER TABLE %Q.'%q_node' RENAME TO \"%w_node\";" - "ALTER TABLE %Q.'%q_parent' RENAME TO \"%w_parent\";" - "ALTER TABLE %Q.'%q_rowid' RENAME TO \"%w_rowid\";" - , pRtree->zDb, pRtree->zName, zNewName - , pRtree->zDb, pRtree->zName, zNewName - , pRtree->zDb, pRtree->zName, zNewName - ); - if( zSql ){ - rc = sqlite3_exec(pRtree->db, zSql, 0, 0, 0); - sqlite3_free(zSql); - } - return rc; -} - -/* -** This function populates the pRtree->nRowEst variable with an estimate -** of the number of rows in the virtual table. If possible, this is based -** on sqlite_stat1 data. Otherwise, use RTREE_DEFAULT_ROWEST. -*/ -static int rtreeQueryStat1(sqlite3 *db, Rtree *pRtree){ - const char *zSql = "SELECT stat FROM sqlite_stat1 WHERE tbl= ? || '_rowid'"; - sqlite3_stmt *p; - int rc; - i64 nRow = 0; - - rc = sqlite3_prepare_v2(db, zSql, -1, &p, 0); - if( rc==SQLITE_OK ){ - sqlite3_bind_text(p, 1, pRtree->zName, -1, SQLITE_STATIC); - if( sqlite3_step(p)==SQLITE_ROW ) nRow = sqlite3_column_int64(p, 0); - rc = sqlite3_finalize(p); - }else if( rc!=SQLITE_NOMEM ){ - rc = SQLITE_OK; - } - - if( rc==SQLITE_OK ){ - if( nRow==0 ){ - pRtree->nRowEst = RTREE_DEFAULT_ROWEST; - }else{ - pRtree->nRowEst = MAX(nRow, RTREE_MIN_ROWEST); - } - } - - return rc; -} - -static sqlite3_module rtreeModule = { - 0, /* iVersion */ - rtreeCreate, /* xCreate - create a table */ - rtreeConnect, /* xConnect - connect to an existing table */ - rtreeBestIndex, /* xBestIndex - Determine search strategy */ - rtreeDisconnect, /* xDisconnect - Disconnect from a table */ - rtreeDestroy, /* xDestroy - Drop a table */ - rtreeOpen, /* xOpen - open a cursor */ - rtreeClose, /* xClose - close a cursor */ - rtreeFilter, /* xFilter - configure scan constraints */ - rtreeNext, /* xNext - advance a cursor */ - rtreeEof, /* xEof */ - rtreeColumn, /* xColumn - read data */ - rtreeRowid, /* xRowid - read data */ - rtreeUpdate, /* xUpdate - write data */ - 0, /* xBegin - begin transaction */ - 0, /* xSync - sync transaction */ - 0, /* xCommit - commit transaction */ - 0, /* xRollback - rollback transaction */ - 0, /* xFindFunction - function overloading */ - rtreeRename, /* xRename - rename the table */ - 0, /* xSavepoint */ - 0, /* xRelease */ - 0 /* xRollbackTo */ -}; - -static int rtreeSqlInit( - Rtree *pRtree, - sqlite3 *db, - const char *zDb, - const char *zPrefix, - int isCreate -){ - int rc = SQLITE_OK; - - #define N_STATEMENT 9 - static const char *azSql[N_STATEMENT] = { - /* Read and write the xxx_node table */ - "SELECT data FROM '%q'.'%q_node' WHERE nodeno = :1", - "INSERT OR REPLACE INTO '%q'.'%q_node' VALUES(:1, :2)", - "DELETE FROM '%q'.'%q_node' WHERE nodeno = :1", - - /* Read and write the xxx_rowid table */ - "SELECT nodeno FROM '%q'.'%q_rowid' WHERE rowid = :1", - "INSERT OR REPLACE INTO '%q'.'%q_rowid' VALUES(:1, :2)", - "DELETE FROM '%q'.'%q_rowid' WHERE rowid = :1", - - /* Read and write the xxx_parent table */ - "SELECT parentnode FROM '%q'.'%q_parent' WHERE nodeno = :1", - "INSERT OR REPLACE INTO '%q'.'%q_parent' VALUES(:1, :2)", - "DELETE FROM '%q'.'%q_parent' WHERE nodeno = :1" - }; - sqlite3_stmt **appStmt[N_STATEMENT]; - int i; - - pRtree->db = db; - - if( isCreate ){ - char *zCreate = sqlite3_mprintf( -"CREATE TABLE \"%w\".\"%w_node\"(nodeno INTEGER PRIMARY KEY, data BLOB);" -"CREATE TABLE \"%w\".\"%w_rowid\"(rowid INTEGER PRIMARY KEY, nodeno INTEGER);" -"CREATE TABLE \"%w\".\"%w_parent\"(nodeno INTEGER PRIMARY KEY, parentnode INTEGER);" -"INSERT INTO '%q'.'%q_node' VALUES(1, zeroblob(%d))", - zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, zDb, zPrefix, pRtree->iNodeSize - ); - if( !zCreate ){ - return SQLITE_NOMEM; - } - rc = sqlite3_exec(db, zCreate, 0, 0, 0); - sqlite3_free(zCreate); - if( rc!=SQLITE_OK ){ - return rc; - } - } - - appStmt[0] = &pRtree->pReadNode; - appStmt[1] = &pRtree->pWriteNode; - appStmt[2] = &pRtree->pDeleteNode; - appStmt[3] = &pRtree->pReadRowid; - appStmt[4] = &pRtree->pWriteRowid; - appStmt[5] = &pRtree->pDeleteRowid; - appStmt[6] = &pRtree->pReadParent; - appStmt[7] = &pRtree->pWriteParent; - appStmt[8] = &pRtree->pDeleteParent; - - rc = rtreeQueryStat1(db, pRtree); - for(i=0; iiNodeSize is populated and SQLITE_OK returned. -** Otherwise, an SQLite error code is returned. -** -** If this function is being called as part of an xConnect(), then the rtree -** table already exists. In this case the node-size is determined by inspecting -** the root node of the tree. -** -** Otherwise, for an xCreate(), use 64 bytes less than the database page-size. -** This ensures that each node is stored on a single database page. If the -** database page-size is so large that more than RTREE_MAXCELLS entries -** would fit in a single node, use a smaller node-size. -*/ -static int getNodeSize( - sqlite3 *db, /* Database handle */ - Rtree *pRtree, /* Rtree handle */ - int isCreate, /* True for xCreate, false for xConnect */ - char **pzErr /* OUT: Error message, if any */ -){ - int rc; - char *zSql; - if( isCreate ){ - int iPageSize = 0; - zSql = sqlite3_mprintf("PRAGMA %Q.page_size", pRtree->zDb); - rc = getIntFromStmt(db, zSql, &iPageSize); - if( rc==SQLITE_OK ){ - pRtree->iNodeSize = iPageSize-64; - if( (4+pRtree->nBytesPerCell*RTREE_MAXCELLS)iNodeSize ){ - pRtree->iNodeSize = 4+pRtree->nBytesPerCell*RTREE_MAXCELLS; - } - }else{ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); - } - }else{ - zSql = sqlite3_mprintf( - "SELECT length(data) FROM '%q'.'%q_node' WHERE nodeno = 1", - pRtree->zDb, pRtree->zName - ); - rc = getIntFromStmt(db, zSql, &pRtree->iNodeSize); - if( rc!=SQLITE_OK ){ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); - } - } - - sqlite3_free(zSql); - return rc; -} - -/* -** This function is the implementation of both the xConnect and xCreate -** methods of the r-tree virtual table. -** -** argv[0] -> module name -** argv[1] -> database name -** argv[2] -> table name -** argv[...] -> column names... -*/ -static int rtreeInit( - sqlite3 *db, /* Database connection */ - void *pAux, /* One of the RTREE_COORD_* constants */ - int argc, const char *const*argv, /* Parameters to CREATE TABLE statement */ - sqlite3_vtab **ppVtab, /* OUT: New virtual table */ - char **pzErr, /* OUT: Error message, if any */ - int isCreate /* True for xCreate, false for xConnect */ -){ - int rc = SQLITE_OK; - Rtree *pRtree; - int nDb; /* Length of string argv[1] */ - int nName; /* Length of string argv[2] */ - int eCoordType = (pAux ? RTREE_COORD_INT32 : RTREE_COORD_REAL32); - - const char *aErrMsg[] = { - 0, /* 0 */ - "Wrong number of columns for an rtree table", /* 1 */ - "Too few columns for an rtree table", /* 2 */ - "Too many columns for an rtree table" /* 3 */ - }; - - int iErr = (argc<6) ? 2 : argc>(RTREE_MAX_DIMENSIONS*2+4) ? 3 : argc%2; - if( aErrMsg[iErr] ){ - *pzErr = sqlite3_mprintf("%s", aErrMsg[iErr]); - return SQLITE_ERROR; - } - - sqlite3_vtab_config(db, SQLITE_VTAB_CONSTRAINT_SUPPORT, 1); - - /* Allocate the sqlite3_vtab structure */ - nDb = (int)strlen(argv[1]); - nName = (int)strlen(argv[2]); - pRtree = (Rtree *)sqlite3_malloc(sizeof(Rtree)+nDb+nName+2); - if( !pRtree ){ - return SQLITE_NOMEM; - } - memset(pRtree, 0, sizeof(Rtree)+nDb+nName+2); - pRtree->nBusy = 1; - pRtree->base.pModule = &rtreeModule; - pRtree->zDb = (char *)&pRtree[1]; - pRtree->zName = &pRtree->zDb[nDb+1]; - pRtree->nDim = (argc-4)/2; - pRtree->nBytesPerCell = 8 + pRtree->nDim*4*2; - pRtree->eCoordType = eCoordType; - memcpy(pRtree->zDb, argv[1], nDb); - memcpy(pRtree->zName, argv[2], nName); - - /* Figure out the node size to use. */ - rc = getNodeSize(db, pRtree, isCreate, pzErr); - - /* Create/Connect to the underlying relational database schema. If - ** that is successful, call sqlite3_declare_vtab() to configure - ** the r-tree table schema. - */ - if( rc==SQLITE_OK ){ - if( (rc = rtreeSqlInit(pRtree, db, argv[1], argv[2], isCreate)) ){ - *pzErr = sqlite3_mprintf("%s", sqlite3_errmsg(db)); - }else{ - char *zSql = sqlite3_mprintf("CREATE TABLE x(%s", argv[3]); - char *zTmp; - int ii; - for(ii=4; zSql && ii*2 coordinates. -*/ -static void rtreenode(sqlite3_context *ctx, int nArg, sqlite3_value **apArg){ - char *zText = 0; - RtreeNode node; - Rtree tree; - int ii; - - UNUSED_PARAMETER(nArg); - memset(&node, 0, sizeof(RtreeNode)); - memset(&tree, 0, sizeof(Rtree)); - tree.nDim = sqlite3_value_int(apArg[0]); - tree.nBytesPerCell = 8 + 8 * tree.nDim; - node.zData = (u8 *)sqlite3_value_blob(apArg[1]); - - for(ii=0; iimagic = RTREE_GEOMETRY_MAGIC; - pBlob->xGeom = pGeomCtx->xGeom; - pBlob->pContext = pGeomCtx->pContext; - pBlob->nParam = nArg; - for(i=0; iaParam[i] = sqlite3_value_int64(aArg[i]); -#else - pBlob->aParam[i] = sqlite3_value_double(aArg[i]); -#endif - } - sqlite3_result_blob(ctx, pBlob, nBlob, doSqlite3Free); - } -} - -/* -** Register a new geometry function for use with the r-tree MATCH operator. -*/ -SQLITE_API int sqlite3_rtree_geometry_callback( - sqlite3 *db, - const char *zGeom, - int (*xGeom)(sqlite3_rtree_geometry *, int, RtreeDValue *, int *), - void *pContext -){ - RtreeGeomCallback *pGeomCtx; /* Context object for new user-function */ - - /* Allocate and populate the context object. */ - pGeomCtx = (RtreeGeomCallback *)sqlite3_malloc(sizeof(RtreeGeomCallback)); - if( !pGeomCtx ) return SQLITE_NOMEM; - pGeomCtx->xGeom = xGeom; - pGeomCtx->pContext = pContext; - - /* Create the new user-function. Register a destructor function to delete - ** the context object when it is no longer required. */ - return sqlite3_create_function_v2(db, zGeom, -1, SQLITE_ANY, - (void *)pGeomCtx, geomCallback, 0, 0, doSqlite3Free - ); -} - -#if !SQLITE_CORE -#ifdef _WIN32 -__declspec(dllexport) -#endif -SQLITE_API int sqlite3_rtree_init( - sqlite3 *db, - char **pzErrMsg, - const sqlite3_api_routines *pApi -){ - SQLITE_EXTENSION_INIT2(pApi) - return sqlite3RtreeInit(db); -} -#endif - -#endif - -/************** End of rtree.c ***********************************************/ -/************** Begin file icu.c *********************************************/ -/* -** 2007 May 6 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** Id: icu.c,v 1.7 2007/12/13 21:54:11 drh Exp -** -** This file implements an integration between the ICU library -** ("International Components for Unicode", an open-source library -** for handling unicode data) and SQLite. The integration uses -** ICU to provide the following to SQLite: -** -** * An implementation of the SQL regexp() function (and hence REGEXP -** operator) using the ICU uregex_XX() APIs. -** -** * Implementations of the SQL scalar upper() and lower() functions -** for case mapping. -** -** * Integration of ICU and SQLite collation sequences. -** -** * An implementation of the LIKE operator that uses ICU to -** provide case-independent matching. -*/ - -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_ICU) - -/* Include ICU headers */ -#include -#include -#include -#include - -/* #include */ - -#ifndef SQLITE_CORE - SQLITE_EXTENSION_INIT1 -#else -#endif - -/* -** Maximum length (in bytes) of the pattern in a LIKE or GLOB -** operator. -*/ -#ifndef SQLITE_MAX_LIKE_PATTERN_LENGTH -# define SQLITE_MAX_LIKE_PATTERN_LENGTH 50000 -#endif - -/* -** Version of sqlite3_free() that is always a function, never a macro. -*/ -static void xFree(void *p){ - sqlite3_free(p); -} - -/* -** Compare two UTF-8 strings for equality where the first string is -** a "LIKE" expression. Return true (1) if they are the same and -** false (0) if they are different. -*/ -static int icuLikeCompare( - const uint8_t *zPattern, /* LIKE pattern */ - const uint8_t *zString, /* The UTF-8 string to compare against */ - const UChar32 uEsc /* The escape character */ -){ - static const int MATCH_ONE = (UChar32)'_'; - static const int MATCH_ALL = (UChar32)'%'; - - int iPattern = 0; /* Current byte index in zPattern */ - int iString = 0; /* Current byte index in zString */ - - int prevEscape = 0; /* True if the previous character was uEsc */ - - while( zPattern[iPattern]!=0 ){ - - /* Read (and consume) the next character from the input pattern. */ - UChar32 uPattern; - U8_NEXT_UNSAFE(zPattern, iPattern, uPattern); - assert(uPattern!=0); - - /* There are now 4 possibilities: - ** - ** 1. uPattern is an unescaped match-all character "%", - ** 2. uPattern is an unescaped match-one character "_", - ** 3. uPattern is an unescaped escape character, or - ** 4. uPattern is to be handled as an ordinary character - */ - if( !prevEscape && uPattern==MATCH_ALL ){ - /* Case 1. */ - uint8_t c; - - /* Skip any MATCH_ALL or MATCH_ONE characters that follow a - ** MATCH_ALL. For each MATCH_ONE, skip one character in the - ** test string. - */ - while( (c=zPattern[iPattern]) == MATCH_ALL || c == MATCH_ONE ){ - if( c==MATCH_ONE ){ - if( zString[iString]==0 ) return 0; - U8_FWD_1_UNSAFE(zString, iString); - } - iPattern++; - } - - if( zPattern[iPattern]==0 ) return 1; - - while( zString[iString] ){ - if( icuLikeCompare(&zPattern[iPattern], &zString[iString], uEsc) ){ - return 1; - } - U8_FWD_1_UNSAFE(zString, iString); - } - return 0; - - }else if( !prevEscape && uPattern==MATCH_ONE ){ - /* Case 2. */ - if( zString[iString]==0 ) return 0; - U8_FWD_1_UNSAFE(zString, iString); - - }else if( !prevEscape && uPattern==uEsc){ - /* Case 3. */ - prevEscape = 1; - - }else{ - /* Case 4. */ - UChar32 uString; - U8_NEXT_UNSAFE(zString, iString, uString); - uString = u_foldCase(uString, U_FOLD_CASE_DEFAULT); - uPattern = u_foldCase(uPattern, U_FOLD_CASE_DEFAULT); - if( uString!=uPattern ){ - return 0; - } - prevEscape = 0; - } - } - - return zString[iString]==0; -} - -/* -** Implementation of the like() SQL function. This function implements -** the build-in LIKE operator. The first argument to the function is the -** pattern and the second argument is the string. So, the SQL statements: -** -** A LIKE B -** -** is implemented as like(B, A). If there is an escape character E, -** -** A LIKE B ESCAPE E -** -** is mapped to like(B, A, E). -*/ -static void icuLikeFunc( - sqlite3_context *context, - int argc, - sqlite3_value **argv -){ - const unsigned char *zA = sqlite3_value_text(argv[0]); - const unsigned char *zB = sqlite3_value_text(argv[1]); - UChar32 uEsc = 0; - - /* Limit the length of the LIKE or GLOB pattern to avoid problems - ** of deep recursion and N*N behavior in patternCompare(). - */ - if( sqlite3_value_bytes(argv[0])>SQLITE_MAX_LIKE_PATTERN_LENGTH ){ - sqlite3_result_error(context, "LIKE or GLOB pattern too complex", -1); - return; - } - - - if( argc==3 ){ - /* The escape character string must consist of a single UTF-8 character. - ** Otherwise, return an error. - */ - int nE= sqlite3_value_bytes(argv[2]); - const unsigned char *zE = sqlite3_value_text(argv[2]); - int i = 0; - if( zE==0 ) return; - U8_NEXT(zE, i, nE, uEsc); - if( i!=nE){ - sqlite3_result_error(context, - "ESCAPE expression must be a single character", -1); - return; - } - } - - if( zA && zB ){ - sqlite3_result_int(context, icuLikeCompare(zA, zB, uEsc)); - } -} - -/* -** This function is called when an ICU function called from within -** the implementation of an SQL scalar function returns an error. -** -** The scalar function context passed as the first argument is -** loaded with an error message based on the following two args. -*/ -static void icuFunctionError( - sqlite3_context *pCtx, /* SQLite scalar function context */ - const char *zName, /* Name of ICU function that failed */ - UErrorCode e /* Error code returned by ICU function */ -){ - char zBuf[128]; - sqlite3_snprintf(128, zBuf, "ICU error: %s(): %s", zName, u_errorName(e)); - zBuf[127] = '\0'; - sqlite3_result_error(pCtx, zBuf, -1); -} - -/* -** Function to delete compiled regexp objects. Registered as -** a destructor function with sqlite3_set_auxdata(). -*/ -static void icuRegexpDelete(void *p){ - URegularExpression *pExpr = (URegularExpression *)p; - uregex_close(pExpr); -} - -/* -** Implementation of SQLite REGEXP operator. This scalar function takes -** two arguments. The first is a regular expression pattern to compile -** the second is a string to match against that pattern. If either -** argument is an SQL NULL, then NULL Is returned. Otherwise, the result -** is 1 if the string matches the pattern, or 0 otherwise. -** -** SQLite maps the regexp() function to the regexp() operator such -** that the following two are equivalent: -** -** zString REGEXP zPattern -** regexp(zPattern, zString) -** -** Uses the following ICU regexp APIs: -** -** uregex_open() -** uregex_matches() -** uregex_close() -*/ -static void icuRegexpFunc(sqlite3_context *p, int nArg, sqlite3_value **apArg){ - UErrorCode status = U_ZERO_ERROR; - URegularExpression *pExpr; - UBool res; - const UChar *zString = sqlite3_value_text16(apArg[1]); - - (void)nArg; /* Unused parameter */ - - /* If the left hand side of the regexp operator is NULL, - ** then the result is also NULL. - */ - if( !zString ){ - return; - } - - pExpr = sqlite3_get_auxdata(p, 0); - if( !pExpr ){ - const UChar *zPattern = sqlite3_value_text16(apArg[0]); - if( !zPattern ){ - return; - } - pExpr = uregex_open(zPattern, -1, 0, 0, &status); - - if( U_SUCCESS(status) ){ - sqlite3_set_auxdata(p, 0, pExpr, icuRegexpDelete); - }else{ - assert(!pExpr); - icuFunctionError(p, "uregex_open", status); - return; - } - } - - /* Configure the text that the regular expression operates on. */ - uregex_setText(pExpr, zString, -1, &status); - if( !U_SUCCESS(status) ){ - icuFunctionError(p, "uregex_setText", status); - return; - } - - /* Attempt the match */ - res = uregex_matches(pExpr, 0, &status); - if( !U_SUCCESS(status) ){ - icuFunctionError(p, "uregex_matches", status); - return; - } - - /* Set the text that the regular expression operates on to a NULL - ** pointer. This is not really necessary, but it is tidier than - ** leaving the regular expression object configured with an invalid - ** pointer after this function returns. - */ - uregex_setText(pExpr, 0, 0, &status); - - /* Return 1 or 0. */ - sqlite3_result_int(p, res ? 1 : 0); -} - -/* -** Implementations of scalar functions for case mapping - upper() and -** lower(). Function upper() converts its input to upper-case (ABC). -** Function lower() converts to lower-case (abc). -** -** ICU provides two types of case mapping, "general" case mapping and -** "language specific". Refer to ICU documentation for the differences -** between the two. -** -** To utilise "general" case mapping, the upper() or lower() scalar -** functions are invoked with one argument: -** -** upper('ABC') -> 'abc' -** lower('abc') -> 'ABC' -** -** To access ICU "language specific" case mapping, upper() or lower() -** should be invoked with two arguments. The second argument is the name -** of the locale to use. Passing an empty string ("") or SQL NULL value -** as the second argument is the same as invoking the 1 argument version -** of upper() or lower(). -** -** lower('I', 'en_us') -> 'i' -** lower('I', 'tr_tr') -> 'ı' (small dotless i) -** -** http://www.icu-project.org/userguide/posix.html#case_mappings -*/ -static void icuCaseFunc16(sqlite3_context *p, int nArg, sqlite3_value **apArg){ - const UChar *zInput; - UChar *zOutput; - int nInput; - int nOutput; - - UErrorCode status = U_ZERO_ERROR; - const char *zLocale = 0; - - assert(nArg==1 || nArg==2); - if( nArg==2 ){ - zLocale = (const char *)sqlite3_value_text(apArg[1]); - } - - zInput = sqlite3_value_text16(apArg[0]); - if( !zInput ){ - return; - } - nInput = sqlite3_value_bytes16(apArg[0]); - - nOutput = nInput * 2 + 2; - zOutput = sqlite3_malloc(nOutput); - if( !zOutput ){ - return; - } - - if( sqlite3_user_data(p) ){ - u_strToUpper(zOutput, nOutput/2, zInput, nInput/2, zLocale, &status); - }else{ - u_strToLower(zOutput, nOutput/2, zInput, nInput/2, zLocale, &status); - } - - if( !U_SUCCESS(status) ){ - icuFunctionError(p, "u_strToLower()/u_strToUpper", status); - return; - } - - sqlite3_result_text16(p, zOutput, -1, xFree); -} - -/* -** Collation sequence destructor function. The pCtx argument points to -** a UCollator structure previously allocated using ucol_open(). -*/ -static void icuCollationDel(void *pCtx){ - UCollator *p = (UCollator *)pCtx; - ucol_close(p); -} - -/* -** Collation sequence comparison function. The pCtx argument points to -** a UCollator structure previously allocated using ucol_open(). -*/ -static int icuCollationColl( - void *pCtx, - int nLeft, - const void *zLeft, - int nRight, - const void *zRight -){ - UCollationResult res; - UCollator *p = (UCollator *)pCtx; - res = ucol_strcoll(p, (UChar *)zLeft, nLeft/2, (UChar *)zRight, nRight/2); - switch( res ){ - case UCOL_LESS: return -1; - case UCOL_GREATER: return +1; - case UCOL_EQUAL: return 0; - } - assert(!"Unexpected return value from ucol_strcoll()"); - return 0; -} - -/* -** Implementation of the scalar function icu_load_collation(). -** -** This scalar function is used to add ICU collation based collation -** types to an SQLite database connection. It is intended to be called -** as follows: -** -** SELECT icu_load_collation(, ); -** -** Where is a string containing an ICU locale identifier (i.e. -** "en_AU", "tr_TR" etc.) and is the name of the -** collation sequence to create. -*/ -static void icuLoadCollation( - sqlite3_context *p, - int nArg, - sqlite3_value **apArg -){ - sqlite3 *db = (sqlite3 *)sqlite3_user_data(p); - UErrorCode status = U_ZERO_ERROR; - const char *zLocale; /* Locale identifier - (eg. "jp_JP") */ - const char *zName; /* SQL Collation sequence name (eg. "japanese") */ - UCollator *pUCollator; /* ICU library collation object */ - int rc; /* Return code from sqlite3_create_collation_x() */ - - assert(nArg==2); - zLocale = (const char *)sqlite3_value_text(apArg[0]); - zName = (const char *)sqlite3_value_text(apArg[1]); - - if( !zLocale || !zName ){ - return; - } - - pUCollator = ucol_open(zLocale, &status); - if( !U_SUCCESS(status) ){ - icuFunctionError(p, "ucol_open", status); - return; - } - assert(p); - - rc = sqlite3_create_collation_v2(db, zName, SQLITE_UTF16, (void *)pUCollator, - icuCollationColl, icuCollationDel - ); - if( rc!=SQLITE_OK ){ - ucol_close(pUCollator); - sqlite3_result_error(p, "Error registering collation function", -1); - } -} - -/* -** Register the ICU extension functions with database db. -*/ -SQLITE_PRIVATE int sqlite3IcuInit(sqlite3 *db){ - struct IcuScalar { - const char *zName; /* Function name */ - int nArg; /* Number of arguments */ - int enc; /* Optimal text encoding */ - void *pContext; /* sqlite3_user_data() context */ - void (*xFunc)(sqlite3_context*,int,sqlite3_value**); - } scalars[] = { - {"regexp", 2, SQLITE_ANY, 0, icuRegexpFunc}, - - {"lower", 1, SQLITE_UTF16, 0, icuCaseFunc16}, - {"lower", 2, SQLITE_UTF16, 0, icuCaseFunc16}, - {"upper", 1, SQLITE_UTF16, (void*)1, icuCaseFunc16}, - {"upper", 2, SQLITE_UTF16, (void*)1, icuCaseFunc16}, - - {"lower", 1, SQLITE_UTF8, 0, icuCaseFunc16}, - {"lower", 2, SQLITE_UTF8, 0, icuCaseFunc16}, - {"upper", 1, SQLITE_UTF8, (void*)1, icuCaseFunc16}, - {"upper", 2, SQLITE_UTF8, (void*)1, icuCaseFunc16}, - - {"like", 2, SQLITE_UTF8, 0, icuLikeFunc}, - {"like", 3, SQLITE_UTF8, 0, icuLikeFunc}, - - {"icu_load_collation", 2, SQLITE_UTF8, (void*)db, icuLoadCollation}, - }; - - int rc = SQLITE_OK; - int i; - - for(i=0; rc==SQLITE_OK && i<(int)(sizeof(scalars)/sizeof(scalars[0])); i++){ - struct IcuScalar *p = &scalars[i]; - rc = sqlite3_create_function( - db, p->zName, p->nArg, p->enc, p->pContext, p->xFunc, 0, 0 - ); - } - - return rc; -} - -#if !SQLITE_CORE -#ifdef _WIN32 -__declspec(dllexport) -#endif -SQLITE_API int sqlite3_icu_init( - sqlite3 *db, - char **pzErrMsg, - const sqlite3_api_routines *pApi -){ - SQLITE_EXTENSION_INIT2(pApi) - return sqlite3IcuInit(db); -} -#endif - -#endif - -/************** End of icu.c *************************************************/ -/************** Begin file fts3_icu.c ****************************************/ -/* -** 2007 June 22 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This file implements a tokenizer for fts3 based on the ICU library. -*/ -#if !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) -#ifdef SQLITE_ENABLE_ICU - -/* #include */ -/* #include */ - -#include -/* #include */ -/* #include */ -#include - -typedef struct IcuTokenizer IcuTokenizer; -typedef struct IcuCursor IcuCursor; - -struct IcuTokenizer { - sqlite3_tokenizer base; - char *zLocale; -}; - -struct IcuCursor { - sqlite3_tokenizer_cursor base; - - UBreakIterator *pIter; /* ICU break-iterator object */ - int nChar; /* Number of UChar elements in pInput */ - UChar *aChar; /* Copy of input using utf-16 encoding */ - int *aOffset; /* Offsets of each character in utf-8 input */ - - int nBuffer; - char *zBuffer; - - int iToken; -}; - -/* -** Create a new tokenizer instance. -*/ -static int icuCreate( - int argc, /* Number of entries in argv[] */ - const char * const *argv, /* Tokenizer creation arguments */ - sqlite3_tokenizer **ppTokenizer /* OUT: Created tokenizer */ -){ - IcuTokenizer *p; - int n = 0; - - if( argc>0 ){ - n = strlen(argv[0])+1; - } - p = (IcuTokenizer *)sqlite3_malloc(sizeof(IcuTokenizer)+n); - if( !p ){ - return SQLITE_NOMEM; - } - memset(p, 0, sizeof(IcuTokenizer)); - - if( n ){ - p->zLocale = (char *)&p[1]; - memcpy(p->zLocale, argv[0], n); - } - - *ppTokenizer = (sqlite3_tokenizer *)p; - - return SQLITE_OK; -} - -/* -** Destroy a tokenizer -*/ -static int icuDestroy(sqlite3_tokenizer *pTokenizer){ - IcuTokenizer *p = (IcuTokenizer *)pTokenizer; - sqlite3_free(p); - return SQLITE_OK; -} - -/* -** Prepare to begin tokenizing a particular string. The input -** string to be tokenized is pInput[0..nBytes-1]. A cursor -** used to incrementally tokenize this string is returned in -** *ppCursor. -*/ -static int icuOpen( - sqlite3_tokenizer *pTokenizer, /* The tokenizer */ - const char *zInput, /* Input string */ - int nInput, /* Length of zInput in bytes */ - sqlite3_tokenizer_cursor **ppCursor /* OUT: Tokenization cursor */ -){ - IcuTokenizer *p = (IcuTokenizer *)pTokenizer; - IcuCursor *pCsr; - - const int32_t opt = U_FOLD_CASE_DEFAULT; - UErrorCode status = U_ZERO_ERROR; - int nChar; - - UChar32 c; - int iInput = 0; - int iOut = 0; - - *ppCursor = 0; - - if( zInput==0 ){ - nInput = 0; - zInput = ""; - }else if( nInput<0 ){ - nInput = strlen(zInput); - } - nChar = nInput+1; - pCsr = (IcuCursor *)sqlite3_malloc( - sizeof(IcuCursor) + /* IcuCursor */ - ((nChar+3)&~3) * sizeof(UChar) + /* IcuCursor.aChar[] */ - (nChar+1) * sizeof(int) /* IcuCursor.aOffset[] */ - ); - if( !pCsr ){ - return SQLITE_NOMEM; - } - memset(pCsr, 0, sizeof(IcuCursor)); - pCsr->aChar = (UChar *)&pCsr[1]; - pCsr->aOffset = (int *)&pCsr->aChar[(nChar+3)&~3]; - - pCsr->aOffset[iOut] = iInput; - U8_NEXT(zInput, iInput, nInput, c); - while( c>0 ){ - int isError = 0; - c = u_foldCase(c, opt); - U16_APPEND(pCsr->aChar, iOut, nChar, c, isError); - if( isError ){ - sqlite3_free(pCsr); - return SQLITE_ERROR; - } - pCsr->aOffset[iOut] = iInput; - - if( iInputpIter = ubrk_open(UBRK_WORD, p->zLocale, pCsr->aChar, iOut, &status); - if( !U_SUCCESS(status) ){ - sqlite3_free(pCsr); - return SQLITE_ERROR; - } - pCsr->nChar = iOut; - - ubrk_first(pCsr->pIter); - *ppCursor = (sqlite3_tokenizer_cursor *)pCsr; - return SQLITE_OK; -} - -/* -** Close a tokenization cursor previously opened by a call to icuOpen(). -*/ -static int icuClose(sqlite3_tokenizer_cursor *pCursor){ - IcuCursor *pCsr = (IcuCursor *)pCursor; - ubrk_close(pCsr->pIter); - sqlite3_free(pCsr->zBuffer); - sqlite3_free(pCsr); - return SQLITE_OK; -} - -/* -** Extract the next token from a tokenization cursor. -*/ -static int icuNext( - sqlite3_tokenizer_cursor *pCursor, /* Cursor returned by simpleOpen */ - const char **ppToken, /* OUT: *ppToken is the token text */ - int *pnBytes, /* OUT: Number of bytes in token */ - int *piStartOffset, /* OUT: Starting offset of token */ - int *piEndOffset, /* OUT: Ending offset of token */ - int *piPosition /* OUT: Position integer of token */ -){ - IcuCursor *pCsr = (IcuCursor *)pCursor; - - int iStart = 0; - int iEnd = 0; - int nByte = 0; - - while( iStart==iEnd ){ - UChar32 c; - - iStart = ubrk_current(pCsr->pIter); - iEnd = ubrk_next(pCsr->pIter); - if( iEnd==UBRK_DONE ){ - return SQLITE_DONE; - } - - while( iStartaChar, iWhite, pCsr->nChar, c); - if( u_isspace(c) ){ - iStart = iWhite; - }else{ - break; - } - } - assert(iStart<=iEnd); - } - - do { - UErrorCode status = U_ZERO_ERROR; - if( nByte ){ - char *zNew = sqlite3_realloc(pCsr->zBuffer, nByte); - if( !zNew ){ - return SQLITE_NOMEM; - } - pCsr->zBuffer = zNew; - pCsr->nBuffer = nByte; - } - - u_strToUTF8( - pCsr->zBuffer, pCsr->nBuffer, &nByte, /* Output vars */ - &pCsr->aChar[iStart], iEnd-iStart, /* Input vars */ - &status /* Output success/failure */ - ); - } while( nByte>pCsr->nBuffer ); - - *ppToken = pCsr->zBuffer; - *pnBytes = nByte; - *piStartOffset = pCsr->aOffset[iStart]; - *piEndOffset = pCsr->aOffset[iEnd]; - *piPosition = pCsr->iToken++; - - return SQLITE_OK; -} - -/* -** The set of routines that implement the simple tokenizer -*/ -static const sqlite3_tokenizer_module icuTokenizerModule = { - 0, /* iVersion */ - icuCreate, /* xCreate */ - icuDestroy, /* xCreate */ - icuOpen, /* xOpen */ - icuClose, /* xClose */ - icuNext, /* xNext */ -}; - -/* -** Set *ppModule to point at the implementation of the ICU tokenizer. -*/ -SQLITE_PRIVATE void sqlite3Fts3IcuTokenizerModule( - sqlite3_tokenizer_module const**ppModule -){ - *ppModule = &icuTokenizerModule; -} - -#endif /* defined(SQLITE_ENABLE_ICU) */ -#endif /* !defined(SQLITE_CORE) || defined(SQLITE_ENABLE_FTS3) */ - -/************** End of fts3_icu.c ********************************************/ diff --git a/external/public-domain/sqlite/dist/sqlite3.h b/external/public-domain/sqlite/dist/sqlite3.h deleted file mode 100644 index 6cf5977b1..000000000 --- a/external/public-domain/sqlite/dist/sqlite3.h +++ /dev/null @@ -1,7385 +0,0 @@ -/* -** 2001 September 15 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the interface that the SQLite library -** presents to client programs. If a C-function, structure, datatype, -** or constant definition does not appear in this file, then it is -** not a published API of SQLite, is subject to change without -** notice, and should not be referenced by programs that use SQLite. -** -** Some of the definitions that are in this file are marked as -** "experimental". Experimental interfaces are normally new -** features recently added to SQLite. We do not anticipate changes -** to experimental interfaces but reserve the right to make minor changes -** if experience from use "in the wild" suggest such changes are prudent. -** -** The official C-language API documentation for SQLite is derived -** from comments in this file. This file is the authoritative source -** on how SQLite interfaces are suppose to operate. -** -** The name of this file under configuration management is "sqlite.h.in". -** The makefile makes some minor changes to this file (such as inserting -** the version number) and changes its name to "sqlite3.h" as -** part of the build process. -*/ -#ifndef _SQLITE3_H_ -#define _SQLITE3_H_ -#include /* Needed for the definition of va_list */ - -/* -** Make sure we can call this stuff from C++. -*/ -#ifdef __cplusplus -extern "C" { -#endif - - -/* -** Add the ability to override 'extern' -*/ -#ifndef SQLITE_EXTERN -# define SQLITE_EXTERN extern -#endif - -#ifndef SQLITE_API -# define SQLITE_API -#endif - - -/* -** These no-op macros are used in front of interfaces to mark those -** interfaces as either deprecated or experimental. New applications -** should not use deprecated interfaces - they are support for backwards -** compatibility only. Application writers should be aware that -** experimental interfaces are subject to change in point releases. -** -** These macros used to resolve to various kinds of compiler magic that -** would generate warning messages when they were used. But that -** compiler magic ended up generating such a flurry of bug reports -** that we have taken it all out and gone back to using simple -** noop macros. -*/ -#define SQLITE_DEPRECATED -#define SQLITE_EXPERIMENTAL - -/* -** Ensure these symbols were not defined by some previous header file. -*/ -#ifdef SQLITE_VERSION -# undef SQLITE_VERSION -#endif -#ifdef SQLITE_VERSION_NUMBER -# undef SQLITE_VERSION_NUMBER -#endif - -/* -** CAPI3REF: Compile-Time Library Version Numbers -** -** ^(The [SQLITE_VERSION] C preprocessor macro in the sqlite3.h header -** evaluates to a string literal that is the SQLite version in the -** format "X.Y.Z" where X is the major version number (always 3 for -** SQLite3) and Y is the minor version number and Z is the release number.)^ -** ^(The [SQLITE_VERSION_NUMBER] C preprocessor macro resolves to an integer -** with the value (X*1000000 + Y*1000 + Z) where X, Y, and Z are the same -** numbers used in [SQLITE_VERSION].)^ -** The SQLITE_VERSION_NUMBER for any given release of SQLite will also -** be larger than the release from which it is derived. Either Y will -** be held constant and Z will be incremented or else Y will be incremented -** and Z will be reset to zero. -** -** Since version 3.6.18, SQLite source code has been stored in the -** Fossil configuration management -** system. ^The SQLITE_SOURCE_ID macro evaluates to -** a string which identifies a particular check-in of SQLite -** within its configuration management system. ^The SQLITE_SOURCE_ID -** string contains the date and time of the check-in (UTC) and an SHA1 -** hash of the entire source tree. -** -** See also: [sqlite3_libversion()], -** [sqlite3_libversion_number()], [sqlite3_sourceid()], -** [sqlite_version()] and [sqlite_source_id()]. -*/ -#define SQLITE_VERSION "3.8.3.1" -#define SQLITE_VERSION_NUMBER 3008003 -#define SQLITE_SOURCE_ID "2014-02-11 14:52:19 ea3317a4803d71d88183b29f1d3086f46d68a00e" - -/* -** CAPI3REF: Run-Time Library Version Numbers -** KEYWORDS: sqlite3_version, sqlite3_sourceid -** -** These interfaces provide the same information as the [SQLITE_VERSION], -** [SQLITE_VERSION_NUMBER], and [SQLITE_SOURCE_ID] C preprocessor macros -** but are associated with the library instead of the header file. ^(Cautious -** programmers might include assert() statements in their application to -** verify that values returned by these interfaces match the macros in -** the header, and thus insure that the application is -** compiled with matching library and header files. -** -**
    -** assert( sqlite3_libversion_number()==SQLITE_VERSION_NUMBER );
    -** assert( strcmp(sqlite3_sourceid(),SQLITE_SOURCE_ID)==0 );
    -** assert( strcmp(sqlite3_libversion(),SQLITE_VERSION)==0 );
    -** 
    )^ -** -** ^The sqlite3_version[] string constant contains the text of [SQLITE_VERSION] -** macro. ^The sqlite3_libversion() function returns a pointer to the -** to the sqlite3_version[] string constant. The sqlite3_libversion() -** function is provided for use in DLLs since DLL users usually do not have -** direct access to string constants within the DLL. ^The -** sqlite3_libversion_number() function returns an integer equal to -** [SQLITE_VERSION_NUMBER]. ^The sqlite3_sourceid() function returns -** a pointer to a string constant whose value is the same as the -** [SQLITE_SOURCE_ID] C preprocessor macro. -** -** See also: [sqlite_version()] and [sqlite_source_id()]. -*/ -SQLITE_API SQLITE_EXTERN const char sqlite3_version[]; -SQLITE_API const char *sqlite3_libversion(void); -SQLITE_API const char *sqlite3_sourceid(void); -SQLITE_API int sqlite3_libversion_number(void); - -/* -** CAPI3REF: Run-Time Library Compilation Options Diagnostics -** -** ^The sqlite3_compileoption_used() function returns 0 or 1 -** indicating whether the specified option was defined at -** compile time. ^The SQLITE_ prefix may be omitted from the -** option name passed to sqlite3_compileoption_used(). -** -** ^The sqlite3_compileoption_get() function allows iterating -** over the list of options that were defined at compile time by -** returning the N-th compile time option string. ^If N is out of range, -** sqlite3_compileoption_get() returns a NULL pointer. ^The SQLITE_ -** prefix is omitted from any strings returned by -** sqlite3_compileoption_get(). -** -** ^Support for the diagnostic functions sqlite3_compileoption_used() -** and sqlite3_compileoption_get() may be omitted by specifying the -** [SQLITE_OMIT_COMPILEOPTION_DIAGS] option at compile time. -** -** See also: SQL functions [sqlite_compileoption_used()] and -** [sqlite_compileoption_get()] and the [compile_options pragma]. -*/ -#ifndef SQLITE_OMIT_COMPILEOPTION_DIAGS -SQLITE_API int sqlite3_compileoption_used(const char *zOptName); -SQLITE_API const char *sqlite3_compileoption_get(int N); -#endif - -/* -** CAPI3REF: Test To See If The Library Is Threadsafe -** -** ^The sqlite3_threadsafe() function returns zero if and only if -** SQLite was compiled with mutexing code omitted due to the -** [SQLITE_THREADSAFE] compile-time option being set to 0. -** -** SQLite can be compiled with or without mutexes. When -** the [SQLITE_THREADSAFE] C preprocessor macro is 1 or 2, mutexes -** are enabled and SQLite is threadsafe. When the -** [SQLITE_THREADSAFE] macro is 0, -** the mutexes are omitted. Without the mutexes, it is not safe -** to use SQLite concurrently from more than one thread. -** -** Enabling mutexes incurs a measurable performance penalty. -** So if speed is of utmost importance, it makes sense to disable -** the mutexes. But for maximum safety, mutexes should be enabled. -** ^The default behavior is for mutexes to be enabled. -** -** This interface can be used by an application to make sure that the -** version of SQLite that it is linking against was compiled with -** the desired setting of the [SQLITE_THREADSAFE] macro. -** -** This interface only reports on the compile-time mutex setting -** of the [SQLITE_THREADSAFE] flag. If SQLite is compiled with -** SQLITE_THREADSAFE=1 or =2 then mutexes are enabled by default but -** can be fully or partially disabled using a call to [sqlite3_config()] -** with the verbs [SQLITE_CONFIG_SINGLETHREAD], [SQLITE_CONFIG_MULTITHREAD], -** or [SQLITE_CONFIG_MUTEX]. ^(The return value of the -** sqlite3_threadsafe() function shows only the compile-time setting of -** thread safety, not any run-time changes to that setting made by -** sqlite3_config(). In other words, the return value from sqlite3_threadsafe() -** is unchanged by calls to sqlite3_config().)^ -** -** See the [threading mode] documentation for additional information. -*/ -SQLITE_API int sqlite3_threadsafe(void); - -/* -** CAPI3REF: Database Connection Handle -** KEYWORDS: {database connection} {database connections} -** -** Each open SQLite database is represented by a pointer to an instance of -** the opaque structure named "sqlite3". It is useful to think of an sqlite3 -** pointer as an object. The [sqlite3_open()], [sqlite3_open16()], and -** [sqlite3_open_v2()] interfaces are its constructors, and [sqlite3_close()] -** and [sqlite3_close_v2()] are its destructors. There are many other -** interfaces (such as -** [sqlite3_prepare_v2()], [sqlite3_create_function()], and -** [sqlite3_busy_timeout()] to name but three) that are methods on an -** sqlite3 object. -*/ -typedef struct sqlite3 sqlite3; - -/* -** CAPI3REF: 64-Bit Integer Types -** KEYWORDS: sqlite_int64 sqlite_uint64 -** -** Because there is no cross-platform way to specify 64-bit integer types -** SQLite includes typedefs for 64-bit signed and unsigned integers. -** -** The sqlite3_int64 and sqlite3_uint64 are the preferred type definitions. -** The sqlite_int64 and sqlite_uint64 types are supported for backwards -** compatibility only. -** -** ^The sqlite3_int64 and sqlite_int64 types can store integer values -** between -9223372036854775808 and +9223372036854775807 inclusive. ^The -** sqlite3_uint64 and sqlite_uint64 types can store integer values -** between 0 and +18446744073709551615 inclusive. -*/ -#ifdef SQLITE_INT64_TYPE - typedef SQLITE_INT64_TYPE sqlite_int64; - typedef unsigned SQLITE_INT64_TYPE sqlite_uint64; -#elif defined(_MSC_VER) || defined(__BORLANDC__) - typedef __int64 sqlite_int64; - typedef unsigned __int64 sqlite_uint64; -#else - typedef long long int sqlite_int64; - typedef unsigned long long int sqlite_uint64; -#endif -typedef sqlite_int64 sqlite3_int64; -typedef sqlite_uint64 sqlite3_uint64; - -/* -** If compiling for a processor that lacks floating point support, -** substitute integer for floating-point. -*/ -#ifdef SQLITE_OMIT_FLOATING_POINT -# define double sqlite3_int64 -#endif - -/* -** CAPI3REF: Closing A Database Connection -** -** ^The sqlite3_close() and sqlite3_close_v2() routines are destructors -** for the [sqlite3] object. -** ^Calls to sqlite3_close() and sqlite3_close_v2() return SQLITE_OK if -** the [sqlite3] object is successfully destroyed and all associated -** resources are deallocated. -** -** ^If the database connection is associated with unfinalized prepared -** statements or unfinished sqlite3_backup objects then sqlite3_close() -** will leave the database connection open and return [SQLITE_BUSY]. -** ^If sqlite3_close_v2() is called with unfinalized prepared statements -** and unfinished sqlite3_backups, then the database connection becomes -** an unusable "zombie" which will automatically be deallocated when the -** last prepared statement is finalized or the last sqlite3_backup is -** finished. The sqlite3_close_v2() interface is intended for use with -** host languages that are garbage collected, and where the order in which -** destructors are called is arbitrary. -** -** Applications should [sqlite3_finalize | finalize] all [prepared statements], -** [sqlite3_blob_close | close] all [BLOB handles], and -** [sqlite3_backup_finish | finish] all [sqlite3_backup] objects associated -** with the [sqlite3] object prior to attempting to close the object. ^If -** sqlite3_close_v2() is called on a [database connection] that still has -** outstanding [prepared statements], [BLOB handles], and/or -** [sqlite3_backup] objects then it returns SQLITE_OK but the deallocation -** of resources is deferred until all [prepared statements], [BLOB handles], -** and [sqlite3_backup] objects are also destroyed. -** -** ^If an [sqlite3] object is destroyed while a transaction is open, -** the transaction is automatically rolled back. -** -** The C parameter to [sqlite3_close(C)] and [sqlite3_close_v2(C)] -** must be either a NULL -** pointer or an [sqlite3] object pointer obtained -** from [sqlite3_open()], [sqlite3_open16()], or -** [sqlite3_open_v2()], and not previously closed. -** ^Calling sqlite3_close() or sqlite3_close_v2() with a NULL pointer -** argument is a harmless no-op. -*/ -SQLITE_API int sqlite3_close(sqlite3*); -SQLITE_API int sqlite3_close_v2(sqlite3*); - -/* -** The type for a callback function. -** This is legacy and deprecated. It is included for historical -** compatibility and is not documented. -*/ -typedef int (*sqlite3_callback)(void*,int,char**, char**); - -/* -** CAPI3REF: One-Step Query Execution Interface -** -** The sqlite3_exec() interface is a convenience wrapper around -** [sqlite3_prepare_v2()], [sqlite3_step()], and [sqlite3_finalize()], -** that allows an application to run multiple statements of SQL -** without having to use a lot of C code. -** -** ^The sqlite3_exec() interface runs zero or more UTF-8 encoded, -** semicolon-separate SQL statements passed into its 2nd argument, -** in the context of the [database connection] passed in as its 1st -** argument. ^If the callback function of the 3rd argument to -** sqlite3_exec() is not NULL, then it is invoked for each result row -** coming out of the evaluated SQL statements. ^The 4th argument to -** sqlite3_exec() is relayed through to the 1st argument of each -** callback invocation. ^If the callback pointer to sqlite3_exec() -** is NULL, then no callback is ever invoked and result rows are -** ignored. -** -** ^If an error occurs while evaluating the SQL statements passed into -** sqlite3_exec(), then execution of the current statement stops and -** subsequent statements are skipped. ^If the 5th parameter to sqlite3_exec() -** is not NULL then any error message is written into memory obtained -** from [sqlite3_malloc()] and passed back through the 5th parameter. -** To avoid memory leaks, the application should invoke [sqlite3_free()] -** on error message strings returned through the 5th parameter of -** of sqlite3_exec() after the error message string is no longer needed. -** ^If the 5th parameter to sqlite3_exec() is not NULL and no errors -** occur, then sqlite3_exec() sets the pointer in its 5th parameter to -** NULL before returning. -** -** ^If an sqlite3_exec() callback returns non-zero, the sqlite3_exec() -** routine returns SQLITE_ABORT without invoking the callback again and -** without running any subsequent SQL statements. -** -** ^The 2nd argument to the sqlite3_exec() callback function is the -** number of columns in the result. ^The 3rd argument to the sqlite3_exec() -** callback is an array of pointers to strings obtained as if from -** [sqlite3_column_text()], one for each column. ^If an element of a -** result row is NULL then the corresponding string pointer for the -** sqlite3_exec() callback is a NULL pointer. ^The 4th argument to the -** sqlite3_exec() callback is an array of pointers to strings where each -** entry represents the name of corresponding result column as obtained -** from [sqlite3_column_name()]. -** -** ^If the 2nd parameter to sqlite3_exec() is a NULL pointer, a pointer -** to an empty string, or a pointer that contains only whitespace and/or -** SQL comments, then no SQL statements are evaluated and the database -** is not changed. -** -** Restrictions: -** -**
      -**
    • The application must insure that the 1st parameter to sqlite3_exec() -** is a valid and open [database connection]. -**
    • The application must not close the [database connection] specified by -** the 1st parameter to sqlite3_exec() while sqlite3_exec() is running. -**
    • The application must not modify the SQL statement text passed into -** the 2nd parameter of sqlite3_exec() while sqlite3_exec() is running. -**
    -*/ -SQLITE_API int sqlite3_exec( - sqlite3*, /* An open database */ - const char *sql, /* SQL to be evaluated */ - int (*callback)(void*,int,char**,char**), /* Callback function */ - void *, /* 1st argument to callback */ - char **errmsg /* Error msg written here */ -); - -/* -** CAPI3REF: Result Codes -** KEYWORDS: SQLITE_OK {error code} {error codes} -** KEYWORDS: {result code} {result codes} -** -** Many SQLite functions return an integer result code from the set shown -** here in order to indicate success or failure. -** -** New error codes may be added in future versions of SQLite. -** -** See also: [SQLITE_IOERR_READ | extended result codes], -** [sqlite3_vtab_on_conflict()] [SQLITE_ROLLBACK | result codes]. -*/ -#define SQLITE_OK 0 /* Successful result */ -/* beginning-of-error-codes */ -#define SQLITE_ERROR 1 /* SQL error or missing database */ -#define SQLITE_INTERNAL 2 /* Internal logic error in SQLite */ -#define SQLITE_PERM 3 /* Access permission denied */ -#define SQLITE_ABORT 4 /* Callback routine requested an abort */ -#define SQLITE_BUSY 5 /* The database file is locked */ -#define SQLITE_LOCKED 6 /* A table in the database is locked */ -#define SQLITE_NOMEM 7 /* A malloc() failed */ -#define SQLITE_READONLY 8 /* Attempt to write a readonly database */ -#define SQLITE_INTERRUPT 9 /* Operation terminated by sqlite3_interrupt()*/ -#define SQLITE_IOERR 10 /* Some kind of disk I/O error occurred */ -#define SQLITE_CORRUPT 11 /* The database disk image is malformed */ -#define SQLITE_NOTFOUND 12 /* Unknown opcode in sqlite3_file_control() */ -#define SQLITE_FULL 13 /* Insertion failed because database is full */ -#define SQLITE_CANTOPEN 14 /* Unable to open the database file */ -#define SQLITE_PROTOCOL 15 /* Database lock protocol error */ -#define SQLITE_EMPTY 16 /* Database is empty */ -#define SQLITE_SCHEMA 17 /* The database schema changed */ -#define SQLITE_TOOBIG 18 /* String or BLOB exceeds size limit */ -#define SQLITE_CONSTRAINT 19 /* Abort due to constraint violation */ -#define SQLITE_MISMATCH 20 /* Data type mismatch */ -#define SQLITE_MISUSE 21 /* Library used incorrectly */ -#define SQLITE_NOLFS 22 /* Uses OS features not supported on host */ -#define SQLITE_AUTH 23 /* Authorization denied */ -#define SQLITE_FORMAT 24 /* Auxiliary database format error */ -#define SQLITE_RANGE 25 /* 2nd parameter to sqlite3_bind out of range */ -#define SQLITE_NOTADB 26 /* File opened that is not a database file */ -#define SQLITE_NOTICE 27 /* Notifications from sqlite3_log() */ -#define SQLITE_WARNING 28 /* Warnings from sqlite3_log() */ -#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */ -#define SQLITE_DONE 101 /* sqlite3_step() has finished executing */ -/* end-of-error-codes */ - -/* -** CAPI3REF: Extended Result Codes -** KEYWORDS: {extended error code} {extended error codes} -** KEYWORDS: {extended result code} {extended result codes} -** -** In its default configuration, SQLite API routines return one of 26 integer -** [SQLITE_OK | result codes]. However, experience has shown that many of -** these result codes are too coarse-grained. They do not provide as -** much information about problems as programmers might like. In an effort to -** address this, newer versions of SQLite (version 3.3.8 and later) include -** support for additional result codes that provide more detailed information -** about errors. The extended result codes are enabled or disabled -** on a per database connection basis using the -** [sqlite3_extended_result_codes()] API. -** -** Some of the available extended result codes are listed here. -** One may expect the number of extended result codes will increase -** over time. Software that uses extended result codes should expect -** to see new result codes in future releases of SQLite. -** -** The SQLITE_OK result code will never be extended. It will always -** be exactly zero. -*/ -#define SQLITE_IOERR_READ (SQLITE_IOERR | (1<<8)) -#define SQLITE_IOERR_SHORT_READ (SQLITE_IOERR | (2<<8)) -#define SQLITE_IOERR_WRITE (SQLITE_IOERR | (3<<8)) -#define SQLITE_IOERR_FSYNC (SQLITE_IOERR | (4<<8)) -#define SQLITE_IOERR_DIR_FSYNC (SQLITE_IOERR | (5<<8)) -#define SQLITE_IOERR_TRUNCATE (SQLITE_IOERR | (6<<8)) -#define SQLITE_IOERR_FSTAT (SQLITE_IOERR | (7<<8)) -#define SQLITE_IOERR_UNLOCK (SQLITE_IOERR | (8<<8)) -#define SQLITE_IOERR_RDLOCK (SQLITE_IOERR | (9<<8)) -#define SQLITE_IOERR_DELETE (SQLITE_IOERR | (10<<8)) -#define SQLITE_IOERR_BLOCKED (SQLITE_IOERR | (11<<8)) -#define SQLITE_IOERR_NOMEM (SQLITE_IOERR | (12<<8)) -#define SQLITE_IOERR_ACCESS (SQLITE_IOERR | (13<<8)) -#define SQLITE_IOERR_CHECKRESERVEDLOCK (SQLITE_IOERR | (14<<8)) -#define SQLITE_IOERR_LOCK (SQLITE_IOERR | (15<<8)) -#define SQLITE_IOERR_CLOSE (SQLITE_IOERR | (16<<8)) -#define SQLITE_IOERR_DIR_CLOSE (SQLITE_IOERR | (17<<8)) -#define SQLITE_IOERR_SHMOPEN (SQLITE_IOERR | (18<<8)) -#define SQLITE_IOERR_SHMSIZE (SQLITE_IOERR | (19<<8)) -#define SQLITE_IOERR_SHMLOCK (SQLITE_IOERR | (20<<8)) -#define SQLITE_IOERR_SHMMAP (SQLITE_IOERR | (21<<8)) -#define SQLITE_IOERR_SEEK (SQLITE_IOERR | (22<<8)) -#define SQLITE_IOERR_DELETE_NOENT (SQLITE_IOERR | (23<<8)) -#define SQLITE_IOERR_MMAP (SQLITE_IOERR | (24<<8)) -#define SQLITE_IOERR_GETTEMPPATH (SQLITE_IOERR | (25<<8)) -#define SQLITE_IOERR_CONVPATH (SQLITE_IOERR | (26<<8)) -#define SQLITE_LOCKED_SHAREDCACHE (SQLITE_LOCKED | (1<<8)) -#define SQLITE_BUSY_RECOVERY (SQLITE_BUSY | (1<<8)) -#define SQLITE_BUSY_SNAPSHOT (SQLITE_BUSY | (2<<8)) -#define SQLITE_CANTOPEN_NOTEMPDIR (SQLITE_CANTOPEN | (1<<8)) -#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) -#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) -#define SQLITE_CANTOPEN_CONVPATH (SQLITE_CANTOPEN | (4<<8)) -#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) -#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) -#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) -#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) -#define SQLITE_READONLY_DBMOVED (SQLITE_READONLY | (4<<8)) -#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) -#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) -#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) -#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) -#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) -#define SQLITE_CONSTRAINT_NOTNULL (SQLITE_CONSTRAINT | (5<<8)) -#define SQLITE_CONSTRAINT_PRIMARYKEY (SQLITE_CONSTRAINT | (6<<8)) -#define SQLITE_CONSTRAINT_TRIGGER (SQLITE_CONSTRAINT | (7<<8)) -#define SQLITE_CONSTRAINT_UNIQUE (SQLITE_CONSTRAINT | (8<<8)) -#define SQLITE_CONSTRAINT_VTAB (SQLITE_CONSTRAINT | (9<<8)) -#define SQLITE_CONSTRAINT_ROWID (SQLITE_CONSTRAINT |(10<<8)) -#define SQLITE_NOTICE_RECOVER_WAL (SQLITE_NOTICE | (1<<8)) -#define SQLITE_NOTICE_RECOVER_ROLLBACK (SQLITE_NOTICE | (2<<8)) -#define SQLITE_WARNING_AUTOINDEX (SQLITE_WARNING | (1<<8)) - -/* -** CAPI3REF: Flags For File Open Operations -** -** These bit values are intended for use in the -** 3rd parameter to the [sqlite3_open_v2()] interface and -** in the 4th parameter to the [sqlite3_vfs.xOpen] method. -*/ -#define SQLITE_OPEN_READONLY 0x00000001 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_READWRITE 0x00000002 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_CREATE 0x00000004 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_DELETEONCLOSE 0x00000008 /* VFS only */ -#define SQLITE_OPEN_EXCLUSIVE 0x00000010 /* VFS only */ -#define SQLITE_OPEN_AUTOPROXY 0x00000020 /* VFS only */ -#define SQLITE_OPEN_URI 0x00000040 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_MEMORY 0x00000080 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_MAIN_DB 0x00000100 /* VFS only */ -#define SQLITE_OPEN_TEMP_DB 0x00000200 /* VFS only */ -#define SQLITE_OPEN_TRANSIENT_DB 0x00000400 /* VFS only */ -#define SQLITE_OPEN_MAIN_JOURNAL 0x00000800 /* VFS only */ -#define SQLITE_OPEN_TEMP_JOURNAL 0x00001000 /* VFS only */ -#define SQLITE_OPEN_SUBJOURNAL 0x00002000 /* VFS only */ -#define SQLITE_OPEN_MASTER_JOURNAL 0x00004000 /* VFS only */ -#define SQLITE_OPEN_NOMUTEX 0x00008000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_FULLMUTEX 0x00010000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_SHAREDCACHE 0x00020000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_PRIVATECACHE 0x00040000 /* Ok for sqlite3_open_v2() */ -#define SQLITE_OPEN_WAL 0x00080000 /* VFS only */ - -/* Reserved: 0x00F00000 */ - -/* -** CAPI3REF: Device Characteristics -** -** The xDeviceCharacteristics method of the [sqlite3_io_methods] -** object returns an integer which is a vector of these -** bit values expressing I/O characteristics of the mass storage -** device that holds the file that the [sqlite3_io_methods] -** refers to. -** -** The SQLITE_IOCAP_ATOMIC property means that all writes of -** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values -** mean that writes of blocks that are nnn bytes in size and -** are aligned to an address which is an integer multiple of -** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means -** that when data is appended to a file, the data is appended -** first then the size of the file is extended, never the other -** way around. The SQLITE_IOCAP_SEQUENTIAL property means that -** information is written to disk in the same order as calls -** to xWrite(). The SQLITE_IOCAP_POWERSAFE_OVERWRITE property means that -** after reboot following a crash or power loss, the only bytes in a -** file that were written at the application level might have changed -** and that adjacent bytes, even bytes within the same sector are -** guaranteed to be unchanged. The SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN -** flag indicate that a file cannot be deleted when open. -*/ -#define SQLITE_IOCAP_ATOMIC 0x00000001 -#define SQLITE_IOCAP_ATOMIC512 0x00000002 -#define SQLITE_IOCAP_ATOMIC1K 0x00000004 -#define SQLITE_IOCAP_ATOMIC2K 0x00000008 -#define SQLITE_IOCAP_ATOMIC4K 0x00000010 -#define SQLITE_IOCAP_ATOMIC8K 0x00000020 -#define SQLITE_IOCAP_ATOMIC16K 0x00000040 -#define SQLITE_IOCAP_ATOMIC32K 0x00000080 -#define SQLITE_IOCAP_ATOMIC64K 0x00000100 -#define SQLITE_IOCAP_SAFE_APPEND 0x00000200 -#define SQLITE_IOCAP_SEQUENTIAL 0x00000400 -#define SQLITE_IOCAP_UNDELETABLE_WHEN_OPEN 0x00000800 -#define SQLITE_IOCAP_POWERSAFE_OVERWRITE 0x00001000 - -/* -** CAPI3REF: File Locking Levels -** -** SQLite uses one of these integer values as the second -** argument to calls it makes to the xLock() and xUnlock() methods -** of an [sqlite3_io_methods] object. -*/ -#define SQLITE_LOCK_NONE 0 -#define SQLITE_LOCK_SHARED 1 -#define SQLITE_LOCK_RESERVED 2 -#define SQLITE_LOCK_PENDING 3 -#define SQLITE_LOCK_EXCLUSIVE 4 - -/* -** CAPI3REF: Synchronization Type Flags -** -** When SQLite invokes the xSync() method of an -** [sqlite3_io_methods] object it uses a combination of -** these integer values as the second argument. -** -** When the SQLITE_SYNC_DATAONLY flag is used, it means that the -** sync operation only needs to flush data to mass storage. Inode -** information need not be flushed. If the lower four bits of the flag -** equal SQLITE_SYNC_NORMAL, that means to use normal fsync() semantics. -** If the lower four bits equal SQLITE_SYNC_FULL, that means -** to use Mac OS X style fullsync instead of fsync(). -** -** Do not confuse the SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags -** with the [PRAGMA synchronous]=NORMAL and [PRAGMA synchronous]=FULL -** settings. The [synchronous pragma] determines when calls to the -** xSync VFS method occur and applies uniformly across all platforms. -** The SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL flags determine how -** energetic or rigorous or forceful the sync operations are and -** only make a difference on Mac OSX for the default SQLite code. -** (Third-party VFS implementations might also make the distinction -** between SQLITE_SYNC_NORMAL and SQLITE_SYNC_FULL, but among the -** operating systems natively supported by SQLite, only Mac OSX -** cares about the difference.) -*/ -#define SQLITE_SYNC_NORMAL 0x00002 -#define SQLITE_SYNC_FULL 0x00003 -#define SQLITE_SYNC_DATAONLY 0x00010 - -/* -** CAPI3REF: OS Interface Open File Handle -** -** An [sqlite3_file] object represents an open file in the -** [sqlite3_vfs | OS interface layer]. Individual OS interface -** implementations will -** want to subclass this object by appending additional fields -** for their own use. The pMethods entry is a pointer to an -** [sqlite3_io_methods] object that defines methods for performing -** I/O operations on the open file. -*/ -typedef struct sqlite3_file sqlite3_file; -struct sqlite3_file { - const struct sqlite3_io_methods *pMethods; /* Methods for an open file */ -}; - -/* -** CAPI3REF: OS Interface File Virtual Methods Object -** -** Every file opened by the [sqlite3_vfs.xOpen] method populates an -** [sqlite3_file] object (or, more commonly, a subclass of the -** [sqlite3_file] object) with a pointer to an instance of this object. -** This object defines the methods used to perform various operations -** against the open file represented by the [sqlite3_file] object. -** -** If the [sqlite3_vfs.xOpen] method sets the sqlite3_file.pMethods element -** to a non-NULL pointer, then the sqlite3_io_methods.xClose method -** may be invoked even if the [sqlite3_vfs.xOpen] reported that it failed. The -** only way to prevent a call to xClose following a failed [sqlite3_vfs.xOpen] -** is for the [sqlite3_vfs.xOpen] to set the sqlite3_file.pMethods element -** to NULL. -** -** The flags argument to xSync may be one of [SQLITE_SYNC_NORMAL] or -** [SQLITE_SYNC_FULL]. The first choice is the normal fsync(). -** The second choice is a Mac OS X style fullsync. The [SQLITE_SYNC_DATAONLY] -** flag may be ORed in to indicate that only the data of the file -** and not its inode needs to be synced. -** -** The integer values to xLock() and xUnlock() are one of -**
      -**
    • [SQLITE_LOCK_NONE], -**
    • [SQLITE_LOCK_SHARED], -**
    • [SQLITE_LOCK_RESERVED], -**
    • [SQLITE_LOCK_PENDING], or -**
    • [SQLITE_LOCK_EXCLUSIVE]. -**
    -** xLock() increases the lock. xUnlock() decreases the lock. -** The xCheckReservedLock() method checks whether any database connection, -** either in this process or in some other process, is holding a RESERVED, -** PENDING, or EXCLUSIVE lock on the file. It returns true -** if such a lock exists and false otherwise. -** -** The xFileControl() method is a generic interface that allows custom -** VFS implementations to directly control an open file using the -** [sqlite3_file_control()] interface. The second "op" argument is an -** integer opcode. The third argument is a generic pointer intended to -** point to a structure that may contain arguments or space in which to -** write return values. Potential uses for xFileControl() might be -** functions to enable blocking locks with timeouts, to change the -** locking strategy (for example to use dot-file locks), to inquire -** about the status of a lock, or to break stale locks. The SQLite -** core reserves all opcodes less than 100 for its own use. -** A [SQLITE_FCNTL_LOCKSTATE | list of opcodes] less than 100 is available. -** Applications that define a custom xFileControl method should use opcodes -** greater than 100 to avoid conflicts. VFS implementations should -** return [SQLITE_NOTFOUND] for file control opcodes that they do not -** recognize. -** -** The xSectorSize() method returns the sector size of the -** device that underlies the file. The sector size is the -** minimum write that can be performed without disturbing -** other bytes in the file. The xDeviceCharacteristics() -** method returns a bit vector describing behaviors of the -** underlying device: -** -**
      -**
    • [SQLITE_IOCAP_ATOMIC] -**
    • [SQLITE_IOCAP_ATOMIC512] -**
    • [SQLITE_IOCAP_ATOMIC1K] -**
    • [SQLITE_IOCAP_ATOMIC2K] -**
    • [SQLITE_IOCAP_ATOMIC4K] -**
    • [SQLITE_IOCAP_ATOMIC8K] -**
    • [SQLITE_IOCAP_ATOMIC16K] -**
    • [SQLITE_IOCAP_ATOMIC32K] -**
    • [SQLITE_IOCAP_ATOMIC64K] -**
    • [SQLITE_IOCAP_SAFE_APPEND] -**
    • [SQLITE_IOCAP_SEQUENTIAL] -**
    -** -** The SQLITE_IOCAP_ATOMIC property means that all writes of -** any size are atomic. The SQLITE_IOCAP_ATOMICnnn values -** mean that writes of blocks that are nnn bytes in size and -** are aligned to an address which is an integer multiple of -** nnn are atomic. The SQLITE_IOCAP_SAFE_APPEND value means -** that when data is appended to a file, the data is appended -** first then the size of the file is extended, never the other -** way around. The SQLITE_IOCAP_SEQUENTIAL property means that -** information is written to disk in the same order as calls -** to xWrite(). -** -** If xRead() returns SQLITE_IOERR_SHORT_READ it must also fill -** in the unread portions of the buffer with zeros. A VFS that -** fails to zero-fill short reads might seem to work. However, -** failure to zero-fill short reads will eventually lead to -** database corruption. -*/ -typedef struct sqlite3_io_methods sqlite3_io_methods; -struct sqlite3_io_methods { - int iVersion; - int (*xClose)(sqlite3_file*); - int (*xRead)(sqlite3_file*, void*, int iAmt, sqlite3_int64 iOfst); - int (*xWrite)(sqlite3_file*, const void*, int iAmt, sqlite3_int64 iOfst); - int (*xTruncate)(sqlite3_file*, sqlite3_int64 size); - int (*xSync)(sqlite3_file*, int flags); - int (*xFileSize)(sqlite3_file*, sqlite3_int64 *pSize); - int (*xLock)(sqlite3_file*, int); - int (*xUnlock)(sqlite3_file*, int); - int (*xCheckReservedLock)(sqlite3_file*, int *pResOut); - int (*xFileControl)(sqlite3_file*, int op, void *pArg); - int (*xSectorSize)(sqlite3_file*); - int (*xDeviceCharacteristics)(sqlite3_file*); - /* Methods above are valid for version 1 */ - int (*xShmMap)(sqlite3_file*, int iPg, int pgsz, int, void volatile**); - int (*xShmLock)(sqlite3_file*, int offset, int n, int flags); - void (*xShmBarrier)(sqlite3_file*); - int (*xShmUnmap)(sqlite3_file*, int deleteFlag); - /* Methods above are valid for version 2 */ - int (*xFetch)(sqlite3_file*, sqlite3_int64 iOfst, int iAmt, void **pp); - int (*xUnfetch)(sqlite3_file*, sqlite3_int64 iOfst, void *p); - /* Methods above are valid for version 3 */ - /* Additional methods may be added in future releases */ -}; - -/* -** CAPI3REF: Standard File Control Opcodes -** -** These integer constants are opcodes for the xFileControl method -** of the [sqlite3_io_methods] object and for the [sqlite3_file_control()] -** interface. -** -** The [SQLITE_FCNTL_LOCKSTATE] opcode is used for debugging. This -** opcode causes the xFileControl method to write the current state of -** the lock (one of [SQLITE_LOCK_NONE], [SQLITE_LOCK_SHARED], -** [SQLITE_LOCK_RESERVED], [SQLITE_LOCK_PENDING], or [SQLITE_LOCK_EXCLUSIVE]) -** into an integer that the pArg argument points to. This capability -** is used during testing and only needs to be supported when SQLITE_TEST -** is defined. -**
      -**
    • [[SQLITE_FCNTL_SIZE_HINT]] -** The [SQLITE_FCNTL_SIZE_HINT] opcode is used by SQLite to give the VFS -** layer a hint of how large the database file will grow to be during the -** current transaction. This hint is not guaranteed to be accurate but it -** is often close. The underlying VFS might choose to preallocate database -** file space based on this hint in order to help writes to the database -** file run faster. -** -**
    • [[SQLITE_FCNTL_CHUNK_SIZE]] -** The [SQLITE_FCNTL_CHUNK_SIZE] opcode is used to request that the VFS -** extends and truncates the database file in chunks of a size specified -** by the user. The fourth argument to [sqlite3_file_control()] should -** point to an integer (type int) containing the new chunk-size to use -** for the nominated database. Allocating database file space in large -** chunks (say 1MB at a time), may reduce file-system fragmentation and -** improve performance on some systems. -** -**
    • [[SQLITE_FCNTL_FILE_POINTER]] -** The [SQLITE_FCNTL_FILE_POINTER] opcode is used to obtain a pointer -** to the [sqlite3_file] object associated with a particular database -** connection. See the [sqlite3_file_control()] documentation for -** additional information. -** -**
    • [[SQLITE_FCNTL_SYNC_OMITTED]] -** No longer in use. -** -**
    • [[SQLITE_FCNTL_SYNC]] -** The [SQLITE_FCNTL_SYNC] opcode is generated internally by SQLite and -** sent to the VFS immediately before the xSync method is invoked on a -** database file descriptor. Or, if the xSync method is not invoked -** because the user has configured SQLite with -** [PRAGMA synchronous | PRAGMA synchronous=OFF] it is invoked in place -** of the xSync method. In most cases, the pointer argument passed with -** this file-control is NULL. However, if the database file is being synced -** as part of a multi-database commit, the argument points to a nul-terminated -** string containing the transactions master-journal file name. VFSes that -** do not need this signal should silently ignore this opcode. Applications -** should not call [sqlite3_file_control()] with this opcode as doing so may -** disrupt the operation of the specialized VFSes that do require it. -** -**
    • [[SQLITE_FCNTL_COMMIT_PHASETWO]] -** The [SQLITE_FCNTL_COMMIT_PHASETWO] opcode is generated internally by SQLite -** and sent to the VFS after a transaction has been committed immediately -** but before the database is unlocked. VFSes that do not need this signal -** should silently ignore this opcode. Applications should not call -** [sqlite3_file_control()] with this opcode as doing so may disrupt the -** operation of the specialized VFSes that do require it. -** -**
    • [[SQLITE_FCNTL_WIN32_AV_RETRY]] -** ^The [SQLITE_FCNTL_WIN32_AV_RETRY] opcode is used to configure automatic -** retry counts and intervals for certain disk I/O operations for the -** windows [VFS] in order to provide robustness in the presence of -** anti-virus programs. By default, the windows VFS will retry file read, -** file write, and file delete operations up to 10 times, with a delay -** of 25 milliseconds before the first retry and with the delay increasing -** by an additional 25 milliseconds with each subsequent retry. This -** opcode allows these two values (10 retries and 25 milliseconds of delay) -** to be adjusted. The values are changed for all database connections -** within the same process. The argument is a pointer to an array of two -** integers where the first integer i the new retry count and the second -** integer is the delay. If either integer is negative, then the setting -** is not changed but instead the prior value of that setting is written -** into the array entry, allowing the current retry settings to be -** interrogated. The zDbName parameter is ignored. -** -**
    • [[SQLITE_FCNTL_PERSIST_WAL]] -** ^The [SQLITE_FCNTL_PERSIST_WAL] opcode is used to set or query the -** persistent [WAL | Write Ahead Log] setting. By default, the auxiliary -** write ahead log and shared memory files used for transaction control -** are automatically deleted when the latest connection to the database -** closes. Setting persistent WAL mode causes those files to persist after -** close. Persisting the files is useful when other processes that do not -** have write permission on the directory containing the database file want -** to read the database file, as the WAL and shared memory files must exist -** in order for the database to be readable. The fourth parameter to -** [sqlite3_file_control()] for this opcode should be a pointer to an integer. -** That integer is 0 to disable persistent WAL mode or 1 to enable persistent -** WAL mode. If the integer is -1, then it is overwritten with the current -** WAL persistence setting. -** -**
    • [[SQLITE_FCNTL_POWERSAFE_OVERWRITE]] -** ^The [SQLITE_FCNTL_POWERSAFE_OVERWRITE] opcode is used to set or query the -** persistent "powersafe-overwrite" or "PSOW" setting. The PSOW setting -** determines the [SQLITE_IOCAP_POWERSAFE_OVERWRITE] bit of the -** xDeviceCharacteristics methods. The fourth parameter to -** [sqlite3_file_control()] for this opcode should be a pointer to an integer. -** That integer is 0 to disable zero-damage mode or 1 to enable zero-damage -** mode. If the integer is -1, then it is overwritten with the current -** zero-damage mode setting. -** -**
    • [[SQLITE_FCNTL_OVERWRITE]] -** ^The [SQLITE_FCNTL_OVERWRITE] opcode is invoked by SQLite after opening -** a write transaction to indicate that, unless it is rolled back for some -** reason, the entire database file will be overwritten by the current -** transaction. This is used by VACUUM operations. -** -**
    • [[SQLITE_FCNTL_VFSNAME]] -** ^The [SQLITE_FCNTL_VFSNAME] opcode can be used to obtain the names of -** all [VFSes] in the VFS stack. The names are of all VFS shims and the -** final bottom-level VFS are written into memory obtained from -** [sqlite3_malloc()] and the result is stored in the char* variable -** that the fourth parameter of [sqlite3_file_control()] points to. -** The caller is responsible for freeing the memory when done. As with -** all file-control actions, there is no guarantee that this will actually -** do anything. Callers should initialize the char* variable to a NULL -** pointer in case this file-control is not implemented. This file-control -** is intended for diagnostic use only. -** -**
    • [[SQLITE_FCNTL_PRAGMA]] -** ^Whenever a [PRAGMA] statement is parsed, an [SQLITE_FCNTL_PRAGMA] -** file control is sent to the open [sqlite3_file] object corresponding -** to the database file to which the pragma statement refers. ^The argument -** to the [SQLITE_FCNTL_PRAGMA] file control is an array of -** pointers to strings (char**) in which the second element of the array -** is the name of the pragma and the third element is the argument to the -** pragma or NULL if the pragma has no argument. ^The handler for an -** [SQLITE_FCNTL_PRAGMA] file control can optionally make the first element -** of the char** argument point to a string obtained from [sqlite3_mprintf()] -** or the equivalent and that string will become the result of the pragma or -** the error message if the pragma fails. ^If the -** [SQLITE_FCNTL_PRAGMA] file control returns [SQLITE_NOTFOUND], then normal -** [PRAGMA] processing continues. ^If the [SQLITE_FCNTL_PRAGMA] -** file control returns [SQLITE_OK], then the parser assumes that the -** VFS has handled the PRAGMA itself and the parser generates a no-op -** prepared statement. ^If the [SQLITE_FCNTL_PRAGMA] file control returns -** any result code other than [SQLITE_OK] or [SQLITE_NOTFOUND], that means -** that the VFS encountered an error while handling the [PRAGMA] and the -** compilation of the PRAGMA fails with an error. ^The [SQLITE_FCNTL_PRAGMA] -** file control occurs at the beginning of pragma statement analysis and so -** it is able to override built-in [PRAGMA] statements. -** -**
    • [[SQLITE_FCNTL_BUSYHANDLER]] -** ^The [SQLITE_FCNTL_BUSYHANDLER] -** file-control may be invoked by SQLite on the database file handle -** shortly after it is opened in order to provide a custom VFS with access -** to the connections busy-handler callback. The argument is of type (void **) -** - an array of two (void *) values. The first (void *) actually points -** to a function of type (int (*)(void *)). In order to invoke the connections -** busy-handler, this function should be invoked with the second (void *) in -** the array as the only argument. If it returns non-zero, then the operation -** should be retried. If it returns zero, the custom VFS should abandon the -** current operation. -** -**
    • [[SQLITE_FCNTL_TEMPFILENAME]] -** ^Application can invoke the [SQLITE_FCNTL_TEMPFILENAME] file-control -** to have SQLite generate a -** temporary filename using the same algorithm that is followed to generate -** temporary filenames for TEMP tables and other internal uses. The -** argument should be a char** which will be filled with the filename -** written into memory obtained from [sqlite3_malloc()]. The caller should -** invoke [sqlite3_free()] on the result to avoid a memory leak. -** -**
    • [[SQLITE_FCNTL_MMAP_SIZE]] -** The [SQLITE_FCNTL_MMAP_SIZE] file control is used to query or set the -** maximum number of bytes that will be used for memory-mapped I/O. -** The argument is a pointer to a value of type sqlite3_int64 that -** is an advisory maximum number of bytes in the file to memory map. The -** pointer is overwritten with the old value. The limit is not changed if -** the value originally pointed to is negative, and so the current limit -** can be queried by passing in a pointer to a negative number. This -** file-control is used internally to implement [PRAGMA mmap_size]. -** -**
    • [[SQLITE_FCNTL_TRACE]] -** The [SQLITE_FCNTL_TRACE] file control provides advisory information -** to the VFS about what the higher layers of the SQLite stack are doing. -** This file control is used by some VFS activity tracing [shims]. -** The argument is a zero-terminated string. Higher layers in the -** SQLite stack may generate instances of this file control if -** the [SQLITE_USE_FCNTL_TRACE] compile-time option is enabled. -** -**
    • [[SQLITE_FCNTL_HAS_MOVED]] -** The [SQLITE_FCNTL_HAS_MOVED] file control interprets its argument as a -** pointer to an integer and it writes a boolean into that integer depending -** on whether or not the file has been renamed, moved, or deleted since it -** was first opened. -** -**
    -*/ -#define SQLITE_FCNTL_LOCKSTATE 1 -#define SQLITE_GET_LOCKPROXYFILE 2 -#define SQLITE_SET_LOCKPROXYFILE 3 -#define SQLITE_LAST_ERRNO 4 -#define SQLITE_FCNTL_SIZE_HINT 5 -#define SQLITE_FCNTL_CHUNK_SIZE 6 -#define SQLITE_FCNTL_FILE_POINTER 7 -#define SQLITE_FCNTL_SYNC_OMITTED 8 -#define SQLITE_FCNTL_WIN32_AV_RETRY 9 -#define SQLITE_FCNTL_PERSIST_WAL 10 -#define SQLITE_FCNTL_OVERWRITE 11 -#define SQLITE_FCNTL_VFSNAME 12 -#define SQLITE_FCNTL_POWERSAFE_OVERWRITE 13 -#define SQLITE_FCNTL_PRAGMA 14 -#define SQLITE_FCNTL_BUSYHANDLER 15 -#define SQLITE_FCNTL_TEMPFILENAME 16 -#define SQLITE_FCNTL_MMAP_SIZE 18 -#define SQLITE_FCNTL_TRACE 19 -#define SQLITE_FCNTL_HAS_MOVED 20 -#define SQLITE_FCNTL_SYNC 21 -#define SQLITE_FCNTL_COMMIT_PHASETWO 22 - -/* -** CAPI3REF: Mutex Handle -** -** The mutex module within SQLite defines [sqlite3_mutex] to be an -** abstract type for a mutex object. The SQLite core never looks -** at the internal representation of an [sqlite3_mutex]. It only -** deals with pointers to the [sqlite3_mutex] object. -** -** Mutexes are created using [sqlite3_mutex_alloc()]. -*/ -typedef struct sqlite3_mutex sqlite3_mutex; - -/* -** CAPI3REF: OS Interface Object -** -** An instance of the sqlite3_vfs object defines the interface between -** the SQLite core and the underlying operating system. The "vfs" -** in the name of the object stands for "virtual file system". See -** the [VFS | VFS documentation] for further information. -** -** The value of the iVersion field is initially 1 but may be larger in -** future versions of SQLite. Additional fields may be appended to this -** object when the iVersion value is increased. Note that the structure -** of the sqlite3_vfs object changes in the transaction between -** SQLite version 3.5.9 and 3.6.0 and yet the iVersion field was not -** modified. -** -** The szOsFile field is the size of the subclassed [sqlite3_file] -** structure used by this VFS. mxPathname is the maximum length of -** a pathname in this VFS. -** -** Registered sqlite3_vfs objects are kept on a linked list formed by -** the pNext pointer. The [sqlite3_vfs_register()] -** and [sqlite3_vfs_unregister()] interfaces manage this list -** in a thread-safe way. The [sqlite3_vfs_find()] interface -** searches the list. Neither the application code nor the VFS -** implementation should use the pNext pointer. -** -** The pNext field is the only field in the sqlite3_vfs -** structure that SQLite will ever modify. SQLite will only access -** or modify this field while holding a particular static mutex. -** The application should never modify anything within the sqlite3_vfs -** object once the object has been registered. -** -** The zName field holds the name of the VFS module. The name must -** be unique across all VFS modules. -** -** [[sqlite3_vfs.xOpen]] -** ^SQLite guarantees that the zFilename parameter to xOpen -** is either a NULL pointer or string obtained -** from xFullPathname() with an optional suffix added. -** ^If a suffix is added to the zFilename parameter, it will -** consist of a single "-" character followed by no more than -** 11 alphanumeric and/or "-" characters. -** ^SQLite further guarantees that -** the string will be valid and unchanged until xClose() is -** called. Because of the previous sentence, -** the [sqlite3_file] can safely store a pointer to the -** filename if it needs to remember the filename for some reason. -** If the zFilename parameter to xOpen is a NULL pointer then xOpen -** must invent its own temporary name for the file. ^Whenever the -** xFilename parameter is NULL it will also be the case that the -** flags parameter will include [SQLITE_OPEN_DELETEONCLOSE]. -** -** The flags argument to xOpen() includes all bits set in -** the flags argument to [sqlite3_open_v2()]. Or if [sqlite3_open()] -** or [sqlite3_open16()] is used, then flags includes at least -** [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]. -** If xOpen() opens a file read-only then it sets *pOutFlags to -** include [SQLITE_OPEN_READONLY]. Other bits in *pOutFlags may be set. -** -** ^(SQLite will also add one of the following flags to the xOpen() -** call, depending on the object being opened: -** -**
      -**
    • [SQLITE_OPEN_MAIN_DB] -**
    • [SQLITE_OPEN_MAIN_JOURNAL] -**
    • [SQLITE_OPEN_TEMP_DB] -**
    • [SQLITE_OPEN_TEMP_JOURNAL] -**
    • [SQLITE_OPEN_TRANSIENT_DB] -**
    • [SQLITE_OPEN_SUBJOURNAL] -**
    • [SQLITE_OPEN_MASTER_JOURNAL] -**
    • [SQLITE_OPEN_WAL] -**
    )^ -** -** The file I/O implementation can use the object type flags to -** change the way it deals with files. For example, an application -** that does not care about crash recovery or rollback might make -** the open of a journal file a no-op. Writes to this journal would -** also be no-ops, and any attempt to read the journal would return -** SQLITE_IOERR. Or the implementation might recognize that a database -** file will be doing page-aligned sector reads and writes in a random -** order and set up its I/O subsystem accordingly. -** -** SQLite might also add one of the following flags to the xOpen method: -** -**
      -**
    • [SQLITE_OPEN_DELETEONCLOSE] -**
    • [SQLITE_OPEN_EXCLUSIVE] -**
    -** -** The [SQLITE_OPEN_DELETEONCLOSE] flag means the file should be -** deleted when it is closed. ^The [SQLITE_OPEN_DELETEONCLOSE] -** will be set for TEMP databases and their journals, transient -** databases, and subjournals. -** -** ^The [SQLITE_OPEN_EXCLUSIVE] flag is always used in conjunction -** with the [SQLITE_OPEN_CREATE] flag, which are both directly -** analogous to the O_EXCL and O_CREAT flags of the POSIX open() -** API. The SQLITE_OPEN_EXCLUSIVE flag, when paired with the -** SQLITE_OPEN_CREATE, is used to indicate that file should always -** be created, and that it is an error if it already exists. -** It is not used to indicate the file should be opened -** for exclusive access. -** -** ^At least szOsFile bytes of memory are allocated by SQLite -** to hold the [sqlite3_file] structure passed as the third -** argument to xOpen. The xOpen method does not have to -** allocate the structure; it should just fill it in. Note that -** the xOpen method must set the sqlite3_file.pMethods to either -** a valid [sqlite3_io_methods] object or to NULL. xOpen must do -** this even if the open fails. SQLite expects that the sqlite3_file.pMethods -** element will be valid after xOpen returns regardless of the success -** or failure of the xOpen call. -** -** [[sqlite3_vfs.xAccess]] -** ^The flags argument to xAccess() may be [SQLITE_ACCESS_EXISTS] -** to test for the existence of a file, or [SQLITE_ACCESS_READWRITE] to -** test whether a file is readable and writable, or [SQLITE_ACCESS_READ] -** to test whether a file is at least readable. The file can be a -** directory. -** -** ^SQLite will always allocate at least mxPathname+1 bytes for the -** output buffer xFullPathname. The exact size of the output buffer -** is also passed as a parameter to both methods. If the output buffer -** is not large enough, [SQLITE_CANTOPEN] should be returned. Since this is -** handled as a fatal error by SQLite, vfs implementations should endeavor -** to prevent this by setting mxPathname to a sufficiently large value. -** -** The xRandomness(), xSleep(), xCurrentTime(), and xCurrentTimeInt64() -** interfaces are not strictly a part of the filesystem, but they are -** included in the VFS structure for completeness. -** The xRandomness() function attempts to return nBytes bytes -** of good-quality randomness into zOut. The return value is -** the actual number of bytes of randomness obtained. -** The xSleep() method causes the calling thread to sleep for at -** least the number of microseconds given. ^The xCurrentTime() -** method returns a Julian Day Number for the current date and time as -** a floating point value. -** ^The xCurrentTimeInt64() method returns, as an integer, the Julian -** Day Number multiplied by 86400000 (the number of milliseconds in -** a 24-hour day). -** ^SQLite will use the xCurrentTimeInt64() method to get the current -** date and time if that method is available (if iVersion is 2 or -** greater and the function pointer is not NULL) and will fall back -** to xCurrentTime() if xCurrentTimeInt64() is unavailable. -** -** ^The xSetSystemCall(), xGetSystemCall(), and xNestSystemCall() interfaces -** are not used by the SQLite core. These optional interfaces are provided -** by some VFSes to facilitate testing of the VFS code. By overriding -** system calls with functions under its control, a test program can -** simulate faults and error conditions that would otherwise be difficult -** or impossible to induce. The set of system calls that can be overridden -** varies from one VFS to another, and from one version of the same VFS to the -** next. Applications that use these interfaces must be prepared for any -** or all of these interfaces to be NULL or for their behavior to change -** from one release to the next. Applications must not attempt to access -** any of these methods if the iVersion of the VFS is less than 3. -*/ -typedef struct sqlite3_vfs sqlite3_vfs; -typedef void (*sqlite3_syscall_ptr)(void); -struct sqlite3_vfs { - int iVersion; /* Structure version number (currently 3) */ - int szOsFile; /* Size of subclassed sqlite3_file */ - int mxPathname; /* Maximum file pathname length */ - sqlite3_vfs *pNext; /* Next registered VFS */ - const char *zName; /* Name of this virtual file system */ - void *pAppData; /* Pointer to application-specific data */ - int (*xOpen)(sqlite3_vfs*, const char *zName, sqlite3_file*, - int flags, int *pOutFlags); - int (*xDelete)(sqlite3_vfs*, const char *zName, int syncDir); - int (*xAccess)(sqlite3_vfs*, const char *zName, int flags, int *pResOut); - int (*xFullPathname)(sqlite3_vfs*, const char *zName, int nOut, char *zOut); - void *(*xDlOpen)(sqlite3_vfs*, const char *zFilename); - void (*xDlError)(sqlite3_vfs*, int nByte, char *zErrMsg); - void (*(*xDlSym)(sqlite3_vfs*,void*, const char *zSymbol))(void); - void (*xDlClose)(sqlite3_vfs*, void*); - int (*xRandomness)(sqlite3_vfs*, int nByte, char *zOut); - int (*xSleep)(sqlite3_vfs*, int microseconds); - int (*xCurrentTime)(sqlite3_vfs*, double*); - int (*xGetLastError)(sqlite3_vfs*, int, char *); - /* - ** The methods above are in version 1 of the sqlite_vfs object - ** definition. Those that follow are added in version 2 or later - */ - int (*xCurrentTimeInt64)(sqlite3_vfs*, sqlite3_int64*); - /* - ** The methods above are in versions 1 and 2 of the sqlite_vfs object. - ** Those below are for version 3 and greater. - */ - int (*xSetSystemCall)(sqlite3_vfs*, const char *zName, sqlite3_syscall_ptr); - sqlite3_syscall_ptr (*xGetSystemCall)(sqlite3_vfs*, const char *zName); - const char *(*xNextSystemCall)(sqlite3_vfs*, const char *zName); - /* - ** The methods above are in versions 1 through 3 of the sqlite_vfs object. - ** New fields may be appended in figure versions. The iVersion - ** value will increment whenever this happens. - */ -}; - -/* -** CAPI3REF: Flags for the xAccess VFS method -** -** These integer constants can be used as the third parameter to -** the xAccess method of an [sqlite3_vfs] object. They determine -** what kind of permissions the xAccess method is looking for. -** With SQLITE_ACCESS_EXISTS, the xAccess method -** simply checks whether the file exists. -** With SQLITE_ACCESS_READWRITE, the xAccess method -** checks whether the named directory is both readable and writable -** (in other words, if files can be added, removed, and renamed within -** the directory). -** The SQLITE_ACCESS_READWRITE constant is currently used only by the -** [temp_store_directory pragma], though this could change in a future -** release of SQLite. -** With SQLITE_ACCESS_READ, the xAccess method -** checks whether the file is readable. The SQLITE_ACCESS_READ constant is -** currently unused, though it might be used in a future release of -** SQLite. -*/ -#define SQLITE_ACCESS_EXISTS 0 -#define SQLITE_ACCESS_READWRITE 1 /* Used by PRAGMA temp_store_directory */ -#define SQLITE_ACCESS_READ 2 /* Unused */ - -/* -** CAPI3REF: Flags for the xShmLock VFS method -** -** These integer constants define the various locking operations -** allowed by the xShmLock method of [sqlite3_io_methods]. The -** following are the only legal combinations of flags to the -** xShmLock method: -** -**
      -**
    • SQLITE_SHM_LOCK | SQLITE_SHM_SHARED -**
    • SQLITE_SHM_LOCK | SQLITE_SHM_EXCLUSIVE -**
    • SQLITE_SHM_UNLOCK | SQLITE_SHM_SHARED -**
    • SQLITE_SHM_UNLOCK | SQLITE_SHM_EXCLUSIVE -**
    -** -** When unlocking, the same SHARED or EXCLUSIVE flag must be supplied as -** was given no the corresponding lock. -** -** The xShmLock method can transition between unlocked and SHARED or -** between unlocked and EXCLUSIVE. It cannot transition between SHARED -** and EXCLUSIVE. -*/ -#define SQLITE_SHM_UNLOCK 1 -#define SQLITE_SHM_LOCK 2 -#define SQLITE_SHM_SHARED 4 -#define SQLITE_SHM_EXCLUSIVE 8 - -/* -** CAPI3REF: Maximum xShmLock index -** -** The xShmLock method on [sqlite3_io_methods] may use values -** between 0 and this upper bound as its "offset" argument. -** The SQLite core will never attempt to acquire or release a -** lock outside of this range -*/ -#define SQLITE_SHM_NLOCK 8 - - -/* -** CAPI3REF: Initialize The SQLite Library -** -** ^The sqlite3_initialize() routine initializes the -** SQLite library. ^The sqlite3_shutdown() routine -** deallocates any resources that were allocated by sqlite3_initialize(). -** These routines are designed to aid in process initialization and -** shutdown on embedded systems. Workstation applications using -** SQLite normally do not need to invoke either of these routines. -** -** A call to sqlite3_initialize() is an "effective" call if it is -** the first time sqlite3_initialize() is invoked during the lifetime of -** the process, or if it is the first time sqlite3_initialize() is invoked -** following a call to sqlite3_shutdown(). ^(Only an effective call -** of sqlite3_initialize() does any initialization. All other calls -** are harmless no-ops.)^ -** -** A call to sqlite3_shutdown() is an "effective" call if it is the first -** call to sqlite3_shutdown() since the last sqlite3_initialize(). ^(Only -** an effective call to sqlite3_shutdown() does any deinitialization. -** All other valid calls to sqlite3_shutdown() are harmless no-ops.)^ -** -** The sqlite3_initialize() interface is threadsafe, but sqlite3_shutdown() -** is not. The sqlite3_shutdown() interface must only be called from a -** single thread. All open [database connections] must be closed and all -** other SQLite resources must be deallocated prior to invoking -** sqlite3_shutdown(). -** -** Among other things, ^sqlite3_initialize() will invoke -** sqlite3_os_init(). Similarly, ^sqlite3_shutdown() -** will invoke sqlite3_os_end(). -** -** ^The sqlite3_initialize() routine returns [SQLITE_OK] on success. -** ^If for some reason, sqlite3_initialize() is unable to initialize -** the library (perhaps it is unable to allocate a needed resource such -** as a mutex) it returns an [error code] other than [SQLITE_OK]. -** -** ^The sqlite3_initialize() routine is called internally by many other -** SQLite interfaces so that an application usually does not need to -** invoke sqlite3_initialize() directly. For example, [sqlite3_open()] -** calls sqlite3_initialize() so the SQLite library will be automatically -** initialized when [sqlite3_open()] is called if it has not be initialized -** already. ^However, if SQLite is compiled with the [SQLITE_OMIT_AUTOINIT] -** compile-time option, then the automatic calls to sqlite3_initialize() -** are omitted and the application must call sqlite3_initialize() directly -** prior to using any other SQLite interface. For maximum portability, -** it is recommended that applications always invoke sqlite3_initialize() -** directly prior to using any other SQLite interface. Future releases -** of SQLite may require this. In other words, the behavior exhibited -** when SQLite is compiled with [SQLITE_OMIT_AUTOINIT] might become the -** default behavior in some future release of SQLite. -** -** The sqlite3_os_init() routine does operating-system specific -** initialization of the SQLite library. The sqlite3_os_end() -** routine undoes the effect of sqlite3_os_init(). Typical tasks -** performed by these routines include allocation or deallocation -** of static resources, initialization of global variables, -** setting up a default [sqlite3_vfs] module, or setting up -** a default configuration using [sqlite3_config()]. -** -** The application should never invoke either sqlite3_os_init() -** or sqlite3_os_end() directly. The application should only invoke -** sqlite3_initialize() and sqlite3_shutdown(). The sqlite3_os_init() -** interface is called automatically by sqlite3_initialize() and -** sqlite3_os_end() is called by sqlite3_shutdown(). Appropriate -** implementations for sqlite3_os_init() and sqlite3_os_end() -** are built into SQLite when it is compiled for Unix, Windows, or OS/2. -** When [custom builds | built for other platforms] -** (using the [SQLITE_OS_OTHER=1] compile-time -** option) the application must supply a suitable implementation for -** sqlite3_os_init() and sqlite3_os_end(). An application-supplied -** implementation of sqlite3_os_init() or sqlite3_os_end() -** must return [SQLITE_OK] on success and some other [error code] upon -** failure. -*/ -SQLITE_API int sqlite3_initialize(void); -SQLITE_API int sqlite3_shutdown(void); -SQLITE_API int sqlite3_os_init(void); -SQLITE_API int sqlite3_os_end(void); - -/* -** CAPI3REF: Configuring The SQLite Library -** -** The sqlite3_config() interface is used to make global configuration -** changes to SQLite in order to tune SQLite to the specific needs of -** the application. The default configuration is recommended for most -** applications and so this routine is usually not necessary. It is -** provided to support rare applications with unusual needs. -** -** The sqlite3_config() interface is not threadsafe. The application -** must insure that no other SQLite interfaces are invoked by other -** threads while sqlite3_config() is running. Furthermore, sqlite3_config() -** may only be invoked prior to library initialization using -** [sqlite3_initialize()] or after shutdown by [sqlite3_shutdown()]. -** ^If sqlite3_config() is called after [sqlite3_initialize()] and before -** [sqlite3_shutdown()] then it will return SQLITE_MISUSE. -** Note, however, that ^sqlite3_config() can be called as part of the -** implementation of an application-defined [sqlite3_os_init()]. -** -** The first argument to sqlite3_config() is an integer -** [configuration option] that determines -** what property of SQLite is to be configured. Subsequent arguments -** vary depending on the [configuration option] -** in the first argument. -** -** ^When a configuration option is set, sqlite3_config() returns [SQLITE_OK]. -** ^If the option is unknown or SQLite is unable to set the option -** then this routine returns a non-zero [error code]. -*/ -SQLITE_API int sqlite3_config(int, ...); - -/* -** CAPI3REF: Configure database connections -** -** The sqlite3_db_config() interface is used to make configuration -** changes to a [database connection]. The interface is similar to -** [sqlite3_config()] except that the changes apply to a single -** [database connection] (specified in the first argument). -** -** The second argument to sqlite3_db_config(D,V,...) is the -** [SQLITE_DBCONFIG_LOOKASIDE | configuration verb] - an integer code -** that indicates what aspect of the [database connection] is being configured. -** Subsequent arguments vary depending on the configuration verb. -** -** ^Calls to sqlite3_db_config() return SQLITE_OK if and only if -** the call is considered successful. -*/ -SQLITE_API int sqlite3_db_config(sqlite3*, int op, ...); - -/* -** CAPI3REF: Memory Allocation Routines -** -** An instance of this object defines the interface between SQLite -** and low-level memory allocation routines. -** -** This object is used in only one place in the SQLite interface. -** A pointer to an instance of this object is the argument to -** [sqlite3_config()] when the configuration option is -** [SQLITE_CONFIG_MALLOC] or [SQLITE_CONFIG_GETMALLOC]. -** By creating an instance of this object -** and passing it to [sqlite3_config]([SQLITE_CONFIG_MALLOC]) -** during configuration, an application can specify an alternative -** memory allocation subsystem for SQLite to use for all of its -** dynamic memory needs. -** -** Note that SQLite comes with several [built-in memory allocators] -** that are perfectly adequate for the overwhelming majority of applications -** and that this object is only useful to a tiny minority of applications -** with specialized memory allocation requirements. This object is -** also used during testing of SQLite in order to specify an alternative -** memory allocator that simulates memory out-of-memory conditions in -** order to verify that SQLite recovers gracefully from such -** conditions. -** -** The xMalloc, xRealloc, and xFree methods must work like the -** malloc(), realloc() and free() functions from the standard C library. -** ^SQLite guarantees that the second argument to -** xRealloc is always a value returned by a prior call to xRoundup. -** -** xSize should return the allocated size of a memory allocation -** previously obtained from xMalloc or xRealloc. The allocated size -** is always at least as big as the requested size but may be larger. -** -** The xRoundup method returns what would be the allocated size of -** a memory allocation given a particular requested size. Most memory -** allocators round up memory allocations at least to the next multiple -** of 8. Some allocators round up to a larger multiple or to a power of 2. -** Every memory allocation request coming in through [sqlite3_malloc()] -** or [sqlite3_realloc()] first calls xRoundup. If xRoundup returns 0, -** that causes the corresponding memory allocation to fail. -** -** The xInit method initializes the memory allocator. For example, -** it might allocate any require mutexes or initialize internal data -** structures. The xShutdown method is invoked (indirectly) by -** [sqlite3_shutdown()] and should deallocate any resources acquired -** by xInit. The pAppData pointer is used as the only parameter to -** xInit and xShutdown. -** -** SQLite holds the [SQLITE_MUTEX_STATIC_MASTER] mutex when it invokes -** the xInit method, so the xInit method need not be threadsafe. The -** xShutdown method is only called from [sqlite3_shutdown()] so it does -** not need to be threadsafe either. For all other methods, SQLite -** holds the [SQLITE_MUTEX_STATIC_MEM] mutex as long as the -** [SQLITE_CONFIG_MEMSTATUS] configuration option is turned on (which -** it is by default) and so the methods are automatically serialized. -** However, if [SQLITE_CONFIG_MEMSTATUS] is disabled, then the other -** methods must be threadsafe or else make their own arrangements for -** serialization. -** -** SQLite will never invoke xInit() more than once without an intervening -** call to xShutdown(). -*/ -typedef struct sqlite3_mem_methods sqlite3_mem_methods; -struct sqlite3_mem_methods { - void *(*xMalloc)(int); /* Memory allocation function */ - void (*xFree)(void*); /* Free a prior allocation */ - void *(*xRealloc)(void*,int); /* Resize an allocation */ - int (*xSize)(void*); /* Return the size of an allocation */ - int (*xRoundup)(int); /* Round up request size to allocation size */ - int (*xInit)(void*); /* Initialize the memory allocator */ - void (*xShutdown)(void*); /* Deinitialize the memory allocator */ - void *pAppData; /* Argument to xInit() and xShutdown() */ -}; - -/* -** CAPI3REF: Configuration Options -** KEYWORDS: {configuration option} -** -** These constants are the available integer configuration options that -** can be passed as the first argument to the [sqlite3_config()] interface. -** -** New configuration options may be added in future releases of SQLite. -** Existing configuration options might be discontinued. Applications -** should check the return code from [sqlite3_config()] to make sure that -** the call worked. The [sqlite3_config()] interface will return a -** non-zero [error code] if a discontinued or unsupported configuration option -** is invoked. -** -**
    -** [[SQLITE_CONFIG_SINGLETHREAD]]
    SQLITE_CONFIG_SINGLETHREAD
    -**
    There are no arguments to this option. ^This option sets the -** [threading mode] to Single-thread. In other words, it disables -** all mutexing and puts SQLite into a mode where it can only be used -** by a single thread. ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** it is not possible to change the [threading mode] from its default -** value of Single-thread and so [sqlite3_config()] will return -** [SQLITE_ERROR] if called with the SQLITE_CONFIG_SINGLETHREAD -** configuration option.
    -** -** [[SQLITE_CONFIG_MULTITHREAD]]
    SQLITE_CONFIG_MULTITHREAD
    -**
    There are no arguments to this option. ^This option sets the -** [threading mode] to Multi-thread. In other words, it disables -** mutexing on [database connection] and [prepared statement] objects. -** The application is responsible for serializing access to -** [database connections] and [prepared statements]. But other mutexes -** are enabled so that SQLite will be safe to use in a multi-threaded -** environment as long as no two threads attempt to use the same -** [database connection] at the same time. ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** it is not possible to set the Multi-thread [threading mode] and -** [sqlite3_config()] will return [SQLITE_ERROR] if called with the -** SQLITE_CONFIG_MULTITHREAD configuration option.
    -** -** [[SQLITE_CONFIG_SERIALIZED]]
    SQLITE_CONFIG_SERIALIZED
    -**
    There are no arguments to this option. ^This option sets the -** [threading mode] to Serialized. In other words, this option enables -** all mutexes including the recursive -** mutexes on [database connection] and [prepared statement] objects. -** In this mode (which is the default when SQLite is compiled with -** [SQLITE_THREADSAFE=1]) the SQLite library will itself serialize access -** to [database connections] and [prepared statements] so that the -** application is free to use the same [database connection] or the -** same [prepared statement] in different threads at the same time. -** ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** it is not possible to set the Serialized [threading mode] and -** [sqlite3_config()] will return [SQLITE_ERROR] if called with the -** SQLITE_CONFIG_SERIALIZED configuration option.
    -** -** [[SQLITE_CONFIG_MALLOC]]
    SQLITE_CONFIG_MALLOC
    -**
    ^(This option takes a single argument which is a pointer to an -** instance of the [sqlite3_mem_methods] structure. The argument specifies -** alternative low-level memory allocation routines to be used in place of -** the memory allocation routines built into SQLite.)^ ^SQLite makes -** its own private copy of the content of the [sqlite3_mem_methods] structure -** before the [sqlite3_config()] call returns.
    -** -** [[SQLITE_CONFIG_GETMALLOC]]
    SQLITE_CONFIG_GETMALLOC
    -**
    ^(This option takes a single argument which is a pointer to an -** instance of the [sqlite3_mem_methods] structure. The [sqlite3_mem_methods] -** structure is filled with the currently defined memory allocation routines.)^ -** This option can be used to overload the default memory allocation -** routines with a wrapper that simulations memory allocation failure or -** tracks memory usage, for example.
    -** -** [[SQLITE_CONFIG_MEMSTATUS]]
    SQLITE_CONFIG_MEMSTATUS
    -**
    ^This option takes single argument of type int, interpreted as a -** boolean, which enables or disables the collection of memory allocation -** statistics. ^(When memory allocation statistics are disabled, the -** following SQLite interfaces become non-operational: -**
      -**
    • [sqlite3_memory_used()] -**
    • [sqlite3_memory_highwater()] -**
    • [sqlite3_soft_heap_limit64()] -**
    • [sqlite3_status()] -**
    )^ -** ^Memory allocation statistics are enabled by default unless SQLite is -** compiled with [SQLITE_DEFAULT_MEMSTATUS]=0 in which case memory -** allocation statistics are disabled by default. -**
    -** -** [[SQLITE_CONFIG_SCRATCH]]
    SQLITE_CONFIG_SCRATCH
    -**
    ^This option specifies a static memory buffer that SQLite can use for -** scratch memory. There are three arguments: A pointer an 8-byte -** aligned memory buffer from which the scratch allocations will be -** drawn, the size of each scratch allocation (sz), -** and the maximum number of scratch allocations (N). The sz -** argument must be a multiple of 16. -** The first argument must be a pointer to an 8-byte aligned buffer -** of at least sz*N bytes of memory. -** ^SQLite will use no more than two scratch buffers per thread. So -** N should be set to twice the expected maximum number of threads. -** ^SQLite will never require a scratch buffer that is more than 6 -** times the database page size. ^If SQLite needs needs additional -** scratch memory beyond what is provided by this configuration option, then -** [sqlite3_malloc()] will be used to obtain the memory needed.
    -** -** [[SQLITE_CONFIG_PAGECACHE]]
    SQLITE_CONFIG_PAGECACHE
    -**
    ^This option specifies a static memory buffer that SQLite can use for -** the database page cache with the default page cache implementation. -** This configuration should not be used if an application-define page -** cache implementation is loaded using the SQLITE_CONFIG_PCACHE2 option. -** There are three arguments to this option: A pointer to 8-byte aligned -** memory, the size of each page buffer (sz), and the number of pages (N). -** The sz argument should be the size of the largest database page -** (a power of two between 512 and 32768) plus a little extra for each -** page header. ^The page header size is 20 to 40 bytes depending on -** the host architecture. ^It is harmless, apart from the wasted memory, -** to make sz a little too large. The first -** argument should point to an allocation of at least sz*N bytes of memory. -** ^SQLite will use the memory provided by the first argument to satisfy its -** memory needs for the first N pages that it adds to cache. ^If additional -** page cache memory is needed beyond what is provided by this option, then -** SQLite goes to [sqlite3_malloc()] for the additional storage space. -** The pointer in the first argument must -** be aligned to an 8-byte boundary or subsequent behavior of SQLite -** will be undefined.
    -** -** [[SQLITE_CONFIG_HEAP]]
    SQLITE_CONFIG_HEAP
    -**
    ^This option specifies a static memory buffer that SQLite will use -** for all of its dynamic memory allocation needs beyond those provided -** for by [SQLITE_CONFIG_SCRATCH] and [SQLITE_CONFIG_PAGECACHE]. -** There are three arguments: An 8-byte aligned pointer to the memory, -** the number of bytes in the memory buffer, and the minimum allocation size. -** ^If the first pointer (the memory pointer) is NULL, then SQLite reverts -** to using its default memory allocator (the system malloc() implementation), -** undoing any prior invocation of [SQLITE_CONFIG_MALLOC]. ^If the -** memory pointer is not NULL and either [SQLITE_ENABLE_MEMSYS3] or -** [SQLITE_ENABLE_MEMSYS5] are defined, then the alternative memory -** allocator is engaged to handle all of SQLites memory allocation needs. -** The first pointer (the memory pointer) must be aligned to an 8-byte -** boundary or subsequent behavior of SQLite will be undefined. -** The minimum allocation size is capped at 2**12. Reasonable values -** for the minimum allocation size are 2**5 through 2**8.
    -** -** [[SQLITE_CONFIG_MUTEX]]
    SQLITE_CONFIG_MUTEX
    -**
    ^(This option takes a single argument which is a pointer to an -** instance of the [sqlite3_mutex_methods] structure. The argument specifies -** alternative low-level mutex routines to be used in place -** the mutex routines built into SQLite.)^ ^SQLite makes a copy of the -** content of the [sqlite3_mutex_methods] structure before the call to -** [sqlite3_config()] returns. ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** the entire mutexing subsystem is omitted from the build and hence calls to -** [sqlite3_config()] with the SQLITE_CONFIG_MUTEX configuration option will -** return [SQLITE_ERROR].
    -** -** [[SQLITE_CONFIG_GETMUTEX]]
    SQLITE_CONFIG_GETMUTEX
    -**
    ^(This option takes a single argument which is a pointer to an -** instance of the [sqlite3_mutex_methods] structure. The -** [sqlite3_mutex_methods] -** structure is filled with the currently defined mutex routines.)^ -** This option can be used to overload the default mutex allocation -** routines with a wrapper used to track mutex usage for performance -** profiling or testing, for example. ^If SQLite is compiled with -** the [SQLITE_THREADSAFE | SQLITE_THREADSAFE=0] compile-time option then -** the entire mutexing subsystem is omitted from the build and hence calls to -** [sqlite3_config()] with the SQLITE_CONFIG_GETMUTEX configuration option will -** return [SQLITE_ERROR].
    -** -** [[SQLITE_CONFIG_LOOKASIDE]]
    SQLITE_CONFIG_LOOKASIDE
    -**
    ^(This option takes two arguments that determine the default -** memory allocation for the lookaside memory allocator on each -** [database connection]. The first argument is the -** size of each lookaside buffer slot and the second is the number of -** slots allocated to each database connection.)^ ^(This option sets the -** default lookaside size. The [SQLITE_DBCONFIG_LOOKASIDE] -** verb to [sqlite3_db_config()] can be used to change the lookaside -** configuration on individual connections.)^
    -** -** [[SQLITE_CONFIG_PCACHE2]]
    SQLITE_CONFIG_PCACHE2
    -**
    ^(This option takes a single argument which is a pointer to -** an [sqlite3_pcache_methods2] object. This object specifies the interface -** to a custom page cache implementation.)^ ^SQLite makes a copy of the -** object and uses it for page cache memory allocations.
    -** -** [[SQLITE_CONFIG_GETPCACHE2]]
    SQLITE_CONFIG_GETPCACHE2
    -**
    ^(This option takes a single argument which is a pointer to an -** [sqlite3_pcache_methods2] object. SQLite copies of the current -** page cache implementation into that object.)^
    -** -** [[SQLITE_CONFIG_LOG]]
    SQLITE_CONFIG_LOG
    -**
    The SQLITE_CONFIG_LOG option is used to configure the SQLite -** global [error log]. -** (^The SQLITE_CONFIG_LOG option takes two arguments: a pointer to a -** function with a call signature of void(*)(void*,int,const char*), -** and a pointer to void. ^If the function pointer is not NULL, it is -** invoked by [sqlite3_log()] to process each logging event. ^If the -** function pointer is NULL, the [sqlite3_log()] interface becomes a no-op. -** ^The void pointer that is the second argument to SQLITE_CONFIG_LOG is -** passed through as the first parameter to the application-defined logger -** function whenever that function is invoked. ^The second parameter to -** the logger function is a copy of the first parameter to the corresponding -** [sqlite3_log()] call and is intended to be a [result code] or an -** [extended result code]. ^The third parameter passed to the logger is -** log message after formatting via [sqlite3_snprintf()]. -** The SQLite logging interface is not reentrant; the logger function -** supplied by the application must not invoke any SQLite interface. -** In a multi-threaded application, the application-defined logger -** function must be threadsafe.
    -** -** [[SQLITE_CONFIG_URI]]
    SQLITE_CONFIG_URI -**
    ^(This option takes a single argument of type int. If non-zero, then -** URI handling is globally enabled. If the parameter is zero, then URI handling -** is globally disabled.)^ ^If URI handling is globally enabled, all filenames -** passed to [sqlite3_open()], [sqlite3_open_v2()], [sqlite3_open16()] or -** specified as part of [ATTACH] commands are interpreted as URIs, regardless -** of whether or not the [SQLITE_OPEN_URI] flag is set when the database -** connection is opened. ^If it is globally disabled, filenames are -** only interpreted as URIs if the SQLITE_OPEN_URI flag is set when the -** database connection is opened. ^(By default, URI handling is globally -** disabled. The default value may be changed by compiling with the -** [SQLITE_USE_URI] symbol defined.)^ -** -** [[SQLITE_CONFIG_COVERING_INDEX_SCAN]]
    SQLITE_CONFIG_COVERING_INDEX_SCAN -**
    ^This option takes a single integer argument which is interpreted as -** a boolean in order to enable or disable the use of covering indices for -** full table scans in the query optimizer. ^The default setting is determined -** by the [SQLITE_ALLOW_COVERING_INDEX_SCAN] compile-time option, or is "on" -** if that compile-time option is omitted. -** The ability to disable the use of covering indices for full table scans -** is because some incorrectly coded legacy applications might malfunction -** when the optimization is enabled. Providing the ability to -** disable the optimization allows the older, buggy application code to work -** without change even with newer versions of SQLite. -** -** [[SQLITE_CONFIG_PCACHE]] [[SQLITE_CONFIG_GETPCACHE]] -**
    SQLITE_CONFIG_PCACHE and SQLITE_CONFIG_GETPCACHE -**
    These options are obsolete and should not be used by new code. -** They are retained for backwards compatibility but are now no-ops. -**
    -** -** [[SQLITE_CONFIG_SQLLOG]] -**
    SQLITE_CONFIG_SQLLOG -**
    This option is only available if sqlite is compiled with the -** [SQLITE_ENABLE_SQLLOG] pre-processor macro defined. The first argument should -** be a pointer to a function of type void(*)(void*,sqlite3*,const char*, int). -** The second should be of type (void*). The callback is invoked by the library -** in three separate circumstances, identified by the value passed as the -** fourth parameter. If the fourth parameter is 0, then the database connection -** passed as the second argument has just been opened. The third argument -** points to a buffer containing the name of the main database file. If the -** fourth parameter is 1, then the SQL statement that the third parameter -** points to has just been executed. Or, if the fourth parameter is 2, then -** the connection being passed as the second parameter is being closed. The -** third parameter is passed NULL In this case. An example of using this -** configuration option can be seen in the "test_sqllog.c" source file in -** the canonical SQLite source tree.
    -** -** [[SQLITE_CONFIG_MMAP_SIZE]] -**
    SQLITE_CONFIG_MMAP_SIZE -**
    ^SQLITE_CONFIG_MMAP_SIZE takes two 64-bit integer (sqlite3_int64) values -** that are the default mmap size limit (the default setting for -** [PRAGMA mmap_size]) and the maximum allowed mmap size limit. -** ^The default setting can be overridden by each database connection using -** either the [PRAGMA mmap_size] command, or by using the -** [SQLITE_FCNTL_MMAP_SIZE] file control. ^(The maximum allowed mmap size -** cannot be changed at run-time. Nor may the maximum allowed mmap size -** exceed the compile-time maximum mmap size set by the -** [SQLITE_MAX_MMAP_SIZE] compile-time option.)^ -** ^If either argument to this option is negative, then that argument is -** changed to its compile-time default. -** -** [[SQLITE_CONFIG_WIN32_HEAPSIZE]] -**
    SQLITE_CONFIG_WIN32_HEAPSIZE -**
    ^This option is only available if SQLite is compiled for Windows -** with the [SQLITE_WIN32_MALLOC] pre-processor macro defined. -** SQLITE_CONFIG_WIN32_HEAPSIZE takes a 32-bit unsigned integer value -** that specifies the maximum size of the created heap. -**
    -*/ -#define SQLITE_CONFIG_SINGLETHREAD 1 /* nil */ -#define SQLITE_CONFIG_MULTITHREAD 2 /* nil */ -#define SQLITE_CONFIG_SERIALIZED 3 /* nil */ -#define SQLITE_CONFIG_MALLOC 4 /* sqlite3_mem_methods* */ -#define SQLITE_CONFIG_GETMALLOC 5 /* sqlite3_mem_methods* */ -#define SQLITE_CONFIG_SCRATCH 6 /* void*, int sz, int N */ -#define SQLITE_CONFIG_PAGECACHE 7 /* void*, int sz, int N */ -#define SQLITE_CONFIG_HEAP 8 /* void*, int nByte, int min */ -#define SQLITE_CONFIG_MEMSTATUS 9 /* boolean */ -#define SQLITE_CONFIG_MUTEX 10 /* sqlite3_mutex_methods* */ -#define SQLITE_CONFIG_GETMUTEX 11 /* sqlite3_mutex_methods* */ -/* previously SQLITE_CONFIG_CHUNKALLOC 12 which is now unused. */ -#define SQLITE_CONFIG_LOOKASIDE 13 /* int int */ -#define SQLITE_CONFIG_PCACHE 14 /* no-op */ -#define SQLITE_CONFIG_GETPCACHE 15 /* no-op */ -#define SQLITE_CONFIG_LOG 16 /* xFunc, void* */ -#define SQLITE_CONFIG_URI 17 /* int */ -#define SQLITE_CONFIG_PCACHE2 18 /* sqlite3_pcache_methods2* */ -#define SQLITE_CONFIG_GETPCACHE2 19 /* sqlite3_pcache_methods2* */ -#define SQLITE_CONFIG_COVERING_INDEX_SCAN 20 /* int */ -#define SQLITE_CONFIG_SQLLOG 21 /* xSqllog, void* */ -#define SQLITE_CONFIG_MMAP_SIZE 22 /* sqlite3_int64, sqlite3_int64 */ -#define SQLITE_CONFIG_WIN32_HEAPSIZE 23 /* int nByte */ - -/* -** CAPI3REF: Database Connection Configuration Options -** -** These constants are the available integer configuration options that -** can be passed as the second argument to the [sqlite3_db_config()] interface. -** -** New configuration options may be added in future releases of SQLite. -** Existing configuration options might be discontinued. Applications -** should check the return code from [sqlite3_db_config()] to make sure that -** the call worked. ^The [sqlite3_db_config()] interface will return a -** non-zero [error code] if a discontinued or unsupported configuration option -** is invoked. -** -**
    -**
    SQLITE_DBCONFIG_LOOKASIDE
    -**
    ^This option takes three additional arguments that determine the -** [lookaside memory allocator] configuration for the [database connection]. -** ^The first argument (the third parameter to [sqlite3_db_config()] is a -** pointer to a memory buffer to use for lookaside memory. -** ^The first argument after the SQLITE_DBCONFIG_LOOKASIDE verb -** may be NULL in which case SQLite will allocate the -** lookaside buffer itself using [sqlite3_malloc()]. ^The second argument is the -** size of each lookaside buffer slot. ^The third argument is the number of -** slots. The size of the buffer in the first argument must be greater than -** or equal to the product of the second and third arguments. The buffer -** must be aligned to an 8-byte boundary. ^If the second argument to -** SQLITE_DBCONFIG_LOOKASIDE is not a multiple of 8, it is internally -** rounded down to the next smaller multiple of 8. ^(The lookaside memory -** configuration for a database connection can only be changed when that -** connection is not currently using lookaside memory, or in other words -** when the "current value" returned by -** [sqlite3_db_status](D,[SQLITE_CONFIG_LOOKASIDE],...) is zero. -** Any attempt to change the lookaside memory configuration when lookaside -** memory is in use leaves the configuration unchanged and returns -** [SQLITE_BUSY].)^
    -** -**
    SQLITE_DBCONFIG_ENABLE_FKEY
    -**
    ^This option is used to enable or disable the enforcement of -** [foreign key constraints]. There should be two additional arguments. -** The first argument is an integer which is 0 to disable FK enforcement, -** positive to enable FK enforcement or negative to leave FK enforcement -** unchanged. The second parameter is a pointer to an integer into which -** is written 0 or 1 to indicate whether FK enforcement is off or on -** following this call. The second parameter may be a NULL pointer, in -** which case the FK enforcement setting is not reported back.
    -** -**
    SQLITE_DBCONFIG_ENABLE_TRIGGER
    -**
    ^This option is used to enable or disable [CREATE TRIGGER | triggers]. -** There should be two additional arguments. -** The first argument is an integer which is 0 to disable triggers, -** positive to enable triggers or negative to leave the setting unchanged. -** The second parameter is a pointer to an integer into which -** is written 0 or 1 to indicate whether triggers are disabled or enabled -** following this call. The second parameter may be a NULL pointer, in -** which case the trigger setting is not reported back.
    -** -**
    -*/ -#define SQLITE_DBCONFIG_LOOKASIDE 1001 /* void* int int */ -#define SQLITE_DBCONFIG_ENABLE_FKEY 1002 /* int int* */ -#define SQLITE_DBCONFIG_ENABLE_TRIGGER 1003 /* int int* */ - - -/* -** CAPI3REF: Enable Or Disable Extended Result Codes -** -** ^The sqlite3_extended_result_codes() routine enables or disables the -** [extended result codes] feature of SQLite. ^The extended result -** codes are disabled by default for historical compatibility. -*/ -SQLITE_API int sqlite3_extended_result_codes(sqlite3*, int onoff); - -/* -** CAPI3REF: Last Insert Rowid -** -** ^Each entry in most SQLite tables (except for [WITHOUT ROWID] tables) -** has a unique 64-bit signed -** integer key called the [ROWID | "rowid"]. ^The rowid is always available -** as an undeclared column named ROWID, OID, or _ROWID_ as long as those -** names are not also used by explicitly declared columns. ^If -** the table has a column of type [INTEGER PRIMARY KEY] then that column -** is another alias for the rowid. -** -** ^The sqlite3_last_insert_rowid(D) interface returns the [rowid] of the -** most recent successful [INSERT] into a rowid table or [virtual table] -** on database connection D. -** ^Inserts into [WITHOUT ROWID] tables are not recorded. -** ^If no successful [INSERT]s into rowid tables -** have ever occurred on the database connection D, -** then sqlite3_last_insert_rowid(D) returns zero. -** -** ^(If an [INSERT] occurs within a trigger or within a [virtual table] -** method, then this routine will return the [rowid] of the inserted -** row as long as the trigger or virtual table method is running. -** But once the trigger or virtual table method ends, the value returned -** by this routine reverts to what it was before the trigger or virtual -** table method began.)^ -** -** ^An [INSERT] that fails due to a constraint violation is not a -** successful [INSERT] and does not change the value returned by this -** routine. ^Thus INSERT OR FAIL, INSERT OR IGNORE, INSERT OR ROLLBACK, -** and INSERT OR ABORT make no changes to the return value of this -** routine when their insertion fails. ^(When INSERT OR REPLACE -** encounters a constraint violation, it does not fail. The -** INSERT continues to completion after deleting rows that caused -** the constraint problem so INSERT OR REPLACE will always change -** the return value of this interface.)^ -** -** ^For the purposes of this routine, an [INSERT] is considered to -** be successful even if it is subsequently rolled back. -** -** This function is accessible to SQL statements via the -** [last_insert_rowid() SQL function]. -** -** If a separate thread performs a new [INSERT] on the same -** database connection while the [sqlite3_last_insert_rowid()] -** function is running and thus changes the last insert [rowid], -** then the value returned by [sqlite3_last_insert_rowid()] is -** unpredictable and might not equal either the old or the new -** last insert [rowid]. -*/ -SQLITE_API sqlite3_int64 sqlite3_last_insert_rowid(sqlite3*); - -/* -** CAPI3REF: Count The Number Of Rows Modified -** -** ^This function returns the number of database rows that were changed -** or inserted or deleted by the most recently completed SQL statement -** on the [database connection] specified by the first parameter. -** ^(Only changes that are directly specified by the [INSERT], [UPDATE], -** or [DELETE] statement are counted. Auxiliary changes caused by -** triggers or [foreign key actions] are not counted.)^ Use the -** [sqlite3_total_changes()] function to find the total number of changes -** including changes caused by triggers and foreign key actions. -** -** ^Changes to a view that are simulated by an [INSTEAD OF trigger] -** are not counted. Only real table changes are counted. -** -** ^(A "row change" is a change to a single row of a single table -** caused by an INSERT, DELETE, or UPDATE statement. Rows that -** are changed as side effects of [REPLACE] constraint resolution, -** rollback, ABORT processing, [DROP TABLE], or by any other -** mechanisms do not count as direct row changes.)^ -** -** A "trigger context" is a scope of execution that begins and -** ends with the script of a [CREATE TRIGGER | trigger]. -** Most SQL statements are -** evaluated outside of any trigger. This is the "top level" -** trigger context. If a trigger fires from the top level, a -** new trigger context is entered for the duration of that one -** trigger. Subtriggers create subcontexts for their duration. -** -** ^Calling [sqlite3_exec()] or [sqlite3_step()] recursively does -** not create a new trigger context. -** -** ^This function returns the number of direct row changes in the -** most recent INSERT, UPDATE, or DELETE statement within the same -** trigger context. -** -** ^Thus, when called from the top level, this function returns the -** number of changes in the most recent INSERT, UPDATE, or DELETE -** that also occurred at the top level. ^(Within the body of a trigger, -** the sqlite3_changes() interface can be called to find the number of -** changes in the most recently completed INSERT, UPDATE, or DELETE -** statement within the body of the same trigger. -** However, the number returned does not include changes -** caused by subtriggers since those have their own context.)^ -** -** See also the [sqlite3_total_changes()] interface, the -** [count_changes pragma], and the [changes() SQL function]. -** -** If a separate thread makes changes on the same database connection -** while [sqlite3_changes()] is running then the value returned -** is unpredictable and not meaningful. -*/ -SQLITE_API int sqlite3_changes(sqlite3*); - -/* -** CAPI3REF: Total Number Of Rows Modified -** -** ^This function returns the number of row changes caused by [INSERT], -** [UPDATE] or [DELETE] statements since the [database connection] was opened. -** ^(The count returned by sqlite3_total_changes() includes all changes -** from all [CREATE TRIGGER | trigger] contexts and changes made by -** [foreign key actions]. However, -** the count does not include changes used to implement [REPLACE] constraints, -** do rollbacks or ABORT processing, or [DROP TABLE] processing. The -** count does not include rows of views that fire an [INSTEAD OF trigger], -** though if the INSTEAD OF trigger makes changes of its own, those changes -** are counted.)^ -** ^The sqlite3_total_changes() function counts the changes as soon as -** the statement that makes them is completed (when the statement handle -** is passed to [sqlite3_reset()] or [sqlite3_finalize()]). -** -** See also the [sqlite3_changes()] interface, the -** [count_changes pragma], and the [total_changes() SQL function]. -** -** If a separate thread makes changes on the same database connection -** while [sqlite3_total_changes()] is running then the value -** returned is unpredictable and not meaningful. -*/ -SQLITE_API int sqlite3_total_changes(sqlite3*); - -/* -** CAPI3REF: Interrupt A Long-Running Query -** -** ^This function causes any pending database operation to abort and -** return at its earliest opportunity. This routine is typically -** called in response to a user action such as pressing "Cancel" -** or Ctrl-C where the user wants a long query operation to halt -** immediately. -** -** ^It is safe to call this routine from a thread different from the -** thread that is currently running the database operation. But it -** is not safe to call this routine with a [database connection] that -** is closed or might close before sqlite3_interrupt() returns. -** -** ^If an SQL operation is very nearly finished at the time when -** sqlite3_interrupt() is called, then it might not have an opportunity -** to be interrupted and might continue to completion. -** -** ^An SQL operation that is interrupted will return [SQLITE_INTERRUPT]. -** ^If the interrupted SQL operation is an INSERT, UPDATE, or DELETE -** that is inside an explicit transaction, then the entire transaction -** will be rolled back automatically. -** -** ^The sqlite3_interrupt(D) call is in effect until all currently running -** SQL statements on [database connection] D complete. ^Any new SQL statements -** that are started after the sqlite3_interrupt() call and before the -** running statements reaches zero are interrupted as if they had been -** running prior to the sqlite3_interrupt() call. ^New SQL statements -** that are started after the running statement count reaches zero are -** not effected by the sqlite3_interrupt(). -** ^A call to sqlite3_interrupt(D) that occurs when there are no running -** SQL statements is a no-op and has no effect on SQL statements -** that are started after the sqlite3_interrupt() call returns. -** -** If the database connection closes while [sqlite3_interrupt()] -** is running then bad things will likely happen. -*/ -SQLITE_API void sqlite3_interrupt(sqlite3*); - -/* -** CAPI3REF: Determine If An SQL Statement Is Complete -** -** These routines are useful during command-line input to determine if the -** currently entered text seems to form a complete SQL statement or -** if additional input is needed before sending the text into -** SQLite for parsing. ^These routines return 1 if the input string -** appears to be a complete SQL statement. ^A statement is judged to be -** complete if it ends with a semicolon token and is not a prefix of a -** well-formed CREATE TRIGGER statement. ^Semicolons that are embedded within -** string literals or quoted identifier names or comments are not -** independent tokens (they are part of the token in which they are -** embedded) and thus do not count as a statement terminator. ^Whitespace -** and comments that follow the final semicolon are ignored. -** -** ^These routines return 0 if the statement is incomplete. ^If a -** memory allocation fails, then SQLITE_NOMEM is returned. -** -** ^These routines do not parse the SQL statements thus -** will not detect syntactically incorrect SQL. -** -** ^(If SQLite has not been initialized using [sqlite3_initialize()] prior -** to invoking sqlite3_complete16() then sqlite3_initialize() is invoked -** automatically by sqlite3_complete16(). If that initialization fails, -** then the return value from sqlite3_complete16() will be non-zero -** regardless of whether or not the input SQL is complete.)^ -** -** The input to [sqlite3_complete()] must be a zero-terminated -** UTF-8 string. -** -** The input to [sqlite3_complete16()] must be a zero-terminated -** UTF-16 string in native byte order. -*/ -SQLITE_API int sqlite3_complete(const char *sql); -SQLITE_API int sqlite3_complete16(const void *sql); - -/* -** CAPI3REF: Register A Callback To Handle SQLITE_BUSY Errors -** -** ^This routine sets a callback function that might be invoked whenever -** an attempt is made to open a database table that another thread -** or process has locked. -** -** ^If the busy callback is NULL, then [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] -** is returned immediately upon encountering the lock. ^If the busy callback -** is not NULL, then the callback might be invoked with two arguments. -** -** ^The first argument to the busy handler is a copy of the void* pointer which -** is the third argument to sqlite3_busy_handler(). ^The second argument to -** the busy handler callback is the number of times that the busy handler has -** been invoked for this locking event. ^If the -** busy callback returns 0, then no additional attempts are made to -** access the database and [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED] is returned. -** ^If the callback returns non-zero, then another attempt -** is made to open the database for reading and the cycle repeats. -** -** The presence of a busy handler does not guarantee that it will be invoked -** when there is lock contention. ^If SQLite determines that invoking the busy -** handler could result in a deadlock, it will go ahead and return [SQLITE_BUSY] -** or [SQLITE_IOERR_BLOCKED] instead of invoking the busy handler. -** Consider a scenario where one process is holding a read lock that -** it is trying to promote to a reserved lock and -** a second process is holding a reserved lock that it is trying -** to promote to an exclusive lock. The first process cannot proceed -** because it is blocked by the second and the second process cannot -** proceed because it is blocked by the first. If both processes -** invoke the busy handlers, neither will make any progress. Therefore, -** SQLite returns [SQLITE_BUSY] for the first process, hoping that this -** will induce the first process to release its read lock and allow -** the second process to proceed. -** -** ^The default busy callback is NULL. -** -** ^The [SQLITE_BUSY] error is converted to [SQLITE_IOERR_BLOCKED] -** when SQLite is in the middle of a large transaction where all the -** changes will not fit into the in-memory cache. SQLite will -** already hold a RESERVED lock on the database file, but it needs -** to promote this lock to EXCLUSIVE so that it can spill cache -** pages into the database file without harm to concurrent -** readers. ^If it is unable to promote the lock, then the in-memory -** cache will be left in an inconsistent state and so the error -** code is promoted from the relatively benign [SQLITE_BUSY] to -** the more severe [SQLITE_IOERR_BLOCKED]. ^This error code promotion -** forces an automatic rollback of the changes. See the -** -** CorruptionFollowingBusyError wiki page for a discussion of why -** this is important. -** -** ^(There can only be a single busy handler defined for each -** [database connection]. Setting a new busy handler clears any -** previously set handler.)^ ^Note that calling [sqlite3_busy_timeout()] -** will also set or clear the busy handler. -** -** The busy callback should not take any actions which modify the -** database connection that invoked the busy handler. Any such actions -** result in undefined behavior. -** -** A busy handler must not close the database connection -** or [prepared statement] that invoked the busy handler. -*/ -SQLITE_API int sqlite3_busy_handler(sqlite3*, int(*)(void*,int), void*); - -/* -** CAPI3REF: Set A Busy Timeout -** -** ^This routine sets a [sqlite3_busy_handler | busy handler] that sleeps -** for a specified amount of time when a table is locked. ^The handler -** will sleep multiple times until at least "ms" milliseconds of sleeping -** have accumulated. ^After at least "ms" milliseconds of sleeping, -** the handler returns 0 which causes [sqlite3_step()] to return -** [SQLITE_BUSY] or [SQLITE_IOERR_BLOCKED]. -** -** ^Calling this routine with an argument less than or equal to zero -** turns off all busy handlers. -** -** ^(There can only be a single busy handler for a particular -** [database connection] any any given moment. If another busy handler -** was defined (using [sqlite3_busy_handler()]) prior to calling -** this routine, that other busy handler is cleared.)^ -*/ -SQLITE_API int sqlite3_busy_timeout(sqlite3*, int ms); - -/* -** CAPI3REF: Convenience Routines For Running Queries -** -** This is a legacy interface that is preserved for backwards compatibility. -** Use of this interface is not recommended. -** -** Definition: A result table is memory data structure created by the -** [sqlite3_get_table()] interface. A result table records the -** complete query results from one or more queries. -** -** The table conceptually has a number of rows and columns. But -** these numbers are not part of the result table itself. These -** numbers are obtained separately. Let N be the number of rows -** and M be the number of columns. -** -** A result table is an array of pointers to zero-terminated UTF-8 strings. -** There are (N+1)*M elements in the array. The first M pointers point -** to zero-terminated strings that contain the names of the columns. -** The remaining entries all point to query results. NULL values result -** in NULL pointers. All other values are in their UTF-8 zero-terminated -** string representation as returned by [sqlite3_column_text()]. -** -** A result table might consist of one or more memory allocations. -** It is not safe to pass a result table directly to [sqlite3_free()]. -** A result table should be deallocated using [sqlite3_free_table()]. -** -** ^(As an example of the result table format, suppose a query result -** is as follows: -** -**
    -**        Name        | Age
    -**        -----------------------
    -**        Alice       | 43
    -**        Bob         | 28
    -**        Cindy       | 21
    -** 
    -** -** There are two column (M==2) and three rows (N==3). Thus the -** result table has 8 entries. Suppose the result table is stored -** in an array names azResult. Then azResult holds this content: -** -**
    -**        azResult[0] = "Name";
    -**        azResult[1] = "Age";
    -**        azResult[2] = "Alice";
    -**        azResult[3] = "43";
    -**        azResult[4] = "Bob";
    -**        azResult[5] = "28";
    -**        azResult[6] = "Cindy";
    -**        azResult[7] = "21";
    -** 
    )^ -** -** ^The sqlite3_get_table() function evaluates one or more -** semicolon-separated SQL statements in the zero-terminated UTF-8 -** string of its 2nd parameter and returns a result table to the -** pointer given in its 3rd parameter. -** -** After the application has finished with the result from sqlite3_get_table(), -** it must pass the result table pointer to sqlite3_free_table() in order to -** release the memory that was malloced. Because of the way the -** [sqlite3_malloc()] happens within sqlite3_get_table(), the calling -** function must not try to call [sqlite3_free()] directly. Only -** [sqlite3_free_table()] is able to release the memory properly and safely. -** -** The sqlite3_get_table() interface is implemented as a wrapper around -** [sqlite3_exec()]. The sqlite3_get_table() routine does not have access -** to any internal data structures of SQLite. It uses only the public -** interface defined here. As a consequence, errors that occur in the -** wrapper layer outside of the internal [sqlite3_exec()] call are not -** reflected in subsequent calls to [sqlite3_errcode()] or -** [sqlite3_errmsg()]. -*/ -SQLITE_API int sqlite3_get_table( - sqlite3 *db, /* An open database */ - const char *zSql, /* SQL to be evaluated */ - char ***pazResult, /* Results of the query */ - int *pnRow, /* Number of result rows written here */ - int *pnColumn, /* Number of result columns written here */ - char **pzErrmsg /* Error msg written here */ -); -SQLITE_API void sqlite3_free_table(char **result); - -/* -** CAPI3REF: Formatted String Printing Functions -** -** These routines are work-alikes of the "printf()" family of functions -** from the standard C library. -** -** ^The sqlite3_mprintf() and sqlite3_vmprintf() routines write their -** results into memory obtained from [sqlite3_malloc()]. -** The strings returned by these two routines should be -** released by [sqlite3_free()]. ^Both routines return a -** NULL pointer if [sqlite3_malloc()] is unable to allocate enough -** memory to hold the resulting string. -** -** ^(The sqlite3_snprintf() routine is similar to "snprintf()" from -** the standard C library. The result is written into the -** buffer supplied as the second parameter whose size is given by -** the first parameter. Note that the order of the -** first two parameters is reversed from snprintf().)^ This is an -** historical accident that cannot be fixed without breaking -** backwards compatibility. ^(Note also that sqlite3_snprintf() -** returns a pointer to its buffer instead of the number of -** characters actually written into the buffer.)^ We admit that -** the number of characters written would be a more useful return -** value but we cannot change the implementation of sqlite3_snprintf() -** now without breaking compatibility. -** -** ^As long as the buffer size is greater than zero, sqlite3_snprintf() -** guarantees that the buffer is always zero-terminated. ^The first -** parameter "n" is the total size of the buffer, including space for -** the zero terminator. So the longest string that can be completely -** written will be n-1 characters. -** -** ^The sqlite3_vsnprintf() routine is a varargs version of sqlite3_snprintf(). -** -** These routines all implement some additional formatting -** options that are useful for constructing SQL statements. -** All of the usual printf() formatting options apply. In addition, there -** is are "%q", "%Q", and "%z" options. -** -** ^(The %q option works like %s in that it substitutes a nul-terminated -** string from the argument list. But %q also doubles every '\'' character. -** %q is designed for use inside a string literal.)^ By doubling each '\'' -** character it escapes that character and allows it to be inserted into -** the string. -** -** For example, assume the string variable zText contains text as follows: -** -**
    -**  char *zText = "It's a happy day!";
    -** 
    -** -** One can use this text in an SQL statement as follows: -** -**
    -**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText);
    -**  sqlite3_exec(db, zSQL, 0, 0, 0);
    -**  sqlite3_free(zSQL);
    -** 
    -** -** Because the %q format string is used, the '\'' character in zText -** is escaped and the SQL generated is as follows: -** -**
    -**  INSERT INTO table1 VALUES('It''s a happy day!')
    -** 
    -** -** This is correct. Had we used %s instead of %q, the generated SQL -** would have looked like this: -** -**
    -**  INSERT INTO table1 VALUES('It's a happy day!');
    -** 
    -** -** This second example is an SQL syntax error. As a general rule you should -** always use %q instead of %s when inserting text into a string literal. -** -** ^(The %Q option works like %q except it also adds single quotes around -** the outside of the total string. Additionally, if the parameter in the -** argument list is a NULL pointer, %Q substitutes the text "NULL" (without -** single quotes).)^ So, for example, one could say: -** -**
    -**  char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES(%Q)", zText);
    -**  sqlite3_exec(db, zSQL, 0, 0, 0);
    -**  sqlite3_free(zSQL);
    -** 
    -** -** The code above will render a correct SQL statement in the zSQL -** variable even if the zText variable is a NULL pointer. -** -** ^(The "%z" formatting option works like "%s" but with the -** addition that after the string has been read and copied into -** the result, [sqlite3_free()] is called on the input string.)^ -*/ -SQLITE_API char *sqlite3_mprintf(const char*,...); -SQLITE_API char *sqlite3_vmprintf(const char*, va_list); -SQLITE_API char *sqlite3_snprintf(int,char*,const char*, ...); -SQLITE_API char *sqlite3_vsnprintf(int,char*,const char*, va_list); - -/* -** CAPI3REF: Memory Allocation Subsystem -** -** The SQLite core uses these three routines for all of its own -** internal memory allocation needs. "Core" in the previous sentence -** does not include operating-system specific VFS implementation. The -** Windows VFS uses native malloc() and free() for some operations. -** -** ^The sqlite3_malloc() routine returns a pointer to a block -** of memory at least N bytes in length, where N is the parameter. -** ^If sqlite3_malloc() is unable to obtain sufficient free -** memory, it returns a NULL pointer. ^If the parameter N to -** sqlite3_malloc() is zero or negative then sqlite3_malloc() returns -** a NULL pointer. -** -** ^Calling sqlite3_free() with a pointer previously returned -** by sqlite3_malloc() or sqlite3_realloc() releases that memory so -** that it might be reused. ^The sqlite3_free() routine is -** a no-op if is called with a NULL pointer. Passing a NULL pointer -** to sqlite3_free() is harmless. After being freed, memory -** should neither be read nor written. Even reading previously freed -** memory might result in a segmentation fault or other severe error. -** Memory corruption, a segmentation fault, or other severe error -** might result if sqlite3_free() is called with a non-NULL pointer that -** was not obtained from sqlite3_malloc() or sqlite3_realloc(). -** -** ^(The sqlite3_realloc() interface attempts to resize a -** prior memory allocation to be at least N bytes, where N is the -** second parameter. The memory allocation to be resized is the first -** parameter.)^ ^ If the first parameter to sqlite3_realloc() -** is a NULL pointer then its behavior is identical to calling -** sqlite3_malloc(N) where N is the second parameter to sqlite3_realloc(). -** ^If the second parameter to sqlite3_realloc() is zero or -** negative then the behavior is exactly the same as calling -** sqlite3_free(P) where P is the first parameter to sqlite3_realloc(). -** ^sqlite3_realloc() returns a pointer to a memory allocation -** of at least N bytes in size or NULL if sufficient memory is unavailable. -** ^If M is the size of the prior allocation, then min(N,M) bytes -** of the prior allocation are copied into the beginning of buffer returned -** by sqlite3_realloc() and the prior allocation is freed. -** ^If sqlite3_realloc() returns NULL, then the prior allocation -** is not freed. -** -** ^The memory returned by sqlite3_malloc() and sqlite3_realloc() -** is always aligned to at least an 8 byte boundary, or to a -** 4 byte boundary if the [SQLITE_4_BYTE_ALIGNED_MALLOC] compile-time -** option is used. -** -** In SQLite version 3.5.0 and 3.5.1, it was possible to define -** the SQLITE_OMIT_MEMORY_ALLOCATION which would cause the built-in -** implementation of these routines to be omitted. That capability -** is no longer provided. Only built-in memory allocators can be used. -** -** Prior to SQLite version 3.7.10, the Windows OS interface layer called -** the system malloc() and free() directly when converting -** filenames between the UTF-8 encoding used by SQLite -** and whatever filename encoding is used by the particular Windows -** installation. Memory allocation errors were detected, but -** they were reported back as [SQLITE_CANTOPEN] or -** [SQLITE_IOERR] rather than [SQLITE_NOMEM]. -** -** The pointer arguments to [sqlite3_free()] and [sqlite3_realloc()] -** must be either NULL or else pointers obtained from a prior -** invocation of [sqlite3_malloc()] or [sqlite3_realloc()] that have -** not yet been released. -** -** The application must not read or write any part of -** a block of memory after it has been released using -** [sqlite3_free()] or [sqlite3_realloc()]. -*/ -SQLITE_API void *sqlite3_malloc(int); -SQLITE_API void *sqlite3_realloc(void*, int); -SQLITE_API void sqlite3_free(void*); - -/* -** CAPI3REF: Memory Allocator Statistics -** -** SQLite provides these two interfaces for reporting on the status -** of the [sqlite3_malloc()], [sqlite3_free()], and [sqlite3_realloc()] -** routines, which form the built-in memory allocation subsystem. -** -** ^The [sqlite3_memory_used()] routine returns the number of bytes -** of memory currently outstanding (malloced but not freed). -** ^The [sqlite3_memory_highwater()] routine returns the maximum -** value of [sqlite3_memory_used()] since the high-water mark -** was last reset. ^The values returned by [sqlite3_memory_used()] and -** [sqlite3_memory_highwater()] include any overhead -** added by SQLite in its implementation of [sqlite3_malloc()], -** but not overhead added by the any underlying system library -** routines that [sqlite3_malloc()] may call. -** -** ^The memory high-water mark is reset to the current value of -** [sqlite3_memory_used()] if and only if the parameter to -** [sqlite3_memory_highwater()] is true. ^The value returned -** by [sqlite3_memory_highwater(1)] is the high-water mark -** prior to the reset. -*/ -SQLITE_API sqlite3_int64 sqlite3_memory_used(void); -SQLITE_API sqlite3_int64 sqlite3_memory_highwater(int resetFlag); - -/* -** CAPI3REF: Pseudo-Random Number Generator -** -** SQLite contains a high-quality pseudo-random number generator (PRNG) used to -** select random [ROWID | ROWIDs] when inserting new records into a table that -** already uses the largest possible [ROWID]. The PRNG is also used for -** the build-in random() and randomblob() SQL functions. This interface allows -** applications to access the same PRNG for other purposes. -** -** ^A call to this routine stores N bytes of randomness into buffer P. -** ^If N is less than one, then P can be a NULL pointer. -** -** ^If this routine has not been previously called or if the previous -** call had N less than one, then the PRNG is seeded using randomness -** obtained from the xRandomness method of the default [sqlite3_vfs] object. -** ^If the previous call to this routine had an N of 1 or more then -** the pseudo-randomness is generated -** internally and without recourse to the [sqlite3_vfs] xRandomness -** method. -*/ -SQLITE_API void sqlite3_randomness(int N, void *P); - -/* -** CAPI3REF: Compile-Time Authorization Callbacks -** -** ^This routine registers an authorizer callback with a particular -** [database connection], supplied in the first argument. -** ^The authorizer callback is invoked as SQL statements are being compiled -** by [sqlite3_prepare()] or its variants [sqlite3_prepare_v2()], -** [sqlite3_prepare16()] and [sqlite3_prepare16_v2()]. ^At various -** points during the compilation process, as logic is being created -** to perform various actions, the authorizer callback is invoked to -** see if those actions are allowed. ^The authorizer callback should -** return [SQLITE_OK] to allow the action, [SQLITE_IGNORE] to disallow the -** specific action but allow the SQL statement to continue to be -** compiled, or [SQLITE_DENY] to cause the entire SQL statement to be -** rejected with an error. ^If the authorizer callback returns -** any value other than [SQLITE_IGNORE], [SQLITE_OK], or [SQLITE_DENY] -** then the [sqlite3_prepare_v2()] or equivalent call that triggered -** the authorizer will fail with an error message. -** -** When the callback returns [SQLITE_OK], that means the operation -** requested is ok. ^When the callback returns [SQLITE_DENY], the -** [sqlite3_prepare_v2()] or equivalent call that triggered the -** authorizer will fail with an error message explaining that -** access is denied. -** -** ^The first parameter to the authorizer callback is a copy of the third -** parameter to the sqlite3_set_authorizer() interface. ^The second parameter -** to the callback is an integer [SQLITE_COPY | action code] that specifies -** the particular action to be authorized. ^The third through sixth parameters -** to the callback are zero-terminated strings that contain additional -** details about the action to be authorized. -** -** ^If the action code is [SQLITE_READ] -** and the callback returns [SQLITE_IGNORE] then the -** [prepared statement] statement is constructed to substitute -** a NULL value in place of the table column that would have -** been read if [SQLITE_OK] had been returned. The [SQLITE_IGNORE] -** return can be used to deny an untrusted user access to individual -** columns of a table. -** ^If the action code is [SQLITE_DELETE] and the callback returns -** [SQLITE_IGNORE] then the [DELETE] operation proceeds but the -** [truncate optimization] is disabled and all rows are deleted individually. -** -** An authorizer is used when [sqlite3_prepare | preparing] -** SQL statements from an untrusted source, to ensure that the SQL statements -** do not try to access data they are not allowed to see, or that they do not -** try to execute malicious statements that damage the database. For -** example, an application may allow a user to enter arbitrary -** SQL queries for evaluation by a database. But the application does -** not want the user to be able to make arbitrary changes to the -** database. An authorizer could then be put in place while the -** user-entered SQL is being [sqlite3_prepare | prepared] that -** disallows everything except [SELECT] statements. -** -** Applications that need to process SQL from untrusted sources -** might also consider lowering resource limits using [sqlite3_limit()] -** and limiting database size using the [max_page_count] [PRAGMA] -** in addition to using an authorizer. -** -** ^(Only a single authorizer can be in place on a database connection -** at a time. Each call to sqlite3_set_authorizer overrides the -** previous call.)^ ^Disable the authorizer by installing a NULL callback. -** The authorizer is disabled by default. -** -** The authorizer callback must not do anything that will modify -** the database connection that invoked the authorizer callback. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -** ^When [sqlite3_prepare_v2()] is used to prepare a statement, the -** statement might be re-prepared during [sqlite3_step()] due to a -** schema change. Hence, the application should ensure that the -** correct authorizer callback remains in place during the [sqlite3_step()]. -** -** ^Note that the authorizer callback is invoked only during -** [sqlite3_prepare()] or its variants. Authorization is not -** performed during statement evaluation in [sqlite3_step()], unless -** as stated in the previous paragraph, sqlite3_step() invokes -** sqlite3_prepare_v2() to reprepare a statement after a schema change. -*/ -SQLITE_API int sqlite3_set_authorizer( - sqlite3*, - int (*xAuth)(void*,int,const char*,const char*,const char*,const char*), - void *pUserData -); - -/* -** CAPI3REF: Authorizer Return Codes -** -** The [sqlite3_set_authorizer | authorizer callback function] must -** return either [SQLITE_OK] or one of these two constants in order -** to signal SQLite whether or not the action is permitted. See the -** [sqlite3_set_authorizer | authorizer documentation] for additional -** information. -** -** Note that SQLITE_IGNORE is also used as a [SQLITE_ROLLBACK | return code] -** from the [sqlite3_vtab_on_conflict()] interface. -*/ -#define SQLITE_DENY 1 /* Abort the SQL statement with an error */ -#define SQLITE_IGNORE 2 /* Don't allow access, but don't generate an error */ - -/* -** CAPI3REF: Authorizer Action Codes -** -** The [sqlite3_set_authorizer()] interface registers a callback function -** that is invoked to authorize certain SQL statement actions. The -** second parameter to the callback is an integer code that specifies -** what action is being authorized. These are the integer action codes that -** the authorizer callback may be passed. -** -** These action code values signify what kind of operation is to be -** authorized. The 3rd and 4th parameters to the authorization -** callback function will be parameters or NULL depending on which of these -** codes is used as the second parameter. ^(The 5th parameter to the -** authorizer callback is the name of the database ("main", "temp", -** etc.) if applicable.)^ ^The 6th parameter to the authorizer callback -** is the name of the inner-most trigger or view that is responsible for -** the access attempt or NULL if this access attempt is directly from -** top-level SQL code. -*/ -/******************************************* 3rd ************ 4th ***********/ -#define SQLITE_CREATE_INDEX 1 /* Index Name Table Name */ -#define SQLITE_CREATE_TABLE 2 /* Table Name NULL */ -#define SQLITE_CREATE_TEMP_INDEX 3 /* Index Name Table Name */ -#define SQLITE_CREATE_TEMP_TABLE 4 /* Table Name NULL */ -#define SQLITE_CREATE_TEMP_TRIGGER 5 /* Trigger Name Table Name */ -#define SQLITE_CREATE_TEMP_VIEW 6 /* View Name NULL */ -#define SQLITE_CREATE_TRIGGER 7 /* Trigger Name Table Name */ -#define SQLITE_CREATE_VIEW 8 /* View Name NULL */ -#define SQLITE_DELETE 9 /* Table Name NULL */ -#define SQLITE_DROP_INDEX 10 /* Index Name Table Name */ -#define SQLITE_DROP_TABLE 11 /* Table Name NULL */ -#define SQLITE_DROP_TEMP_INDEX 12 /* Index Name Table Name */ -#define SQLITE_DROP_TEMP_TABLE 13 /* Table Name NULL */ -#define SQLITE_DROP_TEMP_TRIGGER 14 /* Trigger Name Table Name */ -#define SQLITE_DROP_TEMP_VIEW 15 /* View Name NULL */ -#define SQLITE_DROP_TRIGGER 16 /* Trigger Name Table Name */ -#define SQLITE_DROP_VIEW 17 /* View Name NULL */ -#define SQLITE_INSERT 18 /* Table Name NULL */ -#define SQLITE_PRAGMA 19 /* Pragma Name 1st arg or NULL */ -#define SQLITE_READ 20 /* Table Name Column Name */ -#define SQLITE_SELECT 21 /* NULL NULL */ -#define SQLITE_TRANSACTION 22 /* Operation NULL */ -#define SQLITE_UPDATE 23 /* Table Name Column Name */ -#define SQLITE_ATTACH 24 /* Filename NULL */ -#define SQLITE_DETACH 25 /* Database Name NULL */ -#define SQLITE_ALTER_TABLE 26 /* Database Name Table Name */ -#define SQLITE_REINDEX 27 /* Index Name NULL */ -#define SQLITE_ANALYZE 28 /* Table Name NULL */ -#define SQLITE_CREATE_VTABLE 29 /* Table Name Module Name */ -#define SQLITE_DROP_VTABLE 30 /* Table Name Module Name */ -#define SQLITE_FUNCTION 31 /* NULL Function Name */ -#define SQLITE_SAVEPOINT 32 /* Operation Savepoint Name */ -#define SQLITE_COPY 0 /* No longer used */ -#define SQLITE_RECURSIVE 33 /* NULL NULL */ - -/* -** CAPI3REF: Tracing And Profiling Functions -** -** These routines register callback functions that can be used for -** tracing and profiling the execution of SQL statements. -** -** ^The callback function registered by sqlite3_trace() is invoked at -** various times when an SQL statement is being run by [sqlite3_step()]. -** ^The sqlite3_trace() callback is invoked with a UTF-8 rendering of the -** SQL statement text as the statement first begins executing. -** ^(Additional sqlite3_trace() callbacks might occur -** as each triggered subprogram is entered. The callbacks for triggers -** contain a UTF-8 SQL comment that identifies the trigger.)^ -** -** The [SQLITE_TRACE_SIZE_LIMIT] compile-time option can be used to limit -** the length of [bound parameter] expansion in the output of sqlite3_trace(). -** -** ^The callback function registered by sqlite3_profile() is invoked -** as each SQL statement finishes. ^The profile callback contains -** the original statement text and an estimate of wall-clock time -** of how long that statement took to run. ^The profile callback -** time is in units of nanoseconds, however the current implementation -** is only capable of millisecond resolution so the six least significant -** digits in the time are meaningless. Future versions of SQLite -** might provide greater resolution on the profiler callback. The -** sqlite3_profile() function is considered experimental and is -** subject to change in future versions of SQLite. -*/ -SQLITE_API void *sqlite3_trace(sqlite3*, void(*xTrace)(void*,const char*), void*); -SQLITE_API SQLITE_EXPERIMENTAL void *sqlite3_profile(sqlite3*, - void(*xProfile)(void*,const char*,sqlite3_uint64), void*); - -/* -** CAPI3REF: Query Progress Callbacks -** -** ^The sqlite3_progress_handler(D,N,X,P) interface causes the callback -** function X to be invoked periodically during long running calls to -** [sqlite3_exec()], [sqlite3_step()] and [sqlite3_get_table()] for -** database connection D. An example use for this -** interface is to keep a GUI updated during a large query. -** -** ^The parameter P is passed through as the only parameter to the -** callback function X. ^The parameter N is the approximate number of -** [virtual machine instructions] that are evaluated between successive -** invocations of the callback X. ^If N is less than one then the progress -** handler is disabled. -** -** ^Only a single progress handler may be defined at one time per -** [database connection]; setting a new progress handler cancels the -** old one. ^Setting parameter X to NULL disables the progress handler. -** ^The progress handler is also disabled by setting N to a value less -** than 1. -** -** ^If the progress callback returns non-zero, the operation is -** interrupted. This feature can be used to implement a -** "Cancel" button on a GUI progress dialog box. -** -** The progress handler callback must not do anything that will modify -** the database connection that invoked the progress handler. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -*/ -SQLITE_API void sqlite3_progress_handler(sqlite3*, int, int(*)(void*), void*); - -/* -** CAPI3REF: Opening A New Database Connection -** -** ^These routines open an SQLite database file as specified by the -** filename argument. ^The filename argument is interpreted as UTF-8 for -** sqlite3_open() and sqlite3_open_v2() and as UTF-16 in the native byte -** order for sqlite3_open16(). ^(A [database connection] handle is usually -** returned in *ppDb, even if an error occurs. The only exception is that -** if SQLite is unable to allocate memory to hold the [sqlite3] object, -** a NULL will be written into *ppDb instead of a pointer to the [sqlite3] -** object.)^ ^(If the database is opened (and/or created) successfully, then -** [SQLITE_OK] is returned. Otherwise an [error code] is returned.)^ ^The -** [sqlite3_errmsg()] or [sqlite3_errmsg16()] routines can be used to obtain -** an English language description of the error following a failure of any -** of the sqlite3_open() routines. -** -** ^The default encoding for the database will be UTF-8 if -** sqlite3_open() or sqlite3_open_v2() is called and -** UTF-16 in the native byte order if sqlite3_open16() is used. -** -** Whether or not an error occurs when it is opened, resources -** associated with the [database connection] handle should be released by -** passing it to [sqlite3_close()] when it is no longer required. -** -** The sqlite3_open_v2() interface works like sqlite3_open() -** except that it accepts two additional parameters for additional control -** over the new database connection. ^(The flags parameter to -** sqlite3_open_v2() can take one of -** the following three values, optionally combined with the -** [SQLITE_OPEN_NOMUTEX], [SQLITE_OPEN_FULLMUTEX], [SQLITE_OPEN_SHAREDCACHE], -** [SQLITE_OPEN_PRIVATECACHE], and/or [SQLITE_OPEN_URI] flags:)^ -** -**
    -** ^(
    [SQLITE_OPEN_READONLY]
    -**
    The database is opened in read-only mode. If the database does not -** already exist, an error is returned.
    )^ -** -** ^(
    [SQLITE_OPEN_READWRITE]
    -**
    The database is opened for reading and writing if possible, or reading -** only if the file is write protected by the operating system. In either -** case the database must already exist, otherwise an error is returned.
    )^ -** -** ^(
    [SQLITE_OPEN_READWRITE] | [SQLITE_OPEN_CREATE]
    -**
    The database is opened for reading and writing, and is created if -** it does not already exist. This is the behavior that is always used for -** sqlite3_open() and sqlite3_open16().
    )^ -**
    -** -** If the 3rd parameter to sqlite3_open_v2() is not one of the -** combinations shown above optionally combined with other -** [SQLITE_OPEN_READONLY | SQLITE_OPEN_* bits] -** then the behavior is undefined. -** -** ^If the [SQLITE_OPEN_NOMUTEX] flag is set, then the database connection -** opens in the multi-thread [threading mode] as long as the single-thread -** mode has not been set at compile-time or start-time. ^If the -** [SQLITE_OPEN_FULLMUTEX] flag is set then the database connection opens -** in the serialized [threading mode] unless single-thread was -** previously selected at compile-time or start-time. -** ^The [SQLITE_OPEN_SHAREDCACHE] flag causes the database connection to be -** eligible to use [shared cache mode], regardless of whether or not shared -** cache is enabled using [sqlite3_enable_shared_cache()]. ^The -** [SQLITE_OPEN_PRIVATECACHE] flag causes the database connection to not -** participate in [shared cache mode] even if it is enabled. -** -** ^The fourth parameter to sqlite3_open_v2() is the name of the -** [sqlite3_vfs] object that defines the operating system interface that -** the new database connection should use. ^If the fourth parameter is -** a NULL pointer then the default [sqlite3_vfs] object is used. -** -** ^If the filename is ":memory:", then a private, temporary in-memory database -** is created for the connection. ^This in-memory database will vanish when -** the database connection is closed. Future versions of SQLite might -** make use of additional special filenames that begin with the ":" character. -** It is recommended that when a database filename actually does begin with -** a ":" character you should prefix the filename with a pathname such as -** "./" to avoid ambiguity. -** -** ^If the filename is an empty string, then a private, temporary -** on-disk database will be created. ^This private database will be -** automatically deleted as soon as the database connection is closed. -** -** [[URI filenames in sqlite3_open()]]

    URI Filenames

    -** -** ^If [URI filename] interpretation is enabled, and the filename argument -** begins with "file:", then the filename is interpreted as a URI. ^URI -** filename interpretation is enabled if the [SQLITE_OPEN_URI] flag is -** set in the fourth argument to sqlite3_open_v2(), or if it has -** been enabled globally using the [SQLITE_CONFIG_URI] option with the -** [sqlite3_config()] method or by the [SQLITE_USE_URI] compile-time option. -** As of SQLite version 3.7.7, URI filename interpretation is turned off -** by default, but future releases of SQLite might enable URI filename -** interpretation by default. See "[URI filenames]" for additional -** information. -** -** URI filenames are parsed according to RFC 3986. ^If the URI contains an -** authority, then it must be either an empty string or the string -** "localhost". ^If the authority is not an empty string or "localhost", an -** error is returned to the caller. ^The fragment component of a URI, if -** present, is ignored. -** -** ^SQLite uses the path component of the URI as the name of the disk file -** which contains the database. ^If the path begins with a '/' character, -** then it is interpreted as an absolute path. ^If the path does not begin -** with a '/' (meaning that the authority section is omitted from the URI) -** then the path is interpreted as a relative path. -** ^On windows, the first component of an absolute path -** is a drive specification (e.g. "C:"). -** -** [[core URI query parameters]] -** The query component of a URI may contain parameters that are interpreted -** either by SQLite itself, or by a [VFS | custom VFS implementation]. -** SQLite interprets the following three query parameters: -** -**
      -**
    • vfs: ^The "vfs" parameter may be used to specify the name of -** a VFS object that provides the operating system interface that should -** be used to access the database file on disk. ^If this option is set to -** an empty string the default VFS object is used. ^Specifying an unknown -** VFS is an error. ^If sqlite3_open_v2() is used and the vfs option is -** present, then the VFS specified by the option takes precedence over -** the value passed as the fourth parameter to sqlite3_open_v2(). -** -**
    • mode: ^(The mode parameter may be set to either "ro", "rw", -** "rwc", or "memory". Attempting to set it to any other value is -** an error)^. -** ^If "ro" is specified, then the database is opened for read-only -** access, just as if the [SQLITE_OPEN_READONLY] flag had been set in the -** third argument to sqlite3_open_v2(). ^If the mode option is set to -** "rw", then the database is opened for read-write (but not create) -** access, as if SQLITE_OPEN_READWRITE (but not SQLITE_OPEN_CREATE) had -** been set. ^Value "rwc" is equivalent to setting both -** SQLITE_OPEN_READWRITE and SQLITE_OPEN_CREATE. ^If the mode option is -** set to "memory" then a pure [in-memory database] that never reads -** or writes from disk is used. ^It is an error to specify a value for -** the mode parameter that is less restrictive than that specified by -** the flags passed in the third parameter to sqlite3_open_v2(). -** -**
    • cache: ^The cache parameter may be set to either "shared" or -** "private". ^Setting it to "shared" is equivalent to setting the -** SQLITE_OPEN_SHAREDCACHE bit in the flags argument passed to -** sqlite3_open_v2(). ^Setting the cache parameter to "private" is -** equivalent to setting the SQLITE_OPEN_PRIVATECACHE bit. -** ^If sqlite3_open_v2() is used and the "cache" parameter is present in -** a URI filename, its value overrides any behavior requested by setting -** SQLITE_OPEN_PRIVATECACHE or SQLITE_OPEN_SHAREDCACHE flag. -**
    -** -** ^Specifying an unknown parameter in the query component of a URI is not an -** error. Future versions of SQLite might understand additional query -** parameters. See "[query parameters with special meaning to SQLite]" for -** additional information. -** -** [[URI filename examples]]

    URI filename examples

    -** -**
    -**
    URI filenames Results -**
    file:data.db -** Open the file "data.db" in the current directory. -**
    file:/home/fred/data.db
    -** file:///home/fred/data.db
    -** file://localhost/home/fred/data.db
    -** Open the database file "/home/fred/data.db". -**
    file://darkstar/home/fred/data.db -** An error. "darkstar" is not a recognized authority. -**
    -** file:///C:/Documents%20and%20Settings/fred/Desktop/data.db -** Windows only: Open the file "data.db" on fred's desktop on drive -** C:. Note that the %20 escaping in this example is not strictly -** necessary - space characters can be used literally -** in URI filenames. -**
    file:data.db?mode=ro&cache=private -** Open file "data.db" in the current directory for read-only access. -** Regardless of whether or not shared-cache mode is enabled by -** default, use a private cache. -**
    file:/home/fred/data.db?vfs=unix-nolock -** Open file "/home/fred/data.db". Use the special VFS "unix-nolock". -**
    file:data.db?mode=readonly -** An error. "readonly" is not a valid option for the "mode" parameter. -**
    -** -** ^URI hexadecimal escape sequences (%HH) are supported within the path and -** query components of a URI. A hexadecimal escape sequence consists of a -** percent sign - "%" - followed by exactly two hexadecimal digits -** specifying an octet value. ^Before the path or query components of a -** URI filename are interpreted, they are encoded using UTF-8 and all -** hexadecimal escape sequences replaced by a single byte containing the -** corresponding octet. If this process generates an invalid UTF-8 encoding, -** the results are undefined. -** -** Note to Windows users: The encoding used for the filename argument -** of sqlite3_open() and sqlite3_open_v2() must be UTF-8, not whatever -** codepage is currently defined. Filenames containing international -** characters must be converted to UTF-8 prior to passing them into -** sqlite3_open() or sqlite3_open_v2(). -** -** Note to Windows Runtime users: The temporary directory must be set -** prior to calling sqlite3_open() or sqlite3_open_v2(). Otherwise, various -** features that require the use of temporary files may fail. -** -** See also: [sqlite3_temp_directory] -*/ -SQLITE_API int sqlite3_open( - const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb /* OUT: SQLite db handle */ -); -SQLITE_API int sqlite3_open16( - const void *filename, /* Database filename (UTF-16) */ - sqlite3 **ppDb /* OUT: SQLite db handle */ -); -SQLITE_API int sqlite3_open_v2( - const char *filename, /* Database filename (UTF-8) */ - sqlite3 **ppDb, /* OUT: SQLite db handle */ - int flags, /* Flags */ - const char *zVfs /* Name of VFS module to use */ -); - -/* -** CAPI3REF: Obtain Values For URI Parameters -** -** These are utility routines, useful to VFS implementations, that check -** to see if a database file was a URI that contained a specific query -** parameter, and if so obtains the value of that query parameter. -** -** If F is the database filename pointer passed into the xOpen() method of -** a VFS implementation when the flags parameter to xOpen() has one or -** more of the [SQLITE_OPEN_URI] or [SQLITE_OPEN_MAIN_DB] bits set and -** P is the name of the query parameter, then -** sqlite3_uri_parameter(F,P) returns the value of the P -** parameter if it exists or a NULL pointer if P does not appear as a -** query parameter on F. If P is a query parameter of F -** has no explicit value, then sqlite3_uri_parameter(F,P) returns -** a pointer to an empty string. -** -** The sqlite3_uri_boolean(F,P,B) routine assumes that P is a boolean -** parameter and returns true (1) or false (0) according to the value -** of P. The sqlite3_uri_boolean(F,P,B) routine returns true (1) if the -** value of query parameter P is one of "yes", "true", or "on" in any -** case or if the value begins with a non-zero number. The -** sqlite3_uri_boolean(F,P,B) routines returns false (0) if the value of -** query parameter P is one of "no", "false", or "off" in any case or -** if the value begins with a numeric zero. If P is not a query -** parameter on F or if the value of P is does not match any of the -** above, then sqlite3_uri_boolean(F,P,B) returns (B!=0). -** -** The sqlite3_uri_int64(F,P,D) routine converts the value of P into a -** 64-bit signed integer and returns that integer, or D if P does not -** exist. If the value of P is something other than an integer, then -** zero is returned. -** -** If F is a NULL pointer, then sqlite3_uri_parameter(F,P) returns NULL and -** sqlite3_uri_boolean(F,P,B) returns B. If F is not a NULL pointer and -** is not a database file pathname pointer that SQLite passed into the xOpen -** VFS method, then the behavior of this routine is undefined and probably -** undesirable. -*/ -SQLITE_API const char *sqlite3_uri_parameter(const char *zFilename, const char *zParam); -SQLITE_API int sqlite3_uri_boolean(const char *zFile, const char *zParam, int bDefault); -SQLITE_API sqlite3_int64 sqlite3_uri_int64(const char*, const char*, sqlite3_int64); - - -/* -** CAPI3REF: Error Codes And Messages -** -** ^The sqlite3_errcode() interface returns the numeric [result code] or -** [extended result code] for the most recent failed sqlite3_* API call -** associated with a [database connection]. If a prior API call failed -** but the most recent API call succeeded, the return value from -** sqlite3_errcode() is undefined. ^The sqlite3_extended_errcode() -** interface is the same except that it always returns the -** [extended result code] even when extended result codes are -** disabled. -** -** ^The sqlite3_errmsg() and sqlite3_errmsg16() return English-language -** text that describes the error, as either UTF-8 or UTF-16 respectively. -** ^(Memory to hold the error message string is managed internally. -** The application does not need to worry about freeing the result. -** However, the error string might be overwritten or deallocated by -** subsequent calls to other SQLite interface functions.)^ -** -** ^The sqlite3_errstr() interface returns the English-language text -** that describes the [result code], as UTF-8. -** ^(Memory to hold the error message string is managed internally -** and must not be freed by the application)^. -** -** When the serialized [threading mode] is in use, it might be the -** case that a second error occurs on a separate thread in between -** the time of the first error and the call to these interfaces. -** When that happens, the second error will be reported since these -** interfaces always report the most recent result. To avoid -** this, each thread can obtain exclusive use of the [database connection] D -** by invoking [sqlite3_mutex_enter]([sqlite3_db_mutex](D)) before beginning -** to use D and invoking [sqlite3_mutex_leave]([sqlite3_db_mutex](D)) after -** all calls to the interfaces listed here are completed. -** -** If an interface fails with SQLITE_MISUSE, that means the interface -** was invoked incorrectly by the application. In that case, the -** error code and message may or may not be set. -*/ -SQLITE_API int sqlite3_errcode(sqlite3 *db); -SQLITE_API int sqlite3_extended_errcode(sqlite3 *db); -SQLITE_API const char *sqlite3_errmsg(sqlite3*); -SQLITE_API const void *sqlite3_errmsg16(sqlite3*); -SQLITE_API const char *sqlite3_errstr(int); - -/* -** CAPI3REF: SQL Statement Object -** KEYWORDS: {prepared statement} {prepared statements} -** -** An instance of this object represents a single SQL statement. -** This object is variously known as a "prepared statement" or a -** "compiled SQL statement" or simply as a "statement". -** -** The life of a statement object goes something like this: -** -**
      -**
    1. Create the object using [sqlite3_prepare_v2()] or a related -** function. -**
    2. Bind values to [host parameters] using the sqlite3_bind_*() -** interfaces. -**
    3. Run the SQL by calling [sqlite3_step()] one or more times. -**
    4. Reset the statement using [sqlite3_reset()] then go back -** to step 2. Do this zero or more times. -**
    5. Destroy the object using [sqlite3_finalize()]. -**
    -** -** Refer to documentation on individual methods above for additional -** information. -*/ -typedef struct sqlite3_stmt sqlite3_stmt; - -/* -** CAPI3REF: Run-time Limits -** -** ^(This interface allows the size of various constructs to be limited -** on a connection by connection basis. The first parameter is the -** [database connection] whose limit is to be set or queried. The -** second parameter is one of the [limit categories] that define a -** class of constructs to be size limited. The third parameter is the -** new limit for that construct.)^ -** -** ^If the new limit is a negative number, the limit is unchanged. -** ^(For each limit category SQLITE_LIMIT_NAME there is a -** [limits | hard upper bound] -** set at compile-time by a C preprocessor macro called -** [limits | SQLITE_MAX_NAME]. -** (The "_LIMIT_" in the name is changed to "_MAX_".))^ -** ^Attempts to increase a limit above its hard upper bound are -** silently truncated to the hard upper bound. -** -** ^Regardless of whether or not the limit was changed, the -** [sqlite3_limit()] interface returns the prior value of the limit. -** ^Hence, to find the current value of a limit without changing it, -** simply invoke this interface with the third parameter set to -1. -** -** Run-time limits are intended for use in applications that manage -** both their own internal database and also databases that are controlled -** by untrusted external sources. An example application might be a -** web browser that has its own databases for storing history and -** separate databases controlled by JavaScript applications downloaded -** off the Internet. The internal databases can be given the -** large, default limits. Databases managed by external sources can -** be given much smaller limits designed to prevent a denial of service -** attack. Developers might also want to use the [sqlite3_set_authorizer()] -** interface to further control untrusted SQL. The size of the database -** created by an untrusted script can be contained using the -** [max_page_count] [PRAGMA]. -** -** New run-time limit categories may be added in future releases. -*/ -SQLITE_API int sqlite3_limit(sqlite3*, int id, int newVal); - -/* -** CAPI3REF: Run-Time Limit Categories -** KEYWORDS: {limit category} {*limit categories} -** -** These constants define various performance limits -** that can be lowered at run-time using [sqlite3_limit()]. -** The synopsis of the meanings of the various limits is shown below. -** Additional information is available at [limits | Limits in SQLite]. -** -**
    -** [[SQLITE_LIMIT_LENGTH]] ^(
    SQLITE_LIMIT_LENGTH
    -**
    The maximum size of any string or BLOB or table row, in bytes.
    )^ -** -** [[SQLITE_LIMIT_SQL_LENGTH]] ^(
    SQLITE_LIMIT_SQL_LENGTH
    -**
    The maximum length of an SQL statement, in bytes.
    )^ -** -** [[SQLITE_LIMIT_COLUMN]] ^(
    SQLITE_LIMIT_COLUMN
    -**
    The maximum number of columns in a table definition or in the -** result set of a [SELECT] or the maximum number of columns in an index -** or in an ORDER BY or GROUP BY clause.
    )^ -** -** [[SQLITE_LIMIT_EXPR_DEPTH]] ^(
    SQLITE_LIMIT_EXPR_DEPTH
    -**
    The maximum depth of the parse tree on any expression.
    )^ -** -** [[SQLITE_LIMIT_COMPOUND_SELECT]] ^(
    SQLITE_LIMIT_COMPOUND_SELECT
    -**
    The maximum number of terms in a compound SELECT statement.
    )^ -** -** [[SQLITE_LIMIT_VDBE_OP]] ^(
    SQLITE_LIMIT_VDBE_OP
    -**
    The maximum number of instructions in a virtual machine program -** used to implement an SQL statement. This limit is not currently -** enforced, though that might be added in some future release of -** SQLite.
    )^ -** -** [[SQLITE_LIMIT_FUNCTION_ARG]] ^(
    SQLITE_LIMIT_FUNCTION_ARG
    -**
    The maximum number of arguments on a function.
    )^ -** -** [[SQLITE_LIMIT_ATTACHED]] ^(
    SQLITE_LIMIT_ATTACHED
    -**
    The maximum number of [ATTACH | attached databases].)^
    -** -** [[SQLITE_LIMIT_LIKE_PATTERN_LENGTH]] -** ^(
    SQLITE_LIMIT_LIKE_PATTERN_LENGTH
    -**
    The maximum length of the pattern argument to the [LIKE] or -** [GLOB] operators.
    )^ -** -** [[SQLITE_LIMIT_VARIABLE_NUMBER]] -** ^(
    SQLITE_LIMIT_VARIABLE_NUMBER
    -**
    The maximum index number of any [parameter] in an SQL statement.)^ -** -** [[SQLITE_LIMIT_TRIGGER_DEPTH]] ^(
    SQLITE_LIMIT_TRIGGER_DEPTH
    -**
    The maximum depth of recursion for triggers.
    )^ -**
    -*/ -#define SQLITE_LIMIT_LENGTH 0 -#define SQLITE_LIMIT_SQL_LENGTH 1 -#define SQLITE_LIMIT_COLUMN 2 -#define SQLITE_LIMIT_EXPR_DEPTH 3 -#define SQLITE_LIMIT_COMPOUND_SELECT 4 -#define SQLITE_LIMIT_VDBE_OP 5 -#define SQLITE_LIMIT_FUNCTION_ARG 6 -#define SQLITE_LIMIT_ATTACHED 7 -#define SQLITE_LIMIT_LIKE_PATTERN_LENGTH 8 -#define SQLITE_LIMIT_VARIABLE_NUMBER 9 -#define SQLITE_LIMIT_TRIGGER_DEPTH 10 - -/* -** CAPI3REF: Compiling An SQL Statement -** KEYWORDS: {SQL statement compiler} -** -** To execute an SQL query, it must first be compiled into a byte-code -** program using one of these routines. -** -** The first argument, "db", is a [database connection] obtained from a -** prior successful call to [sqlite3_open()], [sqlite3_open_v2()] or -** [sqlite3_open16()]. The database connection must not have been closed. -** -** The second argument, "zSql", is the statement to be compiled, encoded -** as either UTF-8 or UTF-16. The sqlite3_prepare() and sqlite3_prepare_v2() -** interfaces use UTF-8, and sqlite3_prepare16() and sqlite3_prepare16_v2() -** use UTF-16. -** -** ^If the nByte argument is less than zero, then zSql is read up to the -** first zero terminator. ^If nByte is non-negative, then it is the maximum -** number of bytes read from zSql. ^When nByte is non-negative, the -** zSql string ends at either the first '\000' or '\u0000' character or -** the nByte-th byte, whichever comes first. If the caller knows -** that the supplied string is nul-terminated, then there is a small -** performance advantage to be gained by passing an nByte parameter that -** is equal to the number of bytes in the input string including -** the nul-terminator bytes as this saves SQLite from having to -** make a copy of the input string. -** -** ^If pzTail is not NULL then *pzTail is made to point to the first byte -** past the end of the first SQL statement in zSql. These routines only -** compile the first statement in zSql, so *pzTail is left pointing to -** what remains uncompiled. -** -** ^*ppStmt is left pointing to a compiled [prepared statement] that can be -** executed using [sqlite3_step()]. ^If there is an error, *ppStmt is set -** to NULL. ^If the input text contains no SQL (if the input is an empty -** string or a comment) then *ppStmt is set to NULL. -** The calling procedure is responsible for deleting the compiled -** SQL statement using [sqlite3_finalize()] after it has finished with it. -** ppStmt may not be NULL. -** -** ^On success, the sqlite3_prepare() family of routines return [SQLITE_OK]; -** otherwise an [error code] is returned. -** -** The sqlite3_prepare_v2() and sqlite3_prepare16_v2() interfaces are -** recommended for all new programs. The two older interfaces are retained -** for backwards compatibility, but their use is discouraged. -** ^In the "v2" interfaces, the prepared statement -** that is returned (the [sqlite3_stmt] object) contains a copy of the -** original SQL text. This causes the [sqlite3_step()] interface to -** behave differently in three ways: -** -**
      -**
    1. -** ^If the database schema changes, instead of returning [SQLITE_SCHEMA] as it -** always used to do, [sqlite3_step()] will automatically recompile the SQL -** statement and try to run it again. As many as [SQLITE_MAX_SCHEMA_RETRY] -** retries will occur before sqlite3_step() gives up and returns an error. -**
    2. -** -**
    3. -** ^When an error occurs, [sqlite3_step()] will return one of the detailed -** [error codes] or [extended error codes]. ^The legacy behavior was that -** [sqlite3_step()] would only return a generic [SQLITE_ERROR] result code -** and the application would have to make a second call to [sqlite3_reset()] -** in order to find the underlying cause of the problem. With the "v2" prepare -** interfaces, the underlying reason for the error is returned immediately. -**
    4. -** -**
    5. -** ^If the specific value bound to [parameter | host parameter] in the -** WHERE clause might influence the choice of query plan for a statement, -** then the statement will be automatically recompiled, as if there had been -** a schema change, on the first [sqlite3_step()] call following any change -** to the [sqlite3_bind_text | bindings] of that [parameter]. -** ^The specific value of WHERE-clause [parameter] might influence the -** choice of query plan if the parameter is the left-hand side of a [LIKE] -** or [GLOB] operator or if the parameter is compared to an indexed column -** and the [SQLITE_ENABLE_STAT3] compile-time option is enabled. -**
    6. -**
    -*/ -SQLITE_API int sqlite3_prepare( - sqlite3 *db, /* Database handle */ - const char *zSql, /* SQL statement, UTF-8 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const char **pzTail /* OUT: Pointer to unused portion of zSql */ -); -SQLITE_API int sqlite3_prepare_v2( - sqlite3 *db, /* Database handle */ - const char *zSql, /* SQL statement, UTF-8 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const char **pzTail /* OUT: Pointer to unused portion of zSql */ -); -SQLITE_API int sqlite3_prepare16( - sqlite3 *db, /* Database handle */ - const void *zSql, /* SQL statement, UTF-16 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const void **pzTail /* OUT: Pointer to unused portion of zSql */ -); -SQLITE_API int sqlite3_prepare16_v2( - sqlite3 *db, /* Database handle */ - const void *zSql, /* SQL statement, UTF-16 encoded */ - int nByte, /* Maximum length of zSql in bytes. */ - sqlite3_stmt **ppStmt, /* OUT: Statement handle */ - const void **pzTail /* OUT: Pointer to unused portion of zSql */ -); - -/* -** CAPI3REF: Retrieving Statement SQL -** -** ^This interface can be used to retrieve a saved copy of the original -** SQL text used to create a [prepared statement] if that statement was -** compiled using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()]. -*/ -SQLITE_API const char *sqlite3_sql(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Determine If An SQL Statement Writes The Database -** -** ^The sqlite3_stmt_readonly(X) interface returns true (non-zero) if -** and only if the [prepared statement] X makes no direct changes to -** the content of the database file. -** -** Note that [application-defined SQL functions] or -** [virtual tables] might change the database indirectly as a side effect. -** ^(For example, if an application defines a function "eval()" that -** calls [sqlite3_exec()], then the following SQL statement would -** change the database file through side-effects: -** -**
    -**    SELECT eval('DELETE FROM t1') FROM t2;
    -** 
    -** -** But because the [SELECT] statement does not change the database file -** directly, sqlite3_stmt_readonly() would still return true.)^ -** -** ^Transaction control statements such as [BEGIN], [COMMIT], [ROLLBACK], -** [SAVEPOINT], and [RELEASE] cause sqlite3_stmt_readonly() to return true, -** since the statements themselves do not actually modify the database but -** rather they control the timing of when other statements modify the -** database. ^The [ATTACH] and [DETACH] statements also cause -** sqlite3_stmt_readonly() to return true since, while those statements -** change the configuration of a database connection, they do not make -** changes to the content of the database files on disk. -*/ -SQLITE_API int sqlite3_stmt_readonly(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Determine If A Prepared Statement Has Been Reset -** -** ^The sqlite3_stmt_busy(S) interface returns true (non-zero) if the -** [prepared statement] S has been stepped at least once using -** [sqlite3_step(S)] but has not run to completion and/or has not -** been reset using [sqlite3_reset(S)]. ^The sqlite3_stmt_busy(S) -** interface returns false if S is a NULL pointer. If S is not a -** NULL pointer and is not a pointer to a valid [prepared statement] -** object, then the behavior is undefined and probably undesirable. -** -** This interface can be used in combination [sqlite3_next_stmt()] -** to locate all prepared statements associated with a database -** connection that are in need of being reset. This can be used, -** for example, in diagnostic routines to search for prepared -** statements that are holding a transaction open. -*/ -SQLITE_API int sqlite3_stmt_busy(sqlite3_stmt*); - -/* -** CAPI3REF: Dynamically Typed Value Object -** KEYWORDS: {protected sqlite3_value} {unprotected sqlite3_value} -** -** SQLite uses the sqlite3_value object to represent all values -** that can be stored in a database table. SQLite uses dynamic typing -** for the values it stores. ^Values stored in sqlite3_value objects -** can be integers, floating point values, strings, BLOBs, or NULL. -** -** An sqlite3_value object may be either "protected" or "unprotected". -** Some interfaces require a protected sqlite3_value. Other interfaces -** will accept either a protected or an unprotected sqlite3_value. -** Every interface that accepts sqlite3_value arguments specifies -** whether or not it requires a protected sqlite3_value. -** -** The terms "protected" and "unprotected" refer to whether or not -** a mutex is held. An internal mutex is held for a protected -** sqlite3_value object but no mutex is held for an unprotected -** sqlite3_value object. If SQLite is compiled to be single-threaded -** (with [SQLITE_THREADSAFE=0] and with [sqlite3_threadsafe()] returning 0) -** or if SQLite is run in one of reduced mutex modes -** [SQLITE_CONFIG_SINGLETHREAD] or [SQLITE_CONFIG_MULTITHREAD] -** then there is no distinction between protected and unprotected -** sqlite3_value objects and they can be used interchangeably. However, -** for maximum code portability it is recommended that applications -** still make the distinction between protected and unprotected -** sqlite3_value objects even when not strictly required. -** -** ^The sqlite3_value objects that are passed as parameters into the -** implementation of [application-defined SQL functions] are protected. -** ^The sqlite3_value object returned by -** [sqlite3_column_value()] is unprotected. -** Unprotected sqlite3_value objects may only be used with -** [sqlite3_result_value()] and [sqlite3_bind_value()]. -** The [sqlite3_value_blob | sqlite3_value_type()] family of -** interfaces require protected sqlite3_value objects. -*/ -typedef struct Mem sqlite3_value; - -/* -** CAPI3REF: SQL Function Context Object -** -** The context in which an SQL function executes is stored in an -** sqlite3_context object. ^A pointer to an sqlite3_context object -** is always first parameter to [application-defined SQL functions]. -** The application-defined SQL function implementation will pass this -** pointer through into calls to [sqlite3_result_int | sqlite3_result()], -** [sqlite3_aggregate_context()], [sqlite3_user_data()], -** [sqlite3_context_db_handle()], [sqlite3_get_auxdata()], -** and/or [sqlite3_set_auxdata()]. -*/ -typedef struct sqlite3_context sqlite3_context; - -/* -** CAPI3REF: Binding Values To Prepared Statements -** KEYWORDS: {host parameter} {host parameters} {host parameter name} -** KEYWORDS: {SQL parameter} {SQL parameters} {parameter binding} -** -** ^(In the SQL statement text input to [sqlite3_prepare_v2()] and its variants, -** literals may be replaced by a [parameter] that matches one of following -** templates: -** -**
      -**
    • ? -**
    • ?NNN -**
    • :VVV -**
    • @VVV -**
    • $VVV -**
    -** -** In the templates above, NNN represents an integer literal, -** and VVV represents an alphanumeric identifier.)^ ^The values of these -** parameters (also called "host parameter names" or "SQL parameters") -** can be set using the sqlite3_bind_*() routines defined here. -** -** ^The first argument to the sqlite3_bind_*() routines is always -** a pointer to the [sqlite3_stmt] object returned from -** [sqlite3_prepare_v2()] or its variants. -** -** ^The second argument is the index of the SQL parameter to be set. -** ^The leftmost SQL parameter has an index of 1. ^When the same named -** SQL parameter is used more than once, second and subsequent -** occurrences have the same index as the first occurrence. -** ^The index for named parameters can be looked up using the -** [sqlite3_bind_parameter_index()] API if desired. ^The index -** for "?NNN" parameters is the value of NNN. -** ^The NNN value must be between 1 and the [sqlite3_limit()] -** parameter [SQLITE_LIMIT_VARIABLE_NUMBER] (default value: 999). -** -** ^The third argument is the value to bind to the parameter. -** ^If the third parameter to sqlite3_bind_text() or sqlite3_bind_text16() -** or sqlite3_bind_blob() is a NULL pointer then the fourth parameter -** is ignored and the end result is the same as sqlite3_bind_null(). -** -** ^(In those routines that have a fourth argument, its value is the -** number of bytes in the parameter. To be clear: the value is the -** number of bytes in the value, not the number of characters.)^ -** ^If the fourth parameter to sqlite3_bind_text() or sqlite3_bind_text16() -** is negative, then the length of the string is -** the number of bytes up to the first zero terminator. -** If the fourth parameter to sqlite3_bind_blob() is negative, then -** the behavior is undefined. -** If a non-negative fourth parameter is provided to sqlite3_bind_text() -** or sqlite3_bind_text16() then that parameter must be the byte offset -** where the NUL terminator would occur assuming the string were NUL -** terminated. If any NUL characters occur at byte offsets less than -** the value of the fourth parameter then the resulting string value will -** contain embedded NULs. The result of expressions involving strings -** with embedded NULs is undefined. -** -** ^The fifth argument to sqlite3_bind_blob(), sqlite3_bind_text(), and -** sqlite3_bind_text16() is a destructor used to dispose of the BLOB or -** string after SQLite has finished with it. ^The destructor is called -** to dispose of the BLOB or string even if the call to sqlite3_bind_blob(), -** sqlite3_bind_text(), or sqlite3_bind_text16() fails. -** ^If the fifth argument is -** the special value [SQLITE_STATIC], then SQLite assumes that the -** information is in static, unmanaged space and does not need to be freed. -** ^If the fifth argument has the value [SQLITE_TRANSIENT], then -** SQLite makes its own private copy of the data immediately, before -** the sqlite3_bind_*() routine returns. -** -** ^The sqlite3_bind_zeroblob() routine binds a BLOB of length N that -** is filled with zeroes. ^A zeroblob uses a fixed amount of memory -** (just an integer to hold its size) while it is being processed. -** Zeroblobs are intended to serve as placeholders for BLOBs whose -** content is later written using -** [sqlite3_blob_open | incremental BLOB I/O] routines. -** ^A negative value for the zeroblob results in a zero-length BLOB. -** -** ^If any of the sqlite3_bind_*() routines are called with a NULL pointer -** for the [prepared statement] or with a prepared statement for which -** [sqlite3_step()] has been called more recently than [sqlite3_reset()], -** then the call will return [SQLITE_MISUSE]. If any sqlite3_bind_() -** routine is passed a [prepared statement] that has been finalized, the -** result is undefined and probably harmful. -** -** ^Bindings are not cleared by the [sqlite3_reset()] routine. -** ^Unbound parameters are interpreted as NULL. -** -** ^The sqlite3_bind_* routines return [SQLITE_OK] on success or an -** [error code] if anything goes wrong. -** ^[SQLITE_RANGE] is returned if the parameter -** index is out of range. ^[SQLITE_NOMEM] is returned if malloc() fails. -** -** See also: [sqlite3_bind_parameter_count()], -** [sqlite3_bind_parameter_name()], and [sqlite3_bind_parameter_index()]. -*/ -SQLITE_API int sqlite3_bind_blob(sqlite3_stmt*, int, const void*, int n, void(*)(void*)); -SQLITE_API int sqlite3_bind_double(sqlite3_stmt*, int, double); -SQLITE_API int sqlite3_bind_int(sqlite3_stmt*, int, int); -SQLITE_API int sqlite3_bind_int64(sqlite3_stmt*, int, sqlite3_int64); -SQLITE_API int sqlite3_bind_null(sqlite3_stmt*, int); -SQLITE_API int sqlite3_bind_text(sqlite3_stmt*, int, const char*, int n, void(*)(void*)); -SQLITE_API int sqlite3_bind_text16(sqlite3_stmt*, int, const void*, int, void(*)(void*)); -SQLITE_API int sqlite3_bind_value(sqlite3_stmt*, int, const sqlite3_value*); -SQLITE_API int sqlite3_bind_zeroblob(sqlite3_stmt*, int, int n); - -/* -** CAPI3REF: Number Of SQL Parameters -** -** ^This routine can be used to find the number of [SQL parameters] -** in a [prepared statement]. SQL parameters are tokens of the -** form "?", "?NNN", ":AAA", "$AAA", or "@AAA" that serve as -** placeholders for values that are [sqlite3_bind_blob | bound] -** to the parameters at a later time. -** -** ^(This routine actually returns the index of the largest (rightmost) -** parameter. For all forms except ?NNN, this will correspond to the -** number of unique parameters. If parameters of the ?NNN form are used, -** there may be gaps in the list.)^ -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_name()], and -** [sqlite3_bind_parameter_index()]. -*/ -SQLITE_API int sqlite3_bind_parameter_count(sqlite3_stmt*); - -/* -** CAPI3REF: Name Of A Host Parameter -** -** ^The sqlite3_bind_parameter_name(P,N) interface returns -** the name of the N-th [SQL parameter] in the [prepared statement] P. -** ^(SQL parameters of the form "?NNN" or ":AAA" or "@AAA" or "$AAA" -** have a name which is the string "?NNN" or ":AAA" or "@AAA" or "$AAA" -** respectively. -** In other words, the initial ":" or "$" or "@" or "?" -** is included as part of the name.)^ -** ^Parameters of the form "?" without a following integer have no name -** and are referred to as "nameless" or "anonymous parameters". -** -** ^The first host parameter has an index of 1, not 0. -** -** ^If the value N is out of range or if the N-th parameter is -** nameless, then NULL is returned. ^The returned string is -** always in UTF-8 encoding even if the named parameter was -** originally specified as UTF-16 in [sqlite3_prepare16()] or -** [sqlite3_prepare16_v2()]. -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_count()], and -** [sqlite3_bind_parameter_index()]. -*/ -SQLITE_API const char *sqlite3_bind_parameter_name(sqlite3_stmt*, int); - -/* -** CAPI3REF: Index Of A Parameter With A Given Name -** -** ^Return the index of an SQL parameter given its name. ^The -** index value returned is suitable for use as the second -** parameter to [sqlite3_bind_blob|sqlite3_bind()]. ^A zero -** is returned if no matching parameter is found. ^The parameter -** name must be given in UTF-8 even if the original statement -** was prepared from UTF-16 text using [sqlite3_prepare16_v2()]. -** -** See also: [sqlite3_bind_blob|sqlite3_bind()], -** [sqlite3_bind_parameter_count()], and -** [sqlite3_bind_parameter_index()]. -*/ -SQLITE_API int sqlite3_bind_parameter_index(sqlite3_stmt*, const char *zName); - -/* -** CAPI3REF: Reset All Bindings On A Prepared Statement -** -** ^Contrary to the intuition of many, [sqlite3_reset()] does not reset -** the [sqlite3_bind_blob | bindings] on a [prepared statement]. -** ^Use this routine to reset all host parameters to NULL. -*/ -SQLITE_API int sqlite3_clear_bindings(sqlite3_stmt*); - -/* -** CAPI3REF: Number Of Columns In A Result Set -** -** ^Return the number of columns in the result set returned by the -** [prepared statement]. ^This routine returns 0 if pStmt is an SQL -** statement that does not return data (for example an [UPDATE]). -** -** See also: [sqlite3_data_count()] -*/ -SQLITE_API int sqlite3_column_count(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Column Names In A Result Set -** -** ^These routines return the name assigned to a particular column -** in the result set of a [SELECT] statement. ^The sqlite3_column_name() -** interface returns a pointer to a zero-terminated UTF-8 string -** and sqlite3_column_name16() returns a pointer to a zero-terminated -** UTF-16 string. ^The first parameter is the [prepared statement] -** that implements the [SELECT] statement. ^The second parameter is the -** column number. ^The leftmost column is number 0. -** -** ^The returned string pointer is valid until either the [prepared statement] -** is destroyed by [sqlite3_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite3_step()] for a particular run -** or until the next call to -** sqlite3_column_name() or sqlite3_column_name16() on the same column. -** -** ^If sqlite3_malloc() fails during the processing of either routine -** (for example during a conversion from UTF-8 to UTF-16) then a -** NULL pointer is returned. -** -** ^The name of a result column is the value of the "AS" clause for -** that column, if there is an AS clause. If there is no AS clause -** then the name of the column is unspecified and may change from -** one release of SQLite to the next. -*/ -SQLITE_API const char *sqlite3_column_name(sqlite3_stmt*, int N); -SQLITE_API const void *sqlite3_column_name16(sqlite3_stmt*, int N); - -/* -** CAPI3REF: Source Of Data In A Query Result -** -** ^These routines provide a means to determine the database, table, and -** table column that is the origin of a particular result column in -** [SELECT] statement. -** ^The name of the database or table or column can be returned as -** either a UTF-8 or UTF-16 string. ^The _database_ routines return -** the database name, the _table_ routines return the table name, and -** the origin_ routines return the column name. -** ^The returned string is valid until the [prepared statement] is destroyed -** using [sqlite3_finalize()] or until the statement is automatically -** reprepared by the first call to [sqlite3_step()] for a particular run -** or until the same information is requested -** again in a different encoding. -** -** ^The names returned are the original un-aliased names of the -** database, table, and column. -** -** ^The first argument to these interfaces is a [prepared statement]. -** ^These functions return information about the Nth result column returned by -** the statement, where N is the second function argument. -** ^The left-most column is column 0 for these routines. -** -** ^If the Nth column returned by the statement is an expression or -** subquery and is not a column value, then all of these functions return -** NULL. ^These routine might also return NULL if a memory allocation error -** occurs. ^Otherwise, they return the name of the attached database, table, -** or column that query result column was extracted from. -** -** ^As with all other SQLite APIs, those whose names end with "16" return -** UTF-16 encoded strings and the other functions return UTF-8. -** -** ^These APIs are only available if the library was compiled with the -** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol. -** -** If two or more threads call one or more of these routines against the same -** prepared statement and column at the same time then the results are -** undefined. -** -** If two or more threads call one or more -** [sqlite3_column_database_name | column metadata interfaces] -** for the same [prepared statement] and result column -** at the same time then the results are undefined. -*/ -SQLITE_API const char *sqlite3_column_database_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_database_name16(sqlite3_stmt*,int); -SQLITE_API const char *sqlite3_column_table_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_table_name16(sqlite3_stmt*,int); -SQLITE_API const char *sqlite3_column_origin_name(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_origin_name16(sqlite3_stmt*,int); - -/* -** CAPI3REF: Declared Datatype Of A Query Result -** -** ^(The first parameter is a [prepared statement]. -** If this statement is a [SELECT] statement and the Nth column of the -** returned result set of that [SELECT] is a table column (not an -** expression or subquery) then the declared type of the table -** column is returned.)^ ^If the Nth column of the result set is an -** expression or subquery, then a NULL pointer is returned. -** ^The returned string is always UTF-8 encoded. -** -** ^(For example, given the database schema: -** -** CREATE TABLE t1(c1 VARIANT); -** -** and the following statement to be compiled: -** -** SELECT c1 + 1, c1 FROM t1; -** -** this routine would return the string "VARIANT" for the second result -** column (i==1), and a NULL pointer for the first result column (i==0).)^ -** -** ^SQLite uses dynamic run-time typing. ^So just because a column -** is declared to contain a particular type does not mean that the -** data stored in that column is of the declared type. SQLite is -** strongly typed, but the typing is dynamic not static. ^Type -** is associated with individual values, not with the containers -** used to hold those values. -*/ -SQLITE_API const char *sqlite3_column_decltype(sqlite3_stmt*,int); -SQLITE_API const void *sqlite3_column_decltype16(sqlite3_stmt*,int); - -/* -** CAPI3REF: Evaluate An SQL Statement -** -** After a [prepared statement] has been prepared using either -** [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] or one of the legacy -** interfaces [sqlite3_prepare()] or [sqlite3_prepare16()], this function -** must be called one or more times to evaluate the statement. -** -** The details of the behavior of the sqlite3_step() interface depend -** on whether the statement was prepared using the newer "v2" interface -** [sqlite3_prepare_v2()] and [sqlite3_prepare16_v2()] or the older legacy -** interface [sqlite3_prepare()] and [sqlite3_prepare16()]. The use of the -** new "v2" interface is recommended for new applications but the legacy -** interface will continue to be supported. -** -** ^In the legacy interface, the return value will be either [SQLITE_BUSY], -** [SQLITE_DONE], [SQLITE_ROW], [SQLITE_ERROR], or [SQLITE_MISUSE]. -** ^With the "v2" interface, any of the other [result codes] or -** [extended result codes] might be returned as well. -** -** ^[SQLITE_BUSY] means that the database engine was unable to acquire the -** database locks it needs to do its job. ^If the statement is a [COMMIT] -** or occurs outside of an explicit transaction, then you can retry the -** statement. If the statement is not a [COMMIT] and occurs within an -** explicit transaction then you should rollback the transaction before -** continuing. -** -** ^[SQLITE_DONE] means that the statement has finished executing -** successfully. sqlite3_step() should not be called again on this virtual -** machine without first calling [sqlite3_reset()] to reset the virtual -** machine back to its initial state. -** -** ^If the SQL statement being executed returns any data, then [SQLITE_ROW] -** is returned each time a new row of data is ready for processing by the -** caller. The values may be accessed using the [column access functions]. -** sqlite3_step() is called again to retrieve the next row of data. -** -** ^[SQLITE_ERROR] means that a run-time error (such as a constraint -** violation) has occurred. sqlite3_step() should not be called again on -** the VM. More information may be found by calling [sqlite3_errmsg()]. -** ^With the legacy interface, a more specific error code (for example, -** [SQLITE_INTERRUPT], [SQLITE_SCHEMA], [SQLITE_CORRUPT], and so forth) -** can be obtained by calling [sqlite3_reset()] on the -** [prepared statement]. ^In the "v2" interface, -** the more specific error code is returned directly by sqlite3_step(). -** -** [SQLITE_MISUSE] means that the this routine was called inappropriately. -** Perhaps it was called on a [prepared statement] that has -** already been [sqlite3_finalize | finalized] or on one that had -** previously returned [SQLITE_ERROR] or [SQLITE_DONE]. Or it could -** be the case that the same database connection is being used by two or -** more threads at the same moment in time. -** -** For all versions of SQLite up to and including 3.6.23.1, a call to -** [sqlite3_reset()] was required after sqlite3_step() returned anything -** other than [SQLITE_ROW] before any subsequent invocation of -** sqlite3_step(). Failure to reset the prepared statement using -** [sqlite3_reset()] would result in an [SQLITE_MISUSE] return from -** sqlite3_step(). But after version 3.6.23.1, sqlite3_step() began -** calling [sqlite3_reset()] automatically in this circumstance rather -** than returning [SQLITE_MISUSE]. This is not considered a compatibility -** break because any application that ever receives an SQLITE_MISUSE error -** is broken by definition. The [SQLITE_OMIT_AUTORESET] compile-time option -** can be used to restore the legacy behavior. -** -** Goofy Interface Alert: In the legacy interface, the sqlite3_step() -** API always returns a generic error code, [SQLITE_ERROR], following any -** error other than [SQLITE_BUSY] and [SQLITE_MISUSE]. You must call -** [sqlite3_reset()] or [sqlite3_finalize()] in order to find one of the -** specific [error codes] that better describes the error. -** We admit that this is a goofy design. The problem has been fixed -** with the "v2" interface. If you prepare all of your SQL statements -** using either [sqlite3_prepare_v2()] or [sqlite3_prepare16_v2()] instead -** of the legacy [sqlite3_prepare()] and [sqlite3_prepare16()] interfaces, -** then the more specific [error codes] are returned directly -** by sqlite3_step(). The use of the "v2" interface is recommended. -*/ -SQLITE_API int sqlite3_step(sqlite3_stmt*); - -/* -** CAPI3REF: Number of columns in a result set -** -** ^The sqlite3_data_count(P) interface returns the number of columns in the -** current row of the result set of [prepared statement] P. -** ^If prepared statement P does not have results ready to return -** (via calls to the [sqlite3_column_int | sqlite3_column_*()] of -** interfaces) then sqlite3_data_count(P) returns 0. -** ^The sqlite3_data_count(P) routine also returns 0 if P is a NULL pointer. -** ^The sqlite3_data_count(P) routine returns 0 if the previous call to -** [sqlite3_step](P) returned [SQLITE_DONE]. ^The sqlite3_data_count(P) -** will return non-zero if previous call to [sqlite3_step](P) returned -** [SQLITE_ROW], except in the case of the [PRAGMA incremental_vacuum] -** where it always returns zero since each step of that multi-step -** pragma returns 0 columns of data. -** -** See also: [sqlite3_column_count()] -*/ -SQLITE_API int sqlite3_data_count(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Fundamental Datatypes -** KEYWORDS: SQLITE_TEXT -** -** ^(Every value in SQLite has one of five fundamental datatypes: -** -**
      -**
    • 64-bit signed integer -**
    • 64-bit IEEE floating point number -**
    • string -**
    • BLOB -**
    • NULL -**
    )^ -** -** These constants are codes for each of those types. -** -** Note that the SQLITE_TEXT constant was also used in SQLite version 2 -** for a completely different meaning. Software that links against both -** SQLite version 2 and SQLite version 3 should use SQLITE3_TEXT, not -** SQLITE_TEXT. -*/ -#define SQLITE_INTEGER 1 -#define SQLITE_FLOAT 2 -#define SQLITE_BLOB 4 -#define SQLITE_NULL 5 -#ifdef SQLITE_TEXT -# undef SQLITE_TEXT -#else -# define SQLITE_TEXT 3 -#endif -#define SQLITE3_TEXT 3 - -/* -** CAPI3REF: Result Values From A Query -** KEYWORDS: {column access functions} -** -** These routines form the "result set" interface. -** -** ^These routines return information about a single column of the current -** result row of a query. ^In every case the first argument is a pointer -** to the [prepared statement] that is being evaluated (the [sqlite3_stmt*] -** that was returned from [sqlite3_prepare_v2()] or one of its variants) -** and the second argument is the index of the column for which information -** should be returned. ^The leftmost column of the result set has the index 0. -** ^The number of columns in the result can be determined using -** [sqlite3_column_count()]. -** -** If the SQL statement does not currently point to a valid row, or if the -** column index is out of range, the result is undefined. -** These routines may only be called when the most recent call to -** [sqlite3_step()] has returned [SQLITE_ROW] and neither -** [sqlite3_reset()] nor [sqlite3_finalize()] have been called subsequently. -** If any of these routines are called after [sqlite3_reset()] or -** [sqlite3_finalize()] or after [sqlite3_step()] has returned -** something other than [SQLITE_ROW], the results are undefined. -** If [sqlite3_step()] or [sqlite3_reset()] or [sqlite3_finalize()] -** are called from a different thread while any of these routines -** are pending, then the results are undefined. -** -** ^The sqlite3_column_type() routine returns the -** [SQLITE_INTEGER | datatype code] for the initial data type -** of the result column. ^The returned value is one of [SQLITE_INTEGER], -** [SQLITE_FLOAT], [SQLITE_TEXT], [SQLITE_BLOB], or [SQLITE_NULL]. The value -** returned by sqlite3_column_type() is only meaningful if no type -** conversions have occurred as described below. After a type conversion, -** the value returned by sqlite3_column_type() is undefined. Future -** versions of SQLite may change the behavior of sqlite3_column_type() -** following a type conversion. -** -** ^If the result is a BLOB or UTF-8 string then the sqlite3_column_bytes() -** routine returns the number of bytes in that BLOB or string. -** ^If the result is a UTF-16 string, then sqlite3_column_bytes() converts -** the string to UTF-8 and then returns the number of bytes. -** ^If the result is a numeric value then sqlite3_column_bytes() uses -** [sqlite3_snprintf()] to convert that value to a UTF-8 string and returns -** the number of bytes in that string. -** ^If the result is NULL, then sqlite3_column_bytes() returns zero. -** -** ^If the result is a BLOB or UTF-16 string then the sqlite3_column_bytes16() -** routine returns the number of bytes in that BLOB or string. -** ^If the result is a UTF-8 string, then sqlite3_column_bytes16() converts -** the string to UTF-16 and then returns the number of bytes. -** ^If the result is a numeric value then sqlite3_column_bytes16() uses -** [sqlite3_snprintf()] to convert that value to a UTF-16 string and returns -** the number of bytes in that string. -** ^If the result is NULL, then sqlite3_column_bytes16() returns zero. -** -** ^The values returned by [sqlite3_column_bytes()] and -** [sqlite3_column_bytes16()] do not include the zero terminators at the end -** of the string. ^For clarity: the values returned by -** [sqlite3_column_bytes()] and [sqlite3_column_bytes16()] are the number of -** bytes in the string, not the number of characters. -** -** ^Strings returned by sqlite3_column_text() and sqlite3_column_text16(), -** even empty strings, are always zero-terminated. ^The return -** value from sqlite3_column_blob() for a zero-length BLOB is a NULL pointer. -** -** ^The object returned by [sqlite3_column_value()] is an -** [unprotected sqlite3_value] object. An unprotected sqlite3_value object -** may only be used with [sqlite3_bind_value()] and [sqlite3_result_value()]. -** If the [unprotected sqlite3_value] object returned by -** [sqlite3_column_value()] is used in any other way, including calls -** to routines like [sqlite3_value_int()], [sqlite3_value_text()], -** or [sqlite3_value_bytes()], then the behavior is undefined. -** -** These routines attempt to convert the value where appropriate. ^For -** example, if the internal representation is FLOAT and a text result -** is requested, [sqlite3_snprintf()] is used internally to perform the -** conversion automatically. ^(The following table details the conversions -** that are applied: -** -**
    -** -**
    Internal
    Type
    Requested
    Type
    Conversion -** -**
    NULL INTEGER Result is 0 -**
    NULL FLOAT Result is 0.0 -**
    NULL TEXT Result is a NULL pointer -**
    NULL BLOB Result is a NULL pointer -**
    INTEGER FLOAT Convert from integer to float -**
    INTEGER TEXT ASCII rendering of the integer -**
    INTEGER BLOB Same as INTEGER->TEXT -**
    FLOAT INTEGER [CAST] to INTEGER -**
    FLOAT TEXT ASCII rendering of the float -**
    FLOAT BLOB [CAST] to BLOB -**
    TEXT INTEGER [CAST] to INTEGER -**
    TEXT FLOAT [CAST] to REAL -**
    TEXT BLOB No change -**
    BLOB INTEGER [CAST] to INTEGER -**
    BLOB FLOAT [CAST] to REAL -**
    BLOB TEXT Add a zero terminator if needed -**
    -**
    )^ -** -** The table above makes reference to standard C library functions atoi() -** and atof(). SQLite does not really use these functions. It has its -** own equivalent internal routines. The atoi() and atof() names are -** used in the table for brevity and because they are familiar to most -** C programmers. -** -** Note that when type conversions occur, pointers returned by prior -** calls to sqlite3_column_blob(), sqlite3_column_text(), and/or -** sqlite3_column_text16() may be invalidated. -** Type conversions and pointer invalidations might occur -** in the following cases: -** -**
      -**
    • The initial content is a BLOB and sqlite3_column_text() or -** sqlite3_column_text16() is called. A zero-terminator might -** need to be added to the string.
    • -**
    • The initial content is UTF-8 text and sqlite3_column_bytes16() or -** sqlite3_column_text16() is called. The content must be converted -** to UTF-16.
    • -**
    • The initial content is UTF-16 text and sqlite3_column_bytes() or -** sqlite3_column_text() is called. The content must be converted -** to UTF-8.
    • -**
    -** -** ^Conversions between UTF-16be and UTF-16le are always done in place and do -** not invalidate a prior pointer, though of course the content of the buffer -** that the prior pointer references will have been modified. Other kinds -** of conversion are done in place when it is possible, but sometimes they -** are not possible and in those cases prior pointers are invalidated. -** -** The safest and easiest to remember policy is to invoke these routines -** in one of the following ways: -** -**
      -**
    • sqlite3_column_text() followed by sqlite3_column_bytes()
    • -**
    • sqlite3_column_blob() followed by sqlite3_column_bytes()
    • -**
    • sqlite3_column_text16() followed by sqlite3_column_bytes16()
    • -**
    -** -** In other words, you should call sqlite3_column_text(), -** sqlite3_column_blob(), or sqlite3_column_text16() first to force the result -** into the desired format, then invoke sqlite3_column_bytes() or -** sqlite3_column_bytes16() to find the size of the result. Do not mix calls -** to sqlite3_column_text() or sqlite3_column_blob() with calls to -** sqlite3_column_bytes16(), and do not mix calls to sqlite3_column_text16() -** with calls to sqlite3_column_bytes(). -** -** ^The pointers returned are valid until a type conversion occurs as -** described above, or until [sqlite3_step()] or [sqlite3_reset()] or -** [sqlite3_finalize()] is called. ^The memory space used to hold strings -** and BLOBs is freed automatically. Do not pass the pointers returned -** from [sqlite3_column_blob()], [sqlite3_column_text()], etc. into -** [sqlite3_free()]. -** -** ^(If a memory allocation error occurs during the evaluation of any -** of these routines, a default value is returned. The default value -** is either the integer 0, the floating point number 0.0, or a NULL -** pointer. Subsequent calls to [sqlite3_errcode()] will return -** [SQLITE_NOMEM].)^ -*/ -SQLITE_API const void *sqlite3_column_blob(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_bytes(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_bytes16(sqlite3_stmt*, int iCol); -SQLITE_API double sqlite3_column_double(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_int(sqlite3_stmt*, int iCol); -SQLITE_API sqlite3_int64 sqlite3_column_int64(sqlite3_stmt*, int iCol); -SQLITE_API const unsigned char *sqlite3_column_text(sqlite3_stmt*, int iCol); -SQLITE_API const void *sqlite3_column_text16(sqlite3_stmt*, int iCol); -SQLITE_API int sqlite3_column_type(sqlite3_stmt*, int iCol); -SQLITE_API sqlite3_value *sqlite3_column_value(sqlite3_stmt*, int iCol); - -/* -** CAPI3REF: Destroy A Prepared Statement Object -** -** ^The sqlite3_finalize() function is called to delete a [prepared statement]. -** ^If the most recent evaluation of the statement encountered no errors -** or if the statement is never been evaluated, then sqlite3_finalize() returns -** SQLITE_OK. ^If the most recent evaluation of statement S failed, then -** sqlite3_finalize(S) returns the appropriate [error code] or -** [extended error code]. -** -** ^The sqlite3_finalize(S) routine can be called at any point during -** the life cycle of [prepared statement] S: -** before statement S is ever evaluated, after -** one or more calls to [sqlite3_reset()], or after any call -** to [sqlite3_step()] regardless of whether or not the statement has -** completed execution. -** -** ^Invoking sqlite3_finalize() on a NULL pointer is a harmless no-op. -** -** The application must finalize every [prepared statement] in order to avoid -** resource leaks. It is a grievous error for the application to try to use -** a prepared statement after it has been finalized. Any use of a prepared -** statement after it has been finalized can result in undefined and -** undesirable behavior such as segfaults and heap corruption. -*/ -SQLITE_API int sqlite3_finalize(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Reset A Prepared Statement Object -** -** The sqlite3_reset() function is called to reset a [prepared statement] -** object back to its initial state, ready to be re-executed. -** ^Any SQL statement variables that had values bound to them using -** the [sqlite3_bind_blob | sqlite3_bind_*() API] retain their values. -** Use [sqlite3_clear_bindings()] to reset the bindings. -** -** ^The [sqlite3_reset(S)] interface resets the [prepared statement] S -** back to the beginning of its program. -** -** ^If the most recent call to [sqlite3_step(S)] for the -** [prepared statement] S returned [SQLITE_ROW] or [SQLITE_DONE], -** or if [sqlite3_step(S)] has never before been called on S, -** then [sqlite3_reset(S)] returns [SQLITE_OK]. -** -** ^If the most recent call to [sqlite3_step(S)] for the -** [prepared statement] S indicated an error, then -** [sqlite3_reset(S)] returns an appropriate [error code]. -** -** ^The [sqlite3_reset(S)] interface does not change the values -** of any [sqlite3_bind_blob|bindings] on the [prepared statement] S. -*/ -SQLITE_API int sqlite3_reset(sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Create Or Redefine SQL Functions -** KEYWORDS: {function creation routines} -** KEYWORDS: {application-defined SQL function} -** KEYWORDS: {application-defined SQL functions} -** -** ^These functions (collectively known as "function creation routines") -** are used to add SQL functions or aggregates or to redefine the behavior -** of existing SQL functions or aggregates. The only differences between -** these routines are the text encoding expected for -** the second parameter (the name of the function being created) -** and the presence or absence of a destructor callback for -** the application data pointer. -** -** ^The first parameter is the [database connection] to which the SQL -** function is to be added. ^If an application uses more than one database -** connection then application-defined SQL functions must be added -** to each database connection separately. -** -** ^The second parameter is the name of the SQL function to be created or -** redefined. ^The length of the name is limited to 255 bytes in a UTF-8 -** representation, exclusive of the zero-terminator. ^Note that the name -** length limit is in UTF-8 bytes, not characters nor UTF-16 bytes. -** ^Any attempt to create a function with a longer name -** will result in [SQLITE_MISUSE] being returned. -** -** ^The third parameter (nArg) -** is the number of arguments that the SQL function or -** aggregate takes. ^If this parameter is -1, then the SQL function or -** aggregate may take any number of arguments between 0 and the limit -** set by [sqlite3_limit]([SQLITE_LIMIT_FUNCTION_ARG]). If the third -** parameter is less than -1 or greater than 127 then the behavior is -** undefined. -** -** ^The fourth parameter, eTextRep, specifies what -** [SQLITE_UTF8 | text encoding] this SQL function prefers for -** its parameters. The application should set this parameter to -** [SQLITE_UTF16LE] if the function implementation invokes -** [sqlite3_value_text16le()] on an input, or [SQLITE_UTF16BE] if the -** implementation invokes [sqlite3_value_text16be()] on an input, or -** [SQLITE_UTF16] if [sqlite3_value_text16()] is used, or [SQLITE_UTF8] -** otherwise. ^The same SQL function may be registered multiple times using -** different preferred text encodings, with different implementations for -** each encoding. -** ^When multiple implementations of the same function are available, SQLite -** will pick the one that involves the least amount of data conversion. -** -** ^The fourth parameter may optionally be ORed with [SQLITE_DETERMINISTIC] -** to signal that the function will always return the same result given -** the same inputs within a single SQL statement. Most SQL functions are -** deterministic. The built-in [random()] SQL function is an example of a -** function that is not deterministic. The SQLite query planner is able to -** perform additional optimizations on deterministic functions, so use -** of the [SQLITE_DETERMINISTIC] flag is recommended where possible. -** -** ^(The fifth parameter is an arbitrary pointer. The implementation of the -** function can gain access to this pointer using [sqlite3_user_data()].)^ -** -** ^The sixth, seventh and eighth parameters, xFunc, xStep and xFinal, are -** pointers to C-language functions that implement the SQL function or -** aggregate. ^A scalar SQL function requires an implementation of the xFunc -** callback only; NULL pointers must be passed as the xStep and xFinal -** parameters. ^An aggregate SQL function requires an implementation of xStep -** and xFinal and NULL pointer must be passed for xFunc. ^To delete an existing -** SQL function or aggregate, pass NULL pointers for all three function -** callbacks. -** -** ^(If the ninth parameter to sqlite3_create_function_v2() is not NULL, -** then it is destructor for the application data pointer. -** The destructor is invoked when the function is deleted, either by being -** overloaded or when the database connection closes.)^ -** ^The destructor is also invoked if the call to -** sqlite3_create_function_v2() fails. -** ^When the destructor callback of the tenth parameter is invoked, it -** is passed a single argument which is a copy of the application data -** pointer which was the fifth parameter to sqlite3_create_function_v2(). -** -** ^It is permitted to register multiple implementations of the same -** functions with the same name but with either differing numbers of -** arguments or differing preferred text encodings. ^SQLite will use -** the implementation that most closely matches the way in which the -** SQL function is used. ^A function implementation with a non-negative -** nArg parameter is a better match than a function implementation with -** a negative nArg. ^A function where the preferred text encoding -** matches the database encoding is a better -** match than a function where the encoding is different. -** ^A function where the encoding difference is between UTF16le and UTF16be -** is a closer match than a function where the encoding difference is -** between UTF8 and UTF16. -** -** ^Built-in functions may be overloaded by new application-defined functions. -** -** ^An application-defined function is permitted to call other -** SQLite interfaces. However, such calls must not -** close the database connection nor finalize or reset the prepared -** statement in which the function is running. -*/ -SQLITE_API int sqlite3_create_function( - sqlite3 *db, - const char *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) -); -SQLITE_API int sqlite3_create_function16( - sqlite3 *db, - const void *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*) -); -SQLITE_API int sqlite3_create_function_v2( - sqlite3 *db, - const char *zFunctionName, - int nArg, - int eTextRep, - void *pApp, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void(*xDestroy)(void*) -); - -/* -** CAPI3REF: Text Encodings -** -** These constant define integer codes that represent the various -** text encodings supported by SQLite. -*/ -#define SQLITE_UTF8 1 -#define SQLITE_UTF16LE 2 -#define SQLITE_UTF16BE 3 -#define SQLITE_UTF16 4 /* Use native byte order */ -#define SQLITE_ANY 5 /* Deprecated */ -#define SQLITE_UTF16_ALIGNED 8 /* sqlite3_create_collation only */ - -/* -** CAPI3REF: Function Flags -** -** These constants may be ORed together with the -** [SQLITE_UTF8 | preferred text encoding] as the fourth argument -** to [sqlite3_create_function()], [sqlite3_create_function16()], or -** [sqlite3_create_function_v2()]. -*/ -#define SQLITE_DETERMINISTIC 0x800 - -/* -** CAPI3REF: Deprecated Functions -** DEPRECATED -** -** These functions are [deprecated]. In order to maintain -** backwards compatibility with older code, these functions continue -** to be supported. However, new applications should avoid -** the use of these functions. To help encourage people to avoid -** using these functions, we are not going to tell you what they do. -*/ -#ifndef SQLITE_OMIT_DEPRECATED -SQLITE_API SQLITE_DEPRECATED int sqlite3_aggregate_count(sqlite3_context*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_expired(sqlite3_stmt*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_transfer_bindings(sqlite3_stmt*, sqlite3_stmt*); -SQLITE_API SQLITE_DEPRECATED int sqlite3_global_recover(void); -SQLITE_API SQLITE_DEPRECATED void sqlite3_thread_cleanup(void); -SQLITE_API SQLITE_DEPRECATED int sqlite3_memory_alarm(void(*)(void*,sqlite3_int64,int), - void*,sqlite3_int64); -#endif - -/* -** CAPI3REF: Obtaining SQL Function Parameter Values -** -** The C-language implementation of SQL functions and aggregates uses -** this set of interface routines to access the parameter values on -** the function or aggregate. -** -** The xFunc (for scalar functions) or xStep (for aggregates) parameters -** to [sqlite3_create_function()] and [sqlite3_create_function16()] -** define callbacks that implement the SQL functions and aggregates. -** The 3rd parameter to these callbacks is an array of pointers to -** [protected sqlite3_value] objects. There is one [sqlite3_value] object for -** each parameter to the SQL function. These routines are used to -** extract values from the [sqlite3_value] objects. -** -** These routines work only with [protected sqlite3_value] objects. -** Any attempt to use these routines on an [unprotected sqlite3_value] -** object results in undefined behavior. -** -** ^These routines work just like the corresponding [column access functions] -** except that these routines take a single [protected sqlite3_value] object -** pointer instead of a [sqlite3_stmt*] pointer and an integer column number. -** -** ^The sqlite3_value_text16() interface extracts a UTF-16 string -** in the native byte-order of the host machine. ^The -** sqlite3_value_text16be() and sqlite3_value_text16le() interfaces -** extract UTF-16 strings as big-endian and little-endian respectively. -** -** ^(The sqlite3_value_numeric_type() interface attempts to apply -** numeric affinity to the value. This means that an attempt is -** made to convert the value to an integer or floating point. If -** such a conversion is possible without loss of information (in other -** words, if the value is a string that looks like a number) -** then the conversion is performed. Otherwise no conversion occurs. -** The [SQLITE_INTEGER | datatype] after conversion is returned.)^ -** -** Please pay particular attention to the fact that the pointer returned -** from [sqlite3_value_blob()], [sqlite3_value_text()], or -** [sqlite3_value_text16()] can be invalidated by a subsequent call to -** [sqlite3_value_bytes()], [sqlite3_value_bytes16()], [sqlite3_value_text()], -** or [sqlite3_value_text16()]. -** -** These routines must be called from the same thread as -** the SQL function that supplied the [sqlite3_value*] parameters. -*/ -SQLITE_API const void *sqlite3_value_blob(sqlite3_value*); -SQLITE_API int sqlite3_value_bytes(sqlite3_value*); -SQLITE_API int sqlite3_value_bytes16(sqlite3_value*); -SQLITE_API double sqlite3_value_double(sqlite3_value*); -SQLITE_API int sqlite3_value_int(sqlite3_value*); -SQLITE_API sqlite3_int64 sqlite3_value_int64(sqlite3_value*); -SQLITE_API const unsigned char *sqlite3_value_text(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16le(sqlite3_value*); -SQLITE_API const void *sqlite3_value_text16be(sqlite3_value*); -SQLITE_API int sqlite3_value_type(sqlite3_value*); -SQLITE_API int sqlite3_value_numeric_type(sqlite3_value*); - -/* -** CAPI3REF: Obtain Aggregate Function Context -** -** Implementations of aggregate SQL functions use this -** routine to allocate memory for storing their state. -** -** ^The first time the sqlite3_aggregate_context(C,N) routine is called -** for a particular aggregate function, SQLite -** allocates N of memory, zeroes out that memory, and returns a pointer -** to the new memory. ^On second and subsequent calls to -** sqlite3_aggregate_context() for the same aggregate function instance, -** the same buffer is returned. Sqlite3_aggregate_context() is normally -** called once for each invocation of the xStep callback and then one -** last time when the xFinal callback is invoked. ^(When no rows match -** an aggregate query, the xStep() callback of the aggregate function -** implementation is never called and xFinal() is called exactly once. -** In those cases, sqlite3_aggregate_context() might be called for the -** first time from within xFinal().)^ -** -** ^The sqlite3_aggregate_context(C,N) routine returns a NULL pointer -** when first called if N is less than or equal to zero or if a memory -** allocate error occurs. -** -** ^(The amount of space allocated by sqlite3_aggregate_context(C,N) is -** determined by the N parameter on first successful call. Changing the -** value of N in subsequent call to sqlite3_aggregate_context() within -** the same aggregate function instance will not resize the memory -** allocation.)^ Within the xFinal callback, it is customary to set -** N=0 in calls to sqlite3_aggregate_context(C,N) so that no -** pointless memory allocations occur. -** -** ^SQLite automatically frees the memory allocated by -** sqlite3_aggregate_context() when the aggregate query concludes. -** -** The first parameter must be a copy of the -** [sqlite3_context | SQL function context] that is the first parameter -** to the xStep or xFinal callback routine that implements the aggregate -** function. -** -** This routine must be called from the same thread in which -** the aggregate SQL function is running. -*/ -SQLITE_API void *sqlite3_aggregate_context(sqlite3_context*, int nBytes); - -/* -** CAPI3REF: User Data For Functions -** -** ^The sqlite3_user_data() interface returns a copy of -** the pointer that was the pUserData parameter (the 5th parameter) -** of the [sqlite3_create_function()] -** and [sqlite3_create_function16()] routines that originally -** registered the application defined function. -** -** This routine must be called from the same thread in which -** the application-defined function is running. -*/ -SQLITE_API void *sqlite3_user_data(sqlite3_context*); - -/* -** CAPI3REF: Database Connection For Functions -** -** ^The sqlite3_context_db_handle() interface returns a copy of -** the pointer to the [database connection] (the 1st parameter) -** of the [sqlite3_create_function()] -** and [sqlite3_create_function16()] routines that originally -** registered the application defined function. -*/ -SQLITE_API sqlite3 *sqlite3_context_db_handle(sqlite3_context*); - -/* -** CAPI3REF: Function Auxiliary Data -** -** These functions may be used by (non-aggregate) SQL functions to -** associate metadata with argument values. If the same value is passed to -** multiple invocations of the same SQL function during query execution, under -** some circumstances the associated metadata may be preserved. An example -** of where this might be useful is in a regular-expression matching -** function. The compiled version of the regular expression can be stored as -** metadata associated with the pattern string. -** Then as long as the pattern string remains the same, -** the compiled regular expression can be reused on multiple -** invocations of the same function. -** -** ^The sqlite3_get_auxdata() interface returns a pointer to the metadata -** associated by the sqlite3_set_auxdata() function with the Nth argument -** value to the application-defined function. ^If there is no metadata -** associated with the function argument, this sqlite3_get_auxdata() interface -** returns a NULL pointer. -** -** ^The sqlite3_set_auxdata(C,N,P,X) interface saves P as metadata for the N-th -** argument of the application-defined function. ^Subsequent -** calls to sqlite3_get_auxdata(C,N) return P from the most recent -** sqlite3_set_auxdata(C,N,P,X) call if the metadata is still valid or -** NULL if the metadata has been discarded. -** ^After each call to sqlite3_set_auxdata(C,N,P,X) where X is not NULL, -** SQLite will invoke the destructor function X with parameter P exactly -** once, when the metadata is discarded. -** SQLite is free to discard the metadata at any time, including:
      -**
    • when the corresponding function parameter changes, or -**
    • when [sqlite3_reset()] or [sqlite3_finalize()] is called for the -** SQL statement, or -**
    • when sqlite3_set_auxdata() is invoked again on the same parameter, or -**
    • during the original sqlite3_set_auxdata() call when a memory -** allocation error occurs.
    )^ -** -** Note the last bullet in particular. The destructor X in -** sqlite3_set_auxdata(C,N,P,X) might be called immediately, before the -** sqlite3_set_auxdata() interface even returns. Hence sqlite3_set_auxdata() -** should be called near the end of the function implementation and the -** function implementation should not make any use of P after -** sqlite3_set_auxdata() has been called. -** -** ^(In practice, metadata is preserved between function calls for -** function parameters that are compile-time constants, including literal -** values and [parameters] and expressions composed from the same.)^ -** -** These routines must be called from the same thread in which -** the SQL function is running. -*/ -SQLITE_API void *sqlite3_get_auxdata(sqlite3_context*, int N); -SQLITE_API void sqlite3_set_auxdata(sqlite3_context*, int N, void*, void (*)(void*)); - - -/* -** CAPI3REF: Constants Defining Special Destructor Behavior -** -** These are special values for the destructor that is passed in as the -** final argument to routines like [sqlite3_result_blob()]. ^If the destructor -** argument is SQLITE_STATIC, it means that the content pointer is constant -** and will never change. It does not need to be destroyed. ^The -** SQLITE_TRANSIENT value means that the content will likely change in -** the near future and that SQLite should make its own private copy of -** the content before returning. -** -** The typedef is necessary to work around problems in certain -** C++ compilers. -*/ -typedef void (*sqlite3_destructor_type)(void*); -#define SQLITE_STATIC ((sqlite3_destructor_type)0) -#define SQLITE_TRANSIENT ((sqlite3_destructor_type)-1) - -/* -** CAPI3REF: Setting The Result Of An SQL Function -** -** These routines are used by the xFunc or xFinal callbacks that -** implement SQL functions and aggregates. See -** [sqlite3_create_function()] and [sqlite3_create_function16()] -** for additional information. -** -** These functions work very much like the [parameter binding] family of -** functions used to bind values to host parameters in prepared statements. -** Refer to the [SQL parameter] documentation for additional information. -** -** ^The sqlite3_result_blob() interface sets the result from -** an application-defined function to be the BLOB whose content is pointed -** to by the second parameter and which is N bytes long where N is the -** third parameter. -** -** ^The sqlite3_result_zeroblob() interfaces set the result of -** the application-defined function to be a BLOB containing all zero -** bytes and N bytes in size, where N is the value of the 2nd parameter. -** -** ^The sqlite3_result_double() interface sets the result from -** an application-defined function to be a floating point value specified -** by its 2nd argument. -** -** ^The sqlite3_result_error() and sqlite3_result_error16() functions -** cause the implemented SQL function to throw an exception. -** ^SQLite uses the string pointed to by the -** 2nd parameter of sqlite3_result_error() or sqlite3_result_error16() -** as the text of an error message. ^SQLite interprets the error -** message string from sqlite3_result_error() as UTF-8. ^SQLite -** interprets the string from sqlite3_result_error16() as UTF-16 in native -** byte order. ^If the third parameter to sqlite3_result_error() -** or sqlite3_result_error16() is negative then SQLite takes as the error -** message all text up through the first zero character. -** ^If the third parameter to sqlite3_result_error() or -** sqlite3_result_error16() is non-negative then SQLite takes that many -** bytes (not characters) from the 2nd parameter as the error message. -** ^The sqlite3_result_error() and sqlite3_result_error16() -** routines make a private copy of the error message text before -** they return. Hence, the calling function can deallocate or -** modify the text after they return without harm. -** ^The sqlite3_result_error_code() function changes the error code -** returned by SQLite as a result of an error in a function. ^By default, -** the error code is SQLITE_ERROR. ^A subsequent call to sqlite3_result_error() -** or sqlite3_result_error16() resets the error code to SQLITE_ERROR. -** -** ^The sqlite3_result_error_toobig() interface causes SQLite to throw an -** error indicating that a string or BLOB is too long to represent. -** -** ^The sqlite3_result_error_nomem() interface causes SQLite to throw an -** error indicating that a memory allocation failed. -** -** ^The sqlite3_result_int() interface sets the return value -** of the application-defined function to be the 32-bit signed integer -** value given in the 2nd argument. -** ^The sqlite3_result_int64() interface sets the return value -** of the application-defined function to be the 64-bit signed integer -** value given in the 2nd argument. -** -** ^The sqlite3_result_null() interface sets the return value -** of the application-defined function to be NULL. -** -** ^The sqlite3_result_text(), sqlite3_result_text16(), -** sqlite3_result_text16le(), and sqlite3_result_text16be() interfaces -** set the return value of the application-defined function to be -** a text string which is represented as UTF-8, UTF-16 native byte order, -** UTF-16 little endian, or UTF-16 big endian, respectively. -** ^SQLite takes the text result from the application from -** the 2nd parameter of the sqlite3_result_text* interfaces. -** ^If the 3rd parameter to the sqlite3_result_text* interfaces -** is negative, then SQLite takes result text from the 2nd parameter -** through the first zero character. -** ^If the 3rd parameter to the sqlite3_result_text* interfaces -** is non-negative, then as many bytes (not characters) of the text -** pointed to by the 2nd parameter are taken as the application-defined -** function result. If the 3rd parameter is non-negative, then it -** must be the byte offset into the string where the NUL terminator would -** appear if the string where NUL terminated. If any NUL characters occur -** in the string at a byte offset that is less than the value of the 3rd -** parameter, then the resulting string will contain embedded NULs and the -** result of expressions operating on strings with embedded NULs is undefined. -** ^If the 4th parameter to the sqlite3_result_text* interfaces -** or sqlite3_result_blob is a non-NULL pointer, then SQLite calls that -** function as the destructor on the text or BLOB result when it has -** finished using that result. -** ^If the 4th parameter to the sqlite3_result_text* interfaces or to -** sqlite3_result_blob is the special constant SQLITE_STATIC, then SQLite -** assumes that the text or BLOB result is in constant space and does not -** copy the content of the parameter nor call a destructor on the content -** when it has finished using that result. -** ^If the 4th parameter to the sqlite3_result_text* interfaces -** or sqlite3_result_blob is the special constant SQLITE_TRANSIENT -** then SQLite makes a copy of the result into space obtained from -** from [sqlite3_malloc()] before it returns. -** -** ^The sqlite3_result_value() interface sets the result of -** the application-defined function to be a copy the -** [unprotected sqlite3_value] object specified by the 2nd parameter. ^The -** sqlite3_result_value() interface makes a copy of the [sqlite3_value] -** so that the [sqlite3_value] specified in the parameter may change or -** be deallocated after sqlite3_result_value() returns without harm. -** ^A [protected sqlite3_value] object may always be used where an -** [unprotected sqlite3_value] object is required, so either -** kind of [sqlite3_value] object can be used with this interface. -** -** If these routines are called from within the different thread -** than the one containing the application-defined function that received -** the [sqlite3_context] pointer, the results are undefined. -*/ -SQLITE_API void sqlite3_result_blob(sqlite3_context*, const void*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_double(sqlite3_context*, double); -SQLITE_API void sqlite3_result_error(sqlite3_context*, const char*, int); -SQLITE_API void sqlite3_result_error16(sqlite3_context*, const void*, int); -SQLITE_API void sqlite3_result_error_toobig(sqlite3_context*); -SQLITE_API void sqlite3_result_error_nomem(sqlite3_context*); -SQLITE_API void sqlite3_result_error_code(sqlite3_context*, int); -SQLITE_API void sqlite3_result_int(sqlite3_context*, int); -SQLITE_API void sqlite3_result_int64(sqlite3_context*, sqlite3_int64); -SQLITE_API void sqlite3_result_null(sqlite3_context*); -SQLITE_API void sqlite3_result_text(sqlite3_context*, const char*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_text16(sqlite3_context*, const void*, int, void(*)(void*)); -SQLITE_API void sqlite3_result_text16le(sqlite3_context*, const void*, int,void(*)(void*)); -SQLITE_API void sqlite3_result_text16be(sqlite3_context*, const void*, int,void(*)(void*)); -SQLITE_API void sqlite3_result_value(sqlite3_context*, sqlite3_value*); -SQLITE_API void sqlite3_result_zeroblob(sqlite3_context*, int n); - -/* -** CAPI3REF: Define New Collating Sequences -** -** ^These functions add, remove, or modify a [collation] associated -** with the [database connection] specified as the first argument. -** -** ^The name of the collation is a UTF-8 string -** for sqlite3_create_collation() and sqlite3_create_collation_v2() -** and a UTF-16 string in native byte order for sqlite3_create_collation16(). -** ^Collation names that compare equal according to [sqlite3_strnicmp()] are -** considered to be the same name. -** -** ^(The third argument (eTextRep) must be one of the constants: -**
      -**
    • [SQLITE_UTF8], -**
    • [SQLITE_UTF16LE], -**
    • [SQLITE_UTF16BE], -**
    • [SQLITE_UTF16], or -**
    • [SQLITE_UTF16_ALIGNED]. -**
    )^ -** ^The eTextRep argument determines the encoding of strings passed -** to the collating function callback, xCallback. -** ^The [SQLITE_UTF16] and [SQLITE_UTF16_ALIGNED] values for eTextRep -** force strings to be UTF16 with native byte order. -** ^The [SQLITE_UTF16_ALIGNED] value for eTextRep forces strings to begin -** on an even byte address. -** -** ^The fourth argument, pArg, is an application data pointer that is passed -** through as the first argument to the collating function callback. -** -** ^The fifth argument, xCallback, is a pointer to the collating function. -** ^Multiple collating functions can be registered using the same name but -** with different eTextRep parameters and SQLite will use whichever -** function requires the least amount of data transformation. -** ^If the xCallback argument is NULL then the collating function is -** deleted. ^When all collating functions having the same name are deleted, -** that collation is no longer usable. -** -** ^The collating function callback is invoked with a copy of the pArg -** application data pointer and with two strings in the encoding specified -** by the eTextRep argument. The collating function must return an -** integer that is negative, zero, or positive -** if the first string is less than, equal to, or greater than the second, -** respectively. A collating function must always return the same answer -** given the same inputs. If two or more collating functions are registered -** to the same collation name (using different eTextRep values) then all -** must give an equivalent answer when invoked with equivalent strings. -** The collating function must obey the following properties for all -** strings A, B, and C: -** -**
      -**
    1. If A==B then B==A. -**
    2. If A==B and B==C then A==C. -**
    3. If A<B THEN B>A. -**
    4. If A<B and B<C then A<C. -**
    -** -** If a collating function fails any of the above constraints and that -** collating function is registered and used, then the behavior of SQLite -** is undefined. -** -** ^The sqlite3_create_collation_v2() works like sqlite3_create_collation() -** with the addition that the xDestroy callback is invoked on pArg when -** the collating function is deleted. -** ^Collating functions are deleted when they are overridden by later -** calls to the collation creation functions or when the -** [database connection] is closed using [sqlite3_close()]. -** -** ^The xDestroy callback is not called if the -** sqlite3_create_collation_v2() function fails. Applications that invoke -** sqlite3_create_collation_v2() with a non-NULL xDestroy argument should -** check the return code and dispose of the application data pointer -** themselves rather than expecting SQLite to deal with it for them. -** This is different from every other SQLite interface. The inconsistency -** is unfortunate but cannot be changed without breaking backwards -** compatibility. -** -** See also: [sqlite3_collation_needed()] and [sqlite3_collation_needed16()]. -*/ -SQLITE_API int sqlite3_create_collation( - sqlite3*, - const char *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*) -); -SQLITE_API int sqlite3_create_collation_v2( - sqlite3*, - const char *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*), - void(*xDestroy)(void*) -); -SQLITE_API int sqlite3_create_collation16( - sqlite3*, - const void *zName, - int eTextRep, - void *pArg, - int(*xCompare)(void*,int,const void*,int,const void*) -); - -/* -** CAPI3REF: Collation Needed Callbacks -** -** ^To avoid having to register all collation sequences before a database -** can be used, a single callback function may be registered with the -** [database connection] to be invoked whenever an undefined collation -** sequence is required. -** -** ^If the function is registered using the sqlite3_collation_needed() API, -** then it is passed the names of undefined collation sequences as strings -** encoded in UTF-8. ^If sqlite3_collation_needed16() is used, -** the names are passed as UTF-16 in machine native byte order. -** ^A call to either function replaces the existing collation-needed callback. -** -** ^(When the callback is invoked, the first argument passed is a copy -** of the second argument to sqlite3_collation_needed() or -** sqlite3_collation_needed16(). The second argument is the database -** connection. The third argument is one of [SQLITE_UTF8], [SQLITE_UTF16BE], -** or [SQLITE_UTF16LE], indicating the most desirable form of the collation -** sequence function required. The fourth parameter is the name of the -** required collation sequence.)^ -** -** The callback function should register the desired collation using -** [sqlite3_create_collation()], [sqlite3_create_collation16()], or -** [sqlite3_create_collation_v2()]. -*/ -SQLITE_API int sqlite3_collation_needed( - sqlite3*, - void*, - void(*)(void*,sqlite3*,int eTextRep,const char*) -); -SQLITE_API int sqlite3_collation_needed16( - sqlite3*, - void*, - void(*)(void*,sqlite3*,int eTextRep,const void*) -); - -#ifdef SQLITE_HAS_CODEC -/* -** Specify the key for an encrypted database. This routine should be -** called right after sqlite3_open(). -** -** The code to implement this API is not available in the public release -** of SQLite. -*/ -SQLITE_API int sqlite3_key( - sqlite3 *db, /* Database to be rekeyed */ - const void *pKey, int nKey /* The key */ -); -SQLITE_API int sqlite3_key_v2( - sqlite3 *db, /* Database to be rekeyed */ - const char *zDbName, /* Name of the database */ - const void *pKey, int nKey /* The key */ -); - -/* -** Change the key on an open database. If the current database is not -** encrypted, this routine will encrypt it. If pNew==0 or nNew==0, the -** database is decrypted. -** -** The code to implement this API is not available in the public release -** of SQLite. -*/ -SQLITE_API int sqlite3_rekey( - sqlite3 *db, /* Database to be rekeyed */ - const void *pKey, int nKey /* The new key */ -); -SQLITE_API int sqlite3_rekey_v2( - sqlite3 *db, /* Database to be rekeyed */ - const char *zDbName, /* Name of the database */ - const void *pKey, int nKey /* The new key */ -); - -/* -** Specify the activation key for a SEE database. Unless -** activated, none of the SEE routines will work. -*/ -SQLITE_API void sqlite3_activate_see( - const char *zPassPhrase /* Activation phrase */ -); -#endif - -#ifdef SQLITE_ENABLE_CEROD -/* -** Specify the activation key for a CEROD database. Unless -** activated, none of the CEROD routines will work. -*/ -SQLITE_API void sqlite3_activate_cerod( - const char *zPassPhrase /* Activation phrase */ -); -#endif - -/* -** CAPI3REF: Suspend Execution For A Short Time -** -** The sqlite3_sleep() function causes the current thread to suspend execution -** for at least a number of milliseconds specified in its parameter. -** -** If the operating system does not support sleep requests with -** millisecond time resolution, then the time will be rounded up to -** the nearest second. The number of milliseconds of sleep actually -** requested from the operating system is returned. -** -** ^SQLite implements this interface by calling the xSleep() -** method of the default [sqlite3_vfs] object. If the xSleep() method -** of the default VFS is not implemented correctly, or not implemented at -** all, then the behavior of sqlite3_sleep() may deviate from the description -** in the previous paragraphs. -*/ -SQLITE_API int sqlite3_sleep(int); - -/* -** CAPI3REF: Name Of The Folder Holding Temporary Files -** -** ^(If this global variable is made to point to a string which is -** the name of a folder (a.k.a. directory), then all temporary files -** created by SQLite when using a built-in [sqlite3_vfs | VFS] -** will be placed in that directory.)^ ^If this variable -** is a NULL pointer, then SQLite performs a search for an appropriate -** temporary file directory. -** -** It is not safe to read or modify this variable in more than one -** thread at a time. It is not safe to read or modify this variable -** if a [database connection] is being used at the same time in a separate -** thread. -** It is intended that this variable be set once -** as part of process initialization and before any SQLite interface -** routines have been called and that this variable remain unchanged -** thereafter. -** -** ^The [temp_store_directory pragma] may modify this variable and cause -** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, -** the [temp_store_directory pragma] always assumes that any string -** that this variable points to is held in memory obtained from -** [sqlite3_malloc] and the pragma may attempt to free that memory -** using [sqlite3_free]. -** Hence, if this variable is modified directly, either it should be -** made NULL or made to point to memory obtained from [sqlite3_malloc] -** or else the use of the [temp_store_directory pragma] should be avoided. -** -** Note to Windows Runtime users: The temporary directory must be set -** prior to calling [sqlite3_open] or [sqlite3_open_v2]. Otherwise, various -** features that require the use of temporary files may fail. Here is an -** example of how to do this using C++ with the Windows Runtime: -** -**
    -** LPCWSTR zPath = Windows::Storage::ApplicationData::Current->
    -**       TemporaryFolder->Path->Data();
    -** char zPathBuf[MAX_PATH + 1];
    -** memset(zPathBuf, 0, sizeof(zPathBuf));
    -** WideCharToMultiByte(CP_UTF8, 0, zPath, -1, zPathBuf, sizeof(zPathBuf),
    -**       NULL, NULL);
    -** sqlite3_temp_directory = sqlite3_mprintf("%s", zPathBuf);
    -** 
    -*/ -SQLITE_API SQLITE_EXTERN char *sqlite3_temp_directory; - -/* -** CAPI3REF: Name Of The Folder Holding Database Files -** -** ^(If this global variable is made to point to a string which is -** the name of a folder (a.k.a. directory), then all database files -** specified with a relative pathname and created or accessed by -** SQLite when using a built-in windows [sqlite3_vfs | VFS] will be assumed -** to be relative to that directory.)^ ^If this variable is a NULL -** pointer, then SQLite assumes that all database files specified -** with a relative pathname are relative to the current directory -** for the process. Only the windows VFS makes use of this global -** variable; it is ignored by the unix VFS. -** -** Changing the value of this variable while a database connection is -** open can result in a corrupt database. -** -** It is not safe to read or modify this variable in more than one -** thread at a time. It is not safe to read or modify this variable -** if a [database connection] is being used at the same time in a separate -** thread. -** It is intended that this variable be set once -** as part of process initialization and before any SQLite interface -** routines have been called and that this variable remain unchanged -** thereafter. -** -** ^The [data_store_directory pragma] may modify this variable and cause -** it to point to memory obtained from [sqlite3_malloc]. ^Furthermore, -** the [data_store_directory pragma] always assumes that any string -** that this variable points to is held in memory obtained from -** [sqlite3_malloc] and the pragma may attempt to free that memory -** using [sqlite3_free]. -** Hence, if this variable is modified directly, either it should be -** made NULL or made to point to memory obtained from [sqlite3_malloc] -** or else the use of the [data_store_directory pragma] should be avoided. -*/ -SQLITE_API SQLITE_EXTERN char *sqlite3_data_directory; - -/* -** CAPI3REF: Test For Auto-Commit Mode -** KEYWORDS: {autocommit mode} -** -** ^The sqlite3_get_autocommit() interface returns non-zero or -** zero if the given database connection is or is not in autocommit mode, -** respectively. ^Autocommit mode is on by default. -** ^Autocommit mode is disabled by a [BEGIN] statement. -** ^Autocommit mode is re-enabled by a [COMMIT] or [ROLLBACK]. -** -** If certain kinds of errors occur on a statement within a multi-statement -** transaction (errors including [SQLITE_FULL], [SQLITE_IOERR], -** [SQLITE_NOMEM], [SQLITE_BUSY], and [SQLITE_INTERRUPT]) then the -** transaction might be rolled back automatically. The only way to -** find out whether SQLite automatically rolled back the transaction after -** an error is to use this function. -** -** If another thread changes the autocommit status of the database -** connection while this routine is running, then the return value -** is undefined. -*/ -SQLITE_API int sqlite3_get_autocommit(sqlite3*); - -/* -** CAPI3REF: Find The Database Handle Of A Prepared Statement -** -** ^The sqlite3_db_handle interface returns the [database connection] handle -** to which a [prepared statement] belongs. ^The [database connection] -** returned by sqlite3_db_handle is the same [database connection] -** that was the first argument -** to the [sqlite3_prepare_v2()] call (or its variants) that was used to -** create the statement in the first place. -*/ -SQLITE_API sqlite3 *sqlite3_db_handle(sqlite3_stmt*); - -/* -** CAPI3REF: Return The Filename For A Database Connection -** -** ^The sqlite3_db_filename(D,N) interface returns a pointer to a filename -** associated with database N of connection D. ^The main database file -** has the name "main". If there is no attached database N on the database -** connection D, or if database N is a temporary or in-memory database, then -** a NULL pointer is returned. -** -** ^The filename returned by this function is the output of the -** xFullPathname method of the [VFS]. ^In other words, the filename -** will be an absolute pathname, even if the filename used -** to open the database originally was a URI or relative pathname. -*/ -SQLITE_API const char *sqlite3_db_filename(sqlite3 *db, const char *zDbName); - -/* -** CAPI3REF: Determine if a database is read-only -** -** ^The sqlite3_db_readonly(D,N) interface returns 1 if the database N -** of connection D is read-only, 0 if it is read/write, or -1 if N is not -** the name of a database on connection D. -*/ -SQLITE_API int sqlite3_db_readonly(sqlite3 *db, const char *zDbName); - -/* -** CAPI3REF: Find the next prepared statement -** -** ^This interface returns a pointer to the next [prepared statement] after -** pStmt associated with the [database connection] pDb. ^If pStmt is NULL -** then this interface returns a pointer to the first prepared statement -** associated with the database connection pDb. ^If no prepared statement -** satisfies the conditions of this routine, it returns NULL. -** -** The [database connection] pointer D in a call to -** [sqlite3_next_stmt(D,S)] must refer to an open database -** connection and in particular must not be a NULL pointer. -*/ -SQLITE_API sqlite3_stmt *sqlite3_next_stmt(sqlite3 *pDb, sqlite3_stmt *pStmt); - -/* -** CAPI3REF: Commit And Rollback Notification Callbacks -** -** ^The sqlite3_commit_hook() interface registers a callback -** function to be invoked whenever a transaction is [COMMIT | committed]. -** ^Any callback set by a previous call to sqlite3_commit_hook() -** for the same database connection is overridden. -** ^The sqlite3_rollback_hook() interface registers a callback -** function to be invoked whenever a transaction is [ROLLBACK | rolled back]. -** ^Any callback set by a previous call to sqlite3_rollback_hook() -** for the same database connection is overridden. -** ^The pArg argument is passed through to the callback. -** ^If the callback on a commit hook function returns non-zero, -** then the commit is converted into a rollback. -** -** ^The sqlite3_commit_hook(D,C,P) and sqlite3_rollback_hook(D,C,P) functions -** return the P argument from the previous call of the same function -** on the same [database connection] D, or NULL for -** the first call for each function on D. -** -** The commit and rollback hook callbacks are not reentrant. -** The callback implementation must not do anything that will modify -** the database connection that invoked the callback. Any actions -** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the commit -** or rollback hook in the first place. -** Note that running any other SQL statements, including SELECT statements, -** or merely calling [sqlite3_prepare_v2()] and [sqlite3_step()] will modify -** the database connections for the meaning of "modify" in this paragraph. -** -** ^Registering a NULL function disables the callback. -** -** ^When the commit hook callback routine returns zero, the [COMMIT] -** operation is allowed to continue normally. ^If the commit hook -** returns non-zero, then the [COMMIT] is converted into a [ROLLBACK]. -** ^The rollback hook is invoked on a rollback that results from a commit -** hook returning non-zero, just as it would be with any other rollback. -** -** ^For the purposes of this API, a transaction is said to have been -** rolled back if an explicit "ROLLBACK" statement is executed, or -** an error or constraint causes an implicit rollback to occur. -** ^The rollback callback is not invoked if a transaction is -** automatically rolled back because the database connection is closed. -** -** See also the [sqlite3_update_hook()] interface. -*/ -SQLITE_API void *sqlite3_commit_hook(sqlite3*, int(*)(void*), void*); -SQLITE_API void *sqlite3_rollback_hook(sqlite3*, void(*)(void *), void*); - -/* -** CAPI3REF: Data Change Notification Callbacks -** -** ^The sqlite3_update_hook() interface registers a callback function -** with the [database connection] identified by the first argument -** to be invoked whenever a row is updated, inserted or deleted in -** a rowid table. -** ^Any callback set by a previous call to this function -** for the same database connection is overridden. -** -** ^The second argument is a pointer to the function to invoke when a -** row is updated, inserted or deleted in a rowid table. -** ^The first argument to the callback is a copy of the third argument -** to sqlite3_update_hook(). -** ^The second callback argument is one of [SQLITE_INSERT], [SQLITE_DELETE], -** or [SQLITE_UPDATE], depending on the operation that caused the callback -** to be invoked. -** ^The third and fourth arguments to the callback contain pointers to the -** database and table name containing the affected row. -** ^The final callback parameter is the [rowid] of the row. -** ^In the case of an update, this is the [rowid] after the update takes place. -** -** ^(The update hook is not invoked when internal system tables are -** modified (i.e. sqlite_master and sqlite_sequence).)^ -** ^The update hook is not invoked when [WITHOUT ROWID] tables are modified. -** -** ^In the current implementation, the update hook -** is not invoked when duplication rows are deleted because of an -** [ON CONFLICT | ON CONFLICT REPLACE] clause. ^Nor is the update hook -** invoked when rows are deleted using the [truncate optimization]. -** The exceptions defined in this paragraph might change in a future -** release of SQLite. -** -** The update hook implementation must not do anything that will modify -** the database connection that invoked the update hook. Any actions -** to modify the database connection must be deferred until after the -** completion of the [sqlite3_step()] call that triggered the update hook. -** Note that [sqlite3_prepare_v2()] and [sqlite3_step()] both modify their -** database connections for the meaning of "modify" in this paragraph. -** -** ^The sqlite3_update_hook(D,C,P) function -** returns the P argument from the previous call -** on the same [database connection] D, or NULL for -** the first call on D. -** -** See also the [sqlite3_commit_hook()] and [sqlite3_rollback_hook()] -** interfaces. -*/ -SQLITE_API void *sqlite3_update_hook( - sqlite3*, - void(*)(void *,int ,char const *,char const *,sqlite3_int64), - void* -); - -/* -** CAPI3REF: Enable Or Disable Shared Pager Cache -** -** ^(This routine enables or disables the sharing of the database cache -** and schema data structures between [database connection | connections] -** to the same database. Sharing is enabled if the argument is true -** and disabled if the argument is false.)^ -** -** ^Cache sharing is enabled and disabled for an entire process. -** This is a change as of SQLite version 3.5.0. In prior versions of SQLite, -** sharing was enabled or disabled for each thread separately. -** -** ^(The cache sharing mode set by this interface effects all subsequent -** calls to [sqlite3_open()], [sqlite3_open_v2()], and [sqlite3_open16()]. -** Existing database connections continue use the sharing mode -** that was in effect at the time they were opened.)^ -** -** ^(This routine returns [SQLITE_OK] if shared cache was enabled or disabled -** successfully. An [error code] is returned otherwise.)^ -** -** ^Shared cache is disabled by default. But this might change in -** future releases of SQLite. Applications that care about shared -** cache setting should set it explicitly. -** -** This interface is threadsafe on processors where writing a -** 32-bit integer is atomic. -** -** See Also: [SQLite Shared-Cache Mode] -*/ -SQLITE_API int sqlite3_enable_shared_cache(int); - -/* -** CAPI3REF: Attempt To Free Heap Memory -** -** ^The sqlite3_release_memory() interface attempts to free N bytes -** of heap memory by deallocating non-essential memory allocations -** held by the database library. Memory used to cache database -** pages to improve performance is an example of non-essential memory. -** ^sqlite3_release_memory() returns the number of bytes actually freed, -** which might be more or less than the amount requested. -** ^The sqlite3_release_memory() routine is a no-op returning zero -** if SQLite is not compiled with [SQLITE_ENABLE_MEMORY_MANAGEMENT]. -** -** See also: [sqlite3_db_release_memory()] -*/ -SQLITE_API int sqlite3_release_memory(int); - -/* -** CAPI3REF: Free Memory Used By A Database Connection -** -** ^The sqlite3_db_release_memory(D) interface attempts to free as much heap -** memory as possible from database connection D. Unlike the -** [sqlite3_release_memory()] interface, this interface is in effect even -** when the [SQLITE_ENABLE_MEMORY_MANAGEMENT] compile-time option is -** omitted. -** -** See also: [sqlite3_release_memory()] -*/ -SQLITE_API int sqlite3_db_release_memory(sqlite3*); - -/* -** CAPI3REF: Impose A Limit On Heap Size -** -** ^The sqlite3_soft_heap_limit64() interface sets and/or queries the -** soft limit on the amount of heap memory that may be allocated by SQLite. -** ^SQLite strives to keep heap memory utilization below the soft heap -** limit by reducing the number of pages held in the page cache -** as heap memory usages approaches the limit. -** ^The soft heap limit is "soft" because even though SQLite strives to stay -** below the limit, it will exceed the limit rather than generate -** an [SQLITE_NOMEM] error. In other words, the soft heap limit -** is advisory only. -** -** ^The return value from sqlite3_soft_heap_limit64() is the size of -** the soft heap limit prior to the call, or negative in the case of an -** error. ^If the argument N is negative -** then no change is made to the soft heap limit. Hence, the current -** size of the soft heap limit can be determined by invoking -** sqlite3_soft_heap_limit64() with a negative argument. -** -** ^If the argument N is zero then the soft heap limit is disabled. -** -** ^(The soft heap limit is not enforced in the current implementation -** if one or more of following conditions are true: -** -**
      -**
    • The soft heap limit is set to zero. -**
    • Memory accounting is disabled using a combination of the -** [sqlite3_config]([SQLITE_CONFIG_MEMSTATUS],...) start-time option and -** the [SQLITE_DEFAULT_MEMSTATUS] compile-time option. -**
    • An alternative page cache implementation is specified using -** [sqlite3_config]([SQLITE_CONFIG_PCACHE2],...). -**
    • The page cache allocates from its own memory pool supplied -** by [sqlite3_config]([SQLITE_CONFIG_PAGECACHE],...) rather than -** from the heap. -**
    )^ -** -** Beginning with SQLite version 3.7.3, the soft heap limit is enforced -** regardless of whether or not the [SQLITE_ENABLE_MEMORY_MANAGEMENT] -** compile-time option is invoked. With [SQLITE_ENABLE_MEMORY_MANAGEMENT], -** the soft heap limit is enforced on every memory allocation. Without -** [SQLITE_ENABLE_MEMORY_MANAGEMENT], the soft heap limit is only enforced -** when memory is allocated by the page cache. Testing suggests that because -** the page cache is the predominate memory user in SQLite, most -** applications will achieve adequate soft heap limit enforcement without -** the use of [SQLITE_ENABLE_MEMORY_MANAGEMENT]. -** -** The circumstances under which SQLite will enforce the soft heap limit may -** changes in future releases of SQLite. -*/ -SQLITE_API sqlite3_int64 sqlite3_soft_heap_limit64(sqlite3_int64 N); - -/* -** CAPI3REF: Deprecated Soft Heap Limit Interface -** DEPRECATED -** -** This is a deprecated version of the [sqlite3_soft_heap_limit64()] -** interface. This routine is provided for historical compatibility -** only. All new applications should use the -** [sqlite3_soft_heap_limit64()] interface rather than this one. -*/ -SQLITE_API SQLITE_DEPRECATED void sqlite3_soft_heap_limit(int N); - - -/* -** CAPI3REF: Extract Metadata About A Column Of A Table -** -** ^This routine returns metadata about a specific column of a specific -** database table accessible using the [database connection] handle -** passed as the first function argument. -** -** ^The column is identified by the second, third and fourth parameters to -** this function. ^The second parameter is either the name of the database -** (i.e. "main", "temp", or an attached database) containing the specified -** table or NULL. ^If it is NULL, then all attached databases are searched -** for the table using the same algorithm used by the database engine to -** resolve unqualified table references. -** -** ^The third and fourth parameters to this function are the table and column -** name of the desired column, respectively. Neither of these parameters -** may be NULL. -** -** ^Metadata is returned by writing to the memory locations passed as the 5th -** and subsequent parameters to this function. ^Any of these arguments may be -** NULL, in which case the corresponding element of metadata is omitted. -** -** ^(
    -** -**
    Parameter Output
    Type
    Description -** -**
    5th const char* Data type -**
    6th const char* Name of default collation sequence -**
    7th int True if column has a NOT NULL constraint -**
    8th int True if column is part of the PRIMARY KEY -**
    9th int True if column is [AUTOINCREMENT] -**
    -**
    )^ -** -** ^The memory pointed to by the character pointers returned for the -** declaration type and collation sequence is valid only until the next -** call to any SQLite API function. -** -** ^If the specified table is actually a view, an [error code] is returned. -** -** ^If the specified column is "rowid", "oid" or "_rowid_" and an -** [INTEGER PRIMARY KEY] column has been explicitly declared, then the output -** parameters are set for the explicitly declared column. ^(If there is no -** explicitly declared [INTEGER PRIMARY KEY] column, then the output -** parameters are set as follows: -** -**
    -**     data type: "INTEGER"
    -**     collation sequence: "BINARY"
    -**     not null: 0
    -**     primary key: 1
    -**     auto increment: 0
    -** 
    )^ -** -** ^(This function may load one or more schemas from database files. If an -** error occurs during this process, or if the requested table or column -** cannot be found, an [error code] is returned and an error message left -** in the [database connection] (to be retrieved using sqlite3_errmsg()).)^ -** -** ^This API is only available if the library was compiled with the -** [SQLITE_ENABLE_COLUMN_METADATA] C-preprocessor symbol defined. -*/ -SQLITE_API int sqlite3_table_column_metadata( - sqlite3 *db, /* Connection handle */ - const char *zDbName, /* Database name or NULL */ - const char *zTableName, /* Table name */ - const char *zColumnName, /* Column name */ - char const **pzDataType, /* OUTPUT: Declared data type */ - char const **pzCollSeq, /* OUTPUT: Collation sequence name */ - int *pNotNull, /* OUTPUT: True if NOT NULL constraint exists */ - int *pPrimaryKey, /* OUTPUT: True if column part of PK */ - int *pAutoinc /* OUTPUT: True if column is auto-increment */ -); - -/* -** CAPI3REF: Load An Extension -** -** ^This interface loads an SQLite extension library from the named file. -** -** ^The sqlite3_load_extension() interface attempts to load an -** [SQLite extension] library contained in the file zFile. If -** the file cannot be loaded directly, attempts are made to load -** with various operating-system specific extensions added. -** So for example, if "samplelib" cannot be loaded, then names like -** "samplelib.so" or "samplelib.dylib" or "samplelib.dll" might -** be tried also. -** -** ^The entry point is zProc. -** ^(zProc may be 0, in which case SQLite will try to come up with an -** entry point name on its own. It first tries "sqlite3_extension_init". -** If that does not work, it constructs a name "sqlite3_X_init" where the -** X is consists of the lower-case equivalent of all ASCII alphabetic -** characters in the filename from the last "/" to the first following -** "." and omitting any initial "lib".)^ -** ^The sqlite3_load_extension() interface returns -** [SQLITE_OK] on success and [SQLITE_ERROR] if something goes wrong. -** ^If an error occurs and pzErrMsg is not 0, then the -** [sqlite3_load_extension()] interface shall attempt to -** fill *pzErrMsg with error message text stored in memory -** obtained from [sqlite3_malloc()]. The calling function -** should free this memory by calling [sqlite3_free()]. -** -** ^Extension loading must be enabled using -** [sqlite3_enable_load_extension()] prior to calling this API, -** otherwise an error will be returned. -** -** See also the [load_extension() SQL function]. -*/ -SQLITE_API int sqlite3_load_extension( - sqlite3 *db, /* Load the extension into this database connection */ - const char *zFile, /* Name of the shared library containing extension */ - const char *zProc, /* Entry point. Derived from zFile if 0 */ - char **pzErrMsg /* Put error message here if not 0 */ -); - -/* -** CAPI3REF: Enable Or Disable Extension Loading -** -** ^So as not to open security holes in older applications that are -** unprepared to deal with [extension loading], and as a means of disabling -** [extension loading] while evaluating user-entered SQL, the following API -** is provided to turn the [sqlite3_load_extension()] mechanism on and off. -** -** ^Extension loading is off by default. -** ^Call the sqlite3_enable_load_extension() routine with onoff==1 -** to turn extension loading on and call it with onoff==0 to turn -** it back off again. -*/ -SQLITE_API int sqlite3_enable_load_extension(sqlite3 *db, int onoff); - -/* -** CAPI3REF: Automatically Load Statically Linked Extensions -** -** ^This interface causes the xEntryPoint() function to be invoked for -** each new [database connection] that is created. The idea here is that -** xEntryPoint() is the entry point for a statically linked [SQLite extension] -** that is to be automatically loaded into all new database connections. -** -** ^(Even though the function prototype shows that xEntryPoint() takes -** no arguments and returns void, SQLite invokes xEntryPoint() with three -** arguments and expects and integer result as if the signature of the -** entry point where as follows: -** -**
    -**    int xEntryPoint(
    -**      sqlite3 *db,
    -**      const char **pzErrMsg,
    -**      const struct sqlite3_api_routines *pThunk
    -**    );
    -** 
    )^ -** -** If the xEntryPoint routine encounters an error, it should make *pzErrMsg -** point to an appropriate error message (obtained from [sqlite3_mprintf()]) -** and return an appropriate [error code]. ^SQLite ensures that *pzErrMsg -** is NULL before calling the xEntryPoint(). ^SQLite will invoke -** [sqlite3_free()] on *pzErrMsg after xEntryPoint() returns. ^If any -** xEntryPoint() returns an error, the [sqlite3_open()], [sqlite3_open16()], -** or [sqlite3_open_v2()] call that provoked the xEntryPoint() will fail. -** -** ^Calling sqlite3_auto_extension(X) with an entry point X that is already -** on the list of automatic extensions is a harmless no-op. ^No entry point -** will be called more than once for each database connection that is opened. -** -** See also: [sqlite3_reset_auto_extension()] -** and [sqlite3_cancel_auto_extension()] -*/ -SQLITE_API int sqlite3_auto_extension(void (*xEntryPoint)(void)); - -/* -** CAPI3REF: Cancel Automatic Extension Loading -** -** ^The [sqlite3_cancel_auto_extension(X)] interface unregisters the -** initialization routine X that was registered using a prior call to -** [sqlite3_auto_extension(X)]. ^The [sqlite3_cancel_auto_extension(X)] -** routine returns 1 if initialization routine X was successfully -** unregistered and it returns 0 if X was not on the list of initialization -** routines. -*/ -SQLITE_API int sqlite3_cancel_auto_extension(void (*xEntryPoint)(void)); - -/* -** CAPI3REF: Reset Automatic Extension Loading -** -** ^This interface disables all automatic extensions previously -** registered using [sqlite3_auto_extension()]. -*/ -SQLITE_API void sqlite3_reset_auto_extension(void); - -/* -** The interface to the virtual-table mechanism is currently considered -** to be experimental. The interface might change in incompatible ways. -** If this is a problem for you, do not use the interface at this time. -** -** When the virtual-table mechanism stabilizes, we will declare the -** interface fixed, support it indefinitely, and remove this comment. -*/ - -/* -** Structures used by the virtual table interface -*/ -typedef struct sqlite3_vtab sqlite3_vtab; -typedef struct sqlite3_index_info sqlite3_index_info; -typedef struct sqlite3_vtab_cursor sqlite3_vtab_cursor; -typedef struct sqlite3_module sqlite3_module; - -/* -** CAPI3REF: Virtual Table Object -** KEYWORDS: sqlite3_module {virtual table module} -** -** This structure, sometimes called a "virtual table module", -** defines the implementation of a [virtual tables]. -** This structure consists mostly of methods for the module. -** -** ^A virtual table module is created by filling in a persistent -** instance of this structure and passing a pointer to that instance -** to [sqlite3_create_module()] or [sqlite3_create_module_v2()]. -** ^The registration remains valid until it is replaced by a different -** module or until the [database connection] closes. The content -** of this structure must not change while it is registered with -** any database connection. -*/ -struct sqlite3_module { - int iVersion; - int (*xCreate)(sqlite3*, void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**); - int (*xConnect)(sqlite3*, void *pAux, - int argc, const char *const*argv, - sqlite3_vtab **ppVTab, char**); - int (*xBestIndex)(sqlite3_vtab *pVTab, sqlite3_index_info*); - int (*xDisconnect)(sqlite3_vtab *pVTab); - int (*xDestroy)(sqlite3_vtab *pVTab); - int (*xOpen)(sqlite3_vtab *pVTab, sqlite3_vtab_cursor **ppCursor); - int (*xClose)(sqlite3_vtab_cursor*); - int (*xFilter)(sqlite3_vtab_cursor*, int idxNum, const char *idxStr, - int argc, sqlite3_value **argv); - int (*xNext)(sqlite3_vtab_cursor*); - int (*xEof)(sqlite3_vtab_cursor*); - int (*xColumn)(sqlite3_vtab_cursor*, sqlite3_context*, int); - int (*xRowid)(sqlite3_vtab_cursor*, sqlite3_int64 *pRowid); - int (*xUpdate)(sqlite3_vtab *, int, sqlite3_value **, sqlite3_int64 *); - int (*xBegin)(sqlite3_vtab *pVTab); - int (*xSync)(sqlite3_vtab *pVTab); - int (*xCommit)(sqlite3_vtab *pVTab); - int (*xRollback)(sqlite3_vtab *pVTab); - int (*xFindFunction)(sqlite3_vtab *pVtab, int nArg, const char *zName, - void (**pxFunc)(sqlite3_context*,int,sqlite3_value**), - void **ppArg); - int (*xRename)(sqlite3_vtab *pVtab, const char *zNew); - /* The methods above are in version 1 of the sqlite_module object. Those - ** below are for version 2 and greater. */ - int (*xSavepoint)(sqlite3_vtab *pVTab, int); - int (*xRelease)(sqlite3_vtab *pVTab, int); - int (*xRollbackTo)(sqlite3_vtab *pVTab, int); -}; - -/* -** CAPI3REF: Virtual Table Indexing Information -** KEYWORDS: sqlite3_index_info -** -** The sqlite3_index_info structure and its substructures is used as part -** of the [virtual table] interface to -** pass information into and receive the reply from the [xBestIndex] -** method of a [virtual table module]. The fields under **Inputs** are the -** inputs to xBestIndex and are read-only. xBestIndex inserts its -** results into the **Outputs** fields. -** -** ^(The aConstraint[] array records WHERE clause constraints of the form: -** -**
    column OP expr
    -** -** where OP is =, <, <=, >, or >=.)^ ^(The particular operator is -** stored in aConstraint[].op using one of the -** [SQLITE_INDEX_CONSTRAINT_EQ | SQLITE_INDEX_CONSTRAINT_ values].)^ -** ^(The index of the column is stored in -** aConstraint[].iColumn.)^ ^(aConstraint[].usable is TRUE if the -** expr on the right-hand side can be evaluated (and thus the constraint -** is usable) and false if it cannot.)^ -** -** ^The optimizer automatically inverts terms of the form "expr OP column" -** and makes other simplifications to the WHERE clause in an attempt to -** get as many WHERE clause terms into the form shown above as possible. -** ^The aConstraint[] array only reports WHERE clause terms that are -** relevant to the particular virtual table being queried. -** -** ^Information about the ORDER BY clause is stored in aOrderBy[]. -** ^Each term of aOrderBy records a column of the ORDER BY clause. -** -** The [xBestIndex] method must fill aConstraintUsage[] with information -** about what parameters to pass to xFilter. ^If argvIndex>0 then -** the right-hand side of the corresponding aConstraint[] is evaluated -** and becomes the argvIndex-th entry in argv. ^(If aConstraintUsage[].omit -** is true, then the constraint is assumed to be fully handled by the -** virtual table and is not checked again by SQLite.)^ -** -** ^The idxNum and idxPtr values are recorded and passed into the -** [xFilter] method. -** ^[sqlite3_free()] is used to free idxPtr if and only if -** needToFreeIdxPtr is true. -** -** ^The orderByConsumed means that output from [xFilter]/[xNext] will occur in -** the correct order to satisfy the ORDER BY clause so that no separate -** sorting step is required. -** -** ^The estimatedCost value is an estimate of the cost of a particular -** strategy. A cost of N indicates that the cost of the strategy is similar -** to a linear scan of an SQLite table with N rows. A cost of log(N) -** indicates that the expense of the operation is similar to that of a -** binary search on a unique indexed field of an SQLite table with N rows. -** -** ^The estimatedRows value is an estimate of the number of rows that -** will be returned by the strategy. -** -** IMPORTANT: The estimatedRows field was added to the sqlite3_index_info -** structure for SQLite version 3.8.2. If a virtual table extension is -** used with an SQLite version earlier than 3.8.2, the results of attempting -** to read or write the estimatedRows field are undefined (but are likely -** to included crashing the application). The estimatedRows field should -** therefore only be used if [sqlite3_libversion_number()] returns a -** value greater than or equal to 3008002. -*/ -struct sqlite3_index_info { - /* Inputs */ - int nConstraint; /* Number of entries in aConstraint */ - struct sqlite3_index_constraint { - int iColumn; /* Column on left-hand side of constraint */ - unsigned char op; /* Constraint operator */ - unsigned char usable; /* True if this constraint is usable */ - int iTermOffset; /* Used internally - xBestIndex should ignore */ - } *aConstraint; /* Table of WHERE clause constraints */ - int nOrderBy; /* Number of terms in the ORDER BY clause */ - struct sqlite3_index_orderby { - int iColumn; /* Column number */ - unsigned char desc; /* True for DESC. False for ASC. */ - } *aOrderBy; /* The ORDER BY clause */ - /* Outputs */ - struct sqlite3_index_constraint_usage { - int argvIndex; /* if >0, constraint is part of argv to xFilter */ - unsigned char omit; /* Do not code a test for this constraint */ - } *aConstraintUsage; - int idxNum; /* Number used to identify the index */ - char *idxStr; /* String, possibly obtained from sqlite3_malloc */ - int needToFreeIdxStr; /* Free idxStr using sqlite3_free() if true */ - int orderByConsumed; /* True if output is already ordered */ - double estimatedCost; /* Estimated cost of using this index */ - /* Fields below are only available in SQLite 3.8.2 and later */ - sqlite3_int64 estimatedRows; /* Estimated number of rows returned */ -}; - -/* -** CAPI3REF: Virtual Table Constraint Operator Codes -** -** These macros defined the allowed values for the -** [sqlite3_index_info].aConstraint[].op field. Each value represents -** an operator that is part of a constraint term in the wHERE clause of -** a query that uses a [virtual table]. -*/ -#define SQLITE_INDEX_CONSTRAINT_EQ 2 -#define SQLITE_INDEX_CONSTRAINT_GT 4 -#define SQLITE_INDEX_CONSTRAINT_LE 8 -#define SQLITE_INDEX_CONSTRAINT_LT 16 -#define SQLITE_INDEX_CONSTRAINT_GE 32 -#define SQLITE_INDEX_CONSTRAINT_MATCH 64 - -/* -** CAPI3REF: Register A Virtual Table Implementation -** -** ^These routines are used to register a new [virtual table module] name. -** ^Module names must be registered before -** creating a new [virtual table] using the module and before using a -** preexisting [virtual table] for the module. -** -** ^The module name is registered on the [database connection] specified -** by the first parameter. ^The name of the module is given by the -** second parameter. ^The third parameter is a pointer to -** the implementation of the [virtual table module]. ^The fourth -** parameter is an arbitrary client data pointer that is passed through -** into the [xCreate] and [xConnect] methods of the virtual table module -** when a new virtual table is be being created or reinitialized. -** -** ^The sqlite3_create_module_v2() interface has a fifth parameter which -** is a pointer to a destructor for the pClientData. ^SQLite will -** invoke the destructor function (if it is not NULL) when SQLite -** no longer needs the pClientData pointer. ^The destructor will also -** be invoked if the call to sqlite3_create_module_v2() fails. -** ^The sqlite3_create_module() -** interface is equivalent to sqlite3_create_module_v2() with a NULL -** destructor. -*/ -SQLITE_API int sqlite3_create_module( - sqlite3 *db, /* SQLite connection to register module with */ - const char *zName, /* Name of the module */ - const sqlite3_module *p, /* Methods for the module */ - void *pClientData /* Client data for xCreate/xConnect */ -); -SQLITE_API int sqlite3_create_module_v2( - sqlite3 *db, /* SQLite connection to register module with */ - const char *zName, /* Name of the module */ - const sqlite3_module *p, /* Methods for the module */ - void *pClientData, /* Client data for xCreate/xConnect */ - void(*xDestroy)(void*) /* Module destructor function */ -); - -/* -** CAPI3REF: Virtual Table Instance Object -** KEYWORDS: sqlite3_vtab -** -** Every [virtual table module] implementation uses a subclass -** of this object to describe a particular instance -** of the [virtual table]. Each subclass will -** be tailored to the specific needs of the module implementation. -** The purpose of this superclass is to define certain fields that are -** common to all module implementations. -** -** ^Virtual tables methods can set an error message by assigning a -** string obtained from [sqlite3_mprintf()] to zErrMsg. The method should -** take care that any prior string is freed by a call to [sqlite3_free()] -** prior to assigning a new string to zErrMsg. ^After the error message -** is delivered up to the client application, the string will be automatically -** freed by sqlite3_free() and the zErrMsg field will be zeroed. -*/ -struct sqlite3_vtab { - const sqlite3_module *pModule; /* The module for this virtual table */ - int nRef; /* NO LONGER USED */ - char *zErrMsg; /* Error message from sqlite3_mprintf() */ - /* Virtual table implementations will typically add additional fields */ -}; - -/* -** CAPI3REF: Virtual Table Cursor Object -** KEYWORDS: sqlite3_vtab_cursor {virtual table cursor} -** -** Every [virtual table module] implementation uses a subclass of the -** following structure to describe cursors that point into the -** [virtual table] and are used -** to loop through the virtual table. Cursors are created using the -** [sqlite3_module.xOpen | xOpen] method of the module and are destroyed -** by the [sqlite3_module.xClose | xClose] method. Cursors are used -** by the [xFilter], [xNext], [xEof], [xColumn], and [xRowid] methods -** of the module. Each module implementation will define -** the content of a cursor structure to suit its own needs. -** -** This superclass exists in order to define fields of the cursor that -** are common to all implementations. -*/ -struct sqlite3_vtab_cursor { - sqlite3_vtab *pVtab; /* Virtual table of this cursor */ - /* Virtual table implementations will typically add additional fields */ -}; - -/* -** CAPI3REF: Declare The Schema Of A Virtual Table -** -** ^The [xCreate] and [xConnect] methods of a -** [virtual table module] call this interface -** to declare the format (the names and datatypes of the columns) of -** the virtual tables they implement. -*/ -SQLITE_API int sqlite3_declare_vtab(sqlite3*, const char *zSQL); - -/* -** CAPI3REF: Overload A Function For A Virtual Table -** -** ^(Virtual tables can provide alternative implementations of functions -** using the [xFindFunction] method of the [virtual table module]. -** But global versions of those functions -** must exist in order to be overloaded.)^ -** -** ^(This API makes sure a global version of a function with a particular -** name and number of parameters exists. If no such function exists -** before this API is called, a new function is created.)^ ^The implementation -** of the new function always causes an exception to be thrown. So -** the new function is not good for anything by itself. Its only -** purpose is to be a placeholder function that can be overloaded -** by a [virtual table]. -*/ -SQLITE_API int sqlite3_overload_function(sqlite3*, const char *zFuncName, int nArg); - -/* -** The interface to the virtual-table mechanism defined above (back up -** to a comment remarkably similar to this one) is currently considered -** to be experimental. The interface might change in incompatible ways. -** If this is a problem for you, do not use the interface at this time. -** -** When the virtual-table mechanism stabilizes, we will declare the -** interface fixed, support it indefinitely, and remove this comment. -*/ - -/* -** CAPI3REF: A Handle To An Open BLOB -** KEYWORDS: {BLOB handle} {BLOB handles} -** -** An instance of this object represents an open BLOB on which -** [sqlite3_blob_open | incremental BLOB I/O] can be performed. -** ^Objects of this type are created by [sqlite3_blob_open()] -** and destroyed by [sqlite3_blob_close()]. -** ^The [sqlite3_blob_read()] and [sqlite3_blob_write()] interfaces -** can be used to read or write small subsections of the BLOB. -** ^The [sqlite3_blob_bytes()] interface returns the size of the BLOB in bytes. -*/ -typedef struct sqlite3_blob sqlite3_blob; - -/* -** CAPI3REF: Open A BLOB For Incremental I/O -** -** ^(This interfaces opens a [BLOB handle | handle] to the BLOB located -** in row iRow, column zColumn, table zTable in database zDb; -** in other words, the same BLOB that would be selected by: -** -**
    -**     SELECT zColumn FROM zDb.zTable WHERE [rowid] = iRow;
    -** 
    )^ -** -** ^If the flags parameter is non-zero, then the BLOB is opened for read -** and write access. ^If it is zero, the BLOB is opened for read access. -** ^It is not possible to open a column that is part of an index or primary -** key for writing. ^If [foreign key constraints] are enabled, it is -** not possible to open a column that is part of a [child key] for writing. -** -** ^Note that the database name is not the filename that contains -** the database but rather the symbolic name of the database that -** appears after the AS keyword when the database is connected using [ATTACH]. -** ^For the main database file, the database name is "main". -** ^For TEMP tables, the database name is "temp". -** -** ^(On success, [SQLITE_OK] is returned and the new [BLOB handle] is written -** to *ppBlob. Otherwise an [error code] is returned and *ppBlob is set -** to be a null pointer.)^ -** ^This function sets the [database connection] error code and message -** accessible via [sqlite3_errcode()] and [sqlite3_errmsg()] and related -** functions. ^Note that the *ppBlob variable is always initialized in a -** way that makes it safe to invoke [sqlite3_blob_close()] on *ppBlob -** regardless of the success or failure of this routine. -** -** ^(If the row that a BLOB handle points to is modified by an -** [UPDATE], [DELETE], or by [ON CONFLICT] side-effects -** then the BLOB handle is marked as "expired". -** This is true if any column of the row is changed, even a column -** other than the one the BLOB handle is open on.)^ -** ^Calls to [sqlite3_blob_read()] and [sqlite3_blob_write()] for -** an expired BLOB handle fail with a return code of [SQLITE_ABORT]. -** ^(Changes written into a BLOB prior to the BLOB expiring are not -** rolled back by the expiration of the BLOB. Such changes will eventually -** commit if the transaction continues to completion.)^ -** -** ^Use the [sqlite3_blob_bytes()] interface to determine the size of -** the opened blob. ^The size of a blob may not be changed by this -** interface. Use the [UPDATE] SQL command to change the size of a -** blob. -** -** ^The [sqlite3_blob_open()] interface will fail for a [WITHOUT ROWID] -** table. Incremental BLOB I/O is not possible on [WITHOUT ROWID] tables. -** -** ^The [sqlite3_bind_zeroblob()] and [sqlite3_result_zeroblob()] interfaces -** and the built-in [zeroblob] SQL function can be used, if desired, -** to create an empty, zero-filled blob in which to read or write using -** this interface. -** -** To avoid a resource leak, every open [BLOB handle] should eventually -** be released by a call to [sqlite3_blob_close()]. -*/ -SQLITE_API int sqlite3_blob_open( - sqlite3*, - const char *zDb, - const char *zTable, - const char *zColumn, - sqlite3_int64 iRow, - int flags, - sqlite3_blob **ppBlob -); - -/* -** CAPI3REF: Move a BLOB Handle to a New Row -** -** ^This function is used to move an existing blob handle so that it points -** to a different row of the same database table. ^The new row is identified -** by the rowid value passed as the second argument. Only the row can be -** changed. ^The database, table and column on which the blob handle is open -** remain the same. Moving an existing blob handle to a new row can be -** faster than closing the existing handle and opening a new one. -** -** ^(The new row must meet the same criteria as for [sqlite3_blob_open()] - -** it must exist and there must be either a blob or text value stored in -** the nominated column.)^ ^If the new row is not present in the table, or if -** it does not contain a blob or text value, or if another error occurs, an -** SQLite error code is returned and the blob handle is considered aborted. -** ^All subsequent calls to [sqlite3_blob_read()], [sqlite3_blob_write()] or -** [sqlite3_blob_reopen()] on an aborted blob handle immediately return -** SQLITE_ABORT. ^Calling [sqlite3_blob_bytes()] on an aborted blob handle -** always returns zero. -** -** ^This function sets the database handle error code and message. -*/ -SQLITE_API SQLITE_EXPERIMENTAL int sqlite3_blob_reopen(sqlite3_blob *, sqlite3_int64); - -/* -** CAPI3REF: Close A BLOB Handle -** -** ^Closes an open [BLOB handle]. -** -** ^Closing a BLOB shall cause the current transaction to commit -** if there are no other BLOBs, no pending prepared statements, and the -** database connection is in [autocommit mode]. -** ^If any writes were made to the BLOB, they might be held in cache -** until the close operation if they will fit. -** -** ^(Closing the BLOB often forces the changes -** out to disk and so if any I/O errors occur, they will likely occur -** at the time when the BLOB is closed. Any errors that occur during -** closing are reported as a non-zero return value.)^ -** -** ^(The BLOB is closed unconditionally. Even if this routine returns -** an error code, the BLOB is still closed.)^ -** -** ^Calling this routine with a null pointer (such as would be returned -** by a failed call to [sqlite3_blob_open()]) is a harmless no-op. -*/ -SQLITE_API int sqlite3_blob_close(sqlite3_blob *); - -/* -** CAPI3REF: Return The Size Of An Open BLOB -** -** ^Returns the size in bytes of the BLOB accessible via the -** successfully opened [BLOB handle] in its only argument. ^The -** incremental blob I/O routines can only read or overwriting existing -** blob content; they cannot change the size of a blob. -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. -*/ -SQLITE_API int sqlite3_blob_bytes(sqlite3_blob *); - -/* -** CAPI3REF: Read Data From A BLOB Incrementally -** -** ^(This function is used to read data from an open [BLOB handle] into a -** caller-supplied buffer. N bytes of data are copied into buffer Z -** from the open BLOB, starting at offset iOffset.)^ -** -** ^If offset iOffset is less than N bytes from the end of the BLOB, -** [SQLITE_ERROR] is returned and no data is read. ^If N or iOffset is -** less than zero, [SQLITE_ERROR] is returned and no data is read. -** ^The size of the blob (and hence the maximum value of N+iOffset) -** can be determined using the [sqlite3_blob_bytes()] interface. -** -** ^An attempt to read from an expired [BLOB handle] fails with an -** error code of [SQLITE_ABORT]. -** -** ^(On success, sqlite3_blob_read() returns SQLITE_OK. -** Otherwise, an [error code] or an [extended error code] is returned.)^ -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. -** -** See also: [sqlite3_blob_write()]. -*/ -SQLITE_API int sqlite3_blob_read(sqlite3_blob *, void *Z, int N, int iOffset); - -/* -** CAPI3REF: Write Data Into A BLOB Incrementally -** -** ^This function is used to write data into an open [BLOB handle] from a -** caller-supplied buffer. ^N bytes of data are copied from the buffer Z -** into the open BLOB, starting at offset iOffset. -** -** ^If the [BLOB handle] passed as the first argument was not opened for -** writing (the flags parameter to [sqlite3_blob_open()] was zero), -** this function returns [SQLITE_READONLY]. -** -** ^This function may only modify the contents of the BLOB; it is -** not possible to increase the size of a BLOB using this API. -** ^If offset iOffset is less than N bytes from the end of the BLOB, -** [SQLITE_ERROR] is returned and no data is written. ^If N is -** less than zero [SQLITE_ERROR] is returned and no data is written. -** The size of the BLOB (and hence the maximum value of N+iOffset) -** can be determined using the [sqlite3_blob_bytes()] interface. -** -** ^An attempt to write to an expired [BLOB handle] fails with an -** error code of [SQLITE_ABORT]. ^Writes to the BLOB that occurred -** before the [BLOB handle] expired are not rolled back by the -** expiration of the handle, though of course those changes might -** have been overwritten by the statement that expired the BLOB handle -** or by other independent statements. -** -** ^(On success, sqlite3_blob_write() returns SQLITE_OK. -** Otherwise, an [error code] or an [extended error code] is returned.)^ -** -** This routine only works on a [BLOB handle] which has been created -** by a prior successful call to [sqlite3_blob_open()] and which has not -** been closed by [sqlite3_blob_close()]. Passing any other pointer in -** to this routine results in undefined and probably undesirable behavior. -** -** See also: [sqlite3_blob_read()]. -*/ -SQLITE_API int sqlite3_blob_write(sqlite3_blob *, const void *z, int n, int iOffset); - -/* -** CAPI3REF: Virtual File System Objects -** -** A virtual filesystem (VFS) is an [sqlite3_vfs] object -** that SQLite uses to interact -** with the underlying operating system. Most SQLite builds come with a -** single default VFS that is appropriate for the host computer. -** New VFSes can be registered and existing VFSes can be unregistered. -** The following interfaces are provided. -** -** ^The sqlite3_vfs_find() interface returns a pointer to a VFS given its name. -** ^Names are case sensitive. -** ^Names are zero-terminated UTF-8 strings. -** ^If there is no match, a NULL pointer is returned. -** ^If zVfsName is NULL then the default VFS is returned. -** -** ^New VFSes are registered with sqlite3_vfs_register(). -** ^Each new VFS becomes the default VFS if the makeDflt flag is set. -** ^The same VFS can be registered multiple times without injury. -** ^To make an existing VFS into the default VFS, register it again -** with the makeDflt flag set. If two different VFSes with the -** same name are registered, the behavior is undefined. If a -** VFS is registered with a name that is NULL or an empty string, -** then the behavior is undefined. -** -** ^Unregister a VFS with the sqlite3_vfs_unregister() interface. -** ^(If the default VFS is unregistered, another VFS is chosen as -** the default. The choice for the new VFS is arbitrary.)^ -*/ -SQLITE_API sqlite3_vfs *sqlite3_vfs_find(const char *zVfsName); -SQLITE_API int sqlite3_vfs_register(sqlite3_vfs*, int makeDflt); -SQLITE_API int sqlite3_vfs_unregister(sqlite3_vfs*); - -/* -** CAPI3REF: Mutexes -** -** The SQLite core uses these routines for thread -** synchronization. Though they are intended for internal -** use by SQLite, code that links against SQLite is -** permitted to use any of these routines. -** -** The SQLite source code contains multiple implementations -** of these mutex routines. An appropriate implementation -** is selected automatically at compile-time. ^(The following -** implementations are available in the SQLite core: -** -**
      -**
    • SQLITE_MUTEX_PTHREADS -**
    • SQLITE_MUTEX_W32 -**
    • SQLITE_MUTEX_NOOP -**
    )^ -** -** ^The SQLITE_MUTEX_NOOP implementation is a set of routines -** that does no real locking and is appropriate for use in -** a single-threaded application. ^The SQLITE_MUTEX_PTHREADS and -** SQLITE_MUTEX_W32 implementations are appropriate for use on Unix -** and Windows. -** -** ^(If SQLite is compiled with the SQLITE_MUTEX_APPDEF preprocessor -** macro defined (with "-DSQLITE_MUTEX_APPDEF=1"), then no mutex -** implementation is included with the library. In this case the -** application must supply a custom mutex implementation using the -** [SQLITE_CONFIG_MUTEX] option of the sqlite3_config() function -** before calling sqlite3_initialize() or any other public sqlite3_ -** function that calls sqlite3_initialize().)^ -** -** ^The sqlite3_mutex_alloc() routine allocates a new -** mutex and returns a pointer to it. ^If it returns NULL -** that means that a mutex could not be allocated. ^SQLite -** will unwind its stack and return an error. ^(The argument -** to sqlite3_mutex_alloc() is one of these integer constants: -** -**
      -**
    • SQLITE_MUTEX_FAST -**
    • SQLITE_MUTEX_RECURSIVE -**
    • SQLITE_MUTEX_STATIC_MASTER -**
    • SQLITE_MUTEX_STATIC_MEM -**
    • SQLITE_MUTEX_STATIC_MEM2 -**
    • SQLITE_MUTEX_STATIC_PRNG -**
    • SQLITE_MUTEX_STATIC_LRU -**
    • SQLITE_MUTEX_STATIC_LRU2 -**
    )^ -** -** ^The first two constants (SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) -** cause sqlite3_mutex_alloc() to create -** a new mutex. ^The new mutex is recursive when SQLITE_MUTEX_RECURSIVE -** is used but not necessarily so when SQLITE_MUTEX_FAST is used. -** The mutex implementation does not need to make a distinction -** between SQLITE_MUTEX_RECURSIVE and SQLITE_MUTEX_FAST if it does -** not want to. ^SQLite will only request a recursive mutex in -** cases where it really needs one. ^If a faster non-recursive mutex -** implementation is available on the host platform, the mutex subsystem -** might return such a mutex in response to SQLITE_MUTEX_FAST. -** -** ^The other allowed parameters to sqlite3_mutex_alloc() (anything other -** than SQLITE_MUTEX_FAST and SQLITE_MUTEX_RECURSIVE) each return -** a pointer to a static preexisting mutex. ^Six static mutexes are -** used by the current version of SQLite. Future versions of SQLite -** may add additional static mutexes. Static mutexes are for internal -** use by SQLite only. Applications that use SQLite mutexes should -** use only the dynamic mutexes returned by SQLITE_MUTEX_FAST or -** SQLITE_MUTEX_RECURSIVE. -** -** ^Note that if one of the dynamic mutex parameters (SQLITE_MUTEX_FAST -** or SQLITE_MUTEX_RECURSIVE) is used then sqlite3_mutex_alloc() -** returns a different mutex on every call. ^But for the static -** mutex types, the same mutex is returned on every call that has -** the same type number. -** -** ^The sqlite3_mutex_free() routine deallocates a previously -** allocated dynamic mutex. ^SQLite is careful to deallocate every -** dynamic mutex that it allocates. The dynamic mutexes must not be in -** use when they are deallocated. Attempting to deallocate a static -** mutex results in undefined behavior. ^SQLite never deallocates -** a static mutex. -** -** ^The sqlite3_mutex_enter() and sqlite3_mutex_try() routines attempt -** to enter a mutex. ^If another thread is already within the mutex, -** sqlite3_mutex_enter() will block and sqlite3_mutex_try() will return -** SQLITE_BUSY. ^The sqlite3_mutex_try() interface returns [SQLITE_OK] -** upon successful entry. ^(Mutexes created using -** SQLITE_MUTEX_RECURSIVE can be entered multiple times by the same thread. -** In such cases the, -** mutex must be exited an equal number of times before another thread -** can enter.)^ ^(If the same thread tries to enter any other -** kind of mutex more than once, the behavior is undefined. -** SQLite will never exhibit -** such behavior in its own use of mutexes.)^ -** -** ^(Some systems (for example, Windows 95) do not support the operation -** implemented by sqlite3_mutex_try(). On those systems, sqlite3_mutex_try() -** will always return SQLITE_BUSY. The SQLite core only ever uses -** sqlite3_mutex_try() as an optimization so this is acceptable behavior.)^ -** -** ^The sqlite3_mutex_leave() routine exits a mutex that was -** previously entered by the same thread. ^(The behavior -** is undefined if the mutex is not currently entered by the -** calling thread or is not currently allocated. SQLite will -** never do either.)^ -** -** ^If the argument to sqlite3_mutex_enter(), sqlite3_mutex_try(), or -** sqlite3_mutex_leave() is a NULL pointer, then all three routines -** behave as no-ops. -** -** See also: [sqlite3_mutex_held()] and [sqlite3_mutex_notheld()]. -*/ -SQLITE_API sqlite3_mutex *sqlite3_mutex_alloc(int); -SQLITE_API void sqlite3_mutex_free(sqlite3_mutex*); -SQLITE_API void sqlite3_mutex_enter(sqlite3_mutex*); -SQLITE_API int sqlite3_mutex_try(sqlite3_mutex*); -SQLITE_API void sqlite3_mutex_leave(sqlite3_mutex*); - -/* -** CAPI3REF: Mutex Methods Object -** -** An instance of this structure defines the low-level routines -** used to allocate and use mutexes. -** -** Usually, the default mutex implementations provided by SQLite are -** sufficient, however the user has the option of substituting a custom -** implementation for specialized deployments or systems for which SQLite -** does not provide a suitable implementation. In this case, the user -** creates and populates an instance of this structure to pass -** to sqlite3_config() along with the [SQLITE_CONFIG_MUTEX] option. -** Additionally, an instance of this structure can be used as an -** output variable when querying the system for the current mutex -** implementation, using the [SQLITE_CONFIG_GETMUTEX] option. -** -** ^The xMutexInit method defined by this structure is invoked as -** part of system initialization by the sqlite3_initialize() function. -** ^The xMutexInit routine is called by SQLite exactly once for each -** effective call to [sqlite3_initialize()]. -** -** ^The xMutexEnd method defined by this structure is invoked as -** part of system shutdown by the sqlite3_shutdown() function. The -** implementation of this method is expected to release all outstanding -** resources obtained by the mutex methods implementation, especially -** those obtained by the xMutexInit method. ^The xMutexEnd() -** interface is invoked exactly once for each call to [sqlite3_shutdown()]. -** -** ^(The remaining seven methods defined by this structure (xMutexAlloc, -** xMutexFree, xMutexEnter, xMutexTry, xMutexLeave, xMutexHeld and -** xMutexNotheld) implement the following interfaces (respectively): -** -**
      -**
    • [sqlite3_mutex_alloc()]
    • -**
    • [sqlite3_mutex_free()]
    • -**
    • [sqlite3_mutex_enter()]
    • -**
    • [sqlite3_mutex_try()]
    • -**
    • [sqlite3_mutex_leave()]
    • -**
    • [sqlite3_mutex_held()]
    • -**
    • [sqlite3_mutex_notheld()]
    • -**
    )^ -** -** The only difference is that the public sqlite3_XXX functions enumerated -** above silently ignore any invocations that pass a NULL pointer instead -** of a valid mutex handle. The implementations of the methods defined -** by this structure are not required to handle this case, the results -** of passing a NULL pointer instead of a valid mutex handle are undefined -** (i.e. it is acceptable to provide an implementation that segfaults if -** it is passed a NULL pointer). -** -** The xMutexInit() method must be threadsafe. ^It must be harmless to -** invoke xMutexInit() multiple times within the same process and without -** intervening calls to xMutexEnd(). Second and subsequent calls to -** xMutexInit() must be no-ops. -** -** ^xMutexInit() must not use SQLite memory allocation ([sqlite3_malloc()] -** and its associates). ^Similarly, xMutexAlloc() must not use SQLite memory -** allocation for a static mutex. ^However xMutexAlloc() may use SQLite -** memory allocation for a fast or recursive mutex. -** -** ^SQLite will invoke the xMutexEnd() method when [sqlite3_shutdown()] is -** called, but only if the prior call to xMutexInit returned SQLITE_OK. -** If xMutexInit fails in any way, it is expected to clean up after itself -** prior to returning. -*/ -typedef struct sqlite3_mutex_methods sqlite3_mutex_methods; -struct sqlite3_mutex_methods { - int (*xMutexInit)(void); - int (*xMutexEnd)(void); - sqlite3_mutex *(*xMutexAlloc)(int); - void (*xMutexFree)(sqlite3_mutex *); - void (*xMutexEnter)(sqlite3_mutex *); - int (*xMutexTry)(sqlite3_mutex *); - void (*xMutexLeave)(sqlite3_mutex *); - int (*xMutexHeld)(sqlite3_mutex *); - int (*xMutexNotheld)(sqlite3_mutex *); -}; - -/* -** CAPI3REF: Mutex Verification Routines -** -** The sqlite3_mutex_held() and sqlite3_mutex_notheld() routines -** are intended for use inside assert() statements. ^The SQLite core -** never uses these routines except inside an assert() and applications -** are advised to follow the lead of the core. ^The SQLite core only -** provides implementations for these routines when it is compiled -** with the SQLITE_DEBUG flag. ^External mutex implementations -** are only required to provide these routines if SQLITE_DEBUG is -** defined and if NDEBUG is not defined. -** -** ^These routines should return true if the mutex in their argument -** is held or not held, respectively, by the calling thread. -** -** ^The implementation is not required to provide versions of these -** routines that actually work. If the implementation does not provide working -** versions of these routines, it should at least provide stubs that always -** return true so that one does not get spurious assertion failures. -** -** ^If the argument to sqlite3_mutex_held() is a NULL pointer then -** the routine should return 1. This seems counter-intuitive since -** clearly the mutex cannot be held if it does not exist. But -** the reason the mutex does not exist is because the build is not -** using mutexes. And we do not want the assert() containing the -** call to sqlite3_mutex_held() to fail, so a non-zero return is -** the appropriate thing to do. ^The sqlite3_mutex_notheld() -** interface should also return 1 when given a NULL pointer. -*/ -#ifndef NDEBUG -SQLITE_API int sqlite3_mutex_held(sqlite3_mutex*); -SQLITE_API int sqlite3_mutex_notheld(sqlite3_mutex*); -#endif - -/* -** CAPI3REF: Mutex Types -** -** The [sqlite3_mutex_alloc()] interface takes a single argument -** which is one of these integer constants. -** -** The set of static mutexes may change from one SQLite release to the -** next. Applications that override the built-in mutex logic must be -** prepared to accommodate additional static mutexes. -*/ -#define SQLITE_MUTEX_FAST 0 -#define SQLITE_MUTEX_RECURSIVE 1 -#define SQLITE_MUTEX_STATIC_MASTER 2 -#define SQLITE_MUTEX_STATIC_MEM 3 /* sqlite3_malloc() */ -#define SQLITE_MUTEX_STATIC_MEM2 4 /* NOT USED */ -#define SQLITE_MUTEX_STATIC_OPEN 4 /* sqlite3BtreeOpen() */ -#define SQLITE_MUTEX_STATIC_PRNG 5 /* sqlite3_random() */ -#define SQLITE_MUTEX_STATIC_LRU 6 /* lru page list */ -#define SQLITE_MUTEX_STATIC_LRU2 7 /* NOT USED */ -#define SQLITE_MUTEX_STATIC_PMEM 7 /* sqlite3PageMalloc() */ - -/* -** CAPI3REF: Retrieve the mutex for a database connection -** -** ^This interface returns a pointer the [sqlite3_mutex] object that -** serializes access to the [database connection] given in the argument -** when the [threading mode] is Serialized. -** ^If the [threading mode] is Single-thread or Multi-thread then this -** routine returns a NULL pointer. -*/ -SQLITE_API sqlite3_mutex *sqlite3_db_mutex(sqlite3*); - -/* -** CAPI3REF: Low-Level Control Of Database Files -** -** ^The [sqlite3_file_control()] interface makes a direct call to the -** xFileControl method for the [sqlite3_io_methods] object associated -** with a particular database identified by the second argument. ^The -** name of the database is "main" for the main database or "temp" for the -** TEMP database, or the name that appears after the AS keyword for -** databases that are added using the [ATTACH] SQL command. -** ^A NULL pointer can be used in place of "main" to refer to the -** main database file. -** ^The third and fourth parameters to this routine -** are passed directly through to the second and third parameters of -** the xFileControl method. ^The return value of the xFileControl -** method becomes the return value of this routine. -** -** ^The SQLITE_FCNTL_FILE_POINTER value for the op parameter causes -** a pointer to the underlying [sqlite3_file] object to be written into -** the space pointed to by the 4th parameter. ^The SQLITE_FCNTL_FILE_POINTER -** case is a short-circuit path which does not actually invoke the -** underlying sqlite3_io_methods.xFileControl method. -** -** ^If the second parameter (zDbName) does not match the name of any -** open database file, then SQLITE_ERROR is returned. ^This error -** code is not remembered and will not be recalled by [sqlite3_errcode()] -** or [sqlite3_errmsg()]. The underlying xFileControl method might -** also return SQLITE_ERROR. There is no way to distinguish between -** an incorrect zDbName and an SQLITE_ERROR return from the underlying -** xFileControl method. -** -** See also: [SQLITE_FCNTL_LOCKSTATE] -*/ -SQLITE_API int sqlite3_file_control(sqlite3*, const char *zDbName, int op, void*); - -/* -** CAPI3REF: Testing Interface -** -** ^The sqlite3_test_control() interface is used to read out internal -** state of SQLite and to inject faults into SQLite for testing -** purposes. ^The first parameter is an operation code that determines -** the number, meaning, and operation of all subsequent parameters. -** -** This interface is not for use by applications. It exists solely -** for verifying the correct operation of the SQLite library. Depending -** on how the SQLite library is compiled, this interface might not exist. -** -** The details of the operation codes, their meanings, the parameters -** they take, and what they do are all subject to change without notice. -** Unlike most of the SQLite API, this function is not guaranteed to -** operate consistently from one release to the next. -*/ -SQLITE_API int sqlite3_test_control(int op, ...); - -/* -** CAPI3REF: Testing Interface Operation Codes -** -** These constants are the valid operation code parameters used -** as the first argument to [sqlite3_test_control()]. -** -** These parameters and their meanings are subject to change -** without notice. These values are for testing purposes only. -** Applications should not use any of these parameters or the -** [sqlite3_test_control()] interface. -*/ -#define SQLITE_TESTCTRL_FIRST 5 -#define SQLITE_TESTCTRL_PRNG_SAVE 5 -#define SQLITE_TESTCTRL_PRNG_RESTORE 6 -#define SQLITE_TESTCTRL_PRNG_RESET 7 -#define SQLITE_TESTCTRL_BITVEC_TEST 8 -#define SQLITE_TESTCTRL_FAULT_INSTALL 9 -#define SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS 10 -#define SQLITE_TESTCTRL_PENDING_BYTE 11 -#define SQLITE_TESTCTRL_ASSERT 12 -#define SQLITE_TESTCTRL_ALWAYS 13 -#define SQLITE_TESTCTRL_RESERVE 14 -#define SQLITE_TESTCTRL_OPTIMIZATIONS 15 -#define SQLITE_TESTCTRL_ISKEYWORD 16 -#define SQLITE_TESTCTRL_SCRATCHMALLOC 17 -#define SQLITE_TESTCTRL_LOCALTIME_FAULT 18 -#define SQLITE_TESTCTRL_EXPLAIN_STMT 19 -#define SQLITE_TESTCTRL_NEVER_CORRUPT 20 -#define SQLITE_TESTCTRL_LAST 20 - -/* -** CAPI3REF: SQLite Runtime Status -** -** ^This interface is used to retrieve runtime status information -** about the performance of SQLite, and optionally to reset various -** highwater marks. ^The first argument is an integer code for -** the specific parameter to measure. ^(Recognized integer codes -** are of the form [status parameters | SQLITE_STATUS_...].)^ -** ^The current value of the parameter is returned into *pCurrent. -** ^The highest recorded value is returned in *pHighwater. ^If the -** resetFlag is true, then the highest record value is reset after -** *pHighwater is written. ^(Some parameters do not record the highest -** value. For those parameters -** nothing is written into *pHighwater and the resetFlag is ignored.)^ -** ^(Other parameters record only the highwater mark and not the current -** value. For these latter parameters nothing is written into *pCurrent.)^ -** -** ^The sqlite3_status() routine returns SQLITE_OK on success and a -** non-zero [error code] on failure. -** -** This routine is threadsafe but is not atomic. This routine can be -** called while other threads are running the same or different SQLite -** interfaces. However the values returned in *pCurrent and -** *pHighwater reflect the status of SQLite at different points in time -** and it is possible that another thread might change the parameter -** in between the times when *pCurrent and *pHighwater are written. -** -** See also: [sqlite3_db_status()] -*/ -SQLITE_API int sqlite3_status(int op, int *pCurrent, int *pHighwater, int resetFlag); - - -/* -** CAPI3REF: Status Parameters -** KEYWORDS: {status parameters} -** -** These integer constants designate various run-time status parameters -** that can be returned by [sqlite3_status()]. -** -**
    -** [[SQLITE_STATUS_MEMORY_USED]] ^(
    SQLITE_STATUS_MEMORY_USED
    -**
    This parameter is the current amount of memory checked out -** using [sqlite3_malloc()], either directly or indirectly. The -** figure includes calls made to [sqlite3_malloc()] by the application -** and internal memory usage by the SQLite library. Scratch memory -** controlled by [SQLITE_CONFIG_SCRATCH] and auxiliary page-cache -** memory controlled by [SQLITE_CONFIG_PAGECACHE] is not included in -** this parameter. The amount returned is the sum of the allocation -** sizes as reported by the xSize method in [sqlite3_mem_methods].
    )^ -** -** [[SQLITE_STATUS_MALLOC_SIZE]] ^(
    SQLITE_STATUS_MALLOC_SIZE
    -**
    This parameter records the largest memory allocation request -** handed to [sqlite3_malloc()] or [sqlite3_realloc()] (or their -** internal equivalents). Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. -** The value written into the *pCurrent parameter is undefined.
    )^ -** -** [[SQLITE_STATUS_MALLOC_COUNT]] ^(
    SQLITE_STATUS_MALLOC_COUNT
    -**
    This parameter records the number of separate memory allocations -** currently checked out.
    )^ -** -** [[SQLITE_STATUS_PAGECACHE_USED]] ^(
    SQLITE_STATUS_PAGECACHE_USED
    -**
    This parameter returns the number of pages used out of the -** [pagecache memory allocator] that was configured using -** [SQLITE_CONFIG_PAGECACHE]. The -** value returned is in pages, not in bytes.
    )^ -** -** [[SQLITE_STATUS_PAGECACHE_OVERFLOW]] -** ^(
    SQLITE_STATUS_PAGECACHE_OVERFLOW
    -**
    This parameter returns the number of bytes of page cache -** allocation which could not be satisfied by the [SQLITE_CONFIG_PAGECACHE] -** buffer and where forced to overflow to [sqlite3_malloc()]. The -** returned value includes allocations that overflowed because they -** where too large (they were larger than the "sz" parameter to -** [SQLITE_CONFIG_PAGECACHE]) and allocations that overflowed because -** no space was left in the page cache.
    )^ -** -** [[SQLITE_STATUS_PAGECACHE_SIZE]] ^(
    SQLITE_STATUS_PAGECACHE_SIZE
    -**
    This parameter records the largest memory allocation request -** handed to [pagecache memory allocator]. Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. -** The value written into the *pCurrent parameter is undefined.
    )^ -** -** [[SQLITE_STATUS_SCRATCH_USED]] ^(
    SQLITE_STATUS_SCRATCH_USED
    -**
    This parameter returns the number of allocations used out of the -** [scratch memory allocator] configured using -** [SQLITE_CONFIG_SCRATCH]. The value returned is in allocations, not -** in bytes. Since a single thread may only have one scratch allocation -** outstanding at time, this parameter also reports the number of threads -** using scratch memory at the same time.
    )^ -** -** [[SQLITE_STATUS_SCRATCH_OVERFLOW]] ^(
    SQLITE_STATUS_SCRATCH_OVERFLOW
    -**
    This parameter returns the number of bytes of scratch memory -** allocation which could not be satisfied by the [SQLITE_CONFIG_SCRATCH] -** buffer and where forced to overflow to [sqlite3_malloc()]. The values -** returned include overflows because the requested allocation was too -** larger (that is, because the requested allocation was larger than the -** "sz" parameter to [SQLITE_CONFIG_SCRATCH]) and because no scratch buffer -** slots were available. -**
    )^ -** -** [[SQLITE_STATUS_SCRATCH_SIZE]] ^(
    SQLITE_STATUS_SCRATCH_SIZE
    -**
    This parameter records the largest memory allocation request -** handed to [scratch memory allocator]. Only the value returned in the -** *pHighwater parameter to [sqlite3_status()] is of interest. -** The value written into the *pCurrent parameter is undefined.
    )^ -** -** [[SQLITE_STATUS_PARSER_STACK]] ^(
    SQLITE_STATUS_PARSER_STACK
    -**
    This parameter records the deepest parser stack. It is only -** meaningful if SQLite is compiled with [YYTRACKMAXSTACKDEPTH].
    )^ -**
    -** -** New status parameters may be added from time to time. -*/ -#define SQLITE_STATUS_MEMORY_USED 0 -#define SQLITE_STATUS_PAGECACHE_USED 1 -#define SQLITE_STATUS_PAGECACHE_OVERFLOW 2 -#define SQLITE_STATUS_SCRATCH_USED 3 -#define SQLITE_STATUS_SCRATCH_OVERFLOW 4 -#define SQLITE_STATUS_MALLOC_SIZE 5 -#define SQLITE_STATUS_PARSER_STACK 6 -#define SQLITE_STATUS_PAGECACHE_SIZE 7 -#define SQLITE_STATUS_SCRATCH_SIZE 8 -#define SQLITE_STATUS_MALLOC_COUNT 9 - -/* -** CAPI3REF: Database Connection Status -** -** ^This interface is used to retrieve runtime status information -** about a single [database connection]. ^The first argument is the -** database connection object to be interrogated. ^The second argument -** is an integer constant, taken from the set of -** [SQLITE_DBSTATUS options], that -** determines the parameter to interrogate. The set of -** [SQLITE_DBSTATUS options] is likely -** to grow in future releases of SQLite. -** -** ^The current value of the requested parameter is written into *pCur -** and the highest instantaneous value is written into *pHiwtr. ^If -** the resetFlg is true, then the highest instantaneous value is -** reset back down to the current value. -** -** ^The sqlite3_db_status() routine returns SQLITE_OK on success and a -** non-zero [error code] on failure. -** -** See also: [sqlite3_status()] and [sqlite3_stmt_status()]. -*/ -SQLITE_API int sqlite3_db_status(sqlite3*, int op, int *pCur, int *pHiwtr, int resetFlg); - -/* -** CAPI3REF: Status Parameters for database connections -** KEYWORDS: {SQLITE_DBSTATUS options} -** -** These constants are the available integer "verbs" that can be passed as -** the second argument to the [sqlite3_db_status()] interface. -** -** New verbs may be added in future releases of SQLite. Existing verbs -** might be discontinued. Applications should check the return code from -** [sqlite3_db_status()] to make sure that the call worked. -** The [sqlite3_db_status()] interface will return a non-zero error code -** if a discontinued or unsupported verb is invoked. -** -**
    -** [[SQLITE_DBSTATUS_LOOKASIDE_USED]] ^(
    SQLITE_DBSTATUS_LOOKASIDE_USED
    -**
    This parameter returns the number of lookaside memory slots currently -** checked out.
    )^ -** -** [[SQLITE_DBSTATUS_LOOKASIDE_HIT]] ^(
    SQLITE_DBSTATUS_LOOKASIDE_HIT
    -**
    This parameter returns the number malloc attempts that were -** satisfied using lookaside memory. Only the high-water value is meaningful; -** the current value is always zero.)^ -** -** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE]] -** ^(
    SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE
    -**
    This parameter returns the number malloc attempts that might have -** been satisfied using lookaside memory but failed due to the amount of -** memory requested being larger than the lookaside slot size. -** Only the high-water value is meaningful; -** the current value is always zero.)^ -** -** [[SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL]] -** ^(
    SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL
    -**
    This parameter returns the number malloc attempts that might have -** been satisfied using lookaside memory but failed due to all lookaside -** memory already being in use. -** Only the high-water value is meaningful; -** the current value is always zero.)^ -** -** [[SQLITE_DBSTATUS_CACHE_USED]] ^(
    SQLITE_DBSTATUS_CACHE_USED
    -**
    This parameter returns the approximate number of of bytes of heap -** memory used by all pager caches associated with the database connection.)^ -** ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_USED is always 0. -** -** [[SQLITE_DBSTATUS_SCHEMA_USED]] ^(
    SQLITE_DBSTATUS_SCHEMA_USED
    -**
    This parameter returns the approximate number of of bytes of heap -** memory used to store the schema for all databases associated -** with the connection - main, temp, and any [ATTACH]-ed databases.)^ -** ^The full amount of memory used by the schemas is reported, even if the -** schema memory is shared with other database connections due to -** [shared cache mode] being enabled. -** ^The highwater mark associated with SQLITE_DBSTATUS_SCHEMA_USED is always 0. -** -** [[SQLITE_DBSTATUS_STMT_USED]] ^(
    SQLITE_DBSTATUS_STMT_USED
    -**
    This parameter returns the approximate number of of bytes of heap -** and lookaside memory used by all prepared statements associated with -** the database connection.)^ -** ^The highwater mark associated with SQLITE_DBSTATUS_STMT_USED is always 0. -**
    -** -** [[SQLITE_DBSTATUS_CACHE_HIT]] ^(
    SQLITE_DBSTATUS_CACHE_HIT
    -**
    This parameter returns the number of pager cache hits that have -** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_HIT -** is always 0. -**
    -** -** [[SQLITE_DBSTATUS_CACHE_MISS]] ^(
    SQLITE_DBSTATUS_CACHE_MISS
    -**
    This parameter returns the number of pager cache misses that have -** occurred.)^ ^The highwater mark associated with SQLITE_DBSTATUS_CACHE_MISS -** is always 0. -**
    -** -** [[SQLITE_DBSTATUS_CACHE_WRITE]] ^(
    SQLITE_DBSTATUS_CACHE_WRITE
    -**
    This parameter returns the number of dirty cache entries that have -** been written to disk. Specifically, the number of pages written to the -** wal file in wal mode databases, or the number of pages written to the -** database file in rollback mode databases. Any pages written as part of -** transaction rollback or database recovery operations are not included. -** If an IO or other error occurs while writing a page to disk, the effect -** on subsequent SQLITE_DBSTATUS_CACHE_WRITE requests is undefined.)^ ^The -** highwater mark associated with SQLITE_DBSTATUS_CACHE_WRITE is always 0. -**
    -** -** [[SQLITE_DBSTATUS_DEFERRED_FKS]] ^(
    SQLITE_DBSTATUS_DEFERRED_FKS
    -**
    This parameter returns zero for the current value if and only if -** all foreign key constraints (deferred or immediate) have been -** resolved.)^ ^The highwater mark is always 0. -**
    -**
    -*/ -#define SQLITE_DBSTATUS_LOOKASIDE_USED 0 -#define SQLITE_DBSTATUS_CACHE_USED 1 -#define SQLITE_DBSTATUS_SCHEMA_USED 2 -#define SQLITE_DBSTATUS_STMT_USED 3 -#define SQLITE_DBSTATUS_LOOKASIDE_HIT 4 -#define SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE 5 -#define SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL 6 -#define SQLITE_DBSTATUS_CACHE_HIT 7 -#define SQLITE_DBSTATUS_CACHE_MISS 8 -#define SQLITE_DBSTATUS_CACHE_WRITE 9 -#define SQLITE_DBSTATUS_DEFERRED_FKS 10 -#define SQLITE_DBSTATUS_MAX 10 /* Largest defined DBSTATUS */ - - -/* -** CAPI3REF: Prepared Statement Status -** -** ^(Each prepared statement maintains various -** [SQLITE_STMTSTATUS counters] that measure the number -** of times it has performed specific operations.)^ These counters can -** be used to monitor the performance characteristics of the prepared -** statements. For example, if the number of table steps greatly exceeds -** the number of table searches or result rows, that would tend to indicate -** that the prepared statement is using a full table scan rather than -** an index. -** -** ^(This interface is used to retrieve and reset counter values from -** a [prepared statement]. The first argument is the prepared statement -** object to be interrogated. The second argument -** is an integer code for a specific [SQLITE_STMTSTATUS counter] -** to be interrogated.)^ -** ^The current value of the requested counter is returned. -** ^If the resetFlg is true, then the counter is reset to zero after this -** interface call returns. -** -** See also: [sqlite3_status()] and [sqlite3_db_status()]. -*/ -SQLITE_API int sqlite3_stmt_status(sqlite3_stmt*, int op,int resetFlg); - -/* -** CAPI3REF: Status Parameters for prepared statements -** KEYWORDS: {SQLITE_STMTSTATUS counter} {SQLITE_STMTSTATUS counters} -** -** These preprocessor macros define integer codes that name counter -** values associated with the [sqlite3_stmt_status()] interface. -** The meanings of the various counters are as follows: -** -**
    -** [[SQLITE_STMTSTATUS_FULLSCAN_STEP]]
    SQLITE_STMTSTATUS_FULLSCAN_STEP
    -**
    ^This is the number of times that SQLite has stepped forward in -** a table as part of a full table scan. Large numbers for this counter -** may indicate opportunities for performance improvement through -** careful use of indices.
    -** -** [[SQLITE_STMTSTATUS_SORT]]
    SQLITE_STMTSTATUS_SORT
    -**
    ^This is the number of sort operations that have occurred. -** A non-zero value in this counter may indicate an opportunity to -** improvement performance through careful use of indices.
    -** -** [[SQLITE_STMTSTATUS_AUTOINDEX]]
    SQLITE_STMTSTATUS_AUTOINDEX
    -**
    ^This is the number of rows inserted into transient indices that -** were created automatically in order to help joins run faster. -** A non-zero value in this counter may indicate an opportunity to -** improvement performance by adding permanent indices that do not -** need to be reinitialized each time the statement is run.
    -** -** [[SQLITE_STMTSTATUS_VM_STEP]]
    SQLITE_STMTSTATUS_VM_STEP
    -**
    ^This is the number of virtual machine operations executed -** by the prepared statement if that number is less than or equal -** to 2147483647. The number of virtual machine operations can be -** used as a proxy for the total work done by the prepared statement. -** If the number of virtual machine operations exceeds 2147483647 -** then the value returned by this statement status code is undefined. -**
    -**
    -*/ -#define SQLITE_STMTSTATUS_FULLSCAN_STEP 1 -#define SQLITE_STMTSTATUS_SORT 2 -#define SQLITE_STMTSTATUS_AUTOINDEX 3 -#define SQLITE_STMTSTATUS_VM_STEP 4 - -/* -** CAPI3REF: Custom Page Cache Object -** -** The sqlite3_pcache type is opaque. It is implemented by -** the pluggable module. The SQLite core has no knowledge of -** its size or internal structure and never deals with the -** sqlite3_pcache object except by holding and passing pointers -** to the object. -** -** See [sqlite3_pcache_methods2] for additional information. -*/ -typedef struct sqlite3_pcache sqlite3_pcache; - -/* -** CAPI3REF: Custom Page Cache Object -** -** The sqlite3_pcache_page object represents a single page in the -** page cache. The page cache will allocate instances of this -** object. Various methods of the page cache use pointers to instances -** of this object as parameters or as their return value. -** -** See [sqlite3_pcache_methods2] for additional information. -*/ -typedef struct sqlite3_pcache_page sqlite3_pcache_page; -struct sqlite3_pcache_page { - void *pBuf; /* The content of the page */ - void *pExtra; /* Extra information associated with the page */ -}; - -/* -** CAPI3REF: Application Defined Page Cache. -** KEYWORDS: {page cache} -** -** ^(The [sqlite3_config]([SQLITE_CONFIG_PCACHE2], ...) interface can -** register an alternative page cache implementation by passing in an -** instance of the sqlite3_pcache_methods2 structure.)^ -** In many applications, most of the heap memory allocated by -** SQLite is used for the page cache. -** By implementing a -** custom page cache using this API, an application can better control -** the amount of memory consumed by SQLite, the way in which -** that memory is allocated and released, and the policies used to -** determine exactly which parts of a database file are cached and for -** how long. -** -** The alternative page cache mechanism is an -** extreme measure that is only needed by the most demanding applications. -** The built-in page cache is recommended for most uses. -** -** ^(The contents of the sqlite3_pcache_methods2 structure are copied to an -** internal buffer by SQLite within the call to [sqlite3_config]. Hence -** the application may discard the parameter after the call to -** [sqlite3_config()] returns.)^ -** -** [[the xInit() page cache method]] -** ^(The xInit() method is called once for each effective -** call to [sqlite3_initialize()])^ -** (usually only once during the lifetime of the process). ^(The xInit() -** method is passed a copy of the sqlite3_pcache_methods2.pArg value.)^ -** The intent of the xInit() method is to set up global data structures -** required by the custom page cache implementation. -** ^(If the xInit() method is NULL, then the -** built-in default page cache is used instead of the application defined -** page cache.)^ -** -** [[the xShutdown() page cache method]] -** ^The xShutdown() method is called by [sqlite3_shutdown()]. -** It can be used to clean up -** any outstanding resources before process shutdown, if required. -** ^The xShutdown() method may be NULL. -** -** ^SQLite automatically serializes calls to the xInit method, -** so the xInit method need not be threadsafe. ^The -** xShutdown method is only called from [sqlite3_shutdown()] so it does -** not need to be threadsafe either. All other methods must be threadsafe -** in multithreaded applications. -** -** ^SQLite will never invoke xInit() more than once without an intervening -** call to xShutdown(). -** -** [[the xCreate() page cache methods]] -** ^SQLite invokes the xCreate() method to construct a new cache instance. -** SQLite will typically create one cache instance for each open database file, -** though this is not guaranteed. ^The -** first parameter, szPage, is the size in bytes of the pages that must -** be allocated by the cache. ^szPage will always a power of two. ^The -** second parameter szExtra is a number of bytes of extra storage -** associated with each page cache entry. ^The szExtra parameter will -** a number less than 250. SQLite will use the -** extra szExtra bytes on each page to store metadata about the underlying -** database page on disk. The value passed into szExtra depends -** on the SQLite version, the target platform, and how SQLite was compiled. -** ^The third argument to xCreate(), bPurgeable, is true if the cache being -** created will be used to cache database pages of a file stored on disk, or -** false if it is used for an in-memory database. The cache implementation -** does not have to do anything special based with the value of bPurgeable; -** it is purely advisory. ^On a cache where bPurgeable is false, SQLite will -** never invoke xUnpin() except to deliberately delete a page. -** ^In other words, calls to xUnpin() on a cache with bPurgeable set to -** false will always have the "discard" flag set to true. -** ^Hence, a cache created with bPurgeable false will -** never contain any unpinned pages. -** -** [[the xCachesize() page cache method]] -** ^(The xCachesize() method may be called at any time by SQLite to set the -** suggested maximum cache-size (number of pages stored by) the cache -** instance passed as the first argument. This is the value configured using -** the SQLite "[PRAGMA cache_size]" command.)^ As with the bPurgeable -** parameter, the implementation is not required to do anything with this -** value; it is advisory only. -** -** [[the xPagecount() page cache methods]] -** The xPagecount() method must return the number of pages currently -** stored in the cache, both pinned and unpinned. -** -** [[the xFetch() page cache methods]] -** The xFetch() method locates a page in the cache and returns a pointer to -** an sqlite3_pcache_page object associated with that page, or a NULL pointer. -** The pBuf element of the returned sqlite3_pcache_page object will be a -** pointer to a buffer of szPage bytes used to store the content of a -** single database page. The pExtra element of sqlite3_pcache_page will be -** a pointer to the szExtra bytes of extra storage that SQLite has requested -** for each entry in the page cache. -** -** The page to be fetched is determined by the key. ^The minimum key value -** is 1. After it has been retrieved using xFetch, the page is considered -** to be "pinned". -** -** If the requested page is already in the page cache, then the page cache -** implementation must return a pointer to the page buffer with its content -** intact. If the requested page is not already in the cache, then the -** cache implementation should use the value of the createFlag -** parameter to help it determined what action to take: -** -** -**
    createFlag Behavior when page is not already in cache -**
    0 Do not allocate a new page. Return NULL. -**
    1 Allocate a new page if it easy and convenient to do so. -** Otherwise return NULL. -**
    2 Make every effort to allocate a new page. Only return -** NULL if allocating a new page is effectively impossible. -**
    -** -** ^(SQLite will normally invoke xFetch() with a createFlag of 0 or 1. SQLite -** will only use a createFlag of 2 after a prior call with a createFlag of 1 -** failed.)^ In between the to xFetch() calls, SQLite may -** attempt to unpin one or more cache pages by spilling the content of -** pinned pages to disk and synching the operating system disk cache. -** -** [[the xUnpin() page cache method]] -** ^xUnpin() is called by SQLite with a pointer to a currently pinned page -** as its second argument. If the third parameter, discard, is non-zero, -** then the page must be evicted from the cache. -** ^If the discard parameter is -** zero, then the page may be discarded or retained at the discretion of -** page cache implementation. ^The page cache implementation -** may choose to evict unpinned pages at any time. -** -** The cache must not perform any reference counting. A single -** call to xUnpin() unpins the page regardless of the number of prior calls -** to xFetch(). -** -** [[the xRekey() page cache methods]] -** The xRekey() method is used to change the key value associated with the -** page passed as the second argument. If the cache -** previously contains an entry associated with newKey, it must be -** discarded. ^Any prior cache entry associated with newKey is guaranteed not -** to be pinned. -** -** When SQLite calls the xTruncate() method, the cache must discard all -** existing cache entries with page numbers (keys) greater than or equal -** to the value of the iLimit parameter passed to xTruncate(). If any -** of these pages are pinned, they are implicitly unpinned, meaning that -** they can be safely discarded. -** -** [[the xDestroy() page cache method]] -** ^The xDestroy() method is used to delete a cache allocated by xCreate(). -** All resources associated with the specified cache should be freed. ^After -** calling the xDestroy() method, SQLite considers the [sqlite3_pcache*] -** handle invalid, and will not use it with any other sqlite3_pcache_methods2 -** functions. -** -** [[the xShrink() page cache method]] -** ^SQLite invokes the xShrink() method when it wants the page cache to -** free up as much of heap memory as possible. The page cache implementation -** is not obligated to free any memory, but well-behaved implementations should -** do their best. -*/ -typedef struct sqlite3_pcache_methods2 sqlite3_pcache_methods2; -struct sqlite3_pcache_methods2 { - int iVersion; - void *pArg; - int (*xInit)(void*); - void (*xShutdown)(void*); - sqlite3_pcache *(*xCreate)(int szPage, int szExtra, int bPurgeable); - void (*xCachesize)(sqlite3_pcache*, int nCachesize); - int (*xPagecount)(sqlite3_pcache*); - sqlite3_pcache_page *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); - void (*xUnpin)(sqlite3_pcache*, sqlite3_pcache_page*, int discard); - void (*xRekey)(sqlite3_pcache*, sqlite3_pcache_page*, - unsigned oldKey, unsigned newKey); - void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); - void (*xDestroy)(sqlite3_pcache*); - void (*xShrink)(sqlite3_pcache*); -}; - -/* -** This is the obsolete pcache_methods object that has now been replaced -** by sqlite3_pcache_methods2. This object is not used by SQLite. It is -** retained in the header file for backwards compatibility only. -*/ -typedef struct sqlite3_pcache_methods sqlite3_pcache_methods; -struct sqlite3_pcache_methods { - void *pArg; - int (*xInit)(void*); - void (*xShutdown)(void*); - sqlite3_pcache *(*xCreate)(int szPage, int bPurgeable); - void (*xCachesize)(sqlite3_pcache*, int nCachesize); - int (*xPagecount)(sqlite3_pcache*); - void *(*xFetch)(sqlite3_pcache*, unsigned key, int createFlag); - void (*xUnpin)(sqlite3_pcache*, void*, int discard); - void (*xRekey)(sqlite3_pcache*, void*, unsigned oldKey, unsigned newKey); - void (*xTruncate)(sqlite3_pcache*, unsigned iLimit); - void (*xDestroy)(sqlite3_pcache*); -}; - - -/* -** CAPI3REF: Online Backup Object -** -** The sqlite3_backup object records state information about an ongoing -** online backup operation. ^The sqlite3_backup object is created by -** a call to [sqlite3_backup_init()] and is destroyed by a call to -** [sqlite3_backup_finish()]. -** -** See Also: [Using the SQLite Online Backup API] -*/ -typedef struct sqlite3_backup sqlite3_backup; - -/* -** CAPI3REF: Online Backup API. -** -** The backup API copies the content of one database into another. -** It is useful either for creating backups of databases or -** for copying in-memory databases to or from persistent files. -** -** See Also: [Using the SQLite Online Backup API] -** -** ^SQLite holds a write transaction open on the destination database file -** for the duration of the backup operation. -** ^The source database is read-locked only while it is being read; -** it is not locked continuously for the entire backup operation. -** ^Thus, the backup may be performed on a live source database without -** preventing other database connections from -** reading or writing to the source database while the backup is underway. -** -** ^(To perform a backup operation: -**
      -**
    1. sqlite3_backup_init() is called once to initialize the -** backup, -**
    2. sqlite3_backup_step() is called one or more times to transfer -** the data between the two databases, and finally -**
    3. sqlite3_backup_finish() is called to release all resources -** associated with the backup operation. -**
    )^ -** There should be exactly one call to sqlite3_backup_finish() for each -** successful call to sqlite3_backup_init(). -** -** [[sqlite3_backup_init()]] sqlite3_backup_init() -** -** ^The D and N arguments to sqlite3_backup_init(D,N,S,M) are the -** [database connection] associated with the destination database -** and the database name, respectively. -** ^The database name is "main" for the main database, "temp" for the -** temporary database, or the name specified after the AS keyword in -** an [ATTACH] statement for an attached database. -** ^The S and M arguments passed to -** sqlite3_backup_init(D,N,S,M) identify the [database connection] -** and database name of the source database, respectively. -** ^The source and destination [database connections] (parameters S and D) -** must be different or else sqlite3_backup_init(D,N,S,M) will fail with -** an error. -** -** ^If an error occurs within sqlite3_backup_init(D,N,S,M), then NULL is -** returned and an error code and error message are stored in the -** destination [database connection] D. -** ^The error code and message for the failed call to sqlite3_backup_init() -** can be retrieved using the [sqlite3_errcode()], [sqlite3_errmsg()], and/or -** [sqlite3_errmsg16()] functions. -** ^A successful call to sqlite3_backup_init() returns a pointer to an -** [sqlite3_backup] object. -** ^The [sqlite3_backup] object may be used with the sqlite3_backup_step() and -** sqlite3_backup_finish() functions to perform the specified backup -** operation. -** -** [[sqlite3_backup_step()]] sqlite3_backup_step() -** -** ^Function sqlite3_backup_step(B,N) will copy up to N pages between -** the source and destination databases specified by [sqlite3_backup] object B. -** ^If N is negative, all remaining source pages are copied. -** ^If sqlite3_backup_step(B,N) successfully copies N pages and there -** are still more pages to be copied, then the function returns [SQLITE_OK]. -** ^If sqlite3_backup_step(B,N) successfully finishes copying all pages -** from source to destination, then it returns [SQLITE_DONE]. -** ^If an error occurs while running sqlite3_backup_step(B,N), -** then an [error code] is returned. ^As well as [SQLITE_OK] and -** [SQLITE_DONE], a call to sqlite3_backup_step() may return [SQLITE_READONLY], -** [SQLITE_NOMEM], [SQLITE_BUSY], [SQLITE_LOCKED], or an -** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX] extended error code. -** -** ^(The sqlite3_backup_step() might return [SQLITE_READONLY] if -**
      -**
    1. the destination database was opened read-only, or -**
    2. the destination database is using write-ahead-log journaling -** and the destination and source page sizes differ, or -**
    3. the destination database is an in-memory database and the -** destination and source page sizes differ. -**
    )^ -** -** ^If sqlite3_backup_step() cannot obtain a required file-system lock, then -** the [sqlite3_busy_handler | busy-handler function] -** is invoked (if one is specified). ^If the -** busy-handler returns non-zero before the lock is available, then -** [SQLITE_BUSY] is returned to the caller. ^In this case the call to -** sqlite3_backup_step() can be retried later. ^If the source -** [database connection] -** is being used to write to the source database when sqlite3_backup_step() -** is called, then [SQLITE_LOCKED] is returned immediately. ^Again, in this -** case the call to sqlite3_backup_step() can be retried later on. ^(If -** [SQLITE_IOERR_ACCESS | SQLITE_IOERR_XXX], [SQLITE_NOMEM], or -** [SQLITE_READONLY] is returned, then -** there is no point in retrying the call to sqlite3_backup_step(). These -** errors are considered fatal.)^ The application must accept -** that the backup operation has failed and pass the backup operation handle -** to the sqlite3_backup_finish() to release associated resources. -** -** ^The first call to sqlite3_backup_step() obtains an exclusive lock -** on the destination file. ^The exclusive lock is not released until either -** sqlite3_backup_finish() is called or the backup operation is complete -** and sqlite3_backup_step() returns [SQLITE_DONE]. ^Every call to -** sqlite3_backup_step() obtains a [shared lock] on the source database that -** lasts for the duration of the sqlite3_backup_step() call. -** ^Because the source database is not locked between calls to -** sqlite3_backup_step(), the source database may be modified mid-way -** through the backup process. ^If the source database is modified by an -** external process or via a database connection other than the one being -** used by the backup operation, then the backup will be automatically -** restarted by the next call to sqlite3_backup_step(). ^If the source -** database is modified by the using the same database connection as is used -** by the backup operation, then the backup database is automatically -** updated at the same time. -** -** [[sqlite3_backup_finish()]] sqlite3_backup_finish() -** -** When sqlite3_backup_step() has returned [SQLITE_DONE], or when the -** application wishes to abandon the backup operation, the application -** should destroy the [sqlite3_backup] by passing it to sqlite3_backup_finish(). -** ^The sqlite3_backup_finish() interfaces releases all -** resources associated with the [sqlite3_backup] object. -** ^If sqlite3_backup_step() has not yet returned [SQLITE_DONE], then any -** active write-transaction on the destination database is rolled back. -** The [sqlite3_backup] object is invalid -** and may not be used following a call to sqlite3_backup_finish(). -** -** ^The value returned by sqlite3_backup_finish is [SQLITE_OK] if no -** sqlite3_backup_step() errors occurred, regardless or whether or not -** sqlite3_backup_step() completed. -** ^If an out-of-memory condition or IO error occurred during any prior -** sqlite3_backup_step() call on the same [sqlite3_backup] object, then -** sqlite3_backup_finish() returns the corresponding [error code]. -** -** ^A return of [SQLITE_BUSY] or [SQLITE_LOCKED] from sqlite3_backup_step() -** is not a permanent error and does not affect the return value of -** sqlite3_backup_finish(). -** -** [[sqlite3_backup__remaining()]] [[sqlite3_backup_pagecount()]] -** sqlite3_backup_remaining() and sqlite3_backup_pagecount() -** -** ^Each call to sqlite3_backup_step() sets two values inside -** the [sqlite3_backup] object: the number of pages still to be backed -** up and the total number of pages in the source database file. -** The sqlite3_backup_remaining() and sqlite3_backup_pagecount() interfaces -** retrieve these two values, respectively. -** -** ^The values returned by these functions are only updated by -** sqlite3_backup_step(). ^If the source database is modified during a backup -** operation, then the values are not updated to account for any extra -** pages that need to be updated or the size of the source database file -** changing. -** -** Concurrent Usage of Database Handles -** -** ^The source [database connection] may be used by the application for other -** purposes while a backup operation is underway or being initialized. -** ^If SQLite is compiled and configured to support threadsafe database -** connections, then the source database connection may be used concurrently -** from within other threads. -** -** However, the application must guarantee that the destination -** [database connection] is not passed to any other API (by any thread) after -** sqlite3_backup_init() is called and before the corresponding call to -** sqlite3_backup_finish(). SQLite does not currently check to see -** if the application incorrectly accesses the destination [database connection] -** and so no error code is reported, but the operations may malfunction -** nevertheless. Use of the destination database connection while a -** backup is in progress might also also cause a mutex deadlock. -** -** If running in [shared cache mode], the application must -** guarantee that the shared cache used by the destination database -** is not accessed while the backup is running. In practice this means -** that the application must guarantee that the disk file being -** backed up to is not accessed by any connection within the process, -** not just the specific connection that was passed to sqlite3_backup_init(). -** -** The [sqlite3_backup] object itself is partially threadsafe. Multiple -** threads may safely make multiple concurrent calls to sqlite3_backup_step(). -** However, the sqlite3_backup_remaining() and sqlite3_backup_pagecount() -** APIs are not strictly speaking threadsafe. If they are invoked at the -** same time as another thread is invoking sqlite3_backup_step() it is -** possible that they return invalid values. -*/ -SQLITE_API sqlite3_backup *sqlite3_backup_init( - sqlite3 *pDest, /* Destination database handle */ - const char *zDestName, /* Destination database name */ - sqlite3 *pSource, /* Source database handle */ - const char *zSourceName /* Source database name */ -); -SQLITE_API int sqlite3_backup_step(sqlite3_backup *p, int nPage); -SQLITE_API int sqlite3_backup_finish(sqlite3_backup *p); -SQLITE_API int sqlite3_backup_remaining(sqlite3_backup *p); -SQLITE_API int sqlite3_backup_pagecount(sqlite3_backup *p); - -/* -** CAPI3REF: Unlock Notification -** -** ^When running in shared-cache mode, a database operation may fail with -** an [SQLITE_LOCKED] error if the required locks on the shared-cache or -** individual tables within the shared-cache cannot be obtained. See -** [SQLite Shared-Cache Mode] for a description of shared-cache locking. -** ^This API may be used to register a callback that SQLite will invoke -** when the connection currently holding the required lock relinquishes it. -** ^This API is only available if the library was compiled with the -** [SQLITE_ENABLE_UNLOCK_NOTIFY] C-preprocessor symbol defined. -** -** See Also: [Using the SQLite Unlock Notification Feature]. -** -** ^Shared-cache locks are released when a database connection concludes -** its current transaction, either by committing it or rolling it back. -** -** ^When a connection (known as the blocked connection) fails to obtain a -** shared-cache lock and SQLITE_LOCKED is returned to the caller, the -** identity of the database connection (the blocking connection) that -** has locked the required resource is stored internally. ^After an -** application receives an SQLITE_LOCKED error, it may call the -** sqlite3_unlock_notify() method with the blocked connection handle as -** the first argument to register for a callback that will be invoked -** when the blocking connections current transaction is concluded. ^The -** callback is invoked from within the [sqlite3_step] or [sqlite3_close] -** call that concludes the blocking connections transaction. -** -** ^(If sqlite3_unlock_notify() is called in a multi-threaded application, -** there is a chance that the blocking connection will have already -** concluded its transaction by the time sqlite3_unlock_notify() is invoked. -** If this happens, then the specified callback is invoked immediately, -** from within the call to sqlite3_unlock_notify().)^ -** -** ^If the blocked connection is attempting to obtain a write-lock on a -** shared-cache table, and more than one other connection currently holds -** a read-lock on the same table, then SQLite arbitrarily selects one of -** the other connections to use as the blocking connection. -** -** ^(There may be at most one unlock-notify callback registered by a -** blocked connection. If sqlite3_unlock_notify() is called when the -** blocked connection already has a registered unlock-notify callback, -** then the new callback replaces the old.)^ ^If sqlite3_unlock_notify() is -** called with a NULL pointer as its second argument, then any existing -** unlock-notify callback is canceled. ^The blocked connections -** unlock-notify callback may also be canceled by closing the blocked -** connection using [sqlite3_close()]. -** -** The unlock-notify callback is not reentrant. If an application invokes -** any sqlite3_xxx API functions from within an unlock-notify callback, a -** crash or deadlock may be the result. -** -** ^Unless deadlock is detected (see below), sqlite3_unlock_notify() always -** returns SQLITE_OK. -** -** Callback Invocation Details -** -** When an unlock-notify callback is registered, the application provides a -** single void* pointer that is passed to the callback when it is invoked. -** However, the signature of the callback function allows SQLite to pass -** it an array of void* context pointers. The first argument passed to -** an unlock-notify callback is a pointer to an array of void* pointers, -** and the second is the number of entries in the array. -** -** When a blocking connections transaction is concluded, there may be -** more than one blocked connection that has registered for an unlock-notify -** callback. ^If two or more such blocked connections have specified the -** same callback function, then instead of invoking the callback function -** multiple times, it is invoked once with the set of void* context pointers -** specified by the blocked connections bundled together into an array. -** This gives the application an opportunity to prioritize any actions -** related to the set of unblocked database connections. -** -** Deadlock Detection -** -** Assuming that after registering for an unlock-notify callback a -** database waits for the callback to be issued before taking any further -** action (a reasonable assumption), then using this API may cause the -** application to deadlock. For example, if connection X is waiting for -** connection Y's transaction to be concluded, and similarly connection -** Y is waiting on connection X's transaction, then neither connection -** will proceed and the system may remain deadlocked indefinitely. -** -** To avoid this scenario, the sqlite3_unlock_notify() performs deadlock -** detection. ^If a given call to sqlite3_unlock_notify() would put the -** system in a deadlocked state, then SQLITE_LOCKED is returned and no -** unlock-notify callback is registered. The system is said to be in -** a deadlocked state if connection A has registered for an unlock-notify -** callback on the conclusion of connection B's transaction, and connection -** B has itself registered for an unlock-notify callback when connection -** A's transaction is concluded. ^Indirect deadlock is also detected, so -** the system is also considered to be deadlocked if connection B has -** registered for an unlock-notify callback on the conclusion of connection -** C's transaction, where connection C is waiting on connection A. ^Any -** number of levels of indirection are allowed. -** -** The "DROP TABLE" Exception -** -** When a call to [sqlite3_step()] returns SQLITE_LOCKED, it is almost -** always appropriate to call sqlite3_unlock_notify(). There is however, -** one exception. When executing a "DROP TABLE" or "DROP INDEX" statement, -** SQLite checks if there are any currently executing SELECT statements -** that belong to the same connection. If there are, SQLITE_LOCKED is -** returned. In this case there is no "blocking connection", so invoking -** sqlite3_unlock_notify() results in the unlock-notify callback being -** invoked immediately. If the application then re-attempts the "DROP TABLE" -** or "DROP INDEX" query, an infinite loop might be the result. -** -** One way around this problem is to check the extended error code returned -** by an sqlite3_step() call. ^(If there is a blocking connection, then the -** extended error code is set to SQLITE_LOCKED_SHAREDCACHE. Otherwise, in -** the special "DROP TABLE/INDEX" case, the extended error code is just -** SQLITE_LOCKED.)^ -*/ -SQLITE_API int sqlite3_unlock_notify( - sqlite3 *pBlocked, /* Waiting connection */ - void (*xNotify)(void **apArg, int nArg), /* Callback function to invoke */ - void *pNotifyArg /* Argument to pass to xNotify */ -); - - -/* -** CAPI3REF: String Comparison -** -** ^The [sqlite3_stricmp()] and [sqlite3_strnicmp()] APIs allow applications -** and extensions to compare the contents of two buffers containing UTF-8 -** strings in a case-independent fashion, using the same definition of "case -** independence" that SQLite uses internally when comparing identifiers. -*/ -SQLITE_API int sqlite3_stricmp(const char *, const char *); -SQLITE_API int sqlite3_strnicmp(const char *, const char *, int); - -/* -** CAPI3REF: String Globbing -* -** ^The [sqlite3_strglob(P,X)] interface returns zero if string X matches -** the glob pattern P, and it returns non-zero if string X does not match -** the glob pattern P. ^The definition of glob pattern matching used in -** [sqlite3_strglob(P,X)] is the same as for the "X GLOB P" operator in the -** SQL dialect used by SQLite. ^The sqlite3_strglob(P,X) function is case -** sensitive. -** -** Note that this routine returns zero on a match and non-zero if the strings -** do not match, the same as [sqlite3_stricmp()] and [sqlite3_strnicmp()]. -*/ -SQLITE_API int sqlite3_strglob(const char *zGlob, const char *zStr); - -/* -** CAPI3REF: Error Logging Interface -** -** ^The [sqlite3_log()] interface writes a message into the [error log] -** established by the [SQLITE_CONFIG_LOG] option to [sqlite3_config()]. -** ^If logging is enabled, the zFormat string and subsequent arguments are -** used with [sqlite3_snprintf()] to generate the final output string. -** -** The sqlite3_log() interface is intended for use by extensions such as -** virtual tables, collating functions, and SQL functions. While there is -** nothing to prevent an application from calling sqlite3_log(), doing so -** is considered bad form. -** -** The zFormat string must not be NULL. -** -** To avoid deadlocks and other threading problems, the sqlite3_log() routine -** will not use dynamically allocated memory. The log message is stored in -** a fixed-length buffer on the stack. If the log message is longer than -** a few hundred characters, it will be truncated to the length of the -** buffer. -*/ -SQLITE_API void sqlite3_log(int iErrCode, const char *zFormat, ...); - -/* -** CAPI3REF: Write-Ahead Log Commit Hook -** -** ^The [sqlite3_wal_hook()] function is used to register a callback that -** will be invoked each time a database connection commits data to a -** [write-ahead log] (i.e. whenever a transaction is committed in -** [journal_mode | journal_mode=WAL mode]). -** -** ^The callback is invoked by SQLite after the commit has taken place and -** the associated write-lock on the database released, so the implementation -** may read, write or [checkpoint] the database as required. -** -** ^The first parameter passed to the callback function when it is invoked -** is a copy of the third parameter passed to sqlite3_wal_hook() when -** registering the callback. ^The second is a copy of the database handle. -** ^The third parameter is the name of the database that was written to - -** either "main" or the name of an [ATTACH]-ed database. ^The fourth parameter -** is the number of pages currently in the write-ahead log file, -** including those that were just committed. -** -** The callback function should normally return [SQLITE_OK]. ^If an error -** code is returned, that error will propagate back up through the -** SQLite code base to cause the statement that provoked the callback -** to report an error, though the commit will have still occurred. If the -** callback returns [SQLITE_ROW] or [SQLITE_DONE], or if it returns a value -** that does not correspond to any valid SQLite error code, the results -** are undefined. -** -** A single database handle may have at most a single write-ahead log callback -** registered at one time. ^Calling [sqlite3_wal_hook()] replaces any -** previously registered write-ahead log callback. ^Note that the -** [sqlite3_wal_autocheckpoint()] interface and the -** [wal_autocheckpoint pragma] both invoke [sqlite3_wal_hook()] and will -** those overwrite any prior [sqlite3_wal_hook()] settings. -*/ -SQLITE_API void *sqlite3_wal_hook( - sqlite3*, - int(*)(void *,sqlite3*,const char*,int), - void* -); - -/* -** CAPI3REF: Configure an auto-checkpoint -** -** ^The [sqlite3_wal_autocheckpoint(D,N)] is a wrapper around -** [sqlite3_wal_hook()] that causes any database on [database connection] D -** to automatically [checkpoint] -** after committing a transaction if there are N or -** more frames in the [write-ahead log] file. ^Passing zero or -** a negative value as the nFrame parameter disables automatic -** checkpoints entirely. -** -** ^The callback registered by this function replaces any existing callback -** registered using [sqlite3_wal_hook()]. ^Likewise, registering a callback -** using [sqlite3_wal_hook()] disables the automatic checkpoint mechanism -** configured by this function. -** -** ^The [wal_autocheckpoint pragma] can be used to invoke this interface -** from SQL. -** -** ^Every new [database connection] defaults to having the auto-checkpoint -** enabled with a threshold of 1000 or [SQLITE_DEFAULT_WAL_AUTOCHECKPOINT] -** pages. The use of this interface -** is only necessary if the default setting is found to be suboptimal -** for a particular application. -*/ -SQLITE_API int sqlite3_wal_autocheckpoint(sqlite3 *db, int N); - -/* -** CAPI3REF: Checkpoint a database -** -** ^The [sqlite3_wal_checkpoint(D,X)] interface causes database named X -** on [database connection] D to be [checkpointed]. ^If X is NULL or an -** empty string, then a checkpoint is run on all databases of -** connection D. ^If the database connection D is not in -** [WAL | write-ahead log mode] then this interface is a harmless no-op. -** -** ^The [wal_checkpoint pragma] can be used to invoke this interface -** from SQL. ^The [sqlite3_wal_autocheckpoint()] interface and the -** [wal_autocheckpoint pragma] can be used to cause this interface to be -** run whenever the WAL reaches a certain size threshold. -** -** See also: [sqlite3_wal_checkpoint_v2()] -*/ -SQLITE_API int sqlite3_wal_checkpoint(sqlite3 *db, const char *zDb); - -/* -** CAPI3REF: Checkpoint a database -** -** Run a checkpoint operation on WAL database zDb attached to database -** handle db. The specific operation is determined by the value of the -** eMode parameter: -** -**
    -**
    SQLITE_CHECKPOINT_PASSIVE
    -** Checkpoint as many frames as possible without waiting for any database -** readers or writers to finish. Sync the db file if all frames in the log -** are checkpointed. This mode is the same as calling -** sqlite3_wal_checkpoint(). The busy-handler callback is never invoked. -** -**
    SQLITE_CHECKPOINT_FULL
    -** This mode blocks (calls the busy-handler callback) until there is no -** database writer and all readers are reading from the most recent database -** snapshot. It then checkpoints all frames in the log file and syncs the -** database file. This call blocks database writers while it is running, -** but not database readers. -** -**
    SQLITE_CHECKPOINT_RESTART
    -** This mode works the same way as SQLITE_CHECKPOINT_FULL, except after -** checkpointing the log file it blocks (calls the busy-handler callback) -** until all readers are reading from the database file only. This ensures -** that the next client to write to the database file restarts the log file -** from the beginning. This call blocks database writers while it is running, -** but not database readers. -**
    -** -** If pnLog is not NULL, then *pnLog is set to the total number of frames in -** the log file before returning. If pnCkpt is not NULL, then *pnCkpt is set to -** the total number of checkpointed frames (including any that were already -** checkpointed when this function is called). *pnLog and *pnCkpt may be -** populated even if sqlite3_wal_checkpoint_v2() returns other than SQLITE_OK. -** If no values are available because of an error, they are both set to -1 -** before returning to communicate this to the caller. -** -** All calls obtain an exclusive "checkpoint" lock on the database file. If -** any other process is running a checkpoint operation at the same time, the -** lock cannot be obtained and SQLITE_BUSY is returned. Even if there is a -** busy-handler configured, it will not be invoked in this case. -** -** The SQLITE_CHECKPOINT_FULL and RESTART modes also obtain the exclusive -** "writer" lock on the database file. If the writer lock cannot be obtained -** immediately, and a busy-handler is configured, it is invoked and the writer -** lock retried until either the busy-handler returns 0 or the lock is -** successfully obtained. The busy-handler is also invoked while waiting for -** database readers as described above. If the busy-handler returns 0 before -** the writer lock is obtained or while waiting for database readers, the -** checkpoint operation proceeds from that point in the same way as -** SQLITE_CHECKPOINT_PASSIVE - checkpointing as many frames as possible -** without blocking any further. SQLITE_BUSY is returned in this case. -** -** If parameter zDb is NULL or points to a zero length string, then the -** specified operation is attempted on all WAL databases. In this case the -** values written to output parameters *pnLog and *pnCkpt are undefined. If -** an SQLITE_BUSY error is encountered when processing one or more of the -** attached WAL databases, the operation is still attempted on any remaining -** attached databases and SQLITE_BUSY is returned to the caller. If any other -** error occurs while processing an attached database, processing is abandoned -** and the error code returned to the caller immediately. If no error -** (SQLITE_BUSY or otherwise) is encountered while processing the attached -** databases, SQLITE_OK is returned. -** -** If database zDb is the name of an attached database that is not in WAL -** mode, SQLITE_OK is returned and both *pnLog and *pnCkpt set to -1. If -** zDb is not NULL (or a zero length string) and is not the name of any -** attached database, SQLITE_ERROR is returned to the caller. -*/ -SQLITE_API int sqlite3_wal_checkpoint_v2( - sqlite3 *db, /* Database handle */ - const char *zDb, /* Name of attached database (or NULL) */ - int eMode, /* SQLITE_CHECKPOINT_* value */ - int *pnLog, /* OUT: Size of WAL log in frames */ - int *pnCkpt /* OUT: Total number of frames checkpointed */ -); - -/* -** CAPI3REF: Checkpoint operation parameters -** -** These constants can be used as the 3rd parameter to -** [sqlite3_wal_checkpoint_v2()]. See the [sqlite3_wal_checkpoint_v2()] -** documentation for additional information about the meaning and use of -** each of these values. -*/ -#define SQLITE_CHECKPOINT_PASSIVE 0 -#define SQLITE_CHECKPOINT_FULL 1 -#define SQLITE_CHECKPOINT_RESTART 2 - -/* -** CAPI3REF: Virtual Table Interface Configuration -** -** This function may be called by either the [xConnect] or [xCreate] method -** of a [virtual table] implementation to configure -** various facets of the virtual table interface. -** -** If this interface is invoked outside the context of an xConnect or -** xCreate virtual table method then the behavior is undefined. -** -** At present, there is only one option that may be configured using -** this function. (See [SQLITE_VTAB_CONSTRAINT_SUPPORT].) Further options -** may be added in the future. -*/ -SQLITE_API int sqlite3_vtab_config(sqlite3*, int op, ...); - -/* -** CAPI3REF: Virtual Table Configuration Options -** -** These macros define the various options to the -** [sqlite3_vtab_config()] interface that [virtual table] implementations -** can use to customize and optimize their behavior. -** -**
    -**
    SQLITE_VTAB_CONSTRAINT_SUPPORT -**
    Calls of the form -** [sqlite3_vtab_config](db,SQLITE_VTAB_CONSTRAINT_SUPPORT,X) are supported, -** where X is an integer. If X is zero, then the [virtual table] whose -** [xCreate] or [xConnect] method invoked [sqlite3_vtab_config()] does not -** support constraints. In this configuration (which is the default) if -** a call to the [xUpdate] method returns [SQLITE_CONSTRAINT], then the entire -** statement is rolled back as if [ON CONFLICT | OR ABORT] had been -** specified as part of the users SQL statement, regardless of the actual -** ON CONFLICT mode specified. -** -** If X is non-zero, then the virtual table implementation guarantees -** that if [xUpdate] returns [SQLITE_CONSTRAINT], it will do so before -** any modifications to internal or persistent data structures have been made. -** If the [ON CONFLICT] mode is ABORT, FAIL, IGNORE or ROLLBACK, SQLite -** is able to roll back a statement or database transaction, and abandon -** or continue processing the current SQL statement as appropriate. -** If the ON CONFLICT mode is REPLACE and the [xUpdate] method returns -** [SQLITE_CONSTRAINT], SQLite handles this as if the ON CONFLICT mode -** had been ABORT. -** -** Virtual table implementations that are required to handle OR REPLACE -** must do so within the [xUpdate] method. If a call to the -** [sqlite3_vtab_on_conflict()] function indicates that the current ON -** CONFLICT policy is REPLACE, the virtual table implementation should -** silently replace the appropriate rows within the xUpdate callback and -** return SQLITE_OK. Or, if this is not possible, it may return -** SQLITE_CONSTRAINT, in which case SQLite falls back to OR ABORT -** constraint handling. -**
    -*/ -#define SQLITE_VTAB_CONSTRAINT_SUPPORT 1 - -/* -** CAPI3REF: Determine The Virtual Table Conflict Policy -** -** This function may only be called from within a call to the [xUpdate] method -** of a [virtual table] implementation for an INSERT or UPDATE operation. ^The -** value returned is one of [SQLITE_ROLLBACK], [SQLITE_IGNORE], [SQLITE_FAIL], -** [SQLITE_ABORT], or [SQLITE_REPLACE], according to the [ON CONFLICT] mode -** of the SQL statement that triggered the call to the [xUpdate] method of the -** [virtual table]. -*/ -SQLITE_API int sqlite3_vtab_on_conflict(sqlite3 *); - -/* -** CAPI3REF: Conflict resolution modes -** -** These constants are returned by [sqlite3_vtab_on_conflict()] to -** inform a [virtual table] implementation what the [ON CONFLICT] mode -** is for the SQL statement being evaluated. -** -** Note that the [SQLITE_IGNORE] constant is also used as a potential -** return value from the [sqlite3_set_authorizer()] callback and that -** [SQLITE_ABORT] is also a [result code]. -*/ -#define SQLITE_ROLLBACK 1 -/* #define SQLITE_IGNORE 2 // Also used by sqlite3_authorizer() callback */ -#define SQLITE_FAIL 3 -/* #define SQLITE_ABORT 4 // Also an error code */ -#define SQLITE_REPLACE 5 - - - -/* -** Undo the hack that converts floating point types to integer for -** builds on processors without floating point support. -*/ -#ifdef SQLITE_OMIT_FLOATING_POINT -# undef double -#endif - -#ifdef __cplusplus -} /* End of the 'extern "C"' block */ -#endif -#endif /* _SQLITE3_H_ */ - -/* -** 2010 August 30 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -*/ - -#ifndef _SQLITE3RTREE_H_ -#define _SQLITE3RTREE_H_ - - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct sqlite3_rtree_geometry sqlite3_rtree_geometry; - -/* -** Register a geometry callback named zGeom that can be used as part of an -** R-Tree geometry query as follows: -** -** SELECT ... FROM WHERE MATCH $zGeom(... params ...) -*/ -SQLITE_API int sqlite3_rtree_geometry_callback( - sqlite3 *db, - const char *zGeom, -#ifdef SQLITE_RTREE_INT_ONLY - int (*xGeom)(sqlite3_rtree_geometry*, int n, sqlite3_int64 *a, int *pRes), -#else - int (*xGeom)(sqlite3_rtree_geometry*, int n, double *a, int *pRes), -#endif - void *pContext -); - - -/* -** A pointer to a structure of the following type is passed as the first -** argument to callbacks registered using rtree_geometry_callback(). -*/ -struct sqlite3_rtree_geometry { - void *pContext; /* Copy of pContext passed to s_r_g_c() */ - int nParam; /* Size of array aParam[] */ - double *aParam; /* Parameters passed to SQL geom function */ - void *pUser; /* Callback implementation user data */ - void (*xDelUser)(void *); /* Called by SQLite to clean up pUser */ -}; - - -#ifdef __cplusplus -} /* end of the 'extern "C"' block */ -#endif - -#endif /* ifndef _SQLITE3RTREE_H_ */ - diff --git a/external/public-domain/sqlite/dist/sqlite3ext.h b/external/public-domain/sqlite/dist/sqlite3ext.h deleted file mode 100644 index ecf93f62f..000000000 --- a/external/public-domain/sqlite/dist/sqlite3ext.h +++ /dev/null @@ -1,487 +0,0 @@ -/* -** 2006 June 7 -** -** The author disclaims copyright to this source code. In place of -** a legal notice, here is a blessing: -** -** May you do good and not evil. -** May you find forgiveness for yourself and forgive others. -** May you share freely, never taking more than you give. -** -************************************************************************* -** This header file defines the SQLite interface for use by -** shared libraries that want to be imported as extensions into -** an SQLite instance. Shared libraries that intend to be loaded -** as extensions by SQLite should #include this file instead of -** sqlite3.h. -*/ -#ifndef _SQLITE3EXT_H_ -#define _SQLITE3EXT_H_ -#include "sqlite3.h" - -typedef struct sqlite3_api_routines sqlite3_api_routines; - -/* -** The following structure holds pointers to all of the SQLite API -** routines. -** -** WARNING: In order to maintain backwards compatibility, add new -** interfaces to the end of this structure only. If you insert new -** interfaces in the middle of this structure, then older different -** versions of SQLite will not be able to load each others' shared -** libraries! -*/ -struct sqlite3_api_routines { - void * (*aggregate_context)(sqlite3_context*,int nBytes); - int (*aggregate_count)(sqlite3_context*); - int (*bind_blob)(sqlite3_stmt*,int,const void*,int n,void(*)(void*)); - int (*bind_double)(sqlite3_stmt*,int,double); - int (*bind_int)(sqlite3_stmt*,int,int); - int (*bind_int64)(sqlite3_stmt*,int,sqlite_int64); - int (*bind_null)(sqlite3_stmt*,int); - int (*bind_parameter_count)(sqlite3_stmt*); - int (*bind_parameter_index)(sqlite3_stmt*,const char*zName); - const char * (*bind_parameter_name)(sqlite3_stmt*,int); - int (*bind_text)(sqlite3_stmt*,int,const char*,int n,void(*)(void*)); - int (*bind_text16)(sqlite3_stmt*,int,const void*,int,void(*)(void*)); - int (*bind_value)(sqlite3_stmt*,int,const sqlite3_value*); - int (*busy_handler)(sqlite3*,int(*)(void*,int),void*); - int (*busy_timeout)(sqlite3*,int ms); - int (*changes)(sqlite3*); - int (*close)(sqlite3*); - int (*collation_needed)(sqlite3*,void*,void(*)(void*,sqlite3*, - int eTextRep,const char*)); - int (*collation_needed16)(sqlite3*,void*,void(*)(void*,sqlite3*, - int eTextRep,const void*)); - const void * (*column_blob)(sqlite3_stmt*,int iCol); - int (*column_bytes)(sqlite3_stmt*,int iCol); - int (*column_bytes16)(sqlite3_stmt*,int iCol); - int (*column_count)(sqlite3_stmt*pStmt); - const char * (*column_database_name)(sqlite3_stmt*,int); - const void * (*column_database_name16)(sqlite3_stmt*,int); - const char * (*column_decltype)(sqlite3_stmt*,int i); - const void * (*column_decltype16)(sqlite3_stmt*,int); - double (*column_double)(sqlite3_stmt*,int iCol); - int (*column_int)(sqlite3_stmt*,int iCol); - sqlite_int64 (*column_int64)(sqlite3_stmt*,int iCol); - const char * (*column_name)(sqlite3_stmt*,int); - const void * (*column_name16)(sqlite3_stmt*,int); - const char * (*column_origin_name)(sqlite3_stmt*,int); - const void * (*column_origin_name16)(sqlite3_stmt*,int); - const char * (*column_table_name)(sqlite3_stmt*,int); - const void * (*column_table_name16)(sqlite3_stmt*,int); - const unsigned char * (*column_text)(sqlite3_stmt*,int iCol); - const void * (*column_text16)(sqlite3_stmt*,int iCol); - int (*column_type)(sqlite3_stmt*,int iCol); - sqlite3_value* (*column_value)(sqlite3_stmt*,int iCol); - void * (*commit_hook)(sqlite3*,int(*)(void*),void*); - int (*complete)(const char*sql); - int (*complete16)(const void*sql); - int (*create_collation)(sqlite3*,const char*,int,void*, - int(*)(void*,int,const void*,int,const void*)); - int (*create_collation16)(sqlite3*,const void*,int,void*, - int(*)(void*,int,const void*,int,const void*)); - int (*create_function)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_function16)(sqlite3*,const void*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*)); - int (*create_module)(sqlite3*,const char*,const sqlite3_module*,void*); - int (*data_count)(sqlite3_stmt*pStmt); - sqlite3 * (*db_handle)(sqlite3_stmt*); - int (*declare_vtab)(sqlite3*,const char*); - int (*enable_shared_cache)(int); - int (*errcode)(sqlite3*db); - const char * (*errmsg)(sqlite3*); - const void * (*errmsg16)(sqlite3*); - int (*exec)(sqlite3*,const char*,sqlite3_callback,void*,char**); - int (*expired)(sqlite3_stmt*); - int (*finalize)(sqlite3_stmt*pStmt); - void (*free)(void*); - void (*free_table)(char**result); - int (*get_autocommit)(sqlite3*); - void * (*get_auxdata)(sqlite3_context*,int); - int (*get_table)(sqlite3*,const char*,char***,int*,int*,char**); - int (*global_recover)(void); - void (*interruptx)(sqlite3*); - sqlite_int64 (*last_insert_rowid)(sqlite3*); - const char * (*libversion)(void); - int (*libversion_number)(void); - void *(*malloc)(int); - char * (*mprintf)(const char*,...); - int (*open)(const char*,sqlite3**); - int (*open16)(const void*,sqlite3**); - int (*prepare)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - void * (*profile)(sqlite3*,void(*)(void*,const char*,sqlite_uint64),void*); - void (*progress_handler)(sqlite3*,int,int(*)(void*),void*); - void *(*realloc)(void*,int); - int (*reset)(sqlite3_stmt*pStmt); - void (*result_blob)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_double)(sqlite3_context*,double); - void (*result_error)(sqlite3_context*,const char*,int); - void (*result_error16)(sqlite3_context*,const void*,int); - void (*result_int)(sqlite3_context*,int); - void (*result_int64)(sqlite3_context*,sqlite_int64); - void (*result_null)(sqlite3_context*); - void (*result_text)(sqlite3_context*,const char*,int,void(*)(void*)); - void (*result_text16)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16be)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_text16le)(sqlite3_context*,const void*,int,void(*)(void*)); - void (*result_value)(sqlite3_context*,sqlite3_value*); - void * (*rollback_hook)(sqlite3*,void(*)(void*),void*); - int (*set_authorizer)(sqlite3*,int(*)(void*,int,const char*,const char*, - const char*,const char*),void*); - void (*set_auxdata)(sqlite3_context*,int,void*,void (*)(void*)); - char * (*snprintf)(int,char*,const char*,...); - int (*step)(sqlite3_stmt*); - int (*table_column_metadata)(sqlite3*,const char*,const char*,const char*, - char const**,char const**,int*,int*,int*); - void (*thread_cleanup)(void); - int (*total_changes)(sqlite3*); - void * (*trace)(sqlite3*,void(*xTrace)(void*,const char*),void*); - int (*transfer_bindings)(sqlite3_stmt*,sqlite3_stmt*); - void * (*update_hook)(sqlite3*,void(*)(void*,int ,char const*,char const*, - sqlite_int64),void*); - void * (*user_data)(sqlite3_context*); - const void * (*value_blob)(sqlite3_value*); - int (*value_bytes)(sqlite3_value*); - int (*value_bytes16)(sqlite3_value*); - double (*value_double)(sqlite3_value*); - int (*value_int)(sqlite3_value*); - sqlite_int64 (*value_int64)(sqlite3_value*); - int (*value_numeric_type)(sqlite3_value*); - const unsigned char * (*value_text)(sqlite3_value*); - const void * (*value_text16)(sqlite3_value*); - const void * (*value_text16be)(sqlite3_value*); - const void * (*value_text16le)(sqlite3_value*); - int (*value_type)(sqlite3_value*); - char *(*vmprintf)(const char*,va_list); - /* Added ??? */ - int (*overload_function)(sqlite3*, const char *zFuncName, int nArg); - /* Added by 3.3.13 */ - int (*prepare_v2)(sqlite3*,const char*,int,sqlite3_stmt**,const char**); - int (*prepare16_v2)(sqlite3*,const void*,int,sqlite3_stmt**,const void**); - int (*clear_bindings)(sqlite3_stmt*); - /* Added by 3.4.1 */ - int (*create_module_v2)(sqlite3*,const char*,const sqlite3_module*,void*, - void (*xDestroy)(void *)); - /* Added by 3.5.0 */ - int (*bind_zeroblob)(sqlite3_stmt*,int,int); - int (*blob_bytes)(sqlite3_blob*); - int (*blob_close)(sqlite3_blob*); - int (*blob_open)(sqlite3*,const char*,const char*,const char*,sqlite3_int64, - int,sqlite3_blob**); - int (*blob_read)(sqlite3_blob*,void*,int,int); - int (*blob_write)(sqlite3_blob*,const void*,int,int); - int (*create_collation_v2)(sqlite3*,const char*,int,void*, - int(*)(void*,int,const void*,int,const void*), - void(*)(void*)); - int (*file_control)(sqlite3*,const char*,int,void*); - sqlite3_int64 (*memory_highwater)(int); - sqlite3_int64 (*memory_used)(void); - sqlite3_mutex *(*mutex_alloc)(int); - void (*mutex_enter)(sqlite3_mutex*); - void (*mutex_free)(sqlite3_mutex*); - void (*mutex_leave)(sqlite3_mutex*); - int (*mutex_try)(sqlite3_mutex*); - int (*open_v2)(const char*,sqlite3**,int,const char*); - int (*release_memory)(int); - void (*result_error_nomem)(sqlite3_context*); - void (*result_error_toobig)(sqlite3_context*); - int (*sleep)(int); - void (*soft_heap_limit)(int); - sqlite3_vfs *(*vfs_find)(const char*); - int (*vfs_register)(sqlite3_vfs*,int); - int (*vfs_unregister)(sqlite3_vfs*); - int (*xthreadsafe)(void); - void (*result_zeroblob)(sqlite3_context*,int); - void (*result_error_code)(sqlite3_context*,int); - int (*test_control)(int, ...); - void (*randomness)(int,void*); - sqlite3 *(*context_db_handle)(sqlite3_context*); - int (*extended_result_codes)(sqlite3*,int); - int (*limit)(sqlite3*,int,int); - sqlite3_stmt *(*next_stmt)(sqlite3*,sqlite3_stmt*); - const char *(*sql)(sqlite3_stmt*); - int (*status)(int,int*,int*,int); - int (*backup_finish)(sqlite3_backup*); - sqlite3_backup *(*backup_init)(sqlite3*,const char*,sqlite3*,const char*); - int (*backup_pagecount)(sqlite3_backup*); - int (*backup_remaining)(sqlite3_backup*); - int (*backup_step)(sqlite3_backup*,int); - const char *(*compileoption_get)(int); - int (*compileoption_used)(const char*); - int (*create_function_v2)(sqlite3*,const char*,int,int,void*, - void (*xFunc)(sqlite3_context*,int,sqlite3_value**), - void (*xStep)(sqlite3_context*,int,sqlite3_value**), - void (*xFinal)(sqlite3_context*), - void(*xDestroy)(void*)); - int (*db_config)(sqlite3*,int,...); - sqlite3_mutex *(*db_mutex)(sqlite3*); - int (*db_status)(sqlite3*,int,int*,int*,int); - int (*extended_errcode)(sqlite3*); - void (*log)(int,const char*,...); - sqlite3_int64 (*soft_heap_limit64)(sqlite3_int64); - const char *(*sourceid)(void); - int (*stmt_status)(sqlite3_stmt*,int,int); - int (*strnicmp)(const char*,const char*,int); - int (*unlock_notify)(sqlite3*,void(*)(void**,int),void*); - int (*wal_autocheckpoint)(sqlite3*,int); - int (*wal_checkpoint)(sqlite3*,const char*); - void *(*wal_hook)(sqlite3*,int(*)(void*,sqlite3*,const char*,int),void*); - int (*blob_reopen)(sqlite3_blob*,sqlite3_int64); - int (*vtab_config)(sqlite3*,int op,...); - int (*vtab_on_conflict)(sqlite3*); - /* Version 3.7.16 and later */ - int (*close_v2)(sqlite3*); - const char *(*db_filename)(sqlite3*,const char*); - int (*db_readonly)(sqlite3*,const char*); - int (*db_release_memory)(sqlite3*); - const char *(*errstr)(int); - int (*stmt_busy)(sqlite3_stmt*); - int (*stmt_readonly)(sqlite3_stmt*); - int (*stricmp)(const char*,const char*); - int (*uri_boolean)(const char*,const char*,int); - sqlite3_int64 (*uri_int64)(const char*,const char*,sqlite3_int64); - const char *(*uri_parameter)(const char*,const char*); - char *(*vsnprintf)(int,char*,const char*,va_list); - int (*wal_checkpoint_v2)(sqlite3*,const char*,int,int*,int*); -}; - -/* -** The following macros redefine the API routines so that they are -** redirected throught the global sqlite3_api structure. -** -** This header file is also used by the loadext.c source file -** (part of the main SQLite library - not an extension) so that -** it can get access to the sqlite3_api_routines structure -** definition. But the main library does not want to redefine -** the API. So the redefinition macros are only valid if the -** SQLITE_CORE macros is undefined. -*/ -#ifndef SQLITE_CORE -#define sqlite3_aggregate_context sqlite3_api->aggregate_context -#ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_aggregate_count sqlite3_api->aggregate_count -#endif -#define sqlite3_bind_blob sqlite3_api->bind_blob -#define sqlite3_bind_double sqlite3_api->bind_double -#define sqlite3_bind_int sqlite3_api->bind_int -#define sqlite3_bind_int64 sqlite3_api->bind_int64 -#define sqlite3_bind_null sqlite3_api->bind_null -#define sqlite3_bind_parameter_count sqlite3_api->bind_parameter_count -#define sqlite3_bind_parameter_index sqlite3_api->bind_parameter_index -#define sqlite3_bind_parameter_name sqlite3_api->bind_parameter_name -#define sqlite3_bind_text sqlite3_api->bind_text -#define sqlite3_bind_text16 sqlite3_api->bind_text16 -#define sqlite3_bind_value sqlite3_api->bind_value -#define sqlite3_busy_handler sqlite3_api->busy_handler -#define sqlite3_busy_timeout sqlite3_api->busy_timeout -#define sqlite3_changes sqlite3_api->changes -#define sqlite3_close sqlite3_api->close -#define sqlite3_collation_needed sqlite3_api->collation_needed -#define sqlite3_collation_needed16 sqlite3_api->collation_needed16 -#define sqlite3_column_blob sqlite3_api->column_blob -#define sqlite3_column_bytes sqlite3_api->column_bytes -#define sqlite3_column_bytes16 sqlite3_api->column_bytes16 -#define sqlite3_column_count sqlite3_api->column_count -#define sqlite3_column_database_name sqlite3_api->column_database_name -#define sqlite3_column_database_name16 sqlite3_api->column_database_name16 -#define sqlite3_column_decltype sqlite3_api->column_decltype -#define sqlite3_column_decltype16 sqlite3_api->column_decltype16 -#define sqlite3_column_double sqlite3_api->column_double -#define sqlite3_column_int sqlite3_api->column_int -#define sqlite3_column_int64 sqlite3_api->column_int64 -#define sqlite3_column_name sqlite3_api->column_name -#define sqlite3_column_name16 sqlite3_api->column_name16 -#define sqlite3_column_origin_name sqlite3_api->column_origin_name -#define sqlite3_column_origin_name16 sqlite3_api->column_origin_name16 -#define sqlite3_column_table_name sqlite3_api->column_table_name -#define sqlite3_column_table_name16 sqlite3_api->column_table_name16 -#define sqlite3_column_text sqlite3_api->column_text -#define sqlite3_column_text16 sqlite3_api->column_text16 -#define sqlite3_column_type sqlite3_api->column_type -#define sqlite3_column_value sqlite3_api->column_value -#define sqlite3_commit_hook sqlite3_api->commit_hook -#define sqlite3_complete sqlite3_api->complete -#define sqlite3_complete16 sqlite3_api->complete16 -#define sqlite3_create_collation sqlite3_api->create_collation -#define sqlite3_create_collation16 sqlite3_api->create_collation16 -#define sqlite3_create_function sqlite3_api->create_function -#define sqlite3_create_function16 sqlite3_api->create_function16 -#define sqlite3_create_module sqlite3_api->create_module -#define sqlite3_create_module_v2 sqlite3_api->create_module_v2 -#define sqlite3_data_count sqlite3_api->data_count -#define sqlite3_db_handle sqlite3_api->db_handle -#define sqlite3_declare_vtab sqlite3_api->declare_vtab -#define sqlite3_enable_shared_cache sqlite3_api->enable_shared_cache -#define sqlite3_errcode sqlite3_api->errcode -#define sqlite3_errmsg sqlite3_api->errmsg -#define sqlite3_errmsg16 sqlite3_api->errmsg16 -#define sqlite3_exec sqlite3_api->exec -#ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_expired sqlite3_api->expired -#endif -#define sqlite3_finalize sqlite3_api->finalize -#define sqlite3_free sqlite3_api->free -#define sqlite3_free_table sqlite3_api->free_table -#define sqlite3_get_autocommit sqlite3_api->get_autocommit -#define sqlite3_get_auxdata sqlite3_api->get_auxdata -#define sqlite3_get_table sqlite3_api->get_table -#ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_global_recover sqlite3_api->global_recover -#endif -#define sqlite3_interrupt sqlite3_api->interruptx -#define sqlite3_last_insert_rowid sqlite3_api->last_insert_rowid -#define sqlite3_libversion sqlite3_api->libversion -#define sqlite3_libversion_number sqlite3_api->libversion_number -#define sqlite3_malloc sqlite3_api->malloc -#define sqlite3_mprintf sqlite3_api->mprintf -#define sqlite3_open sqlite3_api->open -#define sqlite3_open16 sqlite3_api->open16 -#define sqlite3_prepare sqlite3_api->prepare -#define sqlite3_prepare16 sqlite3_api->prepare16 -#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 -#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 -#define sqlite3_profile sqlite3_api->profile -#define sqlite3_progress_handler sqlite3_api->progress_handler -#define sqlite3_realloc sqlite3_api->realloc -#define sqlite3_reset sqlite3_api->reset -#define sqlite3_result_blob sqlite3_api->result_blob -#define sqlite3_result_double sqlite3_api->result_double -#define sqlite3_result_error sqlite3_api->result_error -#define sqlite3_result_error16 sqlite3_api->result_error16 -#define sqlite3_result_int sqlite3_api->result_int -#define sqlite3_result_int64 sqlite3_api->result_int64 -#define sqlite3_result_null sqlite3_api->result_null -#define sqlite3_result_text sqlite3_api->result_text -#define sqlite3_result_text16 sqlite3_api->result_text16 -#define sqlite3_result_text16be sqlite3_api->result_text16be -#define sqlite3_result_text16le sqlite3_api->result_text16le -#define sqlite3_result_value sqlite3_api->result_value -#define sqlite3_rollback_hook sqlite3_api->rollback_hook -#define sqlite3_set_authorizer sqlite3_api->set_authorizer -#define sqlite3_set_auxdata sqlite3_api->set_auxdata -#define sqlite3_snprintf sqlite3_api->snprintf -#define sqlite3_step sqlite3_api->step -#define sqlite3_table_column_metadata sqlite3_api->table_column_metadata -#define sqlite3_thread_cleanup sqlite3_api->thread_cleanup -#define sqlite3_total_changes sqlite3_api->total_changes -#define sqlite3_trace sqlite3_api->trace -#ifndef SQLITE_OMIT_DEPRECATED -#define sqlite3_transfer_bindings sqlite3_api->transfer_bindings -#endif -#define sqlite3_update_hook sqlite3_api->update_hook -#define sqlite3_user_data sqlite3_api->user_data -#define sqlite3_value_blob sqlite3_api->value_blob -#define sqlite3_value_bytes sqlite3_api->value_bytes -#define sqlite3_value_bytes16 sqlite3_api->value_bytes16 -#define sqlite3_value_double sqlite3_api->value_double -#define sqlite3_value_int sqlite3_api->value_int -#define sqlite3_value_int64 sqlite3_api->value_int64 -#define sqlite3_value_numeric_type sqlite3_api->value_numeric_type -#define sqlite3_value_text sqlite3_api->value_text -#define sqlite3_value_text16 sqlite3_api->value_text16 -#define sqlite3_value_text16be sqlite3_api->value_text16be -#define sqlite3_value_text16le sqlite3_api->value_text16le -#define sqlite3_value_type sqlite3_api->value_type -#define sqlite3_vmprintf sqlite3_api->vmprintf -#define sqlite3_overload_function sqlite3_api->overload_function -#define sqlite3_prepare_v2 sqlite3_api->prepare_v2 -#define sqlite3_prepare16_v2 sqlite3_api->prepare16_v2 -#define sqlite3_clear_bindings sqlite3_api->clear_bindings -#define sqlite3_bind_zeroblob sqlite3_api->bind_zeroblob -#define sqlite3_blob_bytes sqlite3_api->blob_bytes -#define sqlite3_blob_close sqlite3_api->blob_close -#define sqlite3_blob_open sqlite3_api->blob_open -#define sqlite3_blob_read sqlite3_api->blob_read -#define sqlite3_blob_write sqlite3_api->blob_write -#define sqlite3_create_collation_v2 sqlite3_api->create_collation_v2 -#define sqlite3_file_control sqlite3_api->file_control -#define sqlite3_memory_highwater sqlite3_api->memory_highwater -#define sqlite3_memory_used sqlite3_api->memory_used -#define sqlite3_mutex_alloc sqlite3_api->mutex_alloc -#define sqlite3_mutex_enter sqlite3_api->mutex_enter -#define sqlite3_mutex_free sqlite3_api->mutex_free -#define sqlite3_mutex_leave sqlite3_api->mutex_leave -#define sqlite3_mutex_try sqlite3_api->mutex_try -#define sqlite3_open_v2 sqlite3_api->open_v2 -#define sqlite3_release_memory sqlite3_api->release_memory -#define sqlite3_result_error_nomem sqlite3_api->result_error_nomem -#define sqlite3_result_error_toobig sqlite3_api->result_error_toobig -#define sqlite3_sleep sqlite3_api->sleep -#define sqlite3_soft_heap_limit sqlite3_api->soft_heap_limit -#define sqlite3_vfs_find sqlite3_api->vfs_find -#define sqlite3_vfs_register sqlite3_api->vfs_register -#define sqlite3_vfs_unregister sqlite3_api->vfs_unregister -#define sqlite3_threadsafe sqlite3_api->xthreadsafe -#define sqlite3_result_zeroblob sqlite3_api->result_zeroblob -#define sqlite3_result_error_code sqlite3_api->result_error_code -#define sqlite3_test_control sqlite3_api->test_control -#define sqlite3_randomness sqlite3_api->randomness -#define sqlite3_context_db_handle sqlite3_api->context_db_handle -#define sqlite3_extended_result_codes sqlite3_api->extended_result_codes -#define sqlite3_limit sqlite3_api->limit -#define sqlite3_next_stmt sqlite3_api->next_stmt -#define sqlite3_sql sqlite3_api->sql -#define sqlite3_status sqlite3_api->status -#define sqlite3_backup_finish sqlite3_api->backup_finish -#define sqlite3_backup_init sqlite3_api->backup_init -#define sqlite3_backup_pagecount sqlite3_api->backup_pagecount -#define sqlite3_backup_remaining sqlite3_api->backup_remaining -#define sqlite3_backup_step sqlite3_api->backup_step -#define sqlite3_compileoption_get sqlite3_api->compileoption_get -#define sqlite3_compileoption_used sqlite3_api->compileoption_used -#define sqlite3_create_function_v2 sqlite3_api->create_function_v2 -#define sqlite3_db_config sqlite3_api->db_config -#define sqlite3_db_mutex sqlite3_api->db_mutex -#define sqlite3_db_status sqlite3_api->db_status -#define sqlite3_extended_errcode sqlite3_api->extended_errcode -#define sqlite3_log sqlite3_api->log -#define sqlite3_soft_heap_limit64 sqlite3_api->soft_heap_limit64 -#define sqlite3_sourceid sqlite3_api->sourceid -#define sqlite3_stmt_status sqlite3_api->stmt_status -#define sqlite3_strnicmp sqlite3_api->strnicmp -#define sqlite3_unlock_notify sqlite3_api->unlock_notify -#define sqlite3_wal_autocheckpoint sqlite3_api->wal_autocheckpoint -#define sqlite3_wal_checkpoint sqlite3_api->wal_checkpoint -#define sqlite3_wal_hook sqlite3_api->wal_hook -#define sqlite3_blob_reopen sqlite3_api->blob_reopen -#define sqlite3_vtab_config sqlite3_api->vtab_config -#define sqlite3_vtab_on_conflict sqlite3_api->vtab_on_conflict -/* Version 3.7.16 and later */ -#define sqlite3_close_v2 sqlite3_api->close_v2 -#define sqlite3_db_filename sqlite3_api->db_filename -#define sqlite3_db_readonly sqlite3_api->db_readonly -#define sqlite3_db_release_memory sqlite3_api->db_release_memory -#define sqlite3_errstr sqlite3_api->errstr -#define sqlite3_stmt_busy sqlite3_api->stmt_busy -#define sqlite3_stmt_readonly sqlite3_api->stmt_readonly -#define sqlite3_stricmp sqlite3_api->stricmp -#define sqlite3_uri_boolean sqlite3_api->uri_boolean -#define sqlite3_uri_int64 sqlite3_api->uri_int64 -#define sqlite3_uri_parameter sqlite3_api->uri_parameter -#define sqlite3_uri_vsnprintf sqlite3_api->vsnprintf -#define sqlite3_wal_checkpoint_v2 sqlite3_api->wal_checkpoint_v2 -#endif /* SQLITE_CORE */ - -#ifndef SQLITE_CORE - /* This case when the file really is being compiled as a loadable - ** extension */ -# define SQLITE_EXTENSION_INIT1 const sqlite3_api_routines *sqlite3_api=0; -# define SQLITE_EXTENSION_INIT2(v) sqlite3_api=v; -# define SQLITE_EXTENSION_INIT3 \ - extern const sqlite3_api_routines *sqlite3_api; -#else - /* This case when the file is being statically linked into the - ** application */ -# define SQLITE_EXTENSION_INIT1 /*no-op*/ -# define SQLITE_EXTENSION_INIT2(v) (void)v; /* unused parameter */ -# define SQLITE_EXTENSION_INIT3 /*no-op*/ -#endif - -#endif /* _SQLITE3EXT_H_ */ diff --git a/external/public-domain/sqlite/lib/Makefile b/external/public-domain/sqlite/lib/Makefile deleted file mode 100644 index 6e56bc2eb..000000000 --- a/external/public-domain/sqlite/lib/Makefile +++ /dev/null @@ -1,36 +0,0 @@ -# $NetBSD: Makefile,v 1.6 2014/03/07 18:37:48 christos Exp $ - -LIB= sqlite3 -INCS= sqlite3.h sqlite3ext.h -INCSDIR= /usr/include - -SRCS= sqlite3.c - -CFLAGS+= -DNDEBUG - -FILES+= sqlite3.pc -FILESOWN_sqlite3.pc= ${BINOWN} -FILESGRP_sqlite3.pc= ${BINGRP} -FILESMODE_sqlite3.pc= ${NONBINMODE} -FILESDIR_sqlite3.pc= /usr/lib/pkgconfig - -CLEANFILES+=sqlite3.pc - -.include - -.if defined(__MINIX) -.if !empty(DBG:M-Og) || !empty(CFLAGS:M-Og) || \ - !empty(DBG:M-g) || !empty(CFLAGS:M-g) -#LSC: -Wno-maybe-uninitialized while compiling with -DNDEBUG -Og -CWARNFLAGS.gcc+= -Wno-maybe-uninitialized -.endif -.endif # defined(__MINIX) - -all: sqlite3.pc -dependall: all - -sqlite3.pc: ${SRCDIR}/sqlite3.h sqlite3.pc.in - @(V=$$( (echo '#include '; echo SQLITE_VERSION) | \ - ${HOST_CC} -E -I${SRCDIR} - | tail -1 | tr -d '"') && \ - ${TOOL_SED} -e s/@VERSION@/$$V/ < ${.CURDIR}/sqlite3.pc.in \ - > ${.TARGET}) diff --git a/external/public-domain/sqlite/lib/shlib_version b/external/public-domain/sqlite/lib/shlib_version deleted file mode 100644 index 27968bcba..000000000 --- a/external/public-domain/sqlite/lib/shlib_version +++ /dev/null @@ -1,4 +0,0 @@ -# $NetBSD: shlib_version,v 1.3 2014/02/16 18:16:35 christos Exp $ -# -major=1 -minor=2 diff --git a/external/public-domain/sqlite/lib/sqlite3.pc.in b/external/public-domain/sqlite/lib/sqlite3.pc.in deleted file mode 100644 index e5d9d0bc3..000000000 --- a/external/public-domain/sqlite/lib/sqlite3.pc.in +++ /dev/null @@ -1,4 +0,0 @@ -Name: SQLite -Description: SQL database engine -Version: @VERSION@ -Libs: -lsqlite3 diff --git a/external/public-domain/tz/Makefile b/external/public-domain/tz/Makefile deleted file mode 100644 index 777e91e92..000000000 --- a/external/public-domain/tz/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.1 2014/08/08 09:14:40 apb Exp $ - -SUBDIR+= share - -.include diff --git a/external/public-domain/tz/Makefile.inc b/external/public-domain/tz/Makefile.inc deleted file mode 100644 index 289e3cafa..000000000 --- a/external/public-domain/tz/Makefile.inc +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.1 2014/08/08 09:14:40 apb Exp $ - -.include - -TZDISTDIR:= ${.PARSEDIR}/dist diff --git a/external/public-domain/tz/dist/CONTRIBUTING b/external/public-domain/tz/dist/CONTRIBUTING deleted file mode 100644 index 358bc20f6..000000000 --- a/external/public-domain/tz/dist/CONTRIBUTING +++ /dev/null @@ -1,69 +0,0 @@ -Contributing to the tz code and data - -The time zone database is by no means authoritative: governments -change timekeeping rules erratically and sometimes with little -warning, the data entries do not cover all of civil time before -1970, and undoubtedly errors remain in the code and data. Feel -free to fill gaps or fix mistakes, and please email improvements -to tz@iana.org for use in the future. - -To email small changes, please run a POSIX shell command like -'diff -u old/europe new/europe >myfix.patch', and attach -myfix.patch to the email. - -For more-elaborate changes, please read the Theory file and browse -the mailing list archives for -examples of patches that tend to work well. Ideally, additions to -data should contain commentary citing reliable sources as -justification. - -Please submit changes against either the latest release in - or the master branch of the experimental -Git repository. If you use Git the following workflow may be helpful: - - * Copy the experimental repository. - - git clone https://github.com/eggert/tz.git - cd tz - - * Get current with the master branch. - - git checkout master - git pull - - * Switch to a new branch for the changes. Choose a different - branch name for each change set. - - git checkout -b mybranch - - * Edit source files. Include commentary that justifies the - changes by citing reliable sources. - - * Debug the changes, e.g.: - - make check - make install - ./zdump -v America/Los_Angeles - - * For each separable change, commit it in the new branch, e.g.: - - git add northamerica - git commit - - See recent 'git log' output for the commit-message style. - - * Create patch files 0001-*, 0002-*, ... - - git format-patch master - - * After reviewing the patch files, send the patches to tz@iana.org - for others to review. - - git send-email master - - * Start anew by getting current with the master branch again - (the second step above). - -Please do not create issues or pull requests on GitHub, as the -proper procedure for proposing and distributing patches is via -email as illustrated above. diff --git a/external/public-domain/tz/dist/Makefile b/external/public-domain/tz/dist/Makefile deleted file mode 100644 index d2f64c87f..000000000 --- a/external/public-domain/tz/dist/Makefile +++ /dev/null @@ -1,665 +0,0 @@ -# This file is in the public domain, so clarified as of -# 2009-05-17 by Arthur David Olson. - -# Package name for the code distribution. -PACKAGE= tzcode - -# Version numbers of the code and data distributions. -VERSION= 2015f - -# Email address for bug reports. -BUGEMAIL= tz@iana.org - -# Change the line below for your time zone (after finding the zone you want in -# the time zone files, or adding it to a time zone file). -# Alternately, if you discover you've got the wrong time zone, you can just -# zic -l rightzone -# to correct things. -# Use the command -# make zonenames -# to get a list of the values you can use for LOCALTIME. - -LOCALTIME= GMT - -# If you want something other than Eastern United States time as a template -# for handling POSIX-style time zone environment variables, -# change the line below (after finding the zone you want in the -# time zone files, or adding it to a time zone file). -# (When a POSIX-style environment variable is handled, the rules in the -# template file are used to determine "spring forward" and "fall back" days and -# times; the environment variable itself specifies UT offsets of standard and -# summer time.) -# Alternately, if you discover you've got the wrong time zone, you can just -# zic -p rightzone -# to correct things. -# Use the command -# make zonenames -# to get a list of the values you can use for POSIXRULES. -# If you want POSIX compatibility, use "America/New_York". - -POSIXRULES= America/New_York - -# Also see TZDEFRULESTRING below, which takes effect only -# if the time zone files cannot be accessed. - -# Everything gets put in subdirectories of. . . - -TOPDIR= /usr/local - -# "Compiled" time zone information is placed in the "TZDIR" directory -# (and subdirectories). -# Use an absolute path name for TZDIR unless you're just testing the software. - -TZDIR_BASENAME= zoneinfo -TZDIR= $(TOPDIR)/etc/$(TZDIR_BASENAME) - -# Types to try, as an alternative to time_t. int64_t should be first. -TIME_T_ALTERNATIVES= int64_t int32_t uint32_t uint64_t - -# The "tzselect", "zic", and "zdump" commands get installed in. . . - -ETCDIR= $(TOPDIR)/etc - -# If you "make INSTALL", the "date" command gets installed in. . . - -BINDIR= $(TOPDIR)/bin - -# Manual pages go in subdirectories of. . . - -MANDIR= $(TOPDIR)/man - -# Library functions are put in an archive in LIBDIR. - -LIBDIR= $(TOPDIR)/lib - -# If you always want time values interpreted as "seconds since the epoch -# (not counting leap seconds)", use -# REDO= posix_only -# below. If you always want right time values interpreted as "seconds since -# the epoch" (counting leap seconds)", use -# REDO= right_only -# below. If you want both sets of data available, with leap seconds not -# counted normally, use -# REDO= posix_right -# below. If you want both sets of data available, with leap seconds counted -# normally, use -# REDO= right_posix -# below. If you want just POSIX-compatible time values, but with -# out-of-scope and often-wrong data from the file 'backzone', use -# REDO= posix_packrat -# POSIX mandates that leap seconds not be counted; for compatibility with it, -# use "posix_only", "posix_right", or "posix_packrat". - -REDO= posix_right - -# Since "." may not be in PATH... - -YEARISTYPE= ./yearistype - -# Non-default libraries needed to link. -# Add -lintl if you want to use 'gettext' on Solaris. -LDLIBS= - -# Add the following to the end of the "CFLAGS=" line as needed. -# -DBIG_BANG=-9999999LL if the Big Bang occurred at time -9999999 (see zic.c) -# -DHAVE_DOS_FILE_NAMES if file names have drive specifiers etc. (MS-DOS) -# -DHAVE_GETTEXT=1 if 'gettext' works (GNU, Linux, Solaris); also see LDLIBS -# -DHAVE_INCOMPATIBLE_CTIME_R=1 if your system's time.h declares -# ctime_r and asctime_r incompatibly with the POSIX standard (Solaris 8). -# -DHAVE_INTTYPES_H=1 if you have a pre-C99 compiler with "inttypes.h" -# -DHAVE_LINK=0 if your system lacks a link function -# -DHAVE_LOCALTIME_R=0 if your system lacks a localtime_r function -# -DHAVE_LOCALTIME_RZ=0 if you do not want zdump to use localtime_rz -# This defaults to 1 if a working localtime_rz seems to be available. -# localtime_rz can make zdump significantly faster, but is nonstandard. -# -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h" -# -DHAVE_STRFTIME_L=1 if declares locale_t and strftime_l -# This defaults to 0 if _POSIX_VERSION < 200809, 1 otherwise. -# -DHAVE_STRDUP=0 if your system lacks the strdup function -# -DHAVE_SYMLINK=0 if your system lacks the symlink function -# -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h" -# -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h" -# -DHAVE_TZSET=0 if your system lacks a tzset function -# -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?) -# -DNO_RUN_TIME_WARNINGS_ABOUT_YEAR_2000_PROBLEMS_THANK_YOU=1 -# if you do not want run time warnings about formats that may cause -# year 2000 grief -# -Dssize_t=long on ancient hosts that lack ssize_t -# -DTHREAD_SAFE=1 to make localtime.c thread-safe, as POSIX requires; -# not needed by the main-program tz code, which is single-threaded. -# Append other compiler flags as needed, e.g., -pthread on GNU/Linux. -# -Dtime_tz=\"T\" to use T as the time_t type, rather than the system time_t -# -DTZ_DOMAIN=\"foo\" to use "foo" for gettext domain name; default is "tz" -# -DTZ_DOMAINDIR=\"/path\" to use "/path" for gettext directory; -# the default is system-supplied, typically "/usr/lib/locale" -# -DTZDEFRULESTRING=\",date/time,date/time\" to default to the specified -# DST transitions if the time zone files cannot be accessed -# -DUNINIT_TRAP=1 if reading uninitialized storage can cause problems -# other than simply getting garbage data -# -DUSE_LTZ=0 to build zdump with the system time zone library -# Also set TZDOBJS=zdump.o and CHECK_TIME_T_ALTERNATIVES= below. -# -DZIC_MAX_ABBR_LEN_WO_WARN=3 -# (or some other number) to set the maximum time zone abbreviation length -# that zic will accept without a warning (the default is 6) -# $(GCC_DEBUG_FLAGS) if you are using recent GCC and want lots of checking -GCC_DEBUG_FLAGS = -Dlint -g3 -O3 -fno-common -fstrict-aliasing \ - -Wall -Wextra \ - -Wbad-function-cast -Wcast-align -Wdate-time \ - -Wdeclaration-after-statement \ - -Wdouble-promotion \ - -Wformat=2 -Winit-self -Wjump-misses-init \ - -Wlogical-op -Wmissing-prototypes -Wnested-externs \ - -Wold-style-definition -Woverlength-strings -Wpointer-arith \ - -Wshadow -Wstrict-prototypes -Wsuggest-attribute=const \ - -Wsuggest-attribute=format -Wsuggest-attribute=noreturn \ - -Wsuggest-attribute=pure -Wtrampolines \ - -Wunused -Wwrite-strings \ - -Wno-address -Wno-format-nonliteral -Wno-sign-compare \ - -Wno-type-limits -Wno-unused-parameter -# -# If you want to use System V compatibility code, add -# -DUSG_COMPAT -# to the end of the "CFLAGS=" line. This arrange for "timezone" and "daylight" -# variables to be kept up-to-date by the time conversion functions. Neither -# "timezone" nor "daylight" is described in X3J11's work. -# -# If your system has a "GMT offset" field in its "struct tm"s -# (or if you decide to add such a field in your system's "time.h" file), -# add the name to a define such as -# -DTM_GMTOFF=tm_gmtoff -# to the end of the "CFLAGS=" line. If not defined, the code attempts to -# guess TM_GMTOFF from other macros; define NO_TM_GMTOFF to suppress this. -# Similarly, if your system has a "zone abbreviation" field, define -# -DTM_ZONE=tm_zone -# and define NO_TM_ZONE to suppress any guessing. These two fields are not -# required by POSIX, but are widely available on GNU/Linux and BSD systems. -# -# If you want functions that were inspired by early versions of X3J11's work, -# add -# -DSTD_INSPIRED -# to the end of the "CFLAGS=" line. This arranges for the functions -# "tzsetwall", "offtime", "timelocal", "timegm", "timeoff", -# "posix2time", and "time2posix" to be added to the time conversion library. -# "tzsetwall" is like "tzset" except that it arranges for local wall clock -# time (rather than the time specified in the TZ environment variable) -# to be used. -# "offtime" is like "gmtime" except that it accepts a second (long) argument -# that gives an offset to add to the time_t when converting it. -# "timelocal" is equivalent to "mktime". -# "timegm" is like "timelocal" except that it turns a struct tm into -# a time_t using UT (rather than local time as "timelocal" does). -# "timeoff" is like "timegm" except that it accepts a second (long) argument -# that gives an offset to use when converting to a time_t. -# "posix2time" and "time2posix" are described in an included manual page. -# X3J11's work does not describe any of these functions. -# Sun has provided "tzsetwall", "timelocal", and "timegm" in SunOS 4.0. -# These functions may well disappear in future releases of the time -# conversion package. -# -# If you don't want functions that were inspired by NetBSD, add -# -DNETBSD_INSPIRED=0 -# to the end of the "CFLAGS=" line. Otherwise, the functions -# "localtime_rz", "mktime_z", "tzalloc", and "tzfree" are added to the -# time library, and if STD_INSPIRED is also defined the functions -# "posix2time_z" and "time2posix_z" are added as well. -# The functions ending in "_z" (or "_rz") are like their unsuffixed -# (or suffixed-by-"_r") counterparts, except with an extra first -# argument of opaque type timezone_t that specifies the time zone. -# "tzalloc" allocates a timezone_t value, and "tzfree" frees it. -# -# If you want to allocate state structures in localtime, add -# -DALL_STATE -# to the end of the "CFLAGS=" line. Storage is obtained by calling malloc. -# -# If you want an "altzone" variable (a la System V Release 3.1), add -# -DALTZONE -# to the end of the "CFLAGS=" line. -# This variable is not described in X3J11's work. -# -# NIST-PCTS:151-2, Version 1.4, (1993-12-03) is a test suite put -# out by the National Institute of Standards and Technology -# which claims to test C and Posix conformance. If you want to pass PCTS, add -# -DPCTS -# to the end of the "CFLAGS=" line. -# -# If you want strict compliance with XPG4 as of 1994-04-09, add -# -DXPG4_1994_04_09 -# to the end of the "CFLAGS=" line. This causes "strftime" to always return -# 53 as a week number (rather than 52 or 53) for those days in January that -# before the first Monday in January when a "%V" format is used and January 1 -# falls on a Friday, Saturday, or Sunday. - -CFLAGS= - -# Linker flags. Default to $(LFLAGS) for backwards compatibility -# to tzcode2012h and earlier. - -LDFLAGS= $(LFLAGS) - -zic= ./zic -ZIC= $(zic) $(ZFLAGS) - -ZFLAGS= - -# The name of a Posix-compliant 'awk' on your system. -AWK= awk - -# The full path name of a Posix-compliant shell, preferably one that supports -# the Korn shell's 'select' statement as an extension. -# These days, Bash is the most popular. -# It should be OK to set this to /bin/sh, on platforms where /bin/sh -# lacks 'select' or doesn't completely conform to Posix, but /bin/bash -# is typically nicer if it works. -KSHELL= /bin/bash - -# The path where SGML DTDs are kept and the catalog file(s) to use when -# validating. The default is appropriate for Ubuntu 13.10. -SGML_TOPDIR= /usr -SGML_DTDDIR= $(SGML_TOPDIR)/share/xml/w3c-sgml-lib/schema/dtd -SGML_SEARCH_PATH= $(SGML_DTDDIR)/REC-html401-19991224 -SGML_CATALOG_FILES= \ - $(SGML_TOPDIR)/share/doc/w3-recs/html/www.w3.org/TR/1999/REC-html401-19991224/HTML4.cat - -# The name, arguments and environment of a program to validate your web pages. -# See for a validator, and -# for a validation library. -VALIDATE = nsgmls -VALIDATE_FLAGS = -s -B -wall -wno-unused-param -VALIDATE_ENV = \ - SGML_CATALOG_FILES=$(SGML_CATALOG_FILES) \ - SGML_SEARCH_PATH=$(SGML_SEARCH_PATH) \ - SP_CHARSET_FIXED=YES \ - SP_ENCODING=UTF-8 - -# This expensive test requires USE_LTZ. -# To suppress it, define this macro to be empty. -CHECK_TIME_T_ALTERNATIVES = check_time_t_alternatives - -# SAFE_CHAR is a regular expression that matches a safe character. -# Some parts of this distribution are limited to safe characters; -# others can use any UTF-8 character. -# For now, the safe characters are a safe subset of ASCII. -# The caller must set the shell variable 'sharp' to the character '#', -# since Makefile macros cannot contain '#'. -# TAB_CHAR is a single tab character, in single quotes. -TAB_CHAR= ' ' -SAFE_CHARSET1= $(TAB_CHAR)' !\"'$$sharp'$$%&'\''()*+,./0123456789:;<=>?@' -SAFE_CHARSET2= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\^_`' -SAFE_CHARSET3= 'abcdefghijklmnopqrstuvwxyz{|}~' -SAFE_CHARSET= $(SAFE_CHARSET1)$(SAFE_CHARSET2)$(SAFE_CHARSET3) -SAFE_CHAR= '[]'$(SAFE_CHARSET)'-]' - -# OK_CHAR matches any character allowed in the distributed files. -# This is the same as SAFE_CHAR, except that multibyte letters are -# also allowed so that commentary can contain people's names and quote -# non-English sources. For non-letters the sources are limited to -# ASCII renderings for the convenience of maintainers whose text editors -# mishandle UTF-8 by default (e.g., XEmacs 21.4.22). -OK_CHAR= '[][:alpha:]'$(SAFE_CHARSET)'-]' - -# SAFE_LINE matches a line of safe characters. -# SAFE_SHARP_LINE is similar, except any OK character can follow '#'; -# this is so that comments can contain non-ASCII characters. -# OK_LINE matches a line of OK characters. -SAFE_LINE= '^'$(SAFE_CHAR)'*$$' -SAFE_SHARP_LINE='^'$(SAFE_CHAR)'*('$$sharp$(OK_CHAR)'*)?$$' -OK_LINE= '^'$(OK_CHAR)'*$$' - -# Flags to give 'tar' when making a distribution. -# Try to use flags appropriate for GNU tar. -GNUTARFLAGS= --numeric-owner --owner=0 --group=0 --mode=go+u,go-w -TARFLAGS= `if tar $(GNUTARFLAGS) --version >/dev/null 2>&1; \ - then echo $(GNUTARFLAGS); \ - else :; \ - fi` - -# Flags to give 'gzip' when making a distribution. -GZIPFLAGS= -9n - -############################################################################### - -#MAKE= make - -cc= cc -CC= $(cc) -DTZDIR=\"$(TZDIR)\" - -AR= ar - -# ':' on typical hosts; 'ranlib' on the ancient hosts that still need ranlib. -RANLIB= : - -TZCOBJS= zic.o -TZDOBJS= zdump.o localtime.o asctime.o -DATEOBJS= date.o localtime.o strftime.o asctime.o -LIBSRCS= localtime.c asctime.c difftime.c -LIBOBJS= localtime.o asctime.o difftime.o -HEADERS= tzfile.h private.h -NONLIBSRCS= zic.c zdump.c -NEWUCBSRCS= date.c strftime.c -SOURCES= $(HEADERS) $(LIBSRCS) $(NONLIBSRCS) $(NEWUCBSRCS) \ - tzselect.ksh workman.sh -MANS= newctime.3 newstrftime.3 newtzset.3 time2posix.3 \ - tzfile.5 tzselect.8 zic.8 zdump.8 -MANTXTS= newctime.3.txt newstrftime.3.txt newtzset.3.txt \ - time2posix.3.txt \ - tzfile.5.txt tzselect.8.txt zic.8.txt zdump.8.txt \ - date.1.txt -COMMON= CONTRIBUTING Makefile NEWS README Theory -WEB_PAGES= tz-art.htm tz-link.htm -DOCS= $(MANS) date.1 $(MANTXTS) $(WEB_PAGES) -PRIMARY_YDATA= africa antarctica asia australasia \ - europe northamerica southamerica -YDATA= $(PRIMARY_YDATA) pacificnew etcetera backward -NDATA= systemv factory -TDATA= $(YDATA) $(NDATA) -ZONETABLES= zone1970.tab zone.tab -TABDATA= iso3166.tab leapseconds $(ZONETABLES) -LEAP_DEPS= leapseconds.awk leap-seconds.list -DATA= $(YDATA) $(NDATA) backzone $(TABDATA) \ - leap-seconds.list yearistype.sh -AWK_SCRIPTS= checklinks.awk checktab.awk leapseconds.awk -MISC= $(AWK_SCRIPTS) zoneinfo2tdf.pl -ENCHILADA= $(COMMON) $(DOCS) $(SOURCES) $(DATA) $(MISC) - -# And for the benefit of csh users on systems that assume the user -# shell should be used to handle commands in Makefiles. . . - -SHELL= /bin/sh - -all: tzselect zic zdump libtz.a $(TABDATA) - -ALL: all date $(ENCHILADA) - -install: all $(DATA) $(REDO) $(MANS) - mkdir -p $(DESTDIR)$(ETCDIR) $(DESTDIR)$(TZDIR) \ - $(DESTDIR)$(LIBDIR) \ - $(DESTDIR)$(MANDIR)/man3 $(DESTDIR)$(MANDIR)/man5 \ - $(DESTDIR)$(MANDIR)/man8 - $(ZIC) -y $(YEARISTYPE) \ - -d $(DESTDIR)$(TZDIR) -l $(LOCALTIME) -p $(POSIXRULES) - cp -f iso3166.tab $(ZONETABLES) $(DESTDIR)$(TZDIR)/. - cp tzselect zic zdump $(DESTDIR)$(ETCDIR)/. - cp libtz.a $(DESTDIR)$(LIBDIR)/. - $(RANLIB) $(DESTDIR)$(LIBDIR)/libtz.a - cp -f newctime.3 newtzset.3 $(DESTDIR)$(MANDIR)/man3/. - cp -f tzfile.5 $(DESTDIR)$(MANDIR)/man5/. - cp -f tzselect.8 zdump.8 zic.8 $(DESTDIR)$(MANDIR)/man8/. - -INSTALL: ALL install date.1 - mkdir -p $(DESTDIR)$(BINDIR) $(DESTDIR)$(MANDIR)/man1 - cp date $(DESTDIR)$(BINDIR)/. - cp -f date.1 $(DESTDIR)$(MANDIR)/man1/. - -version.h: - (echo 'static char const PKGVERSION[]="($(PACKAGE)) ";' && \ - echo 'static char const TZVERSION[]="$(VERSION)";' && \ - echo 'static char const REPORT_BUGS_TO[]="$(BUGEMAIL)";') >$@ - -zdump: $(TZDOBJS) - $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZDOBJS) $(LDLIBS) - -zic: $(TZCOBJS) yearistype - $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(TZCOBJS) $(LDLIBS) - -yearistype: yearistype.sh - cp yearistype.sh yearistype - chmod +x yearistype - -leapseconds: $(LEAP_DEPS) - $(AWK) -f leapseconds.awk leap-seconds.list >$@ - -posix_only: zic $(TDATA) - $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \ - -L /dev/null $(TDATA) - -right_only: zic leapseconds $(TDATA) - $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \ - -L leapseconds $(TDATA) - -# In earlier versions of this makefile, the other two directories were -# subdirectories of $(TZDIR). However, this led to configuration errors. -# For example, with posix_right under the earlier scheme, -# TZ='right/Australia/Adelaide' got you localtime with leap seconds, -# but gmtime without leap seconds, which led to problems with applications -# like sendmail that subtract gmtime from localtime. -# Therefore, the other two directories are now siblings of $(TZDIR). -# You must replace all of $(TZDIR) to switch from not using leap seconds -# to using them, or vice versa. -right_posix: right_only leapseconds - rm -fr $(DESTDIR)$(TZDIR)-leaps - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-leaps || \ - $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ - -L leapseconds $(TDATA) - $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ - -L /dev/null $(TDATA) - -posix_right: posix_only leapseconds - rm -fr $(DESTDIR)$(TZDIR)-posix - ln -s $(TZDIR_BASENAME) $(DESTDIR)$(TZDIR)-posix || \ - $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-posix \ - -L /dev/null $(TDATA) - $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR)-leaps \ - -L leapseconds $(TDATA) - -posix_packrat: posix_only backzone - $(AWK) '/^Rule/' $(TDATA) | \ - $(ZIC) -y $(YEARISTYPE) -d $(DESTDIR)$(TZDIR) \ - -L /dev/null - backzone - -zones: $(REDO) - -libtz.a: $(LIBOBJS) - $(AR) ru $@ $(LIBOBJS) - $(RANLIB) $@ - -date: $(DATEOBJS) - $(CC) -o $@ $(CFLAGS) $(LDFLAGS) $(DATEOBJS) $(LDLIBS) - -tzselect: tzselect.ksh - sed \ - -e 's|#!/bin/bash|#!$(KSHELL)|g' \ - -e 's|AWK=[^}]*|AWK=$(AWK)|g' \ - -e 's|\(PKGVERSION\)=.*|\1='\''($(PACKAGE)) '\''|' \ - -e 's|\(REPORT_BUGS_TO\)=.*|\1=$(BUGEMAIL)|' \ - -e 's|TZDIR=[^}]*|TZDIR=$(TZDIR)|' \ - -e 's|\(TZVERSION\)=.*|\1=$(VERSION)|' \ - <$? >$@ - chmod +x $@ - -check: check_character_set check_white_space check_links check_sorted \ - check_tables check_web - -check_character_set: $(ENCHILADA) - LC_ALL=en_US.utf8 && export LC_ALL && \ - sharp='#' && \ - ! grep -Env $(SAFE_LINE) Makefile $(MANS) date.1 $(MANTXTS) \ - $(MISC) $(SOURCES) $(WEB_PAGES) && \ - ! grep -Env $(SAFE_SHARP_LINE) $(TDATA) backzone \ - leapseconds yearistype.sh zone.tab && \ - ! grep -Env $(OK_LINE) $(ENCHILADA) - -check_white_space: $(ENCHILADA) - ! grep -En ' '$(TAB_CHAR)"|$$(printf '[\f\r\v]')" $(ENCHILADA) - ! grep -n '[[:space:]]$$' $(ENCHILADA) - -CHECK_CC_LIST = { n = split($$1,a,/,/); for (i=2; i<=n; i++) print a[1], a[i]; } - -check_sorted: backward backzone iso3166.tab zone.tab zone1970.tab - $(AWK) '/^Link/ {print $$3}' backward | LC_ALL=C sort -cu - $(AWK) '/^Zone/ {print $$2}' backzone | LC_ALL=C sort -cu - $(AWK) '/^[^#]/ {print $$1}' iso3166.tab | LC_ALL=C sort -cu - $(AWK) '/^[^#]/ {print $$1}' zone.tab | LC_ALL=C sort -c - $(AWK) '/^[^#]/ {print substr($$0, 1, 2)}' zone1970.tab | \ - LC_ALL=C sort -c - $(AWK) '/^[^#]/ $(CHECK_CC_LIST)' zone1970.tab | \ - LC_ALL=C sort -cu - -check_links: checklinks.awk $(TDATA) - $(AWK) -f checklinks.awk $(TDATA) - -check_tables: checktab.awk $(PRIMARY_YDATA) $(ZONETABLES) - for tab in $(ZONETABLES); do \ - $(AWK) -f checktab.awk -v zone_table=$$tab $(PRIMARY_YDATA) \ - || exit; \ - done - -check_web: $(WEB_PAGES) - $(VALIDATE_ENV) $(VALIDATE) $(VALIDATE_FLAGS) $(WEB_PAGES) - -clean_misc: - rm -f core *.o *.out \ - date tzselect version.h zdump zic yearistype libtz.a -clean: clean_misc - rm -fr tzpublic - -maintainer-clean: clean - @echo 'This command is intended for maintainers to use; it' - @echo 'deletes files that may need special tools to rebuild.' - rm -f leapseconds $(MANTXTS) *.asc *.tar.gz - -names: - @echo $(ENCHILADA) - -public: check check_public $(CHECK_TIME_T_ALTERNATIVES) \ - tarballs signatures - -date.1.txt: date.1 -newctime.3.txt: newctime.3 -newstrftime.3.txt: newstrftime.3 -newtzset.3.txt: newtzset.3 -time2posix.3.txt: time2posix.3 -tzfile.5.txt: tzfile.5 -tzselect.8.txt: tzselect.8 -zdump.8.txt: zdump.8 -zic.8.txt: zic.8 - -$(MANTXTS): workman.sh - LC_ALL=C sh workman.sh `expr $@ : '\(.*\)\.txt$$'` >$@ - -# Set the time stamps to those of the git repository, if available, -# and if the files have not changed since then. -# This uses GNU 'touch' syntax 'touch -d@N FILE', -# where N is the number of seconds since 1970. -# If git or GNU 'touch' is absent, don't bother to sync with git timestamps. -# Also, set the timestamp of each prebuilt file like 'leapseconds' -# to be the maximum of the files it depends on. -set-timestamps.out: $(ENCHILADA) - rm -f $@ - if files=`git ls-files $(ENCHILADA)` && \ - touch -md @1 test.out; then \ - rm -f test.out && \ - for file in $$files; do \ - if git diff --quiet $$file; then \ - time=`git log -1 --format='tformat:%ct' $$file` && \ - touch -cmd @$$time $$file; \ - else \ - echo >&2 "$$file: warning: does not match repository"; \ - fi || exit; \ - done; \ - fi - touch -cmr `ls -t $(LEAP_DEPS) | sed 1q` leapseconds - for file in `ls $(MANTXTS) | sed 's/\.txt$$//'`; do \ - touch -cmr `ls -t $$file workman.sh | sed 1q` $$file.txt || \ - exit; \ - done - touch $@ - -# The zics below ensure that each data file can stand on its own. -# We also do an all-files run to catch links to links. - -check_public: - $(MAKE) maintainer-clean - $(MAKE) "CFLAGS=$(GCC_DEBUG_FLAGS)" ALL - mkdir tzpublic - for i in $(TDATA) ; do \ - $(zic) -v -d tzpublic $$i 2>&1 || exit; \ - done - $(zic) -v -d tzpublic $(TDATA) - rm -fr tzpublic - -# Check that the code works under various alternative -# implementations of time_t. -check_time_t_alternatives: - if diff -q Makefile Makefile 2>/dev/null; then \ - quiet_option='-q'; \ - else \ - quiet_option=''; \ - fi && \ - zones=`$(AWK) '/^[^#]/ { print $$3 }' tzpublic/int64_t.out && \ - tzpublic/$$type/etc/zdump -V -t $$range $$zones \ - >tzpublic/$$type.out && \ - diff -u tzpublic/int64_t.out tzpublic/$$type.out \ - || exit; \ - done - rm -fr tzpublic - -tarballs: tzcode$(VERSION).tar.gz tzdata$(VERSION).tar.gz - -tzcode$(VERSION).tar.gz: set-timestamps.out - LC_ALL=C && export LC_ALL && \ - tar $(TARFLAGS) -cf - \ - $(COMMON) $(DOCS) $(SOURCES) | \ - gzip $(GZIPFLAGS) > $@ - -tzdata$(VERSION).tar.gz: set-timestamps.out - LC_ALL=C && export LC_ALL && \ - tar $(TARFLAGS) -cf - $(COMMON) $(DATA) $(MISC) | \ - gzip $(GZIPFLAGS) > $@ - -signatures: tzcode$(VERSION).tar.gz.asc tzdata$(VERSION).tar.gz.asc - -tzcode$(VERSION).tar.gz.asc: tzcode$(VERSION).tar.gz - gpg --armor --detach-sign $? - -tzdata$(VERSION).tar.gz.asc: tzdata$(VERSION).tar.gz - gpg --armor --detach-sign $? - -typecheck: - $(MAKE) clean - for i in "long long" unsigned; \ - do \ - $(MAKE) CFLAGS="-DTYPECHECK -D__time_t_defined -D_TIME_T \"-Dtime_t=$$i\"" ; \ - ./zdump -v Europe/Rome ; \ - $(MAKE) clean ; \ - done - -zonenames: $(TDATA) - @$(AWK) '/^Zone/ { print $$2 } /^Link/ { print $$3 }' $(TDATA) - -asctime.o: private.h tzfile.h -date.o: private.h -difftime.o: private.h -localtime.o: private.h tzfile.h -strftime.o: private.h tzfile.h -zdump.o: version.h -zic.o: private.h tzfile.h version.h - -.KEEP_STATE: - -.PHONY: ALL INSTALL all -.PHONY: check check_character_set check_links -.PHONY: check_public check_sorted check_tables -.PHONY: check_time_t_alternatives check_web check_white_space clean clean_misc -.PHONY: install maintainer-clean names posix_packrat posix_only posix_right -.PHONY: public right_only right_posix signatures tarballs typecheck -.PHONY: zonenames zones diff --git a/external/public-domain/tz/dist/NEWS b/external/public-domain/tz/dist/NEWS deleted file mode 100644 index b47725013..000000000 --- a/external/public-domain/tz/dist/NEWS +++ /dev/null @@ -1,3253 +0,0 @@ -News for the tz database - -Release 2015f - 2015-08-10 18:06:56 -0700 - - Changes affecting future time stamps - - North Korea switches to +0830 on 2015-08-15. (Thanks to Steffen Thorsen.) - The abbreviation remains "KST". (Thanks to Robert Elz.) - - Uruguay no longer observes DST. (Thanks to Steffen Thorsen - and Pablo Camargo.) - - Changes affecting past and future time stamps - - Moldova starts and ends DST at 00:00 UTC, not at 01:00 UTC. - (Thanks to Roman Tudos.) - - Changes affecting data format and code - - zic's '-y YEARISTYPE' option is no longer documented. The TYPE - field of a Rule line should now be '-'; the old values 'even', - 'odd', 'uspres', 'nonpres', 'nonuspres' were already undocumented. - Although the implementation has not changed, these features do not - work in the default installation, they are not used in the data, - and they are now considered obsolescent. - - zic now checks that two rules don't take effect at the same time. - (Thanks to Jon Skeet and Arthur David Olson.) Constraints on - simultaneity are now documented. - - The two characters '%z' in a zone format now stand for the UTC - offset, e.g., '-07' for seven hours behind UTC and '+0530' for - five hours and thirty minutes ahead. This better supports time - zone abbreviations conforming to POSIX.1-2001 and later. - - Changes affecting installed data files - - Comments for America/Halifax and America/Glace_Bay have been improved. - (Thanks to Brian Inglis.) - - Data entries have been simplified for Atlantic/Canary, Europe/Simferopol, - Europe/Sofia, and Europe/Tallinn. This yields slightly smaller - installed data files for Europe/Simferopol and Europe/Tallinn. - It does not affect timestamps. (Thanks to Howard Hinnant.) - - Changes affecting code - - zdump and zic no longer warn about valid time zone abbreviations - like '-05'. - - Some Visual Studio 2013 warnings have been suppressed. - (Thanks to Kees Dekker.) - - 'date' no longer sets the time of day and its -a, -d, -n and -t - options have been removed. Long obsolescent, the implementation - of these features had porting problems. Builders no longer need - to configure HAVE_ADJTIME, HAVE_SETTIMEOFDAY, or HAVE_UTMPX_H. - (Thanks to Kees Dekker for pointing out the problem.) - - Changes affecting documentation - - The Theory file mentions naming issues earlier, as these seem to be - poorly publicized (thanks to Gilmore Davidson for reporting the problem). - - tz-link.htm mentions Time Zone Database Parser (thanks to Howard Hinnant). - - Mention that Herbert Samuel introduced the term "Summer Time". - - -Release 2015e - 2015-06-13 10:56:02 -0700 - - Changes affecting future time stamps - - Morocco will suspend DST from 2015-06-14 03:00 through 2015-07-19 02:00, - not 06-13 and 07-18 as we had guessed. (Thanks to Milamber.) - - Assume Cayman Islands will observe DST starting next year, using US rules. - Although it isn't guaranteed, it is the most likely. - - Changes affecting data format - - The file 'iso3166.tab' now uses UTF-8, so that its entries can better - spell the names of Ã…land Islands, Côte d'Ivoire, and Réunion. - - Changes affecting code - - When displaying data, tzselect converts it to the current locale's - encoding if the iconv command works. (Problem reported by random832.) - - tzselect no longer mishandles Dominica, fixing a bug introduced - in Release 2014f. (Problem reported by Owen Leibman.) - - zic -l no longer fails when compiled with -DTZDEFAULT=\"/etc/localtime\". - This fixes a bug introduced in Release 2014f. - (Problem reported by Leonardo Chiquitto.) - - -Release 2015d - 2015-04-24 08:09:46 -0700 - - Changes affecting future time stamps - - Egypt will not observe DST in 2015 and will consider canceling it - permanently. For now, assume no DST indefinitely. - (Thanks to Ahmed Nazmy and Tim Parenti.) - - Changes affecting past time stamps - - America/Whitehorse switched from UTC-9 to UTC-8 on 1967-05-28, not - 1966-07-01. Also, Yukon's time zone history is documented better. - (Thanks to Brian Inglis and Dennis Ferguson.) - - Change affecting past and future time zone abbreviations - - The abbreviations for Hawaii-Aleutian standard and daylight times - have been changed from HAST/HADT to HST/HDT, as per US Government - Printing Office style. This affects only America/Adak since 1983, - as America/Honolulu was already using the new style. - - Changes affecting code - - zic has some minor performance improvements. - - -Release 2015c - 2015-04-11 08:55:55 -0700 - - Changes affecting future time stamps - - Egypt's spring-forward transition is at 24:00 on April's last Thursday, - not 00:00 on April's last Friday. 2015's transition will therefore be on - Thursday, April 30 at 24:00, not Friday, April 24 at 00:00. Similar fixes - apply to 2026, 2037, 2043, etc. (Thanks to Steffen Thorsen.) - - Changes affecting past time stamps - - The following changes affect some pre-1991 Chile-related time stamps - in America/Santiago, Antarctica/Palmer, and Pacific/Easter. - - The 1910 transition was January 10, not January 1. - - The 1918 transition was September 10, not September 1. - - The UTC-4 time observed from 1932 to 1942 is now considered to be - standard time, not year-round DST. - - Santiago observed DST (UTC-3) from 1946-07-15 through 1946-08-31, - then reverted to standard time, then switched its time zone to - UTC-5 on 1947-04-01. - - Assume transitions before 1968 were at 00:00, since we have no data - saying otherwise. - - The spring 1988 transition was 1988-10-09, not 1988-10-02. - The fall 1990 transition was 1990-03-11, not 1990-03-18. - - Assume no UTC offset change for Pacific/Easter on 1890-01-01, - and omit all transitions on Pacific/Easter from 1942 through 1946 - since we have no data suggesting that they existed. - - One more zone has been turned into a link, as it differed - from an existing zone only for older time stamps. As usual, - this change affects UTC offsets in pre-1970 time stamps only. - The zone's old contents have been moved to the 'backzone' file. - The affected zone is America/Montreal. - - Changes affecting commentary - - Mention the TZUpdater tool. - - Mention "The Time Now". (Thanks to Brandon Ramsey.) - - -Release 2015b - 2015-03-19 23:28:11 -0700 - - Changes affecting future time stamps - - Mongolia will start observing DST again this year, from the last - Saturday in March at 02:00 to the last Saturday in September at 00:00. - (Thanks to Ganbold Tsagaankhuu.) - - Palestine will start DST on March 28, not March 27. Also, - correct the fall 2014 transition from September 26 to October 24. - Adjust future predictions accordingly. (Thanks to Steffen Thorsen.) - - Changes affecting past time stamps - - The 1982 zone shift in Pacific/Easter has been corrected, fixing a 2015a - regression. (Thanks to Stuart Bishop for reporting the problem.) - - Some more zones have been turned into links, when they differed - from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. - Their old contents have been moved to the 'backzone' file. - The affected zones are: America/Antigua, America/Cayman, - Pacific/Midway, and Pacific/Saipan. - - Changes affecting time zone abbreviations - - Correct the 1992-2010 DST abbreviation in Volgograd from "MSK" to "MSD". - (Thanks to Hank W.) - - Changes affecting code - - Fix integer overflow bug in reference 'mktime' implementation. - (Problem reported by Jörg Richter.) - - Allow -Dtime_tz=time_t compilations, and allow -Dtime_tz=... libraries - to be used in the same executable as standard-library time_t functions. - (Problems reported by Bradley White.) - - Changes affecting commentary - - Cite the recent Mexican decree changing Quintana Roo's time zone. - (Thanks to Carlos Raúl Perasso.) - - Likewise for the recent Chilean decree. (Thanks to Eduardo Romero Urra.) - - Update info about Mars time. - - -Release 2015a - 2015-01-29 22:35:20 -0800 - - Changes affecting future time stamps - - The Mexican state of Quintana Roo, represented by America/Cancun, - will shift from Central Time with DST to Eastern Time without DST - on 2015-02-01 at 02:00. (Thanks to Steffen Thorsen and Gwillim Law.) - - Chile will not change clocks in April or thereafter; its new standard time - will be its old daylight saving time. This affects America/Santiago, - Pacific/Easter, and Antarctica/Palmer. (Thanks to Juan Correa.) - - New leap second 2015-06-30 23:59:60 UTC as per IERS Bulletin C 49. - (Thanks to Tim Parenti.) - - Changes affecting past time stamps - - Iceland observed DST in 1919 and 1921, and its 1939 fallback - transition was Oct. 29, not Nov. 29. Remove incorrect data from - Shanks about time in Iceland between 1837 and 1908. - - Some more zones have been turned into links, when they differed - from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. - Their old contents have been moved to the 'backzone' file. - The affected zones are: Asia/Aden, Asia/Bahrain, Asia/Kuwait, - and Asia/Muscat. - - Changes affecting code - - tzalloc now scrubs time zone abbreviations compatibly with the way - that tzset always has, by replacing invalid bytes with '_' and by - shortening too-long abbreviations. - - tzselect ports to POSIX awk implementations, no longer mishandles - POSIX TZ settings when GNU awk is used, and reports POSIX TZ - settings to the user. (Thanks to Stefan Kuhn.) - - Changes affecting build procedure - - 'make check' now checks for links to links in the data. - One such link (for Africa/Asmera) has been fixed. - (Thanks to Stephen Colebourne for pointing out the problem.) - - Changes affecting commentary - - The leapseconds file commentary now mentions the expiration date. - (Problem reported by Martin Burnicki.) - - Update Mexican Library of Congress URL. - - -Release 2014j - 2014-11-10 17:37:11 -0800 - - Changes affecting current and future time stamps - - Turks & Caicos' switch from US eastern time to UTC-4 year-round - did not occur on 2014-11-02 at 02:00. It's currently scheduled - for 2015-11-01 at 02:00. (Thanks to Chris Walton.) - - Changes affecting past time stamps - - Many pre-1989 time stamps have been corrected for Asia/Seoul and - Asia/Pyongyang, based on sources for the Korean-language Wikipedia - entry for time in Korea. (Thanks to Sanghyuk Jung.) Also, no - longer guess that Pyongyang mimicked Seoul time after World War II, - as this is politically implausible. - - Some more zones have been turned into links, when they differed - from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. - Their old contents have been moved to the 'backzone' file. - The affected zones are: Africa/Addis_Ababa, Africa/Asmara, - Africa/Dar_es_Salaam, Africa/Djibouti, Africa/Kampala, - Africa/Mogadishu, Indian/Antananarivo, Indian/Comoro, and - Indian/Mayotte. - - Changes affecting commentary - - The commentary is less enthusiastic about Shanks as a source, - and is more careful to distinguish UT from UTC. - - -Release 2014i - 2014-10-21 22:04:57 -0700 - - Changes affecting future time stamps - - Pacific/Fiji will observe DST from 2014-11-02 02:00 to 2015-01-18 03:00. - (Thanks to Ken Rylander for the heads-up.) Guess that future - years will use a similar pattern. - - A new Zone Pacific/Bougainville, for the part of Papua New Guinea - that plans to switch from UTC+10 to UTC+11 on 2014-12-28 at 02:00. - (Thanks to Kiley Walbom for the heads-up.) - - Changes affecting time zone abbreviations - - Since Belarus is not changing its clocks even though Moscow is, - the time zone abbreviation in Europe/Minsk is changing from FET - to its more-traditional value MSK on 2014-10-26 at 01:00. - (Thanks to Alexander Bokovoy for the heads-up about Belarus.) - - The new abbreviation IDT stands for the pre-1976 use of UT+8 in - Indochina, to distinguish it better from ICT (UT+7). - - Changes affecting past time stamps - - Many time stamps have been corrected for Asia/Ho_Chi_Minh before 1976 - (thanks to Trần Ngá»c Quân for an indirect pointer to Trần Tiến Bình's - authoritative book). Asia/Ho_Chi_Minh has been added to - zone1970.tab, to give tzselect users in Vietnam two choices, - since north and south Vietnam disagreed after our 1970 cutoff. - - Asia/Phnom_Penh and Asia/Vientiane have been turned into links, as - they differed from existing zones only for older time stamps. As - usual, these changes affect pre-1970 time stamps only. Their old - contents have been moved to the 'backzone' file. - - Changes affecting code - - The time-related library functions now set errno on failure, and - some crashes in the new tzalloc-related library functions have - been fixed. (Thanks to Christos Zoulas for reporting most of - these problems and for suggesting fixes.) - - If USG_COMPAT is defined and the requested time stamp is standard time, - the tz library's localtime and mktime functions now set the extern - variable timezone to a value appropriate for that time stamp; and - similarly for ALTZONE, daylight saving time, and the altzone variable. - This change is a companion to the tzname change in 2014h, and is - designed to make timezone and altzone more compatible with tzname. - - The tz library's functions now set errno to EOVERFLOW if they fail - because the result cannot be represented. ctime and ctime_r now - return NULL and set errno when a time stamp is out of range, rather - than having undefined behavior. - - Some bugs associated with the new 2014g functions have been fixed. - This includes a bug that largely incapacitated the new functions - time2posix_z and posix2time_z. (Thanks to Christos Zoulas.) - It also includes some uses of uninitialized variables after tzalloc. - The new code uses the standard type 'ssize_t', which the Makefile - now gives porting advice about. - - Changes affecting commentary - - Updated URLs for NRC Canada (thanks to Matt Johnson and Brian Inglis). - - -Release 2014h - 2014-09-25 18:59:03 -0700 - - Changes affecting past time stamps - - America/Jamaica's 1974 spring-forward transition was Jan. 6, not Apr. 28. - - Shanks says Asia/Novokuznetsk switched from LMT (not "NMT") on 1924-05-01, - not 1920-01-06. The old entry was based on a misinterpretation of Shanks. - - Some more zones have been turned into links, when they differed - from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. - Their old contents have been moved to the 'backzone' file. - The affected zones are: Africa/Blantyre, Africa/Bujumbura, - Africa/Gaborone, Africa/Harare, Africa/Kigali, Africa/Lubumbashi, - Africa/Lusaka, Africa/Maseru, and Africa/Mbabane. - - Changes affecting code - - zdump -V and -v now output gmtoff= values on all platforms, - not merely on platforms defining TM_GMTOFF. - - The tz library's localtime and mktime functions now set tzname to a value - appropriate for the requested time stamp, and zdump now uses this - on platforms not defining TM_ZONE, fixing a 2014g regression. - (Thanks to Tim Parenti for reporting the problem.) - - The tz library no longer sets tzname if localtime or mktime fails. - - zdump -c no longer mishandles transitions near year boundaries. - (Thanks to Tim Parenti for reporting the problem.) - - An access to uninitalized data has been fixed. - (Thanks to Jörg Richter for reporting the problem.) - - When THREAD_SAFE is defined, the code ports to the C11 memory model. - A memory leak has been fixed if ALL_STATE and THREAD_SAFE are defined - and two threads race to initialize data used by gmtime-like functions. - (Thanks to Andy Heninger for reporting the problems.) - - Changes affecting build procedure - - 'make check' now checks better for properly-sorted data. - - Changes affecting documentation and commentary - - zdump's gmtoff=N output is now documented, and its isdst=D output - is now documented to possibly output D values other than 0 or 1. - - zdump -c's treatment of years is now documented to use the - Gregorian calendar and Universal Time without leap seconds, - and its behavior at cutoff boundaries is now documented better. - (Thanks to Arthur David Olson and Tim Parenti for reporting the problems.) - - Programs are now documented to use the proleptic Gregorian calendar. - (Thanks to Alan Barrett for the suggestion.) - - Fractional-second GMT offsets have been documented for civil time - in 19th-century Chennai, Jakarta, and New York. - - -Release 2014g - 2014-08-28 12:31:23 -0700 - - Changes affecting future time stamps - - Turks & Caicos is switching from US eastern time to UTC-4 year-round, - modeled as a switch from EST/EDT to AST on 2014-11-02 at 02:00. - [As noted in 2014j, this switch was later delayed.] - - Changes affecting past time stamps - - Time in Russia or the USSR before 1926 or so has been corrected by - a few seconds in the following zones: Asia/Irkutsk, - Asia/Krasnoyarsk, Asia/Omsk, Asia/Samarkand, Asia/Tbilisi, - Asia/Vladivostok, Asia/Yakutsk, Europe/Riga, Europe/Samara. For - Asia/Yekaterinburg the correction is a few minutes. (Thanks to - Vladimir Karpinsky.) - - The Portuguese decree of 1911-05-26 took effect on 1912-01-01. - This affects 1911 time stamps in Africa/Bissau, Africa/Luanda, - Atlantic/Azores, and Atlantic/Madeira. Also, Lisbon's pre-1912 - GMT offset was -0:36:45 (rounded from -0:36:44.68), not -0:36:32. - (Thanks to Stephen Colebourne for pointing to the decree.) - - Asia/Dhaka ended DST on 2009-12-31 at 24:00, not 23:59. - - A new file 'backzone' contains data which may appeal to - connoisseurs of old time stamps, although it is out of scope for - the tz database, is often poorly sourced, and contains some data - that is known to be incorrect. The new file is not recommended - for ordinary use and its entries are not installed by default. - (Thanks to Lester Caine for the high-quality Jersey, Guernsey, and - Isle of Man entries.) - - Some more zones have been turned into links, when they differed - from existing zones only for older time stamps. As usual, - these changes affect UTC offsets in pre-1970 time stamps only. - Their old contents have been moved to the 'backzone' file. - The affected zones are: Africa/Bangui, Africa/Brazzaville, - Africa/Douala, Africa/Kinshasa, Africa/Libreville, Africa/Luanda, - Africa/Malabo, Africa/Niamey, and Africa/Porto-Novo. - - Changes affecting code - - Unless NETBSD_INSPIRED is defined to 0, the tz library now - supplies functions for creating and using objects that represent - time zones. The new functions are tzalloc, tzfree, localtime_rz, - mktime_z, and (if STD_INSPIRED is also defined) posix2time_z and - time2posix_z. They are intended for performance: for example, - localtime_rz (unlike localtime_r) is trivially thread-safe without - locking. (Thanks to Christos Zoulas for proposing NetBSD-inspired - functions, and to Alan Barrett and Jonathan Lennox for helping to - debug the change.) - - zdump now builds with the tz library unless USE_LTZ is defined to 0, - This lets zdump use tz features even if the system library lacks them. - To build zdump with the system library, use 'make CFLAGS=-DUSE_LTZ=0 - TZDOBJS=zdump.o CHECK_TIME_T_ALTERNATIVES='. - - zdump now uses localtime_rz if available, as it's significantly faster, - and it can help zdump better diagnose invalid time zone names. - Define HAVE_LOCALTIME_RZ to 0 to suppress this. HAVE_LOCALTIME_RZ - defaults to 1 if NETBSD_INSPIRED && USE_LTZ. When localtime_rz is - not available, zdump now uses localtime_r and tzset if available, - as this is a bit cleaner and faster than plain localtime. Compile - with -DHAVE_LOCALTIME_R=0 and/or -DHAVE_TZSET=0 if your system - lacks these two functions. - - If THREAD_SAFE is defined to 1, the tz library is now thread-safe. - Although not needed for tz's own applications, which are single-threaded, - this supports POSIX better if the tz library is used in multithreaded apps. - - Some crashes have been fixed when zdump or the tz library is given - invalid or outlandish input. - - The tz library no longer mishandles leap seconds on platforms with - unsigned time_t in time zones that lack ordinary transitions after 1970. - - The tz code now attempts to infer TM_GMTOFF and TM_ZONE if not - already defined, to make it easier to configure on common platforms. - Define NO_TM_GMTOFF and NO_TM_ZONE to suppress this. - - Unless the new macro UNINIT_TRAP is defined to 1, the tz code now - assumes that reading uninitialized memory yields garbage values - but does not cause other problems such as traps. - - If TM_GMTOFF is defined and UNINIT_TRAP is 0, mktime is now - more likely to guess right for ambiguous time stamps near - transitions where tm_isdst does not change. - - If HAVE_STRFTIME_L is defined to 1, the tz library now defines - strftime_l for compatibility with recent versions of POSIX. - Only the C locale is supported, though. HAVE_STRFTIME_L defaults - to 1 on recent POSIX versions, and to 0 otherwise. - - tzselect -c now uses a hybrid distance measure that works better - in Africa. (Thanks to Alan Barrett for noting the problem.) - - The C source code now ports to NetBSD when GCC_DEBUG_FLAGS is used, - or when time_tz is defined. - - When HAVE_UTMPX_H is set the 'date' command now builds on systems - whose file does not define WTMPX_FILE, and when setting - the date it updates the wtmpx file if _PATH_WTMPX is defined. - This affects GNU/Linux and similar systems. - - For easier maintenance later, some C code has been simplified, - some lint has been removed, and the code has been tweaked so that - plain 'make' is more likely to work. - - The C type 'bool' is now used for boolean values, instead of 'int'. - - The long-obsolete LOCALE_HOME code has been removed. - - The long-obsolete 'gtime' function has been removed. - - Changes affecting build procedure - - 'zdump' no longer links in ialloc.o, as it's not needed. - - 'make check_time_t_alternatives' no longer assumes GNU diff. - - Changes affecting distribution tarballs - - The files checktab.awk and zoneinfo2tdf.pl are now distributed in - the tzdata tarball instead of the tzcode tarball, since they help - maintain the data. The NEWS and Theory files are now also - distributed in the tzdata tarball, as they're relevant for data. - (Thanks to Alan Barrett for pointing this out.) Also, the - leapseconds.awk file is no longer distributed in the tzcode - tarball, since it belongs in the tzdata tarball (where 2014f - inadvertently also distributed it). - - Changes affecting documentation and commentary - - A new file CONTRIBUTING is distributed. (Thanks to Tim Parenti for - suggesting a CONTRIBUTING file, and to Tony Finch and Walter Harms - for debugging it.) - - The man pages have been updated to use function prototypes, - to document thread-safe variants like localtime_r, and to document - the NetBSD-inspired functions tzalloc, tzfree, localtime_rz, and - mktime_z. - - The fields in Link lines have been renamed to be more descriptive - and more like the parameters of 'ln'. LINK-FROM has become TARGET, - and LINK-TO has become LINK-NAME. - - tz-link.htm mentions the IETF's tzdist working group; Windows - Runtime etc. (thanks to Matt Johnson); and HP-UX's tztab. - - Some broken URLs have been fixed in the commentary. (Thanks to - Lester Caine.) - - Commentary about Philippines DST has been updated, and commentary - on pre-1970 time in India has been added. - - -Release 2014f - 2014-08-05 17:42:36 -0700 - - Changes affecting future time stamps - - Russia will subtract an hour from most of its time zones on 2014-10-26 - at 02:00 local time. (Thanks to Alexander Krivenyshev.) - There are a few exceptions: Magadan Oblast (Asia/Magadan) and Zabaykalsky - Krai are subtracting two hours; conversely, Chukotka Autonomous Okrug - (Asia/Anadyr), Kamchatka Krai (Asia/Kamchatka), Kemerovo Oblast - (Asia/Novokuznetsk), and the Samara Oblast and the Udmurt Republic - (Europe/Samara) are not changing their clocks. The changed zones are - Europe/Kaliningrad, Europe/Moscow, Europe/Simferopol, Europe/Volgograd, - Asia/Yekaterinburg, Asia/Omsk, Asia/Novosibirsk, Asia/Krasnoyarsk, - Asia/Irkutsk, Asia/Yakutsk, Asia/Vladivostok, Asia/Khandyga, - Asia/Sakhalin, and Asia/Ust-Nera; Asia/Magadan will have two hours - subtracted; and Asia/Novokuznetsk's time zone abbreviation is affected, - but not its UTC offset. Two zones are added: Asia/Chita (split - from Asia/Yakutsk, and also with two hours subtracted) and - Asia/Srednekolymsk (split from Asia/Magadan, but with only one hour - subtracted). (Thanks to Tim Parenti for much of the above.) - - Changes affecting time zone abbreviations - - Australian eastern time zone abbreviations are now AEST/AEDT not EST, - and similarly for the other Australian zones. That is, for eastern - standard and daylight saving time the abbreviations are AEST and AEDT - instead of the former EST for both; similarly, ACST/ACDT, ACWST/ACWDT, - and AWST/AWDT are now used instead of the former CST, CWST, and WST. - This change does not affect UTC offsets, only time zone abbreviations. - (Thanks to Rich Tibbett and many others.) - - Asia/Novokuznetsk shifts from NOVT to KRAT (remaining on UTC+7) - effective 2014-10-26 at 02:00 local time. - - The time zone abbreviation for Xinjiang Time (observed in Ürümqi) - has been changed from URUT to XJT. (Thanks to Luther Ma.) - - Prefer MSK/MSD for Moscow time in Russia, even in other cities. - Similarly, prefer EET/EEST for eastern European time in Russia. - - Change time zone abbreviations in (western) Samoa to use "ST" and - "DT" suffixes, as this is more likely to match common practice. - Prefix "W" to (western) Samoa time when its standard-time offset - disagrees with that of American Samoa. - - America/Metlakatla now uses PST, not MeST, to abbreviate its time zone. - - Time zone abbreviations have been updated for Japan's two time - zones used 1896-1937. JWST now stands for Western Standard - Time, and JCST for Central Standard Time (formerly this was CJT). - These abbreviations are now used for time in Korea, Taiwan, - and Sakhalin while controlled by Japan. - - Changes affecting past time stamps - - China's five zones have been simplified to two, since the post-1970 - differences in the other three seem to have been imaginary. The - zones Asia/Harbin, Asia/Chongqing, and Asia/Kashgar have been - removed; backwards-compatibility links still work, albeit with - different behaviors for time stamps before May 1980. Asia/Urumqi's - 1980 transition to UTC+8 has been removed, so that it is now at - UTC+6 and not UTC+8. (Thanks to Luther Ma and to Alois Treindl; - Treindl sent helpful translations of two papers by Guo Qingsheng.) - - Some zones have been turned into links, when they differed from existing - zones only for older UTC offsets where data entries were likely invented. - These changes affect UTC offsets in pre-1970 time stamps only. This is - similar to the change in release 2013e, except this time for western - Africa. The affected zones are: Africa/Bamako, Africa/Banjul, - Africa/Conakry, Africa/Dakar, Africa/Freetown, Africa/Lome, - Africa/Nouakchott, Africa/Ouagadougou, Africa/Sao_Tome, and - Atlantic/St_Helena. This also affects the backwards-compatibility - link Africa/Timbuktu. (Thanks to Alan Barrett, Stephen Colebourne, - Tim Parenti, and David Patte for reporting problems in earlier - versions of this change.) - - Asia/Shanghai's pre-standard-time UT offset has been changed from - 8:05:57 to 8:05:43, the location of Xujiahui Observatory. Its - transition to standard time has been changed from 1928 to 1901. - - Asia/Taipei switched to JWST on 1896-01-01, then to JST on 1937-10-01, - then to CST on 1945-09-21 at 01:00, and did not observe DST in 1945. - In 1946 it observed DST from 05-15 through 09-30; in 1947 - from 04-15 through 10-31; and in 1979 from 07-01 through 09-30. - (Thanks to Yu-Cheng Chuang.) - - Asia/Riyadh's transition to standard time is now 1947-03-14, not 1950. - - Europe/Helsinki's 1942 fall-back transition was 10-04 at 01:00, not - 10-03 at 00:00. (Thanks to Konstantin Hyppönen.) - - Pacific/Pago_Pago has been changed from UTC-11:30 to UTC-11 for the period - from 1911 to 1950. - - Pacific/Chatham has been changed to New Zealand standard time plus - 45 minutes for the period before 1957, reflecting a 1956 remark in - the New Zealand parliament. - - Europe/Budapest has several pre-1946 corrections: in 1918 the transition - out of DST was on 09-16, not 09-29; in 1919 it was on 11-24, not 09-15; in - 1945 it was on 11-01, not 11-03; in 1941 the transition to DST was 04-08 - not 04-06 at 02:00; and there was no DST in 1920. - - Africa/Accra is now assumed to have observed DST from 1920 through 1935. - - Time in Russia before 1927 or so has been corrected by a few seconds in - the following zones: Europe/Moscow, Asia/Irkutsk, Asia/Tbilisi, - Asia/Tashkent, Asia/Vladivostok, Asia/Yekaterinburg, Europe/Helsinki, and - Europe/Riga. Also, Moscow's location has been changed to its Kilometer 0 - point. (Thanks to Vladimir Karpinsky for the Moscow changes.) - - Changes affecting data format - - A new file 'zone1970.tab' supersedes 'zone.tab' in the installed data. - The new file's extended format allows multiple country codes per zone. - The older file is still installed but is deprecated; its format is - not changing and it will still be distributed for a while, but new - applications should use the new file. - - The new file format simplifies maintenance of obscure locations. - To test this, it adds coverage for the Crozet Islands and the - Scattered Islands. (Thanks to Tobias Conradi and Antoine Leca.) - - The file 'iso3166.tab' is planned to switch from ASCII to UTF-8. - It is still ASCII now, but commentary about the switch has been added. - The new file 'zone1970.tab' already uses UTF-8. - - Changes affecting code - - 'localtime', 'mktime', etc. now use much less stack space if ALL_STATE - is defined. (Thanks to Elliott Hughes for reporting the problem.) - - 'zic' no longer mishandles input when ignoring case in locales that - are not compatible with English, e.g., unibyte Turkish locales when - compiled with HAVE_GETTEXT. - - Error diagnostics of 'zic' and 'yearistype' have been reworded so that - they no longer use ASCII '-' as if it were a dash. - - 'zic' now rejects output file names that contain '.' or '..' components. - (Thanks to Tim Parenti for reporting the problem.) - - 'zic -v' now warns about output file names that do not follow - POSIX rules, or that contain a digit or '.'. (Thanks to Arthur - David Olson for starting the ball rolling on this.) - - Some lint has been removed when using GCC_DEBUG_FLAGS with GCC 4.9.0. - - Changes affecting build procedure - - 'zic' no longer links in localtime.o and asctime.o, as they're not needed. - (Thanks to John Cochran.) - - Changes affecting documentation and commentary - - The 'Theory' file documents legacy names, the longstanding - exceptions to the POSIX-inspired file name rules. - - The 'zic' documentation clarifies the role of time types when - interpreting dates. (Thanks to Arthur David Olson.) - - Documentation and commentary now prefer UTF-8 to US-ASCII, - allowing the use of proper accents in foreign words and names. - Code and data have not changed because of this. (Thanks to - Garrett Wollman, Ian Abbott, and Guy Harris for helping to debug - this.) - - Non-HTML documentation and commentary now use plain-text URLs instead of - HTML insertions, and are more consistent about bracketing URLs when they - are not already surrounded by white space. (Thanks to suggestions by - Steffen Nurpmeso.) - - There is new commentary about Xujiahui Observatory, the five time-zone - project in China from 1918 to 1949, timekeeping in Japanese-occupied - Shanghai, and Tibet Time in the 1950s. The sharp-eyed can spot the - warlord Jin Shuren in the data. - - Commentary about the coverage of each Russian zone has been standardized. - (Thanks to Tim Parenti). - - There is new commentary about contemporary timekeeping in Ethiopia. - - Obsolete comments about a 2007 proposal for DST in Kuwait has been removed. - - There is new commentary about time in Poland in 1919. - - Proper credit has been given to DST inventor George Vernon Hudson. - - Commentary about time in Metlakatla, AK and Resolute, NU has been - improved, with a new source for the former. - - In zone.tab, Pacific/Easter no longer mentions Salas y Gómez, as it - is uninhabited. - - Commentary about permanent Antarctic bases has been updated. - - Several typos have been corrected. (Thanks to Tim Parenti for - contributing some of these fixes.) - - tz-link.htm now mentions the JavaScript libraries Moment Timezone, - TimezoneJS.Date, Walltime-js, and Timezone. (Thanks to a heads-up - from Matt Johnson.) Also, it mentions the Go 'latlong' package. - (Thanks to a heads-up from Dirkjan Ochtman.) - - The files usno1988, usno1989, usno1989a, usno1995, usno1997, and usno1998 - have been removed. These obsolescent US Naval Observatory entries were no - longer helpful for maintenance. (Thanks to Tim Parenti for the suggestion.) - - -Release 2014e - 2014-06-12 21:53:52 -0700 - - Changes affecting near-future time stamps - - Egypt's 2014 Ramadan-based transitions are June 26 and July 31 at 24:00. - (Thanks to Imed Chihi.) Guess that from 2015 on Egypt will temporarily - switch to standard time at 24:00 the last Thursday before Ramadan, and - back to DST at 00:00 the first Friday after Ramadan. - - Similarly, Morocco's are June 28 at 03:00 and August 2 at 02:00. (Thanks - to Milamber Space Network.) Guess that from 2015 on Morocco will - temporarily switch to standard time at 03:00 the last Saturday before - Ramadan, and back to DST at 02:00 the first Saturday after Ramadan. - - Changes affecting past time stamps - - The abbreviation "MSM" (Moscow Midsummer Time) is now used instead of - "MSD" for Moscow's double daylight time in summer 1921. Also, a typo - "VLASST" has been repaired to be "VLAST" for Vladivostok summer time - in 1991. (Thanks to Hank W. for reporting the problems.) - - Changes affecting commentary - - tz-link.htm now cites RFC 7265 for jCal, mentions PTP and the - draft CalDAV extension, updates URLs for TSP, TZInfo, IATA, and - removes stale pointers to World Time Explorer and WORLDTIME. - - -Release 2014d - 2014-05-27 21:34:40 -0700 - - Changes affecting code - - zic no longer generates files containing time stamps before the Big Bang. - This works around GNOME bug 730332 - . - (Thanks to Leonardo Chiquitto for reporting the bug, and to - Arthur David Olson and James Cloos for suggesting improvements to the fix.) - - Changes affecting documentation - - tz-link.htm now mentions GNOME. - - -Release 2014c - 2014-05-13 07:44:13 -0700 - - Changes affecting near-future time stamps - - Egypt observes DST starting 2014-05-15 at 24:00. - (Thanks to Ahmad El-Dardiry and Gunther Vermier.) - Details have not been announced, except that DST will not be observed - during Ramadan. Guess that DST will stop during the same Ramadan dates as - Morocco, and that Egypt's future spring and fall transitions will be the - same as 2010 when it last observed DST, namely April's last Friday at - 00:00 to September's last Thursday at 23:00 standard time. Also, guess - that Ramadan transitions will be at 00:00 standard time. - - Changes affecting code - - zic now generates transitions for minimum time values, eliminating guesswork - when handling low-valued time stamps. (Thanks to Arthur David Olson.) - - Port to Cygwin sans glibc. (Thanks to Arthur David Olson.) - - Changes affecting commentary and documentation - - Remove now-confusing comment about Jordan. (Thanks to Oleksii Nochovnyi.) - - -Release 2014b - 2014-03-24 21:28:50 -0700 - - Changes affecting near-future time stamps - - Crimea switches to Moscow time on 2014-03-30 at 02:00 local time. - (Thanks to Alexander Krivenyshev.) Move its zone.tab entry from UA to RU. - - New entry for Troll station, Antarctica. (Thanks to Paul-Inge Flakstad and - Bengt-Inge Larsson.) This is currently an approximation; a better version - will require the zic and localtime fixes mentioned below, and the plan is - to wait for a while until at least the zic fixes propagate. - - Changes affecting code - - 'zic' and 'localtime' no longer reject locations needing four transitions - per year for the foreseeable future. (Thanks to Andrew Main (Zefram).) - Also, 'zic' avoids some unlikely failures due to integer overflow. - - Changes affecting build procedure - - 'make check' now detects Rule lines defined but never used. - The NZAQ rules, an instance of this problem, have been removed. - - Changes affecting commentary and documentation - - Fix Tuesday/Thursday typo in description of time in Israel. - (Thanks to Bert Katz via Pavel Kharitonov and Mike Frysinger.) - - Microsoft Windows 8.1 doesn't support tz database names. (Thanks - to Donald MacQueen.) Instead, the Microsoft Windows Store app - library supports them. - - Add comments about Johnston Island time in the 1960s. - (Thanks to Lyle McElhaney.) - - Morocco's 2014 DST start will be as predicted. - (Thanks to Sebastien Willemijns.) - - -Release 2014a - 2014-03-07 23:30:29 -0800 - - Changes affecting near-future time stamps - - Turkey begins DST on 2014-03-31, not 03-30. (Thanks to Faruk Pasin for - the heads-up, and to Tim Parenti for simplifying the update.) - - Changes affecting past time stamps - - Fiji ended DST on 2014-01-19 at 02:00, not the previously-scheduled 03:00. - (Thanks to Steffen Thorsen.) - - Ukraine switched from Moscow to Eastern European time on 1990-07-01 - (not 1992-01-01), and observed DST during the entire next winter. - (Thanks to Vladimir in Moscow via Alois Treindl.) - - In 1988 Israel observed DST from 04-10 to 09-04, not 04-09 to 09-03. - (Thanks to Avigdor Finkelstein.) - - Changes affecting code - - A uninitialized-storage bug in 'localtime' has been fixed. - (Thanks to Logan Chien.) - - Changes affecting the build procedure - - The settings for 'make check_web' now default to Ubuntu 13.10. - - Changes affecting commentary and documentation - - The boundary of the US Pacific time zone is given more accurately. - (Thanks to Alan Mintz.) - - Chile's 2014 DST will be as predicted. (Thanks to José Miguel Garrido.) - - Paraguay's 2014 DST will be as predicted. (Thanks to Carlos Raúl Perasso.) - - Better descriptions of countries with same time zone history as - Trinidad and Tobago since 1970. (Thanks to Alan Barrett for suggestion.) - - Several changes affect tz-link.htm, the main web page. - - Mention Time.is (thanks to Even Scharning) and WX-now (thanks to - David Braverman). - - Mention xCal (Internet RFC 6321) and jCal. - - Microsoft has some support for tz database names. - - CLDR data formats include both XML and JSON. - - Mention Maggiolo's map of solar vs standard time. - (Thanks to Arthur David Olson.) - - Mention TZ4Net. (Thanks to Matt Johnson.) - - Mention the timezone-olson Haskell package. - - Mention zeitverschiebung.net. (Thanks to Martin Jäger.) - - Remove moribund links to daylight-savings-time.info and to - Simple Timer + Clocks. - - Update two links. (Thanks to Oscar van Vlijmen.) - - Fix some formatting glitches, e.g., remove random newlines from - abbr elements' title attributes. - - -Release 2013i - 2013-12-17 07:25:23 -0800 - - Changes affecting near-future time stamps: - - Jordan switches back to standard time at 00:00 on December 20, 2013. - The 2006-2011 transition schedule is planned to resume in 2014. - (Thanks to Steffen Thorsen.) - - Changes affecting past time stamps: - - In 2004, Cuba began DST on March 28, not April 4. - (Thanks to Steffen Thorsen.) - - Changes affecting code - - The compile-time flag NOSOLAR has been removed, as nowadays the - benefit of slightly shrinking runtime table size is outweighed by the - cost of disallowing potential future updates that exceed old limits. - - Changes affecting documentation and commentary - - The files solar87, solar88, and solar89 are no longer distributed. - They were a negative experiment - that is, a demonstration that - tz data can represent solar time only with some difficulty and error. - Their presence in the distribution caused confusion, as Riyadh - civil time was generally not solar time in those years. - - tz-link.htm now mentions Noda Time. (Thanks to Matt Johnson.) - - -Release 2013h - 2013-10-25 15:32:32 -0700 - - Changes affecting current and future time stamps: - - Libya has switched its time zone back to UTC+2 without DST, - instead of UTC+1 with DST. (Thanks to Even Scharning.) - - Western Sahara (Africa/El_Aaiun) uses Morocco's DST rules. - (Thanks to Gwillim Law.) - - Changes affecting future time stamps: - - Acre and (we guess) western Amazonas will switch from UTC-4 to UTC-5 - on 2013-11-10. This affects America/Rio_Branco and America/Eirunepe. - (Thanks to Steffen Thorsen.) - - Add entries for DST transitions in Morocco in the year 2038. - This avoids some year-2038 glitches introduced in 2013g. - (Thanks to Yoshito Umaoka for reporting the problem.) - - Changes affecting API - - The 'tzselect' command no longer requires the 'select' command, - and should now work with /bin/sh on more platforms. It also works - around a bug in BusyBox awk before version 1.21.0. (Thanks to - Patrick 'P. J.' McDermott and Alan Barrett.) - - Changes affecting code - - Fix localtime overflow bugs with 32-bit unsigned time_t. - - zdump no longer assumes sscanf returns maximal values on overflow. - - Changes affecting the build procedure - - The builder can specify which programs to use, if any, instead of - 'ar' and 'ranlib', and libtz.a is now built locally before being - installed. (Thanks to Michael Forney.) - - A dependency typo in the 'zdump' rule has been fixed. - (Thanks to Andrew Paprocki.) - - The Makefile has been simplified by assuming that 'mkdir -p' and 'cp -f' - work as specified by POSIX.2-1992 or later; this is portable nowadays. - - 'make clean' no longer removes 'leapseconds', since it's - host-independent and is part of the distribution. - - The unused makefile macros TZCSRCS, TZDSRCS, DATESRCS have been removed. - - Changes affecting documentation and commentary - - tz-link.htm now mentions TC TIMEZONE's draft time zone service protocol - (thanks to Mike Douglass) and TimezoneJS.Date (thanks to Jim Fehrle). - - Update URLs in tz-link page. Add URLs for Microsoft Windows, since - 8.1 introduces tz support. Remove URLs for Tru64 and UnixWare (no - longer maintained) and for old advisories. SOFA now does C. - -Release 2013g - 2013-09-30 21:08:26 -0700 - - Changes affecting current and near-future time stamps - - Morocco now observes DST from the last Sunday in March to the last - Sunday in October, not April to September respectively. (Thanks - to Steffen Thorsen.) - - Changes affecting 'zic' - - 'zic' now runs on platforms that lack both hard links and symlinks. - (Thanks to Theo Veenker for reporting the problem, for MinGW.) - Also, fix some bugs on platforms that lack hard links but have symlinks. - - 'zic -v' again warns that Asia/Tehran has no POSIX environment variable - to predict the far future, fixing a bug introduced in 2013e. - - Changes affecting the build procedure - - The 'leapseconds' file is again put into the tzdata tarball. - Also, 'leapseconds.awk', so tzdata is self-contained. (Thanks to - Matt Burgess and Ian Abbott.) The timestamps of these and other - dependent files in tarballs are adjusted more consistently. - - Changes affecting documentation and commentary - - The README file is now part of the data tarball as well as the code. - It now states that files are public domain unless otherwise specified. - (Thanks to Andrew Main (Zefram) for asking for clarifications.) - Its details about the 1989 release moved to a place of honor near - the end of NEWS. - - -Release 2013f - 2013-09-24 23:37:36 -0700 - - Changes affecting near-future time stamps - - Tocantins will very likely not observe DST starting this spring. - (Thanks to Steffen Thorsen.) - - Jordan will likely stay at UTC+3 indefinitely, and will not fall - back this fall. - - Palestine will fall back at 00:00, not 01:00. (Thanks to Steffen Thorsen.) - - Changes affecting API - - The types of the global variables 'timezone' and 'altzone' (if present) - have been changed back to 'long'. This is required for 'timezone' - by POSIX, and for 'altzone' by common practice, e.g., Solaris 11. - These variables were originally 'long' in the tz code, but were - mistakenly changed to 'time_t' in 1987; nobody reported the - incompatibility until now. The difference matters on x32, where - 'long' is 32 bits and 'time_t' is 64. (Thanks to Elliott Hughes.) - - Changes affecting the build procedure - - Avoid long strings in leapseconds.awk to work around a mawk bug. - (Thanks to Cyril Baurand.) - - Changes affecting documentation and commentary - - New file 'NEWS' that contains release notes like this one. - - Paraguay's law does not specify DST transition time; 00:00 is customary. - (Thanks to Waldemar Villamayor-Venialbo.) - - Minor capitalization fixes. - - Changes affecting version-control only - - The experimental GitHub repository now contains annotated and - signed tags for recent releases, e.g., '2013e' for Release 2013e. - Releases are tagged starting with 2012e; earlier releases were - done differently, and tags would either not have a simple name or - not exactly match what was released. - - 'make set-timestamps' is now simpler and a bit more portable. - - -Release 2013e - 2013-09-19 23:50:04 -0700 - - Changes affecting near-future time stamps - - This year Fiji will start DST on October 27, not October 20. - (Thanks to David Wheeler for the heads-up.) For now, guess that - Fiji will continue to spring forward the Sunday before the fourth - Monday in October. - - Changes affecting current and future time zone abbreviations - - Use WIB/WITA/WIT rather than WIT/CIT/EIT for alphabetic Indonesian - time zone abbreviations since 1932. (Thanks to George Ziegler, - Priyadi Iman Nurcahyo, Zakaria, Jason Grimes, Martin Pitt, and - Benny Lin.) This affects Asia/Dili, Asia/Jakarta, Asia/Jayapura, - Asia/Makassar, and Asia/Pontianak. - - Use ART (UTC-3, standard time), rather than WARST (also UTC-3, but - daylight saving time) for San Luis, Argentina since 2009. - - Changes affecting GodthÃ¥b time stamps after 2037 if version mismatch - - Allow POSIX-like TZ strings where the transition time's hour can - range from -167 through 167, instead of the POSIX-required 0 - through 24. E.g., TZ='FJT-12FJST,M10.3.1/146,M1.3.4/75' for the - new Fiji rules. This is a more-compact way to represent - far-future time stamps for America/Godthab, America/Santiago, - Antarctica/Palmer, Asia/Gaza, Asia/Hebron, Asia/Jerusalem, - Pacific/Easter, and Pacific/Fiji. Other zones are unaffected by - this change. (Derived from a suggestion by Arthur David Olson.) - - Allow POSIX-like TZ strings where daylight saving time is in - effect all year. E.g., TZ='WART4WARST,J1/0,J365/25' for Western - Argentina Summer Time all year. This supports a more-compact way - to represent the 2013d data for America/Argentina/San_Luis. - Because of the change for San Luis noted above this change does not - affect the current data. (Thanks to Andrew Main (Zefram) for - suggestions that improved this change.) - - Where these two TZ changes take effect, there is a minor extension - to the tz file format in that it allows new values for the - embedded TZ-format string, and the tz file format version number - has therefore been increased from 2 to 3 as a precaution. - Version-2-based client code should continue to work as before for - all time stamps before 2038. Existing version-2-based client code - (tzcode, GNU/Linux, Solaris) has been tested on version-3-format - files, and typically works in practice even for time stamps after - 2037; the only known exception is America/Godthab. - - Changes affecting time stamps before 1970 - - Pacific/Johnston is now a link to Pacific/Honolulu. This corrects - some errors before 1947. - - Some zones have been turned into links, when they differ from existing - zones only in older data entries that were likely invented or that - differ only in LMT or transitions from LMT. These changes affect - only time stamps before 1943. The affected zones are: - Africa/Juba, America/Anguilla, America/Aruba, America/Dominica, - America/Grenada, America/Guadeloupe, America/Marigot, - America/Montserrat, America/St_Barthelemy, America/St_Kitts, - America/St_Lucia, America/St_Thomas, America/St_Vincent, - America/Tortola, and Europe/Vaduz. (Thanks to Alois Treindl for - confirming that the old Europe/Vaduz zone was wrong and the new - link is better for WWII-era times.) - - Change Kingston Mean Time from -5:07:12 to -5:07:11. This affects - America/Cayman, America/Jamaica and America/Grand_Turk time stamps - from 1890 to 1912. - - Change the UT offset of Bern Mean Time from 0:29:44 to 0:29:46. - This affects Europe/Zurich time stamps from 1853 to 1894. (Thanks - to Alois Treindl). - - Change the date of the circa-1850 Zurich transition from 1849-09-12 - to 1853-07-16, overriding Shanks with data from Messerli about - postal and telegraph time in Switzerland. - - Changes affecting time zone abbreviations before 1970 - - For Asia/Jakarta, use BMT (not JMT) for mean time from 1923 to 1932, - as Jakarta was called Batavia back then. - - Changes affecting API - - The 'zic' command now outputs a dummy transition when far-future - data can't be summarized using a TZ string, and uses a 402-year - window rather than a 400-year window. For the current data, this - affects only the Asia/Tehran file. It does not affect any of the - time stamps that this file represents, so zdump outputs the same - information as before. (Thanks to Andrew Main (Zefram).) - - The 'date' command has a new '-r' option, which lets you specify - the integer time to display, a la FreeBSD. - - The 'tzselect' command has two new options '-c' and '-n', which lets you - select a zone based on latitude and longitude. - - The 'zic' command's '-v' option now warns about constructs that - require the new version-3 binary file format. (Thanks to Arthur - David Olson for the suggestion.) - - Support for floating-point time_t has been removed. - It was always dicey, and POSIX no longer requires it. - (Thanks to Eric Blake for suggesting to the POSIX committee to - remove it, and thanks to Alan Barrett, Clive D.W. Feather, Andy - Heninger, Arthur David Olson, and Alois Treindl, for reporting - bugs and elucidating some of the corners of the old floating-point - implementation.) - - The signatures of 'offtime', 'timeoff', and 'gtime' have been - changed back to the old practice of using 'long' to represent UT - offsets. This had been inadvertently and mistakenly changed to - 'int_fast32_t'. (Thanks to Christos Zoulas.) - - The code avoids undefined behavior on integer overflow in some - more places, including gmtime, localtime, mktime and zdump. - - Changes affecting the zdump utility - - zdump now outputs "UT" when referring to Universal Time, not "UTC". - "UTC" does not make sense for time stamps that predate the introduction - of UTC, whereas "UT", a more-generic term, does. (Thanks to Steve Allen - for clarifying UT vs UTC.) - - Data changes affecting behavior of tzselect and similar programs - - Country code BQ is now called the more-common name "Caribbean Netherlands" - rather than the more-official "Bonaire, St Eustatius & Saba". - - Remove from zone.tab the names America/Montreal, America/Shiprock, - and Antarctica/South_Pole, as they are equivalent to existing - same-country-code zones for post-1970 time stamps. The data entries for - these names are unchanged, so the names continue to work as before. - - Changes affecting code internals - - zic -c now runs way faster on 64-bit hosts when given large numbers. - - zic now uses vfprintf to avoid allocating and freeing some memory. - - tzselect now computes the list of continents from the data, - rather than have it hard-coded. - - Minor changes pacify GCC 4.7.3 and GCC 4.8.1. - - Changes affecting the build procedure - - The 'leapseconds' file is now generated automatically from a - new file 'leap-seconds.list', which is a copy of - . - A new source file 'leapseconds.awk' implements this. - The goal is simplification of the future maintenance of 'leapseconds'. - - When building the 'posix' or 'right' subdirectories, if the - subdirectory would be a copy of the default subdirectory, it is - now made a symbolic link if that is supported. This saves about - 2 MB of file system space. - - The links America/Shiprock and Antarctica/South_Pole have been - moved to the 'backward' file. This affects only nondefault builds - that omit 'backward'. - - Changes affecting version-control only - - .gitignore now ignores 'date'. - - Changes affecting documentation and commentary - - Changes to the 'tzfile' man page - - It now mentions that the binary file format may be extended in - future versions by appending data. - - It now refers to the 'zdump' and 'zic' man pages. - - Changes to the 'zic' man page - - It lists conditions that elicit a warning with '-v'. - - It says that the behavior is unspecified when duplicate names - are given, or if the source of one link is the target of another. - - Its examples are updated to match the latest data. - - The definition of white space has been clarified slightly. - (Thanks to Michael Deckers.) - - Changes to the 'Theory' file - - There is a new section about the accuracy of the tz database, - describing the many ways that errors can creep in, and - explaining why so many of the pre-1970 time stamps are wrong or - misleading (thanks to Steve Allen, Lester Caine, and Garrett - Wollman for discussions that contributed to this). - - The 'Theory' file describes LMT better (this follows a - suggestion by Guy Harris). - - It refers to the 2013 edition of POSIX rather than the 2004 edition. - - It's mentioned that excluding 'backward' should not affect the - other data, and it suggests at least one zone.tab name per - inhabited country (thanks to Stephen Colebourne). - - Some longstanding restrictions on names are documented, e.g., - 'America/New_York' precludes 'America/New_York/Bronx'. - - It gives more reasons for the 1970 cutoff. - - It now mentions which time_t variants are supported, such as - signed integer time_t. (Thanks to Paul Goyette for reporting - typos in an experimental version of this change.) - - (Thanks to Philip Newton for correcting typos in these changes.) - - Documentation and commentary is more careful to distinguish UT in - general from UTC in particular. (Thanks to Steve Allen.) - - Add a better source for the Zurich 1894 transition. - (Thanks to Pierre-Yves Berger.) - - Update shapefile citations in tz-link.htm. (Thanks to Guy Harris.) - - -Release 2013d - 2013-07-05 07:38:01 -0700 - - Changes affecting future time stamps: - - Morocco's midsummer transitions this year are July 7 and August 10, - not July 9 and August 8. (Thanks to Andrew Paprocki.) - - Israel now falls back on the last Sunday of October. - (Thanks to Ephraim Silverberg.) - - Changes affecting past time stamps: - - Specify Jerusalem's location more precisely; this changes the pre-1880 - times by 2 s. - - Changing affecting metadata only: - - Fix typos in the entries for country codes BQ and SX. - - Changes affecting code: - - Rework the code to fix a bug with handling Australia/Macquarie on - 32-bit hosts (thanks to Arthur David Olson). - - Port to platforms like NetBSD, where time_t can be wider than long. - - Add support for testing time_t types other than the system's. - Run 'make check_time_t_alternatives' to try this out. - Currently, the tests fail for unsigned time_t; - this should get fixed at some point. - - Changes affecting documentation and commentary: - - Deemphasize the significance of national borders. - - Update the zdump man page. - - Remove obsolete NOID comment (thanks to Denis Excoffier). - - Update several URLs and comments in the web pages. - - Spelling fixes (thanks to Kevin Lyda and Jonathan Leffler). - - Update URL for CLDR Zone->Tzid table (thanks to Yoshito Umaoka). - - -Release 2013c - 2013-04-19 16:17:40 -0700 - - Changes affecting current and future time stamps: - - Palestine observed DST starting March 29, 2013. (Thanks to - Steffen Thorsen.) From 2013 on, Gaza and Hebron both observe DST, - with the predicted rules being the last Thursday in March at 24:00 - to the first Friday on or after September 21 at 01:00. - - Assume that the recent change to Paraguay's DST rules is permanent, - by moving the end of DST to the 4th Sunday in March every year. - (Thanks to Carlos Raúl Perasso.) - - Changes affecting past time stamps: - - Fix some historical data for Palestine to agree with that of - timeanddate.com, as follows: - - The spring 2008 change in Gaza and Hebron was on 00:00 Mar 28, not - 00:00 Apr 1. - - The fall 2009 change in Gaza and Hebron on Sep 4 was at 01:00, not - 02:00. - - The spring 2010 change in Hebron was 00:00 Mar 26, not 00:01 Mar 27. - - The spring 2011 change in Gaza was 00:01 Apr 1, not 12:01 Apr 2. - - The spring 2011 change in Hebron on Apr 1 was at 00:01, not 12:01. - - The fall 2011 change in Hebron on Sep 30 was at 00:00, not 03:00. - - Fix times of habitation for Macquarie to agree with the Tasmania - Parks & Wildlife Service history, which indicates that permanent - habitation was 1899-1919 and 1948 on. - - Changing affecting metadata only: - - Macquarie Island is politically part of Australia, not Antarctica. - (Thanks to Tobias Conradi.) - - Sort Macquarie more-consistently with other parts of Australia. - (Thanks to Tim Parenti.) - - -Release 2013b - 2013-03-10 22:33:40 -0700 - - Changes affecting current and future time stamps: - - Haiti uses US daylight-saving rules this year, and presumably future years. - This changes time stamps starting today. (Thanks to Steffen Thorsen.) - - Paraguay will end DST on March 24 this year. - (Thanks to Steffen Thorsen.) For now, assume it's just this year. - - Morocco does not observe DST during Ramadan; - try to predict Ramadan in Morocco as best we can. - (Thanks to Erik Homoet for the heads-up.) - - Changes affecting commentary: - - Update URLs in tz-link page. Add URLs for webOS, BB10, iOS. - Update URL for Solaris. Mention Internet RFC 6557. - Update Internet RFCs 2445->5545, 2822->5322. - Switch from FTP to HTTP for Internet RFCs. - - -Release 2013a - 2013-02-27 09:20:35 -0800 - - Change affecting binary data format: - - The zone offset at the end of version-2-format zone files is now - allowed to be 24:00, as per POSIX.1-2008. (Thanks to Arthur David Olson.) - - Changes affecting current and future time stamps: - - Chile's 2013 rules, and we guess rules for 2014 and later, will be - the same as 2012, namely Apr Sun>=23 03:00 UTC to Sep Sun>=2 04:00 UTC. - (Thanks to Steffen Thorsen and Robert Elz.) - - New Zones Asia/Khandyga, Asia/Ust-Nera, Europe/Busingen. - (Thanks to Tobias Conradi and Arthur David Olson.) - - Many changes affect historical time stamps before 1940. - These were deduced from: Milne J. Civil time. Geogr J. 1899 - Feb;13(2):173-94 . - - Changes affecting the code: - - Fix zic bug that mishandled Egypt's 2010 changes (this also affected - the data). (Thanks to Arthur David Olson.) - - Fix localtime bug when time_t is unsigned and data files were generated - by a signed time_t system. (Thanks to Doug Bailey for reporting and - to Arthur David Olson for fixing.) - - Allow the email address for bug reports to be set by the packager. - The default is tz@iana.org, as before. (Thanks to Joseph S. Myers.) - - Update HTML checking to be compatible with Ubuntu 12.10. - - Check that files are a safe subset of ASCII. At some point we may - relax this requirement to a safe subset of UTF-8. Without the - check, some non-UTF-8 encodings were leaking into the distribution. - - Commentary changes: - - Restore a comment about copyright notices that was inadvertently deleted. - (Thanks to Arthur David Olson.) - - Improve the commentary about which districts observe what times - in Russia. (Thanks to Oscar van Vlijmen and Arthur David Olson). - - Add web page links to tz.js. - - Add "Run by the Monkeys" to tz-art. (Thanks to Arthur David Olson.) - - -Release 2012j - 2012-11-12 18:34:49 -0800 - - Libya moved to CET this weekend, but with DST planned next year. - (Thanks to Even Scharning, Steffen Thorsen, and Tim Parenti.) - - Signatures now have the extension .asc, not .sign, as that's more - standard. (Thanks to Phil Pennock.) - - The output of 'zdump --version', and of 'zic --version', now - uses a format that is more typical for --version. - (Thanks to Joseph S. Myers.) - - The output of 'tzselect --help', 'zdump --help', and 'zic --help' - now uses tz@iana.org rather than the old elsie address. - - zic -v now complains about abbreviations that are less than 3 - or more than 6 characters, as per Posix. Formerly, it checked - for abbreviations that were more than 3. - - 'make public' no longer puts its temporary directory under /tmp, - and uses the just-built zic rather than the system zic. - - Various fixes to documentation and commentary. - - -Release 2012i - 2012-11-03 12:57:09 -0700 - - Cuba switches from DST tomorrow at 01:00. (Thanks to Steffen Thorsen.) - - Linker flags can now be specified via LDFLAGS. - AWK now defaults to 'awk', not 'nawk'. - The shell in tzselect now defaults to /bin/bash, but this can - be overridden by specifying KSHELL. - The main web page now mentions the unofficial GitHub repository. - (Thanks to Mike Frysinger.) - - Tarball signatures can now be built by running 'make signatures'. - There are also new makefile rules 'tarballs', 'check_public', and - separate makefile rules for each tarball and signature file. - A few makefile rules are now more portable to strict POSIX. - - The main web page now lists the canonical IANA URL. - - -Release 2012h - 2012-10-26 22:49:10 -0700 - - Bahia no longer has DST. (Thanks to Kelley Cook.) - - Tocantins has DST. (Thanks to Rodrigo Severo.) - - Israel has new DST rules next year. (Thanks to Ephraim Silverberg.) - - Jordan stays on DST this winter. (Thanks to Steffen Thorsen.) - - Web page updates. - - More C modernization, except that at Arthur David Olson's suggestion - the instances of 'register' were kept. - - -Release 2012g - 2012-10-17 20:59:45 -0700 - - Samoa fall 2012 and later. (Thanks to Nicholas Pereira and Robert Elz.) - - Palestine fall 2012. (Thanks to Steffen Thorsen.) - - Assume C89. - - To attack the version-number problem, this release ships the file - 'Makefile' (which contains the release number) in both the tzcode and - the tzdata tarballs. The two Makefiles are identical, and should be - identical in any matching pair of tarballs, so it shouldn't matter - which order you extract the tarballs. Perhaps we can come up with a - better version-number scheme at some point; this scheme does have the - virtue of not adding more files. - - -Release 2012f - 2012-09-12 23:17:03 -0700 - - * australasia (Pacific/Fiji): Fiji DST is October 21 through January - 20 this year. (Thanks to Steffen Thorsen.) - - -Release 2012e - 2012-08-02 20:44:55 -0700 - - * australasia (Pacific/Fakaofo): Tokelau is UTC+13, not UTC+14. - (Thanks to Steffen Thorsen.) - - * Use a single version number for both code and data. - - * .gitignore: New file. - - * Remove trailing white space. - - -Release code2012c-data2012d - 2012-07-19 16:35:33 -0700 - - Changes for Morocco's time stamps, which take effect in a couple of - hours, along with infrastructure changes to accommodate how the tz - code and data are released on IANA. - - -Release data2012c - 2012-03-27 12:17:25 -0400 - - africa - Summer time changes for Morocco (to start late April 2012) - - asia - Changes for 2012 for Gaza & the West Bank (Hebron) and Syria - - northamerica - Haiti following US/Canada rules for 2012 (and we're assuming, - for now anyway, for the future). - - -Release 2012b - 2012-03-02 12:29:15 +0700 - - There is just one change to tzcode2012b (compared with 2012a): - the Makefile that was accidentally included with 2012a has been - replaced with the version that should have been there, which is - identical with the previous version (from tzcode2011i). - - There are just two changes in tzdata2012b compared with 2012a. - - Most significantly, summer time in Cuba has been delayed 3 weeks - (now starts April 1 rather than March 11). Since Mar 11 (the old start - date, as listed in 2012a) is just a little over a week away, this - change is urgent. - - Less importantly, an excess tab in one of the changes in zone.tab - in 2012a has been removed. - - -Release 2012a - 2012-03-01 18:28:10 +0700 - - The changes in tzcode2012a (compared to the previous version, 2011i) - are entirely to the README and tz-art.htm and tz-link.htm files, if - none of those concern you, you can ignore the code update. The changes - reflect the changed addresses for the mailing list and the code and - data distribution points & methods (and a link to DateTime::TimeZone::Tzfile - has been added to tz-link.htm). - - In tzdata2012a (compared to the previous release, which was 2011n) - the major changes are: - Chile 2011/2012 and 2012/2013 summer time date adjustments. - Falkland Islands onto permanent summer time (we're assuming for the - foreseeable future, though 2012 is all we're fairly certain of.) - Armenia has abolished Summer Time. - Tokelau jumped the International Date Line back last December - (just the same as their near neighbour, Samoa). - America/Creston is a new zone for a small area of British Columbia - There will be a leapsecond 2012-06-30 23:59:60 UTC. - - Other minor changes are: - Corrections to 1918 Canadian summer time end dates. - Updated URL for UK time zone history (in comments) - A few typos in Le Corre's list of free French place names (comments) - - -Release data2011n - 2011-10-30 14:57:54 +0700 - - There are three changes of note - most urgently, Cuba (America/Havana) - has extended summer time by two weeks, now to end on Nov 13, rather than - the (already past) Oct 30. Second, the Pridnestrovian Moldavian Republic - (Europe/Tiraspol) decided not to split from the rest of Moldova after - all, and consequently that zone has been removed (again) and reinstated - in the "backward" file as a link to Europe/Chisinau. And third, the - end date for Fiji's summer time this summer was moved forward from the - earlier planned Feb 26, to Jan 22. - - Apart from that, Moldova (MD) returns to a single entry in zone.tab - (and the incorrect syntax that was in the 2011m version of that file - is so fixed - it would have been fixed in a different way had this - change not happened - that's the "missing" sccs version id). - - -Release data2011m - 2011-10-24 21:42:16 +0700 - - In particular, the typos in comments in the data (2011-11-17 should have - been 2011-10-17 as Alan Barrett noted, and spelling of Tiraspol that - Tim Parenti noted) have been fixed, and the change for Ukraine has been - made in all 4 Ukrainian zones, rather than just Kiev (again, thanks to - Tim Parenti, and also Denys Gavrysh) - - In addition, I added Europe/Tiraspol to zone.tab. - - This time, all the files have new version numbers... (including the files - otherwise unchanged in 2011m that were changed in 2011l but didn't get new - version numbers there...) - - -Release data2011l - 2011-10-10 11:15:43 +0700 - - There are just 2 changes that cause different generated tzdata files from - zic, to Asia/Hebron and Pacific/Fiji - the possible change for Bahia, Brazil - is included, but commented out. Compared with the diff I sent out last week, - this version also includes attributions for the sources for the changes - (in much the same format as ado used, but the html tags have not been - checked, verified, or used in any way at all, so if there are errors there, - please let me know.) - - -Release data2011k - 2011-09-20 17:54:03 -0400 - - [not summarized] - - -Release data2011j - 2011-09-12 09:22:49 -0400 - - (contemporary changes for Samoa; past changes for Kenya, Uganda, and - Tanzania); there are also two spelling corrections to comments in - the australasia file (with thanks to Christos Zoulas). - - -Release 2011i - 2011-08-29 05:56:32 -0400 - - [not summarized] - - -Release data2011h - 2011-06-15 18:41:48 -0400 - - Russia and Curaçao changes - - -Release 2011g - 2011-04-25 09:07:22 -0400 - - update the rules for Egypt to reflect its abandonment of DST this year - - -Release 2011f - 2011-04-06 17:14:53 -0400 - - [not summarized] - - -Release 2011e - 2011-03-31 16:04:38 -0400 - - Morocco, Chile, and tz-link changes - - -Release 2011d - 2011-03-14 09:18:01 -0400 - - changes that impact present-day time stamps in Cuba, Samoa, and Turkey - - -Release 2011c - 2011-03-07 09:30:09 -0500 - - These do affect current time stamps in Chile and Annette Island, Canada. - - -Release 2011b - 2011-02-07 08:44:50 -0500 - - [not summarized] - - -Release 2011a - 2011-01-24 10:30:16 -0500 - - [not summarized] - - -Release data2010o - 2010-11-01 09:18:23 -0400 - - change to the end of DST in Fiji in 2011 - - -Release 2010n - 2010-10-25 08:19:17 -0400 - - [not summarized] - - -Release 2010m - 2010-09-27 09:24:48 -0400 - - Hong Kong, Vostok, and zic.c changes - - -Release 2010l - 2010-08-16 06:57:25 -0400 - - [not summarized] - - -Release 2010k - 2010-07-26 10:42:27 -0400 - - [not summarized] - - -Release 2010j - 2010-05-10 09:07:48 -0400 - - changes for Bahía de Banderas and for version naming - - -Release data2010i - 2010-04-16 18:50:45 -0400 - - the end of DST in Morocco on 2010-08-08 - - -Release data2010h - 2010-04-05 09:58:56 -0400 - - [not summarized] - - -Release data2010g - 2010-03-24 11:14:53 -0400 - - [not summarized] - - -Release 2010f - 2010-03-22 09:45:46 -0400 - - [not summarized] - - -Release data2010e - 2010-03-08 14:24:27 -0500 - - corrects the Dhaka bug found by Danvin Ruangchan - - -Release data2010d - 2010-03-06 07:26:01 -0500 - - [not summarized] - - -Release 2010c - 2010-03-01 09:20:58 -0500 - - changes including KRE's suggestion for earlier initialization of - "goahead" and "goback" structure elements - - -Release code2010a - 2010-02-16 10:40:04 -0500 - - [not summarized] - - -Release data2010b - 2010-01-20 12:37:01 -0500 - - Mexico changes - - -Release data2010a - 2010-01-18 08:30:04 -0500 - - changes to Dhaka - - -Release data2009u - 2009-12-26 08:32:28 -0500 - - changes to DST in Bangladesh - - -Release 2009t - 2009-12-21 13:24:27 -0500 - - [not summarized] - - -Release data2009s - 2009-11-14 10:26:32 -0500 - - (cosmetic) Antarctica change and the DST-in-Fiji-in-2009-and-2010 change - - -Release 2009r - 2009-11-09 10:10:31 -0500 - - "antarctica" and "tz-link.htm" changes - - -Release 2009q - 2009-11-02 09:12:40 -0500 - - with two corrections as reported by Eric Muller and Philip Newton - - -Release data2009p - 2009-10-23 15:05:27 -0400 - - Argentina (including San Luis) changes (with the correction from - Mariano Absatz) - - -Release data2009o - 2009-10-14 16:49:38 -0400 - - Samoa (commentary only), Pakistan, and Bangladesh changes - - -Release data2009n - 2009-09-22 15:13:38 -0400 - - added commentary for Argentina and a change to the end of DST in - 2009 in Pakistan - - -Release data2009m - 2009-09-03 10:23:43 -0400 - - Samoa and Palestine changes - - -Release data2009l - 2009-08-14 09:13:07 -0400 - - Samoa (comments only) and Egypt - - -Release 2009k - 2009-07-20 09:46:08 -0400 - - [not summarized] - - -Release data2009j - 2009-06-15 06:43:59 -0400 - - Bangladesh change (with a short turnaround since the DST change is - impending) - - -Release 2009i - 2009-06-08 09:21:22 -0400 - - updating for DST in Bangladesh this year - - -Release 2009h - 2009-05-26 09:19:14 -0400 - - [not summarized] - - -Release data2009g - 2009-04-20 16:34:07 -0400 - - Cairo - - -Release data2009f - 2009-04-10 11:00:52 -0400 - - correct DST in Pakistan - - -Release 2009e - 2009-04-06 09:08:11 -0400 - - [not summarized] - - -Release 2009d - 2009-03-23 09:38:12 -0400 - - Morocco, Tunisia, Argentina, and American Astronomical Society changes - - -Release data2009c - 2009-03-16 09:47:51 -0400 - - change to the start of Cuban DST - - -Release 2009b - 2009-02-09 11:15:22 -0500 - - [not summarized] - - -Release 2009a - 2009-01-21 10:09:39 -0500 - - [not summarized] - - -Release data2008i - 2008-10-21 12:10:25 -0400 - - southamerica and zone.tab files, with Argentina DST rule changes and - United States zone reordering and recommenting - - -Release 2008h - 2008-10-13 07:33:56 -0400 - - [not summarized] - - -Release 2008g - 2008-10-06 09:03:18 -0400 - - Fix a broken HTML anchor and update Brazil's DST transitions; - there's also a slight reordering of information in tz-art.htm. - - -Release data2008f - 2008-09-09 22:33:26 -0400 - - [not summarized] - - -Release 2008e - 2008-07-28 14:11:17 -0400 - - changes by Arthur David Olson and Jesper Nørgaard Welen - - -Release data2008d - 2008-07-07 09:51:38 -0400 - - changes by Arthur David Olson, Paul Eggert, and Rodrigo Severo - - -Release data2008c - 2008-05-19 17:48:03 -0400 - - Pakistan, Morocco, and Mongolia - - -Release data2008b - 2008-03-24 08:30:59 -0400 - - including renaming Asia/Calcutta to Asia/Kolkata, with a backward - link provided - - -Release 2008a - 2008-03-08 05:42:16 -0500 - - [not summarized] - - -Release 2007k - 2007-12-31 10:25:22 -0500 - - most importantly, changes to the "southamerica" file based on - Argentina's readoption of daylight saving time - - -Release 2007j - 2007-12-03 09:51:01 -0500 - - 1. eliminate the "P" (parameter) macro; - - 2. the "noncontroversial" changes circulated on the time zone - mailing list (less the changes to "logwtmp.c"); - - 3. eliminate "too many transition" errors when "min" is used in time - zone rules; - - 4. changes by Paul Eggert (including updated information for Venezuela). - - -Release data2007i - 2007-10-30 10:28:11 -0400 - - changes for Cuba and Syria - - -Release 2007h - 2007-10-01 10:05:51 -0400 - - changes by Paul Eggert, as well as an updated link to the ICU - project in tz-link.htm - - -Release 2007g - 2007-08-20 10:47:59 -0400 - - changes by Paul Eggert - - The "leapseconds" file has been updated to incorporate the most - recent International Earth Rotation and Reference Systems Service - (IERS) bulletin. - - There's an addition to tz-art.htm regarding the television show "Medium". - - -Release 2007f - 2007-05-07 10:46:46 -0400 - - changes by Paul Eggert (including Haiti, Turks and Caicos, and New - Zealand) - - changes to zic.c to allow hour values greater than 24 (along with - Paul's improved time value overflow checking) - - -Release 2007e - 2007-04-02 10:11:52 -0400 - - Syria and Honduras changes by Paul Eggert - - zic.c variable renaming changes by Arthur David Olson - - -Release 2007d - 2007-03-20 08:48:30 -0400 - - changes by Paul Eggert - - the elimination of white space at the ends of lines - - -Release 2007c - 2007-02-26 09:09:37 -0500 - - changes by Paul Eggert - - -Release 2007b - 2007-02-12 09:34:20 -0500 - - Paul Eggert's proposed change to the quotation handling logic in zic.c. - - changes to the commentary in "leapseconds" reflecting the IERS - announcement that there is to be no positive leap second at the end - of June 2007. - - -Release 2007a - 2007-01-08 12:28:29 -0500 - - changes by Paul Eggert - - Derick Rethan's Asmara change - - Oscar van Vlijmen's Easter Island local mean time change - - symbolic link changes - - -Release 2006p - 2006-11-27 08:54:27 -0500 - - changes by Paul Eggert - - -Release 2006o - 2006-11-06 09:18:07 -0500 - - changes by Paul Eggert - - -Release 2006n - 2006-10-10 11:32:06 -0400 - - changes by Paul Eggert - - -Release 2006m - 2006-10-02 15:32:35 -0400 - - changes for Uruguay, Palestine, and Egypt by Paul Eggert - - (minimalist) changes to zic.8 to clarify "until" information - - -Release data2006l - 2006-09-18 12:58:11 -0400 - - Paul's best-effort work on this coming weekend's Egypt time change - - -Release 2006k - 2006-08-28 12:19:09 -0400 - - changes by Paul Eggert - - -Release 2006j - 2006-08-21 09:56:32 -0400 - - changes by Paul Eggert - - -Release code2006i - 2006-08-07 12:30:55 -0400 - - localtime.c fixes - - Ken Pizzini's conversion script - - -Release code2006h - 2006-07-24 09:19:37 -0400 - - adds public domain notices to four files - - includes a fix for transition times being off by a second - - adds a new recording to the "arts" file (information courtesy Colin Bowern) - - -Release 2006g - 2006-05-08 17:18:09 -0400 - - northamerica changes by Paul Eggert - - -Release 2006f - 2006-05-01 11:46:00 -0400 - - a missing version number problem is fixed (with thanks to Bradley - White for catching the problem) - - -Release 2006d - 2006-04-17 14:33:43 -0400 - - changes by Paul Eggert - - added new items to tz-arts.htm that were found by Paul - - -Release 2006c - 2006-04-03 10:09:32 -0400 - - two sets of data changes by Paul Eggert - - a fencepost error fix in zic.c - - changes to zic.c and the "europe" file to minimize differences - between output produced by the old 32-bit zic and the new 64-bit - version - - -Release 2006b - 2006-02-20 10:08:18 -0500 - [tz32code2006b + tz64code2006b + tzdata2006b] - - 64-bit code - - All SCCS IDs were bumped to "8.1" for this release. - - -Release 2006a - 2006-01-30 08:59:31 -0500 - - changes by Paul Eggert (in particular, Indiana time zone moves) - - an addition to the zic manual page to describe how special-case - transitions are handled - - -Release 2005r - 2005-12-27 09:27:13 -0500 - - Canadian changes by Paul Eggert - - They also add "
    " directives to time zone data files and reflect
    -  changes to warning message logic in "zdump.c" (but with calls to
    -  "gettext" kept unbundled at the suggestion of Ken Pizzini).
    -
    -
    -Release 2005q - 2005-12-13 09:17:09 -0500
    -
    -  Nothing earth-shaking here:
    -	1.  Electronic mail addresses have been removed.
    -	2.  Casts of the return value of exit have been removed.
    -	3.  Casts of the argument of is.* macros have been added.
    -	4.  Indentation in one section of zic.c has been fixed.
    -	5.  References to dead URLs in the data files have been dealt with.
    -
    -
    -Release 2005p - 2005-12-05 10:30:53 -0500
    -
    -  "systemv", "tz-link.htm", and "zdump.c" changes
    -  (less the casts of arguments to the is* macros)
    -
    -
    -Release 2005o - 2005-11-28 10:55:26 -0500
    -
    -  Georgia, Cuba, Nicaragua, and Jordan changes by Paul Eggert
    -
    -  zdump.c lint fixes by Arthur David Olson
    -
    -
    -Release 2005n - 2005-10-03 09:44:09 -0400
    -
    -  changes by Paul Eggert (both the Uruguay changes and the Kyrgyzstan
    -  et al. changes)
    -
    -
    -Release 2005m - 2005-08-29 12:15:40 -0400
    -
    -  changes by Paul Eggert (with a small tweak to the tz-art change)
    -
    -  a declaration of an unused variable has been removed from zdump.c
    -
    -
    -Release 2005l - 2005-08-22 12:06:39 -0400
    -
    -  changes by Paul Eggert
    -
    -  overflow/underflow checks by Arthur David Olson, minus changes to
    -  the "Theory" file about the pending addition of 64-bit data (I grow
    -  less confident of the changes being accepted with each passing day,
    -  and the changes no longer increase the data files nine-fold--there's
    -  less than a doubling in size by my local Sun's reckoning)
    -
    -
    -Release 2005k - 2005-07-14 14:14:24 -0400
    -
    -  The "leapseconds" file has been edited to reflect the recently
    -  announced leap second at the end of 2005.
    -
    -  I've also deleted electronic mail addresses from the files as an
    -  anti-spam measure.
    -
    -
    -Release 2005j - 2005-06-13 14:34:13 -0400
    -
    -  These reflect changes to limit the length of time zone abbreviations
    -  and the characters used in those abbreviations.
    -
    -  There are also changes to handle POSIX-style "quoted" time zone
    -  environment variables.
    -
    -  The changes were circulated on the time zone mailing list; the only
    -  change since then was the removal of a couple of minimum-length of
    -  abbreviation checks.
    -
    -
    -Release data2005i - 2005-04-21 15:04:16 -0400
    -
    -  changes (most importantly to Nicaragua and Haiti) by Paul Eggert
    -
    -
    -Release 2005h - 2005-04-04 11:24:47 -0400
    -
    -  changes by Paul Eggert
    -
    -  minor changes to Makefile and zdump.c to produce more useful output
    -  when doing a "make typecheck"
    -
    -
    -Release 2005g - 2005-03-14 10:11:21 -0500
    -
    -  changes by Paul Eggert (a change to current DST rules in Uruguay and
    -  an update to a link to time zone software)
    -
    -
    -Release 2005f - 2005-03-01 08:45:32 -0500
    -
    -  data and documentation changes by Paul Eggert
    -
    -
    -Release 2005e - 2005-02-10 15:59:44 -0500
    -
    -  [not summarized]
    -
    -
    -Release code2005d - 2005-01-31 09:21:47 -0500
    -
    -  make zic complain about links to links if the -v flag is used
    -
    -  have "make public" do more code checking
    -
    -  add an include to "localtime.c" for the benefit of gcc systems
    -
    -
    -Release 2005c - 2005-01-17 18:36:29 -0500
    -
    -  get better results when mktime runs on a system where time_t is double
    -
    -  changes to the data files (most importantly to Paraguay)
    -
    -
    -Release 2005b - 2005-01-10 09:19:54 -0500
    -
    -  Get localtime and gmtime working on systems with exotic time_t types.
    -
    -  Update the leap second commentary in the "leapseconds" file.
    -
    -
    -Release 2005a - 2005-01-01 13:13:44 -0500
    -
    -  [not summarized]
    -
    -
    -Release code2004i - 2004-12-14 13:42:58 -0500
    -
    -  Deal with systems where time_t is unsigned.
    -
    -
    -Release code2004h - 2004-12-07 11:40:18 -0500
    -
    -  64-bit-time_t changes
    -
    -
    -Release 2004g - 2004-11-02 09:06:01 -0500
    -
    -  update to Cuba (taking effect this weekend)
    -
    -  other changes by Paul Eggert
    -
    -  correction of the spelling of Oslo
    -
    -  changed versions of difftime.c and private.h
    -
    -
    -Release code2004f - 2004-10-21 10:25:22 -0400
    -
    -  Cope with wide-ranging tm_year values.
    -
    -
    -Release 2004e - 2004-10-11 14:47:21 -0400
    -
    -  Brazil/Argentina/Israel changes by Paul Eggert
    -
    -  changes to tz-link.htm by Paul
    -
    -  one small fix to Makefile
    -
    -
    -Release 2004d - 2004-09-22 08:27:29 -0400
    -
    -  Avoid overflow problems when TM_YEAR_BASE is added to an integer.
    -
    -
    -Release 2004c - 2004-08-11 12:06:26 -0400
    -
    -  asctime-related changes
    -
    -  (variants of) some of the documentation changes suggested by Paul Eggert
    -
    -
    -Release 2004b - 2004-07-19 14:33:35 -0400
    -
    -  data changes by Paul Eggert - most importantly, updates for Argentina
    -
    -
    -Release 2004a - 2004-05-27 12:00:47 -0400
    -
    -  changes by Paul Eggert
    -
    -  Handle DST transitions that occur at the end of a month in some
    -  years but at the start of the following month in other years.
    -
    -  Add a copy of the correspondence that's the basis for claims about
    -  DST in the Navajo Nation.
    -
    -
    -Release 2003e - 2003-12-15 09:36:47 -0500
    -
    -  changes by Arthur David Olson (primarily code changes)
    -
    -  changes by Paul Eggert (primarily data changes)
    -
    -  minor changes to "Makefile" and "northamerica" (in the latter case,
    -  optimization of the "Toronto" rules)
    -
    -
    -Release 2003d - 2003-10-06 09:34:44 -0400
    -
    -  changes by Paul Eggert
    -
    -
    -Release 2003c - 2003-09-16 10:47:05 -0400
    -
    -  Fix bad returns in zic.c's inleap function.
    -  Thanks to Bradley White for catching the problem!
    -
    -
    -Release 2003b - 2003-09-16 07:13:44 -0400
    -
    -  Add a "--version" option (and documentation) to the zic and zdump commands.
    -
    -  changes to overflow/underflow checking in zic
    -
    -  a localtime typo fix.
    -
    -  Update the leapseconds and tz-art.htm files.
    -
    -
    -Release 2003a - 2003-03-24 09:30:54 -0500
    -
    -  changes by Paul Eggert
    -
    -  a few additions and modifications to the tz-art.htm file
    -
    -
    -Release 2002d - 2002-10-15 13:12:42 -0400
    -
    -  changes by Paul Eggert, less the "Britain (UK)" change in iso3166.tab
    -
    -  There's also a new time zone quote in "tz-art.htm".
    -
    -
    -Release 2002c - 2002-04-04 11:55:20 -0500
    -
    -  changes by Paul Eggert
    -
    -  Change zic.c to avoid creating symlinks to files that don't exist.
    -
    -
    -Release 2002b - 2002-01-28 12:56:03 -0500
    -
    -  [These change notes are for Release 2002a, which was corrupted.
    -  2002b was a corrected version of 2002a.]
    -
    -  changes by Paul Eggert
    -
    -  Update the "leapseconds" file to note that there'll be no leap
    -  second at the end of June, 2002.
    -
    -  Change "zic.c" to deal with a problem in handling the "Asia/Bishkek" zone.
    -
    -  Change to "difftime.c" to avoid sizeof problems.
    -
    -
    -Release 2001d - 2001-10-09 13:31:32 -0400
    -
    -  changes by Paul Eggert
    -
    -
    -Release 2001c - 2001-06-05 13:59:55 -0400
    -
    -  changes by Paul Eggert and Andrew Brown
    -
    -
    -Release 2001b - 2001-04-05 16:44:38 -0400
    -
    -  changes by Paul Eggert (modulo jnorgard's typo fix)
    -
    -  tz-art.htm has been HTMLified.
    -
    -
    -Release 2001a - 2001-03-13 12:57:44 -0500
    -
    -  changes by Paul Eggert
    -
    -  An addition to the "leapseconds" file: comments with the text of the
    -  latest IERS leap second notice.
    -
    -  Trailing white space has been removed from data file lines, and
    -  repeated spaces in "Rule Jordan" lines in the "asia" file have been
    -  converted to tabs.
    -
    -
    -Release 2000h - 2000-12-14 15:33:38 -0500
    -
    -  changes by Paul Eggert
    -
    -  one typo fix in the "art" file
    -
    -  With providence, this is the last update of the millennium.
    -
    -
    -Release 2000g - 2000-10-10 11:35:22 -0400
    -
    -  changes by Paul Eggert
    -
    -  correction of John Mackin's name submitted by Robert Elz
    -
    -  Garry Shandling's Daylight Saving Time joke (!?!) from the recent
    -  Emmy Awards broadcast.
    -
    -
    -Release 2000f - 2000-08-10 09:31:58 -0400
    -
    -  changes by Paul Eggert
    -
    -  Added information in "tz-art.htm" on a Seinfeld reference to DST.
    -
    -  Error checking and messages in the "yearistype" script have been
    -  improved.
    -
    -
    -Release 2000e - 2000-07-31 09:27:54 -0400
    -
    -  data changes by Paul Eggert
    -
    -  a change to the default value of the defined constant HAVE_STRERROR
    -
    -  the addition of a Dave Barry quote on DST to the tz-arts file
    -
    -
    -Release 2000d - 2000-04-20 15:43:04 -0400
    -
    -  changes to the documentation and code of strftime for C99 conformance
    -
    -  a bug fix for date.c
    -
    -  These are based on (though modified from) changes by Paul Eggert.
    -
    -
    -Release 2000c - 2000-03-04 10:31:43 -0500
    -
    -  changes by Paul Eggert
    -
    -
    -Release 2000b - 2000-02-21 12:16:29 -0500
    -
    -  changes by Paul Eggert and Joseph Myers
    -
    -  modest tweaks to the tz-art.htm and tz-link.htm files
    -
    -
    -Release 2000a - 2000-01-18 09:21:26 -0500
    -
    -  changes by Paul Eggert
    -
    -  The two hypertext documents have also been renamed.
    -
    -
    -Release code1999i-data1999j - 1999-11-15 18:43:22 -0500
    -
    -  Paul Eggert's changes
    -
    -  additions to the "zic" manual page and the "Arts.htm" file
    -
    -
    -Release code1999h-data1999i - 1999-11-08 14:55:21 -0500
    -
    -  [not summarized]
    -
    -
    -Release data1999h - 1999-10-07 03:50:29 -0400
    -
    -  changes by Paul Eggert to "europe" (most importantly, fixing
    -  Lithuania and Estonia)
    -
    -
    -Release 1999g - 1999-09-28 11:06:18 -0400
    -
    -  data changes by Paul Eggert (most importantly, the change for
    -  Lebanon that buys correctness for this coming Sunday)
    -
    -  The "code" file contains changes to "Makefile" and "checktab.awk" to
    -  allow better checking of time zone files before they are published.
    -
    -
    -Release 1999f - 1999-09-23 09:48:14 -0400
    -
    -  changes by Arthur David Olson and Paul Eggert
    -
    -
    -Release 1999e - 1999-08-17 15:20:54 -0400
    -
    -  changes circulated by Paul Eggert, although the change to handling
    -  of DST-specifying time zone names has been commented out for now
    -  (search for "XXX" in "localtime.c" for details).  These files also
    -  do not make any changes to the start of DST in Brazil.
    -
    -  In addition to Paul's changes, there are updates to "Arts.htm" and
    -  cleanups of URLs.
    -
    -
    -Release 1999d - 1999-03-30 11:31:07 -0500
    -
    -  changes by Paul Eggert
    -
    -  The Makefile's "make public" rule has also been changed to do a test
    -  compile of each individual time zone data file (which should help
    -  avoid problems such as the one we had with Nicosia).
    -
    -
    -Release 1999c - 1999-03-25 09:47:47 -0500
    -
    -  changes by Paul Eggert, most importantly the change for Chile.
    -
    -
    -Release 1999b - 1999-02-01 17:51:44 -0500
    -
    -  changes by Paul Eggert
    -
    -  code changes (suggested by Mani Varadarajan, mani at be.com) for
    -  correct handling of symbolic links when building using a relative directory
    -
    -  code changes to generate correct messages for failed links
    -
    -  updates to the URLs in Arts.htm
    -
    -
    -Release 1999a - 1999-01-19 16:20:29 -0500
    -
    -  error message internationalizations and corrections in zic.c and
    -  zdump.c (as suggested by Vladimir Michl, vladimir.michl at upol.cz,
    -  to whom thanks!)
    -
    -
    -Release code1998h-data1998i - 1998-10-01 09:56:10 -0400
    -
    -  changes for Brazil, Chile, and Germany
    -
    -  support for use of "24:00" in the input files for the time zone compiler
    -
    -
    -Release code1998g-data1998h - 1998-09-24 10:50:28 -0400
    -
    -  changes by Paul Eggert
    -
    -  correction to a define in the "private.h" file
    -
    -
    -Release data1998g - 1998-08-11 03:28:35 -0000
    -  [tzdata1998g.tar.gz is missing!]
    -
    -  Lithuanian change provided by mgedmin at pub.osf.it
    -
    -  Move creation of the GMT link with Etc/GMT to "etcetera" (from
    -  "backward") to ensure that the GMT file is created even where folks
    -  don't want the "backward" links (as suggested by Paul Eggert).
    -
    -
    -Release data1998f - 1998-07-20 13:50:00 -0000
    -  [tzdata1998f.tar.gz is missing!]
    -
    -  Update the "leapseconds" file to include the newly-announced
    -  insertion at the end of 1998.
    -
    -
    -Release code1998f - 1998-06-01 10:18:31 -0400
    -
    -  addition to localtime.c by Guy Harris
    -
    -
    -Release 1998e - 1998-05-28 09:56:26 -0400
    -
    -  The Makefile is changed to produce zoneinfo-posix rather than
    -  zoneinfo/posix, and to produce zoneinfo-leaps rather than
    -  zoneinfo/right.
    -
    -  data changes by Paul Eggert
    -
    -  changes from Guy Harris to provide asctime_r and ctime_r
    -
    -  A usno1998 file (substantially identical to usno1997) has been added.
    -
    -
    -Release 1998d - 1998-05-14 11:58:34 -0400
    -
    -  changes to comments (in particular, elimination of references to CIA maps).
    -  "Arts.htm", "WWW.htm", "asia", and "australasia" are the only places
    -  where changes occur.
    -
    -
    -Release 1998c - 1998-02-28 12:32:26 -0500
    -
    -  changes by Paul Eggert (save the "French correction," on which I'll
    -  wait for the dust to settle)
    -
    -  symlink changes
    -
    -  changes and additions to Arts.htm
    -
    -
    -Release 1998b - 1998-01-17 14:31:51 -0500
    -
    -  URL cleanups and additions
    -
    -
    -Release 1998a - 1998-01-13 12:37:35 -0500
    -
    -  changes by Paul Eggert
    -
    -
    -Release code1997i-data1997k - 1997-12-29 09:53:41 -0500
    -
    -  changes by Paul Eggert, with minor modifications from Arthur David
    -  Olson to make the files more browser friendly
    -
    -
    -Release code1997h-data1997j - 1997-12-18 17:47:35 -0500
    -
    -  minor changes to put "TZif" at the start of each time zone information file
    -
    -  a rule has also been added to the Makefile so you can
    -	make zones
    -  to just recompile the zone information files (rather than doing a
    -  full "make install" with its other effects).
    -
    -
    -Release data1997i - 1997-10-07 08:45:38 -0400
    -
    -  changes to Africa by Paul Eggert
    -
    -
    -Release code1997g-data1997h - 1997-09-04 16:56:54 -0400
    -
    -  corrections for Uruguay (and other locations)
    -
    -  Arthur David Olson's simple-minded fix allowing mktime to both
    -  correctly handle leap seconds and correctly handle tm_sec values
    -  upon which arithmetic has been performed.
    -
    -
    -Release code1997f-data1997g - 1997-07-19 13:15:02 -0400
    -
    -  Paul Eggert's updates
    -
    -  a small change to a function prototype;
    -
    -  "Music" has been renamed "Arts.htm", HTMLified, and augmented to
    -  include information on Around the World in Eighty Days.
    -
    -
    -Release code1997e-data1997f - 1997-05-03 18:52:34 -0400
    -
    -  fixes to zic's error handling
    -
    -  changes inspired by the item circulated on Slovenia
    -
    -  The description of Web resources has been HTMLified for browsing
    -  convenience.
    -
    -  A new piece of tz-related music has been added to the "Music" file.
    -
    -
    -Release code1997d-data1997e - 1997-03-29 12:48:52 -0500
    -
    -  Paul Eggert's latest suggestions
    -
    -
    -Release code1997c-data1997d - 1997-03-07 20:37:54 -0500
    -
    -  changes to "zic.c" to correct performance of the "-s" option
    -
    -  a new file "usno1997"
    -
    -
    -Release data1997c - 1997-03-04 09:58:18 -0500
    -
    -  changes in Israel
    -
    -
    -Release 1997b - 1997-02-27 18:34:19 -0500
    -
    -  The data file incorporates the 1997 leap second.
    -
    -  The code file incorporates Arthur David Olson's take on the
    -  zic/multiprocessor/directory-creation situation.
    -
    -
    -Release 1997a - 1997-01-21 09:11:10 -0500
    -
    -  Paul Eggert's Antarctica (and other changes)
    -
    -  Arthur David Olson finessed the "getopt" issue by checking against
    -  both -1 and EOF (regardless of POSIX, SunOS 4.1.1's manual says -1
    -  is returned while SunOS 5.5's manual says EOF is returned).
    -
    -
    -Release code1996o-data1996n - 1996-12-27 21:42:05 -0500
    -
    -  Paul Eggert's latest changes
    -
    -
    -Release code1996n - 1996-12-16 09:42:02 -0500
    -
    -  link snapping fix from Bruce Evans (via Garrett Wollman)
    -
    -
    -Release data1996m - 1996-11-24 02:37:34 -0000
    -  [tzdata1996m.tar.gz is missing!]
    -
    -  Paul Eggert's batch of changes
    -
    -
    -Release code1996m-data1996l - 1996-11-05 14:00:12 -0500
    -
    -  No functional changes here; the files have simply been changed to
    -  make more use of ISO style dates in comments. The names of the above
    -  files now include the year in full.
    -
    -
    -Release code96l - 1996-09-08 17:12:20 -0400
    -
    -  tzcode96k was missing a couple of pieces.
    -
    -
    -Release 96k - 1996-09-08 16:06:22 -0400
    -
    -  the latest round of changes from Paul Eggert
    -
    -  the recent Year 2000 material
    -
    -
    -Release code96j - 1996-07-30 13:18:53 -0400
    -
    -  Set sp->typecnt as suggested by Timothy Patrick Murphy.
    -
    -
    -Release code96i - 1996-07-27 20:11:35 -0400
    -
    -  Paul's suggested patch for strftime %V week numbers
    -
    -
    -Release data96i - 1996-07-01 18:13:04 -0400
    -
    -  "northamerica" and "europe" changes by Paul Eggert
    -
    -
    -Release code96h - 1996-06-05 08:02:21 -0400
    -
    -  fix for handling transitions specified in Universal Time
    -
    -  Some "public domain" notices have also been added.
    -
    -
    -Release code96g - 1996-05-16 14:00:26 -0400
    -
    -  fix for the simultaneous-DST-and-zone-change challenge
    -
    -
    -Release data96h - 1996-05-09 17:40:51 -0400
    -
    -  changes by Paul Eggert
    -
    -
    -Release code96f-data96g - 1996-05-03 03:09:59 -0000
    -  [tzcode96f.tar.gz + tzdata96g.tar.gz are both missing!]
    -
    -  The changes get us some of the way to fixing the problems noted in Paul
    -  Eggert's letter yesterday (in addition to a few others).  The approach
    -  has been to make zic a bit smarter about figuring out what time zone
    -  abbreviations apply just after the time specified in the "UNTIL" part
    -  of a zone line.  Putting the smarts in zic means avoiding having
    -  transition times show up in both "Zone" lines and "Rule" lines, which
    -  in turn avoids multiple transition time entries in time zone files.
    -  (This also makes the zic input files such as "europe" a bit shorter and
    -  should ease maintenance.)
    -
    -
    -Release data96f - 1996-04-19 19:20:03 -0000
    -  [tzdata96f.tar.gz is missing!]
    -
    -  The only changes are to the "northamerica" file; the time zone
    -  abbreviation for Denver is corrected to MST (and MDT), and the
    -  comments for Mexico have been updated.
    -
    -
    -Release data96e - 1996-03-19 17:37:26 -0500
    -
    -  Proposals by Paul Eggert, in particular the Portugal change that
    -  comes into play at the end of this month.
    -
    -
    -Release data96d - 1996-03-18 20:49:39 -0500
    -
    -  [not summarized]
    -
    -
    -Release code96e - 1996-02-29 15:43:27 -0000
    -  [tzcode96e.tar.gz is missing!]
    -
    -  internationalization changes and the fix to the documentation for strftime
    -
    -
    -Release code96d-data96c - 1996-02-12 11:05:27 -0500
    -
    -  The "code" file simply updates Bob Kridle's electronic address.
    -
    -  The "data" file updates rules for Mexico.
    -
    -
    -Release data96b - 1996-01-27 15:44:42 -0500
    -
    -  Kiribati change
    -
    -
    -Release code96c - 1996-01-16 16:58:15 -0500
    -
    -  leap-year streamlining and binary-search changes
    -
    -  fix to newctime.3
    -
    -
    -Release code96b - 1996-01-10 20:42:39 -0500
    -
    -  fixes and enhancements from Paul Eggert, including code that
    -  emulates the behavior of recent versions of the SunOS "date"
    -  command.
    -
    -
    -Release 96a - 1996-01-06 09:08:24 -0500
    -
    -  Israel updates
    -
    -  fixes to strftime.c for correct ISO 8601 week number generation,
    -  plus support for two new formats ('G' and 'g') to give ISO 8601 year
    -  numbers (which are not necessarily the same as calendar year numbers)
    -
    -
    -Release code95i-data95m - 1995-12-21 12:46:47 -0500
    -
    -  The latest revisions from Paul Eggert are included, the usno1995
    -  file has been updated, and a new file ("WWW") covering useful URLs
    -  has been added.
    -
    -
    -Release code95h-data95l - 1995-12-19 18:10:12 -0500
    -
    -  A simplification of a macro definition, a change to data for Sudan,
    -  and (for last minute shoppers) notes in the "Music" file on the CD
    -  "Old Man Time".
    -
    -
    -Release code95g-data95k - 1995-10-30 10:32:47 -0500
    -
    -  (slightly reformatted) 8-bit-clean proposed patch
    -
    -  minor patch: US/Eastern -> America/New_York
    -
    -  snapshot of the USNO's latest data ("usno1995")
    -
    -  some other minor cleanups
    -
    -
    -Release code95f-data95j - 1995-10-28 21:01:34 -0000
    -  [tzcode95f.tar.gz + tzdata95j.tar.gz are both missing!]
    -
    -  European cleanups
    -
    -  support for 64-bit time_t's
    -
    -  optimization in localtime.c
    -
    -
    -Release code95e - 1995-10-13 13:23:57 -0400
    -
    -  the mktime change to scan from future to past when trying to find time zone
    -  offsets
    -
    -
    -Release data95i - 1995-09-26 10:43:26 -0400
    -
    -  For Canada/Central, guess that the Sun customer's "one week too
    -  early" was just a approximation, and the true error is one month
    -  too early.  This is consistent with the rest of Canada.
    -
    -
    -Release data95h - 1995-09-21 11:26:48 -0400
    -
    -  latest changes from Paul Eggert
    -
    -
    -Release code95d - 1995-09-14 11:14:45 -0400
    -
    -  the addition of a "Music" file, which documents four recorded
    -  versions of the tune "Save That Time".
    -
    -
    -Release data95g - 1995-09-01 17:21:36 -0400
    -
    -  "yearistype" correction
    -
    -
    -Release data95f - 1995-08-28 20:46:56 -0400
    -
    -  Paul Eggert's change to the australasia file
    -
    -
    -Release data95e - 1995-07-08 18:02:34 -0400
    -
    -  The only change is a leap second at the end of this year.
    -  Thanks to Bradley White for forwarding news on the leap second.
    -
    -
    -Release data95d - 1995-07-03 13:26:22 -0400
    -
    -  Paul Eggert's changes
    -
    -
    -Release data95c - 1995-07-02 19:19:28 -0400
    -
    -  changes to "asia", "backward", "europe", and "southamerica"
    -  (read: northamericacentrics need not apply)
    -
    -
    -Release code95c - 1995-03-13 14:00:46 -0500
    -
    -  one-line fix for sign extension problems in detzcode
    -
    -
    -Release 95b - 1995-03-04 11:22:38 -0500
    -
    -  Minor changes in both:
    -
    -  The "code" file contains a workaround for the lack of "unistd.h" in
    -  Microsoft C++ version 7.
    -
    -  The "data" file contains a fixed "Link" for America/Shiprock.
    -
    -
    -Release 94h - 1994-12-10 12:51:14 -0500
    -
    -  The files:
    -
    -  *	incorporate the changes to "zdump" and "date" to make changes to
    -	the "TZ" environment variable permanent;
    -
    -  *	incorporate the table changes by Paul Eggert;
    -
    -  *	include (and document) support for universal time specifications in
    -	data files - but do not (yet) include use of this feature in the
    -	data files.
    -
    -  Think of this as "TZ Classic" - the software has been set up not to break if
    -  universal time shows up in its input, and data entries have been
    -  left as is so as not to break existing implementations.
    -
    -
    -Release data94f - 1994-08-20 12:56:09 -0400
    -
    -  (with thanks!) the latest data updates from Paul Eggert
    -
    -
    -Release data94e - 1994-06-04 13:13:53 -0400
    -
    -  [not summarized]
    -
    -
    -Release code94g - 1994-05-05 12:14:07 -0400
    -
    -  fix missing "optind.c" and a reference to it in the Makefile
    -
    -
    -Release code94f - 1994-05-05 13:00:33 -0000
    -  [tzcode94f.tar.gz is missing!]
    -
    -  changes to avoid overflow in difftime, as well as changes to cope
    -  with the 52/53 challenge in strftime
    -
    -
    -Release code94e - 1994-03-30 23:32:59 -0500
    -
    -  change for the benefit of PCTS
    -
    -
    -Release 94d - 1994-02-24 15:42:25 -0500
    -
    -  Avoid clashes with POSIX semantics for zones such as GMT+4.
    -
    -  Some other very minor housekeeping is also present.
    -
    -
    -Release code94c - 1994-02-10 08:52:40 -0500
    -
    -  Fix bug where mkdirs was broken unless you compile with
    -  -fwritable-strings (which is generally losing to do).
    -
    -
    -Release 94b - 1994-02-07 10:04:33 -0500
    -
    -  work by Paul Eggert who notes:
    -
    -  I found another book of time zone histories by E W Whitman; it's not
    -  as extensive as Shanks but has a few goodies of its own.  I used it
    -  to update the tables.  I also fixed some more as a result of
    -  correspondence with Adam David and Peter Ilieve, and move some stray
    -  links from 'europe' to 'backward'.  I corrected some scanning errors
    -  in usno1989.
    -
    -  As far as the code goes, I fixed zic to allow years in the range
    -  INT_MIN to INT_MAX; this fixed a few boundary conditions around 1900.
    -  And I cleaned up the zic documentation a little bit.
    -
    -
    -Release data94a - 1994-02-03 08:58:54 -0500
    -
    -  It simply incorporates the recently announced leap second into the
    -  "leapseconds" file.
    -
    -
    -Release 93g - 1993-11-22 17:28:27 -0500
    -
    -  Paul Eggert has provided a good deal of historic information (based
    -  on Shanks), and there are some code changes to deal with the buglets
    -  that crawled out in dealing with the new information.
    -
    -
    -Release 93f - 1993-10-15 12:27:46 -0400
    -
    -  Paul Eggert's changes
    -
    -
    -Release 93e - 1993-09-05 21:21:44 -0400
    -
    -  This has updated data for Israel, England, and Kwajalein.  There's
    -  also an update to "zdump" to cope with Kwajalein's 24-hour jump.
    -  Thanks to Paul Eggert and Peter Ilieve for the changes.
    -
    -
    -Release 93d - 1993-06-17 23:34:17 -0400
    -
    -  new fix and new data on Israel
    -
    -
    -Release 93c - 1993-06-06 19:31:55 -0400
    -
    -  [not summarized]
    -
    -
    -Release 93b - 1993-02-02 14:53:58 -0500
    -
    -  updated "leapseconds" file
    -
    -
    -Release 93 - 1993-01-08 07:01:06 -0500
    -
    -  At kre's suggestion, the package has been split in two - a code piece
    -  (which also includes documentation) that's only of use to folks who
    -  want to recompile things and a data piece useful to anyone who can
    -  run "zic".
    -
    -  The new version has a few changes to the data files, a few
    -  portability changes, and an off-by-one fix (with thanks to
    -  Tom Karzes at deshaw.com for providing a description and a
    -  solution).
    -
    -
    -Release 92c - 1992-11-21 17:35:36 -0000
    -  [tz92c.tar.Z is missing!]
    -
    -  The fallout from the latest round of DST transitions.
    -
    -  There are changes for Portugal, Saskatchewan, and "Pacific-New";
    -  there's also a change to "zic.c" that makes it portable to more systems.
    -
    -
    -Release 92 - 1992-04-25 18:17:03 -0000
    -  [tz92.tar.Z is missing!]
    -
    -  By popular demand (well, at any rate, following a request by kre at munnari)
    -
    -
    -The 1989 update of the time zone package featured:
    -
    -  *	POSIXization (including interpretation of POSIX-style TZ environment
    -	variables, provided by Guy Harris),
    -  *	ANSIfication (including versions of "mktime" and "difftime"),
    -  *	SVIDulation (an "altzone" variable)
    -  *	MACHination (the "gtime" function)
    -  *	corrections to some time zone data (including corrections to the rules
    -	for Great Britain and New Zealand)
    -  *	reference data from the United States Naval Observatory for folks who
    -	want to do additional time zones
    -  *	and the 1989 data for Saudi Arabia.
    -
    -  (Since this code will be treated as "part of the implementation" in some
    -  places and as "part of the application" in others, there's no good way to
    -  name functions, such as timegm, that are not part of the proposed ANSI C
    -  standard; such functions have kept their old, underscore-free names in this
    -  update.)
    -
    -  And the "dysize" function has disappeared; it was present to allow
    -  compilation of the "date" command on old BSD systems, and a version of "date"
    -  is now provided in the package.  The "date" command is not created when you
    -  "make all" since it may lack options provided by the version distributed with
    -  your operating system, or may not interact with the system in the same way
    -  the native version does.
    -
    -  Since POSIX frowns on correct leap second handling, the default behavior of
    -  the "zic" command (in the absence of a "-L" option) has been changed to omit
    -  leap second information from its output files.
    -
    -
    ------
    -Notes
    -
    -This file contains copies of the part of each release announcement
    -that talks about the changes in that release.  The text has been
    -adapted and reformatted for the purposes of this file.
    -
    -Typically a release R consists of a pair of tarball files,
    -tzcodeR.tar.gz and tzdataR.tar.gz.  However, some releases (e.g.,
    -code2010a, data2012c) consist of just one or the other tarball, and a
    -few (e.g., code2012c-data2012d) have tarballs with mixed version
    -numbers.
    -
    -Release time stamps are taken from the release's commit (for newer,
    -git releases), from the newest file in the tarball (for older
    -releases, where this info is available) or from the email announcing
    -the release (if all else fails; these are marked with a time zone of
    --0000 and an "is missing!" comment).
    -
    -Earlier versions of the code and data were not announced on the tz
    -list and are not summarized here.
    -
    -This file is in the public domain.
    -
    -Local Variables:
    -coding: utf-8
    -End:
    diff --git a/external/public-domain/tz/dist/README b/external/public-domain/tz/dist/README
    deleted file mode 100644
    index 06ef1d919..000000000
    --- a/external/public-domain/tz/dist/README
    +++ /dev/null
    @@ -1,61 +0,0 @@
    -README for the tz distribution
    -
    -"What time is it?" -- Richard Deacon as The King
    -"Any time you want it to be." -- Frank Baxter as The Scientist
    -					(from the Bell System film "About Time")
    -
    -The Time Zone Database (often called tz or zoneinfo) contains code and
    -data that represent the history of local time for many representative
    -locations around the globe.  It is updated periodically to reflect
    -changes made by political bodies to time zone boundaries, UTC offsets,
    -and daylight-saving rules.
    -
    -Unless otherwise specified, all files in the tz code and data are in
    -the public domain, so clarified as of 2009-05-17 by Arthur David Olson.
    -The few exceptions are code derived from BSD, which uses the BSD license.
    -
    -Here is a recipe for acquiring, building, installing, and testing the
    -tz distribution on a GNU/Linux or similar host.
    -
    -	mkdir tz
    -	cd tz
    -	wget --retr-symlinks 'ftp://ftp.iana.org/tz/tz*-latest.tar.gz'
    -	gzip -dc tzcode-latest.tar.gz | tar -xf -
    -	gzip -dc tzdata-latest.tar.gz | tar -xf -
    -
    -Be sure to read the comments in "Makefile" and make any changes needed
    -to make things right for your system, especially if you are using some
    -platform other than GNU/Linux.  Then run the following commands,
    -substituting your desired installation directory for "$HOME/tzdir":
    -
    -	make TOPDIR=$HOME/tzdir install
    -	$HOME/tzdir/etc/zdump -v America/Los_Angeles
    -
    -Historical local time information has been included here to:
    -
    -*	provide a compendium of data about the history of civil time
    -	that is useful even if not 100% accurate;
    -
    -*	give an idea of the variety of local time rules that have
    -	existed in the past and thus an idea of the variety that may be
    -	expected in the future;
    -
    -*	provide a test of the generality of the local time rule description
    -	system.
    -
    -The information in the time zone data files is by no means authoritative;
    -fixes and enhancements are welcome.  Please see the file CONTRIBUTING
    -for details.
    -
    -Thanks to these Time Zone Caballeros who've made major contributions to the
    -time conversion package: Keith Bostic; Bob Devine; Paul Eggert; Robert Elz;
    -Guy Harris; Mark Horton; John Mackin; and Bradley White.  Thanks also to
    -Michael Bloom, Art Neilson, Stephen Prince, John Sovereign, and Frank Wales
    -for testing work, and to Gwillim Law for checking local mean time data.
    -Thanks in particular to Arthur David Olson, the project's founder and first
    -maintainer, to whom the time zone community owes the greatest debt of all.
    -None of them are responsible for remaining errors.
    -
    -Look in  for updated versions of these files.
    -
    -Please send comments or information to tz@iana.org.
    diff --git a/external/public-domain/tz/dist/Theory b/external/public-domain/tz/dist/Theory
    deleted file mode 100644
    index 96cba5172..000000000
    --- a/external/public-domain/tz/dist/Theory
    +++ /dev/null
    @@ -1,790 +0,0 @@
    -Theory and pragmatics of the tz code and data
    -
    -
    ------ Outline -----
    -
    -	Scope of the tz database
    -	Names of time zone rules
    -	Time zone abbreviations
    -	Accuracy of the tz database
    -	Time and date functions
    -	Calendrical issues
    -	Time and time zones on Mars
    -
    -
    ------ Scope of the tz database -----
    -
    -The tz database attempts to record the history and predicted future of
    -all computer-based clocks that track civil time.  To represent this
    -data, the world is partitioned into regions whose clocks all agree
    -about time stamps that occur after the somewhat-arbitrary cutoff point
    -of the POSIX Epoch (1970-01-01 00:00:00 UTC).  For each such region,
    -the database records all known clock transitions, and labels the region
    -with a notable location.  Although 1970 is a somewhat-arbitrary
    -cutoff, there are significant challenges to moving the cutoff earlier
    -even by a decade or two, due to the wide variety of local practices
    -before computer timekeeping became prevalent.
    -
    -Clock transitions before 1970 are recorded for each such location,
    -because most systems support time stamps before 1970 and could
    -misbehave if data entries were omitted for pre-1970 transitions.
    -However, the database is not designed for and does not suffice for
    -applications requiring accurate handling of all past times everywhere,
    -as it would take far too much effort and guesswork to record all
    -details of pre-1970 civil timekeeping.
    -
    -As described below, reference source code for using the tz database is
    -also available.  The tz code is upwards compatible with POSIX, an
    -international standard for UNIX-like systems.  As of this writing, the
    -current edition of POSIX is:
    -
    -  The Open Group Base Specifications Issue 7
    -  IEEE Std 1003.1, 2013 Edition
    -  
    -
    -
    -
    ------ Names of time zone rules -----
    -
    -Each of the database's time zone rules has a unique name.
    -Inexperienced users are not expected to select these names unaided.
    -Distributors should provide documentation and/or a simple selection
    -interface that explains the names; for one example, see the 'tzselect'
    -program in the tz code.  The Unicode Common Locale Data Repository
    - contains data that may be useful for other
    -selection interfaces.
    -
    -The time zone rule naming conventions attempt to strike a balance
    -among the following goals:
    -
    - * Uniquely identify every region where clocks have agreed since 1970.
    -   This is essential for the intended use: static clocks keeping local
    -   civil time.
    -
    - * Indicate to experts where that region is.
    -
    - * Be robust in the presence of political changes.  For example, names
    -   of countries are ordinarily not used, to avoid incompatibilities
    -   when countries change their name (e.g. Zaire->Congo) or when
    -   locations change countries (e.g. Hong Kong from UK colony to
    -   China).
    -
    - * Be portable to a wide variety of implementations.
    -
    - * Use a consistent naming conventions over the entire world.
    -
    -Names normally have the form AREA/LOCATION, where AREA is the name
    -of a continent or ocean, and LOCATION is the name of a specific
    -location within that region.  North and South America share the same
    -area, 'America'.  Typical names are 'Africa/Cairo', 'America/New_York',
    -and 'Pacific/Honolulu'.
    -
    -Here are the general rules used for choosing location names,
    -in decreasing order of importance:
    -
    -	Use only valid POSIX file name components (i.e., the parts of
    -		names other than '/').  Do not use the file name
    -		components '.' and '..'.  Within a file name component,
    -		use only ASCII letters, '.', '-' and '_'.  Do not use
    -		digits, as that might create an ambiguity with POSIX
    -		TZ strings.  A file name component must not exceed 14
    -		characters or start with '-'.  E.g., prefer 'Brunei'
    -		to 'Bandar_Seri_Begawan'.  Exceptions: see the discussion
    -		of legacy names below.
    -	A name must not be empty, or contain '//', or start or end with '/'.
    -	Do not use names that differ only in case.  Although the reference
    -		implementation is case-sensitive, some other implementations
    -		are not, and they would mishandle names differing only in case.
    -	If one name A is an initial prefix of another name AB (ignoring case),
    -		then B must not start with '/', as a regular file cannot have
    -		the same name as a directory in POSIX.  For example,
    -		'America/New_York' precludes 'America/New_York/Bronx'.
    -	Uninhabited regions like the North Pole and Bouvet Island
    -		do not need locations, since local time is not defined there.
    -	There should typically be at least one name for each ISO 3166-1
    -		officially assigned two-letter code for an inhabited country
    -		or territory.
    -	If all the clocks in a region have agreed since 1970,
    -		don't bother to include more than one location
    -		even if subregions' clocks disagreed before 1970.
    -		Otherwise these tables would become annoyingly large.
    -	If a name is ambiguous, use a less ambiguous alternative;
    -		e.g. many cities are named San José and Georgetown, so
    -		prefer 'Costa_Rica' to 'San_Jose' and 'Guyana' to 'Georgetown'.
    -	Keep locations compact.  Use cities or small islands, not countries
    -		or regions, so that any future time zone changes do not split
    -		locations into different time zones.  E.g. prefer 'Paris'
    -		to 'France', since France has had multiple time zones.
    -	Use mainstream English spelling, e.g. prefer 'Rome' to 'Roma', and
    -		prefer 'Athens' to the Greek 'Αθήνα' or the Romanized 'Athína'.
    -		The POSIX file name restrictions encourage this rule.
    -	Use the most populous among locations in a zone,
    -		e.g. prefer 'Shanghai' to 'Beijing'.  Among locations with
    -		similar populations, pick the best-known location,
    -		e.g. prefer 'Rome' to 'Milan'.
    -	Use the singular form, e.g. prefer 'Canary' to 'Canaries'.
    -	Omit common suffixes like '_Islands' and '_City', unless that
    -		would lead to ambiguity.  E.g. prefer 'Cayman' to
    -		'Cayman_Islands' and 'Guatemala' to 'Guatemala_City',
    -		but prefer 'Mexico_City' to 'Mexico' because the country
    -		of Mexico has several time zones.
    -	Use '_' to represent a space.
    -	Omit '.' from abbreviations in names, e.g. prefer 'St_Helena'
    -		to 'St._Helena'.
    -	Do not change established names if they only marginally
    -		violate the above rules.  For example, don't change
    -		the existing name 'Rome' to 'Milan' merely because
    -		Milan's population has grown to be somewhat greater
    -		than Rome's.
    -	If a name is changed, put its old spelling in the 'backward' file.
    -		This means old spellings will continue to work.
    -
    -The file 'zone1970.tab' lists geographical locations used to name time
    -zone rules.  It is intended to be an exhaustive list of names for
    -geographic regions as described above; this is a subset of the names
    -in the data.  Although a 'zone1970.tab' location's longitude
    -corresponds to its LMT offset with one hour for every 15 degrees east
    -longitude, this relationship is not exact.
    -
    -Older versions of this package used a different naming scheme,
    -and these older names are still supported.
    -See the file 'backward' for most of these older names
    -(e.g., 'US/Eastern' instead of 'America/New_York').
    -The other old-fashioned names still supported are
    -'WET', 'CET', 'MET', and 'EET' (see the file 'europe').
    -
    -Older versions of this package defined legacy names that are
    -incompatible with the first rule of location names, but which are
    -still supported.  These legacy names are mostly defined in the file
    -'etcetera'.  Also, the file 'backward' defines the legacy names
    -'GMT0', 'GMT-0', 'GMT+0' and 'Canada/East-Saskatchewan', and the file
    -'northamerica' defines the legacy names 'EST5EDT', 'CST6CDT',
    -'MST7MDT', and 'PST8PDT'.
    -
    -Excluding 'backward' should not affect the other data.  If
    -'backward' is excluded, excluding 'etcetera' should not affect the
    -remaining data.
    -
    -
    ------ Time zone abbreviations -----
    -
    -When this package is installed, it generates time zone abbreviations
    -like 'EST' to be compatible with human tradition and POSIX.
    -Here are the general rules used for choosing time zone abbreviations,
    -in decreasing order of importance:
    -
    -	Use abbreviations that consist of three or more ASCII letters.
    -		Previous editions of this database also used characters like
    -		' ' and '?', but these characters have a special meaning to
    -		the shell and cause commands like
    -			set `date`
    -		to have unexpected effects.
    -		Previous editions of this rule required upper-case letters,
    -		but the Congressman who introduced Chamorro Standard Time
    -		preferred "ChST", so the rule has been relaxed.
    -
    -		This rule guarantees that all abbreviations could have
    -		been specified by a POSIX TZ string.  POSIX
    -		requires at least three characters for an
    -		abbreviation.  POSIX through 2000 says that an abbreviation
    -		cannot start with ':', and cannot contain ',', '-',
    -		'+', NUL, or a digit.  POSIX from 2001 on changes this
    -		rule to say that an abbreviation can contain only '-', '+',
    -		and alphanumeric characters from the portable character set
    -		in the current locale.  To be portable to both sets of
    -		rules, an abbreviation must therefore use only ASCII
    -		letters.
    -
    -	Use abbreviations that are in common use among English-speakers,
    -		e.g. 'EST' for Eastern Standard Time in North America.
    -		We assume that applications translate them to other languages
    -		as part of the normal localization process; for example,
    -		a French application might translate 'EST' to 'HNE'.
    -
    -	For zones whose times are taken from a city's longitude, use the
    -		traditional xMT notation, e.g. 'PMT' for Paris Mean Time.
    -		The only name like this in current use is 'GMT'.
    -
    -	Use 'LMT' for local mean time of locations before the introduction
    -		of standard time; see "Scope of the tz database".
    -
    -	If there is no common English abbreviation, use numeric offsets like
    -		-05 and +0830 that are generated by zic's %z notation.
    -
    -    [The remaining guidelines predate the introduction of %z.
    -    They are problematic as they mean tz data entries invent
    -    notation rather than record it.  These guidelines are now
    -    deprecated and the plan is to gradually move to %z for
    -    inhabited locations and to "-00" for uninhabited locations.]
    -
    -	If there is no common English abbreviation, abbreviate the English
    -		translation of the usual phrase used by native speakers.
    -		If this is not available or is a phrase mentioning the country
    -		(e.g. "Cape Verde Time"), then:
    -
    -		When a country is identified with a single or principal zone,
    -			append 'T' to the country's ISO	code, e.g. 'CVT' for
    -			Cape Verde Time.  For summer time append 'ST';
    -			for double summer time append 'DST'; etc.
    -		Otherwise, take the first three letters of an English place
    -			name identifying each zone and append 'T', 'ST', etc.
    -			as before; e.g. 'VLAST' for VLAdivostok Summer Time.
    -
    -	Use UT (with time zone abbreviation 'zzz') for locations while
    -		uninhabited.  The 'zzz' mnemonic is that these locations are,
    -		in some sense, asleep.
    -
    -Application writers should note that these abbreviations are ambiguous
    -in practice: e.g. 'CST' has a different meaning in China than
    -it does in the United States.  In new applications, it's often better
    -to use numeric UT offsets like '-0600' instead of time zone
    -abbreviations like 'CST'; this avoids the ambiguity.
    -
    -
    ------ Accuracy of the tz database -----
    -
    -The tz database is not authoritative, and it surely has errors.
    -Corrections are welcome and encouraged; see the file CONTRIBUTING.
    -Users requiring authoritative data should consult national standards
    -bodies and the references cited in the database's comments.
    -
    -Errors in the tz database arise from many sources:
    -
    - * The tz database predicts future time stamps, and current predictions
    -   will be incorrect after future governments change the rules.
    -   For example, if today someone schedules a meeting for 13:00 next
    -   October 1, Casablanca time, and tomorrow Morocco changes its
    -   daylight saving rules, software can mess up after the rule change
    -   if it blithely relies on conversions made before the change.
    -
    - * The pre-1970 entries in this database cover only a tiny sliver of how
    -   clocks actually behaved; the vast majority of the necessary
    -   information was lost or never recorded.  Thousands more zones would
    -   be needed if the tz database's scope were extended to cover even
    -   just the known or guessed history of standard time; for example,
    -   the current single entry for France would need to split into dozens
    -   of entries, perhaps hundreds.
    -
    - * Most of the pre-1970 data entries come from unreliable sources, often
    -   astrology books that lack citations and whose compilers evidently
    -   invented entries when the true facts were unknown, without
    -   reporting which entries were known and which were invented.
    -   These books often contradict each other or give implausible entries,
    -   and on the rare occasions when they are checked they are
    -   typically found to be incorrect.
    -
    - * For the UK the tz database relies on years of first-class work done by
    -   Joseph Myers and others; see .
    -   Other countries are not done nearly as well.
    -
    - * Sometimes, different people in the same city would maintain clocks
    -   that differed significantly.  Railway time was used by railroad
    -   companies (which did not always agree with each other),
    -   church-clock time was used for birth certificates, etc.
    -   Often this was merely common practice, but sometimes it was set by law.
    -   For example, from 1891 to 1911 the UT offset in France was legally
    -   0:09:21 outside train stations and 0:04:21 inside.
    -
    - * Although a named location in the tz database stands for the
    -   containing region, its pre-1970 data entries are often accurate for
    -   only a small subset of that region.  For example, Europe/London
    -   stands for the United Kingdom, but its pre-1847 times are valid
    -   only for locations that have London's exact meridian, and its 1847
    -   transition to GMT is known to be valid only for the L&NW and the
    -   Caledonian railways.
    -
    - * The tz database does not record the earliest time for which a zone's
    -   data entries are thereafter valid for every location in the region.
    -   For example, Europe/London is valid for all locations in its
    -   region after GMT was made the standard time, but the date of
    -   standardization (1880-08-02) is not in the tz database, other than
    -   in commentary.  For many zones the earliest time of validity is
    -   unknown.
    -
    - * The tz database does not record a region's boundaries, and in many
    -   cases the boundaries are not known.  For example, the zone
    -   America/Kentucky/Louisville represents a region around the city of
    -   Louisville, the boundaries of which are unclear.
    -
    - * Changes that are modeled as instantaneous transitions in the tz
    -   database were often spread out over hours, days, or even decades.
    -
    - * Even if the time is specified by law, locations sometimes
    -   deliberately flout the law.
    -
    - * Early timekeeping practices, even assuming perfect clocks, were
    -   often not specified to the accuracy that the tz database requires.
    -
    - * Sometimes historical timekeeping was specified more precisely
    -   than what the tz database can handle.  For example, from 1909 to
    -   1937 Netherlands clocks were legally UT+00:19:32.13, but the tz
    -   database cannot represent the fractional second.
    -
    - * Even when all the timestamp transitions recorded by the tz database
    -   are correct, the tz rules that generate them may not faithfully
    -   reflect the historical rules.  For example, from 1922 until World
    -   War II the UK moved clocks forward the day following the third
    -   Saturday in April unless that was Easter, in which case it moved
    -   clocks forward the previous Sunday.  Because the tz database has no
    -   way to specify Easter, these exceptional years are entered as
    -   separate tz Rule lines, even though the legal rules did not change.
    -
    - * The tz database models pre-standard time using the proleptic Gregorian
    -   calendar and local mean time (LMT), but many people used other
    -   calendars and other timescales.  For example, the Roman Empire used
    -   the Julian calendar, and had 12 varying-length daytime hours with a
    -   non-hour-based system at night.
    -
    - * Early clocks were less reliable, and data entries do not represent
    -   this unreliability.
    -
    - * As for leap seconds, civil time was not based on atomic time before
    -   1972, and we don't know the history of earth's rotation accurately
    -   enough to map SI seconds to historical solar time to more than
    -   about one-hour accuracy.  See: Morrison LV, Stephenson FR.
    -   Historical values of the Earth's clock error Delta T and the
    -   calculation of eclipses. J Hist Astron. 2004;35:327-36
    -   ;
    -   Historical values of the Earth's clock error. J Hist Astron. 2005;36:339
    -   .
    -
    - * The relationship between POSIX time (that is, UTC but ignoring leap
    -   seconds) and UTC is not agreed upon after 1972.  Although the POSIX
    -   clock officially stops during an inserted leap second, at least one
    -   proposed standard has it jumping back a second instead; and in
    -   practice POSIX clocks more typically either progress glacially during
    -   a leap second, or are slightly slowed while near a leap second.
    -
    - * The tz database does not represent how uncertain its information is.
    -   Ideally it would contain information about when data entries are
    -   incomplete or dicey.  Partial temporal knowledge is a field of
    -   active research, though, and it's not clear how to apply it here.
    -
    -In short, many, perhaps most, of the tz database's pre-1970 and future
    -time stamps are either wrong or misleading.  Any attempt to pass the
    -tz database off as the definition of time should be unacceptable to
    -anybody who cares about the facts.  In particular, the tz database's
    -LMT offsets should not be considered meaningful, and should not prompt
    -creation of zones merely because two locations differ in LMT or
    -transitioned to standard time at different dates.
    -
    -
    ------ Time and date functions -----
    -
    -The tz code contains time and date functions that are upwards
    -compatible with those of POSIX.
    -
    -POSIX has the following properties and limitations.
    -
    -*	In POSIX, time display in a process is controlled by the
    -	environment variable TZ.  Unfortunately, the POSIX TZ string takes
    -	a form that is hard to describe and is error-prone in practice.
    -	Also, POSIX TZ strings can't deal with other (for example, Israeli)
    -	daylight saving time rules, or situations where more than two
    -	time zone abbreviations are used in an area.
    -
    -	The POSIX TZ string takes the following form:
    -
    -		stdoffset[dst[offset][,date[/time],date[/time]]]
    -
    -	where:
    -
    -	std and dst
    -		are 3 or more characters specifying the standard
    -		and daylight saving time (DST) zone names.
    -		Starting with POSIX.1-2001, std and dst may also be
    -		in a quoted form like ""; this allows
    -		"+" and "-" in the names.
    -	offset
    -		is of the form '[+-]hh:[mm[:ss]]' and specifies the
    -		offset west of UT.  'hh' may be a single digit; 0<=hh<=24.
    -		The default DST offset is one hour ahead of standard time.
    -	date[/time],date[/time]
    -		specifies the beginning and end of DST.  If this is absent,
    -		the system supplies its own rules for DST, and these can
    -		differ from year to year; typically US DST rules are used.
    -	time
    -		takes the form 'hh:[mm[:ss]]' and defaults to 02:00.
    -		This is the same format as the offset, except that a
    -		leading '+' or '-' is not allowed.
    -	date
    -		takes one of the following forms:
    -		Jn (1<=n<=365)
    -			origin-1 day number not counting February 29
    -		n (0<=n<=365)
    -			origin-0 day number counting February 29 if present
    -		Mm.n.d (0[Sunday]<=d<=6[Saturday], 1<=n<=5, 1<=m<=12)
    -			for the dth day of week n of month m of the year,
    -			where week 1 is the first week in which day d appears,
    -			and '5' stands for the last week in which day d appears
    -			(which may be either the 4th or 5th week).
    -			Typically, this is the only useful form;
    -			the n and Jn forms are rarely used.
    -
    -	Here is an example POSIX TZ string, for US Pacific time using rules
    -	appropriate from 1987 through 2006:
    -
    -		TZ='PST8PDT,M4.1.0/02:00,M10.5.0/02:00'
    -
    -	This POSIX TZ string is hard to remember, and mishandles time stamps
    -	before 1987 and after 2006.  With this package you can use this
    -	instead:
    -
    -		TZ='America/Los_Angeles'
    -
    -*	POSIX does not define the exact meaning of TZ values like "EST5EDT".
    -	Typically the current US DST rules are used to interpret such values,
    -	but this means that the US DST rules are compiled into each program
    -	that does time conversion.  This means that when US time conversion
    -	rules change (as in the United States in 1987), all programs that
    -	do time conversion must be recompiled to ensure proper results.
    -
    -*	In POSIX, there's no tamper-proof way for a process to learn the
    -	system's best idea of local wall clock.  (This is important for
    -	applications that an administrator wants used only at certain times -
    -	without regard to whether the user has fiddled the "TZ" environment
    -	variable.  While an administrator can "do everything in UTC" to get
    -	around the problem, doing so is inconvenient and precludes handling
    -	daylight saving time shifts - as might be required to limit phone
    -	calls to off-peak hours.)
    -
    -*	POSIX requires that systems ignore leap seconds.
    -
    -*	The tz code attempts to support all the time_t implementations
    -	allowed by POSIX.  The time_t type represents a nonnegative count of
    -	seconds since 1970-01-01 00:00:00 UTC, ignoring leap seconds.
    -	In practice, time_t is usually a signed 64- or 32-bit integer; 32-bit
    -	signed time_t values stop working after 2038-01-19 03:14:07 UTC, so
    -	new implementations these days typically use a signed 64-bit integer.
    -	Unsigned 32-bit integers are used on one or two platforms,
    -	and 36-bit and 40-bit integers are also used occasionally.
    -	Although earlier POSIX versions allowed time_t to be a
    -	floating-point type, this was not supported by any practical
    -	systems, and POSIX.1-2013 and the tz code both require time_t
    -	to be an integer type.
    -
    -These are the extensions that have been made to the POSIX functions:
    -
    -*	The "TZ" environment variable is used in generating the name of a file
    -	from which time zone information is read (or is interpreted a la
    -	POSIX); "TZ" is no longer constrained to be a three-letter time zone
    -	name followed by a number of hours and an optional three-letter
    -	daylight time zone name.  The daylight saving time rules to be used
    -	for a particular time zone are encoded in the time zone file;
    -	the format of the file allows U.S., Australian, and other rules to be
    -	encoded, and allows for situations where more than two time zone
    -	abbreviations are used.
    -
    -	It was recognized that allowing the "TZ" environment variable to
    -	take on values such as "America/New_York" might cause "old" programs
    -	(that expect "TZ" to have a certain form) to operate incorrectly;
    -	consideration was given to using some other environment variable
    -	(for example, "TIMEZONE") to hold the string used to generate the
    -	time zone information file name.  In the end, however, it was decided
    -	to continue using "TZ": it is widely used for time zone purposes;
    -	separately maintaining both "TZ" and "TIMEZONE" seemed a nuisance;
    -	and systems where "new" forms of "TZ" might cause problems can simply
    -	use TZ values such as "EST5EDT" which can be used both by
    -	"new" programs (a la POSIX) and "old" programs (as zone names and
    -	offsets).
    -
    -*	To handle places where more than two time zone abbreviations are used,
    -	the functions "localtime" and "gmtime" set tzname[tmp->tm_isdst]
    -	(where "tmp" is the value the function returns) to the time zone
    -	abbreviation to be used.  This differs from POSIX, where the elements
    -	of tzname are only changed as a result of calls to tzset.
    -
    -*	Since the "TZ" environment variable can now be used to control time
    -	conversion, the "daylight" and "timezone" variables are no longer
    -	needed.  (These variables are defined and set by "tzset"; however, their
    -	values will not be used by "localtime.")
    -
    -*	The "localtime" function has been set up to deliver correct results
    -	for near-minimum or near-maximum time_t values.  (A comment in the
    -	source code tells how to get compatibly wrong results).
    -
    -*	A function "tzsetwall" has been added to arrange for the system's
    -	best approximation to local wall clock time to be delivered by
    -	subsequent calls to "localtime."  Source code for portable
    -	applications that "must" run on local wall clock time should call
    -	"tzsetwall();" if such code is moved to "old" systems that don't
    -	provide tzsetwall, you won't be able to generate an executable program.
    -	(These time zone functions also arrange for local wall clock time to be
    -	used if tzset is called - directly or indirectly - and there's no "TZ"
    -	environment variable; portable applications should not, however, rely
    -	on this behavior since it's not the way SVR2 systems behave.)
    -
    -*	Negative time_t values are supported, on systems where time_t is signed.
    -
    -*	These functions can account for leap seconds, thanks to Bradley White.
    -
    -Points of interest to folks with other systems:
    -
    -*	This package is already part of many POSIX-compliant hosts,
    -	including BSD, HP, Linux, Network Appliance, SCO, SGI, and Sun.
    -	On such hosts, the primary use of this package
    -	is to update obsolete time zone rule tables.
    -	To do this, you may need to compile the time zone compiler
    -	'zic' supplied with this package instead of using the system 'zic',
    -	since the format of zic's input changed slightly in late 1994,
    -	and many vendors still do not support the new input format.
    -
    -*	The UNIX Version 7 "timezone" function is not present in this package;
    -	it's impossible to reliably map timezone's arguments (a "minutes west
    -	of GMT" value and a "daylight saving time in effect" flag) to a
    -	time zone abbreviation, and we refuse to guess.
    -	Programs that in the past used the timezone function may now examine
    -	tzname[localtime(&clock)->tm_isdst] to learn the correct time
    -	zone abbreviation to use.  Alternatively, use
    -	localtime(&clock)->tm_zone if this has been enabled.
    -
    -*	The 4.2BSD gettimeofday function is not used in this package.
    -	This formerly let users obtain the current UTC offset and DST flag,
    -	but this functionality was removed in later versions of BSD.
    -
    -*	In SVR2, time conversion fails for near-minimum or near-maximum
    -	time_t values when doing conversions for places that don't use UT.
    -	This package takes care to do these conversions correctly.
    -
    -The functions that are conditionally compiled if STD_INSPIRED is defined
    -should, at this point, be looked on primarily as food for thought.  They are
    -not in any sense "standard compatible" - some are not, in fact, specified in
    -*any* standard.  They do, however, represent responses of various authors to
    -standardization proposals.
    -
    -Other time conversion proposals, in particular the one developed by folks at
    -Hewlett Packard, offer a wider selection of functions that provide capabilities
    -beyond those provided here.  The absence of such functions from this package
    -is not meant to discourage the development, standardization, or use of such
    -functions.  Rather, their absence reflects the decision to make this package
    -contain valid extensions to POSIX, to ensure its broad acceptability.  If
    -more powerful time conversion functions can be standardized, so much the
    -better.
    -
    -
    ------ Calendrical issues -----
    -
    -Calendrical issues are a bit out of scope for a time zone database,
    -but they indicate the sort of problems that we would run into if we
    -extended the time zone database further into the past.  An excellent
    -resource in this area is Nachum Dershowitz and Edward M. Reingold,
    -Calendrical Calculations: Third Edition, Cambridge University Press (2008)
    -.
    -Other information and sources are given below.  They sometimes disagree.
    -
    -
    -France
    -
    -Gregorian calendar adopted 1582-12-20.
    -French Revolutionary calendar used 1793-11-24 through 1805-12-31,
    -and (in Paris only) 1871-05-06 through 1871-05-23.
    -
    -
    -Russia
    -
    -From Chris Carrier (1996-12-02):
    -On 1929-10-01 the Soviet Union instituted an "Eternal Calendar"
    -with 30-day months plus 5 holidays, with a 5-day week.
    -On 1931-12-01 it changed to a 6-day week; in 1934 it reverted to the
    -Gregorian calendar while retaining the 6-day week; on 1940-06-27 it
    -reverted to the 7-day week.  With the 6-day week the usual days
    -off were the 6th, 12th, 18th, 24th and 30th of the month.
    -(Source: Evitiar Zerubavel, _The Seven Day Circle_)
    -
    -
    -Mark Brader reported a similar story in "The Book of Calendars", edited
    -by Frank Parise (1982, Facts on File, ISBN 0-8719-6467-8), page 377.  But:
    -
    -From: Petteri Sulonen (via Usenet)
    -Date: 14 Jan 1999 00:00:00 GMT
    -...
    -
    -If your source is correct, how come documents between 1929 and 1940 were
    -still dated using the conventional, Gregorian calendar?
    -
    -I can post a scan of a document dated December 1, 1934, signed by
    -Yenukidze, the secretary, on behalf of Kalinin, the President of the
    -Executive Committee of the Supreme Soviet, if you like.
    -
    -
    -
    -Sweden (and Finland)
    -
    -From: Mark Brader
    -Subject: Re: Gregorian reform - a part of locale?
    -
    -Date: 1996-07-06
    -
    -In 1700, Denmark made the transition from Julian to Gregorian.  Sweden
    -decided to *start* a transition in 1700 as well, but rather than have one of
    -those unsightly calendar gaps :-), they simply decreed that the next leap
    -year after 1696 would be in 1744 - putting the whole country on a calendar
    -different from both Julian and Gregorian for a period of 40 years.
    -
    -However, in 1704 something went wrong and the plan was not carried through;
    -they did, after all, have a leap year that year.  And one in 1708.  In 1712
    -they gave it up and went back to Julian, putting 30 days in February that
    -year!...
    -
    -Then in 1753, Sweden made the transition to Gregorian in the usual manner,
    -getting there only 13 years behind the original schedule.
    -
    -(A previous posting of this story was challenged, and Swedish readers
    -produced the following references to support it: "Tideräkning och historia"
    -by Natanael Beckman (1924) and "Tid, en bok om tideräkning och
    -kalenderväsen" by Lars-Olof Lodén (1968).
    -
    -
    -Grotefend's data
    -
    -From: "Michael Palmer" [with one obvious typo fixed]
    -Subject: Re: Gregorian Calendar (was Re: Another FHC related question
    -Newsgroups: soc.genealogy.german
    -Date: Tue, 9 Feb 1999 02:32:48 -800
    -...
    -
    -The following is a(n incomplete) listing, arranged chronologically, of
    -European states, with the date they converted from the Julian to the
    -Gregorian calendar:
    -
    -04/15 Oct 1582 - Italy (with exceptions), Spain, Portugal, Poland (Roman
    -                 Catholics and Danzig only)
    -09/20 Dec 1582 - France, Lorraine
    -
    -21 Dec 1582/
    -   01 Jan 1583 - Holland, Brabant, Flanders, Hennegau
    -10/21 Feb 1583 - bishopric of Liege (Lüttich)
    -13/24 Feb 1583 - bishopric of Augsburg
    -04/15 Oct 1583 - electorate of Trier
    -05/16 Oct 1583 - Bavaria, bishoprics of Freising, Eichstedt, Regensburg,
    -                 Salzburg, Brixen
    -13/24 Oct 1583 - Austrian Oberelsaß and Breisgau
    -20/31 Oct 1583 - bishopric of Basel
    -02/13 Nov 1583 - duchy of Jülich-Berg
    -02/13 Nov 1583 - electorate and city of Köln
    -04/15 Nov 1583 - bishopric of Würzburg
    -11/22 Nov 1583 - electorate of Mainz
    -16/27 Nov 1583 - bishopric of Strassburg and the margraviate of Baden
    -17/28 Nov 1583 - bishopric of Münster and duchy of Cleve
    -14/25 Dec 1583 - Steiermark
    -
    -06/17 Jan 1584 - Austria and Bohemia
    -11/22 Jan 1584 - Lucerne, Uri, Schwyz, Zug, Freiburg, Solothurn
    -12/23 Jan 1584 - Silesia and the Lausitz
    -22 Jan/
    -   02 Feb 1584 - Hungary (legally on 21 Oct 1587)
    -      Jun 1584 - Unterwalden
    -01/12 Jul 1584 - duchy of Westfalen
    -
    -16/27 Jun 1585 - bishopric of Paderborn
    -
    -14/25 Dec 1590 - Transylvania
    -
    -22 Aug/
    -   02 Sep 1612 - duchy of Prussia
    -
    -13/24 Dec 1614 - Pfalz-Neuburg
    -
    -          1617 - duchy of Kurland (reverted to the Julian calendar in
    -                 1796)
    -
    -          1624 - bishopric of Osnabrück
    -
    -          1630 - bishopric of Minden
    -
    -15/26 Mar 1631 - bishopric of Hildesheim
    -
    -          1655 - Kanton Wallis
    -
    -05/16 Feb 1682 - city of Strassburg
    -
    -18 Feb/
    -   01 Mar 1700 - Protestant Germany (including Swedish possessions in
    -                 Germany), Denmark, Norway
    -30 Jun/
    -   12 Jul 1700 - Gelderland, Zutphen
    -10 Nov/
    -   12 Dec 1700 - Utrecht, Overijssel
    -
    -31 Dec 1700/
    -   12 Jan 1701 - Friesland, Groningen, Zürich, Bern, Basel, Geneva,
    -                 Turgau, and Schaffhausen
    -
    -          1724 - Glarus, Appenzell, and the city of St. Gallen
    -
    -01 Jan 1750    - Pisa and Florence
    -
    -02/14 Sep 1752 - Great Britain
    -
    -17 Feb/
    -   01 Mar 1753 - Sweden
    -
    -1760-1812      - Graubünden
    -
    -The Russian empire (including Finland and the Baltic states) did not
    -convert to the Gregorian calendar until the Soviet revolution of 1917.
    -
    -Source: H. Grotefend, _Taschenbuch der Zeitrechnung des deutschen
    -Mittelalters und der Neuzeit_, herausgegeben von Dr. O. Grotefend
    -(Hannover: Hahnsche Buchhandlung, 1941), pp. 26-28.
    -
    -
    ------ Time and time zones on Mars -----
    -
    -Some people's work schedules use Mars time.  Jet Propulsion Laboratory
    -(JPL) coordinators have kept Mars time on and off at least since 1997
    -for the Mars Pathfinder mission.  Some of their family members have
    -also adapted to Mars time.  Dozens of special Mars watches were built
    -for JPL workers who kept Mars time during the Mars Exploration
    -Rovers mission (2004).  These timepieces look like normal Seikos and
    -Citizens but use Mars seconds rather than terrestrial seconds.
    -
    -A Mars solar day is called a "sol" and has a mean period equal to
    -about 24 hours 39 minutes 35.244 seconds in terrestrial time.  It is
    -divided into a conventional 24-hour clock, so each Mars second equals
    -about 1.02749125 terrestrial seconds.
    -
    -The prime meridian of Mars goes through the center of the crater
    -Airy-0, named in honor of the British astronomer who built the
    -Greenwich telescope that defines Earth's prime meridian.  Mean solar
    -time on the Mars prime meridian is called Mars Coordinated Time (MTC).
    -
    -Each landed mission on Mars has adopted a different reference for
    -solar time keeping, so there is no real standard for Mars time zones.
    -For example, the Mars Exploration Rover project (2004) defined two
    -time zones "Local Solar Time A" and "Local Solar Time B" for its two
    -missions, each zone designed so that its time equals local true solar
    -time at approximately the middle of the nominal mission.  Such a "time
    -zone" is not particularly suited for any application other than the
    -mission itself.
    -
    -Many calendars have been proposed for Mars, but none have achieved
    -wide acceptance.  Astronomers often use Mars Sol Date (MSD) which is a
    -sequential count of Mars solar days elapsed since about 1873-12-29
    -12:00 GMT.
    -
    -The tz database does not currently support Mars time, but it is
    -documented here in the hopes that support will be added eventually.
    -
    -Sources:
    -
    -Michael Allison and Robert Schmunk,
    -"Technical Notes on Mars Solar Time as Adopted by the Mars24 Sunclock"
    - (2012-08-08).
    -
    -Jia-Rui Chong, "Workdays Fit for a Martian", Los Angeles Times
    -
    -(2004-01-14), pp A1, A20-A21.
    -
    -Tom Chmielewski, "Jet Lag Is Worse on Mars", The Atlantic (2015-02-26)
    -
    -
    ------
    -
    -This file is in the public domain, so clarified as of 2009-05-17 by
    -Arthur David Olson.
    -
    ------
    -Local Variables:
    -coding: utf-8
    -End:
    diff --git a/external/public-domain/tz/dist/africa b/external/public-domain/tz/dist/africa
    deleted file mode 100644
    index f20d21602..000000000
    --- a/external/public-domain/tz/dist/africa
    +++ /dev/null
    @@ -1,1182 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# This file is by no means authoritative; if you think you know better,
    -# go ahead and edit the file (and please send any changes to
    -# tz@iana.org for general use in the future).  For more, please see
    -# the file CONTRIBUTING in the tz distribution.
    -
    -# From Paul Eggert (2014-10-31):
    -#
    -# Unless otherwise specified, the source for data through 1990 is:
    -# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
    -# San Diego: ACS Publications, Inc. (2003).
    -# Unfortunately this book contains many errors and cites no sources.
    -#
    -# Gwillim Law writes that a good source
    -# for recent time zone data is the International Air Transport
    -# Association's Standard Schedules Information Manual (IATA SSIM),
    -# published semiannually.  Law sent in several helpful summaries
    -# of the IATA's data after 1990.  Except where otherwise noted,
    -# IATA SSIM is the source for entries after 1990.
    -#
    -# Another source occasionally used is Edward W. Whitman, World Time Differences,
    -# Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
    -# I found in the UCLA library.
    -#
    -# For data circa 1899, a common source is:
    -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
    -# http://www.jstor.org/stable/1774359
    -#
    -# A reliable and entertaining source about time zones is
    -# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
    -#
    -# Previous editions of this database used WAT, CAT, SAT, and EAT
    -# for +0:00 through +3:00, respectively,
    -# but Mark R V Murray reports that
    -# 'SAST' is the official abbreviation for +2:00 in the country of South Africa,
    -# 'CAT' is commonly used for +2:00 in countries north of South Africa, and
    -# 'WAT' is probably the best name for +1:00, as the common phrase for
    -# the area that includes Nigeria is "West Africa".
    -# He has heard of "Western Sahara Time" for +0:00 but can find no reference.
    -#
    -# To make things confusing, 'WAT' seems to have been used for -1:00 long ago;
    -# I'd guess that this was because people needed _some_ name for -1:00,
    -# and at the time, far west Africa was the only major land area in -1:00.
    -# This usage is now obsolete, as the last use of -1:00 on the African
    -# mainland seems to have been 1976 in Western Sahara.
    -#
    -# To summarize, the following abbreviations seem to have some currency:
    -#	-1:00	WAT	West Africa Time (no longer used)
    -#	 0:00	GMT	Greenwich Mean Time
    -#	 2:00	CAT	Central Africa Time
    -#	 2:00	SAST	South Africa Standard Time
    -# and Murray suggests the following abbreviation:
    -#	 1:00	WAT	West Africa Time
    -# I realize that this leads to 'WAT' being used for both -1:00 and 1:00
    -# for times before 1976, but this is the best I can think of
    -# until we get more information.
    -#
    -# I invented the following abbreviations; corrections are welcome!
    -#	 2:00	WAST	West Africa Summer Time
    -#	 2:30	BEAT	British East Africa Time (no longer used)
    -#	 2:45	BEAUT	British East Africa Unified Time (no longer used)
    -#	 3:00	CAST	Central Africa Summer Time (no longer used)
    -#	 3:00	SAST	South Africa Summer Time (no longer used)
    -#	 3:00	EAT	East Africa Time
    -
    -# Algeria
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Algeria	1916	only	-	Jun	14	23:00s	1:00	S
    -Rule	Algeria	1916	1919	-	Oct	Sun>=1	23:00s	0	-
    -Rule	Algeria	1917	only	-	Mar	24	23:00s	1:00	S
    -Rule	Algeria	1918	only	-	Mar	 9	23:00s	1:00	S
    -Rule	Algeria	1919	only	-	Mar	 1	23:00s	1:00	S
    -Rule	Algeria	1920	only	-	Feb	14	23:00s	1:00	S
    -Rule	Algeria	1920	only	-	Oct	23	23:00s	0	-
    -Rule	Algeria	1921	only	-	Mar	14	23:00s	1:00	S
    -Rule	Algeria	1921	only	-	Jun	21	23:00s	0	-
    -Rule	Algeria	1939	only	-	Sep	11	23:00s	1:00	S
    -Rule	Algeria	1939	only	-	Nov	19	 1:00	0	-
    -Rule	Algeria	1944	1945	-	Apr	Mon>=1	 2:00	1:00	S
    -Rule	Algeria	1944	only	-	Oct	 8	 2:00	0	-
    -Rule	Algeria	1945	only	-	Sep	16	 1:00	0	-
    -Rule	Algeria	1971	only	-	Apr	25	23:00s	1:00	S
    -Rule	Algeria	1971	only	-	Sep	26	23:00s	0	-
    -Rule	Algeria	1977	only	-	May	 6	 0:00	1:00	S
    -Rule	Algeria	1977	only	-	Oct	21	 0:00	0	-
    -Rule	Algeria	1978	only	-	Mar	24	 1:00	1:00	S
    -Rule	Algeria	1978	only	-	Sep	22	 3:00	0	-
    -Rule	Algeria	1980	only	-	Apr	25	 0:00	1:00	S
    -Rule	Algeria	1980	only	-	Oct	31	 2:00	0	-
    -# Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
    -# more precise 0:09:21.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Algiers	0:12:12 -	LMT	1891 Mar 15  0:01
    -			0:09:21	-	PMT	1911 Mar 11 # Paris Mean Time
    -			0:00	Algeria	WE%sT	1940 Feb 25  2:00
    -			1:00	Algeria	CE%sT	1946 Oct  7
    -			0:00	-	WET	1956 Jan 29
    -			1:00	-	CET	1963 Apr 14
    -			0:00	Algeria	WE%sT	1977 Oct 21
    -			1:00	Algeria	CE%sT	1979 Oct 26
    -			0:00	Algeria	WE%sT	1981 May
    -			1:00	-	CET
    -
    -# Angola
    -# Benin
    -# See Africa/Lagos.
    -
    -# Botswana
    -# See Africa/Maputo.
    -
    -# Burkina Faso
    -# See Africa/Abidjan.
    -
    -# Burundi
    -# See Africa/Maputo.
    -
    -# Cameroon
    -# See Africa/Lagos.
    -
    -# Cape Verde
    -#
    -# Shanks gives 1907 for the transition to CVT.
    -# Perhaps the 1911-05-26 Portuguese decree
    -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
    -# merely made it official?
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Atlantic/Cape_Verde -1:34:04 -	LMT	1907        # Praia
    -			-2:00	-	CVT	1942 Sep
    -			-2:00	1:00	CVST	1945 Oct 15
    -			-2:00	-	CVT	1975 Nov 25  2:00
    -			-1:00	-	CVT
    -
    -# Central African Republic
    -# See Africa/Lagos.
    -
    -# Chad
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Ndjamena	1:00:12 -	LMT	1912        # N'Djamena
    -			1:00	-	WAT	1979 Oct 14
    -			1:00	1:00	WAST	1980 Mar  8
    -			1:00	-	WAT
    -
    -# Comoros
    -# See Africa/Nairobi.
    -
    -# Democratic Republic of the Congo
    -# See Africa/Lagos for the western part and Africa/Maputo for the eastern.
    -
    -# Republic of the Congo
    -# See Africa/Lagos.
    -
    -# Côte d'Ivoire / Ivory Coast
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Abidjan	-0:16:08 -	LMT	1912
    -			 0:00	-	GMT
    -Link Africa/Abidjan Africa/Bamako	# Mali
    -Link Africa/Abidjan Africa/Banjul	# Gambia
    -Link Africa/Abidjan Africa/Conakry	# Guinea
    -Link Africa/Abidjan Africa/Dakar	# Senegal
    -Link Africa/Abidjan Africa/Freetown	# Sierra Leone
    -Link Africa/Abidjan Africa/Lome		# Togo
    -Link Africa/Abidjan Africa/Nouakchott	# Mauritania
    -Link Africa/Abidjan Africa/Ouagadougou	# Burkina Faso
    -Link Africa/Abidjan Africa/Sao_Tome	# São Tomé and Príncipe
    -Link Africa/Abidjan Atlantic/St_Helena	# St Helena
    -
    -# Djibouti
    -# See Africa/Nairobi.
    -
    -###############################################################################
    -
    -# Egypt
    -
    -# Milne says Cairo used 2:05:08.9, the local mean time of the Abbasizeh
    -# observatory; round to nearest.  Milne also says that the official time for
    -# Egypt was mean noon at the Great Pyramid, 2:04:30.5, but apparently this
    -# did not apply to Cairo, Alexandria, or Port Said.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Egypt	1940	only	-	Jul	15	0:00	1:00	S
    -Rule	Egypt	1940	only	-	Oct	 1	0:00	0	-
    -Rule	Egypt	1941	only	-	Apr	15	0:00	1:00	S
    -Rule	Egypt	1941	only	-	Sep	16	0:00	0	-
    -Rule	Egypt	1942	1944	-	Apr	 1	0:00	1:00	S
    -Rule	Egypt	1942	only	-	Oct	27	0:00	0	-
    -Rule	Egypt	1943	1945	-	Nov	 1	0:00	0	-
    -Rule	Egypt	1945	only	-	Apr	16	0:00	1:00	S
    -Rule	Egypt	1957	only	-	May	10	0:00	1:00	S
    -Rule	Egypt	1957	1958	-	Oct	 1	0:00	0	-
    -Rule	Egypt	1958	only	-	May	 1	0:00	1:00	S
    -Rule	Egypt	1959	1981	-	May	 1	1:00	1:00	S
    -Rule	Egypt	1959	1965	-	Sep	30	3:00	0	-
    -Rule	Egypt	1966	1994	-	Oct	 1	3:00	0	-
    -Rule	Egypt	1982	only	-	Jul	25	1:00	1:00	S
    -Rule	Egypt	1983	only	-	Jul	12	1:00	1:00	S
    -Rule	Egypt	1984	1988	-	May	 1	1:00	1:00	S
    -Rule	Egypt	1989	only	-	May	 6	1:00	1:00	S
    -Rule	Egypt	1990	1994	-	May	 1	1:00	1:00	S
    -# IATA (after 1990) says transitions are at 0:00.
    -# Go with IATA starting in 1995, except correct 1995 entry from 09-30 to 09-29.
    -
    -# From Alexander Krivenyshev (2011-04-20):
    -# "...Egypt's interim cabinet decided on Wednesday to cancel daylight
    -# saving time after a poll posted on its website showed the majority of
    -# Egyptians would approve the cancellation."
    -#
    -# Egypt to cancel daylight saving time
    -# http://www.almasryalyoum.com/en/node/407168
    -# or
    -# http://www.worldtimezone.com/dst_news/dst_news_egypt04.html
    -Rule	Egypt	1995	2010	-	Apr	lastFri	 0:00s	1:00	S
    -Rule	Egypt	1995	2005	-	Sep	lastThu	24:00	0	-
    -# From Steffen Thorsen (2006-09-19):
    -# The Egyptian Gazette, issue 41,090 (2006-09-18), page 1, reports:
    -# Egypt will turn back clocks by one hour at the midnight of Thursday
    -# after observing the daylight saving time since May.
    -# http://news.gom.com.eg/gazette/pdf/2006/09/18/01.pdf
    -Rule	Egypt	2006	only	-	Sep	21	24:00	0	-
    -# From Dirk Losch (2007-08-14):
    -# I received a mail from an airline which says that the daylight
    -# saving time in Egypt will end in the night of 2007-09-06 to 2007-09-07.
    -# From Jesper Nørgaard Welen (2007-08-15): [The following agree:]
    -# http://www.nentjes.info/Bill/bill5.htm
    -# http://www.timeanddate.com/worldclock/city.html?n=53
    -# From Steffen Thorsen (2007-09-04): The official information...:
    -# http://www.sis.gov.eg/En/EgyptOnline/Miscellaneous/000002/0207000000000000001580.htm
    -Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	0	-
    -# From Abdelrahman Hassan (2007-09-06):
    -# Due to the Hijri (lunar Islamic calendar) year being 11 days shorter
    -# than the year of the Gregorian calendar, Ramadan shifts earlier each
    -# year. This year it will be observed September 13 (September is quite
    -# hot in Egypt), and the idea is to make fasting easier for workers by
    -# shifting business hours one hour out of daytime heat. Consequently,
    -# unless discontinued, next DST may end Thursday 28 August 2008.
    -# From Paul Eggert (2007-08-17):
    -# For lack of better info, assume the new rule is last Thursday in August.
    -
    -# From Petr Machata (2009-04-06):
    -# The following appeared in Red Hat bugzilla[1] (edited):
    -#
    -# > $ zdump -v /usr/share/zoneinfo/Africa/Cairo | grep 2009
    -# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 21:59:59 2009 UTC = Thu =
    -# Apr 23
    -# > 23:59:59 2009 EET isdst=0 gmtoff=7200
    -# > /usr/share/zoneinfo/Africa/Cairo  Thu Apr 23 22:00:00 2009 UTC = Fri =
    -# Apr 24
    -# > 01:00:00 2009 EEST isdst=1 gmtoff=10800
    -# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 20:59:59 2009 UTC = Thu =
    -# Aug 27
    -# > 23:59:59 2009 EEST isdst=1 gmtoff=10800
    -# > /usr/share/zoneinfo/Africa/Cairo  Thu Aug 27 21:00:00 2009 UTC = Thu =
    -# Aug 27
    -# > 23:00:00 2009 EET isdst=0 gmtoff=7200
    -#
    -# > end date should be Thu Sep 24 2009 (Last Thursday in September at 23:59=
    -# :59)
    -# > http://support.microsoft.com/kb/958729/
    -#
    -# timeanddate[2] and another site I've found[3] also support that.
    -#
    -# [1] https://bugzilla.redhat.com/show_bug.cgi?id=492263
    -# [2] http://www.timeanddate.com/worldclock/clockchange.html?n=53
    -# [3] http://wwp.greenwichmeantime.com/time-zone/africa/egypt/
    -
    -# From Arthur David Olson (2009-04-20):
    -# In 2009 (and for the next several years), Ramadan ends before the fourth
    -# Thursday in September; Egypt is expected to revert to the last Thursday
    -# in September.
    -
    -# From Steffen Thorsen (2009-08-11):
    -# We have been able to confirm the August change with the Egyptian Cabinet
    -# Information and Decision Support Center:
    -# http://www.timeanddate.com/news/time/egypt-dst-ends-2009.html
    -#
    -# The Middle East News Agency
    -# http://www.mena.org.eg/index.aspx
    -# also reports "Egypt starts winter time on August 21"
    -# today in article numbered "71, 11/08/2009 12:25 GMT."
    -# Only the title above is available without a subscription to their service,
    -# and can be found by searching for "winter" in their search engine
    -# (at least today).
    -
    -# From Alexander Krivenyshev (2010-07-20):
    -# According to News from Egypt - Al-Masry Al-Youm Egypt's cabinet has
    -# decided that Daylight Saving Time will not be used in Egypt during
    -# Ramadan.
    -#
    -# Arabic translation:
    -# "Clocks to go back during Ramadan - and then forward again"
    -# http://www.almasryalyoum.com/en/news/clocks-go-back-during-ramadan-and-then-forward-again
    -# http://www.worldtimezone.com/dst_news/dst_news_egypt02.html
    -
    -# From Ahmad El-Dardiry (2014-05-07):
    -# Egypt is to change back to Daylight system on May 15
    -# http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx
    -
    -# From Gunther Vermier (2014-05-13):
    -# our Egypt office confirms that the change will be at 15 May "midnight" (24:00)
    -
    -# From Imed Chihi (2014-06-04):
    -# We have finally "located" a precise official reference about the DST changes
    -# in Egypt.  The Ministers Cabinet decision is explained at
    -# http://www.cabinet.gov.eg/Media/CabinetMeetingsDetails.aspx?id=347 ...
    -# [T]his (Arabic) site is not accessible outside Egypt, but the page ...
    -# translates into: "With regard to daylight saving time, it is scheduled to
    -# take effect at exactly twelve o'clock this evening, Thursday, 15 MAY 2014,
    -# to be suspended by twelve o'clock on the evening of Thursday, 26 JUN 2014,
    -# and re-established again at the end of the month of Ramadan, at twelve
    -# o'clock on the evening of Thursday, 31 JUL 2014."  This statement has been
    -# reproduced by other (more accessible) sites[, e.g.,]...
    -# http://elgornal.net/news/news.aspx?id=4699258
    -
    -# From Paul Eggert (2014-06-04):
    -# Sarah El Deeb and Lee Keath of AP report that the Egyptian government says
    -# the change is because of blackouts in Cairo, even though Ahram Online (cited
    -# above) says DST had no affect on electricity consumption.  There is
    -# no information about when DST will end this fall.  See:
    -# http://abcnews.go.com/International/wireStory/el-sissi-pushes-egyptians-line-23614833
    -
    -# From Steffen Thorsen (2015-04-08):
    -# Egypt will start DST on midnight after Thursday, April 30, 2015.
    -# This is based on a law (no 35) from May 15, 2014 saying it starts the last
    -# Thursday of April....  Clocks will still be turned back for Ramadan, but
    -# dates not yet announced....
    -# http://almogaz.com/news/weird-news/2015/04/05/1947105 ...
    -# http://www.timeanddate.com/news/time/egypt-starts-dst-2015.html
    -
    -# From Ahmed Nazmy (2015-04-20):
    -# Egypt's ministers cabinet just announced ... that it will cancel DST at
    -# least for 2015.
    -#
    -# From Tim Parenti (2015-04-20):
    -# http://english.ahram.org.eg/WriterArticles/NewsContentP/1/128195/Egypt/No-daylight-saving-this-summer-Egypts-prime-minist.aspx
    -# "Egypt's cabinet agreed on Monday not to switch clocks for daylight saving
    -# time this summer, and carry out studies on the possibility of canceling the
    -# practice altogether in future years."
    -#
    -# From Paul Eggert (2015-04-24):
    -# Yesterday the office of Egyptian President El-Sisi announced his
    -# decision to abandon DST permanently.  See Ahram Online 2015-04-24.
    -# http://english.ahram.org.eg/NewsContent/1/64/128509/Egypt/Politics-/Sisi-cancels-daylight-saving-time-in-Egypt.aspx
    -
    -Rule	Egypt	2008	only	-	Aug	lastThu	24:00	0	-
    -Rule	Egypt	2009	only	-	Aug	20	24:00	0	-
    -Rule	Egypt	2010	only	-	Aug	10	24:00	0	-
    -Rule	Egypt	2010	only	-	Sep	 9	24:00	1:00	S
    -Rule	Egypt	2010	only	-	Sep	lastThu	24:00	0	-
    -Rule	Egypt	2014	only	-	May	15	24:00	1:00	S
    -Rule	Egypt	2014	only	-	Jun	26	24:00	0	-
    -Rule	Egypt	2014	only	-	Jul	31	24:00	1:00	S
    -Rule	Egypt	2014	only	-	Sep	lastThu	24:00	0	-
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Cairo	2:05:09 -	LMT	1900 Oct
    -			2:00	Egypt	EE%sT
    -
    -# Equatorial Guinea
    -# See Africa/Lagos.
    -
    -# Eritrea
    -# Ethiopia
    -# See Africa/Nairobi.
    -
    -# Gabon
    -# See Africa/Lagos.
    -
    -# Gambia
    -# See Africa/Abidjan.
    -
    -# Ghana
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -# Whitman says DST was observed from 1931 to "the present";
    -# Shanks & Pottenger say 1936 to 1942;
    -# and September 1 to January 1 is given by:
    -# Scott Keltie J, Epstein M (eds), The Statesman's Year-Book,
    -# 57th ed. Macmillan, London (1920), OCLC 609408015, pp xxviii.
    -# For lack of better info, assume DST was observed from 1920 to 1942.
    -Rule	Ghana	1920	1942	-	Sep	 1	0:00	0:20	GHST
    -Rule	Ghana	1920	1942	-	Dec	31	0:00	0	GMT
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Accra	-0:00:52 -	LMT	1918
    -			 0:00	Ghana	%s
    -
    -# Guinea
    -# See Africa/Abidjan.
    -
    -# Guinea-Bissau
    -#
    -# Shanks gives 1911-05-26 for the transition to WAT,
    -# evidently confusing the date of the Portuguese decree
    -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
    -# with the date that it took effect, namely 1912-01-01.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Bissau	-1:02:20 -	LMT	1912 Jan  1
    -			-1:00	-	WAT	1975
    -			 0:00	-	GMT
    -
    -# Kenya
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Nairobi	2:27:16	-	LMT	1928 Jul
    -			3:00	-	EAT	1930
    -			2:30	-	BEAT	1940
    -			2:45	-	BEAUT	1960
    -			3:00	-	EAT
    -Link Africa/Nairobi Africa/Addis_Ababa	 # Ethiopia
    -Link Africa/Nairobi Africa/Asmara	 # Eritrea
    -Link Africa/Nairobi Africa/Dar_es_Salaam # Tanzania
    -Link Africa/Nairobi Africa/Djibouti
    -Link Africa/Nairobi Africa/Kampala	 # Uganda
    -Link Africa/Nairobi Africa/Mogadishu	 # Somalia
    -Link Africa/Nairobi Indian/Antananarivo	 # Madagascar
    -Link Africa/Nairobi Indian/Comoro
    -Link Africa/Nairobi Indian/Mayotte
    -
    -# Lesotho
    -# See Africa/Johannesburg.
    -
    -# Liberia
    -# From Paul Eggert (2006-03-22):
    -# In 1972 Liberia was the last country to switch
    -# from a UTC offset that was not a multiple of 15 or 20 minutes.
    -# Howse reports that it was in honor of their president's birthday.
    -# Shank & Pottenger report the date as May 1, whereas Howse reports Jan;
    -# go with Shanks & Pottenger.
    -# For Liberia before 1972, Shanks & Pottenger report -0:44, whereas Howse and
    -# Whitman each report -0:44:30; go with the more precise figure.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Monrovia	-0:43:08 -	LMT	1882
    -			-0:43:08 -	MMT	1919 Mar # Monrovia Mean Time
    -			-0:44:30 -	LRT	1972 May # Liberia Time
    -			 0:00	-	GMT
    -
    -###############################################################################
    -
    -# Libya
    -
    -# From Even Scharning (2012-11-10):
    -# Libya set their time one hour back at 02:00 on Saturday November 10.
    -# http://www.libyaherald.com/2012/11/04/clocks-to-go-back-an-hour-on-saturday/
    -# Here is an official source [in Arabic]: http://ls.ly/fb6Yc
    -#
    -# Steffen Thorsen forwarded a translation (2012-11-10) in
    -# http://mm.icann.org/pipermail/tz/2012-November/018451.html
    -#
    -# From Tim Parenti (2012-11-11):
    -# Treat the 2012-11-10 change as a zone change from UTC+2 to UTC+1.
    -# The DST rules planned for 2013 and onward roughly mirror those of Europe
    -# (either two days before them or five days after them, so as to fall on
    -# lastFri instead of lastSun).
    -
    -# From Even Scharning (2013-10-25):
    -# The scheduled end of DST in Libya on Friday, October 25, 2013 was
    -# cancelled yesterday....
    -# http://www.libyaherald.com/2013/10/24/correction-no-time-change-tomorrow/
    -#
    -# From Paul Eggert (2013-10-25):
    -# For now, assume they're reverting to the pre-2012 rules of permanent UTC+2.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Libya	1951	only	-	Oct	14	2:00	1:00	S
    -Rule	Libya	1952	only	-	Jan	 1	0:00	0	-
    -Rule	Libya	1953	only	-	Oct	 9	2:00	1:00	S
    -Rule	Libya	1954	only	-	Jan	 1	0:00	0	-
    -Rule	Libya	1955	only	-	Sep	30	0:00	1:00	S
    -Rule	Libya	1956	only	-	Jan	 1	0:00	0	-
    -Rule	Libya	1982	1984	-	Apr	 1	0:00	1:00	S
    -Rule	Libya	1982	1985	-	Oct	 1	0:00	0	-
    -Rule	Libya	1985	only	-	Apr	 6	0:00	1:00	S
    -Rule	Libya	1986	only	-	Apr	 4	0:00	1:00	S
    -Rule	Libya	1986	only	-	Oct	 3	0:00	0	-
    -Rule	Libya	1987	1989	-	Apr	 1	0:00	1:00	S
    -Rule	Libya	1987	1989	-	Oct	 1	0:00	0	-
    -Rule	Libya	1997	only	-	Apr	 4	0:00	1:00	S
    -Rule	Libya	1997	only	-	Oct	 4	0:00	0	-
    -Rule	Libya	2013	only	-	Mar	lastFri	1:00	1:00	S
    -Rule	Libya	2013	only	-	Oct	lastFri	2:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Tripoli	0:52:44 -	LMT	1920
    -			1:00	Libya	CE%sT	1959
    -			2:00	-	EET	1982
    -			1:00	Libya	CE%sT	1990 May  4
    -# The 1996 and 1997 entries are from Shanks & Pottenger;
    -# the IATA SSIM data entries contain some obvious errors.
    -			2:00	-	EET	1996 Sep 30
    -			1:00	Libya	CE%sT	1997 Oct  4
    -			2:00	-	EET	2012 Nov 10  2:00
    -			1:00	Libya	CE%sT	2013 Oct 25  2:00
    -			2:00	-	EET
    -
    -# Madagascar
    -# See Africa/Nairobi.
    -
    -# Malawi
    -# See Africa/Maputo.
    -
    -# Mali
    -# Mauritania
    -# See Africa/Abidjan.
    -
    -# Mauritius
    -
    -# From Steffen Thorsen (2008-06-25):
    -# Mauritius plans to observe DST from 2008-11-01 to 2009-03-31 on a trial
    -# basis....
    -# It seems that Mauritius observed daylight saving time from 1982-10-10 to
    -# 1983-03-20 as well, but that was not successful....
    -# http://www.timeanddate.com/news/time/mauritius-daylight-saving-time.html
    -
    -# From Alex Krivenyshev (2008-06-25):
    -# http://economicdevelopment.gov.mu/portal/site/Mainhomepage/menuitem.a42b24128104d9845dabddd154508a0c/?content_id=0a7cee8b5d69a110VgnVCM1000000a04a8c0RCRD
    -
    -# From Arthur David Olson (2008-06-30):
    -# The www.timeanddate.com article cited by Steffen Thorsen notes that "A
    -# final decision has yet to be made on the times that daylight saving
    -# would begin and end on these dates." As a place holder, use midnight.
    -
    -# From Paul Eggert (2008-06-30):
    -# Follow Thorsen on DST in 1982/1983, instead of Shanks & Pottenger.
    -
    -# From Steffen Thorsen (2008-07-10):
    -# According to
    -# http://www.lexpress.mu/display_article.php?news_id=111216
    -# (in French), Mauritius will start and end their DST a few days earlier
    -# than previously announced (2008-11-01 to 2009-03-31).  The new start
    -# date is 2008-10-26 at 02:00 and the new end date is 2009-03-27 (no time
    -# given, but it is probably at either 2 or 3 wall clock time).
    -#
    -# A little strange though, since the article says that they moved the date
    -# to align itself with Europe and USA which also change time on that date,
    -# but that means they have not paid attention to what happened in
    -# USA/Canada last year (DST ends first Sunday in November). I also wonder
    -# why that they end on a Friday, instead of aligning with Europe which
    -# changes two days later.
    -
    -# From Alex Krivenyshev (2008-07-11):
    -# Seems that English language article "The revival of daylight saving
    -# time: Energy conservation?"- No. 16578 (07/11/2008) was originally
    -# published on Monday, June 30, 2008...
    -#
    -# I guess that article in French "Le gouvernement avance l'introduction
    -# de l'heure d'été" stating that DST in Mauritius starting on October 26
    -# and ending on March 27, 2009 is the most recent one....
    -# http://www.worldtimezone.com/dst_news/dst_news_mauritius02.html
    -
    -# From Riad M. Hossen Ally (2008-08-03):
    -# The Government of Mauritius weblink
    -# http://www.gov.mu/portal/site/pmosite/menuitem.4ca0efdee47462e7440a600248a521ca/?content_id=4728ca68b2a5b110VgnVCM1000000a04a8c0RCRD
    -# Cabinet Decision of July 18th, 2008 states as follows:
    -#
    -# 4. ...Cabinet has agreed to the introduction into the National Assembly
    -# of the Time Bill which provides for the introduction of summer time in
    -# Mauritius. The summer time period which will be of one hour ahead of
    -# the standard time, will be aligned with that in Europe and the United
    -# States of America. It will start at two o'clock in the morning on the
    -# last Sunday of October and will end at two o'clock in the morning on
    -# the last Sunday of March the following year. The summer time for the
    -# year 2008-2009 will, therefore, be effective as from 26 October 2008
    -# and end on 29 March 2009.
    -
    -# From Ed Maste (2008-10-07):
    -# THE TIME BILL (No. XXVII of 2008) Explanatory Memorandum states the
    -# beginning / ending of summer time is 2 o'clock standard time in the
    -# morning of the last Sunday of October / last Sunday of March.
    -# http://www.gov.mu/portal/goc/assemblysite/file/bill2708.pdf
    -
    -# From Steffen Thorsen (2009-06-05):
    -# According to several sources, Mauritius will not continue to observe
    -# DST the coming summer...
    -#
    -# Some sources, in French:
    -# http://www.defimedia.info/news/946/Rashid-Beebeejaun-:-%C2%AB-L%E2%80%99heure-d%E2%80%99%C3%A9t%C3%A9-ne-sera-pas-appliqu%C3%A9e-cette-ann%C3%A9e-%C2%BB
    -# http://lexpress.mu/Story/3398~Beebeejaun---Les-objectifs-d-%C3%A9conomie-d-%C3%A9nergie-de-l-heure-d-%C3%A9t%C3%A9-ont-%C3%A9t%C3%A9-atteints-
    -#
    -# Our wrap-up:
    -# http://www.timeanddate.com/news/time/mauritius-dst-will-not-repeat.html
    -
    -# From Arthur David Olson (2009-07-11):
    -# The "mauritius-dst-will-not-repeat" wrapup includes this:
    -# "The trial ended on March 29, 2009, when the clocks moved back by one hour
    -# at 2am (or 02:00) local time..."
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule Mauritius	1982	only	-	Oct	10	0:00	1:00	S
    -Rule Mauritius	1983	only	-	Mar	21	0:00	0	-
    -Rule Mauritius	2008	only	-	Oct	lastSun	2:00	1:00	S
    -Rule Mauritius	2009	only	-	Mar	lastSun	2:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Indian/Mauritius	3:50:00 -	LMT	1907 # Port Louis
    -			4:00 Mauritius	MU%sT	# Mauritius Time
    -# Agalega Is, Rodriguez
    -# no information; probably like Indian/Mauritius
    -
    -# Mayotte
    -# See Africa/Nairobi.
    -
    -# Morocco
    -# See the 'europe' file for Spanish Morocco (Africa/Ceuta).
    -
    -# From Alex Krivenyshev (2008-05-09):
    -# Here is an article that Morocco plan to introduce Daylight Saving Time between
    -# 1 June, 2008 and 27 September, 2008.
    -#
    -# "... Morocco is to save energy by adjusting its clock during summer so it will
    -# be one hour ahead of GMT between 1 June and 27 September, according to
    -# Communication Minister and Government Spokesman, Khalid Naciri...."
    -#
    -# http://www.worldtimezone.net/dst_news/dst_news_morocco01.html
    -# http://en.afrik.com/news11892.html
    -
    -# From Alex Krivenyshev (2008-05-09):
    -# The Morocco time change can be confirmed on Morocco web site Maghreb Arabe
    -# Presse:
    -# http://www.map.ma/eng/sections/box3/morocco_shifts_to_da/view
    -#
    -# Morocco shifts to daylight time on June 1st through September 27, Govt.
    -# spokesman.
    -
    -# From Patrice Scattolin (2008-05-09):
    -# According to this article:
    -# http://www.avmaroc.com/actualite/heure-dete-comment-a127896.html
    -# (and republished here: )
    -# the changes occur at midnight:
    -#
    -# Saturday night May 31st at midnight (which in French is to be
    -# interpreted as the night between Saturday and Sunday)
    -# Sunday night the 28th at midnight
    -#
    -# Seeing that the 28th is Monday, I am guessing that she intends to say
    -# the midnight of the 28th which is the midnight between Sunday and
    -# Monday, which jives with other sources that say that it's inclusive
    -# June 1st to Sept 27th.
    -#
    -# The decision was taken by decree *2-08-224 *but I can't find the decree
    -# published on the web.
    -#
    -# It's also confirmed here:
    -# http://www.maroc.ma/NR/exeres/FACF141F-D910-44B0-B7FA-6E03733425D1.htm
    -# on a government portal as being between June 1st and Sept 27th (not yet
    -# posted in English).
    -#
    -# The following Google query will generate many relevant hits:
    -# http://www.google.com/search?hl=en&q=Conseil+de+gouvernement+maroc+heure+avance&btnG=Search
    -
    -# From Steffen Thorsen (2008-08-27):
    -# Morocco will change the clocks back on the midnight between August 31
    -# and September 1. They originally planned to observe DST to near the end
    -# of September:
    -#
    -# One article about it (in French):
    -# http://www.menara.ma/fr/Actualites/Maroc/Societe/ci.retour_a_l_heure_gmt_a_partir_du_dimanche_31_aout_a_minuit_officiel_.default
    -#
    -# We have some further details posted here:
    -# http://www.timeanddate.com/news/time/morocco-ends-dst-early-2008.html
    -
    -# From Steffen Thorsen (2009-03-17):
    -# Morocco will observe DST from 2009-06-01 00:00 to 2009-08-21 00:00 according
    -# to many sources, such as
    -# http://news.marweb.com/morocco/entertainment/morocco-daylight-saving.html
    -# http://www.medi1sat.ma/fr/depeche.aspx?idp=2312
    -# (French)
    -#
    -# Our summary:
    -# http://www.timeanddate.com/news/time/morocco-starts-dst-2009.html
    -
    -# From Alexander Krivenyshev (2009-03-17):
    -# Here is a link to official document from Royaume du Maroc Premier Ministre,
    -# Ministère de la Modernisation des Secteurs Publics
    -#
    -# Under Article 1 of Royal Decree No. 455-67 of Act 23 safar 1387 (2 June 1967)
    -# concerning the amendment of the legal time, the Ministry of Modernization of
    -# Public Sectors announced that the official time in the Kingdom will be
    -# advanced 60 minutes from Sunday 31 May 2009 at midnight.
    -#
    -# http://www.mmsp.gov.ma/francais/Actualites_fr/PDF_Actualites_Fr/HeureEte_FR.pdf
    -# http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
    -
    -# From Steffen Thorsen (2010-04-13):
    -# Several news media in Morocco report that the Ministry of Modernization
    -# of Public Sectors has announced that Morocco will have DST from
    -# 2010-05-02 to 2010-08-08.
    -#
    -# Example:
    -# http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html
    -# (French)
    -# Our page:
    -# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
    -
    -# From Dan Abitol (2011-03-30):
    -# ...Rules for Africa/Casablanca are the following (24h format)
    -# The 3rd April 2011 at 00:00:00, [it] will be 3rd April 01:00:00
    -# The 31st July 2011 at 00:59:59, [it] will be 31st July 00:00:00
    -# ...Official links of change in morocco
    -# The change was broadcast on the FM Radio
    -# I ve called ANRT (telecom regulations in Morocco) at
    -# +212.537.71.84.00
    -# http://www.anrt.net.ma/fr/
    -# They said that
    -# http://www.map.ma/fr/sections/accueil/l_heure_legale_au_ma/view
    -# is the official publication to look at.
    -# They said that the decision was already taken.
    -#
    -# More articles in the press
    -# http://www.yabiladi.com/articles/details/5058/secret-l-heure-d-ete-maroc-leve.html
    -# http://www.lematin.ma/Actualite/Express/Article.asp?id=148923
    -# http://www.lavieeco.com/actualite/Le-Maroc-passe-sur-GMT%2B1-a-partir-de-dim
    -
    -# From Petr Machata (2011-03-30):
    -# They have it written in English here:
    -# http://www.map.ma/eng/sections/home/morocco_to_spring_fo/view
    -#
    -# It says there that "Morocco will resume its standard time on July 31,
    -# 2011 at midnight." Now they don't say whether they mean midnight of
    -# wall clock time (i.e. 11pm UTC), but that's what I would assume. It has
    -# also been like that in the past.
    -
    -# From Alexander Krivenyshev (2012-03-09):
    -# According to Infomédiaire web site from Morocco (infomediaire.ma),
    -# on March 9, 2012, (in French) Heure légale:
    -# Le Maroc adopte officiellement l'heure d'été
    -# http://www.infomediaire.ma/news/maroc/heure-l%C3%A9gale-le-maroc-adopte-officiellement-lheure-d%C3%A9t%C3%A9
    -# Governing Council adopted draft decree, that Morocco DST starts on
    -# the last Sunday of March (March 25, 2012) and ends on
    -# last Sunday of September (September 30, 2012)
    -# except the month of Ramadan.
    -# or (brief)
    -# http://www.worldtimezone.com/dst_news/dst_news_morocco06.html
    -
    -# From Arthur David Olson (2012-03-10):
    -# The infomediaire.ma source indicates that the system is to be in
    -# effect every year. It gives 03H00 as the "fall back" time of day;
    -# it lacks a "spring forward" time of day; assume 2:00 XXX.
    -# Wait on specifying the Ramadan exception for details about
    -# start date, start time of day, end date, and end time of day XXX.
    -
    -# From Christophe Tropamer (2012-03-16):
    -# Seen Morocco change again:
    -# http://www.le2uminutes.com/actualite.php
    -# "...à partir du dernier dimanche d'avril et non fins mars,
    -# comme annoncé précédemment."
    -
    -# From Milamber Space Network (2012-07-17):
    -# The official return to GMT is announced by the Moroccan government:
    -# http://www.mmsp.gov.ma/fr/actualites.aspx?id=288 [in French]
    -#
    -# Google translation, lightly edited:
    -# Back to the standard time of the Kingdom (GMT)
    -# Pursuant to Decree No. 2-12-126 issued on 26 Jumada (I) 1433 (April 18,
    -# 2012) and in accordance with the order of Mr. President of the
    -# Government No. 3-47-12 issued on 24 Sha'ban (11 July 2012), the Ministry
    -# of Public Service and Administration Modernization announces the return
    -# of the legal time of the Kingdom (GMT) from Friday, July 20, 2012 until
    -# Monday, August 20, 2012.  So the time will be delayed by 60 minutes from
    -# 3:00 am Friday, July 20, 2012 and will again be advanced by 60 minutes
    -# August 20, 2012 from 2:00 am.
    -
    -# From Paul Eggert (2013-03-06):
    -# Morocco's daylight-saving transitions due to Ramadan seem to be
    -# announced a bit in advance.  On 2012-07-11 the Moroccan government
    -# announced that year's Ramadan daylight-saving transitions would be
    -# 2012-07-20 and 2012-08-20; see
    -# http://www.mmsp.gov.ma/fr/actualites.aspx?id=288
    -
    -# From Andrew Paprocki (2013-07-02):
    -# Morocco announced that the year's Ramadan daylight-savings
    -# transitions would be 2013-07-07 and 2013-08-10; see:
    -# http://www.maroc.ma/en/news/morocco-suspends-daylight-saving-time-july-7-aug10
    -
    -# From Steffen Thorsen (2013-09-28):
    -# Morocco extends DST by one month, on very short notice, just 1 day
    -# before it was going to end.  There is a new decree (2.13.781) for
    -# this, where DST from now on goes from last Sunday of March at 02:00
    -# to last Sunday of October at 03:00, similar to EU rules.  Official
    -# source (French):
    -# http://www.maroc.gov.ma/fr/actualites/lhoraire-dete-gmt1-maintenu-jusquau-27-octobre-2013
    -# Another source (specifying the time for start and end in the decree):
    -# http://www.lemag.ma/Heure-d-ete-au-Maroc-jusqu-au-27-octobre_a75620.html
    -
    -# From Sebastien Willemijns (2014-03-18):
    -# http://www.afriquinfos.com/articles/2014/3/18/maroc-heure-dete-avancez-tous-horloges-247891.asp
    -
    -# From Milamber Space Network (2014-06-05):
    -# The Moroccan government has recently announced that the country will return
    -# to standard time at 03:00 on Saturday, June 28, 2014 local time....  DST
    -# will resume again at 02:00 on Saturday, August 2, 2014....
    -# http://www.mmsp.gov.ma/fr/actualites.aspx?id=586
    -
    -# From Milamber (2015-06-08):
    -# (Google Translation) The hour will thus be delayed 60 minutes
    -# Sunday, June 14 at 3:00, the ministry said in a statement, adding
    -# that the time will be advanced again 60 minutes Sunday, July 19,
    -# 2015 at 2:00.  The move comes under 2.12.126 Decree of 26 Jumada I
    -# 1433 (18 April 2012) and the decision of the Head of Government of
    -# 16 N. 3-29-15 Chaaban 1435 (4 June 2015).
    -# Source (french):
    -# http://lnt.ma/le-maroc-reculera-dune-heure-le-dimanche-14-juin/
    -#
    -# From Milamber (2015-06-09):
    -# http://www.mmsp.gov.ma/fr/actualites.aspx?id=863
    -#
    -# From Michael Deckers (2015-06-09):
    -# [The gov.ma announcement] would (probably) make the switch on 2015-07-19 go
    -# from 03:00 to 04:00 rather than from 02:00 to 03:00, as in the patch....
    -# I think the patch is correct and the quoted text is wrong; the text in
    -#  agrees
    -# with the patch.
    -
    -# From Paul Eggert (2015-06-08):
    -# For now, guess that later spring and fall transitions will use 2015's rules,
    -# and guess that Morocco will switch to standard time at 03:00 the last
    -# Sunday before Ramadan, and back to DST at 02:00 the first Sunday after
    -# Ramadan.  To implement this, transition dates for 2016 through 2037 were
    -# determined by running the following program under GNU Emacs 24.3, with the
    -# results integrated by hand into the table below.
    -# (let ((islamic-year 1437))
    -#   (require 'cal-islam)
    -#   (while (< islamic-year 1460)
    -#     (let ((a (calendar-islamic-to-absolute (list 9 1 islamic-year)))
    -#           (b (calendar-islamic-to-absolute (list 10 1 islamic-year)))
    -#           (sunday 0))
    -#       (while (/= sunday (mod (setq a (1- a)) 7)))
    -#       (while (/= sunday (mod b 7))
    -#         (setq b (1+ b)))
    -#       (setq a (calendar-gregorian-from-absolute a))
    -#       (setq b (calendar-gregorian-from-absolute b))
    -#       (insert
    -#        (format
    -#         (concat "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 3:00\t0\t-\n"
    -#                 "Rule\tMorocco\t%d\tonly\t-\t%s\t%2d\t 2:00\t1:00\tS\n")
    -#         (car (cdr (cdr a))) (calendar-month-name (car a) t) (car (cdr a))
    -#         (car (cdr (cdr b))) (calendar-month-name (car b) t) (car (cdr b)))))
    -#     (setq islamic-year (+ 1 islamic-year))))
    -
    -# RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -
    -Rule	Morocco	1939	only	-	Sep	12	 0:00	1:00	S
    -Rule	Morocco	1939	only	-	Nov	19	 0:00	0	-
    -Rule	Morocco	1940	only	-	Feb	25	 0:00	1:00	S
    -Rule	Morocco	1945	only	-	Nov	18	 0:00	0	-
    -Rule	Morocco	1950	only	-	Jun	11	 0:00	1:00	S
    -Rule	Morocco	1950	only	-	Oct	29	 0:00	0	-
    -Rule	Morocco	1967	only	-	Jun	 3	12:00	1:00	S
    -Rule	Morocco	1967	only	-	Oct	 1	 0:00	0	-
    -Rule	Morocco	1974	only	-	Jun	24	 0:00	1:00	S
    -Rule	Morocco	1974	only	-	Sep	 1	 0:00	0	-
    -Rule	Morocco	1976	1977	-	May	 1	 0:00	1:00	S
    -Rule	Morocco	1976	only	-	Aug	 1	 0:00	0	-
    -Rule	Morocco	1977	only	-	Sep	28	 0:00	0	-
    -Rule	Morocco	1978	only	-	Jun	 1	 0:00	1:00	S
    -Rule	Morocco	1978	only	-	Aug	 4	 0:00	0	-
    -Rule	Morocco	2008	only	-	Jun	 1	 0:00	1:00	S
    -Rule	Morocco	2008	only	-	Sep	 1	 0:00	0	-
    -Rule	Morocco	2009	only	-	Jun	 1	 0:00	1:00	S
    -Rule	Morocco	2009	only	-	Aug	21	 0:00	0	-
    -Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	S
    -Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
    -Rule	Morocco	2011	only	-	Apr	 3	 0:00	1:00	S
    -Rule	Morocco	2011	only	-	Jul	31	 0	0	-
    -Rule	Morocco	2012	2013	-	Apr	lastSun	 2:00	1:00	S
    -Rule	Morocco	2012	only	-	Sep	30	 3:00	0	-
    -Rule	Morocco	2012	only	-	Jul	20	 3:00	0	-
    -Rule	Morocco	2012	only	-	Aug	20	 2:00	1:00	S
    -Rule	Morocco	2013	only	-	Jul	 7	 3:00	0	-
    -Rule	Morocco	2013	only	-	Aug	10	 2:00	1:00	S
    -Rule	Morocco	2013	max	-	Oct	lastSun	 3:00	0	-
    -Rule	Morocco	2014	2021	-	Mar	lastSun	 2:00	1:00	S
    -Rule	Morocco	2014	only	-	Jun	28	 3:00	0	-
    -Rule	Morocco	2014	only	-	Aug	 2	 2:00	1:00	S
    -Rule	Morocco	2015	only	-	Jun	14	 3:00	0	-
    -Rule	Morocco	2015	only	-	Jul	19	 2:00	1:00	S
    -Rule	Morocco	2016	only	-	Jun	 5	 3:00	0	-
    -Rule	Morocco	2016	only	-	Jul	10	 2:00	1:00	S
    -Rule	Morocco	2017	only	-	May	21	 3:00	0	-
    -Rule	Morocco	2017	only	-	Jul	 2	 2:00	1:00	S
    -Rule	Morocco	2018	only	-	May	13	 3:00	0	-
    -Rule	Morocco	2018	only	-	Jun	17	 2:00	1:00	S
    -Rule	Morocco	2019	only	-	May	 5	 3:00	0	-
    -Rule	Morocco	2019	only	-	Jun	 9	 2:00	1:00	S
    -Rule	Morocco	2020	only	-	Apr	19	 3:00	0	-
    -Rule	Morocco	2020	only	-	May	24	 2:00	1:00	S
    -Rule	Morocco	2021	only	-	Apr	11	 3:00	0	-
    -Rule	Morocco	2021	only	-	May	16	 2:00	1:00	S
    -Rule	Morocco	2022	only	-	May	 8	 2:00	1:00	S
    -Rule	Morocco	2023	only	-	Apr	23	 2:00	1:00	S
    -Rule	Morocco	2024	only	-	Apr	14	 2:00	1:00	S
    -Rule	Morocco	2025	only	-	Apr	 6	 2:00	1:00	S
    -Rule	Morocco	2026	max	-	Mar	lastSun	 2:00	1:00	S
    -Rule	Morocco	2036	only	-	Oct	19	 3:00	0	-
    -Rule	Morocco	2037	only	-	Oct	 4	 3:00	0	-
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Africa/Casablanca	-0:30:20 -	LMT	1913 Oct 26
    -			 0:00	Morocco	WE%sT	1984 Mar 16
    -			 1:00	-	CET	1986
    -			 0:00	Morocco	WE%sT
    -
    -# Western Sahara
    -#
    -# From Gwillim Law (2013-10-22):
    -# A correspondent who is usually well informed about time zone matters
    -# ... says that Western Sahara observes daylight saving time, just as
    -# Morocco does.
    -#
    -# From Paul Eggert (2013-10-23):
    -# Assume that this has been true since Western Sahara switched to GMT,
    -# since most of it was then controlled by Morocco.
    -
    -Zone Africa/El_Aaiun	-0:52:48 -	LMT	1934 Jan # El Aaiún
    -			-1:00	-	WAT	1976 Apr 14
    -			 0:00	Morocco	WE%sT
    -
    -# Mozambique
    -#
    -# Shanks gives 1903-03-01 for the transition to CAT.
    -# Perhaps the 1911-05-26 Portuguese decree
    -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
    -# merely made it official?
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Maputo	2:10:20 -	LMT	1903 Mar
    -			2:00	-	CAT
    -Link Africa/Maputo Africa/Blantyre	# Malawi
    -Link Africa/Maputo Africa/Bujumbura	# Burundi
    -Link Africa/Maputo Africa/Gaborone	# Botswana
    -Link Africa/Maputo Africa/Harare	# Zimbabwe
    -Link Africa/Maputo Africa/Kigali	# Rwanda
    -Link Africa/Maputo Africa/Lubumbashi	# E Dem. Rep. of Congo
    -Link Africa/Maputo Africa/Lusaka	# Zambia
    -
    -# Namibia
    -# The 1994-04-03 transition is from Shanks & Pottenger.
    -# Shanks & Pottenger report no DST after 1998-04; go with IATA.
    -
    -# From Petronella Sibeene (2007-03-30):
    -# http://allafrica.com/stories/200703300178.html
    -# While the entire country changes its time, Katima Mulilo and other
    -# settlements in Caprivi unofficially will not because the sun there
    -# rises and sets earlier compared to other regions.  Chief of
    -# Forecasting Riaan van Zyl explained that the far eastern parts of
    -# the country are close to 40 minutes earlier in sunrise than the rest
    -# of the country.
    -#
    -# From Paul Eggert (2007-03-31):
    -# Apparently the Caprivi Strip informally observes Botswana time, but
    -# we have no details.  In the meantime people there can use Africa/Gaborone.
    -
    -# RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Namibia	1994	max	-	Sep	Sun>=1	2:00	1:00	S
    -Rule	Namibia	1995	max	-	Apr	Sun>=1	2:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Windhoek	1:08:24 -	LMT	1892 Feb 8
    -			1:30	-	SWAT	1903 Mar    # SW Africa Time
    -			2:00	-	SAST	1942 Sep 20  2:00
    -			2:00	1:00	SAST	1943 Mar 21  2:00
    -			2:00	-	SAST	1990 Mar 21 # independence
    -			2:00	-	CAT	1994 Apr  3
    -			1:00	Namibia	WA%sT
    -
    -# Niger
    -# See Africa/Lagos.
    -
    -# Nigeria
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Lagos	0:13:36 -	LMT	1919 Sep
    -			1:00	-	WAT
    -Link Africa/Lagos Africa/Bangui	     # Central African Republic
    -Link Africa/Lagos Africa/Brazzaville # Rep. of the Congo
    -Link Africa/Lagos Africa/Douala	     # Cameroon
    -Link Africa/Lagos Africa/Kinshasa    # Dem. Rep. of the Congo (west)
    -Link Africa/Lagos Africa/Libreville  # Gabon
    -Link Africa/Lagos Africa/Luanda	     # Angola
    -Link Africa/Lagos Africa/Malabo	     # Equatorial Guinea
    -Link Africa/Lagos Africa/Niamey	     # Niger
    -Link Africa/Lagos Africa/Porto-Novo  # Benin
    -
    -# Réunion
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Indian/Reunion	3:41:52 -	LMT	1911 Jun # Saint-Denis
    -			4:00	-	RET	# Réunion Time
    -#
    -# Crozet Islands also observes Réunion time; see the 'antarctica' file.
    -#
    -# Scattered Islands (Îles Éparses) administered from Réunion are as follows.
    -# The following information about them is taken from
    -# Îles Éparses (, 1997-07-22,
    -# in French; no longer available as of 1999-08-17).
    -# We have no info about their time zone histories.
    -#
    -# Bassas da India - uninhabited
    -# Europa Island - inhabited from 1905 to 1910 by two families
    -# Glorioso Is - inhabited until at least 1958
    -# Juan de Nova - uninhabited
    -# Tromelin - inhabited until at least 1958
    -
    -# Rwanda
    -# See Africa/Maputo.
    -
    -# St Helena
    -# See Africa/Abidjan.
    -# The other parts of the St Helena territory are similar:
    -#	Tristan da Cunha: on GMT, say Whitman and the CIA
    -#	Ascension: on GMT, say the USNO (1995-12-21) and the CIA
    -#	Gough (scientific station since 1955; sealers wintered previously):
    -#		on GMT, says the CIA
    -#	Inaccessible, Nightingale: uninhabited
    -
    -# São Tomé and Príncipe
    -# Senegal
    -# See Africa/Abidjan.
    -
    -# Seychelles
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Indian/Mahe	3:41:48 -	LMT	1906 Jun # Victoria
    -			4:00	-	SCT	# Seychelles Time
    -# From Paul Eggert (2001-05-30):
    -# Aldabra, Farquhar, and Desroches, originally dependencies of the
    -# Seychelles, were transferred to the British Indian Ocean Territory
    -# in 1965 and returned to Seychelles control in 1976.  We don't know
    -# whether this affected their time zone, so omit this for now.
    -# Possibly the islands were uninhabited.
    -
    -# Sierra Leone
    -# See Africa/Abidjan.
    -
    -# Somalia
    -# See Africa/Nairobi.
    -
    -# South Africa
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	SA	1942	1943	-	Sep	Sun>=15	2:00	1:00	-
    -Rule	SA	1943	1944	-	Mar	Sun>=15	2:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Africa/Johannesburg 1:52:00 -	LMT	1892 Feb 8
    -			1:30	-	SAST	1903 Mar
    -			2:00	SA	SAST
    -Link Africa/Johannesburg Africa/Maseru	   # Lesotho
    -Link Africa/Johannesburg Africa/Mbabane    # Swaziland
    -#
    -# Marion and Prince Edward Is
    -# scientific station since 1947
    -# no information
    -
    -# Sudan
    -#
    -# From 
    -# Sudan News Agency (2000-01-13),
    -# also reported by Michaël De Beukelaer-Dossche via Steffen Thorsen:
    -# Clocks will be moved ahead for 60 minutes all over the Sudan as of noon
    -# Saturday....  This was announced Thursday by Caretaker State Minister for
    -# Manpower Abdul-Rahman Nur-Eddin.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Sudan	1970	only	-	May	 1	0:00	1:00	S
    -Rule	Sudan	1970	1985	-	Oct	15	0:00	0	-
    -Rule	Sudan	1971	only	-	Apr	30	0:00	1:00	S
    -Rule	Sudan	1972	1985	-	Apr	lastSun	0:00	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Khartoum	2:10:08 -	LMT	1931
    -			2:00	Sudan	CA%sT	2000 Jan 15 12:00
    -			3:00	-	EAT
    -
    -# South Sudan
    -Link Africa/Khartoum Africa/Juba
    -
    -# Swaziland
    -# See Africa/Johannesburg.
    -
    -# Tanzania
    -# See Africa/Nairobi.
    -
    -# Togo
    -# See Africa/Abidjan.
    -
    -# Tunisia
    -
    -# From Gwillim Law (2005-04-30):
    -# My correspondent, Risto Nykänen, has alerted me to another adoption of DST,
    -# this time in Tunisia.  According to Yahoo France News
    -# , in a story attributed to AP
    -# and dated 2005-04-26, "Tunisia has decided to advance its official time by
    -# one hour, starting on Sunday, May 1.  Henceforth, Tunisian time will be
    -# UTC+2 instead of UTC+1.  The change will take place at 23:00 UTC next
    -# Saturday."  (My translation)
    -#
    -# From Oscar van Vlijmen (2005-05-02):
    -# La Presse, the first national daily newspaper ...
    -# http://www.lapresse.tn/archives/archives280405/actualites/lheure.html
    -# ... DST for 2005: on: Sun May 1 0h standard time, off: Fri Sept. 30,
    -# 1h standard time.
    -#
    -# From Atef Loukil (2006-03-28):
    -# The daylight saving time will be the same each year:
    -# Beginning      : the last Sunday of March at 02:00
    -# Ending         : the last Sunday of October at 03:00 ...
    -# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=1188&Itemid=50
    -
    -# From Steffen Thorsen (2009-03-16):
    -# According to several news sources, Tunisia will not observe DST this year.
    -# (Arabic)
    -# http://www.elbashayer.com/?page=viewn&nid=42546
    -# http://www.babnet.net/kiwidetail-15295.asp
    -#
    -# We have also confirmed this with the US embassy in Tunisia.
    -# We have a wrap-up about this on the following page:
    -# http://www.timeanddate.com/news/time/tunisia-cancels-dst-2009.html
    -
    -# From Alexander Krivenyshev (2009-03-17):
    -# Here is a link to Tunis Afrique Presse News Agency
    -#
    -# Standard time to be kept the whole year long (tap.info.tn):
    -#
    -# (in English)
    -# http://www.tap.info.tn/en/index.php?option=com_content&task=view&id=26813&Itemid=157
    -#
    -# (in Arabic)
    -# http://www.tap.info.tn/ar/index.php?option=com_content&task=view&id=61240&Itemid=1
    -
    -# From Arthur David Olson (2009-03-18):
    -# The Tunis Afrique Presse News Agency notice contains this: "This measure is
    -# due to the fact that the fasting month of Ramadan coincides with the period
    -# concerned by summer time.  Therefore, the standard time will be kept
    -# unchanged the whole year long."  So foregoing DST seems to be an exception
    -# (albeit one that may be repeated in the future).
    -
    -# From Alexander Krivenyshev (2010-03-27):
    -# According to some news reports Tunis confirmed not to use DST in 2010
    -#
    -# (translation):
    -# "The Tunisian government has decided to abandon DST, which was scheduled on
    -# Sunday...
    -# Tunisian authorities had suspended the DST for the first time last year also
    -# coincided with the month of Ramadan..."
    -#
    -# (in Arabic)
    -# http://www.moheet.com/show_news.aspx?nid=358861&pg=1
    -# http://www.almadenahnews.com/newss/news.php?c=118&id=38036
    -# http://www.worldtimezone.com/dst_news/dst_news_tunis02.html
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Tunisia	1939	only	-	Apr	15	23:00s	1:00	S
    -Rule	Tunisia	1939	only	-	Nov	18	23:00s	0	-
    -Rule	Tunisia	1940	only	-	Feb	25	23:00s	1:00	S
    -Rule	Tunisia	1941	only	-	Oct	 6	 0:00	0	-
    -Rule	Tunisia	1942	only	-	Mar	 9	 0:00	1:00	S
    -Rule	Tunisia	1942	only	-	Nov	 2	 3:00	0	-
    -Rule	Tunisia	1943	only	-	Mar	29	 2:00	1:00	S
    -Rule	Tunisia	1943	only	-	Apr	17	 2:00	0	-
    -Rule	Tunisia	1943	only	-	Apr	25	 2:00	1:00	S
    -Rule	Tunisia	1943	only	-	Oct	 4	 2:00	0	-
    -Rule	Tunisia	1944	1945	-	Apr	Mon>=1	 2:00	1:00	S
    -Rule	Tunisia	1944	only	-	Oct	 8	 0:00	0	-
    -Rule	Tunisia	1945	only	-	Sep	16	 0:00	0	-
    -Rule	Tunisia	1977	only	-	Apr	30	 0:00s	1:00	S
    -Rule	Tunisia	1977	only	-	Sep	24	 0:00s	0	-
    -Rule	Tunisia	1978	only	-	May	 1	 0:00s	1:00	S
    -Rule	Tunisia	1978	only	-	Oct	 1	 0:00s	0	-
    -Rule	Tunisia	1988	only	-	Jun	 1	 0:00s	1:00	S
    -Rule	Tunisia	1988	1990	-	Sep	lastSun	 0:00s	0	-
    -Rule	Tunisia	1989	only	-	Mar	26	 0:00s	1:00	S
    -Rule	Tunisia	1990	only	-	May	 1	 0:00s	1:00	S
    -Rule	Tunisia	2005	only	-	May	 1	 0:00s	1:00	S
    -Rule	Tunisia	2005	only	-	Sep	30	 1:00s	0	-
    -Rule	Tunisia	2006	2008	-	Mar	lastSun	 2:00s	1:00	S
    -Rule	Tunisia	2006	2008	-	Oct	lastSun	 2:00s	0	-
    -
    -# Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
    -# more precise 0:09:21.
    -# Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Africa/Tunis	0:40:44 -	LMT	1881 May 12
    -			0:09:21	-	PMT	1911 Mar 11 # Paris Mean Time
    -			1:00	Tunisia	CE%sT
    -
    -# Uganda
    -# See Africa/Nairobi.
    -
    -# Zambia
    -# Zimbabwe
    -# See Africa/Maputo.
    diff --git a/external/public-domain/tz/dist/antarctica b/external/public-domain/tz/dist/antarctica
    deleted file mode 100644
    index 2af088f0b..000000000
    --- a/external/public-domain/tz/dist/antarctica
    +++ /dev/null
    @@ -1,337 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# From Paul Eggert (1999-11-15):
    -# To keep things manageable, we list only locations occupied year-round; see
    -# COMNAP - Stations and Bases
    -# http://www.comnap.aq/comnap/comnap.nsf/P/Stations/
    -# and
    -# Summary of the Peri-Antarctic Islands (1998-07-23)
    -# http://www.spri.cam.ac.uk/bob/periant.htm
    -# for information.
    -# Unless otherwise specified, we have no time zone information.
    -#
    -# Except for the French entries,
    -# I made up all time zone abbreviations mentioned here; corrections welcome!
    -# FORMAT is 'zzz' and GMTOFF is 0 for locations while uninhabited.
    -
    -# Argentina - year-round bases
    -# Belgrano II, Confin Coast, -770227-0343737, since 1972-02-05
    -# Carlini, Potter Cove, King George Island, -6414-0602320, since 1982-01
    -# Esperanza, Hope Bay, -6323-05659, since 1952-12-17
    -# Marambio, -6414-05637, since 1969-10-29
    -# Orcadas, Laurie I, -6016-04444, since 1904-02-22
    -# San Martín, Barry I, -6808-06706, since 1951-03-21
    -#	(except 1960-03 / 1976-03-21)
    -
    -# Australia - territories
    -# Heard Island, McDonald Islands (uninhabited)
    -#	previously sealers and scientific personnel wintered
    -#	Margaret Turner reports
    -#	http://web.archive.org/web/20021204222245/http://www.dstc.qut.edu.au/DST/marg/daylight.html
    -#	(1999-09-30) that they're UTC+5, with no DST;
    -#	presumably this is when they have visitors.
    -#
    -# year-round bases
    -# Casey, Bailey Peninsula, -6617+11032, since 1969
    -# Davis, Vestfold Hills, -6835+07759, since 1957-01-13
    -#	(except 1964-11 - 1969-02)
    -# Mawson, Holme Bay, -6736+06253, since 1954-02-13
    -
    -# From Steffen Thorsen (2009-03-11):
    -# Three Australian stations in Antarctica have changed their time zone:
    -# Casey moved from UTC+8 to UTC+11
    -# Davis moved from UTC+7 to UTC+5
    -# Mawson moved from UTC+6 to UTC+5
    -# The changes occurred on 2009-10-18 at 02:00 (local times).
    -#
    -# Government source: (Australian Antarctic Division)
    -# http://www.aad.gov.au/default.asp?casid=37079
    -#
    -# We have more background information here:
    -# http://www.timeanddate.com/news/time/antarctica-new-times.html
    -
    -# From Steffen Thorsen (2010-03-10):
    -# We got these changes from the Australian Antarctic Division: ...
    -#
    -# - Casey station reverted to its normal time of UTC+8 on 5 March 2010.
    -# The change to UTC+11 is being considered as a regular summer thing but
    -# has not been decided yet.
    -#
    -# - Davis station will revert to its normal time of UTC+7 at 10 March 2010
    -# 20:00 UTC.
    -#
    -# - Mawson station stays on UTC+5.
    -#
    -# Background:
    -# http://www.timeanddate.com/news/time/antartica-time-changes-2010.html
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Antarctica/Casey	0	-	zzz	1969
    -			8:00	-	AWST	2009 Oct 18  2:00
    -						# Australian Western Std Time
    -			11:00	-	CAST	2010 Mar  5  2:00  # Casey Time
    -			8:00	-	AWST	2011 Oct 28  2:00
    -			11:00	-	CAST	2012 Feb 21 17:00u
    -			8:00	-	AWST
    -Zone Antarctica/Davis	0	-	zzz	1957 Jan 13
    -			7:00	-	DAVT	1964 Nov    # Davis Time
    -			0	-	zzz	1969 Feb
    -			7:00	-	DAVT	2009 Oct 18  2:00
    -			5:00	-	DAVT	2010 Mar 10 20:00u
    -			7:00	-	DAVT	2011 Oct 28  2:00
    -			5:00	-	DAVT	2012 Feb 21 20:00u
    -			7:00	-	DAVT
    -Zone Antarctica/Mawson	0	-	zzz	1954 Feb 13
    -			6:00	-	MAWT	2009 Oct 18  2:00 # Mawson Time
    -			5:00	-	MAWT
    -# References:
    -# Casey Weather (1998-02-26)
    -# http://www.antdiv.gov.au/aad/exop/sfo/casey/casey_aws.html
    -# Davis Station, Antarctica (1998-02-26)
    -# http://www.antdiv.gov.au/aad/exop/sfo/davis/video.html
    -# Mawson Station, Antarctica (1998-02-25)
    -# http://www.antdiv.gov.au/aad/exop/sfo/mawson/video.html
    -
    -# Belgium - year-round base
    -# Princess Elisabeth, Queen Maud Land, -713412+0231200, since 2007
    -
    -# Brazil - year-round base
    -# Ferraz, King George Island, -6205+05824, since 1983/4
    -
    -# Bulgaria - year-round base
    -# St. Kliment Ohridski, Livingston Island, -623829-0602153, since 1988
    -
    -# Chile - year-round bases and towns
    -# Escudero, South Shetland Is, -621157-0585735, since 1994
    -# Frei Montalva, King George Island, -6214-05848, since 1969-03-07
    -# O'Higgins, Antarctic Peninsula, -6319-05704, since 1948-02
    -# Prat, -6230-05941
    -# Villa Las Estrellas (a town), around the Frei base, since 1984-04-09
    -# These locations have always used Santiago time; use TZ='America/Santiago'.
    -
    -# China - year-round bases
    -# Great Wall, King George Island, -6213-05858, since 1985-02-20
    -# Zhongshan, Larsemann Hills, Prydz Bay, -6922+07623, since 1989-02-26
    -
    -# France - year-round bases (also see "France & Italy")
    -#
    -# From Antoine Leca (1997-01-20):
    -# Time data entries are from Nicole Pailleau at the IFRTP
    -# (French Institute for Polar Research and Technology).
    -# She confirms that French Southern Territories and Terre Adélie bases
    -# don't observe daylight saving time, even if Terre Adélie supplies came
    -# from Tasmania.
    -#
    -# French Southern Territories with year-round inhabitants
    -#
    -# Alfred Faure, Possession Island, Crozet Islands, -462551+0515152, since 1964;
    -#	sealing & whaling stations operated variously 1802/1911+;
    -#	see Indian/Reunion.
    -#
    -# Martin-de-Viviès, Amsterdam Island, -374105+0773155, since 1950
    -# Port-aux-Français, Kerguelen Islands, -492110+0701303, since 1951;
    -#	whaling & sealing station operated 1908/1914, 1920/1929, and 1951/1956
    -#
    -# St Paul Island - near Amsterdam, uninhabited
    -#	fishing stations operated variously 1819/1931
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Indian/Kerguelen	0	-	zzz	1950 # Port-aux-Français
    -			5:00	-	TFT	# ISO code TF Time
    -#
    -# year-round base in the main continent
    -# Dumont d'Urville, Île des Pétrels, -6640+14001, since 1956-11
    -#  (2005-12-05)
    -#
    -# Another base at Port-Martin, 50km east, began operation in 1947.
    -# It was destroyed by fire on 1952-01-14.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Antarctica/DumontDUrville 0 -	zzz	1947
    -			10:00	-	PMT	1952 Jan 14 # Port-Martin Time
    -			0	-	zzz	1956 Nov
    -			10:00	-	DDUT	# Dumont-d'Urville Time
    -
    -# France & Italy - year-round base
    -# Concordia, -750600+1232000, since 2005
    -
    -# Germany - year-round base
    -# Neumayer III, -704080-0081602, since 2009
    -
    -# India - year-round bases
    -# Bharati, -692428+0761114, since 2012
    -# Maitri, -704558+0114356, since 1989
    -
    -# Italy - year-round base (also see "France & Italy")
    -# Zuchelli, Terra Nova Bay, -744140+1640647, since 1986
    -
    -# Japan - year-round bases
    -# Syowa (also known as Showa), -690022+0393524, since 1957
    -#
    -# From Hideyuki Suzuki (1999-02-06):
    -# In all Japanese stations, +0300 is used as the standard time.
    -#
    -# Syowa station, which is the first antarctic station of Japan,
    -# was established on 1957-01-29.  Since Syowa station is still the main
    -# station of Japan, it's appropriate for the principal location.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Antarctica/Syowa	0	-	zzz	1957 Jan 29
    -			3:00	-	SYOT	# Syowa Time
    -# See:
    -# NIPR Antarctic Research Activities (1999-08-17)
    -# http://www.nipr.ac.jp/english/ara01.html
    -
    -# S Korea - year-round base
    -# Jang Bogo, Terra Nova Bay, -743700+1641205 since 2014
    -# King Sejong, King George Island, -6213-05847, since 1988
    -
    -# New Zealand - claims
    -# Balleny Islands (never inhabited)
    -# Scott Island (never inhabited)
    -#
    -# year-round base
    -# Scott Base, Ross Island, since 1957-01.
    -# See Pacific/Auckland.
    -
    -# Norway - territories
    -# Bouvet (never inhabited)
    -#
    -# claims
    -# Peter I Island (never inhabited)
    -#
    -# year-round base
    -# Troll, Queen Maud Land, -720041+0023206, since 2005-02-12
    -#
    -# From Paul-Inge Flakstad (2014-03-10):
    -# I recently had a long dialog about this with the developer of timegenie.com.
    -# In the absence of specific dates, he decided to choose some likely ones:
    -#   GMT +1 - From March 1 to the last Sunday in March
    -#   GMT +2 - From the last Sunday in March until the last Sunday in October
    -#   GMT +1 - From the last Sunday in October until November 7
    -#   GMT +0 - From November 7 until March 1
    -# The dates for switching to and from UTC+0 will probably not be absolutely
    -# correct, but they should be quite close to the actual dates.
    -#
    -# From Paul Eggert (2014-03-21):
    -# The CET-switching Troll rules require zic from tzcode 2014b or later, so as
    -# suggested by Bengt-Inge Larsson comment them out for now, and approximate
    -# with only UTC and CEST.  Uncomment them when 2014b is more prevalent.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -#Rule	Troll	2005	max	-	Mar	 1	1:00u	1:00	CET
    -Rule	Troll	2005	max	-	Mar	lastSun	1:00u	2:00	CEST
    -#Rule	Troll	2005	max	-	Oct	lastSun	1:00u	1:00	CET
    -#Rule	Troll	2004	max	-	Nov	 7	1:00u	0:00	UTC
    -# Remove the following line when uncommenting the above '#Rule' lines.
    -Rule	Troll	2004	max	-	Oct	lastSun	1:00u	0:00	UTC
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Antarctica/Troll	0	-	zzz	2005 Feb 12
    -			0:00	Troll	%s
    -
    -# Poland - year-round base
    -# Arctowski, King George Island, -620945-0582745, since 1977
    -
    -# Romania - year-bound base
    -# Law-Racoviță, Larsemann Hills, -692319+0762251, since 1986
    -
    -# Russia - year-round bases
    -# Bellingshausen, King George Island, -621159-0585337, since 1968-02-22
    -# Mirny, Davis coast, -6633+09301, since 1956-02
    -# Molodezhnaya, Alasheyev Bay, -6740+04551,
    -#	year-round from 1962-02 to 1999-07-01
    -# Novolazarevskaya, Queen Maud Land, -7046+01150,
    -#	year-round from 1960/61 to 1992
    -
    -# Vostok, since 1957-12-16, temporarily closed 1994-02/1994-11
    -# From Craig Mundell (1994-12-15):
    -# http://quest.arc.nasa.gov/antarctica/QA/computers/Directions,Time,ZIP
    -# Vostok, which is one of the Russian stations, is set on the same
    -# time as Moscow, Russia.
    -#
    -# From Lee Hotz (2001-03-08):
    -# I queried the folks at Columbia who spent the summer at Vostok and this is
    -# what they had to say about time there:
    -# "in the US Camp (East Camp) we have been on New Zealand (McMurdo)
    -# time, which is 12 hours ahead of GMT. The Russian Station Vostok was
    -# 6 hours behind that (although only 2 miles away, i.e. 6 hours ahead
    -# of GMT). This is a time zone I think two hours east of Moscow. The
    -# natural time zone is in between the two: 8 hours ahead of GMT."
    -#
    -# From Paul Eggert (2001-05-04):
    -# This seems to be hopelessly confusing, so I asked Lee Hotz about it
    -# in person.  He said that some Antarctic locations set their local
    -# time so that noon is the warmest part of the day, and that this
    -# changes during the year and does not necessarily correspond to mean
    -# solar noon.  So the Vostok time might have been whatever the clocks
    -# happened to be during their visit.  So we still don't really know what time
    -# it is at Vostok.  But we'll guess UTC+6.
    -#
    -Zone Antarctica/Vostok	0	-	zzz	1957 Dec 16
    -			6:00	-	VOST	# Vostok time
    -
    -# S Africa - year-round bases
    -# Marion Island, -4653+03752
    -# SANAE IV, Vesleskarvet, Queen Maud Land, -714022-0025026, since 1997
    -
    -# Ukraine - year-round base
    -# Vernadsky (formerly Faraday), Galindez Island, -651445-0641526, since 1954
    -
    -# United Kingdom
    -#
    -# British Antarctic Territories (BAT) claims
    -# South Orkney Islands
    -#	scientific station from 1903
    -#	whaling station at Signy I 1920/1926
    -# South Shetland Islands
    -#
    -# year-round bases
    -# Bird Island, South Georgia, -5400-03803, since 1983
    -# Deception Island, -6259-06034, whaling station 1912/1931,
    -#	scientific station 1943/1967,
    -#	previously sealers and a scientific expedition wintered by accident,
    -#	and a garrison was deployed briefly
    -# Halley, Coates Land, -7535-02604, since 1956-01-06
    -#	Halley is on a moving ice shelf and is periodically relocated
    -#	so that it is never more than 10km from its nominal location.
    -# Rothera, Adelaide Island, -6734-6808, since 1976-12-01
    -#
    -# From Paul Eggert (2002-10-22)
    -#  says Rothera is -03 all year.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Antarctica/Rothera	0	-	zzz	1976 Dec  1
    -			-3:00	-	ROTT	# Rothera time
    -
    -# Uruguay - year round base
    -# Artigas, King George Island, -621104-0585107
    -
    -# USA - year-round bases
    -#
    -# Palmer, Anvers Island, since 1965 (moved 2 miles in 1968)
    -# See 'southamerica' for Antarctica/Palmer, since it uses South American DST.
    -#
    -# McMurdo Station, Ross Island, since 1955-12
    -# Amundsen-Scott South Pole Station, continuously occupied since 1956-11-20
    -#
    -# From Chris Carrier (1996-06-27):
    -# Siple, the first commander of the South Pole station,
    -# stated that he would have liked to have kept GMT at the station,
    -# but that he found it more convenient to keep GMT+12
    -# as supplies for the station were coming from McMurdo Sound,
    -# which was on GMT+12 because New Zealand was on GMT+12 all year
    -# at that time (1957).  (Source: Siple's book 90 Degrees South.)
    -#
    -# From Susan Smith
    -# http://www.cybertours.com/whs/pole10.html
    -# (1995-11-13 16:24:56 +1300, no longer available):
    -# We use the same time as McMurdo does.
    -# And they use the same time as Christchurch, NZ does....
    -# One last quirk about South Pole time.
    -# All the electric clocks are usually wrong.
    -# Something about the generators running at 60.1hertz or something
    -# makes all of the clocks run fast.  So every couple of days,
    -# we have to go around and set them back 5 minutes or so.
    -# Maybe if we let them run fast all of the time, we'd get to leave here sooner!!
    -#
    -# See 'australasia' for Antarctica/McMurdo.
    diff --git a/external/public-domain/tz/dist/asia b/external/public-domain/tz/dist/asia
    deleted file mode 100644
    index 4f8756b87..000000000
    --- a/external/public-domain/tz/dist/asia
    +++ /dev/null
    @@ -1,2878 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# This file is by no means authoritative; if you think you know better,
    -# go ahead and edit the file (and please send any changes to
    -# tz@iana.org for general use in the future).  For more, please see
    -# the file CONTRIBUTING in the tz distribution.
    -
    -# From Paul Eggert (2015-08-08):
    -#
    -# Unless otherwise specified, the source for data through 1990 is:
    -# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
    -# San Diego: ACS Publications, Inc. (2003).
    -# Unfortunately this book contains many errors and cites no sources.
    -#
    -# Gwillim Law writes that a good source
    -# for recent time zone data is the International Air Transport
    -# Association's Standard Schedules Information Manual (IATA SSIM),
    -# published semiannually.  Law sent in several helpful summaries
    -# of the IATA's data after 1990.  Except where otherwise noted,
    -# IATA SSIM is the source for entries after 1990.
    -#
    -# Another source occasionally used is Edward W. Whitman, World Time Differences,
    -# Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
    -# I found in the UCLA library.
    -#
    -# For data circa 1899, a common source is:
    -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
    -# http://www.jstor.org/stable/1774359
    -#
    -# For Russian data circa 1919, a source is:
    -# Byalokoz EL. New Counting of Time in Russia since July 1, 1919.
    -# (See the 'europe' file for a fuller citation.)
    -#
    -# A reliable and entertaining source about time zones is
    -# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
    -#
    -# I invented the abbreviations marked '*' in the following table;
    -# the rest are from earlier versions of this file, or from other sources.
    -# Corrections are welcome!
    -#	     std  dst
    -#	     LMT	Local Mean Time
    -#	2:00 EET  EEST	Eastern European Time
    -#	2:00 IST  IDT	Israel
    -#	3:00 AST  ADT	Arabia*
    -#	3:30 IRST IRDT	Iran*
    -#	4:00 GST	Gulf*
    -#	5:30 IST	India
    -#	7:00 ICT	Indochina, most times and locations*
    -#	7:00 WIB	west Indonesia (Waktu Indonesia Barat)
    -#	8:00 WITA	central Indonesia (Waktu Indonesia Tengah)
    -#	8:00 CST	China
    -#	8:00 IDT	Indochina, 1943-45, 1947-55, 1960-75 (some locations)*
    -#	8:00 JWST	Western Standard Time (Japan, 1896/1937)*
    -#	8:30 KST  KDT	Korea when at +0830*
    -#	9:00 JCST	Central Standard Time (Japan, 1896/1937)
    -#	9:00 WIT	east Indonesia (Waktu Indonesia Timur)
    -#	9:00 JST  JDT	Japan
    -#	9:00 KST  KDT	Korea when at +09
    -#	9:30 ACST	Australian Central Standard Time
    -#
    -# See the 'europe' file for Russia and Turkey in Asia.
    -
    -# From Guy Harris:
    -# Incorporates data for Singapore from Robert Elz' asia 1.1, as well as
    -# additional information from Tom Yap, Sun Microsystems Intercontinental
    -# Technical Support (including a page from the Official Airline Guide -
    -# Worldwide Edition).  The names for time zones are guesses.
    -
    -###############################################################################
    -
    -# These rules are stolen from the 'europe' file.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	EUAsia	1981	max	-	Mar	lastSun	 1:00u	1:00	S
    -Rule	EUAsia	1979	1995	-	Sep	lastSun	 1:00u	0	-
    -Rule	EUAsia	1996	max	-	Oct	lastSun	 1:00u	0	-
    -Rule E-EurAsia	1981	max	-	Mar	lastSun	 0:00	1:00	S
    -Rule E-EurAsia	1979	1995	-	Sep	lastSun	 0:00	0	-
    -Rule E-EurAsia	1996	max	-	Oct	lastSun	 0:00	0	-
    -Rule RussiaAsia	1981	1984	-	Apr	1	 0:00	1:00	S
    -Rule RussiaAsia	1981	1983	-	Oct	1	 0:00	0	-
    -Rule RussiaAsia	1984	1991	-	Sep	lastSun	 2:00s	0	-
    -Rule RussiaAsia	1985	1991	-	Mar	lastSun	 2:00s	1:00	S
    -Rule RussiaAsia	1992	only	-	Mar	lastSat	23:00	1:00	S
    -Rule RussiaAsia	1992	only	-	Sep	lastSat	23:00	0	-
    -Rule RussiaAsia	1993	max	-	Mar	lastSun	 2:00s	1:00	S
    -Rule RussiaAsia	1993	1995	-	Sep	lastSun	 2:00s	0	-
    -Rule RussiaAsia	1996	max	-	Oct	lastSun	 2:00s	0	-
    -
    -# Afghanistan
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Kabul	4:36:48 -	LMT	1890
    -			4:00	-	AFT	1945
    -			4:30	-	AFT
    -
    -# Armenia
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger have Yerevan switching to 3:00 (with Russian DST)
    -# in spring 1991, then to 4:00 with no DST in fall 1995, then
    -# readopting Russian DST in 1997.  Go with Shanks & Pottenger, even
    -# when they disagree with others.  Edgar Der-Danieliantz
    -# reported (1996-05-04) that Yerevan probably wouldn't use DST
    -# in 1996, though it did use DST in 1995.  IATA SSIM (1991/1998) reports that
    -# Armenia switched from 3:00 to 4:00 in 1998 and observed DST after 1991,
    -# but started switching at 3:00s in 1998.
    -
    -# From Arthur David Olson (2011-06-15):
    -# While Russia abandoned DST in 2011, Armenia may choose to
    -# follow Russia's "old" rules.
    -
    -# From Alexander Krivenyshev (2012-02-10):
    -# According to News Armenia, on Feb 9, 2012,
    -# http://newsarmenia.ru/society/20120209/42609695.html
    -#
    -# The Armenia National Assembly adopted final reading of Amendments to the
    -# Law "On procedure of calculation time on the territory of the Republic of
    -# Armenia" according to which Armenia [is] abolishing Daylight Saving Time.
    -# or
    -# (brief)
    -# http://www.worldtimezone.com/dst_news/dst_news_armenia03.html
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Yerevan	2:58:00 -	LMT	1924 May  2
    -			3:00	-	YERT	1957 Mar    # Yerevan Time
    -			4:00 RussiaAsia YER%sT	1991 Mar 31  2:00s
    -			3:00	1:00	YERST	1991 Sep 23 # independence
    -			3:00 RussiaAsia	AM%sT	1995 Sep 24  2:00s
    -			4:00	-	AMT	1997
    -			4:00 RussiaAsia	AM%sT	2012 Mar 25  2:00s
    -			4:00	-	AMT
    -
    -# Azerbaijan
    -# From Rustam Aliyev of the Azerbaijan Internet Forum (2005-10-23):
    -# According to the resolution of Cabinet of Ministers, 1997
    -# Resolution available at: http://aif.az/docs/daylight_res.pdf
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Azer	1997	max	-	Mar	lastSun	 4:00	1:00	S
    -Rule	Azer	1997	max	-	Oct	lastSun	 5:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Baku	3:19:24 -	LMT	1924 May  2
    -			3:00	-	BAKT	1957 Mar    # Baku Time
    -			4:00 RussiaAsia BAK%sT	1991 Mar 31  2:00s
    -			3:00	1:00	BAKST	1991 Aug 30 # independence
    -			3:00 RussiaAsia	AZ%sT	1992 Sep lastSat 23:00
    -			4:00	-	AZT	1996     # Azerbaijan Time
    -			4:00	EUAsia	AZ%sT	1997
    -			4:00	Azer	AZ%sT
    -
    -# Bahrain
    -# See Asia/Qatar.
    -
    -# Bangladesh
    -# From Alexander Krivenyshev (2009-05-13):
    -# According to newspaper Asian Tribune (May 6, 2009) Bangladesh may introduce
    -# Daylight Saving Time from June 16 to Sept 30
    -#
    -# Bangladesh to introduce daylight saving time likely from June 16
    -# http://www.asiantribune.com/?q=node/17288
    -# http://www.worldtimezone.com/dst_news/dst_news_bangladesh02.html
    -#
    -# "... Bangladesh government has decided to switch daylight saving time from
    -# June
    -# 16 till September 30 in a bid to ensure maximum use of daylight to cope with
    -# crippling power crisis. "
    -#
    -# The switch will remain in effect from June 16 to Sept 30 (2009) but if
    -# implemented the next year, it will come in force from April 1, 2010
    -
    -# From Steffen Thorsen (2009-06-02):
    -# They have finally decided now, but changed the start date to midnight between
    -# the 19th and 20th, and they have not set the end date yet.
    -#
    -# Some sources:
    -# http://in.reuters.com/article/southAsiaNews/idINIndia-40017620090601
    -# http://bdnews24.com/details.php?id=85889&cid=2
    -#
    -# Our wrap-up:
    -# http://www.timeanddate.com/news/time/bangladesh-daylight-saving-2009.html
    -
    -# From A. N. M. Kamrus Saadat (2009-06-15):
    -# Finally we've got the official mail regarding DST start time where DST start
    -# time is mentioned as Jun 19 2009, 23:00 from BTRC (Bangladesh
    -# Telecommunication Regulatory Commission).
    -#
    -# No DST end date has been announced yet.
    -
    -# From Alexander Krivenyshev (2009-09-25):
    -# Bangladesh won't go back to Standard Time from October 1, 2009,
    -# instead it will continue DST measure till the cabinet makes a fresh decision.
    -#
    -# Following report by same newspaper-"The Daily Star Friday":
    -# "DST change awaits cabinet decision-Clock won't go back by 1-hr from Oct 1"
    -# http://www.thedailystar.net/newDesign/news-details.php?nid=107021
    -# http://www.worldtimezone.com/dst_news/dst_news_bangladesh04.html
    -
    -# From Steffen Thorsen (2009-10-13):
    -# IANS (Indo-Asian News Service) now reports:
    -# Bangladesh has decided that the clock advanced by an hour to make
    -# maximum use of daylight hours as an energy saving measure would
    -# "continue for an indefinite period."
    -#
    -# One of many places where it is published:
    -# http://www.thaindian.com/newsportal/business/bangladesh-to-continue-indefinitely-with-advanced-time_100259987.html
    -
    -# From Alexander Krivenyshev (2009-12-24):
    -# According to Bangladesh newspaper "The Daily Star,"
    -# Bangladesh will change its clock back to Standard Time on Dec 31, 2009.
    -#
    -# Clock goes back 1-hr on Dec 31 night.
    -# http://www.thedailystar.net/newDesign/news-details.php?nid=119228
    -# http://www.worldtimezone.com/dst_news/dst_news_bangladesh05.html
    -#
    -# "...The government yesterday decided to put the clock back by one hour
    -# on December 31 midnight and the new time will continue until March 31,
    -# 2010 midnight. The decision came at a cabinet meeting at the Prime
    -# Minister's Office last night..."
    -
    -# From Alexander Krivenyshev (2010-03-22):
    -# According to Bangladesh newspaper "The Daily Star,"
    -# Cabinet cancels Daylight Saving Time
    -# http://www.thedailystar.net/newDesign/latest_news.php?nid=22817
    -# http://www.worldtimezone.com/dst_news/dst_news_bangladesh06.html
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Dhaka	2009	only	-	Jun	19	23:00	1:00	S
    -Rule	Dhaka	2009	only	-	Dec	31	24:00	0	-
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Dhaka	6:01:40 -	LMT	1890
    -			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
    -			6:30	-	BURT	1942 May 15 # Burma Time
    -			5:30	-	IST	1942 Sep
    -			6:30	-	BURT	1951 Sep 30
    -			6:00	-	DACT	1971 Mar 26 # Dacca Time
    -			6:00	-	BDT	2009
    -			6:00	Dhaka	BD%sT
    -
    -# Bhutan
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Thimphu	5:58:36 -	LMT	1947 Aug 15 # or Thimbu
    -			5:30	-	IST	1987 Oct
    -			6:00	-	BTT	# Bhutan Time
    -
    -# British Indian Ocean Territory
    -# Whitman and the 1995 CIA time zone map say 5:00, but the
    -# 1997 and later maps say 6:00.  Assume the switch occurred in 1996.
    -# We have no information as to when standard time was introduced;
    -# assume it occurred in 1907, the same year as Mauritius (which
    -# then contained the Chagos Archipelago).
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Indian/Chagos	4:49:40	-	LMT	1907
    -			5:00	-	IOT	1996 # BIOT Time
    -			6:00	-	IOT
    -
    -# Brunei
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Brunei	7:39:40 -	LMT	1926 Mar # Bandar Seri Begawan
    -			7:30	-	BNT	1933
    -			8:00	-	BNT
    -
    -# Burma / Myanmar
    -
    -# Milne says 6:24:40 was the meridian of the time ball observatory at Rangoon.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Rangoon	6:24:40 -	LMT	1880        # or Yangon
    -			6:24:40	-	RMT	1920        # Rangoon Mean Time?
    -			6:30	-	BURT	1942 May    # Burma Time
    -			9:00	-	JST	1945 May  3
    -			6:30	-	MMT	# Myanmar Time
    -
    -# Cambodia
    -# See Asia/Bangkok.
    -
    -
    -# China
    -
    -# From Guy Harris:
    -# People's Republic of China.  Yes, they really have only one time zone.
    -
    -# From Bob Devine (1988-01-28):
    -# No they don't.  See TIME mag, 1986-02-17 p.52.  Even though
    -# China is across 4 physical time zones, before Feb 1, 1986 only the
    -# Peking (Beijing) time zone was recognized.  Since that date, China
    -# has two of 'em - Peking's and Ürümqi (named after the capital of
    -# the Xinjiang Uyghur Autonomous Region).  I don't know about DST for it.
    -#
    -# . . .I just deleted the DST table and this editor makes it too
    -# painful to suck in another copy.  So, here is what I have for
    -# DST start/end dates for Peking's time zone (info from AP):
    -#
    -#     1986 May 4 - Sept 14
    -#     1987 mid-April - ??
    -
    -# From U. S. Naval Observatory (1989-01-19):
    -# CHINA               8 H  AHEAD OF UTC  ALL OF CHINA, INCL TAIWAN
    -# CHINA               9 H  AHEAD OF UTC  APR 17 - SEP 10
    -
    -# From Paul Eggert (2008-02-11):
    -# Jim Mann, "A clumsy embrace for another western custom: China on daylight
    -# time - sort of", Los Angeles Times, 1986-05-05 ... [says] that China began
    -# observing daylight saving time in 1986.
    -
    -# From Paul Eggert (2014-06-30):
    -# Shanks & Pottenger have China switching to a single time zone in 1980, but
    -# this doesn't seem to be correct.  They also write that China observed summer
    -# DST from 1986 through 1991, which seems to match the above commentary, so
    -# go with them for DST rules as follows:
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Shang	1940	only	-	Jun	 3	0:00	1:00	D
    -Rule	Shang	1940	1941	-	Oct	 1	0:00	0	S
    -Rule	Shang	1941	only	-	Mar	16	0:00	1:00	D
    -Rule	PRC	1986	only	-	May	 4	0:00	1:00	D
    -Rule	PRC	1986	1991	-	Sep	Sun>=11	0:00	0	S
    -Rule	PRC	1987	1991	-	Apr	Sun>=10	0:00	1:00	D
    -
    -# From Anthony Fok (2001-12-20):
    -# BTW, I did some research on-line and found some info regarding these five
    -# historic timezones from some Taiwan websites.  And yes, there are official
    -# Chinese names for these locales (before 1949).
    -#
    -# From Jesper Nørgaard Welen (2006-07-14):
    -# I have investigated the timezones around 1970 on the
    -# http://www.astro.com/atlas site [with provinces and county
    -# boundaries summarized below]....  A few other exceptions were two
    -# counties on the Sichuan side of the Xizang-Sichuan border,
    -# counties Dege and Baiyu which lies on the Sichuan side and are
    -# therefore supposed to be GMT+7, Xizang region being GMT+6, but Dege
    -# county is GMT+8 according to astro.com while Baiyu county is GMT+6
    -# (could be true), for the moment I am assuming that those two
    -# counties are mistakes in the astro.com data.
    -
    -# From Paul Eggert (2014-06-30):
    -# Alois Treindl kindly sent me translations of the following two sources:
    -#
    -# (1)
    -# Guo Qingsheng (National Time-Service Center, CAS, Xi'an 710600, China)
    -# Beijing Time at the Beginning of the PRC
    -# China Historical Materials of Science and Technology
    -# (Zhongguo ke ji shi liao, ä¸­å›½ç§‘æŠ€å²æ–™), Vol. 24, No. 1 (2003)
    -# It gives evidence that at the beginning of the PRC, Beijing time was
    -# officially apparent solar time!  However, Guo also says that the
    -# evidence is dubious, as the relevant institute of astronomy had not
    -# been taken over by the PRC yet.  It's plausible that apparent solar
    -# time was announced but never implemented, and that people continued
    -# to use UT+8.  As the Shanghai radio station (and I presume the
    -# observatory) was still under control of French missionaries, it
    -# could well have ignored any such mandate.
    -#
    -# (2)
    -# Guo Qing-sheng (Shaanxi Astronomical Observatory, CAS, Xi'an 710600, China)
    -# A Study on the Standard Time Changes for the Past 100 Years in China
    -# [undated and unknown publication location]
    -# It says several things:
    -#   * The Qing dynasty used local apparent solar time throughout China.
    -#   * The Republic of China instituted Beijing mean solar time effective
    -#     the official calendar book of 1914.
    -#   * The French Concession in Shanghai set up signal stations in
    -#     French docks in the 1890s, controlled by Xujiahui (Zikawei)
    -#     Observatory and set to local mean time.
    -#   * "From the end of the 19th century" it changed to UT+8.
    -#   * Chinese Customs (by then reduced to a tool of foreign powers)
    -#     eventually standardized on this time for all ports, and it
    -#     became used by railways as well.
    -#   * In 1918 the Central Observatory proposed dividing China into
    -#     five time zones (see below for details).  This caught on
    -#     at first only in coastal areas observing UT+8.
    -#   * During WWII all of China was in theory was at UT+7.  In practice
    -#     this was ignored in the west, and I presume was ignored in
    -#     Japanese-occupied territory.
    -#   * Japanese-occupied Manchuria was at UT+9, i.e., Japan time.
    -#   * The five-zone plan was resurrected after WWII and officially put into
    -#     place (with some modifications) in March 1948.  It's not clear
    -#     how well it was observed in areas under Nationalist control.
    -#   * The People's Liberation Army used UT+8 during the civil war.
    -#
    -# An AP article "Shanghai Internat'l Area Little Changed" in the
    -# Lewiston (ME) Daily Sun (1939-05-29), p 17, said "Even the time is
    -# different - the occupied districts going by Tokyo time, an hour
    -# ahead of that prevailing in the rest of Shanghai."  Guess that the
    -# Xujiahui Observatory was under French control and stuck with UT+8.
    -#
    -# In earlier versions of this file, China had many separate Zone entries, but
    -# this was based on what were apparently incorrect data in Shanks & Pottenger.
    -# This has now been simplified to the two entries Asia/Shanghai and
    -# Asia/Urumqi, with the others being links for backward compatibility.
    -# Proposed in 1918 and theoretically in effect until 1949 (although in practice
    -# mainly observed in coastal areas), the five zones were:
    -#
    -# Changbai Time ("Long-white Time", Long-white = Heilongjiang area) UT+8.5
    -# Asia/Harbin (currently a link to Asia/Shanghai)
    -# Heilongjiang (except Mohe county), Jilin
    -#
    -# Zhongyuan Time ("Central plain Time") UT+8
    -# Asia/Shanghai
    -# most of China
    -# This currently represents most other zones as well,
    -# as apparently these regions have been the same since 1970.
    -# Milne gives 8:05:43.2 for Xujiahui Observatory time; round to nearest.
    -# Guo says Shanghai switched to UT+8 "from the end of the 19th century".
    -#
    -# Long-shu Time (probably due to Long and Shu being two names of that area) UT+7
    -# Asia/Chongqing (currently a link to Asia/Shanghai)
    -# Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan;
    -# most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong
    -# counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing,
    -# Yangchun, Yangjiang, Yu'nan, and Yunfu.
    -#
    -# Xin-zang Time ("Xinjiang-Tibet Time") UT+6
    -# Asia/Urumqi
    -# This currently represents Kunlun Time as well,
    -# as apparently the two regions have been the same since 1970.
    -# The Gansu counties Aksay, Anxi, Dunhuang, Subei; west Qinghai;
    -# the Guangdong counties  Xuwen, Haikang, Suixi, Lianjiang,
    -# Zhanjiang, Wuchuan, Huazhou, Gaozhou, Maoming, Dianbai, and Xinyi;
    -# east Tibet, including Lhasa, Chamdo, Shigaise, Jimsar, Shawan and Hutubi;
    -# east Xinjiang, including Ürümqi, Turpan, Karamay, Korla, Minfeng, Jinghe,
    -# Wusu, Qiemo, Xinyan, Wulanwusu, Jinghe, Yumin, Tacheng, Tuoli, Emin,
    -# Shihezi, Changji, Yanqi, Heshuo, Tuokexun, Tulufan, Shanshan, Hami,
    -# Fukang, Kuitun, Kumukuli, Miquan, Qitai, and Turfan.
    -#
    -# Kunlun Time UT+5.5
    -# Asia/Kashgar (currently a link to Asia/Urumqi)
    -# West Tibet, including Pulan, Aheqi, Shufu, Shule;
    -# West Xinjiang, including Aksu, Atushi, Yining, Hetian, Cele, Luopu, Nileke,
    -# Zhaosu, Tekesi, Gongliu, Chabuchaer, Huocheng, Bole, Pishan, Suiding,
    -# and Yarkand.
    -
    -# From Luther Ma (2009-10-17):
    -# Almost all (>99.9%) ethnic Chinese (properly ethnic Han) living in
    -# Xinjiang use Chinese Standard Time. Some are aware of Xinjiang time,
    -# but have no need of it. All planes, trains, and schools function on
    -# what is called "Beijing time." When Han make an appointment in Chinese
    -# they implicitly use Beijing time.
    -#
    -# On the other hand, ethnic Uyghurs, who make up about half the
    -# population of Xinjiang, typically use "Xinjiang time" which is two
    -# hours behind Beijing time, or UTC +0600. The government of the Xinjiang
    -# Uyghur Autonomous Region, (XAUR, or just Xinjiang for short) as well as
    -# local governments such as the Ürümqi city government use both times in
    -# publications, referring to what is popularly called Xinjiang time as
    -# "Ürümqi time." When Uyghurs make an appointment in the Uyghur language
    -# they almost invariably use Xinjiang time.
    -#
    -# (Their ethnic Han compatriots would typically have no clue of its
    -# widespread use, however, because so extremely few of them are fluent in
    -# Uyghur, comparable to the number of Anglo-Americans fluent in Navajo.)
    -#
    -# (...As with the rest of China there was a brief interval ending in 1990
    -# or 1991 when summer time was in use.  The confusion was severe, with
    -# the province not having dual times but four times in use at the same
    -# time. Some areas remained on standard Xinjiang time or Beijing time and
    -# others moving their clocks ahead.)
    -
    -# From Luther Ma (2009-11-19):
    -# With the risk of being redundant to previous answers these are the most common
    -# English "transliterations" (w/o using non-English symbols):
    -#
    -# 1. Wulumuqi...
    -# 2. Kashi...
    -# 3. Urumqi...
    -# 4. Kashgar...
    -# ...
    -# 5. It seems that Uyghurs in Ürümqi has been using Xinjiang since at least the
    -# 1960's. I know of one Han, now over 50, who grew up in the surrounding
    -# countryside and used Xinjiang time as a child.
    -#
    -# 6. Likewise for Kashgar and the rest of south Xinjiang I don't know of any
    -# start date for Xinjiang time.
    -#
    -# Without having access to local historical records, nor the ability to legally
    -# publish them, I would go with October 1, 1949, when Xinjiang became the Uyghur
    -# Autonomous Region under the PRC. (Before that Uyghurs, of course, would also
    -# not be using Beijing time, but some local time.)
    -
    -# From David Cochrane (2014-03-26):
    -# Just a confirmation that Ürümqi time was implemented in Ürümqi on 1 Feb 1986:
    -# http://content.time.com/time/magazine/article/0,9171,960684,00.html
    -
    -# From Luther Ma (2014-04-22):
    -# I have interviewed numerous people of various nationalities and from
    -# different localities in Xinjiang and can confirm the information in Guo's
    -# report regarding Xinjiang, as well as the Time article reference by David
    -# Cochrane.  Whether officially recognized or not (and both are officially
    -# recognized), two separate times have been in use in Xinjiang since at least
    -# the Cultural Revolution: Xinjiang Time (XJT), aka Ürümqi Time or local time;
    -# and Beijing Time.  There is no confusion in Xinjiang as to which name refers
    -# to which time. Both are widely used in the province, although in some
    -# population groups might be use one to the exclusion of the other.  The only
    -# problem is that computers and smart phones list Ürümqi (or Kashgar) as
    -# having the same time as Beijing.
    -
    -# From Paul Eggert (2014-06-30):
    -# In the early days of the PRC, Tibet was given its own time zone (UT+6) but
    -# this was withdrawn in 1959 and never reinstated; see Tubten Khétsun,
    -# Memories of life in Lhasa under Chinese Rule, Columbia U Press, ISBN
    -# 978-0231142861 (2008), translator's introduction by Matthew Akester, p x.
    -# As this is before our 1970 cutoff, Tibet doesn't need a separate zone.
    -#
    -# Xinjiang Time is well-documented as being officially recognized.  E.g., see
    -# "The Working-Calendar for The Xinjiang Uygur Autonomous Region Government"
    -#  (2014-04-22).
    -# Unfortunately, we have no good records of time in Xinjiang before 1986.
    -# During the 20th century parts of Xinjiang were ruled by the Qing dynasty,
    -# the Republic of China, various warlords, the First and Second East Turkestan
    -# Republics, the Soviet Union, the Kuomintang, and the People's Republic of
    -# China, and tracking down all these organizations' timekeeping rules would be
    -# quite a trick.  Approximate this lost history by a transition from LMT to
    -# XJT at the start of 1928, the year of accession of the warlord Jin Shuren,
    -# which happens to be the date given by Shanks & Pottenger (no doubt as a
    -# guess) as the transition from LMT.  Ignore the usage of UT+8 before
    -# 1986-02-01 under the theory that the transition date to UT+8 is unknown and
    -# that the sort of users who prefer Asia/Urumqi now typically ignored the
    -# UT+8 mandate back then.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -# Beijing time, used throughout China; represented by Shanghai.
    -Zone	Asia/Shanghai	8:05:43	-	LMT	1901
    -			8:00	Shang	C%sT	1949
    -			8:00	PRC	C%sT
    -# Xinjiang time, used by many in western China; represented by Ürümqi / Ürümchi
    -# / Wulumuqi.  (Please use Asia/Shanghai if you prefer Beijing time.)
    -Zone	Asia/Urumqi	5:50:20	-	LMT	1928
    -			6:00	-	XJT
    -
    -
    -# Hong Kong (Xianggang)
    -
    -# Milne gives 7:36:41.7; round this.
    -
    -# From Lee Yiu Chung (2009-10-24):
    -# I found there are some mistakes for the...DST rule for Hong
    -# Kong. [According] to the DST record from Hong Kong Observatory (actually,
    -# it is not [an] observatory, but the official meteorological agency of HK,
    -# and also serves as the official timing agency), there are some missing
    -# and incorrect rules. Although the exact switch over time is missing, I
    -# think 3:30 is correct. The official DST record for Hong Kong can be
    -# obtained from
    -# http://www.hko.gov.hk/gts/time/Summertime.htm
    -
    -# From Arthur David Olson (2009-10-28):
    -# Here are the dates given at
    -# http://www.hko.gov.hk/gts/time/Summertime.htm
    -# as of 2009-10-28:
    -# Year        Period
    -# 1941        1 Apr to 30 Sep
    -# 1942        Whole year
    -# 1943        Whole year
    -# 1944        Whole year
    -# 1945        Whole year
    -# 1946        20 Apr to 1 Dec
    -# 1947        13 Apr to 30 Dec
    -# 1948        2 May to 31 Oct
    -# 1949        3 Apr to 30 Oct
    -# 1950        2 Apr to 29 Oct
    -# 1951        1 Apr to 28 Oct
    -# 1952        6 Apr to 25 Oct
    -# 1953        5 Apr to 1 Nov
    -# 1954        21 Mar to 31 Oct
    -# 1955        20 Mar to 6 Nov
    -# 1956        18 Mar to 4 Nov
    -# 1957        24 Mar to 3 Nov
    -# 1958        23 Mar to 2 Nov
    -# 1959        22 Mar to 1 Nov
    -# 1960        20 Mar to 6 Nov
    -# 1961        19 Mar to 5 Nov
    -# 1962        18 Mar to 4 Nov
    -# 1963        24 Mar to 3 Nov
    -# 1964        22 Mar to 1 Nov
    -# 1965        18 Apr to 17 Oct
    -# 1966        17 Apr to 16 Oct
    -# 1967        16 Apr to 22 Oct
    -# 1968        21 Apr to 20 Oct
    -# 1969        20 Apr to 19 Oct
    -# 1970        19 Apr to 18 Oct
    -# 1971        18 Apr to 17 Oct
    -# 1972        16 Apr to 22 Oct
    -# 1973        22 Apr to 21 Oct
    -# 1973/74     30 Dec 73 to 20 Oct 74
    -# 1975        20 Apr to 19 Oct
    -# 1976        18 Apr to 17 Oct
    -# 1977        Nil
    -# 1978        Nil
    -# 1979        13 May to 21 Oct
    -# 1980 to Now Nil
    -# The page does not give start or end times of day.
    -# The page does not give a start date for 1942.
    -# The page does not givw an end date for 1945.
    -# The Japanese occupation of Hong Kong began on 1941-12-25.
    -# The Japanese surrender of Hong Kong was signed 1945-09-15.
    -# For lack of anything better, use start of those days as the transition times.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	HK	1941	only	-	Apr	1	3:30	1:00	S
    -Rule	HK	1941	only	-	Sep	30	3:30	0	-
    -Rule	HK	1946	only	-	Apr	20	3:30	1:00	S
    -Rule	HK	1946	only	-	Dec	1	3:30	0	-
    -Rule	HK	1947	only	-	Apr	13	3:30	1:00	S
    -Rule	HK	1947	only	-	Dec	30	3:30	0	-
    -Rule	HK	1948	only	-	May	2	3:30	1:00	S
    -Rule	HK	1948	1951	-	Oct	lastSun	3:30	0	-
    -Rule	HK	1952	only	-	Oct	25	3:30	0	-
    -Rule	HK	1949	1953	-	Apr	Sun>=1	3:30	1:00	S
    -Rule	HK	1953	only	-	Nov	1	3:30	0	-
    -Rule	HK	1954	1964	-	Mar	Sun>=18	3:30	1:00	S
    -Rule	HK	1954	only	-	Oct	31	3:30	0	-
    -Rule	HK	1955	1964	-	Nov	Sun>=1	3:30	0	-
    -Rule	HK	1965	1976	-	Apr	Sun>=16	3:30	1:00	S
    -Rule	HK	1965	1976	-	Oct	Sun>=16	3:30	0	-
    -Rule	HK	1973	only	-	Dec	30	3:30	1:00	S
    -Rule	HK	1979	only	-	May	Sun>=8	3:30	1:00	S
    -Rule	HK	1979	only	-	Oct	Sun>=16	3:30	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Hong_Kong	7:36:42 -	LMT	1904 Oct 30
    -			8:00	HK	HK%sT	1941 Dec 25
    -			9:00	-	JST	1945 Sep 15
    -			8:00	HK	HK%sT
    -
    -###############################################################################
    -
    -# Taiwan
    -
    -# From smallufo (2010-04-03):
    -# According to Taiwan's CWB [Central Weather Bureau],
    -# http://www.cwb.gov.tw/V6/astronomy/cdata/summert.htm
    -# Taipei has DST in 1979 between July 1st and Sep 30.
    -
    -# From Yu-Cheng Chuang (2013-07-12):
    -# On Dec 28, 1895, the Meiji Emperor announced Ordinance No. 167 of
    -# Meiji Year 28 "The clause about standard time", mentioned that
    -# Taiwan and Penghu Islands, as well as Yaeyama and Miyako Islands
    -# (both in Okinawa) adopt the Western Standard Time which is based on
    -# 120E. The adoption began from Jan 1, 1896. The original text can be
    -# found on Wikisource:
    -# http://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
    -# ... This could be the first adoption of time zone in Taiwan, because
    -# during the Qing Dynasty, it seems that there was no time zone
    -# declared officially.
    -#
    -# Later, in the beginning of World War II, on Sep 25, 1937, the Showa
    -# Emperor announced Ordinance No. 529 of Showa Year 12 "The clause of
    -# revision in the ordinance No. 167 of Meiji year 28 about standard
    -# time", in which abolished the adoption of Western Standard Time in
    -# western islands (listed above), which means the whole Japan
    -# territory, including later occupations, adopt Japan Central Time
    -# (UTC+9). The adoption began on Oct 1, 1937. The original text can
    -# be found on Wikisource:
    -# http://ja.wikisource.org/wiki/明治二å八年勅令第百六å七號標準時ニ關スル件中改正ノ件
    -#
    -# That is, the time zone of Taipei switched to UTC+9 on Oct 1, 1937.
    -
    -# From Yu-Cheng Chuang (2014-07-02):
    -# I've found more evidence about when the time zone was switched from UTC+9
    -# back to UTC+8 after WW2.  I believe it was on Sep 21, 1945.  In a document
    -# during Japanese era [1] in which the officer told the staff to change time
    -# zone back to Western Standard Time (UTC+8) on Sep 21.  And in another
    -# history page of National Cheng Kung University [2], on Sep 21 there is a
    -# note "from today, switch back to Western Standard Time".  From these two
    -# materials, I believe that the time zone change happened on Sep 21.  And
    -# today I have found another monthly journal called "The Astronomical Herald"
    -# from The Astronomical Society of Japan [3] in which it mentioned the fact
    -# that:
    -#
    -# 1. Standard Time of the Country (Japan) was adopted on Jan 1, 1888, using
    -# the time at 135E (GMT+9)
    -#
    -# 2. Standard Time of the Country was renamed to Central Standard Time, on Jan
    -# 1, 1898, and on the same day, the new territories Taiwan and Penghu islands,
    -# as well as Yaeyama and Miyako islands, adopted a new time zone called
    -# Western Standard Time, which is in GMT+8.
    -#
    -# 3. Western Standard Time was deprecated on Sep 30, 1937. From then all the
    -# territories of Japan adopted the same time zone, which is Central Standard
    -# Time.
    -#
    -# [1] Academica Historica, Taiwan:
    -# http://163.29.208.22:8080/govsaleShowImage/connect_img.php?s=00101738900090036&e=00101738900090037
    -# [2] Nat'l Cheng Kung University 70th Anniversary Special Site:
    -# http://www.ncku.edu.tw/~ncku70/menu/001/01_01.htm
    -# [3] Yukio Niimi, The Standard Time in Japan (1997), p.475:
    -# http://www.asj.or.jp/geppou/archive_open/1997/pdf/19971001c.pdf
    -
    -# Yu-Cheng Chuang (2014-07-03):
    -# I finally have found the real official gazette about changing back to
    -# Western Standard Time on Sep 21 in Taiwan.  It's Taiwan Governor-General
    -# Bulletin No. 386 in Showa 20 years (1945), published on Sep 19, 1945. [1] ...
    -# [It] abolishes Bulletin No. 207 in Showa 12 years (1937), which is a local
    -# bulletin in Taiwan for that Ordinance No. 529. It also mentioned that 1am on
    -# Sep 21, 1945 will be 12am on Sep 21.  I think this bulletin is much more
    -# official than the one I mentioned in my first mail, because it's from the
    -# top-level government in Taiwan. If you're going to quote any resource, this
    -# would be a good one.
    -# [1] Taiwan Governor-General Gazette, No. 1018, Sep 19, 1945:
    -# http://db2.th.gov.tw/db2/view/viewImg.php?imgcode=0072031018a&num=19&bgn=019&end=019&otherImg=&type=gener
    -
    -# From Yu-Cheng Chuang (2014-07-02):
    -# In 1946, DST in Taiwan was from May 15 and ended on Sep 30. The info from
    -# Central Weather Bureau website was not correct.
    -#
    -# Original Bulletin:
    -# http://subtpg.tpg.gov.tw/og/image2.asp?f=03502F0AKM1AF
    -# http://subtpg.tpg.gov.tw/og/image2.asp?f=0350300AKM1B0 (cont.)
    -#
    -# In 1947, DST in Taiwan was expanded to Oct 31. There is a backup of that
    -# telegram announcement from Taiwan Province Government:
    -#
    -# http://subtpg.tpg.gov.tw/og/image2.asp?f=0360310AKZ431
    -#
    -# Here is a brief translation:
    -#
    -#   The Summer Time this year is adopted from midnight Apr 15 until Sep 20
    -#   midnight. To save (energy?) consumption, we're expanding Summer Time
    -#   adoption till Oct 31 midnight.
    -#
    -# The Central Weather Bureau website didn't mention that, however it can
    -# be found from historical government announcement database.
    -
    -# From Paul Eggert (2014-07-03):
    -# As per Yu-Cheng Chuang, say that Taiwan was at UT+9 from 1937-10-01
    -# until 1945-09-21 at 01:00, overriding Shanks & Pottenger.
    -# Likewise, use Yu-Cheng Chuang's data for DST in Taiwan.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Taiwan	1946	only	-	May	15	0:00	1:00	D
    -Rule	Taiwan	1946	only	-	Oct	1	0:00	0	S
    -Rule	Taiwan	1947	only	-	Apr	15	0:00	1:00	D
    -Rule	Taiwan	1947	only	-	Nov	1	0:00	0	S
    -Rule	Taiwan	1948	1951	-	May	1	0:00	1:00	D
    -Rule	Taiwan	1948	1951	-	Oct	1	0:00	0	S
    -Rule	Taiwan	1952	only	-	Mar	1	0:00	1:00	D
    -Rule	Taiwan	1952	1954	-	Nov	1	0:00	0	S
    -Rule	Taiwan	1953	1959	-	Apr	1	0:00	1:00	D
    -Rule	Taiwan	1955	1961	-	Oct	1	0:00	0	S
    -Rule	Taiwan	1960	1961	-	Jun	1	0:00	1:00	D
    -Rule	Taiwan	1974	1975	-	Apr	1	0:00	1:00	D
    -Rule	Taiwan	1974	1975	-	Oct	1	0:00	0	S
    -Rule	Taiwan	1979	only	-	Jul	1	0:00	1:00	D
    -Rule	Taiwan	1979	only	-	Oct	1	0:00	0	S
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -# Taipei or Taibei or T'ai-pei
    -Zone	Asia/Taipei	8:06:00 -	LMT	1896 Jan  1
    -			8:00	-	JWST	1937 Oct  1
    -			9:00	-	JST	1945 Sep 21  1:00
    -			8:00	Taiwan	C%sT
    -
    -# Macau (Macao, Aomen)
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Macau	1961	1962	-	Mar	Sun>=16	3:30	1:00	S
    -Rule	Macau	1961	1964	-	Nov	Sun>=1	3:30	0	-
    -Rule	Macau	1963	only	-	Mar	Sun>=16	0:00	1:00	S
    -Rule	Macau	1964	only	-	Mar	Sun>=16	3:30	1:00	S
    -Rule	Macau	1965	only	-	Mar	Sun>=16	0:00	1:00	S
    -Rule	Macau	1965	only	-	Oct	31	0:00	0	-
    -Rule	Macau	1966	1971	-	Apr	Sun>=16	3:30	1:00	S
    -Rule	Macau	1966	1971	-	Oct	Sun>=16	3:30	0	-
    -Rule	Macau	1972	1974	-	Apr	Sun>=15	0:00	1:00	S
    -Rule	Macau	1972	1973	-	Oct	Sun>=15	0:00	0	-
    -Rule	Macau	1974	1977	-	Oct	Sun>=15	3:30	0	-
    -Rule	Macau	1975	1977	-	Apr	Sun>=15	3:30	1:00	S
    -Rule	Macau	1978	1980	-	Apr	Sun>=15	0:00	1:00	S
    -Rule	Macau	1978	1980	-	Oct	Sun>=15	0:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Macau	7:34:20 -	LMT	1912 Jan  1
    -			8:00	Macau	MO%sT	1999 Dec 20 # return to China
    -			8:00	PRC	C%sT
    -
    -
    -###############################################################################
    -
    -# Cyprus
    -#
    -# Milne says the Eastern Telegraph Company used 2:14:00.  Stick with LMT.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Cyprus	1975	only	-	Apr	13	0:00	1:00	S
    -Rule	Cyprus	1975	only	-	Oct	12	0:00	0	-
    -Rule	Cyprus	1976	only	-	May	15	0:00	1:00	S
    -Rule	Cyprus	1976	only	-	Oct	11	0:00	0	-
    -Rule	Cyprus	1977	1980	-	Apr	Sun>=1	0:00	1:00	S
    -Rule	Cyprus	1977	only	-	Sep	25	0:00	0	-
    -Rule	Cyprus	1978	only	-	Oct	2	0:00	0	-
    -Rule	Cyprus	1979	1997	-	Sep	lastSun	0:00	0	-
    -Rule	Cyprus	1981	1998	-	Mar	lastSun	0:00	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Nicosia	2:13:28 -	LMT	1921 Nov 14
    -			2:00	Cyprus	EE%sT	1998 Sep
    -			2:00	EUAsia	EE%sT
    -# IATA SSIM (1998-09) has Cyprus using EU rules for the first time.
    -
    -# Classically, Cyprus belongs to Asia; e.g. see Herodotus, Histories, I.72.
    -# However, for various reasons many users expect to find it under Europe.
    -Link	Asia/Nicosia	Europe/Nicosia
    -
    -# Georgia
    -# From Paul Eggert (1994-11-19):
    -# Today's _Economist_ (p 60) reports that Georgia moved its clocks forward
    -# an hour recently, due to a law proposed by Zurab Murvanidze,
    -# an MP who went on a hunger strike for 11 days to force discussion about it!
    -# We have no details, but we'll guess they didn't move the clocks back in fall.
    -#
    -# From Mathew Englander, quoting AP (1996-10-23 13:05-04):
    -# Instead of putting back clocks at the end of October, Georgia
    -# will stay on daylight savings time this winter to save energy,
    -# President Eduard Shevardnadze decreed Wednesday.
    -#
    -# From the BBC via Joseph S. Myers (2004-06-27):
    -#
    -# Georgia moved closer to Western Europe on Sunday...  The former Soviet
    -# republic has changed its time zone back to that of Moscow.  As a result it
    -# is now just four hours ahead of Greenwich Mean Time, rather than five hours
    -# ahead.  The switch was decreed by the pro-Western president of Georgia,
    -# Mikheil Saakashvili, who said the change was partly prompted by the process
    -# of integration into Europe.
    -
    -# From Teimuraz Abashidze (2005-11-07):
    -# Government of Georgia ... decided to NOT CHANGE daylight savings time on
    -# [Oct.] 30, as it was done before during last more than 10 years.
    -# Currently, we are in fact GMT +4:00, as before 30 October it was GMT
    -# +3:00.... The problem is, there is NO FORMAL LAW or governmental document
    -# about it.  As far as I can find, I was told, that there is no document,
    -# because we just DIDN'T ISSUE document about switching to winter time....
    -# I don't know what can be done, especially knowing that some years ago our
    -# DST rules where changed THREE TIMES during one month.
    -
    -# Milne 1899 says Tbilisi (Tiflis) time was 2:59:05.7.
    -# Byalokoz 1919 says Georgia was 2:59:11.
    -# Go with Byalokoz.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Tbilisi	2:59:11 -	LMT	1880
    -			2:59:11	-	TBMT	1924 May  2 # Tbilisi Mean Time
    -			3:00	-	TBIT	1957 Mar    # Tbilisi Time
    -			4:00 RussiaAsia TBI%sT	1991 Mar 31  2:00s
    -			3:00	1:00	TBIST	1991 Apr  9 # independence
    -			3:00 RussiaAsia GE%sT	1992        # Georgia Time
    -			3:00 E-EurAsia	GE%sT	1994 Sep lastSun
    -			4:00 E-EurAsia	GE%sT	1996 Oct lastSun
    -			4:00	1:00	GEST	1997 Mar lastSun
    -			4:00 E-EurAsia	GE%sT	2004 Jun 27
    -			3:00 RussiaAsia	GE%sT	2005 Mar lastSun  2:00
    -			4:00	-	GET
    -
    -# East Timor
    -
    -# See Indonesia for the 1945 transition.
    -
    -# From João Carrascalão, brother of the former governor of East Timor, in
    -# East Timor may be late for its millennium
    -#  (1999-12-26/31):
    -# Portugal tried to change the time forward in 1974 because the sun
    -# rises too early but the suggestion raised a lot of problems with the
    -# Timorese and I still don't think it would work today because it
    -# conflicts with their way of life.
    -
    -# From Paul Eggert (2000-12-04):
    -# We don't have any record of the above attempt.
    -# Most likely our records are incomplete, but we have no better data.
    -
    -# From Manoel de Almeida e Silva, Deputy Spokesman for the UN Secretary-General
    -# http://www.hri.org/news/world/undh/2000/00-08-16.undh.html
    -# (2000-08-16):
    -# The Cabinet of the East Timor Transition Administration decided
    -# today to advance East Timor's time by one hour.  The time change,
    -# which will be permanent, with no seasonal adjustment, will happen at
    -# midnight on Saturday, September 16.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Dili	8:22:20 -	LMT	1912 Jan  1
    -			8:00	-	TLT	1942 Feb 21 23:00 # E Timor Time
    -			9:00	-	JST	1945 Sep 23
    -			9:00	-	TLT	1976 May  3
    -			8:00	-	WITA	2000 Sep 17  0:00
    -			9:00	-	TLT
    -
    -# India
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Kolkata	5:53:28 -	LMT	1880        # Kolkata
    -			5:53:20	-	HMT	1941 Oct    # Howrah Mean Time?
    -			6:30	-	BURT	1942 May 15 # Burma Time
    -			5:30	-	IST	1942 Sep
    -			5:30	1:00	IST	1945 Oct 15
    -			5:30	-	IST
    -# The following are like Asia/Kolkata:
    -#	Andaman Is
    -#	Lakshadweep (Laccadive, Minicoy and Amindivi Is)
    -#	Nicobar Is
    -
    -# Indonesia
    -#
    -# From Paul Eggert (2014-09-06):
    -# The 1876 Report of the Secretary of the [US] Navy, p 306 says that Batavia
    -# civil time was 7:07:12.5; round to even for Jakarta.
    -#
    -# From Gwillim Law (2001-05-28), overriding Shanks & Pottenger:
    -# http://www.sumatera-inc.com/go_to_invest/about_indonesia.asp#standtime
    -# says that Indonesia's time zones changed on 1988-01-01.  Looking at some
    -# time zone maps, I think that must refer to Western Borneo (Kalimantan Barat
    -# and Kalimantan Tengah) switching from UTC+8 to UTC+7.
    -#
    -# From Paul Eggert (2007-03-10):
    -# Here is another correction to Shanks & Pottenger.
    -# JohnTWB writes that Japanese forces did not surrender control in
    -# Indonesia until 1945-09-01 00:00 at the earliest (in Jakarta) and
    -# other formal surrender ceremonies were September 9, 11, and 13, plus
    -# September 12 for the regional surrender to Mountbatten in Singapore.
    -# These would be the earliest possible times for a change.
    -# Régimes horaires pour le monde entier, by Henri Le Corre, (Éditions
    -# Traditionnelles, 1987, Paris) says that Java and Madura switched
    -# from JST to UTC+07:30 on 1945-09-23, and gives 1944-09-01 for Jayapura
    -# (Hollandia).  For now, assume all Indonesian locations other than Jayapura
    -# switched on 1945-09-23.
    -#
    -# From Paul Eggert (2013-08-11):
    -# Normally the tz database uses English-language abbreviations, but in
    -# Indonesia it's typical to use Indonesian-language abbreviations even
    -# when writing in English.  For example, see the English-language
    -# summary published by the Time and Frequency Laboratory of the
    -# Research Center for Calibration, Instrumentation and Metrology,
    -# Indonesia,  (2006-09-29).
    -# The abbreviations are:
    -#
    -# WIB  - UTC+7 - Waktu Indonesia Barat (Indonesia western time)
    -# WITA - UTC+8 - Waktu Indonesia Tengah (Indonesia central time)
    -# WIT  - UTC+9 - Waktu Indonesia Timur (Indonesia eastern time)
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -# Java, Sumatra
    -Zone Asia/Jakarta	7:07:12 -	LMT	1867 Aug 10
    -# Shanks & Pottenger say the next transition was at 1924 Jan 1 0:13,
    -# but this must be a typo.
    -			7:07:12	-	BMT	1923 Dec 31 23:47:12 # Batavia
    -			7:20	-	JAVT	1932 Nov    # Java Time
    -			7:30	-	WIB	1942 Mar 23
    -			9:00	-	JST	1945 Sep 23
    -			7:30	-	WIB	1948 May
    -			8:00	-	WIB	1950 May
    -			7:30	-	WIB	1964
    -			7:00	-	WIB
    -# west and central Borneo
    -Zone Asia/Pontianak	7:17:20	-	LMT	1908 May
    -			7:17:20	-	PMT	1932 Nov    # Pontianak MT
    -			7:30	-	WIB	1942 Jan 29
    -			9:00	-	JST	1945 Sep 23
    -			7:30	-	WIB	1948 May
    -			8:00	-	WIB	1950 May
    -			7:30	-	WIB	1964
    -			8:00	-	WITA	1988 Jan  1
    -			7:00	-	WIB
    -# Sulawesi, Lesser Sundas, east and south Borneo
    -Zone Asia/Makassar	7:57:36 -	LMT	1920
    -			7:57:36	-	MMT	1932 Nov    # Macassar MT
    -			8:00	-	WITA	1942 Feb  9
    -			9:00	-	JST	1945 Sep 23
    -			8:00	-	WITA
    -# Maluku Islands, West Papua, Papua
    -Zone Asia/Jayapura	9:22:48 -	LMT	1932 Nov
    -			9:00	-	WIT	1944 Sep  1
    -			9:30	-	ACST	1964
    -			9:00	-	WIT
    -
    -# Iran
    -
    -# From Roozbeh Pournader (2003-03-15):
    -# This is an English translation of what I just found (originally in Persian).
    -# The Gregorian dates in brackets are mine:
    -#
    -#	Official Newspaper No. 13548-1370/6/25 [1991-09-16]
    -#	No. 16760/T233 H				1370/6/10 [1991-09-01]
    -#
    -#	The Rule About Change of the Official Time of the Country
    -#
    -#	The Board of Ministers, in the meeting dated 1370/5/23 [1991-08-14],
    -#	based on the suggestion number 2221/D dated 1370/4/22 [1991-07-13]
    -#	of the Country's Organization for Official and Employment Affairs,
    -#	and referring to the law for equating the working hours of workers
    -#	and officers in the whole country dated 1359/4/23 [1980-07-14], and
    -#	for synchronizing the official times of the country, agreed that:
    -#
    -#	The official time of the country will should move forward one hour
    -#	at the 24[:00] hours of the first day of Farvardin and should return
    -#	to its previous state at the 24[:00] hours of the 30th day of
    -#	Shahrivar.
    -#
    -#	First Deputy to the President - Hassan Habibi
    -#
    -# From personal experience, that agrees with what has been followed
    -# for at least the last 5 years.  Before that, for a few years, the
    -# date used was the first Thursday night of Farvardin and the last
    -# Thursday night of Shahrivar, but I can't give exact dates....
    -# I have also changed the abbreviations to what is considered correct
    -# here in Iran, IRST for regular time and IRDT for daylight saving time.
    -#
    -# From Roozbeh Pournader (2005-04-05):
    -# The text of the Iranian law, in effect since 1925, clearly mentions
    -# that the true solar year is the measure, and there is no arithmetic
    -# leap year calculation involved.  There has never been any serious
    -# plan to change that law....
    -#
    -# From Paul Eggert (2006-03-22):
    -# Go with Shanks & Pottenger before Sept. 1991, and with Pournader thereafter.
    -# I used Ed Reingold's cal-persia in GNU Emacs 21.2 to check Persian dates,
    -# stopping after 2037 when 32-bit time_t's overflow.
    -# That cal-persia used Birashk's approximation, which disagrees with the solar
    -# calendar predictions for the year 2025, so I corrected those dates by hand.
    -#
    -# From Oscar van Vlijmen (2005-03-30), writing about future
    -# discrepancies between cal-persia and the Iranian calendar:
    -# For 2091 solar-longitude-after yields 2091-03-20 08:40:07.7 UT for
    -# the vernal equinox and that gets so close to 12:00 some local
    -# Iranian time that the definition of the correct location needs to be
    -# known exactly, amongst other factors.  2157 is even closer:
    -# 2157-03-20 08:37:15.5 UT.  But the Gregorian year 2025 should give
    -# no interpretation problem whatsoever.  By the way, another instant
    -# in the near future where there will be a discrepancy between
    -# arithmetical and astronomical Iranian calendars will be in 2058:
    -# vernal equinox on 2058-03-20 09:03:05.9 UT.  The Java version of
    -# Reingold's/Dershowitz' calculator gives correctly the Gregorian date
    -# 2058-03-21 for 1 Farvardin 1437 (astronomical).
    -#
    -# From Steffen Thorsen (2006-03-22):
    -# Several of my users have reported that Iran will not observe DST anymore:
    -# http://www.irna.ir/en/news/view/line-17/0603193812164948.htm
    -#
    -# From Reuters (2007-09-16), with a heads-up from Jesper Nørgaard Welen:
    -# ... the Guardian Council ... approved a law on Sunday to re-introduce
    -# daylight saving time ...
    -# http://uk.reuters.com/article/oilRpt/idUKBLA65048420070916
    -#
    -# From Roozbeh Pournader (2007-11-05):
    -# This is quoted from Official Gazette of the Islamic Republic of
    -# Iran, Volume 63, No. 18242, dated Tuesday 1386/6/24
    -# [2007-10-16]. I am doing the best translation I can:...
    -# The official time of the country will be moved forward for one hour
    -# on the 24 hours of the first day of the month of Farvardin and will
    -# be changed back to its previous state on the 24 hours of the
    -# thirtieth day of Shahrivar.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Iran	1978	1980	-	Mar	21	0:00	1:00	D
    -Rule	Iran	1978	only	-	Oct	21	0:00	0	S
    -Rule	Iran	1979	only	-	Sep	19	0:00	0	S
    -Rule	Iran	1980	only	-	Sep	23	0:00	0	S
    -Rule	Iran	1991	only	-	May	 3	0:00	1:00	D
    -Rule	Iran	1992	1995	-	Mar	22	0:00	1:00	D
    -Rule	Iran	1991	1995	-	Sep	22	0:00	0	S
    -Rule	Iran	1996	only	-	Mar	21	0:00	1:00	D
    -Rule	Iran	1996	only	-	Sep	21	0:00	0	S
    -Rule	Iran	1997	1999	-	Mar	22	0:00	1:00	D
    -Rule	Iran	1997	1999	-	Sep	22	0:00	0	S
    -Rule	Iran	2000	only	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2000	only	-	Sep	21	0:00	0	S
    -Rule	Iran	2001	2003	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2001	2003	-	Sep	22	0:00	0	S
    -Rule	Iran	2004	only	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2004	only	-	Sep	21	0:00	0	S
    -Rule	Iran	2005	only	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2005	only	-	Sep	22	0:00	0	S
    -Rule	Iran	2008	only	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2008	only	-	Sep	21	0:00	0	S
    -Rule	Iran	2009	2011	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2009	2011	-	Sep	22	0:00	0	S
    -Rule	Iran	2012	only	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2012	only	-	Sep	21	0:00	0	S
    -Rule	Iran	2013	2015	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2013	2015	-	Sep	22	0:00	0	S
    -Rule	Iran	2016	only	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2016	only	-	Sep	21	0:00	0	S
    -Rule	Iran	2017	2019	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2017	2019	-	Sep	22	0:00	0	S
    -Rule	Iran	2020	only	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2020	only	-	Sep	21	0:00	0	S
    -Rule	Iran	2021	2023	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2021	2023	-	Sep	22	0:00	0	S
    -Rule	Iran	2024	only	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2024	only	-	Sep	21	0:00	0	S
    -Rule	Iran	2025	2027	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2025	2027	-	Sep	22	0:00	0	S
    -Rule	Iran	2028	2029	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2028	2029	-	Sep	21	0:00	0	S
    -Rule	Iran	2030	2031	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2030	2031	-	Sep	22	0:00	0	S
    -Rule	Iran	2032	2033	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2032	2033	-	Sep	21	0:00	0	S
    -Rule	Iran	2034	2035	-	Mar	22	0:00	1:00	D
    -Rule	Iran	2034	2035	-	Sep	22	0:00	0	S
    -Rule	Iran	2036	2037	-	Mar	21	0:00	1:00	D
    -Rule	Iran	2036	2037	-	Sep	21	0:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Tehran	3:25:44	-	LMT	1916
    -			3:25:44	-	TMT	1946     # Tehran Mean Time
    -			3:30	-	IRST	1977 Nov
    -			4:00	Iran	IR%sT	1979
    -			3:30	Iran	IR%sT
    -
    -
    -# Iraq
    -#
    -# From Jonathan Lennox (2000-06-12):
    -# An article in this week's Economist ("Inside the Saddam-free zone", p. 50 in
    -# the U.S. edition) on the Iraqi Kurds contains a paragraph:
    -# "The three northern provinces ... switched their clocks this spring and
    -# are an hour ahead of Baghdad."
    -#
    -# But Rives McDow (2000-06-18) quotes a contact in Iraqi-Kurdistan as follows:
    -# In the past, some Kurdish nationalists, as a protest to the Iraqi
    -# Government, did not adhere to daylight saving time.  They referred
    -# to daylight saving as Saddam time.  But, as of today, the time zone
    -# in Iraqi-Kurdistan is on standard time with Baghdad, Iraq.
    -#
    -# So we'll ignore the Economist's claim.
    -
    -# From Steffen Thorsen (2008-03-10):
    -# The cabinet in Iraq abolished DST last week, according to the following
    -# news sources (in Arabic):
    -# http://www.aljeeran.net/wesima_articles/news-20080305-98602.html
    -# http://www.aswataliraq.info/look/article.tpl?id=2047&IdLanguage=17&IdPublication=4&NrArticle=71743&NrIssue=1&NrSection=10
    -#
    -# We have published a short article in English about the change:
    -# http://www.timeanddate.com/news/time/iraq-dumps-daylight-saving.html
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Iraq	1982	only	-	May	1	0:00	1:00	D
    -Rule	Iraq	1982	1984	-	Oct	1	0:00	0	S
    -Rule	Iraq	1983	only	-	Mar	31	0:00	1:00	D
    -Rule	Iraq	1984	1985	-	Apr	1	0:00	1:00	D
    -Rule	Iraq	1985	1990	-	Sep	lastSun	1:00s	0	S
    -Rule	Iraq	1986	1990	-	Mar	lastSun	1:00s	1:00	D
    -# IATA SSIM (1991/1996) says Apr 1 12:01am UTC; guess the ':01' is a typo.
    -# Shanks & Pottenger say Iraq did not observe DST 1992/1997; ignore this.
    -#
    -Rule	Iraq	1991	2007	-	Apr	 1	3:00s	1:00	D
    -Rule	Iraq	1991	2007	-	Oct	 1	3:00s	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Baghdad	2:57:40	-	LMT	1890
    -			2:57:36	-	BMT	1918     # Baghdad Mean Time?
    -			3:00	-	AST	1982 May
    -			3:00	Iraq	A%sT
    -
    -
    -###############################################################################
    -
    -# Israel
    -
    -# From Ephraim Silverberg (2001-01-11):
    -#
    -# I coined "IST/IDT" circa 1988.  Until then there were three
    -# different abbreviations in use:
    -#
    -# JST  Jerusalem Standard Time [Danny Braniss, Hebrew University]
    -# IZT  Israel Zonal (sic) Time [Prof. Haim Papo, Technion]
    -# EEST Eastern Europe Standard Time [used by almost everyone else]
    -#
    -# Since timezones should be called by country and not capital cities,
    -# I ruled out JST.  As Israel is in Asia Minor and not Eastern Europe,
    -# EEST was equally unacceptable.  Since "zonal" was not compatible with
    -# any other timezone abbreviation, I felt that 'IST' was the way to go
    -# and, indeed, it has received almost universal acceptance in timezone
    -# settings in Israeli computers.
    -#
    -# In any case, I am happy to share timezone abbreviations with India,
    -# high on my favorite-country list (and not only because my wife's
    -# family is from India).
    -
    -# From Shanks & Pottenger:
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Zion	1940	only	-	Jun	 1	0:00	1:00	D
    -Rule	Zion	1942	1944	-	Nov	 1	0:00	0	S
    -Rule	Zion	1943	only	-	Apr	 1	2:00	1:00	D
    -Rule	Zion	1944	only	-	Apr	 1	0:00	1:00	D
    -Rule	Zion	1945	only	-	Apr	16	0:00	1:00	D
    -Rule	Zion	1945	only	-	Nov	 1	2:00	0	S
    -Rule	Zion	1946	only	-	Apr	16	2:00	1:00	D
    -Rule	Zion	1946	only	-	Nov	 1	0:00	0	S
    -Rule	Zion	1948	only	-	May	23	0:00	2:00	DD
    -Rule	Zion	1948	only	-	Sep	 1	0:00	1:00	D
    -Rule	Zion	1948	1949	-	Nov	 1	2:00	0	S
    -Rule	Zion	1949	only	-	May	 1	0:00	1:00	D
    -Rule	Zion	1950	only	-	Apr	16	0:00	1:00	D
    -Rule	Zion	1950	only	-	Sep	15	3:00	0	S
    -Rule	Zion	1951	only	-	Apr	 1	0:00	1:00	D
    -Rule	Zion	1951	only	-	Nov	11	3:00	0	S
    -Rule	Zion	1952	only	-	Apr	20	2:00	1:00	D
    -Rule	Zion	1952	only	-	Oct	19	3:00	0	S
    -Rule	Zion	1953	only	-	Apr	12	2:00	1:00	D
    -Rule	Zion	1953	only	-	Sep	13	3:00	0	S
    -Rule	Zion	1954	only	-	Jun	13	0:00	1:00	D
    -Rule	Zion	1954	only	-	Sep	12	0:00	0	S
    -Rule	Zion	1955	only	-	Jun	11	2:00	1:00	D
    -Rule	Zion	1955	only	-	Sep	11	0:00	0	S
    -Rule	Zion	1956	only	-	Jun	 3	0:00	1:00	D
    -Rule	Zion	1956	only	-	Sep	30	3:00	0	S
    -Rule	Zion	1957	only	-	Apr	29	2:00	1:00	D
    -Rule	Zion	1957	only	-	Sep	22	0:00	0	S
    -Rule	Zion	1974	only	-	Jul	 7	0:00	1:00	D
    -Rule	Zion	1974	only	-	Oct	13	0:00	0	S
    -Rule	Zion	1975	only	-	Apr	20	0:00	1:00	D
    -Rule	Zion	1975	only	-	Aug	31	0:00	0	S
    -Rule	Zion	1985	only	-	Apr	14	0:00	1:00	D
    -Rule	Zion	1985	only	-	Sep	15	0:00	0	S
    -Rule	Zion	1986	only	-	May	18	0:00	1:00	D
    -Rule	Zion	1986	only	-	Sep	 7	0:00	0	S
    -Rule	Zion	1987	only	-	Apr	15	0:00	1:00	D
    -Rule	Zion	1987	only	-	Sep	13	0:00	0	S
    -
    -# From Avigdor Finkelstein (2014-03-05):
    -# I check the Parliament (Knesset) records and there it's stated that the
    -# [1988] transition should take place on Saturday night, when the Sabbath
    -# ends and changes to Sunday.
    -Rule	Zion	1988	only	-	Apr	10	0:00	1:00	D
    -Rule	Zion	1988	only	-	Sep	 4	0:00	0	S
    -
    -# From Ephraim Silverberg
    -# (1997-03-04, 1998-03-16, 1998-12-28, 2000-01-17, 2000-07-25, 2004-12-22,
    -# and 2005-02-17):
    -
    -# According to the Office of the Secretary General of the Ministry of
    -# Interior, there is NO set rule for Daylight-Savings/Standard time changes.
    -# One thing is entrenched in law, however: that there must be at least 150
    -# days of daylight savings time annually.  From 1993-1998, the change to
    -# daylight savings time was on a Friday morning from midnight IST to
    -# 1 a.m IDT; up until 1998, the change back to standard time was on a
    -# Saturday night from midnight daylight savings time to 11 p.m. standard
    -# time.  1996 is an exception to this rule where the change back to standard
    -# time took place on Sunday night instead of Saturday night to avoid
    -# conflicts with the Jewish New Year.  In 1999, the change to
    -# daylight savings time was still on a Friday morning but from
    -# 2 a.m. IST to 3 a.m. IDT; furthermore, the change back to standard time
    -# was also on a Friday morning from 2 a.m. IDT to 1 a.m. IST for
    -# 1999 only.  In the year 2000, the change to daylight savings time was
    -# similar to 1999, but although the change back will be on a Friday, it
    -# will take place from 1 a.m. IDT to midnight IST.  Starting in 2001, all
    -# changes to/from will take place at 1 a.m. old time, but now there is no
    -# rule as to what day of the week it will take place in as the start date
    -# (except in 2003) is the night after the Passover Seder (i.e. the eve
    -# of the 16th of Nisan in the lunar Hebrew calendar) and the end date
    -# (except in 2002) is three nights before Yom Kippur [Day of Atonement]
    -# (the eve of the 7th of Tishrei in the lunar Hebrew calendar).
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Zion	1989	only	-	Apr	30	0:00	1:00	D
    -Rule	Zion	1989	only	-	Sep	 3	0:00	0	S
    -Rule	Zion	1990	only	-	Mar	25	0:00	1:00	D
    -Rule	Zion	1990	only	-	Aug	26	0:00	0	S
    -Rule	Zion	1991	only	-	Mar	24	0:00	1:00	D
    -Rule	Zion	1991	only	-	Sep	 1	0:00	0	S
    -Rule	Zion	1992	only	-	Mar	29	0:00	1:00	D
    -Rule	Zion	1992	only	-	Sep	 6	0:00	0	S
    -Rule	Zion	1993	only	-	Apr	 2	0:00	1:00	D
    -Rule	Zion	1993	only	-	Sep	 5	0:00	0	S
    -
    -# The dates for 1994-1995 were obtained from Office of the Spokeswoman for the
    -# Ministry of Interior, Jerusalem, Israel.  The spokeswoman can be reached by
    -# calling the office directly at 972-2-6701447 or 972-2-6701448.
    -
    -# Rule	NAME    FROM    TO      TYPE    IN      ON      AT      SAVE    LETTER/S
    -Rule	Zion	1994	only	-	Apr	 1	0:00	1:00	D
    -Rule	Zion	1994	only	-	Aug	28	0:00	0	S
    -Rule	Zion	1995	only	-	Mar	31	0:00	1:00	D
    -Rule	Zion	1995	only	-	Sep	 3	0:00	0	S
    -
    -# The dates for 1996 were determined by the Minister of Interior of the
    -# time, Haim Ramon.  The official announcement regarding 1996-1998
    -# (with the dates for 1997-1998 no longer being relevant) can be viewed at:
    -#
    -#   ftp://ftp.cs.huji.ac.il/pub/tz/announcements/1996-1998.ramon.ps.gz
    -#
    -# The dates for 1997-1998 were altered by his successor, Rabbi Eli Suissa.
    -#
    -# The official announcements for the years 1997-1999 can be viewed at:
    -#
    -#   ftp://ftp.cs.huji.ac.il/pub/tz/announcements/YYYY.ps.gz
    -#
    -#       where YYYY is the relevant year.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Zion	1996	only	-	Mar	15	0:00	1:00	D
    -Rule	Zion	1996	only	-	Sep	16	0:00	0	S
    -Rule	Zion	1997	only	-	Mar	21	0:00	1:00	D
    -Rule	Zion	1997	only	-	Sep	14	0:00	0	S
    -Rule	Zion	1998	only	-	Mar	20	0:00	1:00	D
    -Rule	Zion	1998	only	-	Sep	 6	0:00	0	S
    -Rule	Zion	1999	only	-	Apr	 2	2:00	1:00	D
    -Rule	Zion	1999	only	-	Sep	 3	2:00	0	S
    -
    -# The Knesset Interior Committee has changed the dates for 2000 for
    -# the third time in just over a year and have set new dates for the
    -# years 2001-2004 as well.
    -#
    -# The official announcement for the start date of 2000 can be viewed at:
    -#
    -#	ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2000-start.ps.gz
    -#
    -# The official announcement for the end date of 2000 and the dates
    -# for the years 2001-2004 can be viewed at:
    -#
    -#	ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2000-2004.ps.gz
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Zion	2000	only	-	Apr	14	2:00	1:00	D
    -Rule	Zion	2000	only	-	Oct	 6	1:00	0	S
    -Rule	Zion	2001	only	-	Apr	 9	1:00	1:00	D
    -Rule	Zion	2001	only	-	Sep	24	1:00	0	S
    -Rule	Zion	2002	only	-	Mar	29	1:00	1:00	D
    -Rule	Zion	2002	only	-	Oct	 7	1:00	0	S
    -Rule	Zion	2003	only	-	Mar	28	1:00	1:00	D
    -Rule	Zion	2003	only	-	Oct	 3	1:00	0	S
    -Rule	Zion	2004	only	-	Apr	 7	1:00	1:00	D
    -Rule	Zion	2004	only	-	Sep	22	1:00	0	S
    -
    -# The proposed law agreed upon by the Knesset Interior Committee on
    -# 2005-02-14 is that, for 2005 and beyond, DST starts at 02:00 the
    -# last Friday before April 2nd (i.e. the last Friday in March or April
    -# 1st itself if it falls on a Friday) and ends at 02:00 on the Saturday
    -# night _before_ the fast of Yom Kippur.
    -#
    -# Those who can read Hebrew can view the announcement at:
    -#
    -#	ftp://ftp.cs.huji.ac.il/pub/tz/announcements/2005+beyond.ps
    -
    -# From Paul Eggert (2012-10-26):
    -# I used Ephraim Silverberg's dst-israel.el program
    -#  (2005-02-20)
    -# along with Ed Reingold's cal-hebrew in GNU Emacs 21.4,
    -# to generate the transitions from 2005 through 2012.
    -# (I replaced "lastFri" with "Fri>=26" by hand.)
    -# The spring transitions all correspond to the following Rule:
    -#
    -# Rule	Zion	2005	2012	-	Mar	Fri>=26	2:00	1:00	D
    -#
    -# but older zic implementations (e.g., Solaris 8) do not support
    -# "Fri>=26" to mean April 1 in years like 2005, so for now we list the
    -# springtime transitions explicitly.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Zion	2005	only	-	Apr	 1	2:00	1:00	D
    -Rule	Zion	2005	only	-	Oct	 9	2:00	0	S
    -Rule	Zion	2006	2010	-	Mar	Fri>=26	2:00	1:00	D
    -Rule	Zion	2006	only	-	Oct	 1	2:00	0	S
    -Rule	Zion	2007	only	-	Sep	16	2:00	0	S
    -Rule	Zion	2008	only	-	Oct	 5	2:00	0	S
    -Rule	Zion	2009	only	-	Sep	27	2:00	0	S
    -Rule	Zion	2010	only	-	Sep	12	2:00	0	S
    -Rule	Zion	2011	only	-	Apr	 1	2:00	1:00	D
    -Rule	Zion	2011	only	-	Oct	 2	2:00	0	S
    -Rule	Zion	2012	only	-	Mar	Fri>=26	2:00	1:00	D
    -Rule	Zion	2012	only	-	Sep	23	2:00	0	S
    -
    -# From Ephraim Silverberg (2013-06-27):
    -# On June 23, 2013, the Israeli government approved changes to the
    -# Time Decree Law.  The next day, the changes passed the First Reading
    -# in the Knesset.  The law is expected to pass the Second and Third
    -# (final) Readings by the beginning of September 2013.
    -#
    -# As of 2013, DST starts at 02:00 on the Friday before the last Sunday
    -# in March.  DST ends at 02:00 on the last Sunday of October.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Zion	2013	max	-	Mar	Fri>=23	2:00	1:00	D
    -Rule	Zion	2013	max	-	Oct	lastSun	2:00	0	S
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Jerusalem	2:20:54 -	LMT	1880
    -			2:20:40	-	JMT	1918 # Jerusalem Mean Time?
    -			2:00	Zion	I%sT
    -
    -
    -
    -###############################################################################
    -
    -# Japan
    -
    -# '9:00' and 'JST' is from Guy Harris.
    -
    -# From Paul Eggert (1995-03-06):
    -# Today's _Asahi Evening News_ (page 4) reports that Japan had
    -# daylight saving between 1948 and 1951, but "the system was discontinued
    -# because the public believed it would lead to longer working hours."
    -
    -# From Mayumi Negishi in the 2005-08-10 Japan Times:
    -# http://www.japantimes.co.jp/cgi-bin/getarticle.pl5?nn20050810f2.htm
    -# Occupation authorities imposed daylight-saving time on Japan on
    -# [1948-05-01]....  But lack of prior debate and the execution of
    -# daylight-saving time just three days after the bill was passed generated
    -# deep hatred of the concept....  The Diet unceremoniously passed a bill to
    -# dump the unpopular system in October 1951, less than a month after the San
    -# Francisco Peace Treaty was signed.  (A government poll in 1951 showed 53%
    -# of the Japanese wanted to scrap daylight-saving time, as opposed to 30% who
    -# wanted to keep it.)
    -
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger write that DST in Japan during those years was as follows:
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Japan	1948	only	-	May	Sun>=1	2:00	1:00	D
    -Rule	Japan	1948	1951	-	Sep	Sat>=8	2:00	0	S
    -Rule	Japan	1949	only	-	Apr	Sun>=1	2:00	1:00	D
    -Rule	Japan	1950	1951	-	May	Sun>=1	2:00	1:00	D
    -# but the only locations using it (for birth certificates, presumably, since
    -# their audience is astrologers) were US military bases.  For now, assume
    -# that for most purposes daylight-saving time was observed; otherwise, what
    -# would have been the point of the 1951 poll?
    -
    -# From Hideyuki Suzuki (1998-11-09):
    -# 'Tokyo' usually stands for the former location of Tokyo Astronomical
    -# Observatory: 139 degrees 44' 40.90" E (9h 18m 58.727s),
    -# 35 degrees 39' 16.0" N.
    -# This data is from 'Rika Nenpyou (Chronological Scientific Tables) 1996'
    -# edited by National Astronomical Observatory of Japan....
    -# JST (Japan Standard Time) has been used since 1888-01-01 00:00 (JST).
    -# The law is enacted on 1886-07-07.
    -
    -# From Hideyuki Suzuki (1998-11-16):
    -# The ordinance No. 51 (1886) established "standard time" in Japan,
    -# which stands for the time on 135 degrees E.
    -# In the ordinance No. 167 (1895), "standard time" was renamed to "central
    -# standard time".  And the same ordinance also established "western standard
    -# time", which stands for the time on 120 degrees E....  But "western standard
    -# time" was abolished in the ordinance No. 529 (1937).  In the ordinance No.
    -# 167, there is no mention regarding for what place western standard time is
    -# standard....
    -#
    -# I wrote "ordinance" above, but I don't know how to translate.
    -# In Japanese it's "chokurei", which means ordinance from emperor.
    -
    -# From Yu-Cheng Chuang (2013-07-12):
    -# ...the Meiji Emperor announced Ordinance No. 167 of Meiji Year 28 "The clause
    -# about standard time" ... The adoption began from Jan 1, 1896.
    -# http://ja.wikisource.org/wiki/標準時ニ關スル件_(公布時)
    -#
    -# ...the Showa Emperor announced Ordinance No. 529 of Showa Year 12 ... which
    -# means the whole Japan territory, including later occupations, adopt Japan
    -# Central Time (UTC+9). The adoption began on Oct 1, 1937.
    -# http://ja.wikisource.org/wiki/明治二å八年勅令第百六å七號標準時ニ關スル件中改正ノ件
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Tokyo	9:18:59	-	LMT	1887 Dec 31 15:00u
    -			9:00	-	JST	1896 Jan  1
    -			9:00	-	JCST	1937 Oct  1
    -			9:00	Japan	J%sT
    -# Since 1938, all Japanese possessions have been like Asia/Tokyo.
    -
    -# Jordan
    -#
    -# From 
    -# Jordan Week (1999-07-01) via Steffen Thorsen (1999-09-09):
    -# Clocks in Jordan were forwarded one hour on Wednesday at midnight,
    -# in accordance with the government's decision to implement summer time
    -# all year round.
    -#
    -# From 
    -# Jordan Week (1999-09-30) via Steffen Thorsen (1999-11-09):
    -# Winter time starts today Thursday, 30 September. Clocks will be turned back
    -# by one hour.  This is the latest government decision and it's final!
    -# The decision was taken because of the increase in working hours in
    -# government's departments from six to seven hours.
    -#
    -# From Paul Eggert (2005-11-22):
    -# Starting 2003 transitions are from Steffen Thorsen's web site timeanddate.com.
    -#
    -# From Steffen Thorsen (2005-11-23):
    -# For Jordan I have received multiple independent user reports every year
    -# about DST end dates, as the end-rule is different every year.
    -#
    -# From Steffen Thorsen (2006-10-01), after a heads-up from Hilal Malawi:
    -# http://www.petranews.gov.jo/nepras/2006/Sep/05/4000.htm
    -# "Jordan will switch to winter time on Friday, October 27".
    -#
    -
    -# From Steffen Thorsen (2009-04-02):
    -# This single one might be good enough, (2009-03-24, Arabic):
    -# http://petra.gov.jo/Artical.aspx?Lng=2&Section=8&Artical=95279
    -#
    -# Google's translation:
    -#
    -# > The Council of Ministers decided in 2002 to adopt the principle of timely
    -# > submission of the summer at 60 minutes as of midnight on the last Thursday
    -# > of the month of March of each year.
    -#
    -# So - this means the midnight between Thursday and Friday since 2002.
    -
    -# From Arthur David Olson (2009-04-06):
    -# We still have Jordan switching to DST on Thursdays in 2000 and 2001.
    -
    -# From Steffen Thorsen (2012-10-25):
    -# Yesterday the government in Jordan announced that they will not
    -# switch back to standard time this winter, so the will stay on DST
    -# until about the same time next year (at least).
    -# http://www.petra.gov.jo/Public_News/Nws_NewsDetails.aspx?NewsID=88950
    -
    -# From Steffen Thorsen (2013-12-11):
    -# Jordan Times and other sources say that Jordan is going back to
    -# UTC+2 on 2013-12-19 at midnight:
    -# http://jordantimes.com/govt-decides-to-switch-back-to-wintertime
    -# Official, in Arabic:
    -# http://www.petra.gov.jo/public_news/Nws_NewsDetails.aspx?Menu_ID=&Site_Id=2&lang=1&NewsID=133230&CatID=14
    -# ... Our background/permalink about it
    -# http://www.timeanddate.com/news/time/jordan-reverses-dst-decision.html
    -# ...
    -# http://www.petra.gov.jo/Public_News/Nws_NewsDetails.aspx?lang=2&site_id=1&NewsID=133313&Type=P
    -# ... says midnight for the coming one and 1:00 for the ones in the future
    -# (and they will use DST again next year, using the normal schedule).
    -
    -# From Paul Eggert (2013-12-11):
    -# As Steffen suggested, consider the past 21-month experiment to be DST.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Jordan	1973	only	-	Jun	6	0:00	1:00	S
    -Rule	Jordan	1973	1975	-	Oct	1	0:00	0	-
    -Rule	Jordan	1974	1977	-	May	1	0:00	1:00	S
    -Rule	Jordan	1976	only	-	Nov	1	0:00	0	-
    -Rule	Jordan	1977	only	-	Oct	1	0:00	0	-
    -Rule	Jordan	1978	only	-	Apr	30	0:00	1:00	S
    -Rule	Jordan	1978	only	-	Sep	30	0:00	0	-
    -Rule	Jordan	1985	only	-	Apr	1	0:00	1:00	S
    -Rule	Jordan	1985	only	-	Oct	1	0:00	0	-
    -Rule	Jordan	1986	1988	-	Apr	Fri>=1	0:00	1:00	S
    -Rule	Jordan	1986	1990	-	Oct	Fri>=1	0:00	0	-
    -Rule	Jordan	1989	only	-	May	8	0:00	1:00	S
    -Rule	Jordan	1990	only	-	Apr	27	0:00	1:00	S
    -Rule	Jordan	1991	only	-	Apr	17	0:00	1:00	S
    -Rule	Jordan	1991	only	-	Sep	27	0:00	0	-
    -Rule	Jordan	1992	only	-	Apr	10	0:00	1:00	S
    -Rule	Jordan	1992	1993	-	Oct	Fri>=1	0:00	0	-
    -Rule	Jordan	1993	1998	-	Apr	Fri>=1	0:00	1:00	S
    -Rule	Jordan	1994	only	-	Sep	Fri>=15	0:00	0	-
    -Rule	Jordan	1995	1998	-	Sep	Fri>=15	0:00s	0	-
    -Rule	Jordan	1999	only	-	Jul	 1	0:00s	1:00	S
    -Rule	Jordan	1999	2002	-	Sep	lastFri	0:00s	0	-
    -Rule	Jordan	2000	2001	-	Mar	lastThu	0:00s	1:00	S
    -Rule	Jordan	2002	2012	-	Mar	lastThu	24:00	1:00	S
    -Rule	Jordan	2003	only	-	Oct	24	0:00s	0	-
    -Rule	Jordan	2004	only	-	Oct	15	0:00s	0	-
    -Rule	Jordan	2005	only	-	Sep	lastFri	0:00s	0	-
    -Rule	Jordan	2006	2011	-	Oct	lastFri	0:00s	0	-
    -Rule	Jordan	2013	only	-	Dec	20	0:00	0	-
    -Rule	Jordan	2014	max	-	Mar	lastThu	24:00	1:00	S
    -Rule	Jordan	2014	max	-	Oct	lastFri	0:00s	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Amman	2:23:44 -	LMT	1931
    -			2:00	Jordan	EE%sT
    -
    -
    -# Kazakhstan
    -
    -# From Paul Eggert (1996-11-22):
    -# Andrew Evtichov (1996-04-13) writes that Kazakhstan
    -# stayed in sync with Moscow after 1990, and that Aqtobe (formerly Aktyubinsk)
    -# and Aqtau (formerly Shevchenko) are the largest cities in their zones.
    -# Guess that Aqtau and Aqtobe diverged in 1995, since that's the first time
    -# IATA SSIM mentions a third time zone in Kazakhstan.
    -
    -# From Paul Eggert (2006-03-22):
    -# German Iofis, ELSI, Almaty (2001-10-09) reports that Kazakhstan uses
    -# RussiaAsia rules, instead of switching at 00:00 as the IATA has it.
    -# Go with Shanks & Pottenger, who have them always using RussiaAsia rules.
    -# Also go with the following claims of Shanks & Pottenger:
    -#
    -# - Kazakhstan did not observe DST in 1991.
    -# - Qyzylorda switched from +5:00 to +6:00 on 1992-01-19 02:00.
    -# - Oral switched from +5:00 to +4:00 in spring 1989.
    -
    -# From Kazakhstan Embassy's News Bulletin No. 11
    -#  (2005-03-21):
    -# The Government of Kazakhstan passed a resolution March 15 abolishing
    -# daylight saving time citing lack of economic benefits and health
    -# complications coupled with a decrease in productivity.
    -#
    -# From Branislav Kojic (in Astana) via Gwillim Law (2005-06-28):
    -# ... what happened was that the former Kazakhstan Eastern time zone
    -# was "blended" with the Central zone.  Therefore, Kazakhstan now has
    -# two time zones, and difference between them is one hour.  The zone
    -# closer to UTC is the former Western zone (probably still called the
    -# same), encompassing four provinces in the west: Aqtobe, Atyrau,
    -# Mangghystau, and West Kazakhstan.  The other zone encompasses
    -# everything else....  I guess that would make Kazakhstan time zones
    -# de jure UTC+5 and UTC+6 respectively.
    -
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -#
    -# Almaty (formerly Alma-Ata), representing most locations in Kazakhstan
    -Zone	Asia/Almaty	5:07:48 -	LMT	1924 May  2 # or Alma-Ata
    -			5:00	-	ALMT	1930 Jun 21 # Alma-Ata Time
    -			6:00 RussiaAsia ALM%sT	1991
    -			6:00	-	ALMT	1992
    -			6:00 RussiaAsia	ALM%sT	2005 Mar 15
    -			6:00	-	ALMT
    -# Qyzylorda (aka Kyzylorda, Kizilorda, Kzyl-Orda, etc.)
    -Zone	Asia/Qyzylorda	4:21:52 -	LMT	1924 May  2
    -			4:00	-	KIZT	1930 Jun 21 # Kizilorda Time
    -			5:00	-	KIZT	1981 Apr  1
    -			5:00	1:00	KIZST	1981 Oct  1
    -			6:00	-	KIZT	1982 Apr  1
    -			5:00 RussiaAsia	KIZ%sT	1991
    -			5:00	-	KIZT	1991 Dec 16 # independence
    -			5:00	-	QYZT	1992 Jan 19  2:00
    -			6:00 RussiaAsia	QYZ%sT	2005 Mar 15
    -			6:00	-	QYZT
    -# Aqtobe (aka Aktobe, formerly Aktyubinsk)
    -Zone	Asia/Aqtobe	3:48:40	-	LMT	1924 May  2
    -			4:00	-	AKTT	1930 Jun 21 # Aktyubinsk Time
    -			5:00	-	AKTT	1981 Apr  1
    -			5:00	1:00	AKTST	1981 Oct  1
    -			6:00	-	AKTT	1982 Apr  1
    -			5:00 RussiaAsia	AKT%sT	1991
    -			5:00	-	AKTT	1991 Dec 16 # independence
    -			5:00 RussiaAsia	AQT%sT	2005 Mar 15 # Aqtobe Time
    -			5:00	-	AQTT
    -# Mangghystau
    -# Aqtau was not founded until 1963, but it represents an inhabited region,
    -# so include time stamps before 1963.
    -Zone	Asia/Aqtau	3:21:04	-	LMT	1924 May  2
    -			4:00	-	FORT	1930 Jun 21 # Fort Shevchenko T
    -			5:00	-	FORT	1963
    -			5:00	-	SHET	1981 Oct  1 # Shevchenko Time
    -			6:00	-	SHET	1982 Apr  1
    -			5:00 RussiaAsia	SHE%sT	1991
    -			5:00	-	SHET	1991 Dec 16 # independence
    -			5:00 RussiaAsia	AQT%sT	1995 Mar lastSun  2:00 # Aqtau Time
    -			4:00 RussiaAsia	AQT%sT	2005 Mar 15
    -			5:00	-	AQTT
    -# West Kazakhstan
    -Zone	Asia/Oral	3:25:24	-	LMT	1924 May  2 # or Ural'sk
    -			4:00	-	URAT	1930 Jun 21 # Ural'sk time
    -			5:00	-	URAT	1981 Apr  1
    -			5:00	1:00	URAST	1981 Oct  1
    -			6:00	-	URAT	1982 Apr  1
    -			5:00 RussiaAsia	URA%sT	1989 Mar 26  2:00
    -			4:00 RussiaAsia	URA%sT	1991
    -			4:00	-	URAT	1991 Dec 16 # independence
    -			4:00 RussiaAsia	ORA%sT	2005 Mar 15 # Oral Time
    -			5:00	-	ORAT
    -
    -# Kyrgyzstan (Kirgizstan)
    -# Transitions through 1991 are from Shanks & Pottenger.
    -
    -# From Paul Eggert (2005-08-15):
    -# According to an article dated today in the Kyrgyzstan Development Gateway
    -# http://eng.gateway.kg/cgi-bin/page.pl?id=1&story_name=doc9979.shtml
    -# Kyrgyzstan is canceling the daylight saving time system.  I take the article
    -# to mean that they will leave their clocks at 6 hours ahead of UTC.
    -# From Malik Abdugaliev (2005-09-21):
    -# Our government cancels daylight saving time 6th of August 2005.
    -# From 2005-08-12 our GMT-offset is +6, w/o any daylight saving.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Kyrgyz	1992	1996	-	Apr	Sun>=7	0:00s	1:00	S
    -Rule	Kyrgyz	1992	1996	-	Sep	lastSun	0:00	0	-
    -Rule	Kyrgyz	1997	2005	-	Mar	lastSun	2:30	1:00	S
    -Rule	Kyrgyz	1997	2004	-	Oct	lastSun	2:30	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Bishkek	4:58:24 -	LMT	1924 May  2
    -			5:00	-	FRUT	1930 Jun 21 # Frunze Time
    -			6:00 RussiaAsia FRU%sT	1991 Mar 31  2:00s
    -			5:00	1:00	FRUST	1991 Aug 31  2:00 # independence
    -			5:00	Kyrgyz	KG%sT	2005 Aug 12 # Kyrgyzstan Time
    -			6:00	-	KGT
    -
    -###############################################################################
    -
    -# Korea (North and South)
    -
    -# From Annie I. Bang (2006-07-10):
    -# http://www.koreaherald.com/view.php?ud=200607100012
    -# Korea ran a daylight saving program from 1949-61 but stopped it
    -# during the 1950-53 Korean War.  The system was temporarily enforced
    -# between 1987 and 1988 ...
    -
    -# From Sanghyuk Jung (2014-10-29):
    -# http://mm.icann.org/pipermail/tz/2014-October/021830.html
    -# According to the Korean Wikipedia
    -# http://ko.wikipedia.org/wiki/한국_표준시
    -# [oldid=12896437 2014-09-04 08:03 UTC]
    -# DST in Republic of Korea was as follows....  And I checked old
    -# newspapers in Korean, all articles correspond with data in Wikipedia.
    -# For example, the article in 1948 (Korean Language) proved that DST
    -# started at June 1 in that year.  For another example, the article in
    -# 1988 said that DST started at 2:00 AM in that year.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	ROK	1948	only	-	Jun	 1	0:00	1:00	D
    -Rule	ROK	1948	only	-	Sep	13	0:00	0	S
    -Rule	ROK	1949	only	-	Apr	 3	0:00	1:00	D
    -Rule	ROK	1949	1951	-	Sep	Sun>=8	0:00	0	S
    -Rule	ROK	1950	only	-	Apr	 1	0:00	1:00	D
    -Rule	ROK	1951	only	-	May	 6	0:00	1:00	D
    -Rule	ROK	1955	only	-	May	 5	0:00	1:00	D
    -Rule	ROK	1955	only	-	Sep	 9	0:00	0	S
    -Rule	ROK	1956	only	-	May	20	0:00	1:00	D
    -Rule	ROK	1956	only	-	Sep	30	0:00	0	S
    -Rule	ROK	1957	1960	-	May	Sun>=1	0:00	1:00	D
    -Rule	ROK	1957	1960	-	Sep	Sun>=18	0:00	0	S
    -Rule	ROK	1987	1988	-	May	Sun>=8	2:00	1:00	D
    -Rule	ROK	1987	1988	-	Oct	Sun>=8	3:00	0	S
    -
    -# From Paul Eggert (2014-10-30):
    -# The Korean Wikipedia entry gives the following sources for UT offsets:
    -#
    -# 1908: Official Journal Article No. 3994 (Edict No. 5)
    -# 1912: Governor-General of Korea Official Gazette Issue No. 367
    -#       (Announcement No. 338)
    -# 1954: Presidential Decree No. 876 (1954-03-17)
    -# 1961: Law No. 676 (1961-08-07)
    -# 1987: Law No. 3919 (1986-12-31)
    -#
    -# The Wikipedia entry also has confusing information about a change
    -# to UT+9 in April 1910, but then what would be the point of the later change
    -# to UT+9 on 1912-01-01?  Omit the 1910 change for now.
    -#
    -# I guessed that time zone abbreviations through 1945 followed the same
    -# rules as discussed under Taiwan, with nominal switches from JST to KST
    -# when the respective cities were taken over by the Allies after WWII.
    -#
    -# For Pyongyang we have no information; guess no changes since World War II.
    -
    -# From Steffen Thorsen (2015-08-07):
    -# According to many news sources, North Korea is going to change to
    -# the 8:30 time zone on August 15, one example:
    -# http://www.bbc.com/news/world-asia-33815049
    -#
    -# From Paul Eggert (2015-08-07):
    -# No transition time is specified; assume 00:00.
    -# There is no common English-language abbreviation for this time zone.
    -# Use %z rather than invent one.  We can't assume %z works everywhere yet,
    -# so for now substitute its output manually.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Seoul	8:27:52	-	LMT	1908 Apr  1
    -			8:30	-	KST	1912 Jan  1
    -			9:00	-	JCST	1937 Oct  1
    -			9:00	-	JST	1945 Sep  8
    -			9:00	-	KST	1954 Mar 21
    -			8:30	ROK	K%sT	1961 Aug 10
    -			9:00	ROK	K%sT
    -Zone	Asia/Pyongyang	8:23:00 -	LMT	1908 Apr  1
    -			8:30	-	KST	1912 Jan  1
    -			9:00	-	JCST	1937 Oct  1
    -			9:00	-	JST	1945 Aug 24
    -			9:00	-	KST	2015 Aug 15
    -			8:30	-	KST
    -
    -###############################################################################
    -
    -# Kuwait
    -# See Asia/Riyadh.
    -
    -# Laos
    -# See Asia/Bangkok.
    -
    -
    -# Lebanon
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Lebanon	1920	only	-	Mar	28	0:00	1:00	S
    -Rule	Lebanon	1920	only	-	Oct	25	0:00	0	-
    -Rule	Lebanon	1921	only	-	Apr	3	0:00	1:00	S
    -Rule	Lebanon	1921	only	-	Oct	3	0:00	0	-
    -Rule	Lebanon	1922	only	-	Mar	26	0:00	1:00	S
    -Rule	Lebanon	1922	only	-	Oct	8	0:00	0	-
    -Rule	Lebanon	1923	only	-	Apr	22	0:00	1:00	S
    -Rule	Lebanon	1923	only	-	Sep	16	0:00	0	-
    -Rule	Lebanon	1957	1961	-	May	1	0:00	1:00	S
    -Rule	Lebanon	1957	1961	-	Oct	1	0:00	0	-
    -Rule	Lebanon	1972	only	-	Jun	22	0:00	1:00	S
    -Rule	Lebanon	1972	1977	-	Oct	1	0:00	0	-
    -Rule	Lebanon	1973	1977	-	May	1	0:00	1:00	S
    -Rule	Lebanon	1978	only	-	Apr	30	0:00	1:00	S
    -Rule	Lebanon	1978	only	-	Sep	30	0:00	0	-
    -Rule	Lebanon	1984	1987	-	May	1	0:00	1:00	S
    -Rule	Lebanon	1984	1991	-	Oct	16	0:00	0	-
    -Rule	Lebanon	1988	only	-	Jun	1	0:00	1:00	S
    -Rule	Lebanon	1989	only	-	May	10	0:00	1:00	S
    -Rule	Lebanon	1990	1992	-	May	1	0:00	1:00	S
    -Rule	Lebanon	1992	only	-	Oct	4	0:00	0	-
    -Rule	Lebanon	1993	max	-	Mar	lastSun	0:00	1:00	S
    -Rule	Lebanon	1993	1998	-	Sep	lastSun	0:00	0	-
    -Rule	Lebanon	1999	max	-	Oct	lastSun	0:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Beirut	2:22:00 -	LMT	1880
    -			2:00	Lebanon	EE%sT
    -
    -# Malaysia
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	NBorneo	1935	1941	-	Sep	14	0:00	0:20	TS # one-Third Summer
    -Rule	NBorneo	1935	1941	-	Dec	14	0:00	0	-
    -#
    -# peninsular Malaysia
    -# taken from Mok Ly Yng (2003-10-30)
    -# http://www.math.nus.edu.sg/aslaksen/teaching/timezone.html
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Asia/Kuala_Lumpur	6:46:46 -	LMT	1901 Jan  1
    -			6:55:25	-	SMT	1905 Jun  1 # Singapore M.T.
    -			7:00	-	MALT	1933 Jan  1 # Malaya Time
    -			7:00	0:20	MALST	1936 Jan  1
    -			7:20	-	MALT	1941 Sep  1
    -			7:30	-	MALT	1942 Feb 16
    -			9:00	-	JST	1945 Sep 12
    -			7:30	-	MALT	1982 Jan  1
    -			8:00	-	MYT	# Malaysia Time
    -# Sabah & Sarawak
    -# From Paul Eggert (2014-08-12):
    -# The data entries here are mostly from Shanks & Pottenger, but the 1942, 1945
    -# and 1982 transition dates are from Mok Ly Yng.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Asia/Kuching	7:21:20	-	LMT	1926 Mar
    -			7:30	-	BORT	1933        # Borneo Time
    -			8:00	NBorneo	BOR%sT	1942 Feb 16
    -			9:00	-	JST	1945 Sep 12
    -			8:00	-	BORT	1982 Jan  1
    -			8:00	-	MYT
    -
    -# Maldives
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Indian/Maldives	4:54:00 -	LMT	1880 # Male
    -			4:54:00	-	MMT	1960 # Male Mean Time
    -			5:00	-	MVT	# Maldives Time
    -
    -# Mongolia
    -
    -# Shanks & Pottenger say that Mongolia has three time zones, but
    -# The USNO (1995-12-21) and the CIA map Standard Time Zones of the World
    -# (2005-03) both say that it has just one.
    -
    -# From Oscar van Vlijmen (1999-12-11):
    -# General Information Mongolia
    -#  (1999-09)
    -# "Time: Mongolia has two time zones. Three westernmost provinces of
    -# Bayan-Ölgii, Uvs, and Hovd are one hour earlier than the capital city, and
    -# the rest of the country follows the Ulaanbaatar time, which is UTC/GMT plus
    -# eight hours."
    -
    -# From Rives McDow (1999-12-13):
    -# Mongolia discontinued the use of daylight savings time in 1999; 1998
    -# being the last year it was implemented.  The dates of implementation I am
    -# unsure of, but most probably it was similar to Russia, except for the time
    -# of implementation may have been different....
    -# Some maps in the past have indicated that there was an additional time
    -# zone in the eastern part of Mongolia, including the provinces of Dornod,
    -# Sükhbaatar, and possibly Khentii.
    -
    -# From Paul Eggert (1999-12-15):
    -# Naming and spelling is tricky in Mongolia.
    -# We'll use Hovd (also spelled Chovd and Khovd) to represent the west zone;
    -# the capital of the Hovd province is sometimes called Hovd, sometimes Dund-Us,
    -# and sometimes Jirgalanta (with variant spellings), but the name Hovd
    -# is good enough for our purposes.
    -
    -# From Rives McDow (2001-05-13):
    -# In addition to Mongolia starting daylight savings as reported earlier
    -# (adopted DST on 2001-04-27 02:00 local time, ending 2001-09-28),
    -# there are three time zones.
    -#
    -# Provinces [at 7:00]: Bayan-Ölgii, Uvs, Khovd, Zavkhan, Govi-Altai
    -# Provinces [at 8:00]: Khövsgöl, Bulgan, Arkhangai, Khentii, Töv,
    -#	Bayankhongor, Övörkhangai, Dundgovi, Dornogovi, Ömnögovi
    -# Provinces [at 9:00]: Dornod, Sükhbaatar
    -#
    -# [The province of Selenge is omitted from the above lists.]
    -
    -# From Ganbold Ts., Ulaanbaatar (2004-04-17):
    -# Daylight saving occurs at 02:00 local time last Saturday of March.
    -# It will change back to normal at 02:00 local time last Saturday of
    -# September.... As I remember this rule was changed in 2001.
    -#
    -# From Paul Eggert (2004-04-17):
    -# For now, assume Rives McDow's informant got confused about Friday vs
    -# Saturday, and that his 2001 dates should have 1 added to them.
    -
    -# From Paul Eggert (2005-07-26):
    -# We have wildly conflicting information about Mongolia's time zones.
    -# Bill Bonnet (2005-05-19) reports that the US Embassy in Ulaanbaatar says
    -# there is only one time zone and that DST is observed, citing Microsoft
    -# Windows XP as the source.  Risto Nykänen (2005-05-16) reports that
    -# travelmongolia.org says there are two time zones (UTC+7, UTC+8) with no DST.
    -# Oscar van Vlijmen (2005-05-20) reports that the Mongolian Embassy in
    -# Washington, DC says there are two time zones, with DST observed.
    -# He also found
    -# http://ubpost.mongolnews.mn/index.php?subaction=showcomments&id=1111634894&archive=&start_from=&ucat=1&
    -# which also says that there is DST, and which has a comment by "Toddius"
    -# (2005-03-31 06:05 +0700) saying "Mongolia actually has 3.5 time zones.
    -# The West (OLGII) is +7 GMT, most of the country is ULAT is +8 GMT
    -# and some Eastern provinces are +9 GMT but Sükhbaatar Aimag is SUHK +8.5 GMT.
    -# The SUKH timezone is new this year, it is one of the few things the
    -# parliament passed during the tumultuous winter session."
    -# For now, let's ignore this information, until we have more confirmation.
    -
    -# From Ganbold Ts. (2007-02-26):
    -# Parliament of Mongolia has just changed the daylight-saving rule in February.
    -# They decided not to adopt daylight-saving time....
    -# http://www.mongolnews.mn/index.php?module=unuudur&sec=view&id=15742
    -
    -# From Deborah Goldsmith (2008-03-30):
    -# We received a bug report claiming that the tz database UTC offset for
    -# Asia/Choibalsan (GMT+09:00) is incorrect, and that it should be GMT
    -# +08:00 instead. Different sources appear to disagree with the tz
    -# database on this, e.g.:
    -#
    -# http://www.timeanddate.com/worldclock/city.html?n=1026
    -# http://www.worldtimeserver.com/current_time_in_MN.aspx
    -#
    -# both say GMT+08:00.
    -
    -# From Steffen Thorsen (2008-03-31):
    -# eznis airways, which operates several domestic flights, has a flight
    -# schedule here:
    -# http://www.eznis.com/Container.jsp?id=112
    -# (click the English flag for English)
    -#
    -# There it appears that flights between Choibalsan and Ulaanbaatar arrive
    -# about 1:35 - 1:50 hours later in local clock time, no matter the
    -# direction, while Ulaanbaatar-Khovd takes 2 hours in the Eastern
    -# direction and 3:35 back, which indicates that Ulaanbaatar and Khovd are
    -# in different time zones (like we know about), while Choibalsan and
    -# Ulaanbaatar are in the same time zone (correction needed).
    -
    -# From Arthur David Olson (2008-05-19):
    -# Assume that Choibalsan is indeed offset by 8:00.
    -# XXX--in the absence of better information, assume that transition
    -# was at the start of 2008-03-31 (the day of Steffen Thorsen's report);
    -# this is almost surely wrong.
    -
    -# From Ganbold Tsagaankhuu (2015-03-10):
    -# It seems like yesterday Mongolian Government meeting has concluded to use
    -# daylight saving time in Mongolia....  Starting at 2:00AM of last Saturday of
    -# March 2015, daylight saving time starts.  And 00:00AM of last Saturday of
    -# September daylight saving time ends.  Source:
    -# http://zasag.mn/news/view/8969
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Mongol	1983	1984	-	Apr	1	0:00	1:00	S
    -Rule	Mongol	1983	only	-	Oct	1	0:00	0	-
    -# Shanks & Pottenger and IATA SSIM say 1990s switches occurred at 00:00,
    -# but McDow says the 2001 switches occurred at 02:00.  Also, IATA SSIM
    -# (1996-09) says 1996-10-25.  Go with Shanks & Pottenger through 1998.
    -#
    -# Shanks & Pottenger say that the Sept. 1984 through Sept. 1990 switches
    -# in Choibalsan (more precisely, in Dornod and Sükhbaatar) took place
    -# at 02:00 standard time, not at 00:00 local time as in the rest of
    -# the country.  That would be odd, and possibly is a result of their
    -# correction of 02:00 (in the previous edition) not being done correctly
    -# in the latest edition; so ignore it for now.
    -
    -Rule	Mongol	1985	1998	-	Mar	lastSun	0:00	1:00	S
    -Rule	Mongol	1984	1998	-	Sep	lastSun	0:00	0	-
    -# IATA SSIM (1999-09) says Mongolia no longer observes DST.
    -Rule	Mongol	2001	only	-	Apr	lastSat	2:00	1:00	S
    -Rule	Mongol	2001	2006	-	Sep	lastSat	2:00	0	-
    -Rule	Mongol	2002	2006	-	Mar	lastSat	2:00	1:00	S
    -Rule	Mongol	2015	max	-	Mar	lastSat	2:00	1:00	S
    -Rule	Mongol	2015	max	-	Sep	lastSat	0:00	0	-
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -# Hovd, a.k.a. Chovd, Dund-Us, Dzhargalant, Khovd, Jirgalanta
    -Zone	Asia/Hovd	6:06:36 -	LMT	1905 Aug
    -			6:00	-	HOVT	1978     # Hovd Time
    -			7:00	Mongol	HOV%sT
    -# Ulaanbaatar, a.k.a. Ulan Bataar, Ulan Bator, Urga
    -Zone	Asia/Ulaanbaatar 7:07:32 -	LMT	1905 Aug
    -			7:00	-	ULAT	1978     # Ulaanbaatar Time
    -			8:00	Mongol	ULA%sT
    -# Choibalsan, a.k.a. Bajan Tümen, Bajan Tumen, Chojbalsan,
    -# Choybalsan, Sanbejse, Tchoibalsan
    -Zone	Asia/Choibalsan	7:38:00 -	LMT	1905 Aug
    -			7:00	-	ULAT	1978
    -			8:00	-	ULAT	1983 Apr
    -			9:00	Mongol	CHO%sT	2008 Mar 31 # Choibalsan Time
    -			8:00	Mongol	CHO%sT
    -
    -# Nepal
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Kathmandu	5:41:16 -	LMT	1920
    -			5:30	-	IST	1986
    -			5:45	-	NPT	# Nepal Time
    -
    -# Oman
    -# See Asia/Dubai.
    -
    -# Pakistan
    -
    -# From Rives McDow (2002-03-13):
    -# I have been advised that Pakistan has decided to adopt dst on a
    -# TRIAL basis for one year, starting 00:01 local time on April 7, 2002
    -# and ending at 00:01 local time October 6, 2002.  This is what I was
    -# told, but I believe that the actual time of change may be 00:00; the
    -# 00:01 was to make it clear which day it was on.
    -
    -# From Paul Eggert (2002-03-15):
    -# Jesper Nørgaard found this URL:
    -# http://www.pak.gov.pk/public/news/app/app06_dec.htm
    -# (dated 2001-12-06) which says that the Cabinet adopted a scheme "to
    -# advance the clocks by one hour on the night between the first
    -# Saturday and Sunday of April and revert to the original position on
    -# 15th October each year".  This agrees with McDow's 04-07 at 00:00,
    -# but disagrees about the October transition, and makes it sound like
    -# it's not on a trial basis.  Also, the "between the first Saturday
    -# and Sunday of April" phrase, if taken literally, means that the
    -# transition takes place at 00:00 on the first Sunday on or after 04-02.
    -
    -# From Paul Eggert (2003-02-09):
    -# DAWN  reported on 2002-10-05
    -# that 2002 DST ended that day at midnight.  Go with McDow for now.
    -
    -# From Steffen Thorsen (2003-03-14):
    -# According to http://www.dawn.com/2003/03/07/top15.htm
    -# there will be no DST in Pakistan this year:
    -#
    -# ISLAMABAD, March 6: Information and Media Development Minister Sheikh
    -# Rashid Ahmed on Thursday said the cabinet had reversed a previous
    -# decision to advance clocks by one hour in summer and put them back by
    -# one hour in winter with the aim of saving light hours and energy.
    -#
    -# The minister told a news conference that the experiment had rather
    -# shown 8 per cent higher consumption of electricity.
    -
    -# From Alex Krivenyshev (2008-05-15):
    -#
    -# Here is an article that Pakistan plan to introduce Daylight Saving Time
    -# on June 1, 2008 for 3 months.
    -#
    -# "... The federal cabinet on Wednesday announced a new conservation plan to
    -# help reduce load shedding by approving the closure of commercial centres at
    -# 9pm and moving clocks forward by one hour for the next three months. ...."
    -#
    -# http://www.worldtimezone.net/dst_news/dst_news_pakistan01.html
    -# http://www.dailytimes.com.pk/default.asp?page=2008%5C05%5C15%5Cstory_15-5-2008_pg1_4
    -
    -# From Arthur David Olson (2008-05-19):
    -# XXX--midnight transitions is a guess; 2008 only is a guess.
    -
    -# From Alexander Krivenyshev (2008-08-28):
    -# Pakistan government has decided to keep the watches one-hour advanced
    -# for another 2 months - plan to return to Standard Time on October 31
    -# instead of August 31.
    -#
    -# http://www.worldtimezone.com/dst_news/dst_news_pakistan02.html
    -# http://dailymailnews.com/200808/28/news/dmbrn03.html
    -
    -# From Alexander Krivenyshev (2009-04-08):
    -# Based on previous media reports that "... proposed plan to
    -# advance clocks by one hour from May 1 will cause disturbance
    -# to the working schedules rather than bringing discipline in
    -# official working."
    -# http://www.thenews.com.pk/daily_detail.asp?id=171280
    -#
    -# recent news that instead of May 2009 - Pakistan plan to
    -# introduce DST from April 15, 2009
    -#
    -# FYI: Associated Press Of Pakistan
    -# April 08, 2009
    -# Cabinet okays proposal to advance clocks by one hour from April 15
    -# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=73043&Itemid=1
    -# http://www.worldtimezone.com/dst_news/dst_news_pakistan05.html
    -#
    -# ....
    -# The Federal Cabinet on Wednesday approved the proposal to
    -# advance clocks in the country by one hour from April 15 to
    -# conserve energy"
    -
    -# From Steffen Thorsen (2009-09-17):
    -# "The News International," Pakistan reports that: "The Federal
    -# Government has decided to restore the previous time by moving the
    -# clocks backward by one hour from October 1. A formal announcement to
    -# this effect will be made after the Prime Minister grants approval in
    -# this regard."
    -# http://www.thenews.com.pk/updates.asp?id=87168
    -
    -# From Alexander Krivenyshev (2009-09-28):
    -# According to Associated Press Of Pakistan, it is confirmed that
    -# Pakistan clocks across the country would be turned back by an hour from
    -# October 1, 2009.
    -#
    -# "Clocks to go back one hour from 1 Oct"
    -# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=86715&Itemid=2
    -# http://www.worldtimezone.com/dst_news/dst_news_pakistan07.htm
    -#
    -# From Steffen Thorsen (2009-09-29):
    -# Now they seem to have changed their mind, November 1 is the new date:
    -# http://www.thenews.com.pk/top_story_detail.asp?Id=24742
    -# "The country's clocks will be reversed by one hour on November 1.
    -# Officials of Federal Ministry for Interior told this to Geo News on
    -# Monday."
    -#
    -# And more importantly, it seems that these dates will be kept every year:
    -# "It has now been decided that clocks will be wound forward by one hour
    -# on April 15 and reversed by an hour on November 1 every year without
    -# obtaining prior approval, the officials added."
    -#
    -# We have confirmed this year's end date with both with the Ministry of
    -# Water and Power and the Pakistan Electric Power Company:
    -# http://www.timeanddate.com/news/time/pakistan-ends-dst09.html
    -
    -# From Christoph Göhre (2009-10-01):
    -# [T]he German Consulate General in Karachi reported me today that Pakistan
    -# will go back to standard time on 1st of November.
    -
    -# From Steffen Thorsen (2010-03-26):
    -# Steffen Thorsen wrote:
    -# > On Thursday (2010-03-25) it was announced that DST would start in
    -# > Pakistan on 2010-04-01.
    -# >
    -# > Then today, the president said that they might have to revert the
    -# > decision if it is not supported by the parliament. So at the time
    -# > being, it seems unclear if DST will be actually observed or not - but
    -# > April 1 could be a more likely date than April 15.
    -# Now, it seems that the decision to not observe DST in final:
    -#
    -# "Govt Withdraws Plan To Advance Clocks"
    -# http://www.apakistannews.com/govt-withdraws-plan-to-advance-clocks-172041
    -#
    -# "People laud PM's announcement to end DST"
    -# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=99374&Itemid=2
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
    -Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
    -Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
    -Rule Pakistan	2008	2009	-	Nov	1	0:00	0	-
    -Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Karachi	4:28:12 -	LMT	1907
    -			5:30	-	IST	1942 Sep
    -			5:30	1:00	IST	1945 Oct 15
    -			5:30	-	IST	1951 Sep 30
    -			5:00	-	KART	1971 Mar 26 # Karachi Time
    -			5:00 Pakistan	PK%sT	# Pakistan Time
    -
    -# Palestine
    -
    -# From Amos Shapir (1998-02-15):
    -#
    -# From 1917 until 1948-05-15, all of Palestine, including the parts now
    -# known as the Gaza Strip and the West Bank, was under British rule.
    -# Therefore the rules given for Israel for that period, apply there too...
    -#
    -# The Gaza Strip was under Egyptian rule between 1948-05-15 until 1967-06-05
    -# (except a short occupation by Israel from 1956-11 till 1957-03, but no
    -# time zone was affected then).  It was never formally annexed to Egypt,
    -# though.
    -#
    -# The rest of Palestine was under Jordanian rule at that time, formally
    -# annexed in 1950 as the West Bank (and the word "Trans" was dropped from
    -# the country's previous name of "the Hashemite Kingdom of the
    -# Trans-Jordan").  So the rules for Jordan for that time apply.  Major
    -# towns in that area are Nablus (Shchem), El-Halil (Hebron), Ramallah, and
    -# East Jerusalem.
    -#
    -# Both areas were occupied by Israel in June 1967, but not annexed (except
    -# for East Jerusalem).  They were on Israel time since then; there might
    -# have been a Military Governor's order about time zones, but I'm not aware
    -# of any (such orders may have been issued semi-annually whenever summer
    -# time was in effect, but maybe the legal aspect of time was just neglected).
    -#
    -# The Palestinian Authority was established in 1993, and got hold of most
    -# towns in the West Bank and Gaza by 1995.  I know that in order to
    -# demonstrate...independence, they have been switching to
    -# summer time and back on a different schedule than Israel's, but I don't
    -# know when this was started, or what algorithm is used (most likely the
    -# Jordanian one).
    -#
    -# To summarize, the table should probably look something like that:
    -#
    -# Area \ when | 1918-1947 | 1948-1967 | 1967-1995 | 1996-
    -# ------------+-----------+-----------+-----------+-----------
    -# Israel      | Zion      | Zion      | Zion      | Zion
    -# West bank   | Zion      | Jordan    | Zion      | Jordan
    -# Gaza        | Zion      | Egypt     | Zion      | Jordan
    -#
    -# I guess more info may be available from the PA's web page (if/when they
    -# have one).
    -
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger write that Gaza did not observe DST until 1957, but go
    -# with Shapir and assume that it observed DST from 1940 through 1947,
    -# and that it used Jordanian rules starting in 1996.
    -# We don't yet need a separate entry for the West Bank, since
    -# the only differences between it and Gaza that we know about
    -# occurred before our cutoff date of 1970.
    -# However, as we get more information, we may need to add entries
    -# for parts of the West Bank as they transitioned from Israel's rules
    -# to Palestine's rules.
    -
    -# From IINS News Service - Israel - 1998-03-23 10:38:07 Israel time,
    -# forwarded by Ephraim Silverberg:
    -#
    -# Despite the fact that Israel changed over to daylight savings time
    -# last week, the PLO Authority (PA) has decided not to turn its clocks
    -# one-hour forward at this time.  As a sign of independence from Israeli rule,
    -# the PA has decided to implement DST in April.
    -
    -# From Paul Eggert (1999-09-20):
    -# Daoud Kuttab writes in Holiday havoc
    -# http://www.jpost.com/com/Archive/22.Apr.1999/Opinion/Article-2.html
    -# (Jerusalem Post, 1999-04-22) that
    -# the Palestinian National Authority changed to DST on 1999-04-15.
    -# I vaguely recall that they switch back in October (sorry, forgot the source).
    -# For now, let's assume that the spring switch was at 24:00,
    -# and that they switch at 0:00 on the 3rd Fridays of April and October.
    -
    -# From Paul Eggert (2005-11-22):
    -# Starting 2004 transitions are from Steffen Thorsen's web site timeanddate.com.
    -
    -# From Steffen Thorsen (2005-11-23):
    -# A user from Gaza reported that Gaza made the change early because of
    -# the Ramadan.  Next year Ramadan will be even earlier, so I think
    -# there is a good chance next year's end date will be around two weeks
    -# earlier - the same goes for Jordan.
    -
    -# From Steffen Thorsen (2006-08-17):
    -# I was informed by a user in Bethlehem that in Bethlehem it started the
    -# same day as Israel, and after checking with other users in the area, I
    -# was informed that they started DST one day after Israel.  I was not
    -# able to find any authoritative sources at the time, nor details if
    -# Gaza changed as well, but presumed Gaza to follow the same rules as
    -# the West Bank.
    -
    -# From Steffen Thorsen (2006-09-26):
    -# according to the Palestine News Network (2006-09-19):
    -# http://english.pnn.ps/index.php?option=com_content&task=view&id=596&Itemid=5
    -# > The Council of Ministers announced that this year its winter schedule
    -# > will begin early, as of midnight Thursday.  It is also time to turn
    -# > back the clocks for winter.  Friday will begin an hour late this week.
    -# I guess it is likely that next year's date will be moved as well,
    -# because of the Ramadan.
    -
    -# From Jesper Nørgaard Welen (2007-09-18):
    -# According to Steffen Thorsen's web site the Gaza Strip and the rest of the
    -# Palestinian territories left DST early on 13.th. of September at 2:00.
    -
    -# From Paul Eggert (2007-09-20):
    -# My understanding is that Gaza and the West Bank disagree even over when
    -# the weekend is (Thursday+Friday versus Friday+Saturday), so I'd be a bit
    -# surprised if they agreed about DST.  But for now, assume they agree.
    -# For lack of better information, predict that future changes will be
    -# the 2nd Thursday of September at 02:00.
    -
    -# From Alexander Krivenyshev (2008-08-28):
    -# Here is an article, that Mideast running on different clocks at Ramadan.
    -#
    -# Gaza Strip (as Egypt) ended DST at midnight Thursday (Aug 28, 2008), while
    -# the West Bank will end Daylight Saving Time at midnight Sunday (Aug 31, 2008).
    -#
    -# http://www.guardian.co.uk/world/feedarticle/7759001
    -# http://www.abcnews.go.com/International/wireStory?id=5676087
    -# http://www.worldtimezone.com/dst_news/dst_news_gazastrip01.html
    -
    -# From Alexander Krivenyshev (2009-03-26):
    -# According to the Palestine News Network (arabic.pnn.ps), Palestinian
    -# government decided to start Daylight Time on Thursday night March
    -# 26 and continue until the night of 27 September 2009.
    -#
    -# (in Arabic)
    -# http://arabic.pnn.ps/index.php?option=com_content&task=view&id=50850
    -#
    -# (English translation)
    -# http://www.worldtimezone.com/dst_news/dst_news_westbank01.html
    -
    -# From Steffen Thorsen (2009-08-31):
    -# Palestine's Council of Ministers announced that they will revert back to
    -# winter time on Friday, 2009-09-04.
    -#
    -# One news source:
    -# http://www.safa.ps/ara/?action=showdetail&seid=4158
    -# (Palestinian press agency, Arabic),
    -# Google translate: "Decided that the Palestinian government in Ramallah
    -# headed by Salam Fayyad, the start of work in time for the winter of
    -# 2009, starting on Friday approved the fourth delay Sept. clock sixty
    -# minutes per hour as of Friday morning."
    -#
    -# We are not sure if Gaza will do the same, last year they had a different
    -# end date, we will keep this page updated:
    -# http://www.timeanddate.com/news/time/westbank-gaza-dst-2009.html
    -
    -# From Alexander Krivenyshev (2009-09-02):
    -# Seems that Gaza Strip will go back to Winter Time same date as West Bank.
    -#
    -# According to Palestinian Ministry Of Interior, West Bank and Gaza Strip plan
    -# to change time back to Standard time on September 4, 2009.
    -#
    -# "Winter time unite the West Bank and Gaza"
    -# (from Palestinian National Authority):
    -# http://www.moi.gov.ps/en/?page=633167343250594025&nid=11505
    -# http://www.worldtimezone.com/dst_news/dst_news_gazastrip02.html
    -
    -# From Alexander Krivenyshev (2010-03-19):
    -# According to Voice of Palestine DST will last for 191 days, from March
    -# 26, 2010 till "the last Sunday before the tenth day of Tishri
    -# (October), each year" (October 03, 2010?)
    -#
    -# http://palvoice.org/forums/showthread.php?t=245697
    -# (in Arabic)
    -# http://www.worldtimezone.com/dst_news/dst_news_westbank03.html
    -
    -# From Steffen Thorsen (2010-03-24):
    -# ...Ma'an News Agency reports that Hamas cabinet has decided it will
    -# start one day later, at 12:01am. Not sure if they really mean 12:01am or
    -# noon though:
    -#
    -# http://www.maannews.net/eng/ViewDetails.aspx?ID=271178
    -# (Ma'an News Agency)
    -# "At 12:01am Friday, clocks in Israel and the West Bank will change to
    -# 1:01am, while Gaza clocks will change at 12:01am Saturday morning."
    -
    -# From Steffen Thorsen (2010-08-11):
    -# According to several sources, including
    -# http://www.maannews.net/eng/ViewDetails.aspx?ID=306795
    -# the clocks were set back one hour at 2010-08-11 00:00:00 local time in
    -# Gaza and the West Bank.
    -# Some more background info:
    -# http://www.timeanddate.com/news/time/westbank-gaza-end-dst-2010.html
    -
    -# From Steffen Thorsen (2011-08-26):
    -# Gaza and the West Bank did go back to standard time in the beginning of
    -# August, and will now enter daylight saving time again on 2011-08-30
    -# 00:00 (so two periods of DST in 2011). The pause was because of
    -# Ramadan.
    -#
    -# http://www.maannews.net/eng/ViewDetails.aspx?ID=416217
    -# Additional info:
    -# http://www.timeanddate.com/news/time/palestine-dst-2011.html
    -
    -# From Alexander Krivenyshev (2011-08-27):
    -# According to the article in The Jerusalem Post:
    -# "...Earlier this month, the Palestinian government in the West Bank decided to
    -# move to standard time for 30 days, during Ramadan. The Palestinians in the
    -# Gaza Strip accepted the change and also moved their clocks one hour back.
    -# The Hamas government said on Saturday that it won't observe summertime after
    -# the Muslim feast of Id al-Fitr, which begins on Tuesday..."
    -# ...
    -# http://www.jpost.com/MiddleEast/Article.aspx?id=235650
    -# http://www.worldtimezone.com/dst_news/dst_news_gazastrip05.html
    -# The rules for Egypt are stolen from the 'africa' file.
    -
    -# From Steffen Thorsen (2011-09-30):
    -# West Bank did end Daylight Saving Time this morning/midnight (2011-09-30
    -# 00:00).
    -# So West Bank and Gaza now have the same time again.
    -#
    -# Many sources, including:
    -# http://www.maannews.net/eng/ViewDetails.aspx?ID=424808
    -
    -# From Steffen Thorsen (2012-03-26):
    -# Palestinian news sources tell that both Gaza and West Bank will start DST
    -# on Friday (Thursday midnight, 2012-03-29 24:00).
    -# Some of many sources in Arabic:
    -# http://www.samanews.com/index.php?act=Show&id=122638
    -#
    -# http://safa.ps/details/news/74352/%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-%D8%A8%D8%A7%D9%84%D8%B6%D9%81%D8%A9-%D9%88%D8%BA%D8%B2%D8%A9-%D9%84%D9%8A%D9%84%D8%A9-%D8%A7%D9%84%D8%AC%D9%85%D8%B9%D8%A9.html
    -#
    -# Our brief summary:
    -# http://www.timeanddate.com/news/time/gaza-west-bank-dst-2012.html
    -
    -# From Steffen Thorsen (2013-03-26):
    -# The following news sources tells that Palestine will "start daylight saving
    -# time from midnight on Friday, March 29, 2013" (translated).
    -# [These are in Arabic and are for Gaza and for Ramallah, respectively.]
    -# http://www.samanews.com/index.php?act=Show&id=154120
    -# http://safa.ps/details/news/99844/%D8%B1%D8%A7%D9%85-%D8%A7%D9%84%D9%84%D9%87-%D8%A8%D8%AF%D8%A1-%D8%A7%D9%84%D8%AA%D9%88%D9%82%D9%8A%D8%AA-%D8%A7%D9%84%D8%B5%D9%8A%D9%81%D9%8A-29-%D8%A7%D9%84%D8%AC%D8%A7%D8%B1%D9%8A.html
    -
    -# From Steffen Thorsen (2013-09-24):
    -# The Gaza and West Bank are ending DST Thursday at midnight
    -# (2013-09-27 00:00:00) (one hour earlier than last year...).
    -# This source in English, says "that winter time will go into effect
    -# at midnight on Thursday in the West Bank and Gaza Strip":
    -# http://english.wafa.ps/index.php?action=detail&id=23246
    -# official source...:
    -# http://www.palestinecabinet.gov.ps/ar/Views/ViewDetails.aspx?pid=1252
    -
    -# From Steffen Thorsen (2015-03-03):
    -# Sources such as http://www.alquds.com/news/article/view/id/548257
    -# and http://www.raya.ps/ar/news/890705.html say Palestine areas will
    -# start DST on 2015-03-28 00:00 which is one day later than expected.
    -#
    -# From Paul Eggert (2015-03-03):
    -# http://www.timeanddate.com/time/change/west-bank/ramallah?year=2014
    -# says that the fall 2014 transition was Oct 23 at 24:00.
    -# For future dates, guess the last Friday in March at 24:00 through
    -# the first Friday on or after October 21 at 00:00.  This is consistent with
    -# the predictions in today's editions of the following URLs:
    -# http://www.timeanddate.com/time/change/gaza-strip/gaza
    -# http://www.timeanddate.com/time/change/west-bank/hebron
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule EgyptAsia	1957	only	-	May	10	0:00	1:00	S
    -Rule EgyptAsia	1957	1958	-	Oct	 1	0:00	0	-
    -Rule EgyptAsia	1958	only	-	May	 1	0:00	1:00	S
    -Rule EgyptAsia	1959	1967	-	May	 1	1:00	1:00	S
    -Rule EgyptAsia	1959	1965	-	Sep	30	3:00	0	-
    -Rule EgyptAsia	1966	only	-	Oct	 1	3:00	0	-
    -
    -Rule Palestine	1999	2005	-	Apr	Fri>=15	0:00	1:00	S
    -Rule Palestine	1999	2003	-	Oct	Fri>=15	0:00	0	-
    -Rule Palestine	2004	only	-	Oct	 1	1:00	0	-
    -Rule Palestine	2005	only	-	Oct	 4	2:00	0	-
    -Rule Palestine	2006	2007	-	Apr	 1	0:00	1:00	S
    -Rule Palestine	2006	only	-	Sep	22	0:00	0	-
    -Rule Palestine	2007	only	-	Sep	Thu>=8	2:00	0	-
    -Rule Palestine	2008	2009	-	Mar	lastFri	0:00	1:00	S
    -Rule Palestine	2008	only	-	Sep	 1	0:00	0	-
    -Rule Palestine	2009	only	-	Sep	Fri>=1	1:00	0	-
    -Rule Palestine	2010	only	-	Mar	26	0:00	1:00	S
    -Rule Palestine	2010	only	-	Aug	11	0:00	0	-
    -Rule Palestine	2011	only	-	Apr	 1	0:01	1:00	S
    -Rule Palestine	2011	only	-	Aug	 1	0:00	0	-
    -Rule Palestine	2011	only	-	Aug	30	0:00	1:00	S
    -Rule Palestine	2011	only	-	Sep	30	0:00	0	-
    -Rule Palestine	2012	2014	-	Mar	lastThu	24:00	1:00	S
    -Rule Palestine	2012	only	-	Sep	21	1:00	0	-
    -Rule Palestine	2013	only	-	Sep	Fri>=21	0:00	0	-
    -Rule Palestine	2014	max	-	Oct	Fri>=21	0:00	0	-
    -Rule Palestine	2015	max	-	Mar	lastFri	24:00	1:00	S
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Gaza	2:17:52	-	LMT	1900 Oct
    -			2:00	Zion	EET	1948 May 15
    -			2:00 EgyptAsia	EE%sT	1967 Jun  5
    -			2:00	Zion	I%sT	1996
    -			2:00	Jordan	EE%sT	1999
    -			2:00 Palestine	EE%sT	2008 Aug 29  0:00
    -			2:00	-	EET	2008 Sep
    -			2:00 Palestine	EE%sT	2010
    -			2:00	-	EET	2010 Mar 27  0:01
    -			2:00 Palestine	EE%sT	2011 Aug  1
    -			2:00	-	EET	2012
    -			2:00 Palestine	EE%sT
    -
    -Zone	Asia/Hebron	2:20:23	-	LMT	1900 Oct
    -			2:00	Zion	EET	1948 May 15
    -			2:00 EgyptAsia	EE%sT	1967 Jun  5
    -			2:00	Zion	I%sT	1996
    -			2:00	Jordan	EE%sT	1999
    -			2:00 Palestine	EE%sT
    -
    -# Paracel Is
    -# no information
    -
    -# Philippines
    -# On 1844-08-16, Narciso Clavería, governor-general of the
    -# Philippines, issued a proclamation announcing that 1844-12-30 was to
    -# be immediately followed by 1845-01-01; see R.H. van Gent's
    -# History of the International Date Line
    -# http://www.staff.science.uu.nl/~gent0113/idl/idl_philippines.htm
    -# The rest of the data entries are from Shanks & Pottenger.
    -
    -# From Jesper Nørgaard Welen (2006-04-26):
    -# ... claims that Philippines had DST last time in 1990:
    -# http://story.philippinetimes.com/p.x/ct/9/id/145be20cc6b121c0/cid/3e5bbccc730d258c/
    -# [a story dated 2006-04-25 by Cris Larano of Dow Jones Newswires,
    -# but no details]
    -
    -# From Paul Eggert (2014-08-14):
    -# The following source says DST may be instituted November-January and again
    -# March-June, but this is not definite.  It also says DST was last proclaimed
    -# during the Ramos administration (1992-1998); but again, no details.
    -# Carcamo D. PNoy urged to declare use of daylight saving time.
    -# Philippine Star 2014-08-05
    -# http://www.philstar.com/headlines/2014/08/05/1354152/pnoy-urged-declare-use-daylight-saving-time
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Phil	1936	only	-	Nov	1	0:00	1:00	S
    -Rule	Phil	1937	only	-	Feb	1	0:00	0	-
    -Rule	Phil	1954	only	-	Apr	12	0:00	1:00	S
    -Rule	Phil	1954	only	-	Jul	1	0:00	0	-
    -Rule	Phil	1978	only	-	Mar	22	0:00	1:00	S
    -Rule	Phil	1978	only	-	Sep	21	0:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Manila	-15:56:00 -	LMT	1844 Dec 31
    -			8:04:00 -	LMT	1899 May 11
    -			8:00	Phil	PH%sT	1942 May
    -			9:00	-	JST	1944 Nov
    -			8:00	Phil	PH%sT
    -
    -# Qatar
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Qatar	3:26:08 -	LMT	1920     # Al Dawhah / Doha
    -			4:00	-	GST	1972 Jun
    -			3:00	-	AST
    -Link Asia/Qatar Asia/Bahrain
    -
    -# Saudi Arabia
    -#
    -# From Paul Eggert (2014-07-15):
    -# Time in Saudi Arabia and other countries in the Arabian peninsula was not
    -# standardized until relatively recently; we don't know when, and possibly it
    -# has never been made official.  Richard P Hunt, in "Islam city yielding to
    -# modern times", New York Times (1961-04-09), p 20, wrote that only airlines
    -# observed standard time, and that people in Jeddah mostly observed quasi-solar
    -# time, doing so by setting their watches at sunrise to 6 o'clock (or to 12
    -# o'clock for "Arab" time).
    -#
    -# The TZ database cannot represent quasi-solar time; airline time is the best
    -# we can do.  The 1946 foreign air news digest of the U.S. Civil Aeronautics
    -# Board (OCLC 42299995) reported that the "... Arabian Government, inaugurated
    -# a weekly Dhahran-Cairo service, via the Saudi Arabian cities of Riyadh and
    -# Jidda, on March 14, 1947".  Shanks & Pottenger guessed 1950; go with the
    -# earlier date.
    -#
    -# Shanks & Pottenger also state that until 1968-05-01 Saudi Arabia had two
    -# time zones; the other zone, at UTC+4, was in the far eastern part of
    -# the country.  Ignore this, as it's before our 1970 cutoff.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Riyadh	3:06:52 -	LMT	1947 Mar 14
    -			3:00	-	AST
    -Link Asia/Riyadh Asia/Aden	# Yemen
    -Link Asia/Riyadh Asia/Kuwait
    -
    -# Singapore
    -# taken from Mok Ly Yng (2003-10-30)
    -# http://www.math.nus.edu.sg/aslaksen/teaching/timezone.html
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Singapore	6:55:25 -	LMT	1901 Jan  1
    -			6:55:25	-	SMT	1905 Jun  1 # Singapore M.T.
    -			7:00	-	MALT	1933 Jan  1 # Malaya Time
    -			7:00	0:20	MALST	1936 Jan  1
    -			7:20	-	MALT	1941 Sep  1
    -			7:30	-	MALT	1942 Feb 16
    -			9:00	-	JST	1945 Sep 12
    -			7:30	-	MALT	1965 Aug  9 # independence
    -			7:30	-	SGT	1982 Jan  1 # Singapore Time
    -			8:00	-	SGT
    -
    -# Spratly Is
    -# no information
    -
    -# Sri Lanka
    -
    -# From Paul Eggert (2013-02-21):
    -# Milne says "Madras mean time use from May 1, 1898.  Prior to this Colombo
    -# mean time, 5h. 4m. 21.9s. F., was used."  But 5:04:21.9 differs considerably
    -# from Colombo's meridian 5:19:24, so for now ignore Milne and stick with
    -# Shanks and Pottenger.
    -
    -# From Paul Eggert (1996-09-03):
    -# "Sri Lanka advances clock by an hour to avoid blackout"
    -# (, 1996-05-24,
    -# no longer available as of 1999-08-17)
    -# reported "the country's standard time will be put forward by one hour at
    -# midnight Friday (1830 GMT) 'in the light of the present power crisis'."
    -#
    -# From Dharmasiri Senanayake, Sri Lanka Media Minister (1996-10-24), as quoted
    -# by Shamindra in Daily News - Hot News Section
    -#  (1996-10-26):
    -# With effect from 12.30 a.m. on 26th October 1996
    -# Sri Lanka will be six (06) hours ahead of GMT.
    -
    -# From Jesper Nørgaard Welen (2006-04-14), quoting Sri Lanka News Online
    -#  (2006-04-13):
    -# 0030 hrs on April 15, 2006 (midnight of April 14, 2006 +30 minutes)
    -# at present, become 2400 hours of April 14, 2006 (midnight of April 14, 2006).
    -
    -# From Peter Apps and Ranga Sirila of Reuters (2006-04-12) in:
    -# http://today.reuters.co.uk/news/newsArticle.aspx?type=scienceNews&storyID=2006-04-12T172228Z_01_COL295762_RTRIDST_0_SCIENCE-SRILANKA-TIME-DC.XML
    -# [The Tamil Tigers] never accepted the original 1996 time change and simply
    -# kept their clocks set five and a half hours ahead of Greenwich Mean
    -# Time (GMT), in line with neighbor India.
    -# From Paul Eggert (2006-04-18):
    -# People who live in regions under Tamil control can use [TZ='Asia/Kolkata'],
    -# as that zone has agreed with the Tamil areas since our cutoff date of 1970.
    -
    -# From K Sethu (2006-04-25):
    -# I think the abbreviation LKT originated from the world of computers at
    -# the time of or subsequent to the time zone changes by SL Government
    -# twice in 1996 and probably SL Government or its standardization
    -# agencies never declared an abbreviation as a national standard.
    -#
    -# I recollect before the recent change the government announcements
    -# mentioning it as simply changing Sri Lanka Standard Time or Sri Lanka
    -# Time and no mention was made about the abbreviation.
    -#
    -# If we look at Sri Lanka Department of Government's "Official News
    -# Website of Sri Lanka" ... http://www.news.lk/ we can see that they
    -# use SLT as abbreviation in time stamp at the beginning of each news
    -# item....
    -#
    -# Within Sri Lanka I think LKT is well known among computer users and
    -# administrators.  In my opinion SLT may not be a good choice because the
    -# nation's largest telcom / internet operator Sri Lanka Telcom is well
    -# known by that abbreviation - simply as SLT (there IP domains are
    -# slt.lk and sltnet.lk).
    -#
    -# But if indeed our government has adopted SLT as standard abbreviation
    -# (that we have not known so far) then  it is better that it be used for
    -# all computers.
    -
    -# From Paul Eggert (2006-04-25):
    -# One possibility is that we wait for a bit for the dust to settle down
    -# and then see what people actually say in practice.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Colombo	5:19:24 -	LMT	1880
    -			5:19:32	-	MMT	1906        # Moratuwa Mean Time
    -			5:30	-	IST	1942 Jan  5
    -			5:30	0:30	IHST	1942 Sep
    -			5:30	1:00	IST	1945 Oct 16  2:00
    -			5:30	-	IST	1996 May 25  0:00
    -			6:30	-	LKT	1996 Oct 26  0:30
    -			6:00	-	LKT	2006 Apr 15  0:30
    -			5:30	-	IST
    -
    -# Syria
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Syria	1920	1923	-	Apr	Sun>=15	2:00	1:00	S
    -Rule	Syria	1920	1923	-	Oct	Sun>=1	2:00	0	-
    -Rule	Syria	1962	only	-	Apr	29	2:00	1:00	S
    -Rule	Syria	1962	only	-	Oct	1	2:00	0	-
    -Rule	Syria	1963	1965	-	May	1	2:00	1:00	S
    -Rule	Syria	1963	only	-	Sep	30	2:00	0	-
    -Rule	Syria	1964	only	-	Oct	1	2:00	0	-
    -Rule	Syria	1965	only	-	Sep	30	2:00	0	-
    -Rule	Syria	1966	only	-	Apr	24	2:00	1:00	S
    -Rule	Syria	1966	1976	-	Oct	1	2:00	0	-
    -Rule	Syria	1967	1978	-	May	1	2:00	1:00	S
    -Rule	Syria	1977	1978	-	Sep	1	2:00	0	-
    -Rule	Syria	1983	1984	-	Apr	9	2:00	1:00	S
    -Rule	Syria	1983	1984	-	Oct	1	2:00	0	-
    -Rule	Syria	1986	only	-	Feb	16	2:00	1:00	S
    -Rule	Syria	1986	only	-	Oct	9	2:00	0	-
    -Rule	Syria	1987	only	-	Mar	1	2:00	1:00	S
    -Rule	Syria	1987	1988	-	Oct	31	2:00	0	-
    -Rule	Syria	1988	only	-	Mar	15	2:00	1:00	S
    -Rule	Syria	1989	only	-	Mar	31	2:00	1:00	S
    -Rule	Syria	1989	only	-	Oct	1	2:00	0	-
    -Rule	Syria	1990	only	-	Apr	1	2:00	1:00	S
    -Rule	Syria	1990	only	-	Sep	30	2:00	0	-
    -Rule	Syria	1991	only	-	Apr	 1	0:00	1:00	S
    -Rule	Syria	1991	1992	-	Oct	 1	0:00	0	-
    -Rule	Syria	1992	only	-	Apr	 8	0:00	1:00	S
    -Rule	Syria	1993	only	-	Mar	26	0:00	1:00	S
    -Rule	Syria	1993	only	-	Sep	25	0:00	0	-
    -# IATA SSIM (1998-02) says 1998-04-02;
    -# (1998-09) says 1999-03-29 and 1999-09-29; (1999-02) says 1999-04-02,
    -# 2000-04-02, and 2001-04-02; (1999-09) says 2000-03-31 and 2001-03-31;
    -# (2006) says 2006-03-31 and 2006-09-22;
    -# for now ignore all these claims and go with Shanks & Pottenger,
    -# except for the 2006-09-22 claim (which seems right for Ramadan).
    -Rule	Syria	1994	1996	-	Apr	 1	0:00	1:00	S
    -Rule	Syria	1994	2005	-	Oct	 1	0:00	0	-
    -Rule	Syria	1997	1998	-	Mar	lastMon	0:00	1:00	S
    -Rule	Syria	1999	2006	-	Apr	 1	0:00	1:00	S
    -# From Stephen Colebourne (2006-09-18):
    -# According to IATA data, Syria will change DST on 21st September [21:00 UTC]
    -# this year [only]....  This is probably related to Ramadan, like Egypt.
    -Rule	Syria	2006	only	-	Sep	22	0:00	0	-
    -# From Paul Eggert (2007-03-29):
    -# Today the AP reported "Syria will switch to summertime at midnight Thursday."
    -# http://www.iht.com/articles/ap/2007/03/29/africa/ME-GEN-Syria-Time-Change.php
    -Rule	Syria	2007	only	-	Mar	lastFri	0:00	1:00	S
    -# From Jesper Nørgaard (2007-10-27):
    -# The sister center ICARDA of my work CIMMYT is confirming that Syria DST will
    -# not take place 1st November at 0:00 o'clock but 1st November at 24:00 or
    -# rather Midnight between Thursday and Friday. This does make more sense than
    -# having it between Wednesday and Thursday (two workdays in Syria) since the
    -# weekend in Syria is not Saturday and Sunday, but Friday and Saturday. So now
    -# it is implemented at midnight of the last workday before weekend...
    -#
    -# From Steffen Thorsen (2007-10-27):
    -# Jesper Nørgaard Welen wrote:
    -#
    -# > "Winter local time in Syria will be observed at midnight of Thursday 1
    -# > November 2007, and the clock will be put back 1 hour."
    -#
    -# I found confirmation on this in this gov.sy-article (Arabic):
    -# http://wehda.alwehda.gov.sy/_print_veiw.asp?FileName=12521710520070926111247
    -#
    -# which using Google's translate tools says:
    -# Council of Ministers also approved the commencement of work on
    -# identifying the winter time as of Friday, 2/11/2007 where the 60th
    -# minute delay at midnight Thursday 1/11/2007.
    -Rule	Syria	2007	only	-	Nov	 Fri>=1	0:00	0	-
    -
    -# From Stephen Colebourne (2008-03-17):
    -# For everyone's info, I saw an IATA time zone change for [Syria] for
    -# this month (March 2008) in the last day or so....
    -# Country     Time Standard   --- DST Start ---   --- DST End ---  DST
    -# Name        Zone Variation   Time    Date        Time    Date
    -# Variation
    -# Syrian Arab
    -# Republic    SY    +0200      2200  03APR08       2100  30SEP08   +0300
    -#                              2200  02APR09       2100  30SEP09   +0300
    -#                              2200  01APR10       2100  30SEP10   +0300
    -
    -# From Arthur David Olson (2008-03-17):
    -# Here's a link to English-language coverage by the Syrian Arab News
    -# Agency (SANA)...
    -# http://www.sana.sy/eng/21/2008/03/11/165173.htm
    -# ...which reads (in part) "The Cabinet approved the suggestion of the
    -# Ministry of Electricity to begin daylight savings time on Friday April
    -# 4th, advancing clocks one hour ahead on midnight of Thursday April 3rd."
    -# Since Syria is two hours east of UTC, the 2200 and 2100 transition times
    -# shown above match up with midnight in Syria.
    -
    -# From Arthur David Olson (2008-03-18):
    -# My best guess at a Syrian rule is "the Friday nearest April 1";
    -# coding that involves either using a "Mar Fri>=29" construct that old time zone
    -# compilers can't handle  or having multiple Rules (a la Israel).
    -# For now, use "Apr Fri>=1", and go with IATA on a uniform Sep 30 end.
    -
    -# From Steffen Thorsen (2008-10-07):
    -# Syria has now officially decided to end DST on 2008-11-01 this year,
    -# according to the following article in the Syrian Arab News Agency (SANA).
    -#
    -# The article is in Arabic, and seems to tell that they will go back to
    -# winter time on 2008-11-01 at 00:00 local daylight time (delaying/setting
    -# clocks back 60 minutes).
    -#
    -# http://sana.sy/ara/2/2008/10/07/195459.htm
    -
    -# From Steffen Thorsen (2009-03-19):
    -# Syria will start DST on 2009-03-27 00:00 this year according to many sources,
    -# two examples:
    -#
    -# http://www.sana.sy/eng/21/2009/03/17/217563.htm
    -# (English, Syrian Arab News # Agency)
    -# http://thawra.alwehda.gov.sy/_View_news2.asp?FileName=94459258720090318012209
    -# (Arabic, gov-site)
    -#
    -# We have not found any sources saying anything about when DST ends this year.
    -#
    -# Our summary
    -# http://www.timeanddate.com/news/time/syria-dst-starts-march-27-2009.html
    -
    -# From Steffen Thorsen (2009-10-27):
    -# The Syrian Arab News Network on 2009-09-29 reported that Syria will
    -# revert back to winter (standard) time on midnight between Thursday
    -# 2009-10-29 and Friday 2009-10-30:
    -# http://www.sana.sy/ara/2/2009/09/29/247012.htm (Arabic)
    -
    -# From Arthur David Olson (2009-10-28):
    -# We'll see if future DST switching times turn out to be end of the last
    -# Thursday of the month or the start of the last Friday of the month or
    -# something else. For now, use the start of the last Friday.
    -
    -# From Steffen Thorsen (2010-03-17):
    -# The "Syrian News Station" reported on 2010-03-16 that the Council of
    -# Ministers has decided that Syria will start DST on midnight Thursday
    -# 2010-04-01: (midnight between Thursday and Friday):
    -# http://sns.sy/sns/?path=news/read/11421 (Arabic)
    -
    -# From Steffen Thorsen (2012-03-26):
    -# Today, Syria's government announced that they will start DST early on Friday
    -# (00:00). This is a bit earlier than the past two years.
    -#
    -# From Syrian Arab News Agency, in Arabic:
    -# http://www.sana.sy/ara/2/2012/03/26/408215.htm
    -#
    -# Our brief summary:
    -# http://www.timeanddate.com/news/time/syria-dst-2012.html
    -
    -# From Arthur David Olson (2012-03-27):
    -# Assume last Friday in March going forward XXX.
    -
    -Rule	Syria	2008	only	-	Apr	Fri>=1	0:00	1:00	S
    -Rule	Syria	2008	only	-	Nov	1	0:00	0	-
    -Rule	Syria	2009	only	-	Mar	lastFri	0:00	1:00	S
    -Rule	Syria	2010	2011	-	Apr	Fri>=1	0:00	1:00	S
    -Rule	Syria	2012	max	-	Mar	lastFri	0:00	1:00	S
    -Rule	Syria	2009	max	-	Oct	lastFri	0:00	0	-
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Damascus	2:25:12 -	LMT	1920 # Dimashq
    -			2:00	Syria	EE%sT
    -
    -# Tajikistan
    -# From Shanks & Pottenger.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Dushanbe	4:35:12 -	LMT	1924 May  2
    -			5:00	-	DUST	1930 Jun 21 # Dushanbe Time
    -			6:00 RussiaAsia DUS%sT	1991 Mar 31  2:00s
    -			5:00	1:00	DUSST	1991 Sep  9  2:00s
    -			5:00	-	TJT	# Tajikistan Time
    -
    -# Thailand
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Bangkok	6:42:04	-	LMT	1880
    -			6:42:04	-	BMT	1920 Apr # Bangkok Mean Time
    -			7:00	-	ICT
    -Link Asia/Bangkok Asia/Phnom_Penh	# Cambodia
    -Link Asia/Bangkok Asia/Vientiane	# Laos
    -
    -# Turkmenistan
    -# From Shanks & Pottenger.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Ashgabat	3:53:32 -	LMT	1924 May  2 # or Ashkhabad
    -			4:00	-	ASHT	1930 Jun 21 # Ashkhabad Time
    -			5:00 RussiaAsia	ASH%sT	1991 Mar 31  2:00
    -			4:00 RussiaAsia	ASH%sT	1991 Oct 27 # independence
    -			4:00 RussiaAsia	TM%sT	1992 Jan 19  2:00
    -			5:00	-	TMT
    -
    -# United Arab Emirates
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Dubai	3:41:12 -	LMT	1920
    -			4:00	-	GST
    -Link Asia/Dubai Asia/Muscat	# Oman
    -
    -# Uzbekistan
    -# Byalokoz 1919 says Uzbekistan was 4:27:53.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Asia/Samarkand	4:27:53 -	LMT	1924 May  2
    -			4:00	-	SAMT	1930 Jun 21 # Samarkand Time
    -			5:00	-	SAMT	1981 Apr  1
    -			5:00	1:00	SAMST	1981 Oct  1
    -			6:00	-	TAST	1982 Apr  1 # Tashkent Time
    -			5:00 RussiaAsia	SAM%sT	1991 Sep  1 # independence
    -			5:00 RussiaAsia	UZ%sT	1992
    -			5:00	-	UZT
    -# Milne says Tashkent was 4:37:10.8; round to nearest.
    -Zone	Asia/Tashkent	4:37:11 -	LMT	1924 May  2
    -			5:00	-	TAST	1930 Jun 21 # Tashkent Time
    -			6:00 RussiaAsia	TAS%sT	1991 Mar 31  2:00
    -			5:00 RussiaAsia	TAS%sT	1991 Sep  1 # independence
    -			5:00 RussiaAsia	UZ%sT	1992
    -			5:00	-	UZT
    -
    -# Vietnam
    -
    -# From Paul Eggert (2014-10-04):
    -# Milne gives 7:16:56 for the meridian of Saigon in 1899, as being
    -# used in Lower Laos, Cambodia, and Annam.  But this is quite a ways
    -# from Saigon's location.  For now, ignore this and stick with Shanks
    -# and Pottenger for LMT before 1906.
    -
    -# From Arthur David Olson (2008-03-18):
    -# The English-language name of Vietnam's most populous city is "Ho Chi Minh
    -# City"; use Ho_Chi_Minh below to avoid a name of more than 14 characters.
    -
    -# From Paul Eggert (2014-10-21) after a heads-up from Trần Ngá»c Quân:
    -# Trần Tiến Bình's authoritative book "Lịch Việt Nam: thế kỷ XX-XXI (1901-2100)"
    -# (Nhà xuất bản Văn Hoá - Thông Tin, Hanoi, 2005), pp 49-50,
    -# is quoted verbatim in:
    -# http://www.thoigian.com.vn/?mPage=P80D01
    -# is translated by Brian Inglis in:
    -# http://mm.icann.org/pipermail/tz/2014-October/021654.html
    -# and is the basis for the information below.
    -#
    -# The 1906 transition was effective July 1 and standardized Indochina to
    -# Phù Liễn Observatory, legally 104 deg. 17'17" east of Paris.
    -# It's unclear whether this meant legal Paris Mean Time (00:09:21) or
    -# the Paris Meridian (2 deg. 20'14.03" E); the former yields 07:06:30.1333...
    -# and the latter 07:06:29.333... so either way it rounds to 07:06:30,
    -# which is used below even though the modern-day Phù Liễn Observatory
    -# is closer to 07:06:31.  Abbreviate Phù Liễn Mean Time as PLMT.
    -#
    -# The following transitions occurred in Indochina in general (before 1954)
    -# and in South Vietnam in particular (after 1954):
    -# To 07:00 on 1911-05-01.
    -# To 08:00 on 1942-12-31 at 23:00.
    -# To 09:00 in 1945-03-14 at 23:00.
    -# To 07:00 on 1945-09-02 in Vietnam.
    -# To 08:00 on 1947-04-01 in French-controlled Indochina.
    -# To 07:00 on 1955-07-01 in South Vietnam.
    -# To 08:00 on 1959-12-31 at 23:00 in South Vietnam.
    -# To 07:00 on 1975-06-13 in South Vietnam.
    -#
    -# Trần cites the following sources; it's unclear which supplied the info above.
    -#
    -# Hoàng Xuân Hãn: "Lịch và lịch Việt Nam". Tập san Khoa há»c Xã há»™i,
    -# No. 9, Paris, February 1982.
    -#
    -# Lê Thành Lân: "Lịch và niên biểu lịch sử hai mươi thế kỷ (0001-2010)",
    -# NXB Thống kê, Hanoi, 2000.
    -#
    -# Lê Thành Lân: "Lịch hai thế kỷ (1802-2010) và các lịch vĩnh cửu",
    -# NXB Thuận Hoá, Huế, 1995.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Asia/Ho_Chi_Minh	7:06:40 -	LMT	1906 Jul  1
    -			7:06:30	-	PLMT	1911 May  1
    -			7:00	-	ICT	1942 Dec 31 23:00
    -			8:00	-	IDT	1945 Mar 14 23:00
    -			9:00	-	JST	1945 Sep  2
    -			7:00	-	ICT	1947 Apr  1
    -			8:00	-	IDT	1955 Jul  1
    -			7:00	-	ICT	1959 Dec 31 23:00
    -			8:00	-	IDT	1975 Jun 13
    -			7:00	-	ICT
    -
    -# Yemen
    -# See Asia/Riyadh.
    diff --git a/external/public-domain/tz/dist/australasia b/external/public-domain/tz/dist/australasia
    deleted file mode 100644
    index 3e2c0b345..000000000
    --- a/external/public-domain/tz/dist/australasia
    +++ /dev/null
    @@ -1,1741 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# This file also includes Pacific islands.
    -
    -# Notes are at the end of this file
    -
    -###############################################################################
    -
    -# Australia
    -
    -# Please see the notes below for the controversy about "EST" versus "AEST" etc.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Aus	1917	only	-	Jan	 1	0:01	1:00	D
    -Rule	Aus	1917	only	-	Mar	25	2:00	0	S
    -Rule	Aus	1942	only	-	Jan	 1	2:00	1:00	D
    -Rule	Aus	1942	only	-	Mar	29	2:00	0	S
    -Rule	Aus	1942	only	-	Sep	27	2:00	1:00	D
    -Rule	Aus	1943	1944	-	Mar	lastSun	2:00	0	S
    -Rule	Aus	1943	only	-	Oct	 3	2:00	1:00	D
    -# Go with Whitman and the Australian National Standards Commission, which
    -# says W Australia didn't use DST in 1943/1944.  Ignore Whitman's claim that
    -# 1944/1945 was just like 1943/1944.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -# Northern Territory
    -Zone Australia/Darwin	 8:43:20 -	LMT	1895 Feb
    -			 9:00	-	ACST	1899 May
    -			 9:30	Aus	AC%sT
    -# Western Australia
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	AW	1974	only	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AW	1975	only	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AW	1983	only	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AW	1984	only	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AW	1991	only	-	Nov	17	2:00s	1:00	D
    -Rule	AW	1992	only	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AW	2006	only	-	Dec	 3	2:00s	1:00	D
    -Rule	AW	2007	2009	-	Mar	lastSun	2:00s	0	S
    -Rule	AW	2007	2008	-	Oct	lastSun	2:00s	1:00	D
    -Zone Australia/Perth	 7:43:24 -	LMT	1895 Dec
    -			 8:00	Aus	AW%sT	1943 Jul
    -			 8:00	AW	AW%sT
    -Zone Australia/Eucla	 8:35:28 -	LMT	1895 Dec
    -			 8:45	Aus	ACW%sT	1943 Jul
    -			 8:45	AW	ACW%sT
    -
    -# Queensland
    -#
    -# From Alex Livingston (1996-11-01):
    -# I have heard or read more than once that some resort islands off the coast
    -# of Queensland chose to keep observing daylight-saving time even after
    -# Queensland ceased to.
    -#
    -# From Paul Eggert (1996-11-22):
    -# IATA SSIM (1993-02/1994-09) say that the Holiday Islands (Hayman, Lindeman,
    -# Hamilton) observed DST for two years after the rest of Queensland stopped.
    -# Hamilton is the largest, but there is also a Hamilton in Victoria,
    -# so use Lindeman.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	AQ	1971	only	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AQ	1972	only	-	Feb	lastSun	2:00s	0	S
    -Rule	AQ	1989	1991	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AQ	1990	1992	-	Mar	Sun>=1	2:00s	0	S
    -Rule	Holiday	1992	1993	-	Oct	lastSun	2:00s	1:00	D
    -Rule	Holiday	1993	1994	-	Mar	Sun>=1	2:00s	0	S
    -Zone Australia/Brisbane	10:12:08 -	LMT	1895
    -			10:00	Aus	AE%sT	1971
    -			10:00	AQ	AE%sT
    -Zone Australia/Lindeman  9:55:56 -	LMT	1895
    -			10:00	Aus	AE%sT	1971
    -			10:00	AQ	AE%sT	1992 Jul
    -			10:00	Holiday	AE%sT
    -
    -# South Australia
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	AS	1971	1985	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AS	1986	only	-	Oct	19	2:00s	1:00	D
    -Rule	AS	1987	2007	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AS	1972	only	-	Feb	27	2:00s	0	S
    -Rule	AS	1973	1985	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AS	1986	1990	-	Mar	Sun>=15	2:00s	0	S
    -Rule	AS	1991	only	-	Mar	3	2:00s	0	S
    -Rule	AS	1992	only	-	Mar	22	2:00s	0	S
    -Rule	AS	1993	only	-	Mar	7	2:00s	0	S
    -Rule	AS	1994	only	-	Mar	20	2:00s	0	S
    -Rule	AS	1995	2005	-	Mar	lastSun	2:00s	0	S
    -Rule	AS	2006	only	-	Apr	2	2:00s	0	S
    -Rule	AS	2007	only	-	Mar	lastSun	2:00s	0	S
    -Rule	AS	2008	max	-	Apr	Sun>=1	2:00s	0	S
    -Rule	AS	2008	max	-	Oct	Sun>=1	2:00s	1:00	D
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Australia/Adelaide	9:14:20 -	LMT	1895 Feb
    -			9:00	-	ACST	1899 May
    -			9:30	Aus	AC%sT	1971
    -			9:30	AS	AC%sT
    -
    -# Tasmania
    -#
    -# From Paul Eggert (2005-08-16):
    -# http://www.bom.gov.au/climate/averages/tables/dst_times.shtml
    -# says King Island didn't observe DST from WWII until late 1971.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	AT	1967	only	-	Oct	Sun>=1	2:00s	1:00	D
    -Rule	AT	1968	only	-	Mar	lastSun	2:00s	0	S
    -Rule	AT	1968	1985	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AT	1969	1971	-	Mar	Sun>=8	2:00s	0	S
    -Rule	AT	1972	only	-	Feb	lastSun	2:00s	0	S
    -Rule	AT	1973	1981	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AT	1982	1983	-	Mar	lastSun	2:00s	0	S
    -Rule	AT	1984	1986	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AT	1986	only	-	Oct	Sun>=15	2:00s	1:00	D
    -Rule	AT	1987	1990	-	Mar	Sun>=15	2:00s	0	S
    -Rule	AT	1987	only	-	Oct	Sun>=22	2:00s	1:00	D
    -Rule	AT	1988	1990	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AT	1991	1999	-	Oct	Sun>=1	2:00s	1:00	D
    -Rule	AT	1991	2005	-	Mar	lastSun	2:00s	0	S
    -Rule	AT	2000	only	-	Aug	lastSun	2:00s	1:00	D
    -Rule	AT	2001	max	-	Oct	Sun>=1	2:00s	1:00	D
    -Rule	AT	2006	only	-	Apr	Sun>=1	2:00s	0	S
    -Rule	AT	2007	only	-	Mar	lastSun	2:00s	0	S
    -Rule	AT	2008	max	-	Apr	Sun>=1	2:00s	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Australia/Hobart	9:49:16	-	LMT	1895 Sep
    -			10:00	-	AEST	1916 Oct  1  2:00
    -			10:00	1:00	AEDT	1917 Feb
    -			10:00	Aus	AE%sT	1967
    -			10:00	AT	AE%sT
    -Zone Australia/Currie	9:35:28	-	LMT	1895 Sep
    -			10:00	-	AEST	1916 Oct  1  2:00
    -			10:00	1:00	AEDT	1917 Feb
    -			10:00	Aus	AE%sT	1971 Jul
    -			10:00	AT	AE%sT
    -
    -# Victoria
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	AV	1971	1985	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AV	1972	only	-	Feb	lastSun	2:00s	0	S
    -Rule	AV	1973	1985	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AV	1986	1990	-	Mar	Sun>=15	2:00s	0	S
    -Rule	AV	1986	1987	-	Oct	Sun>=15	2:00s	1:00	D
    -Rule	AV	1988	1999	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AV	1991	1994	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AV	1995	2005	-	Mar	lastSun	2:00s	0	S
    -Rule	AV	2000	only	-	Aug	lastSun	2:00s	1:00	D
    -Rule	AV	2001	2007	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AV	2006	only	-	Apr	Sun>=1	2:00s	0	S
    -Rule	AV	2007	only	-	Mar	lastSun	2:00s	0	S
    -Rule	AV	2008	max	-	Apr	Sun>=1	2:00s	0	S
    -Rule	AV	2008	max	-	Oct	Sun>=1	2:00s	1:00	D
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Australia/Melbourne 9:39:52 -	LMT	1895 Feb
    -			10:00	Aus	AE%sT	1971
    -			10:00	AV	AE%sT
    -
    -# New South Wales
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	AN	1971	1985	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AN	1972	only	-	Feb	27	2:00s	0	S
    -Rule	AN	1973	1981	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AN	1982	only	-	Apr	Sun>=1	2:00s	0	S
    -Rule	AN	1983	1985	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AN	1986	1989	-	Mar	Sun>=15	2:00s	0	S
    -Rule	AN	1986	only	-	Oct	19	2:00s	1:00	D
    -Rule	AN	1987	1999	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AN	1990	1995	-	Mar	Sun>=1	2:00s	0	S
    -Rule	AN	1996	2005	-	Mar	lastSun	2:00s	0	S
    -Rule	AN	2000	only	-	Aug	lastSun	2:00s	1:00	D
    -Rule	AN	2001	2007	-	Oct	lastSun	2:00s	1:00	D
    -Rule	AN	2006	only	-	Apr	Sun>=1	2:00s	0	S
    -Rule	AN	2007	only	-	Mar	lastSun	2:00s	0	S
    -Rule	AN	2008	max	-	Apr	Sun>=1	2:00s	0	S
    -Rule	AN	2008	max	-	Oct	Sun>=1	2:00s	1:00	D
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Australia/Sydney	10:04:52 -	LMT	1895 Feb
    -			10:00	Aus	AE%sT	1971
    -			10:00	AN	AE%sT
    -Zone Australia/Broken_Hill 9:25:48 -	LMT	1895 Feb
    -			10:00	-	AEST	1896 Aug 23
    -			9:00	-	ACST	1899 May
    -			9:30	Aus	AC%sT	1971
    -			9:30	AN	AC%sT	2000
    -			9:30	AS	AC%sT
    -
    -# Lord Howe Island
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	LH	1981	1984	-	Oct	lastSun	2:00	1:00	D
    -Rule	LH	1982	1985	-	Mar	Sun>=1	2:00	0	S
    -Rule	LH	1985	only	-	Oct	lastSun	2:00	0:30	D
    -Rule	LH	1986	1989	-	Mar	Sun>=15	2:00	0	S
    -Rule	LH	1986	only	-	Oct	19	2:00	0:30	D
    -Rule	LH	1987	1999	-	Oct	lastSun	2:00	0:30	D
    -Rule	LH	1990	1995	-	Mar	Sun>=1	2:00	0	S
    -Rule	LH	1996	2005	-	Mar	lastSun	2:00	0	S
    -Rule	LH	2000	only	-	Aug	lastSun	2:00	0:30	D
    -Rule	LH	2001	2007	-	Oct	lastSun	2:00	0:30	D
    -Rule	LH	2006	only	-	Apr	Sun>=1	2:00	0	S
    -Rule	LH	2007	only	-	Mar	lastSun	2:00	0	S
    -Rule	LH	2008	max	-	Apr	Sun>=1	2:00	0	S
    -Rule	LH	2008	max	-	Oct	Sun>=1	2:00	0:30	D
    -Zone Australia/Lord_Howe 10:36:20 -	LMT	1895 Feb
    -			10:00	-	AEST	1981 Mar
    -			10:30	LH	LH%sT
    -
    -# Australian miscellany
    -#
    -# Ashmore Is, Cartier
    -# no indigenous inhabitants; only seasonal caretakers
    -# no times are set
    -#
    -# Coral Sea Is
    -# no indigenous inhabitants; only meteorologists
    -# no times are set
    -#
    -# Macquarie
    -# Permanent occupation (scientific station) 1911-1915 and since 25 March 1948;
    -# sealing and penguin oil station operated Nov 1899 to Apr 1919.  See the
    -# Tasmania Parks & Wildlife Service history of sealing at Macquarie Island
    -# http://www.parks.tas.gov.au/index.aspx?base=1828
    -# http://www.parks.tas.gov.au/index.aspx?base=1831
    -# Guess that it was like Australia/Hobart while inhabited before 2010.
    -#
    -# From Steffen Thorsen (2010-03-10):
    -# We got these changes from the Australian Antarctic Division:
    -# - Macquarie Island will stay on UTC+11 for winter and therefore not
    -# switch back from daylight savings time when other parts of Australia do
    -# on 4 April.
    -#
    -# From Arthur David Olson (2013-05-23):
    -# The 1919 transition is overspecified below so pre-2013 zics
    -# will produce a binary file with an [A]EST-type as the first 32-bit type;
    -# this is required for correct handling of times before 1916 by
    -# pre-2013 versions of localtime.
    -Zone Antarctica/Macquarie 0	-	zzz	1899 Nov
    -			10:00	-	AEST	1916 Oct  1  2:00
    -			10:00	1:00	AEDT	1917 Feb
    -			10:00	Aus	AE%sT	1919 Apr  1  0:00s
    -			0	-	zzz	1948 Mar 25
    -			10:00	Aus	AE%sT	1967
    -			10:00	AT	AE%sT	2010 Apr  4  3:00
    -			11:00	-	MIST	# Macquarie I Standard Time
    -
    -# Christmas
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Indian/Christmas	7:02:52 -	LMT	1895 Feb
    -			7:00	-	CXT	# Christmas Island Time
    -
    -# Cocos (Keeling) Is
    -# These islands were ruled by the Ross family from about 1830 to 1978.
    -# We don't know when standard time was introduced; for now, we guess 1900.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Indian/Cocos	6:27:40	-	LMT	1900
    -			6:30	-	CCT	# Cocos Islands Time
    -
    -
    -# Fiji
    -
    -# Milne gives 11:55:44 for Suva.
    -
    -# From Alexander Krivenyshev (2009-11-10):
    -# According to Fiji Broadcasting Corporation,  Fiji plans to re-introduce DST
    -# from November 29th 2009  to April 25th 2010.
    -#
    -# "Daylight savings to commence this month"
    -# http://www.radiofiji.com.fj/fullstory.php?id=23719
    -# http://www.worldtimezone.com/dst_news/dst_news_fiji01.html
    -
    -# From Steffen Thorsen (2009-11-10):
    -# The Fiji Government has posted some more details about the approved
    -# amendments:
    -# http://www.fiji.gov.fj/publish/page_16198.shtml
    -
    -# From Steffen Thorsen (2010-03-03):
    -# The Cabinet in Fiji has decided to end DST about a month early, on
    -# 2010-03-28 at 03:00.
    -# The plan is to observe DST again, from 2010-10-24 to sometime in March
    -# 2011 (last Sunday a good guess?).
    -#
    -# Official source:
    -# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=1096:3310-cabinet-approves-change-in-daylight-savings-dates&catid=49:cabinet-releases&Itemid=166
    -#
    -# A bit more background info here:
    -# http://www.timeanddate.com/news/time/fiji-dst-ends-march-2010.html
    -
    -# From Alexander Krivenyshev (2010-10-24):
    -# According to Radio Fiji and Fiji Times online, Fiji will end DST 3
    -# weeks earlier than expected - on March 6, 2011, not March 27, 2011...
    -# Here is confirmation from Government of the Republic of the Fiji Islands,
    -# Ministry of Information (fiji.gov.fj) web site:
    -# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=2608:daylight-savings&catid=71:press-releases&Itemid=155
    -# http://www.worldtimezone.com/dst_news/dst_news_fiji04.html
    -
    -# From Steffen Thorsen (2011-10-03):
    -# Now the dates have been confirmed, and at least our start date
    -# assumption was correct (end date was one week wrong).
    -#
    -# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=4966:daylight-saving-starts-in-fiji&catid=71:press-releases&Itemid=155
    -# which says
    -# Members of the public are reminded to change their time to one hour in
    -# advance at 2am to 3am on October 23, 2011 and one hour back at 3am to
    -# 2am on February 26 next year.
    -
    -# From Ken Rylander (2011-10-24)
    -# Another change to the Fiji DST end date. In the TZ database the end date for
    -# Fiji DST 2012, is currently Feb 26. This has been changed to Jan 22.
    -#
    -# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=5017:amendments-to-daylight-savings&catid=71:press-releases&Itemid=155
    -# states:
    -#
    -# The end of daylight saving scheduled initially for the 26th of February 2012
    -# has been brought forward to the 22nd of January 2012.
    -# The commencement of daylight saving will remain unchanged and start
    -# on the  23rd of October, 2011.
    -
    -# From the Fiji Government Online Portal (2012-08-21) via Steffen Thorsen:
    -# The Minister for Labour, Industrial Relations and Employment Mr Jone Usamate
    -# today confirmed that Fiji will start daylight savings at 2 am on Sunday 21st
    -# October 2012 and end at 3 am on Sunday 20th January 2013.
    -# http://www.fiji.gov.fj/index.php?option=com_content&view=article&id=6702&catid=71&Itemid=155
    -
    -# From the Fijian Government Media Center (2013-08-30) via David Wheeler:
    -# Fiji will start daylight savings on Sunday 27th October, 2013 ...
    -# move clocks forward by one hour from 2am
    -# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-27th-OCTOBER-201.aspx
    -
    -# From Steffen Thorsen (2013-01-10):
    -# Fiji will end DST on 2014-01-19 02:00:
    -# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx
    -
    -# From Ken Rylander (2014-10-20):
    -# DST will start Nov. 2 this year.
    -# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-NOVEMBER-2ND.aspx
    -
    -# From Paul Eggert (2014-10-20):
    -# For now, guess DST from 02:00 the first Sunday in November to
    -# 03:00 the first Sunday on or after January 18.  Although ad hoc, it
    -# matches this year's plan and seems more likely to match future
    -# practice than guessing no DST.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
    -Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
    -Rule	Fiji	2009	only	-	Nov	29	2:00	1:00	S
    -Rule	Fiji	2010	only	-	Mar	lastSun	3:00	0	-
    -Rule	Fiji	2010	2013	-	Oct	Sun>=21	2:00	1:00	S
    -Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
    -Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
    -Rule	Fiji	2014	only	-	Jan	Sun>=18	2:00	0	-
    -Rule	Fiji	2014	max	-	Nov	Sun>=1	2:00	1:00	S
    -Rule	Fiji	2015	max	-	Jan	Sun>=18	3:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26 # Suva
    -			12:00	Fiji	FJ%sT	# Fiji Time
    -
    -# French Polynesia
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Gambier	 -8:59:48 -	LMT	1912 Oct # Rikitea
    -			 -9:00	-	GAMT	# Gambier Time
    -Zone	Pacific/Marquesas -9:18:00 -	LMT	1912 Oct
    -			 -9:30	-	MART	# Marquesas Time
    -Zone	Pacific/Tahiti	 -9:58:16 -	LMT	1912 Oct # Papeete
    -			-10:00	-	TAHT	# Tahiti Time
    -# Clipperton (near North America) is administered from French Polynesia;
    -# it is uninhabited.
    -
    -# Guam
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Guam	-14:21:00 -	LMT	1844 Dec 31
    -			 9:39:00 -	LMT	1901        # Agana
    -			10:00	-	GST	2000 Dec 23 # Guam
    -			10:00	-	ChST	# Chamorro Standard Time
    -Link Pacific/Guam Pacific/Saipan # N Mariana Is
    -
    -# Kiribati
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Tarawa	 11:32:04 -	LMT	1901 # Bairiki
    -			 12:00	-	GILT	# Gilbert Is Time
    -Zone Pacific/Enderbury	-11:24:20 -	LMT	1901
    -			-12:00	-	PHOT	1979 Oct # Phoenix Is Time
    -			-11:00	-	PHOT	1995
    -			 13:00	-	PHOT
    -Zone Pacific/Kiritimati	-10:29:20 -	LMT	1901
    -			-10:40	-	LINT	1979 Oct # Line Is Time
    -			-10:00	-	LINT	1995
    -			 14:00	-	LINT
    -
    -# N Mariana Is
    -# See Pacific/Guam.
    -
    -# Marshall Is
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Majuro	11:24:48 -	LMT	1901
    -			11:00	-	MHT	1969 Oct # Marshall Islands Time
    -			12:00	-	MHT
    -Zone Pacific/Kwajalein	11:09:20 -	LMT	1901
    -			11:00	-	MHT	1969 Oct
    -			-12:00	-	KWAT	1993 Aug 20 # Kwajalein Time
    -			12:00	-	MHT
    -
    -# Micronesia
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Chuuk	10:07:08 -	LMT	1901
    -			10:00	-	CHUT	# Chuuk Time
    -Zone Pacific/Pohnpei	10:32:52 -	LMT	1901 # Kolonia
    -			11:00	-	PONT	# Pohnpei Time
    -Zone Pacific/Kosrae	10:51:56 -	LMT	1901
    -			11:00	-	KOST	1969 Oct # Kosrae Time
    -			12:00	-	KOST	1999
    -			11:00	-	KOST
    -
    -# Nauru
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Nauru	11:07:40 -	LMT	1921 Jan 15 # Uaobe
    -			11:30	-	NRT	1942 Mar 15 # Nauru Time
    -			9:00	-	JST	1944 Aug 15
    -			11:30	-	NRT	1979 May
    -			12:00	-	NRT
    -
    -# New Caledonia
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	NC	1977	1978	-	Dec	Sun>=1	0:00	1:00	S
    -Rule	NC	1978	1979	-	Feb	27	0:00	0	-
    -Rule	NC	1996	only	-	Dec	 1	2:00s	1:00	S
    -# Shanks & Pottenger say the following was at 2:00; go with IATA.
    -Rule	NC	1997	only	-	Mar	 2	2:00s	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Noumea	11:05:48 -	LMT	1912 Jan 13 # Nouméa
    -			11:00	NC	NC%sT
    -
    -
    -###############################################################################
    -
    -# New Zealand
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	NZ	1927	only	-	Nov	 6	2:00	1:00	S
    -Rule	NZ	1928	only	-	Mar	 4	2:00	0	M
    -Rule	NZ	1928	1933	-	Oct	Sun>=8	2:00	0:30	S
    -Rule	NZ	1929	1933	-	Mar	Sun>=15	2:00	0	M
    -Rule	NZ	1934	1940	-	Apr	lastSun	2:00	0	M
    -Rule	NZ	1934	1940	-	Sep	lastSun	2:00	0:30	S
    -Rule	NZ	1946	only	-	Jan	 1	0:00	0	S
    -# Since 1957 Chatham has been 45 minutes ahead of NZ, but there's no
    -# convenient single notation for the date and time of this transition
    -# so we must duplicate the Rule lines.
    -Rule	NZ	1974	only	-	Nov	Sun>=1	2:00s	1:00	D
    -Rule	Chatham	1974	only	-	Nov	Sun>=1	2:45s	1:00	D
    -Rule	NZ	1975	only	-	Feb	lastSun	2:00s	0	S
    -Rule	Chatham	1975	only	-	Feb	lastSun	2:45s	0	S
    -Rule	NZ	1975	1988	-	Oct	lastSun	2:00s	1:00	D
    -Rule	Chatham	1975	1988	-	Oct	lastSun	2:45s	1:00	D
    -Rule	NZ	1976	1989	-	Mar	Sun>=1	2:00s	0	S
    -Rule	Chatham	1976	1989	-	Mar	Sun>=1	2:45s	0	S
    -Rule	NZ	1989	only	-	Oct	Sun>=8	2:00s	1:00	D
    -Rule	Chatham	1989	only	-	Oct	Sun>=8	2:45s	1:00	D
    -Rule	NZ	1990	2006	-	Oct	Sun>=1	2:00s	1:00	D
    -Rule	Chatham	1990	2006	-	Oct	Sun>=1	2:45s	1:00	D
    -Rule	NZ	1990	2007	-	Mar	Sun>=15	2:00s	0	S
    -Rule	Chatham	1990	2007	-	Mar	Sun>=15	2:45s	0	S
    -Rule	NZ	2007	max	-	Sep	lastSun	2:00s	1:00	D
    -Rule	Chatham	2007	max	-	Sep	lastSun	2:45s	1:00	D
    -Rule	NZ	2008	max	-	Apr	Sun>=1	2:00s	0	S
    -Rule	Chatham	2008	max	-	Apr	Sun>=1	2:45s	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Auckland	11:39:04 -	LMT	1868 Nov  2
    -			11:30	NZ	NZ%sT	1946 Jan  1
    -			12:00	NZ	NZ%sT
    -Zone Pacific/Chatham	12:13:48 -	LMT	1868 Nov  2
    -			12:15	-	CHAST	1946 Jan  1
    -			12:45	Chatham	CHA%sT
    -
    -Link Pacific/Auckland Antarctica/McMurdo
    -
    -# Auckland Is
    -# uninhabited; MÄori and Moriori, colonial settlers, pastoralists, sealers,
    -# and scientific personnel have wintered
    -
    -# Campbell I
    -# minor whaling stations operated 1909/1914
    -# scientific station operated 1941/1995;
    -# previously whalers, sealers, pastoralists, and scientific personnel wintered
    -# was probably like Pacific/Auckland
    -
    -# Cook Is
    -# From Shanks & Pottenger:
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Cook	1978	only	-	Nov	12	0:00	0:30	HS
    -Rule	Cook	1979	1991	-	Mar	Sun>=1	0:00	0	-
    -Rule	Cook	1979	1990	-	Oct	lastSun	0:00	0:30	HS
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Rarotonga	-10:39:04 -	LMT	1901        # Avarua
    -			-10:30	-	CKT	1978 Nov 12 # Cook Is Time
    -			-10:00	Cook	CK%sT
    -
    -###############################################################################
    -
    -
    -# Niue
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Niue	-11:19:40 -	LMT	1901        # Alofi
    -			-11:20	-	NUT	1951        # Niue Time
    -			-11:30	-	NUT	1978 Oct  1
    -			-11:00	-	NUT
    -
    -# Norfolk
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Norfolk	11:11:52 -	LMT	1901 # Kingston
    -			11:12	-	NMT	1951 # Norfolk Mean Time
    -			11:30	-	NFT	# Norfolk Time
    -
    -# Palau (Belau)
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Palau	8:57:56 -	LMT	1901 # Koror
    -			9:00	-	PWT	# Palau Time
    -
    -# Papua New Guinea
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Port_Moresby 9:48:40 -	LMT	1880
    -			9:48:32	-	PMMT	1895 # Port Moresby Mean Time
    -			10:00	-	PGT	# Papua New Guinea Time
    -#
    -# From Paul Eggert (2014-10-13):
    -# Base the Bougainville entry on the Arawa-Kieta region, which appears to have
    -# the most people even though it was devastated in the Bougainville Civil War.
    -#
    -# Although Shanks gives 1942-03-15 / 1943-11-01 for JST, these dates
    -# are apparently rough guesswork from the starts of military campaigns.
    -# The World War II entries below are instead based on Arawa-Kieta.
    -# The Japanese occupied Kieta in July 1942,
    -# according to the Pacific War Online Encyclopedia
    -# http://pwencycl.kgbudge.com/B/o/Bougainville.htm
    -# and seem to have controlled it until their 1945-08-21 surrender.
    -#
    -# The Autonomous Region of Bougainville plans to switch from UTC+10 to UTC+11
    -# on 2014-12-28 at 02:00.  They call UTC+11 "Bougainville Standard Time";
    -# abbreviate this as BST.  See:
    -# http://www.bougainville24.com/bougainville-issues/bougainville-gets-own-timezone/
    -#
    -Zone Pacific/Bougainville 10:22:16 -	LMT	1880
    -			 9:48:32 -	PMMT	1895
    -			10:00	-	PGT	1942 Jul
    -			 9:00	-	JST	1945 Aug 21
    -			10:00	-	PGT	2014 Dec 28  2:00
    -			11:00	-	BST
    -
    -# Pitcairn
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Pitcairn	-8:40:20 -	LMT	1901        # Adamstown
    -			-8:30	-	PNT	1998 Apr 27  0:00
    -			-8:00	-	PST	# Pitcairn Standard Time
    -
    -# American Samoa
    -Zone Pacific/Pago_Pago	 12:37:12 -	LMT	1879 Jul  5
    -			-11:22:48 -	LMT	1911
    -			-11:00	-	NST	1967 Apr    # N=Nome
    -			-11:00	-	BST	1983 Nov 30 # B=Bering
    -			-11:00	-	SST	            # S=Samoa
    -Link Pacific/Pago_Pago Pacific/Midway # in US minor outlying islands
    -
    -# Samoa (formerly and also known as Western Samoa)
    -
    -# From Steffen Thorsen (2009-10-16):
    -# We have been in contact with the government of Samoa again, and received
    -# the following info:
    -#
    -# "Cabinet has now approved Daylight Saving to be effected next year
    -# commencing from the last Sunday of September 2010 and conclude first
    -# Sunday of April 2011."
    -#
    -# Background info:
    -# http://www.timeanddate.com/news/time/samoa-dst-plan-2009.html
    -#
    -# Samoa's Daylight Saving Time Act 2009 is available here, but does not
    -# contain any dates:
    -# http://www.parliament.gov.ws/documents/acts/Daylight%20Saving%20Act%20%202009%20%28English%29%20-%20Final%207-7-091.pdf
    -
    -# From Laupue Raymond Hughes (2010-10-07):
    -# Please see
    -# http://www.mcil.gov.ws
    -# the Ministry of Commerce, Industry and Labour (sideframe) "Last Sunday
    -# September 2010 (26/09/10) - adjust clocks forward from 12:00 midnight
    -# to 01:00am and First Sunday April 2011 (03/04/11) - adjust clocks
    -# backwards from 1:00am to 12:00am"
    -
    -# From Laupue Raymond Hughes (2011-03-07):
    -# [http://www.mcil.gov.ws/ftcd/daylight_saving_2011.pdf]
    -#
    -# ... when the standard time strikes the hour of four o'clock (4.00am
    -# or 0400 Hours) on the 2nd April 2011, then all instruments used to
    -# measure standard time are to be adjusted/changed to three o'clock
    -# (3:00am or 0300Hrs).
    -
    -# From David Zülke (2011-05-09):
    -# Subject: Samoa to move timezone from east to west of international date line
    -#
    -# http://www.morningstar.co.uk/uk/markets/newsfeeditem.aspx?id=138501958347963
    -
    -# From Paul Eggert (2014-06-27):
    -# The International Date Line Act 2011
    -# http://www.parliament.gov.ws/images/ACTS/International_Date_Line_Act__2011_-_Eng.pdf
    -# changed Samoa from UTC-11 to UTC+13, effective "12 o'clock midnight, on
    -# Thursday 29th December 2011".  The International Date Line was adjusted
    -# accordingly.
    -
    -# From Laupue Raymond Hughes (2011-09-02):
    -# http://www.mcil.gov.ws/mcil_publications.html
    -#
    -# here is the official website publication for Samoa DST and dateline change
    -#
    -# DST
    -# Year  End      Time              Start        Time
    -# 2011  - - -    - - -             24 September 3:00am to 4:00am
    -# 2012  01 April 4:00am to 3:00am  - - -        - - -
    -#
    -# Dateline Change skip Friday 30th Dec 2011
    -# Thursday 29th December 2011	23:59:59 Hours
    -# Saturday 31st December 2011	00:00:00 Hours
    -#
    -# From Nicholas Pereira (2012-09-10):
    -# Daylight Saving Time commences on Sunday 30th September 2012 and
    -# ends on Sunday 7th of April 2013....
    -# http://www.mcil.gov.ws/mcil_publications.html
    -#
    -# From Paul Eggert (2014-07-08):
    -# That web page currently lists transitions for 2012/3 and 2013/4.
    -# Assume the pattern instituted in 2012 will continue indefinitely.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	WS	2010	only	-	Sep	lastSun	0:00	1	D
    -Rule	WS	2011	only	-	Apr	Sat>=1	4:00	0	S
    -Rule	WS	2011	only	-	Sep	lastSat	3:00	1	D
    -Rule	WS	2012	max	-	Apr	Sun>=1	4:00	0	S
    -Rule	WS	2012	max	-	Sep	lastSun	3:00	1	D
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Apia	 12:33:04 -	LMT	1879 Jul  5
    -			-11:26:56 -	LMT	1911
    -			-11:30	-	WSST	1950
    -			-11:00	WS	S%sT	2011 Dec 29 24:00 # S=Samoa
    -			 13:00	WS	WS%sT
    -
    -# Solomon Is
    -# excludes Bougainville, for which see Papua New Guinea
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Guadalcanal 10:39:48 -	LMT	1912 Oct # Honiara
    -			11:00	-	SBT	# Solomon Is Time
    -
    -# Tokelau Is
    -#
    -# From Gwillim Law (2011-12-29)
    -# A correspondent informed me that Tokelau, like Samoa, will be skipping
    -# December 31 this year ...
    -#
    -# From Steffen Thorsen (2012-07-25)
    -# ... we double checked by calling hotels and offices based in Tokelau asking
    -# about the time there, and they all told a time that agrees with UTC+13....
    -# Shanks says UTC-10 from 1901 [but] ... there is a good chance the change
    -# actually was to UTC-11 back then.
    -#
    -# From Paul Eggert (2012-07-25)
    -# A Google Books snippet of Appendix to the Journals of the House of
    -# Representatives of New Zealand, Session 1948,
    -# , page 65, says Tokelau
    -# was "11 hours slow on G.M.T."  Go with Thorsen and assume Shanks & Pottenger
    -# are off by an hour starting in 1901.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Fakaofo	-11:24:56 -	LMT	1901
    -			-11:00	-	TKT	2011 Dec 30 # Tokelau Time
    -			13:00	-	TKT
    -
    -# Tonga
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Tonga	1999	only	-	Oct	 7	2:00s	1:00	S
    -Rule	Tonga	2000	only	-	Mar	19	2:00s	0	-
    -Rule	Tonga	2000	2001	-	Nov	Sun>=1	2:00	1:00	S
    -Rule	Tonga	2001	2002	-	Jan	lastSun	2:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Tongatapu	12:19:20 -	LMT	1901
    -			12:20	-	TOT	1941 # Tonga Time
    -			13:00	-	TOT	1999
    -			13:00	Tonga	TO%sT
    -
    -# Tuvalu
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Funafuti	11:56:52 -	LMT	1901
    -			12:00	-	TVT	# Tuvalu Time
    -
    -
    -# US minor outlying islands
    -
    -# Howland, Baker
    -# Howland was mined for guano by American companies 1857-1878 and British
    -# 1886-1891; Baker was similar but exact dates are not known.
    -# Inhabited by civilians 1935-1942; U.S. military bases 1943-1944;
    -# uninhabited thereafter.
    -# Howland observed Hawaii Standard Time (UT-10:30) in 1937;
    -# see page 206 of Elgen M. Long and Marie K. Long,
    -# Amelia Earhart: the Mystery Solved, Simon & Schuster (2000).
    -# So most likely Howland and Baker observed Hawaii Time from 1935
    -# until they were abandoned after the war.
    -
    -# Jarvis
    -# Mined for guano by American companies 1857-1879 and British 1883?-1891?.
    -# Inhabited by civilians 1935-1942; IGY scientific base 1957-1958;
    -# uninhabited thereafter.
    -# no information; was probably like Pacific/Kiritimati
    -
    -# Johnston
    -#
    -# From Paul Eggert (2014-03-11):
    -# Sometimes Johnston kept Hawaii time, and sometimes it was an hour behind.
    -# Details are uncertain.  We have no data for Johnston after 1970, so
    -# treat it like Hawaii for now.
    -#
    -# In his memoirs of June 6th to October 4, 1945
    -#  (2005), Herbert C. Bach writes,
    -# "We started our letdown to Kwajalein Atoll and landed there at 5:00 AM
    -# Johnston time, 1:30 AM Kwajalein time."  This was in June 1945, and
    -# confirms that Johnston kept the same time as Honolulu in summer 1945.
    -#
    -# From Lyle McElhaney (2014-03-11):
    -# [W]hen JI was being used for that [atomic bomb] testing, the time being used
    -# was not Hawaiian time but rather the same time being used on the ships,
    -# which had a GMT offset of -11 hours.  This apparently applied to at least the
    -# time from Operation Newsreel (Hardtack I/Teak shot, 1958-08-01) to the last
    -# Operation Fishbowl shot (Tightrope, 1962-11-04).... [See] Herman Hoerlin,
    -# "The United States High-Altitude Test Experience: A Review Emphasizing the
    -# Impact on the Environment", Los Alamos LA-6405, Oct 1976.
    -# http://www.fas.org/sgp/othergov/doe/lanl/docs1/00322994.pdf
    -# See the table on page 4 where he lists GMT and local times for the tests; a
    -# footnote for the JI tests reads that local time is "JI time = Hawaii Time
    -# Minus One Hour".
    -#
    -# See 'northamerica' for Pacific/Johnston.
    -
    -# Kingman
    -# uninhabited
    -
    -# Midway
    -# See Pacific/Pago_Pago.
    -
    -# Palmyra
    -# uninhabited since World War II; was probably like Pacific/Kiritimati
    -
    -# Wake
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Wake	11:06:28 -	LMT	1901
    -			12:00	-	WAKT	# Wake Time
    -
    -
    -# Vanuatu
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Vanuatu	1983	only	-	Sep	25	0:00	1:00	S
    -Rule	Vanuatu	1984	1991	-	Mar	Sun>=23	0:00	0	-
    -Rule	Vanuatu	1984	only	-	Oct	23	0:00	1:00	S
    -Rule	Vanuatu	1985	1991	-	Sep	Sun>=23	0:00	1:00	S
    -Rule	Vanuatu	1992	1993	-	Jan	Sun>=23	0:00	0	-
    -Rule	Vanuatu	1992	only	-	Oct	Sun>=23	0:00	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Efate	11:13:16 -	LMT	1912 Jan 13 # Vila
    -			11:00	Vanuatu	VU%sT	# Vanuatu Time
    -
    -# Wallis and Futuna
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Pacific/Wallis	12:15:20 -	LMT	1901
    -			12:00	-	WFT	# Wallis & Futuna Time
    -
    -###############################################################################
    -
    -# NOTES
    -
    -# This file is by no means authoritative; if you think you know better,
    -# go ahead and edit the file (and please send any changes to
    -# tz@iana.org for general use in the future).  For more, please see
    -# the file CONTRIBUTING in the tz distribution.
    -
    -# From Paul Eggert (2014-10-31):
    -#
    -# Unless otherwise specified, the source for data through 1990 is:
    -# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
    -# San Diego: ACS Publications, Inc. (2003).
    -# Unfortunately this book contains many errors and cites no sources.
    -#
    -# Gwillim Law writes that a good source
    -# for recent time zone data is the International Air Transport
    -# Association's Standard Schedules Information Manual (IATA SSIM),
    -# published semiannually.  Law sent in several helpful summaries
    -# of the IATA's data after 1990.  Except where otherwise noted,
    -# IATA SSIM is the source for entries after 1990.
    -#
    -# Another source occasionally used is Edward W. Whitman, World Time Differences,
    -# Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
    -# I found in the UCLA library.
    -#
    -# For data circa 1899, a common source is:
    -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
    -# http://www.jstor.org/stable/1774359
    -#
    -# A reliable and entertaining source about time zones is
    -# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
    -#
    -# I invented the abbreviations marked '*' in the following table;
    -# the rest are from earlier versions of this file, or from other sources.
    -# Corrections are welcome!
    -#		std	dst
    -#		LMT		Local Mean Time
    -#	  8:00	AWST	AWDT	Western Australia
    -#	  8:45	ACWST	ACWDT	Central Western Australia*
    -#	  9:00	JST		Japan
    -#	  9:30	ACST	ACDT	Central Australia
    -#	 10:00	AEST	AEDT	Eastern Australia
    -#	 10:00	ChST		Chamorro
    -#	 10:30	LHST	LHDT	Lord Howe*
    -#	 11:00	BST		Bougainville*
    -#	 11:30	NZMT	NZST	New Zealand through 1945
    -#	 12:00	NZST	NZDT	New Zealand 1946-present
    -#	 12:15	CHAST		Chatham through 1945*
    -#	 12:45	CHAST	CHADT	Chatham 1946-present*
    -#	 13:00	WSST	WSDT	(western) Samoa 2011-present*
    -#	-11:30	WSST		Western Samoa through 1950*
    -#	-11:00	SST		Samoa
    -#	-10:00	HST		Hawaii
    -#	- 8:00	PST		Pitcairn*
    -#
    -# See the 'northamerica' file for Hawaii.
    -# See the 'southamerica' file for Easter I and the Galápagos Is.
    -
    -###############################################################################
    -
    -# Australia
    -
    -# From Paul Eggert (2014-06-30):
    -# Daylight saving time has long been controversial in Australia, pitting
    -# region against region, rural against urban, and local against global.
    -# For example, in her review of Graeme Davison's _The Unforgiving
    -# Minute: how Australians learned to tell the time_ (1993), Perth native
    -# Phillipa J Martyr wrote, "The section entitled 'Saving Daylight' was
    -# very informative, but was (as can, sadly, only be expected from a
    -# Melbourne-based study) replete with the usual chuckleheaded
    -# Queenslanders and straw-chewing yokels from the West prattling fables
    -# about fading curtains and crazed farm animals."
    -# Electronic Journal of Australian and New Zealand History (1997-03-03)
    -# http://www.jcu.edu.au/aff/history/reviews/davison.htm
    -
    -# From Paul Eggert (2005-12-08):
    -# Implementation Dates of Daylight Saving Time within Australia
    -# http://www.bom.gov.au/climate/averages/tables/dst_times.shtml
    -# summarizes daylight saving issues in Australia.
    -
    -# From Arthur David Olson (2005-12-12):
    -# Lawlink NSW:Daylight Saving in New South Wales
    -# http://www.lawlink.nsw.gov.au/lawlink/Corporate/ll_agdinfo.nsf/pages/community_relations_daylight_saving
    -# covers New South Wales in particular.
    -
    -# From John Mackin (1991-03-06):
    -# We in Australia have _never_ referred to DST as 'daylight' time.
    -# It is called 'summer' time.  Now by a happy coincidence, 'summer'
    -# and 'standard' happen to start with the same letter; hence, the
    -# abbreviation does _not_ change...
    -# The legislation does not actually define abbreviations, at least
    -# in this State, but the abbreviation is just commonly taken to be the
    -# initials of the phrase, and the legislation here uniformly uses
    -# the phrase 'summer time' and does not use the phrase 'daylight
    -# time'.
    -# Announcers on the Commonwealth radio network, the ABC (for Australian
    -# Broadcasting Commission), use the phrases 'Eastern Standard Time'
    -# or 'Eastern Summer Time'.  (Note, though, that as I say in the
    -# current australasia file, there is really no such thing.)  Announcers
    -# on its overseas service, Radio Australia, use the same phrases
    -# prefixed by the word 'Australian' when referring to local times;
    -# time announcements on that service, naturally enough, are made in UTC.
    -
    -# From Paul Eggert (2014-06-30):
    -#
    -# Inspired by Mackin's remarks quoted above, earlier versions of this
    -# file used "EST" for both Eastern Standard Time and Eastern Summer
    -# Time in Australia, and similarly for "CST", "CWST", and "WST".
    -# However, these abbreviations were confusing and were not common
    -# practice among Australians, and there were justifiable complaints
    -# about them, so I attempted to survey current Australian usage.
    -# For the tz database, the full English phrase is not that important;
    -# what matters is the abbreviation.  It's difficult to survey the web
    -# directly for abbreviation usage, as there are so many false hits for
    -# strings like "EST" and "EDT", so I looked for pages that defined an
    -# abbreviation for eastern or central DST in Australia, and got the
    -# following numbers of unique hits for the listed Google queries:
    -#
    -#   10 "Eastern Daylight Time AEST" site:au [some are false hits]
    -#   10 "Eastern Summer Time AEST" site:au
    -#   10 "Summer Time AEDT" site:au
    -#   13 "EDST Eastern Daylight Saving Time" site:au
    -#   18 "Summer Time ESST" site:au
    -#   28 "Eastern Daylight Saving Time EDST" site:au
    -#   39 "EDT Eastern Daylight Time" site:au [some are false hits]
    -#   53 "Eastern Daylight Time EDT" site:au [some are false hits]
    -#   54 "AEDT Australian Eastern Daylight Time" site:au
    -#  182 "Eastern Daylight Time AEDT" site:au
    -#
    -#   17 "Central Daylight Time CDT" site:au [some are false hits]
    -#   46 "Central Daylight Time ACDT" site:au
    -#
    -# I tried several other variants (e.g., "Eastern Summer Time EST") but
    -# they all returned fewer than 10 unique hits.  I also looked for pages
    -# mentioning both "western standard time" and an abbreviation, since
    -# there is no WST in the US to generate false hits, and found:
    -#
    -#  156 "western standard time" AWST site:au
    -#  226 "western standard time" WST site:au
    -#
    -# I then surveyed the top ten newspapers in Australia by circulation as
    -# listed in Wikipedia, using Google queries like "AEDT site:heraldsun.com.au"
    -# and obtaining estimated counts from the initial page of search results.
    -# All ten papers greatly preferred "AEDT" to "EDT".  The papers
    -# surveyed were the Herald Sun, The Daily Telegraph, The Courier-Mail,
    -# The Sydney Morning Herald, The West Australian, The Age, The Advertiser,
    -# The Australian, The Financial Review, and The Herald (Newcastle).
    -#
    -# I also searched for historical usage, to see whether abbreviations
    -# like "AEDT" are new.  A Trove search 
    -# found only one newspaper (The Canberra Times) with a house style
    -# dating back to the 1970s, I expect because other newspapers weren't
    -# fully indexed.  The Canberra Times strongly preferred abbreviations
    -# like "AEDT".  The first occurrence of "AEDT" was a World Weather
    -# column (1971-11-17, page 24), and of "ACDT" was a Scoreboard column
    -# (1993-01-24, p 16).  The style was the typical usage but was not
    -# strictly enforced; for example, "Welcome to the twilight zones ..."
    -# (1994-10-29, p 1) uses the abbreviations AEST/AEDT, CST/CDT, and
    -# WST, and goes on to say, "The confusion and frustration some feel
    -# about the lack of uniformity among Australia's six states and two
    -# territories has prompted one group to form its very own political
    -# party -- the Sydney-based Daylight Saving Extension Party."
    -#
    -# I also surveyed federal government sources.  They did not agree:
    -#
    -#   The Australian Government (2014-03-26)
    -#   http://australia.gov.au/about-australia/our-country/time
    -#   (This document was produced by the Department of Finance.)
    -#   AEST ACST AWST AEDT ACDT
    -#
    -#   Bureau of Meteorology (2012-11-08)
    -#   http://www.bom.gov.au/climate/averages/tables/daysavtm.shtml
    -#   EST CST WST EDT CDT
    -#
    -#   Civil Aviation Safety Authority (undated)
    -#   http://services.casa.gov.au/outnback/inc/pages/episode3/episode-3_time_zones.shtml
    -#   EST CST WST (no abbreviations given for DST)
    -#
    -#   Geoscience Australia (2011-11-24)
    -#   http://www.ga.gov.au/geodesy/astro/sunrise.jsp
    -#   AEST ACST AWST AEDT ACDT
    -#
    -#   Parliamentary Library (2008-11-10)
    -#   http://www.aph.gov.au/binaries/library/pubs/rp/2008-09/09rp14.pdf
    -#   EST CST WST preferred for standard time; AEST AEDT ACST ACDT also used
    -#
    -#   The Transport Safety Bureau has an extensive series of accident reports,
    -#   and investigators seem to use whatever abbreviation they like.
    -#   Googling site:atsb.gov.au found the following number of unique hits:
    -#   311 "ESuT", 195 "EDT", 26 "AEDT", 83 "CSuT", 46 "CDT".
    -#   "_SuT" tended to appear in older reports, and "A_DT" tended to
    -#   appear in reports of events with international implications.
    -#
    -# From the above it appears that there is a working consensus in
    -# Australia to use trailing "DT" for daylight saving time; although
    -# some sources use trailing "SST" or "ST" or "SuT" they are by far in
    -# the minority.  The case for leading "A" is weaker, but since it
    -# seems to be preferred in the overall web and is preferred in all
    -# the leading newspaper websites and in many government departments,
    -# it has a stronger case than omitting the leading "A".  The current
    -# version of the database therefore uses abbreviations like "AEST" and
    -# "AEDT" for Australian time zones.
    -
    -# From Paul Eggert (1995-12-19):
    -# Shanks & Pottenger report 2:00 for all autumn changes in Australia and NZ.
    -# Mark Prior writes that his newspaper
    -# reports that NSW's fall 1995 change will occur at 2:00,
    -# but Robert Elz says it's been 3:00 in Victoria since 1970
    -# and perhaps the newspaper's '2:00' is referring to standard time.
    -# For now we'll continue to assume 2:00s for changes since 1960.
    -
    -# From Eric Ulevik (1998-01-05):
    -#
    -# Here are some URLs to Australian time legislation. These URLs are stable,
    -# and should probably be included in the data file. There are probably more
    -# relevant entries in this database.
    -#
    -# NSW (including LHI and Broken Hill):
    -# Standard Time Act 1987 (updated 1995-04-04)
    -# http://www.austlii.edu.au/au/legis/nsw/consol_act/sta1987137/index.html
    -# ACT
    -# Standard Time and Summer Time Act 1972
    -# http://www.austlii.edu.au/au/legis/act/consol_act/stasta1972279/index.html
    -# SA
    -# Standard Time Act, 1898
    -# http://www.austlii.edu.au/au/legis/sa/consol_act/sta1898137/index.html
    -
    -# From David Grosz (2005-06-13):
    -# It was announced last week that Daylight Saving would be extended by
    -# one week next year to allow for the 2006 Commonwealth Games.
    -# Daylight Saving is now to end for next year only on the first Sunday
    -# in April instead of the last Sunday in March.
    -#
    -# From Gwillim Law (2005-06-14):
    -# I did some Googling and found that all of those states (and territory) plan
    -# to extend DST together in 2006.
    -# ACT: http://www.cmd.act.gov.au/mediareleases/fileread.cfm?file=86.txt
    -# New South Wales: http://www.thecouriermail.news.com.au/common/story_page/0,5936,15538869%255E1702,00.html
    -# South Australia: http://www.news.com.au/story/0,10117,15555031-1246,00.html
    -# Tasmania: http://www.media.tas.gov.au/release.php?id=14772
    -# Victoria: I wasn't able to find anything separate, but the other articles
    -# allude to it.
    -# But not Queensland
    -# http://www.news.com.au/story/0,10117,15564030-1248,00.html
    -
    -# Northern Territory
    -
    -# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
    -# # The NORTHERN TERRITORY..  [ Courtesy N.T. Dept of the Chief Minister ]
    -# #					[ Nov 1990 ]
    -# #	N.T. have never utilised any DST due to sub-tropical/tropical location.
    -# ...
    -# Zone        Australia/North         9:30    -       CST
    -
    -# From Bradley White (1991-03-04):
    -# A recent excerpt from an Australian newspaper...
    -# the Northern Territory do[es] not have daylight saving.
    -
    -# Western Australia
    -
    -# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
    -# #  The state of WESTERN AUSTRALIA..  [ Courtesy W.A. dept Premier+Cabinet ]
    -# #						[ Nov 1990 ]
    -# #	W.A. suffers from a great deal of public and political opposition to
    -# #	DST in principle. A bill is brought before parliament in most years, but
    -# #	usually defeated either in the upper house, or in party caucus
    -# #	before reaching parliament.
    -# ...
    -# Zone	Australia/West		8:00	AW	%sST
    -# ...
    -# Rule	AW	1974	only	-	Oct	lastSun	2:00	1:00	D
    -# Rule	AW	1975	only	-	Mar	Sun>=1	3:00	0	W
    -# Rule	AW	1983	only	-	Oct	lastSun	2:00	1:00	D
    -# Rule	AW	1984	only	-	Mar	Sun>=1	3:00	0	W
    -
    -# From Bradley White (1991-03-04):
    -# A recent excerpt from an Australian newspaper...
    -# Western Australia...do[es] not have daylight saving.
    -
    -# From John D. Newman via Bradley White (1991-11-02):
    -# Western Australia is still on "winter time". Some DH in Sydney
    -# rang me at home a few days ago at 6.00am. (He had just arrived at
    -# work at 9.00am.)
    -# W.A. is switching to Summer Time on Nov 17th just to confuse
    -# everybody again.
    -
    -# From Arthur David Olson (1992-03-08):
    -# The 1992 ending date used in the rules is a best guess;
    -# it matches what was used in the past.
    -
    -# The Australian Bureau of Meteorology FAQ
    -# http://www.bom.gov.au/faq/faqgen.htm
    -# (1999-09-27) writes that Giles Meteorological Station uses
    -# South Australian time even though it's located in Western Australia.
    -
    -# Queensland
    -# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
    -# #   The state of QUEENSLAND.. [ Courtesy Qld. Dept Premier Econ&Trade Devel ]
    -# #						[ Dec 1990 ]
    -# ...
    -# Zone	Australia/Queensland	10:00	AQ	%sST
    -# ...
    -# Rule	AQ	1971	only	-	Oct	lastSun	2:00	1:00	D
    -# Rule	AQ	1972	only	-	Feb	lastSun	3:00	0	E
    -# Rule	AQ	1989	max	-	Oct	lastSun	2:00	1:00	D
    -# Rule	AQ	1990	max	-	Mar	Sun>=1	3:00	0	E
    -
    -# From Bradley White (1989-12-24):
    -# "Australia/Queensland" now observes daylight time (i.e. from
    -# October 1989).
    -
    -# From Bradley White (1991-03-04):
    -# A recent excerpt from an Australian newspaper...
    -# ...Queensland...[has] agreed to end daylight saving
    -# at 3am tomorrow (March 3)...
    -
    -# From John Mackin (1991-03-06):
    -# I can certainly confirm for my part that Daylight Saving in NSW did in fact
    -# end on Sunday, 3 March.  I don't know at what hour, though.  (It surprised
    -# me.)
    -
    -# From Bradley White (1992-03-08):
    -# ...there was recently a referendum in Queensland which resulted
    -# in the experimental daylight saving system being abandoned. So, ...
    -# ...
    -# Rule	QLD	1989	1991	-	Oct	lastSun	2:00	1:00	D
    -# Rule	QLD	1990	1992	-	Mar	Sun>=1	3:00	0	S
    -# ...
    -
    -# From Arthur David Olson (1992-03-08):
    -# The chosen rules the union of the 1971/1972 change and the 1989-1992 changes.
    -
    -# From Christopher Hunt (2006-11-21), after an advance warning
    -# from Jesper Nørgaard Welen (2006-11-01):
    -# WA are trialing DST for three years.
    -# http://www.parliament.wa.gov.au/parliament/bills.nsf/9A1B183144403DA54825721200088DF1/$File/Bill175-1B.pdf
    -
    -# From Rives McDow (2002-04-09):
    -# The most interesting region I have found consists of three towns on the
    -# southern coast....  South Australia observes daylight saving time; Western
    -# Australia does not.  The two states are one and a half hours apart.  The
    -# residents decided to forget about this nonsense of changing the clock so
    -# much and set the local time 20 hours and 45 minutes from the
    -# international date line, or right in the middle of the time of South
    -# Australia and Western Australia....
    -#
    -# From Paul Eggert (2002-04-09):
    -# This is confirmed by the section entitled
    -# "What's the deal with time zones???" in
    -# http://www.earthsci.unimelb.edu.au/~awatkins/null.html
    -#
    -# From Alex Livingston (2006-12-07):
    -# ... it was just on four years ago that I drove along the Eyre Highway,
    -# which passes through eastern Western Australia close to the southern
    -# coast of the continent.
    -#
    -# I paid particular attention to the time kept there. There can be no
    -# dispute that UTC+08:45 was considered "the time" from the border
    -# village just inside the border with South Australia to as far west
    -# as just east of Caiguna. There can also be no dispute that Eucla is
    -# the largest population centre in this zone....
    -#
    -# Now that Western Australia is observing daylight saving, the
    -# question arose whether this part of the state would follow suit. I
    -# just called the border village and confirmed that indeed they have,
    -# meaning that they are now observing UTC+09:45.
    -#
    -# (2006-12-09):
    -# I personally doubt that either experimentation with daylight saving
    -# in WA or its introduction in SA had anything to do with the genesis
    -# of this time zone.  My hunch is that it's been around since well
    -# before 1975.  I remember seeing it noted on road maps decades ago.
    -
    -# From Paul Eggert (2006-12-15):
    -# For lack of better info, assume the tradition dates back to the
    -# introduction of standard time in 1895.
    -
    -
    -# southeast Australia
    -#
    -# From Paul Eggert (2007-07-23):
    -# Starting autumn 2008 Victoria, NSW, South Australia, Tasmania and the ACT
    -# end DST the first Sunday in April and start DST the first Sunday in October.
    -# http://www.theage.com.au/news/national/daylight-savings-to-span-six-months/2007/06/27/1182623966703.html
    -
    -
    -# South Australia
    -
    -# From Bradley White (1991-03-04):
    -# A recent excerpt from an Australian newspaper...
    -# ...South Australia...[has] agreed to end daylight saving
    -# at 3am tomorrow (March 3)...
    -
    -# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
    -# #   The state of SOUTH AUSTRALIA....[ Courtesy of S.A. Dept of Labour ]
    -# #						[ Nov 1990 ]
    -# ...
    -# Zone	Australia/South		9:30	AS	%sST
    -# ...
    -# Rule	 AS	1971	max	-	Oct	lastSun	2:00	1:00	D
    -# Rule	 AS	1972	1985	-	Mar	Sun>=1	3:00	0	C
    -# Rule	 AS	1986	1990	-	Mar	Sun>=15	3:00	0	C
    -# Rule	 AS	1991	max	-	Mar	Sun>=1	3:00	0	C
    -
    -# From Bradley White (1992-03-11):
    -# Recent correspondence with a friend in Adelaide
    -# contained the following exchange:  "Due to the Adelaide Festival,
    -# South Australia delays setting back our clocks for a few weeks."
    -
    -# From Robert Elz (1992-03-13):
    -# I heard that apparently (or at least, it appears that)
    -# South Aus will have an extra 3 weeks daylight saving every even
    -# numbered year (from 1990).  That's when the Adelaide Festival
    -# is on...
    -
    -# From Robert Elz (1992-03-16, 00:57:07 +1000):
    -# DST didn't end in Adelaide today (yesterday)....
    -# But whether it's "4th Sunday" or "2nd last Sunday" I have no idea whatever...
    -# (it's just as likely to be "the Sunday we pick for this year"...).
    -
    -# From Bradley White (1994-04-11):
    -# If Sun, 15 March, 1992 was at +1030 as kre asserts, but yet Sun, 20 March,
    -# 1994 was at +0930 as John Connolly's customer seems to assert, then I can
    -# only conclude that the actual rule is more complicated....
    -
    -# From John Warburton (1994-10-07):
    -# The new Daylight Savings dates for South Australia ...
    -# was gazetted in the Government Hansard on Sep 26 1994....
    -# start on last Sunday in October and end in last sunday in March.
    -
    -# From Paul Eggert (2007-07-23):
    -# See "southeast Australia" above for 2008 and later.
    -
    -# Tasmania
    -
    -# The rules for 1967 through 1991 were reported by George Shepherd
    -# via Simon Woodhead via Robert Elz (1991-03-06):
    -# #  The state of TASMANIA.. [Courtesy Tasmanian Dept of Premier + Cabinet ]
    -# #					[ Nov 1990 ]
    -
    -# From Bill Hart via Guy Harris (1991-10-10):
    -# Oh yes, the new daylight savings rules are uniquely tasmanian, we have
    -# 6 weeks a year now when we are out of sync with the rest of Australia
    -# (but nothing new about that).
    -
    -# From Alex Livingston (1999-10-04):
    -# I heard on the ABC (Australian Broadcasting Corporation) radio news on the
    -# (long) weekend that Tasmania, which usually goes its own way in this regard,
    -# has decided to join with most of NSW, the ACT, and most of Victoria
    -# (Australia) and start daylight saving on the last Sunday in August in 2000
    -# instead of the first Sunday in October.
    -
    -# Sim Alam (2000-07-03) reported a legal citation for the 2000/2001 rules:
    -# http://www.thelaw.tas.gov.au/fragview/42++1968+GS3A@EN+2000070300
    -
    -# From Paul Eggert (2007-07-23):
    -# See "southeast Australia" above for 2008 and later.
    -
    -# Victoria
    -
    -# The rules for 1971 through 1991 were reported by George Shepherd
    -# via Simon Woodhead via Robert Elz (1991-03-06):
    -# #   The state of VICTORIA.. [ Courtesy of Vic. Dept of Premier + Cabinet ]
    -# #						[ Nov 1990 ]
    -
    -# From Scott Harrington (2001-08-29):
    -# On KQED's "City Arts and Lectures" program last night I heard an
    -# interesting story about daylight savings time.  Dr. John Heilbron was
    -# discussing his book "The Sun in the Church: Cathedrals as Solar
    -# Observatories"[1], and in particular the Shrine of Remembrance[2] located
    -# in Melbourne, Australia.
    -#
    -# Apparently the shrine's main purpose is a beam of sunlight which
    -# illuminates a special spot on the floor at the 11th hour of the 11th day
    -# of the 11th month (Remembrance Day) every year in memory of Australia's
    -# fallen WWI soldiers.  And if you go there on Nov. 11, at 11am local time,
    -# you will indeed see the sunbeam illuminate the special spot at the
    -# expected time.
    -#
    -# However, that is only because of some special mirror contraption that had
    -# to be employed, since due to daylight savings time, the true solar time of
    -# the remembrance moment occurs one hour later (or earlier?).  Perhaps
    -# someone with more information on this jury-rig can tell us more.
    -#
    -# [1] http://www.hup.harvard.edu/catalog/HEISUN.html
    -# [2] http://www.shrine.org.au
    -
    -# From Paul Eggert (2007-07-23):
    -# See "southeast Australia" above for 2008 and later.
    -
    -# New South Wales
    -
    -# From Arthur David Olson:
    -# New South Wales and subjurisdictions have their own ideas of a fun time.
    -# Based on law library research by John Mackin,
    -# who notes:
    -#	In Australia, time is not legislated federally, but rather by the
    -#	individual states.  Thus, while such terms as "Eastern Standard Time"
    -#	[I mean, of course, Australian EST, not any other kind] are in common
    -#	use, _they have NO REAL MEANING_, as they are not defined in the
    -#	legislation.  This is very important to understand.
    -#	I have researched New South Wales time only...
    -
    -# From Eric Ulevik (1999-05-26):
    -# DST will start in NSW on the last Sunday of August, rather than the usual
    -# October in 2000.  See: Matthew Moore,
    -# Two months more daylight saving, Sydney Morning Herald (1999-05-26).
    -# http://www.smh.com.au/news/9905/26/pageone/pageone4.html
    -
    -# From Paul Eggert (1999-09-27):
    -# See the following official NSW source:
    -# Daylight Saving in New South Wales.
    -# http://dir.gis.nsw.gov.au/cgi-bin/genobject/document/other/daylightsaving/tigGmZ
    -#
    -# Narrabri Shire (NSW) council has announced it will ignore the extension of
    -# daylight saving next year.  See:
    -# Narrabri Council to ignore daylight saving
    -# http://abc.net.au/news/regionals/neweng/monthly/regeng-22jul1999-1.htm
    -# (1999-07-22).  For now, we'll wait to see if this really happens.
    -#
    -# Victoria will following NSW.  See:
    -# Vic to extend daylight saving (1999-07-28)
    -# http://abc.net.au/local/news/olympics/1999/07/item19990728112314_1.htm
    -#
    -# However, South Australia rejected the DST request.  See:
    -# South Australia rejects Olympics daylight savings request (1999-07-19)
    -# http://abc.net.au/news/olympics/1999/07/item19990719151754_1.htm
    -#
    -# Queensland also will not observe DST for the Olympics.  See:
    -# Qld says no to daylight savings for Olympics
    -# http://abc.net.au/news/olympics/1999/06/item19990601114608_1.htm
    -# (1999-06-01), which quotes Queensland Premier Peter Beattie as saying
    -# "Look you've got to remember in my family when this came up last time
    -# I voted for it, my wife voted against it and she said to me it's all very
    -# well for you, you don't have to worry about getting the children out of
    -# bed, getting them to school, getting them to sleep at night.
    -# I've been through all this argument domestically...my wife rules."
    -#
    -# Broken Hill will stick with South Australian time in 2000.  See:
    -# Broken Hill to be behind the times (1999-07-21)
    -# http://abc.net.au/news/regionals/brokenh/monthly/regbrok-21jul1999-6.htm
    -
    -# IATA SSIM (1998-09) says that the spring 2000 change for Australian
    -# Capital Territory, New South Wales except Lord Howe Island and Broken
    -# Hill, and Victoria will be August 27, presumably due to the Sydney Olympics.
    -
    -# From Eric Ulevik, referring to Sydney's Sun Herald (2000-08-13), page 29:
    -# The Queensland Premier Peter Beattie is encouraging northern NSW
    -# towns to use Queensland time.
    -
    -# From Paul Eggert (2007-07-23):
    -# See "southeast Australia" above for 2008 and later.
    -
    -# Yancowinna
    -
    -# From John Mackin (1989-01-04):
    -# 'Broken Hill' means the County of Yancowinna.
    -
    -# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
    -# # YANCOWINNA..  [ Confirmation courtesy of Broken Hill Postmaster ]
    -# #					[ Dec 1990 ]
    -# ...
    -# # Yancowinna uses Central Standard Time, despite [its] location on the
    -# # New South Wales side of the S.A. border. Most business and social dealings
    -# # are with CST zones, therefore CST is legislated by local government
    -# # although the switch to Summer Time occurs in line with N.S.W. There have
    -# # been years when this did not apply, but the historical data is not
    -# # presently available.
    -# Zone	Australia/Yancowinna	9:30	 AY	%sST
    -# ...
    -# Rule	 AY	1971	1985	-	Oct	lastSun	2:00	1:00	D
    -# Rule	 AY	1972	only	-	Feb	lastSun	3:00	0	C
    -# [followed by other Rules]
    -
    -# Lord Howe Island
    -
    -# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
    -# LHI...		[ Courtesy of Pauline Van Winsen ]
    -#					[ Dec 1990 ]
    -# Lord Howe Island is located off the New South Wales coast, and is half an
    -# hour ahead of NSW time.
    -
    -# From James Lonergan, Secretary, Lord Howe Island Board (2000-01-27):
    -# Lord Howe Island summer time in 2000/2001 will commence on the same
    -# date as the rest of NSW (i.e. 2000-08-27).  For your information the
    -# Lord Howe Island Board (controlling authority for the Island) is
    -# seeking the community's views on various options for summer time
    -# arrangements on the Island, e.g. advance clocks by 1 full hour
    -# instead of only 30 minutes.  [Dependent] on the wishes of residents
    -# the Board may approach the NSW government to change the existing
    -# arrangements.  The starting date for summer time on the Island will
    -# however always coincide with the rest of NSW.
    -
    -# From James Lonergan, Secretary, Lord Howe Island Board (2000-10-25):
    -# Lord Howe Island advances clocks by 30 minutes during DST in NSW and retards
    -# clocks by 30 minutes when DST finishes. Since DST was most recently
    -# introduced in NSW, the "changeover" time on the Island has been 02:00 as
    -# shown on clocks on LHI. I guess this means that for 30 minutes at the start
    -# of DST, LHI is actually 1 hour ahead of the rest of NSW.
    -
    -# From Paul Eggert (2006-03-22):
    -# For Lord Howe dates we use Shanks & Pottenger through 1989, and
    -# Lonergan thereafter.  For times we use Lonergan.
    -
    -# From Paul Eggert (2007-07-23):
    -# See "southeast Australia" above for 2008 and later.
    -
    -# From Steffen Thorsen (2009-04-28):
    -# According to the official press release, South Australia's extended daylight
    -# saving period will continue with the same rules as used during the 2008-2009
    -# summer (southern hemisphere).
    -#
    -# From
    -# http://www.safework.sa.gov.au/uploaded_files/DaylightDatesSet.pdf
    -# The extended daylight saving period that South Australia has been trialling
    -# for over the last year is now set to be ongoing.
    -# Daylight saving will continue to start on the first Sunday in October each
    -# year and finish on the first Sunday in April the following year.
    -# Industrial Relations Minister, Paul Caica, says this provides South Australia
    -# with a consistent half hour time difference with NSW, Victoria, Tasmania and
    -# the ACT for all 52 weeks of the year...
    -#
    -# We have a wrap-up here:
    -# http://www.timeanddate.com/news/time/south-australia-extends-dst.html
    -###############################################################################
    -
    -# New Zealand
    -
    -# From Mark Davies (1990-10-03):
    -# the 1989/90 year was a trial of an extended "daylight saving" period.
    -# This trial was deemed successful and the extended period adopted for
    -# subsequent years (with the addition of a further week at the start).
    -# source - phone call to Ministry of Internal Affairs Head Office.
    -
    -# From George Shepherd via Simon Woodhead via Robert Elz (1991-03-06):
    -# # The Country of New Zealand   (Australia's east island -) Gee they hate that!
    -# #				   or is Australia the west island of N.Z.
    -# #	[ courtesy of Geoff Tribble.. Auckland N.Z. ]
    -# #				[ Nov 1990 ]
    -# ...
    -# Rule	NZ      1974    1988	-	Oct	lastSun	2:00	1:00	D
    -# Rule	NZ	1989	max	-	Oct	Sun>=1	2:00	1:00	D
    -# Rule	NZ      1975    1989	-	Mar	Sun>=1	3:00	0	S
    -# Rule	NZ	1990	max	-	Mar	lastSun	3:00	0	S
    -# ...
    -# Zone	NZ			12:00	NZ		NZ%sT	# New Zealand
    -# Zone	NZ-CHAT			12:45	-		NZ-CHAT # Chatham Island
    -
    -# From Arthur David Olson (1992-03-08):
    -# The chosen rules use the Davies October 8 values for the start of DST in 1989
    -# rather than the October 1 value.
    -
    -# From Paul Eggert (1995-12-19);
    -# Shank & Pottenger report 2:00 for all autumn changes in Australia and NZ.
    -# Robert Uzgalis writes that the New Zealand Daylight
    -# Savings Time Order in Council dated 1990-06-18 specifies 2:00 standard
    -# time on both the first Sunday in October and the third Sunday in March.
    -# As with Australia, we'll assume the tradition is 2:00s, not 2:00.
    -#
    -# From Paul Eggert (2006-03-22):
    -# The Department of Internal Affairs (DIA) maintains a brief history,
    -# as does Carol Squires; see tz-link.htm for the full references.
    -# Use these sources in preference to Shanks & Pottenger.
    -#
    -# For Chatham, IATA SSIM (1991/1999) gives the NZ rules but with
    -# transitions at 2:45 local standard time; this confirms that Chatham
    -# is always exactly 45 minutes ahead of Auckland.
    -
    -# From Colin Sharples (2007-04-30):
    -# DST will now start on the last Sunday in September, and end on the
    -# first Sunday in April.  The changes take effect this year, meaning
    -# that DST will begin on 2007-09-30 2008-04-06.
    -# http://www.dia.govt.nz/diawebsite.nsf/wpg_URL/Services-Daylight-Saving-Daylight-saving-to-be-extended
    -
    -# From Paul Eggert (2014-07-14):
    -# Chatham Island time was formally standardized on 1957-01-01 by
    -# New Zealand's Standard Time Amendment Act 1956 (1956-10-26).
    -# http://www.austlii.edu.au/nz/legis/hist_act/staa19561956n100244.pdf
    -# According to Google Books snippet view, a speaker in the New Zealand
    -# parliamentary debates in 1956 said "Clause 78 makes provision for standard
    -# time in the Chatham Islands.  The time there is 45 minutes in advance of New
    -# Zealand time.  I understand that is the time they keep locally, anyhow."
    -# For now, assume this practice goes back to the introduction of standard time
    -# in New Zealand, as this would make Chatham Islands time almost exactly match
    -# LMT back when New Zealand was at UTC+11:30; also, assume Chatham Islands did
    -# not observe New Zealand's prewar DST.
    -
    -###############################################################################
    -
    -
    -# Fiji
    -
    -# Howse writes (p 153) that in 1879 the British governor of Fiji
    -# enacted an ordinance standardizing the islands on Antipodean Time
    -# instead of the American system (which was one day behind).
    -
    -# From Rives McDow (1998-10-08):
    -# Fiji will introduce DST effective 0200 local time, 1998-11-01
    -# until 0300 local time 1999-02-28.  Each year the DST period will
    -# be from the first Sunday in November until the last Sunday in February.
    -
    -# From Paul Eggert (2000-01-08):
    -# IATA SSIM (1999-09) says DST ends 0100 local time.  Go with McDow.
    -
    -# From the BBC World Service in
    -# http://news.bbc.co.uk/2/hi/asia-pacific/205226.stm (1998-10-31 16:03 UTC):
    -# The Fijian government says the main reasons for the time change is to
    -# improve productivity and reduce road accidents.... [T]he move is also
    -# intended to boost Fiji's ability to attract tourists to witness the dawning
    -# of the new millennium.
    -
    -# http://www.fiji.gov.fj/press/2000_09/2000_09_13-05.shtml (2000-09-13)
    -# reports that Fiji has discontinued DST.
    -
    -
    -# Kiribati
    -
    -# From Paul Eggert (1996-01-22):
    -# Today's _Wall Street Journal_ (page 1) reports that Kiribati
    -# "declared it the same day [throughout] the country as of Jan. 1, 1995"
    -# as part of the competition to be first into the 21st century.
    -
    -
    -# Kwajalein
    -
    -# In comp.risks 14.87 (26 August 1993), Peter Neumann writes:
    -# I wonder what happened in Kwajalein, where there was NO Friday,
    -# 1993-08-20.  Thursday night at midnight Kwajalein switched sides with
    -# respect to the International Date Line, to rejoin its fellow islands,
    -# going from 11:59 p.m. Thursday to 12:00 m. Saturday in a blink.
    -
    -
    -# N Mariana Is, Guam
    -
    -# Howse writes (p 153) "The Spaniards, on the other hand, reached the
    -# Philippines and the Ladrones from America," and implies that the Ladrones
    -# (now called the Marianas) kept American date for quite some time.
    -# For now, we assume the Ladrones switched at the same time as the Philippines;
    -# see Asia/Manila.
    -
    -# US Public Law 106-564 (2000-12-23) made UTC+10 the official standard time,
    -# under the name "Chamorro Standard Time".  There is no official abbreviation,
    -# but Congressman Robert A. Underwood, author of the bill that became law,
    -# wrote in a press release (2000-12-27) that he will seek the use of "ChST".
    -
    -
    -# Micronesia
    -
    -# Alan Eugene Davis writes (1996-03-16),
    -# "I am certain, having lived there for the past decade, that 'Truk'
    -# (now properly known as Chuuk) ... is in the time zone GMT+10."
    -#
    -# Shanks & Pottenger write that Truk switched from UTC+10 to UTC+11
    -# on 1978-10-01; ignore this for now.
    -
    -# From Paul Eggert (1999-10-29):
    -# The Federated States of Micronesia Visitors Board writes in
    -# The Federated States of Micronesia - Visitor Information (1999-01-26)
    -# http://www.fsmgov.org/info/clocks.html
    -# that Truk and Yap are UTC+10, and Ponape and Kosrae are UTC+11.
    -# We don't know when Kosrae switched from UTC+12; assume January 1 for now.
    -
    -
    -# Midway
    -
    -# From Charles T O'Connor, KMTH DJ (1956),
    -# quoted in the KTMH section of the Radio Heritage Collection
    -#  (2002-12-31):
    -# For the past two months we've been on what is known as Daylight
    -# Saving Time.  This time has put us on air at 5am in the morning,
    -# your time down there in New Zealand.  Starting September 2, 1956
    -# we'll again go back to Standard Time.  This'll mean that we'll go to
    -# air at 6am your time.
    -#
    -# From Paul Eggert (2003-03-23):
    -# We don't know the date of that quote, but we'll guess they
    -# started DST on June 3.  Possibly DST was observed other years
    -# in Midway, but we have no record of it.
    -
    -
    -# Pitcairn
    -
    -# From Rives McDow (1999-11-08):
    -# A Proclamation was signed by the Governor of Pitcairn on the 27th March 1998
    -# with regard to Pitcairn Standard Time.  The Proclamation is as follows.
    -#
    -#	The local time for general purposes in the Islands shall be
    -#	Co-ordinated Universal time minus 8 hours and shall be known
    -#	as Pitcairn Standard Time.
    -#
    -# ... I have also seen Pitcairn listed as UTC minus 9 hours in several
    -# references, and can only assume that this was an error in interpretation
    -# somehow in light of this proclamation.
    -
    -# From Rives McDow (1999-11-09):
    -# The Proclamation regarding Pitcairn time came into effect on 27 April 1998
    -# ... at midnight.
    -
    -# From Howie Phelps (1999-11-10), who talked to a Pitcairner via shortwave:
    -# Betty Christian told me yesterday that their local time is the same as
    -# Pacific Standard Time. They used to be 1/2 hour different from us here in
    -# Sacramento but it was changed a couple of years ago.
    -
    -
    -# (Western) Samoa and American Samoa
    -
    -# Howse writes (p 153, citing p 10 of the 1883-11-18 New York Herald)
    -# that in 1879 the King of Samoa decided to change
    -# "the date in his kingdom from the Antipodean to the American system,
    -# ordaining - by a masterpiece of diplomatic flattery - that
    -# the Fourth of July should be celebrated twice in that year."
    -
    -# Although Shanks & Pottenger says they both switched to UTC-11:30
    -# in 1911, and to UTC-11 in 1950. many earlier sources give UTC-11
    -# for American Samoa, e.g., the US National Bureau of Standards
    -# circular "Standard Time Throughout the World", 1932.
    -# Assume American Samoa switched to UTC-11 in 1911, not 1950,
    -# and that after 1950 they agreed until (western) Samoa skipped a
    -# day in 2011.  Assume also that the Samoas follow the US and New
    -# Zealand's "ST"/"DT" style of daylight-saving abbreviations.
    -
    -# Tonga
    -
    -# From Paul Eggert (1996-01-22):
    -# Today's _Wall Street Journal_ (p 1) reports that "Tonga has been plotting
    -# to sneak ahead of [New Zealanders] by introducing daylight-saving time."
    -# Since Kiribati has moved the Date Line it's not clear what Tonga will do.
    -
    -# Don Mundell writes in the 1997-02-20 Tonga Chronicle
    -# How Tonga became 'The Land where Time Begins':
    -# http://www.tongatapu.net.to/tonga/homeland/timebegins.htm
    -#
    -# Until 1941 Tonga maintained a standard time 50 minutes ahead of NZST
    -# 12 hours and 20 minutes ahead of GMT.  When New Zealand adjusted its
    -# standard time in 1940s, Tonga had the choice of subtracting from its
    -# local time to come on the same standard time as New Zealand or of
    -# advancing its time to maintain the differential of 13 degrees
    -# (approximately 50 minutes ahead of New Zealand time).
    -#
    -# Because His Majesty King TÄufaÊ»Ähau Tupou IV, then Crown Prince
    -# Tungī, preferred to ensure Tonga's title as the land where time
    -# begins, the Legislative Assembly approved the latter change.
    -#
    -# But some of the older, more conservative members from the outer
    -# islands objected. "If at midnight on Dec. 31, we move ahead 40
    -# minutes, as your Royal Highness wishes, what becomes of the 40
    -# minutes we have lost?"
    -#
    -# The Crown Prince, presented an unanswerable argument: "Remember that
    -# on the World Day of Prayer, you would be the first people on Earth
    -# to say your prayers in the morning."
    -
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger say the transition was on 1968-10-01; go with Mundell.
    -
    -# From Eric Ulevik (1999-05-03):
    -# Tonga's director of tourism, who is also secretary of the National Millennium
    -# Committee, has a plan to get Tonga back in front.
    -# He has proposed a one-off move to tropical daylight saving for Tonga from
    -# October to March, which has won approval in principle from the Tongan
    -# Government.
    -
    -# From Steffen Thorsen (1999-09-09):
    -# * Tonga will introduce DST in November
    -#
    -# I was given this link by John Letts:
    -# http://news.bbc.co.uk/hi/english/world/asia-pacific/newsid_424000/424764.stm
    -#
    -# I have not been able to find exact dates for the transition in November
    -# yet. By reading this article it seems like Fiji will be 14 hours ahead
    -# of UTC as well, but as far as I know Fiji will only be 13 hours ahead
    -# (12 + 1 hour DST).
    -
    -# From Arthur David Olson (1999-09-20):
    -# According to :
    -# "Daylight Savings Time will take effect on Oct. 2 through April 15, 2000
    -# and annually thereafter from the first Saturday in October through the
    -# third Saturday of April.  Under the system approved by Privy Council on
    -# Sept. 10, clocks must be turned ahead one hour on the opening day and
    -# set back an hour on the closing date."
    -# Alas, no indication of the time of day.
    -
    -# From Rives McDow (1999-10-06):
    -# Tonga started its Daylight Saving on Saturday morning October 2nd at 0200am.
    -# Daylight Saving ends on April 16 at 0300am which is Sunday morning.
    -
    -# From Steffen Thorsen (2000-10-31):
    -# Back in March I found a notice on the website http://www.tongaonline.com
    -# that Tonga changed back to standard time one month early, on March 19
    -# instead of the original reported date April 16. Unfortunately, the article
    -# is no longer available on the site, and I did not make a copy of the
    -# text, and I have forgotten to report it here.
    -# (Original URL was )
    -
    -# From Rives McDow (2000-12-01):
    -# Tonga is observing DST as of 2000-11-04 and will stop on 2001-01-27.
    -
    -# From Sione Moala-Mafi (2001-09-20) via Rives McDow:
    -# At 2:00am on the first Sunday of November, the standard time in the Kingdom
    -# shall be moved forward by one hour to 3:00am.  At 2:00am on the last Sunday
    -# of January the standard time in the Kingdom shall be moved backward by one
    -# hour to 1:00am.
    -
    -# From Pulu 'Anau (2002-11-05):
    -# The law was for 3 years, supposedly to get renewed.  It wasn't.
    -
    -
    -# Wake
    -
    -# From Vernice Anderson, Personal Secretary to Philip Jessup,
    -# US Ambassador At Large (oral history interview, 1971-02-02):
    -#
    -# Saturday, the 14th [of October, 1950] - ...  The time was all the
    -# more confusing at that point, because we had crossed the
    -# International Date Line, thus getting two Sundays.  Furthermore, we
    -# discovered that Wake Island had two hours of daylight saving time
    -# making calculation of time in Washington difficult if not almost
    -# impossible.
    -#
    -# http://www.trumanlibrary.org/wake/meeting.htm
    -
    -# From Paul Eggert (2003-03-23):
    -# We have no other report of DST in Wake Island, so omit this info for now.
    -
    -###############################################################################
    -
    -# The International Date Line
    -
    -# From Gwillim Law (2000-01-03):
    -#
    -# The International Date Line is not defined by any international standard,
    -# convention, or treaty.  Mapmakers are free to draw it as they please.
    -# Reputable mapmakers will simply ensure that every point of land appears on
    -# the correct side of the IDL, according to the date legally observed there.
    -#
    -# When Kiribati adopted a uniform date in 1995, thereby moving the Phoenix and
    -# Line Islands to the west side of the IDL (or, if you prefer, moving the IDL
    -# to the east side of the Phoenix and Line Islands), I suppose that most
    -# mapmakers redrew the IDL following the boundary of Kiribati.  Even that line
    -# has a rather arbitrary nature.  The straight-line boundaries between Pacific
    -# island nations that are shown on many maps are based on an international
    -# convention, but are not legally binding national borders.... The date is
    -# governed by the IDL; therefore, even on the high seas, there may be some
    -# places as late as fourteen hours later than UTC.  And, since the IDL is not
    -# an international standard, there are some places on the high seas where the
    -# correct date is ambiguous.
    -
    -# From Wikipedia  (2005-08-31):
    -# Before 1920, all ships kept local apparent time on the high seas by setting
    -# their clocks at night or at the morning sight so that, given the ship's
    -# speed and direction, it would be 12 o'clock when the Sun crossed the ship's
    -# meridian (12 o'clock = local apparent noon).  During 1917, at the
    -# Anglo-French Conference on Time-keeping at Sea, it was recommended that all
    -# ships, both military and civilian, should adopt hourly standard time zones
    -# on the high seas.  Whenever a ship was within the territorial waters of any
    -# nation it would use that nation's standard time.  The captain was permitted
    -# to change his ship's clocks at a time of his choice following his ship's
    -# entry into another zone time - he often chose midnight.  These zones were
    -# adopted by all major fleets between 1920 and 1925 but not by many
    -# independent merchant ships until World War II.
    -
    -# From Paul Eggert, using references suggested by Oscar van Vlijmen
    -# (2005-03-20):
    -#
    -# The American Practical Navigator (2002)
    -# http://pollux.nss.nima.mil/pubs/pubs_j_apn_sections.html?rid=187
    -# talks only about the 180-degree meridian with respect to ships in
    -# international waters; it ignores the international date line.
    diff --git a/external/public-domain/tz/dist/backward b/external/public-domain/tz/dist/backward
    deleted file mode 100644
    index 8b0fef582..000000000
    --- a/external/public-domain/tz/dist/backward
    +++ /dev/null
    @@ -1,123 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# This file provides links between current names for time zones
    -# and their old names.  Many names changed in late 1993.
    -
    -# Link	TARGET			LINK-NAME
    -Link	Africa/Nairobi		Africa/Asmera
    -Link	Africa/Abidjan		Africa/Timbuktu
    -Link	America/Argentina/Catamarca	America/Argentina/ComodRivadavia
    -Link	America/Adak		America/Atka
    -Link	America/Argentina/Buenos_Aires	America/Buenos_Aires
    -Link	America/Argentina/Catamarca	America/Catamarca
    -Link	America/Atikokan	America/Coral_Harbour
    -Link	America/Argentina/Cordoba	America/Cordoba
    -Link	America/Tijuana		America/Ensenada
    -Link	America/Indiana/Indianapolis	America/Fort_Wayne
    -Link	America/Indiana/Indianapolis	America/Indianapolis
    -Link	America/Argentina/Jujuy	America/Jujuy
    -Link	America/Indiana/Knox	America/Knox_IN
    -Link	America/Kentucky/Louisville	America/Louisville
    -Link	America/Argentina/Mendoza	America/Mendoza
    -Link	America/Toronto		America/Montreal
    -Link	America/Rio_Branco	America/Porto_Acre
    -Link	America/Argentina/Cordoba	America/Rosario
    -Link	America/Denver		America/Shiprock
    -Link	America/Port_of_Spain	America/Virgin
    -Link	Pacific/Auckland	Antarctica/South_Pole
    -Link	Asia/Ashgabat		Asia/Ashkhabad
    -Link	Asia/Kolkata		Asia/Calcutta
    -Link	Asia/Shanghai		Asia/Chongqing
    -Link	Asia/Shanghai		Asia/Chungking
    -Link	Asia/Dhaka		Asia/Dacca
    -Link	Asia/Shanghai		Asia/Harbin
    -Link	Asia/Urumqi		Asia/Kashgar
    -Link	Asia/Kathmandu		Asia/Katmandu
    -Link	Asia/Macau		Asia/Macao
    -Link	Asia/Ho_Chi_Minh	Asia/Saigon
    -Link	Asia/Jerusalem		Asia/Tel_Aviv
    -Link	Asia/Thimphu		Asia/Thimbu
    -Link	Asia/Makassar		Asia/Ujung_Pandang
    -Link	Asia/Ulaanbaatar	Asia/Ulan_Bator
    -Link	Atlantic/Faroe		Atlantic/Faeroe
    -Link	Europe/Oslo		Atlantic/Jan_Mayen
    -Link	Australia/Sydney	Australia/ACT
    -Link	Australia/Sydney	Australia/Canberra
    -Link	Australia/Lord_Howe	Australia/LHI
    -Link	Australia/Sydney	Australia/NSW
    -Link	Australia/Darwin	Australia/North
    -Link	Australia/Brisbane	Australia/Queensland
    -Link	Australia/Adelaide	Australia/South
    -Link	Australia/Hobart	Australia/Tasmania
    -Link	Australia/Melbourne	Australia/Victoria
    -Link	Australia/Perth		Australia/West
    -Link	Australia/Broken_Hill	Australia/Yancowinna
    -Link	America/Rio_Branco	Brazil/Acre
    -Link	America/Noronha		Brazil/DeNoronha
    -Link	America/Sao_Paulo	Brazil/East
    -Link	America/Manaus		Brazil/West
    -Link	America/Halifax		Canada/Atlantic
    -Link	America/Winnipeg	Canada/Central
    -Link	America/Regina		Canada/East-Saskatchewan
    -Link	America/Toronto		Canada/Eastern
    -Link	America/Edmonton	Canada/Mountain
    -Link	America/St_Johns	Canada/Newfoundland
    -Link	America/Vancouver	Canada/Pacific
    -Link	America/Regina		Canada/Saskatchewan
    -Link	America/Whitehorse	Canada/Yukon
    -Link	America/Santiago	Chile/Continental
    -Link	Pacific/Easter		Chile/EasterIsland
    -Link	America/Havana		Cuba
    -Link	Africa/Cairo		Egypt
    -Link	Europe/Dublin		Eire
    -Link	Europe/London		Europe/Belfast
    -Link	Europe/Chisinau		Europe/Tiraspol
    -Link	Europe/London		GB
    -Link	Europe/London		GB-Eire
    -Link	Etc/GMT			GMT+0
    -Link	Etc/GMT			GMT-0
    -Link	Etc/GMT			GMT0
    -Link	Etc/GMT			Greenwich
    -Link	Asia/Hong_Kong		Hongkong
    -Link	Atlantic/Reykjavik	Iceland
    -Link	Asia/Tehran		Iran
    -Link	Asia/Jerusalem		Israel
    -Link	America/Jamaica		Jamaica
    -Link	Asia/Tokyo		Japan
    -Link	Pacific/Kwajalein	Kwajalein
    -Link	Africa/Tripoli		Libya
    -Link	America/Tijuana		Mexico/BajaNorte
    -Link	America/Mazatlan	Mexico/BajaSur
    -Link	America/Mexico_City	Mexico/General
    -Link	Pacific/Auckland	NZ
    -Link	Pacific/Chatham		NZ-CHAT
    -Link	America/Denver		Navajo
    -Link	Asia/Shanghai		PRC
    -Link	Pacific/Pohnpei		Pacific/Ponape
    -Link	Pacific/Pago_Pago	Pacific/Samoa
    -Link	Pacific/Chuuk		Pacific/Truk
    -Link	Pacific/Chuuk		Pacific/Yap
    -Link	Europe/Warsaw		Poland
    -Link	Europe/Lisbon		Portugal
    -Link	Asia/Taipei		ROC
    -Link	Asia/Seoul		ROK
    -Link	Asia/Singapore		Singapore
    -Link	Europe/Istanbul		Turkey
    -Link	Etc/UCT			UCT
    -Link	America/Anchorage	US/Alaska
    -Link	America/Adak		US/Aleutian
    -Link	America/Phoenix		US/Arizona
    -Link	America/Chicago		US/Central
    -Link	America/Indiana/Indianapolis	US/East-Indiana
    -Link	America/New_York	US/Eastern
    -Link	Pacific/Honolulu	US/Hawaii
    -Link	America/Indiana/Knox	US/Indiana-Starke
    -Link	America/Detroit		US/Michigan
    -Link	America/Denver		US/Mountain
    -Link	America/Los_Angeles	US/Pacific
    -Link	Pacific/Pago_Pago	US/Samoa
    -Link	Etc/UTC			UTC
    -Link	Etc/UTC			Universal
    -Link	Europe/Moscow		W-SU
    -Link	Etc/UTC			Zulu
    diff --git a/external/public-domain/tz/dist/backzone b/external/public-domain/tz/dist/backzone
    deleted file mode 100644
    index 0316708fb..000000000
    --- a/external/public-domain/tz/dist/backzone
    +++ /dev/null
    @@ -1,672 +0,0 @@
    -# Zones that go back beyond the scope of the tz database
    -
    -# This file is in the public domain.
    -
    -# This file is by no means authoritative; if you think you know
    -# better, go ahead and edit it (and please send any changes to
    -# tz@iana.org for general use in the future).  For more, please see
    -# the file CONTRIBUTING in the tz distribution.
    -
    -
    -# From Paul Eggert (2014-10-31):
    -
    -# This file contains data outside the normal scope of the tz database,
    -# in that its zones do not differ from normal tz zones after 1970.
    -# Links in this file point to zones in this file, superseding links in
    -# the file 'backward'.
    -
    -# Although zones in this file may be of some use for analyzing
    -# pre-1970 time stamps, they are less reliable, cover only a tiny
    -# sliver of the pre-1970 era, and cannot feasibly be improved to cover
    -# most of the era.  Because the zones are out of normal scope for the
    -# database, less effort is put into maintaining this file.  Many of
    -# the zones were formerly in other source files, but were removed or
    -# replaced by links as their data entries were questionable and/or they
    -# differed from other zones only in pre-1970 time stamps.
    -
    -# Unless otherwise specified, the source for data through 1990 is:
    -# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
    -# San Diego: ACS Publications, Inc. (2003).
    -# Unfortunately this book contains many errors and cites no sources.
    -
    -# This file is not intended to be compiled standalone, as it
    -# assumes rules from other files.  In the tz distribution, use
    -# 'make posix_packrat' to compile this file.
    -
    -# Zones are sorted by zone name.  Each zone is preceded by the
    -# name of the country that the zone is in, along with any other
    -# commentary and rules associated with the entry.
    -#
    -# As explained in the zic man page, the zone columns are:
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -
    -# Ethiopia
    -# From Paul Eggert (2014-07-31):
    -# Like the Swahili of Kenya and Tanzania, many Ethiopians keep a
    -# 12-hour clock starting at our 06:00, so their "8 o'clock" is our
    -# 02:00 or 14:00.  Keep this in mind when you ask the time in Amharic.
    -#
    -# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time
    -# zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in
    -# 1890, and that they switched to 3:00 on 1936-05-05.  Perhaps 38E50
    -# was for Adis Dera.  Quite likely the Shanks data entries are wrong
    -# anyway.
    -Zone Africa/Addis_Ababa	2:34:48 -	LMT	1870
    -			2:35:20	-	ADMT	1936 May  5 # Adis Dera MT
    -			3:00	-	EAT
    -
    -# Eritrea
    -Zone	Africa/Asmara	2:35:32 -	LMT	1870
    -			2:35:32	-	AMT	1890        # Asmara Mean Time
    -			2:35:20	-	ADMT	1936 May  5 # Adis Dera MT
    -			3:00	-	EAT
    -Link Africa/Asmara Africa/Asmera
    -
    -# Mali (southern)
    -Zone	Africa/Bamako	-0:32:00 -	LMT	1912
    -			 0:00	-	GMT	1934 Feb 26
    -			-1:00	-	WAT	1960 Jun 20
    -			 0:00	-	GMT
    -
    -# Central African Republic
    -Zone	Africa/Bangui	1:14:20	-	LMT	1912
    -			1:00	-	WAT
    -
    -# Gambia
    -Zone	Africa/Banjul	-1:06:36 -	LMT	1912
    -			-1:06:36 -	BMT	1935 # Banjul Mean Time
    -			-1:00	-	WAT	1964
    -			 0:00	-	GMT
    -
    -# Malawi
    -Zone	Africa/Blantyre	2:20:00 -	LMT	1903 Mar
    -			2:00	-	CAT
    -
    -# Republic of the Congo
    -Zone Africa/Brazzaville	1:01:08 -	LMT	1912
    -			1:00	-	WAT
    -
    -# Burundi
    -Zone Africa/Bujumbura	1:57:28	-	LMT	1890
    -			2:00	-	CAT
    -
    -# Guinea
    -Zone	Africa/Conakry	-0:54:52 -	LMT	1912
    -			 0:00	-	GMT	1934 Feb 26
    -			-1:00	-	WAT	1960
    -			 0:00	-	GMT
    -
    -# Senegal
    -Zone	Africa/Dakar	-1:09:44 -	LMT	1912
    -			-1:00	-	WAT	1941 Jun
    -			 0:00	-	GMT
    -
    -# Tanzania
    -Zone Africa/Dar_es_Salaam 2:37:08 -	LMT	1931
    -			3:00	-	EAT	1948
    -			2:45	-	BEAUT	1961
    -			3:00	-	EAT
    -
    -# Djibouti
    -Zone	Africa/Djibouti	2:52:36 -	LMT	1911 Jul
    -			3:00	-	EAT
    -
    -# Cameroon
    -# Whitman says they switched to 1:00 in 1920; go with Shanks & Pottenger.
    -Zone	Africa/Douala	0:38:48	-	LMT	1912
    -			1:00	-	WAT
    -# Sierra Leone
    -# From Paul Eggert (2014-08-12):
    -# The following table is from Shanks & Pottenger, but it can't be right.
    -# Whitman gives Mar 31 - Aug 31 for 1931 on.
    -# The International Hydrographic Bulletin, 1932-33, p 63 says that
    -# Sierra Leone would advance its clocks by 20 minutes on 1933-10-01.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	SL	1935	1942	-	Jun	 1	0:00	0:40	SLST
    -Rule	SL	1935	1942	-	Oct	 1	0:00	0	WAT
    -Rule	SL	1957	1962	-	Jun	 1	0:00	1:00	SLST
    -Rule	SL	1957	1962	-	Sep	 1	0:00	0	GMT
    -Zone	Africa/Freetown	-0:53:00 -	LMT	1882
    -			-0:53:00 -	FMT	1913 Jun # Freetown Mean Time
    -			-1:00	SL	%s	1957
    -			 0:00	SL	%s
    -
    -# Botswana
    -# From Paul Eggert (2013-02-21):
    -# Milne says they were regulated by the Cape Town Signal in 1899;
    -# assume they switched to 2:00 when Cape Town did.
    -Zone	Africa/Gaborone	1:43:40 -	LMT	1885
    -			1:30	-	SAST	1903 Mar
    -			2:00	-	CAT	1943 Sep 19  2:00
    -			2:00	1:00	CAST	1944 Mar 19  2:00
    -			2:00	-	CAT
    -
    -# Zimbabwe
    -Zone	Africa/Harare	2:04:12 -	LMT	1903 Mar
    -			2:00	-	CAT
    -
    -# South Sudan
    -Zone	Africa/Juba	2:06:24 -	LMT	1931
    -			2:00	Sudan	CA%sT	2000 Jan 15 12:00
    -			3:00	-	EAT
    -
    -# Uganda
    -Zone	Africa/Kampala	2:09:40 -	LMT	1928 Jul
    -			3:00	-	EAT	1930
    -			2:30	-	BEAT	1948
    -			2:45	-	BEAUT	1957
    -			3:00	-	EAT
    -
    -# Rwanda
    -Zone	Africa/Kigali	2:00:16 -	LMT	1935 Jun
    -			2:00	-	CAT
    -
    -# Democratic Republic of the Congo (west)
    -Zone Africa/Kinshasa	1:01:12 -	LMT	1897 Nov  9
    -			1:00	-	WAT
    -
    -# Gabon
    -Zone Africa/Libreville	0:37:48 -	LMT	1912
    -			1:00	-	WAT
    -
    -# Togo
    -Zone	Africa/Lome	0:04:52 -	LMT	1893
    -			0:00	-	GMT
    -
    -# Angola
    -#
    -# Shanks gives 1911-05-26 for the transition to WAT,
    -# evidently confusing the date of the Portuguese decree
    -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
    -# with the date that it took effect, namely 1912-01-01.
    -#
    -Zone	Africa/Luanda	0:52:56	-	LMT	1892
    -			0:52:04	-	AOT	1912 Jan  1 # Angola Time
    -			1:00	-	WAT
    -
    -# Democratic Republic of the Congo (east)
    -Zone Africa/Lubumbashi	1:49:52 -	LMT	1897 Nov 9
    -			2:00	-	CAT
    -
    -# Zambia
    -Zone	Africa/Lusaka	1:53:08 -	LMT	1903 Mar
    -			2:00	-	CAT
    -
    -# Equatorial Guinea
    -#
    -# Although Shanks says that Malabo switched from UTC to UTC+1 on 1963-12-15,
    -# a Google Books search says that London Calling, Issues 432-465 (1948), p 19,
    -# says that Spanish Guinea was at GMT+1 back then.  The Shanks data entries
    -# are most likely wrong, but we have nothing better; use them here for now.
    -#
    -Zone	Africa/Malabo	0:35:08 -	LMT	1912
    -			0:00	-	GMT	1963 Dec 15
    -			1:00	-	WAT
    -
    -# Lesotho
    -Zone	Africa/Maseru	1:50:00 -	LMT	1903 Mar
    -			2:00	-	SAST	1943 Sep 19  2:00
    -			2:00	1:00	SAST	1944 Mar 19  2:00
    -			2:00	-	SAST
    -
    -# Swaziland
    -Zone	Africa/Mbabane	2:04:24 -	LMT	1903 Mar
    -			2:00	-	SAST
    -
    -# Somalia
    -Zone Africa/Mogadishu	3:01:28 -	LMT	1893 Nov
    -			3:00	-	EAT	1931
    -			2:30	-	BEAT	1957
    -			3:00	-	EAT
    -
    -# Niger
    -Zone	Africa/Niamey	 0:08:28 -	LMT	1912
    -			-1:00	-	WAT	1934 Feb 26
    -			 0:00	-	GMT	1960
    -			 1:00	-	WAT
    -
    -# Mauritania
    -Zone Africa/Nouakchott	-1:03:48 -	LMT	1912
    -			 0:00	-	GMT	1934 Feb 26
    -			-1:00	-	WAT	1960 Nov 28
    -			 0:00	-	GMT
    -
    -# Burkina Faso
    -Zone Africa/Ouagadougou	-0:06:04 -	LMT	1912
    -			 0:00	-	GMT
    -
    -# Benin
    -# Whitman says they switched to 1:00 in 1946, not 1934;
    -# go with Shanks & Pottenger.
    -Zone Africa/Porto-Novo	0:10:28	-	LMT	1912 Jan  1
    -			0:00	-	GMT	1934 Feb 26
    -			1:00	-	WAT
    -
    -# São Tomé and Príncipe
    -Zone	Africa/Sao_Tome	 0:26:56 -	LMT	1884
    -			-0:36:32 -	LMT	1912 # Lisbon Mean Time
    -			 0:00	-	GMT
    -
    -# Mali (northern)
    -Zone	Africa/Timbuktu	-0:12:04 -	LMT	1912
    -			 0:00	-	GMT
    -
    -# Anguilla
    -Zone America/Anguilla	-4:12:16 -	LMT	1912 Mar  2
    -			-4:00	-	AST
    -
    -# Antigua and Barbuda
    -Zone	America/Antigua	-4:07:12 -	LMT	1912 Mar 2
    -			-5:00	-	EST	1951
    -			-4:00	-	AST
    -
    -# Chubut, Argentina
    -# The name "Comodoro Rivadavia" exceeds the 14-byte POSIX limit.
    -Zone America/Argentina/ComodRivadavia -4:30:00 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1991 Mar  3
    -			-4:00	-	WART	1991 Oct 20
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	-	ART	2004 Jun  1
    -			-4:00	-	WART	2004 Jun 20
    -			-3:00	-	ART
    -
    -# Aruba
    -Zone	America/Aruba	-4:40:24 -	LMT	1912 Feb 12 # Oranjestad
    -			-4:30	-	ANT	1965 # Netherlands Antilles Time
    -			-4:00	-	AST
    -
    -# Canada
    -Zone America/Coral_Harbour -5:32:40 -	LMT	1884
    -			-5:00	NT_YK	E%sT	1946
    -			-5:00	-	EST
    -
    -# Dominica
    -Zone America/Dominica	-4:05:36 -	LMT	1911 Jul  1  0:01 # Roseau
    -			-4:00	-	AST
    -
    -# Baja California
    -# See 'northamerica' for why this entry is here rather than there.
    -Zone America/Ensenada	-7:46:28 -	LMT	1922 Jan  1  0:13:32
    -			-8:00	-	PST	1927 Jun 10 23:00
    -			-7:00	-	MST	1930 Nov 16
    -			-8:00	-	PST	1942 Apr
    -			-7:00	-	MST	1949 Jan 14
    -			-8:00	-	PST	1996
    -			-8:00	Mexico	P%sT
    -
    -# Grenada
    -Zone	America/Grenada	-4:07:00 -	LMT	1911 Jul # St George's
    -			-4:00	-	AST
    -
    -# Guadeloupe
    -Zone America/Guadeloupe	-4:06:08 -	LMT	1911 Jun  8 # Pointe-à-Pitre
    -			-4:00	 -	AST
    -
    -# Canada
    -#
    -# From Paul Eggert (2015-03-24):
    -# Since 1970 most of Quebec has been like Toronto; see
    -# America/Toronto.  However, earlier versions of the tz database
    -# mistakenly relied on data from Shanks & Pottenger saying that Quebec
    -# differed from Ontario after 1970, and the following rules and zone
    -# were created for most of Quebec from the incorrect Shanks &
    -# Pottenger data.  The post-1970 entries have been corrected, but the
    -# pre-1970 entries are unchecked and probably have errors.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Mont	1917	only	-	Mar	25	2:00	1:00	D
    -Rule	Mont	1917	only	-	Apr	24	0:00	0	S
    -Rule	Mont	1919	only	-	Mar	31	2:30	1:00	D
    -Rule	Mont	1919	only	-	Oct	25	2:30	0	S
    -Rule	Mont	1920	only	-	May	 2	2:30	1:00	D
    -Rule	Mont	1920	1922	-	Oct	Sun>=1	2:30	0	S
    -Rule	Mont	1921	only	-	May	 1	2:00	1:00	D
    -Rule	Mont	1922	only	-	Apr	30	2:00	1:00	D
    -Rule	Mont	1924	only	-	May	17	2:00	1:00	D
    -Rule	Mont	1924	1926	-	Sep	lastSun	2:30	0	S
    -Rule	Mont	1925	1926	-	May	Sun>=1	2:00	1:00	D
    -Rule	Mont	1927	1937	-	Apr	lastSat	24:00	1:00	D
    -Rule	Mont	1927	1937	-	Sep	lastSat	24:00	0	S
    -Rule	Mont	1938	1940	-	Apr	lastSun	0:00	1:00	D
    -Rule	Mont	1938	1939	-	Sep	lastSun	0:00	0	S
    -Rule	Mont	1946	1973	-	Apr	lastSun	2:00	1:00	D
    -Rule	Mont	1945	1948	-	Sep	lastSun	2:00	0	S
    -Rule	Mont	1949	1950	-	Oct	lastSun	2:00	0	S
    -Rule	Mont	1951	1956	-	Sep	lastSun	2:00	0	S
    -Rule	Mont	1957	1973	-	Oct	lastSun	2:00	0	S
    -Zone America/Montreal	-4:54:16 -	LMT	1884
    -			-5:00	Mont	E%sT	1918
    -			-5:00	Canada	E%sT	1919
    -			-5:00	Mont	E%sT	1942 Feb  9  2:00s
    -			-5:00	Canada	E%sT	1946
    -			-5:00	Mont	E%sT	1974
    -			-5:00	Canada	E%sT
    -
    -# Montserrat
    -# From Paul Eggert (2006-03-22):
    -# In 1995 volcanic eruptions forced evacuation of Plymouth, the capital.
    -# world.gazetteer.com says Cork Hill is the most populous location now.
    -Zone America/Montserrat	-4:08:52 -	LMT	1911 Jul  1  0:01 # Cork Hill
    -			-4:00	-	AST
    -
    -# Argentina
    -# This entry was intended for the following areas, but has been superseded by
    -# more detailed zones.
    -# Santa Fe (SF), Entre Ríos (ER), Corrientes (CN), Misiones (MN), Chaco (CC),
    -# Formosa (FM), La Pampa (LP), Chubut (CH)
    -Zone America/Rosario	-4:02:40 -	LMT	1894 Nov
    -			-4:16:44 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1991 Jul
    -			-3:00	-	ART	1999 Oct  3  0:00
    -			-4:00	Arg	AR%sT	2000 Mar  3  0:00
    -			-3:00	-	ART
    -
    -# St Kitts-Nevis
    -Zone America/St_Kitts	-4:10:52 -	LMT	1912 Mar  2 # Basseterre
    -			-4:00	-	AST
    -
    -# St Lucia
    -Zone America/St_Lucia	-4:04:00 -	LMT	1890 # Castries
    -			-4:04:00 -	CMT	1912 # Castries Mean Time
    -			-4:00	-	AST
    -
    -# Virgin Is
    -Zone America/St_Thomas	-4:19:44 -	LMT	1911 Jul # Charlotte Amalie
    -			-4:00	-	AST
    -
    -# St Vincent and the Grenadines
    -Zone America/St_Vincent	-4:04:56 -	LMT	1890 # Kingstown
    -			-4:04:56 -	KMT	1912 # Kingstown Mean Time
    -			-4:00	-	AST
    -
    -# British Virgin Is
    -Zone America/Tortola	-4:18:28 -	LMT	1911 Jul # Road Town
    -			-4:00	-	AST
    -
    -# McMurdo, Ross Island, since 1955-12
    -Zone Antarctica/McMurdo	0	-	zzz	1956
    -			12:00	NZ	NZ%sT
    -Link Antarctica/McMurdo Antarctica/South_Pole
    -
    -# Yemen
    -# Milne says 2:59:54 was the meridian of the saluting battery at Aden,
    -# and that Yemen was at 1:55:56, the meridian of the Hagia Sophia.
    -Zone	Asia/Aden	2:59:54	-	LMT	1950
    -			3:00	-	AST
    -
    -# Bahrain
    -Zone	Asia/Bahrain	3:22:20 -	LMT	1920     # Manamah
    -			4:00	-	GST	1972 Jun
    -			3:00	-	AST
    -
    -# India
    -#
    -# From Paul Eggert (2014-09-06):
    -# The 1876 Report of the Secretary of the [US] Navy, p 305 says that Madras
    -# civil time was 5:20:57.3.
    -#
    -# From Paul Eggert (2014-08-21):
    -# In tomorrow's The Hindu, Nitya Menon reports that India had two civil time
    -# zones starting in 1884, one in Bombay and one in Calcutta, and that railways
    -# used a third time zone based on Madras time (80 deg. 18'30" E).  Also,
    -# in 1881 Bombay briefly switched to Madras time, but switched back.  See:
    -# http://www.thehindu.com/news/cities/chennai/madras-375-when-madras-clocked-the-time/article6339393.ece
    -#Zone	  Asia/Chennai  [not enough info to complete]
    -
    -# China
    -# Long-shu Time (probably due to Long and Shu being two names of that area)
    -# Guangxi, Guizhou, Hainan, Ningxia, Sichuan, Shaanxi, and Yunnan;
    -# most of Gansu; west Inner Mongolia; west Qinghai; and the Guangdong
    -# counties Deqing, Enping, Kaiping, Luoding, Taishan, Xinxing,
    -# Yangchun, Yangjiang, Yu'nan, and Yunfu.
    -Zone	Asia/Chongqing	7:06:20	-	LMT	1928     # or Chungking
    -			7:00	-	LONT	1980 May # Long-shu Time
    -			8:00	PRC	C%sT
    -Link Asia/Chongqing Asia/Chungking
    -
    -# Vietnam
    -# From Paul Eggert (2014-10-13):
    -# See Asia/Ho_Chi_Minh for the source for this data.
    -# Trần's book says the 1954-55 transition to 07:00 in Hanoi was in
    -# October 1954, with exact date and time unspecified.
    -Zone	Asia/Hanoi	7:03:24 -	LMT	1906 Jul  1
    -			7:06:30	-	PLMT	1911 May  1
    -			7:00	-	ICT	1942 Dec 31 23:00
    -			8:00	-	IDT	1945 Mar 14 23:00
    -			9:00	-	JST	1945 Sep  2
    -			7:00	-	ICT	1947 Apr  1
    -			8:00	-	IDT	1954 Oct
    -			7:00	-	ICT
    -
    -# China
    -# Changbai Time ("Long-white Time", Long-white = Heilongjiang area)
    -# Heilongjiang (except Mohe county), Jilin
    -Zone	Asia/Harbin	8:26:44	-	LMT	1928     # or Haerbin
    -			8:30	-	CHAT	1932 Mar # Changbai Time
    -			8:00	-	CST	1940
    -			9:00	-	CHAT	1966 May
    -			8:30	-	CHAT	1980 May
    -			8:00	PRC	C%sT
    -
    -# far west China
    -Zone	Asia/Kashgar	5:03:56	-	LMT	1928     # or Kashi or Kaxgar
    -			5:30	-	KAST	1940     # Kashgar Time
    -			5:00	-	KAST	1980 May
    -			8:00	PRC	C%sT
    -
    -# Kuwait
    -Zone	Asia/Kuwait	3:11:56 -	LMT	1950
    -			3:00	-	AST
    -
    -
    -# Oman
    -# Milne says 3:54:24 was the meridian of the Muscat Tidal Observatory.
    -Zone	Asia/Muscat	3:54:24 -	LMT	1920
    -			4:00	-	GST
    -
    -# India
    -# From Paul Eggert (2014-08-11), after a heads-up from Stephen Colebourne:
    -# According to a Portuguese decree (1911-05-26)
    -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
    -# Portuguese India switched to GMT+5 on 1912-01-01.
    -#Zone	Asia/Panaji	[not enough info to complete]
    -
    -# Cambodia
    -# From Paul Eggert (2014-10-11):
    -# See Asia/Ho_Chi_Minh for the source for most of this data.  Also, guess
    -# (1) Cambodia reverted to UT+7 on 1945-09-02, when Vietnam did, and
    -# (2) they also reverted to UT+7 on 1953-11-09, the date of independence.
    -# These guesses are probably wrong but they're better than guessing no
    -# transitions there.
    -Zone	Asia/Phnom_Penh	6:59:40 -	LMT	1906 Jul  1
    -			7:06:30	-	PLMT	1911 May  1
    -			7:00	-	ICT	1942 Dec 31 23:00
    -			8:00	-	IDT	1945 Mar 14 23:00
    -			9:00	-	JST	1945 Sep  2
    -			7:00	-	ICT	1947 Apr  1
    -			8:00	-	IDT	1953 Nov  9
    -			7:00	-	ICT
    -
    -# Israel
    -Zone	Asia/Tel_Aviv	2:19:04 -	LMT	1880
    -			2:21	-	JMT	1918
    -			2:00	Zion	I%sT
    -
    -# Laos
    -# From Paul Eggert (2014-10-11):
    -# See Asia/Ho_Chi_Minh for the source for most of this data.
    -# Trần's book says that Laos reverted to UT+7 on 1955-04-15.
    -# Also, guess that Laos reverted to UT+7 on 1945-09-02, when Vietnam did;
    -# this is probably wrong but it's better than guessing no transition.
    -Zone	Asia/Vientiane	6:50:24 -	LMT	1906 Jul  1
    -			7:06:30	-	PLMT	1911 May  1
    -			7:00	-	ICT	1942 Dec 31 23:00
    -			8:00	-	IDT	1945 Mar 14 23:00
    -			9:00	-	JST	1945 Sep  2
    -			7:00	-	ICT	1947 Apr  1
    -			8:00	-	IDT	1955 Apr 15
    -			7:00	-	ICT
    -
    -# Jan Mayen
    -# From Whitman:
    -Zone Atlantic/Jan_Mayen	-1:00	-	EGT
    -
    -# St Helena
    -Zone Atlantic/St_Helena	-0:22:48 -	LMT	1890 # Jamestown
    -			-0:22:48 -	JMT	1951 # Jamestown Mean Time
    -			 0:00	-	GMT
    -
    -# Northern Ireland
    -Zone	Europe/Belfast	-0:23:40 -	LMT	1880 Aug  2
    -			-0:25:21 -	DMT	1916 May 21  2:00
    -						# DMT = Dublin/Dunsink MT
    -			-0:25:21 1:00	IST	1916 Oct  1  2:00s
    -						# IST = Irish Summer Time
    -			 0:00	GB-Eire	%s	1968 Oct 27
    -			 1:00	-	BST	1971 Oct 31  2:00u
    -			 0:00	GB-Eire	%s	1996
    -			 0:00	EU	GMT/BST
    -
    -# Guernsey
    -# Data from Joseph S. Myers
    -# http://mm.icann.org/pipermail/tz/2013-September/019883.html
    -# References to be added
    -# LMT Location - 49.27N -2.33E - St.Peter Port
    -Zone	Europe/Guernsey	-0:09:19 -	LMT	1913 Jun 18
    -			 0:00	GB-Eire	%s	1940 Jul  2
    -			 1:00	C-Eur	CE%sT	1945 May  8
    -			 0:00	GB-Eire	%s	1968 Oct 27
    -			 1:00	-	BST	1971 Oct 31  2:00u
    -			 0:00	GB-Eire	%s	1996
    -			 0:00	EU	GMT/BST
    -
    -# Isle of Man
    -#
    -# From Lester Caine (2013-09-04):
    -# The Isle of Man legislation is now on-line at
    -# , starting with the original Statutory
    -# Time Act in 1883 and including additional confirmation of some of
    -# the dates of the 'Summer Time' orders originating at
    -# Westminster.  There is a little uncertainty as to the starting date
    -# of the first summer time in 1916 which may have be announced a
    -# couple of days late.  There is still a substantial number of
    -# documents to work through, but it is thought that every GB change
    -# was also implemented on the island.
    -#
    -# AT4 of 1883 - The Statutory Time et cetera Act 1883 -
    -# LMT Location - 54.1508N -4.4814E - Tynwald Hill ( Manx parliament )
    -Zone Europe/Isle_of_Man	-0:17:55 -	LMT	1883 Mar 30  0:00s
    -			 0:00	GB-Eire	%s	1968 Oct 27
    -			 1:00	-	BST	1971 Oct 31  2:00u
    -			 0:00	GB-Eire	%s	1996
    -			 0:00	EU	GMT/BST
    -
    -# Jersey
    -# Data from Joseph S. Myers
    -# http://mm.icann.org/pipermail/tz/2013-September/019883.html
    -# References to be added
    -# LMT Location - 49.187N -2.107E - St. Helier
    -Zone	Europe/Jersey	-0:08:25 -	LMT	1898 Jun 11 16:00u
    -			 0:00	GB-Eire	%s	1940 Jul  2
    -			 1:00	C-Eur	CE%sT	1945 May  8
    -			 0:00	GB-Eire	%s	1968 Oct 27
    -			 1:00	-	BST	1971 Oct 31  2:00u
    -			 0:00	GB-Eire	%s	1996
    -			 0:00	EU	GMT/BST
    -
    -# Slovenia
    -Zone Europe/Ljubljana	0:58:04	-	LMT	1884
    -			1:00	-	CET	1941 Apr 18 23:00
    -			1:00	C-Eur	CE%sT	1945 May  8  2:00s
    -			1:00	1:00	CEST	1945 Sep 16  2:00s
    -			1:00	-	CET	1982 Nov 27
    -			1:00	EU	CE%sT
    -
    -# Bosnia and Herzegovina
    -Zone	Europe/Sarajevo	1:13:40	-	LMT	1884
    -			1:00	-	CET	1941 Apr 18 23:00
    -			1:00	C-Eur	CE%sT	1945 May  8  2:00s
    -			1:00	1:00	CEST	1945 Sep 16  2:00s
    -			1:00	-	CET	1982 Nov 27
    -			1:00	EU	CE%sT
    -
    -# Macedonia
    -Zone	Europe/Skopje	1:25:44	-	LMT	1884
    -			1:00	-	CET	1941 Apr 18 23:00
    -			1:00	C-Eur	CE%sT	1945 May  8  2:00s
    -			1:00	1:00	CEST	1945 Sep 16  2:00s
    -			1:00	-	CET	1982 Nov 27
    -			1:00	EU	CE%sT
    -
    -# Moldova / Transnistria
    -Zone	Europe/Tiraspol	1:58:32	-	LMT	1880
    -			1:55	-	CMT	1918 Feb 15 # Chisinau MT
    -			1:44:24	-	BMT	1931 Jul 24 # Bucharest MT
    -			2:00	Romania	EE%sT	1940 Aug 15
    -			2:00	1:00	EEST	1941 Jul 17
    -			1:00	C-Eur	CE%sT	1944 Aug 24
    -			3:00	Russia	MSK/MSD	1991 Mar 31  2:00
    -			2:00	Russia	EE%sT	1992 Jan 19  2:00
    -			3:00	Russia	MSK/MSD
    -
    -# Liechtenstein
    -Zone	Europe/Vaduz	0:38:04 -	LMT	1894 Jun
    -			1:00	-	CET	1981
    -			1:00	EU	CE%sT
    -
    -# Croatia
    -Zone	Europe/Zagreb	1:03:52	-	LMT	1884
    -			1:00	-	CET	1941 Apr 18 23:00
    -			1:00	C-Eur	CE%sT	1945 May  8  2:00s
    -			1:00	1:00	CEST	1945 Sep 16  2:00s
    -			1:00	-	CET	1982 Nov 27
    -			1:00	EU	CE%sT
    -
    -# Madagascar
    -Zone Indian/Antananarivo 3:10:04 -	LMT	1911 Jul
    -			3:00	-	EAT	1954 Feb 27 23:00s
    -			3:00	1:00	EAST	1954 May 29 23:00s
    -			3:00	-	EAT
    -
    -# Comoros
    -Zone	Indian/Comoro	2:53:04 -	LMT	1911 Jul # Moroni, Gran Comoro
    -			3:00	-	EAT
    -
    -# Mayotte
    -Zone	Indian/Mayotte	3:00:56 -	LMT	1911 Jul # Mamoutzou
    -			3:00	-	EAT
    -
    -# US minor outlying islands
    -Zone Pacific/Johnston	-10:00	-	HST
    -
    -# US minor outlying islands
    -#
    -# From Mark Brader (2005-01-23):
    -# [Fallacies and Fantasies of Air Transport History, by R.E.G. Davies,
    -# published 1994 by Paladwr Press, McLean, VA, USA; ISBN 0-9626483-5-3]
    -# reproduced a Pan American Airways timetable from 1936, for their weekly
    -# "Orient Express" flights between San Francisco and Manila, and connecting
    -# flights to Chicago and the US East Coast.  As it uses some time zone
    -# designations that I've never seen before:....
    -# Fri. 6:30A Lv. HONOLOLU (Pearl Harbor), H.I.   H.L.T. Ar. 5:30P Sun.
    -#  "   3:00P Ar. MIDWAY ISLAND . . . . . . . . . M.L.T. Lv. 6:00A  "
    -#
    -Zone Pacific/Midway	-11:49:28 -	LMT	1901
    -			-11:00	-	NST	1956 Jun  3
    -			-11:00	1:00	NDT	1956 Sep  2
    -			-11:00	-	NST	1967 Apr    # N=Nome
    -			-11:00	-	BST	1983 Nov 30 # B=Bering
    -			-11:00	-	SST	            # S=Samoa
    -
    -# N Mariana Is
    -Zone Pacific/Saipan	-14:17:00 -	LMT	1844 Dec 31
    -			 9:43:00 -	LMT	1901
    -			 9:00	-	MPT	1969 Oct    # N Mariana Is Time
    -			10:00	-	MPT	2000 Dec 23
    -			10:00	-	ChST	# Chamorro Standard Time
    diff --git a/external/public-domain/tz/dist/checklinks.awk b/external/public-domain/tz/dist/checklinks.awk
    deleted file mode 100644
    index f57f736d5..000000000
    --- a/external/public-domain/tz/dist/checklinks.awk
    +++ /dev/null
    @@ -1,19 +0,0 @@
    -# Check links in tz tables.
    -
    -# Contributed by Paul Eggert.
    -
    -/^Link/ { used[$2] = 1 }
    -/^Zone/ { defined[$2] = 1 }
    -
    -END {
    -    status = 0
    -
    -    for (tz in used) {
    -	if (!defined[tz]) {
    -	    printf "%s: Link to non-zone\n", tz
    -	    status = 1
    -	}
    -    }
    -
    -    exit status
    -}
    diff --git a/external/public-domain/tz/dist/checktab.awk b/external/public-domain/tz/dist/checktab.awk
    deleted file mode 100644
    index de982999d..000000000
    --- a/external/public-domain/tz/dist/checktab.awk
    +++ /dev/null
    @@ -1,176 +0,0 @@
    -# Check tz tables for consistency.
    -
    -# Contributed by Paul Eggert.
    -
    -BEGIN {
    -	FS = "\t"
    -
    -	if (!iso_table) iso_table = "iso3166.tab"
    -	if (!zone_table) zone_table = "zone1970.tab"
    -	if (!want_warnings) want_warnings = -1
    -
    -	while (getline >"/dev/stderr"
    -			status = 1
    -		}
    -		cc = $1
    -		name = $2
    -		if (cc !~ /^[A-Z][A-Z]$/) {
    -			printf "%s:%d: invalid country code '%s'\n", \
    -				iso_table, iso_NR, cc >>"/dev/stderr"
    -			status = 1
    -		}
    -		if (cc <= cc0) {
    -			if (cc == cc0) {
    -				s = "duplicate";
    -			} else {
    -				s = "out of order";
    -			}
    -
    -			printf "%s:%d: country code '%s' is %s\n", \
    -				iso_table, iso_NR, cc, s \
    -				>>"/dev/stderr"
    -			status = 1
    -		}
    -		cc0 = cc
    -		if (name2cc[name]) {
    -			printf "%s:%d: '%s' and '%s' have the sname name\n", \
    -				iso_table, iso_NR, name2cc[name], cc \
    -				>>"/dev/stderr"
    -			status = 1
    -		}
    -		name2cc[name] = cc
    -		cc2name[cc] = name
    -		cc2NR[cc] = iso_NR
    -	}
    -
    -	cc0 = ""
    -
    -	while (getline >"/dev/stderr"
    -			status = 1
    -		}
    -		split($1, cca, /,/)
    -		cc = cca[1]
    -		coordinates = $2
    -		tz = $3
    -		comments = $4
    -		if (cc < cc0) {
    -			printf "%s:%d: country code '%s' is out of order\n", \
    -				zone_table, zone_NR, cc >>"/dev/stderr"
    -			status = 1
    -		}
    -		cc0 = cc
    -		tztab[tz] = 1
    -		tz2comments[tz] = comments
    -		tz2NR[tz] = zone_NR
    -		for (i in cca) {
    -		    cc = cca[i]
    -		    cctz = cc tz
    -		    cctztab[cctz] = 1
    -		    if (cc2name[cc]) {
    -			cc_used[cc]++
    -		    } else {
    -			printf "%s:%d: %s: unknown country code\n", \
    -				zone_table, zone_NR, cc >>"/dev/stderr"
    -			status = 1
    -		    }
    -		}
    -		if (coordinates !~ /^[-+][0-9][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9]$/ \
    -		    && coordinates !~ /^[-+][0-9][0-9][0-5][0-9][0-5][0-9][-+][01][0-9][0-9][0-5][0-9][0-5][0-9]$/) {
    -			printf "%s:%d: %s: invalid coordinates\n", \
    -				zone_table, zone_NR, coordinates >>"/dev/stderr"
    -			status = 1
    -		}
    -	}
    -
    -	for (cctz in cctztab) {
    -		cc = substr (cctz, 1, 2)
    -		tz = substr (cctz, 3)
    -		if (1 < cc_used[cc]) {
    -			comments_needed[tz] = cc
    -		}
    -	}
    -	for (cctz in cctztab) {
    -	  cc = substr (cctz, 1, 2)
    -	  tz = substr (cctz, 3)
    -	  if (!comments_needed[tz] && tz2comments[tz]) {
    -	    printf "%s:%d: unnecessary comment '%s'\n", \
    -		zone_table, tz2NR[tz], tz2comments[tz] \
    -		>>"/dev/stderr"
    -	    tz2comments[tz] = 0
    -	    status = 1
    -	  } else if (comments_needed[tz] && !tz2comments[tz]) {
    -	    printf "%s:%d: missing comment for %s\n", \
    -	      zone_table, tz2NR[tz], comments_needed[tz] \
    -	      >>"/dev/stderr"
    -	    status = 1
    -	  }
    -	}
    -	FS = " "
    -}
    -
    -$1 ~ /^#/ { next }
    -
    -{
    -	tz = rules = ""
    -	if ($1 == "Zone") {
    -		tz = $2
    -		ruleUsed[$4] = 1
    -	} else if ($1 == "Link" && zone_table == "zone.tab") {
    -		# Ignore Link commands if source and destination basenames
    -		# are identical, e.g. Europe/Istanbul versus Asia/Istanbul.
    -		src = $2
    -		dst = $3
    -		while ((i = index(src, "/"))) src = substr(src, i+1)
    -		while ((i = index(dst, "/"))) dst = substr(dst, i+1)
    -		if (src != dst) tz = $3
    -	} else if ($1 == "Rule") {
    -		ruleDefined[$2] = 1
    -	} else {
    -		ruleUsed[$2] = 1
    -	}
    -	if (tz && tz ~ /\//) {
    -		if (!tztab[tz]) {
    -			printf "%s: no data for '%s'\n", zone_table, tz \
    -				>>"/dev/stderr"
    -			status = 1
    -		}
    -		zoneSeen[tz] = 1
    -	}
    -}
    -
    -END {
    -	for (tz in ruleDefined) {
    -		if (!ruleUsed[tz]) {
    -			printf "%s: Rule never used\n", tz
    -			status = 1
    -		}
    -	}
    -	for (tz in tztab) {
    -		if (!zoneSeen[tz]) {
    -			printf "%s:%d: no Zone table for '%s'\n", \
    -				zone_table, tz2NR[tz], tz >>"/dev/stderr"
    -			status = 1
    -		}
    -	}
    -	if (0 < want_warnings) {
    -		for (cc in cc2name) {
    -			if (!cc_used[cc]) {
    -				printf "%s:%d: warning: " \
    -					"no Zone entries for %s (%s)\n", \
    -					iso_table, cc2NR[cc], cc, cc2name[cc]
    -			}
    -		}
    -	}
    -
    -	exit status
    -}
    diff --git a/external/public-domain/tz/dist/etcetera b/external/public-domain/tz/dist/etcetera
    deleted file mode 100644
    index c2e25328d..000000000
    --- a/external/public-domain/tz/dist/etcetera
    +++ /dev/null
    @@ -1,80 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# These entries are mostly present for historical reasons, so that
    -# people in areas not otherwise covered by the tz files could "zic -l"
    -# to a time zone that was right for their area.  These days, the
    -# tz files cover almost all the inhabited world, and the only practical
    -# need now for the entries that are not on UTC are for ships at sea
    -# that cannot use POSIX TZ settings.
    -
    -Zone	Etc/GMT		0	-	GMT
    -Zone	Etc/UTC		0	-	UTC
    -Zone	Etc/UCT		0	-	UCT
    -
    -# The following link uses older naming conventions,
    -# but it belongs here, not in the file 'backward',
    -# as functions like gmtime load the "GMT" file to handle leap seconds properly.
    -# We want this to work even on installations that omit the other older names.
    -Link	Etc/GMT				GMT
    -
    -Link	Etc/UTC				Etc/Universal
    -Link	Etc/UTC				Etc/Zulu
    -
    -Link	Etc/GMT				Etc/Greenwich
    -Link	Etc/GMT				Etc/GMT-0
    -Link	Etc/GMT				Etc/GMT+0
    -Link	Etc/GMT				Etc/GMT0
    -
    -# We use POSIX-style signs in the Zone names and the output abbreviations,
    -# even though this is the opposite of what many people expect.
    -# POSIX has positive signs west of Greenwich, but many people expect
    -# positive signs east of Greenwich.  For example, TZ='Etc/GMT+4' uses
    -# the abbreviation "GMT+4" and corresponds to 4 hours behind UT
    -# (i.e. west of Greenwich) even though many people would expect it to
    -# mean 4 hours ahead of UT (i.e. east of Greenwich).
    -#
    -# In the draft 5 of POSIX 1003.1-200x, the angle bracket notation allows for
    -# TZ='+4'; if you want time zone abbreviations conforming to
    -# ISO 8601 you can use TZ='<-0400>+4'.  Thus the commonly-expected
    -# offset is kept within the angle bracket (and is used for display)
    -# while the POSIX sign is kept outside the angle bracket (and is used
    -# for calculation).
    -#
    -# Do not use a TZ setting like TZ='GMT+4', which is four hours behind
    -# GMT but uses the completely misleading abbreviation "GMT".
    -
    -# Earlier incarnations of this package were not POSIX-compliant,
    -# and had lines such as
    -#		Zone	GMT-12		-12	-	GMT-1200
    -# We did not want things to change quietly if someone accustomed to the old
    -# way does a
    -#		zic -l GMT-12
    -# so we moved the names into the Etc subdirectory.
    -
    -Zone	Etc/GMT-14	14	-	GMT-14	# 14 hours ahead of GMT
    -Zone	Etc/GMT-13	13	-	GMT-13
    -Zone	Etc/GMT-12	12	-	GMT-12
    -Zone	Etc/GMT-11	11	-	GMT-11
    -Zone	Etc/GMT-10	10	-	GMT-10
    -Zone	Etc/GMT-9	9	-	GMT-9
    -Zone	Etc/GMT-8	8	-	GMT-8
    -Zone	Etc/GMT-7	7	-	GMT-7
    -Zone	Etc/GMT-6	6	-	GMT-6
    -Zone	Etc/GMT-5	5	-	GMT-5
    -Zone	Etc/GMT-4	4	-	GMT-4
    -Zone	Etc/GMT-3	3	-	GMT-3
    -Zone	Etc/GMT-2	2	-	GMT-2
    -Zone	Etc/GMT-1	1	-	GMT-1
    -Zone	Etc/GMT+1	-1	-	GMT+1
    -Zone	Etc/GMT+2	-2	-	GMT+2
    -Zone	Etc/GMT+3	-3	-	GMT+3
    -Zone	Etc/GMT+4	-4	-	GMT+4
    -Zone	Etc/GMT+5	-5	-	GMT+5
    -Zone	Etc/GMT+6	-6	-	GMT+6
    -Zone	Etc/GMT+7	-7	-	GMT+7
    -Zone	Etc/GMT+8	-8	-	GMT+8
    -Zone	Etc/GMT+9	-9	-	GMT+9
    -Zone	Etc/GMT+10	-10	-	GMT+10
    -Zone	Etc/GMT+11	-11	-	GMT+11
    -Zone	Etc/GMT+12	-12	-	GMT+12
    diff --git a/external/public-domain/tz/dist/europe b/external/public-domain/tz/dist/europe
    deleted file mode 100644
    index 6b89b6e1f..000000000
    --- a/external/public-domain/tz/dist/europe
    +++ /dev/null
    @@ -1,3410 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# This file is by no means authoritative; if you think you know better,
    -# go ahead and edit the file (and please send any changes to
    -# tz@iana.org for general use in the future).  For more, please see
    -# the file CONTRIBUTING in the tz distribution.
    -
    -# From Paul Eggert (2014-10-31):
    -#
    -# Unless otherwise specified, the source for data through 1990 is:
    -# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
    -# San Diego: ACS Publications, Inc. (2003).
    -# Unfortunately this book contains many errors and cites no sources.
    -#
    -# Gwillim Law writes that a good source
    -# for recent time zone data is the International Air Transport
    -# Association's Standard Schedules Information Manual (IATA SSIM),
    -# published semiannually.  Law sent in several helpful summaries
    -# of the IATA's data after 1990.  Except where otherwise noted,
    -# IATA SSIM is the source for entries after 1990.
    -#
    -# A reliable and entertaining source about time zones is
    -# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
    -#
    -# Except where otherwise noted, Shanks & Pottenger is the source for
    -# entries through 1991, and IATA SSIM is the source for entries afterwards.
    -#
    -# Other sources occasionally used include:
    -#
    -#	Edward W. Whitman, World Time Differences,
    -#	Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated),
    -#	which I found in the UCLA library.
    -#
    -#	William Willett, The Waste of Daylight, 19th edition
    -#	
    -#	[PDF] (1914-03)
    -#
    -#	Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
    -#	.  He writes:
    -#	"It is requested that corrections and additions to these tables
    -#	may be sent to Mr. John Milne, Royal Geographical Society,
    -#	Savile Row, London."  Nowadays please email them to tz@iana.org.
    -#
    -#	Byalokoz EL. New Counting of Time in Russia since July 1, 1919.
    -#	This Russian-language source was consulted by Vladimir Karpinsky; see
    -#	http://mm.icann.org/pipermail/tz/2014-August/021320.html
    -#	The full Russian citation is:
    -#	БÑлокоз, Евгений Людвигович. Ðовый Ñчет времени в течении Ñуток
    -#	введенный декретом Совета народных комиÑÑаров Ð´Ð»Ñ Ð²Ñей РоÑÑии Ñ 1-го
    -#	Ð¸ÑŽÐ»Ñ 1919 г. / Изд. 2-е МеждуведомÑтвенной комиÑÑии. - Петроград:
    -#	ДеÑÑÑ‚Ð°Ñ Ð³Ð¾Ñ. тип., 1919.
    -#	http://resolver.gpntb.ru/purl?docushare/dsweb/Get/Resource-2011/Byalokoz__E.L.__Novyy__schet__vremeni__v__techenie__sutok__izd__2(1).pdf
    -#
    -#	Brazil's Divisão Serviço da Hora (DSHO),
    -#	History of Summer Time
    -#	
    -#	(1998-09-21, in Portuguese)
    -
    -#
    -# I invented the abbreviations marked '*' in the following table;
    -# the rest are from earlier versions of this file, or from other sources.
    -# Corrections are welcome!
    -#                   std dst  2dst
    -#                   LMT           Local Mean Time
    -#       -4:00       AST ADT       Atlantic
    -#       -3:00       WGT WGST      Western Greenland*
    -#       -1:00       EGT EGST      Eastern Greenland*
    -#        0:00       GMT BST  BDST Greenwich, British Summer
    -#        0:00       GMT IST       Greenwich, Irish Summer
    -#        0:00       WET WEST WEMT Western Europe
    -#        0:19:32.13 AMT NST       Amsterdam, Netherlands Summer (1835-1937)*
    -#        0:20       NET NEST      Netherlands (1937-1940)*
    -#        1:00       BST           British Standard (1968-1971)
    -#        1:00       CET CEST CEMT Central Europe
    -#        1:00:14    SET           Swedish (1879-1899)*
    -#        2:00       EET EEST      Eastern Europe
    -#        3:00       FET           Further-eastern Europe (2011-2014)*
    -#        3:00       MSK MSD  MSM* Minsk, Moscow
    -
    -# From Peter Ilieve (1994-12-04),
    -# The original six [EU members]: Belgium, France, (West) Germany, Italy,
    -# Luxembourg, the Netherlands.
    -# Plus, from 1 Jan 73: Denmark, Ireland, United Kingdom.
    -# Plus, from 1 Jan 81: Greece.
    -# Plus, from 1 Jan 86: Spain, Portugal.
    -# Plus, from 1 Jan 95: Austria, Finland, Sweden. (Norway negotiated terms for
    -# entry but in a referendum on 28 Nov 94 the people voted No by 52.2% to 47.8%
    -# on a turnout of 88.6%. This was almost the same result as Norway's previous
    -# referendum in 1972, they are the only country to have said No twice.
    -# Referendums in the other three countries voted Yes.)
    -# ...
    -# Estonia ... uses EU dates but not at 01:00 GMT, they use midnight GMT.
    -# I don't think they know yet what they will do from 1996 onwards.
    -# ...
    -# There shouldn't be any [current members who are not using EU rules].
    -# A Directive has the force of law, member states are obliged to enact
    -# national law to implement it. The only contentious issue was the
    -# different end date for the UK and Ireland, and this was always allowed
    -# in the Directive.
    -
    -
    -###############################################################################
    -
    -# Britain (United Kingdom) and Ireland (Eire)
    -
    -# From Peter Ilieve (1994-07-06):
    -#
    -# On 17 Jan 1994 the Independent, a UK quality newspaper, had a piece about
    -# historical vistas along the Thames in west London. There was a photo
    -# and a sketch map showing some of the sightlines involved. One paragraph
    -# of the text said:
    -#
    -# 'An old stone obelisk marking a forgotten terrestrial meridian stands
    -# beside the river at Kew. In the 18th century, before time and longitude
    -# was standardised by the Royal Observatory in Greenwich, scholars observed
    -# this stone and the movement of stars from Kew Observatory nearby. They
    -# made their calculations and set the time for the Horse Guards and Parliament,
    -# but now the stone is obscured by scrubwood and can only be seen by walking
    -# along the towpath within a few yards of it.'
    -#
    -# I have a one inch to one mile map of London and my estimate of the stone's
    -# position is 51 degrees 28' 30" N, 0 degrees 18' 45" W. The longitude should
    -# be within about +-2". The Ordnance Survey grid reference is TQ172761.
    -#
    -# [This yields GMTOFF = -0:01:15 for London LMT in the 18th century.]
    -
    -# From Paul Eggert (1993-11-18):
    -#
    -# Howse writes that Britain was the first country to use standard time.
    -# The railways cared most about the inconsistencies of local mean time,
    -# and it was they who forced a uniform time on the country.
    -# The original idea was credited to Dr. William Hyde Wollaston (1766-1828)
    -# and was popularized by Abraham Follett Osler (1808-1903).
    -# The first railway to adopt London time was the Great Western Railway
    -# in November 1840; other railways followed suit, and by 1847 most
    -# (though not all) railways used London time.  On 1847-09-22 the
    -# Railway Clearing House, an industry standards body, recommended that GMT be
    -# adopted at all stations as soon as the General Post Office permitted it.
    -# The transition occurred on 12-01 for the L&NW, the Caledonian,
    -# and presumably other railways; the January 1848 Bradshaw's lists many
    -# railways as using GMT.  By 1855 the vast majority of public
    -# clocks in Britain were set to GMT (though some, like the great clock
    -# on Tom Tower at Christ Church, Oxford, were fitted with two minute hands,
    -# one for local time and one for GMT).  The last major holdout was the legal
    -# system, which stubbornly stuck to local time for many years, leading
    -# to oddities like polls opening at 08:13 and closing at 16:13.
    -# The legal system finally switched to GMT when the Statutes (Definition
    -# of Time) Act took effect; it received the Royal Assent on 1880-08-02.
    -#
    -# In the tables below, we condense this complicated story into a single
    -# transition date for London, namely 1847-12-01.  We don't know as much
    -# about Dublin, so we use 1880-08-02, the legal transition time.
    -
    -# From Paul Eggert (2014-07-19):
    -# The ancients had no need for daylight saving, as they kept time
    -# informally or via hours whose length depended on the time of year.
    -# Daylight saving time in its modern sense was invented by the
    -# New Zealand entomologist George Vernon Hudson (1867-1946),
    -# whose day job as a postal clerk led him to value
    -# after-hours daylight in which to pursue his research.
    -# In 1895 he presented a paper to the Wellington Philosophical Society
    -# that proposed a two-hour daylight-saving shift.  See:
    -# Hudson GV. On seasonal time-adjustment in countries south of lat. 30 deg.
    -# Transactions and Proceedings of the New Zealand Institute. 1895;28:734
    -# http://rsnz.natlib.govt.nz/volume/rsnz_28/rsnz_28_00_006110.html
    -# Although some interest was expressed in New Zealand, his proposal
    -# did not find its way into law and eventually it was almost forgotten.
    -#
    -# In England, DST was independently reinvented by William Willett (1857-1915),
    -# a London builder and member of the Royal Astronomical Society
    -# who circulated a pamphlet "The Waste of Daylight" (1907)
    -# that proposed advancing clocks 20 minutes on each of four Sundays in April,
    -# and retarding them by the same amount on four Sundays in September.
    -# A bill was drafted in 1909 and introduced in Parliament several times,
    -# but it met with ridicule and opposition, especially from farming interests.
    -# Later editions of the pamphlet proposed one-hour summer time, and
    -# it was eventually adopted as a wartime measure in 1916.
    -# See: Summer Time Arrives Early, The Times (2000-05-18).
    -# A monument to Willett was unveiled on 1927-05-21, in an open space in
    -# a 45-acre wood near Chislehurst, Kent that was purchased by popular
    -# subscription and open to the public.  On the south face of the monolith,
    -# designed by G. W. Miller, is the William Willett Memorial Sundial,
    -# which is permanently set to Summer Time.
    -
    -# From Winston Churchill (1934-04-28):
    -# It is one of the paradoxes of history that we should owe the boon of
    -# summer time, which gives every year to the people of this country
    -# between 160 and 170 hours more daylight leisure, to a war which
    -# plunged Europe into darkness for four years, and shook the
    -# foundations of civilization throughout the world.
    -#	-- "A Silent Toast to William Willett", Pictorial Weekly;
    -#	republished in Finest Hour (Spring 2002) 1(114):26
    -#	http://www.winstonchurchill.org/images/finesthour/Vol.01%20No.114.pdf
    -
    -# From Paul Eggert (2015-08-08):
    -# The OED Supplement says that the English originally said "Daylight Saving"
    -# when they were debating the adoption of DST in 1908; but by 1916 this
    -# term appears only in quotes taken from DST's opponents, whereas the
    -# proponents (who eventually won the argument) are quoted as using "Summer".
    -# The term "Summer Time" was introduced by Herbert Samuel, Home Secretary; see:
    -# Viscount Samuel. Leisure in a Democracy. Cambridge University Press
    -# ISBN 978-1-107-49471-8 (1949, reissued 2015), p 8.
    -
    -# From Arthur David Olson (1989-01-19):
    -# A source at the British Information Office in New York avers that it's
    -# known as "British" Summer Time in all parts of the United Kingdom.
    -
    -# Date: 4 Jan 89 08:57:25 GMT (Wed)
    -# From: Jonathan Leffler
    -# [British Summer Time] is fixed annually by Act of Parliament.
    -# If you can predict what Parliament will do, you should be in
    -# politics making a fortune, not computing.
    -
    -# From Chris Carrier (1996-06-14):
    -# I remember reading in various wartime issues of the London Times the
    -# acronym BDST for British Double Summer Time.  Look for the published
    -# time of sunrise and sunset in The Times, when BDST was in effect, and
    -# if you find a zone reference it will say, "All times B.D.S.T."
    -
    -# From Joseph S. Myers (1999-09-02):
    -# ... some military cables (WO 219/4100 - this is a copy from the
    -# main SHAEF archives held in the US National Archives, SHAEF/5252/8/516)
    -# agree that the usage is BDST (this appears in a message dated 17 Feb 1945).
    -
    -# From Joseph S. Myers (2000-10-03):
    -# On 18th April 1941, Sir Stephen Tallents of the BBC wrote to Sir
    -# Alexander Maxwell of the Home Office asking whether there was any
    -# official designation; the reply of the 21st was that there wasn't
    -# but he couldn't think of anything better than the "Double British
    -# Summer Time" that the BBC had been using informally.
    -# http://www.polyomino.org.uk/british-time/bbc-19410418.png
    -# http://www.polyomino.org.uk/british-time/ho-19410421.png
    -
    -# From Sir Alexander Maxwell in the above-mentioned letter (1941-04-21):
    -# [N]o official designation has as far as I know been adopted for the time
    -# which is to be introduced in May....
    -# I cannot think of anything better than "Double British Summer Time"
    -# which could not be said to run counter to any official description.
    -
    -# From Paul Eggert (2000-10-02):
    -# Howse writes (p 157) 'DBST' too, but 'BDST' seems to have been common
    -# and follows the more usual convention of putting the location name first,
    -# so we use 'BDST'.
    -
    -# Peter Ilieve (1998-04-19) described at length
    -# the history of summer time legislation in the United Kingdom.
    -# Since 1998 Joseph S. Myers has been updating
    -# and extending this list, which can be found in
    -# http://www.polyomino.org.uk/british-time/
    -
    -# From Joseph S. Myers (1998-01-06):
    -#
    -# The legal time in the UK outside of summer time is definitely GMT, not UTC;
    -# see Lord Tanlaw's speech
    -# http://www.publications.parliament.uk/pa/ld199798/ldhansrd/vo970611/text/70611-10.htm#70611-10_head0
    -# (Lords Hansard 11 June 1997 columns 964 to 976).
    -
    -# From Paul Eggert (2006-03-22):
    -#
    -# For lack of other data, follow Shanks & Pottenger for Eire in 1940-1948.
    -#
    -# Given Ilieve and Myers's data, the following claims by Shanks & Pottenger
    -# are incorrect:
    -#     * Wales did not switch from GMT to daylight saving time until
    -#	1921 Apr 3, when they began to conform with the rest of Great Britain.
    -# Actually, Wales was identical after 1880.
    -#     * Eire had two transitions on 1916 Oct 1.
    -# It actually just had one transition.
    -#     * Northern Ireland used single daylight saving time throughout WW II.
    -# Actually, it conformed to Britain.
    -#     * GB-Eire changed standard time to 1 hour ahead of GMT on 1968-02-18.
    -# Actually, that date saw the usual switch to summer time.
    -# Standard time was not changed until 1968-10-27 (the clocks didn't change).
    -#
    -# Here is another incorrect claim by Shanks & Pottenger:
    -#     * Jersey, Guernsey, and the Isle of Man did not switch from GMT
    -#	to daylight saving time until 1921 Apr 3, when they began to
    -#	conform with Great Britain.
    -# S.R.&O. 1916, No. 382 and HO 45/10811/312364 (quoted above) say otherwise.
    -#
    -# The following claim by Shanks & Pottenger is possible though doubtful;
    -# we'll ignore it for now.
    -#     * Dublin's 1971-10-31 switch was at 02:00, even though London's was 03:00.
    -#
    -#
    -# Whitman says Dublin Mean Time was -0:25:21, which is more precise than
    -# Shanks & Pottenger.
    -# Perhaps this was Dunsink Observatory Time, as Dunsink Observatory
    -# (8 km NW of Dublin's center) seemingly was to Dublin as Greenwich was
    -# to London.  For example:
    -#
    -#   "Timeball on the ballast office is down.  Dunsink time."
    -#   -- James Joyce, Ulysses
    -
    -# "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time
    -# was among various actions undertaken by the 'English' government that
    -# would 'put the whole country into the SF (Sinn Féin) camp'.  She claimed
    -# Irish 'public feeling (was) outraged by forcing of English time on us'."
    -# -- Parsons M. Dublin lost its time zone - and 25 minutes - after 1916 Rising.
    -# Irish Times 2014-10-27.
    -# http://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411
    -
    -# From Joseph S. Myers (2005-01-26):
    -# Irish laws are available online at .
    -# These include various relating to legal time, for example:
    -#
    -# ZZA13Y1923.html ZZA12Y1924.html ZZA8Y1925.html ZZSIV20PG1267.html
    -#
    -# ZZSI71Y1947.html ZZSI128Y1948.html ZZSI23Y1949.html ZZSI41Y1950.html
    -# ZZSI27Y1951.html ZZSI73Y1952.html
    -#
    -# ZZSI11Y1961.html ZZSI232Y1961.html ZZSI182Y1962.html
    -# ZZSI167Y1963.html ZZSI257Y1964.html ZZSI198Y1967.html
    -# ZZA23Y1968.html ZZA17Y1971.html
    -#
    -# ZZSI67Y1981.html ZZSI212Y1982.html ZZSI45Y1986.html
    -# ZZSI264Y1988.html ZZSI52Y1990.html ZZSI371Y1992.html
    -# ZZSI395Y1994.html ZZSI484Y1997.html ZZSI506Y2001.html
    -#
    -# [These are all relative to the root, e.g., the first is
    -# .]
    -#
    -# (These are those I found, but there could be more.  In any case these
    -# should allow various updates to the comments in the europe file to cover
    -# the laws applicable in Ireland.)
    -#
    -# (Note that the time in the Republic of Ireland since 1968 has been defined
    -# in terms of standard time being GMT+1 with a period of winter time when it
    -# is GMT, rather than standard time being GMT with a period of summer time
    -# being GMT+1.)
    -
    -# From Paul Eggert (1999-03-28):
    -# Clive Feather (, 1997-03-31)
    -# reports that Folkestone (Cheriton) Shuttle Terminal uses Concession Time
    -# (CT), equivalent to French civil time.
    -# Julian Hill (, 1998-09-30) reports that
    -# trains between Dollands Moor (the freight facility next door)
    -# and Frethun run in CT.
    -# My admittedly uninformed guess is that the terminal has two authorities,
    -# the French concession operators and the British civil authorities,
    -# and that the time depends on who you're talking to.
    -# If, say, the British police were called to the station for some reason,
    -# I would expect the official police report to use GMT/BST and not CET/CEST.
    -# This is a borderline case, but for now let's stick to GMT/BST.
    -
    -# From an anonymous contributor (1996-06-02):
    -# The law governing time in Ireland is under Statutory Instrument SI 395/94,
    -# which gives force to European Union 7th Council Directive No. 94/21/EC.
    -# Under this directive, the Minister for Justice in Ireland makes appropriate
    -# regulations. I spoke this morning with the Secretary of the Department of
    -# Justice (tel +353 1 678 9711) who confirmed to me that the correct name is
    -# "Irish Summer Time", abbreviated to "IST".
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -# Summer Time Act, 1916
    -Rule	GB-Eire	1916	only	-	May	21	2:00s	1:00	BST
    -Rule	GB-Eire	1916	only	-	Oct	 1	2:00s	0	GMT
    -# S.R.&O. 1917, No. 358
    -Rule	GB-Eire	1917	only	-	Apr	 8	2:00s	1:00	BST
    -Rule	GB-Eire	1917	only	-	Sep	17	2:00s	0	GMT
    -# S.R.&O. 1918, No. 274
    -Rule	GB-Eire	1918	only	-	Mar	24	2:00s	1:00	BST
    -Rule	GB-Eire	1918	only	-	Sep	30	2:00s	0	GMT
    -# S.R.&O. 1919, No. 297
    -Rule	GB-Eire	1919	only	-	Mar	30	2:00s	1:00	BST
    -Rule	GB-Eire	1919	only	-	Sep	29	2:00s	0	GMT
    -# S.R.&O. 1920, No. 458
    -Rule	GB-Eire	1920	only	-	Mar	28	2:00s	1:00	BST
    -# S.R.&O. 1920, No. 1844
    -Rule	GB-Eire	1920	only	-	Oct	25	2:00s	0	GMT
    -# S.R.&O. 1921, No. 363
    -Rule	GB-Eire	1921	only	-	Apr	 3	2:00s	1:00	BST
    -Rule	GB-Eire	1921	only	-	Oct	 3	2:00s	0	GMT
    -# S.R.&O. 1922, No. 264
    -Rule	GB-Eire	1922	only	-	Mar	26	2:00s	1:00	BST
    -Rule	GB-Eire	1922	only	-	Oct	 8	2:00s	0	GMT
    -# The Summer Time Act, 1922
    -Rule	GB-Eire	1923	only	-	Apr	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1923	1924	-	Sep	Sun>=16	2:00s	0	GMT
    -Rule	GB-Eire	1924	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -Rule	GB-Eire	1925	1926	-	Apr	Sun>=16	2:00s	1:00	BST
    -# The Summer Time Act, 1925
    -Rule	GB-Eire	1925	1938	-	Oct	Sun>=2	2:00s	0	GMT
    -Rule	GB-Eire	1927	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -Rule	GB-Eire	1928	1929	-	Apr	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1930	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -Rule	GB-Eire	1931	1932	-	Apr	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1933	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -Rule	GB-Eire	1934	only	-	Apr	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1935	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -Rule	GB-Eire	1936	1937	-	Apr	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1938	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -Rule	GB-Eire	1939	only	-	Apr	Sun>=16	2:00s	1:00	BST
    -# S.R.&O. 1939, No. 1379
    -Rule	GB-Eire	1939	only	-	Nov	Sun>=16	2:00s	0	GMT
    -# S.R.&O. 1940, No. 172 and No. 1883
    -Rule	GB-Eire	1940	only	-	Feb	Sun>=23	2:00s	1:00	BST
    -# S.R.&O. 1941, No. 476
    -Rule	GB-Eire	1941	only	-	May	Sun>=2	1:00s	2:00	BDST
    -Rule	GB-Eire	1941	1943	-	Aug	Sun>=9	1:00s	1:00	BST
    -# S.R.&O. 1942, No. 506
    -Rule	GB-Eire	1942	1944	-	Apr	Sun>=2	1:00s	2:00	BDST
    -# S.R.&O. 1944, No. 932
    -Rule	GB-Eire	1944	only	-	Sep	Sun>=16	1:00s	1:00	BST
    -# S.R.&O. 1945, No. 312
    -Rule	GB-Eire	1945	only	-	Apr	Mon>=2	1:00s	2:00	BDST
    -Rule	GB-Eire	1945	only	-	Jul	Sun>=9	1:00s	1:00	BST
    -# S.R.&O. 1945, No. 1208
    -Rule	GB-Eire	1945	1946	-	Oct	Sun>=2	2:00s	0	GMT
    -Rule	GB-Eire	1946	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -# The Summer Time Act, 1947
    -Rule	GB-Eire	1947	only	-	Mar	16	2:00s	1:00	BST
    -Rule	GB-Eire	1947	only	-	Apr	13	1:00s	2:00	BDST
    -Rule	GB-Eire	1947	only	-	Aug	10	1:00s	1:00	BST
    -Rule	GB-Eire	1947	only	-	Nov	 2	2:00s	0	GMT
    -# Summer Time Order, 1948 (S.I. 1948/495)
    -Rule	GB-Eire	1948	only	-	Mar	14	2:00s	1:00	BST
    -Rule	GB-Eire	1948	only	-	Oct	31	2:00s	0	GMT
    -# Summer Time Order, 1949 (S.I. 1949/373)
    -Rule	GB-Eire	1949	only	-	Apr	 3	2:00s	1:00	BST
    -Rule	GB-Eire	1949	only	-	Oct	30	2:00s	0	GMT
    -# Summer Time Order, 1950 (S.I. 1950/518)
    -# Summer Time Order, 1951 (S.I. 1951/430)
    -# Summer Time Order, 1952 (S.I. 1952/451)
    -Rule	GB-Eire	1950	1952	-	Apr	Sun>=14	2:00s	1:00	BST
    -Rule	GB-Eire	1950	1952	-	Oct	Sun>=21	2:00s	0	GMT
    -# revert to the rules of the Summer Time Act, 1925
    -Rule	GB-Eire	1953	only	-	Apr	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1953	1960	-	Oct	Sun>=2	2:00s	0	GMT
    -Rule	GB-Eire	1954	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -Rule	GB-Eire	1955	1956	-	Apr	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1957	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -Rule	GB-Eire	1958	1959	-	Apr	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1960	only	-	Apr	Sun>=9	2:00s	1:00	BST
    -# Summer Time Order, 1961 (S.I. 1961/71)
    -# Summer Time (1962) Order, 1961 (S.I. 1961/2465)
    -# Summer Time Order, 1963 (S.I. 1963/81)
    -Rule	GB-Eire	1961	1963	-	Mar	lastSun	2:00s	1:00	BST
    -Rule	GB-Eire	1961	1968	-	Oct	Sun>=23	2:00s	0	GMT
    -# Summer Time (1964) Order, 1963 (S.I. 1963/2101)
    -# Summer Time Order, 1964 (S.I. 1964/1201)
    -# Summer Time Order, 1967 (S.I. 1967/1148)
    -Rule	GB-Eire	1964	1967	-	Mar	Sun>=19	2:00s	1:00	BST
    -# Summer Time Order, 1968 (S.I. 1968/117)
    -Rule	GB-Eire	1968	only	-	Feb	18	2:00s	1:00	BST
    -# The British Standard Time Act, 1968
    -#	(no summer time)
    -# The Summer Time Act, 1972
    -Rule	GB-Eire	1972	1980	-	Mar	Sun>=16	2:00s	1:00	BST
    -Rule	GB-Eire	1972	1980	-	Oct	Sun>=23	2:00s	0	GMT
    -# Summer Time Order, 1980 (S.I. 1980/1089)
    -# Summer Time Order, 1982 (S.I. 1982/1673)
    -# Summer Time Order, 1986 (S.I. 1986/223)
    -# Summer Time Order, 1988 (S.I. 1988/931)
    -Rule	GB-Eire	1981	1995	-	Mar	lastSun	1:00u	1:00	BST
    -Rule	GB-Eire 1981	1989	-	Oct	Sun>=23	1:00u	0	GMT
    -# Summer Time Order, 1989 (S.I. 1989/985)
    -# Summer Time Order, 1992 (S.I. 1992/1729)
    -# Summer Time Order 1994 (S.I. 1994/2798)
    -Rule	GB-Eire 1990	1995	-	Oct	Sun>=22	1:00u	0	GMT
    -# Summer Time Order 1997 (S.I. 1997/2982)
    -# See EU for rules starting in 1996.
    -#
    -# Use Europe/London for Jersey, Guernsey, and the Isle of Man.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/London	-0:01:15 -	LMT	1847 Dec  1  0:00s
    -			 0:00	GB-Eire	%s	1968 Oct 27
    -			 1:00	-	BST	1971 Oct 31  2:00u
    -			 0:00	GB-Eire	%s	1996
    -			 0:00	EU	GMT/BST
    -Link	Europe/London	Europe/Jersey
    -Link	Europe/London	Europe/Guernsey
    -Link	Europe/London	Europe/Isle_of_Man
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Dublin	-0:25:00 -	LMT	1880 Aug  2
    -			-0:25:21 -	DMT	1916 May 21  2:00
    -			-0:25:21 1:00	IST	1916 Oct  1  2:00s
    -			 0:00	GB-Eire	%s	1921 Dec  6 # independence
    -			 0:00	GB-Eire	GMT/IST	1940 Feb 25  2:00
    -			 0:00	1:00	IST	1946 Oct  6  2:00
    -			 0:00	-	GMT	1947 Mar 16  2:00
    -			 0:00	1:00	IST	1947 Nov  2  2:00
    -			 0:00	-	GMT	1948 Apr 18  2:00
    -			 0:00	GB-Eire	GMT/IST	1968 Oct 27
    -			 1:00	-	IST	1971 Oct 31  2:00u
    -			 0:00	GB-Eire	GMT/IST	1996
    -			 0:00	EU	GMT/IST
    -
    -###############################################################################
    -
    -# Europe
    -
    -# EU rules are for the European Union, previously known as the EC, EEC,
    -# Common Market, etc.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	EU	1977	1980	-	Apr	Sun>=1	 1:00u	1:00	S
    -Rule	EU	1977	only	-	Sep	lastSun	 1:00u	0	-
    -Rule	EU	1978	only	-	Oct	 1	 1:00u	0	-
    -Rule	EU	1979	1995	-	Sep	lastSun	 1:00u	0	-
    -Rule	EU	1981	max	-	Mar	lastSun	 1:00u	1:00	S
    -Rule	EU	1996	max	-	Oct	lastSun	 1:00u	0	-
    -# The most recent directive covers the years starting in 2002.  See:
    -# Directive 2000/84/EC of the European Parliament and of the Council
    -# of 19 January 2001 on summer-time arrangements.
    -# http://eur-lex.europa.eu/LexUriServ/LexUriServ.do?uri=CELEX:32000L0084:EN:NOT
    -
    -# W-Eur differs from EU only in that W-Eur uses standard time.
    -Rule	W-Eur	1977	1980	-	Apr	Sun>=1	 1:00s	1:00	S
    -Rule	W-Eur	1977	only	-	Sep	lastSun	 1:00s	0	-
    -Rule	W-Eur	1978	only	-	Oct	 1	 1:00s	0	-
    -Rule	W-Eur	1979	1995	-	Sep	lastSun	 1:00s	0	-
    -Rule	W-Eur	1981	max	-	Mar	lastSun	 1:00s	1:00	S
    -Rule	W-Eur	1996	max	-	Oct	lastSun	 1:00s	0	-
    -
    -# Older C-Eur rules are for convenience in the tables.
    -# From 1977 on, C-Eur differs from EU only in that C-Eur uses standard time.
    -Rule	C-Eur	1916	only	-	Apr	30	23:00	1:00	S
    -Rule	C-Eur	1916	only	-	Oct	 1	 1:00	0	-
    -Rule	C-Eur	1917	1918	-	Apr	Mon>=15	 2:00s	1:00	S
    -Rule	C-Eur	1917	1918	-	Sep	Mon>=15	 2:00s	0	-
    -Rule	C-Eur	1940	only	-	Apr	 1	 2:00s	1:00	S
    -Rule	C-Eur	1942	only	-	Nov	 2	 2:00s	0	-
    -Rule	C-Eur	1943	only	-	Mar	29	 2:00s	1:00	S
    -Rule	C-Eur	1943	only	-	Oct	 4	 2:00s	0	-
    -Rule	C-Eur	1944	1945	-	Apr	Mon>=1	 2:00s	1:00	S
    -# Whitman gives 1944 Oct 7; go with Shanks & Pottenger.
    -Rule	C-Eur	1944	only	-	Oct	 2	 2:00s	0	-
    -# From Jesper Nørgaard Welen (2008-07-13):
    -#
    -# I found what is probably a typo of 2:00 which should perhaps be 2:00s
    -# in the C-Eur rule from tz database version 2008d (this part was
    -# corrected in version 2008d). The circumstantial evidence is simply the
    -# tz database itself, as seen below:
    -#
    -# Zone Europe/Paris 0:09:21 - LMT 1891 Mar 15  0:01
    -#    0:00 France WE%sT 1945 Sep 16  3:00
    -#
    -# Zone Europe/Monaco 0:29:32 - LMT 1891 Mar 15
    -#    0:00 France WE%sT 1945 Sep 16  3:00
    -#
    -# Zone Europe/Belgrade 1:22:00 - LMT 1884
    -#    1:00 1:00 CEST 1945 Sep 16  2:00s
    -#
    -# Rule France 1945 only - Sep 16  3:00 0 -
    -# Rule Belgium 1945 only - Sep 16  2:00s 0 -
    -# Rule Neth 1945 only - Sep 16 2:00s 0 -
    -#
    -# The rule line to be changed is:
    -#
    -# Rule C-Eur 1945 only - Sep 16  2:00 0 -
    -#
    -# It seems that Paris, Monaco, Rule France, Rule Belgium all agree on
    -# 2:00 standard time, e.g. 3:00 local time.  However there are no
    -# countries that use C-Eur rules in September 1945, so the only items
    -# affected are apparently these fictitious zones that translate acronyms
    -# CET and MET:
    -#
    -# Zone CET  1:00 C-Eur CE%sT
    -# Zone MET  1:00 C-Eur ME%sT
    -#
    -# It this is right then the corrected version would look like:
    -#
    -# Rule C-Eur 1945 only - Sep 16  2:00s 0 -
    -#
    -# A small step for mankind though 8-)
    -Rule	C-Eur	1945	only	-	Sep	16	 2:00s	0	-
    -Rule	C-Eur	1977	1980	-	Apr	Sun>=1	 2:00s	1:00	S
    -Rule	C-Eur	1977	only	-	Sep	lastSun	 2:00s	0	-
    -Rule	C-Eur	1978	only	-	Oct	 1	 2:00s	0	-
    -Rule	C-Eur	1979	1995	-	Sep	lastSun	 2:00s	0	-
    -Rule	C-Eur	1981	max	-	Mar	lastSun	 2:00s	1:00	S
    -Rule	C-Eur	1996	max	-	Oct	lastSun	 2:00s	0	-
    -
    -# E-Eur differs from EU only in that E-Eur switches at midnight local time.
    -Rule	E-Eur	1977	1980	-	Apr	Sun>=1	 0:00	1:00	S
    -Rule	E-Eur	1977	only	-	Sep	lastSun	 0:00	0	-
    -Rule	E-Eur	1978	only	-	Oct	 1	 0:00	0	-
    -Rule	E-Eur	1979	1995	-	Sep	lastSun	 0:00	0	-
    -Rule	E-Eur	1981	max	-	Mar	lastSun	 0:00	1:00	S
    -Rule	E-Eur	1996	max	-	Oct	lastSun	 0:00	0	-
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Russia	1917	only	-	Jul	 1	23:00	1:00	MST  # Moscow Summer Time
    -Rule	Russia	1917	only	-	Dec	28	 0:00	0	MMT  # Moscow Mean Time
    -Rule	Russia	1918	only	-	May	31	22:00	2:00	MDST # Moscow Double Summer Time
    -Rule	Russia	1918	only	-	Sep	16	 1:00	1:00	MST
    -Rule	Russia	1919	only	-	May	31	23:00	2:00	MDST
    -Rule	Russia	1919	only	-	Jul	 1	 2:00	1:00	MSD
    -Rule	Russia	1919	only	-	Aug	16	 0:00	0	MSK
    -Rule	Russia	1921	only	-	Feb	14	23:00	1:00	MSD
    -Rule	Russia	1921	only	-	Mar	20	23:00	2:00	MSM  # Midsummer
    -Rule	Russia	1921	only	-	Sep	 1	 0:00	1:00	MSD
    -Rule	Russia	1921	only	-	Oct	 1	 0:00	0	-
    -# Act No. 925 of the Council of Ministers of the USSR (1980-10-24):
    -Rule	Russia	1981	1984	-	Apr	 1	 0:00	1:00	S
    -Rule	Russia	1981	1983	-	Oct	 1	 0:00	0	-
    -# Act No. 967 of the Council of Ministers of the USSR (1984-09-13), repeated in
    -# Act No. 227 of the Council of Ministers of the USSR (1989-03-14):
    -Rule	Russia	1984	1991	-	Sep	lastSun	 2:00s	0	-
    -Rule	Russia	1985	1991	-	Mar	lastSun	 2:00s	1:00	S
    -#
    -Rule	Russia	1992	only	-	Mar	lastSat	 23:00	1:00	S
    -Rule	Russia	1992	only	-	Sep	lastSat	 23:00	0	-
    -Rule	Russia	1993	2010	-	Mar	lastSun	 2:00s	1:00	S
    -Rule	Russia	1993	1995	-	Sep	lastSun	 2:00s	0	-
    -Rule	Russia	1996	2010	-	Oct	lastSun	 2:00s	0	-
    -# As described below, Russia's 2014 change affects Zone data, not Rule data.
    -
    -# From Alexander Krivenyshev (2011-06-14):
    -# According to Kremlin press service, Russian President Dmitry Medvedev
    -# signed a federal law "On calculation of time" on June 9, 2011.
    -# According to the law Russia is abolishing daylight saving time.
    -#
    -# Medvedev signed a law "On the Calculation of Time" (in russian):
    -# http://bmockbe.ru/events/?ID=7583
    -#
    -# Medvedev signed a law on the calculation of the time (in russian):
    -# http://www.regnum.ru/news/polit/1413906.html
    -
    -# From Arthur David Olson (2011-06-15):
    -# Take "abolishing daylight saving time" to mean that time is now considered
    -# to be standard.
    -
    -# These are for backward compatibility with older versions.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	WET		0:00	EU	WE%sT
    -Zone	CET		1:00	C-Eur	CE%sT
    -Zone	MET		1:00	C-Eur	ME%sT
    -Zone	EET		2:00	EU	EE%sT
    -
    -# Previous editions of this database used abbreviations like MET DST
    -# for Central European Summer Time, but this didn't agree with common usage.
    -
    -# From Markus Kuhn (1996-07-12):
    -# The official German names ... are
    -#
    -#	Mitteleuropäische Zeit (MEZ)         = UTC+01:00
    -#	Mitteleuropäische Sommerzeit (MESZ)  = UTC+02:00
    -#
    -# as defined in the German Time Act (Gesetz über die Zeitbestimmung (ZeitG),
    -# 1978-07-25, Bundesgesetzblatt, Jahrgang 1978, Teil I, S. 1110-1111)....
    -# I wrote ... to the German Federal Physical-Technical Institution
    -#
    -#	Physikalisch-Technische Bundesanstalt (PTB)
    -#	Laboratorium 4.41 "Zeiteinheit"
    -#	Postfach 3345
    -#	D-38023 Braunschweig
    -#	phone: +49 531 592-0
    -#
    -# ... I received today an answer letter from Dr. Peter Hetzel, head of the PTB
    -# department for time and frequency transmission.  He explained that the
    -# PTB translates MEZ and MESZ into English as
    -#
    -#	Central European Time (CET)         = UTC+01:00
    -#	Central European Summer Time (CEST) = UTC+02:00
    -
    -
    -# Albania
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Albania	1940	only	-	Jun	16	0:00	1:00	S
    -Rule	Albania	1942	only	-	Nov	 2	3:00	0	-
    -Rule	Albania	1943	only	-	Mar	29	2:00	1:00	S
    -Rule	Albania	1943	only	-	Apr	10	3:00	0	-
    -Rule	Albania	1974	only	-	May	 4	0:00	1:00	S
    -Rule	Albania	1974	only	-	Oct	 2	0:00	0	-
    -Rule	Albania	1975	only	-	May	 1	0:00	1:00	S
    -Rule	Albania	1975	only	-	Oct	 2	0:00	0	-
    -Rule	Albania	1976	only	-	May	 2	0:00	1:00	S
    -Rule	Albania	1976	only	-	Oct	 3	0:00	0	-
    -Rule	Albania	1977	only	-	May	 8	0:00	1:00	S
    -Rule	Albania	1977	only	-	Oct	 2	0:00	0	-
    -Rule	Albania	1978	only	-	May	 6	0:00	1:00	S
    -Rule	Albania	1978	only	-	Oct	 1	0:00	0	-
    -Rule	Albania	1979	only	-	May	 5	0:00	1:00	S
    -Rule	Albania	1979	only	-	Sep	30	0:00	0	-
    -Rule	Albania	1980	only	-	May	 3	0:00	1:00	S
    -Rule	Albania	1980	only	-	Oct	 4	0:00	0	-
    -Rule	Albania	1981	only	-	Apr	26	0:00	1:00	S
    -Rule	Albania	1981	only	-	Sep	27	0:00	0	-
    -Rule	Albania	1982	only	-	May	 2	0:00	1:00	S
    -Rule	Albania	1982	only	-	Oct	 3	0:00	0	-
    -Rule	Albania	1983	only	-	Apr	18	0:00	1:00	S
    -Rule	Albania	1983	only	-	Oct	 1	0:00	0	-
    -Rule	Albania	1984	only	-	Apr	 1	0:00	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Tirane	1:19:20 -	LMT	1914
    -			1:00	-	CET	1940 Jun 16
    -			1:00	Albania	CE%sT	1984 Jul
    -			1:00	EU	CE%sT
    -
    -# Andorra
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Andorra	0:06:04 -	LMT	1901
    -			0:00	-	WET	1946 Sep 30
    -			1:00	-	CET	1985 Mar 31  2:00
    -			1:00	EU	CE%sT
    -
    -# Austria
    -
    -# Milne says Vienna time was 1:05:21.
    -
    -# From Paul Eggert (2006-03-22): Shanks & Pottenger give 1918-06-16 and
    -# 1945-11-18, but the Austrian Federal Office of Metrology and
    -# Surveying (BEV) gives 1918-09-16 and for Vienna gives the "alleged"
    -# date of 1945-04-12 with no time.  For the 1980-04-06 transition
    -# Shanks & Pottenger give 02:00, the BEV 00:00.  Go with the BEV,
    -# and guess 02:00 for 1945-04-12.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Austria	1920	only	-	Apr	 5	2:00s	1:00	S
    -Rule	Austria	1920	only	-	Sep	13	2:00s	0	-
    -Rule	Austria	1946	only	-	Apr	14	2:00s	1:00	S
    -Rule	Austria	1946	1948	-	Oct	Sun>=1	2:00s	0	-
    -Rule	Austria	1947	only	-	Apr	 6	2:00s	1:00	S
    -Rule	Austria	1948	only	-	Apr	18	2:00s	1:00	S
    -Rule	Austria	1980	only	-	Apr	 6	0:00	1:00	S
    -Rule	Austria	1980	only	-	Sep	28	0:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Vienna	1:05:21 -	LMT	1893 Apr
    -			1:00	C-Eur	CE%sT	1920
    -			1:00	Austria	CE%sT	1940 Apr  1  2:00s
    -			1:00	C-Eur	CE%sT	1945 Apr  2  2:00s
    -			1:00	1:00	CEST	1945 Apr 12  2:00s
    -			1:00	-	CET	1946
    -			1:00	Austria	CE%sT	1981
    -			1:00	EU	CE%sT
    -
    -# Belarus
    -# From Yauhen Kharuzhy (2011-09-16):
    -# By latest Belarus government act Europe/Minsk timezone was changed to
    -# GMT+3 without DST (was GMT+2 with DST).
    -#
    -# Sources (Russian language):
    -# http://www.belta.by/ru/all_news/society/V-Belarusi-otmenjaetsja-perexod-na-sezonnoe-vremja_i_572952.html
    -# http://naviny.by/rubrics/society/2011/09/16/ic_articles_116_175144/
    -# http://news.tut.by/society/250578.html
    -#
    -# From Alexander Bokovoy (2014-10-09):
    -# Belarussian government decided against changing to winter time....
    -# http://eng.belta.by/all_news/society/Belarus-decides-against-adjusting-time-in-Russias-wake_i_76335.html
    -# From Paul Eggert (2014-10-08):
    -# Hence Belarus can share time zone abbreviations with Moscow again.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Minsk	1:50:16 -	LMT	1880
    -			1:50	-	MMT	1924 May  2 # Minsk Mean Time
    -			2:00	-	EET	1930 Jun 21
    -			3:00	-	MSK	1941 Jun 28
    -			1:00	C-Eur	CE%sT	1944 Jul  3
    -			3:00	Russia	MSK/MSD	1990
    -			3:00	-	MSK	1991 Mar 31  2:00s
    -			2:00	1:00	EEST	1991 Sep 29  2:00s
    -			2:00	-	EET	1992 Mar 29  0:00s
    -			2:00	1:00	EEST	1992 Sep 27  0:00s
    -			2:00	Russia	EE%sT	2011 Mar 27  2:00s
    -			3:00	-	FET	2014 Oct 26  1:00s
    -			3:00	-	MSK
    -
    -# Belgium
    -#
    -# From Paul Eggert (1997-07-02):
    -# Entries from 1918 through 1991 are taken from:
    -#	Annuaire de L'Observatoire Royal de Belgique,
    -#	Avenue Circulaire, 3, B-1180 BRUXELLES, CLVIIe année, 1991
    -#	(Imprimerie HAYEZ, s.p.r.l., Rue Fin, 4, 1080 BRUXELLES, MCMXC),
    -#	pp 8-9.
    -# LMT before 1892 was 0:17:30, according to the official journal of Belgium:
    -#	Moniteur Belge, Samedi 30 Avril 1892, N.121.
    -# Thanks to Pascal Delmoitie for these references.
    -# The 1918 rules are listed for completeness; they apply to unoccupied Belgium.
    -# Assume Brussels switched to WET in 1918 when the armistice took effect.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Belgium	1918	only	-	Mar	 9	 0:00s	1:00	S
    -Rule	Belgium	1918	1919	-	Oct	Sat>=1	23:00s	0	-
    -Rule	Belgium	1919	only	-	Mar	 1	23:00s	1:00	S
    -Rule	Belgium	1920	only	-	Feb	14	23:00s	1:00	S
    -Rule	Belgium	1920	only	-	Oct	23	23:00s	0	-
    -Rule	Belgium	1921	only	-	Mar	14	23:00s	1:00	S
    -Rule	Belgium	1921	only	-	Oct	25	23:00s	0	-
    -Rule	Belgium	1922	only	-	Mar	25	23:00s	1:00	S
    -Rule	Belgium	1922	1927	-	Oct	Sat>=1	23:00s	0	-
    -Rule	Belgium	1923	only	-	Apr	21	23:00s	1:00	S
    -Rule	Belgium	1924	only	-	Mar	29	23:00s	1:00	S
    -Rule	Belgium	1925	only	-	Apr	 4	23:00s	1:00	S
    -# DSH writes that a royal decree of 1926-02-22 specified the Sun following 3rd
    -# Sat in Apr (except if it's Easter, in which case it's one Sunday earlier),
    -# to Sun following 1st Sat in Oct, and that a royal decree of 1928-09-15
    -# changed the transition times to 02:00 GMT.
    -Rule	Belgium	1926	only	-	Apr	17	23:00s	1:00	S
    -Rule	Belgium	1927	only	-	Apr	 9	23:00s	1:00	S
    -Rule	Belgium	1928	only	-	Apr	14	23:00s	1:00	S
    -Rule	Belgium	1928	1938	-	Oct	Sun>=2	 2:00s	0	-
    -Rule	Belgium	1929	only	-	Apr	21	 2:00s	1:00	S
    -Rule	Belgium	1930	only	-	Apr	13	 2:00s	1:00	S
    -Rule	Belgium	1931	only	-	Apr	19	 2:00s	1:00	S
    -Rule	Belgium	1932	only	-	Apr	 3	 2:00s	1:00	S
    -Rule	Belgium	1933	only	-	Mar	26	 2:00s	1:00	S
    -Rule	Belgium	1934	only	-	Apr	 8	 2:00s	1:00	S
    -Rule	Belgium	1935	only	-	Mar	31	 2:00s	1:00	S
    -Rule	Belgium	1936	only	-	Apr	19	 2:00s	1:00	S
    -Rule	Belgium	1937	only	-	Apr	 4	 2:00s	1:00	S
    -Rule	Belgium	1938	only	-	Mar	27	 2:00s	1:00	S
    -Rule	Belgium	1939	only	-	Apr	16	 2:00s	1:00	S
    -Rule	Belgium	1939	only	-	Nov	19	 2:00s	0	-
    -Rule	Belgium	1940	only	-	Feb	25	 2:00s	1:00	S
    -Rule	Belgium	1944	only	-	Sep	17	 2:00s	0	-
    -Rule	Belgium	1945	only	-	Apr	 2	 2:00s	1:00	S
    -Rule	Belgium	1945	only	-	Sep	16	 2:00s	0	-
    -Rule	Belgium	1946	only	-	May	19	 2:00s	1:00	S
    -Rule	Belgium	1946	only	-	Oct	 7	 2:00s	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Brussels	0:17:30 -	LMT	1880
    -			0:17:30	-	BMT	1892 May  1 12:00  # Brussels MT
    -			0:00	-	WET	1914 Nov  8
    -			1:00	-	CET	1916 May  1  0:00
    -			1:00	C-Eur	CE%sT	1918 Nov 11 11:00u
    -			0:00	Belgium	WE%sT	1940 May 20  2:00s
    -			1:00	C-Eur	CE%sT	1944 Sep  3
    -			1:00	Belgium	CE%sT	1977
    -			1:00	EU	CE%sT
    -
    -# Bosnia and Herzegovina
    -# See Europe/Belgrade.
    -
    -# Bulgaria
    -#
    -# From Plamen Simenov via Steffen Thorsen (1999-09-09):
    -# A document of Government of Bulgaria (No. 94/1997) says:
    -# EET -> EETDST is in 03:00 Local time in last Sunday of March ...
    -# EETDST -> EET is in 04:00 Local time in last Sunday of October
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Bulg	1979	only	-	Mar	31	23:00	1:00	S
    -Rule	Bulg	1979	only	-	Oct	 1	 1:00	0	-
    -Rule	Bulg	1980	1982	-	Apr	Sat>=1	23:00	1:00	S
    -Rule	Bulg	1980	only	-	Sep	29	 1:00	0	-
    -Rule	Bulg	1981	only	-	Sep	27	 2:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Sofia	1:33:16 -	LMT	1880
    -			1:56:56	-	IMT	1894 Nov 30 # Istanbul MT?
    -			2:00	-	EET	1942 Nov  2  3:00
    -			1:00	C-Eur	CE%sT	1945
    -			1:00	-	CET	1945 Apr  2  3:00
    -			2:00	-	EET	1979 Mar 31 23:00
    -			2:00	Bulg	EE%sT	1982 Sep 26  3:00
    -			2:00	C-Eur	EE%sT	1991
    -			2:00	E-Eur	EE%sT	1997
    -			2:00	EU	EE%sT
    -
    -# Croatia
    -# See Europe/Belgrade.
    -
    -# Cyprus
    -# Please see the 'asia' file for Asia/Nicosia.
    -
    -# Czech Republic
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Czech	1945	only	-	Apr	 8	2:00s	1:00	S
    -Rule	Czech	1945	only	-	Nov	18	2:00s	0	-
    -Rule	Czech	1946	only	-	May	 6	2:00s	1:00	S
    -Rule	Czech	1946	1949	-	Oct	Sun>=1	2:00s	0	-
    -Rule	Czech	1947	only	-	Apr	20	2:00s	1:00	S
    -Rule	Czech	1948	only	-	Apr	18	2:00s	1:00	S
    -Rule	Czech	1949	only	-	Apr	 9	2:00s	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Prague	0:57:44 -	LMT	1850
    -			0:57:44	-	PMT	1891 Oct    # Prague Mean Time
    -			1:00	C-Eur	CE%sT	1944 Sep 17  2:00s
    -			1:00	Czech	CE%sT	1979
    -			1:00	EU	CE%sT
    -# Use Europe/Prague also for Slovakia.
    -
    -# Denmark, Faroe Islands, and Greenland
    -
    -# From Jesper Nørgaard Welen (2005-04-26):
    -# http://www.hum.aau.dk/~poe/tid/tine/DanskTid.htm says that the law
    -# [introducing standard time] was in effect from 1894-01-01....
    -# The page http://www.retsinfo.dk/_GETDOCI_/ACCN/A18930008330-REGL
    -# confirms this, and states that the law was put forth 1893-03-29.
    -#
    -# The EU treaty with effect from 1973:
    -# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19722110030-REGL
    -#
    -# This provoked a new law from 1974 to make possible summer time changes
    -# in subsequent decrees with the law
    -# http://www.retsinfo.dk/_GETDOCI_/ACCN/A19740022330-REGL
    -#
    -# It seems however that no decree was set forward until 1980.  I have
    -# not found any decree, but in another related law, the effecting DST
    -# changes are stated explicitly to be from 1980-04-06 at 02:00 to
    -# 1980-09-28 at 02:00.  If this is true, this differs slightly from
    -# the EU rule in that DST runs to 02:00, not 03:00.  We don't know
    -# when Denmark began using the EU rule correctly, but we have only
    -# confirmation of the 1980-time, so I presume it was correct in 1981:
    -# The law is about the management of the extra hour, concerning
    -# working hours reported and effect on obligatory-rest rules (which
    -# was suspended on that night):
    -# http://www.retsinfo.dk/_GETDOCI_/ACCN/C19801120554-REGL
    -
    -# From Jesper Nørgaard Welen (2005-06-11):
    -# The Herning Folkeblad (1980-09-26) reported that the night between
    -# Saturday and Sunday the clock is set back from three to two.
    -
    -# From Paul Eggert (2005-06-11):
    -# Hence the "02:00" of the 1980 law refers to standard time, not
    -# wall-clock time, and so the EU rules were in effect in 1980.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Denmark	1916	only	-	May	14	23:00	1:00	S
    -Rule	Denmark	1916	only	-	Sep	30	23:00	0	-
    -Rule	Denmark	1940	only	-	May	15	 0:00	1:00	S
    -Rule	Denmark	1945	only	-	Apr	 2	 2:00s	1:00	S
    -Rule	Denmark	1945	only	-	Aug	15	 2:00s	0	-
    -Rule	Denmark	1946	only	-	May	 1	 2:00s	1:00	S
    -Rule	Denmark	1946	only	-	Sep	 1	 2:00s	0	-
    -Rule	Denmark	1947	only	-	May	 4	 2:00s	1:00	S
    -Rule	Denmark	1947	only	-	Aug	10	 2:00s	0	-
    -Rule	Denmark	1948	only	-	May	 9	 2:00s	1:00	S
    -Rule	Denmark	1948	only	-	Aug	 8	 2:00s	0	-
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Europe/Copenhagen	 0:50:20 -	LMT	1890
    -			 0:50:20 -	CMT	1894 Jan  1 # Copenhagen MT
    -			 1:00	Denmark	CE%sT	1942 Nov  2  2:00s
    -			 1:00	C-Eur	CE%sT	1945 Apr  2  2:00
    -			 1:00	Denmark	CE%sT	1980
    -			 1:00	EU	CE%sT
    -Zone Atlantic/Faroe	-0:27:04 -	LMT	1908 Jan 11 # Tórshavn
    -			 0:00	-	WET	1981
    -			 0:00	EU	WE%sT
    -#
    -# From Paul Eggert (2004-10-31):
    -# During World War II, Germany maintained secret manned weather stations in
    -# East Greenland and Franz Josef Land, but we don't know their time zones.
    -# My source for this is Wilhelm Dege's book mentioned under Svalbard.
    -#
    -# From Paul Eggert (2006-03-22):
    -# Greenland joined the EU as part of Denmark, obtained home rule on 1979-05-01,
    -# and left the EU on 1985-02-01.  It therefore should have been using EU
    -# rules at least through 1984.  Shanks & Pottenger say Scoresbysund and Godthåb
    -# used C-Eur rules after 1980, but IATA SSIM (1991/1996) says they use EU
    -# rules since at least 1991.  Assume EU rules since 1980.
    -
    -# From Gwillim Law (2001-06-06), citing
    -#  (2001-03-15),
    -# and with translations corrected by Steffen Thorsen:
    -#
    -# Greenland has four local times, and the relation to UTC
    -# is according to the following time line:
    -#
    -# The military zone near Thule	UTC-4
    -# Standard Greenland time	UTC-3
    -# Scoresbysund			UTC-1
    -# Danmarkshavn			UTC
    -#
    -# In the military area near Thule and in Danmarkshavn DST will not be
    -# introduced.
    -
    -# From Rives McDow (2001-11-01):
    -#
    -# I correspond regularly with the Dansk Polarcenter, and wrote them at
    -# the time to clarify the situation in Thule.  Unfortunately, I have
    -# not heard back from them regarding my recent letter.  [But I have
    -# info from earlier correspondence.]
    -#
    -# According to the center, a very small local time zone around Thule
    -# Air Base keeps the time according to UTC-4, implementing daylight
    -# savings using North America rules, changing the time at 02:00 local time....
    -#
    -# The east coast of Greenland north of the community of Scoresbysund
    -# uses UTC in the same way as in Iceland, year round, with no dst.
    -# There are just a few stations on this coast, including the
    -# Danmarkshavn ICAO weather station mentioned in your September 29th
    -# email.  The other stations are two sledge patrol stations in
    -# Mestersvig and Daneborg, the air force base at Station Nord, and the
    -# DPC research station at Zackenberg.
    -#
    -# Scoresbysund and two small villages nearby keep time UTC-1 and use
    -# the same daylight savings time period as in West Greenland (Godthåb).
    -#
    -# The rest of Greenland, including Godthåb (this area, although it
    -# includes central Greenland, is known as west Greenland), keeps time
    -# UTC-3, with daylight savings methods according to European rules.
    -#
    -# It is common procedure to use UTC 0 in the wilderness of East and
    -# North Greenland, because it is mainly Icelandic aircraft operators
    -# maintaining traffic in these areas.  However, the official status of
    -# this area is that it sticks with Godthåb time.  This area might be
    -# considered a dual time zone in some respects because of this.
    -
    -# From Rives McDow (2001-11-19):
    -# I heard back from someone stationed at Thule; the time change took place
    -# there at 2:00 AM.
    -
    -# From Paul Eggert (2006-03-22):
    -# From 1997 on the CIA map shows Danmarkshavn on GMT;
    -# the 1995 map as like Godthåb.
    -# For lack of better info, assume they were like Godthåb before 1996.
    -# startkart.no says Thule does not observe DST, but this is clearly an error,
    -# so go with Shanks & Pottenger for Thule transitions until this year.
    -# For 2007 on assume Thule will stay in sync with US DST rules.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Thule	1991	1992	-	Mar	lastSun	2:00	1:00	D
    -Rule	Thule	1991	1992	-	Sep	lastSun	2:00	0	S
    -Rule	Thule	1993	2006	-	Apr	Sun>=1	2:00	1:00	D
    -Rule	Thule	1993	2006	-	Oct	lastSun	2:00	0	S
    -Rule	Thule	2007	max	-	Mar	Sun>=8	2:00	1:00	D
    -Rule	Thule	2007	max	-	Nov	Sun>=1	2:00	0	S
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Danmarkshavn -1:14:40 -	LMT	1916 Jul 28
    -			-3:00	-	WGT	1980 Apr  6  2:00
    -			-3:00	EU	WG%sT	1996
    -			0:00	-	GMT
    -Zone America/Scoresbysund -1:27:52 -	LMT	1916 Jul 28 # Ittoqqortoormiit
    -			-2:00	-	CGT	1980 Apr  6  2:00
    -			-2:00	C-Eur	CG%sT	1981 Mar 29
    -			-1:00	EU	EG%sT
    -Zone America/Godthab	-3:26:56 -	LMT	1916 Jul 28 # Nuuk
    -			-3:00	-	WGT	1980 Apr  6  2:00
    -			-3:00	EU	WG%sT
    -Zone America/Thule	-4:35:08 -	LMT	1916 Jul 28 # Pituffik air base
    -			-4:00	Thule	A%sT
    -
    -# Estonia
    -# From Peter Ilieve (1994-10-15):
    -# A relative in Tallinn confirms the accuracy of the data for 1989 onwards
    -# [through 1994] and gives the legal authority for it,
    -# a regulation of the Government of Estonia, No. 111 of 1989....
    -#
    -# From Peter Ilieve (1996-10-28):
    -# [IATA SSIM (1992/1996) claims that the Baltic republics switch at 01:00s,
    -# but a relative confirms that Estonia still switches at 02:00s, writing:]
    -# "I do not [know] exactly but there are some little different
    -# (confusing) rules for International Air and Railway Transport Schedules
    -# conversion in Sunday connected with end of summer time in Estonia....
    -# A discussion is running about the summer time efficiency and effect on
    -# human physiology.  It seems that Estonia maybe will not change to
    -# summer time next spring."
    -
    -# From Peter Ilieve (1998-11-04), heavily edited:
    -# The 1998-09-22 Estonian time law
    -# http://trip.rk.ee/cgi-bin/thw?${BASE}=akt&${OOHTML}=rtd&TA=1998&TO=1&AN=1390
    -# refers to the Eighth Directive and cites the association agreement between
    -# the EU and Estonia, ratified by the Estonian law (RT II 1995, 22-27, 120).
    -#
    -# I also asked [my relative] whether they use any standard abbreviation
    -# for their standard and summer times. He says no, they use "suveaeg"
    -# (summer time) and "talveaeg" (winter time).
    -
    -# From The Baltic Times  (1999-09-09)
    -# via Steffen Thorsen:
    -# This year will mark the last time Estonia shifts to summer time,
    -# a council of the ruling coalition announced Sept. 6....
    -# But what this could mean for Estonia's chances of joining the European
    -# Union are still unclear.  In 1994, the EU declared summer time compulsory
    -# for all member states until 2001.  Brussels has yet to decide what to do
    -# after that.
    -
    -# From Mart Oruaas (2000-01-29):
    -# Regulation No. 301 (1999-10-12) obsoletes previous regulation
    -# No. 206 (1998-09-22) and thus sticks Estonia to +02:00 GMT for all
    -# the year round.  The regulation is effective 1999-11-01.
    -
    -# From Toomas Soome (2002-02-21):
    -# The Estonian government has changed once again timezone politics.
    -# Now we are using again EU rules.
    -#
    -# From Urmet Jänes (2002-03-28):
    -# The legislative reference is Government decree No. 84 on 2002-02-21.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Tallinn	1:39:00	-	LMT	1880
    -			1:39:00	-	TMT	1918 Feb    # Tallinn Mean Time
    -			1:00	C-Eur	CE%sT	1919 Jul
    -			1:39:00	-	TMT	1921 May
    -			2:00	-	EET	1940 Aug  6
    -			3:00	-	MSK	1941 Sep 15
    -			1:00	C-Eur	CE%sT	1944 Sep 22
    -			3:00	Russia	MSK/MSD	1989 Mar 26  2:00s
    -			2:00	1:00	EEST	1989 Sep 24  2:00s
    -			2:00	C-Eur	EE%sT	1998 Sep 22
    -			2:00	EU	EE%sT	1999 Oct 31  4:00
    -			2:00	-	EET	2002 Feb 21
    -			2:00	EU	EE%sT
    -
    -# Finland
    -
    -# From Hannu Strang (1994-09-25 06:03:37 UTC):
    -# Well, here in Helsinki we're just changing from summer time to regular one,
    -# and it's supposed to change at 4am...
    -
    -# From Janne Snabb (2010-07-15):
    -#
    -# I noticed that the Finland data is not accurate for years 1981 and 1982.
    -# During these two first trial years the DST adjustment was made one hour
    -# earlier than in forthcoming years. Starting 1983 the adjustment was made
    -# according to the central European standards.
    -#
    -# This is documented in Heikki Oja: Aikakirja 2007, published by The Almanac
    -# Office of University of Helsinki, ISBN 952-10-3221-9, available online (in
    -# Finnish) at
    -# http://almanakka.helsinki.fi/aikakirja/Aikakirja2007kokonaan.pdf
    -#
    -# Page 105 (56 in PDF version) has a handy table of all past daylight savings
    -# transitions. It is easy enough to interpret without Finnish skills.
    -#
    -# This is also confirmed by Finnish Broadcasting Company's archive at:
    -# http://www.yle.fi/elavaarkisto/?s=s&g=1&ag=5&t=&a=3401
    -#
    -# The news clip from 1981 says that "the time between 2 and 3 o'clock does not
    -# exist tonight."
    -
    -# From Konstantin Hyppönen (2014-06-13):
    -# [Heikki Oja's book Aikakirja 2013]
    -# http://almanakka.helsinki.fi/images/aikakirja/Aikakirja2013kokonaan.pdf
    -# pages 104-105, including a scan from a newspaper published on Apr 2 1942
    -# say that ... [o]n Apr 2 1942, 24 o'clock (which means Apr 3 1942,
    -# 00:00), clocks were moved one hour forward. The newspaper
    -# mentions "on the night from Thursday to Friday"....
    -# On Oct 4 1942, clocks were moved at 1:00 one hour backwards.
    -#
    -# From Paul Eggert (2014-06-14):
    -# Go with Oja over Shanks.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Finland	1942	only	-	Apr	2	24:00	1:00	S
    -Rule	Finland	1942	only	-	Oct	4	1:00	0	-
    -Rule	Finland	1981	1982	-	Mar	lastSun	2:00	1:00	S
    -Rule	Finland	1981	1982	-	Sep	lastSun	3:00	0	-
    -
    -# Milne says Helsinki (Helsingfors) time was 1:39:49.2 (official document);
    -# round to nearest.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Helsinki	1:39:49 -	LMT	1878 May 31
    -			1:39:49	-	HMT	1921 May    # Helsinki Mean Time
    -			2:00	Finland	EE%sT	1983
    -			2:00	EU	EE%sT
    -
    -# Ã…land Is
    -Link	Europe/Helsinki	Europe/Mariehamn
    -
    -
    -# France
    -
    -# From Ciro Discepolo (2000-12-20):
    -#
    -# Henri Le Corre, Régimes horaires pour le monde entier, Éditions
    -# Traditionnelles - Paris 2 books, 1993
    -#
    -# Gabriel, Traité de l'heure dans le monde, Guy Trédaniel,
    -# Paris, 1991
    -#
    -# Françoise Gauquelin, Problèmes de l'heure résolus en astrologie,
    -# Guy Trédaniel, Paris 1987
    -
    -
    -#
    -# Shank & Pottenger seem to use '24:00' ambiguously; resolve it with Whitman.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	France	1916	only	-	Jun	14	23:00s	1:00	S
    -Rule	France	1916	1919	-	Oct	Sun>=1	23:00s	0	-
    -Rule	France	1917	only	-	Mar	24	23:00s	1:00	S
    -Rule	France	1918	only	-	Mar	 9	23:00s	1:00	S
    -Rule	France	1919	only	-	Mar	 1	23:00s	1:00	S
    -Rule	France	1920	only	-	Feb	14	23:00s	1:00	S
    -Rule	France	1920	only	-	Oct	23	23:00s	0	-
    -Rule	France	1921	only	-	Mar	14	23:00s	1:00	S
    -Rule	France	1921	only	-	Oct	25	23:00s	0	-
    -Rule	France	1922	only	-	Mar	25	23:00s	1:00	S
    -# DSH writes that a law of 1923-05-24 specified 3rd Sat in Apr at 23:00 to 1st
    -# Sat in Oct at 24:00; and that in 1930, because of Easter, the transitions
    -# were Apr 12 and Oct 5.  Go with Shanks & Pottenger.
    -Rule	France	1922	1938	-	Oct	Sat>=1	23:00s	0	-
    -Rule	France	1923	only	-	May	26	23:00s	1:00	S
    -Rule	France	1924	only	-	Mar	29	23:00s	1:00	S
    -Rule	France	1925	only	-	Apr	 4	23:00s	1:00	S
    -Rule	France	1926	only	-	Apr	17	23:00s	1:00	S
    -Rule	France	1927	only	-	Apr	 9	23:00s	1:00	S
    -Rule	France	1928	only	-	Apr	14	23:00s	1:00	S
    -Rule	France	1929	only	-	Apr	20	23:00s	1:00	S
    -Rule	France	1930	only	-	Apr	12	23:00s	1:00	S
    -Rule	France	1931	only	-	Apr	18	23:00s	1:00	S
    -Rule	France	1932	only	-	Apr	 2	23:00s	1:00	S
    -Rule	France	1933	only	-	Mar	25	23:00s	1:00	S
    -Rule	France	1934	only	-	Apr	 7	23:00s	1:00	S
    -Rule	France	1935	only	-	Mar	30	23:00s	1:00	S
    -Rule	France	1936	only	-	Apr	18	23:00s	1:00	S
    -Rule	France	1937	only	-	Apr	 3	23:00s	1:00	S
    -Rule	France	1938	only	-	Mar	26	23:00s	1:00	S
    -Rule	France	1939	only	-	Apr	15	23:00s	1:00	S
    -Rule	France	1939	only	-	Nov	18	23:00s	0	-
    -Rule	France	1940	only	-	Feb	25	 2:00	1:00	S
    -# The French rules for 1941-1944 were not used in Paris, but Shanks & Pottenger
    -# write that they were used in Monaco and in many French locations.
    -# Le Corre writes that the upper limit of the free zone was Arnéguy, Orthez,
    -# Mont-de-Marsan, Bazas, Langon, Lamothe-Montravel, Marœuil, La
    -# Rochefoucauld, Champagne-Mouton, La Roche-Posay, La Haye-Descartes,
    -# Loches, Montrichard, Vierzon, Bourges, Moulins, Digoin,
    -# Paray-le-Monial, Montceau-les-Mines, Chalon-sur-Saône, Arbois,
    -# Dole, Morez, St-Claude, and Collonges (Haute-Savoie).
    -Rule	France	1941	only	-	May	 5	 0:00	2:00	M # Midsummer
    -# Shanks & Pottenger say this transition occurred at Oct 6 1:00,
    -# but go with Denis Excoffier (1997-12-12),
    -# who quotes the Ephémérides astronomiques for 1998 from Bureau des Longitudes
    -# as saying 5/10/41 22hUT.
    -Rule	France	1941	only	-	Oct	 6	 0:00	1:00	S
    -Rule	France	1942	only	-	Mar	 9	 0:00	2:00	M
    -Rule	France	1942	only	-	Nov	 2	 3:00	1:00	S
    -Rule	France	1943	only	-	Mar	29	 2:00	2:00	M
    -Rule	France	1943	only	-	Oct	 4	 3:00	1:00	S
    -Rule	France	1944	only	-	Apr	 3	 2:00	2:00	M
    -Rule	France	1944	only	-	Oct	 8	 1:00	1:00	S
    -Rule	France	1945	only	-	Apr	 2	 2:00	2:00	M
    -Rule	France	1945	only	-	Sep	16	 3:00	0	-
    -# Shanks & Pottenger give Mar 28 2:00 and Sep 26 3:00;
    -# go with Excoffier's 28/3/76 0hUT and 25/9/76 23hUT.
    -Rule	France	1976	only	-	Mar	28	 1:00	1:00	S
    -Rule	France	1976	only	-	Sep	26	 1:00	0	-
    -# Shanks & Pottenger give 0:09:20 for Paris Mean Time, and Whitman 0:09:05,
    -# but Howse quotes the actual French legislation as saying 0:09:21.
    -# Go with Howse.  Howse writes that the time in France was officially based
    -# on PMT-0:09:21 until 1978-08-09, when the time base finally switched to UTC.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Paris	0:09:21 -	LMT	1891 Mar 15  0:01
    -			0:09:21	-	PMT	1911 Mar 11  0:01 # Paris MT
    -# Shanks & Pottenger give 1940 Jun 14 0:00; go with Excoffier and Le Corre.
    -			0:00	France	WE%sT	1940 Jun 14 23:00
    -# Le Corre says Paris stuck with occupied-France time after the liberation;
    -# go with Shanks & Pottenger.
    -			1:00	C-Eur	CE%sT	1944 Aug 25
    -			0:00	France	WE%sT	1945 Sep 16  3:00
    -			1:00	France	CE%sT	1977
    -			1:00	EU	CE%sT
    -
    -# Germany
    -
    -# From Markus Kuhn (1998-09-29):
    -# The German time zone web site by the Physikalisch-Technische
    -# Bundesanstalt contains DST information back to 1916.
    -# [See tz-link.htm for the URL.]
    -
    -# From Jörg Schilling (2002-10-23):
    -# In 1945, Berlin was switched to Moscow Summer time (GMT+4) by
    -# http://www.dhm.de/lemo/html/biografien/BersarinNikolai/
    -# General [Nikolai] Bersarin.
    -
    -# From Paul Eggert (2003-03-08):
    -# http://www.parlament-berlin.de/pds-fraktion.nsf/727459127c8b66ee8525662300459099/defc77cb784f180ac1256c2b0030274b/$FILE/bersarint.pdf
    -# says that Bersarin issued an order to use Moscow time on May 20.
    -# However, Moscow did not observe daylight saving in 1945, so
    -# this was equivalent to CEMT (GMT+3), not GMT+4.
    -
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Germany	1946	only	-	Apr	14	2:00s	1:00	S
    -Rule	Germany	1946	only	-	Oct	 7	2:00s	0	-
    -Rule	Germany	1947	1949	-	Oct	Sun>=1	2:00s	0	-
    -# http://www.ptb.de/de/org/4/44/441/salt.htm says the following transition
    -# occurred at 3:00 MEZ, not the 2:00 MEZ given in Shanks & Pottenger.
    -# Go with the PTB.
    -Rule	Germany	1947	only	-	Apr	 6	3:00s	1:00	S
    -Rule	Germany	1947	only	-	May	11	2:00s	2:00	M
    -Rule	Germany	1947	only	-	Jun	29	3:00	1:00	S
    -Rule	Germany	1948	only	-	Apr	18	2:00s	1:00	S
    -Rule	Germany	1949	only	-	Apr	10	2:00s	1:00	S
    -
    -Rule SovietZone	1945	only	-	May	24	2:00	2:00	M # Midsummer
    -Rule SovietZone	1945	only	-	Sep	24	3:00	1:00	S
    -Rule SovietZone	1945	only	-	Nov	18	2:00s	0	-
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Berlin	0:53:28 -	LMT	1893 Apr
    -			1:00	C-Eur	CE%sT	1945 May 24  2:00
    -			1:00 SovietZone	CE%sT	1946
    -			1:00	Germany	CE%sT	1980
    -			1:00	EU	CE%sT
    -
    -# From Tobias Conradi (2011-09-12):
    -# Büsingen , surrounded by the Swiss canton
    -# Schaffhausen, did not start observing DST in 1980 as the rest of DE
    -# (West Germany at that time) and DD (East Germany at that time) did.
    -# DD merged into DE, the area is currently covered by code DE in ISO 3166-1,
    -# which in turn is covered by the zone Europe/Berlin.
    -#
    -# Source for the time in Büsingen 1980:
    -# http://www.srf.ch/player/video?id=c012c029-03b7-4c2b-9164-aa5902cd58d3
    -
    -# From Arthur David Olson (2012-03-03):
    -# Büsingen and Zurich have shared clocks since 1970.
    -
    -Link	Europe/Zurich	Europe/Busingen
    -
    -# Georgia
    -# Please see the "asia" file for Asia/Tbilisi.
    -# Herodotus (Histories, IV.45) says Georgia north of the Phasis (now Rioni)
    -# is in Europe.  Our reference location Tbilisi is in the Asian part.
    -
    -# Gibraltar
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Europe/Gibraltar	-0:21:24 -	LMT	1880 Aug  2  0:00s
    -			0:00	GB-Eire	%s	1957 Apr 14  2:00
    -			1:00	-	CET	1982
    -			1:00	EU	CE%sT
    -
    -# Greece
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -# Whitman gives 1932 Jul 5 - Nov 1; go with Shanks & Pottenger.
    -Rule	Greece	1932	only	-	Jul	 7	0:00	1:00	S
    -Rule	Greece	1932	only	-	Sep	 1	0:00	0	-
    -# Whitman gives 1941 Apr 25 - ?; go with Shanks & Pottenger.
    -Rule	Greece	1941	only	-	Apr	 7	0:00	1:00	S
    -# Whitman gives 1942 Feb 2 - ?; go with Shanks & Pottenger.
    -Rule	Greece	1942	only	-	Nov	 2	3:00	0	-
    -Rule	Greece	1943	only	-	Mar	30	0:00	1:00	S
    -Rule	Greece	1943	only	-	Oct	 4	0:00	0	-
    -# Whitman gives 1944 Oct 3 - Oct 31; go with Shanks & Pottenger.
    -Rule	Greece	1952	only	-	Jul	 1	0:00	1:00	S
    -Rule	Greece	1952	only	-	Nov	 2	0:00	0	-
    -Rule	Greece	1975	only	-	Apr	12	0:00s	1:00	S
    -Rule	Greece	1975	only	-	Nov	26	0:00s	0	-
    -Rule	Greece	1976	only	-	Apr	11	2:00s	1:00	S
    -Rule	Greece	1976	only	-	Oct	10	2:00s	0	-
    -Rule	Greece	1977	1978	-	Apr	Sun>=1	2:00s	1:00	S
    -Rule	Greece	1977	only	-	Sep	26	2:00s	0	-
    -Rule	Greece	1978	only	-	Sep	24	4:00	0	-
    -Rule	Greece	1979	only	-	Apr	 1	9:00	1:00	S
    -Rule	Greece	1979	only	-	Sep	29	2:00	0	-
    -Rule	Greece	1980	only	-	Apr	 1	0:00	1:00	S
    -Rule	Greece	1980	only	-	Sep	28	0:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Athens	1:34:52 -	LMT	1895 Sep 14
    -			1:34:52	-	AMT	1916 Jul 28  0:01 # Athens MT
    -			2:00	Greece	EE%sT	1941 Apr 30
    -			1:00	Greece	CE%sT	1944 Apr  4
    -			2:00	Greece	EE%sT	1981
    -			# Shanks & Pottenger say it switched to C-Eur in 1981;
    -			# go with EU instead, since Greece joined it on Jan 1.
    -			2:00	EU	EE%sT
    -
    -# Hungary
    -# From Paul Eggert (2014-07-15):
    -# Dates for 1916-1945 are taken from:
    -# Oross A. Jelen a múlt jövője: a nyári időszámítás Magyarországon 1916-1945.
    -# National Archives of Hungary (2012-10-29).
    -# http://mnl.gov.hu/a_het_dokumentuma/a_nyari_idoszamitas_magyarorszagon_19161945.html
    -# This source does not always give times, which are taken from Shanks
    -# & Pottenger (which disagree about the dates).
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Hungary	1918	only	-	Apr	 1	 3:00	1:00	S
    -Rule	Hungary	1918	only	-	Sep	16	 3:00	0	-
    -Rule	Hungary	1919	only	-	Apr	15	 3:00	1:00	S
    -Rule	Hungary	1919	only	-	Nov	24	 3:00	0	-
    -Rule	Hungary	1945	only	-	May	 1	23:00	1:00	S
    -Rule	Hungary	1945	only	-	Nov	 1	 0:00	0	-
    -Rule	Hungary	1946	only	-	Mar	31	 2:00s	1:00	S
    -Rule	Hungary	1946	1949	-	Oct	Sun>=1	 2:00s	0	-
    -Rule	Hungary	1947	1949	-	Apr	Sun>=4	 2:00s	1:00	S
    -Rule	Hungary	1950	only	-	Apr	17	 2:00s	1:00	S
    -Rule	Hungary	1950	only	-	Oct	23	 2:00s	0	-
    -Rule	Hungary	1954	1955	-	May	23	 0:00	1:00	S
    -Rule	Hungary	1954	1955	-	Oct	 3	 0:00	0	-
    -Rule	Hungary	1956	only	-	Jun	Sun>=1	 0:00	1:00	S
    -Rule	Hungary	1956	only	-	Sep	lastSun	 0:00	0	-
    -Rule	Hungary	1957	only	-	Jun	Sun>=1	 1:00	1:00	S
    -Rule	Hungary	1957	only	-	Sep	lastSun	 3:00	0	-
    -Rule	Hungary	1980	only	-	Apr	 6	 1:00	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Budapest	1:16:20 -	LMT	1890 Oct
    -			1:00	C-Eur	CE%sT	1918
    -			1:00	Hungary	CE%sT	1941 Apr  8
    -			1:00	C-Eur	CE%sT	1945
    -			1:00	Hungary	CE%sT	1980 Sep 28  2:00s
    -			1:00	EU	CE%sT
    -
    -# Iceland
    -#
    -# From Adam David (1993-11-06):
    -# The name of the timezone in Iceland for system / mail / news purposes is GMT.
    -#
    -# (1993-12-05):
    -# This material is paraphrased from the 1988 edition of the University of
    -# Iceland Almanak.
    -#
    -# From January 1st, 1908 the whole of Iceland was standardised at 1 hour
    -# behind GMT. Previously, local mean solar time was used in different parts
    -# of Iceland, the almanak had been based on Reykjavik mean solar time which
    -# was 1 hour and 28 minutes behind GMT.
    -#
    -# "first day of winter" referred to [below] means the first day of the 26 weeks
    -# of winter, according to the old icelandic calendar that dates back to the
    -# time the norsemen first settled Iceland.  The first day of winter is always
    -# Saturday, but is not dependent on the Julian or Gregorian calendars.
    -#
    -# (1993-12-10):
    -# I have a reference from the Oxford Icelandic-English dictionary for the
    -# beginning of winter, which ties it to the ecclesiastical calendar (and thus
    -# to the julian/gregorian calendar) over the period in question.
    -#	the winter begins on the Saturday next before St. Luke's day
    -#	(old style), or on St. Luke's day, if a Saturday.
    -# St. Luke's day ought to be traceable from ecclesiastical sources. "old style"
    -# might be a reference to the Julian calendar as opposed to Gregorian, or it
    -# might mean something else (???).
    -#
    -# From Paul Eggert (2014-11-22):
    -# The information below is taken from the 1988 Almanak; see
    -# http://www.almanak.hi.is/klukkan.html
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Iceland	1917	1919	-	Feb	19	23:00	1:00	S
    -Rule	Iceland	1917	only	-	Oct	21	 1:00	0	-
    -Rule	Iceland	1918	1919	-	Nov	16	 1:00	0	-
    -Rule	Iceland	1921	only	-	Mar	19	23:00	1:00	S
    -Rule	Iceland	1921	only	-	Jun	23	 1:00	0	-
    -Rule	Iceland	1939	only	-	Apr	29	23:00	1:00	S
    -Rule	Iceland	1939	only	-	Oct	29	 2:00	0	-
    -Rule	Iceland	1940	only	-	Feb	25	 2:00	1:00	S
    -Rule	Iceland	1940	1941	-	Nov	Sun>=2	 1:00s	0	-
    -Rule	Iceland	1941	1942	-	Mar	Sun>=2	 1:00s	1:00	S
    -# 1943-1946 - first Sunday in March until first Sunday in winter
    -Rule	Iceland	1943	1946	-	Mar	Sun>=1	 1:00s	1:00	S
    -Rule	Iceland	1942	1948	-	Oct	Sun>=22	 1:00s	0	-
    -# 1947-1967 - first Sunday in April until first Sunday in winter
    -Rule	Iceland	1947	1967	-	Apr	Sun>=1	 1:00s	1:00	S
    -# 1949 and 1967 Oct transitions delayed by 1 week
    -Rule	Iceland	1949	only	-	Oct	30	 1:00s	0	-
    -Rule	Iceland	1950	1966	-	Oct	Sun>=22	 1:00s	0	-
    -Rule	Iceland	1967	only	-	Oct	29	 1:00s	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Atlantic/Reykjavik	-1:28	-	LMT	1908
    -			-1:00	Iceland	IS%sT	1968 Apr  7  1:00s
    -			 0:00	-	GMT
    -
    -# Italy
    -#
    -# From Paul Eggert (2001-03-06):
    -# Sicily and Sardinia each had their own time zones from 1866 to 1893,
    -# called Palermo Time (+00:53:28) and Cagliari Time (+00:36:32).
    -# During World War II, German-controlled Italy used German time.
    -# But these events all occurred before the 1970 cutoff,
    -# so record only the time in Rome.
    -#
    -# From Paul Eggert (2006-03-22):
    -# For Italian DST we have three sources: Shanks & Pottenger, Whitman, and
    -# F. Pollastri
    -# Day-light Saving Time in Italy (2006-02-03)
    -# http://toi.iriti.cnr.it/uk/ienitlt.html
    -# ('FP' below), taken from an Italian National Electrotechnical Institute
    -# publication. When the three sources disagree, guess who's right, as follows:
    -#
    -# year	FP	Shanks&P. (S)	Whitman (W)	Go with:
    -# 1916	06-03	06-03 24:00	06-03 00:00	FP & W
    -#	09-30	09-30 24:00	09-30 01:00	FP; guess 24:00s
    -# 1917	04-01	03-31 24:00	03-31 00:00	FP & S
    -#	09-30	09-29 24:00	09-30 01:00	FP & W
    -# 1918	03-09	03-09 24:00	03-09 00:00	FP & S
    -#	10-06	10-05 24:00	10-06 01:00	FP & W
    -# 1919	03-01	03-01 24:00	03-01 00:00	FP & S
    -#	10-04	10-04 24:00	10-04 01:00	FP; guess 24:00s
    -# 1920	03-20	03-20 24:00	03-20 00:00	FP & S
    -#	09-18	09-18 24:00	10-01 01:00	FP; guess 24:00s
    -# 1944	04-02	04-03 02:00			S (see C-Eur)
    -#	09-16	10-02 03:00			FP; guess 24:00s
    -# 1945	09-14	09-16 24:00			FP; guess 24:00s
    -# 1970	05-21	05-31 00:00			S
    -#	09-20	09-27 00:00			S
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Italy	1916	only	-	Jun	 3	0:00s	1:00	S
    -Rule	Italy	1916	only	-	Oct	 1	0:00s	0	-
    -Rule	Italy	1917	only	-	Apr	 1	0:00s	1:00	S
    -Rule	Italy	1917	only	-	Sep	30	0:00s	0	-
    -Rule	Italy	1918	only	-	Mar	10	0:00s	1:00	S
    -Rule	Italy	1918	1919	-	Oct	Sun>=1	0:00s	0	-
    -Rule	Italy	1919	only	-	Mar	 2	0:00s	1:00	S
    -Rule	Italy	1920	only	-	Mar	21	0:00s	1:00	S
    -Rule	Italy	1920	only	-	Sep	19	0:00s	0	-
    -Rule	Italy	1940	only	-	Jun	15	0:00s	1:00	S
    -Rule	Italy	1944	only	-	Sep	17	0:00s	0	-
    -Rule	Italy	1945	only	-	Apr	 2	2:00	1:00	S
    -Rule	Italy	1945	only	-	Sep	15	0:00s	0	-
    -Rule	Italy	1946	only	-	Mar	17	2:00s	1:00	S
    -Rule	Italy	1946	only	-	Oct	 6	2:00s	0	-
    -Rule	Italy	1947	only	-	Mar	16	0:00s	1:00	S
    -Rule	Italy	1947	only	-	Oct	 5	0:00s	0	-
    -Rule	Italy	1948	only	-	Feb	29	2:00s	1:00	S
    -Rule	Italy	1948	only	-	Oct	 3	2:00s	0	-
    -Rule	Italy	1966	1968	-	May	Sun>=22	0:00	1:00	S
    -Rule	Italy	1966	1969	-	Sep	Sun>=22	0:00	0	-
    -Rule	Italy	1969	only	-	Jun	 1	0:00	1:00	S
    -Rule	Italy	1970	only	-	May	31	0:00	1:00	S
    -Rule	Italy	1970	only	-	Sep	lastSun	0:00	0	-
    -Rule	Italy	1971	1972	-	May	Sun>=22	0:00	1:00	S
    -Rule	Italy	1971	only	-	Sep	lastSun	1:00	0	-
    -Rule	Italy	1972	only	-	Oct	 1	0:00	0	-
    -Rule	Italy	1973	only	-	Jun	 3	0:00	1:00	S
    -Rule	Italy	1973	1974	-	Sep	lastSun	0:00	0	-
    -Rule	Italy	1974	only	-	May	26	0:00	1:00	S
    -Rule	Italy	1975	only	-	Jun	 1	0:00s	1:00	S
    -Rule	Italy	1975	1977	-	Sep	lastSun	0:00s	0	-
    -Rule	Italy	1976	only	-	May	30	0:00s	1:00	S
    -Rule	Italy	1977	1979	-	May	Sun>=22	0:00s	1:00	S
    -Rule	Italy	1978	only	-	Oct	 1	0:00s	0	-
    -Rule	Italy	1979	only	-	Sep	30	0:00s	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Rome	0:49:56 -	LMT	1866 Sep 22
    -			0:49:56	-	RMT	1893 Nov  1  0:00s # Rome Mean
    -			1:00	Italy	CE%sT	1942 Nov  2  2:00s
    -			1:00	C-Eur	CE%sT	1944 Jul
    -			1:00	Italy	CE%sT	1980
    -			1:00	EU	CE%sT
    -
    -Link	Europe/Rome	Europe/Vatican
    -Link	Europe/Rome	Europe/San_Marino
    -
    -# Latvia
    -
    -# From Liene Kanepe (1998-09-17):
    -
    -# I asked about this matter Scientific Secretary of the Institute of Astronomy
    -# of The University of Latvia Dr. paed Mr. Ilgonis Vilks. I also searched the
    -# correct data in juridical acts and I found some juridical documents about
    -# changes in the counting of time in Latvia from 1981....
    -#
    -# Act No. 35 of the Council of Ministers of Latvian SSR of 1981-01-22 ...
    -# according to the Act No. 925 of the Council of Ministers of USSR of 1980-10-24
    -# ...: all year round the time of 2nd time zone + 1 hour, in addition turning
    -# the hands of the clock 1 hour forward on 1 April at 00:00 (GMT 31 March 21:00)
    -# and 1 hour backward on the 1 October at 00:00 (GMT 30 September 20:00).
    -#
    -# Act No. 592 of the Council of Ministers of Latvian SSR of 1984-09-24 ...
    -# according to the Act No. 967 of the Council of Ministers of USSR of 1984-09-13
    -# ...: all year round the time of 2nd time zone + 1 hour, in addition turning
    -# the hands of the clock 1 hour forward on the last Sunday of March at 02:00
    -# (GMT 23:00 on the previous day) and 1 hour backward on the last Sunday of
    -# September at 03:00 (GMT 23:00 on the previous day).
    -#
    -# Act No. 81 of the Council of Ministers of Latvian SSR of 1989-03-22 ...
    -# according to the Act No. 227 of the Council of Ministers of USSR of 1989-03-14
    -# ...: since the last Sunday of March 1989 in Lithuanian SSR, Latvian SSR,
    -# Estonian SSR and Kaliningrad region of Russian Federation all year round the
    -# time of 2nd time zone (Moscow time minus one hour). On the territory of Latvia
    -# transition to summer time is performed on the last Sunday of March at 02:00
    -# (GMT 00:00), turning the hands of the clock 1 hour forward.  The end of
    -# daylight saving time is performed on the last Sunday of September at 03:00
    -# (GMT 00:00), turning the hands of the clock 1 hour backward. Exception is
    -# 1989-03-26, when we must not turn the hands of the clock....
    -#
    -# The Regulations of the Cabinet of Ministers of the Republic of Latvia of
    -# 1997-01-21 on transition to Summer time ... established the same order of
    -# daylight savings time settings as in the States of the European Union.
    -
    -# From Andrei Ivanov (2000-03-06):
    -# This year Latvia will not switch to Daylight Savings Time (as specified in
    -# The Regulations of the Cabinet of Ministers of the Rep. of Latvia of
    -# 29-Feb-2000 (No. 79) ,
    -# in Latvian for subscribers only).
    -
    -# From RFE/RL Newsline
    -# http://www.rferl.org/newsline/2001/01/3-CEE/cee-030101.html
    -# (2001-01-03), noted after a heads-up by Rives McDow:
    -# The Latvian government on 2 January decided that the country will
    -# institute daylight-saving time this spring, LETA reported.
    -# Last February the three Baltic states decided not to turn back their
    -# clocks one hour in the spring....
    -# Minister of Economy Aigars Kalvītis noted that Latvia had too few
    -# daylight hours and thus decided to comply with a draft European
    -# Commission directive that provides for instituting daylight-saving
    -# time in EU countries between 2002 and 2006. The Latvian government
    -# urged Lithuania and Estonia to adopt a similar time policy, but it
    -# appears that they will not do so....
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Latvia	1989	1996	-	Mar	lastSun	 2:00s	1:00	S
    -Rule	Latvia	1989	1996	-	Sep	lastSun	 2:00s	0	-
    -
    -# Milne 1899 says Riga was 1:36:28 (Polytechnique House time).
    -# Byalokoz 1919 says Latvia was 1:36:34.
    -# Go with Byalokoz.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Riga	1:36:34	-	LMT	1880
    -			1:36:34	-	RMT	1918 Apr 15  2:00 # Riga MT
    -			1:36:34	1:00	LST	1918 Sep 16  3:00 # Latvian ST
    -			1:36:34	-	RMT	1919 Apr  1  2:00
    -			1:36:34	1:00	LST	1919 May 22  3:00
    -			1:36:34	-	RMT	1926 May 11
    -			2:00	-	EET	1940 Aug  5
    -			3:00	-	MSK	1941 Jul
    -			1:00	C-Eur	CE%sT	1944 Oct 13
    -			3:00	Russia	MSK/MSD	1989 Mar lastSun  2:00s
    -			2:00	1:00	EEST	1989 Sep lastSun  2:00s
    -			2:00	Latvia	EE%sT	1997 Jan 21
    -			2:00	EU	EE%sT	2000 Feb 29
    -			2:00	-	EET	2001 Jan  2
    -			2:00	EU	EE%sT
    -
    -# Liechtenstein
    -
    -# From Paul Eggert (2013-09-09):
    -# Shanks & Pottenger say Vaduz is like Zurich.
    -
    -# From Alois Treindl (2013-09-18):
    -# http://www.eliechtensteinensia.li/LIJ/1978/1938-1978/1941.pdf
    -# ... confirms on p. 6 that Liechtenstein followed Switzerland in 1941 and 1942.
    -# I ... translate only the last two paragraphs:
    -#    ... during second world war, in the years 1941 and 1942, Liechtenstein
    -#    introduced daylight saving time, adapting to Switzerland.  From 1943 on
    -#    central European time was in force throughout the year.
    -#    From a report of the duke's government to the high council,
    -#    regarding the introduction of a time law, of 31 May 1977.
    -
    -Link Europe/Zurich Europe/Vaduz
    -
    -
    -# Lithuania
    -
    -# From Paul Eggert (1996-11-22):
    -# IATA SSIM (1992/1996) says Lithuania uses W-Eur rules, but since it is
    -# known to be wrong about Estonia and Latvia, assume it's wrong here too.
    -
    -# From Marius Gedminas (1998-08-07):
    -# I would like to inform that in this year Lithuanian time zone
    -# (Europe/Vilnius) was changed.
    -
    -# From ELTA No. 972 (2582) (1999-09-29) ,
    -# via Steffen Thorsen:
    -# Lithuania has shifted back to the second time zone (GMT plus two hours)
    -# to be valid here starting from October 31,
    -# as decided by the national government on Wednesday....
    -# The Lithuanian government also announced plans to consider a
    -# motion to give up shifting to summer time in spring, as it was
    -# already done by Estonia.
    -
    -# From the Fact File, Lithuanian State Department of Tourism
    -#  (2000-03-27):
    -# Local time is GMT+2 hours ..., no daylight saving.
    -
    -# From a user via Klaus Marten (2003-02-07):
    -# As a candidate for membership of the European Union, Lithuania will
    -# observe Summer Time in 2003, changing its clocks at the times laid
    -# down in EU Directive 2000/84 of 19.I.01 (i.e. at the same times as its
    -# neighbour Latvia). The text of the Lithuanian government Order of
    -# 7.XI.02 to this effect can be found at
    -# http://www.lrvk.lt/nut/11/n1749.htm
    -
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Vilnius	1:41:16	-	LMT	1880
    -			1:24:00	-	WMT	1917        # Warsaw Mean Time
    -			1:35:36	-	KMT	1919 Oct 10 # Kaunas Mean Time
    -			1:00	-	CET	1920 Jul 12
    -			2:00	-	EET	1920 Oct  9
    -			1:00	-	CET	1940 Aug  3
    -			3:00	-	MSK	1941 Jun 24
    -			1:00	C-Eur	CE%sT	1944 Aug
    -			3:00	Russia	MSK/MSD	1991 Mar 31  2:00s
    -			2:00	1:00	EEST	1991 Sep 29  2:00s
    -			2:00	C-Eur	EE%sT	1998
    -			2:00	-	EET	1998 Mar 29  1:00u
    -			1:00	EU	CE%sT	1999 Oct 31  1:00u
    -			2:00	-	EET	2003 Jan  1
    -			2:00	EU	EE%sT
    -
    -# Luxembourg
    -# Whitman disagrees with most of these dates in minor ways;
    -# go with Shanks & Pottenger.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Lux	1916	only	-	May	14	23:00	1:00	S
    -Rule	Lux	1916	only	-	Oct	 1	 1:00	0	-
    -Rule	Lux	1917	only	-	Apr	28	23:00	1:00	S
    -Rule	Lux	1917	only	-	Sep	17	 1:00	0	-
    -Rule	Lux	1918	only	-	Apr	Mon>=15	 2:00s	1:00	S
    -Rule	Lux	1918	only	-	Sep	Mon>=15	 2:00s	0	-
    -Rule	Lux	1919	only	-	Mar	 1	23:00	1:00	S
    -Rule	Lux	1919	only	-	Oct	 5	 3:00	0	-
    -Rule	Lux	1920	only	-	Feb	14	23:00	1:00	S
    -Rule	Lux	1920	only	-	Oct	24	 2:00	0	-
    -Rule	Lux	1921	only	-	Mar	14	23:00	1:00	S
    -Rule	Lux	1921	only	-	Oct	26	 2:00	0	-
    -Rule	Lux	1922	only	-	Mar	25	23:00	1:00	S
    -Rule	Lux	1922	only	-	Oct	Sun>=2	 1:00	0	-
    -Rule	Lux	1923	only	-	Apr	21	23:00	1:00	S
    -Rule	Lux	1923	only	-	Oct	Sun>=2	 2:00	0	-
    -Rule	Lux	1924	only	-	Mar	29	23:00	1:00	S
    -Rule	Lux	1924	1928	-	Oct	Sun>=2	 1:00	0	-
    -Rule	Lux	1925	only	-	Apr	 5	23:00	1:00	S
    -Rule	Lux	1926	only	-	Apr	17	23:00	1:00	S
    -Rule	Lux	1927	only	-	Apr	 9	23:00	1:00	S
    -Rule	Lux	1928	only	-	Apr	14	23:00	1:00	S
    -Rule	Lux	1929	only	-	Apr	20	23:00	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Europe/Luxembourg	0:24:36 -	LMT	1904 Jun
    -			1:00	Lux	CE%sT	1918 Nov 25
    -			0:00	Lux	WE%sT	1929 Oct  6  2:00s
    -			0:00	Belgium	WE%sT	1940 May 14  3:00
    -			1:00	C-Eur	WE%sT	1944 Sep 18  3:00
    -			1:00	Belgium	CE%sT	1977
    -			1:00	EU	CE%sT
    -
    -# Macedonia
    -# See Europe/Belgrade.
    -
    -# Malta
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Malta	1973	only	-	Mar	31	0:00s	1:00	S
    -Rule	Malta	1973	only	-	Sep	29	0:00s	0	-
    -Rule	Malta	1974	only	-	Apr	21	0:00s	1:00	S
    -Rule	Malta	1974	only	-	Sep	16	0:00s	0	-
    -Rule	Malta	1975	1979	-	Apr	Sun>=15	2:00	1:00	S
    -Rule	Malta	1975	1980	-	Sep	Sun>=15	2:00	0	-
    -Rule	Malta	1980	only	-	Mar	31	2:00	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Malta	0:58:04 -	LMT	1893 Nov  2  0:00s # Valletta
    -			1:00	Italy	CE%sT	1942 Nov  2  2:00s
    -			1:00	C-Eur	CE%sT	1945 Apr  2  2:00s
    -			1:00	Italy	CE%sT	1973 Mar 31
    -			1:00	Malta	CE%sT	1981
    -			1:00	EU	CE%sT
    -
    -# Moldova
    -
    -# From Paul Eggert (2006-03-22):
    -# A previous version of this database followed Shanks & Pottenger, who write
    -# that Tiraspol switched to Moscow time on 1992-01-19 at 02:00.
    -# However, this is most likely an error, as Moldova declared independence
    -# on 1991-08-27 (the 1992-01-19 date is that of a Russian decree).
    -# In early 1992 there was large-scale interethnic violence in the area
    -# and it's possible that some Russophones continued to observe Moscow time.
    -# But [two people] separately reported via
    -# Jesper Nørgaard that as of 2001-01-24 Tiraspol was like Chisinau.
    -# The Tiraspol entry has therefore been removed for now.
    -#
    -# From Alexander Krivenyshev (2011-10-17):
    -# Pridnestrovian Moldavian Republic (PMR, also known as
    -# "Pridnestrovie") has abolished seasonal clock change (no transition
    -# to the Winter Time).
    -#
    -# News (in Russian):
    -# http://www.kyivpost.ua/russia/news/pridnestrove-otkazalos-ot-perehoda-na-zimnee-vremya-30954.html
    -# http://www.allmoldova.com/moldova-news/1249064116.html
    -#
    -# The substance of this change (reinstatement of the Tiraspol entry)
    -# is from a patch from Petr Machata (2011-10-17)
    -#
    -# From Tim Parenti (2011-10-19)
    -# In addition, being situated at +4651+2938 would give Tiraspol
    -# a pre-1880 LMT offset of 1:58:32.
    -#
    -# (which agrees with the earlier entry that had been removed)
    -#
    -# From Alexander Krivenyshev (2011-10-26)
    -# NO need to divide Moldova into two timezones at this point.
    -# As of today, Transnistria (Pridnestrovie)- Tiraspol reversed its own
    -# decision to abolish DST this winter.
    -# Following Moldova and neighboring Ukraine- Transnistria (Pridnestrovie)-
    -# Tiraspol will go back to winter time on October 30, 2011.
    -# News from Moldova (in russian):
    -# http://ru.publika.md/link_317061.html
    -
    -# From Roman Tudos (2015-07-02):
    -# http://lex.justice.md/index.php?action=view&view=doc&lang=1&id=355077
    -# From Paul Eggert (2015-07-01):
    -# The abovementioned official link to IGO1445-868/2014 states that
    -# 2014-10-26's fallback transition occurred at 03:00 local time.  Also,
    -# http://www.trm.md/en/social/la-30-martie-vom-trece-la-ora-de-vara
    -# says the 2014-03-30 spring-forward transition was at 02:00 local time.
    -# Guess that since 1997 Moldova has switched one hour before the EU.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Moldova	1997	max	-	Mar	lastSun	 2:00	1:00	S
    -Rule	Moldova	1997	max	-	Oct	lastSun	 3:00	0	-
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Chisinau	1:55:20 -	LMT	1880
    -			1:55	-	CMT	1918 Feb 15 # Chisinau MT
    -			1:44:24	-	BMT	1931 Jul 24 # Bucharest MT
    -			2:00	Romania	EE%sT	1940 Aug 15
    -			2:00	1:00	EEST	1941 Jul 17
    -			1:00	C-Eur	CE%sT	1944 Aug 24
    -			3:00	Russia	MSK/MSD	1990
    -			3:00	-	MSK	1990 May 6
    -			2:00	-	EET	1991
    -			2:00	Russia	EE%sT	1992
    -			2:00	E-Eur	EE%sT	1997
    -# See Romania commentary for the guessed 1997 transition to EU rules.
    -			2:00	Moldova	EE%sT
    -
    -# Monaco
    -# Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
    -# more precise 0:09:21.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Monaco	0:29:32 -	LMT	1891 Mar 15
    -			0:09:21	-	PMT	1911 Mar 11 # Paris Mean Time
    -			0:00	France	WE%sT	1945 Sep 16  3:00
    -			1:00	France	CE%sT	1977
    -			1:00	EU	CE%sT
    -
    -# Montenegro
    -# See Europe/Belgrade.
    -
    -# Netherlands
    -
    -# Howse writes that the Netherlands' railways used GMT between 1892 and 1940,
    -# but for other purposes the Netherlands used Amsterdam mean time.
    -
    -# However, Robert H. van Gent writes (2001-04-01):
    -# Howse's statement is only correct up to 1909. From 1909-05-01 (00:00:00
    -# Amsterdam mean time) onwards, the whole of the Netherlands (including
    -# the Dutch railways) was required by law to observe Amsterdam mean time
    -# (19 minutes 32.13 seconds ahead of GMT). This had already been the
    -# common practice (except for the railways) for many decades but it was
    -# not until 1909 when the Dutch government finally defined this by law.
    -# On 1937-07-01 this was changed to 20 minutes (exactly) ahead of GMT and
    -# was generally known as Dutch Time ("Nederlandse Tijd").
    -#
    -# (2001-04-08):
    -# 1892-05-01 was the date when the Dutch railways were by law required to
    -# observe GMT while the remainder of the Netherlands adhered to the common
    -# practice of following Amsterdam mean time.
    -#
    -# (2001-04-09):
    -# In 1835 the authorities of the province of North Holland requested the
    -# municipal authorities of the towns and cities in the province to observe
    -# Amsterdam mean time but I do not know in how many cases this request was
    -# actually followed.
    -#
    -# From 1852 onwards the Dutch telegraph offices were by law required to
    -# observe Amsterdam mean time. As the time signals from the observatory of
    -# Leiden were also distributed by the telegraph system, I assume that most
    -# places linked up with the telegraph (and railway) system automatically
    -# adopted Amsterdam mean time.
    -#
    -# Although the early Dutch railway companies initially observed a variety
    -# of times, most of them had adopted Amsterdam mean time by 1858 but it
    -# was not until 1866 when they were all required by law to observe
    -# Amsterdam mean time.
    -
    -# The data entries before 1945 are taken from
    -# http://www.phys.uu.nl/~vgent/wettijd/wettijd.htm
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Neth	1916	only	-	May	 1	0:00	1:00	NST	# Netherlands Summer Time
    -Rule	Neth	1916	only	-	Oct	 1	0:00	0	AMT	# Amsterdam Mean Time
    -Rule	Neth	1917	only	-	Apr	16	2:00s	1:00	NST
    -Rule	Neth	1917	only	-	Sep	17	2:00s	0	AMT
    -Rule	Neth	1918	1921	-	Apr	Mon>=1	2:00s	1:00	NST
    -Rule	Neth	1918	1921	-	Sep	lastMon	2:00s	0	AMT
    -Rule	Neth	1922	only	-	Mar	lastSun	2:00s	1:00	NST
    -Rule	Neth	1922	1936	-	Oct	Sun>=2	2:00s	0	AMT
    -Rule	Neth	1923	only	-	Jun	Fri>=1	2:00s	1:00	NST
    -Rule	Neth	1924	only	-	Mar	lastSun	2:00s	1:00	NST
    -Rule	Neth	1925	only	-	Jun	Fri>=1	2:00s	1:00	NST
    -# From 1926 through 1939 DST began 05-15, except that it was delayed by a week
    -# in years when 05-15 fell in the Pentecost weekend.
    -Rule	Neth	1926	1931	-	May	15	2:00s	1:00	NST
    -Rule	Neth	1932	only	-	May	22	2:00s	1:00	NST
    -Rule	Neth	1933	1936	-	May	15	2:00s	1:00	NST
    -Rule	Neth	1937	only	-	May	22	2:00s	1:00	NST
    -Rule	Neth	1937	only	-	Jul	 1	0:00	1:00	S
    -Rule	Neth	1937	1939	-	Oct	Sun>=2	2:00s	0	-
    -Rule	Neth	1938	1939	-	May	15	2:00s	1:00	S
    -Rule	Neth	1945	only	-	Apr	 2	2:00s	1:00	S
    -Rule	Neth	1945	only	-	Sep	16	2:00s	0	-
    -#
    -# Amsterdam Mean Time was +00:19:32.13 exactly, but the .13 is omitted
    -# below because the current format requires GMTOFF to be an integer.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Europe/Amsterdam	0:19:32 -	LMT	1835
    -			0:19:32	Neth	%s	1937 Jul  1
    -			0:20	Neth	NE%sT	1940 May 16  0:00 # Dutch Time
    -			1:00	C-Eur	CE%sT	1945 Apr  2  2:00
    -			1:00	Neth	CE%sT	1977
    -			1:00	EU	CE%sT
    -
    -# Norway
    -# http://met.no/met/met_lex/q_u/sommertid.html (2004-01) agrees with Shanks &
    -# Pottenger.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Norway	1916	only	-	May	22	1:00	1:00	S
    -Rule	Norway	1916	only	-	Sep	30	0:00	0	-
    -Rule	Norway	1945	only	-	Apr	 2	2:00s	1:00	S
    -Rule	Norway	1945	only	-	Oct	 1	2:00s	0	-
    -Rule	Norway	1959	1964	-	Mar	Sun>=15	2:00s	1:00	S
    -Rule	Norway	1959	1965	-	Sep	Sun>=15	2:00s	0	-
    -Rule	Norway	1965	only	-	Apr	25	2:00s	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Oslo	0:43:00 -	LMT	1895 Jan  1
    -			1:00	Norway	CE%sT	1940 Aug 10 23:00
    -			1:00	C-Eur	CE%sT	1945 Apr  2  2:00
    -			1:00	Norway	CE%sT	1980
    -			1:00	EU	CE%sT
    -
    -# Svalbard & Jan Mayen
    -
    -# From Steffen Thorsen (2001-05-01):
    -# Although I could not find it explicitly, it seems that Jan Mayen and
    -# Svalbard have been using the same time as Norway at least since the
    -# time they were declared as parts of Norway.  Svalbard was declared
    -# as a part of Norway by law of 1925-07-17 no 11, section 4 and Jan
    -# Mayen by law of 1930-02-27 no 2, section 2. (From
    -#  and
    -# ).  The law/regulation
    -# for normal/standard time in Norway is from 1894-06-29 no 1 (came
    -# into operation on 1895-01-01) and Svalbard/Jan Mayen seem to be a
    -# part of this law since 1925/1930. (From
    -# ) I have not been
    -# able to find if Jan Mayen used a different time zone (e.g. -0100)
    -# before 1930. Jan Mayen has only been "inhabited" since 1921 by
    -# Norwegian meteorologists and maybe used the same time as Norway ever
    -# since 1921.  Svalbard (Arctic/Longyearbyen) has been inhabited since
    -# before 1895, and therefore probably changed the local time somewhere
    -# between 1895 and 1925 (inclusive).
    -
    -# From Paul Eggert (2013-09-04):
    -#
    -# Actually, Jan Mayen was never occupied by Germany during World War II,
    -# so it must have diverged from Oslo time during the war, as Oslo was
    -# keeping Berlin time.
    -#
    -#  says that the meteorologists
    -# burned down their station in 1940 and left the island, but returned in
    -# 1941 with a small Norwegian garrison and continued operations despite
    -# frequent air attacks from Germans.  In 1943 the Americans established a
    -# radiolocating station on the island, called "Atlantic City".  Possibly
    -# the UT offset changed during the war, but I think it unlikely that
    -# Jan Mayen used German daylight-saving rules.
    -#
    -# Svalbard is more complicated, as it was raided in August 1941 by an
    -# Allied party that evacuated the civilian population to England (says
    -# ).  The Svalbard FAQ
    -#  says that the Germans were
    -# expelled on 1942-05-14.  However, small parties of Germans did return,
    -# and according to Wilhelm Dege's book "War North of 80" (1954)
    -# http://www.ucalgary.ca/UofC/departments/UP/1-55238/1-55238-110-2.html
    -# the German armed forces at the Svalbard weather station code-named
    -# Haudegen did not surrender to the Allies until September 1945.
    -#
    -# All these events predate our cutoff date of 1970, so use Europe/Oslo
    -# for these regions.
    -Link	Europe/Oslo	Arctic/Longyearbyen
    -
    -# Poland
    -
    -# The 1919 dates and times can be found in Tygodnik Urzędowy nr 1 (1919-03-20),
    -#  pp 1-2.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Poland	1918	1919	-	Sep	16	2:00s	0	-
    -Rule	Poland	1919	only	-	Apr	15	2:00s	1:00	S
    -Rule	Poland	1944	only	-	Apr	 3	2:00s	1:00	S
    -# Whitman gives 1944 Nov 30; go with Shanks & Pottenger.
    -Rule	Poland	1944	only	-	Oct	 4	2:00	0	-
    -# For 1944-1948 Whitman gives the previous day; go with Shanks & Pottenger.
    -Rule	Poland	1945	only	-	Apr	29	0:00	1:00	S
    -Rule	Poland	1945	only	-	Nov	 1	0:00	0	-
    -# For 1946 on the source is Kazimierz Borkowski,
    -# Toruń Center for Astronomy, Dept. of Radio Astronomy, Nicolaus Copernicus U.,
    -# http://www.astro.uni.torun.pl/~kb/Artykuly/U-PA/Czas2.htm#tth_tAb1
    -# Thanks to Przemysław Augustyniak (2005-05-28) for this reference.
    -# He also gives these further references:
    -# Mon Pol nr 13, poz 162 (1995) 
    -# Druk nr 2180 (2003) 
    -Rule	Poland	1946	only	-	Apr	14	0:00s	1:00	S
    -Rule	Poland	1946	only	-	Oct	 7	2:00s	0	-
    -Rule	Poland	1947	only	-	May	 4	2:00s	1:00	S
    -Rule	Poland	1947	1949	-	Oct	Sun>=1	2:00s	0	-
    -Rule	Poland	1948	only	-	Apr	18	2:00s	1:00	S
    -Rule	Poland	1949	only	-	Apr	10	2:00s	1:00	S
    -Rule	Poland	1957	only	-	Jun	 2	1:00s	1:00	S
    -Rule	Poland	1957	1958	-	Sep	lastSun	1:00s	0	-
    -Rule	Poland	1958	only	-	Mar	30	1:00s	1:00	S
    -Rule	Poland	1959	only	-	May	31	1:00s	1:00	S
    -Rule	Poland	1959	1961	-	Oct	Sun>=1	1:00s	0	-
    -Rule	Poland	1960	only	-	Apr	 3	1:00s	1:00	S
    -Rule	Poland	1961	1964	-	May	lastSun	1:00s	1:00	S
    -Rule	Poland	1962	1964	-	Sep	lastSun	1:00s	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Warsaw	1:24:00 -	LMT	1880
    -			1:24:00	-	WMT	1915 Aug  5 # Warsaw Mean Time
    -			1:00	C-Eur	CE%sT	1918 Sep 16  3:00
    -			2:00	Poland	EE%sT	1922 Jun
    -			1:00	Poland	CE%sT	1940 Jun 23  2:00
    -			1:00	C-Eur	CE%sT	1944 Oct
    -			1:00	Poland	CE%sT	1977
    -			1:00	W-Eur	CE%sT	1988
    -			1:00	EU	CE%sT
    -
    -# Portugal
    -#
    -# From Paul Eggert (2014-08-11), after a heads-up from Stephen Colebourne:
    -# According to a Portuguese decree (1911-05-26)
    -# http://dre.pt/pdf1sdip/1911/05/12500/23132313.pdf
    -# Lisbon was at -0:36:44.68, but switched to GMT on 1912-01-01 at 00:00.
    -# Round the old offset to -0:36:45.  This agrees with Willett but disagrees
    -# with Shanks, who says the transition occurred on 1911-05-24 at 00:00 for
    -# Europe/Lisbon, Atlantic/Azores, and Atlantic/Madeira.
    -#
    -# From Rui Pedro Salgueiro (1992-11-12):
    -# Portugal has recently (September, 27) changed timezone
    -# (from WET to MET or CET) to harmonize with EEC.
    -#
    -# Martin Bruckmann (1996-02-29) reports via Peter Ilieve
    -# that Portugal is reverting to 0:00 by not moving its clocks this spring.
    -# The new Prime Minister was fed up with getting up in the dark in the winter.
    -#
    -# From Paul Eggert (1996-11-12):
    -# IATA SSIM (1991-09) reports several 1991-09 and 1992-09 transitions
    -# at 02:00u, not 01:00u.  Assume that these are typos.
    -# IATA SSIM (1991/1992) reports that the Azores were at -1:00.
    -# IATA SSIM (1993-02) says +0:00; later issues (through 1996-09) say -1:00.
    -# Guess that the Azores changed to EU rules in 1992 (since that's when Portugal
    -# harmonized with the EU), and that they stayed +0:00 that winter.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -# DSH writes that despite Decree 1,469 (1915), the change to the clocks was not
    -# done every year, depending on what Spain did, because of railroad schedules.
    -# Go with Shanks & Pottenger.
    -Rule	Port	1916	only	-	Jun	17	23:00	1:00	S
    -# Whitman gives 1916 Oct 31; go with Shanks & Pottenger.
    -Rule	Port	1916	only	-	Nov	 1	 1:00	0	-
    -Rule	Port	1917	only	-	Feb	28	23:00s	1:00	S
    -Rule	Port	1917	1921	-	Oct	14	23:00s	0	-
    -Rule	Port	1918	only	-	Mar	 1	23:00s	1:00	S
    -Rule	Port	1919	only	-	Feb	28	23:00s	1:00	S
    -Rule	Port	1920	only	-	Feb	29	23:00s	1:00	S
    -Rule	Port	1921	only	-	Feb	28	23:00s	1:00	S
    -Rule	Port	1924	only	-	Apr	16	23:00s	1:00	S
    -Rule	Port	1924	only	-	Oct	14	23:00s	0	-
    -Rule	Port	1926	only	-	Apr	17	23:00s	1:00	S
    -Rule	Port	1926	1929	-	Oct	Sat>=1	23:00s	0	-
    -Rule	Port	1927	only	-	Apr	 9	23:00s	1:00	S
    -Rule	Port	1928	only	-	Apr	14	23:00s	1:00	S
    -Rule	Port	1929	only	-	Apr	20	23:00s	1:00	S
    -Rule	Port	1931	only	-	Apr	18	23:00s	1:00	S
    -# Whitman gives 1931 Oct 8; go with Shanks & Pottenger.
    -Rule	Port	1931	1932	-	Oct	Sat>=1	23:00s	0	-
    -Rule	Port	1932	only	-	Apr	 2	23:00s	1:00	S
    -Rule	Port	1934	only	-	Apr	 7	23:00s	1:00	S
    -# Whitman gives 1934 Oct 5; go with Shanks & Pottenger.
    -Rule	Port	1934	1938	-	Oct	Sat>=1	23:00s	0	-
    -# Shanks & Pottenger give 1935 Apr 30; go with Whitman.
    -Rule	Port	1935	only	-	Mar	30	23:00s	1:00	S
    -Rule	Port	1936	only	-	Apr	18	23:00s	1:00	S
    -# Whitman gives 1937 Apr 2; go with Shanks & Pottenger.
    -Rule	Port	1937	only	-	Apr	 3	23:00s	1:00	S
    -Rule	Port	1938	only	-	Mar	26	23:00s	1:00	S
    -Rule	Port	1939	only	-	Apr	15	23:00s	1:00	S
    -# Whitman gives 1939 Oct 7; go with Shanks & Pottenger.
    -Rule	Port	1939	only	-	Nov	18	23:00s	0	-
    -Rule	Port	1940	only	-	Feb	24	23:00s	1:00	S
    -# Shanks & Pottenger give 1940 Oct 7; go with Whitman.
    -Rule	Port	1940	1941	-	Oct	 5	23:00s	0	-
    -Rule	Port	1941	only	-	Apr	 5	23:00s	1:00	S
    -Rule	Port	1942	1945	-	Mar	Sat>=8	23:00s	1:00	S
    -Rule	Port	1942	only	-	Apr	25	22:00s	2:00	M # Midsummer
    -Rule	Port	1942	only	-	Aug	15	22:00s	1:00	S
    -Rule	Port	1942	1945	-	Oct	Sat>=24	23:00s	0	-
    -Rule	Port	1943	only	-	Apr	17	22:00s	2:00	M
    -Rule	Port	1943	1945	-	Aug	Sat>=25	22:00s	1:00	S
    -Rule	Port	1944	1945	-	Apr	Sat>=21	22:00s	2:00	M
    -Rule	Port	1946	only	-	Apr	Sat>=1	23:00s	1:00	S
    -Rule	Port	1946	only	-	Oct	Sat>=1	23:00s	0	-
    -Rule	Port	1947	1949	-	Apr	Sun>=1	 2:00s	1:00	S
    -Rule	Port	1947	1949	-	Oct	Sun>=1	 2:00s	0	-
    -# Shanks & Pottenger say DST was observed in 1950; go with Whitman.
    -# Whitman gives Oct lastSun for 1952 on; go with Shanks & Pottenger.
    -Rule	Port	1951	1965	-	Apr	Sun>=1	 2:00s	1:00	S
    -Rule	Port	1951	1965	-	Oct	Sun>=1	 2:00s	0	-
    -Rule	Port	1977	only	-	Mar	27	 0:00s	1:00	S
    -Rule	Port	1977	only	-	Sep	25	 0:00s	0	-
    -Rule	Port	1978	1979	-	Apr	Sun>=1	 0:00s	1:00	S
    -Rule	Port	1978	only	-	Oct	 1	 0:00s	0	-
    -Rule	Port	1979	1982	-	Sep	lastSun	 1:00s	0	-
    -Rule	Port	1980	only	-	Mar	lastSun	 0:00s	1:00	S
    -Rule	Port	1981	1982	-	Mar	lastSun	 1:00s	1:00	S
    -Rule	Port	1983	only	-	Mar	lastSun	 2:00s	1:00	S
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Lisbon	-0:36:45 -	LMT	1884
    -			-0:36:45 -	LMT	1912 Jan  1 # Lisbon Mean Time
    -			 0:00	Port	WE%sT	1966 Apr  3  2:00
    -			 1:00	-	CET	1976 Sep 26  1:00
    -			 0:00	Port	WE%sT	1983 Sep 25  1:00s
    -			 0:00	W-Eur	WE%sT	1992 Sep 27  1:00s
    -			 1:00	EU	CE%sT	1996 Mar 31  1:00u
    -			 0:00	EU	WE%sT
    -Zone Atlantic/Azores	-1:42:40 -	LMT	1884        # Ponta Delgada
    -			-1:54:32 -	HMT	1912 Jan  1 # Horta Mean Time
    -			-2:00	Port	AZO%sT	1966 Apr  3  2:00  # Azores Time
    -			-1:00	Port	AZO%sT	1983 Sep 25  1:00s
    -			-1:00	W-Eur	AZO%sT	1992 Sep 27  1:00s
    -			 0:00	EU	WE%sT	1993 Mar 28  1:00u
    -			-1:00	EU	AZO%sT
    -Zone Atlantic/Madeira	-1:07:36 -	LMT	1884        # Funchal
    -			-1:07:36 -	FMT	1912 Jan  1 # Funchal Mean Time
    -			-1:00	Port	MAD%sT	1966 Apr  3  2:00 # Madeira Time
    -			 0:00	Port	WE%sT	1983 Sep 25  1:00s
    -			 0:00	EU	WE%sT
    -
    -# Romania
    -#
    -# From Paul Eggert (1999-10-07):
    -# Nine O'clock 
    -# (1998-10-23) reports that the switch occurred at
    -# 04:00 local time in fall 1998.  For lack of better info,
    -# assume that Romania and Moldova switched to EU rules in 1997,
    -# the same year as Bulgaria.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Romania	1932	only	-	May	21	 0:00s	1:00	S
    -Rule	Romania	1932	1939	-	Oct	Sun>=1	 0:00s	0	-
    -Rule	Romania	1933	1939	-	Apr	Sun>=2	 0:00s	1:00	S
    -Rule	Romania	1979	only	-	May	27	 0:00	1:00	S
    -Rule	Romania	1979	only	-	Sep	lastSun	 0:00	0	-
    -Rule	Romania	1980	only	-	Apr	 5	23:00	1:00	S
    -Rule	Romania	1980	only	-	Sep	lastSun	 1:00	0	-
    -Rule	Romania	1991	1993	-	Mar	lastSun	 0:00s	1:00	S
    -Rule	Romania	1991	1993	-	Sep	lastSun	 0:00s	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Europe/Bucharest	1:44:24 -	LMT	1891 Oct
    -			1:44:24	-	BMT	1931 Jul 24 # Bucharest MT
    -			2:00	Romania	EE%sT	1981 Mar 29  2:00s
    -			2:00	C-Eur	EE%sT	1991
    -			2:00	Romania	EE%sT	1994
    -			2:00	E-Eur	EE%sT	1997
    -			2:00	EU	EE%sT
    -
    -
    -# Russia
    -
    -# From Alexander Krivenyshev (2011-09-15):
    -# Based on last Russian Government Decree No. 725 on August 31, 2011
    -# (Government document
    -# http://www.government.ru/gov/results/16355/print/
    -# in Russian)
    -# there are few corrections have to be made for some Russian time zones...
    -# All updated Russian Time Zones were placed in table and translated to English
    -# by WorldTimeZone.com at the link below:
    -# http://www.worldtimezone.com/dst_news/dst_news_russia36.htm
    -
    -# From Sanjeev Gupta (2011-09-27):
    -# Scans of [Decree No. 23 of January 8, 1992] are available at:
    -# http://government.consultant.ru/page.aspx?1223966
    -# They are in Cyrillic letters (presumably Russian).
    -
    -# From Arthur David Olson (2012-05-09):
    -# Regarding the instant when clocks in time-zone-shifting parts of Russia
    -# changed in September 2011:
    -#
    -# One source is
    -# http://government.ru/gov/results/16355/
    -# which, according to translate.google.com, begins "Decree of August 31,
    -# 2011 No. 725" and contains no other dates or "effective date" information.
    -#
    -# Another source is
    -# http://www.rg.ru/2011/09/06/chas-zona-dok.html
    -# which, according to translate.google.com, begins "Resolution of the
    -# Government of the Russian Federation on August 31, 2011 N 725" and also
    -# contains "Date first official publication: September 6, 2011 Posted on:
    -# in the 'RG' - Federal Issue No. 5573 September 6, 2011" but which
    -# does not contain any "effective date" information.
    -#
    -# Another source is
    -# http://en.wikipedia.org/wiki/Oymyakonsky_District#cite_note-RuTime-7
    -# which, in note 8, contains "Resolution No. 725 of August 31, 2011...
    -# Effective as of after 7 days following the day of the official publication"
    -# but which does not contain any reference to September 6, 2011.
    -#
    -# The Wikipedia article refers to
    -# http://base.consultant.ru/cons/cgi/online.cgi?req=doc;base=LAW;n=118896
    -# which seems to copy the text of the government.ru page.
    -#
    -# Tobias Conradi combines Wikipedia's
    -# "as of after 7 days following the day of the official publication"
    -# with www.rg.ru's "Date of first official publication: September 6, 2011" to
    -# get September 13, 2011 as the cutover date (unusually, a Tuesday, as Tobias
    -# Conradi notes).
    -#
    -# None of the sources indicates a time of day for changing clocks.
    -#
    -# Go with 2011-09-13 0:00s.
    -
    -# From Alexander Krivenyshev (2014-07-01):
    -# According to the Russian news (ITAR-TASS News Agency)
    -# http://en.itar-tass.com/russia/738562
    -# the State Duma has approved ... the draft bill on returning to
    -# winter time standard and return Russia 11 time zones.  The new
    -# regulations will come into effect on October 26, 2014 at 02:00 ...
    -# http://asozd2.duma.gov.ru/main.nsf/%28Spravka%29?OpenAgent&RN=431985-6&02
    -# Here is a link where we put together table (based on approved Bill N
    -# 431985-6) with proposed 11 Russian time zones and corresponding
    -# areas/cities/administrative centers in the Russian Federation (in English):
    -# http://www.worldtimezone.com/dst_news/dst_news_russia65.html
    -#
    -# From Alexander Krivenyshev (2014-07-22):
    -# Putin signed the Federal Law 431985-6 ... (in Russian)
    -# http://itar-tass.com/obschestvo/1333711
    -# http://www.pravo.gov.ru:8080/page.aspx?111660
    -# http://www.kremlin.ru/acts/46279
    -# From October 26, 2014 the new Russian time zone map will looks like this:
    -# http://www.worldtimezone.com/dst_news/dst_news_russia-map-2014-07.html
    -
    -# From Paul Eggert (2006-03-22):
    -# Except for Moscow after 1919-07-01, I invented the time zone abbreviations.
    -# Moscow time zone abbreviations after 1919-07-01, and Moscow rules after 1991,
    -# are from Andrey A. Chernov.  The rest is from Shanks & Pottenger,
    -# except we follow Chernov's report that 1992 DST transitions were Sat
    -# 23:00, not Sun 02:00s.
    -#
    -# From Stanislaw A. Kuzikowski (1994-06-29):
    -# But now it is some months since Novosibirsk is 3 hours ahead of Moscow!
    -# I do not know why they have decided to make this change;
    -# as far as I remember it was done exactly during winter->summer switching
    -# so we (Novosibirsk) simply did not switch.
    -#
    -# From Andrey A. Chernov (1996-10-04):
    -# 'MSK' and 'MSD' were born and used initially on Moscow computers with
    -# UNIX-like OSes by several developer groups (e.g. Demos group, Kiae group)....
    -# The next step was the UUCP network, the Relcom predecessor
    -# (used mainly for mail), and MSK/MSD was actively used there.
    -#
    -# From Chris Carrier (1996-10-30):
    -# According to a friend of mine who rode the Trans-Siberian Railroad from
    -# Moscow to Irkutsk in 1995, public air and rail transport in Russia ...
    -# still follows Moscow time, no matter where in Russia it is located.
    -#
    -# For Grozny, Chechnya, we have the following story from
    -# John Daniszewski, "Scavengers in the Rubble", Los Angeles Times (2001-02-07):
    -# News - often false - is spread by word of mouth.  A rumor that it was
    -# time to move the clocks back put this whole city out of sync with
    -# the rest of Russia for two weeks - even soldiers stationed here began
    -# enforcing curfew at the wrong time.
    -#
    -# From Gwillim Law (2001-06-05):
    -# There's considerable evidence that Sakhalin Island used to be in
    -# UTC+11, and has changed to UTC+10, in this decade.  I start with the
    -# SSIM, which listed Yuzhno-Sakhalinsk in zone RU10 along with Magadan
    -# until February 1997, and then in RU9 with Khabarovsk and Vladivostok
    -# since September 1997....  Although the Kuril Islands are
    -# administratively part of Sakhalin oblast', they appear to have
    -# remained on UTC+11 along with Magadan.
    -
    -# From Tim Parenti (2014-07-06):
    -# The comments detailing the coverage of each Russian zone are meant to assist
    -# with maintenance only and represent our best guesses as to which regions
    -# are covered by each zone.  They are not meant to be taken as an authoritative
    -# listing.  The region codes listed come from
    -# http://en.wikipedia.org/w/?title=Federal_subjects_of_Russia&oldid=611810498
    -# and are used for convenience only; no guarantees are made regarding their
    -# future stability.  ISO 3166-2:RU codes are also listed for first-level
    -# divisions where available.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Europe/Kaliningrad covers...
    -# 39	RU-KGD	Kaliningrad Oblast
    -
    -Zone Europe/Kaliningrad	 1:22:00 -	LMT	1893 Apr
    -			 1:00	C-Eur	CE%sT	1945
    -			 2:00	Poland	CE%sT	1946
    -			 3:00	Russia	MSK/MSD	1991 Mar 31  2:00s
    -			 2:00	Russia	EE%sT	2011 Mar 27  2:00s
    -			 3:00	-	FET	2014 Oct 26  2:00s
    -			 2:00	-	EET
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
    -# Europe/Moscow covers...
    -# 01	RU-AD	Adygea, Republic of
    -# 05	RU-DA	Dagestan, Republic of
    -# 06	RU-IN	Ingushetia, Republic of
    -# 07	RU-KB	Kabardino-Balkar Republic
    -# 08	RU-KL	Kalmykia, Republic of
    -# 09	RU-KC	Karachay-Cherkess Republic
    -# 10	RU-KR	Karelia, Republic of
    -# 11	RU-KO	Komi Republic
    -# 12	RU-ME	Mari El Republic
    -# 13	RU-MO	Mordovia, Republic of
    -# 15	RU-SE	North Ossetia-Alania, Republic of
    -# 16	RU-TA	Tatarstan, Republic of
    -# 20	RU-CE	Chechen Republic
    -# 21	RU-CU	Chuvash Republic
    -# 23	RU-KDA	Krasnodar Krai
    -# 26	RU-STA	Stavropol Krai
    -# 29	RU-ARK	Arkhangelsk Oblast
    -# 31	RU-BEL	Belgorod Oblast
    -# 32	RU-BRY	Bryansk Oblast
    -# 33	RU-VLA	Vladimir Oblast
    -# 35	RU-VLG	Vologda Oblast
    -# 36	RU-VOR	Voronezh Oblast
    -# 37	RU-IVA	Ivanovo Oblast
    -# 40	RU-KLU	Kaluga Oblast
    -# 44	RU-KOS	Kostroma Oblast
    -# 46	RU-KRS	Kursk Oblast
    -# 47	RU-LEN	Leningrad Oblast
    -# 48	RU-LIP	Lipetsk Oblast
    -# 50	RU-MOS	Moscow Oblast
    -# 51	RU-MUR	Murmansk Oblast
    -# 52	RU-NIZ	Nizhny Novgorod Oblast
    -# 53	RU-NGR	Novgorod Oblast
    -# 57	RU-ORL	Oryol Oblast
    -# 58	RU-PNZ	Penza Oblast
    -# 60	RU-PSK	Pskov Oblast
    -# 61	RU-ROS	Rostov Oblast
    -# 62	RU-RYA	Ryazan Oblast
    -# 67	RU-SMO	Smolensk Oblast
    -# 68	RU-TAM	Tambov Oblast
    -# 69	RU-TVE	Tver Oblast
    -# 71	RU-TUL	Tula Oblast
    -# 73	RU-ULY	Ulyanovsk Oblast
    -# 76	RU-YAR	Yaroslavl Oblast
    -# 77	RU-MOW	Moscow
    -# 78	RU-SPE	Saint Petersburg
    -# 83	RU-NEN	Nenets Autonomous Okrug
    -
    -# From Vladimir Karpinsky (2014-07-08):
    -# LMT in Moscow (before Jul 3, 1916) is 2:30:17, that was defined by Moscow
    -# Observatory (coordinates: 55 deg. 45'29.70", 37 deg. 34'05.30")....
    -# LMT in Moscow since Jul 3, 1916 is 2:31:01 as a result of new standard.
    -# (The info is from the book by Byalokoz ... p. 18.)
    -# The time in St. Petersburg as capital of Russia was defined by
    -# Pulkov observatory, near St. Petersburg.  In 1916 LMT Moscow
    -# was synchronized with LMT St. Petersburg (+30 minutes), (Pulkov observatory
    -# coordinates: 59 deg. 46'18.70", 30 deg. 19'40.70") so 30 deg. 19'40.70" >
    -# 2h01m18.7s = 2:01:19.  LMT Moscow = LMT St.Petersburg + 30m 2:01:19 + 0:30 =
    -# 2:31:19 ...
    -#
    -# From Paul Eggert (2014-07-08):
    -# Milne does not list Moscow, but suggests that its time might be listed in
    -# Résumés mensuels et annuels des observations météorologiques (1895).
    -# Presumably this is OCLC 85825704, a journal published with parallel text in
    -# Russian and French.  This source has not been located; go with Karpinsky.
    -
    -Zone Europe/Moscow	 2:30:17 -	LMT	1880
    -			 2:30:17 -	MMT	1916 Jul  3 # Moscow Mean Time
    -			 2:31:19 Russia	%s	1919 Jul  1  2:00
    -			 3:00	Russia	%s	1921 Oct
    -			 3:00	Russia	MSK/MSD	1922 Oct
    -			 2:00	-	EET	1930 Jun 21
    -			 3:00	Russia	MSK/MSD	1991 Mar 31  2:00s
    -			 2:00	Russia	EE%sT	1992 Jan 19  2:00s
    -			 3:00	Russia	MSK/MSD	2011 Mar 27  2:00s
    -			 4:00	-	MSK	2014 Oct 26  2:00s
    -			 3:00	-	MSK
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Europe/Simferopol covers...
    -# **	****	Crimea, Republic of
    -# **	****	Sevastopol
    -
    -Zone Europe/Simferopol	 2:16:24 -	LMT	1880
    -			 2:16	-	SMT	1924 May  2 # Simferopol Mean T
    -			 2:00	-	EET	1930 Jun 21
    -			 3:00	-	MSK	1941 Nov
    -			 1:00	C-Eur	CE%sT	1944 Apr 13
    -			 3:00	Russia	MSK/MSD	1990
    -			 3:00	-	MSK	1990 Jul  1  2:00
    -			 2:00	-	EET	1992
    -# Central Crimea used Moscow time 1994/1997.
    -#
    -# From Paul Eggert (2006-03-22):
    -# The _Economist_ (1994-05-28, p 45) reports that central Crimea switched
    -# from Kiev to Moscow time sometime after the January 1994 elections.
    -# Shanks (1999) says "date of change uncertain", but implies that it happened
    -# sometime between the 1994 DST switches.  Shanks & Pottenger simply say
    -# 1994-09-25 03:00, but that can't be right.  For now, guess it
    -# changed in May.
    -			 2:00	E-Eur	EE%sT	1994 May
    -# From IATA SSIM (1994/1997), which also says that Kerch is still like Kiev.
    -			 3:00	E-Eur	MSK/MSD	1996 Mar 31  0:00s
    -			 3:00	1:00	MSD	1996 Oct 27  3:00s
    -# IATA SSIM (1997-09) says Crimea switched to EET/EEST.
    -# Assume it happened in March by not changing the clocks.
    -			 3:00	Russia	MSK/MSD	1997
    -			 3:00	-	MSK	1997 Mar lastSun  1:00u
    -# From Alexander Krivenyshev (2014-03-17):
    -# time change at 2:00 (2am) on March 30, 2014
    -# http://vz.ru/news/2014/3/17/677464.html
    -# From Paul Eggert (2014-03-30):
    -# Simferopol and Sevastopol reportedly changed their central town clocks
    -# late the previous day, but this appears to have been ceremonial
    -# and the discrepancies are small enough to not worry about.
    -			 2:00	EU	EE%sT	2014 Mar 30  2:00
    -			 4:00	-	MSK	2014 Oct 26  2:00s
    -			 3:00	-	MSK
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Europe/Volgograd covers...
    -# 30	RU-AST	Astrakhan Oblast
    -# 34	RU-VGG	Volgograd Oblast
    -# 43	RU-KIR	Kirov Oblast
    -# 64	RU-SAR	Saratov Oblast
    -
    -# From Paul Eggert (2006-05-09):
    -# Shanks & Pottenger say Kirov is still at +0400 but Wikipedia says +0300.
    -# Perhaps it switched after the others?  But we have no data.
    -
    -Zone Europe/Volgograd	 2:57:40 -	LMT	1920 Jan  3
    -			 3:00	-	TSAT	1925 Apr  6 # Tsaritsyn Time
    -			 3:00	-	STAT	1930 Jun 21 # Stalingrad Time
    -			 4:00	-	STAT	1961 Nov 11
    -			 4:00	Russia	VOL%sT	1989 Mar 26  2:00s # Volgograd T
    -			 3:00	Russia	VOL%sT	1991 Mar 31  2:00s
    -			 4:00	-	VOLT	1992 Mar 29  2:00s
    -			 3:00	Russia	MSK/MSD	2011 Mar 27  2:00s
    -			 4:00	-	MSK	2014 Oct 26  2:00s
    -			 3:00	-	MSK
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
    -# Europe/Samara covers...
    -# 18	RU-UD	Udmurt Republic
    -# 63	RU-SAM	Samara Oblast
    -
    -# Byalokoz 1919 says Samara was 3:20:20.
    -
    -Zone Europe/Samara	 3:20:20 -	LMT	1919 Jul  1  2:00
    -			 3:00	-	SAMT	1930 Jun 21
    -			 4:00	-	SAMT	1935 Jan 27
    -			 4:00	Russia	KUY%sT	1989 Mar 26  2:00s # Kuybyshev
    -			 3:00	Russia	MSK/MSD	1991 Mar 31  2:00s
    -			 2:00	Russia	EE%sT	1991 Sep 29  2:00s
    -			 3:00	-	KUYT	1991 Oct 20  3:00
    -			 4:00	Russia	SAM%sT	2010 Mar 28  2:00s # Samara Time
    -			 3:00	Russia	SAM%sT	2011 Mar 27  2:00s
    -			 4:00	-	SAMT
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
    -# Asia/Yekaterinburg covers...
    -# 02	RU-BA	Bashkortostan, Republic of
    -# 90	RU-PER	Perm Krai
    -# 45	RU-KGN	Kurgan Oblast
    -# 56	RU-ORE	Orenburg Oblast
    -# 66	RU-SVE	Sverdlovsk Oblast
    -# 72	RU-TYU	Tyumen Oblast
    -# 74	RU-CHE	Chelyabinsk Oblast
    -# 86	RU-KHM	Khanty-Mansi Autonomous Okrug - Yugra
    -# 89	RU-YAN	Yamalo-Nenets Autonomous Okrug
    -#
    -# Note: Effective 2005-12-01, (59) Perm Oblast and (81) Komi-Permyak
    -# Autonomous Okrug merged to form (90, RU-PER) Perm Krai.
    -
    -# Milne says Yekaterinburg was 4:02:32.9; round to nearest.
    -# Byalokoz 1919 says its provincial time was based on Perm, at 3:45:05.
    -# Assume it switched on 1916-07-03, the time of the new standard.
    -# The 1919 and 1930 transitions are from Shanks.
    -
    -Zone Asia/Yekaterinburg	 4:02:33 -	LMT	1916 Jul  3
    -			 3:45:05 -	PMT	1919 Jul 15  4:00
    -			 4:00	-	SVET	1930 Jun 21 # Sverdlovsk Time
    -			 5:00	Russia	SVE%sT	1991 Mar 31  2:00s
    -			 4:00	Russia	SVE%sT	1992 Jan 19  2:00s
    -			 5:00	Russia	YEK%sT	2011 Mar 27  2:00s
    -			 6:00	-	YEKT	2014 Oct 26  2:00s
    -			 5:00	-	YEKT
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
    -# Asia/Omsk covers...
    -# 04	RU-AL	Altai Republic
    -# 22	RU-ALT	Altai Krai
    -# 55	RU-OMS	Omsk Oblast
    -
    -# Byalokoz 1919 says Omsk was 4:53:30.
    -
    -Zone Asia/Omsk		 4:53:30 -	LMT	1919 Nov 14
    -			 5:00	-	OMST	1930 Jun 21 # Omsk Time
    -			 6:00	Russia	OMS%sT	1991 Mar 31  2:00s
    -			 5:00	Russia	OMS%sT	1992 Jan 19  2:00s
    -			 6:00	Russia	OMS%sT	2011 Mar 27  2:00s
    -			 7:00	-	OMST	2014 Oct 26  2:00s
    -			 6:00	-	OMST
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Asia/Novosibirsk covers...
    -# 54	RU-NVS	Novosibirsk Oblast
    -# 70	RU-TOM	Tomsk Oblast
    -
    -# From Paul Eggert (2006-08-19): I'm guessing about Tomsk here; it's
    -# not clear when it switched from +7 to +6.
    -
    -Zone Asia/Novosibirsk	 5:31:40 -	LMT	1919 Dec 14  6:00
    -			 6:00	-	NOVT	1930 Jun 21 # Novosibirsk Time
    -			 7:00	Russia	NOV%sT	1991 Mar 31  2:00s
    -			 6:00	Russia	NOV%sT	1992 Jan 19  2:00s
    -			 7:00	Russia	NOV%sT	1993 May 23 # say Shanks & P.
    -			 6:00	Russia	NOV%sT	2011 Mar 27  2:00s
    -			 7:00	-	NOVT	2014 Oct 26  2:00s
    -			 6:00	-	NOVT
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Asia/Novokuznetsk covers...
    -# 42	RU-KEM	Kemerovo Oblast
    -
    -# From Alexander Krivenyshev (2009-10-13):
    -# Kemerovo oblast' (Kemerovo region) in Russia will change current time zone on
    -# March 28, 2010:
    -# from current Russia Zone 6 - Krasnoyarsk Time Zone (KRA) UTC +0700
    -# to Russia Zone 5 - Novosibirsk Time Zone (NOV) UTC +0600
    -#
    -# This is according to Government of Russia decree No. 740, on September
    -# 14, 2009 "Application in the territory of the Kemerovo region the Fifth
    -# time zone." ("Russia Zone 5" or old "USSR Zone 5" is GMT +0600)
    -#
    -# Russian Government web site (Russian language)
    -# http://www.government.ru/content/governmentactivity/rfgovernmentdecisions/archive/2009/09/14/991633.htm
    -# or Russian-English translation by WorldTimeZone.com with reference
    -# map to local region and new Russia Time Zone map after March 28, 2010
    -# http://www.worldtimezone.com/dst_news/dst_news_russia03.html
    -#
    -# Thus, when Russia will switch to DST on the night of March 28, 2010
    -# Kemerovo region (Kemerovo oblast') will not change the clock.
    -#
    -# As a result, Kemerovo oblast' will be in the same time zone as
    -# Novosibirsk, Omsk, Tomsk, Barnaul and Altai Republic.
    -
    -# From Tim Parenti (2014-07-02), per Alexander Krivenyshev (2014-07-02):
    -# The Kemerovo region will remain at UTC+7 through the 2014-10-26 change, thus
    -# realigning itself with KRAT.
    -
    -Zone Asia/Novokuznetsk	 5:48:48 -	LMT	1924 May  1
    -			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
    -			 7:00	Russia	KRA%sT	1991 Mar 31  2:00s
    -			 6:00	Russia	KRA%sT	1992 Jan 19  2:00s
    -			 7:00	Russia	KRA%sT	2010 Mar 28  2:00s
    -			 6:00	Russia	NOV%sT	2011 Mar 27  2:00s # Novosibirsk
    -			 7:00	-	NOVT	2014 Oct 26  2:00s
    -			 7:00	-	KRAT	# Krasnoyarsk Time
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
    -# Asia/Krasnoyarsk covers...
    -# 17	RU-TY	Tuva Republic
    -# 19	RU-KK	Khakassia, Republic of
    -# 24	RU-KYA	Krasnoyarsk Krai
    -#
    -# Note: Effective 2007-01-01, (88) Evenk Autonomous Okrug and (84) Taymyr
    -# Autonomous Okrug were merged into (24, RU-KYA) Krasnoyarsk Krai.
    -
    -# Byalokoz 1919 says Krasnoyarsk was 6:11:26.
    -
    -Zone Asia/Krasnoyarsk	 6:11:26 -	LMT	1920 Jan  6
    -			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
    -			 7:00	Russia	KRA%sT	1991 Mar 31  2:00s
    -			 6:00	Russia	KRA%sT	1992 Jan 19  2:00s
    -			 7:00	Russia	KRA%sT	2011 Mar 27  2:00s
    -			 8:00	-	KRAT	2014 Oct 26  2:00s
    -			 7:00	-	KRAT
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
    -# Asia/Irkutsk covers...
    -# 03	RU-BU	Buryatia, Republic of
    -# 38	RU-IRK	Irkutsk Oblast
    -#
    -# Note: Effective 2008-01-01, (85) Ust-Orda Buryat Autonomous Okrug was
    -# merged into (38, RU-IRK) Irkutsk Oblast.
    -
    -# Milne 1899 says Irkutsk was 6:57:15.
    -# Byalokoz 1919 says Irkutsk was 6:57:05.
    -# Go with Byalokoz.
    -
    -Zone Asia/Irkutsk	 6:57:05 -	LMT	1880
    -			 6:57:05 -	IMT	1920 Jan 25 # Irkutsk Mean Time
    -			 7:00	-	IRKT	1930 Jun 21 # Irkutsk Time
    -			 8:00	Russia	IRK%sT	1991 Mar 31  2:00s
    -			 7:00	Russia	IRK%sT	1992 Jan 19  2:00s
    -			 8:00	Russia	IRK%sT	2011 Mar 27  2:00s
    -			 9:00	-	IRKT	2014 Oct 26  2:00s
    -			 8:00	-	IRKT
    -
    -
    -# From Tim Parenti (2014-07-06):
    -# Asia/Chita covers...
    -# 92	RU-ZAB	Zabaykalsky Krai
    -#
    -# Note: Effective 2008-03-01, (75) Chita Oblast and (80) Agin-Buryat
    -# Autonomous Okrug merged to form (92, RU-ZAB) Zabaykalsky Krai.
    -
    -Zone Asia/Chita	 7:33:52 -	LMT	1919 Dec 15
    -			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
    -			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
    -			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
    -			 9:00	Russia	YAK%sT	2011 Mar 27  2:00s
    -			10:00	-	YAKT	2014 Oct 26  2:00s
    -			 8:00	-	IRKT
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
    -# Asia/Yakutsk covers...
    -# 28	RU-AMU	Amur Oblast
    -#
    -# ...and parts of (14, RU-SA) Sakha (Yakutia) Republic:
    -# 14-02	****	Aldansky District
    -# 14-04	****	Amginsky District
    -# 14-05	****	Anabarsky District
    -# 14-06	****	Bulunsky District
    -# 14-07	****	Verkhnevilyuysky District
    -# 14-10	****	Vilyuysky District
    -# 14-11	****	Gorny District
    -# 14-12	****	Zhigansky District
    -# 14-13	****	Kobyaysky District
    -# 14-14	****	Lensky District
    -# 14-15	****	Megino-Kangalassky District
    -# 14-16	****	Mirninsky District
    -# 14-18	****	Namsky District
    -# 14-19	****	Neryungrinsky District
    -# 14-21	****	Nyurbinsky District
    -# 14-23	****	Olenyoksky District
    -# 14-24	****	Olyokminsky District
    -# 14-26	****	Suntarsky District
    -# 14-27	****	Tattinsky District
    -# 14-29	****	Ust-Aldansky District
    -# 14-32	****	Khangalassky District
    -# 14-33	****	Churapchinsky District
    -# 14-34	****	Eveno-Bytantaysky National District
    -
    -# From Tim Parenti (2014-07-03):
    -# Our commentary seems to have lost mention of (14-19) Neryungrinsky District.
    -# Since the surrounding districts of Sakha are all YAKT, assume this is, too.
    -# Also assume its history has been the same as the rest of Asia/Yakutsk.
    -
    -# Byalokoz 1919 says Yakutsk was 8:38:58.
    -
    -Zone Asia/Yakutsk	 8:38:58 -	LMT	1919 Dec 15
    -			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
    -			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
    -			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
    -			 9:00	Russia	YAK%sT	2011 Mar 27  2:00s
    -			10:00	-	YAKT	2014 Oct 26  2:00s
    -			 9:00	-	YAKT
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
    -# Asia/Vladivostok covers...
    -# 25	RU-PRI	Primorsky Krai
    -# 27	RU-KHA	Khabarovsk Krai
    -# 79	RU-YEV	Jewish Autonomous Oblast
    -#
    -# ...and parts of (14, RU-SA) Sakha (Yakutia) Republic:
    -# 14-09	****	Verkhoyansky District
    -# 14-31	****	Ust-Yansky District
    -
    -# Milne 1899 says Vladivostok was 8:47:33.5.
    -# Byalokoz 1919 says Vladivostok was 8:47:31.
    -# Go with Byalokoz.
    -
    -Zone Asia/Vladivostok	 8:47:31 -	LMT	1922 Nov 15
    -			 9:00	-	VLAT	1930 Jun 21 # Vladivostok Time
    -			10:00	Russia	VLA%sT	1991 Mar 31  2:00s
    -			 9:00	Russia	VLA%sT	1992 Jan 19  2:00s
    -			10:00	Russia	VLA%sT	2011 Mar 27  2:00s
    -			11:00	-	VLAT	2014 Oct 26  2:00s
    -			10:00	-	VLAT
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Asia/Khandyga covers parts of (14, RU-SA) Sakha (Yakutia) Republic:
    -# 14-28	****	Tomponsky District
    -# 14-30	****	Ust-Maysky District
    -
    -# From Arthur David Olson (2012-05-09):
    -# Tomponskij and Ust'-Majskij switched from Vladivostok time to Yakutsk time
    -# in 2011.
    -
    -# From Paul Eggert (2012-11-25):
    -# Shanks and Pottenger (2003) has Khandyga on Yakutsk time.
    -# Make a wild guess that it switched to Vladivostok time in 2004.
    -# This transition is no doubt wrong, but we have no better info.
    -
    -Zone Asia/Khandyga	 9:02:13 -	LMT	1919 Dec 15
    -			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
    -			 9:00	Russia	YAK%sT	1991 Mar 31  2:00s
    -			 8:00	Russia	YAK%sT	1992 Jan 19  2:00s
    -			 9:00	Russia	YAK%sT	2004
    -			10:00	Russia	VLA%sT	2011 Mar 27  2:00s
    -			11:00	-	VLAT	2011 Sep 13  0:00s # Decree 725?
    -			10:00	-	YAKT	2014 Oct 26  2:00s
    -			 9:00	-	YAKT
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Asia/Sakhalin covers...
    -# 65	RU-SAK	Sakhalin Oblast
    -# ...with the exception of:
    -# 65-11	****	Severo-Kurilsky District (North Kuril Islands)
    -
    -# The Zone name should be Asia/Yuzhno-Sakhalinsk, but that's too long.
    -Zone Asia/Sakhalin	 9:30:48 -	LMT	1905 Aug 23
    -			 9:00	-	JCST	1937 Oct  1
    -			 9:00	-	JST	1945 Aug 25
    -			11:00	Russia	SAK%sT	1991 Mar 31  2:00s # Sakhalin T
    -			10:00	Russia	SAK%sT	1992 Jan 19  2:00s
    -			11:00	Russia	SAK%sT	1997 Mar lastSun  2:00s
    -			10:00	Russia	SAK%sT	2011 Mar 27  2:00s
    -			11:00	-	SAKT	2014 Oct 26  2:00s
    -			10:00	-	SAKT
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2009-11-29):
    -# Asia/Magadan covers...
    -# 49	RU-MAG	Magadan Oblast
    -
    -# From Tim Parenti (2014-07-06), per Alexander Krivenyshev (2014-07-02):
    -# Magadan Oblast is moving from UTC+12 to UTC+10 on 2014-10-26; however,
    -# several districts of Sakha Republic as well as Severo-Kurilsky District of
    -# the Sakhalin Oblast (also known as the North Kuril Islands), represented
    -# until now by Asia/Magadan, will instead move to UTC+11.  These regions will
    -# need their own zone.
    -
    -Zone Asia/Magadan	10:03:12 -	LMT	1924 May  2
    -			10:00	-	MAGT	1930 Jun 21 # Magadan Time
    -			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
    -			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
    -			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
    -			12:00	-	MAGT	2014 Oct 26  2:00s
    -			10:00	-	MAGT
    -
    -
    -# From Tim Parenti (2014-07-06):
    -# Asia/Srednekolymsk covers parts of (14, RU-SA) Sakha (Yakutia) Republic:
    -# 14-01	****	Abyysky District
    -# 14-03	****	Allaikhovsky District
    -# 14-08	****	Verkhnekolymsky District
    -# 14-17	****	Momsky District
    -# 14-20	****	Nizhnekolymsky District
    -# 14-25	****	Srednekolymsky District
    -#
    -# ...and parts of (65, RU-SAK) Sakhalin Oblast:
    -# 65-11	****	Severo-Kurilsky District (North Kuril Islands)
    -
    -# From Tim Parenti (2014-07-02):
    -# Oymyakonsky District of Sakha Republic (represented by Ust-Nera), along with
    -# most of Sakhalin Oblast (represented by Sakhalin) will be moving to UTC+10 on
    -# 2014-10-26 to stay aligned with VLAT/SAKT; however, Severo-Kurilsky District
    -# of the Sakhalin Oblast (also known as the North Kuril Islands, represented by
    -# Severo-Kurilsk) will remain on UTC+11.
    -
    -# From Tim Parenti (2014-07-06):
    -# Assume North Kuril Islands have history like Magadan before 2011-03-27.
    -# There is a decent chance this is wrong, in which case a new zone
    -# Asia/Severo-Kurilsk would become necessary.
    -#
    -# Srednekolymsk and Zyryanka are the most populous places amongst these
    -# districts, but have very similar populations.  In fact, Wikipedia currently
    -# lists them both as having 3528 people, exactly 1668 males and 1860 females
    -# each!  (Yikes!)
    -# http://en.wikipedia.org/w/?title=Srednekolymsky_District&oldid=603435276
    -# http://en.wikipedia.org/w/?title=Verkhnekolymsky_District&oldid=594378493
    -# Assume this is a mistake, albeit an amusing one.
    -#
    -# Looking at censuses, the populations of the two municipalities seem to have
    -# fluctuated recently.  Zyryanka was more populous than Srednekolymsk in the
    -# 1989 and 2002 censuses, but Srednekolymsk was more populous in the most
    -# recent (2010) census, 3525 to 3170.  (See pages 195 and 197 of
    -# http://www.gks.ru/free_doc/new_site/perepis2010/croc/Documents/Vol1/pub-01-05.pdf
    -# in Russian.)  In addition, Srednekolymsk appears to be a much older
    -# settlement and the population of Zyryanka seems to be declining.
    -# Go with Srednekolymsk.
    -#
    -# Since Magadan Oblast moves to UTC+10 on 2014-10-26, we cannot keep using MAGT
    -# as the abbreviation.  Use SRET instead.
    -
    -Zone Asia/Srednekolymsk	10:14:52 -	LMT	1924 May  2
    -			10:00	-	MAGT	1930 Jun 21 # Magadan Time
    -			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
    -			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
    -			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
    -			12:00	-	MAGT	2014 Oct 26  2:00s
    -			11:00	-	SRET	# Srednekolymsk Time
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Asia/Ust-Nera covers parts of (14, RU-SA) Sakha (Yakutia) Republic:
    -# 14-22	****	Oymyakonsky District
    -
    -# From Arthur David Olson (2012-05-09):
    -# Ojmyakonskij [and the Kuril Islands] switched from
    -# Magadan time to Vladivostok time in 2011.
    -#
    -# From Tim Parenti (2014-07-06), per Alexander Krivenyshev (2014-07-02):
    -# It's unlikely that any of the Kuril Islands were involved in such a switch,
    -# as the South and Middle Kurils have been on UTC+11 (SAKT) with the rest of
    -# Sakhalin Oblast since at least 2011-09, and the North Kurils have been on
    -# UTC+12 since at least then, too.
    -
    -Zone Asia/Ust-Nera	 9:32:54 -	LMT	1919 Dec 15
    -			 8:00	-	YAKT	1930 Jun 21 # Yakutsk Time
    -			 9:00	Russia	YAKT	1981 Apr  1
    -			11:00	Russia	MAG%sT	1991 Mar 31  2:00s
    -			10:00	Russia	MAG%sT	1992 Jan 19  2:00s
    -			11:00	Russia	MAG%sT	2011 Mar 27  2:00s
    -			12:00	-	MAGT	2011 Sep 13  0:00s # Decree 725?
    -			11:00	-	VLAT	2014 Oct 26  2:00s
    -			10:00	-	VLAT
    -
    -
    -# From Tim Parenti (2014-07-03), per Oscar van Vlijmen (2001-08-25):
    -# Asia/Kamchatka covers...
    -# 91	RU-KAM	Kamchatka Krai
    -#
    -# Note: Effective 2007-07-01, (41) Kamchatka Oblast and (82) Koryak
    -# Autonomous Okrug merged to form (91, RU-KAM) Kamchatka Krai.
    -
    -# The Zone name should be Asia/Petropavlovsk-Kamchatski or perhaps
    -# Asia/Petropavlovsk-Kamchatsky, but these are too long.
    -Zone Asia/Kamchatka	10:34:36 -	LMT	1922 Nov 10
    -			11:00	-	PETT	1930 Jun 21 # P-K Time
    -			12:00	Russia	PET%sT	1991 Mar 31  2:00s
    -			11:00	Russia	PET%sT	1992 Jan 19  2:00s
    -			12:00	Russia	PET%sT	2010 Mar 28  2:00s
    -			11:00	Russia	PET%sT	2011 Mar 27  2:00s
    -			12:00	-	PETT
    -
    -
    -# From Tim Parenti (2014-07-03):
    -# Asia/Anadyr covers...
    -# 87	RU-CHU	Chukotka Autonomous Okrug
    -
    -Zone Asia/Anadyr	11:49:56 -	LMT	1924 May  2
    -			12:00	-	ANAT	1930 Jun 21 # Anadyr Time
    -			13:00	Russia	ANA%sT	1982 Apr  1  0:00s
    -			12:00	Russia	ANA%sT	1991 Mar 31  2:00s
    -			11:00	Russia	ANA%sT	1992 Jan 19  2:00s
    -			12:00	Russia	ANA%sT	2010 Mar 28  2:00s
    -			11:00	Russia	ANA%sT	2011 Mar 27  2:00s
    -			12:00	-	ANAT
    -
    -
    -# San Marino
    -# See Europe/Rome.
    -
    -# Serbia
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Belgrade	1:22:00	-	LMT	1884
    -			1:00	-	CET	1941 Apr 18 23:00
    -			1:00	C-Eur	CE%sT	1945
    -			1:00	-	CET	1945 May  8  2:00s
    -			1:00	1:00	CEST	1945 Sep 16  2:00s
    -# Metod Koželj reports that the legal date of
    -# transition to EU rules was 1982-11-27, for all of Yugoslavia at the time.
    -# Shanks & Pottenger don't give as much detail, so go with Koželj.
    -			1:00	-	CET	1982 Nov 27
    -			1:00	EU	CE%sT
    -Link Europe/Belgrade Europe/Ljubljana	# Slovenia
    -Link Europe/Belgrade Europe/Podgorica	# Montenegro
    -Link Europe/Belgrade Europe/Sarajevo	# Bosnia and Herzegovina
    -Link Europe/Belgrade Europe/Skopje	# Macedonia
    -Link Europe/Belgrade Europe/Zagreb	# Croatia
    -
    -# Slovakia
    -Link Europe/Prague Europe/Bratislava
    -
    -# Slovenia
    -# See Europe/Belgrade.
    -
    -# Spain
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -# For 1917-1919 Whitman gives Apr Sat>=1 - Oct Sat>=1;
    -# go with Shanks & Pottenger.
    -Rule	Spain	1917	only	-	May	 5	23:00s	1:00	S
    -Rule	Spain	1917	1919	-	Oct	 6	23:00s	0	-
    -Rule	Spain	1918	only	-	Apr	15	23:00s	1:00	S
    -Rule	Spain	1919	only	-	Apr	 5	23:00s	1:00	S
    -# Whitman gives 1921 Feb 28 - Oct 14; go with Shanks & Pottenger.
    -Rule	Spain	1924	only	-	Apr	16	23:00s	1:00	S
    -# Whitman gives 1924 Oct 14; go with Shanks & Pottenger.
    -Rule	Spain	1924	only	-	Oct	 4	23:00s	0	-
    -Rule	Spain	1926	only	-	Apr	17	23:00s	1:00	S
    -# Whitman says no DST in 1929; go with Shanks & Pottenger.
    -Rule	Spain	1926	1929	-	Oct	Sat>=1	23:00s	0	-
    -Rule	Spain	1927	only	-	Apr	 9	23:00s	1:00	S
    -Rule	Spain	1928	only	-	Apr	14	23:00s	1:00	S
    -Rule	Spain	1929	only	-	Apr	20	23:00s	1:00	S
    -# Whitman gives 1937 Jun 16, 1938 Apr 16, 1940 Apr 13;
    -# go with Shanks & Pottenger.
    -Rule	Spain	1937	only	-	May	22	23:00s	1:00	S
    -Rule	Spain	1937	1939	-	Oct	Sat>=1	23:00s	0	-
    -Rule	Spain	1938	only	-	Mar	22	23:00s	1:00	S
    -Rule	Spain	1939	only	-	Apr	15	23:00s	1:00	S
    -Rule	Spain	1940	only	-	Mar	16	23:00s	1:00	S
    -# Whitman says no DST 1942-1945; go with Shanks & Pottenger.
    -Rule	Spain	1942	only	-	May	 2	22:00s	2:00	M # Midsummer
    -Rule	Spain	1942	only	-	Sep	 1	22:00s	1:00	S
    -Rule	Spain	1943	1946	-	Apr	Sat>=13	22:00s	2:00	M
    -Rule	Spain	1943	only	-	Oct	 3	22:00s	1:00	S
    -Rule	Spain	1944	only	-	Oct	10	22:00s	1:00	S
    -Rule	Spain	1945	only	-	Sep	30	 1:00	1:00	S
    -Rule	Spain	1946	only	-	Sep	30	 0:00	0	-
    -Rule	Spain	1949	only	-	Apr	30	23:00	1:00	S
    -Rule	Spain	1949	only	-	Sep	30	 1:00	0	-
    -Rule	Spain	1974	1975	-	Apr	Sat>=13	23:00	1:00	S
    -Rule	Spain	1974	1975	-	Oct	Sun>=1	 1:00	0	-
    -Rule	Spain	1976	only	-	Mar	27	23:00	1:00	S
    -Rule	Spain	1976	1977	-	Sep	lastSun	 1:00	0	-
    -Rule	Spain	1977	1978	-	Apr	 2	23:00	1:00	S
    -Rule	Spain	1978	only	-	Oct	 1	 1:00	0	-
    -# The following rules are copied from Morocco from 1967 through 1978.
    -Rule SpainAfrica 1967	only	-	Jun	 3	12:00	1:00	S
    -Rule SpainAfrica 1967	only	-	Oct	 1	 0:00	0	-
    -Rule SpainAfrica 1974	only	-	Jun	24	 0:00	1:00	S
    -Rule SpainAfrica 1974	only	-	Sep	 1	 0:00	0	-
    -Rule SpainAfrica 1976	1977	-	May	 1	 0:00	1:00	S
    -Rule SpainAfrica 1976	only	-	Aug	 1	 0:00	0	-
    -Rule SpainAfrica 1977	only	-	Sep	28	 0:00	0	-
    -Rule SpainAfrica 1978	only	-	Jun	 1	 0:00	1:00	S
    -Rule SpainAfrica 1978	only	-	Aug	 4	 0:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Madrid	-0:14:44 -	LMT	1901 Jan  1  0:00s
    -			 0:00	Spain	WE%sT	1946 Sep 30
    -			 1:00	Spain	CE%sT	1979
    -			 1:00	EU	CE%sT
    -Zone	Africa/Ceuta	-0:21:16 -	LMT	1901
    -			 0:00	-	WET	1918 May  6 23:00
    -			 0:00	1:00	WEST	1918 Oct  7 23:00
    -			 0:00	-	WET	1924
    -			 0:00	Spain	WE%sT	1929
    -			 0:00 SpainAfrica WE%sT	1984 Mar 16
    -			 1:00	-	CET	1986
    -			 1:00	EU	CE%sT
    -Zone	Atlantic/Canary	-1:01:36 -	LMT	1922 Mar # Las Palmas de Gran C.
    -			-1:00	-	CANT	1946 Sep 30  1:00 # Canaries T
    -			 0:00	-	WET	1980 Apr  6  0:00s
    -			 0:00	1:00	WEST	1980 Sep 28  1:00u
    -			 0:00	EU	WE%sT
    -# IATA SSIM (1996-09) says the Canaries switch at 2:00u, not 1:00u.
    -# Ignore this for now, as the Canaries are part of the EU.
    -
    -# Sweden
    -
    -# From Ivan Nilsson (2001-04-13), superseding Shanks & Pottenger:
    -#
    -# The law "Svensk författningssamling 1878, no 14" about standard time in 1879:
    -# From the beginning of 1879 (that is 01-01 00:00) the time for all
    -# places in the country is "the mean solar time for the meridian at
    -# three degrees, or twelve minutes of time, to the west of the
    -# meridian of the Observatory of Stockholm".  The law is dated 1878-05-31.
    -#
    -# The observatory at that time had the meridian 18 degrees 03' 30"
    -# eastern longitude = 01:12:14 in time.  Less 12 minutes gives the
    -# national standard time as 01:00:14 ahead of GMT....
    -#
    -# About the beginning of CET in Sweden. The lawtext ("Svensk
    -# författningssamling 1899, no 44") states, that "from the beginning
    -# of 1900... ... the same as the mean solar time for the meridian at
    -# the distance of one hour of time from the meridian of the English
    -# observatory at Greenwich, or at 12 minutes 14 seconds to the west
    -# from the meridian of the Observatory of Stockholm". The law is dated
    -# 1899-06-16.  In short: At 1900-01-01 00:00:00 the new standard time
    -# in Sweden is 01:00:00 ahead of GMT.
    -#
    -# 1916: The lawtext ("Svensk författningssamling 1916, no 124") states
    -# that "1916-05-15 is considered to begin one hour earlier". It is
    -# pretty obvious that at 05-14 23:00 the clocks are set to 05-15 00:00....
    -# Further the law says, that "1916-09-30 is considered to end one hour later".
    -#
    -# The laws regulating [DST] are available on the site of the Swedish
    -# Parliament beginning with 1985 - the laws regulating 1980/1984 are
    -# not available on the site (to my knowledge they are only available
    -# in Swedish):  (type
    -# "sommartid" without the quotes in the field "Fritext" and then click
    -# the Sök-button).
    -#
    -# (2001-05-13):
    -#
    -# I have now found a newspaper stating that at 1916-10-01 01:00
    -# summertime the church-clocks etc were set back one hour to show
    -# 1916-10-01 00:00 standard time.  The article also reports that some
    -# people thought the switch to standard time would take place already
    -# at 1916-10-01 00:00 summer time, but they had to wait for another
    -# hour before the event took place.
    -#
    -# Source: The newspaper "Dagens Nyheter", 1916-10-01, page 7 upper left.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Europe/Stockholm	1:12:12 -	LMT	1879 Jan  1
    -			1:00:14	-	SET	1900 Jan  1 # Swedish Time
    -			1:00	-	CET	1916 May 14 23:00
    -			1:00	1:00	CEST	1916 Oct  1  1:00
    -			1:00	-	CET	1980
    -			1:00	EU	CE%sT
    -
    -# Switzerland
    -# From Howse:
    -# By the end of the 18th century clocks and watches became commonplace
    -# and their performance improved enormously.  Communities began to keep
    -# mean time in preference to apparent time - Geneva from 1780 ....
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -# From Whitman (who writes "Midnight?"):
    -# Rule	Swiss	1940	only	-	Nov	 2	0:00	1:00	S
    -# Rule	Swiss	1940	only	-	Dec	31	0:00	0	-
    -# From Shanks & Pottenger:
    -# Rule	Swiss	1941	1942	-	May	Sun>=1	2:00	1:00	S
    -# Rule	Swiss	1941	1942	-	Oct	Sun>=1	0:00	0	-
    -
    -# From Alois Treindl (2008-12-17):
    -# I have researched the DST usage in Switzerland during the 1940ies.
    -#
    -# As I wrote in an earlier message, I suspected the current tzdata values
    -# to be wrong. This is now verified.
    -#
    -# I have found copies of the original ruling by the Swiss Federal
    -# government, in 'Eidgenössische Gesetzessammlung 1941 and 1942' (Swiss
    -# federal law collection)...
    -#
    -# DST began on Monday 5 May 1941, 1:00 am by shifting the clocks to 2:00 am
    -# DST ended on Monday 6 Oct 1941, 2:00 am by shifting the clocks to 1:00 am.
    -#
    -# DST began on Monday, 4 May 1942 at 01:00 am
    -# DST ended on Monday, 5 Oct 1942 at 02:00 am
    -#
    -# There was no DST in 1940, I have checked the law collection carefully.
    -# It is also indicated by the fact that the 1942 entry in the law
    -# collection points back to 1941 as a reference, but no reference to any
    -# other years are made.
    -#
    -# Newspaper articles I have read in the archives on 6 May 1941 reported
    -# about the introduction of DST (Sommerzeit in German) during the previous
    -# night as an absolute novelty, because this was the first time that such
    -# a thing had happened in Switzerland.
    -#
    -# I have also checked 1916, because one book source (Gabriel, Traité de
    -# l'heure dans le monde) claims that Switzerland had DST in 1916. This is
    -# false, no official document could be found. Probably Gabriel got misled
    -# by references to Germany, which introduced DST in 1916 for the first time.
    -#
    -# The tzdata rules for Switzerland must be changed to:
    -# Rule  Swiss   1941    1942    -       May     Mon>=1  1:00    1:00    S
    -# Rule  Swiss   1941    1942    -       Oct     Mon>=1  2:00    0       -
    -#
    -# The 1940 rules must be deleted.
    -#
    -# One further detail for Switzerland, which is probably out of scope for
    -# most users of tzdata: The [Europe/Zurich zone] ...
    -# describes all of Switzerland correctly, with the exception of
    -# the Canton de Genève (Geneva, Genf). Between 1848 and 1894 Geneva did not
    -# follow Bern Mean Time but kept its own local mean time.
    -# To represent this, an extra zone would be needed.
    -#
    -# From Alois Treindl (2013-09-11):
    -# The Federal regulations say
    -# http://www.admin.ch/opc/de/classified-compilation/20071096/index.html
    -# ... the meridian for Bern mean time ... is 7 degrees 26' 22.50".
    -# Expressed in time, it is 0h29m45.5s.
    -
    -# From Pierre-Yves Berger (2013-09-11):
    -# the "Circulaire du conseil fédéral" (December 11 1893)
    -# http://www.amtsdruckschriften.bar.admin.ch/viewOrigDoc.do?id=10071353
    -# clearly states that the [1894-06-01] change should be done at midnight
    -# but if no one is present after 11 at night, could be postponed until one
    -# hour before the beginning of service.
    -
    -# From Paul Eggert (2013-09-11):
    -# Round BMT to the nearest even second, 0:29:46.
    -#
    -# We can find no reliable source for Shanks's assertion that all of Switzerland
    -# except Geneva switched to Bern Mean Time at 00:00 on 1848-09-12.  This book:
    -#
    -#	Jakob Messerli. Gleichmässig, pünktlich, schnell. Zeiteinteilung und
    -#	Zeitgebrauch in der Schweiz im 19. Jahrhundert. Chronos, Zurich 1995,
    -#	ISBN 3-905311-68-2, OCLC 717570797.
    -#
    -# suggests that the transition was more gradual, and that the Swiss did not
    -# agree about civil time during the transition.  The timekeeping it gives the
    -# most detail for is postal and telegraph time: here, federal legislation (the
    -# "Bundesgesetz über die Erstellung von elektrischen Telegraphen") passed on
    -# 1851-11-23, and an official implementation notice was published 1853-07-16
    -# (Bundesblatt 1853, Bd. II, S. 859).  On p 72 Messerli writes that in
    -# practice since July 1853 Bernese time was used in "all postal and telegraph
    -# offices in Switzerland from Geneva to St. Gallen and Basel to Chiasso"
    -# (Google translation).  For now, model this transition as occurring on
    -# 1853-07-16, though it probably occurred at some other date in Zurich, and
    -# legal civil time probably changed at still some other transition date.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Swiss	1941	1942	-	May	Mon>=1	1:00	1:00	S
    -Rule	Swiss	1941	1942	-	Oct	Mon>=1	2:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Zurich	0:34:08 -	LMT	1853 Jul 16 # See above comment.
    -			0:29:46	-	BMT	1894 Jun    # Bern Mean Time
    -			1:00	Swiss	CE%sT	1981
    -			1:00	EU	CE%sT
    -
    -# Turkey
    -
    -# From Amar Devegowda (2007-01-03):
    -# The time zone rules for Istanbul, Turkey have not been changed for years now.
    -# ... The latest rules are available at:
    -# http://www.timeanddate.com/worldclock/timezone.html?n=107
    -# From Steffen Thorsen (2007-01-03):
    -# I have been able to find press records back to 1996 which all say that
    -# DST started 01:00 local time and end at 02:00 local time.  I am not sure
    -# what happened before that.  One example for each year from 1996 to 2001:
    -# http://newspot.byegm.gov.tr/arsiv/1996/21/N4.htm
    -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING97/03/97X03X25.TXT
    -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING98/03/98X03X02.HTM
    -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING99/10/99X10X26.HTM#%2016
    -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2000/03/00X03X06.HTM#%2021
    -# http://www.byegm.gov.tr/YAYINLARIMIZ/CHR/ING2001/03/23x03x01.HTM#%2027
    -# From Paul Eggert (2007-01-03):
    -# Prefer the above source to Shanks & Pottenger for time stamps after 1990.
    -
    -# From Steffen Thorsen (2007-03-09):
    -# Starting 2007 though, it seems that they are adopting EU's 1:00 UTC
    -# start/end time, according to the following page (2007-03-07):
    -# http://www.ntvmsnbc.com/news/402029.asp
    -# The official document is located here - it is in Turkish...:
    -# http://rega.basbakanlik.gov.tr/eskiler/2007/03/20070307-7.htm
    -# I was able to locate the following seemingly official document
    -# (on a non-government server though) describing dates between 2002 and 2006:
    -# http://www.alomaliye.com/bkk_2002_3769.htm
    -
    -# From Gökdeniz Karadağ (2011-03-10):
    -# According to the articles linked below, Turkey will change into summer
    -# time zone (GMT+3) on March 28, 2011 at 3:00 a.m. instead of March 27.
    -# This change is due to a nationwide exam on 27th.
    -# http://www.worldbulletin.net/?aType=haber&ArticleID=70872
    -# Turkish:
    -# http://www.hurriyet.com.tr/ekonomi/17230464.asp?gid=373
    -
    -# From Faruk Pasin (2014-02-14):
    -# The DST for Turkey has been changed for this year because of the
    -# Turkish Local election....
    -# http://www.sabah.com.tr/Ekonomi/2014/02/12/yaz-saatinde-onemli-degisiklik
    -# ... so Turkey will move clocks forward one hour on March 31 at 3:00 a.m.
    -# From Randal L. Schwartz (2014-04-15):
    -# Having landed on a flight from the states to Istanbul (via AMS) on March 31,
    -# I can tell you that NOBODY (even the airlines) respected this timezone DST
    -# change delay.  Maybe the word just didn't get out in time.
    -# From Paul Eggert (2014-06-15):
    -# The press reported massive confusion, as election officials obeyed the rule
    -# change but cell phones (and airline baggage systems) did not.  See:
    -# Kostidis M. Eventful elections in Turkey. Balkan News Agency
    -# http://www.balkaneu.com/eventful-elections-turkey/ 2014-03-30.
    -# I guess the best we can do is document the official time.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Turkey	1916	only	-	May	 1	0:00	1:00	S
    -Rule	Turkey	1916	only	-	Oct	 1	0:00	0	-
    -Rule	Turkey	1920	only	-	Mar	28	0:00	1:00	S
    -Rule	Turkey	1920	only	-	Oct	25	0:00	0	-
    -Rule	Turkey	1921	only	-	Apr	 3	0:00	1:00	S
    -Rule	Turkey	1921	only	-	Oct	 3	0:00	0	-
    -Rule	Turkey	1922	only	-	Mar	26	0:00	1:00	S
    -Rule	Turkey	1922	only	-	Oct	 8	0:00	0	-
    -# Whitman gives 1923 Apr 28 - Sep 16 and no DST in 1924-1925;
    -# go with Shanks & Pottenger.
    -Rule	Turkey	1924	only	-	May	13	0:00	1:00	S
    -Rule	Turkey	1924	1925	-	Oct	 1	0:00	0	-
    -Rule	Turkey	1925	only	-	May	 1	0:00	1:00	S
    -Rule	Turkey	1940	only	-	Jun	30	0:00	1:00	S
    -Rule	Turkey	1940	only	-	Oct	 5	0:00	0	-
    -Rule	Turkey	1940	only	-	Dec	 1	0:00	1:00	S
    -Rule	Turkey	1941	only	-	Sep	21	0:00	0	-
    -Rule	Turkey	1942	only	-	Apr	 1	0:00	1:00	S
    -# Whitman omits the next two transition and gives 1945 Oct 1;
    -# go with Shanks & Pottenger.
    -Rule	Turkey	1942	only	-	Nov	 1	0:00	0	-
    -Rule	Turkey	1945	only	-	Apr	 2	0:00	1:00	S
    -Rule	Turkey	1945	only	-	Oct	 8	0:00	0	-
    -Rule	Turkey	1946	only	-	Jun	 1	0:00	1:00	S
    -Rule	Turkey	1946	only	-	Oct	 1	0:00	0	-
    -Rule	Turkey	1947	1948	-	Apr	Sun>=16	0:00	1:00	S
    -Rule	Turkey	1947	1950	-	Oct	Sun>=2	0:00	0	-
    -Rule	Turkey	1949	only	-	Apr	10	0:00	1:00	S
    -Rule	Turkey	1950	only	-	Apr	19	0:00	1:00	S
    -Rule	Turkey	1951	only	-	Apr	22	0:00	1:00	S
    -Rule	Turkey	1951	only	-	Oct	 8	0:00	0	-
    -Rule	Turkey	1962	only	-	Jul	15	0:00	1:00	S
    -Rule	Turkey	1962	only	-	Oct	 8	0:00	0	-
    -Rule	Turkey	1964	only	-	May	15	0:00	1:00	S
    -Rule	Turkey	1964	only	-	Oct	 1	0:00	0	-
    -Rule	Turkey	1970	1972	-	May	Sun>=2	0:00	1:00	S
    -Rule	Turkey	1970	1972	-	Oct	Sun>=2	0:00	0	-
    -Rule	Turkey	1973	only	-	Jun	 3	1:00	1:00	S
    -Rule	Turkey	1973	only	-	Nov	 4	3:00	0	-
    -Rule	Turkey	1974	only	-	Mar	31	2:00	1:00	S
    -Rule	Turkey	1974	only	-	Nov	 3	5:00	0	-
    -Rule	Turkey	1975	only	-	Mar	30	0:00	1:00	S
    -Rule	Turkey	1975	1976	-	Oct	lastSun	0:00	0	-
    -Rule	Turkey	1976	only	-	Jun	 1	0:00	1:00	S
    -Rule	Turkey	1977	1978	-	Apr	Sun>=1	0:00	1:00	S
    -Rule	Turkey	1977	only	-	Oct	16	0:00	0	-
    -Rule	Turkey	1979	1980	-	Apr	Sun>=1	3:00	1:00	S
    -Rule	Turkey	1979	1982	-	Oct	Mon>=11	0:00	0	-
    -Rule	Turkey	1981	1982	-	Mar	lastSun	3:00	1:00	S
    -Rule	Turkey	1983	only	-	Jul	31	0:00	1:00	S
    -Rule	Turkey	1983	only	-	Oct	 2	0:00	0	-
    -Rule	Turkey	1985	only	-	Apr	20	0:00	1:00	S
    -Rule	Turkey	1985	only	-	Sep	28	0:00	0	-
    -Rule	Turkey	1986	1990	-	Mar	lastSun	2:00s	1:00	S
    -Rule	Turkey	1986	1990	-	Sep	lastSun	2:00s	0	-
    -Rule	Turkey	1991	2006	-	Mar	lastSun	1:00s	1:00	S
    -Rule	Turkey	1991	1995	-	Sep	lastSun	1:00s	0	-
    -Rule	Turkey	1996	2006	-	Oct	lastSun	1:00s	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	Europe/Istanbul	1:55:52 -	LMT	1880
    -			1:56:56	-	IMT	1910 Oct # Istanbul Mean Time?
    -			2:00	Turkey	EE%sT	1978 Oct 15
    -			3:00	Turkey	TR%sT	1985 Apr 20 # Turkey Time
    -			2:00	Turkey	EE%sT	2007
    -			2:00	EU	EE%sT	2011 Mar 27  1:00u
    -			2:00	-	EET	2011 Mar 28  1:00u
    -			2:00	EU	EE%sT	2014 Mar 30  1:00u
    -			2:00	-	EET	2014 Mar 31  1:00u
    -			2:00	EU	EE%sT
    -Link	Europe/Istanbul	Asia/Istanbul	# Istanbul is in both continents.
    -
    -# Ukraine
    -#
    -# From Igor Karpov, who works for the Ukrainian Ministry of Justice,
    -# via Garrett Wollman (2003-01-27):
    -# BTW, I've found the official document on this matter. It's government
    -# regulations No. 509, May 13, 1996. In my poor translation it says:
    -# "Time in Ukraine is set to second timezone (Kiev time). Each last Sunday
    -# of March at 3am the time is changing to 4am and each last Sunday of
    -# October the time at 4am is changing to 3am"
    -
    -# From Alexander Krivenyshev (2011-09-20):
    -# On September 20, 2011 the deputies of the Verkhovna Rada agreed to
    -# abolish the transfer clock to winter time.
    -#
    -# Bill No. 8330 of MP from the Party of Regions Oleg Nadoshi got
    -# approval from 266 deputies.
    -#
    -# Ukraine abolishes transfer back to the winter time (in Russian)
    -# http://news.mail.ru/politics/6861560/
    -#
    -# The Ukrainians will no longer change the clock (in Russian)
    -# http://www.segodnya.ua/news/14290482.html
    -#
    -# Deputies cancelled the winter time (in Russian)
    -# http://www.pravda.com.ua/rus/news/2011/09/20/6600616/
    -#
    -# From Philip Pizzey (2011-10-18):
    -# Today my Ukrainian colleagues have informed me that the
    -# Ukrainian parliament have decided that they will go to winter
    -# time this year after all.
    -#
    -# From Udo Schwedt (2011-10-18):
    -# As far as I understand, the recent change to the Ukrainian time zone
    -# (Europe/Kiev) to introduce permanent daylight saving time (similar
    -# to Russia) was reverted today:
    -# http://portal.rada.gov.ua/rada/control/en/publish/article/info_left?art_id=287324&cat_id=105995
    -#
    -# Also reported by Alexander Bokovoy (2011-10-18) who also noted:
    -# The law documents themselves are at
    -# http://w1.c1.rada.gov.ua/pls/zweb_n/webproc4_1?id=&pf3511=41484
    -
    -# From Vladimir in Moscow via Alois Treindl re Kiev time 1991/2 (2014-02-28):
    -# First in Ukraine they changed Time zone from UTC+3 to UTC+2 with DST:
    -#       03 25 1990 02:00 -03.00 1       Time Zone 3 with DST
    -#       07 01 1990 02:00 -02.00 1       Time Zone 2 with DST
    -# * Ukrainian Government's Resolution of 18.06.1990, No. 134.
    -# http://search.ligazakon.ua/l_doc2.nsf/link1/T001500.html
    -#
    -# They did not end DST in September, 1990 (according to the law,
    -# "summer time" was still in action):
    -#       09 30 1990 03:00 -02.00 1       Time Zone 2 with DST
    -# * Ukrainian Government's Resolution of 21.09.1990, No. 272.
    -# http://search.ligazakon.ua/l_doc2.nsf/link1/KP900272.html
    -#
    -# Again no change in March, 1991 ("summer time" in action):
    -#       03 31 1991 02:00 -02.00 1       Time Zone 2 with DST
    -#
    -# DST ended in September 1991 ("summer time" ended):
    -#       09 29 1991 03:00 -02.00 0       Time Zone 2, no DST
    -# * Ukrainian Government's Resolution of 25.09.1991, No. 225.
    -# http://www.uazakon.com/documents/date_21/pg_iwgdoc.htm
    -# This is an answer.
    -#
    -# Since 1992 they had normal DST procedure:
    -#       03 29 1992 02:00 -02.00 1       DST started
    -#       09 27 1992 03:00 -02.00 0       DST ended
    -# * Ukrainian Government's Resolution of 20.03.1992, No. 139.
    -# http://www.uazakon.com/documents/date_8u/pg_grcasa.htm
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -# Most of Ukraine since 1970 has been like Kiev.
    -# "Kyiv" is the transliteration of the Ukrainian name, but
    -# "Kiev" is more common in English.
    -Zone Europe/Kiev	2:02:04 -	LMT	1880
    -			2:02:04	-	KMT	1924 May  2 # Kiev Mean Time
    -			2:00	-	EET	1930 Jun 21
    -			3:00	-	MSK	1941 Sep 20
    -			1:00	C-Eur	CE%sT	1943 Nov  6
    -			3:00	Russia	MSK/MSD	1990 Jul  1  2:00
    -			2:00	1:00	EEST	1991 Sep 29  3:00
    -			2:00	E-Eur	EE%sT	1995
    -			2:00	EU	EE%sT
    -# Ruthenia used CET 1990/1991.
    -# "Uzhhorod" is the transliteration of the Rusyn/Ukrainian pronunciation, but
    -# "Uzhgorod" is more common in English.
    -Zone Europe/Uzhgorod	1:29:12 -	LMT	1890 Oct
    -			1:00	-	CET	1940
    -			1:00	C-Eur	CE%sT	1944 Oct
    -			1:00	1:00	CEST	1944 Oct 26
    -			1:00	-	CET	1945 Jun 29
    -			3:00	Russia	MSK/MSD	1990
    -			3:00	-	MSK	1990 Jul  1  2:00
    -			1:00	-	CET	1991 Mar 31  3:00
    -			2:00	-	EET	1992
    -			2:00	E-Eur	EE%sT	1995
    -			2:00	EU	EE%sT
    -# Zaporozh'ye and eastern Lugansk oblasts observed DST 1990/1991.
    -# "Zaporizhia" is the transliteration of the Ukrainian name, but
    -# "Zaporozh'ye" is more common in English.  Use the common English
    -# spelling, except omit the apostrophe as it is not allowed in
    -# portable Posix file names.
    -Zone Europe/Zaporozhye	2:20:40 -	LMT	1880
    -			2:20	-	CUT	1924 May  2 # Central Ukraine T
    -			2:00	-	EET	1930 Jun 21
    -			3:00	-	MSK	1941 Aug 25
    -			1:00	C-Eur	CE%sT	1943 Oct 25
    -			3:00	Russia	MSK/MSD	1991 Mar 31  2:00
    -			2:00	E-Eur	EE%sT	1995
    -			2:00	EU	EE%sT
    -
    -# Vatican City
    -# See Europe/Rome.
    -
    -###############################################################################
    -
    -# One source shows that Bulgaria, Cyprus, Finland, and Greece observe DST from
    -# the last Sunday in March to the last Sunday in September in 1986.
    -# The source shows Romania changing a day later than everybody else.
    -#
    -# According to Bernard Sieloff's source, Poland is in the MET time zone but
    -# uses the WE DST rules.  The Western USSR uses EET+1 and ME DST rules.
    -# Bernard Sieloff's source claims Romania switches on the same day, but at
    -# 00:00 standard time (i.e., 01:00 DST).  It also claims that Turkey
    -# switches on the same day, but switches on at 01:00 standard time
    -# and off at 00:00 standard time (i.e., 01:00 DST)
    -
    -# ...
    -# Date: Wed, 28 Jan 87 16:56:27 -0100
    -# From: Tom Hofmann
    -# ...
    -#
    -# ...the European time rules are...standardized since 1981, when
    -# most European countries started DST.  Before that year, only
    -# a few countries (UK, France, Italy) had DST, each according
    -# to own national rules.  In 1981, however, DST started on
    -# 'Apr firstSun', and not on 'Mar lastSun' as in the following
    -# years...
    -# But also since 1981 there are some more national exceptions
    -# than listed in 'europe': Switzerland, for example, joined DST
    -# one year later, Denmark ended DST on 'Oct 1' instead of 'Sep
    -# lastSun' in 1981 - I don't know how they handle now.
    -#
    -# Finally, DST ist always from 'Apr 1' to 'Oct 1' in the
    -# Soviet Union (as far as I know).
    -#
    -# Tom Hofmann, Scientific Computer Center, CIBA-GEIGY AG,
    -# 4002 Basle, Switzerland
    -# ...
    -
    -# ...
    -# Date: Wed, 4 Feb 87 22:35:22 +0100
    -# From: Dik T. Winter
    -# ...
    -#
    -# The information from Tom Hofmann is (as far as I know) not entirely correct.
    -# After a request from chongo at amdahl I tried to retrieve all information
    -# about DST in Europe.  I was able to find all from about 1969.
    -#
    -# ...standardization on DST in Europe started in about 1977 with switches on
    -# first Sunday in April and last Sunday in September...
    -# In 1981 UK joined Europe insofar that
    -# the starting day for both shifted to last Sunday in March.  And from 1982
    -# the whole of Europe used DST, with switch dates April 1 and October 1 in
    -# the Sov[i]et Union.  In 1985 the SU reverted to standard Europe[a]n switch
    -# dates...
    -#
    -# It should also be remembered that time-zones are not constants; e.g.
    -# Portugal switched in 1976 from MET (or CET) to WET with DST...
    -# Note also that though there were rules for switch dates not
    -# all countries abided to these dates, and many individual deviations
    -# occurred, though not since 1982 I believe.  Another note: it is always
    -# assumed that DST is 1 hour ahead of normal time, this need not be the
    -# case; at least in the Netherlands there have been times when DST was 2 hours
    -# in advance of normal time.
    -#
    -# ...
    -# dik t. winter, cwi, amsterdam, nederland
    -# ...
    -
    -# From Bob Devine (1988-01-28):
    -# ...
    -# Greece: Last Sunday in April to last Sunday in September (iffy on dates).
    -# Since 1978.  Change at midnight.
    -# ...
    -# Monaco: has same DST as France.
    -# ...
    diff --git a/external/public-domain/tz/dist/factory b/external/public-domain/tz/dist/factory
    deleted file mode 100644
    index 4304f7cf7..000000000
    --- a/external/public-domain/tz/dist/factory
    +++ /dev/null
    @@ -1,9 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# For companies who don't want to put time zone specification in
    -# their installation procedures.  When users run date, they'll get the message.
    -# Also useful for the "comp.sources" version.
    -
    -# Zone	NAME	GMTOFF	RULES	FORMAT
    -Zone	Factory	0	- "Local time zone must be set--see zic manual page"
    diff --git a/external/public-domain/tz/dist/iso3166.tab b/external/public-domain/tz/dist/iso3166.tab
    deleted file mode 100644
    index 0548800e2..000000000
    --- a/external/public-domain/tz/dist/iso3166.tab
    +++ /dev/null
    @@ -1,274 +0,0 @@
    -# ISO 3166 alpha-2 country codes
    -#
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -#
    -# From Paul Eggert (2015-05-02):
    -# This file contains a table of two-letter country codes.  Columns are
    -# separated by a single tab.  Lines beginning with '#' are comments.
    -# All text uses UTF-8 encoding.  The columns of the table are as follows:
    -#
    -# 1.  ISO 3166-1 alpha-2 country code, current as of
    -#     ISO 3166-1 Newsletter VI-16 (2013-07-11).  See: Updates on ISO 3166
    -#   http://www.iso.org/iso/home/standards/country_codes/updates_on_iso_3166.htm
    -# 2.  The usual English name for the coded region,
    -#     chosen so that alphabetic sorting of subsets produces helpful lists.
    -#     This is not the same as the English name in the ISO 3166 tables.
    -#
    -# The table is sorted by country code.
    -#
    -# This table is intended as an aid for users, to help them select time
    -# zone data appropriate for their practical needs.  It is not intended
    -# to take or endorse any position on legal or territorial claims.
    -#
    -#country-
    -#code	name of country, territory, area, or subdivision
    -AD	Andorra
    -AE	United Arab Emirates
    -AF	Afghanistan
    -AG	Antigua & Barbuda
    -AI	Anguilla
    -AL	Albania
    -AM	Armenia
    -AO	Angola
    -AQ	Antarctica
    -AR	Argentina
    -AS	Samoa (American)
    -AT	Austria
    -AU	Australia
    -AW	Aruba
    -AX	Ã…land Islands
    -AZ	Azerbaijan
    -BA	Bosnia & Herzegovina
    -BB	Barbados
    -BD	Bangladesh
    -BE	Belgium
    -BF	Burkina Faso
    -BG	Bulgaria
    -BH	Bahrain
    -BI	Burundi
    -BJ	Benin
    -BL	St Barthelemy
    -BM	Bermuda
    -BN	Brunei
    -BO	Bolivia
    -BQ	Caribbean Netherlands
    -BR	Brazil
    -BS	Bahamas
    -BT	Bhutan
    -BV	Bouvet Island
    -BW	Botswana
    -BY	Belarus
    -BZ	Belize
    -CA	Canada
    -CC	Cocos (Keeling) Islands
    -CD	Congo (Dem. Rep.)
    -CF	Central African Rep.
    -CG	Congo (Rep.)
    -CH	Switzerland
    -CI	Côte d'Ivoire
    -CK	Cook Islands
    -CL	Chile
    -CM	Cameroon
    -CN	China
    -CO	Colombia
    -CR	Costa Rica
    -CU	Cuba
    -CV	Cape Verde
    -CW	Curacao
    -CX	Christmas Island
    -CY	Cyprus
    -CZ	Czech Republic
    -DE	Germany
    -DJ	Djibouti
    -DK	Denmark
    -DM	Dominica
    -DO	Dominican Republic
    -DZ	Algeria
    -EC	Ecuador
    -EE	Estonia
    -EG	Egypt
    -EH	Western Sahara
    -ER	Eritrea
    -ES	Spain
    -ET	Ethiopia
    -FI	Finland
    -FJ	Fiji
    -FK	Falkland Islands
    -FM	Micronesia
    -FO	Faroe Islands
    -FR	France
    -GA	Gabon
    -GB	Britain (UK)
    -GD	Grenada
    -GE	Georgia
    -GF	French Guiana
    -GG	Guernsey
    -GH	Ghana
    -GI	Gibraltar
    -GL	Greenland
    -GM	Gambia
    -GN	Guinea
    -GP	Guadeloupe
    -GQ	Equatorial Guinea
    -GR	Greece
    -GS	South Georgia & the South Sandwich Islands
    -GT	Guatemala
    -GU	Guam
    -GW	Guinea-Bissau
    -GY	Guyana
    -HK	Hong Kong
    -HM	Heard Island & McDonald Islands
    -HN	Honduras
    -HR	Croatia
    -HT	Haiti
    -HU	Hungary
    -ID	Indonesia
    -IE	Ireland
    -IL	Israel
    -IM	Isle of Man
    -IN	India
    -IO	British Indian Ocean Territory
    -IQ	Iraq
    -IR	Iran
    -IS	Iceland
    -IT	Italy
    -JE	Jersey
    -JM	Jamaica
    -JO	Jordan
    -JP	Japan
    -KE	Kenya
    -KG	Kyrgyzstan
    -KH	Cambodia
    -KI	Kiribati
    -KM	Comoros
    -KN	St Kitts & Nevis
    -KP	Korea (North)
    -KR	Korea (South)
    -KW	Kuwait
    -KY	Cayman Islands
    -KZ	Kazakhstan
    -LA	Laos
    -LB	Lebanon
    -LC	St Lucia
    -LI	Liechtenstein
    -LK	Sri Lanka
    -LR	Liberia
    -LS	Lesotho
    -LT	Lithuania
    -LU	Luxembourg
    -LV	Latvia
    -LY	Libya
    -MA	Morocco
    -MC	Monaco
    -MD	Moldova
    -ME	Montenegro
    -MF	St Martin (French part)
    -MG	Madagascar
    -MH	Marshall Islands
    -MK	Macedonia
    -ML	Mali
    -MM	Myanmar (Burma)
    -MN	Mongolia
    -MO	Macau
    -MP	Northern Mariana Islands
    -MQ	Martinique
    -MR	Mauritania
    -MS	Montserrat
    -MT	Malta
    -MU	Mauritius
    -MV	Maldives
    -MW	Malawi
    -MX	Mexico
    -MY	Malaysia
    -MZ	Mozambique
    -NA	Namibia
    -NC	New Caledonia
    -NE	Niger
    -NF	Norfolk Island
    -NG	Nigeria
    -NI	Nicaragua
    -NL	Netherlands
    -NO	Norway
    -NP	Nepal
    -NR	Nauru
    -NU	Niue
    -NZ	New Zealand
    -OM	Oman
    -PA	Panama
    -PE	Peru
    -PF	French Polynesia
    -PG	Papua New Guinea
    -PH	Philippines
    -PK	Pakistan
    -PL	Poland
    -PM	St Pierre & Miquelon
    -PN	Pitcairn
    -PR	Puerto Rico
    -PS	Palestine
    -PT	Portugal
    -PW	Palau
    -PY	Paraguay
    -QA	Qatar
    -RE	Réunion
    -RO	Romania
    -RS	Serbia
    -RU	Russia
    -RW	Rwanda
    -SA	Saudi Arabia
    -SB	Solomon Islands
    -SC	Seychelles
    -SD	Sudan
    -SE	Sweden
    -SG	Singapore
    -SH	St Helena
    -SI	Slovenia
    -SJ	Svalbard & Jan Mayen
    -SK	Slovakia
    -SL	Sierra Leone
    -SM	San Marino
    -SN	Senegal
    -SO	Somalia
    -SR	Suriname
    -SS	South Sudan
    -ST	Sao Tome & Principe
    -SV	El Salvador
    -SX	St Maarten (Dutch part)
    -SY	Syria
    -SZ	Swaziland
    -TC	Turks & Caicos Is
    -TD	Chad
    -TF	French Southern & Antarctic Lands
    -TG	Togo
    -TH	Thailand
    -TJ	Tajikistan
    -TK	Tokelau
    -TL	East Timor
    -TM	Turkmenistan
    -TN	Tunisia
    -TO	Tonga
    -TR	Turkey
    -TT	Trinidad & Tobago
    -TV	Tuvalu
    -TW	Taiwan
    -TZ	Tanzania
    -UA	Ukraine
    -UG	Uganda
    -UM	US minor outlying islands
    -US	United States
    -UY	Uruguay
    -UZ	Uzbekistan
    -VA	Vatican City
    -VC	St Vincent
    -VE	Venezuela
    -VG	Virgin Islands (UK)
    -VI	Virgin Islands (US)
    -VN	Vietnam
    -VU	Vanuatu
    -WF	Wallis & Futuna
    -WS	Samoa (western)
    -YE	Yemen
    -YT	Mayotte
    -ZA	South Africa
    -ZM	Zambia
    -ZW	Zimbabwe
    diff --git a/external/public-domain/tz/dist/leap-seconds.list b/external/public-domain/tz/dist/leap-seconds.list
    deleted file mode 100644
    index 0a0bacbb9..000000000
    --- a/external/public-domain/tz/dist/leap-seconds.list
    +++ /dev/null
    @@ -1,249 +0,0 @@
    -#
    -#	In the following text, the symbol '#' introduces
    -#	a comment, which continues from that symbol until
    -#	the end of the line. A plain comment line has a
    -#	whitespace character following the comment indicator.
    -#	There are also special comment lines defined below.
    -#	A special comment will always have a non-whitespace
    -#	character in column 2.
    -#
    -#	A blank line should be ignored.
    -#
    -#	The following table shows the corrections that must
    -#	be applied to compute International Atomic Time (TAI)
    -#	from the Coordinated Universal Time (UTC) values that
    -#	are transmitted by almost all time services.
    -#
    -#	The first column shows an epoch as a number of seconds
    -#	since 1 January 1900, 00:00:00 (1900.0 is also used to
    -#	indicate the same epoch.) Both of these time stamp formats
    -#	ignore the complexities of the time scales that were
    -#	used before the current definition of UTC at the start
    -#	of 1972. (See note 3 below.)
    -#	The second column shows the number of seconds that
    -#	must be added to UTC to compute TAI for any timestamp
    -#	at or after that epoch. The value on each line is
    -#	valid from the indicated initial instant until the
    -#	epoch given on the next one or indefinitely into the
    -#	future if there is no next line.
    -#	(The comment on each line shows the representation of
    -#	the corresponding initial epoch in the usual
    -#	day-month-year format. The epoch always begins at
    -#	00:00:00 UTC on the indicated day. See Note 5 below.)
    -#
    -#	Important notes:
    -#
    -#	1. Coordinated Universal Time (UTC) is often referred to
    -#	as Greenwich Mean Time (GMT). The GMT time scale is no
    -#	longer used, and the use of GMT to designate UTC is
    -#	discouraged.
    -#
    -#	2. The UTC time scale is realized by many national
    -#	laboratories and timing centers. Each laboratory
    -#	identifies its realization with its name: Thus
    -#	UTC(NIST), UTC(USNO), etc. The differences among
    -#	these different realizations are typically on the
    -#	order of a few nanoseconds (i.e., 0.000 000 00x s)
    -#	and can be ignored for many purposes. These differences
    -#	are tabulated in Circular T, which is published monthly
    -#	by the International Bureau of Weights and Measures
    -#	(BIPM). See www.bipm.org for more information.
    -#
    -#	3. The current definition of the relationship between UTC
    -#	and TAI dates from 1 January 1972. A number of different
    -#	time scales were in use before that epoch, and it can be
    -#	quite difficult to compute precise timestamps and time
    -#	intervals in those "prehistoric" days. For more information,
    -#	consult:
    -#
    -#		The Explanatory Supplement to the Astronomical
    -#		Ephemeris.
    -#	or
    -#		Terry Quinn, "The BIPM and the Accurate Measurement
    -#		of Time," Proc. of the IEEE, Vol. 79, pp. 894-905,
    -#		July, 1991.
    -#
    -#	4. The decision to insert a leap second into UTC is currently
    -#	the responsibility of the International Earth Rotation and
    -#	Reference Systems Service. (The name was changed from the
    -#	International Earth Rotation Service, but the acronym IERS
    -#	is still used.)
    -#
    -#	Leap seconds are announced by the IERS in its Bulletin C.
    -#
    -#	See www.iers.org for more details.
    -#
    -#	Every national laboratory and timing center uses the
    -#	data from the BIPM and the IERS to construct UTC(lab),
    -#	their local realization of UTC.
    -#
    -#	Although the definition also includes the possibility
    -#	of dropping seconds ("negative" leap seconds), this has
    -#	never been done and is unlikely to be necessary in the
    -#	foreseeable future.
    -#
    -#	5. If your system keeps time as the number of seconds since
    -#	some epoch (e.g., NTP timestamps), then the algorithm for
    -#	assigning a UTC time stamp to an event that happens during a positive
    -#	leap second is not well defined. The official name of that leap
    -#	second is 23:59:60, but there is no way of representing that time
    -#	in these systems.
    -#	Many systems of this type effectively stop the system clock for
    -#	one second during the leap second and use a time that is equivalent
    -#	to 23:59:59 UTC twice. For these systems, the corresponding TAI
    -#	timestamp would be obtained by advancing to the next entry in the
    -#	following table when the time equivalent to 23:59:59 UTC
    -#	is used for the second time. Thus the leap second which
    -#	occurred on 30 June 1972 at 23:59:59 UTC would have TAI
    -#	timestamps computed as follows:
    -#
    -#	...
    -#	30 June 1972 23:59:59 (2287785599, first time):	TAI= UTC + 10 seconds
    -#	30 June 1972 23:59:60 (2287785599,second time):	TAI= UTC + 11 seconds
    -#	1  July 1972 00:00:00 (2287785600)		TAI= UTC + 11 seconds
    -#	...
    -#
    -#	If your system realizes the leap second by repeating 00:00:00 UTC twice
    -#	(this is possible but not usual), then the advance to the next entry
    -#	in the table must occur the second time that a time equivalent to
    -#	00:00:00 UTC is used. Thus, using the same example as above:
    -#
    -#	...
    -#       30 June 1972 23:59:59 (2287785599):		TAI= UTC + 10 seconds
    -#       30 June 1972 23:59:60 (2287785600, first time):	TAI= UTC + 10 seconds
    -#       1  July 1972 00:00:00 (2287785600,second time):	TAI= UTC + 11 seconds
    -#	...
    -#
    -#	in both cases the use of timestamps based on TAI produces a smooth
    -#	time scale with no discontinuity in the time interval. However,
    -#	although the long-term behavior of the time scale is correct in both
    -#	methods, the second method is technically not correct because it adds
    -#	the extra second to the wrong day.
    -#
    -#	This complexity would not be needed for negative leap seconds (if they
    -#	are ever used). The UTC time would skip 23:59:59 and advance from
    -#	23:59:58 to 00:00:00 in that case. The TAI offset would decrease by
    -#	1 second at the same instant. This is a much easier situation to deal
    -#	with, since the difficulty of unambiguously representing the epoch
    -#	during the leap second does not arise.
    -#
    -#	Some systems implement leap seconds by amortizing the leap second
    -#	over the last few minutes of the day. The frequency of the local
    -#	clock is decreased (or increased) to realize the positive (or
    -#	negative) leap second. This method removes the time step described
    -#	above. Although the long-term behavior of the time scale is correct
    -#	in this case, this method introduces an error during the adjustment
    -#	period both in time and in frequency with respect to the official
    -#	definition of UTC.
    -#
    -#	Questions or comments to:
    -#		Judah Levine
    -#		Time and Frequency Division
    -#		NIST
    -#		Boulder, Colorado
    -#		Judah.Levine@nist.gov
    -#
    -#	Last Update of leap second values:   5 January 2015
    -#
    -#	The following line shows this last update date in NTP timestamp
    -#	format. This is the date on which the most recent change to
    -#	the leap second data was added to the file. This line can
    -#	be identified by the unique pair of characters in the first two
    -#	columns as shown below.
    -#
    -#$	 3629404800
    -#
    -#	The NTP timestamps are in units of seconds since the NTP epoch,
    -#	which is 1 January 1900, 00:00:00. The Modified Julian Day number
    -#	corresponding to the NTP time stamp, X, can be computed as
    -#
    -#	X/86400 + 15020
    -#
    -#	where the first term converts seconds to days and the second
    -#	term adds the MJD corresponding to the time origin defined above.
    -#	The integer portion of the result is the integer MJD for that
    -#	day, and any remainder is the time of day, expressed as the
    -#	fraction of the day since 0 hours UTC. The conversion from day
    -#	fraction to seconds or to hours, minutes, and seconds may involve
    -#	rounding or truncation, depending on the method used in the
    -#	computation.
    -#
    -#	The data in this file will be updated periodically as new leap
    -#	seconds are announced. In addition to being entered on the line
    -#	above, the update time (in NTP format) will be added to the basic
    -#	file name leap-seconds to form the name leap-seconds..
    -#	In addition, the generic name leap-seconds.list will always point to
    -#	the most recent version of the file.
    -#
    -#	This update procedure will be performed only when a new leap second
    -#	is announced.
    -#
    -#	The following entry specifies the expiration date of the data
    -#	in this file in units of seconds since the origin at the instant
    -#	1 January 1900, 00:00:00. This expiration date will be changed
    -#	at least twice per year whether or not a new leap second is
    -#	announced. These semi-annual changes will be made no later
    -#	than 1 June and 1 December of each year to indicate what
    -#	action (if any) is to be taken on 30 June and 31 December,
    -#	respectively. (These are the customary effective dates for new
    -#	leap seconds.) This expiration date will be identified by a
    -#	unique pair of characters in columns 1 and 2 as shown below.
    -#	In the unlikely event that a leap second is announced with an
    -#	effective date other than 30 June or 31 December, then this
    -#	file will be edited to include that leap second as soon as it is
    -#	announced or at least one month before the effective date
    -#	(whichever is later).
    -#	If an announcement by the IERS specifies that no leap second is
    -#	scheduled, then only the expiration date of the file will
    -#	be advanced to show that the information in the file is still
    -#	current -- the update time stamp, the data and the name of the file
    -#	will not change.
    -#
    -#	Updated through IERS Bulletin C50
    -#	File expires on:  28 June 2016
    -#
    -#@	3676060800
    -#
    -2272060800	10	# 1 Jan 1972
    -2287785600	11	# 1 Jul 1972
    -2303683200	12	# 1 Jan 1973
    -2335219200	13	# 1 Jan 1974
    -2366755200	14	# 1 Jan 1975
    -2398291200	15	# 1 Jan 1976
    -2429913600	16	# 1 Jan 1977
    -2461449600	17	# 1 Jan 1978
    -2492985600	18	# 1 Jan 1979
    -2524521600	19	# 1 Jan 1980
    -2571782400	20	# 1 Jul 1981
    -2603318400	21	# 1 Jul 1982
    -2634854400	22	# 1 Jul 1983
    -2698012800	23	# 1 Jul 1985
    -2776982400	24	# 1 Jan 1988
    -2840140800	25	# 1 Jan 1990
    -2871676800	26	# 1 Jan 1991
    -2918937600	27	# 1 Jul 1992
    -2950473600	28	# 1 Jul 1993
    -2982009600	29	# 1 Jul 1994
    -3029443200	30	# 1 Jan 1996
    -3076704000	31	# 1 Jul 1997
    -3124137600	32	# 1 Jan 1999
    -3345062400	33	# 1 Jan 2006
    -3439756800	34	# 1 Jan 2009
    -3550089600	35	# 1 Jul 2012
    -3644697600	36	# 1 Jul 2015
    -#
    -#	the following special comment contains the
    -#	hash value of the data in this file computed
    -#	use the secure hash algorithm as specified
    -#	by FIPS 180-1. See the files in ~/pub/sha for
    -#	the details of how this hash value is
    -#	computed. Note that the hash computation
    -#	ignores comments and whitespace characters
    -#	in data lines. It includes the NTP values
    -#	of both the last modification time and the
    -#	expiration time of the file, but not the
    -#	white space on those lines.
    -#	the hash line is also ignored in the
    -#	computation.
    -#
    -#h	3d037453 3acade76 570bd8f8 be2b8bc9 55ec6fe8
    diff --git a/external/public-domain/tz/dist/leapseconds b/external/public-domain/tz/dist/leapseconds
    deleted file mode 100644
    index 70ec6d1b5..000000000
    --- a/external/public-domain/tz/dist/leapseconds
    +++ /dev/null
    @@ -1,60 +0,0 @@
    -# Allowance for leap seconds added to each time zone file.
    -
    -# This file is in the public domain.
    -
    -# This file is generated automatically from the data in the public-domain
    -# leap-seconds.list file available from most NIST time servers.
    -# If the URL  does not work,
    -# you should be able to pick up leap-seconds.list from a secondary NIST server.
    -# For more about leap-seconds.list, please see
    -# The NTP Timescale and Leap Seconds
    -# http://www.eecis.udel.edu/~mills/leap.html
    -
    -# The International Earth Rotation and Reference Systems Service
    -# periodically uses leap seconds to keep UTC to within 0.9 s of UT1
    -# (which measures the true angular orientation of the earth in space); see
    -# Terry J Quinn, The BIPM and the accurate measure of time,
    -# Proc IEEE 79, 7 (July 1991), 894-905 .
    -# There were no leap seconds before 1972, because the official mechanism
    -# accounting for the discrepancy between atomic time and the earth's rotation
    -# did not exist until the early 1970s.
    -
    -# The correction (+ or -) is made at the given time, so lines
    -# will typically look like:
    -#	Leap	YEAR	MON	DAY	23:59:60	+	R/S
    -# or
    -#	Leap	YEAR	MON	DAY	23:59:59	-	R/S
    -
    -# If the leapsecond is Rolling (R) the given time is local time.
    -# If the leapsecond is Stationary (S) the given time is UTC.
    -
    -# Leap	YEAR	MONTH	DAY	HH:MM:SS	CORR	R/S
    -Leap	1972	Jun	30	23:59:60	+	S
    -Leap	1972	Dec	31	23:59:60	+	S
    -Leap	1973	Dec	31	23:59:60	+	S
    -Leap	1974	Dec	31	23:59:60	+	S
    -Leap	1975	Dec	31	23:59:60	+	S
    -Leap	1976	Dec	31	23:59:60	+	S
    -Leap	1977	Dec	31	23:59:60	+	S
    -Leap	1978	Dec	31	23:59:60	+	S
    -Leap	1979	Dec	31	23:59:60	+	S
    -Leap	1981	Jun	30	23:59:60	+	S
    -Leap	1982	Jun	30	23:59:60	+	S
    -Leap	1983	Jun	30	23:59:60	+	S
    -Leap	1985	Jun	30	23:59:60	+	S
    -Leap	1987	Dec	31	23:59:60	+	S
    -Leap	1989	Dec	31	23:59:60	+	S
    -Leap	1990	Dec	31	23:59:60	+	S
    -Leap	1992	Jun	30	23:59:60	+	S
    -Leap	1993	Jun	30	23:59:60	+	S
    -Leap	1994	Jun	30	23:59:60	+	S
    -Leap	1995	Dec	31	23:59:60	+	S
    -Leap	1997	Jun	30	23:59:60	+	S
    -Leap	1998	Dec	31	23:59:60	+	S
    -Leap	2005	Dec	31	23:59:60	+	S
    -Leap	2008	Dec	31	23:59:60	+	S
    -Leap	2012	Jun	30	23:59:60	+	S
    -Leap	2015	Jun	30	23:59:60	+	S
    -
    -#	Updated through IERS Bulletin C50
    -#	File expires on:  28 June 2016
    diff --git a/external/public-domain/tz/dist/leapseconds.awk b/external/public-domain/tz/dist/leapseconds.awk
    deleted file mode 100644
    index 756391e99..000000000
    --- a/external/public-domain/tz/dist/leapseconds.awk
    +++ /dev/null
    @@ -1,75 +0,0 @@
    -# Generate the 'leapseconds' file from 'leap-seconds.list'.
    -
    -# This file is in the public domain.
    -
    -BEGIN {
    -  print "# Allowance for leap seconds added to each time zone file."
    -  print ""
    -  print "# This file is in the public domain."
    -  print ""
    -  print "# This file is generated automatically from the data in the public-domain"
    -  print "# leap-seconds.list file available from most NIST time servers."
    -  print "# If the URL  does not work,"
    -  print "# you should be able to pick up leap-seconds.list from a secondary NIST server."
    -  print "# For more about leap-seconds.list, please see"
    -  print "# The NTP Timescale and Leap Seconds"
    -  print "# http://www.eecis.udel.edu/~mills/leap.html"
    -  print ""
    -  print "# The International Earth Rotation and Reference Systems Service"
    -  print "# periodically uses leap seconds to keep UTC to within 0.9 s of UT1"
    -  print "# (which measures the true angular orientation of the earth in space); see"
    -  print "# Terry J Quinn, The BIPM and the accurate measure of time,"
    -  print "# Proc IEEE 79, 7 (July 1991), 894-905 ."
    -  print "# There were no leap seconds before 1972, because the official mechanism"
    -  print "# accounting for the discrepancy between atomic time and the earth's rotation"
    -  print "# did not exist until the early 1970s."
    -  print ""
    -  print "# The correction (+ or -) is made at the given time, so lines"
    -  print "# will typically look like:"
    -  print "#	Leap	YEAR	MON	DAY	23:59:60	+	R/S"
    -  print "# or"
    -  print "#	Leap	YEAR	MON	DAY	23:59:59	-	R/S"
    -  print ""
    -  print "# If the leapsecond is Rolling (R) the given time is local time."
    -  print "# If the leapsecond is Stationary (S) the given time is UTC."
    -  print ""
    -  print "# Leap	YEAR	MONTH	DAY	HH:MM:SS	CORR	R/S"
    -}
    -
    -/^ *$/ { next }
    -
    -/^#\tUpdated through/ || /^#\tFile expires on:/ {
    -    last_lines = last_lines $0 "\n"
    -}
    -
    -/^#/ { next }
    -
    -{
    -    NTP_timestamp = $1
    -    TAI_minus_UTC = $2
    -    hash_mark = $3
    -    one = $4
    -    month = $5
    -    year = $6
    -    if (old_TAI_minus_UTC) {
    -	if (old_TAI_minus_UTC < TAI_minus_UTC) {
    -	    sign = "23:59:60\t+"
    -	} else {
    -	    sign = "23:59:59\t-"
    -	}
    -	if (month == "Jan") {
    -	    year--;
    -	    month = "Dec";
    -	    day = 31
    -	} else if (month == "Jul") {
    -	    month = "Jun";
    -	    day = 30
    -	}
    -	printf "Leap\t%s\t%s\t%s\t%s\tS\n", year, month, day, sign
    -    }
    -    old_TAI_minus_UTC = TAI_minus_UTC
    -}
    -
    -END {
    -    printf "\n%s", last_lines
    -}
    diff --git a/external/public-domain/tz/dist/northamerica b/external/public-domain/tz/dist/northamerica
    deleted file mode 100644
    index 660a92085..000000000
    --- a/external/public-domain/tz/dist/northamerica
    +++ /dev/null
    @@ -1,3269 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# also includes Central America and the Caribbean
    -
    -# This file is by no means authoritative; if you think you know better,
    -# go ahead and edit the file (and please send any changes to
    -# tz@iana.org for general use in the future).  For more, please see
    -# the file CONTRIBUTING in the tz distribution.
    -
    -# From Paul Eggert (1999-03-22):
    -# A reliable and entertaining source about time zones is
    -# Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
    -
    -###############################################################################
    -
    -# United States
    -
    -# From Paul Eggert (1999-03-31):
    -# Howse writes (pp 121-125) that time zones were invented by
    -# Professor Charles Ferdinand Dowd (1825-1904),
    -# Principal of Temple Grove Ladies' Seminary (Saratoga Springs, NY).
    -# His pamphlet "A System of National Time for Railroads" (1870)
    -# was the result of his proposals at the Convention of Railroad Trunk Lines
    -# in New York City (1869-10).  His 1870 proposal was based on Washington, DC,
    -# but in 1872-05 he moved the proposed origin to Greenwich.
    -# His proposal was adopted by the railroads on 1883-11-18 at 12:00,
    -# and the most of the country soon followed suit.
    -
    -# From Paul Eggert (2005-04-16):
    -# That 1883 transition occurred at 12:00 new time, not at 12:00 old time.
    -# See p 46 of David Prerau, Seize the daylight, Thunder's Mouth Press (2005).
    -
    -# From Paul Eggert (2006-03-22):
    -# A good source for time zone historical data in the US is
    -# Thomas G. Shanks, The American Atlas (5th edition),
    -# San Diego: ACS Publications, Inc. (1991).
    -# Make sure you have the errata sheet; the book is somewhat useless without it.
    -# It is the source for most of the pre-1991 US entries below.
    -
    -# From Paul Eggert (2001-03-06):
    -# Daylight Saving Time was first suggested as a joke by Benjamin Franklin
    -# in his whimsical essay "An Economical Project for Diminishing the Cost
    -# of Light" published in the Journal de Paris (1784-04-26).
    -# Not everyone is happy with the results:
    -#
    -#	I don't really care how time is reckoned so long as there is some
    -#	agreement about it, but I object to being told that I am saving
    -#	daylight when my reason tells me that I am doing nothing of the kind.
    -#	I even object to the implication that I am wasting something
    -#	valuable if I stay in bed after the sun has risen.  As an admirer
    -#	of moonlight I resent the bossy insistence of those who want to
    -#	reduce my time for enjoying it.  At the back of the Daylight Saving
    -#	scheme I detect the bony, blue-fingered hand of Puritanism, eager
    -#	to push people into bed earlier, and get them up earlier, to make
    -#	them healthy, wealthy and wise in spite of themselves.
    -#
    -#	 -- Robertson Davies, The diary of Samuel Marchbanks,
    -#	   Clarke, Irwin (1947), XIX, Sunday
    -#
    -# For more about the first ten years of DST in the United States, see
    -# Robert Garland, Ten years of daylight saving from the Pittsburgh standpoint
    -# (Carnegie Library of Pittsburgh, 1927).
    -# http://www.clpgh.org/exhibit/dst.html
    -#
    -# Shanks says that DST was called "War Time" in the US in 1918 and 1919.
    -# However, DST was imposed by the Standard Time Act of 1918, which
    -# was the first nationwide legal time standard, and apparently
    -# time was just called "Standard Time" or "Daylight Saving Time".
    -
    -# From Arthur David Olson:
    -# US Daylight Saving Time ended on the last Sunday of *October* in 1974.
    -# See, for example, the front page of the Saturday, 1974-10-26
    -# and Sunday, 1974-10-27 editions of the Washington Post.
    -
    -# From Arthur David Olson:
    -# Before the Uniform Time Act of 1966 took effect in 1967, observance of
    -# Daylight Saving Time in the US was by local option, except during wartime.
    -
    -# From Arthur David Olson (2000-09-25):
    -# Last night I heard part of a rebroadcast of a 1945 Arch Oboler radio drama.
    -# In the introduction, Oboler spoke of "Eastern Peace Time."
    -# An AltaVista search turned up:
    -# http://rowayton.org/rhs/hstaug45.html
    -# "When the time is announced over the radio now, it is 'Eastern Peace
    -# Time' instead of the old familiar 'Eastern War Time.'  Peace is wonderful."
    -# (August 1945) by way of confirmation.
    -
    -# From Joseph Gallant citing
    -# George H. Douglas, _The Early Days of Radio Broadcasting_ (1987):
    -# At 7 P.M. (Eastern War Time) [on 1945-08-14], the networks were set
    -# to switch to London for Attlee's address, but the American people
    -# never got to hear his speech live. According to one press account,
    -# CBS' Bob Trout was first to announce the word of Japan's surrender,
    -# but a few seconds later, NBC, ABC and Mutual also flashed the word
    -# of surrender, all of whom interrupting the bells of Big Ben in
    -# London which were to precede Mr. Attlee's speech.
    -
    -# From Paul Eggert (2003-02-09): It was Robert St John, not Bob Trout.  From
    -# Myrna Oliver's obituary of St John on page B16 of today's Los Angeles Times:
    -#
    -# ... a war-weary U.S. clung to radios, awaiting word of Japan's surrender.
    -# Any announcement from Asia would reach St. John's New York newsroom on a
    -# wire service teletype machine, which had prescribed signals for major news.
    -# Associated Press, for example, would ring five bells before spewing out
    -# typed copy of an important story, and 10 bells for news "of transcendental
    -# importance."
    -#
    -# On Aug. 14, stalling while talking steadily into the NBC networks' open
    -# microphone, St. John heard five bells and waited only to hear a sixth bell,
    -# before announcing confidently: "Ladies and gentlemen, World War II is over.
    -# The Japanese have agreed to our surrender terms."
    -#
    -# He had scored a 20-second scoop on other broadcasters.
    -
    -# From Arthur David Olson (2005-08-22):
    -# Paul has been careful to use the "US" rules only in those locations
    -# that are part of the United States; this reflects the real scope of
    -# U.S. government action.  So even though the "US" rules have changed
    -# in the latest release, other countries won't be affected.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	US	1918	1919	-	Mar	lastSun	2:00	1:00	D
    -Rule	US	1918	1919	-	Oct	lastSun	2:00	0	S
    -Rule	US	1942	only	-	Feb	9	2:00	1:00	W # War
    -Rule	US	1945	only	-	Aug	14	23:00u	1:00	P # Peace
    -Rule	US	1945	only	-	Sep	lastSun	2:00	0	S
    -Rule	US	1967	2006	-	Oct	lastSun	2:00	0	S
    -Rule	US	1967	1973	-	Apr	lastSun	2:00	1:00	D
    -Rule	US	1974	only	-	Jan	6	2:00	1:00	D
    -Rule	US	1975	only	-	Feb	23	2:00	1:00	D
    -Rule	US	1976	1986	-	Apr	lastSun	2:00	1:00	D
    -Rule	US	1987	2006	-	Apr	Sun>=1	2:00	1:00	D
    -Rule	US	2007	max	-	Mar	Sun>=8	2:00	1:00	D
    -Rule	US	2007	max	-	Nov	Sun>=1	2:00	0	S
    -
    -# From Arthur David Olson, 2005-12-19
    -# We generate the files specified below to guard against old files with
    -# obsolete information being left in the time zone binary directory.
    -# We limit the list to names that have appeared in previous versions of
    -# this time zone package.
    -# We do these as separate Zones rather than as Links to avoid problems if
    -# a particular place changes whether it observes DST.
    -# We put these specifications here in the northamerica file both to
    -# increase the chances that they'll actually get compiled and to
    -# avoid the need to duplicate the US rules in another file.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	EST		 -5:00	-	EST
    -Zone	MST		 -7:00	-	MST
    -Zone	HST		-10:00	-	HST
    -Zone	EST5EDT		 -5:00	US	E%sT
    -Zone	CST6CDT		 -6:00	US	C%sT
    -Zone	MST7MDT		 -7:00	US	M%sT
    -Zone	PST8PDT		 -8:00	US	P%sT
    -
    -# From Bob Devine (1988-01-28):
    -# ...Alaska (and Hawaii) had the timezone names changed in 1967.
    -#    old			 new
    -#    Pacific Standard Time(PST)  -same-
    -#    Yukon Standard Time(YST)    -same-
    -#    Central Alaska S.T. (CAT)   Alaska-Hawaii St[an]dard Time (AHST)
    -#    Nome Standard Time (NT)     Bering Standard Time (BST)
    -#
    -# ...Alaska's timezone lines were redrawn in 1983 to give only 2 tz.
    -#    The YST zone now covers nearly all of the state, AHST just part
    -#    of the Aleutian islands.   No DST.
    -
    -# From Paul Eggert (1995-12-19):
    -# The tables below use 'NST', not 'NT', for Nome Standard Time.
    -# I invented 'CAWT' for Central Alaska War Time.
    -
    -# From U. S. Naval Observatory (1989-01-19):
    -# USA  EASTERN       5 H  BEHIND UTC    NEW YORK, WASHINGTON
    -# USA  EASTERN       4 H  BEHIND UTC    APR 3 - OCT 30
    -# USA  CENTRAL       6 H  BEHIND UTC    CHICAGO, HOUSTON
    -# USA  CENTRAL       5 H  BEHIND UTC    APR 3 - OCT 30
    -# USA  MOUNTAIN      7 H  BEHIND UTC    DENVER
    -# USA  MOUNTAIN      6 H  BEHIND UTC    APR 3 - OCT 30
    -# USA  PACIFIC       8 H  BEHIND UTC    L.A., SAN FRANCISCO
    -# USA  PACIFIC       7 H  BEHIND UTC    APR 3 - OCT 30
    -# USA  ALASKA STD    9 H  BEHIND UTC    MOST OF ALASKA     (AKST)
    -# USA  ALASKA STD    8 H  BEHIND UTC    APR 3 - OCT 30 (AKDT)
    -# USA  ALEUTIAN     10 H  BEHIND UTC    ISLANDS WEST OF 170W
    -# USA    "           9 H  BEHIND UTC    APR 3 - OCT 30
    -# USA  HAWAII       10 H  BEHIND UTC
    -# USA  BERING       11 H  BEHIND UTC    SAMOA, MIDWAY
    -
    -# From Arthur David Olson (1989-01-21):
    -# The above dates are for 1988.
    -# Note the "AKST" and "AKDT" abbreviations, the claim that there's
    -# no DST in Samoa, and the claim that there is DST in Alaska and the
    -# Aleutians.
    -
    -# From Arthur David Olson (1988-02-13):
    -# Legal standard time zone names, from United States Code (1982 Edition and
    -# Supplement III), Title 15, Chapter 6, Section 260 and forward.  First, names
    -# up to 1967-04-01 (when most provisions of the Uniform Time Act of 1966
    -# took effect), as explained in sections 263 and 261:
    -#	(none)
    -#	United States standard eastern time
    -#	United States standard mountain time
    -#	United States standard central time
    -#	United States standard Pacific time
    -#	(none)
    -#	United States standard Alaska time
    -#	(none)
    -# Next, names from 1967-04-01 until 1983-11-30 (the date for
    -# public law 98-181):
    -#	Atlantic standard time
    -#	eastern standard time
    -#	central standard time
    -#	mountain standard time
    -#	Pacific standard time
    -#	Yukon standard time
    -#	Alaska-Hawaii standard time
    -#	Bering standard time
    -# And after 1983-11-30:
    -#	Atlantic standard time
    -#	eastern standard time
    -#	central standard time
    -#	mountain standard time
    -#	Pacific standard time
    -#	Alaska standard time
    -#	Hawaii-Aleutian standard time
    -#	Samoa standard time
    -# The law doesn't give abbreviations.
    -#
    -# From Paul Eggert (2000-01-08), following a heads-up from Rives McDow:
    -# Public law 106-564 (2000-12-23) introduced ... "Chamorro Standard Time"
    -# for time in Guam and the Northern Marianas.  See the file "australasia".
    -#
    -# From Paul Eggert (2015-04-17):
    -# HST and HDT are standardized abbreviations for Hawaii-Aleutian
    -# standard and daylight times.  See section 9.47 (p 234) of the
    -# U.S. Government Printing Office Style Manual (2008)
    -# http://www.gpo.gov/fdsys/pkg/GPO-STYLEMANUAL-2008/pdf/GPO-STYLEMANUAL-2008.pdf
    -
    -# From Arthur David Olson, 2005-08-09
    -# The following was signed into law on 2005-08-08.
    -#
    -# H.R. 6, Energy Policy Act of 2005, SEC. 110. DAYLIGHT SAVINGS.
    -#   (a) Amendment.--Section 3(a) of the Uniform Time Act of 1966 (15
    -#   U.S.C. 260a(a)) is amended--
    -#     (1) by striking "first Sunday of April" and inserting "second
    -#     Sunday of March"; and
    -#     (2) by striking "last Sunday of October" and inserting "first
    -#     Sunday of November'.
    -#   (b) Effective Date.--Subsection (a) shall take effect 1 year after the
    -#   date of enactment of this Act or March 1, 2007, whichever is later.
    -#   (c) Report to Congress.--Not later than 9 months after the effective
    -#   date stated in subsection (b), the Secretary shall report to Congress
    -#   on the impact of this section on energy consumption in the United
    -#   States.
    -#   (d) Right to Revert.--Congress retains the right to revert the
    -#   Daylight Saving Time back to the 2005 time schedules once the
    -#   Department study is complete.
    -
    -# US eastern time, represented by New York
    -
    -# Connecticut, Delaware, District of Columbia, most of Florida,
    -# Georgia, southeast Indiana (Dearborn and Ohio counties), eastern Kentucky
    -# (except America/Kentucky/Louisville below), Maine, Maryland, Massachusetts,
    -# New Hampshire, New Jersey, New York, North Carolina, Ohio,
    -# Pennsylvania, Rhode Island, South Carolina, eastern Tennessee,
    -# Vermont, Virginia, West Virginia
    -
    -# From Dave Cantor (2004-11-02):
    -# Early this summer I had the occasion to visit the Mount Washington
    -# Observatory weather station atop (of course!) Mount Washington [, NH]....
    -# One of the staff members said that the station was on Eastern Standard Time
    -# and didn't change their clocks for Daylight Saving ... so that their
    -# reports will always have times which are 5 hours behind UTC.
    -
    -# From Paul Eggert (2005-08-26):
    -# According to today's Huntsville Times
    -# http://www.al.com/news/huntsvilletimes/index.ssf?/base/news/1125047783228320.xml&coll=1
    -# a few towns on Alabama's "eastern border with Georgia, such as Phenix City
    -# in Russell County, Lanett in Chambers County and some towns in Lee County,
    -# set their watches and clocks on Eastern time."  It quotes H.H. "Bubba"
    -# Roberts, city administrator in Phenix City. as saying "We are in the Central
    -# time zone, but we do go by the Eastern time zone because so many people work
    -# in Columbus."
    -
    -# From Paul Eggert (2014-09-06):
    -# Monthly Notices of the Royal Astronomical Society 44, 4 (1884-02-08), 208
    -# says that New York City Hall time was 3 minutes 58.4 seconds fast of
    -# Eastern time (i.e., -4:56:01.6) just before the 1883 switch.  Round to the
    -# nearest second.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	NYC	1920	only	-	Mar	lastSun	2:00	1:00	D
    -Rule	NYC	1920	only	-	Oct	lastSun	2:00	0	S
    -Rule	NYC	1921	1966	-	Apr	lastSun	2:00	1:00	D
    -Rule	NYC	1921	1954	-	Sep	lastSun	2:00	0	S
    -Rule	NYC	1955	1966	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/New_York	-4:56:02 -	LMT	1883 Nov 18 12:03:58
    -			-5:00	US	E%sT	1920
    -			-5:00	NYC	E%sT	1942
    -			-5:00	US	E%sT	1946
    -			-5:00	NYC	E%sT	1967
    -			-5:00	US	E%sT
    -
    -# US central time, represented by Chicago
    -
    -# Alabama, Arkansas, Florida panhandle (Bay, Calhoun, Escambia,
    -# Gulf, Holmes, Jackson, Okaloosa, Santa Rosa, Walton, and
    -# Washington counties), Illinois, western Indiana
    -# (Gibson, Jasper, Lake, LaPorte, Newton, Porter, Posey, Spencer,
    -# Vanderburgh, and Warrick counties), Iowa, most of Kansas, western
    -# Kentucky, Louisiana, Minnesota, Mississippi, Missouri, eastern
    -# Nebraska, eastern North Dakota, Oklahoma, eastern South Dakota,
    -# western Tennessee, most of Texas, Wisconsin
    -
    -# From Larry M. Smith (2006-04-26) re Wisconsin:
    -# http://www.legis.state.wi.us/statutes/Stat0175.pdf ...
    -# is currently enforced at the 01:00 time of change.  Because the local
    -# "bar time" in the state corresponds to 02:00, a number of citations
    -# are issued for the "sale of class 'B' alcohol after prohibited
    -# hours" within the deviated hour of this change every year....
    -#
    -# From Douglas R. Bomberg (2007-03-12):
    -# Wisconsin has enacted (nearly eleventh-hour) legislation to get WI
    -# Statue 175 closer in synch with the US Congress' intent....
    -# http://www.legis.state.wi.us/2007/data/acts/07Act3.pdf
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	Chicago	1920	only	-	Jun	13	2:00	1:00	D
    -Rule	Chicago	1920	1921	-	Oct	lastSun	2:00	0	S
    -Rule	Chicago	1921	only	-	Mar	lastSun	2:00	1:00	D
    -Rule	Chicago	1922	1966	-	Apr	lastSun	2:00	1:00	D
    -Rule	Chicago	1922	1954	-	Sep	lastSun	2:00	0	S
    -Rule	Chicago	1955	1966	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Chicago	-5:50:36 -	LMT	1883 Nov 18 12:09:24
    -			-6:00	US	C%sT	1920
    -			-6:00	Chicago	C%sT	1936 Mar  1  2:00
    -			-5:00	-	EST	1936 Nov 15  2:00
    -			-6:00	Chicago	C%sT	1942
    -			-6:00	US	C%sT	1946
    -			-6:00	Chicago	C%sT	1967
    -			-6:00	US	C%sT
    -# Oliver County, ND switched from mountain to central time on 1992-10-25.
    -Zone America/North_Dakota/Center -6:45:12 - LMT	1883 Nov 18 12:14:48
    -			-7:00	US	M%sT	1992 Oct 25  2:00
    -			-6:00	US	C%sT
    -# Morton County, ND, switched from mountain to central time on
    -# 2003-10-26, except for the area around Mandan which was already central time.
    -# See .
    -# Officially this switch also included part of Sioux County, and
    -# Jones, Mellette, and Todd Counties in South Dakota;
    -# but in practice these other counties were already observing central time.
    -# See .
    -Zone America/North_Dakota/New_Salem -6:45:39 - LMT	1883 Nov 18 12:14:21
    -			-7:00	US	M%sT	2003 Oct 26  2:00
    -			-6:00	US	C%sT
    -
    -# From Josh Findley (2011-01-21):
    -# ...it appears that Mercer County, North Dakota, changed from the
    -# mountain time zone to the central time zone at the last transition from
    -# daylight-saving to standard time (on Nov. 7, 2010):
    -# http://www.gpo.gov/fdsys/pkg/FR-2010-09-29/html/2010-24376.htm
    -# http://www.bismarcktribune.com/news/local/article_1eb1b588-c758-11df-b472-001cc4c03286.html
    -
    -# From Andy Lipscomb (2011-01-24):
    -# ...according to the Census Bureau, the largest city is Beulah (although
    -# it's commonly referred to as Beulah-Hazen, with Hazen being the next
    -# largest city in Mercer County).  Google Maps places Beulah's city hall
    -# at 47 degrees 15' 51" N, 101 degrees 46' 40" W, which yields an offset
    -# of 6h47'07".
    -
    -Zone America/North_Dakota/Beulah -6:47:07 - LMT	1883 Nov 18 12:12:53
    -			-7:00	US	M%sT	2010 Nov  7  2:00
    -			-6:00	US	C%sT
    -
    -# US mountain time, represented by Denver
    -#
    -# Colorado, far western Kansas, Montana, western
    -# Nebraska, Nevada border (Jackpot, Owyhee, and Mountain City),
    -# New Mexico, southwestern North Dakota,
    -# western South Dakota, far western Texas (El Paso County, Hudspeth County,
    -# and Pine Springs and Nickel Creek in Culberson County), Utah, Wyoming
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	Denver	1920	1921	-	Mar	lastSun	2:00	1:00	D
    -Rule	Denver	1920	only	-	Oct	lastSun	2:00	0	S
    -Rule	Denver	1921	only	-	May	22	2:00	0	S
    -Rule	Denver	1965	1966	-	Apr	lastSun	2:00	1:00	D
    -Rule	Denver	1965	1966	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Denver	-6:59:56 -	LMT	1883 Nov 18 12:00:04
    -			-7:00	US	M%sT	1920
    -			-7:00	Denver	M%sT	1942
    -			-7:00	US	M%sT	1946
    -			-7:00	Denver	M%sT	1967
    -			-7:00	US	M%sT
    -
    -# US Pacific time, represented by Los Angeles
    -#
    -# California, northern Idaho (Benewah, Bonner, Boundary, Clearwater,
    -# Kootenai, Latah, Lewis, Nez Perce, and Shoshone counties, Idaho county
    -# north of the Salmon River, and the towns of Burgdorf and Warren),
    -# Nevada (except West Wendover), Oregon (except the northern 3/4 of
    -# Malheur county), and Washington
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	CA	1948	only	-	Mar	14	2:00	1:00	D
    -Rule	CA	1949	only	-	Jan	 1	2:00	0	S
    -Rule	CA	1950	1966	-	Apr	lastSun	2:00	1:00	D
    -Rule	CA	1950	1961	-	Sep	lastSun	2:00	0	S
    -Rule	CA	1962	1966	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Los_Angeles -7:52:58 -	LMT	1883 Nov 18 12:07:02
    -			-8:00	US	P%sT	1946
    -			-8:00	CA	P%sT	1967
    -			-8:00	US	P%sT
    -
    -# Alaska
    -# AK%sT is the modern abbreviation for -9:00 per USNO.
    -#
    -# From Paul Eggert (2001-05-30):
    -# Howse writes that Alaska switched from the Julian to the Gregorian calendar,
    -# and from east-of-GMT to west-of-GMT days, when the US bought it from Russia.
    -# This was on 1867-10-18, a Friday; the previous day was 1867-10-06 Julian,
    -# also a Friday.  Include only the time zone part of this transition,
    -# ignoring the switch from Julian to Gregorian, since we can't represent
    -# the Julian calendar.
    -#
    -# As far as we know, none of the exact locations mentioned below were
    -# permanently inhabited in 1867 by anyone using either calendar.
    -# (Yakutat was colonized by the Russians in 1799, but the settlement
    -# was destroyed in 1805 by a Yakutat-kon war party.)  However, there
    -# were nearby inhabitants in some cases and for our purposes perhaps
    -# it's best to simply use the official transition.
    -
    -# From Paul Eggert (2014-07-18):
    -# One opinion of the early-1980s turmoil in Alaska over time zones and
    -# daylight saving time appeared as graffiti on a Juneau airport wall:
    -# "Welcome to Juneau.  Please turn your watch back to the 19th century."
    -# See: Turner W. Alaska's four time zones now two. NY Times 1983-11-01.
    -# http://www.nytimes.com/1983/11/01/us/alaska-s-four-time-zones-now-two.html
    -#
    -# Steve Ferguson (2011-01-31) referred to the following source:
    -# Norris F. Keeping time in Alaska: national directives, local response.
    -# Alaska History 2001;16(1-2).
    -# http://alaskahistoricalsociety.org/discover-alaska/glimpses-of-the-past/keeping-time-in-alaska/
    -
    -# From Arthur David Olson (2011-02-01):
    -# Here's database-relevant material from the 2001 "Alaska History" article:
    -#
    -# On September 20 [1979]...DOT...officials decreed that on April 27,
    -# 1980, Juneau and other nearby communities would move to Yukon Time.
    -# Sitka, Petersburg, Wrangell, and Ketchikan, however, would remain on
    -# Pacific Time.
    -#
    -# ...on September 22, 1980, DOT Secretary Neil E. Goldschmidt rescinded the
    -# Department's September 1979 decision. Juneau and other communities in
    -# northern Southeast reverted to Pacific Time on October 26.
    -#
    -# On October 28 [1983]...the Metlakatla Indian Community Council voted
    -# unanimously to keep the reservation on Pacific Time.
    -#
    -# According to DOT official Joanne Petrie, Indian reservations are not
    -# bound to follow time zones imposed by neighboring jurisdictions.
    -#
    -# (The last is consistent with how the database now handles the Navajo
    -# Nation.)
    -
    -# From Arthur David Olson (2011-02-09):
    -# I just spoke by phone with a staff member at the Metlakatla Indian
    -# Community office (using contact information available at
    -# http://www.commerce.state.ak.us/dca/commdb/CIS.cfm?Comm_Boro_name=Metlakatla
    -# It's shortly after 1:00 here on the east coast of the United States;
    -# the staffer said it was shortly after 10:00 there. When I asked whether
    -# that meant they were on Pacific time, they said no - they were on their
    -# own time. I asked about daylight saving; they said it wasn't used. I
    -# did not inquire about practices in the past.
    -
    -# From Arthur David Olson (2011-08-17):
    -# For lack of better information, assume that Metlakatla's
    -# abandonment of use of daylight saving resulted from the 1983 vote.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Juneau	 15:02:19 -	LMT	1867 Oct 18
    -			 -8:57:41 -	LMT	1900 Aug 20 12:00
    -			 -8:00	-	PST	1942
    -			 -8:00	US	P%sT	1946
    -			 -8:00	-	PST	1969
    -			 -8:00	US	P%sT	1980 Apr 27  2:00
    -			 -9:00	US	Y%sT	1980 Oct 26  2:00
    -			 -8:00	US	P%sT	1983 Oct 30  2:00
    -			 -9:00	US	Y%sT	1983 Nov 30
    -			 -9:00	US	AK%sT
    -Zone America/Sitka	 14:58:47 -	LMT	1867 Oct 18
    -			 -9:01:13 -	LMT	1900 Aug 20 12:00
    -			 -8:00	-	PST	1942
    -			 -8:00	US	P%sT	1946
    -			 -8:00	-	PST	1969
    -			 -8:00	US	P%sT	1983 Oct 30  2:00
    -			 -9:00	US	Y%sT	1983 Nov 30
    -			 -9:00	US	AK%sT
    -Zone America/Metlakatla	 15:13:42 -	LMT	1867 Oct 18
    -			 -8:46:18 -	LMT	1900 Aug 20 12:00
    -			 -8:00	-	PST	1942
    -			 -8:00	US	P%sT	1946
    -			 -8:00	-	PST	1969
    -			 -8:00	US	P%sT	1983 Oct 30  2:00
    -			 -8:00	-	PST
    -Zone America/Yakutat	 14:41:05 -	LMT	1867 Oct 18
    -			 -9:18:55 -	LMT	1900 Aug 20 12:00
    -			 -9:00	-	YST	1942
    -			 -9:00	US	Y%sT	1946
    -			 -9:00	-	YST	1969
    -			 -9:00	US	Y%sT	1983 Nov 30
    -			 -9:00	US	AK%sT
    -Zone America/Anchorage	 14:00:24 -	LMT	1867 Oct 18
    -			 -9:59:36 -	LMT	1900 Aug 20 12:00
    -			-10:00	-	CAT	1942
    -			-10:00	US	CAT/CAWT 1945 Aug 14 23:00u
    -			-10:00	US	CAT/CAPT 1946 # Peace
    -			-10:00	-	CAT	1967 Apr
    -			-10:00	-	AHST	1969
    -			-10:00	US	AH%sT	1983 Oct 30  2:00
    -			 -9:00	US	Y%sT	1983 Nov 30
    -			 -9:00	US	AK%sT
    -Zone America/Nome	 12:58:21 -	LMT	1867 Oct 18
    -			-11:01:38 -	LMT	1900 Aug 20 12:00
    -			-11:00	-	NST	1942
    -			-11:00	US	N%sT	1946
    -			-11:00	-	NST	1967 Apr
    -			-11:00	-	BST	1969
    -			-11:00	US	B%sT	1983 Oct 30  2:00
    -			 -9:00	US	Y%sT	1983 Nov 30
    -			 -9:00	US	AK%sT
    -Zone America/Adak	 12:13:21 -	LMT	1867 Oct 18
    -			-11:46:38 -	LMT	1900 Aug 20 12:00
    -			-11:00	-	NST	1942
    -			-11:00	US	N%sT	1946
    -			-11:00	-	NST	1967 Apr
    -			-11:00	-	BST	1969
    -			-11:00	US	B%sT	1983 Oct 30  2:00
    -			-10:00	US	AH%sT	1983 Nov 30
    -			-10:00	US	H%sT
    -# The following switches don't quite make our 1970 cutoff.
    -#
    -# Shanks writes that part of southwest Alaska (e.g. Aniak)
    -# switched from -11:00 to -10:00 on 1968-09-22 at 02:00,
    -# and another part (e.g. Akiak) made the same switch five weeks later.
    -#
    -# From David Flater (2004-11-09):
    -# In e-mail, 2004-11-02, Ray Hudson, historian/liaison to the Unalaska
    -# Historic Preservation Commission, provided this information, which
    -# suggests that Unalaska deviated from statutory time from early 1967
    -# possibly until 1983:
    -#
    -#  Minutes of the Unalaska City Council Meeting, January 10, 1967:
    -#  "Except for St. Paul and Akutan, Unalaska is the only important
    -#  location not on Alaska Standard Time.  The following resolution was
    -#  made by William Robinson and seconded by Henry Swanson: Be it
    -#  resolved that the City of Unalaska hereby goes to Alaska Standard
    -#  Time as of midnight Friday, January 13, 1967 (1 A.M. Saturday,
    -#  January 14, Alaska Standard Time.)  This resolution was passed with
    -#  three votes for and one against."
    -
    -# Hawaii
    -
    -# From Arthur David Olson (2010-12-09):
    -# "Hawaiian Time" by Robert C. Schmitt and Doak C. Cox appears on pages 207-225
    -# of volume 26 of The Hawaiian Journal of History (1992). As of 2010-12-09,
    -# the article is available at
    -# http://evols.library.manoa.hawaii.edu/bitstream/10524/239/2/JL26215.pdf
    -# and indicates that standard time was adopted effective noon, January
    -# 13, 1896 (page 218), that in "1933, the Legislature decreed daylight
    -# saving for the period between the last Sunday of each April and the
    -# last Sunday of each September, but less than a month later repealed the
    -# act," (page 220), that year-round daylight saving time was in effect
    -# from 1942-02-09 to 1945-09-30 (page 221, with no time of day given for
    -# when clocks changed) and that clocks were changed by 30 minutes
    -# effective the second Sunday of June, 1947 (page 219, with no time of
    -# day given for when clocks changed). A footnote for the 1933 changes
    -# cites Session Laws of Hawaii 1933, "Act. 90 (approved 26 Apr. 1933)
    -# and Act 163 (approved 21 May 1933)."
    -
    -# From Arthur David Olson (2011-01-19):
    -# The following is from "Laws of the Territory of Hawaii Passed by the
    -# Seventeenth Legislature: Regular Session 1933," available (as of
    -# 2011-01-19) at American University's Pence Law Library. Page 85: "Act
    -# 90...At 2 o'clock ante meridian of the last Sunday in April of each
    -# year, the standard time of this Territory shall be advanced one
    -# hour...This Act shall take effect upon its approval. Approved this 26th
    -# day of April, A. D. 1933. LAWRENCE M JUDD, Governor of the Territory of
    -# Hawaii." Page 172: "Act 163...Act 90 of the Session Laws of 1933 is
    -# hereby repealed...This Act shall take effect upon its approval, upon
    -# which date the standard time of this Territory shall be restored to
    -# that existing immediately prior to the taking effect of said Act 90.
    -# Approved this 21st day of May, A. D. 1933. LAWRENCE M. JUDD, Governor
    -# of the Territory of Hawaii."
    -#
    -# Note that 1933-05-21 was a Sunday.
    -# We're left to guess the time of day when Act 163 was approved; guess noon.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Pacific/Honolulu	-10:31:26 -	LMT	1896 Jan 13 12:00
    -			-10:30	-	HST	1933 Apr 30  2:00
    -			-10:30	1:00	HDT	1933 May 21 12:00
    -			-10:30	-	HST	1942 Feb  9  2:00
    -			-10:30	1:00	HDT	1945 Sep 30  2:00
    -			-10:30	-	HST	1947 Jun  8  2:00
    -			-10:00	-	HST
    -Link Pacific/Honolulu Pacific/Johnston
    -
    -# Now we turn to US areas that have diverged from the consensus since 1970.
    -
    -# Arizona mostly uses MST.
    -
    -# From Paul Eggert (2002-10-20):
    -#
    -# The information in the rest of this paragraph is derived from the
    -# Daylight Saving Time web page
    -#  (2002-01-23)
    -# maintained by the Arizona State Library, Archives and Public Records.
    -# Between 1944-01-01 and 1944-04-01 the State of Arizona used standard
    -# time, but by federal law railroads, airlines, bus lines, military
    -# personnel, and some engaged in interstate commerce continued to
    -# observe war (i.e., daylight saving) time.  The 1944-03-17 Phoenix
    -# Gazette says that was the date the law changed, and that 04-01 was
    -# the date the state's clocks would change.  In 1945 the State of
    -# Arizona used standard time all year, again with exceptions only as
    -# mandated by federal law.  Arizona observed DST in 1967, but Arizona
    -# Laws 1968, ch. 183 (effective 1968-03-21) repealed DST.
    -#
    -# Shanks says the 1944 experiment came to an end on 1944-03-17.
    -# Go with the Arizona State Library instead.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Phoenix	-7:28:18 -	LMT	1883 Nov 18 11:31:42
    -			-7:00	US	M%sT	1944 Jan  1  0:01
    -			-7:00	-	MST	1944 Apr  1  0:01
    -			-7:00	US	M%sT	1944 Oct  1  0:01
    -			-7:00	-	MST	1967
    -			-7:00	US	M%sT	1968 Mar 21
    -			-7:00	-	MST
    -# From Arthur David Olson (1988-02-13):
    -# A writer from the Inter Tribal Council of Arizona, Inc.,
    -# notes in private correspondence dated 1987-12-28 that "Presently, only the
    -# Navajo Nation participates in the Daylight Saving Time policy, due to its
    -# large size and location in three states."  (The "only" means that other
    -# tribal nations don't use DST.)
    -#
    -# From Paul Eggert (2013-08-26):
    -# See America/Denver for a zone appropriate for the Navajo Nation.
    -
    -# Southern Idaho (Ada, Adams, Bannock, Bear Lake, Bingham, Blaine,
    -# Boise, Bonneville, Butte, Camas, Canyon, Caribou, Cassia, Clark,
    -# Custer, Elmore, Franklin, Fremont, Gem, Gooding, Jefferson, Jerome,
    -# Lemhi, Lincoln, Madison, Minidoka, Oneida, Owyhee, Payette, Power,
    -# Teton, Twin Falls, Valley, Washington counties, and the southern
    -# quarter of Idaho county) and eastern Oregon (most of Malheur County)
    -# switched four weeks late in 1974.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Boise	-7:44:49 -	LMT	1883 Nov 18 12:15:11
    -			-8:00	US	P%sT	1923 May 13  2:00
    -			-7:00	US	M%sT	1974
    -			-7:00	-	MST	1974 Feb  3  2:00
    -			-7:00	US	M%sT
    -
    -# Indiana
    -#
    -# For a map of Indiana's time zone regions, see:
    -# http://en.wikipedia.org/wiki/Time_in_Indiana
    -#
    -# From Paul Eggert (2007-08-17):
    -# Since 1970, most of Indiana has been like America/Indiana/Indianapolis,
    -# with the following exceptions:
    -#
    -# - Gibson, Jasper, Lake, LaPorte, Newton, Porter, Posey, Spencer,
    -#   Vanderburgh, and Warrick counties have been like America/Chicago.
    -#
    -# - Dearborn and Ohio counties have been like America/New_York.
    -#
    -# - Clark, Floyd, and Harrison counties have been like
    -#   America/Kentucky/Louisville.
    -#
    -# - Crawford, Daviess, Dubois, Knox, Martin, Perry, Pike, Pulaski, Starke,
    -#   and Switzerland counties have their own time zone histories as noted below.
    -#
    -# Shanks partitioned Indiana into 345 regions, each with its own time history,
    -# and wrote "Even newspaper reports present contradictory information."
    -# Those Hoosiers!  Such a flighty and changeable people!
    -# Fortunately, most of the complexity occurred before our cutoff date of 1970.
    -#
    -# Other than Indianapolis, the Indiana place names are so nondescript
    -# that they would be ambiguous if we left them at the 'America' level.
    -# So we reluctantly put them all in a subdirectory 'America/Indiana'.
    -
    -# From Paul Eggert (2014-06-26):
    -# https://www.federalregister.gov/articles/2006/01/20/06-563/standard-time-zone-boundary-in-the-state-of-indiana
    -# says "DOT is relocating the time zone boundary in Indiana to move Starke,
    -# Pulaski, Knox, Daviess, Martin, Pike, Dubois, and Perry Counties from the
    -# Eastern Time Zone to the Central Time Zone.... The effective date of
    -# this rule is 2 a.m. EST Sunday, April 2, 2006, which is the
    -# changeover date from standard time to Daylight Saving Time."
    -# Strictly speaking, this meant the affected counties changed their
    -# clocks twice that night, but this obviously was in error.  The intent
    -# was that 01:59:59 EST be followed by 02:00:00 CDT.
    -
    -# From Gwillim Law (2007-02-10):
    -# The Associated Press has been reporting that Pulaski County, Indiana is
    -# going to switch from Central to Eastern Time on March 11, 2007....
    -# http://www.indystar.com/apps/pbcs.dll/article?AID=/20070207/LOCAL190108/702070524/0/LOCAL
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule Indianapolis 1941	only	-	Jun	22	2:00	1:00	D
    -Rule Indianapolis 1941	1954	-	Sep	lastSun	2:00	0	S
    -Rule Indianapolis 1946	1954	-	Apr	lastSun	2:00	1:00	D
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Indiana/Indianapolis -5:44:38 - LMT	1883 Nov 18 12:15:22
    -			-6:00	US	C%sT	1920
    -			-6:00 Indianapolis C%sT	1942
    -			-6:00	US	C%sT	1946
    -			-6:00 Indianapolis C%sT	1955 Apr 24  2:00
    -			-5:00	-	EST	1957 Sep 29  2:00
    -			-6:00	-	CST	1958 Apr 27  2:00
    -			-5:00	-	EST	1969
    -			-5:00	US	E%sT	1971
    -			-5:00	-	EST	2006
    -			-5:00	US	E%sT
    -#
    -# Eastern Crawford County, Indiana, left its clocks alone in 1974,
    -# as well as from 1976 through 2005.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	Marengo	1951	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Marengo	1951	only	-	Sep	lastSun	2:00	0	S
    -Rule	Marengo	1954	1960	-	Apr	lastSun	2:00	1:00	D
    -Rule	Marengo	1954	1960	-	Sep	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Indiana/Marengo -5:45:23 -	LMT	1883 Nov 18 12:14:37
    -			-6:00	US	C%sT	1951
    -			-6:00	Marengo	C%sT	1961 Apr 30  2:00
    -			-5:00	-	EST	1969
    -			-5:00	US	E%sT	1974 Jan  6  2:00
    -			-6:00	1:00	CDT	1974 Oct 27  2:00
    -			-5:00	US	E%sT	1976
    -			-5:00	-	EST	2006
    -			-5:00	US	E%sT
    -#
    -# Daviess, Dubois, Knox, and Martin Counties, Indiana,
    -# switched from eastern to central time in April 2006, then switched back
    -# in November 2007.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule Vincennes	1946	only	-	Apr	lastSun	2:00	1:00	D
    -Rule Vincennes	1946	only	-	Sep	lastSun	2:00	0	S
    -Rule Vincennes	1953	1954	-	Apr	lastSun	2:00	1:00	D
    -Rule Vincennes	1953	1959	-	Sep	lastSun	2:00	0	S
    -Rule Vincennes	1955	only	-	May	 1	0:00	1:00	D
    -Rule Vincennes	1956	1963	-	Apr	lastSun	2:00	1:00	D
    -Rule Vincennes	1960	only	-	Oct	lastSun	2:00	0	S
    -Rule Vincennes	1961	only	-	Sep	lastSun	2:00	0	S
    -Rule Vincennes	1962	1963	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Indiana/Vincennes -5:50:07 - LMT	1883 Nov 18 12:09:53
    -			-6:00	US	C%sT	1946
    -			-6:00 Vincennes	C%sT	1964 Apr 26  2:00
    -			-5:00	-	EST	1969
    -			-5:00	US	E%sT	1971
    -			-5:00	-	EST	2006 Apr  2  2:00
    -			-6:00	US	C%sT	2007 Nov  4  2:00
    -			-5:00	US	E%sT
    -#
    -# Perry County, Indiana, switched from eastern to central time in April 2006.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule Perry	1946	only	-	Apr	lastSun	2:00	1:00	D
    -Rule Perry	1946	only	-	Sep	lastSun	2:00	0	S
    -Rule Perry	1953	1954	-	Apr	lastSun	2:00	1:00	D
    -Rule Perry	1953	1959	-	Sep	lastSun	2:00	0	S
    -Rule Perry	1955	only	-	May	 1	0:00	1:00	D
    -Rule Perry	1956	1963	-	Apr	lastSun	2:00	1:00	D
    -Rule Perry	1960	only	-	Oct	lastSun	2:00	0	S
    -Rule Perry	1961	only	-	Sep	lastSun	2:00	0	S
    -Rule Perry	1962	1963	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Indiana/Tell_City -5:47:03 - LMT	1883 Nov 18 12:12:57
    -			-6:00	US	C%sT	1946
    -			-6:00 Perry	C%sT	1964 Apr 26  2:00
    -			-5:00	-	EST	1969
    -			-5:00	US	E%sT	1971
    -			-5:00	-	EST	2006 Apr  2  2:00
    -			-6:00	US	C%sT
    -#
    -# Pike County, Indiana moved from central to eastern time in 1977,
    -# then switched back in 2006, then switched back again in 2007.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	Pike	1955	only	-	May	 1	0:00	1:00	D
    -Rule	Pike	1955	1960	-	Sep	lastSun	2:00	0	S
    -Rule	Pike	1956	1964	-	Apr	lastSun	2:00	1:00	D
    -Rule	Pike	1961	1964	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Indiana/Petersburg -5:49:07 - LMT	1883 Nov 18 12:10:53
    -			-6:00	US	C%sT	1955
    -			-6:00	Pike	C%sT	1965 Apr 25  2:00
    -			-5:00	-	EST	1966 Oct 30  2:00
    -			-6:00	US	C%sT	1977 Oct 30  2:00
    -			-5:00	-	EST	2006 Apr  2  2:00
    -			-6:00	US	C%sT	2007 Nov  4  2:00
    -			-5:00	US	E%sT
    -#
    -# Starke County, Indiana moved from central to eastern time in 1991,
    -# then switched back in 2006.
    -# From Arthur David Olson (1991-10-28):
    -# An article on page A3 of the Sunday, 1991-10-27 Washington Post
    -# notes that Starke County switched from Central time to Eastern time as of
    -# 1991-10-27.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	Starke	1947	1961	-	Apr	lastSun	2:00	1:00	D
    -Rule	Starke	1947	1954	-	Sep	lastSun	2:00	0	S
    -Rule	Starke	1955	1956	-	Oct	lastSun	2:00	0	S
    -Rule	Starke	1957	1958	-	Sep	lastSun	2:00	0	S
    -Rule	Starke	1959	1961	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Indiana/Knox -5:46:30 -	LMT	1883 Nov 18 12:13:30
    -			-6:00	US	C%sT	1947
    -			-6:00	Starke	C%sT	1962 Apr 29  2:00
    -			-5:00	-	EST	1963 Oct 27  2:00
    -			-6:00	US	C%sT	1991 Oct 27  2:00
    -			-5:00	-	EST	2006 Apr  2  2:00
    -			-6:00	US	C%sT
    -#
    -# Pulaski County, Indiana, switched from eastern to central time in
    -# April 2006 and then switched back in March 2007.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	Pulaski	1946	1960	-	Apr	lastSun	2:00	1:00	D
    -Rule	Pulaski	1946	1954	-	Sep	lastSun	2:00	0	S
    -Rule	Pulaski	1955	1956	-	Oct	lastSun	2:00	0	S
    -Rule	Pulaski	1957	1960	-	Sep	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Indiana/Winamac -5:46:25 - LMT	1883 Nov 18 12:13:35
    -			-6:00	US	C%sT	1946
    -			-6:00	Pulaski	C%sT	1961 Apr 30  2:00
    -			-5:00	-	EST	1969
    -			-5:00	US	E%sT	1971
    -			-5:00	-	EST	2006 Apr  2  2:00
    -			-6:00	US	C%sT	2007 Mar 11  2:00
    -			-5:00	US	E%sT
    -#
    -# Switzerland County, Indiana, did not observe DST from 1973 through 2005.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Indiana/Vevay -5:40:16 -	LMT	1883 Nov 18 12:19:44
    -			-6:00	US	C%sT	1954 Apr 25  2:00
    -			-5:00	-	EST	1969
    -			-5:00	US	E%sT	1973
    -			-5:00	-	EST	2006
    -			-5:00	US	E%sT
    -
    -# Part of Kentucky left its clocks alone in 1974.
    -# This also includes Clark, Floyd, and Harrison counties in Indiana.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule Louisville	1921	only	-	May	1	2:00	1:00	D
    -Rule Louisville	1921	only	-	Sep	1	2:00	0	S
    -Rule Louisville	1941	1961	-	Apr	lastSun	2:00	1:00	D
    -Rule Louisville	1941	only	-	Sep	lastSun	2:00	0	S
    -Rule Louisville	1946	only	-	Jun	2	2:00	0	S
    -Rule Louisville	1950	1955	-	Sep	lastSun	2:00	0	S
    -Rule Louisville	1956	1960	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Kentucky/Louisville -5:43:02 -	LMT	1883 Nov 18 12:16:58
    -			-6:00	US	C%sT	1921
    -			-6:00 Louisville C%sT	1942
    -			-6:00	US	C%sT	1946
    -			-6:00 Louisville C%sT	1961 Jul 23  2:00
    -			-5:00	-	EST	1968
    -			-5:00	US	E%sT	1974 Jan  6  2:00
    -			-6:00	1:00	CDT	1974 Oct 27  2:00
    -			-5:00	US	E%sT
    -#
    -# Wayne County, Kentucky
    -#
    -# From Lake Cumberland LIFE
    -# http://www.lake-cumberland.com/life/archive/news990129time.shtml
    -# (1999-01-29) via WKYM-101.7:
    -# Clinton County has joined Wayne County in asking the DoT to change from
    -# the Central to the Eastern time zone....  The Wayne County government made
    -# the same request in December.  And while Russell County officials have not
    -# taken action, the majority of respondents to a poll conducted there in
    -# August indicated they would like to change to "fast time" also.
    -# The three Lake Cumberland counties are the farthest east of any U.S.
    -# location in the Central time zone.
    -#
    -# From Rich Wales (2000-08-29):
    -# After prolonged debate, and despite continuing deep differences of opinion,
    -# Wayne County (central Kentucky) is switching from Central (-0600) to Eastern
    -# (-0500) time.  They won't "fall back" this year.  See Sara Shipley,
    -# The difference an hour makes, Nando Times (2000-08-29 15:33 -0400).
    -#
    -# From Paul Eggert (2001-07-16):
    -# The final rule was published in the
    -# Federal Register 65, 160 (2000-08-17), pp 50154-50158.
    -# http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=2000_register&docid=fr17au00-22
    -#
    -Zone America/Kentucky/Monticello -5:39:24 - LMT	1883 Nov 18 12:20:36
    -			-6:00	US	C%sT	1946
    -			-6:00	-	CST	1968
    -			-6:00	US	C%sT	2000 Oct 29  2:00
    -			-5:00	US	E%sT
    -
    -
    -# From Rives McDow (2000-08-30):
    -# Here ... are all the changes in the US since 1985.
    -# Kearny County, KS (put all of county on central;
    -#	previously split between MST and CST) ... 1990-10
    -# Starke County, IN (from CST to EST) ... 1991-10
    -# Oliver County, ND (from MST to CST) ... 1992-10
    -# West Wendover, NV (from PST TO MST) ... 1999-10
    -# Wayne County, KY (from CST to EST) ... 2000-10
    -#
    -# From Paul Eggert (2001-07-17):
    -# We don't know where the line used to be within Kearny County, KS,
    -# so omit that change for now.
    -# See America/Indiana/Knox for the Starke County, IN change.
    -# See America/North_Dakota/Center for the Oliver County, ND change.
    -# West Wendover, NV officially switched from Pacific to mountain time on
    -# 1999-10-31.  See the
    -# Federal Register 64, 203 (1999-10-21), pp 56705-56707.
    -# http://frwebgate.access.gpo.gov/cgi-bin/getdoc.cgi?dbname=1999_register&docid=fr21oc99-15
    -# However, the Federal Register says that West Wendover already operated
    -# on mountain time, and the rule merely made this official;
    -# hence a separate tz entry is not needed.
    -
    -# Michigan
    -#
    -# From Bob Devine (1988-01-28):
    -# Michigan didn't observe DST from 1968 to 1973.
    -#
    -# From Paul Eggert (1999-03-31):
    -# Shanks writes that Michigan started using standard time on 1885-09-18,
    -# but Howse writes (pp 124-125, referring to Popular Astronomy, 1901-01)
    -# that Detroit kept
    -#
    -#	local time until 1900 when the City Council decreed that clocks should
    -#	be put back twenty-eight minutes to Central Standard Time.  Half the
    -#	city obeyed, half refused.  After considerable debate, the decision
    -#	was rescinded and the city reverted to Sun time.  A derisive offer to
    -#	erect a sundial in front of the city hall was referred to the
    -#	Committee on Sewers.  Then, in 1905, Central time was adopted
    -#	by city vote.
    -#
    -# This story is too entertaining to be false, so go with Howse over Shanks.
    -#
    -# From Paul Eggert (2001-03-06):
    -# Garland (1927) writes "Cleveland and Detroit advanced their clocks
    -# one hour in 1914."  This change is not in Shanks.  We have no more
    -# info, so omit this for now.
    -#
    -# Most of Michigan observed DST from 1973 on, but was a bit late in 1975.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule	Detroit	1948	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Detroit	1948	only	-	Sep	lastSun	2:00	0	S
    -Rule	Detroit	1967	only	-	Jun	14	2:00	1:00	D
    -Rule	Detroit	1967	only	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Detroit	-5:32:11 -	LMT	1905
    -			-6:00	-	CST	1915 May 15  2:00
    -			-5:00	-	EST	1942
    -			-5:00	US	E%sT	1946
    -			-5:00	Detroit	E%sT	1973
    -			-5:00	US	E%sT	1975
    -			-5:00	-	EST	1975 Apr 27  2:00
    -			-5:00	US	E%sT
    -#
    -# Dickinson, Gogebic, Iron, and Menominee Counties, Michigan,
    -# switched from EST to CST/CDT in 1973.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
    -Rule Menominee	1946	only	-	Apr	lastSun	2:00	1:00	D
    -Rule Menominee	1946	only	-	Sep	lastSun	2:00	0	S
    -Rule Menominee	1966	only	-	Apr	lastSun	2:00	1:00	D
    -Rule Menominee	1966	only	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Menominee	-5:50:27 -	LMT	1885 Sep 18 12:00
    -			-6:00	US	C%sT	1946
    -			-6:00 Menominee	C%sT	1969 Apr 27  2:00
    -			-5:00	-	EST	1973 Apr 29  2:00
    -			-6:00	US	C%sT
    -
    -# Navassa
    -# administered by the US Fish and Wildlife Service
    -# claimed by US under the provisions of the 1856 Guano Islands Act
    -# also claimed by Haiti
    -# occupied 1857/1900 by the Navassa Phosphate Co
    -# US lighthouse 1917/1996-09
    -# currently uninhabited
    -# see Mark Fineman, "An Isle Rich in Guano and Discord",
    -# _Los Angeles Times_ (1998-11-10), A1, A10; it cites
    -# Jimmy Skaggs, _The Great Guano Rush_ (1994).
    -
    -################################################################################
    -
    -
    -# From Paul Eggert (2014-10-31):
    -#
    -# Unless otherwise specified, the source for data through 1990 is:
    -# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
    -# San Diego: ACS Publications, Inc. (2003).
    -# Unfortunately this book contains many errors and cites no sources.
    -#
    -# Gwillim Law writes that a good source
    -# for recent time zone data is the International Air Transport
    -# Association's Standard Schedules Information Manual (IATA SSIM),
    -# published semiannually.  Law sent in several helpful summaries
    -# of the IATA's data after 1990.  Except where otherwise noted,
    -# IATA SSIM is the source for entries after 1990.
    -#
    -# Other sources occasionally used include:
    -#
    -#	Edward W. Whitman, World Time Differences,
    -#	Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated),
    -#	which I found in the UCLA library.
    -#
    -#	William Willett, The Waste of Daylight, 19th edition
    -#	
    -#	[PDF] (1914-03)
    -#
    -#	Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94
    -#	.
    -#
    -# See the 'europe' file for Greenland.
    -
    -# Canada
    -
    -# From Alain LaBonté (1994-11-14):
    -# I post here the time zone abbreviations standardized in Canada
    -# for both English and French in the CAN/CSA-Z234.4-89 standard....
    -#
    -#	UTC	Standard time	Daylight saving time
    -#	offset	French	English	French	English
    -#	-2:30	-	-	HAT	NDT
    -#	-3	-	-	HAA	ADT
    -#	-3:30	HNT	NST	-	-
    -#	-4	HNA	AST	HAE	EDT
    -#	-5	HNE	EST	HAC	CDT
    -#	-6	HNC	CST	HAR	MDT
    -#	-7	HNR	MST	HAP	PDT
    -#	-8	HNP	PST	HAY	YDT
    -#	-9	HNY	YST	-	-
    -#
    -#	HN: Heure Normale	ST: Standard Time
    -#	HA: Heure Avancée	DT: Daylight saving Time
    -#
    -#	A: de l'Atlantique	Atlantic
    -#	C: du Centre		Central
    -#	E: de l'Est		Eastern
    -#	M:			Mountain
    -#	N:			Newfoundland
    -#	P: du Pacifique		Pacific
    -#	R: des Rocheuses
    -#	T: de Terre-Neuve
    -#	Y: du Yukon		Yukon
    -#
    -# From Paul Eggert (1994-11-22):
    -# Alas, this sort of thing must be handled by localization software.
    -
    -# Unless otherwise specified, the data entries for Canada are all from Shanks
    -# & Pottenger.
    -
    -# From Chris Walton (2006-04-01, 2006-04-25, 2006-06-26, 2007-01-31,
    -# 2007-03-01):
    -# The British Columbia government announced yesterday that it will
    -# adjust daylight savings next year to align with changes in the
    -# U.S. and the rest of Canada....
    -# http://www2.news.gov.bc.ca/news_releases_2005-2009/2006AG0014-000330.htm
    -# ...
    -# Nova Scotia
    -# Daylight saving time will be extended by four weeks starting in 2007....
    -# http://www.gov.ns.ca/just/regulations/rg2/2006/ma1206.pdf
    -#
    -# [For New Brunswick] the new legislation dictates that the time change is to
    -# be done at 02:00 instead of 00:01.
    -# http://www.gnb.ca/0062/acts/BBA-2006/Chap-19.pdf
    -# ...
    -# Manitoba has traditionally changed the clock every fall at 03:00.
    -# As of 2006, the transition is to take place one hour earlier at 02:00.
    -# http://web2.gov.mb.ca/laws/statutes/ccsm/o030e.php
    -# ...
    -# [Alberta, Ontario, Quebec] will follow US rules.
    -# http://www.qp.gov.ab.ca/documents/spring/CH03_06.CFM
    -# http://www.e-laws.gov.on.ca/DBLaws/Source/Regs/English/2006/R06111_e.htm
    -# http://www2.publicationsduquebec.gouv.qc.ca/dynamicSearch/telecharge.php?type=5&file=2006C39A.PDF
    -# ...
    -# P.E.I. will follow US rules....
    -# http://www.assembly.pe.ca/bills/pdf_chapter/62/3/chapter-41.pdf
    -# ...
    -# Province of Newfoundland and Labrador....
    -# http://www.hoa.gov.nl.ca/hoa/bills/Bill0634.htm
    -# ...
    -# Yukon
    -# http://www.gov.yk.ca/legislation/regs/oic2006_127.pdf
    -# ...
    -# N.W.T. will follow US rules.  Whoever maintains the government web site
    -# does not seem to believe in bookmarks.  To see the news release, click the
    -# following link and search for "Daylight Savings Time Change".  Press the
    -# "Daylight Savings Time Change" link; it will fire off a popup using
    -# JavaScript.
    -# http://www.exec.gov.nt.ca/currentnews/currentPR.asp?mode=archive
    -# ...
    -# Nunavut
    -# An amendment to the Interpretation Act was registered on February 19/2007....
    -# http://action.attavik.ca/home/justice-gn/attach/2007/gaz02part2.pdf
    -
    -# From Paul Eggert (2014-10-18):
    -# H. David Matthews and Mary Vincent's map
    -# "It's about TIME", _Canadian Geographic_ (September-October 1998)
    -# http://www.canadiangeographic.ca/Magazine/SO98/alacarte.asp
    -# contains detailed boundaries for regions observing nonstandard
    -# time and daylight saving time arrangements in Canada circa 1998.
    -#
    -# National Research Council Canada maintains info about time zones and DST.
    -# http://www.nrc-cnrc.gc.ca/eng/services/time/time_zones.html
    -# http://www.nrc-cnrc.gc.ca/eng/services/time/faq/index.html#Q5
    -# Its unofficial information is often taken from Matthews and Vincent.
    -
    -# From Paul Eggert (2006-06-27):
    -# For now, assume all of DST-observing Canada will fall into line with the
    -# new US DST rules,
    -
    -# From Chris Walton (2011-12-01)
    -# In the first of Tammy Hardwick's articles
    -# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
    -# she quotes the Friday November 1/1918 edition of the Creston Review.
    -# The quote includes these two statements:
    -# 'Sunday the CPR went back to the old system of time...'
    -# '... The daylight saving scheme was dropped all over Canada at the same time,'
    -# These statements refer to a transition from daylight time to standard time
    -# that occurred nationally on Sunday October 27/1918.  This transition was
    -# also documented in the Saturday October 26/1918 edition of the Toronto Star.
    -
    -# In light of that evidence, we alter the date from the earlier believed
    -# Oct 31, to Oct 27, 1918 (and Sunday is a more likely transition day
    -# than Thursday) in all Canadian rulesets.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Canada	1918	only	-	Apr	14	2:00	1:00	D
    -Rule	Canada	1918	only	-	Oct	27	2:00	0	S
    -Rule	Canada	1942	only	-	Feb	 9	2:00	1:00	W # War
    -Rule	Canada	1945	only	-	Aug	14	23:00u	1:00	P # Peace
    -Rule	Canada	1945	only	-	Sep	30	2:00	0	S
    -Rule	Canada	1974	1986	-	Apr	lastSun	2:00	1:00	D
    -Rule	Canada	1974	2006	-	Oct	lastSun	2:00	0	S
    -Rule	Canada	1987	2006	-	Apr	Sun>=1	2:00	1:00	D
    -Rule	Canada	2007	max	-	Mar	Sun>=8	2:00	1:00	D
    -Rule	Canada	2007	max	-	Nov	Sun>=1	2:00	0	S
    -
    -
    -# Newfoundland and Labrador
    -
    -# From Paul Eggert (2000-10-02):
    -# Matthews and Vincent (1998) write that Labrador should use NST/NDT,
    -# but the only part of Labrador that follows the rules is the
    -# southeast corner, including Port Hope Simpson and Mary's Harbour,
    -# but excluding, say, Black Tickle.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	StJohns	1917	only	-	Apr	 8	2:00	1:00	D
    -Rule	StJohns	1917	only	-	Sep	17	2:00	0	S
    -# Whitman gives 1919 Apr 5 and 1920 Apr 5; go with Shanks & Pottenger.
    -Rule	StJohns	1919	only	-	May	 5	23:00	1:00	D
    -Rule	StJohns	1919	only	-	Aug	12	23:00	0	S
    -# For 1931-1935 Whitman gives Apr same date; go with Shanks & Pottenger.
    -Rule	StJohns	1920	1935	-	May	Sun>=1	23:00	1:00	D
    -Rule	StJohns	1920	1935	-	Oct	lastSun	23:00	0	S
    -# For 1936-1941 Whitman gives May Sun>=8 and Oct Sun>=1; go with Shanks &
    -# Pottenger.
    -Rule	StJohns	1936	1941	-	May	Mon>=9	0:00	1:00	D
    -Rule	StJohns	1936	1941	-	Oct	Mon>=2	0:00	0	S
    -# Whitman gives the following transitions:
    -# 1942 03-01/12-31, 1943 05-30/09-05, 1944 07-10/09-02, 1945 01-01/10-07
    -# but go with Shanks & Pottenger and assume they used Canadian rules.
    -# For 1946-9 Whitman gives May 5,4,9,1 - Oct 1,5,3,2, and for 1950 he gives
    -# Apr 30 - Sep 24; go with Shanks & Pottenger.
    -Rule	StJohns	1946	1950	-	May	Sun>=8	2:00	1:00	D
    -Rule	StJohns	1946	1950	-	Oct	Sun>=2	2:00	0	S
    -Rule	StJohns	1951	1986	-	Apr	lastSun	2:00	1:00	D
    -Rule	StJohns	1951	1959	-	Sep	lastSun	2:00	0	S
    -Rule	StJohns	1960	1986	-	Oct	lastSun	2:00	0	S
    -# From Paul Eggert (2000-10-02):
    -# INMS (2000-09-12) says that, since 1988 at least, Newfoundland switches
    -# at 00:01 local time.  For now, assume it started in 1987.
    -
    -# From Michael Pelley (2011-09-12):
    -# We received today, Monday, September 12, 2011, notification that the
    -# changes to the Newfoundland Standard Time Act have been proclaimed.
    -# The change in the Act stipulates that the change from Daylight Savings
    -# Time to Standard Time and from Standard Time to Daylight Savings Time
    -# now occurs at 2:00AM.
    -# ...
    -# http://www.assembly.nl.ca/legislation/sr/annualstatutes/2011/1106.chp.htm
    -# ...
    -# MICHAEL PELLEY  |  Manager of Enterprise Architecture - Solution Delivery
    -# Office of the Chief Information Officer
    -# Executive Council
    -# Government of Newfoundland & Labrador
    -
    -Rule	StJohns	1987	only	-	Apr	Sun>=1	0:01	1:00	D
    -Rule	StJohns	1987	2006	-	Oct	lastSun	0:01	0	S
    -Rule	StJohns	1988	only	-	Apr	Sun>=1	0:01	2:00	DD
    -Rule	StJohns	1989	2006	-	Apr	Sun>=1	0:01	1:00	D
    -Rule	StJohns	2007	2011	-	Mar	Sun>=8	0:01	1:00	D
    -Rule	StJohns	2007	2010	-	Nov	Sun>=1	0:01	0	S
    -#
    -# St John's has an apostrophe, but Posix file names can't have apostrophes.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/St_Johns	-3:30:52 -	LMT	1884
    -			-3:30:52 StJohns N%sT	1918
    -			-3:30:52 Canada	N%sT	1919
    -			-3:30:52 StJohns N%sT	1935 Mar 30
    -			-3:30	StJohns	N%sT	1942 May 11
    -			-3:30	Canada	N%sT	1946
    -			-3:30	StJohns	N%sT	2011 Nov
    -			-3:30	Canada	N%sT
    -
    -# most of east Labrador
    -
    -# The name 'Happy Valley-Goose Bay' is too long; use 'Goose Bay'.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Goose_Bay	-4:01:40 -	LMT	1884 # Happy Valley-Goose Bay
    -			-3:30:52 -	NST	1918
    -			-3:30:52 Canada N%sT	1919
    -			-3:30:52 -	NST	1935 Mar 30
    -			-3:30	-	NST	1936
    -			-3:30	StJohns	N%sT	1942 May 11
    -			-3:30	Canada	N%sT	1946
    -			-3:30	StJohns	N%sT	1966 Mar 15  2:00
    -			-4:00	StJohns	A%sT	2011 Nov
    -			-4:00	Canada	A%sT
    -
    -
    -# west Labrador, Nova Scotia, Prince Edward I
    -
    -# From Brian Inglis (2015-07-20):
    -# From the historical weather station records available at:
    -# https://weatherspark.com/history/28351/1971/Sydney-Nova-Scotia-Canada
    -# Sydney shares the same time history as Glace Bay, so was
    -# likely to be the same across the island....
    -# Sydney, as the capital and most populous location, or Cape Breton, would
    -# have been better names for the zone had we known this in 1996.
    -
    -# From Paul Eggert (2015-07-20):
    -# Shanks & Pottenger write that since 1970 most of this region has been like
    -# Halifax.  Many locales did not observe peacetime DST until 1972;
    -# the Cape Breton area, represented by Glace Bay, is the largest we know of
    -# (Glace Bay was perhaps not the best name choice but no point changing now).
    -# Shanks & Pottenger also write that Liverpool, NS was the only town
    -# in Canada to observe DST in 1971 but not 1970; for now we'll assume
    -# this is a typo.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Halifax	1916	only	-	Apr	 1	0:00	1:00	D
    -Rule	Halifax	1916	only	-	Oct	 1	0:00	0	S
    -Rule	Halifax	1920	only	-	May	 9	0:00	1:00	D
    -Rule	Halifax	1920	only	-	Aug	29	0:00	0	S
    -Rule	Halifax	1921	only	-	May	 6	0:00	1:00	D
    -Rule	Halifax	1921	1922	-	Sep	 5	0:00	0	S
    -Rule	Halifax	1922	only	-	Apr	30	0:00	1:00	D
    -Rule	Halifax	1923	1925	-	May	Sun>=1	0:00	1:00	D
    -Rule	Halifax	1923	only	-	Sep	 4	0:00	0	S
    -Rule	Halifax	1924	only	-	Sep	15	0:00	0	S
    -Rule	Halifax	1925	only	-	Sep	28	0:00	0	S
    -Rule	Halifax	1926	only	-	May	16	0:00	1:00	D
    -Rule	Halifax	1926	only	-	Sep	13	0:00	0	S
    -Rule	Halifax	1927	only	-	May	 1	0:00	1:00	D
    -Rule	Halifax	1927	only	-	Sep	26	0:00	0	S
    -Rule	Halifax	1928	1931	-	May	Sun>=8	0:00	1:00	D
    -Rule	Halifax	1928	only	-	Sep	 9	0:00	0	S
    -Rule	Halifax	1929	only	-	Sep	 3	0:00	0	S
    -Rule	Halifax	1930	only	-	Sep	15	0:00	0	S
    -Rule	Halifax	1931	1932	-	Sep	Mon>=24	0:00	0	S
    -Rule	Halifax	1932	only	-	May	 1	0:00	1:00	D
    -Rule	Halifax	1933	only	-	Apr	30	0:00	1:00	D
    -Rule	Halifax	1933	only	-	Oct	 2	0:00	0	S
    -Rule	Halifax	1934	only	-	May	20	0:00	1:00	D
    -Rule	Halifax	1934	only	-	Sep	16	0:00	0	S
    -Rule	Halifax	1935	only	-	Jun	 2	0:00	1:00	D
    -Rule	Halifax	1935	only	-	Sep	30	0:00	0	S
    -Rule	Halifax	1936	only	-	Jun	 1	0:00	1:00	D
    -Rule	Halifax	1936	only	-	Sep	14	0:00	0	S
    -Rule	Halifax	1937	1938	-	May	Sun>=1	0:00	1:00	D
    -Rule	Halifax	1937	1941	-	Sep	Mon>=24	0:00	0	S
    -Rule	Halifax	1939	only	-	May	28	0:00	1:00	D
    -Rule	Halifax	1940	1941	-	May	Sun>=1	0:00	1:00	D
    -Rule	Halifax	1946	1949	-	Apr	lastSun	2:00	1:00	D
    -Rule	Halifax	1946	1949	-	Sep	lastSun	2:00	0	S
    -Rule	Halifax	1951	1954	-	Apr	lastSun	2:00	1:00	D
    -Rule	Halifax	1951	1954	-	Sep	lastSun	2:00	0	S
    -Rule	Halifax	1956	1959	-	Apr	lastSun	2:00	1:00	D
    -Rule	Halifax	1956	1959	-	Sep	lastSun	2:00	0	S
    -Rule	Halifax	1962	1973	-	Apr	lastSun	2:00	1:00	D
    -Rule	Halifax	1962	1973	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Halifax	-4:14:24 -	LMT	1902 Jun 15
    -			-4:00	Halifax	A%sT	1918
    -			-4:00	Canada	A%sT	1919
    -			-4:00	Halifax	A%sT	1942 Feb  9  2:00s
    -			-4:00	Canada	A%sT	1946
    -			-4:00	Halifax	A%sT	1974
    -			-4:00	Canada	A%sT
    -Zone America/Glace_Bay	-3:59:48 -	LMT	1902 Jun 15
    -			-4:00	Canada	A%sT	1953
    -			-4:00	Halifax	A%sT	1954
    -			-4:00	-	AST	1972
    -			-4:00	Halifax	A%sT	1974
    -			-4:00	Canada	A%sT
    -
    -# New Brunswick
    -
    -# From Paul Eggert (2007-01-31):
    -# The Time Definition Act 
    -# says they changed at 00:01 through 2006, and
    -#  makes it
    -# clear that this was the case since at least 1993.
    -# For now, assume it started in 1993.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Moncton	1933	1935	-	Jun	Sun>=8	1:00	1:00	D
    -Rule	Moncton	1933	1935	-	Sep	Sun>=8	1:00	0	S
    -Rule	Moncton	1936	1938	-	Jun	Sun>=1	1:00	1:00	D
    -Rule	Moncton	1936	1938	-	Sep	Sun>=1	1:00	0	S
    -Rule	Moncton	1939	only	-	May	27	1:00	1:00	D
    -Rule	Moncton	1939	1941	-	Sep	Sat>=21	1:00	0	S
    -Rule	Moncton	1940	only	-	May	19	1:00	1:00	D
    -Rule	Moncton	1941	only	-	May	 4	1:00	1:00	D
    -Rule	Moncton	1946	1972	-	Apr	lastSun	2:00	1:00	D
    -Rule	Moncton	1946	1956	-	Sep	lastSun	2:00	0	S
    -Rule	Moncton	1957	1972	-	Oct	lastSun	2:00	0	S
    -Rule	Moncton	1993	2006	-	Apr	Sun>=1	0:01	1:00	D
    -Rule	Moncton	1993	2006	-	Oct	lastSun	0:01	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Moncton	-4:19:08 -	LMT	1883 Dec  9
    -			-5:00	-	EST	1902 Jun 15
    -			-4:00	Canada	A%sT	1933
    -			-4:00	Moncton	A%sT	1942
    -			-4:00	Canada	A%sT	1946
    -			-4:00	Moncton	A%sT	1973
    -			-4:00	Canada	A%sT	1993
    -			-4:00	Moncton	A%sT	2007
    -			-4:00	Canada	A%sT
    -
    -# Quebec
    -
    -# From Paul Eggert (2015-03-24):
    -# See America/Toronto for most of Quebec, including Montreal.
    -#
    -# Matthews and Vincent (1998) also write that Quebec east of the -63
    -# meridian is supposed to observe AST, but residents as far east as
    -# Natashquan use EST/EDT, and residents east of Natashquan use AST.
    -# The Quebec department of justice writes in
    -# "The situation in Minganie and Basse-Côte-Nord"
    -# http://www.justice.gouv.qc.ca/english/publications/generale/temps-minganie-a.htm
    -# that the coastal strip from just east of Natashquan to Blanc-Sablon
    -# observes Atlantic standard time all year round.
    -# http://www.assnat.qc.ca/Media/Process.aspx?MediaId=ANQ.Vigie.Bll.DocumentGenerique_8845en
    -# says this common practice was codified into law as of 2007.
    -# For lack of better info, guess this practice began around 1970, contra to
    -# Shanks & Pottenger who have this region observing AST/ADT.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Blanc-Sablon -3:48:28 -	LMT	1884
    -			-4:00	Canada	A%sT	1970
    -			-4:00	-	AST
    -
    -# Ontario
    -
    -# From Paul Eggert (2006-07-09):
    -# Shanks & Pottenger write that since 1970 most of Ontario has been like
    -# Toronto.
    -# Thunder Bay skipped DST in 1973.
    -# Many smaller locales did not observe peacetime DST until 1974;
    -# Nipigon (EST) and Rainy River (CST) are the largest that we know of.
    -# Far west Ontario is like Winnipeg; far east Quebec is like Halifax.
    -
    -# From Mark Brader (2003-07-26):
    -# [According to the Toronto Star] Orillia, Ontario, adopted DST
    -# effective Saturday, 1912-06-22, 22:00; the article mentions that
    -# Port Arthur (now part of Thunder Bay, Ontario) as well as Moose Jaw
    -# have already done so.  In Orillia DST was to run until Saturday,
    -# 1912-08-31 (no time mentioned), but it was met with considerable
    -# hostility from certain segments of the public, and was revoked after
    -# only two weeks - I copied it as Saturday, 1912-07-07, 22:00, but
    -# presumably that should be -07-06.  (1912-06-19, -07-12; also letters
    -# earlier in June).
    -#
    -# Kenora, Ontario, was to abandon DST on 1914-06-01 (-05-21).
    -
    -# From Paul Eggert (1997-10-17):
    -# Mark Brader writes that an article in the 1997-10-14 Toronto Star
    -# says that Atikokan, Ontario currently does not observe DST,
    -# but will vote on 11-10 whether to use EST/EDT.
    -# He also writes that the Ontario Time Act (1990, Chapter T.9)
    -# http://www.gov.on.ca/MBS/english/publications/statregs/conttext.html
    -# says that Ontario east of 90W uses EST/EDT, and west of 90W uses CST/CDT.
    -# Officially Atikokan is therefore on CST/CDT, and most likely this report
    -# concerns a non-official time observed as a matter of local practice.
    -#
    -# From Paul Eggert (2000-10-02):
    -# Matthews and Vincent (1998) write that Atikokan, Pickle Lake, and
    -# New Osnaburgh observe CST all year, that Big Trout Lake observes
    -# CST/CDT, and that Upsala and Shebandowan observe EST/EDT, all in
    -# violation of the official Ontario rules.
    -#
    -# From Paul Eggert (2006-07-09):
    -# Chris Walton (2006-07-06) mentioned an article by Stephanie MacLellan in the
    -# 2005-07-21 Chronicle-Journal, which said:
    -#
    -#	The clocks in Atikokan stay set on standard time year-round.
    -#	This means they spend about half the time on central time and
    -#	the other half on eastern time.
    -#
    -#	For the most part, the system works, Mayor Dennis Brown said.
    -#
    -#	"The majority of businesses in Atikokan deal more with Eastern
    -#	Canada, but there are some that deal with Western Canada," he
    -#	said.  "I don't see any changes happening here."
    -#
    -# Walton also writes "Supposedly Pickle Lake and Mishkeegogamang
    -# [New Osnaburgh] follow the same practice."
    -
    -# From Garry McKinnon (2006-07-14) via Chris Walton:
    -# I chatted with a member of my board who has an outstanding memory
    -# and a long history in Atikokan (and in the telecom industry) and he
    -# can say for certain that Atikokan has been practicing the current
    -# time keeping since 1952, at least.
    -
    -# From Paul Eggert (2006-07-17):
    -# Shanks & Pottenger say that Atikokan has agreed with Rainy River
    -# ever since standard time was introduced, but the information from
    -# McKinnon sounds more authoritative.  For now, assume that Atikokan
    -# switched to EST immediately after WWII era daylight saving time
    -# ended.  This matches the old (less-populous) America/Coral_Harbour
    -# entry since our cutoff date of 1970, so we can move
    -# America/Coral_Harbour to the 'backward' file.
    -
    -# From Mark Brader (2010-03-06):
    -#
    -# Currently the database has:
    -#
    -# # Ontario
    -#
    -# # From Paul Eggert (2006-07-09):
    -# # Shanks & Pottenger write that since 1970 most of Ontario has been like
    -# # Toronto.
    -# # Thunder Bay skipped DST in 1973.
    -# # Many smaller locales did not observe peacetime DST until 1974;
    -# # Nipigon (EST) and Rainy River (CST) are the largest that we know of.
    -#
    -# In the (Toronto) Globe and Mail for Saturday, 1955-09-24, in the bottom
    -# right corner of page 1, it says that Toronto will return to standard
    -# time at 2 am Sunday morning (which agrees with the database), and that:
    -#
    -#     The one-hour setback will go into effect throughout most of Ontario,
    -#     except in areas like Windsor which remains on standard time all year.
    -#
    -# Windsor is, of course, a lot larger than Nipigon.
    -#
    -# I only came across this incidentally.  I don't know if Windsor began
    -# observing DST when Detroit did, or in 1974, or on some other date.
    -#
    -# By the way, the article continues by noting that:
    -#
    -#     Some cities in the United States have pushed the deadline back
    -#     three weeks and will change over from daylight saving in October.
    -
    -# From Arthur David Olson (2010-07-17):
    -#
    -# "Standard Time and Time Zones in Canada" appeared in
    -# The Journal of The Royal Astronomical Society of Canada,
    -# volume 26, number 2 (February 1932) and, as of 2010-07-17,
    -# was available at
    -# http://adsabs.harvard.edu/full/1932JRASC..26...49S
    -#
    -# It includes the text below (starting on page 57):
    -#
    -#   A list of the places in Canada using daylight saving time would
    -# require yearly revision. From information kindly furnished by
    -# the provincial governments and by the postmasters in many cities
    -# and towns, it is found that the following places used daylight sav-
    -# ing in 1930. The information for the province of Quebec is definite,
    -# for the other provinces only approximate:
    -#
    -#	Province	Daylight saving time used
    -# Prince Edward Island	Not used.
    -# Nova Scotia		In Halifax only.
    -# New Brunswick		In St. John only.
    -# Quebec		In the following places:
    -#			Montreal	Lachine
    -#			Quebec		Mont-Royal
    -#			Lévis		Iberville
    -#			St. Lambert	Cap de la Madelèine
    -#			Verdun		Loretteville
    -#			Westmount	Richmond
    -#			Outremont	St. Jérôme
    -#			Longueuil	Greenfield Park
    -#			Arvida		Waterloo
    -#			Chambly-Canton	Beaulieu
    -#			Melbourne	La Tuque
    -#			St. Théophile	Buckingham
    -# Ontario		Used generally in the cities and towns along
    -#			the southerly part of the province. Not
    -#			used in the northwesterly part.
    -# Manitoba		Not used.
    -# Saskatchewan		In Regina only.
    -# Alberta		Not used.
    -# British Columbia	Not used.
    -#
    -#   With some exceptions, the use of daylight saving may be said to be limited
    -# to those cities and towns lying between Quebec city and Windsor, Ont.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Toronto	1919	only	-	Mar	30	23:30	1:00	D
    -Rule	Toronto	1919	only	-	Oct	26	0:00	0	S
    -Rule	Toronto	1920	only	-	May	 2	2:00	1:00	D
    -Rule	Toronto	1920	only	-	Sep	26	0:00	0	S
    -Rule	Toronto	1921	only	-	May	15	2:00	1:00	D
    -Rule	Toronto	1921	only	-	Sep	15	2:00	0	S
    -Rule	Toronto	1922	1923	-	May	Sun>=8	2:00	1:00	D
    -# Shanks & Pottenger say 1923-09-19; assume it's a typo and that "-16"
    -# was meant.
    -Rule	Toronto	1922	1926	-	Sep	Sun>=15	2:00	0	S
    -Rule	Toronto	1924	1927	-	May	Sun>=1	2:00	1:00	D
    -# The 1927-to-1939 rules can be expressed more simply as
    -# Rule	Toronto	1927	1937	-	Sep	Sun>=25	2:00	0	S
    -# Rule	Toronto	1928	1937	-	Apr	Sun>=25	2:00	1:00	D
    -# Rule	Toronto	1938	1940	-	Apr	lastSun	2:00	1:00	D
    -# Rule	Toronto	1938	1939	-	Sep	lastSun	2:00	0	S
    -# The rules below avoid use of Sun>=25
    -# (which pre-2004 versions of zic cannot handle).
    -Rule	Toronto	1927	1932	-	Sep	lastSun	2:00	0	S
    -Rule	Toronto	1928	1931	-	Apr	lastSun	2:00	1:00	D
    -Rule	Toronto	1932	only	-	May	1	2:00	1:00	D
    -Rule	Toronto	1933	1940	-	Apr	lastSun	2:00	1:00	D
    -Rule	Toronto	1933	only	-	Oct	1	2:00	0	S
    -Rule	Toronto	1934	1939	-	Sep	lastSun	2:00	0	S
    -Rule	Toronto	1945	1946	-	Sep	lastSun	2:00	0	S
    -Rule	Toronto	1946	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Toronto	1947	1949	-	Apr	lastSun	0:00	1:00	D
    -Rule	Toronto	1947	1948	-	Sep	lastSun	0:00	0	S
    -Rule	Toronto	1949	only	-	Nov	lastSun	0:00	0	S
    -Rule	Toronto	1950	1973	-	Apr	lastSun	2:00	1:00	D
    -Rule	Toronto	1950	only	-	Nov	lastSun	2:00	0	S
    -Rule	Toronto	1951	1956	-	Sep	lastSun	2:00	0	S
    -# Shanks & Pottenger say Toronto ended DST a week early in 1971,
    -# namely on 1971-10-24, but Mark Brader wrote (2003-05-31) that this
    -# is wrong, and that he had confirmed it by checking the 1971-10-30
    -# Toronto Star, which said that DST was ending 1971-10-31 as usual.
    -Rule	Toronto	1957	1973	-	Oct	lastSun	2:00	0	S
    -
    -# From Paul Eggert (2003-07-27):
    -# Willett (1914-03) writes (p. 17) "In the Cities of Fort William, and
    -# Port Arthur, Ontario, the principle of the Bill has been in
    -# operation for the past three years, and in the City of Moose Jaw,
    -# Saskatchewan, for one year."
    -
    -# From David Bryan via Tory Tronrud, Director/Curator,
    -# Thunder Bay Museum (2003-11-12):
    -# There is some suggestion, however, that, by-law or not, daylight
    -# savings time was being practiced in Fort William and Port Arthur
    -# before 1909.... [I]n 1910, the line between the Eastern and Central
    -# Time Zones was permanently moved about two hundred miles west to
    -# include the Thunder Bay area....  When Canada adopted daylight
    -# savings time in 1916, Fort William and Port Arthur, having done so
    -# already, did not change their clocks....  During the Second World
    -# War,... [t]he cities agreed to implement DST during the summer
    -# months for the remainder of the war years.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Toronto	-5:17:32 -	LMT	1895
    -			-5:00	Canada	E%sT	1919
    -			-5:00	Toronto	E%sT	1942 Feb  9  2:00s
    -			-5:00	Canada	E%sT	1946
    -			-5:00	Toronto	E%sT	1974
    -			-5:00	Canada	E%sT
    -Zone America/Thunder_Bay -5:57:00 -	LMT	1895
    -			-6:00	-	CST	1910
    -			-5:00	-	EST	1942
    -			-5:00	Canada	E%sT	1970
    -			-5:00	Toronto	E%sT	1973
    -			-5:00	-	EST	1974
    -			-5:00	Canada	E%sT
    -Zone America/Nipigon	-5:53:04 -	LMT	1895
    -			-5:00	Canada	E%sT	1940 Sep 29
    -			-5:00	1:00	EDT	1942 Feb  9  2:00s
    -			-5:00	Canada	E%sT
    -Zone America/Rainy_River -6:18:16 -	LMT	1895
    -			-6:00	Canada	C%sT	1940 Sep 29
    -			-6:00	1:00	CDT	1942 Feb  9  2:00s
    -			-6:00	Canada	C%sT
    -Zone America/Atikokan	-6:06:28 -	LMT	1895
    -			-6:00	Canada	C%sT	1940 Sep 29
    -			-6:00	1:00	CDT	1942 Feb  9  2:00s
    -			-6:00	Canada	C%sT	1945 Sep 30  2:00
    -			-5:00	-	EST
    -
    -
    -# Manitoba
    -
    -# From Rob Douglas (2006-04-06):
    -# the old Manitoba Time Act - as amended by Bill 2, assented to
    -# March 27, 1987 ... said ...
    -# "between two o'clock Central Standard Time in the morning of
    -# the first Sunday of April of each year and two o'clock Central
    -# Standard Time in the morning of the last Sunday of October next
    -# following, one hour in advance of Central Standard Time."...
    -# I believe that the English legislation [of the old time act] had
    -# been assented to (March 22, 1967)....
    -# Also, as far as I can tell, there was no order-in-council varying
    -# the time of Daylight Saving Time for 2005 and so the provisions of
    -# the 1987 version would apply - the changeover was at 2:00 Central
    -# Standard Time (i.e. not until 3:00 Central Daylight Time).
    -
    -# From Paul Eggert (2006-04-10):
    -# Shanks & Pottenger say Manitoba switched at 02:00 (not 02:00s)
    -# starting 1966.  Since 02:00s is clearly correct for 1967 on, assume
    -# it was also 02:00s in 1966.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Winn	1916	only	-	Apr	23	0:00	1:00	D
    -Rule	Winn	1916	only	-	Sep	17	0:00	0	S
    -Rule	Winn	1918	only	-	Apr	14	2:00	1:00	D
    -Rule	Winn	1918	only	-	Oct	27	2:00	0	S
    -Rule	Winn	1937	only	-	May	16	2:00	1:00	D
    -Rule	Winn	1937	only	-	Sep	26	2:00	0	S
    -Rule	Winn	1942	only	-	Feb	 9	2:00	1:00	W # War
    -Rule	Winn	1945	only	-	Aug	14	23:00u	1:00	P # Peace
    -Rule	Winn	1945	only	-	Sep	lastSun	2:00	0	S
    -Rule	Winn	1946	only	-	May	12	2:00	1:00	D
    -Rule	Winn	1946	only	-	Oct	13	2:00	0	S
    -Rule	Winn	1947	1949	-	Apr	lastSun	2:00	1:00	D
    -Rule	Winn	1947	1949	-	Sep	lastSun	2:00	0	S
    -Rule	Winn	1950	only	-	May	 1	2:00	1:00	D
    -Rule	Winn	1950	only	-	Sep	30	2:00	0	S
    -Rule	Winn	1951	1960	-	Apr	lastSun	2:00	1:00	D
    -Rule	Winn	1951	1958	-	Sep	lastSun	2:00	0	S
    -Rule	Winn	1959	only	-	Oct	lastSun	2:00	0	S
    -Rule	Winn	1960	only	-	Sep	lastSun	2:00	0	S
    -Rule	Winn	1963	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Winn	1963	only	-	Sep	22	2:00	0	S
    -Rule	Winn	1966	1986	-	Apr	lastSun	2:00s	1:00	D
    -Rule	Winn	1966	2005	-	Oct	lastSun	2:00s	0	S
    -Rule	Winn	1987	2005	-	Apr	Sun>=1	2:00s	1:00	D
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Winnipeg	-6:28:36 -	LMT	1887 Jul 16
    -			-6:00	Winn	C%sT	2006
    -			-6:00	Canada	C%sT
    -
    -
    -# Saskatchewan
    -
    -# From Mark Brader (2003-07-26):
    -# The first actual adoption of DST in Canada was at the municipal
    -# level.  As the [Toronto] Star put it (1912-06-07), "While people
    -# elsewhere have long been talking of legislation to save daylight,
    -# the city of Moose Jaw [Saskatchewan] has acted on its own hook."
    -# DST in Moose Jaw began on Saturday, 1912-06-01 (no time mentioned:
    -# presumably late evening, as below), and would run until "the end of
    -# the summer".  The discrepancy between municipal time and railroad
    -# time was noted.
    -
    -# From Paul Eggert (2003-07-27):
    -# Willett (1914-03) notes that DST "has been in operation ... in the
    -# City of Moose Jaw, Saskatchewan, for one year."
    -
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger say that since 1970 this region has mostly been as Regina.
    -# Some western towns (e.g. Swift Current) switched from MST/MDT to CST in 1972.
    -# Other western towns (e.g. Lloydminster) are like Edmonton.
    -# Matthews and Vincent (1998) write that Denare Beach and Creighton
    -# are like Winnipeg, in violation of Saskatchewan law.
    -
    -# From W. Jones (1992-11-06):
    -# The. . .below is based on information I got from our law library, the
    -# provincial archives, and the provincial Community Services department.
    -# A precise history would require digging through newspaper archives, and
    -# since you didn't say what you wanted, I didn't bother.
    -#
    -# Saskatchewan is split by a time zone meridian (105W) and over the years
    -# the boundary became pretty ragged as communities near it reevaluated
    -# their affiliations in one direction or the other.  In 1965 a provincial
    -# referendum favoured legislating common time practices.
    -#
    -# On 15 April 1966 the Time Act (c. T-14, Revised Statutes of
    -# Saskatchewan 1978) was proclaimed, and established that the eastern
    -# part of Saskatchewan would use CST year round, that districts in
    -# northwest Saskatchewan would by default follow CST but could opt to
    -# follow Mountain Time rules (thus 1 hour difference in the winter and
    -# zero in the summer), and that districts in southwest Saskatchewan would
    -# by default follow MT but could opt to follow CST.
    -#
    -# It took a few years for the dust to settle (I know one story of a town
    -# on one time zone having its school in another, such that a mom had to
    -# serve her family lunch in two shifts), but presently it seems that only
    -# a few towns on the border with Alberta (e.g. Lloydminster) follow MT
    -# rules any more; all other districts appear to have used CST year round
    -# since sometime in the 1960s.
    -
    -# From Chris Walton (2006-06-26):
    -# The Saskatchewan time act which was last updated in 1996 is about 30 pages
    -# long and rather painful to read.
    -# http://www.qp.gov.sk.ca/documents/English/Statutes/Statutes/T14.pdf
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Regina	1918	only	-	Apr	14	2:00	1:00	D
    -Rule	Regina	1918	only	-	Oct	27	2:00	0	S
    -Rule	Regina	1930	1934	-	May	Sun>=1	0:00	1:00	D
    -Rule	Regina	1930	1934	-	Oct	Sun>=1	0:00	0	S
    -Rule	Regina	1937	1941	-	Apr	Sun>=8	0:00	1:00	D
    -Rule	Regina	1937	only	-	Oct	Sun>=8	0:00	0	S
    -Rule	Regina	1938	only	-	Oct	Sun>=1	0:00	0	S
    -Rule	Regina	1939	1941	-	Oct	Sun>=8	0:00	0	S
    -Rule	Regina	1942	only	-	Feb	 9	2:00	1:00	W # War
    -Rule	Regina	1945	only	-	Aug	14	23:00u	1:00	P # Peace
    -Rule	Regina	1945	only	-	Sep	lastSun	2:00	0	S
    -Rule	Regina	1946	only	-	Apr	Sun>=8	2:00	1:00	D
    -Rule	Regina	1946	only	-	Oct	Sun>=8	2:00	0	S
    -Rule	Regina	1947	1957	-	Apr	lastSun	2:00	1:00	D
    -Rule	Regina	1947	1957	-	Sep	lastSun	2:00	0	S
    -Rule	Regina	1959	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Regina	1959	only	-	Oct	lastSun	2:00	0	S
    -#
    -Rule	Swift	1957	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Swift	1957	only	-	Oct	lastSun	2:00	0	S
    -Rule	Swift	1959	1961	-	Apr	lastSun	2:00	1:00	D
    -Rule	Swift	1959	only	-	Oct	lastSun	2:00	0	S
    -Rule	Swift	1960	1961	-	Sep	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Regina	-6:58:36 -	LMT	1905 Sep
    -			-7:00	Regina	M%sT	1960 Apr lastSun  2:00
    -			-6:00	-	CST
    -Zone America/Swift_Current -7:11:20 -	LMT	1905 Sep
    -			-7:00	Canada	M%sT	1946 Apr lastSun  2:00
    -			-7:00	Regina	M%sT	1950
    -			-7:00	Swift	M%sT	1972 Apr lastSun  2:00
    -			-6:00	-	CST
    -
    -
    -# Alberta
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Edm	1918	1919	-	Apr	Sun>=8	2:00	1:00	D
    -Rule	Edm	1918	only	-	Oct	27	2:00	0	S
    -Rule	Edm	1919	only	-	May	27	2:00	0	S
    -Rule	Edm	1920	1923	-	Apr	lastSun	2:00	1:00	D
    -Rule	Edm	1920	only	-	Oct	lastSun	2:00	0	S
    -Rule	Edm	1921	1923	-	Sep	lastSun	2:00	0	S
    -Rule	Edm	1942	only	-	Feb	 9	2:00	1:00	W # War
    -Rule	Edm	1945	only	-	Aug	14	23:00u	1:00	P # Peace
    -Rule	Edm	1945	only	-	Sep	lastSun	2:00	0	S
    -Rule	Edm	1947	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Edm	1947	only	-	Sep	lastSun	2:00	0	S
    -Rule	Edm	1967	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Edm	1967	only	-	Oct	lastSun	2:00	0	S
    -Rule	Edm	1969	only	-	Apr	lastSun	2:00	1:00	D
    -Rule	Edm	1969	only	-	Oct	lastSun	2:00	0	S
    -Rule	Edm	1972	1986	-	Apr	lastSun	2:00	1:00	D
    -Rule	Edm	1972	2006	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Edmonton	-7:33:52 -	LMT	1906 Sep
    -			-7:00	Edm	M%sT	1987
    -			-7:00	Canada	M%sT
    -
    -
    -# British Columbia
    -
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger write that since 1970 most of this region has
    -# been like Vancouver.
    -# Dawson Creek uses MST.  Much of east BC is like Edmonton.
    -# Matthews and Vincent (1998) write that Creston is like Dawson Creek.
    -
    -# It seems though that (re: Creston) is not entirely correct:
    -
    -# From Chris Walton (2011-12-01):
    -# There are two areas within the Canadian province of British Columbia
    -# that do not currently observe daylight saving:
    -# a) The Creston Valley (includes the town of Creston and surrounding area)
    -# b) The eastern half of the Peace River Regional District
    -# (includes the cities of Dawson Creek and Fort St. John)
    -
    -# Earlier this year I stumbled across a detailed article about the time
    -# keeping history of Creston; it was written by Tammy Hardwick who is the
    -# manager of the Creston & District Museum. The article was written in May 2009.
    -# http://www.ilovecreston.com/?p=articles&t=spec&ar=260
    -# According to the article, Creston has not changed its clocks since June 1918.
    -# i.e. Creston has been stuck on UTC-7 for 93 years.
    -# Dawson Creek, on the other hand, changed its clocks as recently as April 1972.
    -
    -# Unfortunately the exact date for the time change in June 1918 remains
    -# unknown and will be difficult to ascertain.  I e-mailed Tammy a few months
    -# ago to ask if Sunday June 2 was a reasonable guess.  She said it was just
    -# as plausible as any other date (in June).  She also said that after writing
    -# the article she had discovered another time change in 1916; this is the
    -# subject of another article which she wrote in October 2010.
    -# http://www.creston.museum.bc.ca/index.php?module=comments&uop=view_comment&cm+id=56
    -
    -# Here is a summary of the three clock change events in Creston's history:
    -# 1. 1884 or 1885: adoption of Mountain Standard Time (GMT-7)
    -# Exact date unknown
    -# 2. Oct 1916: switch to Pacific Standard Time (GMT-8)
    -# Exact date in October unknown; Sunday October 1 is a reasonable guess.
    -# 3. June 1918: switch to Pacific Daylight Time (GMT-7)
    -# Exact date in June unknown; Sunday June 2 is a reasonable guess.
    -# note 1:
    -# On Oct 27/1918 when daylight saving ended in the rest of Canada,
    -# Creston did not change its clocks.
    -# note 2:
    -# During WWII when the Federal Government legislated a mandatory clock change,
    -# Creston did not oblige.
    -# note 3:
    -# There is no guarantee that Creston will remain on Mountain Standard Time
    -# (UTC-7) forever.
    -# The subject was debated at least once this year by the town Council.
    -# http://www.bclocalnews.com/kootenay_rockies/crestonvalleyadvance/news/116760809.html
    -
    -# During a period WWII, summer time (Daylight saying) was mandatory in Canada.
    -# In Creston, that was handled by shifting the area to PST (-8:00) then applying
    -# summer time to cause the offset to be -7:00, the same as it had been before
    -# the change.  It can be argued that the timezone abbreviation during this
    -# period should be PDT rather than MST, but that doesn't seem important enough
    -# (to anyone) to further complicate the rules.
    -
    -# The transition dates (and times) are guesses.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Vanc	1918	only	-	Apr	14	2:00	1:00	D
    -Rule	Vanc	1918	only	-	Oct	27	2:00	0	S
    -Rule	Vanc	1942	only	-	Feb	 9	2:00	1:00	W # War
    -Rule	Vanc	1945	only	-	Aug	14	23:00u	1:00	P # Peace
    -Rule	Vanc	1945	only	-	Sep	30	2:00	0	S
    -Rule	Vanc	1946	1986	-	Apr	lastSun	2:00	1:00	D
    -Rule	Vanc	1946	only	-	Oct	13	2:00	0	S
    -Rule	Vanc	1947	1961	-	Sep	lastSun	2:00	0	S
    -Rule	Vanc	1962	2006	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Vancouver	-8:12:28 -	LMT	1884
    -			-8:00	Vanc	P%sT	1987
    -			-8:00	Canada	P%sT
    -Zone America/Dawson_Creek -8:00:56 -	LMT	1884
    -			-8:00	Canada	P%sT	1947
    -			-8:00	Vanc	P%sT	1972 Aug 30  2:00
    -			-7:00	-	MST
    -Zone America/Creston	-7:46:04 -	LMT	1884
    -			-7:00	-	MST	1916 Oct 1
    -			-8:00	-	PST	1918 Jun 2
    -			-7:00	-	MST
    -
    -# Northwest Territories, Nunavut, Yukon
    -
    -# From Paul Eggert (2006-03-22):
    -# Dawson switched to PST in 1973.  Inuvik switched to MST in 1979.
    -# Mathew Englander (1996-10-07) gives the following refs:
    -#	* 1967. Paragraph 28(34)(g) of the Interpretation Act, S.C. 1967-68,
    -#	c. 7 defines Yukon standard time as UTC-9....
    -#	see Interpretation Act, R.S.C. 1985, c. I-21, s. 35(1).
    -#	[http://canlii.ca/t/7vhg]
    -#	* C.O. 1973/214 switched Yukon to PST on 1973-10-28 00:00.
    -#	* O.I.C. 1980/02 established DST.
    -#	* O.I.C. 1987/056 changed DST to Apr firstSun 2:00 to Oct lastSun 2:00.
    -
    -# From Brian Inglis (2015-04-14):
    -#
    -# I tried to trace the history of Yukon time and found the following
    -# regulations, giving the reference title and URL if found, regulation name,
    -# and relevant quote if available.  Each regulation specifically revokes its
    -# predecessor.  The final reference is to the current Interpretation Act
    -# authorizing and resulting from these regulatory changes.
    -#
    -# Only recent regulations were retrievable via Yukon government site search or
    -# index, and only some via Canadian legal sources.  Other sources used include
    -# articles titled "Standard Time and Time Zones in Canada" from JRASC via ADS
    -# Abstracts, cited by ADO for 1932 ..., and updated versions from 1958 and
    -# 1970 quoted below; each article includes current extracts from provincial
    -# and territorial ST and DST regulations at the end, summaries and details of
    -# standard times and daylight saving time at many locations across Canada,
    -# with time zone maps, tables and calculations for Canadian Sunrise, Sunset,
    -# and LMST; they also cover many countries and global locations, with a chart
    -# and table showing current Universal Time offsets, and may be useful as
    -# another source of information for 1970 and earlier.
    -#
    -# * Standard Time and Time Zones in Canada; Smith, C.C.; JRASC, Vol. 26,
    -#   pp.49-77; February 1932; SAO/NASA Astrophysics Data System (ADS)
    -#   http://adsabs.harvard.edu/abs/1932JRASC..26...49S from p.75:
    -#   Yukon Interpretation Ordinance
    -#   Yukon standard time is the local mean time at the one hundred and
    -#   thirty-fifth meridian.
    -#
    -# * Standard Time and Time Zones in Canada; Smith, C.C.; Thomson, Malcolm M.;
    -#   JRASC, Vol. 52, pp.193-223; October 1958; SAO/NASA Astrophysics Data System
    -#   (ADS) http://adsabs.harvard.edu/abs/1958JRASC..52..193S from pp.220-1:
    -#   Yukon Interpretation Ordinance, 1955, Chap. 16.
    -#
    -#     (1) Subject to this section, standard time shall be reckoned as nine
    -#     hours behind Greenwich Time and called Yukon Standard Time.
    -#
    -#     (2) Notwithstanding subsection (1), the Commissioner may make regulations
    -#     varying the manner of reckoning standard time.
    -#
    -# * Yukon Territory Commissioner's Order 1966-20 Interpretation Ordinance
    -#   http://? - no online source found
    -#
    -# * Standard Time and Time Zones in Canada; Thomson, Malcolm M.; JRASC,
    -#   Vol. 64, pp.129-162; June 1970; SAO/NASA Astrophysics Data System (ADS)
    -#   http://adsabs.harvard.edu/abs/1970JRASC..64..129T from p.156: Yukon
    -#   Territory Commissioner's Order 1967-59 Interpretation Ordinance ...
    -#
    -#     1. Commissioner's Order 1966-20 dated at Whitehorse in the Yukon
    -#     Territory on 27th January, 1966, is hereby revoked.
    -#
    -#     2. Yukon (East) Standard Time as defined by section 36 of the
    -#     Interpretation Ordinance from and after mid-night on the 28th day of May,
    -#     1967 shall be reckoned in the same manner as Pacific Standard Time, that
    -#     is to say, eight hours behind Greenwich Time in the area of the Yukon
    -#     Territory lying east of the 138th degree longitude west.
    -#
    -#     3. In the remainder of the Territory, lying west of the 138th degree
    -#     longitude west, Yukon (West) Standard Time shall be reckoned as nine
    -#     hours behind Greenwich Time.
    -#
    -# * Yukon Standard Time defined as Pacific Standard Time, YCO 1973/214
    -#   http://www.canlii.org/en/yk/laws/regu/yco-1973-214/latest/yco-1973-214.html
    -#   C.O. 1973/214 INTERPRETATION ACT ...
    -#
    -#     1. Effective October 28, 1973 Commissioner's Order 1967/59 is hereby
    -#     revoked.
    -#
    -#     2. Yukon Standard Time as defined by section 36 of the Interpretation
    -#     Act from and after midnight on the twenty-eighth day of October, 1973
    -#     shall be reckoned in the same manner as Pacific Standard Time, that is
    -#     to say eight hours behind Greenwich Time.
    -#
    -# * O.I.C. 1980/02 INTERPRETATION ACT
    -#   http://? - no online source found
    -#
    -# * Yukon Daylight Saving Time, YOIC 1987/56
    -#   http://www.canlii.org/en/yk/laws/regu/yoic-1987-56/latest/yoic-1987-56.html
    -#   O.I.C. 1987/056 INTERPRETATION ACT ...
    -#
    -#   In every year between
    -#     (a) two o'clock in the morning in the first Sunday in April, and
    -#     (b) two o'clock in the morning in the last Sunday in October,
    -#   Standard Time shall be reckoned as seven hours behind Greenwich Time and
    -#   called Yukon Daylight Saving Time.
    -#   ...
    -#   Dated ... 9th day of March, A.D., 1987.
    -#
    -# * Yukon Daylight Saving Time 2006, YOIC 2006/127
    -#   http://www.canlii.org/en/yk/laws/regu/yoic-2006-127/latest/yoic-2006-127.html
    -#   O.I.C. 2006/127 INTERPRETATION ACT ...
    -#
    -#     1. In Yukon each year the time for general purposes shall be 7 hours
    -#     behind Greenwich mean time during the period commencing at two o'clock
    -#     in the forenoon on the second Sunday of March and ending at two o'clock
    -#     in the forenoon on the first Sunday of November and shall be called
    -#     Yukon Daylight Saving Time.
    -#
    -#     2. Order-in-Council 1987/56 is revoked.
    -#
    -#     3. This order comes into force January 1, 2007.
    -#
    -# * Interpretation Act, RSY 2002, c 125
    -# http://www.canlii.org/en/yk/laws/stat/rsy-2002-c-125/latest/rsy-2002-c-125.html
    -
    -# From Rives McDow (1999-09-04):
    -# Nunavut ... moved ... to incorporate the whole territory into one time zone.
    -# Nunavut moves to single time zone Oct. 31
    -# http://www.nunatsiaq.com/nunavut/nvt90903_13.html
    -#
    -# From Antoine Leca (1999-09-06):
    -# We then need to create a new timezone for the Kitikmeot region of Nunavut
    -# to differentiate it from the Yellowknife region.
    -
    -# From Paul Eggert (1999-09-20):
    -# Basic Facts: The New Territory
    -# http://www.nunavut.com/basicfacts/english/basicfacts_1territory.html
    -# (1999) reports that Pangnirtung operates on eastern time,
    -# and that Coral Harbour does not observe DST.  We don't know when
    -# Pangnirtung switched to eastern time; we'll guess 1995.
    -
    -# From Rives McDow (1999-11-08):
    -# On October 31, when the rest of Nunavut went to Central time,
    -# Pangnirtung wobbled.  Here is the result of their wobble:
    -#
    -# The following businesses and organizations in Pangnirtung use Central Time:
    -#
    -#	First Air, Power Corp, Nunavut Construction, Health Center, RCMP,
    -#	Eastern Arctic National Parks, A & D Specialist
    -#
    -# The following businesses and organizations in Pangnirtung use Eastern Time:
    -#
    -#	Hamlet office, All other businesses, Both schools, Airport operator
    -#
    -# This has made for an interesting situation there, which warranted the news.
    -# No one there that I spoke with seems concerned, or has plans to
    -# change the local methods of keeping time, as it evidently does not
    -# really interfere with any activities or make things difficult locally.
    -# They plan to celebrate New Year's turn-over twice, one hour apart,
    -# so it appears that the situation will last at least that long.
    -# The Nunavut Intergovernmental Affairs hopes that they will "come to
    -# their senses", but the locals evidently don't see any problem with
    -# the current state of affairs.
    -
    -# From Michaela Rodrigue, writing in the
    -# Nunatsiaq News (1999-11-19):
    -# http://www.nunatsiaq.com/archives/nunavut991130/nvt91119_17.html
    -# Clyde River, Pangnirtung and Sanikiluaq now operate with two time zones,
    -# central - or Nunavut time - for government offices, and eastern time
    -# for municipal offices and schools....  Igloolik [was similar but then]
    -# made the switch to central time on Saturday, Nov. 6.
    -
    -# From Paul Eggert (2000-10-02):
    -# Matthews and Vincent (1998) say the following, but we lack histories
    -# for these potential new Zones.
    -#
    -# The Canadian Forces station at Alert uses Eastern Time while the
    -# handful of residents at the Eureka weather station [in the Central
    -# zone] skip daylight savings.  Baffin Island, which is crossed by the
    -# Central, Eastern and Atlantic Time zones only uses Eastern Time.
    -# Gjoa Haven, Taloyoak and Pelly Bay all use Mountain instead of
    -# Central Time and Southampton Island [in the Central zone] is not
    -# required to use daylight savings.
    -
    -# From 
    -# Nunavut now has two time zones (2000-11-10):
    -# The Nunavut government would allow its employees in Kugluktuk and
    -# Cambridge Bay to operate on central time year-round, putting them
    -# one hour behind the rest of Nunavut for six months during the winter.
    -# At the end of October the two communities had rebelled against
    -# Nunavut's unified time zone, refusing to shift to eastern time with
    -# the rest of the territory for the winter.  Cambridge Bay remained on
    -# central time, while Kugluktuk, even farther west, reverted to
    -# mountain time, which they had used before the advent of Nunavut's
    -# unified time zone in 1999.
    -#
    -# From Rives McDow (2001-01-20), quoting the Nunavut government:
    -# The preceding decision came into effect at midnight, Saturday Nov 4, 2000.
    -
    -# From Paul Eggert (2000-12-04):
    -# Let's just keep track of the official times for now.
    -
    -# From Rives McDow (2001-03-07):
    -# The premier of Nunavut has issued a ministerial statement advising
    -# that effective 2001-04-01, the territory of Nunavut will revert
    -# back to three time zones (mountain, central, and eastern).  Of the
    -# cities in Nunavut, Coral Harbor is the only one that I know of that
    -# has said it will not observe dst, staying on EST year round.  I'm
    -# checking for more info, and will get back to you if I come up with
    -# more.
    -# [Also see  (2001-03-09).]
    -
    -# From Gwillim Law (2005-05-21):
    -# According to ...
    -# http://www.canadiangeographic.ca/Magazine/SO98/geomap.asp
    -# (from a 1998 Canadian Geographic article), the de facto and de jure time
    -# for Southampton Island (at the north end of Hudson Bay) is UTC-5 all year
    -# round.  Using Google, it's easy to find other websites that confirm this.
    -# I wasn't able to find how far back this time regimen goes, but since it
    -# predates the creation of Nunavut, it probably goes back many years....
    -# The Inuktitut name of Coral Harbour is Sallit, but it's rarely used.
    -#
    -# From Paul Eggert (2014-10-17):
    -# For lack of better information, assume that Southampton Island observed
    -# daylight saving only during wartime.  Gwillim Law's email also
    -# mentioned maps now maintained by National Research Council Canada;
    -# see above for an up-to-date link.
    -
    -# From Chris Walton (2007-03-01):
    -# ... the community of Resolute (located on Cornwallis Island in
    -# Nunavut) moved from Central Time to Eastern Time last November.
    -# Basically the community did not change its clocks at the end of
    -# daylight saving....
    -# http://www.nnsl.com/frames/newspapers/2006-11/nov13_06none.html
    -
    -# From Chris Walton (2011-03-21):
    -# Back in 2007 I initiated the creation of a new "zone file" for Resolute
    -# Bay. Resolute Bay is a small community located about 900km north of
    -# the Arctic Circle. The zone file was required because Resolute Bay had
    -# decided to use UTC-5 instead of UTC-6 for the winter of 2006-2007.
    -#
    -# According to new information which I received last week, Resolute Bay
    -# went back to using UTC-6 in the winter of 2007-2008...
    -#
    -# On March 11/2007 most of Canada went onto daylight saving. On March
    -# 14/2007 I phoned the Resolute Bay hamlet office to do a "time check." I
    -# talked to somebody that was both knowledgeable and helpful. I was able
    -# to confirm that Resolute Bay was still operating on UTC-5. It was
    -# explained to me that Resolute Bay had been on the Eastern Time zone
    -# (EST) in the winter, and was now back on the Central Time zone (CDT).
    -# i.e. the time zone had changed twice in the last year but the clocks
    -# had not moved. The residents had to know which time zone they were in
    -# so they could follow the correct TV schedule...
    -#
    -# On Nov 02/2008 most of Canada went onto standard time. On Nov 03/2008 I
    -# phoned the Resolute Bay hamlet office...[D]ue to the challenging nature
    -# of the phone call, I decided to seek out an alternate source of
    -# information. I found an e-mail address for somebody by the name of
    -# Stephanie Adams whose job was listed as "Inns North Support Officer for
    -# Arctic Co-operatives." I was under the impression that Stephanie lived
    -# and worked in Resolute Bay...
    -#
    -# On March 14/2011 I phoned the hamlet office again. I was told that
    -# Resolute Bay had been using Central Standard Time over the winter of
    -# 2010-2011 and that the clocks had therefore been moved one hour ahead
    -# on March 13/2011. The person I talked to was aware that Resolute Bay
    -# had previously experimented with Eastern Standard Time but he could not
    -# tell me when the practice had stopped.
    -#
    -# On March 17/2011 I searched the Web to find an e-mail address of
    -# somebody that might be able to tell me exactly when Resolute Bay went
    -# off Eastern Standard Time. I stumbled on the name "Aziz Kheraj." Aziz
    -# used to be the mayor of Resolute Bay and he apparently owns half the
    -# businesses including "South Camp Inn." This website has some info on
    -# Aziz:
    -# http://www.uphere.ca/node/493
    -#
    -# I sent Aziz an e-mail asking when Resolute Bay had stopped using
    -# Eastern Standard Time.
    -#
    -# Aziz responded quickly with this: "hi, The time was not changed for the
    -# 1 year only, the following year, the community went back to the old way
    -# of "spring ahead-fall behind" currently we are zulu plus 5 hrs and in
    -# the winter Zulu plus 6 hrs"
    -#
    -# This of course conflicted with everything I had ascertained in November 2008.
    -#
    -# I sent Aziz a copy of my 2008 e-mail exchange with Stephanie. Aziz
    -# responded with this: "Hi, Stephanie lives in Winnipeg. I live here, You
    -# may want to check with the weather office in Resolute Bay or do a
    -# search on the weather through Env. Canada. web site"
    -#
    -# If I had realized the Stephanie did not live in Resolute Bay I would
    -# never have contacted her.  I now believe that all the information I
    -# obtained in November 2008 should be ignored...
    -# I apologize for reporting incorrect information in 2008.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	NT_YK	1918	only	-	Apr	14	2:00	1:00	D
    -Rule	NT_YK	1918	only	-	Oct	27	2:00	0	S
    -Rule	NT_YK	1919	only	-	May	25	2:00	1:00	D
    -Rule	NT_YK	1919	only	-	Nov	 1	0:00	0	S
    -Rule	NT_YK	1942	only	-	Feb	 9	2:00	1:00	W # War
    -Rule	NT_YK	1945	only	-	Aug	14	23:00u	1:00	P # Peace
    -Rule	NT_YK	1945	only	-	Sep	30	2:00	0	S
    -Rule	NT_YK	1965	only	-	Apr	lastSun	0:00	2:00	DD
    -Rule	NT_YK	1965	only	-	Oct	lastSun	2:00	0	S
    -Rule	NT_YK	1980	1986	-	Apr	lastSun	2:00	1:00	D
    -Rule	NT_YK	1980	2006	-	Oct	lastSun	2:00	0	S
    -Rule	NT_YK	1987	2006	-	Apr	Sun>=1	2:00	1:00	D
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -# aka Panniqtuuq
    -Zone America/Pangnirtung 0	-	zzz	1921 # trading post est.
    -			-4:00	NT_YK	A%sT	1995 Apr Sun>=1  2:00
    -			-5:00	Canada	E%sT	1999 Oct 31  2:00
    -			-6:00	Canada	C%sT	2000 Oct 29  2:00
    -			-5:00	Canada	E%sT
    -# formerly Frobisher Bay
    -Zone America/Iqaluit	0	-	zzz	1942 Aug # Frobisher Bay est.
    -			-5:00	NT_YK	E%sT	1999 Oct 31  2:00
    -			-6:00	Canada	C%sT	2000 Oct 29  2:00
    -			-5:00	Canada	E%sT
    -# aka Qausuittuq
    -Zone America/Resolute	0	-	zzz	1947 Aug 31 # Resolute founded
    -			-6:00	NT_YK	C%sT	2000 Oct 29  2:00
    -			-5:00	-	EST	2001 Apr  1  3:00
    -			-6:00	Canada	C%sT	2006 Oct 29  2:00
    -			-5:00	-	EST	2007 Mar 11  3:00
    -			-6:00	Canada	C%sT
    -# aka Kangiqiniq
    -Zone America/Rankin_Inlet 0	-	zzz	1957 # Rankin Inlet founded
    -			-6:00	NT_YK	C%sT	2000 Oct 29  2:00
    -			-5:00	-	EST	2001 Apr  1  3:00
    -			-6:00	Canada	C%sT
    -# aka Iqaluktuuttiaq
    -Zone America/Cambridge_Bay 0	-	zzz	1920 # trading post est.?
    -			-7:00	NT_YK	M%sT	1999 Oct 31  2:00
    -			-6:00	Canada	C%sT	2000 Oct 29  2:00
    -			-5:00	-	EST	2000 Nov  5  0:00
    -			-6:00	-	CST	2001 Apr  1  3:00
    -			-7:00	Canada	M%sT
    -Zone America/Yellowknife 0	-	zzz	1935 # Yellowknife founded?
    -			-7:00	NT_YK	M%sT	1980
    -			-7:00	Canada	M%sT
    -Zone America/Inuvik	0	-	zzz	1953 # Inuvik founded
    -			-8:00	NT_YK	P%sT	1979 Apr lastSun  2:00
    -			-7:00	NT_YK	M%sT	1980
    -			-7:00	Canada	M%sT
    -Zone America/Whitehorse	-9:00:12 -	LMT	1900 Aug 20
    -			-9:00	NT_YK	Y%sT	1967 May 28  0:00
    -			-8:00	NT_YK	P%sT	1980
    -			-8:00	Canada	P%sT
    -Zone America/Dawson	-9:17:40 -	LMT	1900 Aug 20
    -			-9:00	NT_YK	Y%sT	1973 Oct 28  0:00
    -			-8:00	NT_YK	P%sT	1980
    -			-8:00	Canada	P%sT
    -
    -
    -###############################################################################
    -
    -# Mexico
    -
    -# From Paul Eggert (2014-12-07):
    -# The Investigation and Analysis Service of the
    -# Mexican Library of Congress (MLoC) has published a
    -# history of Mexican local time (in Spanish)
    -# http://www.diputados.gob.mx/bibliot/publica/inveyana/polisoc/horver/index.htm
    -#
    -# Here are the discrepancies between Shanks & Pottenger (S&P) and the MLoC.
    -# (In all cases we go with the MLoC.)
    -# S&P report that Baja was at -8:00 in 1922/1923.
    -# S&P say the 1930 transition in Baja was 1930-11-16.
    -# S&P report no DST during summer 1931.
    -# S&P report a transition at 1932-03-30 23:00, not 1932-04-01.
    -
    -# From Gwillim Law (2001-02-20):
    -# There are some other discrepancies between the Decrees page and the
    -# tz database.  I think they can best be explained by supposing that
    -# the researchers who prepared the Decrees page failed to find some of
    -# the relevant documents.
    -
    -# From Alan Perry (1996-02-15):
    -# A guy from our Mexico subsidiary finally found the Presidential Decree
    -# outlining the timezone changes in Mexico.
    -#
    -# ------------- Begin Forwarded Message -------------
    -#
    -# I finally got my hands on the Official Presidential Decree that sets up the
    -# rules for the DST changes. The rules are:
    -#
    -# 1. The country is divided in 3 timezones:
    -#    - Baja California Norte (the Mexico/BajaNorte TZ)
    -#    - Baja California Sur, Nayarit, Sinaloa and Sonora (the Mexico/BajaSur TZ)
    -#    - The rest of the country (the Mexico/General TZ)
    -#
    -# 2. From the first Sunday in April at 2:00 AM to the last Sunday in October
    -#    at 2:00 AM, the times in each zone are as follows:
    -#    BajaNorte: GMT+7
    -#    BajaSur:   GMT+6
    -#    General:   GMT+5
    -#
    -# 3. The rest of the year, the times are as follows:
    -#    BajaNorte: GMT+8
    -#    BajaSur:   GMT+7
    -#    General:   GMT+6
    -#
    -# The Decree was published in Mexico's Official Newspaper on January 4th.
    -#
    -# -------------- End Forwarded Message --------------
    -# From Paul Eggert (1996-06-12):
    -# For an English translation of the decree, see
    -# "Diario Oficial: Time Zone Changeover" (1996-01-04).
    -# http://mexico-travel.com/extra/timezone_eng.html
    -
    -# From Rives McDow (1998-10-08):
    -# The State of Quintana Roo has reverted back to central STD and DST times
    -# (i.e. UTC -0600 and -0500 as of 1998-08-02).
    -
    -# From Rives McDow (2000-01-10):
    -# Effective April 4, 1999 at 2:00 AM local time, Sonora changed to the time
    -# zone 5 hours from the International Date Line, and will not observe daylight
    -# savings time so as to stay on the same time zone as the southern part of
    -# Arizona year round.
    -
    -# From Jesper Nørgaard, translating
    -#  (2001-01-17):
    -# In Oaxaca, the 55.000 teachers from the Section 22 of the National
    -# Syndicate of Education Workers, refuse to apply daylight saving each
    -# year, so that the more than 10,000 schools work at normal hour the
    -# whole year.
    -
    -# From Gwillim Law (2001-01-19):
    -#  ... says
    -# (translated):...
    -# January 17, 2000 - The Energy Secretary, Ernesto Martens, announced
    -# that Summer Time will be reduced from seven to five months, starting
    -# this year....
    -# http://www.publico.com.mx/scripts/texto3.asp?action=pagina&pag=21&pos=p&secc=naci&date=01/17/2001
    -# [translated], says "summer time will ... take effect on the first Sunday
    -# in May, and end on the last Sunday of September.
    -
    -# From Arthur David Olson (2001-01-25):
    -# The 2001-01-24 traditional Washington Post contained the page one
    -# story "Timely Issue Divides Mexicans."...
    -# http://www.washingtonpost.com/wp-dyn/articles/A37383-2001Jan23.html
    -# ... Mexico City Mayor López Obrador "...is threatening to keep
    -# Mexico City and its 20 million residents on a different time than
    -# the rest of the country..." In particular, López Obrador would abolish
    -# observation of Daylight Saving Time.
    -
    -# Official statute published by the Energy Department
    -# http://www.conae.gob.mx/ahorro/decretohorver2001.html#decre
    -# (2001-02-01) shows Baja and Chihauhua as still using US DST rules,
    -# and Sonora with no DST.  This was reported by Jesper Nørgaard (2001-02-03).
    -
    -# From Paul Eggert (2001-03-03):
    -#
    -# http://www.latimes.com/news/nation/20010303/t000018766.html
    -# James F. Smith writes in today's LA Times
    -# * Sonora will continue to observe standard time.
    -# * Last week Mexico City's mayor Andrés Manuel López Obrador decreed that
    -#   the Federal District will not adopt DST.
    -# * 4 of 16 district leaders announced they'll ignore the decree.
    -# * The decree does not affect federal-controlled facilities including
    -#   the airport, banks, hospitals, and schools.
    -#
    -# For now we'll assume that the Federal District will bow to federal rules.
    -
    -# From Jesper Nørgaard (2001-04-01):
    -# I found some references to the Mexican application of daylight
    -# saving, which modifies what I had already sent you, stating earlier
    -# that a number of northern Mexican states would go on daylight
    -# saving. The modification reverts this to only cover Baja California
    -# (Norte), while all other states (except Sonora, who has no daylight
    -# saving all year) will follow the original decree of president
    -# Vicente Fox, starting daylight saving May 6, 2001 and ending
    -# September 30, 2001.
    -# References: "Diario de Monterrey" 
    -# Palabra  (2001-03-31)
    -
    -# From Reuters (2001-09-04):
    -# Mexico's Supreme Court on Tuesday declared that daylight savings was
    -# unconstitutional in Mexico City, creating the possibility the
    -# capital will be in a different time zone from the rest of the nation
    -# next year....  The Supreme Court's ruling takes effect at 2:00
    -# a.m. (0800 GMT) on Sept. 30, when Mexico is scheduled to revert to
    -# standard time. "This is so residents of the Federal District are not
    -# subject to unexpected time changes," a statement from the court said.
    -
    -# From Jesper Nørgaard Welen (2002-03-12):
    -# ... consulting my local grocery store(!) and my coworkers, they all insisted
    -# that a new decision had been made to reinstate US style DST in Mexico....
    -# http://www.conae.gob.mx/ahorro/horaver2001_m1_2002.html (2002-02-20)
    -# confirms this.  Sonora as usual is the only state where DST is not applied.
    -
    -# From Steffen Thorsen (2009-12-28):
    -#
    -# Steffen Thorsen wrote:
    -# > Mexico's House of Representatives has approved a proposal for northern
    -# > Mexico's border cities to share the same daylight saving schedule as
    -# > the United States.
    -# Now this has passed both the Congress and the Senate, so starting from
    -# 2010, some border regions will be the same:
    -# http://www.signonsandiego.com/news/2009/dec/28/clocks-will-match-both-sides-border/
    -# http://www.elmananarey.com/diario/noticia/nacional/noticias/empatan_horario_de_frontera_con_eu/621939
    -# (Spanish)
    -#
    -# Could not find the new law text, but the proposed law text changes are here:
    -# http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/20091210-V.pdf
    -# (Gaceta Parlamentaria)
    -#
    -# There is also a list of the votes here:
    -# http://gaceta.diputados.gob.mx/Gaceta/61/2009/dic/V2-101209.html
    -#
    -# Our page:
    -# http://www.timeanddate.com/news/time/north-mexico-dst-change.html
    -
    -# From Arthur David Olson (2010-01-20):
    -# The page
    -# http://dof.gob.mx/nota_detalle.php?codigo=5127480&fecha=06/01/2010
    -# includes this text:
    -# En los municipios fronterizos de Tijuana y Mexicali en Baja California;
    -# Juárez y Ojinaga en Chihuahua; Acuña y Piedras Negras en Coahuila;
    -# Anáhuac en Nuevo León; y Nuevo Laredo, Reynosa y Matamoros en
    -# Tamaulipas, la aplicación de este horario estacional surtirá efecto
    -# desde las dos horas del segundo domingo de marzo y concluirá a las dos
    -# horas del primer domingo de noviembre.
    -# En los municipios fronterizos que se encuentren ubicados en la franja
    -# fronteriza norte en el territorio comprendido entre la línea
    -# internacional y la línea paralela ubicada a una distancia de veinte
    -# kilómetros, así como la Ciudad de Ensenada, Baja California, hacia el
    -# interior del país, la aplicación de este horario estacional surtirá
    -# efecto desde las dos horas del segundo domingo de marzo y concluirá a
    -# las dos horas del primer domingo de noviembre.
    -
    -# From Steffen Thorsen (2014-12-08), translated by Gwillim Law:
    -# The Mexican state of Quintana Roo will likely change to EST in 2015.
    -#
    -# http://www.unioncancun.mx/articulo/2014/12/04/medio-ambiente/congreso-aprueba-una-hora-mas-de-sol-en-qroo
    -# "With this change, the time conflict that has existed between the municipios
    -# of Quintana Roo and the municipio of Felipe Carrillo Puerto may come to an
    -# end. The latter declared itself in rebellion 15 years ago when a time change
    -# was initiated in Mexico, and since then it has refused to change its time
    -# zone along with the rest of the country."
    -#
    -# From Steffen Thorsen (2015-01-14), translated by Gwillim Law:
    -# http://sipse.com/novedades/confirman-aplicacion-de-nueva-zona-horaria-para-quintana-roo-132331.html
    -# "...the new time zone will come into effect at two o'clock on the first Sunday
    -# of February, when we will have to advance the clock one hour from its current
    -# time..."
    -# Also, the new zone will not use DST.
    -#
    -# From Carlos Raúl Perasso (2015-02-02):
    -# The decree that modifies the Mexican Hour System Law has finally
    -# been published at the Diario Oficial de la Federación
    -# http://www.dof.gob.mx/nota_detalle.php?codigo=5380123&fecha=31/01/2015
    -# It establishes 5 zones for Mexico:
    -# 1- Zona Centro (Central Zone): Corresponds to longitude 90 W,
    -#    includes most of Mexico, excluding what's mentioned below.
    -# 2- Zona Pacífico (Pacific Zone): Longitude 105 W, includes the
    -#    states of Baja California Sur; Chihuahua; Nayarit (excluding Bahía
    -#    de Banderas which lies in Central Zone); Sinaloa and Sonora.
    -# 3- Zona Noroeste (Northwest Zone): Longitude 120 W, includes the
    -#    state of Baja California.
    -# 4- Zona Sureste (Southeast Zone): Longitude 75 W, includes the state
    -#    of Quintana Roo.
    -# 5- The islands, reefs and keys shall take their timezone from the
    -#    longitude they are located at.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Mexico	1939	only	-	Feb	5	0:00	1:00	D
    -Rule	Mexico	1939	only	-	Jun	25	0:00	0	S
    -Rule	Mexico	1940	only	-	Dec	9	0:00	1:00	D
    -Rule	Mexico	1941	only	-	Apr	1	0:00	0	S
    -Rule	Mexico	1943	only	-	Dec	16	0:00	1:00	W # War
    -Rule	Mexico	1944	only	-	May	1	0:00	0	S
    -Rule	Mexico	1950	only	-	Feb	12	0:00	1:00	D
    -Rule	Mexico	1950	only	-	Jul	30	0:00	0	S
    -Rule	Mexico	1996	2000	-	Apr	Sun>=1	2:00	1:00	D
    -Rule	Mexico	1996	2000	-	Oct	lastSun	2:00	0	S
    -Rule	Mexico	2001	only	-	May	Sun>=1	2:00	1:00	D
    -Rule	Mexico	2001	only	-	Sep	lastSun	2:00	0	S
    -Rule	Mexico	2002	max	-	Apr	Sun>=1	2:00	1:00	D
    -Rule	Mexico	2002	max	-	Oct	lastSun	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -# Quintana Roo; represented by Cancún
    -Zone America/Cancun	-5:47:04 -	LMT	1922 Jan  1  0:12:56
    -			-6:00	-	CST	1981 Dec 23
    -			-5:00	Mexico	E%sT	1998 Aug  2  2:00
    -			-6:00	Mexico	C%sT	2015 Feb  1  2:00
    -			-5:00	-	EST
    -# Campeche, Yucatán; represented by Mérida
    -Zone America/Merida	-5:58:28 -	LMT	1922 Jan  1  0:01:32
    -			-6:00	-	CST	1981 Dec 23
    -			-5:00	-	EST	1982 Dec  2
    -			-6:00	Mexico	C%sT
    -# Coahuila, Durango, Nuevo León, Tamaulipas (near US border)
    -Zone America/Matamoros	-6:40:00 -	LMT	1921 Dec 31 23:20:00
    -			-6:00	-	CST	1988
    -			-6:00	US	C%sT	1989
    -			-6:00	Mexico	C%sT	2010
    -			-6:00	US	C%sT
    -# Coahuila, Durango, Nuevo León, Tamaulipas (away from US border)
    -Zone America/Monterrey	-6:41:16 -	LMT	1921 Dec 31 23:18:44
    -			-6:00	-	CST	1988
    -			-6:00	US	C%sT	1989
    -			-6:00	Mexico	C%sT
    -# Central Mexico
    -Zone America/Mexico_City -6:36:36 -	LMT	1922 Jan  1  0:23:24
    -			-7:00	-	MST	1927 Jun 10 23:00
    -			-6:00	-	CST	1930 Nov 15
    -			-7:00	-	MST	1931 May  1 23:00
    -			-6:00	-	CST	1931 Oct
    -			-7:00	-	MST	1932 Apr  1
    -			-6:00	Mexico	C%sT	2001 Sep 30  2:00
    -			-6:00	-	CST	2002 Feb 20
    -			-6:00	Mexico	C%sT
    -# Chihuahua (near US border)
    -Zone America/Ojinaga	-6:57:40 -	LMT	1922 Jan  1  0:02:20
    -			-7:00	-	MST	1927 Jun 10 23:00
    -			-6:00	-	CST	1930 Nov 15
    -			-7:00	-	MST	1931 May  1 23:00
    -			-6:00	-	CST	1931 Oct
    -			-7:00	-	MST	1932 Apr  1
    -			-6:00	-	CST	1996
    -			-6:00	Mexico	C%sT	1998
    -			-6:00	-	CST	1998 Apr Sun>=1  3:00
    -			-7:00	Mexico	M%sT	2010
    -			-7:00	US	M%sT
    -# Chihuahua (away from US border)
    -Zone America/Chihuahua	-7:04:20 -	LMT	1921 Dec 31 23:55:40
    -			-7:00	-	MST	1927 Jun 10 23:00
    -			-6:00	-	CST	1930 Nov 15
    -			-7:00	-	MST	1931 May  1 23:00
    -			-6:00	-	CST	1931 Oct
    -			-7:00	-	MST	1932 Apr  1
    -			-6:00	-	CST	1996
    -			-6:00	Mexico	C%sT	1998
    -			-6:00	-	CST	1998 Apr Sun>=1  3:00
    -			-7:00	Mexico	M%sT
    -# Sonora
    -Zone America/Hermosillo	-7:23:52 -	LMT	1921 Dec 31 23:36:08
    -			-7:00	-	MST	1927 Jun 10 23:00
    -			-6:00	-	CST	1930 Nov 15
    -			-7:00	-	MST	1931 May  1 23:00
    -			-6:00	-	CST	1931 Oct
    -			-7:00	-	MST	1932 Apr  1
    -			-6:00	-	CST	1942 Apr 24
    -			-7:00	-	MST	1949 Jan 14
    -			-8:00	-	PST	1970
    -			-7:00	Mexico	M%sT	1999
    -			-7:00	-	MST
    -
    -# From Alexander Krivenyshev (2010-04-21):
    -# According to news, Bahía de Banderas (Mexican state of Nayarit)
    -# changed time zone UTC-7 to new time zone UTC-6 on April 4, 2010 (to
    -# share the same time zone as nearby city Puerto Vallarta, Jalisco).
    -#
    -# (Spanish)
    -# Bahía de Banderas homologa su horario al del centro del
    -# país, a partir de este domingo
    -# http://www.nayarit.gob.mx/notes.asp?id=20748
    -#
    -# Bahía de Banderas homologa su horario con el del Centro del
    -# País
    -# http://www.bahiadebanderas.gob.mx/principal/index.php?option=com_content&view=article&id=261:bahia-de-banderas-homologa-su-horario-con-el-del-centro-del-pais&catid=42:comunicacion-social&Itemid=50
    -#
    -# (English)
    -# Puerto Vallarta and Bahía de Banderas: One Time Zone
    -# http://virtualvallarta.com/puertovallarta/puertovallarta/localnews/2009-12-03-Puerto-Vallarta-and-Bahia-de-Banderas-One-Time-Zone.shtml
    -# http://www.worldtimezone.com/dst_news/dst_news_mexico08.html
    -#
    -# "Mexico's Senate approved the amendments to the Mexican Schedule System that
    -# will allow Bahía de Banderas and Puerto Vallarta to share the same time
    -# zone ..."
    -# Baja California Sur, Nayarit, Sinaloa
    -
    -# From Arthur David Olson (2010-05-01):
    -# Use "Bahia_Banderas" to keep the name to fourteen characters.
    -
    -# Mazatlán
    -Zone America/Mazatlan	-7:05:40 -	LMT	1921 Dec 31 23:54:20
    -			-7:00	-	MST	1927 Jun 10 23:00
    -			-6:00	-	CST	1930 Nov 15
    -			-7:00	-	MST	1931 May  1 23:00
    -			-6:00	-	CST	1931 Oct
    -			-7:00	-	MST	1932 Apr  1
    -			-6:00	-	CST	1942 Apr 24
    -			-7:00	-	MST	1949 Jan 14
    -			-8:00	-	PST	1970
    -			-7:00	Mexico	M%sT
    -
    -# Bahía de Banderas
    -Zone America/Bahia_Banderas	-7:01:00 -	LMT	1921 Dec 31 23:59:00
    -			-7:00	-	MST	1927 Jun 10 23:00
    -			-6:00	-	CST	1930 Nov 15
    -			-7:00	-	MST	1931 May  1 23:00
    -			-6:00	-	CST	1931 Oct
    -			-7:00	-	MST	1932 Apr  1
    -			-6:00	-	CST	1942 Apr 24
    -			-7:00	-	MST	1949 Jan 14
    -			-8:00	-	PST	1970
    -			-7:00	Mexico	M%sT	2010 Apr  4  2:00
    -			-6:00	Mexico	C%sT
    -
    -# Baja California (near US border)
    -Zone America/Tijuana	-7:48:04 -	LMT	1922 Jan  1  0:11:56
    -			-7:00	-	MST	1924
    -			-8:00	-	PST	1927 Jun 10 23:00
    -			-7:00	-	MST	1930 Nov 15
    -			-8:00	-	PST	1931 Apr  1
    -			-8:00	1:00	PDT	1931 Sep 30
    -			-8:00	-	PST	1942 Apr 24
    -			-8:00	1:00	PWT	1945 Aug 14 23:00u
    -			-8:00	1:00	PPT	1945 Nov 12 # Peace
    -			-8:00	-	PST	1948 Apr  5
    -			-8:00	1:00	PDT	1949 Jan 14
    -			-8:00	-	PST	1954
    -			-8:00	CA	P%sT	1961
    -			-8:00	-	PST	1976
    -			-8:00	US	P%sT	1996
    -			-8:00	Mexico	P%sT	2001
    -			-8:00	US	P%sT	2002 Feb 20
    -			-8:00	Mexico	P%sT	2010
    -			-8:00	US	P%sT
    -# Baja California (away from US border)
    -Zone America/Santa_Isabel	-7:39:28 -	LMT	1922 Jan  1  0:20:32
    -			-7:00	-	MST	1924
    -			-8:00	-	PST	1927 Jun 10 23:00
    -			-7:00	-	MST	1930 Nov 15
    -			-8:00	-	PST	1931 Apr  1
    -			-8:00	1:00	PDT	1931 Sep 30
    -			-8:00	-	PST	1942 Apr 24
    -			-8:00	1:00	PWT	1945 Aug 14 23:00u
    -			-8:00	1:00	PPT	1945 Nov 12 # Peace
    -			-8:00	-	PST	1948 Apr  5
    -			-8:00	1:00	PDT	1949 Jan 14
    -			-8:00	-	PST	1954
    -			-8:00	CA	P%sT	1961
    -			-8:00	-	PST	1976
    -			-8:00	US	P%sT	1996
    -			-8:00	Mexico	P%sT	2001
    -			-8:00	US	P%sT	2002 Feb 20
    -			-8:00	Mexico	P%sT
    -# From Paul Eggert (2006-03-22):
    -# Formerly there was an America/Ensenada zone, which differed from
    -# America/Tijuana only in that it did not observe DST from 1976
    -# through 1995.  This was as per Shanks (1999).  But Shanks & Pottenger say
    -# Ensenada did not observe DST from 1948 through 1975.  Guy Harris reports
    -# that the 1987 OAG says "Only Ensenada, Mexicali, San Felipe and
    -# Tijuana observe DST," which agrees with Shanks & Pottenger but implies that
    -# DST-observance was a town-by-town matter back then.  This concerns
    -# data after 1970 so most likely there should be at least one Zone
    -# other than America/Tijuana for Baja, but it's not clear yet what its
    -# name or contents should be.
    -#
    -# Revillagigedo Is
    -# no information
    -
    -###############################################################################
    -
    -# Anguilla
    -# Antigua and Barbuda
    -# See America/Port_of_Spain.
    -
    -# Bahamas
    -#
    -# For 1899 Milne gives -5:09:29.5; round that.
    -#
    -# From Sue Williams (2006-12-07):
    -# The Bahamas announced about a month ago that they plan to change their DST
    -# rules to sync with the U.S. starting in 2007....
    -# http://www.jonesbahamas.com/?c=45&a=10412
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Bahamas	1964	1975	-	Oct	lastSun	2:00	0	S
    -Rule	Bahamas	1964	1975	-	Apr	lastSun	2:00	1:00	D
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Nassau	-5:09:30 -	LMT	1912 Mar 2
    -			-5:00	Bahamas	E%sT	1976
    -			-5:00	US	E%sT
    -
    -# Barbados
    -
    -# For 1899 Milne gives -3:58:29.2; round that.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Barb	1977	only	-	Jun	12	2:00	1:00	D
    -Rule	Barb	1977	1978	-	Oct	Sun>=1	2:00	0	S
    -Rule	Barb	1978	1980	-	Apr	Sun>=15	2:00	1:00	D
    -Rule	Barb	1979	only	-	Sep	30	2:00	0	S
    -Rule	Barb	1980	only	-	Sep	25	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Barbados	-3:58:29 -	LMT	1924 # Bridgetown
    -			-3:58:29 -	BMT	1932 # Bridgetown Mean Time
    -			-4:00	Barb	A%sT
    -
    -# Belize
    -# Whitman entirely disagrees with Shanks; go with Shanks & Pottenger.
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Belize	1918	1942	-	Oct	Sun>=2	0:00	0:30	HD
    -Rule	Belize	1919	1943	-	Feb	Sun>=9	0:00	0	S
    -Rule	Belize	1973	only	-	Dec	 5	0:00	1:00	D
    -Rule	Belize	1974	only	-	Feb	 9	0:00	0	S
    -Rule	Belize	1982	only	-	Dec	18	0:00	1:00	D
    -Rule	Belize	1983	only	-	Feb	12	0:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Belize	-5:52:48 -	LMT	1912 Apr
    -			-6:00	Belize	C%sT
    -
    -# Bermuda
    -
    -# For 1899 Milne gives -4:19:18.3 as the meridian of the clock tower,
    -# Bermuda dockyard, Ireland I; round that.
    -
    -# From Dan Jones, reporting in The Royal Gazette (2006-06-26):
    -
    -# Next year, however, clocks in the US will go forward on the second Sunday
    -# in March, until the first Sunday in November.  And, after the Time Zone
    -# (Seasonal Variation) Bill 2006 was passed in the House of Assembly on
    -# Friday, the same thing will happen in Bermuda.
    -# http://www.theroyalgazette.com/apps/pbcs.dll/article?AID=/20060529/NEWS/105290135
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Atlantic/Bermuda	-4:19:18 -	LMT	1930 Jan  1  2:00 # Hamilton
    -			-4:00	-	AST	1974 Apr 28  2:00
    -			-4:00	Canada	A%sT	1976
    -			-4:00	US	A%sT
    -
    -# Cayman Is
    -
    -# From Paul Eggert (2015-05-15):
    -# The Cayman government has decided to introduce DST in 2016, the idea being
    -# to keep in sync with New York.  The legislation hasn't passed but the change
    -# seems quite likely.  See: Meade B. Cayman 27.
    -# http://www.cayman27.com.ky/2015/05/15/clock-ticks-toward-daylight-saving-time-in-cayman
    -
    -Zone	America/Cayman	-5:25:32 -	LMT	1890     # Georgetown
    -			-5:07:11 -	KMT	1912 Feb # Kingston Mean Time
    -			-5:00	-	EST	2016
    -			-5:00	US	E%sT
    -
    -# Costa Rica
    -
    -# Milne gives -5:36:13.3 as San José mean time; round to nearest.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	CR	1979	1980	-	Feb	lastSun	0:00	1:00	D
    -Rule	CR	1979	1980	-	Jun	Sun>=1	0:00	0	S
    -Rule	CR	1991	1992	-	Jan	Sat>=15	0:00	1:00	D
    -# IATA SSIM (1991-09) says the following was at 1:00;
    -# go with Shanks & Pottenger.
    -Rule	CR	1991	only	-	Jul	 1	0:00	0	S
    -Rule	CR	1992	only	-	Mar	15	0:00	0	S
    -# There are too many San Josés elsewhere, so we'll use 'Costa Rica'.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Costa_Rica	-5:36:13 -	LMT	1890        # San José
    -			-5:36:13 -	SJMT	1921 Jan 15 # San José Mean Time
    -			-6:00	CR	C%sT
    -# Coco
    -# no information; probably like America/Costa_Rica
    -
    -# Cuba
    -
    -# From Paul Eggert (2013-02-21):
    -# Milne gives -5:28:50.45 for the observatory at Havana, -5:29:23.57
    -# for the port, and -5:30 for meteorological observations.
    -# For now, stick with Shanks & Pottenger.
    -
    -# From Arthur David Olson (1999-03-29):
    -# The 1999-03-28 exhibition baseball game held in Havana, Cuba, between
    -# the Cuban National Team and the Baltimore Orioles was carried live on
    -# the Orioles Radio Network, including affiliate WTOP in Washington, DC.
    -# During the game, play-by-play announcer Jim Hunter noted that
    -# "We'll be losing two hours of sleep...Cuba switched to Daylight Saving
    -# Time today."  (The "two hour" remark referred to losing one hour of
    -# sleep on 1999-03-28 - when the announcers were in Cuba as it switched
    -# to DST - and one more hour on 1999-04-04 - when the announcers will have
    -# returned to Baltimore, which switches on that date.)
    -
    -# From Steffen Thorsen (2013-11-11):
    -# DST start in Cuba in 2004 ... does not follow the same rules as the
    -# years before.  The correct date should be Sunday 2004-03-28 00:00 ...
    -# https://web.archive.org/web/20040402060750/http://www.granma.cu/espanol/2004/marzo/sab27/reloj.html
    -
    -# From Evert van der Veer via Steffen Thorsen (2004-10-28):
    -# Cuba is not going back to standard time this year.
    -# From Paul Eggert (2006-03-22):
    -# http://www.granma.cu/ingles/2004/septiembre/juev30/41medid-i.html
    -# says that it's due to a problem at the Antonio Guiteras
    -# thermoelectric plant, and says "This October there will be no return
    -# to normal hours (after daylight saving time)".
    -# For now, let's assume that it's a temporary measure.
    -
    -# From Carlos A. Carnero Delgado (2005-11-12):
    -# This year (just like in 2004-2005) there's no change in time zone
    -# adjustment in Cuba.  We will stay in daylight saving time:
    -# http://www.granma.cu/espanol/2005/noviembre/mier9/horario.html
    -
    -# From Jesper Nørgaard Welen (2006-10-21):
    -# An article in GRANMA INTERNACIONAL claims that Cuba will end
    -# the 3 years of permanent DST next weekend, see
    -# http://www.granma.cu/ingles/2006/octubre/lun16/43horario.html
    -# "On Saturday night, October 28 going into Sunday, October 29, at 01:00,
    -# watches should be set back one hour - going back to 00:00 hours - returning
    -# to the normal schedule....
    -
    -# From Paul Eggert (2007-03-02):
    -# , dated yesterday,
    -# says Cuban clocks will advance at midnight on March 10.
    -# For lack of better information, assume Cuba will use US rules,
    -# except that it switches at midnight standard time as usual.
    -#
    -# From Steffen Thorsen (2007-10-25):
    -# Carlos Alberto Fonseca Arauz informed me that Cuba will end DST one week
    -# earlier - on the last Sunday of October, just like in 2006.
    -#
    -# He supplied these references:
    -#
    -# http://www.prensalatina.com.mx/article.asp?ID=%7B4CC32C1B-A9F7-42FB-8A07-8631AFC923AF%7D&language=ES
    -# http://actualidad.terra.es/sociedad/articulo/cuba_llama_ahorrar_energia_cambio_1957044.htm
    -#
    -# From Alex Krivenyshev (2007-10-25):
    -# Here is also article from Granma (Cuba):
    -#
    -# Regirá el Horario Normal desde el próximo domingo 28 de octubre
    -# http://www.granma.cubaweb.cu/2007/10/24/nacional/artic07.html
    -#
    -# http://www.worldtimezone.com/dst_news/dst_news_cuba03.html
    -
    -# From Arthur David Olson (2008-03-09):
    -# I'm in Maryland which is now observing United States Eastern Daylight
    -# Time. At 9:44 local time I used RealPlayer to listen to
    -# http://media.enet.cu/radioreloj
    -# a Cuban information station, and heard
    -# the time announced as "ocho cuarenta y cuatro" ("eight forty-four"),
    -# indicating that Cuba is still on standard time.
    -
    -# From Steffen Thorsen (2008-03-12):
    -# It seems that Cuba will start DST on Sunday, 2007-03-16...
    -# It was announced yesterday, according to this source (in Spanish):
    -# http://www.nnc.cubaweb.cu/marzo-2008/cien-1-11-3-08.htm
    -#
    -# Some more background information is posted here:
    -# http://www.timeanddate.com/news/time/cuba-starts-dst-march-16.html
    -#
    -# The article also says that Cuba has been observing DST since 1963,
    -# while Shanks (and tzdata) has 1965 as the first date (except in the
    -# 1940's). Many other web pages in Cuba also claim that it has been
    -# observed since 1963, but with the exception of 1970 - an exception
    -# which is not present in tzdata/Shanks. So there is a chance we need to
    -# change some historic records as well.
    -#
    -# One example:
    -# http://www.radiohc.cu/espanol/noticias/mar07/11mar/hor.htm
    -
    -# From Jesper Nørgaard Welen (2008-03-13):
    -# The Cuban time change has just been confirmed on the most authoritative
    -# web site, the Granma.  Please check out
    -# http://www.granma.cubaweb.cu/2008/03/13/nacional/artic10.html
    -#
    -# Basically as expected after Steffen Thorsen's information, the change
    -# will take place midnight between Saturday and Sunday.
    -
    -# From Arthur David Olson (2008-03-12):
    -# Assume Sun>=15 (third Sunday) going forward.
    -
    -# From Alexander Krivenyshev (2009-03-04)
    -# According to the Radio Reloj - Cuba will start Daylight Saving Time on
    -# midnight between Saturday, March 07, 2009 and Sunday, March 08, 2009-
    -# not on midnight March 14 / March 15 as previously thought.
    -#
    -# http://www.worldtimezone.com/dst_news/dst_news_cuba05.html
    -# (in Spanish)
    -
    -# From Arthur David Olson (2009-03-09)
    -# I listened over the Internet to
    -# http://media.enet.cu/readioreloj
    -# this morning; when it was 10:05 a. m. here in Bethesda, Maryland the
    -# the time was announced as "diez cinco" - the same time as here, indicating
    -# that has indeed switched to DST. Assume second Sunday from 2009 forward.
    -
    -# From Steffen Thorsen (2011-03-08):
    -# Granma announced that Cuba is going to start DST on 2011-03-20 00:00:00
    -# this year. Nothing about the end date known so far (if that has
    -# changed at all).
    -#
    -# Source:
    -# http://granma.co.cu/2011/03/08/nacional/artic01.html
    -#
    -# Our info:
    -# http://www.timeanddate.com/news/time/cuba-starts-dst-2011.html
    -#
    -# From Steffen Thorsen (2011-10-30)
    -# Cuba will end DST two weeks later this year. Instead of going back
    -# tonight, it has been delayed to 2011-11-13 at 01:00.
    -#
    -# One source (Spanish)
    -# http://www.radioangulo.cu/noticias/cuba/17105-cuba-restablecera-el-horario-del-meridiano-de-greenwich.html
    -#
    -# Our page:
    -# http://www.timeanddate.com/news/time/cuba-time-changes-2011.html
    -#
    -# From Steffen Thorsen (2012-03-01)
    -# According to Radio Reloj, Cuba will start DST on Midnight between March
    -# 31 and April 1.
    -#
    -# Radio Reloj has the following info (Spanish):
    -# http://www.radioreloj.cu/index.php/noticias-radio-reloj/71-miscelaneas/7529-cuba-aplicara-el-horario-de-verano-desde-el-1-de-abril
    -#
    -# Our info on it:
    -# http://www.timeanddate.com/news/time/cuba-starts-dst-2012.html
    -
    -# From Steffen Thorsen (2012-11-03):
    -# Radio Reloj and many other sources report that Cuba is changing back
    -# to standard time on 2012-11-04:
    -# http://www.radioreloj.cu/index.php/noticias-radio-reloj/36-nacionales/9961-regira-horario-normal-en-cuba-desde-el-domingo-cuatro-de-noviembre
    -# From Paul Eggert (2012-11-03):
    -# For now, assume the future rule is first Sunday in November.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Cuba	1928	only	-	Jun	10	0:00	1:00	D
    -Rule	Cuba	1928	only	-	Oct	10	0:00	0	S
    -Rule	Cuba	1940	1942	-	Jun	Sun>=1	0:00	1:00	D
    -Rule	Cuba	1940	1942	-	Sep	Sun>=1	0:00	0	S
    -Rule	Cuba	1945	1946	-	Jun	Sun>=1	0:00	1:00	D
    -Rule	Cuba	1945	1946	-	Sep	Sun>=1	0:00	0	S
    -Rule	Cuba	1965	only	-	Jun	1	0:00	1:00	D
    -Rule	Cuba	1965	only	-	Sep	30	0:00	0	S
    -Rule	Cuba	1966	only	-	May	29	0:00	1:00	D
    -Rule	Cuba	1966	only	-	Oct	2	0:00	0	S
    -Rule	Cuba	1967	only	-	Apr	8	0:00	1:00	D
    -Rule	Cuba	1967	1968	-	Sep	Sun>=8	0:00	0	S
    -Rule	Cuba	1968	only	-	Apr	14	0:00	1:00	D
    -Rule	Cuba	1969	1977	-	Apr	lastSun	0:00	1:00	D
    -Rule	Cuba	1969	1971	-	Oct	lastSun	0:00	0	S
    -Rule	Cuba	1972	1974	-	Oct	8	0:00	0	S
    -Rule	Cuba	1975	1977	-	Oct	lastSun	0:00	0	S
    -Rule	Cuba	1978	only	-	May	7	0:00	1:00	D
    -Rule	Cuba	1978	1990	-	Oct	Sun>=8	0:00	0	S
    -Rule	Cuba	1979	1980	-	Mar	Sun>=15	0:00	1:00	D
    -Rule	Cuba	1981	1985	-	May	Sun>=5	0:00	1:00	D
    -Rule	Cuba	1986	1989	-	Mar	Sun>=14	0:00	1:00	D
    -Rule	Cuba	1990	1997	-	Apr	Sun>=1	0:00	1:00	D
    -Rule	Cuba	1991	1995	-	Oct	Sun>=8	0:00s	0	S
    -Rule	Cuba	1996	only	-	Oct	 6	0:00s	0	S
    -Rule	Cuba	1997	only	-	Oct	12	0:00s	0	S
    -Rule	Cuba	1998	1999	-	Mar	lastSun	0:00s	1:00	D
    -Rule	Cuba	1998	2003	-	Oct	lastSun	0:00s	0	S
    -Rule	Cuba	2000	2003	-	Apr	Sun>=1	0:00s	1:00	D
    -Rule	Cuba	2004	only	-	Mar	lastSun	0:00s	1:00	D
    -Rule	Cuba	2006	2010	-	Oct	lastSun	0:00s	0	S
    -Rule	Cuba	2007	only	-	Mar	Sun>=8	0:00s	1:00	D
    -Rule	Cuba	2008	only	-	Mar	Sun>=15	0:00s	1:00	D
    -Rule	Cuba	2009	2010	-	Mar	Sun>=8	0:00s	1:00	D
    -Rule	Cuba	2011	only	-	Mar	Sun>=15	0:00s	1:00	D
    -Rule	Cuba	2011	only	-	Nov	13	0:00s	0	S
    -Rule	Cuba	2012	only	-	Apr	1	0:00s	1:00	D
    -Rule	Cuba	2012	max	-	Nov	Sun>=1	0:00s	0	S
    -Rule	Cuba	2013	max	-	Mar	Sun>=8	0:00s	1:00	D
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Havana	-5:29:28 -	LMT	1890
    -			-5:29:36 -	HMT	1925 Jul 19 12:00 # Havana MT
    -			-5:00	Cuba	C%sT
    -
    -# Dominica
    -# See America/Port_of_Spain.
    -
    -# Dominican Republic
    -
    -# From Steffen Thorsen (2000-10-30):
    -# Enrique Morales reported to me that the Dominican Republic has changed the
    -# time zone to Eastern Standard Time as of Sunday 29 at 2 am....
    -# http://www.listin.com.do/antes/261000/republica/princi.html
    -
    -# From Paul Eggert (2000-12-04):
    -# That URL (2000-10-26, in Spanish) says they planned to use US-style DST.
    -
    -# From Rives McDow (2000-12-01):
    -# Dominican Republic changed its mind and presidential decree on Tuesday,
    -# November 28, 2000, with a new decree.  On Sunday, December 3 at 1:00 AM the
    -# Dominican Republic will be reverting to 8 hours from the International Date
    -# Line, and will not be using DST in the foreseeable future.  The reason they
    -# decided to use DST was to be in synch with Puerto Rico, who was also going
    -# to implement DST.  When Puerto Rico didn't implement DST, the president
    -# decided to revert.
    -
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	DR	1966	only	-	Oct	30	0:00	1:00	D
    -Rule	DR	1967	only	-	Feb	28	0:00	0	S
    -Rule	DR	1969	1973	-	Oct	lastSun	0:00	0:30	HD
    -Rule	DR	1970	only	-	Feb	21	0:00	0	S
    -Rule	DR	1971	only	-	Jan	20	0:00	0	S
    -Rule	DR	1972	1974	-	Jan	21	0:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Santo_Domingo -4:39:36 -	LMT	1890
    -			-4:40	-	SDMT	1933 Apr  1 12:00 # S. Dom. MT
    -			-5:00	DR	E%sT	1974 Oct 27
    -			-4:00	-	AST	2000 Oct 29  2:00
    -			-5:00	US	E%sT	2000 Dec  3  1:00
    -			-4:00	-	AST
    -
    -# El Salvador
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Salv	1987	1988	-	May	Sun>=1	0:00	1:00	D
    -Rule	Salv	1987	1988	-	Sep	lastSun	0:00	0	S
    -# There are too many San Salvadors elsewhere, so use America/El_Salvador
    -# instead of America/San_Salvador.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/El_Salvador -5:56:48 -	LMT	1921 # San Salvador
    -			-6:00	Salv	C%sT
    -
    -# Grenada
    -# Guadeloupe
    -# St Barthélemy
    -# St Martin (French part)
    -# See America/Port_of_Spain.
    -
    -# Guatemala
    -#
    -# From Gwillim Law (2006-04-22), after a heads-up from Oscar van Vlijmen:
    -# Diario Co Latino, at
    -# ,
    -# says in an article dated 2006-04-19 that the Guatemalan government had
    -# decided on that date to advance official time by 60 minutes, to lessen the
    -# impact of the elevated cost of oil....  Daylight saving time will last from
    -# 2006-04-29 24:00 (Guatemalan standard time) to 2006-09-30 (time unspecified).
    -# From Paul Eggert (2006-06-22):
    -# The Ministry of Energy and Mines, press release CP-15/2006
    -# (2006-04-19), says DST ends at 24:00.  See
    -# http://www.sieca.org.gt/Sitio_publico/Energeticos/Doc/Medidas/Cambio_Horario_Nac_190406.pdf
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Guat	1973	only	-	Nov	25	0:00	1:00	D
    -Rule	Guat	1974	only	-	Feb	24	0:00	0	S
    -Rule	Guat	1983	only	-	May	21	0:00	1:00	D
    -Rule	Guat	1983	only	-	Sep	22	0:00	0	S
    -Rule	Guat	1991	only	-	Mar	23	0:00	1:00	D
    -Rule	Guat	1991	only	-	Sep	 7	0:00	0	S
    -Rule	Guat	2006	only	-	Apr	30	0:00	1:00	D
    -Rule	Guat	2006	only	-	Oct	 1	0:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Guatemala	-6:02:04 -	LMT	1918 Oct 5
    -			-6:00	Guat	C%sT
    -
    -# Haiti
    -# From Gwillim Law (2005-04-15):
    -# Risto O. Nykänen wrote me that Haiti is now on DST.
    -# I searched for confirmation, and I found a press release
    -# on the Web page of the Haitian Consulate in Chicago (2005-03-31),
    -# .  Translated from French, it says:
    -#
    -#  "The Prime Minister's Communication Office notifies the public in general
    -#   and the press in particular that, following a decision of the Interior
    -#   Ministry and the Territorial Collectivities [I suppose that means the
    -#   provinces], Haiti will move to Eastern Daylight Time in the night from next
    -#   Saturday the 2nd to Sunday the 3rd.
    -#
    -#  "Consequently, the Prime Minister's Communication Office wishes to inform
    -#   the population that the country's clocks will be set forward one hour
    -#   starting at midnight.  This provision will hold until the last Saturday in
    -#   October 2005.
    -#
    -#  "Port-au-Prince, March 31, 2005"
    -#
    -# From Steffen Thorsen (2006-04-04):
    -# I have been informed by users that Haiti observes DST this year like
    -# last year, so the current "only" rule for 2005 might be changed to a
    -# "max" rule or to last until 2006. (Who knows if they will observe DST
    -# next year or if they will extend their DST like US/Canada next year).
    -#
    -# I have found this article about it (in French):
    -# http://www.haitipressnetwork.com/news.cfm?articleID=7612
    -#
    -# The reason seems to be an energy crisis.
    -
    -# From Stephen Colebourne (2007-02-22):
    -# Some IATA info: Haiti won't be having DST in 2007.
    -
    -# From Steffen Thorsen (2012-03-11):
    -# According to several news sources, Haiti will observe DST this year,
    -# apparently using the same start and end date as USA/Canada.
    -# So this means they have already changed their time.
    -#
    -# http://www.alterpresse.org/spip.php?article12510
    -# http://radiovision2000haiti.net/home/?p=13253
    -#
    -# From Arthur David Olson (2012-03-11):
    -# The alterpresse.org source seems to show a US-style leap from 2:00 a.m. to
    -# 3:00 a.m. rather than the traditional Haitian jump at midnight.
    -# Assume a US-style fall back as well.
    -
    -# From Steffen Thorsen (2013-03-10):
    -# It appears that Haiti is observing DST this year as well, same rules
    -# as US/Canada.  They did it last year as well, and it looks like they
    -# are going to observe DST every year now...
    -#
    -# http://radiovision2000haiti.net/public/haiti-avis-changement-dheure-dimanche/
    -# http://www.canalplushaiti.net/?p=6714
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Haiti	1983	only	-	May	8	0:00	1:00	D
    -Rule	Haiti	1984	1987	-	Apr	lastSun	0:00	1:00	D
    -Rule	Haiti	1983	1987	-	Oct	lastSun	0:00	0	S
    -# Shanks & Pottenger say AT is 2:00, but IATA SSIM (1991/1997) says 1:00s.
    -# Go with IATA.
    -Rule	Haiti	1988	1997	-	Apr	Sun>=1	1:00s	1:00	D
    -Rule	Haiti	1988	1997	-	Oct	lastSun	1:00s	0	S
    -Rule	Haiti	2005	2006	-	Apr	Sun>=1	0:00	1:00	D
    -Rule	Haiti	2005	2006	-	Oct	lastSun	0:00	0	S
    -Rule	Haiti	2012	max	-	Mar	Sun>=8	2:00	1:00	D
    -Rule	Haiti	2012	max	-	Nov	Sun>=1	2:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Port-au-Prince -4:49:20 -	LMT	1890
    -			-4:49	-	PPMT	1917 Jan 24 12:00 # P-a-P MT
    -			-5:00	Haiti	E%sT
    -
    -# Honduras
    -# Shanks & Pottenger say 1921 Jan 1; go with Whitman's more precise Apr 1.
    -
    -# From Paul Eggert (2006-05-05):
    -# worldtimezone.com reports a 2006-05-02 Spanish-language AP article
    -# saying Honduras will start using DST midnight Saturday, effective 4
    -# months until September.  La Tribuna reported today
    -#  that Manuel Zelaya, the president
    -# of Honduras, refused to back down on this.
    -
    -# From Jesper Nørgaard Welen (2006-08-08):
    -# It seems that Honduras has returned from DST to standard time this Monday at
    -# 00:00 hours (prolonging Sunday to 25 hours duration).
    -# http://www.worldtimezone.com/dst_news/dst_news_honduras04.html
    -
    -# From Paul Eggert (2006-08-08):
    -# Also see Diario El Heraldo, The country returns to standard time (2006-08-08).
    -# http://www.elheraldo.hn/nota.php?nid=54941&sec=12
    -# It mentions executive decree 18-2006.
    -
    -# From Steffen Thorsen (2006-08-17):
    -# Honduras will observe DST from 2007 to 2009, exact dates are not
    -# published, I have located this authoritative source:
    -# http://www.presidencia.gob.hn/noticia.aspx?nId=47
    -
    -# From Steffen Thorsen (2007-03-30):
    -# http://www.laprensahn.com/pais_nota.php?id04962=7386
    -# So it seems that Honduras will not enter DST this year....
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Hond	1987	1988	-	May	Sun>=1	0:00	1:00	D
    -Rule	Hond	1987	1988	-	Sep	lastSun	0:00	0	S
    -Rule	Hond	2006	only	-	May	Sun>=1	0:00	1:00	D
    -Rule	Hond	2006	only	-	Aug	Mon>=1	0:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Tegucigalpa -5:48:52 -	LMT	1921 Apr
    -			-6:00	Hond	C%sT
    -#
    -# Great Swan I ceded by US to Honduras in 1972
    -
    -# Jamaica
    -# Shanks & Pottenger give -5:07:12, but Milne records -5:07:10.41 from an
    -# unspecified official document, and says "This time is used throughout the
    -# island".  Go with Milne.  Round to the nearest second as required by zic.
    -#
    -# Shanks & Pottenger give April 28 for the 1974 spring-forward transition, but
    -# Lance Neita writes that Prime Minister Michael Manley decreed it January 5.
    -# Assume Neita meant Jan 6 02:00, the same as the US.  Neita also writes that
    -# Manley's supporters associated this act with Manley's nickname "Joshua"
    -# (recall that in the Bible the sun stood still at Joshua's request),
    -# and with the Rod of Correction which Manley said he had received from
    -# Haile Selassie, Emperor of Ethiopia.  See:
    -# Neita L. The politician in all of us. Jamaica Observer 2014-09-20
    -# http://www.jamaicaobserver.com/columns/The-politician-in-all-of-us_17573647
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Jamaica	-5:07:11 -	LMT	1890        # Kingston
    -			-5:07:11 -	KMT	1912 Feb    # Kingston Mean Time
    -			-5:00	-	EST	1974
    -			-5:00	US	E%sT	1984
    -			-5:00	-	EST
    -
    -# Martinique
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Martinique	-4:04:20 -      LMT	1890        # Fort-de-France
    -			-4:04:20 -	FFMT	1911 May    # Fort-de-France MT
    -			-4:00	-	AST	1980 Apr  6
    -			-4:00	1:00	ADT	1980 Sep 28
    -			-4:00	-	AST
    -
    -# Montserrat
    -# See America/Port_of_Spain.
    -
    -# Nicaragua
    -#
    -# This uses Shanks & Pottenger for times before 2005.
    -#
    -# From Steffen Thorsen (2005-04-12):
    -# I've got reports from 8 different people that Nicaragua just started
    -# DST on Sunday 2005-04-10, in order to save energy because of
    -# expensive petroleum.  The exact end date for DST is not yet
    -# announced, only "September" but some sites also say "mid-September".
    -# Some background information is available on the President's official site:
    -# http://www.presidencia.gob.ni/Presidencia/Files_index/Secretaria/Notas%20de%20Prensa/Presidente/2005/ABRIL/Gobierno-de-nicaragua-adelanta-hora-oficial-06abril.htm
    -# The Decree, no 23-2005 is available here:
    -# http://www.presidencia.gob.ni/buscador_gaceta/BD/DECRETOS/2005/Decreto%2023-2005%20Se%20adelanta%20en%20una%20hora%20en%20todo%20el%20territorio%20nacional%20apartir%20de%20las%2024horas%20del%2009%20de%20Abril.pdf
    -#
    -# From Paul Eggert (2005-05-01):
    -# The decree doesn't say anything about daylight saving, but for now let's
    -# assume that it is daylight saving....
    -#
    -# From Gwillim Law (2005-04-21):
    -# The Associated Press story on the time change, which can be found at
    -# http://www.lapalmainteractivo.com/guias/content/gen/ap/America_Latina/AMC_GEN_NICARAGUA_HORA.html
    -# and elsewhere, says (fifth paragraph, translated from Spanish): "The last
    -# time that a change of clocks was applied to save energy was in the year 2000
    -# during the Arnoldo Alemán administration."...
    -# The northamerica file says that Nicaragua has been on UTC-6 continuously
    -# since December 1998.  I wasn't able to find any details of Nicaraguan time
    -# changes in 2000.  Perhaps a note could be added to the northamerica file, to
    -# the effect that we have indirect evidence that DST was observed in 2000.
    -#
    -# From Jesper Nørgaard Welen (2005-11-02):
    -# Nicaragua left DST the 2005-10-02 at 00:00 (local time).
    -# http://www.presidencia.gob.ni/presidencia/files_index/secretaria/comunicados/2005/septiembre/26septiembre-cambio-hora.htm
    -# (2005-09-26)
    -#
    -# From Jesper Nørgaard Welen (2006-05-05):
    -# http://www.elnuevodiario.com.ni/2006/05/01/nacionales/18410
    -# (my informal translation)
    -# By order of the president of the republic, Enrique Bolaños, Nicaragua
    -# advanced by sixty minutes their official time, yesterday at 2 in the
    -# morning, and will stay that way until 30th of September.
    -#
    -# From Jesper Nørgaard Welen (2006-09-30):
    -# http://www.presidencia.gob.ni/buscador_gaceta/BD/DECRETOS/2006/D-063-2006P-PRN-Cambio-Hora.pdf
    -# My informal translation runs:
    -# The natural sun time is restored in all the national territory, in that the
    -# time is returned one hour at 01:00 am of October 1 of 2006.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Nic	1979	1980	-	Mar	Sun>=16	0:00	1:00	D
    -Rule	Nic	1979	1980	-	Jun	Mon>=23	0:00	0	S
    -Rule	Nic	2005	only	-	Apr	10	0:00	1:00	D
    -Rule	Nic	2005	only	-	Oct	Sun>=1	0:00	0	S
    -Rule	Nic	2006	only	-	Apr	30	2:00	1:00	D
    -Rule	Nic	2006	only	-	Oct	Sun>=1	1:00	0	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Managua	-5:45:08 -	LMT	1890
    -			-5:45:12 -	MMT	1934 Jun 23 # Managua Mean Time?
    -			-6:00	-	CST	1973 May
    -			-5:00	-	EST	1975 Feb 16
    -			-6:00	Nic	C%sT	1992 Jan  1  4:00
    -			-5:00	-	EST	1992 Sep 24
    -			-6:00	-	CST	1993
    -			-5:00	-	EST	1997
    -			-6:00	Nic	C%sT
    -
    -# Panama
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Panama	-5:18:08 -	LMT	1890
    -			-5:19:36 -	CMT	1908 Apr 22 # Colón Mean Time
    -			-5:00	-	EST
    -
    -# Puerto Rico
    -# There are too many San Juans elsewhere, so we'll use 'Puerto_Rico'.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Puerto_Rico -4:24:25 -	LMT	1899 Mar 28 12:00 # San Juan
    -			-4:00	-	AST	1942 May  3
    -			-4:00	US	A%sT	1946
    -			-4:00	-	AST
    -
    -# St Kitts-Nevis
    -# St Lucia
    -# See America/Port_of_Spain.
    -
    -# St Pierre and Miquelon
    -# There are too many St Pierres elsewhere, so we'll use 'Miquelon'.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Miquelon	-3:44:40 -	LMT	1911 May 15 # St Pierre
    -			-4:00	-	AST	1980 May
    -			-3:00	-	PMST	1987 # Pierre & Miquelon Time
    -			-3:00	Canada	PM%sT
    -
    -# St Vincent and the Grenadines
    -# See America/Port_of_Spain.
    -
    -# Turks and Caicos
    -#
    -# From Chris Dunn in
    -# http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=415007
    -# (2007-03-15): In the Turks & Caicos Islands (America/Grand_Turk) the
    -# daylight saving dates for time changes have been adjusted to match
    -# the recent U.S. change of dates.
    -#
    -# From Brian Inglis (2007-04-28):
    -# http://www.turksandcaicos.tc/calendar/index.htm [2007-04-26]
    -# there is an entry for Nov 4 "Daylight Savings Time Ends 2007" and three
    -# rows before that there is an out of date entry for Oct:
    -# "Eastern Standard Times Begins 2007
    -# Clocks are set back one hour at 2:00 a.m. local Daylight Saving Time"
    -# indicating that the normal ET rules are followed.
    -#
    -# From Paul Eggert (2014-08-19):
    -# The 2014-08-13 Cabinet meeting decided to stay on UTC-4 year-round.  See:
    -# http://tcweeklynews.com/daylight-savings-time-to-be-maintained-p5353-127.htm
    -# Model this as a switch from EST/EDT to AST ...
    -# From Chris Walton (2014-11-04):
    -# ... the TCI government appears to have delayed the switch to
    -# "permanent daylight saving time" by one year....
    -# http://tcweeklynews.com/time-change-to-go-ahead-this-november-p5437-127.htm
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Grand_Turk	-4:44:32 -	LMT	1890
    -			-5:07:11 -	KMT	1912 Feb # Kingston Mean Time
    -			-5:00	-	EST	1979
    -			-5:00	US	E%sT	2015 Nov Sun>=1 2:00
    -			-4:00	-	AST
    -
    -# British Virgin Is
    -# Virgin Is
    -# See America/Port_of_Spain.
    -
    -
    -# Local Variables:
    -# coding: utf-8
    -# End:
    diff --git a/external/public-domain/tz/dist/pacificnew b/external/public-domain/tz/dist/pacificnew
    deleted file mode 100644
    index 734943486..000000000
    --- a/external/public-domain/tz/dist/pacificnew
    +++ /dev/null
    @@ -1,27 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# From Arthur David Olson (1989-04-05):
    -# On 1989-04-05, the U. S. House of Representatives passed (238-154) a bill
    -# establishing "Pacific Presidential Election Time"; it was not acted on
    -# by the Senate or signed into law by the President.
    -# You might want to change the "PE" (Presidential Election) below to
    -# "Q" (Quadrennial) to maintain three-character zone abbreviations.
    -# If you're really conservative, you might want to change it to "D".
    -# Avoid "L" (Leap Year), which won't be true in 2100.
    -
    -# If Presidential Election Time is ever established, replace "XXXX" below
    -# with the year the law takes effect and uncomment the "##" lines.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -## Rule	Twilite	XXXX	max	-	Apr	Sun>=1	2:00	1:00	D
    -## Rule	Twilite	XXXX	max	uspres	Oct	lastSun	2:00	1:00	PE
    -## Rule	Twilite	XXXX	max	uspres	Nov	Sun>=7	2:00	0	S
    -## Rule	Twilite	XXXX	max	nonpres	Oct	lastSun	2:00	0	S
    -
    -# Zone	NAME			GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
    -## Zone	America/Los_Angeles-PET	-8:00	US		P%sT	XXXX
    -##				-8:00	Twilite		P%sT
    -
    -# For now...
    -Link	America/Los_Angeles	US/Pacific-New	##
    diff --git a/external/public-domain/tz/dist/southamerica b/external/public-domain/tz/dist/southamerica
    deleted file mode 100644
    index 50d118ebf..000000000
    --- a/external/public-domain/tz/dist/southamerica
    +++ /dev/null
    @@ -1,1750 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# This file is by no means authoritative; if you think you know better,
    -# go ahead and edit the file (and please send any changes to
    -# tz@iana.org for general use in the future).  For more, please see
    -# the file CONTRIBUTING in the tz distribution.
    -
    -# From Paul Eggert (2014-10-31):
    -#
    -# Unless otherwise specified, the source for data through 1990 is:
    -# Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
    -# San Diego: ACS Publications, Inc. (2003).
    -# Unfortunately this book contains many errors and cites no sources.
    -#
    -# Gwillim Law writes that a good source
    -# for recent time zone data is the International Air Transport
    -# Association's Standard Schedules Information Manual (IATA SSIM),
    -# published semiannually.  Law sent in several helpful summaries
    -# of the IATA's data after 1990.  Except where otherwise noted,
    -# IATA SSIM is the source for entries after 1990.
    -#
    -# For data circa 1899, a common source is:
    -# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
    -# http://www.jstor.org/stable/1774359
    -#
    -# Earlier editions of these tables used the North American style (e.g. ARST and
    -# ARDT for Argentine Standard and Daylight Time), but the following quote
    -# suggests that it's better to use European style (e.g. ART and ARST).
    -#	I suggest the use of _Summer time_ instead of the more cumbersome
    -#	_daylight-saving time_.  _Summer time_ seems to be in general use
    -#	in Europe and South America.
    -#	-- E O Cutler, _New York Times_ (1937-02-14), quoted in
    -#	H L Mencken, _The American Language: Supplement I_ (1960), p 466
    -#
    -# Earlier editions of these tables also used the North American style
    -# for time zones in Brazil, but this was incorrect, as Brazilians say
    -# "summer time".  Reinaldo Goulart, a São Paulo businessman active in
    -# the railroad sector, writes (1999-07-06):
    -#	The subject of time zones is currently a matter of discussion/debate in
    -#	Brazil.  Let's say that "the Brasília time" is considered the
    -#	"official time" because Brasília is the capital city.
    -#	The other three time zones are called "Brasília time "minus one" or
    -#	"plus one" or "plus two".  As far as I know there is no such
    -#	name/designation as "Eastern Time" or "Central Time".
    -# So I invented the following (English-language) abbreviations for now.
    -# Corrections are welcome!
    -#		std	dst
    -#	-2:00	FNT	FNST	Fernando de Noronha
    -#	-3:00	BRT	BRST	Brasília
    -#	-4:00	AMT	AMST	Amazon
    -#	-5:00	ACT	ACST	Acre
    -
    -###############################################################################
    -
    -###############################################################################
    -
    -# Argentina
    -
    -# From Bob Devine (1988-01-28):
    -# Argentina: first Sunday in October to first Sunday in April since 1976.
    -# Double Summer time from 1969 to 1974.  Switches at midnight.
    -
    -# From U. S. Naval Observatory (1988-01-19):
    -# ARGENTINA           3 H BEHIND   UTC
    -
    -# From Hernan G. Otero (1995-06-26):
    -# I am sending modifications to the Argentine time zone table...
    -# AR was chosen because they are the ISO letters that represent Argentina.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Arg	1930	only	-	Dec	 1	0:00	1:00	S
    -Rule	Arg	1931	only	-	Apr	 1	0:00	0	-
    -Rule	Arg	1931	only	-	Oct	15	0:00	1:00	S
    -Rule	Arg	1932	1940	-	Mar	 1	0:00	0	-
    -Rule	Arg	1932	1939	-	Nov	 1	0:00	1:00	S
    -Rule	Arg	1940	only	-	Jul	 1	0:00	1:00	S
    -Rule	Arg	1941	only	-	Jun	15	0:00	0	-
    -Rule	Arg	1941	only	-	Oct	15	0:00	1:00	S
    -Rule	Arg	1943	only	-	Aug	 1	0:00	0	-
    -Rule	Arg	1943	only	-	Oct	15	0:00	1:00	S
    -Rule	Arg	1946	only	-	Mar	 1	0:00	0	-
    -Rule	Arg	1946	only	-	Oct	 1	0:00	1:00	S
    -Rule	Arg	1963	only	-	Oct	 1	0:00	0	-
    -Rule	Arg	1963	only	-	Dec	15	0:00	1:00	S
    -Rule	Arg	1964	1966	-	Mar	 1	0:00	0	-
    -Rule	Arg	1964	1966	-	Oct	15	0:00	1:00	S
    -Rule	Arg	1967	only	-	Apr	 2	0:00	0	-
    -Rule	Arg	1967	1968	-	Oct	Sun>=1	0:00	1:00	S
    -Rule	Arg	1968	1969	-	Apr	Sun>=1	0:00	0	-
    -Rule	Arg	1974	only	-	Jan	23	0:00	1:00	S
    -Rule	Arg	1974	only	-	May	 1	0:00	0	-
    -Rule	Arg	1988	only	-	Dec	 1	0:00	1:00	S
    -#
    -# From Hernan G. Otero (1995-06-26):
    -# These corrections were contributed by InterSoft Argentina S.A.,
    -# obtaining the data from the:
    -# Talleres de Hidrografía Naval Argentina
    -# (Argentine Naval Hydrography Institute)
    -Rule	Arg	1989	1993	-	Mar	Sun>=1	0:00	0	-
    -Rule	Arg	1989	1992	-	Oct	Sun>=15	0:00	1:00	S
    -#
    -# From Hernan G. Otero (1995-06-26):
    -# From this moment on, the law that mandated the daylight saving
    -# time corrections was derogated and no more modifications
    -# to the time zones (for daylight saving) are now made.
    -#
    -# From Rives McDow (2000-01-10):
    -# On October 3, 1999, 0:00 local, Argentina implemented daylight savings time,
    -# which did not result in the switch of a time zone, as they stayed 9 hours
    -# from the International Date Line.
    -Rule	Arg	1999	only	-	Oct	Sun>=1	0:00	1:00	S
    -# From Paul Eggert (2007-12-28):
    -# DST was set to expire on March 5, not March 3, but since it was converted
    -# to standard time on March 3 it's more convenient for us to pretend that
    -# it ended on March 3.
    -Rule	Arg	2000	only	-	Mar	3	0:00	0	-
    -#
    -# From Peter Gradelski via Steffen Thorsen (2000-03-01):
    -# We just checked with our São Paulo office and they say the government of
    -# Argentina decided not to become one of the countries that go on or off DST.
    -# So Buenos Aires should be -3 hours from GMT at all times.
    -#
    -# From Fabián L. Arce Jofré (2000-04-04):
    -# The law that claimed DST for Argentina was derogated by President Fernando
    -# de la Rúa on March 2, 2000, because it would make people spend more energy
    -# in the winter time, rather than less.  The change took effect on March 3.
    -#
    -# From Mariano Absatz (2001-06-06):
    -# one of the major newspapers here in Argentina said that the 1999
    -# Timezone Law (which never was effectively applied) will (would?) be
    -# in effect.... The article is at
    -# http://ar.clarin.com/diario/2001-06-06/e-01701.htm
    -# ... The Law itself is "Ley No. 25155", sanctioned on 1999-08-25, enacted
    -# 1999-09-17, and published 1999-09-21.  The official publication is at:
    -# http://www.boletin.jus.gov.ar/BON/Primera/1999/09-Septiembre/21/PDF/BO21-09-99LEG.PDF
    -# Regretfully, you have to subscribe (and pay) for the on-line version....
    -#
    -# (2001-06-12):
    -# the timezone for Argentina will not change next Sunday.
    -# Apparently it will do so on Sunday 24th....
    -# http://ar.clarin.com/diario/2001-06-12/s-03501.htm
    -#
    -# (2001-06-25):
    -# Last Friday (yes, the last working day before the date of the change), the
    -# Senate annulled the 1999 law that introduced the changes later postponed.
    -# http://www.clarin.com.ar/diario/2001-06-22/s-03601.htm
    -# It remains the vote of the Deputies..., but it will be the same....
    -# This kind of things had always been done this way in Argentina.
    -# We are still -03:00 all year round in all of the country.
    -#
    -# From Steffen Thorsen (2007-12-21):
    -# A user (Leonardo Chaim) reported that Argentina will adopt DST....
    -# all of the country (all Zone-entries) are affected.  News reports like
    -# http://www.lanacion.com.ar/opinion/nota.asp?nota_id=973037 indicate
    -# that Argentina will use DST next year as well, from October to
    -# March, although exact rules are not given.
    -#
    -# From Jesper Nørgaard Welen (2007-12-26)
    -# The last hurdle of Argentina DST is over, the proposal was approved in
    -# the lower chamber too (Diputados) with a vote 192 for and 2 against.
    -# By the way thanks to Mariano Absatz and Daniel Mario Vega for the link to
    -# the original scanned proposal, where the dates and the zero hours are
    -# clear and unambiguous...This is the article about final approval:
    -# http://www.lanacion.com.ar/politica/nota.asp?nota_id=973996
    -#
    -# From Paul Eggert (2007-12-22):
    -# For dates after mid-2008, the following rules are my guesses and
    -# are quite possibly wrong, but are more likely than no DST at all.
    -
    -# From Alexander Krivenyshev (2008-09-05):
    -# As per message from Carlos Alberto Fonseca Arauz (Nicaragua),
    -# Argentina will start DST on Sunday October 19, 2008.
    -#
    -# http://www.worldtimezone.com/dst_news/dst_news_argentina03.html
    -# http://www.impulsobaires.com.ar/nota.php?id=57832 (in spanish)
    -
    -# From Juan Manuel Docile in https://bugs.gentoo.org/240339 (2008-10-07)
    -# via Rodrigo Severo:
    -# Argentinian law No. 25.155 is no longer valid.
    -# http://www.infoleg.gov.ar/infolegInternet/anexos/60000-64999/60036/norma.htm
    -# The new one is law No. 26.350
    -# http://www.infoleg.gov.ar/infolegInternet/anexos/135000-139999/136191/norma.htm
    -# So there is no summer time in Argentina for now.
    -
    -# From Mariano Absatz (2008-10-20):
    -# Decree 1693/2008 applies Law 26.350 for the summer 2008/2009 establishing DST
    -# in Argentina from 2008-10-19 until 2009-03-15.
    -# http://www.boletinoficial.gov.ar/Bora.Portal/CustomControls/PdfContent.aspx?fp=16102008&pi=3&pf=4&s=0&sec=01
    -#
    -
    -# Decree 1705/2008 excepting 12 Provinces from applying DST in the summer
    -# 2008/2009: Catamarca, La Rioja, Mendoza, Salta, San Juan, San Luis, La
    -# Pampa, Neuquén, Rio Negro, Chubut, Santa Cruz and Tierra del Fuego
    -# http://www.boletinoficial.gov.ar/Bora.Portal/CustomControls/PdfContent.aspx?fp=17102008&pi=1&pf=1&s=0&sec=01
    -#
    -# Press release 235 dated Saturday October 18th, from the Government of the
    -# Province of Jujuy saying it will not apply DST either (even when it was not
    -# included in Decree 1705/2008).
    -# http://www.jujuy.gov.ar/index2/partes_prensa/18_10_08/235-181008.doc
    -
    -# From fullinet (2009-10-18):
    -# As announced in
    -# http://www.argentina.gob.ar/argentina/portal/paginas.dhtml?pagina=356
    -# (an official .gob.ar) under title: "Sin Cambio de Hora"
    -# (English: "No hour change").
    -#
    -# "Por el momento, el Gobierno Nacional resolvió no modificar la hora
    -# oficial, decisión que estaba en estudio para su implementación el
    -# domingo 18 de octubre. Desde el Ministerio de Planificación se anunció
    -# que la Argentina hoy, en estas condiciones meteorológicas, no necesita
    -# la modificación del huso horario, ya que 2009 nos encuentra con
    -# crecimiento en la producción y distribución energética."
    -
    -Rule	Arg	2007	only	-	Dec	30	0:00	1:00	S
    -Rule	Arg	2008	2009	-	Mar	Sun>=15	0:00	0	-
    -Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:00	S
    -
    -# From Mariano Absatz (2004-05-21):
    -# Today it was officially published that the Province of Mendoza is changing
    -# its timezone this winter... starting tomorrow night....
    -# http://www.gobernac.mendoza.gov.ar/boletin/pdf/20040521-27158-normas.pdf
    -# From Paul Eggert (2004-05-24):
    -# It's Law No. 7,210.  This change is due to a public power emergency, so for
    -# now we'll assume it's for this year only.
    -#
    -# From Paul Eggert (2014-08-09):
    -# Hora de verano para la República Argentina
    -# http://buenasiembra.com.ar/esoterismo/astrologia/hora-de-verano-de-la-republica-argentina-27.html
    -# says that standard time in Argentina from 1894-10-31
    -# to 1920-05-01 was -4:16:48.25.  Go with this more-precise value
    -# over Shanks & Pottenger.
    -#
    -# From Mariano Absatz (2004-06-05):
    -# These media articles from a major newspaper mostly cover the current state:
    -# http://www.lanacion.com.ar/04/05/27/de_604825.asp
    -# http://www.lanacion.com.ar/04/05/28/de_605203.asp
    -#
    -# The following eight (8) provinces pulled clocks back to UTC-04:00 at
    -# midnight Monday May 31st. (that is, the night between 05/31 and 06/01).
    -# Apparently, all nine provinces would go back to UTC-03:00 at the same
    -# time in October 17th.
    -#
    -# Catamarca, Chubut, La Rioja, San Juan, San Luis, Santa Cruz,
    -# Tierra del Fuego, Tucumán.
    -#
    -# From Mariano Absatz (2004-06-14):
    -# ... this weekend, the Province of Tucumán decided it'd go back to UTC-03:00
    -# yesterday midnight (that is, at 24:00 Saturday 12th), since the people's
    -# annoyance with the change is much higher than the power savings obtained....
    -#
    -# From Gwillim Law (2004-06-14):
    -# http://www.lanacion.com.ar/04/06/10/de_609078.asp ...
    -#     "The time change in Tierra del Fuego was a conflicted decision from
    -#   the start.  The government had decreed that the measure would take
    -#   effect on June 1, but a normative error forced the new time to begin
    -#   three days earlier, from a Saturday to a Sunday....
    -# Our understanding was that the change was originally scheduled to take place
    -# on June 1 at 00:00 in Chubut, Santa Cruz, Tierra del Fuego (and some other
    -# provinces).  Sunday was May 30, only two days earlier.  So the article
    -# contains a contradiction.  I would give more credence to the Saturday/Sunday
    -# date than the "three days earlier" phrase, and conclude that Tierra del
    -# Fuego set its clocks back at 2004-05-30 00:00.
    -#
    -# From Steffen Thorsen (2004-10-05):
    -# The previous law 7210 which changed the province of Mendoza's time zone
    -# back in May have been modified slightly in a new law 7277, which set the
    -# new end date to 2004-09-26 (original date was 2004-10-17).
    -# http://www.gobernac.mendoza.gov.ar/boletin/pdf/20040924-27244-normas.pdf
    -#
    -# From Mariano Absatz (2004-10-05):
    -# San Juan changed from UTC-03:00 to UTC-04:00 at midnight between
    -# Sunday, May 30th and Monday, May 31st.  It changed back to UTC-03:00
    -# at midnight between Saturday, July 24th and Sunday, July 25th....
    -# http://www.sanjuan.gov.ar/prensa/archivo/000329.html
    -# http://www.sanjuan.gov.ar/prensa/archivo/000426.html
    -# http://www.sanjuan.gov.ar/prensa/archivo/000441.html
    -
    -# From Alex Krivenyshev (2008-01-17):
    -# Here are articles that Argentina Province San Luis is planning to end DST
    -# as earlier as upcoming Monday January 21, 2008 or February 2008:
    -#
    -# Provincia argentina retrasa reloj y marca diferencia con resto del país
    -# (Argentine Province delayed clock and mark difference with the rest of the
    -# country)
    -# http://cl.invertia.com/noticias/noticia.aspx?idNoticia=200801171849_EFE_ET4373&idtel
    -#
    -# Es inminente que en San Luis atrasen una hora los relojes
    -# (It is imminent in San Luis clocks one hour delay)
    -# http://www.lagaceta.com.ar/nota/253414/Economia/Es-inminente-que-en-San-Luis-atrasen-una-hora-los-relojes.html
    -# http://www.worldtimezone.net/dst_news/dst_news_argentina02.html
    -
    -# From Jesper Nørgaard Welen (2008-01-18):
    -# The page of the San Luis provincial government
    -# http://www.sanluis.gov.ar/notas.asp?idCanal=0&id=22812
    -# confirms what Alex Krivenyshev has earlier sent to the tz
    -# emailing list about that San Luis plans to return to standard
    -# time much earlier than the rest of the country. It also
    -# confirms that upon request the provinces San Juan and Mendoza
    -# refused to follow San Luis in this change.
    -#
    -# The change is supposed to take place Monday the 21st at 0:00
    -# hours. As far as I understand it if this goes ahead, we need
    -# a new timezone for San Luis (although there are also documented
    -# independent changes in the southamerica file of San Luis in
    -# 1990 and 1991 which has not been confirmed).
    -
    -# From Jesper Nørgaard Welen (2008-01-25):
    -# Unfortunately the below page has become defunct, about the San Luis
    -# time change. Perhaps because it now is part of a group of pages "Most
    -# important pages of 2008."
    -#
    -# You can use
    -# http://www.sanluis.gov.ar/notas.asp?idCanal=8141&id=22834
    -# instead it seems. Or use "Buscador" from the main page of the San Luis
    -# government, and fill in "huso" and click OK, and you will get 3 pages
    -# from which the first one is identical to the above.
    -
    -# From Mariano Absatz (2008-01-28):
    -# I can confirm that the Province of San Luis (and so far only that
    -# province) decided to go back to UTC-3 effective midnight Jan 20th 2008
    -# (that is, Monday 21st at 0:00 is the time the clocks were delayed back
    -# 1 hour), and they intend to keep UTC-3 as their timezone all year round
    -# (that is, unless they change their mind any minute now).
    -#
    -# So we'll have to add yet another city to 'southamerica' (I think San
    -# Luis city is the mos populated city in the Province, so it'd be
    -# America/Argentina/San_Luis... of course I can't remember if San Luis's
    -# history of particular changes goes along with Mendoza or San Juan :-(
    -# (I only remember not being able to collect hard facts about San Luis
    -# back in 2004, when these provinces changed to UTC-4 for a few days, I
    -# mailed them personally and never got an answer).
    -
    -# From Paul Eggert (2014-08-12):
    -# Unless otherwise specified, data entries are from Shanks & Pottenger through
    -# 1992, from the IATA otherwise.  As noted below, Shanks & Pottenger say that
    -# America/Cordoba split into 6 subregions during 1991/1992, one of which
    -# was America/San_Luis, but we haven't verified this yet so for now we'll
    -# keep America/Cordoba a single region rather than splitting it into the
    -# other 5 subregions.
    -
    -# From Mariano Absatz (2009-03-13):
    -# Yesterday (with our usual 2-day notice) the Province of San Luis
    -# decided that next Sunday instead of "staying" @utc-03:00 they will go
    -# to utc-04:00 until the second Saturday in October...
    -#
    -# The press release is at
    -# http://www.sanluis.gov.ar/SL/Paginas/NoticiaDetalle.asp?TemaId=1&InfoPrensaId=3102
    -# (I couldn't find the decree, but www.sanluis.gov.ar
    -# is the official page for the Province Government.)
    -#
    -# There's also a note in only one of the major national papers ...
    -# http://www.lanacion.com.ar/nota.asp?nota_id=1107912
    -#
    -# The press release says [quick and dirty translation]:
    -# ... announced that next Sunday, at 00:00, Puntanos (the San Luis
    -# inhabitants) will have to turn back one hour their clocks
    -#
    -# Since then, San Luis will establish its own Province timezone. Thus,
    -# during 2009, this timezone change will run from 00:00 the third Sunday
    -# in March until 24:00 of the second Saturday in October.
    -
    -# From Mariano Absatz (2009-10-16):
    -# ...the Province of San Luis is a case in itself.
    -#
    -# The Law at
    -# http://www.diputadossanluis.gov.ar/diputadosasp/paginas/verNorma.asp?NormaID=276
    -# is ambiguous because establishes a calendar from the 2nd Sunday in
    -# October at 0:00 thru the 2nd Saturday in March at 24:00 and the
    -# complement of that starting on the 2nd Sunday of March at 0:00 and
    -# ending on the 2nd Saturday of March at 24:00.
    -#
    -# This clearly breaks every time the 1st of March or October is a Sunday.
    -#
    -# IMHO, the "spirit of the Law" is to make the changes at 0:00 on the 2nd
    -# Sunday of October and March.
    -#
    -# The problem is that the changes in the rest of the Provinces that did
    -# change in 2007/2008, were made according to the Federal Law and Decrees
    -# that did so on the 3rd Sunday of October and March.
    -#
    -# In fact, San Luis actually switched from UTC-4 to UTC-3 last Sunday
    -# (October 11th) at 0:00.
    -#
    -# So I guess a new set of rules, besides "Arg", must be made and the last
    -# America/Argentina/San_Luis entries should change to use these...
    -#
    -# I'm enclosing a patch that does what I say... regretfully, the San Luis
    -# timezone must be called "WART/WARST" even when most of the time (like,
    -# right now) WARST == ART... that is, since last Sunday, all the country
    -# is using UTC-3, but in my patch, San Luis calls it "WARST" and the rest
    -# of the country calls it "ART".
    -# ...
    -
    -# From Alexander Krivenyshev (2010-04-09):
    -# According to news reports from El Diario de la República Province San
    -# Luis, Argentina (standard time UTC-04) will keep Daylight Saving Time
    -# after April 11, 2010 - will continue to have same time as rest of
    -# Argentina (UTC-3) (no DST).
    -#
    -# Confirmaron la prórroga del huso horario de verano (Spanish)
    -# http://www.eldiariodelarepublica.com/index.php?option=com_content&task=view&id=29383&Itemid=9
    -# or (some English translation):
    -# http://www.worldtimezone.com/dst_news/dst_news_argentina08.html
    -
    -# From Mariano Absatz (2010-04-12):
    -# yes...I can confirm this...and given that San Luis keeps calling
    -# UTC-03:00 "summer time", we should't just let San Luis go back to "Arg"
    -# rules...San Luis is still using "Western ARgentina Time" and it got
    -# stuck on Summer daylight savings time even though the summer is over.
    -
    -# From Paul Eggert (2013-09-05):
    -# Perhaps San Luis operates on the legal fiction that it is at UTC-4
    -# with perpetual summer time, but ordinary usage typically seems to
    -# just say it's at UTC-3; see, for example,
    -# http://es.wikipedia.org/wiki/Hora_oficial_argentina
    -# We've documented similar situations as being plain changes to
    -# standard time, so let's do that here too.  This does not change UTC
    -# offsets, only tm_isdst and the time zone abbreviations.  One minor
    -# plus is that this silences a zic complaint that there's no POSIX TZ
    -# setting for time stamps past 2038.
    -
    -# From Paul Eggert (2013-02-21):
    -# Milne says Córdoba time was -4:16:48.2.  Round to the nearest second.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -#
    -# Buenos Aires (BA), Capital Federal (CF),
    -Zone America/Argentina/Buenos_Aires -3:53:48 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May    # Córdoba Mean Time
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	Arg	AR%sT
    -#
    -# Córdoba (CB), Santa Fe (SF), Entre Ríos (ER), Corrientes (CN), Misiones (MN),
    -# Chaco (CC), Formosa (FM), Santiago del Estero (SE)
    -#
    -# Shanks & Pottenger also make the following claims, which we haven't verified:
    -# - Formosa switched to -3:00 on 1991-01-07.
    -# - Misiones switched to -3:00 on 1990-12-29.
    -# - Chaco switched to -3:00 on 1991-01-04.
    -# - Santiago del Estero switched to -4:00 on 1991-04-01,
    -#   then to -3:00 on 1991-04-26.
    -#
    -Zone America/Argentina/Cordoba -4:16:48 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1991 Mar  3
    -			-4:00	-	WART	1991 Oct 20
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	Arg	AR%sT
    -#
    -# Salta (SA), La Pampa (LP), Neuquén (NQ), Rio Negro (RN)
    -Zone America/Argentina/Salta -4:21:40 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1991 Mar  3
    -			-4:00	-	WART	1991 Oct 20
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	Arg	AR%sT	2008 Oct 18
    -			-3:00	-	ART
    -#
    -# Tucumán (TM)
    -Zone America/Argentina/Tucuman -4:20:52 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1991 Mar  3
    -			-4:00	-	WART	1991 Oct 20
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	-	ART	2004 Jun  1
    -			-4:00	-	WART	2004 Jun 13
    -			-3:00	Arg	AR%sT
    -#
    -# La Rioja (LR)
    -Zone America/Argentina/La_Rioja -4:27:24 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1991 Mar  1
    -			-4:00	-	WART	1991 May  7
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	-	ART	2004 Jun  1
    -			-4:00	-	WART	2004 Jun 20
    -			-3:00	Arg	AR%sT	2008 Oct 18
    -			-3:00	-	ART
    -#
    -# San Juan (SJ)
    -Zone America/Argentina/San_Juan -4:34:04 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1991 Mar  1
    -			-4:00	-	WART	1991 May  7
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	-	ART	2004 May 31
    -			-4:00	-	WART	2004 Jul 25
    -			-3:00	Arg	AR%sT	2008 Oct 18
    -			-3:00	-	ART
    -#
    -# Jujuy (JY)
    -Zone America/Argentina/Jujuy -4:21:12 -	LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1990 Mar  4
    -			-4:00	-	WART	1990 Oct 28
    -			-4:00	1:00	WARST	1991 Mar 17
    -			-4:00	-	WART	1991 Oct  6
    -			-3:00	1:00	ARST	1992
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	Arg	AR%sT	2008 Oct 18
    -			-3:00	-	ART
    -#
    -# Catamarca (CT), Chubut (CH)
    -Zone America/Argentina/Catamarca -4:23:08 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1991 Mar  3
    -			-4:00	-	WART	1991 Oct 20
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	-	ART	2004 Jun  1
    -			-4:00	-	WART	2004 Jun 20
    -			-3:00	Arg	AR%sT	2008 Oct 18
    -			-3:00	-	ART
    -#
    -# Mendoza (MZ)
    -Zone America/Argentina/Mendoza -4:35:16 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1990 Mar  4
    -			-4:00	-	WART	1990 Oct 15
    -			-4:00	1:00	WARST	1991 Mar  1
    -			-4:00	-	WART	1991 Oct 15
    -			-4:00	1:00	WARST	1992 Mar  1
    -			-4:00	-	WART	1992 Oct 18
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	-	ART	2004 May 23
    -			-4:00	-	WART	2004 Sep 26
    -			-3:00	Arg	AR%sT	2008 Oct 18
    -			-3:00	-	ART
    -#
    -# San Luis (SL)
    -
    -Rule	SanLuis	2008	2009	-	Mar	Sun>=8	0:00	0	-
    -Rule	SanLuis	2007	2008	-	Oct	Sun>=8	0:00	1:00	S
    -
    -Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1990
    -			-3:00	1:00	ARST	1990 Mar 14
    -			-4:00	-	WART	1990 Oct 15
    -			-4:00	1:00	WARST	1991 Mar  1
    -			-4:00	-	WART	1991 Jun  1
    -			-3:00	-	ART	1999 Oct  3
    -			-4:00	1:00	WARST	2000 Mar  3
    -			-3:00	-	ART	2004 May 31
    -			-4:00	-	WART	2004 Jul 25
    -			-3:00	Arg	AR%sT	2008 Jan 21
    -			-4:00	SanLuis	WAR%sT	2009 Oct 11
    -			-3:00	-	ART
    -#
    -# Santa Cruz (SC)
    -Zone America/Argentina/Rio_Gallegos -4:36:52 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May    # Córdoba Mean Time
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	-	ART	2004 Jun  1
    -			-4:00	-	WART	2004 Jun 20
    -			-3:00	Arg	AR%sT	2008 Oct 18
    -			-3:00	-	ART
    -#
    -# Tierra del Fuego, Antártida e Islas del Atlántico Sur (TF)
    -Zone America/Argentina/Ushuaia -4:33:12 - LMT	1894 Oct 31
    -			-4:16:48 -	CMT	1920 May    # Córdoba Mean Time
    -			-4:00	-	ART	1930 Dec
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1999 Oct  3
    -			-4:00	Arg	AR%sT	2000 Mar  3
    -			-3:00	-	ART	2004 May 30
    -			-4:00	-	WART	2004 Jun 20
    -			-3:00	Arg	AR%sT	2008 Oct 18
    -			-3:00	-	ART
    -
    -# Aruba
    -Link America/Curacao America/Aruba
    -
    -# Bolivia
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/La_Paz	-4:32:36 -	LMT	1890
    -			-4:32:36 -	CMT	1931 Oct 15 # Calamarca MT
    -			-4:32:36 1:00	BOST	1932 Mar 21 # Bolivia ST
    -			-4:00	-	BOT	# Bolivia Time
    -
    -# Brazil
    -
    -# From Paul Eggert (1993-11-18):
    -# The mayor of Rio recently attempted to change the time zone rules
    -# just in his city, in order to leave more summer time for the tourist trade.
    -# The rule change lasted only part of the day;
    -# the federal government refused to follow the city's rules, and business
    -# was in a chaos, so the mayor backed down that afternoon.
    -
    -# From IATA SSIM (1996-02):
    -# _Only_ the following states in BR1 observe DST: Rio Grande do Sul (RS),
    -# Santa Catarina (SC), Paraná (PR), São Paulo (SP), Rio de Janeiro (RJ),
    -# Espírito Santo (ES), Minas Gerais (MG), Bahia (BA), Goiás (GO),
    -# Distrito Federal (DF), Tocantins (TO), Sergipe [SE] and Alagoas [AL].
    -# [The last three states are new to this issue of the IATA SSIM.]
    -
    -# From Gwillim Law (1996-10-07):
    -# Geography, history (Tocantins was part of Goiás until 1989), and other
    -# sources of time zone information lead me to believe that AL, SE, and TO were
    -# always in BR1, and so the only change was whether or not they observed DST....
    -# The earliest issue of the SSIM I have is 2/91.  Each issue from then until
    -# 9/95 says that DST is observed only in the ten states I quoted from 9/95,
    -# along with Mato Grosso (MT) and Mato Grosso do Sul (MS), which are in BR2
    -# (UTC-4)....  The other two time zones given for Brazil are BR3, which is
    -# UTC-5, no DST, and applies only in the state of Acre (AC); and BR4, which is
    -# UTC-2, and applies to Fernando de Noronha (formerly FN, but I believe it's
    -# become part of the state of Pernambuco).  The boundary between BR1 and BR2
    -# has never been clearly stated.  They've simply been called East and West.
    -# However, some conclusions can be drawn from another IATA manual: the Airline
    -# Coding Directory, which lists close to 400 airports in Brazil.  For each
    -# airport it gives a time zone which is coded to the SSIM.  From that
    -# information, I'm led to conclude that the states of Amapá (AP), Ceará (CE),
    -# Maranhão (MA), Paraíba (PR), Pernambuco (PE), Piauí (PI), and Rio Grande do
    -# Norte (RN), and the eastern part of Pará (PA) are all in BR1 without DST.
    -
    -# From Marcos Tadeu (1998-09-27):
    -# Brazilian official page 
    -
    -# From Jesper Nørgaard (2000-11-03):
    -# [For an official list of which regions in Brazil use which time zones, see:]
    -# http://pcdsh01.on.br/Fusbr.htm
    -# http://pcdsh01.on.br/Fusbrhv.htm
    -
    -# From Celso Doria via David Madeo (2002-10-09):
    -# The reason for the delay this year has to do with elections in Brazil.
    -#
    -# Unlike in the United States, elections in Brazil are 100% computerized and
    -# the results are known almost immediately.  Yesterday, it was the first
    -# round of the elections when 115 million Brazilians voted for President,
    -# Governor, Senators, Federal Deputies, and State Deputies.  Nobody is
    -# counting (or re-counting) votes anymore and we know there will be a second
    -# round for the Presidency and also for some Governors.  The 2nd round will
    -# take place on October 27th.
    -#
    -# The reason why the DST will only begin November 3rd is that the thousands
    -# of electoral machines used cannot have their time changed, and since the
    -# Constitution says the elections must begin at 8:00 AM and end at 5:00 PM,
    -# the Government decided to postpone DST, instead of changing the Constitution
    -# (maybe, for the next elections, it will be possible to change the clock)...
    -
    -# From Rodrigo Severo (2004-10-04):
    -# It's just the biannual change made necessary by the much hyped, supposedly
    -# modern Brazilian eletronic voting machines which, apparently, can't deal
    -# with a time change between the first and the second rounds of the elections.
    -
    -# From Steffen Thorsen (2007-09-20):
    -# Brazil will start DST on 2007-10-14 00:00 and end on 2008-02-17 00:00:
    -# http://www.mme.gov.br/site/news/detail.do;jsessionid=BBA06811AFCAAC28F0285210913513DA?newsId=13975
    -
    -# From Paul Schulze (2008-06-24):
    -# ...by law number 11.662 of April 24, 2008 (published in the "Diario
    -# Oficial da União"...) in Brazil there are changes in the timezones,
    -# effective today (00:00am at June 24, 2008) as follows:
    -#
    -# a) The timezone UTC+5 is extinguished, with all the Acre state and the
    -# part of the Amazonas state that had this timezone now being put to the
    -# timezone UTC+4
    -# b) The whole Pará state now is put at timezone UTC+3, instead of just
    -# part of it, as was before.
    -#
    -# This change follows a proposal of senator Tiao Viana of Acre state, that
    -# proposed it due to concerns about open television channels displaying
    -# programs inappropriate to youths in the states that had the timezone
    -# UTC+5 too early in the night. In the occasion, some more corrections
    -# were proposed, trying to unify the timezones of any given state. This
    -# change modifies timezone rules defined in decree 2.784 of 18 June,
    -# 1913.
    -
    -# From Rodrigo Severo (2008-06-24):
    -# Just correcting the URL:
    -# https://www.in.gov.br/imprensa/visualiza/index.jsp?jornal=do&secao=1&pagina=1&data=25/04/2008
    -#
    -# As a result of the above Decree I believe the America/Rio_Branco
    -# timezone shall be modified from UTC-5 to UTC-4 and a new timezone shall
    -# be created to represent the...west side of the Pará State. I
    -# suggest this new timezone be called Santarem as the most
    -# important/populated city in the affected area.
    -#
    -# This new timezone would be the same as the Rio_Branco timezone up to
    -# the 2008/06/24 change which would be to UTC-3 instead of UTC-4.
    -
    -# From Alex Krivenyshev (2008-06-24):
    -# This is a quick reference page for New and Old Brazil Time Zones map.
    -# http://www.worldtimezone.com/brazil-time-new-old.php
    -#
    -# - 4 time zones replaced by 3 time zones - eliminating time zone UTC-05
    -# (state Acre and the part of the Amazonas will be UTC/GMT-04) - western
    -# part of Par state is moving to one timezone UTC-03 (from UTC-04).
    -
    -# From Paul Eggert (2002-10-10):
    -# The official decrees referenced below are mostly taken from
    -# Decretos sobre o Horário de Verão no Brasil.
    -# http://pcdsh01.on.br/DecHV.html
    -
    -# From Steffen Thorsen (2008-08-29):
    -# As announced by the government and many newspapers in Brazil late
    -# yesterday, Brazil will start DST on 2008-10-19 (need to change rule) and
    -# it will end on 2009-02-15 (current rule for Brazil is fine). Based on
    -# past years experience with the elections, there was a good chance that
    -# the start was postponed to November, but it did not happen this year.
    -#
    -# It has not yet been posted to http://pcdsh01.on.br/DecHV.html
    -#
    -# An official page about it:
    -# http://www.mme.gov.br/site/news/detail.do?newsId=16722
    -# Note that this link does not always work directly, but must be accessed
    -# by going to
    -# http://www.mme.gov.br/first
    -#
    -# One example link that works directly:
    -# http://jornale.com.br/index.php?option=com_content&task=view&id=13530&Itemid=54
    -# (Portuguese)
    -#
    -# We have a written a short article about it as well:
    -# http://www.timeanddate.com/news/time/brazil-dst-2008-2009.html
    -#
    -# From Alexander Krivenyshev (2011-10-04):
    -# State Bahia will return to Daylight savings time this year after 8 years off.
    -# The announcement was made by Governor Jaques Wagner in an interview to a
    -# television station in Salvador.
    -
    -# In Portuguese:
    -# http://g1.globo.com/bahia/noticia/2011/10/governador-jaques-wagner-confirma-horario-de-verao-na-bahia.html
    -# http://noticias.terra.com.br/brasil/noticias/0,,OI5390887-EI8139,00-Bahia+volta+a+ter+horario+de+verao+apos+oito+anos.html
    -
    -# From Guilherme Bernardes Rodrigues (2011-10-07):
    -# There is news in the media, however there is still no decree about it.
    -# I just send a e-mail to Zulmira Brandao at http://pcdsh01.on.br/ the
    -# official agency about time in Brazil, and she confirmed that the old rule is
    -# still in force.
    -
    -# From Guilherme Bernardes Rodrigues (2011-10-14)
    -# It's official, the President signed a decree that includes Bahia in summer
    -# time.
    -#	 [ and in a second message (same day): ]
    -# I found the decree.
    -#
    -# DECRETO No. 7.584, DE 13 DE OUTUBRO DE 2011
    -# Link :
    -# http://www.in.gov.br/visualiza/index.jsp?data=13/10/2011&jornal=1000&pagina=6&totalArquivos=6
    -
    -# From Kelley Cook (2012-10-16):
    -# The governor of state of Bahia in Brazil announced on Thursday that
    -# due to public pressure, he is reversing the DST policy they implemented
    -# last year and will not be going to Summer Time on October 21st....
    -# http://www.correio24horas.com.br/r/artigo/apos-pressoes-wagner-suspende-horario-de-verao-na-bahia
    -
    -# From Rodrigo Severo (2012-10-16):
    -# Tocantins state will have DST.
    -# http://noticias.terra.com.br/brasil/noticias/0,,OI6232536-EI306.html
    -
    -# From Steffen Thorsen (2013-09-20):
    -# Tocantins in Brazil is very likely not to observe DST from October....
    -# http://conexaoto.com.br/2013/09/18/ministerio-confirma-que-tocantins-esta-fora-do-horario-de-verao-em-2013-mas-falta-publicacao-de-decreto
    -# We will keep this article updated when this is confirmed:
    -# http://www.timeanddate.com/news/time/brazil-starts-dst-2013.html
    -
    -# From Steffen Thorsen (2013-10-17):
    -# http://www.timeanddate.com/news/time/acre-amazonas-change-time-zone.html
    -# Senator Jorge Viana announced that Acre will change time zone on November 10.
    -# He did not specify the time of the change, nor if western parts of Amazonas
    -# will change as well.
    -#
    -# From Paul Eggert (2013-10-17):
    -# For now, assume western Amazonas will change as well.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -# Decree 20,466  (1931-10-01)
    -# Decree 21,896  (1932-01-10)
    -Rule	Brazil	1931	only	-	Oct	 3	11:00	1:00	S
    -Rule	Brazil	1932	1933	-	Apr	 1	 0:00	0	-
    -Rule	Brazil	1932	only	-	Oct	 3	 0:00	1:00	S
    -# Decree 23,195  (1933-10-10)
    -# revoked DST.
    -# Decree 27,496  (1949-11-24)
    -# Decree 27,998  (1950-04-13)
    -Rule	Brazil	1949	1952	-	Dec	 1	 0:00	1:00	S
    -Rule	Brazil	1950	only	-	Apr	16	 1:00	0	-
    -Rule	Brazil	1951	1952	-	Apr	 1	 0:00	0	-
    -# Decree 32,308  (1953-02-24)
    -Rule	Brazil	1953	only	-	Mar	 1	 0:00	0	-
    -# Decree 34,724  (1953-11-30)
    -# revoked DST.
    -# Decree 52,700  (1963-10-18)
    -# established DST from 1963-10-23 00:00 to 1964-02-29 00:00
    -# in SP, RJ, GB, MG, ES, due to the prolongation of the drought.
    -# Decree 53,071  (1963-12-03)
    -# extended the above decree to all of the national territory on 12-09.
    -Rule	Brazil	1963	only	-	Dec	 9	 0:00	1:00	S
    -# Decree 53,604  (1964-02-25)
    -# extended summer time by one day to 1964-03-01 00:00 (start of school).
    -Rule	Brazil	1964	only	-	Mar	 1	 0:00	0	-
    -# Decree 55,639  (1965-01-27)
    -Rule	Brazil	1965	only	-	Jan	31	 0:00	1:00	S
    -Rule	Brazil	1965	only	-	Mar	31	 0:00	0	-
    -# Decree 57,303  (1965-11-22)
    -Rule	Brazil	1965	only	-	Dec	 1	 0:00	1:00	S
    -# Decree 57,843  (1966-02-18)
    -Rule	Brazil	1966	1968	-	Mar	 1	 0:00	0	-
    -Rule	Brazil	1966	1967	-	Nov	 1	 0:00	1:00	S
    -# Decree 63,429  (1968-10-15)
    -# revoked DST.
    -# Decree 91,698  (1985-09-27)
    -Rule	Brazil	1985	only	-	Nov	 2	 0:00	1:00	S
    -# Decree 92,310 (1986-01-21)
    -# Decree 92,463 (1986-03-13)
    -Rule	Brazil	1986	only	-	Mar	15	 0:00	0	-
    -# Decree 93,316 (1986-10-01)
    -Rule	Brazil	1986	only	-	Oct	25	 0:00	1:00	S
    -Rule	Brazil	1987	only	-	Feb	14	 0:00	0	-
    -# Decree 94,922  (1987-09-22)
    -Rule	Brazil	1987	only	-	Oct	25	 0:00	1:00	S
    -Rule	Brazil	1988	only	-	Feb	 7	 0:00	0	-
    -# Decree 96,676  (1988-09-12)
    -# except for the states of AC, AM, PA, RR, RO, and AP (then a territory)
    -Rule	Brazil	1988	only	-	Oct	16	 0:00	1:00	S
    -Rule	Brazil	1989	only	-	Jan	29	 0:00	0	-
    -# Decree 98,077  (1989-08-21)
    -# with the same exceptions
    -Rule	Brazil	1989	only	-	Oct	15	 0:00	1:00	S
    -Rule	Brazil	1990	only	-	Feb	11	 0:00	0	-
    -# Decree 99,530  (1990-09-17)
    -# adopted by RS, SC, PR, SP, RJ, ES, MG, GO, MS, DF.
    -# Decree 99,629 (1990-10-19) adds BA, MT.
    -Rule	Brazil	1990	only	-	Oct	21	 0:00	1:00	S
    -Rule	Brazil	1991	only	-	Feb	17	 0:00	0	-
    -# Unnumbered decree  (1991-09-25)
    -# adopted by RS, SC, PR, SP, RJ, ES, MG, BA, GO, MT, MS, DF.
    -Rule	Brazil	1991	only	-	Oct	20	 0:00	1:00	S
    -Rule	Brazil	1992	only	-	Feb	 9	 0:00	0	-
    -# Unnumbered decree  (1992-10-16)
    -# adopted by same states.
    -Rule	Brazil	1992	only	-	Oct	25	 0:00	1:00	S
    -Rule	Brazil	1993	only	-	Jan	31	 0:00	0	-
    -# Decree 942  (1993-09-28)
    -# adopted by same states, plus AM.
    -# Decree 1,252  (1994-09-22;
    -# web page corrected 2004-01-07) adopted by same states, minus AM.
    -# Decree 1,636  (1995-09-14)
    -# adopted by same states, plus MT and TO.
    -# Decree 1,674  (1995-10-13)
    -# adds AL, SE.
    -Rule	Brazil	1993	1995	-	Oct	Sun>=11	 0:00	1:00	S
    -Rule	Brazil	1994	1995	-	Feb	Sun>=15	 0:00	0	-
    -Rule	Brazil	1996	only	-	Feb	11	 0:00	0	-
    -# Decree 2,000  (1996-09-04)
    -# adopted by same states, minus AL, SE.
    -Rule	Brazil	1996	only	-	Oct	 6	 0:00	1:00	S
    -Rule	Brazil	1997	only	-	Feb	16	 0:00	0	-
    -# From Daniel C. Sobral (1998-02-12):
    -# In 1997, the DS began on October 6. The stated reason was that
    -# because international television networks ignored Brazil's policy on DS,
    -# they bought the wrong times on satellite for coverage of Pope's visit.
    -# This year, the ending date of DS was postponed to March 1
    -# to help dealing with the shortages of electric power.
    -#
    -# Decree 2,317 (1997-09-04), adopted by same states.
    -Rule	Brazil	1997	only	-	Oct	 6	 0:00	1:00	S
    -# Decree 2,495 
    -# (1998-02-10)
    -Rule	Brazil	1998	only	-	Mar	 1	 0:00	0	-
    -# Decree 2,780  (1998-09-11)
    -# adopted by the same states as before.
    -Rule	Brazil	1998	only	-	Oct	11	 0:00	1:00	S
    -Rule	Brazil	1999	only	-	Feb	21	 0:00	0	-
    -# Decree 3,150 
    -# (1999-08-23) adopted by same states.
    -# Decree 3,188  (1999-09-30)
    -# adds SE, AL, PB, PE, RN, CE, PI, MA and RR.
    -Rule	Brazil	1999	only	-	Oct	 3	 0:00	1:00	S
    -Rule	Brazil	2000	only	-	Feb	27	 0:00	0	-
    -# Decree 3,592  (2000-09-06)
    -# adopted by the same states as before.
    -# Decree 3,630  (2000-10-13)
    -# repeals DST in PE and RR, effective 2000-10-15 00:00.
    -# Decree 3,632  (2000-10-17)
    -# repeals DST in SE, AL, PB, RN, CE, PI and MA, effective 2000-10-22 00:00.
    -# Decree 3,916 
    -# (2001-09-13) reestablishes DST in AL, CE, MA, PB, PE, PI, RN, SE.
    -Rule	Brazil	2000	2001	-	Oct	Sun>=8	 0:00	1:00	S
    -Rule	Brazil	2001	2006	-	Feb	Sun>=15	 0:00	0	-
    -# Decree 4,399 (2002-10-01) repeals DST in AL, CE, MA, PB, PE, PI, RN, SE.
    -# 4,399 
    -Rule	Brazil	2002	only	-	Nov	 3	 0:00	1:00	S
    -# Decree 4,844 (2003-09-24; corrected 2003-09-26) repeals DST in BA, MT, TO.
    -# 4,844 
    -Rule	Brazil	2003	only	-	Oct	19	 0:00	1:00	S
    -# Decree 5,223 (2004-10-01) reestablishes DST in MT.
    -# 5,223 
    -Rule	Brazil	2004	only	-	Nov	 2	 0:00	1:00	S
    -# Decree 5,539  (2005-09-19),
    -# adopted by the same states as before.
    -Rule	Brazil	2005	only	-	Oct	16	 0:00	1:00	S
    -# Decree 5,920  (2006-10-03),
    -# adopted by the same states as before.
    -Rule	Brazil	2006	only	-	Nov	 5	 0:00	1:00	S
    -Rule	Brazil	2007	only	-	Feb	25	 0:00	0	-
    -# Decree 6,212  (2007-09-26),
    -# adopted by the same states as before.
    -Rule	Brazil	2007	only	-	Oct	Sun>=8	 0:00	1:00	S
    -# From Frederico A. C. Neves (2008-09-10):
    -# According to this decree
    -# http://www.planalto.gov.br/ccivil_03/_Ato2007-2010/2008/Decreto/D6558.htm
    -# [t]he DST period in Brazil now on will be from the 3rd Oct Sunday to the
    -# 3rd Feb Sunday. There is an exception on the return date when this is
    -# the Carnival Sunday then the return date will be the next Sunday...
    -Rule	Brazil	2008	max	-	Oct	Sun>=15	0:00	1:00	S
    -Rule	Brazil	2008	2011	-	Feb	Sun>=15	0:00	0	-
    -Rule	Brazil	2012	only	-	Feb	Sun>=22	0:00	0	-
    -Rule	Brazil	2013	2014	-	Feb	Sun>=15	0:00	0	-
    -Rule	Brazil	2015	only	-	Feb	Sun>=22	0:00	0	-
    -Rule	Brazil	2016	2022	-	Feb	Sun>=15	0:00	0	-
    -Rule	Brazil	2023	only	-	Feb	Sun>=22	0:00	0	-
    -Rule	Brazil	2024	2025	-	Feb	Sun>=15	0:00	0	-
    -Rule	Brazil	2026	only	-	Feb	Sun>=22	0:00	0	-
    -Rule	Brazil	2027	2033	-	Feb	Sun>=15	0:00	0	-
    -Rule	Brazil	2034	only	-	Feb	Sun>=22	0:00	0	-
    -Rule	Brazil	2035	2036	-	Feb	Sun>=15	0:00	0	-
    -Rule	Brazil	2037	only	-	Feb	Sun>=22	0:00	0	-
    -# From Arthur David Olson (2008-09-29):
    -# The next is wrong in some years but is better than nothing.
    -Rule	Brazil	2038	max	-	Feb	Sun>=15	0:00	0	-
    -
    -# The latest ruleset listed above says that the following states observe DST:
    -# DF, ES, GO, MG, MS, MT, PR, RJ, RS, SC, SP.
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -#
    -# Fernando de Noronha (administratively part of PE)
    -Zone America/Noronha	-2:09:40 -	LMT	1914
    -			-2:00	Brazil	FN%sT	1990 Sep 17
    -			-2:00	-	FNT	1999 Sep 30
    -			-2:00	Brazil	FN%sT	2000 Oct 15
    -			-2:00	-	FNT	2001 Sep 13
    -			-2:00	Brazil	FN%sT	2002 Oct  1
    -			-2:00	-	FNT
    -# Other Atlantic islands have no permanent settlement.
    -# These include Trindade and Martim Vaz (administratively part of ES),
    -# Rocas Atoll (RN), and the St Peter and St Paul Archipelago (PE).
    -# Fernando de Noronha was a separate territory from 1942-09-02 to 1989-01-01;
    -# it also included the Penedos.
    -#
    -# Amapá (AP), east Pará (PA)
    -# East Pará includes Belém, Marabá, Serra Norte, and São Félix do Xingu.
    -# The division between east and west Pará is the river Xingu.
    -# In the north a very small part from the river Javary (now Jari I guess,
    -# the border with Amapá) to the Amazon, then to the Xingu.
    -Zone America/Belem	-3:13:56 -	LMT	1914
    -			-3:00	Brazil	BR%sT	1988 Sep 12
    -			-3:00	-	BRT
    -#
    -# west Pará (PA)
    -# West Pará includes Altamira, Óbidos, Prainha, Oriximiná, and Santarém.
    -Zone America/Santarem	-3:38:48 -	LMT	1914
    -			-4:00	Brazil	AM%sT	1988 Sep 12
    -			-4:00	-	AMT	2008 Jun 24  0:00
    -			-3:00	-	BRT
    -#
    -# Maranhão (MA), Piauí (PI), Ceará (CE), Rio Grande do Norte (RN),
    -# Paraíba (PB)
    -Zone America/Fortaleza	-2:34:00 -	LMT	1914
    -			-3:00	Brazil	BR%sT	1990 Sep 17
    -			-3:00	-	BRT	1999 Sep 30
    -			-3:00	Brazil	BR%sT	2000 Oct 22
    -			-3:00	-	BRT	2001 Sep 13
    -			-3:00	Brazil	BR%sT	2002 Oct  1
    -			-3:00	-	BRT
    -#
    -# Pernambuco (PE) (except Atlantic islands)
    -Zone America/Recife	-2:19:36 -	LMT	1914
    -			-3:00	Brazil	BR%sT	1990 Sep 17
    -			-3:00	-	BRT	1999 Sep 30
    -			-3:00	Brazil	BR%sT	2000 Oct 15
    -			-3:00	-	BRT	2001 Sep 13
    -			-3:00	Brazil	BR%sT	2002 Oct  1
    -			-3:00	-	BRT
    -#
    -# Tocantins (TO)
    -Zone America/Araguaina	-3:12:48 -	LMT	1914
    -			-3:00	Brazil	BR%sT	1990 Sep 17
    -			-3:00	-	BRT	1995 Sep 14
    -			-3:00	Brazil	BR%sT	2003 Sep 24
    -			-3:00	-	BRT	2012 Oct 21
    -			-3:00	Brazil	BR%sT	2013 Sep
    -			-3:00	-	BRT
    -#
    -# Alagoas (AL), Sergipe (SE)
    -Zone America/Maceio	-2:22:52 -	LMT	1914
    -			-3:00	Brazil	BR%sT	1990 Sep 17
    -			-3:00	-	BRT	1995 Oct 13
    -			-3:00	Brazil	BR%sT	1996 Sep  4
    -			-3:00	-	BRT	1999 Sep 30
    -			-3:00	Brazil	BR%sT	2000 Oct 22
    -			-3:00	-	BRT	2001 Sep 13
    -			-3:00	Brazil	BR%sT	2002 Oct  1
    -			-3:00	-	BRT
    -#
    -# Bahia (BA)
    -# There are too many Salvadors elsewhere, so use America/Bahia instead
    -# of America/Salvador.
    -Zone America/Bahia	-2:34:04 -	LMT	1914
    -			-3:00	Brazil	BR%sT	2003 Sep 24
    -			-3:00	-	BRT	2011 Oct 16
    -			-3:00	Brazil	BR%sT	2012 Oct 21
    -			-3:00	-	BRT
    -#
    -# Goiás (GO), Distrito Federal (DF), Minas Gerais (MG),
    -# Espírito Santo (ES), Rio de Janeiro (RJ), São Paulo (SP), Paraná (PR),
    -# Santa Catarina (SC), Rio Grande do Sul (RS)
    -Zone America/Sao_Paulo	-3:06:28 -	LMT	1914
    -			-3:00	Brazil	BR%sT	1963 Oct 23  0:00
    -			-3:00	1:00	BRST	1964
    -			-3:00	Brazil	BR%sT
    -#
    -# Mato Grosso do Sul (MS)
    -Zone America/Campo_Grande -3:38:28 -	LMT	1914
    -			-4:00	Brazil	AM%sT
    -#
    -# Mato Grosso (MT)
    -Zone America/Cuiaba	-3:44:20 -	LMT	1914
    -			-4:00	Brazil	AM%sT	2003 Sep 24
    -			-4:00	-	AMT	2004 Oct  1
    -			-4:00	Brazil	AM%sT
    -#
    -# Rondônia (RO)
    -Zone America/Porto_Velho -4:15:36 -	LMT	1914
    -			-4:00	Brazil	AM%sT	1988 Sep 12
    -			-4:00	-	AMT
    -#
    -# Roraima (RR)
    -Zone America/Boa_Vista	-4:02:40 -	LMT	1914
    -			-4:00	Brazil	AM%sT	1988 Sep 12
    -			-4:00	-	AMT	1999 Sep 30
    -			-4:00	Brazil	AM%sT	2000 Oct 15
    -			-4:00	-	AMT
    -#
    -# east Amazonas (AM): Boca do Acre, Jutaí, Manaus, Floriano Peixoto
    -# The great circle line from Tabatinga to Porto Acre divides
    -# east from west Amazonas.
    -Zone America/Manaus	-4:00:04 -	LMT	1914
    -			-4:00	Brazil	AM%sT	1988 Sep 12
    -			-4:00	-	AMT	1993 Sep 28
    -			-4:00	Brazil	AM%sT	1994 Sep 22
    -			-4:00	-	AMT
    -#
    -# west Amazonas (AM): Atalaia do Norte, Boca do Maoco, Benjamin Constant,
    -#	Eirunepé, Envira, Ipixuna
    -Zone America/Eirunepe	-4:39:28 -	LMT	1914
    -			-5:00	Brazil	AC%sT	1988 Sep 12
    -			-5:00	-	ACT	1993 Sep 28
    -			-5:00	Brazil	AC%sT	1994 Sep 22
    -			-5:00	-	ACT	2008 Jun 24  0:00
    -			-4:00	-	AMT	2013 Nov 10
    -			-5:00	-	ACT
    -#
    -# Acre (AC)
    -Zone America/Rio_Branco	-4:31:12 -	LMT	1914
    -			-5:00	Brazil	AC%sT	1988 Sep 12
    -			-5:00	-	ACT	2008 Jun 24  0:00
    -			-4:00	-	AMT	2013 Nov 10
    -			-5:00	-	ACT
    -
    -# Chile
    -
    -# From Paul Eggert (2015-04-03):
    -# Shanks & Pottenger says America/Santiago introduced standard time in
    -# 1890 and rounds its UTC offset to 70W40; guess that in practice this
    -# was the same offset as in 1916-1919.  It also says Pacific/Easter
    -# standardized on 109W22 in 1890; assume this didn't change the clocks.
    -#
    -# Dates for America/Santiago from 1910 to 2004 are primarily from
    -# the following source, cited by Oscar van Vlijmen (2006-10-08):
    -# [1] Chile Law
    -# http://www.webexhibits.org/daylightsaving/chile.html
    -# This contains a copy of a this official table:
    -# Cambios en la hora oficial de Chile desde 1900 (retrieved 2008-03-30)
    -# http://web.archive.org/web/20080330200901/http://www.horaoficial.cl/cambio.htm
    -# [1] needs several corrections, though.
    -#
    -# The first set of corrections is from:
    -# [2] History of the Official Time of Chile
    -# http://www.horaoficial.cl/ing/horaof_ing.html (retrieved 2012-03-06).  See:
    -# http://web.archive.org/web/20120306042032/http://www.horaoficial.cl/ing/horaof_ing.html
    -# This is an English translation of:
    -# Historia de la hora oficial de Chile (retrieved 2012-10-24).  See:
    -# http://web.archive.org/web/20121024234627/http://www.horaoficial.cl/horaof.htm
    -# A fancier Spanish version (requiring mouse-clicking) is at:
    -# http://www.horaoficial.cl/historia_hora.html
    -# Conflicts between [1] and [2] were resolved as follows:
    -#
    -#  - [1] says the 1910 transition was Jan 1, [2] says Jan 10 and cites
    -#    Boletín No. 1, Aviso No. 1 (1910).  Go with [2].
    -#
    -#  - [1] says SMT was -4:42:45, [2] says Chile's official time from
    -#    1916 to 1919 was -4:42:46.3, the meridian of Chile's National
    -#    Astronomical Observatory (OAN), then located in what is now
    -#    Quinta Normal in Santiago.  Go with [2], rounding it to -4:42:46.
    -#
    -#  - [1] says the 1918 transition was Sep 1, [2] says Sep 10 and cites
    -#    Boletín No. 22, Aviso No. 129/1918 (1918-08-23).  Go with [2].
    -#
    -#  - [1] does not give times for transitions; assume they occur
    -#    at midnight mainland time, the current common practice.  However,
    -#    go with [2]'s specification of 23:00 for the 1947-05-21 transition.
    -#
    -# Another correction to [1] is from Jesper Nørgaard Welen, who
    -# wrote (2006-10-08), "I think that there are some obvious mistakes in
    -# the suggested link from Oscar van Vlijmen,... for instance entry 66
    -# says that GMT-4 ended 1990-09-12 while entry 67 only begins GMT-3 at
    -# 1990-09-15 (they should have been 1990-09-15 and 1990-09-16
    -# respectively), but anyhow it clears up some doubts too."
    -#
    -# Data for Pacific/Easter from 1910 through 1967 come from Shanks &
    -# Pottenger.  After that, for lack of better info assume
    -# Pacific/Easter is always two hours behind America/Santiago;
    -# this is known to work for DST transitions starting in 2008 and
    -# may well be true for earlier transitions.
    -
    -# From Eduardo Krell (1995-10-19):
    -# The law says to switch to DST at midnight [24:00] on the second SATURDAY
    -# of October....  The law is the same for March and October.
    -# (1998-09-29):
    -# Because of the drought this year, the government decided to go into
    -# DST earlier (saturday 9/26 at 24:00). This is a one-time change only ...
    -# (unless there's another dry season next year, I guess).
    -
    -# From Julio I. Pacheco Troncoso (1999-03-18):
    -# Because of the same drought, the government decided to end DST later,
    -# on April 3, (one-time change).
    -
    -# From Germán Poo-Caamaño (2008-03-03):
    -# Due to drought, Chile extends Daylight Time in three weeks.  This
    -# is one-time change (Saturday 3/29 at 24:00 for America/Santiago
    -# and Saturday 3/29 at 22:00 for Pacific/Easter)
    -# The Supreme Decree is located at
    -# http://www.shoa.cl/servicios/supremo316.pdf
    -#
    -# From José Miguel Garrido (2008-03-05):
    -# http://www.shoa.cl/noticias/2008/04hora/hora.htm
    -
    -# From Angel Chiang (2010-03-04):
    -# Subject: DST in Chile exceptionally extended to 3 April due to earthquake
    -# http://www.gobiernodechile.cl/viewNoticia.aspx?idArticulo=30098
    -#
    -# From Arthur David Olson (2010-03-06):
    -# Angel Chiang's message confirmed by Julio Pacheco; Julio provided a patch.
    -
    -# From Glenn Eychaner (2011-03-28):
    -# http://diario.elmercurio.com/2011/03/28/_portada/_portada/noticias/7565897A-CA86-49E6-9E03-660B21A4883E.htm?id=3D{7565897A-CA86-49E6-9E03-660B21A4883E}
    -# In English:
    -# Chile's clocks will go back an hour this year on the 7th of May instead
    -# of this Saturday. They will go forward again the 3rd Saturday in
    -# August, not in October as they have since 1968.
    -
    -# From Mauricio Parada (2012-02-22), translated by Glenn Eychaner (2012-02-23):
    -# As stated in the website of the Chilean Energy Ministry
    -# http://www.minenergia.cl/ministerio/noticias/generales/gobierno-anuncia-fechas-de-cambio-de.html
    -# The Chilean Government has decided to postpone the entrance into winter time
    -# (to leave DST) from March 11 2012 to April 28th 2012....
    -# Quote from the website communication:
    -#
    -# 6. For the year 2012, the dates of entry into winter time will be as follows:
    -# a. Saturday April 28, 2012, clocks should go back 60 minutes; that is, at
    -# 23:59:59, instead of passing to 0:00, the time should be adjusted to be 23:00
    -# of the same day.
    -# b. Saturday, September 1, 2012, clocks should go forward 60 minutes; that is,
    -# at 23:59:59, instead of passing to 0:00, the time should be adjusted to be
    -# 01:00 on September 2.
    -
    -# From Steffen Thorsen (2013-02-15):
    -# According to several news sources, Chile has extended DST this year,
    -# they will end DST later and start DST earlier than planned.  They
    -# hope to save energy.  The new end date is 2013-04-28 00:00 and new
    -# start date is 2013-09-08 00:00....
    -# http://www.gob.cl/informa/2013/02/15/gobierno-anuncia-fechas-de-cambio-de-hora-para-el-ano-2013.htm
    -
    -# From José Miguel Garrido (2014-02-19):
    -# Today appeared in the Diario Oficial a decree amending the time change
    -# dates to 2014.
    -# DST End: last Saturday of April 2014 (Sun 27 Apr 2014 03:00 UTC)
    -# DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC)
    -# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf
    -
    -# From Eduardo Romero Urra (2015-03-03):
    -# Today has been published officially that Chile will use the DST time
    -# permanently until March 25 of 2017
    -# http://www.diariooficial.interior.gob.cl/media/2015/03/03/1-large.jpg
    -#
    -# From Paul Eggert (2015-03-03):
    -# For now, assume that the extension will persist indefinitely.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Chile	1927	1931	-	Sep	 1	0:00	1:00	S
    -Rule	Chile	1928	1932	-	Apr	 1	0:00	0	-
    -Rule	Chile	1968	only	-	Nov	 3	4:00u	1:00	S
    -Rule	Chile	1969	only	-	Mar	30	3:00u	0	-
    -Rule	Chile	1969	only	-	Nov	23	4:00u	1:00	S
    -Rule	Chile	1970	only	-	Mar	29	3:00u	0	-
    -Rule	Chile	1971	only	-	Mar	14	3:00u	0	-
    -Rule	Chile	1970	1972	-	Oct	Sun>=9	4:00u	1:00	S
    -Rule	Chile	1972	1986	-	Mar	Sun>=9	3:00u	0	-
    -Rule	Chile	1973	only	-	Sep	30	4:00u	1:00	S
    -Rule	Chile	1974	1987	-	Oct	Sun>=9	4:00u	1:00	S
    -Rule	Chile	1987	only	-	Apr	12	3:00u	0	-
    -Rule	Chile	1988	1990	-	Mar	Sun>=9	3:00u	0	-
    -Rule	Chile	1988	1989	-	Oct	Sun>=9	4:00u	1:00	S
    -Rule	Chile	1990	only	-	Sep	16	4:00u	1:00	S
    -Rule	Chile	1991	1996	-	Mar	Sun>=9	3:00u	0	-
    -Rule	Chile	1991	1997	-	Oct	Sun>=9	4:00u	1:00	S
    -Rule	Chile	1997	only	-	Mar	30	3:00u	0	-
    -Rule	Chile	1998	only	-	Mar	Sun>=9	3:00u	0	-
    -Rule	Chile	1998	only	-	Sep	27	4:00u	1:00	S
    -Rule	Chile	1999	only	-	Apr	 4	3:00u	0	-
    -Rule	Chile	1999	2010	-	Oct	Sun>=9	4:00u	1:00	S
    -Rule	Chile	2000	2007	-	Mar	Sun>=9	3:00u	0	-
    -# N.B.: the end of March 29 in Chile is March 30 in Universal time,
    -# which is used below in specifying the transition.
    -Rule	Chile	2008	only	-	Mar	30	3:00u	0	-
    -Rule	Chile	2009	only	-	Mar	Sun>=9	3:00u	0	-
    -Rule	Chile	2010	only	-	Apr	Sun>=1	3:00u	0	-
    -Rule	Chile	2011	only	-	May	Sun>=2	3:00u	0	-
    -Rule	Chile	2011	only	-	Aug	Sun>=16	4:00u	1:00	S
    -Rule	Chile	2012	2015	-	Apr	Sun>=23	3:00u	0	-
    -Rule	Chile	2012	2014	-	Sep	Sun>=2	4:00u	1:00	S
    -# IATA SSIM anomalies: (1992-02) says 1992-03-14;
    -# (1996-09) says 1998-03-08.  Ignore these.
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Santiago	-4:42:46 -	LMT	1890
    -			-4:42:46 -	SMT	1910 Jan 10 # Santiago Mean Time
    -			-5:00	-	CLT	1916 Jul  1 # Chile Time
    -			-4:42:46 -	SMT	1918 Sep 10
    -			-4:00	-	CLT	1919 Jul  1
    -			-4:42:46 -	SMT	1927 Sep  1
    -			-5:00	Chile	CL%sT	1932 Sep  1
    -			-4:00	-	CLT	1942 Jun  1
    -			-5:00	-	CLT	1942 Aug  1
    -			-4:00	-	CLT	1946 Jul 15
    -			-4:00	1:00	CLST	1946 Sep  1 # central Chile
    -			-4:00	-	CLT	1947 Apr  1
    -			-5:00	-	CLT	1947 May 21 23:00
    -			-4:00	Chile	CL%sT	2015 Apr 26  3:00u
    -			-3:00	-	CLT
    -Zone Pacific/Easter	-7:17:28 -	LMT	1890
    -			-7:17:28 -	EMT	1932 Sep    # Easter Mean Time
    -			-7:00	Chile	EAS%sT	1982 Mar 14 3:00u # Easter Time
    -			-6:00	Chile	EAS%sT	2015 Apr 26 3:00u
    -			-5:00	-	EAST
    -#
    -# Salas y Gómez Island is uninhabited.
    -# Other Chilean locations, including Juan Fernández Is, Desventuradas Is,
    -# and Antarctic bases, are like America/Santiago.
    -
    -# Antarctic base using South American rules
    -# (See the file 'antarctica' for more.)
    -#
    -# Palmer, Anvers Island, since 1965 (moved 2 miles in 1968)
    -#
    -# From Ethan Dicks (1996-10-06):
    -# It keeps the same time as Punta Arenas, Chile, because, just like us
    -# and the South Pole, that's the other end of their supply line....
    -# I verified with someone who was there that since 1980,
    -# Palmer has followed Chile.  Prior to that, before the Falklands War,
    -# Palmer used to be supplied from Argentina.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Antarctica/Palmer	0	-	zzz	1965
    -			-4:00	Arg	AR%sT	1969 Oct  5
    -			-3:00	Arg	AR%sT	1982 May
    -			-4:00	Chile	CL%sT	2015 Apr 26 3:00u
    -			-3:00	-	CLT
    -
    -# Colombia
    -
    -# Milne gives 4:56:16.4 for Bogotá time in 1899; round to nearest.  He writes,
    -# "A variation of fifteen minutes in the public clocks of Bogota is not rare."
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	CO	1992	only	-	May	 3	0:00	1:00	S
    -Rule	CO	1993	only	-	Apr	 4	0:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Bogota	-4:56:16 -	LMT	1884 Mar 13
    -			-4:56:16 -	BMT	1914 Nov 23 # Bogotá Mean Time
    -			-5:00	CO	CO%sT	# Colombia Time
    -# Malpelo, Providencia, San Andres
    -# no information; probably like America/Bogota
    -
    -# Curaçao
    -
    -# Milne gives 4:35:46.9 for Curaçao mean time; round to nearest.
    -#
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger say that The Bottom and Philipsburg have been at
    -# -4:00 since standard time was introduced on 1912-03-02; and that
    -# Kralendijk and Rincon used Kralendijk Mean Time (-4:33:08) from
    -# 1912-02-02 to 1965-01-01.  The former is dubious, since S&P also say
    -# Saba Island has been like Curaçao.
    -# This all predates our 1970 cutoff, though.
    -#
    -# By July 2007 Curaçao and St Maarten are planned to become
    -# associated states within the Netherlands, much like Aruba;
    -# Bonaire, Saba and St Eustatius would become directly part of the
    -# Netherlands as Kingdom Islands.  This won't affect their time zones
    -# though, as far as we know.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Curacao	-4:35:47 -	LMT	1912 Feb 12 # Willemstad
    -			-4:30	-	ANT	1965 # Netherlands Antilles Time
    -			-4:00	-	AST
    -
    -# From Arthur David Olson (2011-06-15):
    -# use links for places with new iso3166 codes.
    -# The name "Lower Prince's Quarter" is both longer than fourteen characters
    -# and contains an apostrophe; use "Lower_Princes" below.
    -
    -Link	America/Curacao	America/Lower_Princes	# Sint Maarten
    -Link	America/Curacao	America/Kralendijk	# Caribbean Netherlands
    -
    -# Ecuador
    -#
    -# Milne says the Central and South American Telegraph Company used -5:24:15.
    -#
    -# From Paul Eggert (2007-03-04):
    -# Apparently Ecuador had a failed experiment with DST in 1992.
    -#  (2007-02-27) and
    -#  (2006-11-06) both
    -# talk about "hora Sixto".  Leave this alone for now, as we have no data.
    -#
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Guayaquil	-5:19:20 -	LMT	1890
    -			-5:14:00 -	QMT	1931 # Quito Mean Time
    -			-5:00	-	ECT	# Ecuador Time
    -Zone Pacific/Galapagos	-5:58:24 -	LMT	1931 # Puerto Baquerizo Moreno
    -			-5:00	-	ECT	1986
    -			-6:00	-	GALT	# Galápagos Time
    -
    -# Falklands
    -
    -# From Paul Eggert (2006-03-22):
    -# Between 1990 and 2000 inclusive, Shanks & Pottenger and the IATA agree except
    -# the IATA gives 1996-09-08.  Go with Shanks & Pottenger.
    -
    -# From Falkland Islands Government Office, London (2001-01-22)
    -# via Jesper Nørgaard:
    -# ... the clocks revert back to Local Mean Time at 2 am on Sunday 15
    -# April 2001 and advance one hour to summer time at 2 am on Sunday 2
    -# September.  It is anticipated that the clocks will revert back at 2
    -# am on Sunday 21 April 2002 and advance to summer time at 2 am on
    -# Sunday 1 September.
    -
    -# From Rives McDow (2001-02-13):
    -#
    -# I have communicated several times with people there, and the last
    -# time I had communications that was helpful was in 1998.  Here is
    -# what was said then:
    -#
    -# "The general rule was that Stanley used daylight saving and the Camp
    -# did not. However for various reasons many people in the Camp have
    -# started to use daylight saving (known locally as 'Stanley Time')
    -# There is no rule as to who uses daylight saving - it is a matter of
    -# personal choice and so it is impossible to draw a map showing who
    -# uses it and who does not. Any list would be out of date as soon as
    -# it was produced. This year daylight saving ended on April 18/19th
    -# and started again on September 12/13th.  I do not know what the rule
    -# is, but can find out if you like.  We do not change at the same time
    -# as UK or Chile."
    -#
    -# I did have in my notes that the rule was "Second Saturday in Sep at
    -# 0:00 until third Saturday in Apr at 0:00".  I think that this does
    -# not agree in some cases with Shanks; is this true?
    -#
    -# Also, there is no mention in the list that some areas in the
    -# Falklands do not use DST.  I have found in my communications there
    -# that these areas are on the western half of East Falkland and all of
    -# West Falkland.  Stanley is the only place that consistently observes
    -# DST.  Again, as in other places in the world, the farmers don't like
    -# it.  West Falkland is almost entirely sheep farmers.
    -#
    -# I know one lady there that keeps a list of which farm keeps DST and
    -# which doesn't each year.  She runs a shop in Stanley, and says that
    -# the list changes each year.  She uses it to communicate to her
    -# customers, catching them when they are home for lunch or dinner.
    -
    -# From Paul Eggert (2001-03-05):
    -# For now, we'll just record the time in Stanley, since we have no
    -# better info.
    -
    -# From Steffen Thorsen (2011-04-01):
    -# The Falkland Islands will not turn back clocks this winter, but stay on
    -# daylight saving time.
    -#
    -# One source:
    -# http://www.falklandnews.com/public/story.cfm?get=5914&source=3
    -#
    -# We have gotten this confirmed by a clerk of the legislative assembly:
    -# Normally the clocks revert to Local Mean Time (UTC/GMT -4 hours) on the
    -# third Sunday of April at 0200hrs and advance to Summer Time (UTC/GMT -3
    -# hours) on the first Sunday of September at 0200hrs.
    -#
    -# IMPORTANT NOTE: During 2011, on a trial basis, the Falkland Islands
    -# will not revert to local mean time, but clocks will remain on Summer
    -# time (UTC/GMT - 3 hours) throughout the whole of 2011.  Any long term
    -# change to local time following the trial period will be notified.
    -#
    -# From Andrew Newman (2012-02-24)
    -# A letter from Justin McPhee, Chief Executive,
    -# Cable & Wireless Falkland Islands (dated 2012-02-22)
    -# states...
    -#   The current Atlantic/Stanley entry under South America expects the
    -#   clocks to go back to standard Falklands Time (FKT) on the 15th April.
    -#   The database entry states that in 2011 Stanley was staying on fixed
    -#   summer time on a trial basis only.  FIG need to contact IANA and/or
    -#   the maintainers of the database to inform them we're adopting
    -#   the same policy this year and suggest recommendations for future years.
    -#
    -# For now we will assume permanent summer time for the Falklands
    -# until advised differently (to apply for 2012 and beyond, after the 2011
    -# experiment was apparently successful.)
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Falk	1937	1938	-	Sep	lastSun	0:00	1:00	S
    -Rule	Falk	1938	1942	-	Mar	Sun>=19	0:00	0	-
    -Rule	Falk	1939	only	-	Oct	1	0:00	1:00	S
    -Rule	Falk	1940	1942	-	Sep	lastSun	0:00	1:00	S
    -Rule	Falk	1943	only	-	Jan	1	0:00	0	-
    -Rule	Falk	1983	only	-	Sep	lastSun	0:00	1:00	S
    -Rule	Falk	1984	1985	-	Apr	lastSun	0:00	0	-
    -Rule	Falk	1984	only	-	Sep	16	0:00	1:00	S
    -Rule	Falk	1985	2000	-	Sep	Sun>=9	0:00	1:00	S
    -Rule	Falk	1986	2000	-	Apr	Sun>=16	0:00	0	-
    -Rule	Falk	2001	2010	-	Apr	Sun>=15	2:00	0	-
    -Rule	Falk	2001	2010	-	Sep	Sun>=1	2:00	1:00	S
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Atlantic/Stanley	-3:51:24 -	LMT	1890
    -			-3:51:24 -	SMT	1912 Mar 12 # Stanley Mean Time
    -			-4:00	Falk	FK%sT	1983 May    # Falkland Is Time
    -			-3:00	Falk	FK%sT	1985 Sep 15
    -			-4:00	Falk	FK%sT	2010 Sep  5  2:00
    -			-3:00	-	FKST
    -
    -# French Guiana
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Cayenne	-3:29:20 -	LMT	1911 Jul
    -			-4:00	-	GFT	1967 Oct # French Guiana Time
    -			-3:00	-	GFT
    -
    -# Guyana
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Guyana	-3:52:40 -	LMT	1915 Mar    # Georgetown
    -			-3:45	-	GBGT	1966 May 26 # Br Guiana Time
    -			-3:45	-	GYT	1975 Jul 31 # Guyana Time
    -			-3:00	-	GYT	1991
    -# IATA SSIM (1996-06) says -4:00.  Assume a 1991 switch.
    -			-4:00	-	GYT
    -
    -# Paraguay
    -#
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger say that spring transitions are 01:00 -> 02:00,
    -# and autumn transitions are 00:00 -> 23:00.  Go with pre-1999
    -# editions of Shanks, and with the IATA, who say transitions occur at 00:00.
    -#
    -# From Waldemar Villamayor-Venialbo (2013-09-20):
    -# No time of the day is established for the adjustment, so people normally
    -# adjust their clocks at 0 hour of the given dates.
    -#
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Para	1975	1988	-	Oct	 1	0:00	1:00	S
    -Rule	Para	1975	1978	-	Mar	 1	0:00	0	-
    -Rule	Para	1979	1991	-	Apr	 1	0:00	0	-
    -Rule	Para	1989	only	-	Oct	22	0:00	1:00	S
    -Rule	Para	1990	only	-	Oct	 1	0:00	1:00	S
    -Rule	Para	1991	only	-	Oct	 6	0:00	1:00	S
    -Rule	Para	1992	only	-	Mar	 1	0:00	0	-
    -Rule	Para	1992	only	-	Oct	 5	0:00	1:00	S
    -Rule	Para	1993	only	-	Mar	31	0:00	0	-
    -Rule	Para	1993	1995	-	Oct	 1	0:00	1:00	S
    -Rule	Para	1994	1995	-	Feb	lastSun	0:00	0	-
    -Rule	Para	1996	only	-	Mar	 1	0:00	0	-
    -# IATA SSIM (2000-02) says 1999-10-10; ignore this for now.
    -# From Steffen Thorsen (2000-10-02):
    -# I have three independent reports that Paraguay changed to DST this Sunday
    -# (10-01).
    -#
    -# Translated by Gwillim Law (2001-02-27) from
    -# Noticias, a daily paper in Asunción, Paraguay (2000-10-01):
    -# http://www.diarionoticias.com.py/011000/nacional/naciona1.htm
    -# Starting at 0:00 today, the clock will be set forward 60 minutes, in
    -# fulfillment of Decree No. 7,273 of the Executive Power....  The time change
    -# system has been operating for several years.  Formerly there was a separate
    -# decree each year; the new law has the same effect, but permanently.  Every
    -# year, the time will change on the first Sunday of October; likewise, the
    -# clock will be set back on the first Sunday of March.
    -#
    -Rule	Para	1996	2001	-	Oct	Sun>=1	0:00	1:00	S
    -# IATA SSIM (1997-09) says Mar 1; go with Shanks & Pottenger.
    -Rule	Para	1997	only	-	Feb	lastSun	0:00	0	-
    -# Shanks & Pottenger say 1999-02-28; IATA SSIM (1999-02) says 1999-02-27, but
    -# (1999-09) reports no date; go with above sources and Gerd Knops (2001-02-27).
    -Rule	Para	1998	2001	-	Mar	Sun>=1	0:00	0	-
    -# From Rives McDow (2002-02-28):
    -# A decree was issued in Paraguay (No. 16350) on 2002-02-26 that changed the
    -# dst method to be from the first Sunday in September to the first Sunday in
    -# April.
    -Rule	Para	2002	2004	-	Apr	Sun>=1	0:00	0	-
    -Rule	Para	2002	2003	-	Sep	Sun>=1	0:00	1:00	S
    -#
    -# From Jesper Nørgaard Welen (2005-01-02):
    -# There are several sources that claim that Paraguay made
    -# a timezone rule change in autumn 2004.
    -# From Steffen Thorsen (2005-01-05):
    -# Decree 1,867 (2004-03-05)
    -# From Carlos Raúl Perasso via Jesper Nørgaard Welen (2006-10-13)
    -# http://www.presidencia.gov.py/decretos/D1867.pdf
    -Rule	Para	2004	2009	-	Oct	Sun>=15	0:00	1:00	S
    -Rule	Para	2005	2009	-	Mar	Sun>=8	0:00	0	-
    -# From Carlos Raúl Perasso (2010-02-18):
    -# By decree number 3958 issued yesterday
    -# http://www.presidencia.gov.py/v1/wp-content/uploads/2010/02/decreto3958.pdf
    -# Paraguay changes its DST schedule, postponing the March rule to April and
    -# modifying the October date. The decree reads:
    -# ...
    -# Art. 1. It is hereby established that from the second Sunday of the month of
    -# April of this year (2010), the official time is to be set back 60 minutes,
    -# and that on the first Sunday of the month of October, it is to be set
    -# forward 60 minutes, in all the territory of the Paraguayan Republic.
    -# ...
    -Rule	Para	2010	max	-	Oct	Sun>=1	0:00	1:00	S
    -Rule	Para	2010	2012	-	Apr	Sun>=8	0:00	0	-
    -#
    -# From Steffen Thorsen (2013-03-07):
    -# Paraguay will end DST on 2013-03-24 00:00....
    -# http://www.ande.gov.py/interna.php?id=1075
    -#
    -# From Carlos Raúl Perasso (2013-03-15):
    -# The change in Paraguay is now final.  Decree number 10780
    -# http://www.presidencia.gov.py/uploads/pdf/presidencia-3b86ff4b691c79d4f5927ca964922ec74772ce857c02ca054a52a37b49afc7fb.pdf
    -# From Carlos Raúl Perasso (2014-02-28):
    -# Decree 1264 can be found at:
    -# http://www.presidencia.gov.py/archivos/documentos/DECRETO1264_ey9r8zai.pdf
    -Rule	Para	2013	max	-	Mar	Sun>=22	0:00	0	-
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Asuncion	-3:50:40 -	LMT	1890
    -			-3:50:40 -	AMT	1931 Oct 10 # Asunción Mean Time
    -			-4:00	-	PYT	1972 Oct    # Paraguay Time
    -			-3:00	-	PYT	1974 Apr
    -			-4:00	Para	PY%sT
    -
    -# Peru
    -#
    -# From Evelyn C. Leeper via Mark Brader (2003-10-26)
    -# :
    -# When we were in Peru in 1985-1986, they apparently switched over
    -# sometime between December 29 and January 3 while we were on the Amazon.
    -#
    -# From Paul Eggert (2006-03-22):
    -# Shanks & Pottenger don't have this transition.  Assume 1986 was like 1987.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	Peru	1938	only	-	Jan	 1	0:00	1:00	S
    -Rule	Peru	1938	only	-	Apr	 1	0:00	0	-
    -Rule	Peru	1938	1939	-	Sep	lastSun	0:00	1:00	S
    -Rule	Peru	1939	1940	-	Mar	Sun>=24	0:00	0	-
    -Rule	Peru	1986	1987	-	Jan	 1	0:00	1:00	S
    -Rule	Peru	1986	1987	-	Apr	 1	0:00	0	-
    -Rule	Peru	1990	only	-	Jan	 1	0:00	1:00	S
    -Rule	Peru	1990	only	-	Apr	 1	0:00	0	-
    -# IATA is ambiguous for 1993/1995; go with Shanks & Pottenger.
    -Rule	Peru	1994	only	-	Jan	 1	0:00	1:00	S
    -Rule	Peru	1994	only	-	Apr	 1	0:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Lima	-5:08:12 -	LMT	1890
    -			-5:08:36 -	LMT	1908 Jul 28 # Lima Mean Time?
    -			-5:00	Peru	PE%sT	# Peru Time
    -
    -# South Georgia
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone Atlantic/South_Georgia -2:26:08 -	LMT	1890 # Grytviken
    -			-2:00	-	GST	# South Georgia Time
    -
    -# South Sandwich Is
    -# uninhabited; scientific personnel have wintered
    -
    -# Suriname
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Paramaribo	-3:40:40 -	LMT	1911
    -			-3:40:52 -	PMT	1935     # Paramaribo Mean Time
    -			-3:40:36 -	PMT	1945 Oct    # The capital moved?
    -			-3:30	-	NEGT	1975 Nov 20 # Dutch Guiana Time
    -			-3:30	-	SRT	1984 Oct    # Suriname Time
    -			-3:00	-	SRT
    -
    -# Trinidad and Tobago
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Port_of_Spain -4:06:04 -	LMT	1912 Mar 2
    -			-4:00	-	AST
    -
    -# These all agree with Trinidad and Tobago since 1970.
    -Link America/Port_of_Spain America/Anguilla
    -Link America/Port_of_Spain America/Antigua
    -Link America/Port_of_Spain America/Dominica
    -Link America/Port_of_Spain America/Grenada
    -Link America/Port_of_Spain America/Guadeloupe
    -Link America/Port_of_Spain America/Marigot	# St Martin (French part)
    -Link America/Port_of_Spain America/Montserrat
    -Link America/Port_of_Spain America/St_Barthelemy # St Barthélemy
    -Link America/Port_of_Spain America/St_Kitts	# St Kitts & Nevis
    -Link America/Port_of_Spain America/St_Lucia
    -Link America/Port_of_Spain America/St_Thomas	# Virgin Islands (US)
    -Link America/Port_of_Spain America/St_Vincent
    -Link America/Port_of_Spain America/Tortola	# Virgin Islands (UK)
    -
    -# Uruguay
    -# From Paul Eggert (1993-11-18):
    -# Uruguay wins the prize for the strangest peacetime manipulation of the rules.
    -# From Shanks & Pottenger:
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -# Whitman gives 1923 Oct 1; go with Shanks & Pottenger.
    -Rule	Uruguay	1923	only	-	Oct	 2	 0:00	0:30	HS
    -Rule	Uruguay	1924	1926	-	Apr	 1	 0:00	0	-
    -Rule	Uruguay	1924	1925	-	Oct	 1	 0:00	0:30	HS
    -Rule	Uruguay	1933	1935	-	Oct	lastSun	 0:00	0:30	HS
    -# Shanks & Pottenger give 1935 Apr 1 0:00 & 1936 Mar 30 0:00; go with Whitman.
    -Rule	Uruguay	1934	1936	-	Mar	Sat>=25	23:30s	0	-
    -Rule	Uruguay	1936	only	-	Nov	 1	 0:00	0:30	HS
    -Rule	Uruguay	1937	1941	-	Mar	lastSun	 0:00	0	-
    -# Whitman gives 1937 Oct 3; go with Shanks & Pottenger.
    -Rule	Uruguay	1937	1940	-	Oct	lastSun	 0:00	0:30	HS
    -# Whitman gives 1941 Oct 24 - 1942 Mar 27, 1942 Dec 14 - 1943 Apr 13,
    -# and 1943 Apr 13 "to present time"; go with Shanks & Pottenger.
    -Rule	Uruguay	1941	only	-	Aug	 1	 0:00	0:30	HS
    -Rule	Uruguay	1942	only	-	Jan	 1	 0:00	0	-
    -Rule	Uruguay	1942	only	-	Dec	14	 0:00	1:00	S
    -Rule	Uruguay	1943	only	-	Mar	14	 0:00	0	-
    -Rule	Uruguay	1959	only	-	May	24	 0:00	1:00	S
    -Rule	Uruguay	1959	only	-	Nov	15	 0:00	0	-
    -Rule	Uruguay	1960	only	-	Jan	17	 0:00	1:00	S
    -Rule	Uruguay	1960	only	-	Mar	 6	 0:00	0	-
    -Rule	Uruguay	1965	1967	-	Apr	Sun>=1	 0:00	1:00	S
    -Rule	Uruguay	1965	only	-	Sep	26	 0:00	0	-
    -Rule	Uruguay	1966	1967	-	Oct	31	 0:00	0	-
    -Rule	Uruguay	1968	1970	-	May	27	 0:00	0:30	HS
    -Rule	Uruguay	1968	1970	-	Dec	 2	 0:00	0	-
    -Rule	Uruguay	1972	only	-	Apr	24	 0:00	1:00	S
    -Rule	Uruguay	1972	only	-	Aug	15	 0:00	0	-
    -Rule	Uruguay	1974	only	-	Mar	10	 0:00	0:30	HS
    -Rule	Uruguay	1974	only	-	Dec	22	 0:00	1:00	S
    -Rule	Uruguay	1976	only	-	Oct	 1	 0:00	0	-
    -Rule	Uruguay	1977	only	-	Dec	 4	 0:00	1:00	S
    -Rule	Uruguay	1978	only	-	Apr	 1	 0:00	0	-
    -Rule	Uruguay	1979	only	-	Oct	 1	 0:00	1:00	S
    -Rule	Uruguay	1980	only	-	May	 1	 0:00	0	-
    -Rule	Uruguay	1987	only	-	Dec	14	 0:00	1:00	S
    -Rule	Uruguay	1988	only	-	Mar	14	 0:00	0	-
    -Rule	Uruguay	1988	only	-	Dec	11	 0:00	1:00	S
    -Rule	Uruguay	1989	only	-	Mar	12	 0:00	0	-
    -Rule	Uruguay	1989	only	-	Oct	29	 0:00	1:00	S
    -# Shanks & Pottenger say no DST was observed in 1990/1 and 1991/2,
    -# and that 1992/3's DST was from 10-25 to 03-01.  Go with IATA.
    -Rule	Uruguay	1990	1992	-	Mar	Sun>=1	 0:00	0	-
    -Rule	Uruguay	1990	1991	-	Oct	Sun>=21	 0:00	1:00	S
    -Rule	Uruguay	1992	only	-	Oct	18	 0:00	1:00	S
    -Rule	Uruguay	1993	only	-	Feb	28	 0:00	0	-
    -# From Eduardo Cota (2004-09-20):
    -# The Uruguayan government has decreed a change in the local time....
    -# http://www.presidencia.gub.uy/decretos/2004091502.htm
    -Rule	Uruguay	2004	only	-	Sep	19	 0:00	1:00	S
    -# From Steffen Thorsen (2005-03-11):
    -# Uruguay's DST was scheduled to end on Sunday, 2005-03-13, but in order to
    -# save energy ... it was postponed two weeks....
    -# http://www.presidencia.gub.uy/_Web/noticias/2005/03/2005031005.htm
    -Rule	Uruguay	2005	only	-	Mar	27	 2:00	0	-
    -# From Eduardo Cota (2005-09-27):
    -# http://www.presidencia.gub.uy/_Web/decretos/2005/09/CM%20119_09%2009%202005_00001.PDF
    -# This means that from 2005-10-09 at 02:00 local time, until 2006-03-12 at
    -# 02:00 local time, official time in Uruguay will be at GMT -2.
    -Rule	Uruguay	2005	only	-	Oct	 9	 2:00	1:00	S
    -Rule	Uruguay	2006	only	-	Mar	12	 2:00	0	-
    -# From Jesper Nørgaard Welen (2006-09-06):
    -# http://www.presidencia.gub.uy/_web/decretos/2006/09/CM%20210_08%2006%202006_00001.PDF
    -#
    -# From Steffen Thorsen (2015-06-30):
    -# ... it looks like they will not be using DST the coming summer:
    -# http://www.elobservador.com.uy/gobierno-resolvio-que-no-habra-cambio-horario-verano-n656787
    -# http://www.republica.com.uy/este-ano-no-se-modificara-el-huso-horario-en-uruguay/523760/
    -# From Paul Eggert (2015-06-30):
    -# Apparently restaurateurs complained that DST caused people to go to the beach
    -# instead of out to dinner.
    -# From Pablo Camargo (2015-07-13):
    -# http://archivo.presidencia.gub.uy/sci/decretos/2015/06/cons_min_201.pdf
    -# [dated 2015-06-29; repeals Decree 311/006 dated 2006-09-04]
    -Rule	Uruguay	2006	2014	-	Oct	Sun>=1	 2:00	1:00	S
    -Rule	Uruguay	2007	2015	-	Mar	Sun>=8	 2:00	0	-
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone America/Montevideo	-3:44:44 -	LMT	1898 Jun 28
    -			-3:44:44 -	MMT	1920 May  1 # Montevideo MT
    -			-3:30	Uruguay	UY%sT	1942 Dec 14 # Uruguay Time
    -			-3:00	Uruguay	UY%sT
    -
    -# Venezuela
    -#
    -# From Paul Eggert (2015-07-28):
    -# For the 1965 transition see Gaceta Oficial No. 27.619 (1964-12-15), p 205.533
    -# http://www.pgr.gob.ve/dmdocuments/1964/27619.pdf
    -#
    -# From John Stainforth (2007-11-28):
    -# ... the change for Venezuela originally expected for 2007-12-31 has
    -# been brought forward to 2007-12-09.  The official announcement was
    -# published today in the "Gaceta Oficial de la República Bolivariana
    -# de Venezuela, número 38.819" (official document for all laws or
    -# resolution publication)
    -# http://www.globovision.com/news.php?nid=72208
    -
    -# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
    -Zone	America/Caracas	-4:27:44 -	LMT	1890
    -			-4:27:40 -	CMT	1912 Feb 12 # Caracas Mean Time?
    -			-4:30	-	VET	1965 Jan  1  0:00 # Venezuela T.
    -			-4:00	-	VET	2007 Dec  9  3:00
    -			-4:30	-	VET
    diff --git a/external/public-domain/tz/dist/systemv b/external/public-domain/tz/dist/systemv
    deleted file mode 100644
    index d9e299575..000000000
    --- a/external/public-domain/tz/dist/systemv
    +++ /dev/null
    @@ -1,37 +0,0 @@
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -
    -# Old rules, should the need arise.
    -# No attempt is made to handle Newfoundland, since it cannot be expressed
    -# using the System V "TZ" scheme (half-hour offset), or anything outside
    -# North America (no support for non-standard DST start/end dates), nor
    -# the changes in the DST rules in the US after 1976 (which occurred after
    -# the old rules were written).
    -#
    -# If you need the old rules, uncomment ## lines.
    -# Compile this *without* leap second correction for true conformance.
    -
    -# Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
    -Rule	SystemV	min	1973	-	Apr	lastSun	2:00	1:00	D
    -Rule	SystemV	min	1973	-	Oct	lastSun	2:00	0	S
    -Rule	SystemV	1974	only	-	Jan	6	2:00	1:00	D
    -Rule	SystemV	1974	only	-	Nov	lastSun	2:00	0	S
    -Rule	SystemV	1975	only	-	Feb	23	2:00	1:00	D
    -Rule	SystemV	1975	only	-	Oct	lastSun	2:00	0	S
    -Rule	SystemV	1976	max	-	Apr	lastSun	2:00	1:00	D
    -Rule	SystemV	1976	max	-	Oct	lastSun	2:00	0	S
    -
    -# Zone	NAME		GMTOFF	RULES/SAVE	FORMAT	[UNTIL]
    -## Zone	SystemV/AST4ADT	-4:00	SystemV		A%sT
    -## Zone	SystemV/EST5EDT	-5:00	SystemV		E%sT
    -## Zone	SystemV/CST6CDT	-6:00	SystemV		C%sT
    -## Zone	SystemV/MST7MDT	-7:00	SystemV		M%sT
    -## Zone	SystemV/PST8PDT	-8:00	SystemV		P%sT
    -## Zone	SystemV/YST9YDT	-9:00	SystemV		Y%sT
    -## Zone	SystemV/AST4	-4:00	-		AST
    -## Zone	SystemV/EST5	-5:00	-		EST
    -## Zone	SystemV/CST6	-6:00	-		CST
    -## Zone	SystemV/MST7	-7:00	-		MST
    -## Zone	SystemV/PST8	-8:00	-		PST
    -## Zone	SystemV/YST9	-9:00	-		YST
    -## Zone	SystemV/HST10	-10:00	-		HST
    diff --git a/external/public-domain/tz/dist/yearistype.sh b/external/public-domain/tz/dist/yearistype.sh
    deleted file mode 100644
    index dfdcdf0e2..000000000
    --- a/external/public-domain/tz/dist/yearistype.sh
    +++ /dev/null
    @@ -1,38 +0,0 @@
    -#! /bin/sh
    -
    -: 'This file is in the public domain, so clarified as of'
    -: '2006-07-17 by Arthur David Olson.'
    -
    -case $#-$1 in
    -	2-|2-0*|2-*[!0-9]*)
    -		echo "$0: wild year: $1" >&2
    -		exit 1 ;;
    -esac
    -
    -case $#-$2 in
    -	2-even)
    -		case $1 in
    -			*[24680])			exit 0 ;;
    -			*)				exit 1 ;;
    -		esac ;;
    -	2-nonpres|2-nonuspres)
    -		case $1 in
    -			*[02468][048]|*[13579][26])	exit 1 ;;
    -			*)				exit 0 ;;
    -		esac ;;
    -	2-odd)
    -		case $1 in
    -			*[13579])			exit 0 ;;
    -			*)				exit 1 ;;
    -		esac ;;
    -	2-uspres)
    -		case $1 in
    -			*[02468][048]|*[13579][26])	exit 0 ;;
    -			*)				exit 1 ;;
    -		esac ;;
    -	2-*)
    -		echo "$0: wild type: $2" >&2 ;;
    -esac
    -
    -echo "$0: usage is $0 year even|odd|uspres|nonpres|nonuspres" >&2
    -exit 1
    diff --git a/external/public-domain/tz/dist/zone.tab b/external/public-domain/tz/dist/zone.tab
    deleted file mode 100644
    index 381f24521..000000000
    --- a/external/public-domain/tz/dist/zone.tab
    +++ /dev/null
    @@ -1,440 +0,0 @@
    -# tz zone descriptions (deprecated version)
    -#
    -# This file is in the public domain, so clarified as of
    -# 2009-05-17 by Arthur David Olson.
    -#
    -# From Paul Eggert (2014-07-31):
    -# This file is intended as a backward-compatibility aid for older programs.
    -# New programs should use zone1970.tab.  This file is like zone1970.tab (see
    -# zone1970.tab's comments), but with the following additional restrictions:
    -#
    -# 1.  This file contains only ASCII characters.
    -# 2.  The first data column contains exactly one country code.
    -#
    -# Because of (2), each row stands for an area that is the intersection
    -# of a region identified by a country code and of a zone where civil
    -# clocks have agreed since 1970; this is a narrower definition than
    -# that of zone1970.tab.
    -#
    -# This table is intended as an aid for users, to help them select time
    -# zone data entries appropriate for their practical needs.  It is not
    -# intended to take or endorse any position on legal or territorial claims.
    -#
    -#country-
    -#code	coordinates	TZ			comments
    -AD	+4230+00131	Europe/Andorra
    -AE	+2518+05518	Asia/Dubai
    -AF	+3431+06912	Asia/Kabul
    -AG	+1703-06148	America/Antigua
    -AI	+1812-06304	America/Anguilla
    -AL	+4120+01950	Europe/Tirane
    -AM	+4011+04430	Asia/Yerevan
    -AO	-0848+01314	Africa/Luanda
    -AQ	-7750+16636	Antarctica/McMurdo	McMurdo, South Pole, Scott (New Zealand time)
    -AQ	-6734-06808	Antarctica/Rothera	Rothera Station, Adelaide Island
    -AQ	-6448-06406	Antarctica/Palmer	Palmer Station, Anvers Island
    -AQ	-6736+06253	Antarctica/Mawson	Mawson Station, Holme Bay
    -AQ	-6835+07758	Antarctica/Davis	Davis Station, Vestfold Hills
    -AQ	-6617+11031	Antarctica/Casey	Casey Station, Bailey Peninsula
    -AQ	-7824+10654	Antarctica/Vostok	Vostok Station, Lake Vostok
    -AQ	-6640+14001	Antarctica/DumontDUrville	Dumont-d'Urville Station, Adelie Land
    -AQ	-690022+0393524	Antarctica/Syowa	Syowa Station, E Ongul I
    -AQ	-720041+0023206	Antarctica/Troll	Troll Station, Queen Maud Land
    -AR	-3436-05827	America/Argentina/Buenos_Aires	Buenos Aires (BA, CF)
    -AR	-3124-06411	America/Argentina/Cordoba	most locations (CB, CC, CN, ER, FM, MN, SE, SF)
    -AR	-2447-06525	America/Argentina/Salta	(SA, LP, NQ, RN)
    -AR	-2411-06518	America/Argentina/Jujuy	Jujuy (JY)
    -AR	-2649-06513	America/Argentina/Tucuman	Tucuman (TM)
    -AR	-2828-06547	America/Argentina/Catamarca	Catamarca (CT), Chubut (CH)
    -AR	-2926-06651	America/Argentina/La_Rioja	La Rioja (LR)
    -AR	-3132-06831	America/Argentina/San_Juan	San Juan (SJ)
    -AR	-3253-06849	America/Argentina/Mendoza	Mendoza (MZ)
    -AR	-3319-06621	America/Argentina/San_Luis	San Luis (SL)
    -AR	-5138-06913	America/Argentina/Rio_Gallegos	Santa Cruz (SC)
    -AR	-5448-06818	America/Argentina/Ushuaia	Tierra del Fuego (TF)
    -AS	-1416-17042	Pacific/Pago_Pago
    -AT	+4813+01620	Europe/Vienna
    -AU	-3133+15905	Australia/Lord_Howe	Lord Howe Island
    -AU	-5430+15857	Antarctica/Macquarie	Macquarie Island
    -AU	-4253+14719	Australia/Hobart	Tasmania - most locations
    -AU	-3956+14352	Australia/Currie	Tasmania - King Island
    -AU	-3749+14458	Australia/Melbourne	Victoria
    -AU	-3352+15113	Australia/Sydney	New South Wales - most locations
    -AU	-3157+14127	Australia/Broken_Hill	New South Wales - Yancowinna
    -AU	-2728+15302	Australia/Brisbane	Queensland - most locations
    -AU	-2016+14900	Australia/Lindeman	Queensland - Holiday Islands
    -AU	-3455+13835	Australia/Adelaide	South Australia
    -AU	-1228+13050	Australia/Darwin	Northern Territory
    -AU	-3157+11551	Australia/Perth	Western Australia - most locations
    -AU	-3143+12852	Australia/Eucla	Western Australia - Eucla area
    -AW	+1230-06958	America/Aruba
    -AX	+6006+01957	Europe/Mariehamn
    -AZ	+4023+04951	Asia/Baku
    -BA	+4352+01825	Europe/Sarajevo
    -BB	+1306-05937	America/Barbados
    -BD	+2343+09025	Asia/Dhaka
    -BE	+5050+00420	Europe/Brussels
    -BF	+1222-00131	Africa/Ouagadougou
    -BG	+4241+02319	Europe/Sofia
    -BH	+2623+05035	Asia/Bahrain
    -BI	-0323+02922	Africa/Bujumbura
    -BJ	+0629+00237	Africa/Porto-Novo
    -BL	+1753-06251	America/St_Barthelemy
    -BM	+3217-06446	Atlantic/Bermuda
    -BN	+0456+11455	Asia/Brunei
    -BO	-1630-06809	America/La_Paz
    -BQ	+120903-0681636	America/Kralendijk
    -BR	-0351-03225	America/Noronha	Atlantic islands
    -BR	-0127-04829	America/Belem	Amapa, E Para
    -BR	-0343-03830	America/Fortaleza	NE Brazil (MA, PI, CE, RN, PB)
    -BR	-0803-03454	America/Recife	Pernambuco
    -BR	-0712-04812	America/Araguaina	Tocantins
    -BR	-0940-03543	America/Maceio	Alagoas, Sergipe
    -BR	-1259-03831	America/Bahia	Bahia
    -BR	-2332-04637	America/Sao_Paulo	S & SE Brazil (GO, DF, MG, ES, RJ, SP, PR, SC, RS)
    -BR	-2027-05437	America/Campo_Grande	Mato Grosso do Sul
    -BR	-1535-05605	America/Cuiaba	Mato Grosso
    -BR	-0226-05452	America/Santarem	W Para
    -BR	-0846-06354	America/Porto_Velho	Rondonia
    -BR	+0249-06040	America/Boa_Vista	Roraima
    -BR	-0308-06001	America/Manaus	E Amazonas
    -BR	-0640-06952	America/Eirunepe	W Amazonas
    -BR	-0958-06748	America/Rio_Branco	Acre
    -BS	+2505-07721	America/Nassau
    -BT	+2728+08939	Asia/Thimphu
    -BW	-2439+02555	Africa/Gaborone
    -BY	+5354+02734	Europe/Minsk
    -BZ	+1730-08812	America/Belize
    -CA	+4734-05243	America/St_Johns	Newfoundland Time, including SE Labrador
    -CA	+4439-06336	America/Halifax	Atlantic Time - Nova Scotia (peninsula), PEI
    -CA	+4612-05957	America/Glace_Bay	Atlantic Time - Nova Scotia (Cape Breton)
    -CA	+4606-06447	America/Moncton	Atlantic Time - New Brunswick
    -CA	+5320-06025	America/Goose_Bay	Atlantic Time - Labrador - most locations
    -CA	+5125-05707	America/Blanc-Sablon	Atlantic Standard Time - Quebec - Lower North Shore
    -CA	+4339-07923	America/Toronto	Eastern Time - Ontario & Quebec - most locations
    -CA	+4901-08816	America/Nipigon	Eastern Time - Ontario & Quebec - places that did not observe DST 1967-1973
    -CA	+4823-08915	America/Thunder_Bay	Eastern Time - Thunder Bay, Ontario
    -CA	+6344-06828	America/Iqaluit	Eastern Time - east Nunavut - most locations
    -CA	+6608-06544	America/Pangnirtung	Eastern Time - Pangnirtung, Nunavut
    -CA	+744144-0944945	America/Resolute	Central Time - Resolute, Nunavut
    -CA	+484531-0913718	America/Atikokan	Eastern Standard Time - Atikokan, Ontario and Southampton I, Nunavut
    -CA	+624900-0920459	America/Rankin_Inlet	Central Time - central Nunavut
    -CA	+4953-09709	America/Winnipeg	Central Time - Manitoba & west Ontario
    -CA	+4843-09434	America/Rainy_River	Central Time - Rainy River & Fort Frances, Ontario
    -CA	+5024-10439	America/Regina	Central Standard Time - Saskatchewan - most locations
    -CA	+5017-10750	America/Swift_Current	Central Standard Time - Saskatchewan - midwest
    -CA	+5333-11328	America/Edmonton	Mountain Time - Alberta, east British Columbia & west Saskatchewan
    -CA	+690650-1050310	America/Cambridge_Bay	Mountain Time - west Nunavut
    -CA	+6227-11421	America/Yellowknife	Mountain Time - central Northwest Territories
    -CA	+682059-1334300	America/Inuvik	Mountain Time - west Northwest Territories
    -CA	+4906-11631	America/Creston	Mountain Standard Time - Creston, British Columbia
    -CA	+5946-12014	America/Dawson_Creek	Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
    -CA	+4916-12307	America/Vancouver	Pacific Time - west British Columbia
    -CA	+6043-13503	America/Whitehorse	Pacific Time - south Yukon
    -CA	+6404-13925	America/Dawson	Pacific Time - north Yukon
    -CC	-1210+09655	Indian/Cocos
    -CD	-0418+01518	Africa/Kinshasa	west Dem. Rep. of Congo
    -CD	-1140+02728	Africa/Lubumbashi	east Dem. Rep. of Congo
    -CF	+0422+01835	Africa/Bangui
    -CG	-0416+01517	Africa/Brazzaville
    -CH	+4723+00832	Europe/Zurich
    -CI	+0519-00402	Africa/Abidjan
    -CK	-2114-15946	Pacific/Rarotonga
    -CL	-3327-07040	America/Santiago	most locations
    -CL	-2709-10926	Pacific/Easter	Easter Island
    -CM	+0403+00942	Africa/Douala
    -CN	+3114+12128	Asia/Shanghai	Beijing Time
    -CN	+4348+08735	Asia/Urumqi	Xinjiang Time
    -CO	+0436-07405	America/Bogota
    -CR	+0956-08405	America/Costa_Rica
    -CU	+2308-08222	America/Havana
    -CV	+1455-02331	Atlantic/Cape_Verde
    -CW	+1211-06900	America/Curacao
    -CX	-1025+10543	Indian/Christmas
    -CY	+3510+03322	Asia/Nicosia
    -CZ	+5005+01426	Europe/Prague
    -DE	+5230+01322	Europe/Berlin	most locations
    -DE	+4742+00841	Europe/Busingen	Busingen
    -DJ	+1136+04309	Africa/Djibouti
    -DK	+5540+01235	Europe/Copenhagen
    -DM	+1518-06124	America/Dominica
    -DO	+1828-06954	America/Santo_Domingo
    -DZ	+3647+00303	Africa/Algiers
    -EC	-0210-07950	America/Guayaquil	mainland
    -EC	-0054-08936	Pacific/Galapagos	Galapagos Islands
    -EE	+5925+02445	Europe/Tallinn
    -EG	+3003+03115	Africa/Cairo
    -EH	+2709-01312	Africa/El_Aaiun
    -ER	+1520+03853	Africa/Asmara
    -ES	+4024-00341	Europe/Madrid	mainland
    -ES	+3553-00519	Africa/Ceuta	Ceuta & Melilla
    -ES	+2806-01524	Atlantic/Canary	Canary Islands
    -ET	+0902+03842	Africa/Addis_Ababa
    -FI	+6010+02458	Europe/Helsinki
    -FJ	-1808+17825	Pacific/Fiji
    -FK	-5142-05751	Atlantic/Stanley
    -FM	+0725+15147	Pacific/Chuuk	Chuuk (Truk) and Yap
    -FM	+0658+15813	Pacific/Pohnpei	Pohnpei (Ponape)
    -FM	+0519+16259	Pacific/Kosrae	Kosrae
    -FO	+6201-00646	Atlantic/Faroe
    -FR	+4852+00220	Europe/Paris
    -GA	+0023+00927	Africa/Libreville
    -GB	+513030-0000731	Europe/London
    -GD	+1203-06145	America/Grenada
    -GE	+4143+04449	Asia/Tbilisi
    -GF	+0456-05220	America/Cayenne
    -GG	+4927-00232	Europe/Guernsey
    -GH	+0533-00013	Africa/Accra
    -GI	+3608-00521	Europe/Gibraltar
    -GL	+6411-05144	America/Godthab	most locations
    -GL	+7646-01840	America/Danmarkshavn	east coast, north of Scoresbysund
    -GL	+7029-02158	America/Scoresbysund	Scoresbysund / Ittoqqortoormiit
    -GL	+7634-06847	America/Thule	Thule / Pituffik
    -GM	+1328-01639	Africa/Banjul
    -GN	+0931-01343	Africa/Conakry
    -GP	+1614-06132	America/Guadeloupe
    -GQ	+0345+00847	Africa/Malabo
    -GR	+3758+02343	Europe/Athens
    -GS	-5416-03632	Atlantic/South_Georgia
    -GT	+1438-09031	America/Guatemala
    -GU	+1328+14445	Pacific/Guam
    -GW	+1151-01535	Africa/Bissau
    -GY	+0648-05810	America/Guyana
    -HK	+2217+11409	Asia/Hong_Kong
    -HN	+1406-08713	America/Tegucigalpa
    -HR	+4548+01558	Europe/Zagreb
    -HT	+1832-07220	America/Port-au-Prince
    -HU	+4730+01905	Europe/Budapest
    -ID	-0610+10648	Asia/Jakarta	Java & Sumatra
    -ID	-0002+10920	Asia/Pontianak	west & central Borneo
    -ID	-0507+11924	Asia/Makassar	east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
    -ID	-0232+14042	Asia/Jayapura	west New Guinea (Irian Jaya) & Malukus (Moluccas)
    -IE	+5320-00615	Europe/Dublin
    -IL	+314650+0351326	Asia/Jerusalem
    -IM	+5409-00428	Europe/Isle_of_Man
    -IN	+2232+08822	Asia/Kolkata
    -IO	-0720+07225	Indian/Chagos
    -IQ	+3321+04425	Asia/Baghdad
    -IR	+3540+05126	Asia/Tehran
    -IS	+6409-02151	Atlantic/Reykjavik
    -IT	+4154+01229	Europe/Rome
    -JE	+4912-00207	Europe/Jersey
    -JM	+175805-0764736	America/Jamaica
    -JO	+3157+03556	Asia/Amman
    -JP	+353916+1394441	Asia/Tokyo
    -KE	-0117+03649	Africa/Nairobi
    -KG	+4254+07436	Asia/Bishkek
    -KH	+1133+10455	Asia/Phnom_Penh
    -KI	+0125+17300	Pacific/Tarawa	Gilbert Islands
    -KI	-0308-17105	Pacific/Enderbury	Phoenix Islands
    -KI	+0152-15720	Pacific/Kiritimati	Line Islands
    -KM	-1141+04316	Indian/Comoro
    -KN	+1718-06243	America/St_Kitts
    -KP	+3901+12545	Asia/Pyongyang
    -KR	+3733+12658	Asia/Seoul
    -KW	+2920+04759	Asia/Kuwait
    -KY	+1918-08123	America/Cayman
    -KZ	+4315+07657	Asia/Almaty	most locations
    -KZ	+4448+06528	Asia/Qyzylorda	Qyzylorda (Kyzylorda, Kzyl-Orda)
    -KZ	+5017+05710	Asia/Aqtobe	Aqtobe (Aktobe)
    -KZ	+4431+05016	Asia/Aqtau	Atyrau (Atirau, Gur'yev), Mangghystau (Mankistau)
    -KZ	+5113+05121	Asia/Oral	West Kazakhstan
    -LA	+1758+10236	Asia/Vientiane
    -LB	+3353+03530	Asia/Beirut
    -LC	+1401-06100	America/St_Lucia
    -LI	+4709+00931	Europe/Vaduz
    -LK	+0656+07951	Asia/Colombo
    -LR	+0618-01047	Africa/Monrovia
    -LS	-2928+02730	Africa/Maseru
    -LT	+5441+02519	Europe/Vilnius
    -LU	+4936+00609	Europe/Luxembourg
    -LV	+5657+02406	Europe/Riga
    -LY	+3254+01311	Africa/Tripoli
    -MA	+3339-00735	Africa/Casablanca
    -MC	+4342+00723	Europe/Monaco
    -MD	+4700+02850	Europe/Chisinau
    -ME	+4226+01916	Europe/Podgorica
    -MF	+1804-06305	America/Marigot
    -MG	-1855+04731	Indian/Antananarivo
    -MH	+0709+17112	Pacific/Majuro	most locations
    -MH	+0905+16720	Pacific/Kwajalein	Kwajalein
    -MK	+4159+02126	Europe/Skopje
    -ML	+1239-00800	Africa/Bamako
    -MM	+1647+09610	Asia/Rangoon
    -MN	+4755+10653	Asia/Ulaanbaatar	most locations
    -MN	+4801+09139	Asia/Hovd	Bayan-Olgiy, Govi-Altai, Hovd, Uvs, Zavkhan
    -MN	+4804+11430	Asia/Choibalsan	Dornod, Sukhbaatar
    -MO	+2214+11335	Asia/Macau
    -MP	+1512+14545	Pacific/Saipan
    -MQ	+1436-06105	America/Martinique
    -MR	+1806-01557	Africa/Nouakchott
    -MS	+1643-06213	America/Montserrat
    -MT	+3554+01431	Europe/Malta
    -MU	-2010+05730	Indian/Mauritius
    -MV	+0410+07330	Indian/Maldives
    -MW	-1547+03500	Africa/Blantyre
    -MX	+1924-09909	America/Mexico_City	Central Time - most locations
    -MX	+2105-08646	America/Cancun	Eastern Standard Time - Quintana Roo
    -MX	+2058-08937	America/Merida	Central Time - Campeche, Yucatan
    -MX	+2540-10019	America/Monterrey	Mexican Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas away from US border
    -MX	+2550-09730	America/Matamoros	US Central Time - Coahuila, Durango, Nuevo Leon, Tamaulipas near US border
    -MX	+2313-10625	America/Mazatlan	Mountain Time - S Baja, Nayarit, Sinaloa
    -MX	+2838-10605	America/Chihuahua	Mexican Mountain Time - Chihuahua away from US border
    -MX	+2934-10425	America/Ojinaga	US Mountain Time - Chihuahua near US border
    -MX	+2904-11058	America/Hermosillo	Mountain Standard Time - Sonora
    -MX	+3232-11701	America/Tijuana	US Pacific Time - Baja California near US border
    -MX	+3018-11452	America/Santa_Isabel	Mexican Pacific Time - Baja California away from US border
    -MX	+2048-10515	America/Bahia_Banderas	Mexican Central Time - Bahia de Banderas
    -MY	+0310+10142	Asia/Kuala_Lumpur	peninsular Malaysia
    -MY	+0133+11020	Asia/Kuching	Sabah & Sarawak
    -MZ	-2558+03235	Africa/Maputo
    -NA	-2234+01706	Africa/Windhoek
    -NC	-2216+16627	Pacific/Noumea
    -NE	+1331+00207	Africa/Niamey
    -NF	-2903+16758	Pacific/Norfolk
    -NG	+0627+00324	Africa/Lagos
    -NI	+1209-08617	America/Managua
    -NL	+5222+00454	Europe/Amsterdam
    -NO	+5955+01045	Europe/Oslo
    -NP	+2743+08519	Asia/Kathmandu
    -NR	-0031+16655	Pacific/Nauru
    -NU	-1901-16955	Pacific/Niue
    -NZ	-3652+17446	Pacific/Auckland	most locations
    -NZ	-4357-17633	Pacific/Chatham	Chatham Islands
    -OM	+2336+05835	Asia/Muscat
    -PA	+0858-07932	America/Panama
    -PE	-1203-07703	America/Lima
    -PF	-1732-14934	Pacific/Tahiti	Society Islands
    -PF	-0900-13930	Pacific/Marquesas	Marquesas Islands
    -PF	-2308-13457	Pacific/Gambier	Gambier Islands
    -PG	-0930+14710	Pacific/Port_Moresby	most locations
    -PG	-0613+15534	Pacific/Bougainville	Bougainville
    -PH	+1435+12100	Asia/Manila
    -PK	+2452+06703	Asia/Karachi
    -PL	+5215+02100	Europe/Warsaw
    -PM	+4703-05620	America/Miquelon
    -PN	-2504-13005	Pacific/Pitcairn
    -PR	+182806-0660622	America/Puerto_Rico
    -PS	+3130+03428	Asia/Gaza	Gaza Strip
    -PS	+313200+0350542	Asia/Hebron	West Bank
    -PT	+3843-00908	Europe/Lisbon	mainland
    -PT	+3238-01654	Atlantic/Madeira	Madeira Islands
    -PT	+3744-02540	Atlantic/Azores	Azores
    -PW	+0720+13429	Pacific/Palau
    -PY	-2516-05740	America/Asuncion
    -QA	+2517+05132	Asia/Qatar
    -RE	-2052+05528	Indian/Reunion
    -RO	+4426+02606	Europe/Bucharest
    -RS	+4450+02030	Europe/Belgrade
    -RU	+5443+02030	Europe/Kaliningrad	Moscow-01 - Kaliningrad
    -RU	+554521+0373704	Europe/Moscow	Moscow+00 - west Russia
    -RU	+4457+03406	Europe/Simferopol	Moscow+00 - Crimea
    -RU	+4844+04425	Europe/Volgograd	Moscow+00 - Caspian Sea
    -RU	+5312+05009	Europe/Samara	Moscow+00 (Moscow+01 after 2014-10-26) - Samara, Udmurtia
    -RU	+5651+06036	Asia/Yekaterinburg	Moscow+02 - Urals
    -RU	+5500+07324	Asia/Omsk	Moscow+03 - west Siberia
    -RU	+5502+08255	Asia/Novosibirsk	Moscow+03 - Novosibirsk
    -RU	+5345+08707	Asia/Novokuznetsk	Moscow+03 (Moscow+04 after 2014-10-26) - Kemerovo
    -RU	+5601+09250	Asia/Krasnoyarsk	Moscow+04 - Yenisei River
    -RU	+5216+10420	Asia/Irkutsk	Moscow+05 - Lake Baikal
    -RU	+5203+11328	Asia/Chita	Moscow+06 (Moscow+05 after 2014-10-26) - Zabaykalsky
    -RU	+6200+12940	Asia/Yakutsk	Moscow+06 - Lena River
    -RU	+623923+1353314	Asia/Khandyga	Moscow+06 - Tomponsky, Ust-Maysky
    -RU	+4310+13156	Asia/Vladivostok	Moscow+07 - Amur River
    -RU	+4658+14242	Asia/Sakhalin	Moscow+07 - Sakhalin Island
    -RU	+643337+1431336	Asia/Ust-Nera	Moscow+07 - Oymyakonsky
    -RU	+5934+15048	Asia/Magadan	Moscow+08 (Moscow+07 after 2014-10-26) - Magadan
    -RU	+6728+15343	Asia/Srednekolymsk	Moscow+08 - E Sakha, N Kuril Is
    -RU	+5301+15839	Asia/Kamchatka	Moscow+08 (Moscow+09 after 2014-10-26) - Kamchatka
    -RU	+6445+17729	Asia/Anadyr	Moscow+08 (Moscow+09 after 2014-10-26) - Bering Sea
    -RW	-0157+03004	Africa/Kigali
    -SA	+2438+04643	Asia/Riyadh
    -SB	-0932+16012	Pacific/Guadalcanal
    -SC	-0440+05528	Indian/Mahe
    -SD	+1536+03232	Africa/Khartoum
    -SE	+5920+01803	Europe/Stockholm
    -SG	+0117+10351	Asia/Singapore
    -SH	-1555-00542	Atlantic/St_Helena
    -SI	+4603+01431	Europe/Ljubljana
    -SJ	+7800+01600	Arctic/Longyearbyen
    -SK	+4809+01707	Europe/Bratislava
    -SL	+0830-01315	Africa/Freetown
    -SM	+4355+01228	Europe/San_Marino
    -SN	+1440-01726	Africa/Dakar
    -SO	+0204+04522	Africa/Mogadishu
    -SR	+0550-05510	America/Paramaribo
    -SS	+0451+03136	Africa/Juba
    -ST	+0020+00644	Africa/Sao_Tome
    -SV	+1342-08912	America/El_Salvador
    -SX	+180305-0630250	America/Lower_Princes
    -SY	+3330+03618	Asia/Damascus
    -SZ	-2618+03106	Africa/Mbabane
    -TC	+2128-07108	America/Grand_Turk
    -TD	+1207+01503	Africa/Ndjamena
    -TF	-492110+0701303	Indian/Kerguelen
    -TG	+0608+00113	Africa/Lome
    -TH	+1345+10031	Asia/Bangkok
    -TJ	+3835+06848	Asia/Dushanbe
    -TK	-0922-17114	Pacific/Fakaofo
    -TL	-0833+12535	Asia/Dili
    -TM	+3757+05823	Asia/Ashgabat
    -TN	+3648+01011	Africa/Tunis
    -TO	-2110-17510	Pacific/Tongatapu
    -TR	+4101+02858	Europe/Istanbul
    -TT	+1039-06131	America/Port_of_Spain
    -TV	-0831+17913	Pacific/Funafuti
    -TW	+2503+12130	Asia/Taipei
    -TZ	-0648+03917	Africa/Dar_es_Salaam
    -UA	+5026+03031	Europe/Kiev	most locations
    -UA	+4837+02218	Europe/Uzhgorod	Ruthenia
    -UA	+4750+03510	Europe/Zaporozhye	Zaporozh'ye, E Lugansk / Zaporizhia, E Luhansk
    -UG	+0019+03225	Africa/Kampala
    -UM	+1645-16931	Pacific/Johnston	Johnston Atoll
    -UM	+2813-17722	Pacific/Midway	Midway Islands
    -UM	+1917+16637	Pacific/Wake	Wake Island
    -US	+404251-0740023	America/New_York	Eastern Time
    -US	+421953-0830245	America/Detroit	Eastern Time - Michigan - most locations
    -US	+381515-0854534	America/Kentucky/Louisville	Eastern Time - Kentucky - Louisville area
    -US	+364947-0845057	America/Kentucky/Monticello	Eastern Time - Kentucky - Wayne County
    -US	+394606-0860929	America/Indiana/Indianapolis	Eastern Time - Indiana - most locations
    -US	+384038-0873143	America/Indiana/Vincennes	Eastern Time - Indiana - Daviess, Dubois, Knox & Martin Counties
    -US	+410305-0863611	America/Indiana/Winamac	Eastern Time - Indiana - Pulaski County
    -US	+382232-0862041	America/Indiana/Marengo	Eastern Time - Indiana - Crawford County
    -US	+382931-0871643	America/Indiana/Petersburg	Eastern Time - Indiana - Pike County
    -US	+384452-0850402	America/Indiana/Vevay	Eastern Time - Indiana - Switzerland County
    -US	+415100-0873900	America/Chicago	Central Time
    -US	+375711-0864541	America/Indiana/Tell_City	Central Time - Indiana - Perry County
    -US	+411745-0863730	America/Indiana/Knox	Central Time - Indiana - Starke County
    -US	+450628-0873651	America/Menominee	Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
    -US	+470659-1011757	America/North_Dakota/Center	Central Time - North Dakota - Oliver County
    -US	+465042-1012439	America/North_Dakota/New_Salem	Central Time - North Dakota - Morton County (except Mandan area)
    -US	+471551-1014640	America/North_Dakota/Beulah	Central Time - North Dakota - Mercer County
    -US	+394421-1045903	America/Denver	Mountain Time
    -US	+433649-1161209	America/Boise	Mountain Time - south Idaho & east Oregon
    -US	+332654-1120424	America/Phoenix	Mountain Standard Time - Arizona (except Navajo)
    -US	+340308-1181434	America/Los_Angeles	Pacific Time
    -US	+550737-1313435	America/Metlakatla	Pacific Standard Time - Annette Island, Alaska
    -US	+611305-1495401	America/Anchorage	Alaska Time
    -US	+581807-1342511	America/Juneau	Alaska Time - Alaska panhandle
    -US	+571035-1351807	America/Sitka	Alaska Time - southeast Alaska panhandle
    -US	+593249-1394338	America/Yakutat	Alaska Time - Alaska panhandle neck
    -US	+643004-1652423	America/Nome	Alaska Time - west Alaska
    -US	+515248-1763929	America/Adak	Aleutian Islands
    -US	+211825-1575130	Pacific/Honolulu	Hawaii
    -UY	-3453-05611	America/Montevideo
    -UZ	+3940+06648	Asia/Samarkand	west Uzbekistan
    -UZ	+4120+06918	Asia/Tashkent	east Uzbekistan
    -VA	+415408+0122711	Europe/Vatican
    -VC	+1309-06114	America/St_Vincent
    -VE	+1030-06656	America/Caracas
    -VG	+1827-06437	America/Tortola
    -VI	+1821-06456	America/St_Thomas
    -VN	+1045+10640	Asia/Ho_Chi_Minh
    -VU	-1740+16825	Pacific/Efate
    -WF	-1318-17610	Pacific/Wallis
    -WS	-1350-17144	Pacific/Apia
    -YE	+1245+04512	Asia/Aden
    -YT	-1247+04514	Indian/Mayotte
    -ZA	-2615+02800	Africa/Johannesburg
    -ZM	-1525+02817	Africa/Lusaka
    -ZW	-1750+03103	Africa/Harare
    diff --git a/external/public-domain/tz/dist/zone1970.tab b/external/public-domain/tz/dist/zone1970.tab
    deleted file mode 100644
    index c9d31d949..000000000
    --- a/external/public-domain/tz/dist/zone1970.tab
    +++ /dev/null
    @@ -1,372 +0,0 @@
    -# tz zone descriptions
    -#
    -# This file is in the public domain.
    -#
    -# From Paul Eggert (2014-07-31):
    -# This file contains a table where each row stands for a zone where
    -# civil time stamps have agreed since 1970.  Columns are separated by
    -# a single tab.  Lines beginning with '#' are comments.  All text uses
    -# UTF-8 encoding.  The columns of the table are as follows:
    -#
    -# 1.  The countries that overlap the zone, as a comma-separated list
    -#     of ISO 3166 2-character country codes.  See the file 'iso3166.tab'.
    -# 2.  Latitude and longitude of the zone's principal location
    -#     in ISO 6709 sign-degrees-minutes-seconds format,
    -#     either +-DDMM+-DDDMM or +-DDMMSS+-DDDMMSS,
    -#     first latitude (+ is north), then longitude (+ is east).
    -# 3.  Zone name used in value of TZ environment variable.
    -#     Please see the 'Theory' file for how zone names are chosen.
    -#     If multiple zones overlap a country, each has a row in the
    -#     table, with each column 1 containing the country code.
    -# 4.  Comments; present if and only if a country has multiple zones.
    -#
    -# If a zone covers multiple countries, the most-populous city is used,
    -# and that country is listed first in column 1; any other countries
    -# are listed alphabetically by country code.  The table is sorted
    -# first by country code, then (if possible) by an order within the
    -# country that (1) makes some geographical sense, and (2) puts the
    -# most populous zones first, where that does not contradict (1).
    -#
    -# This table is intended as an aid for users, to help them select time
    -# zone data entries appropriate for their practical needs.  It is not
    -# intended to take or endorse any position on legal or territorial claims.
    -#
    -#country-
    -#codes	coordinates	TZ	comments
    -AD	+4230+00131	Europe/Andorra
    -AE,OM	+2518+05518	Asia/Dubai
    -AF	+3431+06912	Asia/Kabul
    -AL	+4120+01950	Europe/Tirane
    -AM	+4011+04430	Asia/Yerevan
    -AQ	-6734-06808	Antarctica/Rothera	Rothera Station, Adelaide Island
    -AQ	-6448-06406	Antarctica/Palmer	Palmer Station, Anvers Island
    -AQ	-6736+06253	Antarctica/Mawson	Mawson Station, Holme Bay
    -AQ	-6835+07758	Antarctica/Davis	Davis Station, Vestfold Hills
    -AQ	-6617+11031	Antarctica/Casey	Casey Station, Bailey Peninsula
    -AQ	-7824+10654	Antarctica/Vostok	Vostok Station, Lake Vostok
    -AQ	-6640+14001	Antarctica/DumontDUrville	Dumont-d'Urville Station, Adélie Land
    -AQ	-690022+0393524	Antarctica/Syowa	Syowa Station, E Ongul I
    -AQ	-720041+0023206	Antarctica/Troll	Troll Station, Queen Maud Land
    -AR	-3436-05827	America/Argentina/Buenos_Aires	Buenos Aires (BA, CF)
    -AR	-3124-06411	America/Argentina/Cordoba	most locations (CB, CC, CN, ER, FM, MN, SE, SF)
    -AR	-2447-06525	America/Argentina/Salta	(SA, LP, NQ, RN)
    -AR	-2411-06518	America/Argentina/Jujuy	Jujuy (JY)
    -AR	-2649-06513	America/Argentina/Tucuman	Tucumán (TM)
    -AR	-2828-06547	America/Argentina/Catamarca	Catamarca (CT), Chubut (CH)
    -AR	-2926-06651	America/Argentina/La_Rioja	La Rioja (LR)
    -AR	-3132-06831	America/Argentina/San_Juan	San Juan (SJ)
    -AR	-3253-06849	America/Argentina/Mendoza	Mendoza (MZ)
    -AR	-3319-06621	America/Argentina/San_Luis	San Luis (SL)
    -AR	-5138-06913	America/Argentina/Rio_Gallegos	Santa Cruz (SC)
    -AR	-5448-06818	America/Argentina/Ushuaia	Tierra del Fuego (TF)
    -AS,UM	-1416-17042	Pacific/Pago_Pago	Samoa, Midway
    -AT	+4813+01620	Europe/Vienna
    -AU	-3133+15905	Australia/Lord_Howe	Lord Howe Island
    -AU	-5430+15857	Antarctica/Macquarie	Macquarie Island
    -AU	-4253+14719	Australia/Hobart	Tasmania - most locations
    -AU	-3956+14352	Australia/Currie	Tasmania - King Island
    -AU	-3749+14458	Australia/Melbourne	Victoria
    -AU	-3352+15113	Australia/Sydney	New South Wales - most locations
    -AU	-3157+14127	Australia/Broken_Hill	New South Wales - Yancowinna
    -AU	-2728+15302	Australia/Brisbane	Queensland - most locations
    -AU	-2016+14900	Australia/Lindeman	Queensland - Holiday Islands
    -AU	-3455+13835	Australia/Adelaide	South Australia
    -AU	-1228+13050	Australia/Darwin	Northern Territory
    -AU	-3157+11551	Australia/Perth	Western Australia - most locations
    -AU	-3143+12852	Australia/Eucla	Western Australia - Eucla area
    -AZ	+4023+04951	Asia/Baku
    -BB	+1306-05937	America/Barbados
    -BD	+2343+09025	Asia/Dhaka
    -BE	+5050+00420	Europe/Brussels
    -BG	+4241+02319	Europe/Sofia
    -BM	+3217-06446	Atlantic/Bermuda
    -BN	+0456+11455	Asia/Brunei
    -BO	-1630-06809	America/La_Paz
    -BR	-0351-03225	America/Noronha	Atlantic islands
    -BR	-0127-04829	America/Belem	Amapá, E Pará
    -BR	-0343-03830	America/Fortaleza	NE Brazil (MA, PI, CE, RN, PB)
    -BR	-0803-03454	America/Recife	Pernambuco
    -BR	-0712-04812	America/Araguaina	Tocantins
    -BR	-0940-03543	America/Maceio	Alagoas, Sergipe
    -BR	-1259-03831	America/Bahia	Bahia
    -BR	-2332-04637	America/Sao_Paulo	S & SE Brazil (GO, DF, MG, ES, RJ, SP, PR, SC, RS)
    -BR	-2027-05437	America/Campo_Grande	Mato Grosso do Sul
    -BR	-1535-05605	America/Cuiaba	Mato Grosso
    -BR	-0226-05452	America/Santarem	W Pará
    -BR	-0846-06354	America/Porto_Velho	Rondônia
    -BR	+0249-06040	America/Boa_Vista	Roraima
    -BR	-0308-06001	America/Manaus	E Amazonas
    -BR	-0640-06952	America/Eirunepe	W Amazonas
    -BR	-0958-06748	America/Rio_Branco	Acre
    -BS	+2505-07721	America/Nassau
    -BT	+2728+08939	Asia/Thimphu
    -BY	+5354+02734	Europe/Minsk
    -BZ	+1730-08812	America/Belize
    -CA	+4734-05243	America/St_Johns	Newfoundland Time, including SE Labrador
    -CA	+4439-06336	America/Halifax	Atlantic Time - Nova Scotia (peninsula), PEI
    -CA	+4612-05957	America/Glace_Bay	Atlantic Time - Nova Scotia (Cape Breton)
    -CA	+4606-06447	America/Moncton	Atlantic Time - New Brunswick
    -CA	+5320-06025	America/Goose_Bay	Atlantic Time - Labrador - most locations
    -CA	+5125-05707	America/Blanc-Sablon	Atlantic Standard Time - Quebec - Lower North Shore
    -CA	+4339-07923	America/Toronto	Eastern Time - Ontario & Quebec - most locations
    -CA	+4901-08816	America/Nipigon	Eastern Time - Ontario & Quebec - places that did not observe DST 1967-1973
    -CA	+4823-08915	America/Thunder_Bay	Eastern Time - Thunder Bay, Ontario
    -CA	+6344-06828	America/Iqaluit	Eastern Time - east Nunavut - most locations
    -CA	+6608-06544	America/Pangnirtung	Eastern Time - Pangnirtung, Nunavut
    -CA	+744144-0944945	America/Resolute	Central Time - Resolute, Nunavut
    -CA	+484531-0913718	America/Atikokan	Eastern Standard Time - Atikokan, Ontario and Southampton I, Nunavut
    -CA	+624900-0920459	America/Rankin_Inlet	Central Time - central Nunavut
    -CA	+4953-09709	America/Winnipeg	Central Time - Manitoba & west Ontario
    -CA	+4843-09434	America/Rainy_River	Central Time - Rainy River & Fort Frances, Ontario
    -CA	+5024-10439	America/Regina	Central Standard Time - Saskatchewan - most locations
    -CA	+5017-10750	America/Swift_Current	Central Standard Time - Saskatchewan - midwest
    -CA	+5333-11328	America/Edmonton	Mountain Time - Alberta, east British Columbia & west Saskatchewan
    -CA	+690650-1050310	America/Cambridge_Bay	Mountain Time - west Nunavut
    -CA	+6227-11421	America/Yellowknife	Mountain Time - central Northwest Territories
    -CA	+682059-1334300	America/Inuvik	Mountain Time - west Northwest Territories
    -CA	+4906-11631	America/Creston	Mountain Standard Time - Creston, British Columbia
    -CA	+5946-12014	America/Dawson_Creek	Mountain Standard Time - Dawson Creek & Fort Saint John, British Columbia
    -CA	+4916-12307	America/Vancouver	Pacific Time - west British Columbia
    -CA	+6043-13503	America/Whitehorse	Pacific Time - south Yukon
    -CA	+6404-13925	America/Dawson	Pacific Time - north Yukon
    -CC	-1210+09655	Indian/Cocos
    -CH,DE,LI	+4723+00832	Europe/Zurich	Swiss time
    -CI,BF,GM,GN,ML,MR,SH,SL,SN,ST,TG	+0519-00402	Africa/Abidjan
    -CK	-2114-15946	Pacific/Rarotonga
    -CL	-3327-07040	America/Santiago	most locations
    -CL	-2709-10926	Pacific/Easter	Easter Island
    -CN	+3114+12128	Asia/Shanghai	Beijing Time
    -CN	+4348+08735	Asia/Urumqi	Xinjiang Time
    -CO	+0436-07405	America/Bogota
    -CR	+0956-08405	America/Costa_Rica
    -CU	+2308-08222	America/Havana
    -CV	+1455-02331	Atlantic/Cape_Verde
    -CW,AW,BQ,SX	+1211-06900	America/Curacao
    -CX	-1025+10543	Indian/Christmas
    -CY	+3510+03322	Asia/Nicosia
    -CZ,SK	+5005+01426	Europe/Prague
    -DE	+5230+01322	Europe/Berlin	Berlin time
    -DK	+5540+01235	Europe/Copenhagen
    -DO	+1828-06954	America/Santo_Domingo
    -DZ	+3647+00303	Africa/Algiers
    -EC	-0210-07950	America/Guayaquil	mainland
    -EC	-0054-08936	Pacific/Galapagos	Galápagos Islands
    -EE	+5925+02445	Europe/Tallinn
    -EG	+3003+03115	Africa/Cairo
    -EH	+2709-01312	Africa/El_Aaiun
    -ES	+4024-00341	Europe/Madrid	mainland
    -ES	+3553-00519	Africa/Ceuta	Ceuta & Melilla
    -ES	+2806-01524	Atlantic/Canary	Canary Islands
    -FI,AX	+6010+02458	Europe/Helsinki
    -FJ	-1808+17825	Pacific/Fiji
    -FK	-5142-05751	Atlantic/Stanley
    -FM	+0725+15147	Pacific/Chuuk	Chuuk (Truk) and Yap
    -FM	+0658+15813	Pacific/Pohnpei	Pohnpei (Ponape)
    -FM	+0519+16259	Pacific/Kosrae	Kosrae
    -FO	+6201-00646	Atlantic/Faroe
    -FR	+4852+00220	Europe/Paris
    -GB,GG,IM,JE	+513030-0000731	Europe/London
    -GE	+4143+04449	Asia/Tbilisi
    -GF	+0456-05220	America/Cayenne
    -GH	+0533-00013	Africa/Accra
    -GI	+3608-00521	Europe/Gibraltar
    -GL	+6411-05144	America/Godthab	most locations
    -GL	+7646-01840	America/Danmarkshavn	east coast, north of Scoresbysund
    -GL	+7029-02158	America/Scoresbysund	Scoresbysund / Ittoqqortoormiit
    -GL	+7634-06847	America/Thule	Thule / Pituffik
    -GR	+3758+02343	Europe/Athens
    -GS	-5416-03632	Atlantic/South_Georgia
    -GT	+1438-09031	America/Guatemala
    -GU,MP	+1328+14445	Pacific/Guam
    -GW	+1151-01535	Africa/Bissau
    -GY	+0648-05810	America/Guyana
    -HK	+2217+11409	Asia/Hong_Kong
    -HN	+1406-08713	America/Tegucigalpa
    -HT	+1832-07220	America/Port-au-Prince
    -HU	+4730+01905	Europe/Budapest
    -ID	-0610+10648	Asia/Jakarta	Java & Sumatra
    -ID	-0002+10920	Asia/Pontianak	west & central Borneo
    -ID	-0507+11924	Asia/Makassar	east & south Borneo, Sulawesi (Celebes), Bali, Nusa Tengarra, west Timor
    -ID	-0232+14042	Asia/Jayapura	west New Guinea (Irian Jaya) & Malukus (Moluccas)
    -IE	+5320-00615	Europe/Dublin
    -IL	+314650+0351326	Asia/Jerusalem
    -IN	+2232+08822	Asia/Kolkata
    -IO	-0720+07225	Indian/Chagos
    -IQ	+3321+04425	Asia/Baghdad
    -IR	+3540+05126	Asia/Tehran
    -IS	+6409-02151	Atlantic/Reykjavik
    -IT,SM,VA	+4154+01229	Europe/Rome
    -JM	+175805-0764736	America/Jamaica
    -JO	+3157+03556	Asia/Amman
    -JP	+353916+1394441	Asia/Tokyo
    -KE,DJ,ER,ET,KM,MG,SO,TZ,UG,YT	-0117+03649	Africa/Nairobi
    -KG	+4254+07436	Asia/Bishkek
    -KI	+0125+17300	Pacific/Tarawa	Gilbert Islands
    -KI	-0308-17105	Pacific/Enderbury	Phoenix Islands
    -KI	+0152-15720	Pacific/Kiritimati	Line Islands
    -KP	+3901+12545	Asia/Pyongyang
    -KR	+3733+12658	Asia/Seoul
    -KY	+1918-08123	America/Cayman
    -KZ	+4315+07657	Asia/Almaty	most locations
    -KZ	+4448+06528	Asia/Qyzylorda	Qyzylorda (Kyzylorda, Kzyl-Orda)
    -KZ	+5017+05710	Asia/Aqtobe	Aqtobe (Aktobe)
    -KZ	+4431+05016	Asia/Aqtau	Atyrau (Atirau, Gur'yev), Mangghystau (Mankistau)
    -KZ	+5113+05121	Asia/Oral	West Kazakhstan
    -LB	+3353+03530	Asia/Beirut
    -LK	+0656+07951	Asia/Colombo
    -LR	+0618-01047	Africa/Monrovia
    -LT	+5441+02519	Europe/Vilnius
    -LU	+4936+00609	Europe/Luxembourg
    -LV	+5657+02406	Europe/Riga
    -LY	+3254+01311	Africa/Tripoli
    -MA	+3339-00735	Africa/Casablanca
    -MC	+4342+00723	Europe/Monaco
    -MD	+4700+02850	Europe/Chisinau
    -MH	+0709+17112	Pacific/Majuro	most locations
    -MH	+0905+16720	Pacific/Kwajalein	Kwajalein
    -MM	+1647+09610	Asia/Rangoon
    -MN	+4755+10653	Asia/Ulaanbaatar	most locations
    -MN	+4801+09139	Asia/Hovd	Bayan-Ölgii, Govi-Altai, Hovd, Uvs, Zavkhan
    -MN	+4804+11430	Asia/Choibalsan	Dornod, Sükhbaatar
    -MO	+2214+11335	Asia/Macau
    -MQ	+1436-06105	America/Martinique
    -MT	+3554+01431	Europe/Malta
    -MU	-2010+05730	Indian/Mauritius
    -MV	+0410+07330	Indian/Maldives
    -MX	+1924-09909	America/Mexico_City	Central Time - most locations
    -MX	+2105-08646	America/Cancun	Eastern Standard Time - Quintana Roo
    -MX	+2058-08937	America/Merida	Central Time - Campeche, Yucatán
    -MX	+2540-10019	America/Monterrey	Mexican Central Time - Coahuila, Durango, Nuevo León, Tamaulipas away from US border
    -MX	+2550-09730	America/Matamoros	US Central Time - Coahuila, Durango, Nuevo León, Tamaulipas near US border
    -MX	+2313-10625	America/Mazatlan	Mountain Time - S Baja, Nayarit, Sinaloa
    -MX	+2838-10605	America/Chihuahua	Mexican Mountain Time - Chihuahua away from US border
    -MX	+2934-10425	America/Ojinaga	US Mountain Time - Chihuahua near US border
    -MX	+2904-11058	America/Hermosillo	Mountain Standard Time - Sonora
    -MX	+3232-11701	America/Tijuana	US Pacific Time - Baja California near US border
    -MX	+3018-11452	America/Santa_Isabel	Mexican Pacific Time - Baja California away from US border
    -MX	+2048-10515	America/Bahia_Banderas	Mexican Central Time - Bahía de Banderas
    -MY	+0310+10142	Asia/Kuala_Lumpur	peninsular Malaysia
    -MY	+0133+11020	Asia/Kuching	Sabah & Sarawak
    -MZ,BI,BW,CD,MW,RW,ZM,ZW	-2558+03235	Africa/Maputo	Central Africa Time (UTC+2)
    -NA	-2234+01706	Africa/Windhoek
    -NC	-2216+16627	Pacific/Noumea
    -NF	-2903+16758	Pacific/Norfolk
    -NG,AO,BJ,CD,CF,CG,CM,GA,GQ,NE	+0627+00324	Africa/Lagos	West Africa Time (UTC+1)
    -NI	+1209-08617	America/Managua
    -NL	+5222+00454	Europe/Amsterdam
    -NO,SJ	+5955+01045	Europe/Oslo
    -NP	+2743+08519	Asia/Kathmandu
    -NR	-0031+16655	Pacific/Nauru
    -NU	-1901-16955	Pacific/Niue
    -NZ,AQ	-3652+17446	Pacific/Auckland	New Zealand time
    -NZ	-4357-17633	Pacific/Chatham	Chatham Islands
    -PA	+0858-07932	America/Panama
    -PE	-1203-07703	America/Lima
    -PF	-1732-14934	Pacific/Tahiti	Society Islands
    -PF	-0900-13930	Pacific/Marquesas	Marquesas Islands
    -PF	-2308-13457	Pacific/Gambier	Gambier Islands
    -PG	-0930+14710	Pacific/Port_Moresby	most locations
    -PG	-0613+15534	Pacific/Bougainville	Bougainville
    -PH	+1435+12100	Asia/Manila
    -PK	+2452+06703	Asia/Karachi
    -PL	+5215+02100	Europe/Warsaw
    -PM	+4703-05620	America/Miquelon
    -PN	-2504-13005	Pacific/Pitcairn
    -PR	+182806-0660622	America/Puerto_Rico
    -PS	+3130+03428	Asia/Gaza	Gaza Strip
    -PS	+313200+0350542	Asia/Hebron	West Bank
    -PT	+3843-00908	Europe/Lisbon	mainland
    -PT	+3238-01654	Atlantic/Madeira	Madeira Islands
    -PT	+3744-02540	Atlantic/Azores	Azores
    -PW	+0720+13429	Pacific/Palau
    -PY	-2516-05740	America/Asuncion
    -QA,BH	+2517+05132	Asia/Qatar
    -RE,TF	-2052+05528	Indian/Reunion	Réunion, Crozet Is, Scattered Is
    -RO	+4426+02606	Europe/Bucharest
    -RS,BA,HR,ME,MK,SI	+4450+02030	Europe/Belgrade
    -RU	+5443+02030	Europe/Kaliningrad	Moscow-01 - Kaliningrad
    -RU	+554521+0373704	Europe/Moscow	Moscow+00 - west Russia
    -RU	+4457+03406	Europe/Simferopol	Moscow+00 - Crimea
    -RU	+4844+04425	Europe/Volgograd	Moscow+00 - Caspian Sea
    -RU	+5312+05009	Europe/Samara	Moscow+00 (Moscow+01 after 2014-10-26) - Samara, Udmurtia
    -RU	+5651+06036	Asia/Yekaterinburg	Moscow+02 - Urals
    -RU	+5500+07324	Asia/Omsk	Moscow+03 - west Siberia
    -RU	+5502+08255	Asia/Novosibirsk	Moscow+03 - Novosibirsk
    -RU	+5345+08707	Asia/Novokuznetsk	Moscow+03 (Moscow+04 after 2014-10-26) - Kemerovo
    -RU	+5601+09250	Asia/Krasnoyarsk	Moscow+04 - Yenisei River
    -RU	+5216+10420	Asia/Irkutsk	Moscow+05 - Lake Baikal
    -RU	+5203+11328	Asia/Chita	Moscow+06 (Moscow+05 after 2014-10-26) - Zabaykalsky
    -RU	+6200+12940	Asia/Yakutsk	Moscow+06 - Lena River
    -RU	+623923+1353314	Asia/Khandyga	Moscow+06 - Tomponsky, Ust-Maysky
    -RU	+4310+13156	Asia/Vladivostok	Moscow+07 - Amur River
    -RU	+4658+14242	Asia/Sakhalin	Moscow+07 - Sakhalin Island
    -RU	+643337+1431336	Asia/Ust-Nera	Moscow+07 - Oymyakonsky
    -RU	+5934+15048	Asia/Magadan	Moscow+08 (Moscow+07 after 2014-10-26) - Magadan
    -RU	+6728+15343	Asia/Srednekolymsk	Moscow+08 - E Sakha, N Kuril Is
    -RU	+5301+15839	Asia/Kamchatka	Moscow+08 (Moscow+09 after 2014-10-26) - Kamchatka
    -RU	+6445+17729	Asia/Anadyr	Moscow+08 (Moscow+09 after 2014-10-26) - Bering Sea
    -SA,KW,YE	+2438+04643	Asia/Riyadh
    -SB	-0932+16012	Pacific/Guadalcanal
    -SC	-0440+05528	Indian/Mahe
    -SD,SS	+1536+03232	Africa/Khartoum
    -SE	+5920+01803	Europe/Stockholm
    -SG	+0117+10351	Asia/Singapore
    -SR	+0550-05510	America/Paramaribo
    -SV	+1342-08912	America/El_Salvador
    -SY	+3330+03618	Asia/Damascus
    -TC	+2128-07108	America/Grand_Turk
    -TD	+1207+01503	Africa/Ndjamena
    -TF	-492110+0701303	Indian/Kerguelen	Kerguelen, St Paul I, Amsterdam I
    -TH,KH,LA,VN	+1345+10031	Asia/Bangkok	most of Indochina
    -TJ	+3835+06848	Asia/Dushanbe
    -TK	-0922-17114	Pacific/Fakaofo
    -TL	-0833+12535	Asia/Dili
    -TM	+3757+05823	Asia/Ashgabat
    -TN	+3648+01011	Africa/Tunis
    -TO	-2110-17510	Pacific/Tongatapu
    -TR	+4101+02858	Europe/Istanbul
    -TT,AG,AI,BL,DM,GD,GP,KN,LC,MF,MS,VC,VG,VI	+1039-06131	America/Port_of_Spain
    -TV	-0831+17913	Pacific/Funafuti
    -TW	+2503+12130	Asia/Taipei
    -UA	+5026+03031	Europe/Kiev	most locations
    -UA	+4837+02218	Europe/Uzhgorod	Ruthenia
    -UA	+4750+03510	Europe/Zaporozhye	Zaporozh'ye, E Lugansk / Zaporizhia, E Luhansk
    -UM	+1917+16637	Pacific/Wake	Wake Island
    -US	+404251-0740023	America/New_York	Eastern Time
    -US	+421953-0830245	America/Detroit	Eastern Time - Michigan - most locations
    -US	+381515-0854534	America/Kentucky/Louisville	Eastern Time - Kentucky - Louisville area
    -US	+364947-0845057	America/Kentucky/Monticello	Eastern Time - Kentucky - Wayne County
    -US	+394606-0860929	America/Indiana/Indianapolis	Eastern Time - Indiana - most locations
    -US	+384038-0873143	America/Indiana/Vincennes	Eastern Time - Indiana - Daviess, Dubois, Knox & Martin Counties
    -US	+410305-0863611	America/Indiana/Winamac	Eastern Time - Indiana - Pulaski County
    -US	+382232-0862041	America/Indiana/Marengo	Eastern Time - Indiana - Crawford County
    -US	+382931-0871643	America/Indiana/Petersburg	Eastern Time - Indiana - Pike County
    -US	+384452-0850402	America/Indiana/Vevay	Eastern Time - Indiana - Switzerland County
    -US	+415100-0873900	America/Chicago	Central Time
    -US	+375711-0864541	America/Indiana/Tell_City	Central Time - Indiana - Perry County
    -US	+411745-0863730	America/Indiana/Knox	Central Time - Indiana - Starke County
    -US	+450628-0873651	America/Menominee	Central Time - Michigan - Dickinson, Gogebic, Iron & Menominee Counties
    -US	+470659-1011757	America/North_Dakota/Center	Central Time - North Dakota - Oliver County
    -US	+465042-1012439	America/North_Dakota/New_Salem	Central Time - North Dakota - Morton County (except Mandan area)
    -US	+471551-1014640	America/North_Dakota/Beulah	Central Time - North Dakota - Mercer County
    -US	+394421-1045903	America/Denver	Mountain Time
    -US	+433649-1161209	America/Boise	Mountain Time - south Idaho & east Oregon
    -US	+332654-1120424	America/Phoenix	Mountain Standard Time - Arizona (except Navajo)
    -US	+340308-1181434	America/Los_Angeles	Pacific Time
    -US	+550737-1313435	America/Metlakatla	Pacific Standard Time - Annette Island, Alaska
    -US	+611305-1495401	America/Anchorage	Alaska Time
    -US	+581807-1342511	America/Juneau	Alaska Time - Alaska panhandle
    -US	+571035-1351807	America/Sitka	Alaska Time - southeast Alaska panhandle
    -US	+593249-1394338	America/Yakutat	Alaska Time - Alaska panhandle neck
    -US	+643004-1652423	America/Nome	Alaska Time - west Alaska
    -US	+515248-1763929	America/Adak	Aleutian Islands
    -US,UM	+211825-1575130	Pacific/Honolulu	Hawaii time
    -UY	-3453-05611	America/Montevideo
    -UZ	+3940+06648	Asia/Samarkand	west Uzbekistan
    -UZ	+4120+06918	Asia/Tashkent	east Uzbekistan
    -VE	+1030-06656	America/Caracas
    -VN	+1045+10640	Asia/Ho_Chi_Minh	south Vietnam
    -VU	-1740+16825	Pacific/Efate
    -WF	-1318-17610	Pacific/Wallis
    -WS	-1350-17144	Pacific/Apia
    -ZA,LS,SZ	-2615+02800	Africa/Johannesburg
    diff --git a/external/public-domain/tz/dist/zoneinfo2tdf.pl b/external/public-domain/tz/dist/zoneinfo2tdf.pl
    deleted file mode 100755
    index e05ec0100..000000000
    --- a/external/public-domain/tz/dist/zoneinfo2tdf.pl
    +++ /dev/null
    @@ -1,52 +0,0 @@
    -#! /usr/bin/perl -w
    -
    -# Courtesy Ken Pizzini.
    -
    -use strict;
    -
    -#This file released to the public domain.
    -
    -# Note: error checking is poor; trust the output only if the input
    -# has been checked by zic.
    -
    -my $contZone = '';
    -while (<>) {
    -  my $origline = $_;
    -  my @fields = ();
    -  while (s/^\s*((?:"[^"]*"|[^\s#])+)//) {
    -    push @fields, $1;
    -  }
    -  next unless @fields;
    -
    -  my $type = lc($fields[0]);
    -  if ($contZone) {
    -    @fields >= 3 or warn "bad continuation line";
    -    unshift @fields, '+', $contZone;
    -    $type = 'zone';
    -  }
    -
    -  $contZone = '';
    -  if ($type eq 'zone') {
    -    # Zone  NAME  GMTOFF  RULES/SAVE  FORMAT  [UNTIL]
    -    my $nfields = @fields;
    -    $nfields >= 5 or warn "bad zone line";
    -    if ($nfields > 6) {
    -      #this splice is optional, depending on one's preference
    -      #(one big date-time field, or componentized date and time):
    -      splice(@fields, 5, $nfields-5, "@fields[5..$nfields-1]");
    -    }
    -    $contZone = $fields[1] if @fields > 5;
    -  } elsif ($type eq 'rule') {
    -    # Rule  NAME  FROM  TO  TYPE  IN  ON  AT  SAVE  LETTER/S
    -    @fields == 10 or warn "bad rule line";
    -  } elsif ($type eq 'link') {
    -    # Link  TARGET  LINK-NAME
    -    @fields == 3 or warn "bad link line";
    -  } elsif ($type eq 'leap') {
    -    # Leap  YEAR  MONTH  DAY  HH:MM:SS  CORR  R/S
    -    @fields == 7 or warn "bad leap line";
    -  } else {
    -    warn "Fubar at input line $.: $origline";
    -  }
    -  print join("\t", @fields), "\n";
    -}
    diff --git a/external/public-domain/tz/share/Makefile b/external/public-domain/tz/share/Makefile
    deleted file mode 100644
    index 6c16c36f9..000000000
    --- a/external/public-domain/tz/share/Makefile
    +++ /dev/null
    @@ -1,5 +0,0 @@
    -# $NetBSD: Makefile,v 1.1 2014/08/08 09:18:02 apb Exp $
    -
    -SUBDIR+=	zoneinfo
    -
    -.include 
    diff --git a/external/public-domain/tz/share/zoneinfo/Makefile b/external/public-domain/tz/share/zoneinfo/Makefile
    deleted file mode 100644
    index d01e6f39a..000000000
    --- a/external/public-domain/tz/share/zoneinfo/Makefile
    +++ /dev/null
    @@ -1,148 +0,0 @@
    -#	$NetBSD: Makefile,v 1.2 2014/08/08 09:17:03 apb Exp $
    -
    -.include 
    -.include "../../Makefile.inc"
    -
    -.PATH: ${TZDISTDIR}
    -
    -# If you want something other than Eastern United States time as a template
    -# for handling POSIX-style time zone environment variables,
    -# change the line below (after finding the zone you want in the
    -# time zone files, or adding it to a time zone file).
    -# (When a POSIX-style environment variable is handled, the rules in the
    -# template file are used to determine "spring forward" and "fall back" days and
    -# times; the environment variable itself specifies UT offsets of standard and
    -# summer time.)
    -# Alternately, if you discover you've got the wrong time zone, you can just
    -#	zic -p rightzone
    -# to correct things.
    -# Use the command
    -#	make zonenames
    -# to get a list of the values you can use for POSIXRULES.
    -# If you want POSIX compatibility, use "America/New_York".
    -
    -POSIXRULES=	America/New_York
    -
    -# "Compiled" time zone information is placed in the "TZDIR" directory
    -# (and subdirectories).
    -# Use an absolute path name for TZDIR unless you're just testing the software.
    -# Note: ${DESTDIR} is prepended to this for the actual copy.
    -
    -TZDIR=	/usr/share/zoneinfo
    -
    -# If you always want time values interpreted as "seconds since the epoch
    -# (not counting leap seconds)", use
    -#	REDO=		posix_only
    -# below.  If you always want right time values interpreted as "seconds since
    -# the epoch" (counting leap seconds)", use
    -#	REDO=		right_only
    -# below.  If you want both sets of data available, with leap seconds not
    -# counted normally, use
    -#	REDO=		posix_right
    -# below.  If you want both sets of data available, with leap seconds counted
    -# normally, use
    -#	REDO=		right_posix
    -# below.
    -
    -REDO=		posix_only
    -
    -# Since "." may not be in PATH...
    -YEARISTYPE=	"${HOST_SH} ${TZDISTDIR}/yearistype.sh"
    -
    -PRIMARY_YDATA=	africa antarctica asia australasia \
    -		europe northamerica southamerica
    -YDATA=		$(PRIMARY_YDATA) pacificnew etcetera backward
    -NDATA=		systemv factory
    -TDATA=		$(YDATA) $(NDATA)
    -ZONETABLES=	zone1970.tab zone.tab
    -TABDATA=	iso3166.tab leapseconds $(ZONETABLES)
    -DATA=		$(YDATA) $(NDATA) $(TABDATA) # yearistype.sh
    -
    -TZBUILDDIR=	${.OBJDIR}/builddir
    -
    -.PHONY:	posix_only
    -posix_only: ${TDATA}
    -	${_MKTARGET_CREATE}
    -	mkdir -p ${TZBUILDDIR}
    -	cd ${TZDISTDIR} && \
    -	    ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -L /dev/null ${TDATA}
    -
    -.PHONY:	right_only
    -right_only: leapseconds ${TDATA}
    -	${_MKTARGET_CREATE}
    -	mkdir -p ${TZBUILDDIR}
    -	cd ${TZDISTDIR} && \
    -	    ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -L leapseconds ${TDATA}
    -
    -.PHONY:	other_two
    -other_two: leapseconds ${TDATA}
    -	${_MKTARGET_CREATE}
    -	mkdir -p ${TZBUILDDIR}
    -	cd ${TZDISTDIR} && \
    -	    ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR}/posix -L /dev/null ${TDATA}
    -	cd ${TZDISTDIR} && \
    -	    ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR}/right -L leapseconds ${TDATA}
    -
    -.PHONY:	posix_right
    -posix_right: posix_only other_two
    -
    -.PHONY:	right_posix
    -right_posix: right_only other_two
    -
    -.if ${MKUNPRIVED} == "no"
    -TOOL_PAX.unpriv=-pe
    -.else
    -TOOL_PAX.unpriv=
    -.endif
    -
    -.if ${MKSHARE} != "no"
    -afterinstall: ${DATA} ${REDO} ${TABDATA}
    -	${_MKMSG_CREATE} ${POSIXRULES}
    -	mkdir -p ${TZBUILDDIR}
    -	cd ${TZDISTDIR} && \
    -	    ${TOOL_ZIC} -y ${YEARISTYPE} -d ${TZBUILDDIR} -p ${POSIXRULES}
    -	cd ${TZBUILDDIR} && \
    -	    find . -type f -print | xargs ${TOOL_STAT} -qf '%d,%i %N' | sort \
    -	| while read devino tzfile; do \
    -		destfile=${DESTDIR}${TZDIR}/$${tzfile#./}; \
    -		destdir=$$(dirname $${destfile}); \
    -		if [ ! -d "$$destdir" ]; then \
    -			${_MKSHMSG_INSTALL} $$destdir; \
    -			${_MKSHECHO} ${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} \
    -			$$destdir; \
    -			${INSTALL_DIR} -o ${BINOWN} -g ${BINGRP} $$destdir; \
    -		fi; \
    -		if [ "$$devino" = "$$lastdevino" ]; then \
    -			if  ldevino=$$(${TOOL_STAT} -qf '%d %i' $$lastfile) && \
    -			    tdevino=$$(${TOOL_STAT} -qf '%d %i' $$destfile) && \
    -			    [ "$$ldevino" = "$$tdevino" ]; then \
    -				continue; \
    -			fi; \
    -			${_MKSHMSG_INSTALL} $$destfile; \
    -			${_MKSHECHO} ${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP} \
    -			    -m ${NONBINMODE} $$lastfile $$destfile; \
    -			${INSTALL_LINK} -o ${BINOWN} -g ${BINGRP} \
    -			    -m ${NONBINMODE} $$lastfile $$destfile; \
    -		else \
    -			lastdevino=$$devino; \
    -			lastfile=$$destfile; \
    -			cmp -s $$tzfile $$destfile >/dev/null 2>&1 && continue;\
    -			${_MKSHMSG_INSTALL} $$destfile; \
    -			${_MKSHECHO} ${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
    -			    -m ${NONBINMODE} $$tzfile $$destfile; \
    -			${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} \
    -			    -m ${NONBINMODE} $$tzfile $$destfile; \
    -		fi; \
    -	done
    -	for f in ${TABDATA}; do \
    -		${INSTALL_FILE} -o ${BINOWN} -g ${BINGRP} -m ${NONBINMODE} \
    -			${TZDISTDIR}/$$f ${DESTDIR}${TZDIR}; \
    -	done
    -.else	# ${MKSHARE} == "no"
    -afterinstall:
    -.endif	# ${MKSHARE} == "no"
    -
    -clean:
    -	-rm -rf ${TZBUILDDIR}
    -
    -.include 
    diff --git a/external/public-domain/xz/Makefile b/external/public-domain/xz/Makefile
    deleted file mode 100644
    index 9ec6ae541..000000000
    --- a/external/public-domain/xz/Makefile
    +++ /dev/null
    @@ -1,5 +0,0 @@
    -# $NetBSD: Makefile,v 1.1 2010/11/02 16:34:36 joerg Exp $
    -
    -SUBDIR+=	lib .WAIT bin
    -
    -.include 
    diff --git a/external/public-domain/xz/Makefile.inc b/external/public-domain/xz/Makefile.inc
    deleted file mode 100644
    index d1f6424d7..000000000
    --- a/external/public-domain/xz/Makefile.inc
    +++ /dev/null
    @@ -1,15 +0,0 @@
    -# $NetBSD: Makefile.inc,v 1.3 2011/10/16 17:24:32 joerg Exp $
    -
    -XZHOMEPAGE=	http://tukaani.org/xz/
    -XZVERSION=	5.0.0
    -
    -XZSRCDIR:=	${.PARSEDIR}/dist
    -XZINCDIR:=	${.PARSEDIR}/include
    -
    -CPPFLAGS+=	-I${XZINCDIR}
    -CPPFLAGS+=	-I${XZSRCDIR}/src/common
    -CPPFLAGS+=	-I${XZSRCDIR}/src/liblzma/api
    -CPPFLAGS+=	-DHAVE_CONFIG_H
    -
    -CFLAGS+=	-std=c99
    -WARNS=		2
    diff --git a/external/public-domain/xz/bin/Makefile b/external/public-domain/xz/bin/Makefile
    deleted file mode 100644
    index cef04f31d..000000000
    --- a/external/public-domain/xz/bin/Makefile
    +++ /dev/null
    @@ -1,5 +0,0 @@
    -# $NetBSD: Makefile,v 1.3 2011/08/04 03:38:06 matt Exp $
    -
    -SUBDIR+=	xz lzmainfo
    -
    -.include 
    diff --git a/external/public-domain/xz/bin/Makefile.inc b/external/public-domain/xz/bin/Makefile.inc
    deleted file mode 100644
    index 01b5f2341..000000000
    --- a/external/public-domain/xz/bin/Makefile.inc
    +++ /dev/null
    @@ -1 +0,0 @@
    -.include "../Makefile.inc"
    diff --git a/external/public-domain/xz/bin/lzmainfo/Makefile b/external/public-domain/xz/bin/lzmainfo/Makefile
    deleted file mode 100644
    index 08f8a149d..000000000
    --- a/external/public-domain/xz/bin/lzmainfo/Makefile
    +++ /dev/null
    @@ -1,30 +0,0 @@
    -# $NetBSD: Makefile,v 1.1 2011/08/04 03:38:06 matt Exp $
    -
    -PROG=	lzmainfo
    -BINDIR=	/usr/bin
    -SRCS=	lzmainfo.c
    -
    -#args.c coder.c file_io.c hardware.c list.c main.c \
    -#	message.c options.c signals.c suffix.c util.c
    -SRCS+=	tuklib_exit.c tuklib_cpucores.c tuklib_open_stdxxx.c \
    -	tuklib_mbstr_fw.c tuklib_mbstr_width.c \
    -	tuklib_physmem.c tuklib_progname.c
    -
    -#USETBL=	yes
    -
    -.include 
    -
    -CPPFLAGS+=	-DPACKAGE=\"xz\"
    -.if !defined(__MINIX)
    -CPPFLAGS+=	-DENABLE_NLS -DLOCALEDIR=\"/usr/share/locale\"
    -
    -DPADD+=	${LIBLZMA} ${LIBINTL}
    -LDADD+=	-llzma -lintl
    -.else
    -DPADD+= ${LIBLZMA}
    -LDADD+= -llzma
    -.endif # !defined(__MINIX)
    -
    -.PATH:	${XZSRCDIR}/src/common ${XZSRCDIR}/src/lzmainfo
    -
    -.include 
    diff --git a/external/public-domain/xz/bin/xz/Makefile b/external/public-domain/xz/bin/xz/Makefile
    deleted file mode 100644
    index d1b63df19..000000000
    --- a/external/public-domain/xz/bin/xz/Makefile
    +++ /dev/null
    @@ -1,53 +0,0 @@
    -# $NetBSD: Makefile,v 1.3 2015/04/21 10:12:04 christos Exp $
    -
    -PROG=	xz
    -BINDIR=	/usr/bin
    -SRCS=	args.c coder.c file_io.c hardware.c list.c main.c \
    -	message.c options.c signals.c suffix.c util.c \
    -	tuklib_exit.c tuklib_cpucores.c tuklib_open_stdxxx.c \
    -	tuklib_mbstr_fw.c tuklib_mbstr_width.c \
    -	tuklib_physmem.c tuklib_progname.c mytime.c
    -
    -USETBL=	yes
    -
    -.include 
    -
    -CPPFLAGS+=	-DPACKAGE=\"xz\"
    -.if !defined(__MINIX)
    -CPPFLAGS+=	-DENABLE_NLS -DLOCALEDIR=\"/usr/share/locale\"
    -
    -DPADD+=	${LIBLZMA} ${LIBINTL}
    -LDADD+=	-llzma -lintl
    -.else
    -DPADD+=	${LIBLZMA}
    -LDADD+=	-llzma
    -.endif # !defined(__MINIX)
    -
    -LINKS+=	${BINDIR}/xz ${BINDIR}/lzcat
    -LINKS+=	${BINDIR}/xz ${BINDIR}/lzma
    -LINKS+=	${BINDIR}/xz ${BINDIR}/unlzma
    -LINKS+=	${BINDIR}/xz ${BINDIR}/unxz
    -LINKS+=	${BINDIR}/xz ${BINDIR}/xzcat
    -
    -MLINKS+=	xz.1 lzcat.1
    -MLINKS+=	xz.1 lzma.1
    -MLINKS+=	xz.1 unlzma.1
    -MLINKS+=	xz.1 unxz.1
    -MLINKS+=	xz.1 xzcat.1
    -
    -.PATH:	${XZSRCDIR}/src/common ${XZSRCDIR}/src/xz
    -
    -.if ${MKNLS} != "no"
    -.for lang in cs de it
    -FILES+=					${XZSRCDIR}/po/${lang}.gmo
    -FILESDIR_${XZSRCDIR}/po/${lang}.gmo=	/usr/share/locale/${lang}/LC_MESSAGES
    -FILESNAME_${XZSRCDIR}/po/${lang}.gmo=	xz.mo
    -.endfor
    -.endif
    -
    -.if !defined(__MINIX)
    -LDADD+=	-lpthread
    -DPADD+=	${LIBPTHREAD}
    -.endif # !defined(__MINIX)
    -
    -.include 
    diff --git a/external/public-domain/xz/dist/AUTHORS b/external/public-domain/xz/dist/AUTHORS
    deleted file mode 100644
    index bda87975a..000000000
    --- a/external/public-domain/xz/dist/AUTHORS
    +++ /dev/null
    @@ -1,27 +0,0 @@
    -
    -Authors of XZ Utils
    -===================
    -
    -    XZ Utils is developed and maintained by Lasse Collin
    -    .
    -
    -    Major parts of liblzma are based on code written by Igor Pavlov,
    -    specifically the LZMA SDK . Without
    -    this code, XZ Utils wouldn't exist.
    -
    -    The SHA-256 implementation in liblzma is based on the code found from
    -    7-Zip , which has a modified version of the SHA-256
    -    code found from Crypto++ . The SHA-256 code
    -    in Crypto++ was written by Kevin Springle and Wei Dai.
    -
    -    Some scripts have been adapted from gzip. The original versions
    -    were written by Jean-loup Gailly, Charles Levert, and Paul Eggert.
    -    Andrew Dudman helped adapting the scripts and their man pages for
    -    XZ Utils.
    -
    -    The GNU Autotools-based build system contains files from many authors,
    -    which I'm not trying to list here.
    -
    -    Several people have contributed fixes or reported bugs. Most of them
    -    are mentioned in the file THANKS.
    -
    diff --git a/external/public-domain/xz/dist/COPYING b/external/public-domain/xz/dist/COPYING
    deleted file mode 100644
    index 43c90d059..000000000
    --- a/external/public-domain/xz/dist/COPYING
    +++ /dev/null
    @@ -1,65 +0,0 @@
    -
    -XZ Utils Licensing
    -==================
    -
    -    Different licenses apply to different files in this package. Here
    -    is a rough summary of which licenses apply to which parts of this
    -    package (but check the individual files to be sure!):
    -
    -      - liblzma is in the public domain.
    -
    -      - xz, xzdec, and lzmadec command line tools are in the public
    -        domain unless GNU getopt_long had to be compiled and linked
    -        in from the lib directory. The getopt_long code is under
    -        GNU LGPLv2.1+.
    -
    -      - The scripts to grep, diff, and view compressed files have been
    -        adapted from gzip. These scripts and their documentation are
    -        under GNU GPLv2+.
    -
    -      - All the documentation in the doc directory and most of the
    -        XZ Utils specific documentation files in other directories
    -        are in the public domain.
    -
    -      - Translated messages are in the public domain.
    -
    -      - The build system contains public domain files, and files that
    -        are under GNU GPLv2+ or GNU GPLv3+. None of these files end up
    -        in the binaries being built.
    -
    -      - Test files and test code in the tests directory, and debugging
    -        utilities in the debug directory are in the public domain.
    -
    -      - The extra directory may contain public domain files, and files
    -        that are under various free software licenses.
    -
    -    You can do whatever you want with the files that have been put into
    -    the public domain. If you find public domain legally problematic,
    -    take the previous sentence as a license grant. If you still find
    -    the lack of copyright legally problematic, you have too many
    -    lawyers.
    -
    -    As usual, this software is provided "as is", without any warranty.
    -
    -    If you copy significant amounts of public domain code from XZ Utils
    -    into your project, acknowledging this somewhere in your software is
    -    polite (especially if it is proprietary, non-free software), but
    -    naturally it is not legally required. Here is an example of a good
    -    notice to put into "about box" or into documentation:
    -
    -        This software includes code from XZ Utils .
    -
    -    The following license texts are included in the following files:
    -      - COPYING.LGPLv2.1: GNU Lesser General Public License version 2.1
    -      - COPYING.GPLv2: GNU General Public License version 2
    -      - COPYING.GPLv3: GNU General Public License version 3
    -
    -    Note that the toolchain (compiler, linker etc.) may add some code
    -    pieces that are copyrighted. Thus, it is possible that e.g. liblzma
    -    binary wouldn't actually be in the public domain in its entirety
    -    even though it contains no copyrighted code from the XZ Utils source
    -    package.
    -
    -    If you have questions, don't hesitate to ask the author(s) for more
    -    information.
    -
    diff --git a/external/public-domain/xz/dist/ChangeLog b/external/public-domain/xz/dist/ChangeLog
    deleted file mode 100644
    index f2c90b0be..000000000
    --- a/external/public-domain/xz/dist/ChangeLog
    +++ /dev/null
    @@ -1,14643 +0,0 @@
    -commit dec11497a71518423b5ff0e759100cf8aadf6c7b
    -Author: Lasse Collin 
    -Date:   2015-02-26 16:53:44 +0200
    -
    -    Bump version and soname for 5.2.1.
    -
    - src/liblzma/Makefile.am        | 2 +-
    - src/liblzma/api/lzma/version.h | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 29e39c79975ab89ee5dd671e97064534a9f3a649
    -Author: Lasse Collin 
    -Date:   2015-02-26 13:01:09 +0200
    -
    -    Update NEWS for 5.2.1.
    -
    - NEWS | 14 ++++++++++++++
    - 1 file changed, 14 insertions(+)
    -
    -commit 7a11c4a8e5e15f13d5fa59233b3172e65428efdd
    -Author: Lasse Collin 
    -Date:   2015-02-22 19:38:48 +0200
    -
    -    xz: Use pipe2() if available.
    -
    - configure.ac     | 4 ++--
    - src/xz/file_io.c | 9 ++++++++-
    - 2 files changed, 10 insertions(+), 3 deletions(-)
    -
    -commit 117d962685c72682c63edc9bb765367189800202
    -Author: Lasse Collin 
    -Date:   2015-02-21 23:40:26 +0200
    -
    -    liblzma: Fix a compression-ratio regression in LZMA1/2 in fast mode.
    -    
    -    The bug was added in the commit
    -    f48fce093b07aeda95c18850f5e086d9f2383380 and thus
    -    affected 5.1.4beta and 5.2.0. Luckily the bug cannot
    -    cause data corruption or other nasty things.
    -
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit ae984e31c167d3bc52972ec422dd1ebd5f5d5719
    -Author: Lasse Collin 
    -Date:   2015-02-21 23:00:19 +0200
    -
    -    xz: Fix the fcntl() usage when creating a pipe for the self-pipe trick.
    -    
    -    Now it reads the old flags instead of blindly setting O_NONBLOCK.
    -    The old code may have worked correctly, but this is better.
    -
    - src/xz/file_io.c | 16 +++++++++++-----
    - 1 file changed, 11 insertions(+), 5 deletions(-)
    -
    -commit 2205bb5853098aea36a56df6f5747037175f66b4
    -Author: Lasse Collin 
    -Date:   2015-02-10 15:29:34 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit d935b0cdf3db440269b9d952b2b281b18f8c7b08
    -Author: Lasse Collin 
    -Date:   2015-02-10 15:28:30 +0200
    -
    -    tuklib_cpucores: Use cpuset_getaffinity() on FreeBSD if available.
    -    
    -    In FreeBSD, cpuset_getaffinity() is the preferred way to get
    -    the number of available cores.
    -    
    -    Thanks to Rui Paulo for the patch. I edited it slightly, but
    -    hopefully I didn't break anything.
    -
    - m4/tuklib_cpucores.m4        | 23 ++++++++++++++++++++++-
    - src/common/tuklib_cpucores.c | 18 ++++++++++++++++++
    - 2 files changed, 40 insertions(+), 1 deletion(-)
    -
    -commit eb61bc58c20769cac4d05f363b9c0e8c9c71a560
    -Author: Lasse Collin 
    -Date:   2015-02-09 22:08:37 +0200
    -
    -    xzdiff: Make the mktemp usage compatible with FreeBSD's mktemp.
    -    
    -    Thanks to Rui Paulo for the fix.
    -
    - src/scripts/xzdiff.in | 7 ++++++-
    - 1 file changed, 6 insertions(+), 1 deletion(-)
    -
    -commit b9a5b6b7a29029680af733082b6a46e0fc01623a
    -Author: Lasse Collin 
    -Date:   2015-02-03 21:45:53 +0200
    -
    -    Add a few casts to tuklib_integer.h to silence possible warnings.
    -    
    -    I heard that Visual Studio 2013 gave warnings without the casts.
    -    
    -    Thanks to Gabi Davar.
    -
    - src/common/tuklib_integer.h | 24 ++++++++++++------------
    - 1 file changed, 12 insertions(+), 12 deletions(-)
    -
    -commit c45757135f40e4a0de730ba5fff0100219493982
    -Author: Lasse Collin 
    -Date:   2015-01-26 21:24:39 +0200
    -
    -    liblzma: Set LZMA_MEMCMPLEN_EXTRA depending on the compare method.
    -
    - src/liblzma/common/memcmplen.h | 15 ++++++++++-----
    - 1 file changed, 10 insertions(+), 5 deletions(-)
    -
    -commit 3c500174ed5485f550972a2a6109c361e875f069
    -Author: Lasse Collin 
    -Date:   2015-01-26 20:40:16 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit fec88d41e672d9e197c9442aecf02bd0dfa6d516
    -Author: Lasse Collin 
    -Date:   2015-01-26 20:39:28 +0200
    -
    -    liblzma: Silence harmless Valgrind errors.
    -    
    -    Thanks to Torsten Rupp for reporting this. I had
    -    forgotten to run Valgrind before the 5.2.0 release.
    -
    - src/liblzma/lz/lz_encoder.c | 6 ++++++
    - 1 file changed, 6 insertions(+)
    -
    -commit a9b45badfec0928d20a27c7176c005fa637f7d1e
    -Author: Lasse Collin 
    -Date:   2015-01-09 21:50:19 +0200
    -
    -    xz: Fix comments.
    -
    - src/xz/file_io.c | 12 ++++++++----
    - 1 file changed, 8 insertions(+), 4 deletions(-)
    -
    -commit 541aee6dd4aa97a809aba281475a21b641bb89e2
    -Author: Lasse Collin 
    -Date:   2015-01-09 21:35:06 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 4170edc914655310d2363baccf5e615e09b04911
    -Author: Lasse Collin 
    -Date:   2015-01-09 21:34:06 +0200
    -
    -    xz: Don't fail if stdout doesn't support O_NONBLOCK.
    -    
    -    This is similar to the case with stdin.
    -    
    -    Thanks to Brad Smith for the bug report and testing
    -    on OpenBSD.
    -
    - src/xz/file_io.c | 36 +++++++++++++++---------------------
    - 1 file changed, 15 insertions(+), 21 deletions(-)
    -
    -commit 04bbc0c2843c50c8ad1cba42b937118e38b0508d
    -Author: Lasse Collin 
    -Date:   2015-01-07 19:18:20 +0200
    -
    -    xz: Fix a memory leak in DOS-specific code.
    -
    - src/xz/file_io.c | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit f0f1f6c7235ffa901cf76fe18e33749e200b3eea
    -Author: Lasse Collin 
    -Date:   2015-01-07 19:08:06 +0200
    -
    -    xz: Don't fail if stdin doesn't support O_NONBLOCK.
    -    
    -    It's a problem at least on OpenBSD which doesn't support
    -    O_NONBLOCK on e.g. /dev/null. I'm not surprised if it's
    -    a problem on other OSes too since this behavior is allowed
    -    in POSIX-1.2008.
    -    
    -    The code relying on this behavior was committed in June 2013
    -    and included in 5.1.3alpha released on 2013-10-26. Clearly
    -    the development releases only get limited testing.
    -
    - src/xz/file_io.c | 18 +++++++-----------
    - 1 file changed, 7 insertions(+), 11 deletions(-)
    -
    -commit d2d484647d9d9d679f03c75abb0404f67069271c
    -Author: Lasse Collin 
    -Date:   2015-01-06 20:30:15 +0200
    -
    -    Tests: Don't hide unexpected error messages in test_files.sh.
    -    
    -    Hiding them makes no sense since normally there's no error
    -    when testing the "good" files. With "bad" files errors are
    -    expected and then it makes sense to keep the messages hidden.
    -
    - tests/test_files.sh | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit aae6a6aeda51cf94a47e39ad624728f9bee75e30
    -Author: Lasse Collin 
    -Date:   2014-12-30 11:17:16 +0200
    -
    -    Update Solaris notes in INSTALL.
    -    
    -    Mention the possible "make check" failure on Solaris in the
    -    Solaris-specific section of INSTALL. It was already in
    -    section 4.5 but it is better mention it in the OS-specific
    -    section too.
    -
    - INSTALL | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 7815112153178800a3521b9f31960e7cdc26cfba
    -Author: Lasse Collin 
    -Date:   2014-12-26 12:00:05 +0200
    -
    -    Build: POSIX shell isn't required if scripts are disabled.
    -
    - INSTALL      | 3 ++-
    - configure.ac | 2 +-
    - 2 files changed, 3 insertions(+), 2 deletions(-)
    -
    -commit a0cd05ee71d330b79ead6eb9222e1b24e1559d3a
    -Author: Lasse Collin 
    -Date:   2014-12-21 20:48:37 +0200
    -
    -    DOS: Update Makefile.
    -
    - dos/Makefile | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit b85ee0905ec4ab7656d22e63519fdd3bedb21f2e
    -Author: Lasse Collin 
    -Date:   2014-12-21 19:50:38 +0200
    -
    -    Windows: Fix bin_i486 to bin_i686 in build.bash.
    -
    - windows/build.bash | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit cbafa710918195dbba3db02c3fab4f0538235206
    -Author: Lasse Collin 
    -Date:   2014-12-21 18:58:44 +0200
    -
    -    Docs: Use lzma_cputhreads() in 04_compress_easy_mt.c.
    -
    - doc/examples/04_compress_easy_mt.c | 30 ++++++++++++++++++++++++++----
    - 1 file changed, 26 insertions(+), 4 deletions(-)
    -
    -commit 8dbb57238d372c7263cfeb3e7f7fd9a73173156a
    -Author: Lasse Collin 
    -Date:   2014-12-21 18:56:44 +0200
    -
    -    Docs: Update docs/examples/00_README.txt.
    -
    - doc/examples/00_README.txt | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 6060f7dc76fd6c2a8a1f8e85d0e4d86bb78273e6
    -Author: Lasse Collin 
    -Date:   2014-12-21 18:11:17 +0200
    -
    -    Bump version and soname for 5.2.0.
    -    
    -    I know that soname != app version, but I skip AGE=1
    -    in -version-info to make the soname match the liblzma
    -    version anyway. It doesn't hurt anything as long as
    -    it doesn't conflict with library versioning rules.
    -
    - src/liblzma/Makefile.am        | 2 +-
    - src/liblzma/api/lzma/version.h | 6 +++---
    - src/liblzma/liblzma.map        | 2 +-
    - 3 files changed, 5 insertions(+), 5 deletions(-)
    -
    -commit 3e8bd1d15e417f2d588e9be50ce027ee3d48b2da
    -Author: Lasse Collin 
    -Date:   2014-12-21 18:05:03 +0200
    -
    -    Avoid variable-length arrays in the debug programs.
    -
    - debug/full_flush.c | 3 ++-
    - debug/sync_flush.c | 3 ++-
    - 2 files changed, 4 insertions(+), 2 deletions(-)
    -
    -commit 72f7307cfdceb941aeb2bf30d424cc0d13621786
    -Author: Lasse Collin 
    -Date:   2014-12-21 18:01:45 +0200
    -
    -    Build: Include 04_compress_easy_mt.c in the tarball.
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 2cb82ff21c62def11f3683a8bb0aaf363102aaa0
    -Author: Lasse Collin 
    -Date:   2014-12-21 18:00:38 +0200
    -
    -    Fix build when --disable-threads is used.
    -
    - src/common/mythread.h | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 9b9e3536e458ef958f66b0e8982efc9d36de4d17
    -Author: Adrien Nader 
    -Date:   2014-12-21 15:56:15 +0100
    -
    -    po/fr: improve wording for help for --lzma1/--lzma2.
    -
    - po/fr.po | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit a8b6b569e7fadbf5b5b9139d53bc764015c15027
    -Author: Adrien Nader 
    -Date:   2014-12-21 15:55:48 +0100
    -
    -    po/fr: missing line in translation of --extreme.
    -
    - po/fr.po | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit f168a6fd1a888cf4f0caaddcafcb21dadc6ab6e9
    -Author: Lasse Collin 
    -Date:   2014-12-21 14:32:33 +0200
    -
    -    Update NEWS for 5.2.0.
    -
    - NEWS | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 65 insertions(+)
    -
    -commit cec2ee863b3a88f4bf039cb00f73c4a4fc93a429
    -Author: Lasse Collin 
    -Date:   2014-12-21 14:32:22 +0200
    -
    -    Update NEWS for 5.0.8.
    -
    - NEWS | 12 ++++++++++++
    - 1 file changed, 12 insertions(+)
    -
    -commit 42e97a32649bf53ce43be2258b902a417c6e7fa1
    -Author: Lasse Collin 
    -Date:   2014-12-21 14:07:54 +0200
    -
    -    xz: Fix a comment.
    -
    - src/xz/options.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 29b95d5d6665cedffa6a9d6d3d914f981e852182
    -Author: Lasse Collin 
    -Date:   2014-12-20 20:43:14 +0200
    -
    -    Update INSTALL about the dependencies of the scripts.
    -
    - INSTALL | 15 ++++++++++-----
    - 1 file changed, 10 insertions(+), 5 deletions(-)
    -
    -commit 3af91040bb42c21afbb81f5568c3313125e61192
    -Author: Lasse Collin 
    -Date:   2014-12-20 20:42:33 +0200
    -
    -    Windows: Update build instructions.
    -
    - INSTALL                     | 15 +++++++++------
    - windows/INSTALL-Windows.txt | 44 +++++++++++++++++++++-----------------------
    - 2 files changed, 30 insertions(+), 29 deletions(-)
    -
    -commit 0152f72bf6289d744823dc6c849538f3a139ad70
    -Author: Lasse Collin 
    -Date:   2014-12-20 20:41:48 +0200
    -
    -    Windows: Update the build script and README-Windows.txt.
    -    
    -    The 32-bit build is now for i686 or newer because the
    -    prebuilt MinGW-w64 toolchains include i686 code in the
    -    executables even if one uses -march=i486.
    -    
    -    The build script builds 32-bit SSE2 enabled version too.
    -    Run-time detection of SSE2 support would be nice (on any OS)
    -    but it's not implemented in XZ Utils yet.
    -
    - windows/README-Windows.txt | 30 ++++++++++++++++--------------
    - windows/build.bash         | 23 ++++++++++++++---------
    - 2 files changed, 30 insertions(+), 23 deletions(-)
    -
    -commit 4a1f6133ee5533cee8d91e06fcc22443e5f1881a
    -Author: Lasse Collin 
    -Date:   2014-12-19 15:51:50 +0200
    -
    -    Windows: Define TUKLIB_SYMBOL_PREFIX in config.h.
    -    
    -    It is to keep all symbols in the lzma_ namespace.
    -
    - windows/config.h | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 7f7d093de79eee0c7dbfd7433647e46302f19f82
    -Author: Lasse Collin 
    -Date:   2014-12-16 21:00:09 +0200
    -
    -    xz: Update the man page about --threads.
    -
    - src/xz/xz.1 | 5 -----
    - 1 file changed, 5 deletions(-)
    -
    -commit 009823448b82aa5f465668878a544c5842885407
    -Author: Lasse Collin 
    -Date:   2014-12-16 20:57:43 +0200
    -
    -    xz: Update the man page about --block-size.
    -
    - src/xz/xz.1 | 41 +++++++++++++++++++++++++++++++++--------
    - 1 file changed, 33 insertions(+), 8 deletions(-)
    -
    -commit 7dddfbeb499e528940bc12047355c184644aafe9
    -Author: Adrien Nader 
    -Date:   2014-12-10 22:26:57 +0100
    -
    -    po/fr: several more translation updates: reword and handle --ignore-check.
    -
    - po/fr.po | 50 ++++++++++++++++++++++++++------------------------
    - 1 file changed, 26 insertions(+), 24 deletions(-)
    -
    -commit 6eca5be40e04ddc4b738d493e4e56835956d8b69
    -Author: Adrien Nader 
    -Date:   2014-12-10 22:23:01 +0100
    -
    -    po/fr: yet another place where my email address had to be updated.
    -
    - po/fr.po | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit d1003673e92ba47edd6aeeb3dbea05c18269d0e7
    -Author: Adrien Nader 
    -Date:   2014-12-10 22:22:20 +0100
    -
    -    po/fr: fix several typos that have been around since the beginning.
    -
    - po/fr.po | 22 +++++++++++-----------
    - 1 file changed, 11 insertions(+), 11 deletions(-)
    -
    -commit 4c5aa911a0df027e46171e368debc543d2fa72b2
    -Author: Adrien Nader 
    -Date:   2014-12-03 20:02:31 +0100
    -
    -    po/fr: last batch of new translations for now.
    -    
    -    Four new error messages.
    -
    - po/fr.po | 16 ++++++++--------
    - 1 file changed, 8 insertions(+), 8 deletions(-)
    -
    -commit 3e3099e36d27059499e7996fb38a62e8ab01d356
    -Author: Adrien Nader 
    -Date:   2014-12-03 20:01:32 +0100
    -
    -    po/fr: translations for --threads, --block-size and --block-list.
    -
    - po/fr.po | 12 ++++++++----
    - 1 file changed, 8 insertions(+), 4 deletions(-)
    -
    -commit e7d96a5933eec4e9d4a62569ee88df0ebb0f1d53
    -Author: Adrien Nader 
    -Date:   2014-12-03 20:00:53 +0100
    -
    -    po/fr: remove fuzzy marker for error messages that will be kept in English.
    -    
    -    The following is a copy of a comment inside fr.po:
    -    
    -    Note from translator on "file status flags".
    -    The following entry is kept un-translated on purpose. It is difficult to
    -    translate and should only happen in exceptional circumstances which means
    -    that translating would:
    -    - lose some of the meaning
    -    - make it more difficult to look up in search engines; it might happen one
    -    in
    -    a million times, if we dilute the error message in 20 languages, it will be
    -    almost impossible to find an explanation and support for the error.
    -
    - po/fr.po | 22 ++++++++++++++++------
    - 1 file changed, 16 insertions(+), 6 deletions(-)
    -
    -commit 46cbb9033af8a21fafe543302d6919746e0d72af
    -Author: Adrien Nader 
    -Date:   2014-12-03 19:58:25 +0100
    -
    -    po/fr: several minor updates and better wording.
    -    
    -    Meaning doesn't change at all: it's only for better wording and/or
    -    formatting of a few strings.
    -
    - po/fr.po | 14 +++++++-------
    - 1 file changed, 7 insertions(+), 7 deletions(-)
    -
    -commit 7ce49d444f04e73145f79c832eb4d510594b074a
    -Author: Adrien Nader 
    -Date:   2014-12-03 19:56:12 +0100
    -
    -    po/fr: update my email address and copyright years.
    -
    - po/fr.po | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 214c553ebc3047cd720da1ce5c80cf7c38118d3c
    -Author: Adrien Nader 
    -Date:   2014-11-26 10:08:26 +0100
    -
    -    fr.po: commit file after only "update-po" so actual is readable.
    -
    - po/fr.po | 311 ++++++++++++++++++++++++++++++++++++++++-----------------------
    - 1 file changed, 199 insertions(+), 112 deletions(-)
    -
    -commit 1190c641af09cde85f8bd0fbe5c4906f4a29431b
    -Author: Lasse Collin 
    -Date:   2014-12-02 20:04:07 +0200
    -
    -    liblzma: Document how lzma_mt.block_size affects memory usage.
    -
    - src/liblzma/api/lzma/container.h | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit e4fc1d2f9571fba79ce383595be2ea2a9257def0
    -Author: Lasse Collin 
    -Date:   2014-11-28 20:07:18 +0200
    -
    -    Update INSTALL about a "make check" failure in test_scripts.sh.
    -
    - INSTALL | 24 +++++++++++++++++-------
    - 1 file changed, 17 insertions(+), 7 deletions(-)
    -
    -commit 34f9e40a0a0c3bd2c2730cdb9cd550bbb8a3f2fe
    -Author: Lasse Collin 
    -Date:   2014-11-26 20:12:27 +0200
    -
    -    Remove LZMA_UNSTABLE macro.
    -
    - src/liblzma/api/lzma/container.h | 4 ----
    - src/liblzma/common/common.h      | 2 --
    - src/xz/private.h                 | 1 -
    - 3 files changed, 7 deletions(-)
    -
    -commit 6d9c0ce9f2677b159e32b224aba5b535b304a705
    -Author: Lasse Collin 
    -Date:   2014-11-26 20:10:33 +0200
    -
    -    liblzma: Update lzma_stream_encoder_mt() API docs.
    -
    - src/liblzma/api/lzma/container.h | 5 +++--
    - 1 file changed, 3 insertions(+), 2 deletions(-)
    -
    -commit 2301f3f05dd9742f42cda8f0f318864f5dc39ab3
    -Author: Lasse Collin 
    -Date:   2014-11-25 12:32:05 +0200
    -
    -    liblzma: Verify the filter chain in threaded encoder initialization.
    -    
    -    This way an invalid filter chain is detected at the Stream
    -    encoder initialization instead of delaying it to the first
    -    call to lzma_code() which triggers the initialization of
    -    the actual filter encoder(s).
    -
    - src/liblzma/common/stream_encoder_mt.c | 9 ++++++---
    - 1 file changed, 6 insertions(+), 3 deletions(-)
    -
    -commit 107a263d5bb63cd3593fd6a5c938706539f84523
    -Author: Lasse Collin 
    -Date:   2014-11-17 19:11:49 +0200
    -
    -    Build: Update m4/ax_pthread.m4 from Autoconf Archive.
    -
    - m4/ax_pthread.m4 | 71 +++++++++++++++++++++++++++++++++++++-------------------
    - 1 file changed, 47 insertions(+), 24 deletions(-)
    -
    -commit b13a781833399ff5726cfc997f3cb2f0acbdbf31
    -Author: Lasse Collin 
    -Date:   2014-11-17 18:52:21 +0200
    -
    -    Build: Replace obsolete AC_HELP_STRING with AS_HELP_STRING.
    -
    - configure.ac         | 36 ++++++++++++++++++------------------
    - m4/tuklib_integer.m4 |  2 +-
    - 2 files changed, 19 insertions(+), 19 deletions(-)
    -
    -commit 542cac122ed3550148a2af0033af22b757491378
    -Author: Lasse Collin 
    -Date:   2014-11-17 18:43:19 +0200
    -
    -    Build: Fix Autoconf warnings about escaped backquotes.
    -    
    -    Thanks to Daniel Richard G. for pointing out that it's
    -    good to sometimes run autoreconf -fi with -Wall.
    -
    - configure.ac | 7 +++----
    - 1 file changed, 3 insertions(+), 4 deletions(-)
    -
    -commit 7b03a15cea8cd4f19ed680b51c4bcbae3ce4142f
    -Author: Lasse Collin 
    -Date:   2014-11-10 18:54:40 +0200
    -
    -    xzdiff: Use mkdir if mktemp isn't available.
    -
    - src/scripts/xzdiff.in | 17 ++++++++++++++++-
    - 1 file changed, 16 insertions(+), 1 deletion(-)
    -
    -commit f8c13e5e3609581d5dd9f8777985ca07f2390ad7
    -Author: Lasse Collin 
    -Date:   2014-11-10 18:45:01 +0200
    -
    -    xzdiff: Create a temporary directory to hold a temporary file.
    -    
    -    This avoids the possibility of "File name too long" when
    -    creating a temp file when the input file name is very long.
    -    
    -    This also means that other users on the system can no longer
    -    see the input file names in /tmp (or whatever $TMPDIR is)
    -    since the temporary directory will have a generic name. This
    -    usually doesn't matter since on many systems one can see
    -    the arguments given to all processes anyway.
    -    
    -    The number X chars to mktemp where increased from 6 to 10.
    -    
    -    Note that with some shells temp files or dirs won't be used at all.
    -
    - src/scripts/xzdiff.in | 10 +++++-----
    - 1 file changed, 5 insertions(+), 5 deletions(-)
    -
    -commit 7716dcf9df7f457500cb657314e7a9aea5fedb06
    -Author: Lasse Collin 
    -Date:   2014-11-10 15:38:47 +0200
    -
    -    liblzma: Fix lzma_mt.preset in lzma_stream_encoder_mt_memusage().
    -    
    -    It read the filter chain from a wrong variable. This is a similar
    -    bug that was fixed in 9494fb6d0ff41c585326f00aa8f7fe58f8106a5e.
    -
    - src/liblzma/common/stream_encoder_mt.c | 3 +--
    - 1 file changed, 1 insertion(+), 2 deletions(-)
    -
    -commit 230fa4a605542c84b4178a57381695a0af4e779b
    -Author: Lasse Collin 
    -Date:   2014-11-10 14:49:55 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 4e4ae08bc7c1711e399c9f2d26eb375d39d08101
    -Author: Lasse Collin 
    -Date:   2014-10-29 21:28:25 +0200
    -
    -    Update .gitignore files.
    -
    - .gitignore    | 2 ++
    - m4/.gitignore | 3 +++
    - 2 files changed, 5 insertions(+)
    -
    -commit c923b140b27d1a055db6284e10fd546ad1a7fcdb
    -Author: Lasse Collin 
    -Date:   2014-10-29 21:15:35 +0200
    -
    -    Build: Prepare to support Automake's subdir-objects.
    -    
    -    Due to a bug in Automake, subdir-objects won't be enabled
    -    for now.
    -    
    -    http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17354
    -    
    -    Thanks to Daniel Richard G. for the original patches.
    -
    - configure.ac             |  7 ++++++-
    - src/Makefile.am          | 22 +++++++++++++++++++++-
    - src/liblzma/Makefile.am  |  4 ++--
    - src/lzmainfo/Makefile.am |  4 ++--
    - src/xz/Makefile.am       | 10 +++++-----
    - src/xzdec/Makefile.am    |  8 ++++----
    - 6 files changed, 40 insertions(+), 15 deletions(-)
    -
    -commit 08c2aa16bea0df82828f665d51fba2e0a5e8997f
    -Author: Lasse Collin 
    -Date:   2014-10-24 20:09:29 +0300
    -
    -    Translations: Update the Italian translation.
    -    
    -    Thanks to Milo Casagrande.
    -
    - po/it.po | 452 ++++++++++++++++++++++++++++++++++++++-------------------------
    - 1 file changed, 275 insertions(+), 177 deletions(-)
    -
    -commit 2f9f61aa83539c54ff6c118a2693890f0519b3dd
    -Author: Lasse Collin 
    -Date:   2014-10-18 18:51:45 +0300
    -
    -    Translations: Update the Polish translation.
    -    
    -    Thanks to Jakub Bogusz.
    -
    - po/pl.po | 332 ++++++++++++++++++++++++++++++++++++++++-----------------------
    - 1 file changed, 214 insertions(+), 118 deletions(-)
    -
    -commit 4f9d233f67aea25e532824d11b7642cf7dee7a76
    -Author: Andre Noll 
    -Date:   2014-10-14 17:30:30 +0200
    -
    -    l10n: de.po: Change translator email address.
    -    
    -    Although the old address is still working, the new one should
    -    be preferred. So this commit changes all three places in de.po
    -    accordingly.
    -    
    -    Signed-off-by: Andre Noll 
    -
    - po/de.po | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 00502b2bedad43f0cc167ac17ae0608837ee196b
    -Author: Andre Noll 
    -Date:   2014-10-14 17:30:29 +0200
    -
    -    l10n: de.po: Update German translation
    -    
    -    Signed-off-by: Andre Noll 
    -
    - po/de.po | 531 +++++++++++++++++++++++++++++++++------------------------------
    - 1 file changed, 281 insertions(+), 250 deletions(-)
    -
    -commit 706b0496753fb609e69f1570ec603f11162189d1
    -Author: Andre Noll 
    -Date:   2014-10-14 17:30:28 +0200
    -
    -    l10n: de.po: Fix typo: Schießen -> Schließen.
    -    
    -    That's a funny one since "schießen" means to shoot :)
    -    
    -    Signed-off-by: Andre Noll 
    -
    - po/de.po | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 7c32e6a935c3d7ee366abad1679bd5f322f0c7d4
    -Author: Lasse Collin 
    -Date:   2014-10-09 19:42:26 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 076258cc458f1e705041ac7a729b15ffe8c5214a
    -Author: Lasse Collin 
    -Date:   2014-10-09 19:41:51 +0300
    -
    -    Add support for AmigaOS/AROS to tuklib_physmem().
    -    
    -    Thanks to Fredrik Wikstrom.
    -
    - m4/tuklib_physmem.m4        | 3 ++-
    - src/common/tuklib_physmem.c | 7 +++++++
    - 2 files changed, 9 insertions(+), 1 deletion(-)
    -
    -commit efa7b0a210e1baa8e128fc98c5443a944c39ad24
    -Author: Lasse Collin 
    -Date:   2014-10-09 18:42:14 +0300
    -
    -    xzgrep: Avoid passing both -q and -l to grep.
    -    
    -    The behavior of grep -ql varies:
    -      - GNU grep behaves like grep -q.
    -      - OpenBSD grep behaves like grep -l.
    -    
    -    POSIX doesn't make it 100 % clear what behavior is expected.
    -    Anyway, using both -q and -l at the same time makes no sense
    -    so both options simply should never be used at the same time.
    -    
    -    Thanks to Christian Weisgerber.
    -
    - src/scripts/xzgrep.in | 6 ++++--
    - 1 file changed, 4 insertions(+), 2 deletions(-)
    -
    -commit 9c5f76098c9986b48d2fc574a0b764f4cde0c538
    -Author: Trần Ngá»c Quân 
    -Date:   2014-09-25 09:22:45 +0700
    -
    -    l10n: vi.po: Update Vietnamese translation
    -    
    -    Signed-off-by: Trần Ngá»c Quân 
    -
    - po/vi.po | 136 +++++++++++++++++++++++++++++++++++++++------------------------
    - 1 file changed, 84 insertions(+), 52 deletions(-)
    -
    -commit c4911f2db36d811896c73c008b4218d8fa9a4730
    -Author: Lasse Collin 
    -Date:   2014-09-25 18:38:48 +0300
    -
    -    Build: Detect supported compiler warning flags better.
    -    
    -    Clang and nowadays also GCC accept any -Wfoobar option
    -    but then may give a warning that an unknown warning option
    -    was specified. To avoid adding unsupported warning options,
    -    the options are now tested with -Werror.
    -    
    -    Thanks to Charles Diza.
    -
    - configure.ac | 5 +++--
    - 1 file changed, 3 insertions(+), 2 deletions(-)
    -
    -commit 76e75522ed6f5c228d55587dee5a997893f6e474
    -Author: Lasse Collin 
    -Date:   2014-09-20 21:01:21 +0300
    -
    -    Update NEWS for 5.0.7.
    -
    - NEWS | 11 +++++++++++
    - 1 file changed, 11 insertions(+)
    -
    -commit d62028b4c1174fc67b6929f126f5eb24c018c700
    -Author: Lasse Collin 
    -Date:   2014-09-20 19:42:56 +0300
    -
    -    liblzma: Fix a portability problem in Makefile.am.
    -    
    -    POSIX supports $< only in inference rules (suffix rules).
    -    Using it elsewhere is a GNU make extension and doesn't
    -    work e.g. with OpenBSD make.
    -    
    -    Thanks to Christian Weisgerber for the patch.
    -
    - src/liblzma/Makefile.am | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit c35de31d4283edad3e57d37ffe939406542cb7bb
    -Author: Lasse Collin 
    -Date:   2014-09-14 21:54:09 +0300
    -
    -    Bump the version number to 5.1.4beta.
    -
    - src/liblzma/api/lzma/version.h | 4 ++--
    - src/liblzma/liblzma.map        | 2 +-
    - 2 files changed, 3 insertions(+), 3 deletions(-)
    -
    -commit e9e097e22cacdaa23e5414fea7913535449cb340
    -Author: Lasse Collin 
    -Date:   2014-09-14 21:50:13 +0300
    -
    -    Update NEWS for 5.0.6 and 5.1.4beta.
    -
    - NEWS | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 50 insertions(+)
    -
    -commit 642f856bb8562ab66704b1e01ac7bc08b6d0a663
    -Author: Lasse Collin 
    -Date:   2014-09-14 21:02:41 +0300
    -
    -    Update TODO.
    -
    - TODO | 38 ++++++++++++++++++++++++++++++++++----
    - 1 file changed, 34 insertions(+), 4 deletions(-)
    -
    -commit 6b5e3b9eff5b8cedb2aac5f524d4d60fc8a48124
    -Author: Lasse Collin 
    -Date:   2014-08-05 22:32:36 +0300
    -
    -    xz: Add --ignore-check.
    -
    - src/xz/args.c    |  7 +++++++
    - src/xz/args.h    |  1 +
    - src/xz/coder.c   | 10 +++++++++-
    - src/xz/message.c |  2 ++
    - src/xz/xz.1      | 19 +++++++++++++++++++
    - 5 files changed, 38 insertions(+), 1 deletion(-)
    -
    -commit 9adbc2ff373f979c917cdfd3679ce0ebd59f1040
    -Author: Lasse Collin 
    -Date:   2014-08-05 22:15:07 +0300
    -
    -    liblzma: Add support for LZMA_IGNORE_CHECK.
    -
    - src/liblzma/api/lzma/container.h    | 24 ++++++++++++++++++++++++
    - src/liblzma/common/common.h         |  1 +
    - src/liblzma/common/stream_decoder.c | 14 ++++++++++++--
    - 3 files changed, 37 insertions(+), 2 deletions(-)
    -
    -commit 0e0f34b8e4f1c60ecaec15c2105982381cc9c3e6
    -Author: Lasse Collin 
    -Date:   2014-08-05 22:03:30 +0300
    -
    -    liblzma: Add support for lzma_block.ignore_check.
    -    
    -    Note that this slightly changes how lzma_block_header_decode()
    -    has been documented. Earlier it said that the .version is set
    -    to the lowest required value, but now it says that the .version
    -    field is kept unchanged if possible. In practice this doesn't
    -    affect any old code, because before this commit the only
    -    possible .version was 0.
    -
    - src/liblzma/api/lzma/block.h              | 50 ++++++++++++++++++++++++-------
    - src/liblzma/common/block_buffer_encoder.c |  2 +-
    - src/liblzma/common/block_decoder.c        | 18 ++++++++---
    - src/liblzma/common/block_encoder.c        |  2 +-
    - src/liblzma/common/block_header_decoder.c | 12 ++++++--
    - src/liblzma/common/block_header_encoder.c |  2 +-
    - src/liblzma/common/block_util.c           |  2 +-
    - 7 files changed, 68 insertions(+), 20 deletions(-)
    -
    -commit 71e1437ab585b46f7a25f5a131557d3d1c0cbaa2
    -Author: Lasse Collin 
    -Date:   2014-08-04 19:25:58 +0300
    -
    -    liblzma: Use lzma_memcmplen() in the BT3 match finder.
    -    
    -    I had missed this when writing the commit
    -    5db75054e900fa06ef5ade5f2c21dffdd5d16141.
    -    
    -    Thanks to Jun I Jin.
    -
    - src/liblzma/lz/lz_encoder_mf.c | 5 ++---
    - 1 file changed, 2 insertions(+), 3 deletions(-)
    -
    -commit 41dc9ea06e1414ebe8ef52afc8fc15b6e3282b04
    -Author: Lasse Collin 
    -Date:   2014-08-04 00:25:44 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 5dcffdbcc23a68abc3ac3539b30be71bc9b5af84
    -Author: Lasse Collin 
    -Date:   2014-08-03 21:32:25 +0300
    -
    -    liblzma: SHA-256: Optimize the Maj macro slightly.
    -    
    -    The Maj macro is used where multiple things are added
    -    together, so making Maj a sum of two expressions allows
    -    some extra freedom for the compiler to schedule the
    -    instructions.
    -    
    -    I learned this trick from
    -    .
    -
    - src/liblzma/check/sha256.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit a9477d1e0c6fd0e47e637d051e7b9e2a5d9af517
    -Author: Lasse Collin 
    -Date:   2014-08-03 21:08:12 +0300
    -
    -    liblzma: SHA-256: Optimize the way rotations are done.
    -    
    -    This looks weird because the rotations become sequential,
    -    but it helps quite a bit on both 32-bit and 64-bit x86:
    -    
    -      - It requires fewer instructions on two-operand
    -        instruction sets like x86.
    -    
    -      - It requires one register less which matters especially
    -        on 32-bit x86.
    -    
    -    I hope this doesn't hurt other archs.
    -    
    -    I didn't invent this idea myself, but I don't remember where
    -    I saw it first.
    -
    - src/liblzma/check/sha256.c | 17 +++++++++++------
    - 1 file changed, 11 insertions(+), 6 deletions(-)
    -
    -commit 5a76c7c8ee9a0afbeedb1c211db9224260404347
    -Author: Lasse Collin 
    -Date:   2014-08-03 20:38:13 +0300
    -
    -    liblzma: SHA-256: Remove the GCC #pragma that became unneeded.
    -    
    -    The unrolling in the previous commit should avoid the
    -    situation where a compiler may think that an uninitialized
    -    variable might be accessed.
    -
    - src/liblzma/check/sha256.c | 5 -----
    - 1 file changed, 5 deletions(-)
    -
    -commit 9a096f8e57509775c331950b8351bbca77bdcfa8
    -Author: Lasse Collin 
    -Date:   2014-08-03 20:33:38 +0300
    -
    -    liblzma: SHA-256: Unroll a little more.
    -    
    -    This way a branch isn't needed for each operation
    -    to choose between blk0 and blk2, and still the code
    -    doesn't grow as much as it would with full unrolling.
    -
    - src/liblzma/check/sha256.c | 25 ++++++++++++++++---------
    - 1 file changed, 16 insertions(+), 9 deletions(-)
    -
    -commit bc7650d87bf27f85f1a2a806dc2db1780e09e6a5
    -Author: Lasse Collin 
    -Date:   2014-08-03 19:56:43 +0300
    -
    -    liblzma: SHA-256: Do the byteswapping without a temporary buffer.
    -
    - src/liblzma/check/sha256.c | 13 +------------
    - 1 file changed, 1 insertion(+), 12 deletions(-)
    -
    -commit 544aaa3d13554e8640f9caf7db717a96360ec0f6
    -Author: Lasse Collin 
    -Date:   2014-07-25 22:38:28 +0300
    -
    -    liblzma: Use lzma_memcmplen() in normal mode of LZMA.
    -    
    -    Two locations were not changed yet because the simplest change
    -    assumes that the initial "len" may be greater than "limit".
    -
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c | 20 +++++---------------
    - 1 file changed, 5 insertions(+), 15 deletions(-)
    -
    -commit f48fce093b07aeda95c18850f5e086d9f2383380
    -Author: Lasse Collin 
    -Date:   2014-07-25 22:30:38 +0300
    -
    -    liblzma: Simplify LZMA fast mode code by using memcmp().
    -
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c | 11 +----------
    - 1 file changed, 1 insertion(+), 10 deletions(-)
    -
    -commit 6bf5308e34e23dede5b301b1b9b4f131dacd9218
    -Author: Lasse Collin 
    -Date:   2014-07-25 22:29:49 +0300
    -
    -    liblzma: Use lzma_memcmplen() in fast mode of LZMA.
    -
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 353212137e51e45b105a3a3fc2e6879f1cf0d492
    -Author: Lasse Collin 
    -Date:   2014-07-25 21:16:23 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 5db75054e900fa06ef5ade5f2c21dffdd5d16141
    -Author: Lasse Collin 
    -Date:   2014-07-25 21:15:07 +0300
    -
    -    liblzma: Use lzma_memcmplen() in the match finders.
    -    
    -    This doesn't change the match finder output.
    -
    - src/liblzma/lz/lz_encoder.c    | 13 ++++++++++++-
    - src/liblzma/lz/lz_encoder_mf.c | 33 +++++++++++----------------------
    - 2 files changed, 23 insertions(+), 23 deletions(-)
    -
    -commit e1c8f1d01f4a4e2136173edab2dc63c71ef038f4
    -Author: Lasse Collin 
    -Date:   2014-07-25 20:57:20 +0300
    -
    -    liblzma: Add lzma_memcmplen() for fast memory comparison.
    -    
    -    This commit just adds the function. Its uses will be in
    -    separate commits.
    -    
    -    This hasn't been tested much yet and it's perhaps a bit early
    -    to commit it but if there are bugs they should get found quite
    -    quickly.
    -    
    -    Thanks to Jun I Jin from Intel for help and for pointing out
    -    that string comparison needs to be optimized in liblzma.
    -
    - configure.ac                    |  13 +++
    - src/liblzma/common/Makefile.inc |   1 +
    - src/liblzma/common/memcmplen.h  | 170 ++++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 184 insertions(+)
    -
    -commit 765735cf52e5123586e74a51b9c073b5257f631f
    -Author: Lasse Collin 
    -Date:   2014-07-12 21:10:09 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 59da01785ef66c7e62f36e70ca808fd2824bb995
    -Author: Lasse Collin 
    -Date:   2014-07-12 20:06:08 +0300
    -
    -    Translations: Add Vietnamese translation.
    -    
    -    Thanks to Trần Ngá»c Quân.
    -
    - po/LINGUAS |    1 +
    - po/vi.po   | 1007 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 1008 insertions(+)
    -
    -commit 17215f751c354852700e7f8592ccf319570a0721
    -Author: Lasse Collin 
    -Date:   2014-06-29 20:54:14 +0300
    -
    -    xz: Update the help message of a few options.
    -    
    -    Updated: --threads, --block-size, and --block-list
    -    Added: --flush-timeout
    -
    - src/xz/message.c | 18 +++++++++++-------
    - 1 file changed, 11 insertions(+), 7 deletions(-)
    -
    -commit 96864a6ddf91ad693d102ea165f3d7918744d582
    -Author: Lasse Collin 
    -Date:   2014-06-18 22:07:06 +0300
    -
    -    xz: Use lzma_cputhreads() instead of own copy of tuklib_cpucores().
    -
    - src/xz/Makefile.am |  1 -
    - src/xz/hardware.c  | 12 +++++++++---
    - 2 files changed, 9 insertions(+), 4 deletions(-)
    -
    -commit a115cc3748482e277f42a968baa3cd266f031dba
    -Author: Lasse Collin 
    -Date:   2014-06-18 22:04:24 +0300
    -
    -    liblzma: Add lzma_cputhreads().
    -
    - src/liblzma/Makefile.am                  |  8 +++++++-
    - src/liblzma/api/lzma/hardware.h          | 14 ++++++++++++++
    - src/liblzma/common/Makefile.inc          |  1 +
    - src/liblzma/common/hardware_cputhreads.c | 22 ++++++++++++++++++++++
    - src/liblzma/liblzma.map                  |  1 +
    - 5 files changed, 45 insertions(+), 1 deletion(-)
    -
    -commit 3ce3e7976904fbab4e6482bafa442856f77a51fa
    -Author: Lasse Collin 
    -Date:   2014-06-18 19:11:52 +0300
    -
    -    xz: Check for filter chain compatibility for --flush-timeout.
    -    
    -    This avoids LZMA_PROG_ERROR from lzma_code() with filter chains
    -    that don't support LZMA_SYNC_FLUSH.
    -
    - src/xz/coder.c | 30 +++++++++++++++++++++---------
    - 1 file changed, 21 insertions(+), 9 deletions(-)
    -
    -commit 381ac14ed79e5d38809f251705be8b3193bba417
    -Author: Lasse Collin 
    -Date:   2014-06-13 19:21:54 +0300
    -
    -    xzgrep: List xzgrep_expected_output in tests/Makefile.am.
    -
    - tests/Makefile.am | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit 4244b65b06d5ecaf6f9dd0387ac7e3166bd2364e
    -Author: Lasse Collin 
    -Date:   2014-06-13 18:58:22 +0300
    -
    -    xzgrep: Improve the test script.
    -    
    -    Now it should be close to the functionality of the original
    -    version by Pavel Raiskup.
    -
    - tests/Makefile.am            |  3 ++-
    - tests/test_scripts.sh        | 24 ++++++++++++++----------
    - tests/xzgrep_expected_output | 39 +++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 55 insertions(+), 11 deletions(-)
    -
    -commit 1e60f2c0a0ee6c18b02943ce56214799a70aac26
    -Author: Lasse Collin 
    -Date:   2014-06-11 21:03:25 +0300
    -
    -    xzgrep: Add a test for the previous fix.
    -    
    -    This is a simplified version of Pavel Raiskup's
    -    original patch.
    -
    - tests/test_scripts.sh | 26 ++++++++++++++++++++++----
    - 1 file changed, 22 insertions(+), 4 deletions(-)
    -
    -commit ceca37901783988204caaf40dff4623d535cc789
    -Author: Lasse Collin 
    -Date:   2014-06-11 20:43:28 +0300
    -
    -    xzgrep: exit 0 when at least one file matches.
    -    
    -    Mimic the original grep behavior and return exit_success when
    -    at least one xz compressed file matches given pattern.
    -    
    -    Original bugreport:
    -    https://bugzilla.redhat.com/show_bug.cgi?id=1108085
    -    
    -    Thanks to Pavel Raiskup for the patch.
    -
    - src/scripts/xzgrep.in | 15 +++++++++++++--
    - 1 file changed, 13 insertions(+), 2 deletions(-)
    -
    -commit 8c19216baccb92d011694590df8a1262da2e980c
    -Author: Lasse Collin 
    -Date:   2014-06-09 21:21:24 +0300
    -
    -    xz: Force single-threaded mode when --flush-timeout is used.
    -
    - src/xz/coder.c | 11 +++++++++++
    - 1 file changed, 11 insertions(+)
    -
    -commit 87f1a24810805187d7bbc8ac5512e7eec307ddf5
    -Author: Lasse Collin 
    -Date:   2014-05-25 22:05:39 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit da1718f266fcfc091e7bf08aae1bc986d0e6cc6b
    -Author: Lasse Collin 
    -Date:   2014-05-25 21:45:56 +0300
    -
    -    liblzma: Use lzma_alloc_zero() in LZ encoder initialization.
    -    
    -    This avoids a memzero() call for a newly-allocated memory,
    -    which can be expensive when encoding small streams with
    -    an over-sized dictionary.
    -    
    -    To avoid using lzma_alloc_zero() for memory that doesn't
    -    need to be zeroed, lzma_mf.son is now allocated separately,
    -    which requires handling it separately in normalize() too.
    -    
    -    Thanks to Vincenzo Innocente for reporting the problem.
    -
    - src/liblzma/lz/lz_encoder.c    | 84 ++++++++++++++++++++++--------------------
    - src/liblzma/lz/lz_encoder.h    |  2 +-
    - src/liblzma/lz/lz_encoder_mf.c | 31 +++++++++-------
    - 3 files changed, 62 insertions(+), 55 deletions(-)
    -
    -commit 28af24e9cf2eb259997c85dce13d4c97b3daa47a
    -Author: Lasse Collin 
    -Date:   2014-05-25 19:25:57 +0300
    -
    -    liblzma: Add the internal function lzma_alloc_zero().
    -
    - src/liblzma/common/common.c | 21 +++++++++++++++++++++
    - src/liblzma/common/common.h |  6 ++++++
    - 2 files changed, 27 insertions(+)
    -
    -commit ed9ac85822c490e34b68c259afa0b385d21d1c40
    -Author: Lasse Collin 
    -Date:   2014-05-08 18:03:09 +0300
    -
    -    xz: Fix uint64_t vs. size_t which broke 32-bit build.
    -    
    -    Thanks to Christian Hesse.
    -
    - src/xz/coder.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit d716acdae3fa7996f9e68a7bac012e6d8d13dd02
    -Author: Lasse Collin 
    -Date:   2014-05-04 11:09:11 +0300
    -
    -    Docs: Update comments to refer to lzma/lzma12.h in example programs.
    -
    - doc/examples/03_compress_custom.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 4d5b7b3fda31241ca86ed35e08e73f776ee916e0
    -Author: Lasse Collin 
    -Date:   2014-05-04 11:07:17 +0300
    -
    -    liblzma: Rename the private API header lzma/lzma.h to lzma/lzma12.h.
    -    
    -    It can be confusing that two header files have the same name.
    -    The public API file is still lzma.h.
    -
    - src/liblzma/api/Makefile.am   |   2 +-
    - src/liblzma/api/lzma.h        |   2 +-
    - src/liblzma/api/lzma/lzma.h   | 420 ------------------------------------------
    - src/liblzma/api/lzma/lzma12.h | 420 ++++++++++++++++++++++++++++++++++++++++++
    - 4 files changed, 422 insertions(+), 422 deletions(-)
    -
    -commit 1555a9c5664afc7893a2b75e9970105437f01ef1
    -Author: Lasse Collin 
    -Date:   2014-04-25 17:53:42 +0300
    -
    -    Build: Fix the combination of --disable-xzdec --enable-lzmadec.
    -    
    -    In this case "make install" could fail if the man page directory
    -    didn't already exist at the destination. If it did exist, a
    -    dangling symlink was created there. Now the link is omitted
    -    instead. This isn't the best fix but it's better than the old
    -    behavior.
    -
    - src/xzdec/Makefile.am | 10 +++++++++-
    - 1 file changed, 9 insertions(+), 1 deletion(-)
    -
    -commit 56056571df3377eaa6ae6233b3ccc5d72e81d43d
    -Author: Lasse Collin 
    -Date:   2014-04-25 17:44:26 +0300
    -
    -    Build: Add --disable-doc to configure.
    -
    - INSTALL      | 6 ++++++
    - Makefile.am  | 2 ++
    - configure.ac | 6 ++++++
    - 3 files changed, 14 insertions(+)
    -
    -commit 6de61d8721097a6214810841aa85b08e303ac538
    -Author: Lasse Collin 
    -Date:   2014-04-24 18:06:24 +0300
    -
    -    Update INSTALL.
    -    
    -    Add a note about failing "make check". The source of
    -    the problem should be fixed in libtool (if it really is
    -    a libtool bug and not mine) but I'm unable to spend time
    -    on that for now. Thanks to Nelson H. F. Beebe for reporting
    -    the issue.
    -    
    -    Add a note about a possible need to run "ldconfig" after
    -    "make install".
    -
    - INSTALL | 25 +++++++++++++++++++++++++
    - 1 file changed, 25 insertions(+)
    -
    -commit 54df428799a8d853639b753d0e6784694d73eb3e
    -Author: Lasse Collin 
    -Date:   2014-04-09 17:26:10 +0300
    -
    -    xz: Rename a variable to avoid a namespace collision on Solaris.
    -    
    -    I don't know the details but I have an impression that there's
    -    no problem in practice if using GCC since people have built xz
    -    with GCC (without patching xz), but renaming the variable cannot
    -    hurt either.
    -    
    -    Thanks to Mark Ashley.
    -
    - src/xz/signals.c | 12 +++++++-----
    - 1 file changed, 7 insertions(+), 5 deletions(-)
    -
    -commit 5876ca27daa1429676b1160007d9688266907f00
    -Author: Lasse Collin 
    -Date:   2014-01-29 20:19:41 +0200
    -
    -    Docs: Add example program for threaded encoding.
    -    
    -    I didn't add -DLZMA_UNSTABLE to Makefile so one has to
    -    specify it manually as long as LZMA_UNSTABLE is needed.
    -
    - doc/examples/04_compress_easy_mt.c | 184 +++++++++++++++++++++++++++++++++++++
    - doc/examples/Makefile              |   3 +-
    - 2 files changed, 186 insertions(+), 1 deletion(-)
    -
    -commit 9494fb6d0ff41c585326f00aa8f7fe58f8106a5e
    -Author: Lasse Collin 
    -Date:   2014-01-29 20:13:51 +0200
    -
    -    liblzma: Fix lzma_mt.preset not working with lzma_stream_encoder_mt().
    -    
    -    It read the filter chain from a wrong variable.
    -
    - src/liblzma/common/stream_encoder_mt.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 673a4cb53de3a715685cb1b836da57a3c7dcd43c
    -Author: Lasse Collin 
    -Date:   2014-01-20 11:20:40 +0200
    -
    -    liblzma: Fix typo in a comment.
    -
    - src/liblzma/api/lzma/block.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit ad96a871a1470eb76d6233d3890ce9338047b7a3
    -Author: Lasse Collin 
    -Date:   2014-01-12 19:38:43 +0200
    -
    -    Windows: Add config.h for building liblzma with MSVC 2013.
    -    
    -    This is for building liblzma. Building xz tool too requires
    -    a little more work. Maybe it will be supported, but for most
    -    MSVC users it's enough to be able to build liblzma.
    -    
    -    C99 support in MSVC 2013 is almost usable which is a big
    -    improvement over earlier versions. It's "almost" because
    -    there's a dumb bug that breaks mixed declarations after
    -    an "if" statements unless the "if" statement uses braces:
    -    
    -    https://connect.microsoft.com/VisualStudio/feedback/details/808650/visual-studio-2013-c99-compiler-bug
    -    https://connect.microsoft.com/VisualStudio/feedback/details/808472/c99-support-of-mixed-declarations-and-statements-fails-with-certain-types-and-constructs
    -    
    -    Hopefully it will get fixed. Then liblzma should be
    -    compilable with MSVC 2013 without patching.
    -
    - windows/config.h | 139 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 139 insertions(+)
    -
    -commit 3d5c090872fab4212b57c290e8ed4d02c78c1737
    -Author: Lasse Collin 
    -Date:   2014-01-12 17:41:14 +0200
    -
    -    xz: Fix a comment.
    -
    - src/xz/coder.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 69fd4e1c932c7975476a0143c86e45d81b60d3f9
    -Author: Lasse Collin 
    -Date:   2014-01-12 17:04:33 +0200
    -
    -    Windows: Add MSVC defines for inline and restrict keywords.
    -
    - src/common/sysdefs.h | 10 ++++++++++
    - 1 file changed, 10 insertions(+)
    -
    -commit a19d9e8575ee6647cd9154cf1f20203f1330485f
    -Author: Lasse Collin 
    -Date:   2014-01-12 16:44:52 +0200
    -
    -    liblzma: Avoid C99 compound literal arrays.
    -    
    -    MSVC 2013 doesn't like them. Maybe they aren't so good
    -    for readability either since many aren't used to them.
    -
    - src/liblzma/lzma/lzma_encoder_presets.c | 8 +++++---
    - 1 file changed, 5 insertions(+), 3 deletions(-)
    -
    -commit e28528f1c867b2ed4ac91195ad08efb9bb8a6263
    -Author: Lasse Collin 
    -Date:   2014-01-12 12:50:30 +0200
    -
    -    liblzma: Remove a useless C99ism from sha256.c.
    -    
    -    Unsurprisingly it makes no difference in compiled output.
    -
    - src/liblzma/check/sha256.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 5ad1effc45adfb7dabc9a98e79736077e6b7e2d5
    -Author: Lasse Collin 
    -Date:   2014-01-12 12:17:08 +0200
    -
    -    xz: Fix use of wrong variable.
    -    
    -    Since the only call to suffix_set() uses optarg
    -    as the argument, fixing this bug doesn't change
    -    the behavior of the program.
    -
    - src/xz/suffix.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 3e62c68d75b5a3fdd46dbb34bb335d73289860d5
    -Author: Lasse Collin 
    -Date:   2014-01-12 12:11:36 +0200
    -
    -    Fix typos in comments.
    -
    - src/common/mythread.h          | 2 +-
    - src/liblzma/check/crc32_fast.c | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit e90ea601fb72867ec04adf456cbe4bf9520fd412
    -Author: Lasse Collin 
    -Date:   2013-11-26 18:20:16 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit b22e94d8d15764416354e04729382a7371ae2c30
    -Author: Lasse Collin 
    -Date:   2013-11-26 18:20:09 +0200
    -
    -    liblzma: Document the need for block->check for lzma_block_header_decode().
    -    
    -    Thanks to Tomer Chachamu.
    -
    - src/liblzma/api/lzma/block.h | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit d1cd8b1cb824b72421d1ee370e628024d2fcbec4
    -Author: Lasse Collin 
    -Date:   2013-11-12 16:38:57 +0200
    -
    -    xz: Update the man page about --block-size and --block-list.
    -
    - src/xz/xz.1 | 24 +++++++++++++++---------
    - 1 file changed, 15 insertions(+), 9 deletions(-)
    -
    -commit 76be7c612e6bcc38724488ccc3b8bcb1cfec9f0a
    -Author: Lasse Collin 
    -Date:   2013-11-12 16:30:53 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit dd750acbe2259d75444ef0f8da2d4bacc90d7afc
    -Author: Lasse Collin 
    -Date:   2013-11-12 16:29:48 +0200
    -
    -    xz: Make --block-list and --block-size work together in single-threaded.
    -    
    -    Previously, --block-list and --block-size only worked together
    -    in threaded mode. Boundaries are specified by --block-list, but
    -    --block-size specifies the maximum size for a Block. Now this
    -    works in single-threaded mode too.
    -    
    -    Thanks to James M Leddy for the original patch.
    -
    - src/xz/coder.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++----------
    - 1 file changed, 75 insertions(+), 15 deletions(-)
    -
    -commit ae222fe9805d0161d022d75ba8485dab8bf6d7d5
    -Author: Lasse Collin 
    -Date:   2013-10-26 13:26:14 +0300
    -
    -    Bump the version number to 5.1.3alpha.
    -
    - src/liblzma/api/lzma/version.h | 2 +-
    - src/liblzma/liblzma.map        | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 2193837a6a597cd3bf4e9ddf49421a5697d8e155
    -Author: Lasse Collin 
    -Date:   2013-10-26 13:25:02 +0300
    -
    -    Update NEWS for 5.1.3alpha.
    -
    - NEWS | 35 +++++++++++++++++++++++++++++++++++
    - 1 file changed, 35 insertions(+)
    -
    -commit ed48e75e2763876173aef8902da407a8eb28854b
    -Author: Lasse Collin 
    -Date:   2013-10-26 12:47:04 +0300
    -
    -    Update TODO.
    -
    - TODO | 4 ----
    - 1 file changed, 4 deletions(-)
    -
    -commit 841da0352d79a56a44796a4c39163429c9f039a3
    -Author: Lasse Collin 
    -Date:   2013-10-25 22:41:28 +0300
    -
    -    xz: Document behavior of --block-list with threads.
    -    
    -    This needs to be updated before 5.2.0.
    -
    - src/xz/xz.1 | 24 +++++++++++++++++++++---
    - 1 file changed, 21 insertions(+), 3 deletions(-)
    -
    -commit 56feb8665b78c1032aabd53c619c62af51defe64
    -Author: Lasse Collin 
    -Date:   2013-10-22 20:03:12 +0300
    -
    -    xz: Document --flush-timeout=TIMEOUT on the man page.
    -
    - src/xz/xz.1 | 37 ++++++++++++++++++++++++++++++++++++-
    - 1 file changed, 36 insertions(+), 1 deletion(-)
    -
    -commit ba413da1d5bb3324287cf3174922acd921165971
    -Author: Lasse Collin 
    -Date:   2013-10-22 19:51:55 +0300
    -
    -    xz: Take advantage of LZMA_FULL_BARRIER with --block-list.
    -    
    -    Now if --block-list is used in threaded mode, the encoder
    -    won't need to flush at each Block boundary specified via
    -    --block-list. This improves performance a lot, making
    -    threading helpful with --block-list.
    -    
    -    The flush timer was reset after LZMA_FULL_FLUSH but since
    -    LZMA_FULL_BARRIER doesn't flush, resetting the timer is
    -    no longer done.
    -
    - src/xz/coder.c | 32 +++++++++++++++-----------------
    - 1 file changed, 15 insertions(+), 17 deletions(-)
    -
    -commit 0cd45fc2bc5537de287a0bc005e2d67467a92148
    -Author: Lasse Collin 
    -Date:   2013-10-02 20:05:23 +0300
    -
    -    liblzma: Support LZMA_FULL_FLUSH and _BARRIER in threaded encoder.
    -    
    -    Now --block-list=SIZES works with in the threaded mode too,
    -    although the performance is still bad due to the use of
    -    LZMA_FULL_FLUSH instead of the new LZMA_FULL_BARRIER.
    -
    - src/liblzma/common/stream_encoder_mt.c | 55 ++++++++++++++++++++++++----------
    - 1 file changed, 39 insertions(+), 16 deletions(-)
    -
    -commit 97bb38712f414fabecca908af2e38a12570293fd
    -Author: Lasse Collin 
    -Date:   2013-10-02 12:55:11 +0300
    -
    -    liblzma: Add LZMA_FULL_BARRIER support to single-threaded encoder.
    -    
    -    In the single-threaded encoder LZMA_FULL_BARRIER is simply
    -    an alias for LZMA_FULL_FLUSH.
    -
    - src/liblzma/api/lzma/base.h         | 37 ++++++++++++++++++++++++++++++-------
    - src/liblzma/common/common.c         | 17 +++++++++++++++--
    - src/liblzma/common/common.h         |  7 ++++++-
    - src/liblzma/common/stream_encoder.c |  4 +++-
    - 4 files changed, 54 insertions(+), 11 deletions(-)
    -
    -commit fef0c6b410c08e581c9178700a4e7599f0895ff9
    -Author: Lasse Collin 
    -Date:   2013-09-17 11:57:51 +0300
    -
    -    liblzma: Add block_buffer_encoder.h into Makefile.inc.
    -    
    -    This should have been in b465da5988dd59ad98fda10c2e4ea13d0b9c73bc.
    -
    - src/liblzma/common/Makefile.inc | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 8083e03291b6d21c0f538163e187b4e8cd5594e4
    -Author: Lasse Collin 
    -Date:   2013-09-17 11:55:38 +0300
    -
    -    xz: Add a missing test for TUKLIB_DOSLIKE.
    -
    - src/xz/file_io.c | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 6b44b4a775fe29ecc7bcb7996e086e3bc09e5fd0
    -Author: Lasse Collin 
    -Date:   2013-09-17 11:52:28 +0300
    -
    -    Add native threading support on Windows.
    -    
    -    Now liblzma only uses "mythread" functions and types
    -    which are defined in mythread.h matching the desired
    -    threading method.
    -    
    -    Before Windows Vista, there is no direct equivalent to
    -    pthread condition variables. Since this package doesn't
    -    use pthread_cond_broadcast(), pre-Vista threading can
    -    still be kept quite simple. The pre-Vista code doesn't
    -    use anything that wasn't already available in Windows 95,
    -    so the binaries should run even on Windows 95 if someone
    -    happens to care.
    -
    - INSTALL                                |  41 ++-
    - configure.ac                           | 118 ++++++--
    - src/common/mythread.h                  | 513 ++++++++++++++++++++++++++-------
    - src/liblzma/common/stream_encoder_mt.c |  83 +++---
    - src/xz/coder.c                         |   8 +-
    - windows/README-Windows.txt             |   2 +-
    - windows/build.bash                     |  23 +-
    - 7 files changed, 573 insertions(+), 215 deletions(-)
    -
    -commit ae0ab74a88d5b9b15845f1d9a24ade4349a54f9f
    -Author: Lasse Collin 
    -Date:   2013-09-11 14:40:35 +0300
    -
    -    Build: Remove a comment about Automake 1.10 from configure.ac.
    -    
    -    The previous commit supports silent rules and that requires
    -    Automake 1.11.
    -
    - configure.ac | 2 --
    - 1 file changed, 2 deletions(-)
    -
    -commit 72975df6c8c59aaf849138ab3606e8fb6970596a
    -Author: Lasse Collin 
    -Date:   2013-09-09 20:37:03 +0300
    -
    -    Build: Create liblzma.pc in a src/liblzma/Makefile.am.
    -    
    -    Previously it was done in configure, but doing that goes
    -    against the Autoconf manual. Autoconf requires that it is
    -    possible to override e.g. prefix after running configure
    -    and that doesn't work correctly if liblzma.pc is created
    -    by configure.
    -    
    -    A potential downside of this change is that now e.g.
    -    libdir in liblzma.pc is a standalone string instead of
    -    being defined via ${prefix}, so if one overrides prefix
    -    when running pkg-config the libdir won't get the new value.
    -    I don't know if this matters in practice.
    -    
    -    Thanks to Vincent Torri.
    -
    - configure.ac            |  1 -
    - src/liblzma/Makefile.am | 20 ++++++++++++++++++++
    - 2 files changed, 20 insertions(+), 1 deletion(-)
    -
    -commit 1c2b6e7e8382ed390f53e140f160488bb2205ecc
    -Author: Lasse Collin 
    -Date:   2013-08-04 15:24:09 +0300
    -
    -    Fix the previous commit which broke the build.
    -    
    -    Apparently I didn't even compile-test the previous commit.
    -    
    -    Thanks to Christian Hesse.
    -
    - src/common/tuklib_cpucores.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 124eb69c7857f618b4807588c51bc9ba21bf8691
    -Author: Lasse Collin 
    -Date:   2013-08-03 13:52:58 +0300
    -
    -    Windows: Add Windows support to tuklib_cpucores().
    -    
    -    It is used for Cygwin too. I'm not sure if that is
    -    a good or bad idea.
    -    
    -    Thanks to Vincent Torri.
    -
    - m4/tuklib_cpucores.m4        | 19 +++++++++++++++++--
    - src/common/tuklib_cpucores.c | 13 ++++++++++++-
    - 2 files changed, 29 insertions(+), 3 deletions(-)
    -
    -commit eada8a875ce3fd521cb42e4ace2624d3d49c5f35
    -Author: Anders F Bjorklund 
    -Date:   2013-08-02 15:59:46 +0200
    -
    -    macosx: separate liblzma package
    -
    - macosx/build.sh | 23 +++++++++++++++--------
    - 1 file changed, 15 insertions(+), 8 deletions(-)
    -
    -commit be0100d01ca6a75899d051bee00acf17e6dc0c15
    -Author: Anders F Bjorklund 
    -Date:   2013-08-02 15:58:44 +0200
    -
    -    macosx: set minimum to leopard
    -
    - macosx/build.sh | 13 ++++++++-----
    - 1 file changed, 8 insertions(+), 5 deletions(-)
    -
    -commit 416729e2d743f4b2fe9fd438eedeb98adce033c3
    -Author: Anders F Bjorklund 
    -Date:   2011-08-07 13:13:30 +0200
    -
    -    move configurables into variables
    -
    - macosx/build.sh | 25 ++++++++++++++++++-------
    - 1 file changed, 18 insertions(+), 7 deletions(-)
    -
    -commit 16581080e5f29f9a4e49efece21c5bf572323acc
    -Author: Lasse Collin 
    -Date:   2013-07-15 14:08:41 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 3e2b198ba37b624efd9c7caee2a435dc986b46c6
    -Author: Lasse Collin 
    -Date:   2013-07-15 14:08:02 +0300
    -
    -    Build: Fix the detection of missing CRC32.
    -    
    -    Thanks to Vincent Torri.
    -
    - configure.ac | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit dee6ad3d5915422bc30a6821efeacaeb8ca8ef00
    -Author: Lasse Collin 
    -Date:   2013-07-04 14:18:46 +0300
    -
    -    xz: Add preliminary support for --flush-timeout=TIMEOUT.
    -    
    -    When --flush-timeout=TIMEOUT is used, xz will use
    -    LZMA_SYNC_FLUSH if read() would block and at least
    -    TIMEOUT milliseconds has elapsed since the previous flush.
    -    
    -    This can be useful in realtime-like use cases where the
    -    data is simultanously decompressed by another process
    -    (possibly on a different computer). If new uncompressed
    -    input data is produced slowly, without this option xz could
    -    buffer the data for a long time until it would become
    -    decompressible from the output.
    -    
    -    If TIMEOUT is 0, the feature is disabled. This is the default.
    -    
    -    This commit affects the compression side. Using xz for
    -    the decompression side for the above purpose doesn't work
    -    yet so well because there is quite a bit of input and
    -    output buffering when decompressing.
    -    
    -    The --long-help or man page were not updated yet.
    -    The details of this feature may change.
    -
    - src/xz/args.c    |  7 +++++++
    - src/xz/coder.c   | 46 +++++++++++++++++++++++++++++++++++-----------
    - src/xz/file_io.c | 46 ++++++++++++++++++++++++++++++++++++----------
    - 3 files changed, 78 insertions(+), 21 deletions(-)
    -
    -commit fa381acaf9a29a8114e1c0a97de99bab9adb014e
    -Author: Lasse Collin 
    -Date:   2013-07-04 13:41:03 +0300
    -
    -    xz: Don't set src_eof=true after an I/O error because it's useless.
    -
    - src/xz/file_io.c | 3 ---
    - 1 file changed, 3 deletions(-)
    -
    -commit ea00545beace5b950f709ec21e46878e0f448678
    -Author: Lasse Collin 
    -Date:   2013-07-04 13:25:11 +0300
    -
    -    xz: Fix the test when to read more input.
    -    
    -    Testing for end of file was no longer correct after full flushing
    -    became possible with --block-size=SIZE and --block-list=SIZES.
    -    There was no bug in practice though because xz just made a few
    -    unneeded zero-byte reads.
    -
    - src/xz/coder.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 736903c64bef394c06685d79908e397bcb08b88f
    -Author: Lasse Collin 
    -Date:   2013-07-04 12:51:57 +0300
    -
    -    xz: Move some of the timing code into mytime.[hc].
    -    
    -    This switches units from microseconds to milliseconds.
    -    
    -    New clock_gettime(CLOCK_MONOTONIC) will be used if available.
    -    There is still a fallback to gettimeofday().
    -
    - src/xz/Makefile.am |  2 ++
    - src/xz/coder.c     |  5 +++
    - src/xz/message.c   | 54 +++++++++------------------------
    - src/xz/mytime.c    | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - src/xz/mytime.h    | 47 ++++++++++++++++++++++++++++
    - src/xz/private.h   |  1 +
    - 6 files changed, 158 insertions(+), 40 deletions(-)
    -
    -commit 24edf8d807e24ffaa1e793114d94cca3b970027d
    -Author: Lasse Collin 
    -Date:   2013-07-01 14:35:03 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit c0627b3fceacfa1ed162f5f55235360ea26f569a
    -Author: Lasse Collin 
    -Date:   2013-07-01 14:34:11 +0300
    -
    -    xz: Silence a warning seen with _FORTIFY_SOURCE=2.
    -    
    -    Thanks to Christian Hesse.
    -
    - src/xz/file_io.c | 8 +++++++-
    - 1 file changed, 7 insertions(+), 1 deletion(-)
    -
    -commit 1936718bb38ee394bd89836fdd4eabc0beb02443
    -Author: Lasse Collin 
    -Date:   2013-06-30 19:40:11 +0300
    -
    -    Update NEWS for 5.0.5.
    -
    - NEWS | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 52 insertions(+)
    -
    -commit a37ae8b5eb6093a530198f109c6f7a538c80ecf0
    -Author: Lasse Collin 
    -Date:   2013-06-30 18:02:27 +0300
    -
    -    Man pages: Use similar syntax for synopsis as in xz.
    -    
    -    The man pages of lzmainfo, xzmore, and xzdec had similar
    -    constructs as the man page of xz had before the commit
    -    eb6ca9854b8eb9fbf72497c1cf608d6b19d2d494. Eric S. Raymond
    -    didn't mention these man pages in his bug report, but
    -    it's nice to be consistent.
    -
    - src/lzmainfo/lzmainfo.1 |  4 ++--
    - src/scripts/xzmore.1    |  6 +++---
    - src/xzdec/xzdec.1       | 10 +++++-----
    - 3 files changed, 10 insertions(+), 10 deletions(-)
    -
    -commit cdba9ddd870ae72fd6219a125662c20ec997f86c
    -Author: Lasse Collin 
    -Date:   2013-06-29 15:59:13 +0300
    -
    -    xz: Use non-blocking I/O for the output file.
    -    
    -    Now both reading and writing should be without
    -    race conditions with signals.
    -    
    -    They might still be signal handling issues left.
    -    Signals are blocked during many operations to avoid
    -    EINTR but it may cause problems e.g. if writing to
    -    stderr blocks when trying to display an error message.
    -
    - src/xz/file_io.c | 57 ++++++++++++++++++++++++++++++++++++++++++++++++--------
    - 1 file changed, 49 insertions(+), 8 deletions(-)
    -
    -commit e61a5c95da3fe31281d959e5e842885a8ba2b5bd
    -Author: Lasse Collin 
    -Date:   2013-06-28 23:56:17 +0300
    -
    -    xz: Fix return value type in io_write_buf().
    -    
    -    It didn't affect the behavior of the code since -1
    -    becomes true anyway.
    -
    - src/xz/file_io.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 9dc319eabb34a826f4945f91c71620f14a60e9e2
    -Author: Lasse Collin 
    -Date:   2013-06-28 23:48:05 +0300
    -
    -    xz: Use the self-pipe trick to avoid a race condition with signals.
    -    
    -    It is possible that a signal to set user_abort arrives right
    -    before a blocking system call is made. In this case the call
    -    may block until another signal arrives, while the wanted
    -    behavior is to make xz clean up and exit as soon as possible.
    -    
    -    After this commit, the race condition is avoided with the
    -    input side which already uses non-blocking I/O. The output
    -    side still uses blocking I/O and thus has the race condition.
    -
    - src/xz/file_io.c | 56 ++++++++++++++++++++++++++++++++++++++++++++------------
    - src/xz/file_io.h |  8 ++++++++
    - src/xz/signals.c |  5 +++++
    - 3 files changed, 57 insertions(+), 12 deletions(-)
    -
    -commit 3541bc79d0cfabc0ad155c99bfdad1289f17fec3
    -Author: Lasse Collin 
    -Date:   2013-06-28 22:51:02 +0300
    -
    -    xz: Use non-blocking I/O for the input file.
    -
    - src/xz/file_io.c | 156 +++++++++++++++++++++++++++++++++++++++----------------
    - 1 file changed, 111 insertions(+), 45 deletions(-)
    -
    -commit 78673a08bed5066c81e8a8e90d20e670c28ecfd5
    -Author: Lasse Collin 
    -Date:   2013-06-28 18:46:13 +0300
    -
    -    xz: Remove an outdated NetBSD-specific comment.
    -    
    -    Nowadays errno == EFTYPE is documented in open(2).
    -
    - src/xz/file_io.c | 4 ----
    - 1 file changed, 4 deletions(-)
    -
    -commit a616fdad34b48b2932ef03fb87309dcc8b829527
    -Author: Lasse Collin 
    -Date:   2013-06-28 18:09:47 +0300
    -
    -    xz: Fix error detection of fcntl(fd, F_SETFL, flags) calls.
    -    
    -    POSIX says that fcntl(fd, F_SETFL, flags) returns -1 on
    -    error and "other than -1" on success. This is how it is
    -    documented e.g. on OpenBSD too. On Linux, success with
    -    F_SETFL is always 0 (at least accorinding to fcntl(2)
    -    from man-pages 3.51).
    -
    - src/xz/file_io.c | 8 ++++----
    - 1 file changed, 4 insertions(+), 4 deletions(-)
    -
    -commit 4a08a6e4c61c65ab763ab314100a6d7a3bb89298
    -Author: Lasse Collin 
    -Date:   2013-06-28 17:36:47 +0300
    -
    -    xz: Fix use of wrong variable in a fcntl() call.
    -    
    -    Due to a wrong variable name, when writing a sparse file
    -    to standard output, *all* file status flags were cleared
    -    (to the extent the operating system allowed it) instead of
    -    only clearing the O_APPEND flag. In practice this worked
    -    fine in the common situations on GNU/Linux, but I didn't
    -    check how it behaved elsewhere.
    -    
    -    The original flags were still restored correctly. I still
    -    changed the code to use a separate boolean variable to
    -    indicate when the flags should be restored instead of
    -    relying on a special value in stdout_flags.
    -
    - src/xz/file_io.c | 24 +++++++++++++-----------
    - 1 file changed, 13 insertions(+), 11 deletions(-)
    -
    -commit b790b435daa3351067f80a5973b647f8d55367a2
    -Author: Lasse Collin 
    -Date:   2013-06-28 14:55:37 +0300
    -
    -    xz: Fix assertion related to posix_fadvise().
    -    
    -    Input file can be a FIFO or something else that doesn't
    -    support posix_fadvise() so don't check the return value
    -    even with an assertion. Nothing bad happens if the call
    -    to posix_fadvise() fails.
    -
    - src/xz/file_io.c | 10 ++--------
    - 1 file changed, 2 insertions(+), 8 deletions(-)
    -
    -commit 84d2da6c9dc252f441deb7626c2522202b005d4d
    -Author: Lasse Collin 
    -Date:   2013-06-26 13:30:57 +0300
    -
    -    xz: Check the value of lzma_stream_flags.version in --list.
    -    
    -    It is a no-op for now, but if an old xz version is used
    -    together with a newer liblzma that supports something new,
    -    then this check becomes important and will stop the old xz
    -    from trying to parse files that it won't understand.
    -
    - src/xz/list.c | 14 ++++++++++++++
    - 1 file changed, 14 insertions(+)
    -
    -commit 9376f5f8f762296f2173d61af9101112c36f38c0
    -Author: Lasse Collin 
    -Date:   2013-06-26 12:17:00 +0300
    -
    -    Build: Require Automake 1.12 and use serial-tests option.
    -    
    -    It should actually still work with Automake 1.10 if
    -    the serial-tests option is removed. Automake 1.13 started
    -    using parallel tests by default and the option to get
    -    the old behavior isn't supported before 1.12.
    -    
    -    At least for now, parallel tests don't improve anything
    -    in XZ Utils but they hide the progress output from
    -    test_compress.sh.
    -
    - configure.ac | 4 +++-
    - 1 file changed, 3 insertions(+), 1 deletion(-)
    -
    -commit b7e200d7bd0a3c7c171c13ad37d68296d6f73374
    -Author: Lasse Collin 
    -Date:   2013-06-23 18:59:13 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 46540e4c10923e363741ff5aab99e79fc0ce6ee8
    -Author: Lasse Collin 
    -Date:   2013-06-23 18:57:23 +0300
    -
    -    liblzma: Avoid a warning about a shadowed variable.
    -    
    -    On Mac OS X wait() is declared in  that
    -    we include one way or other so don't use "wait" as
    -    a variable name.
    -    
    -    Thanks to Christian Kujau.
    -
    - src/liblzma/common/stream_encoder_mt.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit ebb501ec73cecc546c67117dd01b5e33c90bfb4a
    -Author: Lasse Collin 
    -Date:   2013-06-23 17:36:47 +0300
    -
    -    xz: Validate Uncompressed Size from Block Header in list.c.
    -    
    -    This affects only "xz -lvv". Normal decompression with xz
    -    already detected if Block Header and Index had mismatched
    -    Uncompressed Size fields. So this just makes "xz -lvv"
    -    show such files as corrupt instead of showing the
    -    Uncompressed Size from Index.
    -
    - src/xz/list.c | 14 +++++++++++++-
    - 1 file changed, 13 insertions(+), 1 deletion(-)
    -
    -commit c09e91dd236d3cabee0fc48312b3dc8cceae41ab
    -Author: Lasse Collin 
    -Date:   2013-06-21 22:08:11 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit eb6ca9854b8eb9fbf72497c1cf608d6b19d2d494
    -Author: Lasse Collin 
    -Date:   2013-06-21 22:04:45 +0300
    -
    -    xz: Make the man page more friendly to doclifter.
    -    
    -    Thanks to Eric S. Raymond.
    -
    - src/xz/xz.1 | 7 ++++---
    - 1 file changed, 4 insertions(+), 3 deletions(-)
    -
    -commit 0c0a1947e6ad90a0a10b7a5c39f6ab99a0aa5c93
    -Author: Lasse Collin 
    -Date:   2013-06-21 21:54:59 +0300
    -
    -    xz: A couple of man page fixes.
    -    
    -    Now the interaction of presets and custom filter chains
    -    is described correctly. Earlier it contradicted itself.
    -    
    -    Thanks to DevHC who reported these issues on IRC to me
    -    on 2012-12-14.
    -
    - src/xz/xz.1 | 35 +++++++++++++++++++++++------------
    - 1 file changed, 23 insertions(+), 12 deletions(-)
    -
    -commit 2fcda89939c903106c429e109083d43d894049e0
    -Author: Lasse Collin 
    -Date:   2013-06-21 21:50:26 +0300
    -
    -    xz: Fix interaction between preset and custom filter chains.
    -    
    -    There was somewhat illogical behavior when --extreme was
    -    specified and mixed with custom filter chains.
    -    
    -    Before this commit, "xz -9 --lzma2 -e" was equivalent
    -    to "xz --lzma2". After it is equivalent to "xz -6e"
    -    (all earlier preset options get forgotten when a custom
    -    filter chain is specified and the default preset is 6
    -    to which -e is applied). I find this less illogical.
    -    
    -    This also affects the meaning of "xz -9e --lzma2 -7".
    -    Earlier it was equivalent to "xz -7e" (the -e specified
    -    before a custom filter chain wasn't forgotten). Now it
    -    is "xz -7". Note that "xz -7e" still is the same as "xz -e7".
    -    
    -    Hopefully very few cared about this in the first place,
    -    so pretty much no one should even notice this change.
    -    
    -    Thanks to Conley Moorhous.
    -
    - src/xz/coder.c | 35 +++++++++++++++++++++--------------
    - 1 file changed, 21 insertions(+), 14 deletions(-)
    -
    -commit 97379c5ea758da3f8b0bc444d5f7fa43753ce610
    -Author: Lasse Collin 
    -Date:   2013-04-27 22:07:46 +0300
    -
    -    Build: Use -Wvla with GCC if supported.
    -    
    -    Variable-length arrays are mandatory in C99 but optional in C11.
    -    The code doesn't currently use any VLAs and it shouldn't in the
    -    future either to stay compatible with C11 without requiring any
    -    optional C11 features.
    -
    - configure.ac | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 8957c58609d3987c58aa72b96c436cf565cc4917
    -Author: Lasse Collin 
    -Date:   2013-04-15 19:29:09 +0300
    -
    -    xzdec: Improve the --help message.
    -    
    -    The options are now ordered in the same order as in xz's help
    -    message.
    -    
    -    Descriptions were added to the options that are ignored.
    -    I left them in parenthesis even if it looks a bit weird
    -    because I find it easier to spot the ignored vs. non-ignored
    -    options from the list that way.
    -
    - src/xzdec/xzdec.c | 10 +++++-----
    - 1 file changed, 5 insertions(+), 5 deletions(-)
    -
    -commit ed886e1a92534a24401d0e99c11f1dcff3b5220a
    -Author: Lasse Collin 
    -Date:   2013-04-05 19:25:40 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 5019413a055ce29e660dbbf15e02443cb5a26c59
    -Author: Jeff Bastian 
    -Date:   2013-04-03 13:59:17 +0200
    -
    -    xzgrep: make the '-h' option to be --no-filename equivalent
    -    
    -    * src/scripts/xzgrep.in: Accept the '-h' option in argument parsing.
    -
    - src/scripts/xzgrep.in | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 5ea900cb5ad862bca81316729f92357c1fc040ce
    -Author: Lasse Collin 
    -Date:   2013-03-23 22:25:15 +0200
    -
    -    liblzma: Be less picky in lzma_alone_decoder().
    -    
    -    To avoid false positives when detecting .lzma files,
    -    rare values in dictionary size and uncompressed size fields
    -    were rejected. They will still be rejected if .lzma files
    -    are decoded with lzma_auto_decoder(), but when using
    -    lzma_alone_decoder() directly, such files will now be accepted.
    -    Hopefully this is an OK compromise.
    -    
    -    This doesn't affect xz because xz still has its own file
    -    format detection code. This does affect lzmadec though.
    -    So after this commit lzmadec will accept files that xz or
    -    xz-emulating-lzma doesn't.
    -    
    -    NOTE: lzma_alone_decoder() still won't decode all .lzma files
    -    because liblzma's LZMA decoder doesn't support lc + lp > 4.
    -    
    -    Reported here:
    -    http://sourceforge.net/projects/lzmautils/forums/forum/708858/topic/7068827
    -
    - src/liblzma/common/alone_decoder.c | 22 ++++++++++++++--------
    - src/liblzma/common/alone_decoder.h |  5 +++--
    - src/liblzma/common/auto_decoder.c  |  2 +-
    - 3 files changed, 18 insertions(+), 11 deletions(-)
    -
    -commit bb117fffa84604b6e3811b068c80db82bf7f7b05
    -Author: Lasse Collin 
    -Date:   2013-03-23 21:55:13 +0200
    -
    -    liblzma: Use lzma_block_buffer_bound64() in threaded encoder.
    -    
    -    Now it uses lzma_block_uncomp_encode() if the data doesn't
    -    fit into the space calculated by lzma_block_buffer_bound64().
    -
    - src/liblzma/common/stream_encoder_mt.c | 66 +++++++++++++++++++++++++---------
    - 1 file changed, 50 insertions(+), 16 deletions(-)
    -
    -commit e572e123b55b29527e54ce5f0807f115481d78b9
    -Author: Lasse Collin 
    -Date:   2013-03-23 21:51:38 +0200
    -
    -    liblzma: Fix another deadlock in the threaded encoder.
    -    
    -    This race condition could cause a deadlock if lzma_end() was
    -    called before finishing the encoding. This can happen with
    -    xz with debugging enabled (non-debugging version doesn't
    -    call lzma_end() before exiting).
    -
    - src/liblzma/common/stream_encoder_mt.c | 9 ++++++---
    - 1 file changed, 6 insertions(+), 3 deletions(-)
    -
    -commit b465da5988dd59ad98fda10c2e4ea13d0b9c73bc
    -Author: Lasse Collin 
    -Date:   2013-03-23 19:17:33 +0200
    -
    -    liblzma: Add lzma_block_uncomp_encode().
    -    
    -    This also adds a new internal function
    -    lzma_block_buffer_bound64() which is similar to
    -    lzma_block_buffer_bound() but uses uint64_t instead
    -    of size_t.
    -
    - src/liblzma/api/lzma/block.h              | 18 ++++++
    - src/liblzma/common/block_buffer_encoder.c | 94 +++++++++++++++++++++----------
    - src/liblzma/common/block_buffer_encoder.h | 24 ++++++++
    - src/liblzma/liblzma.map                   |  1 +
    - 4 files changed, 106 insertions(+), 31 deletions(-)
    -
    -commit 9e6dabcf22ef4679f4faaae15ebd5b137ae2fad1
    -Author: Lasse Collin 
    -Date:   2013-03-05 19:14:50 +0200
    -
    -    Avoid unneeded use of awk in xzless.
    -    
    -    Use "read" instead of "awk" in xzless to get the version
    -    number of "less". The need for awk was introduced in
    -    the commit db5c1817fabf7cbb9e4087b1576eb26f0747338e.
    -    
    -    Thanks to Ariel P for the patch.
    -
    - src/scripts/xzless.in | 3 +--
    - 1 file changed, 1 insertion(+), 2 deletions(-)
    -
    -commit e7b424d267a34803db8d92a3515528be2ed45abd
    -Author: Lasse Collin 
    -Date:   2012-12-14 20:13:32 +0200
    -
    -    Make the progress indicator smooth in threaded mode.
    -    
    -    This adds lzma_get_progress() to liblzma and takes advantage
    -    of it in xz.
    -    
    -    lzma_get_progress() collects progress information from
    -    the thread-specific structures so that fairly accurate
    -    progress information is available to applications. Adding
    -    a new function seemed to be a better way than making the
    -    information directly available in lzma_stream (like total_in
    -    and total_out are) because collecting the information requires
    -    locking mutexes. It's waste of time to do it more often than
    -    the up to date information is actually needed by an application.
    -
    - src/liblzma/api/lzma/base.h            | 22 +++++++++-
    - src/liblzma/common/common.c            | 16 +++++++
    - src/liblzma/common/common.h            |  6 +++
    - src/liblzma/common/stream_encoder_mt.c | 77 +++++++++++++++++++++++++++++++---
    - src/liblzma/liblzma.map                |  1 +
    - src/xz/message.c                       | 20 +++++----
    - 6 files changed, 129 insertions(+), 13 deletions(-)
    -
    -commit 2ebbb994e367f55f2561aa7c9e7451703c171f2f
    -Author: Lasse Collin 
    -Date:   2012-12-14 11:01:41 +0200
    -
    -    liblzma: Fix mythread_sync for nested locking.
    -
    - src/common/mythread.h | 5 +++--
    - 1 file changed, 3 insertions(+), 2 deletions(-)
    -
    -commit 4c7e28705f6de418d19cc77324ef301f996e01ff
    -Author: Lasse Collin 
    -Date:   2012-12-13 21:05:36 +0200
    -
    -    xz: Mention --threads in --help.
    -    
    -    Thanks to Olivier Delhomme for pointing out that this
    -    was still missing.
    -
    - src/xz/message.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit db5c1817fabf7cbb9e4087b1576eb26f0747338e
    -Author: Jonathan Nieder 
    -Date:   2012-11-19 00:10:10 -0800
    -
    -    xzless: Make "less -V" parsing more robust
    -    
    -    In v4.999.9beta~30 (xzless: Support compressed standard input,
    -    2009-08-09), xzless learned to parse ‘less -V’ output to figure out
    -    whether less is new enough to handle $LESSOPEN settings starting
    -    with “|-â€.  That worked well for a while, but the version string from
    -    ‘less’ versions 448 (June, 2012) is misparsed, producing a warning:
    -    
    -    	$ xzless /tmp/test.xz; echo $?
    -    	/usr/bin/xzless: line 49: test: 456 (GNU regular expressions): \
    -    	integer expression expected
    -    	0
    -    
    -    More precisely, modern ‘less’ lists the regexp implementation along
    -    with its version number, and xzless passes the entire version number
    -    with attached parenthetical phrase as a number to "test $a -gt $b",
    -    producing the above confusing message.
    -    
    -    	$ less-444 -V | head -1
    -    	less 444
    -    	$ less -V | head -1
    -    	less 456 (no regular expressions)
    -    
    -    So relax the pattern matched --- instead of expecting "less ",
    -    look for a line of the form "less [ (extra parenthetical)]".
    -    While at it, improve the behavior when no matching line is found ---
    -    instead of producing a cryptic message, we can fall back on a LESSPIPE
    -    setting that is supported by all versions of ‘less’.
    -    
    -    The implementation uses "awk" for simplicity.  Hopefully that’s
    -    portable enough.
    -    
    -    Reported-by: Jörg-Volker Peetz 
    -    Signed-off-by: Jonathan Nieder 
    -
    - src/scripts/xzless.in | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit 65536214a31ecd33b6b03b68a351fb597d3703d6
    -Author: Lasse Collin 
    -Date:   2012-10-03 15:54:24 +0300
    -
    -    xz: Fix the note about --rsyncable on the man page.
    -
    - src/xz/xz.1 | 17 +++++++++--------
    - 1 file changed, 9 insertions(+), 8 deletions(-)
    -
    -commit 3d93b6354927247a1569caf22ad27b07e97ee904
    -Author: Lasse Collin 
    -Date:   2012-09-28 20:11:09 +0300
    -
    -    xz: Improve handling of failed realloc in xrealloc.
    -    
    -    Thanks to Jim Meyering.
    -
    - src/xz/util.c | 14 ++++++++++++--
    - 1 file changed, 12 insertions(+), 2 deletions(-)
    -
    -commit ab225620664e235637833be2329935f9d290ba80
    -Author: Lasse Collin 
    -Date:   2012-08-24 16:27:31 +0300
    -
    -    A few typo fixes to comments and the xz man page.
    -    
    -    Thanks to Jim Meyering.
    -
    - configure.ac               | 2 +-
    - src/liblzma/check/sha256.c | 1 -
    - src/xz/xz.1                | 4 ++--
    - 3 files changed, 3 insertions(+), 4 deletions(-)
    -
    -commit f3c1ec69d910175ffd431fd82968dd35cec806ed
    -Author: Lasse Collin 
    -Date:   2012-08-13 21:40:09 +0300
    -
    -    xz: Add a warning to --help about alpha and beta versions.
    -
    - src/xz/message.c | 5 +++++
    - 1 file changed, 5 insertions(+)
    -
    -commit d8eaf9d8278c23c2cf2b7ca5562d4de570d3b5db
    -Author: Lasse Collin 
    -Date:   2012-08-02 17:13:30 +0300
    -
    -    Build: Bump gettext version requirement to 0.18.
    -    
    -    Otherwise too old version of m4/lib-link.m4 gets included
    -    when autoreconf -fi is run.
    -
    - configure.ac | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 96e08902b09f0f304d4ff80c6e83ef7fff883f34
    -Author: Lasse Collin 
    -Date:   2012-07-17 18:29:08 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 3778db1be53e61ff285c573af5ee468803008456
    -Author: Lasse Collin 
    -Date:   2012-07-17 18:19:59 +0300
    -
    -    liblzma: Make the use of lzma_allocator const-correct.
    -    
    -    There is a tiny risk of causing breakage: If an application
    -    assigns lzma_stream.allocator to a non-const pointer, such
    -    code won't compile anymore. I don't know why anyone would do
    -    such a thing though, so in practice this shouldn't cause trouble.
    -    
    -    Thanks to Jan Kratochvil for the patch.
    -
    - src/liblzma/api/lzma/base.h                |  4 +++-
    - src/liblzma/api/lzma/block.h               |  6 ++---
    - src/liblzma/api/lzma/container.h           |  9 +++++---
    - src/liblzma/api/lzma/filter.h              | 13 ++++++-----
    - src/liblzma/api/lzma/index.h               | 16 ++++++-------
    - src/liblzma/api/lzma/index_hash.h          |  4 ++--
    - src/liblzma/common/alone_decoder.c         |  6 ++---
    - src/liblzma/common/alone_decoder.h         |  2 +-
    - src/liblzma/common/alone_encoder.c         |  8 +++----
    - src/liblzma/common/auto_decoder.c          |  6 ++---
    - src/liblzma/common/block_buffer_decoder.c  |  2 +-
    - src/liblzma/common/block_buffer_encoder.c  |  4 ++--
    - src/liblzma/common/block_decoder.c         |  6 ++---
    - src/liblzma/common/block_decoder.h         |  2 +-
    - src/liblzma/common/block_encoder.c         |  8 +++----
    - src/liblzma/common/block_encoder.h         |  2 +-
    - src/liblzma/common/block_header_decoder.c  |  4 ++--
    - src/liblzma/common/common.c                | 10 ++++-----
    - src/liblzma/common/common.h                | 20 +++++++++--------
    - src/liblzma/common/easy_buffer_encoder.c   |  4 ++--
    - src/liblzma/common/filter_buffer_decoder.c |  3 ++-
    - src/liblzma/common/filter_buffer_encoder.c |  7 +++---
    - src/liblzma/common/filter_common.c         |  4 ++--
    - src/liblzma/common/filter_common.h         |  2 +-
    - src/liblzma/common/filter_decoder.c        |  7 +++---
    - src/liblzma/common/filter_decoder.h        |  2 +-
    - src/liblzma/common/filter_encoder.c        |  2 +-
    - src/liblzma/common/filter_encoder.h        |  2 +-
    - src/liblzma/common/filter_flags_decoder.c  |  2 +-
    - src/liblzma/common/index.c                 | 26 ++++++++++-----------
    - src/liblzma/common/index_decoder.c         | 12 +++++-----
    - src/liblzma/common/index_encoder.c         |  6 ++---
    - src/liblzma/common/index_encoder.h         |  2 +-
    - src/liblzma/common/index_hash.c            |  6 +++--
    - src/liblzma/common/outqueue.c              |  4 ++--
    - src/liblzma/common/outqueue.h              |  5 +++--
    - src/liblzma/common/stream_buffer_decoder.c |  2 +-
    - src/liblzma/common/stream_buffer_encoder.c |  3 ++-
    - src/liblzma/common/stream_decoder.c        |  9 ++++----
    - src/liblzma/common/stream_decoder.h        |  5 +++--
    - src/liblzma/common/stream_encoder.c        | 10 ++++-----
    - src/liblzma/common/stream_encoder_mt.c     | 16 ++++++-------
    - src/liblzma/delta/delta_common.c           |  4 ++--
    - src/liblzma/delta/delta_decoder.c          |  6 ++---
    - src/liblzma/delta/delta_decoder.h          |  5 +++--
    - src/liblzma/delta/delta_encoder.c          |  6 ++---
    - src/liblzma/delta/delta_encoder.h          |  3 ++-
    - src/liblzma/delta/delta_private.h          |  2 +-
    - src/liblzma/lz/lz_decoder.c                |  8 +++----
    - src/liblzma/lz/lz_decoder.h                |  7 +++---
    - src/liblzma/lz/lz_encoder.c                | 19 ++++++++--------
    - src/liblzma/lz/lz_encoder.h                |  6 ++---
    - src/liblzma/lzma/lzma2_decoder.c           |  8 +++----
    - src/liblzma/lzma/lzma2_decoder.h           |  5 +++--
    - src/liblzma/lzma/lzma2_encoder.c           |  6 ++---
    - src/liblzma/lzma/lzma2_encoder.h           |  2 +-
    - src/liblzma/lzma/lzma_decoder.c            |  8 +++----
    - src/liblzma/lzma/lzma_decoder.h            |  7 +++---
    - src/liblzma/lzma/lzma_encoder.c            |  7 +++---
    - src/liblzma/lzma/lzma_encoder.h            |  5 +++--
    - src/liblzma/simple/arm.c                   |  8 ++++---
    - src/liblzma/simple/armthumb.c              |  8 ++++---
    - src/liblzma/simple/ia64.c                  |  8 ++++---
    - src/liblzma/simple/powerpc.c               |  8 ++++---
    - src/liblzma/simple/simple_coder.c          | 10 ++++-----
    - src/liblzma/simple/simple_coder.h          | 36 ++++++++++++++++++++----------
    - src/liblzma/simple/simple_decoder.c        |  2 +-
    - src/liblzma/simple/simple_decoder.h        |  2 +-
    - src/liblzma/simple/simple_private.h        |  3 ++-
    - src/liblzma/simple/sparc.c                 |  8 ++++---
    - src/liblzma/simple/x86.c                   |  8 ++++---
    - 71 files changed, 269 insertions(+), 219 deletions(-)
    -
    -commit d625c7cf824fd3b61c6da84f56179e94917ff603
    -Author: Lasse Collin 
    -Date:   2012-07-05 07:36:28 +0300
    -
    -    Tests: Remove tests/test_block.c that had gotten committed accidentally.
    -
    - tests/test_block.c | 52 ----------------------------------------------------
    - 1 file changed, 52 deletions(-)
    -
    -commit 0b09d266cce72bc4841933b171e79551e488927c
    -Author: Lasse Collin 
    -Date:   2012-07-05 07:33:35 +0300
    -
    -    Build: Include macosx/build.sh in the distribution.
    -    
    -    It has been in the Git repository since 2010 but probably
    -    few people have seen it since it hasn't been included in
    -    the release tarballs. :-(
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit d6e0b23d4613b9f417893dd96cc168c8005ece3d
    -Author: Lasse Collin 
    -Date:   2012-07-05 07:28:53 +0300
    -
    -    Build: Include validate_map.sh in the distribution.
    -    
    -    It's required by "make mydist".
    -    
    -    Fix also the location of EXTRA_DIST+= so that those files
    -    get distributed also if symbol versioning isn't enabled.
    -
    - src/liblzma/Makefile.am | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 19de545d86097c3954d69ab5d12820387f6a09bc
    -Author: Lasse Collin 
    -Date:   2012-07-05 07:24:45 +0300
    -
    -    Docs: Fix the name LZMA Utils -> XZ Utils in debug/README.
    -
    - debug/README | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 672eccf57c31a40dfb956b7662db06d43e18618e
    -Author: Lasse Collin 
    -Date:   2012-07-05 07:23:17 +0300
    -
    -    Include debug/translation.bash in the distribution.
    -    
    -    Also fix the script name mentioned in README.
    -
    - README            | 4 ++--
    - debug/Makefile.am | 3 +++
    - 2 files changed, 5 insertions(+), 2 deletions(-)
    -
    -commit cafb523adac1caf305e70a04bc37f25602bf990c
    -Author: Lasse Collin 
    -Date:   2012-07-04 22:31:58 +0300
    -
    -    xz: Document --block-list better.
    -    
    -    Thanks to Jonathan Nieder.
    -
    - src/xz/xz.1 | 8 +++++++-
    - 1 file changed, 7 insertions(+), 1 deletion(-)
    -
    -commit c7ff218528bc8f7c65e7ef73c6515777346c6794
    -Author: Lasse Collin 
    -Date:   2012-07-04 20:01:49 +0300
    -
    -    Bump the version number to 5.1.2alpha.
    -
    - src/liblzma/api/lzma/version.h | 2 +-
    - src/liblzma/liblzma.map        | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 8f3c1d886f93e6478ad509ff52102b2ce7faa999
    -Author: Lasse Collin 
    -Date:   2012-07-04 20:01:19 +0300
    -
    -    Update NEWS for 5.1.2alpha.
    -
    - NEWS | 41 +++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 41 insertions(+)
    -
    -commit 0d5fa05466e580fbc458820f87013ae7644e20e5
    -Author: Lasse Collin 
    -Date:   2012-07-04 19:58:23 +0300
    -
    -    xz: Fix the version number printed by xz -lvv.
    -    
    -    The decoder bug was fixed in 5.0.2 instead of 5.0.3.
    -
    - src/xz/list.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit df11317985a4165731dde12bb0f0028da0e7b77f
    -Author: Lasse Collin 
    -Date:   2012-07-04 17:11:31 +0300
    -
    -    Build: Add a comment to configure.ac about symbol versioning.
    -
    - configure.ac | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit bd9cc179e8be3ef515201d3ed9c7dd79ae88869d
    -Author: Lasse Collin 
    -Date:   2012-07-04 17:06:49 +0300
    -
    -    Update TODO.
    -
    - TODO | 12 ++++++++++--
    - 1 file changed, 10 insertions(+), 2 deletions(-)
    -
    -commit 4a238dd9b22f462cac5e199828bf1beb0df05884
    -Author: Lasse Collin 
    -Date:   2012-07-04 17:05:46 +0300
    -
    -    Document --enable-symbol-versions in INSTALL.
    -
    - INSTALL | 5 +++++
    - 1 file changed, 5 insertions(+)
    -
    -commit 88ccf47205d7f3aa314d358c72ef214f10f68b43
    -Author: Lasse Collin 
    -Date:   2012-07-03 21:16:39 +0300
    -
    -    xz: Add incomplete support for --block-list.
    -    
    -    It's broken with threads and when also --block-size is used.
    -
    - src/xz/args.c    | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - src/xz/args.h    |  1 +
    - src/xz/coder.c   | 48 ++++++++++++++++++++++++++++------
    - src/xz/coder.h   |  4 +++
    - src/xz/main.c    |  1 +
    - src/xz/message.c |  6 +++++
    - src/xz/xz.1      | 23 +++++++++++++++--
    - 7 files changed, 151 insertions(+), 10 deletions(-)
    -
    -commit 972179cdcdf5d8949c48ee31737d87d3050b44af
    -Author: Lasse Collin 
    -Date:   2012-07-01 18:44:33 +0300
    -
    -    xz: Update the man page about the new field in --robot -lvv.
    -
    - src/xz/xz.1 | 18 +++++++++++++++++-
    - 1 file changed, 17 insertions(+), 1 deletion(-)
    -
    -commit 1403707fc64a70976aebe66f8d9a9bd12f73a2c5
    -Author: Lasse Collin 
    -Date:   2012-06-28 10:47:49 +0300
    -
    -    liblzma: Check that the first byte of range encoded data is 0x00.
    -    
    -    It is just to be more pedantic and thus perhaps catch broken
    -    files slightly earlier.
    -
    - src/liblzma/lzma/lzma_decoder.c        |  8 ++++++--
    - src/liblzma/rangecoder/range_decoder.h | 12 +++++++++---
    - 2 files changed, 15 insertions(+), 5 deletions(-)
    -
    -commit eccd8017ffe2c5de473222c4963ec53c62f7fda2
    -Author: Lasse Collin 
    -Date:   2012-06-22 19:00:23 +0300
    -
    -    Update NEWS from 5.0.4.
    -
    - NEWS | 37 +++++++++++++++++++++++++++++++++++++
    - 1 file changed, 37 insertions(+)
    -
    -commit 2e6754eac26a431e8d340c28906f63bcd1e177e8
    -Author: Lasse Collin 
    -Date:   2012-06-22 14:34:03 +0300
    -
    -    xz: Update man page date to match the latest update.
    -
    - src/xz/xz.1 | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit b3235a0b1af45d5e1244cbe3191516966c076fa0
    -Author: Lasse Collin 
    -Date:   2012-06-18 21:27:47 +0300
    -
    -    Docs: Language fix to 01_compress_easy.c.
    -    
    -    Thanks to Jonathan Nieder.
    -
    - doc/examples/01_compress_easy.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit f1675f765fe228cb5a5f904f853445a03e33cfe9
    -Author: Lasse Collin 
    -Date:   2012-06-14 20:15:30 +0300
    -
    -    Fix the top-level Makefile.am for the new example programs.
    -
    - Makefile.am | 12 ++++++++++--
    - 1 file changed, 10 insertions(+), 2 deletions(-)
    -
    -commit 3a0c5378abefaf86aa39a62a7c9682bdb21568a1
    -Author: Lasse Collin 
    -Date:   2012-06-14 10:52:33 +0300
    -
    -    Docs: Add new example programs.
    -    
    -    These have more comments than the old examples and
    -    human-readable error messages. More tutorial-like examples
    -    are needed but these are a start.
    -
    - doc/examples/00_README.txt        |  27 ++++
    - doc/examples/01_compress_easy.c   | 297 ++++++++++++++++++++++++++++++++++++++
    - doc/examples/02_decompress.c      | 287 ++++++++++++++++++++++++++++++++++++
    - doc/examples/03_compress_custom.c | 193 +++++++++++++++++++++++++
    - doc/examples/Makefile             |  23 +++
    - 5 files changed, 827 insertions(+)
    -
    -commit 1bd2c2c553e30c4a73cfb82abc6908efd6be6b8d
    -Author: Lasse Collin 
    -Date:   2012-06-14 10:33:27 +0300
    -
    -    Docs: Move xz_pipe_comp.c and xz_pipe_decomp.c to doc/examples_old.
    -    
    -    It is good to keep these around to so that if someone has
    -    copied the decompressor bug from xz_pipe_decomp.c he has
    -    an example how to easily fix it.
    -
    - doc/examples/xz_pipe_comp.c       | 127 --------------------------------------
    - doc/examples/xz_pipe_decomp.c     | 123 ------------------------------------
    - doc/examples_old/xz_pipe_comp.c   | 127 ++++++++++++++++++++++++++++++++++++++
    - doc/examples_old/xz_pipe_decomp.c | 123 ++++++++++++++++++++++++++++++++++++
    - 4 files changed, 250 insertions(+), 250 deletions(-)
    -
    -commit 905f0ab5b5ce544d4b68a2ed6077df0f3d021292
    -Author: Lasse Collin 
    -Date:   2012-06-14 10:33:01 +0300
    -
    -    Docs: Fix a bug in xz_pipe_decomp.c example program.
    -
    - doc/examples/xz_pipe_decomp.c | 10 +++++++++-
    - 1 file changed, 9 insertions(+), 1 deletion(-)
    -
    -commit 4bd1a3bd5fdf4870b2f96dd0b8a21657c8a58ad8
    -Author: Lasse Collin 
    -Date:   2012-05-30 23:14:33 +0300
    -
    -    Translations: Update the French translation.
    -    
    -    Thanks to Adrien Nader.
    -
    - po/fr.po | 148 ++++++++++++++++++++++++++++++++++-----------------------------
    - 1 file changed, 79 insertions(+), 69 deletions(-)
    -
    -commit d2e836f2f3a87df6fe6bb0589b037db51205d910
    -Author: Lasse Collin 
    -Date:   2012-05-29 23:42:37 +0300
    -
    -    Translations: Update the German translation.
    -    
    -    The previous only included the new strings in v5.0.
    -
    - po/de.po | 229 +++++++++++++++++++++++++++++++++++++--------------------------
    - 1 file changed, 133 insertions(+), 96 deletions(-)
    -
    -commit c9a16151577ba459afd6e3528df23bc0ddb95171
    -Author: Lasse Collin 
    -Date:   2012-05-29 22:26:27 +0300
    -
    -    Translations: Update the German translation.
    -
    - po/de.po | 169 ++++++++++++++++++++++++++++++++++-----------------------------
    - 1 file changed, 91 insertions(+), 78 deletions(-)
    -
    -commit 1530a74fd48f8493372edad137a24541efe24713
    -Author: Lasse Collin 
    -Date:   2012-05-29 22:14:21 +0300
    -
    -    Translations: Update Polish translation.
    -
    - po/pl.po | 283 +++++++++++++++++++++++++++++++++++++--------------------------
    - 1 file changed, 165 insertions(+), 118 deletions(-)
    -
    -commit d8db706acb8316f9861abd432cfbe001dd6d0c5c
    -Author: Lasse Collin 
    -Date:   2012-05-28 20:42:11 +0300
    -
    -    liblzma: Fix possibility of incorrect LZMA_BUF_ERROR.
    -    
    -    lzma_code() could incorrectly return LZMA_BUF_ERROR if
    -    all of the following was true:
    -    
    -      - The caller knows how many bytes of output to expect
    -        and only provides that much output space.
    -    
    -      - When the last output bytes are decoded, the
    -        caller-provided input buffer ends right before
    -        the LZMA2 end of payload marker. So LZMA2 won't
    -        provide more output anymore, but it won't know it
    -        yet and thus won't return LZMA_STREAM_END yet.
    -    
    -      - A BCJ filter is in use and it hasn't left any
    -        unfiltered bytes in the temp buffer. This can happen
    -        with any BCJ filter, but in practice it's more likely
    -        with filters other than the x86 BCJ.
    -    
    -    Another situation where the bug can be triggered happens
    -    if the uncompressed size is zero bytes and no output space
    -    is provided. In this case the decompression can fail even
    -    if the whole input file is given to lzma_code().
    -    
    -    A similar bug was fixed in XZ Embedded on 2011-09-19.
    -
    - src/liblzma/simple/simple_coder.c |   2 +-
    - tests/Makefile.am                 |   4 +-
    - tests/test_bcj_exact_size.c       | 112 ++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 116 insertions(+), 2 deletions(-)
    -
    -commit 3f94b6d87f1b8f1c421ba548f8ebb83dca9c8cda
    -Author: Lasse Collin 
    -Date:   2012-05-28 15:38:32 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 7769ea051d739a38a1640fd448cf5eb83cb119c6
    -Author: Lasse Collin 
    -Date:   2012-05-28 15:37:43 +0300
    -
    -    xz: Don't show a huge number in -vv when memory limit is disabled.
    -
    - src/xz/message.c | 12 +++++++++++-
    - 1 file changed, 11 insertions(+), 1 deletion(-)
    -
    -commit ec921105725e4d3ef0a683dd83eee6f24ab60ccd
    -Author: Lasse Collin 
    -Date:   2012-05-27 22:30:17 +0300
    -
    -    xz: Document the "summary" lines of --robot -lvv.
    -    
    -    This documents only the columns that are in v5.0.
    -    The new columns added in the master branch aren't
    -    necessarily stable yet.
    -
    - src/xz/xz.1 | 19 +++++++++++++++++++
    - 1 file changed, 19 insertions(+)
    -
    -commit 27d24eb0a9f6eed96d6a4594c2b0bf7a91d29f9a
    -Author: Lasse Collin 
    -Date:   2012-05-27 21:53:20 +0300
    -
    -    xz: Fix output of verbose --robot --list modes.
    -    
    -    It printed the filename in "filename (x/y)" format
    -    which it obviously shouldn't do in robot mode.
    -
    - src/xz/message.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit ab25b82a91754d9388c89abddf806424671d9431
    -Author: Lasse Collin 
    -Date:   2012-05-24 18:33:54 +0300
    -
    -    Build: Upgrade m4/acx_pthread.m4 to the latest version.
    -
    - m4/ax_pthread.m4 | 98 +++++++++++++++++++++++++++++++++++---------------------
    - 1 file changed, 62 insertions(+), 36 deletions(-)
    -
    -commit d05d6d65c41a4bc83f162fa3d67c5d84e8751634
    -Author: Lasse Collin 
    -Date:   2012-05-10 21:15:17 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit e077391982f9f28dbfe542bba8800e7c5b916666
    -Author: Lasse Collin 
    -Date:   2012-05-10 21:14:16 +0300
    -
    -    Docs: Cleanup line wrapping a bit.
    -
    - README          | 12 ++++++------
    - doc/history.txt | 49 +++++++++++++++++++++++++------------------------
    - 2 files changed, 31 insertions(+), 30 deletions(-)
    -
    -commit fc39849c350225c6a1cd7f6e6adff1020521eabc
    -Author: Benno Schulenberg 
    -Date:   2012-03-13 22:04:04 +0100
    -
    -    Fix a few typos and add some missing articles in some documents.
    -    
    -    Also hyphenate several compound adjectives.
    -    
    -    Signed-off-by: Benno Schulenberg 
    -
    - AUTHORS         |  6 +++---
    - README          | 42 ++++++++++++++++++++---------------------
    - doc/faq.txt     | 24 ++++++++++++------------
    - doc/history.txt | 58 ++++++++++++++++++++++++++++-----------------------------
    - 4 files changed, 65 insertions(+), 65 deletions(-)
    -
    -commit 29fa0566d5df199cb9acb2d17bf7eea61acc7fa1
    -Author: Lasse Collin 
    -Date:   2012-04-29 11:51:25 +0300
    -
    -    Windows: Update notes about static linking with MSVC.
    -
    - windows/README-Windows.txt | 13 +++++++++----
    - 1 file changed, 9 insertions(+), 4 deletions(-)
    -
    -commit aac1b31ea4e66cf5a7a8c116bdaa15aa45e6c56e
    -Author: Lasse Collin 
    -Date:   2012-04-19 15:25:26 +0300
    -
    -    liblzma: Remove outdated comments.
    -
    - src/liblzma/simple/simple_coder.c   | 3 ---
    - src/liblzma/simple/simple_private.h | 3 +--
    - 2 files changed, 1 insertion(+), 5 deletions(-)
    -
    -commit df14a46013bea70c0bd35be7821b0b9108f97de7
    -Author: Lasse Collin 
    -Date:   2012-04-19 14:17:52 +0300
    -
    -    DOS: Link against DJGPP's libemu to support FPU emulation.
    -    
    -    This way xz should work on 386SX and 486SX. Floating point
    -    only is needed for verbose output in xz.
    -
    - dos/Makefile | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 03ed742a3a4931bb5c821357832083b26f577b13
    -Author: Lasse Collin 
    -Date:   2012-04-19 14:02:25 +0300
    -
    -    liblzma: Fix Libs.private in liblzma.pc to include -lrt when needed.
    -
    - src/liblzma/liblzma.pc.in | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 8c5b13ad59df70f49429bfdfd6ac120b8f892fda
    -Author: Lasse Collin 
    -Date:   2012-04-19 13:58:55 +0300
    -
    -    Docs: Update MINIX 3 information in INSTALL.
    -
    - INSTALL | 8 +++++---
    - 1 file changed, 5 insertions(+), 3 deletions(-)
    -
    -commit c7376fc415a1566f38b2de4b516a17013d516a8b
    -Author: Lasse Collin 
    -Date:   2012-02-22 14:23:13 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit cff070aba6281ba743d29a62b8c0c66e5da4b2a6
    -Author: Lasse Collin 
    -Date:   2012-02-22 14:02:34 +0200
    -
    -    Fix exit status of xzgrep when grepping binary files.
    -    
    -    When grepping binary files, grep may exit before it has
    -    read all the input. In this case, gzip -q returns 2 (eating
    -    SIGPIPE), but xz and bzip2 show SIGPIPE as the exit status
    -    (e.g. 141). This causes wrong exit status when grepping
    -    xz- or bzip2-compressed binary files.
    -    
    -    The fix checks for the special exit status that indicates SIGPIPE.
    -    It uses kill -l which should be supported everywhere since it
    -    is in both SUSv2 (1997) and POSIX.1-2008.
    -    
    -    Thanks to James Buren for the bug report.
    -
    - src/scripts/xzgrep.in | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit 41cafb2bf9beea915710ee68f05fe929cd17759c
    -Author: Lasse Collin 
    -Date:   2012-02-22 12:08:43 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 2dcea03712fa881930d69ec9eff70855c3d126d9
    -Author: Lasse Collin 
    -Date:   2012-02-22 12:00:16 +0200
    -
    -    Fix compiling with IBM XL C on AIX.
    -
    - INSTALL      | 36 ++++++++++++++++++++++--------------
    - configure.ac |  6 +++++-
    - 2 files changed, 27 insertions(+), 15 deletions(-)
    -
    -commit 7db6bdf4abcf524115be2cf5659ed540cef074c5
    -Author: Lasse Collin 
    -Date:   2012-01-10 17:13:03 +0200
    -
    -    Tests: Fix a compiler warning with _FORTIFY_SOURCE.
    -    
    -    Reported here:
    -    http://sourceforge.net/projects/lzmautils/forums/forum/708858/topic/4927385
    -
    - tests/create_compress_files.c | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit 694952d545b6cf056547893ced69486eff9ece55
    -Author: Lasse Collin 
    -Date:   2011-12-19 21:21:29 +0200
    -
    -    Docs: Explain the stable releases better in README.
    -
    - README | 6 +++++-
    - 1 file changed, 5 insertions(+), 1 deletion(-)
    -
    -commit 418fe668b3c53a9a20020b6cc652aaf25c734b29
    -Author: Lasse Collin 
    -Date:   2011-11-07 13:07:52 +0200
    -
    -    xz: Show minimum required XZ Utils version in xz -lvv.
    -    
    -    Man page wasn't updated yet.
    -
    - src/xz/list.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++------
    - 1 file changed, 57 insertions(+), 6 deletions(-)
    -
    -commit 7081d82c37326bac97184e338345fa1c327e3580
    -Author: Lasse Collin 
    -Date:   2011-11-04 17:57:16 +0200
    -
    -    xz: Fix a typo in a comment.
    -    
    -    Thanks to Bela Lubkin.
    -
    - src/xz/args.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 232fe7cd70ad258d6a37f17e860e0f1b1891eeb5
    -Author: Lasse Collin 
    -Date:   2011-11-03 17:08:02 +0200
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 74d2bae4d3449c68453b0473dd3430ce91fd90c1
    -Author: Lasse Collin 
    -Date:   2011-11-03 17:07:22 +0200
    -
    -    xz: Fix xz on EBCDIC systems.
    -    
    -    Thanks to Chris Donawa.
    -
    - src/xz/coder.c | 5 ++++-
    - 1 file changed, 4 insertions(+), 1 deletion(-)
    -
    -commit 4ac4923f47cc0ef97dd9ca5cfcc44fc53eeab34a
    -Author: Lasse Collin 
    -Date:   2011-10-23 17:09:10 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit ab50ae3ef40c81e5bf613905ca3fd636548b75e7
    -Author: Lasse Collin 
    -Date:   2011-10-23 17:08:14 +0300
    -
    -    liblzma: Fix invalid free() in the threaded encoder.
    -    
    -    It was triggered if initialization failed e.g. due to
    -    running out of memory.
    -    
    -    Thanks to Arkadiusz Miskiewicz.
    -
    - src/liblzma/common/outqueue.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 6b620a0f0813d28c3c544b4ff8cb595b38a6e908
    -Author: Lasse Collin 
    -Date:   2011-10-23 17:05:55 +0300
    -
    -    liblzma: Fix a deadlock in the threaded encoder.
    -    
    -    It was triggered when reinitializing the encoder,
    -    e.g. when encoding two files.
    -
    - src/liblzma/common/stream_encoder_mt.c | 4 +++-
    - 1 file changed, 3 insertions(+), 1 deletion(-)
    -
    -commit bd52cf150ecd51e3ab63a9cc1a3cff6a77500178
    -Author: Lasse Collin 
    -Date:   2011-09-06 12:03:41 +0300
    -
    -    Build: Fix "make check" on Windows.
    -
    - tests/Makefile.am  | 7 +++++--
    - windows/build.bash | 2 ++
    - 2 files changed, 7 insertions(+), 2 deletions(-)
    -
    -commit 5c5b2256969ac473001b7d67615ed3bd0a54cc82
    -Author: Lasse Collin 
    -Date:   2011-08-09 21:19:13 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 5b1e1f10741af9e4bbe4cfc3261fb7c7b04f7809
    -Author: Lasse Collin 
    -Date:   2011-08-09 21:16:44 +0300
    -
    -    Workaround unusual SIZE_MAX on SCO OpenServer.
    -
    - src/common/sysdefs.h | 9 ++++++---
    - 1 file changed, 6 insertions(+), 3 deletions(-)
    -
    -commit e9ed88126eee86e2511fa42681a5c7104820cf0a
    -Author: Lasse Collin 
    -Date:   2011-08-06 20:37:28 +0300
    -
    -    Run the scripts with the correct shell in test_scripts.sh.
    -    
    -    The scripts are now made executable in the build tree.
    -    This way the scripts can be run like programs in
    -    test_scripts.sh. Previously test_scripts.sh always
    -    used sh but it's not correct if @POSIX_SHELL@ is set
    -    to something else by configure.
    -    
    -    Thanks to Jonathan Nieder for the patch.
    -
    - configure.ac          | 8 ++++----
    - tests/test_scripts.sh | 8 ++++----
    - 2 files changed, 8 insertions(+), 8 deletions(-)
    -
    -commit 1c673e5681720491a74fc4b2992e075f47302c22
    -Author: Lasse Collin 
    -Date:   2011-07-31 11:01:47 +0300
    -
    -    Fix exit status of "xzdiff foo.xz bar.xz".
    -    
    -    xzdiff was clobbering the exit status from diff in a case
    -    statement used to analyze the exit statuses from "xz" when
    -    its operands were two compressed files. Save and restore
    -    diff's exit status to fix this.
    -    
    -    The bug is inherited from zdiff in GNU gzip and was fixed
    -    there on 2009-10-09.
    -    
    -    Thanks to Jonathan Nieder for the patch and
    -    to Peter Pallinger for reporting the bug.
    -
    - src/scripts/xzdiff.in |  2 ++
    - tests/Makefile.am     |  4 +++-
    - tests/test_scripts.sh | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 59 insertions(+), 1 deletion(-)
    -
    -commit 324cde7a864f4506c32ae7846d688c359a83fe65
    -Author: Lasse Collin 
    -Date:   2011-06-16 12:15:29 +0300
    -
    -    liblzma: Remove unneeded semicolon.
    -
    - src/liblzma/lz/lz_encoder_hash.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 492c86345551a51a29bf18e55fe55a5e86f169ce
    -Author: Lasse Collin 
    -Date:   2011-05-28 19:24:56 +0300
    -
    -    Build: Make configure print if symbol versioning is enabled or not.
    -
    - configure.ac | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit fc4d4436969bd4d71b704d400a165875e596034a
    -Author: Lasse Collin 
    -Date:   2011-05-28 16:43:26 +0300
    -
    -    Don't call close(-1) in tuklib_open_stdxxx() on error.
    -    
    -    Thanks to Jim Meyering.
    -
    - src/common/tuklib_open_stdxxx.c | 4 +++-
    - 1 file changed, 3 insertions(+), 1 deletion(-)
    -
    -commit bd35d903a04c4d388adb4065b0fa271302380895
    -Author: Lasse Collin 
    -Date:   2011-05-28 15:55:39 +0300
    -
    -    liblzma: Use symbol versioning.
    -    
    -    Symbol versioning is enabled by default on GNU/Linux,
    -    other GNU-based systems, and FreeBSD.
    -    
    -    I'm not sure how stable this is, so it may need
    -    backward-incompatible changes before the next release.
    -    
    -    The idea is that alpha and beta symbols are considered
    -    unstable and require recompiling the applications that
    -    use those symbols. Once a symbol is stable, it may get
    -    extended with new features in ways that don't break
    -    compatibility with older ABI & API.
    -    
    -    The mydist target runs validate_map.sh which should
    -    catch some probable problems in liblzma.map. Otherwise
    -    I would forget to update the map file for new releases.
    -
    - Makefile.am                 |   1 +
    - configure.ac                |  21 +++++++++
    - src/liblzma/Makefile.am     |   6 +++
    - src/liblzma/liblzma.map     | 105 ++++++++++++++++++++++++++++++++++++++++++++
    - src/liblzma/validate_map.sh |  68 ++++++++++++++++++++++++++++
    - 5 files changed, 201 insertions(+)
    -
    -commit afbb244362c9426a37ce4eb9d54aab768da3adad
    -Author: Lasse Collin 
    -Date:   2011-05-28 09:46:46 +0300
    -
    -    Translations: Update the Italian translation.
    -    
    -    Thanks to Milo Casagrande.
    -
    - po/it.po | 365 +++++++++++++++++++++++++++++++++++++--------------------------
    - 1 file changed, 216 insertions(+), 149 deletions(-)
    -
    -commit 79bef85e0543c0c3723281c3c817616c6cec343b
    -Author: Lasse Collin 
    -Date:   2011-05-28 08:46:04 +0300
    -
    -    Tests: Add a test file for the bug in the previous commit.
    -
    - tests/files/README                  |   4 ++++
    - tests/files/bad-1-block_header-6.xz | Bin 0 -> 72 bytes
    - 2 files changed, 4 insertions(+)
    -
    -commit c0297445064951807803457dca1611b3c47e7f0f
    -Author: Lasse Collin 
    -Date:   2011-05-27 22:25:44 +0300
    -
    -    xz: Fix error handling in xz -lvv.
    -    
    -    It could do an invalid free() and read past the end
    -    of the uninitialized filters array.
    -
    - src/xz/list.c | 21 ++++++---------------
    - 1 file changed, 6 insertions(+), 15 deletions(-)
    -
    -commit 8bd91918ac50731f00b1a2a48072980572eb2ff9
    -Author: Lasse Collin 
    -Date:   2011-05-27 22:09:49 +0300
    -
    -    liblzma: Handle allocation failures correctly in lzma_index_init().
    -    
    -    Thanks to Jim Meyering.
    -
    - src/liblzma/common/index.c | 7 +++++--
    - 1 file changed, 5 insertions(+), 2 deletions(-)
    -
    -commit fe00f95828ef5627721b57e054f7eb2d42a2c961
    -Author: Lasse Collin 
    -Date:   2011-05-24 00:23:46 +0300
    -
    -    Build: Fix checking for system-provided SHA-256.
    -
    - configure.ac | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 21b45b9bab541f419712cbfd473ccc31802e0397
    -Author: Lasse Collin 
    -Date:   2011-05-23 18:30:30 +0300
    -
    -    Build: Set GZIP_ENV=-9n in top-level Makefile.am.
    -
    - Makefile.am | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 48053e8a4550233af46359024538bff90c870ab1
    -Author: Lasse Collin 
    -Date:   2011-05-22 16:42:11 +0300
    -
    -    Update NEWS for 5.0.3.
    -
    - NEWS | 32 ++++++++++++++++++++++++++++++++
    - 1 file changed, 32 insertions(+)
    -
    -commit bba37df2c9e54ad773e15ff00a09d2d6989fb3b2
    -Author: Lasse Collin 
    -Date:   2011-05-21 16:28:44 +0300
    -
    -    Add French translation.
    -    
    -    It is known that the BCJ filter --help text is only
    -    partially translated.
    -
    - po/LINGUAS |   1 +
    - po/fr.po   | 864 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 865 insertions(+)
    -
    -commit 4161d7634965a7a287bf208dcd79f6185f448fe8
    -Author: Lasse Collin 
    -Date:   2011-05-21 15:12:10 +0300
    -
    -    xz: Translate also the string used to print the program name.
    -    
    -    French needs a space before a colon, e.g. "xz : foo error".
    -
    - src/xz/message.c | 6 +++++-
    - 1 file changed, 5 insertions(+), 1 deletion(-)
    -
    -commit b94aa0c8380cdb18cddb33440d625474c16643cf
    -Author: Lasse Collin 
    -Date:   2011-05-21 15:08:44 +0300
    -
    -    liblzma: Try to use SHA-256 from the operating system.
    -    
    -    If the operating system libc or other base libraries
    -    provide SHA-256, use that instead of our own copy.
    -    Note that this doesn't use OpenSSL or libgcrypt or
    -    such libraries to avoid creating dependencies to
    -    other packages.
    -    
    -    This supports at least FreeBSD, NetBSD, OpenBSD, Solaris,
    -    MINIX, and Darwin. They all provide similar but not
    -    identical SHA-256 APIs; everyone is a little different.
    -    
    -    Thanks to Wim Lewis for the original patch, improvements,
    -    and testing.
    -
    - configure.ac                   | 54 +++++++++++++++++++++++++++
    - src/liblzma/check/Makefile.inc |  2 +
    - src/liblzma/check/check.h      | 83 ++++++++++++++++++++++++++++++++++++++----
    - 3 files changed, 131 insertions(+), 8 deletions(-)
    -
    -commit f004128678d43ea10b4a6401aa184cf83252d6ec
    -Author: Lasse Collin 
    -Date:   2011-05-17 12:52:18 +0300
    -
    -    Don't use clockid_t in mythread.h when clock_gettime() isn't available.
    -    
    -    Thanks to Wim Lewis for the patch.
    -
    - src/common/mythread.h | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit f779516f42ebd2db47a5b7d6143459bf7737cf2f
    -Author: Lasse Collin 
    -Date:   2011-05-17 12:26:28 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 830ba587775bb562f6eaf05cad61bf669d1f8892
    -Author: Lasse Collin 
    -Date:   2011-05-17 12:21:33 +0300
    -
    -    Update INSTALL with a note about linker problem on OpenSolaris x86.
    -
    - INSTALL | 23 +++++++++++++++++------
    - 1 file changed, 17 insertions(+), 6 deletions(-)
    -
    -commit ec7106309c8060e9c646dba20c4f15689a0bbb04
    -Author: Lasse Collin 
    -Date:   2011-05-17 12:01:37 +0300
    -
    -    Build: Fix initialization of enable_check_* variables in configure.ac.
    -    
    -    This doesn't matter much in practice since it is unlikely
    -    that anyone would have such environment variable names.
    -    
    -    Thanks to Wim Lewis.
    -
    - configure.ac | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 4c6e146df99696920f12410fb17754412797ef36
    -Author: Lasse Collin 
    -Date:   2011-05-17 11:54:38 +0300
    -
    -    Add underscores to attributes (__attribute((__foo__))).
    -
    - src/liblzma/common/alone_decoder.c |  2 +-
    - src/liblzma/common/alone_encoder.c |  2 +-
    - src/liblzma/common/block_encoder.c |  2 +-
    - src/liblzma/common/common.c        |  2 +-
    - src/liblzma/common/common.h        |  2 +-
    - src/liblzma/common/index_decoder.c |  9 +++++----
    - src/liblzma/common/index_encoder.c | 11 ++++++-----
    - src/liblzma/delta/delta_encoder.c  |  2 +-
    - src/liblzma/lz/lz_decoder.c        |  2 +-
    - src/liblzma/lz/lz_encoder.c        |  2 +-
    - src/liblzma/simple/arm.c           |  2 +-
    - src/liblzma/simple/armthumb.c      |  2 +-
    - src/liblzma/simple/ia64.c          |  2 +-
    - src/liblzma/simple/powerpc.c       |  2 +-
    - src/liblzma/simple/simple_coder.c  |  2 +-
    - src/liblzma/simple/sparc.c         |  2 +-
    - src/lzmainfo/lzmainfo.c            |  4 ++--
    - src/xz/coder.c                     |  2 +-
    - src/xz/hardware.h                  |  2 +-
    - src/xz/message.c                   |  2 +-
    - src/xz/message.h                   | 18 +++++++++---------
    - src/xz/options.c                   |  6 +++---
    - src/xz/signals.c                   |  2 +-
    - src/xz/util.h                      |  6 +++---
    - src/xzdec/xzdec.c                  |  6 +++---
    - 25 files changed, 49 insertions(+), 47 deletions(-)
    -
    -commit 7a480e485938884ef3021b48c3b0b9f9699dc9b6
    -Author: Lasse Collin 
    -Date:   2011-05-01 12:24:23 +0300
    -
    -    xz: Fix input file position when --single-stream is used.
    -    
    -    Now the following works as you would expect:
    -    
    -        echo foo | xz > foo.xz
    -        echo bar | xz >> foo.xz
    -        ( xz -dc --single-stream ; xz -dc --single-stream ) < foo.xz
    -    
    -    Note that it doesn't work if the input is not seekable
    -    or if there is Stream Padding between the concatenated
    -    .xz Streams.
    -
    - src/xz/coder.c   |  1 +
    - src/xz/file_io.c | 15 +++++++++++++++
    - src/xz/file_io.h | 13 +++++++++++++
    - 3 files changed, 29 insertions(+)
    -
    -commit c29e6630c1450c630c4e7b783bdd76515db9004c
    -Author: Lasse Collin 
    -Date:   2011-05-01 12:15:51 +0300
    -
    -    xz: Print the maximum number of worker threads in xz -vv.
    -
    - src/xz/coder.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 0b77c4a75158ccc416b07d6e81df8ee0abaea720
    -Author: Lasse Collin 
    -Date:   2011-04-19 10:44:48 +0300
    -
    -    Build: Warn if no supported method to detect the number of CPU cores.
    -
    - configure.ac | 11 +++++------
    - 1 file changed, 5 insertions(+), 6 deletions(-)
    -
    -commit e4622df9ab4982f8faa53d85b17be66216175a58
    -Author: Lasse Collin 
    -Date:   2011-04-19 09:55:06 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 9c1b05828a88eff54409760b92162c7cc2c7cff6
    -Author: Lasse Collin 
    -Date:   2011-04-19 09:20:44 +0300
    -
    -    Fix portability problems in mythread.h.
    -    
    -    Use gettimeofday() if clock_gettime() isn't available
    -    (e.g. Darwin).
    -    
    -    The test for availability of pthread_condattr_setclock()
    -    and CLOCK_MONOTONIC was incorrect. Instead of fixing the
    -    #ifdefs, use an Autoconf test. That way if there exists a
    -    system that supports them but doesn't specify the matching
    -    POSIX #defines, the features will still get detected.
    -    
    -    Don't try to use pthread_sigmask() on OpenVMS. It doesn't
    -    have that function.
    -    
    -    Guard mythread.h against being #included multiple times.
    -
    - configure.ac          |  7 +++++++
    - src/common/mythread.h | 31 +++++++++++++++++++++++++++----
    - 2 files changed, 34 insertions(+), 4 deletions(-)
    -
    -commit 3de00cc75da7b0e7b65e84c62b5351e231f501e9
    -Author: Lasse Collin 
    -Date:   2011-04-18 19:35:49 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit bd5002f5821e3d1b04f2f56989e4a19318e73633
    -Author: Martin Väth 
    -Date:   2011-04-15 04:54:49 -0400
    -
    -    xzgrep: fix typo in $0 parsing
    -    
    -    Reported-by: Diego Elio Pettenò 
    -    Signed-off-by: Martin Väth 
    -    Signed-off-by: Mike Frysinger 
    -
    - src/scripts/xzgrep.in | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 6ef4eabc0acc49e1bb9dc68064706e19fa9fcf48
    -Author: Lasse Collin 
    -Date:   2011-04-12 12:48:31 +0300
    -
    -    Bump the version number to 5.1.1alpha and liblzma soname to 5.0.99.
    -
    - src/liblzma/Makefile.am        | 2 +-
    - src/liblzma/api/lzma/version.h | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 9a4377be0d21e597c66bad6c7452873aebfb3c1c
    -Author: Lasse Collin 
    -Date:   2011-04-12 12:42:37 +0300
    -
    -    Put the unstable APIs behind #ifdef LZMA_UNSTABLE.
    -    
    -    This way people hopefully won't complain if these APIs
    -    change and break code that used an older API.
    -
    - src/liblzma/api/lzma/container.h | 4 ++++
    - src/liblzma/common/common.h      | 2 ++
    - src/xz/private.h                 | 2 ++
    - 3 files changed, 8 insertions(+)
    -
    -commit 3e321a3acd50002cf6fdfd259e910f56d3389bc3
    -Author: Lasse Collin 
    -Date:   2011-04-12 11:59:49 +0300
    -
    -    Remove doubled words from documentation and comments.
    -    
    -    Spot candidates by running these commands:
    -      git ls-files |xargs perl -0777 -n \
    -        -e 'while (/\b(then?|[iao]n|i[fst]|but|f?or|at|and|[dt]o)\s+\1\b/gims)' \
    -        -e '{$n=($` =~ tr/\n/\n/ + 1); ($v=$&)=~s/\n/\\n/g; print "$ARGV:$n:$v\n"}'
    -    
    -    Thanks to Jim Meyering for the original patch.
    -
    - doc/lzma-file-format.txt           | 4 ++--
    - src/liblzma/common/alone_encoder.c | 2 +-
    - src/liblzma/lzma/lzma2_encoder.c   | 2 +-
    - src/xz/file_io.c                   | 2 +-
    - src/xz/xz.1                        | 2 +-
    - windows/INSTALL-Windows.txt        | 2 +-
    - 6 files changed, 7 insertions(+), 7 deletions(-)
    -
    -commit d91a84b534b012d19474f2fda1fbcaef873e1ba4
    -Author: Lasse Collin 
    -Date:   2011-04-12 11:46:01 +0300
    -
    -    Update NEWS.
    -
    - NEWS | 47 +++++++++++++++++++++++++++++++++++++++++++++--
    - 1 file changed, 45 insertions(+), 2 deletions(-)
    -
    -commit 14e6ad8cfe0165c1a8beeb5b2a1536558b29b0a1
    -Author: Lasse Collin 
    -Date:   2011-04-12 11:45:40 +0300
    -
    -    Update TODO.
    -
    - TODO | 12 +++++++++++-
    - 1 file changed, 11 insertions(+), 1 deletion(-)
    -
    -commit 70e750f59793f9b5cd306a5adce9b8e427739e04
    -Author: Lasse Collin 
    -Date:   2011-04-12 11:08:55 +0300
    -
    -    xz: Update the man page about threading.
    -
    - src/xz/xz.1 | 34 ++++++++++++++++++++--------------
    - 1 file changed, 20 insertions(+), 14 deletions(-)
    -
    -commit 24e0406c0fb7494d2037dec033686faf1bf67068
    -Author: Lasse Collin 
    -Date:   2011-04-11 22:06:03 +0300
    -
    -    xz: Add support for threaded compression.
    -
    - src/xz/args.c  |   3 +-
    - src/xz/coder.c | 202 +++++++++++++++++++++++++++++++++++----------------------
    - 2 files changed, 125 insertions(+), 80 deletions(-)
    -
    -commit de678e0c924aa79a19293a8a6ed82e8cb6572a42
    -Author: Lasse Collin 
    -Date:   2011-04-11 22:03:30 +0300
    -
    -    liblzma: Add lzma_stream_encoder_mt() for threaded compression.
    -    
    -    This is the simplest method to do threading, which splits
    -    the uncompressed data into blocks and compresses them
    -    independently from each other. There's room for improvement
    -    especially to reduce the memory usage, but nevertheless,
    -    this is a good start.
    -
    - configure.ac                           |    1 +
    - src/liblzma/api/lzma/container.h       |  163 +++++
    - src/liblzma/common/Makefile.inc        |    7 +
    - src/liblzma/common/common.c            |    9 +-
    - src/liblzma/common/common.h            |   14 +
    - src/liblzma/common/outqueue.c          |  180 ++++++
    - src/liblzma/common/outqueue.h          |  155 +++++
    - src/liblzma/common/stream_encoder_mt.c | 1011 ++++++++++++++++++++++++++++++++
    - 8 files changed, 1539 insertions(+), 1 deletion(-)
    -
    -commit 25fe729532cdf4b8fed56a4519b73cf31efaec50
    -Author: Lasse Collin 
    -Date:   2011-04-11 21:15:07 +0300
    -
    -    liblzma: Add the forgotten lzma_lzma2_block_size().
    -    
    -    This should have been in 5eefc0086d24a65e136352f8c1d19cefb0cbac7a.
    -
    - src/liblzma/lzma/lzma2_encoder.c | 10 ++++++++++
    - src/liblzma/lzma/lzma2_encoder.h |  2 ++
    - 2 files changed, 12 insertions(+)
    -
    -commit 91afb785a1dee34862078d9bf844ef12b8cc3e35
    -Author: Lasse Collin 
    -Date:   2011-04-11 21:04:13 +0300
    -
    -    liblzma: Document lzma_easy_(enc|dec)oder_memusage() better too.
    -
    - src/liblzma/api/lzma/container.h | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit 4a9905302a9e4a1601ae09d650d3f08ce98ae9ee
    -Author: Lasse Collin 
    -Date:   2011-04-11 20:59:07 +0300
    -
    -    liblzma: Document lzma_raw_(enc|dec)oder_memusage() better.
    -    
    -    It didn't mention the return value that is used if
    -    an error occurs.
    -
    - src/liblzma/api/lzma/filter.h | 8 ++++++--
    - 1 file changed, 6 insertions(+), 2 deletions(-)
    -
    -commit 0badb0b1bd649163322783b0bd9e590b4bc7a93d
    -Author: Lasse Collin 
    -Date:   2011-04-11 19:28:18 +0300
    -
    -    liblzma: Use memzero() to initialize supported_actions[].
    -    
    -    This is cleaner and makes it simpler to add new members
    -    to lzma_action enumeration.
    -
    - src/liblzma/common/common.c | 6 ++----
    - 1 file changed, 2 insertions(+), 4 deletions(-)
    -
    -commit a7934c446a58e20268689899d2a39f50e571f251
    -Author: Lasse Collin 
    -Date:   2011-04-11 19:26:27 +0300
    -
    -    liblzma: API comment about lzma_allocator with threaded coding.
    -
    - src/liblzma/api/lzma/base.h | 18 +++++++++++++-----
    - 1 file changed, 13 insertions(+), 5 deletions(-)
    -
    -commit 5eefc0086d24a65e136352f8c1d19cefb0cbac7a
    -Author: Lasse Collin 
    -Date:   2011-04-11 19:16:30 +0300
    -
    -    liblzma: Add an internal function lzma_mt_block_size().
    -    
    -    This is based lzma_chunk_size() that was included in some
    -    development version of liblzma.
    -
    - src/liblzma/common/filter_encoder.c | 46 ++++++++++++++++++-------------------
    - src/liblzma/common/filter_encoder.h |  4 ++--
    - 2 files changed, 24 insertions(+), 26 deletions(-)
    -
    -commit d1199274758049fc523d98c5b860ff814a799eec
    -Author: Lasse Collin 
    -Date:   2011-04-11 13:59:50 +0300
    -
    -    liblzma: Don't create an empty Block in lzma_stream_buffer_encode().
    -    
    -    Empty Block was created if the input buffer was empty.
    -    Empty Block wastes a few bytes of space, but more importantly
    -    it triggers a bug in XZ Utils 5.0.1 and older when trying
    -    to decompress such a file. 5.0.1 and older consider such
    -    files to be corrupt. I thought that no encoder creates empty
    -    Blocks when releasing 5.0.2 but I was wrong.
    -
    - src/liblzma/common/stream_buffer_encoder.c | 20 +++++++++++++-------
    - 1 file changed, 13 insertions(+), 7 deletions(-)
    -
    -commit 3b22fc2c87ec85fcdd385c163b68fc49c97aa848
    -Author: Lasse Collin 
    -Date:   2011-04-11 13:28:40 +0300
    -
    -    liblzma: Fix API docs to mention LZMA_UNSUPPORTED_CHECK.
    -    
    -    This return value was missing from the API comments of
    -    four functions.
    -
    - src/liblzma/api/lzma/block.h     | 1 +
    - src/liblzma/api/lzma/container.h | 3 +++
    - 2 files changed, 4 insertions(+)
    -
    -commit 71b9380145dccf001f22e66a06b9d508905c25ce
    -Author: Lasse Collin 
    -Date:   2011-04-11 13:21:28 +0300
    -
    -    liblzma: Validate encoder arguments better.
    -    
    -    The biggest problem was that the integrity check type
    -    wasn't validated, and e.g. lzma_easy_buffer_encode()
    -    would create a corrupt .xz Stream if given an unsupported
    -    Check ID. Luckily applications don't usually try to use
    -    an unsupport Check ID, so this bug is unlikely to cause
    -    many real-world problems.
    -
    - src/liblzma/common/block_buffer_encoder.c  | 18 ++++++++++++------
    - src/liblzma/common/block_encoder.c         |  5 +++++
    - src/liblzma/common/stream_buffer_encoder.c |  3 +++
    - 3 files changed, 20 insertions(+), 6 deletions(-)
    -
    -commit ec7e3dbad704268825fc48f0bdd4577bc46b4f13
    -Author: Lasse Collin 
    -Date:   2011-04-11 09:57:30 +0300
    -
    -    xz: Move the description of --block-size in --long-help.
    -
    - src/xz/message.c | 8 ++++----
    - 1 file changed, 4 insertions(+), 4 deletions(-)
    -
    -commit cd3086ff443bb282bdf556919c28b3e3cbed8169
    -Author: Lasse Collin 
    -Date:   2011-04-11 09:55:35 +0300
    -
    -    Docs: Document --single-stream and --block-size.
    -
    - src/xz/xz.1 | 38 ++++++++++++++++++++++++++++++++++++--
    - 1 file changed, 36 insertions(+), 2 deletions(-)
    -
    -commit fb64a4924334e3c440865710990fe08090f2fed0
    -Author: Lasse Collin 
    -Date:   2011-04-11 09:27:57 +0300
    -
    -    liblzma: Make lzma_stream_encoder_init() static (second try).
    -    
    -    It's an internal function and it's not needed by
    -    anything outside stream_encoder.c.
    -
    - src/liblzma/common/Makefile.inc     |  1 -
    - src/liblzma/common/easy_encoder.c   |  1 -
    - src/liblzma/common/stream_encoder.c | 13 ++++++-------
    - src/liblzma/common/stream_encoder.h | 23 -----------------------
    - 4 files changed, 6 insertions(+), 32 deletions(-)
    -
    -commit a34730cf6af4d33a4057914e57227b6dfde6567e
    -Author: Lasse Collin 
    -Date:   2011-04-11 08:31:42 +0300
    -
    -    Revert "liblzma: Make lzma_stream_encoder_init() static."
    -    
    -    This reverts commit 352ac82db5d3f64585c07b39e4759388dec0e4d7.
    -    I don't know what I was thinking.
    -
    - src/liblzma/common/Makefile.inc     |  1 +
    - src/liblzma/common/stream_encoder.c |  9 +++++----
    - src/liblzma/common/stream_encoder.h | 23 +++++++++++++++++++++++
    - 3 files changed, 29 insertions(+), 4 deletions(-)
    -
    -commit 9f0a806aef7ea79718e3f1f2baf3564295229a27
    -Author: Lasse Collin 
    -Date:   2011-04-10 21:23:21 +0300
    -
    -    Revise mythread.h.
    -    
    -    This adds:
    -    
    -      - mythread_sync() macro to create synchronized blocks
    -    
    -      - mythread_cond structure and related functions
    -        and macros for condition variables with timed
    -        waiting using a relative timeout
    -    
    -      - mythread_create() to create a thread with all
    -        signals blocked
    -    
    -    Some of these wouldn't need to be inline functions,
    -    but I'll keep them this way for now for simplicity.
    -    
    -    For timed waiting on a condition variable, librt is
    -    now required on some systems to use clock_gettime().
    -    configure.ac was updated to handle this.
    -
    - configure.ac          |   1 +
    - src/common/mythread.h | 200 +++++++++++++++++++++++++++++++++++++++++++++-----
    - 2 files changed, 181 insertions(+), 20 deletions(-)
    -
    -commit 352ac82db5d3f64585c07b39e4759388dec0e4d7
    -Author: Lasse Collin 
    -Date:   2011-04-10 20:37:36 +0300
    -
    -    liblzma: Make lzma_stream_encoder_init() static.
    -    
    -    It's an internal function and it's not needed by
    -    anything outside stream_encoder.c.
    -
    - src/liblzma/common/Makefile.inc     |  1 -
    - src/liblzma/common/stream_encoder.c |  9 ++++-----
    - src/liblzma/common/stream_encoder.h | 23 -----------------------
    - 3 files changed, 4 insertions(+), 29 deletions(-)
    -
    -commit 9e807fe3fe79618ac48f58207cf7082ea20a6928
    -Author: Lasse Collin 
    -Date:   2011-04-10 14:58:10 +0300
    -
    -    DOS: Update the docs and include notes about 8.3 filenames.
    -
    - dos/INSTALL.txt |  79 ++++++++++++++++++++++++++++++++++++
    - dos/README      |  88 ----------------------------------------
    - dos/README.txt  | 123 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 202 insertions(+), 88 deletions(-)
    -
    -commit ebd54dbd6e481d31e80757f900ac8109ad1423c6
    -Author: Lasse Collin 
    -Date:   2011-04-10 13:09:42 +0300
    -
    -    xz/DOS: Add experimental 8.3 filename support.
    -    
    -    This is incompatible with the 8.3 support patch made by
    -    Juan Manuel Guerrero. I think this one is nicer, but
    -    I need to get feedback from DOS users before saying
    -    that this is the final version of 8.3 filename support.
    -
    - src/xz/suffix.c | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++---
    - 1 file changed, 167 insertions(+), 9 deletions(-)
    -
    -commit cd4fe97852bcaeffe674ee51b4613709292a0972
    -Author: Lasse Collin 
    -Date:   2011-04-10 12:47:47 +0300
    -
    -    xz/DOS: Be more careful with the destination file.
    -    
    -    Try to avoid overwriting the source file if --force is
    -    used and the generated destination filename refers to
    -    the source file. This can happen with 8.3 filenames where
    -    extra characters are ignored.
    -    
    -    If the generated output file refers to a special file
    -    like "con" or "prn", refuse to write to it even if --force
    -    is used.
    -
    - src/xz/file_io.c | 35 +++++++++++++++++++++++++++++++++--
    - 1 file changed, 33 insertions(+), 2 deletions(-)
    -
    -commit 607f9f98ae5ef6d49f4c21c806d462bf6b3d6796
    -Author: Lasse Collin 
    -Date:   2011-04-09 18:29:30 +0300
    -
    -    Update THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit fca396b37410d272b754843a5dc13847be443a3a
    -Author: Lasse Collin 
    -Date:   2011-04-09 18:28:58 +0300
    -
    -    liblzma: Add missing #ifdefs to filter_common.c.
    -    
    -    Passing --disable-decoders to configure broke a few
    -    encoders due to missing #ifdefs in filter_common.c.
    -    
    -    Thanks to Jason Gorski for the patch.
    -
    - src/liblzma/common/filter_common.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit b03f6cd3ebadd675f2cc9d518cb26fa860269447
    -Author: Lasse Collin 
    -Date:   2011-04-09 15:24:59 +0300
    -
    -    xz: Avoid unneeded fstat() on DOS-like systems.
    -
    - src/xz/file_io.c | 14 ++++++++------
    - 1 file changed, 8 insertions(+), 6 deletions(-)
    -
    -commit 335fe260a81f61ec99ff5940df733b4c50aedb7c
    -Author: Lasse Collin 
    -Date:   2011-04-09 15:11:13 +0300
    -
    -    xz: Minor internal changes to handling of --threads.
    -    
    -    Now it always defaults to one thread. Maybe this
    -    will change again if a threading method is added
    -    that doesn't affect memory usage.
    -
    - src/xz/args.c     |  4 ++--
    - src/xz/hardware.c | 24 ++++++++++++------------
    - src/xz/hardware.h |  9 ++++-----
    - 3 files changed, 18 insertions(+), 19 deletions(-)
    -
    -commit 9edd6ee895fbe71d245a173f48e511f154a99875
    -Author: Lasse Collin 
    -Date:   2011-04-08 17:53:05 +0300
    -
    -    xz: Change size_t to uint32_t in a few places.
    -
    - src/xz/coder.c | 6 +++---
    - src/xz/coder.h | 2 +-
    - 2 files changed, 4 insertions(+), 4 deletions(-)
    -
    -commit 411013ea4506a6df24d35a060fcbd73a57b73eb3
    -Author: Lasse Collin 
    -Date:   2011-04-08 17:48:41 +0300
    -
    -    xz: Fix a typo in a comment.
    -
    - src/xz/coder.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit b34c5ce4b22e8d7b81f9895d15054af41d17f805
    -Author: Lasse Collin 
    -Date:   2011-04-05 22:41:33 +0300
    -
    -    liblzma: Use TUKLIB_GNUC_REQ to check GCC version in sha256.c.
    -
    - src/liblzma/check/sha256.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit db33117cc85c17e0b897b5312bd5eb43aac41c03
    -Author: Lasse Collin 
    -Date:   2011-04-05 17:12:20 +0300
    -
    -    Build: Upgrade m4/acx_pthread.m4 to the latest version.
    -    
    -    It was renamed to ax_pthread.m4 in Autoconf Archive.
    -
    - configure.ac      |   2 +-
    - m4/acx_pthread.m4 | 279 -----------------------------------------------------
    - m4/ax_pthread.m4  | 283 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 284 insertions(+), 280 deletions(-)
    -
    -commit 1039bfcfc098b69d56ecb39d198a092552eacf6d
    -Author: Lasse Collin 
    -Date:   2011-04-05 15:27:26 +0300
    -
    -    xz: Use posix_fadvise() if it is available.
    -
    - configure.ac     |  3 +++
    - src/xz/file_io.c | 15 +++++++++++++++
    - 2 files changed, 18 insertions(+)
    -
    -commit 1ef3cf44a8eb9512480af4482a5232ea08363b14
    -Author: Lasse Collin 
    -Date:   2011-04-05 15:13:29 +0300
    -
    -    xz: Call lzma_end(&strm) before exiting if debugging is enabled.
    -
    - src/xz/coder.c | 10 ++++++++++
    - src/xz/coder.h |  5 +++++
    - src/xz/main.c  |  4 ++++
    - 3 files changed, 19 insertions(+)
    -
    -commit bd432015d33dcade611d297bc01eb0700088ef6c
    -Author: Lasse Collin 
    -Date:   2011-04-02 14:49:56 +0300
    -
    -    liblzma: Fix a memory leak in stream_encoder.c.
    -    
    -    It leaks old filter options structures (hundred bytes or so)
    -    every time the lzma_stream is reinitialized. With the xz tool,
    -    this happens when compressing multiple files.
    -
    - src/liblzma/common/stream_encoder.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 16889013214e7620d204b6e6c1bf9f3103a13655
    -Author: Lasse Collin 
    -Date:   2011-04-01 08:47:20 +0300
    -
    -    Updated NEWS for 5.0.2.
    -
    - NEWS | 18 ++++++++++++++++++
    - 1 file changed, 18 insertions(+)
    -
    -commit 85cdf7dd4e97b078e7b929e47f55a7f1da36010f
    -Author: Lasse Collin 
    -Date:   2011-03-31 15:06:58 +0300
    -
    -    Update INSTALL with another note about IRIX.
    -
    - INSTALL | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit c3f4995586873d6a4fb7e451010a128571a9a370
    -Author: Lasse Collin 
    -Date:   2011-03-31 12:22:55 +0300
    -
    -    Tests: Add a new file to test empty LZMA2 streams.
    -
    - tests/files/README            |   4 ++++
    - tests/files/good-1-lzma2-5.xz | Bin 0 -> 52 bytes
    - 2 files changed, 4 insertions(+)
    -
    -commit 0d21f49a809dc2088da6cc0da7f948404df7ecfa
    -Author: Lasse Collin 
    -Date:   2011-03-31 11:54:48 +0300
    -
    -    liblzma: Fix decoding of LZMA2 streams having no uncompressed data.
    -    
    -    The decoder considered empty LZMA2 streams to be corrupt.
    -    This shouldn't matter much with .xz files, because no encoder
    -    creates empty LZMA2 streams in .xz. This bug is more likely
    -    to cause problems in applications that use raw LZMA2 streams.
    -
    - src/liblzma/lzma/lzma2_decoder.c | 8 ++++----
    - 1 file changed, 4 insertions(+), 4 deletions(-)
    -
    -commit 40277998cb9bad564ce4827aff152e6e1c904dfa
    -Author: Lasse Collin 
    -Date:   2011-03-24 01:42:49 +0200
    -
    -    Scripts: Better fix for xzgrep.
    -    
    -    Now it uses "grep -q".
    -    
    -    Thanks to Gregory Margo.
    -
    - src/scripts/xzgrep.in | 8 ++++++--
    - 1 file changed, 6 insertions(+), 2 deletions(-)
    -
    -commit 2118733045ad0ca183a3f181a0399baf876983a6
    -Author: Lasse Collin 
    -Date:   2011-03-24 01:22:18 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit c7210d9a3fca6f31a57208bfddfc9ab20a2e097a
    -Author: Lasse Collin 
    -Date:   2011-03-24 01:21:32 +0200
    -
    -    Scripts: Fix xzgrep -l.
    -    
    -    It didn't work at all. It tried to use the -q option
    -    for grep, but it appended it after "--". This works
    -    around it by redirecting to /dev/null. The downside
    -    is that this can be slower with big files compared
    -    to proper use of "grep -q".
    -    
    -    Thanks to Gregory Margo.
    -
    - src/scripts/xzgrep.in | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 4eb83e32046a6d670862bc91c3d82530963b455e
    -Author: Lasse Collin 
    -Date:   2011-03-19 13:08:22 +0200
    -
    -    Scripts: Add lzop (.lzo) support to xzdiff and xzgrep.
    -
    - src/scripts/xzdiff.1  |  6 ++++--
    - src/scripts/xzdiff.in | 22 ++++++++++++++--------
    - src/scripts/xzgrep.1  | 11 +++++++----
    - src/scripts/xzgrep.in |  5 +++--
    - 4 files changed, 28 insertions(+), 16 deletions(-)
    -
    -commit 923b22483bd9356f3219b2b784d96f455f4dc499
    -Author: Lasse Collin 
    -Date:   2011-03-18 19:10:30 +0200
    -
    -    xz: Add --block-size=SIZE.
    -    
    -    This uses LZMA_FULL_FLUSH every SIZE bytes of input.
    -    
    -    Man page wasn't updated yet.
    -
    - src/xz/args.c    |  7 +++++++
    - src/xz/coder.c   | 50 ++++++++++++++++++++++++++++++++++++++++----------
    - src/xz/coder.h   |  3 +++
    - src/xz/message.c |  4 ++++
    - 4 files changed, 54 insertions(+), 10 deletions(-)
    -
    -commit 57597d42ca1740ad506437be168d800a50f1a0ad
    -Author: Lasse Collin 
    -Date:   2011-03-18 18:19:19 +0200
    -
    -    xz: Add --single-stream.
    -    
    -    This can be useful when there is garbage after the
    -    compressed stream (.xz, .lzma, or raw stream).
    -    
    -    Man page wasn't updated yet.
    -
    - src/xz/args.c    |  6 ++++++
    - src/xz/coder.c   | 11 +++++++++--
    - src/xz/coder.h   |  3 +++
    - src/xz/message.c |  6 +++++-
    - 4 files changed, 23 insertions(+), 3 deletions(-)
    -
    -commit 96f94bc925d579a700147fa5d7793b64d69cfc18
    -Author: Lasse Collin 
    -Date:   2011-02-04 22:49:31 +0200
    -
    -    xz: Clean up suffix.c.
    -    
    -    struct suffix_pair isn't needed in compresed_name()
    -    so get rid of it there.
    -
    - src/xz/suffix.c | 44 ++++++++++++++++++++------------------------
    - 1 file changed, 20 insertions(+), 24 deletions(-)
    -
    -commit 8930c7ae3f82bdae15aa129f01de08be23d7e8d7
    -Author: Lasse Collin 
    -Date:   2011-02-04 11:29:47 +0200
    -
    -    xz: Check if the file already has custom suffix when compressing.
    -    
    -    Now "xz -S .test foo.test" refuses to compress the
    -    file because it already has the suffix .test. The man
    -    page had it documented this way already.
    -
    - src/xz/suffix.c | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit 940d5852c6cf08abccc6befd9d1b5411c9076a58
    -Author: Lasse Collin 
    -Date:   2011-02-02 23:01:51 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 4ebe65f839613f27f127bab7b8c347d982330ee3
    -Author: Lasse Collin 
    -Date:   2011-02-02 23:00:33 +0200
    -
    -    Translations: Add Polish translation.
    -    
    -    Thanks to Jakub Bogusz.
    -
    - po/LINGUAS |   1 +
    - po/pl.po   | 825 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 826 insertions(+)
    -
    -commit fc1d292dca1925dfd17174f443f91a696ecd5bf8
    -Author: Lasse Collin 
    -Date:   2011-02-02 22:24:00 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 6dd061adfd2775428b079eb03d6fd47d7c0f1ffe
    -Merge: 9d542ce 5fbce0b
    -Author: Lasse Collin 
    -Date:   2011-02-06 20:13:01 +0200
    -
    -    Merge commit '5fbce0b8d96dc96775aa0215e3581addc830e23d'
    -
    -commit 5fbce0b8d96dc96775aa0215e3581addc830e23d
    -Author: Lasse Collin 
    -Date:   2011-01-28 20:16:57 +0200
    -
    -    Update NEWS for 5.0.1.
    -
    - NEWS | 14 ++++++++++++++
    - 1 file changed, 14 insertions(+)
    -
    -commit 03ebd1bbb314f9f204940219a835c883bf442475
    -Author: Lasse Collin 
    -Date:   2011-01-26 12:19:08 +0200
    -
    -    xz: Fix --force on setuid/setgid/sticky and multi-hardlink files.
    -    
    -    xz didn't compress setuid/setgid/sticky files and files
    -    with multiple hard links even with --force. This bug was
    -    introduced in 23ac2c44c3ac76994825adb7f9a8f719f78b5ee4.
    -    
    -    Thanks to Charles Wilson.
    -
    - src/xz/file_io.c | 15 +++++++--------
    - 1 file changed, 7 insertions(+), 8 deletions(-)
    -
    -commit 9d542ceebcbe40b174169c132ccfcdc720ca7089
    -Merge: 4f2c69a 7bd0a5e
    -Author: Lasse Collin 
    -Date:   2011-01-19 11:45:35 +0200
    -
    -    Merge branch 'v5.0'
    -
    -commit 7bd0a5e7ccc354f7c2e95c8bc27569c820f6a136
    -Author: Lasse Collin 
    -Date:   2011-01-18 21:25:24 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit f71c4e16e913f660977526f0ef8d2acdf458d7c9
    -Author: Lasse Collin 
    -Date:   2011-01-18 21:23:50 +0200
    -
    -    Add alloc_size and malloc attributes to a few functions.
    -    
    -    Thanks to Cristian Rodríguez for the original patch.
    -
    - src/common/sysdefs.h        | 6 ++++++
    - src/liblzma/common/common.h | 2 +-
    - src/xz/util.h               | 5 +++--
    - 3 files changed, 10 insertions(+), 3 deletions(-)
    -
    -commit 316cbe24465143edde8f6ffb7532834b7b2ea93f
    -Author: Lasse Collin 
    -Date:   2010-12-13 16:36:33 +0200
    -
    -    Scripts: Fix gzip and bzip2 support in xzdiff.
    -
    - src/scripts/xzdiff.in | 12 ++++++------
    - 1 file changed, 6 insertions(+), 6 deletions(-)
    -
    -commit 4f2c69a4e3e0aee2e37b0b1671d34086e20c8ac6
    -Merge: adb89e6 9311774
    -Author: Lasse Collin 
    -Date:   2010-12-12 23:13:22 +0200
    -
    -    Merge branch 'v5.0'
    -
    -commit 9311774c493c19deab51ded919dcd2e9c4aa2829
    -Author: Lasse Collin 
    -Date:   2010-12-12 21:23:55 +0200
    -
    -    Build: Enable ASM on DJGPP by default.
    -
    - configure.ac | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 4a42aaee282fc73b482581684d65110506d5efdd
    -Author: Lasse Collin 
    -Date:   2010-12-12 16:09:42 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit ce56f63c41ee210e6308090eb6d49221fdf67d6c
    -Author: Lasse Collin 
    -Date:   2010-12-12 16:07:11 +0200
    -
    -    Add missing PRIx32 and PRIx64 compatibility definitions.
    -    
    -    This fixes portability to systems that lack C99 inttypes.h.
    -    
    -    Thanks to Juan Manuel Guerrero.
    -
    - src/common/sysdefs.h | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit e6baedddcf54e7da049ebc49183565b99facd4c7
    -Author: Lasse Collin 
    -Date:   2010-12-12 14:50:04 +0200
    -
    -    DOS-like: Treat \ and : as directory separators in addition to /.
    -    
    -    Juan Manuel Guerrero had fixed this in his XZ Utils port
    -    to DOS/DJGPP. The bug affects also Windows and OS/2.
    -
    - src/xz/suffix.c | 33 +++++++++++++++++++++++++++++----
    - 1 file changed, 29 insertions(+), 4 deletions(-)
    -
    -commit adb89e68d43a4cadb0c215b45ef7a75737c9c3ec
    -Merge: 7c24e0d b7afd3e
    -Author: Lasse Collin 
    -Date:   2010-12-07 18:53:04 +0200
    -
    -    Merge branch 'v5.0'
    -
    -commit b7afd3e22a8fac115b75c738d40d3eb1de7e286f
    -Author: Lasse Collin 
    -Date:   2010-12-07 18:52:04 +0200
    -
    -    Translations: Fix Czech translation of "sparse file".
    -    
    -    Thanks to Petr Hubený and Marek Černocký.
    -
    - po/cs.po | 88 ++++++++++++++++++++++++++++++++--------------------------------
    - 1 file changed, 44 insertions(+), 44 deletions(-)
    -
    -commit 7c24e0d1b8a2e86e9263b0d56d39621e01aed7af
    -Merge: b4d42f1 3e56470
    -Author: Lasse Collin 
    -Date:   2010-11-15 14:33:01 +0200
    -
    -    Merge branch 'v5.0'
    -
    -commit 3e564704bc6f463cb2db11e3f3f0dbd71d85992e
    -Author: Lasse Collin 
    -Date:   2010-11-15 14:28:26 +0200
    -
    -    liblzma: Document the return value of lzma_lzma_preset().
    -
    - src/liblzma/api/lzma/lzma.h | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 2964d8d691ed92abdcf214888d79ad6d79774735
    -Author: Jonathan Nieder 
    -Date:   2010-11-12 15:22:13 -0600
    -
    -    Simplify paths in generated API docs
    -    
    -    Currently the file list generated by Doxygen has src/ at the
    -    beginning of each path.  Paths like common/sysdefs.h and
    -    liblzma/api/lzma.h are easier to read without such a prefix.
    -    
    -    Builds from a separate build directory with
    -    
    -    	mkdir build
    -    	cd build
    -    	../configure
    -    	doxygen Doxyfile
    -    
    -    include an even longer prefix /home/someone/src/xz/src; this
    -    patch has the nice side-effect of eliminating that prefix, too.
    -    
    -    Fixes: http://bugs.debian.org/572273
    -
    - Doxyfile.in | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit b4d42f1a7120e2cefeb2f14425efe2ca6db85416
    -Author: Anders F Bjorklund 
    -Date:   2010-11-05 12:56:11 +0100
    -
    -    add build script for macosx universal
    -
    - macosx/build.sh | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 92 insertions(+)
    -
    -commit 15ee6935abe4a2fc76639ee342ca2e69af3e0ad6
    -Author: Lasse Collin 
    -Date:   2010-11-04 18:31:40 +0200
    -
    -    Update the copies of GPLv2 and LGPLv2.1 from gnu.org.
    -    
    -    There are only a few white space changes.
    -
    - COPYING.GPLv2    | 14 +++++++-------
    - COPYING.LGPLv2.1 | 16 +++++++---------
    - 2 files changed, 14 insertions(+), 16 deletions(-)
    -
    -commit 8e355f7fdbeee6fe394eb02a28f267ce99a882a2
    -Merge: 974ebe6 37c2565
    -Author: Lasse Collin 
    -Date:   2010-10-26 15:53:06 +0300
    -
    -    Merge branch 'v5.0'
    -
    -commit 37c25658efd25b034266daf87cd381d20d1df776
    -Author: Lasse Collin 
    -Date:   2010-10-26 15:48:48 +0300
    -
    -    Build: Copy the example programs to $docdir/examples.
    -    
    -    The example programs by Daniel Mealha Cabrita were included
    -    in the git repository, but I had forgot to add them to
    -    Makefile.am. Thus, they didn't get included in the source
    -    package at all by "make dist".
    -
    - Makefile.am        | 5 +++++
    - windows/build.bash | 3 ++-
    - 2 files changed, 7 insertions(+), 1 deletion(-)
    -
    -commit 974ebe63497bdf0d262e06474f0dd5a70b1dd000
    -Author: Lasse Collin 
    -Date:   2010-10-26 10:36:41 +0300
    -
    -    liblzma: Rename a few variables and constants.
    -    
    -    This has no semantic changes. I find the new names slightly
    -    more logical and they match the names that are already used
    -    in XZ Embedded.
    -    
    -    The name fastpos wasn't changed (not worth the hassle).
    -
    - src/liblzma/lzma/fastpos.h                     |  55 +++++------
    - src/liblzma/lzma/lzma2_encoder.c               |   2 +-
    - src/liblzma/lzma/lzma_common.h                 |  45 ++++-----
    - src/liblzma/lzma/lzma_decoder.c                |  58 +++++------
    - src/liblzma/lzma/lzma_encoder.c                |  56 +++++------
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c   |   9 +-
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c | 128 ++++++++++++-------------
    - src/liblzma/lzma/lzma_encoder_private.h        |  16 ++--
    - 8 files changed, 183 insertions(+), 186 deletions(-)
    -
    -commit 7c427ec38d016c0070a42315d752857e33792fc4
    -Author: Lasse Collin 
    -Date:   2010-10-25 12:59:25 +0300
    -
    -    Bump version 5.1.0alpha.
    -
    - src/liblzma/api/lzma/version.h | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit e45929260cd902036efd40c5610a8d0a50d5712b
    -Author: Lasse Collin 
    -Date:   2010-10-23 17:25:52 +0300
    -
    -    Build: Fix mydist rule when .git doesn't exist.
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 6e1326fcdf6b6209949be57cfe3ad4b781b65168
    -Author: Lasse Collin 
    -Date:   2010-10-23 14:15:35 +0300
    -
    -    Add NEWS for 5.0.0.
    -
    - NEWS | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 62 insertions(+)
    -
    -commit b667a3ef6338a2c1db7b7706b1f6c99ea392221c
    -Author: Lasse Collin 
    -Date:   2010-10-23 14:02:53 +0300
    -
    -    Bump version to 5.0.0 and liblzma version-info to 5:0:0.
    -
    - src/liblzma/Makefile.am        | 2 +-
    - src/liblzma/api/lzma/version.h | 8 ++++----
    - 2 files changed, 5 insertions(+), 5 deletions(-)
    -
    -commit 8c947e9291691629714dafb4536c718b6cc24fbd
    -Author: Lasse Collin 
    -Date:   2010-10-23 12:30:54 +0300
    -
    -    liblzma: Make lzma_code() check the reserved members in lzma_stream.
    -    
    -    If any of the reserved members in lzma_stream are non-zero
    -    or non-NULL, LZMA_OPTIONS_ERROR is returned. It is possible
    -    that a new feature in the future is indicated by just setting
    -    a reserved member to some other value, so the old liblzma
    -    version need to catch it as an unsupported feature.
    -
    - src/liblzma/common/common.c | 14 ++++++++++++++
    - 1 file changed, 14 insertions(+)
    -
    -commit e61d85e082743ebd2dd0ff28fc0a82482ede0538
    -Author: Lasse Collin 
    -Date:   2010-10-23 12:26:33 +0300
    -
    -    Windows: Use MinGW's stdio functions.
    -    
    -    The non-standard ones from msvcrt.dll appear to work
    -    most of the time with XZ Utils, but there are some
    -    corner cases where things may go very wrong. So it's
    -    good to use the better replacements provided by
    -    MinGW(-w64) runtime.
    -
    - src/common/sysdefs.h | 5 +++++
    - 1 file changed, 5 insertions(+)
    -
    -commit 23e23f1dc029146714c9a98313ab3ea93d71a2fc
    -Author: Lasse Collin 
    -Date:   2010-10-23 12:21:32 +0300
    -
    -    liblzma: Use 512 as INDEX_GROUP_SIZE.
    -    
    -    This lets compiler use shifting instead of 64-bit division.
    -
    - src/liblzma/common/index.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 613939fc82603b75b59eee840871a05bc8dd08e0
    -Author: Lasse Collin 
    -Date:   2010-10-23 12:20:11 +0300
    -
    -    liblzma: A few ABI tweaks to reserve space in structures.
    -
    - src/liblzma/api/lzma/base.h         | 7 ++++++-
    - src/liblzma/api/lzma/lzma.h         | 4 ++--
    - src/liblzma/api/lzma/stream_flags.h | 4 ----
    - 3 files changed, 8 insertions(+), 7 deletions(-)
    -
    -commit 68b83f252df3d27480a9f6f03445d16f6506fef1
    -Author: Lasse Collin 
    -Date:   2010-10-21 23:16:11 +0300
    -
    -    xz: Make sure that message_strm() can never return NULL.
    -
    - src/xz/message.c | 7 +++++--
    - 1 file changed, 5 insertions(+), 2 deletions(-)
    -
    -commit d09c5753e33ff96ee57edb6d1e98e34041203695
    -Author: Lasse Collin 
    -Date:   2010-10-21 23:06:31 +0300
    -
    -    liblzma: Update the comments in the API headers.
    -    
    -    Adding support for LZMA_FINISH for Index encoding and
    -    decoding needed tiny additions to the relevant .c files too.
    -
    - src/liblzma/api/lzma.h              |  4 +--
    - src/liblzma/api/lzma/base.h         | 38 +++++++++++++--------------
    - src/liblzma/api/lzma/bcj.h          |  4 +--
    - src/liblzma/api/lzma/block.h        |  4 +--
    - src/liblzma/api/lzma/container.h    | 26 ++++++++++++-------
    - src/liblzma/api/lzma/filter.h       | 51 ++++++++++++++++++-------------------
    - src/liblzma/api/lzma/hardware.h     |  3 +--
    - src/liblzma/api/lzma/index.h        | 28 ++++++++++++--------
    - src/liblzma/api/lzma/index_hash.h   |  2 +-
    - src/liblzma/api/lzma/lzma.h         | 46 ++++++++++++++++++++++-----------
    - src/liblzma/api/lzma/stream_flags.h |  4 +--
    - src/liblzma/api/lzma/vli.h          | 31 +++++++++++-----------
    - src/liblzma/common/index_decoder.c  |  1 +
    - src/liblzma/common/index_encoder.c  |  1 +
    - 14 files changed, 136 insertions(+), 107 deletions(-)
    -
    -commit 33c1c0e102eb529588503b8beea0903a45488fad
    -Author: Lasse Collin 
    -Date:   2010-10-19 12:08:30 +0300
    -
    -    Update INSTALL.generic.
    -
    - INSTALL.generic | 99 ++++++++++++++++++++++++++++++++++++++++++++++-----------
    - 1 file changed, 81 insertions(+), 18 deletions(-)
    -
    -commit 0076e03641f201c4b77dddd5a6db5880be19a78c
    -Author: Lasse Collin 
    -Date:   2010-10-19 11:44:37 +0300
    -
    -    Clean up a few FIXMEs and TODOs.
    -    
    -    lzma_chunk_size() was commented out because it is
    -    currently useless.
    -
    - src/liblzma/common/filter_encoder.c | 2 ++
    - src/liblzma/common/filter_encoder.h | 4 ++--
    - src/liblzma/lzma/lzma2_decoder.c    | 1 -
    - src/liblzma/lzma/lzma_decoder.c     | 4 ++--
    - src/liblzma/lzma/lzma_encoder.c     | 2 +-
    - src/xz/message.h                    | 2 +-
    - 6 files changed, 8 insertions(+), 7 deletions(-)
    -
    -commit ce34ec4f54ff8b753da236f371ad8dd23c8135c9
    -Author: Lasse Collin 
    -Date:   2010-10-19 10:21:08 +0300
    -
    -    Update docs.
    -
    - INSTALL    | 192 +++++++++++++++++++++++++++++++++++++++++--------------------
    - PACKAGERS  | 104 +++++++++------------------------
    - TODO       |  17 ++++--
    - dos/README |   2 +-
    - 4 files changed, 172 insertions(+), 143 deletions(-)
    -
    -commit f0fa880d247e73264d2c04fe31fb3412318a0026
    -Author: Lasse Collin 
    -Date:   2010-10-12 15:13:30 +0300
    -
    -    xz: Avoid raise() also on OpenVMS.
    -    
    -    This is similar to DOS/DJGPP that killing the program
    -    with a signal will print a backtrace or a similar message.
    -
    - src/xz/signals.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit ac462b1c47c451f5c62e428306314c4bdad8ae7f
    -Author: Lasse Collin 
    -Date:   2010-10-11 21:26:19 +0300
    -
    -    xz: Avoid SA_RESTART for portability reasons.
    -    
    -    SA_RESTART is not as portable as I had hoped. It's missing
    -    at least from OpenVMS, QNX, and DJGPP). Luckily we can do
    -    fine without SA_RESTART.
    -
    - src/xz/message.c | 38 +++++++++++++++-----------------------
    - src/xz/message.h |  4 ++++
    - src/xz/signals.c |  6 ++++++
    - 3 files changed, 25 insertions(+), 23 deletions(-)
    -
    -commit d52b411716a614c202e89ba732492efb9916cd3f
    -Author: Lasse Collin 
    -Date:   2010-10-10 17:58:58 +0300
    -
    -    xz: Use "%"PRIu32 instead of "%d" in a format string.
    -
    - src/xz/message.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit ae74d1bdeb075c3beefe76e1136c5741804e7e91
    -Author: Lasse Collin 
    -Date:   2010-10-10 17:43:26 +0300
    -
    -    test_files.sh: Fix the first line.
    -    
    -    For some reason this prevented running the test only
    -    on OS/2 and even on that it broke only recently.
    -    
    -    Thanks to Elbert Pol.
    -
    - tests/test_files.sh | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit d492b80ddd6f9a13419de6d102df7374d8f448e8
    -Author: Lasse Collin 
    -Date:   2010-10-10 16:49:01 +0300
    -
    -    lzmainfo: Use "%"PRIu32 instead of "%u" for uint32_t.
    -
    - src/lzmainfo/lzmainfo.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 825e859a9054bd91202e5723c41a17e72f63040a
    -Author: Lasse Collin 
    -Date:   2010-10-10 16:47:01 +0300
    -
    -    lzmainfo: Use fileno(stdin) instead of STDIN_FILENO.
    -
    - src/lzmainfo/lzmainfo.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit acbc4cdecbeec2a4dfaac04f185ece49b2ff17c8
    -Author: Lasse Collin 
    -Date:   2010-10-09 23:20:51 +0300
    -
    -    lzmainfo: Use setmode() on DOS-like systems.
    -
    - src/lzmainfo/lzmainfo.c | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit ef364d3abc5647111c5424ea0d83a567e184a23b
    -Author: Lasse Collin 
    -Date:   2010-10-09 21:51:03 +0300
    -
    -    OS/2 and DOS: Be less verbose on signals.
    -    
    -    Calling raise() to kill xz when user has pressed C-c
    -    is a bit verbose on OS/2 and DOS/DJGPP. Instead of
    -    calling raise(), set only the exit status to 1.
    -
    - src/xz/signals.c | 7 +++++++
    - 1 file changed, 7 insertions(+)
    -
    -commit 5629c4be07b6c67e79842b2569da1cedc9c0d69a
    -Author: Lasse Collin 
    -Date:   2010-10-09 19:28:49 +0300
    -
    -    DOS: Update the Makefile, config.h and README.
    -    
    -    This is now simpler and builds only xz.exe.
    -
    - dos/Makefile | 211 +++++++++++++++--------------------------------------------
    - dos/README   |  73 +++++++--------------
    - dos/config.h |  45 ++++---------
    - 3 files changed, 86 insertions(+), 243 deletions(-)
    -
    -commit f25a77e6b9bc48a243ddfbbd755b7960eec7e0ac
    -Author: Lasse Collin 
    -Date:   2010-10-09 18:57:55 +0300
    -
    -    Windows: Put some license info into README-Windows.txt.
    -
    - windows/README-Windows.txt | 8 ++++----
    - 1 file changed, 4 insertions(+), 4 deletions(-)
    -
    -commit e75100f549f85d231df25c07aa94d63e78e2d668
    -Author: Lasse Collin 
    -Date:   2010-10-09 18:57:04 +0300
    -
    -    Windows: Fix a diagnostics bug in build.bash.
    -
    - windows/build.bash | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit efeb998a2b1025df1c1d202cc7d21d866cd1c336
    -Author: Lasse Collin 
    -Date:   2010-10-09 13:02:15 +0300
    -
    -    lzmainfo: Add Windows resource file.
    -
    - src/lzmainfo/Makefile.am        |  9 +++++++++
    - src/lzmainfo/lzmainfo_w32res.rc | 12 ++++++++++++
    - 2 files changed, 21 insertions(+)
    -
    -commit 389d418445f1623593dfdbba55d52fbb6d1205f5
    -Author: Lasse Collin 
    -Date:   2010-10-09 12:57:25 +0300
    -
    -    Add missing public domain notice to lzmadec_w32res.rc.
    -
    - src/xzdec/lzmadec_w32res.rc | 7 +++++++
    - 1 file changed, 7 insertions(+)
    -
    -commit 6389c773a4912dd9f111256d74ba1605230a7957
    -Author: Lasse Collin 
    -Date:   2010-10-09 12:52:12 +0300
    -
    -    Windows: Update common_w32res.rc.
    -
    - src/common/common_w32res.rc | 9 +++------
    - 1 file changed, 3 insertions(+), 6 deletions(-)
    -
    -commit 71275457ca24c9b01721f5cfc3638cf094daf454
    -Author: Lasse Collin 
    -Date:   2010-10-09 12:27:08 +0300
    -
    -    Windows: Make build.bash prefer MinGW-w32 over MinGW.
    -    
    -    This is simply for licensing reasons. The 64-bit version
    -    will be built with MinGW-w64 anyway (at least for now),
    -    so using it also for 32-bit build allows using the same
    -    copyright notice about the MinGW-w64/w32 runtime.
    -    
    -    Note that using MinGW would require a copyright notice too,
    -    because its runtime is not in the public domain either even
    -    though MinGW's home page claims that it is public domain.
    -    See .
    -
    - windows/build.bash | 18 +++++++++---------
    - 1 file changed, 9 insertions(+), 9 deletions(-)
    -
    -commit 3ac35719d8433af937af6491383d4a50e343099b
    -Author: Lasse Collin 
    -Date:   2010-10-09 11:33:21 +0300
    -
    -    Windows: Copy COPYING-Windows.txt (if it exists) to the package.
    -    
    -    Also, put README-Windows.txt to the doc directory like
    -    the other documentation files.
    -
    - windows/build.bash | 14 ++++++++++++--
    - 1 file changed, 12 insertions(+), 2 deletions(-)
    -
    -commit 7b5db576fd7a4a67813b8437a9ccd4dbc94bbaae
    -Author: Lasse Collin 
    -Date:   2010-10-08 21:42:37 +0300
    -
    -    Windows: Fix build.bash again.
    -    
    -    630a8beda34af0ac153c8051b1bf01230558e422 wasn't good.
    -
    - windows/build.bash | 7 ++++---
    - 1 file changed, 4 insertions(+), 3 deletions(-)
    -
    -commit d3cd7abe85ec7c2f46cf198b15c00d5d119df3dd
    -Author: Lasse Collin 
    -Date:   2010-10-08 16:53:20 +0300
    -
    -    Use LZMA_VERSION_STRING instead of PACKAGE_VERSION.
    -    
    -    Those are the same thing, and the former makes it a bit
    -    easier to build the code with other build systems, because
    -    one doesn't need to update the version number into custom
    -    config.h.
    -    
    -    This change affects only lzmainfo. Other tools were already
    -    using LZMA_VERSION_STRING.
    -
    - src/lzmainfo/lzmainfo.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 084c60d318f2dbaef4078d9b100b4a373d0c3a7f
    -Author: Lasse Collin 
    -Date:   2010-10-08 15:59:25 +0300
    -
    -    configure.ac: Remove two unused defines.
    -
    - configure.ac | 4 ----
    - 1 file changed, 4 deletions(-)
    -
    -commit 11f51b6714357cb67ec7e56ed9575c199b5581fe
    -Author: Lasse Collin 
    -Date:   2010-10-08 15:32:29 +0300
    -
    -    Make tests accommodate missing xz or xzdec.
    -
    - tests/test_compress.sh | 47 ++++++++++++++++++++++++++++++-----------------
    - tests/test_files.sh    | 28 ++++++++++++++++++++++++++--
    - 2 files changed, 56 insertions(+), 19 deletions(-)
    -
    -commit b1c7368f95e93ccdefdd0748e04398c26766f47f
    -Author: Lasse Collin 
    -Date:   2010-10-08 15:25:45 +0300
    -
    -    Build: Add options to disable individual command line tools.
    -
    - configure.ac            | 38 ++++++++++++++++++++++++++++++
    - src/Makefile.am         | 15 +++++++++++-
    - src/scripts/Makefile.am | 62 +++++++++++++++++++++----------------------------
    - src/xz/Makefile.am      |  6 ++++-
    - src/xzdec/Makefile.am   | 12 ++++++++--
    - 5 files changed, 93 insertions(+), 40 deletions(-)
    -
    -commit 630a8beda34af0ac153c8051b1bf01230558e422
    -Author: Lasse Collin 
    -Date:   2010-10-07 00:44:53 +0300
    -
    -    Windows: Make build.bash work without --enable-dynamic=no.
    -
    - windows/build.bash | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit f9907503f882a745dce9d84c2968f6c175ba966a
    -Author: Lasse Collin 
    -Date:   2010-10-05 14:13:16 +0300
    -
    -    Build: Remove the static/dynamic tricks.
    -    
    -    Most distros want xz linked against shared liblzma, so
    -    it doesn't help much to require --enable-dynamic for that.
    -    Those who want to avoid PIC on x86-32 to get better
    -    performance, can still do it e.g. by using --disable-shared
    -    to compile xz and then another pass to compile shared liblzma.
    -    
    -    Part of these static/dynamic tricks were needed for Windows
    -    in the past. Nowadays we rely on GCC and binutils to do the
    -    right thing with auto-import. If the Autotooled build system
    -    needs to support some other toolchain on Windows in the future,
    -    this may need some rethinking.
    -
    - configure.ac             | 74 ------------------------------------------------
    - debug/Makefile.am        |  5 +---
    - src/lzmainfo/Makefile.am |  4 +--
    - src/xz/Makefile.am       |  4 +--
    - src/xzdec/Makefile.am    |  4 +--
    - tests/Makefile.am        |  5 +---
    - 6 files changed, 5 insertions(+), 91 deletions(-)
    -
    -commit fda4724d8114fccfa31c1839c15479f350c2fb4c
    -Author: Lasse Collin 
    -Date:   2010-10-05 12:18:58 +0300
    -
    -    configure.ac: Silence a warning from Autoconf 2.68.
    -
    - configure.ac | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 80b5675fa62c87426fe86f8fcd20feeabc4361b9
    -Author: Lasse Collin 
    -Date:   2010-10-04 19:43:01 +0300
    -
    -    A few more languages files to the xz man page.
    -    
    -    Thanks to Jonathan Nieder.
    -
    - src/xz/xz.1 | 45 ++++++++++++++++++++++++---------------------
    - 1 file changed, 24 insertions(+), 21 deletions(-)
    -
    -commit f9722dbeca4dc4c43cfd15d122dafaac50b0a0bb
    -Author: Lasse Collin 
    -Date:   2010-10-02 12:07:33 +0300
    -
    -    Update the FAQ.
    -
    - doc/faq.txt | 104 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
    - 1 file changed, 100 insertions(+), 4 deletions(-)
    -
    -commit 61ae593661e8dc402394e84d567ca2044a51572b
    -Author: Lasse Collin 
    -Date:   2010-10-02 11:38:20 +0300
    -
    -    liblzma: Small fixes to comments in the API headers.
    -
    - src/liblzma/api/lzma/lzma.h | 10 +++++++---
    - 1 file changed, 7 insertions(+), 3 deletions(-)
    -
    -commit 9166682dc601fd42c1b9510572e3f917d18de504
    -Author: Lasse Collin 
    -Date:   2010-09-28 11:40:12 +0300
    -
    -    Create the PDF versions of the man pages better.
    -
    - Makefile.am          | 14 +++++++------
    - build-aux/manconv.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 66 insertions(+), 6 deletions(-)
    -
    -commit 17d3c61edd35de8fa884944fc70d1db86daa5dd8
    -Author: Lasse Collin 
    -Date:   2010-09-28 10:59:53 +0300
    -
    -    Move version.sh to build-aux.
    -
    - Makefile.am          |  4 ++--
    - build-aux/version.sh | 24 ++++++++++++++++++++++++
    - configure.ac         |  2 +-
    - version.sh           | 24 ------------------------
    - windows/build.bash   |  2 +-
    - 5 files changed, 28 insertions(+), 28 deletions(-)
    -
    -commit 84af9d8770451339a692e9b70f96cf56156a6069
    -Author: Lasse Collin 
    -Date:   2010-09-28 10:53:02 +0300
    -
    -    Update .gitignore.
    -
    - .gitignore | 10 +++++++++-
    - 1 file changed, 9 insertions(+), 1 deletion(-)
    -
    -commit 31575a449ac64c523da3bab8d0c0b522cdc7c780
    -Author: Lasse Collin 
    -Date:   2010-09-28 01:17:14 +0300
    -
    -    Fix accomodate -> accommodate on the xz man page.
    -
    - src/xz/xz.1 | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit cec0ddc8ec4ce81685a51998b978e22167e461f9
    -Author: Lasse Collin 
    -Date:   2010-09-27 23:29:34 +0300
    -
    -    Major man page updates.
    -    
    -    Lots of content was updated on the xz man page.
    -    
    -    Technical improvements:
    -      - Start a new sentence on a new line.
    -      - Use fairly short lines.
    -      - Use constant-width font for examples (where supported).
    -      - Some minor cleanups.
    -    
    -    Thanks to Jonathan Nieder for some language fixes.
    -
    - src/lzmainfo/lzmainfo.1 |   25 +-
    - src/scripts/xzdiff.1    |   15 +-
    - src/scripts/xzgrep.1    |   11 +-
    - src/scripts/xzless.1    |   13 +-
    - src/scripts/xzmore.1    |    9 +-
    - src/xz/xz.1             | 1964 ++++++++++++++++++++++++++++++++---------------
    - src/xzdec/xzdec.1       |   39 +-
    - 7 files changed, 1435 insertions(+), 641 deletions(-)
    -
    -commit 075257ab0416a0603be930082e31a5703e4ba345
    -Author: Lasse Collin 
    -Date:   2010-09-26 18:10:31 +0300
    -
    -    Fix the preset -3e.
    -    
    -    depth=0 was missing.
    -
    - src/liblzma/lzma/lzma_encoder_presets.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 2577da9ebdba13fbe99ae5ee8bde35f7ed60f6d1
    -Author: Lasse Collin 
    -Date:   2010-09-23 14:03:10 +0300
    -
    -    Add translations.bash and translation notes to README.
    -    
    -    translations.bash prints some messages from xz, which
    -    hopefully makes it a bit easier to test translations.
    -
    - README                 |  96 +++++++++++++++++++++++++++++++++++++++++++++--
    - debug/translation.bash | 100 +++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 192 insertions(+), 4 deletions(-)
    -
    -commit a3c5997c57e5b1a20aae6d1071b584b4f17d0b23
    -Author: Lasse Collin 
    -Date:   2010-09-17 22:14:30 +0300
    -
    -    xz: Update the Czech translation.
    -    
    -    Thanks to Marek Černocký.
    -
    - po/cs.po | 202 +++++++++++++++++++++++++++++++++++++++++----------------------
    - 1 file changed, 131 insertions(+), 71 deletions(-)
    -
    -commit a1766af582dc23fddd9da1eeb4b9d61e3eb4c2e6
    -Author: Lasse Collin 
    -Date:   2010-09-16 23:40:41 +0300
    -
    -    xz: Add Italian translation.
    -    
    -    Thanks to Milo Casagrande and Lorenzo De Liso.
    -
    - THANKS     |   2 +
    - po/LINGUAS |   1 +
    - po/it.po   | 902 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 905 insertions(+)
    -
    -commit 21088018554e2b0e02914205377ceb6e34a090bd
    -Author: Lasse Collin 
    -Date:   2010-09-15 00:34:13 +0300
    -
    -    xz: Edit a translators comment.
    -
    - src/xz/list.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit be16e28ece1b492b8f93382b7fa1cc4da23c6ff6
    -Author: Lasse Collin 
    -Date:   2010-09-14 22:47:14 +0300
    -
    -    xz: Add German translation.
    -    
    -    Thanks to Andre Noll.
    -
    - THANKS     |   1 +
    - po/LINGUAS |   1 +
    - po/de.po   | 903 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 905 insertions(+)
    -
    -commit e23ea74f3240e6b69683f9e69d1716e0f9e9092b
    -Author: Lasse Collin 
    -Date:   2010-09-10 14:30:25 +0300
    -
    -    Updated README.
    -
    - README | 2 --
    - 1 file changed, 2 deletions(-)
    -
    -commit 8dad2fd69336985adb9f774fa96dc9c0efcb5a71
    -Author: Lasse Collin 
    -Date:   2010-09-10 14:30:07 +0300
    -
    -    Updated INSTALL.
    -
    - INSTALL | 7 ++++---
    - 1 file changed, 4 insertions(+), 3 deletions(-)
    -
    -commit 0b5f07fe3728c27cce416ddc40f7e4803ae96ac2
    -Author: Lasse Collin 
    -Date:   2010-09-10 14:26:20 +0300
    -
    -    Updated the git repository address in ChangeLog.
    -
    - ChangeLog | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit a8760203f93a69bc39fd14520a6e9e7b7d70be06
    -Author: Lasse Collin 
    -Date:   2010-09-10 14:09:33 +0300
    -
    -    xz: Add a comment to translators about "literal context bits".
    -
    - src/xz/message.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit bb0b1004f83cdc4d309e1471c2ecaf9f95ce60c5
    -Author: Lasse Collin 
    -Date:   2010-09-10 10:30:33 +0300
    -
    -    xz: Multiple fixes.
    -    
    -    The code assumed that printing numbers with thousand separators
    -    and decimal points would always produce only US-ASCII characters.
    -    This was used for buffer sizes (with snprintf(), no overflows)
    -    and aligning columns of the progress indicator and --list. That
    -    assumption was wrong (e.g. LC_ALL=fi_FI.UTF-8 with glibc), so
    -    multibyte character support was added in this commit. The old
    -    way is used if the operating system doesn't have enough multibyte
    -    support (e.g. lacks wcwidth()).
    -    
    -    The sizes of buffers were increased to accomodate multibyte
    -    characters. I don't know how big they should be exactly, but
    -    they aren't used for anything critical, so it's not too bad.
    -    If they still aren't big enough, I hopefully get a bug report.
    -    snprintf() takes care of avoiding buffer overflows.
    -    
    -    Some static buffers were replaced with buffers allocated on
    -    stack. double_to_str() was removed. uint64_to_str() and
    -    uint64_to_nicestr() now share the static buffer and test
    -    for thousand separator support.
    -    
    -    Integrity check names "None" and "Unknown-N" (2 <= N <= 15)
    -    were marked to be translated. I had forgot these, plus they
    -    wouldn't have worked correctly anyway before this commit,
    -    because printing tables with multibyte strings didn't work.
    -    
    -    Thanks to Marek Černocký for reporting the bug about
    -    misaligned table columns in --list output.
    -
    - configure.ac                    |   1 +
    - m4/tuklib_mbstr.m4              |  30 ++++++
    - src/common/tuklib_mbstr.h       |  66 +++++++++++++
    - src/common/tuklib_mbstr_fw.c    |  31 ++++++
    - src/common/tuklib_mbstr_width.c |  64 +++++++++++++
    - src/xz/Makefile.am              |   4 +-
    - src/xz/list.c                   | 205 +++++++++++++++++++++++++++-------------
    - src/xz/message.c                |  56 +++++++----
    - src/xz/message.h                |  10 +-
    - src/xz/private.h                |   1 +
    - src/xz/util.c                   | 136 +++++++++-----------------
    - src/xz/util.h                   |   7 --
    - 12 files changed, 424 insertions(+), 187 deletions(-)
    -
    -commit 639f8e2af33cf8a184d59ba56b6df7c098679d61
    -Author: Lasse Collin 
    -Date:   2010-09-08 08:49:22 +0300
    -
    -    Update the Czech translation.
    -    
    -    Thanks to Marek Černocký.
    -
    - po/cs.po | 655 +++++++++++++++++++++++++++++++++++++++++++--------------------
    - 1 file changed, 454 insertions(+), 201 deletions(-)
    -
    -commit 41bc9956ebfd7c86777d33676acf34c45e7ca7c7
    -Author: Lasse Collin 
    -Date:   2010-09-07 12:31:40 +0300
    -
    -    xz: Add a note to translators.
    -
    - src/xz/hardware.c | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 77a7746616e555fc08028e883a56d06bf0088b81
    -Author: Lasse Collin 
    -Date:   2010-09-07 10:42:13 +0300
    -
    -    Fix use of N_() and ngettext().
    -    
    -    I had somehow thought that N_() is usually used
    -    as shorthand for ngettext().
    -    
    -    This also fixes a missing \n from a call to ngettext().
    -
    - src/common/tuklib_gettext.h | 4 ++--
    - src/xz/list.c               | 4 ++--
    - 2 files changed, 4 insertions(+), 4 deletions(-)
    -
    -commit e6ad39335842343e622ab51207d1d3cb9caad801
    -Author: Lasse Collin 
    -Date:   2010-09-06 19:43:12 +0300
    -
    -    Add missing files to POTFILES.in.
    -
    - po/POTFILES.in | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 58f55131820d2e08a1a6beb9ec0ee2378044eb30
    -Author: Lasse Collin 
    -Date:   2010-09-06 10:16:24 +0300
    -
    -    xz: Improve a comment.
    -
    - src/xz/file_io.c | 7 ++++---
    - 1 file changed, 4 insertions(+), 3 deletions(-)
    -
    -commit bcb1b898341f7073f51660d7052d7ed6c5461a66
    -Author: Lasse Collin 
    -Date:   2010-09-05 21:34:29 +0300
    -
    -    xz: Update the comment about NetBSD in file_io.c.
    -    
    -    Thanks to Joerg Sonnenberger.
    -
    - src/xz/file_io.c | 8 ++++----
    - 1 file changed, 4 insertions(+), 4 deletions(-)
    -
    -commit da014d55972f5addbf6b4360d3d8ed2ef4282170
    -Author: Lasse Collin 
    -Date:   2010-09-05 21:11:33 +0300
    -
    -    xz: Use an array instead of pointer for stdin_filename.
    -    
    -    Thanks Joerg Sonnenberger.
    -
    - src/xz/args.c | 2 +-
    - src/xz/args.h | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 8c7d3d1a0781c296c6b6e2465becaffd2132f7ee
    -Author: Lasse Collin 
    -Date:   2010-09-05 12:16:17 +0300
    -
    -    xz: Hopefully ease translating the messages in list.c.
    -
    - src/xz/list.c | 33 +++++++++++++++++++++++----------
    - 1 file changed, 23 insertions(+), 10 deletions(-)
    -
    -commit ef840950ad99cf2955c754875af0e01acf125079
    -Author: Lasse Collin 
    -Date:   2010-09-04 23:14:44 +0300
    -
    -    xz: Fix grammar.
    -
    - src/xz/options.c | 3 +--
    - 1 file changed, 1 insertion(+), 2 deletions(-)
    -
    -commit c46afd6edc04ea140db6c59e8486f5707c810c13
    -Author: Lasse Collin 
    -Date:   2010-09-04 23:12:20 +0300
    -
    -    xz: Use lzma_lzma_preset() to initialize the options structure.
    -
    - src/xz/options.c | 14 ++------------
    - 1 file changed, 2 insertions(+), 12 deletions(-)
    -
    -commit 8fd3ac046d0b1416a2094fecc456d9e0f4d5d065
    -Author: Lasse Collin 
    -Date:   2010-09-04 22:16:28 +0300
    -
    -    Don't set lc=4 with --extreme.
    -    
    -    This should reduce the cases where --extreme makes
    -    compression worse. On the other hand, some other
    -    files may now benefit slightly less from --extreme.
    -
    - src/liblzma/lzma/lzma_encoder_presets.c | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit 474bac0c33e94aeaca8ada17ab19972b1424bc2b
    -Author: Lasse Collin 
    -Date:   2010-09-04 22:10:32 +0300
    -
    -    xz: Minor improvements to --help and --long-help.
    -
    - src/xz/message.c | 24 ++++++++++++------------
    - 1 file changed, 12 insertions(+), 12 deletions(-)
    -
    -commit 373ee26f955617295c5c537b04a153a1969140d2
    -Author: Jonathan Nieder 
    -Date:   2010-09-03 16:49:15 -0500
    -
    -    Adjust memory limits in test_compress.sh
    -    
    -    Testing compression at level -4 now requires 48 MiB of free store at
    -    compression time and 5 MiB at decompression time.
    -    
    -    Signed-off-by: Jonathan Nieder 
    -
    - tests/test_compress.sh | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 2fce9312f36727ea82f3430cc5d3a7d243c5f087
    -Author: Lasse Collin 
    -Date:   2010-09-03 15:54:40 +0300
    -
    -    xz: Make -vv show also decompressor memory usage.
    -
    - src/xz/coder.c | 7 +++++++
    - 1 file changed, 7 insertions(+)
    -
    -commit b4b1cbcb53624ab832f8b3189c74450dc7ea29b6
    -Author: Lasse Collin 
    -Date:   2010-09-03 15:13:12 +0300
    -
    -    Tweak the compression presets -0 .. -5.
    -    
    -    "Extreme" mode might need some further tweaking still.
    -    Docs were not updated yet.
    -
    - src/liblzma/lzma/lzma_encoder_presets.c | 29 +++++++++++++++++++----------
    - 1 file changed, 19 insertions(+), 10 deletions(-)
    -
    -commit 77fe5954cd3d10fb1837372684cbc133b56b6a87
    -Author: Lasse Collin 
    -Date:   2010-09-03 12:28:41 +0300
    -
    -    liblzma: Adjust default depth calculation for HC3 and HC4.
    -    
    -    It was 8 + nice_len / 4, now it is 4 + nice_len / 4.
    -    This allows faster settings at lower nice_len values,
    -    even though it seems that I won't use automatic depth
    -    calcuation with HC3 and HC4 in the presets.
    -
    - src/liblzma/lz/lz_encoder.c | 7 ++++---
    - 1 file changed, 4 insertions(+), 3 deletions(-)
    -
    -commit fce69059cf901ce8075a78c7607d591f144a3b5a
    -Author: Lasse Collin 
    -Date:   2010-09-03 11:11:25 +0300
    -
    -    xz: Make --help two lines shorter.
    -    
    -    At least for now, the --help option doesn't list any
    -    options that take arguments, so "Mandatory arguments to..."
    -    can be omitted.
    -
    - src/xz/message.c | 7 +++++--
    - 1 file changed, 5 insertions(+), 2 deletions(-)
    -
    -commit a848e47ced6e5e2a564b5c454b2f5a19c2f40298
    -Author: Lasse Collin 
    -Date:   2010-09-02 19:22:35 +0300
    -
    -    xz: Make setting a preset override a custom filter chain.
    -    
    -    This is more logical behavior than ignoring preset level
    -    options once a custom filter chain has been specified.
    -
    - src/xz/coder.c | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit b3ff7ba044eaeab3e424d7b51fe914daf681b1a3
    -Author: Lasse Collin 
    -Date:   2010-09-02 19:09:57 +0300
    -
    -    xz: Always warn if adjusting dictionary size due to memlimit.
    -
    - src/xz/coder.c | 28 +++++++++-------------------
    - 1 file changed, 9 insertions(+), 19 deletions(-)
    -
    -commit d5653ba8a1ea9c00de4fddc617aba3c51e18139d
    -Author: Lasse Collin 
    -Date:   2010-08-10 11:04:30 +0300
    -
    -    Fix test_compress.sh.
    -    
    -    It broke when --memory option was removed from xzdec.
    -    
    -    Thanks to Jonathan Nieder.
    -
    - tests/test_compress.sh | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 792331bdee706aa852a78b171040ebf814c6f3ae
    -Author: Lasse Collin 
    -Date:   2010-08-07 20:45:18 +0300
    -
    -    Disable the memory usage limiter by default.
    -    
    -    For several people, the limiter causes bigger problems that
    -    it solves, so it is better to have it disabled by default.
    -    Those who want to have a limiter by default need to enable
    -    it via the environment variable XZ_DEFAULTS.
    -    
    -    Support for environment variable XZ_DEFAULTS was added. It is
    -    parsed before XZ_OPT and technically identical with it. The
    -    intended uses differ quite a bit though; see the man page.
    -    
    -    The memory usage limit can now be set separately for
    -    compression and decompression using --memlimit-compress and
    -    --memlimit-decompress. To set both at once, -M or --memlimit
    -    can be used. --memory was retained as a legacy alias for
    -    --memlimit for backwards compatibility.
    -    
    -    The semantics of --info-memory were changed in backwards
    -    incompatible way. Compatibility wasn't meaningful due to
    -    changes in the memory usage limiter functionality.
    -    
    -    The memory usage limiter info is no longer shown at the
    -    bottom of xz --long -help.
    -    
    -    The memory usage limiter support for removed completely from xzdec.
    -    
    -    xz's man page was updated to match the above changes. Various
    -    unrelated fixes were also made to the man page.
    -
    - src/xz/args.c     |  87 +++++++++-----
    - src/xz/coder.c    |   8 +-
    - src/xz/hardware.c |  96 +++++++++------
    - src/xz/hardware.h |  23 ++--
    - src/xz/list.c     |   2 +-
    - src/xz/message.c  |  39 ++-----
    - src/xz/message.h  |   4 -
    - src/xz/xz.1       | 341 ++++++++++++++++++++++++++++++++++--------------------
    - src/xzdec/xzdec.1 |  45 +------
    - src/xzdec/xzdec.c | 176 +---------------------------
    - 10 files changed, 373 insertions(+), 448 deletions(-)
    -
    -commit 4a45dd4c39f75d25c7a37b6400cb24d4010ca801
    -Author: Lasse Collin 
    -Date:   2010-08-06 20:22:16 +0300
    -
    -    Add missing const to a global constant in xz.
    -
    - src/xz/args.c | 2 +-
    - src/xz/args.h | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 01aa4869cb220b7fdad6d1acbabb2233045daa8f
    -Author: Lasse Collin 
    -Date:   2010-07-28 11:44:55 +0300
    -
    -    Language fixes for man pages.
    -    
    -    Thanks to A. Costa and Jonathan Nieder.
    -
    - src/lzmainfo/lzmainfo.1 | 4 ++--
    - src/xz/xz.1             | 6 +++---
    - 2 files changed, 5 insertions(+), 5 deletions(-)
    -
    -commit ce1f0deafe8504e1492bf1b1efb3e3ec950b1a2b
    -Author: Lasse Collin 
    -Date:   2010-07-27 20:47:12 +0300
    -
    -    Windows: Add a note about building a Git repository snapshot
    -
    - windows/INSTALL-Windows.txt | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit 507a4a4dea1e5462f12f7ed4b076c34e02054a38
    -Author: Lasse Collin 
    -Date:   2010-07-27 20:45:03 +0300
    -
    -    Windows: build.sh is a bash script so name it correctly.
    -
    - INSTALL                     |   2 +-
    - windows/INSTALL-Windows.txt |   6 +-
    - windows/build.bash          | 189 ++++++++++++++++++++++++++++++++++++++++++++
    - windows/build.sh            | 189 --------------------------------------------
    - 4 files changed, 193 insertions(+), 193 deletions(-)
    -
    -commit b1cbfd40f049a646a639eb78a3e41e9e3ef73339
    -Author: Lasse Collin 
    -Date:   2010-07-27 20:27:32 +0300
    -
    -    Windows: Don't strip liblzma.a too much.
    -
    - windows/build.sh | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit a540198ffb25fad36380c5e92ac20c2d28eec46a
    -Author: Lasse Collin 
    -Date:   2010-07-13 20:07:26 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit bab0f01ed931f606b4675aa9f9331a17cec09bad
    -Author: Lasse Collin 
    -Date:   2010-07-13 19:55:50 +0300
    -
    -    Add two simple example programs.
    -    
    -    Hopefully these help a bit when learning the basics
    -    of liblzma API. I plan to write detailed examples about
    -    both basic and advanced features with lots of comments,
    -    but these two examples are good have right now.
    -    
    -    The examples were written by Daniel Mealha Cabrita. Thanks.
    -
    - doc/examples/xz_pipe_comp.c   | 127 ++++++++++++++++++++++++++++++++++++++++++
    - doc/examples/xz_pipe_decomp.c | 115 ++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 242 insertions(+)
    -
    -commit c15c42abb3c8c6e77c778ef06c97a4a10b8b5d00
    -Author: Lasse Collin 
    -Date:   2010-06-15 14:06:29 +0300
    -
    -    Add --no-adjust.
    -
    - src/xz/args.c    |  6 ++++++
    - src/xz/coder.c   |  8 ++------
    - src/xz/coder.h   |  4 ++++
    - src/xz/message.c |  6 +++++-
    - src/xz/xz.1      | 13 +++++++++++--
    - 5 files changed, 28 insertions(+), 9 deletions(-)
    -
    -commit 2130926dd1c839280358172dfadd8d3054bde2b4
    -Author: Lasse Collin 
    -Date:   2010-06-11 21:51:32 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit bc612d0e0c9e4504c59d49168e87a7ae3e458443
    -Author: Lasse Collin 
    -Date:   2010-06-11 21:48:32 +0300
    -
    -    Clarify the description of the default memlimit in the man page.
    -    
    -    Thanks to Denis Excoffier.
    -
    - src/xz/xz.1 | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit e1b6935d60a00405e6b5b455a3426d2248cc926c
    -Author: Lasse Collin 
    -Date:   2010-06-11 21:43:28 +0300
    -
    -    Fix string to uint64_t conversion.
    -    
    -    Thanks to Denis Excoffier for the bug report.
    -
    - src/xz/util.c     | 10 ++++++++--
    - src/xzdec/xzdec.c | 13 +++++++++++--
    - 2 files changed, 19 insertions(+), 4 deletions(-)
    -
    -commit 3e49c8acb0f5312948eddb2342dbb5802d4571d0
    -Author: Lasse Collin 
    -Date:   2010-06-11 10:40:28 +0300
    -
    -    Put the git commit to the filename in mydist rule.
    -
    - Makefile.am | 6 +++++-
    - 1 file changed, 5 insertions(+), 1 deletion(-)
    -
    -commit d8b41eedce486d400f701b757b7b5e4e32276618
    -Author: Lasse Collin 
    -Date:   2010-06-02 23:13:55 +0300
    -
    -    Fix compiling with -Werror.
    -
    - src/xz/message.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit b5fbab6123a39c9a55cd5d7af410e9aae067d5f8
    -Author: Lasse Collin 
    -Date:   2010-06-02 23:09:22 +0300
    -
    -    Silence a bogus Valgrind warning.
    -    
    -    When using -O2 with GCC, it liked to swap two comparisons
    -    in one "if" statement. It's otherwise fine except that
    -    the latter part, which is seemingly never executed, got
    -    executed (nothing wrong with that) and then triggered
    -    warning in Valgrind about conditional jump depending on
    -    uninitialized variable. A few people find this annoying
    -    so do things a bit differently to avoid the warning.
    -
    - src/liblzma/lz/lz_encoder.c | 6 +++++-
    - 1 file changed, 5 insertions(+), 1 deletion(-)
    -
    -commit 29a7b250e685852f2f97615493ec49acaf528623
    -Author: Lasse Collin 
    -Date:   2010-06-02 21:32:12 +0300
    -
    -    Fix a Windows-specific FIXME in signal handling code.
    -
    - src/xz/main.c    | 40 +++++++++++++++++++++++++++++++++++-----
    - src/xz/private.h |  5 +++++
    - src/xz/signals.c | 16 ++++++++--------
    - 3 files changed, 48 insertions(+), 13 deletions(-)
    -
    -commit e89d987056cee7d4e279be3ef3a6cc690bfc0e6d
    -Author: Lasse Collin 
    -Date:   2010-06-02 17:46:58 +0300
    -
    -    Adjust SA_RESTART workaround.
    -    
    -    I want to get a bug report if something else than
    -    DJGPP lacks SA_RESTART.
    -
    - src/xz/message.c | 14 +++++++-------
    - 1 file changed, 7 insertions(+), 7 deletions(-)
    -
    -commit e243145c84ab5c3be8259fd486ead0de5235b3f0
    -Author: Lasse Collin 
    -Date:   2010-06-01 16:02:30 +0300
    -
    -    xz man page updates.
    -    
    -    - Concatenating .xz files and padding
    -    - List mode
    -    - Robot mode
    -    - A few examples (but many more are needed)
    -
    - src/xz/xz.1 | 385 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
    - 1 file changed, 366 insertions(+), 19 deletions(-)
    -
    -commit ce6dc3c0a891f23a862f80ec08d3b6f0beb2a562
    -Author: Lasse Collin 
    -Date:   2010-06-01 15:51:44 +0300
    -
    -    Major update to xz --list.
    -
    - src/xz/list.c | 652 ++++++++++++++++++++++++++++++++++++++++++----------------
    - 1 file changed, 471 insertions(+), 181 deletions(-)
    -
    -commit 905e54804a899e4ad526d38fdba7e803ab9b71bd
    -Author: Lasse Collin 
    -Date:   2010-06-01 14:13:03 +0300
    -
    -    Rename message_filters_get() to message_filters_to_str().
    -
    - src/xz/message.c | 4 ++--
    - src/xz/message.h | 2 +-
    - 2 files changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 4b346ae8af20045027ae5efb068c6d69da3324d2
    -Author: Lasse Collin 
    -Date:   2010-06-01 14:09:12 +0300
    -
    -    Fix a comment.
    -
    - src/liblzma/api/lzma/index.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 07dc34f6da45c9ab757dad7fd5eef522ad27d296
    -Author: Lasse Collin 
    -Date:   2010-05-27 16:17:42 +0300
    -
    -    Fix lzma_block_compressed_size().
    -
    - src/liblzma/common/block_util.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 44d70cb154225e47eebf15a3cfbdf3794cbb4593
    -Author: Lasse Collin 
    -Date:   2010-05-27 14:32:51 +0300
    -
    -    Take Cygwin into account in some #if lines.
    -    
    -    This change is no-op, but good to have just in case
    -    for the future.
    -
    - src/xz/signals.c | 2 +-
    - src/xz/signals.h | 4 ++--
    - 2 files changed, 3 insertions(+), 3 deletions(-)
    -
    -commit a334348dc02803241cf4e0a539eecdc0e7ad2cc7
    -Author: Lasse Collin 
    -Date:   2010-05-27 13:42:44 +0300
    -
    -    Remove references to the Subblock filter in xz and tests.
    -    
    -    Thanks to Jonathan Nieder.
    -
    - src/xz/message.c          |  9 ---------
    - tests/test_filter_flags.c | 23 -----------------------
    - 2 files changed, 32 deletions(-)
    -
    -commit 70e5e2f6a7084e6af909deee88ceac2f6efa7893
    -Author: Lasse Collin 
    -Date:   2010-05-27 13:35:36 +0300
    -
    -    Remove unused chunk_size.c.
    -    
    -    Thanks to Jonathan Nieder for the reminder.
    -
    - src/liblzma/common/chunk_size.c | 67 -----------------------------------------
    - 1 file changed, 67 deletions(-)
    -
    -commit 01a414eaf4be6352c06b48001b041b47e8202faa
    -Author: Jonathan Nieder 
    -Date:   2010-05-27 02:31:33 -0500
    -
    -    Use my_min() instead of MIN() in src/xz/list.c
    -    
    -    This should have been done in
    -    920a69a8d8e4203c5edddd829d932130eac188ea.
    -
    - src/xz/list.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 920a69a8d8e4203c5edddd829d932130eac188ea
    -Author: Lasse Collin 
    -Date:   2010-05-26 10:36:46 +0300
    -
    -    Rename MIN() and MAX() to my_min() and my_max().
    -    
    -    This should avoid some minor portability issues.
    -
    - debug/full_flush.c                             |  2 +-
    - debug/sync_flush.c                             |  2 +-
    - src/common/sysdefs.h                           | 12 +++++-------
    - src/liblzma/common/block_buffer_encoder.c      |  2 +-
    - src/liblzma/common/common.c                    |  2 +-
    - src/liblzma/common/stream_buffer_encoder.c     |  2 +-
    - src/liblzma/delta/delta_encoder.c              |  2 +-
    - src/liblzma/lz/lz_decoder.c                    |  7 ++++---
    - src/liblzma/lz/lz_decoder.h                    |  2 +-
    - src/liblzma/lz/lz_encoder.c                    |  2 +-
    - src/liblzma/lz/lz_encoder.h                    |  2 +-
    - src/liblzma/lz/lz_encoder_mf.c                 |  4 ++--
    - src/liblzma/lzma/lzma2_encoder.c               |  2 +-
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c   |  2 +-
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c | 14 +++++++-------
    - src/xz/args.c                                  |  3 ++-
    - 16 files changed, 31 insertions(+), 31 deletions(-)
    -
    -commit 019ae27c24d0c694545a6a46f8b9fb552198b015
    -Author: Lasse Collin 
    -Date:   2010-05-26 10:30:20 +0300
    -
    -    Fix compilation of debug/known_sizes.c.
    -
    - debug/known_sizes.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 98a4856a6ea84f79c790057a6eb89a25bc45b074
    -Author: Lasse Collin 
    -Date:   2010-05-26 10:28:54 +0300
    -
    -    Remove references to Subblock filter in debug/sync_flush.c.
    -
    - debug/sync_flush.c | 13 -------------
    - 1 file changed, 13 deletions(-)
    -
    -commit 703d2c33c095c41ae0693ee8c27c45e3847e4535
    -Author: Lasse Collin 
    -Date:   2010-05-26 10:16:57 +0300
    -
    -    Better #error message.
    -
    - src/common/sysdefs.h | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit d8a55c48b39703dd83f11089ad01e1ff2ac102e0
    -Author: Lasse Collin 
    -Date:   2010-05-26 09:55:47 +0300
    -
    -    Remove the Subblock filter code for now.
    -    
    -    The spec isn't finished and the code didn't compile anymore.
    -    It won't be included in XZ Utils 5.0.0. It's easy to get it
    -    back once the spec is done.
    -
    - configure.ac                                   |   6 +-
    - src/liblzma/Makefile.am                        |   5 -
    - src/liblzma/api/Makefile.am                    |   1 -
    - src/liblzma/api/lzma.h                         |   1 -
    - src/liblzma/api/lzma/subblock.h                | 200 -----
    - src/liblzma/common/common.h                    |   6 -
    - src/liblzma/common/filter_common.c             |   9 -
    - src/liblzma/common/filter_decoder.c            |  16 -
    - src/liblzma/common/filter_encoder.c            |  12 -
    - src/liblzma/subblock/Makefile.inc              |  20 -
    - src/liblzma/subblock/subblock_decoder.c        | 630 ----------------
    - src/liblzma/subblock/subblock_decoder.h        |  22 -
    - src/liblzma/subblock/subblock_decoder_helper.c |  70 --
    - src/liblzma/subblock/subblock_decoder_helper.h |  29 -
    - src/liblzma/subblock/subblock_encoder.c        | 984 -------------------------
    - src/liblzma/subblock/subblock_encoder.h        |  21 -
    - src/xz/args.c                                  |   9 +-
    - src/xz/options.c                               |  61 --
    - src/xz/options.h                               |   7 -
    - 19 files changed, 4 insertions(+), 2105 deletions(-)
    -
    -commit b6377fc990f9b8651149cae0fecb8b9c5904e26d
    -Author: Lasse Collin 
    -Date:   2010-05-16 18:42:22 +0300
    -
    -    Split message_filters().
    -    
    -    message_filters_to_str() converts the filter chain to
    -    a string. message_filters_show() replaces the original
    -    message_filters().
    -    
    -    uint32_to_optstr() was also added to show the dictionary
    -    size in nicer format when possible.
    -
    - src/xz/coder.c   |   2 +-
    - src/xz/message.c | 187 +++++++++++++++++++++++++++++++++++--------------------
    - src/xz/message.h |  14 ++++-
    - 3 files changed, 134 insertions(+), 69 deletions(-)
    -
    -commit d9986db782d6cf0f314342127280519339378fa0
    -Author: Lasse Collin 
    -Date:   2010-05-14 23:17:20 +0300
    -
    -    Omit lzma_restrict from the API headers.
    -    
    -    It isn't really useful so omitting it makes things
    -    shorter and slightly more readable.
    -
    - src/liblzma/api/lzma.h       | 12 ------------
    - src/liblzma/api/lzma/index.h |  5 ++---
    - src/liblzma/api/lzma/vli.h   | 11 +++++------
    - 3 files changed, 7 insertions(+), 21 deletions(-)
    -
    -commit 0d3489efca0a723dca0394809fa3e6170843af4b
    -Author: Lasse Collin 
    -Date:   2010-05-10 19:57:24 +0300
    -
    -    Updated INSTALL.
    -
    - INSTALL | 5 -----
    - 1 file changed, 5 deletions(-)
    -
    -commit 3fb3d594a2b53886adee161b6261e92277f05f7c
    -Author: Lasse Collin 
    -Date:   2010-05-10 19:54:52 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 6548e304657e77d3a972053db3c41c5daf591113
    -Author: Lasse Collin 
    -Date:   2010-05-10 19:54:15 +0300
    -
    -    Updates to tuklib_physmem and tuklib_cpucores.
    -    
    -    Don't use #error to generate compile error, because some
    -    compilers actually don't take it as an error. This fixes
    -    tuklib_physmem on IRIX.
    -    
    -    Fix incorrect error check for sysconf() return values.
    -    
    -    Add AIX, HP-UX, and Tru64 specific code to detect the
    -    amount RAM.
    -    
    -    Add HP-UX specific code to detect the number of CPU cores.
    -    
    -    Thanks a lot to Peter O'Gorman for initial patches,
    -    testing, and debugging these fixes.
    -
    - m4/tuklib_cpucores.m4        | 33 ++++++++++++++++----
    - m4/tuklib_physmem.m4         | 72 ++++++++++++++++++++++++++++++++++++++++++--
    - src/common/tuklib_cpucores.c | 14 +++++++--
    - src/common/tuklib_physmem.c  | 33 +++++++++++++++++++-
    - 4 files changed, 141 insertions(+), 11 deletions(-)
    -
    -commit a290cfee3e23f046889c022aa96b4eca2016fdda
    -Author: Lasse Collin 
    -Date:   2010-04-12 21:55:56 +0300
    -
    -    Show both elapsed time and estimated remaining time in xz -v.
    -    
    -    The extra space for showing both has been taken from the
    -    sizes field. If the sizes grow big, bigger units than MiB
    -    will be used. It makes it slightly difficult to see that
    -    progress is still happening with huge files, but it should
    -    be OK in practice.
    -    
    -    Thanks to Trent W. Buck for 
    -    and Jonathan Nieder for suggestions how to fix it.
    -
    - THANKS           |  1 +
    - src/xz/message.c | 86 +++++++++++++++++++++++++-------------------------------
    - 2 files changed, 39 insertions(+), 48 deletions(-)
    -
    -commit a1f7a986b8d708f9290da9799ca1b8d7082fad3e
    -Author: Lasse Collin 
    -Date:   2010-03-31 16:47:25 +0300
    -
    -    Add a simple tip to faq.txt about tar and xz.
    -    
    -    Thanks to Gilles Espinasse.
    -
    - THANKS      | 1 +
    - doc/faq.txt | 6 ++++++
    - 2 files changed, 7 insertions(+)
    -
    -commit c737eec91d200d730aa82662affd6b06ebb0bff0
    -Author: Lasse Collin 
    -Date:   2010-03-22 21:03:03 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit f4b2b52624b802c786e4e2a8eb6895794dd93b24
    -Author: Lasse Collin 
    -Date:   2010-03-07 19:52:25 +0200
    -
    -    Fix xzgrep to not break if filenames have spaces or quotes.
    -    
    -    Thanks to someone who reported the bug on IRC.
    -
    - src/scripts/xzgrep.in | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit cf38da00a140bd3bd65b192390ae5553380fd774
    -Author: Lasse Collin 
    -Date:   2010-03-07 13:59:32 +0200
    -
    -    Treat all integer multiplier suffixes as base-2.
    -    
    -    Originally both base-2 and base-10 were supported, but since
    -    there seems to be little need for base-10 in XZ Utils, treat
    -    everything as base-2 and also be more relaxed about the case
    -    of the first letter of the suffix. Now xz will accept e.g.
    -    KiB, Ki, k, K, kB, and KB, and interpret them all as 1024. The
    -    recommended spelling of the suffixes are still KiB, MiB, and GiB.
    -
    - src/xz/util.c     | 53 +++++++++++++++++++++++------------------------------
    - src/xz/xz.1       | 48 ++++++++++++++++++++++++++++--------------------
    - src/xzdec/xzdec.c | 42 ++++++++++++++++--------------------------
    - 3 files changed, 67 insertions(+), 76 deletions(-)
    -
    -commit 00fc1211ae7b687ac912098f4479112059deccbd
    -Author: Lasse Collin 
    -Date:   2010-03-07 13:50:23 +0200
    -
    -    Consistently round up the memory usage limit in messages.
    -    
    -    It still feels a bit wrong to round 1 byte to 1 MiB but
    -    at least it is now done consistently so that the same
    -    byte value is always rounded the same way to MiB.
    -
    - src/xz/message.c  | 5 +++--
    - src/xzdec/xzdec.c | 7 +++++--
    - 2 files changed, 8 insertions(+), 4 deletions(-)
    -
    -commit 9886d436ff5615fc70eef32ff757b1e934069621
    -Author: Lasse Collin 
    -Date:   2010-03-07 13:34:34 +0200
    -
    -    Change the default of --enable-assume-ram from 32 to 128 MiB.
    -    
    -    This is to allow files created with "xz -9" to be decompressed
    -    if the amount of RAM cannot be determined.
    -
    - INSTALL      |  5 ++---
    - configure.ac | 11 ++++++-----
    - 2 files changed, 8 insertions(+), 8 deletions(-)
    -
    -commit 2672bcc9f85ba28ff648e092e9eb4cd9e69ce418
    -Author: Lasse Collin 
    -Date:   2010-03-07 13:29:28 +0200
    -
    -    Increase the default memory usage limit on "low-memory" systems.
    -    
    -    Previously the default limit was always 40 % of RAM. The
    -    new limit is a little bit more complex:
    -    
    -      - If 40 % of RAM is at least 80 MiB, 40 % of RAM is used
    -        as the limit.
    -    
    -      - If 80 % of RAM is over 80 MiB, 80 MiB is used as the limit.
    -    
    -      - Otherwise 80 % of RAM is used as the limit.
    -    
    -    This should make it possible to decompress files created with
    -    "xz -9" on more systems. Swapping is generally more expected
    -    on systems with less RAM, so higher default limit on them
    -    shouldn't cause too bad surprises in terms of heavy swapping.
    -    Instead, the higher default limit should reduce the number of
    -    bad surprises when it used to prevent decompression of files
    -    created with "xz -9". The DoS prevention system shouldn't be
    -    a DoS itself.
    -    
    -    Note that even with the new default limit, a system with 64 MiB
    -    RAM cannot decompress files created with "xz -9" without user
    -    overriding the limit. This should be OK, because if xz is going
    -    to need more memory than the system has RAM, it will run very
    -    very slowly and thus it's good that user has to override the limit
    -    in that case.
    -
    - src/xz/hardware.c | 43 +++++++++++++++++++++++++++++++------------
    - src/xz/xz.1       | 21 +++++++++++++++------
    - src/xzdec/xzdec.1 |  8 ++++----
    - src/xzdec/xzdec.c | 42 ++++++++++++++++++++++++++++++------------
    - 4 files changed, 80 insertions(+), 34 deletions(-)
    -
    -commit 5527b7269a997e7f335d60f237a64bbf225d9dc7
    -Author: Lasse Collin 
    -Date:   2010-03-06 21:36:19 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit d0d1c51aea4351288a7e533cce28cb7f852f6b05
    -Author: Lasse Collin 
    -Date:   2010-03-06 21:17:20 +0200
    -
    -    Fix missing initialization in lzma_strm_init().
    -    
    -    With bad luck, lzma_code() could return LZMA_BUF_ERROR
    -    when it shouldn't.
    -    
    -    This has been here since the early days of liblzma.
    -    It got triggered by the modifications made to the xz
    -    tool in commit 18c10c30d2833f394cd7bce0e6a821044b15832f
    -    but only when decompressing .lzma files. Somehow I managed
    -    to miss testing that with Valgrind earlier.
    -    
    -    This fixes .
    -    Thanks to Rafał Mużyło for helping to debug it on IRC.
    -
    - src/liblzma/common/common.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit eb7d51a3faf9298c0c7aa9aaeae1023dcf9e37ea
    -Author: Lasse Collin 
    -Date:   2010-02-12 13:16:15 +0200
    -
    -    Collection of language fixes to comments and docs.
    -    
    -    Thanks to Jonathan Nieder.
    -
    - README                                         |  2 +-
    - configure.ac                                   |  2 +-
    - doc/faq.txt                                    |  2 +-
    - extra/7z2lzma/7z2lzma.bash                     |  2 +-
    - src/common/tuklib_progname.c                   |  2 +-
    - src/common/tuklib_progname.h                   |  2 +-
    - src/liblzma/api/lzma/base.h                    |  8 ++++----
    - src/liblzma/api/lzma/bcj.h                     |  2 +-
    - src/liblzma/api/lzma/block.h                   |  2 +-
    - src/liblzma/api/lzma/check.h                   |  2 +-
    - src/liblzma/api/lzma/filter.h                  |  4 ++--
    - src/liblzma/api/lzma/index.h                   |  6 +++---
    - src/liblzma/api/lzma/lzma.h                    |  2 +-
    - src/liblzma/api/lzma/version.h                 |  2 +-
    - src/liblzma/api/lzma/vli.h                     |  2 +-
    - src/liblzma/common/block_header_encoder.c      |  2 +-
    - src/liblzma/common/chunk_size.c                |  4 ++--
    - src/liblzma/common/common.h                    |  4 ++--
    - src/liblzma/common/filter_buffer_decoder.c     |  2 +-
    - src/liblzma/common/filter_encoder.c            |  4 ++--
    - src/liblzma/common/index.c                     |  6 +++---
    - src/liblzma/common/index_encoder.c             |  2 +-
    - src/liblzma/common/stream_encoder.c            |  2 +-
    - src/liblzma/common/vli_decoder.c               |  2 +-
    - src/liblzma/lz/lz_encoder.c                    |  2 +-
    - src/liblzma/lz/lz_encoder.h                    |  2 +-
    - src/liblzma/lzma/lzma2_encoder.c               |  2 +-
    - src/liblzma/lzma/lzma_decoder.c                |  4 ++--
    - src/liblzma/lzma/lzma_decoder.h                |  2 +-
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c   |  2 +-
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c |  2 +-
    - src/liblzma/lzma/lzma_encoder_private.h        |  2 +-
    - src/liblzma/simple/simple_coder.c              |  2 +-
    - src/liblzma/subblock/subblock_encoder.c        |  2 +-
    - src/scripts/xzdiff.1                           |  2 +-
    - src/scripts/xzless.1                           | 10 +++++-----
    - src/xz/coder.c                                 |  2 +-
    - src/xz/file_io.c                               |  2 +-
    - src/xz/main.c                                  |  6 +++---
    - src/xz/main.h                                  |  2 +-
    - src/xz/message.c                               | 10 +++++-----
    - src/xz/message.h                               |  2 +-
    - src/xz/xz.1                                    | 16 ++++++++--------
    - src/xzdec/lzmadec_w32res.rc                    |  2 +-
    - src/xzdec/xzdec_w32res.rc                      |  2 +-
    - tests/test_index.c                             |  2 +-
    - windows/build.sh                               |  4 ++--
    - 47 files changed, 77 insertions(+), 77 deletions(-)
    -
    -commit 4785f2021aa6a23f1caf724fcc823e562584f225
    -Author: Lasse Collin 
    -Date:   2010-02-12 12:41:20 +0200
    -
    -    Fix jl -> jb in ASM files.
    -
    - src/liblzma/check/crc32_x86.S | 2 +-
    - src/liblzma/check/crc64_x86.S | 4 ++--
    - 2 files changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 6b50c9429bf85521d355adc61745d06ee017f8c8
    -Author: Lasse Collin 
    -Date:   2010-02-12 12:31:22 +0200
    -
    -    Use __APPLE__ instead of __MACH__ in ASM files.
    -    
    -    This allows the files to work on HURD.
    -    
    -    Thanks to Jonathan Nieder.
    -
    - src/liblzma/check/crc32_x86.S | 8 ++++----
    - src/liblzma/check/crc64_x86.S | 8 ++++----
    - 2 files changed, 8 insertions(+), 8 deletions(-)
    -
    -commit 6503fde658a5cdbdd907a788865470dd64771601
    -Author: Lasse Collin 
    -Date:   2010-02-07 19:48:06 +0200
    -
    -    Subtle change to liblzma Block handling API.
    -    
    -    lzma_block.version has to be initialized even for
    -    lzma_block_header_decode(). This way a future version
    -    of liblzma won't allocate memory in a way that an old
    -    application doesn't know how to free it.
    -    
    -    The subtlety of this change is that all current apps
    -    using lzma_block_header_decode() will keep working for
    -    now, because the only possible version value is zero,
    -    and lzma_block_header_decode() unconditionally sets the
    -    version to zero even now. Unless fixed, these apps will
    -    break in the future if a new version of the Block options
    -    is ever needed.
    -
    - src/liblzma/api/lzma/block.h        | 39 ++++++++++++++++---------------------
    - src/liblzma/common/stream_decoder.c |  3 +++
    - 2 files changed, 20 insertions(+), 22 deletions(-)
    -
    -commit dd7c3841ff78cb94ce02b0220c6e4748460970f7
    -Author: Lasse Collin 
    -Date:   2010-02-02 11:50:11 +0200
    -
    -    Fix wrong assertion.
    -    
    -    This was added in 455e68c030fde8a8c2f5e254c3b3ab9489bf3735.
    -
    - src/xz/main.c | 5 +++--
    - 1 file changed, 3 insertions(+), 2 deletions(-)
    -
    -commit 9d67588c1597849504a3e5ac8bf6f06e7d2ee8be
    -Author: Lasse Collin 
    -Date:   2010-02-01 22:48:42 +0200
    -
    -    Updated TODO.
    -
    - TODO | 4 ----
    - 1 file changed, 4 deletions(-)
    -
    -commit fef6333f52c8801308c3b78acb7942988541d137
    -Author: Lasse Collin 
    -Date:   2010-02-01 22:47:54 +0200
    -
    -    Fix typos in comments.
    -
    - src/xz/list.c    | 2 +-
    - windows/build.sh | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 455e68c030fde8a8c2f5e254c3b3ab9489bf3735
    -Author: Lasse Collin 
    -Date:   2010-02-01 22:46:56 +0200
    -
    -    Fix signal handling for --list.
    -
    - src/xz/main.c | 19 ++++++++++++++-----
    - 1 file changed, 14 insertions(+), 5 deletions(-)
    -
    -commit 82220a149015616f75641ee8bbea415137535b9b
    -Author: Lasse Collin 
    -Date:   2010-02-01 11:44:45 +0200
    -
    -    Fix compression of symlinks with --force.
    -    
    -    xz --force accepted symlinks, but didn't remove
    -    them after successful compression. Instead, an error
    -    message was displayed.
    -
    - src/xz/file_io.c | 14 +++++++++++++-
    - 1 file changed, 13 insertions(+), 1 deletion(-)
    -
    -commit d4da177d5ba3d2ef7323a6f1e06ca16e0478810e
    -Author: Lasse Collin 
    -Date:   2010-02-01 10:20:57 +0200
    -
    -    Fix a comment.
    -
    - windows/build.sh | 5 ++---
    - 1 file changed, 2 insertions(+), 3 deletions(-)
    -
    -commit f9dd797a423a148903cf345b4146cb1fe1eab11d
    -Author: Lasse Collin 
    -Date:   2010-01-31 23:43:54 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit ee5ddb8b28419fe4923ded5c18a50570a762dcab
    -Author: Lasse Collin 
    -Date:   2010-01-31 23:41:29 +0200
    -
    -    Updated TODO.
    -
    - TODO | 17 +++++++++++------
    - 1 file changed, 11 insertions(+), 6 deletions(-)
    -
    -commit 11936ad3f5a2e97bda3463c7a56a2f4bb9265ea6
    -Author: Lasse Collin 
    -Date:   2010-01-31 23:35:04 +0200
    -
    -    Mention TODO in README.
    -
    - README | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 2901a8e7e82af05675b8cd8758a8ceddb111359f
    -Author: Lasse Collin 
    -Date:   2010-01-31 23:31:14 +0200
    -
    -    Updated INSTALL.
    -
    - INSTALL | 52 ++++++++++++++++++++++++++--------------------------
    - 1 file changed, 26 insertions(+), 26 deletions(-)
    -
    -commit 8884e16864ba53fb4b58623d7537d7ef30c28e11
    -Author: Lasse Collin 
    -Date:   2010-01-31 23:28:51 +0200
    -
    -    Revise the Windows build files.
    -    
    -    The old Makefile + config.h was deleted, because it
    -    becomes outdated too easily and building with the
    -    Autotools based build system works fine even on Windows.
    -    
    -    windows/build.sh hasn't got much testing, but it should
    -    work to build 32-bit x86 and x86-64 versions of XZ Utils
    -    using MSYS, MinGW or MinGW-w32, and MinGW-w64.
    -    
    -    windows/INSTALL-Windows.txt describes what packages are
    -    needed and how to install them.
    -    
    -    windows/README-Windows.txt is a readme file for the binary
    -    package that build.sh hopefully builds.
    -    
    -    There are no instructions about using Autotools for now,
    -    so those using a git snapshot may want to run
    -    "autoreconf -fi && ./configure && make mydist" on a UN*X
    -    box and then copy the resulting .tar.gz to a Windows.
    -
    - windows/INSTALL-Windows.txt | 131 ++++++++++++++++++
    - windows/Makefile            | 320 --------------------------------------------
    - windows/README              | 155 ---------------------
    - windows/README-Windows.txt  | 115 ++++++++++++++++
    - windows/build.sh            | 189 ++++++++++++++++++++++++++
    - windows/config.h            | 170 -----------------------
    - 6 files changed, 435 insertions(+), 645 deletions(-)
    -
    -commit 34eb5e201d62f7f46bbe6fe97cfe08cb31b3b88c
    -Author: Lasse Collin 
    -Date:   2010-01-31 19:52:38 +0200
    -
    -    Select the default integrity check type at runtime.
    -    
    -    Previously it was set statically to CRC64 or CRC32
    -    depending on options passed to the configure script.
    -
    - src/xz/coder.c | 19 ++++++++++++++-----
    - 1 file changed, 14 insertions(+), 5 deletions(-)
    -
    -commit 96a4f840e3b9ca5c81e5711ff9c267b194f93ef1
    -Author: Lasse Collin 
    -Date:   2010-01-31 18:17:50 +0200
    -
    -    Improve displaying of the memory usage limit.
    -
    - src/xz/coder.c   |  8 +++-----
    - src/xz/message.c | 37 +++++++++++++++++++++++++++++--------
    - src/xz/util.c    |  7 +++++++
    - src/xz/util.h    |  6 ++++++
    - 4 files changed, 45 insertions(+), 13 deletions(-)
    -
    -commit b3cc4d8edd68a0250cc69680c99b9f7343f99cf2
    -Author: Lasse Collin 
    -Date:   2010-01-31 12:53:56 +0200
    -
    -    Don't use uninitialized sigset_t.
    -    
    -    If signal handlers haven't been established, then it's
    -    useless to try to block them, especially since the sigset_t
    -    used for blocking hasn't been initialized yet.
    -
    - src/xz/signals.c | 34 ++++++++++++++++++++++++----------
    - 1 file changed, 24 insertions(+), 10 deletions(-)
    -
    -commit 231c3c7098f1099a56abb8afece76fc9b8699f05
    -Author: Lasse Collin 
    -Date:   2010-01-31 12:01:54 +0200
    -
    -    Delay opening the destionation file and other fixes.
    -    
    -    The opening of the destination file is now delayed a little.
    -    The coder is initialized, and if decompressing, the memory
    -    usage of the first Block compared against the memory
    -    usage limit before the destination file is opened. This
    -    means that if --force was used, the old "target" file won't
    -    be deleted so easily when something goes wrong very early.
    -    Thanks to Mark K for the bug report.
    -    
    -    The above fix required some changes to progress message
    -    handling. Now there is a separate function for setting and
    -    printing the filename. It is used also in list.c.
    -    
    -    list_file() now handles stdin correctly (gives an error).
    -    
    -    A useless check for user_abort was removed from file_io.c.
    -
    - src/xz/coder.c   |  64 ++++++++++++++++++++++-----------
    - src/xz/file_io.c | 107 +++++++++++++++++++++++++++----------------------------
    - src/xz/file_io.h |   8 +++--
    - src/xz/list.c    |  28 +++++----------
    - src/xz/message.c |  46 +++++++++++++-----------
    - src/xz/message.h |  29 ++++++++++-----
    - 6 files changed, 157 insertions(+), 125 deletions(-)
    -
    -commit 0dbd0641db99d5e73d51d04ce7a71e52dc6b4105
    -Author: Lasse Collin 
    -Date:   2010-01-29 22:48:04 +0200
    -
    -    Add list.h to src/xz/Makefile.am.
    -    
    -    This should have been already in
    -    0bc9eab243dee3be764b3530433a7fcdc3f7c6a1.
    -
    - src/xz/Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit b4b1a56e0cbd597157858264f5c7189201ac9018
    -Author: Lasse Collin 
    -Date:   2010-01-29 13:24:27 +0200
    -
    -    Add lzmainfo.1 to manfiles list to convert to .txt and .pdf.
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 5574d64e03ad3a3d6e00e4b0d3e81c7b5529ec95
    -Author: Lasse Collin 
    -Date:   2010-01-27 16:42:11 +0200
    -
    -    Silence two compiler warnings on DOS-like systems.
    -
    - src/common/tuklib_open_stdxxx.c | 6 +++++-
    - src/xz/file_io.c                | 3 +++
    - 2 files changed, 8 insertions(+), 1 deletion(-)
    -
    -commit b063cc34a30a4edf109343ff373b2b62b8ca72d3
    -Author: Lasse Collin 
    -Date:   2010-01-27 13:31:03 +0200
    -
    -    Use PACKAGE_URL instead of custom PACKAGE_HOMEPAGE.
    -
    - configure.ac              | 9 ++-------
    - src/liblzma/liblzma.pc.in | 2 +-
    - src/lzmainfo/lzmainfo.c   | 2 +-
    - src/xz/message.c          | 2 +-
    - src/xzdec/xzdec.c         | 2 +-
    - 5 files changed, 6 insertions(+), 11 deletions(-)
    -
    -commit 38b8035b5cb5f56457c5fa5a891d6900fcf5984f
    -Author: Lasse Collin 
    -Date:   2010-01-26 23:37:46 +0200
    -
    -    Add a missing space to an error message.
    -    
    -    Thanks to Robert Readman.
    -
    - src/xz/args.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit e5496f9628ff5979392a80421d0b63a4de8015b4
    -Author: Lasse Collin 
    -Date:   2010-01-26 22:53:37 +0200
    -
    -    Use past tense in error message in io_unlink().
    -    
    -    Added a note to translators too.
    -    
    -    Thanks to Robert Readman.
    -
    - THANKS           |  1 +
    - src/xz/file_io.c | 14 ++++++++++++--
    - 2 files changed, 13 insertions(+), 2 deletions(-)
    -
    -commit d9a9800597ea540090e434132c3b511217df0a2b
    -Author: Lasse Collin 
    -Date:   2010-01-26 15:42:24 +0200
    -
    -    Fix too small static buffer in util.c.
    -    
    -    This was introduced in
    -    0dd6d007669b946543ca939a44243833c79e08f4 two days ago.
    -
    - src/xz/util.c | 9 ++++-----
    - 1 file changed, 4 insertions(+), 5 deletions(-)
    -
    -commit d0b4bbf5da068503c099cd456e294d7673548cc0
    -Author: Lasse Collin 
    -Date:   2010-01-26 14:46:43 +0200
    -
    -    Minor comment fix.
    -
    - src/xz/main.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 0bc9eab243dee3be764b3530433a7fcdc3f7c6a1
    -Author: Lasse Collin 
    -Date:   2010-01-24 23:50:54 +0200
    -
    -    Add initial version of xz --list.
    -    
    -    This is a bit rough but should be useful for basic things.
    -    Ideas (with detailed examples) about the output format are
    -    welcome.
    -    
    -    The output of --robot --list is not necessarily stable yet,
    -    although I don't currently have any plans about changing it.
    -    
    -    The man page hasn't been updated yet.
    -
    - src/xz/Makefile.am |   1 +
    - src/xz/list.c      | 988 ++++++++++++++++++++++++++++++++++-------------------
    - src/xz/list.h      |  18 +
    - src/xz/main.c      |  19 +-
    - src/xz/private.h   |   1 +
    - 5 files changed, 668 insertions(+), 359 deletions(-)
    -
    -commit df254ce03be016e217b511e7acd5d493f9929ca5
    -Author: Lasse Collin 
    -Date:   2010-01-24 22:46:11 +0200
    -
    -    Add io_pread().
    -    
    -    It will be used by --list.
    -
    - src/xz/file_io.c | 25 +++++++++++++++++++++++++
    - src/xz/file_io.h | 17 +++++++++++++++++
    - 2 files changed, 42 insertions(+)
    -
    -commit ef68dd4a92976276304de2aedfbe34ae91a86abb
    -Author: Lasse Collin 
    -Date:   2010-01-24 22:45:14 +0200
    -
    -    Set LC_NUMERIC=C when --robot is used.
    -    
    -    It is to ensure that floating point numbers
    -    will always have a dot as the decimal separator.
    -
    - src/xz/args.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 0dd6d007669b946543ca939a44243833c79e08f4
    -Author: Lasse Collin 
    -Date:   2010-01-24 16:57:40 +0200
    -
    -    Some improvements to printing sizes in xz.
    -
    - src/xz/coder.c   | 56 +++++++++++++++------------------------
    - src/xz/message.c | 80 ++++++++++++++++++--------------------------------------
    - src/xz/message.h |  4 +++
    - src/xz/util.c    | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++
    - src/xz/util.h    | 44 +++++++++++++++++++++++++++++++
    - 5 files changed, 166 insertions(+), 90 deletions(-)
    -
    -commit 2a98fdffd68c66371279c211c29153c808ad5c1d
    -Author: Lasse Collin 
    -Date:   2010-01-20 22:02:35 +0200
    -
    -    Fix a typo in README.
    -    
    -    Thanks to R. Bijker.
    -
    - README | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 07a11dad44e041b01dcfc73e8d4e00731158c06d
    -Author: Lasse Collin 
    -Date:   2010-01-17 11:59:54 +0200
    -
    -    Updated windows/Makefile.
    -    
    -    Thanks to Dan Shechter for the patch.
    -    
    -    It is likely that windows/Makefile will be removed
    -    completely, because Autotols based build nowadays
    -    works well with both 32-bit and 64-bit MinGW (I
    -    just need to update the docs).
    -
    - windows/Makefile | 38 +++++++++++++++++++++++++-------------
    - windows/config.h |  2 ++
    - 2 files changed, 27 insertions(+), 13 deletions(-)
    -
    -commit 37f31ead9d2b4e467df11450cf29ed7d7e3e25f3
    -Author: Lasse Collin 
    -Date:   2010-01-15 11:05:11 +0200
    -
    -    Update the xz man page to match the previous two commits.
    -
    - src/xz/xz.1 | 9 +++------
    - 1 file changed, 3 insertions(+), 6 deletions(-)
    -
    -commit 3ffd5d81a43210c8da56da5c5b3637d3f8bc63c7
    -Author: Lasse Collin 
    -Date:   2010-01-13 19:10:25 +0200
    -
    -    Don't read compressed data from a terminal or write it
    -    to a terminal even if --force is specified.
    -    
    -    It just seems more reasonable this way.
    -    
    -    The new behavior matches bzip2. The old one matched gzip.
    -
    - src/xz/main.c | 20 +++++++++-----------
    - src/xz/util.c |  8 ++++----
    - 2 files changed, 13 insertions(+), 15 deletions(-)
    -
    -commit 23ac2c44c3ac76994825adb7f9a8f719f78b5ee4
    -Author: Lasse Collin 
    -Date:   2010-01-13 18:12:40 +0200
    -
    -    Don't compress or decompress special files unless writing
    -    to stdout even if --force is used.
    -    
    -    --force will still enable compression of symlinks, but only
    -    in case they point to a regular file.
    -    
    -    The new way simply seems more reasonable. It matches gzip's
    -    behavior while the old one matched bzip2's behavior.
    -
    - src/xz/file_io.c | 15 ++++++++++-----
    - 1 file changed, 10 insertions(+), 5 deletions(-)
    -
    -commit cee12aa852ec0902983dc1f153346ef750157fb9
    -Author: Lasse Collin 
    -Date:   2010-01-12 16:30:33 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 153c7740c54b3c90129dbd3d6153ac1303c4d605
    -Author: Lasse Collin 
    -Date:   2010-01-12 16:18:14 +0200
    -
    -    Add IRIX-specific code to tuklib_physmem and tuklib_cpucores.
    -    
    -    This is untested but it will get tested soon and, if needed,
    -    fixed before 5.0.0.
    -    
    -    Thanks to Stuart Shelton.
    -
    - m4/tuklib_cpucores.m4        | 11 +++++++++--
    - m4/tuklib_physmem.m4         | 22 +++++++++++++++++++++-
    - src/common/tuklib_cpucores.c |  6 ++++++
    - src/common/tuklib_physmem.c  | 19 +++++++++++++++++++
    - 4 files changed, 55 insertions(+), 3 deletions(-)
    -
    -commit 8ea8dc754a7a5bc2d60db1eac201839cabdab6a1
    -Author: Lasse Collin 
    -Date:   2010-01-01 00:29:10 +0200
    -
    -    Fix _memconfig() functions.
    -    
    -    This affects lzma_memusage() and lzma_memlimit_get().
    -
    - src/liblzma/api/lzma/index.h        |  7 -------
    - src/liblzma/common/alone_decoder.c  | 11 +++++++----
    - src/liblzma/common/index_decoder.c  | 10 ++++++----
    - src/liblzma/common/stream_decoder.c | 11 +++++++----
    - 4 files changed, 20 insertions(+), 19 deletions(-)
    -
    -commit 1a7ec87c8ee61dfc2e496d2e1fb7ab0939804691
    -Author: Lasse Collin 
    -Date:   2009-12-31 22:45:53 +0200
    -
    -    Revised the Index handling code.
    -    
    -    This breaks API and ABI but most apps are not affected
    -    since most apps don't use this part of the API. You will
    -    get a compile error if you are using anything that got
    -    broken.
    -    
    -    Summary of changes:
    -    
    -      - Ability to store Stream Flags, which are needed
    -        for random-access reading in multi-Stream files.
    -    
    -      - Separate function to set size of Stream Padding.
    -    
    -      - Iterator structure makes it possible to read the same
    -        lzma_index from multiple threads at the same time.
    -    
    -      - A lot faster code to locate Blocks.
    -    
    -      - Removed lzma_index_equal() without adding anything
    -        to replace it. I don't know what it should do exactly
    -        with the new features and what actually needs this
    -        function in the first place other than test_index.c,
    -        which now has its own code to compare lzma_indexes.
    -
    - src/liblzma/api/lzma/index.h               |  572 +++++++---
    - src/liblzma/common/index.c                 | 1553 ++++++++++++++++++----------
    - src/liblzma/common/index.h                 |    6 +
    - src/liblzma/common/index_decoder.c         |   12 +-
    - src/liblzma/common/index_encoder.c         |   36 +-
    - src/liblzma/common/index_encoder.h         |    2 +-
    - src/liblzma/common/stream_buffer_encoder.c |    6 +-
    - src/liblzma/common/stream_encoder.c        |    3 +-
    - tests/test_index.c                         |  371 ++++---
    - 9 files changed, 1703 insertions(+), 858 deletions(-)
    -
    -commit f29997a846e673cb3b8cbd57de47ed313b3978bb
    -Author: Lasse Collin 
    -Date:   2009-12-31 21:13:25 +0200
    -
    -    Remove c-format tag in cs.po.
    -    
    -    It was fixed in the C code earlier.
    -
    - po/cs.po | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit 097bad000363e0bf29f8274ad2d7ab59f7dbf644
    -Author: Lasse Collin 
    -Date:   2009-12-31 21:11:05 +0200
    -
    -    Add missing lzma_nothrow in filter.h.
    -
    - src/liblzma/api/lzma/filter.h | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit b56cb1fc31fa2381f92eefc040df85667048d626
    -Author: Lasse Collin 
    -Date:   2009-12-09 18:13:44 +0200
    -
    -    Remove redefinition of _(msgid) macro from lzmainfo.c.
    -
    - src/lzmainfo/lzmainfo.c | 7 -------
    - 1 file changed, 7 deletions(-)
    -
    -commit 171b03febfe09d9fae6ac8be6aa4518bcaf427d2
    -Author: Jonathan Nieder 
    -Date:   2009-12-08 19:41:57 -0600
    -
    -    update po/.gitignore
    -    
    -    Since the *.gmo files are deleted by the maintainer-clean target,
    -    I assume they are not meant to be tracked.
    -    
    -    Also add the other files listed in the Makefile’s clean targets
    -    (stamp-poT, xz.po, xz.[12].po, *.new.po, xz.mo) to make sure they
    -    are not accidentally tracked.  Most of these are intermediate
    -    files that would not appear unless a build is interrupted or
    -    fails.
    -    
    -    Split the list of untracked files by origin to make it easier to
    -    tell if files are missing in the future.
    -    
    -    Signed-off-by: Jonathan Nieder 
    -
    - po/.gitignore | 28 ++++++++++++++++++++++------
    - 1 file changed, 22 insertions(+), 6 deletions(-)
    -
    -commit f7e44c6c11f630519072971b8b07a5729c096c36
    -Author: Lasse Collin 
    -Date:   2009-12-09 00:38:55 +0200
    -
    -    Always rely on GCC's auto-import on Windows.
    -    
    -    I understood that this is nicer, because then people
    -    don't need to worry about the LZMA_API_STATIC macro.
    -    
    -    Thanks to Charles Wilson and Keith Marshall.
    -
    - src/liblzma/api/lzma.h | 16 +++++++++-------
    - 1 file changed, 9 insertions(+), 7 deletions(-)
    -
    -commit 7b76a3e2336f25088957cba92b0dbd854d9caa3c
    -Author: Lasse Collin 
    -Date:   2009-12-07 21:46:53 +0200
    -
    -    Fix file_io.c on DOS-like systems.
    -    
    -    The problem was introduced when adding sparse file
    -    support in 465d1b0d6518c5d980f2db4c2d769f9905bdd902.
    -    
    -    Thanks to Charles Wilson.
    -
    - src/xz/file_io.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 0696f5d268362221380e039bad48a86e29067c6a
    -Author: Lasse Collin 
    -Date:   2009-12-07 20:54:21 +0200
    -
    -    Add Czech translation.
    -    
    -    Thanks to Marek Černocký.
    -    
    -    Other people planning to translate xz: Note that the
    -    messages are a little bit in flux still. Translations
    -    are still welcome, just be prepared to some extra work
    -    in case there are changes.
    -
    - THANKS     |   1 +
    - po/LINGUAS |   1 +
    - po/cs.po   | 637 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 639 insertions(+)
    -
    -commit 5e817a50d276f0a3607638c1c1d449d50b9aa4e5
    -Author: Lasse Collin 
    -Date:   2009-12-07 20:32:08 +0200
    -
    -    Add a note for translators to add a bug reporting address
    -    for translation bugs.
    -
    - src/xz/message.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 6db1c35be9e1e364cdacff6878910e1b7aac2a37
    -Author: Lasse Collin 
    -Date:   2009-12-07 20:07:02 +0200
    -
    -    Prevent xgettext from taking one regular string as a C format string.
    -    
    -    Thanks to Marek Černocký.
    -
    - src/xz/message.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit e0c2776b6ffbd2b1900fde353aceac734edc93d7
    -Author: Lasse Collin 
    -Date:   2009-11-28 17:45:22 +0200
    -
    -    Remove duplicate code in io_open_dest().
    -    
    -    Fix a missing _() in the error message too.
    -
    - src/xz/file_io.c | 9 +--------
    - 1 file changed, 1 insertion(+), 8 deletions(-)
    -
    -commit f057a33c6f7c5992389479f2d4feabf2900ba7ee
    -Author: Lasse Collin 
    -Date:   2009-11-26 10:11:23 +0200
    -
    -    Typo fix to sysdefs.h.
    -    
    -    Thanks to Jonathan Nieder.
    -
    - src/common/sysdefs.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 8767b41534eafdf5e742e12190646bf5740b0cdb
    -Author: Lasse Collin 
    -Date:   2009-11-26 10:10:36 +0200
    -
    -    Fix a memory leak in test_index.c.
    -    
    -    This was introduced in
    -    bd13b04e202b6f495a68eb0766f97085b7c50a06.
    -    
    -    Thanks to Jim Meyering for noticing it.
    -
    - tests/test_index.c | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 919fbaff860acdaa4bcd216500a0b1c960a6db92
    -Author: Lasse Collin 
    -Date:   2009-11-25 14:22:19 +0200
    -
    -    Add missing error check to coder.c.
    -    
    -    With bad luck this could cause a segfault due to
    -    reading (but not writing) past the end of the buffer.
    -
    - src/xz/coder.c | 20 +++++++++++---------
    - 1 file changed, 11 insertions(+), 9 deletions(-)
    -
    -commit bd13b04e202b6f495a68eb0766f97085b7c50a06
    -Author: Lasse Collin 
    -Date:   2009-11-25 13:04:10 +0200
    -
    -    Fix bugs in lzma_index_read() and lzma_index_cat().
    -    
    -    lzma_index_read() didn't skip over Stream Padding
    -    if it was the first record in the Index.
    -    
    -    lzma_index_cat() didn't combine small Indexes correctly.
    -    
    -    The test suite was updated to check for these bugs.
    -    
    -    These bugs didn't affect the xz command line tool or
    -    most users of liblzma in any way.
    -
    - src/liblzma/common/index.c | 30 +++++++++++++++++++-----------
    - tests/test_index.c         | 28 +++++++++++++++++++++++++---
    - 2 files changed, 44 insertions(+), 14 deletions(-)
    -
    -commit 1f196909143b888e062bd9a0c4ba8c34d3019bfa
    -Author: Lasse Collin 
    -Date:   2009-11-25 12:52:56 +0200
    -
    -    Index decoder fixes.
    -    
    -    The Index decoder code didn't perfectly match the API docs,
    -    which said that *i will be set to point to the decoded Index
    -    only after decoding has succeeded. The docs were a bit unclear
    -    too.
    -    
    -    Now the decoder will initially set *i to NULL. *i will be set
    -    to point to the decoded Index once decoding has succeeded.
    -    This simplifies applications too, since it avoids dangling
    -    pointers.
    -
    - src/liblzma/api/lzma/index.h       | 23 ++++++++++++-----------
    - src/liblzma/common/index_decoder.c | 26 ++++++++++++++++++++------
    - 2 files changed, 32 insertions(+), 17 deletions(-)
    -
    -commit 465d1b0d6518c5d980f2db4c2d769f9905bdd902
    -Author: Lasse Collin 
    -Date:   2009-11-25 11:19:20 +0200
    -
    -    Create sparse files by default when decompressing into
    -    a regular file.
    -    
    -    Sparse file creation can be disabled with --no-sparse.
    -    I don't promise yet that the name of this option won't
    -    change before 5.0.0. It's possible that the code, that
    -    checks when it is safe to use sparse output on stdout,
    -    is not good enough, and a more flexible command line
    -    option is needed to configure sparse file handling.
    -
    - src/xz/args.c    |   6 ++
    - src/xz/coder.c   |  33 ++++----
    - src/xz/file_io.c | 243 +++++++++++++++++++++++++++++++++++++++++++++++--------
    - src/xz/file_io.h |  34 ++++++--
    - src/xz/message.c |   1 +
    - src/xz/xz.1      |  11 +++
    - 6 files changed, 272 insertions(+), 56 deletions(-)
    -
    -commit 37de544414fc2dc5039471d1002ebd015eb3e627
    -Author: Lasse Collin 
    -Date:   2009-11-22 12:43:06 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit f1a28b96c900c658fe016852ff62f6c24d1f50fa
    -Author: Lasse Collin 
    -Date:   2009-11-22 12:05:33 +0200
    -
    -    Add missing consts to pointer casts.
    -
    - src/liblzma/check/crc32_fast.c | 4 ++--
    - src/liblzma/check/crc64_fast.c | 5 +++--
    - 2 files changed, 5 insertions(+), 4 deletions(-)
    -
    -commit b9b5c54cd438b3ae47b44cc211b71f3bc53e35ef
    -Author: Lasse Collin 
    -Date:   2009-11-22 12:00:30 +0200
    -
    -    Enable assembler code only if it is known to work
    -    on that operating system.
    -    
    -    I'm too lazy to think how to make a good Autoconf test
    -    for this and it's not that important anyway.
    -    
    -    No longer define HAVE_ASM_X86 or HAVE_ASM_X86_64.
    -    Inline assembler (if any) is used if a macro like
    -    __i386__ or __x86_64__ is defined.
    -
    - configure.ac | 26 ++++++++++++--------------
    - 1 file changed, 12 insertions(+), 14 deletions(-)
    -
    -commit 0733f4c9994db696420a405810d5f02c79ebc404
    -Author: Lasse Collin 
    -Date:   2009-11-22 11:55:03 +0200
    -
    -    Make fastpos.h use tuklib_integer.h instead of bsr.h
    -    when --enable-small has been specified.
    -
    - src/liblzma/common/Makefile.inc |  1 -
    - src/liblzma/common/bsr.h        | 60 -----------------------------------------
    - src/liblzma/lzma/fastpos.h      |  5 +---
    - 3 files changed, 1 insertion(+), 65 deletions(-)
    -
    -commit 7ac3985d891dcc5773543f84cc5bce6c14841b12
    -Author: Lasse Collin 
    -Date:   2009-11-22 11:52:30 +0200
    -
    -    Update tuklib_integer.h with bit scan functions.
    -    
    -    Thanks to Joachim Henke for the original patch.
    -
    - src/common/tuklib_integer.h | 189 ++++++++++++++++++++++++++++++++++++++++++--
    - 1 file changed, 181 insertions(+), 8 deletions(-)
    -
    -commit c74c132f7f79a842c073c66575a4fdb985e4c2e3
    -Author: Lasse Collin 
    -Date:   2009-11-20 12:51:19 +0200
    -
    -    Update tuklib_cpucores.m4 and tuklib_physmem.m4 from tuklib,
    -    which now use AC_CACHE_CHECK. Using the cache variable,
    -    configure now warns if there is no method to detect the amount
    -    of RAM and recommends using --enable-assume-ram.
    -
    - configure.ac          | 16 ++++++++++++++++
    - m4/tuklib_cpucores.m4 | 31 ++++++++++++++++++-------------
    - m4/tuklib_physmem.m4  | 50 +++++++++++++++++++++++++++-----------------------
    - 3 files changed, 61 insertions(+), 36 deletions(-)
    -
    -commit d315ca4930ff96e1428c6021c96f209e1abdd83e
    -Author: Lasse Collin 
    -Date:   2009-11-16 18:16:45 +0200
    -
    -    Add support for --info-memory and --robot to xz.
    -    
    -    Currently --robot works only with --info-memory and
    -    --version. --help and --long-help work too, but --robot
    -    has no effect on them.
    -    
    -    Thanks to Jonathan Nieder for the original patches.
    -
    - src/xz/args.c    | 85 +++++++++++++++++++++++++++++++++-----------------------
    - src/xz/args.h    |  1 +
    - src/xz/main.c    | 11 +++++---
    - src/xz/message.c | 47 +++++++++++++++++++++++--------
    - src/xz/message.h |  4 +++
    - src/xz/xz.1      | 40 +++++++++++++++++++++++---
    - 6 files changed, 133 insertions(+), 55 deletions(-)
    -
    -commit e330fb7e6b8162894280c8a3dc22fdc05cd2d85e
    -Author: Lasse Collin 
    -Date:   2009-11-15 12:54:45 +0200
    -
    -    Fix wrong indentation caused by incorrect settings
    -    in the text editor.
    -
    - src/liblzma/lz/lz_decoder.c                    | 18 +++++++++---------
    - src/liblzma/lzma/lzma2_encoder.c               |  6 +++---
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c |  2 +-
    - 3 files changed, 13 insertions(+), 13 deletions(-)
    -
    -commit 93e418562cf127a9171e87bcd4e9af8e1bfcdae4
    -Author: Lasse Collin 
    -Date:   2009-11-15 12:40:17 +0200
    -
    -    Add lzma_physmem().
    -    
    -    I had hoped to keep liblzma as purely a compression
    -    library as possible (e.g. file I/O will go into
    -    a different library), but it seems that applications
    -    linking agaisnt liblzma need some way to determine
    -    the memory usage limit, and knowing the amount of RAM
    -    is one reasonable way to help making such decisions.
    -    
    -    Thanks to Jonathan Nieder for the original patch.
    -
    - src/liblzma/Makefile.am               |  5 ++--
    - src/liblzma/api/Makefile.am           |  1 +
    - src/liblzma/api/lzma.h                |  3 +++
    - src/liblzma/api/lzma/hardware.h       | 51 +++++++++++++++++++++++++++++++++++
    - src/liblzma/common/Makefile.inc       |  1 +
    - src/liblzma/common/hardware_physmem.c | 25 +++++++++++++++++
    - src/xz/Makefile.am                    |  1 -
    - src/xz/hardware.c                     |  3 +--
    - src/xzdec/Makefile.am                 |  6 ++---
    - src/xzdec/xzdec.c                     |  3 +--
    - 10 files changed, 88 insertions(+), 11 deletions(-)
    -
    -commit cf39faca59083d38422058c6c97aa757ea7797d0
    -Author: Lasse Collin 
    -Date:   2009-11-14 20:21:19 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 2ddcae247c284cc2f396b6cfdab57790c7588b5f
    -Author: Lasse Collin 
    -Date:   2009-11-14 20:20:03 +0200
    -
    -    Some updates to xz man page.
    -
    - src/xz/xz.1 | 54 +++++++++++++++++++++++++++++++++++++++++++++++++-----
    - 1 file changed, 49 insertions(+), 5 deletions(-)
    -
    -commit 19b2674f07f8b588dfaf6638396b4b42866d7e23
    -Author: Lasse Collin 
    -Date:   2009-11-14 19:51:03 +0200
    -
    -    Fix description of --memory in --long-help.
    -
    - src/xz/message.c | 3 +--
    - 1 file changed, 1 insertion(+), 2 deletions(-)
    -
    -commit 2291346f0cccf88e605d84b75c9c5aaaaddb5df8
    -Author: Lasse Collin 
    -Date:   2009-11-14 19:45:39 +0200
    -
    -    Update the debug programs so that they compile again.
    -
    - debug/crc32.c      |  1 +
    - debug/memusage.c   |  6 ++++--
    - debug/sync_flush.c | 14 +++++++++-----
    - 3 files changed, 14 insertions(+), 7 deletions(-)
    -
    -commit 418d64a32e8144210f98a810738fed5a897e8367
    -Author: Lasse Collin 
    -Date:   2009-11-14 18:59:19 +0200
    -
    -    Fix a design error in liblzma API.
    -    
    -    Originally the idea was that using LZMA_FULL_FLUSH
    -    with Stream encoder would read the filter chain
    -    from the same array that was used to intialize the
    -    Stream encoder. Since most apps wouldn't use
    -    LZMA_FULL_FLUSH, most apps wouldn't need to keep
    -    the filter chain available after initializing the
    -    Stream encoder. However, due to my mistake, it
    -    actually required keeping the array always available.
    -    
    -    Since setting the new filter chain via the array
    -    used at initialization time is not a nice way to do
    -    it for a couple of reasons, this commit ditches it
    -    and introduces lzma_filters_update(). This new function
    -    replaces also the "persistent" flag used by LZMA2
    -    (and to-be-designed Subblock filter), which was also
    -    an ugly thing to do.
    -    
    -    Thanks to Alexey Tourbin for reminding me about the problem
    -    that Stream encoder used to require keeping the filter
    -    chain allocated.
    -
    - src/liblzma/api/lzma/filter.h           | 30 +++++++++++++
    - src/liblzma/api/lzma/lzma.h             | 13 ------
    - src/liblzma/common/block_encoder.c      | 14 ++++++
    - src/liblzma/common/common.c             | 20 ++++++++-
    - src/liblzma/common/common.h             | 22 ++++++++++
    - src/liblzma/common/easy_encoder.c       | 63 ++-------------------------
    - src/liblzma/common/filter_common.c      |  3 ++
    - src/liblzma/common/filter_encoder.c     | 27 ++++++++++++
    - src/liblzma/common/filter_encoder.h     |  2 +-
    - src/liblzma/common/stream_encoder.c     | 76 ++++++++++++++++++++++++++++-----
    - src/liblzma/delta/delta_common.c        |  5 +--
    - src/liblzma/delta/delta_decoder.c       |  3 +-
    - src/liblzma/delta/delta_encoder.c       | 17 +++++++-
    - src/liblzma/delta/delta_private.h       |  2 +-
    - src/liblzma/lz/lz_encoder.c             | 17 ++++++++
    - src/liblzma/lz/lz_encoder.h             |  4 ++
    - src/liblzma/lzma/lzma2_encoder.c        | 59 ++++++++++++++-----------
    - src/liblzma/lzma/lzma_encoder_presets.c |  1 -
    - src/liblzma/simple/simple_coder.c       | 12 ++++++
    - src/xz/options.c                        |  1 -
    - 20 files changed, 273 insertions(+), 118 deletions(-)
    -
    -commit f0bf7634b77263a4dd02b20c71861ab67995da68
    -Author: Lasse Collin 
    -Date:   2009-10-17 11:11:58 +0300
    -
    -    Fix wrong function name in the previous commit.
    -    
    -    It was meant to be lzma_filters_copy(), not lzma_filters_dup().
    -
    - src/liblzma/api/lzma/filter.h      | 2 +-
    - src/liblzma/common/filter_common.c | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 6d118a0b9def82e96afba7386ec8d7da0b59649f
    -Author: Lasse Collin 
    -Date:   2009-10-17 01:47:07 +0300
    -
    -    Add lzma_filters_copy().
    -    
    -    This will be needed internally by liblzma once I fix
    -    a design mistake in the encoder API. This function may
    -    be useful to applications too so it's good to export it.
    -
    - src/liblzma/api/lzma/filter.h      | 31 ++++++++++++++
    - src/liblzma/common/filter_common.c | 82 ++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 113 insertions(+)
    -
    -commit 78e92c18470483e161388e679c1ee556adb3a691
    -Author: Jonathan Nieder 
    -Date:   2009-10-15 20:44:13 -0500
    -
    -    Escape dashes in xzmore.1
    -    
    -    A minus sign is larger, easier to see in a printout, and more
    -    likely to use the same glyph as ASCII hyphen-minus in a terminal
    -    than a hyphen.  Since broken manual pagers do not find hyphens
    -    when the user searches for a hyphen-minus, minus signs are also
    -    easier to search for.  So use minus signs instead of hyphens to
    -    render sample terminal output.
    -
    - src/scripts/xzmore.1 | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 7b7fe902d98da28e5769e2aa1e0c08c92384f7ee
    -Author: Lasse Collin 
    -Date:   2009-10-16 20:35:39 +0300
    -
    -    Mention --check=none in --long-help. It was already in
    -    the man page though.
    -    
    -    Thanks to Jim Meyering for noticing this.
    -
    - src/xz/message.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit ebfb2c5e1f344e5c6e549b9dedaa49b0749a4a24
    -Author: Lasse Collin 
    -Date:   2009-10-04 22:57:12 +0300
    -
    -    Use a tuklib module for integer handling.
    -    
    -    This replaces bswap.h and integer.h.
    -    
    -    The tuklib module uses  on GNU,
    -     on *BSDs and 
    -    on Solaris, which may contain optimized code
    -    like inline assembly.
    -
    - configure.ac                              |  54 +----
    - m4/tuklib_integer.m4                      |  74 +++++++
    - src/common/bswap.h                        |  52 -----
    - src/common/integer.h                      | 170 ---------------
    - src/common/tuklib_config.h                |   8 +-
    - src/common/tuklib_integer.h               | 350 ++++++++++++++++++++++++++++++
    - src/liblzma/check/check.c                 |   4 +-
    - src/liblzma/check/crc32_fast.c            |   4 +-
    - src/liblzma/check/crc32_tablegen.c        |   8 +-
    - src/liblzma/check/crc64_fast.c            |   4 +-
    - src/liblzma/check/crc64_tablegen.c        |   8 +-
    - src/liblzma/check/crc_macros.h            |   2 -
    - src/liblzma/check/sha256.c                |  18 +-
    - src/liblzma/common/alone_encoder.c        |   2 +-
    - src/liblzma/common/block_header_decoder.c |   2 +-
    - src/liblzma/common/block_header_encoder.c |   2 +-
    - src/liblzma/common/common.h               |   2 +-
    - src/liblzma/common/stream_flags_decoder.c |   6 +-
    - src/liblzma/common/stream_flags_encoder.c |   6 +-
    - src/liblzma/lz/lz_encoder_hash.h          |   2 +-
    - src/liblzma/lzma/lzma_decoder.c           |   2 +-
    - src/liblzma/lzma/lzma_encoder.c           |   2 +-
    - src/liblzma/lzma/lzma_encoder_private.h   |   2 +-
    - src/liblzma/simple/simple_decoder.c       |   2 +-
    - src/liblzma/simple/simple_encoder.c       |   2 +-
    - tests/test_block_header.c                 |   4 +-
    - tests/test_stream_flags.c                 |   6 +-
    - tests/tests.h                             |   2 +-
    - 28 files changed, 467 insertions(+), 333 deletions(-)
    -
    -commit 29fd321033276261b87da7be5223db33d879a4c7
    -Author: Lasse Collin 
    -Date:   2009-10-02 14:35:56 +0300
    -
    -    Add support for --enable-assume-ram=SIZE.
    -
    - INSTALL           | 16 ++++++++++++++++
    - configure.ac      | 24 ++++++++++++++++++++++++
    - src/xz/hardware.c |  7 +++----
    - src/xzdec/xzdec.c |  5 +++--
    - 4 files changed, 46 insertions(+), 6 deletions(-)
    -
    -commit 3782b3fee4812b0dd4ffdfa6563ed49f73060f25
    -Author: Lasse Collin 
    -Date:   2009-10-02 11:28:17 +0300
    -
    -    Use unaligned access (if possible) on both endiannesses
    -    in lz_encoder_hash.h.
    -
    - src/liblzma/lz/lz_encoder_hash.h | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit c5f68b5cc79085a87f950fea53843e27f328068e
    -Author: Lasse Collin 
    -Date:   2009-10-02 11:03:26 +0300
    -
    -    Make liblzma produce the same output on both endiannesses.
    -    
    -    Seems that it is a problem in some cases if the same
    -    version of XZ Utils produces different output on different
    -    endiannesses, so this commit fixes that problem. The output
    -    will still vary between different XZ Utils versions, but I
    -    cannot avoid that for now.
    -    
    -    This commit bloatens the code on big endian systems by 1 KiB,
    -    which should be OK since liblzma is bloated already. ;-)
    -
    - src/liblzma/check/crc32_tablegen.c     | 30 +++++++++++++++
    - src/liblzma/lz/Makefile.inc            |  1 +
    - src/liblzma/lz/lz_encoder.c            |  7 +++-
    - src/liblzma/lz/lz_encoder_hash.h       | 35 +++++++++++------
    - src/liblzma/lz/lz_encoder_hash_table.h | 68 ++++++++++++++++++++++++++++++++++
    - src/liblzma/lz/lz_encoder_mf.c         |  1 -
    - 6 files changed, 128 insertions(+), 14 deletions(-)
    -
    -commit 4a84d1adfda35e4fb4d41ecf0feb8223b100517a
    -Author: Mike Frysinger 
    -Date:   2009-09-26 12:51:50 -0400
    -
    -    add lzmainfo to gitignore
    -    
    -    Signed-off-by: Mike Frysinger 
    -
    - .gitignore | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 188a1dcd0cc7867810ed3a55c598d0680922c63b
    -Author: Lasse Collin 
    -Date:   2009-09-27 11:53:36 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit db9119b9181b307e7ac5d2bae82444d04b902b59
    -Author: Lasse Collin 
    -Date:   2009-09-27 11:48:54 +0300
    -
    -    Work around a bug in Interix header files.
    -    
    -    Thanks to Markus Duft for the patch.
    -
    - src/common/sysdefs.h | 6 ++++++
    - 1 file changed, 6 insertions(+)
    -
    -commit b3d105e69786a45963176fd2193abe75e05ba738
    -Author: Lasse Collin 
    -Date:   2009-09-24 17:50:17 +0300
    -
    -    Fix an error in OpenVMS-specific code.
    -    
    -    Thanks to Jouk Jansen.
    -
    - src/xz/file_io.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 5e000ff00d4d01e559397b49eb648ad3f159d496
    -Author: Lasse Collin 
    -Date:   2009-09-22 18:59:56 +0300
    -
    -    Added OpenVMS-specific information to INSTALL.
    -
    - INSTALL | 11 +++++++++++
    - 1 file changed, 11 insertions(+)
    -
    -commit 932b2e204463d70f3eee5b8a1ea5a23bf9d001a4
    -Author: Lasse Collin 
    -Date:   2009-09-22 14:03:02 +0300
    -
    -    Better fixes for OpenVMS support.
    -    
    -    Thanks to Jouk Jansen.
    -
    - src/xz/file_io.c | 19 ++++++++++++++++---
    - 1 file changed, 16 insertions(+), 3 deletions(-)
    -
    -commit 4c3630ec4179fe9265407a35c4db1374ffc82372
    -Author: Lasse Collin 
    -Date:   2009-09-22 13:40:19 +0300
    -
    -    Avoid non-standard preprocessor construct.
    -    
    -    Thanks to Jouk Jansen.
    -
    - src/common/tuklib_common.h | 11 +++++++----
    - 1 file changed, 7 insertions(+), 4 deletions(-)
    -
    -commit 0deb1bb60addd1306b525e0ac0ad2a84eb0390d9
    -Author: Lasse Collin 
    -Date:   2009-09-21 19:50:09 +0300
    -
    -    Make sure that TUKLIB_DOSLIKE doesn't get defined on Cygwin.
    -    
    -    Thanks to Charles Wilson.
    -
    - src/common/tuklib_common.h | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit e599bba4216c0edb8cc8f40adad3a6dba88685f4
    -Author: Lasse Collin 
    -Date:   2009-09-19 09:47:30 +0300
    -
    -    Various changes.
    -    
    -    Separate a few reusable components from XZ Utils specific
    -    code. The reusable code is now in "tuklib" modules. A few
    -    more could be separated still, e.g. bswap.h.
    -    
    -    Fix some bugs in lzmainfo.
    -    
    -    Fix physmem and cpucores code on OS/2. Thanks to Elbert Pol
    -    for help.
    -    
    -    Add OpenVMS support into physmem. Add a few #ifdefs to ease
    -    building XZ Utils on OpenVMS. Thanks to Jouk Jansen for the
    -    original patch.
    -
    - THANKS                          |   1 +
    - configure.ac                    |  12 ++--
    - m4/lc_cpucores.m4               |  57 ----------------
    - m4/lc_physmem.m4                |  84 -----------------------
    - m4/tuklib_common.m4             |  22 ++++++
    - m4/tuklib_cpucores.m4           |  72 ++++++++++++++++++++
    - m4/tuklib_physmem.m4            | 119 ++++++++++++++++++++++++++++++++
    - m4/tuklib_progname.m4           |  25 +++++++
    - src/common/cpucores.h           |  51 --------------
    - src/common/open_stdxxx.h        |  49 --------------
    - src/common/physmem.h            | 144 ---------------------------------------
    - src/common/sysdefs.h            |   4 --
    - src/common/tuklib_common.h      |  67 ++++++++++++++++++
    - src/common/tuklib_config.h      |   1 +
    - src/common/tuklib_cpucores.c    |  46 +++++++++++++
    - src/common/tuklib_cpucores.h    |  23 +++++++
    - src/common/tuklib_exit.c        |  57 ++++++++++++++++
    - src/common/tuklib_exit.h        |  25 +++++++
    - src/common/tuklib_gettext.h     |  44 ++++++++++++
    - src/common/tuklib_open_stdxxx.c |  51 ++++++++++++++
    - src/common/tuklib_open_stdxxx.h |  23 +++++++
    - src/common/tuklib_physmem.c     | 146 ++++++++++++++++++++++++++++++++++++++++
    - src/common/tuklib_physmem.h     |  28 ++++++++
    - src/common/tuklib_progname.c    |  50 ++++++++++++++
    - src/common/tuklib_progname.h    |  32 +++++++++
    - src/lzmainfo/Makefile.am        |   5 +-
    - src/lzmainfo/lzmainfo.c         |  65 ++++++------------
    - src/xz/Makefile.am              |   7 +-
    - src/xz/args.c                   |   8 +--
    - src/xz/file_io.c                |  43 ++++++------
    - src/xz/hardware.c               |   8 +--
    - src/xz/main.c                   | 100 ++++++---------------------
    - src/xz/main.h                   |   7 --
    - src/xz/message.c                |  30 +++++----
    - src/xz/message.h                |   8 +--
    - src/xz/private.h                |  11 +--
    - src/xz/signals.c                |   2 +
    - src/xz/signals.h                |  17 +++--
    - src/xz/suffix.c                 |   2 +-
    - src/xzdec/Makefile.am           |  13 +++-
    - src/xzdec/xzdec.c               |  55 +++++----------
    - 41 files changed, 974 insertions(+), 640 deletions(-)
    -
    -commit 49cfc8d392cf535f8dd10233225b1fc726fec9ef
    -Author: Lasse Collin 
    -Date:   2009-09-15 21:07:23 +0300
    -
    -    Fix incorrect use of "restrict".
    -
    - src/liblzma/api/lzma/vli.h       | 4 ++--
    - src/liblzma/common/vli_decoder.c | 2 +-
    - src/liblzma/common/vli_encoder.c | 2 +-
    - 3 files changed, 4 insertions(+), 4 deletions(-)
    -
    -commit 15ffd675ab7af84592eb1c23b0e9f4699aa0fd8c
    -Author: Lasse Collin 
    -Date:   2009-09-12 14:09:17 +0300
    -
    -    Fix GCC version check for nothrow attribute.
    -
    - src/liblzma/api/lzma.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 6bfdd3a88a819f04c8f202e7d3c6f88a01c7d224
    -Author: Lasse Collin 
    -Date:   2009-09-12 14:08:15 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 4ab7b16b9573bdfa32279e4adadff684d5cd58ac
    -Author: Lasse Collin 
    -Date:   2009-09-12 14:07:36 +0300
    -
    -    A few grammar fixes.
    -    
    -    Thanks to Christian Weisgerber for pointing out some of these.
    -
    - src/liblzma/api/lzma.h                    |  4 ++--
    - src/liblzma/api/lzma/vli.h                |  4 ++--
    - src/liblzma/common/block_header_encoder.c |  2 +-
    - src/liblzma/common/filter_common.c        |  2 +-
    - src/liblzma/lz/lz_encoder.h               | 10 +++++-----
    - src/xz/message.c                          | 22 +++++++++++-----------
    - src/xzdec/xzdec.c                         |  2 +-
    - 7 files changed, 23 insertions(+), 23 deletions(-)
    -
    -commit 8905a33daadcd2d6557c83c81c490b827d566c94
    -Author: Lasse Collin 
    -Date:   2009-09-11 17:08:15 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 68059334ff435300ab1ce2c616b0eee1b0d88dd9
    -Author: Lasse Collin 
    -Date:   2009-09-11 17:06:32 +0300
    -
    -    Add PACKAGE_HOMEPAGE to {windows,dos}/config.h to fix build errors.
    -
    - dos/config.h     | 3 +++
    - windows/config.h | 3 +++
    - 2 files changed, 6 insertions(+)
    -
    -commit 221be761f467da76875247bc02d7a1716682075d
    -Author: Lasse Collin 
    -Date:   2009-09-11 10:24:09 +0300
    -
    -    Use $(LN_EXEEXT) in symlinks to executables.
    -    
    -    This fixes "make install" on operating systems using
    -    a suffix for executables.
    -    
    -    Cygwin is treated specially. The symlink names won't have
    -    .exe suffix even though the executables themselves have.
    -    Thanks to Charles Wilson.
    -
    - configure.ac       | 9 +++++++++
    - src/xz/Makefile.am | 4 ++--
    - 2 files changed, 11 insertions(+), 2 deletions(-)
    -
    -commit 18a4233a53d9b82abac7db7d7804684c5fea9c2c
    -Author: Lasse Collin 
    -Date:   2009-09-11 09:25:09 +0300
    -
    -    Fix a couple of warnings.
    -
    - src/liblzma/common/stream_decoder.c            | 2 +-
    - src/liblzma/lz/lz_encoder.c                    | 5 +----
    - src/liblzma/lzma/lzma_encoder.c                | 2 +-
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c | 8 ++++----
    - tests/tests.h                                  | 2 +-
    - 5 files changed, 8 insertions(+), 11 deletions(-)
    -
    -commit 429910b2ba67611d8df60d1a9da9641bdb5f82b4
    -Author: Lasse Collin 
    -Date:   2009-09-05 18:39:21 +0300
    -
    -    Add OS/2-specific code to physmem.h.
    -    
    -    Also move DJGPP-specific code near the code meant
    -    for other DOS-like systems.
    -
    - src/common/physmem.h | 32 +++++++++++++++++++++-----------
    - 1 file changed, 21 insertions(+), 11 deletions(-)
    -
    -commit 7aca7b3174bcbba4a4915682ff0cd405d63f5740
    -Author: Lasse Collin 
    -Date:   2009-09-05 01:21:15 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 60ccb80c9c4a0d771acc5b7d9d6f32b17fed1071
    -Author: Lasse Collin 
    -Date:   2009-09-05 01:20:29 +0300
    -
    -    Use sysctl() != -1 instead of !sysctl() to check if
    -    the function call succeeded.
    -    
    -    NetBSD 4.0 returns positive values on success, but
    -    NetBSD Current and FreeBSD return zero. OpenBSD's
    -    man page doesn't tell what sysctl() returns on
    -    success. All these BSDs return -1 on error.
    -    
    -    Thanks to Robert Elz and Thomas Klausner.
    -
    - src/common/cpucores.h | 2 +-
    - src/common/physmem.h  | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 173368911cf09ab0b03fc4db8f3d4b81d86dce32
    -Author: Lasse Collin 
    -Date:   2009-09-02 09:43:51 +0300
    -
    -    Mention in INSTALL that --enable-small doesn't modify CFLAGS.
    -
    - INSTALL | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 319a0fd7d7e9ebbb71ca6930abfc20777cb4aacc
    -Author: Lasse Collin 
    -Date:   2009-09-01 20:40:01 +0300
    -
    -    Refactored option parsing.
    -
    - src/xz/options.c | 70 ++++++++++++++++++++++++++++----------------------------
    - 1 file changed, 35 insertions(+), 35 deletions(-)
    -
    -commit 25adaaa56e2e51a47a910a8d73452414619a2e53
    -Author: Lasse Collin 
    -Date:   2009-09-01 20:23:30 +0300
    -
    -    Fix options parsing bug in xz.
    -    
    -    xz used to reject "xz --lzma2=pb=2," while
    -    "xz --lzma2=pb=2,," worked. Now both work.
    -
    - src/xz/options.c | 6 ++----
    - 1 file changed, 2 insertions(+), 4 deletions(-)
    -
    -commit 5f6dddc6c911df02ba660564e78e6de80947c947
    -Author: Lasse Collin 
    -Date:   2009-09-01 20:20:19 +0300
    -
    -    Updated TODO.
    -
    - TODO | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 655457b9ada5ec7db398c5392e41290f3f332ea8
    -Author: Lasse Collin 
    -Date:   2009-08-31 21:59:25 +0300
    -
    -    Revert 43f44160b1ddcbf7e5205c37db09b3bebe7226f9
    -    and use a fix that works on all systems using
    -    GNU assembler.
    -    
    -    Maybe the assembler code is used e.g. on Solaris x86
    -    but let's worry about it if this doesn't work on it.
    -
    - src/liblzma/check/crc32_x86.S | 7 ++-----
    - src/liblzma/check/crc64_x86.S | 7 ++-----
    - 2 files changed, 4 insertions(+), 10 deletions(-)
    -
    -commit 162189c3477953805a28f96d3a75cb9ab9417928
    -Author: Lasse Collin 
    -Date:   2009-08-30 17:29:19 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 2331f5f97af3e5897e23da45d9df3d664099c7f8
    -Author: Lasse Collin 
    -Date:   2009-08-30 17:28:52 +0300
    -
    -    Add more OS/2 specific info to INSTALL.
    -
    - INSTALL | 5 +++++
    - 1 file changed, 5 insertions(+)
    -
    -commit 94c66b3297b3ad307eee93cf6b160e3c43997f11
    -Author: Lasse Collin 
    -Date:   2009-08-29 14:43:52 +0300
    -
    -    Use even more hackish way to support thousand separators.
    -    
    -    Seems that in addition on Windows and DOS, also OpenBSD
    -    lacks support for %'d style printf() format strings.
    -    So far that is the only modern POSIX-like system I know
    -    with this problem, but after this hack, the thousand
    -    separator shouldn't be a problem on any system.
    -    
    -    Maybe testing if a format string like %'d produces
    -    reasonable output is invoking undefined behavior on some
    -    systems, but so far all the problematic systems I've tried
    -    just print the raw format string (e.g. %'d prints 'd).
    -    
    -    Maybe Autoconf test would have been better, but this
    -    hack works also for cross-compilation, and avoids
    -    recompilation in case the system libc starts to support
    -    the thousand separator.
    -
    - src/xz/util.c | 36 +++++++++++++++++++++++++-----------
    - 1 file changed, 25 insertions(+), 11 deletions(-)
    -
    -commit 3432e9c6aab851da1227b63dce645d7f190c04d8
    -Author: Lasse Collin 
    -Date:   2009-08-29 13:42:56 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 27414daadf5727e8ab942374b5ec1c8990122878
    -Author: Lasse Collin 
    -Date:   2009-08-29 13:39:21 +0300
    -
    -    Fix sysctl() usage.
    -    
    -    This fixes build on *BSDs and Darwin.
    -    
    -    Thanks to Jukka Salmi for the patches.
    -    Richard Koch reported the problem too.
    -
    - m4/lc_cpucores.m4     | 2 +-
    - m4/lc_physmem.m4      | 2 +-
    - src/common/cpucores.h | 2 +-
    - src/common/physmem.h  | 2 +-
    - 4 files changed, 4 insertions(+), 4 deletions(-)
    -
    -commit 43f44160b1ddcbf7e5205c37db09b3bebe7226f9
    -Author: Lasse Collin 
    -Date:   2009-08-29 13:35:23 +0300
    -
    -    Fix x86 assembler on GCC 3.
    -    
    -    Thanks to Karl Berry.
    -
    - src/liblzma/check/crc32_x86.S | 7 +++++--
    - src/liblzma/check/crc64_x86.S | 7 +++++--
    - 2 files changed, 10 insertions(+), 4 deletions(-)
    -
    -commit 682efdc1f9492fdd76c9ce82e7c00ca0768067e8
    -Author: Lasse Collin 
    -Date:   2009-08-27 18:36:59 +0300
    -
    -    "make dist" fixes
    -
    - Makefile.am | 13 ++++++-------
    - 1 file changed, 6 insertions(+), 7 deletions(-)
    -
    -commit c8c184db1c95bf70f78256ec6237845a57f342af
    -Author: Lasse Collin 
    -Date:   2009-08-27 17:08:33 +0300
    -
    -    Update xz man page date.
    -
    - src/xz/xz.1 | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 9756fce565e98b8fa5fe6ead296d84e7601ec254
    -Author: Lasse Collin 
    -Date:   2009-08-27 17:00:22 +0300
    -
    -    Fix the debug directory.
    -    
    -    6a2eb54092fc625d59921a607ff68cd1a90aa898 and
    -    71f18e8a066a01dda0c8e5508b135ef104e43e4c required
    -    some changes that weren't applied in debug.
    -
    - debug/Makefile.am   | 5 +++--
    - debug/full_flush.c  | 1 +
    - debug/known_sizes.c | 1 +
    - debug/memusage.c    | 1 +
    - debug/sync_flush.c  | 1 +
    - 5 files changed, 7 insertions(+), 2 deletions(-)
    -
    -commit 77007a7fb20187fcf3d1dd9839c79ace2d63f2ea
    -Author: Lasse Collin 
    -Date:   2009-08-27 16:36:40 +0300
    -
    -    Add missing files to EXTRA_DIST.
    -
    - Makefile.am | 11 +++++++----
    - 1 file changed, 7 insertions(+), 4 deletions(-)
    -
    -commit 04dcbfdeb921e5f361a4487134e91e23fffbe09d
    -Author: Lasse Collin 
    -Date:   2009-08-27 16:21:22 +0300
    -
    -    Bumped version to 4.999.9beta.
    -
    - src/liblzma/api/lzma/version.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit fd7618611a22f42a6913bc8d518c9bbc9252d6b4
    -Author: Lasse Collin 
    -Date:   2009-08-27 16:17:47 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit c29e76c0f910fca0a90a50b78d337f6c32623e9d
    -Author: Lasse Collin 
    -Date:   2009-08-27 16:12:52 +0300
    -
    -    .xz file format specification 1.0.4 (probably).
    -    
    -    Thanks to Christian von Roques, Peter Lawler,
    -    and Jim Meyering for the fixes.
    -
    - doc/xz-file-format.txt | 26 +++++++++++++++-----------
    - 1 file changed, 15 insertions(+), 11 deletions(-)
    -
    -commit 696d7ee3953beaf4f0ed18e78917ccf300431966
    -Author: Lasse Collin 
    -Date:   2009-08-27 15:43:54 +0300
    -
    -    Require GNU libtool 2.2.
    -
    - configure.ac | 13 +++----------
    - 1 file changed, 3 insertions(+), 10 deletions(-)
    -
    -commit 4c3558aa8305a8f8b6c43b8569eb539717ca9e8d
    -Author: Lasse Collin 
    -Date:   2009-08-27 15:34:45 +0300
    -
    -    Add "dos" to EXTRA_DIST.
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 35b29e4424ced5a3ababf132283e519080c7b298
    -Author: Lasse Collin 
    -Date:   2009-08-27 15:23:27 +0300
    -
    -    Updated TODO.
    -
    - TODO | 6 ++++++
    - 1 file changed, 6 insertions(+)
    -
    -commit 23414377192c21f3f34c84cdfe0ef0fbd06a1dea
    -Author: Lasse Collin 
    -Date:   2009-08-27 15:17:00 +0300
    -
    -    Some xz man page improvements.
    -
    - src/xz/xz.1 | 78 ++++++++++++++++++++++++++++++++++++++++++++++++-------------
    - 1 file changed, 62 insertions(+), 16 deletions(-)
    -
    -commit 371b04e19fc9051dbaeec51ec0badec6a1f0699d
    -Author: Lasse Collin 
    -Date:   2009-08-27 10:41:01 +0300
    -
    -    Removed doc/bugs.txt.
    -
    - doc/bugs.txt | 46 ----------------------------------------------
    - 1 file changed, 46 deletions(-)
    -
    -commit d88c4072b36d3a76f839185799fb1d91037a1b81
    -Author: Lasse Collin 
    -Date:   2009-08-27 10:40:25 +0300
    -
    -    Updated README.
    -    
    -    It now includes bug reporting instructions/tips.
    -
    - README | 65 +++++++++++++++++++++++++++++++++++++++++++++++++++++++----------
    - 1 file changed, 55 insertions(+), 10 deletions(-)
    -
    -commit 92e536d8b8d33a6b12d0802bcd7be4437046f13e
    -Author: Lasse Collin 
    -Date:   2009-08-27 10:21:18 +0300
    -
    -    Fix a typo in FAQ.
    -    
    -    Thanks to Jim Meyering.
    -    
    -    (From now on, I try to always remember to put
    -    the relevant thanks to commit messages.)
    -
    - doc/faq.txt | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 3e2ba8b58585743e59251e69ad2783eb08357079
    -Author: Lasse Collin 
    -Date:   2009-08-27 10:13:46 +0300
    -
    -    Updates to liblzma API headers.
    -    
    -    Added lzma_nothrow for every function. It adds
    -    throw() when the header is used in C++ code.
    -    
    -    Some lzma_attrs were added or removed.
    -    
    -    Lots of comments were improved.
    -
    - src/liblzma/api/lzma.h              | 20 ++++++++
    - src/liblzma/api/lzma/base.h         | 48 +++++++++---------
    - src/liblzma/api/lzma/block.h        | 38 ++++++++-------
    - src/liblzma/api/lzma/check.h        | 22 +++++----
    - src/liblzma/api/lzma/container.h    | 36 ++++++++------
    - src/liblzma/api/lzma/filter.h       | 81 +++++++++++++++++++------------
    - src/liblzma/api/lzma/index.h        | 97 ++++++++++++++++++++++---------------
    - src/liblzma/api/lzma/index_hash.h   | 14 ++++--
    - src/liblzma/api/lzma/lzma.h         | 87 +++++++++++++++++----------------
    - src/liblzma/api/lzma/stream_flags.h | 12 ++---
    - src/liblzma/api/lzma/version.h      | 10 ++--
    - src/liblzma/api/lzma/vli.h          |  7 +--
    - 12 files changed, 275 insertions(+), 197 deletions(-)
    -
    -commit 8e8ebc17c535a1f8846718059b48417409c37050
    -Author: Lasse Collin 
    -Date:   2009-08-18 00:30:09 +0300
    -
    -    Install faq.txt.
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit b198e770a146e4a41f91a93f0b233713f2515848
    -Author: Lasse Collin 
    -Date:   2009-08-18 00:26:48 +0300
    -
    -    Updated faq.txt.
    -    
    -    Some questions worth answering were removed, because I
    -    currently don't have good up to date answers to them.
    -
    - doc/faq.txt | 239 +++++++++++++++++++-----------------------------------------
    - 1 file changed, 73 insertions(+), 166 deletions(-)
    -
    -commit fe111a25cd788d31b581996e4533910388a7f0a9
    -Author: Lasse Collin 
    -Date:   2009-08-17 22:45:50 +0300
    -
    -    Some xz man changes.
    -
    - src/xz/xz.1 | 88 ++++++++++++++++++++++++++++++-------------------------------
    - 1 file changed, 43 insertions(+), 45 deletions(-)
    -
    -commit 10242a21e9abda0c5c6a03501703cc40b8a699a5
    -Author: Lasse Collin 
    -Date:   2009-08-16 22:15:42 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 3ce1916c83041113b9cad9ead5c97a527cf8aa1d
    -Author: Lasse Collin 
    -Date:   2009-08-16 22:15:13 +0300
    -
    -    Fix data corruption in LZ/LZMA2 encoder.
    -    
    -    Thanks to Jonathan Stott for the bug report.
    -
    - src/liblzma/lz/lz_encoder.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 66da129c8ec33dd66acc92f113f7c1ca740ca81a
    -Author: Lasse Collin 
    -Date:   2009-08-13 15:15:37 +0300
    -
    -    Updated INSTALL and PACKAGERS to match the changes
    -    made in --enable-dynamic.
    -
    - INSTALL   | 20 ++++++++++++++++----
    - PACKAGERS | 11 ++++++-----
    - 2 files changed, 22 insertions(+), 9 deletions(-)
    -
    -commit 8238c4b2402f952c4e492e5b778aa272e57b6705
    -Author: Lasse Collin 
    -Date:   2009-08-13 15:03:46 +0300
    -
    -    Link lzmainfo against shared liblzma by default.
    -
    - src/lzmainfo/Makefile.am | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 71f18e8a066a01dda0c8e5508b135ef104e43e4c
    -Author: Lasse Collin 
    -Date:   2009-08-13 15:00:21 +0300
    -
    -    Make --enable-dynamic a tristate option.
    -    
    -    Some programs will by default be linked against static
    -    liblzma and some against shared liblzma. --enable-dynamic
    -    now allows overriding the default to both directions
    -    (all dynamic or all static) even when building both
    -    shared and static liblzma.
    -    
    -    This is quite messy compared to how simple thing it is supposed
    -    to be. The complexity is mostly due to Windows support.
    -
    - configure.ac | 77 ++++++++++++++++++++++++++++++++++++++++++++----------------
    - 1 file changed, 57 insertions(+), 20 deletions(-)
    -
    -commit 5aa4678b2342dcfc1d2b31aa9fa4f39c539e4b61
    -Author: Lasse Collin 
    -Date:   2009-08-13 12:56:47 +0300
    -
    -    Fix xz Makefile.am for the man page.
    -    
    -    install-exec-hook -> install-data-hook
    -
    - src/xz/Makefile.am | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit e51b4e49e800bd84e6d589dca2964d3985e88139
    -Author: Lasse Collin 
    -Date:   2009-08-13 12:55:45 +0300
    -
    -    Add lzmainfo for backward compatibility with LZMA Utils.
    -    
    -    lzmainfo now links against static liblzma. In contrast
    -    to other command line tools in XZ Utils, linking lzmainfo
    -    against static liblzma by default is dumb. This will be
    -    fixed once I have fixed some related issues in configure.ac.
    -
    - configure.ac             |   1 +
    - src/Makefile.am          |   2 +-
    - src/lzmainfo/Makefile.am |  29 ++++++
    - src/lzmainfo/lzmainfo.1  |  55 +++++++++++
    - src/lzmainfo/lzmainfo.c  | 242 +++++++++++++++++++++++++++++++++++++++++++++++
    - 5 files changed, 328 insertions(+), 1 deletion(-)
    -
    -commit a4165d0584376d948c213ec93c6065d24ff6a5e7
    -Author: Lasse Collin 
    -Date:   2009-08-13 12:42:36 +0300
    -
    -    Sync some error messages from xz to xzdec.
    -    
    -    Make xz error message translation usable outside
    -    xz (at least in upcoming lzmainfo).
    -
    - src/xz/main.c     | 4 ++--
    - src/xzdec/xzdec.c | 6 +++---
    - 2 files changed, 5 insertions(+), 5 deletions(-)
    -
    -commit df636eb4e066b4e154ce8e66e82c87ba1db652a6
    -Author: Lasse Collin 
    -Date:   2009-08-13 09:37:21 +0300
    -
    -    Add xz man page to manfiles in toplevel Makefile.am.
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 180bdf58ea5bb07941e0a99b304d9aa832198748
    -Author: Lasse Collin 
    -Date:   2009-08-13 09:37:01 +0300
    -
    -    Fix first line of xz man page.
    -
    - src/xz/xz.1 | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit e1ce2291e759b50ebfcf7cbbcc04cd098f1705a4
    -Author: Lasse Collin 
    -Date:   2009-08-10 11:22:31 +0300
    -
    -    Added a rough version of the xz man page.
    -
    - src/xz/Makefile.am |   15 +
    - src/xz/xz.1        | 1206 ++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 1221 insertions(+)
    -
    -commit e71903fc6101f1c039d702e335b08aad1e1b4100
    -Author: Jonathan Nieder 
    -Date:   2009-08-09 13:41:20 -0500
    -
    -    “xzdiff a.xz b.xz†always fails
    -    
    -    Attempts to compare two compressed files result in no output and
    -    exit status 2.
    -    
    -    Instead of going to standard output, ‘diff’ output is being
    -    captured in the xz_status variable along with the exit status from
    -    the decompression commands.  Later, when this variable is examined
    -    for nonzero status codes, numerals from dates in the ‘diff’ output
    -    make it appear as though decompression failed.
    -    
    -    So let the ‘diff’ output leak to standard output with another file
    -    descriptor.  (This trick is used in all similar contexts elsewhere
    -    in xzdiff and in the analogous context in gzip’s zdiff script.)
    -
    - src/scripts/xzdiff.in | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 1d314b81aa5b0c4530638ffabd4e0edb52e5362c
    -Author: Jonathan Nieder 
    -Date:   2009-08-09 13:22:12 -0500
    -
    -    xzless: Support compressed standard input
    -    
    -    It can be somewhat confusing that
    -    
    -    	less < some_file.txt
    -    
    -    works fine, whereas
    -    
    -    	xzless < some_file.txt.xz
    -    
    -    does not.  Since version 429, ‘less’ allows a filter specified in
    -    the LESSOPEN environment variable to preprocess its input even if
    -    it comes from standard input, if $LESSOPEN begins with ‘|-’.  So
    -    set $LESSOPEN to take advantage of this feature.
    -    
    -    Check less’s version at runtime so xzless can continue to work
    -    with older versions.
    -
    - src/scripts/xzless.in | 8 +++++++-
    - 1 file changed, 7 insertions(+), 1 deletion(-)
    -
    -commit a7f5d2fe4826ac68839d00059f05004fb81d5c69
    -Author: Lasse Collin 
    -Date:   2009-08-09 20:57:46 +0300
    -
    -    GPLv2+ not GPLv2 for Doxyfile.in is probably OK.
    -
    - Doxyfile.in | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit b735cde20cc14857136ae65a0e5d336ed7ddc862
    -Author: Lasse Collin 
    -Date:   2009-08-02 00:27:29 +0300
    -
    -    Added a copyright notice to Doxyfile.in since it contains
    -    lots of comments from Doxygen.
    -    
    -    It seems that the Doxygen authors' intent is to not apply
    -    their copyright on generated files, but since it doesn't
    -    matter for XZ Utils at all, better safe than sorry.
    -
    - Doxyfile.in | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 0fd157cc008446adfc8f91394f5503868025a642
    -Author: Lasse Collin 
    -Date:   2009-08-02 00:11:37 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit b198da96ff9ac8c89b466b4d196c5f3fe1c7904f
    -Author: Lasse Collin 
    -Date:   2009-08-02 00:10:22 +0300
    -
    -    Updated TODO.
    -
    - TODO | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 669413bb2db954bbfde3c4542fddbbab53891eb4
    -Author: Lasse Collin 
    -Date:   2009-07-30 12:25:55 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit dbbd8fb870ae789d96497911006c869d37148c15
    -Author: Jonathan Nieder 
    -Date:   2009-07-28 17:37:24 -0500
    -
    -    xzdiff: add missing ;; to case statement
    -
    - src/scripts/xzdiff.in | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit adbad2d16cb5909f85d4a429011005613ea62ffe
    -Author: Lasse Collin 
    -Date:   2009-07-24 13:15:06 +0300
    -
    -    Added history.txt to doc_DATA.
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit e0236f12569eb36f9b81ce7a1e52e0f73698ac27
    -Author: Lasse Collin 
    -Date:   2009-07-24 12:00:40 +0300
    -
    -    Updated .gitignore files.
    -
    - .gitignore    | 36 +++++++++++++++++++-----------------
    - po/.gitignore |  3 +++
    - 2 files changed, 22 insertions(+), 17 deletions(-)
    -
    -commit 2f34fb269265e3aba43a2a9c734020a45268826d
    -Author: Lasse Collin 
    -Date:   2009-07-24 11:34:02 +0300
    -
    -    Minor improvements to COPYING.
    -
    - COPYING | 11 ++++++++---
    - 1 file changed, 8 insertions(+), 3 deletions(-)
    -
    -commit 0db1befcfbc120377df4b89923762f16d25f548a
    -Author: Lasse Collin 
    -Date:   2009-07-23 19:10:55 +0300
    -
    -    Fix incorrect usage of getopt_long(), which caused
    -    invalid memory access if XZ_OPT was defined.
    -
    - src/xz/args.c | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit 8f8ec942d6d21ada2096eaf063411bc8bc7e2d48
    -Author: Lasse Collin 
    -Date:   2009-07-20 15:43:32 +0300
    -
    -    Avoid internal error with --format=xz --lzma1.
    -
    - src/xz/coder.c | 16 ++++++++++++----
    - 1 file changed, 12 insertions(+), 4 deletions(-)
    -
    -commit 99f9e879a6a8bb54a65da99c12e0f390216c152a
    -Author: Lasse Collin 
    -Date:   2009-07-19 13:14:20 +0300
    -
    -    Major documentation update.
    -    
    -    Installation and packaging instructions were added.
    -    README and other generic docs were revised.
    -    
    -    Some of the documentation files are now installed to $docdir.
    -
    - AUTHORS         |  35 +++---
    - ChangeLog       |   7 +-
    - INSTALL         | 327 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - INSTALL.generic | 302 +++++++++++++++++++++++++++++++++++++++++++++++++++
    - Makefile.am     |  11 ++
    - PACKAGERS       | 278 +++++++++++++++++++++++++++++++++++++++++++++++
    - README          | 263 ++++++++++++++++++++-------------------------
    - THANKS          |  17 +--
    - 8 files changed, 1070 insertions(+), 170 deletions(-)
    -
    -commit ef4cf1851de89022cba5674784f1a8f6343c15b0
    -Author: Lasse Collin 
    -Date:   2009-07-19 11:09:31 +0300
    -
    -    Added missing author notice to xzless.in.
    -
    - src/scripts/xzless.in | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 4c9c989d45b188667799a7a1d6c728ed43f7bf77
    -Author: Lasse Collin 
    -Date:   2009-07-18 18:54:55 +0300
    -
    -    Use AC_CONFIG_AUX_DIR to clean up the toplevel directory
    -    a little.
    -    
    -    Fixed a related bug in the toplevel Makefile.am.
    -    
    -    Added the build-aux directory to .gitignore.
    -
    - .gitignore   | 1 +
    - Makefile.am  | 1 -
    - configure.ac | 3 ++-
    - 3 files changed, 3 insertions(+), 2 deletions(-)
    -
    -commit 366e436090a7a87215e9bf0e3ddcd55f05b50587
    -Author: Lasse Collin 
    -Date:   2009-07-18 14:34:08 +0300
    -
    -    Updated the totally outdated TODO file.
    -
    - TODO | 117 ++++++++++++++++---------------------------------------------------
    - 1 file changed, 27 insertions(+), 90 deletions(-)
    -
    -commit 64e498c89d8b9966e8663f43bf64d47c26c55c62
    -Author: Lasse Collin 
    -Date:   2009-07-18 11:26:39 +0300
    -
    -    Added public domain notice into a few files.
    -
    - src/common/common_w32res.rc   | 9 ++++++++-
    - src/liblzma/liblzma.pc.in     | 7 +++++++
    - src/liblzma/liblzma_w32res.rc | 7 +++++++
    - src/xz/xz_w32res.rc           | 7 +++++++
    - src/xzdec/xzdec_w32res.rc     | 7 +++++++
    - 5 files changed, 36 insertions(+), 1 deletion(-)
    -
    -commit a35755c5de808df027675688855d1b621a4fb428
    -Author: Lasse Collin 
    -Date:   2009-07-14 21:10:36 +0300
    -
    -    Allow extra commas in filter-specific options on xz command line.
    -    
    -    This may slightly ease writing scripts that construct
    -    filter-specific option strings dynamically.
    -
    - src/xz/options.c | 7 +++++++
    - 1 file changed, 7 insertions(+)
    -
    -commit 98f3cac1ad31191c5160a7e48398bf85141e941c
    -Author: Lasse Collin 
    -Date:   2009-07-14 18:04:31 +0300
    -
    -    Accept --lzma2=preset=6e where "e" is equivalent to --extreme
    -    when no custom chain is in use.
    -
    - src/xz/options.c | 80 +++++++++++++++++++++++++++++++++++++++++---------------
    - 1 file changed, 59 insertions(+), 21 deletions(-)
    -
    -commit d873a09e956363e54bf58c577c8f7e487b6fb464
    -Author: Lasse Collin 
    -Date:   2009-07-12 19:08:30 +0300
    -
    -    Add dist-hook to create ChangeLog from the commit log,
    -    and to conver the man pages to PDF and plain text, which
    -    may be convenient to those who cannot render man pages.
    -
    - Makefile.am | 31 +++++++++++++++++++++++++++++++
    - 1 file changed, 31 insertions(+)
    -
    -commit cd69a5a6c16c289f6f8e2823b03c72289472270f
    -Author: Lasse Collin 
    -Date:   2009-07-10 11:39:38 +0300
    -
    -    BCJ filters: Reject invalid start offsets with LZMA_OPTIONS_ERROR.
    -    
    -    This is a quick and slightly dirty fix to make the code
    -    conform to the latest file format specification. Without
    -    this patch, it's possible to make corrupt files by
    -    specifying start offset that is not a multiple of the
    -    filter's alignment. Custom start offset is almost never
    -    used, so this was only a minor bug.
    -    
    -    The xz command line tool doesn't validate the start offset,
    -    so one will get a bit unclear error message if trying to use
    -    an invalid start offset.
    -
    - src/liblzma/simple/arm.c            | 2 +-
    - src/liblzma/simple/armthumb.c       | 2 +-
    - src/liblzma/simple/ia64.c           | 2 +-
    - src/liblzma/simple/powerpc.c        | 2 +-
    - src/liblzma/simple/simple_coder.c   | 5 ++++-
    - src/liblzma/simple/simple_private.h | 3 ++-
    - src/liblzma/simple/sparc.c          | 2 +-
    - src/liblzma/simple/x86.c            | 2 +-
    - 8 files changed, 12 insertions(+), 8 deletions(-)
    -
    -commit eed9953732b801f6c97317fb3160445a8754180b
    -Author: Lasse Collin 
    -Date:   2009-07-10 11:33:21 +0300
    -
    -    Look for full command names instead of substrings
    -    like "un", "cat", and "lz" when determining if
    -    xz is run as unxz, xzcat, lzma, unlzma, or lzcat.
    -    
    -    This is to ensure that if xz is renamed (e.g. via
    -    --program-transform-name), it doesn't so easily
    -    work in wrong mode.
    -
    - src/xz/args.c | 22 +++++++++++++---------
    - 1 file changed, 13 insertions(+), 9 deletions(-)
    -
    -commit 6f62fa88f4ff7ba78565c314c0e6e71c498fa658
    -Author: Lasse Collin 
    -Date:   2009-07-08 23:06:46 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 1754b7e03e2aa7e2e0196807fe8b0f3f5a637b0e
    -Author: Lasse Collin 
    -Date:   2009-07-08 23:05:29 +0300
    -
    -    Portability improvement to version.sh.
    -
    - version.sh | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit 3bdb53792c0e3e3febe9370e56eda5b08f89410f
    -Author: Lasse Collin 
    -Date:   2009-07-08 22:50:16 +0300
    -
    -    Remove --force from xzdec.
    -    
    -    It was ignored for compatibility with xz, but now that
    -    --decompress --stdout --force copies unrecognized files
    -    as is to stdout, simply ignoring --force in xzdec would
    -    be wrong. xzdec will not support copying unrecognized
    -    data as is to stdout, so it cannot support --force.
    -
    - src/xzdec/xzdec.1 | 5 -----
    - src/xzdec/xzdec.c | 5 +----
    - 2 files changed, 1 insertion(+), 9 deletions(-)
    -
    -commit 5f16ef4abf220028a9ddbcb138217597a9455f62
    -Author: Lasse Collin 
    -Date:   2009-07-06 10:36:04 +0300
    -
    -    Use sed instead of $(SED) so that we don't need to
    -    use AC_PROG_SED. We don't do anything fancy with sed,
    -    so this should work OK. libtool 2.2 sets SED but 1.5
    -    doesn't, so $(SED) happened to work when using libtool 2.2.
    -
    - src/liblzma/Makefile.am |  2 +-
    - src/scripts/Makefile.am | 28 ++++++++++++++--------------
    - src/xz/Makefile.am      |  6 +++---
    - src/xzdec/Makefile.am   |  6 +++---
    - 4 files changed, 21 insertions(+), 21 deletions(-)
    -
    -commit 96e4b257e101d72072d43e144897d92920270669
    -Author: Lasse Collin 
    -Date:   2009-07-05 22:25:17 +0300
    -
    -    Major update to the xzgrep and other scripts based on
    -    the latest versions found from gzip CVS repository.
    -    
    -    configure will try to find a POSIX shell to be used by
    -    the scripts. This should ease portability on systems
    -    which have pre-POSIX /bin/sh.
    -    
    -    xzgrep and xzdiff support .xz, .lzma, .gz, and .bz2 files.
    -    xzmore and xzless support only .xz and .lzma files.
    -    
    -    The name of the xz executable used in these scripts is
    -    now correct even if --program-transform-name has been used.
    -
    - configure.ac            |  14 ++++
    - m4/posix-shell.m4       |  63 ++++++++++++++++
    - src/scripts/Makefile.am |  24 +++---
    - src/scripts/xzdiff      |  67 -----------------
    - src/scripts/xzdiff.1    |  58 ++++++++------
    - src/scripts/xzdiff.in   | 172 ++++++++++++++++++++++++++++++++++++++++++
    - src/scripts/xzgrep      | 123 ------------------------------
    - src/scripts/xzgrep.1    |  85 ++++++++++++---------
    - src/scripts/xzgrep.in   | 196 ++++++++++++++++++++++++++++++++++++++++++++++++
    - src/scripts/xzless.1    |  66 ++++++++++++++++
    - src/scripts/xzless.in   |  51 +++++++++++++
    - src/scripts/xzmore      |  74 ------------------
    - src/scripts/xzmore.1    |  64 +++++++---------
    - src/scripts/xzmore.in   |  78 +++++++++++++++++++
    - 14 files changed, 766 insertions(+), 369 deletions(-)
    -
    -commit 25cc7a6e8c2506a0d80084a4c1c67d33e7439100
    -Author: Lasse Collin 
    -Date:   2009-07-05 19:26:53 +0300
    -
    -    Use @PACKAGE_HOMEPAGE@ in liblzma.pc.in.
    -
    - src/liblzma/liblzma.pc.in | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 18c10c30d2833f394cd7bce0e6a821044b15832f
    -Author: Lasse Collin 
    -Date:   2009-07-04 00:40:44 +0300
    -
    -    Make "xz --decompress --stdout --force" copy unrecognized
    -    files as is to standard output.
    -    
    -    This feature is needed to be more compatible with gzip's
    -    behavior. This was more complicated to implement than it
    -    sounds, because the way liblzma is able to return errors with
    -    files of only a few bytes in size. xz now has its own file
    -    type detection code and no longer uses lzma_auto_decoder().
    -
    - src/xz/coder.c | 213 +++++++++++++++++++++++++++++++++++++++++++++++----------
    - 1 file changed, 178 insertions(+), 35 deletions(-)
    -
    -commit 0a289c01ac821ea9c4250aa906b0ae3cfa953633
    -Author: Lasse Collin 
    -Date:   2009-07-02 14:30:38 +0300
    -
    -    Define PACKAGE_HOMEPAGE in configure.ac and use it in
    -    xz and xzdec.
    -    
    -    Use also PACKAGE_NAME instead of hardcoding "XZ Utils".
    -
    - configure.ac      | 5 +++++
    - src/xz/message.c  | 4 ++--
    - src/xzdec/xzdec.c | 4 ++--
    - 3 files changed, 9 insertions(+), 4 deletions(-)
    -
    -commit 5cc99db5bae8633f85559e5cdaef4cd905a4ee9c
    -Author: Lasse Collin 
    -Date:   2009-07-01 12:21:24 +0300
    -
    -    Avoid visibility related compiler warnings on Windows.
    -
    - configure.ac | 20 +++++++++-----------
    - 1 file changed, 9 insertions(+), 11 deletions(-)
    -
    -commit 7653d1cf48080e63b189ed9d58dea0e82b6b1c5e
    -Author: Lasse Collin 
    -Date:   2009-06-30 17:14:39 +0300
    -
    -    Use static liblzma by default also for tests.
    -
    - tests/Makefile.am | 5 ++++-
    - 1 file changed, 4 insertions(+), 1 deletion(-)
    -
    -commit f42ee981668b545ab6d06c6072e262c29605273c
    -Author: Lasse Collin 
    -Date:   2009-06-30 17:09:57 +0300
    -
    -    Build system fixes
    -    
    -    Don't use libtool convenience libraries to avoid recently
    -    discovered long-standing subtle but somewhat severe bugs
    -    in libtool (at least 1.5.22 and 2.2.6 are affected). It
    -    was found when porting XZ Utils to Windows
    -    
    -    but the problem is significant also e.g. on GNU/Linux.
    -    
    -    Unless --disable-shared is passed to configure, static
    -    library built from a set of convenience libraries will
    -    contain PIC objects. That is, while libtool builds non-PIC
    -    objects too, only PIC objects will be used from the
    -    convenience libraries. On 32-bit x86 (tested on mobile XP2400+),
    -    using PIC instead of non-PIC makes the decompressor 10 % slower
    -    with the default CFLAGS.
    -    
    -    So while xz was linked against static liblzma by default,
    -    it got the slower PIC objects unless --disable-shared was
    -    used. I tend develop and benchmark with --disable-shared
    -    due to faster build time, so I hadn't noticed the problem
    -    in benchmarks earlier.
    -    
    -    This commit also adds support for building Windows resources
    -    into liblzma and executables.
    -
    - configure.ac                        | 34 ++++++++++------
    - src/liblzma/Makefile.am             | 79 +++++++++++++++++++++++++++++--------
    - src/liblzma/check/Makefile.am       | 47 ----------------------
    - src/liblzma/check/Makefile.inc      | 51 ++++++++++++++++++++++++
    - src/liblzma/common/Makefile.am      | 78 ------------------------------------
    - src/liblzma/common/Makefile.inc     | 67 +++++++++++++++++++++++++++++++
    - src/liblzma/common/common.h         | 16 +++++---
    - src/liblzma/delta/Makefile.am       | 28 -------------
    - src/liblzma/delta/Makefile.inc      | 23 +++++++++++
    - src/liblzma/lz/Makefile.am          | 29 --------------
    - src/liblzma/lz/Makefile.inc         | 21 ++++++++++
    - src/liblzma/lzma/Makefile.am        | 51 ------------------------
    - src/liblzma/lzma/Makefile.inc       | 43 ++++++++++++++++++++
    - src/liblzma/rangecoder/Makefile.am  | 26 ------------
    - src/liblzma/rangecoder/Makefile.inc | 21 ++++++++++
    - src/liblzma/simple/Makefile.am      | 51 ------------------------
    - src/liblzma/simple/Makefile.inc     | 47 ++++++++++++++++++++++
    - src/liblzma/subblock/Makefile.am    | 26 ------------
    - src/liblzma/subblock/Makefile.inc   | 20 ++++++++++
    - src/xz/Makefile.am                  | 11 +++++-
    - src/xzdec/Makefile.am               | 20 +++++++++-
    - 21 files changed, 417 insertions(+), 372 deletions(-)
    -
    -commit 89dac1db6f168d7469cfbc4432651d4724c5c0de
    -Author: Lasse Collin 
    -Date:   2009-06-29 22:19:51 +0300
    -
    -    Added a comment about "autoconf -fi" to autogen.sh.
    -
    - autogen.sh | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 6e685aae4594bc0af1b5032e01bb37d0edaa3ebd
    -Author: Lasse Collin 
    -Date:   2009-06-28 10:04:24 +0300
    -
    -    Add -no-undefined to get shared liblzma on Windows.
    -
    - src/liblzma/Makefile.am | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 73f560ee5fa064992b76688d9472baf139432540
    -Author: Lasse Collin 
    -Date:   2009-06-27 22:57:15 +0300
    -
    -    Make physmem() work on Cygwin 1.5 and older.
    -
    - src/common/physmem.h | 77 +++++++++++++++++++++++++++-------------------------
    - 1 file changed, 40 insertions(+), 37 deletions(-)
    -
    -commit 7ff0004fbce24ae72eddfe392828ffd7d4639ed1
    -Author: Lasse Collin 
    -Date:   2009-06-27 17:28:01 +0300
    -
    -    Moved the Windows resource files outside the windows directory
    -    to prepare for building them with Autotools.
    -
    - src/common/common_w32res.rc   | 46 +++++++++++++++++++++++++++++++++++++++++++
    - src/liblzma/liblzma_w32res.rc |  5 +++++
    - src/xz/xz_w32res.rc           |  5 +++++
    - src/xzdec/lzmadec_w32res.rc   |  5 +++++
    - src/xzdec/xzdec_w32res.rc     |  5 +++++
    - windows/Makefile              | 35 +++++++++++++++++---------------
    - windows/common.rc             | 46 -------------------------------------------
    - windows/liblzma.rc            |  5 -----
    - windows/lzmadec.rc            |  5 -----
    - windows/xz.rc                 |  5 -----
    - windows/xzdec.rc              |  5 -----
    - 11 files changed, 85 insertions(+), 82 deletions(-)
    -
    -commit 449c634674f35336a4815d398172e447659a135e
    -Author: Lasse Collin 
    -Date:   2009-06-27 13:05:03 +0300
    -
    -    Added missing $(EXEEXT).
    -
    - src/xz/Makefile.am | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 792db79f27ad9ab1fb977e23be65c7761f545752
    -Author: Lasse Collin 
    -Date:   2009-06-27 12:32:40 +0300
    -
    -    Create correct symlinks even when
    -    --program-{prefix,suffix,transform} is passed to configure.
    -
    - src/scripts/Makefile.am | 80 ++++++++++++++++++++++++++++---------------------
    - src/xz/Makefile.am      | 21 ++++++++-----
    - src/xzdec/Makefile.am   |  9 ++++--
    - 3 files changed, 65 insertions(+), 45 deletions(-)
    -
    -commit 0adc72feb84f5b903f6ad9d3f759b1c326fafc6b
    -Author: Lasse Collin 
    -Date:   2009-06-27 10:02:24 +0300
    -
    -    Silence a compiler warning on DOS-like systems.
    -
    - src/xz/file_io.c | 5 ++++-
    - 1 file changed, 4 insertions(+), 1 deletion(-)
    -
    -commit ad12edc95254ede3f0cb8dec8645e8789e984c4f
    -Author: Lasse Collin 
    -Date:   2009-06-27 09:35:15 +0300
    -
    -    Updated the filenames in POTFILES.in too.
    -
    - po/POTFILES.in | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit b2b1f867532732fe9969131f8713bdd6b0731763
    -Author: Lasse Collin 
    -Date:   2009-06-27 00:43:06 +0300
    -
    -    Hopefully improved portability of the assembler code in
    -    Autotools based builds on Windows.
    -
    - src/liblzma/check/crc32_x86.S | 8 +++++++-
    - src/liblzma/check/crc64_x86.S | 8 +++++++-
    - 2 files changed, 14 insertions(+), 2 deletions(-)
    -
    -commit c393055947247627a09b6a6b8f20aa0c32f9be16
    -Author: Lasse Collin 
    -Date:   2009-06-26 21:17:29 +0300
    -
    -    Updated THANKS (most of today's commits are based on
    -    Charles Wilson's patches).
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit da0af22e4b4139b8a10710945f8b245b3a77c97d
    -Author: Lasse Collin 
    -Date:   2009-06-26 21:00:35 +0300
    -
    -    Updated comments to match renamed files.
    -
    - src/xz/coder.c   | 2 +-
    - src/xz/coder.h   | 2 +-
    - src/xz/file_io.c | 2 +-
    - src/xz/file_io.h | 2 +-
    - 4 files changed, 4 insertions(+), 4 deletions(-)
    -
    -commit 65014fd211dfbd4be48685998cb5a12aaa29c8d2
    -Author: Lasse Collin 
    -Date:   2009-06-26 20:49:54 +0300
    -
    -    Rename process.[hc] to coder.[hc] and io.[hc] to file_io.[hc]
    -    to avoid problems on systems with system headers with those
    -    names.
    -
    - dos/Makefile       |   4 +-
    - src/xz/Makefile.am |   8 +-
    - src/xz/coder.c     | 488 ++++++++++++++++++++++++++++++++++++
    - src/xz/coder.h     |  57 +++++
    - src/xz/file_io.c   | 716 +++++++++++++++++++++++++++++++++++++++++++++++++++++
    - src/xz/file_io.h   |  86 +++++++
    - src/xz/io.c        | 716 -----------------------------------------------------
    - src/xz/io.h        |  86 -------
    - src/xz/private.h   |   4 +-
    - src/xz/process.c   | 488 ------------------------------------
    - src/xz/process.h   |  57 -----
    - windows/Makefile   |   4 +-
    - 12 files changed, 1357 insertions(+), 1357 deletions(-)
    -
    -commit 5e1257466dcb66f1d7a3f71814a5ad885cba43e8
    -Author: Lasse Collin 
    -Date:   2009-06-26 20:43:36 +0300
    -
    -    Rename process_file() to coder_run().
    -
    - src/xz/main.c    | 6 +++---
    - src/xz/process.c | 6 +++---
    - src/xz/process.h | 5 ++---
    - 3 files changed, 8 insertions(+), 9 deletions(-)
    -
    -commit cad62551c5fa9865dbe0841a0b3bc729c4fbe8fc
    -Author: Lasse Collin 
    -Date:   2009-06-26 20:36:45 +0300
    -
    -    Ugly hack to make it possible to use the thousand separator
    -    format character with snprintf() on POSIX systems but not
    -    on non-POSIX systems and still keep xgettext working.
    -
    - dos/Makefile     | 16 +++-------------
    - src/xz/message.c | 17 +++++++++--------
    - src/xz/process.c | 30 +++++++++++++++---------------
    - src/xz/util.c    | 34 ++++++++++++++++++++++++++++++++++
    - src/xz/util.h    | 20 ++++++++++++++++++++
    - windows/Makefile | 13 +++----------
    - 6 files changed, 84 insertions(+), 46 deletions(-)
    -
    -commit fe378d47074b16c52b00fe184d119287c68ce2e7
    -Author: Lasse Collin 
    -Date:   2009-06-26 15:40:40 +0300
    -
    -    Added missing source files to windows/Makefile.
    -
    - windows/Makefile | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 390a6408563067613b29de895cb40e4d0386d62c
    -Author: Lasse Collin 
    -Date:   2009-06-26 15:37:53 +0300
    -
    -    Basic support for building with Cygwin and MinGW using
    -    the Autotools based build system. It's not good yet, more
    -    fixes will follow.
    -
    - configure.ac                  |  7 +++++++
    - src/liblzma/api/lzma.h        |  7 +++++--
    - src/liblzma/check/crc32_x86.S |  7 ++++---
    - src/liblzma/check/crc64_x86.S |  7 ++++---
    - src/liblzma/common/common.h   |  2 +-
    - windows/Makefile              | 16 +++++++---------
    - 6 files changed, 28 insertions(+), 18 deletions(-)
    -
    -commit 1c9360b7d1197457aaad2f8888b99f1149861579
    -Author: Lasse Collin 
    -Date:   2009-06-26 14:47:31 +0300
    -
    -    Fix @variables@ to $(variables) in Makefile.am files.
    -    Fix the ordering of libgnu.a and LTLIBINTL on the linker
    -    command line and added missing LTLIBINTL to tests/Makefile.am.
    -
    - debug/Makefile.am                  | 12 ++++++------
    - src/liblzma/check/Makefile.am      |  4 ++--
    - src/liblzma/common/Makefile.am     | 16 ++++++++--------
    - src/liblzma/delta/Makefile.am      |  4 ++--
    - src/liblzma/lz/Makefile.am         |  6 +++---
    - src/liblzma/lzma/Makefile.am       |  8 ++++----
    - src/liblzma/rangecoder/Makefile.am |  4 ++--
    - src/liblzma/simple/Makefile.am     |  4 ++--
    - src/liblzma/subblock/Makefile.am   |  4 ++--
    - src/xz/Makefile.am                 | 21 +++++++++++----------
    - src/xzdec/Makefile.am              | 19 ++++++++++---------
    - tests/Makefile.am                  | 12 +++++++-----
    - 12 files changed, 59 insertions(+), 55 deletions(-)
    -
    -commit d45615c555e250209ebb55aa3649abe790f1eeac
    -Author: Lasse Collin 
    -Date:   2009-06-26 14:20:02 +0300
    -
    -    Allow to explicitly specify autotool versions in autogen.sh.
    -
    - autogen.sh | 12 ++++++------
    - 1 file changed, 6 insertions(+), 6 deletions(-)
    -
    -commit eaf8367368a329afa48785380f9dca6b681f3397
    -Author: Lasse Collin 
    -Date:   2009-06-26 14:18:32 +0300
    -
    -    Add version.sh to EXTRA_DIST.
    -
    - Makefile.am | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit b317b218e2d383dd27a700094c0de4510540ea18
    -Author: Lasse Collin 
    -Date:   2009-06-24 20:14:10 +0300
    -
    -    Support HW_PHYSMEM64
    -
    - src/common/physmem.h | 30 +++++++++++++++++++-----------
    - 1 file changed, 19 insertions(+), 11 deletions(-)
    -
    -commit ae82dde5d9cc60c80cc89601b6c51cc1611d48e7
    -Author: Lasse Collin 
    -Date:   2009-06-24 13:01:59 +0300
    -
    -    Cast a char argument to isspace() to unsigned char.
    -
    - src/xz/args.c | 11 +++++++++--
    - 1 file changed, 9 insertions(+), 2 deletions(-)
    -
    -commit 1735d31ea347210e914df038eeea4b2626e76e42
    -Author: Lasse Collin 
    -Date:   2009-06-05 13:46:26 +0300
    -
    -    A few more spelling fixes. Released the .xz spec 1.0.3.
    -
    - doc/xz-file-format.txt | 12 +++++++-----
    - 1 file changed, 7 insertions(+), 5 deletions(-)
    -
    -commit 8ed156ce894966103e895aa08f2a9fb912f6fad5
    -Author: Lasse Collin 
    -Date:   2009-06-04 23:42:12 +0300
    -
    -    Added xzdec man page.
    -
    - src/xzdec/Makefile.am |  11 ++++
    - src/xzdec/xzdec.1     | 173 ++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 184 insertions(+)
    -
    -commit f6df39afaa84f71439507178a49b2a5dda6e824c
    -Author: Lasse Collin 
    -Date:   2009-06-04 23:26:47 +0300
    -
    -    Harmonized xzdec --memory with xz --memory and made
    -    minor cleanups.
    -
    - src/xzdec/xzdec.c | 74 +++++++++++++++++++++++++++++++++++++++----------------
    - 1 file changed, 53 insertions(+), 21 deletions(-)
    -
    -commit 1774f27c61ce294a56712ca2f4785f90a62441bc
    -Author: Lasse Collin 
    -Date:   2009-06-04 22:59:55 +0300
    -
    -    Fix purporse -> purpose. Thanks to Andrew Dudman.
    -    Released .xz spec 1.0.2 due to this fix too.
    -
    - THANKS                    | 1 +
    - doc/xz-file-format.txt    | 8 +++++---
    - src/liblzma/liblzma.pc.in | 2 +-
    - windows/Makefile          | 2 +-
    - 4 files changed, 8 insertions(+), 5 deletions(-)
    -
    -commit cb613455642f48fb51059e22018615f64c59b70f
    -Author: Lasse Collin 
    -Date:   2009-06-01 14:53:57 +0300
    -
    -    The .xz file format version 1.0.1
    -
    - doc/xz-file-format.txt | 29 ++++++++++++++++++++++-------
    - 1 file changed, 22 insertions(+), 7 deletions(-)
    -
    -commit 083c23c680ff844846d177cfc58bb7a874e7e6b9
    -Author: Lasse Collin 
    -Date:   2009-05-26 14:48:48 +0300
    -
    -    Make the raw value of the Check field available to applications
    -    via lzma_block structure.
    -    
    -    This changes ABI but not doesn't break API.
    -
    - src/liblzma/api/lzma/block.h              | 17 ++++++++++++++++
    - src/liblzma/common/block_buffer_encoder.c |  1 +
    - src/liblzma/common/block_decoder.c        | 34 ++++++++++++++-----------------
    - src/liblzma/common/block_encoder.c        | 21 ++++++++-----------
    - 4 files changed, 42 insertions(+), 31 deletions(-)
    -
    -commit b4f5c814090dc07d4350453576305e41eb9c998d
    -Author: Lasse Collin 
    -Date:   2009-05-23 16:57:21 +0300
    -
    -    Remove undocumented alternative option names --bcj, --ppc,
    -    and --itanium.
    -
    - src/xz/args.c | 3 ---
    - 1 file changed, 3 deletions(-)
    -
    -commit b1edee2cdc7ef4411b1a21c07094ec763f071281
    -Author: Lasse Collin 
    -Date:   2009-05-23 15:12:23 +0300
    -
    -    Add support for specifying the BCJ filter start offset
    -    in the xz command line tool.
    -
    - src/xz/args.c    | 36 +++++++++++++++++++++---------------
    - src/xz/message.c | 14 ++++++++------
    - src/xz/options.c | 40 ++++++++++++++++++++++++++++++++++++++++
    - src/xz/options.h |  7 +++++++
    - 4 files changed, 76 insertions(+), 21 deletions(-)
    -
    -commit 72aa0e9c5f4289f10ef5bf240a9448d3017f1ceb
    -Author: Lasse Collin 
    -Date:   2009-05-23 14:51:09 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit dcedb6998cefeca6597dd1219328a3abf5acf66d
    -Author: Lasse Collin 
    -Date:   2009-05-22 16:40:50 +0300
    -
    -    Added support for --quiet and --no-warn to xzdec.
    -    Cleaned up the --help message a little.
    -
    - src/xzdec/xzdec.c | 76 +++++++++++++++++++++++++++++++++++--------------------
    - 1 file changed, 49 insertions(+), 27 deletions(-)
    -
    -commit 5f735dae80aa629853f4831d7b84ec1c614979eb
    -Author: Lasse Collin 
    -Date:   2009-05-22 15:11:52 +0300
    -
    -    Use the 40 % of RAM memory usage limit in xzdec too.
    -    
    -    Update the memory usage info text in --help to match
    -    the text in xz --long-help.
    -
    - src/xzdec/xzdec.c | 10 +++++-----
    - 1 file changed, 5 insertions(+), 5 deletions(-)
    -
    -commit b60376249e0c586910c4121fab4f791820cc1289
    -Author: Lasse Collin 
    -Date:   2009-05-22 14:43:00 +0300
    -
    -    Add --no-warn.
    -
    - src/xz/args.c    |  8 +++++++-
    - src/xz/main.c    | 17 +++++++++++++++++
    - src/xz/main.h    |  6 ++++++
    - src/xz/message.c |  4 ++++
    - 4 files changed, 34 insertions(+), 1 deletion(-)
    -
    -commit b4f92f522d4b854c0adb7c38be7531e1a6a7b008
    -Author: Lasse Collin 
    -Date:   2009-05-22 14:27:40 +0300
    -
    -    Fix a comment.
    -
    - src/xz/main.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 4dd21d23f22569285ae706b58b0e5904b8db1839
    -Author: Lasse Collin 
    -Date:   2009-05-22 14:21:20 +0300
    -
    -    Remove the --info option, which was an alias for --list.
    -
    - src/xz/args.c | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit 8836139b63ce774bdd62abf17ab69b290e08229e
    -Author: Lasse Collin 
    -Date:   2009-05-22 12:27:43 +0300
    -
    -    If xz is run as lzma, unlzma, or lzcat, simply imply
    -    --format=lzma. This means that xz emulating lzma
    -    doesn't decompress .xz files, while before this
    -    commit it did. The new way is slightly simpler in
    -    code and especially in upcoming documentation.
    -
    - src/xz/args.c | 17 ++++++-----------
    - 1 file changed, 6 insertions(+), 11 deletions(-)
    -
    -commit b0063023f8adb06ea735ec4af5c6f5b7bdb8e84d
    -Author: Lasse Collin 
    -Date:   2009-05-22 11:29:50 +0300
    -
    -    Make the default memory usage limit 40 % of RAM for both
    -    compressing and decompressing. This should be OK now that
    -    xz automatically scales down the compression settings if
    -    they would exceed the memory usage limit (earlier, the limit
    -    for compression was increased to 90 % because low limit broke
    -    scripts that used "xz -9" on systems with low RAM).
    -    
    -    Support spcifying the memory usage limit as a percentage
    -    of RAM (e.g. --memory=50%).
    -    
    -    Support --threads=0 to reset the thread limit to the default
    -    value (number of available CPU cores). Use UINT32_MAX instead
    -    of SIZE_MAX as the maximum in args.c. hardware.c was already
    -    expecting uint32_t value.
    -    
    -    Cleaned up the output of --help and --long-help.
    -
    - src/xz/args.c     | 28 +++++++++++++-----
    - src/xz/hardware.c | 86 +++++++++++++++++++++++--------------------------------
    - src/xz/hardware.h | 10 +++----
    - src/xz/message.c  | 28 +++++++++---------
    - src/xz/process.c  | 18 +++++-------
    - 5 files changed, 82 insertions(+), 88 deletions(-)
    -
    -commit 071b825b23911a69dd1cd2f8cda004ef8a781fae
    -Author: Lasse Collin 
    -Date:   2009-05-21 17:22:01 +0300
    -
    -    Support special value "max" where xz and xzdec accept an integer.
    -    Don't round the memory usage limit in xzdec --help to avoid
    -    an integer overflow and to not give wrong impression that
    -    the limit is high enough when it may not actually be.
    -
    - src/xz/util.c     | 4 ++++
    - src/xzdec/xzdec.c | 6 +++++-
    - 2 files changed, 9 insertions(+), 1 deletion(-)
    -
    -commit 03ca67fd37dd43fa7f590de340899cd497c10802
    -Author: ABCD 
    -Date:   2009-05-20 17:31:18 -0400
    -
    -    Install lzdiff, lzgrep, and lzmore as symlinks
    -    
    -    This adds lzdiff, lzgrep, and lzmore to the list of symlinks to install.
    -    It also installs symlinks for the manual pages and removes the new
    -    symlinks on uninstall.
    -
    - src/scripts/Makefile.am | 16 ++++++++++++++--
    - 1 file changed, 14 insertions(+), 2 deletions(-)
    -
    -commit a6f43e64128a6da5cd641de1e1e527433b3e5638
    -Author: Lasse Collin 
    -Date:   2009-05-02 16:10:14 +0300
    -
    -    Use a GCC-specific #pragma instead of GCC-specific
    -    -Wno-uninitialized to silence a bogus warning.
    -
    - configure.ac                  | 13 -------------
    - src/liblzma/check/Makefile.am |  5 -----
    - src/liblzma/check/sha256.c    |  5 +++++
    - 3 files changed, 5 insertions(+), 18 deletions(-)
    -
    -commit f6ce63ebdb45a857c8949960c83c9580ae888951
    -Author: Lasse Collin 
    -Date:   2009-05-02 14:46:50 +0300
    -
    -    Removed --disable-encoder and --disable-decoder. Use the values
    -    given to --enable-encoders and --enable-decoders to determine
    -    if any encoder or decoder support is wanted.
    -
    - configure.ac | 48 ++++++++----------------------------------------
    - 1 file changed, 8 insertions(+), 40 deletions(-)
    -
    -commit be06858d5cf8ba46557395035d821dc332f3f830
    -Author: Lasse Collin 
    -Date:   2009-05-01 11:28:52 +0300
    -
    -    Remove docs that are too outdated to be updated
    -    (rewrite will be better).
    -
    - doc/liblzma-advanced.txt | 324 -----------------------------------------------
    - doc/liblzma-hacking.txt  | 112 ----------------
    - doc/liblzma-intro.txt    | 194 ----------------------------
    - doc/liblzma-security.txt | 219 --------------------------------
    - doc/lzma-intro.txt       | 107 ----------------
    - 5 files changed, 956 deletions(-)
    -
    -commit 0255401e57c96af87c6b159eca28974e79430a82
    -Author: Lasse Collin 
    -Date:   2009-05-01 11:21:46 +0300
    -
    -    Added documentation about the legacy .lzma file format.
    -
    - doc/lzma-file-format.txt | 166 +++++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 166 insertions(+)
    -
    -commit 1496ff437c46f38303e0e94c511ca604b3a11f85
    -Author: Lasse Collin 
    -Date:   2009-05-01 11:20:23 +0300
    -
    -    Renamed the file format specification to xz-file-format.txt
    -    which is the filename used on the WWW.
    -
    - doc/file-format.txt    | 1127 ------------------------------------------------
    - doc/xz-file-format.txt | 1127 ++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 1127 insertions(+), 1127 deletions(-)
    -
    -commit 21c6b94373d239d7e86bd480fcd558e30391712f
    -Author: Lasse Collin 
    -Date:   2009-04-28 23:08:32 +0300
    -
    -    Fixed a crash in liblzma.
    -    
    -    liblzma tries to avoid useless free()/malloc() pairs in
    -    initialization when multiple files are handled using the
    -    same lzma_stream. This didn't work with filter chains
    -    due to comparison of wrong pointers in lzma_next_coder_init(),
    -    making liblzma think that no memory reallocation is needed
    -    even when it actually is.
    -    
    -    Easy way to trigger this bug is to decompress two files with
    -    a single xz command. The first file should have e.g. x86+LZMA2
    -    as the filter chain, and the second file just LZMA2.
    -
    - src/liblzma/common/alone_decoder.c  | 2 +-
    - src/liblzma/common/alone_encoder.c  | 4 ++--
    - src/liblzma/common/auto_decoder.c   | 2 +-
    - src/liblzma/common/block_decoder.c  | 2 +-
    - src/liblzma/common/block_encoder.c  | 2 +-
    - src/liblzma/common/common.h         | 4 ++--
    - src/liblzma/common/easy_encoder.c   | 2 +-
    - src/liblzma/common/index_decoder.c  | 2 +-
    - src/liblzma/common/index_encoder.c  | 2 +-
    - src/liblzma/common/stream_decoder.c | 2 +-
    - src/liblzma/common/stream_encoder.c | 2 +-
    - 11 files changed, 13 insertions(+), 13 deletions(-)
    -
    -commit e518d167aa5958e469982f4fb3a24b9b6a2b5d1c
    -Author: Lasse Collin 
    -Date:   2009-04-15 14:13:38 +0300
    -
    -    Fix uint32_t -> size_t in ARM and ARM-Thumb filters.
    -    
    -    On 64-bit system it would have gone into infinite
    -    loop if a single input buffer was over 4 GiB (unlikely).
    -
    - src/liblzma/simple/arm.c      | 2 +-
    - src/liblzma/simple/armthumb.c | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 31decdce041581e57c0d8a407d4795b114ef27ca
    -Author: Lasse Collin 
    -Date:   2009-04-14 11:48:46 +0300
    -
    -    Minor fixes to test files' README.
    -
    - tests/files/README | 17 +++++++++--------
    - 1 file changed, 9 insertions(+), 8 deletions(-)
    -
    -commit 4787d654434891c7df5b43959b0d2873718f06e0
    -Author: Lasse Collin 
    -Date:   2009-04-13 16:36:41 +0300
    -
    -    Updated history.txt.
    -
    - doc/history.txt | 123 ++++++++++++++++++++++++++++++--------------------------
    - 1 file changed, 66 insertions(+), 57 deletions(-)
    -
    -commit 2f0bc9cd40f709152a0177c8e585c0757e9af9c9
    -Author: Lasse Collin 
    -Date:   2009-04-13 14:49:48 +0300
    -
    -    Quick & dirty update to support xz in diff/grep/more scripts.
    -
    - src/scripts/Makefile.am |  38 +++++++++------
    - src/scripts/lzdiff      |  67 --------------------------
    - src/scripts/lzdiff.1    |  51 --------------------
    - src/scripts/lzgrep      | 123 ------------------------------------------------
    - src/scripts/lzgrep.1    |  61 ------------------------
    - src/scripts/lzmore      |  74 -----------------------------
    - src/scripts/lzmore.1    |  55 ----------------------
    - src/scripts/xzdiff      |  67 ++++++++++++++++++++++++++
    - src/scripts/xzdiff.1    |  58 +++++++++++++++++++++++
    - src/scripts/xzgrep      | 123 ++++++++++++++++++++++++++++++++++++++++++++++++
    - src/scripts/xzgrep.1    |  77 ++++++++++++++++++++++++++++++
    - src/scripts/xzmore      |  74 +++++++++++++++++++++++++++++
    - src/scripts/xzmore.1    |  66 ++++++++++++++++++++++++++
    - 13 files changed, 489 insertions(+), 445 deletions(-)
    -
    -commit 02ddf09bc3079b3e17297729b9e43f14d407b8fc
    -Author: Lasse Collin 
    -Date:   2009-04-13 11:27:40 +0300
    -
    -    Put the interesting parts of XZ Utils into the public domain.
    -    Some minor documentation cleanups were made at the same time.
    -
    - COPYING                                        | 67 ++++++++++++++++++++------
    - ChangeLog                                      |  2 +-
    - Doxyfile.in                                    |  8 +--
    - Makefile.am                                    | 13 ++---
    - autogen.sh                                     |  9 ++++
    - configure.ac                                   | 13 ++---
    - debug/Makefile.am                              | 13 ++---
    - debug/crc32.c                                  | 13 ++---
    - debug/full_flush.c                             | 13 ++---
    - debug/hex2bin.c                                |  7 ++-
    - debug/known_sizes.c                            | 13 ++---
    - debug/memusage.c                               | 13 ++---
    - debug/repeat.c                                 | 13 ++---
    - debug/sync_flush.c                             | 13 ++---
    - doc/faq.txt                                    | 38 ++-------------
    - lib/Makefile.am                                | 18 +++----
    - src/Makefile.am                                | 13 ++---
    - src/common/bswap.h                             |  7 ++-
    - src/common/cpucores.h                          |  7 ++-
    - src/common/integer.h                           |  7 ++-
    - src/common/mythread.h                          |  4 +-
    - src/common/open_stdxxx.h                       |  7 ++-
    - src/common/physmem.h                           |  7 ++-
    - src/common/sysdefs.h                           | 13 ++---
    - src/liblzma/Makefile.am                        | 13 ++---
    - src/liblzma/api/Makefile.am                    | 13 ++---
    - src/liblzma/api/lzma.h                         | 38 +++++++++------
    - src/liblzma/api/lzma/base.h                    | 20 +++-----
    - src/liblzma/api/lzma/bcj.h                     | 18 +++----
    - src/liblzma/api/lzma/block.h                   | 18 +++----
    - src/liblzma/api/lzma/check.h                   | 18 +++----
    - src/liblzma/api/lzma/container.h               | 18 +++----
    - src/liblzma/api/lzma/delta.h                   | 18 +++----
    - src/liblzma/api/lzma/filter.h                  | 18 +++----
    - src/liblzma/api/lzma/index.h                   | 18 +++----
    - src/liblzma/api/lzma/index_hash.h              | 22 +++------
    - src/liblzma/api/lzma/lzma.h                    | 18 +++----
    - src/liblzma/api/lzma/stream_flags.h            | 18 +++----
    - src/liblzma/api/lzma/subblock.h                | 18 +++----
    - src/liblzma/api/lzma/version.h                 | 18 +++----
    - src/liblzma/api/lzma/vli.h                     | 46 ++++++++----------
    - src/liblzma/check/Makefile.am                  |  8 ++-
    - src/liblzma/check/check.c                      |  7 ++-
    - src/liblzma/check/check.h                      |  7 ++-
    - src/liblzma/check/crc32_fast.c                 | 30 +++++-------
    - src/liblzma/check/crc32_small.c                |  7 ++-
    - src/liblzma/check/crc32_table.c                |  7 ++-
    - src/liblzma/check/crc32_tablegen.c             |  7 ++-
    - src/liblzma/check/crc32_x86.S                  | 21 +++++---
    - src/liblzma/check/crc64_fast.c                 | 20 +++-----
    - src/liblzma/check/crc64_small.c                |  7 ++-
    - src/liblzma/check/crc64_table.c                |  7 ++-
    - src/liblzma/check/crc64_tablegen.c             |  7 ++-
    - src/liblzma/check/crc64_x86.S                  | 14 ++++--
    - src/liblzma/check/crc_macros.h                 |  9 ++--
    - src/liblzma/check/sha256.c                     | 23 +++++----
    - src/liblzma/common/Makefile.am                 | 13 ++---
    - src/liblzma/common/alone_decoder.c             | 13 ++---
    - src/liblzma/common/alone_decoder.h             | 13 ++---
    - src/liblzma/common/alone_encoder.c             | 13 ++---
    - src/liblzma/common/auto_decoder.c              | 13 ++---
    - src/liblzma/common/block_buffer_decoder.c      | 13 ++---
    - src/liblzma/common/block_buffer_encoder.c      | 13 ++---
    - src/liblzma/common/block_decoder.c             | 13 ++---
    - src/liblzma/common/block_decoder.h             | 13 ++---
    - src/liblzma/common/block_encoder.c             | 13 ++---
    - src/liblzma/common/block_encoder.h             | 13 ++---
    - src/liblzma/common/block_header_decoder.c      | 13 ++---
    - src/liblzma/common/block_header_encoder.c      | 13 ++---
    - src/liblzma/common/block_util.c                | 13 ++---
    - src/liblzma/common/bsr.h                       |  7 ++-
    - src/liblzma/common/chunk_size.c                | 13 ++---
    - src/liblzma/common/common.c                    | 13 ++---
    - src/liblzma/common/common.h                    | 13 ++---
    - src/liblzma/common/easy_buffer_encoder.c       | 13 ++---
    - src/liblzma/common/easy_decoder_memusage.c     | 13 ++---
    - src/liblzma/common/easy_encoder.c              | 13 ++---
    - src/liblzma/common/easy_encoder_memusage.c     | 13 ++---
    - src/liblzma/common/easy_preset.c               | 13 ++---
    - src/liblzma/common/easy_preset.h               | 13 ++---
    - src/liblzma/common/filter_buffer_decoder.c     | 13 ++---
    - src/liblzma/common/filter_buffer_encoder.c     | 13 ++---
    - src/liblzma/common/filter_common.c             | 13 ++---
    - src/liblzma/common/filter_common.h             | 13 ++---
    - src/liblzma/common/filter_decoder.c            | 13 ++---
    - src/liblzma/common/filter_decoder.h            | 13 ++---
    - src/liblzma/common/filter_encoder.c            | 13 ++---
    - src/liblzma/common/filter_encoder.h            | 13 ++---
    - src/liblzma/common/filter_flags_decoder.c      | 13 ++---
    - src/liblzma/common/filter_flags_encoder.c      | 13 ++---
    - src/liblzma/common/index.c                     | 13 ++---
    - src/liblzma/common/index.h                     | 13 ++---
    - src/liblzma/common/index_decoder.c             | 13 ++---
    - src/liblzma/common/index_encoder.c             | 13 ++---
    - src/liblzma/common/index_encoder.h             | 13 ++---
    - src/liblzma/common/index_hash.c                | 13 ++---
    - src/liblzma/common/stream_buffer_decoder.c     | 13 ++---
    - src/liblzma/common/stream_buffer_encoder.c     | 13 ++---
    - src/liblzma/common/stream_decoder.c            | 13 ++---
    - src/liblzma/common/stream_decoder.h            | 13 ++---
    - src/liblzma/common/stream_encoder.c            | 13 ++---
    - src/liblzma/common/stream_encoder.h            | 13 ++---
    - src/liblzma/common/stream_flags_common.c       | 13 ++---
    - src/liblzma/common/stream_flags_common.h       | 13 ++---
    - src/liblzma/common/stream_flags_decoder.c      | 13 ++---
    - src/liblzma/common/stream_flags_encoder.c      | 13 ++---
    - src/liblzma/common/vli_decoder.c               | 13 ++---
    - src/liblzma/common/vli_encoder.c               | 13 ++---
    - src/liblzma/common/vli_size.c                  | 13 ++---
    - src/liblzma/delta/Makefile.am                  | 13 ++---
    - src/liblzma/delta/delta_common.c               | 13 ++---
    - src/liblzma/delta/delta_common.h               | 13 ++---
    - src/liblzma/delta/delta_decoder.c              | 13 ++---
    - src/liblzma/delta/delta_decoder.h              | 13 ++---
    - src/liblzma/delta/delta_encoder.c              | 13 ++---
    - src/liblzma/delta/delta_encoder.h              | 13 ++---
    - src/liblzma/delta/delta_private.h              | 13 ++---
    - src/liblzma/lz/Makefile.am                     | 13 ++---
    - src/liblzma/lz/lz_decoder.c                    | 17 ++-----
    - src/liblzma/lz/lz_decoder.h                    | 17 ++-----
    - src/liblzma/lz/lz_encoder.c                    | 17 ++-----
    - src/liblzma/lz/lz_encoder.h                    | 17 ++-----
    - src/liblzma/lz/lz_encoder_hash.h               | 13 ++---
    - src/liblzma/lz/lz_encoder_mf.c                 | 17 ++-----
    - src/liblzma/lzma/Makefile.am                   | 13 ++---
    - src/liblzma/lzma/fastpos.h                     | 17 ++-----
    - src/liblzma/lzma/fastpos_tablegen.c            | 17 ++-----
    - src/liblzma/lzma/lzma2_decoder.c               | 17 ++-----
    - src/liblzma/lzma/lzma2_decoder.h               | 17 ++-----
    - src/liblzma/lzma/lzma2_encoder.c               | 17 ++-----
    - src/liblzma/lzma/lzma2_encoder.h               | 17 ++-----
    - src/liblzma/lzma/lzma_common.h                 | 17 ++-----
    - src/liblzma/lzma/lzma_decoder.c                | 17 ++-----
    - src/liblzma/lzma/lzma_decoder.h                | 17 ++-----
    - src/liblzma/lzma/lzma_encoder.c                | 17 ++-----
    - src/liblzma/lzma/lzma_encoder.h                | 17 ++-----
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c   | 13 ++---
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c | 13 ++---
    - src/liblzma/lzma/lzma_encoder_presets.c        | 13 ++---
    - src/liblzma/lzma/lzma_encoder_private.h        | 17 ++-----
    - src/liblzma/rangecoder/Makefile.am             | 13 ++---
    - src/liblzma/rangecoder/price.h                 | 13 ++---
    - src/liblzma/rangecoder/price_tablegen.c        | 16 ++----
    - src/liblzma/rangecoder/range_common.h          | 17 ++-----
    - src/liblzma/rangecoder/range_decoder.h         | 17 ++-----
    - src/liblzma/rangecoder/range_encoder.h         | 17 ++-----
    - src/liblzma/simple/Makefile.am                 | 13 ++---
    - src/liblzma/simple/arm.c                       | 17 ++-----
    - src/liblzma/simple/armthumb.c                  | 17 ++-----
    - src/liblzma/simple/ia64.c                      | 17 ++-----
    - src/liblzma/simple/powerpc.c                   | 17 ++-----
    - src/liblzma/simple/simple_coder.c              | 13 ++---
    - src/liblzma/simple/simple_coder.h              | 14 ++----
    - src/liblzma/simple/simple_decoder.c            | 13 ++---
    - src/liblzma/simple/simple_decoder.h            | 13 ++---
    - src/liblzma/simple/simple_encoder.c            | 13 ++---
    - src/liblzma/simple/simple_encoder.h            | 13 ++---
    - src/liblzma/simple/simple_private.h            | 13 ++---
    - src/liblzma/simple/sparc.c                     | 17 ++-----
    - src/liblzma/simple/x86.c                       | 17 ++-----
    - src/liblzma/subblock/Makefile.am               | 13 ++---
    - src/liblzma/subblock/subblock_decoder.c        | 13 ++---
    - src/liblzma/subblock/subblock_decoder.h        | 13 ++---
    - src/liblzma/subblock/subblock_decoder_helper.c | 13 ++---
    - src/liblzma/subblock/subblock_decoder_helper.h | 13 ++---
    - src/liblzma/subblock/subblock_encoder.c        | 13 ++---
    - src/liblzma/subblock/subblock_encoder.h        | 13 ++---
    - src/scripts/Makefile.am                        |  7 +++
    - src/xz/Makefile.am                             | 13 ++---
    - src/xz/args.c                                  | 13 ++---
    - src/xz/args.h                                  | 13 ++---
    - src/xz/hardware.c                              | 13 ++---
    - src/xz/hardware.h                              | 13 ++---
    - src/xz/io.c                                    | 13 ++---
    - src/xz/io.h                                    | 13 ++---
    - src/xz/list.c                                  | 13 ++---
    - src/xz/main.c                                  | 13 ++---
    - src/xz/main.h                                  | 13 ++---
    - src/xz/message.c                               | 13 ++---
    - src/xz/message.h                               | 13 ++---
    - src/xz/options.c                               | 13 ++---
    - src/xz/options.h                               | 13 ++---
    - src/xz/private.h                               | 13 ++---
    - src/xz/process.c                               | 13 ++---
    - src/xz/process.h                               | 13 ++---
    - src/xz/signals.c                               | 13 ++---
    - src/xz/signals.h                               | 13 ++---
    - src/xz/suffix.c                                | 13 ++---
    - src/xz/suffix.h                                | 13 ++---
    - src/xz/util.c                                  | 13 ++---
    - src/xz/util.h                                  | 13 ++---
    - src/xzdec/Makefile.am                          | 13 ++---
    - src/xzdec/xzdec.c                              | 13 ++---
    - tests/Makefile.am                              | 13 ++---
    - tests/bcj_test.c                               |  7 ++-
    - tests/create_compress_files.c                  | 13 ++---
    - tests/test_block.c                             | 13 ++---
    - tests/test_block_header.c                      | 13 ++---
    - tests/test_check.c                             | 13 ++---
    - tests/test_compress.sh                         | 13 ++---
    - tests/test_files.sh                            | 13 ++---
    - tests/test_filter_flags.c                      | 13 ++---
    - tests/test_index.c                             | 13 ++---
    - tests/test_stream_flags.c                      | 13 ++---
    - tests/tests.h                                  | 13 ++---
    - windows/common.rc                              |  2 +-
    - 206 files changed, 868 insertions(+), 2023 deletions(-)
    -
    -commit e79c42d854657ae7f75613bd80c1a35ff7c525cb
    -Author: Lasse Collin 
    -Date:   2009-04-10 11:17:02 +0300
    -
    -    Fix off-by-one in LZ decoder.
    -    
    -    Fortunately, this bug had no security risk other than accepting
    -    some corrupt files as valid.
    -
    - src/liblzma/lz/lz_decoder.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 94eb9ad46f1fded6d8369cf3d38bb9754c1375af
    -Author: Pavel Roskin 
    -Date:   2009-03-31 12:15:01 -0400
    -
    -    Fix minor typos in README
    -
    - README | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 9bab5336ebd765ec4e12252f416eefdf04eba750
    -Author: Lasse Collin 
    -Date:   2009-03-31 21:52:51 +0300
    -
    -    Add a note and work-around instructions to README about
    -    problems detecting a C99 compiler when some standard
    -    headers are missing.
    -
    - README | 11 +++++++++++
    - 1 file changed, 11 insertions(+)
    -
    -commit a0497ff7a06f9350349264fe9b52dfefc6d53ead
    -Author: Lasse Collin 
    -Date:   2009-03-18 16:54:38 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 390e69887fc5e0a108eb41203bed9acd100a3d76
    -Author: Lasse Collin 
    -Date:   2009-03-18 16:51:41 +0200
    -
    -    Fix wrong macro names in lc_cpucores.m4 and cpucores.h.
    -    Thanks to Bert Wesarg.
    -
    - m4/lc_cpucores.m4     | 4 ++--
    - src/common/cpucores.h | 4 ++--
    - 2 files changed, 4 insertions(+), 4 deletions(-)
    -
    -commit 0df9299e2478c2a0c62c05b1ae14a85a353e20d6
    -Author: Lasse Collin 
    -Date:   2009-03-01 09:03:08 +0200
    -
    -    Test for Linux-specific sysinfo() only on Linux systems.
    -    Some other systems have sysinfo() with different semantics.
    -
    - m4/lc_physmem.m4 | 28 +++++++++++++++++++---------
    - 1 file changed, 19 insertions(+), 9 deletions(-)
    -
    -commit cf751edfde3ad6e088dc18e0522d31ae38405933
    -Author: Lasse Collin 
    -Date:   2009-03-01 09:00:06 +0200
    -
    -    Added AC_CONFIG_MACRO_DIR to configure.ac.
    -
    - configure.ac | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 63df14c57dee7c461717784287056688482a7eb9
    -Author: Lasse Collin 
    -Date:   2009-03-01 08:58:41 +0200
    -
    -    Fix the Autoconf test for getopt_long replacement.
    -    It was broken by e114502b2bc371e4a45449832cb69be036360722.
    -
    - m4/getopt.m4 | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit fd6a380f4eda4f00be5f2aa8d222992cd74a714f
    -Author: Lasse Collin 
    -Date:   2009-02-22 19:07:54 +0200
    -
    -    Add a rough explanation of --extreme to output of --help.
    -
    - src/xz/message.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 68bf7ac2984d3627369a240ef0491934d53f7899
    -Author: Lasse Collin 
    -Date:   2009-02-22 18:52:49 +0200
    -
    -    Fixes to progress message handling in xz:
    -    
    -      - Don't use Windows-specific code on Windows. The old code
    -        required at least Windows 2000. Now it should work on
    -        Windows 98 and later, and maybe on Windows 95 too.
    -    
    -      - Use less precision when showing estimated remaining time.
    -    
    -      - Fix some small design issues.
    -
    - src/xz/message.c | 483 +++++++++++++++++++++++++++++++++++--------------------
    - src/xz/message.h |  28 ++--
    - src/xz/process.c |  53 +++---
    - 3 files changed, 351 insertions(+), 213 deletions(-)
    -
    -commit 47c2e21f82242f50f18713a27d644c2c94ab3fea
    -Author: Lasse Collin 
    -Date:   2009-02-18 13:00:10 +0200
    -
    -    Added files missing from the previous commit.
    -
    - src/liblzma/api/lzma/container.h | 33 +++++++++++++++++++++++++++++++++
    - src/liblzma/common/Makefile.am   |  7 ++++++-
    - 2 files changed, 39 insertions(+), 1 deletion(-)
    -
    -commit 489a3dbaa0465f04400804e956a1cfbbee3654a2
    -Author: Lasse Collin 
    -Date:   2009-02-17 10:43:00 +0200
    -
    -    Added lzma_easy_buffer_encode(). Splitted easy.c into small
    -    pieces to avoid unneeded dependencies making statically
    -    linked applications bigger than needed.
    -
    - dos/Makefile                               |   6 +-
    - src/liblzma/common/easy.c                  | 128 -----------------------------
    - src/liblzma/common/easy_buffer_encoder.c   |  34 ++++++++
    - src/liblzma/common/easy_decoder_memusage.c |  31 +++++++
    - src/liblzma/common/easy_encoder.c          |  87 ++++++++++++++++++++
    - src/liblzma/common/easy_encoder_memusage.c |  31 +++++++
    - src/liblzma/common/easy_preset.c           |  34 ++++++++
    - src/liblzma/common/easy_preset.h           |  39 +++++++++
    - windows/Makefile                           |   6 +-
    - 9 files changed, 266 insertions(+), 130 deletions(-)
    -
    -commit 7494816ab08d82f4d6409788825930c4e43cfd0d
    -Author: Lasse Collin 
    -Date:   2009-02-15 15:48:45 +0200
    -
    -    Make physmem.h work on old Windows versions.
    -    Thanks to Hongbo Ni for the original patch.
    -
    - src/common/physmem.h | 31 +++++++++++++++++++++++++++----
    - 1 file changed, 27 insertions(+), 4 deletions(-)
    -
    -commit 11ae4ae35fd70182c713f2d914b7cb1143bc76f0
    -Author: Lasse Collin 
    -Date:   2009-02-14 20:44:52 +0200
    -
    -    Fix microsecond vs. nanosecond confusion in my_time().
    -
    - src/xz/message.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 3084d662d2646ab7eb58daf0dc32cf3f9a74eec7
    -Author: Lasse Collin 
    -Date:   2009-02-14 00:45:29 +0200
    -
    -    Cleanups to the code that detects the amount of RAM and
    -    the number of CPU cores. Added support for using sysinfo()
    -    on Linux systems whose libc lacks appropriate sysconf()
    -    support (at least dietlibc). The Autoconf macros were
    -    split into separate files, and CPU core count detection
    -    was moved from hardware.c to cpucores.h. The core count
    -    isn't used for anything real for now, so a problematic
    -    part in process.c was commented out.
    -
    - configure.ac          | 89 ++-------------------------------------------------
    - m4/lc_cpucores.m4     | 57 +++++++++++++++++++++++++++++++++
    - m4/lc_physmem.m4      | 74 ++++++++++++++++++++++++++++++++++++++++++
    - src/common/cpucores.h | 52 ++++++++++++++++++++++++++++++
    - src/common/physmem.h  | 21 +++++++-----
    - src/xz/args.c         |  4 +--
    - src/xz/hardware.c     | 50 +++++++++++++----------------
    - src/xz/hardware.h     | 11 +++++--
    - src/xz/message.c      |  5 +--
    - src/xz/process.c      |  2 ++
    - 10 files changed, 235 insertions(+), 130 deletions(-)
    -
    -commit 9c62371eab2706c46b1072f5935e28cb4cd9dca8
    -Author: Lasse Collin 
    -Date:   2009-02-13 18:23:50 +0200
    -
    -    Initial port to DOS using DJGPP.
    -
    - dos/Makefile | 261 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - dos/README   | 113 ++++++++++++++++++++++++++
    - dos/config.h | 150 ++++++++++++++++++++++++++++++++++
    - 3 files changed, 524 insertions(+)
    -
    -commit 0dae8b7751d09e9c5a482d5519daaee4800ce203
    -Author: Lasse Collin 
    -Date:   2009-02-13 18:02:05 +0200
    -
    -    Windows port: Take advantage of the version number macros.
    -    Now the version number is not duplicated in the
    -    Windows-specific files anymore.
    -
    - windows/Makefile  |  2 +-
    - windows/common.rc | 16 ++++++++--------
    - windows/config.h  | 15 ---------------
    - 3 files changed, 9 insertions(+), 24 deletions(-)
    -
    -commit fdbc0cfa71f7d660855098a609175ba384259529
    -Author: Lasse Collin 
    -Date:   2009-02-13 18:00:03 +0200
    -
    -    Changed how the version number is specified in various places.
    -    Now configure.ac will get the version number directly from
    -    src/liblzma/api/lzma/version.h. The intent is to reduce the
    -    number of places where the version number is duplicated. In
    -    future, support for displaying Git commit ID may be added too.
    -
    - configure.ac                   |  3 +-
    - src/liblzma/api/lzma/version.h | 70 ++++++++++++++++++++++++++++++++++++++++--
    - src/liblzma/common/common.c    |  2 +-
    - src/xz/message.c               |  2 +-
    - src/xzdec/xzdec.c              |  2 +-
    - version.sh                     | 23 ++++++++++++++
    - 6 files changed, 95 insertions(+), 7 deletions(-)
    -
    -commit 1d924e584b146136989f48c13fff2632896efb3d
    -Author: Lasse Collin 
    -Date:   2009-02-13 17:30:30 +0200
    -
    -    Fix handling of integrity check type in the xz command line tool.
    -
    - src/xz/args.c    | 9 ++++++++-
    - src/xz/process.c | 4 ++++
    - 2 files changed, 12 insertions(+), 1 deletion(-)
    -
    -commit 96c46df7deb231ea68a03d8d1da9de4c774e36d8
    -Author: Lasse Collin 
    -Date:   2009-02-13 17:29:02 +0200
    -
    -    Improve support for DOS-like systems.
    -    Here DOS-like means DOS, Windows, and OS/2.
    -
    - src/common/physmem.h          | 12 ++++++++++++
    - src/common/sysdefs.h          |  4 ++++
    - src/liblzma/check/crc32_x86.S |  6 +++---
    - src/liblzma/check/crc64_x86.S |  6 +++---
    - src/xz/args.c                 | 13 +++++--------
    - src/xz/io.c                   | 39 +++++++++++++++++++++++++--------------
    - src/xz/main.c                 | 23 +++++++++++++++++++++++
    - src/xz/message.c              |  3 +++
    - src/xz/suffix.c               |  5 +++++
    - src/xzdec/xzdec.c             |  5 +++--
    - 10 files changed, 86 insertions(+), 30 deletions(-)
    -
    -commit b6a30ee8c2de60ecd722cd05223e4ba72f822e33
    -Author: Lasse Collin 
    -Date:   2009-02-11 20:02:32 +0200
    -
    -    Remove dead directories from .gitignore.
    -
    - .gitignore | 2 --
    - 1 file changed, 2 deletions(-)
    -
    -commit 1ec5b0027911d94cb6f98892cbc690f818d8a861
    -Author: Jim Meyering 
    -Date:   2009-02-11 14:45:14 +0100
    -
    -    .gitignore vs. Makefiles
    -    
    -    How about this for those of us who do srcdir builds?
    -
    - .gitignore | 22 ++++++++++++++++++++++
    - 1 file changed, 22 insertions(+)
    -
    -commit 154f5aec2de201c674841de4fcc9804c2a87af07
    -Author: Lasse Collin 
    -Date:   2009-02-10 21:48:35 +0200
    -
    -    Removed Makefile from .gitignore since not all Makefiles
    -    in the repository are generated by Autotools. People
    -    should do test builds in a separate build directory anyway.
    -
    - .gitignore | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit e605c2663691b0a4c307786aa368d124ea081daa
    -Author: Lasse Collin 
    -Date:   2009-02-10 21:48:05 +0200
    -
    -    Added resource files for the Windows build.
    -
    - windows/Makefile   | 37 ++++++++++++++++++++++---------------
    - windows/common.rc  | 46 ++++++++++++++++++++++++++++++++++++++++++++++
    - windows/liblzma.rc |  5 +++++
    - windows/lzmadec.rc |  5 +++++
    - windows/xz.rc      |  5 +++++
    - windows/xzdec.rc   |  5 +++++
    - 6 files changed, 88 insertions(+), 15 deletions(-)
    -
    -commit a3bbbe05d32b1f7ea9eb98805df4dda2e811b476
    -Author: Lasse Collin 
    -Date:   2009-02-09 14:54:31 +0200
    -
    -    Let the user specify custom CFLAGS on the make command
    -    line. Previously custom CFLAGS worked only when they were
    -    passed to configure.
    -
    - configure.ac                  | 58 ++++++++++++++++++++++---------------------
    - src/liblzma/check/Makefile.am |  2 +-
    - 2 files changed, 31 insertions(+), 29 deletions(-)
    -
    -commit 53f7598998b1860a69c51243b5d2e34623c6bf60
    -Author: Lasse Collin 
    -Date:   2009-02-08 21:35:11 +0200
    -
    -    Fix aliasing issue in physmem.h.
    -
    - src/common/physmem.h | 19 ++++++++++---------
    - 1 file changed, 10 insertions(+), 9 deletions(-)
    -
    -commit 0e27028d74c5c7a8e036ae2a9b8cecb0ac79d3a6
    -Author: Lasse Collin 
    -Date:   2009-02-08 18:24:50 +0200
    -
    -    Add a separate internal function to initialize the CRC32
    -    table, which is used also by LZ encoder. This was needed
    -    because calling lzma_crc32() and ignoring the result is
    -    a no-op due to lzma_attr_pure.
    -
    - src/liblzma/check/check.h       |  1 +
    - src/liblzma/check/crc32_small.c | 10 +++++++++-
    - src/liblzma/lz/lz_encoder.c     |  4 ++--
    - 3 files changed, 12 insertions(+), 3 deletions(-)
    -
    -commit ae1ad9af54210c9a2be336b1316532da5071516c
    -Author: Lasse Collin 
    -Date:   2009-02-08 18:17:05 +0200
    -
    -    Make "xz --force" to write to terminal as the error
    -    message suggests.
    -
    - src/xz/main.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 79e25eded48d2fe33f31441ab7a034f902e335f8
    -Author: Lasse Collin 
    -Date:   2009-02-08 10:37:50 +0200
    -
    -    Support both slash and backslash as path component
    -    separator on Windows when parsing argv[0].
    -
    - src/xz/args.c | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit bc7c7109cc4410055a888c1c70cbd1c9445c4361
    -Author: Lasse Collin 
    -Date:   2009-02-07 23:18:13 +0200
    -
    -    Omit the wrong and (even if corrected) nowadays useless rm
    -    from autogen.sh.
    -
    - autogen.sh | 28 ----------------------------
    - 1 file changed, 28 deletions(-)
    -
    -commit edfc2031e56f8a2ccda063f02936b3a848d88723
    -Author: Lasse Collin 
    -Date:   2009-02-07 21:41:52 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 880c3309386aac58fc4f3d7ca99bd31bcb1526a3
    -Author: Lasse Collin 
    -Date:   2009-02-07 21:17:07 +0200
    -
    -    Make it easy to choose if command line tools should be
    -    linked statically or dynamically against liblzma. The
    -    default is still to use static liblzma, but it can now
    -    be changed by passing --enable-dynamic to configure.
    -    Thanks to Mike Frysinger for the original patch.
    -    
    -    Fixed a few minor bugs in configure.ac.
    -
    - configure.ac          | 39 +++++++++++++++++++++++++++++++++++++++
    - src/xz/Makefile.am    |  8 +++-----
    - src/xzdec/Makefile.am |  5 +++--
    - 3 files changed, 45 insertions(+), 7 deletions(-)
    -
    -commit 3f86532407e4ace3debb62be16035e009b56ca36
    -Author: Mike Frysinger 
    -Date:   2009-02-06 23:38:39 -0500
    -
    -    add gitignore files
    -    
    -    Signed-off-by: Mike Frysinger 
    -
    - .gitignore    | 32 ++++++++++++++++++++++++++++++++
    - m4/.gitignore | 35 +++++++++++++++++++++++++++++++++++
    - po/.gitignore | 12 ++++++++++++
    - 3 files changed, 79 insertions(+)
    -
    -commit bd7ca1dad5c146b6217799ffaa230c32d207a3e5
    -Author: Lasse Collin 
    -Date:   2009-02-07 17:07:52 +0200
    -
    -    Assume 32 MiB of RAM on unsupported operating systems like
    -    the comment in hardware.c already said.
    -
    - src/xz/hardware.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit d0ab8c1c73ae712adb0d26fbb9da762d99a63618
    -Author: Lasse Collin 
    -Date:   2009-02-07 16:26:58 +0200
    -
    -    MinGW support: Don't build fastpos_tablegen.c as part of
    -    liblzma. Build both static and dynamic liblzma, and also
    -    static and dynamic versions of the command line tools.
    -
    - windows/Makefile | 92 ++++++++++++++++++++++++++++++++++++++++++--------------
    - windows/README   | 10 ------
    - 2 files changed, 69 insertions(+), 33 deletions(-)
    -
    -commit bfd91198e44a52bd9bfe3cd6dcae5edab7c6eb45
    -Author: Lasse Collin 
    -Date:   2009-02-07 15:55:47 +0200
    -
    -    Support LZMA_API_STATIC in assembler files to
    -    avoid __declspec(dllexport) equivalent.
    -
    - src/liblzma/check/crc32_x86.S | 4 ++++
    - src/liblzma/check/crc64_x86.S | 2 ++
    - 2 files changed, 6 insertions(+)
    -
    -commit 3306cf3883492720b3c34baa02f4eb4227d91c73
    -Author: Lasse Collin 
    -Date:   2009-02-07 11:11:50 +0200
    -
    -    Introduced LZMA_API_STATIC macro, which the applications
    -    need to #define when linking against static liblzma on
    -    platforms like Windows. Most developers don't need to
    -    care about LZMA_API_STATIC at all.
    -
    - src/liblzma/api/lzma.h      | 31 ++++++++++++++++++++++++-------
    - src/liblzma/common/common.h |  2 +-
    - 2 files changed, 25 insertions(+), 8 deletions(-)
    -
    -commit b719e63c5f4c91d2d5e2ea585d4c055ec3767d0b
    -Author: Lasse Collin 
    -Date:   2009-02-06 16:55:45 +0200
    -
    -    Another grammar fix
    -
    - README | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit fe5434f940f75fec3611cf9d9edf78c4da8ac760
    -Author: Lasse Collin 
    -Date:   2009-02-06 12:30:23 +0200
    -
    -    Grammar fix in README.
    -
    - README | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 3dfa58a9eedf5a0e566452b078801c9cbcf7a245
    -Author: Lasse Collin 
    -Date:   2009-02-06 10:06:32 +0200
    -
    -    Some MSYS installations (e.g. MsysGit) don't include
    -    install.exe, so don't rely on it.
    -
    - windows/Makefile | 12 +++++++-----
    - windows/README   | 11 ++++++-----
    - 2 files changed, 13 insertions(+), 10 deletions(-)
    -
    -commit 975d8fd72a5148d46b2e1745f7a211cf1dfd9d31
    -Author: Lasse Collin 
    -Date:   2009-02-06 09:13:15 +0200
    -
    -    Recreated the BCJ test files for x86 and SPARC. The old files
    -    were linked with crt*.o, which are copyrighted, and thus the
    -    old test files were not in the public domain as a whole. They
    -    are freely distributable though, but it is better to be careful
    -    and avoid including any copyrighted pieces in the test files.
    -    The new files are just compiled and assembled object files,
    -    and thus don't contain any copyrighted code.
    -
    - tests/bcj_test.c                  |   2 +-
    - tests/compress_prepared_bcj_sparc | Bin 6804 -> 1240 bytes
    - tests/compress_prepared_bcj_x86   | Bin 4649 -> 1388 bytes
    - tests/files/good-1-sparc-lzma2.xz | Bin 2296 -> 612 bytes
    - tests/files/good-1-x86-lzma2.xz   | Bin 1936 -> 716 bytes
    - 5 files changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 094b1b09a531f0d201ec81f2b07346a995fd80b9
    -Author: Lasse Collin 
    -Date:   2009-02-05 21:21:27 +0200
    -
    -    Add the "windows" directory to EXTRA_DIST.
    -
    - Makefile.am | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit e1c3412eec7acec7ca3b32c9c828f3147dc65b49
    -Author: Lasse Collin 
    -Date:   2009-02-05 09:17:51 +0200
    -
    -    Added initial experimental makefile for use with MinGW.
    -
    - windows/Makefile | 253 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - windows/README   | 164 ++++++++++++++++++++++++++++++++++++
    - windows/config.h | 180 +++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 597 insertions(+)
    -
    -commit 75905a9afc0ee89954ede7d08af70d1148bf0fd9
    -Author: Lasse Collin 
    -Date:   2009-02-05 09:12:57 +0200
    -
    -    Various code cleanups the the xz command line tool.
    -    It now builds with MinGW.
    -
    - src/common/physmem.h |  13 ++++
    - src/xz/Makefile.am   |   2 +
    - src/xz/args.h        |   8 ---
    - src/xz/hardware.h    |  10 +--
    - src/xz/io.c          |  93 +++++++++++++++++++-------
    - src/xz/io.h          |  12 ++--
    - src/xz/main.c        | 132 ++-----------------------------------
    - src/xz/main.h        |  22 -------
    - src/xz/message.c     |  65 ++++++++++++++++---
    - src/xz/message.h     |   6 --
    - src/xz/options.h     |   8 ---
    - src/xz/private.h     |  18 ++++--
    - src/xz/process.h     |  10 +--
    - src/xz/signals.c     | 180 +++++++++++++++++++++++++++++++++++++++++++++++++++
    - src/xz/signals.h     |  51 +++++++++++++++
    - src/xz/suffix.h      |   5 --
    - src/xz/util.c        |   5 +-
    - src/xz/util.h        |   5 --
    - 18 files changed, 399 insertions(+), 246 deletions(-)
    -
    -commit d0c0b9e94e0af59d1d8f7f4829695d6efe19ccfe
    -Author: Lasse Collin 
    -Date:   2009-02-03 12:15:17 +0200
    -
    -    Another utime() fix.
    -
    - src/xz/io.c | 9 +++++----
    - 1 file changed, 5 insertions(+), 4 deletions(-)
    -
    -commit ccf92a29e8c7234284f1568c1ec0fd7cb98356ca
    -Author: Lasse Collin 
    -Date:   2009-02-03 10:41:11 +0200
    -
    -    Fix wrong filename argument for utime() and utimes().
    -    This doesn't affect most systems, since most systems
    -    have better functions available.
    -
    - src/xz/io.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 99c1c2abfae2e87f3c17e929783e6d1bb7a3f302
    -Author: Lasse Collin 
    -Date:   2009-02-02 21:19:01 +0200
    -
    -    Updated the x86 assembler code:
    -      - Use call/ret pair to get instruction pointer for PIC.
    -      - Use PIC only if PIC or __PIC__ is #defined.
    -      - The code should work on MinGW and Darwin in addition
    -        to GNU/Linux and Solaris.
    -
    - configure.ac                  |  6 ----
    - src/liblzma/check/crc32_x86.S | 84 ++++++++++++++++++++++++++++++++++++-------
    - src/liblzma/check/crc64_x86.S | 82 ++++++++++++++++++++++++++++++++++++------
    - 3 files changed, 144 insertions(+), 28 deletions(-)
    -
    -commit 22a0c6dd940b78cdac2f4a4b4b0e7cc0ac15021f
    -Author: Lasse Collin 
    -Date:   2009-02-02 20:14:03 +0200
    -
    -    Modify LZMA_API macro so that it works on Windows with
    -    other compilers than MinGW. This may hurt readability
    -    of the API headers slightly, but I don't know any
    -    better way to do this.
    -
    - src/liblzma/api/lzma.h                     |  6 ++---
    - src/liblzma/api/lzma/base.h                | 11 ++++----
    - src/liblzma/api/lzma/block.h               | 22 ++++++++--------
    - src/liblzma/api/lzma/check.h               | 10 ++++----
    - src/liblzma/api/lzma/container.h           | 22 ++++++++--------
    - src/liblzma/api/lzma/filter.h              | 28 ++++++++++-----------
    - src/liblzma/api/lzma/index.h               | 40 +++++++++++++++---------------
    - src/liblzma/api/lzma/index_hash.h          | 10 ++++----
    - src/liblzma/api/lzma/lzma.h                |  6 ++---
    - src/liblzma/api/lzma/stream_flags.h        | 10 ++++----
    - src/liblzma/api/lzma/version.h             |  4 +--
    - src/liblzma/api/lzma/vli.h                 |  6 ++---
    - src/liblzma/check/check.c                  |  4 +--
    - src/liblzma/check/crc32_fast.c             |  2 +-
    - src/liblzma/check/crc32_small.c            |  2 +-
    - src/liblzma/check/crc64_fast.c             |  2 +-
    - src/liblzma/check/crc64_small.c            |  2 +-
    - src/liblzma/common/alone_decoder.c         |  2 +-
    - src/liblzma/common/alone_encoder.c         |  2 +-
    - src/liblzma/common/auto_decoder.c          |  2 +-
    - src/liblzma/common/block_buffer_decoder.c  |  2 +-
    - src/liblzma/common/block_buffer_encoder.c  |  4 +--
    - src/liblzma/common/block_decoder.c         |  2 +-
    - src/liblzma/common/block_encoder.c         |  2 +-
    - src/liblzma/common/block_header_decoder.c  |  2 +-
    - src/liblzma/common/block_header_encoder.c  |  4 +--
    - src/liblzma/common/block_util.c            |  6 ++---
    - src/liblzma/common/chunk_size.c            |  2 +-
    - src/liblzma/common/common.c                | 16 ++++++------
    - src/liblzma/common/common.h                |  2 +-
    - src/liblzma/common/easy.c                  |  6 ++---
    - src/liblzma/common/filter_buffer_decoder.c |  2 +-
    - src/liblzma/common/filter_buffer_encoder.c |  2 +-
    - src/liblzma/common/filter_decoder.c        |  8 +++---
    - src/liblzma/common/filter_encoder.c        | 12 ++++-----
    - src/liblzma/common/filter_flags_decoder.c  |  2 +-
    - src/liblzma/common/filter_flags_encoder.c  |  4 +--
    - src/liblzma/common/index.c                 | 32 ++++++++++++------------
    - src/liblzma/common/index_decoder.c         |  4 +--
    - src/liblzma/common/index_encoder.c         |  4 +--
    - src/liblzma/common/index_hash.c            | 10 ++++----
    - src/liblzma/common/stream_buffer_decoder.c |  2 +-
    - src/liblzma/common/stream_buffer_encoder.c |  4 +--
    - src/liblzma/common/stream_decoder.c        |  2 +-
    - src/liblzma/common/stream_encoder.c        |  2 +-
    - src/liblzma/common/stream_flags_common.c   |  2 +-
    - src/liblzma/common/stream_flags_decoder.c  |  4 +--
    - src/liblzma/common/stream_flags_encoder.c  |  4 +--
    - src/liblzma/common/vli_decoder.c           |  2 +-
    - src/liblzma/common/vli_encoder.c           |  2 +-
    - src/liblzma/common/vli_size.c              |  2 +-
    - src/liblzma/lz/lz_encoder.c                |  2 +-
    - src/liblzma/lzma/lzma_encoder.c            |  2 +-
    - src/liblzma/lzma/lzma_encoder_presets.c    |  2 +-
    - 54 files changed, 177 insertions(+), 176 deletions(-)
    -
    -commit 8dd7b6052e18621e2e6c62f40f762ee88bd3eb65
    -Author: Lasse Collin 
    -Date:   2009-02-01 22:40:35 +0200
    -
    -    Fix a bug in lzma_block_buffer_decode(), although this
    -    function should be rewritten anyway.
    -
    - src/liblzma/common/block_buffer_decoder.c | 8 ++++----
    - 1 file changed, 4 insertions(+), 4 deletions(-)
    -
    -commit 55fd41431e61fb8178858283d636b6781e33e847
    -Author: Lasse Collin 
    -Date:   2009-02-01 22:39:07 +0200
    -
    -    Added initial version of raw buffer-to-buffer coding
    -    functions, and cleaned up filter.h API header a little.
    -    May be very buggy, not tested yet.
    -
    - src/liblzma/api/lzma/filter.h              | 84 +++++++++++++++++++-------
    - src/liblzma/common/Makefile.am             |  2 +
    - src/liblzma/common/filter_buffer_decoder.c | 94 ++++++++++++++++++++++++++++++
    - src/liblzma/common/filter_buffer_encoder.c | 61 +++++++++++++++++++
    - 4 files changed, 221 insertions(+), 20 deletions(-)
    -
    -commit 3e54ecee5cad30a5ca361a88a99230407abc0699
    -Author: Lasse Collin 
    -Date:   2009-02-01 00:11:20 +0200
    -
    -    Fix missing newlines in xzdec.c.
    -
    - src/xzdec/xzdec.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit d64ca34f1b6f34e86adefc7f735b4eff8e6d4a35
    -Author: Lasse Collin 
    -Date:   2009-02-01 00:10:07 +0200
    -
    -    Use __cdecl also for function pointers in liblzma API when
    -    on Windows.
    -
    - src/liblzma/api/lzma.h      | 18 +++++++++++-------
    - src/liblzma/api/lzma/base.h |  4 ++--
    - src/liblzma/common/common.h | 18 +++++++-----------
    - 3 files changed, 20 insertions(+), 20 deletions(-)
    -
    -commit 6a2eb54092fc625d59921a607ff68cd1a90aa898
    -Author: Lasse Collin 
    -Date:   2009-01-31 11:01:48 +0200
    -
    -    Add LZMA_API to liblzma API headers. It's useful at least
    -    on Windows. sysdefs.h no longer #includes lzma.h, so lzma.h
    -    has to be #included separately where needed.
    -
    - src/common/sysdefs.h                |  2 --
    - src/liblzma/api/lzma.h              | 17 ++++++++++++++
    - src/liblzma/api/lzma/base.h         | 10 ++++----
    - src/liblzma/api/lzma/block.h        | 25 +++++++++++---------
    - src/liblzma/api/lzma/check.h        | 12 ++++++----
    - src/liblzma/api/lzma/container.h    | 23 +++++++++---------
    - src/liblzma/api/lzma/filter.h       | 24 +++++++++----------
    - src/liblzma/api/lzma/index.h        | 47 +++++++++++++++++++++----------------
    - src/liblzma/api/lzma/index_hash.h   | 11 +++++----
    - src/liblzma/api/lzma/lzma.h         |  8 ++++---
    - src/liblzma/api/lzma/stream_flags.h | 10 ++++----
    - src/liblzma/api/lzma/version.h      |  4 ++--
    - src/liblzma/api/lzma/vli.h          | 10 ++++----
    - src/liblzma/common/common.h         | 13 ++++++++--
    - src/xz/private.h                    |  1 +
    - src/xzdec/xzdec.c                   |  1 +
    - tests/tests.h                       |  1 +
    - 17 files changed, 131 insertions(+), 88 deletions(-)
    -
    -commit d9993fcb4dfc1f93abaf31ae23b3ef1f3123892b
    -Author: Lasse Collin 
    -Date:   2009-01-31 10:13:09 +0200
    -
    -    Use _WIN32 instead of WIN32 in xzdec.c to test if compiling on Windows.
    -
    - src/xzdec/xzdec.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 2dbdc5befb33c3703e4609809101047c67caf343
    -Author: Lasse Collin 
    -Date:   2009-01-31 10:02:52 +0200
    -
    -    Fix two lines in lzma.h on which the # wasn't at the
    -    beginning of the line.
    -
    - src/liblzma/api/lzma.h | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 4ab760109106dc04f39dd81c97d50f528d1b51c1
    -Author: Lasse Collin 
    -Date:   2009-01-31 09:55:05 +0200
    -
    -    Add support for using liblzma headers in MSVC, which has no
    -    stdint.h or inttypes.h.
    -
    - src/liblzma/api/lzma.h | 70 +++++++++++++++++++++++++++++++++-----------------
    - 1 file changed, 46 insertions(+), 24 deletions(-)
    -
    -commit b2172cf823d3be34cb0246cb4cb32d105e2a34c9
    -Author: Lasse Collin 
    -Date:   2009-01-31 08:49:54 +0200
    -
    -    Fix # -> ## in a macro in lzma.h.
    -
    - src/liblzma/api/lzma.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 1aae8698746d3c87a93f8398cdde2de9ba1f7208
    -Author: Lasse Collin 
    -Date:   2009-01-30 18:50:16 +0200
    -
    -    Updated README.
    -
    - README | 30 ++++++++++++++++++++----------
    - 1 file changed, 20 insertions(+), 10 deletions(-)
    -
    -commit f54bcf6f80d585236bc03ce49f7c73e1abaa17eb
    -Author: Lasse Collin 
    -Date:   2009-01-30 00:29:58 +0200
    -
    -    Remove dangling crc64_init.c.
    -
    - src/liblzma/check/crc64_init.c | 55 ------------------------------------------
    - 1 file changed, 55 deletions(-)
    -
    -commit 982da7ed314398420c38bf154a8f759d5f18b480
    -Author: Lasse Collin 
    -Date:   2009-01-28 17:16:38 +0200
    -
    -    The .xz file format specification version 1.0.0 is now
    -    officially released. The format has been technically the same
    -    since 2008-11-19, but now that it is frozen, people can start
    -    using it without a fear that the format will break.
    -
    - doc/file-format.txt | 84 +++++++++++++++++++++++++++++++----------------------
    - 1 file changed, 49 insertions(+), 35 deletions(-)
    -
    -commit c4683a660b4372156bdaf92f0cdc54a58f95ee6f
    -Author: Lasse Collin 
    -Date:   2009-01-28 08:45:59 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 3241317093595db9f79104faafe93cb989c9f858
    -Author: Lasse Collin 
    -Date:   2009-01-28 08:43:26 +0200
    -
    -    Fix uninitialized variables in alone_decoder.c. This bug was
    -    triggered by the previous commit, since these variables were
    -    not used by anything before support for a preset dictionary.
    -
    - src/liblzma/common/alone_decoder.c | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit f76e39cf930f888d460b443d18f977ebedea8b2a
    -Author: Lasse Collin 
    -Date:   2009-01-27 18:36:05 +0200
    -
    -    Added initial support for preset dictionary for raw LZMA1
    -    and LZMA2. It is not supported by the .xz format or the xz
    -    command line tool yet.
    -
    - src/liblzma/lz/lz_decoder.c      | 35 +++++++++++++++++++++++++----------
    - src/liblzma/lz/lz_decoder.h      |  9 ++++++++-
    - src/liblzma/lz/lz_encoder.c      | 18 ++++++++++++++++--
    - src/liblzma/lzma/lzma2_decoder.c |  9 ++++++---
    - src/liblzma/lzma/lzma2_encoder.c | 12 +++++++-----
    - src/liblzma/lzma/lzma_decoder.c  | 10 ++++++----
    - src/liblzma/lzma/lzma_decoder.h  |  2 +-
    - src/liblzma/lzma/lzma_encoder.c  |  9 ++++++++-
    - 8 files changed, 77 insertions(+), 27 deletions(-)
    -
    -commit 449b8c832b26c3633f3bec60095e57d2d3ada1f3
    -Author: Lasse Collin 
    -Date:   2009-01-26 20:09:17 +0200
    -
    -    Regenerate the CRC tables without trailing blanks.
    -
    - src/liblzma/check/crc32_table_be.h | 1008 +++++++++++++++++------------------
    - src/liblzma/check/crc32_table_le.h | 1008 +++++++++++++++++------------------
    - src/liblzma/check/crc64_table_be.h | 1016 ++++++++++++++++++------------------
    - src/liblzma/check/crc64_table_le.h | 1016 ++++++++++++++++++------------------
    - 4 files changed, 2024 insertions(+), 2024 deletions(-)
    -
    -commit 850f7400428dc9c5fd08a2f35a5bd2c9e45aede2
    -Author: Jim Meyering 
    -Date:   2009-01-19 21:37:16 +0100
    -
    -    remove trailing blanks from all but .xz files
    -
    - debug/known_sizes.c                | 2 +-
    - extra/scanlzma/scanlzma.c          | 5 ++---
    - src/liblzma/check/crc32_tablegen.c | 2 +-
    - src/liblzma/check/crc64_tablegen.c | 2 +-
    - src/scripts/lzdiff.1               | 4 ++--
    - src/scripts/lzmore.1               | 6 +++---
    - tests/test_compress.sh             | 4 ++--
    - 7 files changed, 12 insertions(+), 13 deletions(-)
    -
    -commit 667481f1aad34e1ed15738e7913a9c7e256b4cf5
    -Author: Lasse Collin 
    -Date:   2009-01-26 14:34:10 +0200
    -
    -    Add lzma_block_buffer_decode().
    -
    - src/liblzma/api/lzma/block.h              | 41 +++++++++++++++
    - src/liblzma/common/Makefile.am            |  1 +
    - src/liblzma/common/block_buffer_decoder.c | 87 +++++++++++++++++++++++++++++++
    - 3 files changed, 129 insertions(+)
    -
    -commit 5fb34d8324d3e7e0061df25d0086b64c8726b19d
    -Author: Lasse Collin 
    -Date:   2009-01-26 14:33:28 +0200
    -
    -    Add more sanity checks to lzma_stream_buffer_decode().
    -
    - src/liblzma/common/stream_buffer_decoder.c | 7 +++++++
    - 1 file changed, 7 insertions(+)
    -
    -commit c129748675a5daa8838df92bde32cc04f6ce61ba
    -Author: Lasse Collin 
    -Date:   2009-01-26 14:33:13 +0200
    -
    -    Avoid hardcoded constant in easy.c.
    -
    - src/liblzma/common/easy.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 1859d22d75e072463db74c25bc3f5a7992e5fdf6
    -Author: Lasse Collin 
    -Date:   2009-01-26 13:06:49 +0200
    -
    -    Tiny bit better sanity check in block_util.c
    -
    - src/liblzma/common/block_util.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 2c5fe958e4bbe9b147b10c255955dfe2827fb8e7
    -Author: Lasse Collin 
    -Date:   2009-01-25 01:35:56 +0200
    -
    -    Fix a dumb bug in Block decoder, which made it return
    -    LZMA_DATA_ERROR with valid data. The bug was added in
    -    e114502b2bc371e4a45449832cb69be036360722.
    -
    - src/liblzma/common/block_decoder.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit c81f13ff29271de7293f8af3d81848b1dcae3d19
    -Author: Lasse Collin 
    -Date:   2009-01-23 22:27:50 +0200
    -
    -    Added lzma_stream_buffer_decode() and made minor cleanups.
    -
    - src/liblzma/api/lzma/block.h               |  3 +-
    - src/liblzma/api/lzma/container.h           | 51 ++++++++++++++++-
    - src/liblzma/common/Makefile.am             |  1 +
    - src/liblzma/common/stream_buffer_decoder.c | 91 ++++++++++++++++++++++++++++++
    - 4 files changed, 144 insertions(+), 2 deletions(-)
    -
    -commit 0b3318661ce749550b8531dfd469639a08930391
    -Author: Lasse Collin 
    -Date:   2009-01-22 12:53:33 +0200
    -
    -    Fix a comment.
    -
    - src/liblzma/common/common.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 9ec80355a7212a0a2f8c89d98e51b1d8b4e34eec
    -Author: Lasse Collin 
    -Date:   2009-01-20 16:37:27 +0200
    -
    -    Add some single-call buffer-to-buffer coding functions.
    -
    - src/liblzma/api/lzma/block.h               |  57 ++++++
    - src/liblzma/api/lzma/container.h           |  56 ++++++
    - src/liblzma/api/lzma/index.h               |  70 ++++++-
    - src/liblzma/common/Makefile.am             |   2 +
    - src/liblzma/common/block_buffer_encoder.c  | 305 +++++++++++++++++++++++++++++
    - src/liblzma/common/index_decoder.c         |  83 ++++++--
    - src/liblzma/common/index_encoder.c         |  59 +++++-
    - src/liblzma/common/stream_buffer_encoder.c | 138 +++++++++++++
    - tests/test_index.c                         |  24 +++
    - 9 files changed, 768 insertions(+), 26 deletions(-)
    -
    -commit d8b58d099340f8f4007b24b211ee41a7210c061c
    -Author: Lasse Collin 
    -Date:   2009-01-20 13:45:41 +0200
    -
    -    Block encoder cleanups
    -
    - src/liblzma/common/block_encoder.c | 28 +++++++---------------------
    - src/liblzma/common/block_encoder.h | 25 +++++++++++++++++++++++++
    - 2 files changed, 32 insertions(+), 21 deletions(-)
    -
    -commit 0c09810cb3635cb575cb54e694d41523e7d0a335
    -Author: Lasse Collin 
    -Date:   2009-01-20 10:35:15 +0200
    -
    -    Use LZMA_PROG_ERROR in lzma_code() as documented in base.h.
    -
    - src/liblzma/common/common.c | 24 ++++++++----------------
    - 1 file changed, 8 insertions(+), 16 deletions(-)
    -
    -commit 2f1a8e8eb898f6c036cde55d153ad348bfab3c00
    -Author: Lasse Collin 
    -Date:   2009-01-19 22:53:18 +0200
    -
    -    Fix handling of non-fatal errors in lzma_code().
    -
    - src/liblzma/common/common.c | 9 ++++++++-
    - 1 file changed, 8 insertions(+), 1 deletion(-)
    -
    -commit 4810b6bc25087be872960b9dd1d11ff07735dc88
    -Author: Lasse Collin 
    -Date:   2009-01-19 14:00:33 +0200
    -
    -    Move some LZMA2 constants to lzma2_encoder.h so that they
    -    can be used outside lzma2_encoder.c.
    -
    - src/liblzma/lzma/lzma2_encoder.c | 13 -------------
    - src/liblzma/lzma/lzma2_encoder.h | 14 ++++++++++++++
    - src/liblzma/lzma/lzma_encoder.c  |  3 ++-
    - 3 files changed, 16 insertions(+), 14 deletions(-)
    -
    -commit 00be5d2e09f9c7a6a8563465ad8b8042866817a4
    -Author: Lasse Collin 
    -Date:   2009-01-19 13:52:36 +0200
    -
    -    Remove dead code.
    -
    - src/liblzma/lzma/lzma_encoder.h | 8 --------
    - 1 file changed, 8 deletions(-)
    -
    -commit 128586213f77c9bd82b7e9a62927f6d0c3769d85
    -Author: Lasse Collin 
    -Date:   2009-01-17 14:24:25 +0200
    -
    -    Beta was supposed to be API stable but I had forgot to rename
    -    lzma_memlimit_encoder and lzma_memlimit_decoder to
    -    lzma_raw_encoder_memlimit and lzma_raw_decoder_memlimit. :-(
    -    Now it is fixed. Hopefully it doesn't cause too much trouble
    -    to those who already thought API is stable.
    -
    - src/liblzma/api/lzma/filter.h       | 4 ++--
    - src/liblzma/common/easy.c           | 4 ++--
    - src/liblzma/common/filter_common.c  | 2 +-
    - src/liblzma/common/filter_common.h  | 2 +-
    - src/liblzma/common/filter_decoder.c | 4 ++--
    - src/liblzma/common/filter_encoder.c | 4 ++--
    - src/liblzma/common/stream_decoder.c | 2 +-
    - src/xz/process.c                    | 6 +++---
    - 8 files changed, 14 insertions(+), 14 deletions(-)
    -
    -commit b056379490be5c584c264a967f0540041a163a1e
    -Author: Lasse Collin 
    -Date:   2009-01-15 14:29:22 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit dc8f3be06d54ef6e6cfb5134dd3d25edd08cef89
    -Author: Lasse Collin 
    -Date:   2009-01-15 14:27:32 +0200
    -
    -    Fixed a bug in 7z2lzma.bash to make it work with .7z files
    -    that use something else than 2^n as the dictionary size.
    -    Thanks to Dan Shechter for the bug report.
    -
    - extra/7z2lzma/7z2lzma.bash | 47 +++++++++++++++++++++++-----------------------
    - 1 file changed, 24 insertions(+), 23 deletions(-)
    -
    -commit 8286a60b8f4bd5accfbc9d229d2204bac31994f2
    -Author: Lasse Collin 
    -Date:   2009-01-07 18:41:15 +0200
    -
    -    Use pthread_sigmask() instead of sigprocmask() when pthreads
    -    are enabled.
    -
    - src/common/mythread.h | 6 ++++++
    - src/xz/main.c         | 4 ++--
    - src/xz/private.h      | 1 +
    - 3 files changed, 9 insertions(+), 2 deletions(-)
    -
    -commit 4fd43cb3a906f6da2943f69239ee984c4787c9a9
    -Author: Lasse Collin 
    -Date:   2008-12-31 20:01:00 +0200
    -
    -    Bumped version to 4.999.8beta right after the release
    -    of 4.999.7beta.
    -
    - configure.ac                   | 2 +-
    - src/liblzma/api/lzma/version.h | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 061748f5932719643cda73383db715167d543c22
    -Author: Lasse Collin 
    -Date:   2008-12-31 18:59:02 +0200
    -
    -    Disable Subblock filter from test_compress.sh since it is
    -    disabled by default in configure.ac.
    -
    - tests/test_compress.sh | 22 +++++++++++++---------
    - 1 file changed, 13 insertions(+), 9 deletions(-)
    -
    -commit 9c45658ddc8bd4a7819ef8547d3e7ccf73203e78
    -Author: Lasse Collin 
    -Date:   2008-12-31 17:44:20 +0200
    -
    -    Disable both Subblock encoder and decoder my default,
    -    since they are not finished and may have security issues too.
    -
    - configure.ac | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit b59f1e98f50694cf6a8f1b342fd878feebdb2f88
    -Author: Lasse Collin 
    -Date:   2008-12-31 17:42:50 +0200
    -
    -    Update some files in debug directory.
    -
    - debug/full_flush.c | 2 --
    - debug/memusage.c   | 2 --
    - debug/sync_flush.c | 2 --
    - 3 files changed, 6 deletions(-)
    -
    -commit d1d17a40d33a9682424ca37282813492f2cba6d0
    -Author: Lasse Collin 
    -Date:   2008-12-31 17:41:46 +0200
    -
    -    Prepare for 4.999.7beta release.
    -
    - AUTHORS                        |  4 ++--
    - README                         | 34 +++++++++++++++++-----------------
    - configure.ac                   |  4 ++--
    - src/liblzma/api/lzma/version.h |  2 +-
    - 4 files changed, 22 insertions(+), 22 deletions(-)
    -
    -commit 88d3e6b0b18e24142b6d3b41dc1b84b00c49fef3
    -Author: Lasse Collin 
    -Date:   2008-12-31 17:15:03 +0200
    -
    -    Cleaned up some comments in the API headers.
    -
    - src/liblzma/api/lzma/check.h     | 23 +++++++++++------------
    - src/liblzma/api/lzma/container.h |  2 +-
    - src/liblzma/api/lzma/version.h   |  4 +++-
    - 3 files changed, 15 insertions(+), 14 deletions(-)
    -
    -commit 322ecf93c961e45a1da8c4a794a7fdacefcd7f40
    -Author: Lasse Collin 
    -Date:   2008-12-31 16:29:39 +0200
    -
    -    Renamed lzma_options_simple to lzma_options_bcj in the API.
    -    The internal implementation is still using the name "simple".
    -    It may need some cleanups, so I look at it later.
    -
    - src/liblzma/api/Makefile.am         |  2 +-
    - src/liblzma/api/lzma.h              |  2 +-
    - src/liblzma/api/lzma/bcj.h          | 94 +++++++++++++++++++++++++++++++++++++
    - src/liblzma/api/lzma/simple.h       | 94 -------------------------------------
    - src/liblzma/simple/simple_coder.c   |  2 +-
    - src/liblzma/simple/simple_decoder.c |  4 +-
    - src/liblzma/simple/simple_encoder.c |  4 +-
    - tests/test_filter_flags.c           |  8 ++--
    - 8 files changed, 105 insertions(+), 105 deletions(-)
    -
    -commit 7eea8bec3abfed883efba66264a1452a1c04f6b0
    -Author: Lasse Collin 
    -Date:   2008-12-31 00:57:27 +0200
    -
    -    Fixed missing quoting in configure.ac.
    -
    - configure.ac | 38 +++++++++++++++++++-------------------
    - 1 file changed, 19 insertions(+), 19 deletions(-)
    -
    -commit 28e75f7086dbe9501d926c370375c69dfb1236ce
    -Author: Lasse Collin 
    -Date:   2008-12-31 00:48:23 +0200
    -
    -    Updated src/liblzma/Makefile.am to use liblzma.pc.in, which
    -    should have been in the previous commit.
    -
    - src/liblzma/Makefile.am | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 7ed9d943b31d3ee9c5fb2387e84a241ba33afe90
    -Author: Lasse Collin 
    -Date:   2008-12-31 00:30:49 +0200
    -
    -    Remove lzma_init() and other init functions from liblzma API.
    -    Half of developers were already forgetting to use these
    -    functions, which could have caused total breakage in some future
    -    liblzma version or even now if --enable-small was used. Now
    -    liblzma uses pthread_once() to do the initializations unless
    -    it has been built with --disable-threads which make these
    -    initializations thread-unsafe.
    -    
    -    When --enable-small isn't used, liblzma currently gets needlessly
    -    linked against libpthread (on systems that have it). While it is
    -    stupid for now, liblzma will need threads in future anyway, so
    -    this stupidity will be temporary only.
    -    
    -    When --enable-small is used, different code CRC32 and CRC64 is
    -    now used than without --enable-small. This made the resulting
    -    binary slightly smaller, but the main reason was to clean it up
    -    and to handle the lack of lzma_init_check().
    -    
    -    The pkg-config file lzma.pc was renamed to liblzma.pc. I'm not
    -    sure if it works correctly and portably for static linking
    -    (Libs.private includes -pthread or other operating system
    -    specific flags). Hopefully someone complains if it is bad.
    -    
    -    lzma_rc_prices[] is now included as a precomputed array even
    -    with --enable-small. It's just 128 bytes now that it uses uint8_t
    -    instead of uint32_t. Smaller array seemed to be at least as fast
    -    as the more bloated uint32_t array on x86; hopefully it's not bad
    -    on other architectures.
    -
    - configure.ac                              | 29 ++++++++--
    - src/common/mythread.h                     | 34 ++++++++++++
    - src/liblzma/api/Makefile.am               |  1 -
    - src/liblzma/api/lzma.h                    |  1 -
    - src/liblzma/api/lzma/init.h               | 85 -----------------------------
    - src/liblzma/check/Makefile.am             | 29 ++++------
    - src/liblzma/check/check.c                 | 10 ++--
    - src/liblzma/check/check.h                 | 25 ++++-----
    - src/liblzma/check/check_init.c            | 37 -------------
    - src/liblzma/check/crc32.c                 | 88 -------------------------------
    - src/liblzma/check/crc32_fast.c            | 88 +++++++++++++++++++++++++++++++
    - src/liblzma/check/crc32_init.c            | 55 -------------------
    - src/liblzma/check/crc32_small.c           | 54 +++++++++++++++++++
    - src/liblzma/check/crc32_tablegen.c        | 55 ++++++++++++++++---
    - src/liblzma/check/crc64.c                 | 75 --------------------------
    - src/liblzma/check/crc64_fast.c            | 75 ++++++++++++++++++++++++++
    - src/liblzma/check/crc64_small.c           | 54 +++++++++++++++++++
    - src/liblzma/check/crc64_tablegen.c        | 55 ++++++++++++++++---
    - src/liblzma/common/Makefile.am            |  3 --
    - src/liblzma/common/common.h               |  1 +
    - src/liblzma/common/init.c                 | 39 --------------
    - src/liblzma/common/init_decoder.c         | 31 -----------
    - src/liblzma/common/init_encoder.c         | 40 --------------
    - src/liblzma/liblzma.pc.in                 | 12 +++++
    - src/liblzma/lz/lz_encoder.c               |  6 +++
    - src/liblzma/lzma.pc.in                    | 11 ----
    - src/liblzma/rangecoder/Makefile.am        |  8 +--
    - src/liblzma/rangecoder/price.h            | 16 +-----
    - src/liblzma/rangecoder/price_table.c      |  2 +-
    - src/liblzma/rangecoder/price_table_init.c | 55 -------------------
    - src/liblzma/rangecoder/price_tablegen.c   | 51 +++++++++++++++---
    - src/xz/Makefile.am                        |  5 +-
    - src/xz/main.c                             |  3 --
    - src/xzdec/xzdec.c                         |  3 --
    - tests/test_block_header.c                 |  1 -
    - tests/test_check.c                        |  2 -
    - tests/test_filter_flags.c                 |  2 -
    - tests/test_index.c                        |  2 -
    - tests/test_stream_flags.c                 |  2 -
    - tests/tests.h                             |  2 +-
    - 40 files changed, 519 insertions(+), 628 deletions(-)
    -
    -commit 5cda29b5665004fc0f21d0c41d78022a6a559ab2
    -Author: Lasse Collin 
    -Date:   2008-12-27 19:40:31 +0200
    -
    -    Use 28 MiB as memory usage limit for encoding in test_compress.sh.
    -
    - tests/test_compress.sh | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 050eb14d29e2537c014662e83599fd8a77f13c45
    -Author: Lasse Collin 
    -Date:   2008-12-27 19:32:20 +0200
    -
    -    Revert a change made in 3b34851de1eaf358cf9268922fa0eeed8278d680
    -    that was related to LZMA_MODE_FAST. The original code is slightly
    -    faster although it compresses slightly worse. But since it is fast
    -    mode, it is better to select the faster version.
    -
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c | 23 ++++++++---------------
    - 1 file changed, 8 insertions(+), 15 deletions(-)
    -
    -commit 4820f10d0f173864f6a2ea7479663b509ac53358
    -Author: Lasse Collin 
    -Date:   2008-12-27 19:30:19 +0200
    -
    -    Some xz command line tool improvements.
    -
    - src/xz/args.c    |  23 +++++-----
    - src/xz/message.c |   4 +-
    - src/xz/options.c |   2 +-
    - src/xz/process.c | 133 +++++++++++++++++++++++++++++++++++++++++++------------
    - src/xz/process.h |   3 ++
    - 5 files changed, 121 insertions(+), 44 deletions(-)
    -
    -commit e33194e79d8f5ce07cb4aca909b324ae75098f7e
    -Author: Lasse Collin 
    -Date:   2008-12-27 19:27:49 +0200
    -
    -    Bunch of liblzma tweaks, including some API changes.
    -    The API and ABI should now be very close to stable,
    -    although the code behind it isn't yet.
    -
    - src/liblzma/api/lzma.h                    |  8 ++--
    - src/liblzma/api/lzma/block.h              | 63 ++++++++++++++++++++++++-
    - src/liblzma/api/lzma/container.h          | 76 +++++++++++++++----------------
    - src/liblzma/api/lzma/lzma.h               | 41 +++++++++--------
    - src/liblzma/common/alone_decoder.c        | 36 +++++++--------
    - src/liblzma/common/alone_encoder.c        | 22 ++++-----
    - src/liblzma/common/auto_decoder.c         |  2 +-
    - src/liblzma/common/block_decoder.c        | 54 +++++++++++-----------
    - src/liblzma/common/block_decoder.h        |  4 +-
    - src/liblzma/common/block_encoder.c        | 37 ++++++++-------
    - src/liblzma/common/block_encoder.h        |  4 +-
    - src/liblzma/common/block_header_decoder.c | 41 +++++++++--------
    - src/liblzma/common/block_header_encoder.c | 51 ++++++++++-----------
    - src/liblzma/common/block_util.c           |  3 +-
    - src/liblzma/common/easy.c                 | 45 ++++++------------
    - src/liblzma/common/stream_decoder.c       |  3 +-
    - src/liblzma/common/stream_decoder.h       |  2 +-
    - src/liblzma/common/stream_encoder.c       |  3 +-
    - src/liblzma/common/stream_encoder.h       |  2 +-
    - src/liblzma/common/stream_flags_decoder.c |  2 +-
    - src/liblzma/common/stream_flags_encoder.c |  2 +-
    - src/liblzma/lzma/lzma_encoder.c           |  2 +-
    - src/liblzma/lzma/lzma_encoder_presets.c   | 53 +++++++--------------
    - 23 files changed, 294 insertions(+), 262 deletions(-)
    -
    -commit 4d00652e75dd2736aedc3a3a8baff3dd0ea38074
    -Author: Lasse Collin 
    -Date:   2008-12-18 13:42:52 +0200
    -
    -    Updated Makefile.am that was missing from the previous commit.
    -
    - src/liblzma/common/Makefile.am | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit 634636fa56ccee6e744f78b0abed76c8940f2f8f
    -Author: Lasse Collin 
    -Date:   2008-12-17 21:49:53 +0200
    -
    -    Remove the alignment functions for now. Maybe they will
    -    be added back in some form later, but the current version
    -    wasn't modular, so it would need fixing anyway.
    -
    - src/liblzma/api/Makefile.am      |   1 -
    - src/liblzma/api/lzma.h           |   1 -
    - src/liblzma/api/lzma/alignment.h |  60 ---------------------
    - src/liblzma/common/alignment.c   | 114 ---------------------------------------
    - 4 files changed, 176 deletions(-)
    -
    -commit 4fed98417d1687f5eccccb42a133fde3ec81216a
    -Author: Lasse Collin 
    -Date:   2008-12-17 20:11:23 +0200
    -
    -    xz message handling improvements
    -
    - src/xz/message.c | 125 ++++++++++++++++++++++++++++++++++++++++++++++++++-----
    - src/xz/message.h |   7 +++-
    - src/xz/process.c |  28 ++++++++++++-
    - 3 files changed, 146 insertions(+), 14 deletions(-)
    -
    -commit 653e457e3756ef35e5d1b2be3523b3e4b1e9ee4d
    -Author: Lasse Collin 
    -Date:   2008-12-15 23:26:43 +0200
    -
    -    Fix a dumb bug in .lzma decoder which was introduced in
    -    the previous commit. (Probably the previous commit has
    -    other bugs too, it wasn't tested.)
    -
    - src/liblzma/common/alone_decoder.c | 29 ++++++++++++++---------------
    - 1 file changed, 14 insertions(+), 15 deletions(-)
    -
    -commit 671a5adf1e844bfdd6fd327016c3c28694493158
    -Author: Lasse Collin 
    -Date:   2008-12-15 19:39:13 +0200
    -
    -    Bunch of liblzma API cleanups and fixes.
    -
    - src/liblzma/api/lzma.h              | 122 +++++++++++----------
    - src/liblzma/api/lzma/base.h         | 174 ++++++++++++++++++-----------
    - src/liblzma/api/lzma/block.h        | 211 +++++++++++++++++++++++-------------
    - src/liblzma/api/lzma/check.h        |  28 ++---
    - src/liblzma/api/lzma/container.h    | 155 +++++++++++++-------------
    - src/liblzma/api/lzma/delta.h        |  12 +-
    - src/liblzma/api/lzma/filter.h       |  27 +++--
    - src/liblzma/api/lzma/index.h        |  97 ++++++++++++++---
    - src/liblzma/api/lzma/index_hash.h   |  26 +++--
    - src/liblzma/api/lzma/init.h         |   2 +-
    - src/liblzma/api/lzma/lzma.h         |  12 +-
    - src/liblzma/api/lzma/simple.h       |   4 +-
    - src/liblzma/api/lzma/stream_flags.h |  46 +++++---
    - src/liblzma/api/lzma/version.h      |   6 +-
    - src/liblzma/api/lzma/vli.h          |  17 ++-
    - src/liblzma/common/alone_decoder.c  |  47 +++++---
    - src/liblzma/common/auto_decoder.c   |  29 +++++
    - src/liblzma/common/block_util.c     |  52 +++++----
    - src/liblzma/common/common.c         |  58 ++++++++++
    - src/liblzma/common/common.h         |   9 +-
    - src/liblzma/common/easy.c           |  33 ++++--
    - src/liblzma/common/filter_common.c  |   2 +-
    - src/liblzma/common/index.c          |  11 ++
    - src/liblzma/common/index_decoder.c  |  46 ++++++--
    - src/liblzma/common/stream_decoder.c |  47 ++++++--
    - src/liblzma/lzma/lzma2_encoder.c    |   6 +-
    - tests/test_index.c                  |  10 +-
    - 27 files changed, 863 insertions(+), 426 deletions(-)
    -
    -commit 17781c2c20fd77029cb32e77792889f2f211d69d
    -Author: Lasse Collin 
    -Date:   2008-12-15 14:26:52 +0200
    -
    -    The LZMA2 decoder fix introduced a bug to LZ decoder,
    -    which made LZ decoder return too early after dictionary
    -    reset. This fixes it.
    -
    - src/liblzma/lz/lz_decoder.c | 33 +++++++++++++++++++++++----------
    - 1 file changed, 23 insertions(+), 10 deletions(-)
    -
    -commit f9f2d1e74398500724041f7fb3c38db35ad8c8d8
    -Author: Lasse Collin 
    -Date:   2008-12-15 11:20:22 +0200
    -
    -    Added two new test files.
    -
    - tests/files/README            |   7 +++++++
    - tests/files/bad-1-lzma2-8.xz  | Bin 0 -> 464 bytes
    - tests/files/good-1-lzma2-4.xz | Bin 0 -> 464 bytes
    - 3 files changed, 7 insertions(+)
    -
    -commit ff7fb2c605bccc411069e07b9f11fb957aea2ddf
    -Author: Lasse Collin 
    -Date:   2008-12-15 10:01:59 +0200
    -
    -    Fix data corruption in LZMA2 decoder.
    -
    - src/liblzma/lz/lz_decoder.c      | 17 ++++++++++++++++-
    - src/liblzma/lz/lz_decoder.h      |  8 +++++---
    - src/liblzma/lzma/lzma2_decoder.c | 15 +++++++++++----
    - 3 files changed, 32 insertions(+), 8 deletions(-)
    -
    -commit 1ceebcf7e1bd30b95125f0ad67a09fdb6215d613
    -Author: Lasse Collin 
    -Date:   2008-12-13 00:54:11 +0200
    -
    -    Name the package "xz" in configure.ac.
    -
    - configure.ac | 11 ++++-------
    - 1 file changed, 4 insertions(+), 7 deletions(-)
    -
    -commit a94bf00d0af9b423851905b031be5a645a657820
    -Author: Lasse Collin 
    -Date:   2008-12-12 22:43:21 +0200
    -
    -    Some adjustments to GCC warning flags. The important change
    -    is the removal of -pedantic. It messes up -Werror (which I
    -    really want to keep so that I don't miss any warnings) with
    -    printf format strings that are in POSIX but not in C99.
    -
    - configure.ac | 8 +++++---
    - 1 file changed, 5 insertions(+), 3 deletions(-)
    -
    -commit 8582d392baacd2cdac07ca60041f8c661323676d
    -Author: Lasse Collin 
    -Date:   2008-12-10 01:31:00 +0200
    -
    -    Remove obsolete comment.
    -
    - src/xz/message.c | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit b1ae6dd731ea3636c3c2bfc7aefa71457d3328f1
    -Author: Lasse Collin 
    -Date:   2008-12-10 01:27:15 +0200
    -
    -    Use "decompression" consistently in --long-help.
    -
    - src/xz/message.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 1ea9e7f15afd5d3981e2432710e932320597bca9
    -Author: Lasse Collin 
    -Date:   2008-12-10 01:23:58 +0200
    -
    -    Added preset=NUM to --lzma1 and --lzma2. This makes it easy
    -    to take a preset as a template and modify it a little.
    -
    - src/xz/message.c | 1 +
    - src/xz/options.c | 8 ++++++++
    - 2 files changed, 9 insertions(+)
    -
    -commit bceb3918dbb21f34976bfdd4c171a81319de71f7
    -Author: Lasse Collin 
    -Date:   2008-12-09 17:43:31 +0200
    -
    -    Put the file format specification into the public domain.
    -    Same will be done to the actual code later.
    -
    - doc/file-format.txt | 24 +++++++++---------------
    - 1 file changed, 9 insertions(+), 15 deletions(-)
    -
    -commit 6efa2d80d46a38861016f41f0eb6fa2ec9260fe6
    -Author: Lasse Collin 
    -Date:   2008-12-09 17:41:49 +0200
    -
    -    Make the memusage functions of LZMA1 and LZMA2 encoders
    -    to validate the filter options. Add missing validation
    -    to LZMA2 encoder when options are changed in the middle
    -    of encoding.
    -
    - src/liblzma/lzma/lzma2_encoder.c |  5 ++++-
    - src/liblzma/lzma/lzma_encoder.c  | 44 +++++++++++++++++++++++++++-------------
    - src/liblzma/lzma/lzma_encoder.h  |  2 +-
    - 3 files changed, 35 insertions(+), 16 deletions(-)
    -
    -commit f20a03206b71ff01b827bb7a932411d6a6a4e06a
    -Author: Lasse Collin 
    -Date:   2008-12-09 10:36:24 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit ef7890d56453dca1aeb2e12db29b7e418d93dde4
    -Author: Lasse Collin 
    -Date:   2008-12-01 23:04:12 +0200
    -
    -    In command line tool, take advantage of memusage calculation's
    -    ability to also validate the filter chain and options (not
    -    implemented yet for all filters).
    -
    - src/xz/process.c | 8 ++++----
    - 1 file changed, 4 insertions(+), 4 deletions(-)
    -
    -commit ccd57afa09e332d664d6d6a7498702791ea5f659
    -Author: Lasse Collin 
    -Date:   2008-12-01 22:59:28 +0200
    -
    -    Validate the filter chain before checking filter-specific
    -    memory usage.
    -
    - src/liblzma/common/filter_common.c | 14 ++++++++++----
    - 1 file changed, 10 insertions(+), 4 deletions(-)
    -
    -commit c596fda40b62fe1683d0ac34d0c673dcaae2aa15
    -Author: Lasse Collin 
    -Date:   2008-12-01 22:58:22 +0200
    -
    -    Make the memusage functions of LZMA1 and LZMA2 decoders
    -    to validate the filter options.
    -
    - src/liblzma/lzma/lzma2_decoder.c |  7 ++-----
    - src/liblzma/lzma/lzma_decoder.c  | 14 ++++++++++----
    - src/liblzma/lzma/lzma_decoder.h  |  5 +++++
    - 3 files changed, 17 insertions(+), 9 deletions(-)
    -
    -commit c58f469be5bb9b0bdab825c6687445fd553f4f3a
    -Author: Lasse Collin 
    -Date:   2008-12-01 22:55:18 +0200
    -
    -    Added the changes for Delta filter that should have been
    -    part of 656ec87882ee74b192c4ea4a233a235eca7b04d4.
    -
    - src/liblzma/common/filter_decoder.c | 2 +-
    - src/liblzma/common/filter_encoder.c | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit cd708015202dbf7585b84a8781462a20c42a324b
    -Author: Lasse Collin 
    -Date:   2008-12-01 22:50:28 +0200
    -
    -    LZMA2 decoder cleanups. Make it require new LZMA properties
    -    also in the first LZMA chunk after a dictionary reset in
    -    uncompressed chunk.
    -
    - src/liblzma/lzma/lzma2_decoder.c | 95 +++++++++++++++++-----------------------
    - 1 file changed, 41 insertions(+), 54 deletions(-)
    -
    -commit 656ec87882ee74b192c4ea4a233a235eca7b04d4
    -Author: Lasse Collin 
    -Date:   2008-12-01 16:30:11 +0200
    -
    -    Added lzma_delta_coder_memusage() which also validates
    -    the options.
    -
    - src/liblzma/delta/Makefile.am     |  3 ++-
    - src/liblzma/delta/delta_common.c  | 28 ++++++++++++++++++-------
    - src/liblzma/delta/delta_common.h  | 19 +----------------
    - src/liblzma/delta/delta_decoder.c |  2 +-
    - src/liblzma/delta/delta_decoder.h |  2 +-
    - src/liblzma/delta/delta_encoder.c | 14 ++++---------
    - src/liblzma/delta/delta_encoder.h |  2 +-
    - src/liblzma/delta/delta_private.h | 44 +++++++++++++++++++++++++++++++++++++++
    - 8 files changed, 75 insertions(+), 39 deletions(-)
    -
    -commit 691a9155b7a28882baf37e9d1e969e32e91dbc7a
    -Author: Lasse Collin 
    -Date:   2008-11-29 10:03:49 +0200
    -
    -    Automake includes the m4 directory, so don't add it in
    -    Makefile.am separately.
    -    
    -    Updated THANKS.
    -
    - Makefile.am | 1 -
    - THANKS      | 1 +
    - 2 files changed, 1 insertion(+), 1 deletion(-)
    -
    -commit c7007ddf06ac2b0e018d71d281c21b99f16e7ae0
    -Author: Lasse Collin 
    -Date:   2008-11-28 12:00:48 +0200
    -
    -    Tested using COLUMNS environment variable to avoid broken
    -    progress indicator but since COLUMNS isn't usually available,
    -    the code was left commented out.
    -
    - src/xz/message.c | 14 +++++++++-----
    - 1 file changed, 9 insertions(+), 5 deletions(-)
    -
    -commit ae65dcfde27014e4d811e1a1308aa5d0fe8debbd
    -Author: Lasse Collin 
    -Date:   2008-11-27 19:28:59 +0200
    -
    -    Cleanups to message.c.
    -
    - src/xz/message.c | 47 ++++++++++++++++++-----------------------------
    - 1 file changed, 18 insertions(+), 29 deletions(-)
    -
    -commit a8368b75cdcd5427299001cc42839287f27b244d
    -Author: Lasse Collin 
    -Date:   2008-11-25 02:37:47 +0200
    -
    -    Remove the nowadays unneeded memory limitting malloc() wrapper.
    -
    - src/liblzma/api/Makefile.am         |   1 -
    - src/liblzma/api/lzma.h              |   1 -
    - src/liblzma/api/lzma/memlimit.h     | 207 --------------------------
    - src/liblzma/common/Makefile.am      |   1 -
    - src/liblzma/common/memory_limiter.c | 288 ------------------------------------
    - tests/Makefile.am                   |   2 -
    - tests/test_memlimit.c               | 114 --------------
    - 7 files changed, 614 deletions(-)
    -
    -commit 69472ee5f055a2bb6f28106f0923e1461fd1d080
    -Author: Lasse Collin 
    -Date:   2008-11-23 15:09:03 +0200
    -
    -    VLI encoder and decoder cleanups. Made encoder return
    -    LZMA_PROG_ERROR in single-call mode if there's no output
    -    space.
    -
    - src/liblzma/common/vli_decoder.c | 15 +++++++++------
    - src/liblzma/common/vli_encoder.c | 31 ++++++++++++++++++++++++-------
    - 2 files changed, 33 insertions(+), 13 deletions(-)
    -
    -commit 4249c8c15a08f55b51b7012e6aaafce3aa9eb650
    -Author: Lasse Collin 
    -Date:   2008-11-22 17:44:33 +0200
    -
    -    Typo fix
    -
    - src/xz/process.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 6d1d6f4598d121253dbe1084c6866b66e95c361b
    -Author: Lasse Collin 
    -Date:   2008-11-20 22:59:10 +0200
    -
    -    Support NetBSD's errno for O_NOFOLLOW.
    -
    - src/xz/io.c | 8 ++++++++
    - 1 file changed, 8 insertions(+)
    -
    -commit f901a290eef67b8ea4720ccdf5f46edf775ed9d7
    -Author: Lasse Collin 
    -Date:   2008-11-20 18:05:52 +0200
    -
    -    Build xzdec and lzmadec from xzdec.c. xzdec supports only .xz
    -    files and lzmadec only .lzma files.
    -
    - src/xzdec/Makefile.am |   7 +-
    - src/xzdec/xzdec.c     | 311 ++++++++++++++++++++++----------------------------
    - 2 files changed, 140 insertions(+), 178 deletions(-)
    -
    -commit 86a0ed8f01c8ed44721223f885e679c71b7bb94c
    -Author: Lasse Collin 
    -Date:   2008-11-20 11:01:29 +0200
    -
    -    Minor cleanups to xzdec.
    -
    - src/xzdec/xzdec.c | 20 ++++++++++----------
    - 1 file changed, 10 insertions(+), 10 deletions(-)
    -
    -commit 54f716ba8905d09752dcd1519455a40bd21d5317
    -Author: Lasse Collin 
    -Date:   2008-11-19 23:55:22 +0200
    -
    -    Added missing check for uint16_t.
    -
    - configure.ac | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 1880a3927b23f265f63b2adb86fbdb81ea09eb06
    -Author: Lasse Collin 
    -Date:   2008-11-19 23:52:24 +0200
    -
    -    Renamed lzma to xz and lzmadec to xzdec. We create symlinks
    -    lzma, unlzma, and lzcat in "make install" for backwards
    -    compatibility with LZMA Utils 4.32.x; I'm not sure if this
    -    should be the default though.
    -
    - configure.ac            |   4 +-
    - po/POTFILES.in          |  21 +-
    - src/Makefile.am         |   2 +-
    - src/lzma/Makefile.am    |  72 ----
    - src/lzma/args.c         | 500 ---------------------------
    - src/lzma/args.h         |  56 ---
    - src/lzma/hardware.c     | 122 -------
    - src/lzma/hardware.h     |  45 ---
    - src/lzma/io.c           | 658 -----------------------------------
    - src/lzma/io.h           |  97 ------
    - src/lzma/list.c         | 477 --------------------------
    - src/lzma/main.c         | 402 ----------------------
    - src/lzma/main.h         |  60 ----
    - src/lzma/message.c      | 892 ------------------------------------------------
    - src/lzma/message.h      | 132 -------
    - src/lzma/options.c      | 352 -------------------
    - src/lzma/options.h      |  46 ---
    - src/lzma/private.h      |  52 ---
    - src/lzma/process.c      | 391 ---------------------
    - src/lzma/process.h      |  70 ----
    - src/lzma/suffix.c       | 213 ------------
    - src/lzma/suffix.h       |  40 ---
    - src/lzma/util.c         | 199 -----------
    - src/lzma/util.h         |  71 ----
    - src/lzmadec/Makefile.am |  29 --
    - src/lzmadec/lzmadec.c   | 492 --------------------------
    - src/xz/Makefile.am      |  74 ++++
    - src/xz/args.c           | 500 +++++++++++++++++++++++++++
    - src/xz/args.h           |  56 +++
    - src/xz/hardware.c       | 122 +++++++
    - src/xz/hardware.h       |  45 +++
    - src/xz/io.c             | 658 +++++++++++++++++++++++++++++++++++
    - src/xz/io.h             |  97 ++++++
    - src/xz/list.c           | 477 ++++++++++++++++++++++++++
    - src/xz/main.c           | 402 ++++++++++++++++++++++
    - src/xz/main.h           |  60 ++++
    - src/xz/message.c        | 892 ++++++++++++++++++++++++++++++++++++++++++++++++
    - src/xz/message.h        | 132 +++++++
    - src/xz/options.c        | 352 +++++++++++++++++++
    - src/xz/options.h        |  46 +++
    - src/xz/private.h        |  52 +++
    - src/xz/process.c        | 391 +++++++++++++++++++++
    - src/xz/process.h        |  70 ++++
    - src/xz/suffix.c         | 213 ++++++++++++
    - src/xz/suffix.h         |  40 +++
    - src/xz/util.c           | 199 +++++++++++
    - src/xz/util.h           |  71 ++++
    - src/xzdec/Makefile.am   |  29 ++
    - src/xzdec/xzdec.c       | 492 ++++++++++++++++++++++++++
    - tests/test_compress.sh  |  29 +-
    - tests/test_files.sh     |   4 +-
    - 51 files changed, 5498 insertions(+), 5500 deletions(-)
    -
    -commit e114502b2bc371e4a45449832cb69be036360722
    -Author: Lasse Collin 
    -Date:   2008-11-19 20:46:52 +0200
    -
    -    Oh well, big messy commit again. Some highlights:
    -      - Updated to the latest, probably final file format version.
    -      - Command line tool reworked to not use threads anymore.
    -        Threading will probably go into liblzma anyway.
    -      - Memory usage limit is now about 30 % for uncompression
    -        and about 90 % for compression.
    -      - Progress indicator with --verbose
    -      - Simplified --help and full --long-help
    -      - Upgraded to the last LGPLv2.1+ getopt_long from gnulib.
    -      - Some bug fixes
    -
    - THANKS                                       |   1 +
    - configure.ac                                 |  48 +-
    - debug/full_flush.c                           |   6 +-
    - debug/known_sizes.c                          |   2 +-
    - debug/memusage.c                             |   2 +-
    - debug/sync_flush.c                           |  10 +-
    - doc/file-format.txt                          | 260 ++++----
    - lib/Makefile.am                              |  10 +-
    - lib/getopt.c                                 |  14 +-
    - lib/getopt.in.h                              | 226 +++++++
    - lib/getopt1.c                                |   8 +-
    - lib/getopt_.h                                | 226 -------
    - lib/gettext.h                                | 240 -------
    - m4/getopt.m4                                 |  64 +-
    - src/common/bswap.h                           |  15 +-
    - src/common/physmem.h                         |   4 +
    - src/common/sysdefs.h                         |  12 +-
    - src/liblzma/api/lzma/block.h                 |  47 +-
    - src/liblzma/api/lzma/filter.h                |   8 +
    - src/liblzma/api/lzma/index.h                 |  20 +-
    - src/liblzma/api/lzma/index_hash.h            |   4 +-
    - src/liblzma/common/block_decoder.c           |  59 +-
    - src/liblzma/common/block_encoder.c           |  41 +-
    - src/liblzma/common/block_header_decoder.c    |  31 +-
    - src/liblzma/common/block_header_encoder.c    |  69 +--
    - src/liblzma/common/block_util.c              |  45 +-
    - src/liblzma/common/common.h                  |   8 -
    - src/liblzma/common/filter_common.c           |   4 +-
    - src/liblzma/common/index.c                   | 259 ++++----
    - src/liblzma/common/index.h                   |  33 +-
    - src/liblzma/common/index_decoder.c           |  31 +-
    - src/liblzma/common/index_encoder.c           |  16 +-
    - src/liblzma/common/index_hash.c              |  68 +-
    - src/liblzma/common/stream_decoder.c          |   9 +-
    - src/liblzma/common/stream_encoder.c          |   6 +-
    - src/liblzma/lz/lz_decoder.h                  |   4 +-
    - src/liblzma/subblock/subblock_decoder.c      |   3 +-
    - src/lzma/Makefile.am                         |   9 +-
    - src/lzma/alloc.c                             | 106 ----
    - src/lzma/alloc.h                             |  42 --
    - src/lzma/args.c                              | 531 +++++++---------
    - src/lzma/args.h                              |  42 +-
    - src/lzma/error.c                             | 162 -----
    - src/lzma/error.h                             |  67 --
    - src/lzma/hardware.c                          |  75 ++-
    - src/lzma/hardware.h                          |  16 +-
    - src/lzma/help.c                              | 170 -----
    - src/lzma/help.h                              |  32 -
    - src/lzma/io.c                                | 757 +++++++++++------------
    - src/lzma/io.h                                |  51 +-
    - src/lzma/main.c                              | 392 ++++++++----
    - src/lzma/main.h                              |  60 ++
    - src/lzma/message.c                           | 892 +++++++++++++++++++++++++++
    - src/lzma/message.h                           | 132 ++++
    - src/lzma/options.c                           |  42 +-
    - src/lzma/options.h                           |   6 +-
    - src/lzma/private.h                           |  28 +-
    - src/lzma/process.c                           | 525 ++++++++--------
    - src/lzma/process.h                           |  40 ++
    - src/lzma/suffix.c                            |  52 +-
    - src/lzma/suffix.h                            |  17 +-
    - src/lzma/util.c                              | 100 +--
    - src/lzma/util.h                              |  43 +-
    - src/lzmadec/lzmadec.c                        |  36 +-
    - tests/files/README                           |  12 +-
    - tests/files/bad-1-block_header-1.xz          | Bin 64 -> 64 bytes
    - tests/files/bad-1-block_header-2.xz          | Bin 64 -> 64 bytes
    - tests/files/bad-1-block_header-3.xz          | Bin 68 -> 68 bytes
    - tests/files/bad-1-block_header-4.xz          | Bin 72 -> 76 bytes
    - tests/files/bad-1-block_header-5.xz          | Bin 0 -> 72 bytes
    - tests/files/bad-1-check-crc32.xz             | Bin 68 -> 68 bytes
    - tests/files/bad-1-check-crc64.xz             | Bin 72 -> 72 bytes
    - tests/files/bad-1-check-sha256.xz            | Bin 96 -> 96 bytes
    - tests/files/bad-1-lzma2-1.xz                 | Bin 64 -> 64 bytes
    - tests/files/bad-1-lzma2-2.xz                 | Bin 424 -> 424 bytes
    - tests/files/bad-1-lzma2-3.xz                 | Bin 424 -> 424 bytes
    - tests/files/bad-1-lzma2-4.xz                 | Bin 408 -> 408 bytes
    - tests/files/bad-1-lzma2-5.xz                 | Bin 408 -> 408 bytes
    - tests/files/bad-1-lzma2-6.xz                 | Bin 68 -> 68 bytes
    - tests/files/bad-1-lzma2-7.xz                 | Bin 408 -> 408 bytes
    - tests/files/bad-1-stream_flags-1.xz          | Bin 68 -> 68 bytes
    - tests/files/bad-1-stream_flags-2.xz          | Bin 68 -> 68 bytes
    - tests/files/bad-1-stream_flags-3.xz          | Bin 68 -> 68 bytes
    - tests/files/bad-1-vli-1.xz                   | Bin 72 -> 72 bytes
    - tests/files/bad-1-vli-2.xz                   | Bin 72 -> 76 bytes
    - tests/files/bad-2-compressed_data_padding.xz | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-1.xz                 | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-2.xz                 | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-3.xz                 | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-4.xz                 | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-5.xz                 | Bin 0 -> 92 bytes
    - tests/files/good-1-3delta-lzma2.xz           | Bin 528 -> 528 bytes
    - tests/files/good-1-block_header-1.xz         | Bin 72 -> 72 bytes
    - tests/files/good-1-block_header-2.xz         | Bin 68 -> 68 bytes
    - tests/files/good-1-block_header-3.xz         | Bin 68 -> 68 bytes
    - tests/files/good-1-check-crc32.xz            | Bin 68 -> 68 bytes
    - tests/files/good-1-check-crc64.xz            | Bin 72 -> 72 bytes
    - tests/files/good-1-check-none.xz             | Bin 64 -> 64 bytes
    - tests/files/good-1-check-sha256.xz           | Bin 96 -> 96 bytes
    - tests/files/good-1-delta-lzma2.tiff.xz       | Bin 51312 -> 51316 bytes
    - tests/files/good-1-lzma2-1.xz                | Bin 424 -> 424 bytes
    - tests/files/good-1-lzma2-2.xz                | Bin 424 -> 424 bytes
    - tests/files/good-1-lzma2-3.xz                | Bin 408 -> 408 bytes
    - tests/files/good-1-sparc-lzma2.xz            | Bin 2292 -> 2296 bytes
    - tests/files/good-1-x86-lzma2.xz              | Bin 1936 -> 1936 bytes
    - tests/files/good-2-lzma2.xz                  | Bin 92 -> 92 bytes
    - tests/files/unsupported-block_header.xz      | Bin 68 -> 68 bytes
    - tests/files/unsupported-check.xz             | Bin 68 -> 68 bytes
    - tests/files/unsupported-filter_flags-1.xz    | Bin 68 -> 68 bytes
    - tests/files/unsupported-filter_flags-2.xz    | Bin 68 -> 68 bytes
    - tests/files/unsupported-filter_flags-3.xz    | Bin 68 -> 68 bytes
    - tests/test_block_header.c                    |  16 +-
    - tests/test_index.c                           |  42 +-
    - 113 files changed, 3462 insertions(+), 2946 deletions(-)
    -
    -commit 3c3905b53462ae235c9438d86a4dc51086410932
    -Author: Lasse Collin 
    -Date:   2008-10-09 11:12:29 +0300
    -
    -    Fixed the test that should have been fixed as part
    -    of 1e8e4fd1f3e50129b4541406ad765d2aa1233943.
    -
    - tests/test_block_header.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 0f295bf7a3ece01f667caae318cc3e3424085886
    -Author: Lasse Collin 
    -Date:   2008-10-07 16:42:18 +0300
    -
    -    Fixed some help messages.
    -
    - src/lzma/help.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 1e8e4fd1f3e50129b4541406ad765d2aa1233943
    -Author: Lasse Collin 
    -Date:   2008-10-07 09:40:31 +0300
    -
    -    Made the preset numbering more logical in liblzma API.
    -
    - src/liblzma/api/lzma/container.h        | 20 ++++++++++----------
    - src/liblzma/api/lzma/lzma.h             |  2 +-
    - src/liblzma/lzma/lzma_encoder_presets.c |  3 ++-
    - src/lzma/args.c                         |  8 ++++----
    - src/lzma/args.h                         |  2 +-
    - 5 files changed, 18 insertions(+), 17 deletions(-)
    -
    -commit 5e4df4c3c09c82bbbb1a916784e3dc717ca4ff81
    -Author: Lasse Collin 
    -Date:   2008-10-03 19:36:09 +0300
    -
    -    Removed fi from po/LINGUAS.
    -
    - po/LINGUAS | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit fcfb86c7770328cfffa2e83b176af9a1ba2d9128
    -Author: Lasse Collin 
    -Date:   2008-10-03 07:06:48 +0300
    -
    -    Fixed suffix handling with --format=raw.
    -
    - src/lzma/suffix.c | 28 +++++++++++++++++++---------
    - 1 file changed, 19 insertions(+), 9 deletions(-)
    -
    -commit bd137524f2f50e30ba054f42f1f6536cd3cee920
    -Author: Lasse Collin 
    -Date:   2008-10-02 22:51:46 +0300
    -
    -    Initial changes to change the suffix of the new format to .xz.
    -    This also fixes a bug related to --suffix option. Some issues
    -    with suffixes with --format=raw were not fixed.
    -
    - src/lzma/args.c        | 67 +++++++++++++++++++++++++++++++--------------
    - src/lzma/args.h        | 13 +++++----
    - src/lzma/help.c        |  4 +--
    - src/lzma/process.c     | 24 +++++++++-------
    - src/lzma/suffix.c      | 74 +++++++++++++++++++++++++++++++++++++++++---------
    - tests/test_compress.sh |  3 +-
    - 6 files changed, 133 insertions(+), 52 deletions(-)
    -
    -commit 4c321a41c482821aa3c4d64cdf886a6ed904d844
    -Author: Lasse Collin 
    -Date:   2008-09-30 17:43:55 +0300
    -
    -    Renamed the test files from .lzma suffix to .xz suffix.
    -
    - tests/files/README                             | 128 ++++++++++++-------------
    - tests/files/bad-0-backward_size.lzma           | Bin 32 -> 0 bytes
    - tests/files/bad-0-backward_size.xz             | Bin 0 -> 32 bytes
    - tests/files/bad-0-empty-truncated.lzma         | Bin 31 -> 0 bytes
    - tests/files/bad-0-empty-truncated.xz           | Bin 0 -> 31 bytes
    - tests/files/bad-0-footer_magic.lzma            | Bin 32 -> 0 bytes
    - tests/files/bad-0-footer_magic.xz              | Bin 0 -> 32 bytes
    - tests/files/bad-0-header_magic.lzma            | Bin 32 -> 0 bytes
    - tests/files/bad-0-header_magic.xz              | Bin 0 -> 32 bytes
    - tests/files/bad-0-nonempty_index.lzma          | Bin 32 -> 0 bytes
    - tests/files/bad-0-nonempty_index.xz            | Bin 0 -> 32 bytes
    - tests/files/bad-0cat-alone.lzma                | Bin 55 -> 0 bytes
    - tests/files/bad-0cat-alone.xz                  | Bin 0 -> 55 bytes
    - tests/files/bad-0cat-header_magic.lzma         | Bin 64 -> 0 bytes
    - tests/files/bad-0cat-header_magic.xz           | Bin 0 -> 64 bytes
    - tests/files/bad-0catpad-empty.lzma             | Bin 69 -> 0 bytes
    - tests/files/bad-0catpad-empty.xz               | Bin 0 -> 69 bytes
    - tests/files/bad-0pad-empty.lzma                | Bin 37 -> 0 bytes
    - tests/files/bad-0pad-empty.xz                  | Bin 0 -> 37 bytes
    - tests/files/bad-1-block_header-1.lzma          | Bin 64 -> 0 bytes
    - tests/files/bad-1-block_header-1.xz            | Bin 0 -> 64 bytes
    - tests/files/bad-1-block_header-2.lzma          | Bin 64 -> 0 bytes
    - tests/files/bad-1-block_header-2.xz            | Bin 0 -> 64 bytes
    - tests/files/bad-1-block_header-3.lzma          | Bin 68 -> 0 bytes
    - tests/files/bad-1-block_header-3.xz            | Bin 0 -> 68 bytes
    - tests/files/bad-1-block_header-4.lzma          | Bin 72 -> 0 bytes
    - tests/files/bad-1-block_header-4.xz            | Bin 0 -> 72 bytes
    - tests/files/bad-1-check-crc32.lzma             | Bin 68 -> 0 bytes
    - tests/files/bad-1-check-crc32.xz               | Bin 0 -> 68 bytes
    - tests/files/bad-1-check-crc64.lzma             | Bin 72 -> 0 bytes
    - tests/files/bad-1-check-crc64.xz               | Bin 0 -> 72 bytes
    - tests/files/bad-1-check-sha256.lzma            | Bin 96 -> 0 bytes
    - tests/files/bad-1-check-sha256.xz              | Bin 0 -> 96 bytes
    - tests/files/bad-1-lzma2-1.lzma                 | Bin 64 -> 0 bytes
    - tests/files/bad-1-lzma2-1.xz                   | Bin 0 -> 64 bytes
    - tests/files/bad-1-lzma2-2.lzma                 | Bin 424 -> 0 bytes
    - tests/files/bad-1-lzma2-2.xz                   | Bin 0 -> 424 bytes
    - tests/files/bad-1-lzma2-3.lzma                 | Bin 424 -> 0 bytes
    - tests/files/bad-1-lzma2-3.xz                   | Bin 0 -> 424 bytes
    - tests/files/bad-1-lzma2-4.lzma                 | Bin 408 -> 0 bytes
    - tests/files/bad-1-lzma2-4.xz                   | Bin 0 -> 408 bytes
    - tests/files/bad-1-lzma2-5.lzma                 | Bin 408 -> 0 bytes
    - tests/files/bad-1-lzma2-5.xz                   | Bin 0 -> 408 bytes
    - tests/files/bad-1-lzma2-6.lzma                 | Bin 68 -> 0 bytes
    - tests/files/bad-1-lzma2-6.xz                   | Bin 0 -> 68 bytes
    - tests/files/bad-1-lzma2-7.lzma                 | Bin 408 -> 0 bytes
    - tests/files/bad-1-lzma2-7.xz                   | Bin 0 -> 408 bytes
    - tests/files/bad-1-stream_flags-1.lzma          | Bin 68 -> 0 bytes
    - tests/files/bad-1-stream_flags-1.xz            | Bin 0 -> 68 bytes
    - tests/files/bad-1-stream_flags-2.lzma          | Bin 68 -> 0 bytes
    - tests/files/bad-1-stream_flags-2.xz            | Bin 0 -> 68 bytes
    - tests/files/bad-1-stream_flags-3.lzma          | Bin 68 -> 0 bytes
    - tests/files/bad-1-stream_flags-3.xz            | Bin 0 -> 68 bytes
    - tests/files/bad-1-vli-1.lzma                   | Bin 72 -> 0 bytes
    - tests/files/bad-1-vli-1.xz                     | Bin 0 -> 72 bytes
    - tests/files/bad-1-vli-2.lzma                   | Bin 72 -> 0 bytes
    - tests/files/bad-1-vli-2.xz                     | Bin 0 -> 72 bytes
    - tests/files/bad-2-compressed_data_padding.lzma | Bin 92 -> 0 bytes
    - tests/files/bad-2-compressed_data_padding.xz   | Bin 0 -> 92 bytes
    - tests/files/bad-2-index-1.lzma                 | Bin 92 -> 0 bytes
    - tests/files/bad-2-index-1.xz                   | Bin 0 -> 92 bytes
    - tests/files/bad-2-index-2.lzma                 | Bin 92 -> 0 bytes
    - tests/files/bad-2-index-2.xz                   | Bin 0 -> 92 bytes
    - tests/files/bad-2-index-3.lzma                 | Bin 92 -> 0 bytes
    - tests/files/bad-2-index-3.xz                   | Bin 0 -> 92 bytes
    - tests/files/bad-2-index-4.lzma                 | Bin 92 -> 0 bytes
    - tests/files/bad-2-index-4.xz                   | Bin 0 -> 92 bytes
    - tests/files/good-0-empty.lzma                  | Bin 32 -> 0 bytes
    - tests/files/good-0-empty.xz                    | Bin 0 -> 32 bytes
    - tests/files/good-0cat-empty.lzma               | Bin 64 -> 0 bytes
    - tests/files/good-0cat-empty.xz                 | Bin 0 -> 64 bytes
    - tests/files/good-0catpad-empty.lzma            | Bin 68 -> 0 bytes
    - tests/files/good-0catpad-empty.xz              | Bin 0 -> 68 bytes
    - tests/files/good-0pad-empty.lzma               | Bin 36 -> 0 bytes
    - tests/files/good-0pad-empty.xz                 | Bin 0 -> 36 bytes
    - tests/files/good-1-3delta-lzma2.lzma           | Bin 528 -> 0 bytes
    - tests/files/good-1-3delta-lzma2.xz             | Bin 0 -> 528 bytes
    - tests/files/good-1-block_header-1.lzma         | Bin 72 -> 0 bytes
    - tests/files/good-1-block_header-1.xz           | Bin 0 -> 72 bytes
    - tests/files/good-1-block_header-2.lzma         | Bin 68 -> 0 bytes
    - tests/files/good-1-block_header-2.xz           | Bin 0 -> 68 bytes
    - tests/files/good-1-block_header-3.lzma         | Bin 68 -> 0 bytes
    - tests/files/good-1-block_header-3.xz           | Bin 0 -> 68 bytes
    - tests/files/good-1-check-crc32.lzma            | Bin 68 -> 0 bytes
    - tests/files/good-1-check-crc32.xz              | Bin 0 -> 68 bytes
    - tests/files/good-1-check-crc64.lzma            | Bin 72 -> 0 bytes
    - tests/files/good-1-check-crc64.xz              | Bin 0 -> 72 bytes
    - tests/files/good-1-check-none.lzma             | Bin 64 -> 0 bytes
    - tests/files/good-1-check-none.xz               | Bin 0 -> 64 bytes
    - tests/files/good-1-check-sha256.lzma           | Bin 96 -> 0 bytes
    - tests/files/good-1-check-sha256.xz             | Bin 0 -> 96 bytes
    - tests/files/good-1-delta-lzma2.tiff.lzma       | Bin 51312 -> 0 bytes
    - tests/files/good-1-delta-lzma2.tiff.xz         | Bin 0 -> 51312 bytes
    - tests/files/good-1-lzma2-1.lzma                | Bin 424 -> 0 bytes
    - tests/files/good-1-lzma2-1.xz                  | Bin 0 -> 424 bytes
    - tests/files/good-1-lzma2-2.lzma                | Bin 424 -> 0 bytes
    - tests/files/good-1-lzma2-2.xz                  | Bin 0 -> 424 bytes
    - tests/files/good-1-lzma2-3.lzma                | Bin 408 -> 0 bytes
    - tests/files/good-1-lzma2-3.xz                  | Bin 0 -> 408 bytes
    - tests/files/good-1-sparc-lzma2.lzma            | Bin 2292 -> 0 bytes
    - tests/files/good-1-sparc-lzma2.xz              | Bin 0 -> 2292 bytes
    - tests/files/good-1-x86-lzma2.lzma              | Bin 1936 -> 0 bytes
    - tests/files/good-1-x86-lzma2.xz                | Bin 0 -> 1936 bytes
    - tests/files/good-2-lzma2.lzma                  | Bin 92 -> 0 bytes
    - tests/files/good-2-lzma2.xz                    | Bin 0 -> 92 bytes
    - tests/files/unsupported-block_header.lzma      | Bin 68 -> 0 bytes
    - tests/files/unsupported-block_header.xz        | Bin 0 -> 68 bytes
    - tests/files/unsupported-check.lzma             | Bin 68 -> 0 bytes
    - tests/files/unsupported-check.xz               | Bin 0 -> 68 bytes
    - tests/files/unsupported-filter_flags-1.lzma    | Bin 68 -> 0 bytes
    - tests/files/unsupported-filter_flags-1.xz      | Bin 0 -> 68 bytes
    - tests/files/unsupported-filter_flags-2.lzma    | Bin 68 -> 0 bytes
    - tests/files/unsupported-filter_flags-2.xz      | Bin 0 -> 68 bytes
    - tests/files/unsupported-filter_flags-3.lzma    | Bin 68 -> 0 bytes
    - tests/files/unsupported-filter_flags-3.xz      | Bin 0 -> 68 bytes
    - tests/test_files.sh                            |   6 +-
    - 116 files changed, 66 insertions(+), 68 deletions(-)
    -
    -commit 8e60c889a2816a63013a35c99ce26bf28f5b78eb
    -Author: Lasse Collin 
    -Date:   2008-09-30 13:57:44 +0300
    -
    -    Fixed Stream decoder to actually use the first_stream variable.
    -
    - src/liblzma/common/stream_decoder.c | 5 +++++
    - 1 file changed, 5 insertions(+)
    -
    -commit 3bdbc12c054d1961133ee19802af7dd3c3494543
    -Author: Lasse Collin 
    -Date:   2008-09-30 13:56:57 +0300
    -
    -    Added one more test file.
    -
    - tests/files/README                     |  15 +++++++++++----
    - tests/files/bad-0cat-header_magic.lzma | Bin 0 -> 64 bytes
    - 2 files changed, 11 insertions(+), 4 deletions(-)
    -
    -commit a6639022fdc536e5659b070a465221b4cf7c51fa
    -Author: Lasse Collin 
    -Date:   2008-09-30 13:34:07 +0300
    -
    -    Fixed uninitialized variable in Stream decoder.
    -
    - src/liblzma/common/stream_decoder.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit ed3709000a3f17ecefab29b2235d7e2221b00003
    -Author: Lasse Collin 
    -Date:   2008-09-30 13:27:28 +0300
    -
    -    Added two test files.
    -
    - tests/files/README                  |   6 ++++++
    - tests/files/bad-0-footer_magic.lzma | Bin 0 -> 32 bytes
    - tests/files/bad-0-header_magic.lzma | Bin 0 -> 32 bytes
    - 3 files changed, 6 insertions(+)
    -
    -commit ea560b0ea80525752bdcd0074d24f8dc170bbe29
    -Author: Lasse Collin 
    -Date:   2008-09-27 23:49:24 +0300
    -
    -    Fix conflicting Subblock helper filter's ID.
    -
    - src/liblzma/common/common.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit ad97483b6e55142fd8d5c041db057017a891cd95
    -Author: Lasse Collin 
    -Date:   2008-09-27 23:37:13 +0300
    -
    -    Changed magic bytes to match the updated spec. Filename
    -    suffix wasn't changed yet.
    -
    - src/liblzma/common/auto_decoder.c              |   4 ++--
    - src/liblzma/common/stream_flags_common.c       |   2 +-
    - tests/files/bad-0-backward_size.lzma           | Bin 32 -> 32 bytes
    - tests/files/bad-0-empty-truncated.lzma         | Bin 31 -> 31 bytes
    - tests/files/bad-0-nonempty_index.lzma          | Bin 32 -> 32 bytes
    - tests/files/bad-0cat-alone.lzma                | Bin 55 -> 55 bytes
    - tests/files/bad-0catpad-empty.lzma             | Bin 69 -> 69 bytes
    - tests/files/bad-0pad-empty.lzma                | Bin 37 -> 37 bytes
    - tests/files/bad-1-block_header-1.lzma          | Bin 64 -> 64 bytes
    - tests/files/bad-1-block_header-2.lzma          | Bin 64 -> 64 bytes
    - tests/files/bad-1-block_header-3.lzma          | Bin 68 -> 68 bytes
    - tests/files/bad-1-block_header-4.lzma          | Bin 72 -> 72 bytes
    - tests/files/bad-1-check-crc32.lzma             | Bin 68 -> 68 bytes
    - tests/files/bad-1-check-crc64.lzma             | Bin 72 -> 72 bytes
    - tests/files/bad-1-check-sha256.lzma            | Bin 96 -> 96 bytes
    - tests/files/bad-1-lzma2-1.lzma                 | Bin 64 -> 64 bytes
    - tests/files/bad-1-lzma2-2.lzma                 | Bin 424 -> 424 bytes
    - tests/files/bad-1-lzma2-3.lzma                 | Bin 424 -> 424 bytes
    - tests/files/bad-1-lzma2-4.lzma                 | Bin 408 -> 408 bytes
    - tests/files/bad-1-lzma2-5.lzma                 | Bin 408 -> 408 bytes
    - tests/files/bad-1-lzma2-6.lzma                 | Bin 68 -> 68 bytes
    - tests/files/bad-1-lzma2-7.lzma                 | Bin 408 -> 408 bytes
    - tests/files/bad-1-stream_flags-1.lzma          | Bin 68 -> 68 bytes
    - tests/files/bad-1-stream_flags-2.lzma          | Bin 68 -> 68 bytes
    - tests/files/bad-1-stream_flags-3.lzma          | Bin 68 -> 68 bytes
    - tests/files/bad-1-vli-1.lzma                   | Bin 72 -> 72 bytes
    - tests/files/bad-1-vli-2.lzma                   | Bin 72 -> 72 bytes
    - tests/files/bad-2-compressed_data_padding.lzma | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-1.lzma                 | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-2.lzma                 | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-3.lzma                 | Bin 92 -> 92 bytes
    - tests/files/bad-2-index-4.lzma                 | Bin 92 -> 92 bytes
    - tests/files/good-0-empty.lzma                  | Bin 32 -> 32 bytes
    - tests/files/good-0cat-empty.lzma               | Bin 64 -> 64 bytes
    - tests/files/good-0catpad-empty.lzma            | Bin 68 -> 68 bytes
    - tests/files/good-0pad-empty.lzma               | Bin 36 -> 36 bytes
    - tests/files/good-1-3delta-lzma2.lzma           | Bin 528 -> 528 bytes
    - tests/files/good-1-block_header-1.lzma         | Bin 72 -> 72 bytes
    - tests/files/good-1-block_header-2.lzma         | Bin 68 -> 68 bytes
    - tests/files/good-1-block_header-3.lzma         | Bin 68 -> 68 bytes
    - tests/files/good-1-check-crc32.lzma            | Bin 68 -> 68 bytes
    - tests/files/good-1-check-crc64.lzma            | Bin 72 -> 72 bytes
    - tests/files/good-1-check-none.lzma             | Bin 64 -> 64 bytes
    - tests/files/good-1-check-sha256.lzma           | Bin 96 -> 96 bytes
    - tests/files/good-1-delta-lzma2.tiff.lzma       | Bin 51312 -> 51312 bytes
    - tests/files/good-1-lzma2-1.lzma                | Bin 424 -> 424 bytes
    - tests/files/good-1-lzma2-2.lzma                | Bin 424 -> 424 bytes
    - tests/files/good-1-lzma2-3.lzma                | Bin 408 -> 408 bytes
    - tests/files/good-1-sparc-lzma2.lzma            | Bin 2292 -> 2292 bytes
    - tests/files/good-1-x86-lzma2.lzma              | Bin 1936 -> 1936 bytes
    - tests/files/good-2-lzma2.lzma                  | Bin 92 -> 92 bytes
    - tests/files/unsupported-block_header.lzma      | Bin 68 -> 68 bytes
    - tests/files/unsupported-check.lzma             | Bin 68 -> 68 bytes
    - tests/files/unsupported-filter_flags-1.lzma    | Bin 68 -> 68 bytes
    - tests/files/unsupported-filter_flags-2.lzma    | Bin 68 -> 68 bytes
    - tests/files/unsupported-filter_flags-3.lzma    | Bin 68 -> 68 bytes
    - 56 files changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 7a57069167e9e63394e2b095ee3a63253fcb51c7
    -Author: Lasse Collin 
    -Date:   2008-09-27 23:16:09 +0300
    -
    -    Remove po/fi.po since I'm not keeping it updated for now.
    -
    - po/fi.po | 446 ---------------------------------------------------------------
    - 1 file changed, 446 deletions(-)
    -
    -commit 018ae09df8f2fee5a7374f307df4cb42fad0b81e
    -Author: Lasse Collin 
    -Date:   2008-09-27 23:13:54 +0300
    -
    -    Fix also test_compress.sh.
    -
    - tests/test_compress.sh | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 3a62a5fb85d2eebd8666e64ed5d364d095062858
    -Author: Lasse Collin 
    -Date:   2008-09-27 23:01:15 +0300
    -
    -    Fixed compilation of test_filter_flags.c, which was broken by
    -    1dcecfb09b55157b8653d747963069c8bed74f04.
    -
    - tests/test_filter_flags.c | 16 ++++++++--------
    - 1 file changed, 8 insertions(+), 8 deletions(-)
    -
    -commit c6ca26eef7cd07eba449035514e2b8f9ac3111c0
    -Author: Lasse Collin 
    -Date:   2008-09-27 19:11:02 +0300
    -
    -    Updated file format specification. It changes the suffix
    -    of the new format to .xz and removes the recently added
    -    LZMA filter.
    -
    - doc/file-format.txt | 125 ++++++++++++++--------------------------------------
    - 1 file changed, 32 insertions(+), 93 deletions(-)
    -
    -commit 1dcecfb09b55157b8653d747963069c8bed74f04
    -Author: Lasse Collin 
    -Date:   2008-09-27 19:09:21 +0300
    -
    -    Some API changes, bug fixes, cleanups etc.
    -
    - configure.ac                                   |  18 +-
    - debug/full_flush.c                             |   7 +-
    - debug/known_sizes.c                            |   6 +-
    - debug/memusage.c                               |  22 +--
    - debug/sync_flush.c                             |  18 +-
    - src/liblzma/Makefile.am                        |   2 +-
    - src/liblzma/api/lzma/delta.h                   |   8 +-
    - src/liblzma/api/lzma/lzma.h                    | 230 ++++++++++++++++---------
    - src/liblzma/common/alignment.c                 |   7 +-
    - src/liblzma/common/alone_decoder.c             |  11 +-
    - src/liblzma/common/alone_encoder.c             |   9 +-
    - src/liblzma/common/chunk_size.c                |   2 +-
    - src/liblzma/common/easy.c                      |  20 ++-
    - src/liblzma/common/filter_common.c             |   4 +-
    - src/liblzma/common/filter_decoder.c            |   4 +-
    - src/liblzma/common/filter_encoder.c            |   4 +-
    - src/liblzma/common/init_encoder.c              |   2 +-
    - src/liblzma/delta/delta_common.c               |  12 +-
    - src/liblzma/delta/delta_common.h               |   2 +-
    - src/liblzma/delta/delta_decoder.c              |   2 +-
    - src/liblzma/delta/delta_encoder.c              |   6 +-
    - src/liblzma/lz/lz_encoder.c                    |  30 ++--
    - src/liblzma/lz/lz_encoder.h                    |  26 +--
    - src/liblzma/lz/lz_encoder_mf.c                 |  30 ++--
    - src/liblzma/lzma/Makefile.am                   |   4 +-
    - src/liblzma/lzma/lzma2_decoder.c               |  10 +-
    - src/liblzma/lzma/lzma2_encoder.c               |  27 ++-
    - src/liblzma/lzma/lzma_common.h                 |  26 ++-
    - src/liblzma/lzma/lzma_decoder.c                |  37 ++--
    - src/liblzma/lzma/lzma_encoder.c                |  51 +++---
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c   |  10 +-
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c |  20 +--
    - src/liblzma/lzma/lzma_encoder_presets.c        |  50 ++++--
    - src/liblzma/rangecoder/Makefile.am             |   4 +-
    - src/liblzma/subblock/subblock_decoder.c        |   2 +-
    - src/lzma/args.c                                |  33 ++--
    - src/lzma/help.c                                |  17 +-
    - src/lzma/options.c                             |  92 +++++-----
    - tests/test_block_header.c                      |   9 +-
    - tests/test_compress.sh                         |   4 +-
    - tests/test_filter_flags.c                      |   2 +-
    - 41 files changed, 482 insertions(+), 398 deletions(-)
    -
    -commit 5cc5064cae603b649c64c40125c7dd365de54c9d
    -Author: Lasse Collin 
    -Date:   2008-09-27 11:28:49 +0300
    -
    -    Added 7z2lzma.bash.
    -
    - extra/7z2lzma/7z2lzma.bash | 114 +++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 114 insertions(+)
    -
    -commit f147666a5cd15542d4e427da58629f4a71cc38e1
    -Author: Lasse Collin 
    -Date:   2008-09-17 22:11:39 +0300
    -
    -    Miscellaneous LZ and LZMA encoder cleanups
    -
    - src/liblzma/api/lzma/lzma.h              | 14 -------
    - src/liblzma/lz/lz_encoder.c              |  8 +++-
    - src/liblzma/lzma/Makefile.am             |  1 -
    - src/liblzma/lzma/lzma_encoder.c          | 64 ++++++++++++--------------------
    - src/liblzma/lzma/lzma_encoder_features.c | 59 -----------------------------
    - 5 files changed, 29 insertions(+), 117 deletions(-)
    -
    -commit 13d68b069849e19c33822cd8996cd6447890abb1
    -Author: Lasse Collin 
    -Date:   2008-09-13 13:54:00 +0300
    -
    -    LZ decoder cleanup
    -
    - src/liblzma/lz/lz_decoder.c | 5 ++---
    - 1 file changed, 2 insertions(+), 3 deletions(-)
    -
    -commit 13a74b78e37f16c9096ba5fe1859cc04eaa2f9f7
    -Author: Lasse Collin 
    -Date:   2008-09-13 12:10:43 +0300
    -
    -    Renamed constants:
    -      - LZMA_VLI_VALUE_MAX -> LZMA_VLI_MAX
    -      - LZMA_VLI_VALUE_UNKNOWN -> LZMA_VLI_UNKNOWN
    -      - LZMA_HEADER_ERRRO -> LZMA_OPTIONS_ERROR
    -
    - debug/full_flush.c                        |  2 +-
    - debug/known_sizes.c                       |  2 +-
    - debug/sync_flush.c                        |  2 +-
    - src/liblzma/api/lzma/alignment.h          |  2 +-
    - src/liblzma/api/lzma/base.h               |  4 ++--
    - src/liblzma/api/lzma/block.h              | 28 ++++++++++++++--------------
    - src/liblzma/api/lzma/container.h          | 12 ++++++------
    - src/liblzma/api/lzma/filter.h             | 28 ++++++++++++++--------------
    - src/liblzma/api/lzma/index.h              |  2 +-
    - src/liblzma/api/lzma/lzma.h               |  4 ++--
    - src/liblzma/api/lzma/simple.h             |  2 +-
    - src/liblzma/api/lzma/stream_flags.h       | 20 ++++++++++----------
    - src/liblzma/api/lzma/vli.h                | 16 ++++++++--------
    - src/liblzma/common/alignment.c            |  6 +++---
    - src/liblzma/common/alone_decoder.c        |  2 +-
    - src/liblzma/common/auto_decoder.c         |  2 +-
    - src/liblzma/common/block_decoder.c        | 12 ++++++------
    - src/liblzma/common/block_encoder.c        |  6 +++---
    - src/liblzma/common/block_header_decoder.c | 16 ++++++++--------
    - src/liblzma/common/block_header_encoder.c | 24 ++++++++++++------------
    - src/liblzma/common/block_util.c           |  8 ++++----
    - src/liblzma/common/chunk_size.c           |  2 +-
    - src/liblzma/common/easy.c                 |  4 ++--
    - src/liblzma/common/filter_common.c        | 22 +++++++++++-----------
    - src/liblzma/common/filter_decoder.c       |  6 +++---
    - src/liblzma/common/filter_encoder.c       | 14 +++++++-------
    - src/liblzma/common/index.c                | 24 +++++++++++-------------
    - src/liblzma/common/index.h                |  2 +-
    - src/liblzma/common/index_hash.c           | 13 ++++++-------
    - src/liblzma/common/stream_decoder.c       |  4 ++--
    - src/liblzma/common/stream_encoder.c       |  4 ++--
    - src/liblzma/common/stream_flags_common.c  |  6 +++---
    - src/liblzma/common/stream_flags_decoder.c |  6 +++---
    - src/liblzma/common/stream_flags_encoder.c |  4 ++--
    - src/liblzma/common/vli_encoder.c          |  2 +-
    - src/liblzma/common/vli_size.c             |  2 +-
    - src/liblzma/delta/delta_common.c          |  2 +-
    - src/liblzma/delta/delta_decoder.c         |  2 +-
    - src/liblzma/delta/delta_encoder.c         |  2 +-
    - src/liblzma/lz/lz_decoder.c               |  2 +-
    - src/liblzma/lz/lz_encoder.c               |  2 +-
    - src/liblzma/lzma/lzma2_decoder.c          |  6 +++---
    - src/liblzma/lzma/lzma_decoder.c           | 14 +++++++-------
    - src/liblzma/lzma/lzma_encoder.c           |  8 ++++----
    - src/liblzma/simple/simple_coder.c         |  2 +-
    - src/liblzma/simple/simple_decoder.c       |  2 +-
    - src/liblzma/subblock/subblock_decoder.c   |  6 +++---
    - src/liblzma/subblock/subblock_encoder.c   | 17 ++++++++---------
    - src/lzma/args.c                           |  2 +-
    - src/lzma/error.c                          |  2 +-
    - src/lzma/list.c                           |  6 +++---
    - src/lzmadec/lzmadec.c                     |  2 +-
    - tests/test_block.c                        |  8 ++++----
    - tests/test_block_header.c                 | 30 +++++++++++++++---------------
    - tests/test_filter_flags.c                 |  2 +-
    - tests/test_index.c                        |  2 +-
    - tests/test_stream_flags.c                 |  8 ++++----
    - tests/tests.h                             |  2 +-
    - 58 files changed, 220 insertions(+), 224 deletions(-)
    -
    -commit 320601b2c7b08fc7da9da18d5bf7c3c1a189b080
    -Author: Lasse Collin 
    -Date:   2008-09-12 22:41:40 +0300
    -
    -    Improved the Stream Flags handling API.
    -
    - src/liblzma/api/lzma/stream_flags.h       | 84 +++++++++++++++++++++++++++++--
    - src/liblzma/common/stream_decoder.c       |  5 +-
    - src/liblzma/common/stream_encoder.c       |  2 +
    - src/liblzma/common/stream_flags_common.c  | 28 ++++++++---
    - src/liblzma/common/stream_flags_common.h  |  9 ++++
    - src/liblzma/common/stream_flags_decoder.c |  3 +-
    - src/liblzma/common/stream_flags_encoder.c | 10 ++--
    - tests/test_stream_flags.c                 |  8 ++-
    - 8 files changed, 129 insertions(+), 20 deletions(-)
    -
    -commit ec490da5228263b25bf786bb23d1008468f55b30
    -Author: Lasse Collin 
    -Date:   2008-09-11 23:10:44 +0300
    -
    -    Simplified debug/known_sizes.c to match the relaxed
    -    requirements of Block encoder.
    -
    - debug/known_sizes.c | 14 +++++---------
    - 1 file changed, 5 insertions(+), 9 deletions(-)
    -
    -commit 16e8b98f2659347edfa74afdbbb9e73311153cb9
    -Author: Lasse Collin 
    -Date:   2008-09-11 23:09:24 +0300
    -
    -    Remove a check from Block encoder that should have already
    -    been removed in 2ba01bfa755e47ff6af84a978e3c8d63d7d2775e.
    -
    - src/liblzma/common/block_encoder.c | 5 -----
    - 1 file changed, 5 deletions(-)
    -
    -commit 5a710c3805bdf6d7e3c92e954e4e4565b27bcb13
    -Author: Lasse Collin 
    -Date:   2008-09-11 20:02:38 +0300
    -
    -    Remove bogus #includes.
    -
    - src/liblzma/common/Makefile.am            |  1 -
    - src/liblzma/common/stream_decoder.c       |  3 ---
    - src/liblzma/common/stream_encoder.c       |  1 -
    - src/liblzma/common/stream_flags_decoder.h | 31 -------------------------------
    - 4 files changed, 36 deletions(-)
    -
    -commit 01892b2ca5f69bed0ea746e04b604030d57806bb
    -Author: Lasse Collin 
    -Date:   2008-09-11 10:49:14 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 962f2231d49409fe6852e44ffe8c5dbabb04bc7d
    -Author: Lasse Collin 
    -Date:   2008-09-11 10:48:12 +0300
    -
    -    Fix a compiler error on big endian systems that don't
    -    support unaligned memory access.
    -
    - src/common/integer.h | 32 ++++++++++++++++++--------------
    - 1 file changed, 18 insertions(+), 14 deletions(-)
    -
    -commit fa3ab0df8ae7a8a1ad55b52266dc0fd387458671
    -Author: Lasse Collin 
    -Date:   2008-09-11 10:46:14 +0300
    -
    -    Silence a compiler warning.
    -
    - src/lzma/process.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 9373e81e18822db4972819442ea4c2cb9955470b
    -Author: Lasse Collin 
    -Date:   2008-09-10 19:16:32 +0300
    -
    -    Bumped version to 4.999.6alpha.
    -
    - configure.ac                   | 2 +-
    - src/liblzma/api/lzma/version.h | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit cb072b7c8442ba68bb0c62c0abbbe939794887a3
    -Author: Lasse Collin 
    -Date:   2008-09-10 17:02:00 +0300
    -
    -    Check for LZMA_FILTER_RESERVED_START in filter_flags_encoder.c.
    -    Use LZMA_PROG_ERROR instead of LZMA_HEADER_ERROR if the Filter ID
    -    is in the reserved range. This allows Block Header encoder to
    -    detect unallowed Filter IDs, which is good for Stream encoder.
    -
    - src/liblzma/common/filter_flags_encoder.c | 7 ++++---
    - 1 file changed, 4 insertions(+), 3 deletions(-)
    -
    -commit 123ab0acec435c9e9866a99e30482116cfbd9ba5
    -Author: Lasse Collin 
    -Date:   2008-09-10 16:44:32 +0300
    -
    -    Filter handling cleanups
    -
    - src/liblzma/api/lzma/filter.h       | 133 +++++++++++++++++++++++++++---------
    - src/liblzma/common/filter_common.h  |   3 +
    - src/liblzma/common/filter_decoder.c |  80 +++++++---------------
    - src/liblzma/common/filter_decoder.h |   5 --
    - src/liblzma/common/filter_encoder.c |  82 +++++++---------------
    - src/liblzma/common/filter_encoder.h |   4 --
    - 6 files changed, 156 insertions(+), 151 deletions(-)
    -
    -commit 9cfcd0c4f2f865d8fbbb46ea28344a9be0dd8ad1
    -Author: Lasse Collin 
    -Date:   2008-09-10 00:33:00 +0300
    -
    -    Comments
    -
    - src/liblzma/common/stream_encoder.c | 6 +++++-
    - 1 file changed, 5 insertions(+), 1 deletion(-)
    -
    -commit 2ba01bfa755e47ff6af84a978e3c8d63d7d2775e
    -Author: Lasse Collin 
    -Date:   2008-09-10 00:27:02 +0300
    -
    -    Cleaned up Block encoder and moved the no longer shared
    -    code from block_private.h to block_decoder.c. Now the Block
    -    encoder doesn't need compressed_size and uncompressed_size
    -    from lzma_block structure to be initialized.
    -
    - src/liblzma/api/lzma/block.h       |  3 --
    - src/liblzma/common/Makefile.am     |  1 -
    - src/liblzma/common/block_decoder.c | 23 +++++++++-
    - src/liblzma/common/block_encoder.c | 92 ++++++++++++++++++--------------------
    - src/liblzma/common/block_private.h | 47 -------------------
    - 5 files changed, 66 insertions(+), 100 deletions(-)
    -
    -commit 07efcb5a6bc5d7018798ebd728586f84183e7d64
    -Author: Lasse Collin 
    -Date:   2008-09-07 10:23:13 +0300
    -
    -    Changed Filter ID of LZMA to 0x20.
    -
    - doc/file-format.txt         | 4 ++--
    - src/liblzma/api/lzma/lzma.h | 2 +-
    - 2 files changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 32fe5fa541e82c08e054086279079ae5016bd8d8
    -Author: Lasse Collin 
    -Date:   2008-09-06 23:42:50 +0300
    -
    -    Comments
    -
    - src/liblzma/api/lzma/base.h      | 81 ++++++++++++++++++++++++++--------------
    - src/liblzma/api/lzma/container.h |  6 ++-
    - src/liblzma/lz/lz_encoder.c      |  3 +-
    - src/liblzma/lz/lz_encoder.h      | 12 +++---
    - src/liblzma/lz/lz_encoder_mf.c   |  2 +-
    - 5 files changed, 65 insertions(+), 39 deletions(-)
    -
    -commit 0a31ed9d5e3cde4feb094b66f3a8b2c074605d84
    -Author: Lasse Collin 
    -Date:   2008-09-06 15:14:30 +0300
    -
    -    Some API cleanups
    -
    - src/liblzma/api/lzma/base.h         | 314 +++++++++++++++++++++++-------------
    - src/liblzma/api/lzma/check.h        |  10 ++
    - src/liblzma/api/lzma/container.h    |  40 +++--
    - src/liblzma/common/auto_decoder.c   |  18 +--
    - src/liblzma/common/common.c         |   7 +
    - src/liblzma/common/common.h         |  18 ++-
    - src/liblzma/common/easy.c           |   2 +-
    - src/liblzma/common/stream_decoder.c |  31 ++--
    - src/lzma/process.c                  |   2 +-
    - src/lzmadec/lzmadec.c               |   6 +-
    - tests/tests.h                       |  72 +++------
    - 11 files changed, 301 insertions(+), 219 deletions(-)
    -
    -commit da98df54400998be2a6c3876f9655a3c51b93c10
    -Author: Lasse Collin 
    -Date:   2008-09-04 11:53:06 +0300
    -
    -    Added support for raw encoding and decoding to the command
    -    line tool, and made various cleanups. --lzma was renamed to
    -    --lzma1 to prevent people from accidentally using LZMA when
    -    they want LZMA2.
    -
    - src/lzma/args.c    | 17 +++++++++--------
    - src/lzma/args.h    |  1 +
    - src/lzma/help.c    | 24 ++++++------------------
    - src/lzma/process.c | 42 ++++++++++++++++++++++++++++++++++--------
    - 4 files changed, 50 insertions(+), 34 deletions(-)
    -
    -commit 2496aee8a7741a8a0d42987db41ff2cf1a4bdabd
    -Author: Lasse Collin 
    -Date:   2008-09-04 10:39:15 +0300
    -
    -    Don't allow LZMA_SYNC_FLUSH with decoders anymore. There's
    -    simply nothing that would use it. Allow LZMA_FINISH to the
    -    decoders, which will usually ignore it (auto decoder and
    -    Stream decoder being exceptions).
    -
    - src/liblzma/common/alone_decoder.c  | 1 -
    - src/liblzma/common/block_decoder.c  | 2 +-
    - src/liblzma/common/filter_decoder.c | 2 +-
    - 3 files changed, 2 insertions(+), 3 deletions(-)
    -
    -commit bea301c26d5d52675e11e0236faec0492af98f60
    -Author: Lasse Collin 
    -Date:   2008-09-03 17:06:25 +0300
    -
    -    Minor updates to the file format specification.
    -
    - doc/file-format.txt | 105 ++++++++++++++++++++++++++++++++++++++++++----------
    - 1 file changed, 85 insertions(+), 20 deletions(-)
    -
    -commit 9c75b089b4a9e0edcf4cf7970a4383768707d6c8
    -Author: Lasse Collin 
    -Date:   2008-09-02 19:33:32 +0300
    -
    -    Command line tool fixes
    -
    - src/lzma/process.c | 21 +++++++++++++--------
    - 1 file changed, 13 insertions(+), 8 deletions(-)
    -
    -commit bab0590504b5aeff460ab4ca8c964dd7c1bad9e4
    -Author: Lasse Collin 
    -Date:   2008-09-02 19:31:42 +0300
    -
    -    Auto decoder cleanup
    -
    - src/liblzma/common/auto_decoder.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 689602336d126a46b60d791a67decab65e1e81f5
    -Author: Lasse Collin 
    -Date:   2008-09-02 19:12:12 +0300
    -
    -    Updated auto decoder to handle LZMA_CONCATENATED when decoding
    -    LZMA_Alone files. Decoding of concatenated LZMA_Alone files is
    -    intentionally not supported, so it is better to put this in
    -    auto decoder than LZMA_Alone decoder.
    -
    - src/liblzma/common/auto_decoder.c | 87 ++++++++++++++++++++++++++++++++-------
    - 1 file changed, 71 insertions(+), 16 deletions(-)
    -
    -commit 80c4158f19904026433eb6f5d5ca98a0ecd4f66c
    -Author: Lasse Collin 
    -Date:   2008-09-02 14:56:52 +0300
    -
    -    Stream decoder cleanups
    -
    - src/liblzma/common/stream_decoder.c | 57 +++++++++++++++++++++----------------
    - 1 file changed, 32 insertions(+), 25 deletions(-)
    -
    -commit fc681657450ce57be1fe08f7a15d31dcc705e514
    -Author: Lasse Collin 
    -Date:   2008-09-02 11:45:39 +0300
    -
    -    Some fixes to LZ encoder.
    -
    - src/liblzma/lz/lz_encoder.c    | 56 ++++++++++++++++++++-----
    - src/liblzma/lz/lz_encoder.h    | 18 ++++----
    - src/liblzma/lz/lz_encoder_mf.c | 95 +++++++++++++++++-------------------------
    - 3 files changed, 94 insertions(+), 75 deletions(-)
    -
    -commit ede675f9ac1ca82a7d7c290324adba672118bc8d
    -Author: Lasse Collin 
    -Date:   2008-08-31 11:47:01 +0300
    -
    -    Fix wrong pointer calculation in LZMA encoder.
    -
    - src/liblzma/lzma/lzma_encoder.c | 4 +++-
    - 1 file changed, 3 insertions(+), 1 deletion(-)
    -
    -commit 3b34851de1eaf358cf9268922fa0eeed8278d680
    -Author: Lasse Collin 
    -Date:   2008-08-28 22:53:15 +0300
    -
    -    Sort of garbage collection commit. :-| Many things are still
    -    broken. API has changed a lot and it will still change a
    -    little more here and there. The command line tool doesn't
    -    have all the required changes to reflect the API changes, so
    -    it's easy to get "internal error" or trigger assertions.
    -
    - configure.ac                                       |  356 +++---
    - debug/Makefile.am                                  |    5 +-
    - debug/crc32.c                                      |   45 +
    - debug/full_flush.c                                 |   14 +-
    - debug/hex2bin.c                                    |   54 +
    - debug/known_sizes.c                                |  135 ++
    - debug/memusage.c                                   |    8 +-
    - debug/sync_flush.c                                 |   20 +-
    - src/common/integer.h                               |   26 +-
    - src/common/sysdefs.h                               |   42 +-
    - src/liblzma/Makefile.am                            |   17 +-
    - src/liblzma/api/Makefile.am                        |    6 +-
    - src/liblzma/api/lzma.h                             |  161 ++-
    - src/liblzma/api/lzma/alignment.h                   |    6 +-
    - src/liblzma/api/lzma/alone.h                       |   52 -
    - src/liblzma/api/lzma/auto.h                        |   36 -
    - src/liblzma/api/lzma/base.h                        |   61 +-
    - src/liblzma/api/lzma/block.h                       |   38 +-
    - src/liblzma/api/lzma/check.h                       |   41 +-
    - src/liblzma/api/lzma/container.h                   |  252 ++++
    - src/liblzma/api/lzma/delta.h                       |   36 +-
    - src/liblzma/api/lzma/easy.h                        |  121 --
    - src/liblzma/api/lzma/filter.h                      |   74 +-
    - src/liblzma/api/lzma/index.h                       |   40 +-
    - src/liblzma/api/lzma/index_hash.h                  |   12 +-
    - src/liblzma/api/lzma/lzma.h                        |  222 ++--
    - src/liblzma/api/lzma/memlimit.h                    |   15 +-
    - src/liblzma/api/lzma/raw.h                         |   60 -
    - src/liblzma/api/lzma/simple.h                      |    2 +-
    - src/liblzma/api/lzma/stream.h                      |   53 -
    - src/liblzma/api/lzma/stream_flags.h                |   17 +-
    - src/liblzma/api/lzma/subblock.h                    |    4 +-
    - src/liblzma/api/lzma/version.h                     |   10 +-
    - src/liblzma/api/lzma/vli.h                         |  131 +-
    - src/liblzma/check/check.c                          |  128 +-
    - src/liblzma/check/check.h                          |   67 +-
    - src/liblzma/check/sha256.c                         |   29 +-
    - src/liblzma/common/Makefile.am                     |   51 +-
    - src/liblzma/common/alignment.c                     |    4 +-
    - src/liblzma/common/allocator.c                     |   58 -
    - src/liblzma/common/alone_decoder.c                 |   49 +-
    - src/liblzma/common/alone_decoder.h                 |    9 +-
    - src/liblzma/common/alone_encoder.c                 |   13 +-
    - src/liblzma/common/auto_decoder.c                  |   38 +-
    - src/liblzma/common/block_decoder.c                 |   67 +-
    - src/liblzma/common/block_decoder.h                 |    2 +-
    - src/liblzma/common/block_encoder.c                 |   42 +-
    - src/liblzma/common/block_encoder.h                 |    2 +-
    - src/liblzma/common/block_header_decoder.c          |    6 +-
    - src/liblzma/common/block_header_encoder.c          |    9 +-
    - src/liblzma/common/block_util.c                    |   10 +-
    - src/liblzma/common/code.c                          |  203 ---
    - src/liblzma/common/common.c                        |  298 +++++
    - src/liblzma/common/common.h                        |  237 ++--
    - src/liblzma/common/delta_common.c                  |   66 -
    - src/liblzma/common/delta_common.h                  |   44 -
    - src/liblzma/common/delta_decoder.c                 |   61 -
    - src/liblzma/common/delta_decoder.h                 |   28 -
    - src/liblzma/common/delta_encoder.c                 |   98 --
    - src/liblzma/common/delta_encoder.h                 |   28 -
    - src/liblzma/common/easy.c                          |   18 +-
    - src/liblzma/common/features.c                      |   66 -
    - src/liblzma/common/filter_common.c                 |  262 ++++
    - src/liblzma/common/filter_common.h                 |   52 +
    - src/liblzma/common/filter_decoder.c                |  236 ++++
    - src/liblzma/common/filter_decoder.h                |   35 +
    - src/liblzma/common/filter_encoder.c                |  308 +++++
    - src/liblzma/common/filter_encoder.h                |   38 +
    - src/liblzma/common/filter_flags_decoder.c          |  185 +--
    - src/liblzma/common/filter_flags_encoder.c          |  261 +---
    - src/liblzma/common/index_decoder.c                 |   14 +-
    - src/liblzma/common/index_encoder.c                 |   16 +-
    - src/liblzma/common/index_hash.c                    |    8 +-
    - src/liblzma/common/init_encoder.c                  |    2 +-
    - src/liblzma/common/memory_usage.c                  |  112 --
    - src/liblzma/common/next_coder.c                    |   65 -
    - src/liblzma/common/raw_common.c                    |  127 --
    - src/liblzma/common/raw_common.h                    |   30 -
    - src/liblzma/common/raw_decoder.c                   |  116 --
    - src/liblzma/common/raw_decoder.h                   |   29 -
    - src/liblzma/common/raw_encoder.c                   |  111 --
    - src/liblzma/common/raw_encoder.h                   |   29 -
    - src/liblzma/common/stream_common.c                 |   23 -
    - src/liblzma/common/stream_common.h                 |   31 -
    - src/liblzma/common/stream_decoder.c                |  238 +++-
    - src/liblzma/common/stream_decoder.h                |    4 +-
    - src/liblzma/common/stream_encoder.c                |   35 +-
    - src/liblzma/common/stream_encoder.h                |    2 +-
    - src/liblzma/common/stream_flags_common.c           |   40 +
    - src/liblzma/common/stream_flags_common.h           |   31 +
    - src/liblzma/common/stream_flags_decoder.c          |    2 +-
    - src/liblzma/common/stream_flags_encoder.c          |    2 +-
    - src/liblzma/common/stream_flags_equal.c            |   36 -
    - src/liblzma/common/version.c                       |   25 -
    - src/liblzma/common/vli_decoder.c                   |   29 +-
    - src/liblzma/common/vli_encoder.c                   |   23 +-
    - src/liblzma/common/vli_size.c                      |   37 +
    - src/liblzma/delta/Makefile.am                      |   34 +
    - src/liblzma/delta/delta_common.c                   |   66 +
    - src/liblzma/delta/delta_common.h                   |   44 +
    - src/liblzma/delta/delta_decoder.c                  |   82 ++
    - src/liblzma/delta/delta_decoder.h                  |   32 +
    - src/liblzma/delta/delta_encoder.c                  |  119 ++
    - src/liblzma/delta/delta_encoder.h                  |   30 +
    - src/liblzma/lz/Makefile.am                         |   35 +-
    - src/liblzma/lz/bt2.c                               |   27 -
    - src/liblzma/lz/bt2.h                               |   31 -
    - src/liblzma/lz/bt3.c                               |   29 -
    - src/liblzma/lz/bt3.h                               |   31 -
    - src/liblzma/lz/bt4.c                               |   30 -
    - src/liblzma/lz/bt4.h                               |   31 -
    - src/liblzma/lz/hc3.c                               |   30 -
    - src/liblzma/lz/hc3.h                               |   31 -
    - src/liblzma/lz/hc4.c                               |   31 -
    - src/liblzma/lz/hc4.h                               |   31 -
    - src/liblzma/lz/lz_decoder.c                        |  547 +++-----
    - src/liblzma/lz/lz_decoder.h                        |  308 ++---
    - src/liblzma/lz/lz_encoder.c                        |  780 ++++++------
    - src/liblzma/lz/lz_encoder.h                        |  334 +++--
    - src/liblzma/lz/lz_encoder_hash.h                   |  104 ++
    - src/liblzma/lz/lz_encoder_mf.c                     |  780 ++++++++++++
    - src/liblzma/lz/lz_encoder_private.h                |   40 -
    - src/liblzma/lz/match_c.h                           |  412 ------
    - src/liblzma/lz/match_h.h                           |   69 --
    - src/liblzma/lzma/Makefile.am                       |   37 +-
    - src/liblzma/lzma/fastpos.h                         |    8 +-
    - src/liblzma/lzma/lzma2_decoder.c                   |  318 +++++
    - src/liblzma/lzma/lzma2_decoder.h                   |   35 +
    - src/liblzma/lzma/lzma2_encoder.c                   |  406 ++++++
    - src/liblzma/lzma/lzma2_encoder.h                   |   34 +
    - src/liblzma/lzma/lzma_common.h                     |  208 +++-
    - src/liblzma/lzma/lzma_decoder.c                    | 1306 ++++++++++++--------
    - src/liblzma/lzma/lzma_decoder.h                    |   21 +-
    - src/liblzma/lzma/lzma_encoder.c                    |  576 +++++++--
    - src/liblzma/lzma/lzma_encoder.h                    |   38 +-
    - src/liblzma/lzma/lzma_encoder_features.c           |    2 +-
    - src/liblzma/lzma/lzma_encoder_getoptimum.c         |  925 --------------
    - src/liblzma/lzma/lzma_encoder_getoptimumfast.c     |  201 ---
    - src/liblzma/lzma/lzma_encoder_init.c               |  228 ----
    - src/liblzma/lzma/lzma_encoder_optimum_fast.c       |  193 +++
    - src/liblzma/lzma/lzma_encoder_optimum_normal.c     |  875 +++++++++++++
    - src/liblzma/lzma/lzma_encoder_presets.c            |   52 +-
    - src/liblzma/lzma/lzma_encoder_private.h            |  174 +--
    - src/liblzma/lzma/lzma_literal.c                    |   51 -
    - src/liblzma/lzma/lzma_literal.h                    |   71 --
    - src/liblzma/rangecoder/Makefile.am                 |   10 +-
    - src/liblzma/rangecoder/price.h                     |  111 ++
    - src/liblzma/rangecoder/price_table.c               |   84 +-
    - src/liblzma/rangecoder/price_table_gen.c           |   55 -
    - src/liblzma/rangecoder/price_table_init.c          |   33 +-
    - src/liblzma/rangecoder/price_tablegen.c            |   56 +
    - src/liblzma/rangecoder/range_common.h              |   17 +-
    - src/liblzma/rangecoder/range_decoder.h             |  209 ++--
    - src/liblzma/rangecoder/range_encoder.h             |   92 +-
    - src/liblzma/simple/Makefile.am                     |   12 +
    - src/liblzma/simple/simple_coder.c                  |    8 +-
    - src/liblzma/simple/simple_decoder.c                |   47 +
    - src/liblzma/simple/simple_decoder.h                |   29 +
    - src/liblzma/simple/simple_encoder.c                |   45 +
    - src/liblzma/simple/simple_encoder.h                |   30 +
    - src/liblzma/subblock/Makefile.am                   |    4 +-
    - src/liblzma/subblock/subblock_decoder.c            |   20 +-
    - src/liblzma/subblock/subblock_decoder_helper.c     |    2 +-
    - src/liblzma/subblock/subblock_encoder.c            |   28 +-
    - src/lzma/args.c                                    |   35 +-
    - src/lzma/args.h                                    |    4 +-
    - src/lzma/options.c                                 |   14 +-
    - src/lzma/process.c                                 |   88 +-
    - src/lzmadec/lzmadec.c                              |  157 +--
    - tests/Makefile.am                                  |    1 +
    - tests/files/README                                 |  303 ++---
    - tests/files/bad-0-backward_size.lzma               |  Bin 0 -> 32 bytes
    - tests/files/bad-0-empty-truncated.lzma             |  Bin 0 -> 31 bytes
    - tests/files/bad-0-nonempty_index.lzma              |  Bin 0 -> 32 bytes
    - tests/files/bad-0cat-alone.lzma                    |  Bin 0 -> 55 bytes
    - tests/files/bad-0catpad-empty.lzma                 |  Bin 0 -> 69 bytes
    - tests/files/bad-0pad-empty.lzma                    |  Bin 0 -> 37 bytes
    - tests/files/bad-1-block_header-1.lzma              |  Bin 0 -> 64 bytes
    - tests/files/bad-1-block_header-2.lzma              |  Bin 0 -> 64 bytes
    - tests/files/bad-1-block_header-3.lzma              |  Bin 0 -> 68 bytes
    - tests/files/bad-1-block_header-4.lzma              |  Bin 0 -> 72 bytes
    - tests/files/bad-1-check-crc32.lzma                 |  Bin 0 -> 68 bytes
    - tests/files/bad-1-check-crc64.lzma                 |  Bin 0 -> 72 bytes
    - tests/files/bad-1-check-sha256.lzma                |  Bin 0 -> 96 bytes
    - tests/files/bad-1-lzma2-1.lzma                     |  Bin 0 -> 64 bytes
    - tests/files/bad-1-lzma2-2.lzma                     |  Bin 0 -> 424 bytes
    - tests/files/bad-1-lzma2-3.lzma                     |  Bin 0 -> 424 bytes
    - tests/files/bad-1-lzma2-4.lzma                     |  Bin 0 -> 408 bytes
    - tests/files/bad-1-lzma2-5.lzma                     |  Bin 0 -> 408 bytes
    - tests/files/bad-1-lzma2-6.lzma                     |  Bin 0 -> 68 bytes
    - tests/files/bad-1-lzma2-7.lzma                     |  Bin 0 -> 408 bytes
    - tests/files/bad-1-stream_flags-1.lzma              |  Bin 0 -> 68 bytes
    - tests/files/bad-1-stream_flags-2.lzma              |  Bin 0 -> 68 bytes
    - tests/files/bad-1-stream_flags-3.lzma              |  Bin 0 -> 68 bytes
    - tests/files/bad-1-vli-1.lzma                       |  Bin 0 -> 72 bytes
    - tests/files/bad-1-vli-2.lzma                       |  Bin 0 -> 72 bytes
    - tests/files/bad-2-compressed_data_padding.lzma     |  Bin 0 -> 92 bytes
    - tests/files/bad-2-index-1.lzma                     |  Bin 0 -> 92 bytes
    - tests/files/bad-2-index-2.lzma                     |  Bin 0 -> 92 bytes
    - tests/files/bad-2-index-3.lzma                     |  Bin 0 -> 92 bytes
    - tests/files/bad-2-index-4.lzma                     |  Bin 0 -> 92 bytes
    - tests/files/bad-cat-single-none-pad_garbage_1.lzma |  Bin 65 -> 0 bytes
    - tests/files/bad-cat-single-none-pad_garbage_2.lzma |  Bin 65 -> 0 bytes
    - tests/files/bad-cat-single-none-pad_garbage_3.lzma |  Bin 65 -> 0 bytes
    - tests/files/bad-multi-none-1.lzma                  |  Bin 54 -> 0 bytes
    - tests/files/bad-multi-none-2.lzma                  |  Bin 53 -> 0 bytes
    - tests/files/bad-multi-none-3.lzma                  |  Bin 53 -> 0 bytes
    - tests/files/bad-multi-none-block_1.lzma            |  Bin 66 -> 0 bytes
    - tests/files/bad-multi-none-block_2.lzma            |  Bin 66 -> 0 bytes
    - tests/files/bad-multi-none-block_3.lzma            |  Bin 58 -> 0 bytes
    - tests/files/bad-multi-none-extra_1.lzma            |  Bin 54 -> 0 bytes
    - tests/files/bad-multi-none-extra_2.lzma            |  Bin 54 -> 0 bytes
    - tests/files/bad-multi-none-extra_3.lzma            |  Bin 55 -> 0 bytes
    - tests/files/bad-multi-none-header_1.lzma           |  Bin 57 -> 0 bytes
    - tests/files/bad-multi-none-header_2.lzma           |  Bin 61 -> 0 bytes
    - tests/files/bad-multi-none-header_3.lzma           |  Bin 59 -> 0 bytes
    - tests/files/bad-multi-none-header_4.lzma           |  Bin 59 -> 0 bytes
    - tests/files/bad-multi-none-header_5.lzma           |  Bin 58 -> 0 bytes
    - tests/files/bad-multi-none-header_6.lzma           |  Bin 59 -> 0 bytes
    - tests/files/bad-multi-none-header_7.lzma           |  Bin 59 -> 0 bytes
    - tests/files/bad-multi-none-index_1.lzma            |  Bin 51 -> 0 bytes
    - tests/files/bad-multi-none-index_2.lzma            |  Bin 49 -> 0 bytes
    - tests/files/bad-multi-none-index_3.lzma            |  Bin 51 -> 0 bytes
    - tests/files/bad-multi-none-index_4.lzma            |  Bin 51 -> 0 bytes
    - tests/files/bad-single-data_after_eopm_1.lzma      |  Bin 55 -> 0 bytes
    - tests/files/bad-single-data_after_eopm_2.lzma      |  Bin 56 -> 0 bytes
    - tests/files/bad-single-lzma-flush_beginning.lzma   |  Bin 53 -> 0 bytes
    - tests/files/bad-single-lzma-flush_twice.lzma       |  Bin 63 -> 0 bytes
    - tests/files/bad-single-none-empty.lzma             |  Bin 19 -> 0 bytes
    - .../files/bad-single-none-footer_filter_flags.lzma |  Bin 30 -> 0 bytes
    - tests/files/bad-single-none-too_long_vli.lzma      |  Bin 39 -> 0 bytes
    - tests/files/bad-single-none-truncated.lzma         |  Bin 29 -> 0 bytes
    - tests/files/bad-single-subblock-padding_loop.lzma  |  Bin 43 -> 0 bytes
    - tests/files/bad-single-subblock1023-slow.lzma      |  Bin 7886 -> 0 bytes
    - tests/files/bad-single-subblock_subblock.lzma      |  Bin 26 -> 0 bytes
    - tests/files/good-0-empty.lzma                      |  Bin 0 -> 32 bytes
    - tests/files/good-0cat-empty.lzma                   |  Bin 0 -> 64 bytes
    - tests/files/good-0catpad-empty.lzma                |  Bin 0 -> 68 bytes
    - tests/files/good-0pad-empty.lzma                   |  Bin 0 -> 36 bytes
    - tests/files/good-1-3delta-lzma2.lzma               |  Bin 0 -> 528 bytes
    - tests/files/good-1-block_header-1.lzma             |  Bin 0 -> 72 bytes
    - tests/files/good-1-block_header-2.lzma             |  Bin 0 -> 68 bytes
    - tests/files/good-1-block_header-3.lzma             |  Bin 0 -> 68 bytes
    - tests/files/good-1-check-crc32.lzma                |  Bin 0 -> 68 bytes
    - tests/files/good-1-check-crc64.lzma                |  Bin 0 -> 72 bytes
    - tests/files/good-1-check-none.lzma                 |  Bin 0 -> 64 bytes
    - tests/files/good-1-check-sha256.lzma               |  Bin 0 -> 96 bytes
    - tests/files/good-1-delta-lzma2.tiff.lzma           |  Bin 0 -> 51312 bytes
    - tests/files/good-1-lzma2-1.lzma                    |  Bin 0 -> 424 bytes
    - tests/files/good-1-lzma2-2.lzma                    |  Bin 0 -> 424 bytes
    - tests/files/good-1-lzma2-3.lzma                    |  Bin 0 -> 408 bytes
    - tests/files/good-1-sparc-lzma2.lzma                |  Bin 0 -> 2292 bytes
    - tests/files/good-1-x86-lzma2.lzma                  |  Bin 0 -> 1936 bytes
    - tests/files/good-2-lzma2.lzma                      |  Bin 0 -> 92 bytes
    - tests/files/good-cat-single-none-pad.lzma          |  Bin 64 -> 0 bytes
    - tests/files/good-multi-none-1.lzma                 |  Bin 75 -> 0 bytes
    - tests/files/good-multi-none-2.lzma                 |  Bin 53 -> 0 bytes
    - tests/files/good-multi-none-block_1.lzma           |  Bin 66 -> 0 bytes
    - tests/files/good-multi-none-block_2.lzma           |  Bin 58 -> 0 bytes
    - tests/files/good-multi-none-extra_1.lzma           |  Bin 51 -> 0 bytes
    - tests/files/good-multi-none-extra_2.lzma           |  Bin 79 -> 0 bytes
    - tests/files/good-multi-none-extra_3.lzma           |  Bin 55 -> 0 bytes
    - tests/files/good-multi-none-header_1.lzma          |  Bin 58 -> 0 bytes
    - tests/files/good-multi-none-header_2.lzma          |  Bin 66 -> 0 bytes
    - tests/files/good-multi-none-header_3.lzma          |  Bin 59 -> 0 bytes
    - tests/files/good-single-delta-lzma.tiff.lzma       |  Bin 51409 -> 0 bytes
    - tests/files/good-single-lzma-empty.lzma            |  Bin 21 -> 0 bytes
    - tests/files/good-single-lzma-flush_1.lzma          |  Bin 48 -> 0 bytes
    - tests/files/good-single-lzma-flush_2.lzma          |  Bin 63 -> 0 bytes
    - tests/files/good-single-lzma.lzma                  |  Bin 44 -> 0 bytes
    - tests/files/good-single-none-empty_1.lzma          |  Bin 18 -> 0 bytes
    - tests/files/good-single-none-empty_2.lzma          |  Bin 26 -> 0 bytes
    - tests/files/good-single-none-empty_3.lzma          |  Bin 19 -> 0 bytes
    - tests/files/good-single-none-pad.lzma              |  Bin 32 -> 0 bytes
    - tests/files/good-single-none.lzma                  |  Bin 30 -> 0 bytes
    - tests/files/good-single-sparc-lzma.lzma            |  Bin 2263 -> 0 bytes
    - tests/files/good-single-subblock-lzma.lzma         |  Bin 50 -> 0 bytes
    - tests/files/good-single-subblock_implicit.lzma     |  Bin 35 -> 0 bytes
    - tests/files/good-single-subblock_rle.lzma          |  Bin 118 -> 0 bytes
    - tests/files/good-single-x86-lzma.lzma              |  Bin 1909 -> 0 bytes
    - tests/files/malicious-multi-metadata-64PiB.lzma    |  Bin 51 -> 0 bytes
    - tests/files/malicious-single-subblock-256MiB.lzma  |  Bin 30 -> 0 bytes
    - tests/files/malicious-single-subblock-64PiB.lzma   |  Bin 45 -> 0 bytes
    - tests/files/malicious-single-subblock31-slow.lzma  |  Bin 1233 -> 0 bytes
    - tests/files/unsupported-block_header.lzma          |  Bin 0 -> 68 bytes
    - tests/files/unsupported-check.lzma                 |  Bin 0 -> 68 bytes
    - tests/files/unsupported-filter_flags-1.lzma        |  Bin 0 -> 68 bytes
    - tests/files/unsupported-filter_flags-2.lzma        |  Bin 0 -> 68 bytes
    - tests/files/unsupported-filter_flags-3.lzma        |  Bin 0 -> 68 bytes
    - tests/test_block_header.c                          |   28 +-
    - tests/test_compress.sh                             |    4 +-
    - tests/test_filter_flags.c                          |   51 +-
    - tests/test_stream_flags.c                          |    4 +-
    - tests/tests.h                                      |    8 +
    - 294 files changed, 9768 insertions(+), 8195 deletions(-)
    -
    -commit 57b9a145a527f0716822615e5ed536d33aebd3fc
    -Author: Lasse Collin 
    -Date:   2008-06-20 17:16:32 +0300
    -
    -    Fix test_filter_flags to match the new restriction of lc+lp.
    -
    - tests/test_filter_flags.c | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit eaafc4367c77ec1d910e16d11b4da293969d97a3
    -Author: Lasse Collin 
    -Date:   2008-06-20 16:19:54 +0300
    -
    -    Remove some redundant code from LZMA encoder.
    -
    - src/liblzma/lzma/lzma_encoder.c | 15 +--------------
    - 1 file changed, 1 insertion(+), 14 deletions(-)
    -
    -commit 0809c46534fa5664fe35d9e98d95e87312ed130e
    -Author: Lasse Collin 
    -Date:   2008-06-19 16:35:08 +0300
    -
    -    Add limit of lc + lp <= 4. Now we can allocate the
    -    literal coder as part of the main LZMA encoder or
    -    decoder structure.
    -    
    -    Make the LZMA decoder to rely on the current internal API
    -    to free the allocated memory in case an error occurs.
    -
    - src/liblzma/api/lzma/lzma.h             | 10 +++++-
    - src/liblzma/lzma/lzma_decoder.c         | 57 ++++++++-------------------------
    - src/liblzma/lzma/lzma_encoder_init.c    | 13 ++++----
    - src/liblzma/lzma/lzma_encoder_private.h |  2 +-
    - src/liblzma/lzma/lzma_literal.c         | 39 +++++-----------------
    - src/liblzma/lzma/lzma_literal.h         | 13 +++-----
    - 6 files changed, 43 insertions(+), 91 deletions(-)
    -
    -commit d25ab1b96178f06a0e724f58e3cd68300b2b1275
    -Author: Lasse Collin 
    -Date:   2008-06-18 21:45:19 +0300
    -
    -    Comments
    -
    - src/liblzma/lzma/lzma_encoder.c | 7 ++-----
    - 1 file changed, 2 insertions(+), 5 deletions(-)
    -
    -commit 6368a2fa5901c75864be5171dd57a50af7adbb41
    -Author: Lasse Collin 
    -Date:   2008-06-18 19:19:02 +0300
    -
    -    Delete old code that was supposed to be already deleted
    -    from test_block_header.c.
    -
    - tests/test_block_header.c | 30 ------------------------------
    - 1 file changed, 30 deletions(-)
    -
    -commit 7d17818cec8597f847b0a2537fde991bbc3d9e96
    -Author: Lasse Collin 
    -Date:   2008-06-18 18:02:10 +0300
    -
    -    Update the code to mostly match the new simpler file format
    -    specification. Simplify things by removing most of the
    -    support for known uncompressed size in most places.
    -    There are some miscellaneous changes here and there too.
    -    
    -    The API of liblzma has got many changes and still some
    -    more will be done soon. While most of the code has been
    -    updated, some things are not fixed (the command line tool
    -    will choke with invalid filter chain, if nothing else).
    -    
    -    Subblock filter is somewhat broken for now. It will be
    -    updated once the encoded format of the Subblock filter
    -    has been decided.
    -
    - configure.ac                                   |  41 +-
    - debug/full_flush.c                             |  16 +-
    - debug/sync_flush.c                             |  15 +-
    - src/common/bswap.h                             |  44 ++
    - src/common/integer.h                           | 167 +++++
    - src/liblzma/api/Makefile.am                    |   5 +-
    - src/liblzma/api/lzma.h                         |   9 +-
    - src/liblzma/api/lzma/alone.h                   |  32 +-
    - src/liblzma/api/lzma/auto.h                    |   7 +-
    - src/liblzma/api/lzma/base.h                    |  15 +
    - src/liblzma/api/lzma/block.h                   | 306 +++-------
    - src/liblzma/api/lzma/check.h                   |  18 +-
    - src/liblzma/api/lzma/copy.h                    |  29 -
    - src/liblzma/api/lzma/easy.h                    |  61 +-
    - src/liblzma/api/lzma/extra.h                   | 114 ----
    - src/liblzma/api/lzma/filter.h                  |   5 +-
    - src/liblzma/api/lzma/index.h                   | 204 ++++++-
    - src/liblzma/api/lzma/index_hash.h              |  94 +++
    - src/liblzma/api/lzma/info.h                    | 315 ----------
    - src/liblzma/api/lzma/lzma.h                    |   2 +-
    - src/liblzma/api/lzma/metadata.h                | 100 ---
    - src/liblzma/api/lzma/raw.h                     |  20 +-
    - src/liblzma/api/lzma/stream.h                  | 157 +----
    - src/liblzma/api/lzma/stream_flags.h            | 146 +++--
    - src/liblzma/api/lzma/version.h                 |   2 +-
    - src/liblzma/api/lzma/vli.h                     |  83 ++-
    - src/liblzma/check/Makefile.am                  |   1 -
    - src/liblzma/check/check.c                      |  55 +-
    - src/liblzma/check/check.h                      |  47 +-
    - src/liblzma/check/check_byteswap.h             |  43 --
    - src/liblzma/check/crc32_init.c                 |   2 +-
    - src/liblzma/check/crc64_init.c                 |   2 +-
    - src/liblzma/check/crc_macros.h                 |   2 +-
    - src/liblzma/check/sha256.c                     |  53 +-
    - src/liblzma/common/Makefile.am                 |  31 +-
    - src/liblzma/common/alignment.c                 |   5 +-
    - src/liblzma/common/alone_decoder.c             |  77 +--
    - src/liblzma/common/alone_encoder.c             |  99 ++-
    - src/liblzma/common/auto_decoder.c              |  18 +-
    - src/liblzma/common/block_decoder.c             | 298 +++------
    - src/liblzma/common/block_encoder.c             | 228 ++-----
    - src/liblzma/common/block_header_decoder.c      | 400 +++---------
    - src/liblzma/common/block_header_encoder.c      | 207 +++----
    - src/liblzma/common/block_private.h             |  51 +-
    - src/liblzma/common/block_util.c                |  73 +++
    - src/liblzma/common/common.h                    |  44 +-
    - src/liblzma/common/copy_coder.c                | 144 -----
    - src/liblzma/common/copy_coder.h                |  31 -
    - src/liblzma/common/delta_common.c              |   4 -
    - src/liblzma/common/delta_common.h              |   4 -
    - src/liblzma/common/delta_decoder.c             |  55 +-
    - src/liblzma/common/delta_encoder.c             |   7 +-
    - src/liblzma/common/easy.c                      | 122 ++++
    - src/liblzma/common/easy_common.c               |  54 --
    - src/liblzma/common/easy_common.h               |  28 -
    - src/liblzma/common/easy_multi.c                | 103 ----
    - src/liblzma/common/easy_single.c               |  37 --
    - src/liblzma/common/extra.c                     |  34 --
    - src/liblzma/common/features.c                  |   4 -
    - src/liblzma/common/filter_flags_decoder.c      | 384 ++++--------
    - src/liblzma/common/filter_flags_encoder.c      | 120 +---
    - src/liblzma/common/index.c                     | 773 ++++++++++++++++++++---
    - src/liblzma/common/index.h                     |  67 ++
    - src/liblzma/common/index_decoder.c             | 252 ++++++++
    - src/liblzma/common/index_encoder.c             | 222 +++++++
    - src/liblzma/common/index_encoder.h             |  30 +
    - src/liblzma/common/index_hash.c                | 340 +++++++++++
    - src/liblzma/common/info.c                      | 814 -------------------------
    - src/liblzma/common/memory_usage.c              |   1 -
    - src/liblzma/common/metadata_decoder.c          | 578 ------------------
    - src/liblzma/common/metadata_decoder.h          |  31 -
    - src/liblzma/common/metadata_encoder.c          | 435 -------------
    - src/liblzma/common/metadata_encoder.h          |  30 -
    - src/liblzma/common/raw_common.c                | 178 ++----
    - src/liblzma/common/raw_common.h                |   5 +-
    - src/liblzma/common/raw_decoder.c               |  19 +-
    - src/liblzma/common/raw_decoder.h               |   3 +-
    - src/liblzma/common/raw_encoder.c               | 101 +--
    - src/liblzma/common/raw_encoder.h               |   3 +-
    - src/liblzma/common/stream_common.h             |   3 +
    - src/liblzma/common/stream_decoder.c            | 458 +++++---------
    - src/liblzma/common/stream_decoder.h            |  28 +
    - src/liblzma/common/stream_encoder.c            | 282 +++++++++
    - src/liblzma/common/stream_encoder.h            |  30 +
    - src/liblzma/common/stream_encoder_multi.c      | 445 --------------
    - src/liblzma/common/stream_encoder_multi.h      |  26 -
    - src/liblzma/common/stream_encoder_single.c     | 219 -------
    - src/liblzma/common/stream_flags_decoder.c      | 260 ++------
    - src/liblzma/common/stream_flags_encoder.c      |  56 +-
    - src/liblzma/common/stream_flags_equal.c        |  36 ++
    - src/liblzma/common/vli_decoder.c               |  68 ++-
    - src/liblzma/common/vli_encoder.c               |  59 +-
    - src/liblzma/common/vli_reverse_decoder.c       |  55 --
    - src/liblzma/lz/lz_decoder.c                    |   6 +-
    - src/liblzma/lz/lz_decoder.h                    |  10 +-
    - src/liblzma/lzma/lzma_decoder.c                |  13 +-
    - src/liblzma/lzma/lzma_decoder.h                |  10 +-
    - src/liblzma/simple/simple_coder.c              |  29 +-
    - src/liblzma/simple/simple_private.h            |   4 -
    - src/liblzma/subblock/subblock_decoder.c        | 106 +---
    - src/liblzma/subblock/subblock_decoder_helper.c |   5 +-
    - src/liblzma/subblock/subblock_encoder.c        |   8 +-
    - src/lzma/args.c                                |  22 +-
    - src/lzma/args.h                                |   2 -
    - src/lzma/error.c                               |   6 +
    - src/lzma/process.c                             |  26 +-
    - src/lzmadec/lzmadec.c                          |   8 +-
    - tests/Makefile.am                              |   5 +-
    - tests/test_block_header.c                      | 411 +++++--------
    - tests/test_compress.sh                         |  65 +-
    - tests/test_filter_flags.c                      | 116 ++--
    - tests/test_index.c                             | 504 ++++++++++++++-
    - tests/test_info.c                              | 717 ----------------------
    - tests/test_stream_flags.c                      | 134 ++--
    - tests/tests.h                                  |  14 +-
    - 115 files changed, 4846 insertions(+), 8156 deletions(-)
    -
    -commit bf6348d1a3ff09fdc06940468f318f75ffa6af11
    -Author: Lasse Collin 
    -Date:   2008-06-17 15:03:46 +0300
    -
    -    Update the file format specification draft. The new one is
    -    a lot simpler than the previous versions, but it also means
    -    that the existing code will change a lot.
    -
    - doc/file-format.txt | 1794 +++++++++++++++------------------------------------
    - 1 file changed, 508 insertions(+), 1286 deletions(-)
    -
    -commit 803194ddd26f01ff60ba4e9924c6087a56b29827
    -Author: Lasse Collin 
    -Date:   2008-06-11 21:42:47 +0300
    -
    -    Fix uninitialized variable in LZMA encoder. This was
    -    introduced in 369f72fd656f537a9a8e06f13e6d0d4c242be22f.
    -
    - src/liblzma/lzma/lzma_encoder_init.c | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 0ea98e52ba87453497b1355c51f13bad55c8924a
    -Author: Lasse Collin 
    -Date:   2008-06-11 15:08:44 +0300
    -
    -    Improve command line integer parsing a little in lzma and
    -    lzmadec to make them accept also KiB in addition Ki etc.
    -    Fix also memory usage information in lzmadec --help.
    -
    - src/lzma/util.c       | 23 ++++++++++++++---------
    - src/lzmadec/lzmadec.c | 31 ++++++++++++++++++-------------
    - 2 files changed, 32 insertions(+), 22 deletions(-)
    -
    -commit 436fa5fae96d4e35759aed33066060f09ee8c6ef
    -Author: Lasse Collin 
    -Date:   2008-06-10 20:36:12 +0300
    -
    -    s/decompressed/compressed/ in the command line tool's
    -    error message.
    -
    - src/lzma/main.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 369f72fd656f537a9a8e06f13e6d0d4c242be22f
    -Author: Lasse Collin 
    -Date:   2008-06-01 12:48:17 +0300
    -
    -    Fix a buffer overflow in the LZMA encoder. It was due to my
    -    misunderstanding of the code. There's no tiny fix for this
    -    problem, so I also cleaned up the code in general.
    -    
    -    This reduces the speed of the encoder 2-5 % in the fastest
    -    compression mode ("lzma -1"). High compression modes should
    -    have no noticeable performance difference.
    -    
    -    This commit breaks things (especially LZMA_SYNC_FLUSH) but I
    -    will fix them once the new format and LZMA2 has been roughly
    -    implemented. Plain LZMA won't support LZMA_SYNC_FLUSH at all
    -    and won't be supported in the new .lzma format. This may
    -    change still but this is what it looks like now.
    -    
    -    Support for known uncompressed size (that is, LZMA or LZMA2
    -    without EOPM) is likely to go away. This means there will
    -    be API changes.
    -
    - src/liblzma/lz/lz_encoder.c                    | 113 +----
    - src/liblzma/lz/lz_encoder.h                    |  18 +-
    - src/liblzma/lzma/lzma_encoder.c                | 551 ++++++++++++-------------
    - src/liblzma/lzma/lzma_encoder_getoptimum.c     |  59 ++-
    - src/liblzma/lzma/lzma_encoder_getoptimumfast.c |   4 +-
    - src/liblzma/lzma/lzma_encoder_init.c           |   9 +-
    - src/liblzma/lzma/lzma_encoder_private.h        |  15 +-
    - src/liblzma/rangecoder/range_encoder.h         | 383 +++++++++--------
    - 8 files changed, 532 insertions(+), 620 deletions(-)
    -
    -commit e55e0e873ce2511325749d415ae547d62ab5f00d
    -Author: Lasse Collin 
    -Date:   2008-05-30 11:53:41 +0300
    -
    -    Typo fixes from meyering.
    -
    - doc/faq.txt              | 4 ++--
    - doc/liblzma-advanced.txt | 2 +-
    - 2 files changed, 3 insertions(+), 3 deletions(-)
    -
    -commit ed6664146fcbe9cc4a3b23b31632182ed812ea93
    -Author: Lasse Collin 
    -Date:   2008-05-11 14:24:42 +0300
    -
    -    Remove support for pre-C89 libc versions that lack memcpy,
    -    memmove, and memset.
    -
    - configure.ac                   |  2 +-
    - src/common/sysdefs.h           | 15 ++-------------
    - src/liblzma/common/allocator.c |  2 +-
    - 3 files changed, 4 insertions(+), 15 deletions(-)
    -
    -commit b09464bf9ae694afc2d1dc26188ac4e2e8af0a63
    -Author: Lasse Collin 
    -Date:   2008-05-11 14:17:21 +0300
    -
    -    Improved C99 compiler detection in configure.ac. It will
    -    pass -std=gnu99 instead of -std=c99 to GCC now, but -pedantic
    -    should still give warnings about GNU extensions like before
    -    except with some special keywords like asm().
    -
    - configure.ac | 24 ++++++++++++------------
    - 1 file changed, 12 insertions(+), 12 deletions(-)
    -
    -commit 11de5d5267f7a0a7f0a4d34eec147e65eaf9f9cf
    -Author: Lasse Collin 
    -Date:   2008-05-06 15:15:07 +0300
    -
    -    Bunch of grammar fixes from meyering.
    -
    - doc/liblzma-security.txt        | 8 ++++----
    - src/liblzma/api/lzma/memlimit.h | 6 +++---
    - src/lzma/help.c                 | 2 +-
    - tests/files/README              | 2 +-
    - 4 files changed, 9 insertions(+), 9 deletions(-)
    -
    -commit dc192b6343ae36276c85fcf7ef6006147816eadc
    -Author: Lasse Collin 
    -Date:   2008-05-06 13:41:05 +0300
    -
    -    Typo fix
    -
    - src/liblzma/api/lzma/init.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 944b62b93239b27b338d117f2668c0e95849659b
    -Author: Lasse Collin 
    -Date:   2008-05-04 22:29:27 +0300
    -
    -    Don't print an error message on broken pipe unless --verbose
    -    is used.
    -
    - src/lzma/io.c | 15 ++++++++++++++-
    - 1 file changed, 14 insertions(+), 1 deletion(-)
    -
    -commit 8e074349e47ea6832b8fdf9244e581d453733433
    -Author: Lasse Collin 
    -Date:   2008-04-30 22:16:17 +0300
    -
    -    Fix a crash with --format=alone if other filters than LZMA
    -    are specified on the command line.
    -
    - src/lzma/args.c | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit 2f361ac19b7fd3abcd362de4d470e6a9eb495b73
    -Author: Lasse Collin 
    -Date:   2008-04-28 17:08:27 +0300
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 3be21fb12f4cec2cf07799e8960382f4cb375369
    -Author: Lasse Collin 
    -Date:   2008-04-28 17:06:34 +0300
    -
    -    Fixed wrong spelling "limitter" to "limiter". This affects
    -    liblzma's API.
    -
    - doc/liblzma-security.txt             |  14 +-
    - src/liblzma/api/lzma/base.h          |   4 +-
    - src/liblzma/api/lzma/memlimit.h      |  10 +-
    - src/liblzma/api/lzma/stream.h        |   4 +-
    - src/liblzma/common/Makefile.am       |   2 +-
    - src/liblzma/common/memory_limiter.c  | 288 +++++++++++++++++++++++++++++++++++
    - src/liblzma/common/memory_limitter.c | 288 -----------------------------------
    - src/lzma/list.c                      |   6 +-
    - src/lzmadec/lzmadec.c                |  12 +-
    - tests/test_memlimit.c                |   4 +-
    - 10 files changed, 316 insertions(+), 316 deletions(-)
    -
    -commit beeb81060821dfec4e7898e0d44b7900dcb2215e
    -Author: Lasse Collin 
    -Date:   2008-04-25 15:39:50 +0300
    -
    -    Prevent LZ encoder from hanging with known uncompressed
    -    size. The "fix" breaks LZMA_SYNC_FLUSH at end of stream
    -    with known uncompressed size, but since it currently seems
    -    likely that support for encoding with known uncompressed
    -    size will go away anyway, I'm not fixing this problem now.
    -
    - src/liblzma/lz/lz_encoder.c | 9 +++++++--
    - 1 file changed, 7 insertions(+), 2 deletions(-)
    -
    -commit c324325f9f13cdeb92153c5d00962341ba070ca2
    -Author: Lasse Collin 
    -Date:   2008-04-25 13:58:56 +0300
    -
    -    Removed src/liblzma/common/sysdefs.h symlink, which was
    -    annoying, because "make dist" put two copies of sysdefs.h
    -    into the tarball instead of the symlink.
    -
    - src/liblzma/check/crc32_table.c | 2 +-
    - src/liblzma/check/crc64_table.c | 2 +-
    - src/liblzma/common/Makefile.am  | 1 -
    - src/liblzma/common/common.h     | 2 +-
    - src/liblzma/common/sysdefs.h    | 1 -
    - 5 files changed, 3 insertions(+), 5 deletions(-)
    -
    -commit d3ba30243c75c13d094de1793f9c58acdbacc692
    -Author: Lasse Collin 
    -Date:   2008-04-25 13:41:29 +0300
    -
    -    Added memusage.c to debug directory.
    -
    - debug/Makefile.am |  3 ++-
    - debug/memusage.c  | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 57 insertions(+), 1 deletion(-)
    -
    -commit 8f804c29aa8471ccd6438ddca254092b8869ca52
    -Author: Lasse Collin 
    -Date:   2008-04-25 13:32:35 +0300
    -
    -    Bumped version number to 4.999.3alpha. It will become 5.0.0
    -    once we have a stable release (won't be very soon). The
    -    version number is no longer related to version of LZMA SDK.
    -    
    -    Made some small Automake-related changes to toplevel
    -    Makefile.am and configure.ac.
    -
    - Makefile.am                    |  7 +++++--
    - README                         | 29 +++++++++++++++++++++++++++++
    - configure.ac                   |  4 ++--
    - src/liblzma/api/lzma/version.h | 22 ++++++++++------------
    - 4 files changed, 46 insertions(+), 16 deletions(-)
    -
    -commit c99037ea10f121cbacf60c37a36c29768ae53447
    -Author: Lasse Collin 
    -Date:   2008-04-24 20:25:39 +0300
    -
    -    Fix a memory leak by calling free(extra->data) in
    -    lzma_extra_free().
    -
    - src/liblzma/common/extra.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 22ba3b0b5043fa481903482ce85015fe775939e5
    -Author: Lasse Collin 
    -Date:   2008-04-24 20:23:05 +0300
    -
    -    Make unlzma and lzcat symlinks.
    -
    - src/lzma/Makefile.am | 12 ++++++++++++
    - 1 file changed, 12 insertions(+)
    -
    -commit 17c36422d4cbc2c70d5c83ec389406f92cd9e85e
    -Author: Lasse Collin 
    -Date:   2008-04-24 20:20:27 +0300
    -
    -    Fixed a bug in command line option parsing.
    -
    - src/lzma/options.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 283f939974c32c47f05d495e8dea455ec646ed64
    -Author: Lasse Collin 
    -Date:   2008-04-24 20:19:20 +0300
    -
    -    Added two assert()s.
    -
    - src/liblzma/lzma/lzma_encoder.c | 4 +++-
    - 1 file changed, 3 insertions(+), 1 deletion(-)
    -
    -commit eb348a60b6e19a7c093f892434f23c4756973ffd
    -Author: Lasse Collin 
    -Date:   2008-04-24 19:22:53 +0300
    -
    -    Switch to uint16_t as the type of range coder probabilities.
    -
    - src/liblzma/rangecoder/range_common.h | 25 +++++++++++++++++++------
    - 1 file changed, 19 insertions(+), 6 deletions(-)
    -
    -commit 6c5306e312bcfd254cf654f88c04e34ba786df3d
    -Author: Lasse Collin 
    -Date:   2008-04-24 18:39:57 +0300
    -
    -    Fix wrong return type (uint32_t -> bool).
    -
    - src/liblzma/lz/lz_encoder.c | 2 +-
    - src/liblzma/lz/lz_encoder.h | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 712cfe3ebfd24df24d8896b1315c53c3bc4369c8
    -Author: Lasse Collin 
    -Date:   2008-04-24 18:38:00 +0300
    -
    -    Fix data corruption in LZ encoder with LZMA_SYNC_FLUSH.
    -
    - src/liblzma/lz/lz_encoder.c | 16 ++++++++++++++++
    - src/liblzma/lz/lz_encoder.h |  4 ++++
    - src/liblzma/lz/match_c.h    | 23 ++++++++++++++++++-----
    - 3 files changed, 38 insertions(+), 5 deletions(-)
    -
    -commit bc04486e368d20b3027cde625267762aae063965
    -Author: Lasse Collin 
    -Date:   2008-04-24 17:33:01 +0300
    -
    -    Fix fastpos problem in Makefile.am when built with --enable-small.
    -
    - src/liblzma/lzma/Makefile.am | 5 ++++-
    - 1 file changed, 4 insertions(+), 1 deletion(-)
    -
    -commit 7ab493924e0ed590a5121a15ee54038d238880d3
    -Author: Lasse Collin 
    -Date:   2008-04-24 17:30:51 +0300
    -
    -    Use 64-bit integer as range encoder's cache size. This fixes a
    -    theoretical data corruption, which should be very hard to trigger
    -    even intentionally.
    -
    - src/liblzma/rangecoder/range_encoder.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 641998c3e1ecc8b598fe0eb051fab8b9535c291b
    -Author: Lasse Collin 
    -Date:   2008-03-24 16:38:40 +0200
    -
    -    Replaced the range decoder optimization that used arithmetic
    -    right shift with as fast version that doesn't need
    -    arithmetic right shift. Removed the related check from
    -    configure.ac.
    -
    - configure.ac                           |  1 -
    - m4/ax_c_arithmetic_rshift.m4           | 36 -----------------------
    - src/liblzma/rangecoder/range_decoder.h | 53 ++++++++++------------------------
    - 3 files changed, 16 insertions(+), 74 deletions(-)
    -
    -commit ad999efd279d95f1e7ac555b14170e8e9020488c
    -Author: Lasse Collin 
    -Date:   2008-03-22 14:39:34 +0200
    -
    -    Take advantage of arithmetic right shift in range decoder.
    -
    - src/liblzma/rangecoder/range_decoder.h | 52 ++++++++++++++++++++++++----------
    - 1 file changed, 37 insertions(+), 15 deletions(-)
    -
    -commit 03e0e8a0d7228b6ff1f0af39e2c040a4e425973d
    -Author: Lasse Collin 
    -Date:   2008-03-22 14:18:29 +0200
    -
    -    Added autoconf check to detect if we can use arithmetic
    -    right shift for optimizations.
    -
    - configure.ac                 |  1 +
    - m4/ax_c_arithmetic_rshift.m4 | 36 ++++++++++++++++++++++++++++++++++++
    - 2 files changed, 37 insertions(+)
    -
    -commit 7521bbdc83acab834594a22bec50c8e1bd836298
    -Author: Lasse Collin 
    -Date:   2008-03-22 01:26:36 +0200
    -
    -    Update a comment to use the variable name rep_len_decoder.
    -    
    -    (And BTW, the previous commit actually did change the
    -    program logic slightly.)
    -
    - src/liblzma/lzma/lzma_decoder.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 63b74d000eedaebb8485f623e56864ff5ab71064
    -Author: Lasse Collin 
    -Date:   2008-03-22 00:57:33 +0200
    -
    -    Demystified the "state" variable in LZMA code. Use the
    -    word literal instead of char for better consistency.
    -    There are still some names with _char instead of _literal
    -    in lzma_optimum, these may be changed later.
    -    
    -    Renamed length coder variables.
    -    
    -    This commit doesn't change the program logic.
    -
    - src/liblzma/lzma/lzma_common.h             | 69 ++++++++++++++++++++++--------
    - src/liblzma/lzma/lzma_decoder.c            | 47 ++++++++++----------
    - src/liblzma/lzma/lzma_encoder.c            | 14 +++---
    - src/liblzma/lzma/lzma_encoder_getoptimum.c | 34 +++++++--------
    - src/liblzma/lzma/lzma_encoder_init.c       |  5 ++-
    - src/liblzma/lzma/lzma_encoder_private.h    |  8 ++--
    - 6 files changed, 107 insertions(+), 70 deletions(-)
    -
    -commit e6eb0a26757e851cef62b9440319a8e73b015cb9
    -Author: Lasse Collin 
    -Date:   2008-03-14 23:16:11 +0200
    -
    -    Fix data corruption in LZMA encoder. Note that this bug was
    -    specific to liblzma and was *not* present in LZMA SDK.
    -
    - src/liblzma/lzma/lzma_encoder.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 7d516f5129e4373a6d57249d7f608c634c66bf12
    -Author: Lasse Collin 
    -Date:   2008-03-14 21:32:37 +0200
    -
    -    Fix a comment API header.
    -
    - src/liblzma/api/lzma/lzma.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 748d6e4274921a350bd0a317380309717441ef9c
    -Author: Lasse Collin 
    -Date:   2008-03-12 23:14:50 +0200
    -
    -    Make lzma_stream.next_in const. Let's see if anyone complains.
    -
    - src/liblzma/api/lzma/base.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit bfde3b24a5ae25ce53c854762b6148952386b025
    -Author: Lasse Collin 
    -Date:   2008-03-11 15:35:34 +0200
    -
    -    Apply a minor speed optimization to LZMA decoder.
    -
    - src/liblzma/lzma/lzma_decoder.c | 85 +++++++++++++++++++++--------------------
    - 1 file changed, 43 insertions(+), 42 deletions(-)
    -
    -commit f310c50286d9e4e9c6170bb65348c9bb430a65b4
    -Author: Lasse Collin 
    -Date:   2008-03-11 15:17:16 +0200
    -
    -    Initialize the last byte of the dictionary to zero so that
    -    lz_get_byte(lz, 0) returns zero. This was broken by
    -    1a3b21859818e4d8e89a1da99699233c1bfd197d.
    -
    - src/liblzma/lz/lz_decoder.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 5ead36cf7f823093672a4e43c3180b38c9abbaff
    -Author: Lasse Collin 
    -Date:   2008-03-10 15:57:55 +0200
    -
    -    Really fix the price count initialization.
    -
    - src/liblzma/lzma/lzma_encoder_init.c | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit d4d7feb83d1a1ded8f662a82e21e053841ca726c
    -Author: Lasse Collin 
    -Date:   2008-03-10 13:47:17 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 0541c5ea63ef3c0ff85eeddb0a420e56b0c65258
    -Author: Lasse Collin 
    -Date:   2008-03-10 13:46:48 +0200
    -
    -    Initialize align_price_count and match_price_count in
    -    lzma_encoder_init.c. While we don't call
    -    fill_distances_prices() and fill_align_prices() in
    -    lzma_lzma_encoder_init(), we still need to initialize
    -    these two variables so that the fill functions get
    -    called in lzma_encoder_getoptimum.c in the beginning
    -    of a stream.
    -
    - src/liblzma/lzma/lzma_encoder_init.c | 2 ++
    - 1 file changed, 2 insertions(+)
    -
    -commit 596fa1fac72823e4ef5bc26bb53f9090445bf748
    -Author: Lasse Collin 
    -Date:   2008-03-10 13:44:29 +0200
    -
    -    Always initialize lz->temp_size in lz_decoder.c. temp_size did
    -    get initialized as a side-effect after allocating a new decoder,
    -    but not when the decoder was reused.
    -
    - src/liblzma/lz/lz_decoder.c | 11 ++++++-----
    - 1 file changed, 6 insertions(+), 5 deletions(-)
    -
    -commit 45e43e169527e7a98a8c8a821d37bf25822b764d
    -Author: Lasse Collin 
    -Date:   2008-03-10 13:41:25 +0200
    -
    -    Don't fill allocated memory with 0xFD when debugging is
    -    enabled. It hides errors from Valgrind.
    -
    - src/liblzma/common/allocator.c | 7 ++++---
    - 1 file changed, 4 insertions(+), 3 deletions(-)
    -
    -commit c0e19e0662205f81a86da8903cdc325d50635870
    -Author: Lasse Collin 
    -Date:   2008-02-28 10:24:31 +0200
    -
    -    Remove two redundant validity checks from the LZMA decoder.
    -    These are already checked elsewhere, so omitting these
    -    gives (very) tiny speed up.
    -
    - src/liblzma/lzma/lzma_decoder.c | 23 ++++-------------------
    - 1 file changed, 4 insertions(+), 19 deletions(-)
    -
    -commit de7485806284d1614095ae8cb2ebbb5d74c9ac45
    -Author: Lasse Collin 
    -Date:   2008-02-06 13:25:32 +0200
    -
    -    Tiny clean up to file-format.txt.
    -
    - doc/file-format.txt | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 1a3b21859818e4d8e89a1da99699233c1bfd197d
    -Author: Lasse Collin 
    -Date:   2008-02-02 14:51:06 +0200
    -
    -    Don't memzero() the history buffer when initializing LZ
    -    decoder. There's no danger of information leak here, so
    -    it isn't required. Doing memzero() takes a lot of time
    -    with large dictionaries, which could make it easier to
    -    construct DoS attack to consume too much CPU time.
    -
    - src/liblzma/lz/lz_decoder.c | 7 +++----
    - 1 file changed, 3 insertions(+), 4 deletions(-)
    -
    -commit 7e796e312bf644ea95aea0ff85480f47cfa30fc0
    -Author: Lasse Collin 
    -Date:   2008-02-01 08:39:26 +0200
    -
    -    Do uncompressed size validation in raw encoder. This way
    -    it gets done for not only raw encoder, but also Block
    -    and LZMA_Alone encoders.
    -
    - src/liblzma/common/raw_encoder.c | 90 ++++++++++++++++++++++++++++++++--------
    - 1 file changed, 73 insertions(+), 17 deletions(-)
    -
    -commit 7dd48578a3853e0cfab9f1830bc30927173ec4bc
    -Author: Lasse Collin 
    -Date:   2008-02-01 08:32:05 +0200
    -
    -    Avoid unneeded function call in raw_common.c.
    -
    - src/liblzma/common/raw_common.c | 20 +++++++++++---------
    - 1 file changed, 11 insertions(+), 9 deletions(-)
    -
    -commit b596fac963c3ff96f615d4d9b427a213ec341211
    -Author: Lasse Collin 
    -Date:   2008-01-26 21:42:38 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit e9f6e9c075ad93141a568d94f7d4eb0f2edbd6c2
    -Author: Lasse Collin 
    -Date:   2008-01-26 21:40:23 +0200
    -
    -    Added note.GNU-stack to x86 assembler files. It is needed
    -    when using non-executable stack.
    -
    - src/liblzma/check/crc32_x86.S | 9 +++++++++
    - src/liblzma/check/crc64_x86.S | 9 +++++++++
    - 2 files changed, 18 insertions(+)
    -
    -commit 4c7ad179c78f97f68ad548cb40a9dfa6871655ae
    -Author: Lasse Collin 
    -Date:   2008-01-26 19:12:50 +0200
    -
    -    Added api/lzma/easy.h. I had forgot to add this to the
    -    git repo. Thanks to Stephan Kulow.
    -
    - src/liblzma/api/lzma/easy.h | 174 ++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 174 insertions(+)
    -
    -commit 288b232f54c3692cd36f471d4042f51daf3ea79f
    -Author: Lasse Collin 
    -Date:   2008-01-26 11:09:17 +0200
    -
    -    Added more test files.
    -
    - tests/files/README                       |  11 +++++++++++
    - tests/files/bad-multi-none-header_7.lzma | Bin 0 -> 59 bytes
    - tests/files/good-single-sparc-lzma.lzma  | Bin 0 -> 2263 bytes
    - tests/files/good-single-x86-lzma.lzma    | Bin 0 -> 1909 bytes
    - 4 files changed, 11 insertions(+)
    -
    -commit c467b0defccf233d0c79234407bc38d7d09574d3
    -Author: Lasse Collin 
    -Date:   2008-01-26 10:47:55 +0200
    -
    -    Added more test files.
    -
    - tests/files/README                       |   6 ++++++
    - tests/files/bad-multi-none-block_3.lzma  | Bin 0 -> 58 bytes
    - tests/files/good-multi-none-block_2.lzma | Bin 0 -> 58 bytes
    - 3 files changed, 6 insertions(+)
    -
    -commit f9842f712732c482f2def9f24437851e57dd83f8
    -Author: Lasse Collin 
    -Date:   2008-01-26 00:25:34 +0200
    -
    -    Return LZMA_HEADER_ERROR if LZMA_SYNC_FLUSH is used with any
    -    of the so called simple filters. If there is demand, limited
    -    support for LZMA_SYNC_FLUSH may be added in future.
    -    
    -    After this commit, using LZMA_SYNC_FLUSH shouldn't cause
    -    undefined behavior in any situation.
    -
    - src/liblzma/api/lzma/simple.h     | 9 +++++++++
    - src/liblzma/simple/simple_coder.c | 8 ++++++++
    - 2 files changed, 17 insertions(+)
    -
    -commit e988ea1d1a286dd0f27af0657f9665d5cd8573aa
    -Author: Lasse Collin 
    -Date:   2008-01-25 23:50:35 +0200
    -
    -    Added more Multi-Block test files. Improved some
    -    descriptions in the test files' README.
    -
    - tests/files/README                       |  34 +++++++++++++++++++++++++------
    - tests/files/bad-multi-none-block_1.lzma  | Bin 0 -> 66 bytes
    - tests/files/bad-multi-none-block_2.lzma  | Bin 0 -> 66 bytes
    - tests/files/good-multi-none-block_1.lzma | Bin 0 -> 66 bytes
    - 4 files changed, 28 insertions(+), 6 deletions(-)
    -
    -commit 4441e004185cd4c61bda184010eca5924c9dec87
    -Author: Lasse Collin 
    -Date:   2008-01-25 23:12:36 +0200
    -
    -    Combine lzma_options_block validation needed by both Block
    -    encoder and decoder, and put the shared things to
    -    block_private.h. Improved the checks a little so that
    -    they may detect too big Compressed Size at initialization
    -    time if lzma_options_block.total_size or .total_limit is
    -    known.
    -    
    -    Allow encoding and decoding Blocks with combinations of
    -    fields that are not allowed by the file format specification.
    -    Doing this requires that the application passes such a
    -    combination in lzma_options_lzma; liblzma doesn't do that,
    -    but it's not impossible that someone could find them useful
    -    in some custom file format.
    -
    - src/liblzma/common/block_decoder.c | 37 ++++++++++++----------------
    - src/liblzma/common/block_encoder.c | 32 +++++-------------------
    - src/liblzma/common/block_private.h | 50 ++++++++++++++++++++++++++++++++++++++
    - 3 files changed, 71 insertions(+), 48 deletions(-)
    -
    -commit bf4200c818fcf9102e56328d39cde91bfa13cfb6
    -Author: Lasse Collin 
    -Date:   2008-01-25 19:21:22 +0200
    -
    -    Added test_memlimit.c.
    -
    - tests/Makefile.am     |   2 +
    - tests/test_memlimit.c | 114 ++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 116 insertions(+)
    -
    -commit 7b8fc7e6b501a32a36636dac79ecb57099269005
    -Author: Lasse Collin 
    -Date:   2008-01-25 19:20:28 +0200
    -
    -    Improved the memory limitter:
    -      - Added lzma_memlimit_max() and lzma_memlimit_reached()
    -        API functions.
    -      - Added simple estimation of malloc()'s memory usage
    -        overhead.
    -      - Fixed integer overflow detection in lzma_memlimit_alloc().
    -      - Made some white space cleanups and added more comments.
    -    
    -    The description of lzma_memlimit_max() in memlimit.h is bad
    -    and should be improved.
    -
    - src/liblzma/api/lzma/memlimit.h      | 35 +++++++++++++
    - src/liblzma/common/memory_limitter.c | 97 ++++++++++++++++++++++++++++++------
    - 2 files changed, 118 insertions(+), 14 deletions(-)
    -
    -commit e0c3d0043da2f670cfdb1abbb3223d5a594ad8db
    -Author: Lasse Collin 
    -Date:   2008-01-25 13:55:52 +0200
    -
    -    Use more parenthesis in succeed() macro in tests/tests.h.
    -
    - tests/tests.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 1fd76d488179580d37f31ee11948f4932aed31fd
    -Author: Lasse Collin 
    -Date:   2008-01-24 14:49:34 +0200
    -
    -    Added more Multi-Block Stream test files.
    -
    - tests/files/README                        |  23 +++++++++++++++++++++++
    - tests/files/bad-multi-none-header_2.lzma  | Bin 0 -> 61 bytes
    - tests/files/bad-multi-none-header_3.lzma  | Bin 0 -> 59 bytes
    - tests/files/bad-multi-none-header_4.lzma  | Bin 0 -> 59 bytes
    - tests/files/bad-multi-none-header_5.lzma  | Bin 0 -> 58 bytes
    - tests/files/bad-multi-none-header_6.lzma  | Bin 0 -> 59 bytes
    - tests/files/good-multi-none-header_3.lzma | Bin 0 -> 59 bytes
    - 7 files changed, 23 insertions(+)
    -
    -commit 6e27b1098a28f4ce09bfa6df68ad94182dfc2936
    -Author: Lasse Collin 
    -Date:   2008-01-24 00:46:05 +0200
    -
    -    Added bunch of test files containing Multi-Block Streams.
    -
    - tests/files/README                        |  53 ++++++++++++++++++++++++++++++
    - tests/files/bad-multi-none-1.lzma         | Bin 0 -> 54 bytes
    - tests/files/bad-multi-none-2.lzma         | Bin 0 -> 53 bytes
    - tests/files/bad-multi-none-3.lzma         | Bin 0 -> 53 bytes
    - tests/files/bad-multi-none-extra_1.lzma   | Bin 0 -> 54 bytes
    - tests/files/bad-multi-none-extra_2.lzma   | Bin 0 -> 54 bytes
    - tests/files/bad-multi-none-extra_3.lzma   | Bin 0 -> 55 bytes
    - tests/files/bad-multi-none-header_1.lzma  | Bin 0 -> 57 bytes
    - tests/files/bad-multi-none-index_1.lzma   | Bin 0 -> 51 bytes
    - tests/files/bad-multi-none-index_2.lzma   | Bin 0 -> 49 bytes
    - tests/files/bad-multi-none-index_3.lzma   | Bin 0 -> 51 bytes
    - tests/files/bad-multi-none-index_4.lzma   | Bin 0 -> 51 bytes
    - tests/files/good-multi-none-1.lzma        | Bin 0 -> 75 bytes
    - tests/files/good-multi-none-2.lzma        | Bin 0 -> 53 bytes
    - tests/files/good-multi-none-extra_1.lzma  | Bin 0 -> 51 bytes
    - tests/files/good-multi-none-extra_2.lzma  | Bin 0 -> 79 bytes
    - tests/files/good-multi-none-extra_3.lzma  | Bin 0 -> 55 bytes
    - tests/files/good-multi-none-header_1.lzma | Bin 0 -> 58 bytes
    - tests/files/good-multi-none-header_2.lzma | Bin 0 -> 66 bytes
    - 19 files changed, 53 insertions(+)
    -
    -commit db9df0a9609c01a00a227329fb96e983971040f5
    -Author: Lasse Collin 
    -Date:   2008-01-23 23:43:00 +0200
    -
    -    Fix decoding of empty Metadata Blocks, that don't have
    -    even the Metadata Flags field. Earlier the code allowed
    -    such files; now they are prohibited as the file format
    -    specification requires.
    -
    - src/liblzma/common/metadata_decoder.c | 4 +++-
    - 1 file changed, 3 insertions(+), 1 deletion(-)
    -
    -commit 765f0b05f6e95ed9194fb90819cee189ebbac36b
    -Author: Lasse Collin 
    -Date:   2008-01-23 23:38:18 +0200
    -
    -    Fix a bug related to 99e12af4e2b866c011fe0106cd1e0bfdcc8fe9c6.
    -    lzma_metadata.header_metadata_size was not properly set to
    -    zero if the Metadata had only the Metadata Flags field.
    -
    - src/liblzma/common/metadata_decoder.c | 13 +++++++------
    - 1 file changed, 7 insertions(+), 6 deletions(-)
    -
    -commit 3a7cc5c3dec7b078941f961b0393b86c418883b6
    -Author: Lasse Collin 
    -Date:   2008-01-23 23:35:49 +0200
    -
    -    Fix decoding of Extra Records that have empty Data.
    -
    - src/liblzma/common/metadata_decoder.c | 13 ++++++++++++-
    - 1 file changed, 12 insertions(+), 1 deletion(-)
    -
    -commit e5fdec93e273855c1bcc2579b83cfb481a9a1492
    -Author: Lasse Collin 
    -Date:   2008-01-23 22:02:38 +0200
    -
    -    Add the trailing '\0' to lzma_extra.data as the API header
    -    already documents.
    -
    - src/liblzma/common/metadata_decoder.c | 4 +++-
    - 1 file changed, 3 insertions(+), 1 deletion(-)
    -
    -commit ed40dc5a2c28a8dfccab8c165b3780738eeef93e
    -Author: Lasse Collin 
    -Date:   2008-01-23 21:21:21 +0200
    -
    -    Added debug/full_flush.c.
    -
    - debug/Makefile.am  |   3 +-
    - debug/full_flush.c | 105 +++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 107 insertions(+), 1 deletion(-)
    -
    -commit ae0cd09a666a1682da8fc09487322227679e218d
    -Author: Lasse Collin 
    -Date:   2008-01-23 21:05:33 +0200
    -
    -    Return LZMA_STREAM_END instead of LZMA_OK if
    -    LZMA_SYNC_FLUSH or LZMA_FULL_FLUSH is used when
    -    there's no unfinished Block open.
    -
    - src/liblzma/common/stream_encoder_multi.c | 6 +++++-
    - 1 file changed, 5 insertions(+), 1 deletion(-)
    -
    -commit 0e80ded13dfceb98f9494cbb5381a95eb44d03db
    -Author: Lasse Collin 
    -Date:   2008-01-23 20:05:01 +0200
    -
    -    Added bad-single-none-footer_filter_flags.lzma and
    -    bad-single-none-too_long_vli.lzma.
    -
    - tests/files/README                                   |   5 +++++
    - tests/files/bad-single-none-footer_filter_flags.lzma | Bin 0 -> 30 bytes
    - tests/files/bad-single-none-too_long_vli.lzma        | Bin 0 -> 39 bytes
    - 3 files changed, 5 insertions(+)
    -
    -commit 8c8eb14055d8dd536b1b1c58fb284d34bb8ed1dd
    -Author: Lasse Collin 
    -Date:   2008-01-23 13:42:35 +0200
    -
    -    Fixed a typo.
    -
    - src/liblzma/subblock/subblock_decoder_helper.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 980f65a9a10160c4d105767871e3002b9aaba3e0
    -Author: Lasse Collin 
    -Date:   2008-01-23 13:40:45 +0200
    -
    -    Fix a memory leak in the Subblock encoder.
    -
    - src/liblzma/subblock/subblock_encoder.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 99e12af4e2b866c011fe0106cd1e0bfdcc8fe9c6
    -Author: Lasse Collin 
    -Date:   2008-01-23 13:36:07 +0200
    -
    -    Fix Size of Header Metadata Block handling. Now
    -    lzma_metadata.header_metadata_size == LZMA_VLI_VALUE_UNKNOWN
    -    is not allowed at all. To indicate missing Header Metadata
    -    Block, header_metadata_size must be set to zero. This is
    -    what Metadata decoder does after this patch too.
    -    
    -    Note that other missing fields in lzma_metadata are still
    -    indicated with LZMA_VLI_VALUE_UNKNOWN. This isn't as
    -    illogical as it sounds at first, because missing Size of
    -    Header Metadata Block means that Header Metadata Block is
    -    not present in the Stream. With other Metadata fields,
    -    a missing field means only that the value is unknown.
    -
    - src/liblzma/common/info.c             | 13 ++++---------
    - src/liblzma/common/metadata_decoder.c |  6 ++++++
    - src/liblzma/common/metadata_encoder.c | 11 +++++------
    - tests/test_info.c                     |  4 ++--
    - 4 files changed, 17 insertions(+), 17 deletions(-)
    -
    -commit 58b78ab20c1bcced45cf71ae6684868fc90b4b81
    -Author: Lasse Collin 
    -Date:   2008-01-23 13:15:55 +0200
    -
    -    Fix a memory leak in metadata_decoder.c.
    -
    - src/liblzma/common/metadata_decoder.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 4d8cdbdab44400fd98f0f18a0f701e27cd1acdae
    -Author: Lasse Collin 
    -Date:   2008-01-23 13:13:58 +0200
    -
    -    Fix the fix 863028cb7ad6d8d0455fa69348f56b376d7b908f which
    -    just moved to problem. Now it's really fixed.
    -
    - src/liblzma/common/info.c | 5 ++++-
    - 1 file changed, 4 insertions(+), 1 deletion(-)
    -
    -commit 67321de963ccf69410b3868b8e31534fe18a90de
    -Author: Lasse Collin 
    -Date:   2008-01-23 00:21:04 +0200
    -
    -    Take advantage of return_if_error() macro in
    -    lzma_info_metadata_set() in info.c.
    -
    - src/liblzma/common/info.c | 24 ++++++++----------------
    - 1 file changed, 8 insertions(+), 16 deletions(-)
    -
    -commit 863028cb7ad6d8d0455fa69348f56b376d7b908f
    -Author: Lasse Collin 
    -Date:   2008-01-23 00:18:32 +0200
    -
    -    Fixed a dangling pointer that caused invalid free().
    -
    - src/liblzma/common/info.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit cf49f42a6bd40143f54a6b10d6e605599e958c0b
    -Author: Lasse Collin 
    -Date:   2008-01-22 22:49:24 +0200
    -
    -    Added lzma_easy_* functions. These should make using
    -    liblzma as easy as using zlib, because the easy API
    -    don't require developers to know any fancy LZMA options.
    -    
    -    Note that Multi-Block Stream encoding is currently broken.
    -    The easy API should be OK, the bug(s) are elsewhere.
    -
    - src/liblzma/api/Makefile.am               |   1 +
    - src/liblzma/api/lzma.h                    |   1 +
    - src/liblzma/common/Makefile.am            |   5 ++
    - src/liblzma/common/easy_common.c          |  54 ++++++++++++++++
    - src/liblzma/common/easy_common.h          |  28 ++++++++
    - src/liblzma/common/easy_multi.c           | 103 ++++++++++++++++++++++++++++++
    - src/liblzma/common/easy_single.c          |  37 +++++++++++
    - src/liblzma/common/stream_encoder_multi.c |   3 +-
    - src/liblzma/common/stream_encoder_multi.h |  26 ++++++++
    - 9 files changed, 256 insertions(+), 2 deletions(-)
    -
    -commit 1747b85a43abc1c3f152dbd349be2ef4089ecf6a
    -Author: Lasse Collin 
    -Date:   2008-01-22 21:16:22 +0200
    -
    -    Fix Multi-Block Stream encoder's EOPM usage.
    -
    - src/liblzma/common/stream_encoder_multi.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 0ed6f1adcea540fb9593ca115d36de537f7f0dc6
    -Author: Lasse Collin 
    -Date:   2008-01-22 00:15:11 +0200
    -
    -    Made lzma_extra pointers const in lzma_options_stream.
    -
    - src/liblzma/api/lzma/stream.h             | 4 ++--
    - src/liblzma/common/stream_encoder_multi.c | 8 ++++++--
    - 2 files changed, 8 insertions(+), 4 deletions(-)
    -
    -commit 305afa38f64c75af8e81c4167e2d8fa8d85b53a4
    -Author: Lasse Collin 
    -Date:   2008-01-20 20:15:21 +0200
    -
    -    Updated debug/sync_flush.c.
    -
    - debug/sync_flush.c | 26 ++++++++++++++++++++++++--
    - 1 file changed, 24 insertions(+), 2 deletions(-)
    -
    -commit d53e9b77054cfade6a643e77d085273a348b189c
    -Author: Lasse Collin 
    -Date:   2008-01-20 20:14:26 +0200
    -
    -    Added debug/repeat.c.
    -
    - debug/Makefile.am |  1 +
    - debug/repeat.c    | 43 +++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 44 insertions(+)
    -
    -commit 107259e306bcfc2336a0fb870fb58034c28faa52
    -Author: Lasse Collin 
    -Date:   2008-01-20 20:12:58 +0200
    -
    -    Fix alignment handling bugs in Subblock encoder.
    -    
    -    This leaves one known alignment bug unfixed: If repeat count
    -    doesn't fit into 28-bit integer, the encoder has to split
    -    this to multiple Subblocks with Subblock Type `Repeating Data'.
    -    The extra Subblocks may have wrong alignment. Correct alignment
    -    is restored after the split Repeating Data has been completely
    -    written out.
    -    
    -    Since the encoder doesn't even try to fix the alignment unless
    -    the size of Data is at least 4 bytes, to trigger this bug you
    -    need at least 4 GiB of repeating data with sequence length of
    -    4 or more bytes. Since the worst thing done by this bug is
    -    misaligned data (no data corruption), this bug simply isn't
    -    worth fixing, because a proper fix isn't simple.
    -
    - src/liblzma/subblock/subblock_encoder.c | 170 ++++++++++++++++++++++----------
    - 1 file changed, 119 insertions(+), 51 deletions(-)
    -
    -commit e141fe18950400faaa3503ff88ac20eacd73e88c
    -Author: Lasse Collin 
    -Date:   2008-01-19 21:16:33 +0200
    -
    -    Implemented LZMA_SYNC_FLUSH support to the Subblock encoder.
    -    The API for handing Subfilters was changed to make it
    -    consistent with LZMA_SYNC_FLUSH.
    -    
    -    A few sanity checks were added for Subfilter handling. Some
    -    small bugs were fixed. More comments were added.
    -
    - src/liblzma/api/lzma/subblock.h         |  29 ++--
    - src/liblzma/subblock/subblock_encoder.c | 263 ++++++++++++++++++++++++--------
    - 2 files changed, 214 insertions(+), 78 deletions(-)
    -
    -commit 23c227a864a3b69f38c6a74306161d4e6918d1cc
    -Author: Lasse Collin 
    -Date:   2008-01-19 15:19:21 +0200
    -
    -    Revised the Delta filter implementation. The initialization
    -    function is still shared between encoder and decoder, but the
    -    actual coding is in separate files for encoder and decoder.
    -    
    -    There are now separate functions for the actual delta
    -    calculation depending on if Delta is the last filter in the
    -    chain or not. If it is the last, the new code copies the
    -    data from input to output buffer and does the delta
    -    calculation at the same time. The old code first copied the
    -    data, then did the delta in the target buffer, which required
    -    reading through the data twice.
    -    
    -    Support for LZMA_SYNC_FLUSH was added to the Delta encoder.
    -    This doesn't change anything in the file format.
    -
    - src/liblzma/common/Makefile.am     |  14 ++-
    - src/liblzma/common/delta_coder.c   | 189 -------------------------------------
    - src/liblzma/common/delta_coder.h   |  31 ------
    - src/liblzma/common/delta_common.c  |  70 ++++++++++++++
    - src/liblzma/common/delta_common.h  |  48 ++++++++++
    - src/liblzma/common/delta_decoder.c | 102 ++++++++++++++++++++
    - src/liblzma/common/delta_decoder.h |  28 ++++++
    - src/liblzma/common/delta_encoder.c |  97 +++++++++++++++++++
    - src/liblzma/common/delta_encoder.h |  28 ++++++
    - src/liblzma/common/raw_decoder.c   |   2 +-
    - src/liblzma/common/raw_encoder.c   |   2 +-
    - 11 files changed, 387 insertions(+), 224 deletions(-)
    -
    -commit 61dc82f3e306b25ce3cd3d529df9ec7a0ec04b73
    -Author: Lasse Collin 
    -Date:   2008-01-18 20:18:08 +0200
    -
    -    Added the debug directory and the first debug tool
    -    (sync_flush). These tools are not built unless the
    -    user runs "make" in the debug directory.
    -
    - Makefile.am        |   1 +
    - configure.ac       |   1 +
    - debug/Makefile.am  |  30 ++++++++++++++
    - debug/README       |  17 ++++++++
    - debug/sync_flush.c | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 5 files changed, 165 insertions(+)
    -
    -commit 0ae3208db94585eb8294b97ded387de0a3a07646
    -Author: Lasse Collin 
    -Date:   2008-01-18 20:13:00 +0200
    -
    -    Added test files to test usage of flush marker in LZMA.
    -
    - tests/files/README                               |  12 ++++++++++++
    - tests/files/bad-single-lzma-flush_beginning.lzma | Bin 0 -> 53 bytes
    - tests/files/bad-single-lzma-flush_twice.lzma     | Bin 0 -> 63 bytes
    - tests/files/good-single-lzma-flush_1.lzma        | Bin 0 -> 48 bytes
    - tests/files/good-single-lzma-flush_2.lzma        | Bin 0 -> 63 bytes
    - 5 files changed, 12 insertions(+)
    -
    -commit ab5feaf1fcc146ef9fd39360c53c290bec39524e
    -Author: Lasse Collin 
    -Date:   2008-01-18 20:02:52 +0200
    -
    -    Fix LZMA_SYNC_FLUSH handling in LZ and LZMA encoders.
    -    That code is now almost completely in LZ coder, where
    -    it can be shared with other LZ77-based algorithms in
    -    future.
    -
    - src/liblzma/lz/lz_encoder.c     | 34 ++++++++++++++++++++++++++--------
    - src/liblzma/lz/lz_encoder.h     |  1 +
    - src/liblzma/lzma/lzma_encoder.c | 27 ++-------------------------
    - 3 files changed, 29 insertions(+), 33 deletions(-)
    -
    -commit 079c4f7fc26b3d0b33d9ae7536697b45f3b73585
    -Author: Lasse Collin 
    -Date:   2008-01-18 17:21:24 +0200
    -
    -    Don't add -g to CFLAGS when --enable-debug is specified.
    -    It's the job of the user to put that in CFLAGS.
    -
    - configure.ac | 1 -
    - 1 file changed, 1 deletion(-)
    -
    -commit 61d1784d8f1761d979a6da6e223e279ca33815e6
    -Author: Lasse Collin 
    -Date:   2008-01-18 14:17:37 +0200
    -
    -    Set stdin and stdout to binary mode on Windows. This patch is
    -    a forward port of b7b22fcb979a16d3a47c8001f058c9f7d4416068
    -    from lzma-utils-legacy.git. I don't know if the new code base
    -    builds on Windows, but this is a start.
    -
    - src/lzmadec/lzmadec.c | 9 +++++++++
    - 1 file changed, 9 insertions(+)
    -
    -commit c9cba976913e55ff9aac8a8133cc94416c7c1c9c
    -Author: Lasse Collin 
    -Date:   2008-01-18 00:50:29 +0200
    -
    -    Added test_compress.sh and bunch of files needed by it.
    -    This new set of tests compress and decompress several
    -    test files with many different compression options.
    -    This set of tests will be extended later.
    -
    - tests/Makefile.am                 |  30 ++++---
    - tests/bcj_test.c                  |  66 ++++++++++++++
    - tests/compress_prepared_bcj_sparc | Bin 0 -> 6804 bytes
    - tests/compress_prepared_bcj_x86   | Bin 0 -> 4649 bytes
    - tests/create_compress_files.c     | 164 ++++++++++++++++++++++++++++++++++
    - tests/test_compress.sh            | 183 ++++++++++++++++++++++++++++++++++++++
    - 6 files changed, 433 insertions(+), 10 deletions(-)
    -
    -commit 33be3c0e24d8f43376ccf71cc77d53671e792f07
    -Author: Lasse Collin 
    -Date:   2008-01-17 18:56:53 +0200
    -
    -    Subblock decoder: Don't exit the main loop in decode_buffer()
    -    too early if we hit End of Input while decoding a Subblock of
    -    type Repeating Data. To keep the loop termination condition
    -    elegant, the order of enumerations in coder->sequence were
    -    changed.
    -    
    -    To keep the case-labels in roughly the same order as the
    -    enumerations in coder->sequence, large chunks of code was
    -    moved around. This made the diff big and ugly compared to
    -    the amount of the actual changes made.
    -
    - src/liblzma/subblock/subblock_decoder.c | 272 ++++++++++++++++----------------
    - 1 file changed, 139 insertions(+), 133 deletions(-)
    -
    -commit b254bd97b1cdb68d127523d91ca9e054ed89c4fd
    -Author: Lasse Collin 
    -Date:   2008-01-17 17:39:42 +0200
    -
    -    Fix wrong too small size of argument unfiltered_max
    -    in ia64_coder_init(). It triggered assert() in
    -    simple_coder.c, and could have caused a buffer overflow.
    -    
    -    This error was probably a copypaste mistake, since most
    -    of the simple filters use unfiltered_max = 4.
    -
    - src/liblzma/simple/ia64.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 8f5794c8f1a30e8e3b524b415bbe81af2e04c64a
    -Author: Lasse Collin 
    -Date:   2008-01-17 17:27:45 +0200
    -
    -    Added --delta to the output of "lzma --help".
    -
    - src/lzma/help.c | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit f88590e0014b38d40465937c19f25f05f16c79ae
    -Author: Lasse Collin 
    -Date:   2008-01-17 13:14:20 +0200
    -
    -    Fix Subblock docoder: If Subblock filter was used with known
    -    Uncompressed Size, and the last output byte was from RLE,
    -    the code didn't stop decoding as it should have done.
    -
    - src/liblzma/subblock/subblock_decoder.c | 6 ++++++
    - 1 file changed, 6 insertions(+)
    -
    -commit bc0b945ca376e333077644d2f7fd54c2848aab8a
    -Author: Lasse Collin 
    -Date:   2008-01-16 16:33:37 +0200
    -
    -    Tiny non-technical edits to file-format.txt.
    -
    - doc/file-format.txt | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 7599bb7064ccf007f054595dedda7927af868252
    -Author: Lasse Collin 
    -Date:   2008-01-16 14:48:04 +0200
    -
    -    Plugged a memory leak in stream_decoder.c.
    -
    - src/liblzma/common/stream_decoder.c | 20 ++++++++++++++++++++
    - 1 file changed, 20 insertions(+)
    -
    -commit 0b581539311f3712946e81e747839f8fb5f441a7
    -Author: Lasse Collin 
    -Date:   2008-01-16 14:47:27 +0200
    -
    -    Added memory leak detection to lzmadec.c.
    -
    - src/lzmadec/lzmadec.c | 3 +++
    - 1 file changed, 3 insertions(+)
    -
    -commit 5b5b13c7bb8fde6331064d21f3ebde41072480c4
    -Author: Lasse Collin 
    -Date:   2008-01-16 14:46:50 +0200
    -
    -    Added lzma_memlimit_count().
    -
    - src/liblzma/api/lzma/memlimit.h      | 10 ++++++++++
    - src/liblzma/common/memory_limitter.c | 19 +++++++++++++++++++
    - 2 files changed, 29 insertions(+)
    -
    -commit 19389f2b82ec54fd4c847a18f16482e7be4c9887
    -Author: Lasse Collin 
    -Date:   2008-01-16 14:31:44 +0200
    -
    -    Added ARRAY_SIZE(array) macro.
    -
    - src/common/sysdefs.h | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 9bc33a54cbf83952130adbcb1be32c6882485416
    -Author: Lasse Collin 
    -Date:   2008-01-16 13:27:03 +0200
    -
    -    Make Uncompresed Size validation more strict
    -    in alone_decoder.c.
    -
    - src/liblzma/common/alone_decoder.c | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit 01d71d60b79027e1ce3eb9c79ae5191e1407c883
    -Author: Lasse Collin 
    -Date:   2008-01-15 17:46:59 +0200
    -
    -    Free the allocated memory in lzmadec if debugging is
    -    enabled. This should make it possible to detect possible
    -    memory leaks with Valgrind.
    -
    - src/lzmadec/lzmadec.c | 7 +++++++
    - 1 file changed, 7 insertions(+)
    -
    -commit 8235e6e5b2878f76633afcda9a334640db503ef5
    -Author: Lasse Collin 
    -Date:   2008-01-15 16:25:38 +0200
    -
    -    Fix memory leaks from test_block_header.c.
    -
    - tests/test_block_header.c | 19 +++++++++++++++++--
    - 1 file changed, 17 insertions(+), 2 deletions(-)
    -
    -commit f10fc6a69d40b6d5c9cfbf8d3746f49869c2e2f6
    -Author: Lasse Collin 
    -Date:   2008-01-15 14:23:35 +0200
    -
    -    Use fastpos.h when encoding LZMA dictionary size in
    -    Filter Flags encoder.
    -
    - src/liblzma/common/filter_flags_encoder.c | 40 +++++++++++++++----------------
    - 1 file changed, 19 insertions(+), 21 deletions(-)
    -
    -commit e5728142a2048979f5c0c2149ce71ae952a092e1
    -Author: Lasse Collin 
    -Date:   2008-01-15 14:02:22 +0200
    -
    -    Revised the fastpos code. It now uses the slightly faster
    -    table-based version from LZMA SDK 4.57. This should be
    -    fast on most systems.
    -    
    -    A simpler and smaller alternative version is also provided.
    -    On some CPUs this can be even a little faster than the
    -    default table-based version (see comments in fastpos.h),
    -    but on most systems the table-based code is faster.
    -
    - src/liblzma/common/init_encoder.c          |   3 -
    - src/liblzma/lzma/Makefile.am               |   4 +
    - src/liblzma/lzma/fastpos.h                 | 156 +++++++++
    - src/liblzma/lzma/fastpos_table.c           | 519 +++++++++++++++++++++++++++++
    - src/liblzma/lzma/fastpos_tablegen.c        |  63 ++++
    - src/liblzma/lzma/lzma_common.h             |   3 +-
    - src/liblzma/lzma/lzma_encoder.c            |   1 +
    - src/liblzma/lzma/lzma_encoder_getoptimum.c |   1 +
    - src/liblzma/lzma/lzma_encoder_init.c       |  22 --
    - src/liblzma/lzma/lzma_encoder_private.h    |  21 --
    - 10 files changed, 746 insertions(+), 47 deletions(-)
    -
    -commit 10437b5b567f6a025ff16c45a572e417a0a9cc26
    -Author: Lasse Collin 
    -Date:   2008-01-15 13:32:13 +0200
    -
    -    Added bsr.h.
    -
    - src/liblzma/common/Makefile.am |  1 +
    - src/liblzma/common/bsr.h       | 61 ++++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 62 insertions(+)
    -
    -commit f3c88e8b8d8dd57f4bba5f0921eebf276437c244
    -Author: Lasse Collin 
    -Date:   2008-01-15 13:29:14 +0200
    -
    -    Fixed assembler detection in configure.ac, and added
    -    detection for x86_64.
    -
    - configure.ac | 32 ++++++++++++++++----------------
    - 1 file changed, 16 insertions(+), 16 deletions(-)
    -
    -commit 54ec204f58287f50d3976288295da4188a19192b
    -Author: Lasse Collin 
    -Date:   2008-01-15 12:20:41 +0200
    -
    -    Omit invalid space from printf() format string
    -    in price_table_gen.c.
    -
    - src/liblzma/rangecoder/price_table_gen.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 01b4b19f49f00e17a0f9cb8754c672ac0847b6e1
    -Author: Lasse Collin 
    -Date:   2008-01-15 09:54:34 +0200
    -
    -    Removed a few unused macros from lzma_common.h.
    -
    - src/liblzma/lzma/lzma_common.h | 8 ++------
    - 1 file changed, 2 insertions(+), 6 deletions(-)
    -
    -commit 19bd7f3cf25e4ff8487ef7098ca4a7b58681961d
    -Author: Lasse Collin 
    -Date:   2008-01-15 08:37:42 +0200
    -
    -    Fix a typo in lzma_encoder.c.
    -
    - src/liblzma/lzma/lzma_encoder.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 9f9b1983013048f2142e8bc7e240149d2687bedc
    -Author: Lasse Collin 
    -Date:   2008-01-15 08:36:25 +0200
    -
    -    Convert bittree_get_price() and bittree_reverse_get_price()
    -    from macros to inline functions.
    -
    - src/liblzma/lzma/lzma_encoder.c            | 19 +++-----
    - src/liblzma/lzma/lzma_encoder_getoptimum.c | 16 +++----
    - src/liblzma/rangecoder/range_encoder.h     | 76 +++++++++++++++++-------------
    - 3 files changed, 56 insertions(+), 55 deletions(-)
    -
    -commit 78e85cb1a7667c54853670d2eb09d754bcbda87d
    -Author: Lasse Collin 
    -Date:   2008-01-15 07:44:59 +0200
    -
    -    Fix CRC code in case --enable-small is used.
    -
    - src/liblzma/check/crc32_init.c    | 2 +-
    - src/liblzma/check/crc64_init.c    | 2 +-
    - src/liblzma/common/init_decoder.c | 2 --
    - src/liblzma/common/init_encoder.c | 2 --
    - tests/test_check.c                | 2 ++
    - 5 files changed, 4 insertions(+), 6 deletions(-)
    -
    -commit 949d4346e2d75bcd9dcb66c394d8d851d8db3aa0
    -Author: Lasse Collin 
    -Date:   2008-01-15 07:41:39 +0200
    -
    -    Fix typo in test_index.c.
    -
    - tests/test_index.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit d13d693155c176fc9e9ad5c50d48ccba27c2d9c6
    -Author: Lasse Collin 
    -Date:   2008-01-15 07:40:21 +0200
    -
    -    Added precomputed range coder probability price table.
    -
    - src/liblzma/common/init_encoder.c         |  5 ++-
    - src/liblzma/rangecoder/Makefile.am        |  9 +++-
    - src/liblzma/rangecoder/price_table.c      | 70 +++++++++++++++++++++++++++++++
    - src/liblzma/rangecoder/price_table_gen.c  | 55 ++++++++++++++++++++++++
    - src/liblzma/rangecoder/price_table_init.c | 48 +++++++++++++++++++++
    - src/liblzma/rangecoder/range_common.h     |  4 +-
    - src/liblzma/rangecoder/range_encoder.c    | 46 --------------------
    - src/liblzma/rangecoder/range_encoder.h    | 21 +++++-----
    - 8 files changed, 197 insertions(+), 61 deletions(-)
    -
    -commit 362dc3843b373c1007a50a4719f378981f18ae03
    -Author: Lasse Collin 
    -Date:   2008-01-14 13:42:43 +0200
    -
    -    Remove RC_BUFFER_SIZE from lzma_encoder_private.h
    -    and replace it with a sanity check.
    -
    - src/liblzma/lzma/lzma_encoder_private.h | 6 ++++--
    - 1 file changed, 4 insertions(+), 2 deletions(-)
    -
    -commit e22b37968d153683fec61ad37b6b160cb7ca4ddc
    -Author: Lasse Collin 
    -Date:   2008-01-14 13:39:54 +0200
    -
    -    Major changes to LZ encoder, LZMA encoder, and range encoder.
    -    These changes implement support for LZMA_SYNC_FLUSH in LZMA
    -    encoder, and move the temporary buffer needed by range encoder
    -    from lzma_range_encoder structure to lzma_lz_encoder.
    -
    - src/liblzma/lz/lz_encoder.c            | 138 ++++++++++++++++++++++++++++-----
    - src/liblzma/lz/lz_encoder.h            |  17 ++--
    - src/liblzma/lzma/lzma_encoder.c        |  74 ++++++++++--------
    - src/liblzma/rangecoder/range_encoder.h | 117 ++++++++--------------------
    - 4 files changed, 206 insertions(+), 140 deletions(-)
    -
    -commit b59ef3973781f892c0a72b5e5934194567100be5
    -Author: Lasse Collin 
    -Date:   2008-01-14 13:34:29 +0200
    -
    -    Added one assert() to process.c of the command line tool.
    -
    - src/lzma/process.c | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 9547e734a00ddb64c851fa3f116e4f9e7d763ea7
    -Author: Lasse Collin 
    -Date:   2008-01-14 12:09:52 +0200
    -
    -    Don't use coder->lz.stream_end_was_reached in assertions
    -    in match_c.h.
    -
    - src/liblzma/lz/match_c.h | 2 --
    - 1 file changed, 2 deletions(-)
    -
    -commit 3e09e1c05871f3757f759b801890ccccc9286608
    -Author: Lasse Collin 
    -Date:   2008-01-14 12:08:02 +0200
    -
    -    In lzma_read_match_distances(), don't use
    -    coder->lz.stream_end_was_reached. That variable
    -    will be removed, and the check isn't required anyway.
    -    Rearrange the check so that it doesn't make one to
    -    think that there could be an integer overflow.
    -
    - src/liblzma/lzma/lzma_encoder_private.h | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit a670fec8021e5962429689c194148a04c3418872
    -Author: Lasse Collin 
    -Date:   2008-01-14 11:56:41 +0200
    -
    -    Small LZMA_SYNC_FLUSH fixes to Block and Single-Stream encoders.
    -
    - src/liblzma/common/block_encoder.c         | 4 ++--
    - src/liblzma/common/stream_encoder_single.c | 1 +
    - 2 files changed, 3 insertions(+), 2 deletions(-)
    -
    -commit 3599dba9570a6972a16b6398d6c838e9b420e985
    -Author: Lasse Collin 
    -Date:   2008-01-14 11:54:56 +0200
    -
    -    More fixes to LZMA decoder's flush marker handling.
    -
    - src/liblzma/lzma/lzma_decoder.c | 52 ++++++++++++++++++++++++-----------------
    - 1 file changed, 30 insertions(+), 22 deletions(-)
    -
    -commit f73c2ab6079ed5675a42b39d584a567befbd4624
    -Author: Lasse Collin 
    -Date:   2008-01-10 17:13:42 +0200
    -
    -    Eliminate lzma_lz_encoder.must_move_pos. It's needed
    -    only in one place which isn't performance criticial.
    -
    - src/liblzma/lz/lz_encoder.c | 6 ++----
    - src/liblzma/lz/lz_encoder.h | 4 ----
    - 2 files changed, 2 insertions(+), 8 deletions(-)
    -
    -commit 382808514a42b2f4b4a64515e2dfb3fc1bc48ecd
    -Author: Lasse Collin 
    -Date:   2008-01-09 20:05:57 +0200
    -
    -    Define HAVE_ASM_X86 when x86 assembler optimizations are
    -    used. This #define will be useful for inline assembly.
    -
    - configure.ac | 5 ++++-
    - 1 file changed, 4 insertions(+), 1 deletion(-)
    -
    -commit 0e70fbe4032351aab13a1cd8e5deced105c0b276
    -Author: Lasse Collin 
    -Date:   2008-01-09 12:06:46 +0200
    -
    -    Added good-single-none-empty_3.lzma and
    -    bad-single-none-empty.lzma.
    -
    - tests/files/README                        |   6 ++++++
    - tests/files/bad-single-none-empty.lzma    | Bin 0 -> 19 bytes
    - tests/files/good-single-none-empty_3.lzma | Bin 0 -> 19 bytes
    - 3 files changed, 6 insertions(+)
    -
    -commit 379fbbe84d922c7cc00afa65c6f0c095da596b19
    -Author: Lasse Collin 
    -Date:   2008-01-08 23:11:59 +0200
    -
    -    Take advantage of return_if_error() in block_decoder.c.
    -
    - src/liblzma/common/block_decoder.c | 23 +++++++----------------
    - 1 file changed, 7 insertions(+), 16 deletions(-)
    -
    -commit 97d5fa82077e57815dfad995dc393c2809a78539
    -Author: Lasse Collin 
    -Date:   2008-01-08 23:10:57 +0200
    -
    -    Updated tests/files/README.
    -
    - tests/files/README | 15 +++++++++------
    - 1 file changed, 9 insertions(+), 6 deletions(-)
    -
    -commit 3bb9bb310936cba6a743b4f06739a397dec7c28f
    -Author: Lasse Collin 
    -Date:   2008-01-08 23:05:40 +0200
    -
    -    Added test files with empty Compressed Data.
    -
    - tests/files/README                        |   6 ++++++
    - tests/files/good-single-lzma-empty.lzma   | Bin 0 -> 21 bytes
    - tests/files/good-single-none-empty_1.lzma | Bin 0 -> 18 bytes
    - tests/files/good-single-none-empty_2.lzma | Bin 0 -> 26 bytes
    - 4 files changed, 6 insertions(+)
    -
    -commit 7054c5f5888ac6a7178cd43dc9583ce6c7e78c9f
    -Author: Lasse Collin 
    -Date:   2008-01-08 22:58:42 +0200
    -
    -    Fix decoding of Blocks that have only Block Header.
    -
    - src/liblzma/common/block_decoder.c | 37 ++++++++++++++-----------------------
    - 1 file changed, 14 insertions(+), 23 deletions(-)
    -
    -commit 753e4d95cd1cf29c632dfe1a670af7c67aeffbf4
    -Author: Lasse Collin 
    -Date:   2008-01-08 22:27:46 +0200
    -
    -    Added good-single-subblock_implicit.lzma.
    -
    - tests/files/README                             |   2 ++
    - tests/files/good-single-subblock_implicit.lzma | Bin 0 -> 35 bytes
    - 2 files changed, 2 insertions(+)
    -
    -commit faeac7b7aca75f86afed1e7cc06279d9d497c627
    -Author: Lasse Collin 
    -Date:   2008-01-08 18:50:30 +0200
    -
    -    Disable CRC32 from Block Headers when --check=none
    -    has been specified.
    -
    - src/lzma/process.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit a751126dbb656767ed4666cf0e5d3e17349d93d1
    -Author: Lasse Collin 
    -Date:   2008-01-08 13:36:29 +0200
    -
    -    Fixed encoding of empty files. Arguments to is_size_valid()
    -    were in wrong order in block_encoder.c.
    -
    - src/liblzma/common/block_encoder.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 9080267603b1006c4867c823307dca9df8be0d20
    -Author: Lasse Collin 
    -Date:   2008-01-08 13:35:36 +0200
    -
    -    Added a few test files.
    -
    - tests/files/README                                 |  21 ++++++++++++++++++---
    - tests/files/bad-cat-single-none-pad_garbage_1.lzma | Bin 0 -> 65 bytes
    - tests/files/bad-cat-single-none-pad_garbage_2.lzma | Bin 0 -> 65 bytes
    - tests/files/bad-cat-single-none-pad_garbage_3.lzma | Bin 0 -> 65 bytes
    - tests/files/bad-single-data_after_eopm.lzma        | Bin 55 -> 0 bytes
    - tests/files/bad-single-data_after_eopm_1.lzma      | Bin 0 -> 55 bytes
    - tests/files/bad-single-none-truncated.lzma         | Bin 0 -> 29 bytes
    - 7 files changed, 18 insertions(+), 3 deletions(-)
    -
    -commit b4943ccf73b64fc93a90a23474509c316f55eb2b
    -Author: Lasse Collin 
    -Date:   2008-01-08 12:29:58 +0200
    -
    -    Avoid using ! in test_files.sh, because that doesn't work
    -    with some ancient /bin/sh versions.
    -
    - tests/test_files.sh | 4 +++-
    - 1 file changed, 3 insertions(+), 1 deletion(-)
    -
    -commit e2417b2b9134f3f65e14b61e23cd3644d8954353
    -Author: Lasse Collin 
    -Date:   2008-01-08 00:48:30 +0200
    -
    -    More pre-C99 inttypes.h compatibility fixes. Now the code
    -    should work even if the system has no inttypes.h.
    -
    - src/common/physmem.h               | 11 -----------
    - src/liblzma/check/crc32_init.c     |  5 +----
    - src/liblzma/check/crc32_tablegen.c |  7 ++-----
    - src/liblzma/check/crc64_init.c     |  5 +----
    - src/liblzma/check/crc64_tablegen.c |  7 ++-----
    - 5 files changed, 6 insertions(+), 29 deletions(-)
    -
    -commit 5d227e51c23639423f4ade06aabb54e131f8505e
    -Author: Lasse Collin 
    -Date:   2008-01-07 23:25:32 +0200
    -
    -    Updated fi.po although it's currently pretty much crap.
    -
    - po/fi.po | 12 ++++++------
    - 1 file changed, 6 insertions(+), 6 deletions(-)
    -
    -commit c7189d981a1b27c63da0c1ee80d9b5cd8ce1733d
    -Author: Lasse Collin 
    -Date:   2008-01-07 23:14:25 +0200
    -
    -    Test for $GCC = yes instead of if it is non-empty. This
    -    way it is possible to use ac_cv_c_compiler_gnu=no to
    -    force configure to think it is using non-GNU C compiler.
    -
    - configure.ac | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 3dbbea82b74bb841c995ad332a3aeca613015e10
    -Author: Lasse Collin 
    -Date:   2008-01-07 21:49:41 +0200
    -
    -    Added test_files.sh to tests/Makefile.am so it gets
    -    included in the tarball with "make dist".
    -
    - tests/Makefile.am | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 2fd2d181543feab1b4003f3ac6e85625fbee04f0
    -Author: Lasse Collin 
    -Date:   2008-01-07 18:22:24 +0200
    -
    -    Cosmetic edit to test_files.sh.
    -
    - tests/test_files.sh | 4 ++--
    - 1 file changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 9a71d573100a990ceb30ce0bec6a9a15d795605f
    -Author: Lasse Collin 
    -Date:   2008-01-07 18:09:44 +0200
    -
    -    Added tests/files/README.
    -
    - tests/files/README | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++++
    - 1 file changed, 108 insertions(+)
    -
    -commit 47f48fe9936ed72617a60fbd015df7e0e47a1e43
    -Author: Lasse Collin 
    -Date:   2008-01-07 14:20:57 +0200
    -
    -    Tell in COPYING that everything in tests/files is
    -    public domain.
    -
    - COPYING | 3 ++-
    - 1 file changed, 2 insertions(+), 1 deletion(-)
    -
    -commit 3502b3e1d00251d3c8dda96079440705c28d8225
    -Author: Lasse Collin 
    -Date:   2008-01-07 14:19:05 +0200
    -
    -    Cleaned up the tests/files directory.
    -
    - tests/files/bad-single-subblock-padding_loop.lzma   | Bin 0 -> 43 bytes
    - tests/files/bad-single-subblock1023-slow.lzma       | Bin 0 -> 7886 bytes
    - tests/files/malicious-single-subblock-loop.lzma     | Bin 43 -> 0 bytes
    - tests/files/malicious-single-subblock-lzma.lzma     | Bin 505 -> 0 bytes
    - tests/files/malicious-single-subblock1023-slow.lzma | Bin 7886 -> 0 bytes
    - 5 files changed, 0 insertions(+), 0 deletions(-)
    -
    -commit 908b2ac604b9940369d7fe8a45e9eb6da5d2a24c
    -Author: Lasse Collin 
    -Date:   2008-01-07 13:49:19 +0200
    -
    -    Added test_files.sh to test decoding of the files in
    -    the tests/files directory. It doesn't test the malicious
    -    files yet.
    -
    - tests/Makefile.am   |  4 +++-
    - tests/test_files.sh | 40 ++++++++++++++++++++++++++++++++++++++++
    - 2 files changed, 43 insertions(+), 1 deletion(-)
    -
    -commit ecb2a6548f5978022a8fa931719dc575f5fd3bf6
    -Author: Lasse Collin 
    -Date:   2008-01-07 11:23:13 +0200
    -
    -    Updated README regarding the assembler optimizations.
    -
    - README | 10 +++++-----
    - 1 file changed, 5 insertions(+), 5 deletions(-)
    -
    -commit eacb8050438d3e6146c86eb9732d3fb1ef1825cb
    -Author: Lasse Collin 
    -Date:   2008-01-07 10:58:00 +0200
    -
    -    Updated THANKS.
    -
    - THANKS | 1 +
    - 1 file changed, 1 insertion(+)
    -
    -commit 1239649f96132b18e3b7e2dd152ecf53a195caa8
    -Author: Lasse Collin 
    -Date:   2008-01-06 21:47:17 +0200
    -
    -    Cosmetic changes to configure.ac.
    -
    - configure.ac | 14 ++++++--------
    - 1 file changed, 6 insertions(+), 8 deletions(-)
    -
    -commit 88ee301ec2e4506a30ec7ac9aaa2288e2dcadd0e
    -Author: Lasse Collin 
    -Date:   2008-01-06 19:46:38 +0200
    -
    -    Automatically disable assembler code on Darwin x86.
    -    Darwin has different ABI than GNU+Linux and Solaris,
    -    thus the assembler code doesn't assemble on Darwin.
    -
    - configure.ac | 17 +++++++++++++++--
    - 1 file changed, 15 insertions(+), 2 deletions(-)
    -
    -commit c15a7abf66e3a70792f7444115e484c7981c8284
    -Author: Lasse Collin 
    -Date:   2008-01-06 19:45:27 +0200
    -
    -    With printf(), use PRIu64 with a cast to uint64_t instead
    -    of %zu, because some pre-C99 libc versions don't support %zu.
    -
    - src/lzma/help.c       | 13 +++++++------
    - src/lzmadec/lzmadec.c |  6 ++++--
    - 2 files changed, 11 insertions(+), 8 deletions(-)
    -
    -commit 4e7e54c4c522ab2f6a7abb92cefc4f707e9568fb
    -Author: Lasse Collin 
    -Date:   2008-01-06 16:27:41 +0200
    -
    -    Introduced compatibility with systems that have pre-C99
    -    or no inttypes.h. This is useful when the compiler has
    -    good enough support for C99, but libc headers don't.
    -    
    -    Changed liblzma API so that sys/types.h and inttypes.h
    -    have to be #included before #including lzma.h. On systems
    -    that don't have C99 inttypes.h, it's the problem of the
    -    applications to provide the required types and macros
    -    before #including lzma.h.
    -    
    -    If lzma.h defined the missing types and macros, it could
    -    conflict with third-party applications whose configure
    -    has detected that the types are missing and defined them
    -    in config.h already. An alternative would have been
    -    introducing lzma_uint32 and similar types, but that would
    -    just be an extra pain on modern systems.
    -
    - configure.ac                       | 13 ++++++++-
    - doc/liblzma-intro.txt              | 10 +++++--
    - src/common/sysdefs.h               | 59 +++++++++++++++++++++++++++++++++++++-
    - src/liblzma/api/lzma.h             | 40 +++++++++++++++++---------
    - src/liblzma/check/crc32_table.c    |  4 +--
    - src/liblzma/check/crc32_table_be.h |  2 --
    - src/liblzma/check/crc32_table_le.h |  2 --
    - src/liblzma/check/crc32_tablegen.c |  1 -
    - src/liblzma/check/crc64_table.c    |  4 +--
    - src/liblzma/check/crc64_table_be.h |  2 --
    - src/liblzma/check/crc64_table_le.h |  2 --
    - src/liblzma/check/crc64_tablegen.c |  1 -
    - src/lzma/private.h                 |  1 -
    - 13 files changed, 106 insertions(+), 35 deletions(-)
    -
    -commit a71864f77dfb76b5d78a270641539947c312583a
    -Author: Lasse Collin 
    -Date:   2008-01-05 19:57:00 +0200
    -
    -    Fix typo in comment (INT64_MAX -> UINT64_MAX).
    -
    - src/liblzma/api/lzma/vli.h | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 072927905a3b66281c6311b4b351caa501d8b73a
    -Author: Lasse Collin 
    -Date:   2008-01-05 19:42:04 +0200
    -
    -    Rearranged testing of GCC-specific flags.
    -
    - configure.ac | 33 +++++++++++++++++++++++----------
    - 1 file changed, 23 insertions(+), 10 deletions(-)
    -
    -commit d160ee32598c6d1cd9054ef019e8c9331208b188
    -Author: Lasse Collin 
    -Date:   2008-01-05 01:20:24 +0200
    -
    -    Another bug fix for flush marker detection.
    -
    - src/liblzma/lzma/lzma_decoder.c | 10 +++++++++-
    - 1 file changed, 9 insertions(+), 1 deletion(-)
    -
    -commit fc67f79f607cbfa78c6f47a69dec098d8659b162
    -Author: Lasse Collin 
    -Date:   2008-01-04 21:37:01 +0200
    -
    -    Fix stupid bugs in flush marker detection.
    -
    - src/liblzma/lzma/lzma_decoder.c | 7 ++++---
    - 1 file changed, 4 insertions(+), 3 deletions(-)
    -
    -commit 0029cbbabe87d491fc046a55a629a6d556010baa
    -Author: Lasse Collin 
    -Date:   2008-01-04 21:30:33 +0200
    -
    -    Added support for flush marker, which will be in files
    -    that use LZMA_SYNC_FLUSH with encoder (not implemented
    -    yet). This is a new feature in the raw LZMA format,
    -    which isn't supported by old decoders. This shouldn't
    -    be a problem in practice, since lzma_alone_encoder()
    -    will not allow LZMA_SYNC_FLUSH, and thus not allow
    -    creating files on decodable with old decoders.
    -    
    -    Made lzma_decoder.c to require tab width of 4 characters
    -    if one wants to fit the code in 80 columns. This makes
    -    the code easier to read.
    -
    - src/liblzma/lzma/lzma_common.h  |   4 +
    - src/liblzma/lzma/lzma_decoder.c | 217 ++++++++++++++++++----------------------
    - 2 files changed, 104 insertions(+), 117 deletions(-)
    -
    -commit bbfd1f6ab058a7e661545205befcb7f70c5685ab
    -Author: Lasse Collin 
    -Date:   2008-01-04 20:45:05 +0200
    -
    -    Moved range decoder initialization (reading the first
    -    five input bytes) from LZMA decoder to range decoder
    -    header. Did the same for decoding of direct bits.
    -
    - src/liblzma/lzma/lzma_decoder.c        | 42 +++-------------
    - src/liblzma/rangecoder/range_decoder.h | 87 +++++++++++++++++++++++-----------
    - 2 files changed, 66 insertions(+), 63 deletions(-)
    -
    -commit 5db745cd2a74f6ed2e52f5c716c08ed0daf17ebc
    -Author: Lasse Collin 
    -Date:   2007-12-14 11:15:21 +0200
    -
    -    Added a note to README that --disable-assembler
    -    must be used on Darwin.
    -
    - README | 4 ++++
    - 1 file changed, 4 insertions(+)
    -
    -commit 44b333d4615b5aabc557a0e1b6bb0096da3fae24
    -Author: Lasse Collin 
    -Date:   2007-12-14 10:07:10 +0200
    -
    -    Use the filename suffix .S instead of .s for assembler files
    -    so that the preprocessor removes the /* */ style comments,
    -    which are not supported by some non-GNU assemblers (Solaris)
    -    that otherwise work with this code.
    -
    - src/liblzma/check/Makefile.am |   4 +-
    - src/liblzma/check/crc32_x86.S | 217 ++++++++++++++++++++++++++++++++++++++++++
    - src/liblzma/check/crc32_x86.s | 217 ------------------------------------------
    - src/liblzma/check/crc64_x86.S | 203 +++++++++++++++++++++++++++++++++++++++
    - src/liblzma/check/crc64_x86.s | 203 ---------------------------------------
    - 5 files changed, 422 insertions(+), 422 deletions(-)
    -
    -commit ec1c82b2e82f395f6e8e19ac212a639644330cd7
    -Author: Lasse Collin 
    -Date:   2007-12-14 09:59:05 +0200
    -
    -    Fixed wrong symbol name in crc64_x86.s.
    -
    - src/liblzma/check/crc64_x86.s | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 2881570df6803eed2fe550af34574e8e61794804
    -Author: Lasse Collin 
    -Date:   2007-12-14 09:53:24 +0200
    -
    -    Use .globl instead of .global in x86 assembler code for
    -    better portability. Still needs fixing the commenting.
    -
    - src/liblzma/check/crc32_x86.s | 2 +-
    - src/liblzma/check/crc64_x86.s | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit 698470b8f33fc0e5f27dafa93b39b6dd5dde5a66
    -Author: Lasse Collin 
    -Date:   2007-12-13 20:14:37 +0200
    -
    -    Fixed a few short options that take an argument.
    -    short_opts[] was missing colons to indicate
    -    required argument. Thanks to Fabio Pedretti for
    -    the bug report.
    -
    - src/lzma/args.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 918bcb0e0728d2d976621e9f35b56f224f11d989
    -Author: Lasse Collin 
    -Date:   2007-12-11 17:08:04 +0200
    -
    -    Removed uncompressed size tracking from Delta encoder too.
    -
    - src/liblzma/common/delta_coder.c | 21 +++------------------
    - 1 file changed, 3 insertions(+), 18 deletions(-)
    -
    -commit 3e16d51dd645667b05ff826665b1fc353aa41cd9
    -Author: Lasse Collin 
    -Date:   2007-12-11 16:49:19 +0200
    -
    -    Remove uncompressed size tracking from the filter encoders.
    -    It's not strictly needed there, and just complicates the
    -    code. LZ encoder never even had this feature.
    -    
    -    The primary reason to have uncompressed size tracking in
    -    filter encoders was validating that the application
    -    doesn't give different amount of input that it had
    -    promised. A side effect was to validate internal workings
    -    of liblzma.
    -    
    -    Uncompressed size tracking is still present in the Block
    -    encoder. Maybe it should be added to LZMA_Alone and raw
    -    encoders too. It's simpler to have one coder just to
    -    validate the uncompressed size instead of having it
    -    in every filter.
    -
    - src/liblzma/common/copy_coder.c         | 25 ++--------------------
    - src/liblzma/simple/simple_coder.c       | 29 ++++---------------------
    - src/liblzma/subblock/subblock_encoder.c | 38 ++++++---------------------------
    - 3 files changed, 12 insertions(+), 80 deletions(-)
    -
    -commit 5286723e0d1ac386d5b07f08d78e61becf895a5a
    -Author: Lasse Collin 
    -Date:   2007-12-11 14:10:53 +0200
    -
    -    Get rid of no-NLS gnulib. I don't know how to get it
    -    working with Automake. People who want smaller lzmadec
    -    should use --disable-nls on non-GNU systems.
    -
    - lib/Makefile.am         | 10 +---------
    - src/lzma/Makefile.am    |  2 +-
    - src/lzmadec/Makefile.am |  4 +++-
    - 3 files changed, 5 insertions(+), 11 deletions(-)
    -
    -commit ce8b036a6c7a43b290356b673d953f6d76b2be64
    -Author: Lasse Collin 
    -Date:   2007-12-11 14:09:35 +0200
    -
    -    Fixed a typo in tests/Makefile.am which prevented
    -    building the tests if gnulib was needed.
    -
    - tests/Makefile.am | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit 7c1ad41eb611ed89e5bb8792a3beb533b7aa59f4
    -Author: Lasse Collin 
    -Date:   2007-12-11 11:18:58 +0200
    -
    -    Fixed wrong type of flags_size in Subblock encoder.
    -
    - src/liblzma/subblock/subblock_encoder.c | 2 +-
    - 1 file changed, 1 insertion(+), 1 deletion(-)
    -
    -commit ce64df716243fdc40359090d1f6541f3a4f5f21a
    -Author: Lasse Collin 
    -Date:   2007-12-10 20:44:16 +0200
    -
    -    Bumped version number to 4.42.3alpha.
    -
    - configure.ac                   | 2 +-
    - src/liblzma/api/lzma/version.h | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit b499a0403ea5c41d6a25b40275eb6c57643052ce
    -Author: Lasse Collin 
    -Date:   2007-12-10 15:02:50 +0200
    -
    -    Disabled some unneeded warnings and made "make dist" work.
    -
    - Makefile.am  |  9 +++------
    - configure.ac |  9 ++++++---
    - po/fi.po     | 47 ++++++++++++++++++++++++-----------------------
    - 3 files changed, 33 insertions(+), 32 deletions(-)
    -
    -commit 2ab8adb5165a0b77114a7eb21f9ff1e6a266f172
    -Author: Lasse Collin 
    -Date:   2007-12-09 21:43:15 +0200
    -
    -    Added LZMA_SYNC_FLUSH support to the Copy filter.
    -
    - src/liblzma/common/copy_coder.c | 92 +++++++++++++++++++++++++----------------
    - 1 file changed, 57 insertions(+), 35 deletions(-)
    -
    -commit 329c272d501e88793dda5540358d55c12428d194
    -Author: Lasse Collin 
    -Date:   2007-12-09 17:14:07 +0200
    -
    -    Added missing LZMA_API to the C versions of the CRC functions.
    -    The x86 assembler versions were already OK.
    -
    - src/liblzma/check/crc32.c | 2 +-
    - src/liblzma/check/crc64.c | 2 +-
    - 2 files changed, 2 insertions(+), 2 deletions(-)
    -
    -commit c90daf86ce683fa8cf80491d624ffb158dfbd9d7
    -Author: Jim Meyering 
    -Date:   2007-12-09 15:34:25 +0100
    -
    -    * tests/test_block_header.c (test3): Remove duplicate initializer.
    -
    - autogen.sh                | 2 +-
    - tests/test_block_header.c | 1 -
    - 2 files changed, 1 insertion(+), 2 deletions(-)
    -
    -commit 07ac881779a8477f2c1ab112b91a129e24aa743c
    -Author: Lasse Collin 
    -Date:   2007-12-09 17:06:45 +0200
    -
    -    Take advantage of return_if_error() macro in more places.
    -    Cleaned Subblock filter's initialization code too.
    -
    - src/liblzma/common/block_decoder.c         | 22 +++-------
    - src/liblzma/common/delta_coder.c           |  8 +---
    - src/liblzma/common/stream_decoder.c        | 17 +++-----
    - src/liblzma/common/stream_encoder_multi.c  | 68 ++++++++++--------------------
    - src/liblzma/common/stream_encoder_single.c |  8 ++--
    - src/liblzma/subblock/subblock_decoder.c    | 33 +++++----------
    - src/liblzma/subblock/subblock_encoder.c    | 45 ++++++--------------
    - 7 files changed, 63 insertions(+), 138 deletions(-)
    -
    -commit 41338717964f510ee61d70b25bd4c502ec9f77cf
    -Author: Lasse Collin 
    -Date:   2007-12-09 12:13:01 +0200
    -
    -    Added a bunch of .lzma test files.
    -
    - tests/files/bad-single-data_after_eopm.lzma         | Bin 0 -> 55 bytes
    - tests/files/bad-single-data_after_eopm_2.lzma       | Bin 0 -> 56 bytes
    - tests/files/bad-single-subblock_subblock.lzma       | Bin 0 -> 26 bytes
    - tests/files/good-cat-single-none-pad.lzma           | Bin 0 -> 64 bytes
    - tests/files/good-single-delta-lzma.tiff.lzma        | Bin 0 -> 51409 bytes
    - tests/files/good-single-lzma.lzma                   | Bin 0 -> 44 bytes
    - tests/files/good-single-none-pad.lzma               | Bin 0 -> 32 bytes
    - tests/files/good-single-none.lzma                   | Bin 0 -> 30 bytes
    - tests/files/good-single-subblock-lzma.lzma          | Bin 0 -> 50 bytes
    - tests/files/good-single-subblock_rle.lzma           | Bin 0 -> 118 bytes
    - tests/files/malicious-multi-metadata-64PiB.lzma     | Bin 0 -> 51 bytes
    - tests/files/malicious-single-subblock-256MiB.lzma   | Bin 0 -> 30 bytes
    - tests/files/malicious-single-subblock-64PiB.lzma    | Bin 0 -> 45 bytes
    - tests/files/malicious-single-subblock-loop.lzma     | Bin 0 -> 43 bytes
    - tests/files/malicious-single-subblock-lzma.lzma     | Bin 0 -> 505 bytes
    - tests/files/malicious-single-subblock1023-slow.lzma | Bin 0 -> 7886 bytes
    - tests/files/malicious-single-subblock31-slow.lzma   | Bin 0 -> 1233 bytes
    - 17 files changed, 0 insertions(+), 0 deletions(-)
    -
    -commit ff946ceb7975d4f11950afd33f6315b4d20d1a03
    -Author: Lasse Collin 
    -Date:   2007-12-09 11:24:48 +0200
    -
    -    Re-enabled the security checks in Subblock decoder
    -    that were disabled for debugging reasons.
    -
    - src/liblzma/subblock/subblock_decoder.c | 6 +++---
    - 1 file changed, 3 insertions(+), 3 deletions(-)
    -
    -commit 2bf36d22d2c24ac3f488e63b35564fa2f6dab8d1
    -Author: Lasse Collin 
    -Date:   2007-12-09 11:03:28 +0200
    -
    -    Fixed the tests to build with -Werror.
    -
    - tests/test_block_header.c |  2 +-
    - tests/test_check.c        |  2 +-
    - tests/test_filter_flags.c |  2 +-
    - tests/test_index.c        | 14 +++++++-------
    - tests/test_info.c         |  2 +-
    - tests/test_stream_flags.c |  2 +-
    - 6 files changed, 12 insertions(+), 12 deletions(-)
    -
    -commit 5d018dc03549c1ee4958364712fb0c94e1bf2741
    -Author: Lasse Collin 
    -Date:   2007-12-09 00:42:33 +0200
    -
    -    Imported to git.
    -
    - AUTHORS                                        |   18 +
    - COPYING                                        |   24 +
    - COPYING.GPLv2                                  |  339 +++++
    - COPYING.GPLv3                                  |  674 +++++++++
    - COPYING.LGPLv2.1                               |  504 +++++++
    - ChangeLog                                      |    2 +
    - Doxyfile.in                                    | 1229 ++++++++++++++++
    - Makefile.am                                    |   38 +
    - NEWS                                           |    0
    - README                                         |  151 ++
    - THANKS                                         |   23 +
    - TODO                                           |  109 ++
    - autogen.sh                                     |   38 +
    - configure.ac                                   |  611 ++++++++
    - doc/bugs.txt                                   |   46 +
    - doc/faq.txt                                    |  247 ++++
    - doc/file-format.txt                            | 1861 ++++++++++++++++++++++++
    - doc/history.txt                                |  140 ++
    - doc/liblzma-advanced.txt                       |  324 +++++
    - doc/liblzma-hacking.txt                        |  112 ++
    - doc/liblzma-intro.txt                          |  188 +++
    - doc/liblzma-security.txt                       |  219 +++
    - doc/lzma-intro.txt                             |  107 ++
    - extra/scanlzma/scanlzma.c                      |   85 ++
    - lib/Makefile.am                                |   40 +
    - lib/getopt.c                                   | 1191 +++++++++++++++
    - lib/getopt1.c                                  |  171 +++
    - lib/getopt_.h                                  |  226 +++
    - lib/getopt_int.h                               |  131 ++
    - lib/gettext.h                                  |  240 +++
    - m4/acx_pthread.m4                              |  279 ++++
    - m4/getopt.m4                                   |   83 ++
    - po/LINGUAS                                     |    1 +
    - po/Makevars                                    |   46 +
    - po/POTFILES.in                                 |   13 +
    - po/fi.po                                       |  445 ++++++
    - src/Makefile.am                                |   16 +
    - src/common/open_stdxxx.h                       |   50 +
    - src/common/physmem.h                           |   77 +
    - src/common/sysdefs.h                           |  100 ++
    - src/liblzma/Makefile.am                        |   47 +
    - src/liblzma/api/Makefile.am                    |   39 +
    - src/liblzma/api/lzma.h                         |  122 ++
    - src/liblzma/api/lzma/alignment.h               |   60 +
    - src/liblzma/api/lzma/alone.h                   |   82 ++
    - src/liblzma/api/lzma/auto.h                    |   41 +
    - src/liblzma/api/lzma/base.h                    |  410 ++++++
    - src/liblzma/api/lzma/block.h                   |  409 ++++++
    - src/liblzma/api/lzma/check.h                   |  128 ++
    - src/liblzma/api/lzma/copy.h                    |   29 +
    - src/liblzma/api/lzma/delta.h                   |   49 +
    - src/liblzma/api/lzma/extra.h                   |  114 ++
    - src/liblzma/api/lzma/filter.h                  |  166 +++
    - src/liblzma/api/lzma/index.h                   |   84 ++
    - src/liblzma/api/lzma/info.h                    |  315 ++++
    - src/liblzma/api/lzma/init.h                    |   85 ++
    - src/liblzma/api/lzma/lzma.h                    |  312 ++++
    - src/liblzma/api/lzma/memlimit.h                |  157 ++
    - src/liblzma/api/lzma/metadata.h                |  100 ++
    - src/liblzma/api/lzma/raw.h                     |   72 +
    - src/liblzma/api/lzma/simple.h                  |   85 ++
    - src/liblzma/api/lzma/stream.h                  |  178 +++
    - src/liblzma/api/lzma/stream_flags.h            |  142 ++
    - src/liblzma/api/lzma/subblock.h                |  197 +++
    - src/liblzma/api/lzma/version.h                 |   59 +
    - src/liblzma/api/lzma/vli.h                     |  244 ++++
    - src/liblzma/check/Makefile.am                  |   64 +
    - src/liblzma/check/check.c                      |  160 ++
    - src/liblzma/check/check.h                      |  102 ++
    - src/liblzma/check/check_byteswap.h             |   43 +
    - src/liblzma/check/check_init.c                 |   37 +
    - src/liblzma/check/crc32.c                      |   88 ++
    - src/liblzma/check/crc32_init.c                 |   58 +
    - src/liblzma/check/crc32_table.c                |   22 +
    - src/liblzma/check/crc32_table_be.h             |  527 +++++++
    - src/liblzma/check/crc32_table_le.h             |  527 +++++++
    - src/liblzma/check/crc32_tablegen.c             |   55 +
    - src/liblzma/check/crc32_x86.s                  |  217 +++
    - src/liblzma/check/crc64.c                      |   75 +
    - src/liblzma/check/crc64_init.c                 |   58 +
    - src/liblzma/check/crc64_table.c                |   22 +
    - src/liblzma/check/crc64_table_be.h             |  523 +++++++
    - src/liblzma/check/crc64_table_le.h             |  523 +++++++
    - src/liblzma/check/crc64_tablegen.c             |   56 +
    - src/liblzma/check/crc64_x86.s                  |  203 +++
    - src/liblzma/check/crc_macros.h                 |   33 +
    - src/liblzma/check/sha256.c                     |  203 +++
    - src/liblzma/common/Makefile.am                 |   94 ++
    - src/liblzma/common/alignment.c                 |  118 ++
    - src/liblzma/common/allocator.c                 |   57 +
    - src/liblzma/common/alone_decoder.c             |  197 +++
    - src/liblzma/common/alone_decoder.h             |   24 +
    - src/liblzma/common/alone_encoder.c             |  167 +++
    - src/liblzma/common/auto_decoder.c              |  113 ++
    - src/liblzma/common/block_decoder.c             |  405 ++++++
    - src/liblzma/common/block_decoder.h             |   29 +
    - src/liblzma/common/block_encoder.c             |  375 +++++
    - src/liblzma/common/block_encoder.h             |   29 +
    - src/liblzma/common/block_header_decoder.c      |  373 +++++
    - src/liblzma/common/block_header_encoder.c      |  211 +++
    - src/liblzma/common/block_private.h             |   46 +
    - src/liblzma/common/chunk_size.c                |   74 +
    - src/liblzma/common/code.c                      |  203 +++
    - src/liblzma/common/common.h                    |  271 ++++
    - src/liblzma/common/copy_coder.c                |  143 ++
    - src/liblzma/common/copy_coder.h                |   31 +
    - src/liblzma/common/delta_coder.c               |  210 +++
    - src/liblzma/common/delta_coder.h               |   31 +
    - src/liblzma/common/extra.c                     |   33 +
    - src/liblzma/common/features.c                  |   70 +
    - src/liblzma/common/filter_flags_decoder.c      |  382 +++++
    - src/liblzma/common/filter_flags_encoder.c      |  359 +++++
    - src/liblzma/common/index.c                     |  140 ++
    - src/liblzma/common/info.c                      |  823 +++++++++++
    - src/liblzma/common/init.c                      |   39 +
    - src/liblzma/common/init_decoder.c              |   33 +
    - src/liblzma/common/init_encoder.c              |   44 +
    - src/liblzma/common/memory_limitter.c           |  200 +++
    - src/liblzma/common/memory_usage.c              |  113 ++
    - src/liblzma/common/metadata_decoder.c          |  555 +++++++
    - src/liblzma/common/metadata_decoder.h          |   31 +
    - src/liblzma/common/metadata_encoder.c          |  436 ++++++
    - src/liblzma/common/metadata_encoder.h          |   30 +
    - src/liblzma/common/next_coder.c                |   65 +
    - src/liblzma/common/raw_common.c                |  175 +++
    - src/liblzma/common/raw_common.h                |   31 +
    - src/liblzma/common/raw_decoder.c               |  127 ++
    - src/liblzma/common/raw_decoder.h               |   30 +
    - src/liblzma/common/raw_encoder.c               |  124 ++
    - src/liblzma/common/raw_encoder.h               |   30 +
    - src/liblzma/common/stream_common.c             |   23 +
    - src/liblzma/common/stream_common.h             |   28 +
    - src/liblzma/common/stream_decoder.c            |  454 ++++++
    - src/liblzma/common/stream_encoder_multi.c      |  460 ++++++
    - src/liblzma/common/stream_encoder_single.c     |  220 +++
    - src/liblzma/common/stream_flags_decoder.c      |  258 ++++
    - src/liblzma/common/stream_flags_decoder.h      |   31 +
    - src/liblzma/common/stream_flags_encoder.c      |   75 +
    - src/liblzma/common/sysdefs.h                   |    1 +
    - src/liblzma/common/version.c                   |   25 +
    - src/liblzma/common/vli_decoder.c               |   69 +
    - src/liblzma/common/vli_encoder.c               |   81 ++
    - src/liblzma/common/vli_reverse_decoder.c       |   55 +
    - src/liblzma/lz/Makefile.am                     |   63 +
    - src/liblzma/lz/bt2.c                           |   27 +
    - src/liblzma/lz/bt2.h                           |   31 +
    - src/liblzma/lz/bt3.c                           |   29 +
    - src/liblzma/lz/bt3.h                           |   31 +
    - src/liblzma/lz/bt4.c                           |   30 +
    - src/liblzma/lz/bt4.h                           |   31 +
    - src/liblzma/lz/hc3.c                           |   30 +
    - src/liblzma/lz/hc3.h                           |   31 +
    - src/liblzma/lz/hc4.c                           |   31 +
    - src/liblzma/lz/hc4.h                           |   31 +
    - src/liblzma/lz/lz_decoder.c                    |  462 ++++++
    - src/liblzma/lz/lz_decoder.h                    |  214 +++
    - src/liblzma/lz/lz_encoder.c                    |  481 ++++++
    - src/liblzma/lz/lz_encoder.h                    |  161 ++
    - src/liblzma/lz/lz_encoder_private.h            |   40 +
    - src/liblzma/lz/match_c.h                       |  401 +++++
    - src/liblzma/lz/match_h.h                       |   69 +
    - src/liblzma/lzma.pc.in                         |   11 +
    - src/liblzma/lzma/Makefile.am                   |   43 +
    - src/liblzma/lzma/lzma_common.h                 |  128 ++
    - src/liblzma/lzma/lzma_decoder.c                |  844 +++++++++++
    - src/liblzma/lzma/lzma_decoder.h                |   41 +
    - src/liblzma/lzma/lzma_encoder.c                |  413 ++++++
    - src/liblzma/lzma/lzma_encoder.h                |   35 +
    - src/liblzma/lzma/lzma_encoder_features.c       |   59 +
    - src/liblzma/lzma/lzma_encoder_getoptimum.c     |  893 ++++++++++++
    - src/liblzma/lzma/lzma_encoder_getoptimumfast.c |  201 +++
    - src/liblzma/lzma/lzma_encoder_init.c           |  245 ++++
    - src/liblzma/lzma/lzma_encoder_presets.c        |   34 +
    - src/liblzma/lzma/lzma_encoder_private.h        |  225 +++
    - src/liblzma/lzma/lzma_literal.c                |   74 +
    - src/liblzma/lzma/lzma_literal.h                |   74 +
    - src/liblzma/rangecoder/Makefile.am             |   28 +
    - src/liblzma/rangecoder/range_common.h          |   68 +
    - src/liblzma/rangecoder/range_decoder.h         |  189 +++
    - src/liblzma/rangecoder/range_encoder.c         |   46 +
    - src/liblzma/rangecoder/range_encoder.h         |  317 ++++
    - src/liblzma/simple/Makefile.am                 |   46 +
    - src/liblzma/simple/arm.c                       |   76 +
    - src/liblzma/simple/armthumb.c                  |   81 ++
    - src/liblzma/simple/ia64.c                      |  117 ++
    - src/liblzma/simple/powerpc.c                   |   80 +
    - src/liblzma/simple/simple_coder.c              |  306 ++++
    - src/liblzma/simple/simple_coder.h              |   68 +
    - src/liblzma/simple/simple_private.h            |   86 ++
    - src/liblzma/simple/sparc.c                     |   88 ++
    - src/liblzma/simple/x86.c                       |  161 ++
    - src/liblzma/subblock/Makefile.am               |   33 +
    - src/liblzma/subblock/subblock_decoder.c        |  681 +++++++++
    - src/liblzma/subblock/subblock_decoder.h        |   29 +
    - src/liblzma/subblock/subblock_decoder_helper.c |   80 +
    - src/liblzma/subblock/subblock_decoder_helper.h |   36 +
    - src/liblzma/subblock/subblock_encoder.c        |  841 +++++++++++
    - src/liblzma/subblock/subblock_encoder.h        |   28 +
    - src/lzma/Makefile.am                           |   63 +
    - src/lzma/alloc.c                               |  106 ++
    - src/lzma/alloc.h                               |   42 +
    - src/lzma/args.c                                |  566 +++++++
    - src/lzma/args.h                                |   64 +
    - src/lzma/error.c                               |  156 ++
    - src/lzma/error.h                               |   67 +
    - src/lzma/hardware.c                            |   99 ++
    - src/lzma/hardware.h                            |   31 +
    - src/lzma/help.c                                |  178 +++
    - src/lzma/help.h                                |   32 +
    - src/lzma/io.c                                  |  664 +++++++++
    - src/lzma/io.h                                  |   60 +
    - src/lzma/list.c                                |  477 ++++++
    - src/lzma/main.c                                |  254 ++++
    - src/lzma/options.c                             |  346 +++++
    - src/lzma/options.h                             |   46 +
    - src/lzma/private.h                             |   55 +
    - src/lzma/process.c                             |  458 ++++++
    - src/lzma/process.h                             |   30 +
    - src/lzma/suffix.c                              |  145 ++
    - src/lzma/suffix.h                              |   25 +
    - src/lzma/util.c                                |  182 +++
    - src/lzma/util.h                                |   32 +
    - src/lzmadec/Makefile.am                        |   27 +
    - src/lzmadec/lzmadec.c                          |  515 +++++++
    - src/scripts/Makefile.am                        |   24 +
    - src/scripts/lzdiff                             |   67 +
    - src/scripts/lzdiff.1                           |   51 +
    - src/scripts/lzgrep                             |  123 ++
    - src/scripts/lzgrep.1                           |   61 +
    - src/scripts/lzmore                             |   74 +
    - src/scripts/lzmore.1                           |   55 +
    - tests/Makefile.am                              |   43 +
    - tests/test_block.c                             |   59 +
    - tests/test_block_header.c                      |  352 +++++
    - tests/test_check.c                             |   90 ++
    - tests/test_filter_flags.c                      |  326 +++++
    - tests/test_index.c                             |   43 +
    - tests/test_info.c                              |  717 +++++++++
    - tests/test_stream_flags.c                      |  191 +++
    - tests/tests.h                                  |  148 ++
    - 240 files changed, 42513 insertions(+)
    diff --git a/external/public-domain/xz/dist/INSTALL b/external/public-domain/xz/dist/INSTALL
    deleted file mode 100644
    index fece4b74b..000000000
    --- a/external/public-domain/xz/dist/INSTALL
    +++ /dev/null
    @@ -1,545 +0,0 @@
    -
    -XZ Utils Installation
    -=====================
    -
    -    0. Preface
    -    1. Supported platforms
    -       1.1. Compilers
    -       1.2. Platform-specific notes
    -            1.2.1. AIX
    -            1.2.2. IRIX
    -            1.2.3. MINIX 3
    -            1.2.4. OpenVMS
    -            1.2.5. Solaris, OpenSolaris, and derivatives
    -            1.2.6. Tru64
    -            1.2.7. Windows
    -            1.2.8. DOS
    -       1.3. Adding support for new platforms
    -    2. configure options
    -       2.1. Static vs. dynamic linking of liblzma
    -       2.2. Optimizing xzdec and lzmadec
    -    3. xzgrep and other scripts
    -       3.1. Dependencies
    -       3.2. PATH
    -    4. Troubleshooting
    -       4.1. "No C99 compiler was found."
    -       4.2. "No POSIX conforming shell (sh) was found."
    -       4.3. configure works but build fails at crc32_x86.S
    -       4.4. Lots of warnings about symbol visibility
    -       4.5. "make check" fails
    -       4.6. liblzma.so (or similar) not found when running xz
    -
    -
    -0. Preface
    -----------
    -
    -    If you aren't familiar with building packages that use GNU Autotools,
    -    see the file INSTALL.generic for generic instructions before reading
    -    further.
    -
    -    If you are going to build a package for distribution, see also the
    -    file PACKAGERS. It contains information that should help making the
    -    binary packages as good as possible, but the information isn't very
    -    interesting to those making local builds for private use or for use
    -    in special situations like embedded systems.
    -
    -
    -1. Supported platforms
    -----------------------
    -
    -    XZ Utils are developed on GNU/Linux, but they should work on many
    -    POSIX-like operating systems like *BSDs and Solaris, and even on
    -    a few non-POSIX operating systems.
    -
    -
    -1.1. Compilers
    -
    -    A C99 compiler is required to compile XZ Utils. If you use GCC, you
    -    need at least version 3.x.x. GCC version 2.xx.x doesn't support some
    -    C99 features used in XZ Utils source code, thus GCC 2 won't compile
    -    XZ Utils.
    -
    -    XZ Utils takes advantage of some GNU C extensions when building
    -    with GCC. Because these extensions are used only when building
    -    with GCC, it should be possible to use any C99 compiler.
    -
    -
    -1.2. Platform-specific notes
    -
    -1.2.1. AIX
    -
    -    If you use IBM XL C compiler, pass CC=xlc_r to configure. If
    -    you use CC=xlc instead, you must disable threading support
    -    with --disable-threads (usually not recommended).
    -
    -
    -1.2.2. IRIX
    -
    -    MIPSpro 7.4.4m has been reported to produce broken code if using
    -    the -O2 optimization flag ("make check" fails). Using -O1 should
    -    work.
    -
    -    A problem has been reported when using shared liblzma. Passing
    -    --disable-shared to configure works around this. Alternatively,
    -    putting "-64" to CFLAGS to build a 64-bit version might help too.
    -
    -
    -1.2.3. MINIX 3
    -
    -    The default install of MINIX 3 includes Amsterdam Compiler Kit (ACK),
    -    which doesn't support C99. Install GCC to compile XZ Utils.
    -
    -    MINIX 3.1.8 and older have bugs in /usr/include/stdint.h, which has
    -    to be patched before XZ Utils can be compiled correctly. See
    -    .
    -
    -    MINIX 3.2.0 and later use a different libc and aren't affected by
    -    the above bug.
    -
    -    XZ Utils doesn't have code to detect the amount of physical RAM and
    -    number of CPU cores on MINIX 3.
    -
    -    See section 4.4 in this file about symbol visibility warnings (you
    -    may want to pass gl_cv_cc_visibility=no to configure).
    -
    -
    -1.2.4. OpenVMS
    -
    -    XZ Utils can be built for OpenVMS, but the build system files
    -    are not included in the XZ Utils source package. The required
    -    OpenVMS-specific files are maintained by Jouk Jansen and can be
    -    downloaded here:
    -
    -        http://nchrem.tnw.tudelft.nl/openvms/software2.html#xzutils
    -
    -
    -1.2.5. Solaris, OpenSolaris, and derivatives
    -
    -    The following linker error has been reported on some x86 systems:
    -
    -        ld: fatal: relocation error: R_386_GOTOFF: ...
    -
    -    This can be worked around by passing gl_cv_cc_visibility=no
    -    as an argument to the configure script.
    -
    -    test_scripts.sh in "make check" may fail if good enough tools are
    -    missing from PATH (/usr/xpg4/bin or /usr/xpg6/bin). See sections
    -    4.5 and 3.2 for more information.
    -
    -
    -1.2.6. Tru64
    -
    -    If you try to use the native C compiler on Tru64 (passing CC=cc to
    -    configure), you may need the workaround mention in section 4.1 in
    -    this file (pass also ac_cv_prog_cc_c99= to configure).
    -
    -
    -1.2.7. Windows
    -
    -    Building XZ Utils on Windows is supported under MinGW + MSYS,
    -    MinGW-w64 + MSYS, and Cygwin. There is windows/build.bash to
    -    ease packaging XZ Utils with MinGW(-w64) + MSYS into a
    -    redistributable .zip or .7z file. See windows/INSTALL-Windows.txt
    -    for more information.
    -
    -    It may be possible to build liblzma with other toolchains too, but
    -    that will probably require writing a separate makefile. Building
    -    the command line tools with non-GNU toolchains will be harder than
    -    building only liblzma.
    -
    -    Starting with XZ Utils 5.2.0, building liblzma (not the whole
    -    XZ Utils) should work with MSVC 2013 update 2 or later using
    -    windows/config.h. No project files or makefiles are included yet,
    -    so the build process isn't as convenient yet as it could be.
    -
    -    Even if liblzma is built with MinGW(-w64), the resulting DLL can
    -    be used by other compilers and linkers, including MSVC. See
    -    windows/README-Windows.txt for details.
    -
    -
    -1.2.8. DOS
    -
    -    There is an experimental Makefile in the "dos" directory to build
    -    XZ Utils on DOS using DJGPP. Support for long file names (LFN) is
    -    needed. See dos/README for more information.
    -
    -    GNU Autotools based build hasn't been tried on DOS. If you try, I
    -    would like to hear if it worked.
    -
    -
    -1.3. Adding support for new platforms
    -
    -    If you have written patches to make XZ Utils to work on previously
    -    unsupported platform, please send the patches to me! I will consider
    -    including them to the official version. It's nice to minimize the
    -    need of third-party patching.
    -
    -    One exception: Don't request or send patches to change the whole
    -    source package to C89. I find C99 substantially nicer to write and
    -    maintain. However, the public library headers must be in C89 to
    -    avoid frustrating those who maintain programs, which are strictly
    -    in C89 or C++.
    -
    -
    -2. configure options
    ---------------------
    -
    -    In most cases, the defaults are what you want. Many of the options
    -    below are useful only when building a size-optimized version of
    -    liblzma or command line tools.
    -
    -    --enable-encoders=LIST
    -    --disable-encoders
    -                Specify a comma-separated LIST of filter encoders to
    -                build. See "./configure --help" for exact list of
    -                available filter encoders. The default is to build all
    -                supported encoders.
    -
    -                If LIST is empty or --disable-encoders is used, no filter
    -                encoders will be built and also the code shared between
    -                encoders will be omitted.
    -
    -                Disabling encoders will remove some symbols from the
    -                liblzma ABI, so this option should be used only when it
    -                is known to not cause problems.
    -
    -    --enable-decoders=LIST
    -    --disable-decoders
    -                This is like --enable-encoders but for decoders. The
    -                default is to build all supported decoders.
    -
    -    --enable-match-finders=LIST
    -                liblzma includes two categories of match finders:
    -                hash chains and binary trees. Hash chains (hc3 and hc4)
    -                are quite fast but they don't provide the best compression
    -                ratio. Binary trees (bt2, bt3 and bt4) give excellent
    -                compression ratio, but they are slower and need more
    -                memory than hash chains.
    -
    -                You need to enable at least one match finder to build the
    -                LZMA1 or LZMA2 filter encoders. Usually hash chains are
    -                used only in the fast mode, while binary trees are used to
    -                when the best compression ratio is wanted.
    -
    -                The default is to build all the match finders if LZMA1
    -                or LZMA2 filter encoders are being built.
    -
    -    --enable-checks=LIST
    -                liblzma support multiple integrity checks. CRC32 is
    -                mandatory, and cannot be omitted. See "./configure --help"
    -                for exact list of available integrity check types.
    -
    -                liblzma and the command line tools can decompress files
    -                which use unsupported integrity check type, but naturally
    -                the file integrity cannot be verified in that case.
    -
    -                Disabling integrity checks may remove some symbols from
    -                the liblzma ABI, so this option should be used only when
    -                it is known to not cause problems.
    -
    -    --disable-xz
    -    --disable-xzdec
    -    --disable-lzmadec
    -    --disable-lzmainfo
    -                Don't build and install the command line tool mentioned
    -                in the option name.
    -
    -                NOTE: Disabling xz will skip some tests in "make check".
    -
    -                NOTE: If xzdec is disabled and lzmadec is left enabled,
    -                a dangling man page symlink lzmadec.1 -> xzdec.1 is
    -                created.
    -
    -    --disable-lzma-links
    -                Don't create symlinks for LZMA Utils compatibility.
    -                This includes lzma, unlzma, and lzcat. If scripts are
    -                installed, also lzdiff, lzcmp, lzgrep, lzegrep, lzfgrep,
    -                lzmore, and lzless will be omitted if this option is used.
    -
    -    --disable-scripts
    -                Don't install the scripts xzdiff, xzgrep, xzmore, xzless,
    -                and their symlinks.
    -
    -    --disable-doc
    -                Don't install the documentation files to $docdir
    -                (often /usr/doc/xz or /usr/local/doc/xz). Man pages
    -                will still be installed. The $docdir can be changed
    -                with --docdir=DIR.
    -
    -    --disable-assembler
    -                liblzma includes some assembler optimizations. Currently
    -                there is only assembler code for CRC32 and CRC64 for
    -                32-bit x86.
    -
    -                All the assembler code in liblzma is position-independent
    -                code, which is suitable for use in shared libraries and
    -                position-independent executables. So far only i386
    -                instructions are used, but the code is optimized for i686
    -                class CPUs. If you are compiling liblzma exclusively for
    -                pre-i686 systems, you may want to disable the assembler
    -                code.
    -
    -    --enable-unaligned-access
    -                Allow liblzma to use unaligned memory access for 16-bit
    -                and 32-bit loads and stores. This should be enabled only
    -                when the hardware supports this, i.e. when unaligned
    -                access is fast. Some operating system kernels emulate
    -                unaligned access, which is extremely slow. This option
    -                shouldn't be used on systems that rely on such emulation.
    -
    -                Unaligned access is enabled by default on x86, x86-64,
    -                and big endian PowerPC.
    -
    -    --enable-small
    -                Reduce the size of liblzma by selecting smaller but
    -                semantically equivalent version of some functions, and
    -                omit precomputed lookup tables. This option tends to
    -                make liblzma slightly slower.
    -
    -                Note that while omitting the precomputed tables makes
    -                liblzma smaller on disk, the tables are still needed at
    -                run time, and need to be computed at startup. This also
    -                means that the RAM holding the tables won't be shared
    -                between applications linked against shared liblzma.
    -
    -                This option doesn't modify CFLAGS to tell the compiler
    -                to optimize for size. You need to add -Os or equivalent
    -                flag(s) to CFLAGS manually.
    -
    -    --enable-assume-ram=SIZE
    -                On the most common operating systems, XZ Utils is able to
    -                detect the amount of physical memory on the system. This
    -                information is used by the options --memlimit-compress,
    -                --memlimit-decompress, and --memlimit when setting the
    -                limit to a percentage of total RAM.
    -
    -                On some systems, there is no code to detect the amount of
    -                RAM though. Using --enable-assume-ram one can set how much
    -                memory to assume on these systems. SIZE is given as MiB.
    -                The default is 128 MiB.
    -
    -                Feel free to send patches to add support for detecting
    -                the amount of RAM on the operating system you use. See
    -                src/common/tuklib_physmem.c for details.
    -
    -    --enable-threads=METHOD
    -                Threading support is enabled by default so normally there
    -                is no need to specify this option.
    -
    -                Supported values for METHOD:
    -
    -                        yes     Autodetect the threading method. If none
    -                                is found, configure will give an error.
    -
    -                        posix   Use POSIX pthreads. This is the default
    -                                except on Windows outside Cygwin.
    -
    -                        win95   Use Windows 95 compatible threads. This
    -                                is compatible with Windows XP and later
    -                                too. This is the default for 32-bit x86
    -                                Windows builds. The `win95' threading is
    -                                incompatible with --enable-small.
    -
    -                        vista   Use Windows Vista compatible threads. The
    -                                resulting binaries won't run on Windows XP
    -                                or older. This is the default for Windows
    -                                excluding 32-bit x86 builds (that is, on
    -                                x86-64 the default is `vista').
    -
    -                        no      Disable threading support. This is the
    -                                same as using --disable-threads.
    -                                NOTE: If combined with --enable-small, the
    -                                resulting liblzma won't be thread safe,
    -                                that is, if a multi-threaded application
    -                                calls any liblzma functions from more than
    -                                one thread, something bad may happen.
    -
    -    --enable-symbol-versions
    -                Use symbol versioning for liblzma. This is enabled by
    -                default on GNU/Linux, other GNU-based systems, and
    -                FreeBSD.
    -
    -    --enable-debug
    -                This enables the assert() macro and possibly some other
    -                run-time consistency checks. It makes the code slower, so
    -                you normally don't want to have this enabled.
    -
    -    --enable-werror
    -                If building with GCC, make all compiler warnings an error,
    -                that abort the compilation. This may help catching bugs,
    -                and should work on most systems. This has no effect on the
    -                resulting binaries.
    -
    -
    -2.1. Static vs. dynamic linking of liblzma
    -
    -    On 32-bit x86, linking against static liblzma can give a minor
    -    speed improvement. Static libraries on x86 are usually compiled as
    -    position-dependent code (non-PIC) and shared libraries are built as
    -    position-independent code (PIC). PIC wastes one register, which can
    -    make the code slightly slower compared to a non-PIC version. (Note
    -    that this doesn't apply to x86-64.)
    -
    -    If you want to link xz against static liblzma, the simplest way
    -    is to pass --disable-shared to configure. If you want also shared
    -    liblzma, run configure again and run "make install" only for
    -    src/liblzma.
    -
    -
    -2.2. Optimizing xzdec and lzmadec
    -
    -    xzdec and lzmadec are intended to be relatively small instead of
    -    optimizing for the best speed. Thus, it is a good idea to build
    -    xzdec and lzmadec separately:
    -
    -      - To link the tools against static liblzma, pass --disable-shared
    -        to configure.
    -
    -      - To select somewhat size-optimized variant of some things in
    -        liblzma, pass --enable-small to configure.
    -
    -      - Tell the compiler to optimize for size instead of speed.
    -        E.g. with GCC, put -Os into CFLAGS.
    -
    -      - xzdec and lzmadec will never use multithreading capabilities of
    -        liblzma. You can avoid dependency on libpthread by passing
    -        --disable-threads to configure.
    -
    -      - There are and will be no translated messages for xzdec and
    -        lzmadec, so it is fine to pass also --disable-nls to configure.
    -
    -      - Only decoder code is needed, so you can speed up the build
    -        slightly by passing --disable-encoders to configure. This
    -        shouldn't affect the final size of the executables though,
    -        because the linker is able to omit the encoder code anyway.
    -
    -    If you have no use for xzdec or lzmadec, you can disable them with
    -    --disable-xzdec and --disable-lzmadec.
    -
    -
    -3. xzgrep and other scripts
    ----------------------------
    -
    -3.1. Dependencies
    -
    -    POSIX shell (sh) and bunch of other standard POSIX tools are required
    -    to run the scripts. The configure script tries to find a POSIX
    -    compliant sh, but if it fails, you can force the shell by passing
    -    gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
    -    script.
    -
    -    xzdiff (xzcmp/lzdiff/lzcmp) may use mktemp if it is available. As
    -    a fallback xzdiff will use mkdir to securely create a temporary
    -    directory. Having mktemp available is still recommended since the
    -    mkdir fallback method isn't as robust as mktemp is. The original
    -    mktemp can be found from . On GNU, most will
    -    use the mktemp program from GNU coreutils instead of the original
    -    implementation. Both mktemp versions are fine.
    -
    -    In addition to using xz to decompress .xz files, xzgrep and xzdiff
    -    use gzip, bzip2, and lzop to support .gz, bz2, and .lzo files.
    -
    -
    -3.2. PATH
    -
    -    The scripts assume that the required tools (standard POSIX utilities,
    -    mktemp, and xz) are in PATH; the scripts don't set the PATH themselves.
    -    Some people like this while some think this is a bug. Those in the
    -    latter group can easily patch the scripts before running the configure
    -    script by taking advantage of a placeholder line in the scripts.
    -
    -    For example, to make the scripts prefix /usr/bin:/bin to PATH:
    -
    -        perl -pi -e 's|^#SET_PATH.*$|PATH=/usr/bin:/bin:\$PATH|' \
    -                src/scripts/xz*.in
    -
    -
    -4. Troubleshooting
    -------------------
    -
    -4.1. "No C99 compiler was found."
    -
    -    You need a C99 compiler to build XZ Utils. If the configure script
    -    cannot find a C99 compiler and you think you have such a compiler
    -    installed, set the compiler command by passing CC=/path/to/c99 as
    -    an argument to the configure script.
    -
    -    If you get this error even when you think your compiler supports C99,
    -    you can override the test by passing ac_cv_prog_cc_c99= as an argument
    -    to the configure script. The test for C99 compiler is not perfect (and
    -    it is not as easy to make it perfect as it sounds), so sometimes this
    -    may be needed. You will get a compile error if your compiler doesn't
    -    support enough C99.
    -
    -
    -4.2. "No POSIX conforming shell (sh) was found."
    -
    -    xzgrep and other scripts need a shell that (roughly) conforms
    -    to POSIX. The configure script tries to find such a shell. If
    -    it fails, you can force the shell to be used by passing
    -    gl_cv_posix_shell=/path/to/posix-sh as an argument to the configure
    -    script. Alternatively you can omit the installation of scripts and
    -    this error by passing --disable-scripts to configure.
    -
    -
    -4.3. configure works but build fails at crc32_x86.S
    -
    -    The easy fix is to pass --disable-assembler to the configure script.
    -
    -    The configure script determines if assembler code can be used by
    -    looking at the configure triplet; there is currently no check if
    -    the assembler code can actually actually be built. The x86 assembler
    -    code should work on x86 GNU/Linux, *BSDs, Solaris, Darwin, MinGW,
    -    Cygwin, and DJGPP. On other x86 systems, there may be problems and
    -    the assembler code may need to be disabled with the configure option.
    -
    -    If you get this error when building for x86-64, you have specified or
    -    the configure script has misguessed your architecture. Pass the
    -    correct configure triplet using the --build=CPU-COMPANY-SYSTEM option
    -    (see INSTALL.generic).
    -
    -
    -4.4. Lots of warnings about symbol visibility
    -
    -    On some systems where symbol visibility isn't supported, GCC may
    -    still accept the visibility options and attributes, which will make
    -    configure think that visibility is supported. This will result in
    -    many compiler warnings. You can avoid the warnings by forcing the
    -    visibility support off by passing gl_cv_cc_visibility=no as an
    -    argument to the configure script. This has no effect on the
    -    resulting binaries, but fewer warnings looks nicer and may allow
    -    using --enable-werror.
    -
    -
    -4.5. "make check" fails
    -
    -    If the other tests pass but test_scripts.sh fails, then the problem
    -    is in the scripts in src/scripts. Comparing the contents of
    -    tests/xzgrep_test_output to tests/xzgrep_expected_output might
    -    give a good idea about problems in xzgrep. One possibility is that
    -    some tools are missing from the current PATH or the tools lack
    -    support for some POSIX features. This can happen at least on
    -    Solaris where the tools in /bin may be ancient but good enough
    -    tools are available in /usr/xpg4/bin or /usr/xpg6/bin. One fix
    -    for this problem is described in section 3.2 of this file.
    -
    -    If tests other than test_scripts.sh fail, a likely reason is that
    -    libtool links the test programs against an installed version of
    -    liblzma instead of the version that was just built. This is
    -    obviously a bug which seems to happen on some platforms.
    -    A workaround is to uninstall the old liblzma versions first.
    -
    -    If the problem isn't any of those described above, then it's likely
    -    a bug in XZ Utils or in the compiler. See the platform-specific
    -    notes in this file for possible known problems. Please report
    -    a bug if you cannot solve the problem. See README for contact
    -    information.
    -
    -
    -4.6. liblzma.so (or similar) not found when running xz
    -
    -    If you installed the package with "make install" and get an error
    -    about liblzma.so (or a similarly named file) being missing, try
    -    running "ldconfig" to update the run-time linker cache (if your
    -    operating system has such a command).
    -
    diff --git a/external/public-domain/xz/dist/NEWS b/external/public-domain/xz/dist/NEWS
    deleted file mode 100644
    index 376abea89..000000000
    --- a/external/public-domain/xz/dist/NEWS
    +++ /dev/null
    @@ -1,486 +0,0 @@
    -
    -XZ Utils Release Notes
    -======================
    -
    -5.2.1 (2015-02-26)
    -
    -    * Fixed a compression-ratio regression in fast mode of LZMA1 and
    -      LZMA2. The bug is present in 5.1.4beta and 5.2.0 releases.
    -
    -    * Fixed a portability problem in xz that affected at least OpenBSD.
    -
    -    * Fixed xzdiff to be compatible with FreeBSD's mktemp which differs
    -      from most other mktemp implementations.
    -
    -    * Changed CPU core count detection to use cpuset_getaffinity() on
    -      FreeBSD.
    -
    -
    -5.2.0 (2014-12-21)
    -
    -    Since 5.1.4beta:
    -
    -    * All fixes from 5.0.8
    -
    -    * liblzma: Fixed lzma_stream_encoder_mt_memusage() when a preset
    -      was used.
    -
    -    * xzdiff: If mktemp isn't installed, mkdir will be used as
    -      a fallback to create a temporary directory. Installing mktemp
    -      is still recommended.
    -
    -    * Updated French, German, Italian, Polish, and Vietnamese
    -      translations.
    -
    -    Summary of fixes and new features added in the 5.1.x development
    -    releases:
    -
    -    * liblzma:
    -
    -        - Added support for multi-threaded compression. See the
    -          lzma_mt structure, lzma_stream_encoder_mt(), and
    -          lzma_stream_encoder_mt_memusage() in ,
    -          lzma_get_progress() in , and lzma_cputhreads()
    -          in  for details.
    -
    -        - Made the uses of lzma_allocator const correct.
    -
    -        - Added lzma_block_uncomp_encode() to create uncompressed
    -          .xz Blocks using LZMA2 uncompressed chunks.
    -
    -        - Added support for LZMA_IGNORE_CHECK.
    -
    -        - A few speed optimizations were made.
    -
    -        - Added support for symbol versioning. It is enabled by default
    -          on GNU/Linux, other GNU-based systems, and FreeBSD.
    -
    -        - liblzma (not the whole XZ Utils) should now be buildable
    -          with MSVC 2013 update 2 or later using windows/config.h.
    -
    -    * xz:
    -
    -        - Fixed a race condition in the signal handling. It was
    -          possible that e.g. the first SIGINT didn't make xz exit
    -          if reading or writing blocked and one had bad luck. The fix
    -          is non-trivial, so as of writing it is unknown if it will be
    -          backported to the v5.0 branch.
    -
    -        - Multi-threaded decompression can be enabled with the
    -          --threads (-T) option.
    -
    -        - New command line options in xz: --single-stream,
    -          --block-size=SIZE, --block-list=SIZES,
    -          --flush-timeout=TIMEOUT, and --ignore-check.
    -
    -        - xz -lvv now shows the minimum xz version that is required to
    -          decompress the file. Currently it is 5.0.0 for all supported
    -          .xz files except files with empty LZMA2 streams require 5.0.2.
    -
    -    * xzdiff and xzgrep now support .lzo files if lzop is installed.
    -      The .tzo suffix is also recognized as a shorthand for .tar.lzo.
    -
    -
    -5.1.4beta (2014-09-14)
    -
    -    * All fixes from 5.0.6
    -
    -    * liblzma: Fixed the use of presets in threaded encoder
    -      initialization.
    -
    -    * xz --block-list and --block-size can now be used together
    -      in single-threaded mode. Previously the combination only
    -      worked in multi-threaded mode.
    -
    -    * Added support for LZMA_IGNORE_CHECK to liblzma and made it
    -      available in xz as --ignore-check.
    -
    -    * liblzma speed optimizations:
    -
    -        - Initialization of a new LZMA1 or LZMA2 encoder has been
    -          optimized. (The speed of reinitializing an already-allocated
    -          encoder isn't affected.) This helps when compressing many
    -          small buffers with lzma_stream_buffer_encode() and other
    -          similar situations where an already-allocated encoder state
    -          isn't reused. This speed-up is visible in xz too if one
    -          compresses many small files one at a time instead running xz
    -          once and giving all files as command-line arguments.
    -
    -        - Buffer comparisons are now much faster when unaligned access
    -          is allowed (configured with --enable-unaligned-access). This
    -          speeds up encoding significantly. There is arch-specific code
    -          for 32-bit and 64-bit x86 (32-bit needs SSE2 for the best
    -          results and there's no run-time CPU detection for now).
    -          For other archs there is only generic code which probably
    -          isn't as optimal as arch-specific solutions could be.
    -
    -        - A few speed optimizations were made to the SHA-256 code.
    -          (Note that the builtin SHA-256 code isn't used on all
    -          operating systems.)
    -
    -    * liblzma can now be built with MSVC 2013 update 2 or later
    -      using windows/config.h.
    -
    -    * Vietnamese translation was added.
    -
    -
    -5.1.3alpha (2013-10-26)
    -
    -    * All fixes from 5.0.5
    -
    -    * liblzma:
    -
    -        - Fixed a deadlock in the threaded encoder.
    -
    -        - Made the uses of lzma_allocator const correct.
    -
    -        - Added lzma_block_uncomp_encode() to create uncompressed
    -          .xz Blocks using LZMA2 uncompressed chunks.
    -
    -        - Added support for native threads on Windows and the ability
    -          to detect the number of CPU cores.
    -
    -    * xz:
    -
    -        - Fixed a race condition in the signal handling. It was
    -          possible that e.g. the first SIGINT didn't make xz exit
    -          if reading or writing blocked and one had bad luck. The fix
    -          is non-trivial, so as of writing it is unknown if it will be
    -          backported to the v5.0 branch.
    -
    -        - Made the progress indicator work correctly in threaded mode.
    -
    -        - Threaded encoder now works together with --block-list=SIZES.
    -
    -        - Added preliminary support for --flush-timeout=TIMEOUT.
    -          It can be useful for (somewhat) real-time streaming. For
    -          now the decompression side has to be done with something
    -          else than the xz tool due to how xz does buffering, but this
    -          should be fixed.
    -
    -
    -5.1.2alpha (2012-07-04)
    -
    -    * All fixes from 5.0.3 and 5.0.4
    -
    -    * liblzma:
    -
    -        - Fixed a deadlock and an invalid free() in the threaded encoder.
    -
    -        - Added support for symbol versioning. It is enabled by default
    -          on GNU/Linux, other GNU-based systems, and FreeBSD.
    -
    -        - Use SHA-256 implementation from the operating system if one is
    -          available in libc, libmd, or libutil. liblzma won't use e.g.
    -          OpenSSL or libgcrypt to avoid introducing new dependencies.
    -
    -        - Fixed liblzma.pc for static linking.
    -
    -        - Fixed a few portability bugs.
    -
    -    * xz --decompress --single-stream now fixes the input position after
    -      successful decompression. Now the following works:
    -
    -          echo foo | xz > foo.xz
    -          echo bar | xz >> foo.xz
    -          ( xz -dc --single-stream ; xz -dc --single-stream ) < foo.xz
    -
    -      Note that it doesn't work if the input is not seekable
    -      or if there is Stream Padding between the concatenated
    -      .xz Streams.
    -
    -    * xz -lvv now shows the minimum xz version that is required to
    -      decompress the file. Currently it is 5.0.0 for all supported .xz
    -      files except files with empty LZMA2 streams require 5.0.2.
    -
    -    * Added an *incomplete* implementation of --block-list=SIZES to xz.
    -      It only works correctly in single-threaded mode and when
    -      --block-size isn't used at the same time. --block-list allows
    -      specifying the sizes of Blocks which can be useful e.g. when
    -      creating files for random-access reading.
    -
    -
    -5.1.1alpha (2011-04-12)
    -
    -    * All fixes from 5.0.2
    -
    -    * liblzma fixes that will also be included in 5.0.3:
    -
    -        - A memory leak was fixed.
    -
    -        - lzma_stream_buffer_encode() no longer creates an empty .xz
    -          Block if encoding an empty buffer. Such an empty Block with
    -          LZMA2 data would trigger a bug in 5.0.1 and older (see the
    -          first bullet point in 5.0.2 notes). When releasing 5.0.2,
    -          I thought that no encoder creates this kind of files but
    -          I was wrong.
    -
    -        - Validate function arguments better in a few functions. Most
    -          importantly, specifying an unsupported integrity check to
    -          lzma_stream_buffer_encode() no longer creates a corrupt .xz
    -          file. Probably no application tries to do that, so this
    -          shouldn't be a big problem in practice.
    -
    -        - Document that lzma_block_buffer_encode(),
    -          lzma_easy_buffer_encode(), lzma_stream_encoder(), and
    -          lzma_stream_buffer_encode() may return LZMA_UNSUPPORTED_CHECK.
    -
    -        - The return values of the _memusage() functions are now
    -          documented better.
    -
    -    * Support for multithreaded compression was added using the simplest
    -      method, which splits the input data into blocks and compresses
    -      them independently. Other methods will be added in the future.
    -      The current method has room for improvement, e.g. it is possible
    -      to reduce the memory usage.
    -
    -    * Added the options --single-stream and --block-size=SIZE to xz.
    -
    -    * xzdiff and xzgrep now support .lzo files if lzop is installed.
    -      The .tzo suffix is also recognized as a shorthand for .tar.lzo.
    -
    -    * Support for short 8.3 filenames under DOS was added to xz. It is
    -      experimental and may change before it gets into a stable release.
    -
    -
    -5.0.8 (2014-12-21)
    -
    -    * Fixed an old bug in xzgrep that affected OpenBSD and probably
    -      a few other operating systems too.
    -
    -    * Updated French and German translations.
    -
    -    * Added support for detecting the amount of RAM on AmigaOS/AROS.
    -
    -    * Minor build system updates.
    -
    -
    -5.0.7 (2014-09-20)
    -
    -    * Fix regressions introduced in 5.0.6:
    -
    -        - Fix building with non-GNU make.
    -
    -        - Fix invalid Libs.private value in liblzma.pc which broke
    -          static linking against liblzma if the linker flags were
    -          taken from pkg-config.
    -
    -
    -5.0.6 (2014-09-14)
    -
    -    * xzgrep now exits with status 0 if at least one file matched.
    -
    -    * A few minor portability and build system fixes
    -
    -
    -5.0.5 (2013-06-30)
    -
    -    * lzmadec and liblzma's lzma_alone_decoder(): Support decompressing
    -      .lzma files that have less common settings in the headers
    -      (dictionary size other than 2^n or 2^n + 2^(n-1), or uncompressed
    -      size greater than 256 GiB). The limitations existed to avoid false
    -      positives when detecting .lzma files. The lc + lp <= 4 limitation
    -      still remains since liblzma's LZMA decoder has that limitation.
    -
    -      NOTE: xz's .lzma support or liblzma's lzma_auto_decoder() are NOT
    -      affected by this change. They still consider uncommon .lzma headers
    -      as not being in the .lzma format. Changing this would give way too
    -      many false positives.
    -
    -    * xz:
    -
    -        - Interaction of preset and custom filter chain options was
    -          made less illogical. This affects only certain less typical
    -          uses cases so few people are expected to notice this change.
    -
    -          Now when a custom filter chain option (e.g. --lzma2) is
    -          specified, all preset options (-0 ... -9, -e) earlier are on
    -          the command line are completely forgotten. Similarly, when
    -          a preset option is specified, all custom filter chain options
    -          earlier on the command line are completely forgotten.
    -
    -          Example 1: "xz -9 --lzma2=preset=5 -e" is equivalent to "xz -e"
    -          which is equivalent to "xz -6e". Earlier -e didn't put xz back
    -          into preset mode and thus the example command was equivalent
    -          to "xz --lzma2=preset=5".
    -
    -          Example 2: "xz -9e --lzma2=preset=5 -7" is equivalent to
    -          "xz -7". Earlier a custom filter chain option didn't make
    -          xz forget the -e option so the example was equivalent to
    -          "xz -7e".
    -
    -        - Fixes and improvements to error handling.
    -
    -        - Various fixes to the man page.
    -
    -    * xzless: Fixed to work with "less" versions 448 and later.
    -
    -    * xzgrep: Made -h an alias for --no-filename.
    -
    -    * Include the previously missing debug/translation.bash which can
    -      be useful for translators.
    -
    -    * Include a build script for Mac OS X. This has been in the Git
    -      repository since 2010 but due to a mistake in Makefile.am the
    -      script hasn't been included in a release tarball before.
    -
    -
    -5.0.4 (2012-06-22)
    -
    -    * liblzma:
    -
    -        - Fix lzma_index_init(). It could crash if memory allocation
    -          failed.
    -
    -        - Fix the possibility of an incorrect LZMA_BUF_ERROR when a BCJ
    -          filter is used and the application only provides exactly as
    -          much output space as is the uncompressed size of the file.
    -
    -        - Fix a bug in doc/examples_old/xz_pipe_decompress.c. It didn't
    -          check if the last call to lzma_code() really returned
    -          LZMA_STREAM_END, which made the program think that truncated
    -          files are valid.
    -
    -        - New example programs in doc/examples (old programs are now in
    -          doc/examples_old). These have more comments and more detailed
    -          error handling.
    -
    -    * Fix "xz -lvv foo.xz". It could crash on some corrupted files.
    -
    -    * Fix output of "xz --robot -lv" and "xz --robot -lvv" which
    -      incorrectly printed the filename also in the "foo (x/x)" format.
    -
    -    * Fix exit status of "xzdiff foo.xz bar.xz".
    -
    -    * Fix exit status of "xzgrep foo binary_file".
    -
    -    * Fix portability to EBCDIC systems.
    -
    -    * Fix a configure issue on AIX with the XL C compiler. See INSTALL
    -      for details.
    -
    -    * Update French, German, Italian, and Polish translations.
    -
    -
    -5.0.3 (2011-05-21)
    -
    -    * liblzma fixes:
    -
    -        - A memory leak was fixed.
    -
    -        - lzma_stream_buffer_encode() no longer creates an empty .xz
    -          Block if encoding an empty buffer. Such an empty Block with
    -          LZMA2 data would trigger a bug in 5.0.1 and older (see the
    -          first bullet point in 5.0.2 notes). When releasing 5.0.2,
    -          I thought that no encoder creates this kind of files but
    -          I was wrong.
    -
    -        - Validate function arguments better in a few functions. Most
    -          importantly, specifying an unsupported integrity check to
    -          lzma_stream_buffer_encode() no longer creates a corrupt .xz
    -          file. Probably no application tries to do that, so this
    -          shouldn't be a big problem in practice.
    -
    -        - Document that lzma_block_buffer_encode(),
    -          lzma_easy_buffer_encode(), lzma_stream_encoder(), and
    -          lzma_stream_buffer_encode() may return LZMA_UNSUPPORTED_CHECK.
    -
    -        - The return values of the _memusage() functions are now
    -          documented better.
    -
    -    * Fix command name detection in xzgrep. xzegrep and xzfgrep now
    -      correctly use egrep and fgrep instead of grep.
    -
    -    * French translation was added.
    -
    -
    -5.0.2 (2011-04-01)
    -
    -    * LZMA2 decompressor now correctly accepts LZMA2 streams with no
    -      uncompressed data. Previously it considered them corrupt. The
    -      bug can affect applications that use raw LZMA2 streams. It is
    -      very unlikely to affect .xz files because no compressor creates
    -      .xz files with empty LZMA2 streams. (Empty .xz files are a
    -      different thing than empty LZMA2 streams.)
    -
    -    * "xz --suffix=.foo filename.foo" now refuses to compress the
    -      file due to it already having the suffix .foo. It was already
    -      documented on the man page, but the code lacked the test.
    -
    -    * "xzgrep -l foo bar.xz" works now.
    -
    -    * Polish translation was added.
    -
    -
    -5.0.1 (2011-01-29)
    -
    -    * xz --force now (de)compresses files that have setuid, setgid,
    -      or sticky bit set and files that have multiple hard links.
    -      The man page had it documented this way already, but the code
    -      had a bug.
    -
    -    * gzip and bzip2 support in xzdiff was fixed.
    -
    -    * Portability fixes
    -
    -    * Minor fix to Czech translation
    -
    -
    -5.0.0 (2010-10-23)
    -
    -    Only the most important changes compared to 4.999.9beta are listed
    -    here. One change is especially important:
    -
    -      * The memory usage limit is now disabled by default. Some scripts
    -        written before this change may have used --memory=max on xz command
    -        line or in XZ_OPT. THESE USES OF --memory=max SHOULD BE REMOVED
    -        NOW, because they interfere with user's ability to set the memory
    -        usage limit himself. If user-specified limit causes problems to
    -        your script, blame the user.
    -
    -    Other significant changes:
    -
    -      * Added support for XZ_DEFAULTS environment variable. This variable
    -        allows users to set default options for xz, e.g. default memory
    -        usage limit or default compression level. Scripts that use xz
    -        must never set or unset XZ_DEFAULTS. Scripts should use XZ_OPT
    -        instead if they need a way to pass options to xz via an
    -        environment variable.
    -
    -      * The compression settings associated with the preset levels
    -        -0 ... -9 have been changed. --extreme was changed a little too.
    -        It is now less likely to make compression worse, but with some
    -        files the new --extreme may compress slightly worse than the old
    -        --extreme.
    -
    -      * If a preset level (-0 ... -9) is specified after a custom filter
    -        chain options have been used (e.g. --lzma2), the custom filter
    -        chain will be forgotten. Earlier the preset options were
    -        completely ignored after custom filter chain options had been
    -        seen.
    -
    -      * xz will create sparse files when decompressing if the uncompressed
    -        data contains long sequences of binary zeros. This is done even
    -        when writing to standard output that is connected to a regular
    -        file and certain additional conditions are met to make it safe.
    -
    -      * Support for "xz --list" was added. Combine with --verbose or
    -        --verbose --verbose (-vv) for detailed output.
    -
    -      * I had hoped that liblzma API would have been stable after
    -        4.999.9beta, but there have been a couple of changes in the
    -        advanced features, which don't affect most applications:
    -
    -          - Index handling code was revised. If you were using the old
    -            API, you will get a compiler error (so it's easy to notice).
    -
    -          - A subtle but important change was made to the Block handling
    -            API. lzma_block.version has to be initialized even for
    -            lzma_block_header_decode(). Code that doesn't do it will work
    -            for now, but might break in the future, which makes this API
    -            change easy to miss.
    -
    -      * The major soname has been bumped to 5.0.0. liblzma API and ABI
    -        are now stable, so the need to recompile programs linking against
    -        liblzma shouldn't arise soon.
    -
    diff --git a/external/public-domain/xz/dist/PACKAGERS b/external/public-domain/xz/dist/PACKAGERS
    deleted file mode 100644
    index 6c5d219cb..000000000
    --- a/external/public-domain/xz/dist/PACKAGERS
    +++ /dev/null
    @@ -1,231 +0,0 @@
    -
    -Information to packagers of XZ Utils
    -====================================
    -
    -    0. Preface
    -    1. Package naming
    -    2. Package description
    -    3. License
    -    4. configure options
    -    5. Additional documentation
    -    6. Extra files
    -    7. Installing XZ Utils and LZMA Utils in parallel
    -    8. Example
    -
    -
    -0. Preface
    -----------
    -
    -    This document is meant for people who create and maintain XZ Utils
    -    packages for operating system distributions. The focus is on GNU/Linux
    -    systems, but most things apply to other systems too.
    -
    -    While the standard "configure && make DESTDIR=$PKG install" should
    -    give a pretty good package, there are some details which packagers
    -    may want to tweak.
    -
    -    Packagers should also read the INSTALL file.
    -
    -
    -1. Package naming
    ------------------
    -
    -    The preferred name for the XZ Utils package is "xz", because that's
    -    the name of the upstream tarball. Naturally you may have good reasons
    -    to use some other name; I won't get angry about it. ;-) It's just nice
    -    to be able to point people to the correct package name without asking
    -    what distro they have.
    -
    -    If your distro policy is to split things into small pieces, here is
    -    one suggestion:
    -
    -        xz              xz, xzdec, scripts (xzdiff, xzgrep, etc.), docs
    -        xz-lzma         lzma, unlzma, lzcat, lzgrep etc. symlinks and
    -                        lzmadec binary for compatibility with LZMA Utils
    -        liblzma         liblzma.so.*
    -        liblzma-devel   liblzma.so, liblzma.a, API headers
    -
    -
    -2. Package description
    -----------------------
    -
    -    Here is a suggestion which you may use as the package description.
    -    If you can use only one-line description, pick only the first line.
    -    Naturally, feel free to use some other description if you find it
    -    better, and maybe send it to me too.
    -
    -        Library and command line tools for XZ and LZMA compressed files
    -
    -        XZ Utils provide a general purpose data compression library
    -        and command line tools. The native file format is the .xz
    -        format, but also the legacy .lzma format is supported. The .xz
    -        format supports multiple compression algorithms, of which LZMA2
    -        is currently the primary algorithm. With typical files, XZ Utils
    -        create about 30 % smaller files than gzip.
    -
    -    If you are splitting XZ Utils into multiple packages, here are some
    -    suggestions for package descriptions:
    -
    -    xz:
    -
    -        Command line tools for XZ and LZMA compressed files
    -
    -        This package includes the xz compression tool and other command
    -        line tools from XZ Utils. xz has command line syntax similar to
    -        that of gzip. The native file format is the .xz format, but also
    -        the legacy .lzma format is supported. The .xz format supports
    -        multiple compression algorithms, of which LZMA2 is currently the
    -        primary algorithm. With typical files, XZ Utils create about 30 %
    -        smaller files than gzip.
    -
    -        Note that this package doesn't include the files needed for
    -        LZMA Utils 4.32.x compatibility. Install also the xz-lzma
    -        package to make XZ Utils emulate LZMA Utils 4.32.x.
    -
    -    xz-lzma:
    -
    -        LZMA Utils emulation with XZ Utils
    -
    -        This package includes executables and symlinks to make
    -        XZ Utils emulate lzma, unlzma, lzcat, and other command
    -        line tools found from the legacy LZMA Utils 4.32.x package.
    -
    -    liblzma:
    -
    -        Library for XZ and LZMA compressed files
    -
    -        liblzma is a general purpose data compression library with
    -        an API similar to that of zlib. liblzma supports multiple
    -        algorithms, of which LZMA2 is currently the primary algorithm.
    -        The native file format is .xz, but also the legacy .lzma
    -        format and raw streams (no headers at all) are supported.
    -
    -        This package includes the shared library.
    -
    -    liblzma-devel:
    -
    -        Library for XZ and LZMA compressed files
    -
    -        This package includes the API headers, static library, and
    -        other development files related to liblzma.
    -
    -
    -3. License
    -----------
    -
    -    If the package manager supports a license field, you probably should
    -    put GPLv2+ there (GNU GPL v2 or later). The interesting parts of
    -    XZ Utils are in the public domain, but some less important files
    -    ending up into the binary package are under GPLv2+. So it is simplest
    -    to just say GPLv2+ if you cannot specify "public domain and GPLv2+".
    -
    -    If you split XZ Utils into multiple packages as described earlier
    -    in this file, liblzma and liblzma-dev packages will contain only
    -    public domain code (from XZ Utils at least; compiler or linker may
    -    add some third-party code, which may be copyrighted).
    -
    -
    -4. configure options
    ---------------------
    -
    -    Unless you are building a package for a distribution that is meant
    -    only for embedded systems, don't use the following configure options:
    -
    -        --enable-debug
    -        --enable-encoders (*)
    -        --enable-decoders
    -        --enable-match-finders
    -        --enable-checks
    -        --enable-small (*)
    -        --disable-threads (*)
    -
    -    (*) These are OK when building xzdec and lzmadec as described
    -        in INSTALL.
    -
    -    xzdec and lzmadec don't provide any functionality that isn't already
    -    available in the xz tool. Shipping xzdec and lzmadec without size
    -    optimization and statically-linked liblzma isn't very useful. Doing
    -    that would give users the xzdec man page, which may make it easier
    -    for people to find out that such tools exists, but the executables
    -    wouldn't have any advantage over the full-featured xz.
    -
    -
    -5. Additional documentation
    ----------------------------
    -
    -    "make install" copies some additional documentation to $docdir
    -    (--docdir in configure). There is a copy of the GNU GPL v2, which
    -    can be replaced with a symlink if your distro ships with shared
    -    copies of the common license texts.
    -
    -    liblzma API is currently only documented using Doxygen tags in the
    -    API headers. It hasn't been tested much how good results Doxygen
    -    is able to make from the tags (e.g. Doxyfile might need tweaking,
    -    the tagging may need to be improved etc.), so it might be simpler
    -    to just let people read docs directly from the .h files for now,
    -    and also save quite a bit in package size at the same time.
    -
    -
    -6. Extra files
    ---------------
    -
    -    The "extra" directory contains some small extra tools or other files.
    -    The exact set of extra files can vary between XZ Utils releases. The
    -    extra files have only limited use or they are too dangerous to be
    -    put directly to $bindir (7z2lzma.sh is a good example, since it can
    -    silently create corrupt output if certain conditions are not met).
    -
    -    If you feel like it, you may copy the extra directory under the doc
    -    directory (e.g. /usr/share/doc/xz/extra). Maybe some people will find
    -    them useful. However, most people needing these tools probably are
    -    able to find them from the source package too.
    -
    -    The "debug" directory contains some tools that are useful only when
    -    hacking on XZ Utils. Don't package these tools.
    -
    -
    -7. Installing XZ Utils and LZMA Utils in parallel
    --------------------------------------------------
    -
    -    XZ Utils and LZMA Utils 4.32.x can be installed in parallel by
    -    omitting the compatibility symlinks (lzma, unlzma, lzcat, lzgrep etc.)
    -    from the XZ Utils package. It's probably a good idea to still package
    -    the symlinks into a separate package so that users may choose if they
    -    want to use XZ Utils or LZMA Utils for handling .lzma files.
    -
    -
    -8. Example
    -----------
    -
    -    Here is an example for i686 GNU/Linux that
    -      - links xz and lzmainfo against shared liblzma;
    -      - links size-optimized xzdec and lzmadec against static liblzma
    -        while avoiding libpthread dependency;
    -      - includes only shared liblzma in the final package; and
    -      - copies also the "extra" directory to the package.
    -
    -    PKG=/tmp/xz-pkg
    -    tar xf xz-x.y.z.tar.gz
    -    cd xz-x.y.z
    -    ./configure \
    -            --prefix=/usr \
    -            --disable-static \
    -            --disable-xzdec \
    -            --disable-lzmadec \
    -            CFLAGS='-march=i686 -mtune=generic -O2'
    -    make
    -    make DESTDIR=$PKG install-strip
    -    make clean
    -    ./configure \
    -            --prefix=/usr \
    -            --disable-shared \
    -            --disable-nls \
    -            --disable-encoders \
    -            --enable-small \
    -            --disable-threads \
    -            CFLAGS='-march=i686 -mtune=generic -Os'
    -    make -C src/liblzma
    -    make -C src/xzdec
    -    make -C src/xzdec DESTDIR=$PKG install-strip
    -    cp -a extra $PKG/usr/share/doc/xz
    -
    diff --git a/external/public-domain/xz/dist/README b/external/public-domain/xz/dist/README
    deleted file mode 100644
    index ab8aadfb5..000000000
    --- a/external/public-domain/xz/dist/README
    +++ /dev/null
    @@ -1,308 +0,0 @@
    -
    -XZ Utils
    -========
    -
    -    0. Overview
    -    1. Documentation
    -       1.1. Overall documentation
    -       1.2. Documentation for command-line tools
    -       1.3. Documentation for liblzma
    -    2. Version numbering
    -    3. Reporting bugs
    -    4. Translating the xz tool
    -    5. Other implementations of the .xz format
    -    6. Contact information
    -
    -
    -0. Overview
    ------------
    -
    -    XZ Utils provide a general-purpose data-compression library plus
    -    command-line tools. The native file format is the .xz format, but
    -    also the legacy .lzma format is supported. The .xz format supports
    -    multiple compression algorithms, which are called "filters" in the
    -    context of XZ Utils. The primary filter is currently LZMA2. With
    -    typical files, XZ Utils create about 30 % smaller files than gzip.
    -
    -    To ease adapting support for the .xz format into existing applications
    -    and scripts, the API of liblzma is somewhat similar to the API of the
    -    popular zlib library. For the same reason, the command-line tool xz
    -    has a command-line syntax similar to that of gzip.
    -
    -    When aiming for the highest compression ratio, the LZMA2 encoder uses
    -    a lot of CPU time and may use, depending on the settings, even
    -    hundreds of megabytes of RAM. However, in fast modes, the LZMA2 encoder
    -    competes with bzip2 in compression speed, RAM usage, and compression
    -    ratio.
    -
    -    LZMA2 is reasonably fast to decompress. It is a little slower than
    -    gzip, but a lot faster than bzip2. Being fast to decompress means
    -    that the .xz format is especially nice when the same file will be
    -    decompressed very many times (usually on different computers), which
    -    is the case e.g. when distributing software packages. In such
    -    situations, it's not too bad if the compression takes some time,
    -    since that needs to be done only once to benefit many people.
    -
    -    With some file types, combining (or "chaining") LZMA2 with an
    -    additional filter can improve the compression ratio. A filter chain may
    -    contain up to four filters, although usually only one or two are used.
    -    For example, putting a BCJ (Branch/Call/Jump) filter before LZMA2
    -    in the filter chain can improve compression ratio of executable files.
    -
    -    Since the .xz format allows adding new filter IDs, it is possible that
    -    some day there will be a filter that is, for example, much faster to
    -    compress than LZMA2 (but probably with worse compression ratio).
    -    Similarly, it is possible that some day there is a filter that will
    -    compress better than LZMA2.
    -
    -    XZ Utils doesn't support multithreaded compression or decompression
    -    yet. It has been planned though and taken into account when designing
    -    the .xz file format.
    -
    -
    -1. Documentation
    -----------------
    -
    -1.1. Overall documentation
    -
    -    README              This file
    -
    -    INSTALL.generic     Generic install instructions for those not familiar
    -                        with packages using GNU Autotools
    -    INSTALL             Installation instructions specific to XZ Utils
    -    PACKAGERS           Information to packagers of XZ Utils
    -
    -    COPYING             XZ Utils copyright and license information
    -    COPYING.GPLv2       GNU General Public License version 2
    -    COPYING.GPLv3       GNU General Public License version 3
    -    COPYING.LGPLv2.1    GNU Lesser General Public License version 2.1
    -
    -    AUTHORS             The main authors of XZ Utils
    -    THANKS              Incomplete list of people who have helped making
    -                        this software
    -    NEWS                User-visible changes between XZ Utils releases
    -    ChangeLog           Detailed list of changes (commit log)
    -    TODO                Known bugs and some sort of to-do list
    -
    -    Note that only some of the above files are included in binary
    -    packages.
    -
    -
    -1.2. Documentation for command-line tools
    -
    -    The command-line tools are documented as man pages. In source code
    -    releases (and possibly also in some binary packages), the man pages
    -    are also provided in plain text (ASCII only) and PDF formats in the
    -    directory "doc/man" to make the man pages more accessible to those
    -    whose operating system doesn't provide an easy way to view man pages.
    -
    -
    -1.3. Documentation for liblzma
    -
    -    The liblzma API headers include short docs about each function
    -    and data type as Doxygen tags. These docs should be quite OK as
    -    a quick reference.
    -
    -    I have planned to write a bunch of very well documented example
    -    programs, which (due to comments) should work as a tutorial to
    -    various features of liblzma. No such example programs have been
    -    written yet.
    -
    -    For now, if you have never used liblzma, libbzip2, or zlib, I
    -    recommend learning the *basics* of the zlib API. Once you know that,
    -    it should be easier to learn liblzma.
    -
    -        http://zlib.net/manual.html
    -        http://zlib.net/zlib_how.html
    -
    -
    -2. Version numbering
    ---------------------
    -
    -    The version number format of XZ Utils is X.Y.ZS:
    -
    -      - X is the major version. When this is incremented, the library
    -        API and ABI break.
    -
    -      - Y is the minor version. It is incremented when new features
    -        are added without breaking the existing API or ABI. An even Y
    -        indicates a stable release and an odd Y indicates unstable
    -        (alpha or beta version).
    -
    -      - Z is the revision. This has a different meaning for stable and
    -        unstable releases:
    -
    -          * Stable: Z is incremented when bugs get fixed without adding
    -            any new features. This is intended to be convenient for
    -            downstream distributors that want bug fixes but don't want
    -            any new features to minimize the risk of introducing new bugs.
    -
    -          * Unstable: Z is just a counter. API or ABI of features added
    -            in earlier unstable releases having the same X.Y may break.
    -
    -      - S indicates stability of the release. It is missing from the
    -        stable releases, where Y is an even number. When Y is odd, S
    -        is either "alpha" or "beta" to make it very clear that such
    -        versions are not stable releases. The same X.Y.Z combination is
    -        not used for more than one stability level, i.e. after X.Y.Zalpha,
    -        the next version can be X.Y.(Z+1)beta but not X.Y.Zbeta.
    -
    -
    -3. Reporting bugs
    ------------------
    -
    -    Naturally it is easiest for me if you already know what causes the
    -    unexpected behavior. Even better if you have a patch to propose.
    -    However, quite often the reason for unexpected behavior is unknown,
    -    so here are a few things to do before sending a bug report:
    -
    -      1. Try to create a small example how to reproduce the issue.
    -
    -      2. Compile XZ Utils with debugging code using configure switches
    -         --enable-debug and, if possible, --disable-shared. If you are
    -         using GCC, use CFLAGS='-O0 -ggdb3'. Don't strip the resulting
    -         binaries.
    -
    -      3. Turn on core dumps. The exact command depends on your shell;
    -         for example in GNU bash it is done with "ulimit -c unlimited",
    -         and in tcsh with "limit coredumpsize unlimited".
    -
    -      4. Try to reproduce the suspected bug. If you get "assertion failed"
    -         message, be sure to include the complete message in your bug
    -         report. If the application leaves a coredump, get a backtrace
    -         using gdb:
    -           $ gdb /path/to/app-binary   # Load the app to the debugger.
    -           (gdb) core core   # Open the coredump.
    -           (gdb) bt   # Print the backtrace. Copy & paste to bug report.
    -           (gdb) quit   # Quit gdb.
    -
    -    Report your bug via email or IRC (see Contact information below).
    -    Don't send core dump files or any executables. If you have a small
    -    example file(s) (total size less than 256 KiB), please include
    -    it/them as an attachment. If you have bigger test files, put them
    -    online somewhere and include a URL to the file(s) in the bug report.
    -
    -    Always include the exact version number of XZ Utils in the bug report.
    -    If you are using a snapshot from the git repository, use "git describe"
    -    to get the exact snapshot version. If you are using XZ Utils shipped
    -    in an operating system distribution, mention the distribution name,
    -    distribution version, and exact xz package version; if you cannot
    -    repeat the bug with the code compiled from unpatched source code,
    -    you probably need to report a bug to your distribution's bug tracking
    -    system.
    -
    -
    -4. Translating the xz tool
    ---------------------------
    -
    -    The messages from the xz tool have been translated into a few
    -    languages. Before starting to translate into a new language, ask
    -    the author whether someone else hasn't already started working on it.
    -
    -    Test your translation. Testing includes comparing the translated
    -    output to the original English version by running the same commands
    -    in both your target locale and with LC_ALL=C. Ask someone to
    -    proof-read and test the translation.
    -
    -    Testing can be done e.g. by installing xz into a temporary directory:
    -
    -        ./configure --disable-shared --prefix=/tmp/xz-test
    -        # 
    -        make -C po update-po
    -        make install
    -        bash debug/translation.bash | less
    -        bash debug/translation.bash | less -S  # For --list outputs
    -
    -    Repeat the above as needed (no need to re-run configure though).
    -
    -    Note especially the following:
    -
    -      - The output of --help and --long-help must look nice on
    -        an 80-column terminal. It's OK to add extra lines if needed.
    -
    -      - In contrast, don't add extra lines to error messages and such.
    -        They are often preceded with e.g. a filename on the same line,
    -        so you have no way to predict where to put a \n. Let the terminal
    -        do the wrapping even if it looks ugly. Adding new lines will be
    -        even uglier in the generic case even if it looks nice in a few
    -        limited examples.
    -
    -      - Be careful with column alignment in tables and table-like output
    -        (--list, --list --verbose --verbose, --info-memory, --help, and
    -        --long-help):
    -
    -          * All descriptions of options in --help should start in the
    -            same column (but it doesn't need to be the same column as
    -            in the English messages; just be consistent if you change it).
    -            Check that both --help and --long-help look OK, since they
    -            share several strings.
    -
    -          * --list --verbose and --info-memory print lines that have
    -            the format "Description:   %s". If you need a longer
    -            description, you can put extra space between the colon
    -            and %s. Then you may need to add extra space to other
    -            strings too so that the result as a whole looks good (all
    -            values start at the same column).
    -
    -          * The columns of the actual tables in --list --verbose --verbose
    -            should be aligned properly. Abbreviate if necessary. It might
    -            be good to keep at least 2 or 3 spaces between column headings
    -            and avoid spaces in the headings so that the columns stand out
    -            better, but this is a matter of opinion. Do what you think
    -            looks best.
    -
    -      - Be careful to put a period at the end of a sentence when the
    -        original version has it, and don't put it when the original
    -        doesn't have it. Similarly, be careful with \n characters
    -        at the beginning and end of the strings.
    -
    -      - Read the TRANSLATORS comments that have been extracted from the
    -        source code and included in xz.pot. If they suggest testing the
    -        translation with some type of command, do it. If testing needs
    -        input files, use e.g. tests/files/good-*.xz.
    -
    -      - When updating the translation, read the fuzzy (modified) strings
    -        carefully, and don't mark them as updated before you actually
    -        have updated them. Reading through the unchanged messages can be
    -        good too; sometimes you may find a better wording for them.
    -
    -      - If you find language problems in the original English strings,
    -        feel free to suggest improvements. Ask if something is unclear.
    -
    -      - The translated messages should be understandable (sometimes this
    -        may be a problem with the original English messages too). Don't
    -        make a direct word-by-word translation from English especially if
    -        the result doesn't sound good in your language.
    -
    -    In short, take your time and pay attention to the details. Making
    -    a good translation is not a quick and trivial thing to do. The
    -    translated xz should look as polished as the English version.
    -
    -
    -5. Other implementations of the .xz format
    -------------------------------------------
    -
    -    7-Zip and the p7zip port of 7-Zip support the .xz format starting
    -    from the version 9.00alpha.
    -
    -        http://7-zip.org/
    -        http://p7zip.sourceforge.net/
    -
    -    XZ Embedded is a limited implementation written for use in the Linux
    -    kernel, but it is also suitable for other embedded use.
    -
    -        http://tukaani.org/xz/embedded.html
    -
    -
    -6. Contact information
    -----------------------
    -
    -    If you have questions, bug reports, patches etc. related to XZ Utils,
    -    contact Lasse Collin  (in Finnish or English).
    -    I'm sometimes slow at replying. If you haven't got a reply within two
    -    weeks, assume that your email has got lost and resend it or use IRC.
    -
    -    You can find me also from #tukaani on Freenode; my nick is Larhzu.
    -    The channel tends to be pretty quiet, so just ask your question and
    -    someone may wake up.
    -
    diff --git a/external/public-domain/xz/dist/THANKS b/external/public-domain/xz/dist/THANKS
    deleted file mode 100644
    index 05d20bdf3..000000000
    --- a/external/public-domain/xz/dist/THANKS
    +++ /dev/null
    @@ -1,112 +0,0 @@
    -
    -Thanks
    -======
    -
    -Some people have helped more, some less, but nevertheless everyone's help
    -has been important. :-) In alphabetical order:
    -  - Mark Adler
    -  - H. Peter Anvin
    -  - Jeff Bastian
    -  - Nelson H. F. Beebe
    -  - Karl Berry
    -  - Anders F. Björklund
    -  - Emmanuel Blot
    -  - Martin Blumenstingl
    -  - Jakub Bogusz
    -  - Maarten Bosmans
    -  - Trent W. Buck
    -  - James Buren
    -  - David Burklund
    -  - Daniel Mealha Cabrita
    -  - Milo Casagrande
    -  - Marek Černocký
    -  - Tomer Chachamu
    -  - Chris Donawa
    -  - Andrew Dudman
    -  - Markus Duft
    -  - İsmail Dönmez
    -  - Robert Elz
    -  - Gilles Espinasse
    -  - Denis Excoffier
    -  - Michael Felt
    -  - Mike Frysinger
    -  - Daniel Richard G.
    -  - Bill Glessner
    -  - Jason Gorski
    -  - Juan Manuel Guerrero
    -  - Diederik de Haas
    -  - Joachim Henke
    -  - Christian Hesse
    -  - Vincenzo Innocente
    -  - Peter Ivanov
    -  - Jouk Jansen
    -  - Jun I Jin
    -  - Per Øyvind Karlsen
    -  - Thomas Klausner
    -  - Richard Koch
    -  - Ville Koskinen
    -  - Jan Kratochvil
    -  - Christian Kujau
    -  - Stephan Kulow
    -  - Peter Lawler
    -  - James M Leddy
    -  - Hin-Tak Leung
    -  - Andraž 'ruskie' Levstik
    -  - Cary Lewis
    -  - Wim Lewis
    -  - Lorenzo De Liso
    -  - Bela Lubkin
    -  - Gregory Margo
    -  - Jim Meyering
    -  - Arkadiusz Miskiewicz
    -  - Conley Moorhous
    -  - Rafał Mużyło
    -  - Adrien Nader
    -  - Hongbo Ni
    -  - Jonathan Nieder
    -  - Andre Noll
    -  - Peter O'Gorman
    -  - Peter Pallinger
    -  - Rui Paulo
    -  - Igor Pavlov
    -  - Diego Elio Pettenò
    -  - Elbert Pol
    -  - Mikko Pouru
    -  - Trần Ngá»c Quân
    -  - Pavel Raiskup
    -  - Robert Readman
    -  - Bernhard Reutner-Fischer
    -  - Eric S. Raymond
    -  - Cristian Rodríguez
    -  - Christian von Roques
    -  - Torsten Rupp
    -  - Jukka Salmi
    -  - Alexandre Sauvé
    -  - Benno Schulenberg
    -  - Andreas Schwab
    -  - Dan Shechter
    -  - Stuart Shelton
    -  - Brad Smith
    -  - Jonathan Stott
    -  - Dan Stromberg
    -  - Vincent Torri
    -  - Paul Townsend
    -  - Mohammed Adnène Trojette
    -  - Alexey Tourbin
    -  - Patrick J. Volkerding
    -  - Martin Väth
    -  - Christian Weisgerber
    -  - Bert Wesarg
    -  - Fredrik Wikstrom
    -  - Ralf Wildenhues
    -  - Charles Wilson
    -  - Lars Wirzenius
    -  - Pilorz Wojciech
    -  - Ryan Young
    -  - Andreas Zieringer
    -
    -Also thanks to all the people who have participated in the Tukaani project.
    -
    -I have probably forgot to add some names to the above list. Sorry about
    -that and thanks for your help.
    -
    diff --git a/external/public-domain/xz/dist/TODO b/external/public-domain/xz/dist/TODO
    deleted file mode 100644
    index 45ba433a5..000000000
    --- a/external/public-domain/xz/dist/TODO
    +++ /dev/null
    @@ -1,111 +0,0 @@
    -
    -XZ Utils To-Do List
    -===================
    -
    -Known bugs
    -----------
    -
    -    The test suite is too incomplete.
    -
    -    If the memory usage limit is less than about 13 MiB, xz is unable to
    -    automatically scale down the compression settings enough even though
    -    it would be  possible by switching from BT2/BT3/BT4 match finder to
    -    HC3/HC4.
    -
    -    XZ Utils compress some files significantly worse than LZMA Utils.
    -    This is due to faster compression presets used by XZ Utils, and
    -    can often be worked around by using "xz --extreme". With some files
    -    --extreme isn't enough though: it's most likely with files that
    -    compress extremely well, so going from compression ratio of 0.003
    -    to 0.004 means big relative increase in the compressed file size.
    -
    -    xz doesn't quote unprintable characters when it displays file names
    -    given on the command line.
    -
    -    tuklib_exit() doesn't block signals => EINTR is possible.
    -
    -    SIGTSTP is not handled. If xz is stopped, the estimated remaining
    -    time and calculated (de)compression speed won't make sense in the
    -    progress indicator (xz --verbose).
    -
    -    If liblzma has created threads and fork() gets called, liblzma
    -    code will break in the child process unless it calls exec() and
    -    doesn't touch liblzma.
    -
    -
    -Missing features
    -----------------
    -
    -    Add support for storing metadata in .xz files. A preliminary
    -    idea is to create a new Stream type for metadata. When both
    -    metadata and data are wanted in the same .xz file, two or more
    -    Streams would be concatenated.
    -
    -    The state stored in lzma_stream should be cloneable, which would
    -    be mostly useful when using a preset dictionary in LZMA2, but
    -    it may have other uses too. Compare to deflateCopy() in zlib.
    -
    -    Support LZMA_FINISH in raw decoder to indicate end of LZMA1 and
    -    other streams that don't have an end of payload marker.
    -
    -    Adjust dictionary size when the input file size is known.
    -    Maybe do this only if an option is given.
    -
    -    xz doesn't support copying extended attributes, access control
    -    lists etc. from source to target file.
    -
    -    Multithreaded compression:
    -      - Reduce memory usage of the current method.
    -      - Implement threaded match finders.
    -      - Implement pigz-style threading in LZMA2.
    -
    -    Multithreaded decompression
    -
    -    Buffer-to-buffer coding could use less RAM (especially when
    -    decompressing LZMA1 or LZMA2).
    -
    -    I/O library is not implemented (similar to gzopen() in zlib).
    -    It will be a separate library that supports uncompressed, .gz,
    -    .bz2, .lzma, and .xz files.
    -
    -    Support changing lzma_options_lzma.mode with lzma_filters_update().
    -
    -    Support LZMA_FULL_FLUSH for lzma_stream_decoder() to stop at
    -    Block and Stream boundaries.
    -
    -    lzma_strerror() to convert lzma_ret to human readable form?
    -    This is tricky, because the same error codes are used with
    -    slightly different meanings, and this cannot be fixed anymore.
    -
    -    Make it possible to adjust LZMA2 options in the middle of a Block
    -    so that the encoding speed vs. compression ratio can be optimized
    -    when the compressed data is streamed over network.
    -
    -    Improved BCJ filters. The current filters are small but they aren't
    -    so great when compressing binary packages that contain various file
    -    types. Specifically, they make things worse if there are static
    -    libraries or Linux kernel modules. The filtering could also be
    -    more effective (without getting overly complex), for example,
    -    streamable variant BCJ2 from 7-Zip could be implemented.
    -
    -    Filter that autodetects specific data types in the input stream
    -    and applies appropriate filters for the corrects parts of the input.
    -    Perhaps combine this with the BCJ filter improvement point above.
    -
    -    Long-range LZ77 method as a separate filter or as a new LZMA2
    -    match finder.
    -
    -
    -Documentation
    --------------
    -
    -    More tutorial programs are needed for liblzma.
    -
    -    Document the LZMA1 and LZMA2 algorithms.
    -
    -
    -Miscellaneous
    -------------
    -
    -    Try to get the media type for .xz registered at IANA.
    -
    diff --git a/external/public-domain/xz/dist/config.h.in b/external/public-domain/xz/dist/config.h.in
    deleted file mode 100644
    index 0f1babc83..000000000
    --- a/external/public-domain/xz/dist/config.h.in
    +++ /dev/null
    @@ -1,488 +0,0 @@
    -/* config.h.in.  Generated from configure.ac by autoheader.  */
    -
    -/* Define if building universal (internal helper macro) */
    -#undef AC_APPLE_UNIVERSAL_BUILD
    -
    -/* How many MiB of RAM to assume if the real amount cannot be determined. */
    -#undef ASSUME_RAM
    -
    -/* Define to 1 if translation of program messages to the user's native
    -   language is requested. */
    -#undef ENABLE_NLS
    -
    -/* Define to 1 if bswap_16 is available. */
    -#undef HAVE_BSWAP_16
    -
    -/* Define to 1 if bswap_32 is available. */
    -#undef HAVE_BSWAP_32
    -
    -/* Define to 1 if bswap_64 is available. */
    -#undef HAVE_BSWAP_64
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_BYTESWAP_H
    -
    -/* Define to 1 if the system has the type `CC_SHA256_CTX'. */
    -#undef HAVE_CC_SHA256_CTX
    -
    -/* Define to 1 if you have the `CC_SHA256_Init' function. */
    -#undef HAVE_CC_SHA256_INIT
    -
    -/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
    -   CoreFoundation framework. */
    -#undef HAVE_CFLOCALECOPYCURRENT
    -
    -/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
    -   the CoreFoundation framework. */
    -#undef HAVE_CFPREFERENCESCOPYAPPVALUE
    -
    -/* Define to 1 if crc32 integrity check is enabled. */
    -#undef HAVE_CHECK_CRC32
    -
    -/* Define to 1 if crc64 integrity check is enabled. */
    -#undef HAVE_CHECK_CRC64
    -
    -/* Define to 1 if sha256 integrity check is enabled. */
    -#undef HAVE_CHECK_SHA256
    -
    -/* Define to 1 if you have the `clock_gettime' function. */
    -#undef HAVE_CLOCK_GETTIME
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_COMMONCRYPTO_COMMONDIGEST_H
    -
    -/* Define if the GNU dcgettext() function is already present or preinstalled.
    -   */
    -#undef HAVE_DCGETTEXT
    -
    -/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if
    -   you don't. */
    -#undef HAVE_DECL_CLOCK_MONOTONIC
    -
    -/* Define to 1 if you have the declaration of `program_invocation_name', and
    -   to 0 if you don't. */
    -#undef HAVE_DECL_PROGRAM_INVOCATION_NAME
    -
    -/* Define to 1 if arm decoder is enabled. */
    -#undef HAVE_DECODER_ARM
    -
    -/* Define to 1 if armthumb decoder is enabled. */
    -#undef HAVE_DECODER_ARMTHUMB
    -
    -/* Define to 1 if delta decoder is enabled. */
    -#undef HAVE_DECODER_DELTA
    -
    -/* Define to 1 if ia64 decoder is enabled. */
    -#undef HAVE_DECODER_IA64
    -
    -/* Define to 1 if lzma1 decoder is enabled. */
    -#undef HAVE_DECODER_LZMA1
    -
    -/* Define to 1 if lzma2 decoder is enabled. */
    -#undef HAVE_DECODER_LZMA2
    -
    -/* Define to 1 if powerpc decoder is enabled. */
    -#undef HAVE_DECODER_POWERPC
    -
    -/* Define to 1 if sparc decoder is enabled. */
    -#undef HAVE_DECODER_SPARC
    -
    -/* Define to 1 if x86 decoder is enabled. */
    -#undef HAVE_DECODER_X86
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_DLFCN_H
    -
    -/* Define to 1 if arm encoder is enabled. */
    -#undef HAVE_ENCODER_ARM
    -
    -/* Define to 1 if armthumb encoder is enabled. */
    -#undef HAVE_ENCODER_ARMTHUMB
    -
    -/* Define to 1 if delta encoder is enabled. */
    -#undef HAVE_ENCODER_DELTA
    -
    -/* Define to 1 if ia64 encoder is enabled. */
    -#undef HAVE_ENCODER_IA64
    -
    -/* Define to 1 if lzma1 encoder is enabled. */
    -#undef HAVE_ENCODER_LZMA1
    -
    -/* Define to 1 if lzma2 encoder is enabled. */
    -#undef HAVE_ENCODER_LZMA2
    -
    -/* Define to 1 if powerpc encoder is enabled. */
    -#undef HAVE_ENCODER_POWERPC
    -
    -/* Define to 1 if sparc encoder is enabled. */
    -#undef HAVE_ENCODER_SPARC
    -
    -/* Define to 1 if x86 encoder is enabled. */
    -#undef HAVE_ENCODER_X86
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_FCNTL_H
    -
    -/* Define to 1 if you have the `futimens' function. */
    -#undef HAVE_FUTIMENS
    -
    -/* Define to 1 if you have the `futimes' function. */
    -#undef HAVE_FUTIMES
    -
    -/* Define to 1 if you have the `futimesat' function. */
    -#undef HAVE_FUTIMESAT
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_GETOPT_H
    -
    -/* Define to 1 if you have the `getopt_long' function. */
    -#undef HAVE_GETOPT_LONG
    -
    -/* Define if the GNU gettext() function is already present or preinstalled. */
    -#undef HAVE_GETTEXT
    -
    -/* Define if you have the iconv() function and it works. */
    -#undef HAVE_ICONV
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_IMMINTRIN_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_INTTYPES_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_LIMITS_H
    -
    -/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
    -#undef HAVE_MBRTOWC
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_MEMORY_H
    -
    -/* Define to 1 to enable bt2 match finder. */
    -#undef HAVE_MF_BT2
    -
    -/* Define to 1 to enable bt3 match finder. */
    -#undef HAVE_MF_BT3
    -
    -/* Define to 1 to enable bt4 match finder. */
    -#undef HAVE_MF_BT4
    -
    -/* Define to 1 to enable hc3 match finder. */
    -#undef HAVE_MF_HC3
    -
    -/* Define to 1 to enable hc4 match finder. */
    -#undef HAVE_MF_HC4
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_MINIX_SHA2_H
    -
    -/* Define to 1 if getopt.h declares extern int optreset. */
    -#undef HAVE_OPTRESET
    -
    -/* Define to 1 if you have the `pipe2' function. */
    -#undef HAVE_PIPE2
    -
    -/* Define to 1 if you have the `posix_fadvise' function. */
    -#undef HAVE_POSIX_FADVISE
    -
    -/* Define to 1 if you have the `pthread_condattr_setclock' function. */
    -#undef HAVE_PTHREAD_CONDATTR_SETCLOCK
    -
    -/* Have PTHREAD_PRIO_INHERIT. */
    -#undef HAVE_PTHREAD_PRIO_INHERIT
    -
    -/* Define to 1 if you have the `SHA256Init' function. */
    -#undef HAVE_SHA256INIT
    -
    -/* Define to 1 if the system has the type `SHA256_CTX'. */
    -#undef HAVE_SHA256_CTX
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_SHA256_H
    -
    -/* Define to 1 if you have the `SHA256_Init' function. */
    -#undef HAVE_SHA256_INIT
    -
    -/* Define to 1 if the system has the type `SHA2_CTX'. */
    -#undef HAVE_SHA2_CTX
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_SHA2_H
    -
    -/* Define to 1 if optimizing for size. */
    -#undef HAVE_SMALL
    -
    -/* Define to 1 if stdbool.h conforms to C99. */
    -#undef HAVE_STDBOOL_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_STDINT_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_STDLIB_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_STRINGS_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_STRING_H
    -
    -/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
    -#undef HAVE_STRUCT_STAT_ST_ATIMENSEC
    -
    -/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */
    -#undef HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC
    -
    -/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */
    -#undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC
    -
    -/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */
    -#undef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
    -
    -/* Define to 1 if `st_uatime' is a member of `struct stat'. */
    -#undef HAVE_STRUCT_STAT_ST_UATIME
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_SYS_BYTEORDER_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_SYS_ENDIAN_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_SYS_PARAM_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_SYS_STAT_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_SYS_TIME_H
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_SYS_TYPES_H
    -
    -/* Define to 1 if the system has the type `uintptr_t'. */
    -#undef HAVE_UINTPTR_T
    -
    -/* Define to 1 if you have the  header file. */
    -#undef HAVE_UNISTD_H
    -
    -/* Define to 1 if you have the `utime' function. */
    -#undef HAVE_UTIME
    -
    -/* Define to 1 if you have the `utimes' function. */
    -#undef HAVE_UTIMES
    -
    -/* Define to 1 or 0, depending whether the compiler supports simple visibility
    -   declarations. */
    -#undef HAVE_VISIBILITY
    -
    -/* Define to 1 if you have the `wcwidth' function. */
    -#undef HAVE_WCWIDTH
    -
    -/* Define to 1 if the system has the type `_Bool'. */
    -#undef HAVE__BOOL
    -
    -/* Define to 1 if _mm_movemask_epi8 is available. */
    -#undef HAVE__MM_MOVEMASK_EPI8
    -
    -/* Define to the sub-directory where libtool stores uninstalled libraries. */
    -#undef LT_OBJDIR
    -
    -/* Define to 1 when using POSIX threads (pthreads). */
    -#undef MYTHREAD_POSIX
    -
    -/* Define to 1 when using Windows Vista compatible threads. This uses features
    -   that are not available on Windows XP. */
    -#undef MYTHREAD_VISTA
    -
    -/* Define to 1 when using Windows 95 (and thus XP) compatible threads. This
    -   avoids use of features that were added in Windows Vista. */
    -#undef MYTHREAD_WIN95
    -
    -/* Define to 1 to disable debugging code. */
    -#undef NDEBUG
    -
    -/* Name of package */
    -#undef PACKAGE
    -
    -/* Define to the address where bug reports for this package should be sent. */
    -#undef PACKAGE_BUGREPORT
    -
    -/* Define to the full name of this package. */
    -#undef PACKAGE_NAME
    -
    -/* Define to the full name and version of this package. */
    -#undef PACKAGE_STRING
    -
    -/* Define to the one symbol short name of this package. */
    -#undef PACKAGE_TARNAME
    -
    -/* Define to the home page for this package. */
    -#undef PACKAGE_URL
    -
    -/* Define to the version of this package. */
    -#undef PACKAGE_VERSION
    -
    -/* Define to necessary symbol if this constant uses a non-standard name on
    -   your system. */
    -#undef PTHREAD_CREATE_JOINABLE
    -
    -/* The size of `size_t', as computed by sizeof. */
    -#undef SIZEOF_SIZE_T
    -
    -/* Define to 1 if you have the ANSI C header files. */
    -#undef STDC_HEADERS
    -
    -/* Define to 1 if the number of available CPU cores can be detected with
    -   cpuset(2). */
    -#undef TUKLIB_CPUCORES_CPUSET
    -
    -/* Define to 1 if the number of available CPU cores can be detected with
    -   pstat_getdynamic(). */
    -#undef TUKLIB_CPUCORES_PSTAT_GETDYNAMIC
    -
    -/* Define to 1 if the number of available CPU cores can be detected with
    -   sysconf(_SC_NPROCESSORS_ONLN) or sysconf(_SC_NPROC_ONLN). */
    -#undef TUKLIB_CPUCORES_SYSCONF
    -
    -/* Define to 1 if the number of available CPU cores can be detected with
    -   sysctl(). */
    -#undef TUKLIB_CPUCORES_SYSCTL
    -
    -/* Define to 1 if the system supports fast unaligned access to 16-bit and
    -   32-bit integers. */
    -#undef TUKLIB_FAST_UNALIGNED_ACCESS
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   _system_configuration.physmem. */
    -#undef TUKLIB_PHYSMEM_AIX
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   getinvent_r(). */
    -#undef TUKLIB_PHYSMEM_GETINVENT_R
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   getsysinfo(). */
    -#undef TUKLIB_PHYSMEM_GETSYSINFO
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   pstat_getstatic(). */
    -#undef TUKLIB_PHYSMEM_PSTAT_GETSTATIC
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   sysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES). */
    -#undef TUKLIB_PHYSMEM_SYSCONF
    -
    -/* Define to 1 if the amount of physical memory can be detected with sysctl().
    -   */
    -#undef TUKLIB_PHYSMEM_SYSCTL
    -
    -/* Define to 1 if the amount of physical memory can be detected with Linux
    -   sysinfo(). */
    -#undef TUKLIB_PHYSMEM_SYSINFO
    -
    -/* Enable extensions on AIX 3, Interix.  */
    -#ifndef _ALL_SOURCE
    -# undef _ALL_SOURCE
    -#endif
    -/* Enable GNU extensions on systems that have them.  */
    -#ifndef _GNU_SOURCE
    -# undef _GNU_SOURCE
    -#endif
    -/* Enable threading extensions on Solaris.  */
    -#ifndef _POSIX_PTHREAD_SEMANTICS
    -# undef _POSIX_PTHREAD_SEMANTICS
    -#endif
    -/* Enable extensions on HP NonStop.  */
    -#ifndef _TANDEM_SOURCE
    -# undef _TANDEM_SOURCE
    -#endif
    -/* Enable general extensions on Solaris.  */
    -#ifndef __EXTENSIONS__
    -# undef __EXTENSIONS__
    -#endif
    -
    -
    -/* Version number of package */
    -#undef VERSION
    -
    -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
    -   significant byte first (like Motorola and SPARC, unlike Intel). */
    -#if defined AC_APPLE_UNIVERSAL_BUILD
    -# if defined __BIG_ENDIAN__
    -#  define WORDS_BIGENDIAN 1
    -# endif
    -#else
    -# ifndef WORDS_BIGENDIAN
    -#  undef WORDS_BIGENDIAN
    -# endif
    -#endif
    -
    -/* Enable large inode numbers on Mac OS X 10.5.  */
    -#ifndef _DARWIN_USE_64_BIT_INODE
    -# define _DARWIN_USE_64_BIT_INODE 1
    -#endif
    -
    -/* Number of bits in a file offset, on hosts where this is settable. */
    -#undef _FILE_OFFSET_BITS
    -
    -/* Define for large files, on AIX-style hosts. */
    -#undef _LARGE_FILES
    -
    -/* Define to 1 if on MINIX. */
    -#undef _MINIX
    -
    -/* Define to 2 if the system does not provide POSIX.1 features except with
    -   this defined. */
    -#undef _POSIX_1_SOURCE
    -
    -/* Define to 1 if you need to in order for `stat' and other things to work. */
    -#undef _POSIX_SOURCE
    -
    -/* Define for Solaris 2.5.1 so the uint32_t typedef from ,
    -   , or  is not used. If the typedef were allowed, the
    -   #define below would cause a syntax error. */
    -#undef _UINT32_T
    -
    -/* Define for Solaris 2.5.1 so the uint64_t typedef from ,
    -   , or  is not used. If the typedef were allowed, the
    -   #define below would cause a syntax error. */
    -#undef _UINT64_T
    -
    -/* Define for Solaris 2.5.1 so the uint8_t typedef from ,
    -   , or  is not used. If the typedef were allowed, the
    -   #define below would cause a syntax error. */
    -#undef _UINT8_T
    -
    -/* Define to rpl_ if the getopt replacement functions and variables should be
    -   used. */
    -#undef __GETOPT_PREFIX
    -
    -/* Define to the type of a signed integer type of width exactly 32 bits if
    -   such a type exists and the standard includes do not define it. */
    -#undef int32_t
    -
    -/* Define to the type of a signed integer type of width exactly 64 bits if
    -   such a type exists and the standard includes do not define it. */
    -#undef int64_t
    -
    -/* Define to the type of an unsigned integer type of width exactly 16 bits if
    -   such a type exists and the standard includes do not define it. */
    -#undef uint16_t
    -
    -/* Define to the type of an unsigned integer type of width exactly 32 bits if
    -   such a type exists and the standard includes do not define it. */
    -#undef uint32_t
    -
    -/* Define to the type of an unsigned integer type of width exactly 64 bits if
    -   such a type exists and the standard includes do not define it. */
    -#undef uint64_t
    -
    -/* Define to the type of an unsigned integer type of width exactly 8 bits if
    -   such a type exists and the standard includes do not define it. */
    -#undef uint8_t
    -
    -/* Define to the type of an unsigned integer type wide enough to hold a
    -   pointer, if such a type exists, and if the system does not define it. */
    -#undef uintptr_t
    diff --git a/external/public-domain/xz/dist/configure.ac b/external/public-domain/xz/dist/configure.ac
    deleted file mode 100644
    index ac35c5619..000000000
    --- a/external/public-domain/xz/dist/configure.ac
    +++ /dev/null
    @@ -1,803 +0,0 @@
    -#                                               -*- Autoconf -*-
    -# Process this file with autoconf to produce a configure script.
    -
    -###############################################################################
    -#
    -# Author: Lasse Collin
    -#
    -# This file has been put into the public domain.
    -# You can do whatever you want with this file.
    -#
    -###############################################################################
    -
    -# NOTE: Don't add useless checks. autoscan detects this and that, but don't
    -# let it confuse you. For example, we don't care about checking for behavior
    -# of malloc(), stat(), or lstat(), since we don't use those functions in
    -# a way that would cause the problems the autoconf macros check.
    -
    -AC_PREREQ([2.52])
    -
    -AC_INIT([XZ Utils], 5.0.0, [joerg@NetBSD.org], [xz], [http://tukaani.org/xz/])
    -AC_CONFIG_MACRO_DIR([m4])
    -AC_CONFIG_HEADER([config.h])
    -AC_CONFIG_AUX_DIR([../../gnu/dist/autoconf/config])
    -
    -AC_CANONICAL_HOST
    -AC_USE_SYSTEM_EXTENSIONS
    -
    -# We do some special things on Windows (32-bit or 64-bit) builds.
    -case $host_os in
    -	mingw* | cygwin*) is_w32=yes ;;
    -	*)                is_w32=no ;;
    -esac
    -AM_CONDITIONAL([COND_W32], [test "$is_w32" = yes])
    -
    -# We need to use $EXEEXT with $(LN_S) when creating symlinks to
    -# executables. Cygwin is an exception to this, since it is recommended
    -# that symlinks don't have the .exe suffix. To make this work, we
    -# define LN_EXEEXT.
    -case $host_os in
    -	cygwin)  LN_EXEEXT= ;;
    -	*)       LN_EXEEXT='$(EXEEXT)' ;;
    -esac
    -AC_SUBST([LN_EXEEXT])
    -
    -echo
    -echo "Configure options:"
    -AM_CFLAGS=
    -
    -
    -#############
    -# Debugging #
    -#############
    -
    -AC_MSG_CHECKING([if debugging code should be compiled])
    -AC_ARG_ENABLE([debug], AS_HELP_STRING([--enable-debug], [Enable debugging code.]),
    -	[], enable_debug=no)
    -if test "x$enable_debug" = xyes; then
    -	AC_MSG_RESULT([yes])
    -else
    -	AC_DEFINE([NDEBUG], [1], [Define to 1 to disable debugging code.])
    -	AC_MSG_RESULT([no])
    -fi
    -
    -
    -###########
    -# Filters #
    -###########
    -
    -m4_define([SUPPORTED_FILTERS], [lzma1,lzma2,delta,x86,powerpc,ia64,arm,armthumb,sparc])dnl
    -m4_define([SIMPLE_FILTERS], [x86,powerpc,ia64,arm,armthumb,sparc])
    -m4_define([LZ_FILTERS], [lzma1,lzma2])
    -
    -m4_foreach([NAME], [SUPPORTED_FILTERS],
    -[enable_filter_[]NAME=no
    -enable_encoder_[]NAME=no
    -enable_decoder_[]NAME=no
    -])dnl
    -
    -AC_MSG_CHECKING([which encoders to build])
    -AC_ARG_ENABLE([encoders], AS_HELP_STRING([--enable-encoders=LIST],
    -		[Comma-separated list of encoders to build. Default=all.
    -		Available encoders:]
    -			m4_translit(m4_defn([SUPPORTED_FILTERS]), [,], [ ])),
    -	[], [enable_encoders=SUPPORTED_FILTERS])
    -enable_encoders=`echo "$enable_encoders" | sed 's/,/ /g'`
    -if test "x$enable_encoders" = xno || test "x$enable_encoders" = x; then
    -	AC_MSG_RESULT([(none)])
    -else
    -	for arg in $enable_encoders
    -	do
    -		case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
    -			NAME)
    -				enable_filter_[]NAME=yes
    -				enable_encoder_[]NAME=yes
    -				AC_DEFINE(HAVE_ENCODER_[]m4_toupper(NAME), [1],
    -				[Define to 1 if] NAME [encoder is enabled.])
    -				;;])
    -			*)
    -				AC_MSG_RESULT([])
    -				AC_MSG_ERROR([unknown filter: $arg])
    -				;;
    -		esac
    -	done
    -	AC_MSG_RESULT([$enable_encoders])
    -fi
    -
    -AC_MSG_CHECKING([which decoders to build])
    -AC_ARG_ENABLE([decoders], AS_HELP_STRING([--enable-decoders=LIST],
    -		[Comma-separated list of decoders to build. Default=all.
    -		Available decoders are the same as available encoders.]),
    -	[], [enable_decoders=SUPPORTED_FILTERS])
    -enable_decoders=`echo "$enable_decoders" | sed 's/,/ /g'`
    -if test "x$enable_decoders" = xno || test "x$enable_decoders" = x; then
    -	AC_MSG_RESULT([(none)])
    -else
    -	for arg in $enable_decoders
    -	do
    -		case $arg in m4_foreach([NAME], [SUPPORTED_FILTERS], [
    -			NAME)
    -				enable_filter_[]NAME=yes
    -				enable_decoder_[]NAME=yes
    -				AC_DEFINE(HAVE_DECODER_[]m4_toupper(NAME), [1],
    -				[Define to 1 if] NAME [decoder is enabled.])
    -				;;])
    -			*)
    -				AC_MSG_RESULT([])
    -				AC_MSG_ERROR([unknown filter: $arg])
    -				;;
    -		esac
    -	done
    -
    -	# LZMA2 requires that LZMA1 is enabled.
    -	test "x$enable_encoder_lzma2" = xyes && enable_encoder_lzma1=yes
    -	test "x$enable_decoder_lzma2" = xyes && enable_decoder_lzma1=yes
    -
    -	AC_MSG_RESULT([$enable_decoders])
    -fi
    -
    -if test "x$enable_encoder_lzma2$enable_encoder_lzma1" = xyesno \
    -		|| test "x$enable_decoder_lzma2$enable_decoder_lzma1" = xyesno; then
    -	AC_MSG_ERROR([LZMA2 requires that LZMA1 is also enabled.])
    -fi
    -
    -AM_CONDITIONAL(COND_MAIN_ENCODER, test "x$enable_encoders" != xno && test "x$enable_encoders" != x)
    -AM_CONDITIONAL(COND_MAIN_DECODER, test "x$enable_decoders" != xno && test "x$enable_decoders" != x)
    -
    -m4_foreach([NAME], [SUPPORTED_FILTERS],
    -[AM_CONDITIONAL(COND_FILTER_[]m4_toupper(NAME), test "x$enable_filter_[]NAME" = xyes)
    -AM_CONDITIONAL(COND_ENCODER_[]m4_toupper(NAME), test "x$enable_encoder_[]NAME" = xyes)
    -AM_CONDITIONAL(COND_DECODER_[]m4_toupper(NAME), test "x$enable_decoder_[]NAME" = xyes)
    -])dnl
    -
    -# The so called "simple filters" share common code.
    -enable_filter_simple=no
    -enable_encoder_simple=no
    -enable_decoder_simple=no
    -m4_foreach([NAME], [SIMPLE_FILTERS],
    -[test "x$enable_filter_[]NAME" = xyes && enable_filter_simple=yes
    -test "x$enable_encoder_[]NAME" = xyes && enable_encoder_simple=yes
    -test "x$enable_decoder_[]NAME" = xyes && enable_decoder_simple=yes
    -])dnl
    -AM_CONDITIONAL(COND_FILTER_SIMPLE, test "x$enable_filter_simple" = xyes)
    -AM_CONDITIONAL(COND_ENCODER_SIMPLE, test "x$enable_encoder_simple" = xyes)
    -AM_CONDITIONAL(COND_DECODER_SIMPLE, test "x$enable_decoder_simple" = xyes)
    -
    -# LZ-based filters share common code.
    -enable_filter_lz=no
    -enable_encoder_lz=no
    -enable_decoder_lz=no
    -m4_foreach([NAME], [LZ_FILTERS],
    -[test "x$enable_filter_[]NAME" = xyes && enable_filter_lz=yes
    -test "x$enable_encoder_[]NAME" = xyes && enable_encoder_lz=yes
    -test "x$enable_decoder_[]NAME" = xyes && enable_decoder_lz=yes
    -])dnl
    -AM_CONDITIONAL(COND_FILTER_LZ, test "x$enable_filter_lz" = xyes)
    -AM_CONDITIONAL(COND_ENCODER_LZ, test "x$enable_encoder_lz" = xyes)
    -AM_CONDITIONAL(COND_DECODER_LZ, test "x$enable_decoder_lz" = xyes)
    -
    -m4_foreach([NAME], [SUPPORTED_FILTERS], [
    -	AC_DEFINE(HAVE_ENCODER_[]m4_toupper(NAME), [1],
    -	    [Define to 1 if] NAME [encoder is enabled.])
    -	AC_DEFINE(HAVE_DECODER_[]m4_toupper(NAME), [1],
    -	    [Define to 1 if] NAME [decoder is enabled.])
    -])
    -
    -#################
    -# Match finders #
    -#################
    -
    -m4_define([SUPPORTED_MATCH_FINDERS], [hc3,hc4,bt2,bt3,bt4])
    -
    -m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], [
    -	AC_DEFINE(HAVE_MF_[]m4_toupper(NAME), [1],
    -	    [Define to 1 to enable] NAME [match finder.])
    -])
    -
    -AC_MSG_CHECKING([which match finders to build])
    -AC_ARG_ENABLE([match-finders], AS_HELP_STRING([--enable-match-finders=LIST],
    -		[Comma-separated list of match finders to build. Default=all.
    -		At least one match finder is required for encoding with
    -		the LZMA1 and LZMA2 filters. Available match finders:]
    -		m4_translit(m4_defn([SUPPORTED_MATCH_FINDERS]), [,], [ ])), [],
    -	[enable_match_finders=SUPPORTED_MATCH_FINDERS])
    -enable_match_finders=`echo "$enable_match_finders" | sed 's/,/ /g'`
    -if test "x$enable_encoder_lz" = xyes ; then
    -	for arg in $enable_match_finders
    -		do
    -		case $arg in m4_foreach([NAME], [SUPPORTED_MATCH_FINDERS], [
    -			NAME)
    -				enable_match_finder_[]NAME=yes
    -				AC_DEFINE(HAVE_MF_[]m4_toupper(NAME), [1],
    -				[Define to 1 to enable] NAME [match finder.])
    -				;;])
    -			*)
    -				AC_MSG_RESULT([])
    -				AC_MSG_ERROR([unknown match finder: $arg])
    -				;;
    -		esac
    -	done
    -	AC_MSG_RESULT([$enable_match_finders])
    -else
    -	AC_MSG_RESULT([(none because not building any LZ-based encoder)])
    -fi
    -
    -
    -####################
    -# Integrity checks #
    -####################
    -
    -m4_define([SUPPORTED_CHECKS], [crc32,crc64,sha256])
    -
    -m4_foreach([NAME], [SUPPORTED_CHECKS],
    -[enable_check_[]NAME=no
    -])dnl
    -
    -AC_MSG_CHECKING([which integrity checks to build])
    -AC_ARG_ENABLE([checks], AS_HELP_STRING([--enable-checks=LIST],
    -		[Comma-separated list of integrity checks to build.
    -		Default=all. Available integrity checks:]
    -		m4_translit(m4_defn([SUPPORTED_CHECKS]), [,], [ ])),
    -	[], [enable_checks=SUPPORTED_CHECKS])
    -enable_checks=`echo "$enable_checks" | sed 's/,/ /g'`
    -if test "x$enable_checks" = xno || test "x$enable_checks" = x; then
    -	AC_MSG_RESULT([(none)])
    -else
    -	for arg in $enable_checks
    -	do
    -		case $arg in m4_foreach([NAME], [SUPPORTED_CHECKS], [
    -			NAME)
    -				enable_check_[]NAME=yes
    -				AC_DEFINE(HAVE_CHECK_[]m4_toupper(NAME), [1],
    -				[Define to 1 if] NAME
    -				[integrity check is enabled.])
    -				;;])
    -			*)
    -				AC_MSG_RESULT([])
    -				AC_MSG_ERROR([unknown integrity check: $arg])
    -				;;
    -		esac
    -	done
    -	AC_MSG_RESULT([$enable_checks])
    -fi
    -if test "x$enable_check_crc32" = xno ; then
    -	AC_MSG_ERROR([For now, the CRC32 check must always be enabled.])
    -fi
    -
    -m4_foreach([NAME], [SUPPORTED_CHECKS],
    -[AM_CONDITIONAL(COND_CHECK_[]m4_toupper(NAME), test "x$enable_check_[]NAME" = xyes)
    -])dnl
    -
    -
    -###########################
    -# Assembler optimizations #
    -###########################
    -
    -AM_CONDITIONAL(COND_ASM_X86, false)
    -AM_CONDITIONAL(COND_ASM_X86_64, false)
    -
    -
    -#####################
    -# Size optimization #
    -#####################
    -
    -if false; then
    -AC_MSG_CHECKING([if small size is preferred over speed])
    -AC_ARG_ENABLE([small], AS_HELP_STRING([--enable-small],
    -		[Make liblzma smaller and a little slower.
    -		This is disabled by default to optimize for speed.]),
    -	[], [enable_small=no])
    -if test "x$enable_small" = xyes; then
    -	AC_DEFINE([HAVE_SMALL], [1], [Define to 1 if optimizing for size.])
    -elif test "x$enable_small" != xno; then
    -	AC_MSG_RESULT([])
    -	AC_MSG_ERROR([--enable-small accepts only `yes' or `no'])
    -fi
    -AC_MSG_RESULT([$enable_small])
    -AM_CONDITIONAL(COND_SMALL, test "x$enable_small" = xyes)
    -fi
    -
    -
    -#############
    -# Threading #
    -#############
    -
    -AC_MSG_CHECKING([if threading support is wanted])
    -AC_ARG_ENABLE([threads], AS_HELP_STRING([--enable-threads=METHOD],
    -		[Supported METHODS are `yes', `no', `posix', `win95', and
    -		`vista'. The default is `yes'. Using `no' together with
    -		--enable-small makes liblzma thread unsafe.]),
    -	[], [enable_threads=yes])
    -
    -if test "x$enable_threads" = xyes; then
    -	case $host_os in
    -		mingw*)
    -			case $host_cpu in
    -				i?86)   enable_threads=win95 ;;
    -				*)      enable_threads=vista ;;
    -			esac
    -			;;
    -		*)
    -			enable_threads=posix
    -			;;
    -	esac
    -fi
    -
    -case $enable_threads in
    -	posix | win95 | vista)
    -		AC_MSG_RESULT([yes, $enable_threads])
    -		;;
    -	no)
    -		AC_MSG_RESULT([no])
    -		;;
    -	*)
    -		AC_MSG_RESULT([])
    -		AC_MSG_ERROR([--enable-threads only accepts `yes', `no', `posix', `win95', or `vista'])
    -		;;
    -esac
    -
    -# The Win95 threading lacks thread-safe one-time initialization function.
    -# It's better to disallow it instead of allowing threaded but thread-unsafe
    -# build.
    -if test "x$enable_small$enable_threads" = xyeswin95; then
    -	AC_MSG_ERROR([--enable-threads=win95 and --enable-small cannot be
    -		used at the same time])
    -fi
    -
    -# We use the actual result a little later.
    -
    -
    -#########################
    -# Assumed amount of RAM #
    -#########################
    -
    -# We use 128 MiB as default, because it will allow decompressing files
    -# created with "xz -9". It would be slightly safer to guess a lower value,
    -# but most systems, on which we don't have any way to determine the amount
    -# of RAM, will probably have at least 128 MiB of RAM.
    -AC_MSG_CHECKING([how much RAM to assume if the real amount is unknown])
    -AC_ARG_ENABLE([assume-ram], AS_HELP_STRING([--enable-assume-ram=SIZE],
    -		[If and only if the real amount of RAM cannot be determined,
    -		assume SIZE MiB. The default is 128 MiB. This affects the
    -		default memory usage limit.]),
    -	[], [enable_assume_ram=128])
    -assume_ram_check=`echo "$enable_assume_ram" | tr -d 0123456789`
    -if test -z "$enable_assume_ram" || test -n "$assume_ram_check"; then
    -	AC_MSG_RESULT([])
    -	AC_MSG_ERROR([--enable-assume-ram accepts only an integer argument])
    -fi
    -AC_MSG_RESULT([$enable_assume_ram MiB])
    -AC_DEFINE_UNQUOTED([ASSUME_RAM], [$enable_assume_ram],
    -		[How many MiB of RAM to assume if the real amount cannot
    -		be determined.])
    -
    -
    -#########################
    -# Components to install #
    -#########################
    -
    -AC_ARG_ENABLE([xz], [AS_HELP_STRING([--disable-xz],
    -		[do not build the xz tool])],
    -	[], [enable_xz=yes])
    -AM_CONDITIONAL([COND_XZ], [test x$enable_xz != xno])
    -
    -AC_ARG_ENABLE([xzdec], [AS_HELP_STRING([--disable-xzdec],
    -		[do not build xzdec])],
    -	[], [enable_xzdec=yes])
    -AM_CONDITIONAL([COND_XZDEC], [test x$enable_xzdec != xno])
    -
    -AC_ARG_ENABLE([lzmadec], [AS_HELP_STRING([--disable-lzmadec],
    -		[do not build lzmadec
    -		(it exists primarily for LZMA Utils compatibility)])],
    -	[], [enable_lzmadec=yes])
    -AM_CONDITIONAL([COND_LZMADEC], [test x$enable_lzmadec != xno])
    -
    -AC_ARG_ENABLE([lzmainfo], [AS_HELP_STRING([--disable-lzmainfo],
    -		[do not build lzmainfo
    -		(it exists primarily for LZMA Utils compatibility)])],
    -	[], [enable_lzmainfo=yes])
    -AM_CONDITIONAL([COND_LZMAINFO], [test x$enable_lzmainfo != xno])
    -
    -AC_ARG_ENABLE([lzma-links], [AS_HELP_STRING([--disable-lzma-links],
    -		[do not create symlinks for LZMA Utils compatibility])],
    -	[], [enable_lzma_links=yes])
    -AM_CONDITIONAL([COND_LZMALINKS], [test x$enable_lzma_links != xno])
    -
    -AC_ARG_ENABLE([scripts], [AS_HELP_STRING([--disable-scripts],
    -		[do not install the scripts xzdiff, xzgrep, xzless, xzmore,
    -		and their symlinks])],
    -	[], [enable_scripts=yes])
    -AM_CONDITIONAL([COND_SCRIPTS], [test x$enable_scripts != xno])
    -
    -AC_ARG_ENABLE([doc], [AS_HELP_STRING([--disable-doc],
    -		[do not install documentation files to docdir
    -		(man pages will still be installed)])],
    -	[], [enable_doc=yes])
    -AM_CONDITIONAL([COND_DOC], [test x$enable_doc != xno])
    -
    -
    -#####################
    -# Symbol versioning #
    -#####################
    -
    -AC_MSG_CHECKING([if library symbol versioning should be used])
    -AC_ARG_ENABLE([symbol-versions], [AS_HELP_STRING([--enable-symbol-versions],
    -		[Use symbol versioning for liblzma. Enabled by default on
    -		GNU/Linux, other GNU-based systems, and FreeBSD.])],
    -	[], [enable_symbol_versions=auto])
    -if test "x$enable_symbol_versions" = xauto; then
    -	case $host_os in
    -		# NOTE: Even if one omits -gnu on GNU/Linux (e.g.
    -		# i486-slackware-linux), configure will (via config.sub)
    -		# append -gnu (e.g. i486-slackware-linux-gnu), and this
    -		# test will work correctly.
    -		gnu* | *-gnu* | freebsd*)
    -			enable_symbol_versions=yes
    -			;;
    -		*)
    -			enable_symbol_versions=no
    -			;;
    -	esac
    -fi
    -AC_MSG_RESULT([$enable_symbol_versions])
    -AM_CONDITIONAL([COND_SYMVERS], [test "x$enable_symbol_versions" = xyes])
    -
    -
    -###############################################################################
    -# Checks for programs.
    -###############################################################################
    -
    -echo
    -gl_POSIX_SHELL
    -if test -z "$POSIX_SHELL" && test "x$enable_scripts" = xyes ; then
    -	AC_MSG_ERROR([No POSIX conforming shell (sh) was found.])
    -fi
    -
    -echo
    -echo "Initializing Automake:"
    -
    -# We don't use "subdir-objects" yet because it breaks "make distclean" when
    -# dependencies are enabled (as of Automake 1.14.1) due to this bug:
    -# http://debbugs.gnu.org/cgi/bugreport.cgi?bug=17354
    -# The -Wno-unsupported is used to silence warnings about missing
    -# "subdir-objects".
    -AM_INIT_AUTOMAKE([1.12 foreign tar-v7 filename-length-max=99 serial-tests -Wno-unsupported])
    -AC_PROG_LN_S
    -
    -AC_PROG_CC_C99
    -if test x$ac_cv_prog_cc_c99 = xno ; then
    -	AC_MSG_ERROR([No C99 compiler was found.])
    -fi
    -
    -AM_PROG_CC_C_O
    -AM_PROG_AS
    -AC_USE_SYSTEM_EXTENSIONS
    -
    -case $enable_threads in
    -	posix)
    -		echo
    -		echo "POSIX threading support:"
    -		AX_PTHREAD([:]) dnl We don't need the HAVE_PTHREAD macro.
    -		LIBS="$LIBS $PTHREAD_LIBS"
    -		AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS"
    -
    -		dnl NOTE: PTHREAD_CC is ignored. It would be useful on AIX,
    -		dnl but it's tricky to get it right together with
    -		dnl AC_PROG_CC_C99. Thus, this is handled by telling the
    -		dnl user in INSTALL to set the correct CC manually.
    -
    -		AC_DEFINE([MYTHREAD_POSIX], [1],
    -			[Define to 1 when using POSIX threads (pthreads).])
    -
    -		# These are nice to have but not mandatory.
    -		#
    -		# FIXME: xz uses clock_gettime if it is available and can do
    -		# it even when threading is disabled. Moving this outside
    -		# of pthread detection may be undesirable because then
    -		# liblzma may get linked against librt even when librt isn't
    -		# needed by liblzma.
    -		OLD_CFLAGS=$CFLAGS
    -		CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
    -		AC_SEARCH_LIBS([clock_gettime], [rt])
    -		AC_CHECK_FUNCS([clock_gettime pthread_condattr_setclock])
    -		AC_CHECK_DECLS([CLOCK_MONOTONIC], [], [], [[#include ]])
    -		CFLAGS=$OLD_CFLAGS
    -		;;
    -	win95)
    -		AC_DEFINE([MYTHREAD_WIN95], [1], [Define to 1 when using
    -			Windows 95 (and thus XP) compatible threads.
    -			This avoids use of features that were added in
    -			Windows Vista.])
    -		;;
    -	vista)
    -		AC_DEFINE([MYTHREAD_VISTA], [1], [Define to 1 when using
    -			Windows Vista compatible threads. This uses
    -			features that are not available on Windows XP.])
    -		;;
    -esac
    -AM_CONDITIONAL([COND_THREADS], [test "x$enable_threads" != xno])
    -
    -echo
    -echo "Initializing Libtool:"
    -LT_PREREQ([2.2])
    -LT_INIT([win32-dll])
    -LT_LANG([Windows Resource])
    -
    -# This is a bit wrong since it is possible to request that only some libs
    -# are built as shared. Using that feature isn't so common though, and this
    -# breaks only on Windows (at least for now) if the user enables only some
    -# libs as shared.
    -AM_CONDITIONAL([COND_SHARED], [test "x$enable_shared" != xno])
    -
    -
    -###############################################################################
    -# Checks for libraries.
    -###############################################################################
    -
    -echo
    -echo "Initializing gettext:"
    -AM_GNU_GETTEXT_VERSION([0.18])
    -AM_GNU_GETTEXT([external])
    -
    -
    -###############################################################################
    -# Checks for header files.
    -###############################################################################
    -
    -AC_DEFINE_UNQUOTED([ASSUME_RAM], [128],
    -    [How many MiB of RAM to assume if the real amount cannot be determined.])
    -
    -# There is currently no workarounds in this package if some of
    -# these headers are missing.
    -AC_CHECK_HEADERS([fcntl.h limits.h sys/time.h],
    -	[],
    -	[AC_MSG_ERROR([Required header file(s) are missing.])])
    -
    -# This allows the use of the intrinsic functions if they are available.
    -AC_CHECK_HEADERS([immintrin.h])
    -
    -
    -###############################################################################
    -# Checks for typedefs, structures, and compiler characteristics.
    -###############################################################################
    -
    -dnl We don't need these as long as we need a C99 compiler anyway.
    -dnl AC_C_INLINE
    -dnl AC_C_RESTRICT
    -
    -AC_HEADER_STDBOOL
    -
    -AC_TYPE_UINT8_T
    -AC_TYPE_UINT16_T
    -AC_TYPE_INT32_T
    -AC_TYPE_UINT32_T
    -AC_TYPE_INT64_T
    -AC_TYPE_UINT64_T
    -AC_TYPE_UINTPTR_T
    -
    -AC_CHECK_SIZEOF([size_t])
    -
    -# The command line tool can copy high resolution timestamps if such
    -# information is available in struct stat. Otherwise one second accuracy
    -# is used.
    -AC_CHECK_MEMBERS([
    -	struct stat.st_atim.tv_nsec,
    -	struct stat.st_atimespec.tv_nsec,
    -	struct stat.st_atimensec,
    -	struct stat.st_uatime,
    -	struct stat.st_atim.st__tim.tv_nsec])
    -
    -AC_SYS_LARGEFILE
    -AC_C_BIGENDIAN
    -
    -# Find the best function to set timestamps.
    -AC_CHECK_FUNCS([futimens futimes futimesat utimes utime], [break])
    -
    -# These are nice to have but not mandatory.
    -AC_CHECK_FUNCS([posix_fadvise pipe2])
    -
    -TUKLIB_PROGNAME
    -TUKLIB_INTEGER
    -TUKLIB_PHYSMEM
    -TUKLIB_CPUCORES
    -TUKLIB_MBSTR
    -
    -# Check for system-provided SHA-256. At least the following is supported:
    -#
    -# OS       Headers                     Library  Type           Function
    -# FreeBSD  sys/types.h + sha256.h      libmd    SHA256_CTX     SHA256_Init
    -# NetBSD   sys/types.h + sha2.h                 SHA256_CTX     SHA256_Init
    -# OpenBSD  sys/types.h + sha2.h                 SHA2_CTX       SHA256Init
    -# Solaris  sys/types.h + sha2.h        libmd    SHA256_CTX     SHA256Init
    -# MINIX 3  sys/types.h + minix/sha2.h  libutil  SHA256_CTX     SHA256_Init
    -# Darwin   CommonCrypto/CommonDigest.h          CC_SHA256_CTX  CC_SHA256_Init
    -#
    -# Note that Darwin's CC_SHA256_Update takes buffer size as uint32_t instead
    -# of size_t.
    -#
    -# We don't check for e.g. OpenSSL or libgcrypt because we don't want
    -# to introduce dependencies to other packages by default. Maybe such
    -# libraries could be supported via additional configure options though.
    -#
    -if test "x$enable_check_sha256" = "xyes"; then
    -	# Test for Common Crypto before others, because Darwin has sha256.h
    -	# too and we don't want to use that, because on older versions it
    -	# uses OpenSSL functions, whose SHA256_Init is not guaranteed to
    -	# succeed.
    -	sha256_header_found=no
    -	AC_CHECK_HEADERS(
    -		[CommonCrypto/CommonDigest.h sha256.h sha2.h minix/sha2.h],
    -		[sha256_header_found=yes ; break])
    -	if test "x$sha256_header_found" = xyes; then
    -		AC_CHECK_TYPES([CC_SHA256_CTX, SHA256_CTX, SHA2_CTX], [], [],
    -			[[#ifdef HAVE_SYS_TYPES_H
    -			  # include 
    -			  #endif
    -			  #ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H
    -			  # include 
    -			  #endif
    -			  #ifdef HAVE_SHA256_H
    -			  # include 
    -			  #endif
    -			  #ifdef HAVE_SHA2_H
    -			  # include 
    -			  #endif
    -			  #ifdef HAVE_MINIX_SHA2_H
    -			  # include 
    -			  #endif]])
    -		AC_SEARCH_LIBS([SHA256_Init], [md util])
    -		AC_SEARCH_LIBS([SHA256Init], [md])
    -		AC_CHECK_FUNCS([CC_SHA256_Init SHA256_Init SHA256Init],
    -			[break])
    -	fi
    -fi
    -AM_CONDITIONAL([COND_INTERNAL_SHA256],
    -	[test "x$ac_cv_func_SHA256_Init" != xyes \
    -		&& test "x$ac_cv_func_SHA256Init" != xyes \
    -		&& test "x$ac_cv_func_CC_SHA256_Init" != xyes])
    -
    -# Check for SSE2 intrinsics.
    -AC_CHECK_DECL([_mm_movemask_epi8],
    -	[AC_DEFINE([HAVE__MM_MOVEMASK_EPI8], [1],
    -		[Define to 1 if _mm_movemask_epi8 is available.])],
    -	[],
    -[#ifdef HAVE_IMMINTRIN_H
    -#include 
    -#endif])
    -
    -
    -###############################################################################
    -# If using GCC, set some additional AM_CFLAGS:
    -###############################################################################
    -
    -if test "$GCC" = yes ; then
    -	echo
    -	echo "GCC extensions:"
    -fi
    -
    -# Always do the visibility check but don't set AM_CFLAGS on Windows.
    -# This way things get set properly even on Windows.
    -gl_VISIBILITY
    -if test -n "$CFLAG_VISIBILITY" && test "$is_w32" = no; then
    -	AM_CFLAGS="$AM_CFLAGS $CFLAG_VISIBILITY"
    -fi
    -
    -if test "$GCC" = yes ; then
    -	# Enable as much warnings as possible. These commented warnings won't
    -	# work for this package though:
    -	#   * -Wunreachable-code breaks several assert(0) cases, which are
    -	#     backed up with "return LZMA_PROG_ERROR".
    -	#   * -Wcast-qual would break various things where we need a non-const
    -	#     pointer although we don't modify anything through it.
    -	#   * -Wcast-align breaks optimized CRC32 and CRC64 implementation
    -	#     on some architectures (not on x86), where this warning is bogus,
    -	#     because we take care of correct alignment.
    -	#   * -Winline, -Wdisabled-optimization, -Wunsafe-loop-optimizations
    -	#     don't seem so useful here; at least the last one gives some
    -	#     warnings which are not bugs.
    -	for NEW_FLAG in \
    -			-Wall \
    -			-Wextra \
    -			-Wvla \
    -			-Wformat=2 \
    -			-Winit-self \
    -			-Wmissing-include-dirs \
    -			-Wstrict-aliasing \
    -			-Wfloat-equal \
    -			-Wundef \
    -			-Wshadow \
    -			-Wpointer-arith \
    -			-Wbad-function-cast \
    -			-Wwrite-strings \
    -			-Wlogical-op \
    -			-Waggregate-return \
    -			-Wstrict-prototypes \
    -			-Wold-style-definition \
    -			-Wmissing-prototypes \
    -			-Wmissing-declarations \
    -			-Wmissing-noreturn \
    -			-Wredundant-decls
    -	do
    -		AC_MSG_CHECKING([if $CC accepts $NEW_FLAG])
    -		OLD_CFLAGS="$CFLAGS"
    -		CFLAGS="$CFLAGS $NEW_FLAG -Werror"
    -		AC_COMPILE_IFELSE([AC_LANG_SOURCE(
    -				[void foo(void); void foo(void) { }])], [
    -			AM_CFLAGS="$AM_CFLAGS $NEW_FLAG"
    -			AC_MSG_RESULT([yes])
    -		], [
    -			AC_MSG_RESULT([no])
    -		])
    -		CFLAGS="$OLD_CFLAGS"
    -	done
    -
    -	AC_ARG_ENABLE([werror],
    -		AS_HELP_STRING([--enable-werror], [Enable -Werror to abort
    -			compilation on all compiler warnings.]),
    -		[], [enable_werror=no])
    -	if test "x$enable_werror" = "xyes"; then
    -		AM_CFLAGS="$AM_CFLAGS -Werror"
    -	fi
    -fi
    -
    -
    -###############################################################################
    -# Create the makefiles and config.h
    -###############################################################################
    -
    -echo
    -
    -# Don't build the lib directory at all if we don't need any replacement
    -# functions.
    -AM_CONDITIONAL([COND_GNULIB], test -n "$LIBOBJS")
    -
    -# Add default AM_CFLAGS.
    -AC_SUBST([AM_CFLAGS])
    -
    -# This is needed for src/scripts.
    -xz=`echo xz | sed "$program_transform_name"`
    -AC_SUBST([xz])
    -
    -AC_CONFIG_FILES([
    -	Doxyfile
    -	Makefile
    -	po/Makefile.in
    -	lib/Makefile
    -	src/Makefile
    -	src/liblzma/Makefile
    -	src/liblzma/api/Makefile
    -	src/xz/Makefile
    -	src/xzdec/Makefile
    -	src/lzmainfo/Makefile
    -	src/scripts/Makefile
    -	tests/Makefile
    -	debug/Makefile
    -])
    -AC_CONFIG_FILES([src/scripts/xzdiff], [chmod +x src/scripts/xzdiff])
    -AC_CONFIG_FILES([src/scripts/xzgrep], [chmod +x src/scripts/xzgrep])
    -AC_CONFIG_FILES([src/scripts/xzmore], [chmod +x src/scripts/xzmore])
    -AC_CONFIG_FILES([src/scripts/xzless], [chmod +x src/scripts/xzless])
    -
    -AC_OUTPUT
    -
    -# Some warnings
    -if test x$tuklib_cv_physmem_method = xunknown; then
    -	echo
    -	echo "WARNING:"
    -	echo "No supported method to detect the amount of RAM."
    -	echo "Consider using --enable-assume-ram (if you didn't already)"
    -	echo "or make a patch to add support for this operating system."
    -fi
    -
    -if test x$tuklib_cv_cpucores_method = xunknown; then
    -	echo
    -	echo "WARNING:"
    -	echo "No supported method to detect the number of CPU cores."
    -fi
    -
    -if test "x$enable_threads$enable_small" = xnoyes; then
    -	echo
    -	echo "NOTE:"
    -	echo "liblzma will be thread unsafe due the combination"
    -	echo "of --disable-threads --enable-small."
    -fi
    diff --git a/external/public-domain/xz/dist/doc/examples/00_README.txt b/external/public-domain/xz/dist/doc/examples/00_README.txt
    deleted file mode 100644
    index 120e1eb7e..000000000
    --- a/external/public-domain/xz/dist/doc/examples/00_README.txt
    +++ /dev/null
    @@ -1,31 +0,0 @@
    -
    -liblzma example programs
    -========================
    -
    -Introduction
    -
    -    The examples are written so that the same comments aren't
    -    repeated (much) in later files.
    -
    -    On POSIX systems, the examples should build by just typing "make".
    -
    -    The examples that use stdin or stdout don't set stdin and stdout
    -    to binary mode. On systems where it matters (e.g. Windows) it is
    -    possible that the examples won't work without modification.
    -
    -
    -List of examples
    -
    -    01_compress_easy.c                  Multi-call compression using
    -                                        a compression preset
    -
    -    02_decompress.c                     Multi-call decompression
    -
    -    03_compress_custom.c                Like 01_compress_easy.c but using
    -                                        a custom filter chain
    -                                        (x86 BCJ + LZMA2)
    -
    -    04_compress_easy_mt.c               Multi-threaded multi-call
    -                                        compression using a compression
    -                                        preset
    -
    diff --git a/external/public-domain/xz/dist/doc/examples/01_compress_easy.c b/external/public-domain/xz/dist/doc/examples/01_compress_easy.c
    deleted file mode 100644
    index e6dd2b0cd..000000000
    --- a/external/public-domain/xz/dist/doc/examples/01_compress_easy.c
    +++ /dev/null
    @@ -1,297 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       01_compress_easy.c
    -/// \brief      Compress from stdin to stdout in multi-call mode
    -///
    -/// Usage:      ./01_compress_easy PRESET < INFILE > OUTFILE
    -///
    -/// Example:    ./01_compress_easy 6 < foo > foo.xz
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -
    -static void
    -show_usage_and_exit(const char *argv0)
    -{
    -	fprintf(stderr, "Usage: %s PRESET < INFILE > OUTFILE\n"
    -			"PRESET is a number 0-9 and can optionally be "
    -			"followed by `e' to indicate extreme preset\n",
    -			argv0);
    -	exit(EXIT_FAILURE);
    -}
    -
    -
    -static uint32_t
    -get_preset(int argc, char **argv)
    -{
    -	// One argument whose first char must be 0-9.
    -	if (argc != 2 || argv[1][0] < '0' || argv[1][0] > '9')
    -		show_usage_and_exit(argv[0]);
    -
    -	// Calculate the preste level 0-9.
    -	uint32_t preset = argv[1][0] - '0';
    -
    -	// If there is a second char, it must be 'e'. It will set
    -	// the LZMA_PRESET_EXTREME flag.
    -	if (argv[1][1] != '\0') {
    -		if (argv[1][1] != 'e' || argv[1][2] != '\0')
    -			show_usage_and_exit(argv[0]);
    -
    -		preset |= LZMA_PRESET_EXTREME;
    -	}
    -
    -	return preset;
    -}
    -
    -
    -static bool
    -init_encoder(lzma_stream *strm, uint32_t preset)
    -{
    -	// Initialize the encoder using a preset. Set the integrity to check
    -	// to CRC64, which is the default in the xz command line tool. If
    -	// the .xz file needs to be decompressed with XZ Embedded, use
    -	// LZMA_CHECK_CRC32 instead.
    -	lzma_ret ret = lzma_easy_encoder(strm, preset, LZMA_CHECK_CRC64);
    -
    -	// Return successfully if the initialization went fine.
    -	if (ret == LZMA_OK)
    -		return true;
    -
    -	// Something went wrong. The possible errors are documented in
    -	// lzma/container.h (src/liblzma/api/lzma/container.h in the source
    -	// package or e.g. /usr/include/lzma/container.h depending on the
    -	// install prefix).
    -	const char *msg;
    -	switch (ret) {
    -	case LZMA_MEM_ERROR:
    -		msg = "Memory allocation failed";
    -		break;
    -
    -	case LZMA_OPTIONS_ERROR:
    -		msg = "Specified preset is not supported";
    -		break;
    -
    -	case LZMA_UNSUPPORTED_CHECK:
    -		msg = "Specified integrity check is not supported";
    -		break;
    -
    -	default:
    -		// This is most likely LZMA_PROG_ERROR indicating a bug in
    -		// this program or in liblzma. It is inconvenient to have a
    -		// separate error message for errors that should be impossible
    -		// to occur, but knowing the error code is important for
    -		// debugging. That's why it is good to print the error code
    -		// at least when there is no good error message to show.
    -		msg = "Unknown error, possibly a bug";
    -		break;
    -	}
    -
    -	fprintf(stderr, "Error initializing the encoder: %s (error code %u)\n",
    -			msg, ret);
    -	return false;
    -}
    -
    -
    -static bool
    -compress(lzma_stream *strm, FILE *infile, FILE *outfile)
    -{
    -	// This will be LZMA_RUN until the end of the input file is reached.
    -	// This tells lzma_code() when there will be no more input.
    -	lzma_action action = LZMA_RUN;
    -
    -	// Buffers to temporarily hold uncompressed input
    -	// and compressed output.
    -	uint8_t inbuf[BUFSIZ];
    -	uint8_t outbuf[BUFSIZ];
    -
    -	// Initialize the input and output pointers. Initializing next_in
    -	// and avail_in isn't really necessary when we are going to encode
    -	// just one file since LZMA_STREAM_INIT takes care of initializing
    -	// those already. But it doesn't hurt much and it will be needed
    -	// if encoding more than one file like we will in 02_decompress.c.
    -	//
    -	// While we don't care about strm->total_in or strm->total_out in this
    -	// example, it is worth noting that initializing the encoder will
    -	// always reset total_in and total_out to zero. But the encoder
    -	// initialization doesn't touch next_in, avail_in, next_out, or
    -	// avail_out.
    -	strm->next_in = NULL;
    -	strm->avail_in = 0;
    -	strm->next_out = outbuf;
    -	strm->avail_out = sizeof(outbuf);
    -
    -	// Loop until the file has been successfully compressed or until
    -	// an error occurs.
    -	while (true) {
    -		// Fill the input buffer if it is empty.
    -		if (strm->avail_in == 0 && !feof(infile)) {
    -			strm->next_in = inbuf;
    -			strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
    -					infile);
    -
    -			if (ferror(infile)) {
    -				fprintf(stderr, "Read error: %s\n",
    -						strerror(errno));
    -				return false;
    -			}
    -
    -			// Once the end of the input file has been reached,
    -			// we need to tell lzma_code() that no more input
    -			// will be coming and that it should finish the
    -			// encoding.
    -			if (feof(infile))
    -				action = LZMA_FINISH;
    -		}
    -
    -		// Tell liblzma do the actual encoding.
    -		//
    -		// This reads up to strm->avail_in bytes of input starting
    -		// from strm->next_in. avail_in will be decremented and
    -		// next_in incremented by an equal amount to match the
    -		// number of input bytes consumed.
    -		//
    -		// Up to strm->avail_out bytes of compressed output will be
    -		// written starting from strm->next_out. avail_out and next_out
    -		// will be incremented by an equal amount to match the number
    -		// of output bytes written.
    -		//
    -		// The encoder has to do internal buffering, which means that
    -		// it may take quite a bit of input before the same data is
    -		// available in compressed form in the output buffer.
    -		lzma_ret ret = lzma_code(strm, action);
    -
    -		// If the output buffer is full or if the compression finished
    -		// successfully, write the data from the output bufffer to
    -		// the output file.
    -		if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
    -			// When lzma_code() has returned LZMA_STREAM_END,
    -			// the output buffer is likely to be only partially
    -			// full. Calculate how much new data there is to
    -			// be written to the output file.
    -			size_t write_size = sizeof(outbuf) - strm->avail_out;
    -
    -			if (fwrite(outbuf, 1, write_size, outfile)
    -					!= write_size) {
    -				fprintf(stderr, "Write error: %s\n",
    -						strerror(errno));
    -				return false;
    -			}
    -
    -			// Reset next_out and avail_out.
    -			strm->next_out = outbuf;
    -			strm->avail_out = sizeof(outbuf);
    -		}
    -
    -		// Normally the return value of lzma_code() will be LZMA_OK
    -		// until everything has been encoded.
    -		if (ret != LZMA_OK) {
    -			// Once everything has been encoded successfully, the
    -			// return value of lzma_code() will be LZMA_STREAM_END.
    -			//
    -			// It is important to check for LZMA_STREAM_END. Do not
    -			// assume that getting ret != LZMA_OK would mean that
    -			// everything has gone well.
    -			if (ret == LZMA_STREAM_END)
    -				return true;
    -
    -			// It's not LZMA_OK nor LZMA_STREAM_END,
    -			// so it must be an error code. See lzma/base.h
    -			// (src/liblzma/api/lzma/base.h in the source package
    -			// or e.g. /usr/include/lzma/base.h depending on the
    -			// install prefix) for the list and documentation of
    -			// possible values. Most values listen in lzma_ret
    -			// enumeration aren't possible in this example.
    -			const char *msg;
    -			switch (ret) {
    -			case LZMA_MEM_ERROR:
    -				msg = "Memory allocation failed";
    -				break;
    -
    -			case LZMA_DATA_ERROR:
    -				// This error is returned if the compressed
    -				// or uncompressed size get near 8 EiB
    -				// (2^63 bytes) because that's where the .xz
    -				// file format size limits currently are.
    -				// That is, the possibility of this error
    -				// is mostly theoretical unless you are doing
    -				// something very unusual.
    -				//
    -				// Note that strm->total_in and strm->total_out
    -				// have nothing to do with this error. Changing
    -				// those variables won't increase or decrease
    -				// the chance of getting this error.
    -				msg = "File size limits exceeded";
    -				break;
    -
    -			default:
    -				// This is most likely LZMA_PROG_ERROR, but
    -				// if this program is buggy (or liblzma has
    -				// a bug), it may be e.g. LZMA_BUF_ERROR or
    -				// LZMA_OPTIONS_ERROR too.
    -				//
    -				// It is inconvenient to have a separate
    -				// error message for errors that should be
    -				// impossible to occur, but knowing the error
    -				// code is important for debugging. That's why
    -				// it is good to print the error code at least
    -				// when there is no good error message to show.
    -				msg = "Unknown error, possibly a bug";
    -				break;
    -			}
    -
    -			fprintf(stderr, "Encoder error: %s (error code %u)\n",
    -					msg, ret);
    -			return false;
    -		}
    -	}
    -}
    -
    -
    -extern int
    -main(int argc, char **argv)
    -{
    -	// Get the preset number from the command line.
    -	uint32_t preset = get_preset(argc, argv);
    -
    -	// Initialize a lzma_stream structure. When it is allocated on stack,
    -	// it is simplest to use LZMA_STREAM_INIT macro like below. When it
    -	// is allocated on heap, using memset(strmptr, 0, sizeof(*strmptr))
    -	// works (as long as NULL pointers are represented with zero bits
    -	// as they are on practically all computers today).
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -
    -	// Initialize the encoder. If it succeeds, compress from
    -	// stdin to stdout.
    -	bool success = init_encoder(&strm, preset);
    -	if (success)
    -		success = compress(&strm, stdin, stdout);
    -
    -	// Free the memory allocated for the encoder. If we were encoding
    -	// multiple files, this would only need to be done after the last
    -	// file. See 02_decompress.c for handling of multiple files.
    -	//
    -	// It is OK to call lzma_end() multiple times or when it hasn't been
    -	// actually used except initialized with LZMA_STREAM_INIT.
    -	lzma_end(&strm);
    -
    -	// Close stdout to catch possible write errors that can occur
    -	// when pending data is flushed from the stdio buffers.
    -	if (fclose(stdout)) {
    -		fprintf(stderr, "Write error: %s\n", strerror(errno));
    -		success = false;
    -	}
    -
    -	return success ? EXIT_SUCCESS : EXIT_FAILURE;
    -}
    diff --git a/external/public-domain/xz/dist/doc/examples/02_decompress.c b/external/public-domain/xz/dist/doc/examples/02_decompress.c
    deleted file mode 100644
    index 4c0f37cbc..000000000
    --- a/external/public-domain/xz/dist/doc/examples/02_decompress.c
    +++ /dev/null
    @@ -1,287 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       02_decompress.c
    -/// \brief      Decompress .xz files to stdout
    -///
    -/// Usage:      ./02_decompress INPUT_FILES... > OUTFILE
    -///
    -/// Example:    ./02_decompress foo.xz bar.xz > foobar
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -
    -static bool
    -init_decoder(lzma_stream *strm)
    -{
    -	// Initialize a .xz decoder. The decoder supports a memory usage limit
    -	// and a set of flags.
    -	//
    -	// The memory usage of the decompressor depends on the settings used
    -	// to compress a .xz file. It can vary from less than a megabyte to
    -	// a few gigabytes, but in practice (at least for now) it rarely
    -	// exceeds 65 MiB because that's how much memory is required to
    -	// decompress files created with "xz -9". Settings requiring more
    -	// memory take extra effort to use and don't (at least for now)
    -	// provide significantly better compression in most cases.
    -	//
    -	// Memory usage limit is useful if it is important that the
    -	// decompressor won't consume gigabytes of memory. The need
    -	// for limiting depends on the application. In this example,
    -	// no memory usage limiting is used. This is done by setting
    -	// the limit to UINT64_MAX.
    -	//
    -	// The .xz format allows concatenating compressed files as is:
    -	//
    -	//     echo foo | xz > foobar.xz
    -	//     echo bar | xz >> foobar.xz
    -	//
    -	// When decompressing normal standalone .xz files, LZMA_CONCATENATED
    -	// should always be used to support decompression of concatenated
    -	// .xz files. If LZMA_CONCATENATED isn't used, the decoder will stop
    -	// after the first .xz stream. This can be useful when .xz data has
    -	// been embedded inside another file format.
    -	//
    -	// Flags other than LZMA_CONCATENATED are supported too, and can
    -	// be combined with bitwise-or. See lzma/container.h
    -	// (src/liblzma/api/lzma/container.h in the source package or e.g.
    -	// /usr/include/lzma/container.h depending on the install prefix)
    -	// for details.
    -	lzma_ret ret = lzma_stream_decoder(
    -			strm, UINT64_MAX, LZMA_CONCATENATED);
    -
    -	// Return successfully if the initialization went fine.
    -	if (ret == LZMA_OK)
    -		return true;
    -
    -	// Something went wrong. The possible errors are documented in
    -	// lzma/container.h (src/liblzma/api/lzma/container.h in the source
    -	// package or e.g. /usr/include/lzma/container.h depending on the
    -	// install prefix).
    -	//
    -	// Note that LZMA_MEMLIMIT_ERROR is never possible here. If you
    -	// specify a very tiny limit, the error will be delayed until
    -	// the first headers have been parsed by a call to lzma_code().
    -	const char *msg;
    -	switch (ret) {
    -	case LZMA_MEM_ERROR:
    -		msg = "Memory allocation failed";
    -		break;
    -
    -	case LZMA_OPTIONS_ERROR:
    -		msg = "Unsupported decompressor flags";
    -		break;
    -
    -	default:
    -		// This is most likely LZMA_PROG_ERROR indicating a bug in
    -		// this program or in liblzma. It is inconvenient to have a
    -		// separate error message for errors that should be impossible
    -		// to occur, but knowing the error code is important for
    -		// debugging. That's why it is good to print the error code
    -		// at least when there is no good error message to show.
    -		msg = "Unknown error, possibly a bug";
    -		break;
    -	}
    -
    -	fprintf(stderr, "Error initializing the decoder: %s (error code %u)\n",
    -			msg, ret);
    -	return false;
    -}
    -
    -
    -static bool
    -decompress(lzma_stream *strm, const char *inname, FILE *infile, FILE *outfile)
    -{
    -	// When LZMA_CONCATENATED flag was used when initializing the decoder,
    -	// we need to tell lzma_code() when there will be no more input.
    -	// This is done by setting action to LZMA_FINISH instead of LZMA_RUN
    -	// in the same way as it is done when encoding.
    -	//
    -	// When LZMA_CONCATENATED isn't used, there is no need to use
    -	// LZMA_FINISH to tell when all the input has been read, but it
    -	// is still OK to use it if you want. When LZMA_CONCATENATED isn't
    -	// used, the decoder will stop after the first .xz stream. In that
    -	// case some unused data may be left in strm->next_in.
    -	lzma_action action = LZMA_RUN;
    -
    -	uint8_t inbuf[BUFSIZ];
    -	uint8_t outbuf[BUFSIZ];
    -
    -	strm->next_in = NULL;
    -	strm->avail_in = 0;
    -	strm->next_out = outbuf;
    -	strm->avail_out = sizeof(outbuf);
    -
    -	while (true) {
    -		if (strm->avail_in == 0 && !feof(infile)) {
    -			strm->next_in = inbuf;
    -			strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
    -					infile);
    -
    -			if (ferror(infile)) {
    -				fprintf(stderr, "%s: Read error: %s\n",
    -						inname, strerror(errno));
    -				return false;
    -			}
    -
    -			// Once the end of the input file has been reached,
    -			// we need to tell lzma_code() that no more input
    -			// will be coming. As said before, this isn't required
    -			// if the LZMA_CONATENATED flag isn't used when
    -			// initializing the decoder.
    -			if (feof(infile))
    -				action = LZMA_FINISH;
    -		}
    -
    -		lzma_ret ret = lzma_code(strm, action);
    -
    -		if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
    -			size_t write_size = sizeof(outbuf) - strm->avail_out;
    -
    -			if (fwrite(outbuf, 1, write_size, outfile)
    -					!= write_size) {
    -				fprintf(stderr, "Write error: %s\n",
    -						strerror(errno));
    -				return false;
    -			}
    -
    -			strm->next_out = outbuf;
    -			strm->avail_out = sizeof(outbuf);
    -		}
    -
    -		if (ret != LZMA_OK) {
    -			// Once everything has been decoded successfully, the
    -			// return value of lzma_code() will be LZMA_STREAM_END.
    -			//
    -			// It is important to check for LZMA_STREAM_END. Do not
    -			// assume that getting ret != LZMA_OK would mean that
    -			// everything has gone well or that when you aren't
    -			// getting more output it must have successfully
    -			// decoded everything.
    -			if (ret == LZMA_STREAM_END)
    -				return true;
    -
    -			// It's not LZMA_OK nor LZMA_STREAM_END,
    -			// so it must be an error code. See lzma/base.h
    -			// (src/liblzma/api/lzma/base.h in the source package
    -			// or e.g. /usr/include/lzma/base.h depending on the
    -			// install prefix) for the list and documentation of
    -			// possible values. Many values listen in lzma_ret
    -			// enumeration aren't possible in this example, but
    -			// can be made possible by enabling memory usage limit
    -			// or adding flags to the decoder initialization.
    -			const char *msg;
    -			switch (ret) {
    -			case LZMA_MEM_ERROR:
    -				msg = "Memory allocation failed";
    -				break;
    -
    -			case LZMA_FORMAT_ERROR:
    -				// .xz magic bytes weren't found.
    -				msg = "The input is not in the .xz format";
    -				break;
    -
    -			case LZMA_OPTIONS_ERROR:
    -				// For example, the headers specify a filter
    -				// that isn't supported by this liblzma
    -				// version (or it hasn't been enabled when
    -				// building liblzma, but no-one sane does
    -				// that unless building liblzma for an
    -				// embedded system). Upgrading to a newer
    -				// liblzma might help.
    -				//
    -				// Note that it is unlikely that the file has
    -				// accidentally became corrupt if you get this
    -				// error. The integrity of the .xz headers is
    -				// always verified with a CRC32, so
    -				// unintentionally corrupt files can be
    -				// distinguished from unsupported files.
    -				msg = "Unsupported compression options";
    -				break;
    -
    -			case LZMA_DATA_ERROR:
    -				msg = "Compressed file is corrupt";
    -				break;
    -
    -			case LZMA_BUF_ERROR:
    -				// Typically this error means that a valid
    -				// file has got truncated, but it might also
    -				// be a damaged part in the file that makes
    -				// the decoder think the file is truncated.
    -				// If you prefer, you can use the same error
    -				// message for this as for LZMA_DATA_ERROR.
    -				msg = "Compressed file is truncated or "
    -						"otherwise corrupt";
    -				break;
    -
    -			default:
    -				// This is most likely LZMA_PROG_ERROR.
    -				msg = "Unknown error, possibly a bug";
    -				break;
    -			}
    -
    -			fprintf(stderr, "%s: Decoder error: "
    -					"%s (error code %u)\n",
    -					inname, msg, ret);
    -			return false;
    -		}
    -	}
    -}
    -
    -
    -extern int
    -main(int argc, char **argv)
    -{
    -	if (argc <= 1) {
    -		fprintf(stderr, "Usage: %s FILES...\n", argv[0]);
    -		return EXIT_FAILURE;
    -	}
    -
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -
    -	bool success = true;
    -
    -	// Try to decompress all files.
    -	for (int i = 1; i < argc; ++i) {
    -		if (!init_decoder(&strm)) {
    -			// Decoder initialization failed. There's no point
    -			// to retry it so we need to exit.
    -			success = false;
    -			break;
    -		}
    -
    -		FILE *infile = fopen(argv[i], "rb");
    -
    -		if (infile == NULL) {
    -			fprintf(stderr, "%s: Error opening the "
    -					"input file: %s\n",
    -					argv[i], strerror(errno));
    -			success = false;
    -		} else {
    -			success &= decompress(&strm, argv[i], infile, stdout);
    -			fclose(infile);
    -		}
    -	}
    -
    -	// Free the memory allocated for the decoder. This only needs to be
    -	// done after the last file.
    -	lzma_end(&strm);
    -
    -	if (fclose(stdout)) {
    -		fprintf(stderr, "Write error: %s\n", strerror(errno));
    -		success = false;
    -	}
    -
    -	return success ? EXIT_SUCCESS : EXIT_FAILURE;
    -}
    diff --git a/external/public-domain/xz/dist/doc/examples/03_compress_custom.c b/external/public-domain/xz/dist/doc/examples/03_compress_custom.c
    deleted file mode 100644
    index 40c85e365..000000000
    --- a/external/public-domain/xz/dist/doc/examples/03_compress_custom.c
    +++ /dev/null
    @@ -1,193 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       03_compress_custom.c
    -/// \brief      Compress in multi-call mode using x86 BCJ and LZMA2
    -///
    -/// Usage:      ./03_compress_custom < INFILE > OUTFILE
    -///
    -/// Example:    ./03_compress_custom < foo > foo.xz
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -
    -static bool
    -init_encoder(lzma_stream *strm)
    -{
    -	// Use the default preset (6) for LZMA2.
    -	//
    -	// The lzma_options_lzma structure and the lzma_lzma_preset() function
    -	// are declared in lzma/lzma12.h (src/liblzma/api/lzma/lzma12.h in the
    -	// source package or e.g. /usr/include/lzma/lzma12.h depending on
    -	// the install prefix).
    -	lzma_options_lzma opt_lzma2;
    -	if (lzma_lzma_preset(&opt_lzma2, LZMA_PRESET_DEFAULT)) {
    -		// It should never fail because the default preset
    -		// (and presets 0-9 optionally with LZMA_PRESET_EXTREME)
    -		// are supported by all stable liblzma versions.
    -		//
    -		// (The encoder initialization later in this function may
    -		// still fail due to unsupported preset *if* the features
    -		// required by the preset have been disabled at build time,
    -		// but no-one does such things except on embedded systems.)
    -		fprintf(stderr, "Unsupported preset, possibly a bug\n");
    -		return false;
    -	}
    -
    -	// Now we could customize the LZMA2 options if we wanted. For example,
    -	// we could set the the dictionary size (opt_lzma2.dict_size) to
    -	// something else than the default (8 MiB) of the default preset.
    -	// See lzma/lzma12.h for details of all LZMA2 options.
    -	//
    -	// The x86 BCJ filter will try to modify the x86 instruction stream so
    -	// that LZMA2 can compress it better. The x86 BCJ filter doesn't need
    -	// any options so it will be set to NULL below.
    -	//
    -	// Construct the filter chain. The uncompressed data goes first to
    -	// the first filter in the array, in this case the x86 BCJ filter.
    -	// The array is always terminated by setting .id = LZMA_VLI_UNKNOWN.
    -	//
    -	// See lzma/filter.h for more information about the lzma_filter
    -	// structure.
    -	lzma_filter filters[] = {
    -		{ .id = LZMA_FILTER_X86, .options = NULL },
    -		{ .id = LZMA_FILTER_LZMA2, .options = &opt_lzma2 },
    -		{ .id = LZMA_VLI_UNKNOWN, .options = NULL },
    -	};
    -
    -	// Initialize the encoder using the custom filter chain.
    -	lzma_ret ret = lzma_stream_encoder(strm, filters, LZMA_CHECK_CRC64);
    -
    -	if (ret == LZMA_OK)
    -		return true;
    -
    -	const char *msg;
    -	switch (ret) {
    -	case LZMA_MEM_ERROR:
    -		msg = "Memory allocation failed";
    -		break;
    -
    -	case LZMA_OPTIONS_ERROR:
    -		// We are no longer using a plain preset so this error
    -		// message has been edited accordingly compared to
    -		// 01_compress_easy.c.
    -		msg = "Specified filter chain is not supported";
    -		break;
    -
    -	case LZMA_UNSUPPORTED_CHECK:
    -		msg = "Specified integrity check is not supported";
    -		break;
    -
    -	default:
    -		msg = "Unknown error, possibly a bug";
    -		break;
    -	}
    -
    -	fprintf(stderr, "Error initializing the encoder: %s (error code %u)\n",
    -			msg, ret);
    -	return false;
    -}
    -
    -
    -// This function is identical to the one in 01_compress_easy.c.
    -static bool
    -compress(lzma_stream *strm, FILE *infile, FILE *outfile)
    -{
    -	lzma_action action = LZMA_RUN;
    -
    -	uint8_t inbuf[BUFSIZ];
    -	uint8_t outbuf[BUFSIZ];
    -
    -	strm->next_in = NULL;
    -	strm->avail_in = 0;
    -	strm->next_out = outbuf;
    -	strm->avail_out = sizeof(outbuf);
    -
    -	while (true) {
    -		if (strm->avail_in == 0 && !feof(infile)) {
    -			strm->next_in = inbuf;
    -			strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
    -					infile);
    -
    -			if (ferror(infile)) {
    -				fprintf(stderr, "Read error: %s\n",
    -						strerror(errno));
    -				return false;
    -			}
    -
    -			if (feof(infile))
    -				action = LZMA_FINISH;
    -		}
    -
    -		lzma_ret ret = lzma_code(strm, action);
    -
    -		if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
    -			size_t write_size = sizeof(outbuf) - strm->avail_out;
    -
    -			if (fwrite(outbuf, 1, write_size, outfile)
    -					!= write_size) {
    -				fprintf(stderr, "Write error: %s\n",
    -						strerror(errno));
    -				return false;
    -			}
    -
    -			strm->next_out = outbuf;
    -			strm->avail_out = sizeof(outbuf);
    -		}
    -
    -		if (ret != LZMA_OK) {
    -			if (ret == LZMA_STREAM_END)
    -				return true;
    -
    -			const char *msg;
    -			switch (ret) {
    -			case LZMA_MEM_ERROR:
    -				msg = "Memory allocation failed";
    -				break;
    -
    -			case LZMA_DATA_ERROR:
    -				msg = "File size limits exceeded";
    -				break;
    -
    -			default:
    -				msg = "Unknown error, possibly a bug";
    -				break;
    -			}
    -
    -			fprintf(stderr, "Encoder error: %s (error code %u)\n",
    -					msg, ret);
    -			return false;
    -		}
    -	}
    -}
    -
    -
    -extern int
    -main(void)
    -{
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -
    -	bool success = init_encoder(&strm);
    -	if (success)
    -		success = compress(&strm, stdin, stdout);
    -
    -	lzma_end(&strm);
    -
    -	if (fclose(stdout)) {
    -		fprintf(stderr, "Write error: %s\n", strerror(errno));
    -		success = false;
    -	}
    -
    -	return success ? EXIT_SUCCESS : EXIT_FAILURE;
    -}
    diff --git a/external/public-domain/xz/dist/doc/examples/04_compress_easy_mt.c b/external/public-domain/xz/dist/doc/examples/04_compress_easy_mt.c
    deleted file mode 100644
    index efe56975c..000000000
    --- a/external/public-domain/xz/dist/doc/examples/04_compress_easy_mt.c
    +++ /dev/null
    @@ -1,206 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       04_compress_easy_mt.c
    -/// \brief      Compress in multi-call mode using LZMA2 in multi-threaded mode
    -///
    -/// Usage:      ./04_compress_easy_mt < INFILE > OUTFILE
    -///
    -/// Example:    ./04_compress_easy_mt < foo > foo.xz
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -
    -static bool
    -init_encoder(lzma_stream *strm)
    -{
    -	// The threaded encoder takes the options as pointer to
    -	// a lzma_mt structure.
    -	lzma_mt mt = {
    -		// No flags are needed.
    -		.flags = 0,
    -
    -		// Let liblzma determine a sane block size.
    -		.block_size = 0,
    -
    -		// Use no timeout for lzma_code() calls by setting timeout
    -		// to zero. That is, sometimes lzma_code() might block for
    -		// a long time (from several seconds to even minutes).
    -		// If this is not OK, for example due to progress indicator
    -		// needing updates, specify a timeout in milliseconds here.
    -		// See the documentation of lzma_mt in lzma/container.h for
    -		// information how to choose a reasonable timeout.
    -		.timeout = 0,
    -
    -		// Use the default preset (6) for LZMA2.
    -		// To use a preset, filters must be set to NULL.
    -		.preset = LZMA_PRESET_DEFAULT,
    -		.filters = NULL,
    -
    -		// Use CRC64 for integrity checking. See also
    -		// 01_compress_easy.c about choosing the integrity check.
    -		.check = LZMA_CHECK_CRC64,
    -	};
    -
    -	// Detect how many threads the CPU supports.
    -	mt.threads = lzma_cputhreads();
    -
    -	// If the number of CPU cores/threads cannot be detected,
    -	// use one thread. Note that this isn't the same as the normal
    -	// single-threaded mode as this will still split the data into
    -	// blocks and use more RAM than the normal single-threaded mode.
    -	// You may want to consider using lzma_easy_encoder() or
    -	// lzma_stream_encoder() instead of lzma_stream_encoder_mt() if
    -	// lzma_cputhreads() returns 0 or 1.
    -	if (mt.threads == 0)
    -		mt.threads = 1;
    -
    -	// If the number of CPU cores/threads exceeds threads_max,
    -	// limit the number of threads to keep memory usage lower.
    -	// The number 8 is arbitrarily chosen and may be too low or
    -	// high depending on the compression preset and the computer
    -	// being used.
    -	//
    -	// FIXME: A better way could be to check the amount of RAM
    -	// (or available RAM) and use lzma_stream_encoder_mt_memusage()
    -	// to determine if the number of threads should be reduced.
    -	const uint32_t threads_max = 8;
    -	if (mt.threads > threads_max)
    -		mt.threads = threads_max;
    -
    -	// Initialize the threaded encoder.
    -	lzma_ret ret = lzma_stream_encoder_mt(strm, &mt);
    -
    -	if (ret == LZMA_OK)
    -		return true;
    -
    -	const char *msg;
    -	switch (ret) {
    -	case LZMA_MEM_ERROR:
    -		msg = "Memory allocation failed";
    -		break;
    -
    -	case LZMA_OPTIONS_ERROR:
    -		// We are no longer using a plain preset so this error
    -		// message has been edited accordingly compared to
    -		// 01_compress_easy.c.
    -		msg = "Specified filter chain is not supported";
    -		break;
    -
    -	case LZMA_UNSUPPORTED_CHECK:
    -		msg = "Specified integrity check is not supported";
    -		break;
    -
    -	default:
    -		msg = "Unknown error, possibly a bug";
    -		break;
    -	}
    -
    -	fprintf(stderr, "Error initializing the encoder: %s (error code %u)\n",
    -			msg, ret);
    -	return false;
    -}
    -
    -
    -// This function is identical to the one in 01_compress_easy.c.
    -static bool
    -compress(lzma_stream *strm, FILE *infile, FILE *outfile)
    -{
    -	lzma_action action = LZMA_RUN;
    -
    -	uint8_t inbuf[BUFSIZ];
    -	uint8_t outbuf[BUFSIZ];
    -
    -	strm->next_in = NULL;
    -	strm->avail_in = 0;
    -	strm->next_out = outbuf;
    -	strm->avail_out = sizeof(outbuf);
    -
    -	while (true) {
    -		if (strm->avail_in == 0 && !feof(infile)) {
    -			strm->next_in = inbuf;
    -			strm->avail_in = fread(inbuf, 1, sizeof(inbuf),
    -					infile);
    -
    -			if (ferror(infile)) {
    -				fprintf(stderr, "Read error: %s\n",
    -						strerror(errno));
    -				return false;
    -			}
    -
    -			if (feof(infile))
    -				action = LZMA_FINISH;
    -		}
    -
    -		lzma_ret ret = lzma_code(strm, action);
    -
    -		if (strm->avail_out == 0 || ret == LZMA_STREAM_END) {
    -			size_t write_size = sizeof(outbuf) - strm->avail_out;
    -
    -			if (fwrite(outbuf, 1, write_size, outfile)
    -					!= write_size) {
    -				fprintf(stderr, "Write error: %s\n",
    -						strerror(errno));
    -				return false;
    -			}
    -
    -			strm->next_out = outbuf;
    -			strm->avail_out = sizeof(outbuf);
    -		}
    -
    -		if (ret != LZMA_OK) {
    -			if (ret == LZMA_STREAM_END)
    -				return true;
    -
    -			const char *msg;
    -			switch (ret) {
    -			case LZMA_MEM_ERROR:
    -				msg = "Memory allocation failed";
    -				break;
    -
    -			case LZMA_DATA_ERROR:
    -				msg = "File size limits exceeded";
    -				break;
    -
    -			default:
    -				msg = "Unknown error, possibly a bug";
    -				break;
    -			}
    -
    -			fprintf(stderr, "Encoder error: %s (error code %u)\n",
    -					msg, ret);
    -			return false;
    -		}
    -	}
    -}
    -
    -
    -extern int
    -main(void)
    -{
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -
    -	bool success = init_encoder(&strm);
    -	if (success)
    -		success = compress(&strm, stdin, stdout);
    -
    -	lzma_end(&strm);
    -
    -	if (fclose(stdout)) {
    -		fprintf(stderr, "Write error: %s\n", strerror(errno));
    -		success = false;
    -	}
    -
    -	return success ? EXIT_SUCCESS : EXIT_FAILURE;
    -}
    diff --git a/external/public-domain/xz/dist/doc/examples_old/xz_pipe_comp.c b/external/public-domain/xz/dist/doc/examples_old/xz_pipe_comp.c
    deleted file mode 100644
    index 9f9224bca..000000000
    --- a/external/public-domain/xz/dist/doc/examples_old/xz_pipe_comp.c
    +++ /dev/null
    @@ -1,127 +0,0 @@
    -/*
    - * xz_pipe_comp.c
    - * A simple example of pipe-only xz compressor implementation.
    - * version: 2010-07-12 - by Daniel Mealha Cabrita
    - * Not copyrighted -- provided to the public domain.
    - *
    - * Compiling:
    - * Link with liblzma. GCC example:
    - * $ gcc -llzma xz_pipe_comp.c -o xz_pipe_comp
    - *
    - * Usage example:
    - * $ cat some_file | ./xz_pipe_comp > some_file.xz
    - */
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -
    -/* COMPRESSION SETTINGS */
    -
    -/* analogous to xz CLI options: -0 to -9 */
    -#define COMPRESSION_LEVEL 6
    -
    -/* boolean setting, analogous to xz CLI option: -e */
    -#define COMPRESSION_EXTREME true
    -
    -/* see: /usr/include/lzma/check.h LZMA_CHECK_* */
    -#define INTEGRITY_CHECK LZMA_CHECK_CRC64
    -
    -
    -/* read/write buffer sizes */
    -#define IN_BUF_MAX	4096
    -#define OUT_BUF_MAX	4096
    -
    -/* error codes */
    -#define RET_OK			0
    -#define RET_ERROR_INIT		1
    -#define RET_ERROR_INPUT		2
    -#define RET_ERROR_OUTPUT	3
    -#define RET_ERROR_COMPRESSION	4
    -
    -
    -/* note: in_file and out_file must be open already */
    -int xz_compress (FILE *in_file, FILE *out_file)
    -{
    -	uint32_t preset = COMPRESSION_LEVEL | (COMPRESSION_EXTREME ? LZMA_PRESET_EXTREME : 0);
    -	lzma_check check = INTEGRITY_CHECK;
    -	lzma_stream strm = LZMA_STREAM_INIT; /* alloc and init lzma_stream struct */
    -	uint8_t in_buf [IN_BUF_MAX];
    -	uint8_t out_buf [OUT_BUF_MAX];
    -	size_t in_len;	/* length of useful data in in_buf */
    -	size_t out_len;	/* length of useful data in out_buf */
    -	bool in_finished = false;
    -	bool out_finished = false;
    -	lzma_action action;
    -	lzma_ret ret_xz;
    -	int ret;
    -
    -	ret = RET_OK;
    -
    -	/* initialize xz encoder */
    -	ret_xz = lzma_easy_encoder (&strm, preset, check);
    -	if (ret_xz != LZMA_OK) {
    -		fprintf (stderr, "lzma_easy_encoder error: %d\n", (int) ret_xz);
    -		return RET_ERROR_INIT;
    -	}
    -
    -	while ((! in_finished) && (! out_finished)) {
    -		/* read incoming data */
    -		in_len = fread (in_buf, 1, IN_BUF_MAX, in_file);
    -
    -		if (feof (in_file)) {
    -			in_finished = true;
    -		}
    -		if (ferror (in_file)) {
    -			in_finished = true;
    -			ret = RET_ERROR_INPUT;
    -		}
    -
    -		strm.next_in = in_buf;
    -		strm.avail_in = in_len;
    -
    -		/* if no more data from in_buf, flushes the
    -		   internal xz buffers and closes the xz data
    -		   with LZMA_FINISH */
    -		action = in_finished ? LZMA_FINISH : LZMA_RUN;
    -
    -		/* loop until there's no pending compressed output */
    -		do {
    -			/* out_buf is clean at this point */
    -			strm.next_out = out_buf;
    -			strm.avail_out = OUT_BUF_MAX;
    -
    -			/* compress data */
    -			ret_xz = lzma_code (&strm, action);
    -
    -			if ((ret_xz != LZMA_OK) && (ret_xz != LZMA_STREAM_END)) {
    -				fprintf (stderr, "lzma_code error: %d\n", (int) ret_xz);
    -				out_finished = true;
    -				ret = RET_ERROR_COMPRESSION;
    -			} else {
    -				/* write compressed data */
    -				out_len = OUT_BUF_MAX - strm.avail_out;
    -				fwrite (out_buf, 1, out_len, out_file);
    -				if (ferror (out_file)) {
    -					out_finished = true;
    -					ret = RET_ERROR_OUTPUT;
    -				}
    -			}
    -		} while (strm.avail_out == 0);
    -	}
    -
    -	lzma_end (&strm);
    -	return ret;
    -}
    -
    -int main ()
    -{
    -	int ret;
    -
    -	ret = xz_compress (stdin, stdout);
    -	return ret;
    -}
    -
    diff --git a/external/public-domain/xz/dist/doc/examples_old/xz_pipe_decomp.c b/external/public-domain/xz/dist/doc/examples_old/xz_pipe_decomp.c
    deleted file mode 100644
    index fb5ad8951..000000000
    --- a/external/public-domain/xz/dist/doc/examples_old/xz_pipe_decomp.c
    +++ /dev/null
    @@ -1,123 +0,0 @@
    -/*
    - * xz_pipe_decomp.c
    - * A simple example of pipe-only xz decompressor implementation.
    - * version: 2012-06-14 - by Daniel Mealha Cabrita
    - * Not copyrighted -- provided to the public domain.
    - *
    - * Compiling:
    - * Link with liblzma. GCC example:
    - * $ gcc -llzma xz_pipe_decomp.c -o xz_pipe_decomp
    - *
    - * Usage example:
    - * $ cat some_file.xz | ./xz_pipe_decomp > some_file
    - */
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -
    -/* read/write buffer sizes */
    -#define IN_BUF_MAX	4096
    -#define OUT_BUF_MAX	4096
    -
    -/* error codes */
    -#define RET_OK			0
    -#define RET_ERROR_INIT		1
    -#define RET_ERROR_INPUT		2
    -#define RET_ERROR_OUTPUT	3
    -#define RET_ERROR_DECOMPRESSION	4
    -
    -
    -/* note: in_file and out_file must be open already */
    -int xz_decompress (FILE *in_file, FILE *out_file)
    -{
    -	lzma_stream strm = LZMA_STREAM_INIT; /* alloc and init lzma_stream struct */
    -	const uint32_t flags = LZMA_TELL_UNSUPPORTED_CHECK | LZMA_CONCATENATED;
    -	const uint64_t memory_limit = UINT64_MAX; /* no memory limit */
    -	uint8_t in_buf [IN_BUF_MAX];
    -	uint8_t out_buf [OUT_BUF_MAX];
    -	size_t in_len;	/* length of useful data in in_buf */
    -	size_t out_len;	/* length of useful data in out_buf */
    -	bool in_finished = false;
    -	bool out_finished = false;
    -	lzma_action action;
    -	lzma_ret ret_xz;
    -	int ret;
    -
    -	ret = RET_OK;
    -
    -	/* initialize xz decoder */
    -	ret_xz = lzma_stream_decoder (&strm, memory_limit, flags);
    -	if (ret_xz != LZMA_OK) {
    -		fprintf (stderr, "lzma_stream_decoder error: %d\n", (int) ret_xz);
    -		return RET_ERROR_INIT;
    -	}
    -
    -	while ((! in_finished) && (! out_finished)) {
    -		/* read incoming data */
    -		in_len = fread (in_buf, 1, IN_BUF_MAX, in_file);
    -
    -		if (feof (in_file)) {
    -			in_finished = true;
    -		}
    -		if (ferror (in_file)) {
    -			in_finished = true;
    -			ret = RET_ERROR_INPUT;
    -		}
    -
    -		strm.next_in = in_buf;
    -		strm.avail_in = in_len;
    -
    -		/* if no more data from in_buf, flushes the
    -		   internal xz buffers and closes the decompressed data
    -		   with LZMA_FINISH */
    -		action = in_finished ? LZMA_FINISH : LZMA_RUN;
    -
    -		/* loop until there's no pending decompressed output */
    -		do {
    -			/* out_buf is clean at this point */
    -			strm.next_out = out_buf;
    -			strm.avail_out = OUT_BUF_MAX;
    -
    -			/* decompress data */
    -			ret_xz = lzma_code (&strm, action);
    -
    -			if ((ret_xz != LZMA_OK) && (ret_xz != LZMA_STREAM_END)) {
    -				fprintf (stderr, "lzma_code error: %d\n", (int) ret_xz);
    -				out_finished = true;
    -				ret = RET_ERROR_DECOMPRESSION;
    -			} else {
    -				/* write decompressed data */
    -				out_len = OUT_BUF_MAX - strm.avail_out;
    -				fwrite (out_buf, 1, out_len, out_file);
    -				if (ferror (out_file)) {
    -					out_finished = true;
    -					ret = RET_ERROR_OUTPUT;
    -				}
    -			}
    -		} while (strm.avail_out == 0);
    -	}
    -
    -	/* Bug fix (2012-06-14): If no errors were detected, check
    -	   that the last lzma_code() call returned LZMA_STREAM_END.
    -	   If not, the file is probably truncated. */
    -	if ((ret == RET_OK) && (ret_xz != LZMA_STREAM_END)) {
    -		fprintf (stderr, "Input truncated or corrupt\n");
    -		ret = RET_ERROR_DECOMPRESSION;
    -	}
    -
    -	lzma_end (&strm);
    -	return ret;
    -}
    -
    -int main ()
    -{
    -	int ret;
    -
    -	ret = xz_decompress (stdin, stdout);
    -	return ret;
    -}
    -
    diff --git a/external/public-domain/xz/dist/doc/faq.txt b/external/public-domain/xz/dist/doc/faq.txt
    deleted file mode 100644
    index 333bee09c..000000000
    --- a/external/public-domain/xz/dist/doc/faq.txt
    +++ /dev/null
    @@ -1,224 +0,0 @@
    -
    -XZ Utils FAQ
    -============
    -
    -Q:  What do the letters XZ mean?
    -
    -A:  Nothing. They are just two letters, which come from the file format
    -    suffix .xz. The .xz suffix was selected, because it seemed to be
    -    pretty much unused. It has no deeper meaning.
    -
    -
    -Q:  What are LZMA and LZMA2?
    -
    -A:  LZMA stands for Lempel-Ziv-Markov chain-Algorithm. It is the name
    -    of the compression algorithm designed by Igor Pavlov for 7-Zip.
    -    LZMA is based on LZ77 and range encoding.
    -
    -    LZMA2 is an updated version of the original LZMA to fix a couple of
    -    practical issues. In context of XZ Utils, LZMA is called LZMA1 to
    -    emphasize that LZMA is not the same thing as LZMA2. LZMA2 is the
    -    primary compression algorithm in the .xz file format.
    -
    -
    -Q:  There are many LZMA related projects. How does XZ Utils relate to them?
    -
    -A:  7-Zip and LZMA SDK are the original projects. LZMA SDK is roughly
    -    a subset of the 7-Zip source tree.
    -
    -    p7zip is 7-Zip's command-line tools ported to POSIX-like systems.
    -
    -    LZMA Utils provide a gzip-like lzma tool for POSIX-like systems.
    -    LZMA Utils are based on LZMA SDK. XZ Utils are the successor to
    -    LZMA Utils.
    -
    -    There are several other projects using LZMA. Most are more or less
    -    based on LZMA SDK. See .
    -
    -
    -Q:  Why is liblzma named liblzma if its primary file format is .xz?
    -    Shouldn't it be e.g. libxz?
    -
    -A:  When the designing of the .xz format began, the idea was to replace
    -    the .lzma format and use the same .lzma suffix. It would have been
    -    quite OK to reuse the suffix when there were very few .lzma files
    -    around. However, the old .lzma format became popular before the
    -    new format was finished. The new format was renamed to .xz but the
    -    name of liblzma wasn't changed.
    -
    -
    -Q:  Do XZ Utils support the .7z format?
    -
    -A:  No. Use 7-Zip (Windows) or p7zip (POSIX-like systems) to handle .7z
    -    files.
    -
    -
    -Q:  I have many .tar.7z files. Can I convert them to .tar.xz without
    -    spending hours recompressing the data?
    -
    -A:  In the "extra" directory, there is a script named 7z2lzma.bash which
    -    is able to convert some .7z files to the .lzma format (not .xz). It
    -    needs the 7za (or 7z) command from p7zip. The script may silently
    -    produce corrupt output if certain assumptions are not met, so
    -    decompress the resulting .lzma file and compare it against the
    -    original before deleting the original file!
    -
    -
    -Q:  I have many .lzma files. Can I quickly convert them to the .xz format?
    -
    -A:  For now, no. Since XZ Utils supports the .lzma format, it's usually
    -    not too bad to keep the old files in the old format. If you want to
    -    do the conversion anyway, you need to decompress the .lzma files and
    -    then recompress to the .xz format.
    -
    -    Technically, there is a way to make the conversion relatively fast
    -    (roughly twice the time that normal decompression takes). Writing
    -    such a tool would take quite a bit of time though, and would probably
    -    be useful to only a few people. If you really want such a conversion
    -    tool, contact Lasse Collin and offer some money.
    -
    -
    -Q:  I have installed xz, but my tar doesn't recognize .tar.xz files.
    -    How can I extract .tar.xz files?
    -
    -A:  xz -dc foo.tar.xz | tar xf -
    -
    -
    -Q:  Can I recover parts of a broken .xz file (e.g. a corrupted CD-R)?
    -
    -A:  It may be possible if the file consists of multiple blocks, which
    -    typically is not the case if the file was created in single-threaded
    -    mode. There is no recovery program yet.
    -
    -
    -Q:  Is (some part of) XZ Utils patented?
    -
    -A:  Lasse Collin is not aware of any patents that could affect XZ Utils.
    -    However, due to the nature of software patents, it's not possible to
    -    guarantee that XZ Utils isn't affected by any third party patent(s).
    -
    -
    -Q:  Where can I find documentation about the file format and algorithms?
    -
    -A:  The .xz format is documented in xz-file-format.txt. It is a container
    -    format only, and doesn't include descriptions of any non-trivial
    -    filters.
    -
    -    Documenting LZMA and LZMA2 is planned, but for now, there is no other
    -    documentation than the source code. Before you begin, you should know
    -    the basics of LZ77 and range-coding algorithms. LZMA is based on LZ77,
    -    but LZMA is a lot more complex. Range coding is used to compress
    -    the final bitstream like Huffman coding is used in Deflate.
    -
    -
    -Q:  I cannot find BCJ and BCJ2 filters. Don't they exist in liblzma?
    -
    -A:  BCJ filter is called "x86" in liblzma. BCJ2 is not included,
    -    because it requires using more than one encoded output stream.
    -    A streamable version of BCJ2-style filtering is planned.
    -
    -
    -Q:  I need to use a script that runs "xz -9". On a system with 256 MiB
    -    of RAM, xz says that it cannot allocate memory. Can I make the
    -    script work without modifying it?
    -
    -A:  Set a default memory usage limit for compression. You can do it e.g.
    -    in a shell initialization script such as ~/.bashrc or /etc/profile:
    -
    -        XZ_DEFAULTS=--memlimit-compress=150MiB
    -        export XZ_DEFAULTS
    -
    -    xz will then scale the compression settings down so that the given
    -    memory usage limit is not reached. This way xz shouldn't run out
    -    of memory.
    -
    -    Check also that memory-related resource limits are high enough.
    -    On most systems, "ulimit -a" will show the current resource limits.
    -
    -
    -Q:  How do I create files that can be decompressed with XZ Embedded?
    -
    -A:  See the documentation in XZ Embedded. In short, something like
    -    this is a good start:
    -
    -        xz --check=crc32 --lzma2=preset=6e,dict=64KiB
    -
    -    Or if a BCJ filter is needed too, e.g. if compressing
    -    a kernel image for PowerPC:
    -
    -        xz --check=crc32 --powerpc --lzma2=preset=6e,dict=64KiB
    -
    -    Adjust the dictionary size to get a good compromise between
    -    compression ratio and decompressor memory usage. Note that
    -    in single-call decompression mode of XZ Embedded, a big
    -    dictionary doesn't increase memory usage.
    -
    -
    -Q:  Will xz support threaded compression?
    -
    -A:  It is planned and has been taken into account when designing
    -    the .xz file format. Eventually there will probably be three types
    -    of threading, each method having its own advantages and disadvantages.
    -
    -    The simplest method is splitting the uncompressed data into blocks
    -    and compressing them in parallel independent from each other.
    -    Since the blocks are compressed independently, they can also be
    -    decompressed independently. Together with the index feature in .xz,
    -    this allows using threads to create .xz files for random-access
    -    reading. This also makes threaded decompression possible, although
    -    it is not clear if threaded decompression will ever be implemented.
    -
    -    The independent blocks method has a couple of disadvantages too. It
    -    will compress worse than a single-block method. Often the difference
    -    is not too big (maybe 1-2 %) but sometimes it can be too big. Also,
    -    the memory usage of the compressor increases linearly when adding
    -    threads.
    -
    -    Match finder parallelization is another threading method. It has
    -    been in 7-Zip for ages. It doesn't affect compression ratio or
    -    memory usage significantly. Among the three threading methods, only
    -    this is useful when compressing small files (files that are not
    -    significantly bigger than the dictionary). Unfortunately this method
    -    scales only to about two CPU cores.
    -
    -    The third method is pigz-style threading (I use that name, because
    -    pigz  uses that method). It doesn't
    -    affect compression ratio significantly and scales to many cores.
    -    The memory usage scales linearly when threads are added. This isn't
    -    significant with pigz, because Deflate uses only a 32 KiB dictionary,
    -    but with LZMA2 the memory usage will increase dramatically just like
    -    with the independent-blocks method. There is also a constant
    -    computational overhead, which may make pigz-method a bit dull on
    -    dual-core compared to the parallel match finder method, but with more
    -    cores the overhead is not a big deal anymore.
    -
    -    Combining the threading methods will be possible and also useful.
    -    E.g. combining match finder parallelization with pigz-style threading
    -    can cut the memory usage by 50 %.
    -
    -    It is possible that the single-threaded method will be modified to
    -    create files identical to the pigz-style method. We'll see once
    -    pigz-style threading has been implemented in liblzma.
    -
    -
    -Q:  How do I build a program that needs liblzmadec (lzmadec.h)?
    -
    -A:  liblzmadec is part of LZMA Utils. XZ Utils has liblzma, but no
    -    liblzmadec. The code using liblzmadec should be ported to use
    -    liblzma instead. If you cannot or don't want to do that, download
    -    LZMA Utils from .
    -
    -
    -Q:  The default build of liblzma is too big. How can I make it smaller?
    -
    -A:  Give --enable-small to the configure script. Use also appropriate
    -    --enable or --disable options to include only those filter encoders
    -    and decoders and integrity checks that you actually need. Use
    -    CFLAGS=-Os (with GCC) or equivalent to tell your compiler to optimize
    -    for size. See INSTALL for information about configure options.
    -
    -    If the result is still too big, take a look at XZ Embedded. It is
    -    a separate project, which provides a limited but significantly
    -    smaller XZ decoder implementation than XZ Utils. You can find it
    -    at .
    -
    diff --git a/external/public-domain/xz/dist/doc/history.txt b/external/public-domain/xz/dist/doc/history.txt
    deleted file mode 100644
    index 8545e2322..000000000
    --- a/external/public-domain/xz/dist/doc/history.txt
    +++ /dev/null
    @@ -1,150 +0,0 @@
    -
    -History of LZMA Utils and XZ Utils
    -==================================
    -
    -Tukaani distribution
    -
    -    In 2005, there was a small group working on the Tukaani distribution,
    -    which was a Slackware fork. One of the project's goals was to fit the
    -    distro on a single 700 MiB ISO-9660 image. Using LZMA instead of gzip
    -    helped a lot. Roughly speaking, one could fit data that took 1000 MiB
    -    in gzipped form into 700 MiB with LZMA. Naturally, the compression
    -    ratio varied across packages, but this was what we got on average.
    -
    -    Slackware packages have traditionally had .tgz as the filename suffix,
    -    which is an abbreviation of .tar.gz. A logical naming for LZMA
    -    compressed packages was .tlz, being an abbreviation of .tar.lzma.
    -
    -    At the end of the year 2007, there was no distribution under the
    -    Tukaani project anymore, but development of LZMA Utils was kept going.
    -    Still, there were .tlz packages around, because at least Vector Linux
    -    (a Slackware based distribution) used LZMA for its packages.
    -
    -    First versions of the modified pkgtools used the LZMA_Alone tool from
    -    Igor Pavlov's LZMA SDK as is. It was fine, because users wouldn't need
    -    to interact with LZMA_Alone directly. But people soon wanted to use
    -    LZMA for other files too, and the interface of LZMA_Alone wasn't
    -    comfortable for those used to gzip and bzip2.
    -
    -
    -First steps of LZMA Utils
    -
    -    The first version of LZMA Utils (4.22.0) included a shell script called
    -    lzmash. It was a wrapper that had a gzip-like command-line interface. It
    -    used the LZMA_Alone tool from LZMA SDK to do all the real work. zgrep,
    -    zdiff, and related scripts from gzip were adapted to work with LZMA and
    -    were part of the first LZMA Utils release too.
    -
    -    LZMA Utils 4.22.0 included also lzmadec, which was a small (less than
    -    10 KiB) decoder-only command-line tool. It was written on top of the
    -    decoder-only C code found from the LZMA SDK. lzmadec was convenient in
    -    situations where LZMA_Alone (a few hundred KiB) would be too big.
    -
    -    lzmash and lzmadec were written by Lasse Collin.
    -
    -
    -Second generation
    -
    -    The lzmash script was an ugly and not very secure hack. The last
    -    version of LZMA Utils to use lzmash was 4.27.1.
    -
    -    LZMA Utils 4.32.0beta1 introduced a new lzma command-line tool written
    -    by Ville Koskinen. It was written in C++, and used the encoder and
    -    decoder from C++ LZMA SDK with some little modifications. This tool
    -    replaced both the lzmash script and the LZMA_Alone command-line tool
    -    in LZMA Utils.
    -
    -    Introducing this new tool caused some temporary incompatibilities,
    -    because the LZMA_Alone executable was simply named lzma like the new
    -    command-line tool, but they had a completely different command-line
    -    interface. The file format was still the same.
    -
    -    Lasse wrote liblzmadec, which was a small decoder-only library based
    -    on the C code found from LZMA SDK. liblzmadec had an API similar to
    -    zlib, although there were some significant differences, which made it
    -    non-trivial to use it in some applications designed for zlib and
    -    libbzip2.
    -
    -    The lzmadec command-line tool was converted to use liblzmadec.
    -
    -    Alexandre Sauvé helped converting the build system to use GNU
    -    Autotools. This made it easier to test for certain less portable
    -    features needed by the new command-line tool.
    -
    -    Since the new command-line tool never got completely finished (for
    -    example, it didn't support the LZMA_OPT environment variable), the
    -    intent was to not call 4.32.x stable. Similarly, liblzmadec wasn't
    -    polished, but appeared to work well enough, so some people started
    -    using it too.
    -
    -    Because the development of the third generation of LZMA Utils was
    -    delayed considerably (3-4 years), the 4.32.x branch had to be kept
    -    maintained. It got some bug fixes now and then, and finally it was
    -    decided to call it stable, although most of the missing features were
    -    never added.
    -
    -
    -File format problems
    -
    -    The file format used by LZMA_Alone was primitive. It was designed with
    -    embedded systems in mind, and thus provided only a minimal set of
    -    features. The two biggest problems for non-embedded use were the lack
    -    of magic bytes and an integrity check.
    -
    -    Igor and Lasse started developing a new file format with some help
    -    from Ville Koskinen. Also Mark Adler, Mikko Pouru, H. Peter Anvin,
    -    and Lars Wirzenius helped with some minor things at some point of the
    -    development. Designing the new format took quite a long time (actually,
    -    too long a time would be a more appropriate expression). It was mostly
    -    because Lasse was quite slow at getting things done due to personal
    -    reasons.
    -
    -    Originally the new format was supposed to use the same .lzma suffix
    -    that was already used by the old file format. Switching to the new
    -    format wouldn't have caused much trouble when the old format wasn't
    -    used by many people. But since the development of the new format took
    -    such a long time, the old format got quite popular, and it was decided
    -    that the new file format must use a different suffix.
    -
    -    It was decided to use .xz as the suffix of the new file format. The
    -    first stable .xz file format specification was finally released in
    -    December 2008. In addition to fixing the most obvious problems of
    -    the old .lzma format, the .xz format added some new features like
    -    support for multiple filters (compression algorithms), filter chaining
    -    (like piping on the command line), and limited random-access reading.
    -
    -    Currently the primary compression algorithm used in .xz is LZMA2.
    -    It is an extension on top of the original LZMA to fix some practical
    -    problems: LZMA2 adds support for flushing the encoder, uncompressed
    -    chunks, eases stateful decoder implementations, and improves support
    -    for multithreading. Since LZMA2 is better than the original LZMA, the
    -    original LZMA is not supported in .xz.
    -
    -
    -Transition to XZ Utils
    -
    -    The early versions of XZ Utils were called LZMA Utils. The first
    -    releases were 4.42.0alphas. They dropped the rest of the C++ LZMA SDK.
    -    The code was still directly based on LZMA SDK but ported to C and
    -    converted from a callback API to a stateful API. Later, Igor Pavlov
    -    made a C version of the LZMA encoder too; these ports from C++ to C
    -    were independent in LZMA SDK and LZMA Utils.
    -
    -    The core of the new LZMA Utils was liblzma, a compression library with
    -    a zlib-like API. liblzma supported both the old and new file format.
    -    The gzip-like lzma command-line tool was rewritten to use liblzma.
    -
    -    The new LZMA Utils code base was renamed to XZ Utils when the name
    -    of the new file format had been decided. The liblzma compression
    -    library retained its name though, because changing it would have
    -    caused unnecessary breakage in applications already using the early
    -    liblzma snapshots.
    -
    -    The xz command-line tool can emulate the gzip-like lzma tool by
    -    creating appropriate symlinks (e.g. lzma -> xz). Thus, practically
    -    all scripts using the lzma tool from LZMA Utils will work as is with
    -    XZ Utils (and will keep using the old .lzma format). Still, the .lzma
    -    format is more or less deprecated. XZ Utils will keep supporting it,
    -    but new applications should use the .xz format, and migrating old
    -    applications to .xz is often a good idea too.
    -
    diff --git a/external/public-domain/xz/dist/doc/lzma-file-format.txt b/external/public-domain/xz/dist/doc/lzma-file-format.txt
    deleted file mode 100644
    index 015b0fae6..000000000
    --- a/external/public-domain/xz/dist/doc/lzma-file-format.txt
    +++ /dev/null
    @@ -1,166 +0,0 @@
    -
    -The .lzma File Format
    -=====================
    -
    -        0. Preface
    -           0.1. Notices and Acknowledgements
    -           0.2. Changes
    -        1. File Format
    -           1.1. Header
    -                1.1.1. Properties
    -                1.1.2. Dictionary Size
    -                1.1.3. Uncompressed Size
    -           1.2. LZMA Compressed Data
    -        2. References
    -
    -
    -0. Preface
    -
    -        This document describes the .lzma file format, which is
    -        sometimes also called LZMA_Alone format. It is a legacy file
    -        format, which is being or has been replaced by the .xz format.
    -        The MIME type of the .lzma format is `application/x-lzma'.
    -
    -        The most commonly used software to handle .lzma files are
    -        LZMA SDK, LZMA Utils, 7-Zip, and XZ Utils. This document
    -        describes some of the differences between these implementations
    -        and gives hints what subset of the .lzma format is the most
    -        portable.
    -
    -
    -0.1. Notices and Acknowledgements
    -
    -        This file format was designed by Igor Pavlov for use in
    -        LZMA SDK. This document was written by Lasse Collin
    -         using the documentation found
    -        from the LZMA SDK.
    -
    -        This document has been put into the public domain.
    -
    -
    -0.2. Changes
    -
    -        Last modified: 2011-04-12 11:55+0300
    -
    -
    -1. File Format
    -
    -        +-+-+-+-+-+-+-+-+-+-+-+-+-+==========================+
    -        |         Header          |   LZMA Compressed Data   |
    -        +-+-+-+-+-+-+-+-+-+-+-+-+-+==========================+
    -
    -        The .lzma format file consist of 13-byte Header followed by
    -        the LZMA Compressed Data.
    -
    -        Unlike the .gz, .bz2, and .xz formats, it is not possible to
    -        concatenate multiple .lzma files as is and expect the
    -        decompression tool to decode the resulting file as if it were
    -        a single .lzma file.
    -
    -        For example, the command line tools from LZMA Utils and
    -        LZMA SDK silently ignore all the data after the first .lzma
    -        stream. In contrast, the command line tool from XZ Utils
    -        considers the .lzma file to be corrupt if there is data after
    -        the first .lzma stream.
    -
    -
    -1.1. Header
    -
    -        +------------+----+----+----+----+--+--+--+--+--+--+--+--+
    -        | Properties |  Dictionary Size  |   Uncompressed Size   |
    -        +------------+----+----+----+----+--+--+--+--+--+--+--+--+
    -
    -
    -1.1.1. Properties
    -
    -        The Properties field contains three properties. An abbreviation
    -        is given in parentheses, followed by the value range of the
    -        property. The field consists of
    -
    -            1) the number of literal context bits (lc, [0, 8]);
    -            2) the number of literal position bits (lp, [0, 4]); and
    -            3) the number of position bits (pb, [0, 4]).
    -
    -        The properties are encoded using the following formula:
    -
    -            Properties = (pb * 5 + lp) * 9 + lc
    -
    -        The following C code illustrates a straightforward way to
    -        decode the Properties field:
    -
    -            uint8_t lc, lp, pb;
    -            uint8_t prop = get_lzma_properties();
    -            if (prop > (4 * 5 + 4) * 9 + 8)
    -                return LZMA_PROPERTIES_ERROR;
    -
    -            pb = prop / (9 * 5);
    -            prop -= pb * 9 * 5;
    -            lp = prop / 9;
    -            lc = prop - lp * 9;
    -
    -        XZ Utils has an additional requirement: lc + lp <= 4. Files
    -        which don't follow this requirement cannot be decompressed
    -        with XZ Utils. Usually this isn't a problem since the most
    -        common lc/lp/pb values are 3/0/2. It is the only lc/lp/pb
    -        combination that the files created by LZMA Utils can have,
    -        but LZMA Utils can decompress files with any lc/lp/pb.
    -
    -
    -1.1.2. Dictionary Size
    -
    -        Dictionary Size is stored as an unsigned 32-bit little endian
    -        integer. Any 32-bit value is possible, but for maximum
    -        portability, only sizes of 2^n and 2^n + 2^(n-1) should be
    -        used.
    -
    -        LZMA Utils creates only files with dictionary size 2^n,
    -        16 <= n <= 25. LZMA Utils can decompress files with any
    -        dictionary size.
    -
    -        XZ Utils creates and decompresses .lzma files only with
    -        dictionary sizes 2^n and 2^n + 2^(n-1). If some other
    -        dictionary size is specified when compressing, the value
    -        stored in the Dictionary Size field is a rounded up, but the
    -        specified value is still used in the actual compression code.
    -
    -
    -1.1.3. Uncompressed Size
    -
    -        Uncompressed Size is stored as unsigned 64-bit little endian
    -        integer. A special value of 0xFFFF_FFFF_FFFF_FFFF indicates
    -        that Uncompressed Size is unknown. End of Payload Marker (*)
    -        is used if and only if Uncompressed Size is unknown.
    -
    -        XZ Utils rejects files whose Uncompressed Size field specifies
    -        a known size that is 256 GiB or more. This is to reject false
    -        positives when trying to guess if the input file is in the
    -        .lzma format. When Uncompressed Size is unknown, there is no
    -        limit for the uncompressed size of the file.
    -
    -        (*) Some tools use the term End of Stream (EOS) marker
    -            instead of End of Payload Marker.
    -
    -
    -1.2. LZMA Compressed Data
    -
    -        Detailed description of the format of this field is out of
    -        scope of this document.
    -
    -
    -2. References
    -
    -        LZMA SDK - The original LZMA implementation
    -        http://7-zip.org/sdk.html
    -
    -        7-Zip
    -        http://7-zip.org/
    -
    -        LZMA Utils - LZMA adapted to POSIX-like systems
    -        http://tukaani.org/lzma/
    -
    -        XZ Utils - The next generation of LZMA Utils
    -        http://tukaani.org/xz/
    -
    -        The .xz file format - The successor of the .lzma format
    -        http://tukaani.org/xz/xz-file-format.txt
    -
    diff --git a/external/public-domain/xz/dist/doc/xz-file-format.txt b/external/public-domain/xz/dist/doc/xz-file-format.txt
    deleted file mode 100644
    index 4ed665060..000000000
    --- a/external/public-domain/xz/dist/doc/xz-file-format.txt
    +++ /dev/null
    @@ -1,1150 +0,0 @@
    -
    -The .xz File Format
    -===================
    -
    -Version 1.0.4 (2009-08-27)
    -
    -
    -        0. Preface
    -           0.1. Notices and Acknowledgements
    -           0.2. Getting the Latest Version
    -           0.3. Version History
    -        1. Conventions
    -           1.1. Byte and Its Representation
    -           1.2. Multibyte Integers
    -        2. Overall Structure of .xz File
    -           2.1. Stream
    -                2.1.1. Stream Header
    -                       2.1.1.1. Header Magic Bytes
    -                       2.1.1.2. Stream Flags
    -                       2.1.1.3. CRC32
    -                2.1.2. Stream Footer
    -                       2.1.2.1. CRC32
    -                       2.1.2.2. Backward Size
    -                       2.1.2.3. Stream Flags
    -                       2.1.2.4. Footer Magic Bytes
    -           2.2. Stream Padding
    -        3. Block
    -           3.1. Block Header
    -                3.1.1. Block Header Size
    -                3.1.2. Block Flags
    -                3.1.3. Compressed Size
    -                3.1.4. Uncompressed Size
    -                3.1.5. List of Filter Flags
    -                3.1.6. Header Padding
    -                3.1.7. CRC32
    -           3.2. Compressed Data
    -           3.3. Block Padding
    -           3.4. Check
    -        4. Index
    -           4.1. Index Indicator
    -           4.2. Number of Records
    -           4.3. List of Records
    -                4.3.1. Unpadded Size
    -                4.3.2. Uncompressed Size
    -           4.4. Index Padding
    -           4.5. CRC32
    -        5. Filter Chains
    -           5.1. Alignment
    -           5.2. Security
    -           5.3. Filters
    -                5.3.1. LZMA2
    -                5.3.2. Branch/Call/Jump Filters for Executables
    -                5.3.3. Delta
    -                       5.3.3.1. Format of the Encoded Output
    -           5.4. Custom Filter IDs
    -                5.4.1. Reserved Custom Filter ID Ranges
    -        6. Cyclic Redundancy Checks
    -        7. References
    -
    -
    -0. Preface
    -
    -        This document describes the .xz file format (filename suffix
    -        ".xz", MIME type "application/x-xz"). It is intended that this
    -        this format replace the old .lzma format used by LZMA SDK and
    -        LZMA Utils.
    -
    -
    -0.1. Notices and Acknowledgements
    -
    -        This file format was designed by Lasse Collin
    -         and Igor Pavlov.
    -
    -        Special thanks for helping with this document goes to
    -        Ville Koskinen. Thanks for helping with this document goes to
    -        Mark Adler, H. Peter Anvin, Mikko Pouru, and Lars Wirzenius.
    -
    -        This document has been put into the public domain.
    -
    -
    -0.2. Getting the Latest Version
    -
    -        The latest official version of this document can be downloaded
    -        from .
    -
    -        Specific versions of this document have a filename
    -        xz-file-format-X.Y.Z.txt where X.Y.Z is the version number.
    -        For example, the version 1.0.0 of this document is available
    -        at .
    -
    -
    -0.3. Version History
    -
    -        Version   Date          Description
    -
    -        1.0.4     2009-08-27    Language improvements in Sections 1.2,
    -                                2.1.1.2, 3.1.1, 3.1.2, and 5.3.1
    -
    -        1.0.3     2009-06-05    Spelling fixes in Sections 5.1 and 5.4
    -
    -        1.0.2     2009-06-04    Typo fixes in Sections 4 and 5.3.1
    -
    -        1.0.1     2009-06-01    Typo fix in Section 0.3 and minor
    -                                clarifications to Sections 2, 2.2,
    -                                3.3, 4.4, and 5.3.2
    -
    -        1.0.0     2009-01-14    The first official version
    -
    -
    -1. Conventions
    -
    -        The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD",
    -        "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
    -        document are to be interpreted as described in [RFC-2119].
    -
    -        Indicating a warning means displaying a message, returning
    -        appropriate exit status, or doing something else to let the
    -        user know that something worth warning occurred. The operation
    -        SHOULD still finish if a warning is indicated.
    -
    -        Indicating an error means displaying a message, returning
    -        appropriate exit status, or doing something else to let the
    -        user know that something prevented successfully finishing the
    -        operation. The operation MUST be aborted once an error has
    -        been indicated.
    -
    -
    -1.1. Byte and Its Representation
    -
    -        In this document, byte is always 8 bits.
    -
    -        A "null byte" has all bits unset. That is, the value of a null
    -        byte is 0x00.
    -
    -        To represent byte blocks, this document uses notation that
    -        is similar to the notation used in [RFC-1952]:
    -
    -            +-------+
    -            |  Foo  |   One byte.
    -            +-------+
    -
    -            +---+---+
    -            |  Foo  |   Two bytes; that is, some of the vertical bars
    -            +---+---+   can be missing.
    -
    -            +=======+
    -            |  Foo  |   Zero or more bytes.
    -            +=======+
    -
    -        In this document, a boxed byte or a byte sequence declared
    -        using this notation is called "a field". The example field
    -        above would be called "the Foo field" or plain "Foo".
    -
    -        If there are many fields, they may be split to multiple lines.
    -        This is indicated with an arrow ("--->"):
    -
    -            +=====+
    -            | Foo |
    -            +=====+
    -
    -                 +=====+
    -            ---> | Bar |
    -                 +=====+
    -
    -        The above is equivalent to this:
    -
    -            +=====+=====+
    -            | Foo | Bar |
    -            +=====+=====+
    -
    -
    -1.2. Multibyte Integers
    -
    -        Multibyte integers of static length, such as CRC values,
    -        are stored in little endian byte order (least significant
    -        byte first).
    -
    -        When smaller values are more likely than bigger values (for
    -        example file sizes), multibyte integers are encoded in a
    -        variable-length representation:
    -          - Numbers in the range [0, 127] are copied as is, and take
    -            one byte of space.
    -          - Bigger numbers will occupy two or more bytes. All but the
    -            last byte of the multibyte representation have the highest
    -            (eighth) bit set.
    -
    -        For now, the value of the variable-length integers is limited
    -        to 63 bits, which limits the encoded size of the integer to
    -        nine bytes. These limits may be increased in the future if
    -        needed.
    -
    -        The following C code illustrates encoding and decoding of
    -        variable-length integers. The functions return the number of
    -        bytes occupied by the integer (1-9), or zero on error.
    -
    -            #include 
    -            #include 
    -
    -            size_t
    -            encode(uint8_t buf[static 9], uint64_t num)
    -            {
    -                if (num > UINT64_MAX / 2)
    -                    return 0;
    -
    -                size_t i = 0;
    -
    -                while (num >= 0x80) {
    -                    buf[i++] = (uint8_t)(num) | 0x80;
    -                    num >>= 7;
    -                }
    -
    -                buf[i++] = (uint8_t)(num);
    -
    -                return i;
    -            }
    -
    -            size_t
    -            decode(const uint8_t buf[], size_t size_max, uint64_t *num)
    -            {
    -                if (size_max == 0)
    -                    return 0;
    -
    -                if (size_max > 9)
    -                    size_max = 9;
    -
    -                *num = buf[0] & 0x7F;
    -                size_t i = 0;
    -
    -                while (buf[i++] & 0x80) {
    -                    if (i >= size_max || buf[i] == 0x00)
    -                        return 0;
    -
    -                    *num |= (uint64_t)(buf[i] & 0x7F) << (i * 7);
    -                }
    -
    -                return i;
    -            }
    -
    -
    -2. Overall Structure of .xz File
    -
    -        A standalone .xz files consist of one or more Streams which may
    -        have Stream Padding between or after them:
    -
    -            +========+================+========+================+
    -            | Stream | Stream Padding | Stream | Stream Padding | ...
    -            +========+================+========+================+
    -
    -        The sizes of Stream and Stream Padding are always multiples
    -        of four bytes, thus the size of every valid .xz file MUST be
    -        a multiple of four bytes.
    -
    -        While a typical file contains only one Stream and no Stream
    -        Padding, a decoder handling standalone .xz files SHOULD support
    -        files that have more than one Stream or Stream Padding.
    -
    -        In contrast to standalone .xz files, when the .xz file format
    -        is used as an internal part of some other file format or
    -        communication protocol, it usually is expected that the decoder
    -        stops after the first Stream, and doesn't look for Stream
    -        Padding or possibly other Streams.
    -
    -
    -2.1. Stream
    -
    -        +-+-+-+-+-+-+-+-+-+-+-+-+=======+=======+     +=======+
    -        |     Stream Header     | Block | Block | ... | Block |
    -        +-+-+-+-+-+-+-+-+-+-+-+-+=======+=======+     +=======+
    -
    -             +=======+-+-+-+-+-+-+-+-+-+-+-+-+
    -        ---> | Index |     Stream Footer     |
    -             +=======+-+-+-+-+-+-+-+-+-+-+-+-+
    -
    -        All the above fields have a size that is a multiple of four. If
    -        Stream is used as an internal part of another file format, it
    -        is RECOMMENDED to make the Stream start at an offset that is
    -        a multiple of four bytes.
    -
    -        Stream Header, Index, and Stream Footer are always present in
    -        a Stream. The maximum size of the Index field is 16 GiB (2^34).
    -
    -        There are zero or more Blocks. The maximum number of Blocks is
    -        limited only by the maximum size of the Index field.
    -
    -        Total size of a Stream MUST be less than 8 EiB (2^63 bytes).
    -        The same limit applies to the total amount of uncompressed
    -        data stored in a Stream.
    -
    -        If an implementation supports handling .xz files with multiple
    -        concatenated Streams, it MAY apply the above limits to the file
    -        as a whole instead of limiting per Stream basis.
    -
    -
    -2.1.1. Stream Header
    -
    -        +---+---+---+---+---+---+-------+------+--+--+--+--+
    -        |  Header Magic Bytes   | Stream Flags |   CRC32   |
    -        +---+---+---+---+---+---+-------+------+--+--+--+--+
    -
    -
    -2.1.1.1. Header Magic Bytes
    -
    -        The first six (6) bytes of the Stream are so called Header
    -        Magic Bytes. They can be used to identify the file type.
    -
    -            Using a C array and ASCII:
    -            const uint8_t HEADER_MAGIC[6]
    -                    = { 0xFD, '7', 'z', 'X', 'Z', 0x00 };
    -
    -            In plain hexadecimal:
    -            FD 37 7A 58 5A 00
    -
    -        Notes:
    -          - The first byte (0xFD) was chosen so that the files cannot
    -            be erroneously detected as being in .lzma format, in which
    -            the first byte is in the range [0x00, 0xE0].
    -          - The sixth byte (0x00) was chosen to prevent applications
    -            from misdetecting the file as a text file.
    -
    -        If the Header Magic Bytes don't match, the decoder MUST
    -        indicate an error.
    -
    -
    -2.1.1.2. Stream Flags
    -
    -        The first byte of Stream Flags is always a null byte. In the
    -        future, this byte may be used to indicate a new Stream version
    -        or other Stream properties.
    -
    -        The second byte of Stream Flags is a bit field:
    -
    -            Bit(s)  Mask  Description
    -             0-3    0x0F  Type of Check (see Section 3.4):
    -                              ID    Size      Check name
    -                              0x00   0 bytes  None
    -                              0x01   4 bytes  CRC32
    -                              0x02   4 bytes  (Reserved)
    -                              0x03   4 bytes  (Reserved)
    -                              0x04   8 bytes  CRC64
    -                              0x05   8 bytes  (Reserved)
    -                              0x06   8 bytes  (Reserved)
    -                              0x07  16 bytes  (Reserved)
    -                              0x08  16 bytes  (Reserved)
    -                              0x09  16 bytes  (Reserved)
    -                              0x0A  32 bytes  SHA-256
    -                              0x0B  32 bytes  (Reserved)
    -                              0x0C  32 bytes  (Reserved)
    -                              0x0D  64 bytes  (Reserved)
    -                              0x0E  64 bytes  (Reserved)
    -                              0x0F  64 bytes  (Reserved)
    -             4-7    0xF0  Reserved for future use; MUST be zero for now.
    -
    -        Implementations SHOULD support at least the Check IDs 0x00
    -        (None) and 0x01 (CRC32). Supporting other Check IDs is
    -        OPTIONAL. If an unsupported Check is used, the decoder SHOULD
    -        indicate a warning or error.
    -
    -        If any reserved bit is set, the decoder MUST indicate an error.
    -        It is possible that there is a new field present which the
    -        decoder is not aware of, and can thus parse the Stream Header
    -        incorrectly.
    -
    -
    -2.1.1.3. CRC32
    -
    -        The CRC32 is calculated from the Stream Flags field. It is
    -        stored as an unsigned 32-bit little endian integer. If the
    -        calculated value does not match the stored one, the decoder
    -        MUST indicate an error.
    -
    -        The idea is that Stream Flags would always be two bytes, even
    -        if new features are needed. This way old decoders will be able
    -        to verify the CRC32 calculated from Stream Flags, and thus
    -        distinguish between corrupt files (CRC32 doesn't match) and
    -        files that the decoder doesn't support (CRC32 matches but
    -        Stream Flags has reserved bits set).
    -
    -
    -2.1.2. Stream Footer
    -
    -        +-+-+-+-+---+---+---+---+-------+------+----------+---------+
    -        | CRC32 | Backward Size | Stream Flags | Footer Magic Bytes |
    -        +-+-+-+-+---+---+---+---+-------+------+----------+---------+
    -
    -
    -2.1.2.1. CRC32
    -
    -        The CRC32 is calculated from the Backward Size and Stream Flags
    -        fields. It is stored as an unsigned 32-bit little endian
    -        integer. If the calculated value does not match the stored one,
    -        the decoder MUST indicate an error.
    -
    -        The reason to have the CRC32 field before the Backward Size and
    -        Stream Flags fields is to keep the four-byte fields aligned to
    -        a multiple of four bytes.
    -
    -
    -2.1.2.2. Backward Size
    -
    -        Backward Size is stored as a 32-bit little endian integer,
    -        which indicates the size of the Index field as multiple of
    -        four bytes, minimum value being four bytes:
    -
    -            real_backward_size = (stored_backward_size + 1) * 4;
    -
    -        If the stored value does not match the real size of the Index
    -        field, the decoder MUST indicate an error.
    -
    -        Using a fixed-size integer to store Backward Size makes
    -        it slightly simpler to parse the Stream Footer when the
    -        application needs to parse the Stream backwards.
    -
    -
    -2.1.2.3. Stream Flags
    -
    -        This is a copy of the Stream Flags field from the Stream
    -        Header. The information stored to Stream Flags is needed
    -        when parsing the Stream backwards. The decoder MUST compare
    -        the Stream Flags fields in both Stream Header and Stream
    -        Footer, and indicate an error if they are not identical.
    -
    -
    -2.1.2.4. Footer Magic Bytes
    -
    -        As the last step of the decoding process, the decoder MUST
    -        verify the existence of Footer Magic Bytes. If they don't
    -        match, an error MUST be indicated.
    -
    -            Using a C array and ASCII:
    -            const uint8_t FOOTER_MAGIC[2] = { 'Y', 'Z' };
    -
    -            In hexadecimal:
    -            59 5A
    -
    -        The primary reason to have Footer Magic Bytes is to make
    -        it easier to detect incomplete files quickly, without
    -        uncompressing. If the file does not end with Footer Magic Bytes
    -        (excluding Stream Padding described in Section 2.2), it cannot
    -        be undamaged, unless someone has intentionally appended garbage
    -        after the end of the Stream.
    -
    -
    -2.2. Stream Padding
    -
    -        Only the decoders that support decoding of concatenated Streams
    -        MUST support Stream Padding.
    -
    -        Stream Padding MUST contain only null bytes. To preserve the
    -        four-byte alignment of consecutive Streams, the size of Stream
    -        Padding MUST be a multiple of four bytes. Empty Stream Padding
    -        is allowed. If these requirements are not met, the decoder MUST
    -        indicate an error.
    -
    -        Note that non-empty Stream Padding is allowed at the end of the
    -        file; there doesn't need to be a new Stream after non-empty
    -        Stream Padding. This can be convenient in certain situations
    -        [GNU-tar].
    -
    -        The possibility of Stream Padding MUST be taken into account
    -        when designing an application that parses Streams backwards,
    -        and the application supports concatenated Streams.
    -
    -
    -3. Block
    -
    -        +==============+=================+===============+=======+
    -        | Block Header | Compressed Data | Block Padding | Check |
    -        +==============+=================+===============+=======+
    -
    -
    -3.1. Block Header
    -
    -        +-------------------+-------------+=================+
    -        | Block Header Size | Block Flags | Compressed Size |
    -        +-------------------+-------------+=================+
    -
    -             +===================+======================+
    -        ---> | Uncompressed Size | List of Filter Flags |
    -             +===================+======================+
    -
    -             +================+--+--+--+--+
    -        ---> | Header Padding |   CRC32   |
    -             +================+--+--+--+--+
    -
    -
    -3.1.1. Block Header Size
    -
    -        This field overlaps with the Index Indicator field (see
    -        Section 4.1).
    -
    -        This field contains the size of the Block Header field,
    -        including the Block Header Size field itself. Valid values are
    -        in the range [0x01, 0xFF], which indicate the size of the Block
    -        Header as multiples of four bytes, minimum size being eight
    -        bytes:
    -
    -            real_header_size = (encoded_header_size + 1) * 4;
    -
    -        If a Block Header bigger than 1024 bytes is needed in the
    -        future, a new field can be added between the Block Header and
    -        Compressed Data fields. The presence of this new field would
    -        be indicated in the Block Header field.
    -
    -
    -3.1.2. Block Flags
    -
    -        The Block Flags field is a bit field:
    -
    -            Bit(s)  Mask  Description
    -             0-1    0x03  Number of filters (1-4)
    -             2-5    0x3C  Reserved for future use; MUST be zero for now.
    -              6     0x40  The Compressed Size field is present.
    -              7     0x80  The Uncompressed Size field is present.
    -
    -        If any reserved bit is set, the decoder MUST indicate an error.
    -        It is possible that there is a new field present which the
    -        decoder is not aware of, and can thus parse the Block Header
    -        incorrectly.
    -
    -
    -3.1.3. Compressed Size
    -
    -        This field is present only if the appropriate bit is set in
    -        the Block Flags field (see Section 3.1.2).
    -
    -        The Compressed Size field contains the size of the Compressed
    -        Data field, which MUST be non-zero. Compressed Size is stored
    -        using the encoding described in Section 1.2. If the Compressed
    -        Size doesn't match the size of the Compressed Data field, the
    -        decoder MUST indicate an error.
    -
    -
    -3.1.4. Uncompressed Size
    -
    -        This field is present only if the appropriate bit is set in
    -        the Block Flags field (see Section 3.1.2).
    -
    -        The Uncompressed Size field contains the size of the Block
    -        after uncompressing. Uncompressed Size is stored using the
    -        encoding described in Section 1.2. If the Uncompressed Size
    -        does not match the real uncompressed size, the decoder MUST
    -        indicate an error.
    -
    -        Storing the Compressed Size and Uncompressed Size fields serves
    -        several purposes:
    -          - The decoder knows how much memory it needs to allocate
    -            for a temporary buffer in multithreaded mode.
    -          - Simple error detection: wrong size indicates a broken file.
    -          - Seeking forwards to a specific location in streamed mode.
    -
    -        It should be noted that the only reliable way to determine
    -        the real uncompressed size is to uncompress the Block,
    -        because the Block Header and Index fields may contain
    -        (intentionally or unintentionally) invalid information.
    -
    -
    -3.1.5. List of Filter Flags
    -
    -        +================+================+     +================+
    -        | Filter 0 Flags | Filter 1 Flags | ... | Filter n Flags |
    -        +================+================+     +================+
    -
    -        The number of Filter Flags fields is stored in the Block Flags
    -        field (see Section 3.1.2).
    -
    -        The format of each Filter Flags field is as follows:
    -
    -            +===========+====================+===================+
    -            | Filter ID | Size of Properties | Filter Properties |
    -            +===========+====================+===================+
    -
    -        Both Filter ID and Size of Properties are stored using the
    -        encoding described in Section 1.2. Size of Properties indicates
    -        the size of the Filter Properties field as bytes. The list of
    -        officially defined Filter IDs and the formats of their Filter
    -        Properties are described in Section 5.3.
    -
    -        Filter IDs greater than or equal to 0x4000_0000_0000_0000
    -        (2^62) are reserved for implementation-specific internal use.
    -        These Filter IDs MUST never be used in List of Filter Flags.
    -
    -
    -3.1.6. Header Padding
    -
    -        This field contains as many null byte as it is needed to make
    -        the Block Header have the size specified in Block Header Size.
    -        If any of the bytes are not null bytes, the decoder MUST
    -        indicate an error. It is possible that there is a new field
    -        present which the decoder is not aware of, and can thus parse
    -        the Block Header incorrectly.
    -
    -
    -3.1.7. CRC32
    -
    -        The CRC32 is calculated over everything in the Block Header
    -        field except the CRC32 field itself. It is stored as an
    -        unsigned 32-bit little endian integer. If the calculated
    -        value does not match the stored one, the decoder MUST indicate
    -        an error.
    -
    -        By verifying the CRC32 of the Block Header before parsing the
    -        actual contents allows the decoder to distinguish between
    -        corrupt and unsupported files.
    -
    -
    -3.2. Compressed Data
    -
    -        The format of Compressed Data depends on Block Flags and List
    -        of Filter Flags. Excluding the descriptions of the simplest
    -        filters in Section 5.3, the format of the filter-specific
    -        encoded data is out of scope of this document.
    -
    -
    -3.3. Block Padding
    -
    -        Block Padding MUST contain 0-3 null bytes to make the size of
    -        the Block a multiple of four bytes. This can be needed when
    -        the size of Compressed Data is not a multiple of four. If any
    -        of the bytes in Block Padding are not null bytes, the decoder
    -        MUST indicate an error.
    -
    -
    -3.4. Check
    -
    -        The type and size of the Check field depends on which bits
    -        are set in the Stream Flags field (see Section 2.1.1.2).
    -
    -        The Check, when used, is calculated from the original
    -        uncompressed data. If the calculated Check does not match the
    -        stored one, the decoder MUST indicate an error. If the selected
    -        type of Check is not supported by the decoder, it SHOULD
    -        indicate a warning or error.
    -
    -
    -4. Index
    -
    -        +-----------------+===================+
    -        | Index Indicator | Number of Records |
    -        +-----------------+===================+
    -
    -             +=================+===============+-+-+-+-+
    -        ---> | List of Records | Index Padding | CRC32 |
    -             +=================+===============+-+-+-+-+
    -
    -        Index serves several purposes. Using it, one can
    -          - verify that all Blocks in a Stream have been processed;
    -          - find out the uncompressed size of a Stream; and
    -          - quickly access the beginning of any Block (random access).
    -
    -
    -4.1. Index Indicator
    -
    -        This field overlaps with the Block Header Size field (see
    -        Section 3.1.1). The value of Index Indicator is always 0x00.
    -
    -
    -4.2. Number of Records
    -
    -        This field indicates how many Records there are in the List
    -        of Records field, and thus how many Blocks there are in the
    -        Stream. The value is stored using the encoding described in
    -        Section 1.2. If the decoder has decoded all the Blocks of the
    -        Stream, and then notices that the Number of Records doesn't
    -        match the real number of Blocks, the decoder MUST indicate an
    -        error.
    -
    -
    -4.3. List of Records
    -
    -        List of Records consists of as many Records as indicated by the
    -        Number of Records field:
    -
    -            +========+========+
    -            | Record | Record | ...
    -            +========+========+
    -
    -        Each Record contains information about one Block:
    -
    -            +===============+===================+
    -            | Unpadded Size | Uncompressed Size |
    -            +===============+===================+
    -
    -        If the decoder has decoded all the Blocks of the Stream, it
    -        MUST verify that the contents of the Records match the real
    -        Unpadded Size and Uncompressed Size of the respective Blocks.
    -
    -        Implementation hint: It is possible to verify the Index with
    -        constant memory usage by calculating for example SHA-256 of
    -        both the real size values and the List of Records, then
    -        comparing the hash values. Implementing this using
    -        non-cryptographic hash like CRC32 SHOULD be avoided unless
    -        small code size is important.
    -
    -        If the decoder supports random-access reading, it MUST verify
    -        that Unpadded Size and Uncompressed Size of every completely
    -        decoded Block match the sizes stored in the Index. If only
    -        partial Block is decoded, the decoder MUST verify that the
    -        processed sizes don't exceed the sizes stored in the Index.
    -
    -
    -4.3.1. Unpadded Size
    -
    -        This field indicates the size of the Block excluding the Block
    -        Padding field. That is, Unpadded Size is the size of the Block
    -        Header, Compressed Data, and Check fields. Unpadded Size is
    -        stored using the encoding described in Section 1.2. The value
    -        MUST never be zero; with the current structure of Blocks, the
    -        actual minimum value for Unpadded Size is five.
    -
    -        Implementation note: Because the size of the Block Padding
    -        field is not included in Unpadded Size, calculating the total
    -        size of a Stream or doing random-access reading requires
    -        calculating the actual size of the Blocks by rounding Unpadded
    -        Sizes up to the next multiple of four.
    -
    -        The reason to exclude Block Padding from Unpadded Size is to
    -        ease making a raw copy of Compressed Data without Block
    -        Padding. This can be useful, for example, if someone wants
    -        to convert Streams to some other file format quickly.
    -
    -
    -4.3.2. Uncompressed Size
    -
    -        This field indicates the Uncompressed Size of the respective
    -        Block as bytes. The value is stored using the encoding
    -        described in Section 1.2.
    -
    -
    -4.4. Index Padding
    -
    -        This field MUST contain 0-3 null bytes to pad the Index to
    -        a multiple of four bytes. If any of the bytes are not null
    -        bytes, the decoder MUST indicate an error.
    -
    -
    -4.5. CRC32
    -
    -        The CRC32 is calculated over everything in the Index field
    -        except the CRC32 field itself. The CRC32 is stored as an
    -        unsigned 32-bit little endian integer. If the calculated
    -        value does not match the stored one, the decoder MUST indicate
    -        an error.
    -
    -
    -5. Filter Chains
    -
    -        The Block Flags field defines how many filters are used. When
    -        more than one filter is used, the filters are chained; that is,
    -        the output of one filter is the input of another filter. The
    -        following figure illustrates the direction of data flow.
    -
    -                    v   Uncompressed Data   ^
    -                    |       Filter 0        |
    -            Encoder |       Filter 1        | Decoder
    -                    |       Filter n        |
    -                    v    Compressed Data    ^
    -
    -
    -5.1. Alignment
    -
    -        Alignment of uncompressed input data is usually the job of
    -        the application producing the data. For example, to get the
    -        best results, an archiver tool should make sure that all
    -        PowerPC executable files in the archive stream start at
    -        offsets that are multiples of four bytes.
    -
    -        Some filters, for example LZMA2, can be configured to take
    -        advantage of specified alignment of input data. Note that
    -        taking advantage of aligned input can be beneficial also when
    -        a filter is not the first filter in the chain. For example,
    -        if you compress PowerPC executables, you may want to use the
    -        PowerPC filter and chain that with the LZMA2 filter. Because
    -        not only the input but also the output alignment of the PowerPC
    -        filter is four bytes, it is now beneficial to set LZMA2
    -        settings so that the LZMA2 encoder can take advantage of its
    -        four-byte-aligned input data.
    -
    -        The output of the last filter in the chain is stored to the
    -        Compressed Data field, which is is guaranteed to be aligned
    -        to a multiple of four bytes relative to the beginning of the
    -        Stream. This can increase
    -          - speed, if the filtered data is handled multiple bytes at
    -            a time by the filter-specific encoder and decoder,
    -            because accessing aligned data in computer memory is
    -            usually faster; and
    -          - compression ratio, if the output data is later compressed
    -            with an external compression tool.
    -
    -
    -5.2. Security
    -
    -        If filters would be allowed to be chained freely, it would be
    -        possible to create malicious files, that would be very slow to
    -        decode. Such files could be used to create denial of service
    -        attacks.
    -
    -        Slow files could occur when multiple filters are chained:
    -
    -            v   Compressed input data
    -            |   Filter 1 decoder (last filter)
    -            |   Filter 0 decoder (non-last filter)
    -            v   Uncompressed output data
    -
    -        The decoder of the last filter in the chain produces a lot of
    -        output from little input. Another filter in the chain takes the
    -        output of the last filter, and produces very little output
    -        while consuming a lot of input. As a result, a lot of data is
    -        moved inside the filter chain, but the filter chain as a whole
    -        gets very little work done.
    -
    -        To prevent this kind of slow files, there are restrictions on
    -        how the filters can be chained. These restrictions MUST be
    -        taken into account when designing new filters.
    -
    -        The maximum number of filters in the chain has been limited to
    -        four, thus there can be at maximum of three non-last filters.
    -        Of these three non-last filters, only two are allowed to change
    -        the size of the data.
    -
    -        The non-last filters, that change the size of the data, MUST
    -        have a limit how much the decoder can compress the data: the
    -        decoder SHOULD produce at least n bytes of output when the
    -        filter is given 2n bytes of input. This  limit is not
    -        absolute, but significant deviations MUST be avoided.
    -
    -        The above limitations guarantee that if the last filter in the
    -        chain produces 4n bytes of output, the chain as a whole will
    -        produce at least n bytes of output.
    -
    -
    -5.3. Filters
    -
    -5.3.1. LZMA2
    -
    -        LZMA (Lempel-Ziv-Markov chain-Algorithm) is a general-purpose
    -        compression algorithm with high compression ratio and fast
    -        decompression. LZMA is based on LZ77 and range coding
    -        algorithms.
    -
    -        LZMA2 is an extension on top of the original LZMA. LZMA2 uses
    -        LZMA internally, but adds support for flushing the encoder,
    -        uncompressed chunks, eases stateful decoder implementations,
    -        and improves support for multithreading. Thus, the plain LZMA
    -        will not be supported in this file format.
    -
    -            Filter ID:                  0x21
    -            Size of Filter Properties:  1 byte
    -            Changes size of data:       Yes
    -            Allow as a non-last filter: No
    -            Allow as the last filter:   Yes
    -
    -            Preferred alignment:
    -                Input data:             Adjustable to 1/2/4/8/16 byte(s)
    -                Output data:            1 byte
    -
    -        The format of the one-byte Filter Properties field is as
    -        follows:
    -
    -            Bits   Mask   Description
    -            0-5    0x3F   Dictionary Size
    -            6-7    0xC0   Reserved for future use; MUST be zero for now.
    -
    -        Dictionary Size is encoded with one-bit mantissa and five-bit
    -        exponent. The smallest dictionary size is 4 KiB and the biggest
    -        is 4 GiB.
    -
    -            Raw value   Mantissa   Exponent   Dictionary size
    -                0           2         11         4 KiB
    -                1           3         11         6 KiB
    -                2           2         12         8 KiB
    -                3           3         12        12 KiB
    -                4           2         13        16 KiB
    -                5           3         13        24 KiB
    -                6           2         14        32 KiB
    -              ...         ...        ...      ...
    -               35           3         27       768 MiB
    -               36           2         28      1024 MiB
    -               37           3         29      1536 MiB
    -               38           2         30      2048 MiB
    -               39           3         30      3072 MiB
    -               40           2         31      4096 MiB - 1 B
    -
    -        Instead of having a table in the decoder, the dictionary size
    -        can be decoded using the following C code:
    -
    -            const uint8_t bits = get_dictionary_flags() & 0x3F;
    -            if (bits > 40)
    -                return DICTIONARY_TOO_BIG; // Bigger than 4 GiB
    -
    -            uint32_t dictionary_size;
    -            if (bits == 40) {
    -                dictionary_size = UINT32_MAX;
    -            } else {
    -                dictionary_size = 2 | (bits & 1);
    -                dictionary_size <<= bits / 2 + 11;
    -            }
    -
    -
    -5.3.2. Branch/Call/Jump Filters for Executables
    -
    -        These filters convert relative branch, call, and jump
    -        instructions to their absolute counterparts in executable
    -        files. This conversion increases redundancy and thus
    -        compression ratio.
    -
    -            Size of Filter Properties:  0 or 4 bytes
    -            Changes size of data:       No
    -            Allow as a non-last filter: Yes
    -            Allow as the last filter:   No
    -
    -        Below is the list of filters in this category. The alignment
    -        is the same for both input and output data.
    -
    -            Filter ID   Alignment   Description
    -              0x04       1 byte     x86 filter (BCJ)
    -              0x05       4 bytes    PowerPC (big endian) filter
    -              0x06      16 bytes    IA64 filter
    -              0x07       4 bytes    ARM (little endian) filter
    -              0x08       2 bytes    ARM Thumb (little endian) filter
    -              0x09       4 bytes    SPARC filter
    -
    -        If the size of Filter Properties is four bytes, the Filter
    -        Properties field contains the start offset used for address
    -        conversions. It is stored as an unsigned 32-bit little endian
    -        integer. The start offset MUST be a multiple of the alignment
    -        of the filter as listed in the table above; if it isn't, the
    -        decoder MUST indicate an error. If the size of Filter
    -        Properties is zero, the start offset is zero.
    -
    -        Setting the start offset may be useful if an executable has
    -        multiple sections, and there are many cross-section calls.
    -        Taking advantage of this feature usually requires usage of
    -        the Subblock filter, whose design is not complete yet.
    -
    -
    -5.3.3. Delta
    -
    -        The Delta filter may increase compression ratio when the value
    -        of the next byte correlates with the value of an earlier byte
    -        at specified distance.
    -
    -            Filter ID:                  0x03
    -            Size of Filter Properties:  1 byte
    -            Changes size of data:       No
    -            Allow as a non-last filter: Yes
    -            Allow as the last filter:   No
    -
    -            Preferred alignment:
    -                Input data:             1 byte
    -                Output data:            Same as the original input data
    -
    -        The Properties byte indicates the delta distance, which can be
    -        1-256 bytes backwards from the current byte: 0x00 indicates
    -        distance of 1 byte and 0xFF distance of 256 bytes.
    -
    -
    -5.3.3.1. Format of the Encoded Output
    -
    -        The code below illustrates both encoding and decoding with
    -        the Delta filter.
    -
    -            // Distance is in the range [1, 256].
    -            const unsigned int distance = get_properties_byte() + 1;
    -            uint8_t pos = 0;
    -            uint8_t delta[256];
    -
    -            memset(delta, 0, sizeof(delta));
    -
    -            while (1) {
    -                const int byte = read_byte();
    -                if (byte == EOF)
    -                    break;
    -
    -                uint8_t tmp = delta[(uint8_t)(distance + pos)];
    -                if (is_encoder) {
    -                    tmp = (uint8_t)(byte) - tmp;
    -                    delta[pos] = (uint8_t)(byte);
    -                } else {
    -                    tmp = (uint8_t)(byte) + tmp;
    -                    delta[pos] = tmp;
    -                }
    -
    -                write_byte(tmp);
    -                --pos;
    -            }
    -
    -
    -5.4. Custom Filter IDs
    -
    -        If a developer wants to use custom Filter IDs, he has two
    -        choices. The first choice is to contact Lasse Collin and ask
    -        him to allocate a range of IDs for the developer.
    -
    -        The second choice is to generate a 40-bit random integer,
    -        which the developer can use as his personal Developer ID.
    -        To minimize the risk of collisions, Developer ID has to be
    -        a randomly generated integer, not manually selected "hex word".
    -        The following command, which works on many free operating
    -        systems, can be used to generate Developer ID:
    -
    -            dd if=/dev/urandom bs=5 count=1 | hexdump
    -
    -        The developer can then use his Developer ID to create unique
    -        (well, hopefully unique) Filter IDs.
    -
    -            Bits    Mask                    Description
    -             0-15   0x0000_0000_0000_FFFF   Filter ID
    -            16-55   0x00FF_FFFF_FFFF_0000   Developer ID
    -            56-62   0x3F00_0000_0000_0000   Static prefix: 0x3F
    -
    -        The resulting 63-bit integer will use 9 bytes of space when
    -        stored using the encoding described in Section 1.2. To get
    -        a shorter ID, see the beginning of this Section how to
    -        request a custom ID range.
    -
    -
    -5.4.1. Reserved Custom Filter ID Ranges
    -
    -        Range                       Description
    -        0x0000_0300 - 0x0000_04FF   Reserved to ease .7z compatibility
    -        0x0002_0000 - 0x0007_FFFF   Reserved to ease .7z compatibility
    -        0x0200_0000 - 0x07FF_FFFF   Reserved to ease .7z compatibility
    -
    -
    -6. Cyclic Redundancy Checks
    -
    -        There are several incompatible variations to calculate CRC32
    -        and CRC64. For simplicity and clarity, complete examples are
    -        provided to calculate the checks as they are used in this file
    -        format. Implementations MAY use different code as long as it
    -        gives identical results.
    -
    -        The program below reads data from standard input, calculates
    -        the CRC32 and CRC64 values, and prints the calculated values
    -        as big endian hexadecimal strings to standard output.
    -
    -            #include 
    -            #include 
    -            #include 
    -
    -            uint32_t crc32_table[256];
    -            uint64_t crc64_table[256];
    -
    -            void
    -            init(void)
    -            {
    -                static const uint32_t poly32 = UINT32_C(0xEDB88320);
    -                static const uint64_t poly64
    -                        = UINT64_C(0xC96C5795D7870F42);
    -
    -                for (size_t i = 0; i < 256; ++i) {
    -                    uint32_t crc32 = i;
    -                    uint64_t crc64 = i;
    -
    -                    for (size_t j = 0; j < 8; ++j) {
    -                        if (crc32 & 1)
    -                            crc32 = (crc32 >> 1) ^ poly32;
    -                        else
    -                            crc32 >>= 1;
    -
    -                        if (crc64 & 1)
    -                            crc64 = (crc64 >> 1) ^ poly64;
    -                        else
    -                            crc64 >>= 1;
    -                    }
    -
    -                    crc32_table[i] = crc32;
    -                    crc64_table[i] = crc64;
    -                }
    -            }
    -
    -            uint32_t
    -            crc32(const uint8_t *buf, size_t size, uint32_t crc)
    -            {
    -                crc = ~crc;
    -                for (size_t i = 0; i < size; ++i)
    -                    crc = crc32_table[buf[i] ^ (crc & 0xFF)]
    -                            ^ (crc >> 8);
    -                return ~crc;
    -            }
    -
    -            uint64_t
    -            crc64(const uint8_t *buf, size_t size, uint64_t crc)
    -            {
    -                crc = ~crc;
    -                for (size_t i = 0; i < size; ++i)
    -                    crc = crc64_table[buf[i] ^ (crc & 0xFF)]
    -                            ^ (crc >> 8);
    -                return ~crc;
    -            }
    -
    -            int
    -            main()
    -            {
    -                init();
    -
    -                uint32_t value32 = 0;
    -                uint64_t value64 = 0;
    -                uint64_t total_size = 0;
    -                uint8_t buf[8192];
    -
    -                while (1) {
    -                    const size_t buf_size
    -                            = fread(buf, 1, sizeof(buf), stdin);
    -                    if (buf_size == 0)
    -                        break;
    -
    -                    total_size += buf_size;
    -                    value32 = crc32(buf, buf_size, value32);
    -                    value64 = crc64(buf, buf_size, value64);
    -                }
    -
    -                printf("Bytes:  %" PRIu64 "\n", total_size);
    -                printf("CRC-32: 0x%08" PRIX32 "\n", value32);
    -                printf("CRC-64: 0x%016" PRIX64 "\n", value64);
    -
    -                return 0;
    -            }
    -
    -
    -7. References
    -
    -        LZMA SDK - The original LZMA implementation
    -        http://7-zip.org/sdk.html
    -
    -        LZMA Utils - LZMA adapted to POSIX-like systems
    -        http://tukaani.org/lzma/
    -
    -        XZ Utils - The next generation of LZMA Utils
    -        http://tukaani.org/xz/
    -
    -        [RFC-1952]
    -        GZIP file format specification version 4.3
    -        http://www.ietf.org/rfc/rfc1952.txt
    -          - Notation of byte boxes in section "2.1. Overall conventions"
    -
    -        [RFC-2119]
    -        Key words for use in RFCs to Indicate Requirement Levels
    -        http://www.ietf.org/rfc/rfc2119.txt
    -
    -        [GNU-tar]
    -        GNU tar 1.21 manual
    -        http://www.gnu.org/software/tar/manual/html_node/Blocking-Factor.html
    -          - Node 9.4.2 "Blocking Factor", paragraph that begins
    -            "gzip will complain about trailing garbage"
    -          - Note that this URL points to the latest version of the
    -            manual, and may some day not contain the note which is in
    -            1.21. For the exact version of the manual, download GNU
    -            tar 1.21: ftp://ftp.gnu.org/pub/gnu/tar/tar-1.21.tar.gz
    -
    diff --git a/external/public-domain/xz/dist/m4/tuklib_common.m4 b/external/public-domain/xz/dist/m4/tuklib_common.m4
    deleted file mode 100644
    index d942a25fa..000000000
    --- a/external/public-domain/xz/dist/m4/tuklib_common.m4
    +++ /dev/null
    @@ -1,22 +0,0 @@
    -#
    -# SYNOPSIS
    -#
    -#   TUKLIB_COMMON
    -#
    -# DESCRIPTION
    -#
    -#   Common checks for tuklib.
    -#
    -# COPYING
    -#
    -#   Author: Lasse Collin
    -#
    -#   This file has been put into the public domain.
    -#   You can do whatever you want with this file.
    -#
    -
    -AC_DEFUN_ONCE([TUKLIB_COMMON], [
    -AC_REQUIRE([AC_CANONICAL_HOST])
    -AC_REQUIRE([AC_PROG_CC_C99])
    -AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
    -])dnl
    diff --git a/external/public-domain/xz/dist/m4/tuklib_cpucores.m4 b/external/public-domain/xz/dist/m4/tuklib_cpucores.m4
    deleted file mode 100644
    index 08e2cb0da..000000000
    --- a/external/public-domain/xz/dist/m4/tuklib_cpucores.m4
    +++ /dev/null
    @@ -1,141 +0,0 @@
    -#
    -# SYNOPSIS
    -#
    -#   TUKLIB_CPUCORES
    -#
    -# DESCRIPTION
    -#
    -#   Check how to find out the number of available CPU cores in the system.
    -#   This information is used by tuklib_cpucores.c.
    -#
    -#   Supported methods:
    -#     - GetSystemInfo(): Windows (including Cygwin)
    -#     - sysctl(): BSDs, OS/2
    -#     - sysconf(): GNU/Linux, Solaris, Tru64, IRIX, AIX, Cygwin (but
    -#       GetSystemInfo() is used on Cygwin)
    -#     - pstat_getdynamic(): HP-UX
    -#
    -# COPYING
    -#
    -#   Author: Lasse Collin
    -#
    -#   This file has been put into the public domain.
    -#   You can do whatever you want with this file.
    -#
    -
    -AC_DEFUN_ONCE([TUKLIB_CPUCORES], [
    -AC_REQUIRE([TUKLIB_COMMON])
    -
    -# sys/param.h might be needed by sys/sysctl.h.
    -AC_CHECK_HEADERS([sys/param.h])
    -
    -AC_CACHE_CHECK([how to detect the number of available CPU cores],
    -	[tuklib_cv_cpucores_method], [
    -
    -# Maybe checking $host_os would be enough but this matches what
    -# tuklib_cpucores.c does.
    -#
    -# NOTE: IRIX has a compiler that doesn't error out with #error, so use
    -# a non-compilable text instead of #error to generate an error.
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#if defined(_WIN32) || defined(__CYGWIN__)
    -int main(void) { return 0; }
    -#else
    -compile error
    -#endif
    -]])], [tuklib_cv_cpucores_method=special], [
    -
    -# FreeBSD has both cpuset and sysctl. Look for cpuset first because
    -# it's a better approach.
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -#include 
    -
    -int
    -main(void)
    -{
    -	cpuset_t set;
    -	cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
    -			sizeof(set), &set);
    -	return 0;
    -}
    -]])], [tuklib_cv_cpucores_method=cpuset], [
    -
    -# Look for sysctl() solution first, because on OS/2, both sysconf()
    -# and sysctl() pass the tests in this file, but only sysctl()
    -# actually works.
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -#ifdef HAVE_SYS_PARAM_H
    -#	include 
    -#endif
    -#include 
    -int
    -main(void)
    -{
    -	int name[2] = { CTL_HW, HW_NCPU };
    -	int cpus;
    -	size_t cpus_size = sizeof(cpus);
    -	sysctl(name, 2, &cpus, &cpus_size, NULL, 0);
    -	return 0;
    -}
    -]])], [tuklib_cv_cpucores_method=sysctl], [
    -
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -int
    -main(void)
    -{
    -	long i;
    -#ifdef _SC_NPROCESSORS_ONLN
    -	/* Many systems using sysconf() */
    -	i = sysconf(_SC_NPROCESSORS_ONLN);
    -#else
    -	/* IRIX */
    -	i = sysconf(_SC_NPROC_ONLN);
    -#endif
    -	return 0;
    -}
    -]])], [tuklib_cv_cpucores_method=sysconf], [
    -
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -#include 
    -
    -int
    -main(void)
    -{
    -	struct pst_dynamic pst;
    -	pstat_getdynamic(&pst, sizeof(pst), 1, 0);
    -	(void)pst.psd_proc_cnt;
    -	return 0;
    -}
    -]])], [tuklib_cv_cpucores_method=pstat_getdynamic], [
    -
    -	tuklib_cv_cpucores_method=unknown
    -])])])])])])
    -
    -case $tuklib_cv_cpucores_method in
    -	cpuset)
    -		AC_DEFINE([TUKLIB_CPUCORES_CPUSET], [1],
    -			[Define to 1 if the number of available CPU cores
    -			can be detected with cpuset(2).])
    -		;;
    -	sysctl)
    -		AC_DEFINE([TUKLIB_CPUCORES_SYSCTL], [1],
    -			[Define to 1 if the number of available CPU cores
    -			can be detected with sysctl().])
    -		;;
    -	sysconf)
    -		AC_DEFINE([TUKLIB_CPUCORES_SYSCONF], [1],
    -			[Define to 1 if the number of available CPU cores
    -			can be detected with sysconf(_SC_NPROCESSORS_ONLN)
    -			or sysconf(_SC_NPROC_ONLN).])
    -		;;
    -	pstat_getdynamic)
    -		AC_DEFINE([TUKLIB_CPUCORES_PSTAT_GETDYNAMIC], [1],
    -			[Define to 1 if the number of available CPU cores
    -			can be detected with pstat_getdynamic().])
    -		;;
    -esac
    -])dnl
    diff --git a/external/public-domain/xz/dist/m4/tuklib_integer.m4 b/external/public-domain/xz/dist/m4/tuklib_integer.m4
    deleted file mode 100644
    index 2ab72a2f0..000000000
    --- a/external/public-domain/xz/dist/m4/tuklib_integer.m4
    +++ /dev/null
    @@ -1,74 +0,0 @@
    -#
    -# SYNOPSIS
    -#
    -#   TUKLIB_INTEGER
    -#
    -# DESCRIPTION
    -#
    -#   Checks for tuklib_integer.h:
    -#     - Endianness
    -#     - Does operating system provide byte swapping macros
    -#     - Does the hardware support fast unaligned access to 16-bit
    -#       and 32-bit integers
    -#
    -# COPYING
    -#
    -#   Author: Lasse Collin
    -#
    -#   This file has been put into the public domain.
    -#   You can do whatever you want with this file.
    -#
    -
    -AC_DEFUN_ONCE([TUKLIB_INTEGER], [
    -AC_REQUIRE([TUKLIB_COMMON])
    -AC_REQUIRE([AC_C_BIGENDIAN])
    -AC_CHECK_HEADERS([byteswap.h sys/endian.h sys/byteorder.h], [break])
    -
    -# Even if we have byteswap.h, we may lack the specific macros/functions.
    -if test x$ac_cv_header_byteswap_h = xyes ; then
    -	m4_foreach([FUNC], [bswap_16,bswap_32,bswap_64], [
    -		AC_MSG_CHECKING([if FUNC is available])
    -		AC_LINK_IFELSE([AC_LANG_SOURCE([
    -#include 
    -int
    -main(void)
    -{
    -	FUNC[](42);
    -	return 0;
    -}
    -		])], [
    -			AC_DEFINE(HAVE_[]m4_toupper(FUNC), [1],
    -					[Define to 1 if] FUNC [is available.])
    -			AC_MSG_RESULT([yes])
    -		], [AC_MSG_RESULT([no])])
    -
    -	])dnl
    -fi
    -
    -AC_MSG_CHECKING([if unaligned memory access should be used])
    -AC_ARG_ENABLE([unaligned-access], AS_HELP_STRING([--enable-unaligned-access],
    -		[Enable if the system supports *fast* unaligned memory access
    -		with 16-bit and 32-bit integers. By default, this is enabled
    -		only on x86, x86_64, and big endian PowerPC.]),
    -	[], [enable_unaligned_access=auto])
    -if test "x$enable_unaligned_access" = xauto ; then
    -	# TODO: There may be other architectures, on which unaligned access
    -	# is OK.
    -	case $host_cpu in
    -		i?86|x86_64|powerpc|powerpc64)
    -			enable_unaligned_access=yes
    -			;;
    -		*)
    -			enable_unaligned_access=no
    -			;;
    -	esac
    -fi
    -if test "x$enable_unaligned_access" = xyes ; then
    -	AC_DEFINE([TUKLIB_FAST_UNALIGNED_ACCESS], [1], [Define to 1 if
    -		the system supports fast unaligned access to 16-bit and
    -		32-bit integers.])
    -	AC_MSG_RESULT([yes])
    -else
    -	AC_MSG_RESULT([no])
    -fi
    -])dnl
    diff --git a/external/public-domain/xz/dist/m4/tuklib_mbstr.m4 b/external/public-domain/xz/dist/m4/tuklib_mbstr.m4
    deleted file mode 100644
    index 991be9b9c..000000000
    --- a/external/public-domain/xz/dist/m4/tuklib_mbstr.m4
    +++ /dev/null
    @@ -1,30 +0,0 @@
    -#
    -# SYNOPSIS
    -#
    -#   TUKLIB_MBSTR
    -#
    -# DESCRIPTION
    -#
    -#   Check if multibyte and wide character functionality is available
    -#   for use by tuklib_mbstr_* functions. If not enough multibyte string
    -#   support is available in the C library, the functions keep working
    -#   with the assumption that all strings are a in single-byte character
    -#   set without combining characters, e.g. US-ASCII or ISO-8859-*.
    -#
    -#   This .m4 file and tuklib_mbstr.h are common to all tuklib_mbstr_*
    -#   functions, but each function is put into a separate .c file so
    -#   that it is possible to pick only what is strictly needed.
    -#
    -# COPYING
    -#
    -#   Author: Lasse Collin
    -#
    -#   This file has been put into the public domain.
    -#   You can do whatever you want with this file.
    -#
    -
    -AC_DEFUN_ONCE([TUKLIB_MBSTR], [
    -AC_REQUIRE([TUKLIB_COMMON])
    -AC_FUNC_MBRTOWC
    -AC_CHECK_FUNCS([wcwidth])
    -])dnl
    diff --git a/external/public-domain/xz/dist/m4/tuklib_physmem.m4 b/external/public-domain/xz/dist/m4/tuklib_physmem.m4
    deleted file mode 100644
    index ea02208fd..000000000
    --- a/external/public-domain/xz/dist/m4/tuklib_physmem.m4
    +++ /dev/null
    @@ -1,212 +0,0 @@
    -#
    -# SYNOPSIS
    -#
    -#   TUKLIB_PHYSMEM
    -#
    -# DESCRIPTION
    -#
    -#   Check how to get the amount of physical memory.
    -#   This information is used in tuklib_physmem.c.
    -#
    -#   Supported methods:
    -#
    -#     - Windows (including Cygwin), OS/2, DJGPP (DOS), and OpenVMS have
    -#       operating-system specific functions.
    -#
    -#     - AIX has _system_configuration.physmem.
    -#
    -#     - sysconf() works on GNU/Linux and Solaris, and possibly on
    -#       some BSDs.
    -#
    -#     - BSDs use sysctl().
    -#
    -#     - Tru64 uses getsysinfo().
    -#
    -#     - HP-UX uses pstat_getstatic().
    -#
    -#     - IRIX has setinvent_r(), getinvent_r(), and endinvent_r().
    -#
    -#     - sysinfo() works on Linux/dietlibc and probably on other Linux
    -#       systems whose libc may lack sysconf().
    -#
    -# COPYING
    -#
    -#   Author: Lasse Collin
    -#
    -#   This file has been put into the public domain.
    -#   You can do whatever you want with this file.
    -#
    -
    -AC_DEFUN_ONCE([TUKLIB_PHYSMEM], [
    -AC_REQUIRE([TUKLIB_COMMON])
    -
    -# sys/param.h might be needed by sys/sysctl.h.
    -AC_CHECK_HEADERS([sys/param.h])
    -
    -AC_CACHE_CHECK([how to detect the amount of physical memory],
    -	[tuklib_cv_physmem_method], [
    -
    -# Maybe checking $host_os would be enough but this matches what
    -# tuklib_physmem.c does.
    -#
    -# NOTE: IRIX has a compiler that doesn't error out with #error, so use
    -# a non-compilable text instead of #error to generate an error.
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#if defined(_WIN32) || defined(__CYGWIN__) || defined(__OS2__) \
    -		|| defined(__DJGPP__) || defined(__VMS) \
    -		|| defined(AMIGA) || defined(__AROS__)
    -int main(void) { return 0; }
    -#else
    -compile error
    -#endif
    -]])], [tuklib_cv_physmem_method=special], [
    -
    -# Look for AIX-specific solution before sysconf(), because the test
    -# for sysconf() will pass on AIX but won't actually work
    -# (sysconf(_SC_PHYS_PAGES) compiles but always returns -1 on AIX).
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -
    -int
    -main(void)
    -{
    -	(void)_system_configuration.physmem;
    -	return 0;
    -}
    -]])], [tuklib_cv_physmem_method=aix], [
    -
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -int
    -main(void)
    -{
    -	long i;
    -	i = sysconf(_SC_PAGESIZE);
    -	i = sysconf(_SC_PHYS_PAGES);
    -	return 0;
    -}
    -]])], [tuklib_cv_physmem_method=sysconf], [
    -
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -#ifdef HAVE_SYS_PARAM_H
    -#	include 
    -#endif
    -#include 
    -int
    -main(void)
    -{
    -	int name[2] = { CTL_HW, HW_PHYSMEM };
    -	unsigned long mem;
    -	size_t mem_ptr_size = sizeof(mem);
    -	sysctl(name, 2, &mem, &mem_ptr_size, NULL, 0);
    -	return 0;
    -}
    -]])], [tuklib_cv_physmem_method=sysctl], [
    -
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -#include 
    -
    -int
    -main(void)
    -{
    -	int memkb;
    -	int start = 0;
    -	getsysinfo(GSI_PHYSMEM, (caddr_t)&memkb, sizeof(memkb), &start);
    -	return 0;
    -}
    -]])], [tuklib_cv_physmem_method=getsysinfo],[
    -
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -#include 
    -
    -int
    -main(void)
    -{
    -	struct pst_static pst;
    -	pstat_getstatic(&pst, sizeof(pst), 1, 0);
    -	(void)pst.physical_memory;
    -	(void)pst.page_size;
    -	return 0;
    -}
    -]])], [tuklib_cv_physmem_method=pstat_getstatic],[
    -
    -AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -int
    -main(void)
    -{
    -	inv_state_t *st = NULL;
    -	setinvent_r(&st);
    -	getinvent_r(st);
    -	endinvent_r(st);
    -	return 0;
    -}
    -]])], [tuklib_cv_physmem_method=getinvent_r], [
    -
    -# This version of sysinfo() is Linux-specific. Some non-Linux systems have
    -# different sysinfo() so we must check $host_os.
    -case $host_os in
    -	linux*)
    -		AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
    -#include 
    -int
    -main(void)
    -{
    -	struct sysinfo si;
    -	sysinfo(&si);
    -	return 0;
    -}
    -		]])], [
    -			tuklib_cv_physmem_method=sysinfo
    -		], [
    -			tuklib_cv_physmem_method=unknown
    -		])
    -		;;
    -	*)
    -		tuklib_cv_physmem_method=unknown
    -		;;
    -esac
    -])])])])])])])])
    -
    -case $tuklib_cv_physmem_method in
    -	aix)
    -		AC_DEFINE([TUKLIB_PHYSMEM_AIX], [1],
    -			[Define to 1 if the amount of physical memory
    -			can be detected with _system_configuration.physmem.])
    -		;;
    -	sysconf)
    -		AC_DEFINE([TUKLIB_PHYSMEM_SYSCONF], [1],
    -			[Define to 1 if the amount of physical memory can
    -			be detected with sysconf(_SC_PAGESIZE) and
    -			sysconf(_SC_PHYS_PAGES).])
    -		;;
    -	sysctl)
    -		AC_DEFINE([TUKLIB_PHYSMEM_SYSCTL], [1],
    -			[Define to 1 if the amount of physical memory can
    -			be detected with sysctl().])
    -		;;
    -	getsysinfo)
    -		AC_DEFINE([TUKLIB_PHYSMEM_GETSYSINFO], [1],
    -			[Define to 1 if the amount of physical memory can
    -			be detected with getsysinfo().])
    -		;;
    -	pstat_getstatic)
    -		AC_DEFINE([TUKLIB_PHYSMEM_PSTAT_GETSTATIC], [1],
    -			[Define to 1 if the amount of physical memory can
    -			be detected with pstat_getstatic().])
    -		;;
    -	getinvent_r)
    -		AC_DEFINE([TUKLIB_PHYSMEM_GETINVENT_R], [1],
    -			[Define to 1 if the amount of physical memory
    -			can be detected with getinvent_r().])
    -		;;
    -	sysinfo)
    -		AC_DEFINE([TUKLIB_PHYSMEM_SYSINFO], [1],
    -			[Define to 1 if the amount of physical memory
    -			can be detected with Linux sysinfo().])
    -		;;
    -esac
    -])dnl
    diff --git a/external/public-domain/xz/dist/m4/tuklib_progname.m4 b/external/public-domain/xz/dist/m4/tuklib_progname.m4
    deleted file mode 100644
    index f3e158bd4..000000000
    --- a/external/public-domain/xz/dist/m4/tuklib_progname.m4
    +++ /dev/null
    @@ -1,25 +0,0 @@
    -#
    -# SYNOPSIS
    -#
    -#   TUKLIB_PROGNAME
    -#
    -# DESCRIPTION
    -#
    -#   Put argv[0] into a global variable progname. On DOS-like systems,
    -#   modify it so that it looks nice (no full path or .exe suffix).
    -#
    -#   This .m4 file is needed allow this module to use glibc's
    -#   program_invocation_name.
    -#
    -# COPYING
    -#
    -#   Author: Lasse Collin
    -#
    -#   This file has been put into the public domain.
    -#   You can do whatever you want with this file.
    -#
    -
    -AC_DEFUN_ONCE([TUKLIB_PROGNAME], [
    -AC_REQUIRE([TUKLIB_COMMON])
    -AC_CHECK_DECLS([program_invocation_name], [], [], [#include ])
    -])dnl
    diff --git a/external/public-domain/xz/dist/macosx/build.sh b/external/public-domain/xz/dist/macosx/build.sh
    deleted file mode 100755
    index fd089f3b3..000000000
    --- a/external/public-domain/xz/dist/macosx/build.sh
    +++ /dev/null
    @@ -1,113 +0,0 @@
    -#!/bin/sh
    -
    -###############################################################################
    -# Author: Anders F Björklund 
    -#
    -# This file has been put into the public domain.
    -# You can do whatever you want with this file.
    -###############################################################################
    -
    -mkdir -p Root
    -mkdir -p Resources
    -
    -# Abort immediately if something goes wrong.
    -set -e
    -
    -GCC="gcc-4.2"
    -SDK="/Developer/SDKs/MacOSX10.5.sdk"
    -MDT="10.5"
    -GTT=i686-apple-darwin9
    -
    -ARCHES1="-arch ppc -arch ppc64 -arch i386 -arch x86_64"
    -ARCHES2="-arch ppc -arch i386"
    -PKGFORMAT="10.5" # xar
    -
    -# avoid "unknown required load command: 0x80000022" from linking on Snow Leopard
    -uname -r | grep ^1 >/dev/null && LDFLAGS="$LDFLAGS -Wl,-no_compact_linkedit"
    -
    -# Clean up if it was already configured.
    -[ -f Makefile ] && make distclean
    -
    -# Build the regular fat program
    -
    -CC="$GCC" \
    -CFLAGS="-O2 -g $ARCHES1 -isysroot $SDK -mmacosx-version-min=$MDT" \
    -../configure --disable-dependency-tracking --disable-xzdec --disable-lzmadec $GTT
    -
    -make
    -
    -make check
    -
    -make DESTDIR=`pwd`/Root install
    -
    -make distclean
    -
    -# Build the size-optimized program
    -
    -CC="$GCC" \
    -CFLAGS="-Os -g $ARCHES2 -isysroot $SDK -mmacosx-version-min=$MDT" \
    -../configure --disable-dependency-tracking --disable-shared --disable-nls --disable-encoders --enable-small --disable-threads $GTT
    -
    -make -C src/liblzma
    -make -C src/xzdec
    -make -C src/xzdec DESTDIR=`pwd`/Root install
    -
    -cp -a ../extra Root/usr/local/share/doc/xz
    -
    -make distclean
    -
    -# Move development files to different package
    -
    -test -d liblzma && rm -r liblzma
    -mkdir -p liblzma/usr/local
    -
    -mv Root/usr/local/include liblzma/usr/local
    -mv Root/usr/local/lib liblzma/usr/local
    -
    -mkdir -p Root/usr/local/lib
    -cp -p liblzma/usr/local/lib/liblzma.5.dylib Root/usr/local/lib
    -mkdir -p liblzma/usr/local/share/doc/xz
    -mv Root/usr/local/share/doc/xz/examples* liblzma/usr/local/share/doc/xz
    -
    -# Strip debugging symbols and make relocatable
    -
    -for bin in xz lzmainfo xzdec lzmadec; do
    -    strip -S Root/usr/local/bin/$bin
    -    install_name_tool -change /usr/local/lib/liblzma.5.dylib @executable_path/../lib/liblzma.5.dylib Root/usr/local/bin/$bin
    -done
    -
    -for lib in liblzma.5.dylib; do
    -    strip -S Root/usr/local/lib/$lib
    -    install_name_tool -id @executable_path/../lib/liblzma.5.dylib Root/usr/local/lib/$lib
    -done
    -
    -# Create tarball, but without the HFS+ attrib
    -
    -rmdir debug lib po src/liblzma/api src/liblzma src/lzmainfo src/scripts src/xz src/xzdec src tests
    -
    -( cd Root/usr/local; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../../../XZ.tbz * )
    -( cd liblzma; COPY_EXTENDED_ATTRIBUTES_DISABLE=true COPYFILE_DISABLE=true tar cvjf ../liblzma.tbz ./usr/local )
    -
    -# Include documentation files for package
    -
    -cp -p ../README Resources/ReadMe.txt
    -cp -p ../COPYING Resources/License.txt
    -
    -# Make an Installer.app package
    -
    -ID="org.tukaani.xz"
    -VERSION=`cd ..; sh build-aux/version.sh`
    -PACKAGEMAKER=/Developer/Applications/Utilities/PackageMaker.app/Contents/MacOS/PackageMaker
    -$PACKAGEMAKER -r Root/usr/local -l /usr/local -e Resources -i $ID -n $VERSION -t XZ -o XZ.pkg -g $PKGFORMAT --verbose
    -$PACKAGEMAKER -r liblzma -w -k -i $ID.liblzma -n $VERSION -o liblzma.pkg -g $PKGFORMAT --verbose
    -
    -# Put the package in a disk image
    -
    -if [ "$PKGFORMAT" != "10.5" ]; then
    -hdiutil create -fs HFS+ -format UDZO -quiet -srcfolder XZ.pkg -ov XZ.dmg
    -hdiutil internet-enable -yes -quiet XZ.dmg
    -fi
    -
    -echo
    -echo "Build completed successfully."
    -echo
    diff --git a/external/public-domain/xz/dist/po/cs.gmo b/external/public-domain/xz/dist/po/cs.gmo
    deleted file mode 100644
    index bb9b1ec34961178ee90b4a2bab3dae2d8a635301..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
    
    literal 21945
    zcmbW93v49!ecwm2(!?jnZWJrEQ_K0w_UTB8OOd>XBvO>`Ezu`Fd@osdR(!L&L+;$}
    z&a8K4_ii_dBc(}Uw7Ry4Y9#i#sfoHtukBezoVG!LQ(f?g8VMZKMG_QfYc~dxA`RLg
    zO_Q`J`uO~Q|NqR+lDj-R3k|>X_`mthdi-ai9h{XWmT
    zA3Xn{#VXj~lHYHE-vECbeClnU_e<~aysy#7x8CJ>CEov|AMm`>;O~Hc1$^Wo&*RoR
    z3_b-u5B?PRli;6#_y3^heIEQX@JqDw#=AZ51)h)pkmsEO|0XEkzX86B?-7kY$MdJ&
    z<9W}3cfikpe-6F|-gvL){WSQlANIVjgMSx%11$el%7T9eHo#wbpXX83d-M^D3l1-U
    z{O85)`G&(^a`>+t{(G=bxj%K!t@qn@{st)X{USIG{&SG2dcOxUMel!t4}LO`uUIGA@EN?
    zrtVG9DMR*7g0eqlkfrnbAWP!C0UGej4!;4`c>eF;v*6_q*!lcCIM4Gx0Y3!(KFCsg
    z4}Q?|=D^25Y42rFzIQ%9cZysm&xgFR5n|1t=Pd0z)7z;A;xo(EZcrs!P&Wgo6N
    z{QIEL*}n#*{(V%sAABDuJo6*q1K=7c>vI7VKKNPiDEL)S#(N)w6Z)S8Pl6#x*WQ;v
    z>F>9}?*;!4$W*-VVY6j_o&dieJOS?QUGOOQN1&|R3`F-f@GSVB?(@8h;2-k*
    z6q~lqhYzv{-{k!tKpYFa{~AR368OMj%Qqi)*agq?{_lXF0e=tt5cPiS2z$=+7g)sq
    z!SgXTwaxR9c`GMwf&ZB2KLXG5{d073MxNOe+5ZKI>kD8C{yp&F=REHhz^{P63!eQj
    zGzlI$YUP^{Rm}6h1z|bw_;JgJWl)}917-g9h}-1}4TQSi}I_W1-T`x1jJmG?RD
    zDEJLf`2V5Pw!P;;rsRDBWU0JO@Q1)^xSLrb1_4x9j`-ya7J_!cPq{w?qW;3FTga^ff`?FQgF_;aAN
    z^M65+EAM7grTyo@9|vCtWgXuBqUUXZPk^$XZ-By|Uj=1d{}|*y@8MUv{|eFmd>*!yDj(l>3~+Uv&7(4&QS4>kfa%;kUtQ>isux4t#{o6?wV_
    z%KQV+2fqTsy57Su^A+$6DC_c1!MB0G1>OhBPxiN>cXo|J?l;`?`@z@Tz4UvCizUi`
    zLhG_Gveu8dx37TDaUFBd2^ew7x<1JT$#}54j{jv)evrM|0}NZoEi{(>e#+fE1j^cW
    zxjw;liHm7?uX2^SevnJ{T7I$yAJaQ)ZwODx{s>L~443ep@SFU8g6p8(*|m{d*hha=
    zhXVTw_d>G|aQ!u|$GP6lb(BkJ;@w<`J@1FODwoig$dneB$RhbIas6ek3-ZA4
    z3fDX3hF{8coJ-`9{C<*4WPs3rlM7L-Gzln83(D{NE$Cm!RDVJnFLAwx>rs6(_ybEQ
    zEv|sVqnEiLFYg*xiA(6_FLA|O*SUIJ!V@*F4|2)x0~YkJ@Q3JZ`Tdv$<+1PKzVDuA
    zK}1UaGu#FF6LtpoZLS~Ss&jR?KE)-vMC9Q`F8O_kOXQIJews`A{&x_C;J3gOCi^tk
    z7rB0w>-Tvld?Ua6xc(o%_puk%iLVN`iwc$^PR`TL=wCHV(#4ev
    z%Y2nvKdJ<#9HiHRATs4%8YDc0(S}Jn<+SZr(x5uFsX_{
    zTn=8D9J@l*urgTeiVVeX_e>J@12b{xOnBUs%WiAqT&~ibZK~JvHSpWvVl!Lks5M9!<6OXsQ(_p^UTG*39^}TICUKjcQ|Vd>hTU
    z8Z0iao;+n_>t$&Z8GyVt6YGAGPMIifH~q$f!|_c;VI^<_l3UXVqKy=qTxZXkehPU`
    z%$4SzI=Ent92(zBbA55;*fPU0uF`rKRfVW)m4j2JRyj0f%ITc^;jx^u+WZ;cTs3H=
    zH9M-Ne?4q=nkEVSHiOYG3ub1~@1!x~3oB+K<6z4-*PlKzMCHct#vDKK5hn}G#KE}|
    z+iv`*%ADj@22v`u;%h;>RVh?nlQ(N8hANlC4HHDw(2qqnimHWbR8MwHyVZhlJU|Lf!TH(t+$ZYI&uPu(-to525q5Tn9yzG;*1Eu
    z<9@={BE3a4LCJQzip1{Z)cih5pXek|L$<+{njc24{Q+}K_@W6SNT#c8noc6(&dQ}^
    za-L>ZTgV1wWjHBZ4;h*^zp4Vd(BVrVEE2`$^wNu`rbHrNtDy_z$smtQQwTu6YD863
    z{dU!aQLB?q@AHH`gwn!jJuWo^bV{q?_f!n0af)#An{g*n0e<$_veK!D=t`&E
    z4x+TtGw2v5F=n4!yPd?}fSbc60&Ys%2(E{zCj*cnP)fg*vL#)7acOz!ylb=Yy&CK)
    zQCglVv@lfBHb3|)8@+o#JNIS^w$6Hi7N*9`jCC%fD;JCoRaTm9Rs}p|_KU<~wRAUT
    zv;#*^iD!pXDn)V0uU>^z^hLNnBs&>t3OytyxLyfRp|aw;M?P+78$wiwgrMDKlwp*l
    zLI5H}wL>8^X)y1k8efa9K^jAY6V^-u9b7eryi!wvj#8@G55f(JCAGqOMH?(v>6~my
    z(pg^*uP;uYyKtITI<%#o>RWR~ULQbc<srpF@bc5L!7cOrm4YLnzD&yrWdrEAuP>I
    zt_e#@TTyVW5k{~}4PyvnOspUIl}b9jnQVTIupVSDO}Ufi>lJknZFz0uGj-QZ-1f97
    zsxrgprtbm5NHMa)6)?oK$_P^vt6kgF7u`X$AP=>E-h>
    zIN1eR3X$nl52A`#Ei^6tRD%VBEtG_^fYw4ckjt2nT@fSTK(09^r_7b>{R8|J+ZhxM
    zf2HkTJ3#%?2^mU7)_d{93#U$;VJM70*l34okL~8YNqene-du^|D4md{WwCpHcnUFX^<@Ny+Ja0i709!gV(Dns^=3O;$#AsOXzmM%I`9Uf!8)*Ztj}i0!H+=7&BQ_l54n
    z2W8IUsB0Pf1&t*}ZiGb@R9)TuiNSA|7FTk&Tvcb=Fsd=!vtAwWD>Pu|q2E`zbZ3
    z#afh7QbKLW9p956s25wwKc5z3!*59ao~dEVUD=-;K-7qxJY|x4*lJNvXRSr02=nd`
    zD@2rVx51qR3%DIyo*+cMw^u1PCTOXzUQ5=`dS%;5{
    z(TVC2Ydv-n7^`BvhLJ3S-R33nKkYus1XVbuHH~0Mvv{bY2zJbGDZ>6@_Su@d4s{OM
    zwy#ADw@R|}Y9J@iX2?!at5PB@xL48bdz`)~k>o_lxM+XElg
    zd91q7Y380>k*P20JP*KoVOxj`|6t&-AgG(Z<+`)bsP!Ln>OJSk+VX@QGFF>XdYn0j
    zEY83^%&VS{(WnFf8!`bVl7oy-gYFOMSLRunVWV6S7(jdl|Wph<5VM-gh
    zfsaM)K8k+FoTIN%X15l)C?R4EuGu6Ztw$w5zjR@jC5%{SLa&Xt~)~&ZJw<+
    zUSK{@R6D{Ye-tNX(mSSs0#-+Y`}-@f!*K9heQu`-*wVqBtks?|3)xp&+;j3CI|UCl
    zOlqj>jfh1>7E~KVyRrhp7pCgV`N{5yj-i23MLkigPQ__+6{~O{NbN#f_cQ;xu}5*)
    zwiJ$K>U)%DzbkRO-D#zHQ)*I)#hM#+@<#o-%!`+JgskF#LVH0v?Va3F16~q4CR_Sk
    z9aAz?kH6}j5-Fcc%z_xo)EHsPwo)H@b@da+*49p~oHXnB`!cbdo~)s*gs57{8i!6b
    zRN{>Y8>s3n;k^>iY`CD)M7gsu>De=)!7?Me3b7HTMzu7(WwzWGaf^Sw(NT{~#-N^y
    z^G(F_MjmG67=?3(vhSGaL^YRPgnn?yf&^e_SZP=yai{G$E3gof6#0;w%4~>QYvald
    zZ5<^?m7^<0!|<aE25w^KIB`AI6?2CjX7t_p45Y{{uZ773M
    z{B#&a@aiN>jWvnc;2Z)h$pU)~nUkhy)KgBVNY$_yi_;Pv$po~c`GRL{DabCHC*^~v
    z8@A&}NCYL)4mG%iK#?Of%nZBmkV%1(Y`yD*-!eZ}gph2C3%84!mBuie+(Bv*uct&o
    z)V0$CfoW|d;pm5|jfw_y2o$JpEy%n>p87V0n0c$#zTw}YaCl7p{D
    z@^Vk*cTeYc&u}-8Sh{OZ%HKJ+#wtFFMI0yC(-G*(Jv(L|YHidz369BDl5j1Qh`z(W(mJ>XQ(s9_l
    zbUvOp4IgiLy27D*7#&SJb)RFx>A1bIZ*BE_=>#H4LII_d7>e^|Zf5pyX@*1CBWCu<
    z{Nck-%*@TqP_T41=!U{7gK{&a*}2lpK{Go$e{k-JnOVxc$Z2rteA|zbhKT!lv&=Ho
    z&E4109fTFO?wDtr^5!TUjMl64pQB2&(P0Hk=Lt37B=!RiUY})U>z#gZR00;sbYpfV
    z8Y(<*D#^a(rR7tDHJF{AVSmw55hKvhsvNmL$zfL*Eog)tuWIqa`O~GR2jyg>>p{D8
    zO5(zZ+>2AkR_okn@#JVq^jOcptowzrED(coglf7xZ2
    zXcWF}G|@!H;iu8oEu$sOMD|#Vt4OOJ87NzKDz&)3b$gFY6CqzRC|2*jj?nJ*t6Q7M
    z?U<-iGw6q=>|agsj_T-E`nj6mqYyB^dt>W%y0sbg2r%9Ica=a4C)e0R?M`j$RxKv)
    z#C-eJH_RaS1UuHIo(#>^s)Z;h$65M`o#@rTFoMl?T}M;Bd$SP};e@P`ppVKi+iz`c
    zR#_KWLur>3l%aOD#qQQ^f`HN1W`ghExylp&)l4^T1m(ZzQd&*3xVHWCr%bUV2S~Ct2@{UCZr3~Hrx;04k=2wG6^U|@
    zqaq*y>M=jERNQ_WPCoA5Am~!Jxhb(yjKmeT-^A~gUEgfbiyi9T2`i@2+SP0;?uU18
    zFjQ7{e4~40t{75Rc8+y-ql5A7k-(zzdhzV3?K?}$xB}a6g-xc7@W;o4628kE7E?%K
    zX>EUY>vlg1yIY&4x^=5j$3KP#d&qoC=l4owF_O!&_1dLV7um5I^ayWl-PT6_qUkI+
    zACk{v*G>~!*hy)$)`&Z0M#u?_?TJzIe%ukuFbU0=MU!X25P+H(NEnq^ng}z*YibCl
    z?K~ldOc)43=nSXo$RT$Rv6cqOFog!NBB@+VikWD|s064f%ZbstHXEi;k#XC)OUHI5
    z#YkV83^QEZmCur5Tt7oOG1}E28)i`7b~T(8GqwSj4l}5ok2Oz=8OOV8PT*Ui!WNqD
    z_9m(lLs(2JtW1)Q#^=R|yGLS-B?{sEt<4l+E@Z(8XeSb)Fi>;QRqD+*SMy^oZEe;Y
    zK5~`96lrbUj(lW?))8-!wha2A9Jf1cZO&Ptq_bSa_&`(LHbjK`PT1NJYxO~4Q%ISi
    z5r)-)QB&9FKzyRtBzP1D|h#XpNL}c>!jMy!8jt2HPm6d#R=f+TX}Od
    zg)qN+BTKv~VZQ$EUObA|cqLy>f?6nnGR#W7zcVw{-0W9Tx^zNY)|0H0buAqfN$=N`v9>
    znpsZl8BtADOl}mg9QIWZenWXXYiF0%WC@g(ux={7yMax%MtBz+du=-t+X;m<6znPnoa8=W1LruR0&(arX9q^Z}-WjWn
    z+_vZ%ITp6eJ4J_*wiJxx(y>kM7@>Ik46D3#2Zr~Rl>)>ohGjiy5}JXF;e1wNvs&*A
    zO`bHLZ1zO!uL@IMr2(`JvN@29ID*vqI@hz-X;HO3IY6owrKfDuhf{tEyOg9jfN}Tk
    zO*}}y(d)|sS~FJP%_YEZ-PV!Rm)
    zS2b^Z^u7Gfh!nXPG~|9w#q*k+4yy|6c{Vv{I5&ub!ZHKtUF4>Mmtx>*5``jcGrLaV
    zRgw_K4cvJ-<|%7NPZ2T`n;Rk^lWptQx_+%UByOE1$t5L29ZD5iJ-fX1nxqTuRA#zU
    zTVJW>8zpK20X2BV5e{OV4Zqh|)q#R}#D;=*iuTi#FxB-wZ}m?67AfJ&YoZOxX~l%1
    zGpj4-&#u0BjHH@g3!Y`?VuFHssAOI$N?MWj{2xd5LELSqz7yrzH66!t
    zTeoRzMDkHVtEz};poW7sqNAwzM&%w+u}=OiT-^v-+ne09V(6uv$vbfZx;!n~1$5G>iRXWFq3~si5EfhfML7c$n=N)+uPTfSHX*0xHa`4iBf|
    z-cq|IY+l6)>-Mm@F!x}S$n-~BV`8C>NE9kGokDuBN2?JHH$Sv|dyh_==*t)@gbIcR
    zIcVjc0~s-f!4yL_r{2aw4I5(H6zoj|)u`kpW=Kq3#2}HFpy~Jhbkf>qC{?F^2v>~C
    zU?S|%i-?@58Vy=R^q_FD?5K&Tx2j8Q+G_Bmvr4p|xLWu7(q=`^0EaS}WH_{>dv2V&hRF;^Bs7WiPaBxr40OOh3v^`N#ik+8O9=-9!0wB{=iIC{
    zvQ(;8E|A<)*E>~_Ys5aNP0EqAW%Flq0&f5XYGXO>YyON*RjGuYRgvy{w!iH+ZF-S*
    zkpHoHJw!Tl4KP&7e%9fHBzq7fLrA%vrJ()37N;;+Sw1?+RcM4Tx=Wo}v!SBQlq;0U
    z+u0#c^CGsNY>pwed(B!GxNemi#cY8~q81p2uq*`9sdjd>po_hGMF7*4wt>C%n;*h|bx5%eTfwe#Y)R
    zg=zDm{9_8Si(HnKU3|^1vbVj${q~#typu8eoUp9O90YVkq(`!@2KiSjK?7wOSNY5V
    z00C#0^<>{$zk@CbypyKX$(Utav95FMCFEs&|8XT_wM&sR19{Buy3Wr9jhc@p@B3XS
    zaa4&DxJoEi@pHt`mm&~Kzl&QkAV}9*p{#~AI?x+y(X52K26;{gZLWrxoT9<$VBq5H
    zPt^E9JHYx#MOjpvTH>lnjoeealci%xCYQRJHkS*-^t)<6Q@i%61U1N7_6fz@@nmx^
    z_DDcvC~0i1E4v`%Qa4m{64>b=D`6-!KLeAXhTDI3Lt9v(xuBb^j;=&RES)t&-sfvF
    za!{)~BRaCFHV5pYQ=+b2ZPta|#l*Mg0<8d!zr%n~rXxF83GBJXU~|x%vh_J}+9~A4
    zXqV#;p-7#66^}LU43)W~4KQJiqYZu9G}f;mc}W8I`t2h$sCzG}pn;`d?~EMjP&t=9
    zCZ}C{%}oZIwOzh@Q@jYyF_bDt_Hmp|#p9C*5dXw<;4#Wn$FqhQsFfN@yAg7TgHb@A
    z%u_a3+#>P&vErShIwMxT3rP&#^3rCUUDN}Of|uOF!tJTIp;WZ!7EoG=t8zL6x89O?
    z04FwnGt?!uEb2IUml()-O5&2LMRj)K{3jeh!BA;89u^c?po0*bggFM8rASyM;6}K;
    z$+rf}i$Nx=;&UzoM>L6pTX)~mS+@MD>xI2m0#SU3RC~yTe-czOR&lg5qJWJJ?!7Ip
    zwlW&y5=YKCpF3&0SY)@ar|rC;r+#8ps&EYO5Xke8rLPjLx{W&_?uhf5w8lB*k1UYe
    zlt6_h>MY9XHd3abnfS(;w){gc3Hu0TUL~PJx(L}39PWaJD}hmKKwGY}d+o~VUc0ol
    zh(r{)v)!SuOsJ2Ev3jnG1dF6NWGf~4Pg$j>2lhkhZYqKE8QFxlHF(5%qGCj6CfMLO
    zO->w1gzFn?^$4ZdyD9nSOG+`c+e1@9Q-L}tctE40fLTP+wcuF=%fBM?2_n%wZm(a(
    z9?*n1IcD=NF&+1>(%3>-MvX7CqoT51KuvPmh@w@o8uo~GF>)!NYKTpx}Np9Qk9qm-n%LVeY48R25ayN%2YDi2+WHjGK2a2hmI1(uL@3-*FBfty6a
    zv~ZV76baOI1}Sx;-8`lD(>snwl!hb-gLGp#B9~W3!xb@eTt=PUnOs0iVw;|_1Wgr9
    zYfw=n?42dk^+d&+D(8EgvJbI#wgIk!7}=s~w7d;9?5L2X*ts)9cSx*9Oc-32U3)N-
    zC)(exhz+j|pGC-c^1TVM<-ddS1!@TA?@?X^ff#JLY-ifC1o$}wUb3V1+xDcX1Es`?
    zF9G&@a4f9qZQs!xg3ZjY@&}PM{spT0M|`=_E1Z~FRzz#IKPxV%=kgFXy>qRYQ}iLy
    z4hsrbG^L8Gfwr|ec>7I8n}wqFh|0=6j0V)drC3i0lz(U-hB$-pT|Qrzz%c22h}Dq2
    zw$1ZDNWgQKXG!c^bB^o4d9tBhj>Y-qu8ahE3l1q^-<2U_(aVV2=J*XHx*e+0jHYkQ
    zN{_Sz&0@;6$zwo-R-t)VG%hE8P38JvJEIs0n9=t3n;ybD(DN~S_^Ed3P)u2l6sXf7
    zaY4g-kY;Gw+i${RcbfQ|5+wv()*s|>PR`soJ&{a5vKLsS1hZ!#+7Z&$mg$&7o;dBQ
    zK?_HC>phHW3inSJ?w?_h1=(zcP%-RZ
    zNEuYYI8+=%d8aR7lr8LrD;^o!Wn!KuEVklAa_K<~=B}6;}vPRZ~+snqsKU
    zc7+JHZcTgH>A(04I5=o@TO9`nyV?qQ$c%&_AuvriG{;FY6chEa8$vbo}
    z56a7F?~>Ycd%vE)qh(f-2@EO0_)?tjPP{?!<%kT6<+
    zkg}OG`z2G7e|h0@bZz#h9*uElV&NYn1m_#ze-%*&oS>SsBccx#YO7&T=t4u
    sP^^%%R%PA!_xT~Nc|!#szQE#sFEfrUDJd_?)C*n=3m^AI3T0jWf8(gvhX4Qo
    
    diff --git a/external/public-domain/xz/dist/po/cs.po b/external/public-domain/xz/dist/po/cs.po
    deleted file mode 100644
    index 237a9ab73..000000000
    --- a/external/public-domain/xz/dist/po/cs.po
    +++ /dev/null
    @@ -1,989 +0,0 @@
    -# XZ Utils Czech translation
    -# This file is put in the public domain.
    -# Marek Černocký , 2010.
    -#
    -msgid ""
    -msgstr ""
    -"Project-Id-Version: xz-utils\n"
    -"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
    -"POT-Creation-Date: 2015-02-26 16:55+0200\n"
    -"PO-Revision-Date: 2010-12-03 11:32+0100\n"
    -"Last-Translator: Marek Černocký \n"
    -"Language-Team: Czech \n"
    -"Language: cs\n"
    -"MIME-Version: 1.0\n"
    -"Content-Type: text/plain; charset=UTF-8\n"
    -"Content-Transfer-Encoding: 8bit\n"
    -"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2\n"
    -"X-Poedit-Language: Czech\n"
    -"X-Poedit-SourceCharset: utf-8\n"
    -
    -#: src/xz/args.c:63
    -#, c-format
    -msgid "%s: Invalid argument to --block-list"
    -msgstr ""
    -
    -#: src/xz/args.c:73
    -#, c-format
    -msgid "%s: Too many arguments to --block-list"
    -msgstr ""
    -
    -#: src/xz/args.c:102
    -msgid "0 can only be used as the last element in --block-list"
    -msgstr ""
    -
    -#: src/xz/args.c:406
    -#, c-format
    -msgid "%s: Unknown file format type"
    -msgstr "%s: Neznámý typ formátu souboru"
    -
    -#: src/xz/args.c:429 src/xz/args.c:437
    -#, c-format
    -msgid "%s: Unsupported integrity check type"
    -msgstr "%s: Neznámý typ kontroly integrity"
    -
    -#: src/xz/args.c:473
    -msgid "Only one file can be specified with `--files' or `--files0'."
    -msgstr "Spolu s pÅ™epínaÄi „--files“ nebo „--files0“ může být zadán pouze jeden soubor"
    -
    -#: src/xz/args.c:541
    -#, c-format
    -msgid "The environment variable %s contains too many arguments"
    -msgstr "Proměnná prostředí %s obsahuje příliš mnoho argumentů"
    -
    -#: src/xz/coder.c:110
    -msgid "Maximum number of filters is four"
    -msgstr "Maximální poÄet filtrů je ÄtyÅ™i"
    -
    -#: src/xz/coder.c:129
    -msgid "Memory usage limit is too low for the given filter setup."
    -msgstr "Omezení použitelné paměti je příliš malé pro dané nastavení filtru."
    -
    -#: src/xz/coder.c:159
    -msgid "Using a preset in raw mode is discouraged."
    -msgstr "Použití přednastavení v režimu raw je nevhodné."
    -
    -#: src/xz/coder.c:161
    -msgid "The exact options of the presets may vary between software versions."
    -msgstr "Přesné volby u přednastavení se mohou lišit mezi různými verzemi softwaru."
    -
    -#: src/xz/coder.c:184
    -msgid "The .lzma format supports only the LZMA1 filter"
    -msgstr "Formát .lzma podporuje pouze filtr LZMA1"
    -
    -#: src/xz/coder.c:192
    -msgid "LZMA1 cannot be used with the .xz format"
    -msgstr "LZMA1 nelze použít s formátem .xz"
    -
    -#: src/xz/coder.c:209
    -msgid "The filter chain is incompatible with --flush-timeout"
    -msgstr ""
    -
    -#: src/xz/coder.c:215
    -msgid "Switching to single-threaded mode due to --flush-timeout"
    -msgstr ""
    -
    -#: src/xz/coder.c:234
    -#, c-format
    -msgid "Using up to % threads."
    -msgstr ""
    -
    -#: src/xz/coder.c:247
    -msgid "Unsupported filter chain or filter options"
    -msgstr "Nepodporovaný omezující filtr nebo volby filtru"
    -
    -#: src/xz/coder.c:255
    -#, c-format
    -msgid "Decompression will need %s MiB of memory."
    -msgstr "Dekomprimace bude vyžadovat %s MiB paměti."
    -
    -#: src/xz/coder.c:290
    -#, fuzzy, c-format
    -msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
    -msgstr "PÅ™izpůsobit velikost slovníku LZMA%c z %s MiB na %s MiB, tak aby nebylo pÅ™ekroÄeno omezení použitelné pamÄ›ti %s MiB"
    -
    -#: src/xz/coder.c:344
    -#, c-format
    -msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
    -msgstr "PÅ™izpůsobit velikost slovníku LZMA%c z %s MiB na %s MiB, tak aby nebylo pÅ™ekroÄeno omezení použitelné pamÄ›ti %s MiB"
    -
    -#: src/xz/file_io.c:89 src/xz/file_io.c:93 src/xz/file_io.c:101
    -#, fuzzy, c-format
    -msgid "Error creating a pipe: %s"
    -msgstr "%s: Chyba pÅ™i Ätení názvů souborů: %s"
    -
    -#: src/xz/file_io.c:179
    -#, fuzzy, c-format
    -msgid "%s: poll() failed: %s"
    -msgstr "%s: Selhalo zavření souboru: %s"
    -
    -#. TRANSLATORS: When compression or decompression finishes,
    -#. and xz is going to remove the source file, xz first checks
    -#. if the source file still exists, and if it does, does its
    -#. device and inode numbers match what xz saw when it opened
    -#. the source file. If these checks fail, this message is
    -#. shown, %s being the filename, and the file is not deleted.
    -#. The check for device and inode numbers is there, because
    -#. it is possible that the user has put a new file in place
    -#. of the original file, and in that case it obviously
    -#. shouldn't be removed.
    -#: src/xz/file_io.c:249
    -#, c-format
    -msgid "%s: File seems to have been moved, not removing"
    -msgstr "%s: Vypadá to, že soubor byl přesunut, proto nebude odstraněn"
    -
    -#: src/xz/file_io.c:256 src/xz/file_io.c:769
    -#, c-format
    -msgid "%s: Cannot remove: %s"
    -msgstr "%s: Nelze odstranit: %s"
    -
    -#: src/xz/file_io.c:281
    -#, c-format
    -msgid "%s: Cannot set the file owner: %s"
    -msgstr "%s: Nelze nastavit vlastníka souboru: %s"
    -
    -#: src/xz/file_io.c:287
    -#, c-format
    -msgid "%s: Cannot set the file group: %s"
    -msgstr "%s: Nelze nastavit skupinu souboru: %s"
    -
    -#: src/xz/file_io.c:306
    -#, c-format
    -msgid "%s: Cannot set the file permissions: %s"
    -msgstr "%s: Nelze nastavit oprávnění souboru: %s"
    -
    -#: src/xz/file_io.c:416
    -#, fuzzy, c-format
    -msgid "Error getting the file status flags from standard input: %s"
    -msgstr "Chyba při obnovení příznaku O_APPEND na standardní výstup: %s"
    -
    -#: src/xz/file_io.c:470 src/xz/file_io.c:532
    -#, c-format
    -msgid "%s: Is a symbolic link, skipping"
    -msgstr "%s: Jedná se o symbolický odkaz, vynechává se"
    -
    -#: src/xz/file_io.c:561
    -#, c-format
    -msgid "%s: Is a directory, skipping"
    -msgstr "%s: Jedná se o složku, vynechává se"
    -
    -#: src/xz/file_io.c:567
    -#, c-format
    -msgid "%s: Not a regular file, skipping"
    -msgstr "%s: Nejedná se o běžný soubor, vynechává se"
    -
    -#: src/xz/file_io.c:584
    -#, c-format
    -msgid "%s: File has setuid or setgid bit set, skipping"
    -msgstr "%s: Soubor má nastavený bit setuid nebo setgid, vynechává se"
    -
    -#: src/xz/file_io.c:591
    -#, c-format
    -msgid "%s: File has sticky bit set, skipping"
    -msgstr "%s: Soubor má nastavený bit sticky, vynechává se"
    -
    -#: src/xz/file_io.c:598
    -#, c-format
    -msgid "%s: Input file has more than one hard link, skipping"
    -msgstr "%s: Vstupní soubor má více než jeden pevný odkaz, vynechává se"
    -
    -#: src/xz/file_io.c:678
    -#, fuzzy, c-format
    -msgid "Error restoring the status flags to standard input: %s"
    -msgstr "Chyba při obnovení příznaku O_APPEND na standardní výstup: %s"
    -
    -#: src/xz/file_io.c:727
    -#, fuzzy, c-format
    -msgid "Error getting the file status flags from standard output: %s"
    -msgstr "Chyba při obnovení příznaku O_APPEND na standardní výstup: %s"
    -
    -#: src/xz/file_io.c:905
    -#, c-format
    -msgid "Error restoring the O_APPEND flag to standard output: %s"
    -msgstr "Chyba při obnovení příznaku O_APPEND na standardní výstup: %s"
    -
    -#: src/xz/file_io.c:917
    -#, c-format
    -msgid "%s: Closing the file failed: %s"
    -msgstr "%s: Selhalo zavření souboru: %s"
    -
    -#: src/xz/file_io.c:953 src/xz/file_io.c:1179
    -#, c-format
    -msgid "%s: Seeking failed when trying to create a sparse file: %s"
    -msgstr "%s: Selhalo nastavení pozice při pokusu o vytvoření souboru řídké matice: %s"
    -
    -#: src/xz/file_io.c:1048
    -#, c-format
    -msgid "%s: Read error: %s"
    -msgstr "%s: Chyba Ätení: %s"
    -
    -#: src/xz/file_io.c:1068
    -#, c-format
    -msgid "%s: Error seeking the file: %s"
    -msgstr "%s: Chyba při posunu v rámci souboru: %s"
    -
    -#: src/xz/file_io.c:1078
    -#, c-format
    -msgid "%s: Unexpected end of file"
    -msgstr "%s: NeoÄekávaný konec souboru"
    -
    -#: src/xz/file_io.c:1137
    -#, c-format
    -msgid "%s: Write error: %s"
    -msgstr "%s: Chyba zápisu: %s"
    -
    -#: src/xz/hardware.c:107
    -msgid "Disabled"
    -msgstr "Vypnuto"
    -
    -#. TRANSLATORS: Test with "xz --info-memory" to see if
    -#. the alignment looks nice.
    -#: src/xz/hardware.c:126
    -msgid "Total amount of physical memory (RAM): "
    -msgstr "Celkové množství fyzické paměti (RAM):     "
    -
    -#: src/xz/hardware.c:128
    -msgid "Memory usage limit for compression:    "
    -msgstr "Omezení použitelné paměti pro komprimaci:  "
    -
    -#: src/xz/hardware.c:130
    -msgid "Memory usage limit for decompression:  "
    -msgstr "Omezení použitelné paměti pro dekomprimaci:"
    -
    -#. TRANSLATORS: Indicates that there is no integrity check.
    -#. This string is used in tables, so the width must not
    -#. exceed ten columns with a fixed-width font.
    -#: src/xz/list.c:65
    -msgid "None"
    -msgstr "žádná"
    -
    -#. TRANSLATORS: Indicates that integrity check name is not known,
    -#. but the Check ID is known (here 2). This and other "Unknown-N"
    -#. strings are used in tables, so the width must not exceed ten
    -#. columns with a fixed-width font. It's OK to omit the dash if
    -#. you need space for one extra letter, but don't use spaces.
    -#: src/xz/list.c:72
    -msgid "Unknown-2"
    -msgstr "neznámá-2"
    -
    -#: src/xz/list.c:73
    -msgid "Unknown-3"
    -msgstr "neznámá-3"
    -
    -#: src/xz/list.c:75
    -msgid "Unknown-5"
    -msgstr "neznámá-5"
    -
    -#: src/xz/list.c:76
    -msgid "Unknown-6"
    -msgstr "neznámá-6"
    -
    -#: src/xz/list.c:77
    -msgid "Unknown-7"
    -msgstr "neznámá-7"
    -
    -#: src/xz/list.c:78
    -msgid "Unknown-8"
    -msgstr "neznámá-8"
    -
    -#: src/xz/list.c:79
    -msgid "Unknown-9"
    -msgstr "neznámá-9"
    -
    -#: src/xz/list.c:81
    -msgid "Unknown-11"
    -msgstr "neznámá-11"
    -
    -#: src/xz/list.c:82
    -msgid "Unknown-12"
    -msgstr "neznámá-12"
    -
    -#: src/xz/list.c:83
    -msgid "Unknown-13"
    -msgstr "neznámá-13"
    -
    -#: src/xz/list.c:84
    -msgid "Unknown-14"
    -msgstr "neznámá-14"
    -
    -#: src/xz/list.c:85
    -msgid "Unknown-15"
    -msgstr "neznámá-15"
    -
    -#: src/xz/list.c:153
    -#, c-format
    -msgid "%s: File is empty"
    -msgstr "%s: Soubor je prázdný"
    -
    -#: src/xz/list.c:158
    -#, c-format
    -msgid "%s: Too small to be a valid .xz file"
    -msgstr "%s: Je příliš malý na to, aby to mohl být platný soubor .xz"
    -
    -#. TRANSLATORS: These are column headings. From Strms (Streams)
    -#. to Ratio, the columns are right aligned. Check and Filename
    -#. are left aligned. If you need longer words, it's OK to
    -#. use two lines here. Test with "xz -l foo.xz".
    -#: src/xz/list.c:671
    -msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
    -msgstr "Proud   Bloky      Komprim    Nekomprim  Poměr  Kontrl  Název souboru"
    -
    -#: src/xz/list.c:711
    -#, c-format
    -msgid "  Streams:            %s\n"
    -msgstr "  Proudů:                  %s\n"
    -
    -#: src/xz/list.c:713
    -#, c-format
    -msgid "  Blocks:             %s\n"
    -msgstr "  Bloků:                   %s\n"
    -
    -#: src/xz/list.c:715
    -#, c-format
    -msgid "  Compressed size:    %s\n"
    -msgstr "  Komprimovaná velikost:   %s\n"
    -
    -#: src/xz/list.c:718
    -#, c-format
    -msgid "  Uncompressed size:  %s\n"
    -msgstr "  Nekomprimovaná velikost: %s\n"
    -
    -#: src/xz/list.c:721
    -#, c-format
    -msgid "  Ratio:              %s\n"
    -msgstr "  Poměr komprimace:        %s\n"
    -
    -#: src/xz/list.c:723
    -#, c-format
    -msgid "  Check:              %s\n"
    -msgstr "  Typ kontroly:            %s\n"
    -
    -#: src/xz/list.c:724
    -#, c-format
    -msgid "  Stream padding:     %s\n"
    -msgstr "  Zarovnání proudu:        %s\n"
    -
    -#. TRANSLATORS: The second line is column headings. All except
    -#. Check are right aligned; Check is left aligned. Test with
    -#. "xz -lv foo.xz".
    -#: src/xz/list.c:752
    -msgid ""
    -"  Streams:\n"
    -"    Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding"
    -msgstr ""
    -"  Proudy:\n"
    -"     Proud     Bloky     KomprPozice   NekomprPozice   KomprVelikost NekomprVelikost  Poměr  Kontrola   Zarovnání"
    -
    -#. TRANSLATORS: The second line is column headings. All
    -#. except Check are right aligned; Check is left aligned.
    -#: src/xz/list.c:807
    -#, c-format
    -msgid ""
    -"  Blocks:\n"
    -"    Stream     Block      CompOffset    UncompOffset       TotalSize      UncompSize  Ratio  Check"
    -msgstr ""
    -"  Bloky:\n"
    -"     Proud      Blok     KomprPozice   NekomprPozice    CelkVelikost NekomprVelikost  Poměr  Kontrola"
    -
    -#. TRANSLATORS: These are additional column headings
    -#. for the most verbose listing mode. CheckVal
    -#. (Check value), Flags, and Filters are left aligned.
    -#. Header (Block Header Size), CompSize, and MemUsage
    -#. are right aligned. %*s is replaced with 0-120
    -#. spaces to make the CheckVal column wide enough.
    -#. Test with "xz -lvv foo.xz".
    -#: src/xz/list.c:819
    -#, c-format
    -msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
    -msgstr "   KontrHod %*s HlaviÄ  Příznaky     KomprVel    PoužiPam  Filtry"
    -
    -#: src/xz/list.c:897 src/xz/list.c:1072
    -#, c-format
    -msgid "  Memory needed:      %s MiB\n"
    -msgstr "  Potřebná paměť:          %s MiB\n"
    -
    -#: src/xz/list.c:899 src/xz/list.c:1074
    -#, c-format
    -msgid "  Sizes in headers:   %s\n"
    -msgstr "  Velikosti v hlaviÄkách:  %s\n"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "Yes"
    -msgstr "Ano"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "No"
    -msgstr "Ne"
    -
    -#: src/xz/list.c:901 src/xz/list.c:1076
    -#, c-format
    -msgid "  Minimum XZ Utils version: %s\n"
    -msgstr ""
    -
    -#. TRANSLATORS: %s is an integer. Only the plural form of this
    -#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
    -#: src/xz/list.c:1051
    -#, c-format
    -msgid "%s file\n"
    -msgid_plural "%s files\n"
    -msgstr[0] "%s soubor\n"
    -msgstr[1] "%s soubory\n"
    -msgstr[2] "%s souborů\n"
    -
    -#: src/xz/list.c:1064
    -msgid "Totals:"
    -msgstr "Celkem:"
    -
    -#: src/xz/list.c:1065
    -#, c-format
    -msgid "  Number of files:    %s\n"
    -msgstr "  PoÄet souborů:           %s\n"
    -
    -#: src/xz/list.c:1140
    -msgid "--list works only on .xz files (--format=xz or --format=auto)"
    -msgstr "--list pracuje pouze se soubory .xz (--format=xz nebo --format=auto)"
    -
    -#: src/xz/list.c:1146
    -msgid "--list does not support reading from standard input"
    -msgstr "--list nepodporuje Ätení ze standardního vstupu"
    -
    -#: src/xz/main.c:89
    -#, c-format
    -msgid "%s: Error reading filenames: %s"
    -msgstr "%s: Chyba pÅ™i Ätení názvů souborů: %s"
    -
    -#: src/xz/main.c:96
    -#, c-format
    -msgid "%s: Unexpected end of input when reading filenames"
    -msgstr "%s: NeoÄekávaný konec vstupu pÅ™i Ätení názvů souborů"
    -
    -#: src/xz/main.c:120
    -#, c-format
    -msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?"
    -msgstr "%s: Byl nalezen nulový znak pÅ™i Ätení názvů souborů; nechtÄ›li jste náhodou použít „--files0“ místo „--files“?"
    -
    -#: src/xz/main.c:174
    -msgid "Compression and decompression with --robot are not supported yet."
    -msgstr "Komprimace a dekomprimace s pÅ™epínaÄem --robot není zatím podporovaná."
    -
    -#: src/xz/main.c:231
    -msgid "Cannot read data from standard input when reading filenames from standard input"
    -msgstr "Ze standardního vstupu nelze Äíst data, když se ze standardního vstupu naÄítají názvy souborů"
    -
    -#. TRANSLATORS: This is the program name in the beginning
    -#. of the line in messages. Usually it becomes "xz: ".
    -#. This is a translatable string because French needs
    -#. a space before a colon.
    -#: src/xz/message.c:713
    -#, c-format
    -msgid "%s: "
    -msgstr ""
    -
    -#: src/xz/message.c:776 src/xz/message.c:826
    -msgid "Internal error (bug)"
    -msgstr "Interní chyba"
    -
    -#: src/xz/message.c:783
    -msgid "Cannot establish signal handlers"
    -msgstr "Nelze ustanovit ovladaÄ signálu"
    -
    -#: src/xz/message.c:792
    -msgid "No integrity check; not verifying file integrity"
    -msgstr "Žádná kontrola integrity; integrita souboru se nebude ověřovat"
    -
    -#: src/xz/message.c:795
    -msgid "Unsupported type of integrity check; not verifying file integrity"
    -msgstr "Nepodporovaný typ kontroly integrity; integrita souboru se nebude ověřovat"
    -
    -#: src/xz/message.c:802
    -msgid "Memory usage limit reached"
    -msgstr "Dosaženo omezení použitelné paměti"
    -
    -#: src/xz/message.c:805
    -msgid "File format not recognized"
    -msgstr "Formát souboru nebyl rozpoznán"
    -
    -#: src/xz/message.c:808
    -msgid "Unsupported options"
    -msgstr "Nepodporovaná volba"
    -
    -#: src/xz/message.c:811
    -msgid "Compressed data is corrupt"
    -msgstr "Komprimovaná data jsou poškozená"
    -
    -#: src/xz/message.c:814
    -msgid "Unexpected end of input"
    -msgstr "NeoÄekávaný konec vstupu"
    -
    -#: src/xz/message.c:847
    -#, fuzzy, c-format
    -msgid "%s MiB of memory is required. The limiter is disabled."
    -msgstr "Je vyžadováno %s MiB paměti. Limit je %s."
    -
    -#: src/xz/message.c:875
    -#, c-format
    -msgid "%s MiB of memory is required. The limit is %s."
    -msgstr "Je vyžadováno %s MiB paměti. Limit je %s."
    -
    -#: src/xz/message.c:1042
    -#, c-format
    -msgid "%s: Filter chain: %s\n"
    -msgstr "%s: Omezující filtr: %s\n"
    -
    -#: src/xz/message.c:1052
    -#, c-format
    -msgid "Try `%s --help' for more information."
    -msgstr "Zkuste „%s --help“ pro více informací"
    -
    -#: src/xz/message.c:1078
    -#, c-format
    -msgid ""
    -"Usage: %s [OPTION]... [FILE]...\n"
    -"Compress or decompress FILEs in the .xz format.\n"
    -"\n"
    -msgstr ""
    -"Použití: %s [PŘEPÃNAÄŒ]... [SOUBOR]...\n"
    -"Komprimuje nebo dekomprimuje SOUBORy ve formátu xz.\n"
    -"\n"
    -
    -#: src/xz/message.c:1085
    -msgid "Mandatory arguments to long options are mandatory for short options too.\n"
    -msgstr "Povinné argumenty pro dlouhé pÅ™epínaÄe jsou povinné rovněž pro krátké pÅ™epínaÄe.\n"
    -
    -#: src/xz/message.c:1089
    -msgid " Operation mode:\n"
    -msgstr "OperaÄní režim:\n"
    -
    -#: src/xz/message.c:1092
    -msgid ""
    -"  -z, --compress      force compression\n"
    -"  -d, --decompress    force decompression\n"
    -"  -t, --test          test compressed file integrity\n"
    -"  -l, --list          list information about .xz files"
    -msgstr ""
    -" -z, --compress        provést komprimaci\n"
    -" -d, --decompress      provést dekomprimaci\n"
    -" -t, --test            testovat integritu komprimovaného souboru\n"
    -" -l, --list            vypsat informace o souborech .xz"
    -
    -#: src/xz/message.c:1098
    -msgid ""
    -"\n"
    -" Operation modifiers:\n"
    -msgstr ""
    -"\n"
    -"Modifikátory operací:\n"
    -
    -#: src/xz/message.c:1101
    -msgid ""
    -"  -k, --keep          keep (don't delete) input files\n"
    -"  -f, --force         force overwrite of output file and (de)compress links\n"
    -"  -c, --stdout        write to standard output and don't delete input files"
    -msgstr ""
    -" -k, --keep            zachovat (nemazat) vstupní soubory\n"
    -" -f, --force           vynutit přepis výstupního souboru a de/komprimovat odkazy\n"
    -" -c, --stdout          zapisovat na standardní výstup a nemazat vstupní soubory"
    -
    -#: src/xz/message.c:1107
    -msgid ""
    -"      --single-stream decompress only the first stream, and silently\n"
    -"                      ignore possible remaining input data"
    -msgstr ""
    -
    -#: src/xz/message.c:1110
    -msgid ""
    -"      --no-sparse     do not create sparse files when decompressing\n"
    -"  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
    -"      --files[=FILE]  read filenames to process from FILE; if FILE is\n"
    -"                      omitted, filenames are read from the standard input;\n"
    -"                      filenames must be terminated with the newline character\n"
    -"      --files0[=FILE] like --files but use the null character as terminator"
    -msgstr ""
    -"     --no-sparse       nevytvářet při dekomprimaci soubory řídkých matic\n"
    -" -S, --suffix=.PRIP    použít u komprimovaných souborů příponu „.PRIP“\n"
    -"     --files[=SOUBOR]  Äíst názvy souborů, které se mají zpracovat, ze SOUBORu;\n"
    -"                       pokud není SOUBOR zadán, Äte se ze standardního vstupu;\n"
    -"                       názvy souborů musí být zakonÄeny znakem nového řádku\n"
    -"     --files0[=SOUBOR] stejné jako --files, ale použít k zakonÄování nulový znak"
    -
    -#: src/xz/message.c:1119
    -msgid ""
    -"\n"
    -" Basic file format and compression options:\n"
    -msgstr ""
    -"\n"
    -"Základní pÅ™epínaÄe pro formát souboru a komprimaci:\n"
    -
    -#: src/xz/message.c:1121
    -msgid ""
    -"  -F, --format=FMT    file format to encode or decode; possible values are\n"
    -"                      `auto' (default), `xz', `lzma', and `raw'\n"
    -"  -C, --check=CHECK   integrity check type: `none' (use with caution),\n"
    -"                      `crc32', `crc64' (default), or `sha256'"
    -msgstr ""
    -" -F, --format=FORMÃT   formát souboru k zakódování nebo dekódování; možné\n"
    -"                       hodnoty jsou „auto“ (výchozí), „xz“, „lzma“ a „raw“\n"
    -" -C, --check=KONTROLA  typ kontroly integrity: „none“ (používejte s rozmyslem),\n"
    -"                       „crc32“, „crc64“ (výchozí) nebo „sha256“"
    -
    -#: src/xz/message.c:1126
    -msgid "      --ignore-check  don't verify the integrity check when decompressing"
    -msgstr ""
    -
    -#: src/xz/message.c:1130
    -msgid ""
    -"  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
    -"                      decompressor memory usage into account before using 7-9!"
    -msgstr ""
    -" -0 .. -9              přednastavení komprimace; výchozí je 6; než použijete\n"
    -"                       hodnoty 7 – 9, vezměte do úvahy množství použité paměti"
    -
    -#: src/xz/message.c:1134
    -msgid ""
    -"  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
    -"                      does not affect decompressor memory requirements"
    -msgstr ""
    -" -e, --extreme         zkusit zlepÅ¡it pomÄ›r komprimace využitím více Äasu\n"
    -"                       procesoru; nemá vliv na paměťové nároky dekomprimace"
    -
    -#: src/xz/message.c:1138
    -msgid ""
    -"  -T, --threads=NUM   use at most NUM threads; the default is 1; set to 0\n"
    -"                      to use as many threads as there are processor cores"
    -msgstr ""
    -
    -#: src/xz/message.c:1143
    -msgid ""
    -"      --block-size=SIZE\n"
    -"                      start a new .xz block after every SIZE bytes of input;\n"
    -"                      use this to set the block size for threaded compression"
    -msgstr ""
    -
    -#: src/xz/message.c:1147
    -msgid ""
    -"      --block-list=SIZES\n"
    -"                      start a new .xz block after the given comma-separated\n"
    -"                      intervals of uncompressed data"
    -msgstr ""
    -
    -#: src/xz/message.c:1151
    -msgid ""
    -"      --flush-timeout=TIMEOUT\n"
    -"                      when compressing, if more than TIMEOUT milliseconds has\n"
    -"                      passed since the previous flush and reading more input\n"
    -"                      would block, all pending data is flushed out"
    -msgstr ""
    -
    -#: src/xz/message.c:1157
    -#, no-c-format
    -msgid ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      set memory usage limit for compression, decompression,\n"
    -"                      or both; LIMIT is in bytes, % of RAM, or 0 for defaults"
    -msgstr ""
    -"     --memlimit-compress=LIMIT\n"
    -"     --memlimit-decompress=LIMIT\n"
    -" -M, --memlimit=LIMIT\n"
    -"                       nastaví omezení použitelné paměti pro komprimaci,\n"
    -"                       dekomprimaci nebo obojí; LIMIT je v bajtech, % z paměti\n"
    -"                       RAM nebo 0 pro výchozí"
    -
    -#: src/xz/message.c:1164
    -msgid ""
    -"      --no-adjust     if compression settings exceed the memory usage limit,\n"
    -"                      give an error instead of adjusting the settings downwards"
    -msgstr ""
    -"     --no-adjust       pokud nastavení komprimace přesáhne omezení použitelné\n"
    -"                       paměti, předat chybu namísto snížení nastavení"
    -
    -#: src/xz/message.c:1170
    -msgid ""
    -"\n"
    -" Custom filter chain for compression (alternative for using presets):"
    -msgstr ""
    -"\n"
    -"Vlastní omezující filtr pro komprimaci (alternativa k použití přednastavených):"
    -
    -#: src/xz/message.c:1179
    -msgid ""
    -"\n"
    -"  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
    -"  --lzma2[=OPTS]      more of the following options (valid values; default):\n"
    -"                        preset=PRE reset options to a preset (0-9[e])\n"
    -"                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=NUM     number of literal context bits (0-4; 3)\n"
    -"                        lp=NUM     number of literal position bits (0-4; 0)\n"
    -"                        pb=NUM     number of position bits (0-4; 2)\n"
    -"                        mode=MODE  compression mode (fast, normal; normal)\n"
    -"                        nice=NUM   nice length of a match (2-273; 64)\n"
    -"                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  maximum search depth; 0=automatic (default)"
    -msgstr ""
    -"\n"
    -" --lzma1[=VOLBY]       LZMA1 nebo LZMA2; VOLBY je Äárkou oddÄ›lovaný seznam žádné\n"
    -" --lzma2[=VOLBY]       nebo více následujících voleb (platné hodnoty; výchozí):\n"
    -"                         preset=PŘE změnit volby na PŘEdnastavené (0 – 9[e])\n"
    -"                         dict=POČ   velikost slovníku (4 KiB – 1536 MiB; 8 MiB)\n"
    -"                         lc=POÄŒ     poÄet kontextových bitů literálu (0 – 4; 3)\n"
    -"                         lp=POÄŒ     poÄet poziÄních bitů literálu (0 – 4; 0)\n"
    -"                         pb=POÄŒ     poÄet poziÄních bitů (0 – 4; 2)\n"
    -"                         mode=REŽIM režim komprimace (fast, normal; normal)\n"
    -"                         nice=NUM   příznivá délka shody (2 – 273; 64)\n"
    -"                         mf=NÃZEV   hledání shod (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                         depth=POČ  maximální hloubka prohledávání;\n"
    -"                                    0 = automaticky (výchozí)"
    -
    -#: src/xz/message.c:1194
    -msgid ""
    -"\n"
    -"  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
    -"  --powerpc[=OPTS]    PowerPC BCJ filter (big endian only)\n"
    -"  --ia64[=OPTS]       IA-64 (Itanium) BCJ filter\n"
    -"  --arm[=OPTS]        ARM BCJ filter (little endian only)\n"
    -"  --armthumb[=OPTS]   ARM-Thumb BCJ filter (little endian only)\n"
    -"  --sparc[=OPTS]      SPARC BCJ filter\n"
    -"                      Valid OPTS for all BCJ filters:\n"
    -"                        start=NUM  start offset for conversions (default=0)"
    -msgstr ""
    -"\n"
    -" --x86[=VOLBY]         Filtr x86 BCJ (32bitový a 64bitový)\n"
    -" --powerpc[=VOLBY]     Filtr PowerPC BCJ (pouze big endian)\n"
    -" --ia64[=VOLBY]        Filtr IA64 (Itanium) BCJ\n"
    -" --arm[=VOLBY]         Filtr ARM BCJ (pouze little endian)\n"
    -" --armthumb[=VOLBY]    Filtr ARM-Thumb BCJ (pouze little endian)\n"
    -" --sparc[=VOLBY]       Filtr SPARC BCJ\n"
    -"                       Platné volby pro všechny filtry BCJ:\n"
    -"                         start=POÄŒ  poÄáteÄní posun pro pÅ™evody (výchozí=0)"
    -
    -#: src/xz/message.c:1206
    -msgid ""
    -"\n"
    -"  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
    -"                        dist=NUM   distance between bytes being subtracted\n"
    -"                                   from each other (1-256; 1)"
    -msgstr ""
    -"\n"
    -" --delta[=VOLBY]       Filtr Delta; platné VOLBY (platné hodnoty; výchozí):\n"
    -"                         dist=POÄŒ   vzdálenost mezi bajty, které jsou odeÄítány\n"
    -"                                    jeden od druhého (1 – 256; 1)"
    -
    -#: src/xz/message.c:1214
    -msgid ""
    -"\n"
    -" Other options:\n"
    -msgstr ""
    -"\n"
    -" Ostatní pÅ™epínaÄe:\n"
    -
    -#: src/xz/message.c:1217
    -msgid ""
    -"  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
    -"  -v, --verbose       be verbose; specify twice for even more verbose"
    -msgstr ""
    -" -q, --quiet           potlaÄit varování; zadáním dvakrát, potlaÄíte i chyby\n"
    -" -v, --verbose         podrobnější zprávy; zadáním dvakrát, budou ještě\n"
    -"                       podrobnější"
    -
    -#: src/xz/message.c:1222
    -msgid "  -Q, --no-warn       make warnings not affect the exit status"
    -msgstr " -Q, --no-warn         způsobí, že varování neovlivní stav ukonÄení"
    -
    -#: src/xz/message.c:1224
    -msgid "      --robot         use machine-parsable messages (useful for scripts)"
    -msgstr ""
    -"     --robot           použít strojovÄ› analyzovatelné zprávy (užiteÄné pro\n"
    -"                       skripty)"
    -
    -#: src/xz/message.c:1227
    -msgid ""
    -"      --info-memory   display the total amount of RAM and the currently active\n"
    -"                      memory usage limits, and exit"
    -msgstr ""
    -"     --info-memory     zobrazit celkové množství pamÄ›ti RAM a souÄasné aktivní\n"
    -"                       omezení použitelné pamÄ›ti a skonÄit"
    -
    -#: src/xz/message.c:1230
    -msgid ""
    -"  -h, --help          display the short help (lists only the basic options)\n"
    -"  -H, --long-help     display this long help and exit"
    -msgstr ""
    -" -h, --help            zobrazit krátkou nápovÄ›du (vypíše jen základní pÅ™epínaÄe)\n"
    -" -H, --long-help       zobrazit tuto úplnou nápovÄ›du a skonÄit"
    -
    -#: src/xz/message.c:1234
    -msgid ""
    -"  -h, --help          display this short help and exit\n"
    -"  -H, --long-help     display the long help (lists also the advanced options)"
    -msgstr ""
    -" -h, --help            zobrazit tuto zkrácenou nápovÄ›du a skonÄit\n"
    -" -H, --long-help       zobrazit úplnou nápovÄ›du (vypíše i pokroÄilé pÅ™epínaÄe)"
    -
    -#: src/xz/message.c:1239
    -msgid "  -V, --version       display the version number and exit"
    -msgstr " -V, --version         zobrazit Äíslo verze a skonÄit"
    -
    -#: src/xz/message.c:1241
    -msgid ""
    -"\n"
    -"With no FILE, or when FILE is -, read standard input.\n"
    -msgstr ""
    -"\n"
    -"Pokud SOUBOR není zadán nebo pokud je -, bude se Äíst ze standardního vstupu.\n"
    -
    -#. TRANSLATORS: This message indicates the bug reporting address
    -#. for this package. Please add _another line_ saying
    -#. "Report translation bugs to <...>\n" with the email or WWW
    -#. address for translation bugs. Thanks.
    -#: src/xz/message.c:1247
    -#, c-format
    -msgid "Report bugs to <%s> (in English or Finnish).\n"
    -msgstr "Chyby hlaste na <%s> (v angliÄtinÄ› nebo finÅ¡tinÄ›).\n"
    -
    -#: src/xz/message.c:1249
    -#, c-format
    -msgid "%s home page: <%s>\n"
    -msgstr "Domovská stránka %s: <%s>\n"
    -
    -#: src/xz/message.c:1253
    -msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
    -msgstr ""
    -
    -#: src/xz/options.c:86
    -#, c-format
    -msgid "%s: Options must be `name=value' pairs separated with commas"
    -msgstr "%s: Volby musí být páry „název=hodnota“ oddÄ›lené Äárkami"
    -
    -#: src/xz/options.c:93
    -#, c-format
    -msgid "%s: Invalid option name"
    -msgstr "%s: Neplatný název volby"
    -
    -#: src/xz/options.c:113
    -#, c-format
    -msgid "%s: Invalid option value"
    -msgstr "%s: Neplatná hodnota volby"
    -
    -#: src/xz/options.c:247
    -#, c-format
    -msgid "Unsupported LZMA1/LZMA2 preset: %s"
    -msgstr "Nepodporované přednastavení LZMA1/LZMA2: %s"
    -
    -#: src/xz/options.c:355
    -msgid "The sum of lc and lp must not exceed 4"
    -msgstr "SouÄet lc a lp nesmí pÅ™ekroÄit hodnotu 4"
    -
    -#: src/xz/options.c:359
    -#, c-format
    -msgid "The selected match finder requires at least nice=%"
    -msgstr "Vybraný vyhledávaÄ shod vyžaduje minimálnÄ› nice=%"
    -
    -#: src/xz/suffix.c:133 src/xz/suffix.c:258
    -#, c-format
    -msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
    -msgstr "%s: S pÅ™epínaÄem --format=raw je vyžadován --sufix=.PRIP, vyjma zápisu do standardního výstupu"
    -
    -#: src/xz/suffix.c:164
    -#, c-format
    -msgid "%s: Filename has an unknown suffix, skipping"
    -msgstr "%s: Název souboru má neznámou příponu, vynechává se"
    -
    -#: src/xz/suffix.c:185
    -#, c-format
    -msgid "%s: File already has `%s' suffix, skipping"
    -msgstr "%s: Soubor již má příponu „%s“, vynechává se"
    -
    -#: src/xz/suffix.c:393
    -#, c-format
    -msgid "%s: Invalid filename suffix"
    -msgstr "%s: Neplatná přípona názvu souboru"
    -
    -#: src/xz/util.c:71
    -#, c-format
    -msgid "%s: Value is not a non-negative decimal integer"
    -msgstr "%s: Hodnota není nezáporné desítkové Äíslo"
    -
    -#: src/xz/util.c:113
    -#, c-format
    -msgid "%s: Invalid multiplier suffix"
    -msgstr "%s: Neplatná jednotka s předponou"
    -
    -#: src/xz/util.c:115
    -msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
    -msgstr "Platné jednotky s předponami jsou „KiB“ (2^10 B), „MiB“ (2^20 B) a „GiB“ (2^30 B)."
    -
    -#: src/xz/util.c:132
    -#, c-format
    -msgid "Value of the option `%s' must be in the range [%, %]"
    -msgstr "Hodnota volby „%s“ musí být v rozsahu [%, %]"
    -
    -#: src/xz/util.c:257
    -msgid "Empty filename, skipping"
    -msgstr "Prázdný název souboru, vynechává se"
    -
    -#: src/xz/util.c:271
    -msgid "Compressed data cannot be read from a terminal"
    -msgstr "Z terminálu nelze Äíst komprimovaná data"
    -
    -#: src/xz/util.c:284
    -msgid "Compressed data cannot be written to a terminal"
    -msgstr "Do terminálu nelze zapisovat komprimovaná data"
    -
    -#: src/common/tuklib_exit.c:39
    -msgid "Writing to standard output failed"
    -msgstr "Zápis do standardního výstupu selhal"
    -
    -#: src/common/tuklib_exit.c:42
    -msgid "Unknown error"
    -msgstr "Neznámá chyba"
    -
    -#~ msgid "Limit was %s MiB, but %s MiB would have been needed"
    -#~ msgstr "Limit byl %s MiB, ale bylo by zapotřebí %s MiB"
    -
    -#~ msgid "%s MiB (%s bytes)\n"
    -#~ msgstr "%s MiB (%s bajtů)\n"
    -
    -#~ msgid ""
    -#~ "  -e, --extreme       use more CPU time when encoding to increase compression\n"
    -#~ "                      ratio without increasing memory usage of the decoder"
    -#~ msgstr ""
    -#~ " -e, --extreme         využít více procesorového Äasu pro kódování, Äímž se\n"
    -#~ "                       zvýší kompresní poměr bez zvýšení paměti použité kodérem"
    -
    -#~ msgid ""
    -#~ "  -M, --memory=NUM    use roughly NUM bytes of memory at maximum; 0 indicates\n"
    -#~ "                      the default setting, which is 40 % of total RAM"
    -#~ msgstr ""
    -#~ " -M, --memory=POČ      použít zhruba POČ bajtů paměti jako maximum; 0 znamená\n"
    -#~ "                       výchozí nastavení, což je 40% celkového množství paměti"
    -
    -#~ msgid ""
    -#~ "\n"
    -#~ "  --subblock[=OPTS]   Subblock filter; valid OPTS (valid values; default):\n"
    -#~ "                        size=NUM   number of bytes of data per subblock\n"
    -#~ "                                   (1 - 256Mi; 4Ki)\n"
    -#~ "                        rle=NUM    run-length encoder chunk size (0-256; 0)"
    -#~ msgstr ""
    -#~ "\n"
    -#~ " --subblock[=VOLBY]    Subblokový filtr; platné VOLBY (platné hodnoty; výchozí):\n"
    -#~ "                         size=POÄŒ   poÄet bajtů dat na subblok\n"
    -#~ "                                    (1 - 256 Mi; 4 Ki)\n"
    -#~ "                         rle=POČ    velikost dávky pro kodér run-length (0-256; 0)"
    -
    -#~ msgid ""
    -#~ "On this system and configuration, this program will use a maximum of roughly\n"
    -#~ "%s MiB RAM and "
    -#~ msgstr ""
    -#~ "Na tomto systému a s tímto nastavením použije tento program maximum ze zhruba\n"
    -#~ "%s MiB RAM a "
    -
    -#~ msgid ""
    -#~ "one thread.\n"
    -#~ "\n"
    -#~ msgstr ""
    -#~ "jedno vlákno.\n"
    -#~ "\n"
    -
    -#~ msgid "%s: Invalid multiplier suffix. Valid suffixes:"
    -#~ msgstr "%s: Neplatná přípona. Platné přípony jsou:"
    diff --git a/external/public-domain/xz/dist/po/de.gmo b/external/public-domain/xz/dist/po/de.gmo
    deleted file mode 100644
    index a0e79e20e1753cd82a496f7555a90e1a2561daa4..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
    
    literal 26431
    zcmb`PdvIh~ec$iG^4KA;W*0DT&Kic%ENY>7?Cg$&U^N=ejF{2GBh4;5%bL0BzLFYs
    z-){PLk46ItEXLT_A+e3Ym}~)YHh;LBP$@f^ip|==krO*{uua)9F}RYHU8!{&Z{HO~
    zF96^8@+f*CI1WBU((gZk-vGZ3KFG^2y&{T!ol3s>$|$Pv{LA-7(K+xp!S4oN{i-P9
    zRa5~V1m6Sx6u1Na9QevtN6}w`zX~pZUwcgyeH=VQ;r|7G8hi?T^0iU)720|8>!Roa
    z_g{Z~6nzwY%^RX<9{e1re18DmO}^bXM$x;u|J0kJ=riE2gQvmwzd4FN3w{oK5*&X^
    z6nz5x3ix&Kg!B3DxG#!+iTlrj4RG~)qKKxWuLb;8z&``2I(o%hqlhY^aZvd#1>6Yu
    zv4CFyZ}R?MhWmHE&F5bLHBVJ=0_=gOz^B1`z;A<0Y4j)Ho!|=&Gq>PNK)M*cDd2m+
    zBizTJ`tzxPKLax4=s$q>gMSRZ6TJ8BQN(352de!#sOKLB$HAWk)y{tbPlA5}(uL@)
    zG{RIz7eI}_25P-O4zg6y7eJOE`gzcSza8*T!7c9Z8H=KKfgc7nzJCo)fxiLLMD*gL
    zzMTrlQb(7;<6sk1yqvpaZ`HE`zUR@LGo$RQ*2+svlniXTfiSG#R}KqJJrP9@My3K&^iroCd!i)HweQ
    z_z?J4pxS?c%2i(jWGh5J2r~5ODNy71cc9kwZW?FGqGJIc14YMAf-3)2@CD%Sf!f2r
    z4~jkxaiezc25B<71U?Mj1l5nPg4!Q{22vzCam??}DtMOre*``N{&!I8@fs#y{g?q?
    z0w$p7rU`1@KLfrT{8{i2_zMAlHQ;Xr{8qsK0p3Nv?*#mdfOoQ3dj5)luMPM;0mnhM
    zTyzR#38Tlrd%;hDT9?m*-wS>V)cbLW_F?c*Q1khD@P*(nf*-ykihdbuxajB
    zL7I#nyXfotJopvv+n3-i;9C~iujKn(@GkH!2Jve=zjq~yJ_LRn)OZ$|EYVRN)V}%z
    zD8BKJK?nXyc>jl>^8X)D`~7v7{r!XB$GBe&_rD9Op6`J7fG=kfM1Kxcf0sb*%TI%P
    z|4%@sJ-P*|{;z_fw{L=M#ptg=?Th=@Jgx@(NWgyzihh3+RQ-PqvUQ@FE57~)$W%oi
    z1&@LM5qvfHSKu^w&m*2rmO!c<}i{B!U)
    z_jh0Q^`8NC|0Cco_{(4&eCToC@1F*n-0y+n2gly;_jd}aA3qO5deQHIYWMX|MA6H@
    z^Ptvw71Ve?1fB+eGT=8rNHcmFgV+47g0Ba^2&%uo0GC9wyuR~eAgnw3CinvIr4Y*<
    z;E$1ZNcxH1mq_YY{=1WlCrJhgNH{~-7llE$Z>)?dHOgVCqv
    z4AM3lYKP}%0&WG=x@rye`!3QCkfwFRPjj#J*6+tjKS}D4u91$A?j>CyL00yAGk+iU
    zm-hEv{OyuNQ=&7`;2TN${asRzl#(7J=_j7{VUpH%j+Fnz3+^Vpm2^Mpg(U6E?%fh3i!@A%%@4^1w7p`9!POy5$PTh?4bB*
    z-|P1((kDniLi&3o{XRg_zMUdnBI(y6-9>7U9wfb*^fHouiyorC1D+?%lB(g^74Rp*
    z^$GAp;rbN;1*b?4kv^pxexD@ml4`o)_o#h2NDa~tk)9&`3)1U&2iWfrfB%NxB+o>1`rSd&vntOf
    z!@bs4&qddI_j%rlF7?an_&J`5uJz07cmJN6uU5~xGfP(%d8^Af
    zttM_g>Fy*+>ehF=Nyc40-E>)Rz1xYa-J~|Ms!{_RomSH&adpeJx?4%djUB5Tf8f-#
    zJ9gBMsByCy9~&6arK^jx$6Tx9ba8yzkEWiv*i~E2W?adVcHD_+-Zki^Yi+ojNvA~t
    zn<3SAe4xH&tCJ`f&AW|OqtV*YC|d1qy_IIqf128zBulz8E0^b;T@^KTTXfOCbz_s2
    z(~l=l9344BwR*Kb*;REV?(Dj(elu}nCok5|xQaXWz=>0f^)u7%A^wi8sZkA!=3Lrq
    zt~14qwNZy0;s!I8c9R=jw_fiu)XB=pX?Nm)s@exs)ox{V^|M^pqF`qR>$$t
    zbu?SGWM*;s?7Y*`YicufK#$$nMx1rWUE1n2!!%`P;#!J0MW
    zF623OymI`(6VvY0$v_Ju&XKswcZBW6fLqji&7-9%tgX1y9L(=#FE5rdxiJW}+emJ2ijv(e$hlvfl9e?*dQRmt
    zctm-O&aJM@UM`Pu#MXSI&p|ifL2;u|YA+kjJz1~udhT-}Q6X{f)yImTj1f)tXuZgsj|
    zCU)ofQg(ETYL?sZ2HVQ)r20mku37cV#-K|LK3Zpsq%C)D;nMuLIP%UGvOsqZeq0%c
    z0md~aQBjLKHCIpDz3#-JNZUh{w%%w}w<}`OGph?%=T}F}xSy`rrOA$)xN*~2F&A$z
    z4CC3Gj3nL9`$yDOhuw7$d6{;0FU=^cS|3rB)k$-VvKV`P6E>ezs#{5Q
    z8|9>x9_c#fzrL|+{n4UtcIw?-=X2QbYm6)GigdGIQ@YWrG!weH%fzDQv>UOnq}%Eu
    zFXLvbmzqv-d3Mo8rU6%bolcT=8@mp*2WlKKwoq>`i#HK4^(HcxF~WY68}h7os+a+f9h9j!STAT3PpD*
    z=3j_GXP*0&<}2M~x+<$$lB~C}QNJ-Wv3lhkb@;tbX?yCf>G2WdXfbR?X;p^lW_PQB
    z$7jS^(d&(^>QNduX%~*s?zF0CKhCsi<(k%(4xD(@qCtRY$>Y|PuPKHF_{yb~+q?`g
    z?@`RF-Se=DU+r>h_L1LMz3K+nN>UW
    zb~ig(R3y3BNGe&E8EKaGfhjyTppANm(fSO2Cudp|7{Q1s_l(M+=4N$uq?0s}(V{`)
    ziDe-)CuWAS;SS%QxeMa^9p}z9V)jA!&B4D`Wf1UNOqy4Wt+;b$>4|zPlWt;S!c|U(
    z{DShn@*=;m{IqMaySg!xpJ!vo+z*4gf5dS5v`)r>EeXrT+NoBJTdpTauOuiM4^~d!
    z7ty(M+7@1?nK`$(rp}3qv=mZvD4rmmQRJyw?bMR#{=9jk)j_T!dUj2E@sUEAIy&yI
    z-MD##zcT+oaoua3c;^V^D|70KiH4cE3-faq>B@eQ(cNt)Q|?;YN)u`oQ5jWNX$H1<
    zbQJTsR_#C1x)M7OX`-HtiLTmYWl})gq1`ku}j$>p6fc-MIzIW
    zIx@QjN6#sg*>|R_B5neOnT|2Ha>Yp*8pW|{Ew+DYN{5khC;3pXt}diq8_$+{wUsp5
    zVK6{hL&&yTovyR@m@OFwwJal>?R8V*gXV0u(goGkXr-I|3j1}jD0=1VD$mP-J)l&n
    z3wbdS_<@a~iWF^yexo0^tlx3%y4*a-OYaR4bF6Hu>)T0Eng+WY^NJTPsHB@54IE8-
    zT8d+3L#5c<=!p5x-?5sV9kes^!JyS)BX~}r5nv4+&6gULDc!cZs;VpN*2taLjol%GKU)F1zFQM3bY>;+RHFa`F&H*)(=P|uPGPtEtURP}l
    zXuTEG1t(z`9_+7%@jL7UIV{*fA(Q%aQ?(Sswr=^k%AY~?Y7N;fmtX!=8GXL~vyc-{
    z2<#yV3YOJqcX`pEaP;|}s&A-}`OvI@{@7g|C0R^bdoNzsBFHSWm5!V{BdabL!mD0(
    zs-!*Eg>!QVu4Qlia(Bh7u>L)d)}(9aqAkzi?=P!as*rSyipD6@{~gX`Vp@)={!?9r
    zH$m@b%rdPkkAH&{mExbGWhS*y_HgEKuc^jGB(+>H@4M=*bnBRqte9-}sZj4y;a#(-
    zDAjA79@-ZT%9Q0Tlkk}``M!jyYsWR2KfZAJ&22O6=Uu~m4l`_P@a!|}Yg_Ssi13lv
    zdRj02EB^XU`Bjt$u0O5zX26+{;79NiDh)hn4DhYMX=@X14cTPojU?0IY~s0QM?0bb
    zEK~|!&5CIitU1qvRMS=qdD2Gpn{w|uoV{Cbr=0zni&IGhxIO$xD_VY<+vBRpZFX9{
    z_JKLDAd=33IdHHv>*lPa{k*LP4%A?cSVJ2z%|V9Y{k$14lDx{L9Hz7Hd!HrAcDa_~
    z^*QxDZm9gOjCptMaCRhEAmc9EuD9Eivr$`CWntVsjtgK@Ty1hCe<7D6^W%ry-aRN6
    zYm_wG-Q9jWbhv3I%vOw8U)N!RmH^gPtVg+D8nbmDldhL;r_A-pL0}xnTBwH|s}r2!^)lOSuD2R^4u_0pNqQuNzS(QU9h-`M
    zH7pHUSsUo^7;*CK-9~)VD1^HRxZPHd-5mR=k*attx9N@`QVNqhe|qFSHjd?R#FE>L
    z*EIAQ8|M*rDaIAVhSAoyA`w^3*l*3t5VAMw3ld)qwC^{L?=otmZHHEFu`@Y+o4qKy
    z)@pg(HeX{S$=eoL*)q-(8X^J49ft$8T>jaxuB6Eg)CHNo_^!n0L=z)kdAo1;?1mzq
    z$W=#S9AS-wm(oK}J85f}$zquv(Fvcpqp7?6O)F`#=^el*3U$Wg3nv}RZ(iNPHp57g
    z8c=p%P*u*b*@NhJxIR$e!aRGu%-3XUooPtLOt(2<8$0Ss%q{2`g+?BR)TcK2A_}$6
    zCM*hNc3Pe7pk||sDAgyQGaXEf(~UwhsG(~*m`gCXyi}%`vhaVv~VTbRyQLgT7-CG3Bp1?8}BxwHkhsE
    zpulwz^2zSy2}%#c;;jKPG1_=o$(-i_q$IqF^ADJosYCWoLvb>Z9@v5Ft5-
    z<)bNjgH66;Rf`Mw11{ee)5+Qs!%DKHaAMV>r56A8ivyj2=Z7L%Zlkh7WKbYYqGh=&
    zqzKtdrd}J>TfTJ&-zNWB5bU_C@n40T$s-fdf*hJOhG)go=4JC3jnAg^ms=X
    z%O_*e+J%Kx$G=&3cK(t1OUo;Z^Gj>)k@?H33(HGxX?e{pEUmEz=Fhrw%a`5C<>j+i
    z=GOG?%If??B>QASPQ+Xm2d+_a_IS$m%VqhK^m@J1N=>F*k2`glC}JZDzCb(m3vQmZ
    zLi_OLZr~-)T`v+5A_niZl_zc&~3W!|TDKV@~N{%1D28
    zBJja|Gej#Hb}kJzs^%%h<7GOUNGQm$laU$er310{)-Gq&?BZb7jdA946zj_JWmC}_
    zeZ9u0y$kJ#QMc*eC3nI^bi4B81^$(w>l=$8mnlV+W5@cJ$NQHj`j;pBmk$(|{jB|*
    z{kNxzd=C~^4;5FZx#~*_TkCh~@A0rQ#_Y;j1{Q!_5bgu(8K`a8GkKo16vbX;De-+g
    z%YL@Q0CmMZPOul$`-F}H9=G!&t`6n*$!l}B<50>9j`)ygO_jwA
    z6Si^&231*WO-a?ul8GwnXgz(n+uM!_QJH9UHV>^VuT|z?rt)u9&SHE_x#N?^9;i$b
    z0CdV7J2myd1MiqTJ~>Io%4JTvwb}alCM%PtE0YgWWa{{XKHnvj%F0?NPP2vt6^#E~
    zO93F5SPI>k~QTI6KEKi*>#ldL83
    zGo=MPqfj{4J2|zkr_**+hPgg-W$j$$p?*H~WFzTR=5@eA2d3OZ81{!&8Z2O=at^VI
    zrJT0yHk%>B&R@=qrS85N0`sO7Yr;P62OC0Q^Ggb{0y~f_t_>5UN&P7
    z6>e;E?-|Ts9zB|1xQuepJNF1)Q8OMJjb6HWKwzS|;X`cA?7HbJ?&b~@DVw!MI-}@B
    zj|I9`lxiCtq1c}WF9SHVDn}{WYj`kBRL7vTo+7y}
    z%A|!zHKG03#C}bvhQt=I!tN3!~v{0>2mOxx94v5I(yF$dvUY3ufCBz8JPKJjfT_;7x9pf?%jfJI_o`V?|f(P*4~#C
    z6Y2Uvk#g7)6)6}UTZb>Z9~e2C-i)^z%qGhfA|o$`$jCF#DKe7U`mvEiYFi1xkr^8;
    z541cWIMTUNcx0)%VbvTEAIT9SB&Z0}zXRVsNXXQ@CD%vo+}
    zAfVGXHW14h$`3|!K1&7tV9tK){cz5rlLI`bxVbt+Ms4gpW1*di#di7%Mu&Df*~xiu
    z=c+C%;W*3cfs=%jq5}wF-|GA5&+{GDw2>Hh?=xGgRC-C>AH(5;tCe@R#cE#35bzxG
    zb7mze8^S`|MH~&-cN$)aAGlIb=SOFf&}W}
    zv`>COaeetUXf3h@Wkm-}(wVFC3u}8%oxw<-yKtH7D@*4`HntD
    zITMiWJ>9*@k^bl7o<`d46$XE_MSoFwo&^w@SfTh*A$896>7_1q<*6k+De>FwhQXd
    z>tvB-`S+u39pCB5ELd%e9V8up3~YOcpic|*(?|;v!O!sjHBgr0ZPRM=_T3U209_*U
    z9of$`N5yqaplbzA$28RRnN=Pj+r^;oN60EXcI4_9rzCJzOxq-a={bp6MR37l
    zJ_dtm9p)7qK|8gy{h(PL$Az-cN>)tw$o2=P!PcEBSSiMqbZ#cSpaQZ1k}ZxABn`XW
    zk=3b3^8>vw=0sRE^b@BydlpYVIIdFstt;BxW-LVnuF1n;#6~}ch2SbK#~555eLJ7l
    zSZhDaePTseTFu2)3?9#!$4zv}eXnB3ZsW^
    z4w9F_`0Up^a)QNAa*-KWNiH$V-D>VVg98M{i0RKThW<3eO?Nes*OjBFj!Z79=doGP
    zg}4i*ai}Nv3il^zhcypR@%QK(w0!o(H0;26PC>!jY;$AM7!%0oQ9-@^#aoPFGjuYo
    zung<+G%Y3#EhN>BrF+kKmTIdya*(Ur3j9q*1^!Cc?-K;f4s}_*#?%qTYC+giI-`^x
    zW_(g?YGiX6u|o}dy<=MlXZ7AKJmfGuCQ-Jh?GEWVwUR0@CtfOx-NJ#{(d`Y`6~PTU
    zpU~22kLR+O+k%G$#V=wPC>(e&8aR~G37xD$mNn-M)BEgrd5%v_xHCFpV7wy-XUYPz
    zlDE&MSntFl8@OLtAZPA=rt5w^9$DFd)ac;AG10Cj2qMlYD7{Z(8xl>-ek$q6cqnKd
    z-h)cb$DO8pvaI0&aSZt?jO>m1OT6UIql@=hY=c3@B8QQc9Ta;^{M&BZ=Ib_TieK(p
    zh(V@p-0fRkxl==w@#xm_=;PZuY!mS;VaP}lVvzlwVm-0>nLRY;Lg*h9ihOnU!X?P8
    zVA@-Ix2jv(I4ELzb-j)DUOiLnh0{26lv3iAGLN
    zV5~&E4)i7T7_T2)f_8((g}?kFqaVG!H|y*AmZvf#_&HZ_9`WAl43^pyzf&aBJ`HDB
    z1T-E|3bL1S*I|a5)!7!uP_%Op(ZtVzEa~W4`0Xw>ld}zWesCG?mJb2rmcJu&eiL1|mLv3E;4dumfRBwX7zvA&H@oVnY`jLQu{
    z&SH0P+GR!k2eLkebeH8RM2+BMF~%+_zS~-_TFB8rfHzK-&>j(T$df|DS@t30+CpIj
    zIknbDPubvXh%kr5f%El{Z1|e_wmGiIxgcL{2i?)rK(LE%G7Ms=M(z;oW?NUUB{vH_
    z1>LdSj%a&W961w^)Mc7sbUlsIvw3hgWTwmV8`+&wO)Q^T;B}dM!=leiOK+^jjA|r;
    zx;i8Xy_CJo144lzvFL;5q{;2FDXC_L1f%>%MMvKk)xj&jve%
    zm3ndSR(oTxq@PXs={d{O>714KC3&}Zt9jeJhvo2tf3}I=ug)Gc@zhxANMuWG9q>)%
    ze+P%vv$YQHIL#*uQ8;M)@kl>ZJ)d{)m1OVx6`A0yNZu?R=#?VXN9I1u5}v_3lBE29
    zBvz`HVDZ#ZJ37Rh9nQSMY9Z@kwe0!=LF+?f)-TFaI>@^%`aprs_Reo4^r<#61U{p8
    zvkl8OFN?mr_l#7M(Rr`-aPRQ#2H{&60>d)~H-LG5uu+J2=7`Qq3F}eOdO4%_g_&M1
    zwcSkT=bzD!c#F^8>^z9GwrdJ=_s0FWcUr+fCB&HUDL>=HKjO$k<6&|v-d(-mS`qIY
    z|B2_y!*^hDtU86hKbP#Hmqvnd+wXwnE&(3!Y^aM>MeA(YS#w~^QepL<{{
    zaa)p1T8p4hMR`znp`nOGi4yA&>(=E%!%XC@?^!ub663ITZ+|~>0Yd(Kvk>Un4^*{x
    zWh1;|V%+R=zXMHi!w$pINqY?mQ%4%*q>kaAJR?
    z;^v1(;!6`wqZIz4=R&b!H
    z+qN#=J#99L`aNWQp{EAyfx{)^Ba!sB{0!6TNZt0{Ej+ck9&#Ned(Ho!42|bq*oc}1
    zDOFIS=8-+H!?^7b_isJ){!BB*gZ&Ynh%EE4f9*9p8uOD>rg{bcn>HSbnb-~FQ>b^|
    zuc-r=vwby=^^iZNnBILN!f!Si-%U5~k52r&ukbwpaftq#0Ke$|3jqH=J`7tL-)+q`
    z-hqbaxd)fbnZ&S?<(@rCv^S=KIk-8#Ru8kmZv*VV`YV`$^Cr0QkY}mKIEcP%@Z&N`
    zJ%o>0RW^wx+ECB(K8s6qBk^RMa0osxn#PFg%s&}Wj*wl;UE=^loJb;)dag^TBQWx4
    zzG#^*VfYw|03=EMLTL$t$~%Y(2aA!Kch2ZE&O3kdw}*&1)WJh7|CE4OXzBKO>_xr}
    zqk@D6Pu6TQO7v?s)q$A@sFduH+;&Cned`4N1#7N#2=XarJZK30$dFdLQQss2RD67*
    zXtv^OA?#X8Q#V=?=an{8w$C#!7pFa&@YG)^$<44Fr6XfsN3?`*Pj#8hwT06OeXcC{
    z&IXmp`|NZ52-Z5N;^>Qr26}+Pd&PH)?+^HY{P_L=jm2Eu#KWNYRrL*m&+pYg)O(EB
    zT+vbS;Q_k#MZ;i?wWOz`Zhh1sCj;()0ZZ4PdGM5<_Z}zVS|@0ZqcIlb`%dJ@j38W!`WGV)v)H~7nbH7Uo9g%pr?Y
    zFdyjZ4GBJkO5Bwunx`hS{G|hirFk06%{-_OS|LUhD-I{$N+yd24=V~mQ$+Tz<{vyr
    zCpE8+K8UEZ9bTOD
    zI>`AXi<@0ed2x!`2N2t_QJYky5XRv044A)eCr)85*M|^7
    zeFh;s?LW^7A3p3`C<#^wz(;u-Coh)uc2OH0^lsQWm}fP7%xd~unI@kX`@yf~qdU~W
    z!H*>T$-cglFlOvSwmkc&l}>_#f~zz8vH2zT{~@icgbRZoM!?8?>G)w6E5I!XwPt&x
    zg@pyzJ)eih&wHyE8ZnV`(B~5((813qU?RaWKgvwlKx~?+!1skXOWzwuE0-5~CypDO
    zf;?z-)Aib>HuKq$MQQo(i83@o`?eWr3Rks2-42$q{Z~1#Uimg+saA>=KCEv+_zo+4
    zyVSC80K7{k|L7a;ua8amCV?&V_~CJP_=(6b4zce3VCrywJ}6a-^D=CmWM}W`EzZ8(
    xfw9B>oFb8fv, 2010.
    -#
    -msgid ""
    -msgstr ""
    -"Project-Id-Version: XZ Utils 4.999.9beta\n"
    -"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
    -"POT-Creation-Date: 2015-02-26 16:55+0200\n"
    -"PO-Revision-Date: 2010-09-07 20:27+0200\n"
    -"Last-Translator:  \n"
    -"Language-Team: German\n"
    -"Language: de\n"
    -"MIME-Version: 1.0\n"
    -"Content-Type: text/plain; charset=UTF-8\n"
    -"Content-Transfer-Encoding: 8bit\n"
    -"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    -
    -#: src/xz/args.c:63
    -#, c-format
    -msgid "%s: Invalid argument to --block-list"
    -msgstr "%s: Ungültiges Argument für --block-list"
    -
    -#: src/xz/args.c:73
    -#, c-format
    -msgid "%s: Too many arguments to --block-list"
    -msgstr "%s: Zu viele Argumente für --block-list"
    -
    -#: src/xz/args.c:102
    -msgid "0 can only be used as the last element in --block-list"
    -msgstr "0 kann nur das letzte Element in --block-list sein"
    -
    -#: src/xz/args.c:406
    -#, c-format
    -msgid "%s: Unknown file format type"
    -msgstr "%s: Unbekanntes file format"
    -
    -#: src/xz/args.c:429 src/xz/args.c:437
    -#, c-format
    -msgid "%s: Unsupported integrity check type"
    -msgstr "%s: Integritäts-Check Typ nicht unterstützt"
    -
    -#: src/xz/args.c:473
    -msgid "Only one file can be specified with `--files' or `--files0'."
    -msgstr "Nur ein file kann als Argument für --files oder --files0 angegeben werden."
    -
    -#: src/xz/args.c:541
    -#, c-format
    -msgid "The environment variable %s contains too many arguments"
    -msgstr "Die Umgebungsvariable %s enthält zu viele Argumente"
    -
    -#: src/xz/coder.c:110
    -msgid "Maximum number of filters is four"
    -msgstr "Maximal vier Filter möglich"
    -
    -#: src/xz/coder.c:129
    -msgid "Memory usage limit is too low for the given filter setup."
    -msgstr "Das Speicher Limit ist zu niedrig für die gegebene Filter Konfiguration."
    -
    -#: src/xz/coder.c:159
    -msgid "Using a preset in raw mode is discouraged."
    -msgstr "Verwendung der Voreinstellung im raw Modus wird nicht empfohlen."
    -
    -#: src/xz/coder.c:161
    -msgid "The exact options of the presets may vary between software versions."
    -msgstr "Die genauen Optionen der Voreinstellung können zwischen Software Versionen variieren."
    -
    -#: src/xz/coder.c:184
    -msgid "The .lzma format supports only the LZMA1 filter"
    -msgstr "Das .lzma Format unterstützt nur den LZMA1 Filter"
    -
    -#: src/xz/coder.c:192
    -msgid "LZMA1 cannot be used with the .xz format"
    -msgstr "LZMA1 kann nicht mit dem .xz Format verwendet werden"
    -
    -#: src/xz/coder.c:209
    -msgid "The filter chain is incompatible with --flush-timeout"
    -msgstr "Diese Filter Kette ist inkompatibel zu --flush-timeout"
    -
    -#: src/xz/coder.c:215
    -msgid "Switching to single-threaded mode due to --flush-timeout"
    -msgstr "Schalte um auf Single-Thread Modus wegen --flush-timeout"
    -
    -#: src/xz/coder.c:234
    -#, c-format
    -msgid "Using up to % threads."
    -msgstr "Benutze bis zu % Threads."
    -
    -#: src/xz/coder.c:247
    -msgid "Unsupported filter chain or filter options"
    -msgstr "Optionen nicht unterstützt"
    -
    -#: src/xz/coder.c:255
    -#, c-format
    -msgid "Decompression will need %s MiB of memory."
    -msgstr "Dekompression wird %s MiB Speicher brauchen."
    -
    -#: src/xz/coder.c:290
    -#, c-format
    -msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
    -msgstr "Passte die Anzahl Threads von %s auf %s an um nicht das Speicher Nutzungslimit von %s MiB zu übersteigen"
    -
    -#: src/xz/coder.c:344
    -#, c-format
    -msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
    -msgstr "Passte LZMA%c Wörterbuch Größe von %s MiB to %s MiB an, um nicht das Speicher Nutzungslimit von %s MiB zu übersteigen"
    -
    -#: src/xz/file_io.c:89 src/xz/file_io.c:93 src/xz/file_io.c:101
    -#, c-format
    -msgid "Error creating a pipe: %s"
    -msgstr "Fehler beim Erzeugen der Pipeline: %s"
    -
    -#: src/xz/file_io.c:179
    -#, c-format
    -msgid "%s: poll() failed: %s"
    -msgstr "%s: poll() Fehler: %s"
    -
    -#. TRANSLATORS: When compression or decompression finishes,
    -#. and xz is going to remove the source file, xz first checks
    -#. if the source file still exists, and if it does, does its
    -#. device and inode numbers match what xz saw when it opened
    -#. the source file. If these checks fail, this message is
    -#. shown, %s being the filename, and the file is not deleted.
    -#. The check for device and inode numbers is there, because
    -#. it is possible that the user has put a new file in place
    -#. of the original file, and in that case it obviously
    -#. shouldn't be removed.
    -#: src/xz/file_io.c:249
    -#, c-format
    -msgid "%s: File seems to have been moved, not removing"
    -msgstr "%s: Datei scheint umbenannt worden zu sein, daher wird sie nicht gelöscht"
    -
    -#: src/xz/file_io.c:256 src/xz/file_io.c:769
    -#, c-format
    -msgid "%s: Cannot remove: %s"
    -msgstr "%s: Kann nicht löschen: %s"
    -
    -#: src/xz/file_io.c:281
    -#, c-format
    -msgid "%s: Cannot set the file owner: %s"
    -msgstr "%s: Kann Datei Eigentümer nicht setzen: %s"
    -
    -#: src/xz/file_io.c:287
    -#, c-format
    -msgid "%s: Cannot set the file group: %s"
    -msgstr "%s: Kann Datei Gruppe nicht setzen: %s"
    -
    -#: src/xz/file_io.c:306
    -#, c-format
    -msgid "%s: Cannot set the file permissions: %s"
    -msgstr "%s: Kann Zugriffsrechte nicht setzen: %s"
    -
    -#: src/xz/file_io.c:416
    -#, c-format
    -msgid "Error getting the file status flags from standard input: %s"
    -msgstr "Kann Status Flags der Standardeingabe nicht ermitteln: %s"
    -
    -#: src/xz/file_io.c:470 src/xz/file_io.c:532
    -#, c-format
    -msgid "%s: Is a symbolic link, skipping"
    -msgstr "%s: Überspringe symbolischen Verweis"
    -
    -#: src/xz/file_io.c:561
    -#, c-format
    -msgid "%s: Is a directory, skipping"
    -msgstr "%s: Überspringe Verzeichnis"
    -
    -#: src/xz/file_io.c:567
    -#, c-format
    -msgid "%s: Not a regular file, skipping"
    -msgstr "%s: Keine reguläre Datei, überspringe"
    -
    -#: src/xz/file_io.c:584
    -#, c-format
    -msgid "%s: File has setuid or setgid bit set, skipping"
    -msgstr "%s: Datei hat das setuid oder setgid Bit gesetzt, überspringe"
    -
    -#: src/xz/file_io.c:591
    -#, c-format
    -msgid "%s: File has sticky bit set, skipping"
    -msgstr "%s: Datei hat sticky Bit gesetzt, überspringe"
    -
    -#: src/xz/file_io.c:598
    -#, c-format
    -msgid "%s: Input file has more than one hard link, skipping"
    -msgstr "%s: Eingabedatei hat mehr als einen hard link, überspringe"
    -
    -#: src/xz/file_io.c:678
    -#, c-format
    -msgid "Error restoring the status flags to standard input: %s"
    -msgstr "Fehler beim Wiederherstellen der Status Flags für die Standardausgabe: %s"
    -
    -#: src/xz/file_io.c:727
    -#, c-format
    -msgid "Error getting the file status flags from standard output: %s"
    -msgstr "Kann Status Flags der Standardausgabe nicht ermitteln: %s"
    -
    -#: src/xz/file_io.c:905
    -#, c-format
    -msgid "Error restoring the O_APPEND flag to standard output: %s"
    -msgstr "Fehler beim Wiederherstellen des O_APPEND flags bei Standard Output: %s"
    -
    -#: src/xz/file_io.c:917
    -#, c-format
    -msgid "%s: Closing the file failed: %s"
    -msgstr "%s: Fehler beim Schließen der Datei: %s"
    -
    -#: src/xz/file_io.c:953 src/xz/file_io.c:1179
    -#, c-format
    -msgid "%s: Seeking failed when trying to create a sparse file: %s"
    -msgstr "%s: Positionierungsfehler beim Versuch eine sparse Datei zu erzeugen: %s"
    -
    -#: src/xz/file_io.c:1048
    -#, c-format
    -msgid "%s: Read error: %s"
    -msgstr "%s: Lesefehler: %s"
    -
    -#: src/xz/file_io.c:1068
    -#, c-format
    -msgid "%s: Error seeking the file: %s"
    -msgstr "%s: Fehler beim Lesen der Dateinamen: %s"
    -
    -#: src/xz/file_io.c:1078
    -#, c-format
    -msgid "%s: Unexpected end of file"
    -msgstr "%s: Unerwartetes Ende der Datei"
    -
    -#: src/xz/file_io.c:1137
    -#, c-format
    -msgid "%s: Write error: %s"
    -msgstr "%s: Schreibfehler: %s"
    -
    -#: src/xz/hardware.c:107
    -msgid "Disabled"
    -msgstr "Deaktiviert"
    -
    -#. TRANSLATORS: Test with "xz --info-memory" to see if
    -#. the alignment looks nice.
    -#: src/xz/hardware.c:126
    -msgid "Total amount of physical memory (RAM): "
    -msgstr "Gesamtmenge physikalischer Speicher (RAM): "
    -
    -#: src/xz/hardware.c:128
    -msgid "Memory usage limit for compression:    "
    -msgstr "Speicher Nutzungslimit für Kompression:    "
    -
    -#: src/xz/hardware.c:130
    -msgid "Memory usage limit for decompression:  "
    -msgstr "Speicher Nutzungslimit für Dekompression:  "
    -
    -#. TRANSLATORS: Indicates that there is no integrity check.
    -#. This string is used in tables, so the width must not
    -#. exceed ten columns with a fixed-width font.
    -#: src/xz/list.c:65
    -msgid "None"
    -msgstr "Kein"
    -
    -#. TRANSLATORS: Indicates that integrity check name is not known,
    -#. but the Check ID is known (here 2). This and other "Unknown-N"
    -#. strings are used in tables, so the width must not exceed ten
    -#. columns with a fixed-width font. It's OK to omit the dash if
    -#. you need space for one extra letter, but don't use spaces.
    -#: src/xz/list.c:72
    -msgid "Unknown-2"
    -msgstr "Unbek.2"
    -
    -#: src/xz/list.c:73
    -msgid "Unknown-3"
    -msgstr "Unbek.3"
    -
    -#: src/xz/list.c:75
    -msgid "Unknown-5"
    -msgstr "Unbek.5"
    -
    -#: src/xz/list.c:76
    -msgid "Unknown-6"
    -msgstr "Unbek.6"
    -
    -#: src/xz/list.c:77
    -msgid "Unknown-7"
    -msgstr "Unbek.7"
    -
    -#: src/xz/list.c:78
    -msgid "Unknown-8"
    -msgstr "Unbek.8"
    -
    -#: src/xz/list.c:79
    -msgid "Unknown-9"
    -msgstr "Unbek.9"
    -
    -#: src/xz/list.c:81
    -msgid "Unknown-11"
    -msgstr "Unbek.11"
    -
    -#: src/xz/list.c:82
    -msgid "Unknown-12"
    -msgstr "Unbek.12"
    -
    -#: src/xz/list.c:83
    -msgid "Unknown-13"
    -msgstr "Unbek.13"
    -
    -#: src/xz/list.c:84
    -msgid "Unknown-14"
    -msgstr "Unbek.14"
    -
    -#: src/xz/list.c:85
    -msgid "Unknown-15"
    -msgstr "Unbek.15"
    -
    -#: src/xz/list.c:153
    -#, c-format
    -msgid "%s: File is empty"
    -msgstr "%s: Datei ist leer"
    -
    -#: src/xz/list.c:158
    -#, c-format
    -msgid "%s: Too small to be a valid .xz file"
    -msgstr "%s: Zu klein um ein gültiges .xz file zu sein"
    -
    -#. TRANSLATORS: These are column headings. From Strms (Streams)
    -#. to Ratio, the columns are right aligned. Check and Filename
    -#. are left aligned. If you need longer words, it's OK to
    -#. use two lines here. Test with "xz -l foo.xz".
    -#: src/xz/list.c:671
    -msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
    -msgstr " Str.  Blöcke       Kompr.     Unkompr.  Verh.  Check   Dateiname"
    -
    -#: src/xz/list.c:711
    -#, c-format
    -msgid "  Streams:            %s\n"
    -msgstr "  Ströme:              %s\n"
    -
    -#: src/xz/list.c:713
    -#, c-format
    -msgid "  Blocks:             %s\n"
    -msgstr "  Blöcke:              %s\n"
    -
    -#: src/xz/list.c:715
    -#, c-format
    -msgid "  Compressed size:    %s\n"
    -msgstr "  Größe komprimiert:   %s\n"
    -
    -#: src/xz/list.c:718
    -#, c-format
    -msgid "  Uncompressed size:  %s\n"
    -msgstr "  Größe unkomprimiert: %s\n"
    -
    -#: src/xz/list.c:721
    -#, c-format
    -msgid "  Ratio:              %s\n"
    -msgstr "  Verhältnis:          %s\n"
    -
    -#: src/xz/list.c:723
    -#, c-format
    -msgid "  Check:              %s\n"
    -msgstr "  Check:               %s\n"
    -
    -#: src/xz/list.c:724
    -#, c-format
    -msgid "  Stream padding:     %s\n"
    -msgstr "  Strom Auffüllung:    %s\n"
    -
    -#. TRANSLATORS: The second line is column headings. All except
    -#. Check are right aligned; Check is left aligned. Test with
    -#. "xz -lv foo.xz".
    -#: src/xz/list.c:752
    -msgid ""
    -"  Streams:\n"
    -"    Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding"
    -msgstr ""
    -"  Ströme:\n"
    -"     Strom    Blöcke      KompOffset    UnkompOffset       KompGröße     UnkompGröße  Verh.  Check   Auffüllung"
    -
    -#. TRANSLATORS: The second line is column headings. All
    -#. except Check are right aligned; Check is left aligned.
    -#: src/xz/list.c:807
    -#, c-format
    -msgid ""
    -"  Blocks:\n"
    -"    Stream     Block      CompOffset    UncompOffset       TotalSize      UncompSize  Ratio  Check"
    -msgstr ""
    -"  Blöcke:\n"
    -"     Strom     Block      KompOffset    UnkompOffset      TotalGröße     UnkompGröße  Verh.  Check"
    -
    -#. TRANSLATORS: These are additional column headings
    -#. for the most verbose listing mode. CheckVal
    -#. (Check value), Flags, and Filters are left aligned.
    -#. Header (Block Header Size), CompSize, and MemUsage
    -#. are right aligned. %*s is replaced with 0-120
    -#. spaces to make the CheckVal column wide enough.
    -#. Test with "xz -lvv foo.xz".
    -#: src/xz/list.c:819
    -#, c-format
    -msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
    -msgstr "      CheckWert %*s  Kopf  Schalter    KompGröße    Speicher  Filter"
    -
    -#: src/xz/list.c:897 src/xz/list.c:1072
    -#, c-format
    -msgid "  Memory needed:      %s MiB\n"
    -msgstr "  Benötigter Speicher: %s MiB\n"
    -
    -#: src/xz/list.c:899 src/xz/list.c:1074
    -#, c-format
    -msgid "  Sizes in headers:   %s\n"
    -msgstr "  Größe in Köpfen:     %s\n"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "Yes"
    -msgstr "Ja"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "No"
    -msgstr "Nein"
    -
    -#: src/xz/list.c:901 src/xz/list.c:1076
    -#, c-format
    -msgid "  Minimum XZ Utils version: %s\n"
    -msgstr "  Kleinste XZ Utils version: %s\n"
    -
    -#. TRANSLATORS: %s is an integer. Only the plural form of this
    -#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
    -#: src/xz/list.c:1051
    -#, c-format
    -msgid "%s file\n"
    -msgid_plural "%s files\n"
    -msgstr[0] "%s Datei\n"
    -msgstr[1] "%s Dateien\n"
    -
    -#: src/xz/list.c:1064
    -msgid "Totals:"
    -msgstr "Gesamt:"
    -
    -#: src/xz/list.c:1065
    -#, c-format
    -msgid "  Number of files:    %s\n"
    -msgstr "   Anzahl Dateien:     %s\n"
    -
    -#: src/xz/list.c:1140
    -msgid "--list works only on .xz files (--format=xz or --format=auto)"
    -msgstr "--list funktioniert nur mit .xz Dateien (--format=xz oder --format=auto)"
    -
    -#: src/xz/list.c:1146
    -msgid "--list does not support reading from standard input"
    -msgstr "--list unterstützt kein Lesen der Standardeingabe"
    -
    -#: src/xz/main.c:89
    -#, c-format
    -msgid "%s: Error reading filenames: %s"
    -msgstr "%s: Fehler beim Lesen der Dateinamen: %s"
    -
    -#: src/xz/main.c:96
    -#, c-format
    -msgid "%s: Unexpected end of input when reading filenames"
    -msgstr "%s: Unerwartetes Ende beim Lesen der Dateinamen"
    -
    -#: src/xz/main.c:120
    -#, c-format
    -msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?"
    -msgstr "%s: Null Charakter gefunden beim Lesen der Dateinamen; Meinten Sie `--files0' statt `--files'?"
    -
    -#: src/xz/main.c:174
    -msgid "Compression and decompression with --robot are not supported yet."
    -msgstr "Kompression und Dekompression mit --robot ist noch nicht unterstützt."
    -
    -#: src/xz/main.c:231
    -msgid "Cannot read data from standard input when reading filenames from standard input"
    -msgstr "Lesen der Standardeingabe ist nicht möglich, wenn die Dateinamen auch von der Standardeingabe gelesen werden"
    -
    -#. TRANSLATORS: This is the program name in the beginning
    -#. of the line in messages. Usually it becomes "xz: ".
    -#. This is a translatable string because French needs
    -#. a space before a colon.
    -#: src/xz/message.c:713
    -#, c-format
    -msgid "%s: "
    -msgstr "%s: "
    -
    -#: src/xz/message.c:776 src/xz/message.c:826
    -msgid "Internal error (bug)"
    -msgstr "Interner Fehler (Bug)"
    -
    -#: src/xz/message.c:783
    -msgid "Cannot establish signal handlers"
    -msgstr "Kann Signal Routine nicht setzen"
    -
    -#: src/xz/message.c:792
    -msgid "No integrity check; not verifying file integrity"
    -msgstr "Kein Integritäts-Check; werde Datei-Integrität nicht überprüfen"
    -
    -#: src/xz/message.c:795
    -msgid "Unsupported type of integrity check; not verifying file integrity"
    -msgstr "Typ des Integritäts-Checks nicht unterstützt; werde Datei-Integrität nicht überprüfen"
    -
    -#: src/xz/message.c:802
    -msgid "Memory usage limit reached"
    -msgstr "Speicher-Limit erreicht"
    -
    -#: src/xz/message.c:805
    -msgid "File format not recognized"
    -msgstr "Datei Format nicht erkannt"
    -
    -#: src/xz/message.c:808
    -msgid "Unsupported options"
    -msgstr "Optionen nicht unterstützt"
    -
    -#: src/xz/message.c:811
    -msgid "Compressed data is corrupt"
    -msgstr "Komprimierte Daten sind korrupt"
    -
    -#: src/xz/message.c:814
    -msgid "Unexpected end of input"
    -msgstr "Unerwartetes Eingabe Ende"
    -
    -#: src/xz/message.c:847
    -#, c-format
    -msgid "%s MiB of memory is required. The limiter is disabled."
    -msgstr "%s MiB Speicher wird benötigt. Der Begrenzer ist deaktiviert."
    -
    -#: src/xz/message.c:875
    -#, c-format
    -msgid "%s MiB of memory is required. The limit is %s."
    -msgstr "%s MiB Speicher wird benötigt. Limit ist %s."
    -
    -#: src/xz/message.c:1042
    -#, c-format
    -msgid "%s: Filter chain: %s\n"
    -msgstr "%s: Filter Kette: %s\n"
    -
    -#: src/xz/message.c:1052
    -#, c-format
    -msgid "Try `%s --help' for more information."
    -msgstr "Versuchen Sie `%s --help' für mehr Informationen."
    -
    -#: src/xz/message.c:1078
    -#, c-format
    -msgid ""
    -"Usage: %s [OPTION]... [FILE]...\n"
    -"Compress or decompress FILEs in the .xz format.\n"
    -"\n"
    -msgstr ""
    -"Benutzung: %s [OPTION]... [DATEI]...\n"
    -"Komprimiert oder dekomprimiert .xz DATEI(EN).\n"
    -"\n"
    -
    -#: src/xz/message.c:1085
    -msgid "Mandatory arguments to long options are mandatory for short options too.\n"
    -msgstr ""
    -"Obligatorische Argumente für lange Optionen sind auch für kurze Optionen\n"
    -"zwingend.\n"
    -
    -#: src/xz/message.c:1089
    -msgid " Operation mode:\n"
    -msgstr " Operationsmodus:\n"
    -
    -#: src/xz/message.c:1092
    -msgid ""
    -"  -z, --compress      force compression\n"
    -"  -d, --decompress    force decompression\n"
    -"  -t, --test          test compressed file integrity\n"
    -"  -l, --list          list information about .xz files"
    -msgstr ""
    -"  -z, --compress        erzwinge Komprimierung\n"
    -"  -d, --decompress      erzwinge Dekomprimierung\n"
    -"  -t, --test            überprüfe Datei Integrität\n"
    -"  -l, --list            liste Datei Informationen"
    -
    -#: src/xz/message.c:1098
    -msgid ""
    -"\n"
    -" Operation modifiers:\n"
    -msgstr ""
    -"\n"
    -" Operationsmodifikatoren:\n"
    -
    -#: src/xz/message.c:1101
    -msgid ""
    -"  -k, --keep          keep (don't delete) input files\n"
    -"  -f, --force         force overwrite of output file and (de)compress links\n"
    -"  -c, --stdout        write to standard output and don't delete input files"
    -msgstr ""
    -"  -k, --keep            Eingabedateien beibehalten (nicht löschen)\n"
    -"  -f, --force           erzwinge Überschreiben der Ausgabedatei und\n"
    -"                        (de)komprimiere Verweise (Links)\n"
    -"  -c, --stdout          schreibe nach Standard Output und lösche nicht die\n"
    -"                        Eingabedateien"
    -
    -#: src/xz/message.c:1107
    -msgid ""
    -"      --single-stream decompress only the first stream, and silently\n"
    -"                      ignore possible remaining input data"
    -msgstr ""
    -"      --single-stream   dekomprimiere nur den ersten Datenstrom und ignoriere\n"
    -"                        stillschweigend mögliche weitere Eingabedaten"
    -
    -#: src/xz/message.c:1110
    -msgid ""
    -"      --no-sparse     do not create sparse files when decompressing\n"
    -"  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
    -"      --files[=FILE]  read filenames to process from FILE; if FILE is\n"
    -"                      omitted, filenames are read from the standard input;\n"
    -"                      filenames must be terminated with the newline character\n"
    -"      --files0[=FILE] like --files but use the null character as terminator"
    -msgstr ""
    -"      --no-sparse       erzeuge keine sparse Datei beim Dekomprimieren\n"
    -"  -S, --suffix=.SUF     benutze `.SUF' Endung für komprimierte Dateien\n"
    -"      --files=[DATEI]   lese zu verarbeitende Dateinamen von DATEI; falls\n"
    -"                        DATEI nicht angegeben wurde, werden Dateinamen\n"
    -"                        von Standard Input gelesen. Dateinamen müssen mit\n"
    -"                        einem Zeilenumbruch voneinander getrennt werden\n"
    -"      --files0=[DATEI]  wie --files, aber benutze den Null Charakter als Trenner"
    -
    -#: src/xz/message.c:1119
    -msgid ""
    -"\n"
    -" Basic file format and compression options:\n"
    -msgstr ""
    -"\n"
    -" Grundlegende Optionen für Dateiformat und Kompression:\n"
    -
    -#: src/xz/message.c:1121
    -msgid ""
    -"  -F, --format=FMT    file format to encode or decode; possible values are\n"
    -"                      `auto' (default), `xz', `lzma', and `raw'\n"
    -"  -C, --check=CHECK   integrity check type: `none' (use with caution),\n"
    -"                      `crc32', `crc64' (default), or `sha256'"
    -msgstr ""
    -"  -F, --format=FMT      Dateiformat zur Kodierung oder Dekodierung; mögliche\n"
    -"                        Werte sind `auto' (Voreinstellung), `xz', `lzma' und\n"
    -"                        `raw'\n"
    -"  -C, --check=CHECK     Typ des Integritätschecks: `none' (Vorsicht), `crc32',\n"
    -"                        `crc64' (Voreinstellung), oder `sha256'"
    -
    -#: src/xz/message.c:1126
    -msgid "      --ignore-check  don't verify the integrity check when decompressing"
    -msgstr "     --ignore-check     überprüfe nicht den Integritätscheck beim Dekomprimieren"
    -
    -#: src/xz/message.c:1130
    -msgid ""
    -"  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
    -"                      decompressor memory usage into account before using 7-9!"
    -msgstr ""
    -"  -0 .. -9              Kompressionseinstellung; Voreinstellung is 6. Beachten\n"
    -"                        Sie den Speicherverbrauch des Komprimieres *und* des\n"
    -"                        Dekomprimierers, wenn Sie 7-9 benutzen!"
    -
    -#: src/xz/message.c:1134
    -msgid ""
    -"  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
    -"                      does not affect decompressor memory requirements"
    -msgstr ""
    -"  -e, --extreme         Versuche durch stärkere CPU Nutzung das Kompressions-\n"
    -"                        verhältnis zu verbessern. Das beeinflusst nicht den\n"
    -"                        Speicherbedarf des Dekomprimierers."
    -
    -#: src/xz/message.c:1138
    -msgid ""
    -"  -T, --threads=NUM   use at most NUM threads; the default is 1; set to 0\n"
    -"                      to use as many threads as there are processor cores"
    -msgstr ""
    -"  -T, --threads=ZAHL    erzeuge höchstens ZAHL viele Threads; die Grund-\n"
    -"                        einstellung ist 1. Wenn der Wert 0 angegeben wird, dann\n"
    -"                        werden so viele Threads erzeugt wie es Prozessor Kerne\n"
    -"                        gibt"
    -
    -#: src/xz/message.c:1143
    -msgid ""
    -"      --block-size=SIZE\n"
    -"                      start a new .xz block after every SIZE bytes of input;\n"
    -"                      use this to set the block size for threaded compression"
    -msgstr ""
    -"      --block-size=GRÖßE\n"
    -"                        beginne einen neuen .xz Block nach GRÖßE Input Bytes;\n"
    -"                        Benutzen Sie diese Option um die Block Größe für\n"
    -"                        Kompression mit mehreren Threads zu setzen"
    -
    -#: src/xz/message.c:1147
    -msgid ""
    -"      --block-list=SIZES\n"
    -"                      start a new .xz block after the given comma-separated\n"
    -"                      intervals of uncompressed data"
    -msgstr ""
    -"      --block-list=GRÖßEN\n"
    -"                        beginne einen neuen .xz Block gemäß der angegebenen,\n"
    -"                        durch Kommata getrennten Intervalle an unkomprimierten\n"
    -"                        Daten"
    -
    -#: src/xz/message.c:1151
    -msgid ""
    -"      --flush-timeout=TIMEOUT\n"
    -"                      when compressing, if more than TIMEOUT milliseconds has\n"
    -"                      passed since the previous flush and reading more input\n"
    -"                      would block, all pending data is flushed out"
    -msgstr ""
    -"      --flush-timeout=ZEITÜBERSCHREITUNG\n"
    -"                        wenn beim Komprimieren mehr als ZEITÜBERSCHREITUNG\n"
    -"                        Millisekunden vergangen sind seit der letzten Flush\n"
    -"                        Operation, und das Lesen von zusätzlichem Input den\n"
    -"                        Prozess blockieren würde, dann werden alle noch aus-\n"
    -"                        stehenden Daten geschrieben"
    -
    -#: src/xz/message.c:1157
    -#, no-c-format
    -msgid ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      set memory usage limit for compression, decompression,\n"
    -"                      or both; LIMIT is in bytes, % of RAM, or 0 for defaults"
    -msgstr ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT  Setze Speicher Nutzungslimit für Kompression,\n"
    -"                        Dekompression, oder beides; LIMIT ist in bytes, % RAM,\n"
    -"                        oder 0 für Grundeinstellungen."
    -
    -#: src/xz/message.c:1164
    -msgid ""
    -"      --no-adjust     if compression settings exceed the memory usage limit,\n"
    -"                      give an error instead of adjusting the settings downwards"
    -msgstr ""
    -"      --no-adjust       Wenn die Kompressionseinstellungen das Speicher\n"
    -"                        Nutzungslimit übersteigen, erzeuge einen Fehler statt\n"
    -"                        die Einstellungen nach unten anzupassen."
    -
    -#: src/xz/message.c:1170
    -msgid ""
    -"\n"
    -" Custom filter chain for compression (alternative for using presets):"
    -msgstr ""
    -"\n"
    -" User-definierte Filter Kette für Kompression (alternativ zu Voreinstellung):"
    -
    -#: src/xz/message.c:1179
    -msgid ""
    -"\n"
    -"  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
    -"  --lzma2[=OPTS]      more of the following options (valid values; default):\n"
    -"                        preset=PRE reset options to a preset (0-9[e])\n"
    -"                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=NUM     number of literal context bits (0-4; 3)\n"
    -"                        lp=NUM     number of literal position bits (0-4; 0)\n"
    -"                        pb=NUM     number of position bits (0-4; 2)\n"
    -"                        mode=MODE  compression mode (fast, normal; normal)\n"
    -"                        nice=NUM   nice length of a match (2-273; 64)\n"
    -"                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  maximum search depth; 0=automatic (default)"
    -msgstr ""
    -"\n"
    -"  --lzma1[=OPTIONEN]    LZMA1 oder LZMA2; OPTIONEN ist eine durch Kommata\n"
    -"  --lzma2[=OPTIONEN]    getrennte Liste bestehend aus den folgenden Optionen\n"
    -"                        (zulässige Werte; Voreinstellung):\n"
    -"                          preset=NUM Setze Optionen zurück zu Voreinstellung\n"
    -"                                     (0-9[e])\n"
    -"                          dict=NUM   Wörterbuch Größe (4 KiB - 1536 MiB; 8 MiB)\n"
    -"                          lc=NUM     Anzahl der Literal Kontext Bits (0-4; 3)\n"
    -"                          lp=NUM     Anzahl der Literal Positionsbits (0-4; 0)\n"
    -"                          pb=NUM     Anzahl der Positionsbits (0-4; 2)\n"
    -"                          mode=MODUS Kompressionsmodus (fast, normal; normal)\n"
    -"                          nice=NUM   Nice-Länge eines Treffers (2-273; 64)\n"
    -"                          mf=NAME    Algorithmus zum Auffinden von\n"
    -"                                     Übereinstimmungen (hc3, hc4, bt2, bt3, bt4;\n"
    -"                                     bt4)\n"
    -"                          depth=NUM  Maximale Suchtiefe; 0=automatisch\n"
    -"                                     (Voreinstellung)"
    -
    -#: src/xz/message.c:1194
    -msgid ""
    -"\n"
    -"  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
    -"  --powerpc[=OPTS]    PowerPC BCJ filter (big endian only)\n"
    -"  --ia64[=OPTS]       IA-64 (Itanium) BCJ filter\n"
    -"  --arm[=OPTS]        ARM BCJ filter (little endian only)\n"
    -"  --armthumb[=OPTS]   ARM-Thumb BCJ filter (little endian only)\n"
    -"  --sparc[=OPTS]      SPARC BCJ filter\n"
    -"                      Valid OPTS for all BCJ filters:\n"
    -"                        start=NUM  start offset for conversions (default=0)"
    -msgstr ""
    -"\n"
    -"  --x86[=OPTIONEN]      x86 BCJ Filter (32-bit und 64-bit)\n"
    -"  --powerpc[=OPTIONEN]  PowerPC BCJ Filter (nur big endian)\n"
    -"  --ia64[=OPTIONEN]     IA64 (Itanium) BCJ Filter\n"
    -"  --arm[=OPTIONEN]      ARM BCJ Filter (nur little endian)\n"
    -"  --armthumb[=OPTIONEN] ARM-Thumb BCJ Filter (nur little endian)\n"
    -"  --sparc[=OPTIONEN]    SPARC BCJ Filter\n"
    -"                        Zulässige Optionen für alle BCJ Filter:\n"
    -"                          start=NUM  Start-Offset für Konversion\n"
    -"                          (Voreinstellung=0)"
    -
    -#: src/xz/message.c:1206
    -msgid ""
    -"\n"
    -"  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
    -"                        dist=NUM   distance between bytes being subtracted\n"
    -"                                   from each other (1-256; 1)"
    -msgstr ""
    -"\n"
    -"  --delta[=OPTIONEN]    Delta Filter; zulässige Optionen (gültige Werte;\n"
    -"                        Voreinstellung):\n"
    -"                          dist=NUM  Abstand zwischen den Bytes, die voneinander\n"
    -"                                    subtrahiert werden (1-256; 1)"
    -
    -#: src/xz/message.c:1214
    -msgid ""
    -"\n"
    -" Other options:\n"
    -msgstr ""
    -"\n"
    -" Andere Optionen:\n"
    -
    -#: src/xz/message.c:1217
    -msgid ""
    -"  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
    -"  -v, --verbose       be verbose; specify twice for even more verbose"
    -msgstr ""
    -"  -q, --quiet           unterdrücke Warnungen; benutze diese Option zweimal\n"
    -"                        um auch Fehlermeldungen zu unterdrücken\n"
    -"  -v, --verbose         sei gesprächig; benutze diese Option zweimal um noch\n"
    -"                        gesprächiger zu sein"
    -
    -#: src/xz/message.c:1222
    -msgid "  -Q, --no-warn       make warnings not affect the exit status"
    -msgstr "  -Q, --no-warn         Warnungen verändern nicht den exit status"
    -
    -#: src/xz/message.c:1224
    -msgid "      --robot         use machine-parsable messages (useful for scripts)"
    -msgstr ""
    -"      --robot           benutze Maschinen-lesbare Meldungen (nützlich für\n"
    -"                        Skripte)"
    -
    -#: src/xz/message.c:1227
    -msgid ""
    -"      --info-memory   display the total amount of RAM and the currently active\n"
    -"                      memory usage limits, and exit"
    -msgstr "      --info-memory     zeige Speicherlimit an und terminiere"
    -
    -#: src/xz/message.c:1230
    -msgid ""
    -"  -h, --help          display the short help (lists only the basic options)\n"
    -"  -H, --long-help     display this long help and exit"
    -msgstr ""
    -"  -h, --help            zeige kurze Hilfe and (zeigt nur die grundlegenden\n"
    -"                        Optionen)\n"
    -"  -H, --long-help       zeige diese lange Hilfe an und terminiere"
    -
    -#: src/xz/message.c:1234
    -msgid ""
    -"  -h, --help          display this short help and exit\n"
    -"  -H, --long-help     display the long help (lists also the advanced options)"
    -msgstr ""
    -"  -h, --help            zeige diese kurze Hilfe an und terminiere\n"
    -"  -H, --long-help       zeige die lange Hilfe an (zeigt auch fortgeschrittene\n"
    -"                        Optionen an)"
    -
    -#: src/xz/message.c:1239
    -msgid "  -V, --version       display the version number and exit"
    -msgstr "  -V, --version         zeige Versionsnummer an und terminiere"
    -
    -#: src/xz/message.c:1241
    -msgid ""
    -"\n"
    -"With no FILE, or when FILE is -, read standard input.\n"
    -msgstr ""
    -"\n"
    -"Wenn DATEI nicht angegeben wurde, oder DATEI gleich - ist, dann wird von\n"
    -"der Standardeingabe gelesen.\n"
    -
    -#. TRANSLATORS: This message indicates the bug reporting address
    -#. for this package. Please add _another line_ saying
    -#. "Report translation bugs to <...>\n" with the email or WWW
    -#. address for translation bugs. Thanks.
    -#: src/xz/message.c:1247
    -#, c-format
    -msgid "Report bugs to <%s> (in English or Finnish).\n"
    -msgstr ""
    -"Melde Bugs an <%s> (in englisch oder finnisch).\n"
    -"Melde Übersetzungsfehler an  (in englisch oder deutsch).\n"
    -
    -#: src/xz/message.c:1249
    -#, c-format
    -msgid "%s home page: <%s>\n"
    -msgstr "%s Homepage: <%s>\n"
    -
    -#: src/xz/message.c:1253
    -msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
    -msgstr "DAS IST EINE ENTWICKLERVERSION, DIE NICHT FÜR DEN PRODUKTIVBETRIEB GEEIGNET IST."
    -
    -#: src/xz/options.c:86
    -#, c-format
    -msgid "%s: Options must be `name=value' pairs separated with commas"
    -msgstr "%s: Optionen müssen in der Form `Name=Wert` gegeben werden, getrennt durch Kommata"
    -
    -#: src/xz/options.c:93
    -#, c-format
    -msgid "%s: Invalid option name"
    -msgstr "%s: Ungültige Option"
    -
    -#: src/xz/options.c:113
    -#, c-format
    -msgid "%s: Invalid option value"
    -msgstr "%s: Ungültiger Wert für Option"
    -
    -#: src/xz/options.c:247
    -#, c-format
    -msgid "Unsupported LZMA1/LZMA2 preset: %s"
    -msgstr "LZMA1/LZMA2 Voreinstellung ist ungültig: %s"
    -
    -#: src/xz/options.c:355
    -msgid "The sum of lc and lp must not exceed 4"
    -msgstr "Die Summe aus lc und lp darf höchstens 4 sein"
    -
    -#: src/xz/options.c:359
    -#, c-format
    -msgid "The selected match finder requires at least nice=%"
    -msgstr "Der ausgewählte Algorithmus zum Auffinden von Übereinstimmungen braucht mindestens nice=%"
    -
    -#: src/xz/suffix.c:133 src/xz/suffix.c:258
    -#, c-format
    -msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
    -msgstr "%s: Mit --format=raw ist --suffix=.SUF notwendig, falls nicht auf die Standardausgabe geschrieben wird"
    -
    -#: src/xz/suffix.c:164
    -#, c-format
    -msgid "%s: Filename has an unknown suffix, skipping"
    -msgstr "%s: Dateiname hat unbekannte Endung, überspringe"
    -
    -#: src/xz/suffix.c:185
    -#, c-format
    -msgid "%s: File already has `%s' suffix, skipping"
    -msgstr "%s: Datei hat bereits `%s' Endung, überspringe"
    -
    -#: src/xz/suffix.c:393
    -#, c-format
    -msgid "%s: Invalid filename suffix"
    -msgstr "%s: Ungültige Datei Endung"
    -
    -#: src/xz/util.c:71
    -#, c-format
    -msgid "%s: Value is not a non-negative decimal integer"
    -msgstr "%s: Wert ist keine nicht-negative ganze Zahl"
    -
    -#: src/xz/util.c:113
    -#, c-format
    -msgid "%s: Invalid multiplier suffix"
    -msgstr "%s: Ungültige Einheit"
    -
    -#: src/xz/util.c:115
    -msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
    -msgstr "Gültige Einheiten sind `KiB' (2^10), `MiB' (2^20), und `GiB' (2^30)."
    -
    -#: src/xz/util.c:132
    -#, c-format
    -msgid "Value of the option `%s' must be in the range [%, %]"
    -msgstr "Wert der Option `%s' muss im Bereich [%, %] sein"
    -
    -#: src/xz/util.c:257
    -msgid "Empty filename, skipping"
    -msgstr "Leere Dateiname, überspringe"
    -
    -#: src/xz/util.c:271
    -msgid "Compressed data cannot be read from a terminal"
    -msgstr "Komprimierte Daten können nicht vom Terminal gelesen werden"
    -
    -#: src/xz/util.c:284
    -msgid "Compressed data cannot be written to a terminal"
    -msgstr "Komprimierte Daten können nicht auf das Terminal geschrieben werden"
    -
    -#: src/common/tuklib_exit.c:39
    -msgid "Writing to standard output failed"
    -msgstr "Schreiben auf die Standardausgabe fehlgeschlagen"
    -
    -#: src/common/tuklib_exit.c:42
    -msgid "Unknown error"
    -msgstr "Unbekannter Fehler"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard input: %s"
    -#~ msgstr "Fehler beim Setzen des O_NONBLOCK Flags für Standard Output: %s"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard output: %s"
    -#~ msgstr "Fehler beim Setzen von O_NONBLOCK für die Standardausgabe: %s"
    diff --git a/external/public-domain/xz/dist/po/fr.gmo b/external/public-domain/xz/dist/po/fr.gmo
    deleted file mode 100644
    index fdb990fbe6a0849204b9152ca1634005e538d52a..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
    
    literal 24677
    zcmchfdyr(;eb;X!*_Jm^Y|A3CWyKuZ8G1(A9?i_IR@xbjrF~i>@9eJjAwLw^bEo^x
    z%+>ZweYv!Mr+3$#==tnu{IA6LWihfDguZ^PH
    zfG58zif#v90#om+y|E)4*>5zZbat#wdCN
    z@G|gW;3n|LfjVxoqG$#9hro{jkNmkP`d`3*1^m0ffA&35^m*EUlE$9k{!iZ&
    zMIQnle{&R_0)7doa(CVvMX#gWKLoy$`=5JD6#Wh09|4a7KY3pieHQp7;0wU_eqR)Q
    z4EQzRuL3{#R$spU=cDM0-2Wo51^keUBD#qFFu+&8&EGp9Rii~9MWgqI=hp-L>jD1L
    z0Dl>HgL3~V+&}Yn-_8&y{CpZX3;b!|5#U#VpfGyPJE90wMfU<(o@f>bYNA6xnu=Be
    zyaKFo|HD9y=jQ_a_duo=eG_;;@Sg9Fq6dMG0jGdnp!)x8c>a%p2f6=kp!&IkLWhC(
    z0zqYT4ybuw0cw3e1!PI0p9X^3=of$v_}c;g32=-1H~)nwdKCB(pyu^&fQ!Jd0_iHc
    zi@~#W(E@M*xC&Hz9|r3EPXaaWF9Ag_{}U*@JUZ>ic^-I(`wieS@F##x;O_vR0WQz@
    zas4>(9QVHf6uu9D6t#O4sQy#nG2q956p4Nrcqj0G05#7)1&SW-ejth-0UiXZUIK)K
    zqYne=GWslV1^BOlTBkcfDnpL$5AXs|ba?})`dngr
    z{5%fKfExD~fa0s)2c87p$D}}M6a&@YCxNd4z64|`qMrw9-M$XI3-~SI0pJ}pCiuDl
    z?+tJ&z&YS+dA}6ksQ}Lf_`U!e0k#9Y285KO7l5EH`W#T}_Ul05`5VBefKyCb@2>$L
    z2mXDa@b(Sh?Z8*fN743oFb3f7a{p0?13{T5LDzW%J|k42#5M+Ri+q8EXW1HT3opTFgt@8>K~?QH_tpz!@`zzyJ&m;L7AY|KC8hd*VG&^qs(~K=t<#pvL=CK+)eg=khdM5;P$uAU`~6h7j)8xbQ~Z-3SGm{>
    zH^R^BIcGV)kMl2biiSlO_i%ogGe3@TaV@_Aisp56JTRF8DcJE2ejnxhB1f-oyiC;PTR7J^Mf=~&spDx*(b9F!@8-ON^Ua((#0xqua1J<6b3!skiw>wm>w7=v
    zM>t^@I}(21&G}b2mpMhFEzWt)w{wcO#4oUc9as2;g-n(;fuh~&0Xy3PyGK9Fx$bYH
    zhk$L)li^-G)Ckw_1U??FKL-3B&hO;xa&B?HiSrT8*K+2^^IR-)B6ds;zcIX+2L4F6
    zehm1R!?nPNI9J2{A>bQ0A$yaT_lD;=kgV9?d@JXt!^7_aiYJ!B{cC`);*=cF^(hEn
    z@C>j;;SY0uhVv!Pf6MthoELd_7iDxD;QTX==Xj=d)*;@~v!CRd)>QYRJHgvH_3o>@
    zQ(YaR6FvK5o@q`x@-`k=^XsI0jZ-jx7aee}UT-F?LHx|}x$~DUKI`l_sV8nDZ4HwC
    zlDitW(x%gEH|?+a9VXe5YbG15H{6Y+-=%_KNbN0*wAb$T6P2QS
    zx6y62y4N&|Zf}rwJJ~BoQ?H+7$zb{Xg;UP1ik1dlhUnkA>ACvRXOd@UCSs_WHcDhS
    zG?ci%?XvVn;-(M3J3a2|ZvLS|M^@A0OYRYVC%4pUghg|%GiXPA&0mH#yW%K
    z`oOKH1ExAxKfL4)?bB3mpQd`2
    z(*X3?O>e~6;GpYt`|Y^36yW5hI%y*b1Jb2yC7sOyG`Yc=wc`QgIlWL{c=*tgJ92n(
    zEA5Ttv&U8$jtiAG(oR!Ez128$&}}siA9U-31^sZlJ^99Rh
    zX~O!7`|Z*4?%0LZN+CB5p$=Nf-ma)Q*n*tP>eQ@X(xY3dpCKcvb9Cpd|9OEp&nI9P+q+5CIrBom53L?l)c9=?w?7
    z2O_bDC~dvfZCt5KNH1SpdH<=46EN=46}wJy&COoF;jEgAH<*UW>`i9U*)97gw3Q<6
    z`l!52oIUL1h(uR3<3Sv0T;<3lZEa)|8ryGR2@AUIG_9Z;>CfiBG@-F!mM|O8hMEvv
    zNE`W?n$Q=S47P+%#+nZsf{ARzAT!-W)Ft)CR?@hFg6?)|1IHNBjcsd66W{EogKg(a
    z*h)2%qNUDe*-~etTW=?*#cdi#)%RMlZ)DINpflojci1t#dg0iri4TpnG3@t~&Y-pJ
    zQ2ngPglUF$hgrOdkWJg@orBg!ay=asL!gwstLNieKC`mAaw)V~*XaEFat1|-`szW@
    zk(VeQdpwQ)3eS57w3}rPB5m_=fboM9X2t@oW5O&s8>$!p?lZgSpqmo8fh}W_IqM*>
    zc~;E1)2+wN=ip!)W4cjYWl_WcHqBgey^%lx!uZ~iPa2vy1SGqp-)EF*CmV<_rQ57S
    z@xK}@I%#&Vb*{m&BZHH~ghq8VyKw!$H6X_U)%*(ysmx1&3cfm_Eg~RKOVatdzYxL9JAe$)~l5S`v^=tq}+7&)9rEe43Nc+sz
    z7x0{%X;Baa6Hx92mBZA_QVpb^w9!+dL6eVFL3~2O42A2a?$6v4l6`&WPPbzCARH$!
    z`!32T=2%VImrbm=)8_4ndh2s;c6Qd)kB0IB60;F$YSVE0d$
    zPD$$&9AQaBE*5{IVbXFvL4qei**;u9`nHI{ofcboy}o>U^^yiBD$r6$)l)q|MPba+
    zwEAf#OC{dCnAi6Qw_@}o;Y>l
    z-3(>7${1|-l0~=H>2?xY6;T;gH|PejI5SE3tTp
    zVt6r#U@iLml2^K2H#Y&BEQU3fF{F;vp=1P3C;W%oN-vy20x_!wi)~|iT4M^vouAQ&
    zM$O*@&rC}a6k$D4O?)%>!%JP~254l)kz&ntk?1*vf_-NO8|o%dnEA9P&R=$ew4F?n
    zSj{f%UqR_OQtl_u4^s`HGqCw=X;fQDs~08%s9FfwR<}QJ_8!wc!>N>aVAx(aQ#M$S
    z<}W;m3{#}&D~uZ(v1{Xwn^zU;KwtWZ
    zfP`cHiiUnANh)ZtyJ>HD5r#GRnV6!pM{b{0}u~MFtDseyUVKvgQJvtYQCjP7DuuQ`mwtd
    zBUwUPyce%)5#*ZKN=MEemuC~4!HZsZs-`{Gg>xrRT<5$8$lYc0M9O;}U6QSxtG2v^
    zzrUbvX+qjDDmtT1c}!(;v#i8o`BYcoO$e7TXSo+v#=k*}%JA=CWhTu~cPev)nAGAb
    znp$Cq_rBj<9;CQYteE`P#nA5ABEn>-sI+T?9y=CI%8cbL)9{%J`LP7l_2Om|@$V~F
    z-|WG#$GfI^3mCRFczF!_*3SDeM8pYfJ#Cc!6~BH^eiapkD$#0hMjYw{U)m#77I?52
    zkXu30HfP->bd$L^(o9p??5!5ZI-&w1R0dwts%aIhJ1>LO(pDFJ(!=yybdOGD@6_8x
    zXFn(6j0wAZ7a&Dx5p
    z2=g8iGDl2twaJxYW?W7zPb}`r_I{;Uqomy%Y?u8o;I_FiTQO>VT>*710ivx~kLtKI
    zXB$2)-LP||1Fk1d0_Q;9LK-+!YrUc{j8`w3pb6f=mId0oa%`yA(?
    zLz_eXuFd{I+G`On8u!+#Pp83;)C$kdob@jh%5P$HGzLhb-Q&>9Y`eYQZ4nq7Gtjd#
    z5uxGDVJq(2aCfzEcGQ8|z&yu4Q{ZY3T`ghjZKJ!kyF(Z?Cg>5Yz_r|6tD!9lZ#sWk
    zd(7r>F6s7|7c5gdZ{%p;3A_
    zcg8_Z>5dmwFLlw@#KBvd027MCMo_M^Y`m8{$#qn`+*KmG5>8s|39r1bHXd!EiYH99
    zQ8+Ys5aFe42TVo!8s}zMp{KPoC5dJxD!-k2C)xCYOO$)ce0=4kZ{;l-S@=^pHd5Wy
    zpaV_iLKeOuT0yu1qbnfL+fu$IGsVoRDNxvBXJ~rHRRmJ73koYbOsOOz#SaQo%n%lZ
    zI@h}WE5S6ze#ln=U%VJT#sng#xRon66CJZ~4LH-z*Hi;08QmGO$VbpEEOdD#4DK5_
    z(rWwSWhWM{DD-*m@Z^2?_W6A!Z3hj54Tg$Jvn`B|%?`_m^l7%RB%(qELH&xz`e4o|
    z5+^Y0xT2BFte}vsxrSG9uz;A|SBdioN^76uB9s9#f(h?a9ty+r>koT_qA4>FWq%hY
    zs-BqVoX2V8Itq&=Pi!ZH+34i18gQ?yvV2(!jtou!^Q3y%B7qM_zX~JJ@o~Xhl(W
    zt*fz+n_eGo&P0COwp;+b=}KJ8c)%>`Xcc0JCHnEHH;3kVY7FL~1s}}3ZT#?1j!^`+
    zFMp3K!bZbt*fcBmJ&{HX4QrDyVRzV%g0))-M@v>!J!`W%CzTsnR7#F3M^}u7;a{_+
    z#Z`XC!jHuajNa_Hnvf_FnPzmh%inG}sV&Vs!mo8RIa|n5Ds+r(u5+UamP1FEr#F=2w^gGF3n
    zyb-h5Rh<{giHgi5kkLD<$W*Q@0yk752%dsG+9H)tI#<(vw<8ikq4iVQyjbyk%RBbgZkVZhn
    z^n67c9*)e1tL&Hbwzk>MgD-;BKh2iF492&W%NCpV9tD{_%vdmWPLH#ZS
    z9Gm#4773i-H!Pv6a37d?q_uI+6qwXf6x8qcxL$@sELNGrtv-Ym=tZ
    z+wE^2IDhU^{RAROA&>e=jMhcBFgO2DeU7|{BX0i4;zJKTFt;!_N5T4qulO?raW0
    zU;Pq$5sOX|u6VYHDnGEgvU;kV=ltv(YltT5(2IqxmFe;zo0(~6$#zii;+8L8I$eLH
    zET_?IB>nm+#oZCBi|!Hpy#wc4EL^L88U=*|)#=%7woLMozg(W~EHBT`xX0X_TO^pQ
    z&3L$YZ#EX;*6Oy`jaFQ3
    zT)Gz0fqX3*yv2mAy{(O8TNTaSV$N3C-1ug0Ep5w$Bk~c?*X(rJ#v_?q%+IHAP0o_~
    zf1bKkBd$x1mCxM*FW+|Z7TYx&T@t~D(j<5uSal?EX;YS@E~wc}+M(Iaq-DO>^SH*-
    zRkHUIXK&V*bSYG%#4ja)cA(5oeN@1J8LWjCPooy(N)ThKcP5Q
    zn!754`CPHBc<1v-XDcZZvFg=g1ZcBv2RAOwc5Xs#sAgh&LuzCrGBQIsL4B*1E7rg;
    zkZ`s>j(OFQ3w}Mjh=TPw8N}3{AIh+?3=Js@62@ARnXQ`SzWU7l&hbfOmyWHRIWsYB
    z%;OLQXuQg#%Cu_{Bi�D-^2d8WKdXN7kX+N$N4{?c8JsEL9Olq?P~-7q}qA8ifo%>t8HJV>5gt7QqEosHM%
    ztCYPOd#kl`lek|#`q9KPD5giy_$n&WG6PvG%x>Dn9^JWV2+6UC%L^eiC#5IQGZU^5
    zT-oDD0vh}MP%`UC1rf}^IQG_SXt
    zh?vALW6`6m)6UiIHWVZ46K`007dw5h^M!%Y$V8HCl8@LKiqxtjtWKno1Q$4=Awgw&
    zy;h05*K*?5Bt{oOx^G-QoKd6oo%@A(Qk=&zLkc2Y0S?cyJ2!J#6*eUD^syjFt93FF
    zO_ISR%6>(Z^=;Tj@Fs%UnolQSx)9M_w(JffN`}|#jTEOstAxTM9bJ60S8z{gPdcfq
    zwB3Q*`5Bof@&x1~*ARUTWKd(U^CFM?3Hr3}u*;1pHu3m!v4n+Tkbqr9
    zTPC1KoAbGIR&<=4-jy|%FNlPEku8VBP}UmK9_P%Qh3;lQrt=9iofZcpR*Yq-_Hr3^
    zr9@U=%y|N#$4mKZS$GZfb!Il2k#r%McWw&zCI~HfhW5vA
    z#1Zqf{&d`W+6253?@o2<0~U#tm6QFrm&hd~JHcF?6Of_xc$rDAB0?>mCtHGc#--kk
    zxK_KZ5_hC3K9Ennq?08#Sp5mOZH?uB*Blo7Awt47nuU4dUe&xGP2SV;
    z@0Yq~5i#%^)HFt!9INJtsxDLc}T10qiKEB;cDV9li4RGqPPBl
    zBmkdZ#`cDyWwI;4lgtdL-tr%rN=7g`l~qz7P4heMID!z4hm!M|J9}K__a4D^}tDTz9&h$p2R(L(hx{AaX2G$-<6eh;x^p%*X#e~P8gCX0+ZWuNuJq**jF&1y$yiKap{JWM&PFt56OiwDV(Y>~
    zF)8CPSRe|u_et~gW=mls6t=&HGb!_sIyJbu58_M_6pBF-GnZ#z)^i`^KY>W(m=;Nj
    zVI(+s_
    zRhX!<`ARK$T4s+OdajG};fqsmhU9lAS-RXV$qf}Y*i^w=Ek%K_73oc#*{JAHMJF6n
    zmRIR(u#;zM)#oMds^AOy4vV;gw@Gs}NhNFl$?__5|C9KGK4P)h@veraiY&~qm*enO
    zeEbj&Eiy9mCeIeCso;tHm7n;o=0_$_9X{(bAf45s9!-UBWabB(FmLgk-(_GN7^$Sg
    z_O;JtGDNGUo_ve8hl>`|R{xoDZ@
    zJZ8}dcrit`HPF(55{k@D-V_?otiH;+;y{@30H)`Sdiuv27t?pt-%ohhONvP|IH
    z3}-3D&`UzXr$zlj&Zk{NVCTbXpu(R+oZIg7n|yFosgAXpP5}2&S3|
    z5laY_i_%3EX-*R8713}jZG1bGk8*6kCZE@sxzI6I^wT`$Lk1yyWsAio>QFPn
    z-oWHD%W{OP#^HzTcb13!#s)IaGfo+mEfI32d}yJ9=j81Q|N2@kaWzs@4|-p3=cezb
    zQbQ}Y^CHV-ww8AH)_lS$pVG+!x0KZyb2Ddg{{}2)buF{})%~i7?yh2z?HNo=bQLEc
    z!5fC8p#lX2JqC7el8h8S7m(Z|4Qoi4aac1sP?)s_LCn?k8igAL=(%jJo$KKM-@
    zg5MJGLqQIklrUW}`U*c=)^xr#I#N+sW}Nt3Q1-xLlOwAb-rGD%8*5}Du2WMfIa0Kg
    zPeGBlA=Ub$Wf$FvGVXHr@|iPQx&d_0BHk(|$Ymc6>fU6L_nsy<>Q}WR0!^2>MHY-h
    zBR@Z^#l_>A^I5ZJV6of+9*q%+`II&bSYug~NelMK-&Vv>Q8>L;B(99f`xOZM+%!u!
    zHAXJkZVkZH
    zjxLG24)v$Z-3?#y7(oUF>ufyBV={F`wiS)(vUo_QmETSX9*bW`ImVbL`U=W7z3*C|
    zsUe`?c1c*}nRP6EmQ}LU-WZY9*y;`;cw5YntE;hS+U*__P=c94Bvqwg)@!lRl5bf>
    zp}Jxk`j;Jvg`US*y1TM|hb3kRGLZF~8*GEKo)jIlvHplkEyyxhb;{HN9|U
    z6dSxJNn!=o(bt6uF=2xNBJd56MwrJp^8DY>p9qCAzN>G$n<^9HU4TQjXuM$o`cW8u
    z%JgXo!^7)QwT2=BDCc}tan+;^3wFWa(LEw#RBulVT1S#WMfKeBGXW!9CPNEcORRd<
    z);~}J9~J_K&DlB9XWy+?+6>gEymOk8!Fg*9nQf_*W5|wy
    zf@}}u#eDoLV<#Nj23l5XP{<$gnD%@4l2+`J5`&M<=)Y?q7e=DwzTHtOk$bj(>0P9N
    z#{hloze%Zq45SGO%3%qY{dP9eO|t2HL^{WC!EaFBxMAm1#>dj)Nfx5G`#v6o@8A(IL&>1QgOQKOrDV%9WCiS?g%!}N;=FqDv
    z)WMrMFY9(R^5NVlyNbecVz!KINj)}I^<9u9PU718=qp3F
    z>>|tY6-^Xb*s{7UIlJQni&H);+ami$7R0CX?0)qJh2b=|SWZ|34(HDj@VFEH)h-GF
    z(?VWYy0JkCZYUf=;}8OS+uhBSEw7e|ugv!OKph#{l7l_*FBYXYi0LnA!^6>2W3mbg
    zg0q}$&DN5&kw?zbwG~Q;c0P3-ybcF!Qmrw;JZ;-(y}OPLm&)y8)$ZE=8vBu@gRmfz^;x7BM
    zdQrKoOPqCI_SYU}o(>{yu{$mN#1kv0E+|L5$P6dxT-i`LV*ih_M0@nbEq>%ruf5l8%Y_jRZ_-9
    z@wJhJ@v74Gju4z=<}((;u9$mtZkR^rFRTm?Ef_e$Cjyq+KJ4jJkSV^G(C1Uou)e~`
    z_-6<9)nGMk5>jBBObQQ=qm_{A?JQ4oDtg*J>kA)Uc#;tJ)cp4oSO9oK%B?3A8#(jL
    z6#qTx+33k3(fXRK&Ae~A<, 2011-2014.
    -#
    -msgid ""
    -msgstr ""
    -"Project-Id-Version: xz-utils\n"
    -"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
    -"POT-Creation-Date: 2015-02-26 16:55+0200\n"
    -"PO-Revision-Date: 2010-09-24 21;12+0200\n"
    -"Last-Translator: Adrien Nader \n"
    -"Language-Team: None\n"
    -"Language: fr\n"
    -"MIME-Version: 1.0\n"
    -"Content-Type: text/plain; charset=UTF-8\n"
    -"Content-Transfer-Encoding: 8bit\n"
    -"Plural-Forms: nplurals=2; plural=(n==1) ? 0 : 1;\n"
    -
    -#: src/xz/args.c:63
    -#, c-format
    -msgid "%s: Invalid argument to --block-list"
    -msgstr ""
    -
    -#: src/xz/args.c:73
    -#, c-format
    -msgid "%s: Too many arguments to --block-list"
    -msgstr ""
    -
    -#: src/xz/args.c:102
    -msgid "0 can only be used as the last element in --block-list"
    -msgstr ""
    -
    -#: src/xz/args.c:406
    -#, c-format
    -msgid "%s: Unknown file format type"
    -msgstr "%s : Format de fichier inconnu"
    -
    -#: src/xz/args.c:429 src/xz/args.c:437
    -#, c-format
    -msgid "%s: Unsupported integrity check type"
    -msgstr "%s : Type de vérification d'intégrité inconnu"
    -
    -#: src/xz/args.c:473
    -msgid "Only one file can be specified with `--files' or `--files0'."
    -msgstr "Un seul fichier peut être spécifié avec `--files' ou `--files0'."
    -
    -#: src/xz/args.c:541
    -#, c-format
    -msgid "The environment variable %s contains too many arguments"
    -msgstr "La variable d'environnement %s contient trop d'arguments"
    -
    -#: src/xz/coder.c:110
    -msgid "Maximum number of filters is four"
    -msgstr "Le nombre maximal de filtres est quatre"
    -
    -#: src/xz/coder.c:129
    -msgid "Memory usage limit is too low for the given filter setup."
    -msgstr "La limite d'utilisation mémoire est trop basse pour la configuration de filtres donnée."
    -
    -#: src/xz/coder.c:159
    -msgid "Using a preset in raw mode is discouraged."
    -msgstr "Utiliser un préréglage en mode `raw' est déconseillé."
    -
    -#: src/xz/coder.c:161
    -msgid "The exact options of the presets may vary between software versions."
    -msgstr "Le détail des préréglages peut varier entre différentes versions du logiciel."
    -
    -#: src/xz/coder.c:184
    -msgid "The .lzma format supports only the LZMA1 filter"
    -msgstr "Le format .lzma ne prend en charge que le filtre LZMA1"
    -
    -#: src/xz/coder.c:192
    -msgid "LZMA1 cannot be used with the .xz format"
    -msgstr "Le filtre LZMA1 ne peut être utilisé avec le format .xz"
    -
    -#: src/xz/coder.c:209
    -msgid "The filter chain is incompatible with --flush-timeout"
    -msgstr ""
    -
    -#: src/xz/coder.c:215
    -msgid "Switching to single-threaded mode due to --flush-timeout"
    -msgstr ""
    -
    -#: src/xz/coder.c:234
    -#, c-format
    -msgid "Using up to % threads."
    -msgstr "Jusqu'à % threads seront utilisés."
    -
    -#: src/xz/coder.c:247
    -msgid "Unsupported filter chain or filter options"
    -msgstr "Enchaînement ou options de filtres non pris en charge"
    -
    -#: src/xz/coder.c:255
    -#, c-format
    -msgid "Decompression will need %s MiB of memory."
    -msgstr "La décompression nécessitera %s MiB de mémoire."
    -
    -#: src/xz/coder.c:290
    -#, c-format
    -msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
    -msgstr "Nombre de threads réduit de %s à %s pour ne pas dépasser la limite d'utilisation mémoire de %s MiB"
    -
    -#: src/xz/coder.c:344
    -#, c-format
    -msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
    -msgstr "Taille du dictionnaire LZMA%c réduite de %s MiB à %s MiB pour ne pas dépasser la limite d'utilisation mémoire de %s MiB"
    -
    -#: src/xz/file_io.c:89 src/xz/file_io.c:93 src/xz/file_io.c:101
    -#, c-format
    -msgid "Error creating a pipe: %s"
    -msgstr "Impossible de créer un tube anonyme (pipe) : %s"
    -
    -#: src/xz/file_io.c:179
    -#, c-format
    -msgid "%s: poll() failed: %s"
    -msgstr "%s : L'appel à la fonction poll() a échoué : %s"
    -
    -#. TRANSLATORS: When compression or decompression finishes,
    -#. and xz is going to remove the source file, xz first checks
    -#. if the source file still exists, and if it does, does its
    -#. device and inode numbers match what xz saw when it opened
    -#. the source file. If these checks fail, this message is
    -#. shown, %s being the filename, and the file is not deleted.
    -#. The check for device and inode numbers is there, because
    -#. it is possible that the user has put a new file in place
    -#. of the original file, and in that case it obviously
    -#. shouldn't be removed.
    -#: src/xz/file_io.c:249
    -#, c-format
    -msgid "%s: File seems to have been moved, not removing"
    -msgstr "%s : Le fichier a apparemment été déplacé, suppression annulée"
    -
    -#: src/xz/file_io.c:256 src/xz/file_io.c:769
    -#, c-format
    -msgid "%s: Cannot remove: %s"
    -msgstr "%s : Impossible de supprimer : %s"
    -
    -#: src/xz/file_io.c:281
    -#, c-format
    -msgid "%s: Cannot set the file owner: %s"
    -msgstr "%s : Impossible de modifier le propriétaire du fichier : %s"
    -
    -#: src/xz/file_io.c:287
    -#, c-format
    -msgid "%s: Cannot set the file group: %s"
    -msgstr "%s : Impossible de modifier le groupe propriétaire du fichier : %s"
    -
    -#: src/xz/file_io.c:306
    -#, c-format
    -msgid "%s: Cannot set the file permissions: %s"
    -msgstr "%s : Impossible de modifier les permissions du fichier : %s"
    -
    -# Note from translator on "file status flags".
    -# The following entry is kept un-translated on purpose. It is difficult to
    -# translate and should only happen in exceptional circumstances which means
    -# that translating would:
    -# - lose some of the meaning
    -# - make it more difficult to look up in search engines; it might happen one in
    -# a million times, if we dilute the error message in 20 languages, it will be
    -# almost impossible to find an explanation and support for the error.
    -#: src/xz/file_io.c:416
    -#, c-format
    -msgid "Error getting the file status flags from standard input: %s"
    -msgstr ""
    -
    -#: src/xz/file_io.c:470 src/xz/file_io.c:532
    -#, c-format
    -msgid "%s: Is a symbolic link, skipping"
    -msgstr "%s est un lien symbolique : ignoré"
    -
    -#: src/xz/file_io.c:561
    -#, c-format
    -msgid "%s: Is a directory, skipping"
    -msgstr "%s est un répertoire : ignoré"
    -
    -#: src/xz/file_io.c:567
    -#, c-format
    -msgid "%s: Not a regular file, skipping"
    -msgstr "%s n'est pas un fichier régulier : ignoré"
    -
    -#: src/xz/file_io.c:584
    -#, c-format
    -msgid "%s: File has setuid or setgid bit set, skipping"
    -msgstr "%s : Le fichier possède les bits `setuid' ou `setgid' : ignoré"
    -
    -#: src/xz/file_io.c:591
    -#, c-format
    -msgid "%s: File has sticky bit set, skipping"
    -msgstr "%s : Le fichier possède le bit `sticky' : ignoré"
    -
    -#: src/xz/file_io.c:598
    -#, c-format
    -msgid "%s: Input file has more than one hard link, skipping"
    -msgstr "%s : Le fichier d'entrée a plus d'un lien matériel : ignoré"
    -
    -# See note from translator above titled "file status flags".
    -#: src/xz/file_io.c:678
    -#, c-format
    -msgid "Error restoring the status flags to standard input: %s"
    -msgstr ""
    -
    -# See note from translator above titled "file status flags".
    -#: src/xz/file_io.c:727
    -#, c-format
    -msgid "Error getting the file status flags from standard output: %s"
    -msgstr ""
    -
    -#: src/xz/file_io.c:905
    -#, c-format
    -msgid "Error restoring the O_APPEND flag to standard output: %s"
    -msgstr "Impossible de rétablir le drapeau O_APPEND sur la sortie standard : %s"
    -
    -#: src/xz/file_io.c:917
    -#, c-format
    -msgid "%s: Closing the file failed: %s"
    -msgstr "%s : Impossible de fermer le fichier : %s"
    -
    -#: src/xz/file_io.c:953 src/xz/file_io.c:1179
    -#, c-format
    -msgid "%s: Seeking failed when trying to create a sparse file: %s"
    -msgstr "%s : Impossible de se déplacer dans le fichier pour créer un 'sparse file' : %s"
    -
    -#: src/xz/file_io.c:1048
    -#, c-format
    -msgid "%s: Read error: %s"
    -msgstr "%s : Erreur d'écriture : %s"
    -
    -#: src/xz/file_io.c:1068
    -#, c-format
    -msgid "%s: Error seeking the file: %s"
    -msgstr "%s : Impossible de se déplacer dans le fichier : %s"
    -
    -#: src/xz/file_io.c:1078
    -#, c-format
    -msgid "%s: Unexpected end of file"
    -msgstr "%s : Fin de fichier inattendue"
    -
    -#: src/xz/file_io.c:1137
    -#, c-format
    -msgid "%s: Write error: %s"
    -msgstr "%s : Erreur d'écriture : %s"
    -
    -#: src/xz/hardware.c:107
    -msgid "Disabled"
    -msgstr "Désactivé"
    -
    -#. TRANSLATORS: Test with "xz --info-memory" to see if
    -#. the alignment looks nice.
    -#: src/xz/hardware.c:126
    -msgid "Total amount of physical memory (RAM): "
    -msgstr "Quantité totale de mémoire physique (RAM) :  "
    -
    -#: src/xz/hardware.c:128
    -msgid "Memory usage limit for compression:    "
    -msgstr "Limite d'utilisation pour la compression :   "
    -
    -#: src/xz/hardware.c:130
    -msgid "Memory usage limit for decompression:  "
    -msgstr "Limite d'utilisation pour la décompression : "
    -
    -#. TRANSLATORS: Indicates that there is no integrity check.
    -#. This string is used in tables, so the width must not
    -#. exceed ten columns with a fixed-width font.
    -#: src/xz/list.c:65
    -msgid "None"
    -msgstr "Aucune"
    -
    -#. TRANSLATORS: Indicates that integrity check name is not known,
    -#. but the Check ID is known (here 2). This and other "Unknown-N"
    -#. strings are used in tables, so the width must not exceed ten
    -#. columns with a fixed-width font. It's OK to omit the dash if
    -#. you need space for one extra letter, but don't use spaces.
    -#: src/xz/list.c:72
    -msgid "Unknown-2"
    -msgstr "Inconnue-2"
    -
    -#: src/xz/list.c:73
    -msgid "Unknown-3"
    -msgstr "Inconnue-3"
    -
    -#: src/xz/list.c:75
    -msgid "Unknown-5"
    -msgstr "Inconnue-5"
    -
    -#: src/xz/list.c:76
    -msgid "Unknown-6"
    -msgstr "Inconnue-6"
    -
    -#: src/xz/list.c:77
    -msgid "Unknown-7"
    -msgstr "Inconnue-7"
    -
    -#: src/xz/list.c:78
    -msgid "Unknown-8"
    -msgstr "Inconnue-8"
    -
    -#: src/xz/list.c:79
    -msgid "Unknown-9"
    -msgstr "Inconnue-9"
    -
    -#: src/xz/list.c:81
    -msgid "Unknown-11"
    -msgstr "Inconnue-11"
    -
    -#: src/xz/list.c:82
    -msgid "Unknown-12"
    -msgstr "Inconnue-12"
    -
    -#: src/xz/list.c:83
    -msgid "Unknown-13"
    -msgstr "Inconnue-13"
    -
    -#: src/xz/list.c:84
    -msgid "Unknown-14"
    -msgstr "Inconnue-14"
    -
    -#: src/xz/list.c:85
    -msgid "Unknown-15"
    -msgstr "Inconnue-15"
    -
    -#: src/xz/list.c:153
    -#, c-format
    -msgid "%s: File is empty"
    -msgstr "%s : Le fichier est vide"
    -
    -#: src/xz/list.c:158
    -#, c-format
    -msgid "%s: Too small to be a valid .xz file"
    -msgstr "%s : Trop petit pour être un fichier xz valide."
    -
    -#. TRANSLATORS: These are column headings. From Strms (Streams)
    -#. to Ratio, the columns are right aligned. Check and Filename
    -#. are left aligned. If you need longer words, it's OK to
    -#. use two lines here. Test with "xz -l foo.xz".
    -#: src/xz/list.c:671
    -msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
    -msgstr "Flux    Blocs    Compressé  Décompressé  Ratio  Vérif.  Nom de fichier"
    -
    -#: src/xz/list.c:711
    -#, c-format
    -msgid "  Streams:            %s\n"
    -msgstr "  Flux :                            %s\n"
    -
    -#: src/xz/list.c:713
    -#, c-format
    -msgid "  Blocks:             %s\n"
    -msgstr "  Blocs :                           %s\n"
    -
    -#: src/xz/list.c:715
    -#, c-format
    -msgid "  Compressed size:    %s\n"
    -msgstr "  Taille données avec compression : %s\n"
    -
    -#: src/xz/list.c:718
    -#, c-format
    -msgid "  Uncompressed size:  %s\n"
    -msgstr "  Taille données sans compression : %s\n"
    -
    -#: src/xz/list.c:721
    -#, c-format
    -msgid "  Ratio:              %s\n"
    -msgstr "  Ratio :                           %s\n"
    -
    -#: src/xz/list.c:723
    -#, c-format
    -msgid "  Check:              %s\n"
    -msgstr "  Vérification :                    %s\n"
    -
    -#: src/xz/list.c:724
    -#, c-format
    -msgid "  Stream padding:     %s\n"
    -msgstr "  Octets de rembourrage du flux :   %s\n"
    -
    -#. TRANSLATORS: The second line is column headings. All except
    -#. Check are right aligned; Check is left aligned. Test with
    -#. "xz -lv foo.xz".
    -#: src/xz/list.c:752
    -msgid ""
    -"  Streams:\n"
    -"    Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding"
    -msgstr ""
    -"  Flux :\n"
    -"      Flux     Blocs    PositionComp  PositionDécomp      TailleComp    TailleDécomp  Ratio  Vérif.    Bourrage"
    -
    -#. TRANSLATORS: The second line is column headings. All
    -#. except Check are right aligned; Check is left aligned.
    -#: src/xz/list.c:807
    -#, c-format
    -msgid ""
    -"  Blocks:\n"
    -"    Stream     Block      CompOffset    UncompOffset       TotalSize      UncompSize  Ratio  Check"
    -msgstr ""
    -"  Blocs :\n"
    -"      Flux      Bloc    PositionComp  PositionDécomp       TailleTot    TailleDécomp  Ratio  Vérif."
    -
    -#. TRANSLATORS: These are additional column headings
    -#. for the most verbose listing mode. CheckVal
    -#. (Check value), Flags, and Filters are left aligned.
    -#. Header (Block Header Size), CompSize, and MemUsage
    -#. are right aligned. %*s is replaced with 0-120
    -#. spaces to make the CheckVal column wide enough.
    -#. Test with "xz -lvv foo.xz".
    -#: src/xz/list.c:819
    -#, c-format
    -msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
    -msgstr "     ValVérif %*sEn-tête  Drapeaux   TailleComp     UtilMém  Filtres"
    -
    -#: src/xz/list.c:897 src/xz/list.c:1072
    -#, c-format
    -msgid "  Memory needed:      %s MiB\n"
    -msgstr "  Mémoire nécessaire :              %s MiB\n"
    -
    -#: src/xz/list.c:899 src/xz/list.c:1074
    -#, c-format
    -msgid "  Sizes in headers:   %s\n"
    -msgstr "  Tailles stockées dans l'en-tête : %s\n"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "Yes"
    -msgstr "Oui"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "No"
    -msgstr "Non"
    -
    -#: src/xz/list.c:901 src/xz/list.c:1076
    -#, c-format
    -msgid "  Minimum XZ Utils version: %s\n"
    -msgstr "  Version minimale de XZ Utils : %s\n"
    -
    -#. TRANSLATORS: %s is an integer. Only the plural form of this
    -#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
    -#: src/xz/list.c:1051
    -#, c-format
    -msgid "%s file\n"
    -msgid_plural "%s files\n"
    -msgstr[0] "%s fichier\n"
    -msgstr[1] "%s fichiers\n"
    -
    -#: src/xz/list.c:1064
    -msgid "Totals:"
    -msgstr "Totaux :"
    -
    -#: src/xz/list.c:1065
    -#, c-format
    -msgid "  Number of files:    %s\n"
    -msgstr "  Nombre de fichiers : %s\n"
    -
    -#: src/xz/list.c:1140
    -msgid "--list works only on .xz files (--format=xz or --format=auto)"
    -msgstr "--list ne marche que sur les fichiers .xz (--format=xz ou --format=auto)"
    -
    -#: src/xz/list.c:1146
    -msgid "--list does not support reading from standard input"
    -msgstr "--list est incompatible avec la lecture sur l'entrée standard"
    -
    -#: src/xz/main.c:89
    -#, c-format
    -msgid "%s: Error reading filenames: %s"
    -msgstr "%s : Erreur lors de la lecture des noms de fichiers : %s"
    -
    -#: src/xz/main.c:96
    -#, c-format
    -msgid "%s: Unexpected end of input when reading filenames"
    -msgstr "%s : Fin des données inattendue lors de la lecture des noms de fichiers"
    -
    -#: src/xz/main.c:120
    -#, c-format
    -msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?"
    -msgstr "%s : Caractère NULL détecté lors de la lecture des noms de fichiers ; peut-être pensiez-vous à `--files0' plutot qu'a `--files' ?"
    -
    -#: src/xz/main.c:174
    -msgid "Compression and decompression with --robot are not supported yet."
    -msgstr "La compression et la décompression ne marchent pas encore avec --robot."
    -
    -#: src/xz/main.c:231
    -msgid "Cannot read data from standard input when reading filenames from standard input"
    -msgstr "Impossible de lire à la fois les données et les noms de fichiers depuis l'entrée standard"
    -
    -#. TRANSLATORS: This is the program name in the beginning
    -#. of the line in messages. Usually it becomes "xz: ".
    -#. This is a translatable string because French needs
    -#. a space before a colon.
    -#: src/xz/message.c:713
    -#, c-format
    -msgid "%s: "
    -msgstr "%s : "
    -
    -#: src/xz/message.c:776 src/xz/message.c:826
    -msgid "Internal error (bug)"
    -msgstr "Erreur interne (bug)"
    -
    -#: src/xz/message.c:783
    -msgid "Cannot establish signal handlers"
    -msgstr "Impossible d'installer le gestionnaire de signaux"
    -
    -#: src/xz/message.c:792
    -msgid "No integrity check; not verifying file integrity"
    -msgstr "Pas de données de vérification d'intégrité ; vérification non effectuée"
    -
    -#: src/xz/message.c:795
    -msgid "Unsupported type of integrity check; not verifying file integrity"
    -msgstr "Méthode de vérification d'intégrité non prise en charge ; vérification non effectuée"
    -
    -#: src/xz/message.c:802
    -msgid "Memory usage limit reached"
    -msgstr "Limite d'utilisation mémoire atteinte"
    -
    -#: src/xz/message.c:805
    -msgid "File format not recognized"
    -msgstr "Format de fichier inconnu"
    -
    -#: src/xz/message.c:808
    -msgid "Unsupported options"
    -msgstr "Options non prises en charge"
    -
    -#: src/xz/message.c:811
    -msgid "Compressed data is corrupt"
    -msgstr "Les données compressées sont corrompues"
    -
    -#: src/xz/message.c:814
    -msgid "Unexpected end of input"
    -msgstr "Fin des données inattendue "
    -
    -#: src/xz/message.c:847
    -#, c-format
    -msgid "%s MiB of memory is required. The limiter is disabled."
    -msgstr "%s MiB de mémoire sont nécessaires. La limite est désactivée."
    -
    -#: src/xz/message.c:875
    -#, c-format
    -msgid "%s MiB of memory is required. The limit is %s."
    -msgstr "%s MiB de mémoire sont nécessaires, la limite étant %s."
    -
    -#: src/xz/message.c:1042
    -#, c-format
    -msgid "%s: Filter chain: %s\n"
    -msgstr "%s : Enchaînement de filtres : %s\n"
    -
    -#: src/xz/message.c:1052
    -#, c-format
    -msgid "Try `%s --help' for more information."
    -msgstr "Éxécutez `%s --help' pour obtenir davantage d'informations."
    -
    -#: src/xz/message.c:1078
    -#, c-format
    -msgid ""
    -"Usage: %s [OPTION]... [FILE]...\n"
    -"Compress or decompress FILEs in the .xz format.\n"
    -"\n"
    -msgstr ""
    -"Utilisation : %s [OPTION]... [FICHIER]...\n"
    -"Compresse ou decompresse FICHIER(s) au format .xz.\n"
    -"\n"
    -
    -#: src/xz/message.c:1085
    -msgid "Mandatory arguments to long options are mandatory for short options too.\n"
    -msgstr ""
    -"Les arguments obligatoires pour les options longues le sont aussi pour les\n"
    -"options courtes.\n"
    -
    -#: src/xz/message.c:1089
    -msgid " Operation mode:\n"
    -msgstr " Mode d'opération :\n"
    -
    -#: src/xz/message.c:1092
    -msgid ""
    -"  -z, --compress      force compression\n"
    -"  -d, --decompress    force decompression\n"
    -"  -t, --test          test compressed file integrity\n"
    -"  -l, --list          list information about .xz files"
    -msgstr ""
    -"  -z, --compress      forcer le mode compression\n"
    -"  -d, --decompress    forcer le mode décompression\n"
    -"  -t, --test          tester l'intégrité du fichier compressé\n"
    -"  -l, --list          lister les informations sur les fichiers .xz"
    -
    -#: src/xz/message.c:1098
    -msgid ""
    -"\n"
    -" Operation modifiers:\n"
    -msgstr ""
    -"\n"
    -" Modificateurs :\n"
    -
    -#: src/xz/message.c:1101
    -msgid ""
    -"  -k, --keep          keep (don't delete) input files\n"
    -"  -f, --force         force overwrite of output file and (de)compress links\n"
    -"  -c, --stdout        write to standard output and don't delete input files"
    -msgstr ""
    -"  -k, --keep          ne pas supprimer les fichiers d'entrée\n"
    -"  -f, --force         forcer l'écrasement éventuel du fichier de sortie et\n"
    -"                      (dé)compresser les liens symboliques\n"
    -"  -c, --stdout        écrire sur la sortie standard et ne pas supprimer les\n"
    -"                      fichiers d'entrée"
    -
    -#: src/xz/message.c:1107
    -msgid ""
    -"      --single-stream decompress only the first stream, and silently\n"
    -"                      ignore possible remaining input data"
    -msgstr ""
    -"      --single-stream décompresser uniquement le premier flux et ignorer\n"
    -"                      silencieusement les données éventuellement restantes"
    -
    -#: src/xz/message.c:1110
    -msgid ""
    -"      --no-sparse     do not create sparse files when decompressing\n"
    -"  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
    -"      --files[=FILE]  read filenames to process from FILE; if FILE is\n"
    -"                      omitted, filenames are read from the standard input;\n"
    -"                      filenames must be terminated with the newline character\n"
    -"      --files0[=FILE] like --files but use the null character as terminator"
    -msgstr ""
    -"      --no-sparse     ne pas créer de 'sparse file' lors de la décompression\n"
    -"  -S, --suffix=.SUF   utiliser le suffixe `.SUF' pour les fichiers compressés\n"
    -"      --files[=FILE]  lire les fichiers sur lesquels opérer depuis FILE ; si\n"
    -"                      FILE est omis, ceux-ci sont lus depuis l'entrée standard\n"
    -"                      et doivent être suivis d'un caractère retour à la ligne\n"
    -"      --files0[=FILE] comme --files mais avec un caractère null comme séparateur"
    -
    -#: src/xz/message.c:1119
    -msgid ""
    -"\n"
    -" Basic file format and compression options:\n"
    -msgstr ""
    -"\n"
    -" Options basiques de format de fichier et de compression :\n"
    -
    -#: src/xz/message.c:1121
    -msgid ""
    -"  -F, --format=FMT    file format to encode or decode; possible values are\n"
    -"                      `auto' (default), `xz', `lzma', and `raw'\n"
    -"  -C, --check=CHECK   integrity check type: `none' (use with caution),\n"
    -"                      `crc32', `crc64' (default), or `sha256'"
    -msgstr ""
    -"  -F, --format=FMT    format du fichier à encoder ou décoder ; sont acceptés :\n"
    -"                      `auto' (par défaut), `xz', `lzma' et `raw'\n"
    -"  -C, --check=CHECK   type de vérification d'intégrité : `none' (à utiliser avec\n"
    -"                      précaution), `crc32', `crc64' (par défaut) ou `sha256'"
    -
    -#: src/xz/message.c:1126
    -msgid "      --ignore-check  don't verify the integrity check when decompressing"
    -msgstr ""
    -"      --ignore-check  ne pas vérifier l'intégrité des données lors de\n"
    -"                      la décompression"
    -
    -#: src/xz/message.c:1130
    -msgid ""
    -"  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
    -"                      decompressor memory usage into account before using 7-9!"
    -msgstr ""
    -"  -0 ... -9           préréglage de compression : 6 par défaut ; pensez à\n"
    -"                      l'utilisation mémoire du compresseur *et* du décompresseur\n"
    -"                      avant d'utiliser 7, 8 ou 9 !"
    -
    -#: src/xz/message.c:1134
    -msgid ""
    -"  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
    -"                      does not affect decompressor memory requirements"
    -msgstr ""
    -"  -e, --extreme       essayer d'améliorer la compression en utilisant davantage\n"
    -"                      de temps processeur ;\n"
    -"                      n'affecte pas les besoins mémoire du décompresseur"
    -
    -#: src/xz/message.c:1138
    -msgid ""
    -"  -T, --threads=NUM   use at most NUM threads; the default is 1; set to 0\n"
    -"                      to use as many threads as there are processor cores"
    -msgstr ""
    -"  -T, --threads=NB    créer au plus NB fils de compression (1 par défault) ; la\n"
    -"                      valeur 0 est spéciale et équivaut au nombre de processeurs\n"
    -"                      de la machine"
    -
    -#: src/xz/message.c:1143
    -msgid ""
    -"      --block-size=SIZE\n"
    -"                      start a new .xz block after every SIZE bytes of input;\n"
    -"                      use this to set the block size for threaded compression"
    -msgstr ""
    -"      --block-size=TAILLE\n"
    -"                      débuter un bloc XZ après chaque TAILLE octets de données\n"
    -"                      d'entrée ; ce réglage sert pour la compression paralléle"
    -
    -#: src/xz/message.c:1147
    -msgid ""
    -"      --block-list=SIZES\n"
    -"                      start a new .xz block after the given comma-separated\n"
    -"                      intervals of uncompressed data"
    -msgstr ""
    -"      --block-list=TAILLES\n"
    -"                      débuter des blocs XZ après les TAILLES octets de données\n"
    -"                      spécifiées avec des virgules pour séparateur"
    -
    -#: src/xz/message.c:1151
    -msgid ""
    -"      --flush-timeout=TIMEOUT\n"
    -"                      when compressing, if more than TIMEOUT milliseconds has\n"
    -"                      passed since the previous flush and reading more input\n"
    -"                      would block, all pending data is flushed out"
    -msgstr ""
    -
    -#: src/xz/message.c:1157
    -#, no-c-format
    -msgid ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      set memory usage limit for compression, decompression,\n"
    -"                      or both; LIMIT is in bytes, % of RAM, or 0 for defaults"
    -msgstr ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      règle la limite d'utilisation mémoire pour la compression,\n"
    -"                      décompression ou les deux ; LIMIT est en octets,\n"
    -"                      pourcentage de RAM, ou 0 pour la valeur par défaut"
    -
    -#: src/xz/message.c:1164
    -msgid ""
    -"      --no-adjust     if compression settings exceed the memory usage limit,\n"
    -"                      give an error instead of adjusting the settings downwards"
    -msgstr ""
    -"      --no-adjust     si les réglages de compression dépassent la limite\n"
    -"                      d'utilisation mémoire, renvoyer une erreur plutôt que de\n"
    -"                      diminuer les réglages"
    -
    -#: src/xz/message.c:1170
    -msgid ""
    -"\n"
    -" Custom filter chain for compression (alternative for using presets):"
    -msgstr ""
    -"\n"
    -" Chaîne de filtres de compression personnalisée (en lieu des préréglages) :"
    -
    -#: src/xz/message.c:1179
    -msgid ""
    -"\n"
    -"  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
    -"  --lzma2[=OPTS]      more of the following options (valid values; default):\n"
    -"                        preset=PRE reset options to a preset (0-9[e])\n"
    -"                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=NUM     number of literal context bits (0-4; 3)\n"
    -"                        lp=NUM     number of literal position bits (0-4; 0)\n"
    -"                        pb=NUM     number of position bits (0-4; 2)\n"
    -"                        mode=MODE  compression mode (fast, normal; normal)\n"
    -"                        nice=NUM   nice length of a match (2-273; 64)\n"
    -"                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  maximum search depth; 0=automatic (default)"
    -msgstr ""
    -"\n"
    -"  --lzma1[=OPTS]      LZMA1/2 ; OPTS est une liste d'options parmi les suivantes\n"
    -"  --lzma2[=OPTS]      (entre parenthèses : valeurs valides et par défaut) :\n"
    -"                        preset=PRE remettre les options à un préréglage (0-9[e])\n"
    -"                        dict=NUM   taille dictionnaire (4KiB - 1536MiB ; 8MiB)\n"
    -"                        lc=NUM     nombre de 'literal context bits' (0-4 ; 3)\n"
    -"                        lp=NUM     nombre de 'literal position bits' (0-4 ; 0)\n"
    -"                        pb=NUM     nombre de 'position bits' (0-4 ; 2)\n"
    -"                        mode=MODE  mode de compression (fast, normal ; normal)\n"
    -"                        nice=NUM   nice length of a match (2-273; 64)\n"
    -"                        mf=NAME    'match finder' (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  profondeur de recherche maximale ;\n"
    -"                                      0=automatique (par défaut)"
    -
    -#: src/xz/message.c:1194
    -msgid ""
    -"\n"
    -"  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
    -"  --powerpc[=OPTS]    PowerPC BCJ filter (big endian only)\n"
    -"  --ia64[=OPTS]       IA-64 (Itanium) BCJ filter\n"
    -"  --arm[=OPTS]        ARM BCJ filter (little endian only)\n"
    -"  --armthumb[=OPTS]   ARM-Thumb BCJ filter (little endian only)\n"
    -"  --sparc[=OPTS]      SPARC BCJ filter\n"
    -"                      Valid OPTS for all BCJ filters:\n"
    -"                        start=NUM  start offset for conversions (default=0)"
    -msgstr ""
    -"\n"
    -"  --x86[=OPTS]        filtre BCJ x86 (32-bit et 64-bit)\n"
    -"  --powerpc[=OPTS]    filtre BCJ PowerPC ('big endian' uniquement)\n"
    -"  --ia64[=OPTS]       filtre BCJ IA-64 (Itanium)\n"
    -"  --arm[=OPTS]        filtre BCJ ARM ('little endian' uniquement)\n"
    -"  --armthumb[=OPTS]   filtre BCJ ARM-Thumb ('little endian' uniquement)\n"
    -"  --sparc[=OPTS]      filtre BCJ SPARC\n"
    -"                      OPTS valides pour tous les filtres BCJ :\n"
    -"                        start=NUM  position de début de la conversion (défaut=0)"
    -
    -#: src/xz/message.c:1206
    -msgid ""
    -"\n"
    -"  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
    -"                        dist=NUM   distance between bytes being subtracted\n"
    -"                                   from each other (1-256; 1)"
    -msgstr ""
    -"\n"
    -"  --delta[=OPTS]      Filtre delta ; OPTS valides (vals. valides ; par défaut) :\n"
    -"                        dist=NUM   distance entre les octets soustraits les\n"
    -"                                   uns aux autres (1-256 ; 1)"
    -
    -#: src/xz/message.c:1214
    -msgid ""
    -"\n"
    -" Other options:\n"
    -msgstr ""
    -"\n"
    -" Autres options :\n"
    -
    -#: src/xz/message.c:1217
    -msgid ""
    -"  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
    -"  -v, --verbose       be verbose; specify twice for even more verbose"
    -msgstr ""
    -"  -q, --quiet         masquer les avertissements ; spécifier deux fois pour\n"
    -"                      aussi masquer les erreurs\n"
    -"  -v, --verbose       être bavard ; spécifier deux fois pour l'être davantage"
    -
    -#: src/xz/message.c:1222
    -msgid "  -Q, --no-warn       make warnings not affect the exit status"
    -msgstr "  -Q, --no-warn       les avertissements ne modifient pas le code de sortie"
    -
    -#: src/xz/message.c:1224
    -msgid "      --robot         use machine-parsable messages (useful for scripts)"
    -msgstr ""
    -"      --robot         utiliser des messages lisibles par un programme\n"
    -"                      (utile pour les scripts)"
    -
    -#: src/xz/message.c:1227
    -msgid ""
    -"      --info-memory   display the total amount of RAM and the currently active\n"
    -"                      memory usage limits, and exit"
    -msgstr ""
    -"      --info-memory   afficher la quantité totale de RAM ainsi que la limite\n"
    -"                      actuelle d'utilisation mémoire puis quitter"
    -
    -#: src/xz/message.c:1230
    -msgid ""
    -"  -h, --help          display the short help (lists only the basic options)\n"
    -"  -H, --long-help     display this long help and exit"
    -msgstr ""
    -"  -h, --help          afficher l'aide courte (ne liste que les options de base)\n"
    -"  -H, --long-help     afficher l'aide longue (ceci) puis quitter"
    -
    -#: src/xz/message.c:1234
    -msgid ""
    -"  -h, --help          display this short help and exit\n"
    -"  -H, --long-help     display the long help (lists also the advanced options)"
    -msgstr ""
    -"  -h, --help          afficher l'aide courte (ceci) puis quitter\n"
    -"  -H, --long-help     afficher l'aide longue (liste aussi les options avancées)"
    -
    -#: src/xz/message.c:1239
    -msgid "  -V, --version       display the version number and exit"
    -msgstr "  -V, --version       afficher le numéro de version puis quitter"
    -
    -#: src/xz/message.c:1241
    -msgid ""
    -"\n"
    -"With no FILE, or when FILE is -, read standard input.\n"
    -msgstr ""
    -"\n"
    -"Sans FILE ou quand FILE est -, lire l'entrée standard.\n"
    -
    -#. TRANSLATORS: This message indicates the bug reporting address
    -#. for this package. Please add _another line_ saying
    -#. "Report translation bugs to <...>\n" with the email or WWW
    -#. address for translation bugs. Thanks.
    -#: src/xz/message.c:1247
    -#, c-format
    -msgid "Report bugs to <%s> (in English or Finnish).\n"
    -msgstr ""
    -"Signaler les bogues à <%s> (en anglais ou en finlandais).\n"
    -"Signaler les bogues de traduction à .\n"
    -
    -#: src/xz/message.c:1249
    -#, c-format
    -msgid "%s home page: <%s>\n"
    -msgstr "Page du projet %s : <%s>\n"
    -
    -#: src/xz/message.c:1253
    -msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
    -msgstr ""
    -
    -#: src/xz/options.c:86
    -#, c-format
    -msgid "%s: Options must be `name=value' pairs separated with commas"
    -msgstr "%s: Les options doivent être des paires `nom=valeur' séparées par des virgules"
    -
    -#: src/xz/options.c:93
    -#, c-format
    -msgid "%s: Invalid option name"
    -msgstr "%s : Nom d'option invalide"
    -
    -#: src/xz/options.c:113
    -#, c-format
    -msgid "%s: Invalid option value"
    -msgstr "%s : Valeur d'option invalide"
    -
    -#: src/xz/options.c:247
    -#, c-format
    -msgid "Unsupported LZMA1/LZMA2 preset: %s"
    -msgstr "Préréglage LZMA1/LZMA2 non reconnu : %s"
    -
    -#: src/xz/options.c:355
    -msgid "The sum of lc and lp must not exceed 4"
    -msgstr "La somme de lc et lp ne doit pas dépasser 4"
    -
    -#: src/xz/options.c:359
    -#, c-format
    -msgid "The selected match finder requires at least nice=%"
    -msgstr "Le `match finder' choisi nécessite au moins nice=%"
    -
    -#: src/xz/suffix.c:133 src/xz/suffix.c:258
    -#, c-format
    -msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
    -msgstr "%s : Avec --format=raw, --suffix=.SUF est nécessaire sauf lors de l'écriture vers stdout"
    -
    -#: src/xz/suffix.c:164
    -#, c-format
    -msgid "%s: Filename has an unknown suffix, skipping"
    -msgstr "%s : Le fichier a un suffixe inconnu, ignoré"
    -
    -#: src/xz/suffix.c:185
    -#, c-format
    -msgid "%s: File already has `%s' suffix, skipping"
    -msgstr "%s : Le fichier a déjà le suffixe '%s', ignoré"
    -
    -#: src/xz/suffix.c:393
    -#, c-format
    -msgid "%s: Invalid filename suffix"
    -msgstr "%s: Suffixe de nom de fichier invalide"
    -
    -#: src/xz/util.c:71
    -#, c-format
    -msgid "%s: Value is not a non-negative decimal integer"
    -msgstr "%s : La valeur n'est pas un entier décimal non négatif"
    -
    -#: src/xz/util.c:113
    -#, c-format
    -msgid "%s: Invalid multiplier suffix"
    -msgstr "%s : Suffixe multiplicateur invalide"
    -
    -#: src/xz/util.c:115
    -msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
    -msgstr "Les suffixes valides sont 'KiB' (2^10), 'MiB' (2^20) et 'GiB' (2^30)."
    -
    -#: src/xz/util.c:132
    -#, c-format
    -msgid "Value of the option `%s' must be in the range [%, %]"
    -msgstr "La valeur de l'option '%s' doit être inclue entre % et %"
    -
    -#: src/xz/util.c:257
    -msgid "Empty filename, skipping"
    -msgstr "Nom de fichier vide, ignoré"
    -
    -#: src/xz/util.c:271
    -msgid "Compressed data cannot be read from a terminal"
    -msgstr "Les données compressées ne peuvent pas être lues depuis un terminal"
    -
    -#: src/xz/util.c:284
    -msgid "Compressed data cannot be written to a terminal"
    -msgstr "Les données compressées ne peuvent pas être écrites dans un terminal"
    -
    -#: src/common/tuklib_exit.c:39
    -msgid "Writing to standard output failed"
    -msgstr "Impossible d'écrire vers la sortie standard"
    -
    -#: src/common/tuklib_exit.c:42
    -msgid "Unknown error"
    -msgstr "Erreur inconnue"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard input: %s"
    -#~ msgstr "Impossible d'établir le drapeau O_NONBLOCK sur la sortie standard : %s"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard output: %s"
    -#~ msgstr "Impossible d'activer le drapeau O_NONBLOCK sur la sortie standard : %s"
    diff --git a/external/public-domain/xz/dist/po/it.gmo b/external/public-domain/xz/dist/po/it.gmo
    deleted file mode 100644
    index af52cdea07d3948de11e6d4bec98b2e0ab84466e..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
    
    literal 26091
    zcmchfdyr&Tec!JhAhW!Jc$kL;hk<2g#Pn!pcD0gbG)Sx2S!rNrciEX;Ktiy0y6?jcvtPgkVzEAN~W|6qR5q725@-EbM{=0#vFT2V8ONl&c&kMLC62
    zs
    zyozezUEqD-KLIa+Uj|?H$|(Au;5WcE@awONqQ}7lRQ@se^Wf*f55GE!zC=H-e@zrU
    z#PfGv8$}-iU-h~uS_MA?s@$J|FQwd-pNgWl@%+i#qUh7$H^FuZ$9{%^B
    z=;Htn>i4A}T}CIs`@yTA#__wL_~UOtszit8J%850V?6%~cqjNDLG8z@SbU9R8N3Bd
    zK+#PL)V_Zjd@=Z&-~sTr1AZgmcLV+);9r0*pxj>v{2u{tX0!DDO9H++;6%U~5SELM
    zfNWv(9`NPhM?vk&XTf)ZKLGW92BN(md>5$o{497A_&eYq-4I1z1HZ-dlWfWf7ViCb
    zMbTgI{TJChh7|o0MDsrI4?ywHn_0A%fh*u5cozH>@Coow!I}G5U+TZ;e%j-C^=K4*
    z3j8H-neX5505X*4M_1q}o^NNdkMn#Je;x^}#55E9JfqQZ@R!hob2B
    z!TTW+(eq7jN49}S!H<9k-VsIr5c~!3e}k`J5dRr``Fa%nEAa2Y7WmDRo_~*=@^~g-
    z8Sqn=J`UvCqcFUd*JK9zXH|I^Uoslz-jOfa2-^+p9Vh&egRws
    z-+a!u{{isrJbx4vpL`e8y#70=dA{Xc&=7bG6yJXWRJ;Eig!H0611TEa_HI9pUce{7
    zBYgiwP;~O2K+(a}d;B=I!EK)Z97L2wYY!ufz&>~n_@|)Sf6XI)f6s!DT677V0lx;m
    z2>dVL>%qSb_>=GTdiMwj=|vv`MUUSCkAg3H)XUG4;465}Ktx#dQ4kV{ehYjHc=P+b
    zJbG)u_kb*M^l?z@`6u9w;4Sa>{Tu)#Z#KdE!S{kY;6DY`@AJ<4aXkoXTu*@N_Xpr%
    z@CC8w!?%HpJpUXx3H~9daz6sq{%u?S`5^dOo;Sf;!3=x>_;|oi1^i6Frvm;4_!E@-
    zO2DrM{KJ6X4fw|a|198Nfp4bXkHI^^SJ#oX;7O3JiV{$C^mXtq@P!S(?kk}7_haBq
    z;FrN0z<(az&sSGoQ^*OOdtP*v~!(_^a{5X11@|1JV8GxI~wbt9_&^APLj8Px!CQF4XPC@caSr4O};dXGEHP
    z@_@I2uj7J5ZSOnb`v(H<23!EOH~RcNF3HCwJ@66DzsBy6(cnMk>T;du5}mx9>me@4
    z#6GX*@BRMP{@%;q9+zn892ers>=PjRX|6t3n+tZdkM`_?T-w_e`^Ntf@4uAmOcRfLG2Fi_plIh8!@c0MT(9M-alM*rnd@h`9M@;K
    zp2u}77i?XABscVV1=mNpeva!OaOndZn*Lt|Q8o6-_$!`ia*1YN$@M}mebzmgjCqjz
    zqg?gy-C6LL!~G%fv2g#AfPy1jcXNGG4}3nxb%m>;2R`reU@}Ly7r3Ulp3k+#^>MCG
    za9!s5S+2KmeTwVTTtCnC3tWgG&-Kr^zQH@dJ_q>w
    zfB5{6??iL@+`y&pUcx4d5A>|P72e3DcPqTp8tJ2T(|0l7Y47wY+V~>hX`M&45gl-@
    zR%;~9Ui`@NsneSqk2?Dt(>HEAZT6DxlDil;(}vS)H|6j7+fVW(*GRVGezP~dNIRoH
    zjWq8qpFF$HTiwR(dg8W{-lZgIyR9p|BsrlN%oky13{Is7@^J*)eADYpLhu4qJyR7SUv#{i6ljbgV^{my3YkAU%yD{Cn
    zCc|{uw!4~iGb-2$slA1v_F7ptQ7O82+gY=jUD7PFPA|>c`Lkc9PB+Pu-ty@)tIqDq
    zmUEu}ZtCzm(g$44&EI+G$a?y~lDnI~
    z<6COh!=^dc?zgsBV&>XRA&0ohinV*m<(}J0drWn%c6iAh+NY_`K23G9Jk>a>ZOx5u
    ztFtwttx;_(jBlfrHIn7^Q^!`Fwq8q{YXJJ%O>M_{Z^pH=ZYyps1sva0JFO>SK)Q9!
    zq`lLFCb!wMR@{R;rxt1pcO6=CM-Go~rM10$^5{ClaiP+7+HQ!bck72{+;08wjN9rh
    z=ns!uJyx4P7!?=a~#8(=LQmV8yOTgo0b0Z@zN84*$o_Rw~*F0asr9d
    z6&GGix}sf}Fl^)UoCM$lan9Bvy(OBUWWQZiVh?g^@c^Y)`Z?54Y;b)yPTQgV0dq{n
    z(gbZt=AyOf`nklNmrMEdBF&uYARCO8;iPmsWoXv?DHG6@4&Rl+BJIo_UpuinBZ+)z
    z7hRwyhdi#$AOPcrld5RM-G)osoqlijKqU4MrEN8{`h}W=^zz2q!>b!(R@^UF?ApmC
    zH+%W2vuZBhW*R25cbG|guk0VwR*JamqVjTacE4RLB)Xyz_u@$78jMWR)?
    zu%TC+rWJG}{n`AN#x&N?6K2D*p(aEZ(nfx!CiF!nyxvJ?CrwPp|WeGO*SWiIvcs$jq@?Bb>ci{
    zP>>OFQ^SUqE~Z&OcQz&yFdDeX%sR1k7}MCLtlw<-iO(2wbtGk|sr?aES(|jnEX%p4
    zJBazDR^LtP7cfq;_GHho{^|A=8;>@9r?137`%q_Ir&*L2wOxi-{GDpO3
    zaycDLhEn#fR*Y}?#M=5=v6VHA&c7ebpe#{apMeyL66M#PMuz{2#;zUEUU4ylrYXh&
    zwatu~8N|7T`L^V2sM;nZkJ*GX?x0wW)iMDwXB`9)mzT@l&T4Vv14u6$Bg9zgQ{2#l
    z0&XmHXN@TWeF
    z42josbtt+=HUB~aI``7AvR>^SmaDd*Ey?@a+v(-y*^RTuX~Xk6we4GXUSCh5N6Tq5
    zOKUPLH{7ib9$A)X#jZE8s;}B{i++(9oo-gg`f+AWtJIQMI!NMin+5@5CC^w_zNHuu
    z;2W1!ZtF56yvGTz!B|?_#4Y4N(ru+^8D?@xT0(6hz?*3scG<-~$3Kuku1}cWTrt09
    zdLb#kbX)yixnAu)+P19iVx}It$-0p>MYV1QDf$QgYN=az7xY`xUd3CeQWi}-h_dDN
    zcE4#vnb*5%r2H%~Q?
    zZqhdHG9%3hVxyV6M(-T8LbPH0s`
    zWmH|K8^q%DIN@`?-mM>6P`}(9IXpBV=5;>bjd6A-wI1)(AdrK|p0*Z)PfJ^&XOn)C
    zI`Q^)QunrjbcRf;Uf=e5Q`NnJkOx0Tqhuvp88j-lJ-lU$;l&_=wdwOq-r&gG+?ds5
    zGpws$|w%s5hXc7{YRD3sNAW~`!a0)?54v2yyXlQA?-Vl^_@zp|vGNV%Il)=xErcF*Rs
    zt5NMH%}$sMP_+>9-K^Vl_8zw-$Dx*IWUIYpW_+-m%~yIzZ8fv@&Y;0TTWpG6`L?R-
    zvhN6}RT)B2O$5GgXP6>oUt!$X$C-^gZd_ED2YucFbw(rg}6TkJFDQ1Qw89g8KDya$7HlDe6bmlPaOH$@qfpq{VyjmNr3dneBAs+ynCJ
    zf+M`)b*F0D*Sc|T1;usBd%rxLH7{)N%vYPTwF}i&l&6c9lt_^zRSTrd!mUm6V=PKmK5|*wLH{|~K%GEd5tgv5qP4hZd*!JL=SJ=09
    z+K(Y3Mq>MEqx7%%>j&j`Q4zSovf7)WU_wG1!7r#R@L(|@w}PZ?%(_in)CTLgbSCas0@J6ho?U?Q$!|;C992jX{l~M__+4sE9
    zljK6RmGbp*jXiFv{uMd%?)<@gGI$^}F29g=I@GgSTTvBZ-hGY>5L4XkaHn`7w`0o_
    zhrDoQzf$Z`((3fC4EkZfEpuUZW7PVV4imHmh_-S+s^ij}ZTPr!{q}`6Ydv-nI0y0;
    z(!inG>otX-yn4|DP4HUG1H+DH2~tVP?3v$M8+()4$K9R2i~-62YV^t`QxqyTCX8z6
    zU5f*jw9_P@HtMa{u}(7_sujLBo7cb4Sw{oQq~1eZ?H#OM=2u!ds>
    zI0K)(th$+H-nK3F*huo4O;)j-^Ms~IfO*H^K&{Y!Hm$Sm6(y!;}Wp
    zrdUL2*4ctZq0XhOdm)(F*doO);MbSK$1p*Bm5*`@r=vMn59b!zMCcXXHebdyIW%$@
    zu*T-Zu!bn$s6~t@tb@mcby#rtV9tUsLA^mAgF7w!zQHRIi7y_Nomj-AG${(7tLVeG
    z&);X$c2IJdfoRDz-^KpfX|wwTeH%@TnW)r)@RkK!t-Im1A0rBU=xMlUBug*Y1lAnO
    zuJN+y5+%M$Tm*5N`xF;_^^ibJc%SkRCeCNK-|3Z2nT;wJptO?pjXCc{s7T(cMm1oi
    zD@kuQI<}_!gcZngf7
    zSLByg8|{_tv@w4h(V7lrM299R+|*WoXFBqy`~!k9E-gce#_HyTMC%Z5EJaxAXOrFL
    z)CRZJ0u+QULOJ1w+F?XA`o1Hwq3yC4w)JTn$E;p+2tM
    z5D`*xR5`k0H2CC~tZ7LBf57F(Vm4W4c2rGRiXc`aI+^iruR72PcyTDA?KUbaRR$H>
    zNpwo#3K>H7lBE};de1k7@NMzW2gOdfn)p?Cn46r9&Lq-9gli#KC_v`5n?i!F5=51#
    zq4@E%-R5?hrN)uK>I=RiPDDje40#f+>hDqRI8>-ksf8osHz5%qoaj=;9zXD#0F4xqiE>eA2#{cC)tWl#6jUm5U-VqT~y#
    zQ@`OBSu3p%U+*$e@*?yi6(M5qQCmggu3&sX^+gI!o^AIC7Fr;|j*|Ug{W!cGEIQ_t
    z4xx+D|PtQsy3Zrv1TKGS$t
    zRxV$RHW}-AX6-|0lSbWUe^gRO5Of>LG_)#m31w+n;YLxbDHgWEgH
    z+dD^mifbj0wAHk)aKM3&L{{JwvUH`c9E&ZAHne
    zY$dUeXW(Z$4A4;ABP4r4y^rcB;1N4N;_g7fZ(_@VRI&pj3rC331~PW`z=7zjIj3a;
    z6P%4@=s69l!to~7-^H`W_r~DFTk;lTf;$3Do+o9A==Z|==I0cPC!%6c3wlz7?)-z{
    zn?rNcv(dY%)}+KXepv|TdAl)sPm)KcyV(aYvukUO+PNYUbNOnGhB!=
    zX>U+;(WSiu>m2nD7GQpMj?G1(w&~suEtKDN2glfHd&$nu@ZXouZXU1QJt(JPZYSN^
    zs!m*xrHk%vJpBXjuAPXV&mNhbXVsd}MzeMtjg1rD?$~3#O!A(;U7l*YH!hR&x1=-{L`0d#_;5&LJdP$N
    ziO;ebmGbwn_q@pS!e7LK@sBADb_w2*c9ml2kITk^T8rd5Y&T9guVPeoV>_{SdDi2e
    zBWDKk3?DQb4p54ztUD5G7{}QB#bPF2J!FII#fRO~U!WPe9jt%h@@BN^&>K4$a=MXP
    z4x=qinZQ^y$mwtT^l!t)O-knY_3V9$+PDghGM?wKJ}$^IJ4iZ{aOT1pQcO-<*(ze*
    zD-lY%xaq4N5YAcq@dSbLkfzC6hFtiiN;Pe0{nR_1+;J18Am^5>p2d7|Im
    z*-fs(N03_zC6=TG<=_IktS8;N^vzJW*Ejdw
    z|JM{v^wBo+w8bY%l@nOeCUiM5Vo*cLn%B1wRZ-@}Vo2&NIN$7HiAAM#D!r4OPM46)
    zDI&ino72|{f>bq%yw0gSLpKdFI){@v%g!n__oQ{2Tnf3IWpT?y2xC)Lr|)GbpVN0#
    zP35%Om5v5Uonxz)nVdz>mFkw$IhyDyDnx|S>m%`9YStN2oaGs(JdlJTku#iGp=++D
    zF~U*p0LYVYGW5(UWU8{qKI2n55*6xwFo~;}aOyztn!FltwNLxRUV+tkwJj})=)fF8
    zs5Vm=l3CffEIVE@+sodeG*Aj0aLq|sPE;`|>7~1+gCbH$0EjCi1w7x+Q>SYlSY=!tZdI_N-RdB9;?&`x|WPLDRh>NKq-3});jWnvWN%j;Bfgl
    zk4=FOM{RF#(4P;JjF~9W1{PSG7!)y2O>Os(A`SCzU}!OG3XEy3oRJh1q>59iSX?>3
    zAz$zr@<@-BoedU>W?5_uk&MJ(rG^>>nt_rQnWbZfhB1t#OI!#c$`+88CC^=k1}O*_
    zHR1y%F6B+fEWns{IAtOEQ)lY7u1MhAzDl-;XV^NCOFDybg}LhZvBpjxW6`C}G0pi=
    zFr-387C7l|WoCNb{3z(P!MB*OzggDG-Vkx3y}bzBnHK{Ktx>d?0`f3r@f
    z&q~dCwrtAk(aKe%dAXItxvd+JFm&ms>Me9;ImDDn9dZ}oxhG>Ig2i++<(3t65t$xG>KGCcTnSVWSg
    z!#@3mF-u8m0AnB(eou2I$Ru-2CS9Yp#wD2TZKjc2)SfCqf?*+`EIrn|4=FLMR@jnP
    zV@3y&g!I|rwU{dwgNV)`X%@>9tzmMfXcsl9Yz!KLo%EV?{w3a)IX%dZ~vT0&T;z6GHPLzyr|B}
    zfn0Xm4*dz*GtA^%+$6rkLG<3VS?52vpS(w@&+7RsM2B?a-i$`k`KYYf({xFG*d9h5
    ziZ#f#QTD7NAUYSexsKV(VN1(|ZV+iUGM0-bOb8>Y_+^2u*SPgzP~Jcwu~x$$kykrp
    zQc7}48OfrfY19A;w|FFLJS5q&*JDO+qK=&xHBaa~b;4Dx*l9O$`Rc@sn^2r$g58}U
    zPB=kZqta|QQ!F)RfW2%3LQMIeYCQeaqMN_~OK99rPo|1Eq;0PC*o@l=%eYnlmT|jx
    zYz*1w+)ik%M&#T+2vNsambv)1&3MrMvS*pBXMHS%#$-RQr}lH9+K9YcF^|IF<^pDw
    z)LX)Jqcnv`XMUXW8JK)=&^CTKJO_B&Em#C>D;tU$C--&C-t96n)*F93gebHMBhqv?
    zdNF4N8ZKvH7B?~bAhP(e(1R~BW~@QAnfGA2
    zs7L0IRc3w)e@ke#w%{CmY-Q@|=ci0=OmhXBq3ro(s2NQIyFkk@BDXdyLvu1tp>wyz
    z@0tkeSe%YD5;@I?!XnTH8Ov9j7O9U&xD9PR#*eLOs!6#3$=_?YjDpIRkddg5T@CIG5
    zQ&{~~bzSyUnZn)~X!;{Ef;X`D&{-VCmg1pE=JjG!hm99A{0=h+^H6-OHuvkV#>_mk
    zd5lOMKIOBa$#};v%Cr5t43nc__-)L}d5bPIrkRe&GcNaP4~LG*H4bI>*m)yTjX9q2
    z;=MUJ5by(ot?WwMIU?zJRe^EX+@~FTqq(#Zarl{vl3zIv_Awhmf-)@l*w?1%L##$!
    z&ARYlgw}%_{YRz&C&oRMxBJ2SGl(v}Ucs=?4~>f6Ld5_+5!T8;qMSBWKK`AxTFkaA
    z;NPvw_d=MpG1GCHxm5!k;DzjC*3d_8CW`#y34WkSMl$7m3xfzUVIU5${Kvo31USDb
    z`>ejRQIQb_HTo=MtLp28)L-*}3X9G6=NI`p7o6@YYi=77*4S^zz6?=D?Mv;btNnLdaIyvW0}un^<>xP
    zCX)`K0K}zaOSX{GRQDt&n-Rb-#$jcsia6*~
    zC&yMm&>-d#0-WU7UvD)@JoyUp!1i>+`t@@Q)r2>uwYz*N^QoLba8cV7ve+P2%pUJ)
    zRM8^T&qRl3=buSxBXNcx3-1RG=D{4(&p8hi`bUbbC?*}Eoe>+l^CYZ;WP%RFh35tQs{9G2lDhGH5&GZjyeFv@GMob0@tL0jBKCm
    z7DlIE2HNm-P~=Z-im0m2xosllh&7YpDGjP#Te5`)R(`d`s+H8oB3Un1)Y|dZ+BNS&
    z{D$tZNbKbFnj&nI4zwzH*HuD@tqUtNyc`?@St|C(710QN9g#3*ET_GAWurEy4U1Ld
    z1RPjr7ey3hyrmKuB@{9g6IoKWje@e;KQ@_QghdG8w22~zYl2rHMpS+|;S;qhhT?D-
    zqmH4I(uS5+iQ70Jgl|I5cI5!u7ALSdG!!DZC07^jh#7UBI)aek0SaKmkbQ_*D&WMp
    zSqob;i#nm#f^1_|7?M%}jnw?%$2Ih2rF3qt=$5BJmRD|f(X7r9DzrmFL4~cbeK}6(
    zF($w5#ao#-`hCImY>82)9NOHs0pXf+!$#TpPszg-rnO}(3c|}wLl$nurV>Gg?4*ip
    z3)DTJw&2yNq7KD<61Y)(ks9s=3VkSn&W5x+A`=|iEwrQ(b75}s>=9iy3?ChW&SM}zneU?YVO-sM4{St-{J=5wS_>E
    z=4KS6tsYJoAI!PP7w`0+{&Eq!!vU8p7U5vMKr#p&!dW3}T-!l?9W(g<+ax+;T&?^G
    zNe|X&RQ5xeQyxRfviVrfaHEKgEoh%Rkv@tc#Q9BL^$B9>W)Pt^D?*JFeOoNKaOFA3
    zup=MwCtcW|q7REbYcVT*j6NnnDGj<=Q#?BuC}=2|I%>o58+(6hh(O|;MS;YqT6UoB
    z?M!9V4qhKKjj9=~F+)NEg~9D3IvQvt5L*Ox#rPpE%5OEUr=}-eL`~xv>RNXVGT(_-
    zrwk}MvF9unPrTwoFeL%6r2reXH^%Ojex6H1-sQcf
    zr4$nuqn(^03x?UC%Eb0U6b&U6?%%}TdF^S!#Ei9oJM1NQIEU~ejNJ?-m(TTwEhKf>
    z(rTW&%3dpDLd3s)4i0zQiINK$$F;YnqPBq>o$
    zk))I}_q8&{R|G8CL1;sH1c-MI8%c-Dq7(Y>YLInBia_BhS+B$NOwRAVr7L7>9-4-*
    zzdU0cL1PnPL)uxVlfk&QcyM9zQcO&blNE-*WXdrQ3rUhycT)Z{A7#r&CxdlW>eNOh
    zQn3VoR&;Dh*xEF21LBYQ6p1*rltmlT4}~>R-P({)FB{cZy)eKgh{YH8a}%@ChRI8l
    z_sXhAPM10LmhO%@Cu6(KQD1}O39{<<)?n@&AT;`Zg{XgRDyfn#@Z<@W3_>L0b{E=5^@a-28VcI2wD4
    zm`t)F;vtc8F>RVNt2K|=VTy?g!rscP<&-1~bDb4Qm0V-l`h`*C^|qMGCzM(?rX;dY
    z%$F73m{eF9le0|Hx5%eaV1@aj6NA_jZzf9>v`qE#h4fFoJZWzkZP}N+&i{+zvqeE$hdQF~fYzCWZyw!b}Fw!fnF{y<=lYUOwKI8$1m
    z!V`!#p8jHV`pjDY(1O7ce%@ifOXzp>Tc3kL*zn&5=yy6fCb|6#7q!g)nTf2_f1(tA
    zx{BeeJYfCa)Bf+zgZkM5QT*^T8~;-b{a|I%|MrE{A!Lkx7eRs*`D>3H, 2009, 2010
    -# Lorenzo De Liso , 2010.
    -# Milo Casagrande , 2009, 2010, 2011, 2014.
    -#
    -msgid ""
    -msgstr ""
    -"Project-Id-Version: xz-utils\n"
    -"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
    -"POT-Creation-Date: 2015-02-26 16:55+0200\n"
    -"PO-Revision-Date: 2014-10-20 13:16+0100\n"
    -"Last-Translator: Milo Casagrande \n"
    -"Language-Team: Italian \n"
    -"Language: it\n"
    -"MIME-Version: 1.0\n"
    -"Content-Type: text/plain; charset=UTF-8\n"
    -"Content-Transfer-Encoding: 8bit\n"
    -"X-Launchpad-Export-Date: 2010-08-16 19:16+0000\n"
    -"X-Generator: Poedit 1.6.10\n"
    -"Plural-Forms: nplurals=2; plural=(n != 1);\n"
    -
    -#: src/xz/args.c:63
    -#, c-format
    -msgid "%s: Invalid argument to --block-list"
    -msgstr "%s: argomento non valido per --block-list"
    -
    -#: src/xz/args.c:73
    -#, c-format
    -msgid "%s: Too many arguments to --block-list"
    -msgstr "%s: troppi argomenti per --block-list"
    -
    -#: src/xz/args.c:102
    -msgid "0 can only be used as the last element in --block-list"
    -msgstr "0 può essere usato solo come ultimo elemento in --block-list"
    -
    -#: src/xz/args.c:406
    -#, c-format
    -msgid "%s: Unknown file format type"
    -msgstr "%s: tipo di formato del file sconosciuto"
    -
    -#: src/xz/args.c:429 src/xz/args.c:437
    -#, c-format
    -msgid "%s: Unsupported integrity check type"
    -msgstr "%s: tipo di controllo integrità non supportato"
    -
    -#: src/xz/args.c:473
    -msgid "Only one file can be specified with `--files' or `--files0'."
    -msgstr "Solo un file può essere specificato con \"--files\" o \"--files0\"."
    -
    -#: src/xz/args.c:541
    -#, c-format
    -msgid "The environment variable %s contains too many arguments"
    -msgstr "La variabile d'ambiente %s contiene troppi argomenti"
    -
    -#: src/xz/coder.c:110
    -msgid "Maximum number of filters is four"
    -msgstr "Il numero massimo di filtri è quattro"
    -
    -#: src/xz/coder.c:129
    -msgid "Memory usage limit is too low for the given filter setup."
    -msgstr "Il limite dell'uso della memoria è troppo basso per l'impostazione del filtro dato."
    -
    -#: src/xz/coder.c:159
    -msgid "Using a preset in raw mode is discouraged."
    -msgstr "Non è consigliato usare un preset nella modalità raw."
    -
    -#: src/xz/coder.c:161
    -msgid "The exact options of the presets may vary between software versions."
    -msgstr "Le opzioni esatte per i preset possono variare tra le versioni del software."
    -
    -#: src/xz/coder.c:184
    -msgid "The .lzma format supports only the LZMA1 filter"
    -msgstr "Il formato .lzma supporta solo il filtro LZMA1"
    -
    -#: src/xz/coder.c:192
    -msgid "LZMA1 cannot be used with the .xz format"
    -msgstr "LZMA1 non può essere usato con il formato .xz"
    -
    -#: src/xz/coder.c:209
    -msgid "The filter chain is incompatible with --flush-timeout"
    -msgstr "La catena di filtri non è compatibile con --flush-timeout"
    -
    -#: src/xz/coder.c:215
    -msgid "Switching to single-threaded mode due to --flush-timeout"
    -msgstr "Passaggio a modalità singolo thread poiché viene usato --flush-timeout"
    -
    -#: src/xz/coder.c:234
    -#, c-format
    -msgid "Using up to % threads."
    -msgstr "Vengono usati circa % thread."
    -
    -#: src/xz/coder.c:247
    -msgid "Unsupported filter chain or filter options"
    -msgstr "Catena di filtri od opzioni del filtro non supportata"
    -
    -#: src/xz/coder.c:255
    -#, c-format
    -msgid "Decompression will need %s MiB of memory."
    -msgstr "L'estrazione necessita di %s MiB di memoria."
    -
    -#: src/xz/coder.c:290
    -#, c-format
    -msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
    -msgstr "Regolato il numero di thread da %s a %s per non eccedere il limite di utilizzo della memoria di %s MiB"
    -
    -#: src/xz/coder.c:344
    -#, c-format
    -msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
    -msgstr "Regolata la dimensione del dizionario LZMA%c da %s MiB a %s MiB per non superare il limite dell'uso della memoria di %s MiB"
    -
    -#: src/xz/file_io.c:89 src/xz/file_io.c:93 src/xz/file_io.c:101
    -#, c-format
    -msgid "Error creating a pipe: %s"
    -msgstr "Errore nel creare una pipe: %s"
    -
    -#: src/xz/file_io.c:179
    -#, c-format
    -msgid "%s: poll() failed: %s"
    -msgstr "%s: poll() non riuscita: %s"
    -
    -#. TRANSLATORS: When compression or decompression finishes,
    -#. and xz is going to remove the source file, xz first checks
    -#. if the source file still exists, and if it does, does its
    -#. device and inode numbers match what xz saw when it opened
    -#. the source file. If these checks fail, this message is
    -#. shown, %s being the filename, and the file is not deleted.
    -#. The check for device and inode numbers is there, because
    -#. it is possible that the user has put a new file in place
    -#. of the original file, and in that case it obviously
    -#. shouldn't be removed.
    -#: src/xz/file_io.c:249
    -#, c-format
    -msgid "%s: File seems to have been moved, not removing"
    -msgstr "%s: sembra che il file sia stato spostato, non viene rimosso"
    -
    -#: src/xz/file_io.c:256 src/xz/file_io.c:769
    -#, c-format
    -msgid "%s: Cannot remove: %s"
    -msgstr "%s: impossibile rimuovere: %s"
    -
    -#: src/xz/file_io.c:281
    -#, c-format
    -msgid "%s: Cannot set the file owner: %s"
    -msgstr "%s: impossibile impostare il proprietario del file: %s"
    -
    -#: src/xz/file_io.c:287
    -#, c-format
    -msgid "%s: Cannot set the file group: %s"
    -msgstr "%s: impossibile impostare il gruppo del file: %s"
    -
    -#: src/xz/file_io.c:306
    -#, c-format
    -msgid "%s: Cannot set the file permissions: %s"
    -msgstr "%s: impossibile impostare i permessi del file: %s"
    -
    -#: src/xz/file_io.c:416
    -#, c-format
    -msgid "Error getting the file status flags from standard input: %s"
    -msgstr "Errore nel recuperare le flag di stato del file dallo standard input: %s"
    -
    -#: src/xz/file_io.c:470 src/xz/file_io.c:532
    -#, c-format
    -msgid "%s: Is a symbolic link, skipping"
    -msgstr "%s: è un collegamento simbolico, viene saltato"
    -
    -#: src/xz/file_io.c:561
    -#, c-format
    -msgid "%s: Is a directory, skipping"
    -msgstr "%s: è una directory, viene saltata"
    -
    -#: src/xz/file_io.c:567
    -#, c-format
    -msgid "%s: Not a regular file, skipping"
    -msgstr "%s: non è un file regolare, viene saltato"
    -
    -#: src/xz/file_io.c:584
    -#, c-format
    -msgid "%s: File has setuid or setgid bit set, skipping"
    -msgstr "%s: il file ha il bit setuid o setgid impostato, viene saltato"
    -
    -#: src/xz/file_io.c:591
    -#, c-format
    -msgid "%s: File has sticky bit set, skipping"
    -msgstr "%s: il file ha lo sticky bit impostato, viene saltato"
    -
    -#: src/xz/file_io.c:598
    -#, c-format
    -msgid "%s: Input file has more than one hard link, skipping"
    -msgstr "%s: il file di input ha più di un collegamento fisico, viene saltato"
    -
    -#: src/xz/file_io.c:678
    -#, c-format
    -msgid "Error restoring the status flags to standard input: %s"
    -msgstr "Errore nel ripristinare le flag di stato sullo standard input: %s"
    -
    -#: src/xz/file_io.c:727
    -#, c-format
    -msgid "Error getting the file status flags from standard output: %s"
    -msgstr "Errore nel recuperare le flag di stato del file dallo standard output: %s"
    -
    -#: src/xz/file_io.c:905
    -#, c-format
    -msgid "Error restoring the O_APPEND flag to standard output: %s"
    -msgstr "Errore nel ripristinare la flag O_APPEND sullo standard output: %s"
    -
    -#: src/xz/file_io.c:917
    -#, c-format
    -msgid "%s: Closing the file failed: %s"
    -msgstr "%s: chiusura del file non riuscita: %s"
    -
    -#: src/xz/file_io.c:953 src/xz/file_io.c:1179
    -#, c-format
    -msgid "%s: Seeking failed when trying to create a sparse file: %s"
    -msgstr "%s: posizionamento non riuscito nel tentativo di creare un file sparso: %s"
    -
    -#: src/xz/file_io.c:1048
    -#, c-format
    -msgid "%s: Read error: %s"
    -msgstr "%s: errore di lettura: %s"
    -
    -#: src/xz/file_io.c:1068
    -#, c-format
    -msgid "%s: Error seeking the file: %s"
    -msgstr "%s: errore nel cercare il file: %s"
    -
    -#: src/xz/file_io.c:1078
    -#, c-format
    -msgid "%s: Unexpected end of file"
    -msgstr "%s: fine del file inaspettata"
    -
    -#: src/xz/file_io.c:1137
    -#, c-format
    -msgid "%s: Write error: %s"
    -msgstr "%s: errore di scrittura: %s"
    -
    -#: src/xz/hardware.c:107
    -msgid "Disabled"
    -msgstr "Disabilitato"
    -
    -#. TRANSLATORS: Test with "xz --info-memory" to see if
    -#. the alignment looks nice.
    -#: src/xz/hardware.c:126
    -msgid "Total amount of physical memory (RAM): "
    -msgstr "Quantità totale di memoria fisica (RAM):     "
    -
    -#: src/xz/hardware.c:128
    -msgid "Memory usage limit for compression:    "
    -msgstr "Limite utilizzo memoria per la compressione: "
    -
    -#: src/xz/hardware.c:130
    -msgid "Memory usage limit for decompression:  "
    -msgstr "Limite utilizzo memoria per l'estrazione:    "
    -
    -#. TRANSLATORS: Indicates that there is no integrity check.
    -#. This string is used in tables, so the width must not
    -#. exceed ten columns with a fixed-width font.
    -#: src/xz/list.c:65
    -msgid "None"
    -msgstr "Nessuno"
    -
    -#. TRANSLATORS: Indicates that integrity check name is not known,
    -#. but the Check ID is known (here 2). This and other "Unknown-N"
    -#. strings are used in tables, so the width must not exceed ten
    -#. columns with a fixed-width font. It's OK to omit the dash if
    -#. you need space for one extra letter, but don't use spaces.
    -#: src/xz/list.c:72
    -msgid "Unknown-2"
    -msgstr "Sconosc2"
    -
    -#: src/xz/list.c:73
    -msgid "Unknown-3"
    -msgstr "Sconosc3"
    -
    -#: src/xz/list.c:75
    -msgid "Unknown-5"
    -msgstr "Sconosc5"
    -
    -#: src/xz/list.c:76
    -msgid "Unknown-6"
    -msgstr "Sconosc6"
    -
    -#: src/xz/list.c:77
    -msgid "Unknown-7"
    -msgstr "Sconosc7"
    -
    -#: src/xz/list.c:78
    -msgid "Unknown-8"
    -msgstr "Sconosc8"
    -
    -#: src/xz/list.c:79
    -msgid "Unknown-9"
    -msgstr "Sconosc9"
    -
    -#: src/xz/list.c:81
    -msgid "Unknown-11"
    -msgstr "Sconosc11"
    -
    -#: src/xz/list.c:82
    -msgid "Unknown-12"
    -msgstr "Sconosc12"
    -
    -#: src/xz/list.c:83
    -msgid "Unknown-13"
    -msgstr "Sconosc13"
    -
    -#: src/xz/list.c:84
    -msgid "Unknown-14"
    -msgstr "Sconosc14"
    -
    -#: src/xz/list.c:85
    -msgid "Unknown-15"
    -msgstr "Sconosc15"
    -
    -#: src/xz/list.c:153
    -#, c-format
    -msgid "%s: File is empty"
    -msgstr "%s: il file è vuoto"
    -
    -#: src/xz/list.c:158
    -#, c-format
    -msgid "%s: Too small to be a valid .xz file"
    -msgstr "%s: troppo piccolo per essere un file .xz valido"
    -
    -#. TRANSLATORS: These are column headings. From Strms (Streams)
    -#. to Ratio, the columns are right aligned. Check and Filename
    -#. are left aligned. If you need longer words, it's OK to
    -#. use two lines here. Test with "xz -l foo.xz".
    -#: src/xz/list.c:671
    -msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
    -msgstr " Strm  Blocc.    Compresso     Estratto  Rapp.  Contr   Nome file"
    -
    -#: src/xz/list.c:711
    -#, c-format
    -msgid "  Streams:            %s\n"
    -msgstr "  Stream:               %s\n"
    -
    -#: src/xz/list.c:713
    -#, c-format
    -msgid "  Blocks:             %s\n"
    -msgstr "  Blocchi:              %s\n"
    -
    -#: src/xz/list.c:715
    -#, c-format
    -msgid "  Compressed size:    %s\n"
    -msgstr "  Dim. compresso:       %s\n"
    -
    -#: src/xz/list.c:718
    -#, c-format
    -msgid "  Uncompressed size:  %s\n"
    -msgstr "  Dim. estratto:        %s\n"
    -
    -#: src/xz/list.c:721
    -#, c-format
    -msgid "  Ratio:              %s\n"
    -msgstr "  Rapporto:             %s\n"
    -
    -#: src/xz/list.c:723
    -#, c-format
    -msgid "  Check:              %s\n"
    -msgstr "  Controllo:            %s\n"
    -
    -#: src/xz/list.c:724
    -#, c-format
    -msgid "  Stream padding:     %s\n"
    -msgstr "  Padding dello stream: %s\n"
    -
    -#. TRANSLATORS: The second line is column headings. All except
    -#. Check are right aligned; Check is left aligned. Test with
    -#. "xz -lv foo.xz".
    -#: src/xz/list.c:752
    -msgid ""
    -"  Streams:\n"
    -"    Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding"
    -msgstr ""
    -"Stream:\n"
    -"    Stream    Blocc.    Offset comp.    Offset estr.      Dim. comp.   Dim. estratto  Rapp.  Contr      Padding"
    -
    -#. TRANSLATORS: The second line is column headings. All
    -#. except Check are right aligned; Check is left aligned.
    -#: src/xz/list.c:807
    -#, c-format
    -msgid ""
    -"  Blocks:\n"
    -"    Stream     Block      CompOffset    UncompOffset       TotalSize      UncompSize  Ratio  Check"
    -msgstr ""
    -"  Blocchi:\n"
    -"    Stream    Blocc.    Offset comp. Offset estratto       Dim. tot.   Dim. estratto  Rapp.  Contr"
    -
    -#. TRANSLATORS: These are additional column headings
    -#. for the most verbose listing mode. CheckVal
    -#. (Check value), Flags, and Filters are left aligned.
    -#. Header (Block Header Size), CompSize, and MemUsage
    -#. are right aligned. %*s is replaced with 0-120
    -#. spaces to make the CheckVal column wide enough.
    -#. Test with "xz -lvv foo.xz".
    -#: src/xz/list.c:819
    -#, c-format
    -msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
    -msgstr "      Val.cont %*s Header  Flag       Dim.compr.    Uso mem.  Filtri"
    -
    -#: src/xz/list.c:897 src/xz/list.c:1072
    -#, c-format
    -msgid "  Memory needed:      %s MiB\n"
    -msgstr "  Memoria necessaria:   %s MiB\n"
    -
    -#: src/xz/list.c:899 src/xz/list.c:1074
    -#, c-format
    -msgid "  Sizes in headers:   %s\n"
    -msgstr "  Dim. negli header:    %s\n"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "Yes"
    -msgstr "Sì"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "No"
    -msgstr "No"
    -
    -#: src/xz/list.c:901 src/xz/list.c:1076
    -#, c-format
    -msgid "  Minimum XZ Utils version: %s\n"
    -msgstr "  Versione \"XZ Utils\" minima: %s\n"
    -
    -#. TRANSLATORS: %s is an integer. Only the plural form of this
    -#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
    -#: src/xz/list.c:1051
    -#, c-format
    -msgid "%s file\n"
    -msgid_plural "%s files\n"
    -msgstr[0] "%s file\n"
    -msgstr[1] "%s file\n"
    -
    -#: src/xz/list.c:1064
    -msgid "Totals:"
    -msgstr "Totali:"
    -
    -#: src/xz/list.c:1065
    -#, c-format
    -msgid "  Number of files:    %s\n"
    -msgstr "  Numero di file:       %s\n"
    -
    -#: src/xz/list.c:1140
    -msgid "--list works only on .xz files (--format=xz or --format=auto)"
    -msgstr "--list funziona solamente con file .xz (--format=xz o --format=auto)"
    -
    -#: src/xz/list.c:1146
    -msgid "--list does not support reading from standard input"
    -msgstr "--list non è in grado di leggere dallo standard input"
    -
    -#: src/xz/main.c:89
    -#, c-format
    -msgid "%s: Error reading filenames: %s"
    -msgstr "%s: errore nel leggere i nomi dei file: %s"
    -
    -#: src/xz/main.c:96
    -#, c-format
    -msgid "%s: Unexpected end of input when reading filenames"
    -msgstr "%s: fine dell'input durante la lettura dei nomi dei file non attesa"
    -
    -#: src/xz/main.c:120
    -#, c-format
    -msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?"
    -msgstr "%s: nessun carattere trovato durante la lettura dei nomi dei file; forse si intendeva usare \"--files0\" invece di \"--files\"?"
    -
    -#: src/xz/main.c:174
    -msgid "Compression and decompression with --robot are not supported yet."
    -msgstr "La compressione e l'estrazione con --robot non sono ancora supportate."
    -
    -#: src/xz/main.c:231
    -msgid "Cannot read data from standard input when reading filenames from standard input"
    -msgstr "Impossibile leggere i dati dallo standard input durante la lettura dei nomi dei file dallo standard input"
    -
    -#. TRANSLATORS: This is the program name in the beginning
    -#. of the line in messages. Usually it becomes "xz: ".
    -#. This is a translatable string because French needs
    -#. a space before a colon.
    -#: src/xz/message.c:713
    -#, c-format
    -msgid "%s: "
    -msgstr "%s: "
    -
    -#: src/xz/message.c:776 src/xz/message.c:826
    -msgid "Internal error (bug)"
    -msgstr "Errore interno (bug)"
    -
    -#: src/xz/message.c:783
    -msgid "Cannot establish signal handlers"
    -msgstr "Impossibile stabilire i gestori dei segnali"
    -
    -#: src/xz/message.c:792
    -msgid "No integrity check; not verifying file integrity"
    -msgstr "Nessun controllo d'integrità; l'integrità del file non viene verificata"
    -
    -#: src/xz/message.c:795
    -msgid "Unsupported type of integrity check; not verifying file integrity"
    -msgstr "Tipo di controllo di integrità non supportato; l'integrità del file non viene verificata"
    -
    -#: src/xz/message.c:802
    -msgid "Memory usage limit reached"
    -msgstr "Limite di utilizzo della memoria raggiunto"
    -
    -#: src/xz/message.c:805
    -msgid "File format not recognized"
    -msgstr "Formato di file non riconosciuto"
    -
    -#: src/xz/message.c:808
    -msgid "Unsupported options"
    -msgstr "Opzioni non supportate"
    -
    -#: src/xz/message.c:811
    -msgid "Compressed data is corrupt"
    -msgstr "I dati compressi sono danneggiati"
    -
    -#: src/xz/message.c:814
    -msgid "Unexpected end of input"
    -msgstr "Fine dell'input non attesa"
    -
    -#: src/xz/message.c:847
    -#, c-format
    -msgid "%s MiB of memory is required. The limiter is disabled."
    -msgstr "%s MiB di memoria sono richiesti. Il limite è disabilitato."
    -
    -#: src/xz/message.c:875
    -#, c-format
    -msgid "%s MiB of memory is required. The limit is %s."
    -msgstr "%s MiB di memoria sono richiesti. Il limite è %s."
    -
    -#: src/xz/message.c:1042
    -#, c-format
    -msgid "%s: Filter chain: %s\n"
    -msgstr "%s: catena di filtri: %s\n"
    -
    -#: src/xz/message.c:1052
    -#, c-format
    -msgid "Try `%s --help' for more information."
    -msgstr "Provare \"%s --help\" per maggiori informazioni."
    -
    -#: src/xz/message.c:1078
    -#, c-format
    -msgid ""
    -"Usage: %s [OPTION]... [FILE]...\n"
    -"Compress or decompress FILEs in the .xz format.\n"
    -"\n"
    -msgstr ""
    -"Uso: %s [OPZIONI]... [FILE]...\n"
    -"Comprime o estrae i FILE nel formato .xz.\n"
    -"\n"
    -
    -#: src/xz/message.c:1085
    -msgid "Mandatory arguments to long options are mandatory for short options too.\n"
    -msgstr "Gli argomenti obbligatori per le opzioni lunghe lo sono anche per quelle brevi.\n"
    -
    -#: src/xz/message.c:1089
    -msgid " Operation mode:\n"
    -msgstr " Modalità di operazione:\n"
    -
    -#: src/xz/message.c:1092
    -msgid ""
    -"  -z, --compress      force compression\n"
    -"  -d, --decompress    force decompression\n"
    -"  -t, --test          test compressed file integrity\n"
    -"  -l, --list          list information about .xz files"
    -msgstr ""
    -"  -z, --compress      Forza la compressione\n"
    -"  -d, --decompress    Forza l'estrazione\n"
    -"  -t, --test          Verifica l'integrità dei file compressi\n"
    -"  -l, --list          Elenca informazioni sui file .xz"
    -
    -#: src/xz/message.c:1098
    -msgid ""
    -"\n"
    -" Operation modifiers:\n"
    -msgstr ""
    -"\n"
    -" Modificatori di operazioni:\n"
    -
    -#: src/xz/message.c:1101
    -msgid ""
    -"  -k, --keep          keep (don't delete) input files\n"
    -"  -f, --force         force overwrite of output file and (de)compress links\n"
    -"  -c, --stdout        write to standard output and don't delete input files"
    -msgstr ""
    -"  -k, --keep          Mantiene (non elimina) i file di input\n"
    -"  -f, --force         Forza la sovrascrittura dell'output e comprime/estrae i\n"
    -"                      collegamenti\n"
    -"  -c, --stdout        Scrive sullo standard output e non elimina i file di input"
    -
    -#: src/xz/message.c:1107
    -msgid ""
    -"      --single-stream decompress only the first stream, and silently\n"
    -"                      ignore possible remaining input data"
    -msgstr ""
    -"      --single-stream Decomprime solamente il primo stream e ignora\n"
    -"                      silenziosamente i restanti dati di input"
    -
    -#: src/xz/message.c:1110
    -msgid ""
    -"      --no-sparse     do not create sparse files when decompressing\n"
    -"  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
    -"      --files[=FILE]  read filenames to process from FILE; if FILE is\n"
    -"                      omitted, filenames are read from the standard input;\n"
    -"                      filenames must be terminated with the newline character\n"
    -"      --files0[=FILE] like --files but use the null character as terminator"
    -msgstr ""
    -"      --no-sparse     Non crea file sparsi durante l'estrazione\n"
    -"  -S, --suffix=.SUF   Usa il suffisso \".SUF\" sui file compressi\n"
    -"      --files=[FILE]  Legge i nomi dei file da elaborare da FILE; se FILE è\n"
    -"                      omesso, i nomi dei file sono letti dallo standard input;\n"
    -"                      i nomi dei file devono essere terminati con un carattere\n"
    -"                      di newline\n"
    -"      --files0=[FILE] Come --files ma usa il carattere null come terminatore"
    -
    -#: src/xz/message.c:1119
    -msgid ""
    -"\n"
    -" Basic file format and compression options:\n"
    -msgstr ""
    -"\n"
    -" Formato file di base e opzioni di compressione:\n"
    -
    -#: src/xz/message.c:1121
    -msgid ""
    -"  -F, --format=FMT    file format to encode or decode; possible values are\n"
    -"                      `auto' (default), `xz', `lzma', and `raw'\n"
    -"  -C, --check=CHECK   integrity check type: `none' (use with caution),\n"
    -"                      `crc32', `crc64' (default), or `sha256'"
    -msgstr ""
    -"  -F, --format=FMT    Formato file per codificare o decodificare; i possibili\n"
    -"                      valori sono \"auto\" (predefinito) \"xz\", \"lzma\" e \"raw\"\n"
    -"  -C, --check=CHECK   Tipo di verifica integrità: \"none\" (usare con attenzione),\n"
    -"                      \"crc32\", \"crc64\" (predefinito) o \"sha256\""
    -
    -#: src/xz/message.c:1126
    -msgid "      --ignore-check  don't verify the integrity check when decompressing"
    -msgstr "      --ignore-check  Non verifica il codice di integrità quando decomprime"
    -
    -#: src/xz/message.c:1130
    -msgid ""
    -"  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
    -"                      decompressor memory usage into account before using 7-9!"
    -msgstr ""
    -"  -0 ... -9           Preset di compressione; predefinito è 6; tenere a mente\n"
    -"                      l'utilizzo di memoria per comprimere ed estrarre prima\n"
    -"                      di usare 7-9"
    -
    -#: src/xz/message.c:1134
    -msgid ""
    -"  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
    -"                      does not affect decompressor memory requirements"
    -msgstr ""
    -"  -e, --extreme       Tenta di migliorare il rapporto di compressione\n"
    -"                      utilizzando più tempo di CPU; non cambia i requisiti di\n"
    -"                      memoria in fase di estrazione"
    -
    -#: src/xz/message.c:1138
    -msgid ""
    -"  -T, --threads=NUM   use at most NUM threads; the default is 1; set to 0\n"
    -"                      to use as many threads as there are processor cores"
    -msgstr ""
    -"  -T, --threads=NUM   Usa al massimo NUM thread: il valore predefinito è 1,\n"
    -"                      impostare a 0 per usare tanti thread quanti core la CPU\n"
    -"                      ha a disposizione"
    -
    -#: src/xz/message.c:1143
    -msgid ""
    -"      --block-size=SIZE\n"
    -"                      start a new .xz block after every SIZE bytes of input;\n"
    -"                      use this to set the block size for threaded compression"
    -msgstr ""
    -"      --block-size=DIM\n"
    -"                      Avvia un nuovo blocco .xz dopo ogni DIM byte di input:\n"
    -"                      usare per impostare la dimensione del blocco durante la\n"
    -"                      compressione con thread"
    -
    -#: src/xz/message.c:1147
    -msgid ""
    -"      --block-list=SIZES\n"
    -"                      start a new .xz block after the given comma-separated\n"
    -"                      intervals of uncompressed data"
    -msgstr ""
    -"      --block-list=DIM\n"
    -"                      Avvia un nuovo blocco .xz dopo gli intervalli, sperati\n"
    -"                      da virgole, di dati non compressi"
    -
    -#: src/xz/message.c:1151
    -msgid ""
    -"      --flush-timeout=TIMEOUT\n"
    -"                      when compressing, if more than TIMEOUT milliseconds has\n"
    -"                      passed since the previous flush and reading more input\n"
    -"                      would block, all pending data is flushed out"
    -msgstr ""
    -"      --flush-timeout=TIMEOUT\n"
    -"                      Durante la compressione, se sono passati più di TIMEOUT\n"
    -"                      millisecondi dal flush precedente e la lettura di\n"
    -"                      ulteriore input risulterebbe bloccata, viene eseguito il\n"
    -"                      flush di tutti i dati pendenti"
    -
    -#: src/xz/message.c:1157
    -#, no-c-format
    -msgid ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      set memory usage limit for compression, decompression,\n"
    -"                      or both; LIMIT is in bytes, % of RAM, or 0 for defaults"
    -msgstr ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      Imposta il limite di utilizzo della memoria per la\n"
    -"                      compressione, l'estrazione o entrambe; LIMIT è in byte,\n"
    -"                      % della memoria RAM oppure 0 per il valore predefinito"
    -
    -#: src/xz/message.c:1164
    -msgid ""
    -"      --no-adjust     if compression settings exceed the memory usage limit,\n"
    -"                      give an error instead of adjusting the settings downwards"
    -msgstr ""
    -"      --no-adjust     Se le impostazioni di compressione eccedono il limite di\n"
    -"                      utilizzo della memoria, lancia un errore invece di\n"
    -"                      utilizzare valori più piccoli"
    -
    -#: src/xz/message.c:1170
    -msgid ""
    -"\n"
    -" Custom filter chain for compression (alternative for using presets):"
    -msgstr ""
    -"\n"
    -" Catena di filtri personalizzati per la compressione (alternative per\n"
    -" l'utilizzo di preset):"
    -
    -#: src/xz/message.c:1179
    -msgid ""
    -"\n"
    -"  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
    -"  --lzma2[=OPTS]      more of the following options (valid values; default):\n"
    -"                        preset=PRE reset options to a preset (0-9[e])\n"
    -"                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=NUM     number of literal context bits (0-4; 3)\n"
    -"                        lp=NUM     number of literal position bits (0-4; 0)\n"
    -"                        pb=NUM     number of position bits (0-4; 2)\n"
    -"                        mode=MODE  compression mode (fast, normal; normal)\n"
    -"                        nice=NUM   nice length of a match (2-273; 64)\n"
    -"                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  maximum search depth; 0=automatic (default)"
    -msgstr ""
    -"\n"
    -"  --lzma1[=OPZ]      LZMA1 o LZMA2; OPZ è un elenco separato da virgole di zero\n"
    -"  --lzma2[=OPZ]      o più delle seguenti opzioni (valori validi; predefinito):\n"
    -"                        preset=NUM Reimposta le opzioni al preset NUM (0-9[e])\n"
    -"                        dict=NUM   Dimensione del dizionario\n"
    -"                                   (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=NUM     Numero di bit letterali di contesto (0-4; 3)\n"
    -"                        lp=NUM     Numero di bit letterali di posizione (0-4; 0)\n"
    -"                        pb=NUM     Numero di bit di posizione (0-4; 2)\n"
    -"                        mode=MODE  Modalità di compressione\n"
    -"                                   (fast, normal; normal)\n"
    -"                        nice=NUM   Lunghezza valida per una corrispondenza\n"
    -"                                   (2-273; 64)\n"
    -"                        mf=NAME    Strumento per cercare corrispondenze\n"
    -"                                   (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  Profondità massima di ricerca; 0=automatica\n"
    -"                                   (predefinito)"
    -
    -#: src/xz/message.c:1194
    -msgid ""
    -"\n"
    -"  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
    -"  --powerpc[=OPTS]    PowerPC BCJ filter (big endian only)\n"
    -"  --ia64[=OPTS]       IA-64 (Itanium) BCJ filter\n"
    -"  --arm[=OPTS]        ARM BCJ filter (little endian only)\n"
    -"  --armthumb[=OPTS]   ARM-Thumb BCJ filter (little endian only)\n"
    -"  --sparc[=OPTS]      SPARC BCJ filter\n"
    -"                      Valid OPTS for all BCJ filters:\n"
    -"                        start=NUM  start offset for conversions (default=0)"
    -msgstr ""
    -"\n"
    -"  --x86[=OPZ]        Filtro BCJ x86 (32 e 64 bit)\n"
    -"  --powerpc[=OPZ]    Filtro BCJ PowerPC (solo big endian)\n"
    -"  --ia64[=OPZ]       Filtro BCJ IA-64 (Itanium)\n"
    -"  --arm[=OPZ]        Filtro BCJ ARM (solo little endian)\n"
    -"  --armthumb[=OPZ]   Filtro BCJ ARM-Thumb (solo little endian)\n"
    -"  --sparc[=OPZ]      Filtro BCJ SPARC\n"
    -"                     OPZ valide per tutti i filtri BCJ:\n"
    -"                      start=NUM Offset iniziale per le conversioni\n"
    -"                                (predefinito=0)"
    -
    -#: src/xz/message.c:1206
    -msgid ""
    -"\n"
    -"  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
    -"                        dist=NUM   distance between bytes being subtracted\n"
    -"                                   from each other (1-256; 1)"
    -msgstr ""
    -"\n"
    -"  --delta[=OPZ]      Filtro Delta; OPZ valide (valori validi; predefinito):\n"
    -"                      dist=NUM   Distanza tra byte sottratti\n"
    -"                                 gli uni dagli altri (1-256; 1)"
    -
    -#: src/xz/message.c:1214
    -msgid ""
    -"\n"
    -" Other options:\n"
    -msgstr ""
    -"\n"
    -" Altre opzioni:\n"
    -
    -#: src/xz/message.c:1217
    -msgid ""
    -"  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
    -"  -v, --verbose       be verbose; specify twice for even more verbose"
    -msgstr ""
    -"  -q, --quiet         Sopprime gli avvisi; specificare due volte per sopprimere\n"
    -"                      anche gli errori\n"
    -"  -v, --verbose       Output prolisso; specificare due volte per output ancora\n"
    -"                      più prolisso"
    -
    -#: src/xz/message.c:1222
    -msgid "  -Q, --no-warn       make warnings not affect the exit status"
    -msgstr "  -Q, --no-warn       Gli avvisi non influenzano lo stato d'uscita"
    -
    -#: src/xz/message.c:1224
    -msgid "      --robot         use machine-parsable messages (useful for scripts)"
    -msgstr "      --robot         Usa messaggi analizzabili (utile per gli script)"
    -
    -#: src/xz/message.c:1227
    -msgid ""
    -"      --info-memory   display the total amount of RAM and the currently active\n"
    -"                      memory usage limits, and exit"
    -msgstr ""
    -"      --info-memory   Visualizza la quantità totale di RAM, il limite attuale\n"
    -"                      attivo di utilizzo della memore ed esce"
    -
    -#: src/xz/message.c:1230
    -msgid ""
    -"  -h, --help          display the short help (lists only the basic options)\n"
    -"  -H, --long-help     display this long help and exit"
    -msgstr ""
    -"  -h, --help          Stampa l'aiuto breve (elenca solo le opzioni di base)\n"
    -"  -H, --long-help     Stampa questo lungo aiuto ed esce"
    -
    -#: src/xz/message.c:1234
    -msgid ""
    -"  -h, --help          display this short help and exit\n"
    -"  -H, --long-help     display the long help (lists also the advanced options)"
    -msgstr ""
    -"  -h, --help          Stampa questo breve aiuto ed esce\n"
    -"  -H, --long-help     Stampa l'aiuto lungo (elenca anche le opzioni avanzate)"
    -
    -#: src/xz/message.c:1239
    -msgid "  -V, --version       display the version number and exit"
    -msgstr "  -V, --version       Stampa il numero della versione ed esce"
    -
    -#: src/xz/message.c:1241
    -msgid ""
    -"\n"
    -"With no FILE, or when FILE is -, read standard input.\n"
    -msgstr ""
    -"\n"
    -"Senza FILE, o quando FILE è -, legge lo standard input.\n"
    -
    -#. TRANSLATORS: This message indicates the bug reporting address
    -#. for this package. Please add _another line_ saying
    -#. "Report translation bugs to <...>\n" with the email or WWW
    -#. address for translation bugs. Thanks.
    -#: src/xz/message.c:1247
    -#, c-format
    -msgid "Report bugs to <%s> (in English or Finnish).\n"
    -msgstr ""
    -"Segnalare i bug a <%s> (in inglese o finlandese).\n"
    -"Segnalare i bug di traduzione a .\n"
    -
    -#: src/xz/message.c:1249
    -#, c-format
    -msgid "%s home page: <%s>\n"
    -msgstr "Sito web di %s: <%s>\n"
    -
    -#: src/xz/message.c:1253
    -msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
    -msgstr "Questa è una versione di sviluppo non adatta per utilizzi in produzione."
    -
    -#: src/xz/options.c:86
    -#, c-format
    -msgid "%s: Options must be `name=value' pairs separated with commas"
    -msgstr "%s: le opzioni devono essere coppie \"nome=valore\" separate da virgole"
    -
    -#: src/xz/options.c:93
    -#, c-format
    -msgid "%s: Invalid option name"
    -msgstr "%s: nome opzione non valido"
    -
    -#: src/xz/options.c:113
    -#, c-format
    -msgid "%s: Invalid option value"
    -msgstr "%s: valore dell'opzione non valido"
    -
    -#: src/xz/options.c:247
    -#, c-format
    -msgid "Unsupported LZMA1/LZMA2 preset: %s"
    -msgstr "Preset LZMA/LZMA2 non supportato: %s"
    -
    -#: src/xz/options.c:355
    -msgid "The sum of lc and lp must not exceed 4"
    -msgstr "La somma di lc e lp non deve superare 4"
    -
    -#: src/xz/options.c:359
    -#, c-format
    -msgid "The selected match finder requires at least nice=%"
    -msgstr "Lo strumento per cercare corrispondenze selezionato richiede almeno nice=%"
    -
    -#: src/xz/suffix.c:133 src/xz/suffix.c:258
    -#, c-format
    -msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
    -msgstr "%s: con --format=raw, --suffix=.SUF è richiesto a meno che non si scriva sullo stdout"
    -
    -#: src/xz/suffix.c:164
    -#, c-format
    -msgid "%s: Filename has an unknown suffix, skipping"
    -msgstr "%s: il nome del file ha un suffisso sconosciuto, viene saltato"
    -
    -#: src/xz/suffix.c:185
    -#, c-format
    -msgid "%s: File already has `%s' suffix, skipping"
    -msgstr "%s: il file ha già il suffisso \"%s\", viene saltato"
    -
    -#: src/xz/suffix.c:393
    -#, c-format
    -msgid "%s: Invalid filename suffix"
    -msgstr "%s: suffisso del nome del file non valido"
    -
    -#: src/xz/util.c:71
    -#, c-format
    -msgid "%s: Value is not a non-negative decimal integer"
    -msgstr "%s: il valore non è un numero intero decimale non-negativo"
    -
    -#: src/xz/util.c:113
    -#, c-format
    -msgid "%s: Invalid multiplier suffix"
    -msgstr "%s: suffisso del moltiplicatore non valido"
    -
    -#: src/xz/util.c:115
    -msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
    -msgstr "I suffissi validi sono \"KiB\" (2^10), \"MiB\" (2^20), e \"GiB\" (2^30)."
    -
    -#: src/xz/util.c:132
    -#, c-format
    -msgid "Value of the option `%s' must be in the range [%, %]"
    -msgstr "Il valore dell'opzione \"%s\" deve essere nell'intervallo [%, %]"
    -
    -#: src/xz/util.c:257
    -msgid "Empty filename, skipping"
    -msgstr "Nome file vuoto, viene saltato"
    -
    -#: src/xz/util.c:271
    -msgid "Compressed data cannot be read from a terminal"
    -msgstr "I dati compressi non possono essere letti da un terminale"
    -
    -#: src/xz/util.c:284
    -msgid "Compressed data cannot be written to a terminal"
    -msgstr "I dati compressi non possono essere scritti ad un terminale"
    -
    -#: src/common/tuklib_exit.c:39
    -msgid "Writing to standard output failed"
    -msgstr "Scrittura sullo standard ouput non riuscita"
    -
    -#: src/common/tuklib_exit.c:42
    -msgid "Unknown error"
    -msgstr "Errore sconosciuto"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard input: %s"
    -#~ msgstr "Errore nell'impostare O_NONBLOCK sullo standard input: %s"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard output: %s"
    -#~ msgstr "Errore nell'impostare O_NONBLOCK sullo standard output: %s"
    diff --git a/external/public-domain/xz/dist/po/pl.gmo b/external/public-domain/xz/dist/po/pl.gmo
    deleted file mode 100644
    index 222fca553c4229b7c96d6e189bbf711b374a958e..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
    
    literal 25679
    zcmchfeQ+G-ecxA-9mn)rEZL3|Th1dZG(iOi0eq803YI_;lt7UHOoC!WSq>L>3t)k}
    z+w<+6pgX&b#YnQ<#;sjNu4TJzChZ?>)A6KHJ56FG^+aUrHnp8jGj8p8(oCAnq|=P!
    zw3%rqZ6^JEf6udfcO;IIolbYS`0mTI&+G5~`5k}f=2ty;Lli}y<(%e>UL8gM0r<_=
    zM$wJnJKqpRH-VGj-JCl99r*9TuYh;)^6$MdioQ%G|MAUHRN?v0-V#M8z^{To2)^|#
    zQN*jL0^SAQ2R;vOgTDyA`K?j(zroAk0{Er3MbRa27a#u*@Dt$Y!6)AyMPHzucl}Tl
    zJ;?o6emIJL5`5b`qG%rcG^ldl0^dZr-aDh{z1)BN)+l-w{4#hC`2KfA(R1LZ!6(7V
    zABm!;z%PJb0rxv!{)XG4=vTRa4y=P`-yKCX9epX_Hv|4DNY&9BZ;v9Xh$camI~8y(
    z;70;}7VPu>pN0E7f7F*>05wlla0={#hroXT-VFXW$dpFk244lQ&7)81WtlK52~I21Remt4bp|^
    zb{b)-qX$8azXoc(FM%vo^jVN4h+Y64_?rR$1l-{M=7}h}7yJ;Y@%<8b82k;8CZg}#
    z>)WY-EOm4S+y^#5)%&yI{jY-R@9%*N;LQw9^YngD{ceH#!Dql(@K-?1>;D34;GI7f
    zMUR3%13K_K;1c*|2CsF9LDm0BQ2qE4I0ybVNR!d65dHUq4}co?GN|=W!6V>Lfg0z(
    z1n&m_52*GJQn~7@gRnyMQIMfWp9eLLE1=f(O*GDwMKb{(0Y%48g8Kf8;EmwdLGkc6
    zK+(r8Zq)9ZK$?tBf%k)bQ2qEKDE|0UkWZrhGoC-I;BoFh2Ob1}7u0&ZjmcL(X2I8h
    z2`IX0fLixw!8d?E5AFhgIpF1hUkmunfPVnKmU7<-_-6rM#bW9C8w0*Q;JX7(g0Nh4
    z2xJMPN5EUar$DXCXTbM?-vsr35~95yJP&F5|fxpH5-(gW6=SBN2
    zXr1T(^{`+6UuP1RdH*M%*7Ybv^hWUg;6vaR_>aMV0sd!jl}UXS-ygj%iWa$l;C?S(
    zKMlT<=QDF&t}GsnqOWoP`eR;Rev3)}80BxD_wwwYfd7U2{|>&Ha$i5;+xx=@pcS4U
    zc+h|MBKU8)zX_sw4*V+k8L)OTihdvbbMWtjzei`k4nA`Vo&X;^?fK}dpya}T3-`O|
    zwB~mY=)jZUt>6}@avu-)55x0+4PN5;AAs)!HIq4uqwmUjRk--vU+7EljHD
    zW*;beJqb#lEPUJCdf@OJKRWsxi395@ALAWIkhT~Ot}4vH>rI^+4}
    z2SJuPdLO8Eo&lMv=;uJu_aA|~!CTIHI=KfFKR*g;TpdvI^i!bP`={Vu@OQx)xNF7h
    zr3`!<_rC=4D*76z@!x*V*SiF2{2v703w|=(e+^W>zYQJ)-|;YW0=^G?EBJZvHt-ig
    zjq|raNGN*!d1N=Z1a5)Pg6{|a0@OUd|Hq?f6MPC(y?+ee4eox#*Y^Psl8Qb8YFu9i
    zUkCnAQ0sov1wUW6fsk4>8}ONcUjrfC=}&0r7IczznBNc79#kAiQZbDEEP
    z0w$o^{}iZo{RVgw_~)S7yWz1wA0R9cErDMEKMiW!^B?eX?&F~P@vlIw%jwF^*ML!eZ>%oV?8L$f83O)zE348(E1-=yUs{y|e@b?4$alk(d`0Chy
    z_X7dn5%4_$X9C^}-V-qgp!)YDsP+EmAWIni2FOxJx3Bu~_Q5&se+`@lqpF{;8Sn;f
    zKgGGN=NuZ(BIj##6OLDbPjZSDibM0Jwb8Neq5PY2b&0dj`C-oII7PSjaTdoQ@8G$dLb^YL_zdR{bBgxg&N<8Z5l+YXY0g)3-pmR6m51n4
    z$6Gj`;{5BJf0a`Q>|}EMFnCH2I5N)Ha@INT;uJl4rl*qhr~F$;1h+zmId3^P`*}<9veiuW`PI^QSqV
    z<@^Na-{3@q7|$G}W3S=*Uhw!Epk2;7=f^ld&-n|S$9MXCHHR
    z9M==KmexB-`-poyuBSDp*KWdJ^S7JiM_esgi@WvC-ow0;jzKbkamv8!f{MqJ60R@{zh-qq=*%hp^!X=i+3Go~B!Rdpq9_gtR#6E|_-q4cP$xS50d51mer9&vZ`cYICtYFISqn%%}KQ_NWF
    zDdZ5>nXzUkd7|T1(+)$Ot{gbx_Ft!})^)0CWqGQ84%an3zOL5l4t4ER$G-7(G_qPU
    zdwS{kywlQaYIAi!kKM#toOdQ&Gix{E`jLR+t7@jzBy>oZuAVg4JJ94BYu1Q6kmtm{
    z%D%hyA905cjIX7!HoG`?n(nyp(OTN9iKsWK`zPH-^}wWC?d;PZZdW_ZHh;!fS4&!*
    z4d1Iq{6yO5He8;>Z8~Fbj=1UBxZBC-Us`n&1qXY+dE)LvBUJ7jPu$UCCxa|-6Z`j7
    zSaugTYm7;k>PV&1%C?hst2*@YvYsp-8~J!OU3W>dmc~t&HS0b9X&N6oF!UX>urOCS
    zbihq4AT82vWA9KE)>hnZjFxwEXHE|lauX10r=DEf6km2WAm_p7d|6r1qgV8Oj*J){
    zqjP7M=gtg|aSUrdJdmJk$e_4hA8IcjFFg^M?ZDA?32Ch%Cy+R8apB`hTeJ%khGm?c
    zmH<2&=PWJKTcQa{_RBR)>_JW)-bLwS-5hEt7Pz_*r_E6RfH@{&X@Vvs^SIUNy1B%i
    zmrMEH!&I}>LN*vH!%68{O4qFVB@@s?4W3V7k!I#jES#F3ltkX%Ko{uFA&)DQ2*9}J
    zq$+B0yXMkntJ|5{6^T7WX{+_Dx>b>oo;|y8VgBrx8TZo_yJoWOrk?0K`^?2_48vsh
    zIwNUbE&IpRl_KuisJvX9-E9^ViLR){oj6jz20fFswVsWs?0OwbSkRu+u!3%+Jsba#
    zF_m@mgwZfdF34M`CXG8NzUyE)-Fp>3`$y}><^NmU;Z6sN@GrO{IdVcBL
    z%9yrnnaWC<>ys{BLu#T1I~y=`_}DelI*XG)oweL;#QB)oT5+D!DaZ)9scu6{kEdBT
    zch)BpFzUF-%o?$I7*pAH)~(n4z$cBlT9Pt+sr3<6S)DY;D9f>@>xlWJQr$?ZTNo!<
    zb5F-H|LI!K`lCf(Z>OD}^CfKfHO3XVqPae(skxR_8VTL(F|n9At$OS$>0}-BW!%WR
    zO|vP^%$>H8X~5NPyPY&U^`67*ff~n*E!5l1<8>5F+Cb+rM#OLOL^>D@rR-g$=-=$A
    zh0_bgQdZPE|9&unvP9+dB&1N3C?9(o8T~67yS77Di;GD#P01Eo?JCaG#>(-!1OBI%l)Uxg7HqvUObJ7;@r;b{N#Ot^!6y4!7|3U&f
    z_tI}@zMAVySLLjhB=4@RrBBRGojrGgIy|rQwLNtg^>`0@v>Z00v?{}N!`*7&(OHRB
    z?0OTcden>?w2Q=OwX-VLk27mprH+WDgCrieXb>P)@}xE8Yl;y8zH(XRHZLQ>dz|nZ
    z^rfLiTtyBf?M8~0VIRUUQe5_%Lev2{(%f~9btIW#rW#!R#H54tKCjHU(GJs
    zw*1<~3_UcHwIi#F&)ONJ=x_L|sczt1&~8O*6|bU7nKbbr%9ht_-MSHFUTvqXPQJIS
    zNP4lJRPqip(iq|cGk9!3YiXO&`U0Mlb1e#jV9bcTjG|rh=aVN~v6ZKZ6-PF{StK1XH3x@g1
    ztNhaQ6W8K*bz&yJCv*+tpKdrD(!@1(oOOe
    zvD&Wg-=}uDICNm7LyYTUz7gZ>?$La_Pn|#xB72&e4337DLiZ;9Bz5AowWR881L+Kz
    zR-LY`^@=|C20|YE81<5wY-G@=-1hL6C59J+2-c#{9PtK6=BCHYCW~Q}<#eejbtoBu
    z!wvu8veOD@kU)&8%3@oe9#)@%Ve3aUqEU-C!7Ck7gq1{J;+Mi7Ug|p6K_k+DPiHFc@Ii
    zLdZ9=cE{O!+?E`NTAq>3_Ntlj!E!cV=|R<1&zkFl3I}zuD0=1V8lIQy_JFU3x=?&3
    z0>5r!m?C9cq2JiYne{uaJ+3eh`qD>3BpfSS>iSla3{8XGO?bnL5LD7h_6CV2o|fTQ
    zS<_cAH#TB%_&Zj!y^VEdF&L~md;~8EGy=S#y~R>vGBvlXuBz(FJ2grdb@>_~kkZ=-
    zRjHQYjt%!qqxqofVx2LEiX-o~ES6C69t_e-s%B1ZD>$HLiZW(bNC#&c<>RW20j*}i
    zTyRo`;lb6_Fn))hpnwGo6bh+NebrJ9+q&iFs(1#~t2K1DLVm?l74+o>&q7HeA&7@0
    z7+6-L-4&k(gJU4~RDE3^Sq#lS&>y=?F_I;u#e4Cp7C~;At#stvQF(R25kBj6r@pku
    zx^V6oifhSxzucWOFKlqnqZQfOg=#BG`1>r?Ui^}kCVr3?^@a^v05nfY`r_t03!Tk6IcdnD-Lb77=*$;<$7t83HO~p{X
    z*6AJlqCuIlykQzXS0Ue*Fm?~v=-AGWEkGhn*$@wt5PaqHv3iY^Ca0CuBCi^
    zLVb_x`o1S;-d)_C?+G5rq|3L`R*Ua!)K*kQ7l(o>s%>b$mQ7b#38qO*DJ*u
    zC5=|6H)w|rH_V0Eh*9gS+Dyo&KV%=Oqo;2g+XNCSsztrrx6
    z^6EtcG{I{z4-7l1B}gSDbJh43n%J9+K5nmfWeiCE4@a+TFh!waVM4D)-Zj`@Nn3RS
    zYCFC4I@W1~BVUE*X7lGq&fN|(EMy5~L{$5Pm0DSXC@
    z8v3k_a}QjKa|N;Cv<T5Hq;9JXTv(zOrF48kn2nAN`g)_G3J%``*xn)@QEjK
    z)loV}cq8GZ>=4XO+SS
    zU^sw5RfWKY2eI!6ePFahugT0hvyjS}Zn48QvDXa=w_szG7I_%bfZ7y`D9t*X
    zuqb@9owc`unT;({tO9<0*?kNX#8-JMw{UMX?W$qlLW>B!!rSJ{xH_9g4g=QMoEX*!
    z1pmy_!86`^f9>7#9udfB_i>~qp}f;n3N_(;d2#j`1<+#-P9eF
    z9A+R|GR-%zf7Y9ExV5XfE|>FVJ{;-p@OQ?o*4~LB`K8%L
    zdu8iQ%->qHpiLRkp-BoivD#hV8~I)S0l^rTmZ3yrb#p?Z(-3bgMOf-*lilXj2DjA$
    z6of89Ir&}QQ!d`)y|FKKI_$9yw#iuwx`u(yB4pim6dZ)12);z}a4^CQ^>O7!h>(&y
    zm7^(ogHOI~RZ9x^4KCjov&mXhJADaD5yYxRiy8l}RtMSvFE&NA+(u=k%HV@$5-llQ
    zAw$SsGWB9q@A;+>zD@qcpx6ml6Tb>K(|e|(Gl}#N;aUh53Xpm2CXk@>1W_ewD1IVs
    zHo4r(RO3is^#xxMCt^rYjCc}m*x#ev38=^nq_gx!QC*_S;xOQcYOZg`BO{Fr{@<}+{5!{&Mqu1y2Ygxx3IVZ56mBTCzj5*5{*TeXL>WdVdJX`A!EVMv^Z6*88`hIvjSai%T9YPuH
    zuTBIxc-0KiN{*jPgY~LKN{M)xjV2Nbdh9@CPWsS>SZkxlUNu}C+`0+&eD>m9S-Jdh
    zv_fAmGHM?}+hf#i_V-XYVJf=Tc=8JWT(I>`L{Q3%qRPz7;Bw#Ka{u7+z~J&=c{wOL
    zC^>k0s4RC^d3ASrbq`kqO<`+&r~d8>D`UcLxX8!?zy;wxh@O$!c6z4BvzDUdRhE+2
    z$II}uZ3d_-?opDxpx(!{74WF-A91y-;5V`5Kq}dWk%c2fX#*KMwQE;&&YaUSfeFsW
    zGW47VRpEFO>u=*(<9lOp;w^cLF~J>yCNGk*MD%;#2WF-fizlLDcl&gw2;Id8!jt{e
    zd#9rF!`7t4Hhx(M=Xtv^dL+rC<#x7-nO#|^RUR%PF_?P?r)H)O?DFEMayrLttsF%t
    zRaUaYGVk(as)`AkHt+9rw_?&#rn2_>uH~hb$}t3}Vp^5sI2?!FzUi5Rm1&ZG4!M~_
    zhYue7vFUx&(-f?nVRu^$HYj(XGBaJ7Imjo65AOHnPGLw^R@!khuS+={b|>SlE~zQm
    zdN=R8dq23EW%|Qo1
    zt@`~6#N|^tb6(Z%%6c-@Oge)a4!c%;*J+Xf22(RLHO;c4YMXS-wlkFZbtfC#Y4eEf
    zs^Qtso?AIlxqDDfEw3f*%Dnbskg|u}-NXQPE!SD=dgTNf7^k|~vfF%?>?nUZ+nk-9
    zare1t$J^aA)9;<#=ic)kyS#VyfG#KWc>3O%Y4_m|+jEtf-pe;Le6#O}(peA{Wj^Dv
    zliK+78lWSZC96>zLM^BejkUB)0XI?JBM3WFY;9$Y-j&bQo5{*dk|@wwviz{5@nt`kEBWuJ%`BMXO$VVcTtqHMa6jm*?1g@s&&6
    zSCkOBb8W4x-_s;tUDx#zB3rZ9ugj-rzFa!w%9%%w+HTn@Lo)A6YyCYWL;B9tn1^-G
    z5Vedj{m;QiY(h6
    zd~f-YW5mPqs2r}_XS7FJLr?Xmb4MAicXr|0b_}-dYXd>Js^t9`->tuo=N}U8@
    zE33t1O)j5Wc<7vwny$=OnRL~DkBpndZECNMftm56!EGm-lF!M``IBdsE}UMNJM+kx
    z^+9afWIj&?ID*^BI#gQEm>(H=t;|s%=ow8&p=r{jF{VP5-~*(jvm(0q<^#+Yhvd%^p@*f5gAee-r?n^eN$qHq@0A&G|bhcPs7bl8!MJ50(M%hZ|vhenYi9GgG0o|x+LYq
    z52_o<#oWe_WAaG`7YkLPJXQcrz3I|=s0hOdgC|w8A%0EVckx!IOFQYfEFs?awryT)
    z%TeUiDk@1CA*$u6YTp{9|J7dEHC){PA32&s#*;PIH6c_*1eM(!q1kb1NJF!0@+MpD
    z7O9#hXSThOTP3|@x6Pic$8pI(YO$QILK?&V<>ZVea|Qx0hcd)sCTF&o*nSMT`AUls
    zj-mBp+>@>^vKJ}zWwGb|jKri>EP|(NEF3l>;SSOtt(Fr_kJkblL|U)
    zG6WhxqliY@{kUd|4M9%d@qP!?OFN?(pU5jm8Y03+vKNVyW1p+On7mJ3?s1w>DJxZd
    zmHZ674q>)OXQe1`g92MO<30o%zC=SwC>OnrUEeF1BZY|3w_|3(rcv{G<&sxUY$~d9
    zesILP6e@{KLruB7anm4UDk}xDVn*n160`883T9GxvEPihP%Wm2Hd*#&TDToWJh2!l
    z6P&H8cZ@E)L#z?FDyr}tD!-*qv=CS9MwrdlVpA8BM~XG?w7U(tJTdAV`)8c=>6^SXgIYF$5%iTy
    zQlvpjhnd6#_1txK%H-*kQbHGF$etc1Tb2}>LSxRIL7z=&e{*Y!teGn>P8IADOkD}E
    zow7pl*M=Q3vsng8YT)xR*i1R1rv1k(f1vcnz@>Dgd_qq3L<)GjpI&|%dSGQ;cROCc
    z{Jh)lZNXs}i(=<7wUz@J)t~MT$@x2m8SplZaU{8P36t3pqm)-Fc1cA}TacDF=OpaJ
    z!Qq}g?d-~n^%P~-QBK!RN10w4T#R0sV7kW=Offrm$}U}*KWmAu#Po($<4Z4WdR;ik
    zFohZ0^nwYw?Yl`XExTi4{$R
    zFQIh`kvze|baR9hxVO}^!$Mho+99vC8P}Lw
    za~2WoK|gQz%zrasj(AXFYe7bGFQJ~N`?#j6vT6wzBk8SX*awy@G%%FnT|$)gpr?Zd
    zlg%m7#109rtqgy|Y-OgVkOEhpf=Rc#TkWiaj)ox2x>8a6rw($$%&X^XavOHab1kBc
    z1E$-lJ`@NX-N&jfTpjgshlE$y0P_K^PX_F!mUqZ`9V&X2CALG_Yw$#@VzG4)z2&rB
    zYk}>Q2fN*4g>8Zc!$rnuvE>lsRWmFyGPei?SlXm4f-6rsJM>%^A?G#d>+)VMF#6k+
    zdFkiq=V%=EFcdhStC)Mp`&e;QG|02j!)Is~<**ORQQK~{f32D=vWoR!-n+eH2T7@~
    z=e4vjo5&Q@+3EH?!lhrPi>Nw@Yt$`nk3X1$u1~VjL2XDj2Meh`|
    z_J)tXs_4i&Z3|!ru9L0P
    zGrs9wx16GNihp6Q2Y2cE<-4{qWIU%~3<_U}8(W3!vo|3mx1DBa59JbEe!lFO3*BajLt=Dm=%`B145BX~2Q{ExVTzcSI
    zXl5;ZxyU4WhnAdBK1~xWJv0i`UAVqjTvv^A5SA^1v6^3>pY6Ni!=DPyQ)!`Vnu?Nb
    zCN-j|g$lKv;Zj_=bZskI&gW~aPLXF}o?j82)SjA6dMGy9Wn26}sl%msg!9ryjpB+m
    zu;Ve>x8mUvnm$d5?SGBF2-|M(!QkadMSk&6<9fD^mwe4s+54fLL
    zm9n+Poo7<;lUriz9V%XoTUm!al+3(qelm7SR)7)pP7L7vB)DBsV8Y4r@-G$+{GKuh
    zQ#>kjeu;;VLJ)vhMH(n6?$#VDmZ=weN
    zLkr_={28dU9Fy7j{AO$rG10_yLv#nrc2Fn3WOg-pmgK{b0*)};nRYHHlE5^x=Cou&
    z$P$U){O
    zZn!I^Yi&Z&^)kN|yf1Q&qqD?9dh0U4Y*WUYWbl{Y>{fOFiN}2xbU*VMu3~=vXfpzv
    zV8Y|7(&)ILvHxbIEx(!sW3;s)>b5qlej;w)L*b`miV~sT?DU7Q_NnN^>V$4QkJ34GAB8XUj8eiPumI+*ONSe
    z3XkhMeW-9MUJbD(tgR$^C~VO4A6pECuoSu#M^Ls%QC2sN|M+9RQ!$eaB37#Mz?EE8
    z)(XWvhha4p6jH7;s2LvI`W9sqn5)5v`0=7t)1@Yb$Hn
    z*sR!u9lMUk(|@UoybB!fR8dw_KBV7sQkT*}ezO9;jJxopiDCp_`W00a#fC1fP&pW6zE#IPCA;ReAZPMVhK(E
    zG}+}$E~(Tzc2&c@~Wra{QrL;*v@*QO--jMnf%zvIiE{zd(p}zA6PNP
    zPMS|UjBNw@rDx9%Z?&SmESo&+hhK*Yybxdx^KKirzY$!8T02%ANiqd#nR{i_Y7RIX
    zdx-n-spe4mXrB26xg`>+L$*L+33%I34#rC_5EwEZj8@{UX!*=ScmF6tc8ECPv, 2011-2014.
    -#
    -msgid ""
    -msgstr ""
    -"Project-Id-Version: xz 5.1.4\n"
    -"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
    -"POT-Creation-Date: 2015-02-26 16:55+0200\n"
    -"PO-Revision-Date: 2014-10-15 20:53+0200\n"
    -"Last-Translator: Jakub Bogusz \n"
    -"Language-Team: Polish \n"
    -"Language: pl\n"
    -"MIME-Version: 1.0\n"
    -"Content-Type: text/plain; charset=UTF-8\n"
    -"Content-Transfer-Encoding: 8bit\n"
    -"Plural-Forms: nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
    -
    -#: src/xz/args.c:63
    -#, c-format
    -msgid "%s: Invalid argument to --block-list"
    -msgstr "%s: Błędny argument dla --block-list"
    -
    -#: src/xz/args.c:73
    -#, c-format
    -msgid "%s: Too many arguments to --block-list"
    -msgstr "%s: Zbyt dużo argumentów dla --block-list"
    -
    -#: src/xz/args.c:102
    -msgid "0 can only be used as the last element in --block-list"
    -msgstr "0 w --block-list może być użyte wyłącznie jako ostatni element"
    -
    -#: src/xz/args.c:406
    -#, c-format
    -msgid "%s: Unknown file format type"
    -msgstr "%s: Nieznany typ formatu pliku"
    -
    -#: src/xz/args.c:429 src/xz/args.c:437
    -#, c-format
    -msgid "%s: Unsupported integrity check type"
    -msgstr "%s: Nieobsługiwany typ kontroli spójności"
    -
    -#: src/xz/args.c:473
    -msgid "Only one file can be specified with `--files' or `--files0'."
    -msgstr "Wraz z opcją `--files' lub `--files0' można podać tylko jeden plik."
    -
    -#: src/xz/args.c:541
    -#, c-format
    -msgid "The environment variable %s contains too many arguments"
    -msgstr "Zmienna środowiskowa %s zawiera zbyt dużo argumentów"
    -
    -#: src/xz/coder.c:110
    -msgid "Maximum number of filters is four"
    -msgstr "Maksymalna liczba filtrów to cztery"
    -
    -#: src/xz/coder.c:129
    -msgid "Memory usage limit is too low for the given filter setup."
    -msgstr "Limit użycia pamięci jest zbyt mały dla podanej konfiguracji filtra."
    -
    -#: src/xz/coder.c:159
    -msgid "Using a preset in raw mode is discouraged."
    -msgstr "Użycie ustawień predefiniowanych w trybie surowym jest odradzane."
    -
    -#: src/xz/coder.c:161
    -msgid "The exact options of the presets may vary between software versions."
    -msgstr "Dokładne opcje ustawień predefiniowanych mogą różnić się między wersjami oprogramowania."
    -
    -#: src/xz/coder.c:184
    -msgid "The .lzma format supports only the LZMA1 filter"
    -msgstr "Format .lzma obsługuje tylko filtr LZMA1"
    -
    -#: src/xz/coder.c:192
    -msgid "LZMA1 cannot be used with the .xz format"
    -msgstr "LZMA1 nie może być używany z formatem .xz"
    -
    -#: src/xz/coder.c:209
    -msgid "The filter chain is incompatible with --flush-timeout"
    -msgstr "ÅaÅ„cuch filtrów jest niezgodny z --flush-timeout"
    -
    -#: src/xz/coder.c:215
    -msgid "Switching to single-threaded mode due to --flush-timeout"
    -msgstr "Przełączanie w tryb jednowątkowy z powodu --flush-timeout"
    -
    -#: src/xz/coder.c:234
    -#, c-format
    -msgid "Using up to % threads."
    -msgstr "Maksymalna liczba używanych wątków: %."
    -
    -#: src/xz/coder.c:247
    -msgid "Unsupported filter chain or filter options"
    -msgstr "Nieobsługiwany łańcuch filtrów lub opcje filtra"
    -
    -#: src/xz/coder.c:255
    -#, c-format
    -msgid "Decompression will need %s MiB of memory."
    -msgstr "Dekompresja będzie wymagała %s MiB pamięci."
    -
    -#: src/xz/coder.c:290
    -#, c-format
    -msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
    -msgstr "Skorygowano liczbę wątków z %s do %s, aby nie przekroczyć limitu użycia pamięci %s MiB"
    -
    -#: src/xz/coder.c:344
    -#, c-format
    -msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
    -msgstr "Skorygowano rozmiar słownika LZMA%c z %s MiB do %s MiB aby nie przekroczyć limitu użycia pamięci %s MiB"
    -
    -#: src/xz/file_io.c:89 src/xz/file_io.c:93 src/xz/file_io.c:101
    -#, c-format
    -msgid "Error creating a pipe: %s"
    -msgstr "Błąd tworzenia potoku: %s"
    -
    -#: src/xz/file_io.c:179
    -#, c-format
    -msgid "%s: poll() failed: %s"
    -msgstr "%s: poll() nie powiodło się: %s"
    -
    -#. TRANSLATORS: When compression or decompression finishes,
    -#. and xz is going to remove the source file, xz first checks
    -#. if the source file still exists, and if it does, does its
    -#. device and inode numbers match what xz saw when it opened
    -#. the source file. If these checks fail, this message is
    -#. shown, %s being the filename, and the file is not deleted.
    -#. The check for device and inode numbers is there, because
    -#. it is possible that the user has put a new file in place
    -#. of the original file, and in that case it obviously
    -#. shouldn't be removed.
    -#: src/xz/file_io.c:249
    -#, c-format
    -msgid "%s: File seems to have been moved, not removing"
    -msgstr "%s: Plik wygląda na przeniesiony, nie zostanie usunięty"
    -
    -#: src/xz/file_io.c:256 src/xz/file_io.c:769
    -#, c-format
    -msgid "%s: Cannot remove: %s"
    -msgstr "%s: Nie można usunąć: %s"
    -
    -#: src/xz/file_io.c:281
    -#, c-format
    -msgid "%s: Cannot set the file owner: %s"
    -msgstr "%s: Nie można ustawić właściciela pliku: %s"
    -
    -#: src/xz/file_io.c:287
    -#, c-format
    -msgid "%s: Cannot set the file group: %s"
    -msgstr "%s: Nie można ustawić grupy pliku: %s"
    -
    -#: src/xz/file_io.c:306
    -#, c-format
    -msgid "%s: Cannot set the file permissions: %s"
    -msgstr "%s: Nie można ustawić uprawnień pliku: %s"
    -
    -#: src/xz/file_io.c:416
    -#, c-format
    -msgid "Error getting the file status flags from standard input: %s"
    -msgstr "Błąd podczas pobierania flag stanu pliku ze standardowego wejścia: %s"
    -
    -#: src/xz/file_io.c:470 src/xz/file_io.c:532
    -#, c-format
    -msgid "%s: Is a symbolic link, skipping"
    -msgstr "%s: Jest dowiązaniem symbolicznym, pominięto"
    -
    -#: src/xz/file_io.c:561
    -#, c-format
    -msgid "%s: Is a directory, skipping"
    -msgstr "%s: Jest katalogiem, pominięto"
    -
    -#: src/xz/file_io.c:567
    -#, c-format
    -msgid "%s: Not a regular file, skipping"
    -msgstr "%s: Nie jest zwykłym plikiem, pominięto"
    -
    -#: src/xz/file_io.c:584
    -#, c-format
    -msgid "%s: File has setuid or setgid bit set, skipping"
    -msgstr "%s: Plik ma ustawiony bit setuid lub setgid, pominięto"
    -
    -#: src/xz/file_io.c:591
    -#, c-format
    -msgid "%s: File has sticky bit set, skipping"
    -msgstr "%s: Plik ma ustawiony bit sticky, pominięto"
    -
    -#: src/xz/file_io.c:598
    -#, c-format
    -msgid "%s: Input file has more than one hard link, skipping"
    -msgstr "%s: Plik wejściowy ma więcej niż jedno dowiązanie zwykłe, pominięto"
    -
    -#: src/xz/file_io.c:678
    -#, c-format
    -msgid "Error restoring the status flags to standard input: %s"
    -msgstr "Błąd podczas odtwarzania flag stanu dla standardowego wejścia: %s"
    -
    -#: src/xz/file_io.c:727
    -#, c-format
    -msgid "Error getting the file status flags from standard output: %s"
    -msgstr "Błąd podczas pobierania flag stanu pliku ze standardowego wyjścia: %s"
    -
    -#: src/xz/file_io.c:905
    -#, c-format
    -msgid "Error restoring the O_APPEND flag to standard output: %s"
    -msgstr "Błąd podczas odtwarzania flagi O_APPEND dla standardowego wyjścia: %s"
    -
    -#: src/xz/file_io.c:917
    -#, c-format
    -msgid "%s: Closing the file failed: %s"
    -msgstr "%s: Zamknięcie pliku nie powiodło się: %s"
    -
    -#: src/xz/file_io.c:953 src/xz/file_io.c:1179
    -#, c-format
    -msgid "%s: Seeking failed when trying to create a sparse file: %s"
    -msgstr "%s: Zmiana pozycji nie powiodła się podczas próby utworzenia pliku rzadkiego: %s"
    -
    -#: src/xz/file_io.c:1048
    -#, c-format
    -msgid "%s: Read error: %s"
    -msgstr "%s: Błąd odczytu: %s"
    -
    -#: src/xz/file_io.c:1068
    -#, c-format
    -msgid "%s: Error seeking the file: %s"
    -msgstr "%s: Błąd podczas zmiany pozycji w pliku: %s"
    -
    -#: src/xz/file_io.c:1078
    -#, c-format
    -msgid "%s: Unexpected end of file"
    -msgstr "%s: Nieoczekiwany koniec pliku"
    -
    -#: src/xz/file_io.c:1137
    -#, c-format
    -msgid "%s: Write error: %s"
    -msgstr "%s: Błąd zapisu: %s"
    -
    -#: src/xz/hardware.c:107
    -msgid "Disabled"
    -msgstr "Wyłączony"
    -
    -#. TRANSLATORS: Test with "xz --info-memory" to see if
    -#. the alignment looks nice.
    -#: src/xz/hardware.c:126
    -msgid "Total amount of physical memory (RAM): "
    -msgstr "Całkowita ilość pamięci fizycznej (RAM): "
    -
    -#: src/xz/hardware.c:128
    -msgid "Memory usage limit for compression:    "
    -msgstr "Limit użycia pamięci dla kompresji:      "
    -
    -#: src/xz/hardware.c:130
    -msgid "Memory usage limit for decompression:  "
    -msgstr "Limit użycia pamięci dla dekompresji:    "
    -
    -#. TRANSLATORS: Indicates that there is no integrity check.
    -#. This string is used in tables, so the width must not
    -#. exceed ten columns with a fixed-width font.
    -#: src/xz/list.c:65
    -msgid "None"
    -msgstr "Brak"
    -
    -#. TRANSLATORS: Indicates that integrity check name is not known,
    -#. but the Check ID is known (here 2). This and other "Unknown-N"
    -#. strings are used in tables, so the width must not exceed ten
    -#. columns with a fixed-width font. It's OK to omit the dash if
    -#. you need space for one extra letter, but don't use spaces.
    -#: src/xz/list.c:72
    -msgid "Unknown-2"
    -msgstr "Nieznany-2"
    -
    -#: src/xz/list.c:73
    -msgid "Unknown-3"
    -msgstr "Nieznany-3"
    -
    -#: src/xz/list.c:75
    -msgid "Unknown-5"
    -msgstr "Nieznany-5"
    -
    -#: src/xz/list.c:76
    -msgid "Unknown-6"
    -msgstr "Nieznany-6"
    -
    -#: src/xz/list.c:77
    -msgid "Unknown-7"
    -msgstr "Nieznany-7"
    -
    -#: src/xz/list.c:78
    -msgid "Unknown-8"
    -msgstr "Nieznany-8"
    -
    -#: src/xz/list.c:79
    -msgid "Unknown-9"
    -msgstr "Nieznany-9"
    -
    -#: src/xz/list.c:81
    -msgid "Unknown-11"
    -msgstr "Nieznany11"
    -
    -#: src/xz/list.c:82
    -msgid "Unknown-12"
    -msgstr "Nieznany12"
    -
    -#: src/xz/list.c:83
    -msgid "Unknown-13"
    -msgstr "Nieznany13"
    -
    -#: src/xz/list.c:84
    -msgid "Unknown-14"
    -msgstr "Nieznany14"
    -
    -#: src/xz/list.c:85
    -msgid "Unknown-15"
    -msgstr "Nieznany15"
    -
    -#: src/xz/list.c:153
    -#, c-format
    -msgid "%s: File is empty"
    -msgstr "%s: Plik jest pusty"
    -
    -#: src/xz/list.c:158
    -#, c-format
    -msgid "%s: Too small to be a valid .xz file"
    -msgstr "%s: Za mały na poprawny plik .xz"
    -
    -#. TRANSLATORS: These are column headings. From Strms (Streams)
    -#. to Ratio, the columns are right aligned. Check and Filename
    -#. are left aligned. If you need longer words, it's OK to
    -#. use two lines here. Test with "xz -l foo.xz".
    -#: src/xz/list.c:671
    -msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
    -msgstr "Strum.  Bloki    Spakowany  Rozpakowany  Wsp.  Kontrola Nazwa pliku"
    -
    -#: src/xz/list.c:711
    -#, c-format
    -msgid "  Streams:            %s\n"
    -msgstr "  Strumienie:            %s\n"
    -
    -#: src/xz/list.c:713
    -#, c-format
    -msgid "  Blocks:             %s\n"
    -msgstr "  Bloki:                 %s\n"
    -
    -#: src/xz/list.c:715
    -#, c-format
    -msgid "  Compressed size:    %s\n"
    -msgstr "  Rozmiar spakowany:     %s\n"
    -
    -#: src/xz/list.c:718
    -#, c-format
    -msgid "  Uncompressed size:  %s\n"
    -msgstr "  Rozmiar rozpakowany:   %s\n"
    -
    -#: src/xz/list.c:721
    -#, c-format
    -msgid "  Ratio:              %s\n"
    -msgstr "  Współczynnik:          %s\n"
    -
    -#: src/xz/list.c:723
    -#, c-format
    -msgid "  Check:              %s\n"
    -msgstr "  Kontrola spójności:    %s\n"
    -
    -#: src/xz/list.c:724
    -#, c-format
    -msgid "  Stream padding:     %s\n"
    -msgstr "  Wyrównanie strumienia: %s\n"
    -
    -#. TRANSLATORS: The second line is column headings. All except
    -#. Check are right aligned; Check is left aligned. Test with
    -#. "xz -lv foo.xz".
    -#: src/xz/list.c:752
    -msgid ""
    -"  Streams:\n"
    -"    Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding"
    -msgstr ""
    -"  Strumienie:\n"
    -"  Strumień     Bloki    Offset spak.    Offset rozp.        Rozm.spak.    Rozm.rozp.  Wsp.   Kontrola   Wyrównanie"
    -
    -#. TRANSLATORS: The second line is column headings. All
    -#. except Check are right aligned; Check is left aligned.
    -#: src/xz/list.c:807
    -#, c-format
    -msgid ""
    -"  Blocks:\n"
    -"    Stream     Block      CompOffset    UncompOffset       TotalSize      UncompSize  Ratio  Check"
    -msgstr ""
    -"  Bloki:\n"
    -"  Strumień      Blok    Offset spak.    Offset rozp.  Rozm.całkowity      Rozm.rozp.  Wsp.   Kontrola"
    -
    -#. TRANSLATORS: These are additional column headings
    -#. for the most verbose listing mode. CheckVal
    -#. (Check value), Flags, and Filters are left aligned.
    -#. Header (Block Header Size), CompSize, and MemUsage
    -#. are right aligned. %*s is replaced with 0-120
    -#. spaces to make the CheckVal column wide enough.
    -#. Test with "xz -lvv foo.xz".
    -#: src/xz/list.c:819
    -#, c-format
    -msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
    -msgstr "   S.kontr. %*sNagłówek Flagi     Rozm. spak.  Uż.pamięci  Filtry"
    -
    -#: src/xz/list.c:897 src/xz/list.c:1072
    -#, c-format
    -msgid "  Memory needed:      %s MiB\n"
    -msgstr "  Wymagana pamięć:       %s MiB\n"
    -
    -#: src/xz/list.c:899 src/xz/list.c:1074
    -#, c-format
    -msgid "  Sizes in headers:   %s\n"
    -msgstr "  Rozmiar w nagłówkach:  %s\n"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "Yes"
    -msgstr "Tak"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "No"
    -msgstr "Nie"
    -
    -#: src/xz/list.c:901 src/xz/list.c:1076
    -#, c-format
    -msgid "  Minimum XZ Utils version: %s\n"
    -msgstr "  Minimalna wersja XZ Utils: %s\n"
    -
    -#. TRANSLATORS: %s is an integer. Only the plural form of this
    -#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
    -#: src/xz/list.c:1051
    -#, c-format
    -msgid "%s file\n"
    -msgid_plural "%s files\n"
    -msgstr[0] "%s plik\n"
    -msgstr[1] "%s pliki\n"
    -msgstr[2] "%s plików\n"
    -
    -#: src/xz/list.c:1064
    -msgid "Totals:"
    -msgstr "Sumarycznie:"
    -
    -#: src/xz/list.c:1065
    -#, c-format
    -msgid "  Number of files:    %s\n"
    -msgstr "  Liczba plików:         %s\n"
    -
    -#: src/xz/list.c:1140
    -msgid "--list works only on .xz files (--format=xz or --format=auto)"
    -msgstr "--list działa tylko z plikami .xz (--format=xz lub --format=auto)"
    -
    -#: src/xz/list.c:1146
    -msgid "--list does not support reading from standard input"
    -msgstr "--list nie obsługuje odczytu ze standardowego wejścia"
    -
    -#: src/xz/main.c:89
    -#, c-format
    -msgid "%s: Error reading filenames: %s"
    -msgstr "%s: Błąd odczytu nazw plików: %s"
    -
    -#: src/xz/main.c:96
    -#, c-format
    -msgid "%s: Unexpected end of input when reading filenames"
    -msgstr "%s: Nieoczekiwany koniec wejścia podczas odczytu nazw plików"
    -
    -#: src/xz/main.c:120
    -#, c-format
    -msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?"
    -msgstr "%s: Napotkano znak NUL podczas odczytu nazw plików; może miało być `--files0' zamiast `--files'?"
    -
    -#: src/xz/main.c:174
    -msgid "Compression and decompression with --robot are not supported yet."
    -msgstr "Kompresja i dekompresja z opcją --robot nie jest jeszcze obsługiwana."
    -
    -#: src/xz/main.c:231
    -msgid "Cannot read data from standard input when reading filenames from standard input"
    -msgstr "Nie można odczytać danych ze standardowego wejścia przy czytaniu nazw plików ze standardowego wejścia"
    -
    -#. TRANSLATORS: This is the program name in the beginning
    -#. of the line in messages. Usually it becomes "xz: ".
    -#. This is a translatable string because French needs
    -#. a space before a colon.
    -#: src/xz/message.c:713
    -#, c-format
    -msgid "%s: "
    -msgstr "%s: "
    -
    -#: src/xz/message.c:776 src/xz/message.c:826
    -msgid "Internal error (bug)"
    -msgstr "Błąd wewnętrzny"
    -
    -#: src/xz/message.c:783
    -msgid "Cannot establish signal handlers"
    -msgstr "Nie można ustawić obsługi sygnałów"
    -
    -#: src/xz/message.c:792
    -msgid "No integrity check; not verifying file integrity"
    -msgstr "Brak kontroli spójności; poprawność plików nie będzie weryfikowana"
    -
    -#: src/xz/message.c:795
    -msgid "Unsupported type of integrity check; not verifying file integrity"
    -msgstr "Nieobsługiwany typ kontroli spójności; poprawność plików nie będzie weryfikowana"
    -
    -#: src/xz/message.c:802
    -msgid "Memory usage limit reached"
    -msgstr "Osiągnięto limit użycia pamięci"
    -
    -#: src/xz/message.c:805
    -msgid "File format not recognized"
    -msgstr "Nie rozpoznany format pliku"
    -
    -#: src/xz/message.c:808
    -msgid "Unsupported options"
    -msgstr "Nieobsługiwane opcje"
    -
    -#: src/xz/message.c:811
    -msgid "Compressed data is corrupt"
    -msgstr "Dane skompresowane sÄ… uszkodzone"
    -
    -#: src/xz/message.c:814
    -msgid "Unexpected end of input"
    -msgstr "Nieoczekiwany koniec wejścia"
    -
    -#: src/xz/message.c:847
    -#, c-format
    -msgid "%s MiB of memory is required. The limiter is disabled."
    -msgstr "Wymagane jest %s MiB pamięci. Limit jest wyłączony."
    -
    -#: src/xz/message.c:875
    -#, c-format
    -msgid "%s MiB of memory is required. The limit is %s."
    -msgstr "Wymagane jest %s MiB pamięci. Limit to %s."
    -
    -#: src/xz/message.c:1042
    -#, c-format
    -msgid "%s: Filter chain: %s\n"
    -msgstr "%s: ÅaÅ„cuch filtrów: %s\n"
    -
    -#: src/xz/message.c:1052
    -#, c-format
    -msgid "Try `%s --help' for more information."
    -msgstr "Polecenie `%s --help' pokaże więcej informacji."
    -
    -#: src/xz/message.c:1078
    -#, c-format
    -msgid ""
    -"Usage: %s [OPTION]... [FILE]...\n"
    -"Compress or decompress FILEs in the .xz format.\n"
    -"\n"
    -msgstr ""
    -"Składnia: %s [OPCJA]... [PLIK]...\n"
    -"Kompresja lub dekompresja PLIKÓW w formacie .xz.\n"
    -"\n"
    -
    -#: src/xz/message.c:1085
    -msgid "Mandatory arguments to long options are mandatory for short options too.\n"
    -msgstr ""
    -"Argumenty obowiązkowe dla opcji długich są obowiązkowe również dla opcji\n"
    -"krótkich.\n"
    -
    -#: src/xz/message.c:1089
    -msgid " Operation mode:\n"
    -msgstr " Tryb pracy:\n"
    -
    -#: src/xz/message.c:1092
    -msgid ""
    -"  -z, --compress      force compression\n"
    -"  -d, --decompress    force decompression\n"
    -"  -t, --test          test compressed file integrity\n"
    -"  -l, --list          list information about .xz files"
    -msgstr ""
    -"  -z, --compress      wymuszenie kompresji\n"
    -"  -d, --decompress    wymuszenie dekompresji\n"
    -"  -t, --test          sprawdzenie spójności plików skompresowanych\n"
    -"  -l, --list          wypisanie informacji o plikach .xz"
    -
    -#: src/xz/message.c:1098
    -msgid ""
    -"\n"
    -" Operation modifiers:\n"
    -msgstr ""
    -"\n"
    -" Modyfikatory operacji:\n"
    -
    -#: src/xz/message.c:1101
    -msgid ""
    -"  -k, --keep          keep (don't delete) input files\n"
    -"  -f, --force         force overwrite of output file and (de)compress links\n"
    -"  -c, --stdout        write to standard output and don't delete input files"
    -msgstr ""
    -"  -k, --keep          zachowanie (nieusuwanie) plików wejściowych\n"
    -"  -f, --force         nadpisywanie plików wyjściowych i (de)kompresja dowiązań\n"
    -"  -c, --stdout        zapis na standardowe wyjście, nieusuwanie plików wej."
    -
    -#: src/xz/message.c:1107
    -msgid ""
    -"      --single-stream decompress only the first stream, and silently\n"
    -"                      ignore possible remaining input data"
    -msgstr ""
    -"      --single-stream dekompresja tylko pierwszego strumienia, ciche\n"
    -"                      zignorowanie pozostałych danych wejściowych"
    -
    -#: src/xz/message.c:1110
    -msgid ""
    -"      --no-sparse     do not create sparse files when decompressing\n"
    -"  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
    -"      --files[=FILE]  read filenames to process from FILE; if FILE is\n"
    -"                      omitted, filenames are read from the standard input;\n"
    -"                      filenames must be terminated with the newline character\n"
    -"      --files0[=FILE] like --files but use the null character as terminator"
    -msgstr ""
    -"      --no-sparse     nietworzenie plików rzadkich podczas dekompresji\n"
    -"  -S, --suffix=.ROZ   użycie rozszerzenia `.ROZ' dla plików skompresowanych\n"
    -"      --files[=PLIK]  odczyt nazw plików do przetworzenia z PLIKU; jeśli PLIK\n"
    -"                      nie został podany, nazwy są czytane ze standardowego\n"
    -"                      wejścia; muszą być zakończone znakiem nowej linii\n"
    -"      --files0[=PLIK] podobnie do --files, ale znakiem kończącym musi być NUL"
    -
    -#: src/xz/message.c:1119
    -msgid ""
    -"\n"
    -" Basic file format and compression options:\n"
    -msgstr ""
    -"\n"
    -" Podstawowe opcje formatu pliku i kompresji:\n"
    -
    -#: src/xz/message.c:1121
    -msgid ""
    -"  -F, --format=FMT    file format to encode or decode; possible values are\n"
    -"                      `auto' (default), `xz', `lzma', and `raw'\n"
    -"  -C, --check=CHECK   integrity check type: `none' (use with caution),\n"
    -"                      `crc32', `crc64' (default), or `sha256'"
    -msgstr ""
    -"  -F, --format=FORM   format pliki do kodowania lub dekodowania; możliwe to\n"
    -"                      `auto' (domyślny), `xz', 'lzma' i `raw'\n"
    -"  -C, --check=TEST    typ kontroli spójności: `none' (ostrożnie!),\n"
    -"                      `crc32', `crc64' (domyślny) lub `sha256'"
    -
    -#: src/xz/message.c:1126
    -msgid "      --ignore-check  don't verify the integrity check when decompressing"
    -msgstr "      --ignore-check  bez kontroli sprawdzania integralności przy dekompresji"
    -
    -#: src/xz/message.c:1130
    -msgid ""
    -"  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
    -"                      decompressor memory usage into account before using 7-9!"
    -msgstr ""
    -"  -0 ... -9           predefiniowane opcje kompresji; domyślna to 6; przed\n"
    -"                      użyciem wartości 7-9 należy wziąć pod uwagę wykorzystanie\n"
    -"                      pamięci przy kompresji *oraz* dekompresji!"
    -
    -#: src/xz/message.c:1134
    -msgid ""
    -"  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
    -"                      does not affect decompressor memory requirements"
    -msgstr ""
    -"  -e, --extreme       próba poprawy współczynnika kompresji z użyciem większej\n"
    -"                      ilości czasu procesora; nie wpływa na wymagania\n"
    -"                      pamięciowe dekompresora"
    -
    -#: src/xz/message.c:1138
    -msgid ""
    -"  -T, --threads=NUM   use at most NUM threads; the default is 1; set to 0\n"
    -"                      to use as many threads as there are processor cores"
    -msgstr ""
    -"  -T, --threads=ILE   użycie maksymalnie ILU wątków; domyślnie 1; 0 oznacza\n"
    -"                      tyle, ile jest rdzeni procesorów"
    -
    -#: src/xz/message.c:1143
    -msgid ""
    -"      --block-size=SIZE\n"
    -"                      start a new .xz block after every SIZE bytes of input;\n"
    -"                      use this to set the block size for threaded compression"
    -msgstr ""
    -"      --block-size=ROZMIAR\n"
    -"                      rozpoczęcie nowego bloku .xz co ROZMIAR bajtów wejścia;\n"
    -"                      opcja służy do ustawienia rozmiaru bloku dla kompresji\n"
    -"                      wielowÄ…tkowej"
    -
    -#: src/xz/message.c:1147
    -msgid ""
    -"      --block-list=SIZES\n"
    -"                      start a new .xz block after the given comma-separated\n"
    -"                      intervals of uncompressed data"
    -msgstr ""
    -"      --block-list=ROZMIARY\n"
    -"                      rozpoczęcie nowego bloku .xz po rozdzielonych przecinkiem\n"
    -"                      przedziałach danych nieskompresowanych"
    -
    -#: src/xz/message.c:1151
    -msgid ""
    -"      --flush-timeout=TIMEOUT\n"
    -"                      when compressing, if more than TIMEOUT milliseconds has\n"
    -"                      passed since the previous flush and reading more input\n"
    -"                      would block, all pending data is flushed out"
    -msgstr ""
    -"      --flush-timeout=CZAS\n"
    -"                      przy kompresji, jeśli minęło więcej niż CZAS milisekund\n"
    -"                      ostatniegu zapisu bloku, a odczyt kolejnych danych byłby\n"
    -"                      blokujÄ…cy, wszystkie gotowe dane sÄ… zapisywane"
    -
    -#: src/xz/message.c:1157
    -#, no-c-format
    -msgid ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      set memory usage limit for compression, decompression,\n"
    -"                      or both; LIMIT is in bytes, % of RAM, or 0 for defaults"
    -msgstr ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      ustawienie limitu użycia pamięci dla kompresji,\n"
    -"                      dekompresji lub obu; LIMIT jest w bajtach, % RAM lub 0\n"
    -"                      dla limitów domyślnych"
    -
    -#: src/xz/message.c:1164
    -msgid ""
    -"      --no-adjust     if compression settings exceed the memory usage limit,\n"
    -"                      give an error instead of adjusting the settings downwards"
    -msgstr ""
    -"      --no-adjust     jeśli ustawienia kompresji przekraczają limit użycia\n"
    -"                      pamięci, zostanie zgłoszony błąd zamiast zmniejszania\n"
    -"                      ustawień"
    -
    -#: src/xz/message.c:1170
    -msgid ""
    -"\n"
    -" Custom filter chain for compression (alternative for using presets):"
    -msgstr ""
    -"\n"
    -" ÅaÅ„cuch wÅ‚asnych filtrów do kompresji (alternatywa do używania -0 .. -9):"
    -
    -#: src/xz/message.c:1179
    -msgid ""
    -"\n"
    -"  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
    -"  --lzma2[=OPTS]      more of the following options (valid values; default):\n"
    -"                        preset=PRE reset options to a preset (0-9[e])\n"
    -"                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=NUM     number of literal context bits (0-4; 3)\n"
    -"                        lp=NUM     number of literal position bits (0-4; 0)\n"
    -"                        pb=NUM     number of position bits (0-4; 2)\n"
    -"                        mode=MODE  compression mode (fast, normal; normal)\n"
    -"                        nice=NUM   nice length of a match (2-273; 64)\n"
    -"                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  maximum search depth; 0=automatic (default)"
    -msgstr ""
    -"\n"
    -"  --lzma1[=OPCJE]     LZMA1 lub LZMA2; OPCJE to oddzielona przecinkami lista\n"
    -"  --lzma2[=OPCJE]     zera lub więcej następujących opcji (w nawiasach wartości\n"
    -"                      poprawne; domyślne):\n"
    -"                        preset=PRE ustawienie opcji na predefiniowane (0-9[e])\n"
    -"                        dict=ILE   rozmiar słownika (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=ILE     liczba bitów kontekstu literału (0-4; 3)\n"
    -"                        lp=ILE     liczba bitów pozycji literału (0-4; 0)\n"
    -"                        pp=ILE     liczba bitów pozycji (0-4; 2)\n"
    -"                        mode=TRYB  tryb kompresji (fast, normal; normal)\n"
    -"                        nice=ILE   długość dopasowania (2-273; 64)\n"
    -"                        mf=NAZWA   dopasowywacz (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=ILE  maks. głębokość szukania; 0=auto (domyślne)"
    -
    -#: src/xz/message.c:1194
    -msgid ""
    -"\n"
    -"  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
    -"  --powerpc[=OPTS]    PowerPC BCJ filter (big endian only)\n"
    -"  --ia64[=OPTS]       IA-64 (Itanium) BCJ filter\n"
    -"  --arm[=OPTS]        ARM BCJ filter (little endian only)\n"
    -"  --armthumb[=OPTS]   ARM-Thumb BCJ filter (little endian only)\n"
    -"  --sparc[=OPTS]      SPARC BCJ filter\n"
    -"                      Valid OPTS for all BCJ filters:\n"
    -"                        start=NUM  start offset for conversions (default=0)"
    -msgstr ""
    -"\n"
    -"  --x86[=OPCJE]       Filtr BCJ x86 (32-bitowy lub 64-bitowy)\n"
    -"  --powerpc[=OPCJE]   Filtr BCJ PowerPC (tylko big-endian)\n"
    -"  --ia64[=OPCJE]      Filtr BCJ IA-64 (Itanium)\n"
    -"  --arm[=OPCJE]       Filtr BCJ ARM (tylko little-endian)\n"
    -"  --armthumb[=OPCJE]  Filtr BCJ ARM-Thumb (tylko little-endian)\n"
    -"  --sparc[=OPCJE]     Filtr BCJ SPARC\n"
    -"                      Poprawne OPCJE dla wszystkich filtrów BCJ:\n"
    -"                        start=ILE  offset początku konwersji (domyślnie=0)"
    -
    -#: src/xz/message.c:1206
    -msgid ""
    -"\n"
    -"  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
    -"                        dist=NUM   distance between bytes being subtracted\n"
    -"                                   from each other (1-256; 1)"
    -msgstr ""
    -"\n"
    -"  --delta[=OPCJE]     Filtr delta; poprawne OPCJE (poprawne wart.; domyślne):\n"
    -"                        dist=ILE   odległość między bajtami odejmowanymi od\n"
    -"                                   siebie (1-256; 1)"
    -
    -#: src/xz/message.c:1214
    -msgid ""
    -"\n"
    -" Other options:\n"
    -msgstr ""
    -"\n"
    -" Inne opcje:\n"
    -
    -#: src/xz/message.c:1217
    -msgid ""
    -"  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
    -"  -v, --verbose       be verbose; specify twice for even more verbose"
    -msgstr ""
    -"  -q, --quiet         pominięcie ostrzeżeń; dwukrotne podanie pomija też błędy\n"
    -"  -v, --verbose       więcej informacji; dwukrotne podanie to jeszcze więcej"
    -
    -#: src/xz/message.c:1222
    -msgid "  -Q, --no-warn       make warnings not affect the exit status"
    -msgstr "  -Q, --no-warn       ostrzeżenia nie mają wpływu na status zakończenia"
    -
    -#: src/xz/message.c:1224
    -msgid "      --robot         use machine-parsable messages (useful for scripts)"
    -msgstr "      --robot         komunikaty w formacie dla maszyny (do skryptów)"
    -
    -#: src/xz/message.c:1227
    -msgid ""
    -"      --info-memory   display the total amount of RAM and the currently active\n"
    -"                      memory usage limits, and exit"
    -msgstr ""
    -"      --info-memory   wyświetlenie całkowitej ilości pamięci RAM oraz aktualnie\n"
    -"                      aktywnych limitów pamięci i zakończenie pracy"
    -
    -#: src/xz/message.c:1230
    -msgid ""
    -"  -h, --help          display the short help (lists only the basic options)\n"
    -"  -H, --long-help     display this long help and exit"
    -msgstr ""
    -"  -h, --help          wyświetlenie krótkiego opisu (tylko podstawowe opcje)\n"
    -"  -H, --long-help     wyświetlenie tego długiego opisu i zakończenie"
    -
    -#: src/xz/message.c:1234
    -msgid ""
    -"  -h, --help          display this short help and exit\n"
    -"  -H, --long-help     display the long help (lists also the advanced options)"
    -msgstr ""
    -"  -h, --help          wyświetlenie tego krótkiego opisu i zakończenie\n"
    -"  -H, --long-help     wyświetlenie długiego opisu (także opcje zaawansowane)"
    -
    -#: src/xz/message.c:1239
    -msgid "  -V, --version       display the version number and exit"
    -msgstr "  -V, --version       wyświetlenie informacji o wersji i zakończenie"
    -
    -#: src/xz/message.c:1241
    -msgid ""
    -"\n"
    -"With no FILE, or when FILE is -, read standard input.\n"
    -msgstr ""
    -"\n"
    -"Jeśli nie podano PLIKU lub PLIK to -, czytane jest standardowe wejście.\n"
    -
    -#. TRANSLATORS: This message indicates the bug reporting address
    -#. for this package. Please add _another line_ saying
    -#. "Report translation bugs to <...>\n" with the email or WWW
    -#. address for translation bugs. Thanks.
    -#: src/xz/message.c:1247
    -#, c-format
    -msgid "Report bugs to <%s> (in English or Finnish).\n"
    -msgstr ""
    -"Błędy prosimy zgłaszać na adres <%s>\n"
    -"(w języku angielskim lub fińskim).\n"
    -"Błędy w tłumaczeniu prosimy zgłaszać na adres\n"
    -".\n"
    -
    -#: src/xz/message.c:1249
    -#, c-format
    -msgid "%s home page: <%s>\n"
    -msgstr "Strona domowa %s: <%s>\n"
    -
    -#: src/xz/message.c:1253
    -msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
    -msgstr "TA WERSJA JEST ROZWOJOWA, NIE PRZEZNACZONA DO UŻYTKU PRODUKCYJNEGO."
    -
    -#: src/xz/options.c:86
    -#, c-format
    -msgid "%s: Options must be `name=value' pairs separated with commas"
    -msgstr "%s: Opcje muszą być parami `nazwa=wartość' rozdzielonymi przecinkami"
    -
    -#: src/xz/options.c:93
    -#, c-format
    -msgid "%s: Invalid option name"
    -msgstr "%s: Błędna nazwa opcji"
    -
    -#: src/xz/options.c:113
    -#, c-format
    -msgid "%s: Invalid option value"
    -msgstr "%s: Błędna wartość opcji"
    -
    -#: src/xz/options.c:247
    -#, c-format
    -msgid "Unsupported LZMA1/LZMA2 preset: %s"
    -msgstr "Nieobsługiwane ustawienie predefiniowane LZMA1/LZMA2: %s"
    -
    -#: src/xz/options.c:355
    -msgid "The sum of lc and lp must not exceed 4"
    -msgstr "Suma lc i lp nie może przekroczyć 4"
    -
    -#: src/xz/options.c:359
    -#, c-format
    -msgid "The selected match finder requires at least nice=%"
    -msgstr "Wybrany dopasowywacz wymaga przynajmniej nice=%"
    -
    -#: src/xz/suffix.c:133 src/xz/suffix.c:258
    -#, c-format
    -msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
    -msgstr "%s: Przy --format=raw i zapisie do pliku wymagana jest opcja --suffix=.ROZ"
    -
    -#: src/xz/suffix.c:164
    -#, c-format
    -msgid "%s: Filename has an unknown suffix, skipping"
    -msgstr "%s: Nazwa pliku ma nieznane rozszerzenie, pominięto"
    -
    -#: src/xz/suffix.c:185
    -#, c-format
    -msgid "%s: File already has `%s' suffix, skipping"
    -msgstr "%s: Plik już ma rozszerzenie `%s', pominięto"
    -
    -#: src/xz/suffix.c:393
    -#, c-format
    -msgid "%s: Invalid filename suffix"
    -msgstr "%s: Błędne rozszerzenie nazwy pliku"
    -
    -#: src/xz/util.c:71
    -#, c-format
    -msgid "%s: Value is not a non-negative decimal integer"
    -msgstr "%s: Wartość nie jest nieujemną liczbą całkowitą"
    -
    -#: src/xz/util.c:113
    -#, c-format
    -msgid "%s: Invalid multiplier suffix"
    -msgstr "%s: Błędny przyrostek mnożnika"
    -
    -#: src/xz/util.c:115
    -msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
    -msgstr "Poprawne przyrostki to `KiB' (2^10), `MiB' (2^20) i `GiB' (2^30)."
    -
    -#: src/xz/util.c:132
    -#, c-format
    -msgid "Value of the option `%s' must be in the range [%, %]"
    -msgstr "Wartość opcji `%s' musi być w przedziale [%, %]"
    -
    -#: src/xz/util.c:257
    -msgid "Empty filename, skipping"
    -msgstr "Pusta nazwa pliku, pominięto"
    -
    -#: src/xz/util.c:271
    -msgid "Compressed data cannot be read from a terminal"
    -msgstr "Dane skompresowane nie mogą być czytane z terminala"
    -
    -#: src/xz/util.c:284
    -msgid "Compressed data cannot be written to a terminal"
    -msgstr "Dane skompresowane nie mogą być zapisywane na terminal"
    -
    -#: src/common/tuklib_exit.c:39
    -msgid "Writing to standard output failed"
    -msgstr "Zapis na standardowe wyjście nie powiódł się"
    -
    -#: src/common/tuklib_exit.c:42
    -msgid "Unknown error"
    -msgstr "Nieznany błąd"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard input: %s"
    -#~ msgstr "Błąd podczas ustawiania O_NONBLOCK dla standardowego wejścia: %s"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard output: %s"
    -#~ msgstr "Błąd podczas ustawiania O_NONBLOCK dla standardowego wyjścia: %s"
    diff --git a/external/public-domain/xz/dist/po/vi.gmo b/external/public-domain/xz/dist/po/vi.gmo
    deleted file mode 100644
    index 149030a7a9422ab361d1ec5877ebeff8cec876fe..0000000000000000000000000000000000000000
    GIT binary patch
    literal 0
    HcmV?d00001
    
    literal 27593
    zcmchfd5~RKedjMrASeS2W{HykIhY8wOuu$(wcT>tmRegQsntj=8)F>n_3PLDE_zGz
    z7D;WwU?C=s<1pAU24tH;vT+jiuQ8-onMcl
    z4})*|jVRg$eiBr9=hM@RcA#jNTIPI&dA=c~IlI
    zGvH$&Q;xm~UJm{UyaIgvJEDlwXbe>UF{t|=1P8$yQW4{@tL)@ilNe_}3s^MsI=Xe;M2ZYTlEe);|Wffu}*u^Q+)h;Qs>E{}vio
    zdu0$&i0%NHdh{Tud3+tzy1tgqAz8E`;7y?T_!Ox6OW;ev?}3ux{{V_V)^MSIUklP@
    zv>&`4ybaVimO#nJKY>(zRjX~4?@4uXhWv=w9tqnp6jgC7O8
    zE}sV94SpZg^Ff&QdhkY2^!zmVGH?-m{v}cL74XgAX%^)^9-O@r-h-f9Sv;-ZC`@w*
    zTmT*TZBTsm_u%`$mqEm@gGa&df$z93iY939e}h`b{o8}S0jIb>xFd?b#Qjra@GAXW
    z4Y5C@a=X3W`FG$Eu77(^6nznV7W@G9-oF=K!fcflWk
    ze*r$VKZ^bjc3TLJ$w_*S034C0}hqRT*7BiaqV1v~-j
    z`F-Hqz-PhB!0&;d1^);5o8TFUrE<@Kl83(nnQHVCkf}sl4tqZN5cnpp?*hfI4}q%p
    zD2NC~FMyJhe*~`w*H3x*ct0q9z8Aa}{I>x`G?lv!RQ=mQ>4_)7UEnuCjpMa9c=Uj&?4E`~w{{JI*CHO1vL3Y70@F@5#@D1SLO{^if
    z9aQHgFU8B&hNJ9oPWhfpU5sct0rmJPB&v-vXI>v<4=G
    zWujZb)8HS09|kYK#gF%Ku+H@lz#ZTr1~m%a2WlPv5)@tjE4UuK`c^N$1yFRT2D~3+
    zNYM)c-*(iG|93#99DNg1{mWp|OTqo%2v`J*;8_rr8NFiK({mFjdd`A089e}Q0sk3%
    z1-PN$>3J2X>oXv%9GwOK5d3ktJ~iY0f$xH9=TbV`3Z4W-@29{j_#^Oo@Wxp`|4)Nj
    z*YAO^0be!e>3S)sdE5wI0-ge24SpivLjj)-_?3X)4*30mKMMHY0=~TD+qop53pfOd
    z&ewn%ZwY({cn&-Pegm8buaCVx`aCFl|2=pOxcmKHpPdF@!u35Is;8g$3b8kRt!w=x
    zYo|Cw>*TkSlivy#47ck?H|CGs2L2AmeH_BK_V&|Se~?46G-h}FAL*Xga=e}6a*mgA?B+Pl0qdHs1)_@n@LSKZ*3P`X
    z2&X2~I+xDS?_C@pw=@6e)4;EDNGDy&Azg4ghvWDp$1ibQ!tp+iKF2#a{($3Nj*oHt8xB;V
    z$;=%v;45_x-1%yFm!r(_dmImPJk4<*&j9GGjXFiI&tIxPj#BF7K(1V*gR1z
    zR^9YMv)JG&uFkneYr0v_7n;SHzD;F1n61|;u9z>BT&-Cu*4@B{+{P_ix48}L{fx@D
    zRq`9UX0-pk2exl;wYt;E#%+E!al_?Zp;oEnbB*GBzMiLhS7w;5HtTLH)@xKS3aPz~
    zUF}tB^`c7Ay_>C-%e51lMQy$r*Q$-5o=o%gVx!m`ojkP5*;(3Bv&InpQ#UZ2yZYwh
    zE$jPIXeKUnh+WW7^7RGRh;J*pfzA8k9WLiKY}vH+K)hp{yNbX4TPhdAqB&P>Ri+^^
    zb1lcPL%s~fs?FlbrkjqNOm#T7d7ImGfu`m!(A0db5o?^;wubw+H9y^>tzK#J36ub0K;*i(rjFv5mT26n+9E}uzAo;H#h1Jm(xwC&7c0w
    z%@pUGB|oZ4{$yNfRa~Q(uQM2Xvds;T=3C7gP(!kx>~io;H$>@t(!CT
    zpu+g}+}6!*U>t1`w<_y1O;}&~dZoL(+kWUkrjQ$eQJdxB>aM8SEWys5>eS3l>DEQn
    zZ=fTxb9Cox)nP=m|7VT~c_wSQqai
    zgkc#+hot~_iH#&g-Sd`VpErIFD{HQAU#D*_feO^9M~qXF9wwMntMLw|jj5u0d(!6D4ect{nO}
    zH;4kv&p4TinS6c5#nt&%b7)N@@erp?murP%IVtJU!{hJWb+`}3J-PC(T0G%~PTuCM
    zn#<2J4b$0k%%r+f_xEWlM%~phc@0T+tC|oJTQQSw<|B=(Gcsvg8(E*mE;O(r3%cMm
    ztzaAJ&*s0aPh+h{k=Z~t%!K$t*2vG)l)l)cSrR=NYcgyYCbAJj%-M3QQOY&rO0m{z
    zj!umq*mdy8RG+?VnbJn8bAv9PMQdUPnIQ^tpQ6TyVaGO@D@Y1*xdcby}*<)^e31!(4!{xHEnbYX}^Ue&?61f9|utHKIz3q9V`>%Lx^?+8Yi$N?+G7h+H
    zu+Pk3&S~7YZO(?OWkU0qPdMn-O4Oj1DTra~AgH)TO7?0km!Ek*+RMfWGiLgfG&JFW
    z24pG}S$R=>^~n1TP1*q>yJEf0DC26QDV-#{ZXJrX)L`1lOzlMV1lp==aIzN2r+zav
    zG+xsc;OHjR`~xZIhSz=>dR6BjSMIQuq|ut4jZcma9X_&~HoUA;+wQufy1foNnogTp
    zT9bj?NVht;c~q(uzuwfUZdLOY`bA^R*J}m5A7|dQN^O%!2Tj~>(O^Kl=~ZoEZPVH=&(uRVwR&VtQLSEs75xQ&Md}LC1^woCeo_pHxf}&`d7tTYc%6b>B8kc++9?!FTTU0T
    zUd7;OT$#K2Z4rapEwS)E&FJm}QyQGONJ}9%hw4SlGmbn>tDl+TwhrBV(CT2IQBpa;=CRS|<s%9y%s66fb`6c5a46Jw=B#3F0*9H8F*bR`$r+v*&~@4FYOKMn>&vbK`^OY_ZZ_wN|CwGeK6#N_9%Sk3wgyfe$e;MEZ$cuk-g5Dl$QmKv9-dd%7?
    zsI5kGhSEt}z6BU0jW$A4Y9%|c?6@?W52!8H8Fwi8HCpqQOGsr80huor%$+=;_Q@&=d%A0y7eQfL
    zgBPc;Z*9_#AtFa&>uIC(kNE2cfm)6NXJDQuI4
    zH?mA?8$%ac9PfwRANh3(tpxdnFMNxMy#XRJl(;D;rT8LU}Sk!
    zN+rx^U-7(AEFR0Yl0M$8vFFRGzo1~=9bMa47b1{B*Ekl>&r{E4ZADdtdAE37fSTfL
    zjx*&8Iqh4XJmj&33zcGxik121LZ=@FT(Jt%wL0M(YRM|NDAvkjk+u2nr&
    zh1Pv1L2#gGAr2C%wH{Xr%9|HW&=jxbJaFu2mL!#o%!>JqSMfKQeZD@|k~1LvpUqy`
    zWRgP3!h}(EJ*)77C7v&nQ0w*7+gPU=cGU{^&FA$G^sZwD&!o^qU9B9f9yS&#)3q|0
    z!ydDlkRJ)7&$Y_=x{+c<3lrT@)+|0eL7XystC(*a4&ed@ZlTsfn)9ACautszG2J>$
    zN*Zz}ch_BK^Een@u_Q6$QB8f+=D7|jCAfmw2--SPB<8A;_o8_SM)pB{%HoFu?|Z@V
    zL&j}1ai}E`JH+Y4>}l1hTFv{m$r>9=u3BUjYw$jyEEZti`S3z5v41wLBh}(b+y#Zc
    z&u5IiCQ=
    zQHYt3uUxEKdCTgiu^B;<+<CaACUQeolxXxJ6PdkZZh
    z{EBQ_EaS?&G;%nwCg$X@x;S9FWsE4S7msTTh+y}NIZM6-^9Fx(&P4bNCa=UKzIc>&
    zVi}XvrAT6~qz~Ude}9^`gOS4x#7f4E68_IzmDMNdJ5$D)iBc@klEf)rpt$&}i3VcA7bp*75`5NM^Ubs=^HCK7q+YV_
    zSn!^tiWI$SR2@-TC^m{h;~$0GcUb$v{fsm$VFLrijUybj*FeR6Ww#7^s1v`&}v
    zMJjd;H(Sr7)%x3=(O;rA)~hyG#r>U$#`RK0d}x}&4NSM@)<^y=e}`dAO4C%LiMjOgqM+IdaRS}-&mbQYo3sz)I}
    z$Yk)PlC#MObJY8l>taGm_9{nLjE0!}gf%TK;9qe0v6xRbKh&!xB1IBwCYq@6Z>2fV
    z8}Q_%h?d*9EHxQas1~DxN>|7cvWJjfg6bpR7{)i^9}R|`bT#>_a521YC^}S>9U@%|
    z!@>b_uiXF|bQeifsTzv!j;mEp*F$Oo3B0}#D-uLx6h&7g;j-}_<#xkG<{%wrG|K9d
    zy@yRfGPPbuGE&k>ZmfB@q)_9JEFz+2c9aFPD`sR*%Q^
    zTGedI@q9g2h$1zj%@=s5e!(rXmUyW1Axj(lal_
    z=1U8_t44}LSU12spY=pnR<1D;O)=J^%-W~W)){x3|D8!E3`MJ*CvWhN1Yh4&1f|R=
    z%5B)tIo;Sf-PAeV+&SHno_30MN_L)ZP0L-Go?VrmUCmj?QrKEwp}!l$%9ygt7U^05
    zq##@e)zj5luY1ZoYbjD$Whu#hyofy8%K#0<-OOe$xc3&l3b@(cA91!OkvEBDM=RM2
    zBTGk!(>gkKXw91Fhy|zV1|}pM&(KR6Tt(nbuD?!XP3(=sNwnlW#vJYx*wsc|DMNR3Pq?#bc>PdxW7eCL+9oaw={)Z@MmH53(PX{$e%$Qb_)PAG
    zBol+Xw`FL<&}M`pzs9Si+<^w6Yi|Arh
    zSC0&Dedq9%l-rLpnVYKTtBtY@)QFp^FE2h?brW;TOCKw^cemOPRoykmt0&^}4B~(N
    z94~{)jI44kRjYF?sF|DM-P4G>f%K%*9+A~G?5(o~)jRJpE4kzG^-9Y%h8nCuLGN1T
    zibK_6v(w6mJ07n&z?Ogxp*9Q+!vq-KDnqoF8`=kU1+Tl~>Nb1FMw~x-WNLTrs!loe
    zJX@^icA-OjR_ZD;0&6DAtb94Q8+%NMU7fef#whO<{ORcMwl(j`P1cGtaWlt`7Gk<)
    zX@r+kS7_4;3SsrG#p&gxGp=l8vJH&=()eTTQ)9WQ_L-Y30apHzf^F~-^2ZC>BaUt9$sF$TdA&NrP}i1!w@+7gljG@J;Bso^jBrPPx)43`cQLyHb9O|jfEYZ7Jh8NXkv**&p);pvvEwjZlrSaYjc|VKlL`rq%G$f
    z48={i&o^BaS$)bCwDu);{CV1)*7-&4mF(5tadBg_-afy&u?ugOyl`WF>*kAXl|)7s
    zzjEvIcP}q}npeT4<;Aa>7@P?N{~2~nCZoa?TV6WVax?9-vHRie4{9x&KfL`jP|ma7
    z^3ntI7rTXWs{Q*DCOM`Bn(Zem@UCy5^mFW^3}dY*UKx)5VrKEF*r_4!KzK!&p=Ljq$8$i+
    zE|}+P`|N@($7!S9m)M;qYbc!w@lsxD!qJOgC5KjTKUpoM)9MQTMyK{JFFiPZ>z?uL
    z6SvBxdaw^&kCh}Yc&SDsUe?gGISCKT16q7Ib{}Zvow*aMn)Dk>bGT;@_1h?Q4B7MM
    zyo^XzZCbbudfee!I1T(v!1?cO7qY*&*Q-KcmHmq~^m(A!>)KHn@7()gISA
    zB$g8ArGwe4Oz@F1P51s+FH2_m3i7AIw9OzKwDjq@au&hVf`AV9bF2;=Z(
    z(}yjLp(QB}cC=3?!MZ9&Z!bb@Su-?8s+Nv1R_zdMFA|w9o7p?&r}TLU`UPsR?hnM>
    zG-B&*I`~_RtypEHPDMa0VDeT^RcFnS-+r?842mrl1l
    z1QXve?jveIyN0b>xdG=zBvw)amC&f~{$VQH4&r2Jwu{)B>W)cq*s(B__8W>R5i#5z
    zTZ$n>#q5xYWJqgFw^7$YyDeLy1A$*&`Yb~fUzyA3mkYH5i>Dqzu4~tEh_A!4OJSRf
    zXslxe{_k;fL@yAmiW(z6Bkb~Ciliyg!=gEHp;@&=__R-1UUENg
    zKheEjc`jIdWyUILV1@K%#8b2Fv0=DtwqnJHB}t2lgiIvKcrg>^1CRDuhBVe+Ub=%I
    zt^Ihgri|lbdR0U7d5bcgt6!`kOWb(AX99S
    z4cCymN9M&M{dQBchQy@aoD4t?bE;0F1=nZX2_uvD7c`L`+pDLsb!UhM&@#kDf4sUb
    zKA?D;JUK&+*PG_|D_J)7H#@J!3$_EOYrnNxrG6NN;+kyiZ|w$+qJgjOn~rN@&>q{b
    zlX_$k9wC&K$Cy!6{RG9^dQnT}1ovG8#Ho|-W)g^Xs+jwV{=-<}IckAS_n8l@iT2pO
    zjmlBh+{%&VWS(-c_-e*Gr(ON92`=d&DQLp2iT2pj-F|GI_vN-o!RYqd(VZ!k5pIpP
    z$EI#GM*RX!AEtCnY|?4ZecmfX+fzY~yd}9hjgXsRdi!wB?ukRfGqr4{7)^SY$v`OMAItMHF@8V{^C){sli%8OXZU2+TwsNh9pbXo-VX9*?=oJ3
    z-pFbzIp*-5j!a~m)Kg6j?qzOTq0ZA#d7otsSla4h?#Z&zH-rn%+xgWWp$AkH?Vkxhv~7JA4{_=tzLJBbweklK*`^R!_shU`4W{xZ5vrDzSiBa};%5_^pRBx`K(@*5@ua=wUo|M
    zy+qbB3`%sYZeS0ivRAX@8|3;bStrxDYJjT?TFc$>bUK}trDxQCNZwnf#@@Dt(XH-m
    zD(PP1d008VFM76+uinW!tZhh`E#48~6(ic>bgKLOkWt>=9EQ#FA#e#B=wGY>U(;`+
    zzff8EZ3@wWPla9k-6O&HDObsijOQ{$8BARLkU2=1$ZA61y2Hw
    z4zG-CihDZ?+s#r5VfvRxq?DzQ_U_&Gln;nIug-fH+mi`h?FDJpKkQv)pH~23(WHz#
    zm71t3ojy|NL7n|+v5ZHj(x)mtO0VvsnF@!xAz9IL4ZH*@JtQl~%M<&8z>D~@CE&Z5
    ziqsVgZVXBl;
    zz@%F5kId2Je={jzQ+m8EGS0!@KzDgn^0Vn55d~g0<4@2XmN2DqCrO$%&n}^JsdT98
    ze%$Uy2mviMtbG2*ZK#y@$+FI3>V4V@Cf_HoHlz(Z1tA13xb{GN#+nZ+ohh4@<4kFm
    zDj}5j;JYQw8Vl^^J)X!e2OkvOYbx
    zQ848NvL6*bg0~MSOs(T2e#$=%A4G&<(?>!f&#lr~+8WbQx?S;F6sk+i?zCLnIeQbk
    zbcO-<%(IJyy1ued0xG3X`k95bCvo>#-X!;d%95ySC9o`v?L7a7im`T+jk3x-+kbsy
    zAD>2JYJ`~1Jl-%5dDGS8I}E$G*1U0X@L9@+D^31%vX=c{on*73&^7V*HALS~ItF8y
    z^tD@eLd(;b3Y{_h!uk)g;;E=$Leh!~<=uh}xby0QWNc8wQCFqF2N{3=MR+1B!X1t9
    zB7C&dG8f(onD?OwCRqSK`Y;e{D4B^dv*&>5BAN)obMdvUec0&Z_(~R+DDRPp9D;^S
    zz6jyH>=PISOrA0v_QtIsxeYQk6!}OL6UyXF@O?B9xUR!OL(vWem5}eLX5@W?RM&UA
    za4XF5N~e|m#md&4|{}{UVO;~&EfG}kZSKm{O4y@i`;3v^x
    zdJF#~8a{Jz(N!|?IC4>yq@T^%fvT2L?QE0EzBjj#`5Bo?B1{;Hp1+&W2y?f1t|Bk&
    zo)x<$(DUb$SB;&S1&x|0RuR3o=i#NfYt1#rzFR=xclIBpqM7t#man6MR=l}SiyOf^
    z-mqNS@H!~tLJviI+Yj@#h~D*}8~DOVzJpcu-|7UX*YcZi$982={Y$q=hK`wLPdcCO
    zOnJwslQ$Ka?&7@$WF>7;YBuLbuDF6sTe3-=|F1>c^tHwQ3hh_F;&?n%YF5hE!g@)T
    zhs@5(JfW#+Wqh)_Hj^5&w4a_&B?=8A9m4)b$faa*6WX`2!d$bi?D^BC2gua*jS$T7
    zk(=E9_U&$R@3=Oj?pR)YXo8FOsVO&gXq;Dn6Yd5cPqgoK`}Vd!F|kJv&$zwIOAk%D
    z8?+zBAt|35Bcav)*w|hYern)7N0t{qHznrl7IpicDEMBfmGOq%^R0bm677)LCyU*F
    z7B!ywlNcRUWgAp*{IS05#LZ}f)p|rJ5tfYY9F}4??z8?`^z;>O$8EDn-!@@sSBNQB
    zoE)FIHpQ8JU&gm-EB7`^P!nNz;c1ovr?O-t@TzYm{il59x7*p`TO?U+zC{X6rIxwN
    zvE#!eUwfuSH>s=E5n|JOI8Vf$;S(jkQSwy~Lmb`_FDcMtku3@=z#UKp@q*C)+a(E@
    z$a~tIERtXgnK@G9oIYN`J6KktE4xdA(rLCM6D39agABfaqv6vjFfkXl(oMc@%3f{k
    zy4uurwYlqRi@&a43ZohYw;K3y3$b1!*
    zwW664o~e6MF8nzh(9#wYZMl)e-v
    z?XC|m8+@5>|E~i7`4EH;|G9GbzXa1AhC@oY(3*G`;~1-%a{&>+}WUI{z^v
    z-?o~_@+~^%qUdg3%T~Ty0*N(TR4x5?ZJITI{tS%T`6MB@6gW&(mx=oEDcFe#vE)SA
    umk{^yH
    
    diff --git a/external/public-domain/xz/dist/po/vi.po b/external/public-domain/xz/dist/po/vi.po
    deleted file mode 100644
    index b80956558..000000000
    --- a/external/public-domain/xz/dist/po/vi.po
    +++ /dev/null
    @@ -1,970 +0,0 @@
    -# Vietnamese translations for xz package
    -# Bản dịch tiếng Việt cho gói xz.
    -# This file is put in the public domain.
    -# Trần Ngá»c Quân , 2014.
    -#
    -msgid ""
    -msgstr ""
    -"Project-Id-Version: xz 5.1.4beta\n"
    -"Report-Msgid-Bugs-To: lasse.collin@tukaani.org\n"
    -"POT-Creation-Date: 2015-02-26 16:55+0200\n"
    -"PO-Revision-Date: 2014-09-25 09:06+0700\n"
    -"Last-Translator: Trần Ngá»c Quân \n"
    -"Language-Team: Vietnamese \n"
    -"Language: vi\n"
    -"MIME-Version: 1.0\n"
    -"Content-Type: text/plain; charset=UTF-8\n"
    -"Content-Transfer-Encoding: 8bit\n"
    -"Plural-Forms: nplurals=1; plural=0;\n"
    -"X-Poedit-Basepath: ../\n"
    -
    -#: src/xz/args.c:63
    -#, c-format
    -msgid "%s: Invalid argument to --block-list"
    -msgstr "%s: Äối số cho --block-list không hợp lệ"
    -
    -#: src/xz/args.c:73
    -#, c-format
    -msgid "%s: Too many arguments to --block-list"
    -msgstr "%s: Quá nhiá»u đối số cho --block-list"
    -
    -#: src/xz/args.c:102
    -msgid "0 can only be used as the last element in --block-list"
    -msgstr "0 chỉ có thể dùng như là phần tử cuối trong --block-list"
    -
    -#: src/xz/args.c:406
    -#, c-format
    -msgid "%s: Unknown file format type"
    -msgstr "%s: Không hiểu kiểu định dạng tập tin"
    -
    -#: src/xz/args.c:429 src/xz/args.c:437
    -#, c-format
    -msgid "%s: Unsupported integrity check type"
    -msgstr "%s: Không hỗ trợ kiểu kiểm tra toàn vẹn"
    -
    -#: src/xz/args.c:473
    -msgid "Only one file can be specified with `--files' or `--files0'."
    -msgstr "Chỉ được đưa ra má»™t tập tin cho “--files†hay “--files0â€."
    -
    -#: src/xz/args.c:541
    -#, c-format
    -msgid "The environment variable %s contains too many arguments"
    -msgstr "Biến môi trưá»ng %s chứa quá nhiá»u đối số"
    -
    -#: src/xz/coder.c:110
    -msgid "Maximum number of filters is four"
    -msgstr "Số lượng bá»™ lá»c tối Ä‘a là bốn"
    -
    -#: src/xz/coder.c:129
    -msgid "Memory usage limit is too low for the given filter setup."
    -msgstr "Mức giá»›i hạn dùng bá»™ nhá»› là quá thấp cho việc cài đặt bá»™ lá»c đã cho."
    -
    -#: src/xz/coder.c:159
    -msgid "Using a preset in raw mode is discouraged."
    -msgstr "Dùng hiện tại trong chế độ thô là ngớ ngẩn."
    -
    -#: src/xz/coder.c:161
    -msgid "The exact options of the presets may vary between software versions."
    -msgstr "Các tùy chá»n trích xuất cá»§a chỉnh trước có thể biến đổi phụ thuá»™c vào phiên bản."
    -
    -#: src/xz/coder.c:184
    -msgid "The .lzma format supports only the LZMA1 filter"
    -msgstr "Äịnh dạng .lzma chỉ há»— trợ bá»™ lá»c LZMA1"
    -
    -#: src/xz/coder.c:192
    -msgid "LZMA1 cannot be used with the .xz format"
    -msgstr "LZMA1 không thể được dùng với định dạng .xz"
    -
    -#: src/xz/coder.c:209
    -msgid "The filter chain is incompatible with --flush-timeout"
    -msgstr "Móc xích lá»c là không tương thích vá»›i --flush-timeout"
    -
    -#: src/xz/coder.c:215
    -msgid "Switching to single-threaded mode due to --flush-timeout"
    -msgstr "Chuyển sang chế độ đơn tuyến trình bởi vì --flush-timeout"
    -
    -#: src/xz/coder.c:234
    -#, c-format
    -msgid "Using up to % threads."
    -msgstr "Dùng đến % tuyến trình."
    -
    -#: src/xz/coder.c:247
    -msgid "Unsupported filter chain or filter options"
    -msgstr "Không há»— trợ lá»c móc xích hay tùy chá»n lá»c"
    -
    -#: src/xz/coder.c:255
    -#, c-format
    -msgid "Decompression will need %s MiB of memory."
    -msgstr "Giải nén sẽ cần %s MiB bộ nhớ."
    -
    -#: src/xz/coder.c:290
    -#, c-format
    -msgid "Adjusted the number of threads from %s to %s to not exceed the memory usage limit of %s MiB"
    -msgstr "Chỉnh số lượng tuyến trình từ %s thành %s để không vượt quá giới hạn tiêu dùng bộ nhớ là %s MiB"
    -
    -#: src/xz/coder.c:344
    -#, c-format
    -msgid "Adjusted LZMA%c dictionary size from %s MiB to %s MiB to not exceed the memory usage limit of %s MiB"
    -msgstr "Chỉnh cỡ từ điển LZMA%c từ %s MiB thành %s MiB để không vượt quá giới hạn tiêu dùng bộ nhớ là %s MiB"
    -
    -#: src/xz/file_io.c:89 src/xz/file_io.c:93 src/xz/file_io.c:101
    -#, c-format
    -msgid "Error creating a pipe: %s"
    -msgstr "Gặp lỗi khi tạo một ống dẫn: %s"
    -
    -#: src/xz/file_io.c:179
    -#, c-format
    -msgid "%s: poll() failed: %s"
    -msgstr "%s: hàm poll() bị lỗi: %s"
    -
    -#. TRANSLATORS: When compression or decompression finishes,
    -#. and xz is going to remove the source file, xz first checks
    -#. if the source file still exists, and if it does, does its
    -#. device and inode numbers match what xz saw when it opened
    -#. the source file. If these checks fail, this message is
    -#. shown, %s being the filename, and the file is not deleted.
    -#. The check for device and inode numbers is there, because
    -#. it is possible that the user has put a new file in place
    -#. of the original file, and in that case it obviously
    -#. shouldn't be removed.
    -#: src/xz/file_io.c:249
    -#, c-format
    -msgid "%s: File seems to have been moved, not removing"
    -msgstr "%s: Tập tin có lẽ đã bị di chuyển, không phải gỡ bá»"
    -
    -#: src/xz/file_io.c:256 src/xz/file_io.c:769
    -#, c-format
    -msgid "%s: Cannot remove: %s"
    -msgstr "%s: Không thể gỡ bá»: %s"
    -
    -#: src/xz/file_io.c:281
    -#, c-format
    -msgid "%s: Cannot set the file owner: %s"
    -msgstr "%s: Không thể đặt chủ sở hữu tập tin: %s"
    -
    -#: src/xz/file_io.c:287
    -#, c-format
    -msgid "%s: Cannot set the file group: %s"
    -msgstr "%s: Không thể đặt nhóm tập tin: %s"
    -
    -#: src/xz/file_io.c:306
    -#, c-format
    -msgid "%s: Cannot set the file permissions: %s"
    -msgstr "%s: Không thể đặt chế độ Ä‘á»c ghi cho tập tin: %s"
    -
    -#: src/xz/file_io.c:416
    -#, c-format
    -msgid "Error getting the file status flags from standard input: %s"
    -msgstr "Gặp lỗi khi lấy các cỠtrạng thái tập tin từ đầu vào tiêu chuẩn: %s"
    -
    -#: src/xz/file_io.c:470 src/xz/file_io.c:532
    -#, c-format
    -msgid "%s: Is a symbolic link, skipping"
    -msgstr "%s: Là má»™t liên kết má»m nên bá» qua"
    -
    -#: src/xz/file_io.c:561
    -#, c-format
    -msgid "%s: Is a directory, skipping"
    -msgstr "%s: Không phải là một thư mục nên bỠqua"
    -
    -#: src/xz/file_io.c:567
    -#, c-format
    -msgid "%s: Not a regular file, skipping"
    -msgstr "%s: Không phải là tập tin thưá»ng nên bá» qua"
    -
    -#: src/xz/file_io.c:584
    -#, c-format
    -msgid "%s: File has setuid or setgid bit set, skipping"
    -msgstr "%s: Tập tin có đặt bít setuid hoặc setgid nên bỠqua"
    -
    -#: src/xz/file_io.c:591
    -#, c-format
    -msgid "%s: File has sticky bit set, skipping"
    -msgstr "%s: Tập tin có bít sticky nên bỠqua"
    -
    -#: src/xz/file_io.c:598
    -#, c-format
    -msgid "%s: Input file has more than one hard link, skipping"
    -msgstr "%s: Tập tin đầu vào có nhiá»u hÆ¡n má»™t liên kết cứng nên bá» qua"
    -
    -#: src/xz/file_io.c:678
    -#, c-format
    -msgid "Error restoring the status flags to standard input: %s"
    -msgstr "Gặp lỗi khi phục hồi các cỠtrạng thái tới đầu vào tiêu chuẩn: %s"
    -
    -#: src/xz/file_io.c:727
    -#, c-format
    -msgid "Error getting the file status flags from standard output: %s"
    -msgstr "Gặp lỗi khi lấy các cỠtrạng thái tập tin từ đầu vào tiêu chuẩn: %s"
    -
    -#: src/xz/file_io.c:905
    -#, c-format
    -msgid "Error restoring the O_APPEND flag to standard output: %s"
    -msgstr "Gặp lỗi khi phục hồi cỠO_APPEND trên đầu ra tiêu chuẩn: %s"
    -
    -#: src/xz/file_io.c:917
    -#, c-format
    -msgid "%s: Closing the file failed: %s"
    -msgstr "%s: Gặp lỗi khi đóng tập tin: %s"
    -
    -#: src/xz/file_io.c:953 src/xz/file_io.c:1179
    -#, c-format
    -msgid "%s: Seeking failed when trying to create a sparse file: %s"
    -msgstr "%s: Gặp lá»—i khi di chuyển vị trí Ä‘á»c khi cố tạo má»™t tập tin rải rác: %s"
    -
    -#: src/xz/file_io.c:1048
    -#, c-format
    -msgid "%s: Read error: %s"
    -msgstr "%s: Lá»—i Ä‘á»c: %s"
    -
    -#: src/xz/file_io.c:1068
    -#, c-format
    -msgid "%s: Error seeking the file: %s"
    -msgstr "%s: Gặp lá»—i khi di chuyển vị trí Ä‘á»c tập tin: %s"
    -
    -#: src/xz/file_io.c:1078
    -#, c-format
    -msgid "%s: Unexpected end of file"
    -msgstr "%s: Kết thúc tập tin bất ngá»"
    -
    -#: src/xz/file_io.c:1137
    -#, c-format
    -msgid "%s: Write error: %s"
    -msgstr "%s: Lá»—i ghi: %s"
    -
    -#: src/xz/hardware.c:107
    -msgid "Disabled"
    -msgstr "Bị tắt"
    -
    -#. TRANSLATORS: Test with "xz --info-memory" to see if
    -#. the alignment looks nice.
    -#: src/xz/hardware.c:126
    -msgid "Total amount of physical memory (RAM): "
    -msgstr "Tổng dung lượng bộ nhớ vật lý (RAM):  "
    -
    -#: src/xz/hardware.c:128
    -msgid "Memory usage limit for compression:    "
    -msgstr "Mức giới hạn dùng bộ nhớ cho nén:     "
    -
    -#: src/xz/hardware.c:130
    -msgid "Memory usage limit for decompression:  "
    -msgstr "Mức giới hạn dùng bộ nhớ cho giải nén:"
    -
    -#. TRANSLATORS: Indicates that there is no integrity check.
    -#. This string is used in tables, so the width must not
    -#. exceed ten columns with a fixed-width font.
    -#: src/xz/list.c:65
    -msgid "None"
    -msgstr "Không"
    -
    -#. TRANSLATORS: Indicates that integrity check name is not known,
    -#. but the Check ID is known (here 2). This and other "Unknown-N"
    -#. strings are used in tables, so the width must not exceed ten
    -#. columns with a fixed-width font. It's OK to omit the dash if
    -#. you need space for one extra letter, but don't use spaces.
    -#: src/xz/list.c:72
    -msgid "Unknown-2"
    -msgstr "Chưa_biết2"
    -
    -#: src/xz/list.c:73
    -msgid "Unknown-3"
    -msgstr "Chưa_biết3"
    -
    -#: src/xz/list.c:75
    -msgid "Unknown-5"
    -msgstr "Chưa_biết5"
    -
    -#: src/xz/list.c:76
    -msgid "Unknown-6"
    -msgstr "Chưa_biết6"
    -
    -#: src/xz/list.c:77
    -msgid "Unknown-7"
    -msgstr "Chưa_biết7"
    -
    -#: src/xz/list.c:78
    -msgid "Unknown-8"
    -msgstr "Chưa_biết8"
    -
    -#: src/xz/list.c:79
    -msgid "Unknown-9"
    -msgstr "Chưa_biết9"
    -
    -#: src/xz/list.c:81
    -msgid "Unknown-11"
    -msgstr "ChưaBiết11"
    -
    -#: src/xz/list.c:82
    -msgid "Unknown-12"
    -msgstr "ChưaBiết12"
    -
    -#: src/xz/list.c:83
    -msgid "Unknown-13"
    -msgstr "ChưaBiết13"
    -
    -#: src/xz/list.c:84
    -msgid "Unknown-14"
    -msgstr "ChưaBiết14"
    -
    -#: src/xz/list.c:85
    -msgid "Unknown-15"
    -msgstr "ChưaBiết15"
    -
    -#: src/xz/list.c:153
    -#, c-format
    -msgid "%s: File is empty"
    -msgstr "%s: Tập tin trống rỗng"
    -
    -#: src/xz/list.c:158
    -#, c-format
    -msgid "%s: Too small to be a valid .xz file"
    -msgstr "%s: Là quá nhỠđối với tập tin .xz hợp lệ"
    -
    -#. TRANSLATORS: These are column headings. From Strms (Streams)
    -#. to Ratio, the columns are right aligned. Check and Filename
    -#. are left aligned. If you need longer words, it's OK to
    -#. use two lines here. Test with "xz -l foo.xz".
    -#: src/xz/list.c:671
    -msgid "Strms  Blocks   Compressed Uncompressed  Ratio  Check   Filename"
    -msgstr "Luồng    Khối          Nén     Giải nén  Tỷ lệ  Ktra    Tập tin"
    -
    -#: src/xz/list.c:711
    -#, c-format
    -msgid "  Streams:            %s\n"
    -msgstr "  Luồng dữ liệu:      %s\n"
    -
    -#: src/xz/list.c:713
    -#, c-format
    -msgid "  Blocks:             %s\n"
    -msgstr "  Khối:               %s\n"
    -
    -#: src/xz/list.c:715
    -#, c-format
    -msgid "  Compressed size:    %s\n"
    -msgstr "  Cỡ khi bị nén:      %s\n"
    -
    -#: src/xz/list.c:718
    -#, c-format
    -msgid "  Uncompressed size:  %s\n"
    -msgstr "  Cỡ sau giải nén:    %s\n"
    -
    -#: src/xz/list.c:721
    -#, c-format
    -msgid "  Ratio:              %s\n"
    -msgstr "  Tỷ lệ nén:          %s\n"
    -
    -#: src/xz/list.c:723
    -#, c-format
    -msgid "  Check:              %s\n"
    -msgstr "  Kiểm tra:           %s\n"
    -
    -#: src/xz/list.c:724
    -#, c-format
    -msgid "  Stream padding:     %s\n"
    -msgstr "  Äệm luồng dữ liệu:  %s\n"
    -
    -#. TRANSLATORS: The second line is column headings. All except
    -#. Check are right aligned; Check is left aligned. Test with
    -#. "xz -lv foo.xz".
    -#: src/xz/list.c:752
    -msgid ""
    -"  Streams:\n"
    -"    Stream    Blocks      CompOffset    UncompOffset        CompSize      UncompSize  Ratio  Check      Padding"
    -msgstr ""
    -"  Luồng dữ liệu:\n"
    -"     Luồng      Khối           BùNén       BùGiảiNén           CỡNén       CỡGiảiNén   Tá»·Lệ  Ktra           Äệm"
    -
    -#. TRANSLATORS: The second line is column headings. All
    -#. except Check are right aligned; Check is left aligned.
    -#: src/xz/list.c:807
    -#, c-format
    -msgid ""
    -"  Blocks:\n"
    -"    Stream     Block      CompOffset    UncompOffset       TotalSize      UncompSize  Ratio  Check"
    -msgstr ""
    -"  Khối:\n"
    -"     Luồng      Khối           BùNén       BùGiảiNén          CỡTổng       CỡGiảiNén   TỷLệ  Ktra"
    -
    -#. TRANSLATORS: These are additional column headings
    -#. for the most verbose listing mode. CheckVal
    -#. (Check value), Flags, and Filters are left aligned.
    -#. Header (Block Header Size), CompSize, and MemUsage
    -#. are right aligned. %*s is replaced with 0-120
    -#. spaces to make the CheckVal column wide enough.
    -#. Test with "xz -lvv foo.xz".
    -#: src/xz/list.c:819
    -#, c-format
    -msgid "      CheckVal %*s Header  Flags        CompSize    MemUsage  Filters"
    -msgstr "       GTrịKiểm %*s    Äầu  Cá»              CỡNén     DùngRAM  Bá»™Lá»c"
    -
    -#: src/xz/list.c:897 src/xz/list.c:1072
    -#, c-format
    -msgid "  Memory needed:      %s MiB\n"
    -msgstr "  Bộ nhớ cần:         %s MiB\n"
    -
    -#: src/xz/list.c:899 src/xz/list.c:1074
    -#, c-format
    -msgid "  Sizes in headers:   %s\n"
    -msgstr "  Kích cỡ phần đầu:   %s\n"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "Yes"
    -msgstr "Có"
    -
    -#: src/xz/list.c:900 src/xz/list.c:1075
    -msgid "No"
    -msgstr "Không"
    -
    -#: src/xz/list.c:901 src/xz/list.c:1076
    -#, c-format
    -msgid "  Minimum XZ Utils version: %s\n"
    -msgstr "  Phiên bản “XZ Utils†tối thiểu: %s\n"
    -
    -#. TRANSLATORS: %s is an integer. Only the plural form of this
    -#. message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
    -#: src/xz/list.c:1051
    -#, c-format
    -msgid "%s file\n"
    -msgid_plural "%s files\n"
    -msgstr[0] "%s tập tin\n"
    -
    -#: src/xz/list.c:1064
    -msgid "Totals:"
    -msgstr "Tổng cộng:"
    -
    -#: src/xz/list.c:1065
    -#, c-format
    -msgid "  Number of files:    %s\n"
    -msgstr "  Số tập tin:         %s\n"
    -
    -#: src/xz/list.c:1140
    -msgid "--list works only on .xz files (--format=xz or --format=auto)"
    -msgstr "--list chỉ hoạt động trên các tập tin .xz (--format=xz hay --format=auto)"
    -
    -#: src/xz/list.c:1146
    -msgid "--list does not support reading from standard input"
    -msgstr "--list không há»— trợ Ä‘á»c từ đầu vào tiêu chuẩn"
    -
    -#: src/xz/main.c:89
    -#, c-format
    -msgid "%s: Error reading filenames: %s"
    -msgstr "%s: Gặp lá»—i khi Ä‘á»c tên tập tin: %s"
    -
    -#: src/xz/main.c:96
    -#, c-format
    -msgid "%s: Unexpected end of input when reading filenames"
    -msgstr "%s: Gặp kết thúc đầu vào bất ngá» khi Ä‘á»c các tên tập tin"
    -
    -#: src/xz/main.c:120
    -#, c-format
    -msgid "%s: Null character found when reading filenames; maybe you meant to use `--files0' instead of `--files'?"
    -msgstr "%s: Gặp ký hiệu Null khi Ä‘á»c tên tập tin; có lẽ ý bạn muốn là dùng “--files0†chứ không phải “--files'?"
    -
    -#: src/xz/main.c:174
    -msgid "Compression and decompression with --robot are not supported yet."
    -msgstr "Nén và giải nén với --robot vẫn chưa được hỗ trợ."
    -
    -#: src/xz/main.c:231
    -msgid "Cannot read data from standard input when reading filenames from standard input"
    -msgstr "Không thể Ä‘á»c dữ liệu từ đầu vào tiêu chuẩn khi Ä‘á»c tập tin từ đầu vào tiêu chuẩn"
    -
    -#. TRANSLATORS: This is the program name in the beginning
    -#. of the line in messages. Usually it becomes "xz: ".
    -#. This is a translatable string because French needs
    -#. a space before a colon.
    -#: src/xz/message.c:713
    -#, c-format
    -msgid "%s: "
    -msgstr "%s: "
    -
    -#: src/xz/message.c:776 src/xz/message.c:826
    -msgid "Internal error (bug)"
    -msgstr "Lá»—i ná»™i bá»™ (lá»—i)"
    -
    -#: src/xz/message.c:783
    -msgid "Cannot establish signal handlers"
    -msgstr "Không thể thiết lập bộ xử lý tín hiệu"
    -
    -#: src/xz/message.c:792
    -msgid "No integrity check; not verifying file integrity"
    -msgstr "Không có kiểm tra toàn vẹn nên không thể thẩm tra tính toàn vẹn của tập tin"
    -
    -#: src/xz/message.c:795
    -msgid "Unsupported type of integrity check; not verifying file integrity"
    -msgstr "Kiểu kiểm tra toàn vẹn chưa được hỗ trợ; nên không thể thẩm tra tính toàn vẹn của tập tin"
    -
    -#: src/xz/message.c:802
    -msgid "Memory usage limit reached"
    -msgstr "Äã chạm mốc giá»›i hạn sá»­ dụng bá»™ nhá»›"
    -
    -#: src/xz/message.c:805
    -msgid "File format not recognized"
    -msgstr "Không nhận ra định dạng tập tin"
    -
    -#: src/xz/message.c:808
    -msgid "Unsupported options"
    -msgstr "Tùy chá»n không được há»— trợ"
    -
    -#: src/xz/message.c:811
    -msgid "Compressed data is corrupt"
    -msgstr "Dữ liệu đã nén bị há»ng"
    -
    -#: src/xz/message.c:814
    -msgid "Unexpected end of input"
    -msgstr "Gặp kết thúc đầu vào bất ngá»"
    -
    -#: src/xz/message.c:847
    -#, c-format
    -msgid "%s MiB of memory is required. The limiter is disabled."
    -msgstr "Yêu cầu cần có %s MiB bộ nhớ. Nhưng giới hạn bị tắt."
    -
    -#: src/xz/message.c:875
    -#, c-format
    -msgid "%s MiB of memory is required. The limit is %s."
    -msgstr "Yêu cầu cần có %s MiB bộ nhớ. Nhưng giới hạn là %s."
    -
    -#: src/xz/message.c:1042
    -#, c-format
    -msgid "%s: Filter chain: %s\n"
    -msgstr "%s: Móc xích lá»c: %s\n"
    -
    -#: src/xz/message.c:1052
    -#, c-format
    -msgid "Try `%s --help' for more information."
    -msgstr "Hãy chạy lệnh “%s --help†để xem thông tin thêm."
    -
    -#: src/xz/message.c:1078
    -#, c-format
    -msgid ""
    -"Usage: %s [OPTION]... [FILE]...\n"
    -"Compress or decompress FILEs in the .xz format.\n"
    -"\n"
    -msgstr ""
    -"Cách dùng: %s [TÙY CHỌN]... [TẬP TIN]...\n"
    -"Nén hoặc giải nén các TẬP TIN có định dạng .xz.\n"
    -"\n"
    -
    -#: src/xz/message.c:1085
    -msgid "Mandatory arguments to long options are mandatory for short options too.\n"
    -msgstr "Các tùy chá»n dài bắt buá»™c phải có đối số thì vá»›i tùy chá»n ngắn cÅ©ng vậy.\n"
    -
    -#: src/xz/message.c:1089
    -msgid " Operation mode:\n"
    -msgstr " Chế độ thao tác:\n"
    -
    -#: src/xz/message.c:1092
    -msgid ""
    -"  -z, --compress      force compression\n"
    -"  -d, --decompress    force decompression\n"
    -"  -t, --test          test compressed file integrity\n"
    -"  -l, --list          list information about .xz files"
    -msgstr ""
    -"  -z, --compress      ép buộc nén\n"
    -"  -d, --decompress    ép buộc giải nén\n"
    -"  -t, --test          kiểm tra tính toàn vẹn của tập tin nén\n"
    -"  -l, --list          liệt kê các thông tin vỠtập tin .xz"
    -
    -#: src/xz/message.c:1098
    -msgid ""
    -"\n"
    -" Operation modifiers:\n"
    -msgstr ""
    -"\n"
    -" Bộ chỉnh sửa thao tác:\n"
    -
    -#: src/xz/message.c:1101
    -msgid ""
    -"  -k, --keep          keep (don't delete) input files\n"
    -"  -f, --force         force overwrite of output file and (de)compress links\n"
    -"  -c, --stdout        write to standard output and don't delete input files"
    -msgstr ""
    -"  -k, --keep          giữ lại (đừng xóa) tập tin đầu vào\n"
    -"  -f, --force         buộc ghi đè tập tin đầu ra và (giải) nén các liên kết\n"
    -"  -c, --stdout        ghi ra đầu ra tiêu chuẩn và không xóa tập tin đầu vào"
    -
    -#: src/xz/message.c:1107
    -msgid ""
    -"      --single-stream decompress only the first stream, and silently\n"
    -"                      ignore possible remaining input data"
    -msgstr ""
    -"      --single-stream chỉ giải nén luồng dữ liệu đầu, và bỠqua\n"
    -"                      dữ liệu đầu vào còn lại có thể"
    -
    -#: src/xz/message.c:1110
    -msgid ""
    -"      --no-sparse     do not create sparse files when decompressing\n"
    -"  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
    -"      --files[=FILE]  read filenames to process from FILE; if FILE is\n"
    -"                      omitted, filenames are read from the standard input;\n"
    -"                      filenames must be terminated with the newline character\n"
    -"      --files0[=FILE] like --files but use the null character as terminator"
    -msgstr ""
    -"      --no-sparse     đừng tạo các tập tin rải rác khi giải nén\n"
    -"  -S, --suffix=.ÄUÔI  dùng hậu tố “.ÄUÔI†trên các tập tin nén\n"
    -"      --files[=TẬP-TIN]  Ä‘á»c các tập tin cần xá»­ lý từ TẬP-TIN; nếu không có\n"
    -"                      TẬP-TIN thì tên tập tin sẽ được Ä‘á»c vào từ đầu vào tiêu\n"
    -"                      chuẩn; chúng phải được kết thúc bằng ký tự dòng mới\n"
    -"      --files0[=TẬP-TIN] giống --files nhưng ký tự kết thúc là null"
    -
    -#: src/xz/message.c:1119
    -msgid ""
    -"\n"
    -" Basic file format and compression options:\n"
    -msgstr ""
    -"\n"
    -" Các tùy chá»n vỠđịnh dạng và nén cÆ¡ bản:\n"
    -
    -#: src/xz/message.c:1121
    -msgid ""
    -"  -F, --format=FMT    file format to encode or decode; possible values are\n"
    -"                      `auto' (default), `xz', `lzma', and `raw'\n"
    -"  -C, --check=CHECK   integrity check type: `none' (use with caution),\n"
    -"                      `crc32', `crc64' (default), or `sha256'"
    -msgstr ""
    -"  -F, --format=ÄDạng  định dạng tập tin cần mã hóa hoặc giải mã; giá trị có thể\n"
    -"                      là “auto†(mặc định), “xzâ€, “lzmaâ€, và “rawâ€\n"
    -"  -C, --check=KIỂM    kiểu kiểm tra toàn vẹn: “none†(thận trá»ng khi dùng),\n"
    -"                      “crc32â€, “crc64†(mặc định), hay “sha256â€"
    -
    -#: src/xz/message.c:1126
    -msgid "      --ignore-check  don't verify the integrity check when decompressing"
    -msgstr "      --ignore-check  không thẩm tra tính toàn vẹn khi giải nén"
    -
    -#: src/xz/message.c:1130
    -msgid ""
    -"  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
    -"                      decompressor memory usage into account before using 7-9!"
    -msgstr ""
    -"  -0 ... -9           đặt mức nén; mặc định là 6; tiêu dùng nhiá»u bá»™ nhá»› khi nén\n"
    -"                      và giải nén, nên tính toán trước khi dùng 7-9!"
    -
    -#: src/xz/message.c:1134
    -msgid ""
    -"  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
    -"                      does not affect decompressor memory requirements"
    -msgstr ""
    -"  -e, --extreme       cố gắng nâng cao mức nén bằng cách dùng nhiá»u CPU hÆ¡n;\n"
    -"                      nhưng không yêu cần nhiá»u bá»™ nhá»› khi giải nén"
    -
    -#: src/xz/message.c:1138
    -msgid ""
    -"  -T, --threads=NUM   use at most NUM threads; the default is 1; set to 0\n"
    -"                      to use as many threads as there are processor cores"
    -msgstr ""
    -"  -T, --threads=SỠ   dùng tối đa là SỠtuyến trình; mặc định là 1; đặt\n"
    -"                      thành 0 để dùng số lượng bằng số lõi vi xử lý"
    -
    -#: src/xz/message.c:1143
    -msgid ""
    -"      --block-size=SIZE\n"
    -"                      start a new .xz block after every SIZE bytes of input;\n"
    -"                      use this to set the block size for threaded compression"
    -msgstr ""
    -"      --block-size=Cá» \n"
    -"                      bắt đầu một khối .xz mới sau mỗi CỠ byte của đầu vào;\n"
    -"                      dùng tùy chá»n này để đặt cỡ khối cho nén tuyến trình"
    -
    -#: src/xz/message.c:1147
    -msgid ""
    -"      --block-list=SIZES\n"
    -"                      start a new .xz block after the given comma-separated\n"
    -"                      intervals of uncompressed data"
    -msgstr ""
    -"      --block-list=Cá» \n"
    -"                      bắt đầu một khối .xz mới sau một danh sách ngăn\n"
    -"                      cách bằng dấu phẩy nhịp dữ của dữ liệu chưa nén"
    -
    -#: src/xz/message.c:1151
    -msgid ""
    -"      --flush-timeout=TIMEOUT\n"
    -"                      when compressing, if more than TIMEOUT milliseconds has\n"
    -"                      passed since the previous flush and reading more input\n"
    -"                      would block, all pending data is flushed out"
    -msgstr ""
    -"      --flush-timeout=THỜI_GIAN_CHỜ\n"
    -"                      khi đang nén, nếu đã trải qua hơn THỜI_GIAN_CHỜ milli-giây\n"
    -"                      kể từ lần đẩy dữ liệu lên đĩa trước đó và Ä‘ang Ä‘á»c thêm\n"
    -"                      khối nữa, má»i dữ liệu Ä‘ang chá» sẽ được ghi lên đĩa"
    -
    -#: src/xz/message.c:1157
    -#, no-c-format
    -msgid ""
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      set memory usage limit for compression, decompression,\n"
    -"                      or both; LIMIT is in bytes, % of RAM, or 0 for defaults"
    -msgstr ""
    -"      --memlimit-compress=GIỚI_HẠN\n"
    -"      --memlimit-decompress=GIỚI_HẠN\n"
    -"  -M, --memlimit=GIỚI_HẠN\n"
    -"                      đặt mức giới hạn dùng bộ nhớ cho việc nén, giải nén,\n"
    -"                      hoặc cả hai; GIỚI_HẠN có đơn vị là byte, % của RAM,\n"
    -"                      hay 0 cho mặc định"
    -
    -#: src/xz/message.c:1164
    -msgid ""
    -"      --no-adjust     if compression settings exceed the memory usage limit,\n"
    -"                      give an error instead of adjusting the settings downwards"
    -msgstr ""
    -"      --no-adjust     nếu các cài đặt nén vượt quá giới hạn dùng bộ nhớ,\n"
    -"                      đưa ra một lỗi thay vì sửa đổi các cài đặt xuống"
    -
    -#: src/xz/message.c:1170
    -msgid ""
    -"\n"
    -" Custom filter chain for compression (alternative for using presets):"
    -msgstr ""
    -"\n"
    -" Móc xích lá»c tùy chỉnh cho nén (thay cho việc dùng chỉnh trước):"
    -
    -#: src/xz/message.c:1179
    -msgid ""
    -"\n"
    -"  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
    -"  --lzma2[=OPTS]      more of the following options (valid values; default):\n"
    -"                        preset=PRE reset options to a preset (0-9[e])\n"
    -"                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=NUM     number of literal context bits (0-4; 3)\n"
    -"                        lp=NUM     number of literal position bits (0-4; 0)\n"
    -"                        pb=NUM     number of position bits (0-4; 2)\n"
    -"                        mode=MODE  compression mode (fast, normal; normal)\n"
    -"                        nice=NUM   nice length of a match (2-273; 64)\n"
    -"                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  maximum search depth; 0=automatic (default)"
    -msgstr ""
    -"\n"
    -"  --lzma1[=CTC]       LZMA1 hay LZMA2; CÃC-TÙY-CHỌN là danh sách cá»§a không hoặc\n"
    -"  --lzma2[=CTC]       hÆ¡n các tùy chá»n sau đây (giá trị hợp lệ; mặc định):\n"
    -"                        preset=PRE các tùy chá»n tối ưu nén (0-9[e])\n"
    -"                        dict=SỠ   cỡ từ điển (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=SỠ     số bít ngữ cảnh văn bản (0-4; 3)\n"
    -"                        lp=SỠ     số bít vị trí văn bản (0-4; 0)\n"
    -"                        pb=SỠ     số bít vị trí (0-4; 2)\n"
    -"                        mode=CHẾ_ÄỘ  chế độ nén (fast, normal; normal)\n"
    -"                        nice=Sá»    chiá»u dài “tốt†cá»§a khá»›p (2-273; 64)\n"
    -"                        mf=TÊN     bộ tìm khớp (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=SỠ  mức sâu tìm kiếm tối đa; 0=tự động (mặc định)"
    -
    -#: src/xz/message.c:1194
    -msgid ""
    -"\n"
    -"  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
    -"  --powerpc[=OPTS]    PowerPC BCJ filter (big endian only)\n"
    -"  --ia64[=OPTS]       IA-64 (Itanium) BCJ filter\n"
    -"  --arm[=OPTS]        ARM BCJ filter (little endian only)\n"
    -"  --armthumb[=OPTS]   ARM-Thumb BCJ filter (little endian only)\n"
    -"  --sparc[=OPTS]      SPARC BCJ filter\n"
    -"                      Valid OPTS for all BCJ filters:\n"
    -"                        start=NUM  start offset for conversions (default=0)"
    -msgstr ""
    -"\n"
    -"  --x86[=OPTS]        bá»™ lá»c x86 BCJ (32-bit và 64-bit)\n"
    -"  --powerpc[=OPTS]    bá»™ lá»c PowerPC BCJ (chỉ big endian)\n"
    -"  --ia64[=OPTS]       IA-64 (Itanium) BCJ\n"
    -"  --arm[=OPTS]        bá»™ lá»c ARM BCJ (chỉ little endian)\n"
    -"  --armthumb[=OPTS]   bá»™ lá»c ARM-Thumb BCJ (chỉ little endian)\n"
    -"  --sparc[=OPTS]      bá»™ lá»c SPARC BCJ\n"
    -"                      các tùy chá»n hợp lệ cho má»i bá»™ lá»c BCJ:\n"
    -"                        start=SỠkhoảng bù khởi đầu cho chuyển đổi (mặc định=0)"
    -
    -#: src/xz/message.c:1206
    -msgid ""
    -"\n"
    -"  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
    -"                        dist=NUM   distance between bytes being subtracted\n"
    -"                                   from each other (1-256; 1)"
    -msgstr ""
    -"\n"
    -"  --delta[=OPTS]      bá»™ lá»c Delta;\n"
    -"                      CÃC-TÙY-CHỌN hợp lệ (giá trị hợp lệ; mặc định):\n"
    -"                        dist=SỠ   khoảng cách giữa các byte được trừ từ\n"
    -"                                   những cái khác (1-256; 1)"
    -
    -#: src/xz/message.c:1214
    -msgid ""
    -"\n"
    -" Other options:\n"
    -msgstr ""
    -"\n"
    -" Tùy chá»n khác:\n"
    -
    -#: src/xz/message.c:1217
    -msgid ""
    -"  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
    -"  -v, --verbose       be verbose; specify twice for even more verbose"
    -msgstr ""
    -"  -q, --quiet         không xuất các cảnh báo;\n"
    -"                      chỉ định hai lần nến bạn muốn chặn cả báo lỗi\n"
    -"  -v, --verbose       thông báo chi tiết; dùng hai lần nếu muốn chi tiết hơn"
    -
    -#: src/xz/message.c:1222
    -msgid "  -Q, --no-warn       make warnings not affect the exit status"
    -msgstr "  -Q, --no-warn       làm cho các cảnh báo không ảnh hưởng đến trạng thái thoát"
    -
    -#: src/xz/message.c:1224
    -msgid "      --robot         use machine-parsable messages (useful for scripts)"
    -msgstr ""
    -"      --robot         dùng các thông điệp máy có thể phân tích\n"
    -"                      (hữu dụng với scripts)"
    -
    -#: src/xz/message.c:1227
    -msgid ""
    -"      --info-memory   display the total amount of RAM and the currently active\n"
    -"                      memory usage limits, and exit"
    -msgstr ""
    -"      --info-memory   hiển thị tổng lượng RAM và mức giới hạn tiêu dùng\n"
    -"                      bộ nhớ hiện tại, rồi thoát"
    -
    -#: src/xz/message.c:1230
    -msgid ""
    -"  -h, --help          display the short help (lists only the basic options)\n"
    -"  -H, --long-help     display this long help and exit"
    -msgstr ""
    -"  -h, --help          hiển thị trợ giúp dạng ngắn gá»n\n"
    -"                      (chỉ liệt kê các tùy chá»n cÆ¡ bản)\n"
    -"  -H, --long-help     hiển thị trợ giúp đầy đủ rồi thoát"
    -
    -#: src/xz/message.c:1234
    -msgid ""
    -"  -h, --help          display this short help and exit\n"
    -"  -H, --long-help     display the long help (lists also the advanced options)"
    -msgstr ""
    -"  -h, --help          hiển thị trợ giúp dạng ngắn gá»n rồi thoát\n"
    -"  -H, --long-help     hiển thị trợ giúp đầy đủ\n"
    -"                      (liệt kê cả những tùy chá»n cấp cao)"
    -
    -#: src/xz/message.c:1239
    -msgid "  -V, --version       display the version number and exit"
    -msgstr "  -V, --version       hiển thị số phiên bản và thoát"
    -
    -#: src/xz/message.c:1241
    -msgid ""
    -"\n"
    -"With no FILE, or when FILE is -, read standard input.\n"
    -msgstr ""
    -"\n"
    -"Không có TẬP_TIN, hoặc TẬP_TIN là “-â€, thì Ä‘á»c đầu vào tiêu chuẩn.\n"
    -
    -#. TRANSLATORS: This message indicates the bug reporting address
    -#. for this package. Please add _another line_ saying
    -#. "Report translation bugs to <...>\n" with the email or WWW
    -#. address for translation bugs. Thanks.
    -#: src/xz/message.c:1247
    -#, c-format
    -msgid "Report bugs to <%s> (in English or Finnish).\n"
    -msgstr ""
    -"Hãy báo cáo lỗi cho <%s> (bằng tiếng Anh hoặc Phần Lan).\n"
    -"Thông báo lỗi dịch cho: .\n"
    -
    -#: src/xz/message.c:1249
    -#, c-format
    -msgid "%s home page: <%s>\n"
    -msgstr "Trang chá»§ %s: <%s>.\n"
    -
    -#: src/xz/message.c:1253
    -msgid "THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."
    -msgstr "ÄÂY LÀ PHIÊN BẢN PHÃT TRIỂN VÀ NÓ KHÔNG PHÙ HỢP VỚI MỤC ÄÃCH SẢN XUẤT."
    -
    -#: src/xz/options.c:86
    -#, c-format
    -msgid "%s: Options must be `name=value' pairs separated with commas"
    -msgstr "%s: Các tùy chá»n phải là các cặp “name=value†ngăn cách nhau bằng dấu phẩy"
    -
    -#: src/xz/options.c:93
    -#, c-format
    -msgid "%s: Invalid option name"
    -msgstr "%s: Tên tùy chá»n không hợp lệ"
    -
    -#: src/xz/options.c:113
    -#, c-format
    -msgid "%s: Invalid option value"
    -msgstr "%s: Giá trị cá»§a tùy chá»n không hợp lệ"
    -
    -#: src/xz/options.c:247
    -#, c-format
    -msgid "Unsupported LZMA1/LZMA2 preset: %s"
    -msgstr "Hiện nay chưa hỗ trợ LZMA1/LZMA2: %s"
    -
    -#: src/xz/options.c:355
    -msgid "The sum of lc and lp must not exceed 4"
    -msgstr "Tổng số lượng lc và lp không được vượt quá 4"
    -
    -#: src/xz/options.c:359
    -#, c-format
    -msgid "The selected match finder requires at least nice=%"
    -msgstr "Bá»™ tìm khá»›p đã chá»n yêu cầu mức “tốt†ít nhất là nice=%"
    -
    -#: src/xz/suffix.c:133 src/xz/suffix.c:258
    -#, c-format
    -msgid "%s: With --format=raw, --suffix=.SUF is required unless writing to stdout"
    -msgstr "%s: Nếu --format=raw, --suffix=.SUF sẽ được yêu cầu trừ trưá»ng hợp ghi ra đầu ra tiêu chuẩn"
    -
    -#: src/xz/suffix.c:164
    -#, c-format
    -msgid "%s: Filename has an unknown suffix, skipping"
    -msgstr "%s: Tên tập tin có phần hậu tố chưa biết nên bỠqua"
    -
    -#: src/xz/suffix.c:185
    -#, c-format
    -msgid "%s: File already has `%s' suffix, skipping"
    -msgstr "%s: Tập tin đã sẵn có hậu tố “%s†nên bỠqua"
    -
    -#: src/xz/suffix.c:393
    -#, c-format
    -msgid "%s: Invalid filename suffix"
    -msgstr "%s: Hậu tố tên tập tin không hợp lệ"
    -
    -#: src/xz/util.c:71
    -#, c-format
    -msgid "%s: Value is not a non-negative decimal integer"
    -msgstr "%s: Giá trị không phải là số thập phân nguyên không âm"
    -
    -#: src/xz/util.c:113
    -#, c-format
    -msgid "%s: Invalid multiplier suffix"
    -msgstr "%s: Hậu tố nhân tố không hợp lệ"
    -
    -#: src/xz/util.c:115
    -msgid "Valid suffixes are `KiB' (2^10), `MiB' (2^20), and `GiB' (2^30)."
    -msgstr "Các hậu tố hợp lệ là “KiB†(2^10), “MiB†(2^20), và “GiB†(2^30)."
    -
    -#: src/xz/util.c:132
    -#, c-format
    -msgid "Value of the option `%s' must be in the range [%, %]"
    -msgstr "Giá trị cuả tùy chá»n “%s†phải nằm trong vùng [%, %]"
    -
    -#: src/xz/util.c:257
    -msgid "Empty filename, skipping"
    -msgstr "Tên tập tin trống rỗng nên bỠqua"
    -
    -#: src/xz/util.c:271
    -msgid "Compressed data cannot be read from a terminal"
    -msgstr "Dữ liệu đã nén không thể Ä‘á»c từ thiết bị cuối"
    -
    -#: src/xz/util.c:284
    -msgid "Compressed data cannot be written to a terminal"
    -msgstr "Dữ liệu đã nén không thể ghi ra thiết bị cuối"
    -
    -#: src/common/tuklib_exit.c:39
    -msgid "Writing to standard output failed"
    -msgstr "Gặp lỗi khi ghi dữ liệu vào đầu ra tiêu chuẩn"
    -
    -#: src/common/tuklib_exit.c:42
    -msgid "Unknown error"
    -msgstr "Lỗi chưa biết"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard input: %s"
    -#~ msgstr "Lỗi cài đặt O_NONBLOCK trên đầu vào tiêu chuẩn: %s"
    -
    -#~ msgid "Error setting O_NONBLOCK on standard output: %s"
    -#~ msgstr "Lỗi cài đặt O_NONBLOCK trên đầu ra tiêu chuẩn: %s"
    -
    -#~ msgid ""
    -#~ "      --block-size=SIZE\n"
    -#~ "                      when compressing to the .xz format, start a new block\n"
    -#~ "                      after every SIZE bytes of input; 0=disabled (default)"
    -#~ msgstr ""
    -#~ "      --block-size=Cá» \n"
    -#~ "                      khi nén thành định dạng .xz, bắt đầu khối mới\n"
    -#~ "                      sau mỗi SỠbyte đầu vào; 0=tắt (mặc định)"
    diff --git a/external/public-domain/xz/dist/src/common/common_w32res.rc b/external/public-domain/xz/dist/src/common/common_w32res.rc
    deleted file mode 100644
    index fdb88d184..000000000
    --- a/external/public-domain/xz/dist/src/common/common_w32res.rc
    +++ /dev/null
    @@ -1,50 +0,0 @@
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - */
    -
    -#include 
    -#include "config.h"
    -#define LZMA_H_INTERNAL
    -#define LZMA_H_INTERNAL_RC
    -#include "lzma/version.h"
    -
    -#ifndef MY_BUILD
    -# define MY_BUILD 0
    -#endif
    -#define MY_VERSION LZMA_VERSION_MAJOR,LZMA_VERSION_MINOR,LZMA_VERSION_PATCH,MY_BUILD
    -
    -#define MY_FILENAME    MY_NAME MY_SUFFIX
    -#define MY_COMPANY     "The Tukaani Project "
    -#define MY_PRODUCT     PACKAGE_NAME " <" PACKAGE_URL ">"
    -
    -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
    -VS_VERSION_INFO VERSIONINFO
    -  FILEVERSION MY_VERSION
    -  PRODUCTVERSION MY_VERSION
    -  FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
    -  FILEFLAGS 0
    -  FILEOS VOS_NT_WINDOWS32
    -  FILETYPE MY_TYPE
    -  FILESUBTYPE 0x0L
    -BEGIN
    -    BLOCK "StringFileInfo"
    -    BEGIN
    -        BLOCK "040904b0"
    -        BEGIN
    -            VALUE "CompanyName", MY_COMPANY
    -            VALUE "FileDescription", MY_DESC
    -            VALUE "FileVersion", LZMA_VERSION_STRING
    -            VALUE "InternalName", MY_NAME
    -            VALUE "OriginalFilename", MY_FILENAME
    -            VALUE "ProductName", MY_PRODUCT
    -            VALUE "ProductVersion", LZMA_VERSION_STRING
    -        END
    -    END
    -    BLOCK "VarFileInfo"
    -    BEGIN
    -        VALUE "Translation", 0x409, 1200
    -    END
    -END
    diff --git a/external/public-domain/xz/dist/src/common/mythread.h b/external/public-domain/xz/dist/src/common/mythread.h
    deleted file mode 100644
    index be2265424..000000000
    --- a/external/public-domain/xz/dist/src/common/mythread.h
    +++ /dev/null
    @@ -1,521 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       mythread.h
    -/// \brief      Some threading related helper macros and functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef MYTHREAD_H
    -#define MYTHREAD_H
    -
    -#include "sysdefs.h"
    -
    -// If any type of threading is enabled, #define MYTHREAD_ENABLED.
    -#if defined(MYTHREAD_POSIX) || defined(MYTHREAD_WIN95) \
    -		|| defined(MYTHREAD_VISTA)
    -#	define MYTHREAD_ENABLED 1
    -#endif
    -
    -
    -#ifdef MYTHREAD_ENABLED
    -
    -////////////////////////////////////////
    -// Shared between all threading types //
    -////////////////////////////////////////
    -
    -// Locks a mutex for a duration of a block.
    -//
    -// Perform mythread_mutex_lock(&mutex) in the beginning of a block
    -// and mythread_mutex_unlock(&mutex) at the end of the block. "break"
    -// may be used to unlock the mutex and jump out of the block.
    -// mythread_sync blocks may be nested.
    -//
    -// Example:
    -//
    -//     mythread_sync(mutex) {
    -//         foo();
    -//         if (some_error)
    -//             break; // Skips bar()
    -//         bar();
    -//     }
    -//
    -// At least GCC optimizes the loops completely away so it doesn't slow
    -// things down at all compared to plain mythread_mutex_lock(&mutex)
    -// and mythread_mutex_unlock(&mutex) calls.
    -//
    -#define mythread_sync(mutex) mythread_sync_helper1(mutex, __LINE__)
    -#define mythread_sync_helper1(mutex, line) mythread_sync_helper2(mutex, line)
    -#define mythread_sync_helper2(mutex, line) \
    -	for (unsigned int mythread_i_ ## line = 0; \
    -			mythread_i_ ## line \
    -				? (mythread_mutex_unlock(&(mutex)), 0) \
    -				: (mythread_mutex_lock(&(mutex)), 1); \
    -			mythread_i_ ## line = 1) \
    -		for (unsigned int mythread_j_ ## line = 0; \
    -				!mythread_j_ ## line; \
    -				mythread_j_ ## line = 1)
    -#endif
    -
    -
    -#if !defined(MYTHREAD_ENABLED)
    -
    -//////////////////
    -// No threading //
    -//////////////////
    -
    -// Calls the given function once. This isn't thread safe.
    -#define mythread_once(func) \
    -do { \
    -	static bool once_ = false; \
    -	if (!once_) { \
    -		func(); \
    -		once_ = true; \
    -	} \
    -} while (0)
    -
    -
    -#if !(defined(_WIN32) && !defined(__CYGWIN__))
    -// Use sigprocmask() to set the signal mask in single-threaded programs.
    -#include 
    -
    -static inline void
    -mythread_sigmask(int how, const sigset_t *restrict set,
    -		sigset_t *restrict oset)
    -{
    -	int ret = sigprocmask(how, set, oset);
    -	assert(ret == 0);
    -	(void)ret;
    -}
    -#endif
    -
    -
    -#elif defined(MYTHREAD_POSIX)
    -
    -////////////////////
    -// Using pthreads //
    -////////////////////
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#define MYTHREAD_RET_TYPE void *
    -#define MYTHREAD_RET_VALUE NULL
    -
    -typedef pthread_t mythread;
    -typedef pthread_mutex_t mythread_mutex;
    -
    -typedef struct {
    -	pthread_cond_t cond;
    -#ifdef HAVE_CLOCK_GETTIME
    -	// Clock ID (CLOCK_REALTIME or CLOCK_MONOTONIC) associated with
    -	// the condition variable.
    -	clockid_t clk_id;
    -#endif
    -} mythread_cond;
    -
    -typedef struct timespec mythread_condtime;
    -
    -
    -// Calls the given function once in a thread-safe way.
    -#define mythread_once(func) \
    -	do { \
    -		static pthread_once_t once_ = PTHREAD_ONCE_INIT; \
    -		pthread_once(&once_, &func); \
    -	} while (0)
    -
    -
    -// Use pthread_sigmask() to set the signal mask in multi-threaded programs.
    -// Do nothing on OpenVMS since it lacks pthread_sigmask().
    -static inline void
    -mythread_sigmask(int how, const sigset_t *restrict set,
    -		sigset_t *restrict oset)
    -{
    -#ifdef __VMS
    -	(void)how;
    -	(void)set;
    -	(void)oset;
    -#else
    -	int ret = pthread_sigmask(how, set, oset);
    -	assert(ret == 0);
    -	(void)ret;
    -#endif
    -}
    -
    -
    -// Creates a new thread with all signals blocked. Returns zero on success
    -// and non-zero on error.
    -static inline int
    -mythread_create(mythread *thread, void *(*func)(void *arg), void *arg)
    -{
    -	sigset_t old;
    -	sigset_t all;
    -	sigfillset(&all);
    -
    -	mythread_sigmask(SIG_SETMASK, &all, &old);
    -	const int ret = pthread_create(thread, NULL, func, arg);
    -	mythread_sigmask(SIG_SETMASK, &old, NULL);
    -
    -	return ret;
    -}
    -
    -// Joins a thread. Returns zero on success and non-zero on error.
    -static inline int
    -mythread_join(mythread thread)
    -{
    -	return pthread_join(thread, NULL);
    -}
    -
    -
    -// Initiatlizes a mutex. Returns zero on success and non-zero on error.
    -static inline int
    -mythread_mutex_init(mythread_mutex *mutex)
    -{
    -	return pthread_mutex_init(mutex, NULL);
    -}
    -
    -static inline void
    -mythread_mutex_destroy(mythread_mutex *mutex)
    -{
    -	int ret = pthread_mutex_destroy(mutex);
    -	assert(ret == 0);
    -	(void)ret;
    -}
    -
    -static inline void
    -mythread_mutex_lock(mythread_mutex *mutex)
    -{
    -	int ret = pthread_mutex_lock(mutex);
    -	assert(ret == 0);
    -	(void)ret;
    -}
    -
    -static inline void
    -mythread_mutex_unlock(mythread_mutex *mutex)
    -{
    -	int ret = pthread_mutex_unlock(mutex);
    -	assert(ret == 0);
    -	(void)ret;
    -}
    -
    -
    -// Initializes a condition variable.
    -//
    -// Using CLOCK_MONOTONIC instead of the default CLOCK_REALTIME makes the
    -// timeout in pthread_cond_timedwait() work correctly also if system time
    -// is suddenly changed. Unfortunately CLOCK_MONOTONIC isn't available
    -// everywhere while the default CLOCK_REALTIME is, so the default is
    -// used if CLOCK_MONOTONIC isn't available.
    -//
    -// If clock_gettime() isn't available at all, gettimeofday() will be used.
    -static inline int
    -mythread_cond_init(mythread_cond *mycond)
    -{
    -#ifdef HAVE_CLOCK_GETTIME
    -	// NOTE: HAVE_DECL_CLOCK_MONOTONIC is always defined to 0 or 1.
    -#	if defined(HAVE_PTHREAD_CONDATTR_SETCLOCK) && HAVE_DECL_CLOCK_MONOTONIC
    -	struct timespec ts;
    -	pthread_condattr_t condattr;
    -
    -	// POSIX doesn't seem to *require* that pthread_condattr_setclock()
    -	// will fail if given an unsupported clock ID. Test that
    -	// CLOCK_MONOTONIC really is supported using clock_gettime().
    -	if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0
    -			&& pthread_condattr_init(&condattr) == 0) {
    -		int ret = pthread_condattr_setclock(
    -				&condattr, CLOCK_MONOTONIC);
    -		if (ret == 0)
    -			ret = pthread_cond_init(&mycond->cond, &condattr);
    -
    -		pthread_condattr_destroy(&condattr);
    -
    -		if (ret == 0) {
    -			mycond->clk_id = CLOCK_MONOTONIC;
    -			return 0;
    -		}
    -	}
    -
    -	// If anything above fails, fall back to the default CLOCK_REALTIME.
    -	// POSIX requires that all implementations of clock_gettime() must
    -	// support at least CLOCK_REALTIME.
    -#	endif
    -
    -	mycond->clk_id = CLOCK_REALTIME;
    -#endif
    -
    -	return pthread_cond_init(&mycond->cond, NULL);
    -}
    -
    -static inline void
    -mythread_cond_destroy(mythread_cond *cond)
    -{
    -	int ret = pthread_cond_destroy(&cond->cond);
    -	assert(ret == 0);
    -	(void)ret;
    -}
    -
    -static inline void
    -mythread_cond_signal(mythread_cond *cond)
    -{
    -	int ret = pthread_cond_signal(&cond->cond);
    -	assert(ret == 0);
    -	(void)ret;
    -}
    -
    -static inline void
    -mythread_cond_wait(mythread_cond *cond, mythread_mutex *mutex)
    -{
    -	int ret = pthread_cond_wait(&cond->cond, mutex);
    -	assert(ret == 0);
    -	(void)ret;
    -}
    -
    -// Waits on a condition or until a timeout expires. If the timeout expires,
    -// non-zero is returned, otherwise zero is returned.
    -static inline int
    -mythread_cond_timedwait(mythread_cond *cond, mythread_mutex *mutex,
    -		const mythread_condtime *condtime)
    -{
    -	int ret = pthread_cond_timedwait(&cond->cond, mutex, condtime);
    -	assert(ret == 0 || ret == ETIMEDOUT);
    -	return ret;
    -}
    -
    -// Sets condtime to the absolute time that is timeout_ms milliseconds
    -// in the future. The type of the clock to use is taken from cond.
    -static inline void
    -mythread_condtime_set(mythread_condtime *condtime, const mythread_cond *cond,
    -		uint32_t timeout_ms)
    -{
    -	condtime->tv_sec = timeout_ms / 1000;
    -	condtime->tv_nsec = (timeout_ms % 1000) * 1000000;
    -
    -#ifdef HAVE_CLOCK_GETTIME
    -	struct timespec now;
    -	int ret = clock_gettime(cond->clk_id, &now);
    -	assert(ret == 0);
    -	(void)ret;
    -
    -	condtime->tv_sec += now.tv_sec;
    -	condtime->tv_nsec += now.tv_nsec;
    -#else
    -	(void)cond;
    -
    -	struct timeval now;
    -	gettimeofday(&now, NULL);
    -
    -	condtime->tv_sec += now.tv_sec;
    -	condtime->tv_nsec += now.tv_usec * 1000L;
    -#endif
    -
    -	// tv_nsec must stay in the range [0, 999_999_999].
    -	if (condtime->tv_nsec >= 1000000000L) {
    -		condtime->tv_nsec -= 1000000000L;
    -		++condtime->tv_sec;
    -	}
    -}
    -
    -
    -#elif defined(MYTHREAD_WIN95) || defined(MYTHREAD_VISTA)
    -
    -/////////////////////
    -// Windows threads //
    -/////////////////////
    -
    -#define WIN32_LEAN_AND_MEAN
    -#ifdef MYTHREAD_VISTA
    -#	undef _WIN32_WINNT
    -#	define _WIN32_WINNT 0x0600
    -#endif
    -#include 
    -#include 
    -
    -#define MYTHREAD_RET_TYPE unsigned int __stdcall
    -#define MYTHREAD_RET_VALUE 0
    -
    -typedef HANDLE mythread;
    -typedef CRITICAL_SECTION mythread_mutex;
    -
    -#ifdef MYTHREAD_WIN95
    -typedef HANDLE mythread_cond;
    -#else
    -typedef CONDITION_VARIABLE mythread_cond;
    -#endif
    -
    -typedef struct {
    -	// Tick count (milliseconds) in the beginning of the timeout.
    -	// NOTE: This is 32 bits so it wraps around after 49.7 days.
    -	// Multi-day timeouts may not work as expected.
    -	DWORD start;
    -
    -	// Length of the timeout in milliseconds. The timeout expires
    -	// when the current tick count minus "start" is equal or greater
    -	// than "timeout".
    -	DWORD timeout;
    -} mythread_condtime;
    -
    -
    -// mythread_once() is only available with Vista threads.
    -#ifdef MYTHREAD_VISTA
    -#define mythread_once(func) \
    -	do { \
    -		static INIT_ONCE once_ = INIT_ONCE_STATIC_INIT; \
    -		BOOL pending_; \
    -		if (!InitOnceBeginInitialize(&once_, 0, &pending_, NULL)) \
    -			abort(); \
    -		if (pending_) \
    -			func(); \
    -		if (!InitOnceComplete(&once, 0, NULL)) \
    -			abort(); \
    -	} while (0)
    -#endif
    -
    -
    -// mythread_sigmask() isn't available on Windows. Even a dummy version would
    -// make no sense because the other POSIX signal functions are missing anyway.
    -
    -
    -static inline int
    -mythread_create(mythread *thread,
    -		unsigned int (__stdcall *func)(void *arg), void *arg)
    -{
    -	uintptr_t ret = _beginthreadex(NULL, 0, func, arg, 0, NULL);
    -	if (ret == 0)
    -		return -1;
    -
    -	*thread = (HANDLE)ret;
    -	return 0;
    -}
    -
    -static inline int
    -mythread_join(mythread thread)
    -{
    -	int ret = 0;
    -
    -	if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0)
    -		ret = -1;
    -
    -	if (!CloseHandle(thread))
    -		ret = -1;
    -
    -	return ret;
    -}
    -
    -
    -static inline int
    -mythread_mutex_init(mythread_mutex *mutex)
    -{
    -	InitializeCriticalSection(mutex);
    -	return 0;
    -}
    -
    -static inline void
    -mythread_mutex_destroy(mythread_mutex *mutex)
    -{
    -	DeleteCriticalSection(mutex);
    -}
    -
    -static inline void
    -mythread_mutex_lock(mythread_mutex *mutex)
    -{
    -	EnterCriticalSection(mutex);
    -}
    -
    -static inline void
    -mythread_mutex_unlock(mythread_mutex *mutex)
    -{
    -	LeaveCriticalSection(mutex);
    -}
    -
    -
    -static inline int
    -mythread_cond_init(mythread_cond *cond)
    -{
    -#ifdef MYTHREAD_WIN95
    -	*cond = CreateEvent(NULL, FALSE, FALSE, NULL);
    -	return *cond == NULL ? -1 : 0;
    -#else
    -	InitializeConditionVariable(cond);
    -	return 0;
    -#endif
    -}
    -
    -static inline void
    -mythread_cond_destroy(mythread_cond *cond)
    -{
    -#ifdef MYTHREAD_WIN95
    -	CloseHandle(*cond);
    -#else
    -	(void)cond;
    -#endif
    -}
    -
    -static inline void
    -mythread_cond_signal(mythread_cond *cond)
    -{
    -#ifdef MYTHREAD_WIN95
    -	SetEvent(*cond);
    -#else
    -	WakeConditionVariable(cond);
    -#endif
    -}
    -
    -static inline void
    -mythread_cond_wait(mythread_cond *cond, mythread_mutex *mutex)
    -{
    -#ifdef MYTHREAD_WIN95
    -	LeaveCriticalSection(mutex);
    -	WaitForSingleObject(*cond, INFINITE);
    -	EnterCriticalSection(mutex);
    -#else
    -	BOOL ret = SleepConditionVariableCS(cond, mutex, INFINITE);
    -	assert(ret);
    -	(void)ret;
    -#endif
    -}
    -
    -static inline int
    -mythread_cond_timedwait(mythread_cond *cond, mythread_mutex *mutex,
    -		const mythread_condtime *condtime)
    -{
    -#ifdef MYTHREAD_WIN95
    -	LeaveCriticalSection(mutex);
    -#endif
    -
    -	DWORD elapsed = GetTickCount() - condtime->start;
    -	DWORD timeout = elapsed >= condtime->timeout
    -			? 0 : condtime->timeout - elapsed;
    -
    -#ifdef MYTHREAD_WIN95
    -	DWORD ret = WaitForSingleObject(*cond, timeout);
    -	assert(ret == WAIT_OBJECT_0 || ret == WAIT_TIMEOUT);
    -
    -	EnterCriticalSection(mutex);
    -
    -	return ret == WAIT_TIMEOUT;
    -#else
    -	BOOL ret = SleepConditionVariableCS(cond, mutex, timeout);
    -	assert(ret || GetLastError() == ERROR_TIMEOUT);
    -	return !ret;
    -#endif
    -}
    -
    -static inline void
    -mythread_condtime_set(mythread_condtime *condtime, const mythread_cond *cond,
    -		uint32_t timeout)
    -{
    -	(void)cond;
    -	condtime->start = GetTickCount();
    -	condtime->timeout = timeout;
    -}
    -
    -#endif
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/sysdefs.h b/external/public-domain/xz/dist/src/common/sysdefs.h
    deleted file mode 100644
    index e056ca4ac..000000000
    --- a/external/public-domain/xz/dist/src/common/sysdefs.h
    +++ /dev/null
    @@ -1,202 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       sysdefs.h
    -/// \brief      Common includes, definitions, system-specific things etc.
    -///
    -/// This file is used also by the lzma command line tool, that's why this
    -/// file is separate from common.h.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_SYSDEFS_H
    -#define LZMA_SYSDEFS_H
    -
    -//////////////
    -// Includes //
    -//////////////
    -
    -#ifdef HAVE_CONFIG_H
    -#	include 
    -#endif
    -
    -// Get standard-compliant stdio functions under MinGW and MinGW-w64.
    -#ifdef __MINGW32__
    -#	define __USE_MINGW_ANSI_STDIO 1
    -#endif
    -
    -// size_t and NULL
    -#include 
    -
    -#ifdef HAVE_INTTYPES_H
    -#	include 
    -#endif
    -
    -// C99 says that inttypes.h always includes stdint.h, but some systems
    -// don't do that, and require including stdint.h separately.
    -#ifdef HAVE_STDINT_H
    -#	include 
    -#endif
    -
    -// Some pre-C99 systems have SIZE_MAX in limits.h instead of stdint.h. The
    -// limits are also used to figure out some macros missing from pre-C99 systems.
    -#ifdef HAVE_LIMITS_H
    -#	include 
    -#endif
    -
    -// Be more compatible with systems that have non-conforming inttypes.h.
    -// We assume that int is 32-bit and that long is either 32-bit or 64-bit.
    -// Full Autoconf test could be more correct, but this should work well enough.
    -// Note that this duplicates some code from lzma.h, but this is better since
    -// we can work without inttypes.h thanks to Autoconf tests.
    -#ifndef UINT32_C
    -#	if UINT_MAX != 4294967295U
    -#		error UINT32_C is not defined and unsigned int is not 32-bit.
    -#	endif
    -#	define UINT32_C(n) n ## U
    -#endif
    -#ifndef UINT32_MAX
    -#	define UINT32_MAX UINT32_C(4294967295)
    -#endif
    -#ifndef PRIu32
    -#	define PRIu32 "u"
    -#endif
    -#ifndef PRIx32
    -#	define PRIx32 "x"
    -#endif
    -#ifndef PRIX32
    -#	define PRIX32 "X"
    -#endif
    -
    -#if ULONG_MAX == 4294967295UL
    -#	ifndef UINT64_C
    -#		define UINT64_C(n) n ## ULL
    -#	endif
    -#	ifndef PRIu64
    -#		define PRIu64 "llu"
    -#	endif
    -#	ifndef PRIx64
    -#		define PRIx64 "llx"
    -#	endif
    -#	ifndef PRIX64
    -#		define PRIX64 "llX"
    -#	endif
    -#else
    -#	ifndef UINT64_C
    -#		define UINT64_C(n) n ## UL
    -#	endif
    -#	ifndef PRIu64
    -#		define PRIu64 "lu"
    -#	endif
    -#	ifndef PRIx64
    -#		define PRIx64 "lx"
    -#	endif
    -#	ifndef PRIX64
    -#		define PRIX64 "lX"
    -#	endif
    -#endif
    -#ifndef UINT64_MAX
    -#	define UINT64_MAX UINT64_C(18446744073709551615)
    -#endif
    -
    -// Incorrect(?) SIZE_MAX:
    -//   - Interix headers typedef size_t to unsigned long,
    -//     but a few lines later define SIZE_MAX to INT32_MAX.
    -//   - SCO OpenServer (x86) headers typedef size_t to unsigned int
    -//     but define SIZE_MAX to INT32_MAX.
    -#if defined(__INTERIX) || defined(_SCO_DS)
    -#	undef SIZE_MAX
    -#endif
    -
    -// The code currently assumes that size_t is either 32-bit or 64-bit.
    -#ifndef SIZE_MAX
    -#	if SIZEOF_SIZE_T == 4
    -#		define SIZE_MAX UINT32_MAX
    -#	elif SIZEOF_SIZE_T == 8
    -#		define SIZE_MAX UINT64_MAX
    -#	else
    -#		error size_t is not 32-bit or 64-bit
    -#	endif
    -#endif
    -#if SIZE_MAX != UINT32_MAX && SIZE_MAX != UINT64_MAX
    -#	error size_t is not 32-bit or 64-bit
    -#endif
    -
    -#include 
    -#include 
    -
    -// Pre-C99 systems lack stdbool.h. All the code in LZMA Utils must be written
    -// so that it works with fake bool type, for example:
    -//
    -//    bool foo = (flags & 0x100) != 0;
    -//    bool bar = !!(flags & 0x100);
    -//
    -// This works with the real C99 bool but breaks with fake bool:
    -//
    -//    bool baz = (flags & 0x100);
    -//
    -#ifdef HAVE_STDBOOL_H
    -#	include 
    -#else
    -#	if ! HAVE__BOOL
    -typedef unsigned char _Bool;
    -#	endif
    -#	define bool _Bool
    -#	define false 0
    -#	define true 1
    -#	define __bool_true_false_are_defined 1
    -#endif
    -
    -// string.h should be enough but let's include strings.h and memory.h too if
    -// they exists, since that shouldn't do any harm, but may improve portability.
    -#ifdef HAVE_STRING_H
    -#	include 
    -#endif
    -
    -#ifdef HAVE_STRINGS_H
    -#	include 
    -#endif
    -
    -#ifdef HAVE_MEMORY_H
    -#	include 
    -#endif
    -
    -// As of MSVC 2013, inline and restrict are supported with
    -// non-standard keywords.
    -#if defined(_WIN32) && defined(_MSC_VER)
    -#	ifndef inline
    -#		define inline __inline
    -#	endif
    -#	ifndef restrict
    -#		define restrict __restrict
    -#	endif
    -#endif
    -
    -////////////
    -// Macros //
    -////////////
    -
    -#undef memzero
    -#define memzero(s, n) memset(s, 0, n)
    -
    -// NOTE: Avoid using MIN() and MAX(), because even conditionally defining
    -// those macros can cause some portability trouble, since on some systems
    -// the system headers insist defining their own versions.
    -#define my_min(x, y) ((x) < (y) ? (x) : (y))
    -#define my_max(x, y) ((x) > (y) ? (x) : (y))
    -
    -#ifndef ARRAY_SIZE
    -#	define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
    -#endif
    -
    -#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 3) || __GNUC__ > 4
    -#	define lzma_attr_alloc_size(x) __attribute__((__alloc_size__(x)))
    -#else
    -#	define lzma_attr_alloc_size(x)
    -#endif
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_common.h b/external/public-domain/xz/dist/src/common/tuklib_common.h
    deleted file mode 100644
    index 31fbab58b..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_common.h
    +++ /dev/null
    @@ -1,71 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_common.h
    -/// \brief      Common definitions for tuklib modules
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_COMMON_H
    -#define TUKLIB_COMMON_H
    -
    -// The config file may be replaced by a package-specific file.
    -// It should include at least stddef.h, inttypes.h, and limits.h.
    -#include "tuklib_config.h"
    -
    -// TUKLIB_SYMBOL_PREFIX is prefixed to all symbols exported by
    -// the tuklib modules. If you use a tuklib module in a library,
    -// you should use TUKLIB_SYMBOL_PREFIX to make sure that there
    -// are no symbol conflicts in case someone links your library
    -// into application that also uses the same tuklib module.
    -#ifndef TUKLIB_SYMBOL_PREFIX
    -#	define TUKLIB_SYMBOL_PREFIX
    -#endif
    -
    -#define TUKLIB_CAT_X(a, b) a ## b
    -#define TUKLIB_CAT(a, b) TUKLIB_CAT_X(a, b)
    -
    -#ifndef TUKLIB_SYMBOL
    -#	define TUKLIB_SYMBOL(sym) TUKLIB_CAT(TUKLIB_SYMBOL_PREFIX, sym)
    -#endif
    -
    -#ifndef TUKLIB_DECLS_BEGIN
    -#	ifdef __cplusplus
    -#		define TUKLIB_DECLS_BEGIN extern "C" {
    -#	else
    -#		define TUKLIB_DECLS_BEGIN
    -#	endif
    -#endif
    -
    -#ifndef TUKLIB_DECLS_END
    -#	ifdef __cplusplus
    -#		define TUKLIB_DECLS_END }
    -#	else
    -#		define TUKLIB_DECLS_END
    -#	endif
    -#endif
    -
    -#if defined(__GNUC__) && defined(__GNUC_MINOR__)
    -#	define TUKLIB_GNUC_REQ(major, minor) \
    -		((__GNUC__ == (major) && __GNUC_MINOR__ >= (minor)) \
    -			|| __GNUC__ > (major))
    -#else
    -#	define TUKLIB_GNUC_REQ(major, minor) 0
    -#endif
    -
    -#if TUKLIB_GNUC_REQ(2, 5)
    -#	define tuklib_attr_noreturn __attribute__((__noreturn__))
    -#else
    -#	define tuklib_attr_noreturn
    -#endif
    -
    -#if (defined(_WIN32) && !defined(__CYGWIN__)) \
    -		|| defined(__OS2__) || defined(__MSDOS__)
    -#	define TUKLIB_DOSLIKE 1
    -#endif
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_config.h b/external/public-domain/xz/dist/src/common/tuklib_config.h
    deleted file mode 100644
    index 549cb24d7..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_config.h
    +++ /dev/null
    @@ -1,7 +0,0 @@
    -#ifdef HAVE_CONFIG_H
    -#	include "sysdefs.h"
    -#else
    -#	include 
    -#	include 
    -#	include 
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_cpucores.c b/external/public-domain/xz/dist/src/common/tuklib_cpucores.c
    deleted file mode 100644
    index e235fd1ce..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_cpucores.c
    +++ /dev/null
    @@ -1,91 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_cpucores.c
    -/// \brief      Get the number of CPU cores online
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tuklib_cpucores.h"
    -
    -#if defined(_WIN32) || defined(__CYGWIN__)
    -#	ifndef _WIN32_WINNT
    -#		define _WIN32_WINNT 0x0500
    -#	endif
    -#	include 
    -
    -// FreeBSD
    -#elif defined(TUKLIB_CPUCORES_CPUSET)
    -#	include 
    -#	include 
    -
    -#elif defined(TUKLIB_CPUCORES_SYSCTL)
    -#	ifdef HAVE_SYS_PARAM_H
    -#		include 
    -#	endif
    -#	include 
    -
    -#elif defined(TUKLIB_CPUCORES_SYSCONF)
    -#	include 
    -
    -// HP-UX
    -#elif defined(TUKLIB_CPUCORES_PSTAT_GETDYNAMIC)
    -#	include 
    -#	include 
    -#endif
    -
    -
    -extern uint32_t
    -tuklib_cpucores(void)
    -{
    -	uint32_t ret = 0;
    -
    -#if defined(_WIN32) || defined(__CYGWIN__)
    -	SYSTEM_INFO sysinfo;
    -	GetSystemInfo(&sysinfo);
    -	ret = sysinfo.dwNumberOfProcessors;
    -
    -#elif defined(TUKLIB_CPUCORES_CPUSET)
    -	cpuset_t set;
    -	if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID, -1,
    -			sizeof(set), &set) == 0) {
    -#	ifdef CPU_COUNT
    -		ret = CPU_COUNT(&set);
    -#	else
    -		for (unsigned i = 0; i < CPU_SETSIZE; ++i)
    -			if (CPU_ISSET(i, &set))
    -				++ret;
    -#	endif
    -	}
    -
    -#elif defined(TUKLIB_CPUCORES_SYSCTL)
    -	int name[2] = { CTL_HW, HW_NCPU };
    -	int cpus;
    -	size_t cpus_size = sizeof(cpus);
    -	if (sysctl(name, 2, &cpus, &cpus_size, NULL, 0) != -1
    -			&& cpus_size == sizeof(cpus) && cpus > 0)
    -		ret = cpus;
    -
    -#elif defined(TUKLIB_CPUCORES_SYSCONF)
    -#	ifdef _SC_NPROCESSORS_ONLN
    -	// Most systems
    -	const long cpus = sysconf(_SC_NPROCESSORS_ONLN);
    -#	else
    -	// IRIX
    -	const long cpus = sysconf(_SC_NPROC_ONLN);
    -#	endif
    -	if (cpus > 0)
    -		ret = cpus;
    -
    -#elif defined(TUKLIB_CPUCORES_PSTAT_GETDYNAMIC)
    -	struct pst_dynamic pst;
    -	if (pstat_getdynamic(&pst, sizeof(pst), 1, 0) != -1)
    -		ret = pst.psd_proc_cnt;
    -#endif
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_cpucores.h b/external/public-domain/xz/dist/src/common/tuklib_cpucores.h
    deleted file mode 100644
    index be1ce1c17..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_cpucores.h
    +++ /dev/null
    @@ -1,23 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_cpucores.h
    -/// \brief      Get the number of CPU cores online
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_CPUCORES_H
    -#define TUKLIB_CPUCORES_H
    -
    -#include "tuklib_common.h"
    -TUKLIB_DECLS_BEGIN
    -
    -#define tuklib_cpucores TUKLIB_SYMBOL(tuklib_cpucores)
    -extern uint32_t tuklib_cpucores(void);
    -
    -TUKLIB_DECLS_END
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_exit.c b/external/public-domain/xz/dist/src/common/tuklib_exit.c
    deleted file mode 100644
    index c393be64d..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_exit.c
    +++ /dev/null
    @@ -1,57 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_exit.c
    -/// \brief      Close stdout and stderr, and exit
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tuklib_common.h"
    -
    -#include 
    -#include 
    -
    -#include "tuklib_gettext.h"
    -#include "tuklib_progname.h"
    -#include "tuklib_exit.h"
    -
    -
    -extern void
    -tuklib_exit(int status, int err_status, int show_error)
    -{
    -	if (status != err_status) {
    -		// Close stdout. If something goes wrong,
    -		// print an error message to stderr.
    -		const int ferror_err = ferror(stdout);
    -		const int fclose_err = fclose(stdout);
    -		if (ferror_err || fclose_err) {
    -			status = err_status;
    -
    -			// If it was fclose() that failed, we have the reason
    -			// in errno. If only ferror() indicated an error,
    -			// we have no idea what the reason was.
    -			if (show_error)
    -				fprintf(stderr, "%s: %s: %s\n", progname,
    -						_("Writing to standard "
    -							"output failed"),
    -						fclose_err ? strerror(errno)
    -							: _("Unknown error"));
    -		}
    -	}
    -
    -	if (status != err_status) {
    -		// Close stderr. If something goes wrong, there's
    -		// nothing where we could print an error message.
    -		// Just set the exit status.
    -		const int ferror_err = ferror(stderr);
    -		const int fclose_err = fclose(stderr);
    -		if (fclose_err || ferror_err)
    -			status = err_status;
    -	}
    -
    -	exit(status);
    -}
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_exit.h b/external/public-domain/xz/dist/src/common/tuklib_exit.h
    deleted file mode 100644
    index b11776f0e..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_exit.h
    +++ /dev/null
    @@ -1,25 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_exit.h
    -/// \brief      Close stdout and stderr, and exit
    -/// \note       Requires tuklib_progname and tuklib_gettext modules
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_EXIT_H
    -#define TUKLIB_EXIT_H
    -
    -#include "tuklib_common.h"
    -TUKLIB_DECLS_BEGIN
    -
    -#define tuklib_exit TUKLIB_SYMBOL(tuklib_exit)
    -extern void tuklib_exit(int status, int err_status, int show_error)
    -		tuklib_attr_noreturn;
    -
    -TUKLIB_DECLS_END
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_gettext.h b/external/public-domain/xz/dist/src/common/tuklib_gettext.h
    deleted file mode 100644
    index ff1890407..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_gettext.h
    +++ /dev/null
    @@ -1,44 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_gettext.h
    -/// \brief      Wrapper for gettext and friends
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_GETTEXT_H
    -#define TUKLIB_GETTEXT_H
    -
    -#include "tuklib_common.h"
    -#include 
    -
    -#ifndef TUKLIB_GETTEXT
    -#	ifdef ENABLE_NLS
    -#		define TUKLIB_GETTEXT 1
    -#	else
    -#		define TUKLIB_GETTEXT 0
    -#	endif
    -#endif
    -
    -#if TUKLIB_GETTEXT
    -#	include 
    -#	define tuklib_gettext_init(package, localedir) \
    -		do { \
    -			setlocale(LC_ALL, ""); \
    -			bindtextdomain(package, localedir); \
    -			textdomain(package); \
    -		} while (0)
    -#	define _(msgid) gettext(msgid)
    -#else
    -#	define tuklib_gettext_init(package, localedir) \
    -		setlocale(LC_ALL, "")
    -#	define _(msgid) (msgid)
    -#	define ngettext(msgid1, msgid2, n) ((n) == 1 ? (msgid1) : (msgid2))
    -#endif
    -#define N_(msgid) msgid
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_integer.h b/external/public-domain/xz/dist/src/common/tuklib_integer.h
    deleted file mode 100644
    index a7fda6796..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_integer.h
    +++ /dev/null
    @@ -1,523 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_integer.h
    -/// \brief      Various integer and bit operations
    -///
    -/// This file provides macros or functions to do some basic integer and bit
    -/// operations.
    -///
    -/// Endianness related integer operations (XX = 16, 32, or 64; Y = b or l):
    -///   - Byte swapping: bswapXX(num)
    -///   - Byte order conversions to/from native: convXXYe(num)
    -///   - Aligned reads: readXXYe(ptr)
    -///   - Aligned writes: writeXXYe(ptr, num)
    -///   - Unaligned reads (16/32-bit only): unaligned_readXXYe(ptr)
    -///   - Unaligned writes (16/32-bit only): unaligned_writeXXYe(ptr, num)
    -///
    -/// Since they can macros, the arguments should have no side effects since
    -/// they may be evaluated more than once.
    -///
    -/// \todo       PowerPC and possibly some other architectures support
    -///             byte swapping load and store instructions. This file
    -///             doesn't take advantage of those instructions.
    -///
    -/// Bit scan operations for non-zero 32-bit integers:
    -///   - Bit scan reverse (find highest non-zero bit): bsr32(num)
    -///   - Count leading zeros: clz32(num)
    -///   - Count trailing zeros: ctz32(num)
    -///   - Bit scan forward (simply an alias for ctz32()): bsf32(num)
    -///
    -/// The above bit scan operations return 0-31. If num is zero,
    -/// the result is undefined.
    -//
    -//  Authors:    Lasse Collin
    -//              Joachim Henke
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_INTEGER_H
    -#define TUKLIB_INTEGER_H
    -
    -#include "tuklib_common.h"
    -
    -
    -////////////////////////////////////////
    -// Operating system specific features //
    -////////////////////////////////////////
    -
    -#if defined(HAVE_BYTESWAP_H)
    -	// glibc, uClibc, dietlibc
    -#	include 
    -#	ifdef HAVE_BSWAP_16
    -#		define bswap16(num) bswap_16(num)
    -#	endif
    -#	ifdef HAVE_BSWAP_32
    -#		define bswap32(num) bswap_32(num)
    -#	endif
    -#	ifdef HAVE_BSWAP_64
    -#		define bswap64(num) bswap_64(num)
    -#	endif
    -
    -#elif defined(HAVE_SYS_ENDIAN_H)
    -	// *BSDs and Darwin
    -#	include 
    -
    -#elif defined(HAVE_SYS_BYTEORDER_H)
    -	// Solaris
    -#	include 
    -#	ifdef BSWAP_16
    -#		define bswap16(num) BSWAP_16(num)
    -#	endif
    -#	ifdef BSWAP_32
    -#		define bswap32(num) BSWAP_32(num)
    -#	endif
    -#	ifdef BSWAP_64
    -#		define bswap64(num) BSWAP_64(num)
    -#	endif
    -#	ifdef BE_16
    -#		define conv16be(num) BE_16(num)
    -#	endif
    -#	ifdef BE_32
    -#		define conv32be(num) BE_32(num)
    -#	endif
    -#	ifdef BE_64
    -#		define conv64be(num) BE_64(num)
    -#	endif
    -#	ifdef LE_16
    -#		define conv16le(num) LE_16(num)
    -#	endif
    -#	ifdef LE_32
    -#		define conv32le(num) LE_32(num)
    -#	endif
    -#	ifdef LE_64
    -#		define conv64le(num) LE_64(num)
    -#	endif
    -#endif
    -
    -
    -///////////////////
    -// Byte swapping //
    -///////////////////
    -
    -#ifndef bswap16
    -#	define bswap16(num) \
    -		(((uint16_t)(num) << 8) | ((uint16_t)(num) >> 8))
    -#endif
    -
    -#ifndef bswap32
    -#	define bswap32(num) \
    -		( (((uint32_t)(num) << 24)                       ) \
    -		| (((uint32_t)(num) <<  8) & UINT32_C(0x00FF0000)) \
    -		| (((uint32_t)(num) >>  8) & UINT32_C(0x0000FF00)) \
    -		| (((uint32_t)(num) >> 24)                       ) )
    -#endif
    -
    -#ifndef bswap64
    -#	define bswap64(num) \
    -		( (((uint64_t)(num) << 56)                               ) \
    -		| (((uint64_t)(num) << 40) & UINT64_C(0x00FF000000000000)) \
    -		| (((uint64_t)(num) << 24) & UINT64_C(0x0000FF0000000000)) \
    -		| (((uint64_t)(num) <<  8) & UINT64_C(0x000000FF00000000)) \
    -		| (((uint64_t)(num) >>  8) & UINT64_C(0x00000000FF000000)) \
    -		| (((uint64_t)(num) >> 24) & UINT64_C(0x0000000000FF0000)) \
    -		| (((uint64_t)(num) >> 40) & UINT64_C(0x000000000000FF00)) \
    -		| (((uint64_t)(num) >> 56)                               ) )
    -#endif
    -
    -// Define conversion macros using the basic byte swapping macros.
    -#ifdef WORDS_BIGENDIAN
    -#	ifndef conv16be
    -#		define conv16be(num) ((uint16_t)(num))
    -#	endif
    -#	ifndef conv32be
    -#		define conv32be(num) ((uint32_t)(num))
    -#	endif
    -#	ifndef conv64be
    -#		define conv64be(num) ((uint64_t)(num))
    -#	endif
    -#	ifndef conv16le
    -#		define conv16le(num) bswap16(num)
    -#	endif
    -#	ifndef conv32le
    -#		define conv32le(num) bswap32(num)
    -#	endif
    -#	ifndef conv64le
    -#		define conv64le(num) bswap64(num)
    -#	endif
    -#else
    -#	ifndef conv16be
    -#		define conv16be(num) bswap16(num)
    -#	endif
    -#	ifndef conv32be
    -#		define conv32be(num) bswap32(num)
    -#	endif
    -#	ifndef conv64be
    -#		define conv64be(num) bswap64(num)
    -#	endif
    -#	ifndef conv16le
    -#		define conv16le(num) ((uint16_t)(num))
    -#	endif
    -#	ifndef conv32le
    -#		define conv32le(num) ((uint32_t)(num))
    -#	endif
    -#	ifndef conv64le
    -#		define conv64le(num) ((uint64_t)(num))
    -#	endif
    -#endif
    -
    -
    -//////////////////////////////
    -// Aligned reads and writes //
    -//////////////////////////////
    -
    -static inline uint16_t
    -read16be(const uint8_t *buf)
    -{
    -	uint16_t num = *(const uint16_t *)buf;
    -	return conv16be(num);
    -}
    -
    -
    -static inline uint16_t
    -read16le(const uint8_t *buf)
    -{
    -	uint16_t num = *(const uint16_t *)buf;
    -	return conv16le(num);
    -}
    -
    -
    -static inline uint32_t
    -read32be(const uint8_t *buf)
    -{
    -	uint32_t num = *(const uint32_t *)buf;
    -	return conv32be(num);
    -}
    -
    -
    -static inline uint32_t
    -read32le(const uint8_t *buf)
    -{
    -	uint32_t num = *(const uint32_t *)buf;
    -	return conv32le(num);
    -}
    -
    -
    -static inline uint64_t
    -read64be(const uint8_t *buf)
    -{
    -	uint64_t num = *(const uint64_t *)buf;
    -	return conv64be(num);
    -}
    -
    -
    -static inline uint64_t
    -read64le(const uint8_t *buf)
    -{
    -	uint64_t num = *(const uint64_t *)buf;
    -	return conv64le(num);
    -}
    -
    -
    -// NOTE: Possible byte swapping must be done in a macro to allow GCC
    -// to optimize byte swapping of constants when using glibc's or *BSD's
    -// byte swapping macros. The actual write is done in an inline function
    -// to make type checking of the buf pointer possible similarly to readXXYe()
    -// functions.
    -
    -#define write16be(buf, num) write16ne((buf), conv16be(num))
    -#define write16le(buf, num) write16ne((buf), conv16le(num))
    -#define write32be(buf, num) write32ne((buf), conv32be(num))
    -#define write32le(buf, num) write32ne((buf), conv32le(num))
    -#define write64be(buf, num) write64ne((buf), conv64be(num))
    -#define write64le(buf, num) write64ne((buf), conv64le(num))
    -
    -
    -static inline void
    -write16ne(uint8_t *buf, uint16_t num)
    -{
    -	*(uint16_t *)buf = num;
    -	return;
    -}
    -
    -
    -static inline void
    -write32ne(uint8_t *buf, uint32_t num)
    -{
    -	*(uint32_t *)buf = num;
    -	return;
    -}
    -
    -
    -static inline void
    -write64ne(uint8_t *buf, uint64_t num)
    -{
    -	*(uint64_t *)buf = num;
    -	return;
    -}
    -
    -
    -////////////////////////////////
    -// Unaligned reads and writes //
    -////////////////////////////////
    -
    -// NOTE: TUKLIB_FAST_UNALIGNED_ACCESS indicates only support for 16-bit and
    -// 32-bit unaligned integer loads and stores. It's possible that 64-bit
    -// unaligned access doesn't work or is slower than byte-by-byte access.
    -// Since unaligned 64-bit is probably not needed as often as 16-bit or
    -// 32-bit, we simply don't support 64-bit unaligned access for now.
    -#ifdef TUKLIB_FAST_UNALIGNED_ACCESS
    -#	define unaligned_read16be read16be
    -#	define unaligned_read16le read16le
    -#	define unaligned_read32be read32be
    -#	define unaligned_read32le read32le
    -#	define unaligned_write16be write16be
    -#	define unaligned_write16le write16le
    -#	define unaligned_write32be write32be
    -#	define unaligned_write32le write32le
    -
    -#else
    -
    -static inline uint16_t
    -unaligned_read16be(const uint8_t *buf)
    -{
    -	uint16_t num = ((uint16_t)buf[0] << 8) | (uint16_t)buf[1];
    -	return num;
    -}
    -
    -
    -static inline uint16_t
    -unaligned_read16le(const uint8_t *buf)
    -{
    -	uint16_t num = ((uint16_t)buf[0]) | ((uint16_t)buf[1] << 8);
    -	return num;
    -}
    -
    -
    -static inline uint32_t
    -unaligned_read32be(const uint8_t *buf)
    -{
    -	uint32_t num = (uint32_t)buf[0] << 24;
    -	num |= (uint32_t)buf[1] << 16;
    -	num |= (uint32_t)buf[2] << 8;
    -	num |= (uint32_t)buf[3];
    -	return num;
    -}
    -
    -
    -static inline uint32_t
    -unaligned_read32le(const uint8_t *buf)
    -{
    -	uint32_t num = (uint32_t)buf[0];
    -	num |= (uint32_t)buf[1] << 8;
    -	num |= (uint32_t)buf[2] << 16;
    -	num |= (uint32_t)buf[3] << 24;
    -	return num;
    -}
    -
    -
    -static inline void
    -unaligned_write16be(uint8_t *buf, uint16_t num)
    -{
    -	buf[0] = (uint8_t)(num >> 8);
    -	buf[1] = (uint8_t)num;
    -	return;
    -}
    -
    -
    -static inline void
    -unaligned_write16le(uint8_t *buf, uint16_t num)
    -{
    -	buf[0] = (uint8_t)num;
    -	buf[1] = (uint8_t)(num >> 8);
    -	return;
    -}
    -
    -
    -static inline void
    -unaligned_write32be(uint8_t *buf, uint32_t num)
    -{
    -	buf[0] = (uint8_t)(num >> 24);
    -	buf[1] = (uint8_t)(num >> 16);
    -	buf[2] = (uint8_t)(num >> 8);
    -	buf[3] = (uint8_t)num;
    -	return;
    -}
    -
    -
    -static inline void
    -unaligned_write32le(uint8_t *buf, uint32_t num)
    -{
    -	buf[0] = (uint8_t)num;
    -	buf[1] = (uint8_t)(num >> 8);
    -	buf[2] = (uint8_t)(num >> 16);
    -	buf[3] = (uint8_t)(num >> 24);
    -	return;
    -}
    -
    -#endif
    -
    -
    -static inline uint32_t
    -bsr32(uint32_t n)
    -{
    -	// Check for ICC first, since it tends to define __GNUC__ too.
    -#if defined(__INTEL_COMPILER)
    -	return _bit_scan_reverse(n);
    -
    -#elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX == UINT32_MAX
    -	// GCC >= 3.4 has __builtin_clz(), which gives good results on
    -	// multiple architectures. On x86, __builtin_clz() ^ 31U becomes
    -	// either plain BSR (so the XOR gets optimized away) or LZCNT and
    -	// XOR (if -march indicates that SSE4a instructions are supported).
    -	return __builtin_clz(n) ^ 31U;
    -
    -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
    -	uint32_t i;
    -	__asm__("bsrl %1, %0" : "=r" (i) : "rm" (n));
    -	return i;
    -
    -#elif defined(_MSC_VER) && _MSC_VER >= 1400
    -	// MSVC isn't supported by tuklib, but since this code exists,
    -	// it doesn't hurt to have it here anyway.
    -	uint32_t i;
    -	_BitScanReverse((DWORD *)&i, n);
    -	return i;
    -
    -#else
    -	uint32_t i = 31;
    -
    -	if ((n & UINT32_C(0xFFFF0000)) == 0) {
    -		n <<= 16;
    -		i = 15;
    -	}
    -
    -	if ((n & UINT32_C(0xFF000000)) == 0) {
    -		n <<= 8;
    -		i -= 8;
    -	}
    -
    -	if ((n & UINT32_C(0xF0000000)) == 0) {
    -		n <<= 4;
    -		i -= 4;
    -	}
    -
    -	if ((n & UINT32_C(0xC0000000)) == 0) {
    -		n <<= 2;
    -		i -= 2;
    -	}
    -
    -	if ((n & UINT32_C(0x80000000)) == 0)
    -		--i;
    -
    -	return i;
    -#endif
    -}
    -
    -
    -static inline uint32_t
    -clz32(uint32_t n)
    -{
    -#if defined(__INTEL_COMPILER)
    -	return _bit_scan_reverse(n) ^ 31U;
    -
    -#elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX == UINT32_MAX
    -	return __builtin_clz(n);
    -
    -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
    -	uint32_t i;
    -	__asm__("bsrl %1, %0\n\t"
    -		"xorl $31, %0"
    -		: "=r" (i) : "rm" (n));
    -	return i;
    -
    -#elif defined(_MSC_VER) && _MSC_VER >= 1400
    -	uint32_t i;
    -	_BitScanReverse((DWORD *)&i, n);
    -	return i ^ 31U;
    -
    -#else
    -	uint32_t i = 0;
    -
    -	if ((n & UINT32_C(0xFFFF0000)) == 0) {
    -		n <<= 16;
    -		i = 16;
    -	}
    -
    -	if ((n & UINT32_C(0xFF000000)) == 0) {
    -		n <<= 8;
    -		i += 8;
    -	}
    -
    -	if ((n & UINT32_C(0xF0000000)) == 0) {
    -		n <<= 4;
    -		i += 4;
    -	}
    -
    -	if ((n & UINT32_C(0xC0000000)) == 0) {
    -		n <<= 2;
    -		i += 2;
    -	}
    -
    -	if ((n & UINT32_C(0x80000000)) == 0)
    -		++i;
    -
    -	return i;
    -#endif
    -}
    -
    -
    -static inline uint32_t
    -ctz32(uint32_t n)
    -{
    -#if defined(__INTEL_COMPILER)
    -	return _bit_scan_forward(n);
    -
    -#elif TUKLIB_GNUC_REQ(3, 4) && UINT_MAX >= UINT32_MAX
    -	return __builtin_ctz(n);
    -
    -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
    -	uint32_t i;
    -	__asm__("bsfl %1, %0" : "=r" (i) : "rm" (n));
    -	return i;
    -
    -#elif defined(_MSC_VER) && _MSC_VER >= 1400
    -	uint32_t i;
    -	_BitScanForward((DWORD *)&i, n);
    -	return i;
    -
    -#else
    -	uint32_t i = 0;
    -
    -	if ((n & UINT32_C(0x0000FFFF)) == 0) {
    -		n >>= 16;
    -		i = 16;
    -	}
    -
    -	if ((n & UINT32_C(0x000000FF)) == 0) {
    -		n >>= 8;
    -		i += 8;
    -	}
    -
    -	if ((n & UINT32_C(0x0000000F)) == 0) {
    -		n >>= 4;
    -		i += 4;
    -	}
    -
    -	if ((n & UINT32_C(0x00000003)) == 0) {
    -		n >>= 2;
    -		i += 2;
    -	}
    -
    -	if ((n & UINT32_C(0x00000001)) == 0)
    -		++i;
    -
    -	return i;
    -#endif
    -}
    -
    -#define bsf32 ctz32
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_mbstr.h b/external/public-domain/xz/dist/src/common/tuklib_mbstr.h
    deleted file mode 100644
    index 9f3583551..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_mbstr.h
    +++ /dev/null
    @@ -1,66 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_mstr.h
    -/// \brief      Utility functions for handling multibyte strings
    -///
    -/// If not enough multibyte string support is available in the C library,
    -/// these functions keep working with the assumption that all strings
    -/// are in a single-byte character set without combining characters, e.g.
    -/// US-ASCII or ISO-8859-*.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_MBSTR_H
    -#define TUKLIB_MBSTR_H
    -
    -#include "tuklib_common.h"
    -TUKLIB_DECLS_BEGIN
    -
    -#define tuklib_mbstr_width TUKLIB_SYMBOL(tuklib_mbstr_width)
    -extern size_t tuklib_mbstr_width(const char *str, size_t *bytes);
    -///<
    -/// \brief      Get the number of columns needed for the multibyte string
    -///
    -/// This is somewhat similar to wcswidth() but works on multibyte strings.
    -///
    -/// \param      str         String whose width is to be calculated. If the
    -///                         current locale uses a multibyte character set
    -///                         that has shift states, the string must begin
    -///                         and end in the initial shift state.
    -/// \param      bytes       If this is not NULL, *bytes is set to the
    -///                         value returned by strlen(str) (even if an
    -///                         error occurs when calculating the width).
    -///
    -/// \return     On success, the number of columns needed to display the
    -///             string e.g. in a terminal emulator is returned. On error,
    -///             (size_t)-1 is returned. Possible errors include invalid,
    -///             partial, or non-printable multibyte character in str, or
    -///             that str doesn't end in the initial shift state.
    -
    -#define tuklib_mbstr_fw TUKLIB_SYMBOL(tuklib_mbstr_fw)
    -extern int tuklib_mbstr_fw(const char *str, int columns_min);
    -///<
    -/// \brief      Get the field width for printf() e.g. to align table columns
    -///
    -/// Printing simple tables to a terminal can be done using the field field
    -/// feature in the printf() format string, but it works only with single-byte
    -/// character sets. To do the same with multibyte strings, tuklib_mbstr_fw()
    -/// can be used to calculate appropriate field width.
    -///
    -/// The behavior of this function is undefined, if
    -///   - str is NULL or not terminated with '\0';
    -///   - columns_min <= 0; or
    -///   - the calculated field width exceeds INT_MAX.
    -///
    -/// \return     If tuklib_mbstr_width(str, NULL) fails, -1 is returned.
    -///             If str needs more columns than columns_min, zero is returned.
    -///             Otherwise a positive integer is returned, which can be
    -///             used as the field width, e.g. printf("%*s", fw, str).
    -
    -TUKLIB_DECLS_END
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_mbstr_fw.c b/external/public-domain/xz/dist/src/common/tuklib_mbstr_fw.c
    deleted file mode 100644
    index 978a3fe10..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_mbstr_fw.c
    +++ /dev/null
    @@ -1,31 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_mstr_fw.c
    -/// \brief      Get the field width for printf() e.g. to align table columns
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tuklib_mbstr.h"
    -
    -
    -extern int
    -tuklib_mbstr_fw(const char *str, int columns_min)
    -{
    -	size_t len;
    -	const size_t width = tuklib_mbstr_width(str, &len);
    -	if (width == (size_t)-1)
    -		return -1;
    -
    -	if (width > (size_t)columns_min)
    -		return 0;
    -
    -	if (width < (size_t)columns_min)
    -		len += (size_t)columns_min - width;
    -
    -	return len;
    -}
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_mbstr_width.c b/external/public-domain/xz/dist/src/common/tuklib_mbstr_width.c
    deleted file mode 100644
    index 3c38990f4..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_mbstr_width.c
    +++ /dev/null
    @@ -1,64 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_mstr_width.c
    -/// \brief      Calculate width of a multibyte string
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tuklib_mbstr.h"
    -
    -#if defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH)
    -#	include 
    -#endif
    -
    -
    -extern size_t
    -tuklib_mbstr_width(const char *str, size_t *bytes)
    -{
    -	const size_t len = strlen(str);
    -	if (bytes != NULL)
    -		*bytes = len;
    -
    -#if !(defined(HAVE_MBRTOWC) && defined(HAVE_WCWIDTH))
    -	// In single-byte mode, the width of the string is the same
    -	// as its length.
    -	return len;
    -
    -#else
    -	mbstate_t state;
    -	memset(&state, 0, sizeof(state));
    -
    -	size_t width = 0;
    -	size_t i = 0;
    -
    -	// Convert one multibyte character at a time to wchar_t
    -	// and get its width using wcwidth().
    -	while (i < len) {
    -		wchar_t wc;
    -		const size_t ret = mbrtowc(&wc, str + i, len - i, &state);
    -		if (ret < 1 || ret > len)
    -			return (size_t)-1;
    -
    -		i += ret;
    -
    -		const int wc_width = wcwidth(wc);
    -		if (wc_width < 0)
    -			return (size_t)-1;
    -
    -		width += wc_width;
    -	}
    -
    -	// Require that the string ends in the initial shift state.
    -	// This way the caller can be combine the string with other
    -	// strings without needing to worry about the shift states.
    -	if (!mbsinit(&state))
    -		return (size_t)-1;
    -
    -	return width;
    -#endif
    -}
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_open_stdxxx.c b/external/public-domain/xz/dist/src/common/tuklib_open_stdxxx.c
    deleted file mode 100644
    index 26702a6af..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_open_stdxxx.c
    +++ /dev/null
    @@ -1,57 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_open_stdxxx.c
    -/// \brief      Make sure that file descriptors 0, 1, and 2 are open
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tuklib_open_stdxxx.h"
    -
    -#ifndef TUKLIB_DOSLIKE
    -#	include 
    -#	include 
    -#	include 
    -#	include 
    -#endif
    -
    -
    -extern void
    -tuklib_open_stdxxx(int err_status)
    -{
    -#ifdef TUKLIB_DOSLIKE
    -	// Do nothing, just silence warnings.
    -	(void)err_status;
    -
    -#else
    -	for (int i = 0; i <= 2; ++i) {
    -		// We use fcntl() to check if the file descriptor is open.
    -		if (fcntl(i, F_GETFD) == -1 && errno == EBADF) {
    -			// With stdin, we could use /dev/full so that
    -			// writing to stdin would fail. However, /dev/full
    -			// is Linux specific, and if the program tries to
    -			// write to stdin, there's already a problem anyway.
    -			const int fd = open("/dev/null", O_NOCTTY
    -					| (i == 0 ? O_WRONLY : O_RDONLY));
    -
    -			if (fd != i) {
    -				if (fd != -1)
    -					(void)close(fd);
    -
    -				// Something went wrong. Exit with the
    -				// exit status we were given. Don't try
    -				// to print an error message, since stderr
    -				// may very well be non-existent. This
    -				// error should be extremely rare.
    -				exit(err_status);
    -			}
    -		}
    -	}
    -#endif
    -
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_open_stdxxx.h b/external/public-domain/xz/dist/src/common/tuklib_open_stdxxx.h
    deleted file mode 100644
    index b91161609..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_open_stdxxx.h
    +++ /dev/null
    @@ -1,23 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_open_stdxxx.h
    -/// \brief      Make sure that file descriptors 0, 1, and 2 are open
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_OPEN_STDXXX_H
    -#define TUKLIB_OPEN_STDXXX_H
    -
    -#include "tuklib_common.h"
    -TUKLIB_DECLS_BEGIN
    -
    -#define tuklib_open_stdxx TUKLIB_SYMBOL(tuklib_open_stdxxx)
    -extern void tuklib_open_stdxxx(int err_status);
    -
    -TUKLIB_DECLS_END
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_physmem.c b/external/public-domain/xz/dist/src/common/tuklib_physmem.c
    deleted file mode 100644
    index 3cc7d12a1..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_physmem.c
    +++ /dev/null
    @@ -1,203 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_physmem.c
    -/// \brief      Get the amount of physical memory
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tuklib_physmem.h"
    -
    -// We want to use Windows-specific code on Cygwin, which also has memory
    -// information available via sysconf(), but on Cygwin 1.5 and older it
    -// gives wrong results (from our point of view).
    -#if defined(_WIN32) || defined(__CYGWIN__)
    -#	ifndef _WIN32_WINNT
    -#		define _WIN32_WINNT 0x0500
    -#	endif
    -#	include 
    -
    -#elif defined(__OS2__)
    -#	define INCL_DOSMISC
    -#	include 
    -
    -#elif defined(__DJGPP__)
    -#	include 
    -
    -#elif defined(__VMS)
    -#	include 
    -#	include 
    -#	include 
    -
    -#elif defined(AMIGA) || defined(__AROS__)
    -#	define __USE_INLINE__
    -#	include 
    -
    -// AIX
    -#elif defined(TUKLIB_PHYSMEM_AIX)
    -#	include 
    -
    -#elif defined(TUKLIB_PHYSMEM_SYSCONF)
    -#	include 
    -
    -#elif defined(TUKLIB_PHYSMEM_SYSCTL)
    -#	ifdef HAVE_SYS_PARAM_H
    -#		include 
    -#	endif
    -#	include 
    -
    -// Tru64
    -#elif defined(TUKLIB_PHYSMEM_GETSYSINFO)
    -#	include 
    -#	include 
    -
    -// HP-UX
    -#elif defined(TUKLIB_PHYSMEM_PSTAT_GETSTATIC)
    -#	include 
    -#	include 
    -
    -// IRIX
    -#elif defined(TUKLIB_PHYSMEM_GETINVENT_R)
    -#	include 
    -
    -// This sysinfo() is Linux-specific.
    -#elif defined(TUKLIB_PHYSMEM_SYSINFO)
    -#	include 
    -#endif
    -
    -
    -extern uint64_t
    -tuklib_physmem(void)
    -{
    -	uint64_t ret = 0;
    -
    -#if defined(_WIN32) || defined(__CYGWIN__)
    -	if ((GetVersion() & 0xFF) >= 5) {
    -		// Windows 2000 and later have GlobalMemoryStatusEx() which
    -		// supports reporting values greater than 4 GiB. To keep the
    -		// code working also on older Windows versions, use
    -		// GlobalMemoryStatusEx() conditionally.
    -		HMODULE kernel32 = GetModuleHandle("kernel32.dll");
    -		if (kernel32 != NULL) {
    -			BOOL (WINAPI *gmse)(LPMEMORYSTATUSEX) = GetProcAddress(
    -					kernel32, "GlobalMemoryStatusEx");
    -			if (gmse != NULL) {
    -				MEMORYSTATUSEX meminfo;
    -				meminfo.dwLength = sizeof(meminfo);
    -				if (gmse(&meminfo))
    -					ret = meminfo.ullTotalPhys;
    -			}
    -		}
    -	}
    -
    -	if (ret == 0) {
    -		// GlobalMemoryStatus() is supported by Windows 95 and later,
    -		// so it is fine to link against it unconditionally. Note that
    -		// GlobalMemoryStatus() has no return value.
    -		MEMORYSTATUS meminfo;
    -		meminfo.dwLength = sizeof(meminfo);
    -		GlobalMemoryStatus(&meminfo);
    -		ret = meminfo.dwTotalPhys;
    -	}
    -
    -#elif defined(__OS2__)
    -	unsigned long mem;
    -	if (DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM,
    -			&mem, sizeof(mem)) == 0)
    -		ret = mem;
    -
    -#elif defined(__DJGPP__)
    -	__dpmi_free_mem_info meminfo;
    -	if (__dpmi_get_free_memory_information(&meminfo) == 0
    -			&& meminfo.total_number_of_physical_pages
    -				!= (unsigned long)-1)
    -		ret = (uint64_t)meminfo.total_number_of_physical_pages * 4096;
    -
    -#elif defined(__VMS)
    -	int vms_mem;
    -	int val = SYI$_MEMSIZE;
    -	if (LIB$GETSYI(&val, &vms_mem, 0, 0, 0, 0) == SS$_NORMAL)
    -		ret = (uint64_t)vms_mem * 8192;
    -
    -#elif defined(AMIGA) || defined(__AROS__)
    -	ret = AvailMem(MEMF_TOTAL);
    -
    -#elif defined(TUKLIB_PHYSMEM_AIX)
    -	ret = _system_configuration.physmem;
    -
    -#elif defined(TUKLIB_PHYSMEM_SYSCONF)
    -	const long pagesize = sysconf(_SC_PAGESIZE);
    -	const long pages = sysconf(_SC_PHYS_PAGES);
    -	if (pagesize != -1 && pages != -1)
    -		// According to docs, pagesize * pages can overflow.
    -		// Simple case is 32-bit box with 4 GiB or more RAM,
    -		// which may report exactly 4 GiB of RAM, and "long"
    -		// being 32-bit will overflow. Casting to uint64_t
    -		// hopefully avoids overflows in the near future.
    -		ret = (uint64_t)pagesize * (uint64_t)pages;
    -
    -#elif defined(TUKLIB_PHYSMEM_SYSCTL)
    -	int name[2] = {
    -		CTL_HW,
    -#ifdef HW_PHYSMEM64
    -		HW_PHYSMEM64
    -#else
    -		HW_PHYSMEM
    -#endif
    -	};
    -	union {
    -		uint32_t u32;
    -		uint64_t u64;
    -	} mem;
    -	size_t mem_ptr_size = sizeof(mem.u64);
    -	if (sysctl(name, 2, &mem.u64, &mem_ptr_size, NULL, 0) != -1) {
    -		// IIRC, 64-bit "return value" is possible on some 64-bit
    -		// BSD systems even with HW_PHYSMEM (instead of HW_PHYSMEM64),
    -		// so support both.
    -		if (mem_ptr_size == sizeof(mem.u64))
    -			ret = mem.u64;
    -		else if (mem_ptr_size == sizeof(mem.u32))
    -			ret = mem.u32;
    -	}
    -
    -#elif defined(TUKLIB_PHYSMEM_GETSYSINFO)
    -	// Docs are unclear if "start" is needed, but it doesn't hurt
    -	// much to have it.
    -	int memkb;
    -	int start = 0;
    -	if (getsysinfo(GSI_PHYSMEM, (caddr_t)&memkb, sizeof(memkb), &start)
    -			!= -1)
    -		ret = (uint64_t)memkb * 1024;
    -
    -#elif defined(TUKLIB_PHYSMEM_PSTAT_GETSTATIC)
    -	struct pst_static pst;
    -	if (pstat_getstatic(&pst, sizeof(pst), 1, 0) != -1)
    -		ret = (uint64_t)pst.physical_memory * (uint64_t)pst.page_size;
    -
    -#elif defined(TUKLIB_PHYSMEM_GETINVENT_R)
    -	inv_state_t *st = NULL;
    -	if (setinvent_r(&st) != -1) {
    -		inventory_t *i;
    -		while ((i = getinvent_r(st)) != NULL) {
    -			if (i->inv_class == INV_MEMORY
    -					&& i->inv_type == INV_MAIN_MB) {
    -				ret = (uint64_t)i->inv_state << 20;
    -				break;
    -			}
    -		}
    -
    -		endinvent_r(st);
    -	}
    -
    -#elif defined(TUKLIB_PHYSMEM_SYSINFO)
    -	struct sysinfo si;
    -	if (sysinfo(&si) == 0)
    -		ret = (uint64_t)si.totalram * si.mem_unit;
    -#endif
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_physmem.h b/external/public-domain/xz/dist/src/common/tuklib_physmem.h
    deleted file mode 100644
    index 09e2a5133..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_physmem.h
    +++ /dev/null
    @@ -1,28 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_physmem.h
    -/// \brief      Get the amount of physical memory
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_PHYSMEM_H
    -#define TUKLIB_PHYSMEM_H
    -
    -#include "tuklib_common.h"
    -TUKLIB_DECLS_BEGIN
    -
    -#define tuklib_physmem TUKLIB_SYMBOL(tuklib_physmem)
    -extern uint64_t tuklib_physmem(void);
    -///<
    -/// \brief      Get the amount of physical memory in bytes
    -///
    -/// \return     Amount of physical memory in bytes. On error, zero is
    -///             returned.
    -
    -TUKLIB_DECLS_END
    -#endif
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_progname.c b/external/public-domain/xz/dist/src/common/tuklib_progname.c
    deleted file mode 100644
    index 7cb7e203d..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_progname.c
    +++ /dev/null
    @@ -1,50 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_progname.c
    -/// \brief      Program name to be displayed in messages
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tuklib_progname.h"
    -#include 
    -
    -
    -#if !HAVE_DECL_PROGRAM_INVOCATION_NAME
    -char *progname = NULL;
    -#endif
    -
    -
    -extern void
    -tuklib_progname_init(char **argv)
    -{
    -#ifdef TUKLIB_DOSLIKE
    -	// On these systems, argv[0] always has the full path and .exe
    -	// suffix even if the user just types the plain program name.
    -	// We modify argv[0] to make it nicer to read.
    -
    -	// Strip the leading path.
    -	char *p = argv[0] + strlen(argv[0]);
    -	while (argv[0] < p && p[-1] != '/' && p[-1] != '\\')
    -		--p;
    -
    -	argv[0] = p;
    -
    -	// Strip the .exe suffix.
    -	p = strrchr(p, '.');
    -	if (p != NULL)
    -		*p = '\0';
    -
    -	// Make it lowercase.
    -	for (p = argv[0]; *p != '\0'; ++p)
    -		if (*p >= 'A' && *p <= 'Z')
    -			*p = *p - 'A' + 'a';
    -#endif
    -
    -	progname = argv[0];
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/common/tuklib_progname.h b/external/public-domain/xz/dist/src/common/tuklib_progname.h
    deleted file mode 100644
    index 791b12517..000000000
    --- a/external/public-domain/xz/dist/src/common/tuklib_progname.h
    +++ /dev/null
    @@ -1,32 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tuklib_progname.h
    -/// \brief      Program name to be displayed in messages
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef TUKLIB_PROGNAME_H
    -#define TUKLIB_PROGNAME_H
    -
    -#include "tuklib_common.h"
    -#include 
    -
    -TUKLIB_DECLS_BEGIN
    -
    -#if HAVE_DECL_PROGRAM_INVOCATION_NAME
    -#	define progname program_invocation_name
    -#else
    -#	define progname TUKLIB_SYMBOL(tuklib_progname)
    -	extern char *progname;
    -#endif
    -
    -#define tuklib_progname_init TUKLIB_SYMBOL(tuklib_progname_init)
    -extern void tuklib_progname_init(char **argv);
    -
    -TUKLIB_DECLS_END
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma.h b/external/public-domain/xz/dist/src/liblzma/api/lzma.h
    deleted file mode 100644
    index 72c51b241..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma.h
    +++ /dev/null
    @@ -1,313 +0,0 @@
    -/**
    - * \file        api/lzma.h
    - * \brief       The public API of liblzma data compression library
    - *
    - * liblzma is a public domain general-purpose data compression library with
    - * a zlib-like API. The native file format is .xz, but also the old .lzma
    - * format and raw (no headers) streams are supported. Multiple compression
    - * algorithms (filters) are supported. Currently LZMA2 is the primary filter.
    - *
    - * liblzma is part of XZ Utils . XZ Utils includes
    - * a gzip-like command line tool named xz and some other tools. XZ Utils
    - * is developed and maintained by Lasse Collin.
    - *
    - * Major parts of liblzma are based on Igor Pavlov's public domain LZMA SDK
    - * .
    - *
    - * The SHA-256 implementation is based on the public domain code found from
    - * 7-Zip , which has a modified version of the public
    - * domain SHA-256 code found from Crypto++ .
    - * The SHA-256 code in Crypto++ was written by Kevin Springle and Wei Dai.
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - */
    -
    -#ifndef LZMA_H
    -#define LZMA_H
    -
    -/*****************************
    - * Required standard headers *
    - *****************************/
    -
    -/*
    - * liblzma API headers need some standard types and macros. To allow
    - * including lzma.h without requiring the application to include other
    - * headers first, lzma.h includes the required standard headers unless
    - * they already seem to be included already or if LZMA_MANUAL_HEADERS
    - * has been defined.
    - *
    - * Here's what types and macros are needed and from which headers:
    - *  - stddef.h: size_t, NULL
    - *  - stdint.h: uint8_t, uint32_t, uint64_t, UINT32_C(n), uint64_C(n),
    - *    UINT32_MAX, UINT64_MAX
    - *
    - * However, inttypes.h is a little more portable than stdint.h, although
    - * inttypes.h declares some unneeded things compared to plain stdint.h.
    - *
    - * The hacks below aren't perfect, specifically they assume that inttypes.h
    - * exists and that it typedefs at least uint8_t, uint32_t, and uint64_t,
    - * and that, in case of incomplete inttypes.h, unsigned int is 32-bit.
    - * If the application already takes care of setting up all the types and
    - * macros properly (for example by using gnulib's stdint.h or inttypes.h),
    - * we try to detect that the macros are already defined and don't include
    - * inttypes.h here again. However, you may define LZMA_MANUAL_HEADERS to
    - * force this file to never include any system headers.
    - *
    - * Some could argue that liblzma API should provide all the required types,
    - * for example lzma_uint64, LZMA_UINT64_C(n), and LZMA_UINT64_MAX. This was
    - * seen as an unnecessary mess, since most systems already provide all the
    - * necessary types and macros in the standard headers.
    - *
    - * Note that liblzma API still has lzma_bool, because using stdbool.h would
    - * break C89 and C++ programs on many systems. sizeof(bool) in C99 isn't
    - * necessarily the same as sizeof(bool) in C++.
    - */
    -
    -#ifndef LZMA_MANUAL_HEADERS
    -	/*
    -	 * I suppose this works portably also in C++. Note that in C++,
    -	 * we need to get size_t into the global namespace.
    -	 */
    -#	include 
    -
    -	/*
    -	 * Skip inttypes.h if we already have all the required macros. If we
    -	 * have the macros, we assume that we have the matching typedefs too.
    -	 */
    -#	if !defined(UINT32_C) || !defined(UINT64_C) \
    -			|| !defined(UINT32_MAX) || !defined(UINT64_MAX)
    -		/*
    -		 * MSVC has no C99 support, and thus it cannot be used to
    -		 * compile liblzma. The liblzma API has to still be usable
    -		 * from MSVC, so we need to define the required standard
    -		 * integer types here.
    -		 */
    -#		if defined(_WIN32) && defined(_MSC_VER)
    -			typedef unsigned __int8 uint8_t;
    -			typedef unsigned __int32 uint32_t;
    -			typedef unsigned __int64 uint64_t;
    -#		else
    -			/* Use the standard inttypes.h. */
    -#			ifdef __cplusplus
    -				/*
    -				 * C99 sections 7.18.2 and 7.18.4 specify
    -				 * that C++ implementations define the limit
    -				 * and constant macros only if specifically
    -				 * requested. Note that if you want the
    -				 * format macros (PRIu64 etc.) too, you need
    -				 * to define __STDC_FORMAT_MACROS before
    -				 * including lzma.h, since re-including
    -				 * inttypes.h with __STDC_FORMAT_MACROS
    -				 * defined doesn't necessarily work.
    -				 */
    -#				ifndef __STDC_LIMIT_MACROS
    -#					define __STDC_LIMIT_MACROS 1
    -#				endif
    -#				ifndef __STDC_CONSTANT_MACROS
    -#					define __STDC_CONSTANT_MACROS 1
    -#				endif
    -#			endif
    -
    -#			include 
    -#		endif
    -
    -		/*
    -		 * Some old systems have only the typedefs in inttypes.h, and
    -		 * lack all the macros. For those systems, we need a few more
    -		 * hacks. We assume that unsigned int is 32-bit and unsigned
    -		 * long is either 32-bit or 64-bit. If these hacks aren't
    -		 * enough, the application has to setup the types manually
    -		 * before including lzma.h.
    -		 */
    -#		ifndef UINT32_C
    -#			if defined(_WIN32) && defined(_MSC_VER)
    -#				define UINT32_C(n) n ## UI32
    -#			else
    -#				define UINT32_C(n) n ## U
    -#			endif
    -#		endif
    -
    -#		ifndef UINT64_C
    -#			if defined(_WIN32) && defined(_MSC_VER)
    -#				define UINT64_C(n) n ## UI64
    -#			else
    -				/* Get ULONG_MAX. */
    -#				include 
    -#				if ULONG_MAX == 4294967295UL
    -#					define UINT64_C(n) n ## ULL
    -#				else
    -#					define UINT64_C(n) n ## UL
    -#				endif
    -#			endif
    -#		endif
    -
    -#		ifndef UINT32_MAX
    -#			define UINT32_MAX (UINT32_C(4294967295))
    -#		endif
    -
    -#		ifndef UINT64_MAX
    -#			define UINT64_MAX (UINT64_C(18446744073709551615))
    -#		endif
    -#	endif
    -#endif /* ifdef LZMA_MANUAL_HEADERS */
    -
    -
    -/******************
    - * LZMA_API macro *
    - ******************/
    -
    -/*
    - * Some systems require that the functions and function pointers are
    - * declared specially in the headers. LZMA_API_IMPORT is for importing
    - * symbols and LZMA_API_CALL is to specify the calling convention.
    - *
    - * By default it is assumed that the application will link dynamically
    - * against liblzma. #define LZMA_API_STATIC in your application if you
    - * want to link against static liblzma. If you don't care about portability
    - * to operating systems like Windows, or at least don't care about linking
    - * against static liblzma on them, don't worry about LZMA_API_STATIC. That
    - * is, most developers will never need to use LZMA_API_STATIC.
    - *
    - * The GCC variants are a special case on Windows (Cygwin and MinGW).
    - * We rely on GCC doing the right thing with its auto-import feature,
    - * and thus don't use __declspec(dllimport). This way developers don't
    - * need to worry about LZMA_API_STATIC. Also the calling convention is
    - * omitted on Cygwin but not on MinGW.
    - */
    -#ifndef LZMA_API_IMPORT
    -#	if !defined(LZMA_API_STATIC) && defined(_WIN32) && !defined(__GNUC__)
    -#		define LZMA_API_IMPORT __declspec(dllimport)
    -#	else
    -#		define LZMA_API_IMPORT
    -#	endif
    -#endif
    -
    -#ifndef LZMA_API_CALL
    -#	if defined(_WIN32) && !defined(__CYGWIN__)
    -#		define LZMA_API_CALL __cdecl
    -#	else
    -#		define LZMA_API_CALL
    -#	endif
    -#endif
    -
    -#ifndef LZMA_API
    -#	define LZMA_API(type) LZMA_API_IMPORT type LZMA_API_CALL
    -#endif
    -
    -
    -/***********
    - * nothrow *
    - ***********/
    -
    -/*
    - * None of the functions in liblzma may throw an exception. Even
    - * the functions that use callback functions won't throw exceptions,
    - * because liblzma would break if a callback function threw an exception.
    - */
    -#ifndef lzma_nothrow
    -#	if defined(__cplusplus)
    -#		define lzma_nothrow throw()
    -#	elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 3)
    -#		define lzma_nothrow __attribute__((__nothrow__))
    -#	else
    -#		define lzma_nothrow
    -#	endif
    -#endif
    -
    -
    -/********************
    - * GNU C extensions *
    - ********************/
    -
    -/*
    - * GNU C extensions are used conditionally in the public API. It doesn't
    - * break anything if these are sometimes enabled and sometimes not, only
    - * affects warnings and optimizations.
    - */
    -#if __GNUC__ >= 3
    -#	ifndef lzma_attribute
    -#		define lzma_attribute(attr) __attribute__(attr)
    -#	endif
    -
    -	/* warn_unused_result was added in GCC 3.4. */
    -#	ifndef lzma_attr_warn_unused_result
    -#		if __GNUC__ == 3 && __GNUC_MINOR__ < 4
    -#			define lzma_attr_warn_unused_result
    -#		endif
    -#	endif
    -
    -#else
    -#	ifndef lzma_attribute
    -#		define lzma_attribute(attr)
    -#	endif
    -#endif
    -
    -
    -#ifndef lzma_attr_pure
    -#	define lzma_attr_pure lzma_attribute((__pure__))
    -#endif
    -
    -#ifndef lzma_attr_const
    -#	define lzma_attr_const lzma_attribute((__const__))
    -#endif
    -
    -#ifndef lzma_attr_warn_unused_result
    -#	define lzma_attr_warn_unused_result \
    -		lzma_attribute((__warn_unused_result__))
    -#endif
    -
    -
    -/**************
    - * Subheaders *
    - **************/
    -
    -#ifdef __cplusplus
    -extern "C" {
    -#endif
    -
    -/*
    - * Subheaders check that this is defined. It is to prevent including
    - * them directly from applications.
    - */
    -#define LZMA_H_INTERNAL 1
    -
    -/* Basic features */
    -#include "lzma/version.h"
    -#include "lzma/base.h"
    -#include "lzma/vli.h"
    -#include "lzma/check.h"
    -
    -/* Filters */
    -#include "lzma/filter.h"
    -#include "lzma/bcj.h"
    -#include "lzma/delta.h"
    -#include "lzma/lzma12.h"
    -
    -/* Container formats */
    -#include "lzma/container.h"
    -
    -/* Advanced features */
    -#include "lzma/stream_flags.h"
    -#include "lzma/block.h"
    -#include "lzma/index.h"
    -#include "lzma/index_hash.h"
    -
    -/* Hardware information */
    -#include "lzma/hardware.h"
    -
    -/*
    - * All subheaders included. Undefine LZMA_H_INTERNAL to prevent applications
    - * re-including the subheaders.
    - */
    -#undef LZMA_H_INTERNAL
    -
    -#ifdef __cplusplus
    -}
    -#endif
    -
    -#endif /* ifndef LZMA_H */
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/base.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/base.h
    deleted file mode 100644
    index 7a31a4205..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/base.h
    +++ /dev/null
    @@ -1,654 +0,0 @@
    -/**
    - * \file        lzma/base.h
    - * \brief       Data types and functions used in many places in liblzma API
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Boolean
    - *
    - * This is here because C89 doesn't have stdbool.h. To set a value for
    - * variables having type lzma_bool, you can use
    - *   - C99's `true' and `false' from stdbool.h;
    - *   - C++'s internal `true' and `false'; or
    - *   - integers one (true) and zero (false).
    - */
    -typedef unsigned char lzma_bool;
    -
    -
    -/**
    - * \brief       Type of reserved enumeration variable in structures
    - *
    - * To avoid breaking library ABI when new features are added, several
    - * structures contain extra variables that may be used in future. Since
    - * sizeof(enum) can be different than sizeof(int), and sizeof(enum) may
    - * even vary depending on the range of enumeration constants, we specify
    - * a separate type to be used for reserved enumeration variables. All
    - * enumeration constants in liblzma API will be non-negative and less
    - * than 128, which should guarantee that the ABI won't break even when
    - * new constants are added to existing enumerations.
    - */
    -typedef enum {
    -	LZMA_RESERVED_ENUM      = 0
    -} lzma_reserved_enum;
    -
    -
    -/**
    - * \brief       Return values used by several functions in liblzma
    - *
    - * Check the descriptions of specific functions to find out which return
    - * values they can return. With some functions the return values may have
    - * more specific meanings than described here; those differences are
    - * described per-function basis.
    - */
    -typedef enum {
    -	LZMA_OK                 = 0,
    -		/**<
    -		 * \brief       Operation completed successfully
    -		 */
    -
    -	LZMA_STREAM_END         = 1,
    -		/**<
    -		 * \brief       End of stream was reached
    -		 *
    -		 * In encoder, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, or
    -		 * LZMA_FINISH was finished. In decoder, this indicates
    -		 * that all the data was successfully decoded.
    -		 *
    -		 * In all cases, when LZMA_STREAM_END is returned, the last
    -		 * output bytes should be picked from strm->next_out.
    -		 */
    -
    -	LZMA_NO_CHECK           = 2,
    -		/**<
    -		 * \brief       Input stream has no integrity check
    -		 *
    -		 * This return value can be returned only if the
    -		 * LZMA_TELL_NO_CHECK flag was used when initializing
    -		 * the decoder. LZMA_NO_CHECK is just a warning, and
    -		 * the decoding can be continued normally.
    -		 *
    -		 * It is possible to call lzma_get_check() immediately after
    -		 * lzma_code has returned LZMA_NO_CHECK. The result will
    -		 * naturally be LZMA_CHECK_NONE, but the possibility to call
    -		 * lzma_get_check() may be convenient in some applications.
    -		 */
    -
    -	LZMA_UNSUPPORTED_CHECK  = 3,
    -		/**<
    -		 * \brief       Cannot calculate the integrity check
    -		 *
    -		 * The usage of this return value is different in encoders
    -		 * and decoders.
    -		 *
    -		 * Encoders can return this value only from the initialization
    -		 * function. If initialization fails with this value, the
    -		 * encoding cannot be done, because there's no way to produce
    -		 * output with the correct integrity check.
    -		 *
    -		 * Decoders can return this value only from lzma_code() and
    -		 * only if the LZMA_TELL_UNSUPPORTED_CHECK flag was used when
    -		 * initializing the decoder. The decoding can still be
    -		 * continued normally even if the check type is unsupported,
    -		 * but naturally the check will not be validated, and possible
    -		 * errors may go undetected.
    -		 *
    -		 * With decoder, it is possible to call lzma_get_check()
    -		 * immediately after lzma_code() has returned
    -		 * LZMA_UNSUPPORTED_CHECK. This way it is possible to find
    -		 * out what the unsupported Check ID was.
    -		 */
    -
    -	LZMA_GET_CHECK          = 4,
    -		/**<
    -		 * \brief       Integrity check type is now available
    -		 *
    -		 * This value can be returned only by the lzma_code() function
    -		 * and only if the decoder was initialized with the
    -		 * LZMA_TELL_ANY_CHECK flag. LZMA_GET_CHECK tells the
    -		 * application that it may now call lzma_get_check() to find
    -		 * out the Check ID. This can be used, for example, to
    -		 * implement a decoder that accepts only files that have
    -		 * strong enough integrity check.
    -		 */
    -
    -	LZMA_MEM_ERROR          = 5,
    -		/**<
    -		 * \brief       Cannot allocate memory
    -		 *
    -		 * Memory allocation failed, or the size of the allocation
    -		 * would be greater than SIZE_MAX.
    -		 *
    -		 * Due to internal implementation reasons, the coding cannot
    -		 * be continued even if more memory were made available after
    -		 * LZMA_MEM_ERROR.
    -		 */
    -
    -	LZMA_MEMLIMIT_ERROR     = 6,
    -		/**
    -		 * \brief       Memory usage limit was reached
    -		 *
    -		 * Decoder would need more memory than allowed by the
    -		 * specified memory usage limit. To continue decoding,
    -		 * the memory usage limit has to be increased with
    -		 * lzma_memlimit_set().
    -		 */
    -
    -	LZMA_FORMAT_ERROR       = 7,
    -		/**<
    -		 * \brief       File format not recognized
    -		 *
    -		 * The decoder did not recognize the input as supported file
    -		 * format. This error can occur, for example, when trying to
    -		 * decode .lzma format file with lzma_stream_decoder,
    -		 * because lzma_stream_decoder accepts only the .xz format.
    -		 */
    -
    -	LZMA_OPTIONS_ERROR      = 8,
    -		/**<
    -		 * \brief       Invalid or unsupported options
    -		 *
    -		 * Invalid or unsupported options, for example
    -		 *  - unsupported filter(s) or filter options; or
    -		 *  - reserved bits set in headers (decoder only).
    -		 *
    -		 * Rebuilding liblzma with more features enabled, or
    -		 * upgrading to a newer version of liblzma may help.
    -		 */
    -
    -	LZMA_DATA_ERROR         = 9,
    -		/**<
    -		 * \brief       Data is corrupt
    -		 *
    -		 * The usage of this return value is different in encoders
    -		 * and decoders. In both encoder and decoder, the coding
    -		 * cannot continue after this error.
    -		 *
    -		 * Encoders return this if size limits of the target file
    -		 * format would be exceeded. These limits are huge, thus
    -		 * getting this error from an encoder is mostly theoretical.
    -		 * For example, the maximum compressed and uncompressed
    -		 * size of a .xz Stream is roughly 8 EiB (2^63 bytes).
    -		 *
    -		 * Decoders return this error if the input data is corrupt.
    -		 * This can mean, for example, invalid CRC32 in headers
    -		 * or invalid check of uncompressed data.
    -		 */
    -
    -	LZMA_BUF_ERROR          = 10,
    -		/**<
    -		 * \brief       No progress is possible
    -		 *
    -		 * This error code is returned when the coder cannot consume
    -		 * any new input and produce any new output. The most common
    -		 * reason for this error is that the input stream being
    -		 * decoded is truncated or corrupt.
    -		 *
    -		 * This error is not fatal. Coding can be continued normally
    -		 * by providing more input and/or more output space, if
    -		 * possible.
    -		 *
    -		 * Typically the first call to lzma_code() that can do no
    -		 * progress returns LZMA_OK instead of LZMA_BUF_ERROR. Only
    -		 * the second consecutive call doing no progress will return
    -		 * LZMA_BUF_ERROR. This is intentional.
    -		 *
    -		 * With zlib, Z_BUF_ERROR may be returned even if the
    -		 * application is doing nothing wrong, so apps will need
    -		 * to handle Z_BUF_ERROR specially. The above hack
    -		 * guarantees that liblzma never returns LZMA_BUF_ERROR
    -		 * to properly written applications unless the input file
    -		 * is truncated or corrupt. This should simplify the
    -		 * applications a little.
    -		 */
    -
    -	LZMA_PROG_ERROR         = 11,
    -		/**<
    -		 * \brief       Programming error
    -		 *
    -		 * This indicates that the arguments given to the function are
    -		 * invalid or the internal state of the decoder is corrupt.
    -		 *   - Function arguments are invalid or the structures
    -		 *     pointed by the argument pointers are invalid
    -		 *     e.g. if strm->next_out has been set to NULL and
    -		 *     strm->avail_out > 0 when calling lzma_code().
    -		 *   - lzma_* functions have been called in wrong order
    -		 *     e.g. lzma_code() was called right after lzma_end().
    -		 *   - If errors occur randomly, the reason might be flaky
    -		 *     hardware.
    -		 *
    -		 * If you think that your code is correct, this error code
    -		 * can be a sign of a bug in liblzma. See the documentation
    -		 * how to report bugs.
    -		 */
    -} lzma_ret;
    -
    -
    -/**
    - * \brief       The `action' argument for lzma_code()
    - *
    - * After the first use of LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, LZMA_FULL_BARRIER,
    - * or LZMA_FINISH, the same `action' must is used until lzma_code() returns
    - * LZMA_STREAM_END. Also, the amount of input (that is, strm->avail_in) must
    - * not be modified by the application until lzma_code() returns
    - * LZMA_STREAM_END. Changing the `action' or modifying the amount of input
    - * will make lzma_code() return LZMA_PROG_ERROR.
    - */
    -typedef enum {
    -	LZMA_RUN = 0,
    -		/**<
    -		 * \brief       Continue coding
    -		 *
    -		 * Encoder: Encode as much input as possible. Some internal
    -		 * buffering will probably be done (depends on the filter
    -		 * chain in use), which causes latency: the input used won't
    -		 * usually be decodeable from the output of the same
    -		 * lzma_code() call.
    -		 *
    -		 * Decoder: Decode as much input as possible and produce as
    -		 * much output as possible.
    -		 */
    -
    -	LZMA_SYNC_FLUSH = 1,
    -		/**<
    -		 * \brief       Make all the input available at output
    -		 *
    -		 * Normally the encoder introduces some latency.
    -		 * LZMA_SYNC_FLUSH forces all the buffered data to be
    -		 * available at output without resetting the internal
    -		 * state of the encoder. This way it is possible to use
    -		 * compressed stream for example for communication over
    -		 * network.
    -		 *
    -		 * Only some filters support LZMA_SYNC_FLUSH. Trying to use
    -		 * LZMA_SYNC_FLUSH with filters that don't support it will
    -		 * make lzma_code() return LZMA_OPTIONS_ERROR. For example,
    -		 * LZMA1 doesn't support LZMA_SYNC_FLUSH but LZMA2 does.
    -		 *
    -		 * Using LZMA_SYNC_FLUSH very often can dramatically reduce
    -		 * the compression ratio. With some filters (for example,
    -		 * LZMA2), fine-tuning the compression options may help
    -		 * mitigate this problem significantly (for example,
    -		 * match finder with LZMA2).
    -		 *
    -		 * Decoders don't support LZMA_SYNC_FLUSH.
    -		 */
    -
    -	LZMA_FULL_FLUSH = 2,
    -		/**<
    -		 * \brief       Finish encoding of the current Block
    -		 *
    -		 * All the input data going to the current Block must have
    -		 * been given to the encoder (the last bytes can still be
    -		 * pending in *next_in). Call lzma_code() with LZMA_FULL_FLUSH
    -		 * until it returns LZMA_STREAM_END. Then continue normally
    -		 * with LZMA_RUN or finish the Stream with LZMA_FINISH.
    -		 *
    -		 * This action is currently supported only by Stream encoder
    -		 * and easy encoder (which uses Stream encoder). If there is
    -		 * no unfinished Block, no empty Block is created.
    -		 */
    -
    -	LZMA_FULL_BARRIER = 4,
    -		/**<
    -		 * \brief       Finish encoding of the current Block
    -		 *
    -		 * This is like LZMA_FULL_FLUSH except that this doesn't
    -		 * necessarily wait until all the input has been made
    -		 * available via the output buffer. That is, lzma_code()
    -		 * might return LZMA_STREAM_END as soon as all the input
    -		 * has been consumed (avail_in == 0).
    -		 *
    -		 * LZMA_FULL_BARRIER is useful with a threaded encoder if
    -		 * one wants to split the .xz Stream into Blocks at specific
    -		 * offsets but doesn't care if the output isn't flushed
    -		 * immediately. Using LZMA_FULL_BARRIER allows keeping
    -		 * the threads busy while LZMA_FULL_FLUSH would make
    -		 * lzma_code() wait until all the threads have finished
    -		 * until more data could be passed to the encoder.
    -		 *
    -		 * With a lzma_stream initialized with the single-threaded
    -		 * lzma_stream_encoder() or lzma_easy_encoder(),
    -		 * LZMA_FULL_BARRIER is an alias for LZMA_FULL_FLUSH.
    -		 */
    -
    -	LZMA_FINISH = 3
    -		/**<
    -		 * \brief       Finish the coding operation
    -		 *
    -		 * All the input data must have been given to the encoder
    -		 * (the last bytes can still be pending in next_in).
    -		 * Call lzma_code() with LZMA_FINISH until it returns
    -		 * LZMA_STREAM_END. Once LZMA_FINISH has been used,
    -		 * the amount of input must no longer be changed by
    -		 * the application.
    -		 *
    -		 * When decoding, using LZMA_FINISH is optional unless the
    -		 * LZMA_CONCATENATED flag was used when the decoder was
    -		 * initialized. When LZMA_CONCATENATED was not used, the only
    -		 * effect of LZMA_FINISH is that the amount of input must not
    -		 * be changed just like in the encoder.
    -		 */
    -} lzma_action;
    -
    -
    -/**
    - * \brief       Custom functions for memory handling
    - *
    - * A pointer to lzma_allocator may be passed via lzma_stream structure
    - * to liblzma, and some advanced functions take a pointer to lzma_allocator
    - * as a separate function argument. The library will use the functions
    - * specified in lzma_allocator for memory handling instead of the default
    - * malloc() and free(). C++ users should note that the custom memory
    - * handling functions must not throw exceptions.
    - *
    - * Single-threaded mode only: liblzma doesn't make an internal copy of
    - * lzma_allocator. Thus, it is OK to change these function pointers in
    - * the middle of the coding process, but obviously it must be done
    - * carefully to make sure that the replacement `free' can deallocate
    - * memory allocated by the earlier `alloc' function(s).
    - *
    - * Multithreaded mode: liblzma might internally store pointers to the
    - * lzma_allocator given via the lzma_stream structure. The application
    - * must not change the allocator pointer in lzma_stream or the contents
    - * of the pointed lzma_allocator structure until lzma_end() has been used
    - * to free the memory associated with that lzma_stream. The allocation
    - * functions might be called simultaneously from multiple threads, and
    - * thus they must be thread safe.
    - */
    -typedef struct {
    -	/**
    -	 * \brief       Pointer to a custom memory allocation function
    -	 *
    -	 * If you don't want a custom allocator, but still want
    -	 * custom free(), set this to NULL and liblzma will use
    -	 * the standard malloc().
    -	 *
    -	 * \param       opaque  lzma_allocator.opaque (see below)
    -	 * \param       nmemb   Number of elements like in calloc(). liblzma
    -	 *                      will always set nmemb to 1, so it is safe to
    -	 *                      ignore nmemb in a custom allocator if you like.
    -	 *                      The nmemb argument exists only for
    -	 *                      compatibility with zlib and libbzip2.
    -	 * \param       size    Size of an element in bytes.
    -	 *                      liblzma never sets this to zero.
    -	 *
    -	 * \return      Pointer to the beginning of a memory block of
    -	 *              `size' bytes, or NULL if allocation fails
    -	 *              for some reason. When allocation fails, functions
    -	 *              of liblzma return LZMA_MEM_ERROR.
    -	 *
    -	 * The allocator should not waste time zeroing the allocated buffers.
    -	 * This is not only about speed, but also memory usage, since the
    -	 * operating system kernel doesn't necessarily allocate the requested
    -	 * memory in physical memory until it is actually used. With small
    -	 * input files, liblzma may actually need only a fraction of the
    -	 * memory that it requested for allocation.
    -	 *
    -	 * \note        LZMA_MEM_ERROR is also used when the size of the
    -	 *              allocation would be greater than SIZE_MAX. Thus,
    -	 *              don't assume that the custom allocator must have
    -	 *              returned NULL if some function from liblzma
    -	 *              returns LZMA_MEM_ERROR.
    -	 */
    -	void *(LZMA_API_CALL *alloc)(void *opaque, size_t nmemb, size_t size);
    -
    -	/**
    -	 * \brief       Pointer to a custom memory freeing function
    -	 *
    -	 * If you don't want a custom freeing function, but still
    -	 * want a custom allocator, set this to NULL and liblzma
    -	 * will use the standard free().
    -	 *
    -	 * \param       opaque  lzma_allocator.opaque (see below)
    -	 * \param       ptr     Pointer returned by lzma_allocator.alloc(),
    -	 *                      or when it is set to NULL, a pointer returned
    -	 *                      by the standard malloc().
    -	 */
    -	void (LZMA_API_CALL *free)(void *opaque, void *ptr);
    -
    -	/**
    -	 * \brief       Pointer passed to .alloc() and .free()
    -	 *
    -	 * opaque is passed as the first argument to lzma_allocator.alloc()
    -	 * and lzma_allocator.free(). This intended to ease implementing
    -	 * custom memory allocation functions for use with liblzma.
    -	 *
    -	 * If you don't need this, you should set this to NULL.
    -	 */
    -	void *opaque;
    -
    -} lzma_allocator;
    -
    -
    -/**
    - * \brief       Internal data structure
    - *
    - * The contents of this structure is not visible outside the library.
    - */
    -typedef struct lzma_internal_s lzma_internal;
    -
    -
    -/**
    - * \brief       Passing data to and from liblzma
    - *
    - * The lzma_stream structure is used for
    - *  - passing pointers to input and output buffers to liblzma;
    - *  - defining custom memory hander functions; and
    - *  - holding a pointer to coder-specific internal data structures.
    - *
    - * Typical usage:
    - *
    - *  - After allocating lzma_stream (on stack or with malloc()), it must be
    - *    initialized to LZMA_STREAM_INIT (see LZMA_STREAM_INIT for details).
    - *
    - *  - Initialize a coder to the lzma_stream, for example by using
    - *    lzma_easy_encoder() or lzma_auto_decoder(). Some notes:
    - *      - In contrast to zlib, strm->next_in and strm->next_out are
    - *        ignored by all initialization functions, thus it is safe
    - *        to not initialize them yet.
    - *      - The initialization functions always set strm->total_in and
    - *        strm->total_out to zero.
    - *      - If the initialization function fails, no memory is left allocated
    - *        that would require freeing with lzma_end() even if some memory was
    - *        associated with the lzma_stream structure when the initialization
    - *        function was called.
    - *
    - *  - Use lzma_code() to do the actual work.
    - *
    - *  - Once the coding has been finished, the existing lzma_stream can be
    - *    reused. It is OK to reuse lzma_stream with different initialization
    - *    function without calling lzma_end() first. Old allocations are
    - *    automatically freed.
    - *
    - *  - Finally, use lzma_end() to free the allocated memory. lzma_end() never
    - *    frees the lzma_stream structure itself.
    - *
    - * Application may modify the values of total_in and total_out as it wants.
    - * They are updated by liblzma to match the amount of data read and
    - * written but aren't used for anything else except as a possible return
    - * values from lzma_get_progress().
    - */
    -typedef struct {
    -	const uint8_t *next_in; /**< Pointer to the next input byte. */
    -	size_t avail_in;    /**< Number of available input bytes in next_in. */
    -	uint64_t total_in;  /**< Total number of bytes read by liblzma. */
    -
    -	uint8_t *next_out;  /**< Pointer to the next output position. */
    -	size_t avail_out;   /**< Amount of free space in next_out. */
    -	uint64_t total_out; /**< Total number of bytes written by liblzma. */
    -
    -	/**
    -	 * \brief       Custom memory allocation functions
    -	 *
    -	 * In most cases this is NULL which makes liblzma use
    -	 * the standard malloc() and free().
    -	 *
    -	 * \note        In 5.0.x this is not a const pointer.
    -	 */
    -	const lzma_allocator *allocator;
    -
    -	/** Internal state is not visible to applications. */
    -	lzma_internal *internal;
    -
    -	/*
    -	 * Reserved space to allow possible future extensions without
    -	 * breaking the ABI. Excluding the initialization of this structure,
    -	 * you should not touch these, because the names of these variables
    -	 * may change.
    -	 */
    -	void *reserved_ptr1;
    -	void *reserved_ptr2;
    -	void *reserved_ptr3;
    -	void *reserved_ptr4;
    -	uint64_t reserved_int1;
    -	uint64_t reserved_int2;
    -	size_t reserved_int3;
    -	size_t reserved_int4;
    -	lzma_reserved_enum reserved_enum1;
    -	lzma_reserved_enum reserved_enum2;
    -
    -} lzma_stream;
    -
    -
    -/**
    - * \brief       Initialization for lzma_stream
    - *
    - * When you declare an instance of lzma_stream, you can immediately
    - * initialize it so that initialization functions know that no memory
    - * has been allocated yet:
    - *
    - *     lzma_stream strm = LZMA_STREAM_INIT;
    - *
    - * If you need to initialize a dynamically allocated lzma_stream, you can use
    - * memset(strm_pointer, 0, sizeof(lzma_stream)). Strictly speaking, this
    - * violates the C standard since NULL may have different internal
    - * representation than zero, but it should be portable enough in practice.
    - * Anyway, for maximum portability, you can use something like this:
    - *
    - *     lzma_stream tmp = LZMA_STREAM_INIT;
    - *     *strm = tmp;
    - */
    -#define LZMA_STREAM_INIT \
    -	{ NULL, 0, 0, NULL, 0, 0, NULL, NULL, \
    -	NULL, NULL, NULL, NULL, 0, 0, 0, 0, \
    -	LZMA_RESERVED_ENUM, LZMA_RESERVED_ENUM }
    -
    -
    -/**
    - * \brief       Encode or decode data
    - *
    - * Once the lzma_stream has been successfully initialized (e.g. with
    - * lzma_stream_encoder()), the actual encoding or decoding is done
    - * using this function. The application has to update strm->next_in,
    - * strm->avail_in, strm->next_out, and strm->avail_out to pass input
    - * to and get output from liblzma.
    - *
    - * See the description of the coder-specific initialization function to find
    - * out what `action' values are supported by the coder.
    - */
    -extern LZMA_API(lzma_ret) lzma_code(lzma_stream *strm, lzma_action action)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Free memory allocated for the coder data structures
    - *
    - * \param       strm    Pointer to lzma_stream that is at least initialized
    - *                      with LZMA_STREAM_INIT.
    - *
    - * After lzma_end(strm), strm->internal is guaranteed to be NULL. No other
    - * members of the lzma_stream structure are touched.
    - *
    - * \note        zlib indicates an error if application end()s unfinished
    - *              stream structure. liblzma doesn't do this, and assumes that
    - *              application knows what it is doing.
    - */
    -extern LZMA_API(void) lzma_end(lzma_stream *strm) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Get progress information
    - *
    - * In single-threaded mode, applications can get progress information from
    - * strm->total_in and strm->total_out. In multi-threaded mode this is less
    - * useful because a significant amount of both input and output data gets
    - * buffered internally by liblzma. This makes total_in and total_out give
    - * misleading information and also makes the progress indicator updates
    - * non-smooth.
    - *
    - * This function gives realistic progress information also in multi-threaded
    - * mode by taking into account the progress made by each thread. In
    - * single-threaded mode *progress_in and *progress_out are set to
    - * strm->total_in and strm->total_out, respectively.
    - */
    -extern LZMA_API(void) lzma_get_progress(lzma_stream *strm,
    -		uint64_t *progress_in, uint64_t *progress_out) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Get the memory usage of decoder filter chain
    - *
    - * This function is currently supported only when *strm has been initialized
    - * with a function that takes a memlimit argument. With other functions, you
    - * should use e.g. lzma_raw_encoder_memusage() or lzma_raw_decoder_memusage()
    - * to estimate the memory requirements.
    - *
    - * This function is useful e.g. after LZMA_MEMLIMIT_ERROR to find out how big
    - * the memory usage limit should have been to decode the input. Note that
    - * this may give misleading information if decoding .xz Streams that have
    - * multiple Blocks, because each Block can have different memory requirements.
    - *
    - * \return      How much memory is currently allocated for the filter
    - *              decoders. If no filter chain is currently allocated,
    - *              some non-zero value is still returned, which is less than
    - *              or equal to what any filter chain would indicate as its
    - *              memory requirement.
    - *
    - *              If this function isn't supported by *strm or some other error
    - *              occurs, zero is returned.
    - */
    -extern LZMA_API(uint64_t) lzma_memusage(const lzma_stream *strm)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Get the current memory usage limit
    - *
    - * This function is supported only when *strm has been initialized with
    - * a function that takes a memlimit argument.
    - *
    - * \return      On success, the current memory usage limit is returned
    - *              (always non-zero). On error, zero is returned.
    - */
    -extern LZMA_API(uint64_t) lzma_memlimit_get(const lzma_stream *strm)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Set the memory usage limit
    - *
    - * This function is supported only when *strm has been initialized with
    - * a function that takes a memlimit argument.
    - *
    - * \return      - LZMA_OK: New memory usage limit successfully set.
    - *              - LZMA_MEMLIMIT_ERROR: The new limit is too small.
    - *                The limit was not changed.
    - *              - LZMA_PROG_ERROR: Invalid arguments, e.g. *strm doesn't
    - *                support memory usage limit or memlimit was zero.
    - */
    -extern LZMA_API(lzma_ret) lzma_memlimit_set(
    -		lzma_stream *strm, uint64_t memlimit) lzma_nothrow;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/bcj.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/bcj.h
    deleted file mode 100644
    index 8e37538ad..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/bcj.h
    +++ /dev/null
    @@ -1,90 +0,0 @@
    -/**
    - * \file        lzma/bcj.h
    - * \brief       Branch/Call/Jump conversion filters
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/* Filter IDs for lzma_filter.id */
    -
    -#define LZMA_FILTER_X86         LZMA_VLI_C(0x04)
    -	/**<
    -	 * Filter for x86 binaries
    -	 */
    -
    -#define LZMA_FILTER_POWERPC     LZMA_VLI_C(0x05)
    -	/**<
    -	 * Filter for Big endian PowerPC binaries
    -	 */
    -
    -#define LZMA_FILTER_IA64        LZMA_VLI_C(0x06)
    -	/**<
    -	 * Filter for IA-64 (Itanium) binaries.
    -	 */
    -
    -#define LZMA_FILTER_ARM         LZMA_VLI_C(0x07)
    -	/**<
    -	 * Filter for ARM binaries.
    -	 */
    -
    -#define LZMA_FILTER_ARMTHUMB    LZMA_VLI_C(0x08)
    -	/**<
    -	 * Filter for ARM-Thumb binaries.
    -	 */
    -
    -#define LZMA_FILTER_SPARC       LZMA_VLI_C(0x09)
    -	/**<
    -	 * Filter for SPARC binaries.
    -	 */
    -
    -
    -/**
    - * \brief       Options for BCJ filters
    - *
    - * The BCJ filters never change the size of the data. Specifying options
    - * for them is optional: if pointer to options is NULL, default value is
    - * used. You probably never need to specify options to BCJ filters, so just
    - * set the options pointer to NULL and be happy.
    - *
    - * If options with non-default values have been specified when encoding,
    - * the same options must also be specified when decoding.
    - *
    - * \note        At the moment, none of the BCJ filters support
    - *              LZMA_SYNC_FLUSH. If LZMA_SYNC_FLUSH is specified,
    - *              LZMA_OPTIONS_ERROR will be returned. If there is need,
    - *              partial support for LZMA_SYNC_FLUSH can be added in future.
    - *              Partial means that flushing would be possible only at
    - *              offsets that are multiple of 2, 4, or 16 depending on
    - *              the filter, except x86 which cannot be made to support
    - *              LZMA_SYNC_FLUSH predictably.
    - */
    -typedef struct {
    -	/**
    -	 * \brief       Start offset for conversions
    -	 *
    -	 * This setting is useful only when the same filter is used
    -	 * _separately_ for multiple sections of the same executable file,
    -	 * and the sections contain cross-section branch/call/jump
    -	 * instructions. In that case it is beneficial to set the start
    -	 * offset of the non-first sections so that the relative addresses
    -	 * of the cross-section branch/call/jump instructions will use the
    -	 * same absolute addresses as in the first section.
    -	 *
    -	 * When the pointer to options is NULL, the default value (zero)
    -	 * is used.
    -	 */
    -	uint32_t start_offset;
    -
    -} lzma_options_bcj;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/block.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/block.h
    deleted file mode 100644
    index 7bdcfd7cb..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/block.h
    +++ /dev/null
    @@ -1,581 +0,0 @@
    -/**
    - * \file        lzma/block.h
    - * \brief       .xz Block handling
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Options for the Block and Block Header encoders and decoders
    - *
    - * Different Block handling functions use different parts of this structure.
    - * Some read some members, other functions write, and some do both. Only the
    - * members listed for reading need to be initialized when the specified
    - * functions are called. The members marked for writing will be assigned
    - * new values at some point either by calling the given function or by
    - * later calls to lzma_code().
    - */
    -typedef struct {
    -	/**
    -	 * \brief       Block format version
    -	 *
    -	 * To prevent API and ABI breakages when new features are needed,
    -	 * a version number is used to indicate which fields in this
    -	 * structure are in use:
    -	 *   - liblzma >= 5.0.0: version = 0 is supported.
    -	 *   - liblzma >= 5.1.4beta: Support for version = 1 was added,
    -	 *     which adds the ignore_check field.
    -	 *
    -	 * If version is greater than one, most Block related functions
    -	 * will return LZMA_OPTIONS_ERROR (lzma_block_header_decode() works
    -	 * with any version value).
    -	 *
    -	 * Read by:
    -	 *  - All functions that take pointer to lzma_block as argument,
    -	 *    including lzma_block_header_decode().
    -	 *
    -	 * Written by:
    -	 *  - lzma_block_header_decode()
    -	 */
    -	uint32_t version;
    -
    -	/**
    -	 * \brief       Size of the Block Header field
    -	 *
    -	 * This is always a multiple of four.
    -	 *
    -	 * Read by:
    -	 *  - lzma_block_header_encode()
    -	 *  - lzma_block_header_decode()
    -	 *  - lzma_block_compressed_size()
    -	 *  - lzma_block_unpadded_size()
    -	 *  - lzma_block_total_size()
    -	 *  - lzma_block_decoder()
    -	 *  - lzma_block_buffer_decode()
    -	 *
    -	 * Written by:
    -	 *  - lzma_block_header_size()
    -	 *  - lzma_block_buffer_encode()
    -	 */
    -	uint32_t header_size;
    -#	define LZMA_BLOCK_HEADER_SIZE_MIN 8
    -#	define LZMA_BLOCK_HEADER_SIZE_MAX 1024
    -
    -	/**
    -	 * \brief       Type of integrity Check
    -	 *
    -	 * The Check ID is not stored into the Block Header, thus its value
    -	 * must be provided also when decoding.
    -	 *
    -	 * Read by:
    -	 *  - lzma_block_header_encode()
    -	 *  - lzma_block_header_decode()
    -	 *  - lzma_block_compressed_size()
    -	 *  - lzma_block_unpadded_size()
    -	 *  - lzma_block_total_size()
    -	 *  - lzma_block_encoder()
    -	 *  - lzma_block_decoder()
    -	 *  - lzma_block_buffer_encode()
    -	 *  - lzma_block_buffer_decode()
    -	 */
    -	lzma_check check;
    -
    -	/**
    -	 * \brief       Size of the Compressed Data in bytes
    -	 *
    -	 * Encoding: If this is not LZMA_VLI_UNKNOWN, Block Header encoder
    -	 * will store this value to the Block Header. Block encoder doesn't
    -	 * care about this value, but will set it once the encoding has been
    -	 * finished.
    -	 *
    -	 * Decoding: If this is not LZMA_VLI_UNKNOWN, Block decoder will
    -	 * verify that the size of the Compressed Data field matches
    -	 * compressed_size.
    -	 *
    -	 * Usually you don't know this value when encoding in streamed mode,
    -	 * and thus cannot write this field into the Block Header.
    -	 *
    -	 * In non-streamed mode you can reserve space for this field before
    -	 * encoding the actual Block. After encoding the data, finish the
    -	 * Block by encoding the Block Header. Steps in detail:
    -	 *
    -	 *  - Set compressed_size to some big enough value. If you don't know
    -	 *    better, use LZMA_VLI_MAX, but remember that bigger values take
    -	 *    more space in Block Header.
    -	 *
    -	 *  - Call lzma_block_header_size() to see how much space you need to
    -	 *    reserve for the Block Header.
    -	 *
    -	 *  - Encode the Block using lzma_block_encoder() and lzma_code().
    -	 *    It sets compressed_size to the correct value.
    -	 *
    -	 *  - Use lzma_block_header_encode() to encode the Block Header.
    -	 *    Because space was reserved in the first step, you don't need
    -	 *    to call lzma_block_header_size() anymore, because due to
    -	 *    reserving, header_size has to be big enough. If it is "too big",
    -	 *    lzma_block_header_encode() will add enough Header Padding to
    -	 *    make Block Header to match the size specified by header_size.
    -	 *
    -	 * Read by:
    -	 *  - lzma_block_header_size()
    -	 *  - lzma_block_header_encode()
    -	 *  - lzma_block_compressed_size()
    -	 *  - lzma_block_unpadded_size()
    -	 *  - lzma_block_total_size()
    -	 *  - lzma_block_decoder()
    -	 *  - lzma_block_buffer_decode()
    -	 *
    -	 * Written by:
    -	 *  - lzma_block_header_decode()
    -	 *  - lzma_block_compressed_size()
    -	 *  - lzma_block_encoder()
    -	 *  - lzma_block_decoder()
    -	 *  - lzma_block_buffer_encode()
    -	 *  - lzma_block_buffer_decode()
    -	 */
    -	lzma_vli compressed_size;
    -
    -	/**
    -	 * \brief       Uncompressed Size in bytes
    -	 *
    -	 * This is handled very similarly to compressed_size above.
    -	 *
    -	 * uncompressed_size is needed by fewer functions than
    -	 * compressed_size. This is because uncompressed_size isn't
    -	 * needed to validate that Block stays within proper limits.
    -	 *
    -	 * Read by:
    -	 *  - lzma_block_header_size()
    -	 *  - lzma_block_header_encode()
    -	 *  - lzma_block_decoder()
    -	 *  - lzma_block_buffer_decode()
    -	 *
    -	 * Written by:
    -	 *  - lzma_block_header_decode()
    -	 *  - lzma_block_encoder()
    -	 *  - lzma_block_decoder()
    -	 *  - lzma_block_buffer_encode()
    -	 *  - lzma_block_buffer_decode()
    -	 */
    -	lzma_vli uncompressed_size;
    -
    -	/**
    -	 * \brief       Array of filters
    -	 *
    -	 * There can be 1-4 filters. The end of the array is marked with
    -	 * .id = LZMA_VLI_UNKNOWN.
    -	 *
    -	 * Read by:
    -	 *  - lzma_block_header_size()
    -	 *  - lzma_block_header_encode()
    -	 *  - lzma_block_encoder()
    -	 *  - lzma_block_decoder()
    -	 *  - lzma_block_buffer_encode()
    -	 *  - lzma_block_buffer_decode()
    -	 *
    -	 * Written by:
    -	 *  - lzma_block_header_decode(): Note that this does NOT free()
    -	 *    the old filter options structures. All unused filters[] will
    -	 *    have .id == LZMA_VLI_UNKNOWN and .options == NULL. If
    -	 *    decoding fails, all filters[] are guaranteed to be
    -	 *    LZMA_VLI_UNKNOWN and NULL.
    -	 *
    -	 * \note        Because of the array is terminated with
    -	 *              .id = LZMA_VLI_UNKNOWN, the actual array must
    -	 *              have LZMA_FILTERS_MAX + 1 members or the Block
    -	 *              Header decoder will overflow the buffer.
    -	 */
    -	lzma_filter *filters;
    -
    -	/**
    -	 * \brief       Raw value stored in the Check field
    -	 *
    -	 * After successful coding, the first lzma_check_size(check) bytes
    -	 * of this array contain the raw value stored in the Check field.
    -	 *
    -	 * Note that CRC32 and CRC64 are stored in little endian byte order.
    -	 * Take it into account if you display the Check values to the user.
    -	 *
    -	 * Written by:
    -	 *  - lzma_block_encoder()
    -	 *  - lzma_block_decoder()
    -	 *  - lzma_block_buffer_encode()
    -	 *  - lzma_block_buffer_decode()
    -	 */
    -	uint8_t raw_check[LZMA_CHECK_SIZE_MAX];
    -
    -	/*
    -	 * Reserved space to allow possible future extensions without
    -	 * breaking the ABI. You should not touch these, because the names
    -	 * of these variables may change. These are and will never be used
    -	 * with the currently supported options, so it is safe to leave these
    -	 * uninitialized.
    -	 */
    -	void *reserved_ptr1;
    -	void *reserved_ptr2;
    -	void *reserved_ptr3;
    -	uint32_t reserved_int1;
    -	uint32_t reserved_int2;
    -	lzma_vli reserved_int3;
    -	lzma_vli reserved_int4;
    -	lzma_vli reserved_int5;
    -	lzma_vli reserved_int6;
    -	lzma_vli reserved_int7;
    -	lzma_vli reserved_int8;
    -	lzma_reserved_enum reserved_enum1;
    -	lzma_reserved_enum reserved_enum2;
    -	lzma_reserved_enum reserved_enum3;
    -	lzma_reserved_enum reserved_enum4;
    -
    -	/**
    -	 * \brief       A flag to Block decoder to not verify the Check field
    -	 *
    -	 * This field is supported by liblzma >= 5.1.4beta if .version >= 1.
    -	 *
    -	 * If this is set to true, the integrity check won't be calculated
    -	 * and verified. Unless you know what you are doing, you should
    -	 * leave this to false. (A reason to set this to true is when the
    -	 * file integrity is verified externally anyway and you want to
    -	 * speed up the decompression, which matters mostly when using
    -	 * SHA-256 as the integrity check.)
    -	 *
    -	 * If .version >= 1, read by:
    -	 *   - lzma_block_decoder()
    -	 *   - lzma_block_buffer_decode()
    -	 *
    -	 * Written by (.version is ignored):
    -	 *   - lzma_block_header_decode() always sets this to false
    -	 */
    -	lzma_bool ignore_check;
    -
    -	lzma_bool reserved_bool2;
    -	lzma_bool reserved_bool3;
    -	lzma_bool reserved_bool4;
    -	lzma_bool reserved_bool5;
    -	lzma_bool reserved_bool6;
    -	lzma_bool reserved_bool7;
    -	lzma_bool reserved_bool8;
    -
    -} lzma_block;
    -
    -
    -/**
    - * \brief       Decode the Block Header Size field
    - *
    - * To decode Block Header using lzma_block_header_decode(), the size of the
    - * Block Header has to be known and stored into lzma_block.header_size.
    - * The size can be calculated from the first byte of a Block using this macro.
    - * Note that if the first byte is 0x00, it indicates beginning of Index; use
    - * this macro only when the byte is not 0x00.
    - *
    - * There is no encoding macro, because Block Header encoder is enough for that.
    - */
    -#define lzma_block_header_size_decode(b) (((uint32_t)(b) + 1) * 4)
    -
    -
    -/**
    - * \brief       Calculate Block Header Size
    - *
    - * Calculate the minimum size needed for the Block Header field using the
    - * settings specified in the lzma_block structure. Note that it is OK to
    - * increase the calculated header_size value as long as it is a multiple of
    - * four and doesn't exceed LZMA_BLOCK_HEADER_SIZE_MAX. Increasing header_size
    - * just means that lzma_block_header_encode() will add Header Padding.
    - *
    - * \return      - LZMA_OK: Size calculated successfully and stored to
    - *                block->header_size.
    - *              - LZMA_OPTIONS_ERROR: Unsupported version, filters or
    - *                filter options.
    - *              - LZMA_PROG_ERROR: Invalid values like compressed_size == 0.
    - *
    - * \note        This doesn't check that all the options are valid i.e. this
    - *              may return LZMA_OK even if lzma_block_header_encode() or
    - *              lzma_block_encoder() would fail. If you want to validate the
    - *              filter chain, consider using lzma_memlimit_encoder() which as
    - *              a side-effect validates the filter chain.
    - */
    -extern LZMA_API(lzma_ret) lzma_block_header_size(lzma_block *block)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Encode Block Header
    - *
    - * The caller must have calculated the size of the Block Header already with
    - * lzma_block_header_size(). If a value larger than the one calculated by
    - * lzma_block_header_size() is used, the Block Header will be padded to the
    - * specified size.
    - *
    - * \param       out         Beginning of the output buffer. This must be
    - *                          at least block->header_size bytes.
    - * \param       block       Block options to be encoded.
    - *
    - * \return      - LZMA_OK: Encoding was successful. block->header_size
    - *                bytes were written to output buffer.
    - *              - LZMA_OPTIONS_ERROR: Invalid or unsupported options.
    - *              - LZMA_PROG_ERROR: Invalid arguments, for example
    - *                block->header_size is invalid or block->filters is NULL.
    - */
    -extern LZMA_API(lzma_ret) lzma_block_header_encode(
    -		const lzma_block *block, uint8_t *out)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Decode Block Header
    - *
    - * block->version should (usually) be set to the highest value supported
    - * by the application. If the application sets block->version to a value
    - * higher than supported by the current liblzma version, this function will
    - * downgrade block->version to the highest value supported by it. Thus one
    - * should check the value of block->version after calling this function if
    - * block->version was set to a non-zero value and the application doesn't
    - * otherwise know that the liblzma version being used is new enough to
    - * support the specified block->version.
    - *
    - * The size of the Block Header must have already been decoded with
    - * lzma_block_header_size_decode() macro and stored to block->header_size.
    - *
    - * The integrity check type from Stream Header must have been stored
    - * to block->check.
    - *
    - * block->filters must have been allocated, but they don't need to be
    - * initialized (possible existing filter options are not freed).
    - *
    - * \param       block       Destination for Block options.
    - * \param       allocator   lzma_allocator for custom allocator functions.
    - *                          Set to NULL to use malloc() (and also free()
    - *                          if an error occurs).
    - * \param       in          Beginning of the input buffer. This must be
    - *                          at least block->header_size bytes.
    - *
    - * \return      - LZMA_OK: Decoding was successful. block->header_size
    - *                bytes were read from the input buffer.
    - *              - LZMA_OPTIONS_ERROR: The Block Header specifies some
    - *                unsupported options such as unsupported filters. This can
    - *                happen also if block->version was set to a too low value
    - *                compared to what would be required to properly represent
    - *                the information stored in the Block Header.
    - *              - LZMA_DATA_ERROR: Block Header is corrupt, for example,
    - *                the CRC32 doesn't match.
    - *              - LZMA_PROG_ERROR: Invalid arguments, for example
    - *                block->header_size is invalid or block->filters is NULL.
    - */
    -extern LZMA_API(lzma_ret) lzma_block_header_decode(lzma_block *block,
    -		const lzma_allocator *allocator, const uint8_t *in)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Validate and set Compressed Size according to Unpadded Size
    - *
    - * Block Header stores Compressed Size, but Index has Unpadded Size. If the
    - * application has already parsed the Index and is now decoding Blocks,
    - * it can calculate Compressed Size from Unpadded Size. This function does
    - * exactly that with error checking:
    - *
    - *  - Compressed Size calculated from Unpadded Size must be positive integer,
    - *    that is, Unpadded Size must be big enough that after Block Header and
    - *    Check fields there's still at least one byte for Compressed Size.
    - *
    - *  - If Compressed Size was present in Block Header, the new value
    - *    calculated from Unpadded Size is compared against the value
    - *    from Block Header.
    - *
    - * \note        This function must be called _after_ decoding the Block Header
    - *              field so that it can properly validate Compressed Size if it
    - *              was present in Block Header.
    - *
    - * \return      - LZMA_OK: block->compressed_size was set successfully.
    - *              - LZMA_DATA_ERROR: unpadded_size is too small compared to
    - *                block->header_size and lzma_check_size(block->check).
    - *              - LZMA_PROG_ERROR: Some values are invalid. For example,
    - *                block->header_size must be a multiple of four and
    - *                between 8 and 1024 inclusive.
    - */
    -extern LZMA_API(lzma_ret) lzma_block_compressed_size(
    -		lzma_block *block, lzma_vli unpadded_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Calculate Unpadded Size
    - *
    - * The Index field stores Unpadded Size and Uncompressed Size. The latter
    - * can be taken directly from the lzma_block structure after coding a Block,
    - * but Unpadded Size needs to be calculated from Block Header Size,
    - * Compressed Size, and size of the Check field. This is where this function
    - * is needed.
    - *
    - * \return      Unpadded Size on success, or zero on error.
    - */
    -extern LZMA_API(lzma_vli) lzma_block_unpadded_size(const lzma_block *block)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Calculate the total encoded size of a Block
    - *
    - * This is equivalent to lzma_block_unpadded_size() except that the returned
    - * value includes the size of the Block Padding field.
    - *
    - * \return      On success, total encoded size of the Block. On error,
    - *              zero is returned.
    - */
    -extern LZMA_API(lzma_vli) lzma_block_total_size(const lzma_block *block)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Initialize .xz Block encoder
    - *
    - * Valid actions for lzma_code() are LZMA_RUN, LZMA_SYNC_FLUSH (only if the
    - * filter chain supports it), and LZMA_FINISH.
    - *
    - * \return      - LZMA_OK: All good, continue with lzma_code().
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_UNSUPPORTED_CHECK: block->check specifies a Check ID
    - *                that is not supported by this buid of liblzma. Initializing
    - *                the encoder failed.
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_block_encoder(
    -		lzma_stream *strm, lzma_block *block)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Initialize .xz Block decoder
    - *
    - * Valid actions for lzma_code() are LZMA_RUN and LZMA_FINISH. Using
    - * LZMA_FINISH is not required. It is supported only for convenience.
    - *
    - * \return      - LZMA_OK: All good, continue with lzma_code().
    - *              - LZMA_UNSUPPORTED_CHECK: Initialization was successful, but
    - *                the given Check ID is not supported, thus Check will be
    - *                ignored.
    - *              - LZMA_PROG_ERROR
    - *              - LZMA_MEM_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_block_decoder(
    -		lzma_stream *strm, lzma_block *block)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Calculate maximum output size for single-call Block encoding
    - *
    - * This is equivalent to lzma_stream_buffer_bound() but for .xz Blocks.
    - * See the documentation of lzma_stream_buffer_bound().
    - */
    -extern LZMA_API(size_t) lzma_block_buffer_bound(size_t uncompressed_size)
    -		lzma_nothrow;
    -
    -
    -/**
    - * \brief       Single-call .xz Block encoder
    - *
    - * In contrast to the multi-call encoder initialized with
    - * lzma_block_encoder(), this function encodes also the Block Header. This
    - * is required to make it possible to write appropriate Block Header also
    - * in case the data isn't compressible, and different filter chain has to be
    - * used to encode the data in uncompressed form using uncompressed chunks
    - * of the LZMA2 filter.
    - *
    - * When the data isn't compressible, header_size, compressed_size, and
    - * uncompressed_size are set just like when the data was compressible, but
    - * it is possible that header_size is too small to hold the filter chain
    - * specified in block->filters, because that isn't necessarily the filter
    - * chain that was actually used to encode the data. lzma_block_unpadded_size()
    - * still works normally, because it doesn't read the filters array.
    - *
    - * \param       block       Block options: block->version, block->check,
    - *                          and block->filters must have been initialized.
    - * \param       allocator   lzma_allocator for custom allocator functions.
    - *                          Set to NULL to use malloc() and free().
    - * \param       in          Beginning of the input buffer
    - * \param       in_size     Size of the input buffer
    - * \param       out         Beginning of the output buffer
    - * \param       out_pos     The next byte will be written to out[*out_pos].
    - *                          *out_pos is updated only if encoding succeeds.
    - * \param       out_size    Size of the out buffer; the first byte into
    - *                          which no data is written to is out[out_size].
    - *
    - * \return      - LZMA_OK: Encoding was successful.
    - *              - LZMA_BUF_ERROR: Not enough output buffer space.
    - *              - LZMA_UNSUPPORTED_CHECK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_DATA_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_block_buffer_encode(
    -		lzma_block *block, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Single-call uncompressed .xz Block encoder
    - *
    - * This is like lzma_block_buffer_encode() except this doesn't try to
    - * compress the data and instead encodes the data using LZMA2 uncompressed
    - * chunks. The required output buffer size can be determined with
    - * lzma_block_buffer_bound().
    - *
    - * Since the data won't be compressed, this function ignores block->filters.
    - * This function doesn't take lzma_allocator because this function doesn't
    - * allocate any memory from the heap.
    - */
    -extern LZMA_API(lzma_ret) lzma_block_uncomp_encode(lzma_block *block,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Single-call .xz Block decoder
    - *
    - * This is single-call equivalent of lzma_block_decoder(), and requires that
    - * the caller has already decoded Block Header and checked its memory usage.
    - *
    - * \param       block       Block options just like with lzma_block_decoder().
    - * \param       allocator   lzma_allocator for custom allocator functions.
    - *                          Set to NULL to use malloc() and free().
    - * \param       in          Beginning of the input buffer
    - * \param       in_pos      The next byte will be read from in[*in_pos].
    - *                          *in_pos is updated only if decoding succeeds.
    - * \param       in_size     Size of the input buffer; the first byte that
    - *                          won't be read is in[in_size].
    - * \param       out         Beginning of the output buffer
    - * \param       out_pos     The next byte will be written to out[*out_pos].
    - *                          *out_pos is updated only if encoding succeeds.
    - * \param       out_size    Size of the out buffer; the first byte into
    - *                          which no data is written to is out[out_size].
    - *
    - * \return      - LZMA_OK: Decoding was successful.
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_DATA_ERROR
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_BUF_ERROR: Output buffer was too small.
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_block_buffer_decode(
    -		lzma_block *block, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -		lzma_nothrow;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/check.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/check.h
    deleted file mode 100644
    index 6a243db0d..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/check.h
    +++ /dev/null
    @@ -1,150 +0,0 @@
    -/**
    - * \file        lzma/check.h
    - * \brief       Integrity checks
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Type of the integrity check (Check ID)
    - *
    - * The .xz format supports multiple types of checks that are calculated
    - * from the uncompressed data. They vary in both speed and ability to
    - * detect errors.
    - */
    -typedef enum {
    -	LZMA_CHECK_NONE     = 0,
    -		/**<
    -		 * No Check is calculated.
    -		 *
    -		 * Size of the Check field: 0 bytes
    -		 */
    -
    -	LZMA_CHECK_CRC32    = 1,
    -		/**<
    -		 * CRC32 using the polynomial from the IEEE 802.3 standard
    -		 *
    -		 * Size of the Check field: 4 bytes
    -		 */
    -
    -	LZMA_CHECK_CRC64    = 4,
    -		/**<
    -		 * CRC64 using the polynomial from the ECMA-182 standard
    -		 *
    -		 * Size of the Check field: 8 bytes
    -		 */
    -
    -	LZMA_CHECK_SHA256   = 10
    -		/**<
    -		 * SHA-256
    -		 *
    -		 * Size of the Check field: 32 bytes
    -		 */
    -} lzma_check;
    -
    -
    -/**
    - * \brief       Maximum valid Check ID
    - *
    - * The .xz file format specification specifies 16 Check IDs (0-15). Some
    - * of them are only reserved, that is, no actual Check algorithm has been
    - * assigned. When decoding, liblzma still accepts unknown Check IDs for
    - * future compatibility. If a valid but unsupported Check ID is detected,
    - * liblzma can indicate a warning; see the flags LZMA_TELL_NO_CHECK,
    - * LZMA_TELL_UNSUPPORTED_CHECK, and LZMA_TELL_ANY_CHECK in container.h.
    - */
    -#define LZMA_CHECK_ID_MAX 15
    -
    -
    -/**
    - * \brief       Test if the given Check ID is supported
    - *
    - * Return true if the given Check ID is supported by this liblzma build.
    - * Otherwise false is returned. It is safe to call this with a value that
    - * is not in the range [0, 15]; in that case the return value is always false.
    - *
    - * You can assume that LZMA_CHECK_NONE and LZMA_CHECK_CRC32 are always
    - * supported (even if liblzma is built with limited features).
    - */
    -extern LZMA_API(lzma_bool) lzma_check_is_supported(lzma_check check)
    -		lzma_nothrow lzma_attr_const;
    -
    -
    -/**
    - * \brief       Get the size of the Check field with the given Check ID
    - *
    - * Although not all Check IDs have a check algorithm associated, the size of
    - * every Check is already frozen. This function returns the size (in bytes) of
    - * the Check field with the specified Check ID. The values are:
    - * { 0, 4, 4, 4, 8, 8, 8, 16, 16, 16, 32, 32, 32, 64, 64, 64 }
    - *
    - * If the argument is not in the range [0, 15], UINT32_MAX is returned.
    - */
    -extern LZMA_API(uint32_t) lzma_check_size(lzma_check check)
    -		lzma_nothrow lzma_attr_const;
    -
    -
    -/**
    - * \brief       Maximum size of a Check field
    - */
    -#define LZMA_CHECK_SIZE_MAX 64
    -
    -
    -/**
    - * \brief       Calculate CRC32
    - *
    - * Calculate CRC32 using the polynomial from the IEEE 802.3 standard.
    - *
    - * \param       buf     Pointer to the input buffer
    - * \param       size    Size of the input buffer
    - * \param       crc     Previously returned CRC value. This is used to
    - *                      calculate the CRC of a big buffer in smaller chunks.
    - *                      Set to zero when starting a new calculation.
    - *
    - * \return      Updated CRC value, which can be passed to this function
    - *              again to continue CRC calculation.
    - */
    -extern LZMA_API(uint32_t) lzma_crc32(
    -		const uint8_t *buf, size_t size, uint32_t crc)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Calculate CRC64
    - *
    - * Calculate CRC64 using the polynomial from the ECMA-182 standard.
    - *
    - * This function is used similarly to lzma_crc32(). See its documentation.
    - */
    -extern LZMA_API(uint64_t) lzma_crc64(
    -		const uint8_t *buf, size_t size, uint64_t crc)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/*
    - * SHA-256 functions are currently not exported to public API.
    - * Contact Lasse Collin if you think it should be.
    - */
    -
    -
    -/**
    - * \brief       Get the type of the integrity check
    - *
    - * This function can be called only immediately after lzma_code() has
    - * returned LZMA_NO_CHECK, LZMA_UNSUPPORTED_CHECK, or LZMA_GET_CHECK.
    - * Calling this function in any other situation has undefined behavior.
    - */
    -extern LZMA_API(lzma_check) lzma_get_check(const lzma_stream *strm)
    -		lzma_nothrow;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/container.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/container.h
    deleted file mode 100644
    index 86991add1..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/container.h
    +++ /dev/null
    @@ -1,619 +0,0 @@
    -/**
    - * \file        lzma/container.h
    - * \brief       File formats
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/************
    - * Encoding *
    - ************/
    -
    -/**
    - * \brief       Default compression preset
    - *
    - * It's not straightforward to recommend a default preset, because in some
    - * cases keeping the resource usage relatively low is more important that
    - * getting the maximum compression ratio.
    - */
    -#define LZMA_PRESET_DEFAULT     UINT32_C(6)
    -
    -
    -/**
    - * \brief       Mask for preset level
    - *
    - * This is useful only if you need to extract the level from the preset
    - * variable. That should be rare.
    - */
    -#define LZMA_PRESET_LEVEL_MASK  UINT32_C(0x1F)
    -
    -
    -/*
    - * Preset flags
    - *
    - * Currently only one flag is defined.
    - */
    -
    -/**
    - * \brief       Extreme compression preset
    - *
    - * This flag modifies the preset to make the encoding significantly slower
    - * while improving the compression ratio only marginally. This is useful
    - * when you don't mind wasting time to get as small result as possible.
    - *
    - * This flag doesn't affect the memory usage requirements of the decoder (at
    - * least not significantly). The memory usage of the encoder may be increased
    - * a little but only at the lowest preset levels (0-3).
    - */
    -#define LZMA_PRESET_EXTREME       (UINT32_C(1) << 31)
    -
    -
    -/**
    - * \brief       Multithreading options
    - */
    -typedef struct {
    -	/**
    -	 * \brief       Flags
    -	 *
    -	 * Set this to zero if no flags are wanted.
    -	 *
    -	 * No flags are currently supported.
    -	 */
    -	uint32_t flags;
    -
    -	/**
    -	 * \brief       Number of worker threads to use
    -	 */
    -	uint32_t threads;
    -
    -	/**
    -	 * \brief       Maximum uncompressed size of a Block
    -	 *
    -	 * The encoder will start a new .xz Block every block_size bytes.
    -	 * Using LZMA_FULL_FLUSH or LZMA_FULL_BARRIER with lzma_code()
    -	 * the caller may tell liblzma to start a new Block earlier.
    -	 *
    -	 * With LZMA2, a recommended block size is 2-4 times the LZMA2
    -	 * dictionary size. With very small dictionaries, it is recommended
    -	 * to use at least 1 MiB block size for good compression ratio, even
    -	 * if this is more than four times the dictionary size. Note that
    -	 * these are only recommendations for typical use cases; feel free
    -	 * to use other values. Just keep in mind that using a block size
    -	 * less than the LZMA2 dictionary size is waste of RAM.
    -	 *
    -	 * Set this to 0 to let liblzma choose the block size depending
    -	 * on the compression options. For LZMA2 it will be 3*dict_size
    -	 * or 1 MiB, whichever is more.
    -	 *
    -	 * For each thread, about 3 * block_size bytes of memory will be
    -	 * allocated. This may change in later liblzma versions. If so,
    -	 * the memory usage will probably be reduced, not increased.
    -	 */
    -	uint64_t block_size;
    -
    -	/**
    -	 * \brief       Timeout to allow lzma_code() to return early
    -	 *
    -	 * Multithreading can make liblzma to consume input and produce
    -	 * output in a very bursty way: it may first read a lot of input
    -	 * to fill internal buffers, then no input or output occurs for
    -	 * a while.
    -	 *
    -	 * In single-threaded mode, lzma_code() won't return until it has
    -	 * either consumed all the input or filled the output buffer. If
    -	 * this is done in multithreaded mode, it may cause a call
    -	 * lzma_code() to take even tens of seconds, which isn't acceptable
    -	 * in all applications.
    -	 *
    -	 * To avoid very long blocking times in lzma_code(), a timeout
    -	 * (in milliseconds) may be set here. If lzma_code() would block
    -	 * longer than this number of milliseconds, it will return with
    -	 * LZMA_OK. Reasonable values are 100 ms or more. The xz command
    -	 * line tool uses 300 ms.
    -	 *
    -	 * If long blocking times are fine for you, set timeout to a special
    -	 * value of 0, which will disable the timeout mechanism and will make
    -	 * lzma_code() block until all the input is consumed or the output
    -	 * buffer has been filled.
    -	 *
    -	 * \note        Even with a timeout, lzma_code() might sometimes take
    -	 *              somewhat long time to return. No timing guarantees
    -	 *              are made.
    -	 */
    -	uint32_t timeout;
    -
    -	/**
    -	 * \brief       Compression preset (level and possible flags)
    -	 *
    -	 * The preset is set just like with lzma_easy_encoder().
    -	 * The preset is ignored if filters below is non-NULL.
    -	 */
    -	uint32_t preset;
    -
    -	/**
    -	 * \brief       Filter chain (alternative to a preset)
    -	 *
    -	 * If this is NULL, the preset above is used. Otherwise the preset
    -	 * is ignored and the filter chain specified here is used.
    -	 */
    -	const lzma_filter *filters;
    -
    -	/**
    -	 * \brief       Integrity check type
    -	 *
    -	 * See check.h for available checks. The xz command line tool
    -	 * defaults to LZMA_CHECK_CRC64, which is a good choice if you
    -	 * are unsure.
    -	 */
    -	lzma_check check;
    -
    -	/*
    -	 * Reserved space to allow possible future extensions without
    -	 * breaking the ABI. You should not touch these, because the names
    -	 * of these variables may change. These are and will never be used
    -	 * with the currently supported options, so it is safe to leave these
    -	 * uninitialized.
    -	 */
    -	lzma_reserved_enum reserved_enum1;
    -	lzma_reserved_enum reserved_enum2;
    -	lzma_reserved_enum reserved_enum3;
    -	uint32_t reserved_int1;
    -	uint32_t reserved_int2;
    -	uint32_t reserved_int3;
    -	uint32_t reserved_int4;
    -	uint64_t reserved_int5;
    -	uint64_t reserved_int6;
    -	uint64_t reserved_int7;
    -	uint64_t reserved_int8;
    -	void *reserved_ptr1;
    -	void *reserved_ptr2;
    -	void *reserved_ptr3;
    -	void *reserved_ptr4;
    -
    -} lzma_mt;
    -
    -
    -/**
    - * \brief       Calculate approximate memory usage of easy encoder
    - *
    - * This function is a wrapper for lzma_raw_encoder_memusage().
    - *
    - * \param       preset  Compression preset (level and possible flags)
    - *
    - * \return      Number of bytes of memory required for the given
    - *              preset when encoding. If an error occurs, for example
    - *              due to unsupported preset, UINT64_MAX is returned.
    - */
    -extern LZMA_API(uint64_t) lzma_easy_encoder_memusage(uint32_t preset)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Calculate approximate decoder memory usage of a preset
    - *
    - * This function is a wrapper for lzma_raw_decoder_memusage().
    - *
    - * \param       preset  Compression preset (level and possible flags)
    - *
    - * \return      Number of bytes of memory required to decompress a file
    - *              that was compressed using the given preset. If an error
    - *              occurs, for example due to unsupported preset, UINT64_MAX
    - *              is returned.
    - */
    -extern LZMA_API(uint64_t) lzma_easy_decoder_memusage(uint32_t preset)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Initialize .xz Stream encoder using a preset number
    - *
    - * This function is intended for those who just want to use the basic features
    - * if liblzma (that is, most developers out there).
    - *
    - * \param       strm    Pointer to lzma_stream that is at least initialized
    - *                      with LZMA_STREAM_INIT.
    - * \param       preset  Compression preset to use. A preset consist of level
    - *                      number and zero or more flags. Usually flags aren't
    - *                      used, so preset is simply a number [0, 9] which match
    - *                      the options -0 ... -9 of the xz command line tool.
    - *                      Additional flags can be be set using bitwise-or with
    - *                      the preset level number, e.g. 6 | LZMA_PRESET_EXTREME.
    - * \param       check   Integrity check type to use. See check.h for available
    - *                      checks. The xz command line tool defaults to
    - *                      LZMA_CHECK_CRC64, which is a good choice if you are
    - *                      unsure. LZMA_CHECK_CRC32 is good too as long as the
    - *                      uncompressed file is not many gigabytes.
    - *
    - * \return      - LZMA_OK: Initialization succeeded. Use lzma_code() to
    - *                encode your data.
    - *              - LZMA_MEM_ERROR: Memory allocation failed.
    - *              - LZMA_OPTIONS_ERROR: The given compression preset is not
    - *                supported by this build of liblzma.
    - *              - LZMA_UNSUPPORTED_CHECK: The given check type is not
    - *                supported by this liblzma build.
    - *              - LZMA_PROG_ERROR: One or more of the parameters have values
    - *                that will never be valid. For example, strm == NULL.
    - *
    - * If initialization fails (return value is not LZMA_OK), all the memory
    - * allocated for *strm by liblzma is always freed. Thus, there is no need
    - * to call lzma_end() after failed initialization.
    - *
    - * If initialization succeeds, use lzma_code() to do the actual encoding.
    - * Valid values for `action' (the second argument of lzma_code()) are
    - * LZMA_RUN, LZMA_SYNC_FLUSH, LZMA_FULL_FLUSH, and LZMA_FINISH. In future,
    - * there may be compression levels or flags that don't support LZMA_SYNC_FLUSH.
    - */
    -extern LZMA_API(lzma_ret) lzma_easy_encoder(
    -		lzma_stream *strm, uint32_t preset, lzma_check check)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Single-call .xz Stream encoding using a preset number
    - *
    - * The maximum required output buffer size can be calculated with
    - * lzma_stream_buffer_bound().
    - *
    - * \param       preset      Compression preset to use. See the description
    - *                          in lzma_easy_encoder().
    - * \param       check       Type of the integrity check to calculate from
    - *                          uncompressed data.
    - * \param       allocator   lzma_allocator for custom allocator functions.
    - *                          Set to NULL to use malloc() and free().
    - * \param       in          Beginning of the input buffer
    - * \param       in_size     Size of the input buffer
    - * \param       out         Beginning of the output buffer
    - * \param       out_pos     The next byte will be written to out[*out_pos].
    - *                          *out_pos is updated only if encoding succeeds.
    - * \param       out_size    Size of the out buffer; the first byte into
    - *                          which no data is written to is out[out_size].
    - *
    - * \return      - LZMA_OK: Encoding was successful.
    - *              - LZMA_BUF_ERROR: Not enough output buffer space.
    - *              - LZMA_UNSUPPORTED_CHECK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_DATA_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_easy_buffer_encode(
    -		uint32_t preset, lzma_check check,
    -		const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Initialize .xz Stream encoder using a custom filter chain
    - *
    - * \param       strm    Pointer to properly prepared lzma_stream
    - * \param       filters Array of filters. This must be terminated with
    - *                      filters[n].id = LZMA_VLI_UNKNOWN. See filter.h for
    - *                      more information.
    - * \param       check   Type of the integrity check to calculate from
    - *                      uncompressed data.
    - *
    - * \return      - LZMA_OK: Initialization was successful.
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_UNSUPPORTED_CHECK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_encoder(lzma_stream *strm,
    -		const lzma_filter *filters, lzma_check check)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Calculate approximate memory usage of multithreaded .xz encoder
    - *
    - * Since doing the encoding in threaded mode doesn't affect the memory
    - * requirements of single-threaded decompressor, you can use
    - * lzma_easy_decoder_memusage(options->preset) or
    - * lzma_raw_decoder_memusage(options->filters) to calculate
    - * the decompressor memory requirements.
    - *
    - * \param       options Compression options
    - *
    - * \return      Number of bytes of memory required for encoding with the
    - *              given options. If an error occurs, for example due to
    - *              unsupported preset or filter chain, UINT64_MAX is returned.
    - */
    -extern LZMA_API(uint64_t) lzma_stream_encoder_mt_memusage(
    -		const lzma_mt *options) lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Initialize multithreaded .xz Stream encoder
    - *
    - * This provides the functionality of lzma_easy_encoder() and
    - * lzma_stream_encoder() as a single function for multithreaded use.
    - *
    - * The supported actions for lzma_code() are LZMA_RUN, LZMA_FULL_FLUSH,
    - * LZMA_FULL_BARRIER, and LZMA_FINISH. Support for LZMA_SYNC_FLUSH might be
    - * added in the future.
    - *
    - * \param       strm    Pointer to properly prepared lzma_stream
    - * \param       options Pointer to multithreaded compression options
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_UNSUPPORTED_CHECK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_encoder_mt(
    -		lzma_stream *strm, const lzma_mt *options)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Initialize .lzma encoder (legacy file format)
    - *
    - * The .lzma format is sometimes called the LZMA_Alone format, which is the
    - * reason for the name of this function. The .lzma format supports only the
    - * LZMA1 filter. There is no support for integrity checks like CRC32.
    - *
    - * Use this function if and only if you need to create files readable by
    - * legacy LZMA tools such as LZMA Utils 4.32.x. Moving to the .xz format
    - * is strongly recommended.
    - *
    - * The valid action values for lzma_code() are LZMA_RUN and LZMA_FINISH.
    - * No kind of flushing is supported, because the file format doesn't make
    - * it possible.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_alone_encoder(
    -		lzma_stream *strm, const lzma_options_lzma *options)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Calculate output buffer size for single-call Stream encoder
    - *
    - * When trying to compress uncompressible data, the encoded size will be
    - * slightly bigger than the input data. This function calculates how much
    - * output buffer space is required to be sure that lzma_stream_buffer_encode()
    - * doesn't return LZMA_BUF_ERROR.
    - *
    - * The calculated value is not exact, but it is guaranteed to be big enough.
    - * The actual maximum output space required may be slightly smaller (up to
    - * about 100 bytes). This should not be a problem in practice.
    - *
    - * If the calculated maximum size doesn't fit into size_t or would make the
    - * Stream grow past LZMA_VLI_MAX (which should never happen in practice),
    - * zero is returned to indicate the error.
    - *
    - * \note        The limit calculated by this function applies only to
    - *              single-call encoding. Multi-call encoding may (and probably
    - *              will) have larger maximum expansion when encoding
    - *              uncompressible data. Currently there is no function to
    - *              calculate the maximum expansion of multi-call encoding.
    - */
    -extern LZMA_API(size_t) lzma_stream_buffer_bound(size_t uncompressed_size)
    -		lzma_nothrow;
    -
    -
    -/**
    - * \brief       Single-call .xz Stream encoder
    - *
    - * \param       filters     Array of filters. This must be terminated with
    - *                          filters[n].id = LZMA_VLI_UNKNOWN. See filter.h
    - *                          for more information.
    - * \param       check       Type of the integrity check to calculate from
    - *                          uncompressed data.
    - * \param       allocator   lzma_allocator for custom allocator functions.
    - *                          Set to NULL to use malloc() and free().
    - * \param       in          Beginning of the input buffer
    - * \param       in_size     Size of the input buffer
    - * \param       out         Beginning of the output buffer
    - * \param       out_pos     The next byte will be written to out[*out_pos].
    - *                          *out_pos is updated only if encoding succeeds.
    - * \param       out_size    Size of the out buffer; the first byte into
    - *                          which no data is written to is out[out_size].
    - *
    - * \return      - LZMA_OK: Encoding was successful.
    - *              - LZMA_BUF_ERROR: Not enough output buffer space.
    - *              - LZMA_UNSUPPORTED_CHECK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_DATA_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_buffer_encode(
    -		lzma_filter *filters, lzma_check check,
    -		const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/************
    - * Decoding *
    - ************/
    -
    -/**
    - * This flag makes lzma_code() return LZMA_NO_CHECK if the input stream
    - * being decoded has no integrity check. Note that when used with
    - * lzma_auto_decoder(), all .lzma files will trigger LZMA_NO_CHECK
    - * if LZMA_TELL_NO_CHECK is used.
    - */
    -#define LZMA_TELL_NO_CHECK              UINT32_C(0x01)
    -
    -
    -/**
    - * This flag makes lzma_code() return LZMA_UNSUPPORTED_CHECK if the input
    - * stream has an integrity check, but the type of the integrity check is not
    - * supported by this liblzma version or build. Such files can still be
    - * decoded, but the integrity check cannot be verified.
    - */
    -#define LZMA_TELL_UNSUPPORTED_CHECK     UINT32_C(0x02)
    -
    -
    -/**
    - * This flag makes lzma_code() return LZMA_GET_CHECK as soon as the type
    - * of the integrity check is known. The type can then be got with
    - * lzma_get_check().
    - */
    -#define LZMA_TELL_ANY_CHECK             UINT32_C(0x04)
    -
    -
    -/**
    - * This flag makes lzma_code() not calculate and verify the integrity check
    - * of the compressed data in .xz files. This means that invalid integrity
    - * check values won't be detected and LZMA_DATA_ERROR won't be returned in
    - * such cases.
    - *
    - * This flag only affects the checks of the compressed data itself; the CRC32
    - * values in the .xz headers will still be verified normally.
    - *
    - * Don't use this flag unless you know what you are doing. Possible reasons
    - * to use this flag:
    - *
    - *   - Trying to recover data from a corrupt .xz file.
    - *
    - *   - Speeding up decompression, which matters mostly with SHA-256
    - *     or with files that have compressed extremely well. It's recommended
    - *     to not use this flag for this purpose unless the file integrity is
    - *     verified externally in some other way.
    - *
    - * Support for this flag was added in liblzma 5.1.4beta.
    - */
    -#define LZMA_IGNORE_CHECK               UINT32_C(0x10)
    -
    -
    -/**
    - * This flag enables decoding of concatenated files with file formats that
    - * allow concatenating compressed files as is. From the formats currently
    - * supported by liblzma, only the .xz format allows concatenated files.
    - * Concatenated files are not allowed with the legacy .lzma format.
    - *
    - * This flag also affects the usage of the `action' argument for lzma_code().
    - * When LZMA_CONCATENATED is used, lzma_code() won't return LZMA_STREAM_END
    - * unless LZMA_FINISH is used as `action'. Thus, the application has to set
    - * LZMA_FINISH in the same way as it does when encoding.
    - *
    - * If LZMA_CONCATENATED is not used, the decoders still accept LZMA_FINISH
    - * as `action' for lzma_code(), but the usage of LZMA_FINISH isn't required.
    - */
    -#define LZMA_CONCATENATED               UINT32_C(0x08)
    -
    -
    -/**
    - * \brief       Initialize .xz Stream decoder
    - *
    - * \param       strm        Pointer to properly prepared lzma_stream
    - * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
    - *                          to effectively disable the limiter.
    - * \param       flags       Bitwise-or of zero or more of the decoder flags:
    - *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
    - *                          LZMA_TELL_ANY_CHECK, LZMA_CONCATENATED
    - *
    - * \return      - LZMA_OK: Initialization was successful.
    - *              - LZMA_MEM_ERROR: Cannot allocate memory.
    - *              - LZMA_OPTIONS_ERROR: Unsupported flags
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_decoder(
    -		lzma_stream *strm, uint64_t memlimit, uint32_t flags)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Decode .xz Streams and .lzma files with autodetection
    - *
    - * This decoder autodetects between the .xz and .lzma file formats, and
    - * calls lzma_stream_decoder() or lzma_alone_decoder() once the type
    - * of the input file has been detected.
    - *
    - * \param       strm        Pointer to properly prepared lzma_stream
    - * \param       memlimit    Memory usage limit as bytes. Use UINT64_MAX
    - *                          to effectively disable the limiter.
    - * \param       flags       Bitwise-or of flags, or zero for no flags.
    - *
    - * \return      - LZMA_OK: Initialization was successful.
    - *              - LZMA_MEM_ERROR: Cannot allocate memory.
    - *              - LZMA_OPTIONS_ERROR: Unsupported flags
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_auto_decoder(
    -		lzma_stream *strm, uint64_t memlimit, uint32_t flags)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Initialize .lzma decoder (legacy file format)
    - *
    - * Valid `action' arguments to lzma_code() are LZMA_RUN and LZMA_FINISH.
    - * There is no need to use LZMA_FINISH, but allowing it may simplify
    - * certain types of applications.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_alone_decoder(
    -		lzma_stream *strm, uint64_t memlimit)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Single-call .xz Stream decoder
    - *
    - * \param       memlimit    Pointer to how much memory the decoder is allowed
    - *                          to allocate. The value pointed by this pointer is
    - *                          modified if and only if LZMA_MEMLIMIT_ERROR is
    - *                          returned.
    - * \param       flags       Bitwise-or of zero or more of the decoder flags:
    - *                          LZMA_TELL_NO_CHECK, LZMA_TELL_UNSUPPORTED_CHECK,
    - *                          LZMA_CONCATENATED. Note that LZMA_TELL_ANY_CHECK
    - *                          is not allowed and will return LZMA_PROG_ERROR.
    - * \param       allocator   lzma_allocator for custom allocator functions.
    - *                          Set to NULL to use malloc() and free().
    - * \param       in          Beginning of the input buffer
    - * \param       in_pos      The next byte will be read from in[*in_pos].
    - *                          *in_pos is updated only if decoding succeeds.
    - * \param       in_size     Size of the input buffer; the first byte that
    - *                          won't be read is in[in_size].
    - * \param       out         Beginning of the output buffer
    - * \param       out_pos     The next byte will be written to out[*out_pos].
    - *                          *out_pos is updated only if decoding succeeds.
    - * \param       out_size    Size of the out buffer; the first byte into
    - *                          which no data is written to is out[out_size].
    - *
    - * \return      - LZMA_OK: Decoding was successful.
    - *              - LZMA_FORMAT_ERROR
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_DATA_ERROR
    - *              - LZMA_NO_CHECK: This can be returned only if using
    - *                the LZMA_TELL_NO_CHECK flag.
    - *              - LZMA_UNSUPPORTED_CHECK: This can be returned only if using
    - *                the LZMA_TELL_UNSUPPORTED_CHECK flag.
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.
    - *                The minimum required memlimit value was stored to *memlimit.
    - *              - LZMA_BUF_ERROR: Output buffer was too small.
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_buffer_decode(
    -		uint64_t *memlimit, uint32_t flags,
    -		const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/delta.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/delta.h
    deleted file mode 100644
    index 592fc4f84..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/delta.h
    +++ /dev/null
    @@ -1,77 +0,0 @@
    -/**
    - * \file        lzma/delta.h
    - * \brief       Delta filter
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Filter ID
    - *
    - * Filter ID of the Delta filter. This is used as lzma_filter.id.
    - */
    -#define LZMA_FILTER_DELTA       LZMA_VLI_C(0x03)
    -
    -
    -/**
    - * \brief       Type of the delta calculation
    - *
    - * Currently only byte-wise delta is supported. Other possible types could
    - * be, for example, delta of 16/32/64-bit little/big endian integers, but
    - * these are not currently planned since byte-wise delta is almost as good.
    - */
    -typedef enum {
    -	LZMA_DELTA_TYPE_BYTE
    -} lzma_delta_type;
    -
    -
    -/**
    - * \brief       Options for the Delta filter
    - *
    - * These options are needed by both encoder and decoder.
    - */
    -typedef struct {
    -	/** For now, this must always be LZMA_DELTA_TYPE_BYTE. */
    -	lzma_delta_type type;
    -
    -	/**
    -	 * \brief       Delta distance
    -	 *
    -	 * With the only currently supported type, LZMA_DELTA_TYPE_BYTE,
    -	 * the distance is as bytes.
    -	 *
    -	 * Examples:
    -	 *  - 16-bit stereo audio: distance = 4 bytes
    -	 *  - 24-bit RGB image data: distance = 3 bytes
    -	 */
    -	uint32_t dist;
    -#	define LZMA_DELTA_DIST_MIN 1
    -#	define LZMA_DELTA_DIST_MAX 256
    -
    -	/*
    -	 * Reserved space to allow possible future extensions without
    -	 * breaking the ABI. You should not touch these, because the names
    -	 * of these variables may change. These are and will never be used
    -	 * when type is LZMA_DELTA_TYPE_BYTE, so it is safe to leave these
    -	 * uninitialized.
    -	 */
    -	uint32_t reserved_int1;
    -	uint32_t reserved_int2;
    -	uint32_t reserved_int3;
    -	uint32_t reserved_int4;
    -	void *reserved_ptr1;
    -	void *reserved_ptr2;
    -
    -} lzma_options_delta;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/filter.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/filter.h
    deleted file mode 100644
    index 4e78752b8..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/filter.h
    +++ /dev/null
    @@ -1,425 +0,0 @@
    -/**
    - * \file        lzma/filter.h
    - * \brief       Common filter related types and functions
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Maximum number of filters in a chain
    - *
    - * A filter chain can have 1-4 filters, of which three are allowed to change
    - * the size of the data. Usually only one or two filters are needed.
    - */
    -#define LZMA_FILTERS_MAX 4
    -
    -
    -/**
    - * \brief       Filter options
    - *
    - * This structure is used to pass Filter ID and a pointer filter's
    - * options to liblzma. A few functions work with a single lzma_filter
    - * structure, while most functions expect a filter chain.
    - *
    - * A filter chain is indicated with an array of lzma_filter structures.
    - * The array is terminated with .id = LZMA_VLI_UNKNOWN. Thus, the filter
    - * array must have LZMA_FILTERS_MAX + 1 elements (that is, five) to
    - * be able to hold any arbitrary filter chain. This is important when
    - * using lzma_block_header_decode() from block.h, because too small
    - * array would make liblzma write past the end of the filters array.
    - */
    -typedef struct {
    -	/**
    -	 * \brief       Filter ID
    -	 *
    -	 * Use constants whose name begin with `LZMA_FILTER_' to specify
    -	 * different filters. In an array of lzma_filter structures, use
    -	 * LZMA_VLI_UNKNOWN to indicate end of filters.
    -	 *
    -	 * \note        This is not an enum, because on some systems enums
    -	 *              cannot be 64-bit.
    -	 */
    -	lzma_vli id;
    -
    -	/**
    -	 * \brief       Pointer to filter-specific options structure
    -	 *
    -	 * If the filter doesn't need options, set this to NULL. If id is
    -	 * set to LZMA_VLI_UNKNOWN, options is ignored, and thus
    -	 * doesn't need be initialized.
    -	 */
    -	void *options;
    -
    -} lzma_filter;
    -
    -
    -/**
    - * \brief       Test if the given Filter ID is supported for encoding
    - *
    - * Return true if the give Filter ID is supported for encoding by this
    - * liblzma build. Otherwise false is returned.
    - *
    - * There is no way to list which filters are available in this particular
    - * liblzma version and build. It would be useless, because the application
    - * couldn't know what kind of options the filter would need.
    - */
    -extern LZMA_API(lzma_bool) lzma_filter_encoder_is_supported(lzma_vli id)
    -		lzma_nothrow lzma_attr_const;
    -
    -
    -/**
    - * \brief       Test if the given Filter ID is supported for decoding
    - *
    - * Return true if the give Filter ID is supported for decoding by this
    - * liblzma build. Otherwise false is returned.
    - */
    -extern LZMA_API(lzma_bool) lzma_filter_decoder_is_supported(lzma_vli id)
    -		lzma_nothrow lzma_attr_const;
    -
    -
    -/**
    - * \brief       Copy the filters array
    - *
    - * Copy the Filter IDs and filter-specific options from src to dest.
    - * Up to LZMA_FILTERS_MAX filters are copied, plus the terminating
    - * .id == LZMA_VLI_UNKNOWN. Thus, dest should have at least
    - * LZMA_FILTERS_MAX + 1 elements space unless the caller knows that
    - * src is smaller than that.
    - *
    - * Unless the filter-specific options is NULL, the Filter ID has to be
    - * supported by liblzma, because liblzma needs to know the size of every
    - * filter-specific options structure. The filter-specific options are not
    - * validated. If options is NULL, any unsupported Filter IDs are copied
    - * without returning an error.
    - *
    - * Old filter-specific options in dest are not freed, so dest doesn't
    - * need to be initialized by the caller in any way.
    - *
    - * If an error occurs, memory possibly already allocated by this function
    - * is always freed.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_OPTIONS_ERROR: Unsupported Filter ID and its options
    - *                is not NULL.
    - *              - LZMA_PROG_ERROR: src or dest is NULL.
    - */
    -extern LZMA_API(lzma_ret) lzma_filters_copy(
    -		const lzma_filter *src, lzma_filter *dest,
    -		const lzma_allocator *allocator) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Calculate approximate memory requirements for raw encoder
    - *
    - * This function can be used to calculate the memory requirements for
    - * Block and Stream encoders too because Block and Stream encoders don't
    - * need significantly more memory than raw encoder.
    - *
    - * \param       filters     Array of filters terminated with
    - *                          .id == LZMA_VLI_UNKNOWN.
    - *
    - * \return      Number of bytes of memory required for the given
    - *              filter chain when encoding. If an error occurs,
    - *              for example due to unsupported filter chain,
    - *              UINT64_MAX is returned.
    - */
    -extern LZMA_API(uint64_t) lzma_raw_encoder_memusage(const lzma_filter *filters)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Calculate approximate memory requirements for raw decoder
    - *
    - * This function can be used to calculate the memory requirements for
    - * Block and Stream decoders too because Block and Stream decoders don't
    - * need significantly more memory than raw decoder.
    - *
    - * \param       filters     Array of filters terminated with
    - *                          .id == LZMA_VLI_UNKNOWN.
    - *
    - * \return      Number of bytes of memory required for the given
    - *              filter chain when decoding. If an error occurs,
    - *              for example due to unsupported filter chain,
    - *              UINT64_MAX is returned.
    - */
    -extern LZMA_API(uint64_t) lzma_raw_decoder_memusage(const lzma_filter *filters)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Initialize raw encoder
    - *
    - * This function may be useful when implementing custom file formats.
    - *
    - * \param       strm    Pointer to properly prepared lzma_stream
    - * \param       filters Array of lzma_filter structures. The end of the
    - *                      array must be marked with .id = LZMA_VLI_UNKNOWN.
    - *
    - * The `action' with lzma_code() can be LZMA_RUN, LZMA_SYNC_FLUSH (if the
    - * filter chain supports it), or LZMA_FINISH.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_raw_encoder(
    -		lzma_stream *strm, const lzma_filter *filters)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Initialize raw decoder
    - *
    - * The initialization of raw decoder goes similarly to raw encoder.
    - *
    - * The `action' with lzma_code() can be LZMA_RUN or LZMA_FINISH. Using
    - * LZMA_FINISH is not required, it is supported just for convenience.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_raw_decoder(
    -		lzma_stream *strm, const lzma_filter *filters)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Update the filter chain in the encoder
    - *
    - * This function is for advanced users only. This function has two slightly
    - * different purposes:
    - *
    - *  - After LZMA_FULL_FLUSH when using Stream encoder: Set a new filter
    - *    chain, which will be used starting from the next Block.
    - *
    - *  - After LZMA_SYNC_FLUSH using Raw, Block, or Stream encoder: Change
    - *    the filter-specific options in the middle of encoding. The actual
    - *    filters in the chain (Filter IDs) cannot be changed. In the future,
    - *    it might become possible to change the filter options without
    - *    using LZMA_SYNC_FLUSH.
    - *
    - * While rarely useful, this function may be called also when no data has
    - * been compressed yet. In that case, this function will behave as if
    - * LZMA_FULL_FLUSH (Stream encoder) or LZMA_SYNC_FLUSH (Raw or Block
    - * encoder) had been used right before calling this function.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_MEMLIMIT_ERROR
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_filters_update(
    -		lzma_stream *strm, const lzma_filter *filters) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Single-call raw encoder
    - *
    - * \param       filters     Array of lzma_filter structures. The end of the
    - *                          array must be marked with .id = LZMA_VLI_UNKNOWN.
    - * \param       allocator   lzma_allocator for custom allocator functions.
    - *                          Set to NULL to use malloc() and free().
    - * \param       in          Beginning of the input buffer
    - * \param       in_size     Size of the input buffer
    - * \param       out         Beginning of the output buffer
    - * \param       out_pos     The next byte will be written to out[*out_pos].
    - *                          *out_pos is updated only if encoding succeeds.
    - * \param       out_size    Size of the out buffer; the first byte into
    - *                          which no data is written to is out[out_size].
    - *
    - * \return      - LZMA_OK: Encoding was successful.
    - *              - LZMA_BUF_ERROR: Not enough output buffer space.
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_DATA_ERROR
    - *              - LZMA_PROG_ERROR
    - *
    - * \note        There is no function to calculate how big output buffer
    - *              would surely be big enough. (lzma_stream_buffer_bound()
    - *              works only for lzma_stream_buffer_encode(); raw encoder
    - *              won't necessarily meet that bound.)
    - */
    -extern LZMA_API(lzma_ret) lzma_raw_buffer_encode(
    -		const lzma_filter *filters, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size, uint8_t *out,
    -		size_t *out_pos, size_t out_size) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Single-call raw decoder
    - *
    - * \param       filters     Array of lzma_filter structures. The end of the
    - *                          array must be marked with .id = LZMA_VLI_UNKNOWN.
    - * \param       allocator   lzma_allocator for custom allocator functions.
    - *                          Set to NULL to use malloc() and free().
    - * \param       in          Beginning of the input buffer
    - * \param       in_pos      The next byte will be read from in[*in_pos].
    - *                          *in_pos is updated only if decoding succeeds.
    - * \param       in_size     Size of the input buffer; the first byte that
    - *                          won't be read is in[in_size].
    - * \param       out         Beginning of the output buffer
    - * \param       out_pos     The next byte will be written to out[*out_pos].
    - *                          *out_pos is updated only if encoding succeeds.
    - * \param       out_size    Size of the out buffer; the first byte into
    - *                          which no data is written to is out[out_size].
    - */
    -extern LZMA_API(lzma_ret) lzma_raw_buffer_decode(
    -		const lzma_filter *filters, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Get the size of the Filter Properties field
    - *
    - * This function may be useful when implementing custom file formats
    - * using the raw encoder and decoder.
    - *
    - * \param       size    Pointer to uint32_t to hold the size of the properties
    - * \param       filter  Filter ID and options (the size of the properties may
    - *                      vary depending on the options)
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_PROG_ERROR
    - *
    - * \note        This function validates the Filter ID, but does not
    - *              necessarily validate the options. Thus, it is possible
    - *              that this returns LZMA_OK while the following call to
    - *              lzma_properties_encode() returns LZMA_OPTIONS_ERROR.
    - */
    -extern LZMA_API(lzma_ret) lzma_properties_size(
    -		uint32_t *size, const lzma_filter *filter) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Encode the Filter Properties field
    - *
    - * \param       filter  Filter ID and options
    - * \param       props   Buffer to hold the encoded options. The size of
    - *                      buffer must have been already determined with
    - *                      lzma_properties_size().
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_PROG_ERROR
    - *
    - * \note        Even this function won't validate more options than actually
    - *              necessary. Thus, it is possible that encoding the properties
    - *              succeeds but using the same options to initialize the encoder
    - *              will fail.
    - *
    - * \note        If lzma_properties_size() indicated that the size
    - *              of the Filter Properties field is zero, calling
    - *              lzma_properties_encode() is not required, but it
    - *              won't do any harm either.
    - */
    -extern LZMA_API(lzma_ret) lzma_properties_encode(
    -		const lzma_filter *filter, uint8_t *props) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Decode the Filter Properties field
    - *
    - * \param       filter      filter->id must have been set to the correct
    - *                          Filter ID. filter->options doesn't need to be
    - *                          initialized (it's not freed by this function). The
    - *                          decoded options will be stored to filter->options.
    - *                          filter->options is set to NULL if there are no
    - *                          properties or if an error occurs.
    - * \param       allocator   Custom memory allocator used to allocate the
    - *                          options. Set to NULL to use the default malloc(),
    - *                          and in case of an error, also free().
    - * \param       props       Input buffer containing the properties.
    - * \param       props_size  Size of the properties. This must be the exact
    - *                          size; giving too much or too little input will
    - *                          return LZMA_OPTIONS_ERROR.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_MEM_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_properties_decode(
    -		lzma_filter *filter, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Calculate encoded size of a Filter Flags field
    - *
    - * Knowing the size of Filter Flags is useful to know when allocating
    - * memory to hold the encoded Filter Flags.
    - *
    - * \param       size    Pointer to integer to hold the calculated size
    - * \param       filter  Filter ID and associated options whose encoded
    - *                      size is to be calculated
    - *
    - * \return      - LZMA_OK: *size set successfully. Note that this doesn't
    - *                guarantee that filter->options is valid, thus
    - *                lzma_filter_flags_encode() may still fail.
    - *              - LZMA_OPTIONS_ERROR: Unknown Filter ID or unsupported options.
    - *              - LZMA_PROG_ERROR: Invalid options
    - *
    - * \note        If you need to calculate size of List of Filter Flags,
    - *              you need to loop over every lzma_filter entry.
    - */
    -extern LZMA_API(lzma_ret) lzma_filter_flags_size(
    -		uint32_t *size, const lzma_filter *filter)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Encode Filter Flags into given buffer
    - *
    - * In contrast to some functions, this doesn't allocate the needed buffer.
    - * This is due to how this function is used internally by liblzma.
    - *
    - * \param       filter      Filter ID and options to be encoded
    - * \param       out         Beginning of the output buffer
    - * \param       out_pos     out[*out_pos] is the next write position. This
    - *                          is updated by the encoder.
    - * \param       out_size    out[out_size] is the first byte to not write.
    - *
    - * \return      - LZMA_OK: Encoding was successful.
    - *              - LZMA_OPTIONS_ERROR: Invalid or unsupported options.
    - *              - LZMA_PROG_ERROR: Invalid options or not enough output
    - *                buffer space (you should have checked it with
    - *                lzma_filter_flags_size()).
    - */
    -extern LZMA_API(lzma_ret) lzma_filter_flags_encode(const lzma_filter *filter,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Decode Filter Flags from given buffer
    - *
    - * The decoded result is stored into *filter. The old value of
    - * filter->options is not free()d.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_OPTIONS_ERROR
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_filter_flags_decode(
    -		lzma_filter *filter, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/hardware.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/hardware.h
    deleted file mode 100644
    index 5321d9af8..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/hardware.h
    +++ /dev/null
    @@ -1,64 +0,0 @@
    -/**
    - * \file        lzma/hardware.h
    - * \brief       Hardware information
    - *
    - * Since liblzma can consume a lot of system resources, it also provides
    - * ways to limit the resource usage. Applications linking against liblzma
    - * need to do the actual decisions how much resources to let liblzma to use.
    - * To ease making these decisions, liblzma provides functions to find out
    - * the relevant capabilities of the underlaying hardware. Currently there
    - * is only a function to find out the amount of RAM, but in the future there
    - * will be also a function to detect how many concurrent threads the system
    - * can run.
    - *
    - * \note        On some operating systems, these function may temporarily
    - *              load a shared library or open file descriptor(s) to find out
    - *              the requested hardware information. Unless the application
    - *              assumes that specific file descriptors are not touched by
    - *              other threads, this should have no effect on thread safety.
    - *              Possible operations involving file descriptors will restart
    - *              the syscalls if they return EINTR.
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Get the total amount of physical memory (RAM) in bytes
    - *
    - * This function may be useful when determining a reasonable memory
    - * usage limit for decompressing or how much memory it is OK to use
    - * for compressing.
    - *
    - * \return      On success, the total amount of physical memory in bytes
    - *              is returned. If the amount of RAM cannot be determined,
    - *              zero is returned. This can happen if an error occurs
    - *              or if there is no code in liblzma to detect the amount
    - *              of RAM on the specific operating system.
    - */
    -extern LZMA_API(uint64_t) lzma_physmem(void) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Get the number of processor cores or threads
    - *
    - * This function may be useful when determining how many threads to use.
    - * If the hardware supports more than one thread per CPU core, the number
    - * of hardware threads is returned if that information is available.
    - *
    - * \brief       On success, the number of available CPU threads or cores is
    - *              returned. If this information isn't available or an error
    - *              occurs, zero is returned.
    - */
    -extern LZMA_API(uint32_t) lzma_cputhreads(void) lzma_nothrow;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/index.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/index.h
    deleted file mode 100644
    index dda60ec1c..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/index.h
    +++ /dev/null
    @@ -1,682 +0,0 @@
    -/**
    - * \file        lzma/index.h
    - * \brief       Handling of .xz Index and related information
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Opaque data type to hold the Index(es) and other information
    - *
    - * lzma_index often holds just one .xz Index and possibly the Stream Flags
    - * of the same Stream and size of the Stream Padding field. However,
    - * multiple lzma_indexes can be concatenated with lzma_index_cat() and then
    - * there may be information about multiple Streams in the same lzma_index.
    - *
    - * Notes about thread safety: Only one thread may modify lzma_index at
    - * a time. All functions that take non-const pointer to lzma_index
    - * modify it. As long as no thread is modifying the lzma_index, getting
    - * information from the same lzma_index can be done from multiple threads
    - * at the same time with functions that take a const pointer to
    - * lzma_index or use lzma_index_iter. The same iterator must be used
    - * only by one thread at a time, of course, but there can be as many
    - * iterators for the same lzma_index as needed.
    - */
    -typedef struct lzma_index_s lzma_index;
    -
    -
    -/**
    - * \brief       Iterator to get information about Blocks and Streams
    - */
    -typedef struct {
    -	struct {
    -		/**
    -		 * \brief       Pointer to Stream Flags
    -		 *
    -		 * This is NULL if Stream Flags have not been set for
    -		 * this Stream with lzma_index_stream_flags().
    -		 */
    -		const lzma_stream_flags *flags;
    -
    -		const void *reserved_ptr1;
    -		const void *reserved_ptr2;
    -		const void *reserved_ptr3;
    -
    -		/**
    -		 * \brief       Stream number in the lzma_index
    -		 *
    -		 * The first Stream is 1.
    -		 */
    -		lzma_vli number;
    -
    -		/**
    -		 * \brief       Number of Blocks in the Stream
    -		 *
    -		 * If this is zero, the block structure below has
    -		 * undefined values.
    -		 */
    -		lzma_vli block_count;
    -
    -		/**
    -		 * \brief       Compressed start offset of this Stream
    -		 *
    -		 * The offset is relative to the beginning of the lzma_index
    -		 * (i.e. usually the beginning of the .xz file).
    -		 */
    -		lzma_vli compressed_offset;
    -
    -		/**
    -		 * \brief       Uncompressed start offset of this Stream
    -		 *
    -		 * The offset is relative to the beginning of the lzma_index
    -		 * (i.e. usually the beginning of the .xz file).
    -		 */
    -		lzma_vli uncompressed_offset;
    -
    -		/**
    -		 * \brief       Compressed size of this Stream
    -		 *
    -		 * This includes all headers except the possible
    -		 * Stream Padding after this Stream.
    -		 */
    -		lzma_vli compressed_size;
    -
    -		/**
    -		 * \brief       Uncompressed size of this Stream
    -		 */
    -		lzma_vli uncompressed_size;
    -
    -		/**
    -		 * \brief       Size of Stream Padding after this Stream
    -		 *
    -		 * If it hasn't been set with lzma_index_stream_padding(),
    -		 * this defaults to zero. Stream Padding is always
    -		 * a multiple of four bytes.
    -		 */
    -		lzma_vli padding;
    -
    -		lzma_vli reserved_vli1;
    -		lzma_vli reserved_vli2;
    -		lzma_vli reserved_vli3;
    -		lzma_vli reserved_vli4;
    -	} stream;
    -
    -	struct {
    -		/**
    -		 * \brief       Block number in the file
    -		 *
    -		 * The first Block is 1.
    -		 */
    -		lzma_vli number_in_file;
    -
    -		/**
    -		 * \brief       Compressed start offset of this Block
    -		 *
    -		 * This offset is relative to the beginning of the
    -		 * lzma_index (i.e. usually the beginning of the .xz file).
    -		 * Normally this is where you should seek in the .xz file
    -		 * to start decompressing this Block.
    -		 */
    -		lzma_vli compressed_file_offset;
    -
    -		/**
    -		 * \brief       Uncompressed start offset of this Block
    -		 *
    -		 * This offset is relative to the beginning of the lzma_index
    -		 * (i.e. usually the beginning of the .xz file).
    -		 *
    -		 * When doing random-access reading, it is possible that
    -		 * the target offset is not exactly at Block boundary. One
    -		 * will need to compare the target offset against
    -		 * uncompressed_file_offset or uncompressed_stream_offset,
    -		 * and possibly decode and throw away some amount of data
    -		 * before reaching the target offset.
    -		 */
    -		lzma_vli uncompressed_file_offset;
    -
    -		/**
    -		 * \brief       Block number in this Stream
    -		 *
    -		 * The first Block is 1.
    -		 */
    -		lzma_vli number_in_stream;
    -
    -		/**
    -		 * \brief       Compressed start offset of this Block
    -		 *
    -		 * This offset is relative to the beginning of the Stream
    -		 * containing this Block.
    -		 */
    -		lzma_vli compressed_stream_offset;
    -
    -		/**
    -		 * \brief       Uncompressed start offset of this Block
    -		 *
    -		 * This offset is relative to the beginning of the Stream
    -		 * containing this Block.
    -		 */
    -		lzma_vli uncompressed_stream_offset;
    -
    -		/**
    -		 * \brief       Uncompressed size of this Block
    -		 *
    -		 * You should pass this to the Block decoder if you will
    -		 * decode this Block. It will allow the Block decoder to
    -		 * validate the uncompressed size.
    -		 */
    -		lzma_vli uncompressed_size;
    -
    -		/**
    -		 * \brief       Unpadded size of this Block
    -		 *
    -		 * You should pass this to the Block decoder if you will
    -		 * decode this Block. It will allow the Block decoder to
    -		 * validate the unpadded size.
    -		 */
    -		lzma_vli unpadded_size;
    -
    -		/**
    -		 * \brief       Total compressed size
    -		 *
    -		 * This includes all headers and padding in this Block.
    -		 * This is useful if you need to know how many bytes
    -		 * the Block decoder will actually read.
    -		 */
    -		lzma_vli total_size;
    -
    -		lzma_vli reserved_vli1;
    -		lzma_vli reserved_vli2;
    -		lzma_vli reserved_vli3;
    -		lzma_vli reserved_vli4;
    -
    -		const void *reserved_ptr1;
    -		const void *reserved_ptr2;
    -		const void *reserved_ptr3;
    -		const void *reserved_ptr4;
    -	} block;
    -
    -	/*
    -	 * Internal data which is used to store the state of the iterator.
    -	 * The exact format may vary between liblzma versions, so don't
    -	 * touch these in any way.
    -	 */
    -	union {
    -		const void *p;
    -		size_t s;
    -		lzma_vli v;
    -	} internal[6];
    -} lzma_index_iter;
    -
    -
    -/**
    - * \brief       Operation mode for lzma_index_iter_next()
    - */
    -typedef enum {
    -	LZMA_INDEX_ITER_ANY             = 0,
    -		/**<
    -		 * \brief       Get the next Block or Stream
    -		 *
    -		 * Go to the next Block if the current Stream has at least
    -		 * one Block left. Otherwise go to the next Stream even if
    -		 * it has no Blocks. If the Stream has no Blocks
    -		 * (lzma_index_iter.stream.block_count == 0),
    -		 * lzma_index_iter.block will have undefined values.
    -		 */
    -
    -	LZMA_INDEX_ITER_STREAM          = 1,
    -		/**<
    -		 * \brief       Get the next Stream
    -		 *
    -		 * Go to the next Stream even if the current Stream has
    -		 * unread Blocks left. If the next Stream has at least one
    -		 * Block, the iterator will point to the first Block.
    -		 * If there are no Blocks, lzma_index_iter.block will have
    -		 * undefined values.
    -		 */
    -
    -	LZMA_INDEX_ITER_BLOCK           = 2,
    -		/**<
    -		 * \brief       Get the next Block
    -		 *
    -		 * Go to the next Block if the current Stream has at least
    -		 * one Block left. If the current Stream has no Blocks left,
    -		 * the next Stream with at least one Block is located and
    -		 * the iterator will be made to point to the first Block of
    -		 * that Stream.
    -		 */
    -
    -	LZMA_INDEX_ITER_NONEMPTY_BLOCK  = 3
    -		/**<
    -		 * \brief       Get the next non-empty Block
    -		 *
    -		 * This is like LZMA_INDEX_ITER_BLOCK except that it will
    -		 * skip Blocks whose Uncompressed Size is zero.
    -		 */
    -
    -} lzma_index_iter_mode;
    -
    -
    -/**
    - * \brief       Calculate memory usage of lzma_index
    - *
    - * On disk, the size of the Index field depends on both the number of Records
    - * stored and how big values the Records store (due to variable-length integer
    - * encoding). When the Index is kept in lzma_index structure, the memory usage
    - * depends only on the number of Records/Blocks stored in the Index(es), and
    - * in case of concatenated lzma_indexes, the number of Streams. The size in
    - * RAM is almost always significantly bigger than in the encoded form on disk.
    - *
    - * This function calculates an approximate amount of memory needed hold
    - * the given number of Streams and Blocks in lzma_index structure. This
    - * value may vary between CPU architectures and also between liblzma versions
    - * if the internal implementation is modified.
    - */
    -extern LZMA_API(uint64_t) lzma_index_memusage(
    -		lzma_vli streams, lzma_vli blocks) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Calculate the memory usage of an existing lzma_index
    - *
    - * This is a shorthand for lzma_index_memusage(lzma_index_stream_count(i),
    - * lzma_index_block_count(i)).
    - */
    -extern LZMA_API(uint64_t) lzma_index_memused(const lzma_index *i)
    -		lzma_nothrow;
    -
    -
    -/**
    - * \brief       Allocate and initialize a new lzma_index structure
    - *
    - * \return      On success, a pointer to an empty initialized lzma_index is
    - *              returned. If allocation fails, NULL is returned.
    - */
    -extern LZMA_API(lzma_index *) lzma_index_init(const lzma_allocator *allocator)
    -		lzma_nothrow;
    -
    -
    -/**
    - * \brief       Deallocate lzma_index
    - *
    - * If i is NULL, this does nothing.
    - */
    -extern LZMA_API(void) lzma_index_end(
    -		lzma_index *i, const lzma_allocator *allocator) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Add a new Block to lzma_index
    - *
    - * \param       i                 Pointer to a lzma_index structure
    - * \param       allocator         Pointer to lzma_allocator, or NULL to
    - *                                use malloc()
    - * \param       unpadded_size     Unpadded Size of a Block. This can be
    - *                                calculated with lzma_block_unpadded_size()
    - *                                after encoding or decoding the Block.
    - * \param       uncompressed_size Uncompressed Size of a Block. This can be
    - *                                taken directly from lzma_block structure
    - *                                after encoding or decoding the Block.
    - *
    - * Appending a new Block does not invalidate iterators. For example,
    - * if an iterator was pointing to the end of the lzma_index, after
    - * lzma_index_append() it is possible to read the next Block with
    - * an existing iterator.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_DATA_ERROR: Compressed or uncompressed size of the
    - *                Stream or size of the Index field would grow too big.
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_index_append(
    -		lzma_index *i, const lzma_allocator *allocator,
    -		lzma_vli unpadded_size, lzma_vli uncompressed_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Set the Stream Flags
    - *
    - * Set the Stream Flags of the last (and typically the only) Stream
    - * in lzma_index. This can be useful when reading information from the
    - * lzma_index, because to decode Blocks, knowing the integrity check type
    - * is needed.
    - *
    - * The given Stream Flags are copied into internal preallocated structure
    - * in the lzma_index, thus the caller doesn't need to keep the *stream_flags
    - * available after calling this function.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_OPTIONS_ERROR: Unsupported stream_flags->version.
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_index_stream_flags(
    -		lzma_index *i, const lzma_stream_flags *stream_flags)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Get the types of integrity Checks
    - *
    - * If lzma_index_stream_flags() is used to set the Stream Flags for
    - * every Stream, lzma_index_checks() can be used to get a bitmask to
    - * indicate which Check types have been used. It can be useful e.g. if
    - * showing the Check types to the user.
    - *
    - * The bitmask is 1 << check_id, e.g. CRC32 is 1 << 1 and SHA-256 is 1 << 10.
    - */
    -extern LZMA_API(uint32_t) lzma_index_checks(const lzma_index *i)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Set the amount of Stream Padding
    - *
    - * Set the amount of Stream Padding of the last (and typically the only)
    - * Stream in the lzma_index. This is needed when planning to do random-access
    - * reading within multiple concatenated Streams.
    - *
    - * By default, the amount of Stream Padding is assumed to be zero bytes.
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_DATA_ERROR: The file size would grow too big.
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_index_stream_padding(
    -		lzma_index *i, lzma_vli stream_padding)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Get the number of Streams
    - */
    -extern LZMA_API(lzma_vli) lzma_index_stream_count(const lzma_index *i)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Get the number of Blocks
    - *
    - * This returns the total number of Blocks in lzma_index. To get number
    - * of Blocks in individual Streams, use lzma_index_iter.
    - */
    -extern LZMA_API(lzma_vli) lzma_index_block_count(const lzma_index *i)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Get the size of the Index field as bytes
    - *
    - * This is needed to verify the Backward Size field in the Stream Footer.
    - */
    -extern LZMA_API(lzma_vli) lzma_index_size(const lzma_index *i)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Get the total size of the Stream
    - *
    - * If multiple lzma_indexes have been combined, this works as if the Blocks
    - * were in a single Stream. This is useful if you are going to combine
    - * Blocks from multiple Streams into a single new Stream.
    - */
    -extern LZMA_API(lzma_vli) lzma_index_stream_size(const lzma_index *i)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Get the total size of the Blocks
    - *
    - * This doesn't include the Stream Header, Stream Footer, Stream Padding,
    - * or Index fields.
    - */
    -extern LZMA_API(lzma_vli) lzma_index_total_size(const lzma_index *i)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Get the total size of the file
    - *
    - * When no lzma_indexes have been combined with lzma_index_cat() and there is
    - * no Stream Padding, this function is identical to lzma_index_stream_size().
    - * If multiple lzma_indexes have been combined, this includes also the headers
    - * of each separate Stream and the possible Stream Padding fields.
    - */
    -extern LZMA_API(lzma_vli) lzma_index_file_size(const lzma_index *i)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Get the uncompressed size of the file
    - */
    -extern LZMA_API(lzma_vli) lzma_index_uncompressed_size(const lzma_index *i)
    -		lzma_nothrow lzma_attr_pure;
    -
    -
    -/**
    - * \brief       Initialize an iterator
    - *
    - * \param       iter    Pointer to a lzma_index_iter structure
    - * \param       i       lzma_index to which the iterator will be associated
    - *
    - * This function associates the iterator with the given lzma_index, and calls
    - * lzma_index_iter_rewind() on the iterator.
    - *
    - * This function doesn't allocate any memory, thus there is no
    - * lzma_index_iter_end(). The iterator is valid as long as the
    - * associated lzma_index is valid, that is, until lzma_index_end() or
    - * using it as source in lzma_index_cat(). Specifically, lzma_index doesn't
    - * become invalid if new Blocks are added to it with lzma_index_append() or
    - * if it is used as the destination in lzma_index_cat().
    - *
    - * It is safe to make copies of an initialized lzma_index_iter, for example,
    - * to easily restart reading at some particular position.
    - */
    -extern LZMA_API(void) lzma_index_iter_init(
    -		lzma_index_iter *iter, const lzma_index *i) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Rewind the iterator
    - *
    - * Rewind the iterator so that next call to lzma_index_iter_next() will
    - * return the first Block or Stream.
    - */
    -extern LZMA_API(void) lzma_index_iter_rewind(lzma_index_iter *iter)
    -		lzma_nothrow;
    -
    -
    -/**
    - * \brief       Get the next Block or Stream
    - *
    - * \param       iter    Iterator initialized with lzma_index_iter_init()
    - * \param       mode    Specify what kind of information the caller wants
    - *                      to get. See lzma_index_iter_mode for details.
    - *
    - * \return      If next Block or Stream matching the mode was found, *iter
    - *              is updated and this function returns false. If no Block or
    - *              Stream matching the mode is found, *iter is not modified
    - *              and this function returns true. If mode is set to an unknown
    - *              value, *iter is not modified and this function returns true.
    - */
    -extern LZMA_API(lzma_bool) lzma_index_iter_next(
    -		lzma_index_iter *iter, lzma_index_iter_mode mode)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Locate a Block
    - *
    - * If it is possible to seek in the .xz file, it is possible to parse
    - * the Index field(s) and use lzma_index_iter_locate() to do random-access
    - * reading with granularity of Block size.
    - *
    - * \param       iter    Iterator that was earlier initialized with
    - *                      lzma_index_iter_init().
    - * \param       target  Uncompressed target offset which the caller would
    - *                      like to locate from the Stream
    - *
    - * If the target is smaller than the uncompressed size of the Stream (can be
    - * checked with lzma_index_uncompressed_size()):
    - *  - Information about the Stream and Block containing the requested
    - *    uncompressed offset is stored into *iter.
    - *  - Internal state of the iterator is adjusted so that
    - *    lzma_index_iter_next() can be used to read subsequent Blocks or Streams.
    - *  - This function returns false.
    - *
    - * If target is greater than the uncompressed size of the Stream, *iter
    - * is not modified, and this function returns true.
    - */
    -extern LZMA_API(lzma_bool) lzma_index_iter_locate(
    -		lzma_index_iter *iter, lzma_vli target) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Concatenate lzma_indexes
    - *
    - * Concatenating lzma_indexes is useful when doing random-access reading in
    - * multi-Stream .xz file, or when combining multiple Streams into single
    - * Stream.
    - *
    - * \param       dest      lzma_index after which src is appended
    - * \param       src       lzma_index to be appended after dest. If this
    - *                        function succeeds, the memory allocated for src
    - *                        is freed or moved to be part of dest, and all
    - *                        iterators pointing to src will become invalid.
    - * \param       allocator Custom memory allocator; can be NULL to use
    - *                        malloc() and free().
    - *
    - * \return      - LZMA_OK: lzma_indexes were concatenated successfully.
    - *                src is now a dangling pointer.
    - *              - LZMA_DATA_ERROR: *dest would grow too big.
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_index_cat(lzma_index *dest, lzma_index *src,
    -		const lzma_allocator *allocator)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Duplicate lzma_index
    - *
    - * \return      A copy of the lzma_index, or NULL if memory allocation failed.
    - */
    -extern LZMA_API(lzma_index *) lzma_index_dup(
    -		const lzma_index *i, const lzma_allocator *allocator)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Initialize .xz Index encoder
    - *
    - * \param       strm        Pointer to properly prepared lzma_stream
    - * \param       i           Pointer to lzma_index which should be encoded.
    - *
    - * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
    - * It is enough to use only one of them (you can choose freely; use LZMA_RUN
    - * to support liblzma versions older than 5.0.0).
    - *
    - * \return      - LZMA_OK: Initialization succeeded, continue with lzma_code().
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_index_encoder(
    -		lzma_stream *strm, const lzma_index *i)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Initialize .xz Index decoder
    - *
    - * \param       strm        Pointer to properly prepared lzma_stream
    - * \param       i           The decoded Index will be made available via
    - *                          this pointer. Initially this function will
    - *                          set *i to NULL (the old value is ignored). If
    - *                          decoding succeeds (lzma_code() returns
    - *                          LZMA_STREAM_END), *i will be set to point
    - *                          to a new lzma_index, which the application
    - *                          has to later free with lzma_index_end().
    - * \param       memlimit    How much memory the resulting lzma_index is
    - *                          allowed to require.
    - *
    - * The valid `action' values for lzma_code() are LZMA_RUN and LZMA_FINISH.
    - * It is enough to use only one of them (you can choose freely; use LZMA_RUN
    - * to support liblzma versions older than 5.0.0).
    - *
    - * \return      - LZMA_OK: Initialization succeeded, continue with lzma_code().
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_MEMLIMIT_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_index_decoder(
    -		lzma_stream *strm, lzma_index **i, uint64_t memlimit)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Single-call .xz Index encoder
    - *
    - * \param       i         lzma_index to be encoded
    - * \param       out       Beginning of the output buffer
    - * \param       out_pos   The next byte will be written to out[*out_pos].
    - *                        *out_pos is updated only if encoding succeeds.
    - * \param       out_size  Size of the out buffer; the first byte into
    - *                        which no data is written to is out[out_size].
    - *
    - * \return      - LZMA_OK: Encoding was successful.
    - *              - LZMA_BUF_ERROR: Output buffer is too small. Use
    - *                lzma_index_size() to find out how much output
    - *                space is needed.
    - *              - LZMA_PROG_ERROR
    - *
    - * \note        This function doesn't take allocator argument since all
    - *              the internal data is allocated on stack.
    - */
    -extern LZMA_API(lzma_ret) lzma_index_buffer_encode(const lzma_index *i,
    -		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Single-call .xz Index decoder
    - *
    - * \param       i           If decoding succeeds, *i will point to a new
    - *                          lzma_index, which the application has to
    - *                          later free with lzma_index_end(). If an error
    - *                          occurs, *i will be NULL. The old value of *i
    - *                          is always ignored and thus doesn't need to be
    - *                          initialized by the caller.
    - * \param       memlimit    Pointer to how much memory the resulting
    - *                          lzma_index is allowed to require. The value
    - *                          pointed by this pointer is modified if and only
    - *                          if LZMA_MEMLIMIT_ERROR is returned.
    - * \param       allocator   Pointer to lzma_allocator, or NULL to use malloc()
    - * \param       in          Beginning of the input buffer
    - * \param       in_pos      The next byte will be read from in[*in_pos].
    - *                          *in_pos is updated only if decoding succeeds.
    - * \param       in_size     Size of the input buffer; the first byte that
    - *                          won't be read is in[in_size].
    - *
    - * \return      - LZMA_OK: Decoding was successful.
    - *              - LZMA_MEM_ERROR
    - *              - LZMA_MEMLIMIT_ERROR: Memory usage limit was reached.
    - *                The minimum required memlimit value was stored to *memlimit.
    - *              - LZMA_DATA_ERROR
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_index_buffer_decode(lzma_index **i,
    -		uint64_t *memlimit, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size)
    -		lzma_nothrow;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/index_hash.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/index_hash.h
    deleted file mode 100644
    index 9287f1dfd..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/index_hash.h
    +++ /dev/null
    @@ -1,107 +0,0 @@
    -/**
    - * \file        lzma/index_hash.h
    - * \brief       Validate Index by using a hash function
    - *
    - * Hashing makes it possible to use constant amount of memory to validate
    - * Index of arbitrary size.
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -/**
    - * \brief       Opaque data type to hold the Index hash
    - */
    -typedef struct lzma_index_hash_s lzma_index_hash;
    -
    -
    -/**
    - * \brief       Allocate and initialize a new lzma_index_hash structure
    - *
    - * If index_hash is NULL, a new lzma_index_hash structure is allocated,
    - * initialized, and a pointer to it returned. If allocation fails, NULL
    - * is returned.
    - *
    - * If index_hash is non-NULL, it is reinitialized and the same pointer
    - * returned. In this case, return value cannot be NULL or a different
    - * pointer than the index_hash that was given as an argument.
    - */
    -extern LZMA_API(lzma_index_hash *) lzma_index_hash_init(
    -		lzma_index_hash *index_hash, const lzma_allocator *allocator)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Deallocate lzma_index_hash structure
    - */
    -extern LZMA_API(void) lzma_index_hash_end(
    -		lzma_index_hash *index_hash, const lzma_allocator *allocator)
    -		lzma_nothrow;
    -
    -
    -/**
    - * \brief       Add a new Record to an Index hash
    - *
    - * \param       index             Pointer to a lzma_index_hash structure
    - * \param       unpadded_size     Unpadded Size of a Block
    - * \param       uncompressed_size Uncompressed Size of a Block
    - *
    - * \return      - LZMA_OK
    - *              - LZMA_DATA_ERROR: Compressed or uncompressed size of the
    - *                Stream or size of the Index field would grow too big.
    - *              - LZMA_PROG_ERROR: Invalid arguments or this function is being
    - *                used when lzma_index_hash_decode() has already been used.
    - */
    -extern LZMA_API(lzma_ret) lzma_index_hash_append(lzma_index_hash *index_hash,
    -		lzma_vli unpadded_size, lzma_vli uncompressed_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Decode and validate the Index field
    - *
    - * After telling the sizes of all Blocks with lzma_index_hash_append(),
    - * the actual Index field is decoded with this function. Specifically,
    - * once decoding of the Index field has been started, no more Records
    - * can be added using lzma_index_hash_append().
    - *
    - * This function doesn't use lzma_stream structure to pass the input data.
    - * Instead, the input buffer is specified using three arguments. This is
    - * because it matches better the internal APIs of liblzma.
    - *
    - * \param       index_hash      Pointer to a lzma_index_hash structure
    - * \param       in              Pointer to the beginning of the input buffer
    - * \param       in_pos          in[*in_pos] is the next byte to process
    - * \param       in_size         in[in_size] is the first byte not to process
    - *
    - * \return      - LZMA_OK: So far good, but more input is needed.
    - *              - LZMA_STREAM_END: Index decoded successfully and it matches
    - *                the Records given with lzma_index_hash_append().
    - *              - LZMA_DATA_ERROR: Index is corrupt or doesn't match the
    - *                information given with lzma_index_hash_append().
    - *              - LZMA_BUF_ERROR: Cannot progress because *in_pos >= in_size.
    - *              - LZMA_PROG_ERROR
    - */
    -extern LZMA_API(lzma_ret) lzma_index_hash_decode(lzma_index_hash *index_hash,
    -		const uint8_t *in, size_t *in_pos, size_t in_size)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Get the size of the Index field as bytes
    - *
    - * This is needed to verify the Backward Size field in the Stream Footer.
    - */
    -extern LZMA_API(lzma_vli) lzma_index_hash_size(
    -		const lzma_index_hash *index_hash)
    -		lzma_nothrow lzma_attr_pure;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/lzma12.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/lzma12.h
    deleted file mode 100644
    index 4e32fa3a2..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/lzma12.h
    +++ /dev/null
    @@ -1,420 +0,0 @@
    -/**
    - * \file        lzma/lzma12.h
    - * \brief       LZMA1 and LZMA2 filters
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       LZMA1 Filter ID
    - *
    - * LZMA1 is the very same thing as what was called just LZMA in LZMA Utils,
    - * 7-Zip, and LZMA SDK. It's called LZMA1 here to prevent developers from
    - * accidentally using LZMA when they actually want LZMA2.
    - *
    - * LZMA1 shouldn't be used for new applications unless you _really_ know
    - * what you are doing. LZMA2 is almost always a better choice.
    - */
    -#define LZMA_FILTER_LZMA1       LZMA_VLI_C(0x4000000000000001)
    -
    -/**
    - * \brief       LZMA2 Filter ID
    - *
    - * Usually you want this instead of LZMA1. Compared to LZMA1, LZMA2 adds
    - * support for LZMA_SYNC_FLUSH, uncompressed chunks (smaller expansion
    - * when trying to compress uncompressible data), possibility to change
    - * lc/lp/pb in the middle of encoding, and some other internal improvements.
    - */
    -#define LZMA_FILTER_LZMA2       LZMA_VLI_C(0x21)
    -
    -
    -/**
    - * \brief       Match finders
    - *
    - * Match finder has major effect on both speed and compression ratio.
    - * Usually hash chains are faster than binary trees.
    - *
    - * If you will use LZMA_SYNC_FLUSH often, the hash chains may be a better
    - * choice, because binary trees get much higher compression ratio penalty
    - * with LZMA_SYNC_FLUSH.
    - *
    - * The memory usage formulas are only rough estimates, which are closest to
    - * reality when dict_size is a power of two. The formulas are  more complex
    - * in reality, and can also change a little between liblzma versions. Use
    - * lzma_raw_encoder_memusage() to get more accurate estimate of memory usage.
    - */
    -typedef enum {
    -	LZMA_MF_HC3     = 0x03,
    -		/**<
    -		 * \brief       Hash Chain with 2- and 3-byte hashing
    -		 *
    -		 * Minimum nice_len: 3
    -		 *
    -		 * Memory usage:
    -		 *  - dict_size <= 16 MiB: dict_size * 7.5
    -		 *  - dict_size > 16 MiB: dict_size * 5.5 + 64 MiB
    -		 */
    -
    -	LZMA_MF_HC4     = 0x04,
    -		/**<
    -		 * \brief       Hash Chain with 2-, 3-, and 4-byte hashing
    -		 *
    -		 * Minimum nice_len: 4
    -		 *
    -		 * Memory usage:
    -		 *  - dict_size <= 32 MiB: dict_size * 7.5
    -		 *  - dict_size > 32 MiB: dict_size * 6.5
    -		 */
    -
    -	LZMA_MF_BT2     = 0x12,
    -		/**<
    -		 * \brief       Binary Tree with 2-byte hashing
    -		 *
    -		 * Minimum nice_len: 2
    -		 *
    -		 * Memory usage: dict_size * 9.5
    -		 */
    -
    -	LZMA_MF_BT3     = 0x13,
    -		/**<
    -		 * \brief       Binary Tree with 2- and 3-byte hashing
    -		 *
    -		 * Minimum nice_len: 3
    -		 *
    -		 * Memory usage:
    -		 *  - dict_size <= 16 MiB: dict_size * 11.5
    -		 *  - dict_size > 16 MiB: dict_size * 9.5 + 64 MiB
    -		 */
    -
    -	LZMA_MF_BT4     = 0x14
    -		/**<
    -		 * \brief       Binary Tree with 2-, 3-, and 4-byte hashing
    -		 *
    -		 * Minimum nice_len: 4
    -		 *
    -		 * Memory usage:
    -		 *  - dict_size <= 32 MiB: dict_size * 11.5
    -		 *  - dict_size > 32 MiB: dict_size * 10.5
    -		 */
    -} lzma_match_finder;
    -
    -
    -/**
    - * \brief       Test if given match finder is supported
    - *
    - * Return true if the given match finder is supported by this liblzma build.
    - * Otherwise false is returned. It is safe to call this with a value that
    - * isn't listed in lzma_match_finder enumeration; the return value will be
    - * false.
    - *
    - * There is no way to list which match finders are available in this
    - * particular liblzma version and build. It would be useless, because
    - * a new match finder, which the application developer wasn't aware,
    - * could require giving additional options to the encoder that the older
    - * match finders don't need.
    - */
    -extern LZMA_API(lzma_bool) lzma_mf_is_supported(lzma_match_finder match_finder)
    -		lzma_nothrow lzma_attr_const;
    -
    -
    -/**
    - * \brief       Compression modes
    - *
    - * This selects the function used to analyze the data produced by the match
    - * finder.
    - */
    -typedef enum {
    -	LZMA_MODE_FAST = 1,
    -		/**<
    -		 * \brief       Fast compression
    -		 *
    -		 * Fast mode is usually at its best when combined with
    -		 * a hash chain match finder.
    -		 */
    -
    -	LZMA_MODE_NORMAL = 2
    -		/**<
    -		 * \brief       Normal compression
    -		 *
    -		 * This is usually notably slower than fast mode. Use this
    -		 * together with binary tree match finders to expose the
    -		 * full potential of the LZMA1 or LZMA2 encoder.
    -		 */
    -} lzma_mode;
    -
    -
    -/**
    - * \brief       Test if given compression mode is supported
    - *
    - * Return true if the given compression mode is supported by this liblzma
    - * build. Otherwise false is returned. It is safe to call this with a value
    - * that isn't listed in lzma_mode enumeration; the return value will be false.
    - *
    - * There is no way to list which modes are available in this particular
    - * liblzma version and build. It would be useless, because a new compression
    - * mode, which the application developer wasn't aware, could require giving
    - * additional options to the encoder that the older modes don't need.
    - */
    -extern LZMA_API(lzma_bool) lzma_mode_is_supported(lzma_mode mode)
    -		lzma_nothrow lzma_attr_const;
    -
    -
    -/**
    - * \brief       Options specific to the LZMA1 and LZMA2 filters
    - *
    - * Since LZMA1 and LZMA2 share most of the code, it's simplest to share
    - * the options structure too. For encoding, all but the reserved variables
    - * need to be initialized unless specifically mentioned otherwise.
    - * lzma_lzma_preset() can be used to get a good starting point.
    - *
    - * For raw decoding, both LZMA1 and LZMA2 need dict_size, preset_dict, and
    - * preset_dict_size (if preset_dict != NULL). LZMA1 needs also lc, lp, and pb.
    - */
    -typedef struct {
    -	/**
    -	 * \brief       Dictionary size in bytes
    -	 *
    -	 * Dictionary size indicates how many bytes of the recently processed
    -	 * uncompressed data is kept in memory. One method to reduce size of
    -	 * the uncompressed data is to store distance-length pairs, which
    -	 * indicate what data to repeat from the dictionary buffer. Thus,
    -	 * the bigger the dictionary, the better the compression ratio
    -	 * usually is.
    -	 *
    -	 * Maximum size of the dictionary depends on multiple things:
    -	 *  - Memory usage limit
    -	 *  - Available address space (not a problem on 64-bit systems)
    -	 *  - Selected match finder (encoder only)
    -	 *
    -	 * Currently the maximum dictionary size for encoding is 1.5 GiB
    -	 * (i.e. (UINT32_C(1) << 30) + (UINT32_C(1) << 29)) even on 64-bit
    -	 * systems for certain match finder implementation reasons. In the
    -	 * future, there may be match finders that support bigger
    -	 * dictionaries.
    -	 *
    -	 * Decoder already supports dictionaries up to 4 GiB - 1 B (i.e.
    -	 * UINT32_MAX), so increasing the maximum dictionary size of the
    -	 * encoder won't cause problems for old decoders.
    -	 *
    -	 * Because extremely small dictionaries sizes would have unneeded
    -	 * overhead in the decoder, the minimum dictionary size is 4096 bytes.
    -	 *
    -	 * \note        When decoding, too big dictionary does no other harm
    -	 *              than wasting memory.
    -	 */
    -	uint32_t dict_size;
    -#	define LZMA_DICT_SIZE_MIN       UINT32_C(4096)
    -#	define LZMA_DICT_SIZE_DEFAULT   (UINT32_C(1) << 23)
    -
    -	/**
    -	 * \brief       Pointer to an initial dictionary
    -	 *
    -	 * It is possible to initialize the LZ77 history window using
    -	 * a preset dictionary. It is useful when compressing many
    -	 * similar, relatively small chunks of data independently from
    -	 * each other. The preset dictionary should contain typical
    -	 * strings that occur in the files being compressed. The most
    -	 * probable strings should be near the end of the preset dictionary.
    -	 *
    -	 * This feature should be used only in special situations. For
    -	 * now, it works correctly only with raw encoding and decoding.
    -	 * Currently none of the container formats supported by
    -	 * liblzma allow preset dictionary when decoding, thus if
    -	 * you create a .xz or .lzma file with preset dictionary, it
    -	 * cannot be decoded with the regular decoder functions. In the
    -	 * future, the .xz format will likely get support for preset
    -	 * dictionary though.
    -	 */
    -	const uint8_t *preset_dict;
    -
    -	/**
    -	 * \brief       Size of the preset dictionary
    -	 *
    -	 * Specifies the size of the preset dictionary. If the size is
    -	 * bigger than dict_size, only the last dict_size bytes are
    -	 * processed.
    -	 *
    -	 * This variable is read only when preset_dict is not NULL.
    -	 * If preset_dict is not NULL but preset_dict_size is zero,
    -	 * no preset dictionary is used (identical to only setting
    -	 * preset_dict to NULL).
    -	 */
    -	uint32_t preset_dict_size;
    -
    -	/**
    -	 * \brief       Number of literal context bits
    -	 *
    -	 * How many of the highest bits of the previous uncompressed
    -	 * eight-bit byte (also known as `literal') are taken into
    -	 * account when predicting the bits of the next literal.
    -	 *
    -	 * E.g. in typical English text, an upper-case letter is
    -	 * often followed by a lower-case letter, and a lower-case
    -	 * letter is usually followed by another lower-case letter.
    -	 * In the US-ASCII character set, the highest three bits are 010
    -	 * for upper-case letters and 011 for lower-case letters.
    -	 * When lc is at least 3, the literal coding can take advantage of
    -	 * this property in the uncompressed data.
    -	 *
    -	 * There is a limit that applies to literal context bits and literal
    -	 * position bits together: lc + lp <= 4. Without this limit the
    -	 * decoding could become very slow, which could have security related
    -	 * results in some cases like email servers doing virus scanning.
    -	 * This limit also simplifies the internal implementation in liblzma.
    -	 *
    -	 * There may be LZMA1 streams that have lc + lp > 4 (maximum possible
    -	 * lc would be 8). It is not possible to decode such streams with
    -	 * liblzma.
    -	 */
    -	uint32_t lc;
    -#	define LZMA_LCLP_MIN    0
    -#	define LZMA_LCLP_MAX    4
    -#	define LZMA_LC_DEFAULT  3
    -
    -	/**
    -	 * \brief       Number of literal position bits
    -	 *
    -	 * lp affects what kind of alignment in the uncompressed data is
    -	 * assumed when encoding literals. A literal is a single 8-bit byte.
    -	 * See pb below for more information about alignment.
    -	 */
    -	uint32_t lp;
    -#	define LZMA_LP_DEFAULT  0
    -
    -	/**
    -	 * \brief       Number of position bits
    -	 *
    -	 * pb affects what kind of alignment in the uncompressed data is
    -	 * assumed in general. The default means four-byte alignment
    -	 * (2^ pb =2^2=4), which is often a good choice when there's
    -	 * no better guess.
    -	 *
    -	 * When the aligment is known, setting pb accordingly may reduce
    -	 * the file size a little. E.g. with text files having one-byte
    -	 * alignment (US-ASCII, ISO-8859-*, UTF-8), setting pb=0 can
    -	 * improve compression slightly. For UTF-16 text, pb=1 is a good
    -	 * choice. If the alignment is an odd number like 3 bytes, pb=0
    -	 * might be the best choice.
    -	 *
    -	 * Even though the assumed alignment can be adjusted with pb and
    -	 * lp, LZMA1 and LZMA2 still slightly favor 16-byte alignment.
    -	 * It might be worth taking into account when designing file formats
    -	 * that are likely to be often compressed with LZMA1 or LZMA2.
    -	 */
    -	uint32_t pb;
    -#	define LZMA_PB_MIN      0
    -#	define LZMA_PB_MAX      4
    -#	define LZMA_PB_DEFAULT  2
    -
    -	/** Compression mode */
    -	lzma_mode mode;
    -
    -	/**
    -	 * \brief       Nice length of a match
    -	 *
    -	 * This determines how many bytes the encoder compares from the match
    -	 * candidates when looking for the best match. Once a match of at
    -	 * least nice_len bytes long is found, the encoder stops looking for
    -	 * better candidates and encodes the match. (Naturally, if the found
    -	 * match is actually longer than nice_len, the actual length is
    -	 * encoded; it's not truncated to nice_len.)
    -	 *
    -	 * Bigger values usually increase the compression ratio and
    -	 * compression time. For most files, 32 to 128 is a good value,
    -	 * which gives very good compression ratio at good speed.
    -	 *
    -	 * The exact minimum value depends on the match finder. The maximum
    -	 * is 273, which is the maximum length of a match that LZMA1 and
    -	 * LZMA2 can encode.
    -	 */
    -	uint32_t nice_len;
    -
    -	/** Match finder ID */
    -	lzma_match_finder mf;
    -
    -	/**
    -	 * \brief       Maximum search depth in the match finder
    -	 *
    -	 * For every input byte, match finder searches through the hash chain
    -	 * or binary tree in a loop, each iteration going one step deeper in
    -	 * the chain or tree. The searching stops if
    -	 *  - a match of at least nice_len bytes long is found;
    -	 *  - all match candidates from the hash chain or binary tree have
    -	 *    been checked; or
    -	 *  - maximum search depth is reached.
    -	 *
    -	 * Maximum search depth is needed to prevent the match finder from
    -	 * wasting too much time in case there are lots of short match
    -	 * candidates. On the other hand, stopping the search before all
    -	 * candidates have been checked can reduce compression ratio.
    -	 *
    -	 * Setting depth to zero tells liblzma to use an automatic default
    -	 * value, that depends on the selected match finder and nice_len.
    -	 * The default is in the range [4, 200] or so (it may vary between
    -	 * liblzma versions).
    -	 *
    -	 * Using a bigger depth value than the default can increase
    -	 * compression ratio in some cases. There is no strict maximum value,
    -	 * but high values (thousands or millions) should be used with care:
    -	 * the encoder could remain fast enough with typical input, but
    -	 * malicious input could cause the match finder to slow down
    -	 * dramatically, possibly creating a denial of service attack.
    -	 */
    -	uint32_t depth;
    -
    -	/*
    -	 * Reserved space to allow possible future extensions without
    -	 * breaking the ABI. You should not touch these, because the names
    -	 * of these variables may change. These are and will never be used
    -	 * with the currently supported options, so it is safe to leave these
    -	 * uninitialized.
    -	 */
    -	uint32_t reserved_int1;
    -	uint32_t reserved_int2;
    -	uint32_t reserved_int3;
    -	uint32_t reserved_int4;
    -	uint32_t reserved_int5;
    -	uint32_t reserved_int6;
    -	uint32_t reserved_int7;
    -	uint32_t reserved_int8;
    -	lzma_reserved_enum reserved_enum1;
    -	lzma_reserved_enum reserved_enum2;
    -	lzma_reserved_enum reserved_enum3;
    -	lzma_reserved_enum reserved_enum4;
    -	void *reserved_ptr1;
    -	void *reserved_ptr2;
    -
    -} lzma_options_lzma;
    -
    -
    -/**
    - * \brief       Set a compression preset to lzma_options_lzma structure
    - *
    - * 0 is the fastest and 9 is the slowest. These match the switches -0 .. -9
    - * of the xz command line tool. In addition, it is possible to bitwise-or
    - * flags to the preset. Currently only LZMA_PRESET_EXTREME is supported.
    - * The flags are defined in container.h, because the flags are used also
    - * with lzma_easy_encoder().
    - *
    - * The preset values are subject to changes between liblzma versions.
    - *
    - * This function is available only if LZMA1 or LZMA2 encoder has been enabled
    - * when building liblzma.
    - *
    - * \return      On success, false is returned. If the preset is not
    - *              supported, true is returned.
    - */
    -extern LZMA_API(lzma_bool) lzma_lzma_preset(
    -		lzma_options_lzma *options, uint32_t preset) lzma_nothrow;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/stream_flags.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/stream_flags.h
    deleted file mode 100644
    index bbdd40826..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/stream_flags.h
    +++ /dev/null
    @@ -1,223 +0,0 @@
    -/**
    - * \file        lzma/stream_flags.h
    - * \brief       .xz Stream Header and Stream Footer encoder and decoder
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Size of Stream Header and Stream Footer
    - *
    - * Stream Header and Stream Footer have the same size and they are not
    - * going to change even if a newer version of the .xz file format is
    - * developed in future.
    - */
    -#define LZMA_STREAM_HEADER_SIZE 12
    -
    -
    -/**
    - * \brief       Options for encoding/decoding Stream Header and Stream Footer
    - */
    -typedef struct {
    -	/**
    -	 * \brief       Stream Flags format version
    -	 *
    -	 * To prevent API and ABI breakages if new features are needed in
    -	 * Stream Header or Stream Footer, a version number is used to
    -	 * indicate which fields in this structure are in use. For now,
    -	 * version must always be zero. With non-zero version, the
    -	 * lzma_stream_header_encode() and lzma_stream_footer_encode()
    -	 * will return LZMA_OPTIONS_ERROR.
    -	 *
    -	 * lzma_stream_header_decode() and lzma_stream_footer_decode()
    -	 * will always set this to the lowest value that supports all the
    -	 * features indicated by the Stream Flags field. The application
    -	 * must check that the version number set by the decoding functions
    -	 * is supported by the application. Otherwise it is possible that
    -	 * the application will decode the Stream incorrectly.
    -	 */
    -	uint32_t version;
    -
    -	/**
    -	 * \brief       Backward Size
    -	 *
    -	 * Backward Size must be a multiple of four bytes. In this Stream
    -	 * format version, Backward Size is the size of the Index field.
    -	 *
    -	 * Backward Size isn't actually part of the Stream Flags field, but
    -	 * it is convenient to include in this structure anyway. Backward
    -	 * Size is present only in the Stream Footer. There is no need to
    -	 * initialize backward_size when encoding Stream Header.
    -	 *
    -	 * lzma_stream_header_decode() always sets backward_size to
    -	 * LZMA_VLI_UNKNOWN so that it is convenient to use
    -	 * lzma_stream_flags_compare() when both Stream Header and Stream
    -	 * Footer have been decoded.
    -	 */
    -	lzma_vli backward_size;
    -#	define LZMA_BACKWARD_SIZE_MIN 4
    -#	define LZMA_BACKWARD_SIZE_MAX (LZMA_VLI_C(1) << 34)
    -
    -	/**
    -	 * \brief       Check ID
    -	 *
    -	 * This indicates the type of the integrity check calculated from
    -	 * uncompressed data.
    -	 */
    -	lzma_check check;
    -
    -	/*
    -	 * Reserved space to allow possible future extensions without
    -	 * breaking the ABI. You should not touch these, because the
    -	 * names of these variables may change.
    -	 *
    -	 * (We will never be able to use all of these since Stream Flags
    -	 * is just two bytes plus Backward Size of four bytes. But it's
    -	 * nice to have the proper types when they are needed.)
    -	 */
    -	lzma_reserved_enum reserved_enum1;
    -	lzma_reserved_enum reserved_enum2;
    -	lzma_reserved_enum reserved_enum3;
    -	lzma_reserved_enum reserved_enum4;
    -	lzma_bool reserved_bool1;
    -	lzma_bool reserved_bool2;
    -	lzma_bool reserved_bool3;
    -	lzma_bool reserved_bool4;
    -	lzma_bool reserved_bool5;
    -	lzma_bool reserved_bool6;
    -	lzma_bool reserved_bool7;
    -	lzma_bool reserved_bool8;
    -	uint32_t reserved_int1;
    -	uint32_t reserved_int2;
    -
    -} lzma_stream_flags;
    -
    -
    -/**
    - * \brief       Encode Stream Header
    - *
    - * \param       options     Stream Header options to be encoded.
    - *                          options->backward_size is ignored and doesn't
    - *                          need to be initialized.
    - * \param       out         Beginning of the output buffer of
    - *                          LZMA_STREAM_HEADER_SIZE bytes.
    - *
    - * \return      - LZMA_OK: Encoding was successful.
    - *              - LZMA_OPTIONS_ERROR: options->version is not supported by
    - *                this liblzma version.
    - *              - LZMA_PROG_ERROR: Invalid options.
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_header_encode(
    -		const lzma_stream_flags *options, uint8_t *out)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Encode Stream Footer
    - *
    - * \param       options     Stream Footer options to be encoded.
    - * \param       out         Beginning of the output buffer of
    - *                          LZMA_STREAM_HEADER_SIZE bytes.
    - *
    - * \return      - LZMA_OK: Encoding was successful.
    - *              - LZMA_OPTIONS_ERROR: options->version is not supported by
    - *                this liblzma version.
    - *              - LZMA_PROG_ERROR: Invalid options.
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_footer_encode(
    -		const lzma_stream_flags *options, uint8_t *out)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Decode Stream Header
    - *
    - * \param       options     Target for the decoded Stream Header options.
    - * \param       in          Beginning of the input buffer of
    - *                          LZMA_STREAM_HEADER_SIZE bytes.
    - *
    - * options->backward_size is always set to LZMA_VLI_UNKNOWN. This is to
    - * help comparing Stream Flags from Stream Header and Stream Footer with
    - * lzma_stream_flags_compare().
    - *
    - * \return      - LZMA_OK: Decoding was successful.
    - *              - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given
    - *                buffer cannot be Stream Header.
    - *              - LZMA_DATA_ERROR: CRC32 doesn't match, thus the header
    - *                is corrupt.
    - *              - LZMA_OPTIONS_ERROR: Unsupported options are present
    - *                in the header.
    - *
    - * \note        When decoding .xz files that contain multiple Streams, it may
    - *              make sense to print "file format not recognized" only if
    - *              decoding of the Stream Header of the _first_ Stream gives
    - *              LZMA_FORMAT_ERROR. If non-first Stream Header gives
    - *              LZMA_FORMAT_ERROR, the message used for LZMA_DATA_ERROR is
    - *              probably more appropriate.
    - *
    - *              For example, Stream decoder in liblzma uses LZMA_DATA_ERROR if
    - *              LZMA_FORMAT_ERROR is returned by lzma_stream_header_decode()
    - *              when decoding non-first Stream.
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_header_decode(
    -		lzma_stream_flags *options, const uint8_t *in)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Decode Stream Footer
    - *
    - * \param       options     Target for the decoded Stream Header options.
    - * \param       in          Beginning of the input buffer of
    - *                          LZMA_STREAM_HEADER_SIZE bytes.
    - *
    - * \return      - LZMA_OK: Decoding was successful.
    - *              - LZMA_FORMAT_ERROR: Magic bytes don't match, thus the given
    - *                buffer cannot be Stream Footer.
    - *              - LZMA_DATA_ERROR: CRC32 doesn't match, thus the Stream Footer
    - *                is corrupt.
    - *              - LZMA_OPTIONS_ERROR: Unsupported options are present
    - *                in Stream Footer.
    - *
    - * \note        If Stream Header was already decoded successfully, but
    - *              decoding Stream Footer returns LZMA_FORMAT_ERROR, the
    - *              application should probably report some other error message
    - *              than "file format not recognized", since the file more likely
    - *              is corrupt (possibly truncated). Stream decoder in liblzma
    - *              uses LZMA_DATA_ERROR in this situation.
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_footer_decode(
    -		lzma_stream_flags *options, const uint8_t *in)
    -		lzma_nothrow lzma_attr_warn_unused_result;
    -
    -
    -/**
    - * \brief       Compare two lzma_stream_flags structures
    - *
    - * backward_size values are compared only if both are not
    - * LZMA_VLI_UNKNOWN.
    - *
    - * \return      - LZMA_OK: Both are equal. If either had backward_size set
    - *                to LZMA_VLI_UNKNOWN, backward_size values were not
    - *                compared or validated.
    - *              - LZMA_DATA_ERROR: The structures differ.
    - *              - LZMA_OPTIONS_ERROR: version in either structure is greater
    - *                than the maximum supported version (currently zero).
    - *              - LZMA_PROG_ERROR: Invalid value, e.g. invalid check or
    - *                backward_size.
    - */
    -extern LZMA_API(lzma_ret) lzma_stream_flags_compare(
    -		const lzma_stream_flags *a, const lzma_stream_flags *b)
    -		lzma_nothrow lzma_attr_pure;
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/version.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/version.h
    deleted file mode 100644
    index 9682155a3..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/version.h
    +++ /dev/null
    @@ -1,121 +0,0 @@
    -/**
    - * \file        lzma/version.h
    - * \brief       Version number
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/*
    - * Version number split into components
    - */
    -#define LZMA_VERSION_MAJOR 5
    -#define LZMA_VERSION_MINOR 2
    -#define LZMA_VERSION_PATCH 1
    -#define LZMA_VERSION_STABILITY LZMA_VERSION_STABILITY_STABLE
    -
    -#ifndef LZMA_VERSION_COMMIT
    -#	define LZMA_VERSION_COMMIT ""
    -#endif
    -
    -
    -/*
    - * Map symbolic stability levels to integers.
    - */
    -#define LZMA_VERSION_STABILITY_ALPHA 0
    -#define LZMA_VERSION_STABILITY_BETA 1
    -#define LZMA_VERSION_STABILITY_STABLE 2
    -
    -
    -/**
    - * \brief       Compile-time version number
    - *
    - * The version number is of format xyyyzzzs where
    - *  - x = major
    - *  - yyy = minor
    - *  - zzz = revision
    - *  - s indicates stability: 0 = alpha, 1 = beta, 2 = stable
    - *
    - * The same xyyyzzz triplet is never reused with different stability levels.
    - * For example, if 5.1.0alpha has been released, there will never be 5.1.0beta
    - * or 5.1.0 stable.
    - *
    - * \note        The version number of liblzma has nothing to with
    - *              the version number of Igor Pavlov's LZMA SDK.
    - */
    -#define LZMA_VERSION (LZMA_VERSION_MAJOR * UINT32_C(10000000) \
    -		+ LZMA_VERSION_MINOR * UINT32_C(10000) \
    -		+ LZMA_VERSION_PATCH * UINT32_C(10) \
    -		+ LZMA_VERSION_STABILITY)
    -
    -
    -/*
    - * Macros to construct the compile-time version string
    - */
    -#if LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_ALPHA
    -#	define LZMA_VERSION_STABILITY_STRING "alpha"
    -#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_BETA
    -#	define LZMA_VERSION_STABILITY_STRING "beta"
    -#elif LZMA_VERSION_STABILITY == LZMA_VERSION_STABILITY_STABLE
    -#	define LZMA_VERSION_STABILITY_STRING ""
    -#else
    -#	error Incorrect LZMA_VERSION_STABILITY
    -#endif
    -
    -#define LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit) \
    -		#major "." #minor "." #patch stability commit
    -
    -#define LZMA_VERSION_STRING_C(major, minor, patch, stability, commit) \
    -		LZMA_VERSION_STRING_C_(major, minor, patch, stability, commit)
    -
    -
    -/**
    - * \brief       Compile-time version as a string
    - *
    - * This can be for example "4.999.5alpha", "4.999.8beta", or "5.0.0" (stable
    - * versions don't have any "stable" suffix). In future, a snapshot built
    - * from source code repository may include an additional suffix, for example
    - * "4.999.8beta-21-g1d92". The commit ID won't be available in numeric form
    - * in LZMA_VERSION macro.
    - */
    -#define LZMA_VERSION_STRING LZMA_VERSION_STRING_C( \
    -		LZMA_VERSION_MAJOR, LZMA_VERSION_MINOR, \
    -		LZMA_VERSION_PATCH, LZMA_VERSION_STABILITY_STRING, \
    -		LZMA_VERSION_COMMIT)
    -
    -
    -/* #ifndef is needed for use with windres (MinGW or Cygwin). */
    -#ifndef LZMA_H_INTERNAL_RC
    -
    -/**
    - * \brief       Run-time version number as an integer
    - *
    - * Return the value of LZMA_VERSION macro at the compile time of liblzma.
    - * This allows the application to compare if it was built against the same,
    - * older, or newer version of liblzma that is currently running.
    - */
    -extern LZMA_API(uint32_t) lzma_version_number(void)
    -		lzma_nothrow lzma_attr_const;
    -
    -
    -/**
    - * \brief       Run-time version as a string
    - *
    - * This function may be useful if you want to display which version of
    - * liblzma your application is currently using.
    - */
    -extern LZMA_API(const char *) lzma_version_string(void)
    -		lzma_nothrow lzma_attr_const;
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/api/lzma/vli.h b/external/public-domain/xz/dist/src/liblzma/api/lzma/vli.h
    deleted file mode 100644
    index 9ad13f2e2..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/api/lzma/vli.h
    +++ /dev/null
    @@ -1,166 +0,0 @@
    -/**
    - * \file        lzma/vli.h
    - * \brief       Variable-length integer handling
    - *
    - * In the .xz format, most integers are encoded in a variable-length
    - * representation, which is sometimes called little endian base-128 encoding.
    - * This saves space when smaller values are more likely than bigger values.
    - *
    - * The encoding scheme encodes seven bits to every byte, using minimum
    - * number of bytes required to represent the given value. Encodings that use
    - * non-minimum number of bytes are invalid, thus every integer has exactly
    - * one encoded representation. The maximum number of bits in a VLI is 63,
    - * thus the vli argument must be less than or equal to UINT64_MAX / 2. You
    - * should use LZMA_VLI_MAX for clarity.
    - */
    -
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * See ../lzma.h for information about liblzma as a whole.
    - */
    -
    -#ifndef LZMA_H_INTERNAL
    -#	error Never include this file directly. Use  instead.
    -#endif
    -
    -
    -/**
    - * \brief       Maximum supported value of a variable-length integer
    - */
    -#define LZMA_VLI_MAX (UINT64_MAX / 2)
    -
    -/**
    - * \brief       VLI value to denote that the value is unknown
    - */
    -#define LZMA_VLI_UNKNOWN UINT64_MAX
    -
    -/**
    - * \brief       Maximum supported encoded length of variable length integers
    - */
    -#define LZMA_VLI_BYTES_MAX 9
    -
    -/**
    - * \brief       VLI constant suffix
    - */
    -#define LZMA_VLI_C(n) UINT64_C(n)
    -
    -
    -/**
    - * \brief       Variable-length integer type
    - *
    - * Valid VLI values are in the range [0, LZMA_VLI_MAX]. Unknown value is
    - * indicated with LZMA_VLI_UNKNOWN, which is the maximum value of the
    - * underlaying integer type.
    - *
    - * lzma_vli will be uint64_t for the foreseeable future. If a bigger size
    - * is needed in the future, it is guaranteed that 2 * LZMA_VLI_MAX will
    - * not overflow lzma_vli. This simplifies integer overflow detection.
    - */
    -typedef uint64_t lzma_vli;
    -
    -
    -/**
    - * \brief       Validate a variable-length integer
    - *
    - * This is useful to test that application has given acceptable values
    - * for example in the uncompressed_size and compressed_size variables.
    - *
    - * \return      True if the integer is representable as VLI or if it
    - *              indicates unknown value.
    - */
    -#define lzma_vli_is_valid(vli) \
    -	((vli) <= LZMA_VLI_MAX || (vli) == LZMA_VLI_UNKNOWN)
    -
    -
    -/**
    - * \brief       Encode a variable-length integer
    - *
    - * This function has two modes: single-call and multi-call. Single-call mode
    - * encodes the whole integer at once; it is an error if the output buffer is
    - * too small. Multi-call mode saves the position in *vli_pos, and thus it is
    - * possible to continue encoding if the buffer becomes full before the whole
    - * integer has been encoded.
    - *
    - * \param       vli       Integer to be encoded
    - * \param       vli_pos   How many VLI-encoded bytes have already been written
    - *                        out. When starting to encode a new integer in
    - *                        multi-call mode, *vli_pos must be set to zero.
    - *                        To use single-call encoding, set vli_pos to NULL.
    - * \param       out       Beginning of the output buffer
    - * \param       out_pos   The next byte will be written to out[*out_pos].
    - * \param       out_size  Size of the out buffer; the first byte into
    - *                        which no data is written to is out[out_size].
    - *
    - * \return      Slightly different return values are used in multi-call and
    - *              single-call modes.
    - *
    - *              Single-call (vli_pos == NULL):
    - *              - LZMA_OK: Integer successfully encoded.
    - *              - LZMA_PROG_ERROR: Arguments are not sane. This can be due
    - *                to too little output space; single-call mode doesn't use
    - *                LZMA_BUF_ERROR, since the application should have checked
    - *                the encoded size with lzma_vli_size().
    - *
    - *              Multi-call (vli_pos != NULL):
    - *              - LZMA_OK: So far all OK, but the integer is not
    - *                completely written out yet.
    - *              - LZMA_STREAM_END: Integer successfully encoded.
    - *              - LZMA_BUF_ERROR: No output space was provided.
    - *              - LZMA_PROG_ERROR: Arguments are not sane.
    - */
    -extern LZMA_API(lzma_ret) lzma_vli_encode(lzma_vli vli, size_t *vli_pos,
    -		uint8_t *out, size_t *out_pos, size_t out_size) lzma_nothrow;
    -
    -
    -/**
    - * \brief       Decode a variable-length integer
    - *
    - * Like lzma_vli_encode(), this function has single-call and multi-call modes.
    - *
    - * \param       vli       Pointer to decoded integer. The decoder will
    - *                        initialize it to zero when *vli_pos == 0, so
    - *                        application isn't required to initialize *vli.
    - * \param       vli_pos   How many bytes have already been decoded. When
    - *                        starting to decode a new integer in multi-call
    - *                        mode, *vli_pos must be initialized to zero. To
    - *                        use single-call decoding, set vli_pos to NULL.
    - * \param       in        Beginning of the input buffer
    - * \param       in_pos    The next byte will be read from in[*in_pos].
    - * \param       in_size   Size of the input buffer; the first byte that
    - *                        won't be read is in[in_size].
    - *
    - * \return      Slightly different return values are used in multi-call and
    - *              single-call modes.
    - *
    - *              Single-call (vli_pos == NULL):
    - *              - LZMA_OK: Integer successfully decoded.
    - *              - LZMA_DATA_ERROR: Integer is corrupt. This includes hitting
    - *                the end of the input buffer before the whole integer was
    - *                decoded; providing no input at all will use LZMA_DATA_ERROR.
    - *              - LZMA_PROG_ERROR: Arguments are not sane.
    - *
    - *              Multi-call (vli_pos != NULL):
    - *              - LZMA_OK: So far all OK, but the integer is not
    - *                completely decoded yet.
    - *              - LZMA_STREAM_END: Integer successfully decoded.
    - *              - LZMA_DATA_ERROR: Integer is corrupt.
    - *              - LZMA_BUF_ERROR: No input was provided.
    - *              - LZMA_PROG_ERROR: Arguments are not sane.
    - */
    -extern LZMA_API(lzma_ret) lzma_vli_decode(lzma_vli *vli, size_t *vli_pos,
    -		const uint8_t *in, size_t *in_pos, size_t in_size)
    -		lzma_nothrow;
    -
    -
    -/**
    - * \brief       Get the number of bytes required to encode a VLI
    - *
    - * \return      Number of bytes on success (1-9). If vli isn't valid,
    - *              zero is returned.
    - */
    -extern LZMA_API(uint32_t) lzma_vli_size(lzma_vli vli)
    -		lzma_nothrow lzma_attr_pure;
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/check.c b/external/public-domain/xz/dist/src/liblzma/check/check.c
    deleted file mode 100644
    index 428ddaeb7..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/check.c
    +++ /dev/null
    @@ -1,174 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       check.c
    -/// \brief      Single API to access different integrity checks
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "check.h"
    -
    -
    -extern LZMA_API(lzma_bool)
    -lzma_check_is_supported(lzma_check type)
    -{
    -	if ((unsigned int)(type) > LZMA_CHECK_ID_MAX)
    -		return false;
    -
    -	static const lzma_bool available_checks[LZMA_CHECK_ID_MAX + 1] = {
    -		true,   // LZMA_CHECK_NONE
    -
    -#ifdef HAVE_CHECK_CRC32
    -		true,
    -#else
    -		false,
    -#endif
    -
    -		false,  // Reserved
    -		false,  // Reserved
    -
    -#ifdef HAVE_CHECK_CRC64
    -		true,
    -#else
    -		false,
    -#endif
    -
    -		false,  // Reserved
    -		false,  // Reserved
    -		false,  // Reserved
    -		false,  // Reserved
    -		false,  // Reserved
    -
    -#ifdef HAVE_CHECK_SHA256
    -		true,
    -#else
    -		false,
    -#endif
    -
    -		false,  // Reserved
    -		false,  // Reserved
    -		false,  // Reserved
    -		false,  // Reserved
    -		false,  // Reserved
    -	};
    -
    -	return available_checks[(unsigned int)(type)];
    -}
    -
    -
    -extern LZMA_API(uint32_t)
    -lzma_check_size(lzma_check type)
    -{
    -	if ((unsigned int)(type) > LZMA_CHECK_ID_MAX)
    -		return UINT32_MAX;
    -
    -	// See file-format.txt section 2.1.1.2.
    -	static const uint8_t check_sizes[LZMA_CHECK_ID_MAX + 1] = {
    -		0,
    -		4, 4, 4,
    -		8, 8, 8,
    -		16, 16, 16,
    -		32, 32, 32,
    -		64, 64, 64
    -	};
    -
    -	return check_sizes[(unsigned int)(type)];
    -}
    -
    -
    -extern void
    -lzma_check_init(lzma_check_state *check, lzma_check type)
    -{
    -	switch (type) {
    -	case LZMA_CHECK_NONE:
    -		break;
    -
    -#ifdef HAVE_CHECK_CRC32
    -	case LZMA_CHECK_CRC32:
    -		check->state.crc32 = 0;
    -		break;
    -#endif
    -
    -#ifdef HAVE_CHECK_CRC64
    -	case LZMA_CHECK_CRC64:
    -		check->state.crc64 = 0;
    -		break;
    -#endif
    -
    -#ifdef HAVE_CHECK_SHA256
    -	case LZMA_CHECK_SHA256:
    -		lzma_sha256_init(check);
    -		break;
    -#endif
    -
    -	default:
    -		break;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -lzma_check_update(lzma_check_state *check, lzma_check type,
    -		const uint8_t *buf, size_t size)
    -{
    -	switch (type) {
    -#ifdef HAVE_CHECK_CRC32
    -	case LZMA_CHECK_CRC32:
    -		check->state.crc32 = lzma_crc32(buf, size, check->state.crc32);
    -		break;
    -#endif
    -
    -#ifdef HAVE_CHECK_CRC64
    -	case LZMA_CHECK_CRC64:
    -		check->state.crc64 = lzma_crc64(buf, size, check->state.crc64);
    -		break;
    -#endif
    -
    -#ifdef HAVE_CHECK_SHA256
    -	case LZMA_CHECK_SHA256:
    -		lzma_sha256_update(buf, size, check);
    -		break;
    -#endif
    -
    -	default:
    -		break;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -lzma_check_finish(lzma_check_state *check, lzma_check type)
    -{
    -	switch (type) {
    -#ifdef HAVE_CHECK_CRC32
    -	case LZMA_CHECK_CRC32:
    -		check->buffer.u32[0] = conv32le(check->state.crc32);
    -		break;
    -#endif
    -
    -#ifdef HAVE_CHECK_CRC64
    -	case LZMA_CHECK_CRC64:
    -		check->buffer.u64[0] = conv64le(check->state.crc64);
    -		break;
    -#endif
    -
    -#ifdef HAVE_CHECK_SHA256
    -	case LZMA_CHECK_SHA256:
    -		lzma_sha256_finish(check);
    -		break;
    -#endif
    -
    -	default:
    -		break;
    -	}
    -
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/check.h b/external/public-domain/xz/dist/src/liblzma/check/check.h
    deleted file mode 100644
    index 2b4cf981c..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/check.h
    +++ /dev/null
    @@ -1,179 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       check.h
    -/// \brief      Internal API to different integrity check functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_CHECK_H
    -#define LZMA_CHECK_H
    -
    -#include "common.h"
    -
    -#ifdef NETBSD_NATIVE_SHA256
    -#include 
    -#else
    -#if defined(HAVE_COMMONCRYPTO_COMMONDIGEST_H)
    -#	include 
    -#elif defined(HAVE_SHA256_H)
    -#	include 
    -#	include 
    -#elif defined(HAVE_SHA2_H)
    -#	include 
    -#	include 
    -#elif defined(HAVE_MINIX_SHA2_H)
    -#	include 
    -#	include 
    -#endif
    -#endif
    -
    -#if defined(HAVE_CC_SHA256_CTX)
    -typedef CC_SHA256_CTX lzma_sha256_state;
    -#elif defined(HAVE_SHA256_CTX)
    -typedef SHA256_CTX lzma_sha256_state;
    -#elif defined(HAVE_SHA2_CTX)
    -typedef SHA2_CTX lzma_sha256_state;
    -#else
    -/// State for the internal SHA-256 implementation
    -typedef struct {
    -	/// Internal state
    -	uint32_t state[8];
    -
    -	/// Size of the message excluding padding
    -	uint64_t size;
    -} lzma_sha256_state;
    -#endif
    -
    -#if defined(HAVE_CC_SHA256_INIT)
    -#	define LZMA_SHA256FUNC(x) CC_SHA256_ ## x
    -#elif defined(HAVE_SHA256_INIT)
    -#	define LZMA_SHA256FUNC(x) SHA256_ ## x
    -#elif defined(HAVE_SHA256INIT)
    -#	define LZMA_SHA256FUNC(x) SHA256 ## x
    -#endif
    -
    -// Index hashing needs the best possible hash function (preferably
    -// a cryptographic hash) for maximum reliability.
    -#if defined(HAVE_CHECK_SHA256)
    -#	define LZMA_CHECK_BEST LZMA_CHECK_SHA256
    -#elif defined(HAVE_CHECK_CRC64)
    -#	define LZMA_CHECK_BEST LZMA_CHECK_CRC64
    -#else
    -#	define LZMA_CHECK_BEST LZMA_CHECK_CRC32
    -#endif
    -
    -
    -/// \brief      Structure to hold internal state of the check being calculated
    -///
    -/// \note       This is not in the public API because this structure may
    -///             change in future if new integrity check algorithms are added.
    -typedef struct {
    -	/// Buffer to hold the final result and a temporary buffer for SHA256.
    -	union {
    -		uint8_t u8[64];
    -		uint32_t u32[16];
    -		uint64_t u64[8];
    -	} buffer;
    -
    -	/// Check-specific data
    -	union {
    -		uint32_t crc32;
    -		uint64_t crc64;
    -#ifdef NETBSD_NATIVE_SHA256
    -		SHA256_CTX sha256;
    -#else
    -		lzma_sha256_state sha256;
    -#endif
    -	} state;
    -
    -} lzma_check_state;
    -#endif
    -
    -
    -/// lzma_crc32_table[0] is needed by LZ encoder so we need to keep
    -/// the array two-dimensional.
    -#ifdef HAVE_SMALL
    -extern uint32_t lzma_crc32_table[1][256];
    -extern void lzma_crc32_init(void);
    -#else
    -extern const uint32_t lzma_crc32_table[8][256];
    -extern const uint64_t lzma_crc64_table[4][256];
    -#endif
    -
    -
    -/// \brief      Initialize *check depending on type
    -///
    -/// \return     LZMA_OK on success. LZMA_UNSUPPORTED_CHECK if the type is not
    -///             supported by the current version or build of liblzma.
    -///             LZMA_PROG_ERROR if type > LZMA_CHECK_ID_MAX.
    -extern void lzma_check_init(lzma_check_state *check, lzma_check type);
    -
    -/// Update the check state
    -extern void lzma_check_update(lzma_check_state *check, lzma_check type,
    -		const uint8_t *buf, size_t size);
    -
    -/// Finish the check calculation and store the result to check->buffer.u8.
    -extern void lzma_check_finish(lzma_check_state *check, lzma_check type);
    -
    -#ifdef NETBSD_NATIVE_SHA256
    -#define lzma_sha256_init(check)	\
    -	SHA256_Init(&(check)->state.sha256)
    -#define lzma_sha256_update(buf,size,check) \
    -	SHA256_Update(&(check)->state.sha256, buf, size)
    -#define lzma_sha256_finish(check) \
    -	SHA256_Final((check)->buffer.u8, &(check)->state.sha256)
    -#else
    -
    -#ifndef LZMA_SHA256FUNC
    -
    -/// Prepare SHA-256 state for new input.
    -extern void lzma_sha256_init(lzma_check_state *check);
    -
    -/// Update the SHA-256 hash state
    -extern void lzma_sha256_update(
    -		const uint8_t *buf, size_t size, lzma_check_state *check);
    -
    -/// Finish the SHA-256 calculation and store the result to check->buffer.u8.
    -extern void lzma_sha256_finish(lzma_check_state *check);
    -
    -
    -#else
    -
    -static inline void
    -lzma_sha256_init(lzma_check_state *check)
    -{
    -	LZMA_SHA256FUNC(Init)(&check->state.sha256);
    -}
    -
    -
    -static inline void
    -lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check)
    -{
    -#if defined(HAVE_CC_SHA256_INIT) && SIZE_MAX > UINT32_MAX
    -	// Darwin's CC_SHA256_Update takes uint32_t as the buffer size,
    -	// so use a loop to support size_t.
    -	while (size > UINT32_MAX) {
    -		LZMA_SHA256FUNC(Update)(&check->state.sha256, buf, UINT32_MAX);
    -		buf += UINT32_MAX;
    -		size -= UINT32_MAX;
    -	}
    -#endif
    -
    -	LZMA_SHA256FUNC(Update)(&check->state.sha256, buf, size);
    -}
    -
    -
    -static inline void
    -lzma_sha256_finish(lzma_check_state *check)
    -{
    -	LZMA_SHA256FUNC(Final)(check->buffer.u8, &check->state.sha256);
    -}
    -
    -#endif
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc32_fast.c b/external/public-domain/xz/dist/src/liblzma/check/crc32_fast.c
    deleted file mode 100644
    index 3de02638d..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc32_fast.c
    +++ /dev/null
    @@ -1,82 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc32.c
    -/// \brief      CRC32 calculation
    -///
    -/// Calculate the CRC32 using the slice-by-eight algorithm.
    -/// It is explained in this document:
    -/// http://www.intel.com/technology/comms/perfnet/download/CRC_generators.pdf
    -/// The code in this file is not the same as in Intel's paper, but
    -/// the basic principle is identical.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "check.h"
    -#include "crc_macros.h"
    -
    -
    -// If you make any changes, do some benchmarking! Seemingly unrelated
    -// changes can very easily ruin the performance (and very probably is
    -// very compiler dependent).
    -extern LZMA_API(uint32_t)
    -lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
    -{
    -	crc = ~crc;
    -
    -#ifdef WORDS_BIGENDIAN
    -	crc = bswap32(crc);
    -#endif
    -
    -	if (size > 8) {
    -		// Fix the alignment, if needed. The if statement above
    -		// ensures that this won't read past the end of buf[].
    -		while ((uintptr_t)(buf) & 7) {
    -			crc = lzma_crc32_table[0][*buf++ ^ A(crc)] ^ S8(crc);
    -			--size;
    -		}
    -
    -		// Calculate the position where to stop.
    -		const uint8_t *const limit = buf + (size & ~(size_t)(7));
    -
    -		// Calculate how many bytes must be calculated separately
    -		// before returning the result.
    -		size &= (size_t)(7);
    -
    -		// Calculate the CRC32 using the slice-by-eight algorithm.
    -		while (buf < limit) {
    -			crc ^= *(const uint32_t *)(buf);
    -			buf += 4;
    -
    -			crc = lzma_crc32_table[7][A(crc)]
    -			    ^ lzma_crc32_table[6][B(crc)]
    -			    ^ lzma_crc32_table[5][C(crc)]
    -			    ^ lzma_crc32_table[4][D(crc)];
    -
    -			const uint32_t tmp = *(const uint32_t *)(buf);
    -			buf += 4;
    -
    -			// At least with some compilers, it is critical for
    -			// performance, that the crc variable is XORed
    -			// between the two table-lookup pairs.
    -			crc = lzma_crc32_table[3][A(tmp)]
    -			    ^ lzma_crc32_table[2][B(tmp)]
    -			    ^ crc
    -			    ^ lzma_crc32_table[1][C(tmp)]
    -			    ^ lzma_crc32_table[0][D(tmp)];
    -		}
    -	}
    -
    -	while (size-- != 0)
    -		crc = lzma_crc32_table[0][*buf++ ^ A(crc)] ^ S8(crc);
    -
    -#ifdef WORDS_BIGENDIAN
    -	crc = bswap32(crc);
    -#endif
    -
    -	return ~crc;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc32_small.c b/external/public-domain/xz/dist/src/liblzma/check/crc32_small.c
    deleted file mode 100644
    index 5f8a32868..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc32_small.c
    +++ /dev/null
    @@ -1,61 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc32_small.c
    -/// \brief      CRC32 calculation (size-optimized)
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "check.h"
    -
    -
    -uint32_t lzma_crc32_table[1][256];
    -
    -
    -static void
    -crc32_init(void)
    -{
    -	static const uint32_t poly32 = UINT32_C(0xEDB88320);
    -
    -	for (size_t b = 0; b < 256; ++b) {
    -		uint32_t r = b;
    -		for (size_t i = 0; i < 8; ++i) {
    -			if (r & 1)
    -				r = (r >> 1) ^ poly32;
    -			else
    -				r >>= 1;
    -		}
    -
    -		lzma_crc32_table[0][b] = r;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -lzma_crc32_init(void)
    -{
    -	mythread_once(crc32_init);
    -	return;
    -}
    -
    -
    -extern LZMA_API(uint32_t)
    -lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc)
    -{
    -	lzma_crc32_init();
    -
    -	crc = ~crc;
    -
    -	while (size != 0) {
    -		crc = lzma_crc32_table[0][*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
    -		--size;
    -	}
    -
    -	return ~crc;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc32_table.c b/external/public-domain/xz/dist/src/liblzma/check/crc32_table.c
    deleted file mode 100644
    index 368874eb7..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc32_table.c
    +++ /dev/null
    @@ -1,19 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc32_table.c
    -/// \brief      Precalculated CRC32 table with correct endianness
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -#ifdef WORDS_BIGENDIAN
    -#	include "crc32_table_be.h"
    -#else
    -#	include "crc32_table_le.h"
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc32_table_be.h b/external/public-domain/xz/dist/src/liblzma/check/crc32_table_be.h
    deleted file mode 100644
    index c483cb670..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc32_table_be.h
    +++ /dev/null
    @@ -1,525 +0,0 @@
    -/* This file has been automatically generated by crc32_tablegen.c. */
    -
    -const uint32_t lzma_crc32_table[8][256] = {
    -	{
    -		0x00000000, 0x96300777, 0x2C610EEE, 0xBA510999,
    -		0x19C46D07, 0x8FF46A70, 0x35A563E9, 0xA395649E,
    -		0x3288DB0E, 0xA4B8DC79, 0x1EE9D5E0, 0x88D9D297,
    -		0x2B4CB609, 0xBD7CB17E, 0x072DB8E7, 0x911DBF90,
    -		0x6410B71D, 0xF220B06A, 0x4871B9F3, 0xDE41BE84,
    -		0x7DD4DA1A, 0xEBE4DD6D, 0x51B5D4F4, 0xC785D383,
    -		0x56986C13, 0xC0A86B64, 0x7AF962FD, 0xECC9658A,
    -		0x4F5C0114, 0xD96C0663, 0x633D0FFA, 0xF50D088D,
    -		0xC8206E3B, 0x5E10694C, 0xE44160D5, 0x727167A2,
    -		0xD1E4033C, 0x47D4044B, 0xFD850DD2, 0x6BB50AA5,
    -		0xFAA8B535, 0x6C98B242, 0xD6C9BBDB, 0x40F9BCAC,
    -		0xE36CD832, 0x755CDF45, 0xCF0DD6DC, 0x593DD1AB,
    -		0xAC30D926, 0x3A00DE51, 0x8051D7C8, 0x1661D0BF,
    -		0xB5F4B421, 0x23C4B356, 0x9995BACF, 0x0FA5BDB8,
    -		0x9EB80228, 0x0888055F, 0xB2D90CC6, 0x24E90BB1,
    -		0x877C6F2F, 0x114C6858, 0xAB1D61C1, 0x3D2D66B6,
    -		0x9041DC76, 0x0671DB01, 0xBC20D298, 0x2A10D5EF,
    -		0x8985B171, 0x1FB5B606, 0xA5E4BF9F, 0x33D4B8E8,
    -		0xA2C90778, 0x34F9000F, 0x8EA80996, 0x18980EE1,
    -		0xBB0D6A7F, 0x2D3D6D08, 0x976C6491, 0x015C63E6,
    -		0xF4516B6B, 0x62616C1C, 0xD8306585, 0x4E0062F2,
    -		0xED95066C, 0x7BA5011B, 0xC1F40882, 0x57C40FF5,
    -		0xC6D9B065, 0x50E9B712, 0xEAB8BE8B, 0x7C88B9FC,
    -		0xDF1DDD62, 0x492DDA15, 0xF37CD38C, 0x654CD4FB,
    -		0x5861B24D, 0xCE51B53A, 0x7400BCA3, 0xE230BBD4,
    -		0x41A5DF4A, 0xD795D83D, 0x6DC4D1A4, 0xFBF4D6D3,
    -		0x6AE96943, 0xFCD96E34, 0x468867AD, 0xD0B860DA,
    -		0x732D0444, 0xE51D0333, 0x5F4C0AAA, 0xC97C0DDD,
    -		0x3C710550, 0xAA410227, 0x10100BBE, 0x86200CC9,
    -		0x25B56857, 0xB3856F20, 0x09D466B9, 0x9FE461CE,
    -		0x0EF9DE5E, 0x98C9D929, 0x2298D0B0, 0xB4A8D7C7,
    -		0x173DB359, 0x810DB42E, 0x3B5CBDB7, 0xAD6CBAC0,
    -		0x2083B8ED, 0xB6B3BF9A, 0x0CE2B603, 0x9AD2B174,
    -		0x3947D5EA, 0xAF77D29D, 0x1526DB04, 0x8316DC73,
    -		0x120B63E3, 0x843B6494, 0x3E6A6D0D, 0xA85A6A7A,
    -		0x0BCF0EE4, 0x9DFF0993, 0x27AE000A, 0xB19E077D,
    -		0x44930FF0, 0xD2A30887, 0x68F2011E, 0xFEC20669,
    -		0x5D5762F7, 0xCB676580, 0x71366C19, 0xE7066B6E,
    -		0x761BD4FE, 0xE02BD389, 0x5A7ADA10, 0xCC4ADD67,
    -		0x6FDFB9F9, 0xF9EFBE8E, 0x43BEB717, 0xD58EB060,
    -		0xE8A3D6D6, 0x7E93D1A1, 0xC4C2D838, 0x52F2DF4F,
    -		0xF167BBD1, 0x6757BCA6, 0xDD06B53F, 0x4B36B248,
    -		0xDA2B0DD8, 0x4C1B0AAF, 0xF64A0336, 0x607A0441,
    -		0xC3EF60DF, 0x55DF67A8, 0xEF8E6E31, 0x79BE6946,
    -		0x8CB361CB, 0x1A8366BC, 0xA0D26F25, 0x36E26852,
    -		0x95770CCC, 0x03470BBB, 0xB9160222, 0x2F260555,
    -		0xBE3BBAC5, 0x280BBDB2, 0x925AB42B, 0x046AB35C,
    -		0xA7FFD7C2, 0x31CFD0B5, 0x8B9ED92C, 0x1DAEDE5B,
    -		0xB0C2649B, 0x26F263EC, 0x9CA36A75, 0x0A936D02,
    -		0xA906099C, 0x3F360EEB, 0x85670772, 0x13570005,
    -		0x824ABF95, 0x147AB8E2, 0xAE2BB17B, 0x381BB60C,
    -		0x9B8ED292, 0x0DBED5E5, 0xB7EFDC7C, 0x21DFDB0B,
    -		0xD4D2D386, 0x42E2D4F1, 0xF8B3DD68, 0x6E83DA1F,
    -		0xCD16BE81, 0x5B26B9F6, 0xE177B06F, 0x7747B718,
    -		0xE65A0888, 0x706A0FFF, 0xCA3B0666, 0x5C0B0111,
    -		0xFF9E658F, 0x69AE62F8, 0xD3FF6B61, 0x45CF6C16,
    -		0x78E20AA0, 0xEED20DD7, 0x5483044E, 0xC2B30339,
    -		0x612667A7, 0xF71660D0, 0x4D476949, 0xDB776E3E,
    -		0x4A6AD1AE, 0xDC5AD6D9, 0x660BDF40, 0xF03BD837,
    -		0x53AEBCA9, 0xC59EBBDE, 0x7FCFB247, 0xE9FFB530,
    -		0x1CF2BDBD, 0x8AC2BACA, 0x3093B353, 0xA6A3B424,
    -		0x0536D0BA, 0x9306D7CD, 0x2957DE54, 0xBF67D923,
    -		0x2E7A66B3, 0xB84A61C4, 0x021B685D, 0x942B6F2A,
    -		0x37BE0BB4, 0xA18E0CC3, 0x1BDF055A, 0x8DEF022D
    -	}, {
    -		0x00000000, 0x41311B19, 0x82623632, 0xC3532D2B,
    -		0x04C56C64, 0x45F4777D, 0x86A75A56, 0xC796414F,
    -		0x088AD9C8, 0x49BBC2D1, 0x8AE8EFFA, 0xCBD9F4E3,
    -		0x0C4FB5AC, 0x4D7EAEB5, 0x8E2D839E, 0xCF1C9887,
    -		0x5112C24A, 0x1023D953, 0xD370F478, 0x9241EF61,
    -		0x55D7AE2E, 0x14E6B537, 0xD7B5981C, 0x96848305,
    -		0x59981B82, 0x18A9009B, 0xDBFA2DB0, 0x9ACB36A9,
    -		0x5D5D77E6, 0x1C6C6CFF, 0xDF3F41D4, 0x9E0E5ACD,
    -		0xA2248495, 0xE3159F8C, 0x2046B2A7, 0x6177A9BE,
    -		0xA6E1E8F1, 0xE7D0F3E8, 0x2483DEC3, 0x65B2C5DA,
    -		0xAAAE5D5D, 0xEB9F4644, 0x28CC6B6F, 0x69FD7076,
    -		0xAE6B3139, 0xEF5A2A20, 0x2C09070B, 0x6D381C12,
    -		0xF33646DF, 0xB2075DC6, 0x715470ED, 0x30656BF4,
    -		0xF7F32ABB, 0xB6C231A2, 0x75911C89, 0x34A00790,
    -		0xFBBC9F17, 0xBA8D840E, 0x79DEA925, 0x38EFB23C,
    -		0xFF79F373, 0xBE48E86A, 0x7D1BC541, 0x3C2ADE58,
    -		0x054F79F0, 0x447E62E9, 0x872D4FC2, 0xC61C54DB,
    -		0x018A1594, 0x40BB0E8D, 0x83E823A6, 0xC2D938BF,
    -		0x0DC5A038, 0x4CF4BB21, 0x8FA7960A, 0xCE968D13,
    -		0x0900CC5C, 0x4831D745, 0x8B62FA6E, 0xCA53E177,
    -		0x545DBBBA, 0x156CA0A3, 0xD63F8D88, 0x970E9691,
    -		0x5098D7DE, 0x11A9CCC7, 0xD2FAE1EC, 0x93CBFAF5,
    -		0x5CD76272, 0x1DE6796B, 0xDEB55440, 0x9F844F59,
    -		0x58120E16, 0x1923150F, 0xDA703824, 0x9B41233D,
    -		0xA76BFD65, 0xE65AE67C, 0x2509CB57, 0x6438D04E,
    -		0xA3AE9101, 0xE29F8A18, 0x21CCA733, 0x60FDBC2A,
    -		0xAFE124AD, 0xEED03FB4, 0x2D83129F, 0x6CB20986,
    -		0xAB2448C9, 0xEA1553D0, 0x29467EFB, 0x687765E2,
    -		0xF6793F2F, 0xB7482436, 0x741B091D, 0x352A1204,
    -		0xF2BC534B, 0xB38D4852, 0x70DE6579, 0x31EF7E60,
    -		0xFEF3E6E7, 0xBFC2FDFE, 0x7C91D0D5, 0x3DA0CBCC,
    -		0xFA368A83, 0xBB07919A, 0x7854BCB1, 0x3965A7A8,
    -		0x4B98833B, 0x0AA99822, 0xC9FAB509, 0x88CBAE10,
    -		0x4F5DEF5F, 0x0E6CF446, 0xCD3FD96D, 0x8C0EC274,
    -		0x43125AF3, 0x022341EA, 0xC1706CC1, 0x804177D8,
    -		0x47D73697, 0x06E62D8E, 0xC5B500A5, 0x84841BBC,
    -		0x1A8A4171, 0x5BBB5A68, 0x98E87743, 0xD9D96C5A,
    -		0x1E4F2D15, 0x5F7E360C, 0x9C2D1B27, 0xDD1C003E,
    -		0x120098B9, 0x533183A0, 0x9062AE8B, 0xD153B592,
    -		0x16C5F4DD, 0x57F4EFC4, 0x94A7C2EF, 0xD596D9F6,
    -		0xE9BC07AE, 0xA88D1CB7, 0x6BDE319C, 0x2AEF2A85,
    -		0xED796BCA, 0xAC4870D3, 0x6F1B5DF8, 0x2E2A46E1,
    -		0xE136DE66, 0xA007C57F, 0x6354E854, 0x2265F34D,
    -		0xE5F3B202, 0xA4C2A91B, 0x67918430, 0x26A09F29,
    -		0xB8AEC5E4, 0xF99FDEFD, 0x3ACCF3D6, 0x7BFDE8CF,
    -		0xBC6BA980, 0xFD5AB299, 0x3E099FB2, 0x7F3884AB,
    -		0xB0241C2C, 0xF1150735, 0x32462A1E, 0x73773107,
    -		0xB4E17048, 0xF5D06B51, 0x3683467A, 0x77B25D63,
    -		0x4ED7FACB, 0x0FE6E1D2, 0xCCB5CCF9, 0x8D84D7E0,
    -		0x4A1296AF, 0x0B238DB6, 0xC870A09D, 0x8941BB84,
    -		0x465D2303, 0x076C381A, 0xC43F1531, 0x850E0E28,
    -		0x42984F67, 0x03A9547E, 0xC0FA7955, 0x81CB624C,
    -		0x1FC53881, 0x5EF42398, 0x9DA70EB3, 0xDC9615AA,
    -		0x1B0054E5, 0x5A314FFC, 0x996262D7, 0xD85379CE,
    -		0x174FE149, 0x567EFA50, 0x952DD77B, 0xD41CCC62,
    -		0x138A8D2D, 0x52BB9634, 0x91E8BB1F, 0xD0D9A006,
    -		0xECF37E5E, 0xADC26547, 0x6E91486C, 0x2FA05375,
    -		0xE836123A, 0xA9070923, 0x6A542408, 0x2B653F11,
    -		0xE479A796, 0xA548BC8F, 0x661B91A4, 0x272A8ABD,
    -		0xE0BCCBF2, 0xA18DD0EB, 0x62DEFDC0, 0x23EFE6D9,
    -		0xBDE1BC14, 0xFCD0A70D, 0x3F838A26, 0x7EB2913F,
    -		0xB924D070, 0xF815CB69, 0x3B46E642, 0x7A77FD5B,
    -		0xB56B65DC, 0xF45A7EC5, 0x370953EE, 0x763848F7,
    -		0xB1AE09B8, 0xF09F12A1, 0x33CC3F8A, 0x72FD2493
    -	}, {
    -		0x00000000, 0x376AC201, 0x6ED48403, 0x59BE4602,
    -		0xDCA80907, 0xEBC2CB06, 0xB27C8D04, 0x85164F05,
    -		0xB851130E, 0x8F3BD10F, 0xD685970D, 0xE1EF550C,
    -		0x64F91A09, 0x5393D808, 0x0A2D9E0A, 0x3D475C0B,
    -		0x70A3261C, 0x47C9E41D, 0x1E77A21F, 0x291D601E,
    -		0xAC0B2F1B, 0x9B61ED1A, 0xC2DFAB18, 0xF5B56919,
    -		0xC8F23512, 0xFF98F713, 0xA626B111, 0x914C7310,
    -		0x145A3C15, 0x2330FE14, 0x7A8EB816, 0x4DE47A17,
    -		0xE0464D38, 0xD72C8F39, 0x8E92C93B, 0xB9F80B3A,
    -		0x3CEE443F, 0x0B84863E, 0x523AC03C, 0x6550023D,
    -		0x58175E36, 0x6F7D9C37, 0x36C3DA35, 0x01A91834,
    -		0x84BF5731, 0xB3D59530, 0xEA6BD332, 0xDD011133,
    -		0x90E56B24, 0xA78FA925, 0xFE31EF27, 0xC95B2D26,
    -		0x4C4D6223, 0x7B27A022, 0x2299E620, 0x15F32421,
    -		0x28B4782A, 0x1FDEBA2B, 0x4660FC29, 0x710A3E28,
    -		0xF41C712D, 0xC376B32C, 0x9AC8F52E, 0xADA2372F,
    -		0xC08D9A70, 0xF7E75871, 0xAE591E73, 0x9933DC72,
    -		0x1C259377, 0x2B4F5176, 0x72F11774, 0x459BD575,
    -		0x78DC897E, 0x4FB64B7F, 0x16080D7D, 0x2162CF7C,
    -		0xA4748079, 0x931E4278, 0xCAA0047A, 0xFDCAC67B,
    -		0xB02EBC6C, 0x87447E6D, 0xDEFA386F, 0xE990FA6E,
    -		0x6C86B56B, 0x5BEC776A, 0x02523168, 0x3538F369,
    -		0x087FAF62, 0x3F156D63, 0x66AB2B61, 0x51C1E960,
    -		0xD4D7A665, 0xE3BD6464, 0xBA032266, 0x8D69E067,
    -		0x20CBD748, 0x17A11549, 0x4E1F534B, 0x7975914A,
    -		0xFC63DE4F, 0xCB091C4E, 0x92B75A4C, 0xA5DD984D,
    -		0x989AC446, 0xAFF00647, 0xF64E4045, 0xC1248244,
    -		0x4432CD41, 0x73580F40, 0x2AE64942, 0x1D8C8B43,
    -		0x5068F154, 0x67023355, 0x3EBC7557, 0x09D6B756,
    -		0x8CC0F853, 0xBBAA3A52, 0xE2147C50, 0xD57EBE51,
    -		0xE839E25A, 0xDF53205B, 0x86ED6659, 0xB187A458,
    -		0x3491EB5D, 0x03FB295C, 0x5A456F5E, 0x6D2FAD5F,
    -		0x801B35E1, 0xB771F7E0, 0xEECFB1E2, 0xD9A573E3,
    -		0x5CB33CE6, 0x6BD9FEE7, 0x3267B8E5, 0x050D7AE4,
    -		0x384A26EF, 0x0F20E4EE, 0x569EA2EC, 0x61F460ED,
    -		0xE4E22FE8, 0xD388EDE9, 0x8A36ABEB, 0xBD5C69EA,
    -		0xF0B813FD, 0xC7D2D1FC, 0x9E6C97FE, 0xA90655FF,
    -		0x2C101AFA, 0x1B7AD8FB, 0x42C49EF9, 0x75AE5CF8,
    -		0x48E900F3, 0x7F83C2F2, 0x263D84F0, 0x115746F1,
    -		0x944109F4, 0xA32BCBF5, 0xFA958DF7, 0xCDFF4FF6,
    -		0x605D78D9, 0x5737BAD8, 0x0E89FCDA, 0x39E33EDB,
    -		0xBCF571DE, 0x8B9FB3DF, 0xD221F5DD, 0xE54B37DC,
    -		0xD80C6BD7, 0xEF66A9D6, 0xB6D8EFD4, 0x81B22DD5,
    -		0x04A462D0, 0x33CEA0D1, 0x6A70E6D3, 0x5D1A24D2,
    -		0x10FE5EC5, 0x27949CC4, 0x7E2ADAC6, 0x494018C7,
    -		0xCC5657C2, 0xFB3C95C3, 0xA282D3C1, 0x95E811C0,
    -		0xA8AF4DCB, 0x9FC58FCA, 0xC67BC9C8, 0xF1110BC9,
    -		0x740744CC, 0x436D86CD, 0x1AD3C0CF, 0x2DB902CE,
    -		0x4096AF91, 0x77FC6D90, 0x2E422B92, 0x1928E993,
    -		0x9C3EA696, 0xAB546497, 0xF2EA2295, 0xC580E094,
    -		0xF8C7BC9F, 0xCFAD7E9E, 0x9613389C, 0xA179FA9D,
    -		0x246FB598, 0x13057799, 0x4ABB319B, 0x7DD1F39A,
    -		0x3035898D, 0x075F4B8C, 0x5EE10D8E, 0x698BCF8F,
    -		0xEC9D808A, 0xDBF7428B, 0x82490489, 0xB523C688,
    -		0x88649A83, 0xBF0E5882, 0xE6B01E80, 0xD1DADC81,
    -		0x54CC9384, 0x63A65185, 0x3A181787, 0x0D72D586,
    -		0xA0D0E2A9, 0x97BA20A8, 0xCE0466AA, 0xF96EA4AB,
    -		0x7C78EBAE, 0x4B1229AF, 0x12AC6FAD, 0x25C6ADAC,
    -		0x1881F1A7, 0x2FEB33A6, 0x765575A4, 0x413FB7A5,
    -		0xC429F8A0, 0xF3433AA1, 0xAAFD7CA3, 0x9D97BEA2,
    -		0xD073C4B5, 0xE71906B4, 0xBEA740B6, 0x89CD82B7,
    -		0x0CDBCDB2, 0x3BB10FB3, 0x620F49B1, 0x55658BB0,
    -		0x6822D7BB, 0x5F4815BA, 0x06F653B8, 0x319C91B9,
    -		0xB48ADEBC, 0x83E01CBD, 0xDA5E5ABF, 0xED3498BE
    -	}, {
    -		0x00000000, 0x6567BCB8, 0x8BC809AA, 0xEEAFB512,
    -		0x5797628F, 0x32F0DE37, 0xDC5F6B25, 0xB938D79D,
    -		0xEF28B4C5, 0x8A4F087D, 0x64E0BD6F, 0x018701D7,
    -		0xB8BFD64A, 0xDDD86AF2, 0x3377DFE0, 0x56106358,
    -		0x9F571950, 0xFA30A5E8, 0x149F10FA, 0x71F8AC42,
    -		0xC8C07BDF, 0xADA7C767, 0x43087275, 0x266FCECD,
    -		0x707FAD95, 0x1518112D, 0xFBB7A43F, 0x9ED01887,
    -		0x27E8CF1A, 0x428F73A2, 0xAC20C6B0, 0xC9477A08,
    -		0x3EAF32A0, 0x5BC88E18, 0xB5673B0A, 0xD00087B2,
    -		0x6938502F, 0x0C5FEC97, 0xE2F05985, 0x8797E53D,
    -		0xD1878665, 0xB4E03ADD, 0x5A4F8FCF, 0x3F283377,
    -		0x8610E4EA, 0xE3775852, 0x0DD8ED40, 0x68BF51F8,
    -		0xA1F82BF0, 0xC49F9748, 0x2A30225A, 0x4F579EE2,
    -		0xF66F497F, 0x9308F5C7, 0x7DA740D5, 0x18C0FC6D,
    -		0x4ED09F35, 0x2BB7238D, 0xC518969F, 0xA07F2A27,
    -		0x1947FDBA, 0x7C204102, 0x928FF410, 0xF7E848A8,
    -		0x3D58149B, 0x583FA823, 0xB6901D31, 0xD3F7A189,
    -		0x6ACF7614, 0x0FA8CAAC, 0xE1077FBE, 0x8460C306,
    -		0xD270A05E, 0xB7171CE6, 0x59B8A9F4, 0x3CDF154C,
    -		0x85E7C2D1, 0xE0807E69, 0x0E2FCB7B, 0x6B4877C3,
    -		0xA20F0DCB, 0xC768B173, 0x29C70461, 0x4CA0B8D9,
    -		0xF5986F44, 0x90FFD3FC, 0x7E5066EE, 0x1B37DA56,
    -		0x4D27B90E, 0x284005B6, 0xC6EFB0A4, 0xA3880C1C,
    -		0x1AB0DB81, 0x7FD76739, 0x9178D22B, 0xF41F6E93,
    -		0x03F7263B, 0x66909A83, 0x883F2F91, 0xED589329,
    -		0x546044B4, 0x3107F80C, 0xDFA84D1E, 0xBACFF1A6,
    -		0xECDF92FE, 0x89B82E46, 0x67179B54, 0x027027EC,
    -		0xBB48F071, 0xDE2F4CC9, 0x3080F9DB, 0x55E74563,
    -		0x9CA03F6B, 0xF9C783D3, 0x176836C1, 0x720F8A79,
    -		0xCB375DE4, 0xAE50E15C, 0x40FF544E, 0x2598E8F6,
    -		0x73888BAE, 0x16EF3716, 0xF8408204, 0x9D273EBC,
    -		0x241FE921, 0x41785599, 0xAFD7E08B, 0xCAB05C33,
    -		0x3BB659ED, 0x5ED1E555, 0xB07E5047, 0xD519ECFF,
    -		0x6C213B62, 0x094687DA, 0xE7E932C8, 0x828E8E70,
    -		0xD49EED28, 0xB1F95190, 0x5F56E482, 0x3A31583A,
    -		0x83098FA7, 0xE66E331F, 0x08C1860D, 0x6DA63AB5,
    -		0xA4E140BD, 0xC186FC05, 0x2F294917, 0x4A4EF5AF,
    -		0xF3762232, 0x96119E8A, 0x78BE2B98, 0x1DD99720,
    -		0x4BC9F478, 0x2EAE48C0, 0xC001FDD2, 0xA566416A,
    -		0x1C5E96F7, 0x79392A4F, 0x97969F5D, 0xF2F123E5,
    -		0x05196B4D, 0x607ED7F5, 0x8ED162E7, 0xEBB6DE5F,
    -		0x528E09C2, 0x37E9B57A, 0xD9460068, 0xBC21BCD0,
    -		0xEA31DF88, 0x8F566330, 0x61F9D622, 0x049E6A9A,
    -		0xBDA6BD07, 0xD8C101BF, 0x366EB4AD, 0x53090815,
    -		0x9A4E721D, 0xFF29CEA5, 0x11867BB7, 0x74E1C70F,
    -		0xCDD91092, 0xA8BEAC2A, 0x46111938, 0x2376A580,
    -		0x7566C6D8, 0x10017A60, 0xFEAECF72, 0x9BC973CA,
    -		0x22F1A457, 0x479618EF, 0xA939ADFD, 0xCC5E1145,
    -		0x06EE4D76, 0x6389F1CE, 0x8D2644DC, 0xE841F864,
    -		0x51792FF9, 0x341E9341, 0xDAB12653, 0xBFD69AEB,
    -		0xE9C6F9B3, 0x8CA1450B, 0x620EF019, 0x07694CA1,
    -		0xBE519B3C, 0xDB362784, 0x35999296, 0x50FE2E2E,
    -		0x99B95426, 0xFCDEE89E, 0x12715D8C, 0x7716E134,
    -		0xCE2E36A9, 0xAB498A11, 0x45E63F03, 0x208183BB,
    -		0x7691E0E3, 0x13F65C5B, 0xFD59E949, 0x983E55F1,
    -		0x2106826C, 0x44613ED4, 0xAACE8BC6, 0xCFA9377E,
    -		0x38417FD6, 0x5D26C36E, 0xB389767C, 0xD6EECAC4,
    -		0x6FD61D59, 0x0AB1A1E1, 0xE41E14F3, 0x8179A84B,
    -		0xD769CB13, 0xB20E77AB, 0x5CA1C2B9, 0x39C67E01,
    -		0x80FEA99C, 0xE5991524, 0x0B36A036, 0x6E511C8E,
    -		0xA7166686, 0xC271DA3E, 0x2CDE6F2C, 0x49B9D394,
    -		0xF0810409, 0x95E6B8B1, 0x7B490DA3, 0x1E2EB11B,
    -		0x483ED243, 0x2D596EFB, 0xC3F6DBE9, 0xA6916751,
    -		0x1FA9B0CC, 0x7ACE0C74, 0x9461B966, 0xF10605DE
    -	}, {
    -		0x00000000, 0xB029603D, 0x6053C07A, 0xD07AA047,
    -		0xC0A680F5, 0x708FE0C8, 0xA0F5408F, 0x10DC20B2,
    -		0xC14B7030, 0x7162100D, 0xA118B04A, 0x1131D077,
    -		0x01EDF0C5, 0xB1C490F8, 0x61BE30BF, 0xD1975082,
    -		0x8297E060, 0x32BE805D, 0xE2C4201A, 0x52ED4027,
    -		0x42316095, 0xF21800A8, 0x2262A0EF, 0x924BC0D2,
    -		0x43DC9050, 0xF3F5F06D, 0x238F502A, 0x93A63017,
    -		0x837A10A5, 0x33537098, 0xE329D0DF, 0x5300B0E2,
    -		0x042FC1C1, 0xB406A1FC, 0x647C01BB, 0xD4556186,
    -		0xC4894134, 0x74A02109, 0xA4DA814E, 0x14F3E173,
    -		0xC564B1F1, 0x754DD1CC, 0xA537718B, 0x151E11B6,
    -		0x05C23104, 0xB5EB5139, 0x6591F17E, 0xD5B89143,
    -		0x86B821A1, 0x3691419C, 0xE6EBE1DB, 0x56C281E6,
    -		0x461EA154, 0xF637C169, 0x264D612E, 0x96640113,
    -		0x47F35191, 0xF7DA31AC, 0x27A091EB, 0x9789F1D6,
    -		0x8755D164, 0x377CB159, 0xE706111E, 0x572F7123,
    -		0x4958F358, 0xF9719365, 0x290B3322, 0x9922531F,
    -		0x89FE73AD, 0x39D71390, 0xE9ADB3D7, 0x5984D3EA,
    -		0x88138368, 0x383AE355, 0xE8404312, 0x5869232F,
    -		0x48B5039D, 0xF89C63A0, 0x28E6C3E7, 0x98CFA3DA,
    -		0xCBCF1338, 0x7BE67305, 0xAB9CD342, 0x1BB5B37F,
    -		0x0B6993CD, 0xBB40F3F0, 0x6B3A53B7, 0xDB13338A,
    -		0x0A846308, 0xBAAD0335, 0x6AD7A372, 0xDAFEC34F,
    -		0xCA22E3FD, 0x7A0B83C0, 0xAA712387, 0x1A5843BA,
    -		0x4D773299, 0xFD5E52A4, 0x2D24F2E3, 0x9D0D92DE,
    -		0x8DD1B26C, 0x3DF8D251, 0xED827216, 0x5DAB122B,
    -		0x8C3C42A9, 0x3C152294, 0xEC6F82D3, 0x5C46E2EE,
    -		0x4C9AC25C, 0xFCB3A261, 0x2CC90226, 0x9CE0621B,
    -		0xCFE0D2F9, 0x7FC9B2C4, 0xAFB31283, 0x1F9A72BE,
    -		0x0F46520C, 0xBF6F3231, 0x6F159276, 0xDF3CF24B,
    -		0x0EABA2C9, 0xBE82C2F4, 0x6EF862B3, 0xDED1028E,
    -		0xCE0D223C, 0x7E244201, 0xAE5EE246, 0x1E77827B,
    -		0x92B0E6B1, 0x2299868C, 0xF2E326CB, 0x42CA46F6,
    -		0x52166644, 0xE23F0679, 0x3245A63E, 0x826CC603,
    -		0x53FB9681, 0xE3D2F6BC, 0x33A856FB, 0x838136C6,
    -		0x935D1674, 0x23747649, 0xF30ED60E, 0x4327B633,
    -		0x102706D1, 0xA00E66EC, 0x7074C6AB, 0xC05DA696,
    -		0xD0818624, 0x60A8E619, 0xB0D2465E, 0x00FB2663,
    -		0xD16C76E1, 0x614516DC, 0xB13FB69B, 0x0116D6A6,
    -		0x11CAF614, 0xA1E39629, 0x7199366E, 0xC1B05653,
    -		0x969F2770, 0x26B6474D, 0xF6CCE70A, 0x46E58737,
    -		0x5639A785, 0xE610C7B8, 0x366A67FF, 0x864307C2,
    -		0x57D45740, 0xE7FD377D, 0x3787973A, 0x87AEF707,
    -		0x9772D7B5, 0x275BB788, 0xF72117CF, 0x470877F2,
    -		0x1408C710, 0xA421A72D, 0x745B076A, 0xC4726757,
    -		0xD4AE47E5, 0x648727D8, 0xB4FD879F, 0x04D4E7A2,
    -		0xD543B720, 0x656AD71D, 0xB510775A, 0x05391767,
    -		0x15E537D5, 0xA5CC57E8, 0x75B6F7AF, 0xC59F9792,
    -		0xDBE815E9, 0x6BC175D4, 0xBBBBD593, 0x0B92B5AE,
    -		0x1B4E951C, 0xAB67F521, 0x7B1D5566, 0xCB34355B,
    -		0x1AA365D9, 0xAA8A05E4, 0x7AF0A5A3, 0xCAD9C59E,
    -		0xDA05E52C, 0x6A2C8511, 0xBA562556, 0x0A7F456B,
    -		0x597FF589, 0xE95695B4, 0x392C35F3, 0x890555CE,
    -		0x99D9757C, 0x29F01541, 0xF98AB506, 0x49A3D53B,
    -		0x983485B9, 0x281DE584, 0xF86745C3, 0x484E25FE,
    -		0x5892054C, 0xE8BB6571, 0x38C1C536, 0x88E8A50B,
    -		0xDFC7D428, 0x6FEEB415, 0xBF941452, 0x0FBD746F,
    -		0x1F6154DD, 0xAF4834E0, 0x7F3294A7, 0xCF1BF49A,
    -		0x1E8CA418, 0xAEA5C425, 0x7EDF6462, 0xCEF6045F,
    -		0xDE2A24ED, 0x6E0344D0, 0xBE79E497, 0x0E5084AA,
    -		0x5D503448, 0xED795475, 0x3D03F432, 0x8D2A940F,
    -		0x9DF6B4BD, 0x2DDFD480, 0xFDA574C7, 0x4D8C14FA,
    -		0x9C1B4478, 0x2C322445, 0xFC488402, 0x4C61E43F,
    -		0x5CBDC48D, 0xEC94A4B0, 0x3CEE04F7, 0x8CC764CA
    -	}, {
    -		0x00000000, 0xA5D35CCB, 0x0BA1C84D, 0xAE729486,
    -		0x1642919B, 0xB391CD50, 0x1DE359D6, 0xB830051D,
    -		0x6D8253EC, 0xC8510F27, 0x66239BA1, 0xC3F0C76A,
    -		0x7BC0C277, 0xDE139EBC, 0x70610A3A, 0xD5B256F1,
    -		0x9B02D603, 0x3ED18AC8, 0x90A31E4E, 0x35704285,
    -		0x8D404798, 0x28931B53, 0x86E18FD5, 0x2332D31E,
    -		0xF68085EF, 0x5353D924, 0xFD214DA2, 0x58F21169,
    -		0xE0C21474, 0x451148BF, 0xEB63DC39, 0x4EB080F2,
    -		0x3605AC07, 0x93D6F0CC, 0x3DA4644A, 0x98773881,
    -		0x20473D9C, 0x85946157, 0x2BE6F5D1, 0x8E35A91A,
    -		0x5B87FFEB, 0xFE54A320, 0x502637A6, 0xF5F56B6D,
    -		0x4DC56E70, 0xE81632BB, 0x4664A63D, 0xE3B7FAF6,
    -		0xAD077A04, 0x08D426CF, 0xA6A6B249, 0x0375EE82,
    -		0xBB45EB9F, 0x1E96B754, 0xB0E423D2, 0x15377F19,
    -		0xC08529E8, 0x65567523, 0xCB24E1A5, 0x6EF7BD6E,
    -		0xD6C7B873, 0x7314E4B8, 0xDD66703E, 0x78B52CF5,
    -		0x6C0A580F, 0xC9D904C4, 0x67AB9042, 0xC278CC89,
    -		0x7A48C994, 0xDF9B955F, 0x71E901D9, 0xD43A5D12,
    -		0x01880BE3, 0xA45B5728, 0x0A29C3AE, 0xAFFA9F65,
    -		0x17CA9A78, 0xB219C6B3, 0x1C6B5235, 0xB9B80EFE,
    -		0xF7088E0C, 0x52DBD2C7, 0xFCA94641, 0x597A1A8A,
    -		0xE14A1F97, 0x4499435C, 0xEAEBD7DA, 0x4F388B11,
    -		0x9A8ADDE0, 0x3F59812B, 0x912B15AD, 0x34F84966,
    -		0x8CC84C7B, 0x291B10B0, 0x87698436, 0x22BAD8FD,
    -		0x5A0FF408, 0xFFDCA8C3, 0x51AE3C45, 0xF47D608E,
    -		0x4C4D6593, 0xE99E3958, 0x47ECADDE, 0xE23FF115,
    -		0x378DA7E4, 0x925EFB2F, 0x3C2C6FA9, 0x99FF3362,
    -		0x21CF367F, 0x841C6AB4, 0x2A6EFE32, 0x8FBDA2F9,
    -		0xC10D220B, 0x64DE7EC0, 0xCAACEA46, 0x6F7FB68D,
    -		0xD74FB390, 0x729CEF5B, 0xDCEE7BDD, 0x793D2716,
    -		0xAC8F71E7, 0x095C2D2C, 0xA72EB9AA, 0x02FDE561,
    -		0xBACDE07C, 0x1F1EBCB7, 0xB16C2831, 0x14BF74FA,
    -		0xD814B01E, 0x7DC7ECD5, 0xD3B57853, 0x76662498,
    -		0xCE562185, 0x6B857D4E, 0xC5F7E9C8, 0x6024B503,
    -		0xB596E3F2, 0x1045BF39, 0xBE372BBF, 0x1BE47774,
    -		0xA3D47269, 0x06072EA2, 0xA875BA24, 0x0DA6E6EF,
    -		0x4316661D, 0xE6C53AD6, 0x48B7AE50, 0xED64F29B,
    -		0x5554F786, 0xF087AB4D, 0x5EF53FCB, 0xFB266300,
    -		0x2E9435F1, 0x8B47693A, 0x2535FDBC, 0x80E6A177,
    -		0x38D6A46A, 0x9D05F8A1, 0x33776C27, 0x96A430EC,
    -		0xEE111C19, 0x4BC240D2, 0xE5B0D454, 0x4063889F,
    -		0xF8538D82, 0x5D80D149, 0xF3F245CF, 0x56211904,
    -		0x83934FF5, 0x2640133E, 0x883287B8, 0x2DE1DB73,
    -		0x95D1DE6E, 0x300282A5, 0x9E701623, 0x3BA34AE8,
    -		0x7513CA1A, 0xD0C096D1, 0x7EB20257, 0xDB615E9C,
    -		0x63515B81, 0xC682074A, 0x68F093CC, 0xCD23CF07,
    -		0x189199F6, 0xBD42C53D, 0x133051BB, 0xB6E30D70,
    -		0x0ED3086D, 0xAB0054A6, 0x0572C020, 0xA0A19CEB,
    -		0xB41EE811, 0x11CDB4DA, 0xBFBF205C, 0x1A6C7C97,
    -		0xA25C798A, 0x078F2541, 0xA9FDB1C7, 0x0C2EED0C,
    -		0xD99CBBFD, 0x7C4FE736, 0xD23D73B0, 0x77EE2F7B,
    -		0xCFDE2A66, 0x6A0D76AD, 0xC47FE22B, 0x61ACBEE0,
    -		0x2F1C3E12, 0x8ACF62D9, 0x24BDF65F, 0x816EAA94,
    -		0x395EAF89, 0x9C8DF342, 0x32FF67C4, 0x972C3B0F,
    -		0x429E6DFE, 0xE74D3135, 0x493FA5B3, 0xECECF978,
    -		0x54DCFC65, 0xF10FA0AE, 0x5F7D3428, 0xFAAE68E3,
    -		0x821B4416, 0x27C818DD, 0x89BA8C5B, 0x2C69D090,
    -		0x9459D58D, 0x318A8946, 0x9FF81DC0, 0x3A2B410B,
    -		0xEF9917FA, 0x4A4A4B31, 0xE438DFB7, 0x41EB837C,
    -		0xF9DB8661, 0x5C08DAAA, 0xF27A4E2C, 0x57A912E7,
    -		0x19199215, 0xBCCACEDE, 0x12B85A58, 0xB76B0693,
    -		0x0F5B038E, 0xAA885F45, 0x04FACBC3, 0xA1299708,
    -		0x749BC1F9, 0xD1489D32, 0x7F3A09B4, 0xDAE9557F,
    -		0x62D95062, 0xC70A0CA9, 0x6978982F, 0xCCABC4E4
    -	}, {
    -		0x00000000, 0xB40B77A6, 0x29119F97, 0x9D1AE831,
    -		0x13244FF4, 0xA72F3852, 0x3A35D063, 0x8E3EA7C5,
    -		0x674EEF33, 0xD3459895, 0x4E5F70A4, 0xFA540702,
    -		0x746AA0C7, 0xC061D761, 0x5D7B3F50, 0xE97048F6,
    -		0xCE9CDE67, 0x7A97A9C1, 0xE78D41F0, 0x53863656,
    -		0xDDB89193, 0x69B3E635, 0xF4A90E04, 0x40A279A2,
    -		0xA9D23154, 0x1DD946F2, 0x80C3AEC3, 0x34C8D965,
    -		0xBAF67EA0, 0x0EFD0906, 0x93E7E137, 0x27EC9691,
    -		0x9C39BDCF, 0x2832CA69, 0xB5282258, 0x012355FE,
    -		0x8F1DF23B, 0x3B16859D, 0xA60C6DAC, 0x12071A0A,
    -		0xFB7752FC, 0x4F7C255A, 0xD266CD6B, 0x666DBACD,
    -		0xE8531D08, 0x5C586AAE, 0xC142829F, 0x7549F539,
    -		0x52A563A8, 0xE6AE140E, 0x7BB4FC3F, 0xCFBF8B99,
    -		0x41812C5C, 0xF58A5BFA, 0x6890B3CB, 0xDC9BC46D,
    -		0x35EB8C9B, 0x81E0FB3D, 0x1CFA130C, 0xA8F164AA,
    -		0x26CFC36F, 0x92C4B4C9, 0x0FDE5CF8, 0xBBD52B5E,
    -		0x79750B44, 0xCD7E7CE2, 0x506494D3, 0xE46FE375,
    -		0x6A5144B0, 0xDE5A3316, 0x4340DB27, 0xF74BAC81,
    -		0x1E3BE477, 0xAA3093D1, 0x372A7BE0, 0x83210C46,
    -		0x0D1FAB83, 0xB914DC25, 0x240E3414, 0x900543B2,
    -		0xB7E9D523, 0x03E2A285, 0x9EF84AB4, 0x2AF33D12,
    -		0xA4CD9AD7, 0x10C6ED71, 0x8DDC0540, 0x39D772E6,
    -		0xD0A73A10, 0x64AC4DB6, 0xF9B6A587, 0x4DBDD221,
    -		0xC38375E4, 0x77880242, 0xEA92EA73, 0x5E999DD5,
    -		0xE54CB68B, 0x5147C12D, 0xCC5D291C, 0x78565EBA,
    -		0xF668F97F, 0x42638ED9, 0xDF7966E8, 0x6B72114E,
    -		0x820259B8, 0x36092E1E, 0xAB13C62F, 0x1F18B189,
    -		0x9126164C, 0x252D61EA, 0xB83789DB, 0x0C3CFE7D,
    -		0x2BD068EC, 0x9FDB1F4A, 0x02C1F77B, 0xB6CA80DD,
    -		0x38F42718, 0x8CFF50BE, 0x11E5B88F, 0xA5EECF29,
    -		0x4C9E87DF, 0xF895F079, 0x658F1848, 0xD1846FEE,
    -		0x5FBAC82B, 0xEBB1BF8D, 0x76AB57BC, 0xC2A0201A,
    -		0xF2EA1688, 0x46E1612E, 0xDBFB891F, 0x6FF0FEB9,
    -		0xE1CE597C, 0x55C52EDA, 0xC8DFC6EB, 0x7CD4B14D,
    -		0x95A4F9BB, 0x21AF8E1D, 0xBCB5662C, 0x08BE118A,
    -		0x8680B64F, 0x328BC1E9, 0xAF9129D8, 0x1B9A5E7E,
    -		0x3C76C8EF, 0x887DBF49, 0x15675778, 0xA16C20DE,
    -		0x2F52871B, 0x9B59F0BD, 0x0643188C, 0xB2486F2A,
    -		0x5B3827DC, 0xEF33507A, 0x7229B84B, 0xC622CFED,
    -		0x481C6828, 0xFC171F8E, 0x610DF7BF, 0xD5068019,
    -		0x6ED3AB47, 0xDAD8DCE1, 0x47C234D0, 0xF3C94376,
    -		0x7DF7E4B3, 0xC9FC9315, 0x54E67B24, 0xE0ED0C82,
    -		0x099D4474, 0xBD9633D2, 0x208CDBE3, 0x9487AC45,
    -		0x1AB90B80, 0xAEB27C26, 0x33A89417, 0x87A3E3B1,
    -		0xA04F7520, 0x14440286, 0x895EEAB7, 0x3D559D11,
    -		0xB36B3AD4, 0x07604D72, 0x9A7AA543, 0x2E71D2E5,
    -		0xC7019A13, 0x730AEDB5, 0xEE100584, 0x5A1B7222,
    -		0xD425D5E7, 0x602EA241, 0xFD344A70, 0x493F3DD6,
    -		0x8B9F1DCC, 0x3F946A6A, 0xA28E825B, 0x1685F5FD,
    -		0x98BB5238, 0x2CB0259E, 0xB1AACDAF, 0x05A1BA09,
    -		0xECD1F2FF, 0x58DA8559, 0xC5C06D68, 0x71CB1ACE,
    -		0xFFF5BD0B, 0x4BFECAAD, 0xD6E4229C, 0x62EF553A,
    -		0x4503C3AB, 0xF108B40D, 0x6C125C3C, 0xD8192B9A,
    -		0x56278C5F, 0xE22CFBF9, 0x7F3613C8, 0xCB3D646E,
    -		0x224D2C98, 0x96465B3E, 0x0B5CB30F, 0xBF57C4A9,
    -		0x3169636C, 0x856214CA, 0x1878FCFB, 0xAC738B5D,
    -		0x17A6A003, 0xA3ADD7A5, 0x3EB73F94, 0x8ABC4832,
    -		0x0482EFF7, 0xB0899851, 0x2D937060, 0x999807C6,
    -		0x70E84F30, 0xC4E33896, 0x59F9D0A7, 0xEDF2A701,
    -		0x63CC00C4, 0xD7C77762, 0x4ADD9F53, 0xFED6E8F5,
    -		0xD93A7E64, 0x6D3109C2, 0xF02BE1F3, 0x44209655,
    -		0xCA1E3190, 0x7E154636, 0xE30FAE07, 0x5704D9A1,
    -		0xBE749157, 0x0A7FE6F1, 0x97650EC0, 0x236E7966,
    -		0xAD50DEA3, 0x195BA905, 0x84414134, 0x304A3692
    -	}, {
    -		0x00000000, 0x9E00AACC, 0x7D072542, 0xE3078F8E,
    -		0xFA0E4A84, 0x640EE048, 0x87096FC6, 0x1909C50A,
    -		0xB51BE5D3, 0x2B1B4F1F, 0xC81CC091, 0x561C6A5D,
    -		0x4F15AF57, 0xD115059B, 0x32128A15, 0xAC1220D9,
    -		0x2B31BB7C, 0xB53111B0, 0x56369E3E, 0xC83634F2,
    -		0xD13FF1F8, 0x4F3F5B34, 0xAC38D4BA, 0x32387E76,
    -		0x9E2A5EAF, 0x002AF463, 0xE32D7BED, 0x7D2DD121,
    -		0x6424142B, 0xFA24BEE7, 0x19233169, 0x87239BA5,
    -		0x566276F9, 0xC862DC35, 0x2B6553BB, 0xB565F977,
    -		0xAC6C3C7D, 0x326C96B1, 0xD16B193F, 0x4F6BB3F3,
    -		0xE379932A, 0x7D7939E6, 0x9E7EB668, 0x007E1CA4,
    -		0x1977D9AE, 0x87777362, 0x6470FCEC, 0xFA705620,
    -		0x7D53CD85, 0xE3536749, 0x0054E8C7, 0x9E54420B,
    -		0x875D8701, 0x195D2DCD, 0xFA5AA243, 0x645A088F,
    -		0xC8482856, 0x5648829A, 0xB54F0D14, 0x2B4FA7D8,
    -		0x324662D2, 0xAC46C81E, 0x4F414790, 0xD141ED5C,
    -		0xEDC29D29, 0x73C237E5, 0x90C5B86B, 0x0EC512A7,
    -		0x17CCD7AD, 0x89CC7D61, 0x6ACBF2EF, 0xF4CB5823,
    -		0x58D978FA, 0xC6D9D236, 0x25DE5DB8, 0xBBDEF774,
    -		0xA2D7327E, 0x3CD798B2, 0xDFD0173C, 0x41D0BDF0,
    -		0xC6F32655, 0x58F38C99, 0xBBF40317, 0x25F4A9DB,
    -		0x3CFD6CD1, 0xA2FDC61D, 0x41FA4993, 0xDFFAE35F,
    -		0x73E8C386, 0xEDE8694A, 0x0EEFE6C4, 0x90EF4C08,
    -		0x89E68902, 0x17E623CE, 0xF4E1AC40, 0x6AE1068C,
    -		0xBBA0EBD0, 0x25A0411C, 0xC6A7CE92, 0x58A7645E,
    -		0x41AEA154, 0xDFAE0B98, 0x3CA98416, 0xA2A92EDA,
    -		0x0EBB0E03, 0x90BBA4CF, 0x73BC2B41, 0xEDBC818D,
    -		0xF4B54487, 0x6AB5EE4B, 0x89B261C5, 0x17B2CB09,
    -		0x909150AC, 0x0E91FA60, 0xED9675EE, 0x7396DF22,
    -		0x6A9F1A28, 0xF49FB0E4, 0x17983F6A, 0x899895A6,
    -		0x258AB57F, 0xBB8A1FB3, 0x588D903D, 0xC68D3AF1,
    -		0xDF84FFFB, 0x41845537, 0xA283DAB9, 0x3C837075,
    -		0xDA853B53, 0x4485919F, 0xA7821E11, 0x3982B4DD,
    -		0x208B71D7, 0xBE8BDB1B, 0x5D8C5495, 0xC38CFE59,
    -		0x6F9EDE80, 0xF19E744C, 0x1299FBC2, 0x8C99510E,
    -		0x95909404, 0x0B903EC8, 0xE897B146, 0x76971B8A,
    -		0xF1B4802F, 0x6FB42AE3, 0x8CB3A56D, 0x12B30FA1,
    -		0x0BBACAAB, 0x95BA6067, 0x76BDEFE9, 0xE8BD4525,
    -		0x44AF65FC, 0xDAAFCF30, 0x39A840BE, 0xA7A8EA72,
    -		0xBEA12F78, 0x20A185B4, 0xC3A60A3A, 0x5DA6A0F6,
    -		0x8CE74DAA, 0x12E7E766, 0xF1E068E8, 0x6FE0C224,
    -		0x76E9072E, 0xE8E9ADE2, 0x0BEE226C, 0x95EE88A0,
    -		0x39FCA879, 0xA7FC02B5, 0x44FB8D3B, 0xDAFB27F7,
    -		0xC3F2E2FD, 0x5DF24831, 0xBEF5C7BF, 0x20F56D73,
    -		0xA7D6F6D6, 0x39D65C1A, 0xDAD1D394, 0x44D17958,
    -		0x5DD8BC52, 0xC3D8169E, 0x20DF9910, 0xBEDF33DC,
    -		0x12CD1305, 0x8CCDB9C9, 0x6FCA3647, 0xF1CA9C8B,
    -		0xE8C35981, 0x76C3F34D, 0x95C47CC3, 0x0BC4D60F,
    -		0x3747A67A, 0xA9470CB6, 0x4A408338, 0xD44029F4,
    -		0xCD49ECFE, 0x53494632, 0xB04EC9BC, 0x2E4E6370,
    -		0x825C43A9, 0x1C5CE965, 0xFF5B66EB, 0x615BCC27,
    -		0x7852092D, 0xE652A3E1, 0x05552C6F, 0x9B5586A3,
    -		0x1C761D06, 0x8276B7CA, 0x61713844, 0xFF719288,
    -		0xE6785782, 0x7878FD4E, 0x9B7F72C0, 0x057FD80C,
    -		0xA96DF8D5, 0x376D5219, 0xD46ADD97, 0x4A6A775B,
    -		0x5363B251, 0xCD63189D, 0x2E649713, 0xB0643DDF,
    -		0x6125D083, 0xFF257A4F, 0x1C22F5C1, 0x82225F0D,
    -		0x9B2B9A07, 0x052B30CB, 0xE62CBF45, 0x782C1589,
    -		0xD43E3550, 0x4A3E9F9C, 0xA9391012, 0x3739BADE,
    -		0x2E307FD4, 0xB030D518, 0x53375A96, 0xCD37F05A,
    -		0x4A146BFF, 0xD414C133, 0x37134EBD, 0xA913E471,
    -		0xB01A217B, 0x2E1A8BB7, 0xCD1D0439, 0x531DAEF5,
    -		0xFF0F8E2C, 0x610F24E0, 0x8208AB6E, 0x1C0801A2,
    -		0x0501C4A8, 0x9B016E64, 0x7806E1EA, 0xE6064B26
    -	}
    -};
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc32_table_le.h b/external/public-domain/xz/dist/src/liblzma/check/crc32_table_le.h
    deleted file mode 100644
    index 25f4fc443..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc32_table_le.h
    +++ /dev/null
    @@ -1,525 +0,0 @@
    -/* This file has been automatically generated by crc32_tablegen.c. */
    -
    -const uint32_t lzma_crc32_table[8][256] = {
    -	{
    -		0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
    -		0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
    -		0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
    -		0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
    -		0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
    -		0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
    -		0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
    -		0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
    -		0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
    -		0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
    -		0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
    -		0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
    -		0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
    -		0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
    -		0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
    -		0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
    -		0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
    -		0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
    -		0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
    -		0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
    -		0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
    -		0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
    -		0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
    -		0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
    -		0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
    -		0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
    -		0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
    -		0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
    -		0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
    -		0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
    -		0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
    -		0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
    -		0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
    -		0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
    -		0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
    -		0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
    -		0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
    -		0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
    -		0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
    -		0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
    -		0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
    -		0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
    -		0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
    -		0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
    -		0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
    -		0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
    -		0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
    -		0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
    -		0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
    -		0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
    -		0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
    -		0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
    -		0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
    -		0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
    -		0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
    -		0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
    -		0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
    -		0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
    -		0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
    -		0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
    -		0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
    -		0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
    -		0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
    -		0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
    -	}, {
    -		0x00000000, 0x191B3141, 0x32366282, 0x2B2D53C3,
    -		0x646CC504, 0x7D77F445, 0x565AA786, 0x4F4196C7,
    -		0xC8D98A08, 0xD1C2BB49, 0xFAEFE88A, 0xE3F4D9CB,
    -		0xACB54F0C, 0xB5AE7E4D, 0x9E832D8E, 0x87981CCF,
    -		0x4AC21251, 0x53D92310, 0x78F470D3, 0x61EF4192,
    -		0x2EAED755, 0x37B5E614, 0x1C98B5D7, 0x05838496,
    -		0x821B9859, 0x9B00A918, 0xB02DFADB, 0xA936CB9A,
    -		0xE6775D5D, 0xFF6C6C1C, 0xD4413FDF, 0xCD5A0E9E,
    -		0x958424A2, 0x8C9F15E3, 0xA7B24620, 0xBEA97761,
    -		0xF1E8E1A6, 0xE8F3D0E7, 0xC3DE8324, 0xDAC5B265,
    -		0x5D5DAEAA, 0x44469FEB, 0x6F6BCC28, 0x7670FD69,
    -		0x39316BAE, 0x202A5AEF, 0x0B07092C, 0x121C386D,
    -		0xDF4636F3, 0xC65D07B2, 0xED705471, 0xF46B6530,
    -		0xBB2AF3F7, 0xA231C2B6, 0x891C9175, 0x9007A034,
    -		0x179FBCFB, 0x0E848DBA, 0x25A9DE79, 0x3CB2EF38,
    -		0x73F379FF, 0x6AE848BE, 0x41C51B7D, 0x58DE2A3C,
    -		0xF0794F05, 0xE9627E44, 0xC24F2D87, 0xDB541CC6,
    -		0x94158A01, 0x8D0EBB40, 0xA623E883, 0xBF38D9C2,
    -		0x38A0C50D, 0x21BBF44C, 0x0A96A78F, 0x138D96CE,
    -		0x5CCC0009, 0x45D73148, 0x6EFA628B, 0x77E153CA,
    -		0xBABB5D54, 0xA3A06C15, 0x888D3FD6, 0x91960E97,
    -		0xDED79850, 0xC7CCA911, 0xECE1FAD2, 0xF5FACB93,
    -		0x7262D75C, 0x6B79E61D, 0x4054B5DE, 0x594F849F,
    -		0x160E1258, 0x0F152319, 0x243870DA, 0x3D23419B,
    -		0x65FD6BA7, 0x7CE65AE6, 0x57CB0925, 0x4ED03864,
    -		0x0191AEA3, 0x188A9FE2, 0x33A7CC21, 0x2ABCFD60,
    -		0xAD24E1AF, 0xB43FD0EE, 0x9F12832D, 0x8609B26C,
    -		0xC94824AB, 0xD05315EA, 0xFB7E4629, 0xE2657768,
    -		0x2F3F79F6, 0x362448B7, 0x1D091B74, 0x04122A35,
    -		0x4B53BCF2, 0x52488DB3, 0x7965DE70, 0x607EEF31,
    -		0xE7E6F3FE, 0xFEFDC2BF, 0xD5D0917C, 0xCCCBA03D,
    -		0x838A36FA, 0x9A9107BB, 0xB1BC5478, 0xA8A76539,
    -		0x3B83984B, 0x2298A90A, 0x09B5FAC9, 0x10AECB88,
    -		0x5FEF5D4F, 0x46F46C0E, 0x6DD93FCD, 0x74C20E8C,
    -		0xF35A1243, 0xEA412302, 0xC16C70C1, 0xD8774180,
    -		0x9736D747, 0x8E2DE606, 0xA500B5C5, 0xBC1B8484,
    -		0x71418A1A, 0x685ABB5B, 0x4377E898, 0x5A6CD9D9,
    -		0x152D4F1E, 0x0C367E5F, 0x271B2D9C, 0x3E001CDD,
    -		0xB9980012, 0xA0833153, 0x8BAE6290, 0x92B553D1,
    -		0xDDF4C516, 0xC4EFF457, 0xEFC2A794, 0xF6D996D5,
    -		0xAE07BCE9, 0xB71C8DA8, 0x9C31DE6B, 0x852AEF2A,
    -		0xCA6B79ED, 0xD37048AC, 0xF85D1B6F, 0xE1462A2E,
    -		0x66DE36E1, 0x7FC507A0, 0x54E85463, 0x4DF36522,
    -		0x02B2F3E5, 0x1BA9C2A4, 0x30849167, 0x299FA026,
    -		0xE4C5AEB8, 0xFDDE9FF9, 0xD6F3CC3A, 0xCFE8FD7B,
    -		0x80A96BBC, 0x99B25AFD, 0xB29F093E, 0xAB84387F,
    -		0x2C1C24B0, 0x350715F1, 0x1E2A4632, 0x07317773,
    -		0x4870E1B4, 0x516BD0F5, 0x7A468336, 0x635DB277,
    -		0xCBFAD74E, 0xD2E1E60F, 0xF9CCB5CC, 0xE0D7848D,
    -		0xAF96124A, 0xB68D230B, 0x9DA070C8, 0x84BB4189,
    -		0x03235D46, 0x1A386C07, 0x31153FC4, 0x280E0E85,
    -		0x674F9842, 0x7E54A903, 0x5579FAC0, 0x4C62CB81,
    -		0x8138C51F, 0x9823F45E, 0xB30EA79D, 0xAA1596DC,
    -		0xE554001B, 0xFC4F315A, 0xD7626299, 0xCE7953D8,
    -		0x49E14F17, 0x50FA7E56, 0x7BD72D95, 0x62CC1CD4,
    -		0x2D8D8A13, 0x3496BB52, 0x1FBBE891, 0x06A0D9D0,
    -		0x5E7EF3EC, 0x4765C2AD, 0x6C48916E, 0x7553A02F,
    -		0x3A1236E8, 0x230907A9, 0x0824546A, 0x113F652B,
    -		0x96A779E4, 0x8FBC48A5, 0xA4911B66, 0xBD8A2A27,
    -		0xF2CBBCE0, 0xEBD08DA1, 0xC0FDDE62, 0xD9E6EF23,
    -		0x14BCE1BD, 0x0DA7D0FC, 0x268A833F, 0x3F91B27E,
    -		0x70D024B9, 0x69CB15F8, 0x42E6463B, 0x5BFD777A,
    -		0xDC656BB5, 0xC57E5AF4, 0xEE530937, 0xF7483876,
    -		0xB809AEB1, 0xA1129FF0, 0x8A3FCC33, 0x9324FD72
    -	}, {
    -		0x00000000, 0x01C26A37, 0x0384D46E, 0x0246BE59,
    -		0x0709A8DC, 0x06CBC2EB, 0x048D7CB2, 0x054F1685,
    -		0x0E1351B8, 0x0FD13B8F, 0x0D9785D6, 0x0C55EFE1,
    -		0x091AF964, 0x08D89353, 0x0A9E2D0A, 0x0B5C473D,
    -		0x1C26A370, 0x1DE4C947, 0x1FA2771E, 0x1E601D29,
    -		0x1B2F0BAC, 0x1AED619B, 0x18ABDFC2, 0x1969B5F5,
    -		0x1235F2C8, 0x13F798FF, 0x11B126A6, 0x10734C91,
    -		0x153C5A14, 0x14FE3023, 0x16B88E7A, 0x177AE44D,
    -		0x384D46E0, 0x398F2CD7, 0x3BC9928E, 0x3A0BF8B9,
    -		0x3F44EE3C, 0x3E86840B, 0x3CC03A52, 0x3D025065,
    -		0x365E1758, 0x379C7D6F, 0x35DAC336, 0x3418A901,
    -		0x3157BF84, 0x3095D5B3, 0x32D36BEA, 0x331101DD,
    -		0x246BE590, 0x25A98FA7, 0x27EF31FE, 0x262D5BC9,
    -		0x23624D4C, 0x22A0277B, 0x20E69922, 0x2124F315,
    -		0x2A78B428, 0x2BBADE1F, 0x29FC6046, 0x283E0A71,
    -		0x2D711CF4, 0x2CB376C3, 0x2EF5C89A, 0x2F37A2AD,
    -		0x709A8DC0, 0x7158E7F7, 0x731E59AE, 0x72DC3399,
    -		0x7793251C, 0x76514F2B, 0x7417F172, 0x75D59B45,
    -		0x7E89DC78, 0x7F4BB64F, 0x7D0D0816, 0x7CCF6221,
    -		0x798074A4, 0x78421E93, 0x7A04A0CA, 0x7BC6CAFD,
    -		0x6CBC2EB0, 0x6D7E4487, 0x6F38FADE, 0x6EFA90E9,
    -		0x6BB5866C, 0x6A77EC5B, 0x68315202, 0x69F33835,
    -		0x62AF7F08, 0x636D153F, 0x612BAB66, 0x60E9C151,
    -		0x65A6D7D4, 0x6464BDE3, 0x662203BA, 0x67E0698D,
    -		0x48D7CB20, 0x4915A117, 0x4B531F4E, 0x4A917579,
    -		0x4FDE63FC, 0x4E1C09CB, 0x4C5AB792, 0x4D98DDA5,
    -		0x46C49A98, 0x4706F0AF, 0x45404EF6, 0x448224C1,
    -		0x41CD3244, 0x400F5873, 0x4249E62A, 0x438B8C1D,
    -		0x54F16850, 0x55330267, 0x5775BC3E, 0x56B7D609,
    -		0x53F8C08C, 0x523AAABB, 0x507C14E2, 0x51BE7ED5,
    -		0x5AE239E8, 0x5B2053DF, 0x5966ED86, 0x58A487B1,
    -		0x5DEB9134, 0x5C29FB03, 0x5E6F455A, 0x5FAD2F6D,
    -		0xE1351B80, 0xE0F771B7, 0xE2B1CFEE, 0xE373A5D9,
    -		0xE63CB35C, 0xE7FED96B, 0xE5B86732, 0xE47A0D05,
    -		0xEF264A38, 0xEEE4200F, 0xECA29E56, 0xED60F461,
    -		0xE82FE2E4, 0xE9ED88D3, 0xEBAB368A, 0xEA695CBD,
    -		0xFD13B8F0, 0xFCD1D2C7, 0xFE976C9E, 0xFF5506A9,
    -		0xFA1A102C, 0xFBD87A1B, 0xF99EC442, 0xF85CAE75,
    -		0xF300E948, 0xF2C2837F, 0xF0843D26, 0xF1465711,
    -		0xF4094194, 0xF5CB2BA3, 0xF78D95FA, 0xF64FFFCD,
    -		0xD9785D60, 0xD8BA3757, 0xDAFC890E, 0xDB3EE339,
    -		0xDE71F5BC, 0xDFB39F8B, 0xDDF521D2, 0xDC374BE5,
    -		0xD76B0CD8, 0xD6A966EF, 0xD4EFD8B6, 0xD52DB281,
    -		0xD062A404, 0xD1A0CE33, 0xD3E6706A, 0xD2241A5D,
    -		0xC55EFE10, 0xC49C9427, 0xC6DA2A7E, 0xC7184049,
    -		0xC25756CC, 0xC3953CFB, 0xC1D382A2, 0xC011E895,
    -		0xCB4DAFA8, 0xCA8FC59F, 0xC8C97BC6, 0xC90B11F1,
    -		0xCC440774, 0xCD866D43, 0xCFC0D31A, 0xCE02B92D,
    -		0x91AF9640, 0x906DFC77, 0x922B422E, 0x93E92819,
    -		0x96A63E9C, 0x976454AB, 0x9522EAF2, 0x94E080C5,
    -		0x9FBCC7F8, 0x9E7EADCF, 0x9C381396, 0x9DFA79A1,
    -		0x98B56F24, 0x99770513, 0x9B31BB4A, 0x9AF3D17D,
    -		0x8D893530, 0x8C4B5F07, 0x8E0DE15E, 0x8FCF8B69,
    -		0x8A809DEC, 0x8B42F7DB, 0x89044982, 0x88C623B5,
    -		0x839A6488, 0x82580EBF, 0x801EB0E6, 0x81DCDAD1,
    -		0x8493CC54, 0x8551A663, 0x8717183A, 0x86D5720D,
    -		0xA9E2D0A0, 0xA820BA97, 0xAA6604CE, 0xABA46EF9,
    -		0xAEEB787C, 0xAF29124B, 0xAD6FAC12, 0xACADC625,
    -		0xA7F18118, 0xA633EB2F, 0xA4755576, 0xA5B73F41,
    -		0xA0F829C4, 0xA13A43F3, 0xA37CFDAA, 0xA2BE979D,
    -		0xB5C473D0, 0xB40619E7, 0xB640A7BE, 0xB782CD89,
    -		0xB2CDDB0C, 0xB30FB13B, 0xB1490F62, 0xB08B6555,
    -		0xBBD72268, 0xBA15485F, 0xB853F606, 0xB9919C31,
    -		0xBCDE8AB4, 0xBD1CE083, 0xBF5A5EDA, 0xBE9834ED
    -	}, {
    -		0x00000000, 0xB8BC6765, 0xAA09C88B, 0x12B5AFEE,
    -		0x8F629757, 0x37DEF032, 0x256B5FDC, 0x9DD738B9,
    -		0xC5B428EF, 0x7D084F8A, 0x6FBDE064, 0xD7018701,
    -		0x4AD6BFB8, 0xF26AD8DD, 0xE0DF7733, 0x58631056,
    -		0x5019579F, 0xE8A530FA, 0xFA109F14, 0x42ACF871,
    -		0xDF7BC0C8, 0x67C7A7AD, 0x75720843, 0xCDCE6F26,
    -		0x95AD7F70, 0x2D111815, 0x3FA4B7FB, 0x8718D09E,
    -		0x1ACFE827, 0xA2738F42, 0xB0C620AC, 0x087A47C9,
    -		0xA032AF3E, 0x188EC85B, 0x0A3B67B5, 0xB28700D0,
    -		0x2F503869, 0x97EC5F0C, 0x8559F0E2, 0x3DE59787,
    -		0x658687D1, 0xDD3AE0B4, 0xCF8F4F5A, 0x7733283F,
    -		0xEAE41086, 0x525877E3, 0x40EDD80D, 0xF851BF68,
    -		0xF02BF8A1, 0x48979FC4, 0x5A22302A, 0xE29E574F,
    -		0x7F496FF6, 0xC7F50893, 0xD540A77D, 0x6DFCC018,
    -		0x359FD04E, 0x8D23B72B, 0x9F9618C5, 0x272A7FA0,
    -		0xBAFD4719, 0x0241207C, 0x10F48F92, 0xA848E8F7,
    -		0x9B14583D, 0x23A83F58, 0x311D90B6, 0x89A1F7D3,
    -		0x1476CF6A, 0xACCAA80F, 0xBE7F07E1, 0x06C36084,
    -		0x5EA070D2, 0xE61C17B7, 0xF4A9B859, 0x4C15DF3C,
    -		0xD1C2E785, 0x697E80E0, 0x7BCB2F0E, 0xC377486B,
    -		0xCB0D0FA2, 0x73B168C7, 0x6104C729, 0xD9B8A04C,
    -		0x446F98F5, 0xFCD3FF90, 0xEE66507E, 0x56DA371B,
    -		0x0EB9274D, 0xB6054028, 0xA4B0EFC6, 0x1C0C88A3,
    -		0x81DBB01A, 0x3967D77F, 0x2BD27891, 0x936E1FF4,
    -		0x3B26F703, 0x839A9066, 0x912F3F88, 0x299358ED,
    -		0xB4446054, 0x0CF80731, 0x1E4DA8DF, 0xA6F1CFBA,
    -		0xFE92DFEC, 0x462EB889, 0x549B1767, 0xEC277002,
    -		0x71F048BB, 0xC94C2FDE, 0xDBF98030, 0x6345E755,
    -		0x6B3FA09C, 0xD383C7F9, 0xC1366817, 0x798A0F72,
    -		0xE45D37CB, 0x5CE150AE, 0x4E54FF40, 0xF6E89825,
    -		0xAE8B8873, 0x1637EF16, 0x048240F8, 0xBC3E279D,
    -		0x21E91F24, 0x99557841, 0x8BE0D7AF, 0x335CB0CA,
    -		0xED59B63B, 0x55E5D15E, 0x47507EB0, 0xFFEC19D5,
    -		0x623B216C, 0xDA874609, 0xC832E9E7, 0x708E8E82,
    -		0x28ED9ED4, 0x9051F9B1, 0x82E4565F, 0x3A58313A,
    -		0xA78F0983, 0x1F336EE6, 0x0D86C108, 0xB53AA66D,
    -		0xBD40E1A4, 0x05FC86C1, 0x1749292F, 0xAFF54E4A,
    -		0x322276F3, 0x8A9E1196, 0x982BBE78, 0x2097D91D,
    -		0x78F4C94B, 0xC048AE2E, 0xD2FD01C0, 0x6A4166A5,
    -		0xF7965E1C, 0x4F2A3979, 0x5D9F9697, 0xE523F1F2,
    -		0x4D6B1905, 0xF5D77E60, 0xE762D18E, 0x5FDEB6EB,
    -		0xC2098E52, 0x7AB5E937, 0x680046D9, 0xD0BC21BC,
    -		0x88DF31EA, 0x3063568F, 0x22D6F961, 0x9A6A9E04,
    -		0x07BDA6BD, 0xBF01C1D8, 0xADB46E36, 0x15080953,
    -		0x1D724E9A, 0xA5CE29FF, 0xB77B8611, 0x0FC7E174,
    -		0x9210D9CD, 0x2AACBEA8, 0x38191146, 0x80A57623,
    -		0xD8C66675, 0x607A0110, 0x72CFAEFE, 0xCA73C99B,
    -		0x57A4F122, 0xEF189647, 0xFDAD39A9, 0x45115ECC,
    -		0x764DEE06, 0xCEF18963, 0xDC44268D, 0x64F841E8,
    -		0xF92F7951, 0x41931E34, 0x5326B1DA, 0xEB9AD6BF,
    -		0xB3F9C6E9, 0x0B45A18C, 0x19F00E62, 0xA14C6907,
    -		0x3C9B51BE, 0x842736DB, 0x96929935, 0x2E2EFE50,
    -		0x2654B999, 0x9EE8DEFC, 0x8C5D7112, 0x34E11677,
    -		0xA9362ECE, 0x118A49AB, 0x033FE645, 0xBB838120,
    -		0xE3E09176, 0x5B5CF613, 0x49E959FD, 0xF1553E98,
    -		0x6C820621, 0xD43E6144, 0xC68BCEAA, 0x7E37A9CF,
    -		0xD67F4138, 0x6EC3265D, 0x7C7689B3, 0xC4CAEED6,
    -		0x591DD66F, 0xE1A1B10A, 0xF3141EE4, 0x4BA87981,
    -		0x13CB69D7, 0xAB770EB2, 0xB9C2A15C, 0x017EC639,
    -		0x9CA9FE80, 0x241599E5, 0x36A0360B, 0x8E1C516E,
    -		0x866616A7, 0x3EDA71C2, 0x2C6FDE2C, 0x94D3B949,
    -		0x090481F0, 0xB1B8E695, 0xA30D497B, 0x1BB12E1E,
    -		0x43D23E48, 0xFB6E592D, 0xE9DBF6C3, 0x516791A6,
    -		0xCCB0A91F, 0x740CCE7A, 0x66B96194, 0xDE0506F1
    -	}, {
    -		0x00000000, 0x3D6029B0, 0x7AC05360, 0x47A07AD0,
    -		0xF580A6C0, 0xC8E08F70, 0x8F40F5A0, 0xB220DC10,
    -		0x30704BC1, 0x0D106271, 0x4AB018A1, 0x77D03111,
    -		0xC5F0ED01, 0xF890C4B1, 0xBF30BE61, 0x825097D1,
    -		0x60E09782, 0x5D80BE32, 0x1A20C4E2, 0x2740ED52,
    -		0x95603142, 0xA80018F2, 0xEFA06222, 0xD2C04B92,
    -		0x5090DC43, 0x6DF0F5F3, 0x2A508F23, 0x1730A693,
    -		0xA5107A83, 0x98705333, 0xDFD029E3, 0xE2B00053,
    -		0xC1C12F04, 0xFCA106B4, 0xBB017C64, 0x866155D4,
    -		0x344189C4, 0x0921A074, 0x4E81DAA4, 0x73E1F314,
    -		0xF1B164C5, 0xCCD14D75, 0x8B7137A5, 0xB6111E15,
    -		0x0431C205, 0x3951EBB5, 0x7EF19165, 0x4391B8D5,
    -		0xA121B886, 0x9C419136, 0xDBE1EBE6, 0xE681C256,
    -		0x54A11E46, 0x69C137F6, 0x2E614D26, 0x13016496,
    -		0x9151F347, 0xAC31DAF7, 0xEB91A027, 0xD6F18997,
    -		0x64D15587, 0x59B17C37, 0x1E1106E7, 0x23712F57,
    -		0x58F35849, 0x659371F9, 0x22330B29, 0x1F532299,
    -		0xAD73FE89, 0x9013D739, 0xD7B3ADE9, 0xEAD38459,
    -		0x68831388, 0x55E33A38, 0x124340E8, 0x2F236958,
    -		0x9D03B548, 0xA0639CF8, 0xE7C3E628, 0xDAA3CF98,
    -		0x3813CFCB, 0x0573E67B, 0x42D39CAB, 0x7FB3B51B,
    -		0xCD93690B, 0xF0F340BB, 0xB7533A6B, 0x8A3313DB,
    -		0x0863840A, 0x3503ADBA, 0x72A3D76A, 0x4FC3FEDA,
    -		0xFDE322CA, 0xC0830B7A, 0x872371AA, 0xBA43581A,
    -		0x9932774D, 0xA4525EFD, 0xE3F2242D, 0xDE920D9D,
    -		0x6CB2D18D, 0x51D2F83D, 0x167282ED, 0x2B12AB5D,
    -		0xA9423C8C, 0x9422153C, 0xD3826FEC, 0xEEE2465C,
    -		0x5CC29A4C, 0x61A2B3FC, 0x2602C92C, 0x1B62E09C,
    -		0xF9D2E0CF, 0xC4B2C97F, 0x8312B3AF, 0xBE729A1F,
    -		0x0C52460F, 0x31326FBF, 0x7692156F, 0x4BF23CDF,
    -		0xC9A2AB0E, 0xF4C282BE, 0xB362F86E, 0x8E02D1DE,
    -		0x3C220DCE, 0x0142247E, 0x46E25EAE, 0x7B82771E,
    -		0xB1E6B092, 0x8C869922, 0xCB26E3F2, 0xF646CA42,
    -		0x44661652, 0x79063FE2, 0x3EA64532, 0x03C66C82,
    -		0x8196FB53, 0xBCF6D2E3, 0xFB56A833, 0xC6368183,
    -		0x74165D93, 0x49767423, 0x0ED60EF3, 0x33B62743,
    -		0xD1062710, 0xEC660EA0, 0xABC67470, 0x96A65DC0,
    -		0x248681D0, 0x19E6A860, 0x5E46D2B0, 0x6326FB00,
    -		0xE1766CD1, 0xDC164561, 0x9BB63FB1, 0xA6D61601,
    -		0x14F6CA11, 0x2996E3A1, 0x6E369971, 0x5356B0C1,
    -		0x70279F96, 0x4D47B626, 0x0AE7CCF6, 0x3787E546,
    -		0x85A73956, 0xB8C710E6, 0xFF676A36, 0xC2074386,
    -		0x4057D457, 0x7D37FDE7, 0x3A978737, 0x07F7AE87,
    -		0xB5D77297, 0x88B75B27, 0xCF1721F7, 0xF2770847,
    -		0x10C70814, 0x2DA721A4, 0x6A075B74, 0x576772C4,
    -		0xE547AED4, 0xD8278764, 0x9F87FDB4, 0xA2E7D404,
    -		0x20B743D5, 0x1DD76A65, 0x5A7710B5, 0x67173905,
    -		0xD537E515, 0xE857CCA5, 0xAFF7B675, 0x92979FC5,
    -		0xE915E8DB, 0xD475C16B, 0x93D5BBBB, 0xAEB5920B,
    -		0x1C954E1B, 0x21F567AB, 0x66551D7B, 0x5B3534CB,
    -		0xD965A31A, 0xE4058AAA, 0xA3A5F07A, 0x9EC5D9CA,
    -		0x2CE505DA, 0x11852C6A, 0x562556BA, 0x6B457F0A,
    -		0x89F57F59, 0xB49556E9, 0xF3352C39, 0xCE550589,
    -		0x7C75D999, 0x4115F029, 0x06B58AF9, 0x3BD5A349,
    -		0xB9853498, 0x84E51D28, 0xC34567F8, 0xFE254E48,
    -		0x4C059258, 0x7165BBE8, 0x36C5C138, 0x0BA5E888,
    -		0x28D4C7DF, 0x15B4EE6F, 0x521494BF, 0x6F74BD0F,
    -		0xDD54611F, 0xE03448AF, 0xA794327F, 0x9AF41BCF,
    -		0x18A48C1E, 0x25C4A5AE, 0x6264DF7E, 0x5F04F6CE,
    -		0xED242ADE, 0xD044036E, 0x97E479BE, 0xAA84500E,
    -		0x4834505D, 0x755479ED, 0x32F4033D, 0x0F942A8D,
    -		0xBDB4F69D, 0x80D4DF2D, 0xC774A5FD, 0xFA148C4D,
    -		0x78441B9C, 0x4524322C, 0x028448FC, 0x3FE4614C,
    -		0x8DC4BD5C, 0xB0A494EC, 0xF704EE3C, 0xCA64C78C
    -	}, {
    -		0x00000000, 0xCB5CD3A5, 0x4DC8A10B, 0x869472AE,
    -		0x9B914216, 0x50CD91B3, 0xD659E31D, 0x1D0530B8,
    -		0xEC53826D, 0x270F51C8, 0xA19B2366, 0x6AC7F0C3,
    -		0x77C2C07B, 0xBC9E13DE, 0x3A0A6170, 0xF156B2D5,
    -		0x03D6029B, 0xC88AD13E, 0x4E1EA390, 0x85427035,
    -		0x9847408D, 0x531B9328, 0xD58FE186, 0x1ED33223,
    -		0xEF8580F6, 0x24D95353, 0xA24D21FD, 0x6911F258,
    -		0x7414C2E0, 0xBF481145, 0x39DC63EB, 0xF280B04E,
    -		0x07AC0536, 0xCCF0D693, 0x4A64A43D, 0x81387798,
    -		0x9C3D4720, 0x57619485, 0xD1F5E62B, 0x1AA9358E,
    -		0xEBFF875B, 0x20A354FE, 0xA6372650, 0x6D6BF5F5,
    -		0x706EC54D, 0xBB3216E8, 0x3DA66446, 0xF6FAB7E3,
    -		0x047A07AD, 0xCF26D408, 0x49B2A6A6, 0x82EE7503,
    -		0x9FEB45BB, 0x54B7961E, 0xD223E4B0, 0x197F3715,
    -		0xE82985C0, 0x23755665, 0xA5E124CB, 0x6EBDF76E,
    -		0x73B8C7D6, 0xB8E41473, 0x3E7066DD, 0xF52CB578,
    -		0x0F580A6C, 0xC404D9C9, 0x4290AB67, 0x89CC78C2,
    -		0x94C9487A, 0x5F959BDF, 0xD901E971, 0x125D3AD4,
    -		0xE30B8801, 0x28575BA4, 0xAEC3290A, 0x659FFAAF,
    -		0x789ACA17, 0xB3C619B2, 0x35526B1C, 0xFE0EB8B9,
    -		0x0C8E08F7, 0xC7D2DB52, 0x4146A9FC, 0x8A1A7A59,
    -		0x971F4AE1, 0x5C439944, 0xDAD7EBEA, 0x118B384F,
    -		0xE0DD8A9A, 0x2B81593F, 0xAD152B91, 0x6649F834,
    -		0x7B4CC88C, 0xB0101B29, 0x36846987, 0xFDD8BA22,
    -		0x08F40F5A, 0xC3A8DCFF, 0x453CAE51, 0x8E607DF4,
    -		0x93654D4C, 0x58399EE9, 0xDEADEC47, 0x15F13FE2,
    -		0xE4A78D37, 0x2FFB5E92, 0xA96F2C3C, 0x6233FF99,
    -		0x7F36CF21, 0xB46A1C84, 0x32FE6E2A, 0xF9A2BD8F,
    -		0x0B220DC1, 0xC07EDE64, 0x46EAACCA, 0x8DB67F6F,
    -		0x90B34FD7, 0x5BEF9C72, 0xDD7BEEDC, 0x16273D79,
    -		0xE7718FAC, 0x2C2D5C09, 0xAAB92EA7, 0x61E5FD02,
    -		0x7CE0CDBA, 0xB7BC1E1F, 0x31286CB1, 0xFA74BF14,
    -		0x1EB014D8, 0xD5ECC77D, 0x5378B5D3, 0x98246676,
    -		0x852156CE, 0x4E7D856B, 0xC8E9F7C5, 0x03B52460,
    -		0xF2E396B5, 0x39BF4510, 0xBF2B37BE, 0x7477E41B,
    -		0x6972D4A3, 0xA22E0706, 0x24BA75A8, 0xEFE6A60D,
    -		0x1D661643, 0xD63AC5E6, 0x50AEB748, 0x9BF264ED,
    -		0x86F75455, 0x4DAB87F0, 0xCB3FF55E, 0x006326FB,
    -		0xF135942E, 0x3A69478B, 0xBCFD3525, 0x77A1E680,
    -		0x6AA4D638, 0xA1F8059D, 0x276C7733, 0xEC30A496,
    -		0x191C11EE, 0xD240C24B, 0x54D4B0E5, 0x9F886340,
    -		0x828D53F8, 0x49D1805D, 0xCF45F2F3, 0x04192156,
    -		0xF54F9383, 0x3E134026, 0xB8873288, 0x73DBE12D,
    -		0x6EDED195, 0xA5820230, 0x2316709E, 0xE84AA33B,
    -		0x1ACA1375, 0xD196C0D0, 0x5702B27E, 0x9C5E61DB,
    -		0x815B5163, 0x4A0782C6, 0xCC93F068, 0x07CF23CD,
    -		0xF6999118, 0x3DC542BD, 0xBB513013, 0x700DE3B6,
    -		0x6D08D30E, 0xA65400AB, 0x20C07205, 0xEB9CA1A0,
    -		0x11E81EB4, 0xDAB4CD11, 0x5C20BFBF, 0x977C6C1A,
    -		0x8A795CA2, 0x41258F07, 0xC7B1FDA9, 0x0CED2E0C,
    -		0xFDBB9CD9, 0x36E74F7C, 0xB0733DD2, 0x7B2FEE77,
    -		0x662ADECF, 0xAD760D6A, 0x2BE27FC4, 0xE0BEAC61,
    -		0x123E1C2F, 0xD962CF8A, 0x5FF6BD24, 0x94AA6E81,
    -		0x89AF5E39, 0x42F38D9C, 0xC467FF32, 0x0F3B2C97,
    -		0xFE6D9E42, 0x35314DE7, 0xB3A53F49, 0x78F9ECEC,
    -		0x65FCDC54, 0xAEA00FF1, 0x28347D5F, 0xE368AEFA,
    -		0x16441B82, 0xDD18C827, 0x5B8CBA89, 0x90D0692C,
    -		0x8DD55994, 0x46898A31, 0xC01DF89F, 0x0B412B3A,
    -		0xFA1799EF, 0x314B4A4A, 0xB7DF38E4, 0x7C83EB41,
    -		0x6186DBF9, 0xAADA085C, 0x2C4E7AF2, 0xE712A957,
    -		0x15921919, 0xDECECABC, 0x585AB812, 0x93066BB7,
    -		0x8E035B0F, 0x455F88AA, 0xC3CBFA04, 0x089729A1,
    -		0xF9C19B74, 0x329D48D1, 0xB4093A7F, 0x7F55E9DA,
    -		0x6250D962, 0xA90C0AC7, 0x2F987869, 0xE4C4ABCC
    -	}, {
    -		0x00000000, 0xA6770BB4, 0x979F1129, 0x31E81A9D,
    -		0xF44F2413, 0x52382FA7, 0x63D0353A, 0xC5A73E8E,
    -		0x33EF4E67, 0x959845D3, 0xA4705F4E, 0x020754FA,
    -		0xC7A06A74, 0x61D761C0, 0x503F7B5D, 0xF64870E9,
    -		0x67DE9CCE, 0xC1A9977A, 0xF0418DE7, 0x56368653,
    -		0x9391B8DD, 0x35E6B369, 0x040EA9F4, 0xA279A240,
    -		0x5431D2A9, 0xF246D91D, 0xC3AEC380, 0x65D9C834,
    -		0xA07EF6BA, 0x0609FD0E, 0x37E1E793, 0x9196EC27,
    -		0xCFBD399C, 0x69CA3228, 0x582228B5, 0xFE552301,
    -		0x3BF21D8F, 0x9D85163B, 0xAC6D0CA6, 0x0A1A0712,
    -		0xFC5277FB, 0x5A257C4F, 0x6BCD66D2, 0xCDBA6D66,
    -		0x081D53E8, 0xAE6A585C, 0x9F8242C1, 0x39F54975,
    -		0xA863A552, 0x0E14AEE6, 0x3FFCB47B, 0x998BBFCF,
    -		0x5C2C8141, 0xFA5B8AF5, 0xCBB39068, 0x6DC49BDC,
    -		0x9B8CEB35, 0x3DFBE081, 0x0C13FA1C, 0xAA64F1A8,
    -		0x6FC3CF26, 0xC9B4C492, 0xF85CDE0F, 0x5E2BD5BB,
    -		0x440B7579, 0xE27C7ECD, 0xD3946450, 0x75E36FE4,
    -		0xB044516A, 0x16335ADE, 0x27DB4043, 0x81AC4BF7,
    -		0x77E43B1E, 0xD19330AA, 0xE07B2A37, 0x460C2183,
    -		0x83AB1F0D, 0x25DC14B9, 0x14340E24, 0xB2430590,
    -		0x23D5E9B7, 0x85A2E203, 0xB44AF89E, 0x123DF32A,
    -		0xD79ACDA4, 0x71EDC610, 0x4005DC8D, 0xE672D739,
    -		0x103AA7D0, 0xB64DAC64, 0x87A5B6F9, 0x21D2BD4D,
    -		0xE47583C3, 0x42028877, 0x73EA92EA, 0xD59D995E,
    -		0x8BB64CE5, 0x2DC14751, 0x1C295DCC, 0xBA5E5678,
    -		0x7FF968F6, 0xD98E6342, 0xE86679DF, 0x4E11726B,
    -		0xB8590282, 0x1E2E0936, 0x2FC613AB, 0x89B1181F,
    -		0x4C162691, 0xEA612D25, 0xDB8937B8, 0x7DFE3C0C,
    -		0xEC68D02B, 0x4A1FDB9F, 0x7BF7C102, 0xDD80CAB6,
    -		0x1827F438, 0xBE50FF8C, 0x8FB8E511, 0x29CFEEA5,
    -		0xDF879E4C, 0x79F095F8, 0x48188F65, 0xEE6F84D1,
    -		0x2BC8BA5F, 0x8DBFB1EB, 0xBC57AB76, 0x1A20A0C2,
    -		0x8816EAF2, 0x2E61E146, 0x1F89FBDB, 0xB9FEF06F,
    -		0x7C59CEE1, 0xDA2EC555, 0xEBC6DFC8, 0x4DB1D47C,
    -		0xBBF9A495, 0x1D8EAF21, 0x2C66B5BC, 0x8A11BE08,
    -		0x4FB68086, 0xE9C18B32, 0xD82991AF, 0x7E5E9A1B,
    -		0xEFC8763C, 0x49BF7D88, 0x78576715, 0xDE206CA1,
    -		0x1B87522F, 0xBDF0599B, 0x8C184306, 0x2A6F48B2,
    -		0xDC27385B, 0x7A5033EF, 0x4BB82972, 0xEDCF22C6,
    -		0x28681C48, 0x8E1F17FC, 0xBFF70D61, 0x198006D5,
    -		0x47ABD36E, 0xE1DCD8DA, 0xD034C247, 0x7643C9F3,
    -		0xB3E4F77D, 0x1593FCC9, 0x247BE654, 0x820CEDE0,
    -		0x74449D09, 0xD23396BD, 0xE3DB8C20, 0x45AC8794,
    -		0x800BB91A, 0x267CB2AE, 0x1794A833, 0xB1E3A387,
    -		0x20754FA0, 0x86024414, 0xB7EA5E89, 0x119D553D,
    -		0xD43A6BB3, 0x724D6007, 0x43A57A9A, 0xE5D2712E,
    -		0x139A01C7, 0xB5ED0A73, 0x840510EE, 0x22721B5A,
    -		0xE7D525D4, 0x41A22E60, 0x704A34FD, 0xD63D3F49,
    -		0xCC1D9F8B, 0x6A6A943F, 0x5B828EA2, 0xFDF58516,
    -		0x3852BB98, 0x9E25B02C, 0xAFCDAAB1, 0x09BAA105,
    -		0xFFF2D1EC, 0x5985DA58, 0x686DC0C5, 0xCE1ACB71,
    -		0x0BBDF5FF, 0xADCAFE4B, 0x9C22E4D6, 0x3A55EF62,
    -		0xABC30345, 0x0DB408F1, 0x3C5C126C, 0x9A2B19D8,
    -		0x5F8C2756, 0xF9FB2CE2, 0xC813367F, 0x6E643DCB,
    -		0x982C4D22, 0x3E5B4696, 0x0FB35C0B, 0xA9C457BF,
    -		0x6C636931, 0xCA146285, 0xFBFC7818, 0x5D8B73AC,
    -		0x03A0A617, 0xA5D7ADA3, 0x943FB73E, 0x3248BC8A,
    -		0xF7EF8204, 0x519889B0, 0x6070932D, 0xC6079899,
    -		0x304FE870, 0x9638E3C4, 0xA7D0F959, 0x01A7F2ED,
    -		0xC400CC63, 0x6277C7D7, 0x539FDD4A, 0xF5E8D6FE,
    -		0x647E3AD9, 0xC209316D, 0xF3E12BF0, 0x55962044,
    -		0x90311ECA, 0x3646157E, 0x07AE0FE3, 0xA1D90457,
    -		0x579174BE, 0xF1E67F0A, 0xC00E6597, 0x66796E23,
    -		0xA3DE50AD, 0x05A95B19, 0x34414184, 0x92364A30
    -	}, {
    -		0x00000000, 0xCCAA009E, 0x4225077D, 0x8E8F07E3,
    -		0x844A0EFA, 0x48E00E64, 0xC66F0987, 0x0AC50919,
    -		0xD3E51BB5, 0x1F4F1B2B, 0x91C01CC8, 0x5D6A1C56,
    -		0x57AF154F, 0x9B0515D1, 0x158A1232, 0xD92012AC,
    -		0x7CBB312B, 0xB01131B5, 0x3E9E3656, 0xF23436C8,
    -		0xF8F13FD1, 0x345B3F4F, 0xBAD438AC, 0x767E3832,
    -		0xAF5E2A9E, 0x63F42A00, 0xED7B2DE3, 0x21D12D7D,
    -		0x2B142464, 0xE7BE24FA, 0x69312319, 0xA59B2387,
    -		0xF9766256, 0x35DC62C8, 0xBB53652B, 0x77F965B5,
    -		0x7D3C6CAC, 0xB1966C32, 0x3F196BD1, 0xF3B36B4F,
    -		0x2A9379E3, 0xE639797D, 0x68B67E9E, 0xA41C7E00,
    -		0xAED97719, 0x62737787, 0xECFC7064, 0x205670FA,
    -		0x85CD537D, 0x496753E3, 0xC7E85400, 0x0B42549E,
    -		0x01875D87, 0xCD2D5D19, 0x43A25AFA, 0x8F085A64,
    -		0x562848C8, 0x9A824856, 0x140D4FB5, 0xD8A74F2B,
    -		0xD2624632, 0x1EC846AC, 0x9047414F, 0x5CED41D1,
    -		0x299DC2ED, 0xE537C273, 0x6BB8C590, 0xA712C50E,
    -		0xADD7CC17, 0x617DCC89, 0xEFF2CB6A, 0x2358CBF4,
    -		0xFA78D958, 0x36D2D9C6, 0xB85DDE25, 0x74F7DEBB,
    -		0x7E32D7A2, 0xB298D73C, 0x3C17D0DF, 0xF0BDD041,
    -		0x5526F3C6, 0x998CF358, 0x1703F4BB, 0xDBA9F425,
    -		0xD16CFD3C, 0x1DC6FDA2, 0x9349FA41, 0x5FE3FADF,
    -		0x86C3E873, 0x4A69E8ED, 0xC4E6EF0E, 0x084CEF90,
    -		0x0289E689, 0xCE23E617, 0x40ACE1F4, 0x8C06E16A,
    -		0xD0EBA0BB, 0x1C41A025, 0x92CEA7C6, 0x5E64A758,
    -		0x54A1AE41, 0x980BAEDF, 0x1684A93C, 0xDA2EA9A2,
    -		0x030EBB0E, 0xCFA4BB90, 0x412BBC73, 0x8D81BCED,
    -		0x8744B5F4, 0x4BEEB56A, 0xC561B289, 0x09CBB217,
    -		0xAC509190, 0x60FA910E, 0xEE7596ED, 0x22DF9673,
    -		0x281A9F6A, 0xE4B09FF4, 0x6A3F9817, 0xA6959889,
    -		0x7FB58A25, 0xB31F8ABB, 0x3D908D58, 0xF13A8DC6,
    -		0xFBFF84DF, 0x37558441, 0xB9DA83A2, 0x7570833C,
    -		0x533B85DA, 0x9F918544, 0x111E82A7, 0xDDB48239,
    -		0xD7718B20, 0x1BDB8BBE, 0x95548C5D, 0x59FE8CC3,
    -		0x80DE9E6F, 0x4C749EF1, 0xC2FB9912, 0x0E51998C,
    -		0x04949095, 0xC83E900B, 0x46B197E8, 0x8A1B9776,
    -		0x2F80B4F1, 0xE32AB46F, 0x6DA5B38C, 0xA10FB312,
    -		0xABCABA0B, 0x6760BA95, 0xE9EFBD76, 0x2545BDE8,
    -		0xFC65AF44, 0x30CFAFDA, 0xBE40A839, 0x72EAA8A7,
    -		0x782FA1BE, 0xB485A120, 0x3A0AA6C3, 0xF6A0A65D,
    -		0xAA4DE78C, 0x66E7E712, 0xE868E0F1, 0x24C2E06F,
    -		0x2E07E976, 0xE2ADE9E8, 0x6C22EE0B, 0xA088EE95,
    -		0x79A8FC39, 0xB502FCA7, 0x3B8DFB44, 0xF727FBDA,
    -		0xFDE2F2C3, 0x3148F25D, 0xBFC7F5BE, 0x736DF520,
    -		0xD6F6D6A7, 0x1A5CD639, 0x94D3D1DA, 0x5879D144,
    -		0x52BCD85D, 0x9E16D8C3, 0x1099DF20, 0xDC33DFBE,
    -		0x0513CD12, 0xC9B9CD8C, 0x4736CA6F, 0x8B9CCAF1,
    -		0x8159C3E8, 0x4DF3C376, 0xC37CC495, 0x0FD6C40B,
    -		0x7AA64737, 0xB60C47A9, 0x3883404A, 0xF42940D4,
    -		0xFEEC49CD, 0x32464953, 0xBCC94EB0, 0x70634E2E,
    -		0xA9435C82, 0x65E95C1C, 0xEB665BFF, 0x27CC5B61,
    -		0x2D095278, 0xE1A352E6, 0x6F2C5505, 0xA386559B,
    -		0x061D761C, 0xCAB77682, 0x44387161, 0x889271FF,
    -		0x825778E6, 0x4EFD7878, 0xC0727F9B, 0x0CD87F05,
    -		0xD5F86DA9, 0x19526D37, 0x97DD6AD4, 0x5B776A4A,
    -		0x51B26353, 0x9D1863CD, 0x1397642E, 0xDF3D64B0,
    -		0x83D02561, 0x4F7A25FF, 0xC1F5221C, 0x0D5F2282,
    -		0x079A2B9B, 0xCB302B05, 0x45BF2CE6, 0x89152C78,
    -		0x50353ED4, 0x9C9F3E4A, 0x121039A9, 0xDEBA3937,
    -		0xD47F302E, 0x18D530B0, 0x965A3753, 0x5AF037CD,
    -		0xFF6B144A, 0x33C114D4, 0xBD4E1337, 0x71E413A9,
    -		0x7B211AB0, 0xB78B1A2E, 0x39041DCD, 0xF5AE1D53,
    -		0x2C8E0FFF, 0xE0240F61, 0x6EAB0882, 0xA201081C,
    -		0xA8C40105, 0x646E019B, 0xEAE10678, 0x264B06E6
    -	}
    -};
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc32_tablegen.c b/external/public-domain/xz/dist/src/liblzma/check/crc32_tablegen.c
    deleted file mode 100644
    index 31a4d2751..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc32_tablegen.c
    +++ /dev/null
    @@ -1,117 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc32_tablegen.c
    -/// \brief      Generate crc32_table_le.h and crc32_table_be.h
    -///
    -/// Compiling: gcc -std=c99 -o crc32_tablegen crc32_tablegen.c
    -/// Add -DWORDS_BIGENDIAN to generate big endian table.
    -/// Add -DLZ_HASH_TABLE to generate lz_encoder_hash_table.h (little endian).
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include 
    -#include "../../common/tuklib_integer.h"
    -
    -
    -static uint32_t crc32_table[8][256];
    -
    -
    -static void
    -init_crc32_table(void)
    -{
    -	static const uint32_t poly32 = UINT32_C(0xEDB88320);
    -
    -	for (size_t s = 0; s < 8; ++s) {
    -		for (size_t b = 0; b < 256; ++b) {
    -			uint32_t r = s == 0 ? b : crc32_table[s - 1][b];
    -
    -			for (size_t i = 0; i < 8; ++i) {
    -				if (r & 1)
    -					r = (r >> 1) ^ poly32;
    -				else
    -					r >>= 1;
    -			}
    -
    -			crc32_table[s][b] = r;
    -		}
    -	}
    -
    -#ifdef WORDS_BIGENDIAN
    -	for (size_t s = 0; s < 8; ++s)
    -		for (size_t b = 0; b < 256; ++b)
    -			crc32_table[s][b] = bswap32(crc32_table[s][b]);
    -#endif
    -
    -	return;
    -}
    -
    -
    -static void
    -print_crc32_table(void)
    -{
    -	printf("/* This file has been automatically generated by "
    -			"crc32_tablegen.c. */\n\n"
    -			"const uint32_t lzma_crc32_table[8][256] = {\n\t{");
    -
    -	for (size_t s = 0; s < 8; ++s) {
    -		for (size_t b = 0; b < 256; ++b) {
    -			if ((b % 4) == 0)
    -				printf("\n\t\t");
    -
    -			printf("0x%08" PRIX32, crc32_table[s][b]);
    -
    -			if (b != 255)
    -				printf(",%s", (b+1) % 4 == 0 ? "" : " ");
    -		}
    -
    -		if (s == 7)
    -			printf("\n\t}\n};\n");
    -		else
    -			printf("\n\t}, {");
    -	}
    -
    -	return;
    -}
    -
    -
    -static void
    -print_lz_table(void)
    -{
    -	printf("/* This file has been automatically generated by "
    -			"crc32_tablegen.c. */\n\n"
    -			"const uint32_t lzma_lz_hash_table[256] = {");
    -
    -	for (size_t b = 0; b < 256; ++b) {
    -		if ((b % 4) == 0)
    -			printf("\n\t");
    -
    -		printf("0x%08" PRIX32, crc32_table[0][b]);
    -
    -		if (b != 255)
    -			printf(",%s", (b+1) % 4 == 0 ? "" : " ");
    -	}
    -
    -	printf("\n};\n");
    -
    -	return;
    -}
    -
    -
    -int
    -main(void)
    -{
    -	init_crc32_table();
    -
    -#ifdef LZ_HASH_TABLE
    -	print_lz_table();
    -#else
    -	print_crc32_table();
    -#endif
    -
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc32_x86.S b/external/public-domain/xz/dist/src/liblzma/check/crc32_x86.S
    deleted file mode 100644
    index 67f68a414..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc32_x86.S
    +++ /dev/null
    @@ -1,304 +0,0 @@
    -/*
    - * Speed-optimized CRC32 using slicing-by-eight algorithm
    - *
    - * This uses only i386 instructions, but it is optimized for i686 and later
    - * (including e.g. Pentium II/III/IV, Athlon XP, and Core 2). For i586
    - * (e.g. Pentium), slicing-by-four would be better, and even the C version
    - * of slicing-by-eight built with gcc -march=i586 tends to be a little bit
    - * better than this. Very few probably run this code on i586 or older x86
    - * so this shouldn't be a problem in practice.
    - *
    - * Authors: Igor Pavlov (original version)
    - *          Lasse Collin (AT&T syntax, PIC support, better portability)
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * This code needs lzma_crc32_table, which can be created using the
    - * following C code:
    -
    -uint32_t lzma_crc32_table[8][256];
    -
    -void
    -init_table(void)
    -{
    -	// IEEE-802.3
    -	static const uint32_t poly32 = UINT32_C(0xEDB88320);
    -
    -	// Castagnoli
    -	// static const uint32_t poly32 = UINT32_C(0x82F63B78);
    -
    -	// Koopman
    -	// static const uint32_t poly32 = UINT32_C(0xEB31D82E);
    -
    -	for (size_t s = 0; s < 8; ++s) {
    -		for (size_t b = 0; b < 256; ++b) {
    -			uint32_t r = s == 0 ? b : lzma_crc32_table[s - 1][b];
    -
    -			for (size_t i = 0; i < 8; ++i) {
    -				if (r & 1)
    -					r = (r >> 1) ^ poly32;
    -				else
    -					r >>= 1;
    -			}
    -
    -			lzma_crc32_table[s][b] = r;
    -		}
    -	}
    -}
    -
    - * The prototype of the CRC32 function:
    - * extern uint32_t lzma_crc32(const uint8_t *buf, size_t size, uint32_t crc);
    - */
    -
    -/*
    - * On some systems, the functions need to be prefixed. The prefix is
    - * usually an underscore.
    - */
    -#ifndef __USER_LABEL_PREFIX__
    -#	define __USER_LABEL_PREFIX__
    -#endif
    -#define MAKE_SYM_CAT(prefix, sym) prefix ## sym
    -#define MAKE_SYM(prefix, sym) MAKE_SYM_CAT(prefix, sym)
    -#define LZMA_CRC32 MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc32)
    -#define LZMA_CRC32_TABLE MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc32_table)
    -
    -/*
    - * Solaris assembler doesn't have .p2align, and Darwin uses .align
    - * differently than GNU/Linux and Solaris.
    - */
    -#if defined(__APPLE__) || defined(__MSDOS__)
    -#	define ALIGN(pow2, abs) .align pow2
    -#else
    -#	define ALIGN(pow2, abs) .align abs
    -#endif
    -
    -	.text
    -	.globl	LZMA_CRC32
    -
    -#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) \
    -		&& !defined(__MSDOS__)
    -	.type	LZMA_CRC32, @function
    -#endif
    -
    -	ALIGN(4, 16)
    -LZMA_CRC32:
    -	/*
    -	 * Register usage:
    -	 * %eax crc
    -	 * %esi buf
    -	 * %edi size or buf + size
    -	 * %ebx lzma_crc32_table
    -	 * %ebp Table index
    -	 * %ecx Temporary
    -	 * %edx Temporary
    -	 */
    -	pushl	%ebx
    -	pushl	%esi
    -	pushl	%edi
    -	pushl	%ebp
    -	movl	0x14(%esp), %esi /* buf */
    -	movl	0x18(%esp), %edi /* size */
    -	movl	0x1C(%esp), %eax /* crc */
    -
    -	/*
    -	 * Store the address of lzma_crc32_table to %ebx. This is needed to
    -	 * get position-independent code (PIC).
    -	 *
    -	 * The PIC macro is defined by libtool, while __PIC__ is defined
    -	 * by GCC but only on some systems. Testing for both makes it simpler
    -	 * to test this code without libtool, and keeps the code working also
    -	 * when built with libtool but using something else than GCC.
    -	 *
    -	 * I understood that libtool may define PIC on Windows even though
    -	 * the code in Windows DLLs is not PIC in sense that it is in ELF
    -	 * binaries, so we need a separate check to always use the non-PIC
    -	 * code on Windows.
    -	 */
    -#if (!defined(PIC) && !defined(__PIC__)) \
    -		|| (defined(_WIN32) || defined(__CYGWIN__))
    -	/* Not PIC */
    -	movl	$ LZMA_CRC32_TABLE, %ebx
    -#elif defined(__APPLE__)
    -	/* Mach-O */
    -	call	.L_get_pc
    -.L_pic:
    -	leal	.L_lzma_crc32_table$non_lazy_ptr-.L_pic(%ebx), %ebx
    -	movl	(%ebx), %ebx
    -#else
    -	/* ELF */
    -	call	.L_get_pc
    -	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
    -	movl	LZMA_CRC32_TABLE@GOT(%ebx), %ebx
    -#endif
    -
    -	/* Complement the initial value. */
    -	notl	%eax
    -
    -	ALIGN(4, 16)
    -.L_align:
    -	/*
    -	 * Check if there is enough input to use slicing-by-eight.
    -	 * We need 16 bytes, because the loop pre-reads eight bytes.
    -	 */
    -	cmpl	$16, %edi
    -	jb	.L_rest
    -
    -	/* Check if we have reached alignment of eight bytes. */
    -	testl	$7, %esi
    -	jz	.L_slice
    -
    -	/* Calculate CRC of the next input byte. */
    -	movzbl	(%esi), %ebp
    -	incl	%esi
    -	movzbl	%al, %ecx
    -	xorl	%ecx, %ebp
    -	shrl	$8, %eax
    -	xorl	(%ebx, %ebp, 4), %eax
    -	decl	%edi
    -	jmp	.L_align
    -
    -	ALIGN(2, 4)
    -.L_slice:
    -	/*
    -	 * If we get here, there's at least 16 bytes of aligned input
    -	 * available. Make %edi multiple of eight bytes. Store the possible
    -	 * remainder over the "size" variable in the argument stack.
    -	 */
    -	movl	%edi, 0x18(%esp)
    -	andl	$-8, %edi
    -	subl	%edi, 0x18(%esp)
    -
    -	/*
    -	 * Let %edi be buf + size - 8 while running the main loop. This way
    -	 * we can compare for equality to determine when exit the loop.
    -	 */
    -	addl	%esi, %edi
    -	subl	$8, %edi
    -
    -	/* Read in the first eight aligned bytes. */
    -	xorl	(%esi), %eax
    -	movl	4(%esi), %ecx
    -	movzbl	%cl, %ebp
    -
    -.L_loop:
    -	movl	0x0C00(%ebx, %ebp, 4), %edx
    -	movzbl	%ch, %ebp
    -	xorl	0x0800(%ebx, %ebp, 4), %edx
    -	shrl	$16, %ecx
    -	xorl	8(%esi), %edx
    -	movzbl	%cl, %ebp
    -	xorl	0x0400(%ebx, %ebp, 4), %edx
    -	movzbl	%ch, %ebp
    -	xorl	(%ebx, %ebp, 4), %edx
    -	movzbl	%al, %ebp
    -
    -	/*
    -	 * Read the next four bytes, for which the CRC is calculated
    -	 * on the next interation of the loop.
    -	 */
    -	movl	12(%esi), %ecx
    -
    -	xorl	0x1C00(%ebx, %ebp, 4), %edx
    -	movzbl	%ah, %ebp
    -	shrl	$16, %eax
    -	xorl	0x1800(%ebx, %ebp, 4), %edx
    -	movzbl	%ah, %ebp
    -	movzbl	%al, %eax
    -	movl	0x1400(%ebx, %eax, 4), %eax
    -	addl	$8, %esi
    -	xorl	%edx, %eax
    -	xorl	0x1000(%ebx, %ebp, 4), %eax
    -
    -	/* Check for end of aligned input. */
    -	cmpl	%edi, %esi
    -	movzbl	%cl, %ebp
    -	jne	.L_loop
    -
    -	/*
    -	 * Process the remaining eight bytes, which we have already
    -	 * copied to %ecx and %edx.
    -	 */
    -	movl	0x0C00(%ebx, %ebp, 4), %edx
    -	movzbl	%ch, %ebp
    -	xorl	0x0800(%ebx, %ebp, 4), %edx
    -	shrl	$16, %ecx
    -	movzbl	%cl, %ebp
    -	xorl	0x0400(%ebx, %ebp, 4), %edx
    -	movzbl	%ch, %ebp
    -	xorl	(%ebx, %ebp, 4), %edx
    -	movzbl	%al, %ebp
    -
    -	xorl	0x1C00(%ebx, %ebp, 4), %edx
    -	movzbl	%ah, %ebp
    -	shrl	$16, %eax
    -	xorl	0x1800(%ebx, %ebp, 4), %edx
    -	movzbl	%ah, %ebp
    -	movzbl	%al, %eax
    -	movl	0x1400(%ebx, %eax, 4), %eax
    -	addl	$8, %esi
    -	xorl	%edx, %eax
    -	xorl	0x1000(%ebx, %ebp, 4), %eax
    -
    -	/* Copy the number of remaining bytes to %edi. */
    -	movl	0x18(%esp), %edi
    -
    -.L_rest:
    -	/* Check for end of input. */
    -	testl	%edi, %edi
    -	jz	.L_return
    -
    -	/* Calculate CRC of the next input byte. */
    -	movzbl	(%esi), %ebp
    -	incl	%esi
    -	movzbl	%al, %ecx
    -	xorl	%ecx, %ebp
    -	shrl	$8, %eax
    -	xorl	(%ebx, %ebp, 4), %eax
    -	decl	%edi
    -	jmp	.L_rest
    -
    -.L_return:
    -	/* Complement the final value. */
    -	notl	%eax
    -
    -	popl	%ebp
    -	popl	%edi
    -	popl	%esi
    -	popl	%ebx
    -	ret
    -
    -#if defined(PIC) || defined(__PIC__)
    -	ALIGN(4, 16)
    -.L_get_pc:
    -	movl	(%esp), %ebx
    -	ret
    -#endif
    -
    -#if defined(__APPLE__) && (defined(PIC) || defined(__PIC__))
    -	/* Mach-O PIC */
    -	.section __IMPORT,__pointers,non_lazy_symbol_pointers
    -.L_lzma_crc32_table$non_lazy_ptr:
    -	.indirect_symbol LZMA_CRC32_TABLE
    -	.long 0
    -
    -#elif defined(_WIN32) || defined(__CYGWIN__)
    -#	ifdef DLL_EXPORT
    -	/* This is equivalent of __declspec(dllexport). */
    -	.section .drectve
    -	.ascii " -export:lzma_crc32"
    -#	endif
    -
    -#elif !defined(__MSDOS__)
    -	/* ELF */
    -	.size	LZMA_CRC32, .-LZMA_CRC32
    -#endif
    -
    -/*
    - * This is needed to support non-executable stack. It's ugly to
    - * use __linux__ here, but I don't know a way to detect when
    - * we are using GNU assembler.
    - */
    -#if defined(__ELF__) && defined(__linux__)
    -	.section	.note.GNU-stack,"",@progbits
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc64_fast.c b/external/public-domain/xz/dist/src/liblzma/check/crc64_fast.c
    deleted file mode 100644
    index 52af29ed4..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc64_fast.c
    +++ /dev/null
    @@ -1,72 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc64.c
    -/// \brief      CRC64 calculation
    -///
    -/// Calculate the CRC64 using the slice-by-four algorithm. This is the same
    -/// idea that is used in crc32_fast.c, but for CRC64 we use only four tables
    -/// instead of eight to avoid increasing CPU cache usage.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "check.h"
    -#include "crc_macros.h"
    -
    -
    -#ifdef WORDS_BIGENDIAN
    -#	define A1(x) ((x) >> 56)
    -#else
    -#	define A1 A
    -#endif
    -
    -
    -// See the comments in crc32_fast.c. They aren't duplicated here.
    -extern LZMA_API(uint64_t)
    -lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
    -{
    -	crc = ~crc;
    -
    -#ifdef WORDS_BIGENDIAN
    -	crc = bswap64(crc);
    -#endif
    -
    -	if (size > 4) {
    -		while ((uintptr_t)(buf) & 3) {
    -			crc = lzma_crc64_table[0][*buf++ ^ A1(crc)] ^ S8(crc);
    -			--size;
    -		}
    -
    -		const uint8_t *const limit = buf + (size & ~(size_t)(3));
    -		size &= (size_t)(3);
    -
    -		while (buf < limit) {
    -#ifdef WORDS_BIGENDIAN
    -			const uint32_t tmp = (crc >> 32)
    -					^ *(const uint32_t *)(buf);
    -#else
    -			const uint32_t tmp = crc ^ *(const uint32_t *)(buf);
    -#endif
    -			buf += 4;
    -
    -			crc = lzma_crc64_table[3][A(tmp)]
    -			    ^ lzma_crc64_table[2][B(tmp)]
    -			    ^ S32(crc)
    -			    ^ lzma_crc64_table[1][C(tmp)]
    -			    ^ lzma_crc64_table[0][D(tmp)];
    -		}
    -	}
    -
    -	while (size-- != 0)
    -		crc = lzma_crc64_table[0][*buf++ ^ A1(crc)] ^ S8(crc);
    -
    -#ifdef WORDS_BIGENDIAN
    -	crc = bswap64(crc);
    -#endif
    -
    -	return ~crc;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc64_small.c b/external/public-domain/xz/dist/src/liblzma/check/crc64_small.c
    deleted file mode 100644
    index 55d72316b..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc64_small.c
    +++ /dev/null
    @@ -1,53 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc64_small.c
    -/// \brief      CRC64 calculation (size-optimized)
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "check.h"
    -
    -
    -static uint64_t crc64_table[256];
    -
    -
    -static void
    -crc64_init(void)
    -{
    -	static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42);
    -
    -	for (size_t b = 0; b < 256; ++b) {
    -		uint64_t r = b;
    -		for (size_t i = 0; i < 8; ++i) {
    -			if (r & 1)
    -				r = (r >> 1) ^ poly64;
    -			else
    -				r >>= 1;
    -		}
    -
    -		crc64_table[b] = r;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
    -{
    -	mythread_once(crc64_init);
    -
    -	crc = ~crc;
    -
    -	while (size != 0) {
    -		crc = crc64_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);
    -		--size;
    -	}
    -
    -	return ~crc;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc64_table.c b/external/public-domain/xz/dist/src/liblzma/check/crc64_table.c
    deleted file mode 100644
    index 1fbcd9470..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc64_table.c
    +++ /dev/null
    @@ -1,19 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc64_table.c
    -/// \brief      Precalculated CRC64 table with correct endianness
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -#ifdef WORDS_BIGENDIAN
    -#	include "crc64_table_be.h"
    -#else
    -#	include "crc64_table_le.h"
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc64_table_be.h b/external/public-domain/xz/dist/src/liblzma/check/crc64_table_be.h
    deleted file mode 100644
    index ea074f397..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc64_table_be.h
    +++ /dev/null
    @@ -1,521 +0,0 @@
    -/* This file has been automatically generated by crc64_tablegen.c. */
    -
    -const uint64_t lzma_crc64_table[4][256] = {
    -	{
    -		UINT64_C(0x0000000000000000), UINT64_C(0x6F5FA703BE4C2EB3),
    -		UINT64_C(0x5BA040A8573684F4), UINT64_C(0x34FFE7ABE97AAA47),
    -		UINT64_C(0x335E8FFF84C3D07B), UINT64_C(0x5C0128FC3A8FFEC8),
    -		UINT64_C(0x68FECF57D3F5548F), UINT64_C(0x07A168546DB97A3C),
    -		UINT64_C(0x66BC1EFF0987A1F7), UINT64_C(0x09E3B9FCB7CB8F44),
    -		UINT64_C(0x3D1C5E575EB12503), UINT64_C(0x5243F954E0FD0BB0),
    -		UINT64_C(0x55E291008D44718C), UINT64_C(0x3ABD360333085F3F),
    -		UINT64_C(0x0E42D1A8DA72F578), UINT64_C(0x611D76AB643EDBCB),
    -		UINT64_C(0x4966335138A19B7D), UINT64_C(0x2639945286EDB5CE),
    -		UINT64_C(0x12C673F96F971F89), UINT64_C(0x7D99D4FAD1DB313A),
    -		UINT64_C(0x7A38BCAEBC624B06), UINT64_C(0x15671BAD022E65B5),
    -		UINT64_C(0x2198FC06EB54CFF2), UINT64_C(0x4EC75B055518E141),
    -		UINT64_C(0x2FDA2DAE31263A8A), UINT64_C(0x40858AAD8F6A1439),
    -		UINT64_C(0x747A6D066610BE7E), UINT64_C(0x1B25CA05D85C90CD),
    -		UINT64_C(0x1C84A251B5E5EAF1), UINT64_C(0x73DB05520BA9C442),
    -		UINT64_C(0x4724E2F9E2D36E05), UINT64_C(0x287B45FA5C9F40B6),
    -		UINT64_C(0x92CC66A2704237FB), UINT64_C(0xFD93C1A1CE0E1948),
    -		UINT64_C(0xC96C260A2774B30F), UINT64_C(0xA633810999389DBC),
    -		UINT64_C(0xA192E95DF481E780), UINT64_C(0xCECD4E5E4ACDC933),
    -		UINT64_C(0xFA32A9F5A3B76374), UINT64_C(0x956D0EF61DFB4DC7),
    -		UINT64_C(0xF470785D79C5960C), UINT64_C(0x9B2FDF5EC789B8BF),
    -		UINT64_C(0xAFD038F52EF312F8), UINT64_C(0xC08F9FF690BF3C4B),
    -		UINT64_C(0xC72EF7A2FD064677), UINT64_C(0xA87150A1434A68C4),
    -		UINT64_C(0x9C8EB70AAA30C283), UINT64_C(0xF3D11009147CEC30),
    -		UINT64_C(0xDBAA55F348E3AC86), UINT64_C(0xB4F5F2F0F6AF8235),
    -		UINT64_C(0x800A155B1FD52872), UINT64_C(0xEF55B258A19906C1),
    -		UINT64_C(0xE8F4DA0CCC207CFD), UINT64_C(0x87AB7D0F726C524E),
    -		UINT64_C(0xB3549AA49B16F809), UINT64_C(0xDC0B3DA7255AD6BA),
    -		UINT64_C(0xBD164B0C41640D71), UINT64_C(0xD249EC0FFF2823C2),
    -		UINT64_C(0xE6B60BA416528985), UINT64_C(0x89E9ACA7A81EA736),
    -		UINT64_C(0x8E48C4F3C5A7DD0A), UINT64_C(0xE11763F07BEBF3B9),
    -		UINT64_C(0xD5E8845B929159FE), UINT64_C(0xBAB723582CDD774D),
    -		UINT64_C(0xA187C3EBCA2BB664), UINT64_C(0xCED864E8746798D7),
    -		UINT64_C(0xFA2783439D1D3290), UINT64_C(0x9578244023511C23),
    -		UINT64_C(0x92D94C144EE8661F), UINT64_C(0xFD86EB17F0A448AC),
    -		UINT64_C(0xC9790CBC19DEE2EB), UINT64_C(0xA626ABBFA792CC58),
    -		UINT64_C(0xC73BDD14C3AC1793), UINT64_C(0xA8647A177DE03920),
    -		UINT64_C(0x9C9B9DBC949A9367), UINT64_C(0xF3C43ABF2AD6BDD4),
    -		UINT64_C(0xF46552EB476FC7E8), UINT64_C(0x9B3AF5E8F923E95B),
    -		UINT64_C(0xAFC512431059431C), UINT64_C(0xC09AB540AE156DAF),
    -		UINT64_C(0xE8E1F0BAF28A2D19), UINT64_C(0x87BE57B94CC603AA),
    -		UINT64_C(0xB341B012A5BCA9ED), UINT64_C(0xDC1E17111BF0875E),
    -		UINT64_C(0xDBBF7F457649FD62), UINT64_C(0xB4E0D846C805D3D1),
    -		UINT64_C(0x801F3FED217F7996), UINT64_C(0xEF4098EE9F335725),
    -		UINT64_C(0x8E5DEE45FB0D8CEE), UINT64_C(0xE10249464541A25D),
    -		UINT64_C(0xD5FDAEEDAC3B081A), UINT64_C(0xBAA209EE127726A9),
    -		UINT64_C(0xBD0361BA7FCE5C95), UINT64_C(0xD25CC6B9C1827226),
    -		UINT64_C(0xE6A3211228F8D861), UINT64_C(0x89FC861196B4F6D2),
    -		UINT64_C(0x334BA549BA69819F), UINT64_C(0x5C14024A0425AF2C),
    -		UINT64_C(0x68EBE5E1ED5F056B), UINT64_C(0x07B442E253132BD8),
    -		UINT64_C(0x00152AB63EAA51E4), UINT64_C(0x6F4A8DB580E67F57),
    -		UINT64_C(0x5BB56A1E699CD510), UINT64_C(0x34EACD1DD7D0FBA3),
    -		UINT64_C(0x55F7BBB6B3EE2068), UINT64_C(0x3AA81CB50DA20EDB),
    -		UINT64_C(0x0E57FB1EE4D8A49C), UINT64_C(0x61085C1D5A948A2F),
    -		UINT64_C(0x66A93449372DF013), UINT64_C(0x09F6934A8961DEA0),
    -		UINT64_C(0x3D0974E1601B74E7), UINT64_C(0x5256D3E2DE575A54),
    -		UINT64_C(0x7A2D961882C81AE2), UINT64_C(0x1572311B3C843451),
    -		UINT64_C(0x218DD6B0D5FE9E16), UINT64_C(0x4ED271B36BB2B0A5),
    -		UINT64_C(0x497319E7060BCA99), UINT64_C(0x262CBEE4B847E42A),
    -		UINT64_C(0x12D3594F513D4E6D), UINT64_C(0x7D8CFE4CEF7160DE),
    -		UINT64_C(0x1C9188E78B4FBB15), UINT64_C(0x73CE2FE4350395A6),
    -		UINT64_C(0x4731C84FDC793FE1), UINT64_C(0x286E6F4C62351152),
    -		UINT64_C(0x2FCF07180F8C6B6E), UINT64_C(0x4090A01BB1C045DD),
    -		UINT64_C(0x746F47B058BAEF9A), UINT64_C(0x1B30E0B3E6F6C129),
    -		UINT64_C(0x420F87D795576CC9), UINT64_C(0x2D5020D42B1B427A),
    -		UINT64_C(0x19AFC77FC261E83D), UINT64_C(0x76F0607C7C2DC68E),
    -		UINT64_C(0x715108281194BCB2), UINT64_C(0x1E0EAF2BAFD89201),
    -		UINT64_C(0x2AF1488046A23846), UINT64_C(0x45AEEF83F8EE16F5),
    -		UINT64_C(0x24B399289CD0CD3E), UINT64_C(0x4BEC3E2B229CE38D),
    -		UINT64_C(0x7F13D980CBE649CA), UINT64_C(0x104C7E8375AA6779),
    -		UINT64_C(0x17ED16D718131D45), UINT64_C(0x78B2B1D4A65F33F6),
    -		UINT64_C(0x4C4D567F4F2599B1), UINT64_C(0x2312F17CF169B702),
    -		UINT64_C(0x0B69B486ADF6F7B4), UINT64_C(0x6436138513BAD907),
    -		UINT64_C(0x50C9F42EFAC07340), UINT64_C(0x3F96532D448C5DF3),
    -		UINT64_C(0x38373B79293527CF), UINT64_C(0x57689C7A9779097C),
    -		UINT64_C(0x63977BD17E03A33B), UINT64_C(0x0CC8DCD2C04F8D88),
    -		UINT64_C(0x6DD5AA79A4715643), UINT64_C(0x028A0D7A1A3D78F0),
    -		UINT64_C(0x3675EAD1F347D2B7), UINT64_C(0x592A4DD24D0BFC04),
    -		UINT64_C(0x5E8B258620B28638), UINT64_C(0x31D482859EFEA88B),
    -		UINT64_C(0x052B652E778402CC), UINT64_C(0x6A74C22DC9C82C7F),
    -		UINT64_C(0xD0C3E175E5155B32), UINT64_C(0xBF9C46765B597581),
    -		UINT64_C(0x8B63A1DDB223DFC6), UINT64_C(0xE43C06DE0C6FF175),
    -		UINT64_C(0xE39D6E8A61D68B49), UINT64_C(0x8CC2C989DF9AA5FA),
    -		UINT64_C(0xB83D2E2236E00FBD), UINT64_C(0xD762892188AC210E),
    -		UINT64_C(0xB67FFF8AEC92FAC5), UINT64_C(0xD920588952DED476),
    -		UINT64_C(0xEDDFBF22BBA47E31), UINT64_C(0x8280182105E85082),
    -		UINT64_C(0x8521707568512ABE), UINT64_C(0xEA7ED776D61D040D),
    -		UINT64_C(0xDE8130DD3F67AE4A), UINT64_C(0xB1DE97DE812B80F9),
    -		UINT64_C(0x99A5D224DDB4C04F), UINT64_C(0xF6FA752763F8EEFC),
    -		UINT64_C(0xC205928C8A8244BB), UINT64_C(0xAD5A358F34CE6A08),
    -		UINT64_C(0xAAFB5DDB59771034), UINT64_C(0xC5A4FAD8E73B3E87),
    -		UINT64_C(0xF15B1D730E4194C0), UINT64_C(0x9E04BA70B00DBA73),
    -		UINT64_C(0xFF19CCDBD43361B8), UINT64_C(0x90466BD86A7F4F0B),
    -		UINT64_C(0xA4B98C738305E54C), UINT64_C(0xCBE62B703D49CBFF),
    -		UINT64_C(0xCC47432450F0B1C3), UINT64_C(0xA318E427EEBC9F70),
    -		UINT64_C(0x97E7038C07C63537), UINT64_C(0xF8B8A48FB98A1B84),
    -		UINT64_C(0xE388443C5F7CDAAD), UINT64_C(0x8CD7E33FE130F41E),
    -		UINT64_C(0xB8280494084A5E59), UINT64_C(0xD777A397B60670EA),
    -		UINT64_C(0xD0D6CBC3DBBF0AD6), UINT64_C(0xBF896CC065F32465),
    -		UINT64_C(0x8B768B6B8C898E22), UINT64_C(0xE4292C6832C5A091),
    -		UINT64_C(0x85345AC356FB7B5A), UINT64_C(0xEA6BFDC0E8B755E9),
    -		UINT64_C(0xDE941A6B01CDFFAE), UINT64_C(0xB1CBBD68BF81D11D),
    -		UINT64_C(0xB66AD53CD238AB21), UINT64_C(0xD935723F6C748592),
    -		UINT64_C(0xEDCA9594850E2FD5), UINT64_C(0x829532973B420166),
    -		UINT64_C(0xAAEE776D67DD41D0), UINT64_C(0xC5B1D06ED9916F63),
    -		UINT64_C(0xF14E37C530EBC524), UINT64_C(0x9E1190C68EA7EB97),
    -		UINT64_C(0x99B0F892E31E91AB), UINT64_C(0xF6EF5F915D52BF18),
    -		UINT64_C(0xC210B83AB428155F), UINT64_C(0xAD4F1F390A643BEC),
    -		UINT64_C(0xCC5269926E5AE027), UINT64_C(0xA30DCE91D016CE94),
    -		UINT64_C(0x97F2293A396C64D3), UINT64_C(0xF8AD8E3987204A60),
    -		UINT64_C(0xFF0CE66DEA99305C), UINT64_C(0x9053416E54D51EEF),
    -		UINT64_C(0xA4ACA6C5BDAFB4A8), UINT64_C(0xCBF301C603E39A1B),
    -		UINT64_C(0x7144229E2F3EED56), UINT64_C(0x1E1B859D9172C3E5),
    -		UINT64_C(0x2AE46236780869A2), UINT64_C(0x45BBC535C6444711),
    -		UINT64_C(0x421AAD61ABFD3D2D), UINT64_C(0x2D450A6215B1139E),
    -		UINT64_C(0x19BAEDC9FCCBB9D9), UINT64_C(0x76E54ACA4287976A),
    -		UINT64_C(0x17F83C6126B94CA1), UINT64_C(0x78A79B6298F56212),
    -		UINT64_C(0x4C587CC9718FC855), UINT64_C(0x2307DBCACFC3E6E6),
    -		UINT64_C(0x24A6B39EA27A9CDA), UINT64_C(0x4BF9149D1C36B269),
    -		UINT64_C(0x7F06F336F54C182E), UINT64_C(0x105954354B00369D),
    -		UINT64_C(0x382211CF179F762B), UINT64_C(0x577DB6CCA9D35898),
    -		UINT64_C(0x6382516740A9F2DF), UINT64_C(0x0CDDF664FEE5DC6C),
    -		UINT64_C(0x0B7C9E30935CA650), UINT64_C(0x642339332D1088E3),
    -		UINT64_C(0x50DCDE98C46A22A4), UINT64_C(0x3F83799B7A260C17),
    -		UINT64_C(0x5E9E0F301E18D7DC), UINT64_C(0x31C1A833A054F96F),
    -		UINT64_C(0x053E4F98492E5328), UINT64_C(0x6A61E89BF7627D9B),
    -		UINT64_C(0x6DC080CF9ADB07A7), UINT64_C(0x029F27CC24972914),
    -		UINT64_C(0x3660C067CDED8353), UINT64_C(0x593F676473A1ADE0)
    -	}, {
    -		UINT64_C(0x0000000000000000), UINT64_C(0x0DF1D05C9279E954),
    -		UINT64_C(0x1AE2A1B924F3D2A9), UINT64_C(0x171371E5B68A3BFD),
    -		UINT64_C(0xB1DA4DDC62497DC1), UINT64_C(0xBC2B9D80F0309495),
    -		UINT64_C(0xAB38EC6546BAAF68), UINT64_C(0xA6C93C39D4C3463C),
    -		UINT64_C(0xE7AB9517EE3D2210), UINT64_C(0xEA5A454B7C44CB44),
    -		UINT64_C(0xFD4934AECACEF0B9), UINT64_C(0xF0B8E4F258B719ED),
    -		UINT64_C(0x5671D8CB8C745FD1), UINT64_C(0x5B8008971E0DB685),
    -		UINT64_C(0x4C937972A8878D78), UINT64_C(0x4162A92E3AFE642C),
    -		UINT64_C(0xCE572B2FDC7B4420), UINT64_C(0xC3A6FB734E02AD74),
    -		UINT64_C(0xD4B58A96F8889689), UINT64_C(0xD9445ACA6AF17FDD),
    -		UINT64_C(0x7F8D66F3BE3239E1), UINT64_C(0x727CB6AF2C4BD0B5),
    -		UINT64_C(0x656FC74A9AC1EB48), UINT64_C(0x689E171608B8021C),
    -		UINT64_C(0x29FCBE3832466630), UINT64_C(0x240D6E64A03F8F64),
    -		UINT64_C(0x331E1F8116B5B499), UINT64_C(0x3EEFCFDD84CC5DCD),
    -		UINT64_C(0x9826F3E4500F1BF1), UINT64_C(0x95D723B8C276F2A5),
    -		UINT64_C(0x82C4525D74FCC958), UINT64_C(0x8F358201E685200C),
    -		UINT64_C(0x9CAF565EB8F78840), UINT64_C(0x915E86022A8E6114),
    -		UINT64_C(0x864DF7E79C045AE9), UINT64_C(0x8BBC27BB0E7DB3BD),
    -		UINT64_C(0x2D751B82DABEF581), UINT64_C(0x2084CBDE48C71CD5),
    -		UINT64_C(0x3797BA3BFE4D2728), UINT64_C(0x3A666A676C34CE7C),
    -		UINT64_C(0x7B04C34956CAAA50), UINT64_C(0x76F51315C4B34304),
    -		UINT64_C(0x61E662F0723978F9), UINT64_C(0x6C17B2ACE04091AD),
    -		UINT64_C(0xCADE8E953483D791), UINT64_C(0xC72F5EC9A6FA3EC5),
    -		UINT64_C(0xD03C2F2C10700538), UINT64_C(0xDDCDFF708209EC6C),
    -		UINT64_C(0x52F87D71648CCC60), UINT64_C(0x5F09AD2DF6F52534),
    -		UINT64_C(0x481ADCC8407F1EC9), UINT64_C(0x45EB0C94D206F79D),
    -		UINT64_C(0xE32230AD06C5B1A1), UINT64_C(0xEED3E0F194BC58F5),
    -		UINT64_C(0xF9C0911422366308), UINT64_C(0xF4314148B04F8A5C),
    -		UINT64_C(0xB553E8668AB1EE70), UINT64_C(0xB8A2383A18C80724),
    -		UINT64_C(0xAFB149DFAE423CD9), UINT64_C(0xA24099833C3BD58D),
    -		UINT64_C(0x0489A5BAE8F893B1), UINT64_C(0x097875E67A817AE5),
    -		UINT64_C(0x1E6B0403CC0B4118), UINT64_C(0x139AD45F5E72A84C),
    -		UINT64_C(0x385FADBC70EF1181), UINT64_C(0x35AE7DE0E296F8D5),
    -		UINT64_C(0x22BD0C05541CC328), UINT64_C(0x2F4CDC59C6652A7C),
    -		UINT64_C(0x8985E06012A66C40), UINT64_C(0x8474303C80DF8514),
    -		UINT64_C(0x936741D93655BEE9), UINT64_C(0x9E969185A42C57BD),
    -		UINT64_C(0xDFF438AB9ED23391), UINT64_C(0xD205E8F70CABDAC5),
    -		UINT64_C(0xC5169912BA21E138), UINT64_C(0xC8E7494E2858086C),
    -		UINT64_C(0x6E2E7577FC9B4E50), UINT64_C(0x63DFA52B6EE2A704),
    -		UINT64_C(0x74CCD4CED8689CF9), UINT64_C(0x793D04924A1175AD),
    -		UINT64_C(0xF6088693AC9455A1), UINT64_C(0xFBF956CF3EEDBCF5),
    -		UINT64_C(0xECEA272A88678708), UINT64_C(0xE11BF7761A1E6E5C),
    -		UINT64_C(0x47D2CB4FCEDD2860), UINT64_C(0x4A231B135CA4C134),
    -		UINT64_C(0x5D306AF6EA2EFAC9), UINT64_C(0x50C1BAAA7857139D),
    -		UINT64_C(0x11A3138442A977B1), UINT64_C(0x1C52C3D8D0D09EE5),
    -		UINT64_C(0x0B41B23D665AA518), UINT64_C(0x06B06261F4234C4C),
    -		UINT64_C(0xA0795E5820E00A70), UINT64_C(0xAD888E04B299E324),
    -		UINT64_C(0xBA9BFFE10413D8D9), UINT64_C(0xB76A2FBD966A318D),
    -		UINT64_C(0xA4F0FBE2C81899C1), UINT64_C(0xA9012BBE5A617095),
    -		UINT64_C(0xBE125A5BECEB4B68), UINT64_C(0xB3E38A077E92A23C),
    -		UINT64_C(0x152AB63EAA51E400), UINT64_C(0x18DB666238280D54),
    -		UINT64_C(0x0FC817878EA236A9), UINT64_C(0x0239C7DB1CDBDFFD),
    -		UINT64_C(0x435B6EF52625BBD1), UINT64_C(0x4EAABEA9B45C5285),
    -		UINT64_C(0x59B9CF4C02D66978), UINT64_C(0x54481F1090AF802C),
    -		UINT64_C(0xF2812329446CC610), UINT64_C(0xFF70F375D6152F44),
    -		UINT64_C(0xE8638290609F14B9), UINT64_C(0xE59252CCF2E6FDED),
    -		UINT64_C(0x6AA7D0CD1463DDE1), UINT64_C(0x67560091861A34B5),
    -		UINT64_C(0x7045717430900F48), UINT64_C(0x7DB4A128A2E9E61C),
    -		UINT64_C(0xDB7D9D11762AA020), UINT64_C(0xD68C4D4DE4534974),
    -		UINT64_C(0xC19F3CA852D97289), UINT64_C(0xCC6EECF4C0A09BDD),
    -		UINT64_C(0x8D0C45DAFA5EFFF1), UINT64_C(0x80FD9586682716A5),
    -		UINT64_C(0x97EEE463DEAD2D58), UINT64_C(0x9A1F343F4CD4C40C),
    -		UINT64_C(0x3CD6080698178230), UINT64_C(0x3127D85A0A6E6B64),
    -		UINT64_C(0x2634A9BFBCE45099), UINT64_C(0x2BC579E32E9DB9CD),
    -		UINT64_C(0xF5A054D6CA71FB90), UINT64_C(0xF851848A580812C4),
    -		UINT64_C(0xEF42F56FEE822939), UINT64_C(0xE2B325337CFBC06D),
    -		UINT64_C(0x447A190AA8388651), UINT64_C(0x498BC9563A416F05),
    -		UINT64_C(0x5E98B8B38CCB54F8), UINT64_C(0x536968EF1EB2BDAC),
    -		UINT64_C(0x120BC1C1244CD980), UINT64_C(0x1FFA119DB63530D4),
    -		UINT64_C(0x08E9607800BF0B29), UINT64_C(0x0518B02492C6E27D),
    -		UINT64_C(0xA3D18C1D4605A441), UINT64_C(0xAE205C41D47C4D15),
    -		UINT64_C(0xB9332DA462F676E8), UINT64_C(0xB4C2FDF8F08F9FBC),
    -		UINT64_C(0x3BF77FF9160ABFB0), UINT64_C(0x3606AFA5847356E4),
    -		UINT64_C(0x2115DE4032F96D19), UINT64_C(0x2CE40E1CA080844D),
    -		UINT64_C(0x8A2D32257443C271), UINT64_C(0x87DCE279E63A2B25),
    -		UINT64_C(0x90CF939C50B010D8), UINT64_C(0x9D3E43C0C2C9F98C),
    -		UINT64_C(0xDC5CEAEEF8379DA0), UINT64_C(0xD1AD3AB26A4E74F4),
    -		UINT64_C(0xC6BE4B57DCC44F09), UINT64_C(0xCB4F9B0B4EBDA65D),
    -		UINT64_C(0x6D86A7329A7EE061), UINT64_C(0x6077776E08070935),
    -		UINT64_C(0x7764068BBE8D32C8), UINT64_C(0x7A95D6D72CF4DB9C),
    -		UINT64_C(0x690F0288728673D0), UINT64_C(0x64FED2D4E0FF9A84),
    -		UINT64_C(0x73EDA3315675A179), UINT64_C(0x7E1C736DC40C482D),
    -		UINT64_C(0xD8D54F5410CF0E11), UINT64_C(0xD5249F0882B6E745),
    -		UINT64_C(0xC237EEED343CDCB8), UINT64_C(0xCFC63EB1A64535EC),
    -		UINT64_C(0x8EA4979F9CBB51C0), UINT64_C(0x835547C30EC2B894),
    -		UINT64_C(0x94463626B8488369), UINT64_C(0x99B7E67A2A316A3D),
    -		UINT64_C(0x3F7EDA43FEF22C01), UINT64_C(0x328F0A1F6C8BC555),
    -		UINT64_C(0x259C7BFADA01FEA8), UINT64_C(0x286DABA6487817FC),
    -		UINT64_C(0xA75829A7AEFD37F0), UINT64_C(0xAAA9F9FB3C84DEA4),
    -		UINT64_C(0xBDBA881E8A0EE559), UINT64_C(0xB04B584218770C0D),
    -		UINT64_C(0x1682647BCCB44A31), UINT64_C(0x1B73B4275ECDA365),
    -		UINT64_C(0x0C60C5C2E8479898), UINT64_C(0x0191159E7A3E71CC),
    -		UINT64_C(0x40F3BCB040C015E0), UINT64_C(0x4D026CECD2B9FCB4),
    -		UINT64_C(0x5A111D096433C749), UINT64_C(0x57E0CD55F64A2E1D),
    -		UINT64_C(0xF129F16C22896821), UINT64_C(0xFCD82130B0F08175),
    -		UINT64_C(0xEBCB50D5067ABA88), UINT64_C(0xE63A8089940353DC),
    -		UINT64_C(0xCDFFF96ABA9EEA11), UINT64_C(0xC00E293628E70345),
    -		UINT64_C(0xD71D58D39E6D38B8), UINT64_C(0xDAEC888F0C14D1EC),
    -		UINT64_C(0x7C25B4B6D8D797D0), UINT64_C(0x71D464EA4AAE7E84),
    -		UINT64_C(0x66C7150FFC244579), UINT64_C(0x6B36C5536E5DAC2D),
    -		UINT64_C(0x2A546C7D54A3C801), UINT64_C(0x27A5BC21C6DA2155),
    -		UINT64_C(0x30B6CDC470501AA8), UINT64_C(0x3D471D98E229F3FC),
    -		UINT64_C(0x9B8E21A136EAB5C0), UINT64_C(0x967FF1FDA4935C94),
    -		UINT64_C(0x816C801812196769), UINT64_C(0x8C9D504480608E3D),
    -		UINT64_C(0x03A8D24566E5AE31), UINT64_C(0x0E590219F49C4765),
    -		UINT64_C(0x194A73FC42167C98), UINT64_C(0x14BBA3A0D06F95CC),
    -		UINT64_C(0xB2729F9904ACD3F0), UINT64_C(0xBF834FC596D53AA4),
    -		UINT64_C(0xA8903E20205F0159), UINT64_C(0xA561EE7CB226E80D),
    -		UINT64_C(0xE403475288D88C21), UINT64_C(0xE9F2970E1AA16575),
    -		UINT64_C(0xFEE1E6EBAC2B5E88), UINT64_C(0xF31036B73E52B7DC),
    -		UINT64_C(0x55D90A8EEA91F1E0), UINT64_C(0x5828DAD278E818B4),
    -		UINT64_C(0x4F3BAB37CE622349), UINT64_C(0x42CA7B6B5C1BCA1D),
    -		UINT64_C(0x5150AF3402696251), UINT64_C(0x5CA17F6890108B05),
    -		UINT64_C(0x4BB20E8D269AB0F8), UINT64_C(0x4643DED1B4E359AC),
    -		UINT64_C(0xE08AE2E860201F90), UINT64_C(0xED7B32B4F259F6C4),
    -		UINT64_C(0xFA68435144D3CD39), UINT64_C(0xF799930DD6AA246D),
    -		UINT64_C(0xB6FB3A23EC544041), UINT64_C(0xBB0AEA7F7E2DA915),
    -		UINT64_C(0xAC199B9AC8A792E8), UINT64_C(0xA1E84BC65ADE7BBC),
    -		UINT64_C(0x072177FF8E1D3D80), UINT64_C(0x0AD0A7A31C64D4D4),
    -		UINT64_C(0x1DC3D646AAEEEF29), UINT64_C(0x1032061A3897067D),
    -		UINT64_C(0x9F07841BDE122671), UINT64_C(0x92F654474C6BCF25),
    -		UINT64_C(0x85E525A2FAE1F4D8), UINT64_C(0x8814F5FE68981D8C),
    -		UINT64_C(0x2EDDC9C7BC5B5BB0), UINT64_C(0x232C199B2E22B2E4),
    -		UINT64_C(0x343F687E98A88919), UINT64_C(0x39CEB8220AD1604D),
    -		UINT64_C(0x78AC110C302F0461), UINT64_C(0x755DC150A256ED35),
    -		UINT64_C(0x624EB0B514DCD6C8), UINT64_C(0x6FBF60E986A53F9C),
    -		UINT64_C(0xC9765CD0526679A0), UINT64_C(0xC4878C8CC01F90F4),
    -		UINT64_C(0xD394FD697695AB09), UINT64_C(0xDE652D35E4EC425D)
    -	}, {
    -		UINT64_C(0x0000000000000000), UINT64_C(0xCB6D6A914AE10B3F),
    -		UINT64_C(0x96DBD42295C2177E), UINT64_C(0x5DB6BEB3DF231C41),
    -		UINT64_C(0x2CB7A9452A852FFC), UINT64_C(0xE7DAC3D4606424C3),
    -		UINT64_C(0xBA6C7D67BF473882), UINT64_C(0x710117F6F5A633BD),
    -		UINT64_C(0xDD705D247FA5876A), UINT64_C(0x161D37B535448C55),
    -		UINT64_C(0x4BAB8906EA679014), UINT64_C(0x80C6E397A0869B2B),
    -		UINT64_C(0xF1C7F4615520A896), UINT64_C(0x3AAA9EF01FC1A3A9),
    -		UINT64_C(0x671C2043C0E2BFE8), UINT64_C(0xAC714AD28A03B4D7),
    -		UINT64_C(0xBAE1BA48FE4A0FD5), UINT64_C(0x718CD0D9B4AB04EA),
    -		UINT64_C(0x2C3A6E6A6B8818AB), UINT64_C(0xE75704FB21691394),
    -		UINT64_C(0x9656130DD4CF2029), UINT64_C(0x5D3B799C9E2E2B16),
    -		UINT64_C(0x008DC72F410D3757), UINT64_C(0xCBE0ADBE0BEC3C68),
    -		UINT64_C(0x6791E76C81EF88BF), UINT64_C(0xACFC8DFDCB0E8380),
    -		UINT64_C(0xF14A334E142D9FC1), UINT64_C(0x3A2759DF5ECC94FE),
    -		UINT64_C(0x4B264E29AB6AA743), UINT64_C(0x804B24B8E18BAC7C),
    -		UINT64_C(0xDDFD9A0B3EA8B03D), UINT64_C(0x1690F09A7449BB02),
    -		UINT64_C(0xF1DD7B3ED73AC638), UINT64_C(0x3AB011AF9DDBCD07),
    -		UINT64_C(0x6706AF1C42F8D146), UINT64_C(0xAC6BC58D0819DA79),
    -		UINT64_C(0xDD6AD27BFDBFE9C4), UINT64_C(0x1607B8EAB75EE2FB),
    -		UINT64_C(0x4BB10659687DFEBA), UINT64_C(0x80DC6CC8229CF585),
    -		UINT64_C(0x2CAD261AA89F4152), UINT64_C(0xE7C04C8BE27E4A6D),
    -		UINT64_C(0xBA76F2383D5D562C), UINT64_C(0x711B98A977BC5D13),
    -		UINT64_C(0x001A8F5F821A6EAE), UINT64_C(0xCB77E5CEC8FB6591),
    -		UINT64_C(0x96C15B7D17D879D0), UINT64_C(0x5DAC31EC5D3972EF),
    -		UINT64_C(0x4B3CC1762970C9ED), UINT64_C(0x8051ABE76391C2D2),
    -		UINT64_C(0xDDE71554BCB2DE93), UINT64_C(0x168A7FC5F653D5AC),
    -		UINT64_C(0x678B683303F5E611), UINT64_C(0xACE602A24914ED2E),
    -		UINT64_C(0xF150BC119637F16F), UINT64_C(0x3A3DD680DCD6FA50),
    -		UINT64_C(0x964C9C5256D54E87), UINT64_C(0x5D21F6C31C3445B8),
    -		UINT64_C(0x00974870C31759F9), UINT64_C(0xCBFA22E189F652C6),
    -		UINT64_C(0xBAFB35177C50617B), UINT64_C(0x71965F8636B16A44),
    -		UINT64_C(0x2C20E135E9927605), UINT64_C(0xE74D8BA4A3737D3A),
    -		UINT64_C(0xE2BBF77CAE758C71), UINT64_C(0x29D69DEDE494874E),
    -		UINT64_C(0x7460235E3BB79B0F), UINT64_C(0xBF0D49CF71569030),
    -		UINT64_C(0xCE0C5E3984F0A38D), UINT64_C(0x056134A8CE11A8B2),
    -		UINT64_C(0x58D78A1B1132B4F3), UINT64_C(0x93BAE08A5BD3BFCC),
    -		UINT64_C(0x3FCBAA58D1D00B1B), UINT64_C(0xF4A6C0C99B310024),
    -		UINT64_C(0xA9107E7A44121C65), UINT64_C(0x627D14EB0EF3175A),
    -		UINT64_C(0x137C031DFB5524E7), UINT64_C(0xD811698CB1B42FD8),
    -		UINT64_C(0x85A7D73F6E973399), UINT64_C(0x4ECABDAE247638A6),
    -		UINT64_C(0x585A4D34503F83A4), UINT64_C(0x933727A51ADE889B),
    -		UINT64_C(0xCE819916C5FD94DA), UINT64_C(0x05ECF3878F1C9FE5),
    -		UINT64_C(0x74EDE4717ABAAC58), UINT64_C(0xBF808EE0305BA767),
    -		UINT64_C(0xE2363053EF78BB26), UINT64_C(0x295B5AC2A599B019),
    -		UINT64_C(0x852A10102F9A04CE), UINT64_C(0x4E477A81657B0FF1),
    -		UINT64_C(0x13F1C432BA5813B0), UINT64_C(0xD89CAEA3F0B9188F),
    -		UINT64_C(0xA99DB955051F2B32), UINT64_C(0x62F0D3C44FFE200D),
    -		UINT64_C(0x3F466D7790DD3C4C), UINT64_C(0xF42B07E6DA3C3773),
    -		UINT64_C(0x13668C42794F4A49), UINT64_C(0xD80BE6D333AE4176),
    -		UINT64_C(0x85BD5860EC8D5D37), UINT64_C(0x4ED032F1A66C5608),
    -		UINT64_C(0x3FD1250753CA65B5), UINT64_C(0xF4BC4F96192B6E8A),
    -		UINT64_C(0xA90AF125C60872CB), UINT64_C(0x62679BB48CE979F4),
    -		UINT64_C(0xCE16D16606EACD23), UINT64_C(0x057BBBF74C0BC61C),
    -		UINT64_C(0x58CD05449328DA5D), UINT64_C(0x93A06FD5D9C9D162),
    -		UINT64_C(0xE2A178232C6FE2DF), UINT64_C(0x29CC12B2668EE9E0),
    -		UINT64_C(0x747AAC01B9ADF5A1), UINT64_C(0xBF17C690F34CFE9E),
    -		UINT64_C(0xA987360A8705459C), UINT64_C(0x62EA5C9BCDE44EA3),
    -		UINT64_C(0x3F5CE22812C752E2), UINT64_C(0xF43188B9582659DD),
    -		UINT64_C(0x85309F4FAD806A60), UINT64_C(0x4E5DF5DEE761615F),
    -		UINT64_C(0x13EB4B6D38427D1E), UINT64_C(0xD88621FC72A37621),
    -		UINT64_C(0x74F76B2EF8A0C2F6), UINT64_C(0xBF9A01BFB241C9C9),
    -		UINT64_C(0xE22CBF0C6D62D588), UINT64_C(0x2941D59D2783DEB7),
    -		UINT64_C(0x5840C26BD225ED0A), UINT64_C(0x932DA8FA98C4E635),
    -		UINT64_C(0xCE9B164947E7FA74), UINT64_C(0x05F67CD80D06F14B),
    -		UINT64_C(0xC477EFF95CEB18E3), UINT64_C(0x0F1A8568160A13DC),
    -		UINT64_C(0x52AC3BDBC9290F9D), UINT64_C(0x99C1514A83C804A2),
    -		UINT64_C(0xE8C046BC766E371F), UINT64_C(0x23AD2C2D3C8F3C20),
    -		UINT64_C(0x7E1B929EE3AC2061), UINT64_C(0xB576F80FA94D2B5E),
    -		UINT64_C(0x1907B2DD234E9F89), UINT64_C(0xD26AD84C69AF94B6),
    -		UINT64_C(0x8FDC66FFB68C88F7), UINT64_C(0x44B10C6EFC6D83C8),
    -		UINT64_C(0x35B01B9809CBB075), UINT64_C(0xFEDD7109432ABB4A),
    -		UINT64_C(0xA36BCFBA9C09A70B), UINT64_C(0x6806A52BD6E8AC34),
    -		UINT64_C(0x7E9655B1A2A11736), UINT64_C(0xB5FB3F20E8401C09),
    -		UINT64_C(0xE84D819337630048), UINT64_C(0x2320EB027D820B77),
    -		UINT64_C(0x5221FCF4882438CA), UINT64_C(0x994C9665C2C533F5),
    -		UINT64_C(0xC4FA28D61DE62FB4), UINT64_C(0x0F9742475707248B),
    -		UINT64_C(0xA3E60895DD04905C), UINT64_C(0x688B620497E59B63),
    -		UINT64_C(0x353DDCB748C68722), UINT64_C(0xFE50B62602278C1D),
    -		UINT64_C(0x8F51A1D0F781BFA0), UINT64_C(0x443CCB41BD60B49F),
    -		UINT64_C(0x198A75F26243A8DE), UINT64_C(0xD2E71F6328A2A3E1),
    -		UINT64_C(0x35AA94C78BD1DEDB), UINT64_C(0xFEC7FE56C130D5E4),
    -		UINT64_C(0xA37140E51E13C9A5), UINT64_C(0x681C2A7454F2C29A),
    -		UINT64_C(0x191D3D82A154F127), UINT64_C(0xD2705713EBB5FA18),
    -		UINT64_C(0x8FC6E9A03496E659), UINT64_C(0x44AB83317E77ED66),
    -		UINT64_C(0xE8DAC9E3F47459B1), UINT64_C(0x23B7A372BE95528E),
    -		UINT64_C(0x7E011DC161B64ECF), UINT64_C(0xB56C77502B5745F0),
    -		UINT64_C(0xC46D60A6DEF1764D), UINT64_C(0x0F000A3794107D72),
    -		UINT64_C(0x52B6B4844B336133), UINT64_C(0x99DBDE1501D26A0C),
    -		UINT64_C(0x8F4B2E8F759BD10E), UINT64_C(0x4426441E3F7ADA31),
    -		UINT64_C(0x1990FAADE059C670), UINT64_C(0xD2FD903CAAB8CD4F),
    -		UINT64_C(0xA3FC87CA5F1EFEF2), UINT64_C(0x6891ED5B15FFF5CD),
    -		UINT64_C(0x352753E8CADCE98C), UINT64_C(0xFE4A3979803DE2B3),
    -		UINT64_C(0x523B73AB0A3E5664), UINT64_C(0x9956193A40DF5D5B),
    -		UINT64_C(0xC4E0A7899FFC411A), UINT64_C(0x0F8DCD18D51D4A25),
    -		UINT64_C(0x7E8CDAEE20BB7998), UINT64_C(0xB5E1B07F6A5A72A7),
    -		UINT64_C(0xE8570ECCB5796EE6), UINT64_C(0x233A645DFF9865D9),
    -		UINT64_C(0x26CC1885F29E9492), UINT64_C(0xEDA17214B87F9FAD),
    -		UINT64_C(0xB017CCA7675C83EC), UINT64_C(0x7B7AA6362DBD88D3),
    -		UINT64_C(0x0A7BB1C0D81BBB6E), UINT64_C(0xC116DB5192FAB051),
    -		UINT64_C(0x9CA065E24DD9AC10), UINT64_C(0x57CD0F730738A72F),
    -		UINT64_C(0xFBBC45A18D3B13F8), UINT64_C(0x30D12F30C7DA18C7),
    -		UINT64_C(0x6D67918318F90486), UINT64_C(0xA60AFB1252180FB9),
    -		UINT64_C(0xD70BECE4A7BE3C04), UINT64_C(0x1C668675ED5F373B),
    -		UINT64_C(0x41D038C6327C2B7A), UINT64_C(0x8ABD5257789D2045),
    -		UINT64_C(0x9C2DA2CD0CD49B47), UINT64_C(0x5740C85C46359078),
    -		UINT64_C(0x0AF676EF99168C39), UINT64_C(0xC19B1C7ED3F78706),
    -		UINT64_C(0xB09A0B882651B4BB), UINT64_C(0x7BF761196CB0BF84),
    -		UINT64_C(0x2641DFAAB393A3C5), UINT64_C(0xED2CB53BF972A8FA),
    -		UINT64_C(0x415DFFE973711C2D), UINT64_C(0x8A30957839901712),
    -		UINT64_C(0xD7862BCBE6B30B53), UINT64_C(0x1CEB415AAC52006C),
    -		UINT64_C(0x6DEA56AC59F433D1), UINT64_C(0xA6873C3D131538EE),
    -		UINT64_C(0xFB31828ECC3624AF), UINT64_C(0x305CE81F86D72F90),
    -		UINT64_C(0xD71163BB25A452AA), UINT64_C(0x1C7C092A6F455995),
    -		UINT64_C(0x41CAB799B06645D4), UINT64_C(0x8AA7DD08FA874EEB),
    -		UINT64_C(0xFBA6CAFE0F217D56), UINT64_C(0x30CBA06F45C07669),
    -		UINT64_C(0x6D7D1EDC9AE36A28), UINT64_C(0xA610744DD0026117),
    -		UINT64_C(0x0A613E9F5A01D5C0), UINT64_C(0xC10C540E10E0DEFF),
    -		UINT64_C(0x9CBAEABDCFC3C2BE), UINT64_C(0x57D7802C8522C981),
    -		UINT64_C(0x26D697DA7084FA3C), UINT64_C(0xEDBBFD4B3A65F103),
    -		UINT64_C(0xB00D43F8E546ED42), UINT64_C(0x7B602969AFA7E67D),
    -		UINT64_C(0x6DF0D9F3DBEE5D7F), UINT64_C(0xA69DB362910F5640),
    -		UINT64_C(0xFB2B0DD14E2C4A01), UINT64_C(0x3046674004CD413E),
    -		UINT64_C(0x414770B6F16B7283), UINT64_C(0x8A2A1A27BB8A79BC),
    -		UINT64_C(0xD79CA49464A965FD), UINT64_C(0x1CF1CE052E486EC2),
    -		UINT64_C(0xB08084D7A44BDA15), UINT64_C(0x7BEDEE46EEAAD12A),
    -		UINT64_C(0x265B50F53189CD6B), UINT64_C(0xED363A647B68C654),
    -		UINT64_C(0x9C372D928ECEF5E9), UINT64_C(0x575A4703C42FFED6),
    -		UINT64_C(0x0AECF9B01B0CE297), UINT64_C(0xC181932151EDE9A8)
    -	}, {
    -		UINT64_C(0x0000000000000000), UINT64_C(0xDCA12C225E8AEE1D),
    -		UINT64_C(0xB8435944BC14DD3B), UINT64_C(0x64E27566E29E3326),
    -		UINT64_C(0x7087B2887829BA77), UINT64_C(0xAC269EAA26A3546A),
    -		UINT64_C(0xC8C4EBCCC43D674C), UINT64_C(0x1465C7EE9AB78951),
    -		UINT64_C(0xE00E6511F15274EF), UINT64_C(0x3CAF4933AFD89AF2),
    -		UINT64_C(0x584D3C554D46A9D4), UINT64_C(0x84EC107713CC47C9),
    -		UINT64_C(0x9089D799897BCE98), UINT64_C(0x4C28FBBBD7F12085),
    -		UINT64_C(0x28CA8EDD356F13A3), UINT64_C(0xF46BA2FF6BE5FDBE),
    -		UINT64_C(0x4503C48DC90A304C), UINT64_C(0x99A2E8AF9780DE51),
    -		UINT64_C(0xFD409DC9751EED77), UINT64_C(0x21E1B1EB2B94036A),
    -		UINT64_C(0x35847605B1238A3B), UINT64_C(0xE9255A27EFA96426),
    -		UINT64_C(0x8DC72F410D375700), UINT64_C(0x5166036353BDB91D),
    -		UINT64_C(0xA50DA19C385844A3), UINT64_C(0x79AC8DBE66D2AABE),
    -		UINT64_C(0x1D4EF8D8844C9998), UINT64_C(0xC1EFD4FADAC67785),
    -		UINT64_C(0xD58A13144071FED4), UINT64_C(0x092B3F361EFB10C9),
    -		UINT64_C(0x6DC94A50FC6523EF), UINT64_C(0xB1686672A2EFCDF2),
    -		UINT64_C(0x8A06881B93156098), UINT64_C(0x56A7A439CD9F8E85),
    -		UINT64_C(0x3245D15F2F01BDA3), UINT64_C(0xEEE4FD7D718B53BE),
    -		UINT64_C(0xFA813A93EB3CDAEF), UINT64_C(0x262016B1B5B634F2),
    -		UINT64_C(0x42C263D7572807D4), UINT64_C(0x9E634FF509A2E9C9),
    -		UINT64_C(0x6A08ED0A62471477), UINT64_C(0xB6A9C1283CCDFA6A),
    -		UINT64_C(0xD24BB44EDE53C94C), UINT64_C(0x0EEA986C80D92751),
    -		UINT64_C(0x1A8F5F821A6EAE00), UINT64_C(0xC62E73A044E4401D),
    -		UINT64_C(0xA2CC06C6A67A733B), UINT64_C(0x7E6D2AE4F8F09D26),
    -		UINT64_C(0xCF054C965A1F50D4), UINT64_C(0x13A460B40495BEC9),
    -		UINT64_C(0x774615D2E60B8DEF), UINT64_C(0xABE739F0B88163F2),
    -		UINT64_C(0xBF82FE1E2236EAA3), UINT64_C(0x6323D23C7CBC04BE),
    -		UINT64_C(0x07C1A75A9E223798), UINT64_C(0xDB608B78C0A8D985),
    -		UINT64_C(0x2F0B2987AB4D243B), UINT64_C(0xF3AA05A5F5C7CA26),
    -		UINT64_C(0x974870C31759F900), UINT64_C(0x4BE95CE149D3171D),
    -		UINT64_C(0x5F8C9B0FD3649E4C), UINT64_C(0x832DB72D8DEE7051),
    -		UINT64_C(0xE7CFC24B6F704377), UINT64_C(0x3B6EEE6931FAAD6A),
    -		UINT64_C(0x91131E980D8418A2), UINT64_C(0x4DB232BA530EF6BF),
    -		UINT64_C(0x295047DCB190C599), UINT64_C(0xF5F16BFEEF1A2B84),
    -		UINT64_C(0xE194AC1075ADA2D5), UINT64_C(0x3D3580322B274CC8),
    -		UINT64_C(0x59D7F554C9B97FEE), UINT64_C(0x8576D976973391F3),
    -		UINT64_C(0x711D7B89FCD66C4D), UINT64_C(0xADBC57ABA25C8250),
    -		UINT64_C(0xC95E22CD40C2B176), UINT64_C(0x15FF0EEF1E485F6B),
    -		UINT64_C(0x019AC90184FFD63A), UINT64_C(0xDD3BE523DA753827),
    -		UINT64_C(0xB9D9904538EB0B01), UINT64_C(0x6578BC676661E51C),
    -		UINT64_C(0xD410DA15C48E28EE), UINT64_C(0x08B1F6379A04C6F3),
    -		UINT64_C(0x6C538351789AF5D5), UINT64_C(0xB0F2AF7326101BC8),
    -		UINT64_C(0xA497689DBCA79299), UINT64_C(0x783644BFE22D7C84),
    -		UINT64_C(0x1CD431D900B34FA2), UINT64_C(0xC0751DFB5E39A1BF),
    -		UINT64_C(0x341EBF0435DC5C01), UINT64_C(0xE8BF93266B56B21C),
    -		UINT64_C(0x8C5DE64089C8813A), UINT64_C(0x50FCCA62D7426F27),
    -		UINT64_C(0x44990D8C4DF5E676), UINT64_C(0x983821AE137F086B),
    -		UINT64_C(0xFCDA54C8F1E13B4D), UINT64_C(0x207B78EAAF6BD550),
    -		UINT64_C(0x1B1596839E91783A), UINT64_C(0xC7B4BAA1C01B9627),
    -		UINT64_C(0xA356CFC72285A501), UINT64_C(0x7FF7E3E57C0F4B1C),
    -		UINT64_C(0x6B92240BE6B8C24D), UINT64_C(0xB7330829B8322C50),
    -		UINT64_C(0xD3D17D4F5AAC1F76), UINT64_C(0x0F70516D0426F16B),
    -		UINT64_C(0xFB1BF3926FC30CD5), UINT64_C(0x27BADFB03149E2C8),
    -		UINT64_C(0x4358AAD6D3D7D1EE), UINT64_C(0x9FF986F48D5D3FF3),
    -		UINT64_C(0x8B9C411A17EAB6A2), UINT64_C(0x573D6D38496058BF),
    -		UINT64_C(0x33DF185EABFE6B99), UINT64_C(0xEF7E347CF5748584),
    -		UINT64_C(0x5E16520E579B4876), UINT64_C(0x82B77E2C0911A66B),
    -		UINT64_C(0xE6550B4AEB8F954D), UINT64_C(0x3AF42768B5057B50),
    -		UINT64_C(0x2E91E0862FB2F201), UINT64_C(0xF230CCA471381C1C),
    -		UINT64_C(0x96D2B9C293A62F3A), UINT64_C(0x4A7395E0CD2CC127),
    -		UINT64_C(0xBE18371FA6C93C99), UINT64_C(0x62B91B3DF843D284),
    -		UINT64_C(0x065B6E5B1ADDE1A2), UINT64_C(0xDAFA427944570FBF),
    -		UINT64_C(0xCE9F8597DEE086EE), UINT64_C(0x123EA9B5806A68F3),
    -		UINT64_C(0x76DCDCD362F45BD5), UINT64_C(0xAA7DF0F13C7EB5C8),
    -		UINT64_C(0xA739329F30A7E9D6), UINT64_C(0x7B981EBD6E2D07CB),
    -		UINT64_C(0x1F7A6BDB8CB334ED), UINT64_C(0xC3DB47F9D239DAF0),
    -		UINT64_C(0xD7BE8017488E53A1), UINT64_C(0x0B1FAC351604BDBC),
    -		UINT64_C(0x6FFDD953F49A8E9A), UINT64_C(0xB35CF571AA106087),
    -		UINT64_C(0x4737578EC1F59D39), UINT64_C(0x9B967BAC9F7F7324),
    -		UINT64_C(0xFF740ECA7DE14002), UINT64_C(0x23D522E8236BAE1F),
    -		UINT64_C(0x37B0E506B9DC274E), UINT64_C(0xEB11C924E756C953),
    -		UINT64_C(0x8FF3BC4205C8FA75), UINT64_C(0x535290605B421468),
    -		UINT64_C(0xE23AF612F9ADD99A), UINT64_C(0x3E9BDA30A7273787),
    -		UINT64_C(0x5A79AF5645B904A1), UINT64_C(0x86D883741B33EABC),
    -		UINT64_C(0x92BD449A818463ED), UINT64_C(0x4E1C68B8DF0E8DF0),
    -		UINT64_C(0x2AFE1DDE3D90BED6), UINT64_C(0xF65F31FC631A50CB),
    -		UINT64_C(0x0234930308FFAD75), UINT64_C(0xDE95BF2156754368),
    -		UINT64_C(0xBA77CA47B4EB704E), UINT64_C(0x66D6E665EA619E53),
    -		UINT64_C(0x72B3218B70D61702), UINT64_C(0xAE120DA92E5CF91F),
    -		UINT64_C(0xCAF078CFCCC2CA39), UINT64_C(0x165154ED92482424),
    -		UINT64_C(0x2D3FBA84A3B2894E), UINT64_C(0xF19E96A6FD386753),
    -		UINT64_C(0x957CE3C01FA65475), UINT64_C(0x49DDCFE2412CBA68),
    -		UINT64_C(0x5DB8080CDB9B3339), UINT64_C(0x8119242E8511DD24),
    -		UINT64_C(0xE5FB5148678FEE02), UINT64_C(0x395A7D6A3905001F),
    -		UINT64_C(0xCD31DF9552E0FDA1), UINT64_C(0x1190F3B70C6A13BC),
    -		UINT64_C(0x757286D1EEF4209A), UINT64_C(0xA9D3AAF3B07ECE87),
    -		UINT64_C(0xBDB66D1D2AC947D6), UINT64_C(0x6117413F7443A9CB),
    -		UINT64_C(0x05F5345996DD9AED), UINT64_C(0xD954187BC85774F0),
    -		UINT64_C(0x683C7E096AB8B902), UINT64_C(0xB49D522B3432571F),
    -		UINT64_C(0xD07F274DD6AC6439), UINT64_C(0x0CDE0B6F88268A24),
    -		UINT64_C(0x18BBCC8112910375), UINT64_C(0xC41AE0A34C1BED68),
    -		UINT64_C(0xA0F895C5AE85DE4E), UINT64_C(0x7C59B9E7F00F3053),
    -		UINT64_C(0x88321B189BEACDED), UINT64_C(0x5493373AC56023F0),
    -		UINT64_C(0x3071425C27FE10D6), UINT64_C(0xECD06E7E7974FECB),
    -		UINT64_C(0xF8B5A990E3C3779A), UINT64_C(0x241485B2BD499987),
    -		UINT64_C(0x40F6F0D45FD7AAA1), UINT64_C(0x9C57DCF6015D44BC),
    -		UINT64_C(0x362A2C073D23F174), UINT64_C(0xEA8B002563A91F69),
    -		UINT64_C(0x8E69754381372C4F), UINT64_C(0x52C85961DFBDC252),
    -		UINT64_C(0x46AD9E8F450A4B03), UINT64_C(0x9A0CB2AD1B80A51E),
    -		UINT64_C(0xFEEEC7CBF91E9638), UINT64_C(0x224FEBE9A7947825),
    -		UINT64_C(0xD6244916CC71859B), UINT64_C(0x0A85653492FB6B86),
    -		UINT64_C(0x6E671052706558A0), UINT64_C(0xB2C63C702EEFB6BD),
    -		UINT64_C(0xA6A3FB9EB4583FEC), UINT64_C(0x7A02D7BCEAD2D1F1),
    -		UINT64_C(0x1EE0A2DA084CE2D7), UINT64_C(0xC2418EF856C60CCA),
    -		UINT64_C(0x7329E88AF429C138), UINT64_C(0xAF88C4A8AAA32F25),
    -		UINT64_C(0xCB6AB1CE483D1C03), UINT64_C(0x17CB9DEC16B7F21E),
    -		UINT64_C(0x03AE5A028C007B4F), UINT64_C(0xDF0F7620D28A9552),
    -		UINT64_C(0xBBED03463014A674), UINT64_C(0x674C2F646E9E4869),
    -		UINT64_C(0x93278D9B057BB5D7), UINT64_C(0x4F86A1B95BF15BCA),
    -		UINT64_C(0x2B64D4DFB96F68EC), UINT64_C(0xF7C5F8FDE7E586F1),
    -		UINT64_C(0xE3A03F137D520FA0), UINT64_C(0x3F01133123D8E1BD),
    -		UINT64_C(0x5BE36657C146D29B), UINT64_C(0x87424A759FCC3C86),
    -		UINT64_C(0xBC2CA41CAE3691EC), UINT64_C(0x608D883EF0BC7FF1),
    -		UINT64_C(0x046FFD5812224CD7), UINT64_C(0xD8CED17A4CA8A2CA),
    -		UINT64_C(0xCCAB1694D61F2B9B), UINT64_C(0x100A3AB68895C586),
    -		UINT64_C(0x74E84FD06A0BF6A0), UINT64_C(0xA84963F2348118BD),
    -		UINT64_C(0x5C22C10D5F64E503), UINT64_C(0x8083ED2F01EE0B1E),
    -		UINT64_C(0xE4619849E3703838), UINT64_C(0x38C0B46BBDFAD625),
    -		UINT64_C(0x2CA57385274D5F74), UINT64_C(0xF0045FA779C7B169),
    -		UINT64_C(0x94E62AC19B59824F), UINT64_C(0x484706E3C5D36C52),
    -		UINT64_C(0xF92F6091673CA1A0), UINT64_C(0x258E4CB339B64FBD),
    -		UINT64_C(0x416C39D5DB287C9B), UINT64_C(0x9DCD15F785A29286),
    -		UINT64_C(0x89A8D2191F151BD7), UINT64_C(0x5509FE3B419FF5CA),
    -		UINT64_C(0x31EB8B5DA301C6EC), UINT64_C(0xED4AA77FFD8B28F1),
    -		UINT64_C(0x19210580966ED54F), UINT64_C(0xC58029A2C8E43B52),
    -		UINT64_C(0xA1625CC42A7A0874), UINT64_C(0x7DC370E674F0E669),
    -		UINT64_C(0x69A6B708EE476F38), UINT64_C(0xB5079B2AB0CD8125),
    -		UINT64_C(0xD1E5EE4C5253B203), UINT64_C(0x0D44C26E0CD95C1E)
    -	}
    -};
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc64_table_le.h b/external/public-domain/xz/dist/src/liblzma/check/crc64_table_le.h
    deleted file mode 100644
    index 1196b31e1..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc64_table_le.h
    +++ /dev/null
    @@ -1,521 +0,0 @@
    -/* This file has been automatically generated by crc64_tablegen.c. */
    -
    -const uint64_t lzma_crc64_table[4][256] = {
    -	{
    -		UINT64_C(0x0000000000000000), UINT64_C(0xB32E4CBE03A75F6F),
    -		UINT64_C(0xF4843657A840A05B), UINT64_C(0x47AA7AE9ABE7FF34),
    -		UINT64_C(0x7BD0C384FF8F5E33), UINT64_C(0xC8FE8F3AFC28015C),
    -		UINT64_C(0x8F54F5D357CFFE68), UINT64_C(0x3C7AB96D5468A107),
    -		UINT64_C(0xF7A18709FF1EBC66), UINT64_C(0x448FCBB7FCB9E309),
    -		UINT64_C(0x0325B15E575E1C3D), UINT64_C(0xB00BFDE054F94352),
    -		UINT64_C(0x8C71448D0091E255), UINT64_C(0x3F5F08330336BD3A),
    -		UINT64_C(0x78F572DAA8D1420E), UINT64_C(0xCBDB3E64AB761D61),
    -		UINT64_C(0x7D9BA13851336649), UINT64_C(0xCEB5ED8652943926),
    -		UINT64_C(0x891F976FF973C612), UINT64_C(0x3A31DBD1FAD4997D),
    -		UINT64_C(0x064B62BCAEBC387A), UINT64_C(0xB5652E02AD1B6715),
    -		UINT64_C(0xF2CF54EB06FC9821), UINT64_C(0x41E11855055BC74E),
    -		UINT64_C(0x8A3A2631AE2DDA2F), UINT64_C(0x39146A8FAD8A8540),
    -		UINT64_C(0x7EBE1066066D7A74), UINT64_C(0xCD905CD805CA251B),
    -		UINT64_C(0xF1EAE5B551A2841C), UINT64_C(0x42C4A90B5205DB73),
    -		UINT64_C(0x056ED3E2F9E22447), UINT64_C(0xB6409F5CFA457B28),
    -		UINT64_C(0xFB374270A266CC92), UINT64_C(0x48190ECEA1C193FD),
    -		UINT64_C(0x0FB374270A266CC9), UINT64_C(0xBC9D3899098133A6),
    -		UINT64_C(0x80E781F45DE992A1), UINT64_C(0x33C9CD4A5E4ECDCE),
    -		UINT64_C(0x7463B7A3F5A932FA), UINT64_C(0xC74DFB1DF60E6D95),
    -		UINT64_C(0x0C96C5795D7870F4), UINT64_C(0xBFB889C75EDF2F9B),
    -		UINT64_C(0xF812F32EF538D0AF), UINT64_C(0x4B3CBF90F69F8FC0),
    -		UINT64_C(0x774606FDA2F72EC7), UINT64_C(0xC4684A43A15071A8),
    -		UINT64_C(0x83C230AA0AB78E9C), UINT64_C(0x30EC7C140910D1F3),
    -		UINT64_C(0x86ACE348F355AADB), UINT64_C(0x3582AFF6F0F2F5B4),
    -		UINT64_C(0x7228D51F5B150A80), UINT64_C(0xC10699A158B255EF),
    -		UINT64_C(0xFD7C20CC0CDAF4E8), UINT64_C(0x4E526C720F7DAB87),
    -		UINT64_C(0x09F8169BA49A54B3), UINT64_C(0xBAD65A25A73D0BDC),
    -		UINT64_C(0x710D64410C4B16BD), UINT64_C(0xC22328FF0FEC49D2),
    -		UINT64_C(0x85895216A40BB6E6), UINT64_C(0x36A71EA8A7ACE989),
    -		UINT64_C(0x0ADDA7C5F3C4488E), UINT64_C(0xB9F3EB7BF06317E1),
    -		UINT64_C(0xFE5991925B84E8D5), UINT64_C(0x4D77DD2C5823B7BA),
    -		UINT64_C(0x64B62BCAEBC387A1), UINT64_C(0xD7986774E864D8CE),
    -		UINT64_C(0x90321D9D438327FA), UINT64_C(0x231C512340247895),
    -		UINT64_C(0x1F66E84E144CD992), UINT64_C(0xAC48A4F017EB86FD),
    -		UINT64_C(0xEBE2DE19BC0C79C9), UINT64_C(0x58CC92A7BFAB26A6),
    -		UINT64_C(0x9317ACC314DD3BC7), UINT64_C(0x2039E07D177A64A8),
    -		UINT64_C(0x67939A94BC9D9B9C), UINT64_C(0xD4BDD62ABF3AC4F3),
    -		UINT64_C(0xE8C76F47EB5265F4), UINT64_C(0x5BE923F9E8F53A9B),
    -		UINT64_C(0x1C4359104312C5AF), UINT64_C(0xAF6D15AE40B59AC0),
    -		UINT64_C(0x192D8AF2BAF0E1E8), UINT64_C(0xAA03C64CB957BE87),
    -		UINT64_C(0xEDA9BCA512B041B3), UINT64_C(0x5E87F01B11171EDC),
    -		UINT64_C(0x62FD4976457FBFDB), UINT64_C(0xD1D305C846D8E0B4),
    -		UINT64_C(0x96797F21ED3F1F80), UINT64_C(0x2557339FEE9840EF),
    -		UINT64_C(0xEE8C0DFB45EE5D8E), UINT64_C(0x5DA24145464902E1),
    -		UINT64_C(0x1A083BACEDAEFDD5), UINT64_C(0xA9267712EE09A2BA),
    -		UINT64_C(0x955CCE7FBA6103BD), UINT64_C(0x267282C1B9C65CD2),
    -		UINT64_C(0x61D8F8281221A3E6), UINT64_C(0xD2F6B4961186FC89),
    -		UINT64_C(0x9F8169BA49A54B33), UINT64_C(0x2CAF25044A02145C),
    -		UINT64_C(0x6B055FEDE1E5EB68), UINT64_C(0xD82B1353E242B407),
    -		UINT64_C(0xE451AA3EB62A1500), UINT64_C(0x577FE680B58D4A6F),
    -		UINT64_C(0x10D59C691E6AB55B), UINT64_C(0xA3FBD0D71DCDEA34),
    -		UINT64_C(0x6820EEB3B6BBF755), UINT64_C(0xDB0EA20DB51CA83A),
    -		UINT64_C(0x9CA4D8E41EFB570E), UINT64_C(0x2F8A945A1D5C0861),
    -		UINT64_C(0x13F02D374934A966), UINT64_C(0xA0DE61894A93F609),
    -		UINT64_C(0xE7741B60E174093D), UINT64_C(0x545A57DEE2D35652),
    -		UINT64_C(0xE21AC88218962D7A), UINT64_C(0x5134843C1B317215),
    -		UINT64_C(0x169EFED5B0D68D21), UINT64_C(0xA5B0B26BB371D24E),
    -		UINT64_C(0x99CA0B06E7197349), UINT64_C(0x2AE447B8E4BE2C26),
    -		UINT64_C(0x6D4E3D514F59D312), UINT64_C(0xDE6071EF4CFE8C7D),
    -		UINT64_C(0x15BB4F8BE788911C), UINT64_C(0xA6950335E42FCE73),
    -		UINT64_C(0xE13F79DC4FC83147), UINT64_C(0x521135624C6F6E28),
    -		UINT64_C(0x6E6B8C0F1807CF2F), UINT64_C(0xDD45C0B11BA09040),
    -		UINT64_C(0x9AEFBA58B0476F74), UINT64_C(0x29C1F6E6B3E0301B),
    -		UINT64_C(0xC96C5795D7870F42), UINT64_C(0x7A421B2BD420502D),
    -		UINT64_C(0x3DE861C27FC7AF19), UINT64_C(0x8EC62D7C7C60F076),
    -		UINT64_C(0xB2BC941128085171), UINT64_C(0x0192D8AF2BAF0E1E),
    -		UINT64_C(0x4638A2468048F12A), UINT64_C(0xF516EEF883EFAE45),
    -		UINT64_C(0x3ECDD09C2899B324), UINT64_C(0x8DE39C222B3EEC4B),
    -		UINT64_C(0xCA49E6CB80D9137F), UINT64_C(0x7967AA75837E4C10),
    -		UINT64_C(0x451D1318D716ED17), UINT64_C(0xF6335FA6D4B1B278),
    -		UINT64_C(0xB199254F7F564D4C), UINT64_C(0x02B769F17CF11223),
    -		UINT64_C(0xB4F7F6AD86B4690B), UINT64_C(0x07D9BA1385133664),
    -		UINT64_C(0x4073C0FA2EF4C950), UINT64_C(0xF35D8C442D53963F),
    -		UINT64_C(0xCF273529793B3738), UINT64_C(0x7C0979977A9C6857),
    -		UINT64_C(0x3BA3037ED17B9763), UINT64_C(0x888D4FC0D2DCC80C),
    -		UINT64_C(0x435671A479AAD56D), UINT64_C(0xF0783D1A7A0D8A02),
    -		UINT64_C(0xB7D247F3D1EA7536), UINT64_C(0x04FC0B4DD24D2A59),
    -		UINT64_C(0x3886B22086258B5E), UINT64_C(0x8BA8FE9E8582D431),
    -		UINT64_C(0xCC0284772E652B05), UINT64_C(0x7F2CC8C92DC2746A),
    -		UINT64_C(0x325B15E575E1C3D0), UINT64_C(0x8175595B76469CBF),
    -		UINT64_C(0xC6DF23B2DDA1638B), UINT64_C(0x75F16F0CDE063CE4),
    -		UINT64_C(0x498BD6618A6E9DE3), UINT64_C(0xFAA59ADF89C9C28C),
    -		UINT64_C(0xBD0FE036222E3DB8), UINT64_C(0x0E21AC88218962D7),
    -		UINT64_C(0xC5FA92EC8AFF7FB6), UINT64_C(0x76D4DE52895820D9),
    -		UINT64_C(0x317EA4BB22BFDFED), UINT64_C(0x8250E80521188082),
    -		UINT64_C(0xBE2A516875702185), UINT64_C(0x0D041DD676D77EEA),
    -		UINT64_C(0x4AAE673FDD3081DE), UINT64_C(0xF9802B81DE97DEB1),
    -		UINT64_C(0x4FC0B4DD24D2A599), UINT64_C(0xFCEEF8632775FAF6),
    -		UINT64_C(0xBB44828A8C9205C2), UINT64_C(0x086ACE348F355AAD),
    -		UINT64_C(0x34107759DB5DFBAA), UINT64_C(0x873E3BE7D8FAA4C5),
    -		UINT64_C(0xC094410E731D5BF1), UINT64_C(0x73BA0DB070BA049E),
    -		UINT64_C(0xB86133D4DBCC19FF), UINT64_C(0x0B4F7F6AD86B4690),
    -		UINT64_C(0x4CE50583738CB9A4), UINT64_C(0xFFCB493D702BE6CB),
    -		UINT64_C(0xC3B1F050244347CC), UINT64_C(0x709FBCEE27E418A3),
    -		UINT64_C(0x3735C6078C03E797), UINT64_C(0x841B8AB98FA4B8F8),
    -		UINT64_C(0xADDA7C5F3C4488E3), UINT64_C(0x1EF430E13FE3D78C),
    -		UINT64_C(0x595E4A08940428B8), UINT64_C(0xEA7006B697A377D7),
    -		UINT64_C(0xD60ABFDBC3CBD6D0), UINT64_C(0x6524F365C06C89BF),
    -		UINT64_C(0x228E898C6B8B768B), UINT64_C(0x91A0C532682C29E4),
    -		UINT64_C(0x5A7BFB56C35A3485), UINT64_C(0xE955B7E8C0FD6BEA),
    -		UINT64_C(0xAEFFCD016B1A94DE), UINT64_C(0x1DD181BF68BDCBB1),
    -		UINT64_C(0x21AB38D23CD56AB6), UINT64_C(0x9285746C3F7235D9),
    -		UINT64_C(0xD52F0E859495CAED), UINT64_C(0x6601423B97329582),
    -		UINT64_C(0xD041DD676D77EEAA), UINT64_C(0x636F91D96ED0B1C5),
    -		UINT64_C(0x24C5EB30C5374EF1), UINT64_C(0x97EBA78EC690119E),
    -		UINT64_C(0xAB911EE392F8B099), UINT64_C(0x18BF525D915FEFF6),
    -		UINT64_C(0x5F1528B43AB810C2), UINT64_C(0xEC3B640A391F4FAD),
    -		UINT64_C(0x27E05A6E926952CC), UINT64_C(0x94CE16D091CE0DA3),
    -		UINT64_C(0xD3646C393A29F297), UINT64_C(0x604A2087398EADF8),
    -		UINT64_C(0x5C3099EA6DE60CFF), UINT64_C(0xEF1ED5546E415390),
    -		UINT64_C(0xA8B4AFBDC5A6ACA4), UINT64_C(0x1B9AE303C601F3CB),
    -		UINT64_C(0x56ED3E2F9E224471), UINT64_C(0xE5C372919D851B1E),
    -		UINT64_C(0xA26908783662E42A), UINT64_C(0x114744C635C5BB45),
    -		UINT64_C(0x2D3DFDAB61AD1A42), UINT64_C(0x9E13B115620A452D),
    -		UINT64_C(0xD9B9CBFCC9EDBA19), UINT64_C(0x6A978742CA4AE576),
    -		UINT64_C(0xA14CB926613CF817), UINT64_C(0x1262F598629BA778),
    -		UINT64_C(0x55C88F71C97C584C), UINT64_C(0xE6E6C3CFCADB0723),
    -		UINT64_C(0xDA9C7AA29EB3A624), UINT64_C(0x69B2361C9D14F94B),
    -		UINT64_C(0x2E184CF536F3067F), UINT64_C(0x9D36004B35545910),
    -		UINT64_C(0x2B769F17CF112238), UINT64_C(0x9858D3A9CCB67D57),
    -		UINT64_C(0xDFF2A94067518263), UINT64_C(0x6CDCE5FE64F6DD0C),
    -		UINT64_C(0x50A65C93309E7C0B), UINT64_C(0xE388102D33392364),
    -		UINT64_C(0xA4226AC498DEDC50), UINT64_C(0x170C267A9B79833F),
    -		UINT64_C(0xDCD7181E300F9E5E), UINT64_C(0x6FF954A033A8C131),
    -		UINT64_C(0x28532E49984F3E05), UINT64_C(0x9B7D62F79BE8616A),
    -		UINT64_C(0xA707DB9ACF80C06D), UINT64_C(0x14299724CC279F02),
    -		UINT64_C(0x5383EDCD67C06036), UINT64_C(0xE0ADA17364673F59)
    -	}, {
    -		UINT64_C(0x0000000000000000), UINT64_C(0x54E979925CD0F10D),
    -		UINT64_C(0xA9D2F324B9A1E21A), UINT64_C(0xFD3B8AB6E5711317),
    -		UINT64_C(0xC17D4962DC4DDAB1), UINT64_C(0x959430F0809D2BBC),
    -		UINT64_C(0x68AFBA4665EC38AB), UINT64_C(0x3C46C3D4393CC9A6),
    -		UINT64_C(0x10223DEE1795ABE7), UINT64_C(0x44CB447C4B455AEA),
    -		UINT64_C(0xB9F0CECAAE3449FD), UINT64_C(0xED19B758F2E4B8F0),
    -		UINT64_C(0xD15F748CCBD87156), UINT64_C(0x85B60D1E9708805B),
    -		UINT64_C(0x788D87A87279934C), UINT64_C(0x2C64FE3A2EA96241),
    -		UINT64_C(0x20447BDC2F2B57CE), UINT64_C(0x74AD024E73FBA6C3),
    -		UINT64_C(0x899688F8968AB5D4), UINT64_C(0xDD7FF16ACA5A44D9),
    -		UINT64_C(0xE13932BEF3668D7F), UINT64_C(0xB5D04B2CAFB67C72),
    -		UINT64_C(0x48EBC19A4AC76F65), UINT64_C(0x1C02B80816179E68),
    -		UINT64_C(0x3066463238BEFC29), UINT64_C(0x648F3FA0646E0D24),
    -		UINT64_C(0x99B4B516811F1E33), UINT64_C(0xCD5DCC84DDCFEF3E),
    -		UINT64_C(0xF11B0F50E4F32698), UINT64_C(0xA5F276C2B823D795),
    -		UINT64_C(0x58C9FC745D52C482), UINT64_C(0x0C2085E60182358F),
    -		UINT64_C(0x4088F7B85E56AF9C), UINT64_C(0x14618E2A02865E91),
    -		UINT64_C(0xE95A049CE7F74D86), UINT64_C(0xBDB37D0EBB27BC8B),
    -		UINT64_C(0x81F5BEDA821B752D), UINT64_C(0xD51CC748DECB8420),
    -		UINT64_C(0x28274DFE3BBA9737), UINT64_C(0x7CCE346C676A663A),
    -		UINT64_C(0x50AACA5649C3047B), UINT64_C(0x0443B3C41513F576),
    -		UINT64_C(0xF9783972F062E661), UINT64_C(0xAD9140E0ACB2176C),
    -		UINT64_C(0x91D78334958EDECA), UINT64_C(0xC53EFAA6C95E2FC7),
    -		UINT64_C(0x380570102C2F3CD0), UINT64_C(0x6CEC098270FFCDDD),
    -		UINT64_C(0x60CC8C64717DF852), UINT64_C(0x3425F5F62DAD095F),
    -		UINT64_C(0xC91E7F40C8DC1A48), UINT64_C(0x9DF706D2940CEB45),
    -		UINT64_C(0xA1B1C506AD3022E3), UINT64_C(0xF558BC94F1E0D3EE),
    -		UINT64_C(0x086336221491C0F9), UINT64_C(0x5C8A4FB0484131F4),
    -		UINT64_C(0x70EEB18A66E853B5), UINT64_C(0x2407C8183A38A2B8),
    -		UINT64_C(0xD93C42AEDF49B1AF), UINT64_C(0x8DD53B3C839940A2),
    -		UINT64_C(0xB193F8E8BAA58904), UINT64_C(0xE57A817AE6757809),
    -		UINT64_C(0x18410BCC03046B1E), UINT64_C(0x4CA8725E5FD49A13),
    -		UINT64_C(0x8111EF70BCAD5F38), UINT64_C(0xD5F896E2E07DAE35),
    -		UINT64_C(0x28C31C54050CBD22), UINT64_C(0x7C2A65C659DC4C2F),
    -		UINT64_C(0x406CA61260E08589), UINT64_C(0x1485DF803C307484),
    -		UINT64_C(0xE9BE5536D9416793), UINT64_C(0xBD572CA48591969E),
    -		UINT64_C(0x9133D29EAB38F4DF), UINT64_C(0xC5DAAB0CF7E805D2),
    -		UINT64_C(0x38E121BA129916C5), UINT64_C(0x6C0858284E49E7C8),
    -		UINT64_C(0x504E9BFC77752E6E), UINT64_C(0x04A7E26E2BA5DF63),
    -		UINT64_C(0xF99C68D8CED4CC74), UINT64_C(0xAD75114A92043D79),
    -		UINT64_C(0xA15594AC938608F6), UINT64_C(0xF5BCED3ECF56F9FB),
    -		UINT64_C(0x088767882A27EAEC), UINT64_C(0x5C6E1E1A76F71BE1),
    -		UINT64_C(0x6028DDCE4FCBD247), UINT64_C(0x34C1A45C131B234A),
    -		UINT64_C(0xC9FA2EEAF66A305D), UINT64_C(0x9D135778AABAC150),
    -		UINT64_C(0xB177A9428413A311), UINT64_C(0xE59ED0D0D8C3521C),
    -		UINT64_C(0x18A55A663DB2410B), UINT64_C(0x4C4C23F46162B006),
    -		UINT64_C(0x700AE020585E79A0), UINT64_C(0x24E399B2048E88AD),
    -		UINT64_C(0xD9D81304E1FF9BBA), UINT64_C(0x8D316A96BD2F6AB7),
    -		UINT64_C(0xC19918C8E2FBF0A4), UINT64_C(0x9570615ABE2B01A9),
    -		UINT64_C(0x684BEBEC5B5A12BE), UINT64_C(0x3CA2927E078AE3B3),
    -		UINT64_C(0x00E451AA3EB62A15), UINT64_C(0x540D28386266DB18),
    -		UINT64_C(0xA936A28E8717C80F), UINT64_C(0xFDDFDB1CDBC73902),
    -		UINT64_C(0xD1BB2526F56E5B43), UINT64_C(0x85525CB4A9BEAA4E),
    -		UINT64_C(0x7869D6024CCFB959), UINT64_C(0x2C80AF90101F4854),
    -		UINT64_C(0x10C66C44292381F2), UINT64_C(0x442F15D675F370FF),
    -		UINT64_C(0xB9149F60908263E8), UINT64_C(0xEDFDE6F2CC5292E5),
    -		UINT64_C(0xE1DD6314CDD0A76A), UINT64_C(0xB5341A8691005667),
    -		UINT64_C(0x480F903074714570), UINT64_C(0x1CE6E9A228A1B47D),
    -		UINT64_C(0x20A02A76119D7DDB), UINT64_C(0x744953E44D4D8CD6),
    -		UINT64_C(0x8972D952A83C9FC1), UINT64_C(0xDD9BA0C0F4EC6ECC),
    -		UINT64_C(0xF1FF5EFADA450C8D), UINT64_C(0xA51627688695FD80),
    -		UINT64_C(0x582DADDE63E4EE97), UINT64_C(0x0CC4D44C3F341F9A),
    -		UINT64_C(0x308217980608D63C), UINT64_C(0x646B6E0A5AD82731),
    -		UINT64_C(0x9950E4BCBFA93426), UINT64_C(0xCDB99D2EE379C52B),
    -		UINT64_C(0x90FB71CAD654A0F5), UINT64_C(0xC41208588A8451F8),
    -		UINT64_C(0x392982EE6FF542EF), UINT64_C(0x6DC0FB7C3325B3E2),
    -		UINT64_C(0x518638A80A197A44), UINT64_C(0x056F413A56C98B49),
    -		UINT64_C(0xF854CB8CB3B8985E), UINT64_C(0xACBDB21EEF686953),
    -		UINT64_C(0x80D94C24C1C10B12), UINT64_C(0xD43035B69D11FA1F),
    -		UINT64_C(0x290BBF007860E908), UINT64_C(0x7DE2C69224B01805),
    -		UINT64_C(0x41A405461D8CD1A3), UINT64_C(0x154D7CD4415C20AE),
    -		UINT64_C(0xE876F662A42D33B9), UINT64_C(0xBC9F8FF0F8FDC2B4),
    -		UINT64_C(0xB0BF0A16F97FF73B), UINT64_C(0xE4567384A5AF0636),
    -		UINT64_C(0x196DF93240DE1521), UINT64_C(0x4D8480A01C0EE42C),
    -		UINT64_C(0x71C2437425322D8A), UINT64_C(0x252B3AE679E2DC87),
    -		UINT64_C(0xD810B0509C93CF90), UINT64_C(0x8CF9C9C2C0433E9D),
    -		UINT64_C(0xA09D37F8EEEA5CDC), UINT64_C(0xF4744E6AB23AADD1),
    -		UINT64_C(0x094FC4DC574BBEC6), UINT64_C(0x5DA6BD4E0B9B4FCB),
    -		UINT64_C(0x61E07E9A32A7866D), UINT64_C(0x350907086E777760),
    -		UINT64_C(0xC8328DBE8B066477), UINT64_C(0x9CDBF42CD7D6957A),
    -		UINT64_C(0xD073867288020F69), UINT64_C(0x849AFFE0D4D2FE64),
    -		UINT64_C(0x79A1755631A3ED73), UINT64_C(0x2D480CC46D731C7E),
    -		UINT64_C(0x110ECF10544FD5D8), UINT64_C(0x45E7B682089F24D5),
    -		UINT64_C(0xB8DC3C34EDEE37C2), UINT64_C(0xEC3545A6B13EC6CF),
    -		UINT64_C(0xC051BB9C9F97A48E), UINT64_C(0x94B8C20EC3475583),
    -		UINT64_C(0x698348B826364694), UINT64_C(0x3D6A312A7AE6B799),
    -		UINT64_C(0x012CF2FE43DA7E3F), UINT64_C(0x55C58B6C1F0A8F32),
    -		UINT64_C(0xA8FE01DAFA7B9C25), UINT64_C(0xFC177848A6AB6D28),
    -		UINT64_C(0xF037FDAEA72958A7), UINT64_C(0xA4DE843CFBF9A9AA),
    -		UINT64_C(0x59E50E8A1E88BABD), UINT64_C(0x0D0C771842584BB0),
    -		UINT64_C(0x314AB4CC7B648216), UINT64_C(0x65A3CD5E27B4731B),
    -		UINT64_C(0x989847E8C2C5600C), UINT64_C(0xCC713E7A9E159101),
    -		UINT64_C(0xE015C040B0BCF340), UINT64_C(0xB4FCB9D2EC6C024D),
    -		UINT64_C(0x49C73364091D115A), UINT64_C(0x1D2E4AF655CDE057),
    -		UINT64_C(0x216889226CF129F1), UINT64_C(0x7581F0B03021D8FC),
    -		UINT64_C(0x88BA7A06D550CBEB), UINT64_C(0xDC53039489803AE6),
    -		UINT64_C(0x11EA9EBA6AF9FFCD), UINT64_C(0x4503E72836290EC0),
    -		UINT64_C(0xB8386D9ED3581DD7), UINT64_C(0xECD1140C8F88ECDA),
    -		UINT64_C(0xD097D7D8B6B4257C), UINT64_C(0x847EAE4AEA64D471),
    -		UINT64_C(0x794524FC0F15C766), UINT64_C(0x2DAC5D6E53C5366B),
    -		UINT64_C(0x01C8A3547D6C542A), UINT64_C(0x5521DAC621BCA527),
    -		UINT64_C(0xA81A5070C4CDB630), UINT64_C(0xFCF329E2981D473D),
    -		UINT64_C(0xC0B5EA36A1218E9B), UINT64_C(0x945C93A4FDF17F96),
    -		UINT64_C(0x6967191218806C81), UINT64_C(0x3D8E608044509D8C),
    -		UINT64_C(0x31AEE56645D2A803), UINT64_C(0x65479CF41902590E),
    -		UINT64_C(0x987C1642FC734A19), UINT64_C(0xCC956FD0A0A3BB14),
    -		UINT64_C(0xF0D3AC04999F72B2), UINT64_C(0xA43AD596C54F83BF),
    -		UINT64_C(0x59015F20203E90A8), UINT64_C(0x0DE826B27CEE61A5),
    -		UINT64_C(0x218CD888524703E4), UINT64_C(0x7565A11A0E97F2E9),
    -		UINT64_C(0x885E2BACEBE6E1FE), UINT64_C(0xDCB7523EB73610F3),
    -		UINT64_C(0xE0F191EA8E0AD955), UINT64_C(0xB418E878D2DA2858),
    -		UINT64_C(0x492362CE37AB3B4F), UINT64_C(0x1DCA1B5C6B7BCA42),
    -		UINT64_C(0x5162690234AF5051), UINT64_C(0x058B1090687FA15C),
    -		UINT64_C(0xF8B09A268D0EB24B), UINT64_C(0xAC59E3B4D1DE4346),
    -		UINT64_C(0x901F2060E8E28AE0), UINT64_C(0xC4F659F2B4327BED),
    -		UINT64_C(0x39CDD344514368FA), UINT64_C(0x6D24AAD60D9399F7),
    -		UINT64_C(0x414054EC233AFBB6), UINT64_C(0x15A92D7E7FEA0ABB),
    -		UINT64_C(0xE892A7C89A9B19AC), UINT64_C(0xBC7BDE5AC64BE8A1),
    -		UINT64_C(0x803D1D8EFF772107), UINT64_C(0xD4D4641CA3A7D00A),
    -		UINT64_C(0x29EFEEAA46D6C31D), UINT64_C(0x7D0697381A063210),
    -		UINT64_C(0x712612DE1B84079F), UINT64_C(0x25CF6B4C4754F692),
    -		UINT64_C(0xD8F4E1FAA225E585), UINT64_C(0x8C1D9868FEF51488),
    -		UINT64_C(0xB05B5BBCC7C9DD2E), UINT64_C(0xE4B2222E9B192C23),
    -		UINT64_C(0x1989A8987E683F34), UINT64_C(0x4D60D10A22B8CE39),
    -		UINT64_C(0x61042F300C11AC78), UINT64_C(0x35ED56A250C15D75),
    -		UINT64_C(0xC8D6DC14B5B04E62), UINT64_C(0x9C3FA586E960BF6F),
    -		UINT64_C(0xA0796652D05C76C9), UINT64_C(0xF4901FC08C8C87C4),
    -		UINT64_C(0x09AB957669FD94D3), UINT64_C(0x5D42ECE4352D65DE)
    -	}, {
    -		UINT64_C(0x0000000000000000), UINT64_C(0x3F0BE14A916A6DCB),
    -		UINT64_C(0x7E17C29522D4DB96), UINT64_C(0x411C23DFB3BEB65D),
    -		UINT64_C(0xFC2F852A45A9B72C), UINT64_C(0xC3246460D4C3DAE7),
    -		UINT64_C(0x823847BF677D6CBA), UINT64_C(0xBD33A6F5F6170171),
    -		UINT64_C(0x6A87A57F245D70DD), UINT64_C(0x558C4435B5371D16),
    -		UINT64_C(0x149067EA0689AB4B), UINT64_C(0x2B9B86A097E3C680),
    -		UINT64_C(0x96A8205561F4C7F1), UINT64_C(0xA9A3C11FF09EAA3A),
    -		UINT64_C(0xE8BFE2C043201C67), UINT64_C(0xD7B4038AD24A71AC),
    -		UINT64_C(0xD50F4AFE48BAE1BA), UINT64_C(0xEA04ABB4D9D08C71),
    -		UINT64_C(0xAB18886B6A6E3A2C), UINT64_C(0x94136921FB0457E7),
    -		UINT64_C(0x2920CFD40D135696), UINT64_C(0x162B2E9E9C793B5D),
    -		UINT64_C(0x57370D412FC78D00), UINT64_C(0x683CEC0BBEADE0CB),
    -		UINT64_C(0xBF88EF816CE79167), UINT64_C(0x80830ECBFD8DFCAC),
    -		UINT64_C(0xC19F2D144E334AF1), UINT64_C(0xFE94CC5EDF59273A),
    -		UINT64_C(0x43A76AAB294E264B), UINT64_C(0x7CAC8BE1B8244B80),
    -		UINT64_C(0x3DB0A83E0B9AFDDD), UINT64_C(0x02BB49749AF09016),
    -		UINT64_C(0x38C63AD73E7BDDF1), UINT64_C(0x07CDDB9DAF11B03A),
    -		UINT64_C(0x46D1F8421CAF0667), UINT64_C(0x79DA19088DC56BAC),
    -		UINT64_C(0xC4E9BFFD7BD26ADD), UINT64_C(0xFBE25EB7EAB80716),
    -		UINT64_C(0xBAFE7D685906B14B), UINT64_C(0x85F59C22C86CDC80),
    -		UINT64_C(0x52419FA81A26AD2C), UINT64_C(0x6D4A7EE28B4CC0E7),
    -		UINT64_C(0x2C565D3D38F276BA), UINT64_C(0x135DBC77A9981B71),
    -		UINT64_C(0xAE6E1A825F8F1A00), UINT64_C(0x9165FBC8CEE577CB),
    -		UINT64_C(0xD079D8177D5BC196), UINT64_C(0xEF72395DEC31AC5D),
    -		UINT64_C(0xEDC9702976C13C4B), UINT64_C(0xD2C29163E7AB5180),
    -		UINT64_C(0x93DEB2BC5415E7DD), UINT64_C(0xACD553F6C57F8A16),
    -		UINT64_C(0x11E6F50333688B67), UINT64_C(0x2EED1449A202E6AC),
    -		UINT64_C(0x6FF1379611BC50F1), UINT64_C(0x50FAD6DC80D63D3A),
    -		UINT64_C(0x874ED556529C4C96), UINT64_C(0xB845341CC3F6215D),
    -		UINT64_C(0xF95917C370489700), UINT64_C(0xC652F689E122FACB),
    -		UINT64_C(0x7B61507C1735FBBA), UINT64_C(0x446AB136865F9671),
    -		UINT64_C(0x057692E935E1202C), UINT64_C(0x3A7D73A3A48B4DE7),
    -		UINT64_C(0x718C75AE7CF7BBE2), UINT64_C(0x4E8794E4ED9DD629),
    -		UINT64_C(0x0F9BB73B5E236074), UINT64_C(0x30905671CF490DBF),
    -		UINT64_C(0x8DA3F084395E0CCE), UINT64_C(0xB2A811CEA8346105),
    -		UINT64_C(0xF3B432111B8AD758), UINT64_C(0xCCBFD35B8AE0BA93),
    -		UINT64_C(0x1B0BD0D158AACB3F), UINT64_C(0x2400319BC9C0A6F4),
    -		UINT64_C(0x651C12447A7E10A9), UINT64_C(0x5A17F30EEB147D62),
    -		UINT64_C(0xE72455FB1D037C13), UINT64_C(0xD82FB4B18C6911D8),
    -		UINT64_C(0x9933976E3FD7A785), UINT64_C(0xA6387624AEBDCA4E),
    -		UINT64_C(0xA4833F50344D5A58), UINT64_C(0x9B88DE1AA5273793),
    -		UINT64_C(0xDA94FDC5169981CE), UINT64_C(0xE59F1C8F87F3EC05),
    -		UINT64_C(0x58ACBA7A71E4ED74), UINT64_C(0x67A75B30E08E80BF),
    -		UINT64_C(0x26BB78EF533036E2), UINT64_C(0x19B099A5C25A5B29),
    -		UINT64_C(0xCE049A2F10102A85), UINT64_C(0xF10F7B65817A474E),
    -		UINT64_C(0xB01358BA32C4F113), UINT64_C(0x8F18B9F0A3AE9CD8),
    -		UINT64_C(0x322B1F0555B99DA9), UINT64_C(0x0D20FE4FC4D3F062),
    -		UINT64_C(0x4C3CDD90776D463F), UINT64_C(0x73373CDAE6072BF4),
    -		UINT64_C(0x494A4F79428C6613), UINT64_C(0x7641AE33D3E60BD8),
    -		UINT64_C(0x375D8DEC6058BD85), UINT64_C(0x08566CA6F132D04E),
    -		UINT64_C(0xB565CA530725D13F), UINT64_C(0x8A6E2B19964FBCF4),
    -		UINT64_C(0xCB7208C625F10AA9), UINT64_C(0xF479E98CB49B6762),
    -		UINT64_C(0x23CDEA0666D116CE), UINT64_C(0x1CC60B4CF7BB7B05),
    -		UINT64_C(0x5DDA28934405CD58), UINT64_C(0x62D1C9D9D56FA093),
    -		UINT64_C(0xDFE26F2C2378A1E2), UINT64_C(0xE0E98E66B212CC29),
    -		UINT64_C(0xA1F5ADB901AC7A74), UINT64_C(0x9EFE4CF390C617BF),
    -		UINT64_C(0x9C4505870A3687A9), UINT64_C(0xA34EE4CD9B5CEA62),
    -		UINT64_C(0xE252C71228E25C3F), UINT64_C(0xDD592658B98831F4),
    -		UINT64_C(0x606A80AD4F9F3085), UINT64_C(0x5F6161E7DEF55D4E),
    -		UINT64_C(0x1E7D42386D4BEB13), UINT64_C(0x2176A372FC2186D8),
    -		UINT64_C(0xF6C2A0F82E6BF774), UINT64_C(0xC9C941B2BF019ABF),
    -		UINT64_C(0x88D5626D0CBF2CE2), UINT64_C(0xB7DE83279DD54129),
    -		UINT64_C(0x0AED25D26BC24058), UINT64_C(0x35E6C498FAA82D93),
    -		UINT64_C(0x74FAE74749169BCE), UINT64_C(0x4BF1060DD87CF605),
    -		UINT64_C(0xE318EB5CF9EF77C4), UINT64_C(0xDC130A1668851A0F),
    -		UINT64_C(0x9D0F29C9DB3BAC52), UINT64_C(0xA204C8834A51C199),
    -		UINT64_C(0x1F376E76BC46C0E8), UINT64_C(0x203C8F3C2D2CAD23),
    -		UINT64_C(0x6120ACE39E921B7E), UINT64_C(0x5E2B4DA90FF876B5),
    -		UINT64_C(0x899F4E23DDB20719), UINT64_C(0xB694AF694CD86AD2),
    -		UINT64_C(0xF7888CB6FF66DC8F), UINT64_C(0xC8836DFC6E0CB144),
    -		UINT64_C(0x75B0CB09981BB035), UINT64_C(0x4ABB2A430971DDFE),
    -		UINT64_C(0x0BA7099CBACF6BA3), UINT64_C(0x34ACE8D62BA50668),
    -		UINT64_C(0x3617A1A2B155967E), UINT64_C(0x091C40E8203FFBB5),
    -		UINT64_C(0x4800633793814DE8), UINT64_C(0x770B827D02EB2023),
    -		UINT64_C(0xCA382488F4FC2152), UINT64_C(0xF533C5C265964C99),
    -		UINT64_C(0xB42FE61DD628FAC4), UINT64_C(0x8B2407574742970F),
    -		UINT64_C(0x5C9004DD9508E6A3), UINT64_C(0x639BE59704628B68),
    -		UINT64_C(0x2287C648B7DC3D35), UINT64_C(0x1D8C270226B650FE),
    -		UINT64_C(0xA0BF81F7D0A1518F), UINT64_C(0x9FB460BD41CB3C44),
    -		UINT64_C(0xDEA84362F2758A19), UINT64_C(0xE1A3A228631FE7D2),
    -		UINT64_C(0xDBDED18BC794AA35), UINT64_C(0xE4D530C156FEC7FE),
    -		UINT64_C(0xA5C9131EE54071A3), UINT64_C(0x9AC2F254742A1C68),
    -		UINT64_C(0x27F154A1823D1D19), UINT64_C(0x18FAB5EB135770D2),
    -		UINT64_C(0x59E69634A0E9C68F), UINT64_C(0x66ED777E3183AB44),
    -		UINT64_C(0xB15974F4E3C9DAE8), UINT64_C(0x8E5295BE72A3B723),
    -		UINT64_C(0xCF4EB661C11D017E), UINT64_C(0xF045572B50776CB5),
    -		UINT64_C(0x4D76F1DEA6606DC4), UINT64_C(0x727D1094370A000F),
    -		UINT64_C(0x3361334B84B4B652), UINT64_C(0x0C6AD20115DEDB99),
    -		UINT64_C(0x0ED19B758F2E4B8F), UINT64_C(0x31DA7A3F1E442644),
    -		UINT64_C(0x70C659E0ADFA9019), UINT64_C(0x4FCDB8AA3C90FDD2),
    -		UINT64_C(0xF2FE1E5FCA87FCA3), UINT64_C(0xCDF5FF155BED9168),
    -		UINT64_C(0x8CE9DCCAE8532735), UINT64_C(0xB3E23D8079394AFE),
    -		UINT64_C(0x64563E0AAB733B52), UINT64_C(0x5B5DDF403A195699),
    -		UINT64_C(0x1A41FC9F89A7E0C4), UINT64_C(0x254A1DD518CD8D0F),
    -		UINT64_C(0x9879BB20EEDA8C7E), UINT64_C(0xA7725A6A7FB0E1B5),
    -		UINT64_C(0xE66E79B5CC0E57E8), UINT64_C(0xD96598FF5D643A23),
    -		UINT64_C(0x92949EF28518CC26), UINT64_C(0xAD9F7FB81472A1ED),
    -		UINT64_C(0xEC835C67A7CC17B0), UINT64_C(0xD388BD2D36A67A7B),
    -		UINT64_C(0x6EBB1BD8C0B17B0A), UINT64_C(0x51B0FA9251DB16C1),
    -		UINT64_C(0x10ACD94DE265A09C), UINT64_C(0x2FA73807730FCD57),
    -		UINT64_C(0xF8133B8DA145BCFB), UINT64_C(0xC718DAC7302FD130),
    -		UINT64_C(0x8604F9188391676D), UINT64_C(0xB90F185212FB0AA6),
    -		UINT64_C(0x043CBEA7E4EC0BD7), UINT64_C(0x3B375FED7586661C),
    -		UINT64_C(0x7A2B7C32C638D041), UINT64_C(0x45209D785752BD8A),
    -		UINT64_C(0x479BD40CCDA22D9C), UINT64_C(0x789035465CC84057),
    -		UINT64_C(0x398C1699EF76F60A), UINT64_C(0x0687F7D37E1C9BC1),
    -		UINT64_C(0xBBB45126880B9AB0), UINT64_C(0x84BFB06C1961F77B),
    -		UINT64_C(0xC5A393B3AADF4126), UINT64_C(0xFAA872F93BB52CED),
    -		UINT64_C(0x2D1C7173E9FF5D41), UINT64_C(0x121790397895308A),
    -		UINT64_C(0x530BB3E6CB2B86D7), UINT64_C(0x6C0052AC5A41EB1C),
    -		UINT64_C(0xD133F459AC56EA6D), UINT64_C(0xEE3815133D3C87A6),
    -		UINT64_C(0xAF2436CC8E8231FB), UINT64_C(0x902FD7861FE85C30),
    -		UINT64_C(0xAA52A425BB6311D7), UINT64_C(0x9559456F2A097C1C),
    -		UINT64_C(0xD44566B099B7CA41), UINT64_C(0xEB4E87FA08DDA78A),
    -		UINT64_C(0x567D210FFECAA6FB), UINT64_C(0x6976C0456FA0CB30),
    -		UINT64_C(0x286AE39ADC1E7D6D), UINT64_C(0x176102D04D7410A6),
    -		UINT64_C(0xC0D5015A9F3E610A), UINT64_C(0xFFDEE0100E540CC1),
    -		UINT64_C(0xBEC2C3CFBDEABA9C), UINT64_C(0x81C922852C80D757),
    -		UINT64_C(0x3CFA8470DA97D626), UINT64_C(0x03F1653A4BFDBBED),
    -		UINT64_C(0x42ED46E5F8430DB0), UINT64_C(0x7DE6A7AF6929607B),
    -		UINT64_C(0x7F5DEEDBF3D9F06D), UINT64_C(0x40560F9162B39DA6),
    -		UINT64_C(0x014A2C4ED10D2BFB), UINT64_C(0x3E41CD0440674630),
    -		UINT64_C(0x83726BF1B6704741), UINT64_C(0xBC798ABB271A2A8A),
    -		UINT64_C(0xFD65A96494A49CD7), UINT64_C(0xC26E482E05CEF11C),
    -		UINT64_C(0x15DA4BA4D78480B0), UINT64_C(0x2AD1AAEE46EEED7B),
    -		UINT64_C(0x6BCD8931F5505B26), UINT64_C(0x54C6687B643A36ED),
    -		UINT64_C(0xE9F5CE8E922D379C), UINT64_C(0xD6FE2FC403475A57),
    -		UINT64_C(0x97E20C1BB0F9EC0A), UINT64_C(0xA8E9ED51219381C1)
    -	}, {
    -		UINT64_C(0x0000000000000000), UINT64_C(0x1DEE8A5E222CA1DC),
    -		UINT64_C(0x3BDD14BC445943B8), UINT64_C(0x26339EE26675E264),
    -		UINT64_C(0x77BA297888B28770), UINT64_C(0x6A54A326AA9E26AC),
    -		UINT64_C(0x4C673DC4CCEBC4C8), UINT64_C(0x5189B79AEEC76514),
    -		UINT64_C(0xEF7452F111650EE0), UINT64_C(0xF29AD8AF3349AF3C),
    -		UINT64_C(0xD4A9464D553C4D58), UINT64_C(0xC947CC137710EC84),
    -		UINT64_C(0x98CE7B8999D78990), UINT64_C(0x8520F1D7BBFB284C),
    -		UINT64_C(0xA3136F35DD8ECA28), UINT64_C(0xBEFDE56BFFA26BF4),
    -		UINT64_C(0x4C300AC98DC40345), UINT64_C(0x51DE8097AFE8A299),
    -		UINT64_C(0x77ED1E75C99D40FD), UINT64_C(0x6A03942BEBB1E121),
    -		UINT64_C(0x3B8A23B105768435), UINT64_C(0x2664A9EF275A25E9),
    -		UINT64_C(0x0057370D412FC78D), UINT64_C(0x1DB9BD5363036651),
    -		UINT64_C(0xA34458389CA10DA5), UINT64_C(0xBEAAD266BE8DAC79),
    -		UINT64_C(0x98994C84D8F84E1D), UINT64_C(0x8577C6DAFAD4EFC1),
    -		UINT64_C(0xD4FE714014138AD5), UINT64_C(0xC910FB1E363F2B09),
    -		UINT64_C(0xEF2365FC504AC96D), UINT64_C(0xF2CDEFA2726668B1),
    -		UINT64_C(0x986015931B88068A), UINT64_C(0x858E9FCD39A4A756),
    -		UINT64_C(0xA3BD012F5FD14532), UINT64_C(0xBE538B717DFDE4EE),
    -		UINT64_C(0xEFDA3CEB933A81FA), UINT64_C(0xF234B6B5B1162026),
    -		UINT64_C(0xD4072857D763C242), UINT64_C(0xC9E9A209F54F639E),
    -		UINT64_C(0x771447620AED086A), UINT64_C(0x6AFACD3C28C1A9B6),
    -		UINT64_C(0x4CC953DE4EB44BD2), UINT64_C(0x5127D9806C98EA0E),
    -		UINT64_C(0x00AE6E1A825F8F1A), UINT64_C(0x1D40E444A0732EC6),
    -		UINT64_C(0x3B737AA6C606CCA2), UINT64_C(0x269DF0F8E42A6D7E),
    -		UINT64_C(0xD4501F5A964C05CF), UINT64_C(0xC9BE9504B460A413),
    -		UINT64_C(0xEF8D0BE6D2154677), UINT64_C(0xF26381B8F039E7AB),
    -		UINT64_C(0xA3EA36221EFE82BF), UINT64_C(0xBE04BC7C3CD22363),
    -		UINT64_C(0x9837229E5AA7C107), UINT64_C(0x85D9A8C0788B60DB),
    -		UINT64_C(0x3B244DAB87290B2F), UINT64_C(0x26CAC7F5A505AAF3),
    -		UINT64_C(0x00F95917C3704897), UINT64_C(0x1D17D349E15CE94B),
    -		UINT64_C(0x4C9E64D30F9B8C5F), UINT64_C(0x5170EE8D2DB72D83),
    -		UINT64_C(0x7743706F4BC2CFE7), UINT64_C(0x6AADFA3169EE6E3B),
    -		UINT64_C(0xA218840D981E1391), UINT64_C(0xBFF60E53BA32B24D),
    -		UINT64_C(0x99C590B1DC475029), UINT64_C(0x842B1AEFFE6BF1F5),
    -		UINT64_C(0xD5A2AD7510AC94E1), UINT64_C(0xC84C272B3280353D),
    -		UINT64_C(0xEE7FB9C954F5D759), UINT64_C(0xF391339776D97685),
    -		UINT64_C(0x4D6CD6FC897B1D71), UINT64_C(0x50825CA2AB57BCAD),
    -		UINT64_C(0x76B1C240CD225EC9), UINT64_C(0x6B5F481EEF0EFF15),
    -		UINT64_C(0x3AD6FF8401C99A01), UINT64_C(0x273875DA23E53BDD),
    -		UINT64_C(0x010BEB384590D9B9), UINT64_C(0x1CE5616667BC7865),
    -		UINT64_C(0xEE288EC415DA10D4), UINT64_C(0xF3C6049A37F6B108),
    -		UINT64_C(0xD5F59A785183536C), UINT64_C(0xC81B102673AFF2B0),
    -		UINT64_C(0x9992A7BC9D6897A4), UINT64_C(0x847C2DE2BF443678),
    -		UINT64_C(0xA24FB300D931D41C), UINT64_C(0xBFA1395EFB1D75C0),
    -		UINT64_C(0x015CDC3504BF1E34), UINT64_C(0x1CB2566B2693BFE8),
    -		UINT64_C(0x3A81C88940E65D8C), UINT64_C(0x276F42D762CAFC50),
    -		UINT64_C(0x76E6F54D8C0D9944), UINT64_C(0x6B087F13AE213898),
    -		UINT64_C(0x4D3BE1F1C854DAFC), UINT64_C(0x50D56BAFEA787B20),
    -		UINT64_C(0x3A78919E8396151B), UINT64_C(0x27961BC0A1BAB4C7),
    -		UINT64_C(0x01A58522C7CF56A3), UINT64_C(0x1C4B0F7CE5E3F77F),
    -		UINT64_C(0x4DC2B8E60B24926B), UINT64_C(0x502C32B8290833B7),
    -		UINT64_C(0x761FAC5A4F7DD1D3), UINT64_C(0x6BF126046D51700F),
    -		UINT64_C(0xD50CC36F92F31BFB), UINT64_C(0xC8E24931B0DFBA27),
    -		UINT64_C(0xEED1D7D3D6AA5843), UINT64_C(0xF33F5D8DF486F99F),
    -		UINT64_C(0xA2B6EA171A419C8B), UINT64_C(0xBF586049386D3D57),
    -		UINT64_C(0x996BFEAB5E18DF33), UINT64_C(0x848574F57C347EEF),
    -		UINT64_C(0x76489B570E52165E), UINT64_C(0x6BA611092C7EB782),
    -		UINT64_C(0x4D958FEB4A0B55E6), UINT64_C(0x507B05B56827F43A),
    -		UINT64_C(0x01F2B22F86E0912E), UINT64_C(0x1C1C3871A4CC30F2),
    -		UINT64_C(0x3A2FA693C2B9D296), UINT64_C(0x27C12CCDE095734A),
    -		UINT64_C(0x993CC9A61F3718BE), UINT64_C(0x84D243F83D1BB962),
    -		UINT64_C(0xA2E1DD1A5B6E5B06), UINT64_C(0xBF0F57447942FADA),
    -		UINT64_C(0xEE86E0DE97859FCE), UINT64_C(0xF3686A80B5A93E12),
    -		UINT64_C(0xD55BF462D3DCDC76), UINT64_C(0xC8B57E3CF1F07DAA),
    -		UINT64_C(0xD6E9A7309F3239A7), UINT64_C(0xCB072D6EBD1E987B),
    -		UINT64_C(0xED34B38CDB6B7A1F), UINT64_C(0xF0DA39D2F947DBC3),
    -		UINT64_C(0xA1538E481780BED7), UINT64_C(0xBCBD041635AC1F0B),
    -		UINT64_C(0x9A8E9AF453D9FD6F), UINT64_C(0x876010AA71F55CB3),
    -		UINT64_C(0x399DF5C18E573747), UINT64_C(0x24737F9FAC7B969B),
    -		UINT64_C(0x0240E17DCA0E74FF), UINT64_C(0x1FAE6B23E822D523),
    -		UINT64_C(0x4E27DCB906E5B037), UINT64_C(0x53C956E724C911EB),
    -		UINT64_C(0x75FAC80542BCF38F), UINT64_C(0x6814425B60905253),
    -		UINT64_C(0x9AD9ADF912F63AE2), UINT64_C(0x873727A730DA9B3E),
    -		UINT64_C(0xA104B94556AF795A), UINT64_C(0xBCEA331B7483D886),
    -		UINT64_C(0xED6384819A44BD92), UINT64_C(0xF08D0EDFB8681C4E),
    -		UINT64_C(0xD6BE903DDE1DFE2A), UINT64_C(0xCB501A63FC315FF6),
    -		UINT64_C(0x75ADFF0803933402), UINT64_C(0x6843755621BF95DE),
    -		UINT64_C(0x4E70EBB447CA77BA), UINT64_C(0x539E61EA65E6D666),
    -		UINT64_C(0x0217D6708B21B372), UINT64_C(0x1FF95C2EA90D12AE),
    -		UINT64_C(0x39CAC2CCCF78F0CA), UINT64_C(0x24244892ED545116),
    -		UINT64_C(0x4E89B2A384BA3F2D), UINT64_C(0x536738FDA6969EF1),
    -		UINT64_C(0x7554A61FC0E37C95), UINT64_C(0x68BA2C41E2CFDD49),
    -		UINT64_C(0x39339BDB0C08B85D), UINT64_C(0x24DD11852E241981),
    -		UINT64_C(0x02EE8F674851FBE5), UINT64_C(0x1F0005396A7D5A39),
    -		UINT64_C(0xA1FDE05295DF31CD), UINT64_C(0xBC136A0CB7F39011),
    -		UINT64_C(0x9A20F4EED1867275), UINT64_C(0x87CE7EB0F3AAD3A9),
    -		UINT64_C(0xD647C92A1D6DB6BD), UINT64_C(0xCBA943743F411761),
    -		UINT64_C(0xED9ADD965934F505), UINT64_C(0xF07457C87B1854D9),
    -		UINT64_C(0x02B9B86A097E3C68), UINT64_C(0x1F5732342B529DB4),
    -		UINT64_C(0x3964ACD64D277FD0), UINT64_C(0x248A26886F0BDE0C),
    -		UINT64_C(0x7503911281CCBB18), UINT64_C(0x68ED1B4CA3E01AC4),
    -		UINT64_C(0x4EDE85AEC595F8A0), UINT64_C(0x53300FF0E7B9597C),
    -		UINT64_C(0xEDCDEA9B181B3288), UINT64_C(0xF02360C53A379354),
    -		UINT64_C(0xD610FE275C427130), UINT64_C(0xCBFE74797E6ED0EC),
    -		UINT64_C(0x9A77C3E390A9B5F8), UINT64_C(0x879949BDB2851424),
    -		UINT64_C(0xA1AAD75FD4F0F640), UINT64_C(0xBC445D01F6DC579C),
    -		UINT64_C(0x74F1233D072C2A36), UINT64_C(0x691FA96325008BEA),
    -		UINT64_C(0x4F2C37814375698E), UINT64_C(0x52C2BDDF6159C852),
    -		UINT64_C(0x034B0A458F9EAD46), UINT64_C(0x1EA5801BADB20C9A),
    -		UINT64_C(0x38961EF9CBC7EEFE), UINT64_C(0x257894A7E9EB4F22),
    -		UINT64_C(0x9B8571CC164924D6), UINT64_C(0x866BFB923465850A),
    -		UINT64_C(0xA05865705210676E), UINT64_C(0xBDB6EF2E703CC6B2),
    -		UINT64_C(0xEC3F58B49EFBA3A6), UINT64_C(0xF1D1D2EABCD7027A),
    -		UINT64_C(0xD7E24C08DAA2E01E), UINT64_C(0xCA0CC656F88E41C2),
    -		UINT64_C(0x38C129F48AE82973), UINT64_C(0x252FA3AAA8C488AF),
    -		UINT64_C(0x031C3D48CEB16ACB), UINT64_C(0x1EF2B716EC9DCB17),
    -		UINT64_C(0x4F7B008C025AAE03), UINT64_C(0x52958AD220760FDF),
    -		UINT64_C(0x74A614304603EDBB), UINT64_C(0x69489E6E642F4C67),
    -		UINT64_C(0xD7B57B059B8D2793), UINT64_C(0xCA5BF15BB9A1864F),
    -		UINT64_C(0xEC686FB9DFD4642B), UINT64_C(0xF186E5E7FDF8C5F7),
    -		UINT64_C(0xA00F527D133FA0E3), UINT64_C(0xBDE1D8233113013F),
    -		UINT64_C(0x9BD246C15766E35B), UINT64_C(0x863CCC9F754A4287),
    -		UINT64_C(0xEC9136AE1CA42CBC), UINT64_C(0xF17FBCF03E888D60),
    -		UINT64_C(0xD74C221258FD6F04), UINT64_C(0xCAA2A84C7AD1CED8),
    -		UINT64_C(0x9B2B1FD69416ABCC), UINT64_C(0x86C59588B63A0A10),
    -		UINT64_C(0xA0F60B6AD04FE874), UINT64_C(0xBD188134F26349A8),
    -		UINT64_C(0x03E5645F0DC1225C), UINT64_C(0x1E0BEE012FED8380),
    -		UINT64_C(0x383870E3499861E4), UINT64_C(0x25D6FABD6BB4C038),
    -		UINT64_C(0x745F4D278573A52C), UINT64_C(0x69B1C779A75F04F0),
    -		UINT64_C(0x4F82599BC12AE694), UINT64_C(0x526CD3C5E3064748),
    -		UINT64_C(0xA0A13C6791602FF9), UINT64_C(0xBD4FB639B34C8E25),
    -		UINT64_C(0x9B7C28DBD5396C41), UINT64_C(0x8692A285F715CD9D),
    -		UINT64_C(0xD71B151F19D2A889), UINT64_C(0xCAF59F413BFE0955),
    -		UINT64_C(0xECC601A35D8BEB31), UINT64_C(0xF1288BFD7FA74AED),
    -		UINT64_C(0x4FD56E9680052119), UINT64_C(0x523BE4C8A22980C5),
    -		UINT64_C(0x74087A2AC45C62A1), UINT64_C(0x69E6F074E670C37D),
    -		UINT64_C(0x386F47EE08B7A669), UINT64_C(0x2581CDB02A9B07B5),
    -		UINT64_C(0x03B253524CEEE5D1), UINT64_C(0x1E5CD90C6EC2440D)
    -	}
    -};
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc64_tablegen.c b/external/public-domain/xz/dist/src/liblzma/check/crc64_tablegen.c
    deleted file mode 100644
    index fddaa7ed1..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc64_tablegen.c
    +++ /dev/null
    @@ -1,88 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc64_tablegen.c
    -/// \brief      Generate crc64_table_le.h and crc64_table_be.h
    -///
    -/// Compiling: gcc -std=c99 -o crc64_tablegen crc64_tablegen.c
    -/// Add -DWORDS_BIGENDIAN to generate big endian table.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include 
    -#include "../../common/tuklib_integer.h"
    -
    -
    -static uint64_t crc64_table[4][256];
    -
    -
    -extern void
    -init_crc64_table(void)
    -{
    -	static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42);
    -
    -	for (size_t s = 0; s < 4; ++s) {
    -		for (size_t b = 0; b < 256; ++b) {
    -			uint64_t r = s == 0 ? b : crc64_table[s - 1][b];
    -
    -			for (size_t i = 0; i < 8; ++i) {
    -				if (r & 1)
    -					r = (r >> 1) ^ poly64;
    -				else
    -					r >>= 1;
    -			}
    -
    -			crc64_table[s][b] = r;
    -		}
    -	}
    -
    -#ifdef WORDS_BIGENDIAN
    -	for (size_t s = 0; s < 4; ++s)
    -		for (size_t b = 0; b < 256; ++b)
    -			crc64_table[s][b] = bswap64(crc64_table[s][b]);
    -#endif
    -
    -	return;
    -}
    -
    -
    -static void
    -print_crc64_table(void)
    -{
    -	printf("/* This file has been automatically generated by "
    -			"crc64_tablegen.c. */\n\n"
    -			"const uint64_t lzma_crc64_table[4][256] = {\n\t{");
    -
    -	for (size_t s = 0; s < 4; ++s) {
    -		for (size_t b = 0; b < 256; ++b) {
    -			if ((b % 2) == 0)
    -				printf("\n\t\t");
    -
    -			printf("UINT64_C(0x%016" PRIX64 ")",
    -					crc64_table[s][b]);
    -
    -			if (b != 255)
    -				printf(",%s", (b+1) % 2 == 0 ? "" : " ");
    -		}
    -
    -		if (s == 3)
    -			printf("\n\t}\n};\n");
    -		else
    -			printf("\n\t}, {");
    -	}
    -
    -	return;
    -}
    -
    -
    -int
    -main(void)
    -{
    -	init_crc64_table();
    -	print_crc64_table();
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc64_x86.S b/external/public-domain/xz/dist/src/liblzma/check/crc64_x86.S
    deleted file mode 100644
    index f5bb84b97..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc64_x86.S
    +++ /dev/null
    @@ -1,287 +0,0 @@
    -/*
    - * Speed-optimized CRC64 using slicing-by-four algorithm
    - *
    - * This uses only i386 instructions, but it is optimized for i686 and later
    - * (including e.g. Pentium II/III/IV, Athlon XP, and Core 2).
    - *
    - * Authors: Igor Pavlov (original CRC32 assembly code)
    - *          Lasse Collin (CRC64 adaptation of the modified CRC32 code)
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - *
    - * This code needs lzma_crc64_table, which can be created using the
    - * following C code:
    -
    -uint64_t lzma_crc64_table[4][256];
    -
    -void
    -init_table(void)
    -{
    -	// ECMA-182
    -	static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42);
    -
    -	for (size_t s = 0; s < 4; ++s) {
    -		for (size_t b = 0; b < 256; ++b) {
    -			uint64_t r = s == 0 ? b : lzma_crc64_table[s - 1][b];
    -
    -			for (size_t i = 0; i < 8; ++i) {
    -				if (r & 1)
    -					r = (r >> 1) ^ poly64;
    -				else
    -					r >>= 1;
    -			}
    -
    -			lzma_crc64_table[s][b] = r;
    -		}
    -	}
    -}
    -
    - * The prototype of the CRC64 function:
    - * extern uint64_t lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc);
    - */
    -
    -/*
    - * On some systems, the functions need to be prefixed. The prefix is
    - * usually an underscore.
    - */
    -#ifndef __USER_LABEL_PREFIX__
    -#	define __USER_LABEL_PREFIX__
    -#endif
    -#define MAKE_SYM_CAT(prefix, sym) prefix ## sym
    -#define MAKE_SYM(prefix, sym) MAKE_SYM_CAT(prefix, sym)
    -#define LZMA_CRC64 MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc64)
    -#define LZMA_CRC64_TABLE MAKE_SYM(__USER_LABEL_PREFIX__, lzma_crc64_table)
    -
    -/*
    - * Solaris assembler doesn't have .p2align, and Darwin uses .align
    - * differently than GNU/Linux and Solaris.
    - */
    -#if defined(__APPLE__) || defined(__MSDOS__)
    -#	define ALIGN(pow2, abs) .align pow2
    -#else
    -#	define ALIGN(pow2, abs) .align abs
    -#endif
    -
    -	.text
    -	.globl	LZMA_CRC64
    -
    -#if !defined(__APPLE__) && !defined(_WIN32) && !defined(__CYGWIN__) \
    -		&& !defined(__MSDOS__)
    -	.type	LZMA_CRC64, @function
    -#endif
    -
    -	ALIGN(4, 16)
    -LZMA_CRC64:
    -	/*
    -	 * Register usage:
    -	 * %eax crc LSB
    -	 * %edx crc MSB
    -	 * %esi buf
    -	 * %edi size or buf + size
    -	 * %ebx lzma_crc64_table
    -	 * %ebp Table index
    -	 * %ecx Temporary
    -	 */
    -	pushl	%ebx
    -	pushl	%esi
    -	pushl	%edi
    -	pushl	%ebp
    -	movl	0x14(%esp), %esi /* buf */
    -	movl	0x18(%esp), %edi /* size */
    -	movl	0x1C(%esp), %eax /* crc LSB */
    -	movl	0x20(%esp), %edx /* crc MSB */
    -
    -	/*
    -	 * Store the address of lzma_crc64_table to %ebx. This is needed to
    -	 * get position-independent code (PIC).
    -	 *
    -	 * The PIC macro is defined by libtool, while __PIC__ is defined
    -	 * by GCC but only on some systems. Testing for both makes it simpler
    -	 * to test this code without libtool, and keeps the code working also
    -	 * when built with libtool but using something else than GCC.
    -	 *
    -	 * I understood that libtool may define PIC on Windows even though
    -	 * the code in Windows DLLs is not PIC in sense that it is in ELF
    -	 * binaries, so we need a separate check to always use the non-PIC
    -	 * code on Windows.
    -	 */
    -#if (!defined(PIC) && !defined(__PIC__)) \
    -		|| (defined(_WIN32) || defined(__CYGWIN__))
    -	/* Not PIC */
    -	movl	$ LZMA_CRC64_TABLE, %ebx
    -#elif defined(__APPLE__)
    -	/* Mach-O */
    -	call	.L_get_pc
    -.L_pic:
    -	leal	.L_lzma_crc64_table$non_lazy_ptr-.L_pic(%ebx), %ebx
    -	movl	(%ebx), %ebx
    -#else
    -	/* ELF */
    -	call	.L_get_pc
    -	addl	$_GLOBAL_OFFSET_TABLE_, %ebx
    -	movl	LZMA_CRC64_TABLE@GOT(%ebx), %ebx
    -#endif
    -
    -	/* Complement the initial value. */
    -	notl	%eax
    -	notl	%edx
    -
    -.L_align:
    -	/*
    -	 * Check if there is enough input to use slicing-by-four.
    -	 * We need eight bytes, because the loop pre-reads four bytes.
    -	 */
    -	cmpl	$8, %edi
    -	jb	.L_rest
    -
    -	/* Check if we have reached alignment of four bytes. */
    -	testl	$3, %esi
    -	jz	.L_slice
    -
    -	/* Calculate CRC of the next input byte. */
    -	movzbl	(%esi), %ebp
    -	incl	%esi
    -	movzbl	%al, %ecx
    -	xorl	%ecx, %ebp
    -	shrdl	$8, %edx, %eax
    -	xorl	(%ebx, %ebp, 8), %eax
    -	shrl	$8, %edx
    -	xorl	4(%ebx, %ebp, 8), %edx
    -	decl	%edi
    -	jmp	.L_align
    -
    -.L_slice:
    -	/*
    -	 * If we get here, there's at least eight bytes of aligned input
    -	 * available. Make %edi multiple of four bytes. Store the possible
    -	 * remainder over the "size" variable in the argument stack.
    -	 */
    -	movl	%edi, 0x18(%esp)
    -	andl	$-4, %edi
    -	subl	%edi, 0x18(%esp)
    -
    -	/*
    -	 * Let %edi be buf + size - 4 while running the main loop. This way
    -	 * we can compare for equality to determine when exit the loop.
    -	 */
    -	addl	%esi, %edi
    -	subl	$4, %edi
    -
    -	/* Read in the first four aligned bytes. */
    -	movl	(%esi), %ecx
    -
    -.L_loop:
    -	xorl	%eax, %ecx
    -	movzbl	%cl, %ebp
    -	movl	0x1800(%ebx, %ebp, 8), %eax
    -	xorl	%edx, %eax
    -	movl	0x1804(%ebx, %ebp, 8), %edx
    -	movzbl	%ch, %ebp
    -	xorl	0x1000(%ebx, %ebp, 8), %eax
    -	xorl	0x1004(%ebx, %ebp, 8), %edx
    -	shrl	$16, %ecx
    -	movzbl	%cl, %ebp
    -	xorl	0x0800(%ebx, %ebp, 8), %eax
    -	xorl	0x0804(%ebx, %ebp, 8), %edx
    -	movzbl	%ch, %ebp
    -	addl	$4, %esi
    -	xorl	(%ebx, %ebp, 8), %eax
    -	xorl	4(%ebx, %ebp, 8), %edx
    -
    -	/* Check for end of aligned input. */
    -	cmpl	%edi, %esi
    -
    -	/*
    -	 * Copy the next input byte to %ecx. It is slightly faster to
    -	 * read it here than at the top of the loop.
    -	 */
    -	movl	(%esi), %ecx
    -	jb	.L_loop
    -
    -	/*
    -	 * Process the remaining four bytes, which we have already
    -	 * copied to %ecx.
    -	 */
    -	xorl	%eax, %ecx
    -	movzbl	%cl, %ebp
    -	movl	0x1800(%ebx, %ebp, 8), %eax
    -	xorl	%edx, %eax
    -	movl	0x1804(%ebx, %ebp, 8), %edx
    -	movzbl	%ch, %ebp
    -	xorl	0x1000(%ebx, %ebp, 8), %eax
    -	xorl	0x1004(%ebx, %ebp, 8), %edx
    -	shrl	$16, %ecx
    -	movzbl	%cl, %ebp
    -	xorl	0x0800(%ebx, %ebp, 8), %eax
    -	xorl	0x0804(%ebx, %ebp, 8), %edx
    -	movzbl	%ch, %ebp
    -	addl	$4, %esi
    -	xorl	(%ebx, %ebp, 8), %eax
    -	xorl	4(%ebx, %ebp, 8), %edx
    -
    -	/* Copy the number of remaining bytes to %edi. */
    -	movl	0x18(%esp), %edi
    -
    -.L_rest:
    -	/* Check for end of input. */
    -	testl	%edi, %edi
    -	jz	.L_return
    -
    -	/* Calculate CRC of the next input byte. */
    -	movzbl	(%esi), %ebp
    -	incl	%esi
    -	movzbl	%al, %ecx
    -	xorl	%ecx, %ebp
    -	shrdl	$8, %edx, %eax
    -	xorl	(%ebx, %ebp, 8), %eax
    -	shrl	$8, %edx
    -	xorl	4(%ebx, %ebp, 8), %edx
    -	decl	%edi
    -	jmp	.L_rest
    -
    -.L_return:
    -	/* Complement the final value. */
    -	notl	%eax
    -	notl	%edx
    -
    -	popl	%ebp
    -	popl	%edi
    -	popl	%esi
    -	popl	%ebx
    -	ret
    -
    -#if defined(PIC) || defined(__PIC__)
    -	ALIGN(4, 16)
    -.L_get_pc:
    -	movl	(%esp), %ebx
    -	ret
    -#endif
    -
    -#if defined(__APPLE__) && (defined(PIC) || defined(__PIC__))
    -	/* Mach-O PIC */
    -	.section __IMPORT,__pointers,non_lazy_symbol_pointers
    -.L_lzma_crc64_table$non_lazy_ptr:
    -	.indirect_symbol LZMA_CRC64_TABLE
    -	.long 0
    -
    -#elif defined(_WIN32) || defined(__CYGWIN__)
    -#	ifdef DLL_EXPORT
    -	/* This is equivalent of __declspec(dllexport). */
    -	.section .drectve
    -	.ascii " -export:lzma_crc64"
    -#	endif
    -
    -#elif !defined(__MSDOS__)
    -	/* ELF */
    -	.size	LZMA_CRC64, .-LZMA_CRC64
    -#endif
    -
    -/*
    - * This is needed to support non-executable stack. It's ugly to
    - * use __linux__ here, but I don't know a way to detect when
    - * we are using GNU assembler.
    - */
    -#if defined(__ELF__) && defined(__linux__)
    -	.section	.note.GNU-stack,"",@progbits
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/crc_macros.h b/external/public-domain/xz/dist/src/liblzma/check/crc_macros.h
    deleted file mode 100644
    index a7c21b765..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/crc_macros.h
    +++ /dev/null
    @@ -1,30 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       crc_macros.h
    -/// \brief      Some endian-dependent macros for CRC32 and CRC64
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifdef WORDS_BIGENDIAN
    -#	define A(x) ((x) >> 24)
    -#	define B(x) (((x) >> 16) & 0xFF)
    -#	define C(x) (((x) >> 8) & 0xFF)
    -#	define D(x) ((x) & 0xFF)
    -
    -#	define S8(x) ((x) << 8)
    -#	define S32(x) ((x) << 32)
    -
    -#else
    -#	define A(x) ((x) & 0xFF)
    -#	define B(x) (((x) >> 8) & 0xFF)
    -#	define C(x) (((x) >> 16) & 0xFF)
    -#	define D(x) ((x) >> 24)
    -
    -#	define S8(x) ((x) >> 8)
    -#	define S32(x) ((x) >> 32)
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/check/sha256.c b/external/public-domain/xz/dist/src/liblzma/check/sha256.c
    deleted file mode 100644
    index 5eede5ce0..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/check/sha256.c
    +++ /dev/null
    @@ -1,196 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       sha256.c
    -/// \brief      SHA-256
    -///
    -/// \todo       Crypto++ has x86 ASM optimizations. They use SSE so if they
    -///             are imported to liblzma, SSE instructions need to be used
    -///             conditionally to keep the code working on older boxes.
    -//
    -//  This code is based on the code found from 7-Zip, which has a modified
    -//  version of the SHA-256 found from Crypto++ .
    -//  The code was modified a little to fit into liblzma.
    -//
    -//  Authors:    Kevin Springle
    -//              Wei Dai
    -//              Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "check.h"
    -
    -// Rotate a uint32_t. GCC can optimize this to a rotate instruction
    -// at least on x86.
    -static inline uint32_t
    -rotr_32(uint32_t num, unsigned amount)
    -{
    -        return (num >> amount) | (num << (32 - amount));
    -}
    -
    -#define blk0(i) (W[i] = conv32be(data[i]))
    -#define blk2(i) (W[i & 15] += s1(W[(i - 2) & 15]) + W[(i - 7) & 15] \
    -		+ s0(W[(i - 15) & 15]))
    -
    -#define Ch(x, y, z) (z ^ (x & (y ^ z)))
    -#define Maj(x, y, z) ((x & (y ^ z)) + (y & z))
    -
    -#define a(i) T[(0 - i) & 7]
    -#define b(i) T[(1 - i) & 7]
    -#define c(i) T[(2 - i) & 7]
    -#define d(i) T[(3 - i) & 7]
    -#define e(i) T[(4 - i) & 7]
    -#define f(i) T[(5 - i) & 7]
    -#define g(i) T[(6 - i) & 7]
    -#define h(i) T[(7 - i) & 7]
    -
    -#define R(i, j, blk) \
    -	h(i) += S1(e(i)) + Ch(e(i), f(i), g(i)) + SHA256_K[i + j] + blk; \
    -	d(i) += h(i); \
    -	h(i) += S0(a(i)) + Maj(a(i), b(i), c(i))
    -#define R0(i) R(i, 0, blk0(i))
    -#define R2(i) R(i, j, blk2(i))
    -
    -#define S0(x) rotr_32(x ^ rotr_32(x ^ rotr_32(x, 9), 11), 2)
    -#define S1(x) rotr_32(x ^ rotr_32(x ^ rotr_32(x, 14), 5), 6)
    -#define s0(x) (rotr_32(x ^ rotr_32(x, 11), 7) ^ (x >> 3))
    -#define s1(x) (rotr_32(x ^ rotr_32(x, 2), 17) ^ (x >> 10))
    -
    -
    -static const uint32_t SHA256_K[64] = {
    -	0x428A2F98, 0x71374491, 0xB5C0FBCF, 0xE9B5DBA5,
    -	0x3956C25B, 0x59F111F1, 0x923F82A4, 0xAB1C5ED5,
    -	0xD807AA98, 0x12835B01, 0x243185BE, 0x550C7DC3,
    -	0x72BE5D74, 0x80DEB1FE, 0x9BDC06A7, 0xC19BF174,
    -	0xE49B69C1, 0xEFBE4786, 0x0FC19DC6, 0x240CA1CC,
    -	0x2DE92C6F, 0x4A7484AA, 0x5CB0A9DC, 0x76F988DA,
    -	0x983E5152, 0xA831C66D, 0xB00327C8, 0xBF597FC7,
    -	0xC6E00BF3, 0xD5A79147, 0x06CA6351, 0x14292967,
    -	0x27B70A85, 0x2E1B2138, 0x4D2C6DFC, 0x53380D13,
    -	0x650A7354, 0x766A0ABB, 0x81C2C92E, 0x92722C85,
    -	0xA2BFE8A1, 0xA81A664B, 0xC24B8B70, 0xC76C51A3,
    -	0xD192E819, 0xD6990624, 0xF40E3585, 0x106AA070,
    -	0x19A4C116, 0x1E376C08, 0x2748774C, 0x34B0BCB5,
    -	0x391C0CB3, 0x4ED8AA4A, 0x5B9CCA4F, 0x682E6FF3,
    -	0x748F82EE, 0x78A5636F, 0x84C87814, 0x8CC70208,
    -	0x90BEFFFA, 0xA4506CEB, 0xBEF9A3F7, 0xC67178F2,
    -};
    -
    -
    -static void
    -transform(uint32_t state[8], const uint32_t data[16])
    -{
    -	uint32_t W[16];
    -	uint32_t T[8];
    -
    -	// Copy state[] to working vars.
    -	memcpy(T, state, sizeof(T));
    -
    -	// The first 16 operations unrolled
    -	R0( 0); R0( 1); R0( 2); R0( 3);
    -	R0( 4); R0( 5); R0( 6); R0( 7);
    -	R0( 8); R0( 9); R0(10); R0(11);
    -	R0(12); R0(13); R0(14); R0(15);
    -
    -	// The remaining 48 operations partially unrolled
    -	for (unsigned int j = 16; j < 64; j += 16) {
    -		R2( 0); R2( 1); R2( 2); R2( 3);
    -		R2( 4); R2( 5); R2( 6); R2( 7);
    -		R2( 8); R2( 9); R2(10); R2(11);
    -		R2(12); R2(13); R2(14); R2(15);
    -	}
    -
    -	// Add the working vars back into state[].
    -	state[0] += a(0);
    -	state[1] += b(0);
    -	state[2] += c(0);
    -	state[3] += d(0);
    -	state[4] += e(0);
    -	state[5] += f(0);
    -	state[6] += g(0);
    -	state[7] += h(0);
    -}
    -
    -
    -static void
    -process(lzma_check_state *check)
    -{
    -	transform(check->state.sha256.state, check->buffer.u32);
    -	return;
    -}
    -
    -
    -extern void
    -lzma_sha256_init(lzma_check_state *check)
    -{
    -	static const uint32_t s[8] = {
    -		0x6A09E667, 0xBB67AE85, 0x3C6EF372, 0xA54FF53A,
    -		0x510E527F, 0x9B05688C, 0x1F83D9AB, 0x5BE0CD19,
    -	};
    -
    -	memcpy(check->state.sha256.state, s, sizeof(s));
    -	check->state.sha256.size = 0;
    -
    -	return;
    -}
    -
    -
    -extern void
    -lzma_sha256_update(const uint8_t *buf, size_t size, lzma_check_state *check)
    -{
    -	// Copy the input data into a properly aligned temporary buffer.
    -	// This way we can be called with arbitrarily sized buffers
    -	// (no need to be multiple of 64 bytes), and the code works also
    -	// on architectures that don't allow unaligned memory access.
    -	while (size > 0) {
    -		const size_t copy_start = check->state.sha256.size & 0x3F;
    -		size_t copy_size = 64 - copy_start;
    -		if (copy_size > size)
    -			copy_size = size;
    -
    -		memcpy(check->buffer.u8 + copy_start, buf, copy_size);
    -
    -		buf += copy_size;
    -		size -= copy_size;
    -		check->state.sha256.size += copy_size;
    -
    -		if ((check->state.sha256.size & 0x3F) == 0)
    -			process(check);
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -lzma_sha256_finish(lzma_check_state *check)
    -{
    -	// Add padding as described in RFC 3174 (it describes SHA-1 but
    -	// the same padding style is used for SHA-256 too).
    -	size_t pos = check->state.sha256.size & 0x3F;
    -	check->buffer.u8[pos++] = 0x80;
    -
    -	while (pos != 64 - 8) {
    -		if (pos == 64) {
    -			process(check);
    -			pos = 0;
    -		}
    -
    -		check->buffer.u8[pos++] = 0x00;
    -	}
    -
    -	// Convert the message size from bytes to bits.
    -	check->state.sha256.size *= 8;
    -
    -	check->buffer.u64[(64 - 8) / 8] = conv64be(check->state.sha256.size);
    -
    -	process(check);
    -
    -	for (size_t i = 0; i < 8; ++i)
    -		check->buffer.u32[i] = conv32be(check->state.sha256.state[i]);
    -
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/alone_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/alone_decoder.c
    deleted file mode 100644
    index c1360ca1e..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/alone_decoder.c
    +++ /dev/null
    @@ -1,238 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       alone_decoder.c
    -/// \brief      Decoder for LZMA_Alone files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "alone_decoder.h"
    -#include "lzma_decoder.h"
    -#include "lz_decoder.h"
    -
    -
    -struct lzma_coder_s {
    -	lzma_next_coder next;
    -
    -	enum {
    -		SEQ_PROPERTIES,
    -		SEQ_DICTIONARY_SIZE,
    -		SEQ_UNCOMPRESSED_SIZE,
    -		SEQ_CODER_INIT,
    -		SEQ_CODE,
    -	} sequence;
    -
    -	/// If true, reject files that are unlikely to be .lzma files.
    -	/// If false, more non-.lzma files get accepted and will give
    -	/// LZMA_DATA_ERROR either immediately or after a few output bytes.
    -	bool picky;
    -
    -	/// Position in the header fields
    -	size_t pos;
    -
    -	/// Uncompressed size decoded from the header
    -	lzma_vli uncompressed_size;
    -
    -	/// Memory usage limit
    -	uint64_t memlimit;
    -
    -	/// Amount of memory actually needed (only an estimate)
    -	uint64_t memusage;
    -
    -	/// Options decoded from the header needed to initialize
    -	/// the LZMA decoder
    -	lzma_options_lzma options;
    -};
    -
    -
    -static lzma_ret
    -alone_decode(lzma_coder *coder,
    -		const lzma_allocator *allocator lzma_attribute((__unused__)),
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size,
    -		lzma_action action)
    -{
    -	while (*out_pos < out_size
    -			&& (coder->sequence == SEQ_CODE || *in_pos < in_size))
    -	switch (coder->sequence) {
    -	case SEQ_PROPERTIES:
    -		if (lzma_lzma_lclppb_decode(&coder->options, in[*in_pos]))
    -			return LZMA_FORMAT_ERROR;
    -
    -		coder->sequence = SEQ_DICTIONARY_SIZE;
    -		++*in_pos;
    -		break;
    -
    -	case SEQ_DICTIONARY_SIZE:
    -		coder->options.dict_size
    -				|= (size_t)(in[*in_pos]) << (coder->pos * 8);
    -
    -		if (++coder->pos == 4) {
    -			if (coder->picky && coder->options.dict_size
    -					!= UINT32_MAX) {
    -				// A hack to ditch tons of false positives:
    -				// We allow only dictionary sizes that are
    -				// 2^n or 2^n + 2^(n-1). LZMA_Alone created
    -				// only files with 2^n, but accepts any
    -				// dictionary size.
    -				uint32_t d = coder->options.dict_size - 1;
    -				d |= d >> 2;
    -				d |= d >> 3;
    -				d |= d >> 4;
    -				d |= d >> 8;
    -				d |= d >> 16;
    -				++d;
    -
    -				if (d != coder->options.dict_size)
    -					return LZMA_FORMAT_ERROR;
    -			}
    -
    -			coder->pos = 0;
    -			coder->sequence = SEQ_UNCOMPRESSED_SIZE;
    -		}
    -
    -		++*in_pos;
    -		break;
    -
    -	case SEQ_UNCOMPRESSED_SIZE:
    -		coder->uncompressed_size
    -				|= (lzma_vli)(in[*in_pos]) << (coder->pos * 8);
    -		++*in_pos;
    -		if (++coder->pos < 8)
    -			break;
    -
    -		// Another hack to ditch false positives: Assume that
    -		// if the uncompressed size is known, it must be less
    -		// than 256 GiB.
    -		if (coder->picky
    -				&& coder->uncompressed_size != LZMA_VLI_UNKNOWN
    -				&& coder->uncompressed_size
    -					>= (LZMA_VLI_C(1) << 38))
    -			return LZMA_FORMAT_ERROR;
    -
    -		// Calculate the memory usage so that it is ready
    -		// for SEQ_CODER_INIT.
    -		coder->memusage = lzma_lzma_decoder_memusage(&coder->options)
    -				+ LZMA_MEMUSAGE_BASE;
    -
    -		coder->pos = 0;
    -		coder->sequence = SEQ_CODER_INIT;
    -
    -	// Fall through
    -
    -	case SEQ_CODER_INIT: {
    -		if (coder->memusage > coder->memlimit)
    -			return LZMA_MEMLIMIT_ERROR;
    -
    -		lzma_filter_info filters[2] = {
    -			{
    -				.init = &lzma_lzma_decoder_init,
    -				.options = &coder->options,
    -			}, {
    -				.init = NULL,
    -			}
    -		};
    -
    -		const lzma_ret ret = lzma_next_filter_init(&coder->next,
    -				allocator, filters);
    -		if (ret != LZMA_OK)
    -			return ret;
    -
    -		// Use a hack to set the uncompressed size.
    -		lzma_lz_decoder_uncompressed(coder->next.coder,
    -				coder->uncompressed_size);
    -
    -		coder->sequence = SEQ_CODE;
    -		break;
    -	}
    -
    -	case SEQ_CODE: {
    -		return coder->next.code(coder->next.coder,
    -				allocator, in, in_pos, in_size,
    -				out, out_pos, out_size, action);
    -	}
    -
    -	default:
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static void
    -alone_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_ret
    -alone_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
    -		uint64_t *old_memlimit, uint64_t new_memlimit)
    -{
    -	*memusage = coder->memusage;
    -	*old_memlimit = coder->memlimit;
    -
    -	if (new_memlimit != 0) {
    -		if (new_memlimit < coder->memusage)
    -			return LZMA_MEMLIMIT_ERROR;
    -
    -		coder->memlimit = new_memlimit;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern lzma_ret
    -lzma_alone_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		uint64_t memlimit, bool picky)
    -{
    -	lzma_next_coder_init(&lzma_alone_decoder_init, next, allocator);
    -
    -	if (memlimit == 0)
    -		return LZMA_PROG_ERROR;
    -
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &alone_decode;
    -		next->end = &alone_decoder_end;
    -		next->memconfig = &alone_decoder_memconfig;
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	next->coder->sequence = SEQ_PROPERTIES;
    -	next->coder->picky = picky;
    -	next->coder->pos = 0;
    -	next->coder->options.dict_size = 0;
    -	next->coder->options.preset_dict = NULL;
    -	next->coder->options.preset_dict_size = 0;
    -	next->coder->uncompressed_size = 0;
    -	next->coder->memlimit = memlimit;
    -	next->coder->memusage = LZMA_MEMUSAGE_BASE;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_alone_decoder(lzma_stream *strm, uint64_t memlimit)
    -{
    -	lzma_next_strm_init(lzma_alone_decoder_init, strm, memlimit, false);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/alone_decoder.h b/external/public-domain/xz/dist/src/liblzma/common/alone_decoder.h
    deleted file mode 100644
    index dfa031aa7..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/alone_decoder.h
    +++ /dev/null
    @@ -1,23 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       alone_decoder.h
    -/// \brief      Decoder for LZMA_Alone files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_ALONE_DECODER_H
    -#define LZMA_ALONE_DECODER_H
    -
    -#include "common.h"
    -
    -
    -extern lzma_ret lzma_alone_decoder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		uint64_t memlimit, bool picky);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/alone_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/alone_encoder.c
    deleted file mode 100644
    index a2bc9eee1..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/alone_encoder.c
    +++ /dev/null
    @@ -1,157 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       alone_decoder.c
    -/// \brief      Decoder for LZMA_Alone files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -#include "lzma_encoder.h"
    -
    -
    -#define ALONE_HEADER_SIZE (1 + 4 + 8)
    -
    -
    -struct lzma_coder_s {
    -	lzma_next_coder next;
    -
    -	enum {
    -		SEQ_HEADER,
    -		SEQ_CODE,
    -	} sequence;
    -
    -	size_t header_pos;
    -	uint8_t header[ALONE_HEADER_SIZE];
    -};
    -
    -
    -static lzma_ret
    -alone_encode(lzma_coder *coder,
    -		const lzma_allocator *allocator lzma_attribute((__unused__)),
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size,
    -		lzma_action action)
    -{
    -	while (*out_pos < out_size)
    -	switch (coder->sequence) {
    -	case SEQ_HEADER:
    -		lzma_bufcpy(coder->header, &coder->header_pos,
    -				ALONE_HEADER_SIZE,
    -				out, out_pos, out_size);
    -		if (coder->header_pos < ALONE_HEADER_SIZE)
    -			return LZMA_OK;
    -
    -		coder->sequence = SEQ_CODE;
    -		break;
    -
    -	case SEQ_CODE:
    -		return coder->next.code(coder->next.coder,
    -				allocator, in, in_pos, in_size,
    -				out, out_pos, out_size, action);
    -
    -	default:
    -		assert(0);
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static void
    -alone_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -// At least for now, this is not used by any internal function.
    -static lzma_ret
    -alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_options_lzma *options)
    -{
    -	lzma_next_coder_init(&alone_encoder_init, next, allocator);
    -
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &alone_encode;
    -		next->end = &alone_encoder_end;
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	// Basic initializations
    -	next->coder->sequence = SEQ_HEADER;
    -	next->coder->header_pos = 0;
    -
    -	// Encode the header:
    -	// - Properties (1 byte)
    -	if (lzma_lzma_lclppb_encode(options, next->coder->header))
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// - Dictionary size (4 bytes)
    -	if (options->dict_size < LZMA_DICT_SIZE_MIN)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Round up to the next 2^n or 2^n + 2^(n - 1) depending on which
    -	// one is the next unless it is UINT32_MAX. While the header would
    -	// allow any 32-bit integer, we do this to keep the decoder of liblzma
    -	// accepting the resulting files.
    -	uint32_t d = options->dict_size - 1;
    -	d |= d >> 2;
    -	d |= d >> 3;
    -	d |= d >> 4;
    -	d |= d >> 8;
    -	d |= d >> 16;
    -	if (d != UINT32_MAX)
    -		++d;
    -
    -	unaligned_write32le(next->coder->header + 1, d);
    -
    -	// - Uncompressed size (always unknown and using EOPM)
    -	memset(next->coder->header + 1 + 4, 0xFF, 8);
    -
    -	// Initialize the LZMA encoder.
    -	const lzma_filter_info filters[2] = {
    -		{
    -			.init = &lzma_lzma_encoder_init,
    -			.options = (void *)(options),
    -		}, {
    -			.init = NULL,
    -		}
    -	};
    -
    -	return lzma_next_filter_init(&next->coder->next, allocator, filters);
    -}
    -
    -
    -/*
    -extern lzma_ret
    -lzma_alone_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_options_alone *options)
    -{
    -	lzma_next_coder_init(&alone_encoder_init, next, allocator, options);
    -}
    -*/
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_alone_encoder(lzma_stream *strm, const lzma_options_lzma *options)
    -{
    -	lzma_next_strm_init(alone_encoder_init, strm, options);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/auto_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/auto_decoder.c
    deleted file mode 100644
    index bf3550701..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/auto_decoder.c
    +++ /dev/null
    @@ -1,186 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       auto_decoder.c
    -/// \brief      Autodetect between .xz Stream and .lzma (LZMA_Alone) formats
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "stream_decoder.h"
    -#include "alone_decoder.h"
    -
    -
    -struct lzma_coder_s {
    -	/// Stream decoder or LZMA_Alone decoder
    -	lzma_next_coder next;
    -
    -	uint64_t memlimit;
    -	uint32_t flags;
    -
    -	enum {
    -		SEQ_INIT,
    -		SEQ_CODE,
    -		SEQ_FINISH,
    -	} sequence;
    -};
    -
    -
    -static lzma_ret
    -auto_decode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	switch (coder->sequence) {
    -	case SEQ_INIT:
    -		if (*in_pos >= in_size)
    -			return LZMA_OK;
    -
    -		// Update the sequence now, because we want to continue from
    -		// SEQ_CODE even if we return some LZMA_*_CHECK.
    -		coder->sequence = SEQ_CODE;
    -
    -		// Detect the file format. For now this is simple, since if
    -		// it doesn't start with 0xFD (the first magic byte of the
    -		// new format), it has to be LZMA_Alone, or something that
    -		// we don't support at all.
    -		if (in[*in_pos] == 0xFD) {
    -			return_if_error(lzma_stream_decoder_init(
    -					&coder->next, allocator,
    -					coder->memlimit, coder->flags));
    -		} else {
    -			return_if_error(lzma_alone_decoder_init(&coder->next,
    -					allocator, coder->memlimit, true));
    -
    -			// If the application wants to know about missing
    -			// integrity check or about the check in general, we
    -			// need to handle it here, because LZMA_Alone decoder
    -			// doesn't accept any flags.
    -			if (coder->flags & LZMA_TELL_NO_CHECK)
    -				return LZMA_NO_CHECK;
    -
    -			if (coder->flags & LZMA_TELL_ANY_CHECK)
    -				return LZMA_GET_CHECK;
    -		}
    -
    -	// Fall through
    -
    -	case SEQ_CODE: {
    -		const lzma_ret ret = coder->next.code(
    -				coder->next.coder, allocator,
    -				in, in_pos, in_size,
    -				out, out_pos, out_size, action);
    -		if (ret != LZMA_STREAM_END
    -				|| (coder->flags & LZMA_CONCATENATED) == 0)
    -			return ret;
    -
    -		coder->sequence = SEQ_FINISH;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_FINISH:
    -		// When LZMA_DECODE_CONCATENATED was used and we were decoding
    -		// LZMA_Alone file, we need to check check that there is no
    -		// trailing garbage and wait for LZMA_FINISH.
    -		if (*in_pos < in_size)
    -			return LZMA_DATA_ERROR;
    -
    -		return action == LZMA_FINISH ? LZMA_STREAM_END : LZMA_OK;
    -
    -	default:
    -		assert(0);
    -		return LZMA_PROG_ERROR;
    -	}
    -}
    -
    -
    -static void
    -auto_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_check
    -auto_decoder_get_check(const lzma_coder *coder)
    -{
    -	// It is LZMA_Alone if get_check is NULL.
    -	return coder->next.get_check == NULL ? LZMA_CHECK_NONE
    -			: coder->next.get_check(coder->next.coder);
    -}
    -
    -
    -static lzma_ret
    -auto_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
    -		uint64_t *old_memlimit, uint64_t new_memlimit)
    -{
    -	lzma_ret ret;
    -
    -	if (coder->next.memconfig != NULL) {
    -		ret = coder->next.memconfig(coder->next.coder,
    -				memusage, old_memlimit, new_memlimit);
    -		assert(*old_memlimit == coder->memlimit);
    -	} else {
    -		// No coder is configured yet. Use the base value as
    -		// the current memory usage.
    -		*memusage = LZMA_MEMUSAGE_BASE;
    -		*old_memlimit = coder->memlimit;
    -		ret = LZMA_OK;
    -	}
    -
    -	if (ret == LZMA_OK && new_memlimit != 0)
    -		coder->memlimit = new_memlimit;
    -
    -	return ret;
    -}
    -
    -
    -static lzma_ret
    -auto_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		uint64_t memlimit, uint32_t flags)
    -{
    -	lzma_next_coder_init(&auto_decoder_init, next, allocator);
    -
    -	if (memlimit == 0)
    -		return LZMA_PROG_ERROR;
    -
    -	if (flags & ~LZMA_SUPPORTED_FLAGS)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &auto_decode;
    -		next->end = &auto_decoder_end;
    -		next->get_check = &auto_decoder_get_check;
    -		next->memconfig = &auto_decoder_memconfig;
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	next->coder->memlimit = memlimit;
    -	next->coder->flags = flags;
    -	next->coder->sequence = SEQ_INIT;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_auto_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
    -{
    -	lzma_next_strm_init(auto_decoder_init, strm, memlimit, flags);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_buffer_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/block_buffer_decoder.c
    deleted file mode 100644
    index b0ded90dd..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_buffer_decoder.c
    +++ /dev/null
    @@ -1,80 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_buffer_decoder.c
    -/// \brief      Single-call .xz Block decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "block_decoder.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_buffer_decode(lzma_block *block, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	if (in_pos == NULL || (in == NULL && *in_pos != in_size)
    -			|| *in_pos > in_size || out_pos == NULL
    -			|| (out == NULL && *out_pos != out_size)
    -			|| *out_pos > out_size)
    -		return LZMA_PROG_ERROR;
    -
    -	// Initialize the Block decoder.
    -	lzma_next_coder block_decoder = LZMA_NEXT_CODER_INIT;
    -	lzma_ret ret = lzma_block_decoder_init(
    -			&block_decoder, allocator, block);
    -
    -	if (ret == LZMA_OK) {
    -		// Save the positions so that we can restore them in case
    -		// an error occurs.
    -		const size_t in_start = *in_pos;
    -		const size_t out_start = *out_pos;
    -
    -		// Do the actual decoding.
    -		ret = block_decoder.code(block_decoder.coder, allocator,
    -				in, in_pos, in_size, out, out_pos, out_size,
    -				LZMA_FINISH);
    -
    -		if (ret == LZMA_STREAM_END) {
    -			ret = LZMA_OK;
    -		} else {
    -			if (ret == LZMA_OK) {
    -				// Either the input was truncated or the
    -				// output buffer was too small.
    -				assert(*in_pos == in_size
    -						|| *out_pos == out_size);
    -
    -				// If all the input was consumed, then the
    -				// input is truncated, even if the output
    -				// buffer is also full. This is because
    -				// processing the last byte of the Block
    -				// never produces output.
    -				//
    -				// NOTE: This assumption may break when new
    -				// filters are added, if the end marker of
    -				// the filter doesn't consume at least one
    -				// complete byte.
    -				if (*in_pos == in_size)
    -					ret = LZMA_DATA_ERROR;
    -				else
    -					ret = LZMA_BUF_ERROR;
    -			}
    -
    -			// Restore the positions.
    -			*in_pos = in_start;
    -			*out_pos = out_start;
    -		}
    -	}
    -
    -	// Free the decoder memory. This needs to be done even if
    -	// initialization fails, because the internal API doesn't
    -	// require the initialization function to free its memory on error.
    -	lzma_next_end(&block_decoder, allocator);
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_buffer_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/block_buffer_encoder.c
    deleted file mode 100644
    index 39e263aa4..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_buffer_encoder.c
    +++ /dev/null
    @@ -1,337 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_buffer_encoder.c
    -/// \brief      Single-call .xz Block encoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "block_buffer_encoder.h"
    -#include "block_encoder.h"
    -#include "filter_encoder.h"
    -#include "lzma2_encoder.h"
    -#include "check.h"
    -
    -
    -/// Estimate the maximum size of the Block Header and Check fields for
    -/// a Block that uses LZMA2 uncompressed chunks. We could use
    -/// lzma_block_header_size() but this is simpler.
    -///
    -/// Block Header Size + Block Flags + Compressed Size
    -/// + Uncompressed Size + Filter Flags for LZMA2 + CRC32 + Check
    -/// and round up to the next multiple of four to take Header Padding
    -/// into account.
    -#define HEADERS_BOUND ((1 + 1 + 2 * LZMA_VLI_BYTES_MAX + 3 + 4 \
    -		+ LZMA_CHECK_SIZE_MAX + 3) & ~3)
    -
    -
    -static uint64_t
    -lzma2_bound(uint64_t uncompressed_size)
    -{
    -	// Prevent integer overflow in overhead calculation.
    -	if (uncompressed_size > COMPRESSED_SIZE_MAX)
    -		return 0;
    -
    -	// Calculate the exact overhead of the LZMA2 headers: Round
    -	// uncompressed_size up to the next multiple of LZMA2_CHUNK_MAX,
    -	// multiply by the size of per-chunk header, and add one byte for
    -	// the end marker.
    -	const uint64_t overhead = ((uncompressed_size + LZMA2_CHUNK_MAX - 1)
    -				/ LZMA2_CHUNK_MAX)
    -			* LZMA2_HEADER_UNCOMPRESSED + 1;
    -
    -	// Catch the possible integer overflow.
    -	if (COMPRESSED_SIZE_MAX - overhead < uncompressed_size)
    -		return 0;
    -
    -	return uncompressed_size + overhead;
    -}
    -
    -
    -extern uint64_t
    -lzma_block_buffer_bound64(uint64_t uncompressed_size)
    -{
    -	// If the data doesn't compress, we always use uncompressed
    -	// LZMA2 chunks.
    -	uint64_t lzma2_size = lzma2_bound(uncompressed_size);
    -	if (lzma2_size == 0)
    -		return 0;
    -
    -	// Take Block Padding into account.
    -	lzma2_size = (lzma2_size + 3) & ~UINT64_C(3);
    -
    -	// No risk of integer overflow because lzma2_bound() already takes
    -	// into account the size of the headers in the Block.
    -	return HEADERS_BOUND + lzma2_size;
    -}
    -
    -
    -extern LZMA_API(size_t)
    -lzma_block_buffer_bound(size_t uncompressed_size)
    -{
    -	uint64_t ret = lzma_block_buffer_bound64(uncompressed_size);
    -
    -#if SIZE_MAX < UINT64_MAX
    -	// Catch the possible integer overflow on 32-bit systems.
    -	if (ret > SIZE_MAX)
    -		return 0;
    -#endif
    -
    -	return ret;
    -}
    -
    -
    -static lzma_ret
    -block_encode_uncompressed(lzma_block *block, const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	// Use LZMA2 uncompressed chunks. We wouldn't need a dictionary at
    -	// all, but LZMA2 always requires a dictionary, so use the minimum
    -	// value to minimize memory usage of the decoder.
    -	lzma_options_lzma lzma2 = {
    -		.dict_size = LZMA_DICT_SIZE_MIN,
    -	};
    -
    -	lzma_filter filters[2];
    -	filters[0].id = LZMA_FILTER_LZMA2;
    -	filters[0].options = &lzma2;
    -	filters[1].id = LZMA_VLI_UNKNOWN;
    -
    -	// Set the above filter options to *block temporarily so that we can
    -	// encode the Block Header.
    -	lzma_filter *filters_orig = block->filters;
    -	block->filters = filters;
    -
    -	if (lzma_block_header_size(block) != LZMA_OK) {
    -		block->filters = filters_orig;
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	// Check that there's enough output space. The caller has already
    -	// set block->compressed_size to what lzma2_bound() has returned,
    -	// so we can reuse that value. We know that compressed_size is a
    -	// known valid VLI and header_size is a small value so their sum
    -	// will never overflow.
    -	assert(block->compressed_size == lzma2_bound(in_size));
    -	if (out_size - *out_pos
    -			< block->header_size + block->compressed_size) {
    -		block->filters = filters_orig;
    -		return LZMA_BUF_ERROR;
    -	}
    -
    -	if (lzma_block_header_encode(block, out + *out_pos) != LZMA_OK) {
    -		block->filters = filters_orig;
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	block->filters = filters_orig;
    -	*out_pos += block->header_size;
    -
    -	// Encode the data using LZMA2 uncompressed chunks.
    -	size_t in_pos = 0;
    -	uint8_t control = 0x01; // Dictionary reset
    -
    -	while (in_pos < in_size) {
    -		// Control byte: Indicate uncompressed chunk, of which
    -		// the first resets the dictionary.
    -		out[(*out_pos)++] = control;
    -		control = 0x02; // No dictionary reset
    -
    -		// Size of the uncompressed chunk
    -		const size_t copy_size
    -				= my_min(in_size - in_pos, LZMA2_CHUNK_MAX);
    -		out[(*out_pos)++] = (copy_size - 1) >> 8;
    -		out[(*out_pos)++] = (copy_size - 1) & 0xFF;
    -
    -		// The actual data
    -		assert(*out_pos + copy_size <= out_size);
    -		memcpy(out + *out_pos, in + in_pos, copy_size);
    -
    -		in_pos += copy_size;
    -		*out_pos += copy_size;
    -	}
    -
    -	// End marker
    -	out[(*out_pos)++] = 0x00;
    -	assert(*out_pos <= out_size);
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static lzma_ret
    -block_encode_normal(lzma_block *block, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	// Find out the size of the Block Header.
    -	return_if_error(lzma_block_header_size(block));
    -
    -	// Reserve space for the Block Header and skip it for now.
    -	if (out_size - *out_pos <= block->header_size)
    -		return LZMA_BUF_ERROR;
    -
    -	const size_t out_start = *out_pos;
    -	*out_pos += block->header_size;
    -
    -	// Limit out_size so that we stop encoding if the output would grow
    -	// bigger than what uncompressed Block would be.
    -	if (out_size - *out_pos > block->compressed_size)
    -		out_size = *out_pos + block->compressed_size;
    -
    -	// TODO: In many common cases this could be optimized to use
    -	// significantly less memory.
    -	lzma_next_coder raw_encoder = LZMA_NEXT_CODER_INIT;
    -	lzma_ret ret = lzma_raw_encoder_init(
    -			&raw_encoder, allocator, block->filters);
    -
    -	if (ret == LZMA_OK) {
    -		size_t in_pos = 0;
    -		ret = raw_encoder.code(raw_encoder.coder, allocator,
    -				in, &in_pos, in_size, out, out_pos, out_size,
    -				LZMA_FINISH);
    -	}
    -
    -	// NOTE: This needs to be run even if lzma_raw_encoder_init() failed.
    -	lzma_next_end(&raw_encoder, allocator);
    -
    -	if (ret == LZMA_STREAM_END) {
    -		// Compression was successful. Write the Block Header.
    -		block->compressed_size
    -				= *out_pos - (out_start + block->header_size);
    -		ret = lzma_block_header_encode(block, out + out_start);
    -		if (ret != LZMA_OK)
    -			ret = LZMA_PROG_ERROR;
    -
    -	} else if (ret == LZMA_OK) {
    -		// Output buffer became full.
    -		ret = LZMA_BUF_ERROR;
    -	}
    -
    -	// Reset *out_pos if something went wrong.
    -	if (ret != LZMA_OK)
    -		*out_pos = out_start;
    -
    -	return ret;
    -}
    -
    -
    -static lzma_ret
    -block_buffer_encode(lzma_block *block, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size,
    -		bool try_to_compress)
    -{
    -	// Validate the arguments.
    -	if (block == NULL || (in == NULL && in_size != 0) || out == NULL
    -			|| out_pos == NULL || *out_pos > out_size)
    -		return LZMA_PROG_ERROR;
    -
    -	// The contents of the structure may depend on the version so
    -	// check the version before validating the contents of *block.
    -	if (block->version > 1)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX
    -			|| (try_to_compress && block->filters == NULL))
    -		return LZMA_PROG_ERROR;
    -
    -	if (!lzma_check_is_supported(block->check))
    -		return LZMA_UNSUPPORTED_CHECK;
    -
    -	// Size of a Block has to be a multiple of four, so limit the size
    -	// here already. This way we don't need to check it again when adding
    -	// Block Padding.
    -	out_size -= (out_size - *out_pos) & 3;
    -
    -	// Get the size of the Check field.
    -	const size_t check_size = lzma_check_size(block->check);
    -	assert(check_size != UINT32_MAX);
    -
    -	// Reserve space for the Check field.
    -	if (out_size - *out_pos <= check_size)
    -		return LZMA_BUF_ERROR;
    -
    -	out_size -= check_size;
    -
    -	// Initialize block->uncompressed_size and calculate the worst-case
    -	// value for block->compressed_size.
    -	block->uncompressed_size = in_size;
    -	block->compressed_size = lzma2_bound(in_size);
    -	if (block->compressed_size == 0)
    -		return LZMA_DATA_ERROR;
    -
    -	// Do the actual compression.
    -	lzma_ret ret = LZMA_BUF_ERROR;
    -	if (try_to_compress)
    -		ret = block_encode_normal(block, allocator,
    -				in, in_size, out, out_pos, out_size);
    -
    -	if (ret != LZMA_OK) {
    -		// If the error was something else than output buffer
    -		// becoming full, return the error now.
    -		if (ret != LZMA_BUF_ERROR)
    -			return ret;
    -
    -		// The data was uncompressible (at least with the options
    -		// given to us) or the output buffer was too small. Use the
    -		// uncompressed chunks of LZMA2 to wrap the data into a valid
    -		// Block. If we haven't been given enough output space, even
    -		// this may fail.
    -		return_if_error(block_encode_uncompressed(block, in, in_size,
    -				out, out_pos, out_size));
    -	}
    -
    -	assert(*out_pos <= out_size);
    -
    -	// Block Padding. No buffer overflow here, because we already adjusted
    -	// out_size so that (out_size - out_start) is a multiple of four.
    -	// Thus, if the buffer is full, the loop body can never run.
    -	for (size_t i = (size_t)(block->compressed_size); i & 3; ++i) {
    -		assert(*out_pos < out_size);
    -		out[(*out_pos)++] = 0x00;
    -	}
    -
    -	// If there's no Check field, we are done now.
    -	if (check_size > 0) {
    -		// Calculate the integrity check. We reserved space for
    -		// the Check field earlier so we don't need to check for
    -		// available output space here.
    -		lzma_check_state check;
    -		lzma_check_init(&check, block->check);
    -		lzma_check_update(&check, block->check, in, in_size);
    -		lzma_check_finish(&check, block->check);
    -
    -		memcpy(block->raw_check, check.buffer.u8, check_size);
    -		memcpy(out + *out_pos, check.buffer.u8, check_size);
    -		*out_pos += check_size;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_buffer_encode(lzma_block *block, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	return block_buffer_encode(block, allocator,
    -			in, in_size, out, out_pos, out_size, true);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_uncomp_encode(lzma_block *block,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	// It won't allocate any memory from heap so no need
    -	// for lzma_allocator.
    -	return block_buffer_encode(block, NULL,
    -			in, in_size, out, out_pos, out_size, false);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_buffer_encoder.h b/external/public-domain/xz/dist/src/liblzma/common/block_buffer_encoder.h
    deleted file mode 100644
    index 653207f73..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_buffer_encoder.h
    +++ /dev/null
    @@ -1,24 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_buffer_encoder.h
    -/// \brief      Single-call .xz Block encoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_BLOCK_BUFFER_ENCODER_H
    -#define LZMA_BLOCK_BUFFER_ENCODER_H
    -
    -#include "common.h"
    -
    -
    -/// uint64_t version of lzma_block_buffer_bound(). It is used by
    -/// stream_encoder_mt.c. Probably the original lzma_block_buffer_bound()
    -/// should have been 64-bit, but fixing it would break the ABI.
    -extern uint64_t lzma_block_buffer_bound64(uint64_t uncompressed_size);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/block_decoder.c
    deleted file mode 100644
    index 685c3b038..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_decoder.c
    +++ /dev/null
    @@ -1,252 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_decoder.c
    -/// \brief      Decodes .xz Blocks
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "block_decoder.h"
    -#include "filter_decoder.h"
    -#include "check.h"
    -
    -
    -struct lzma_coder_s {
    -	enum {
    -		SEQ_CODE,
    -		SEQ_PADDING,
    -		SEQ_CHECK,
    -	} sequence;
    -
    -	/// The filters in the chain; initialized with lzma_raw_decoder_init().
    -	lzma_next_coder next;
    -
    -	/// Decoding options; we also write Compressed Size and Uncompressed
    -	/// Size back to this structure when the decoding has been finished.
    -	lzma_block *block;
    -
    -	/// Compressed Size calculated while decoding
    -	lzma_vli compressed_size;
    -
    -	/// Uncompressed Size calculated while decoding
    -	lzma_vli uncompressed_size;
    -
    -	/// Maximum allowed Compressed Size; this takes into account the
    -	/// size of the Block Header and Check fields when Compressed Size
    -	/// is unknown.
    -	lzma_vli compressed_limit;
    -
    -	/// Position when reading the Check field
    -	size_t check_pos;
    -
    -	/// Check of the uncompressed data
    -	lzma_check_state check;
    -
    -	/// True if the integrity check won't be calculated and verified.
    -	bool ignore_check;
    -};
    -
    -
    -static inline bool
    -update_size(lzma_vli *size, lzma_vli add, lzma_vli limit)
    -{
    -	if (limit > LZMA_VLI_MAX)
    -		limit = LZMA_VLI_MAX;
    -
    -	if (limit < *size || limit - *size < add)
    -		return true;
    -
    -	*size += add;
    -
    -	return false;
    -}
    -
    -
    -static inline bool
    -is_size_valid(lzma_vli size, lzma_vli reference)
    -{
    -	return reference == LZMA_VLI_UNKNOWN || reference == size;
    -}
    -
    -
    -static lzma_ret
    -block_decode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	switch (coder->sequence) {
    -	case SEQ_CODE: {
    -		const size_t in_start = *in_pos;
    -		const size_t out_start = *out_pos;
    -
    -		const lzma_ret ret = coder->next.code(coder->next.coder,
    -				allocator, in, in_pos, in_size,
    -				out, out_pos, out_size, action);
    -
    -		const size_t in_used = *in_pos - in_start;
    -		const size_t out_used = *out_pos - out_start;
    -
    -		// NOTE: We compare to compressed_limit here, which prevents
    -		// the total size of the Block growing past LZMA_VLI_MAX.
    -		if (update_size(&coder->compressed_size, in_used,
    -					coder->compressed_limit)
    -				|| update_size(&coder->uncompressed_size,
    -					out_used,
    -					coder->block->uncompressed_size))
    -			return LZMA_DATA_ERROR;
    -
    -		if (!coder->ignore_check)
    -			lzma_check_update(&coder->check, coder->block->check,
    -					out + out_start, out_used);
    -
    -		if (ret != LZMA_STREAM_END)
    -			return ret;
    -
    -		// Compressed and Uncompressed Sizes are now at their final
    -		// values. Verify that they match the values given to us.
    -		if (!is_size_valid(coder->compressed_size,
    -					coder->block->compressed_size)
    -				|| !is_size_valid(coder->uncompressed_size,
    -					coder->block->uncompressed_size))
    -			return LZMA_DATA_ERROR;
    -
    -		// Copy the values into coder->block. The caller
    -		// may use this information to construct Index.
    -		coder->block->compressed_size = coder->compressed_size;
    -		coder->block->uncompressed_size = coder->uncompressed_size;
    -
    -		coder->sequence = SEQ_PADDING;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_PADDING:
    -		// Compressed Data is padded to a multiple of four bytes.
    -		while (coder->compressed_size & 3) {
    -			if (*in_pos >= in_size)
    -				return LZMA_OK;
    -
    -			// We use compressed_size here just get the Padding
    -			// right. The actual Compressed Size was stored to
    -			// coder->block already, and won't be modified by
    -			// us anymore.
    -			++coder->compressed_size;
    -
    -			if (in[(*in_pos)++] != 0x00)
    -				return LZMA_DATA_ERROR;
    -		}
    -
    -		if (coder->block->check == LZMA_CHECK_NONE)
    -			return LZMA_STREAM_END;
    -
    -		if (!coder->ignore_check)
    -			lzma_check_finish(&coder->check, coder->block->check);
    -
    -		coder->sequence = SEQ_CHECK;
    -
    -	// Fall through
    -
    -	case SEQ_CHECK: {
    -		const size_t check_size = lzma_check_size(coder->block->check);
    -		lzma_bufcpy(in, in_pos, in_size, coder->block->raw_check,
    -				&coder->check_pos, check_size);
    -		if (coder->check_pos < check_size)
    -			return LZMA_OK;
    -
    -		// Validate the Check only if we support it.
    -		// coder->check.buffer may be uninitialized
    -		// when the Check ID is not supported.
    -		if (!coder->ignore_check
    -				&& lzma_check_is_supported(coder->block->check)
    -				&& memcmp(coder->block->raw_check,
    -					coder->check.buffer.u8,
    -					check_size) != 0)
    -			return LZMA_DATA_ERROR;
    -
    -		return LZMA_STREAM_END;
    -	}
    -	}
    -
    -	return LZMA_PROG_ERROR;
    -}
    -
    -
    -static void
    -block_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -extern lzma_ret
    -lzma_block_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		lzma_block *block)
    -{
    -	lzma_next_coder_init(&lzma_block_decoder_init, next, allocator);
    -
    -	// Validate the options. lzma_block_unpadded_size() does that for us
    -	// except for Uncompressed Size and filters. Filters are validated
    -	// by the raw decoder.
    -	if (lzma_block_unpadded_size(block) == 0
    -			|| !lzma_vli_is_valid(block->uncompressed_size))
    -		return LZMA_PROG_ERROR;
    -
    -	// Allocate and initialize *next->coder if needed.
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &block_decode;
    -		next->end = &block_decoder_end;
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	// Basic initializations
    -	next->coder->sequence = SEQ_CODE;
    -	next->coder->block = block;
    -	next->coder->compressed_size = 0;
    -	next->coder->uncompressed_size = 0;
    -
    -	// If Compressed Size is not known, we calculate the maximum allowed
    -	// value so that encoded size of the Block (including Block Padding)
    -	// is still a valid VLI and a multiple of four.
    -	next->coder->compressed_limit
    -			= block->compressed_size == LZMA_VLI_UNKNOWN
    -				? (LZMA_VLI_MAX & ~LZMA_VLI_C(3))
    -					- block->header_size
    -					- lzma_check_size(block->check)
    -				: block->compressed_size;
    -
    -	// Initialize the check. It's caller's problem if the Check ID is not
    -	// supported, and the Block decoder cannot verify the Check field.
    -	// Caller can test lzma_check_is_supported(block->check).
    -	next->coder->check_pos = 0;
    -	lzma_check_init(&next->coder->check, block->check);
    -
    -	next->coder->ignore_check = block->version >= 1
    -			? block->ignore_check : false;
    -
    -	// Initialize the filter chain.
    -	return lzma_raw_decoder_init(&next->coder->next, allocator,
    -			block->filters);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_decoder(lzma_stream *strm, lzma_block *block)
    -{
    -	lzma_next_strm_init(lzma_block_decoder_init, strm, block);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_decoder.h b/external/public-domain/xz/dist/src/liblzma/common/block_decoder.h
    deleted file mode 100644
    index 718c5ced8..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_decoder.h
    +++ /dev/null
    @@ -1,22 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_decoder.h
    -/// \brief      Decodes .xz Blocks
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_BLOCK_DECODER_H
    -#define LZMA_BLOCK_DECODER_H
    -
    -#include "common.h"
    -
    -
    -extern lzma_ret lzma_block_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator, lzma_block *block);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/block_encoder.c
    deleted file mode 100644
    index def586410..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_encoder.c
    +++ /dev/null
    @@ -1,217 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_encoder.c
    -/// \brief      Encodes .xz Blocks
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "block_encoder.h"
    -#include "filter_encoder.h"
    -#include "check.h"
    -
    -
    -struct lzma_coder_s {
    -	/// The filters in the chain; initialized with lzma_raw_decoder_init().
    -	lzma_next_coder next;
    -
    -	/// Encoding options; we also write Unpadded Size, Compressed Size,
    -	/// and Uncompressed Size back to this structure when the encoding
    -	/// has been finished.
    -	lzma_block *block;
    -
    -	enum {
    -		SEQ_CODE,
    -		SEQ_PADDING,
    -		SEQ_CHECK,
    -	} sequence;
    -
    -	/// Compressed Size calculated while encoding
    -	lzma_vli compressed_size;
    -
    -	/// Uncompressed Size calculated while encoding
    -	lzma_vli uncompressed_size;
    -
    -	/// Position in the Check field
    -	size_t pos;
    -
    -	/// Check of the uncompressed data
    -	lzma_check_state check;
    -};
    -
    -
    -static lzma_ret
    -block_encode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	// Check that our amount of input stays in proper limits.
    -	if (LZMA_VLI_MAX - coder->uncompressed_size < in_size - *in_pos)
    -		return LZMA_DATA_ERROR;
    -
    -	switch (coder->sequence) {
    -	case SEQ_CODE: {
    -		const size_t in_start = *in_pos;
    -		const size_t out_start = *out_pos;
    -
    -		const lzma_ret ret = coder->next.code(coder->next.coder,
    -				allocator, in, in_pos, in_size,
    -				out, out_pos, out_size, action);
    -
    -		const size_t in_used = *in_pos - in_start;
    -		const size_t out_used = *out_pos - out_start;
    -
    -		if (COMPRESSED_SIZE_MAX - coder->compressed_size < out_used)
    -			return LZMA_DATA_ERROR;
    -
    -		coder->compressed_size += out_used;
    -
    -		// No need to check for overflow because we have already
    -		// checked it at the beginning of this function.
    -		coder->uncompressed_size += in_used;
    -
    -		lzma_check_update(&coder->check, coder->block->check,
    -				in + in_start, in_used);
    -
    -		if (ret != LZMA_STREAM_END || action == LZMA_SYNC_FLUSH)
    -			return ret;
    -
    -		assert(*in_pos == in_size);
    -		assert(action == LZMA_FINISH);
    -
    -		// Copy the values into coder->block. The caller
    -		// may use this information to construct Index.
    -		coder->block->compressed_size = coder->compressed_size;
    -		coder->block->uncompressed_size = coder->uncompressed_size;
    -
    -		coder->sequence = SEQ_PADDING;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_PADDING:
    -		// Pad Compressed Data to a multiple of four bytes. We can
    -		// use coder->compressed_size for this since we don't need
    -		// it for anything else anymore.
    -		while (coder->compressed_size & 3) {
    -			if (*out_pos >= out_size)
    -				return LZMA_OK;
    -
    -			out[*out_pos] = 0x00;
    -			++*out_pos;
    -			++coder->compressed_size;
    -		}
    -
    -		if (coder->block->check == LZMA_CHECK_NONE)
    -			return LZMA_STREAM_END;
    -
    -		lzma_check_finish(&coder->check, coder->block->check);
    -
    -		coder->sequence = SEQ_CHECK;
    -
    -	// Fall through
    -
    -	case SEQ_CHECK: {
    -		const size_t check_size = lzma_check_size(coder->block->check);
    -		lzma_bufcpy(coder->check.buffer.u8, &coder->pos, check_size,
    -				out, out_pos, out_size);
    -		if (coder->pos < check_size)
    -			return LZMA_OK;
    -
    -		memcpy(coder->block->raw_check, coder->check.buffer.u8,
    -				check_size);
    -		return LZMA_STREAM_END;
    -	}
    -	}
    -
    -	return LZMA_PROG_ERROR;
    -}
    -
    -
    -static void
    -block_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_ret
    -block_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
    -		const lzma_filter *filters lzma_attribute((__unused__)),
    -		const lzma_filter *reversed_filters)
    -{
    -	if (coder->sequence != SEQ_CODE)
    -		return LZMA_PROG_ERROR;
    -
    -	return lzma_next_filter_update(
    -			&coder->next, allocator, reversed_filters);
    -}
    -
    -
    -extern lzma_ret
    -lzma_block_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		lzma_block *block)
    -{
    -	lzma_next_coder_init(&lzma_block_encoder_init, next, allocator);
    -
    -	if (block == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	// The contents of the structure may depend on the version so
    -	// check the version first.
    -	if (block->version > 1)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// If the Check ID is not supported, we cannot calculate the check and
    -	// thus not create a proper Block.
    -	if ((unsigned int)(block->check) > LZMA_CHECK_ID_MAX)
    -		return LZMA_PROG_ERROR;
    -
    -	if (!lzma_check_is_supported(block->check))
    -		return LZMA_UNSUPPORTED_CHECK;
    -
    -	// Allocate and initialize *next->coder if needed.
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &block_encode;
    -		next->end = &block_encoder_end;
    -		next->update = &block_encoder_update;
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	// Basic initializations
    -	next->coder->sequence = SEQ_CODE;
    -	next->coder->block = block;
    -	next->coder->compressed_size = 0;
    -	next->coder->uncompressed_size = 0;
    -	next->coder->pos = 0;
    -
    -	// Initialize the check
    -	lzma_check_init(&next->coder->check, block->check);
    -
    -	// Initialize the requested filters.
    -	return lzma_raw_encoder_init(&next->coder->next, allocator,
    -			block->filters);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_encoder(lzma_stream *strm, lzma_block *block)
    -{
    -	lzma_next_strm_init(lzma_block_encoder_init, strm, block);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_encoder.h b/external/public-domain/xz/dist/src/liblzma/common/block_encoder.h
    deleted file mode 100644
    index bd97c186e..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_encoder.h
    +++ /dev/null
    @@ -1,47 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_encoder.h
    -/// \brief      Encodes .xz Blocks
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_BLOCK_ENCODER_H
    -#define LZMA_BLOCK_ENCODER_H
    -
    -#include "common.h"
    -
    -
    -/// \brief      Biggest Compressed Size value that the Block encoder supports
    -///
    -/// The maximum size of a single Block is limited by the maximum size of
    -/// a Stream, which in theory is 2^63 - 3 bytes (i.e. LZMA_VLI_MAX - 3).
    -/// While the size is really big and no one should hit it in practice, we
    -/// take it into account in some places anyway to catch some errors e.g. if
    -/// application passes insanely big value to some function.
    -///
    -/// We could take into account the headers etc. to determine the exact
    -/// maximum size of the Compressed Data field, but the complexity would give
    -/// us nothing useful. Instead, limit the size of Compressed Data so that
    -/// even with biggest possible Block Header and Check fields the total
    -/// encoded size of the Block stays as a valid VLI. This doesn't guarantee
    -/// that the size of the Stream doesn't grow too big, but that problem is
    -/// taken care outside the Block handling code.
    -///
    -/// ~LZMA_VLI_C(3) is to guarantee that if we need padding at the end of
    -/// the Compressed Data field, it will still stay in the proper limit.
    -///
    -/// This constant is in this file because it is needed in both
    -/// block_encoder.c and block_buffer_encoder.c.
    -#define COMPRESSED_SIZE_MAX ((LZMA_VLI_MAX - LZMA_BLOCK_HEADER_SIZE_MAX \
    -		- LZMA_CHECK_SIZE_MAX) & ~LZMA_VLI_C(3))
    -
    -
    -extern lzma_ret lzma_block_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator, lzma_block *block);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_header_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/block_header_decoder.c
    deleted file mode 100644
    index 1dd982f6b..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_header_decoder.c
    +++ /dev/null
    @@ -1,124 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_header_decoder.c
    -/// \brief      Decodes Block Header from .xz files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -#include "check.h"
    -
    -
    -static void
    -free_properties(lzma_block *block, const lzma_allocator *allocator)
    -{
    -	// Free allocated filter options. The last array member is not
    -	// touched after the initialization in the beginning of
    -	// lzma_block_header_decode(), so we don't need to touch that here.
    -	for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i) {
    -		lzma_free(block->filters[i].options, allocator);
    -		block->filters[i].id = LZMA_VLI_UNKNOWN;
    -		block->filters[i].options = NULL;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_header_decode(lzma_block *block,
    -		const lzma_allocator *allocator, const uint8_t *in)
    -{
    -	// NOTE: We consider the header to be corrupt not only when the
    -	// CRC32 doesn't match, but also when variable-length integers
    -	// are invalid or over 63 bits, or if the header is too small
    -	// to contain the claimed information.
    -
    -	// Initialize the filter options array. This way the caller can
    -	// safely free() the options even if an error occurs in this function.
    -	for (size_t i = 0; i <= LZMA_FILTERS_MAX; ++i) {
    -		block->filters[i].id = LZMA_VLI_UNKNOWN;
    -		block->filters[i].options = NULL;
    -	}
    -
    -	// Versions 0 and 1 are supported. If a newer version was specified,
    -	// we need to downgrade it.
    -	if (block->version > 1)
    -		block->version = 1;
    -
    -	// This isn't a Block Header option, but since the decompressor will
    -	// read it if version >= 1, it's better to initialize it here than
    -	// to expect the caller to do it since in almost all cases this
    -	// should be false.
    -	block->ignore_check = false;
    -
    -	// Validate Block Header Size and Check type. The caller must have
    -	// already set these, so it is a programming error if this test fails.
    -	if (lzma_block_header_size_decode(in[0]) != block->header_size
    -			|| (unsigned int)(block->check) > LZMA_CHECK_ID_MAX)
    -		return LZMA_PROG_ERROR;
    -
    -	// Exclude the CRC32 field.
    -	const size_t in_size = block->header_size - 4;
    -
    -	// Verify CRC32
    -	if (lzma_crc32(in, in_size, 0) != unaligned_read32le(in + in_size))
    -		return LZMA_DATA_ERROR;
    -
    -	// Check for unsupported flags.
    -	if (in[1] & 0x3C)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Start after the Block Header Size and Block Flags fields.
    -	size_t in_pos = 2;
    -
    -	// Compressed Size
    -	if (in[1] & 0x40) {
    -		return_if_error(lzma_vli_decode(&block->compressed_size,
    -				NULL, in, &in_pos, in_size));
    -
    -		// Validate Compressed Size. This checks that it isn't zero
    -		// and that the total size of the Block is a valid VLI.
    -		if (lzma_block_unpadded_size(block) == 0)
    -			return LZMA_DATA_ERROR;
    -	} else {
    -		block->compressed_size = LZMA_VLI_UNKNOWN;
    -	}
    -
    -	// Uncompressed Size
    -	if (in[1] & 0x80)
    -		return_if_error(lzma_vli_decode(&block->uncompressed_size,
    -				NULL, in, &in_pos, in_size));
    -	else
    -		block->uncompressed_size = LZMA_VLI_UNKNOWN;
    -
    -	// Filter Flags
    -	const size_t filter_count = (in[1] & 3) + 1;
    -	for (size_t i = 0; i < filter_count; ++i) {
    -		const lzma_ret ret = lzma_filter_flags_decode(
    -				&block->filters[i], allocator,
    -				in, &in_pos, in_size);
    -		if (ret != LZMA_OK) {
    -			free_properties(block, allocator);
    -			return ret;
    -		}
    -	}
    -
    -	// Padding
    -	while (in_pos < in_size) {
    -		if (in[in_pos++] != 0x00) {
    -			free_properties(block, allocator);
    -
    -			// Possibly some new field present so use
    -			// LZMA_OPTIONS_ERROR instead of LZMA_DATA_ERROR.
    -			return LZMA_OPTIONS_ERROR;
    -		}
    -	}
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_header_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/block_header_encoder.c
    deleted file mode 100644
    index 5c5f5424a..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_header_encoder.c
    +++ /dev/null
    @@ -1,132 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_header_encoder.c
    -/// \brief      Encodes Block Header for .xz files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -#include "check.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_header_size(lzma_block *block)
    -{
    -	if (block->version > 1)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Block Header Size + Block Flags + CRC32.
    -	uint32_t size = 1 + 1 + 4;
    -
    -	// Compressed Size
    -	if (block->compressed_size != LZMA_VLI_UNKNOWN) {
    -		const uint32_t add = lzma_vli_size(block->compressed_size);
    -		if (add == 0 || block->compressed_size == 0)
    -			return LZMA_PROG_ERROR;
    -
    -		size += add;
    -	}
    -
    -	// Uncompressed Size
    -	if (block->uncompressed_size != LZMA_VLI_UNKNOWN) {
    -		const uint32_t add = lzma_vli_size(block->uncompressed_size);
    -		if (add == 0)
    -			return LZMA_PROG_ERROR;
    -
    -		size += add;
    -	}
    -
    -	// List of Filter Flags
    -	if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN)
    -		return LZMA_PROG_ERROR;
    -
    -	for (size_t i = 0; block->filters[i].id != LZMA_VLI_UNKNOWN; ++i) {
    -		// Don't allow too many filters.
    -		if (i == LZMA_FILTERS_MAX)
    -			return LZMA_PROG_ERROR;
    -
    -		uint32_t add;
    -		return_if_error(lzma_filter_flags_size(&add,
    -				block->filters + i));
    -
    -		size += add;
    -	}
    -
    -	// Pad to a multiple of four bytes.
    -	block->header_size = (size + 3) & ~UINT32_C(3);
    -
    -	// NOTE: We don't verify that the encoded size of the Block stays
    -	// within limits. This is because it is possible that we are called
    -	// with exaggerated Compressed Size (e.g. LZMA_VLI_MAX) to reserve
    -	// space for Block Header, and later called again with lower,
    -	// real values.
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_header_encode(const lzma_block *block, uint8_t *out)
    -{
    -	// Validate everything but filters.
    -	if (lzma_block_unpadded_size(block) == 0
    -			|| !lzma_vli_is_valid(block->uncompressed_size))
    -		return LZMA_PROG_ERROR;
    -
    -	// Indicate the size of the buffer _excluding_ the CRC32 field.
    -	const size_t out_size = block->header_size - 4;
    -
    -	// Store the Block Header Size.
    -	out[0] = out_size / 4;
    -
    -	// We write Block Flags in pieces.
    -	out[1] = 0x00;
    -	size_t out_pos = 2;
    -
    -	// Compressed Size
    -	if (block->compressed_size != LZMA_VLI_UNKNOWN) {
    -		return_if_error(lzma_vli_encode(block->compressed_size, NULL,
    -				out, &out_pos, out_size));
    -
    -		out[1] |= 0x40;
    -	}
    -
    -	// Uncompressed Size
    -	if (block->uncompressed_size != LZMA_VLI_UNKNOWN) {
    -		return_if_error(lzma_vli_encode(block->uncompressed_size, NULL,
    -				out, &out_pos, out_size));
    -
    -		out[1] |= 0x80;
    -	}
    -
    -	// Filter Flags
    -	if (block->filters == NULL || block->filters[0].id == LZMA_VLI_UNKNOWN)
    -		return LZMA_PROG_ERROR;
    -
    -	size_t filter_count = 0;
    -	do {
    -		// There can be a maximum of four filters.
    -		if (filter_count == LZMA_FILTERS_MAX)
    -			return LZMA_PROG_ERROR;
    -
    -		return_if_error(lzma_filter_flags_encode(
    -				block->filters + filter_count,
    -				out, &out_pos, out_size));
    -
    -	} while (block->filters[++filter_count].id != LZMA_VLI_UNKNOWN);
    -
    -	out[1] |= filter_count - 1;
    -
    -	// Padding
    -	memzero(out + out_pos, out_size - out_pos);
    -
    -	// CRC32
    -	unaligned_write32le(out + out_size, lzma_crc32(out, out_size, 0));
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/block_util.c b/external/public-domain/xz/dist/src/liblzma/common/block_util.c
    deleted file mode 100644
    index 00c7fe8d5..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/block_util.c
    +++ /dev/null
    @@ -1,90 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       block_header.c
    -/// \brief      Utility functions to handle lzma_block
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -#include "index.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_block_compressed_size(lzma_block *block, lzma_vli unpadded_size)
    -{
    -	// Validate everything but Uncompressed Size and filters.
    -	if (lzma_block_unpadded_size(block) == 0)
    -		return LZMA_PROG_ERROR;
    -
    -	const uint32_t container_size = block->header_size
    -			+ lzma_check_size(block->check);
    -
    -	// Validate that Compressed Size will be greater than zero.
    -	if (unpadded_size <= container_size)
    -		return LZMA_DATA_ERROR;
    -
    -	// Calculate what Compressed Size is supposed to be.
    -	// If Compressed Size was present in Block Header,
    -	// compare that the new value matches it.
    -	const lzma_vli compressed_size = unpadded_size - container_size;
    -	if (block->compressed_size != LZMA_VLI_UNKNOWN
    -			&& block->compressed_size != compressed_size)
    -		return LZMA_DATA_ERROR;
    -
    -	block->compressed_size = compressed_size;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_block_unpadded_size(const lzma_block *block)
    -{
    -	// Validate the values that we are interested in i.e. all but
    -	// Uncompressed Size and the filters.
    -	//
    -	// NOTE: This function is used for validation too, so it is
    -	// essential that these checks are always done even if
    -	// Compressed Size is unknown.
    -	if (block == NULL || block->version > 1
    -			|| block->header_size < LZMA_BLOCK_HEADER_SIZE_MIN
    -			|| block->header_size > LZMA_BLOCK_HEADER_SIZE_MAX
    -			|| (block->header_size & 3)
    -			|| !lzma_vli_is_valid(block->compressed_size)
    -			|| block->compressed_size == 0
    -			|| (unsigned int)(block->check) > LZMA_CHECK_ID_MAX)
    -		return 0;
    -
    -	// If Compressed Size is unknown, return that we cannot know
    -	// size of the Block either.
    -	if (block->compressed_size == LZMA_VLI_UNKNOWN)
    -		return LZMA_VLI_UNKNOWN;
    -
    -	// Calculate Unpadded Size and validate it.
    -	const lzma_vli unpadded_size = block->compressed_size
    -				+ block->header_size
    -				+ lzma_check_size(block->check);
    -
    -	assert(unpadded_size >= UNPADDED_SIZE_MIN);
    -	if (unpadded_size > UNPADDED_SIZE_MAX)
    -		return 0;
    -
    -	return unpadded_size;
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_block_total_size(const lzma_block *block)
    -{
    -	lzma_vli unpadded_size = lzma_block_unpadded_size(block);
    -
    -	if (unpadded_size != LZMA_VLI_UNKNOWN)
    -		unpadded_size = vli_ceil4(unpadded_size);
    -
    -	return unpadded_size;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/common.c b/external/public-domain/xz/dist/src/liblzma/common/common.c
    deleted file mode 100644
    index 28aa2b714..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/common.c
    +++ /dev/null
    @@ -1,443 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       common.h
    -/// \brief      Common functions needed in many places in liblzma
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -
    -/////////////
    -// Version //
    -/////////////
    -
    -extern LZMA_API(uint32_t)
    -lzma_version_number(void)
    -{
    -	return LZMA_VERSION;
    -}
    -
    -
    -extern LZMA_API(const char *)
    -lzma_version_string(void)
    -{
    -	return LZMA_VERSION_STRING;
    -}
    -
    -
    -///////////////////////
    -// Memory allocation //
    -///////////////////////
    -
    -extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
    -lzma_alloc(size_t size, const lzma_allocator *allocator)
    -{
    -	// Some malloc() variants return NULL if called with size == 0.
    -	if (size == 0)
    -		size = 1;
    -
    -	void *ptr;
    -
    -	if (allocator != NULL && allocator->alloc != NULL)
    -		ptr = allocator->alloc(allocator->opaque, 1, size);
    -	else
    -		ptr = malloc(size);
    -
    -	return ptr;
    -}
    -
    -
    -extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
    -lzma_alloc_zero(size_t size, const lzma_allocator *allocator)
    -{
    -	// Some calloc() variants return NULL if called with size == 0.
    -	if (size == 0)
    -		size = 1;
    -
    -	void *ptr;
    -
    -	if (allocator != NULL && allocator->alloc != NULL) {
    -		ptr = allocator->alloc(allocator->opaque, 1, size);
    -		if (ptr != NULL)
    -			memzero(ptr, size);
    -	} else {
    -		ptr = calloc(1, size);
    -	}
    -
    -	return ptr;
    -}
    -
    -
    -extern void
    -lzma_free(void *ptr, const lzma_allocator *allocator)
    -{
    -	if (allocator != NULL && allocator->free != NULL)
    -		allocator->free(allocator->opaque, ptr);
    -	else
    -		free(ptr);
    -
    -	return;
    -}
    -
    -
    -//////////
    -// Misc //
    -//////////
    -
    -extern size_t
    -lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size)
    -{
    -	const size_t in_avail = in_size - *in_pos;
    -	const size_t out_avail = out_size - *out_pos;
    -	const size_t copy_size = my_min(in_avail, out_avail);
    -
    -	memcpy(out + *out_pos, in + *in_pos, copy_size);
    -
    -	*in_pos += copy_size;
    -	*out_pos += copy_size;
    -
    -	return copy_size;
    -}
    -
    -
    -extern lzma_ret
    -lzma_next_filter_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	lzma_next_coder_init(filters[0].init, next, allocator);
    -	next->id = filters[0].id;
    -	return filters[0].init == NULL
    -			? LZMA_OK : filters[0].init(next, allocator, filters);
    -}
    -
    -
    -extern lzma_ret
    -lzma_next_filter_update(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *reversed_filters)
    -{
    -	// Check that the application isn't trying to change the Filter ID.
    -	// End of filters is indicated with LZMA_VLI_UNKNOWN in both
    -	// reversed_filters[0].id and next->id.
    -	if (reversed_filters[0].id != next->id)
    -		return LZMA_PROG_ERROR;
    -
    -	if (reversed_filters[0].id == LZMA_VLI_UNKNOWN)
    -		return LZMA_OK;
    -
    -	assert(next->update != NULL);
    -	return next->update(next->coder, allocator, NULL, reversed_filters);
    -}
    -
    -
    -extern void
    -lzma_next_end(lzma_next_coder *next, const lzma_allocator *allocator)
    -{
    -	if (next->init != (uintptr_t)(NULL)) {
    -		// To avoid tiny end functions that simply call
    -		// lzma_free(coder, allocator), we allow leaving next->end
    -		// NULL and call lzma_free() here.
    -		if (next->end != NULL)
    -			next->end(next->coder, allocator);
    -		else
    -			lzma_free(next->coder, allocator);
    -
    -		// Reset the variables so the we don't accidentally think
    -		// that it is an already initialized coder.
    -		*next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	return;
    -}
    -
    -
    -//////////////////////////////////////
    -// External to internal API wrapper //
    -//////////////////////////////////////
    -
    -extern lzma_ret
    -lzma_strm_init(lzma_stream *strm)
    -{
    -	if (strm == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	if (strm->internal == NULL) {
    -		strm->internal = lzma_alloc(sizeof(lzma_internal),
    -				strm->allocator);
    -		if (strm->internal == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		strm->internal->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	memzero(strm->internal->supported_actions,
    -			sizeof(strm->internal->supported_actions));
    -	strm->internal->sequence = ISEQ_RUN;
    -	strm->internal->allow_buf_error = false;
    -
    -	strm->total_in = 0;
    -	strm->total_out = 0;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_code(lzma_stream *strm, lzma_action action)
    -{
    -	// Sanity checks
    -	if ((strm->next_in == NULL && strm->avail_in != 0)
    -			|| (strm->next_out == NULL && strm->avail_out != 0)
    -			|| strm->internal == NULL
    -			|| strm->internal->next.code == NULL
    -			|| (unsigned int)(action) > LZMA_ACTION_MAX
    -			|| !strm->internal->supported_actions[action])
    -		return LZMA_PROG_ERROR;
    -
    -	// Check if unsupported members have been set to non-zero or non-NULL,
    -	// which would indicate that some new feature is wanted.
    -	if (strm->reserved_ptr1 != NULL
    -			|| strm->reserved_ptr2 != NULL
    -			|| strm->reserved_ptr3 != NULL
    -			|| strm->reserved_ptr4 != NULL
    -			|| strm->reserved_int1 != 0
    -			|| strm->reserved_int2 != 0
    -			|| strm->reserved_int3 != 0
    -			|| strm->reserved_int4 != 0
    -			|| strm->reserved_enum1 != LZMA_RESERVED_ENUM
    -			|| strm->reserved_enum2 != LZMA_RESERVED_ENUM)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	switch (strm->internal->sequence) {
    -	case ISEQ_RUN:
    -		switch (action) {
    -		case LZMA_RUN:
    -			break;
    -
    -		case LZMA_SYNC_FLUSH:
    -			strm->internal->sequence = ISEQ_SYNC_FLUSH;
    -			break;
    -
    -		case LZMA_FULL_FLUSH:
    -			strm->internal->sequence = ISEQ_FULL_FLUSH;
    -			break;
    -
    -		case LZMA_FINISH:
    -			strm->internal->sequence = ISEQ_FINISH;
    -			break;
    -
    -		case LZMA_FULL_BARRIER:
    -			strm->internal->sequence = ISEQ_FULL_BARRIER;
    -			break;
    -		}
    -
    -		break;
    -
    -	case ISEQ_SYNC_FLUSH:
    -		// The same action must be used until we return
    -		// LZMA_STREAM_END, and the amount of input must not change.
    -		if (action != LZMA_SYNC_FLUSH
    -				|| strm->internal->avail_in != strm->avail_in)
    -			return LZMA_PROG_ERROR;
    -
    -		break;
    -
    -	case ISEQ_FULL_FLUSH:
    -		if (action != LZMA_FULL_FLUSH
    -				|| strm->internal->avail_in != strm->avail_in)
    -			return LZMA_PROG_ERROR;
    -
    -		break;
    -
    -	case ISEQ_FINISH:
    -		if (action != LZMA_FINISH
    -				|| strm->internal->avail_in != strm->avail_in)
    -			return LZMA_PROG_ERROR;
    -
    -		break;
    -
    -	case ISEQ_FULL_BARRIER:
    -		if (action != LZMA_FULL_BARRIER
    -				|| strm->internal->avail_in != strm->avail_in)
    -			return LZMA_PROG_ERROR;
    -
    -		break;
    -
    -	case ISEQ_END:
    -		return LZMA_STREAM_END;
    -
    -	case ISEQ_ERROR:
    -	default:
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	size_t in_pos = 0;
    -	size_t out_pos = 0;
    -	lzma_ret ret = strm->internal->next.code(
    -			strm->internal->next.coder, strm->allocator,
    -			strm->next_in, &in_pos, strm->avail_in,
    -			strm->next_out, &out_pos, strm->avail_out, action);
    -
    -	strm->next_in += in_pos;
    -	strm->avail_in -= in_pos;
    -	strm->total_in += in_pos;
    -
    -	strm->next_out += out_pos;
    -	strm->avail_out -= out_pos;
    -	strm->total_out += out_pos;
    -
    -	strm->internal->avail_in = strm->avail_in;
    -
    -	// Cast is needed to silence a warning about LZMA_TIMED_OUT, which
    -	// isn't part of lzma_ret enumeration.
    -	switch ((unsigned int)(ret)) {
    -	case LZMA_OK:
    -		// Don't return LZMA_BUF_ERROR when it happens the first time.
    -		// This is to avoid returning LZMA_BUF_ERROR when avail_out
    -		// was zero but still there was no more data left to written
    -		// to next_out.
    -		if (out_pos == 0 && in_pos == 0) {
    -			if (strm->internal->allow_buf_error)
    -				ret = LZMA_BUF_ERROR;
    -			else
    -				strm->internal->allow_buf_error = true;
    -		} else {
    -			strm->internal->allow_buf_error = false;
    -		}
    -		break;
    -
    -	case LZMA_TIMED_OUT:
    -		strm->internal->allow_buf_error = false;
    -		ret = LZMA_OK;
    -		break;
    -
    -	case LZMA_STREAM_END:
    -		if (strm->internal->sequence == ISEQ_SYNC_FLUSH
    -				|| strm->internal->sequence == ISEQ_FULL_FLUSH
    -				|| strm->internal->sequence
    -					== ISEQ_FULL_BARRIER)
    -			strm->internal->sequence = ISEQ_RUN;
    -		else
    -			strm->internal->sequence = ISEQ_END;
    -
    -	// Fall through
    -
    -	case LZMA_NO_CHECK:
    -	case LZMA_UNSUPPORTED_CHECK:
    -	case LZMA_GET_CHECK:
    -	case LZMA_MEMLIMIT_ERROR:
    -		// Something else than LZMA_OK, but not a fatal error,
    -		// that is, coding may be continued (except if ISEQ_END).
    -		strm->internal->allow_buf_error = false;
    -		break;
    -
    -	default:
    -		// All the other errors are fatal; coding cannot be continued.
    -		assert(ret != LZMA_BUF_ERROR);
    -		strm->internal->sequence = ISEQ_ERROR;
    -		break;
    -	}
    -
    -	return ret;
    -}
    -
    -
    -extern LZMA_API(void)
    -lzma_end(lzma_stream *strm)
    -{
    -	if (strm != NULL && strm->internal != NULL) {
    -		lzma_next_end(&strm->internal->next, strm->allocator);
    -		lzma_free(strm->internal, strm->allocator);
    -		strm->internal = NULL;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern LZMA_API(void)
    -lzma_get_progress(lzma_stream *strm,
    -		uint64_t *progress_in, uint64_t *progress_out)
    -{
    -	if (strm->internal->next.get_progress != NULL) {
    -		strm->internal->next.get_progress(strm->internal->next.coder,
    -				progress_in, progress_out);
    -	} else {
    -		*progress_in = strm->total_in;
    -		*progress_out = strm->total_out;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern LZMA_API(lzma_check)
    -lzma_get_check(const lzma_stream *strm)
    -{
    -	// Return LZMA_CHECK_NONE if we cannot know the check type.
    -	// It's a bug in the application if this happens.
    -	if (strm->internal->next.get_check == NULL)
    -		return LZMA_CHECK_NONE;
    -
    -	return strm->internal->next.get_check(strm->internal->next.coder);
    -}
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_memusage(const lzma_stream *strm)
    -{
    -	uint64_t memusage;
    -	uint64_t old_memlimit;
    -
    -	if (strm == NULL || strm->internal == NULL
    -			|| strm->internal->next.memconfig == NULL
    -			|| strm->internal->next.memconfig(
    -				strm->internal->next.coder,
    -				&memusage, &old_memlimit, 0) != LZMA_OK)
    -		return 0;
    -
    -	return memusage;
    -}
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_memlimit_get(const lzma_stream *strm)
    -{
    -	uint64_t old_memlimit;
    -	uint64_t memusage;
    -
    -	if (strm == NULL || strm->internal == NULL
    -			|| strm->internal->next.memconfig == NULL
    -			|| strm->internal->next.memconfig(
    -				strm->internal->next.coder,
    -				&memusage, &old_memlimit, 0) != LZMA_OK)
    -		return 0;
    -
    -	return old_memlimit;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_memlimit_set(lzma_stream *strm, uint64_t new_memlimit)
    -{
    -	// Dummy variables to simplify memconfig functions
    -	uint64_t old_memlimit;
    -	uint64_t memusage;
    -
    -	if (strm == NULL || strm->internal == NULL
    -			|| strm->internal->next.memconfig == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	if (new_memlimit != 0 && new_memlimit < LZMA_MEMUSAGE_BASE)
    -		return LZMA_MEMLIMIT_ERROR;
    -
    -	return strm->internal->next.memconfig(strm->internal->next.coder,
    -			&memusage, &old_memlimit, new_memlimit);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/common.h b/external/public-domain/xz/dist/src/liblzma/common/common.h
    deleted file mode 100644
    index 955d784a5..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/common.h
    +++ /dev/null
    @@ -1,318 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       common.h
    -/// \brief      Definitions common to the whole liblzma library
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_COMMON_H
    -#define LZMA_COMMON_H
    -
    -#include "sysdefs.h"
    -#include "mythread.h"
    -#include "tuklib_integer.h"
    -
    -#if defined(_WIN32) || defined(__CYGWIN__)
    -#	ifdef DLL_EXPORT
    -#		define LZMA_API_EXPORT __declspec(dllexport)
    -#	else
    -#		define LZMA_API_EXPORT
    -#	endif
    -// Don't use ifdef or defined() below.
    -#elif HAVE_VISIBILITY
    -#	define LZMA_API_EXPORT __attribute__((__visibility__("default")))
    -#else
    -#	define LZMA_API_EXPORT
    -#endif
    -
    -#define LZMA_API(type) LZMA_API_EXPORT type LZMA_API_CALL
    -
    -#include "lzma.h"
    -
    -// These allow helping the compiler in some often-executed branches, whose
    -// result is almost always the same.
    -#ifdef __GNUC__
    -#	define likely(expr) __builtin_expect(expr, true)
    -#	define unlikely(expr) __builtin_expect(expr, false)
    -#else
    -#	define likely(expr) (expr)
    -#	define unlikely(expr) (expr)
    -#endif
    -
    -
    -/// Size of temporary buffers needed in some filters
    -#define LZMA_BUFFER_SIZE 4096
    -
    -
    -/// Maximum number of worker threads within one multithreaded component.
    -/// The limit exists solely to make it simpler to prevent integer overflows
    -/// when allocating structures etc. This should be big enough for now...
    -/// the code won't scale anywhere close to this number anyway.
    -#define LZMA_THREADS_MAX 16384
    -
    -
    -/// Starting value for memory usage estimates. Instead of calculating size
    -/// of _every_ structure and taking into account malloc() overhead etc., we
    -/// add a base size to all memory usage estimates. It's not very accurate
    -/// but should be easily good enough.
    -#define LZMA_MEMUSAGE_BASE (UINT64_C(1) << 15)
    -
    -/// Start of internal Filter ID space. These IDs must never be used
    -/// in Streams.
    -#define LZMA_FILTER_RESERVED_START (LZMA_VLI_C(1) << 62)
    -
    -
    -/// Supported flags that can be passed to lzma_stream_decoder()
    -/// or lzma_auto_decoder().
    -#define LZMA_SUPPORTED_FLAGS \
    -	( LZMA_TELL_NO_CHECK \
    -	| LZMA_TELL_UNSUPPORTED_CHECK \
    -	| LZMA_TELL_ANY_CHECK \
    -	| LZMA_IGNORE_CHECK \
    -	| LZMA_CONCATENATED )
    -
    -
    -/// Largest valid lzma_action value as unsigned integer.
    -#define LZMA_ACTION_MAX ((unsigned int)(LZMA_FULL_BARRIER))
    -
    -
    -/// Special return value (lzma_ret) to indicate that a timeout was reached
    -/// and lzma_code() must not return LZMA_BUF_ERROR. This is converted to
    -/// LZMA_OK in lzma_code(). This is not in the lzma_ret enumeration because
    -/// there's no need to have it in the public API.
    -#define LZMA_TIMED_OUT 32
    -
    -
    -/// Type of encoder/decoder specific data; the actual structure is defined
    -/// differently in different coders.
    -typedef struct lzma_coder_s lzma_coder;
    -
    -typedef struct lzma_next_coder_s lzma_next_coder;
    -
    -typedef struct lzma_filter_info_s lzma_filter_info;
    -
    -
    -/// Type of a function used to initialize a filter encoder or decoder
    -typedef lzma_ret (*lzma_init_function)(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -/// Type of a function to do some kind of coding work (filters, Stream,
    -/// Block encoders/decoders etc.). Some special coders use don't use both
    -/// input and output buffers, but for simplicity they still use this same
    -/// function prototype.
    -typedef lzma_ret (*lzma_code_function)(
    -		lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size,
    -		lzma_action action);
    -
    -/// Type of a function to free the memory allocated for the coder
    -typedef void (*lzma_end_function)(
    -		lzma_coder *coder, const lzma_allocator *allocator);
    -
    -
    -/// Raw coder validates and converts an array of lzma_filter structures to
    -/// an array of lzma_filter_info structures. This array is used with
    -/// lzma_next_filter_init to initialize the filter chain.
    -struct lzma_filter_info_s {
    -	/// Filter ID. This is used only by the encoder
    -	/// with lzma_filters_update().
    -	lzma_vli id;
    -
    -	/// Pointer to function used to initialize the filter.
    -	/// This is NULL to indicate end of array.
    -	lzma_init_function init;
    -
    -	/// Pointer to filter's options structure
    -	void *options;
    -};
    -
    -
    -/// Hold data and function pointers of the next filter in the chain.
    -struct lzma_next_coder_s {
    -	/// Pointer to coder-specific data
    -	lzma_coder *coder;
    -
    -	/// Filter ID. This is LZMA_VLI_UNKNOWN when this structure doesn't
    -	/// point to a filter coder.
    -	lzma_vli id;
    -
    -	/// "Pointer" to init function. This is never called here.
    -	/// We need only to detect if we are initializing a coder
    -	/// that was allocated earlier. See lzma_next_coder_init and
    -	/// lzma_next_strm_init macros in this file.
    -	uintptr_t init;
    -
    -	/// Pointer to function to do the actual coding
    -	lzma_code_function code;
    -
    -	/// Pointer to function to free lzma_next_coder.coder. This can
    -	/// be NULL; in that case, lzma_free is called to free
    -	/// lzma_next_coder.coder.
    -	lzma_end_function end;
    -
    -	/// Pointer to a function to get progress information. If this is NULL,
    -	/// lzma_stream.total_in and .total_out are used instead.
    -	void (*get_progress)(lzma_coder *coder,
    -			uint64_t *progress_in, uint64_t *progress_out);
    -
    -	/// Pointer to function to return the type of the integrity check.
    -	/// Most coders won't support this.
    -	lzma_check (*get_check)(const lzma_coder *coder);
    -
    -	/// Pointer to function to get and/or change the memory usage limit.
    -	/// If new_memlimit == 0, the limit is not changed.
    -	lzma_ret (*memconfig)(lzma_coder *coder, uint64_t *memusage,
    -			uint64_t *old_memlimit, uint64_t new_memlimit);
    -
    -	/// Update the filter-specific options or the whole filter chain
    -	/// in the encoder.
    -	lzma_ret (*update)(lzma_coder *coder, const lzma_allocator *allocator,
    -			const lzma_filter *filters,
    -			const lzma_filter *reversed_filters);
    -};
    -
    -
    -/// Macro to initialize lzma_next_coder structure
    -#define LZMA_NEXT_CODER_INIT \
    -	(lzma_next_coder){ \
    -		.coder = NULL, \
    -		.init = (uintptr_t)(NULL), \
    -		.id = LZMA_VLI_UNKNOWN, \
    -		.code = NULL, \
    -		.end = NULL, \
    -		.get_progress = NULL, \
    -		.get_check = NULL, \
    -		.memconfig = NULL, \
    -		.update = NULL, \
    -	}
    -
    -
    -/// Internal data for lzma_strm_init, lzma_code, and lzma_end. A pointer to
    -/// this is stored in lzma_stream.
    -struct lzma_internal_s {
    -	/// The actual coder that should do something useful
    -	lzma_next_coder next;
    -
    -	/// Track the state of the coder. This is used to validate arguments
    -	/// so that the actual coders can rely on e.g. that LZMA_SYNC_FLUSH
    -	/// is used on every call to lzma_code until next.code has returned
    -	/// LZMA_STREAM_END.
    -	enum {
    -		ISEQ_RUN,
    -		ISEQ_SYNC_FLUSH,
    -		ISEQ_FULL_FLUSH,
    -		ISEQ_FINISH,
    -		ISEQ_FULL_BARRIER,
    -		ISEQ_END,
    -		ISEQ_ERROR,
    -	} sequence;
    -
    -	/// A copy of lzma_stream avail_in. This is used to verify that the
    -	/// amount of input doesn't change once e.g. LZMA_FINISH has been
    -	/// used.
    -	size_t avail_in;
    -
    -	/// Indicates which lzma_action values are allowed by next.code.
    -	bool supported_actions[LZMA_ACTION_MAX + 1];
    -
    -	/// If true, lzma_code will return LZMA_BUF_ERROR if no progress was
    -	/// made (no input consumed and no output produced by next.code).
    -	bool allow_buf_error;
    -};
    -
    -
    -/// Allocates memory
    -extern void *lzma_alloc(size_t size, const lzma_allocator *allocator)
    -		lzma_attribute((__malloc__)) lzma_attr_alloc_size(1);
    -
    -/// Allocates memory and zeroes it (like calloc()). This can be faster
    -/// than lzma_alloc() + memzero() while being backward compatible with
    -/// custom allocators.
    -extern void * lzma_attribute((__malloc__)) lzma_attr_alloc_size(1)
    -		lzma_alloc_zero(size_t size, const lzma_allocator *allocator);
    -
    -/// Frees memory
    -extern void lzma_free(void *ptr, const lzma_allocator *allocator);
    -
    -
    -/// Allocates strm->internal if it is NULL, and initializes *strm and
    -/// strm->internal. This function is only called via lzma_next_strm_init macro.
    -extern lzma_ret lzma_strm_init(lzma_stream *strm);
    -
    -/// Initializes the next filter in the chain, if any. This takes care of
    -/// freeing the memory of previously initialized filter if it is different
    -/// than the filter being initialized now. This way the actual filter
    -/// initialization functions don't need to use lzma_next_coder_init macro.
    -extern lzma_ret lzma_next_filter_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -/// Update the next filter in the chain, if any. This checks that
    -/// the application is not trying to change the Filter IDs.
    -extern lzma_ret lzma_next_filter_update(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *reversed_filters);
    -
    -/// Frees the memory allocated for next->coder either using next->end or,
    -/// if next->end is NULL, using lzma_free.
    -extern void lzma_next_end(lzma_next_coder *next,
    -		const lzma_allocator *allocator);
    -
    -
    -/// Copy as much data as possible from in[] to out[] and update *in_pos
    -/// and *out_pos accordingly. Returns the number of bytes copied.
    -extern size_t lzma_bufcpy(const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size);
    -
    -
    -/// \brief      Return if expression doesn't evaluate to LZMA_OK
    -///
    -/// There are several situations where we want to return immediately
    -/// with the value of expr if it isn't LZMA_OK. This macro shortens
    -/// the code a little.
    -#define return_if_error(expr) \
    -do { \
    -	const lzma_ret ret_ = (expr); \
    -	if (ret_ != LZMA_OK) \
    -		return ret_; \
    -} while (0)
    -
    -
    -/// If next isn't already initialized, free the previous coder. Then mark
    -/// that next is _possibly_ initialized for the coder using this macro.
    -/// "Possibly" means that if e.g. allocation of next->coder fails, the
    -/// structure isn't actually initialized for this coder, but leaving
    -/// next->init to func is still OK.
    -#define lzma_next_coder_init(func, next, allocator) \
    -do { \
    -	if ((uintptr_t)(func) != (next)->init) \
    -		lzma_next_end(next, allocator); \
    -	(next)->init = (uintptr_t)(func); \
    -} while (0)
    -
    -
    -/// Initializes lzma_strm and calls func() to initialize strm->internal->next.
    -/// (The function being called will use lzma_next_coder_init()). If
    -/// initialization fails, memory that wasn't freed by func() is freed
    -/// along strm->internal.
    -#define lzma_next_strm_init(func, strm, ...) \
    -do { \
    -	return_if_error(lzma_strm_init(strm)); \
    -	const lzma_ret ret_ = func(&(strm)->internal->next, \
    -			(strm)->allocator, __VA_ARGS__); \
    -	if (ret_ != LZMA_OK) { \
    -		lzma_end(strm); \
    -		return ret_; \
    -	} \
    -} while (0)
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/easy_buffer_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/easy_buffer_encoder.c
    deleted file mode 100644
    index 48eb56f5c..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/easy_buffer_encoder.c
    +++ /dev/null
    @@ -1,27 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       easy_buffer_encoder.c
    -/// \brief      Easy single-call .xz Stream encoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "easy_preset.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_easy_buffer_encode(uint32_t preset, lzma_check check,
    -		const lzma_allocator *allocator, const uint8_t *in,
    -		size_t in_size, uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	lzma_options_easy opt_easy;
    -	if (lzma_easy_preset(&opt_easy, preset))
    -		return LZMA_OPTIONS_ERROR;
    -
    -	return lzma_stream_buffer_encode(opt_easy.filters, check,
    -			allocator, in, in_size, out, out_pos, out_size);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/easy_decoder_memusage.c b/external/public-domain/xz/dist/src/liblzma/common/easy_decoder_memusage.c
    deleted file mode 100644
    index 20bcd5b71..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/easy_decoder_memusage.c
    +++ /dev/null
    @@ -1,24 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       easy_decoder_memusage.c
    -/// \brief      Decoder memory usage calculation to match easy encoder presets
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "easy_preset.h"
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_easy_decoder_memusage(uint32_t preset)
    -{
    -	lzma_options_easy opt_easy;
    -	if (lzma_easy_preset(&opt_easy, preset))
    -		return UINT32_MAX;
    -
    -	return lzma_raw_decoder_memusage(opt_easy.filters);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/easy_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/easy_encoder.c
    deleted file mode 100644
    index 5cb492dd0..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/easy_encoder.c
    +++ /dev/null
    @@ -1,24 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       easy_encoder.c
    -/// \brief      Easy .xz Stream encoder initialization
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "easy_preset.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_easy_encoder(lzma_stream *strm, uint32_t preset, lzma_check check)
    -{
    -	lzma_options_easy opt_easy;
    -	if (lzma_easy_preset(&opt_easy, preset))
    -		return LZMA_OPTIONS_ERROR;
    -
    -	return lzma_stream_encoder(strm, opt_easy.filters, check);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/easy_encoder_memusage.c b/external/public-domain/xz/dist/src/liblzma/common/easy_encoder_memusage.c
    deleted file mode 100644
    index e91057584..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/easy_encoder_memusage.c
    +++ /dev/null
    @@ -1,24 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       easy_encoder_memusage.c
    -/// \brief      Easy .xz Stream encoder memory usage calculation
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "easy_preset.h"
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_easy_encoder_memusage(uint32_t preset)
    -{
    -	lzma_options_easy opt_easy;
    -	if (lzma_easy_preset(&opt_easy, preset))
    -		return UINT32_MAX;
    -
    -	return lzma_raw_encoder_memusage(opt_easy.filters);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/easy_preset.c b/external/public-domain/xz/dist/src/liblzma/common/easy_preset.c
    deleted file mode 100644
    index 2f9859860..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/easy_preset.c
    +++ /dev/null
    @@ -1,27 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       easy_preset.c
    -/// \brief      Preset handling for easy encoder and decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "easy_preset.h"
    -
    -
    -extern bool
    -lzma_easy_preset(lzma_options_easy *opt_easy, uint32_t preset)
    -{
    -	if (lzma_lzma_preset(&opt_easy->opt_lzma, preset))
    -		return true;
    -
    -	opt_easy->filters[0].id = LZMA_FILTER_LZMA2;
    -	opt_easy->filters[0].options = &opt_easy->opt_lzma;
    -	opt_easy->filters[1].id = LZMA_VLI_UNKNOWN;
    -
    -	return false;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/easy_preset.h b/external/public-domain/xz/dist/src/liblzma/common/easy_preset.h
    deleted file mode 100644
    index 382ade894..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/easy_preset.h
    +++ /dev/null
    @@ -1,32 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       easy_preset.h
    -/// \brief      Preset handling for easy encoder and decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -
    -typedef struct {
    -	/// We need to keep the filters array available in case
    -	/// LZMA_FULL_FLUSH is used.
    -	lzma_filter filters[LZMA_FILTERS_MAX + 1];
    -
    -	/// Options for LZMA2
    -	lzma_options_lzma opt_lzma;
    -
    -	// Options for more filters can be added later, so this struct
    -	// is not ready to be put into the public API.
    -
    -} lzma_options_easy;
    -
    -
    -/// Set *easy to the settings given by the preset. Returns true on error,
    -/// false on success.
    -extern bool lzma_easy_preset(lzma_options_easy *easy, uint32_t preset);
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_buffer_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/filter_buffer_decoder.c
    deleted file mode 100644
    index 6620986ee..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_buffer_decoder.c
    +++ /dev/null
    @@ -1,88 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_buffer_decoder.c
    -/// \brief      Single-call raw decoding
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "filter_decoder.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_raw_buffer_decode(
    -		const lzma_filter *filters, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	// Validate what isn't validated later in filter_common.c.
    -	if (in == NULL || in_pos == NULL || *in_pos > in_size || out == NULL
    -			|| out_pos == NULL || *out_pos > out_size)
    -		return LZMA_PROG_ERROR;
    -
    -	// Initialize the decoer.
    -	lzma_next_coder next = LZMA_NEXT_CODER_INIT;
    -	return_if_error(lzma_raw_decoder_init(&next, allocator, filters));
    -
    -	// Store the positions so that we can restore them if something
    -	// goes wrong.
    -	const size_t in_start = *in_pos;
    -	const size_t out_start = *out_pos;
    -
    -	// Do the actual decoding and free decoder's memory.
    -	lzma_ret ret = next.code(next.coder, allocator, in, in_pos, in_size,
    -			out, out_pos, out_size, LZMA_FINISH);
    -
    -	if (ret == LZMA_STREAM_END) {
    -		ret = LZMA_OK;
    -	} else {
    -		if (ret == LZMA_OK) {
    -			// Either the input was truncated or the
    -			// output buffer was too small.
    -			assert(*in_pos == in_size || *out_pos == out_size);
    -
    -			if (*in_pos != in_size) {
    -				// Since input wasn't consumed completely,
    -				// the output buffer became full and is
    -				// too small.
    -				ret = LZMA_BUF_ERROR;
    -
    -			} else if (*out_pos != out_size) {
    -				// Since output didn't became full, the input
    -				// has to be truncated.
    -				ret = LZMA_DATA_ERROR;
    -
    -			} else {
    -				// All the input was consumed and output
    -				// buffer is full. Now we don't immediately
    -				// know the reason for the error. Try
    -				// decoding one more byte. If it succeeds,
    -				// then the output buffer was too small. If
    -				// we cannot get a new output byte, the input
    -				// is truncated.
    -				uint8_t tmp[1];
    -				size_t tmp_pos = 0;
    -				(void)next.code(next.coder, allocator,
    -						in, in_pos, in_size,
    -						tmp, &tmp_pos, 1, LZMA_FINISH);
    -
    -				if (tmp_pos == 1)
    -					ret = LZMA_BUF_ERROR;
    -				else
    -					ret = LZMA_DATA_ERROR;
    -			}
    -		}
    -
    -		// Restore the positions.
    -		*in_pos = in_start;
    -		*out_pos = out_start;
    -	}
    -
    -	lzma_next_end(&next, allocator);
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_buffer_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/filter_buffer_encoder.c
    deleted file mode 100644
    index dda18e3d8..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_buffer_encoder.c
    +++ /dev/null
    @@ -1,55 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_buffer_encoder.c
    -/// \brief      Single-call raw encoding
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "filter_encoder.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_raw_buffer_encode(
    -		const lzma_filter *filters, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	// Validate what isn't validated later in filter_common.c.
    -	if ((in == NULL && in_size != 0) || out == NULL
    -			|| out_pos == NULL || *out_pos > out_size)
    -		return LZMA_PROG_ERROR;
    -
    -	// Initialize the encoder
    -	lzma_next_coder next = LZMA_NEXT_CODER_INIT;
    -	return_if_error(lzma_raw_encoder_init(&next, allocator, filters));
    -
    -	// Store the output position so that we can restore it if
    -	// something goes wrong.
    -	const size_t out_start = *out_pos;
    -
    -	// Do the actual encoding and free coder's memory.
    -	size_t in_pos = 0;
    -	lzma_ret ret = next.code(next.coder, allocator, in, &in_pos, in_size,
    -			out, out_pos, out_size, LZMA_FINISH);
    -	lzma_next_end(&next, allocator);
    -
    -	if (ret == LZMA_STREAM_END) {
    -		ret = LZMA_OK;
    -	} else {
    -		if (ret == LZMA_OK) {
    -			// Output buffer was too small.
    -			assert(*out_pos == out_size);
    -			ret = LZMA_BUF_ERROR;
    -		}
    -
    -		// Restore the output position.
    -		*out_pos = out_start;
    -	}
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_common.c b/external/public-domain/xz/dist/src/liblzma/common/filter_common.c
    deleted file mode 100644
    index 9ad5d5d8e..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_common.c
    +++ /dev/null
    @@ -1,337 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_common.c
    -/// \brief      Filter-specific stuff common for both encoder and decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "filter_common.h"
    -
    -
    -static const struct {
    -	/// Filter ID
    -	lzma_vli id;
    -
    -	/// Size of the filter-specific options structure
    -	size_t options_size;
    -
    -	/// True if it is OK to use this filter as non-last filter in
    -	/// the chain.
    -	bool non_last_ok;
    -
    -	/// True if it is OK to use this filter as the last filter in
    -	/// the chain.
    -	bool last_ok;
    -
    -	/// True if the filter may change the size of the data (that is, the
    -	/// amount of encoded output can be different than the amount of
    -	/// uncompressed input).
    -	bool changes_size;
    -
    -} features[] = {
    -#if defined (HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1)
    -	{
    -		.id = LZMA_FILTER_LZMA1,
    -		.options_size = sizeof(lzma_options_lzma),
    -		.non_last_ok = false,
    -		.last_ok = true,
    -		.changes_size = true,
    -	},
    -#endif
    -#if defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2)
    -	{
    -		.id = LZMA_FILTER_LZMA2,
    -		.options_size = sizeof(lzma_options_lzma),
    -		.non_last_ok = false,
    -		.last_ok = true,
    -		.changes_size = true,
    -	},
    -#endif
    -#if defined(HAVE_ENCODER_X86) || defined(HAVE_DECODER_X86)
    -	{
    -		.id = LZMA_FILTER_X86,
    -		.options_size = sizeof(lzma_options_bcj),
    -		.non_last_ok = true,
    -		.last_ok = false,
    -		.changes_size = false,
    -	},
    -#endif
    -#if defined(HAVE_ENCODER_POWERPC) || defined(HAVE_DECODER_POWERPC)
    -	{
    -		.id = LZMA_FILTER_POWERPC,
    -		.options_size = sizeof(lzma_options_bcj),
    -		.non_last_ok = true,
    -		.last_ok = false,
    -		.changes_size = false,
    -	},
    -#endif
    -#if defined(HAVE_ENCODER_IA64) || defined(HAVE_DECODER_IA64)
    -	{
    -		.id = LZMA_FILTER_IA64,
    -		.options_size = sizeof(lzma_options_bcj),
    -		.non_last_ok = true,
    -		.last_ok = false,
    -		.changes_size = false,
    -	},
    -#endif
    -#if defined(HAVE_ENCODER_ARM) || defined(HAVE_DECODER_ARM)
    -	{
    -		.id = LZMA_FILTER_ARM,
    -		.options_size = sizeof(lzma_options_bcj),
    -		.non_last_ok = true,
    -		.last_ok = false,
    -		.changes_size = false,
    -	},
    -#endif
    -#if defined(HAVE_ENCODER_ARMTHUMB) || defined(HAVE_DECODER_ARMTHUMB)
    -	{
    -		.id = LZMA_FILTER_ARMTHUMB,
    -		.options_size = sizeof(lzma_options_bcj),
    -		.non_last_ok = true,
    -		.last_ok = false,
    -		.changes_size = false,
    -	},
    -#endif
    -#if defined(HAVE_ENCODER_SPARC) || defined(HAVE_DECODER_SPARC)
    -	{
    -		.id = LZMA_FILTER_SPARC,
    -		.options_size = sizeof(lzma_options_bcj),
    -		.non_last_ok = true,
    -		.last_ok = false,
    -		.changes_size = false,
    -	},
    -#endif
    -#if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA)
    -	{
    -		.id = LZMA_FILTER_DELTA,
    -		.options_size = sizeof(lzma_options_delta),
    -		.non_last_ok = true,
    -		.last_ok = false,
    -		.changes_size = false,
    -	},
    -#endif
    -	{
    -		.id = LZMA_VLI_UNKNOWN
    -	}
    -};
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_filters_copy(const lzma_filter *src, lzma_filter *dest,
    -		const lzma_allocator *allocator)
    -{
    -	if (src == NULL || dest == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	lzma_ret ret;
    -	size_t i;
    -	for (i = 0; src[i].id != LZMA_VLI_UNKNOWN; ++i) {
    -		// There must be a maximum of four filters plus
    -		// the array terminator.
    -		if (i == LZMA_FILTERS_MAX) {
    -			ret = LZMA_OPTIONS_ERROR;
    -			goto error;
    -		}
    -
    -		dest[i].id = src[i].id;
    -
    -		if (src[i].options == NULL) {
    -			dest[i].options = NULL;
    -		} else {
    -			// See if the filter is supported only when the
    -			// options is not NULL. This might be convenient
    -			// sometimes if the app is actually copying only
    -			// a partial filter chain with a place holder ID.
    -			//
    -			// When options is not NULL, the Filter ID must be
    -			// supported by us, because otherwise we don't know
    -			// how big the options are.
    -			size_t j;
    -			for (j = 0; src[i].id != features[j].id; ++j) {
    -				if (features[j].id == LZMA_VLI_UNKNOWN) {
    -					ret = LZMA_OPTIONS_ERROR;
    -					goto error;
    -				}
    -			}
    -
    -			// Allocate and copy the options.
    -			dest[i].options = lzma_alloc(features[j].options_size,
    -					allocator);
    -			if (dest[i].options == NULL) {
    -				ret = LZMA_MEM_ERROR;
    -				goto error;
    -			}
    -
    -			memcpy(dest[i].options, src[i].options,
    -					features[j].options_size);
    -		}
    -	}
    -
    -	// Terminate the filter array.
    -	assert(i <= LZMA_FILTERS_MAX + 1);
    -	dest[i].id = LZMA_VLI_UNKNOWN;
    -	dest[i].options = NULL;
    -
    -	return LZMA_OK;
    -
    -error:
    -	// Free the options which we have already allocated.
    -	while (i-- > 0) {
    -		lzma_free(dest[i].options, allocator);
    -		dest[i].options = NULL;
    -	}
    -
    -	return ret;
    -}
    -
    -
    -static lzma_ret
    -validate_chain(const lzma_filter *filters, size_t *count)
    -{
    -	// There must be at least one filter.
    -	if (filters == NULL || filters[0].id == LZMA_VLI_UNKNOWN)
    -		return LZMA_PROG_ERROR;
    -
    -	// Number of non-last filters that may change the size of the data
    -	// significantly (that is, more than 1-2 % or so).
    -	size_t changes_size_count = 0;
    -
    -	// True if it is OK to add a new filter after the current filter.
    -	bool non_last_ok = true;
    -
    -	// True if the last filter in the given chain is actually usable as
    -	// the last filter. Only filters that support embedding End of Payload
    -	// Marker can be used as the last filter in the chain.
    -	bool last_ok = false;
    -
    -	size_t i = 0;
    -	do {
    -		size_t j;
    -		for (j = 0; filters[i].id != features[j].id; ++j)
    -			if (features[j].id == LZMA_VLI_UNKNOWN)
    -				return LZMA_OPTIONS_ERROR;
    -
    -		// If the previous filter in the chain cannot be a non-last
    -		// filter, the chain is invalid.
    -		if (!non_last_ok)
    -			return LZMA_OPTIONS_ERROR;
    -
    -		non_last_ok = features[j].non_last_ok;
    -		last_ok = features[j].last_ok;
    -		changes_size_count += features[j].changes_size;
    -
    -	} while (filters[++i].id != LZMA_VLI_UNKNOWN);
    -
    -	// There must be 1-4 filters. The last filter must be usable as
    -	// the last filter in the chain. A maximum of three filters are
    -	// allowed to change the size of the data.
    -	if (i > LZMA_FILTERS_MAX || !last_ok || changes_size_count > 3)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	*count = i;
    -	return LZMA_OK;
    -}
    -
    -
    -extern lzma_ret
    -lzma_raw_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *options,
    -		lzma_filter_find coder_find, bool is_encoder)
    -{
    -	// Do some basic validation and get the number of filters.
    -	size_t count;
    -	return_if_error(validate_chain(options, &count));
    -
    -	// Set the filter functions and copy the options pointer.
    -	lzma_filter_info filters[LZMA_FILTERS_MAX + 1];
    -	if (is_encoder) {
    -		for (size_t i = 0; i < count; ++i) {
    -			// The order of the filters is reversed in the
    -			// encoder. It allows more efficient handling
    -			// of the uncompressed data.
    -			const size_t j = count - i - 1;
    -
    -			const lzma_filter_coder *const fc
    -					= coder_find(options[i].id);
    -			if (fc == NULL || fc->init == NULL)
    -				return LZMA_OPTIONS_ERROR;
    -
    -			filters[j].id = options[i].id;
    -			filters[j].init = fc->init;
    -			filters[j].options = options[i].options;
    -		}
    -	} else {
    -		for (size_t i = 0; i < count; ++i) {
    -			const lzma_filter_coder *const fc
    -					= coder_find(options[i].id);
    -			if (fc == NULL || fc->init == NULL)
    -				return LZMA_OPTIONS_ERROR;
    -
    -			filters[i].id = options[i].id;
    -			filters[i].init = fc->init;
    -			filters[i].options = options[i].options;
    -		}
    -	}
    -
    -	// Terminate the array.
    -	filters[count].id = LZMA_VLI_UNKNOWN;
    -	filters[count].init = NULL;
    -
    -	// Initialize the filters.
    -	const lzma_ret ret = lzma_next_filter_init(next, allocator, filters);
    -	if (ret != LZMA_OK)
    -		lzma_next_end(next, allocator);
    -
    -	return ret;
    -}
    -
    -
    -extern uint64_t
    -lzma_raw_coder_memusage(lzma_filter_find coder_find,
    -		const lzma_filter *filters)
    -{
    -	// The chain has to have at least one filter.
    -	{
    -		size_t tmp;
    -		if (validate_chain(filters, &tmp) != LZMA_OK)
    -			return UINT64_MAX;
    -	}
    -
    -	uint64_t total = 0;
    -	size_t i = 0;
    -
    -	do {
    -		const lzma_filter_coder *const fc
    -				 = coder_find(filters[i].id);
    -		if (fc == NULL)
    -			return UINT64_MAX; // Unsupported Filter ID
    -
    -		if (fc->memusage == NULL) {
    -			// This filter doesn't have a function to calculate
    -			// the memory usage and validate the options. Such
    -			// filters need only little memory, so we use 1 KiB
    -			// as a good estimate. They also accept all possible
    -			// options, so there's no need to worry about lack
    -			// of validation.
    -			total += 1024;
    -		} else {
    -			// Call the filter-specific memory usage calculation
    -			// function.
    -			const uint64_t usage
    -					= fc->memusage(filters[i].options);
    -			if (usage == UINT64_MAX)
    -				return UINT64_MAX; // Invalid options
    -
    -			total += usage;
    -		}
    -	} while (filters[++i].id != LZMA_VLI_UNKNOWN);
    -
    -	// Add some fixed amount of extra. It's to compensate memory usage
    -	// of Stream, Block etc. coders, malloc() overhead, stack etc.
    -	return total + LZMA_MEMUSAGE_BASE;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_common.h b/external/public-domain/xz/dist/src/liblzma/common/filter_common.h
    deleted file mode 100644
    index 42a26a24a..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_common.h
    +++ /dev/null
    @@ -1,48 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_common.c
    -/// \brief      Filter-specific stuff common for both encoder and decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_FILTER_COMMON_H
    -#define LZMA_FILTER_COMMON_H
    -
    -#include "common.h"
    -
    -
    -/// Both lzma_filter_encoder and lzma_filter_decoder begin with these members.
    -typedef struct {
    -	/// Filter ID
    -	lzma_vli id;
    -
    -	/// Initializes the filter encoder and calls lzma_next_filter_init()
    -	/// for filters + 1.
    -	lzma_init_function init;
    -
    -	/// Calculates memory usage of the encoder. If the options are
    -	/// invalid, UINT64_MAX is returned.
    -	uint64_t (*memusage)(const void *options);
    -
    -} lzma_filter_coder;
    -
    -
    -typedef const lzma_filter_coder *(*lzma_filter_find)(lzma_vli id);
    -
    -
    -extern lzma_ret lzma_raw_coder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *filters,
    -		lzma_filter_find coder_find, bool is_encoder);
    -
    -
    -extern uint64_t lzma_raw_coder_memusage(lzma_filter_find coder_find,
    -		const lzma_filter *filters);
    -
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/filter_decoder.c
    deleted file mode 100644
    index c75b0a89c..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_decoder.c
    +++ /dev/null
    @@ -1,184 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_decoder.c
    -/// \brief      Filter ID mapping to filter-specific functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "filter_decoder.h"
    -#include "filter_common.h"
    -#include "lzma_decoder.h"
    -#include "lzma2_decoder.h"
    -#include "simple_decoder.h"
    -#include "delta_decoder.h"
    -
    -
    -typedef struct {
    -	/// Filter ID
    -	lzma_vli id;
    -
    -	/// Initializes the filter encoder and calls lzma_next_filter_init()
    -	/// for filters + 1.
    -	lzma_init_function init;
    -
    -	/// Calculates memory usage of the encoder. If the options are
    -	/// invalid, UINT64_MAX is returned.
    -	uint64_t (*memusage)(const void *options);
    -
    -	/// Decodes Filter Properties.
    -	///
    -	/// \return     - LZMA_OK: Properties decoded successfully.
    -	///             - LZMA_OPTIONS_ERROR: Unsupported properties
    -	///             - LZMA_MEM_ERROR: Memory allocation failed.
    -	lzma_ret (*props_decode)(
    -			void **options, const lzma_allocator *allocator,
    -			const uint8_t *props, size_t props_size);
    -
    -} lzma_filter_decoder;
    -
    -
    -static const lzma_filter_decoder decoders[] = {
    -#ifdef HAVE_DECODER_LZMA1
    -	{
    -		.id = LZMA_FILTER_LZMA1,
    -		.init = &lzma_lzma_decoder_init,
    -		.memusage = &lzma_lzma_decoder_memusage,
    -		.props_decode = &lzma_lzma_props_decode,
    -	},
    -#endif
    -#ifdef HAVE_DECODER_LZMA2
    -	{
    -		.id = LZMA_FILTER_LZMA2,
    -		.init = &lzma_lzma2_decoder_init,
    -		.memusage = &lzma_lzma2_decoder_memusage,
    -		.props_decode = &lzma_lzma2_props_decode,
    -	},
    -#endif
    -#ifdef HAVE_DECODER_X86
    -	{
    -		.id = LZMA_FILTER_X86,
    -		.init = &lzma_simple_x86_decoder_init,
    -		.memusage = NULL,
    -		.props_decode = &lzma_simple_props_decode,
    -	},
    -#endif
    -#ifdef HAVE_DECODER_POWERPC
    -	{
    -		.id = LZMA_FILTER_POWERPC,
    -		.init = &lzma_simple_powerpc_decoder_init,
    -		.memusage = NULL,
    -		.props_decode = &lzma_simple_props_decode,
    -	},
    -#endif
    -#ifdef HAVE_DECODER_IA64
    -	{
    -		.id = LZMA_FILTER_IA64,
    -		.init = &lzma_simple_ia64_decoder_init,
    -		.memusage = NULL,
    -		.props_decode = &lzma_simple_props_decode,
    -	},
    -#endif
    -#ifdef HAVE_DECODER_ARM
    -	{
    -		.id = LZMA_FILTER_ARM,
    -		.init = &lzma_simple_arm_decoder_init,
    -		.memusage = NULL,
    -		.props_decode = &lzma_simple_props_decode,
    -	},
    -#endif
    -#ifdef HAVE_DECODER_ARMTHUMB
    -	{
    -		.id = LZMA_FILTER_ARMTHUMB,
    -		.init = &lzma_simple_armthumb_decoder_init,
    -		.memusage = NULL,
    -		.props_decode = &lzma_simple_props_decode,
    -	},
    -#endif
    -#ifdef HAVE_DECODER_SPARC
    -	{
    -		.id = LZMA_FILTER_SPARC,
    -		.init = &lzma_simple_sparc_decoder_init,
    -		.memusage = NULL,
    -		.props_decode = &lzma_simple_props_decode,
    -	},
    -#endif
    -#ifdef HAVE_DECODER_DELTA
    -	{
    -		.id = LZMA_FILTER_DELTA,
    -		.init = &lzma_delta_decoder_init,
    -		.memusage = &lzma_delta_coder_memusage,
    -		.props_decode = &lzma_delta_props_decode,
    -	},
    -#endif
    -};
    -
    -
    -static const lzma_filter_decoder *
    -decoder_find(lzma_vli id)
    -{
    -	for (size_t i = 0; i < ARRAY_SIZE(decoders); ++i)
    -		if (decoders[i].id == id)
    -			return decoders + i;
    -
    -	return NULL;
    -}
    -
    -
    -extern LZMA_API(lzma_bool)
    -lzma_filter_decoder_is_supported(lzma_vli id)
    -{
    -	return decoder_find(id) != NULL;
    -}
    -
    -
    -extern lzma_ret
    -lzma_raw_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *options)
    -{
    -	return lzma_raw_coder_init(next, allocator,
    -			options, (lzma_filter_find)(&decoder_find), false);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_raw_decoder(lzma_stream *strm, const lzma_filter *options)
    -{
    -	lzma_next_strm_init(lzma_raw_decoder_init, strm, options);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_raw_decoder_memusage(const lzma_filter *filters)
    -{
    -	return lzma_raw_coder_memusage(
    -			(lzma_filter_find)(&decoder_find), filters);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_properties_decode(lzma_filter *filter, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size)
    -{
    -	// Make it always NULL so that the caller can always safely free() it.
    -	filter->options = NULL;
    -
    -	const lzma_filter_decoder *const fd = decoder_find(filter->id);
    -	if (fd == NULL)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	if (fd->props_decode == NULL)
    -		return props_size == 0 ? LZMA_OK : LZMA_OPTIONS_ERROR;
    -
    -	return fd->props_decode(
    -			&filter->options, allocator, props, props_size);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_decoder.h b/external/public-domain/xz/dist/src/liblzma/common/filter_decoder.h
    deleted file mode 100644
    index a2e255fe5..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_decoder.h
    +++ /dev/null
    @@ -1,23 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_decoder.c
    -/// \brief      Filter ID mapping to filter-specific functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_FILTER_DECODER_H
    -#define LZMA_FILTER_DECODER_H
    -
    -#include "common.h"
    -
    -
    -extern lzma_ret lzma_raw_decoder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *options);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/filter_encoder.c
    deleted file mode 100644
    index c5d8f3972..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_encoder.c
    +++ /dev/null
    @@ -1,286 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_decoder.c
    -/// \brief      Filter ID mapping to filter-specific functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "filter_encoder.h"
    -#include "filter_common.h"
    -#include "lzma_encoder.h"
    -#include "lzma2_encoder.h"
    -#include "simple_encoder.h"
    -#include "delta_encoder.h"
    -
    -
    -typedef struct {
    -	/// Filter ID
    -	lzma_vli id;
    -
    -	/// Initializes the filter encoder and calls lzma_next_filter_init()
    -	/// for filters + 1.
    -	lzma_init_function init;
    -
    -	/// Calculates memory usage of the encoder. If the options are
    -	/// invalid, UINT64_MAX is returned.
    -	uint64_t (*memusage)(const void *options);
    -
    -	/// Calculates the recommended Uncompressed Size for .xz Blocks to
    -	/// which the input data can be split to make multithreaded
    -	/// encoding possible. If this is NULL, it is assumed that
    -	/// the encoder is fast enough with single thread.
    -	uint64_t (*block_size)(const void *options);
    -
    -	/// Tells the size of the Filter Properties field. If options are
    -	/// invalid, UINT32_MAX is returned. If this is NULL, props_size_fixed
    -	/// is used.
    -	lzma_ret (*props_size_get)(uint32_t *size, const void *options);
    -	uint32_t props_size_fixed;
    -
    -	/// Encodes Filter Properties.
    -	///
    -	/// \return     - LZMA_OK: Properties encoded successfully.
    -	///             - LZMA_OPTIONS_ERROR: Unsupported options
    -	///             - LZMA_PROG_ERROR: Invalid options or not enough
    -	///               output space
    -	lzma_ret (*props_encode)(const void *options, uint8_t *out);
    -
    -} lzma_filter_encoder;
    -
    -
    -static const lzma_filter_encoder encoders[] = {
    -#ifdef HAVE_ENCODER_LZMA1
    -	{
    -		.id = LZMA_FILTER_LZMA1,
    -		.init = &lzma_lzma_encoder_init,
    -		.memusage = &lzma_lzma_encoder_memusage,
    -		.block_size = NULL, // FIXME
    -		.props_size_get = NULL,
    -		.props_size_fixed = 5,
    -		.props_encode = &lzma_lzma_props_encode,
    -	},
    -#endif
    -#ifdef HAVE_ENCODER_LZMA2
    -	{
    -		.id = LZMA_FILTER_LZMA2,
    -		.init = &lzma_lzma2_encoder_init,
    -		.memusage = &lzma_lzma2_encoder_memusage,
    -		.block_size = &lzma_lzma2_block_size, // FIXME
    -		.props_size_get = NULL,
    -		.props_size_fixed = 1,
    -		.props_encode = &lzma_lzma2_props_encode,
    -	},
    -#endif
    -#ifdef HAVE_ENCODER_X86
    -	{
    -		.id = LZMA_FILTER_X86,
    -		.init = &lzma_simple_x86_encoder_init,
    -		.memusage = NULL,
    -		.block_size = NULL,
    -		.props_size_get = &lzma_simple_props_size,
    -		.props_encode = &lzma_simple_props_encode,
    -	},
    -#endif
    -#ifdef HAVE_ENCODER_POWERPC
    -	{
    -		.id = LZMA_FILTER_POWERPC,
    -		.init = &lzma_simple_powerpc_encoder_init,
    -		.memusage = NULL,
    -		.block_size = NULL,
    -		.props_size_get = &lzma_simple_props_size,
    -		.props_encode = &lzma_simple_props_encode,
    -	},
    -#endif
    -#ifdef HAVE_ENCODER_IA64
    -	{
    -		.id = LZMA_FILTER_IA64,
    -		.init = &lzma_simple_ia64_encoder_init,
    -		.memusage = NULL,
    -		.block_size = NULL,
    -		.props_size_get = &lzma_simple_props_size,
    -		.props_encode = &lzma_simple_props_encode,
    -	},
    -#endif
    -#ifdef HAVE_ENCODER_ARM
    -	{
    -		.id = LZMA_FILTER_ARM,
    -		.init = &lzma_simple_arm_encoder_init,
    -		.memusage = NULL,
    -		.block_size = NULL,
    -		.props_size_get = &lzma_simple_props_size,
    -		.props_encode = &lzma_simple_props_encode,
    -	},
    -#endif
    -#ifdef HAVE_ENCODER_ARMTHUMB
    -	{
    -		.id = LZMA_FILTER_ARMTHUMB,
    -		.init = &lzma_simple_armthumb_encoder_init,
    -		.memusage = NULL,
    -		.block_size = NULL,
    -		.props_size_get = &lzma_simple_props_size,
    -		.props_encode = &lzma_simple_props_encode,
    -	},
    -#endif
    -#ifdef HAVE_ENCODER_SPARC
    -	{
    -		.id = LZMA_FILTER_SPARC,
    -		.init = &lzma_simple_sparc_encoder_init,
    -		.memusage = NULL,
    -		.block_size = NULL,
    -		.props_size_get = &lzma_simple_props_size,
    -		.props_encode = &lzma_simple_props_encode,
    -	},
    -#endif
    -#ifdef HAVE_ENCODER_DELTA
    -	{
    -		.id = LZMA_FILTER_DELTA,
    -		.init = &lzma_delta_encoder_init,
    -		.memusage = &lzma_delta_coder_memusage,
    -		.block_size = NULL,
    -		.props_size_get = NULL,
    -		.props_size_fixed = 1,
    -		.props_encode = &lzma_delta_props_encode,
    -	},
    -#endif
    -};
    -
    -
    -static const lzma_filter_encoder *
    -encoder_find(lzma_vli id)
    -{
    -	for (size_t i = 0; i < ARRAY_SIZE(encoders); ++i)
    -		if (encoders[i].id == id)
    -			return encoders + i;
    -
    -	return NULL;
    -}
    -
    -
    -extern LZMA_API(lzma_bool)
    -lzma_filter_encoder_is_supported(lzma_vli id)
    -{
    -	return encoder_find(id) != NULL;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_filters_update(lzma_stream *strm, const lzma_filter *filters)
    -{
    -	if (strm->internal->next.update == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	// Validate the filter chain.
    -	if (lzma_raw_encoder_memusage(filters) == UINT64_MAX)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// The actual filter chain in the encoder is reversed. Some things
    -	// still want the normal order chain, so we provide both.
    -	size_t count = 1;
    -	while (filters[count].id != LZMA_VLI_UNKNOWN)
    -		++count;
    -
    -	lzma_filter reversed_filters[LZMA_FILTERS_MAX + 1];
    -	for (size_t i = 0; i < count; ++i)
    -		reversed_filters[count - i - 1] = filters[i];
    -
    -	reversed_filters[count].id = LZMA_VLI_UNKNOWN;
    -
    -	return strm->internal->next.update(strm->internal->next.coder,
    -			strm->allocator, filters, reversed_filters);
    -}
    -
    -
    -extern lzma_ret
    -lzma_raw_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *options)
    -{
    -	return lzma_raw_coder_init(next, allocator,
    -			options, (lzma_filter_find)(&encoder_find), true);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_raw_encoder(lzma_stream *strm, const lzma_filter *options)
    -{
    -	lzma_next_strm_init(lzma_raw_coder_init, strm, options,
    -			(lzma_filter_find)(&encoder_find), true);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_raw_encoder_memusage(const lzma_filter *filters)
    -{
    -	return lzma_raw_coder_memusage(
    -			(lzma_filter_find)(&encoder_find), filters);
    -}
    -
    -
    -extern uint64_t
    -lzma_mt_block_size(const lzma_filter *filters)
    -{
    -	uint64_t max = 0;
    -
    -	for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) {
    -		const lzma_filter_encoder *const fe
    -				= encoder_find(filters[i].id);
    -		if (fe->block_size != NULL) {
    -			const uint64_t size
    -					= fe->block_size(filters[i].options);
    -			if (size == 0)
    -				return 0;
    -
    -			if (size > max)
    -				max = size;
    -		}
    -	}
    -
    -	return max;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_properties_size(uint32_t *size, const lzma_filter *filter)
    -{
    -	const lzma_filter_encoder *const fe = encoder_find(filter->id);
    -	if (fe == NULL) {
    -		// Unknown filter - if the Filter ID is a proper VLI,
    -		// return LZMA_OPTIONS_ERROR instead of LZMA_PROG_ERROR,
    -		// because it's possible that we just don't have support
    -		// compiled in for the requested filter.
    -		return filter->id <= LZMA_VLI_MAX
    -				? LZMA_OPTIONS_ERROR : LZMA_PROG_ERROR;
    -	}
    -
    -	if (fe->props_size_get == NULL) {
    -		// No props_size_get() function, use props_size_fixed.
    -		*size = fe->props_size_fixed;
    -		return LZMA_OK;
    -	}
    -
    -	return fe->props_size_get(size, filter->options);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_properties_encode(const lzma_filter *filter, uint8_t *props)
    -{
    -	const lzma_filter_encoder *const fe = encoder_find(filter->id);
    -	if (fe == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	if (fe->props_encode == NULL)
    -		return LZMA_OK;
    -
    -	return fe->props_encode(filter->options, props);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_encoder.h b/external/public-domain/xz/dist/src/liblzma/common/filter_encoder.h
    deleted file mode 100644
    index f1d5683fe..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_encoder.h
    +++ /dev/null
    @@ -1,27 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_encoder.c
    -/// \brief      Filter ID mapping to filter-specific functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_FILTER_ENCODER_H
    -#define LZMA_FILTER_ENCODER_H
    -
    -#include "common.h"
    -
    -
    -// FIXME: Might become a part of the public API.
    -extern uint64_t lzma_mt_block_size(const lzma_filter *filters);
    -
    -
    -extern lzma_ret lzma_raw_encoder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *filters);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_flags_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/filter_flags_decoder.c
    deleted file mode 100644
    index ddfb08594..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_flags_decoder.c
    +++ /dev/null
    @@ -1,46 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_flags_decoder.c
    -/// \brief      Decodes a Filter Flags field
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "filter_decoder.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_filter_flags_decode(
    -		lzma_filter *filter, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size)
    -{
    -	// Set the pointer to NULL so the caller can always safely free it.
    -	filter->options = NULL;
    -
    -	// Filter ID
    -	return_if_error(lzma_vli_decode(&filter->id, NULL,
    -			in, in_pos, in_size));
    -
    -	if (filter->id >= LZMA_FILTER_RESERVED_START)
    -		return LZMA_DATA_ERROR;
    -
    -	// Size of Properties
    -	lzma_vli props_size;
    -	return_if_error(lzma_vli_decode(&props_size, NULL,
    -			in, in_pos, in_size));
    -
    -	// Filter Properties
    -	if (in_size - *in_pos < props_size)
    -		return LZMA_DATA_ERROR;
    -
    -	const lzma_ret ret = lzma_properties_decode(
    -			filter, allocator, in + *in_pos, props_size);
    -
    -	*in_pos += props_size;
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/filter_flags_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/filter_flags_encoder.c
    deleted file mode 100644
    index d110566de..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/filter_flags_encoder.c
    +++ /dev/null
    @@ -1,56 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       filter_flags_encoder.c
    -/// \brief      Decodes a Filter Flags field
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "filter_encoder.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_filter_flags_size(uint32_t *size, const lzma_filter *filter)
    -{
    -	if (filter->id >= LZMA_FILTER_RESERVED_START)
    -		return LZMA_PROG_ERROR;
    -
    -	return_if_error(lzma_properties_size(size, filter));
    -
    -	*size += lzma_vli_size(filter->id) + lzma_vli_size(*size);
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_filter_flags_encode(const lzma_filter *filter,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	// Filter ID
    -	if (filter->id >= LZMA_FILTER_RESERVED_START)
    -		return LZMA_PROG_ERROR;
    -
    -	return_if_error(lzma_vli_encode(filter->id, NULL,
    -			out, out_pos, out_size));
    -
    -	// Size of Properties
    -	uint32_t props_size;
    -	return_if_error(lzma_properties_size(&props_size, filter));
    -	return_if_error(lzma_vli_encode(props_size, NULL,
    -			out, out_pos, out_size));
    -
    -	// Filter Properties
    -	if (out_size - *out_pos < props_size)
    -		return LZMA_PROG_ERROR;
    -
    -	return_if_error(lzma_properties_encode(filter, out + *out_pos));
    -
    -	*out_pos += props_size;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/hardware_cputhreads.c b/external/public-domain/xz/dist/src/liblzma/common/hardware_cputhreads.c
    deleted file mode 100644
    index f468366a6..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/hardware_cputhreads.c
    +++ /dev/null
    @@ -1,22 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       hardware_cputhreads.c
    -/// \brief      Get the number of CPU threads or cores
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -#include "tuklib_cpucores.h"
    -
    -
    -extern LZMA_API(uint32_t)
    -lzma_cputhreads(void)
    -{
    -	return tuklib_cpucores();
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/hardware_physmem.c b/external/public-domain/xz/dist/src/liblzma/common/hardware_physmem.c
    deleted file mode 100644
    index 7405b658a..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/hardware_physmem.c
    +++ /dev/null
    @@ -1,25 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       hardware_physmem.c
    -/// \brief      Get the total amount of physical memory (RAM)
    -//
    -//  Author:     Jonathan Nieder
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -#include "tuklib_physmem.h"
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_physmem(void)
    -{
    -	// It is simpler to make lzma_physmem() a wrapper for
    -	// tuklib_physmem() than to hack appropriate symbol visiblity
    -	// support for the tuklib modules.
    -	return tuklib_physmem();
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/index.c b/external/public-domain/xz/dist/src/liblzma/common/index.c
    deleted file mode 100644
    index 11f45f400..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/index.c
    +++ /dev/null
    @@ -1,1244 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       index.c
    -/// \brief      Handling of .xz Indexes and some other Stream information
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "index.h"
    -#include "stream_flags_common.h"
    -
    -
    -/// \brief      How many Records to allocate at once
    -///
    -/// This should be big enough to avoid making lots of tiny allocations
    -/// but small enough to avoid too much unused memory at once.
    -#define INDEX_GROUP_SIZE 512
    -
    -
    -/// \brief      How many Records can be allocated at once at maximum
    -#define PREALLOC_MAX ((SIZE_MAX - sizeof(index_group)) / sizeof(index_record))
    -
    -
    -/// \brief      Base structure for index_stream and index_group structures
    -typedef struct index_tree_node_s index_tree_node;
    -struct index_tree_node_s {
    -	/// Uncompressed start offset of this Stream (relative to the
    -	/// beginning of the file) or Block (relative to the beginning
    -	/// of the Stream)
    -	lzma_vli uncompressed_base;
    -
    -	/// Compressed start offset of this Stream or Block
    -	lzma_vli compressed_base;
    -
    -	index_tree_node *parent;
    -	index_tree_node *left;
    -	index_tree_node *right;
    -};
    -
    -
    -/// \brief      AVL tree to hold index_stream or index_group structures
    -typedef struct {
    -	/// Root node
    -	index_tree_node *root;
    -
    -	/// Leftmost node. Since the tree will be filled sequentially,
    -	/// this won't change after the first node has been added to
    -	/// the tree.
    -	index_tree_node *leftmost;
    -
    -	/// The rightmost node in the tree. Since the tree is filled
    -	/// sequentially, this is always the node where to add the new data.
    -	index_tree_node *rightmost;
    -
    -	/// Number of nodes in the tree
    -	uint32_t count;
    -
    -} index_tree;
    -
    -
    -typedef struct {
    -	lzma_vli uncompressed_sum;
    -	lzma_vli unpadded_sum;
    -} index_record;
    -
    -
    -typedef struct {
    -	/// Every Record group is part of index_stream.groups tree.
    -	index_tree_node node;
    -
    -	/// Number of Blocks in this Stream before this group.
    -	lzma_vli number_base;
    -
    -	/// Number of Records that can be put in records[].
    -	size_t allocated;
    -
    -	/// Index of the last Record in use.
    -	size_t last;
    -
    -	/// The sizes in this array are stored as cumulative sums relative
    -	/// to the beginning of the Stream. This makes it possible to
    -	/// use binary search in lzma_index_locate().
    -	///
    -	/// Note that the cumulative summing is done specially for
    -	/// unpadded_sum: The previous value is rounded up to the next
    -	/// multiple of four before adding the Unpadded Size of the new
    -	/// Block. The total encoded size of the Blocks in the Stream
    -	/// is records[last].unpadded_sum in the last Record group of
    -	/// the Stream.
    -	///
    -	/// For example, if the Unpadded Sizes are 39, 57, and 81, the
    -	/// stored values are 39, 97 (40 + 57), and 181 (100 + 181).
    -	/// The total encoded size of these Blocks is 184.
    -	///
    -	/// This is a flexible array, because it makes easy to optimize
    -	/// memory usage in case someone concatenates many Streams that
    -	/// have only one or few Blocks.
    -	index_record records[];
    -
    -} index_group;
    -
    -
    -typedef struct {
    -	/// Every index_stream is a node in the tree of Sreams.
    -	index_tree_node node;
    -
    -	/// Number of this Stream (first one is 1)
    -	uint32_t number;
    -
    -	/// Total number of Blocks before this Stream
    -	lzma_vli block_number_base;
    -
    -	/// Record groups of this Stream are stored in a tree.
    -	/// It's a T-tree with AVL-tree balancing. There are
    -	/// INDEX_GROUP_SIZE Records per node by default.
    -	/// This keeps the number of memory allocations reasonable
    -	/// and finding a Record is fast.
    -	index_tree groups;
    -
    -	/// Number of Records in this Stream
    -	lzma_vli record_count;
    -
    -	/// Size of the List of Records field in this Stream. This is used
    -	/// together with record_count to calculate the size of the Index
    -	/// field and thus the total size of the Stream.
    -	lzma_vli index_list_size;
    -
    -	/// Stream Flags of this Stream. This is meaningful only if
    -	/// the Stream Flags have been told us with lzma_index_stream_flags().
    -	/// Initially stream_flags.version is set to UINT32_MAX to indicate
    -	/// that the Stream Flags are unknown.
    -	lzma_stream_flags stream_flags;
    -
    -	/// Amount of Stream Padding after this Stream. This defaults to
    -	/// zero and can be set with lzma_index_stream_padding().
    -	lzma_vli stream_padding;
    -
    -} index_stream;
    -
    -
    -struct lzma_index_s {
    -	/// AVL-tree containing the Stream(s). Often there is just one
    -	/// Stream, but using a tree keeps lookups fast even when there
    -	/// are many concatenated Streams.
    -	index_tree streams;
    -
    -	/// Uncompressed size of all the Blocks in the Stream(s)
    -	lzma_vli uncompressed_size;
    -
    -	/// Total size of all the Blocks in the Stream(s)
    -	lzma_vli total_size;
    -
    -	/// Total number of Records in all Streams in this lzma_index
    -	lzma_vli record_count;
    -
    -	/// Size of the List of Records field if all the Streams in this
    -	/// lzma_index were packed into a single Stream (makes it simpler to
    -	/// take many .xz files and combine them into a single Stream).
    -	///
    -	/// This value together with record_count is needed to calculate
    -	/// Backward Size that is stored into Stream Footer.
    -	lzma_vli index_list_size;
    -
    -	/// How many Records to allocate at once in lzma_index_append().
    -	/// This defaults to INDEX_GROUP_SIZE but can be overriden with
    -	/// lzma_index_prealloc().
    -	size_t prealloc;
    -
    -	/// Bitmask indicating what integrity check types have been used
    -	/// as set by lzma_index_stream_flags(). The bit of the last Stream
    -	/// is not included here, since it is possible to change it by
    -	/// calling lzma_index_stream_flags() again.
    -	uint32_t checks;
    -};
    -
    -
    -static void
    -index_tree_init(index_tree *tree)
    -{
    -	tree->root = NULL;
    -	tree->leftmost = NULL;
    -	tree->rightmost = NULL;
    -	tree->count = 0;
    -	return;
    -}
    -
    -
    -/// Helper for index_tree_end()
    -static void
    -index_tree_node_end(index_tree_node *node, const lzma_allocator *allocator,
    -		void (*free_func)(void *node, const lzma_allocator *allocator))
    -{
    -	// The tree won't ever be very huge, so recursion should be fine.
    -	// 20 levels in the tree is likely quite a lot already in practice.
    -	if (node->left != NULL)
    -		index_tree_node_end(node->left, allocator, free_func);
    -
    -	if (node->right != NULL)
    -		index_tree_node_end(node->right, allocator, free_func);
    -
    -	if (free_func != NULL)
    -		free_func(node, allocator);
    -
    -	lzma_free(node, allocator);
    -	return;
    -}
    -
    -
    -/// Free the meory allocated for a tree. If free_func is not NULL,
    -/// it is called on each node before freeing the node. This is used
    -/// to free the Record groups from each index_stream before freeing
    -/// the index_stream itself.
    -static void
    -index_tree_end(index_tree *tree, const lzma_allocator *allocator,
    -		void (*free_func)(void *node, const lzma_allocator *allocator))
    -{
    -	if (tree->root != NULL)
    -		index_tree_node_end(tree->root, allocator, free_func);
    -
    -	return;
    -}
    -
    -
    -/// Add a new node to the tree. node->uncompressed_base and
    -/// node->compressed_base must have been set by the caller already.
    -static void
    -index_tree_append(index_tree *tree, index_tree_node *node)
    -{
    -	node->parent = tree->rightmost;
    -	node->left = NULL;
    -	node->right = NULL;
    -
    -	++tree->count;
    -
    -	// Handle the special case of adding the first node.
    -	if (tree->root == NULL) {
    -		tree->root = node;
    -		tree->leftmost = node;
    -		tree->rightmost = node;
    -		return;
    -	}
    -
    -	// The tree is always filled sequentially.
    -	assert(tree->rightmost->uncompressed_base <= node->uncompressed_base);
    -	assert(tree->rightmost->compressed_base < node->compressed_base);
    -
    -	// Add the new node after the rightmost node. It's the correct
    -	// place due to the reason above.
    -	tree->rightmost->right = node;
    -	tree->rightmost = node;
    -
    -	// Balance the AVL-tree if needed. We don't need to keep the balance
    -	// factors in nodes, because we always fill the tree sequentially,
    -	// and thus know the state of the tree just by looking at the node
    -	// count. From the node count we can calculate how many steps to go
    -	// up in the tree to find the rotation root.
    -	uint32_t up = tree->count ^ (UINT32_C(1) << bsr32(tree->count));
    -	if (up != 0) {
    -		// Locate the root node for the rotation.
    -		up = ctz32(tree->count) + 2;
    -		do {
    -			node = node->parent;
    -		} while (--up > 0);
    -
    -		// Rotate left using node as the rotation root.
    -		index_tree_node *pivot = node->right;
    -
    -		if (node->parent == NULL) {
    -			tree->root = pivot;
    -		} else {
    -			assert(node->parent->right == node);
    -			node->parent->right = pivot;
    -		}
    -
    -		pivot->parent = node->parent;
    -
    -		node->right = pivot->left;
    -		if (node->right != NULL)
    -			node->right->parent = node;
    -
    -		pivot->left = node;
    -		node->parent = pivot;
    -	}
    -
    -	return;
    -}
    -
    -
    -/// Get the next node in the tree. Return NULL if there are no more nodes.
    -static void *
    -index_tree_next(const index_tree_node *node)
    -{
    -	if (node->right != NULL) {
    -		node = node->right;
    -		while (node->left != NULL)
    -			node = node->left;
    -
    -		return (void *)(node);
    -	}
    -
    -	while (node->parent != NULL && node->parent->right == node)
    -		node = node->parent;
    -
    -	return (void *)(node->parent);
    -}
    -
    -
    -/// Locate a node that contains the given uncompressed offset. It is
    -/// caller's job to check that target is not bigger than the uncompressed
    -/// size of the tree (the last node would be returned in that case still).
    -static void *
    -index_tree_locate(const index_tree *tree, lzma_vli target)
    -{
    -	const index_tree_node *result = NULL;
    -	const index_tree_node *node = tree->root;
    -
    -	assert(tree->leftmost == NULL
    -			|| tree->leftmost->uncompressed_base == 0);
    -
    -	// Consecutive nodes may have the same uncompressed_base.
    -	// We must pick the rightmost one.
    -	while (node != NULL) {
    -		if (node->uncompressed_base > target) {
    -			node = node->left;
    -		} else {
    -			result = node;
    -			node = node->right;
    -		}
    -	}
    -
    -	return (void *)(result);
    -}
    -
    -
    -/// Allocate and initialize a new Stream using the given base offsets.
    -static index_stream *
    -index_stream_init(lzma_vli compressed_base, lzma_vli uncompressed_base,
    -		lzma_vli stream_number, lzma_vli block_number_base,
    -		const lzma_allocator *allocator)
    -{
    -	index_stream *s = lzma_alloc(sizeof(index_stream), allocator);
    -	if (s == NULL)
    -		return NULL;
    -
    -	s->node.uncompressed_base = uncompressed_base;
    -	s->node.compressed_base = compressed_base;
    -	s->node.parent = NULL;
    -	s->node.left = NULL;
    -	s->node.right = NULL;
    -
    -	s->number = stream_number;
    -	s->block_number_base = block_number_base;
    -
    -	index_tree_init(&s->groups);
    -
    -	s->record_count = 0;
    -	s->index_list_size = 0;
    -	s->stream_flags.version = UINT32_MAX;
    -	s->stream_padding = 0;
    -
    -	return s;
    -}
    -
    -
    -/// Free the memory allocated for a Stream and its Record groups.
    -static void
    -index_stream_end(void *node, const lzma_allocator *allocator)
    -{
    -	index_stream *s = node;
    -	index_tree_end(&s->groups, allocator, NULL);
    -	return;
    -}
    -
    -
    -static lzma_index *
    -index_init_plain(const lzma_allocator *allocator)
    -{
    -	lzma_index *i = lzma_alloc(sizeof(lzma_index), allocator);
    -	if (i != NULL) {
    -		index_tree_init(&i->streams);
    -		i->uncompressed_size = 0;
    -		i->total_size = 0;
    -		i->record_count = 0;
    -		i->index_list_size = 0;
    -		i->prealloc = INDEX_GROUP_SIZE;
    -		i->checks = 0;
    -	}
    -
    -	return i;
    -}
    -
    -
    -extern LZMA_API(lzma_index *)
    -lzma_index_init(const lzma_allocator *allocator)
    -{
    -	lzma_index *i = index_init_plain(allocator);
    -	if (i == NULL)
    -		return NULL;
    -
    -	index_stream *s = index_stream_init(0, 0, 1, 0, allocator);
    -	if (s == NULL) {
    -		lzma_free(i, allocator);
    -		return NULL;
    -	}
    -
    -	index_tree_append(&i->streams, &s->node);
    -
    -	return i;
    -}
    -
    -
    -extern LZMA_API(void)
    -lzma_index_end(lzma_index *i, const lzma_allocator *allocator)
    -{
    -	// NOTE: If you modify this function, check also the bottom
    -	// of lzma_index_cat().
    -	if (i != NULL) {
    -		index_tree_end(&i->streams, allocator, &index_stream_end);
    -		lzma_free(i, allocator);
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -lzma_index_prealloc(lzma_index *i, lzma_vli records)
    -{
    -	if (records > PREALLOC_MAX)
    -		records = PREALLOC_MAX;
    -
    -	i->prealloc = (size_t)(records);
    -	return;
    -}
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_index_memusage(lzma_vli streams, lzma_vli blocks)
    -{
    -	// This calculates an upper bound that is only a little bit
    -	// bigger than the exact maximum memory usage with the given
    -	// parameters.
    -
    -	// Typical malloc() overhead is 2 * sizeof(void *) but we take
    -	// a little bit extra just in case. Using LZMA_MEMUSAGE_BASE
    -	// instead would give too inaccurate estimate.
    -	const size_t alloc_overhead = 4 * sizeof(void *);
    -
    -	// Amount of memory needed for each Stream base structures.
    -	// We assume that every Stream has at least one Block and
    -	// thus at least one group.
    -	const size_t stream_base = sizeof(index_stream)
    -			+ sizeof(index_group) + 2 * alloc_overhead;
    -
    -	// Amount of memory needed per group.
    -	const size_t group_base = sizeof(index_group)
    -			+ INDEX_GROUP_SIZE * sizeof(index_record)
    -			+ alloc_overhead;
    -
    -	// Number of groups. There may actually be more, but that overhead
    -	// has been taken into account in stream_base already.
    -	const lzma_vli groups
    -			= (blocks + INDEX_GROUP_SIZE - 1) / INDEX_GROUP_SIZE;
    -
    -	// Memory used by index_stream and index_group structures.
    -	const uint64_t streams_mem = streams * stream_base;
    -	const uint64_t groups_mem = groups * group_base;
    -
    -	// Memory used by the base structure.
    -	const uint64_t index_base = sizeof(lzma_index) + alloc_overhead;
    -
    -	// Validate the arguments and catch integer overflows.
    -	// Maximum number of Streams is "only" UINT32_MAX, because
    -	// that limit is used by the tree containing the Streams.
    -	const uint64_t limit = UINT64_MAX - index_base;
    -	if (streams == 0 || streams > UINT32_MAX || blocks > LZMA_VLI_MAX
    -			|| streams > limit / stream_base
    -			|| groups > limit / group_base
    -			|| limit - streams_mem < groups_mem)
    -		return UINT64_MAX;
    -
    -	return index_base + streams_mem + groups_mem;
    -}
    -
    -
    -extern LZMA_API(uint64_t)
    -lzma_index_memused(const lzma_index *i)
    -{
    -	return lzma_index_memusage(i->streams.count, i->record_count);
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_index_block_count(const lzma_index *i)
    -{
    -	return i->record_count;
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_index_stream_count(const lzma_index *i)
    -{
    -	return i->streams.count;
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_index_size(const lzma_index *i)
    -{
    -	return index_size(i->record_count, i->index_list_size);
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_index_total_size(const lzma_index *i)
    -{
    -	return i->total_size;
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_index_stream_size(const lzma_index *i)
    -{
    -	// Stream Header + Blocks + Index + Stream Footer
    -	return LZMA_STREAM_HEADER_SIZE + i->total_size
    -			+ index_size(i->record_count, i->index_list_size)
    -			+ LZMA_STREAM_HEADER_SIZE;
    -}
    -
    -
    -static lzma_vli
    -index_file_size(lzma_vli compressed_base, lzma_vli unpadded_sum,
    -		lzma_vli record_count, lzma_vli index_list_size,
    -		lzma_vli stream_padding)
    -{
    -	// Earlier Streams and Stream Paddings + Stream Header
    -	// + Blocks + Index + Stream Footer + Stream Padding
    -	//
    -	// This might go over LZMA_VLI_MAX due to too big unpadded_sum
    -	// when this function is used in lzma_index_append().
    -	lzma_vli file_size = compressed_base + 2 * LZMA_STREAM_HEADER_SIZE
    -			+ stream_padding + vli_ceil4(unpadded_sum);
    -	if (file_size > LZMA_VLI_MAX)
    -		return LZMA_VLI_UNKNOWN;
    -
    -	// The same applies here.
    -	file_size += index_size(record_count, index_list_size);
    -	if (file_size > LZMA_VLI_MAX)
    -		return LZMA_VLI_UNKNOWN;
    -
    -	return file_size;
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_index_file_size(const lzma_index *i)
    -{
    -	const index_stream *s = (const index_stream *)(i->streams.rightmost);
    -	const index_group *g = (const index_group *)(s->groups.rightmost);
    -	return index_file_size(s->node.compressed_base,
    -			g == NULL ? 0 : g->records[g->last].unpadded_sum,
    -			s->record_count, s->index_list_size,
    -			s->stream_padding);
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_index_uncompressed_size(const lzma_index *i)
    -{
    -	return i->uncompressed_size;
    -}
    -
    -
    -extern LZMA_API(uint32_t)
    -lzma_index_checks(const lzma_index *i)
    -{
    -	uint32_t checks = i->checks;
    -
    -	// Get the type of the Check of the last Stream too.
    -	const index_stream *s = (const index_stream *)(i->streams.rightmost);
    -	if (s->stream_flags.version != UINT32_MAX)
    -		checks |= UINT32_C(1) << s->stream_flags.check;
    -
    -	return checks;
    -}
    -
    -
    -extern uint32_t
    -lzma_index_padding_size(const lzma_index *i)
    -{
    -	return (LZMA_VLI_C(4) - index_size_unpadded(
    -			i->record_count, i->index_list_size)) & 3;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_stream_flags(lzma_index *i, const lzma_stream_flags *stream_flags)
    -{
    -	if (i == NULL || stream_flags == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	// Validate the Stream Flags.
    -	return_if_error(lzma_stream_flags_compare(
    -			stream_flags, stream_flags));
    -
    -	index_stream *s = (index_stream *)(i->streams.rightmost);
    -	s->stream_flags = *stream_flags;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_stream_padding(lzma_index *i, lzma_vli stream_padding)
    -{
    -	if (i == NULL || stream_padding > LZMA_VLI_MAX
    -			|| (stream_padding & 3) != 0)
    -		return LZMA_PROG_ERROR;
    -
    -	index_stream *s = (index_stream *)(i->streams.rightmost);
    -
    -	// Check that the new value won't make the file grow too big.
    -	const lzma_vli old_stream_padding = s->stream_padding;
    -	s->stream_padding = 0;
    -	if (lzma_index_file_size(i) + stream_padding > LZMA_VLI_MAX) {
    -		s->stream_padding = old_stream_padding;
    -		return LZMA_DATA_ERROR;
    -	}
    -
    -	s->stream_padding = stream_padding;
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_append(lzma_index *i, const lzma_allocator *allocator,
    -		lzma_vli unpadded_size, lzma_vli uncompressed_size)
    -{
    -	// Validate.
    -	if (i == NULL || unpadded_size < UNPADDED_SIZE_MIN
    -			|| unpadded_size > UNPADDED_SIZE_MAX
    -			|| uncompressed_size > LZMA_VLI_MAX)
    -		return LZMA_PROG_ERROR;
    -
    -	index_stream *s = (index_stream *)(i->streams.rightmost);
    -	index_group *g = (index_group *)(s->groups.rightmost);
    -
    -	const lzma_vli compressed_base = g == NULL ? 0
    -			: vli_ceil4(g->records[g->last].unpadded_sum);
    -	const lzma_vli uncompressed_base = g == NULL ? 0
    -			: g->records[g->last].uncompressed_sum;
    -	const uint32_t index_list_size_add = lzma_vli_size(unpadded_size)
    -			+ lzma_vli_size(uncompressed_size);
    -
    -	// Check that the file size will stay within limits.
    -	if (index_file_size(s->node.compressed_base,
    -			compressed_base + unpadded_size, s->record_count + 1,
    -			s->index_list_size + index_list_size_add,
    -			s->stream_padding) == LZMA_VLI_UNKNOWN)
    -		return LZMA_DATA_ERROR;
    -
    -	// The size of the Index field must not exceed the maximum value
    -	// that can be stored in the Backward Size field.
    -	if (index_size(i->record_count + 1,
    -			i->index_list_size + index_list_size_add)
    -			> LZMA_BACKWARD_SIZE_MAX)
    -		return LZMA_DATA_ERROR;
    -
    -	if (g != NULL && g->last + 1 < g->allocated) {
    -		// There is space in the last group at least for one Record.
    -		++g->last;
    -	} else {
    -		// We need to allocate a new group.
    -		g = lzma_alloc(sizeof(index_group)
    -				+ i->prealloc * sizeof(index_record),
    -				allocator);
    -		if (g == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		g->last = 0;
    -		g->allocated = i->prealloc;
    -
    -		// Reset prealloc so that if the application happens to
    -		// add new Records, the allocation size will be sane.
    -		i->prealloc = INDEX_GROUP_SIZE;
    -
    -		// Set the start offsets of this group.
    -		g->node.uncompressed_base = uncompressed_base;
    -		g->node.compressed_base = compressed_base;
    -		g->number_base = s->record_count + 1;
    -
    -		// Add the new group to the Stream.
    -		index_tree_append(&s->groups, &g->node);
    -	}
    -
    -	// Add the new Record to the group.
    -	g->records[g->last].uncompressed_sum
    -			= uncompressed_base + uncompressed_size;
    -	g->records[g->last].unpadded_sum
    -			= compressed_base + unpadded_size;
    -
    -	// Update the totals.
    -	++s->record_count;
    -	s->index_list_size += index_list_size_add;
    -
    -	i->total_size += vli_ceil4(unpadded_size);
    -	i->uncompressed_size += uncompressed_size;
    -	++i->record_count;
    -	i->index_list_size += index_list_size_add;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -/// Structure to pass info to index_cat_helper()
    -typedef struct {
    -	/// Uncompressed size of the destination
    -	lzma_vli uncompressed_size;
    -
    -	/// Compressed file size of the destination
    -	lzma_vli file_size;
    -
    -	/// Same as above but for Block numbers
    -	lzma_vli block_number_add;
    -
    -	/// Number of Streams that were in the destination index before we
    -	/// started appending new Streams from the source index. This is
    -	/// used to fix the Stream numbering.
    -	uint32_t stream_number_add;
    -
    -	/// Destination index' Stream tree
    -	index_tree *streams;
    -
    -} index_cat_info;
    -
    -
    -/// Add the Stream nodes from the source index to dest using recursion.
    -/// Simplest iterative traversal of the source tree wouldn't work, because
    -/// we update the pointers in nodes when moving them to the destination tree.
    -static void
    -index_cat_helper(const index_cat_info *info, index_stream *this)
    -{
    -	index_stream *left = (index_stream *)(this->node.left);
    -	index_stream *right = (index_stream *)(this->node.right);
    -
    -	if (left != NULL)
    -		index_cat_helper(info, left);
    -
    -	this->node.uncompressed_base += info->uncompressed_size;
    -	this->node.compressed_base += info->file_size;
    -	this->number += info->stream_number_add;
    -	this->block_number_base += info->block_number_add;
    -	index_tree_append(info->streams, &this->node);
    -
    -	if (right != NULL)
    -		index_cat_helper(info, right);
    -
    -	return;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_cat(lzma_index *restrict dest, lzma_index *restrict src,
    -		const lzma_allocator *allocator)
    -{
    -	const lzma_vli dest_file_size = lzma_index_file_size(dest);
    -
    -	// Check that we don't exceed the file size limits.
    -	if (dest_file_size + lzma_index_file_size(src) > LZMA_VLI_MAX
    -			|| dest->uncompressed_size + src->uncompressed_size
    -				> LZMA_VLI_MAX)
    -		return LZMA_DATA_ERROR;
    -
    -	// Check that the encoded size of the combined lzma_indexes stays
    -	// within limits. In theory, this should be done only if we know
    -	// that the user plans to actually combine the Streams and thus
    -	// construct a single Index (probably rare). However, exceeding
    -	// this limit is quite theoretical, so we do this check always
    -	// to simplify things elsewhere.
    -	{
    -		const lzma_vli dest_size = index_size_unpadded(
    -				dest->record_count, dest->index_list_size);
    -		const lzma_vli src_size = index_size_unpadded(
    -				src->record_count, src->index_list_size);
    -		if (vli_ceil4(dest_size + src_size) > LZMA_BACKWARD_SIZE_MAX)
    -			return LZMA_DATA_ERROR;
    -	}
    -
    -	// Optimize the last group to minimize memory usage. Allocation has
    -	// to be done before modifying dest or src.
    -	{
    -		index_stream *s = (index_stream *)(dest->streams.rightmost);
    -		index_group *g = (index_group *)(s->groups.rightmost);
    -		if (g != NULL && g->last + 1 < g->allocated) {
    -			assert(g->node.left == NULL);
    -			assert(g->node.right == NULL);
    -
    -			index_group *newg = lzma_alloc(sizeof(index_group)
    -					+ (g->last + 1)
    -					* sizeof(index_record),
    -					allocator);
    -			if (newg == NULL)
    -				return LZMA_MEM_ERROR;
    -
    -			newg->node = g->node;
    -			newg->allocated = g->last + 1;
    -			newg->last = g->last;
    -			newg->number_base = g->number_base;
    -
    -			memcpy(newg->records, g->records, newg->allocated
    -					* sizeof(index_record));
    -
    -			if (g->node.parent != NULL) {
    -				assert(g->node.parent->right == &g->node);
    -				g->node.parent->right = &newg->node;
    -			}
    -
    -			if (s->groups.leftmost == &g->node) {
    -				assert(s->groups.root == &g->node);
    -				s->groups.leftmost = &newg->node;
    -				s->groups.root = &newg->node;
    -			}
    -
    -			if (s->groups.rightmost == &g->node)
    -				s->groups.rightmost = &newg->node;
    -
    -			lzma_free(g, allocator);
    -		}
    -	}
    -
    -	// Add all the Streams from src to dest. Update the base offsets
    -	// of each Stream from src.
    -	const index_cat_info info = {
    -		.uncompressed_size = dest->uncompressed_size,
    -		.file_size = dest_file_size,
    -		.stream_number_add = dest->streams.count,
    -		.block_number_add = dest->record_count,
    -		.streams = &dest->streams,
    -	};
    -	index_cat_helper(&info, (index_stream *)(src->streams.root));
    -
    -	// Update info about all the combined Streams.
    -	dest->uncompressed_size += src->uncompressed_size;
    -	dest->total_size += src->total_size;
    -	dest->record_count += src->record_count;
    -	dest->index_list_size += src->index_list_size;
    -	dest->checks = lzma_index_checks(dest) | src->checks;
    -
    -	// There's nothing else left in src than the base structure.
    -	lzma_free(src, allocator);
    -
    -	return LZMA_OK;
    -}
    -
    -
    -/// Duplicate an index_stream.
    -static index_stream *
    -index_dup_stream(const index_stream *src, const lzma_allocator *allocator)
    -{
    -	// Catch a somewhat theoretical integer overflow.
    -	if (src->record_count > PREALLOC_MAX)
    -		return NULL;
    -
    -	// Allocate and initialize a new Stream.
    -	index_stream *dest = index_stream_init(src->node.compressed_base,
    -			src->node.uncompressed_base, src->number,
    -			src->block_number_base, allocator);
    -
    -	// Return immediately if allocation failed or if there are
    -	// no groups to duplicate.
    -	if (dest == NULL || src->groups.leftmost == NULL)
    -		return dest;
    -
    -	// Copy the overall information.
    -	dest->record_count = src->record_count;
    -	dest->index_list_size = src->index_list_size;
    -	dest->stream_flags = src->stream_flags;
    -	dest->stream_padding = src->stream_padding;
    -
    -	// Allocate memory for the Records. We put all the Records into
    -	// a single group. It's simplest and also tends to make
    -	// lzma_index_locate() a little bit faster with very big Indexes.
    -	index_group *destg = lzma_alloc(sizeof(index_group)
    -			+ src->record_count * sizeof(index_record),
    -			allocator);
    -	if (destg == NULL) {
    -		index_stream_end(dest, allocator);
    -		return NULL;
    -	}
    -
    -	// Initialize destg.
    -	destg->node.uncompressed_base = 0;
    -	destg->node.compressed_base = 0;
    -	destg->number_base = 1;
    -	destg->allocated = src->record_count;
    -	destg->last = src->record_count - 1;
    -
    -	// Go through all the groups in src and copy the Records into destg.
    -	const index_group *srcg = (const index_group *)(src->groups.leftmost);
    -	size_t i = 0;
    -	do {
    -		memcpy(destg->records + i, srcg->records,
    -				(srcg->last + 1) * sizeof(index_record));
    -		i += srcg->last + 1;
    -		srcg = index_tree_next(&srcg->node);
    -	} while (srcg != NULL);
    -
    -	assert(i == destg->allocated);
    -
    -	// Add the group to the new Stream.
    -	index_tree_append(&dest->groups, &destg->node);
    -
    -	return dest;
    -}
    -
    -
    -extern LZMA_API(lzma_index *)
    -lzma_index_dup(const lzma_index *src, const lzma_allocator *allocator)
    -{
    -	// Allocate the base structure (no initial Stream).
    -	lzma_index *dest = index_init_plain(allocator);
    -	if (dest == NULL)
    -		return NULL;
    -
    -	// Copy the totals.
    -	dest->uncompressed_size = src->uncompressed_size;
    -	dest->total_size = src->total_size;
    -	dest->record_count = src->record_count;
    -	dest->index_list_size = src->index_list_size;
    -
    -	// Copy the Streams and the groups in them.
    -	const index_stream *srcstream
    -			= (const index_stream *)(src->streams.leftmost);
    -	do {
    -		index_stream *deststream = index_dup_stream(
    -				srcstream, allocator);
    -		if (deststream == NULL) {
    -			lzma_index_end(dest, allocator);
    -			return NULL;
    -		}
    -
    -		index_tree_append(&dest->streams, &deststream->node);
    -
    -		srcstream = index_tree_next(&srcstream->node);
    -	} while (srcstream != NULL);
    -
    -	return dest;
    -}
    -
    -
    -/// Indexing for lzma_index_iter.internal[]
    -enum {
    -	ITER_INDEX,
    -	ITER_STREAM,
    -	ITER_GROUP,
    -	ITER_RECORD,
    -	ITER_METHOD,
    -};
    -
    -
    -/// Values for lzma_index_iter.internal[ITER_METHOD].s
    -enum {
    -	ITER_METHOD_NORMAL,
    -	ITER_METHOD_NEXT,
    -	ITER_METHOD_LEFTMOST,
    -};
    -
    -
    -static void
    -iter_set_info(lzma_index_iter *iter)
    -{
    -	const lzma_index *i = iter->internal[ITER_INDEX].p;
    -	const index_stream *stream = iter->internal[ITER_STREAM].p;
    -	const index_group *group = iter->internal[ITER_GROUP].p;
    -	const size_t record = iter->internal[ITER_RECORD].s;
    -
    -	// lzma_index_iter.internal must not contain a pointer to the last
    -	// group in the index, because that may be reallocated by
    -	// lzma_index_cat().
    -	if (group == NULL) {
    -		// There are no groups.
    -		assert(stream->groups.root == NULL);
    -		iter->internal[ITER_METHOD].s = ITER_METHOD_LEFTMOST;
    -
    -	} else if (i->streams.rightmost != &stream->node
    -			|| stream->groups.rightmost != &group->node) {
    -		// The group is not not the last group in the index.
    -		iter->internal[ITER_METHOD].s = ITER_METHOD_NORMAL;
    -
    -	} else if (stream->groups.leftmost != &group->node) {
    -		// The group isn't the only group in the Stream, thus we
    -		// know that it must have a parent group i.e. it's not
    -		// the root node.
    -		assert(stream->groups.root != &group->node);
    -		assert(group->node.parent->right == &group->node);
    -		iter->internal[ITER_METHOD].s = ITER_METHOD_NEXT;
    -		iter->internal[ITER_GROUP].p = group->node.parent;
    -
    -	} else {
    -		// The Stream has only one group.
    -		assert(stream->groups.root == &group->node);
    -		assert(group->node.parent == NULL);
    -		iter->internal[ITER_METHOD].s = ITER_METHOD_LEFTMOST;
    -		iter->internal[ITER_GROUP].p = NULL;
    -	}
    -
    -	iter->stream.number = stream->number;
    -	iter->stream.block_count = stream->record_count;
    -	iter->stream.compressed_offset = stream->node.compressed_base;
    -	iter->stream.uncompressed_offset = stream->node.uncompressed_base;
    -
    -	// iter->stream.flags will be NULL if the Stream Flags haven't been
    -	// set with lzma_index_stream_flags().
    -	iter->stream.flags = stream->stream_flags.version == UINT32_MAX
    -			? NULL : &stream->stream_flags;
    -	iter->stream.padding = stream->stream_padding;
    -
    -	if (stream->groups.rightmost == NULL) {
    -		// Stream has no Blocks.
    -		iter->stream.compressed_size = index_size(0, 0)
    -				+ 2 * LZMA_STREAM_HEADER_SIZE;
    -		iter->stream.uncompressed_size = 0;
    -	} else {
    -		const index_group *g = (const index_group *)(
    -				stream->groups.rightmost);
    -
    -		// Stream Header + Stream Footer + Index + Blocks
    -		iter->stream.compressed_size = 2 * LZMA_STREAM_HEADER_SIZE
    -				+ index_size(stream->record_count,
    -					stream->index_list_size)
    -				+ vli_ceil4(g->records[g->last].unpadded_sum);
    -		iter->stream.uncompressed_size
    -				= g->records[g->last].uncompressed_sum;
    -	}
    -
    -	if (group != NULL) {
    -		iter->block.number_in_stream = group->number_base + record;
    -		iter->block.number_in_file = iter->block.number_in_stream
    -				+ stream->block_number_base;
    -
    -		iter->block.compressed_stream_offset
    -				= record == 0 ? group->node.compressed_base
    -				: vli_ceil4(group->records[
    -					record - 1].unpadded_sum);
    -		iter->block.uncompressed_stream_offset
    -				= record == 0 ? group->node.uncompressed_base
    -				: group->records[record - 1].uncompressed_sum;
    -
    -		iter->block.uncompressed_size
    -				= group->records[record].uncompressed_sum
    -				- iter->block.uncompressed_stream_offset;
    -		iter->block.unpadded_size
    -				= group->records[record].unpadded_sum
    -				- iter->block.compressed_stream_offset;
    -		iter->block.total_size = vli_ceil4(iter->block.unpadded_size);
    -
    -		iter->block.compressed_stream_offset
    -				+= LZMA_STREAM_HEADER_SIZE;
    -
    -		iter->block.compressed_file_offset
    -				= iter->block.compressed_stream_offset
    -				+ iter->stream.compressed_offset;
    -		iter->block.uncompressed_file_offset
    -				= iter->block.uncompressed_stream_offset
    -				+ iter->stream.uncompressed_offset;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern LZMA_API(void)
    -lzma_index_iter_init(lzma_index_iter *iter, const lzma_index *i)
    -{
    -	iter->internal[ITER_INDEX].p = i;
    -	lzma_index_iter_rewind(iter);
    -	return;
    -}
    -
    -
    -extern LZMA_API(void)
    -lzma_index_iter_rewind(lzma_index_iter *iter)
    -{
    -	iter->internal[ITER_STREAM].p = NULL;
    -	iter->internal[ITER_GROUP].p = NULL;
    -	iter->internal[ITER_RECORD].s = 0;
    -	iter->internal[ITER_METHOD].s = ITER_METHOD_NORMAL;
    -	return;
    -}
    -
    -
    -extern LZMA_API(lzma_bool)
    -lzma_index_iter_next(lzma_index_iter *iter, lzma_index_iter_mode mode)
    -{
    -	// Catch unsupported mode values.
    -	if ((unsigned int)(mode) > LZMA_INDEX_ITER_NONEMPTY_BLOCK)
    -		return true;
    -
    -	const lzma_index *i = iter->internal[ITER_INDEX].p;
    -	const index_stream *stream = iter->internal[ITER_STREAM].p;
    -	const index_group *group = NULL;
    -	size_t record = iter->internal[ITER_RECORD].s;
    -
    -	// If we are being asked for the next Stream, leave group to NULL
    -	// so that the rest of the this function thinks that this Stream
    -	// has no groups and will thus go to the next Stream.
    -	if (mode != LZMA_INDEX_ITER_STREAM) {
    -		// Get the pointer to the current group. See iter_set_inf()
    -		// for explanation.
    -		switch (iter->internal[ITER_METHOD].s) {
    -		case ITER_METHOD_NORMAL:
    -			group = iter->internal[ITER_GROUP].p;
    -			break;
    -
    -		case ITER_METHOD_NEXT:
    -			group = index_tree_next(iter->internal[ITER_GROUP].p);
    -			break;
    -
    -		case ITER_METHOD_LEFTMOST:
    -			group = (const index_group *)(
    -					stream->groups.leftmost);
    -			break;
    -		}
    -	}
    -
    -again:
    -	if (stream == NULL) {
    -		// We at the beginning of the lzma_index.
    -		// Locate the first Stream.
    -		stream = (const index_stream *)(i->streams.leftmost);
    -		if (mode >= LZMA_INDEX_ITER_BLOCK) {
    -			// Since we are being asked to return information
    -			// about the first a Block, skip Streams that have
    -			// no Blocks.
    -			while (stream->groups.leftmost == NULL) {
    -				stream = index_tree_next(&stream->node);
    -				if (stream == NULL)
    -					return true;
    -			}
    -		}
    -
    -		// Start from the first Record in the Stream.
    -		group = (const index_group *)(stream->groups.leftmost);
    -		record = 0;
    -
    -	} else if (group != NULL && record < group->last) {
    -		// The next Record is in the same group.
    -		++record;
    -
    -	} else {
    -		// This group has no more Records or this Stream has
    -		// no Blocks at all.
    -		record = 0;
    -
    -		// If group is not NULL, this Stream has at least one Block
    -		// and thus at least one group. Find the next group.
    -		if (group != NULL)
    -			group = index_tree_next(&group->node);
    -
    -		if (group == NULL) {
    -			// This Stream has no more Records. Find the next
    -			// Stream. If we are being asked to return information
    -			// about a Block, we skip empty Streams.
    -			do {
    -				stream = index_tree_next(&stream->node);
    -				if (stream == NULL)
    -					return true;
    -			} while (mode >= LZMA_INDEX_ITER_BLOCK
    -					&& stream->groups.leftmost == NULL);
    -
    -			group = (const index_group *)(
    -					stream->groups.leftmost);
    -		}
    -	}
    -
    -	if (mode == LZMA_INDEX_ITER_NONEMPTY_BLOCK) {
    -		// We need to look for the next Block again if this Block
    -		// is empty.
    -		if (record == 0) {
    -			if (group->node.uncompressed_base
    -					== group->records[0].uncompressed_sum)
    -				goto again;
    -		} else if (group->records[record - 1].uncompressed_sum
    -				== group->records[record].uncompressed_sum) {
    -			goto again;
    -		}
    -	}
    -
    -	iter->internal[ITER_STREAM].p = stream;
    -	iter->internal[ITER_GROUP].p = group;
    -	iter->internal[ITER_RECORD].s = record;
    -
    -	iter_set_info(iter);
    -
    -	return false;
    -}
    -
    -
    -extern LZMA_API(lzma_bool)
    -lzma_index_iter_locate(lzma_index_iter *iter, lzma_vli target)
    -{
    -	const lzma_index *i = iter->internal[ITER_INDEX].p;
    -
    -	// If the target is past the end of the file, return immediately.
    -	if (i->uncompressed_size <= target)
    -		return true;
    -
    -	// Locate the Stream containing the target offset.
    -	const index_stream *stream = index_tree_locate(&i->streams, target);
    -	assert(stream != NULL);
    -	target -= stream->node.uncompressed_base;
    -
    -	// Locate the group containing the target offset.
    -	const index_group *group = index_tree_locate(&stream->groups, target);
    -	assert(group != NULL);
    -
    -	// Use binary search to locate the exact Record. It is the first
    -	// Record whose uncompressed_sum is greater than target.
    -	// This is because we want the rightmost Record that fullfills the
    -	// search criterion. It is possible that there are empty Blocks;
    -	// we don't want to return them.
    -	size_t left = 0;
    -	size_t right = group->last;
    -
    -	while (left < right) {
    -		const size_t pos = left + (right - left) / 2;
    -		if (group->records[pos].uncompressed_sum <= target)
    -			left = pos + 1;
    -		else
    -			right = pos;
    -	}
    -
    -	iter->internal[ITER_STREAM].p = stream;
    -	iter->internal[ITER_GROUP].p = group;
    -	iter->internal[ITER_RECORD].s = left;
    -
    -	iter_set_info(iter);
    -
    -	return false;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/index.h b/external/public-domain/xz/dist/src/liblzma/common/index.h
    deleted file mode 100644
    index 64e97247d..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/index.h
    +++ /dev/null
    @@ -1,73 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       index.h
    -/// \brief      Handling of Index
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_INDEX_H
    -#define LZMA_INDEX_H
    -
    -#include "common.h"
    -
    -
    -/// Minimum Unpadded Size
    -#define UNPADDED_SIZE_MIN LZMA_VLI_C(5)
    -
    -/// Maximum Unpadded Size
    -#define UNPADDED_SIZE_MAX (LZMA_VLI_MAX & ~LZMA_VLI_C(3))
    -
    -
    -/// Get the size of the Index Padding field. This is needed by Index encoder
    -/// and decoder, but applications should have no use for this.
    -extern uint32_t lzma_index_padding_size(const lzma_index *i);
    -
    -
    -/// Set for how many Records to allocate memory the next time
    -/// lzma_index_append() needs to allocate space for a new Record.
    -/// This is used only by the Index decoder.
    -extern void lzma_index_prealloc(lzma_index *i, lzma_vli records);
    -
    -
    -/// Round the variable-length integer to the next multiple of four.
    -static inline lzma_vli
    -vli_ceil4(lzma_vli vli)
    -{
    -	assert(vli <= LZMA_VLI_MAX);
    -	return (vli + 3) & ~LZMA_VLI_C(3);
    -}
    -
    -
    -/// Calculate the size of the Index field excluding Index Padding
    -static inline lzma_vli
    -index_size_unpadded(lzma_vli count, lzma_vli index_list_size)
    -{
    -	// Index Indicator + Number of Records + List of Records + CRC32
    -	return 1 + lzma_vli_size(count) + index_list_size + 4;
    -}
    -
    -
    -/// Calculate the size of the Index field including Index Padding
    -static inline lzma_vli
    -index_size(lzma_vli count, lzma_vli index_list_size)
    -{
    -	return vli_ceil4(index_size_unpadded(count, index_list_size));
    -}
    -
    -
    -/// Calculate the total size of the Stream
    -static inline lzma_vli
    -index_stream_size(lzma_vli blocks_size,
    -		lzma_vli count, lzma_vli index_list_size)
    -{
    -	return LZMA_STREAM_HEADER_SIZE + blocks_size
    -			+ index_size(count, index_list_size)
    -			+ LZMA_STREAM_HEADER_SIZE;
    -}
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/index_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/index_decoder.c
    deleted file mode 100644
    index 795d1834c..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/index_decoder.c
    +++ /dev/null
    @@ -1,345 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       index_decoder.c
    -/// \brief      Decodes the Index field
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "index.h"
    -#include "check.h"
    -
    -
    -struct lzma_coder_s {
    -	enum {
    -		SEQ_INDICATOR,
    -		SEQ_COUNT,
    -		SEQ_MEMUSAGE,
    -		SEQ_UNPADDED,
    -		SEQ_UNCOMPRESSED,
    -		SEQ_PADDING_INIT,
    -		SEQ_PADDING,
    -		SEQ_CRC32,
    -	} sequence;
    -
    -	/// Memory usage limit
    -	uint64_t memlimit;
    -
    -	/// Target Index
    -	lzma_index *index;
    -
    -	/// Pointer give by the application, which is set after
    -	/// successful decoding.
    -	lzma_index **index_ptr;
    -
    -	/// Number of Records left to decode.
    -	lzma_vli count;
    -
    -	/// The most recent Unpadded Size field
    -	lzma_vli unpadded_size;
    -
    -	/// The most recent Uncompressed Size field
    -	lzma_vli uncompressed_size;
    -
    -	/// Position in integers
    -	size_t pos;
    -
    -	/// CRC32 of the List of Records field
    -	uint32_t crc32;
    -};
    -
    -
    -static lzma_ret
    -index_decode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size,
    -		uint8_t *restrict out lzma_attribute((__unused__)),
    -		size_t *restrict out_pos lzma_attribute((__unused__)),
    -		size_t out_size lzma_attribute((__unused__)),
    -		lzma_action action lzma_attribute((__unused__)))
    -{
    -	// Similar optimization as in index_encoder.c
    -	const size_t in_start = *in_pos;
    -	lzma_ret ret = LZMA_OK;
    -
    -	while (*in_pos < in_size)
    -	switch (coder->sequence) {
    -	case SEQ_INDICATOR:
    -		// Return LZMA_DATA_ERROR instead of e.g. LZMA_PROG_ERROR or
    -		// LZMA_FORMAT_ERROR, because a typical usage case for Index
    -		// decoder is when parsing the Stream backwards. If seeking
    -		// backward from the Stream Footer gives us something that
    -		// doesn't begin with Index Indicator, the file is considered
    -		// corrupt, not "programming error" or "unrecognized file
    -		// format". One could argue that the application should
    -		// verify the Index Indicator before trying to decode the
    -		// Index, but well, I suppose it is simpler this way.
    -		if (in[(*in_pos)++] != 0x00)
    -			return LZMA_DATA_ERROR;
    -
    -		coder->sequence = SEQ_COUNT;
    -		break;
    -
    -	case SEQ_COUNT:
    -		ret = lzma_vli_decode(&coder->count, &coder->pos,
    -				in, in_pos, in_size);
    -		if (ret != LZMA_STREAM_END)
    -			goto out;
    -
    -		coder->pos = 0;
    -		coder->sequence = SEQ_MEMUSAGE;
    -
    -	// Fall through
    -
    -	case SEQ_MEMUSAGE:
    -		if (lzma_index_memusage(1, coder->count) > coder->memlimit) {
    -			ret = LZMA_MEMLIMIT_ERROR;
    -			goto out;
    -		}
    -
    -		// Tell the Index handling code how many Records this
    -		// Index has to allow it to allocate memory more efficiently.
    -		lzma_index_prealloc(coder->index, coder->count);
    -
    -		ret = LZMA_OK;
    -		coder->sequence = coder->count == 0
    -				? SEQ_PADDING_INIT : SEQ_UNPADDED;
    -		break;
    -
    -	case SEQ_UNPADDED:
    -	case SEQ_UNCOMPRESSED: {
    -		lzma_vli *size = coder->sequence == SEQ_UNPADDED
    -				? &coder->unpadded_size
    -				: &coder->uncompressed_size;
    -
    -		ret = lzma_vli_decode(size, &coder->pos,
    -				in, in_pos, in_size);
    -		if (ret != LZMA_STREAM_END)
    -			goto out;
    -
    -		ret = LZMA_OK;
    -		coder->pos = 0;
    -
    -		if (coder->sequence == SEQ_UNPADDED) {
    -			// Validate that encoded Unpadded Size isn't too small
    -			// or too big.
    -			if (coder->unpadded_size < UNPADDED_SIZE_MIN
    -					|| coder->unpadded_size
    -						> UNPADDED_SIZE_MAX)
    -				return LZMA_DATA_ERROR;
    -
    -			coder->sequence = SEQ_UNCOMPRESSED;
    -		} else {
    -			// Add the decoded Record to the Index.
    -			return_if_error(lzma_index_append(
    -					coder->index, allocator,
    -					coder->unpadded_size,
    -					coder->uncompressed_size));
    -
    -			// Check if this was the last Record.
    -			coder->sequence = --coder->count == 0
    -					? SEQ_PADDING_INIT
    -					: SEQ_UNPADDED;
    -		}
    -
    -		break;
    -	}
    -
    -	case SEQ_PADDING_INIT:
    -		coder->pos = lzma_index_padding_size(coder->index);
    -		coder->sequence = SEQ_PADDING;
    -
    -	// Fall through
    -
    -	case SEQ_PADDING:
    -		if (coder->pos > 0) {
    -			--coder->pos;
    -			if (in[(*in_pos)++] != 0x00)
    -				return LZMA_DATA_ERROR;
    -
    -			break;
    -		}
    -
    -		// Finish the CRC32 calculation.
    -		coder->crc32 = lzma_crc32(in + in_start,
    -				*in_pos - in_start, coder->crc32);
    -
    -		coder->sequence = SEQ_CRC32;
    -
    -	// Fall through
    -
    -	case SEQ_CRC32:
    -		do {
    -			if (*in_pos == in_size)
    -				return LZMA_OK;
    -
    -			if (((coder->crc32 >> (coder->pos * 8)) & 0xFF)
    -					!= in[(*in_pos)++])
    -				return LZMA_DATA_ERROR;
    -
    -		} while (++coder->pos < 4);
    -
    -		// Decoding was successful, now we can let the application
    -		// see the decoded Index.
    -		*coder->index_ptr = coder->index;
    -
    -		// Make index NULL so we don't free it unintentionally.
    -		coder->index = NULL;
    -
    -		return LZMA_STREAM_END;
    -
    -	default:
    -		assert(0);
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -out:
    -	// Update the CRC32,
    -	coder->crc32 = lzma_crc32(in + in_start,
    -			*in_pos - in_start, coder->crc32);
    -
    -	return ret;
    -}
    -
    -
    -static void
    -index_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_index_end(coder->index, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_ret
    -index_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
    -		uint64_t *old_memlimit, uint64_t new_memlimit)
    -{
    -	*memusage = lzma_index_memusage(1, coder->count);
    -	*old_memlimit = coder->memlimit;
    -
    -	if (new_memlimit != 0) {
    -		if (new_memlimit < *memusage)
    -			return LZMA_MEMLIMIT_ERROR;
    -
    -		coder->memlimit = new_memlimit;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static lzma_ret
    -index_decoder_reset(lzma_coder *coder, const lzma_allocator *allocator,
    -		lzma_index **i, uint64_t memlimit)
    -{
    -	// Remember the pointer given by the application. We will set it
    -	// to point to the decoded Index only if decoding is successful.
    -	// Before that, keep it NULL so that applications can always safely
    -	// pass it to lzma_index_end() no matter did decoding succeed or not.
    -	coder->index_ptr = i;
    -	*i = NULL;
    -
    -	// We always allocate a new lzma_index.
    -	coder->index = lzma_index_init(allocator);
    -	if (coder->index == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	// Initialize the rest.
    -	coder->sequence = SEQ_INDICATOR;
    -	coder->memlimit = memlimit;
    -	coder->count = 0; // Needs to be initialized due to _memconfig().
    -	coder->pos = 0;
    -	coder->crc32 = 0;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static lzma_ret
    -index_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		lzma_index **i, uint64_t memlimit)
    -{
    -	lzma_next_coder_init(&index_decoder_init, next, allocator);
    -
    -	if (i == NULL || memlimit == 0)
    -		return LZMA_PROG_ERROR;
    -
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &index_decode;
    -		next->end = &index_decoder_end;
    -		next->memconfig = &index_decoder_memconfig;
    -		next->coder->index = NULL;
    -	} else {
    -		lzma_index_end(next->coder->index, allocator);
    -	}
    -
    -	return index_decoder_reset(next->coder, allocator, i, memlimit);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_decoder(lzma_stream *strm, lzma_index **i, uint64_t memlimit)
    -{
    -	lzma_next_strm_init(index_decoder_init, strm, i, memlimit);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_buffer_decode(lzma_index **i, uint64_t *memlimit,
    -		const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size)
    -{
    -	// Sanity checks
    -	if (i == NULL || memlimit == NULL
    -			|| in == NULL || in_pos == NULL || *in_pos > in_size)
    -		return LZMA_PROG_ERROR;
    -
    -	// Initialize the decoder.
    -	lzma_coder coder;
    -	return_if_error(index_decoder_reset(&coder, allocator, i, *memlimit));
    -
    -	// Store the input start position so that we can restore it in case
    -	// of an error.
    -	const size_t in_start = *in_pos;
    -
    -	// Do the actual decoding.
    -	lzma_ret ret = index_decode(&coder, allocator, in, in_pos, in_size,
    -			NULL, NULL, 0, LZMA_RUN);
    -
    -	if (ret == LZMA_STREAM_END) {
    -		ret = LZMA_OK;
    -	} else {
    -		// Something went wrong, free the Index structure and restore
    -		// the input position.
    -		lzma_index_end(coder.index, allocator);
    -		*in_pos = in_start;
    -
    -		if (ret == LZMA_OK) {
    -			// The input is truncated or otherwise corrupt.
    -			// Use LZMA_DATA_ERROR instead of LZMA_BUF_ERROR
    -			// like lzma_vli_decode() does in single-call mode.
    -			ret = LZMA_DATA_ERROR;
    -
    -		} else if (ret == LZMA_MEMLIMIT_ERROR) {
    -			// Tell the caller how much memory would have
    -			// been needed.
    -			*memlimit = lzma_index_memusage(1, coder.count);
    -		}
    -	}
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/index_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/index_encoder.c
    deleted file mode 100644
    index d25ac7d33..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/index_encoder.c
    +++ /dev/null
    @@ -1,254 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       index_encoder.c
    -/// \brief      Encodes the Index field
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "index_encoder.h"
    -#include "index.h"
    -#include "check.h"
    -
    -
    -struct lzma_coder_s {
    -	enum {
    -		SEQ_INDICATOR,
    -		SEQ_COUNT,
    -		SEQ_UNPADDED,
    -		SEQ_UNCOMPRESSED,
    -		SEQ_NEXT,
    -		SEQ_PADDING,
    -		SEQ_CRC32,
    -	} sequence;
    -
    -	/// Index being encoded
    -	const lzma_index *index;
    -
    -	/// Iterator for the Index being encoded
    -	lzma_index_iter iter;
    -
    -	/// Position in integers
    -	size_t pos;
    -
    -	/// CRC32 of the List of Records field
    -	uint32_t crc32;
    -};
    -
    -
    -static lzma_ret
    -index_encode(lzma_coder *coder,
    -		const lzma_allocator *allocator lzma_attribute((__unused__)),
    -		const uint8_t *restrict in lzma_attribute((__unused__)),
    -		size_t *restrict in_pos lzma_attribute((__unused__)),
    -		size_t in_size lzma_attribute((__unused__)),
    -		uint8_t *restrict out, size_t *restrict out_pos,
    -		size_t out_size,
    -		lzma_action action lzma_attribute((__unused__)))
    -{
    -	// Position where to start calculating CRC32. The idea is that we
    -	// need to call lzma_crc32() only once per call to index_encode().
    -	const size_t out_start = *out_pos;
    -
    -	// Return value to use if we return at the end of this function.
    -	// We use "goto out" to jump out of the while-switch construct
    -	// instead of returning directly, because that way we don't need
    -	// to copypaste the lzma_crc32() call to many places.
    -	lzma_ret ret = LZMA_OK;
    -
    -	while (*out_pos < out_size)
    -	switch (coder->sequence) {
    -	case SEQ_INDICATOR:
    -		out[*out_pos] = 0x00;
    -		++*out_pos;
    -		coder->sequence = SEQ_COUNT;
    -		break;
    -
    -	case SEQ_COUNT: {
    -		const lzma_vli count = lzma_index_block_count(coder->index);
    -		ret = lzma_vli_encode(count, &coder->pos,
    -				out, out_pos, out_size);
    -		if (ret != LZMA_STREAM_END)
    -			goto out;
    -
    -		ret = LZMA_OK;
    -		coder->pos = 0;
    -		coder->sequence = SEQ_NEXT;
    -		break;
    -	}
    -
    -	case SEQ_NEXT:
    -		if (lzma_index_iter_next(
    -				&coder->iter, LZMA_INDEX_ITER_BLOCK)) {
    -			// Get the size of the Index Padding field.
    -			coder->pos = lzma_index_padding_size(coder->index);
    -			assert(coder->pos <= 3);
    -			coder->sequence = SEQ_PADDING;
    -			break;
    -		}
    -
    -		coder->sequence = SEQ_UNPADDED;
    -
    -	// Fall through
    -
    -	case SEQ_UNPADDED:
    -	case SEQ_UNCOMPRESSED: {
    -		const lzma_vli size = coder->sequence == SEQ_UNPADDED
    -				? coder->iter.block.unpadded_size
    -				: coder->iter.block.uncompressed_size;
    -
    -		ret = lzma_vli_encode(size, &coder->pos,
    -				out, out_pos, out_size);
    -		if (ret != LZMA_STREAM_END)
    -			goto out;
    -
    -		ret = LZMA_OK;
    -		coder->pos = 0;
    -
    -		// Advance to SEQ_UNCOMPRESSED or SEQ_NEXT.
    -		++coder->sequence;
    -		break;
    -	}
    -
    -	case SEQ_PADDING:
    -		if (coder->pos > 0) {
    -			--coder->pos;
    -			out[(*out_pos)++] = 0x00;
    -			break;
    -		}
    -
    -		// Finish the CRC32 calculation.
    -		coder->crc32 = lzma_crc32(out + out_start,
    -				*out_pos - out_start, coder->crc32);
    -
    -		coder->sequence = SEQ_CRC32;
    -
    -	// Fall through
    -
    -	case SEQ_CRC32:
    -		// We don't use the main loop, because we don't want
    -		// coder->crc32 to be touched anymore.
    -		do {
    -			if (*out_pos == out_size)
    -				return LZMA_OK;
    -
    -			out[*out_pos] = (coder->crc32 >> (coder->pos * 8))
    -					& 0xFF;
    -			++*out_pos;
    -
    -		} while (++coder->pos < 4);
    -
    -		return LZMA_STREAM_END;
    -
    -	default:
    -		assert(0);
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -out:
    -	// Update the CRC32.
    -	coder->crc32 = lzma_crc32(out + out_start,
    -			*out_pos - out_start, coder->crc32);
    -
    -	return ret;
    -}
    -
    -
    -static void
    -index_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static void
    -index_encoder_reset(lzma_coder *coder, const lzma_index *i)
    -{
    -	lzma_index_iter_init(&coder->iter, i);
    -
    -	coder->sequence = SEQ_INDICATOR;
    -	coder->index = i;
    -	coder->pos = 0;
    -	coder->crc32 = 0;
    -
    -	return;
    -}
    -
    -
    -extern lzma_ret
    -lzma_index_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_index *i)
    -{
    -	lzma_next_coder_init(&lzma_index_encoder_init, next, allocator);
    -
    -	if (i == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &index_encode;
    -		next->end = &index_encoder_end;
    -	}
    -
    -	index_encoder_reset(next->coder, i);
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_encoder(lzma_stream *strm, const lzma_index *i)
    -{
    -	lzma_next_strm_init(lzma_index_encoder_init, strm, i);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_buffer_encode(const lzma_index *i,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	// Validate the arguments.
    -	if (i == NULL || out == NULL || out_pos == NULL || *out_pos > out_size)
    -		return LZMA_PROG_ERROR;
    -
    -	// Don't try to encode if there's not enough output space.
    -	if (out_size - *out_pos < lzma_index_size(i))
    -		return LZMA_BUF_ERROR;
    -
    -	// The Index encoder needs just one small data structure so we can
    -	// allocate it on stack.
    -	lzma_coder coder;
    -	index_encoder_reset(&coder, i);
    -
    -	// Do the actual encoding. This should never fail, but store
    -	// the original *out_pos just in case.
    -	const size_t out_start = *out_pos;
    -	lzma_ret ret = index_encode(&coder, NULL, NULL, NULL, 0,
    -			out, out_pos, out_size, LZMA_RUN);
    -
    -	if (ret == LZMA_STREAM_END) {
    -		ret = LZMA_OK;
    -	} else {
    -		// We should never get here, but just in case, restore the
    -		// output position and set the error accordingly if something
    -		// goes wrong and debugging isn't enabled.
    -		assert(0);
    -		*out_pos = out_start;
    -		ret = LZMA_PROG_ERROR;
    -	}
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/index_encoder.h b/external/public-domain/xz/dist/src/liblzma/common/index_encoder.h
    deleted file mode 100644
    index 4d55cd104..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/index_encoder.h
    +++ /dev/null
    @@ -1,23 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       index_encoder.h
    -/// \brief      Encodes the Index field
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_INDEX_ENCODER_H
    -#define LZMA_INDEX_ENCODER_H
    -
    -#include "common.h"
    -
    -
    -extern lzma_ret lzma_index_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator, const lzma_index *i);
    -
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/index_hash.c b/external/public-domain/xz/dist/src/liblzma/common/index_hash.c
    deleted file mode 100644
    index d7a0344b7..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/index_hash.c
    +++ /dev/null
    @@ -1,334 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       index_hash.c
    -/// \brief      Validates Index by using a hash function
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -#include "index.h"
    -#include "check.h"
    -
    -
    -typedef struct {
    -	/// Sum of the Block sizes (including Block Padding)
    -	lzma_vli blocks_size;
    -
    -	/// Sum of the Uncompressed Size fields
    -	lzma_vli uncompressed_size;
    -
    -	/// Number of Records
    -	lzma_vli count;
    -
    -	/// Size of the List of Index Records as bytes
    -	lzma_vli index_list_size;
    -
    -	/// Check calculated from Unpadded Sizes and Uncompressed Sizes.
    -	lzma_check_state check;
    -
    -} lzma_index_hash_info;
    -
    -
    -struct lzma_index_hash_s {
    -	enum {
    -		SEQ_BLOCK,
    -		SEQ_COUNT,
    -		SEQ_UNPADDED,
    -		SEQ_UNCOMPRESSED,
    -		SEQ_PADDING_INIT,
    -		SEQ_PADDING,
    -		SEQ_CRC32,
    -	} sequence;
    -
    -	/// Information collected while decoding the actual Blocks.
    -	lzma_index_hash_info blocks;
    -
    -	/// Information collected from the Index field.
    -	lzma_index_hash_info records;
    -
    -	/// Number of Records not fully decoded
    -	lzma_vli remaining;
    -
    -	/// Unpadded Size currently being read from an Index Record.
    -	lzma_vli unpadded_size;
    -
    -	/// Uncompressed Size currently being read from an Index Record.
    -	lzma_vli uncompressed_size;
    -
    -	/// Position in variable-length integers when decoding them from
    -	/// the List of Records.
    -	size_t pos;
    -
    -	/// CRC32 of the Index
    -	uint32_t crc32;
    -};
    -
    -
    -extern LZMA_API(lzma_index_hash *)
    -lzma_index_hash_init(lzma_index_hash *index_hash,
    -		const lzma_allocator *allocator)
    -{
    -	if (index_hash == NULL) {
    -		index_hash = lzma_alloc(sizeof(lzma_index_hash), allocator);
    -		if (index_hash == NULL)
    -			return NULL;
    -	}
    -
    -	index_hash->sequence = SEQ_BLOCK;
    -	index_hash->blocks.blocks_size = 0;
    -	index_hash->blocks.uncompressed_size = 0;
    -	index_hash->blocks.count = 0;
    -	index_hash->blocks.index_list_size = 0;
    -	index_hash->records.blocks_size = 0;
    -	index_hash->records.uncompressed_size = 0;
    -	index_hash->records.count = 0;
    -	index_hash->records.index_list_size = 0;
    -	index_hash->unpadded_size = 0;
    -	index_hash->uncompressed_size = 0;
    -	index_hash->pos = 0;
    -	index_hash->crc32 = 0;
    -
    -	// These cannot fail because LZMA_CHECK_BEST is known to be supported.
    -	(void)lzma_check_init(&index_hash->blocks.check, LZMA_CHECK_BEST);
    -	(void)lzma_check_init(&index_hash->records.check, LZMA_CHECK_BEST);
    -
    -	return index_hash;
    -}
    -
    -
    -extern LZMA_API(void)
    -lzma_index_hash_end(lzma_index_hash *index_hash,
    -		const lzma_allocator *allocator)
    -{
    -	lzma_free(index_hash, allocator);
    -	return;
    -}
    -
    -
    -extern LZMA_API(lzma_vli)
    -lzma_index_hash_size(const lzma_index_hash *index_hash)
    -{
    -	// Get the size of the Index from ->blocks instead of ->records for
    -	// cases where application wants to know the Index Size before
    -	// decoding the Index.
    -	return index_size(index_hash->blocks.count,
    -			index_hash->blocks.index_list_size);
    -}
    -
    -
    -/// Updates the sizes and the hash without any validation.
    -static lzma_ret
    -hash_append(lzma_index_hash_info *info, lzma_vli unpadded_size,
    -		lzma_vli uncompressed_size)
    -{
    -	info->blocks_size += vli_ceil4(unpadded_size);
    -	info->uncompressed_size += uncompressed_size;
    -	info->index_list_size += lzma_vli_size(unpadded_size)
    -			+ lzma_vli_size(uncompressed_size);
    -	++info->count;
    -
    -	const lzma_vli sizes[2] = { unpadded_size, uncompressed_size };
    -	lzma_check_update(&info->check, LZMA_CHECK_BEST,
    -			(const uint8_t *)(sizes), sizeof(sizes));
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_hash_append(lzma_index_hash *index_hash, lzma_vli unpadded_size,
    -		lzma_vli uncompressed_size)
    -{
    -	// Validate the arguments.
    -	if (index_hash->sequence != SEQ_BLOCK
    -			|| unpadded_size < UNPADDED_SIZE_MIN
    -			|| unpadded_size > UNPADDED_SIZE_MAX
    -			|| uncompressed_size > LZMA_VLI_MAX)
    -		return LZMA_PROG_ERROR;
    -
    -	// Update the hash.
    -	return_if_error(hash_append(&index_hash->blocks,
    -			unpadded_size, uncompressed_size));
    -
    -	// Validate the properties of *info are still in allowed limits.
    -	if (index_hash->blocks.blocks_size > LZMA_VLI_MAX
    -			|| index_hash->blocks.uncompressed_size > LZMA_VLI_MAX
    -			|| index_size(index_hash->blocks.count,
    -					index_hash->blocks.index_list_size)
    -				> LZMA_BACKWARD_SIZE_MAX
    -			|| index_stream_size(index_hash->blocks.blocks_size,
    -					index_hash->blocks.count,
    -					index_hash->blocks.index_list_size)
    -				> LZMA_VLI_MAX)
    -		return LZMA_DATA_ERROR;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_index_hash_decode(lzma_index_hash *index_hash, const uint8_t *in,
    -		size_t *in_pos, size_t in_size)
    -{
    -	// Catch zero input buffer here, because in contrast to Index encoder
    -	// and decoder functions, applications call this function directly
    -	// instead of via lzma_code(), which does the buffer checking.
    -	if (*in_pos >= in_size)
    -		return LZMA_BUF_ERROR;
    -
    -	// NOTE: This function has many similarities to index_encode() and
    -	// index_decode() functions found from index_encoder.c and
    -	// index_decoder.c. See the comments especially in index_encoder.c.
    -	const size_t in_start = *in_pos;
    -	lzma_ret ret = LZMA_OK;
    -
    -	while (*in_pos < in_size)
    -	switch (index_hash->sequence) {
    -	case SEQ_BLOCK:
    -		// Check the Index Indicator is present.
    -		if (in[(*in_pos)++] != 0x00)
    -			return LZMA_DATA_ERROR;
    -
    -		index_hash->sequence = SEQ_COUNT;
    -		break;
    -
    -	case SEQ_COUNT: {
    -		ret = lzma_vli_decode(&index_hash->remaining,
    -				&index_hash->pos, in, in_pos, in_size);
    -		if (ret != LZMA_STREAM_END)
    -			goto out;
    -
    -		// The count must match the count of the Blocks decoded.
    -		if (index_hash->remaining != index_hash->blocks.count)
    -			return LZMA_DATA_ERROR;
    -
    -		ret = LZMA_OK;
    -		index_hash->pos = 0;
    -
    -		// Handle the special case when there are no Blocks.
    -		index_hash->sequence = index_hash->remaining == 0
    -				? SEQ_PADDING_INIT : SEQ_UNPADDED;
    -		break;
    -	}
    -
    -	case SEQ_UNPADDED:
    -	case SEQ_UNCOMPRESSED: {
    -		lzma_vli *size = index_hash->sequence == SEQ_UNPADDED
    -				? &index_hash->unpadded_size
    -				: &index_hash->uncompressed_size;
    -
    -		ret = lzma_vli_decode(size, &index_hash->pos,
    -				in, in_pos, in_size);
    -		if (ret != LZMA_STREAM_END)
    -			goto out;
    -
    -		ret = LZMA_OK;
    -		index_hash->pos = 0;
    -
    -		if (index_hash->sequence == SEQ_UNPADDED) {
    -			if (index_hash->unpadded_size < UNPADDED_SIZE_MIN
    -					|| index_hash->unpadded_size
    -						> UNPADDED_SIZE_MAX)
    -				return LZMA_DATA_ERROR;
    -
    -			index_hash->sequence = SEQ_UNCOMPRESSED;
    -		} else {
    -			// Update the hash.
    -			return_if_error(hash_append(&index_hash->records,
    -					index_hash->unpadded_size,
    -					index_hash->uncompressed_size));
    -
    -			// Verify that we don't go over the known sizes. Note
    -			// that this validation is simpler than the one used
    -			// in lzma_index_hash_append(), because here we know
    -			// that values in index_hash->blocks are already
    -			// validated and we are fine as long as we don't
    -			// exceed them in index_hash->records.
    -			if (index_hash->blocks.blocks_size
    -					< index_hash->records.blocks_size
    -					|| index_hash->blocks.uncompressed_size
    -					< index_hash->records.uncompressed_size
    -					|| index_hash->blocks.index_list_size
    -					< index_hash->records.index_list_size)
    -				return LZMA_DATA_ERROR;
    -
    -			// Check if this was the last Record.
    -			index_hash->sequence = --index_hash->remaining == 0
    -					? SEQ_PADDING_INIT : SEQ_UNPADDED;
    -		}
    -
    -		break;
    -	}
    -
    -	case SEQ_PADDING_INIT:
    -		index_hash->pos = (LZMA_VLI_C(4) - index_size_unpadded(
    -				index_hash->records.count,
    -				index_hash->records.index_list_size)) & 3;
    -		index_hash->sequence = SEQ_PADDING;
    -
    -	// Fall through
    -
    -	case SEQ_PADDING:
    -		if (index_hash->pos > 0) {
    -			--index_hash->pos;
    -			if (in[(*in_pos)++] != 0x00)
    -				return LZMA_DATA_ERROR;
    -
    -			break;
    -		}
    -
    -		// Compare the sizes.
    -		if (index_hash->blocks.blocks_size
    -				!= index_hash->records.blocks_size
    -				|| index_hash->blocks.uncompressed_size
    -				!= index_hash->records.uncompressed_size
    -				|| index_hash->blocks.index_list_size
    -				!= index_hash->records.index_list_size)
    -			return LZMA_DATA_ERROR;
    -
    -		// Finish the hashes and compare them.
    -		lzma_check_finish(&index_hash->blocks.check, LZMA_CHECK_BEST);
    -		lzma_check_finish(&index_hash->records.check, LZMA_CHECK_BEST);
    -		if (memcmp(index_hash->blocks.check.buffer.u8,
    -				index_hash->records.check.buffer.u8,
    -				lzma_check_size(LZMA_CHECK_BEST)) != 0)
    -			return LZMA_DATA_ERROR;
    -
    -		// Finish the CRC32 calculation.
    -		index_hash->crc32 = lzma_crc32(in + in_start,
    -				*in_pos - in_start, index_hash->crc32);
    -
    -		index_hash->sequence = SEQ_CRC32;
    -
    -	// Fall through
    -
    -	case SEQ_CRC32:
    -		do {
    -			if (*in_pos == in_size)
    -				return LZMA_OK;
    -
    -			if (((index_hash->crc32 >> (index_hash->pos * 8))
    -					& 0xFF) != in[(*in_pos)++])
    -				return LZMA_DATA_ERROR;
    -
    -		} while (++index_hash->pos < 4);
    -
    -		return LZMA_STREAM_END;
    -
    -	default:
    -		assert(0);
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -out:
    -	// Update the CRC32,
    -	index_hash->crc32 = lzma_crc32(in + in_start,
    -			*in_pos - in_start, index_hash->crc32);
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/memcmplen.h b/external/public-domain/xz/dist/src/liblzma/common/memcmplen.h
    deleted file mode 100644
    index c1efc9e28..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/memcmplen.h
    +++ /dev/null
    @@ -1,175 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       memcmplen.h
    -/// \brief      Optimized comparison of two buffers
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_MEMCMPLEN_H
    -#define LZMA_MEMCMPLEN_H
    -
    -#include "common.h"
    -
    -#ifdef HAVE_IMMINTRIN_H
    -#	include 
    -#endif
    -
    -
    -/// Find out how many equal bytes the two buffers have.
    -///
    -/// \param      buf1    First buffer
    -/// \param      buf2    Second buffer
    -/// \param      len     How many bytes have already been compared and will
    -///                     be assumed to match
    -/// \param      limit   How many bytes to compare at most, including the
    -///                     already-compared bytes. This must be significantly
    -///                     smaller than UINT32_MAX to avoid integer overflows.
    -///                     Up to LZMA_MEMCMPLEN_EXTRA bytes may be read past
    -///                     the specified limit from both buf1 and buf2.
    -///
    -/// \return     Number of equal bytes in the buffers is returned.
    -///             This is always at least len and at most limit.
    -///
    -/// \note       LZMA_MEMCMPLEN_EXTRA defines how many extra bytes may be read.
    -///             It's rounded up to 2^n. This extra amount needs to be
    -///             allocated in the buffers being used. It needs to be
    -///             initialized too to keep Valgrind quiet.
    -static inline uint32_t lzma_attribute((__always_inline__))
    -lzma_memcmplen(const uint8_t *buf1, const uint8_t *buf2,
    -		uint32_t len, uint32_t limit)
    -{
    -	assert(len <= limit);
    -	assert(limit <= UINT32_MAX / 2);
    -
    -#if defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
    -		&& ((TUKLIB_GNUC_REQ(3, 4) && defined(__x86_64__)) \
    -			|| (defined(__INTEL_COMPILER) && defined(__x86_64__)) \
    -			|| (defined(__INTEL_COMPILER) && defined(_M_X64)) \
    -			|| (defined(_MSC_VER) && defined(_M_X64)))
    -	// NOTE: This will use 64-bit unaligned access which
    -	// TUKLIB_FAST_UNALIGNED_ACCESS wasn't meant to permit, but
    -	// it's convenient here at least as long as it's x86-64 only.
    -	//
    -	// I keep this x86-64 only for now since that's where I know this
    -	// to be a good method. This may be fine on other 64-bit CPUs too.
    -	// On big endian one should use xor instead of subtraction and switch
    -	// to __builtin_clzll().
    -#define LZMA_MEMCMPLEN_EXTRA 8
    -	while (len < limit) {
    -		const uint64_t x = *(const uint64_t *)(buf1 + len)
    -				- *(const uint64_t *)(buf2 + len);
    -		if (x != 0) {
    -#	if defined(_M_X64) // MSVC or Intel C compiler on Windows
    -			unsigned long tmp;
    -			_BitScanForward64(&tmp, x);
    -			len += (uint32_t)tmp >> 3;
    -#	else // GCC, clang, or Intel C compiler
    -			len += (uint32_t)__builtin_ctzll(x) >> 3;
    -#	endif
    -			return my_min(len, limit);
    -		}
    -
    -		len += 8;
    -	}
    -
    -	return limit;
    -
    -#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) \
    -		&& defined(HAVE__MM_MOVEMASK_EPI8) \
    -		&& ((defined(__GNUC__) && defined(__SSE2_MATH__)) \
    -			|| (defined(__INTEL_COMPILER) && defined(__SSE2__)) \
    -			|| (defined(_MSC_VER) && defined(_M_IX86_FP) \
    -				&& _M_IX86_FP >= 2))
    -	// NOTE: Like above, this will use 128-bit unaligned access which
    -	// TUKLIB_FAST_UNALIGNED_ACCESS wasn't meant to permit.
    -	//
    -	// SSE2 version for 32-bit and 64-bit x86. On x86-64 the above
    -	// version is sometimes significantly faster and sometimes
    -	// slightly slower than this SSE2 version, so this SSE2
    -	// version isn't used on x86-64.
    -#	define LZMA_MEMCMPLEN_EXTRA 16
    -	while (len < limit) {
    -		const uint32_t x = 0xFFFF ^ _mm_movemask_epi8(_mm_cmpeq_epi8(
    -			_mm_loadu_si128((const __m128i *)(buf1 + len)),
    -			_mm_loadu_si128((const __m128i *)(buf2 + len))));
    -
    -		if (x != 0) {
    -#	if defined(__INTEL_COMPILER)
    -			len += _bit_scan_forward(x);
    -#	elif defined(_MSC_VER)
    -			unsigned long tmp;
    -			_BitScanForward(&tmp, x);
    -			len += tmp;
    -#	else
    -			len += __builtin_ctz(x);
    -#	endif
    -			return my_min(len, limit);
    -		}
    -
    -		len += 16;
    -	}
    -
    -	return limit;
    -
    -#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) && !defined(WORDS_BIGENDIAN)
    -	// Generic 32-bit little endian method
    -#	define LZMA_MEMCMPLEN_EXTRA 4
    -	while (len < limit) {
    -		uint32_t x = *(const uint32_t *)(buf1 + len)
    -				- *(const uint32_t *)(buf2 + len);
    -		if (x != 0) {
    -			if ((x & 0xFFFF) == 0) {
    -				len += 2;
    -				x >>= 16;
    -			}
    -
    -			if ((x & 0xFF) == 0)
    -				++len;
    -
    -			return my_min(len, limit);
    -		}
    -
    -		len += 4;
    -	}
    -
    -	return limit;
    -
    -#elif defined(TUKLIB_FAST_UNALIGNED_ACCESS) && defined(WORDS_BIGENDIAN)
    -	// Generic 32-bit big endian method
    -#	define LZMA_MEMCMPLEN_EXTRA 4
    -	while (len < limit) {
    -		uint32_t x = *(const uint32_t *)(buf1 + len)
    -				^ *(const uint32_t *)(buf2 + len);
    -		if (x != 0) {
    -			if ((x & 0xFFFF0000) == 0) {
    -				len += 2;
    -				x <<= 16;
    -			}
    -
    -			if ((x & 0xFF000000) == 0)
    -				++len;
    -
    -			return my_min(len, limit);
    -		}
    -
    -		len += 4;
    -	}
    -
    -	return limit;
    -
    -#else
    -	// Simple portable version that doesn't use unaligned access.
    -#	define LZMA_MEMCMPLEN_EXTRA 0
    -	while (len < limit && buf1[len] == buf2[len])
    -		++len;
    -
    -	return len;
    -#endif
    -}
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/outqueue.c b/external/public-domain/xz/dist/src/liblzma/common/outqueue.c
    deleted file mode 100644
    index 2dc8a38d1..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/outqueue.c
    +++ /dev/null
    @@ -1,184 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       outqueue.c
    -/// \brief      Output queue handling in multithreaded coding
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "outqueue.h"
    -
    -
    -/// This is to ease integer overflow checking: We may allocate up to
    -/// 2 * LZMA_THREADS_MAX buffers and we need some extra memory for other
    -/// data structures (that's the second /2).
    -#define BUF_SIZE_MAX (UINT64_MAX / LZMA_THREADS_MAX / 2 / 2)
    -
    -
    -static lzma_ret
    -get_options(uint64_t *bufs_alloc_size, uint32_t *bufs_count,
    -		uint64_t buf_size_max, uint32_t threads)
    -{
    -	if (threads > LZMA_THREADS_MAX || buf_size_max > BUF_SIZE_MAX)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// The number of buffers is twice the number of threads.
    -	// This wastes RAM but keeps the threads busy when buffers
    -	// finish out of order.
    -	//
    -	// NOTE: If this is changed, update BUF_SIZE_MAX too.
    -	*bufs_count = threads * 2;
    -	*bufs_alloc_size = *bufs_count * buf_size_max;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern uint64_t
    -lzma_outq_memusage(uint64_t buf_size_max, uint32_t threads)
    -{
    -	uint64_t bufs_alloc_size;
    -	uint32_t bufs_count;
    -
    -	if (get_options(&bufs_alloc_size, &bufs_count, buf_size_max, threads)
    -			!= LZMA_OK)
    -		return UINT64_MAX;
    -
    -	return sizeof(lzma_outq) + bufs_count * sizeof(lzma_outbuf)
    -			+ bufs_alloc_size;
    -}
    -
    -
    -extern lzma_ret
    -lzma_outq_init(lzma_outq *outq, const lzma_allocator *allocator,
    -		uint64_t buf_size_max, uint32_t threads)
    -{
    -	uint64_t bufs_alloc_size;
    -	uint32_t bufs_count;
    -
    -	// Set bufs_count and bufs_alloc_size.
    -	return_if_error(get_options(&bufs_alloc_size, &bufs_count,
    -			buf_size_max, threads));
    -
    -	// Allocate memory if needed.
    -	if (outq->buf_size_max != buf_size_max
    -			|| outq->bufs_allocated != bufs_count) {
    -		lzma_outq_end(outq, allocator);
    -
    -#if SIZE_MAX < UINT64_MAX
    -		if (bufs_alloc_size > SIZE_MAX)
    -			return LZMA_MEM_ERROR;
    -#endif
    -
    -		outq->bufs = lzma_alloc(bufs_count * sizeof(lzma_outbuf),
    -				allocator);
    -		outq->bufs_mem = lzma_alloc((size_t)(bufs_alloc_size),
    -				allocator);
    -
    -		if (outq->bufs == NULL || outq->bufs_mem == NULL) {
    -			lzma_outq_end(outq, allocator);
    -			return LZMA_MEM_ERROR;
    -		}
    -	}
    -
    -	// Initialize the rest of the main structure. Initialization of
    -	// outq->bufs[] is done when they are actually needed.
    -	outq->buf_size_max = (size_t)(buf_size_max);
    -	outq->bufs_allocated = bufs_count;
    -	outq->bufs_pos = 0;
    -	outq->bufs_used = 0;
    -	outq->read_pos = 0;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern void
    -lzma_outq_end(lzma_outq *outq, const lzma_allocator *allocator)
    -{
    -	lzma_free(outq->bufs, allocator);
    -	outq->bufs = NULL;
    -
    -	lzma_free(outq->bufs_mem, allocator);
    -	outq->bufs_mem = NULL;
    -
    -	return;
    -}
    -
    -
    -extern lzma_outbuf *
    -lzma_outq_get_buf(lzma_outq *outq)
    -{
    -	// Caller must have checked it with lzma_outq_has_buf().
    -	assert(outq->bufs_used < outq->bufs_allocated);
    -
    -	// Initialize the new buffer.
    -	lzma_outbuf *buf = &outq->bufs[outq->bufs_pos];
    -	buf->buf = outq->bufs_mem + outq->bufs_pos * outq->buf_size_max;
    -	buf->size = 0;
    -	buf->finished = false;
    -
    -	// Update the queue state.
    -	if (++outq->bufs_pos == outq->bufs_allocated)
    -		outq->bufs_pos = 0;
    -
    -	++outq->bufs_used;
    -
    -	return buf;
    -}
    -
    -
    -extern bool
    -lzma_outq_is_readable(const lzma_outq *outq)
    -{
    -	uint32_t i = outq->bufs_pos - outq->bufs_used;
    -	if (outq->bufs_pos < outq->bufs_used)
    -		i += outq->bufs_allocated;
    -
    -	return outq->bufs[i].finished;
    -}
    -
    -
    -extern lzma_ret
    -lzma_outq_read(lzma_outq *restrict outq, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size,
    -		lzma_vli *restrict unpadded_size,
    -		lzma_vli *restrict uncompressed_size)
    -{
    -	// There must be at least one buffer from which to read.
    -	if (outq->bufs_used == 0)
    -		return LZMA_OK;
    -
    -	// Get the buffer.
    -	uint32_t i = outq->bufs_pos - outq->bufs_used;
    -	if (outq->bufs_pos < outq->bufs_used)
    -		i += outq->bufs_allocated;
    -
    -	lzma_outbuf *buf = &outq->bufs[i];
    -
    -	// If it isn't finished yet, we cannot read from it.
    -	if (!buf->finished)
    -		return LZMA_OK;
    -
    -	// Copy from the buffer to output.
    -	lzma_bufcpy(buf->buf, &outq->read_pos, buf->size,
    -			out, out_pos, out_size);
    -
    -	// Return if we didn't get all the data from the buffer.
    -	if (outq->read_pos < buf->size)
    -		return LZMA_OK;
    -
    -	// The buffer was finished. Tell the caller its size information.
    -	*unpadded_size = buf->unpadded_size;
    -	*uncompressed_size = buf->uncompressed_size;
    -
    -	// Free this buffer for further use.
    -	--outq->bufs_used;
    -	outq->read_pos = 0;
    -
    -	return LZMA_STREAM_END;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/outqueue.h b/external/public-domain/xz/dist/src/liblzma/common/outqueue.h
    deleted file mode 100644
    index 079634de4..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/outqueue.h
    +++ /dev/null
    @@ -1,156 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       outqueue.h
    -/// \brief      Output queue handling in multithreaded coding
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -
    -/// Output buffer for a single thread
    -typedef struct {
    -	/// Pointer to the output buffer of lzma_outq.buf_size_max bytes
    -	uint8_t *buf;
    -
    -	/// Amount of data written to buf
    -	size_t size;
    -
    -	/// Additional size information
    -	lzma_vli unpadded_size;
    -	lzma_vli uncompressed_size;
    -
    -	/// True when no more data will be written into this buffer.
    -	///
    -	/// \note       This is read by another thread and thus access
    -	///             to this variable needs a mutex.
    -	bool finished;
    -
    -} lzma_outbuf;
    -
    -
    -typedef struct {
    -	/// Array of buffers that are used cyclically.
    -	lzma_outbuf *bufs;
    -
    -	/// Memory allocated for all the buffers
    -	uint8_t *bufs_mem;
    -
    -	/// Amount of buffer space available in each buffer
    -	size_t buf_size_max;
    -
    -	/// Number of buffers allocated
    -	uint32_t bufs_allocated;
    -
    -	/// Position in the bufs array. The next buffer to be taken
    -	/// into use is bufs[bufs_pos].
    -	uint32_t bufs_pos;
    -
    -	/// Number of buffers in use
    -	uint32_t bufs_used;
    -
    -	/// Position in the buffer in lzma_outq_read()
    -	size_t read_pos;
    -
    -} lzma_outq;
    -
    -
    -/**
    - * \brief       Calculate the memory usage of an output queue
    - *
    - * \return      Approximate memory usage in bytes or UINT64_MAX on error.
    - */
    -extern uint64_t lzma_outq_memusage(uint64_t buf_size_max, uint32_t threads);
    -
    -
    -/// \brief      Initialize an output queue
    -///
    -/// \param      outq            Pointer to an output queue. Before calling
    -///                             this function the first time, *outq should
    -///                             have been zeroed with memzero() so that this
    -///                             function knows that there are no previous
    -///                             allocations to free.
    -/// \param      allocator       Pointer to allocator or NULL
    -/// \param      buf_size_max    Maximum amount of data that a single buffer
    -///                             in the queue may need to store.
    -/// \param      threads         Number of buffers that may be in use
    -///                             concurrently. Note that more than this number
    -///                             of buffers will actually get allocated to
    -///                             improve performance when buffers finish
    -///                             out of order.
    -///
    -/// \return     - LZMA_OK
    -///             - LZMA_MEM_ERROR
    -///
    -extern lzma_ret lzma_outq_init(
    -		lzma_outq *outq, const lzma_allocator *allocator,
    -		uint64_t buf_size_max, uint32_t threads);
    -
    -
    -/// \brief      Free the memory associated with the output queue
    -extern void lzma_outq_end(lzma_outq *outq, const lzma_allocator *allocator);
    -
    -
    -/// \brief      Get a new buffer
    -///
    -/// lzma_outq_has_buf() must be used to check that there is a buffer
    -/// available before calling lzma_outq_get_buf().
    -///
    -extern lzma_outbuf *lzma_outq_get_buf(lzma_outq *outq);
    -
    -
    -/// \brief      Test if there is data ready to be read
    -///
    -/// Call to this function must be protected with the same mutex that
    -/// is used to protect lzma_outbuf.finished.
    -///
    -extern bool lzma_outq_is_readable(const lzma_outq *outq);
    -
    -
    -/// \brief      Read finished data
    -///
    -/// \param      outq            Pointer to an output queue
    -/// \param      out             Beginning of the output buffer
    -/// \param      out_pos         The next byte will be written to
    -///                             out[*out_pos].
    -/// \param      out_size        Size of the out buffer; the first byte into
    -///                             which no data is written to is out[out_size].
    -/// \param      unpadded_size   Unpadded Size from the Block encoder
    -/// \param      uncompressed_size Uncompressed Size from the Block encoder
    -///
    -/// \return     - LZMA: All OK. Either no data was available or the buffer
    -///               being read didn't become empty yet.
    -///             - LZMA_STREAM_END: The buffer being read was finished.
    -///               *unpadded_size and *uncompressed_size were set.
    -///
    -/// \note       This reads lzma_outbuf.finished variables and thus call
    -///             to this function needs to be protected with a mutex.
    -///
    -extern lzma_ret lzma_outq_read(lzma_outq *restrict outq,
    -		uint8_t *restrict out, size_t *restrict out_pos,
    -		size_t out_size, lzma_vli *restrict unpadded_size,
    -		lzma_vli *restrict uncompressed_size);
    -
    -
    -/// \brief      Test if there is at least one buffer free
    -///
    -/// This must be used before getting a new buffer with lzma_outq_get_buf().
    -///
    -static inline bool
    -lzma_outq_has_buf(const lzma_outq *outq)
    -{
    -	return outq->bufs_used < outq->bufs_allocated;
    -}
    -
    -
    -/// \brief      Test if the queue is completely empty
    -static inline bool
    -lzma_outq_is_empty(const lzma_outq *outq)
    -{
    -	return outq->bufs_used == 0;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_buffer_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/stream_buffer_decoder.c
    deleted file mode 100644
    index b9745b5db..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_buffer_decoder.c
    +++ /dev/null
    @@ -1,91 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_buffer_decoder.c
    -/// \brief      Single-call .xz Stream decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "stream_decoder.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_buffer_decode(uint64_t *memlimit, uint32_t flags,
    -		const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	// Sanity checks
    -	if (in_pos == NULL || (in == NULL && *in_pos != in_size)
    -			|| *in_pos > in_size || out_pos == NULL
    -			|| (out == NULL && *out_pos != out_size)
    -			|| *out_pos > out_size)
    -		return LZMA_PROG_ERROR;
    -
    -	// Catch flags that are not allowed in buffer-to-buffer decoding.
    -	if (flags & LZMA_TELL_ANY_CHECK)
    -		return LZMA_PROG_ERROR;
    -
    -	// Initialize the Stream decoder.
    -	// TODO: We need something to tell the decoder that it can use the
    -	// output buffer as workspace, and thus save significant amount of RAM.
    -	lzma_next_coder stream_decoder = LZMA_NEXT_CODER_INIT;
    -	lzma_ret ret = lzma_stream_decoder_init(
    -			&stream_decoder, allocator, *memlimit, flags);
    -
    -	if (ret == LZMA_OK) {
    -		// Save the positions so that we can restore them in case
    -		// an error occurs.
    -		const size_t in_start = *in_pos;
    -		const size_t out_start = *out_pos;
    -
    -		// Do the actual decoding.
    -		ret = stream_decoder.code(stream_decoder.coder, allocator,
    -				in, in_pos, in_size, out, out_pos, out_size,
    -				LZMA_FINISH);
    -
    -		if (ret == LZMA_STREAM_END) {
    -			ret = LZMA_OK;
    -		} else {
    -			// Something went wrong, restore the positions.
    -			*in_pos = in_start;
    -			*out_pos = out_start;
    -
    -			if (ret == LZMA_OK) {
    -				// Either the input was truncated or the
    -				// output buffer was too small.
    -				assert(*in_pos == in_size
    -						|| *out_pos == out_size);
    -
    -				// If all the input was consumed, then the
    -				// input is truncated, even if the output
    -				// buffer is also full. This is because
    -				// processing the last byte of the Stream
    -				// never produces output.
    -				if (*in_pos == in_size)
    -					ret = LZMA_DATA_ERROR;
    -				else
    -					ret = LZMA_BUF_ERROR;
    -
    -			} else if (ret == LZMA_MEMLIMIT_ERROR) {
    -				// Let the caller know how much memory would
    -				// have been needed.
    -				uint64_t memusage;
    -				(void)stream_decoder.memconfig(
    -						stream_decoder.coder,
    -						memlimit, &memusage, 0);
    -			}
    -		}
    -	}
    -
    -	// Free the decoder memory. This needs to be done even if
    -	// initialization fails, because the internal API doesn't
    -	// require the initialization function to free its memory on error.
    -	lzma_next_end(&stream_decoder, allocator);
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_buffer_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/stream_buffer_encoder.c
    deleted file mode 100644
    index af49554a6..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_buffer_encoder.c
    +++ /dev/null
    @@ -1,141 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_buffer_encoder.c
    -/// \brief      Single-call .xz Stream encoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "index.h"
    -
    -
    -/// Maximum size of Index that has exactly one Record.
    -/// Index Indicator + Number of Records + Record + CRC32 rounded up to
    -/// the next multiple of four.
    -#define INDEX_BOUND ((1 + 1 + 2 * LZMA_VLI_BYTES_MAX + 4 + 3) & ~3)
    -
    -/// Stream Header, Stream Footer, and Index
    -#define HEADERS_BOUND (2 * LZMA_STREAM_HEADER_SIZE + INDEX_BOUND)
    -
    -
    -extern LZMA_API(size_t)
    -lzma_stream_buffer_bound(size_t uncompressed_size)
    -{
    -	// Get the maximum possible size of a Block.
    -	const size_t block_bound = lzma_block_buffer_bound(uncompressed_size);
    -	if (block_bound == 0)
    -		return 0;
    -
    -	// Catch the possible integer overflow and also prevent the size of
    -	// the Stream exceeding LZMA_VLI_MAX (theoretically possible on
    -	// 64-bit systems).
    -	if (my_min(SIZE_MAX, LZMA_VLI_MAX) - block_bound < HEADERS_BOUND)
    -		return 0;
    -
    -	return block_bound + HEADERS_BOUND;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_buffer_encode(lzma_filter *filters, lzma_check check,
    -		const lzma_allocator *allocator,
    -		const uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t *out_pos_ptr, size_t out_size)
    -{
    -	// Sanity checks
    -	if (filters == NULL || (unsigned int)(check) > LZMA_CHECK_ID_MAX
    -			|| (in == NULL && in_size != 0) || out == NULL
    -			|| out_pos_ptr == NULL || *out_pos_ptr > out_size)
    -		return LZMA_PROG_ERROR;
    -
    -	if (!lzma_check_is_supported(check))
    -		return LZMA_UNSUPPORTED_CHECK;
    -
    -	// Note for the paranoids: Index encoder prevents the Stream from
    -	// getting too big and still being accepted with LZMA_OK, and Block
    -	// encoder catches if the input is too big. So we don't need to
    -	// separately check if the buffers are too big.
    -
    -	// Use a local copy. We update *out_pos_ptr only if everything
    -	// succeeds.
    -	size_t out_pos = *out_pos_ptr;
    -
    -	// Check that there's enough space for both Stream Header and
    -	// Stream Footer.
    -	if (out_size - out_pos <= 2 * LZMA_STREAM_HEADER_SIZE)
    -		return LZMA_BUF_ERROR;
    -
    -	// Reserve space for Stream Footer so we don't need to check for
    -	// available space again before encoding Stream Footer.
    -	out_size -= LZMA_STREAM_HEADER_SIZE;
    -
    -	// Encode the Stream Header.
    -	lzma_stream_flags stream_flags = {
    -		.version = 0,
    -		.check = check,
    -	};
    -
    -	if (lzma_stream_header_encode(&stream_flags, out + out_pos)
    -			!= LZMA_OK)
    -		return LZMA_PROG_ERROR;
    -
    -	out_pos += LZMA_STREAM_HEADER_SIZE;
    -
    -	// Encode a Block but only if there is at least one byte of input.
    -	lzma_block block = {
    -		.version = 0,
    -		.check = check,
    -		.filters = filters,
    -	};
    -
    -	if (in_size > 0)
    -		return_if_error(lzma_block_buffer_encode(&block, allocator,
    -				in, in_size, out, &out_pos, out_size));
    -
    -	// Index
    -	{
    -		// Create an Index. It will have one Record if there was
    -		// at least one byte of input to encode. Otherwise the
    -		// Index will be empty.
    -		lzma_index *i = lzma_index_init(allocator);
    -		if (i == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		lzma_ret ret = LZMA_OK;
    -
    -		if (in_size > 0)
    -			ret = lzma_index_append(i, allocator,
    -					lzma_block_unpadded_size(&block),
    -					block.uncompressed_size);
    -
    -		// If adding the Record was successful, encode the Index
    -		// and get its size which will be stored into Stream Footer.
    -		if (ret == LZMA_OK) {
    -			ret = lzma_index_buffer_encode(
    -					i, out, &out_pos, out_size);
    -
    -			stream_flags.backward_size = lzma_index_size(i);
    -		}
    -
    -		lzma_index_end(i, allocator);
    -
    -		if (ret != LZMA_OK)
    -			return ret;
    -	}
    -
    -	// Stream Footer. We have already reserved space for this.
    -	if (lzma_stream_footer_encode(&stream_flags, out + out_pos)
    -			!= LZMA_OK)
    -		return LZMA_PROG_ERROR;
    -
    -	out_pos += LZMA_STREAM_HEADER_SIZE;
    -
    -	// Everything went fine, make the new output position available
    -	// to the application.
    -	*out_pos_ptr = out_pos;
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/stream_decoder.c
    deleted file mode 100644
    index 3ab938c9f..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_decoder.c
    +++ /dev/null
    @@ -1,462 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_decoder.c
    -/// \brief      Decodes .xz Streams
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "stream_decoder.h"
    -#include "block_decoder.h"
    -
    -
    -struct lzma_coder_s {
    -	enum {
    -		SEQ_STREAM_HEADER,
    -		SEQ_BLOCK_HEADER,
    -		SEQ_BLOCK,
    -		SEQ_INDEX,
    -		SEQ_STREAM_FOOTER,
    -		SEQ_STREAM_PADDING,
    -	} sequence;
    -
    -	/// Block or Metadata decoder. This takes little memory and the same
    -	/// data structure can be used to decode every Block Header, so it's
    -	/// a good idea to have a separate lzma_next_coder structure for it.
    -	lzma_next_coder block_decoder;
    -
    -	/// Block options decoded by the Block Header decoder and used by
    -	/// the Block decoder.
    -	lzma_block block_options;
    -
    -	/// Stream Flags from Stream Header
    -	lzma_stream_flags stream_flags;
    -
    -	/// Index is hashed so that it can be compared to the sizes of Blocks
    -	/// with O(1) memory usage.
    -	lzma_index_hash *index_hash;
    -
    -	/// Memory usage limit
    -	uint64_t memlimit;
    -
    -	/// Amount of memory actually needed (only an estimate)
    -	uint64_t memusage;
    -
    -	/// If true, LZMA_NO_CHECK is returned if the Stream has
    -	/// no integrity check.
    -	bool tell_no_check;
    -
    -	/// If true, LZMA_UNSUPPORTED_CHECK is returned if the Stream has
    -	/// an integrity check that isn't supported by this liblzma build.
    -	bool tell_unsupported_check;
    -
    -	/// If true, LZMA_GET_CHECK is returned after decoding Stream Header.
    -	bool tell_any_check;
    -
    -	/// If true, we will tell the Block decoder to skip calculating
    -	/// and verifying the integrity check.
    -	bool ignore_check;
    -
    -	/// If true, we will decode concatenated Streams that possibly have
    -	/// Stream Padding between or after them. LZMA_STREAM_END is returned
    -	/// once the application isn't giving us any new input, and we aren't
    -	/// in the middle of a Stream, and possible Stream Padding is a
    -	/// multiple of four bytes.
    -	bool concatenated;
    -
    -	/// When decoding concatenated Streams, this is true as long as we
    -	/// are decoding the first Stream. This is needed to avoid misleading
    -	/// LZMA_FORMAT_ERROR in case the later Streams don't have valid magic
    -	/// bytes.
    -	bool first_stream;
    -
    -	/// Write position in buffer[] and position in Stream Padding
    -	size_t pos;
    -
    -	/// Buffer to hold Stream Header, Block Header, and Stream Footer.
    -	/// Block Header has biggest maximum size.
    -	uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX];
    -};
    -
    -
    -static lzma_ret
    -stream_decoder_reset(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	// Initialize the Index hash used to verify the Index.
    -	coder->index_hash = lzma_index_hash_init(coder->index_hash, allocator);
    -	if (coder->index_hash == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	// Reset the rest of the variables.
    -	coder->sequence = SEQ_STREAM_HEADER;
    -	coder->pos = 0;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static lzma_ret
    -stream_decode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	// When decoding the actual Block, it may be able to produce more
    -	// output even if we don't give it any new input.
    -	while (true)
    -	switch (coder->sequence) {
    -	case SEQ_STREAM_HEADER: {
    -		// Copy the Stream Header to the internal buffer.
    -		lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos,
    -				LZMA_STREAM_HEADER_SIZE);
    -
    -		// Return if we didn't get the whole Stream Header yet.
    -		if (coder->pos < LZMA_STREAM_HEADER_SIZE)
    -			return LZMA_OK;
    -
    -		coder->pos = 0;
    -
    -		// Decode the Stream Header.
    -		const lzma_ret ret = lzma_stream_header_decode(
    -				&coder->stream_flags, coder->buffer);
    -		if (ret != LZMA_OK)
    -			return ret == LZMA_FORMAT_ERROR && !coder->first_stream
    -					? LZMA_DATA_ERROR : ret;
    -
    -		// If we are decoding concatenated Streams, and the later
    -		// Streams have invalid Header Magic Bytes, we give
    -		// LZMA_DATA_ERROR instead of LZMA_FORMAT_ERROR.
    -		coder->first_stream = false;
    -
    -		// Copy the type of the Check so that Block Header and Block
    -		// decoders see it.
    -		coder->block_options.check = coder->stream_flags.check;
    -
    -		// Even if we return LZMA_*_CHECK below, we want
    -		// to continue from Block Header decoding.
    -		coder->sequence = SEQ_BLOCK_HEADER;
    -
    -		// Detect if there's no integrity check or if it is
    -		// unsupported if those were requested by the application.
    -		if (coder->tell_no_check && coder->stream_flags.check
    -				== LZMA_CHECK_NONE)
    -			return LZMA_NO_CHECK;
    -
    -		if (coder->tell_unsupported_check
    -				&& !lzma_check_is_supported(
    -					coder->stream_flags.check))
    -			return LZMA_UNSUPPORTED_CHECK;
    -
    -		if (coder->tell_any_check)
    -			return LZMA_GET_CHECK;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_BLOCK_HEADER: {
    -		if (*in_pos >= in_size)
    -			return LZMA_OK;
    -
    -		if (coder->pos == 0) {
    -			// Detect if it's Index.
    -			if (in[*in_pos] == 0x00) {
    -				coder->sequence = SEQ_INDEX;
    -				break;
    -			}
    -
    -			// Calculate the size of the Block Header. Note that
    -			// Block Header decoder wants to see this byte too
    -			// so don't advance *in_pos.
    -			coder->block_options.header_size
    -					= lzma_block_header_size_decode(
    -						in[*in_pos]);
    -		}
    -
    -		// Copy the Block Header to the internal buffer.
    -		lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos,
    -				coder->block_options.header_size);
    -
    -		// Return if we didn't get the whole Block Header yet.
    -		if (coder->pos < coder->block_options.header_size)
    -			return LZMA_OK;
    -
    -		coder->pos = 0;
    -
    -		// Version 1 is needed to support the .ignore_check option.
    -		coder->block_options.version = 1;
    -
    -		// Set up a buffer to hold the filter chain. Block Header
    -		// decoder will initialize all members of this array so
    -		// we don't need to do it here.
    -		lzma_filter filters[LZMA_FILTERS_MAX + 1];
    -		coder->block_options.filters = filters;
    -
    -		// Decode the Block Header.
    -		return_if_error(lzma_block_header_decode(&coder->block_options,
    -				allocator, coder->buffer));
    -
    -		// If LZMA_IGNORE_CHECK was used, this flag needs to be set.
    -		// It has to be set after lzma_block_header_decode() because
    -		// it always resets this to false.
    -		coder->block_options.ignore_check = coder->ignore_check;
    -
    -		// Check the memory usage limit.
    -		const uint64_t memusage = lzma_raw_decoder_memusage(filters);
    -		lzma_ret ret;
    -
    -		if (memusage == UINT64_MAX) {
    -			// One or more unknown Filter IDs.
    -			ret = LZMA_OPTIONS_ERROR;
    -		} else {
    -			// Now we can set coder->memusage since we know that
    -			// the filter chain is valid. We don't want
    -			// lzma_memusage() to return UINT64_MAX in case of
    -			// invalid filter chain.
    -			coder->memusage = memusage;
    -
    -			if (memusage > coder->memlimit) {
    -				// The chain would need too much memory.
    -				ret = LZMA_MEMLIMIT_ERROR;
    -			} else {
    -				// Memory usage is OK.
    -				// Initialize the Block decoder.
    -				ret = lzma_block_decoder_init(
    -						&coder->block_decoder,
    -						allocator,
    -						&coder->block_options);
    -			}
    -		}
    -
    -		// Free the allocated filter options since they are needed
    -		// only to initialize the Block decoder.
    -		for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i)
    -			lzma_free(filters[i].options, allocator);
    -
    -		coder->block_options.filters = NULL;
    -
    -		// Check if memory usage calculation and Block enocoder
    -		// initialization succeeded.
    -		if (ret != LZMA_OK)
    -			return ret;
    -
    -		coder->sequence = SEQ_BLOCK;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_BLOCK: {
    -		const lzma_ret ret = coder->block_decoder.code(
    -				coder->block_decoder.coder, allocator,
    -				in, in_pos, in_size, out, out_pos, out_size,
    -				action);
    -
    -		if (ret != LZMA_STREAM_END)
    -			return ret;
    -
    -		// Block decoded successfully. Add the new size pair to
    -		// the Index hash.
    -		return_if_error(lzma_index_hash_append(coder->index_hash,
    -				lzma_block_unpadded_size(
    -					&coder->block_options),
    -				coder->block_options.uncompressed_size));
    -
    -		coder->sequence = SEQ_BLOCK_HEADER;
    -		break;
    -	}
    -
    -	case SEQ_INDEX: {
    -		// If we don't have any input, don't call
    -		// lzma_index_hash_decode() since it would return
    -		// LZMA_BUF_ERROR, which we must not do here.
    -		if (*in_pos >= in_size)
    -			return LZMA_OK;
    -
    -		// Decode the Index and compare it to the hash calculated
    -		// from the sizes of the Blocks (if any).
    -		const lzma_ret ret = lzma_index_hash_decode(coder->index_hash,
    -				in, in_pos, in_size);
    -		if (ret != LZMA_STREAM_END)
    -			return ret;
    -
    -		coder->sequence = SEQ_STREAM_FOOTER;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_STREAM_FOOTER: {
    -		// Copy the Stream Footer to the internal buffer.
    -		lzma_bufcpy(in, in_pos, in_size, coder->buffer, &coder->pos,
    -				LZMA_STREAM_HEADER_SIZE);
    -
    -		// Return if we didn't get the whole Stream Footer yet.
    -		if (coder->pos < LZMA_STREAM_HEADER_SIZE)
    -			return LZMA_OK;
    -
    -		coder->pos = 0;
    -
    -		// Decode the Stream Footer. The decoder gives
    -		// LZMA_FORMAT_ERROR if the magic bytes don't match,
    -		// so convert that return code to LZMA_DATA_ERROR.
    -		lzma_stream_flags footer_flags;
    -		const lzma_ret ret = lzma_stream_footer_decode(
    -				&footer_flags, coder->buffer);
    -		if (ret != LZMA_OK)
    -			return ret == LZMA_FORMAT_ERROR
    -					? LZMA_DATA_ERROR : ret;
    -
    -		// Check that Index Size stored in the Stream Footer matches
    -		// the real size of the Index field.
    -		if (lzma_index_hash_size(coder->index_hash)
    -				!= footer_flags.backward_size)
    -			return LZMA_DATA_ERROR;
    -
    -		// Compare that the Stream Flags fields are identical in
    -		// both Stream Header and Stream Footer.
    -		return_if_error(lzma_stream_flags_compare(
    -				&coder->stream_flags, &footer_flags));
    -
    -		if (!coder->concatenated)
    -			return LZMA_STREAM_END;
    -
    -		coder->sequence = SEQ_STREAM_PADDING;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_STREAM_PADDING:
    -		assert(coder->concatenated);
    -
    -		// Skip over possible Stream Padding.
    -		while (true) {
    -			if (*in_pos >= in_size) {
    -				// Unless LZMA_FINISH was used, we cannot
    -				// know if there's more input coming later.
    -				if (action != LZMA_FINISH)
    -					return LZMA_OK;
    -
    -				// Stream Padding must be a multiple of
    -				// four bytes.
    -				return coder->pos == 0
    -						? LZMA_STREAM_END
    -						: LZMA_DATA_ERROR;
    -			}
    -
    -			// If the byte is not zero, it probably indicates
    -			// beginning of a new Stream (or the file is corrupt).
    -			if (in[*in_pos] != 0x00)
    -				break;
    -
    -			++*in_pos;
    -			coder->pos = (coder->pos + 1) & 3;
    -		}
    -
    -		// Stream Padding must be a multiple of four bytes (empty
    -		// Stream Padding is OK).
    -		if (coder->pos != 0) {
    -			++*in_pos;
    -			return LZMA_DATA_ERROR;
    -		}
    -
    -		// Prepare to decode the next Stream.
    -		return_if_error(stream_decoder_reset(coder, allocator));
    -		break;
    -
    -	default:
    -		assert(0);
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	// Never reached
    -}
    -
    -
    -static void
    -stream_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->block_decoder, allocator);
    -	lzma_index_hash_end(coder->index_hash, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_check
    -stream_decoder_get_check(const lzma_coder *coder)
    -{
    -	return coder->stream_flags.check;
    -}
    -
    -
    -static lzma_ret
    -stream_decoder_memconfig(lzma_coder *coder, uint64_t *memusage,
    -		uint64_t *old_memlimit, uint64_t new_memlimit)
    -{
    -	*memusage = coder->memusage;
    -	*old_memlimit = coder->memlimit;
    -
    -	if (new_memlimit != 0) {
    -		if (new_memlimit < coder->memusage)
    -			return LZMA_MEMLIMIT_ERROR;
    -
    -		coder->memlimit = new_memlimit;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern lzma_ret
    -lzma_stream_decoder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		uint64_t memlimit, uint32_t flags)
    -{
    -	lzma_next_coder_init(&lzma_stream_decoder_init, next, allocator);
    -
    -	if (memlimit == 0)
    -		return LZMA_PROG_ERROR;
    -
    -	if (flags & ~LZMA_SUPPORTED_FLAGS)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &stream_decode;
    -		next->end = &stream_decoder_end;
    -		next->get_check = &stream_decoder_get_check;
    -		next->memconfig = &stream_decoder_memconfig;
    -
    -		next->coder->block_decoder = LZMA_NEXT_CODER_INIT;
    -		next->coder->index_hash = NULL;
    -	}
    -
    -	next->coder->memlimit = memlimit;
    -	next->coder->memusage = LZMA_MEMUSAGE_BASE;
    -	next->coder->tell_no_check = (flags & LZMA_TELL_NO_CHECK) != 0;
    -	next->coder->tell_unsupported_check
    -			= (flags & LZMA_TELL_UNSUPPORTED_CHECK) != 0;
    -	next->coder->tell_any_check = (flags & LZMA_TELL_ANY_CHECK) != 0;
    -	next->coder->ignore_check = (flags & LZMA_IGNORE_CHECK) != 0;
    -	next->coder->concatenated = (flags & LZMA_CONCATENATED) != 0;
    -	next->coder->first_stream = true;
    -
    -	return stream_decoder_reset(next->coder, allocator);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_decoder(lzma_stream *strm, uint64_t memlimit, uint32_t flags)
    -{
    -	lzma_next_strm_init(lzma_stream_decoder_init, strm, memlimit, flags);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_decoder.h b/external/public-domain/xz/dist/src/liblzma/common/stream_decoder.h
    deleted file mode 100644
    index c13c6ba12..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_decoder.h
    +++ /dev/null
    @@ -1,22 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_decoder.h
    -/// \brief      Decodes .xz Streams
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_STREAM_DECODER_H
    -#define LZMA_STREAM_DECODER_H
    -
    -#include "common.h"
    -
    -extern lzma_ret lzma_stream_decoder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		uint64_t memlimit, uint32_t flags);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/stream_encoder.c
    deleted file mode 100644
    index a7663bc48..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_encoder.c
    +++ /dev/null
    @@ -1,332 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_encoder.c
    -/// \brief      Encodes .xz Streams
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "block_encoder.h"
    -#include "index_encoder.h"
    -
    -
    -struct lzma_coder_s {
    -	enum {
    -		SEQ_STREAM_HEADER,
    -		SEQ_BLOCK_INIT,
    -		SEQ_BLOCK_HEADER,
    -		SEQ_BLOCK_ENCODE,
    -		SEQ_INDEX_ENCODE,
    -		SEQ_STREAM_FOOTER,
    -	} sequence;
    -
    -	/// True if Block encoder has been initialized by
    -	/// stream_encoder_init() or stream_encoder_update()
    -	/// and thus doesn't need to be initialized in stream_encode().
    -	bool block_encoder_is_initialized;
    -
    -	/// Block
    -	lzma_next_coder block_encoder;
    -
    -	/// Options for the Block encoder
    -	lzma_block block_options;
    -
    -	/// The filter chain currently in use
    -	lzma_filter filters[LZMA_FILTERS_MAX + 1];
    -
    -	/// Index encoder. This is separate from Block encoder, because this
    -	/// doesn't take much memory, and when encoding multiple Streams
    -	/// with the same encoding options we avoid reallocating memory.
    -	lzma_next_coder index_encoder;
    -
    -	/// Index to hold sizes of the Blocks
    -	lzma_index *index;
    -
    -	/// Read position in buffer[]
    -	size_t buffer_pos;
    -
    -	/// Total number of bytes in buffer[]
    -	size_t buffer_size;
    -
    -	/// Buffer to hold Stream Header, Block Header, and Stream Footer.
    -	/// Block Header has biggest maximum size.
    -	uint8_t buffer[LZMA_BLOCK_HEADER_SIZE_MAX];
    -};
    -
    -
    -static lzma_ret
    -block_encoder_init(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	// Prepare the Block options. Even though Block encoder doesn't need
    -	// compressed_size, uncompressed_size, and header_size to be
    -	// initialized, it is a good idea to do it here, because this way
    -	// we catch if someone gave us Filter ID that cannot be used in
    -	// Blocks/Streams.
    -	coder->block_options.compressed_size = LZMA_VLI_UNKNOWN;
    -	coder->block_options.uncompressed_size = LZMA_VLI_UNKNOWN;
    -
    -	return_if_error(lzma_block_header_size(&coder->block_options));
    -
    -	// Initialize the actual Block encoder.
    -	return lzma_block_encoder_init(&coder->block_encoder, allocator,
    -			&coder->block_options);
    -}
    -
    -
    -static lzma_ret
    -stream_encode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	// Main loop
    -	while (*out_pos < out_size)
    -	switch (coder->sequence) {
    -	case SEQ_STREAM_HEADER:
    -	case SEQ_BLOCK_HEADER:
    -	case SEQ_STREAM_FOOTER:
    -		lzma_bufcpy(coder->buffer, &coder->buffer_pos,
    -				coder->buffer_size, out, out_pos, out_size);
    -		if (coder->buffer_pos < coder->buffer_size)
    -			return LZMA_OK;
    -
    -		if (coder->sequence == SEQ_STREAM_FOOTER)
    -			return LZMA_STREAM_END;
    -
    -		coder->buffer_pos = 0;
    -		++coder->sequence;
    -		break;
    -
    -	case SEQ_BLOCK_INIT: {
    -		if (*in_pos == in_size) {
    -			// If we are requested to flush or finish the current
    -			// Block, return LZMA_STREAM_END immediately since
    -			// there's nothing to do.
    -			if (action != LZMA_FINISH)
    -				return action == LZMA_RUN
    -						? LZMA_OK : LZMA_STREAM_END;
    -
    -			// The application had used LZMA_FULL_FLUSH to finish
    -			// the previous Block, but now wants to finish without
    -			// encoding new data, or it is simply creating an
    -			// empty Stream with no Blocks.
    -			//
    -			// Initialize the Index encoder, and continue to
    -			// actually encoding the Index.
    -			return_if_error(lzma_index_encoder_init(
    -					&coder->index_encoder, allocator,
    -					coder->index));
    -			coder->sequence = SEQ_INDEX_ENCODE;
    -			break;
    -		}
    -
    -		// Initialize the Block encoder unless it was already
    -		// initialized by stream_encoder_init() or
    -		// stream_encoder_update().
    -		if (!coder->block_encoder_is_initialized)
    -			return_if_error(block_encoder_init(coder, allocator));
    -
    -		// Make it false so that we don't skip the initialization
    -		// with the next Block.
    -		coder->block_encoder_is_initialized = false;
    -
    -		// Encode the Block Header. This shouldn't fail since we have
    -		// already initialized the Block encoder.
    -		if (lzma_block_header_encode(&coder->block_options,
    -				coder->buffer) != LZMA_OK)
    -			return LZMA_PROG_ERROR;
    -
    -		coder->buffer_size = coder->block_options.header_size;
    -		coder->sequence = SEQ_BLOCK_HEADER;
    -		break;
    -	}
    -
    -	case SEQ_BLOCK_ENCODE: {
    -		static const lzma_action convert[LZMA_ACTION_MAX + 1] = {
    -			LZMA_RUN,
    -			LZMA_SYNC_FLUSH,
    -			LZMA_FINISH,
    -			LZMA_FINISH,
    -			LZMA_FINISH,
    -		};
    -
    -		const lzma_ret ret = coder->block_encoder.code(
    -				coder->block_encoder.coder, allocator,
    -				in, in_pos, in_size,
    -				out, out_pos, out_size, convert[action]);
    -		if (ret != LZMA_STREAM_END || action == LZMA_SYNC_FLUSH)
    -			return ret;
    -
    -		// Add a new Index Record.
    -		const lzma_vli unpadded_size = lzma_block_unpadded_size(
    -				&coder->block_options);
    -		assert(unpadded_size != 0);
    -		return_if_error(lzma_index_append(coder->index, allocator,
    -				unpadded_size,
    -				coder->block_options.uncompressed_size));
    -
    -		coder->sequence = SEQ_BLOCK_INIT;
    -		break;
    -	}
    -
    -	case SEQ_INDEX_ENCODE: {
    -		// Call the Index encoder. It doesn't take any input, so
    -		// those pointers can be NULL.
    -		const lzma_ret ret = coder->index_encoder.code(
    -				coder->index_encoder.coder, allocator,
    -				NULL, NULL, 0,
    -				out, out_pos, out_size, LZMA_RUN);
    -		if (ret != LZMA_STREAM_END)
    -			return ret;
    -
    -		// Encode the Stream Footer into coder->buffer.
    -		const lzma_stream_flags stream_flags = {
    -			.version = 0,
    -			.backward_size = lzma_index_size(coder->index),
    -			.check = coder->block_options.check,
    -		};
    -
    -		if (lzma_stream_footer_encode(&stream_flags, coder->buffer)
    -				!= LZMA_OK)
    -			return LZMA_PROG_ERROR;
    -
    -		coder->buffer_size = LZMA_STREAM_HEADER_SIZE;
    -		coder->sequence = SEQ_STREAM_FOOTER;
    -		break;
    -	}
    -
    -	default:
    -		assert(0);
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static void
    -stream_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->block_encoder, allocator);
    -	lzma_next_end(&coder->index_encoder, allocator);
    -	lzma_index_end(coder->index, allocator);
    -
    -	for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
    -		lzma_free(coder->filters[i].options, allocator);
    -
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_ret
    -stream_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
    -		const lzma_filter *filters,
    -		const lzma_filter *reversed_filters)
    -{
    -	if (coder->sequence <= SEQ_BLOCK_INIT) {
    -		// There is no incomplete Block waiting to be finished,
    -		// thus we can change the whole filter chain. Start by
    -		// trying to initialize the Block encoder with the new
    -		// chain. This way we detect if the chain is valid.
    -		coder->block_encoder_is_initialized = false;
    -		coder->block_options.filters = (lzma_filter *)(filters);
    -		const lzma_ret ret = block_encoder_init(coder, allocator);
    -		coder->block_options.filters = coder->filters;
    -		if (ret != LZMA_OK)
    -			return ret;
    -
    -		coder->block_encoder_is_initialized = true;
    -
    -	} else if (coder->sequence <= SEQ_BLOCK_ENCODE) {
    -		// We are in the middle of a Block. Try to update only
    -		// the filter-specific options.
    -		return_if_error(coder->block_encoder.update(
    -				coder->block_encoder.coder, allocator,
    -				filters, reversed_filters));
    -	} else {
    -		// Trying to update the filter chain when we are already
    -		// encoding Index or Stream Footer.
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	// Free the copy of the old chain and make a copy of the new chain.
    -	for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
    -		lzma_free(coder->filters[i].options, allocator);
    -
    -	return lzma_filters_copy(filters, coder->filters, allocator);
    -}
    -
    -
    -static lzma_ret
    -stream_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter *filters, lzma_check check)
    -{
    -	lzma_next_coder_init(&stream_encoder_init, next, allocator);
    -
    -	if (filters == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &stream_encode;
    -		next->end = &stream_encoder_end;
    -		next->update = &stream_encoder_update;
    -
    -		next->coder->filters[0].id = LZMA_VLI_UNKNOWN;
    -		next->coder->block_encoder = LZMA_NEXT_CODER_INIT;
    -		next->coder->index_encoder = LZMA_NEXT_CODER_INIT;
    -		next->coder->index = NULL;
    -	}
    -
    -	// Basic initializations
    -	next->coder->sequence = SEQ_STREAM_HEADER;
    -	next->coder->block_options.version = 0;
    -	next->coder->block_options.check = check;
    -
    -	// Initialize the Index
    -	lzma_index_end(next->coder->index, allocator);
    -	next->coder->index = lzma_index_init(allocator);
    -	if (next->coder->index == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	// Encode the Stream Header
    -	lzma_stream_flags stream_flags = {
    -		.version = 0,
    -		.check = check,
    -	};
    -	return_if_error(lzma_stream_header_encode(
    -			&stream_flags, next->coder->buffer));
    -
    -	next->coder->buffer_pos = 0;
    -	next->coder->buffer_size = LZMA_STREAM_HEADER_SIZE;
    -
    -	// Initialize the Block encoder. This way we detect unsupported
    -	// filter chains when initializing the Stream encoder instead of
    -	// giving an error after Stream Header has already written out.
    -	return stream_encoder_update(
    -			next->coder, allocator, filters, NULL);
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_encoder(lzma_stream *strm,
    -		const lzma_filter *filters, lzma_check check)
    -{
    -	lzma_next_strm_init(stream_encoder_init, strm, filters, check);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -	strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
    -	strm->internal->supported_actions[LZMA_FULL_FLUSH] = true;
    -	strm->internal->supported_actions[LZMA_FULL_BARRIER] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_encoder_mt.c b/external/public-domain/xz/dist/src/liblzma/common/stream_encoder_mt.c
    deleted file mode 100644
    index 9780ed04c..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_encoder_mt.c
    +++ /dev/null
    @@ -1,1131 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_encoder_mt.c
    -/// \brief      Multithreaded .xz Stream encoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "filter_encoder.h"
    -#include "easy_preset.h"
    -#include "block_encoder.h"
    -#include "block_buffer_encoder.h"
    -#include "index_encoder.h"
    -#include "outqueue.h"
    -
    -
    -/// Maximum supported block size. This makes it simpler to prevent integer
    -/// overflows if we are given unusually large block size.
    -#define BLOCK_SIZE_MAX (UINT64_MAX / LZMA_THREADS_MAX)
    -
    -
    -typedef enum {
    -	/// Waiting for work.
    -	THR_IDLE,
    -
    -	/// Encoding is in progress.
    -	THR_RUN,
    -
    -	/// Encoding is in progress but no more input data will
    -	/// be read.
    -	THR_FINISH,
    -
    -	/// The main thread wants the thread to stop whatever it was doing
    -	/// but not exit.
    -	THR_STOP,
    -
    -	/// The main thread wants the thread to exit. We could use
    -	/// cancellation but since there's stopped anyway, this is lazier.
    -	THR_EXIT,
    -
    -} worker_state;
    -
    -
    -typedef struct worker_thread_s worker_thread;
    -struct worker_thread_s {
    -	worker_state state;
    -
    -	/// Input buffer of coder->block_size bytes. The main thread will
    -	/// put new input into this and update in_size accordingly. Once
    -	/// no more input is coming, state will be set to THR_FINISH.
    -	uint8_t *in;
    -
    -	/// Amount of data available in the input buffer. This is modified
    -	/// only by the main thread.
    -	size_t in_size;
    -
    -	/// Output buffer for this thread. This is set by the main
    -	/// thread every time a new Block is started with this thread
    -	/// structure.
    -	lzma_outbuf *outbuf;
    -
    -	/// Pointer to the main structure is needed when putting this
    -	/// thread back to the stack of free threads.
    -	lzma_coder *coder;
    -
    -	/// The allocator is set by the main thread. Since a copy of the
    -	/// pointer is kept here, the application must not change the
    -	/// allocator before calling lzma_end().
    -	const lzma_allocator *allocator;
    -
    -	/// Amount of uncompressed data that has already been compressed.
    -	uint64_t progress_in;
    -
    -	/// Amount of compressed data that is ready.
    -	uint64_t progress_out;
    -
    -	/// Block encoder
    -	lzma_next_coder block_encoder;
    -
    -	/// Compression options for this Block
    -	lzma_block block_options;
    -
    -	/// Next structure in the stack of free worker threads.
    -	worker_thread *next;
    -
    -	mythread_mutex mutex;
    -	mythread_cond cond;
    -
    -	/// The ID of this thread is used to join the thread
    -	/// when it's not needed anymore.
    -	mythread thread_id;
    -};
    -
    -
    -struct lzma_coder_s {
    -	enum {
    -		SEQ_STREAM_HEADER,
    -		SEQ_BLOCK,
    -		SEQ_INDEX,
    -		SEQ_STREAM_FOOTER,
    -	} sequence;
    -
    -	/// Start a new Block every block_size bytes of input unless
    -	/// LZMA_FULL_FLUSH or LZMA_FULL_BARRIER is used earlier.
    -	size_t block_size;
    -
    -	/// The filter chain currently in use
    -	lzma_filter filters[LZMA_FILTERS_MAX + 1];
    -
    -
    -	/// Index to hold sizes of the Blocks
    -	lzma_index *index;
    -
    -	/// Index encoder
    -	lzma_next_coder index_encoder;
    -
    -
    -	/// Stream Flags for encoding the Stream Header and Stream Footer.
    -	lzma_stream_flags stream_flags;
    -
    -	/// Buffer to hold Stream Header and Stream Footer.
    -	uint8_t header[LZMA_STREAM_HEADER_SIZE];
    -
    -	/// Read position in header[]
    -	size_t header_pos;
    -
    -
    -	/// Output buffer queue for compressed data
    -	lzma_outq outq;
    -
    -
    -	/// Maximum wait time if cannot use all the input and cannot
    -	/// fill the output buffer. This is in milliseconds.
    -	uint32_t timeout;
    -
    -
    -	/// Error code from a worker thread
    -	lzma_ret thread_error;
    -
    -	/// Array of allocated thread-specific structures
    -	worker_thread *threads;
    -
    -	/// Number of structures in "threads" above. This is also the
    -	/// number of threads that will be created at maximum.
    -	uint32_t threads_max;
    -
    -	/// Number of thread structures that have been initialized, and
    -	/// thus the number of worker threads actually created so far.
    -	uint32_t threads_initialized;
    -
    -	/// Stack of free threads. When a thread finishes, it puts itself
    -	/// back into this stack. This starts as empty because threads
    -	/// are created only when actually needed.
    -	worker_thread *threads_free;
    -
    -	/// The most recent worker thread to which the main thread writes
    -	/// the new input from the application.
    -	worker_thread *thr;
    -
    -
    -	/// Amount of uncompressed data in Blocks that have already
    -	/// been finished.
    -	uint64_t progress_in;
    -
    -	/// Amount of compressed data in Stream Header + Blocks that
    -	/// have already been finished.
    -	uint64_t progress_out;
    -
    -
    -	mythread_mutex mutex;
    -	mythread_cond cond;
    -};
    -
    -
    -/// Tell the main thread that something has gone wrong.
    -static void
    -worker_error(worker_thread *thr, lzma_ret ret)
    -{
    -	assert(ret != LZMA_OK);
    -	assert(ret != LZMA_STREAM_END);
    -
    -	mythread_sync(thr->coder->mutex) {
    -		if (thr->coder->thread_error == LZMA_OK)
    -			thr->coder->thread_error = ret;
    -
    -		mythread_cond_signal(&thr->coder->cond);
    -	}
    -
    -	return;
    -}
    -
    -
    -static worker_state
    -worker_encode(worker_thread *thr, worker_state state)
    -{
    -	assert(thr->progress_in == 0);
    -	assert(thr->progress_out == 0);
    -
    -	// Set the Block options.
    -	thr->block_options = (lzma_block){
    -		.version = 0,
    -		.check = thr->coder->stream_flags.check,
    -		.compressed_size = thr->coder->outq.buf_size_max,
    -		.uncompressed_size = thr->coder->block_size,
    -
    -		// TODO: To allow changing the filter chain, the filters
    -		// array must be copied to each worker_thread.
    -		.filters = thr->coder->filters,
    -	};
    -
    -	// Calculate maximum size of the Block Header. This amount is
    -	// reserved in the beginning of the buffer so that Block Header
    -	// along with Compressed Size and Uncompressed Size can be
    -	// written there.
    -	lzma_ret ret = lzma_block_header_size(&thr->block_options);
    -	if (ret != LZMA_OK) {
    -		worker_error(thr, ret);
    -		return THR_STOP;
    -	}
    -
    -	// Initialize the Block encoder.
    -	ret = lzma_block_encoder_init(&thr->block_encoder,
    -			thr->allocator, &thr->block_options);
    -	if (ret != LZMA_OK) {
    -		worker_error(thr, ret);
    -		return THR_STOP;
    -	}
    -
    -	size_t in_pos = 0;
    -	size_t in_size = 0;
    -
    -	thr->outbuf->size = thr->block_options.header_size;
    -	const size_t out_size = thr->coder->outq.buf_size_max;
    -
    -	do {
    -		mythread_sync(thr->mutex) {
    -			// Store in_pos and out_pos into *thr so that
    -			// an application may read them via
    -			// lzma_get_progress() to get progress information.
    -			//
    -			// NOTE: These aren't updated when the encoding
    -			// finishes. Instead, the final values are taken
    -			// later from thr->outbuf.
    -			thr->progress_in = in_pos;
    -			thr->progress_out = thr->outbuf->size;
    -
    -			while (in_size == thr->in_size
    -					&& thr->state == THR_RUN)
    -				mythread_cond_wait(&thr->cond, &thr->mutex);
    -
    -			state = thr->state;
    -			in_size = thr->in_size;
    -		}
    -
    -		// Return if we were asked to stop or exit.
    -		if (state >= THR_STOP)
    -			return state;
    -
    -		lzma_action action = state == THR_FINISH
    -				? LZMA_FINISH : LZMA_RUN;
    -
    -		// Limit the amount of input given to the Block encoder
    -		// at once. This way this thread can react fairly quickly
    -		// if the main thread wants us to stop or exit.
    -		static const size_t in_chunk_max = 16384;
    -		size_t in_limit = in_size;
    -		if (in_size - in_pos > in_chunk_max) {
    -			in_limit = in_pos + in_chunk_max;
    -			action = LZMA_RUN;
    -		}
    -
    -		ret = thr->block_encoder.code(
    -				thr->block_encoder.coder, thr->allocator,
    -				thr->in, &in_pos, in_limit, thr->outbuf->buf,
    -				&thr->outbuf->size, out_size, action);
    -	} while (ret == LZMA_OK && thr->outbuf->size < out_size);
    -
    -	switch (ret) {
    -	case LZMA_STREAM_END:
    -		assert(state == THR_FINISH);
    -
    -		// Encode the Block Header. By doing it after
    -		// the compression, we can store the Compressed Size
    -		// and Uncompressed Size fields.
    -		ret = lzma_block_header_encode(&thr->block_options,
    -				thr->outbuf->buf);
    -		if (ret != LZMA_OK) {
    -			worker_error(thr, ret);
    -			return THR_STOP;
    -		}
    -
    -		break;
    -
    -	case LZMA_OK:
    -		// The data was incompressible. Encode it using uncompressed
    -		// LZMA2 chunks.
    -		//
    -		// First wait that we have gotten all the input.
    -		mythread_sync(thr->mutex) {
    -			while (thr->state == THR_RUN)
    -				mythread_cond_wait(&thr->cond, &thr->mutex);
    -
    -			state = thr->state;
    -			in_size = thr->in_size;
    -		}
    -
    -		if (state >= THR_STOP)
    -			return state;
    -
    -		// Do the encoding. This takes care of the Block Header too.
    -		thr->outbuf->size = 0;
    -		ret = lzma_block_uncomp_encode(&thr->block_options,
    -				thr->in, in_size, thr->outbuf->buf,
    -				&thr->outbuf->size, out_size);
    -
    -		// It shouldn't fail.
    -		if (ret != LZMA_OK) {
    -			worker_error(thr, LZMA_PROG_ERROR);
    -			return THR_STOP;
    -		}
    -
    -		break;
    -
    -	default:
    -		worker_error(thr, ret);
    -		return THR_STOP;
    -	}
    -
    -	// Set the size information that will be read by the main thread
    -	// to write the Index field.
    -	thr->outbuf->unpadded_size
    -			= lzma_block_unpadded_size(&thr->block_options);
    -	assert(thr->outbuf->unpadded_size != 0);
    -	thr->outbuf->uncompressed_size = thr->block_options.uncompressed_size;
    -
    -	return THR_FINISH;
    -}
    -
    -
    -static MYTHREAD_RET_TYPE
    -worker_start(void *thr_ptr)
    -{
    -	worker_thread *thr = thr_ptr;
    -	worker_state state = THR_IDLE; // Init to silence a warning
    -
    -	while (true) {
    -		// Wait for work.
    -		mythread_sync(thr->mutex) {
    -			while (true) {
    -				// The thread is already idle so if we are
    -				// requested to stop, just set the state.
    -				if (thr->state == THR_STOP) {
    -					thr->state = THR_IDLE;
    -					mythread_cond_signal(&thr->cond);
    -				}
    -
    -				state = thr->state;
    -				if (state != THR_IDLE)
    -					break;
    -
    -				mythread_cond_wait(&thr->cond, &thr->mutex);
    -			}
    -		}
    -
    -		assert(state != THR_IDLE);
    -		assert(state != THR_STOP);
    -
    -		if (state <= THR_FINISH)
    -			state = worker_encode(thr, state);
    -
    -		if (state == THR_EXIT)
    -			break;
    -
    -		// Mark the thread as idle unless the main thread has
    -		// told us to exit. Signal is needed for the case
    -		// where the main thread is waiting for the threads to stop.
    -		mythread_sync(thr->mutex) {
    -			if (thr->state != THR_EXIT) {
    -				thr->state = THR_IDLE;
    -				mythread_cond_signal(&thr->cond);
    -			}
    -		}
    -
    -		mythread_sync(thr->coder->mutex) {
    -			// Mark the output buffer as finished if
    -			// no errors occurred.
    -			thr->outbuf->finished = state == THR_FINISH;
    -
    -			// Update the main progress info.
    -			thr->coder->progress_in
    -					+= thr->outbuf->uncompressed_size;
    -			thr->coder->progress_out += thr->outbuf->size;
    -			thr->progress_in = 0;
    -			thr->progress_out = 0;
    -
    -			// Return this thread to the stack of free threads.
    -			thr->next = thr->coder->threads_free;
    -			thr->coder->threads_free = thr;
    -
    -			mythread_cond_signal(&thr->coder->cond);
    -		}
    -	}
    -
    -	// Exiting, free the resources.
    -	mythread_mutex_destroy(&thr->mutex);
    -	mythread_cond_destroy(&thr->cond);
    -
    -	lzma_next_end(&thr->block_encoder, thr->allocator);
    -	lzma_free(thr->in, thr->allocator);
    -	return MYTHREAD_RET_VALUE;
    -}
    -
    -
    -/// Make the threads stop but not exit. Optionally wait for them to stop.
    -static void
    -threads_stop(lzma_coder *coder, bool wait_for_threads)
    -{
    -	// Tell the threads to stop.
    -	for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
    -		mythread_sync(coder->threads[i].mutex) {
    -			coder->threads[i].state = THR_STOP;
    -			mythread_cond_signal(&coder->threads[i].cond);
    -		}
    -	}
    -
    -	if (!wait_for_threads)
    -		return;
    -
    -	// Wait for the threads to settle in the idle state.
    -	for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
    -		mythread_sync(coder->threads[i].mutex) {
    -			while (coder->threads[i].state != THR_IDLE)
    -				mythread_cond_wait(&coder->threads[i].cond,
    -						&coder->threads[i].mutex);
    -		}
    -	}
    -
    -	return;
    -}
    -
    -
    -/// Stop the threads and free the resources associated with them.
    -/// Wait until the threads have exited.
    -static void
    -threads_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
    -		mythread_sync(coder->threads[i].mutex) {
    -			coder->threads[i].state = THR_EXIT;
    -			mythread_cond_signal(&coder->threads[i].cond);
    -		}
    -	}
    -
    -	for (uint32_t i = 0; i < coder->threads_initialized; ++i) {
    -		int ret = mythread_join(coder->threads[i].thread_id);
    -		assert(ret == 0);
    -		(void)ret;
    -	}
    -
    -	lzma_free(coder->threads, allocator);
    -	return;
    -}
    -
    -
    -/// Initialize a new worker_thread structure and create a new thread.
    -static lzma_ret
    -initialize_new_thread(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	worker_thread *thr = &coder->threads[coder->threads_initialized];
    -
    -	thr->in = lzma_alloc(coder->block_size, allocator);
    -	if (thr->in == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	if (mythread_mutex_init(&thr->mutex))
    -		goto error_mutex;
    -
    -	if (mythread_cond_init(&thr->cond))
    -		goto error_cond;
    -
    -	thr->state = THR_IDLE;
    -	thr->allocator = allocator;
    -	thr->coder = coder;
    -	thr->progress_in = 0;
    -	thr->progress_out = 0;
    -	thr->block_encoder = LZMA_NEXT_CODER_INIT;
    -
    -	if (mythread_create(&thr->thread_id, &worker_start, thr))
    -		goto error_thread;
    -
    -	++coder->threads_initialized;
    -	coder->thr = thr;
    -
    -	return LZMA_OK;
    -
    -error_thread:
    -	mythread_cond_destroy(&thr->cond);
    -
    -error_cond:
    -	mythread_mutex_destroy(&thr->mutex);
    -
    -error_mutex:
    -	lzma_free(thr->in, allocator);
    -	return LZMA_MEM_ERROR;
    -}
    -
    -
    -static lzma_ret
    -get_thread(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	// If there are no free output subqueues, there is no
    -	// point to try getting a thread.
    -	if (!lzma_outq_has_buf(&coder->outq))
    -		return LZMA_OK;
    -
    -	// If there is a free structure on the stack, use it.
    -	mythread_sync(coder->mutex) {
    -		if (coder->threads_free != NULL) {
    -			coder->thr = coder->threads_free;
    -			coder->threads_free = coder->threads_free->next;
    -		}
    -	}
    -
    -	if (coder->thr == NULL) {
    -		// If there are no uninitialized structures left, return.
    -		if (coder->threads_initialized == coder->threads_max)
    -			return LZMA_OK;
    -
    -		// Initialize a new thread.
    -		return_if_error(initialize_new_thread(coder, allocator));
    -	}
    -
    -	// Reset the parts of the thread state that have to be done
    -	// in the main thread.
    -	mythread_sync(coder->thr->mutex) {
    -		coder->thr->state = THR_RUN;
    -		coder->thr->in_size = 0;
    -		coder->thr->outbuf = lzma_outq_get_buf(&coder->outq);
    -		mythread_cond_signal(&coder->thr->cond);
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static lzma_ret
    -stream_encode_in(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, lzma_action action)
    -{
    -	while (*in_pos < in_size
    -			|| (coder->thr != NULL && action != LZMA_RUN)) {
    -		if (coder->thr == NULL) {
    -			// Get a new thread.
    -			const lzma_ret ret = get_thread(coder, allocator);
    -			if (coder->thr == NULL)
    -				return ret;
    -		}
    -
    -		// Copy the input data to thread's buffer.
    -		size_t thr_in_size = coder->thr->in_size;
    -		lzma_bufcpy(in, in_pos, in_size, coder->thr->in,
    -				&thr_in_size, coder->block_size);
    -
    -		// Tell the Block encoder to finish if
    -		//  - it has got block_size bytes of input; or
    -		//  - all input was used and LZMA_FINISH, LZMA_FULL_FLUSH,
    -		//    or LZMA_FULL_BARRIER was used.
    -		//
    -		// TODO: LZMA_SYNC_FLUSH and LZMA_SYNC_BARRIER.
    -		const bool finish = thr_in_size == coder->block_size
    -				|| (*in_pos == in_size && action != LZMA_RUN);
    -
    -		bool block_error = false;
    -
    -		mythread_sync(coder->thr->mutex) {
    -			if (coder->thr->state == THR_IDLE) {
    -				// Something has gone wrong with the Block
    -				// encoder. It has set coder->thread_error
    -				// which we will read a few lines later.
    -				block_error = true;
    -			} else {
    -				// Tell the Block encoder its new amount
    -				// of input and update the state if needed.
    -				coder->thr->in_size = thr_in_size;
    -
    -				if (finish)
    -					coder->thr->state = THR_FINISH;
    -
    -				mythread_cond_signal(&coder->thr->cond);
    -			}
    -		}
    -
    -		if (block_error) {
    -			lzma_ret ret;
    -
    -			mythread_sync(coder->mutex) {
    -				ret = coder->thread_error;
    -			}
    -
    -			return ret;
    -		}
    -
    -		if (finish)
    -			coder->thr = NULL;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -/// Wait until more input can be consumed, more output can be read, or
    -/// an optional timeout is reached.
    -static bool
    -wait_for_work(lzma_coder *coder, mythread_condtime *wait_abs,
    -		bool *has_blocked, bool has_input)
    -{
    -	if (coder->timeout != 0 && !*has_blocked) {
    -		// Every time when stream_encode_mt() is called via
    -		// lzma_code(), *has_blocked starts as false. We set it
    -		// to true here and calculate the absolute time when
    -		// we must return if there's nothing to do.
    -		//
    -		// The idea of *has_blocked is to avoid unneeded calls
    -		// to mythread_condtime_set(), which may do a syscall
    -		// depending on the operating system.
    -		*has_blocked = true;
    -		mythread_condtime_set(wait_abs, &coder->cond, coder->timeout);
    -	}
    -
    -	bool timed_out = false;
    -
    -	mythread_sync(coder->mutex) {
    -		// There are four things that we wait. If one of them
    -		// becomes possible, we return.
    -		//  - If there is input left, we need to get a free
    -		//    worker thread and an output buffer for it.
    -		//  - Data ready to be read from the output queue.
    -		//  - A worker thread indicates an error.
    -		//  - Time out occurs.
    -		while ((!has_input || coder->threads_free == NULL
    -					|| !lzma_outq_has_buf(&coder->outq))
    -				&& !lzma_outq_is_readable(&coder->outq)
    -				&& coder->thread_error == LZMA_OK
    -				&& !timed_out) {
    -			if (coder->timeout != 0)
    -				timed_out = mythread_cond_timedwait(
    -						&coder->cond, &coder->mutex,
    -						wait_abs) != 0;
    -			else
    -				mythread_cond_wait(&coder->cond,
    -						&coder->mutex);
    -		}
    -	}
    -
    -	return timed_out;
    -}
    -
    -
    -static lzma_ret
    -stream_encode_mt(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	switch (coder->sequence) {
    -	case SEQ_STREAM_HEADER:
    -		lzma_bufcpy(coder->header, &coder->header_pos,
    -				sizeof(coder->header),
    -				out, out_pos, out_size);
    -		if (coder->header_pos < sizeof(coder->header))
    -			return LZMA_OK;
    -
    -		coder->header_pos = 0;
    -		coder->sequence = SEQ_BLOCK;
    -
    -	// Fall through
    -
    -	case SEQ_BLOCK: {
    -		// Initialized to silence warnings.
    -		lzma_vli unpadded_size = 0;
    -		lzma_vli uncompressed_size = 0;
    -		lzma_ret ret = LZMA_OK;
    -
    -		// These are for wait_for_work().
    -		bool has_blocked = false;
    -		mythread_condtime wait_abs;
    -
    -		while (true) {
    -			mythread_sync(coder->mutex) {
    -				// Check for Block encoder errors.
    -				ret = coder->thread_error;
    -				if (ret != LZMA_OK) {
    -					assert(ret != LZMA_STREAM_END);
    -					break;
    -				}
    -
    -				// Try to read compressed data to out[].
    -				ret = lzma_outq_read(&coder->outq,
    -						out, out_pos, out_size,
    -						&unpadded_size,
    -						&uncompressed_size);
    -			}
    -
    -			if (ret == LZMA_STREAM_END) {
    -				// End of Block. Add it to the Index.
    -				ret = lzma_index_append(coder->index,
    -						allocator, unpadded_size,
    -						uncompressed_size);
    -
    -				// If we didn't fill the output buffer yet,
    -				// try to read more data. Maybe the next
    -				// outbuf has been finished already too.
    -				if (*out_pos < out_size)
    -					continue;
    -			}
    -
    -			if (ret != LZMA_OK) {
    -				// coder->thread_error was set or
    -				// lzma_index_append() failed.
    -				threads_stop(coder, false);
    -				return ret;
    -			}
    -
    -			// Try to give uncompressed data to a worker thread.
    -			ret = stream_encode_in(coder, allocator,
    -					in, in_pos, in_size, action);
    -			if (ret != LZMA_OK) {
    -				threads_stop(coder, false);
    -				return ret;
    -			}
    -
    -			// See if we should wait or return.
    -			//
    -			// TODO: LZMA_SYNC_FLUSH and LZMA_SYNC_BARRIER.
    -			if (*in_pos == in_size) {
    -				// LZMA_RUN: More data is probably coming
    -				// so return to let the caller fill the
    -				// input buffer.
    -				if (action == LZMA_RUN)
    -					return LZMA_OK;
    -
    -				// LZMA_FULL_BARRIER: The same as with
    -				// LZMA_RUN but tell the caller that the
    -				// barrier was completed.
    -				if (action == LZMA_FULL_BARRIER)
    -					return LZMA_STREAM_END;
    -
    -				// Finishing or flushing isn't completed until
    -				// all input data has been encoded and copied
    -				// to the output buffer.
    -				if (lzma_outq_is_empty(&coder->outq)) {
    -					// LZMA_FINISH: Continue to encode
    -					// the Index field.
    -					if (action == LZMA_FINISH)
    -						break;
    -
    -					// LZMA_FULL_FLUSH: Return to tell
    -					// the caller that flushing was
    -					// completed.
    -					if (action == LZMA_FULL_FLUSH)
    -						return LZMA_STREAM_END;
    -				}
    -			}
    -
    -			// Return if there is no output space left.
    -			// This check must be done after testing the input
    -			// buffer, because we might want to use a different
    -			// return code.
    -			if (*out_pos == out_size)
    -				return LZMA_OK;
    -
    -			// Neither in nor out has been used completely.
    -			// Wait until there's something we can do.
    -			if (wait_for_work(coder, &wait_abs, &has_blocked,
    -					*in_pos < in_size))
    -				return LZMA_TIMED_OUT;
    -		}
    -
    -		// All Blocks have been encoded and the threads have stopped.
    -		// Prepare to encode the Index field.
    -		return_if_error(lzma_index_encoder_init(
    -				&coder->index_encoder, allocator,
    -				coder->index));
    -		coder->sequence = SEQ_INDEX;
    -
    -		// Update the progress info to take the Index and
    -		// Stream Footer into account. Those are very fast to encode
    -		// so in terms of progress information they can be thought
    -		// to be ready to be copied out.
    -		coder->progress_out += lzma_index_size(coder->index)
    -				+ LZMA_STREAM_HEADER_SIZE;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_INDEX: {
    -		// Call the Index encoder. It doesn't take any input, so
    -		// those pointers can be NULL.
    -		const lzma_ret ret = coder->index_encoder.code(
    -				coder->index_encoder.coder, allocator,
    -				NULL, NULL, 0,
    -				out, out_pos, out_size, LZMA_RUN);
    -		if (ret != LZMA_STREAM_END)
    -			return ret;
    -
    -		// Encode the Stream Footer into coder->buffer.
    -		coder->stream_flags.backward_size
    -				= lzma_index_size(coder->index);
    -		if (lzma_stream_footer_encode(&coder->stream_flags,
    -				coder->header) != LZMA_OK)
    -			return LZMA_PROG_ERROR;
    -
    -		coder->sequence = SEQ_STREAM_FOOTER;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_STREAM_FOOTER:
    -		lzma_bufcpy(coder->header, &coder->header_pos,
    -				sizeof(coder->header),
    -				out, out_pos, out_size);
    -		return coder->header_pos < sizeof(coder->header)
    -				? LZMA_OK : LZMA_STREAM_END;
    -	}
    -
    -	assert(0);
    -	return LZMA_PROG_ERROR;
    -}
    -
    -
    -static void
    -stream_encoder_mt_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	// Threads must be killed before the output queue can be freed.
    -	threads_end(coder, allocator);
    -	lzma_outq_end(&coder->outq, allocator);
    -
    -	for (size_t i = 0; coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
    -		lzma_free(coder->filters[i].options, allocator);
    -
    -	lzma_next_end(&coder->index_encoder, allocator);
    -	lzma_index_end(coder->index, allocator);
    -
    -	mythread_cond_destroy(&coder->cond);
    -	mythread_mutex_destroy(&coder->mutex);
    -
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -/// Options handling for lzma_stream_encoder_mt_init() and
    -/// lzma_stream_encoder_mt_memusage()
    -static lzma_ret
    -get_options(const lzma_mt *options, lzma_options_easy *opt_easy,
    -		const lzma_filter **filters, uint64_t *block_size,
    -		uint64_t *outbuf_size_max)
    -{
    -	// Validate some of the options.
    -	if (options == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	if (options->flags != 0 || options->threads == 0
    -			|| options->threads > LZMA_THREADS_MAX)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	if (options->filters != NULL) {
    -		// Filter chain was given, use it as is.
    -		*filters = options->filters;
    -	} else {
    -		// Use a preset.
    -		if (lzma_easy_preset(opt_easy, options->preset))
    -			return LZMA_OPTIONS_ERROR;
    -
    -		*filters = opt_easy->filters;
    -	}
    -
    -	// Block size
    -	if (options->block_size > 0) {
    -		if (options->block_size > BLOCK_SIZE_MAX)
    -			return LZMA_OPTIONS_ERROR;
    -
    -		*block_size = options->block_size;
    -	} else {
    -		// Determine the Block size from the filter chain.
    -		*block_size = lzma_mt_block_size(*filters);
    -		if (*block_size == 0)
    -			return LZMA_OPTIONS_ERROR;
    -
    -		assert(*block_size <= BLOCK_SIZE_MAX);
    -	}
    -
    -	// Calculate the maximum amount output that a single output buffer
    -	// may need to hold. This is the same as the maximum total size of
    -	// a Block.
    -	*outbuf_size_max = lzma_block_buffer_bound64(*block_size);
    -	if (*outbuf_size_max == 0)
    -		return LZMA_MEM_ERROR;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static void
    -get_progress(lzma_coder *coder, uint64_t *progress_in, uint64_t *progress_out)
    -{
    -	// Lock coder->mutex to prevent finishing threads from moving their
    -	// progress info from the worker_thread structure to lzma_coder.
    -	mythread_sync(coder->mutex) {
    -		*progress_in = coder->progress_in;
    -		*progress_out = coder->progress_out;
    -
    -		for (size_t i = 0; i < coder->threads_initialized; ++i) {
    -			mythread_sync(coder->threads[i].mutex) {
    -				*progress_in += coder->threads[i].progress_in;
    -				*progress_out += coder->threads[i]
    -						.progress_out;
    -			}
    -		}
    -	}
    -
    -	return;
    -}
    -
    -
    -static lzma_ret
    -stream_encoder_mt_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_mt *options)
    -{
    -	lzma_next_coder_init(&stream_encoder_mt_init, next, allocator);
    -
    -	// Get the filter chain.
    -	lzma_options_easy easy;
    -	const lzma_filter *filters;
    -	uint64_t block_size;
    -	uint64_t outbuf_size_max;
    -	return_if_error(get_options(options, &easy, &filters,
    -			&block_size, &outbuf_size_max));
    -
    -#if SIZE_MAX < UINT64_MAX
    -	if (block_size > SIZE_MAX)
    -		return LZMA_MEM_ERROR;
    -#endif
    -
    -	// Validate the filter chain so that we can give an error in this
    -	// function instead of delaying it to the first call to lzma_code().
    -	// The memory usage calculation verifies the filter chain as
    -	// a side effect so we take advatange of that.
    -	if (lzma_raw_encoder_memusage(filters) == UINT64_MAX)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Validate the Check ID.
    -	if ((unsigned int)(options->check) > LZMA_CHECK_ID_MAX)
    -		return LZMA_PROG_ERROR;
    -
    -	if (!lzma_check_is_supported(options->check))
    -		return LZMA_UNSUPPORTED_CHECK;
    -
    -	// Allocate and initialize the base structure if needed.
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		// For the mutex and condition variable initializations
    -		// the error handling has to be done here because
    -		// stream_encoder_mt_end() doesn't know if they have
    -		// already been initialized or not.
    -		if (mythread_mutex_init(&next->coder->mutex)) {
    -			lzma_free(next->coder, allocator);
    -			next->coder = NULL;
    -			return LZMA_MEM_ERROR;
    -		}
    -
    -		if (mythread_cond_init(&next->coder->cond)) {
    -			mythread_mutex_destroy(&next->coder->mutex);
    -			lzma_free(next->coder, allocator);
    -			next->coder = NULL;
    -			return LZMA_MEM_ERROR;
    -		}
    -
    -		next->code = &stream_encode_mt;
    -		next->end = &stream_encoder_mt_end;
    -		next->get_progress = &get_progress;
    -// 		next->update = &stream_encoder_mt_update;
    -
    -		next->coder->filters[0].id = LZMA_VLI_UNKNOWN;
    -		next->coder->index_encoder = LZMA_NEXT_CODER_INIT;
    -		next->coder->index = NULL;
    -		memzero(&next->coder->outq, sizeof(next->coder->outq));
    -		next->coder->threads = NULL;
    -		next->coder->threads_max = 0;
    -		next->coder->threads_initialized = 0;
    -	}
    -
    -	// Basic initializations
    -	next->coder->sequence = SEQ_STREAM_HEADER;
    -	next->coder->block_size = (size_t)(block_size);
    -	next->coder->thread_error = LZMA_OK;
    -	next->coder->thr = NULL;
    -
    -	// Allocate the thread-specific base structures.
    -	assert(options->threads > 0);
    -	if (next->coder->threads_max != options->threads) {
    -		threads_end(next->coder, allocator);
    -
    -		next->coder->threads = NULL;
    -		next->coder->threads_max = 0;
    -
    -		next->coder->threads_initialized = 0;
    -		next->coder->threads_free = NULL;
    -
    -		next->coder->threads = lzma_alloc(
    -				options->threads * sizeof(worker_thread),
    -				allocator);
    -		if (next->coder->threads == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->coder->threads_max = options->threads;
    -	} else {
    -		// Reuse the old structures and threads. Tell the running
    -		// threads to stop and wait until they have stopped.
    -		threads_stop(next->coder, true);
    -	}
    -
    -	// Output queue
    -	return_if_error(lzma_outq_init(&next->coder->outq, allocator,
    -			outbuf_size_max, options->threads));
    -
    -	// Timeout
    -	next->coder->timeout = options->timeout;
    -
    -	// Free the old filter chain and copy the new one.
    -	for (size_t i = 0; next->coder->filters[i].id != LZMA_VLI_UNKNOWN; ++i)
    -		lzma_free(next->coder->filters[i].options, allocator);
    -
    -	return_if_error(lzma_filters_copy(
    -			filters, next->coder->filters, allocator));
    -
    -	// Index
    -	lzma_index_end(next->coder->index, allocator);
    -	next->coder->index = lzma_index_init(allocator);
    -	if (next->coder->index == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	// Stream Header
    -	next->coder->stream_flags.version = 0;
    -	next->coder->stream_flags.check = options->check;
    -	return_if_error(lzma_stream_header_encode(
    -			&next->coder->stream_flags, next->coder->header));
    -
    -	next->coder->header_pos = 0;
    -
    -	// Progress info
    -	next->coder->progress_in = 0;
    -	next->coder->progress_out = LZMA_STREAM_HEADER_SIZE;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_encoder_mt(lzma_stream *strm, const lzma_mt *options)
    -{
    -	lzma_next_strm_init(stream_encoder_mt_init, strm, options);
    -
    -	strm->internal->supported_actions[LZMA_RUN] = true;
    -// 	strm->internal->supported_actions[LZMA_SYNC_FLUSH] = true;
    -	strm->internal->supported_actions[LZMA_FULL_FLUSH] = true;
    -	strm->internal->supported_actions[LZMA_FULL_BARRIER] = true;
    -	strm->internal->supported_actions[LZMA_FINISH] = true;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -// This function name is a monster but it's consistent with the older
    -// monster names. :-( 31 chars is the max that C99 requires so in that
    -// sense it's not too long. ;-)
    -extern LZMA_API(uint64_t)
    -lzma_stream_encoder_mt_memusage(const lzma_mt *options)
    -{
    -	lzma_options_easy easy;
    -	const lzma_filter *filters;
    -	uint64_t block_size;
    -	uint64_t outbuf_size_max;
    -
    -	if (get_options(options, &easy, &filters, &block_size,
    -			&outbuf_size_max) != LZMA_OK)
    -		return UINT64_MAX;
    -
    -	// Memory usage of the input buffers
    -	const uint64_t inbuf_memusage = options->threads * block_size;
    -
    -	// Memory usage of the filter encoders
    -	uint64_t filters_memusage = lzma_raw_encoder_memusage(filters);
    -	if (filters_memusage == UINT64_MAX)
    -		return UINT64_MAX;
    -
    -	filters_memusage *= options->threads;
    -
    -	// Memory usage of the output queue
    -	const uint64_t outq_memusage = lzma_outq_memusage(
    -			outbuf_size_max, options->threads);
    -	if (outq_memusage == UINT64_MAX)
    -		return UINT64_MAX;
    -
    -	// Sum them with overflow checking.
    -	uint64_t total_memusage = LZMA_MEMUSAGE_BASE + sizeof(lzma_coder)
    -			+ options->threads * sizeof(worker_thread);
    -
    -	if (UINT64_MAX - total_memusage < inbuf_memusage)
    -		return UINT64_MAX;
    -
    -	total_memusage += inbuf_memusage;
    -
    -	if (UINT64_MAX - total_memusage < filters_memusage)
    -		return UINT64_MAX;
    -
    -	total_memusage += filters_memusage;
    -
    -	if (UINT64_MAX - total_memusage < outq_memusage)
    -		return UINT64_MAX;
    -
    -	return total_memusage + outq_memusage;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_flags_common.c b/external/public-domain/xz/dist/src/liblzma/common/stream_flags_common.c
    deleted file mode 100644
    index fbe8eb8ab..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_flags_common.c
    +++ /dev/null
    @@ -1,47 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_flags_common.c
    -/// \brief      Common stuff for Stream flags coders
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "stream_flags_common.h"
    -
    -
    -const uint8_t lzma_header_magic[6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 };
    -const uint8_t lzma_footer_magic[2] = { 0x59, 0x5A };
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_flags_compare(
    -		const lzma_stream_flags *a, const lzma_stream_flags *b)
    -{
    -	// We can compare only version 0 structures.
    -	if (a->version != 0 || b->version != 0)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Check type
    -	if ((unsigned int)(a->check) > LZMA_CHECK_ID_MAX
    -			|| (unsigned int)(b->check) > LZMA_CHECK_ID_MAX)
    -		return LZMA_PROG_ERROR;
    -
    -	if (a->check != b->check)
    -		return LZMA_DATA_ERROR;
    -
    -	// Backward Sizes are compared only if they are known in both.
    -	if (a->backward_size != LZMA_VLI_UNKNOWN
    -			&& b->backward_size != LZMA_VLI_UNKNOWN) {
    -		if (!is_backward_size_valid(a) || !is_backward_size_valid(b))
    -			return LZMA_PROG_ERROR;
    -
    -		if (a->backward_size != b->backward_size)
    -			return LZMA_DATA_ERROR;
    -	}
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_flags_common.h b/external/public-domain/xz/dist/src/liblzma/common/stream_flags_common.h
    deleted file mode 100644
    index 9f3122a3b..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_flags_common.h
    +++ /dev/null
    @@ -1,33 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_flags_common.h
    -/// \brief      Common stuff for Stream flags coders
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_STREAM_FLAGS_COMMON_H
    -#define LZMA_STREAM_FLAGS_COMMON_H
    -
    -#include "common.h"
    -
    -/// Size of the Stream Flags field
    -#define LZMA_STREAM_FLAGS_SIZE 2
    -
    -extern const uint8_t lzma_header_magic[6];
    -extern const uint8_t lzma_footer_magic[2];
    -
    -
    -static inline bool
    -is_backward_size_valid(const lzma_stream_flags *options)
    -{
    -	return options->backward_size >= LZMA_BACKWARD_SIZE_MIN
    -			&& options->backward_size <= LZMA_BACKWARD_SIZE_MAX
    -			&& (options->backward_size & 3) == 0;
    -}
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_flags_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/stream_flags_decoder.c
    deleted file mode 100644
    index 1bc2f97c5..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_flags_decoder.c
    +++ /dev/null
    @@ -1,82 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_flags_decoder.c
    -/// \brief      Decodes Stream Header and Stream Footer from .xz files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "stream_flags_common.h"
    -
    -
    -static bool
    -stream_flags_decode(lzma_stream_flags *options, const uint8_t *in)
    -{
    -	// Reserved bits must be unset.
    -	if (in[0] != 0x00 || (in[1] & 0xF0))
    -		return true;
    -
    -	options->version = 0;
    -	options->check = in[1] & 0x0F;
    -
    -	return false;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_header_decode(lzma_stream_flags *options, const uint8_t *in)
    -{
    -	// Magic
    -	if (memcmp(in, lzma_header_magic, sizeof(lzma_header_magic)) != 0)
    -		return LZMA_FORMAT_ERROR;
    -
    -	// Verify the CRC32 so we can distinguish between corrupt
    -	// and unsupported files.
    -	const uint32_t crc = lzma_crc32(in + sizeof(lzma_header_magic),
    -			LZMA_STREAM_FLAGS_SIZE, 0);
    -	if (crc != unaligned_read32le(in + sizeof(lzma_header_magic)
    -			+ LZMA_STREAM_FLAGS_SIZE))
    -		return LZMA_DATA_ERROR;
    -
    -	// Stream Flags
    -	if (stream_flags_decode(options, in + sizeof(lzma_header_magic)))
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Set Backward Size to indicate unknown value. That way
    -	// lzma_stream_flags_compare() can be used to compare Stream Header
    -	// and Stream Footer while keeping it useful also for comparing
    -	// two Stream Footers.
    -	options->backward_size = LZMA_VLI_UNKNOWN;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_footer_decode(lzma_stream_flags *options, const uint8_t *in)
    -{
    -	// Magic
    -	if (memcmp(in + sizeof(uint32_t) * 2 + LZMA_STREAM_FLAGS_SIZE,
    -			lzma_footer_magic, sizeof(lzma_footer_magic)) != 0)
    -		return LZMA_FORMAT_ERROR;
    -
    -	// CRC32
    -	const uint32_t crc = lzma_crc32(in + sizeof(uint32_t),
    -			sizeof(uint32_t) + LZMA_STREAM_FLAGS_SIZE, 0);
    -	if (crc != unaligned_read32le(in))
    -		return LZMA_DATA_ERROR;
    -
    -	// Stream Flags
    -	if (stream_flags_decode(options, in + sizeof(uint32_t) * 2))
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Backward Size
    -	options->backward_size = unaligned_read32le(in + sizeof(uint32_t));
    -	options->backward_size = (options->backward_size + 1) * 4;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/stream_flags_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/stream_flags_encoder.c
    deleted file mode 100644
    index 4e717159f..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/stream_flags_encoder.c
    +++ /dev/null
    @@ -1,86 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       stream_flags_encoder.c
    -/// \brief      Encodes Stream Header and Stream Footer for .xz files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "stream_flags_common.h"
    -
    -
    -static bool
    -stream_flags_encode(const lzma_stream_flags *options, uint8_t *out)
    -{
    -	if ((unsigned int)(options->check) > LZMA_CHECK_ID_MAX)
    -		return true;
    -
    -	out[0] = 0x00;
    -	out[1] = options->check;
    -
    -	return false;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_header_encode(const lzma_stream_flags *options, uint8_t *out)
    -{
    -	assert(sizeof(lzma_header_magic) + LZMA_STREAM_FLAGS_SIZE
    -			+ 4 == LZMA_STREAM_HEADER_SIZE);
    -
    -	if (options->version != 0)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Magic
    -	memcpy(out, lzma_header_magic, sizeof(lzma_header_magic));
    -
    -	// Stream Flags
    -	if (stream_flags_encode(options, out + sizeof(lzma_header_magic)))
    -		return LZMA_PROG_ERROR;
    -
    -	// CRC32 of the Stream Header
    -	const uint32_t crc = lzma_crc32(out + sizeof(lzma_header_magic),
    -			LZMA_STREAM_FLAGS_SIZE, 0);
    -
    -	unaligned_write32le(out + sizeof(lzma_header_magic)
    -			+ LZMA_STREAM_FLAGS_SIZE, crc);
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_stream_footer_encode(const lzma_stream_flags *options, uint8_t *out)
    -{
    -	assert(2 * 4 + LZMA_STREAM_FLAGS_SIZE + sizeof(lzma_footer_magic)
    -			== LZMA_STREAM_HEADER_SIZE);
    -
    -	if (options->version != 0)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Backward Size
    -	if (!is_backward_size_valid(options))
    -		return LZMA_PROG_ERROR;
    -
    -	unaligned_write32le(out + 4, options->backward_size / 4 - 1);
    -
    -	// Stream Flags
    -	if (stream_flags_encode(options, out + 2 * 4))
    -		return LZMA_PROG_ERROR;
    -
    -	// CRC32
    -	const uint32_t crc = lzma_crc32(
    -			out + 4, 4 + LZMA_STREAM_FLAGS_SIZE, 0);
    -
    -	unaligned_write32le(out, crc);
    -
    -	// Magic
    -	memcpy(out + 2 * 4 + LZMA_STREAM_FLAGS_SIZE,
    -			lzma_footer_magic, sizeof(lzma_footer_magic));
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/vli_decoder.c b/external/public-domain/xz/dist/src/liblzma/common/vli_decoder.c
    deleted file mode 100644
    index c181828bf..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/vli_decoder.c
    +++ /dev/null
    @@ -1,86 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       vli_decoder.c
    -/// \brief      Decodes variable-length integers
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_vli_decode(lzma_vli *restrict vli, size_t *vli_pos,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size)
    -{
    -	// If we haven't been given vli_pos, work in single-call mode.
    -	size_t vli_pos_internal = 0;
    -	if (vli_pos == NULL) {
    -		vli_pos = &vli_pos_internal;
    -		*vli = 0;
    -
    -		// If there's no input, use LZMA_DATA_ERROR. This way it is
    -		// easy to decode VLIs from buffers that have known size,
    -		// and get the correct error code in case the buffer is
    -		// too short.
    -		if (*in_pos >= in_size)
    -			return LZMA_DATA_ERROR;
    -
    -	} else {
    -		// Initialize *vli when starting to decode a new integer.
    -		if (*vli_pos == 0)
    -			*vli = 0;
    -
    -		// Validate the arguments.
    -		if (*vli_pos >= LZMA_VLI_BYTES_MAX
    -				|| (*vli >> (*vli_pos * 7)) != 0)
    -			return LZMA_PROG_ERROR;;
    -
    -		if (*in_pos >= in_size)
    -			return LZMA_BUF_ERROR;
    -	}
    -
    -	do {
    -		// Read the next byte. Use a temporary variable so that we
    -		// can update *in_pos immediately.
    -		const uint8_t byte = in[*in_pos];
    -		++*in_pos;
    -
    -		// Add the newly read byte to *vli.
    -		*vli += (lzma_vli)(byte & 0x7F) << (*vli_pos * 7);
    -		++*vli_pos;
    -
    -		// Check if this is the last byte of a multibyte integer.
    -		if ((byte & 0x80) == 0) {
    -			// We don't allow using variable-length integers as
    -			// padding i.e. the encoding must use the most the
    -			// compact form.
    -			if (byte == 0x00 && *vli_pos > 1)
    -				return LZMA_DATA_ERROR;
    -
    -			return vli_pos == &vli_pos_internal
    -					? LZMA_OK : LZMA_STREAM_END;
    -		}
    -
    -		// There is at least one more byte coming. If we have already
    -		// read maximum number of bytes, the integer is considered
    -		// corrupt.
    -		//
    -		// If we need bigger integers in future, old versions liblzma
    -		// will confusingly indicate the file being corrupt istead of
    -		// unsupported. I suppose it's still better this way, because
    -		// in the foreseeable future (writing this in 2008) the only
    -		// reason why files would appear having over 63-bit integers
    -		// is that the files are simply corrupt.
    -		if (*vli_pos == LZMA_VLI_BYTES_MAX)
    -			return LZMA_DATA_ERROR;
    -
    -	} while (*in_pos < in_size);
    -
    -	return vli_pos == &vli_pos_internal ? LZMA_DATA_ERROR : LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/vli_encoder.c b/external/public-domain/xz/dist/src/liblzma/common/vli_encoder.c
    deleted file mode 100644
    index f8642694e..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/vli_encoder.c
    +++ /dev/null
    @@ -1,69 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       vli_encoder.c
    -/// \brief      Encodes variable-length integers
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -
    -extern LZMA_API(lzma_ret)
    -lzma_vli_encode(lzma_vli vli, size_t *vli_pos,
    -		uint8_t *restrict out, size_t *restrict out_pos,
    -		size_t out_size)
    -{
    -	// If we haven't been given vli_pos, work in single-call mode.
    -	size_t vli_pos_internal = 0;
    -	if (vli_pos == NULL) {
    -		vli_pos = &vli_pos_internal;
    -
    -		// In single-call mode, we expect that the caller has
    -		// reserved enough output space.
    -		if (*out_pos >= out_size)
    -			return LZMA_PROG_ERROR;
    -	} else {
    -		// This never happens when we are called by liblzma, but
    -		// may happen if called directly from an application.
    -		if (*out_pos >= out_size)
    -			return LZMA_BUF_ERROR;
    -	}
    -
    -	// Validate the arguments.
    -	if (*vli_pos >= LZMA_VLI_BYTES_MAX || vli > LZMA_VLI_MAX)
    -		return LZMA_PROG_ERROR;
    -
    -	// Shift vli so that the next bits to encode are the lowest. In
    -	// single-call mode this never changes vli since *vli_pos is zero.
    -	vli >>= *vli_pos * 7;
    -
    -	// Write the non-last bytes in a loop.
    -	while (vli >= 0x80) {
    -		// We don't need *vli_pos during this function call anymore,
    -		// but update it here so that it is ready if we need to
    -		// return before the whole integer has been decoded.
    -		++*vli_pos;
    -		assert(*vli_pos < LZMA_VLI_BYTES_MAX);
    -
    -		// Write the next byte.
    -		out[*out_pos] = (uint8_t)(vli) | 0x80;
    -		vli >>= 7;
    -
    -		if (++*out_pos == out_size)
    -			return vli_pos == &vli_pos_internal
    -					? LZMA_PROG_ERROR : LZMA_OK;
    -	}
    -
    -	// Write the last byte.
    -	out[*out_pos] = (uint8_t)(vli);
    -	++*out_pos;
    -	++*vli_pos;
    -
    -	return vli_pos == &vli_pos_internal ? LZMA_OK : LZMA_STREAM_END;
    -
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/common/vli_size.c b/external/public-domain/xz/dist/src/liblzma/common/vli_size.c
    deleted file mode 100644
    index ec1b4fa48..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/common/vli_size.c
    +++ /dev/null
    @@ -1,30 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       vli_size.c
    -/// \brief      Calculates the encoded size of a variable-length integer
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -
    -extern LZMA_API(uint32_t)
    -lzma_vli_size(lzma_vli vli)
    -{
    -	if (vli > LZMA_VLI_MAX)
    -		return 0;
    -
    -	uint32_t i = 0;
    -	do {
    -		vli >>= 7;
    -		++i;
    -	} while (vli != 0);
    -
    -	assert(i <= LZMA_VLI_BYTES_MAX);
    -	return i;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/delta/delta_common.c b/external/public-domain/xz/dist/src/liblzma/delta/delta_common.c
    deleted file mode 100644
    index 13dd46828..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/delta/delta_common.c
    +++ /dev/null
    @@ -1,70 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       delta_common.c
    -/// \brief      Common stuff for Delta encoder and decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "delta_common.h"
    -#include "delta_private.h"
    -
    -
    -static void
    -delta_coder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -extern lzma_ret
    -lzma_delta_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	// Allocate memory for the decoder if needed.
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		// End function is the same for encoder and decoder.
    -		next->end = &delta_coder_end;
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	// Validate the options.
    -	if (lzma_delta_coder_memusage(filters[0].options) == UINT64_MAX)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Set the delta distance.
    -	const lzma_options_delta *opt = filters[0].options;
    -	next->coder->distance = opt->dist;
    -
    -	// Initialize the rest of the variables.
    -	next->coder->pos = 0;
    -	memzero(next->coder->history, LZMA_DELTA_DIST_MAX);
    -
    -	// Initialize the next decoder in the chain, if any.
    -	return lzma_next_filter_init(&next->coder->next,
    -			allocator, filters + 1);
    -}
    -
    -
    -extern uint64_t
    -lzma_delta_coder_memusage(const void *options)
    -{
    -	const lzma_options_delta *opt = options;
    -
    -	if (opt == NULL || opt->type != LZMA_DELTA_TYPE_BYTE
    -			|| opt->dist < LZMA_DELTA_DIST_MIN
    -			|| opt->dist > LZMA_DELTA_DIST_MAX)
    -		return UINT64_MAX;
    -
    -	return sizeof(lzma_coder);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/delta/delta_common.h b/external/public-domain/xz/dist/src/liblzma/delta/delta_common.h
    deleted file mode 100644
    index 7e7e1baaf..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/delta/delta_common.h
    +++ /dev/null
    @@ -1,20 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       delta_common.h
    -/// \brief      Common stuff for Delta encoder and decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_DELTA_COMMON_H
    -#define LZMA_DELTA_COMMON_H
    -
    -#include "common.h"
    -
    -extern uint64_t lzma_delta_coder_memusage(const void *options);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/delta/delta_decoder.c b/external/public-domain/xz/dist/src/liblzma/delta/delta_decoder.c
    deleted file mode 100644
    index 726d02399..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/delta/delta_decoder.c
    +++ /dev/null
    @@ -1,76 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       delta_decoder.c
    -/// \brief      Delta filter decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "delta_decoder.h"
    -#include "delta_private.h"
    -
    -
    -static void
    -decode_buffer(lzma_coder *coder, uint8_t *buffer, size_t size)
    -{
    -	const size_t distance = coder->distance;
    -
    -	for (size_t i = 0; i < size; ++i) {
    -		buffer[i] += coder->history[(distance + coder->pos) & 0xFF];
    -		coder->history[coder->pos-- & 0xFF] = buffer[i];
    -	}
    -}
    -
    -
    -static lzma_ret
    -delta_decode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	assert(coder->next.code != NULL);
    -
    -	const size_t out_start = *out_pos;
    -
    -	const lzma_ret ret = coder->next.code(coder->next.coder, allocator,
    -			in, in_pos, in_size, out, out_pos, out_size,
    -			action);
    -
    -	decode_buffer(coder, out + out_start, *out_pos - out_start);
    -
    -	return ret;
    -}
    -
    -
    -extern lzma_ret
    -lzma_delta_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	next->code = &delta_decode;
    -	return lzma_delta_coder_init(next, allocator, filters);
    -}
    -
    -
    -extern lzma_ret
    -lzma_delta_props_decode(void **options, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size)
    -{
    -	if (props_size != 1)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	lzma_options_delta *opt
    -			= lzma_alloc(sizeof(lzma_options_delta), allocator);
    -	if (opt == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	opt->type = LZMA_DELTA_TYPE_BYTE;
    -	opt->dist = props[0] + 1;
    -
    -	*options = opt;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/delta/delta_decoder.h b/external/public-domain/xz/dist/src/liblzma/delta/delta_decoder.h
    deleted file mode 100644
    index ad89cc659..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/delta/delta_decoder.h
    +++ /dev/null
    @@ -1,26 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       delta_decoder.h
    -/// \brief      Delta filter decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_DELTA_DECODER_H
    -#define LZMA_DELTA_DECODER_H
    -
    -#include "delta_common.h"
    -
    -extern lzma_ret lzma_delta_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern lzma_ret lzma_delta_props_decode(
    -		void **options, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/delta/delta_encoder.c b/external/public-domain/xz/dist/src/liblzma/delta/delta_encoder.c
    deleted file mode 100644
    index 5a842636b..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/delta/delta_encoder.c
    +++ /dev/null
    @@ -1,121 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       delta_encoder.c
    -/// \brief      Delta filter encoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "delta_encoder.h"
    -#include "delta_private.h"
    -
    -
    -/// Copies and encodes the data at the same time. This is used when Delta
    -/// is the first filter in the chain (and thus the last filter in the
    -/// encoder's filter stack).
    -static void
    -copy_and_encode(lzma_coder *coder,
    -		const uint8_t *restrict in, uint8_t *restrict out, size_t size)
    -{
    -	const size_t distance = coder->distance;
    -
    -	for (size_t i = 0; i < size; ++i) {
    -		const uint8_t tmp = coder->history[
    -				(distance + coder->pos) & 0xFF];
    -		coder->history[coder->pos-- & 0xFF] = in[i];
    -		out[i] = in[i] - tmp;
    -	}
    -}
    -
    -
    -/// Encodes the data in place. This is used when we are the last filter
    -/// in the chain (and thus non-last filter in the encoder's filter stack).
    -static void
    -encode_in_place(lzma_coder *coder, uint8_t *buffer, size_t size)
    -{
    -	const size_t distance = coder->distance;
    -
    -	for (size_t i = 0; i < size; ++i) {
    -		const uint8_t tmp = coder->history[
    -				(distance + coder->pos) & 0xFF];
    -		coder->history[coder->pos-- & 0xFF] = buffer[i];
    -		buffer[i] -= tmp;
    -	}
    -}
    -
    -
    -static lzma_ret
    -delta_encode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	lzma_ret ret;
    -
    -	if (coder->next.code == NULL) {
    -		const size_t in_avail = in_size - *in_pos;
    -		const size_t out_avail = out_size - *out_pos;
    -		const size_t size = my_min(in_avail, out_avail);
    -
    -		copy_and_encode(coder, in + *in_pos, out + *out_pos, size);
    -
    -		*in_pos += size;
    -		*out_pos += size;
    -
    -		ret = action != LZMA_RUN && *in_pos == in_size
    -				? LZMA_STREAM_END : LZMA_OK;
    -
    -	} else {
    -		const size_t out_start = *out_pos;
    -
    -		ret = coder->next.code(coder->next.coder, allocator,
    -				in, in_pos, in_size, out, out_pos, out_size,
    -				action);
    -
    -		encode_in_place(coder, out + out_start, *out_pos - out_start);
    -	}
    -
    -	return ret;
    -}
    -
    -
    -static lzma_ret
    -delta_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
    -		const lzma_filter *filters_null lzma_attribute((__unused__)),
    -		const lzma_filter *reversed_filters)
    -{
    -	// Delta doesn't and will never support changing the options in
    -	// the middle of encoding. If the app tries to change them, we
    -	// simply ignore them.
    -	return lzma_next_filter_update(
    -			&coder->next, allocator, reversed_filters + 1);
    -}
    -
    -
    -extern lzma_ret
    -lzma_delta_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	next->code = &delta_encode;
    -	next->update = &delta_encoder_update;
    -	return lzma_delta_coder_init(next, allocator, filters);
    -}
    -
    -
    -extern lzma_ret
    -lzma_delta_props_encode(const void *options, uint8_t *out)
    -{
    -	// The caller must have already validated the options, so it's
    -	// LZMA_PROG_ERROR if they are invalid.
    -	if (lzma_delta_coder_memusage(options) == UINT64_MAX)
    -		return LZMA_PROG_ERROR;
    -
    -	const lzma_options_delta *opt = options;
    -	out[0] = opt->dist - LZMA_DELTA_DIST_MIN;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/delta/delta_encoder.h b/external/public-domain/xz/dist/src/liblzma/delta/delta_encoder.h
    deleted file mode 100644
    index 4ab984785..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/delta/delta_encoder.h
    +++ /dev/null
    @@ -1,24 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       delta_encoder.h
    -/// \brief      Delta filter encoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_DELTA_ENCODER_H
    -#define LZMA_DELTA_ENCODER_H
    -
    -#include "delta_common.h"
    -
    -extern lzma_ret lzma_delta_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern lzma_ret lzma_delta_props_encode(const void *options, uint8_t *out);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/delta/delta_private.h b/external/public-domain/xz/dist/src/liblzma/delta/delta_private.h
    deleted file mode 100644
    index 46ce0c645..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/delta/delta_private.h
    +++ /dev/null
    @@ -1,37 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       delta_private.h
    -/// \brief      Private common stuff for Delta encoder and decoder
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_DELTA_PRIVATE_H
    -#define LZMA_DELTA_PRIVATE_H
    -
    -#include "delta_common.h"
    -
    -struct lzma_coder_s {
    -	/// Next coder in the chain
    -	lzma_next_coder next;
    -
    -	/// Delta distance
    -	size_t distance;
    -
    -	/// Position in history[]
    -	uint8_t pos;
    -
    -	/// Buffer to hold history of the original data
    -	uint8_t history[LZMA_DELTA_DIST_MAX];
    -};
    -
    -
    -extern lzma_ret lzma_delta_coder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/liblzma.map b/external/public-domain/xz/dist/src/liblzma/liblzma.map
    deleted file mode 100644
    index f53a4ea30..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/liblzma.map
    +++ /dev/null
    @@ -1,108 +0,0 @@
    -XZ_5.0 {
    -global:
    -	lzma_alone_decoder;
    -	lzma_alone_encoder;
    -	lzma_auto_decoder;
    -	lzma_block_buffer_bound;
    -	lzma_block_buffer_decode;
    -	lzma_block_buffer_encode;
    -	lzma_block_compressed_size;
    -	lzma_block_decoder;
    -	lzma_block_encoder;
    -	lzma_block_header_decode;
    -	lzma_block_header_encode;
    -	lzma_block_header_size;
    -	lzma_block_total_size;
    -	lzma_block_unpadded_size;
    -	lzma_check_is_supported;
    -	lzma_check_size;
    -	lzma_code;
    -	lzma_crc32;
    -	lzma_crc64;
    -	lzma_easy_buffer_encode;
    -	lzma_easy_decoder_memusage;
    -	lzma_easy_encoder;
    -	lzma_easy_encoder_memusage;
    -	lzma_end;
    -	lzma_filter_decoder_is_supported;
    -	lzma_filter_encoder_is_supported;
    -	lzma_filter_flags_decode;
    -	lzma_filter_flags_encode;
    -	lzma_filter_flags_size;
    -	lzma_filters_copy;
    -	lzma_filters_update;
    -	lzma_get_check;
    -	lzma_index_append;
    -	lzma_index_block_count;
    -	lzma_index_buffer_decode;
    -	lzma_index_buffer_encode;
    -	lzma_index_cat;
    -	lzma_index_checks;
    -	lzma_index_decoder;
    -	lzma_index_dup;
    -	lzma_index_encoder;
    -	lzma_index_end;
    -	lzma_index_file_size;
    -	lzma_index_hash_append;
    -	lzma_index_hash_decode;
    -	lzma_index_hash_end;
    -	lzma_index_hash_init;
    -	lzma_index_hash_size;
    -	lzma_index_init;
    -	lzma_index_iter_init;
    -	lzma_index_iter_locate;
    -	lzma_index_iter_next;
    -	lzma_index_iter_rewind;
    -	lzma_index_memusage;
    -	lzma_index_memused;
    -	lzma_index_size;
    -	lzma_index_stream_count;
    -	lzma_index_stream_flags;
    -	lzma_index_stream_padding;
    -	lzma_index_stream_size;
    -	lzma_index_total_size;
    -	lzma_index_uncompressed_size;
    -	lzma_lzma_preset;
    -	lzma_memlimit_get;
    -	lzma_memlimit_set;
    -	lzma_memusage;
    -	lzma_mf_is_supported;
    -	lzma_mode_is_supported;
    -	lzma_physmem;
    -	lzma_properties_decode;
    -	lzma_properties_encode;
    -	lzma_properties_size;
    -	lzma_raw_buffer_decode;
    -	lzma_raw_buffer_encode;
    -	lzma_raw_decoder;
    -	lzma_raw_decoder_memusage;
    -	lzma_raw_encoder;
    -	lzma_raw_encoder_memusage;
    -	lzma_stream_buffer_bound;
    -	lzma_stream_buffer_decode;
    -	lzma_stream_buffer_encode;
    -	lzma_stream_decoder;
    -	lzma_stream_encoder;
    -	lzma_stream_flags_compare;
    -	lzma_stream_footer_decode;
    -	lzma_stream_footer_encode;
    -	lzma_stream_header_decode;
    -	lzma_stream_header_encode;
    -	lzma_version_number;
    -	lzma_version_string;
    -	lzma_vli_decode;
    -	lzma_vli_encode;
    -	lzma_vli_size;
    -};
    -
    -XZ_5.2 {
    -global:
    -	lzma_block_uncomp_encode;
    -	lzma_cputhreads;
    -	lzma_get_progress;
    -	lzma_stream_encoder_mt;
    -	lzma_stream_encoder_mt_memusage;
    -
    -local:
    -	*;
    -} XZ_5.0;
    diff --git a/external/public-domain/xz/dist/src/liblzma/liblzma.pc.in b/external/public-domain/xz/dist/src/liblzma/liblzma.pc.in
    deleted file mode 100644
    index 9fa489115..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/liblzma.pc.in
    +++ /dev/null
    @@ -1,19 +0,0 @@
    -#
    -# Author: Lasse Collin
    -#
    -# This file has been put into the public domain.
    -# You can do whatever you want with this file.
    -#
    -
    -prefix=@prefix@
    -exec_prefix=@exec_prefix@
    -libdir=@libdir@
    -includedir=@includedir@
    -
    -Name: liblzma
    -Description: General purpose data compression library
    -URL: @PACKAGE_URL@
    -Version: @PACKAGE_VERSION@
    -Cflags: -I${includedir}
    -Libs: -L${libdir} -llzma
    -Libs.private: @PTHREAD_CFLAGS@ @LIBS@
    diff --git a/external/public-domain/xz/dist/src/liblzma/liblzma_w32res.rc b/external/public-domain/xz/dist/src/liblzma/liblzma_w32res.rc
    deleted file mode 100644
    index d4d8159c7..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/liblzma_w32res.rc
    +++ /dev/null
    @@ -1,12 +0,0 @@
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - */
    -
    -#define MY_TYPE VFT_DLL
    -#define MY_NAME "liblzma"
    -#define MY_SUFFIX ".dll"
    -#define MY_DESC "liblzma data compression library"
    -#include "common_w32res.rc"
    diff --git a/external/public-domain/xz/dist/src/liblzma/lz/lz_decoder.c b/external/public-domain/xz/dist/src/liblzma/lz/lz_decoder.c
    deleted file mode 100644
    index 2328a8e73..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lz/lz_decoder.c
    +++ /dev/null
    @@ -1,300 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lz_decoder.c
    -/// \brief      LZ out window
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -// liblzma supports multiple LZ77-based filters. The LZ part is shared
    -// between these filters. The LZ code takes care of dictionary handling
    -// and passing the data between filters in the chain. The filter-specific
    -// part decodes from the input buffer to the dictionary.
    -
    -
    -#include "lz_decoder.h"
    -
    -
    -struct lzma_coder_s {
    -	/// Dictionary (history buffer)
    -	lzma_dict dict;
    -
    -	/// The actual LZ-based decoder e.g. LZMA
    -	lzma_lz_decoder lz;
    -
    -	/// Next filter in the chain, if any. Note that LZMA and LZMA2 are
    -	/// only allowed as the last filter, but the long-range filter in
    -	/// future can be in the middle of the chain.
    -	lzma_next_coder next;
    -
    -	/// True if the next filter in the chain has returned LZMA_STREAM_END.
    -	bool next_finished;
    -
    -	/// True if the LZ decoder (e.g. LZMA) has detected end of payload
    -	/// marker. This may become true before next_finished becomes true.
    -	bool this_finished;
    -
    -	/// Temporary buffer needed when the LZ-based filter is not the last
    -	/// filter in the chain. The output of the next filter is first
    -	/// decoded into buffer[], which is then used as input for the actual
    -	/// LZ-based decoder.
    -	struct {
    -		size_t pos;
    -		size_t size;
    -		uint8_t buffer[LZMA_BUFFER_SIZE];
    -	} temp;
    -};
    -
    -
    -static void
    -lz_decoder_reset(lzma_coder *coder)
    -{
    -	coder->dict.pos = 0;
    -	coder->dict.full = 0;
    -	coder->dict.buf[coder->dict.size - 1] = '\0';
    -	coder->dict.need_reset = false;
    -	return;
    -}
    -
    -
    -static lzma_ret
    -decode_buffer(lzma_coder *coder,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size)
    -{
    -	while (true) {
    -		// Wrap the dictionary if needed.
    -		if (coder->dict.pos == coder->dict.size)
    -			coder->dict.pos = 0;
    -
    -		// Store the current dictionary position. It is needed to know
    -		// where to start copying to the out[] buffer.
    -		const size_t dict_start = coder->dict.pos;
    -
    -		// Calculate how much we allow coder->lz.code() to decode.
    -		// It must not decode past the end of the dictionary
    -		// buffer, and we don't want it to decode more than is
    -		// actually needed to fill the out[] buffer.
    -		coder->dict.limit = coder->dict.pos
    -				+ my_min(out_size - *out_pos,
    -					coder->dict.size - coder->dict.pos);
    -
    -		// Call the coder->lz.code() to do the actual decoding.
    -		const lzma_ret ret = coder->lz.code(
    -				coder->lz.coder, &coder->dict,
    -				in, in_pos, in_size);
    -
    -		// Copy the decoded data from the dictionary to the out[]
    -		// buffer.
    -		const size_t copy_size = coder->dict.pos - dict_start;
    -		assert(copy_size <= out_size - *out_pos);
    -		memcpy(out + *out_pos, coder->dict.buf + dict_start,
    -				copy_size);
    -		*out_pos += copy_size;
    -
    -		// Reset the dictionary if so requested by coder->lz.code().
    -		if (coder->dict.need_reset) {
    -			lz_decoder_reset(coder);
    -
    -			// Since we reset dictionary, we don't check if
    -			// dictionary became full.
    -			if (ret != LZMA_OK || *out_pos == out_size)
    -				return ret;
    -		} else {
    -			// Return if everything got decoded or an error
    -			// occurred, or if there's no more data to decode.
    -			//
    -			// Note that detecting if there's something to decode
    -			// is done by looking if dictionary become full
    -			// instead of looking if *in_pos == in_size. This
    -			// is because it is possible that all the input was
    -			// consumed already but some data is pending to be
    -			// written to the dictionary.
    -			if (ret != LZMA_OK || *out_pos == out_size
    -					|| coder->dict.pos < coder->dict.size)
    -				return ret;
    -		}
    -	}
    -}
    -
    -
    -static lzma_ret
    -lz_decode(lzma_coder *coder,
    -		const lzma_allocator *allocator lzma_attribute((__unused__)),
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size,
    -		lzma_action action)
    -{
    -	if (coder->next.code == NULL)
    -		return decode_buffer(coder, in, in_pos, in_size,
    -				out, out_pos, out_size);
    -
    -	// We aren't the last coder in the chain, we need to decode
    -	// our input to a temporary buffer.
    -	while (*out_pos < out_size) {
    -		// Fill the temporary buffer if it is empty.
    -		if (!coder->next_finished
    -				&& coder->temp.pos == coder->temp.size) {
    -			coder->temp.pos = 0;
    -			coder->temp.size = 0;
    -
    -			const lzma_ret ret = coder->next.code(
    -					coder->next.coder,
    -					allocator, in, in_pos, in_size,
    -					coder->temp.buffer, &coder->temp.size,
    -					LZMA_BUFFER_SIZE, action);
    -
    -			if (ret == LZMA_STREAM_END)
    -				coder->next_finished = true;
    -			else if (ret != LZMA_OK || coder->temp.size == 0)
    -				return ret;
    -		}
    -
    -		if (coder->this_finished) {
    -			if (coder->temp.size != 0)
    -				return LZMA_DATA_ERROR;
    -
    -			if (coder->next_finished)
    -				return LZMA_STREAM_END;
    -
    -			return LZMA_OK;
    -		}
    -
    -		const lzma_ret ret = decode_buffer(coder, coder->temp.buffer,
    -				&coder->temp.pos, coder->temp.size,
    -				out, out_pos, out_size);
    -
    -		if (ret == LZMA_STREAM_END)
    -			coder->this_finished = true;
    -		else if (ret != LZMA_OK)
    -			return ret;
    -		else if (coder->next_finished && *out_pos < out_size)
    -			return LZMA_DATA_ERROR;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static void
    -lz_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -	lzma_free(coder->dict.buf, allocator);
    -
    -	if (coder->lz.end != NULL)
    -		coder->lz.end(coder->lz.coder, allocator);
    -	else
    -		lzma_free(coder->lz.coder, allocator);
    -
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -extern lzma_ret
    -lzma_lz_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters,
    -		lzma_ret (*lz_init)(lzma_lz_decoder *lz,
    -			const lzma_allocator *allocator, const void *options,
    -			lzma_lz_options *lz_options))
    -{
    -	// Allocate the base structure if it isn't already allocated.
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &lz_decode;
    -		next->end = &lz_decoder_end;
    -
    -		next->coder->dict.buf = NULL;
    -		next->coder->dict.size = 0;
    -		next->coder->lz = LZMA_LZ_DECODER_INIT;
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	// Allocate and initialize the LZ-based decoder. It will also give
    -	// us the dictionary size.
    -	lzma_lz_options lz_options;
    -	return_if_error(lz_init(&next->coder->lz, allocator,
    -			filters[0].options, &lz_options));
    -
    -	// If the dictionary size is very small, increase it to 4096 bytes.
    -	// This is to prevent constant wrapping of the dictionary, which
    -	// would slow things down. The downside is that since we don't check
    -	// separately for the real dictionary size, we may happily accept
    -	// corrupt files.
    -	if (lz_options.dict_size < 4096)
    -		lz_options.dict_size = 4096;
    -
    -	// Make dictionary size a multipe of 16. Some LZ-based decoders like
    -	// LZMA use the lowest bits lzma_dict.pos to know the alignment of the
    -	// data. Aligned buffer is also good when memcpying from the
    -	// dictionary to the output buffer, since applications are
    -	// recommended to give aligned buffers to liblzma.
    -	//
    -	// Avoid integer overflow.
    -	if (lz_options.dict_size > SIZE_MAX - 15)
    -		return LZMA_MEM_ERROR;
    -
    -	lz_options.dict_size = (lz_options.dict_size + 15) & ~((size_t)(15));
    -
    -	// Allocate and initialize the dictionary.
    -	if (next->coder->dict.size != lz_options.dict_size) {
    -		lzma_free(next->coder->dict.buf, allocator);
    -		next->coder->dict.buf
    -				= lzma_alloc(lz_options.dict_size, allocator);
    -		if (next->coder->dict.buf == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->coder->dict.size = lz_options.dict_size;
    -	}
    -
    -	lz_decoder_reset(next->coder);
    -
    -	// Use the preset dictionary if it was given to us.
    -	if (lz_options.preset_dict != NULL
    -			&& lz_options.preset_dict_size > 0) {
    -		// If the preset dictionary is bigger than the actual
    -		// dictionary, copy only the tail.
    -		const size_t copy_size = my_min(lz_options.preset_dict_size,
    -				lz_options.dict_size);
    -		const size_t offset = lz_options.preset_dict_size - copy_size;
    -		memcpy(next->coder->dict.buf, lz_options.preset_dict + offset,
    -				copy_size);
    -		next->coder->dict.pos = copy_size;
    -		next->coder->dict.full = copy_size;
    -	}
    -
    -	// Miscellaneous initializations
    -	next->coder->next_finished = false;
    -	next->coder->this_finished = false;
    -	next->coder->temp.pos = 0;
    -	next->coder->temp.size = 0;
    -
    -	// Initialize the next filter in the chain, if any.
    -	return lzma_next_filter_init(&next->coder->next, allocator,
    -			filters + 1);
    -}
    -
    -
    -extern uint64_t
    -lzma_lz_decoder_memusage(size_t dictionary_size)
    -{
    -	return sizeof(lzma_coder) + (uint64_t)(dictionary_size);
    -}
    -
    -
    -extern void
    -lzma_lz_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size)
    -{
    -	coder->lz.set_uncompressed(coder->lz.coder, uncompressed_size);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lz/lz_decoder.h b/external/public-domain/xz/dist/src/liblzma/lz/lz_decoder.h
    deleted file mode 100644
    index 277900afb..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lz/lz_decoder.h
    +++ /dev/null
    @@ -1,235 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lz_decoder.h
    -/// \brief      LZ out window
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZ_DECODER_H
    -#define LZMA_LZ_DECODER_H
    -
    -#include "common.h"
    -
    -
    -typedef struct {
    -	/// Pointer to the dictionary buffer. It can be an allocated buffer
    -	/// internal to liblzma, or it can a be a buffer given by the
    -	/// application when in single-call mode (not implemented yet).
    -	uint8_t *buf;
    -
    -	/// Write position in dictionary. The next byte will be written to
    -	/// buf[pos].
    -	size_t pos;
    -
    -	/// Indicates how full the dictionary is. This is used by
    -	/// dict_is_distance_valid() to detect corrupt files that would
    -	/// read beyond the beginning of the dictionary.
    -	size_t full;
    -
    -	/// Write limit
    -	size_t limit;
    -
    -	/// Size of the dictionary
    -	size_t size;
    -
    -	/// True when dictionary should be reset before decoding more data.
    -	bool need_reset;
    -
    -} lzma_dict;
    -
    -
    -typedef struct {
    -	size_t dict_size;
    -	const uint8_t *preset_dict;
    -	size_t preset_dict_size;
    -} lzma_lz_options;
    -
    -
    -typedef struct {
    -	/// Data specific to the LZ-based decoder
    -	lzma_coder *coder;
    -
    -	/// Function to decode from in[] to *dict
    -	lzma_ret (*code)(lzma_coder *restrict coder,
    -			lzma_dict *restrict dict, const uint8_t *restrict in,
    -			size_t *restrict in_pos, size_t in_size);
    -
    -	void (*reset)(lzma_coder *coder, const void *options);
    -
    -	/// Set the uncompressed size
    -	void (*set_uncompressed)(lzma_coder *coder,
    -			lzma_vli uncompressed_size);
    -
    -	/// Free allocated resources
    -	void (*end)(lzma_coder *coder, const lzma_allocator *allocator);
    -
    -} lzma_lz_decoder;
    -
    -
    -#define LZMA_LZ_DECODER_INIT \
    -	(lzma_lz_decoder){ \
    -		.coder = NULL, \
    -		.code = NULL, \
    -		.reset = NULL, \
    -		.set_uncompressed = NULL, \
    -		.end = NULL, \
    -	}
    -
    -
    -extern lzma_ret lzma_lz_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters,
    -		lzma_ret (*lz_init)(lzma_lz_decoder *lz,
    -			const lzma_allocator *allocator, const void *options,
    -			lzma_lz_options *lz_options));
    -
    -extern uint64_t lzma_lz_decoder_memusage(size_t dictionary_size);
    -
    -extern void lzma_lz_decoder_uncompressed(
    -		lzma_coder *coder, lzma_vli uncompressed_size);
    -
    -
    -//////////////////////
    -// Inline functions //
    -//////////////////////
    -
    -/// Get a byte from the history buffer.
    -static inline uint8_t
    -dict_get(const lzma_dict *const dict, const uint32_t distance)
    -{
    -	return dict->buf[dict->pos - distance - 1
    -			+ (distance < dict->pos ? 0 : dict->size)];
    -}
    -
    -
    -/// Test if dictionary is empty.
    -static inline bool
    -dict_is_empty(const lzma_dict *const dict)
    -{
    -	return dict->full == 0;
    -}
    -
    -
    -/// Validate the match distance
    -static inline bool
    -dict_is_distance_valid(const lzma_dict *const dict, const size_t distance)
    -{
    -	return dict->full > distance;
    -}
    -
    -
    -/// Repeat *len bytes at distance.
    -static inline bool
    -dict_repeat(lzma_dict *dict, uint32_t distance, uint32_t *len)
    -{
    -	// Don't write past the end of the dictionary.
    -	const size_t dict_avail = dict->limit - dict->pos;
    -	uint32_t left = my_min(dict_avail, *len);
    -	*len -= left;
    -
    -	// Repeat a block of data from the history. Because memcpy() is faster
    -	// than copying byte by byte in a loop, the copying process gets split
    -	// into three cases.
    -	if (distance < left) {
    -		// Source and target areas overlap, thus we can't use
    -		// memcpy() nor even memmove() safely.
    -		do {
    -			dict->buf[dict->pos] = dict_get(dict, distance);
    -			++dict->pos;
    -		} while (--left > 0);
    -
    -	} else if (distance < dict->pos) {
    -		// The easiest and fastest case
    -		memcpy(dict->buf + dict->pos,
    -				dict->buf + dict->pos - distance - 1,
    -				left);
    -		dict->pos += left;
    -
    -	} else {
    -		// The bigger the dictionary, the more rare this
    -		// case occurs. We need to "wrap" the dict, thus
    -		// we might need two memcpy() to copy all the data.
    -		assert(dict->full == dict->size);
    -		const uint32_t copy_pos
    -				= dict->pos - distance - 1 + dict->size;
    -		uint32_t copy_size = dict->size - copy_pos;
    -
    -		if (copy_size < left) {
    -			memmove(dict->buf + dict->pos, dict->buf + copy_pos,
    -					copy_size);
    -			dict->pos += copy_size;
    -			copy_size = left - copy_size;
    -			memcpy(dict->buf + dict->pos, dict->buf, copy_size);
    -			dict->pos += copy_size;
    -		} else {
    -			memmove(dict->buf + dict->pos, dict->buf + copy_pos,
    -					left);
    -			dict->pos += left;
    -		}
    -	}
    -
    -	// Update how full the dictionary is.
    -	if (dict->full < dict->pos)
    -		dict->full = dict->pos;
    -
    -	return unlikely(*len != 0);
    -}
    -
    -
    -/// Puts one byte into the dictionary. Returns true if the dictionary was
    -/// already full and the byte couldn't be added.
    -static inline bool
    -dict_put(lzma_dict *dict, uint8_t byte)
    -{
    -	if (unlikely(dict->pos == dict->limit))
    -		return true;
    -
    -	dict->buf[dict->pos++] = byte;
    -
    -	if (dict->pos > dict->full)
    -		dict->full = dict->pos;
    -
    -	return false;
    -}
    -
    -
    -/// Copies arbitrary amount of data into the dictionary.
    -static inline void
    -dict_write(lzma_dict *restrict dict, const uint8_t *restrict in,
    -		size_t *restrict in_pos, size_t in_size,
    -		size_t *restrict left)
    -{
    -	// NOTE: If we are being given more data than the size of the
    -	// dictionary, it could be possible to optimize the LZ decoder
    -	// so that not everything needs to go through the dictionary.
    -	// This shouldn't be very common thing in practice though, and
    -	// the slowdown of one extra memcpy() isn't bad compared to how
    -	// much time it would have taken if the data were compressed.
    -
    -	if (in_size - *in_pos > *left)
    -		in_size = *in_pos + *left;
    -
    -	*left -= lzma_bufcpy(in, in_pos, in_size,
    -			dict->buf, &dict->pos, dict->limit);
    -
    -	if (dict->pos > dict->full)
    -		dict->full = dict->pos;
    -
    -	return;
    -}
    -
    -
    -static inline void
    -dict_reset(lzma_dict *dict)
    -{
    -	dict->need_reset = true;
    -	return;
    -}
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder.c b/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder.c
    deleted file mode 100644
    index 01dfc06f3..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder.c
    +++ /dev/null
    @@ -1,605 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lz_encoder.c
    -/// \brief      LZ in window
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "lz_encoder.h"
    -#include "lz_encoder_hash.h"
    -
    -// See lz_encoder_hash.h. This is a bit hackish but avoids making
    -// endianness a conditional in makefiles.
    -#if defined(WORDS_BIGENDIAN) && !defined(HAVE_SMALL)
    -#	include "lz_encoder_hash_table.h"
    -#endif
    -
    -#include "memcmplen.h"
    -
    -
    -struct lzma_coder_s {
    -	/// LZ-based encoder e.g. LZMA
    -	lzma_lz_encoder lz;
    -
    -	/// History buffer and match finder
    -	lzma_mf mf;
    -
    -	/// Next coder in the chain
    -	lzma_next_coder next;
    -};
    -
    -
    -/// \brief      Moves the data in the input window to free space for new data
    -///
    -/// mf->buffer is a sliding input window, which keeps mf->keep_size_before
    -/// bytes of input history available all the time. Now and then we need to
    -/// "slide" the buffer to make space for the new data to the end of the
    -/// buffer. At the same time, data older than keep_size_before is dropped.
    -///
    -static void
    -move_window(lzma_mf *mf)
    -{
    -	// Align the move to a multiple of 16 bytes. Some LZ-based encoders
    -	// like LZMA use the lowest bits of mf->read_pos to know the
    -	// alignment of the uncompressed data. We also get better speed
    -	// for memmove() with aligned buffers.
    -	assert(mf->read_pos > mf->keep_size_before);
    -	const uint32_t move_offset
    -		= (mf->read_pos - mf->keep_size_before) & ~UINT32_C(15);
    -
    -	assert(mf->write_pos > move_offset);
    -	const size_t move_size = mf->write_pos - move_offset;
    -
    -	assert(move_offset + move_size <= mf->size);
    -
    -	memmove(mf->buffer, mf->buffer + move_offset, move_size);
    -
    -	mf->offset += move_offset;
    -	mf->read_pos -= move_offset;
    -	mf->read_limit -= move_offset;
    -	mf->write_pos -= move_offset;
    -
    -	return;
    -}
    -
    -
    -/// \brief      Tries to fill the input window (mf->buffer)
    -///
    -/// If we are the last encoder in the chain, our input data is in in[].
    -/// Otherwise we call the next filter in the chain to process in[] and
    -/// write its output to mf->buffer.
    -///
    -/// This function must not be called once it has returned LZMA_STREAM_END.
    -///
    -static lzma_ret
    -fill_window(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *in, size_t *in_pos, size_t in_size,
    -		lzma_action action)
    -{
    -	assert(coder->mf.read_pos <= coder->mf.write_pos);
    -
    -	// Move the sliding window if needed.
    -	if (coder->mf.read_pos >= coder->mf.size - coder->mf.keep_size_after)
    -		move_window(&coder->mf);
    -
    -	// Maybe this is ugly, but lzma_mf uses uint32_t for most things
    -	// (which I find cleanest), but we need size_t here when filling
    -	// the history window.
    -	size_t write_pos = coder->mf.write_pos;
    -	lzma_ret ret;
    -	if (coder->next.code == NULL) {
    -		// Not using a filter, simply memcpy() as much as possible.
    -		lzma_bufcpy(in, in_pos, in_size, coder->mf.buffer,
    -				&write_pos, coder->mf.size);
    -
    -		ret = action != LZMA_RUN && *in_pos == in_size
    -				? LZMA_STREAM_END : LZMA_OK;
    -
    -	} else {
    -		ret = coder->next.code(coder->next.coder, allocator,
    -				in, in_pos, in_size,
    -				coder->mf.buffer, &write_pos,
    -				coder->mf.size, action);
    -	}
    -
    -	coder->mf.write_pos = write_pos;
    -
    -	// Silence Valgrind. lzma_memcmplen() can read extra bytes
    -	// and Valgrind will give warnings if those bytes are uninitialized
    -	// because Valgrind cannot see that the values of the uninitialized
    -	// bytes are eventually ignored.
    -	memzero(coder->mf.buffer + write_pos, LZMA_MEMCMPLEN_EXTRA);
    -
    -	// If end of stream has been reached or flushing completed, we allow
    -	// the encoder to process all the input (that is, read_pos is allowed
    -	// to reach write_pos). Otherwise we keep keep_size_after bytes
    -	// available as prebuffer.
    -	if (ret == LZMA_STREAM_END) {
    -		assert(*in_pos == in_size);
    -		ret = LZMA_OK;
    -		coder->mf.action = action;
    -		coder->mf.read_limit = coder->mf.write_pos;
    -
    -	} else if (coder->mf.write_pos > coder->mf.keep_size_after) {
    -		// This needs to be done conditionally, because if we got
    -		// only little new input, there may be too little input
    -		// to do any encoding yet.
    -		coder->mf.read_limit = coder->mf.write_pos
    -				- coder->mf.keep_size_after;
    -	}
    -
    -	// Restart the match finder after finished LZMA_SYNC_FLUSH.
    -	if (coder->mf.pending > 0
    -			&& coder->mf.read_pos < coder->mf.read_limit) {
    -		// Match finder may update coder->pending and expects it to
    -		// start from zero, so use a temporary variable.
    -		const size_t pending = coder->mf.pending;
    -		coder->mf.pending = 0;
    -
    -		// Rewind read_pos so that the match finder can hash
    -		// the pending bytes.
    -		assert(coder->mf.read_pos >= pending);
    -		coder->mf.read_pos -= pending;
    -
    -		// Call the skip function directly instead of using
    -		// mf_skip(), since we don't want to touch mf->read_ahead.
    -		coder->mf.skip(&coder->mf, pending);
    -	}
    -
    -	return ret;
    -}
    -
    -
    -static lzma_ret
    -lz_encode(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size,
    -		uint8_t *restrict out, size_t *restrict out_pos,
    -		size_t out_size, lzma_action action)
    -{
    -	while (*out_pos < out_size
    -			&& (*in_pos < in_size || action != LZMA_RUN)) {
    -		// Read more data to coder->mf.buffer if needed.
    -		if (coder->mf.action == LZMA_RUN && coder->mf.read_pos
    -				>= coder->mf.read_limit)
    -			return_if_error(fill_window(coder, allocator,
    -					in, in_pos, in_size, action));
    -
    -		// Encode
    -		const lzma_ret ret = coder->lz.code(coder->lz.coder,
    -				&coder->mf, out, out_pos, out_size);
    -		if (ret != LZMA_OK) {
    -			// Setting this to LZMA_RUN for cases when we are
    -			// flushing. It doesn't matter when finishing or if
    -			// an error occurred.
    -			coder->mf.action = LZMA_RUN;
    -			return ret;
    -		}
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static bool
    -lz_encoder_prepare(lzma_mf *mf, const lzma_allocator *allocator,
    -		const lzma_lz_options *lz_options)
    -{
    -	// For now, the dictionary size is limited to 1.5 GiB. This may grow
    -	// in the future if needed, but it needs a little more work than just
    -	// changing this check.
    -	if (lz_options->dict_size < LZMA_DICT_SIZE_MIN
    -			|| lz_options->dict_size
    -				> (UINT32_C(1) << 30) + (UINT32_C(1) << 29)
    -			|| lz_options->nice_len > lz_options->match_len_max)
    -		return true;
    -
    -	mf->keep_size_before = lz_options->before_size + lz_options->dict_size;
    -
    -	mf->keep_size_after = lz_options->after_size
    -			+ lz_options->match_len_max;
    -
    -	// To avoid constant memmove()s, allocate some extra space. Since
    -	// memmove()s become more expensive when the size of the buffer
    -	// increases, we reserve more space when a large dictionary is
    -	// used to make the memmove() calls rarer.
    -	//
    -	// This works with dictionaries up to about 3 GiB. If bigger
    -	// dictionary is wanted, some extra work is needed:
    -	//   - Several variables in lzma_mf have to be changed from uint32_t
    -	//     to size_t.
    -	//   - Memory usage calculation needs something too, e.g. use uint64_t
    -	//     for mf->size.
    -	uint32_t reserve = lz_options->dict_size / 2;
    -	if (reserve > (UINT32_C(1) << 30))
    -		reserve /= 2;
    -
    -	reserve += (lz_options->before_size + lz_options->match_len_max
    -			+ lz_options->after_size) / 2 + (UINT32_C(1) << 19);
    -
    -	const uint32_t old_size = mf->size;
    -	mf->size = mf->keep_size_before + reserve + mf->keep_size_after;
    -
    -	// Deallocate the old history buffer if it exists but has different
    -	// size than what is needed now.
    -	if (mf->buffer != NULL && old_size != mf->size) {
    -		lzma_free(mf->buffer, allocator);
    -		mf->buffer = NULL;
    -	}
    -
    -	// Match finder options
    -	mf->match_len_max = lz_options->match_len_max;
    -	mf->nice_len = lz_options->nice_len;
    -
    -	// cyclic_size has to stay smaller than 2 Gi. Note that this doesn't
    -	// mean limiting dictionary size to less than 2 GiB. With a match
    -	// finder that uses multibyte resolution (hashes start at e.g. every
    -	// fourth byte), cyclic_size would stay below 2 Gi even when
    -	// dictionary size is greater than 2 GiB.
    -	//
    -	// It would be possible to allow cyclic_size >= 2 Gi, but then we
    -	// would need to be careful to use 64-bit types in various places
    -	// (size_t could do since we would need bigger than 32-bit address
    -	// space anyway). It would also require either zeroing a multigigabyte
    -	// buffer at initialization (waste of time and RAM) or allow
    -	// normalization in lz_encoder_mf.c to access uninitialized
    -	// memory to keep the code simpler. The current way is simple and
    -	// still allows pretty big dictionaries, so I don't expect these
    -	// limits to change.
    -	mf->cyclic_size = lz_options->dict_size + 1;
    -
    -	// Validate the match finder ID and setup the function pointers.
    -	switch (lz_options->match_finder) {
    -#ifdef HAVE_MF_HC3
    -	case LZMA_MF_HC3:
    -		mf->find = &lzma_mf_hc3_find;
    -		mf->skip = &lzma_mf_hc3_skip;
    -		break;
    -#endif
    -#ifdef HAVE_MF_HC4
    -	case LZMA_MF_HC4:
    -		mf->find = &lzma_mf_hc4_find;
    -		mf->skip = &lzma_mf_hc4_skip;
    -		break;
    -#endif
    -#ifdef HAVE_MF_BT2
    -	case LZMA_MF_BT2:
    -		mf->find = &lzma_mf_bt2_find;
    -		mf->skip = &lzma_mf_bt2_skip;
    -		break;
    -#endif
    -#ifdef HAVE_MF_BT3
    -	case LZMA_MF_BT3:
    -		mf->find = &lzma_mf_bt3_find;
    -		mf->skip = &lzma_mf_bt3_skip;
    -		break;
    -#endif
    -#ifdef HAVE_MF_BT4
    -	case LZMA_MF_BT4:
    -		mf->find = &lzma_mf_bt4_find;
    -		mf->skip = &lzma_mf_bt4_skip;
    -		break;
    -#endif
    -
    -	default:
    -		return true;
    -	}
    -
    -	// Calculate the sizes of mf->hash and mf->son and check that
    -	// nice_len is big enough for the selected match finder.
    -	const uint32_t hash_bytes = lz_options->match_finder & 0x0F;
    -	if (hash_bytes > mf->nice_len)
    -		return true;
    -
    -	const bool is_bt = (lz_options->match_finder & 0x10) != 0;
    -	uint32_t hs;
    -
    -	if (hash_bytes == 2) {
    -		hs = 0xFFFF;
    -	} else {
    -		// Round dictionary size up to the next 2^n - 1 so it can
    -		// be used as a hash mask.
    -		hs = lz_options->dict_size - 1;
    -		hs |= hs >> 1;
    -		hs |= hs >> 2;
    -		hs |= hs >> 4;
    -		hs |= hs >> 8;
    -		hs >>= 1;
    -		hs |= 0xFFFF;
    -
    -		if (hs > (UINT32_C(1) << 24)) {
    -			if (hash_bytes == 3)
    -				hs = (UINT32_C(1) << 24) - 1;
    -			else
    -				hs >>= 1;
    -		}
    -	}
    -
    -	mf->hash_mask = hs;
    -
    -	++hs;
    -	if (hash_bytes > 2)
    -		hs += HASH_2_SIZE;
    -	if (hash_bytes > 3)
    -		hs += HASH_3_SIZE;
    -/*
    -	No match finder uses this at the moment.
    -	if (mf->hash_bytes > 4)
    -		hs += HASH_4_SIZE;
    -*/
    -
    -	const uint32_t old_hash_count = mf->hash_count;
    -	const uint32_t old_sons_count = mf->sons_count;
    -	mf->hash_count = hs;
    -	mf->sons_count = mf->cyclic_size;
    -	if (is_bt)
    -		mf->sons_count *= 2;
    -
    -	// Deallocate the old hash array if it exists and has different size
    -	// than what is needed now.
    -	if (old_hash_count != mf->hash_count
    -			|| old_sons_count != mf->sons_count) {
    -		lzma_free(mf->hash, allocator);
    -		mf->hash = NULL;
    -
    -		lzma_free(mf->son, allocator);
    -		mf->son = NULL;
    -	}
    -
    -	// Maximum number of match finder cycles
    -	mf->depth = lz_options->depth;
    -	if (mf->depth == 0) {
    -		if (is_bt)
    -			mf->depth = 16 + mf->nice_len / 2;
    -		else
    -			mf->depth = 4 + mf->nice_len / 4;
    -	}
    -
    -	return false;
    -}
    -
    -
    -static bool
    -lz_encoder_init(lzma_mf *mf, const lzma_allocator *allocator,
    -		const lzma_lz_options *lz_options)
    -{
    -	// Allocate the history buffer.
    -	if (mf->buffer == NULL) {
    -		// lzma_memcmplen() is used for the dictionary buffer
    -		// so we need to allocate a few extra bytes to prevent
    -		// it from reading past the end of the buffer.
    -		mf->buffer = lzma_alloc(mf->size + LZMA_MEMCMPLEN_EXTRA,
    -				allocator);
    -		if (mf->buffer == NULL)
    -			return true;
    -
    -		// Keep Valgrind happy with lzma_memcmplen() and initialize
    -		// the extra bytes whose value may get read but which will
    -		// effectively get ignored.
    -		memzero(mf->buffer + mf->size, LZMA_MEMCMPLEN_EXTRA);
    -	}
    -
    -	// Use cyclic_size as initial mf->offset. This allows
    -	// avoiding a few branches in the match finders. The downside is
    -	// that match finder needs to be normalized more often, which may
    -	// hurt performance with huge dictionaries.
    -	mf->offset = mf->cyclic_size;
    -	mf->read_pos = 0;
    -	mf->read_ahead = 0;
    -	mf->read_limit = 0;
    -	mf->write_pos = 0;
    -	mf->pending = 0;
    -
    -#if UINT32_MAX >= SIZE_MAX / 4
    -	// Check for integer overflow. (Huge dictionaries are not
    -	// possible on 32-bit CPU.)
    -	if (mf->hash_count > SIZE_MAX / sizeof(uint32_t)
    -			|| mf->sons_count > SIZE_MAX / sizeof(uint32_t))
    -		return true;
    -#endif
    -
    -	// Allocate and initialize the hash table. Since EMPTY_HASH_VALUE
    -	// is zero, we can use lzma_alloc_zero() or memzero() for mf->hash.
    -	//
    -	// We don't need to initialize mf->son, but not doing that may
    -	// make Valgrind complain in normalization (see normalize() in
    -	// lz_encoder_mf.c). Skipping the initialization is *very* good
    -	// when big dictionary is used but only small amount of data gets
    -	// actually compressed: most of the mf->son won't get actually
    -	// allocated by the kernel, so we avoid wasting RAM and improve
    -	// initialization speed a lot.
    -	if (mf->hash == NULL) {
    -		mf->hash = lzma_alloc_zero(mf->hash_count * sizeof(uint32_t),
    -				allocator);
    -		mf->son = lzma_alloc(mf->sons_count * sizeof(uint32_t),
    -				allocator);
    -
    -		if (mf->hash == NULL || mf->son == NULL) {
    -			lzma_free(mf->hash, allocator);
    -			mf->hash = NULL;
    -
    -			lzma_free(mf->son, allocator);
    -			mf->son = NULL;
    -
    -			return true;
    -		}
    -	} else {
    -/*
    -		for (uint32_t i = 0; i < mf->hash_count; ++i)
    -			mf->hash[i] = EMPTY_HASH_VALUE;
    -*/
    -		memzero(mf->hash, mf->hash_count * sizeof(uint32_t));
    -	}
    -
    -	mf->cyclic_pos = 0;
    -
    -	// Handle preset dictionary.
    -	if (lz_options->preset_dict != NULL
    -			&& lz_options->preset_dict_size > 0) {
    -		// If the preset dictionary is bigger than the actual
    -		// dictionary, use only the tail.
    -		mf->write_pos = my_min(lz_options->preset_dict_size, mf->size);
    -		memcpy(mf->buffer, lz_options->preset_dict
    -				+ lz_options->preset_dict_size - mf->write_pos,
    -				mf->write_pos);
    -		mf->action = LZMA_SYNC_FLUSH;
    -		mf->skip(mf, mf->write_pos);
    -	}
    -
    -	mf->action = LZMA_RUN;
    -
    -	return false;
    -}
    -
    -
    -extern uint64_t
    -lzma_lz_encoder_memusage(const lzma_lz_options *lz_options)
    -{
    -	// Old buffers must not exist when calling lz_encoder_prepare().
    -	lzma_mf mf = {
    -		.buffer = NULL,
    -		.hash = NULL,
    -		.son = NULL,
    -		.hash_count = 0,
    -		.sons_count = 0,
    -	};
    -
    -	// Setup the size information into mf.
    -	if (lz_encoder_prepare(&mf, NULL, lz_options))
    -		return UINT64_MAX;
    -
    -	// Calculate the memory usage.
    -	return ((uint64_t)(mf.hash_count) + mf.sons_count) * sizeof(uint32_t)
    -			+ mf.size + sizeof(lzma_coder);
    -}
    -
    -
    -static void
    -lz_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -
    -	lzma_free(coder->mf.son, allocator);
    -	lzma_free(coder->mf.hash, allocator);
    -	lzma_free(coder->mf.buffer, allocator);
    -
    -	if (coder->lz.end != NULL)
    -		coder->lz.end(coder->lz.coder, allocator);
    -	else
    -		lzma_free(coder->lz.coder, allocator);
    -
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_ret
    -lz_encoder_update(lzma_coder *coder, const lzma_allocator *allocator,
    -		const lzma_filter *filters_null lzma_attribute((__unused__)),
    -		const lzma_filter *reversed_filters)
    -{
    -	if (coder->lz.options_update == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	return_if_error(coder->lz.options_update(
    -			coder->lz.coder, reversed_filters));
    -
    -	return lzma_next_filter_update(
    -			&coder->next, allocator, reversed_filters + 1);
    -}
    -
    -
    -extern lzma_ret
    -lzma_lz_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters,
    -		lzma_ret (*lz_init)(lzma_lz_encoder *lz,
    -			const lzma_allocator *allocator, const void *options,
    -			lzma_lz_options *lz_options))
    -{
    -#ifdef HAVE_SMALL
    -	// We need that the CRC32 table has been initialized.
    -	lzma_crc32_init();
    -#endif
    -
    -	// Allocate and initialize the base data structure.
    -	if (next->coder == NULL) {
    -		next->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &lz_encode;
    -		next->end = &lz_encoder_end;
    -		next->update = &lz_encoder_update;
    -
    -		next->coder->lz.coder = NULL;
    -		next->coder->lz.code = NULL;
    -		next->coder->lz.end = NULL;
    -
    -		next->coder->mf.buffer = NULL;
    -		next->coder->mf.hash = NULL;
    -		next->coder->mf.son = NULL;
    -		next->coder->mf.hash_count = 0;
    -		next->coder->mf.sons_count = 0;
    -
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -	}
    -
    -	// Initialize the LZ-based encoder.
    -	lzma_lz_options lz_options;
    -	return_if_error(lz_init(&next->coder->lz, allocator,
    -			filters[0].options, &lz_options));
    -
    -	// Setup the size information into next->coder->mf and deallocate
    -	// old buffers if they have wrong size.
    -	if (lz_encoder_prepare(&next->coder->mf, allocator, &lz_options))
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Allocate new buffers if needed, and do the rest of
    -	// the initialization.
    -	if (lz_encoder_init(&next->coder->mf, allocator, &lz_options))
    -		return LZMA_MEM_ERROR;
    -
    -	// Initialize the next filter in the chain, if any.
    -	return lzma_next_filter_init(&next->coder->next, allocator,
    -			filters + 1);
    -}
    -
    -
    -extern LZMA_API(lzma_bool)
    -lzma_mf_is_supported(lzma_match_finder mf)
    -{
    -	bool ret = false;
    -
    -#ifdef HAVE_MF_HC3
    -	if (mf == LZMA_MF_HC3)
    -		ret = true;
    -#endif
    -
    -#ifdef HAVE_MF_HC4
    -	if (mf == LZMA_MF_HC4)
    -		ret = true;
    -#endif
    -
    -#ifdef HAVE_MF_BT2
    -	if (mf == LZMA_MF_BT2)
    -		ret = true;
    -#endif
    -
    -#ifdef HAVE_MF_BT3
    -	if (mf == LZMA_MF_BT3)
    -		ret = true;
    -#endif
    -
    -#ifdef HAVE_MF_BT4
    -	if (mf == LZMA_MF_BT4)
    -		ret = true;
    -#endif
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder.h b/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder.h
    deleted file mode 100644
    index dad9c6b29..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder.h
    +++ /dev/null
    @@ -1,328 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lz_encoder.h
    -/// \brief      LZ in window and match finder API
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZ_ENCODER_H
    -#define LZMA_LZ_ENCODER_H
    -
    -#include "common.h"
    -
    -
    -/// A table of these is used by the LZ-based encoder to hold
    -/// the length-distance pairs found by the match finder.
    -typedef struct {
    -	uint32_t len;
    -	uint32_t dist;
    -} lzma_match;
    -
    -
    -typedef struct lzma_mf_s lzma_mf;
    -struct lzma_mf_s {
    -	///////////////
    -	// In Window //
    -	///////////////
    -
    -	/// Pointer to buffer with data to be compressed
    -	uint8_t *buffer;
    -
    -	/// Total size of the allocated buffer (that is, including all
    -	/// the extra space)
    -	uint32_t size;
    -
    -	/// Number of bytes that must be kept available in our input history.
    -	/// That is, once keep_size_before bytes have been processed,
    -	/// buffer[read_pos - keep_size_before] is the oldest byte that
    -	/// must be available for reading.
    -	uint32_t keep_size_before;
    -
    -	/// Number of bytes that must be kept in buffer after read_pos.
    -	/// That is, read_pos <= write_pos - keep_size_after as long as
    -	/// action is LZMA_RUN; when action != LZMA_RUN, read_pos is allowed
    -	/// to reach write_pos so that the last bytes get encoded too.
    -	uint32_t keep_size_after;
    -
    -	/// Match finders store locations of matches using 32-bit integers.
    -	/// To avoid adjusting several megabytes of integers every time the
    -	/// input window is moved with move_window, we only adjust the
    -	/// offset of the buffer. Thus, buffer[value_in_hash_table - offset]
    -	/// is the byte pointed by value_in_hash_table.
    -	uint32_t offset;
    -
    -	/// buffer[read_pos] is the next byte to run through the match
    -	/// finder. This is incremented in the match finder once the byte
    -	/// has been processed.
    -	uint32_t read_pos;
    -
    -	/// Number of bytes that have been ran through the match finder, but
    -	/// which haven't been encoded by the LZ-based encoder yet.
    -	uint32_t read_ahead;
    -
    -	/// As long as read_pos is less than read_limit, there is enough
    -	/// input available in buffer for at least one encoding loop.
    -	///
    -	/// Because of the stateful API, read_limit may and will get greater
    -	/// than read_pos quite often. This is taken into account when
    -	/// calculating the value for keep_size_after.
    -	uint32_t read_limit;
    -
    -	/// buffer[write_pos] is the first byte that doesn't contain valid
    -	/// uncompressed data; that is, the next input byte will be copied
    -	/// to buffer[write_pos].
    -	uint32_t write_pos;
    -
    -	/// Number of bytes not hashed before read_pos. This is needed to
    -	/// restart the match finder after LZMA_SYNC_FLUSH.
    -	uint32_t pending;
    -
    -	//////////////////
    -	// Match Finder //
    -	//////////////////
    -
    -	/// Find matches. Returns the number of distance-length pairs written
    -	/// to the matches array. This is called only via lzma_mf_find().
    -	uint32_t (*find)(lzma_mf *mf, lzma_match *matches);
    -
    -	/// Skips num bytes. This is like find() but doesn't make the
    -	/// distance-length pairs available, thus being a little faster.
    -	/// This is called only via mf_skip().
    -	void (*skip)(lzma_mf *mf, uint32_t num);
    -
    -	uint32_t *hash;
    -	uint32_t *son;
    -	uint32_t cyclic_pos;
    -	uint32_t cyclic_size; // Must be dictionary size + 1.
    -	uint32_t hash_mask;
    -
    -	/// Maximum number of loops in the match finder
    -	uint32_t depth;
    -
    -	/// Maximum length of a match that the match finder will try to find.
    -	uint32_t nice_len;
    -
    -	/// Maximum length of a match supported by the LZ-based encoder.
    -	/// If the longest match found by the match finder is nice_len,
    -	/// mf_find() tries to expand it up to match_len_max bytes.
    -	uint32_t match_len_max;
    -
    -	/// When running out of input, binary tree match finders need to know
    -	/// if it is due to flushing or finishing. The action is used also
    -	/// by the LZ-based encoders themselves.
    -	lzma_action action;
    -
    -	/// Number of elements in hash[]
    -	uint32_t hash_count;
    -
    -	/// Number of elements in son[]
    -	uint32_t sons_count;
    -};
    -
    -
    -typedef struct {
    -	/// Extra amount of data to keep available before the "actual"
    -	/// dictionary.
    -	size_t before_size;
    -
    -	/// Size of the history buffer
    -	size_t dict_size;
    -
    -	/// Extra amount of data to keep available after the "actual"
    -	/// dictionary.
    -	size_t after_size;
    -
    -	/// Maximum length of a match that the LZ-based encoder can accept.
    -	/// This is used to extend matches of length nice_len to the
    -	/// maximum possible length.
    -	size_t match_len_max;
    -
    -	/// Match finder will search matches up to this length.
    -	/// This must be less than or equal to match_len_max.
    -	size_t nice_len;
    -
    -	/// Type of the match finder to use
    -	lzma_match_finder match_finder;
    -
    -	/// Maximum search depth
    -	uint32_t depth;
    -
    -	/// TODO: Comment
    -	const uint8_t *preset_dict;
    -
    -	uint32_t preset_dict_size;
    -
    -} lzma_lz_options;
    -
    -
    -// The total usable buffer space at any moment outside the match finder:
    -// before_size + dict_size + after_size + match_len_max
    -//
    -// In reality, there's some extra space allocated to prevent the number of
    -// memmove() calls reasonable. The bigger the dict_size is, the bigger
    -// this extra buffer will be since with bigger dictionaries memmove() would
    -// also take longer.
    -//
    -// A single encoder loop in the LZ-based encoder may call the match finder
    -// (mf_find() or mf_skip()) at most after_size times. In other words,
    -// a single encoder loop may increment lzma_mf.read_pos at most after_size
    -// times. Since matches are looked up to
    -// lzma_mf.buffer[lzma_mf.read_pos + match_len_max - 1], the total
    -// amount of extra buffer needed after dict_size becomes
    -// after_size + match_len_max.
    -//
    -// before_size has two uses. The first one is to keep literals available
    -// in cases when the LZ-based encoder has made some read ahead.
    -// TODO: Maybe this could be changed by making the LZ-based encoders to
    -// store the actual literals as they do with length-distance pairs.
    -//
    -// Algorithms such as LZMA2 first try to compress a chunk, and then check
    -// if the encoded result is smaller than the uncompressed one. If the chunk
    -// was uncompressible, it is better to store it in uncompressed form in
    -// the output stream. To do this, the whole uncompressed chunk has to be
    -// still available in the history buffer. before_size achieves that.
    -
    -
    -typedef struct {
    -	/// Data specific to the LZ-based encoder
    -	lzma_coder *coder;
    -
    -	/// Function to encode from *dict to out[]
    -	lzma_ret (*code)(lzma_coder *restrict coder,
    -			lzma_mf *restrict mf, uint8_t *restrict out,
    -			size_t *restrict out_pos, size_t out_size);
    -
    -	/// Free allocated resources
    -	void (*end)(lzma_coder *coder, const lzma_allocator *allocator);
    -
    -	/// Update the options in the middle of the encoding.
    -	lzma_ret (*options_update)(lzma_coder *coder,
    -			const lzma_filter *filter);
    -
    -} lzma_lz_encoder;
    -
    -
    -// Basic steps:
    -//  1. Input gets copied into the dictionary.
    -//  2. Data in dictionary gets run through the match finder byte by byte.
    -//  3. The literals and matches are encoded using e.g. LZMA.
    -//
    -// The bytes that have been ran through the match finder, but not encoded yet,
    -// are called `read ahead'.
    -
    -
    -/// Get pointer to the first byte not ran through the match finder
    -static inline const uint8_t *
    -mf_ptr(const lzma_mf *mf)
    -{
    -	return mf->buffer + mf->read_pos;
    -}
    -
    -
    -/// Get the number of bytes that haven't been ran through the match finder yet.
    -static inline uint32_t
    -mf_avail(const lzma_mf *mf)
    -{
    -	return mf->write_pos - mf->read_pos;
    -}
    -
    -
    -/// Get the number of bytes that haven't been encoded yet (some of these
    -/// bytes may have been ran through the match finder though).
    -static inline uint32_t
    -mf_unencoded(const lzma_mf *mf)
    -{
    -	return mf->write_pos - mf->read_pos + mf->read_ahead;
    -}
    -
    -
    -/// Calculate the absolute offset from the beginning of the most recent
    -/// dictionary reset. Only the lowest four bits are important, so there's no
    -/// problem that we don't know the 64-bit size of the data encoded so far.
    -///
    -/// NOTE: When moving the input window, we need to do it so that the lowest
    -/// bits of dict->read_pos are not modified to keep this macro working
    -/// as intended.
    -static inline uint32_t
    -mf_position(const lzma_mf *mf)
    -{
    -	return mf->read_pos - mf->read_ahead;
    -}
    -
    -
    -/// Since everything else begins with mf_, use it also for lzma_mf_find().
    -#define mf_find lzma_mf_find
    -
    -
    -/// Skip the given number of bytes. This is used when a good match was found.
    -/// For example, if mf_find() finds a match of 200 bytes long, the first byte
    -/// of that match was already consumed by mf_find(), and the rest 199 bytes
    -/// have to be skipped with mf_skip(mf, 199).
    -static inline void
    -mf_skip(lzma_mf *mf, uint32_t amount)
    -{
    -	if (amount != 0) {
    -		mf->skip(mf, amount);
    -		mf->read_ahead += amount;
    -	}
    -}
    -
    -
    -/// Copies at most *left number of bytes from the history buffer
    -/// to out[]. This is needed by LZMA2 to encode uncompressed chunks.
    -static inline void
    -mf_read(lzma_mf *mf, uint8_t *out, size_t *out_pos, size_t out_size,
    -		size_t *left)
    -{
    -	const size_t out_avail = out_size - *out_pos;
    -	const size_t copy_size = my_min(out_avail, *left);
    -
    -	assert(mf->read_ahead == 0);
    -	assert(mf->read_pos >= *left);
    -
    -	memcpy(out + *out_pos, mf->buffer + mf->read_pos - *left,
    -			copy_size);
    -
    -	*out_pos += copy_size;
    -	*left -= copy_size;
    -	return;
    -}
    -
    -
    -extern lzma_ret lzma_lz_encoder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters,
    -		lzma_ret (*lz_init)(lzma_lz_encoder *lz,
    -			const lzma_allocator *allocator, const void *options,
    -			lzma_lz_options *lz_options));
    -
    -
    -extern uint64_t lzma_lz_encoder_memusage(const lzma_lz_options *lz_options);
    -
    -
    -// These are only for LZ encoder's internal use.
    -extern uint32_t lzma_mf_find(
    -		lzma_mf *mf, uint32_t *count, lzma_match *matches);
    -
    -extern uint32_t lzma_mf_hc3_find(lzma_mf *dict, lzma_match *matches);
    -extern void lzma_mf_hc3_skip(lzma_mf *dict, uint32_t amount);
    -
    -extern uint32_t lzma_mf_hc4_find(lzma_mf *dict, lzma_match *matches);
    -extern void lzma_mf_hc4_skip(lzma_mf *dict, uint32_t amount);
    -
    -extern uint32_t lzma_mf_bt2_find(lzma_mf *dict, lzma_match *matches);
    -extern void lzma_mf_bt2_skip(lzma_mf *dict, uint32_t amount);
    -
    -extern uint32_t lzma_mf_bt3_find(lzma_mf *dict, lzma_match *matches);
    -extern void lzma_mf_bt3_skip(lzma_mf *dict, uint32_t amount);
    -
    -extern uint32_t lzma_mf_bt4_find(lzma_mf *dict, lzma_match *matches);
    -extern void lzma_mf_bt4_skip(lzma_mf *dict, uint32_t amount);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_hash.h b/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_hash.h
    deleted file mode 100644
    index 342a333d1..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_hash.h
    +++ /dev/null
    @@ -1,108 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lz_encoder_hash.h
    -/// \brief      Hash macros for match finders
    -//
    -//  Author:     Igor Pavlov
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZ_ENCODER_HASH_H
    -#define LZMA_LZ_ENCODER_HASH_H
    -
    -#if defined(WORDS_BIGENDIAN) && !defined(HAVE_SMALL)
    -	// This is to make liblzma produce the same output on big endian
    -	// systems that it does on little endian systems. lz_encoder.c
    -	// takes care of including the actual table.
    -	extern const uint32_t lzma_lz_hash_table[256];
    -#	define hash_table lzma_lz_hash_table
    -#else
    -#	include "check.h"
    -#	define hash_table lzma_crc32_table[0]
    -#endif
    -
    -#define HASH_2_SIZE (UINT32_C(1) << 10)
    -#define HASH_3_SIZE (UINT32_C(1) << 16)
    -#define HASH_4_SIZE (UINT32_C(1) << 20)
    -
    -#define HASH_2_MASK (HASH_2_SIZE - 1)
    -#define HASH_3_MASK (HASH_3_SIZE - 1)
    -#define HASH_4_MASK (HASH_4_SIZE - 1)
    -
    -#define FIX_3_HASH_SIZE (HASH_2_SIZE)
    -#define FIX_4_HASH_SIZE (HASH_2_SIZE + HASH_3_SIZE)
    -#define FIX_5_HASH_SIZE (HASH_2_SIZE + HASH_3_SIZE + HASH_4_SIZE)
    -
    -// Endianness doesn't matter in hash_2_calc() (no effect on the output).
    -#ifdef TUKLIB_FAST_UNALIGNED_ACCESS
    -#	define hash_2_calc() \
    -		const uint32_t hash_value = *(const uint16_t *)(cur)
    -#else
    -#	define hash_2_calc() \
    -		const uint32_t hash_value \
    -			= (uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8)
    -#endif
    -
    -#define hash_3_calc() \
    -	const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \
    -	const uint32_t hash_2_value = temp & HASH_2_MASK; \
    -	const uint32_t hash_value \
    -			= (temp ^ ((uint32_t)(cur[2]) << 8)) & mf->hash_mask
    -
    -#define hash_4_calc() \
    -	const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \
    -	const uint32_t hash_2_value = temp & HASH_2_MASK; \
    -	const uint32_t hash_3_value \
    -			= (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \
    -	const uint32_t hash_value = (temp ^ ((uint32_t)(cur[2]) << 8) \
    -			^ (hash_table[cur[3]] << 5)) & mf->hash_mask
    -
    -
    -// The following are not currently used.
    -
    -#define hash_5_calc() \
    -	const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \
    -	const uint32_t hash_2_value = temp & HASH_2_MASK; \
    -	const uint32_t hash_3_value \
    -			= (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \
    -	uint32_t hash_4_value = (temp ^ ((uint32_t)(cur[2]) << 8) ^ \
    -			^ hash_table[cur[3]] << 5); \
    -	const uint32_t hash_value \
    -			= (hash_4_value ^ (hash_table[cur[4]] << 3)) \
    -				& mf->hash_mask; \
    -	hash_4_value &= HASH_4_MASK
    -
    -/*
    -#define hash_zip_calc() \
    -	const uint32_t hash_value \
    -			= (((uint32_t)(cur[0]) | ((uint32_t)(cur[1]) << 8)) \
    -				^ hash_table[cur[2]]) & 0xFFFF
    -*/
    -
    -#define hash_zip_calc() \
    -	const uint32_t hash_value \
    -			= (((uint32_t)(cur[2]) | ((uint32_t)(cur[0]) << 8)) \
    -				^ hash_table[cur[1]]) & 0xFFFF
    -
    -#define mt_hash_2_calc() \
    -	const uint32_t hash_2_value \
    -			= (hash_table[cur[0]] ^ cur[1]) & HASH_2_MASK
    -
    -#define mt_hash_3_calc() \
    -	const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \
    -	const uint32_t hash_2_value = temp & HASH_2_MASK; \
    -	const uint32_t hash_3_value \
    -			= (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK
    -
    -#define mt_hash_4_calc() \
    -	const uint32_t temp = hash_table[cur[0]] ^ cur[1]; \
    -	const uint32_t hash_2_value = temp & HASH_2_MASK; \
    -	const uint32_t hash_3_value \
    -			= (temp ^ ((uint32_t)(cur[2]) << 8)) & HASH_3_MASK; \
    -	const uint32_t hash_4_value = (temp ^ ((uint32_t)(cur[2]) << 8) ^ \
    -			(hash_table[cur[3]] << 5)) & HASH_4_MASK
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_hash_table.h b/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_hash_table.h
    deleted file mode 100644
    index 8c51717d7..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_hash_table.h
    +++ /dev/null
    @@ -1,68 +0,0 @@
    -/* This file has been automatically generated by crc32_tablegen.c. */
    -
    -const uint32_t lzma_lz_hash_table[256] = {
    -	0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA,
    -	0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
    -	0x0EDB8832, 0x79DCB8A4, 0xE0D5E91E, 0x97D2D988,
    -	0x09B64C2B, 0x7EB17CBD, 0xE7B82D07, 0x90BF1D91,
    -	0x1DB71064, 0x6AB020F2, 0xF3B97148, 0x84BE41DE,
    -	0x1ADAD47D, 0x6DDDE4EB, 0xF4D4B551, 0x83D385C7,
    -	0x136C9856, 0x646BA8C0, 0xFD62F97A, 0x8A65C9EC,
    -	0x14015C4F, 0x63066CD9, 0xFA0F3D63, 0x8D080DF5,
    -	0x3B6E20C8, 0x4C69105E, 0xD56041E4, 0xA2677172,
    -	0x3C03E4D1, 0x4B04D447, 0xD20D85FD, 0xA50AB56B,
    -	0x35B5A8FA, 0x42B2986C, 0xDBBBC9D6, 0xACBCF940,
    -	0x32D86CE3, 0x45DF5C75, 0xDCD60DCF, 0xABD13D59,
    -	0x26D930AC, 0x51DE003A, 0xC8D75180, 0xBFD06116,
    -	0x21B4F4B5, 0x56B3C423, 0xCFBA9599, 0xB8BDA50F,
    -	0x2802B89E, 0x5F058808, 0xC60CD9B2, 0xB10BE924,
    -	0x2F6F7C87, 0x58684C11, 0xC1611DAB, 0xB6662D3D,
    -	0x76DC4190, 0x01DB7106, 0x98D220BC, 0xEFD5102A,
    -	0x71B18589, 0x06B6B51F, 0x9FBFE4A5, 0xE8B8D433,
    -	0x7807C9A2, 0x0F00F934, 0x9609A88E, 0xE10E9818,
    -	0x7F6A0DBB, 0x086D3D2D, 0x91646C97, 0xE6635C01,
    -	0x6B6B51F4, 0x1C6C6162, 0x856530D8, 0xF262004E,
    -	0x6C0695ED, 0x1B01A57B, 0x8208F4C1, 0xF50FC457,
    -	0x65B0D9C6, 0x12B7E950, 0x8BBEB8EA, 0xFCB9887C,
    -	0x62DD1DDF, 0x15DA2D49, 0x8CD37CF3, 0xFBD44C65,
    -	0x4DB26158, 0x3AB551CE, 0xA3BC0074, 0xD4BB30E2,
    -	0x4ADFA541, 0x3DD895D7, 0xA4D1C46D, 0xD3D6F4FB,
    -	0x4369E96A, 0x346ED9FC, 0xAD678846, 0xDA60B8D0,
    -	0x44042D73, 0x33031DE5, 0xAA0A4C5F, 0xDD0D7CC9,
    -	0x5005713C, 0x270241AA, 0xBE0B1010, 0xC90C2086,
    -	0x5768B525, 0x206F85B3, 0xB966D409, 0xCE61E49F,
    -	0x5EDEF90E, 0x29D9C998, 0xB0D09822, 0xC7D7A8B4,
    -	0x59B33D17, 0x2EB40D81, 0xB7BD5C3B, 0xC0BA6CAD,
    -	0xEDB88320, 0x9ABFB3B6, 0x03B6E20C, 0x74B1D29A,
    -	0xEAD54739, 0x9DD277AF, 0x04DB2615, 0x73DC1683,
    -	0xE3630B12, 0x94643B84, 0x0D6D6A3E, 0x7A6A5AA8,
    -	0xE40ECF0B, 0x9309FF9D, 0x0A00AE27, 0x7D079EB1,
    -	0xF00F9344, 0x8708A3D2, 0x1E01F268, 0x6906C2FE,
    -	0xF762575D, 0x806567CB, 0x196C3671, 0x6E6B06E7,
    -	0xFED41B76, 0x89D32BE0, 0x10DA7A5A, 0x67DD4ACC,
    -	0xF9B9DF6F, 0x8EBEEFF9, 0x17B7BE43, 0x60B08ED5,
    -	0xD6D6A3E8, 0xA1D1937E, 0x38D8C2C4, 0x4FDFF252,
    -	0xD1BB67F1, 0xA6BC5767, 0x3FB506DD, 0x48B2364B,
    -	0xD80D2BDA, 0xAF0A1B4C, 0x36034AF6, 0x41047A60,
    -	0xDF60EFC3, 0xA867DF55, 0x316E8EEF, 0x4669BE79,
    -	0xCB61B38C, 0xBC66831A, 0x256FD2A0, 0x5268E236,
    -	0xCC0C7795, 0xBB0B4703, 0x220216B9, 0x5505262F,
    -	0xC5BA3BBE, 0xB2BD0B28, 0x2BB45A92, 0x5CB36A04,
    -	0xC2D7FFA7, 0xB5D0CF31, 0x2CD99E8B, 0x5BDEAE1D,
    -	0x9B64C2B0, 0xEC63F226, 0x756AA39C, 0x026D930A,
    -	0x9C0906A9, 0xEB0E363F, 0x72076785, 0x05005713,
    -	0x95BF4A82, 0xE2B87A14, 0x7BB12BAE, 0x0CB61B38,
    -	0x92D28E9B, 0xE5D5BE0D, 0x7CDCEFB7, 0x0BDBDF21,
    -	0x86D3D2D4, 0xF1D4E242, 0x68DDB3F8, 0x1FDA836E,
    -	0x81BE16CD, 0xF6B9265B, 0x6FB077E1, 0x18B74777,
    -	0x88085AE6, 0xFF0F6A70, 0x66063BCA, 0x11010B5C,
    -	0x8F659EFF, 0xF862AE69, 0x616BFFD3, 0x166CCF45,
    -	0xA00AE278, 0xD70DD2EE, 0x4E048354, 0x3903B3C2,
    -	0xA7672661, 0xD06016F7, 0x4969474D, 0x3E6E77DB,
    -	0xAED16A4A, 0xD9D65ADC, 0x40DF0B66, 0x37D83BF0,
    -	0xA9BCAE53, 0xDEBB9EC5, 0x47B2CF7F, 0x30B5FFE9,
    -	0xBDBDF21C, 0xCABAC28A, 0x53B39330, 0x24B4A3A6,
    -	0xBAD03605, 0xCDD70693, 0x54DE5729, 0x23D967BF,
    -	0xB3667A2E, 0xC4614AB8, 0x5D681B02, 0x2A6F2B94,
    -	0xB40BBE37, 0xC30C8EA1, 0x5A05DF1B, 0x2D02EF8D
    -};
    diff --git a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_mf.c b/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_mf.c
    deleted file mode 100644
    index 78520779f..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lz/lz_encoder_mf.c
    +++ /dev/null
    @@ -1,744 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lz_encoder_mf.c
    -/// \brief      Match finders
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "lz_encoder.h"
    -#include "lz_encoder_hash.h"
    -#include "memcmplen.h"
    -
    -
    -/// \brief      Find matches starting from the current byte
    -///
    -/// \return     The length of the longest match found
    -extern uint32_t
    -lzma_mf_find(lzma_mf *mf, uint32_t *count_ptr, lzma_match *matches)
    -{
    -	// Call the match finder. It returns the number of length-distance
    -	// pairs found.
    -	// FIXME: Minimum count is zero, what _exactly_ is the maximum?
    -	const uint32_t count = mf->find(mf, matches);
    -
    -	// Length of the longest match; assume that no matches were found
    -	// and thus the maximum length is zero.
    -	uint32_t len_best = 0;
    -
    -	if (count > 0) {
    -#ifndef NDEBUG
    -		// Validate the matches.
    -		for (uint32_t i = 0; i < count; ++i) {
    -			assert(matches[i].len <= mf->nice_len);
    -			assert(matches[i].dist < mf->read_pos);
    -			assert(memcmp(mf_ptr(mf) - 1,
    -				mf_ptr(mf) - matches[i].dist - 2,
    -				matches[i].len) == 0);
    -		}
    -#endif
    -
    -		// The last used element in the array contains
    -		// the longest match.
    -		len_best = matches[count - 1].len;
    -
    -		// If a match of maximum search length was found, try to
    -		// extend the match to maximum possible length.
    -		if (len_best == mf->nice_len) {
    -			// The limit for the match length is either the
    -			// maximum match length supported by the LZ-based
    -			// encoder or the number of bytes left in the
    -			// dictionary, whichever is smaller.
    -			uint32_t limit = mf_avail(mf) + 1;
    -			if (limit > mf->match_len_max)
    -				limit = mf->match_len_max;
    -
    -			// Pointer to the byte we just ran through
    -			// the match finder.
    -			const uint8_t *p1 = mf_ptr(mf) - 1;
    -
    -			// Pointer to the beginning of the match. We need -1
    -			// here because the match distances are zero based.
    -			const uint8_t *p2 = p1 - matches[count - 1].dist - 1;
    -
    -			len_best = lzma_memcmplen(p1, p2, len_best, limit);
    -		}
    -	}
    -
    -	*count_ptr = count;
    -
    -	// Finally update the read position to indicate that match finder was
    -	// run for this dictionary offset.
    -	++mf->read_ahead;
    -
    -	return len_best;
    -}
    -
    -
    -/// Hash value to indicate unused element in the hash. Since we start the
    -/// positions from dict_size + 1, zero is always too far to qualify
    -/// as usable match position.
    -#define EMPTY_HASH_VALUE 0
    -
    -
    -/// Normalization must be done when lzma_mf.offset + lzma_mf.read_pos
    -/// reaches MUST_NORMALIZE_POS.
    -#define MUST_NORMALIZE_POS UINT32_MAX
    -
    -
    -/// \brief      Normalizes hash values
    -///
    -/// The hash arrays store positions of match candidates. The positions are
    -/// relative to an arbitrary offset that is not the same as the absolute
    -/// offset in the input stream. The relative position of the current byte
    -/// is lzma_mf.offset + lzma_mf.read_pos. The distances of the matches are
    -/// the differences of the current read position and the position found from
    -/// the hash.
    -///
    -/// To prevent integer overflows of the offsets stored in the hash arrays,
    -/// we need to "normalize" the stored values now and then. During the
    -/// normalization, we drop values that indicate distance greater than the
    -/// dictionary size, thus making space for new values.
    -static void
    -normalize(lzma_mf *mf)
    -{
    -	assert(mf->read_pos + mf->offset == MUST_NORMALIZE_POS);
    -
    -	// In future we may not want to touch the lowest bits, because there
    -	// may be match finders that use larger resolution than one byte.
    -	const uint32_t subvalue
    -			= (MUST_NORMALIZE_POS - mf->cyclic_size);
    -				// & (~(UINT32_C(1) << 10) - 1);
    -
    -	for (uint32_t i = 0; i < mf->hash_count; ++i) {
    -		// If the distance is greater than the dictionary size,
    -		// we can simply mark the hash element as empty.
    -		if (mf->hash[i] <= subvalue)
    -			mf->hash[i] = EMPTY_HASH_VALUE;
    -		else
    -			mf->hash[i] -= subvalue;
    -	}
    -
    -	for (uint32_t i = 0; i < mf->sons_count; ++i) {
    -		// Do the same for mf->son.
    -		//
    -		// NOTE: There may be uninitialized elements in mf->son.
    -		// Valgrind may complain that the "if" below depends on
    -		// an uninitialized value. In this case it is safe to ignore
    -		// the warning. See also the comments in lz_encoder_init()
    -		// in lz_encoder.c.
    -		if (mf->son[i] <= subvalue)
    -			mf->son[i] = EMPTY_HASH_VALUE;
    -		else
    -			mf->son[i] -= subvalue;
    -	}
    -
    -	// Update offset to match the new locations.
    -	mf->offset -= subvalue;
    -
    -	return;
    -}
    -
    -
    -/// Mark the current byte as processed from point of view of the match finder.
    -static void
    -move_pos(lzma_mf *mf)
    -{
    -	if (++mf->cyclic_pos == mf->cyclic_size)
    -		mf->cyclic_pos = 0;
    -
    -	++mf->read_pos;
    -	assert(mf->read_pos <= mf->write_pos);
    -
    -	if (unlikely(mf->read_pos + mf->offset == UINT32_MAX))
    -		normalize(mf);
    -}
    -
    -
    -/// When flushing, we cannot run the match finder unless there is nice_len
    -/// bytes available in the dictionary. Instead, we skip running the match
    -/// finder (indicating that no match was found), and count how many bytes we
    -/// have ignored this way.
    -///
    -/// When new data is given after the flushing was completed, the match finder
    -/// is restarted by rewinding mf->read_pos backwards by mf->pending. Then
    -/// the missed bytes are added to the hash using the match finder's skip
    -/// function (with small amount of input, it may start using mf->pending
    -/// again if flushing).
    -///
    -/// Due to this rewinding, we don't touch cyclic_pos or test for
    -/// normalization. It will be done when the match finder's skip function
    -/// catches up after a flush.
    -static void
    -move_pending(lzma_mf *mf)
    -{
    -	++mf->read_pos;
    -	assert(mf->read_pos <= mf->write_pos);
    -	++mf->pending;
    -}
    -
    -
    -/// Calculate len_limit and determine if there is enough input to run
    -/// the actual match finder code. Sets up "cur" and "pos". This macro
    -/// is used by all find functions and binary tree skip functions. Hash
    -/// chain skip function doesn't need len_limit so a simpler code is used
    -/// in them.
    -#define header(is_bt, len_min, ret_op) \
    -	uint32_t len_limit = mf_avail(mf); \
    -	if (mf->nice_len <= len_limit) { \
    -		len_limit = mf->nice_len; \
    -	} else if (len_limit < (len_min) \
    -			|| (is_bt && mf->action == LZMA_SYNC_FLUSH)) { \
    -		assert(mf->action != LZMA_RUN); \
    -		move_pending(mf); \
    -		ret_op; \
    -	} \
    -	const uint8_t *cur = mf_ptr(mf); \
    -	const uint32_t pos = mf->read_pos + mf->offset
    -
    -
    -/// Header for find functions. "return 0" indicates that zero matches
    -/// were found.
    -#define header_find(is_bt, len_min) \
    -	header(is_bt, len_min, return 0); \
    -	uint32_t matches_count = 0
    -
    -
    -/// Header for a loop in a skip function. "continue" tells to skip the rest
    -/// of the code in the loop.
    -#define header_skip(is_bt, len_min) \
    -	header(is_bt, len_min, continue)
    -
    -
    -/// Calls hc_find_func() or bt_find_func() and calculates the total number
    -/// of matches found. Updates the dictionary position and returns the number
    -/// of matches found.
    -#define call_find(func, len_best) \
    -do { \
    -	matches_count = func(len_limit, pos, cur, cur_match, mf->depth, \
    -				mf->son, mf->cyclic_pos, mf->cyclic_size, \
    -				matches + matches_count, len_best) \
    -			- matches; \
    -	move_pos(mf); \
    -	return matches_count; \
    -} while (0)
    -
    -
    -////////////////
    -// Hash Chain //
    -////////////////
    -
    -#if defined(HAVE_MF_HC3) || defined(HAVE_MF_HC4)
    -///
    -///
    -/// \param      len_limit       Don't look for matches longer than len_limit.
    -/// \param      pos             lzma_mf.read_pos + lzma_mf.offset
    -/// \param      cur             Pointer to current byte (mf_ptr(mf))
    -/// \param      cur_match       Start position of the current match candidate
    -/// \param      depth           Maximum length of the hash chain
    -/// \param      son             lzma_mf.son (contains the hash chain)
    -/// \param      cyclic_pos
    -/// \param      cyclic_size
    -/// \param      matches         Array to hold the matches.
    -/// \param      len_best        The length of the longest match found so far.
    -static lzma_match *
    -hc_find_func(
    -		const uint32_t len_limit,
    -		const uint32_t pos,
    -		const uint8_t *const cur,
    -		uint32_t cur_match,
    -		uint32_t depth,
    -		uint32_t *const son,
    -		const uint32_t cyclic_pos,
    -		const uint32_t cyclic_size,
    -		lzma_match *matches,
    -		uint32_t len_best)
    -{
    -	son[cyclic_pos] = cur_match;
    -
    -	while (true) {
    -		const uint32_t delta = pos - cur_match;
    -		if (depth-- == 0 || delta >= cyclic_size)
    -			return matches;
    -
    -		const uint8_t *const pb = cur - delta;
    -		cur_match = son[cyclic_pos - delta
    -				+ (delta > cyclic_pos ? cyclic_size : 0)];
    -
    -		if (pb[len_best] == cur[len_best] && pb[0] == cur[0]) {
    -			uint32_t len = lzma_memcmplen(pb, cur, 1, len_limit);
    -
    -			if (len_best < len) {
    -				len_best = len;
    -				matches->len = len;
    -				matches->dist = delta - 1;
    -				++matches;
    -
    -				if (len == len_limit)
    -					return matches;
    -			}
    -		}
    -	}
    -}
    -
    -
    -#define hc_find(len_best) \
    -	call_find(hc_find_func, len_best)
    -
    -
    -#define hc_skip() \
    -do { \
    -	mf->son[mf->cyclic_pos] = cur_match; \
    -	move_pos(mf); \
    -} while (0)
    -
    -#endif
    -
    -
    -#ifdef HAVE_MF_HC3
    -extern uint32_t
    -lzma_mf_hc3_find(lzma_mf *mf, lzma_match *matches)
    -{
    -	header_find(false, 3);
    -
    -	hash_3_calc();
    -
    -	const uint32_t delta2 = pos - mf->hash[hash_2_value];
    -	const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value];
    -
    -	mf->hash[hash_2_value] = pos;
    -	mf->hash[FIX_3_HASH_SIZE + hash_value] = pos;
    -
    -	uint32_t len_best = 2;
    -
    -	if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) {
    -		len_best = lzma_memcmplen(cur - delta2, cur,
    -				len_best, len_limit);
    -
    -		matches[0].len = len_best;
    -		matches[0].dist = delta2 - 1;
    -		matches_count = 1;
    -
    -		if (len_best == len_limit) {
    -			hc_skip();
    -			return 1; // matches_count
    -		}
    -	}
    -
    -	hc_find(len_best);
    -}
    -
    -
    -extern void
    -lzma_mf_hc3_skip(lzma_mf *mf, uint32_t amount)
    -{
    -	do {
    -		if (mf_avail(mf) < 3) {
    -			move_pending(mf);
    -			continue;
    -		}
    -
    -		const uint8_t *cur = mf_ptr(mf);
    -		const uint32_t pos = mf->read_pos + mf->offset;
    -
    -		hash_3_calc();
    -
    -		const uint32_t cur_match
    -				= mf->hash[FIX_3_HASH_SIZE + hash_value];
    -
    -		mf->hash[hash_2_value] = pos;
    -		mf->hash[FIX_3_HASH_SIZE + hash_value] = pos;
    -
    -		hc_skip();
    -
    -	} while (--amount != 0);
    -}
    -#endif
    -
    -
    -#ifdef HAVE_MF_HC4
    -extern uint32_t
    -lzma_mf_hc4_find(lzma_mf *mf, lzma_match *matches)
    -{
    -	header_find(false, 4);
    -
    -	hash_4_calc();
    -
    -	uint32_t delta2 = pos - mf->hash[hash_2_value];
    -	const uint32_t delta3
    -			= pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value];
    -	const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value];
    -
    -	mf->hash[hash_2_value ] = pos;
    -	mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos;
    -	mf->hash[FIX_4_HASH_SIZE + hash_value] = pos;
    -
    -	uint32_t len_best = 1;
    -
    -	if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) {
    -		len_best = 2;
    -		matches[0].len = 2;
    -		matches[0].dist = delta2 - 1;
    -		matches_count = 1;
    -	}
    -
    -	if (delta2 != delta3 && delta3 < mf->cyclic_size
    -			&& *(cur - delta3) == *cur) {
    -		len_best = 3;
    -		matches[matches_count++].dist = delta3 - 1;
    -		delta2 = delta3;
    -	}
    -
    -	if (matches_count != 0) {
    -		len_best = lzma_memcmplen(cur - delta2, cur,
    -				len_best, len_limit);
    -
    -		matches[matches_count - 1].len = len_best;
    -
    -		if (len_best == len_limit) {
    -			hc_skip();
    -			return matches_count;
    -		}
    -	}
    -
    -	if (len_best < 3)
    -		len_best = 3;
    -
    -	hc_find(len_best);
    -}
    -
    -
    -extern void
    -lzma_mf_hc4_skip(lzma_mf *mf, uint32_t amount)
    -{
    -	do {
    -		if (mf_avail(mf) < 4) {
    -			move_pending(mf);
    -			continue;
    -		}
    -
    -		const uint8_t *cur = mf_ptr(mf);
    -		const uint32_t pos = mf->read_pos + mf->offset;
    -
    -		hash_4_calc();
    -
    -		const uint32_t cur_match
    -				= mf->hash[FIX_4_HASH_SIZE + hash_value];
    -
    -		mf->hash[hash_2_value] = pos;
    -		mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos;
    -		mf->hash[FIX_4_HASH_SIZE + hash_value] = pos;
    -
    -		hc_skip();
    -
    -	} while (--amount != 0);
    -}
    -#endif
    -
    -
    -/////////////////
    -// Binary Tree //
    -/////////////////
    -
    -#if defined(HAVE_MF_BT2) || defined(HAVE_MF_BT3) || defined(HAVE_MF_BT4)
    -static lzma_match *
    -bt_find_func(
    -		const uint32_t len_limit,
    -		const uint32_t pos,
    -		const uint8_t *const cur,
    -		uint32_t cur_match,
    -		uint32_t depth,
    -		uint32_t *const son,
    -		const uint32_t cyclic_pos,
    -		const uint32_t cyclic_size,
    -		lzma_match *matches,
    -		uint32_t len_best)
    -{
    -	uint32_t *ptr0 = son + (cyclic_pos << 1) + 1;
    -	uint32_t *ptr1 = son + (cyclic_pos << 1);
    -
    -	uint32_t len0 = 0;
    -	uint32_t len1 = 0;
    -
    -	while (true) {
    -		const uint32_t delta = pos - cur_match;
    -		if (depth-- == 0 || delta >= cyclic_size) {
    -			*ptr0 = EMPTY_HASH_VALUE;
    -			*ptr1 = EMPTY_HASH_VALUE;
    -			return matches;
    -		}
    -
    -		uint32_t *const pair = son + ((cyclic_pos - delta
    -				+ (delta > cyclic_pos ? cyclic_size : 0))
    -				<< 1);
    -
    -		const uint8_t *const pb = cur - delta;
    -		uint32_t len = my_min(len0, len1);
    -
    -		if (pb[len] == cur[len]) {
    -			len = lzma_memcmplen(pb, cur, len + 1, len_limit);
    -
    -			if (len_best < len) {
    -				len_best = len;
    -				matches->len = len;
    -				matches->dist = delta - 1;
    -				++matches;
    -
    -				if (len == len_limit) {
    -					*ptr1 = pair[0];
    -					*ptr0 = pair[1];
    -					return matches;
    -				}
    -			}
    -		}
    -
    -		if (pb[len] < cur[len]) {
    -			*ptr1 = cur_match;
    -			ptr1 = pair + 1;
    -			cur_match = *ptr1;
    -			len1 = len;
    -		} else {
    -			*ptr0 = cur_match;
    -			ptr0 = pair;
    -			cur_match = *ptr0;
    -			len0 = len;
    -		}
    -	}
    -}
    -
    -
    -static void
    -bt_skip_func(
    -		const uint32_t len_limit,
    -		const uint32_t pos,
    -		const uint8_t *const cur,
    -		uint32_t cur_match,
    -		uint32_t depth,
    -		uint32_t *const son,
    -		const uint32_t cyclic_pos,
    -		const uint32_t cyclic_size)
    -{
    -	uint32_t *ptr0 = son + (cyclic_pos << 1) + 1;
    -	uint32_t *ptr1 = son + (cyclic_pos << 1);
    -
    -	uint32_t len0 = 0;
    -	uint32_t len1 = 0;
    -
    -	while (true) {
    -		const uint32_t delta = pos - cur_match;
    -		if (depth-- == 0 || delta >= cyclic_size) {
    -			*ptr0 = EMPTY_HASH_VALUE;
    -			*ptr1 = EMPTY_HASH_VALUE;
    -			return;
    -		}
    -
    -		uint32_t *pair = son + ((cyclic_pos - delta
    -				+ (delta > cyclic_pos ? cyclic_size : 0))
    -				<< 1);
    -		const uint8_t *pb = cur - delta;
    -		uint32_t len = my_min(len0, len1);
    -
    -		if (pb[len] == cur[len]) {
    -			len = lzma_memcmplen(pb, cur, len + 1, len_limit);
    -
    -			if (len == len_limit) {
    -				*ptr1 = pair[0];
    -				*ptr0 = pair[1];
    -				return;
    -			}
    -		}
    -
    -		if (pb[len] < cur[len]) {
    -			*ptr1 = cur_match;
    -			ptr1 = pair + 1;
    -			cur_match = *ptr1;
    -			len1 = len;
    -		} else {
    -			*ptr0 = cur_match;
    -			ptr0 = pair;
    -			cur_match = *ptr0;
    -			len0 = len;
    -		}
    -	}
    -}
    -
    -
    -#define bt_find(len_best) \
    -	call_find(bt_find_func, len_best)
    -
    -#define bt_skip() \
    -do { \
    -	bt_skip_func(len_limit, pos, cur, cur_match, mf->depth, \
    -			mf->son, mf->cyclic_pos, \
    -			mf->cyclic_size); \
    -	move_pos(mf); \
    -} while (0)
    -
    -#endif
    -
    -
    -#ifdef HAVE_MF_BT2
    -extern uint32_t
    -lzma_mf_bt2_find(lzma_mf *mf, lzma_match *matches)
    -{
    -	header_find(true, 2);
    -
    -	hash_2_calc();
    -
    -	const uint32_t cur_match = mf->hash[hash_value];
    -	mf->hash[hash_value] = pos;
    -
    -	bt_find(1);
    -}
    -
    -
    -extern void
    -lzma_mf_bt2_skip(lzma_mf *mf, uint32_t amount)
    -{
    -	do {
    -		header_skip(true, 2);
    -
    -		hash_2_calc();
    -
    -		const uint32_t cur_match = mf->hash[hash_value];
    -		mf->hash[hash_value] = pos;
    -
    -		bt_skip();
    -
    -	} while (--amount != 0);
    -}
    -#endif
    -
    -
    -#ifdef HAVE_MF_BT3
    -extern uint32_t
    -lzma_mf_bt3_find(lzma_mf *mf, lzma_match *matches)
    -{
    -	header_find(true, 3);
    -
    -	hash_3_calc();
    -
    -	const uint32_t delta2 = pos - mf->hash[hash_2_value];
    -	const uint32_t cur_match = mf->hash[FIX_3_HASH_SIZE + hash_value];
    -
    -	mf->hash[hash_2_value] = pos;
    -	mf->hash[FIX_3_HASH_SIZE + hash_value] = pos;
    -
    -	uint32_t len_best = 2;
    -
    -	if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) {
    -		len_best = lzma_memcmplen(
    -				cur, cur - delta2, len_best, len_limit);
    -
    -		matches[0].len = len_best;
    -		matches[0].dist = delta2 - 1;
    -		matches_count = 1;
    -
    -		if (len_best == len_limit) {
    -			bt_skip();
    -			return 1; // matches_count
    -		}
    -	}
    -
    -	bt_find(len_best);
    -}
    -
    -
    -extern void
    -lzma_mf_bt3_skip(lzma_mf *mf, uint32_t amount)
    -{
    -	do {
    -		header_skip(true, 3);
    -
    -		hash_3_calc();
    -
    -		const uint32_t cur_match
    -				= mf->hash[FIX_3_HASH_SIZE + hash_value];
    -
    -		mf->hash[hash_2_value] = pos;
    -		mf->hash[FIX_3_HASH_SIZE + hash_value] = pos;
    -
    -		bt_skip();
    -
    -	} while (--amount != 0);
    -}
    -#endif
    -
    -
    -#ifdef HAVE_MF_BT4
    -extern uint32_t
    -lzma_mf_bt4_find(lzma_mf *mf, lzma_match *matches)
    -{
    -	header_find(true, 4);
    -
    -	hash_4_calc();
    -
    -	uint32_t delta2 = pos - mf->hash[hash_2_value];
    -	const uint32_t delta3
    -			= pos - mf->hash[FIX_3_HASH_SIZE + hash_3_value];
    -	const uint32_t cur_match = mf->hash[FIX_4_HASH_SIZE + hash_value];
    -
    -	mf->hash[hash_2_value] = pos;
    -	mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos;
    -	mf->hash[FIX_4_HASH_SIZE + hash_value] = pos;
    -
    -	uint32_t len_best = 1;
    -
    -	if (delta2 < mf->cyclic_size && *(cur - delta2) == *cur) {
    -		len_best = 2;
    -		matches[0].len = 2;
    -		matches[0].dist = delta2 - 1;
    -		matches_count = 1;
    -	}
    -
    -	if (delta2 != delta3 && delta3 < mf->cyclic_size
    -			&& *(cur - delta3) == *cur) {
    -		len_best = 3;
    -		matches[matches_count++].dist = delta3 - 1;
    -		delta2 = delta3;
    -	}
    -
    -	if (matches_count != 0) {
    -		len_best = lzma_memcmplen(
    -				cur, cur - delta2, len_best, len_limit);
    -
    -		matches[matches_count - 1].len = len_best;
    -
    -		if (len_best == len_limit) {
    -			bt_skip();
    -			return matches_count;
    -		}
    -	}
    -
    -	if (len_best < 3)
    -		len_best = 3;
    -
    -	bt_find(len_best);
    -}
    -
    -
    -extern void
    -lzma_mf_bt4_skip(lzma_mf *mf, uint32_t amount)
    -{
    -	do {
    -		header_skip(true, 4);
    -
    -		hash_4_calc();
    -
    -		const uint32_t cur_match
    -				= mf->hash[FIX_4_HASH_SIZE + hash_value];
    -
    -		mf->hash[hash_2_value] = pos;
    -		mf->hash[FIX_3_HASH_SIZE + hash_3_value] = pos;
    -		mf->hash[FIX_4_HASH_SIZE + hash_value] = pos;
    -
    -		bt_skip();
    -
    -	} while (--amount != 0);
    -}
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/fastpos.h b/external/public-domain/xz/dist/src/liblzma/lzma/fastpos.h
    deleted file mode 100644
    index a3feea58d..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/fastpos.h
    +++ /dev/null
    @@ -1,141 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       fastpos.h
    -/// \brief      Kind of two-bit version of bit scan reverse
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_FASTPOS_H
    -#define LZMA_FASTPOS_H
    -
    -// LZMA encodes match distances by storing the highest two bits using
    -// a six-bit value [0, 63], and then the missing lower bits.
    -// Dictionary size is also stored using this encoding in the .xz
    -// file format header.
    -//
    -// fastpos.h provides a way to quickly find out the correct six-bit
    -// values. The following table gives some examples of this encoding:
    -//
    -//     dist   return
    -//       0       0
    -//       1       1
    -//       2       2
    -//       3       3
    -//       4       4
    -//       5       4
    -//       6       5
    -//       7       5
    -//       8       6
    -//      11       6
    -//      12       7
    -//     ...      ...
    -//      15       7
    -//      16       8
    -//      17       8
    -//     ...      ...
    -//      23       8
    -//      24       9
    -//      25       9
    -//     ...      ...
    -//
    -//
    -// Provided functions or macros
    -// ----------------------------
    -//
    -// get_dist_slot(dist) is the basic version. get_dist_slot_2(dist)
    -// assumes that dist >= FULL_DISTANCES, thus the result is at least
    -// FULL_DISTANCES_BITS * 2. Using get_dist_slot(dist) instead of
    -// get_dist_slot_2(dist) would give the same result, but get_dist_slot_2(dist)
    -// should be tiny bit faster due to the assumption being made.
    -//
    -//
    -// Size vs. speed
    -// --------------
    -//
    -// With some CPUs that have fast BSR (bit scan reverse) instruction, the
    -// size optimized version is slightly faster than the bigger table based
    -// approach. Such CPUs include Intel Pentium Pro, Pentium II, Pentium III
    -// and Core 2 (possibly others). AMD K7 seems to have slower BSR, but that
    -// would still have speed roughly comparable to the table version. Older
    -// x86 CPUs like the original Pentium have very slow BSR; on those systems
    -// the table version is a lot faster.
    -//
    -// On some CPUs, the table version is a lot faster when using position
    -// dependent code, but with position independent code the size optimized
    -// version is slightly faster. This occurs at least on 32-bit SPARC (no
    -// ASM optimizations).
    -//
    -// I'm making the table version the default, because that has good speed
    -// on all systems I have tried. The size optimized version is sometimes
    -// slightly faster, but sometimes it is a lot slower.
    -
    -#ifdef HAVE_SMALL
    -#	define get_dist_slot(dist) \
    -		((dist) <= 4 ? (dist) : get_dist_slot_2(dist))
    -
    -static inline uint32_t
    -get_dist_slot_2(uint32_t dist)
    -{
    -	const uint32_t i = bsr32(dist);
    -	return (i + i) + ((dist >> (i - 1)) & 1);
    -}
    -
    -
    -#else
    -
    -#define FASTPOS_BITS 13
    -
    -extern const uint8_t lzma_fastpos[1 << FASTPOS_BITS];
    -
    -
    -#define fastpos_shift(extra, n) \
    -	((extra) + (n) * (FASTPOS_BITS - 1))
    -
    -#define fastpos_limit(extra, n) \
    -	(UINT32_C(1) << (FASTPOS_BITS + fastpos_shift(extra, n)))
    -
    -#define fastpos_result(dist, extra, n) \
    -	lzma_fastpos[(dist) >> fastpos_shift(extra, n)] \
    -			+ 2 * fastpos_shift(extra, n)
    -
    -
    -static inline uint32_t
    -get_dist_slot(uint32_t dist)
    -{
    -	// If it is small enough, we can pick the result directly from
    -	// the precalculated table.
    -	if (dist < fastpos_limit(0, 0))
    -		return lzma_fastpos[dist];
    -
    -	if (dist < fastpos_limit(0, 1))
    -		return fastpos_result(dist, 0, 1);
    -
    -	return fastpos_result(dist, 0, 2);
    -}
    -
    -
    -#ifdef FULL_DISTANCES_BITS
    -static inline uint32_t
    -get_dist_slot_2(uint32_t dist)
    -{
    -	assert(dist >= FULL_DISTANCES);
    -
    -	if (dist < fastpos_limit(FULL_DISTANCES_BITS - 1, 0))
    -		return fastpos_result(dist, FULL_DISTANCES_BITS - 1, 0);
    -
    -	if (dist < fastpos_limit(FULL_DISTANCES_BITS - 1, 1))
    -		return fastpos_result(dist, FULL_DISTANCES_BITS - 1, 1);
    -
    -	return fastpos_result(dist, FULL_DISTANCES_BITS - 1, 2);
    -}
    -#endif
    -
    -#endif
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/fastpos_table.c b/external/public-domain/xz/dist/src/liblzma/lzma/fastpos_table.c
    deleted file mode 100644
    index 6a3ceac0e..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/fastpos_table.c
    +++ /dev/null
    @@ -1,519 +0,0 @@
    -/* This file has been automatically generated by fastpos_tablegen.c. */
    -
    -#include "common.h"
    -#include "fastpos.h"
    -
    -const uint8_t lzma_fastpos[1 << FASTPOS_BITS] = {
    -	  0,  1,  2,  3,  4,  4,  5,  5,  6,  6,  6,  6,  7,  7,  7,  7,
    -	  8,  8,  8,  8,  8,  8,  8,  8,  9,  9,  9,  9,  9,  9,  9,  9,
    -	 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
    -	 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
    -	 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
    -	 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
    -	 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
    -	 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
    -	 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
    -	 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
    -	 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
    -	 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
    -	 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    -	 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    -	 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    -	 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
    -	 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
    -	 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
    -	 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
    -	 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
    -	 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
    -	 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
    -	 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
    -	 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
    -	 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    -	 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    -	 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    -	 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    -	 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    -	 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    -	 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    -	 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
    -	 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25
    -};
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/fastpos_tablegen.c b/external/public-domain/xz/dist/src/liblzma/lzma/fastpos_tablegen.c
    deleted file mode 100644
    index c97e6f411..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/fastpos_tablegen.c
    +++ /dev/null
    @@ -1,56 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       fastpos_tablegen.c
    -/// \brief      Generates the lzma_fastpos[] lookup table
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include 
    -#include 
    -#include 
    -#include "fastpos.h"
    -
    -
    -int
    -main(void)
    -{
    -	uint8_t fastpos[1 << FASTPOS_BITS];
    -
    -	const uint8_t fast_slots = 2 * FASTPOS_BITS;
    -	uint32_t c = 2;
    -
    -	fastpos[0] = 0;
    -	fastpos[1] = 1;
    -
    -	for (uint8_t slot_fast = 2; slot_fast < fast_slots; ++slot_fast) {
    -		const uint32_t k = 1 << ((slot_fast >> 1) - 1);
    -		for (uint32_t j = 0; j < k; ++j, ++c)
    -			fastpos[c] = slot_fast;
    -	}
    -
    -	printf("/* This file has been automatically generated "
    -			"by fastpos_tablegen.c. */\n\n"
    -			"#include \"common.h\"\n"
    -			"#include \"fastpos.h\"\n\n"
    -			"const uint8_t lzma_fastpos[1 << FASTPOS_BITS] = {");
    -
    -	for (size_t i = 0; i < (1 << FASTPOS_BITS); ++i) {
    -		if (i % 16 == 0)
    -			printf("\n\t");
    -
    -		printf("%3u", (unsigned int)(fastpos[i]));
    -
    -		if (i != (1 << FASTPOS_BITS) - 1)
    -			printf(",");
    -	}
    -
    -	printf("\n};\n");
    -
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_decoder.c b/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_decoder.c
    deleted file mode 100644
    index 84982d2c4..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_decoder.c
    +++ /dev/null
    @@ -1,304 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma2_decoder.c
    -/// \brief      LZMA2 decoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "lzma2_decoder.h"
    -#include "lz_decoder.h"
    -#include "lzma_decoder.h"
    -
    -
    -struct lzma_coder_s {
    -	enum sequence {
    -		SEQ_CONTROL,
    -		SEQ_UNCOMPRESSED_1,
    -		SEQ_UNCOMPRESSED_2,
    -		SEQ_COMPRESSED_0,
    -		SEQ_COMPRESSED_1,
    -		SEQ_PROPERTIES,
    -		SEQ_LZMA,
    -		SEQ_COPY,
    -	} sequence;
    -
    -	/// Sequence after the size fields have been decoded.
    -	enum sequence next_sequence;
    -
    -	/// LZMA decoder
    -	lzma_lz_decoder lzma;
    -
    -	/// Uncompressed size of LZMA chunk
    -	size_t uncompressed_size;
    -
    -	/// Compressed size of the chunk (naturally equals to uncompressed
    -	/// size of uncompressed chunk)
    -	size_t compressed_size;
    -
    -	/// True if properties are needed. This is false before the
    -	/// first LZMA chunk.
    -	bool need_properties;
    -
    -	/// True if dictionary reset is needed. This is false before the
    -	/// first chunk (LZMA or uncompressed).
    -	bool need_dictionary_reset;
    -
    -	lzma_options_lzma options;
    -};
    -
    -
    -static lzma_ret
    -lzma2_decode(lzma_coder *restrict coder, lzma_dict *restrict dict,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size)
    -{
    -	// With SEQ_LZMA it is possible that no new input is needed to do
    -	// some progress. The rest of the sequences assume that there is
    -	// at least one byte of input.
    -	while (*in_pos < in_size || coder->sequence == SEQ_LZMA)
    -	switch (coder->sequence) {
    -	case SEQ_CONTROL: {
    -		const uint32_t control = in[*in_pos];
    -		++*in_pos;
    -
    -		// End marker
    -		if (control == 0x00)
    -			return LZMA_STREAM_END;
    -
    -		if (control >= 0xE0 || control == 1) {
    -			// Dictionary reset implies that next LZMA chunk has
    -			// to set new properties.
    -			coder->need_properties = true;
    -			coder->need_dictionary_reset = true;
    -		} else if (coder->need_dictionary_reset) {
    -			return LZMA_DATA_ERROR;
    -		}
    -
    -		if (control >= 0x80) {
    -			// LZMA chunk. The highest five bits of the
    -			// uncompressed size are taken from the control byte.
    -			coder->uncompressed_size = (control & 0x1F) << 16;
    -			coder->sequence = SEQ_UNCOMPRESSED_1;
    -
    -			// See if there are new properties or if we need to
    -			// reset the state.
    -			if (control >= 0xC0) {
    -				// When there are new properties, state reset
    -				// is done at SEQ_PROPERTIES.
    -				coder->need_properties = false;
    -				coder->next_sequence = SEQ_PROPERTIES;
    -
    -			} else if (coder->need_properties) {
    -				return LZMA_DATA_ERROR;
    -
    -			} else {
    -				coder->next_sequence = SEQ_LZMA;
    -
    -				// If only state reset is wanted with old
    -				// properties, do the resetting here for
    -				// simplicity.
    -				if (control >= 0xA0)
    -					coder->lzma.reset(coder->lzma.coder,
    -							&coder->options);
    -			}
    -		} else {
    -			// Invalid control values
    -			if (control > 2)
    -				return LZMA_DATA_ERROR;
    -
    -			// It's uncompressed chunk
    -			coder->sequence = SEQ_COMPRESSED_0;
    -			coder->next_sequence = SEQ_COPY;
    -		}
    -
    -		if (coder->need_dictionary_reset) {
    -			// Finish the dictionary reset and let the caller
    -			// flush the dictionary to the actual output buffer.
    -			coder->need_dictionary_reset = false;
    -			dict_reset(dict);
    -			return LZMA_OK;
    -		}
    -
    -		break;
    -	}
    -
    -	case SEQ_UNCOMPRESSED_1:
    -		coder->uncompressed_size += (uint32_t)(in[(*in_pos)++]) << 8;
    -		coder->sequence = SEQ_UNCOMPRESSED_2;
    -		break;
    -
    -	case SEQ_UNCOMPRESSED_2:
    -		coder->uncompressed_size += in[(*in_pos)++] + 1;
    -		coder->sequence = SEQ_COMPRESSED_0;
    -		coder->lzma.set_uncompressed(coder->lzma.coder,
    -				coder->uncompressed_size);
    -		break;
    -
    -	case SEQ_COMPRESSED_0:
    -		coder->compressed_size = (uint32_t)(in[(*in_pos)++]) << 8;
    -		coder->sequence = SEQ_COMPRESSED_1;
    -		break;
    -
    -	case SEQ_COMPRESSED_1:
    -		coder->compressed_size += in[(*in_pos)++] + 1;
    -		coder->sequence = coder->next_sequence;
    -		break;
    -
    -	case SEQ_PROPERTIES:
    -		if (lzma_lzma_lclppb_decode(&coder->options, in[(*in_pos)++]))
    -			return LZMA_DATA_ERROR;
    -
    -		coder->lzma.reset(coder->lzma.coder, &coder->options);
    -
    -		coder->sequence = SEQ_LZMA;
    -		break;
    -
    -	case SEQ_LZMA: {
    -		// Store the start offset so that we can update
    -		// coder->compressed_size later.
    -		const size_t in_start = *in_pos;
    -
    -		// Decode from in[] to *dict.
    -		const lzma_ret ret = coder->lzma.code(coder->lzma.coder,
    -				dict, in, in_pos, in_size);
    -
    -		// Validate and update coder->compressed_size.
    -		const size_t in_used = *in_pos - in_start;
    -		if (in_used > coder->compressed_size)
    -			return LZMA_DATA_ERROR;
    -
    -		coder->compressed_size -= in_used;
    -
    -		// Return if we didn't finish the chunk, or an error occurred.
    -		if (ret != LZMA_STREAM_END)
    -			return ret;
    -
    -		// The LZMA decoder must have consumed the whole chunk now.
    -		// We don't need to worry about uncompressed size since it
    -		// is checked by the LZMA decoder.
    -		if (coder->compressed_size != 0)
    -			return LZMA_DATA_ERROR;
    -
    -		coder->sequence = SEQ_CONTROL;
    -		break;
    -	}
    -
    -	case SEQ_COPY: {
    -		// Copy from input to the dictionary as is.
    -		dict_write(dict, in, in_pos, in_size, &coder->compressed_size);
    -		if (coder->compressed_size != 0)
    -			return LZMA_OK;
    -
    -		coder->sequence = SEQ_CONTROL;
    -		break;
    -	}
    -
    -	default:
    -		assert(0);
    -		return LZMA_PROG_ERROR;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static void
    -lzma2_decoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	assert(coder->lzma.end == NULL);
    -	lzma_free(coder->lzma.coder, allocator);
    -
    -	lzma_free(coder, allocator);
    -
    -	return;
    -}
    -
    -
    -static lzma_ret
    -lzma2_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
    -		const void *opt, lzma_lz_options *lz_options)
    -{
    -	if (lz->coder == NULL) {
    -		lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (lz->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		lz->code = &lzma2_decode;
    -		lz->end = &lzma2_decoder_end;
    -
    -		lz->coder->lzma = LZMA_LZ_DECODER_INIT;
    -	}
    -
    -	const lzma_options_lzma *options = opt;
    -
    -	lz->coder->sequence = SEQ_CONTROL;
    -	lz->coder->need_properties = true;
    -	lz->coder->need_dictionary_reset = options->preset_dict == NULL
    -			|| options->preset_dict_size == 0;
    -
    -	return lzma_lzma_decoder_create(&lz->coder->lzma,
    -			allocator, options, lz_options);
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma2_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	// LZMA2 can only be the last filter in the chain. This is enforced
    -	// by the raw_decoder initialization.
    -	assert(filters[1].init == NULL);
    -
    -	return lzma_lz_decoder_init(next, allocator, filters,
    -			&lzma2_decoder_init);
    -}
    -
    -
    -extern uint64_t
    -lzma_lzma2_decoder_memusage(const void *options)
    -{
    -	return sizeof(lzma_coder)
    -			+ lzma_lzma_decoder_memusage_nocheck(options);
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma2_props_decode(void **options, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size)
    -{
    -	if (props_size != 1)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Check that reserved bits are unset.
    -	if (props[0] & 0xC0)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Decode the dictionary size.
    -	if (props[0] > 40)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	lzma_options_lzma *opt = lzma_alloc(
    -			sizeof(lzma_options_lzma), allocator);
    -	if (opt == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	if (props[0] == 40) {
    -		opt->dict_size = UINT32_MAX;
    -	} else {
    -		opt->dict_size = 2 | (props[0] & 1);
    -		opt->dict_size <<= props[0] / 2 + 11;
    -	}
    -
    -	opt->preset_dict = NULL;
    -	opt->preset_dict_size = 0;
    -
    -	*options = opt;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_decoder.h b/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_decoder.h
    deleted file mode 100644
    index ef2dcbfa7..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_decoder.h
    +++ /dev/null
    @@ -1,29 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma2_decoder.h
    -/// \brief      LZMA2 decoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZMA2_DECODER_H
    -#define LZMA_LZMA2_DECODER_H
    -
    -#include "common.h"
    -
    -extern lzma_ret lzma_lzma2_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern uint64_t lzma_lzma2_decoder_memusage(const void *options);
    -
    -extern lzma_ret lzma_lzma2_props_decode(
    -		void **options, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_encoder.c b/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_encoder.c
    deleted file mode 100644
    index b6756bfc2..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_encoder.c
    +++ /dev/null
    @@ -1,403 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma2_encoder.c
    -/// \brief      LZMA2 encoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "lz_encoder.h"
    -#include "lzma_encoder.h"
    -#include "fastpos.h"
    -#include "lzma2_encoder.h"
    -
    -
    -struct lzma_coder_s {
    -	enum {
    -		SEQ_INIT,
    -		SEQ_LZMA_ENCODE,
    -		SEQ_LZMA_COPY,
    -		SEQ_UNCOMPRESSED_HEADER,
    -		SEQ_UNCOMPRESSED_COPY,
    -	} sequence;
    -
    -	/// LZMA encoder
    -	lzma_coder *lzma;
    -
    -	/// LZMA options currently in use.
    -	lzma_options_lzma opt_cur;
    -
    -	bool need_properties;
    -	bool need_state_reset;
    -	bool need_dictionary_reset;
    -
    -	/// Uncompressed size of a chunk
    -	size_t uncompressed_size;
    -
    -	/// Compressed size of a chunk (excluding headers); this is also used
    -	/// to indicate the end of buf[] in SEQ_LZMA_COPY.
    -	size_t compressed_size;
    -
    -	/// Read position in buf[]
    -	size_t buf_pos;
    -
    -	/// Buffer to hold the chunk header and LZMA compressed data
    -	uint8_t buf[LZMA2_HEADER_MAX + LZMA2_CHUNK_MAX];
    -};
    -
    -
    -static void
    -lzma2_header_lzma(lzma_coder *coder)
    -{
    -	assert(coder->uncompressed_size > 0);
    -	assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX);
    -	assert(coder->compressed_size > 0);
    -	assert(coder->compressed_size <= LZMA2_CHUNK_MAX);
    -
    -	size_t pos;
    -
    -	if (coder->need_properties) {
    -		pos = 0;
    -
    -		if (coder->need_dictionary_reset)
    -			coder->buf[pos] = 0x80 + (3 << 5);
    -		else
    -			coder->buf[pos] = 0x80 + (2 << 5);
    -	} else {
    -		pos = 1;
    -
    -		if (coder->need_state_reset)
    -			coder->buf[pos] = 0x80 + (1 << 5);
    -		else
    -			coder->buf[pos] = 0x80;
    -	}
    -
    -	// Set the start position for copying.
    -	coder->buf_pos = pos;
    -
    -	// Uncompressed size
    -	size_t size = coder->uncompressed_size - 1;
    -	coder->buf[pos++] += size >> 16;
    -	coder->buf[pos++] = (size >> 8) & 0xFF;
    -	coder->buf[pos++] = size & 0xFF;
    -
    -	// Compressed size
    -	size = coder->compressed_size - 1;
    -	coder->buf[pos++] = size >> 8;
    -	coder->buf[pos++] = size & 0xFF;
    -
    -	// Properties, if needed
    -	if (coder->need_properties)
    -		lzma_lzma_lclppb_encode(&coder->opt_cur, coder->buf + pos);
    -
    -	coder->need_properties = false;
    -	coder->need_state_reset = false;
    -	coder->need_dictionary_reset = false;
    -
    -	// The copying code uses coder->compressed_size to indicate the end
    -	// of coder->buf[], so we need add the maximum size of the header here.
    -	coder->compressed_size += LZMA2_HEADER_MAX;
    -
    -	return;
    -}
    -
    -
    -static void
    -lzma2_header_uncompressed(lzma_coder *coder)
    -{
    -	assert(coder->uncompressed_size > 0);
    -	assert(coder->uncompressed_size <= LZMA2_CHUNK_MAX);
    -
    -	// If this is the first chunk, we need to include dictionary
    -	// reset indicator.
    -	if (coder->need_dictionary_reset)
    -		coder->buf[0] = 1;
    -	else
    -		coder->buf[0] = 2;
    -
    -	coder->need_dictionary_reset = false;
    -
    -	// "Compressed" size
    -	coder->buf[1] = (coder->uncompressed_size - 1) >> 8;
    -	coder->buf[2] = (coder->uncompressed_size - 1) & 0xFF;
    -
    -	// Set the start position for copying.
    -	coder->buf_pos = 0;
    -	return;
    -}
    -
    -
    -static lzma_ret
    -lzma2_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
    -		uint8_t *restrict out, size_t *restrict out_pos,
    -		size_t out_size)
    -{
    -	while (*out_pos < out_size)
    -	switch (coder->sequence) {
    -	case SEQ_INIT:
    -		// If there's no input left and we are flushing or finishing,
    -		// don't start a new chunk.
    -		if (mf_unencoded(mf) == 0) {
    -			// Write end of payload marker if finishing.
    -			if (mf->action == LZMA_FINISH)
    -				out[(*out_pos)++] = 0;
    -
    -			return mf->action == LZMA_RUN
    -					? LZMA_OK : LZMA_STREAM_END;
    -		}
    -
    -		if (coder->need_state_reset)
    -			return_if_error(lzma_lzma_encoder_reset(
    -					coder->lzma, &coder->opt_cur));
    -
    -		coder->uncompressed_size = 0;
    -		coder->compressed_size = 0;
    -		coder->sequence = SEQ_LZMA_ENCODE;
    -
    -	// Fall through
    -
    -	case SEQ_LZMA_ENCODE: {
    -		// Calculate how much more uncompressed data this chunk
    -		// could accept.
    -		const uint32_t left = LZMA2_UNCOMPRESSED_MAX
    -				- coder->uncompressed_size;
    -		uint32_t limit;
    -
    -		if (left < mf->match_len_max) {
    -			// Must flush immediately since the next LZMA symbol
    -			// could make the uncompressed size of the chunk too
    -			// big.
    -			limit = 0;
    -		} else {
    -			// Calculate maximum read_limit that is OK from point
    -			// of view of LZMA2 chunk size.
    -			limit = mf->read_pos - mf->read_ahead
    -					+ left - mf->match_len_max;
    -		}
    -
    -		// Save the start position so that we can update
    -		// coder->uncompressed_size.
    -		const uint32_t read_start = mf->read_pos - mf->read_ahead;
    -
    -		// Call the LZMA encoder until the chunk is finished.
    -		const lzma_ret ret = lzma_lzma_encode(coder->lzma, mf,
    -				coder->buf + LZMA2_HEADER_MAX,
    -				&coder->compressed_size,
    -				LZMA2_CHUNK_MAX, limit);
    -
    -		coder->uncompressed_size += mf->read_pos - mf->read_ahead
    -				- read_start;
    -
    -		assert(coder->compressed_size <= LZMA2_CHUNK_MAX);
    -		assert(coder->uncompressed_size <= LZMA2_UNCOMPRESSED_MAX);
    -
    -		if (ret != LZMA_STREAM_END)
    -			return LZMA_OK;
    -
    -		// See if the chunk compressed. If it didn't, we encode it
    -		// as uncompressed chunk. This saves a few bytes of space
    -		// and makes decoding faster.
    -		if (coder->compressed_size >= coder->uncompressed_size) {
    -			coder->uncompressed_size += mf->read_ahead;
    -			assert(coder->uncompressed_size
    -					<= LZMA2_UNCOMPRESSED_MAX);
    -			mf->read_ahead = 0;
    -			lzma2_header_uncompressed(coder);
    -			coder->need_state_reset = true;
    -			coder->sequence = SEQ_UNCOMPRESSED_HEADER;
    -			break;
    -		}
    -
    -		// The chunk did compress at least by one byte, so we store
    -		// the chunk as LZMA.
    -		lzma2_header_lzma(coder);
    -
    -		coder->sequence = SEQ_LZMA_COPY;
    -	}
    -
    -	// Fall through
    -
    -	case SEQ_LZMA_COPY:
    -		// Copy the compressed chunk along its headers to the
    -		// output buffer.
    -		lzma_bufcpy(coder->buf, &coder->buf_pos,
    -				coder->compressed_size,
    -				out, out_pos, out_size);
    -		if (coder->buf_pos != coder->compressed_size)
    -			return LZMA_OK;
    -
    -		coder->sequence = SEQ_INIT;
    -		break;
    -
    -	case SEQ_UNCOMPRESSED_HEADER:
    -		// Copy the three-byte header to indicate uncompressed chunk.
    -		lzma_bufcpy(coder->buf, &coder->buf_pos,
    -				LZMA2_HEADER_UNCOMPRESSED,
    -				out, out_pos, out_size);
    -		if (coder->buf_pos != LZMA2_HEADER_UNCOMPRESSED)
    -			return LZMA_OK;
    -
    -		coder->sequence = SEQ_UNCOMPRESSED_COPY;
    -
    -	// Fall through
    -
    -	case SEQ_UNCOMPRESSED_COPY:
    -		// Copy the uncompressed data as is from the dictionary
    -		// to the output buffer.
    -		mf_read(mf, out, out_pos, out_size, &coder->uncompressed_size);
    -		if (coder->uncompressed_size != 0)
    -			return LZMA_OK;
    -
    -		coder->sequence = SEQ_INIT;
    -		break;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static void
    -lzma2_encoder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_free(coder->lzma, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_ret
    -lzma2_encoder_options_update(lzma_coder *coder, const lzma_filter *filter)
    -{
    -	// New options can be set only when there is no incomplete chunk.
    -	// This is the case at the beginning of the raw stream and right
    -	// after LZMA_SYNC_FLUSH.
    -	if (filter->options == NULL || coder->sequence != SEQ_INIT)
    -		return LZMA_PROG_ERROR;
    -
    -	// Look if there are new options. At least for now,
    -	// only lc/lp/pb can be changed.
    -	const lzma_options_lzma *opt = filter->options;
    -	if (coder->opt_cur.lc != opt->lc || coder->opt_cur.lp != opt->lp
    -			|| coder->opt_cur.pb != opt->pb) {
    -		// Validate the options.
    -		if (opt->lc > LZMA_LCLP_MAX || opt->lp > LZMA_LCLP_MAX
    -				|| opt->lc + opt->lp > LZMA_LCLP_MAX
    -				|| opt->pb > LZMA_PB_MAX)
    -			return LZMA_OPTIONS_ERROR;
    -
    -		// The new options will be used when the encoder starts
    -		// a new LZMA2 chunk.
    -		coder->opt_cur.lc = opt->lc;
    -		coder->opt_cur.lp = opt->lp;
    -		coder->opt_cur.pb = opt->pb;
    -		coder->need_properties = true;
    -		coder->need_state_reset = true;
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static lzma_ret
    -lzma2_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
    -		const void *options, lzma_lz_options *lz_options)
    -{
    -	if (options == NULL)
    -		return LZMA_PROG_ERROR;
    -
    -	if (lz->coder == NULL) {
    -		lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (lz->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		lz->code = &lzma2_encode;
    -		lz->end = &lzma2_encoder_end;
    -		lz->options_update = &lzma2_encoder_options_update;
    -
    -		lz->coder->lzma = NULL;
    -	}
    -
    -	lz->coder->opt_cur = *(const lzma_options_lzma *)(options);
    -
    -	lz->coder->sequence = SEQ_INIT;
    -	lz->coder->need_properties = true;
    -	lz->coder->need_state_reset = false;
    -	lz->coder->need_dictionary_reset
    -			= lz->coder->opt_cur.preset_dict == NULL
    -			|| lz->coder->opt_cur.preset_dict_size == 0;
    -
    -	// Initialize LZMA encoder
    -	return_if_error(lzma_lzma_encoder_create(&lz->coder->lzma, allocator,
    -			&lz->coder->opt_cur, lz_options));
    -
    -	// Make sure that we will always have enough history available in
    -	// case we need to use uncompressed chunks. They are used when the
    -	// compressed size of a chunk is not smaller than the uncompressed
    -	// size, so we need to have at least LZMA2_COMPRESSED_MAX bytes
    -	// history available.
    -	if (lz_options->before_size + lz_options->dict_size < LZMA2_CHUNK_MAX)
    -		lz_options->before_size
    -				= LZMA2_CHUNK_MAX - lz_options->dict_size;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma2_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return lzma_lz_encoder_init(
    -			next, allocator, filters, &lzma2_encoder_init);
    -}
    -
    -
    -extern uint64_t
    -lzma_lzma2_encoder_memusage(const void *options)
    -{
    -	const uint64_t lzma_mem = lzma_lzma_encoder_memusage(options);
    -	if (lzma_mem == UINT64_MAX)
    -		return UINT64_MAX;
    -
    -	return sizeof(lzma_coder) + lzma_mem;
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma2_props_encode(const void *options, uint8_t *out)
    -{
    -	const lzma_options_lzma *const opt = options;
    -	uint32_t d = my_max(opt->dict_size, LZMA_DICT_SIZE_MIN);
    -
    -	// Round up to the next 2^n - 1 or 2^n + 2^(n - 1) - 1 depending
    -	// on which one is the next:
    -	--d;
    -	d |= d >> 2;
    -	d |= d >> 3;
    -	d |= d >> 4;
    -	d |= d >> 8;
    -	d |= d >> 16;
    -
    -	// Get the highest two bits using the proper encoding:
    -	if (d == UINT32_MAX)
    -		out[0] = 40;
    -	else
    -		out[0] = get_dist_slot(d + 1) - 24;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern uint64_t
    -lzma_lzma2_block_size(const void *options)
    -{
    -	const lzma_options_lzma *const opt = options;
    -
    -	// Use at least 1 MiB to keep compression ratio better.
    -	return my_max((uint64_t)(opt->dict_size) * 3, UINT64_C(1) << 20);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_encoder.h b/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_encoder.h
    deleted file mode 100644
    index 515f18393..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma2_encoder.h
    +++ /dev/null
    @@ -1,43 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma2_encoder.h
    -/// \brief      LZMA2 encoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZMA2_ENCODER_H
    -#define LZMA_LZMA2_ENCODER_H
    -
    -#include "common.h"
    -
    -
    -/// Maximum number of bytes of actual data per chunk (no headers)
    -#define LZMA2_CHUNK_MAX (UINT32_C(1) << 16)
    -
    -/// Maximum uncompressed size of LZMA chunk (no headers)
    -#define LZMA2_UNCOMPRESSED_MAX (UINT32_C(1) << 21)
    -
    -/// Maximum size of LZMA2 headers
    -#define LZMA2_HEADER_MAX 6
    -
    -/// Size of a header for uncompressed chunk
    -#define LZMA2_HEADER_UNCOMPRESSED 3
    -
    -
    -extern lzma_ret lzma_lzma2_encoder_init(
    -		lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern uint64_t lzma_lzma2_encoder_memusage(const void *options);
    -
    -extern lzma_ret lzma_lzma2_props_encode(const void *options, uint8_t *out);
    -
    -extern uint64_t lzma_lzma2_block_size(const void *options);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_common.h b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_common.h
    deleted file mode 100644
    index 09efd3872..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_common.h
    +++ /dev/null
    @@ -1,224 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_common.h
    -/// \brief      Private definitions common to LZMA encoder and decoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZMA_COMMON_H
    -#define LZMA_LZMA_COMMON_H
    -
    -#include "common.h"
    -#include "range_common.h"
    -
    -
    -///////////////////
    -// Miscellaneous //
    -///////////////////
    -
    -/// Maximum number of position states. A position state is the lowest pos bits
    -/// number of bits of the current uncompressed offset. In some places there
    -/// are different sets of probabilities for different pos states.
    -#define POS_STATES_MAX (1 << LZMA_PB_MAX)
    -
    -
    -/// Validates lc, lp, and pb.
    -static inline bool
    -is_lclppb_valid(const lzma_options_lzma *options)
    -{
    -	return options->lc <= LZMA_LCLP_MAX && options->lp <= LZMA_LCLP_MAX
    -			&& options->lc + options->lp <= LZMA_LCLP_MAX
    -			&& options->pb <= LZMA_PB_MAX;
    -}
    -
    -
    -///////////
    -// State //
    -///////////
    -
    -/// This enum is used to track which events have occurred most recently and
    -/// in which order. This information is used to predict the next event.
    -///
    -/// Events:
    -///  - Literal: One 8-bit byte
    -///  - Match: Repeat a chunk of data at some distance
    -///  - Long repeat: Multi-byte match at a recently seen distance
    -///  - Short repeat: One-byte repeat at a recently seen distance
    -///
    -/// The event names are in from STATE_oldest_older_previous. REP means
    -/// either short or long repeated match, and NONLIT means any non-literal.
    -typedef enum {
    -	STATE_LIT_LIT,
    -	STATE_MATCH_LIT_LIT,
    -	STATE_REP_LIT_LIT,
    -	STATE_SHORTREP_LIT_LIT,
    -	STATE_MATCH_LIT,
    -	STATE_REP_LIT,
    -	STATE_SHORTREP_LIT,
    -	STATE_LIT_MATCH,
    -	STATE_LIT_LONGREP,
    -	STATE_LIT_SHORTREP,
    -	STATE_NONLIT_MATCH,
    -	STATE_NONLIT_REP,
    -} lzma_lzma_state;
    -
    -
    -/// Total number of states
    -#define STATES 12
    -
    -/// The lowest 7 states indicate that the previous state was a literal.
    -#define LIT_STATES 7
    -
    -
    -/// Indicate that the latest state was a literal.
    -#define update_literal(state) \
    -	state = ((state) <= STATE_SHORTREP_LIT_LIT \
    -			? STATE_LIT_LIT \
    -			: ((state) <= STATE_LIT_SHORTREP \
    -				? (state) - 3 \
    -				: (state) - 6))
    -
    -/// Indicate that the latest state was a match.
    -#define update_match(state) \
    -	state = ((state) < LIT_STATES ? STATE_LIT_MATCH : STATE_NONLIT_MATCH)
    -
    -/// Indicate that the latest state was a long repeated match.
    -#define update_long_rep(state) \
    -	state = ((state) < LIT_STATES ? STATE_LIT_LONGREP : STATE_NONLIT_REP)
    -
    -/// Indicate that the latest state was a short match.
    -#define update_short_rep(state) \
    -	state = ((state) < LIT_STATES ? STATE_LIT_SHORTREP : STATE_NONLIT_REP)
    -
    -/// Test if the previous state was a literal.
    -#define is_literal_state(state) \
    -	((state) < LIT_STATES)
    -
    -
    -/////////////
    -// Literal //
    -/////////////
    -
    -/// Each literal coder is divided in three sections:
    -///   - 0x001-0x0FF: Without match byte
    -///   - 0x101-0x1FF: With match byte; match bit is 0
    -///   - 0x201-0x2FF: With match byte; match bit is 1
    -///
    -/// Match byte is used when the previous LZMA symbol was something else than
    -/// a literal (that is, it was some kind of match).
    -#define LITERAL_CODER_SIZE 0x300
    -
    -/// Maximum number of literal coders
    -#define LITERAL_CODERS_MAX (1 << LZMA_LCLP_MAX)
    -
    -/// Locate the literal coder for the next literal byte. The choice depends on
    -///   - the lowest literal_pos_bits bits of the position of the current
    -///     byte; and
    -///   - the highest literal_context_bits bits of the previous byte.
    -#define literal_subcoder(probs, lc, lp_mask, pos, prev_byte) \
    -	((probs)[(((pos) & lp_mask) << lc) + ((prev_byte) >> (8 - lc))])
    -
    -
    -static inline void
    -literal_init(probability (*probs)[LITERAL_CODER_SIZE],
    -		uint32_t lc, uint32_t lp)
    -{
    -	assert(lc + lp <= LZMA_LCLP_MAX);
    -
    -	const uint32_t coders = 1U << (lc + lp);
    -
    -	for (uint32_t i = 0; i < coders; ++i)
    -		for (uint32_t j = 0; j < LITERAL_CODER_SIZE; ++j)
    -			bit_reset(probs[i][j]);
    -
    -	return;
    -}
    -
    -
    -//////////////////
    -// Match length //
    -//////////////////
    -
    -// Minimum length of a match is two bytes.
    -#define MATCH_LEN_MIN 2
    -
    -// Match length is encoded with 4, 5, or 10 bits.
    -//
    -// Length   Bits
    -//  2-9      4 = Choice=0 + 3 bits
    -// 10-17     5 = Choice=1 + Choice2=0 + 3 bits
    -// 18-273   10 = Choice=1 + Choice2=1 + 8 bits
    -#define LEN_LOW_BITS 3
    -#define LEN_LOW_SYMBOLS (1 << LEN_LOW_BITS)
    -#define LEN_MID_BITS 3
    -#define LEN_MID_SYMBOLS (1 << LEN_MID_BITS)
    -#define LEN_HIGH_BITS 8
    -#define LEN_HIGH_SYMBOLS (1 << LEN_HIGH_BITS)
    -#define LEN_SYMBOLS (LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS + LEN_HIGH_SYMBOLS)
    -
    -// Maximum length of a match is 273 which is a result of the encoding
    -// described above.
    -#define MATCH_LEN_MAX (MATCH_LEN_MIN + LEN_SYMBOLS - 1)
    -
    -
    -////////////////////
    -// Match distance //
    -////////////////////
    -
    -// Different sets of probabilities are used for match distances that have very
    -// short match length: Lengths of 2, 3, and 4 bytes have a separate set of
    -// probabilities for each length. The matches with longer length use a shared
    -// set of probabilities.
    -#define DIST_STATES 4
    -
    -// Macro to get the index of the appropriate probability array.
    -#define get_dist_state(len) \
    -	((len) < DIST_STATES + MATCH_LEN_MIN \
    -		? (len) - MATCH_LEN_MIN \
    -		: DIST_STATES - 1)
    -
    -// The highest two bits of a match distance (distance slot) are encoded
    -// using six bits. See fastpos.h for more explanation.
    -#define DIST_SLOT_BITS 6
    -#define DIST_SLOTS (1 << DIST_SLOT_BITS)
    -
    -// Match distances up to 127 are fully encoded using probabilities. Since
    -// the highest two bits (distance slot) are always encoded using six bits,
    -// the distances 0-3 don't need any additional bits to encode, since the
    -// distance slot itself is the same as the actual distance. DIST_MODEL_START
    -// indicates the first distance slot where at least one additional bit is
    -// needed.
    -#define DIST_MODEL_START 4
    -
    -// Match distances greater than 127 are encoded in three pieces:
    -//   - distance slot: the highest two bits
    -//   - direct bits: 2-26 bits below the highest two bits
    -//   - alignment bits: four lowest bits
    -//
    -// Direct bits don't use any probabilities.
    -//
    -// The distance slot value of 14 is for distances 128-191 (see the table in
    -// fastpos.h to understand why).
    -#define DIST_MODEL_END 14
    -
    -// Distance slots that indicate a distance <= 127.
    -#define FULL_DISTANCES_BITS (DIST_MODEL_END / 2)
    -#define FULL_DISTANCES (1 << FULL_DISTANCES_BITS)
    -
    -// For match distances greater than 127, only the highest two bits and the
    -// lowest four bits (alignment) is encoded using probabilities.
    -#define ALIGN_BITS 4
    -#define ALIGN_SIZE (1 << ALIGN_BITS)
    -#define ALIGN_MASK (ALIGN_SIZE - 1)
    -
    -// LZMA remembers the four most recent match distances. Reusing these distances
    -// tends to take less space than re-encoding the actual distance value.
    -#define REPS 4
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_decoder.c b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_decoder.c
    deleted file mode 100644
    index b8f931705..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_decoder.c
    +++ /dev/null
    @@ -1,1061 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_decoder.c
    -/// \brief      LZMA decoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "lz_decoder.h"
    -#include "lzma_common.h"
    -#include "lzma_decoder.h"
    -#include "range_decoder.h"
    -
    -
    -#ifdef HAVE_SMALL
    -
    -// Macros for (somewhat) size-optimized code.
    -#define seq_4(seq) seq
    -
    -#define seq_6(seq) seq
    -
    -#define seq_8(seq) seq
    -
    -#define seq_len(seq) \
    -	seq ## _CHOICE, \
    -	seq ## _CHOICE2, \
    -	seq ## _BITTREE
    -
    -#define len_decode(target, ld, pos_state, seq) \
    -do { \
    -case seq ## _CHOICE: \
    -	rc_if_0(ld.choice, seq ## _CHOICE) { \
    -		rc_update_0(ld.choice); \
    -		probs = ld.low[pos_state];\
    -		limit = LEN_LOW_SYMBOLS; \
    -		target = MATCH_LEN_MIN; \
    -	} else { \
    -		rc_update_1(ld.choice); \
    -case seq ## _CHOICE2: \
    -		rc_if_0(ld.choice2, seq ## _CHOICE2) { \
    -			rc_update_0(ld.choice2); \
    -			probs = ld.mid[pos_state]; \
    -			limit = LEN_MID_SYMBOLS; \
    -			target = MATCH_LEN_MIN + LEN_LOW_SYMBOLS; \
    -		} else { \
    -			rc_update_1(ld.choice2); \
    -			probs = ld.high; \
    -			limit = LEN_HIGH_SYMBOLS; \
    -			target = MATCH_LEN_MIN + LEN_LOW_SYMBOLS \
    -					+ LEN_MID_SYMBOLS; \
    -		} \
    -	} \
    -	symbol = 1; \
    -case seq ## _BITTREE: \
    -	do { \
    -		rc_bit(probs[symbol], , , seq ## _BITTREE); \
    -	} while (symbol < limit); \
    -	target += symbol - limit; \
    -} while (0)
    -
    -#else // HAVE_SMALL
    -
    -// Unrolled versions
    -#define seq_4(seq) \
    -	seq ## 0, \
    -	seq ## 1, \
    -	seq ## 2, \
    -	seq ## 3
    -
    -#define seq_6(seq) \
    -	seq ## 0, \
    -	seq ## 1, \
    -	seq ## 2, \
    -	seq ## 3, \
    -	seq ## 4, \
    -	seq ## 5
    -
    -#define seq_8(seq) \
    -	seq ## 0, \
    -	seq ## 1, \
    -	seq ## 2, \
    -	seq ## 3, \
    -	seq ## 4, \
    -	seq ## 5, \
    -	seq ## 6, \
    -	seq ## 7
    -
    -#define seq_len(seq) \
    -	seq ## _CHOICE, \
    -	seq ## _LOW0, \
    -	seq ## _LOW1, \
    -	seq ## _LOW2, \
    -	seq ## _CHOICE2, \
    -	seq ## _MID0, \
    -	seq ## _MID1, \
    -	seq ## _MID2, \
    -	seq ## _HIGH0, \
    -	seq ## _HIGH1, \
    -	seq ## _HIGH2, \
    -	seq ## _HIGH3, \
    -	seq ## _HIGH4, \
    -	seq ## _HIGH5, \
    -	seq ## _HIGH6, \
    -	seq ## _HIGH7
    -
    -#define len_decode(target, ld, pos_state, seq) \
    -do { \
    -	symbol = 1; \
    -case seq ## _CHOICE: \
    -	rc_if_0(ld.choice, seq ## _CHOICE) { \
    -		rc_update_0(ld.choice); \
    -		rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW0); \
    -		rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW1); \
    -		rc_bit_case(ld.low[pos_state][symbol], , , seq ## _LOW2); \
    -		target = symbol - LEN_LOW_SYMBOLS + MATCH_LEN_MIN; \
    -	} else { \
    -		rc_update_1(ld.choice); \
    -case seq ## _CHOICE2: \
    -		rc_if_0(ld.choice2, seq ## _CHOICE2) { \
    -			rc_update_0(ld.choice2); \
    -			rc_bit_case(ld.mid[pos_state][symbol], , , \
    -					seq ## _MID0); \
    -			rc_bit_case(ld.mid[pos_state][symbol], , , \
    -					seq ## _MID1); \
    -			rc_bit_case(ld.mid[pos_state][symbol], , , \
    -					seq ## _MID2); \
    -			target = symbol - LEN_MID_SYMBOLS \
    -					+ MATCH_LEN_MIN + LEN_LOW_SYMBOLS; \
    -		} else { \
    -			rc_update_1(ld.choice2); \
    -			rc_bit_case(ld.high[symbol], , , seq ## _HIGH0); \
    -			rc_bit_case(ld.high[symbol], , , seq ## _HIGH1); \
    -			rc_bit_case(ld.high[symbol], , , seq ## _HIGH2); \
    -			rc_bit_case(ld.high[symbol], , , seq ## _HIGH3); \
    -			rc_bit_case(ld.high[symbol], , , seq ## _HIGH4); \
    -			rc_bit_case(ld.high[symbol], , , seq ## _HIGH5); \
    -			rc_bit_case(ld.high[symbol], , , seq ## _HIGH6); \
    -			rc_bit_case(ld.high[symbol], , , seq ## _HIGH7); \
    -			target = symbol - LEN_HIGH_SYMBOLS \
    -					+ MATCH_LEN_MIN \
    -					+ LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS; \
    -		} \
    -	} \
    -} while (0)
    -
    -#endif // HAVE_SMALL
    -
    -
    -/// Length decoder probabilities; see comments in lzma_common.h.
    -typedef struct {
    -	probability choice;
    -	probability choice2;
    -	probability low[POS_STATES_MAX][LEN_LOW_SYMBOLS];
    -	probability mid[POS_STATES_MAX][LEN_MID_SYMBOLS];
    -	probability high[LEN_HIGH_SYMBOLS];
    -} lzma_length_decoder;
    -
    -
    -struct lzma_coder_s {
    -	///////////////////
    -	// Probabilities //
    -	///////////////////
    -
    -	/// Literals; see comments in lzma_common.h.
    -	probability literal[LITERAL_CODERS_MAX][LITERAL_CODER_SIZE];
    -
    -	/// If 1, it's a match. Otherwise it's a single 8-bit literal.
    -	probability is_match[STATES][POS_STATES_MAX];
    -
    -	/// If 1, it's a repeated match. The distance is one of rep0 .. rep3.
    -	probability is_rep[STATES];
    -
    -	/// If 0, distance of a repeated match is rep0.
    -	/// Otherwise check is_rep1.
    -	probability is_rep0[STATES];
    -
    -	/// If 0, distance of a repeated match is rep1.
    -	/// Otherwise check is_rep2.
    -	probability is_rep1[STATES];
    -
    -	/// If 0, distance of a repeated match is rep2. Otherwise it is rep3.
    -	probability is_rep2[STATES];
    -
    -	/// If 1, the repeated match has length of one byte. Otherwise
    -	/// the length is decoded from rep_len_decoder.
    -	probability is_rep0_long[STATES][POS_STATES_MAX];
    -
    -	/// Probability tree for the highest two bits of the match distance.
    -	/// There is a separate probability tree for match lengths of
    -	/// 2 (i.e. MATCH_LEN_MIN), 3, 4, and [5, 273].
    -	probability dist_slot[DIST_STATES][DIST_SLOTS];
    -
    -	/// Probability trees for additional bits for match distance when the
    -	/// distance is in the range [4, 127].
    -	probability pos_special[FULL_DISTANCES - DIST_MODEL_END];
    -
    -	/// Probability tree for the lowest four bits of a match distance
    -	/// that is equal to or greater than 128.
    -	probability pos_align[ALIGN_SIZE];
    -
    -	/// Length of a normal match
    -	lzma_length_decoder match_len_decoder;
    -
    -	/// Length of a repeated match
    -	lzma_length_decoder rep_len_decoder;
    -
    -	///////////////////
    -	// Decoder state //
    -	///////////////////
    -
    -	// Range coder
    -	lzma_range_decoder rc;
    -
    -	// Types of the most recently seen LZMA symbols
    -	lzma_lzma_state state;
    -
    -	uint32_t rep0;      ///< Distance of the latest match
    -	uint32_t rep1;      ///< Distance of second latest match
    -	uint32_t rep2;      ///< Distance of third latest match
    -	uint32_t rep3;      ///< Distance of fourth latest match
    -
    -	uint32_t pos_mask; // (1U << pb) - 1
    -	uint32_t literal_context_bits;
    -	uint32_t literal_pos_mask;
    -
    -	/// Uncompressed size as bytes, or LZMA_VLI_UNKNOWN if end of
    -	/// payload marker is expected.
    -	lzma_vli uncompressed_size;
    -
    -	////////////////////////////////
    -	// State of incomplete symbol //
    -	////////////////////////////////
    -
    -	/// Position where to continue the decoder loop
    -	enum {
    -		SEQ_NORMALIZE,
    -		SEQ_IS_MATCH,
    -		seq_8(SEQ_LITERAL),
    -		seq_8(SEQ_LITERAL_MATCHED),
    -		SEQ_LITERAL_WRITE,
    -		SEQ_IS_REP,
    -		seq_len(SEQ_MATCH_LEN),
    -		seq_6(SEQ_DIST_SLOT),
    -		SEQ_DIST_MODEL,
    -		SEQ_DIRECT,
    -		seq_4(SEQ_ALIGN),
    -		SEQ_EOPM,
    -		SEQ_IS_REP0,
    -		SEQ_SHORTREP,
    -		SEQ_IS_REP0_LONG,
    -		SEQ_IS_REP1,
    -		SEQ_IS_REP2,
    -		seq_len(SEQ_REP_LEN),
    -		SEQ_COPY,
    -	} sequence;
    -
    -	/// Base of the current probability tree
    -	probability *probs;
    -
    -	/// Symbol being decoded. This is also used as an index variable in
    -	/// bittree decoders: probs[symbol]
    -	uint32_t symbol;
    -
    -	/// Used as a loop termination condition on bittree decoders and
    -	/// direct bits decoder.
    -	uint32_t limit;
    -
    -	/// Matched literal decoder: 0x100 or 0 to help avoiding branches.
    -	/// Bittree reverse decoders: Offset of the next bit: 1 << offset
    -	uint32_t offset;
    -
    -	/// If decoding a literal: match byte.
    -	/// If decoding a match: length of the match.
    -	uint32_t len;
    -};
    -
    -
    -static lzma_ret
    -lzma_decode(lzma_coder *restrict coder, lzma_dict *restrict dictptr,
    -		const uint8_t *restrict in,
    -		size_t *restrict in_pos, size_t in_size)
    -{
    -	////////////////////
    -	// Initialization //
    -	////////////////////
    -
    -	{
    -		const lzma_ret ret = rc_read_init(
    -				&coder->rc, in, in_pos, in_size);
    -		if (ret != LZMA_STREAM_END)
    -			return ret;
    -	}
    -
    -	///////////////
    -	// Variables //
    -	///////////////
    -
    -	// Making local copies of often-used variables improves both
    -	// speed and readability.
    -
    -	lzma_dict dict = *dictptr;
    -
    -	const size_t dict_start = dict.pos;
    -
    -	// Range decoder
    -	rc_to_local(coder->rc, *in_pos);
    -
    -	// State
    -	uint32_t state = coder->state;
    -	uint32_t rep0 = coder->rep0;
    -	uint32_t rep1 = coder->rep1;
    -	uint32_t rep2 = coder->rep2;
    -	uint32_t rep3 = coder->rep3;
    -
    -	const uint32_t pos_mask = coder->pos_mask;
    -
    -	// These variables are actually needed only if we last time ran
    -	// out of input in the middle of the decoder loop.
    -	probability *probs = coder->probs;
    -	uint32_t symbol = coder->symbol;
    -	uint32_t limit = coder->limit;
    -	uint32_t offset = coder->offset;
    -	uint32_t len = coder->len;
    -
    -	const uint32_t literal_pos_mask = coder->literal_pos_mask;
    -	const uint32_t literal_context_bits = coder->literal_context_bits;
    -
    -	// Temporary variables
    -	uint32_t pos_state = dict.pos & pos_mask;
    -
    -	lzma_ret ret = LZMA_OK;
    -
    -	// If uncompressed size is known, there must be no end of payload
    -	// marker.
    -	const bool no_eopm = coder->uncompressed_size
    -			!= LZMA_VLI_UNKNOWN;
    -	if (no_eopm && coder->uncompressed_size < dict.limit - dict.pos)
    -		dict.limit = dict.pos + (size_t)(coder->uncompressed_size);
    -
    -	// The main decoder loop. The "switch" is used to restart the decoder at
    -	// correct location. Once restarted, the "switch" is no longer used.
    -	switch (coder->sequence)
    -	while (true) {
    -		// Calculate new pos_state. This is skipped on the first loop
    -		// since we already calculated it when setting up the local
    -		// variables.
    -		pos_state = dict.pos & pos_mask;
    -
    -	case SEQ_NORMALIZE:
    -	case SEQ_IS_MATCH:
    -		if (unlikely(no_eopm && dict.pos == dict.limit))
    -			break;
    -
    -		rc_if_0(coder->is_match[state][pos_state], SEQ_IS_MATCH) {
    -			rc_update_0(coder->is_match[state][pos_state]);
    -
    -			// It's a literal i.e. a single 8-bit byte.
    -
    -			probs = literal_subcoder(coder->literal,
    -					literal_context_bits, literal_pos_mask,
    -					dict.pos, dict_get(&dict, 0));
    -			symbol = 1;
    -
    -			if (is_literal_state(state)) {
    -				// Decode literal without match byte.
    -#ifdef HAVE_SMALL
    -	case SEQ_LITERAL:
    -				do {
    -					rc_bit(probs[symbol], , , SEQ_LITERAL);
    -				} while (symbol < (1 << 8));
    -#else
    -				rc_bit_case(probs[symbol], , , SEQ_LITERAL0);
    -				rc_bit_case(probs[symbol], , , SEQ_LITERAL1);
    -				rc_bit_case(probs[symbol], , , SEQ_LITERAL2);
    -				rc_bit_case(probs[symbol], , , SEQ_LITERAL3);
    -				rc_bit_case(probs[symbol], , , SEQ_LITERAL4);
    -				rc_bit_case(probs[symbol], , , SEQ_LITERAL5);
    -				rc_bit_case(probs[symbol], , , SEQ_LITERAL6);
    -				rc_bit_case(probs[symbol], , , SEQ_LITERAL7);
    -#endif
    -			} else {
    -				// Decode literal with match byte.
    -				//
    -				// We store the byte we compare against
    -				// ("match byte") to "len" to minimize the
    -				// number of variables we need to store
    -				// between decoder calls.
    -				len = dict_get(&dict, rep0) << 1;
    -
    -				// The usage of "offset" allows omitting some
    -				// branches, which should give tiny speed
    -				// improvement on some CPUs. "offset" gets
    -				// set to zero if match_bit didn't match.
    -				offset = 0x100;
    -
    -#ifdef HAVE_SMALL
    -	case SEQ_LITERAL_MATCHED:
    -				do {
    -					const uint32_t match_bit
    -							= len & offset;
    -					const uint32_t subcoder_index
    -							= offset + match_bit
    -							+ symbol;
    -
    -					rc_bit(probs[subcoder_index],
    -							offset &= ~match_bit,
    -							offset &= match_bit,
    -							SEQ_LITERAL_MATCHED);
    -
    -					// It seems to be faster to do this
    -					// here instead of putting it to the
    -					// beginning of the loop and then
    -					// putting the "case" in the middle
    -					// of the loop.
    -					len <<= 1;
    -
    -				} while (symbol < (1 << 8));
    -#else
    -				// Unroll the loop.
    -				uint32_t match_bit;
    -				uint32_t subcoder_index;
    -
    -#	define d(seq) \
    -		case seq: \
    -			match_bit = len & offset; \
    -			subcoder_index = offset + match_bit + symbol; \
    -			rc_bit(probs[subcoder_index], \
    -					offset &= ~match_bit, \
    -					offset &= match_bit, \
    -					seq)
    -
    -				d(SEQ_LITERAL_MATCHED0);
    -				len <<= 1;
    -				d(SEQ_LITERAL_MATCHED1);
    -				len <<= 1;
    -				d(SEQ_LITERAL_MATCHED2);
    -				len <<= 1;
    -				d(SEQ_LITERAL_MATCHED3);
    -				len <<= 1;
    -				d(SEQ_LITERAL_MATCHED4);
    -				len <<= 1;
    -				d(SEQ_LITERAL_MATCHED5);
    -				len <<= 1;
    -				d(SEQ_LITERAL_MATCHED6);
    -				len <<= 1;
    -				d(SEQ_LITERAL_MATCHED7);
    -#	undef d
    -#endif
    -			}
    -
    -			//update_literal(state);
    -			// Use a lookup table to update to literal state,
    -			// since compared to other state updates, this would
    -			// need two branches.
    -			static const lzma_lzma_state next_state[] = {
    -				STATE_LIT_LIT,
    -				STATE_LIT_LIT,
    -				STATE_LIT_LIT,
    -				STATE_LIT_LIT,
    -				STATE_MATCH_LIT_LIT,
    -				STATE_REP_LIT_LIT,
    -				STATE_SHORTREP_LIT_LIT,
    -				STATE_MATCH_LIT,
    -				STATE_REP_LIT,
    -				STATE_SHORTREP_LIT,
    -				STATE_MATCH_LIT,
    -				STATE_REP_LIT
    -			};
    -			state = next_state[state];
    -
    -	case SEQ_LITERAL_WRITE:
    -			if (unlikely(dict_put(&dict, symbol))) {
    -				coder->sequence = SEQ_LITERAL_WRITE;
    -				goto out;
    -			}
    -
    -			continue;
    -		}
    -
    -		// Instead of a new byte we are going to get a byte range
    -		// (distance and length) which will be repeated from our
    -		// output history.
    -
    -		rc_update_1(coder->is_match[state][pos_state]);
    -
    -	case SEQ_IS_REP:
    -		rc_if_0(coder->is_rep[state], SEQ_IS_REP) {
    -			// Not a repeated match
    -			rc_update_0(coder->is_rep[state]);
    -			update_match(state);
    -
    -			// The latest three match distances are kept in
    -			// memory in case there are repeated matches.
    -			rep3 = rep2;
    -			rep2 = rep1;
    -			rep1 = rep0;
    -
    -			// Decode the length of the match.
    -			len_decode(len, coder->match_len_decoder,
    -					pos_state, SEQ_MATCH_LEN);
    -
    -			// Prepare to decode the highest two bits of the
    -			// match distance.
    -			probs = coder->dist_slot[get_dist_state(len)];
    -			symbol = 1;
    -
    -#ifdef HAVE_SMALL
    -	case SEQ_DIST_SLOT:
    -			do {
    -				rc_bit(probs[symbol], , , SEQ_DIST_SLOT);
    -			} while (symbol < DIST_SLOTS);
    -#else
    -			rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT0);
    -			rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT1);
    -			rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT2);
    -			rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT3);
    -			rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT4);
    -			rc_bit_case(probs[symbol], , , SEQ_DIST_SLOT5);
    -#endif
    -			// Get rid of the highest bit that was needed for
    -			// indexing of the probability array.
    -			symbol -= DIST_SLOTS;
    -			assert(symbol <= 63);
    -
    -			if (symbol < DIST_MODEL_START) {
    -				// Match distances [0, 3] have only two bits.
    -				rep0 = symbol;
    -			} else {
    -				// Decode the lowest [1, 29] bits of
    -				// the match distance.
    -				limit = (symbol >> 1) - 1;
    -				assert(limit >= 1 && limit <= 30);
    -				rep0 = 2 + (symbol & 1);
    -
    -				if (symbol < DIST_MODEL_END) {
    -					// Prepare to decode the low bits for
    -					// a distance of [4, 127].
    -					assert(limit <= 5);
    -					rep0 <<= limit;
    -					assert(rep0 <= 96);
    -					// -1 is fine, because we start
    -					// decoding at probs[1], not probs[0].
    -					// NOTE: This violates the C standard,
    -					// since we are doing pointer
    -					// arithmetic past the beginning of
    -					// the array.
    -					assert((int32_t)(rep0 - symbol - 1)
    -							>= -1);
    -					assert((int32_t)(rep0 - symbol - 1)
    -							<= 82);
    -					probs = coder->pos_special + rep0
    -							- symbol - 1;
    -					symbol = 1;
    -					offset = 0;
    -	case SEQ_DIST_MODEL:
    -#ifdef HAVE_SMALL
    -					do {
    -						rc_bit(probs[symbol], ,
    -							rep0 += 1 << offset,
    -							SEQ_DIST_MODEL);
    -					} while (++offset < limit);
    -#else
    -					switch (limit) {
    -					case 5:
    -						assert(offset == 0);
    -						rc_bit(probs[symbol], ,
    -							rep0 += 1,
    -							SEQ_DIST_MODEL);
    -						++offset;
    -						--limit;
    -					case 4:
    -						rc_bit(probs[symbol], ,
    -							rep0 += 1 << offset,
    -							SEQ_DIST_MODEL);
    -						++offset;
    -						--limit;
    -					case 3:
    -						rc_bit(probs[symbol], ,
    -							rep0 += 1 << offset,
    -							SEQ_DIST_MODEL);
    -						++offset;
    -						--limit;
    -					case 2:
    -						rc_bit(probs[symbol], ,
    -							rep0 += 1 << offset,
    -							SEQ_DIST_MODEL);
    -						++offset;
    -						--limit;
    -					case 1:
    -						// We need "symbol" only for
    -						// indexing the probability
    -						// array, thus we can use
    -						// rc_bit_last() here to omit
    -						// the unneeded updating of
    -						// "symbol".
    -						rc_bit_last(probs[symbol], ,
    -							rep0 += 1 << offset,
    -							SEQ_DIST_MODEL);
    -					}
    -#endif
    -				} else {
    -					// The distance is >= 128. Decode the
    -					// lower bits without probabilities
    -					// except the lowest four bits.
    -					assert(symbol >= 14);
    -					assert(limit >= 6);
    -					limit -= ALIGN_BITS;
    -					assert(limit >= 2);
    -	case SEQ_DIRECT:
    -					// Not worth manual unrolling
    -					do {
    -						rc_direct(rep0, SEQ_DIRECT);
    -					} while (--limit > 0);
    -
    -					// Decode the lowest four bits using
    -					// probabilities.
    -					rep0 <<= ALIGN_BITS;
    -					symbol = 1;
    -#ifdef HAVE_SMALL
    -					offset = 0;
    -	case SEQ_ALIGN:
    -					do {
    -						rc_bit(coder->pos_align[
    -								symbol], ,
    -							rep0 += 1 << offset,
    -							SEQ_ALIGN);
    -					} while (++offset < ALIGN_BITS);
    -#else
    -	case SEQ_ALIGN0:
    -					rc_bit(coder->pos_align[symbol], ,
    -							rep0 += 1, SEQ_ALIGN0);
    -	case SEQ_ALIGN1:
    -					rc_bit(coder->pos_align[symbol], ,
    -							rep0 += 2, SEQ_ALIGN1);
    -	case SEQ_ALIGN2:
    -					rc_bit(coder->pos_align[symbol], ,
    -							rep0 += 4, SEQ_ALIGN2);
    -	case SEQ_ALIGN3:
    -					// Like in SEQ_DIST_MODEL, we don't
    -					// need "symbol" for anything else
    -					// than indexing the probability array.
    -					rc_bit_last(coder->pos_align[symbol], ,
    -							rep0 += 8, SEQ_ALIGN3);
    -#endif
    -
    -					if (rep0 == UINT32_MAX) {
    -						// End of payload marker was
    -						// found. It must not be
    -						// present if uncompressed
    -						// size is known.
    -						if (coder->uncompressed_size
    -						!= LZMA_VLI_UNKNOWN) {
    -							ret = LZMA_DATA_ERROR;
    -							goto out;
    -						}
    -
    -	case SEQ_EOPM:
    -						// LZMA1 stream with
    -						// end-of-payload marker.
    -						rc_normalize(SEQ_EOPM);
    -						ret = LZMA_STREAM_END;
    -						goto out;
    -					}
    -				}
    -			}
    -
    -			// Validate the distance we just decoded.
    -			if (unlikely(!dict_is_distance_valid(&dict, rep0))) {
    -				ret = LZMA_DATA_ERROR;
    -				goto out;
    -			}
    -
    -		} else {
    -			rc_update_1(coder->is_rep[state]);
    -
    -			// Repeated match
    -			//
    -			// The match distance is a value that we have had
    -			// earlier. The latest four match distances are
    -			// available as rep0, rep1, rep2 and rep3. We will
    -			// now decode which of them is the new distance.
    -			//
    -			// There cannot be a match if we haven't produced
    -			// any output, so check that first.
    -			if (unlikely(!dict_is_distance_valid(&dict, 0))) {
    -				ret = LZMA_DATA_ERROR;
    -				goto out;
    -			}
    -
    -	case SEQ_IS_REP0:
    -			rc_if_0(coder->is_rep0[state], SEQ_IS_REP0) {
    -				rc_update_0(coder->is_rep0[state]);
    -				// The distance is rep0.
    -
    -	case SEQ_IS_REP0_LONG:
    -				rc_if_0(coder->is_rep0_long[state][pos_state],
    -						SEQ_IS_REP0_LONG) {
    -					rc_update_0(coder->is_rep0_long[
    -							state][pos_state]);
    -
    -					update_short_rep(state);
    -
    -	case SEQ_SHORTREP:
    -					if (unlikely(dict_put(&dict, dict_get(
    -							&dict, rep0)))) {
    -						coder->sequence = SEQ_SHORTREP;
    -						goto out;
    -					}
    -
    -					continue;
    -				}
    -
    -				// Repeating more than one byte at
    -				// distance of rep0.
    -				rc_update_1(coder->is_rep0_long[
    -						state][pos_state]);
    -
    -			} else {
    -				rc_update_1(coder->is_rep0[state]);
    -
    -	case SEQ_IS_REP1:
    -				// The distance is rep1, rep2 or rep3. Once
    -				// we find out which one of these three, it
    -				// is stored to rep0 and rep1, rep2 and rep3
    -				// are updated accordingly.
    -				rc_if_0(coder->is_rep1[state], SEQ_IS_REP1) {
    -					rc_update_0(coder->is_rep1[state]);
    -
    -					const uint32_t distance = rep1;
    -					rep1 = rep0;
    -					rep0 = distance;
    -
    -				} else {
    -					rc_update_1(coder->is_rep1[state]);
    -	case SEQ_IS_REP2:
    -					rc_if_0(coder->is_rep2[state],
    -							SEQ_IS_REP2) {
    -						rc_update_0(coder->is_rep2[
    -								state]);
    -
    -						const uint32_t distance = rep2;
    -						rep2 = rep1;
    -						rep1 = rep0;
    -						rep0 = distance;
    -
    -					} else {
    -						rc_update_1(coder->is_rep2[
    -								state]);
    -
    -						const uint32_t distance = rep3;
    -						rep3 = rep2;
    -						rep2 = rep1;
    -						rep1 = rep0;
    -						rep0 = distance;
    -					}
    -				}
    -			}
    -
    -			update_long_rep(state);
    -
    -			// Decode the length of the repeated match.
    -			len_decode(len, coder->rep_len_decoder,
    -					pos_state, SEQ_REP_LEN);
    -		}
    -
    -		/////////////////////////////////
    -		// Repeat from history buffer. //
    -		/////////////////////////////////
    -
    -		// The length is always between these limits. There is no way
    -		// to trigger the algorithm to set len outside this range.
    -		assert(len >= MATCH_LEN_MIN);
    -		assert(len <= MATCH_LEN_MAX);
    -
    -	case SEQ_COPY:
    -		// Repeat len bytes from distance of rep0.
    -		if (unlikely(dict_repeat(&dict, rep0, &len))) {
    -			coder->sequence = SEQ_COPY;
    -			goto out;
    -		}
    -	}
    -
    -	rc_normalize(SEQ_NORMALIZE);
    -	coder->sequence = SEQ_IS_MATCH;
    -
    -out:
    -	// Save state
    -
    -	// NOTE: Must not copy dict.limit.
    -	dictptr->pos = dict.pos;
    -	dictptr->full = dict.full;
    -
    -	rc_from_local(coder->rc, *in_pos);
    -
    -	coder->state = state;
    -	coder->rep0 = rep0;
    -	coder->rep1 = rep1;
    -	coder->rep2 = rep2;
    -	coder->rep3 = rep3;
    -
    -	coder->probs = probs;
    -	coder->symbol = symbol;
    -	coder->limit = limit;
    -	coder->offset = offset;
    -	coder->len = len;
    -
    -	// Update the remaining amount of uncompressed data if uncompressed
    -	// size was known.
    -	if (coder->uncompressed_size != LZMA_VLI_UNKNOWN) {
    -		coder->uncompressed_size -= dict.pos - dict_start;
    -
    -		// Since there cannot be end of payload marker if the
    -		// uncompressed size was known, we check here if we
    -		// finished decoding.
    -		if (coder->uncompressed_size == 0 && ret == LZMA_OK
    -				&& coder->sequence != SEQ_NORMALIZE)
    -			ret = coder->sequence == SEQ_IS_MATCH
    -					? LZMA_STREAM_END : LZMA_DATA_ERROR;
    -	}
    -
    -	// We can do an additional check in the range decoder to catch some
    -	// corrupted files.
    -	if (ret == LZMA_STREAM_END) {
    -		if (!rc_is_finished(coder->rc))
    -			ret = LZMA_DATA_ERROR;
    -
    -		// Reset the range decoder so that it is ready to reinitialize
    -		// for a new LZMA2 chunk.
    -		rc_reset(coder->rc);
    -	}
    -
    -	return ret;
    -}
    -
    -
    -
    -static void
    -lzma_decoder_uncompressed(lzma_coder *coder, lzma_vli uncompressed_size)
    -{
    -	coder->uncompressed_size = uncompressed_size;
    -}
    -
    -/*
    -extern void
    -lzma_lzma_decoder_uncompressed(void *coder_ptr, lzma_vli uncompressed_size)
    -{
    -	// This is hack.
    -	(*(lzma_coder **)(coder))->uncompressed_size = uncompressed_size;
    -}
    -*/
    -
    -static void
    -lzma_decoder_reset(lzma_coder *coder, const void *opt)
    -{
    -	const lzma_options_lzma *options = opt;
    -
    -	// NOTE: We assume that lc/lp/pb are valid since they were
    -	// successfully decoded with lzma_lzma_decode_properties().
    -
    -	// Calculate pos_mask. We don't need pos_bits as is for anything.
    -	coder->pos_mask = (1U << options->pb) - 1;
    -
    -	// Initialize the literal decoder.
    -	literal_init(coder->literal, options->lc, options->lp);
    -
    -	coder->literal_context_bits = options->lc;
    -	coder->literal_pos_mask = (1U << options->lp) - 1;
    -
    -	// State
    -	coder->state = STATE_LIT_LIT;
    -	coder->rep0 = 0;
    -	coder->rep1 = 0;
    -	coder->rep2 = 0;
    -	coder->rep3 = 0;
    -	coder->pos_mask = (1U << options->pb) - 1;
    -
    -	// Range decoder
    -	rc_reset(coder->rc);
    -
    -	// Bit and bittree decoders
    -	for (uint32_t i = 0; i < STATES; ++i) {
    -		for (uint32_t j = 0; j <= coder->pos_mask; ++j) {
    -			bit_reset(coder->is_match[i][j]);
    -			bit_reset(coder->is_rep0_long[i][j]);
    -		}
    -
    -		bit_reset(coder->is_rep[i]);
    -		bit_reset(coder->is_rep0[i]);
    -		bit_reset(coder->is_rep1[i]);
    -		bit_reset(coder->is_rep2[i]);
    -	}
    -
    -	for (uint32_t i = 0; i < DIST_STATES; ++i)
    -		bittree_reset(coder->dist_slot[i], DIST_SLOT_BITS);
    -
    -	for (uint32_t i = 0; i < FULL_DISTANCES - DIST_MODEL_END; ++i)
    -		bit_reset(coder->pos_special[i]);
    -
    -	bittree_reset(coder->pos_align, ALIGN_BITS);
    -
    -	// Len decoders (also bit/bittree)
    -	const uint32_t num_pos_states = 1U << options->pb;
    -	bit_reset(coder->match_len_decoder.choice);
    -	bit_reset(coder->match_len_decoder.choice2);
    -	bit_reset(coder->rep_len_decoder.choice);
    -	bit_reset(coder->rep_len_decoder.choice2);
    -
    -	for (uint32_t pos_state = 0; pos_state < num_pos_states; ++pos_state) {
    -		bittree_reset(coder->match_len_decoder.low[pos_state],
    -				LEN_LOW_BITS);
    -		bittree_reset(coder->match_len_decoder.mid[pos_state],
    -				LEN_MID_BITS);
    -
    -		bittree_reset(coder->rep_len_decoder.low[pos_state],
    -				LEN_LOW_BITS);
    -		bittree_reset(coder->rep_len_decoder.mid[pos_state],
    -				LEN_MID_BITS);
    -	}
    -
    -	bittree_reset(coder->match_len_decoder.high, LEN_HIGH_BITS);
    -	bittree_reset(coder->rep_len_decoder.high, LEN_HIGH_BITS);
    -
    -	coder->sequence = SEQ_IS_MATCH;
    -	coder->probs = NULL;
    -	coder->symbol = 0;
    -	coder->limit = 0;
    -	coder->offset = 0;
    -	coder->len = 0;
    -
    -	return;
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma_decoder_create(lzma_lz_decoder *lz, const lzma_allocator *allocator,
    -		const void *opt, lzma_lz_options *lz_options)
    -{
    -	if (lz->coder == NULL) {
    -		lz->coder = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (lz->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		lz->code = &lzma_decode;
    -		lz->reset = &lzma_decoder_reset;
    -		lz->set_uncompressed = &lzma_decoder_uncompressed;
    -	}
    -
    -	// All dictionary sizes are OK here. LZ decoder will take care of
    -	// the special cases.
    -	const lzma_options_lzma *options = opt;
    -	lz_options->dict_size = options->dict_size;
    -	lz_options->preset_dict = options->preset_dict;
    -	lz_options->preset_dict_size = options->preset_dict_size;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -/// Allocate and initialize LZMA decoder. This is used only via LZ
    -/// initialization (lzma_lzma_decoder_init() passes function pointer to
    -/// the LZ initialization).
    -static lzma_ret
    -lzma_decoder_init(lzma_lz_decoder *lz, const lzma_allocator *allocator,
    -		const void *options, lzma_lz_options *lz_options)
    -{
    -	if (!is_lclppb_valid(options))
    -		return LZMA_PROG_ERROR;
    -
    -	return_if_error(lzma_lzma_decoder_create(
    -			lz, allocator, options, lz_options));
    -
    -	lzma_decoder_reset(lz->coder, options);
    -	lzma_decoder_uncompressed(lz->coder, LZMA_VLI_UNKNOWN);
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma_decoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	// LZMA can only be the last filter in the chain. This is enforced
    -	// by the raw_decoder initialization.
    -	assert(filters[1].init == NULL);
    -
    -	return lzma_lz_decoder_init(next, allocator, filters,
    -			&lzma_decoder_init);
    -}
    -
    -
    -extern bool
    -lzma_lzma_lclppb_decode(lzma_options_lzma *options, uint8_t byte)
    -{
    -	if (byte > (4 * 5 + 4) * 9 + 8)
    -		return true;
    -
    -	// See the file format specification to understand this.
    -	options->pb = byte / (9 * 5);
    -	byte -= options->pb * 9 * 5;
    -	options->lp = byte / 9;
    -	options->lc = byte - options->lp * 9;
    -
    -	return options->lc + options->lp > LZMA_LCLP_MAX;
    -}
    -
    -
    -extern uint64_t
    -lzma_lzma_decoder_memusage_nocheck(const void *options)
    -{
    -	const lzma_options_lzma *const opt = options;
    -	return sizeof(lzma_coder) + lzma_lz_decoder_memusage(opt->dict_size);
    -}
    -
    -
    -extern uint64_t
    -lzma_lzma_decoder_memusage(const void *options)
    -{
    -	if (!is_lclppb_valid(options))
    -		return UINT64_MAX;
    -
    -	return lzma_lzma_decoder_memusage_nocheck(options);
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma_props_decode(void **options, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size)
    -{
    -	if (props_size != 5)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	lzma_options_lzma *opt
    -			= lzma_alloc(sizeof(lzma_options_lzma), allocator);
    -	if (opt == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	if (lzma_lzma_lclppb_decode(opt, props[0]))
    -		goto error;
    -
    -	// All dictionary sizes are accepted, including zero. LZ decoder
    -	// will automatically use a dictionary at least a few KiB even if
    -	// a smaller dictionary is requested.
    -	opt->dict_size = unaligned_read32le(props + 1);
    -
    -	opt->preset_dict = NULL;
    -	opt->preset_dict_size = 0;
    -
    -	*options = opt;
    -
    -	return LZMA_OK;
    -
    -error:
    -	lzma_free(opt, allocator);
    -	return LZMA_OPTIONS_ERROR;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_decoder.h b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_decoder.h
    deleted file mode 100644
    index fa8ecb23e..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_decoder.h
    +++ /dev/null
    @@ -1,53 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_decoder.h
    -/// \brief      LZMA decoder API
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZMA_DECODER_H
    -#define LZMA_LZMA_DECODER_H
    -
    -#include "common.h"
    -
    -
    -/// Allocates and initializes LZMA decoder
    -extern lzma_ret lzma_lzma_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern uint64_t lzma_lzma_decoder_memusage(const void *options);
    -
    -extern lzma_ret lzma_lzma_props_decode(
    -		void **options, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size);
    -
    -
    -/// \brief      Decodes the LZMA Properties byte (lc/lp/pb)
    -///
    -/// \return     true if error occurred, false on success
    -///
    -extern bool lzma_lzma_lclppb_decode(
    -		lzma_options_lzma *options, uint8_t byte);
    -
    -
    -#ifdef LZMA_LZ_DECODER_H
    -/// Allocate and setup function pointers only. This is used by LZMA1 and
    -/// LZMA2 decoders.
    -extern lzma_ret lzma_lzma_decoder_create(
    -		lzma_lz_decoder *lz, const lzma_allocator *allocator,
    -		const void *opt, lzma_lz_options *lz_options);
    -
    -/// Gets memory usage without validating lc/lp/pb. This is used by LZMA2
    -/// decoder, because raw LZMA2 decoding doesn't need lc/lp/pb.
    -extern uint64_t lzma_lzma_decoder_memusage_nocheck(const void *options);
    -
    -#endif
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder.c b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder.c
    deleted file mode 100644
    index 31cb4f044..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder.c
    +++ /dev/null
    @@ -1,676 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_encoder.c
    -/// \brief      LZMA encoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "lzma2_encoder.h"
    -#include "lzma_encoder_private.h"
    -#include "fastpos.h"
    -
    -
    -/////////////
    -// Literal //
    -/////////////
    -
    -static inline void
    -literal_matched(lzma_range_encoder *rc, probability *subcoder,
    -		uint32_t match_byte, uint32_t symbol)
    -{
    -	uint32_t offset = 0x100;
    -	symbol += UINT32_C(1) << 8;
    -
    -	do {
    -		match_byte <<= 1;
    -		const uint32_t match_bit = match_byte & offset;
    -		const uint32_t subcoder_index
    -				= offset + match_bit + (symbol >> 8);
    -		const uint32_t bit = (symbol >> 7) & 1;
    -		rc_bit(rc, &subcoder[subcoder_index], bit);
    -
    -		symbol <<= 1;
    -		offset &= ~(match_byte ^ symbol);
    -
    -	} while (symbol < (UINT32_C(1) << 16));
    -}
    -
    -
    -static inline void
    -literal(lzma_coder *coder, lzma_mf *mf, uint32_t position)
    -{
    -	// Locate the literal byte to be encoded and the subcoder.
    -	const uint8_t cur_byte = mf->buffer[
    -			mf->read_pos - mf->read_ahead];
    -	probability *subcoder = literal_subcoder(coder->literal,
    -			coder->literal_context_bits, coder->literal_pos_mask,
    -			position, mf->buffer[mf->read_pos - mf->read_ahead - 1]);
    -
    -	if (is_literal_state(coder->state)) {
    -		// Previous LZMA-symbol was a literal. Encode a normal
    -		// literal without a match byte.
    -		rc_bittree(&coder->rc, subcoder, 8, cur_byte);
    -	} else {
    -		// Previous LZMA-symbol was a match. Use the last byte of
    -		// the match as a "match byte". That is, compare the bits
    -		// of the current literal and the match byte.
    -		const uint8_t match_byte = mf->buffer[
    -				mf->read_pos - coder->reps[0] - 1
    -				- mf->read_ahead];
    -		literal_matched(&coder->rc, subcoder, match_byte, cur_byte);
    -	}
    -
    -	update_literal(coder->state);
    -}
    -
    -
    -//////////////////
    -// Match length //
    -//////////////////
    -
    -static void
    -length_update_prices(lzma_length_encoder *lc, const uint32_t pos_state)
    -{
    -	const uint32_t table_size = lc->table_size;
    -	lc->counters[pos_state] = table_size;
    -
    -	const uint32_t a0 = rc_bit_0_price(lc->choice);
    -	const uint32_t a1 = rc_bit_1_price(lc->choice);
    -	const uint32_t b0 = a1 + rc_bit_0_price(lc->choice2);
    -	const uint32_t b1 = a1 + rc_bit_1_price(lc->choice2);
    -	uint32_t *const prices = lc->prices[pos_state];
    -
    -	uint32_t i;
    -	for (i = 0; i < table_size && i < LEN_LOW_SYMBOLS; ++i)
    -		prices[i] = a0 + rc_bittree_price(lc->low[pos_state],
    -				LEN_LOW_BITS, i);
    -
    -	for (; i < table_size && i < LEN_LOW_SYMBOLS + LEN_MID_SYMBOLS; ++i)
    -		prices[i] = b0 + rc_bittree_price(lc->mid[pos_state],
    -				LEN_MID_BITS, i - LEN_LOW_SYMBOLS);
    -
    -	for (; i < table_size; ++i)
    -		prices[i] = b1 + rc_bittree_price(lc->high, LEN_HIGH_BITS,
    -				i - LEN_LOW_SYMBOLS - LEN_MID_SYMBOLS);
    -
    -	return;
    -}
    -
    -
    -static inline void
    -length(lzma_range_encoder *rc, lzma_length_encoder *lc,
    -		const uint32_t pos_state, uint32_t len, const bool fast_mode)
    -{
    -	assert(len <= MATCH_LEN_MAX);
    -	len -= MATCH_LEN_MIN;
    -
    -	if (len < LEN_LOW_SYMBOLS) {
    -		rc_bit(rc, &lc->choice, 0);
    -		rc_bittree(rc, lc->low[pos_state], LEN_LOW_BITS, len);
    -	} else {
    -		rc_bit(rc, &lc->choice, 1);
    -		len -= LEN_LOW_SYMBOLS;
    -
    -		if (len < LEN_MID_SYMBOLS) {
    -			rc_bit(rc, &lc->choice2, 0);
    -			rc_bittree(rc, lc->mid[pos_state], LEN_MID_BITS, len);
    -		} else {
    -			rc_bit(rc, &lc->choice2, 1);
    -			len -= LEN_MID_SYMBOLS;
    -			rc_bittree(rc, lc->high, LEN_HIGH_BITS, len);
    -		}
    -	}
    -
    -	// Only getoptimum uses the prices so don't update the table when
    -	// in fast mode.
    -	if (!fast_mode)
    -		if (--lc->counters[pos_state] == 0)
    -			length_update_prices(lc, pos_state);
    -}
    -
    -
    -///////////
    -// Match //
    -///////////
    -
    -static inline void
    -match(lzma_coder *coder, const uint32_t pos_state,
    -		const uint32_t distance, const uint32_t len)
    -{
    -	update_match(coder->state);
    -
    -	length(&coder->rc, &coder->match_len_encoder, pos_state, len,
    -			coder->fast_mode);
    -
    -	const uint32_t dist_slot = get_dist_slot(distance);
    -	const uint32_t dist_state = get_dist_state(len);
    -	rc_bittree(&coder->rc, coder->dist_slot[dist_state],
    -			DIST_SLOT_BITS, dist_slot);
    -
    -	if (dist_slot >= DIST_MODEL_START) {
    -		const uint32_t footer_bits = (dist_slot >> 1) - 1;
    -		const uint32_t base = (2 | (dist_slot & 1)) << footer_bits;
    -		const uint32_t dist_reduced = distance - base;
    -
    -		if (dist_slot < DIST_MODEL_END) {
    -			// Careful here: base - dist_slot - 1 can be -1, but
    -			// rc_bittree_reverse starts at probs[1], not probs[0].
    -			rc_bittree_reverse(&coder->rc,
    -				coder->dist_special + base - dist_slot - 1,
    -				footer_bits, dist_reduced);
    -		} else {
    -			rc_direct(&coder->rc, dist_reduced >> ALIGN_BITS,
    -					footer_bits - ALIGN_BITS);
    -			rc_bittree_reverse(
    -					&coder->rc, coder->dist_align,
    -					ALIGN_BITS, dist_reduced & ALIGN_MASK);
    -			++coder->align_price_count;
    -		}
    -	}
    -
    -	coder->reps[3] = coder->reps[2];
    -	coder->reps[2] = coder->reps[1];
    -	coder->reps[1] = coder->reps[0];
    -	coder->reps[0] = distance;
    -	++coder->match_price_count;
    -}
    -
    -
    -////////////////////
    -// Repeated match //
    -////////////////////
    -
    -static inline void
    -rep_match(lzma_coder *coder, const uint32_t pos_state,
    -		const uint32_t rep, const uint32_t len)
    -{
    -	if (rep == 0) {
    -		rc_bit(&coder->rc, &coder->is_rep0[coder->state], 0);
    -		rc_bit(&coder->rc,
    -				&coder->is_rep0_long[coder->state][pos_state],
    -				len != 1);
    -	} else {
    -		const uint32_t distance = coder->reps[rep];
    -		rc_bit(&coder->rc, &coder->is_rep0[coder->state], 1);
    -
    -		if (rep == 1) {
    -			rc_bit(&coder->rc, &coder->is_rep1[coder->state], 0);
    -		} else {
    -			rc_bit(&coder->rc, &coder->is_rep1[coder->state], 1);
    -			rc_bit(&coder->rc, &coder->is_rep2[coder->state],
    -					rep - 2);
    -
    -			if (rep == 3)
    -				coder->reps[3] = coder->reps[2];
    -
    -			coder->reps[2] = coder->reps[1];
    -		}
    -
    -		coder->reps[1] = coder->reps[0];
    -		coder->reps[0] = distance;
    -	}
    -
    -	if (len == 1) {
    -		update_short_rep(coder->state);
    -	} else {
    -		length(&coder->rc, &coder->rep_len_encoder, pos_state, len,
    -				coder->fast_mode);
    -		update_long_rep(coder->state);
    -	}
    -}
    -
    -
    -//////////
    -// Main //
    -//////////
    -
    -static void
    -encode_symbol(lzma_coder *coder, lzma_mf *mf,
    -		uint32_t back, uint32_t len, uint32_t position)
    -{
    -	const uint32_t pos_state = position & coder->pos_mask;
    -
    -	if (back == UINT32_MAX) {
    -		// Literal i.e. eight-bit byte
    -		assert(len == 1);
    -		rc_bit(&coder->rc,
    -				&coder->is_match[coder->state][pos_state], 0);
    -		literal(coder, mf, position);
    -	} else {
    -		// Some type of match
    -		rc_bit(&coder->rc,
    -			&coder->is_match[coder->state][pos_state], 1);
    -
    -		if (back < REPS) {
    -			// It's a repeated match i.e. the same distance
    -			// has been used earlier.
    -			rc_bit(&coder->rc, &coder->is_rep[coder->state], 1);
    -			rep_match(coder, pos_state, back, len);
    -		} else {
    -			// Normal match
    -			rc_bit(&coder->rc, &coder->is_rep[coder->state], 0);
    -			match(coder, pos_state, back - REPS, len);
    -		}
    -	}
    -
    -	assert(mf->read_ahead >= len);
    -	mf->read_ahead -= len;
    -}
    -
    -
    -static bool
    -encode_init(lzma_coder *coder, lzma_mf *mf)
    -{
    -	assert(mf_position(mf) == 0);
    -
    -	if (mf->read_pos == mf->read_limit) {
    -		if (mf->action == LZMA_RUN)
    -			return false; // We cannot do anything.
    -
    -		// We are finishing (we cannot get here when flushing).
    -		assert(mf->write_pos == mf->read_pos);
    -		assert(mf->action == LZMA_FINISH);
    -	} else {
    -		// Do the actual initialization. The first LZMA symbol must
    -		// always be a literal.
    -		mf_skip(mf, 1);
    -		mf->read_ahead = 0;
    -		rc_bit(&coder->rc, &coder->is_match[0][0], 0);
    -		rc_bittree(&coder->rc, coder->literal[0], 8, mf->buffer[0]);
    -	}
    -
    -	// Initialization is done (except if empty file).
    -	coder->is_initialized = true;
    -
    -	return true;
    -}
    -
    -
    -static void
    -encode_eopm(lzma_coder *coder, uint32_t position)
    -{
    -	const uint32_t pos_state = position & coder->pos_mask;
    -	rc_bit(&coder->rc, &coder->is_match[coder->state][pos_state], 1);
    -	rc_bit(&coder->rc, &coder->is_rep[coder->state], 0);
    -	match(coder, pos_state, UINT32_MAX, MATCH_LEN_MIN);
    -}
    -
    -
    -/// Number of bytes that a single encoding loop in lzma_lzma_encode() can
    -/// consume from the dictionary. This limit comes from lzma_lzma_optimum()
    -/// and may need to be updated if that function is significantly modified.
    -#define LOOP_INPUT_MAX (OPTS + 1)
    -
    -
    -extern lzma_ret
    -lzma_lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
    -		uint8_t *restrict out, size_t *restrict out_pos,
    -		size_t out_size, uint32_t limit)
    -{
    -	// Initialize the stream if no data has been encoded yet.
    -	if (!coder->is_initialized && !encode_init(coder, mf))
    -		return LZMA_OK;
    -
    -	// Get the lowest bits of the uncompressed offset from the LZ layer.
    -	uint32_t position = mf_position(mf);
    -
    -	while (true) {
    -		// Encode pending bits, if any. Calling this before encoding
    -		// the next symbol is needed only with plain LZMA, since
    -		// LZMA2 always provides big enough buffer to flush
    -		// everything out from the range encoder. For the same reason,
    -		// rc_encode() never returns true when this function is used
    -		// as part of LZMA2 encoder.
    -		if (rc_encode(&coder->rc, out, out_pos, out_size)) {
    -			assert(limit == UINT32_MAX);
    -			return LZMA_OK;
    -		}
    -
    -		// With LZMA2 we need to take care that compressed size of
    -		// a chunk doesn't get too big.
    -		// FIXME? Check if this could be improved.
    -		if (limit != UINT32_MAX
    -				&& (mf->read_pos - mf->read_ahead >= limit
    -					|| *out_pos + rc_pending(&coder->rc)
    -						>= LZMA2_CHUNK_MAX
    -							- LOOP_INPUT_MAX))
    -			break;
    -
    -		// Check that there is some input to process.
    -		if (mf->read_pos >= mf->read_limit) {
    -			if (mf->action == LZMA_RUN)
    -				return LZMA_OK;
    -
    -			if (mf->read_ahead == 0)
    -				break;
    -		}
    -
    -		// Get optimal match (repeat position and length).
    -		// Value ranges for pos:
    -		//   - [0, REPS): repeated match
    -		//   - [REPS, UINT32_MAX):
    -		//     match at (pos - REPS)
    -		//   - UINT32_MAX: not a match but a literal
    -		// Value ranges for len:
    -		//   - [MATCH_LEN_MIN, MATCH_LEN_MAX]
    -		uint32_t len;
    -		uint32_t back;
    -
    -		if (coder->fast_mode)
    -			lzma_lzma_optimum_fast(coder, mf, &back, &len);
    -		else
    -			lzma_lzma_optimum_normal(
    -					coder, mf, &back, &len, position);
    -
    -		encode_symbol(coder, mf, back, len, position);
    -
    -		position += len;
    -	}
    -
    -	if (!coder->is_flushed) {
    -		coder->is_flushed = true;
    -
    -		// We don't support encoding plain LZMA streams without EOPM,
    -		// and LZMA2 doesn't use EOPM at LZMA level.
    -		if (limit == UINT32_MAX)
    -			encode_eopm(coder, position);
    -
    -		// Flush the remaining bytes from the range encoder.
    -		rc_flush(&coder->rc);
    -
    -		// Copy the remaining bytes to the output buffer. If there
    -		// isn't enough output space, we will copy out the remaining
    -		// bytes on the next call to this function by using
    -		// the rc_encode() call in the encoding loop above.
    -		if (rc_encode(&coder->rc, out, out_pos, out_size)) {
    -			assert(limit == UINT32_MAX);
    -			return LZMA_OK;
    -		}
    -	}
    -
    -	// Make it ready for the next LZMA2 chunk.
    -	coder->is_flushed = false;
    -
    -	return LZMA_STREAM_END;
    -}
    -
    -
    -static lzma_ret
    -lzma_encode(lzma_coder *restrict coder, lzma_mf *restrict mf,
    -		uint8_t *restrict out, size_t *restrict out_pos,
    -		size_t out_size)
    -{
    -	// Plain LZMA has no support for sync-flushing.
    -	if (unlikely(mf->action == LZMA_SYNC_FLUSH))
    -		return LZMA_OPTIONS_ERROR;
    -
    -	return lzma_lzma_encode(coder, mf, out, out_pos, out_size, UINT32_MAX);
    -}
    -
    -
    -////////////////////
    -// Initialization //
    -////////////////////
    -
    -static bool
    -is_options_valid(const lzma_options_lzma *options)
    -{
    -	// Validate some of the options. LZ encoder validates nice_len too
    -	// but we need a valid value here earlier.
    -	return is_lclppb_valid(options)
    -			&& options->nice_len >= MATCH_LEN_MIN
    -			&& options->nice_len <= MATCH_LEN_MAX
    -			&& (options->mode == LZMA_MODE_FAST
    -				|| options->mode == LZMA_MODE_NORMAL);
    -}
    -
    -
    -static void
    -set_lz_options(lzma_lz_options *lz_options, const lzma_options_lzma *options)
    -{
    -	// LZ encoder initialization does the validation for these so we
    -	// don't need to validate here.
    -	lz_options->before_size = OPTS;
    -	lz_options->dict_size = options->dict_size;
    -	lz_options->after_size = LOOP_INPUT_MAX;
    -	lz_options->match_len_max = MATCH_LEN_MAX;
    -	lz_options->nice_len = options->nice_len;
    -	lz_options->match_finder = options->mf;
    -	lz_options->depth = options->depth;
    -	lz_options->preset_dict = options->preset_dict;
    -	lz_options->preset_dict_size = options->preset_dict_size;
    -	return;
    -}
    -
    -
    -static void
    -length_encoder_reset(lzma_length_encoder *lencoder,
    -		const uint32_t num_pos_states, const bool fast_mode)
    -{
    -	bit_reset(lencoder->choice);
    -	bit_reset(lencoder->choice2);
    -
    -	for (size_t pos_state = 0; pos_state < num_pos_states; ++pos_state) {
    -		bittree_reset(lencoder->low[pos_state], LEN_LOW_BITS);
    -		bittree_reset(lencoder->mid[pos_state], LEN_MID_BITS);
    -	}
    -
    -	bittree_reset(lencoder->high, LEN_HIGH_BITS);
    -
    -	if (!fast_mode)
    -		for (size_t pos_state = 0; pos_state < num_pos_states;
    -				++pos_state)
    -			length_update_prices(lencoder, pos_state);
    -
    -	return;
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma_encoder_reset(lzma_coder *coder, const lzma_options_lzma *options)
    -{
    -	if (!is_options_valid(options))
    -		return LZMA_OPTIONS_ERROR;
    -
    -	coder->pos_mask = (1U << options->pb) - 1;
    -	coder->literal_context_bits = options->lc;
    -	coder->literal_pos_mask = (1U << options->lp) - 1;
    -
    -	// Range coder
    -	rc_reset(&coder->rc);
    -
    -	// State
    -	coder->state = STATE_LIT_LIT;
    -	for (size_t i = 0; i < REPS; ++i)
    -		coder->reps[i] = 0;
    -
    -	literal_init(coder->literal, options->lc, options->lp);
    -
    -	// Bit encoders
    -	for (size_t i = 0; i < STATES; ++i) {
    -		for (size_t j = 0; j <= coder->pos_mask; ++j) {
    -			bit_reset(coder->is_match[i][j]);
    -			bit_reset(coder->is_rep0_long[i][j]);
    -		}
    -
    -		bit_reset(coder->is_rep[i]);
    -		bit_reset(coder->is_rep0[i]);
    -		bit_reset(coder->is_rep1[i]);
    -		bit_reset(coder->is_rep2[i]);
    -	}
    -
    -	for (size_t i = 0; i < FULL_DISTANCES - DIST_MODEL_END; ++i)
    -		bit_reset(coder->dist_special[i]);
    -
    -	// Bit tree encoders
    -	for (size_t i = 0; i < DIST_STATES; ++i)
    -		bittree_reset(coder->dist_slot[i], DIST_SLOT_BITS);
    -
    -	bittree_reset(coder->dist_align, ALIGN_BITS);
    -
    -	// Length encoders
    -	length_encoder_reset(&coder->match_len_encoder,
    -			1U << options->pb, coder->fast_mode);
    -
    -	length_encoder_reset(&coder->rep_len_encoder,
    -			1U << options->pb, coder->fast_mode);
    -
    -	// Price counts are incremented every time appropriate probabilities
    -	// are changed. price counts are set to zero when the price tables
    -	// are updated, which is done when the appropriate price counts have
    -	// big enough value, and lzma_mf.read_ahead == 0 which happens at
    -	// least every OPTS (a few thousand) possible price count increments.
    -	//
    -	// By resetting price counts to UINT32_MAX / 2, we make sure that the
    -	// price tables will be initialized before they will be used (since
    -	// the value is definitely big enough), and that it is OK to increment
    -	// price counts without risk of integer overflow (since UINT32_MAX / 2
    -	// is small enough). The current code doesn't increment price counts
    -	// before initializing price tables, but it maybe done in future if
    -	// we add support for saving the state between LZMA2 chunks.
    -	coder->match_price_count = UINT32_MAX / 2;
    -	coder->align_price_count = UINT32_MAX / 2;
    -
    -	coder->opts_end_index = 0;
    -	coder->opts_current_index = 0;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma_encoder_create(lzma_coder **coder_ptr,
    -		const lzma_allocator *allocator,
    -		const lzma_options_lzma *options, lzma_lz_options *lz_options)
    -{
    -	// Allocate lzma_coder if it wasn't already allocated.
    -	if (*coder_ptr == NULL) {
    -		*coder_ptr = lzma_alloc(sizeof(lzma_coder), allocator);
    -		if (*coder_ptr == NULL)
    -			return LZMA_MEM_ERROR;
    -	}
    -
    -	lzma_coder *coder = *coder_ptr;
    -
    -	// Set compression mode. We haven't validates the options yet,
    -	// but it's OK here, since nothing bad happens with invalid
    -	// options in the code below, and they will get rejected by
    -	// lzma_lzma_encoder_reset() call at the end of this function.
    -	switch (options->mode) {
    -		case LZMA_MODE_FAST:
    -			coder->fast_mode = true;
    -			break;
    -
    -		case LZMA_MODE_NORMAL: {
    -			coder->fast_mode = false;
    -
    -			// Set dist_table_size.
    -			// Round the dictionary size up to next 2^n.
    -			uint32_t log_size = 0;
    -			while ((UINT32_C(1) << log_size) < options->dict_size)
    -				++log_size;
    -
    -			coder->dist_table_size = log_size * 2;
    -
    -			// Length encoders' price table size
    -			coder->match_len_encoder.table_size
    -				= options->nice_len + 1 - MATCH_LEN_MIN;
    -			coder->rep_len_encoder.table_size
    -				= options->nice_len + 1 - MATCH_LEN_MIN;
    -			break;
    -		}
    -
    -		default:
    -			return LZMA_OPTIONS_ERROR;
    -	}
    -
    -	// We don't need to write the first byte as literal if there is
    -	// a non-empty preset dictionary. encode_init() wouldn't even work
    -	// if there is a non-empty preset dictionary, because encode_init()
    -	// assumes that position is zero and previous byte is also zero.
    -	coder->is_initialized = options->preset_dict != NULL
    -			&& options->preset_dict_size > 0;
    -	coder->is_flushed = false;
    -
    -	set_lz_options(lz_options, options);
    -
    -	return lzma_lzma_encoder_reset(coder, options);
    -}
    -
    -
    -static lzma_ret
    -lzma_encoder_init(lzma_lz_encoder *lz, const lzma_allocator *allocator,
    -		const void *options, lzma_lz_options *lz_options)
    -{
    -	lz->code = &lzma_encode;
    -	return lzma_lzma_encoder_create(
    -			&lz->coder, allocator, options, lz_options);
    -}
    -
    -
    -extern lzma_ret
    -lzma_lzma_encoder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return lzma_lz_encoder_init(
    -			next, allocator, filters, &lzma_encoder_init);
    -}
    -
    -
    -extern uint64_t
    -lzma_lzma_encoder_memusage(const void *options)
    -{
    -	if (!is_options_valid(options))
    -		return UINT64_MAX;
    -
    -	lzma_lz_options lz_options;
    -	set_lz_options(&lz_options, options);
    -
    -	const uint64_t lz_memusage = lzma_lz_encoder_memusage(&lz_options);
    -	if (lz_memusage == UINT64_MAX)
    -		return UINT64_MAX;
    -
    -	return (uint64_t)(sizeof(lzma_coder)) + lz_memusage;
    -}
    -
    -
    -extern bool
    -lzma_lzma_lclppb_encode(const lzma_options_lzma *options, uint8_t *byte)
    -{
    -	if (!is_lclppb_valid(options))
    -		return true;
    -
    -	*byte = (options->pb * 5 + options->lp) * 9 + options->lc;
    -	assert(*byte <= (4 * 5 + 4) * 9 + 8);
    -
    -	return false;
    -}
    -
    -
    -#ifdef HAVE_ENCODER_LZMA1
    -extern lzma_ret
    -lzma_lzma_props_encode(const void *options, uint8_t *out)
    -{
    -	const lzma_options_lzma *const opt = options;
    -
    -	if (lzma_lzma_lclppb_encode(opt, out))
    -		return LZMA_PROG_ERROR;
    -
    -	unaligned_write32le(out + 1, opt->dict_size);
    -
    -	return LZMA_OK;
    -}
    -#endif
    -
    -
    -extern LZMA_API(lzma_bool)
    -lzma_mode_is_supported(lzma_mode mode)
    -{
    -	return mode == LZMA_MODE_FAST || mode == LZMA_MODE_NORMAL;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder.h b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder.h
    deleted file mode 100644
    index cc9cc2f27..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder.h
    +++ /dev/null
    @@ -1,55 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_encoder.h
    -/// \brief      LZMA encoder API
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZMA_ENCODER_H
    -#define LZMA_LZMA_ENCODER_H
    -
    -#include "common.h"
    -
    -
    -extern lzma_ret lzma_lzma_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -
    -extern uint64_t lzma_lzma_encoder_memusage(const void *options);
    -
    -extern lzma_ret lzma_lzma_props_encode(const void *options, uint8_t *out);
    -
    -
    -/// Encodes lc/lp/pb into one byte. Returns false on success and true on error.
    -extern bool lzma_lzma_lclppb_encode(
    -		const lzma_options_lzma *options, uint8_t *byte);
    -
    -
    -#ifdef LZMA_LZ_ENCODER_H
    -
    -/// Initializes raw LZMA encoder; this is used by LZMA2.
    -extern lzma_ret lzma_lzma_encoder_create(
    -		lzma_coder **coder_ptr, const lzma_allocator *allocator,
    -		const lzma_options_lzma *options, lzma_lz_options *lz_options);
    -
    -
    -/// Resets an already initialized LZMA encoder; this is used by LZMA2.
    -extern lzma_ret lzma_lzma_encoder_reset(
    -		lzma_coder *coder, const lzma_options_lzma *options);
    -
    -
    -extern lzma_ret lzma_lzma_encode(lzma_coder *restrict coder,
    -		lzma_mf *restrict mf, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size,
    -		uint32_t read_limit);
    -
    -#endif
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_optimum_fast.c b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_optimum_fast.c
    deleted file mode 100644
    index 9b30347cb..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_optimum_fast.c
    +++ /dev/null
    @@ -1,169 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_encoder_optimum_fast.c
    -//
    -//  Author:     Igor Pavlov
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "lzma_encoder_private.h"
    -#include "memcmplen.h"
    -
    -
    -#define change_pair(small_dist, big_dist) \
    -	(((big_dist) >> 7) > (small_dist))
    -
    -
    -extern void
    -lzma_lzma_optimum_fast(lzma_coder *restrict coder, lzma_mf *restrict mf,
    -		uint32_t *restrict back_res, uint32_t *restrict len_res)
    -{
    -	const uint32_t nice_len = mf->nice_len;
    -
    -	uint32_t len_main;
    -	uint32_t matches_count;
    -	if (mf->read_ahead == 0) {
    -		len_main = mf_find(mf, &matches_count, coder->matches);
    -	} else {
    -		assert(mf->read_ahead == 1);
    -		len_main = coder->longest_match_length;
    -		matches_count = coder->matches_count;
    -	}
    -
    -	const uint8_t *buf = mf_ptr(mf) - 1;
    -	const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX);
    -
    -	if (buf_avail < 2) {
    -		// There's not enough input left to encode a match.
    -		*back_res = UINT32_MAX;
    -		*len_res = 1;
    -		return;
    -	}
    -
    -	// Look for repeated matches; scan the previous four match distances
    -	uint32_t rep_len = 0;
    -	uint32_t rep_index = 0;
    -
    -	for (uint32_t i = 0; i < REPS; ++i) {
    -		// Pointer to the beginning of the match candidate
    -		const uint8_t *const buf_back = buf - coder->reps[i] - 1;
    -
    -		// If the first two bytes (2 == MATCH_LEN_MIN) do not match,
    -		// this rep is not useful.
    -		if (not_equal_16(buf, buf_back))
    -			continue;
    -
    -		// The first two bytes matched.
    -		// Calculate the length of the match.
    -		const uint32_t len = lzma_memcmplen(
    -				buf, buf_back, 2, buf_avail);
    -
    -		// If we have found a repeated match that is at least
    -		// nice_len long, return it immediately.
    -		if (len >= nice_len) {
    -			*back_res = i;
    -			*len_res = len;
    -			mf_skip(mf, len - 1);
    -			return;
    -		}
    -
    -		if (len > rep_len) {
    -			rep_index = i;
    -			rep_len = len;
    -		}
    -	}
    -
    -	// We didn't find a long enough repeated match. Encode it as a normal
    -	// match if the match length is at least nice_len.
    -	if (len_main >= nice_len) {
    -		*back_res = coder->matches[matches_count - 1].dist + REPS;
    -		*len_res = len_main;
    -		mf_skip(mf, len_main - 1);
    -		return;
    -	}
    -
    -	uint32_t back_main = 0;
    -	if (len_main >= 2) {
    -		back_main = coder->matches[matches_count - 1].dist;
    -
    -		while (matches_count > 1 && len_main ==
    -				coder->matches[matches_count - 2].len + 1) {
    -			if (!change_pair(coder->matches[
    -						matches_count - 2].dist,
    -					back_main))
    -				break;
    -
    -			--matches_count;
    -			len_main = coder->matches[matches_count - 1].len;
    -			back_main = coder->matches[matches_count - 1].dist;
    -		}
    -
    -		if (len_main == 2 && back_main >= 0x80)
    -			len_main = 1;
    -	}
    -
    -	if (rep_len >= 2) {
    -		if (rep_len + 1 >= len_main
    -				|| (rep_len + 2 >= len_main
    -					&& back_main > (UINT32_C(1) << 9))
    -				|| (rep_len + 3 >= len_main
    -					&& back_main > (UINT32_C(1) << 15))) {
    -			*back_res = rep_index;
    -			*len_res = rep_len;
    -			mf_skip(mf, rep_len - 1);
    -			return;
    -		}
    -	}
    -
    -	if (len_main < 2 || buf_avail <= 2) {
    -		*back_res = UINT32_MAX;
    -		*len_res = 1;
    -		return;
    -	}
    -
    -	// Get the matches for the next byte. If we find a better match,
    -	// the current byte is encoded as a literal.
    -	coder->longest_match_length = mf_find(mf,
    -			&coder->matches_count, coder->matches);
    -
    -	if (coder->longest_match_length >= 2) {
    -		const uint32_t new_dist = coder->matches[
    -				coder->matches_count - 1].dist;
    -
    -		if ((coder->longest_match_length >= len_main
    -					&& new_dist < back_main)
    -				|| (coder->longest_match_length == len_main + 1
    -					&& !change_pair(back_main, new_dist))
    -				|| (coder->longest_match_length > len_main + 1)
    -				|| (coder->longest_match_length + 1 >= len_main
    -					&& len_main >= 3
    -					&& change_pair(new_dist, back_main))) {
    -			*back_res = UINT32_MAX;
    -			*len_res = 1;
    -			return;
    -		}
    -	}
    -
    -	// In contrast to LZMA SDK, dictionary could not have been moved
    -	// between mf_find() calls, thus it is safe to just increment
    -	// the old buf pointer instead of recalculating it with mf_ptr().
    -	++buf;
    -
    -	const uint32_t limit = my_max(2, len_main - 1);
    -
    -	for (uint32_t i = 0; i < REPS; ++i) {
    -		if (memcmp(buf, buf - coder->reps[i] - 1, limit) == 0) {
    -			*back_res = UINT32_MAX;
    -			*len_res = 1;
    -			return;
    -		}
    -	}
    -
    -	*back_res = back_main + REPS;
    -	*len_res = len_main;
    -	mf_skip(mf, len_main - 2);
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_optimum_normal.c b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_optimum_normal.c
    deleted file mode 100644
    index a36057988..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_optimum_normal.c
    +++ /dev/null
    @@ -1,854 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_encoder_optimum_normal.c
    -//
    -//  Author:     Igor Pavlov
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "lzma_encoder_private.h"
    -#include "fastpos.h"
    -#include "memcmplen.h"
    -
    -
    -////////////
    -// Prices //
    -////////////
    -
    -static uint32_t
    -get_literal_price(const lzma_coder *const coder, const uint32_t pos,
    -		const uint32_t prev_byte, const bool match_mode,
    -		uint32_t match_byte, uint32_t symbol)
    -{
    -	const probability *const subcoder = literal_subcoder(coder->literal,
    -			coder->literal_context_bits, coder->literal_pos_mask,
    -			pos, prev_byte);
    -
    -	uint32_t price = 0;
    -
    -	if (!match_mode) {
    -		price = rc_bittree_price(subcoder, 8, symbol);
    -	} else {
    -		uint32_t offset = 0x100;
    -		symbol += UINT32_C(1) << 8;
    -
    -		do {
    -			match_byte <<= 1;
    -
    -			const uint32_t match_bit = match_byte & offset;
    -			const uint32_t subcoder_index
    -					= offset + match_bit + (symbol >> 8);
    -			const uint32_t bit = (symbol >> 7) & 1;
    -			price += rc_bit_price(subcoder[subcoder_index], bit);
    -
    -			symbol <<= 1;
    -			offset &= ~(match_byte ^ symbol);
    -
    -		} while (symbol < (UINT32_C(1) << 16));
    -	}
    -
    -	return price;
    -}
    -
    -
    -static inline uint32_t
    -get_len_price(const lzma_length_encoder *const lencoder,
    -		const uint32_t len, const uint32_t pos_state)
    -{
    -	// NOTE: Unlike the other price tables, length prices are updated
    -	// in lzma_encoder.c
    -	return lencoder->prices[pos_state][len - MATCH_LEN_MIN];
    -}
    -
    -
    -static inline uint32_t
    -get_short_rep_price(const lzma_coder *const coder,
    -		const lzma_lzma_state state, const uint32_t pos_state)
    -{
    -	return rc_bit_0_price(coder->is_rep0[state])
    -		+ rc_bit_0_price(coder->is_rep0_long[state][pos_state]);
    -}
    -
    -
    -static inline uint32_t
    -get_pure_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
    -		const lzma_lzma_state state, uint32_t pos_state)
    -{
    -	uint32_t price;
    -
    -	if (rep_index == 0) {
    -		price = rc_bit_0_price(coder->is_rep0[state]);
    -		price += rc_bit_1_price(coder->is_rep0_long[state][pos_state]);
    -	} else {
    -		price = rc_bit_1_price(coder->is_rep0[state]);
    -
    -		if (rep_index == 1) {
    -			price += rc_bit_0_price(coder->is_rep1[state]);
    -		} else {
    -			price += rc_bit_1_price(coder->is_rep1[state]);
    -			price += rc_bit_price(coder->is_rep2[state],
    -					rep_index - 2);
    -		}
    -	}
    -
    -	return price;
    -}
    -
    -
    -static inline uint32_t
    -get_rep_price(const lzma_coder *const coder, const uint32_t rep_index,
    -		const uint32_t len, const lzma_lzma_state state,
    -		const uint32_t pos_state)
    -{
    -	return get_len_price(&coder->rep_len_encoder, len, pos_state)
    -		+ get_pure_rep_price(coder, rep_index, state, pos_state);
    -}
    -
    -
    -static inline uint32_t
    -get_dist_len_price(const lzma_coder *const coder, const uint32_t dist,
    -		const uint32_t len, const uint32_t pos_state)
    -{
    -	const uint32_t dist_state = get_dist_state(len);
    -	uint32_t price;
    -
    -	if (dist < FULL_DISTANCES) {
    -		price = coder->dist_prices[dist_state][dist];
    -	} else {
    -		const uint32_t dist_slot = get_dist_slot_2(dist);
    -		price = coder->dist_slot_prices[dist_state][dist_slot]
    -				+ coder->align_prices[dist & ALIGN_MASK];
    -	}
    -
    -	price += get_len_price(&coder->match_len_encoder, len, pos_state);
    -
    -	return price;
    -}
    -
    -
    -static void
    -fill_dist_prices(lzma_coder *coder)
    -{
    -	for (uint32_t dist_state = 0; dist_state < DIST_STATES; ++dist_state) {
    -
    -		uint32_t *const dist_slot_prices
    -				= coder->dist_slot_prices[dist_state];
    -
    -		// Price to encode the dist_slot.
    -		for (uint32_t dist_slot = 0;
    -				dist_slot < coder->dist_table_size; ++dist_slot)
    -			dist_slot_prices[dist_slot] = rc_bittree_price(
    -					coder->dist_slot[dist_state],
    -					DIST_SLOT_BITS, dist_slot);
    -
    -		// For matches with distance >= FULL_DISTANCES, add the price
    -		// of the direct bits part of the match distance. (Align bits
    -		// are handled by fill_align_prices()).
    -		for (uint32_t dist_slot = DIST_MODEL_END;
    -				dist_slot < coder->dist_table_size;
    -				++dist_slot)
    -			dist_slot_prices[dist_slot] += rc_direct_price(
    -					((dist_slot >> 1) - 1) - ALIGN_BITS);
    -
    -		// Distances in the range [0, 3] are fully encoded with
    -		// dist_slot, so they are used for coder->dist_prices
    -		// as is.
    -		for (uint32_t i = 0; i < DIST_MODEL_START; ++i)
    -			coder->dist_prices[dist_state][i]
    -					= dist_slot_prices[i];
    -	}
    -
    -	// Distances in the range [4, 127] depend on dist_slot and
    -	// dist_special. We do this in a loop separate from the above
    -	// loop to avoid redundant calls to get_dist_slot().
    -	for (uint32_t i = DIST_MODEL_START; i < FULL_DISTANCES; ++i) {
    -		const uint32_t dist_slot = get_dist_slot(i);
    -		const uint32_t footer_bits = ((dist_slot >> 1) - 1);
    -		const uint32_t base = (2 | (dist_slot & 1)) << footer_bits;
    -		const uint32_t price = rc_bittree_reverse_price(
    -				coder->dist_special + base - dist_slot - 1,
    -				footer_bits, i - base);
    -
    -		for (uint32_t dist_state = 0; dist_state < DIST_STATES;
    -				++dist_state)
    -			coder->dist_prices[dist_state][i]
    -					= price + coder->dist_slot_prices[
    -						dist_state][dist_slot];
    -	}
    -
    -	coder->match_price_count = 0;
    -	return;
    -}
    -
    -
    -static void
    -fill_align_prices(lzma_coder *coder)
    -{
    -	for (uint32_t i = 0; i < ALIGN_SIZE; ++i)
    -		coder->align_prices[i] = rc_bittree_reverse_price(
    -				coder->dist_align, ALIGN_BITS, i);
    -
    -	coder->align_price_count = 0;
    -	return;
    -}
    -
    -
    -/////////////
    -// Optimal //
    -/////////////
    -
    -static inline void
    -make_literal(lzma_optimal *optimal)
    -{
    -	optimal->back_prev = UINT32_MAX;
    -	optimal->prev_1_is_literal = false;
    -}
    -
    -
    -static inline void
    -make_short_rep(lzma_optimal *optimal)
    -{
    -	optimal->back_prev = 0;
    -	optimal->prev_1_is_literal = false;
    -}
    -
    -
    -#define is_short_rep(optimal) \
    -	((optimal).back_prev == 0)
    -
    -
    -static void
    -backward(lzma_coder *restrict coder, uint32_t *restrict len_res,
    -		uint32_t *restrict back_res, uint32_t cur)
    -{
    -	coder->opts_end_index = cur;
    -
    -	uint32_t pos_mem = coder->opts[cur].pos_prev;
    -	uint32_t back_mem = coder->opts[cur].back_prev;
    -
    -	do {
    -		if (coder->opts[cur].prev_1_is_literal) {
    -			make_literal(&coder->opts[pos_mem]);
    -			coder->opts[pos_mem].pos_prev = pos_mem - 1;
    -
    -			if (coder->opts[cur].prev_2) {
    -				coder->opts[pos_mem - 1].prev_1_is_literal
    -						= false;
    -				coder->opts[pos_mem - 1].pos_prev
    -						= coder->opts[cur].pos_prev_2;
    -				coder->opts[pos_mem - 1].back_prev
    -						= coder->opts[cur].back_prev_2;
    -			}
    -		}
    -
    -		const uint32_t pos_prev = pos_mem;
    -		const uint32_t back_cur = back_mem;
    -
    -		back_mem = coder->opts[pos_prev].back_prev;
    -		pos_mem = coder->opts[pos_prev].pos_prev;
    -
    -		coder->opts[pos_prev].back_prev = back_cur;
    -		coder->opts[pos_prev].pos_prev = cur;
    -		cur = pos_prev;
    -
    -	} while (cur != 0);
    -
    -	coder->opts_current_index = coder->opts[0].pos_prev;
    -	*len_res = coder->opts[0].pos_prev;
    -	*back_res = coder->opts[0].back_prev;
    -
    -	return;
    -}
    -
    -
    -//////////
    -// Main //
    -//////////
    -
    -static inline uint32_t
    -helper1(lzma_coder *restrict coder, lzma_mf *restrict mf,
    -		uint32_t *restrict back_res, uint32_t *restrict len_res,
    -		uint32_t position)
    -{
    -	const uint32_t nice_len = mf->nice_len;
    -
    -	uint32_t len_main;
    -	uint32_t matches_count;
    -
    -	if (mf->read_ahead == 0) {
    -		len_main = mf_find(mf, &matches_count, coder->matches);
    -	} else {
    -		assert(mf->read_ahead == 1);
    -		len_main = coder->longest_match_length;
    -		matches_count = coder->matches_count;
    -	}
    -
    -	const uint32_t buf_avail = my_min(mf_avail(mf) + 1, MATCH_LEN_MAX);
    -	if (buf_avail < 2) {
    -		*back_res = UINT32_MAX;
    -		*len_res = 1;
    -		return UINT32_MAX;
    -	}
    -
    -	const uint8_t *const buf = mf_ptr(mf) - 1;
    -
    -	uint32_t rep_lens[REPS];
    -	uint32_t rep_max_index = 0;
    -
    -	for (uint32_t i = 0; i < REPS; ++i) {
    -		const uint8_t *const buf_back = buf - coder->reps[i] - 1;
    -
    -		if (not_equal_16(buf, buf_back)) {
    -			rep_lens[i] = 0;
    -			continue;
    -		}
    -
    -		rep_lens[i] = lzma_memcmplen(buf, buf_back, 2, buf_avail);
    -
    -		if (rep_lens[i] > rep_lens[rep_max_index])
    -			rep_max_index = i;
    -	}
    -
    -	if (rep_lens[rep_max_index] >= nice_len) {
    -		*back_res = rep_max_index;
    -		*len_res = rep_lens[rep_max_index];
    -		mf_skip(mf, *len_res - 1);
    -		return UINT32_MAX;
    -	}
    -
    -
    -	if (len_main >= nice_len) {
    -		*back_res = coder->matches[matches_count - 1].dist + REPS;
    -		*len_res = len_main;
    -		mf_skip(mf, len_main - 1);
    -		return UINT32_MAX;
    -	}
    -
    -	const uint8_t current_byte = *buf;
    -	const uint8_t match_byte = *(buf - coder->reps[0] - 1);
    -
    -	if (len_main < 2 && current_byte != match_byte
    -			&& rep_lens[rep_max_index] < 2) {
    -		*back_res = UINT32_MAX;
    -		*len_res = 1;
    -		return UINT32_MAX;
    -	}
    -
    -	coder->opts[0].state = coder->state;
    -
    -	const uint32_t pos_state = position & coder->pos_mask;
    -
    -	coder->opts[1].price = rc_bit_0_price(
    -				coder->is_match[coder->state][pos_state])
    -			+ get_literal_price(coder, position, buf[-1],
    -				!is_literal_state(coder->state),
    -				match_byte, current_byte);
    -
    -	make_literal(&coder->opts[1]);
    -
    -	const uint32_t match_price = rc_bit_1_price(
    -			coder->is_match[coder->state][pos_state]);
    -	const uint32_t rep_match_price = match_price
    -			+ rc_bit_1_price(coder->is_rep[coder->state]);
    -
    -	if (match_byte == current_byte) {
    -		const uint32_t short_rep_price = rep_match_price
    -				+ get_short_rep_price(
    -					coder, coder->state, pos_state);
    -
    -		if (short_rep_price < coder->opts[1].price) {
    -			coder->opts[1].price = short_rep_price;
    -			make_short_rep(&coder->opts[1]);
    -		}
    -	}
    -
    -	const uint32_t len_end = my_max(len_main, rep_lens[rep_max_index]);
    -
    -	if (len_end < 2) {
    -		*back_res = coder->opts[1].back_prev;
    -		*len_res = 1;
    -		return UINT32_MAX;
    -	}
    -
    -	coder->opts[1].pos_prev = 0;
    -
    -	for (uint32_t i = 0; i < REPS; ++i)
    -		coder->opts[0].backs[i] = coder->reps[i];
    -
    -	uint32_t len = len_end;
    -	do {
    -		coder->opts[len].price = RC_INFINITY_PRICE;
    -	} while (--len >= 2);
    -
    -
    -	for (uint32_t i = 0; i < REPS; ++i) {
    -		uint32_t rep_len = rep_lens[i];
    -		if (rep_len < 2)
    -			continue;
    -
    -		const uint32_t price = rep_match_price + get_pure_rep_price(
    -				coder, i, coder->state, pos_state);
    -
    -		do {
    -			const uint32_t cur_and_len_price = price
    -					+ get_len_price(
    -						&coder->rep_len_encoder,
    -						rep_len, pos_state);
    -
    -			if (cur_and_len_price < coder->opts[rep_len].price) {
    -				coder->opts[rep_len].price = cur_and_len_price;
    -				coder->opts[rep_len].pos_prev = 0;
    -				coder->opts[rep_len].back_prev = i;
    -				coder->opts[rep_len].prev_1_is_literal = false;
    -			}
    -		} while (--rep_len >= 2);
    -	}
    -
    -
    -	const uint32_t normal_match_price = match_price
    -			+ rc_bit_0_price(coder->is_rep[coder->state]);
    -
    -	len = rep_lens[0] >= 2 ? rep_lens[0] + 1 : 2;
    -	if (len <= len_main) {
    -		uint32_t i = 0;
    -		while (len > coder->matches[i].len)
    -			++i;
    -
    -		for(; ; ++len) {
    -			const uint32_t dist = coder->matches[i].dist;
    -			const uint32_t cur_and_len_price = normal_match_price
    -					+ get_dist_len_price(coder,
    -						dist, len, pos_state);
    -
    -			if (cur_and_len_price < coder->opts[len].price) {
    -				coder->opts[len].price = cur_and_len_price;
    -				coder->opts[len].pos_prev = 0;
    -				coder->opts[len].back_prev = dist + REPS;
    -				coder->opts[len].prev_1_is_literal = false;
    -			}
    -
    -			if (len == coder->matches[i].len)
    -				if (++i == matches_count)
    -					break;
    -		}
    -	}
    -
    -	return len_end;
    -}
    -
    -
    -static inline uint32_t
    -helper2(lzma_coder *coder, uint32_t *reps, const uint8_t *buf,
    -		uint32_t len_end, uint32_t position, const uint32_t cur,
    -		const uint32_t nice_len, const uint32_t buf_avail_full)
    -{
    -	uint32_t matches_count = coder->matches_count;
    -	uint32_t new_len = coder->longest_match_length;
    -	uint32_t pos_prev = coder->opts[cur].pos_prev;
    -	lzma_lzma_state state;
    -
    -	if (coder->opts[cur].prev_1_is_literal) {
    -		--pos_prev;
    -
    -		if (coder->opts[cur].prev_2) {
    -			state = coder->opts[coder->opts[cur].pos_prev_2].state;
    -
    -			if (coder->opts[cur].back_prev_2 < REPS)
    -				update_long_rep(state);
    -			else
    -				update_match(state);
    -
    -		} else {
    -			state = coder->opts[pos_prev].state;
    -		}
    -
    -		update_literal(state);
    -
    -	} else {
    -		state = coder->opts[pos_prev].state;
    -	}
    -
    -	if (pos_prev == cur - 1) {
    -		if (is_short_rep(coder->opts[cur]))
    -			update_short_rep(state);
    -		else
    -			update_literal(state);
    -	} else {
    -		uint32_t pos;
    -		if (coder->opts[cur].prev_1_is_literal
    -				&& coder->opts[cur].prev_2) {
    -			pos_prev = coder->opts[cur].pos_prev_2;
    -			pos = coder->opts[cur].back_prev_2;
    -			update_long_rep(state);
    -		} else {
    -			pos = coder->opts[cur].back_prev;
    -			if (pos < REPS)
    -				update_long_rep(state);
    -			else
    -				update_match(state);
    -		}
    -
    -		if (pos < REPS) {
    -			reps[0] = coder->opts[pos_prev].backs[pos];
    -
    -			uint32_t i;
    -			for (i = 1; i <= pos; ++i)
    -				reps[i] = coder->opts[pos_prev].backs[i - 1];
    -
    -			for (; i < REPS; ++i)
    -				reps[i] = coder->opts[pos_prev].backs[i];
    -
    -		} else {
    -			reps[0] = pos - REPS;
    -
    -			for (uint32_t i = 1; i < REPS; ++i)
    -				reps[i] = coder->opts[pos_prev].backs[i - 1];
    -		}
    -	}
    -
    -	coder->opts[cur].state = state;
    -
    -	for (uint32_t i = 0; i < REPS; ++i)
    -		coder->opts[cur].backs[i] = reps[i];
    -
    -	const uint32_t cur_price = coder->opts[cur].price;
    -
    -	const uint8_t current_byte = *buf;
    -	const uint8_t match_byte = *(buf - reps[0] - 1);
    -
    -	const uint32_t pos_state = position & coder->pos_mask;
    -
    -	const uint32_t cur_and_1_price = cur_price
    -			+ rc_bit_0_price(coder->is_match[state][pos_state])
    -			+ get_literal_price(coder, position, buf[-1],
    -			!is_literal_state(state), match_byte, current_byte);
    -
    -	bool next_is_literal = false;
    -
    -	if (cur_and_1_price < coder->opts[cur + 1].price) {
    -		coder->opts[cur + 1].price = cur_and_1_price;
    -		coder->opts[cur + 1].pos_prev = cur;
    -		make_literal(&coder->opts[cur + 1]);
    -		next_is_literal = true;
    -	}
    -
    -	const uint32_t match_price = cur_price
    -			+ rc_bit_1_price(coder->is_match[state][pos_state]);
    -	const uint32_t rep_match_price = match_price
    -			+ rc_bit_1_price(coder->is_rep[state]);
    -
    -	if (match_byte == current_byte
    -			&& !(coder->opts[cur + 1].pos_prev < cur
    -				&& coder->opts[cur + 1].back_prev == 0)) {
    -
    -		const uint32_t short_rep_price = rep_match_price
    -				+ get_short_rep_price(coder, state, pos_state);
    -
    -		if (short_rep_price <= coder->opts[cur + 1].price) {
    -			coder->opts[cur + 1].price = short_rep_price;
    -			coder->opts[cur + 1].pos_prev = cur;
    -			make_short_rep(&coder->opts[cur + 1]);
    -			next_is_literal = true;
    -		}
    -	}
    -
    -	if (buf_avail_full < 2)
    -		return len_end;
    -
    -	const uint32_t buf_avail = my_min(buf_avail_full, nice_len);
    -
    -	if (!next_is_literal && match_byte != current_byte) { // speed optimization
    -		// try literal + rep0
    -		const uint8_t *const buf_back = buf - reps[0] - 1;
    -		const uint32_t limit = my_min(buf_avail_full, nice_len + 1);
    -
    -		const uint32_t len_test = lzma_memcmplen(buf, buf_back, 1, limit) - 1;
    -
    -		if (len_test >= 2) {
    -			lzma_lzma_state state_2 = state;
    -			update_literal(state_2);
    -
    -			const uint32_t pos_state_next = (position + 1) & coder->pos_mask;
    -			const uint32_t next_rep_match_price = cur_and_1_price
    -					+ rc_bit_1_price(coder->is_match[state_2][pos_state_next])
    -					+ rc_bit_1_price(coder->is_rep[state_2]);
    -
    -			//for (; len_test >= 2; --len_test) {
    -			const uint32_t offset = cur + 1 + len_test;
    -
    -			while (len_end < offset)
    -				coder->opts[++len_end].price = RC_INFINITY_PRICE;
    -
    -			const uint32_t cur_and_len_price = next_rep_match_price
    -					+ get_rep_price(coder, 0, len_test,
    -						state_2, pos_state_next);
    -
    -			if (cur_and_len_price < coder->opts[offset].price) {
    -				coder->opts[offset].price = cur_and_len_price;
    -				coder->opts[offset].pos_prev = cur + 1;
    -				coder->opts[offset].back_prev = 0;
    -				coder->opts[offset].prev_1_is_literal = true;
    -				coder->opts[offset].prev_2 = false;
    -			}
    -			//}
    -		}
    -	}
    -
    -
    -	uint32_t start_len = 2; // speed optimization
    -
    -	for (uint32_t rep_index = 0; rep_index < REPS; ++rep_index) {
    -		const uint8_t *const buf_back = buf - reps[rep_index] - 1;
    -		if (not_equal_16(buf, buf_back))
    -			continue;
    -
    -		uint32_t len_test = lzma_memcmplen(buf, buf_back, 2, buf_avail);
    -
    -		while (len_end < cur + len_test)
    -			coder->opts[++len_end].price = RC_INFINITY_PRICE;
    -
    -		const uint32_t len_test_temp = len_test;
    -		const uint32_t price = rep_match_price + get_pure_rep_price(
    -				coder, rep_index, state, pos_state);
    -
    -		do {
    -			const uint32_t cur_and_len_price = price
    -					+ get_len_price(&coder->rep_len_encoder,
    -							len_test, pos_state);
    -
    -			if (cur_and_len_price < coder->opts[cur + len_test].price) {
    -				coder->opts[cur + len_test].price = cur_and_len_price;
    -				coder->opts[cur + len_test].pos_prev = cur;
    -				coder->opts[cur + len_test].back_prev = rep_index;
    -				coder->opts[cur + len_test].prev_1_is_literal = false;
    -			}
    -		} while (--len_test >= 2);
    -
    -		len_test = len_test_temp;
    -
    -		if (rep_index == 0)
    -			start_len = len_test + 1;
    -
    -
    -		uint32_t len_test_2 = len_test + 1;
    -		const uint32_t limit = my_min(buf_avail_full,
    -				len_test_2 + nice_len);
    -		for (; len_test_2 < limit
    -				&& buf[len_test_2] == buf_back[len_test_2];
    -				++len_test_2) ;
    -
    -		len_test_2 -= len_test + 1;
    -
    -		if (len_test_2 >= 2) {
    -			lzma_lzma_state state_2 = state;
    -			update_long_rep(state_2);
    -
    -			uint32_t pos_state_next = (position + len_test) & coder->pos_mask;
    -
    -			const uint32_t cur_and_len_literal_price = price
    -					+ get_len_price(&coder->rep_len_encoder,
    -						len_test, pos_state)
    -					+ rc_bit_0_price(coder->is_match[state_2][pos_state_next])
    -					+ get_literal_price(coder, position + len_test,
    -						buf[len_test - 1], true,
    -						buf_back[len_test], buf[len_test]);
    -
    -			update_literal(state_2);
    -
    -			pos_state_next = (position + len_test + 1) & coder->pos_mask;
    -
    -			const uint32_t next_rep_match_price = cur_and_len_literal_price
    -					+ rc_bit_1_price(coder->is_match[state_2][pos_state_next])
    -					+ rc_bit_1_price(coder->is_rep[state_2]);
    -
    -			//for(; len_test_2 >= 2; len_test_2--) {
    -			const uint32_t offset = cur + len_test + 1 + len_test_2;
    -
    -			while (len_end < offset)
    -				coder->opts[++len_end].price = RC_INFINITY_PRICE;
    -
    -			const uint32_t cur_and_len_price = next_rep_match_price
    -					+ get_rep_price(coder, 0, len_test_2,
    -						state_2, pos_state_next);
    -
    -			if (cur_and_len_price < coder->opts[offset].price) {
    -				coder->opts[offset].price = cur_and_len_price;
    -				coder->opts[offset].pos_prev = cur + len_test + 1;
    -				coder->opts[offset].back_prev = 0;
    -				coder->opts[offset].prev_1_is_literal = true;
    -				coder->opts[offset].prev_2 = true;
    -				coder->opts[offset].pos_prev_2 = cur;
    -				coder->opts[offset].back_prev_2 = rep_index;
    -			}
    -			//}
    -		}
    -	}
    -
    -
    -	//for (uint32_t len_test = 2; len_test <= new_len; ++len_test)
    -	if (new_len > buf_avail) {
    -		new_len = buf_avail;
    -
    -		matches_count = 0;
    -		while (new_len > coder->matches[matches_count].len)
    -			++matches_count;
    -
    -		coder->matches[matches_count++].len = new_len;
    -	}
    -
    -
    -	if (new_len >= start_len) {
    -		const uint32_t normal_match_price = match_price
    -				+ rc_bit_0_price(coder->is_rep[state]);
    -
    -		while (len_end < cur + new_len)
    -			coder->opts[++len_end].price = RC_INFINITY_PRICE;
    -
    -		uint32_t i = 0;
    -		while (start_len > coder->matches[i].len)
    -			++i;
    -
    -		for (uint32_t len_test = start_len; ; ++len_test) {
    -			const uint32_t cur_back = coder->matches[i].dist;
    -			uint32_t cur_and_len_price = normal_match_price
    -					+ get_dist_len_price(coder,
    -						cur_back, len_test, pos_state);
    -
    -			if (cur_and_len_price < coder->opts[cur + len_test].price) {
    -				coder->opts[cur + len_test].price = cur_and_len_price;
    -				coder->opts[cur + len_test].pos_prev = cur;
    -				coder->opts[cur + len_test].back_prev
    -						= cur_back + REPS;
    -				coder->opts[cur + len_test].prev_1_is_literal = false;
    -			}
    -
    -			if (len_test == coder->matches[i].len) {
    -				// Try Match + Literal + Rep0
    -				const uint8_t *const buf_back = buf - cur_back - 1;
    -				uint32_t len_test_2 = len_test + 1;
    -				const uint32_t limit = my_min(buf_avail_full,
    -						len_test_2 + nice_len);
    -
    -				for (; len_test_2 < limit &&
    -						buf[len_test_2] == buf_back[len_test_2];
    -						++len_test_2) ;
    -
    -				len_test_2 -= len_test + 1;
    -
    -				if (len_test_2 >= 2) {
    -					lzma_lzma_state state_2 = state;
    -					update_match(state_2);
    -					uint32_t pos_state_next
    -							= (position + len_test) & coder->pos_mask;
    -
    -					const uint32_t cur_and_len_literal_price = cur_and_len_price
    -							+ rc_bit_0_price(
    -								coder->is_match[state_2][pos_state_next])
    -							+ get_literal_price(coder,
    -								position + len_test,
    -								buf[len_test - 1],
    -								true,
    -								buf_back[len_test],
    -								buf[len_test]);
    -
    -					update_literal(state_2);
    -					pos_state_next = (pos_state_next + 1) & coder->pos_mask;
    -
    -					const uint32_t next_rep_match_price
    -							= cur_and_len_literal_price
    -							+ rc_bit_1_price(
    -								coder->is_match[state_2][pos_state_next])
    -							+ rc_bit_1_price(coder->is_rep[state_2]);
    -
    -					// for(; len_test_2 >= 2; --len_test_2) {
    -					const uint32_t offset = cur + len_test + 1 + len_test_2;
    -
    -					while (len_end < offset)
    -						coder->opts[++len_end].price = RC_INFINITY_PRICE;
    -
    -					cur_and_len_price = next_rep_match_price
    -							+ get_rep_price(coder, 0, len_test_2,
    -								state_2, pos_state_next);
    -
    -					if (cur_and_len_price < coder->opts[offset].price) {
    -						coder->opts[offset].price = cur_and_len_price;
    -						coder->opts[offset].pos_prev = cur + len_test + 1;
    -						coder->opts[offset].back_prev = 0;
    -						coder->opts[offset].prev_1_is_literal = true;
    -						coder->opts[offset].prev_2 = true;
    -						coder->opts[offset].pos_prev_2 = cur;
    -						coder->opts[offset].back_prev_2
    -								= cur_back + REPS;
    -					}
    -					//}
    -				}
    -
    -				if (++i == matches_count)
    -					break;
    -			}
    -		}
    -	}
    -
    -	return len_end;
    -}
    -
    -
    -extern void
    -lzma_lzma_optimum_normal(lzma_coder *restrict coder, lzma_mf *restrict mf,
    -		uint32_t *restrict back_res, uint32_t *restrict len_res,
    -		uint32_t position)
    -{
    -	// If we have symbols pending, return the next pending symbol.
    -	if (coder->opts_end_index != coder->opts_current_index) {
    -		assert(mf->read_ahead > 0);
    -		*len_res = coder->opts[coder->opts_current_index].pos_prev
    -				- coder->opts_current_index;
    -		*back_res = coder->opts[coder->opts_current_index].back_prev;
    -		coder->opts_current_index = coder->opts[
    -				coder->opts_current_index].pos_prev;
    -		return;
    -	}
    -
    -	// Update the price tables. In LZMA SDK <= 4.60 (and possibly later)
    -	// this was done in both initialization function and in the main loop.
    -	// In liblzma they were moved into this single place.
    -	if (mf->read_ahead == 0) {
    -		if (coder->match_price_count >= (1 << 7))
    -			fill_dist_prices(coder);
    -
    -		if (coder->align_price_count >= ALIGN_SIZE)
    -			fill_align_prices(coder);
    -	}
    -
    -	// TODO: This needs quite a bit of cleaning still. But splitting
    -	// the original function into two pieces makes it at least a little
    -	// more readable, since those two parts don't share many variables.
    -
    -	uint32_t len_end = helper1(coder, mf, back_res, len_res, position);
    -	if (len_end == UINT32_MAX)
    -		return;
    -
    -	uint32_t reps[REPS];
    -	memcpy(reps, coder->reps, sizeof(reps));
    -
    -	uint32_t cur;
    -	for (cur = 1; cur < len_end; ++cur) {
    -		assert(cur < OPTS);
    -
    -		coder->longest_match_length = mf_find(
    -				mf, &coder->matches_count, coder->matches);
    -
    -		if (coder->longest_match_length >= mf->nice_len)
    -			break;
    -
    -		len_end = helper2(coder, reps, mf_ptr(mf) - 1, len_end,
    -				position + cur, cur, mf->nice_len,
    -				my_min(mf_avail(mf) + 1, OPTS - 1 - cur));
    -	}
    -
    -	backward(coder, len_res, back_res, cur);
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_presets.c b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_presets.c
    deleted file mode 100644
    index 8484b7744..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_presets.c
    +++ /dev/null
    @@ -1,63 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_encoder_presets.c
    -/// \brief      Encoder presets
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "common.h"
    -
    -
    -extern LZMA_API(lzma_bool)
    -lzma_lzma_preset(lzma_options_lzma *options, uint32_t preset)
    -{
    -	const uint32_t level = preset & LZMA_PRESET_LEVEL_MASK;
    -	const uint32_t flags = preset & ~LZMA_PRESET_LEVEL_MASK;
    -	const uint32_t supported_flags = LZMA_PRESET_EXTREME;
    -
    -	if (level > 9 || (flags & ~supported_flags))
    -		return true;
    -
    -	options->preset_dict = NULL;
    -	options->preset_dict_size = 0;
    -
    -	options->lc = LZMA_LC_DEFAULT;
    -	options->lp = LZMA_LP_DEFAULT;
    -	options->pb = LZMA_PB_DEFAULT;
    -
    -	static const uint8_t dict_pow2[]
    -			= { 18, 20, 21, 22, 22, 23, 23, 24, 25, 26 };
    -	options->dict_size = UINT32_C(1) << dict_pow2[level];
    -
    -	if (level <= 3) {
    -		options->mode = LZMA_MODE_FAST;
    -		options->mf = level == 0 ? LZMA_MF_HC3 : LZMA_MF_HC4;
    -		options->nice_len = level <= 1 ? 128 : 273;
    -		static const uint8_t depths[] = { 4, 8, 24, 48 };
    -		options->depth = depths[level];
    -	} else {
    -		options->mode = LZMA_MODE_NORMAL;
    -		options->mf = LZMA_MF_BT4;
    -		options->nice_len = level == 4 ? 16 : level == 5 ? 32 : 64;
    -		options->depth = 0;
    -	}
    -
    -	if (flags & LZMA_PRESET_EXTREME) {
    -		options->mode = LZMA_MODE_NORMAL;
    -		options->mf = LZMA_MF_BT4;
    -		if (level == 3 || level == 5) {
    -			options->nice_len = 192;
    -			options->depth = 0;
    -		} else {
    -			options->nice_len = 273;
    -			options->depth = 512;
    -		}
    -	}
    -
    -	return false;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_private.h b/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_private.h
    deleted file mode 100644
    index 2f62d6cba..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/lzma/lzma_encoder_private.h
    +++ /dev/null
    @@ -1,148 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzma_encoder_private.h
    -/// \brief      Private definitions for LZMA encoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_LZMA_ENCODER_PRIVATE_H
    -#define LZMA_LZMA_ENCODER_PRIVATE_H
    -
    -#include "lz_encoder.h"
    -#include "range_encoder.h"
    -#include "lzma_common.h"
    -#include "lzma_encoder.h"
    -
    -
    -// Macro to compare if the first two bytes in two buffers differ. This is
    -// needed in lzma_lzma_optimum_*() to test if the match is at least
    -// MATCH_LEN_MIN bytes. Unaligned access gives tiny gain so there's no
    -// reason to not use it when it is supported.
    -#ifdef TUKLIB_FAST_UNALIGNED_ACCESS
    -#	define not_equal_16(a, b) \
    -		(*(const uint16_t *)(a) != *(const uint16_t *)(b))
    -#else
    -#	define not_equal_16(a, b) \
    -		((a)[0] != (b)[0] || (a)[1] != (b)[1])
    -#endif
    -
    -
    -// Optimal - Number of entries in the optimum array.
    -#define OPTS (1 << 12)
    -
    -
    -typedef struct {
    -	probability choice;
    -	probability choice2;
    -	probability low[POS_STATES_MAX][LEN_LOW_SYMBOLS];
    -	probability mid[POS_STATES_MAX][LEN_MID_SYMBOLS];
    -	probability high[LEN_HIGH_SYMBOLS];
    -
    -	uint32_t prices[POS_STATES_MAX][LEN_SYMBOLS];
    -	uint32_t table_size;
    -	uint32_t counters[POS_STATES_MAX];
    -
    -} lzma_length_encoder;
    -
    -
    -typedef struct {
    -	lzma_lzma_state state;
    -
    -	bool prev_1_is_literal;
    -	bool prev_2;
    -
    -	uint32_t pos_prev_2;
    -	uint32_t back_prev_2;
    -
    -	uint32_t price;
    -	uint32_t pos_prev;  // pos_next;
    -	uint32_t back_prev;
    -
    -	uint32_t backs[REPS];
    -
    -} lzma_optimal;
    -
    -
    -struct lzma_coder_s {
    -	/// Range encoder
    -	lzma_range_encoder rc;
    -
    -	/// State
    -	lzma_lzma_state state;
    -
    -	/// The four most recent match distances
    -	uint32_t reps[REPS];
    -
    -	/// Array of match candidates
    -	lzma_match matches[MATCH_LEN_MAX + 1];
    -
    -	/// Number of match candidates in matches[]
    -	uint32_t matches_count;
    -
    -	/// Variable to hold the length of the longest match between calls
    -	/// to lzma_lzma_optimum_*().
    -	uint32_t longest_match_length;
    -
    -	/// True if using getoptimumfast
    -	bool fast_mode;
    -
    -	/// True if the encoder has been initialized by encoding the first
    -	/// byte as a literal.
    -	bool is_initialized;
    -
    -	/// True if the range encoder has been flushed, but not all bytes
    -	/// have been written to the output buffer yet.
    -	bool is_flushed;
    -
    -	uint32_t pos_mask;         ///< (1 << pos_bits) - 1
    -	uint32_t literal_context_bits;
    -	uint32_t literal_pos_mask;
    -
    -	// These are the same as in lzma_decoder.c. See comments there.
    -	probability literal[LITERAL_CODERS_MAX][LITERAL_CODER_SIZE];
    -	probability is_match[STATES][POS_STATES_MAX];
    -	probability is_rep[STATES];
    -	probability is_rep0[STATES];
    -	probability is_rep1[STATES];
    -	probability is_rep2[STATES];
    -	probability is_rep0_long[STATES][POS_STATES_MAX];
    -	probability dist_slot[DIST_STATES][DIST_SLOTS];
    -	probability dist_special[FULL_DISTANCES - DIST_MODEL_END];
    -	probability dist_align[ALIGN_SIZE];
    -
    -	// These are the same as in lzma_decoder.c except that the encoders
    -	// include also price tables.
    -	lzma_length_encoder match_len_encoder;
    -	lzma_length_encoder rep_len_encoder;
    -
    -	// Price tables
    -	uint32_t dist_slot_prices[DIST_STATES][DIST_SLOTS];
    -	uint32_t dist_prices[DIST_STATES][FULL_DISTANCES];
    -	uint32_t dist_table_size;
    -	uint32_t match_price_count;
    -
    -	uint32_t align_prices[ALIGN_SIZE];
    -	uint32_t align_price_count;
    -
    -	// Optimal
    -	uint32_t opts_end_index;
    -	uint32_t opts_current_index;
    -	lzma_optimal opts[OPTS];
    -};
    -
    -
    -extern void lzma_lzma_optimum_fast(
    -		lzma_coder *restrict coder, lzma_mf *restrict mf,
    -		uint32_t *restrict back_res, uint32_t *restrict len_res);
    -
    -extern void lzma_lzma_optimum_normal(lzma_coder *restrict coder,
    -		lzma_mf *restrict mf, uint32_t *restrict back_res,
    -		uint32_t *restrict len_res, uint32_t position);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/rangecoder/price.h b/external/public-domain/xz/dist/src/liblzma/rangecoder/price.h
    deleted file mode 100644
    index 8ae02ca74..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/rangecoder/price.h
    +++ /dev/null
    @@ -1,92 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       price.h
    -/// \brief      Probability price calculation
    -//
    -//  Author:     Igor Pavlov
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_PRICE_H
    -#define LZMA_PRICE_H
    -
    -
    -#define RC_MOVE_REDUCING_BITS 4
    -#define RC_BIT_PRICE_SHIFT_BITS 4
    -#define RC_PRICE_TABLE_SIZE (RC_BIT_MODEL_TOTAL >> RC_MOVE_REDUCING_BITS)
    -
    -#define RC_INFINITY_PRICE (UINT32_C(1) << 30)
    -
    -
    -/// Lookup table for the inline functions defined in this file.
    -extern const uint8_t lzma_rc_prices[RC_PRICE_TABLE_SIZE];
    -
    -
    -static inline uint32_t
    -rc_bit_price(const probability prob, const uint32_t bit)
    -{
    -	return lzma_rc_prices[(prob ^ ((UINT32_C(0) - bit)
    -			& (RC_BIT_MODEL_TOTAL - 1))) >> RC_MOVE_REDUCING_BITS];
    -}
    -
    -
    -static inline uint32_t
    -rc_bit_0_price(const probability prob)
    -{
    -	return lzma_rc_prices[prob >> RC_MOVE_REDUCING_BITS];
    -}
    -
    -
    -static inline uint32_t
    -rc_bit_1_price(const probability prob)
    -{
    -	return lzma_rc_prices[(prob ^ (RC_BIT_MODEL_TOTAL - 1))
    -			>> RC_MOVE_REDUCING_BITS];
    -}
    -
    -
    -static inline uint32_t
    -rc_bittree_price(const probability *const probs,
    -		const uint32_t bit_levels, uint32_t symbol)
    -{
    -	uint32_t price = 0;
    -	symbol += UINT32_C(1) << bit_levels;
    -
    -	do {
    -		const uint32_t bit = symbol & 1;
    -		symbol >>= 1;
    -		price += rc_bit_price(probs[symbol], bit);
    -	} while (symbol != 1);
    -
    -	return price;
    -}
    -
    -
    -static inline uint32_t
    -rc_bittree_reverse_price(const probability *const probs,
    -		uint32_t bit_levels, uint32_t symbol)
    -{
    -	uint32_t price = 0;
    -	uint32_t model_index = 1;
    -
    -	do {
    -		const uint32_t bit = symbol & 1;
    -		symbol >>= 1;
    -		price += rc_bit_price(probs[model_index], bit);
    -		model_index = (model_index << 1) + bit;
    -	} while (--bit_levels != 0);
    -
    -	return price;
    -}
    -
    -
    -static inline uint32_t
    -rc_direct_price(const uint32_t bits)
    -{
    -	 return bits << RC_BIT_PRICE_SHIFT_BITS;
    -}
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/rangecoder/price_table.c b/external/public-domain/xz/dist/src/liblzma/rangecoder/price_table.c
    deleted file mode 100644
    index ac64bf62c..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/rangecoder/price_table.c
    +++ /dev/null
    @@ -1,22 +0,0 @@
    -/* This file has been automatically generated by price_tablegen.c. */
    -
    -#include "range_encoder.h"
    -
    -const uint8_t lzma_rc_prices[RC_PRICE_TABLE_SIZE] = {
    -	 128, 103,  91,  84,  78,  73,  69,  66,
    -	  63,  61,  58,  56,  54,  52,  51,  49,
    -	  48,  46,  45,  44,  43,  42,  41,  40,
    -	  39,  38,  37,  36,  35,  34,  34,  33,
    -	  32,  31,  31,  30,  29,  29,  28,  28,
    -	  27,  26,  26,  25,  25,  24,  24,  23,
    -	  23,  22,  22,  22,  21,  21,  20,  20,
    -	  19,  19,  19,  18,  18,  17,  17,  17,
    -	  16,  16,  16,  15,  15,  15,  14,  14,
    -	  14,  13,  13,  13,  12,  12,  12,  11,
    -	  11,  11,  11,  10,  10,  10,  10,   9,
    -	   9,   9,   9,   8,   8,   8,   8,   7,
    -	   7,   7,   7,   6,   6,   6,   6,   5,
    -	   5,   5,   5,   5,   4,   4,   4,   4,
    -	   3,   3,   3,   3,   3,   2,   2,   2,
    -	   2,   2,   2,   1,   1,   1,   1,   1
    -};
    diff --git a/external/public-domain/xz/dist/src/liblzma/rangecoder/price_tablegen.c b/external/public-domain/xz/dist/src/liblzma/rangecoder/price_tablegen.c
    deleted file mode 100644
    index bf08ce39d..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/rangecoder/price_tablegen.c
    +++ /dev/null
    @@ -1,87 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       price_tablegen.c
    -/// \brief      Probability price table generator
    -///
    -/// Compiling: gcc -std=c99 -o price_tablegen price_tablegen.c
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include 
    -#include 
    -#include "range_common.h"
    -#include "price.h"
    -
    -
    -static uint32_t rc_prices[RC_PRICE_TABLE_SIZE];
    -
    -
    -static void
    -init_price_table(void)
    -{
    -	for (uint32_t i = (UINT32_C(1) << RC_MOVE_REDUCING_BITS) / 2;
    -			i < RC_BIT_MODEL_TOTAL;
    -			i += (UINT32_C(1) << RC_MOVE_REDUCING_BITS)) {
    -		const uint32_t cycles_bits = RC_BIT_PRICE_SHIFT_BITS;
    -		uint32_t w = i;
    -		uint32_t bit_count = 0;
    -
    -		for (uint32_t j = 0; j < cycles_bits; ++j) {
    -			w *= w;
    -			bit_count <<= 1;
    -
    -			while (w >= (UINT32_C(1) << 16)) {
    -				w >>= 1;
    -				++bit_count;
    -			}
    -		}
    -
    -		rc_prices[i >> RC_MOVE_REDUCING_BITS]
    -				= (RC_BIT_MODEL_TOTAL_BITS << cycles_bits)
    -				- 15 - bit_count;
    -	}
    -
    -	return;
    -}
    -
    -
    -static void
    -print_price_table(void)
    -{
    -	printf("/* This file has been automatically generated by "
    -			"price_tablegen.c. */\n\n"
    -			"#include \"range_encoder.h\"\n\n"
    -			"const uint8_t lzma_rc_prices["
    -			"RC_PRICE_TABLE_SIZE] = {");
    -
    -	const size_t array_size = sizeof(lzma_rc_prices)
    -			/ sizeof(lzma_rc_prices[0]);
    -	for (size_t i = 0; i < array_size; ++i) {
    -		if (i % 8 == 0)
    -			printf("\n\t");
    -
    -		printf("%4" PRIu32, rc_prices[i]);
    -
    -		if (i != array_size - 1)
    -			printf(",");
    -	}
    -
    -	printf("\n};\n");
    -
    -	return;
    -}
    -
    -
    -int
    -main(void)
    -{
    -	init_price_table();
    -	print_price_table();
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/rangecoder/range_common.h b/external/public-domain/xz/dist/src/liblzma/rangecoder/range_common.h
    deleted file mode 100644
    index 0e6424198..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/rangecoder/range_common.h
    +++ /dev/null
    @@ -1,73 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       range_common.h
    -/// \brief      Common things for range encoder and decoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_RANGE_COMMON_H
    -#define LZMA_RANGE_COMMON_H
    -
    -#ifdef HAVE_CONFIG_H
    -#	include "common.h"
    -#endif
    -
    -
    -///////////////
    -// Constants //
    -///////////////
    -
    -#define RC_SHIFT_BITS 8
    -#define RC_TOP_BITS 24
    -#define RC_TOP_VALUE (UINT32_C(1) << RC_TOP_BITS)
    -#define RC_BIT_MODEL_TOTAL_BITS 11
    -#define RC_BIT_MODEL_TOTAL (UINT32_C(1) << RC_BIT_MODEL_TOTAL_BITS)
    -#define RC_MOVE_BITS 5
    -
    -
    -////////////
    -// Macros //
    -////////////
    -
    -// Resets the probability so that both 0 and 1 have probability of 50 %
    -#define bit_reset(prob) \
    -	prob = RC_BIT_MODEL_TOTAL >> 1
    -
    -// This does the same for a complete bit tree.
    -// (A tree represented as an array.)
    -#define bittree_reset(probs, bit_levels) \
    -	for (uint32_t bt_i = 0; bt_i < (1 << (bit_levels)); ++bt_i) \
    -		bit_reset((probs)[bt_i])
    -
    -
    -//////////////////////
    -// Type definitions //
    -//////////////////////
    -
    -/// \brief      Type of probabilities used with range coder
    -///
    -/// This needs to be at least 12-bit integer, so uint16_t is a logical choice.
    -/// However, on some architecture and compiler combinations, a bigger type
    -/// may give better speed, because the probability variables are accessed
    -/// a lot. On the other hand, bigger probability type increases cache
    -/// footprint, since there are 2 to 14 thousand probability variables in
    -/// LZMA (assuming the limit of lc + lp <= 4; with lc + lp <= 12 there
    -/// would be about 1.5 million variables).
    -///
    -/// With malicious files, the initialization speed of the LZMA decoder can
    -/// become important. In that case, smaller probability variables mean that
    -/// there is less bytes to write to RAM, which makes initialization faster.
    -/// With big probability type, the initialization can become so slow that it
    -/// can be a problem e.g. for email servers doing virus scanning.
    -///
    -/// I will be sticking to uint16_t unless some specific architectures
    -/// are *much* faster (20-50 %) with uint32_t.
    -typedef uint16_t probability;
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/rangecoder/range_decoder.h b/external/public-domain/xz/dist/src/liblzma/rangecoder/range_decoder.h
    deleted file mode 100644
    index e0b051fac..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/rangecoder/range_decoder.h
    +++ /dev/null
    @@ -1,185 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       range_decoder.h
    -/// \brief      Range Decoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_RANGE_DECODER_H
    -#define LZMA_RANGE_DECODER_H
    -
    -#include "range_common.h"
    -
    -
    -typedef struct {
    -	uint32_t range;
    -	uint32_t code;
    -	uint32_t init_bytes_left;
    -} lzma_range_decoder;
    -
    -
    -/// Reads the first five bytes to initialize the range decoder.
    -static inline lzma_ret
    -rc_read_init(lzma_range_decoder *rc, const uint8_t *restrict in,
    -		size_t *restrict in_pos, size_t in_size)
    -{
    -	while (rc->init_bytes_left > 0) {
    -		if (*in_pos == in_size)
    -			return LZMA_OK;
    -
    -		// The first byte is always 0x00. It could have been omitted
    -		// in LZMA2 but it wasn't, so one byte is wasted in every
    -		// LZMA2 chunk.
    -		if (rc->init_bytes_left == 5 && in[*in_pos] != 0x00)
    -			return LZMA_DATA_ERROR;
    -
    -		rc->code = (rc->code << 8) | in[*in_pos];
    -		++*in_pos;
    -		--rc->init_bytes_left;
    -	}
    -
    -	return LZMA_STREAM_END;
    -}
    -
    -
    -/// Makes local copies of range decoder and *in_pos variables. Doing this
    -/// improves speed significantly. The range decoder macros expect also
    -/// variables `in' and `in_size' to be defined.
    -#define rc_to_local(range_decoder, in_pos) \
    -	lzma_range_decoder rc = range_decoder; \
    -	size_t rc_in_pos = (in_pos); \
    -	uint32_t rc_bound
    -
    -
    -/// Stores the local copes back to the range decoder structure.
    -#define rc_from_local(range_decoder, in_pos) \
    -do { \
    -	range_decoder = rc; \
    -	in_pos = rc_in_pos; \
    -} while (0)
    -
    -
    -/// Resets the range decoder structure.
    -#define rc_reset(range_decoder) \
    -do { \
    -	(range_decoder).range = UINT32_MAX; \
    -	(range_decoder).code = 0; \
    -	(range_decoder).init_bytes_left = 5; \
    -} while (0)
    -
    -
    -/// When decoding has been properly finished, rc.code is always zero unless
    -/// the input stream is corrupt. So checking this can catch some corrupt
    -/// files especially if they don't have any other integrity check.
    -#define rc_is_finished(range_decoder) \
    -	((range_decoder).code == 0)
    -
    -
    -/// Read the next input byte if needed. If more input is needed but there is
    -/// no more input available, "goto out" is used to jump out of the main
    -/// decoder loop.
    -#define rc_normalize(seq) \
    -do { \
    -	if (rc.range < RC_TOP_VALUE) { \
    -		if (unlikely(rc_in_pos == in_size)) { \
    -			coder->sequence = seq; \
    -			goto out; \
    -		} \
    -		rc.range <<= RC_SHIFT_BITS; \
    -		rc.code = (rc.code << RC_SHIFT_BITS) | in[rc_in_pos++]; \
    -	} \
    -} while (0)
    -
    -
    -/// Start decoding a bit. This must be used together with rc_update_0()
    -/// and rc_update_1():
    -///
    -///     rc_if_0(prob, seq) {
    -///         rc_update_0(prob);
    -///         // Do something
    -///     } else {
    -///         rc_update_1(prob);
    -///         // Do something else
    -///     }
    -///
    -#define rc_if_0(prob, seq) \
    -	rc_normalize(seq); \
    -	rc_bound = (rc.range >> RC_BIT_MODEL_TOTAL_BITS) * (prob); \
    -	if (rc.code < rc_bound)
    -
    -
    -/// Update the range decoder state and the used probability variable to
    -/// match a decoded bit of 0.
    -#define rc_update_0(prob) \
    -do { \
    -	rc.range = rc_bound; \
    -	prob += (RC_BIT_MODEL_TOTAL - (prob)) >> RC_MOVE_BITS; \
    -} while (0)
    -
    -
    -/// Update the range decoder state and the used probability variable to
    -/// match a decoded bit of 1.
    -#define rc_update_1(prob) \
    -do { \
    -	rc.range -= rc_bound; \
    -	rc.code -= rc_bound; \
    -	prob -= (prob) >> RC_MOVE_BITS; \
    -} while (0)
    -
    -
    -/// Decodes one bit and runs action0 or action1 depending on the decoded bit.
    -/// This macro is used as the last step in bittree reverse decoders since
    -/// those don't use "symbol" for anything else than indexing the probability
    -/// arrays.
    -#define rc_bit_last(prob, action0, action1, seq) \
    -do { \
    -	rc_if_0(prob, seq) { \
    -		rc_update_0(prob); \
    -		action0; \
    -	} else { \
    -		rc_update_1(prob); \
    -		action1; \
    -	} \
    -} while (0)
    -
    -
    -/// Decodes one bit, updates "symbol", and runs action0 or action1 depending
    -/// on the decoded bit.
    -#define rc_bit(prob, action0, action1, seq) \
    -	rc_bit_last(prob, \
    -		symbol <<= 1; action0, \
    -		symbol = (symbol << 1) + 1; action1, \
    -		seq);
    -
    -
    -/// Like rc_bit() but add "case seq:" as a prefix. This makes the unrolled
    -/// loops more readable because the code isn't littered with "case"
    -/// statements. On the other hand this also makes it less readable, since
    -/// spotting the places where the decoder loop may be restarted is less
    -/// obvious.
    -#define rc_bit_case(prob, action0, action1, seq) \
    -	case seq: rc_bit(prob, action0, action1, seq)
    -
    -
    -/// Decode a bit without using a probability.
    -#define rc_direct(dest, seq) \
    -do { \
    -	rc_normalize(seq); \
    -	rc.range >>= 1; \
    -	rc.code -= rc.range; \
    -	rc_bound = UINT32_C(0) - (rc.code >> 31); \
    -	rc.code += rc.range & rc_bound; \
    -	dest = (dest << 1) + (rc_bound + 1); \
    -} while (0)
    -
    -
    -// NOTE: No macros are provided for bittree decoding. It seems to be simpler
    -// to just write them open in the code.
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/rangecoder/range_encoder.h b/external/public-domain/xz/dist/src/liblzma/rangecoder/range_encoder.h
    deleted file mode 100644
    index 1e1c36995..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/rangecoder/range_encoder.h
    +++ /dev/null
    @@ -1,231 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       range_encoder.h
    -/// \brief      Range Encoder
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_RANGE_ENCODER_H
    -#define LZMA_RANGE_ENCODER_H
    -
    -#include "range_common.h"
    -#include "price.h"
    -
    -
    -/// Maximum number of symbols that can be put pending into lzma_range_encoder
    -/// structure between calls to lzma_rc_encode(). For LZMA, 52+5 is enough
    -/// (match with big distance and length followed by range encoder flush).
    -#define RC_SYMBOLS_MAX 58
    -
    -
    -typedef struct {
    -	uint64_t low;
    -	uint64_t cache_size;
    -	uint32_t range;
    -	uint8_t cache;
    -
    -	/// Number of symbols in the tables
    -	size_t count;
    -
    -	/// rc_encode()'s position in the tables
    -	size_t pos;
    -
    -	/// Symbols to encode
    -	enum {
    -		RC_BIT_0,
    -		RC_BIT_1,
    -		RC_DIRECT_0,
    -		RC_DIRECT_1,
    -		RC_FLUSH,
    -	} symbols[RC_SYMBOLS_MAX];
    -
    -	/// Probabilities associated with RC_BIT_0 or RC_BIT_1
    -	probability *probs[RC_SYMBOLS_MAX];
    -
    -} lzma_range_encoder;
    -
    -
    -static inline void
    -rc_reset(lzma_range_encoder *rc)
    -{
    -	rc->low = 0;
    -	rc->cache_size = 1;
    -	rc->range = UINT32_MAX;
    -	rc->cache = 0;
    -	rc->count = 0;
    -	rc->pos = 0;
    -}
    -
    -
    -static inline void
    -rc_bit(lzma_range_encoder *rc, probability *prob, uint32_t bit)
    -{
    -	rc->symbols[rc->count] = bit;
    -	rc->probs[rc->count] = prob;
    -	++rc->count;
    -}
    -
    -
    -static inline void
    -rc_bittree(lzma_range_encoder *rc, probability *probs,
    -		uint32_t bit_count, uint32_t symbol)
    -{
    -	uint32_t model_index = 1;
    -
    -	do {
    -		const uint32_t bit = (symbol >> --bit_count) & 1;
    -		rc_bit(rc, &probs[model_index], bit);
    -		model_index = (model_index << 1) + bit;
    -	} while (bit_count != 0);
    -}
    -
    -
    -static inline void
    -rc_bittree_reverse(lzma_range_encoder *rc, probability *probs,
    -		uint32_t bit_count, uint32_t symbol)
    -{
    -	uint32_t model_index = 1;
    -
    -	do {
    -		const uint32_t bit = symbol & 1;
    -		symbol >>= 1;
    -		rc_bit(rc, &probs[model_index], bit);
    -		model_index = (model_index << 1) + bit;
    -	} while (--bit_count != 0);
    -}
    -
    -
    -static inline void
    -rc_direct(lzma_range_encoder *rc,
    -		uint32_t value, uint32_t bit_count)
    -{
    -	do {
    -		rc->symbols[rc->count++]
    -				= RC_DIRECT_0 + ((value >> --bit_count) & 1);
    -	} while (bit_count != 0);
    -}
    -
    -
    -static inline void
    -rc_flush(lzma_range_encoder *rc)
    -{
    -	for (size_t i = 0; i < 5; ++i)
    -		rc->symbols[rc->count++] = RC_FLUSH;
    -}
    -
    -
    -static inline bool
    -rc_shift_low(lzma_range_encoder *rc,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	if ((uint32_t)(rc->low) < (uint32_t)(0xFF000000)
    -			|| (uint32_t)(rc->low >> 32) != 0) {
    -		do {
    -			if (*out_pos == out_size)
    -				return true;
    -
    -			out[*out_pos] = rc->cache + (uint8_t)(rc->low >> 32);
    -			++*out_pos;
    -			rc->cache = 0xFF;
    -
    -		} while (--rc->cache_size != 0);
    -
    -		rc->cache = (rc->low >> 24) & 0xFF;
    -	}
    -
    -	++rc->cache_size;
    -	rc->low = (rc->low & 0x00FFFFFF) << RC_SHIFT_BITS;
    -
    -	return false;
    -}
    -
    -
    -static inline bool
    -rc_encode(lzma_range_encoder *rc,
    -		uint8_t *out, size_t *out_pos, size_t out_size)
    -{
    -	assert(rc->count <= RC_SYMBOLS_MAX);
    -
    -	while (rc->pos < rc->count) {
    -		// Normalize
    -		if (rc->range < RC_TOP_VALUE) {
    -			if (rc_shift_low(rc, out, out_pos, out_size))
    -				return true;
    -
    -			rc->range <<= RC_SHIFT_BITS;
    -		}
    -
    -		// Encode a bit
    -		switch (rc->symbols[rc->pos]) {
    -		case RC_BIT_0: {
    -			probability prob = *rc->probs[rc->pos];
    -			rc->range = (rc->range >> RC_BIT_MODEL_TOTAL_BITS)
    -					* prob;
    -			prob += (RC_BIT_MODEL_TOTAL - prob) >> RC_MOVE_BITS;
    -			*rc->probs[rc->pos] = prob;
    -			break;
    -		}
    -
    -		case RC_BIT_1: {
    -			probability prob = *rc->probs[rc->pos];
    -			const uint32_t bound = prob * (rc->range
    -					>> RC_BIT_MODEL_TOTAL_BITS);
    -			rc->low += bound;
    -			rc->range -= bound;
    -			prob -= prob >> RC_MOVE_BITS;
    -			*rc->probs[rc->pos] = prob;
    -			break;
    -		}
    -
    -		case RC_DIRECT_0:
    -			rc->range >>= 1;
    -			break;
    -
    -		case RC_DIRECT_1:
    -			rc->range >>= 1;
    -			rc->low += rc->range;
    -			break;
    -
    -		case RC_FLUSH:
    -			// Prevent further normalizations.
    -			rc->range = UINT32_MAX;
    -
    -			// Flush the last five bytes (see rc_flush()).
    -			do {
    -				if (rc_shift_low(rc, out, out_pos, out_size))
    -					return true;
    -			} while (++rc->pos < rc->count);
    -
    -			// Reset the range encoder so we are ready to continue
    -			// encoding if we weren't finishing the stream.
    -			rc_reset(rc);
    -			return false;
    -
    -		default:
    -			assert(0);
    -			break;
    -		}
    -
    -		++rc->pos;
    -	}
    -
    -	rc->count = 0;
    -	rc->pos = 0;
    -
    -	return false;
    -}
    -
    -
    -static inline uint64_t
    -rc_pending(const lzma_range_encoder *rc)
    -{
    -	return rc->cache_size + 5 - 1;
    -}
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/arm.c b/external/public-domain/xz/dist/src/liblzma/simple/arm.c
    deleted file mode 100644
    index 258d870fe..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/arm.c
    +++ /dev/null
    @@ -1,71 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       arm.c
    -/// \brief      Filter for ARM binaries
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_private.h"
    -
    -
    -static size_t
    -arm_code(lzma_simple *simple lzma_attribute((__unused__)),
    -		uint32_t now_pos, bool is_encoder,
    -		uint8_t *buffer, size_t size)
    -{
    -	size_t i;
    -	for (i = 0; i + 4 <= size; i += 4) {
    -		if (buffer[i + 3] == 0xEB) {
    -			uint32_t src = (buffer[i + 2] << 16)
    -					| (buffer[i + 1] << 8)
    -					| (buffer[i + 0]);
    -			src <<= 2;
    -
    -			uint32_t dest;
    -			if (is_encoder)
    -				dest = now_pos + (uint32_t)(i) + 8 + src;
    -			else
    -				dest = src - (now_pos + (uint32_t)(i) + 8);
    -
    -			dest >>= 2;
    -			buffer[i + 2] = (dest >> 16);
    -			buffer[i + 1] = (dest >> 8);
    -			buffer[i + 0] = dest;
    -		}
    -	}
    -
    -	return i;
    -}
    -
    -
    -static lzma_ret
    -arm_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters, bool is_encoder)
    -{
    -	return lzma_simple_coder_init(next, allocator, filters,
    -			&arm_code, 0, 4, 4, is_encoder);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_arm_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return arm_coder_init(next, allocator, filters, true);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_arm_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return arm_coder_init(next, allocator, filters, false);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/armthumb.c b/external/public-domain/xz/dist/src/liblzma/simple/armthumb.c
    deleted file mode 100644
    index 06c21e406..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/armthumb.c
    +++ /dev/null
    @@ -1,76 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       armthumb.c
    -/// \brief      Filter for ARM-Thumb binaries
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_private.h"
    -
    -
    -static size_t
    -armthumb_code(lzma_simple *simple lzma_attribute((__unused__)),
    -		uint32_t now_pos, bool is_encoder,
    -		uint8_t *buffer, size_t size)
    -{
    -	size_t i;
    -	for (i = 0; i + 4 <= size; i += 2) {
    -		if ((buffer[i + 1] & 0xF8) == 0xF0
    -				&& (buffer[i + 3] & 0xF8) == 0xF8) {
    -			uint32_t src = ((buffer[i + 1] & 0x7) << 19)
    -					| (buffer[i + 0] << 11)
    -					| ((buffer[i + 3] & 0x7) << 8)
    -					| (buffer[i + 2]);
    -
    -			src <<= 1;
    -
    -			uint32_t dest;
    -			if (is_encoder)
    -				dest = now_pos + (uint32_t)(i) + 4 + src;
    -			else
    -				dest = src - (now_pos + (uint32_t)(i) + 4);
    -
    -			dest >>= 1;
    -			buffer[i + 1] = 0xF0 | ((dest >> 19) & 0x7);
    -			buffer[i + 0] = (dest >> 11);
    -			buffer[i + 3] = 0xF8 | ((dest >> 8) & 0x7);
    -			buffer[i + 2] = (dest);
    -			i += 2;
    -		}
    -	}
    -
    -	return i;
    -}
    -
    -
    -static lzma_ret
    -armthumb_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters, bool is_encoder)
    -{
    -	return lzma_simple_coder_init(next, allocator, filters,
    -			&armthumb_code, 0, 4, 2, is_encoder);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return armthumb_coder_init(next, allocator, filters, true);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_armthumb_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return armthumb_coder_init(next, allocator, filters, false);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/ia64.c b/external/public-domain/xz/dist/src/liblzma/simple/ia64.c
    deleted file mode 100644
    index ba7249c00..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/ia64.c
    +++ /dev/null
    @@ -1,112 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       ia64.c
    -/// \brief      Filter for IA64 (Itanium) binaries
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_private.h"
    -
    -
    -static size_t
    -ia64_code(lzma_simple *simple lzma_attribute((__unused__)),
    -		uint32_t now_pos, bool is_encoder,
    -		uint8_t *buffer, size_t size)
    -{
    -	static const uint32_t BRANCH_TABLE[32] = {
    -		0, 0, 0, 0, 0, 0, 0, 0,
    -		0, 0, 0, 0, 0, 0, 0, 0,
    -		4, 4, 6, 6, 0, 0, 7, 7,
    -		4, 4, 0, 0, 4, 4, 0, 0
    -	};
    -
    -	size_t i;
    -	for (i = 0; i + 16 <= size; i += 16) {
    -		const uint32_t instr_template = buffer[i] & 0x1F;
    -		const uint32_t mask = BRANCH_TABLE[instr_template];
    -		uint32_t bit_pos = 5;
    -
    -		for (size_t slot = 0; slot < 3; ++slot, bit_pos += 41) {
    -			if (((mask >> slot) & 1) == 0)
    -				continue;
    -
    -			const size_t byte_pos = (bit_pos >> 3);
    -			const uint32_t bit_res = bit_pos & 0x7;
    -			uint64_t instruction = 0;
    -
    -			for (size_t j = 0; j < 6; ++j)
    -				instruction += (uint64_t)(
    -						buffer[i + j + byte_pos])
    -						<< (8 * j);
    -
    -			uint64_t inst_norm = instruction >> bit_res;
    -
    -			if (((inst_norm >> 37) & 0xF) == 0x5
    -					&& ((inst_norm >> 9) & 0x7) == 0
    -					/* &&  (inst_norm & 0x3F)== 0 */
    -					) {
    -				uint32_t src = (uint32_t)(
    -						(inst_norm >> 13) & 0xFFFFF);
    -				src |= ((inst_norm >> 36) & 1) << 20;
    -
    -				src <<= 4;
    -
    -				uint32_t dest;
    -				if (is_encoder)
    -					dest = now_pos + (uint32_t)(i) + src;
    -				else
    -					dest = src - (now_pos + (uint32_t)(i));
    -
    -				dest >>= 4;
    -
    -				inst_norm &= ~((uint64_t)(0x8FFFFF) << 13);
    -				inst_norm |= (uint64_t)(dest & 0xFFFFF) << 13;
    -				inst_norm |= (uint64_t)(dest & 0x100000)
    -						<< (36 - 20);
    -
    -				instruction &= (1 << bit_res) - 1;
    -				instruction |= (inst_norm << bit_res);
    -
    -				for (size_t j = 0; j < 6; j++)
    -					buffer[i + j + byte_pos] = (uint8_t)(
    -							instruction
    -							>> (8 * j));
    -			}
    -		}
    -	}
    -
    -	return i;
    -}
    -
    -
    -static lzma_ret
    -ia64_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters, bool is_encoder)
    -{
    -	return lzma_simple_coder_init(next, allocator, filters,
    -			&ia64_code, 0, 16, 16, is_encoder);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_ia64_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return ia64_coder_init(next, allocator, filters, true);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_ia64_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return ia64_coder_init(next, allocator, filters, false);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/powerpc.c b/external/public-domain/xz/dist/src/liblzma/simple/powerpc.c
    deleted file mode 100644
    index 46899196a..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/powerpc.c
    +++ /dev/null
    @@ -1,75 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       powerpc.c
    -/// \brief      Filter for PowerPC (big endian) binaries
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_private.h"
    -
    -
    -static size_t
    -powerpc_code(lzma_simple *simple lzma_attribute((__unused__)),
    -		uint32_t now_pos, bool is_encoder,
    -		uint8_t *buffer, size_t size)
    -{
    -	size_t i;
    -	for (i = 0; i + 4 <= size; i += 4) {
    -		// PowerPC branch 6(48) 24(Offset) 1(Abs) 1(Link)
    -		if ((buffer[i] >> 2) == 0x12
    -				&& ((buffer[i + 3] & 3) == 1)) {
    -
    -			const uint32_t src = ((buffer[i + 0] & 3) << 24)
    -					| (buffer[i + 1] << 16)
    -					| (buffer[i + 2] << 8)
    -					| (buffer[i + 3] & (~3));
    -
    -			uint32_t dest;
    -			if (is_encoder)
    -				dest = now_pos + (uint32_t)(i) + src;
    -			else
    -				dest = src - (now_pos + (uint32_t)(i));
    -
    -			buffer[i + 0] = 0x48 | ((dest >> 24) &  0x03);
    -			buffer[i + 1] = (dest >> 16);
    -			buffer[i + 2] = (dest >> 8);
    -			buffer[i + 3] &= 0x03;
    -			buffer[i + 3] |= dest;
    -		}
    -	}
    -
    -	return i;
    -}
    -
    -
    -static lzma_ret
    -powerpc_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters, bool is_encoder)
    -{
    -	return lzma_simple_coder_init(next, allocator, filters,
    -			&powerpc_code, 0, 4, 4, is_encoder);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return powerpc_coder_init(next, allocator, filters, true);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_powerpc_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return powerpc_coder_init(next, allocator, filters, false);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/simple_coder.c b/external/public-domain/xz/dist/src/liblzma/simple/simple_coder.c
    deleted file mode 100644
    index dba5417b4..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/simple_coder.c
    +++ /dev/null
    @@ -1,277 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       simple_coder.c
    -/// \brief      Wrapper for simple filters
    -///
    -/// Simple filters don't change the size of the data i.e. number of bytes
    -/// in equals the number of bytes out.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_private.h"
    -
    -
    -/// Copied or encodes/decodes more data to out[].
    -static lzma_ret
    -copy_or_code(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	assert(!coder->end_was_reached);
    -
    -	if (coder->next.code == NULL) {
    -		lzma_bufcpy(in, in_pos, in_size, out, out_pos, out_size);
    -
    -		// Check if end of stream was reached.
    -		if (coder->is_encoder && action == LZMA_FINISH
    -				&& *in_pos == in_size)
    -			coder->end_was_reached = true;
    -
    -	} else {
    -		// Call the next coder in the chain to provide us some data.
    -		const lzma_ret ret = coder->next.code(
    -				coder->next.coder, allocator,
    -				in, in_pos, in_size,
    -				out, out_pos, out_size, action);
    -
    -		if (ret == LZMA_STREAM_END) {
    -			assert(!coder->is_encoder
    -					|| action == LZMA_FINISH);
    -			coder->end_was_reached = true;
    -
    -		} else if (ret != LZMA_OK) {
    -			return ret;
    -		}
    -	}
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static size_t
    -call_filter(lzma_coder *coder, uint8_t *buffer, size_t size)
    -{
    -	const size_t filtered = coder->filter(coder->simple,
    -			coder->now_pos, coder->is_encoder,
    -			buffer, size);
    -	coder->now_pos += filtered;
    -	return filtered;
    -}
    -
    -
    -static lzma_ret
    -simple_code(lzma_coder *coder, const lzma_allocator *allocator,
    -		const uint8_t *restrict in, size_t *restrict in_pos,
    -		size_t in_size, uint8_t *restrict out,
    -		size_t *restrict out_pos, size_t out_size, lzma_action action)
    -{
    -	// TODO: Add partial support for LZMA_SYNC_FLUSH. We can support it
    -	// in cases when the filter is able to filter everything. With most
    -	// simple filters it can be done at offset that is a multiple of 2,
    -	// 4, or 16. With x86 filter, it needs good luck, and thus cannot
    -	// be made to work predictably.
    -	if (action == LZMA_SYNC_FLUSH)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	// Flush already filtered data from coder->buffer[] to out[].
    -	if (coder->pos < coder->filtered) {
    -		lzma_bufcpy(coder->buffer, &coder->pos, coder->filtered,
    -				out, out_pos, out_size);
    -
    -		// If we couldn't flush all the filtered data, return to
    -		// application immediately.
    -		if (coder->pos < coder->filtered)
    -			return LZMA_OK;
    -
    -		if (coder->end_was_reached) {
    -			assert(coder->filtered == coder->size);
    -			return LZMA_STREAM_END;
    -		}
    -	}
    -
    -	// If we get here, there is no filtered data left in the buffer.
    -	coder->filtered = 0;
    -
    -	assert(!coder->end_was_reached);
    -
    -	// If there is more output space left than there is unfiltered data
    -	// in coder->buffer[], flush coder->buffer[] to out[], and copy/code
    -	// more data to out[] hopefully filling it completely. Then filter
    -	// the data in out[]. This step is where most of the data gets
    -	// filtered if the buffer sizes used by the application are reasonable.
    -	const size_t out_avail = out_size - *out_pos;
    -	const size_t buf_avail = coder->size - coder->pos;
    -	if (out_avail > buf_avail || buf_avail == 0) {
    -		// Store the old position so that we know from which byte
    -		// to start filtering.
    -		const size_t out_start = *out_pos;
    -
    -		// Flush data from coder->buffer[] to out[], but don't reset
    -		// coder->pos and coder->size yet. This way the coder can be
    -		// restarted if the next filter in the chain returns e.g.
    -		// LZMA_MEM_ERROR.
    -		memcpy(out + *out_pos, coder->buffer + coder->pos, buf_avail);
    -		*out_pos += buf_avail;
    -
    -		// Copy/Encode/Decode more data to out[].
    -		{
    -			const lzma_ret ret = copy_or_code(coder, allocator,
    -					in, in_pos, in_size,
    -					out, out_pos, out_size, action);
    -			assert(ret != LZMA_STREAM_END);
    -			if (ret != LZMA_OK)
    -				return ret;
    -		}
    -
    -		// Filter out[].
    -		const size_t size = *out_pos - out_start;
    -		const size_t filtered = call_filter(
    -				coder, out + out_start, size);
    -
    -		const size_t unfiltered = size - filtered;
    -		assert(unfiltered <= coder->allocated / 2);
    -
    -		// Now we can update coder->pos and coder->size, because
    -		// the next coder in the chain (if any) was successful.
    -		coder->pos = 0;
    -		coder->size = unfiltered;
    -
    -		if (coder->end_was_reached) {
    -			// The last byte has been copied to out[] already.
    -			// They are left as is.
    -			coder->size = 0;
    -
    -		} else if (unfiltered > 0) {
    -			// There is unfiltered data left in out[]. Copy it to
    -			// coder->buffer[] and rewind *out_pos appropriately.
    -			*out_pos -= unfiltered;
    -			memcpy(coder->buffer, out + *out_pos, unfiltered);
    -		}
    -	} else if (coder->pos > 0) {
    -		memmove(coder->buffer, coder->buffer + coder->pos, buf_avail);
    -		coder->size -= coder->pos;
    -		coder->pos = 0;
    -	}
    -
    -	assert(coder->pos == 0);
    -
    -	// If coder->buffer[] isn't empty, try to fill it by copying/decoding
    -	// more data. Then filter coder->buffer[] and copy the successfully
    -	// filtered data to out[]. It is probable, that some filtered and
    -	// unfiltered data will be left to coder->buffer[].
    -	if (coder->size > 0) {
    -		{
    -			const lzma_ret ret = copy_or_code(coder, allocator,
    -					in, in_pos, in_size,
    -					coder->buffer, &coder->size,
    -					coder->allocated, action);
    -			assert(ret != LZMA_STREAM_END);
    -			if (ret != LZMA_OK)
    -				return ret;
    -		}
    -
    -		coder->filtered = call_filter(
    -				coder, coder->buffer, coder->size);
    -
    -		// Everything is considered to be filtered if coder->buffer[]
    -		// contains the last bytes of the data.
    -		if (coder->end_was_reached)
    -			coder->filtered = coder->size;
    -
    -		// Flush as much as possible.
    -		lzma_bufcpy(coder->buffer, &coder->pos, coder->filtered,
    -				out, out_pos, out_size);
    -	}
    -
    -	// Check if we got everything done.
    -	if (coder->end_was_reached && coder->pos == coder->size)
    -		return LZMA_STREAM_END;
    -
    -	return LZMA_OK;
    -}
    -
    -
    -static void
    -simple_coder_end(lzma_coder *coder, const lzma_allocator *allocator)
    -{
    -	lzma_next_end(&coder->next, allocator);
    -	lzma_free(coder->simple, allocator);
    -	lzma_free(coder, allocator);
    -	return;
    -}
    -
    -
    -static lzma_ret
    -simple_coder_update(lzma_coder *coder, const lzma_allocator *allocator,
    -		const lzma_filter *filters_null lzma_attribute((__unused__)),
    -		const lzma_filter *reversed_filters)
    -{
    -	// No update support, just call the next filter in the chain.
    -	return lzma_next_filter_update(
    -			&coder->next, allocator, reversed_filters + 1);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters,
    -		size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
    -			bool is_encoder, uint8_t *buffer, size_t size),
    -		size_t simple_size, size_t unfiltered_max,
    -		uint32_t alignment, bool is_encoder)
    -{
    -	// Allocate memory for the lzma_coder structure if needed.
    -	if (next->coder == NULL) {
    -		// Here we allocate space also for the temporary buffer. We
    -		// need twice the size of unfiltered_max, because then it
    -		// is always possible to filter at least unfiltered_max bytes
    -		// more data in coder->buffer[] if it can be filled completely.
    -		next->coder = lzma_alloc(sizeof(lzma_coder)
    -				+ 2 * unfiltered_max, allocator);
    -		if (next->coder == NULL)
    -			return LZMA_MEM_ERROR;
    -
    -		next->code = &simple_code;
    -		next->end = &simple_coder_end;
    -		next->update = &simple_coder_update;
    -
    -		next->coder->next = LZMA_NEXT_CODER_INIT;
    -		next->coder->filter = filter;
    -		next->coder->allocated = 2 * unfiltered_max;
    -
    -		// Allocate memory for filter-specific data structure.
    -		if (simple_size > 0) {
    -			next->coder->simple = lzma_alloc(
    -					simple_size, allocator);
    -			if (next->coder->simple == NULL)
    -				return LZMA_MEM_ERROR;
    -		} else {
    -			next->coder->simple = NULL;
    -		}
    -	}
    -
    -	if (filters[0].options != NULL) {
    -		const lzma_options_bcj *simple = filters[0].options;
    -		next->coder->now_pos = simple->start_offset;
    -		if (next->coder->now_pos & (alignment - 1))
    -			return LZMA_OPTIONS_ERROR;
    -	} else {
    -		next->coder->now_pos = 0;
    -	}
    -
    -	// Reset variables.
    -	next->coder->is_encoder = is_encoder;
    -	next->coder->end_was_reached = false;
    -	next->coder->pos = 0;
    -	next->coder->filtered = 0;
    -	next->coder->size = 0;
    -
    -	return lzma_next_filter_init(
    -			&next->coder->next, allocator, filters + 1);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/simple_coder.h b/external/public-domain/xz/dist/src/liblzma/simple/simple_coder.h
    deleted file mode 100644
    index 19c2ee03a..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/simple_coder.h
    +++ /dev/null
    @@ -1,72 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       simple_coder.h
    -/// \brief      Wrapper for simple filters
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_SIMPLE_CODER_H
    -#define LZMA_SIMPLE_CODER_H
    -
    -#include "common.h"
    -
    -
    -extern lzma_ret lzma_simple_x86_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern lzma_ret lzma_simple_x86_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -
    -extern lzma_ret lzma_simple_powerpc_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern lzma_ret lzma_simple_powerpc_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -
    -extern lzma_ret lzma_simple_ia64_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern lzma_ret lzma_simple_ia64_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -
    -extern lzma_ret lzma_simple_arm_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern lzma_ret lzma_simple_arm_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -
    -extern lzma_ret lzma_simple_armthumb_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern lzma_ret lzma_simple_armthumb_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -
    -extern lzma_ret lzma_simple_sparc_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -extern lzma_ret lzma_simple_sparc_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/simple_decoder.c b/external/public-domain/xz/dist/src/liblzma/simple/simple_decoder.c
    deleted file mode 100644
    index 1d864f2bf..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/simple_decoder.c
    +++ /dev/null
    @@ -1,40 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       simple_decoder.c
    -/// \brief      Properties decoder for simple filters
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_decoder.h"
    -
    -
    -extern lzma_ret
    -lzma_simple_props_decode(void **options, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size)
    -{
    -	if (props_size == 0)
    -		return LZMA_OK;
    -
    -	if (props_size != 4)
    -		return LZMA_OPTIONS_ERROR;
    -
    -	lzma_options_bcj *opt = lzma_alloc(
    -			sizeof(lzma_options_bcj), allocator);
    -	if (opt == NULL)
    -		return LZMA_MEM_ERROR;
    -
    -	opt->start_offset = unaligned_read32le(props);
    -
    -	// Don't leave an options structure allocated if start_offset is zero.
    -	if (opt->start_offset == 0)
    -		lzma_free(opt, allocator);
    -	else
    -		*options = opt;
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/simple_decoder.h b/external/public-domain/xz/dist/src/liblzma/simple/simple_decoder.h
    deleted file mode 100644
    index bed8d37a9..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/simple_decoder.h
    +++ /dev/null
    @@ -1,22 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       simple_decoder.h
    -/// \brief      Properties decoder for simple filters
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_SIMPLE_DECODER_H
    -#define LZMA_SIMPLE_DECODER_H
    -
    -#include "simple_coder.h"
    -
    -extern lzma_ret lzma_simple_props_decode(
    -		void **options, const lzma_allocator *allocator,
    -		const uint8_t *props, size_t props_size);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/simple_encoder.c b/external/public-domain/xz/dist/src/liblzma/simple/simple_encoder.c
    deleted file mode 100644
    index 8aa463bed..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/simple_encoder.c
    +++ /dev/null
    @@ -1,38 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       simple_encoder.c
    -/// \brief      Properties encoder for simple filters
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_encoder.h"
    -
    -
    -extern lzma_ret
    -lzma_simple_props_size(uint32_t *size, const void *options)
    -{
    -	const lzma_options_bcj *const opt = options;
    -	*size = (opt == NULL || opt->start_offset == 0) ? 0 : 4;
    -	return LZMA_OK;
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_props_encode(const void *options, uint8_t *out)
    -{
    -	const lzma_options_bcj *const opt = options;
    -
    -	// The default start offset is zero, so we don't need to store any
    -	// options unless the start offset is non-zero.
    -	if (opt == NULL || opt->start_offset == 0)
    -		return LZMA_OK;
    -
    -	unaligned_write32le(out, opt->start_offset);
    -
    -	return LZMA_OK;
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/simple_encoder.h b/external/public-domain/xz/dist/src/liblzma/simple/simple_encoder.h
    deleted file mode 100644
    index 1cee4823a..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/simple_encoder.h
    +++ /dev/null
    @@ -1,23 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       simple_encoder.c
    -/// \brief      Properties encoder for simple filters
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_SIMPLE_ENCODER_H
    -#define LZMA_SIMPLE_ENCODER_H
    -
    -#include "simple_coder.h"
    -
    -
    -extern lzma_ret lzma_simple_props_size(uint32_t *size, const void *options);
    -
    -extern lzma_ret lzma_simple_props_encode(const void *options, uint8_t *out);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/simple_private.h b/external/public-domain/xz/dist/src/liblzma/simple/simple_private.h
    deleted file mode 100644
    index bb20cb419..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/simple_private.h
    +++ /dev/null
    @@ -1,76 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       simple_private.h
    -/// \brief      Private definitions for so called simple filters
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_SIMPLE_PRIVATE_H
    -#define LZMA_SIMPLE_PRIVATE_H
    -
    -#include "simple_coder.h"
    -
    -
    -typedef struct lzma_simple_s lzma_simple;
    -
    -struct lzma_coder_s {
    -	/// Next filter in the chain
    -	lzma_next_coder next;
    -
    -	/// True if the next coder in the chain has returned LZMA_STREAM_END.
    -	bool end_was_reached;
    -
    -	/// True if filter() should encode the data; false to decode.
    -	/// Currently all simple filters use the same function for encoding
    -	/// and decoding, because the difference between encoders and decoders
    -	/// is very small.
    -	bool is_encoder;
    -
    -	/// Pointer to filter-specific function, which does
    -	/// the actual filtering.
    -	size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
    -			bool is_encoder, uint8_t *buffer, size_t size);
    -
    -	/// Pointer to filter-specific data, or NULL if filter doesn't need
    -	/// any extra data.
    -	lzma_simple *simple;
    -
    -	/// The lowest 32 bits of the current position in the data. Most
    -	/// filters need this to do conversions between absolute and relative
    -	/// addresses.
    -	uint32_t now_pos;
    -
    -	/// Size of the memory allocated for the buffer.
    -	size_t allocated;
    -
    -	/// Flushing position in the temporary buffer. buffer[pos] is the
    -	/// next byte to be copied to out[].
    -	size_t pos;
    -
    -	/// buffer[filtered] is the first unfiltered byte. When pos is smaller
    -	/// than filtered, there is unflushed filtered data in the buffer.
    -	size_t filtered;
    -
    -	/// Total number of bytes (both filtered and unfiltered) currently
    -	/// in the temporary buffer.
    -	size_t size;
    -
    -	/// Temporary buffer
    -	uint8_t buffer[];
    -};
    -
    -
    -extern lzma_ret lzma_simple_coder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters,
    -		size_t (*filter)(lzma_simple *simple, uint32_t now_pos,
    -			bool is_encoder, uint8_t *buffer, size_t size),
    -		size_t simple_size, size_t unfiltered_max,
    -		uint32_t alignment, bool is_encoder);
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/sparc.c b/external/public-domain/xz/dist/src/liblzma/simple/sparc.c
    deleted file mode 100644
    index 53ee49d15..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/sparc.c
    +++ /dev/null
    @@ -1,83 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       sparc.c
    -/// \brief      Filter for SPARC binaries
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_private.h"
    -
    -
    -static size_t
    -sparc_code(lzma_simple *simple lzma_attribute((__unused__)),
    -		uint32_t now_pos, bool is_encoder,
    -		uint8_t *buffer, size_t size)
    -{
    -	size_t i;
    -	for (i = 0; i + 4 <= size; i += 4) {
    -
    -		if ((buffer[i] == 0x40 && (buffer[i + 1] & 0xC0) == 0x00)
    -				|| (buffer[i] == 0x7F
    -				&& (buffer[i + 1] & 0xC0) == 0xC0)) {
    -
    -			uint32_t src = ((uint32_t)buffer[i + 0] << 24)
    -					| ((uint32_t)buffer[i + 1] << 16)
    -					| ((uint32_t)buffer[i + 2] << 8)
    -					| ((uint32_t)buffer[i + 3]);
    -
    -			src <<= 2;
    -
    -			uint32_t dest;
    -			if (is_encoder)
    -				dest = now_pos + (uint32_t)(i) + src;
    -			else
    -				dest = src - (now_pos + (uint32_t)(i));
    -
    -			dest >>= 2;
    -
    -			dest = (((0 - ((dest >> 22) & 1)) << 22) & 0x3FFFFFFF)
    -					| (dest & 0x3FFFFF)
    -					| 0x40000000;
    -
    -			buffer[i + 0] = (uint8_t)(dest >> 24);
    -			buffer[i + 1] = (uint8_t)(dest >> 16);
    -			buffer[i + 2] = (uint8_t)(dest >> 8);
    -			buffer[i + 3] = (uint8_t)(dest);
    -		}
    -	}
    -
    -	return i;
    -}
    -
    -
    -static lzma_ret
    -sparc_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters, bool is_encoder)
    -{
    -	return lzma_simple_coder_init(next, allocator, filters,
    -			&sparc_code, 0, 4, 4, is_encoder);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_sparc_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return sparc_coder_init(next, allocator, filters, true);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_sparc_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return sparc_coder_init(next, allocator, filters, false);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/simple/x86.c b/external/public-domain/xz/dist/src/liblzma/simple/x86.c
    deleted file mode 100644
    index 3b2b4f852..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/simple/x86.c
    +++ /dev/null
    @@ -1,156 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       x86.c
    -/// \brief      Filter for x86 binaries (BCJ filter)
    -///
    -//  Authors:    Igor Pavlov
    -//              Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "simple_private.h"
    -
    -
    -#define Test86MSByte(b) ((b) == 0 || (b) == 0xFF)
    -
    -
    -struct lzma_simple_s {
    -	uint32_t prev_mask;
    -	uint32_t prev_pos;
    -};
    -
    -
    -static size_t
    -x86_code(lzma_simple *simple, uint32_t now_pos, bool is_encoder,
    -		uint8_t *buffer, size_t size)
    -{
    -	static const bool MASK_TO_ALLOWED_STATUS[8]
    -		= { true, true, true, false, true, false, false, false };
    -
    -	static const uint32_t MASK_TO_BIT_NUMBER[8]
    -			= { 0, 1, 2, 2, 3, 3, 3, 3 };
    -
    -	uint32_t prev_mask = simple->prev_mask;
    -	uint32_t prev_pos = simple->prev_pos;
    -
    -	if (size < 5)
    -		return 0;
    -
    -	if (now_pos - prev_pos > 5)
    -		prev_pos = now_pos - 5;
    -
    -	const size_t limit = size - 5;
    -	size_t buffer_pos = 0;
    -
    -	while (buffer_pos <= limit) {
    -		uint8_t b = buffer[buffer_pos];
    -		if (b != 0xE8 && b != 0xE9) {
    -			++buffer_pos;
    -			continue;
    -		}
    -
    -		const uint32_t offset = now_pos + (uint32_t)(buffer_pos)
    -				- prev_pos;
    -		prev_pos = now_pos + (uint32_t)(buffer_pos);
    -
    -		if (offset > 5) {
    -			prev_mask = 0;
    -		} else {
    -			for (uint32_t i = 0; i < offset; ++i) {
    -				prev_mask &= 0x77;
    -				prev_mask <<= 1;
    -			}
    -		}
    -
    -		b = buffer[buffer_pos + 4];
    -
    -		if (Test86MSByte(b)
    -			&& MASK_TO_ALLOWED_STATUS[(prev_mask >> 1) & 0x7]
    -				&& (prev_mask >> 1) < 0x10) {
    -
    -			uint32_t src = ((uint32_t)(b) << 24)
    -				| ((uint32_t)(buffer[buffer_pos + 3]) << 16)
    -				| ((uint32_t)(buffer[buffer_pos + 2]) << 8)
    -				| (buffer[buffer_pos + 1]);
    -
    -			uint32_t dest;
    -			while (true) {
    -				if (is_encoder)
    -					dest = src + (now_pos + (uint32_t)(
    -							buffer_pos) + 5);
    -				else
    -					dest = src - (now_pos + (uint32_t)(
    -							buffer_pos) + 5);
    -
    -				if (prev_mask == 0)
    -					break;
    -
    -				const uint32_t i = MASK_TO_BIT_NUMBER[
    -						prev_mask >> 1];
    -
    -				b = (uint8_t)(dest >> (24 - i * 8));
    -
    -				if (!Test86MSByte(b))
    -					break;
    -
    -				src = dest ^ ((1 << (32 - i * 8)) - 1);
    -			}
    -
    -			buffer[buffer_pos + 4]
    -					= (uint8_t)(~(((dest >> 24) & 1) - 1));
    -			buffer[buffer_pos + 3] = (uint8_t)(dest >> 16);
    -			buffer[buffer_pos + 2] = (uint8_t)(dest >> 8);
    -			buffer[buffer_pos + 1] = (uint8_t)(dest);
    -			buffer_pos += 5;
    -			prev_mask = 0;
    -
    -		} else {
    -			++buffer_pos;
    -			prev_mask |= 1;
    -			if (Test86MSByte(b))
    -				prev_mask |= 0x10;
    -		}
    -	}
    -
    -	simple->prev_mask = prev_mask;
    -	simple->prev_pos = prev_pos;
    -
    -	return buffer_pos;
    -}
    -
    -
    -static lzma_ret
    -x86_coder_init(lzma_next_coder *next, const lzma_allocator *allocator,
    -		const lzma_filter_info *filters, bool is_encoder)
    -{
    -	const lzma_ret ret = lzma_simple_coder_init(next, allocator, filters,
    -			&x86_code, sizeof(lzma_simple), 5, 1, is_encoder);
    -
    -	if (ret == LZMA_OK) {
    -		next->coder->simple->prev_mask = 0;
    -		next->coder->simple->prev_pos = (uint32_t)(-5);
    -	}
    -
    -	return ret;
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_x86_encoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return x86_coder_init(next, allocator, filters, true);
    -}
    -
    -
    -extern lzma_ret
    -lzma_simple_x86_decoder_init(lzma_next_coder *next,
    -		const lzma_allocator *allocator,
    -		const lzma_filter_info *filters)
    -{
    -	return x86_coder_init(next, allocator, filters, false);
    -}
    diff --git a/external/public-domain/xz/dist/src/liblzma/validate_map.sh b/external/public-domain/xz/dist/src/liblzma/validate_map.sh
    deleted file mode 100644
    index 3aee46687..000000000
    --- a/external/public-domain/xz/dist/src/liblzma/validate_map.sh
    +++ /dev/null
    @@ -1,68 +0,0 @@
    -#!/bin/sh
    -
    -###############################################################################
    -#
    -# Check liblzma.map for certain types of errors
    -#
    -# Author: Lasse Collin
    -#
    -# This file has been put into the public domain.
    -# You can do whatever you want with this file.
    -#
    -###############################################################################
    -
    -LC_ALL=C
    -export LC_ALL
    -
    -STATUS=0
    -
    -cd "$(dirname "$0")"
    -
    -# Get the list of symbols that aren't defined in liblzma.map.
    -SYMS=$(sed -n 's/^extern LZMA_API([^)]*) \([a-z0-9_]*\)(.*$/\1;/p' \
    -		api/lzma/*.h \
    -	| sort \
    -	| grep -Fve "$(sed '/[{}:*]/d;/^$/d;s/^	//' liblzma.map)")
    -
    -# Check that there are no old alpha or beta versions listed.
    -VER=$(cd ../.. && sh build-aux/version.sh)
    -NAMES=
    -case $VER in
    -	*alpha | *beta)
    -		NAMES=$(sed -n 's/^.*XZ_\([^ ]*\)\(alpha\|beta\) .*$/\1\2/p' \
    -			liblzma.map | grep -Fv "$VER")
    -		;;
    -esac
    -
    -# Check for duplicate lines. It can catch missing dependencies.
    -DUPS=$(sort liblzma.map | sed '/^$/d;/^global:$/d' | uniq -d)
    -
    -# Print error messages if needed.
    -if test -n "$SYMS$NAMES$DUPS"; then
    -	echo
    -	echo 'validate_map.sh found problems from liblzma.map:'
    -	echo
    -
    -	if test -n "$SYMS"; then
    -		echo 'liblzma.map lacks the following symbols:'
    -		echo "$SYMS"
    -		echo
    -	fi
    -
    -	if test -n "$NAMES"; then
    -		echo 'Obsolete alpha or beta version names:'
    -		echo "$NAMES"
    -		echo
    -	fi
    -
    -	if test -n "$DUPS"; then
    -		echo 'Duplicate lines:'
    -		echo "$DUPS"
    -		echo
    -	fi
    -
    -	STATUS=1
    -fi
    -
    -# Exit status is 1 if problems were found, 0 otherwise.
    -exit "$STATUS"
    diff --git a/external/public-domain/xz/dist/src/lzmainfo/lzmainfo.1 b/external/public-domain/xz/dist/src/lzmainfo/lzmainfo.1
    deleted file mode 100644
    index ce38eee50..000000000
    --- a/external/public-domain/xz/dist/src/lzmainfo/lzmainfo.1
    +++ /dev/null
    @@ -1,60 +0,0 @@
    -.\"
    -.\" Author: Lasse Collin
    -.\"
    -.\" This file has been put into the public domain.
    -.\" You can do whatever you want with this file.
    -.\"
    -.TH LZMAINFO 1 "2013-06-30" "Tukaani" "XZ Utils"
    -.SH NAME
    -lzmainfo \- show information stored in the .lzma file header
    -.SH SYNOPSIS
    -.B lzmainfo
    -.RB [ \-\-help ]
    -.RB [ \-\-version ]
    -.RI [ file... ]
    -.SH DESCRIPTION
    -.B lzmainfo
    -shows information stored in the
    -.B .lzma
    -file header.
    -It reads the first 13 bytes from the specified
    -.IR file ,
    -decodes the header, and prints it to standard output in human
    -readable format.
    -If no
    -.I files
    -are given or
    -.I file
    -is
    -.BR \- ,
    -standard input is read.
    -.PP
    -Usually the most interesting information is
    -the uncompressed size and the dictionary size.
    -Uncompressed size can be shown only if
    -the file is in the non-streamed
    -.B .lzma
    -format variant.
    -The amount of memory required to decompress the file is
    -a few dozen kilobytes plus the dictionary size.
    -.PP
    -.B lzmainfo
    -is included in XZ Utils primarily for
    -backward compatibility with LZMA Utils.
    -.SH "EXIT STATUS"
    -.TP
    -.B 0
    -All is good.
    -.TP
    -.B 1
    -An error occurred.
    -.SH BUGS
    -.B lzmainfo
    -uses
    -.B MB
    -while the correct suffix would be
    -.B MiB
    -(2^20 bytes).
    -This is to keep the output compatible with LZMA Utils.
    -.SH "SEE ALSO"
    -.BR xz (1)
    diff --git a/external/public-domain/xz/dist/src/lzmainfo/lzmainfo.c b/external/public-domain/xz/dist/src/lzmainfo/lzmainfo.c
    deleted file mode 100644
    index b0ccdfb43..000000000
    --- a/external/public-domain/xz/dist/src/lzmainfo/lzmainfo.c
    +++ /dev/null
    @@ -1,219 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       lzmainfo.c
    -/// \brief      lzmainfo tool for compatibility with LZMA Utils
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "sysdefs.h"
    -#include 
    -#include 
    -
    -#include "lzma.h"
    -#include "getopt.h"
    -#include "tuklib_gettext.h"
    -#include "tuklib_progname.h"
    -#include "tuklib_exit.h"
    -
    -#ifdef TUKLIB_DOSLIKE
    -#	include 
    -#	include 
    -#endif
    -
    -
    -static void lzma_attribute((__noreturn__))
    -help(void)
    -{
    -	printf(
    -_("Usage: %s [--help] [--version] [FILE]...\n"
    -"Show information stored in the .lzma file header"), progname);
    -
    -	printf(_(
    -"\nWith no FILE, or when FILE is -, read standard input.\n"));
    -	printf("\n");
    -
    -	printf(_("Report bugs to <%s> (in English or Finnish).\n"),
    -			PACKAGE_BUGREPORT);
    -	printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
    -
    -	tuklib_exit(EXIT_SUCCESS, EXIT_FAILURE, true);
    -}
    -
    -
    -static void lzma_attribute((__noreturn__))
    -version(void)
    -{
    -	puts("lzmainfo (" PACKAGE_NAME ") " LZMA_VERSION_STRING);
    -	tuklib_exit(EXIT_SUCCESS, EXIT_FAILURE, true);
    -}
    -
    -
    -/// Parse command line options.
    -static void
    -parse_args(int argc, char **argv)
    -{
    -	enum {
    -		OPT_HELP,
    -		OPT_VERSION,
    -	};
    -
    -	static const struct option long_opts[] = {
    -		{ "help",    no_argument, NULL, OPT_HELP },
    -		{ "version", no_argument, NULL, OPT_VERSION },
    -		{ NULL,      0,           NULL, 0 }
    -	};
    -
    -	int c;
    -	while ((c = getopt_long(argc, argv, "", long_opts, NULL)) != -1) {
    -		switch (c) {
    -		case OPT_HELP:
    -			help();
    -
    -		case OPT_VERSION:
    -			version();
    -
    -		default:
    -			exit(EXIT_FAILURE);
    -		}
    -	}
    -
    -	return;
    -}
    -
    -
    -/// Primitive base-2 logarithm for integers
    -static uint32_t
    -my_log2(uint32_t n)
    -{
    -	uint32_t e;
    -	for (e = 0; n > 1; ++e, n /= 2) ;
    -	return e;
    -}
    -
    -
    -/// Parse the .lzma header and display information about it.
    -static bool
    -lzmainfo(const char *name, FILE *f)
    -{
    -	uint8_t buf[13];
    -	const size_t size = fread(buf, 1, sizeof(buf), f);
    -	if (size != 13) {
    -		fprintf(stderr, "%s: %s: %s\n", progname, name,
    -				ferror(f) ? strerror(errno)
    -				: _("File is too small to be a .lzma file"));
    -		return true;
    -	}
    -
    -	lzma_filter filter = { .id = LZMA_FILTER_LZMA1 };
    -
    -	// Parse the first five bytes.
    -	switch (lzma_properties_decode(&filter, NULL, buf, 5)) {
    -	case LZMA_OK:
    -		break;
    -
    -	case LZMA_OPTIONS_ERROR:
    -		fprintf(stderr, "%s: %s: %s\n", progname, name,
    -				_("Not a .lzma file"));
    -		return true;
    -
    -	case LZMA_MEM_ERROR:
    -		fprintf(stderr, "%s: %s\n", progname, strerror(ENOMEM));
    -		exit(EXIT_FAILURE);
    -
    -	default:
    -		fprintf(stderr, "%s: %s\n", progname,
    -				_("Internal error (bug)"));
    -		exit(EXIT_FAILURE);
    -	}
    -
    -	// Uncompressed size
    -	uint64_t uncompressed_size = 0;
    -	for (size_t i = 0; i < 8; ++i)
    -		uncompressed_size |= (uint64_t)(buf[5 + i]) << (i * 8);
    -
    -	// Display the results. We don't want to translate these and also
    -	// will use MB instead of MiB, because someone could be parsing
    -	// this output and we don't want to break that when people move
    -	// from LZMA Utils to XZ Utils.
    -	if (f != stdin)
    -		printf("%s\n", name);
    -
    -	printf("Uncompressed size:             ");
    -	if (uncompressed_size == UINT64_MAX)
    -		printf("Unknown");
    -	else
    -		printf("%" PRIu64 " MB (%" PRIu64 " bytes)",
    -				(uncompressed_size + 512 * 1024)
    -					/ (1024 * 1024),
    -				uncompressed_size);
    -
    -	lzma_options_lzma *opt = filter.options;
    -
    -	printf("\nDictionary size:               "
    -			"%" PRIu32 " MB (2^%" PRIu32 " bytes)\n"
    -			"Literal context bits (lc):     %" PRIu32 "\n"
    -			"Literal pos bits (lp):         %" PRIu32 "\n"
    -			"Number of pos bits (pb):       %" PRIu32 "\n",
    -			(opt->dict_size + 512 * 1024) / (1024 * 1024),
    -			my_log2(opt->dict_size), opt->lc, opt->lp, opt->pb);
    -
    -	free(opt);
    -
    -	return false;
    -}
    -
    -
    -extern int
    -main(int argc, char **argv)
    -{
    -	tuklib_progname_init(argv);
    -	tuklib_gettext_init(PACKAGE, LOCALEDIR);
    -
    -	parse_args(argc, argv);
    -
    -#ifdef TUKLIB_DOSLIKE
    -	setmode(fileno(stdin), O_BINARY);
    -#endif
    -
    -	int ret = EXIT_SUCCESS;
    -
    -	// We print empty lines around the output only when reading from
    -	// files specified on the command line. This is due to how
    -	// LZMA Utils did it.
    -	if (optind == argc) {
    -		if (lzmainfo("(stdin)", stdin))
    -			ret = EXIT_FAILURE;
    -	} else {
    -		printf("\n");
    -
    -		do {
    -			if (strcmp(argv[optind], "-") == 0) {
    -				if (lzmainfo("(stdin)", stdin))
    -					ret = EXIT_FAILURE;
    -			} else {
    -				FILE *f = fopen(argv[optind], "r");
    -				if (f == NULL) {
    -					ret = EXIT_FAILURE;
    -					fprintf(stderr, "%s: %s: %s\n",
    -							progname,
    -							argv[optind],
    -							strerror(errno));
    -					continue;
    -				}
    -
    -				if (lzmainfo(argv[optind], f))
    -					ret = EXIT_FAILURE;
    -
    -				printf("\n");
    -				fclose(f);
    -			}
    -		} while (++optind < argc);
    -	}
    -
    -	tuklib_exit(ret, EXIT_FAILURE, true);
    -}
    diff --git a/external/public-domain/xz/dist/src/lzmainfo/lzmainfo_w32res.rc b/external/public-domain/xz/dist/src/lzmainfo/lzmainfo_w32res.rc
    deleted file mode 100644
    index 378fbe695..000000000
    --- a/external/public-domain/xz/dist/src/lzmainfo/lzmainfo_w32res.rc
    +++ /dev/null
    @@ -1,12 +0,0 @@
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - */
    -
    -#define MY_TYPE VFT_APP
    -#define MY_NAME "lzmainfo"
    -#define MY_SUFFIX ".exe"
    -#define MY_DESC "lzmainfo shows information about .lzma files"
    -#include "common_w32res.rc"
    diff --git a/external/public-domain/xz/dist/src/xz/args.c b/external/public-domain/xz/dist/src/xz/args.c
    deleted file mode 100644
    index 54f33af9c..000000000
    --- a/external/public-domain/xz/dist/src/xz/args.c
    +++ /dev/null
    @@ -1,686 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       args.c
    -/// \brief      Argument parsing
    -///
    -/// \note       Filter-specific options parsing is in options.c.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -#include "getopt.h"
    -#include 
    -
    -
    -bool opt_stdout = false;
    -bool opt_force = false;
    -bool opt_keep_original = false;
    -bool opt_robot = false;
    -bool opt_ignore_check = false;
    -
    -// We don't modify or free() this, but we need to assign it in some
    -// non-const pointers.
    -const char stdin_filename[] = "(stdin)";
    -
    -
    -/// Parse and set the memory usage limit for compression and/or decompression.
    -static void
    -parse_memlimit(const char *name, const char *name_percentage, char *str,
    -		bool set_compress, bool set_decompress)
    -{
    -	bool is_percentage = false;
    -	uint64_t value;
    -
    -	const size_t len = strlen(str);
    -	if (len > 0 && str[len - 1] == '%') {
    -		str[len - 1] = '\0';
    -		is_percentage = true;
    -		value = str_to_uint64(name_percentage, str, 1, 100);
    -	} else {
    -		// On 32-bit systems, SIZE_MAX would make more sense than
    -		// UINT64_MAX. But use UINT64_MAX still so that scripts
    -		// that assume > 4 GiB values don't break.
    -		value = str_to_uint64(name, str, 0, UINT64_MAX);
    -	}
    -
    -	hardware_memlimit_set(
    -			value, set_compress, set_decompress, is_percentage);
    -	return;
    -}
    -
    -
    -static void
    -parse_block_list(char *str)
    -{
    -	// It must be non-empty and not begin with a comma.
    -	if (str[0] == '\0' || str[0] == ',')
    -		message_fatal(_("%s: Invalid argument to --block-list"), str);
    -
    -	// Count the number of comma-separated strings.
    -	size_t count = 1;
    -	for (size_t i = 0; str[i] != '\0'; ++i)
    -		if (str[i] == ',')
    -			++count;
    -
    -	// Prevent an unlikely integer overflow.
    -	if (count > SIZE_MAX / sizeof(uint64_t) - 1)
    -		message_fatal(_("%s: Too many arguments to --block-list"),
    -				str);
    -
    -	// Allocate memory to hold all the sizes specified.
    -	// If --block-list was specified already, its value is forgotten.
    -	free(opt_block_list);
    -	opt_block_list = xmalloc((count + 1) * sizeof(uint64_t));
    -
    -	for (size_t i = 0; i < count; ++i) {
    -		// Locate the next comma and replace it with \0.
    -		char *p = strchr(str, ',');
    -		if (p != NULL)
    -			*p = '\0';
    -
    -		if (str[0] == '\0') {
    -			// There is no string, that is, a comma follows
    -			// another comma. Use the previous value.
    -			//
    -			// NOTE: We checked earler that the first char
    -			// of the whole list cannot be a comma.
    -			assert(i > 0);
    -			opt_block_list[i] = opt_block_list[i - 1];
    -		} else {
    -			opt_block_list[i] = str_to_uint64("block-list", str,
    -					0, UINT64_MAX);
    -
    -			// Zero indicates no more new Blocks.
    -			if (opt_block_list[i] == 0) {
    -				if (i + 1 != count)
    -					message_fatal(_("0 can only be used "
    -							"as the last element "
    -							"in --block-list"));
    -
    -				opt_block_list[i] = UINT64_MAX;
    -			}
    -		}
    -
    -		if (p == NULL)
    -			break;
    -		str = p + 1;
    -	}
    -
    -	// Terminate the array.
    -	opt_block_list[count] = 0;
    -	return;
    -}
    -
    -
    -static void
    -parse_real(args_info *args, int argc, char **argv)
    -{
    -	enum {
    -		OPT_X86 = INT_MIN,
    -		OPT_POWERPC,
    -		OPT_IA64,
    -		OPT_ARM,
    -		OPT_ARMTHUMB,
    -		OPT_SPARC,
    -		OPT_DELTA,
    -		OPT_LZMA1,
    -		OPT_LZMA2,
    -
    -		OPT_SINGLE_STREAM,
    -		OPT_NO_SPARSE,
    -		OPT_FILES,
    -		OPT_FILES0,
    -		OPT_BLOCK_SIZE,
    -		OPT_BLOCK_LIST,
    -		OPT_MEM_COMPRESS,
    -		OPT_MEM_DECOMPRESS,
    -		OPT_NO_ADJUST,
    -		OPT_INFO_MEMORY,
    -		OPT_ROBOT,
    -		OPT_FLUSH_TIMEOUT,
    -		OPT_IGNORE_CHECK,
    -	};
    -
    -	static const char short_opts[]
    -			= "cC:defF:hHlkM:qQrS:tT:vVz0123456789";
    -
    -	static const struct option long_opts[] = {
    -		// Operation mode
    -		{ "compress",     no_argument,       NULL,  'z' },
    -		{ "decompress",   no_argument,       NULL,  'd' },
    -		{ "uncompress",   no_argument,       NULL,  'd' },
    -		{ "test",         no_argument,       NULL,  't' },
    -		{ "list",         no_argument,       NULL,  'l' },
    -
    -		// Operation modifiers
    -		{ "keep",         no_argument,       NULL,  'k' },
    -		{ "force",        no_argument,       NULL,  'f' },
    -		{ "stdout",       no_argument,       NULL,  'c' },
    -		{ "to-stdout",    no_argument,       NULL,  'c' },
    -		{ "single-stream", no_argument,      NULL,  OPT_SINGLE_STREAM },
    -		{ "no-sparse",    no_argument,       NULL,  OPT_NO_SPARSE },
    -		{ "suffix",       required_argument, NULL,  'S' },
    -		// { "recursive",      no_argument,       NULL,  'r' }, // TODO
    -		{ "files",        optional_argument, NULL,  OPT_FILES },
    -		{ "files0",       optional_argument, NULL,  OPT_FILES0 },
    -
    -		// Basic compression settings
    -		{ "format",       required_argument, NULL,  'F' },
    -		{ "check",        required_argument, NULL,  'C' },
    -		{ "ignore-check", no_argument,       NULL,  OPT_IGNORE_CHECK },
    -		{ "block-size",   required_argument, NULL,  OPT_BLOCK_SIZE },
    -		{ "block-list",  required_argument, NULL,  OPT_BLOCK_LIST },
    -		{ "memlimit-compress",   required_argument, NULL, OPT_MEM_COMPRESS },
    -		{ "memlimit-decompress", required_argument, NULL, OPT_MEM_DECOMPRESS },
    -		{ "memlimit",     required_argument, NULL,  'M' },
    -		{ "memory",       required_argument, NULL,  'M' }, // Old alias
    -		{ "no-adjust",    no_argument,       NULL,  OPT_NO_ADJUST },
    -		{ "threads",      required_argument, NULL,  'T' },
    -		{ "flush-timeout", required_argument, NULL, OPT_FLUSH_TIMEOUT },
    -
    -		{ "extreme",      no_argument,       NULL,  'e' },
    -		{ "fast",         no_argument,       NULL,  '0' },
    -		{ "best",         no_argument,       NULL,  '9' },
    -
    -		// Filters
    -		{ "lzma1",        optional_argument, NULL,  OPT_LZMA1 },
    -		{ "lzma2",        optional_argument, NULL,  OPT_LZMA2 },
    -		{ "x86",          optional_argument, NULL,  OPT_X86 },
    -		{ "powerpc",      optional_argument, NULL,  OPT_POWERPC },
    -		{ "ia64",         optional_argument, NULL,  OPT_IA64 },
    -		{ "arm",          optional_argument, NULL,  OPT_ARM },
    -		{ "armthumb",     optional_argument, NULL,  OPT_ARMTHUMB },
    -		{ "sparc",        optional_argument, NULL,  OPT_SPARC },
    -		{ "delta",        optional_argument, NULL,  OPT_DELTA },
    -
    -		// Other options
    -		{ "quiet",        no_argument,       NULL,  'q' },
    -		{ "verbose",      no_argument,       NULL,  'v' },
    -		{ "no-warn",      no_argument,       NULL,  'Q' },
    -		{ "robot",        no_argument,       NULL,  OPT_ROBOT },
    -		{ "info-memory",  no_argument,       NULL,  OPT_INFO_MEMORY },
    -		{ "help",         no_argument,       NULL,  'h' },
    -		{ "long-help",    no_argument,       NULL,  'H' },
    -		{ "version",      no_argument,       NULL,  'V' },
    -
    -		{ NULL,           0,                 NULL,   0 }
    -	};
    -
    -	int c;
    -
    -	while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL))
    -			!= -1) {
    -		switch (c) {
    -		// Compression preset (also for decompression if --format=raw)
    -		case '0': case '1': case '2': case '3': case '4':
    -		case '5': case '6': case '7': case '8': case '9':
    -			coder_set_preset(c - '0');
    -			break;
    -
    -		// --memlimit-compress
    -		case OPT_MEM_COMPRESS:
    -			parse_memlimit("memlimit-compress",
    -					"memlimit-compress%", optarg,
    -					true, false);
    -			break;
    -
    -		// --memlimit-decompress
    -		case OPT_MEM_DECOMPRESS:
    -			parse_memlimit("memlimit-decompress",
    -					"memlimit-decompress%", optarg,
    -					false, true);
    -			break;
    -
    -		// --memlimit
    -		case 'M':
    -			parse_memlimit("memlimit", "memlimit%", optarg,
    -					true, true);
    -			break;
    -
    -		// --suffix
    -		case 'S':
    -			suffix_set(optarg);
    -			break;
    -
    -		case 'T':
    -			// The max is from src/liblzma/common/common.h.
    -			hardware_threads_set(str_to_uint64("threads",
    -					optarg, 0, 16384));
    -			break;
    -
    -		// --version
    -		case 'V':
    -			// This doesn't return.
    -			message_version();
    -
    -		// --stdout
    -		case 'c':
    -			opt_stdout = true;
    -			break;
    -
    -		// --decompress
    -		case 'd':
    -			opt_mode = MODE_DECOMPRESS;
    -			break;
    -
    -		// --extreme
    -		case 'e':
    -			coder_set_extreme();
    -			break;
    -
    -		// --force
    -		case 'f':
    -			opt_force = true;
    -			break;
    -
    -		// --info-memory
    -		case OPT_INFO_MEMORY:
    -			// This doesn't return.
    -			hardware_memlimit_show();
    -
    -		// --help
    -		case 'h':
    -			// This doesn't return.
    -			message_help(false);
    -
    -		// --long-help
    -		case 'H':
    -			// This doesn't return.
    -			message_help(true);
    -
    -		// --list
    -		case 'l':
    -			opt_mode = MODE_LIST;
    -			break;
    -
    -		// --keep
    -		case 'k':
    -			opt_keep_original = true;
    -			break;
    -
    -		// --quiet
    -		case 'q':
    -			message_verbosity_decrease();
    -			break;
    -
    -		case 'Q':
    -			set_exit_no_warn();
    -			break;
    -
    -		case 't':
    -			opt_mode = MODE_TEST;
    -			break;
    -
    -		// --verbose
    -		case 'v':
    -			message_verbosity_increase();
    -			break;
    -
    -		// --robot
    -		case OPT_ROBOT:
    -			opt_robot = true;
    -
    -			// This is to make sure that floating point numbers
    -			// always have a dot as decimal separator.
    -			setlocale(LC_NUMERIC, "C");
    -			break;
    -
    -		case 'z':
    -			opt_mode = MODE_COMPRESS;
    -			break;
    -
    -		// Filter setup
    -
    -		case OPT_X86:
    -			coder_add_filter(LZMA_FILTER_X86,
    -					options_bcj(optarg));
    -			break;
    -
    -		case OPT_POWERPC:
    -			coder_add_filter(LZMA_FILTER_POWERPC,
    -					options_bcj(optarg));
    -			break;
    -
    -		case OPT_IA64:
    -			coder_add_filter(LZMA_FILTER_IA64,
    -					options_bcj(optarg));
    -			break;
    -
    -		case OPT_ARM:
    -			coder_add_filter(LZMA_FILTER_ARM,
    -					options_bcj(optarg));
    -			break;
    -
    -		case OPT_ARMTHUMB:
    -			coder_add_filter(LZMA_FILTER_ARMTHUMB,
    -					options_bcj(optarg));
    -			break;
    -
    -		case OPT_SPARC:
    -			coder_add_filter(LZMA_FILTER_SPARC,
    -					options_bcj(optarg));
    -			break;
    -
    -		case OPT_DELTA:
    -			coder_add_filter(LZMA_FILTER_DELTA,
    -					options_delta(optarg));
    -			break;
    -
    -		case OPT_LZMA1:
    -			coder_add_filter(LZMA_FILTER_LZMA1,
    -					options_lzma(optarg));
    -			break;
    -
    -		case OPT_LZMA2:
    -			coder_add_filter(LZMA_FILTER_LZMA2,
    -					options_lzma(optarg));
    -			break;
    -
    -		// Other
    -
    -		// --format
    -		case 'F': {
    -			// Just in case, support both "lzma" and "alone" since
    -			// the latter was used for forward compatibility in
    -			// LZMA Utils 4.32.x.
    -			static const struct {
    -				char str[8];
    -				enum format_type format;
    -			} types[] = {
    -				{ "auto",   FORMAT_AUTO },
    -				{ "xz",     FORMAT_XZ },
    -				{ "lzma",   FORMAT_LZMA },
    -				{ "alone",  FORMAT_LZMA },
    -				// { "gzip",   FORMAT_GZIP },
    -				// { "gz",     FORMAT_GZIP },
    -				{ "raw",    FORMAT_RAW },
    -			};
    -
    -			size_t i = 0;
    -			while (strcmp(types[i].str, optarg) != 0)
    -				if (++i == ARRAY_SIZE(types))
    -					message_fatal(_("%s: Unknown file "
    -							"format type"),
    -							optarg);
    -
    -			opt_format = types[i].format;
    -			break;
    -		}
    -
    -		// --check
    -		case 'C': {
    -			static const struct {
    -				char str[8];
    -				lzma_check check;
    -			} types[] = {
    -				{ "none",   LZMA_CHECK_NONE },
    -				{ "crc32",  LZMA_CHECK_CRC32 },
    -				{ "crc64",  LZMA_CHECK_CRC64 },
    -				{ "sha256", LZMA_CHECK_SHA256 },
    -			};
    -
    -			size_t i = 0;
    -			while (strcmp(types[i].str, optarg) != 0) {
    -				if (++i == ARRAY_SIZE(types))
    -					message_fatal(_("%s: Unsupported "
    -							"integrity "
    -							"check type"), optarg);
    -			}
    -
    -			// Use a separate check in case we are using different
    -			// liblzma than what was used to compile us.
    -			if (!lzma_check_is_supported(types[i].check))
    -				message_fatal(_("%s: Unsupported integrity "
    -						"check type"), optarg);
    -
    -			coder_set_check(types[i].check);
    -			break;
    -		}
    -
    -		case OPT_IGNORE_CHECK:
    -			opt_ignore_check = true;
    -			break;
    -
    -		case OPT_BLOCK_SIZE:
    -			opt_block_size = str_to_uint64("block-size", optarg,
    -					0, LZMA_VLI_MAX);
    -			break;
    -
    -		case OPT_BLOCK_LIST: {
    -			parse_block_list(optarg);
    -			break;
    -		}
    -
    -		case OPT_SINGLE_STREAM:
    -			opt_single_stream = true;
    -			break;
    -
    -		case OPT_NO_SPARSE:
    -			io_no_sparse();
    -			break;
    -
    -		case OPT_FILES:
    -			args->files_delim = '\n';
    -
    -		// Fall through
    -
    -		case OPT_FILES0:
    -			if (args->files_name != NULL)
    -				message_fatal(_("Only one file can be "
    -						"specified with `--files' "
    -						"or `--files0'."));
    -
    -			if (optarg == NULL) {
    -				args->files_name = (char *)stdin_filename;
    -				args->files_file = stdin;
    -			} else {
    -				args->files_name = optarg;
    -				args->files_file = fopen(optarg,
    -						c == OPT_FILES ? "r" : "rb");
    -				if (args->files_file == NULL)
    -					message_fatal("%s: %s", optarg,
    -							strerror(errno));
    -			}
    -
    -			break;
    -
    -		case OPT_NO_ADJUST:
    -			opt_auto_adjust = false;
    -			break;
    -
    -		case OPT_FLUSH_TIMEOUT:
    -			opt_flush_timeout = str_to_uint64("flush-timeout",
    -					optarg, 0, UINT64_MAX);
    -			break;
    -
    -		default:
    -			message_try_help();
    -			tuklib_exit(E_ERROR, E_ERROR, false);
    -		}
    -	}
    -
    -	return;
    -}
    -
    -
    -static void
    -parse_environment(args_info *args, char *argv0, const char *varname)
    -{
    -	char *env = getenv(varname);
    -	if (env == NULL)
    -		return;
    -
    -	// We modify the string, so make a copy of it.
    -	env = xstrdup(env);
    -
    -	// Calculate the number of arguments in env. argc stats at one
    -	// to include space for the program name.
    -	int argc = 1;
    -	bool prev_was_space = true;
    -	for (size_t i = 0; env[i] != '\0'; ++i) {
    -		// NOTE: Cast to unsigned char is needed so that correct
    -		// value gets passed to isspace(), which expects
    -		// unsigned char cast to int. Casting to int is done
    -		// automatically due to integer promotion, but we need to
    -		// force char to unsigned char manually. Otherwise 8-bit
    -		// characters would get promoted to wrong value if
    -		// char is signed.
    -		if (isspace((unsigned char)env[i])) {
    -			prev_was_space = true;
    -		} else if (prev_was_space) {
    -			prev_was_space = false;
    -
    -			// Keep argc small enough to fit into a signed int
    -			// and to keep it usable for memory allocation.
    -			if (++argc == my_min(
    -					INT_MAX, SIZE_MAX / sizeof(char *)))
    -				message_fatal(_("The environment variable "
    -						"%s contains too many "
    -						"arguments"), varname);
    -		}
    -	}
    -
    -	// Allocate memory to hold pointers to the arguments. Add one to get
    -	// space for the terminating NULL (if some systems happen to need it).
    -	char **argv = xmalloc(((size_t)(argc) + 1) * sizeof(char *));
    -	argv[0] = argv0;
    -	argv[argc] = NULL;
    -
    -	// Go through the string again. Split the arguments using '\0'
    -	// characters and add pointers to the resulting strings to argv.
    -	argc = 1;
    -	prev_was_space = true;
    -	for (size_t i = 0; env[i] != '\0'; ++i) {
    -		if (isspace((unsigned char)env[i])) {
    -			prev_was_space = true;
    -			env[i] = '\0';
    -		} else if (prev_was_space) {
    -			prev_was_space = false;
    -			argv[argc++] = env + i;
    -		}
    -	}
    -
    -	// Parse the argument list we got from the environment. All non-option
    -	// arguments i.e. filenames are ignored.
    -	parse_real(args, argc, argv);
    -
    -	// Reset the state of the getopt_long() so that we can parse the
    -	// command line options too. There are two incompatible ways to
    -	// do it.
    -#ifdef HAVE_OPTRESET
    -	// BSD
    -	optind = 1;
    -	optreset = 1;
    -#else
    -	// GNU, Solaris
    -	optind = 0;
    -#endif
    -
    -	// We don't need the argument list from environment anymore.
    -	free(argv);
    -	free(env);
    -
    -	return;
    -}
    -
    -
    -extern void
    -args_parse(args_info *args, int argc, char **argv)
    -{
    -	// Initialize those parts of *args that we need later.
    -	args->files_name = NULL;
    -	args->files_file = NULL;
    -	args->files_delim = '\0';
    -
    -	// Check how we were called.
    -	{
    -		// Remove the leading path name, if any.
    -		const char *name = strrchr(argv[0], '/');
    -		if (name == NULL)
    -			name = argv[0];
    -		else
    -			++name;
    -
    -		// NOTE: It's possible that name[0] is now '\0' if argv[0]
    -		// is weird, but it doesn't matter here.
    -
    -		// Look for full command names instead of substrings like
    -		// "un", "cat", and "lz" to reduce possibility of false
    -		// positives when the programs have been renamed.
    -		if (strstr(name, "xzcat") != NULL) {
    -			opt_mode = MODE_DECOMPRESS;
    -			opt_stdout = true;
    -		} else if (strstr(name, "unxz") != NULL) {
    -			opt_mode = MODE_DECOMPRESS;
    -		} else if (strstr(name, "lzcat") != NULL) {
    -			opt_format = FORMAT_LZMA;
    -			opt_mode = MODE_DECOMPRESS;
    -			opt_stdout = true;
    -		} else if (strstr(name, "unlzma") != NULL) {
    -			opt_format = FORMAT_LZMA;
    -			opt_mode = MODE_DECOMPRESS;
    -		} else if (strstr(name, "lzma") != NULL) {
    -			opt_format = FORMAT_LZMA;
    -		}
    -	}
    -
    -	// First the flags from the environment
    -	parse_environment(args, argv[0], "XZ_DEFAULTS");
    -	parse_environment(args, argv[0], "XZ_OPT");
    -
    -	// Then from the command line
    -	parse_real(args, argc, argv);
    -
    -	// Never remove the source file when the destination is not on disk.
    -	// In test mode the data is written nowhere, but setting opt_stdout
    -	// will make the rest of the code behave well.
    -	if (opt_stdout || opt_mode == MODE_TEST) {
    -		opt_keep_original = true;
    -		opt_stdout = true;
    -	}
    -
    -	// When compressing, if no --format flag was used, or it
    -	// was --format=auto, we compress to the .xz format.
    -	if (opt_mode == MODE_COMPRESS && opt_format == FORMAT_AUTO)
    -		opt_format = FORMAT_XZ;
    -
    -	// Compression settings need to be validated (options themselves and
    -	// their memory usage) when compressing to any file format. It has to
    -	// be done also when uncompressing raw data, since for raw decoding
    -	// the options given on the command line are used to know what kind
    -	// of raw data we are supposed to decode.
    -	if (opt_mode == MODE_COMPRESS || opt_format == FORMAT_RAW)
    -		coder_set_compression_settings();
    -
    -	// If no filenames are given, use stdin.
    -	if (argv[optind] == NULL && args->files_name == NULL) {
    -		// We don't modify or free() the "-" constant. The caller
    -		// modifies this so don't make the struct itself const.
    -		static char *names_stdin[2] = { (char *)"-", NULL };
    -		args->arg_names = names_stdin;
    -		args->arg_count = 1;
    -	} else {
    -		// We got at least one filename from the command line, or
    -		// --files or --files0 was specified.
    -		args->arg_names = argv + optind;
    -		args->arg_count = argc - optind;
    -	}
    -
    -	return;
    -}
    -
    -
    -#ifndef NDEBUG
    -extern void
    -args_free(void)
    -{
    -	free(opt_block_list);
    -	return;
    -}
    -#endif
    diff --git a/external/public-domain/xz/dist/src/xz/args.h b/external/public-domain/xz/dist/src/xz/args.h
    deleted file mode 100644
    index 1defad12e..000000000
    --- a/external/public-domain/xz/dist/src/xz/args.h
    +++ /dev/null
    @@ -1,44 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       args.h
    -/// \brief      Argument parsing
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -typedef struct {
    -	/// Filenames from command line
    -	char **arg_names;
    -
    -	/// Number of filenames from command line
    -	size_t arg_count;
    -
    -	/// Name of the file from which to read filenames. This is NULL
    -	/// if --files or --files0 was not used.
    -	char *files_name;
    -
    -	/// File opened for reading from which filenames are read. This is
    -	/// non-NULL only if files_name is non-NULL.
    -	FILE *files_file;
    -
    -	/// Delimiter for filenames read from files_file
    -	char files_delim;
    -
    -} args_info;
    -
    -
    -extern bool opt_stdout;
    -extern bool opt_force;
    -extern bool opt_keep_original;
    -// extern bool opt_recursive;
    -extern bool opt_robot;
    -extern bool opt_ignore_check;
    -
    -extern const char stdin_filename[];
    -
    -extern void args_parse(args_info *args, int argc, char **argv);
    -extern void args_free(void);
    diff --git a/external/public-domain/xz/dist/src/xz/coder.c b/external/public-domain/xz/dist/src/xz/coder.c
    deleted file mode 100644
    index a94bdb832..000000000
    --- a/external/public-domain/xz/dist/src/xz/coder.c
    +++ /dev/null
    @@ -1,919 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       coder.c
    -/// \brief      Compresses or uncompresses a file
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -
    -/// Return value type for coder_init().
    -enum coder_init_ret {
    -	CODER_INIT_NORMAL,
    -	CODER_INIT_PASSTHRU,
    -	CODER_INIT_ERROR,
    -};
    -
    -
    -enum operation_mode opt_mode = MODE_COMPRESS;
    -enum format_type opt_format = FORMAT_AUTO;
    -bool opt_auto_adjust = true;
    -bool opt_single_stream = false;
    -uint64_t opt_block_size = 0;
    -uint64_t *opt_block_list = NULL;
    -
    -
    -/// Stream used to communicate with liblzma
    -static lzma_stream strm = LZMA_STREAM_INIT;
    -
    -/// Filters needed for all encoding all formats, and also decoding in raw data
    -static lzma_filter filters[LZMA_FILTERS_MAX + 1];
    -
    -/// Input and output buffers
    -static io_buf in_buf;
    -static io_buf out_buf;
    -
    -/// Number of filters. Zero indicates that we are using a preset.
    -static uint32_t filters_count = 0;
    -
    -/// Number of the preset (0-9)
    -static uint32_t preset_number = LZMA_PRESET_DEFAULT;
    -
    -/// Integrity check type
    -static lzma_check check;
    -
    -/// This becomes false if the --check=CHECK option is used.
    -static bool check_default = true;
    -
    -#ifdef MYTHREAD_ENABLED
    -static lzma_mt mt_options = {
    -	.flags = 0,
    -	.timeout = 300,
    -	.filters = filters,
    -};
    -#endif
    -
    -
    -extern void
    -coder_set_check(lzma_check new_check)
    -{
    -	check = new_check;
    -	check_default = false;
    -	return;
    -}
    -
    -
    -static void
    -forget_filter_chain(void)
    -{
    -	// Setting a preset makes us forget a possibly defined custom
    -	// filter chain.
    -	while (filters_count > 0) {
    -		--filters_count;
    -		free(filters[filters_count].options);
    -		filters[filters_count].options = NULL;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -coder_set_preset(uint32_t new_preset)
    -{
    -	preset_number &= ~LZMA_PRESET_LEVEL_MASK;
    -	preset_number |= new_preset;
    -	forget_filter_chain();
    -	return;
    -}
    -
    -
    -extern void
    -coder_set_extreme(void)
    -{
    -	preset_number |= LZMA_PRESET_EXTREME;
    -	forget_filter_chain();
    -	return;
    -}
    -
    -
    -extern void
    -coder_add_filter(lzma_vli id, void *options)
    -{
    -	if (filters_count == LZMA_FILTERS_MAX)
    -		message_fatal(_("Maximum number of filters is four"));
    -
    -	filters[filters_count].id = id;
    -	filters[filters_count].options = options;
    -	++filters_count;
    -
    -	// Setting a custom filter chain makes us forget the preset options.
    -	// This makes a difference if one specifies e.g. "xz -9 --lzma2 -e"
    -	// where the custom filter chain resets the preset level back to
    -	// the default 6, making the example equivalent to "xz -6e".
    -	preset_number = LZMA_PRESET_DEFAULT;
    -
    -	return;
    -}
    -
    -
    -static void lzma_attribute((__noreturn__))
    -memlimit_too_small(uint64_t memory_usage)
    -{
    -	message(V_ERROR, _("Memory usage limit is too low for the given "
    -			"filter setup."));
    -	message_mem_needed(V_ERROR, memory_usage);
    -	tuklib_exit(E_ERROR, E_ERROR, false);
    -}
    -
    -
    -extern void
    -coder_set_compression_settings(void)
    -{
    -	// The default check type is CRC64, but fallback to CRC32
    -	// if CRC64 isn't supported by the copy of liblzma we are
    -	// using. CRC32 is always supported.
    -	if (check_default) {
    -		check = LZMA_CHECK_CRC64;
    -		if (!lzma_check_is_supported(check))
    -			check = LZMA_CHECK_CRC32;
    -	}
    -
    -	// Options for LZMA1 or LZMA2 in case we are using a preset.
    -	static lzma_options_lzma opt_lzma;
    -
    -	if (filters_count == 0) {
    -		// We are using a preset. This is not a good idea in raw mode
    -		// except when playing around with things. Different versions
    -		// of this software may use different options in presets, and
    -		// thus make uncompressing the raw data difficult.
    -		if (opt_format == FORMAT_RAW) {
    -			// The message is shown only if warnings are allowed
    -			// but the exit status isn't changed.
    -			message(V_WARNING, _("Using a preset in raw mode "
    -					"is discouraged."));
    -			message(V_WARNING, _("The exact options of the "
    -					"presets may vary between software "
    -					"versions."));
    -		}
    -
    -		// Get the preset for LZMA1 or LZMA2.
    -		if (lzma_lzma_preset(&opt_lzma, preset_number))
    -			message_bug();
    -
    -		// Use LZMA2 except with --format=lzma we use LZMA1.
    -		filters[0].id = opt_format == FORMAT_LZMA
    -				? LZMA_FILTER_LZMA1 : LZMA_FILTER_LZMA2;
    -		filters[0].options = &opt_lzma;
    -		filters_count = 1;
    -	}
    -
    -	// Terminate the filter options array.
    -	filters[filters_count].id = LZMA_VLI_UNKNOWN;
    -
    -	// If we are using the .lzma format, allow exactly one filter
    -	// which has to be LZMA1.
    -	if (opt_format == FORMAT_LZMA && (filters_count != 1
    -			|| filters[0].id != LZMA_FILTER_LZMA1))
    -		message_fatal(_("The .lzma format supports only "
    -				"the LZMA1 filter"));
    -
    -	// If we are using the .xz format, make sure that there is no LZMA1
    -	// filter to prevent LZMA_PROG_ERROR.
    -	if (opt_format == FORMAT_XZ)
    -		for (size_t i = 0; i < filters_count; ++i)
    -			if (filters[i].id == LZMA_FILTER_LZMA1)
    -				message_fatal(_("LZMA1 cannot be used "
    -						"with the .xz format"));
    -
    -	// Print the selected filter chain.
    -	message_filters_show(V_DEBUG, filters);
    -
    -	// The --flush-timeout option requires LZMA_SYNC_FLUSH support
    -	// from the filter chain. Currently threaded encoder doesn't support
    -	// LZMA_SYNC_FLUSH so single-threaded mode must be used.
    -	if (opt_mode == MODE_COMPRESS && opt_flush_timeout != 0) {
    -		for (size_t i = 0; i < filters_count; ++i) {
    -			switch (filters[i].id) {
    -			case LZMA_FILTER_LZMA2:
    -			case LZMA_FILTER_DELTA:
    -				break;
    -
    -			default:
    -				message_fatal(_("The filter chain is "
    -					"incompatible with --flush-timeout"));
    -			}
    -		}
    -
    -		if (hardware_threads_get() > 1) {
    -			message(V_WARNING, _("Switching to single-threaded "
    -					"mode due to --flush-timeout"));
    -			hardware_threads_set(1);
    -		}
    -	}
    -
    -	// Get the memory usage. Note that if --format=raw was used,
    -	// we can be decompressing.
    -	const uint64_t memory_limit = hardware_memlimit_get(opt_mode);
    -	uint64_t memory_usage;
    -	if (opt_mode == MODE_COMPRESS) {
    -#ifdef MYTHREAD_ENABLED
    -		if (opt_format == FORMAT_XZ && hardware_threads_get() > 1) {
    -			mt_options.threads = hardware_threads_get();
    -			mt_options.block_size = opt_block_size;
    -			mt_options.check = check;
    -			memory_usage = lzma_stream_encoder_mt_memusage(
    -					&mt_options);
    -			if (memory_usage != UINT64_MAX)
    -				message(V_DEBUG, _("Using up to %" PRIu32
    -						" threads."),
    -						mt_options.threads);
    -		} else
    -#endif
    -		{
    -			memory_usage = lzma_raw_encoder_memusage(filters);
    -		}
    -	} else {
    -		memory_usage = lzma_raw_decoder_memusage(filters);
    -	}
    -
    -	if (memory_usage == UINT64_MAX)
    -		message_fatal(_("Unsupported filter chain or filter options"));
    -
    -	// Print memory usage info before possible dictionary
    -	// size auto-adjusting.
    -	message_mem_needed(V_DEBUG, memory_usage);
    -	if (opt_mode == MODE_COMPRESS) {
    -		const uint64_t decmem = lzma_raw_decoder_memusage(filters);
    -		if (decmem != UINT64_MAX)
    -			message(V_DEBUG, _("Decompression will need "
    -					"%s MiB of memory."), uint64_to_str(
    -						round_up_to_mib(decmem), 0));
    -	}
    -
    -	if (memory_usage <= memory_limit)
    -		return;
    -
    -	// If --no-adjust was used or we didn't find LZMA1 or
    -	// LZMA2 as the last filter, give an error immediately.
    -	// --format=raw implies --no-adjust.
    -	if (!opt_auto_adjust || opt_format == FORMAT_RAW)
    -		memlimit_too_small(memory_usage);
    -
    -	assert(opt_mode == MODE_COMPRESS);
    -
    -#ifdef MYTHREAD_ENABLED
    -	if (opt_format == FORMAT_XZ && mt_options.threads > 1) {
    -		// Try to reduce the number of threads before
    -		// adjusting the compression settings down.
    -		do {
    -			// FIXME? The real single-threaded mode has
    -			// lower memory usage, but it's not comparable
    -			// because it doesn't write the size info
    -			// into Block Headers.
    -			if (--mt_options.threads == 0)
    -				memlimit_too_small(memory_usage);
    -
    -			memory_usage = lzma_stream_encoder_mt_memusage(
    -					&mt_options);
    -			if (memory_usage == UINT64_MAX)
    -				message_bug();
    -
    -		} while (memory_usage > memory_limit);
    -
    -		message(V_WARNING, _("Adjusted the number of threads "
    -			"from %s to %s to not exceed "
    -			"the memory usage limit of %s MiB"),
    -			uint64_to_str(hardware_threads_get(), 0),
    -			uint64_to_str(mt_options.threads, 1),
    -			uint64_to_str(round_up_to_mib(
    -				memory_limit), 2));
    -	}
    -#endif
    -
    -	if (memory_usage <= memory_limit)
    -		return;
    -
    -	// Look for the last filter if it is LZMA2 or LZMA1, so we can make
    -	// it use less RAM. With other filters we don't know what to do.
    -	size_t i = 0;
    -	while (filters[i].id != LZMA_FILTER_LZMA2
    -			&& filters[i].id != LZMA_FILTER_LZMA1) {
    -		if (filters[i].id == LZMA_VLI_UNKNOWN)
    -			memlimit_too_small(memory_usage);
    -
    -		++i;
    -	}
    -
    -	// Decrease the dictionary size until we meet the memory
    -	// usage limit. First round down to full mebibytes.
    -	lzma_options_lzma *opt = filters[i].options;
    -	const uint32_t orig_dict_size = opt->dict_size;
    -	opt->dict_size &= ~((UINT32_C(1) << 20) - 1);
    -	while (true) {
    -		// If it is below 1 MiB, auto-adjusting failed. We could be
    -		// more sophisticated and scale it down even more, but let's
    -		// see if many complain about this version.
    -		//
    -		// FIXME: Displays the scaled memory usage instead
    -		// of the original.
    -		if (opt->dict_size < (UINT32_C(1) << 20))
    -			memlimit_too_small(memory_usage);
    -
    -		memory_usage = lzma_raw_encoder_memusage(filters);
    -		if (memory_usage == UINT64_MAX)
    -			message_bug();
    -
    -		// Accept it if it is low enough.
    -		if (memory_usage <= memory_limit)
    -			break;
    -
    -		// Otherwise 1 MiB down and try again. I hope this
    -		// isn't too slow method for cases where the original
    -		// dict_size is very big.
    -		opt->dict_size -= UINT32_C(1) << 20;
    -	}
    -
    -	// Tell the user that we decreased the dictionary size.
    -	message(V_WARNING, _("Adjusted LZMA%c dictionary size "
    -			"from %s MiB to %s MiB to not exceed "
    -			"the memory usage limit of %s MiB"),
    -			filters[i].id == LZMA_FILTER_LZMA2
    -				? '2' : '1',
    -			uint64_to_str(orig_dict_size >> 20, 0),
    -			uint64_to_str(opt->dict_size >> 20, 1),
    -			uint64_to_str(round_up_to_mib(memory_limit), 2));
    -
    -	return;
    -}
    -
    -
    -/// Return true if the data in in_buf seems to be in the .xz format.
    -static bool
    -is_format_xz(void)
    -{
    -	// Specify the magic as hex to be compatible with EBCDIC systems.
    -	static const uint8_t magic[6] = { 0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00 };
    -	return strm.avail_in >= sizeof(magic)
    -			&& memcmp(in_buf.u8, magic, sizeof(magic)) == 0;
    -}
    -
    -
    -/// Return true if the data in in_buf seems to be in the .lzma format.
    -static bool
    -is_format_lzma(void)
    -{
    -	// The .lzma header is 13 bytes.
    -	if (strm.avail_in < 13)
    -		return false;
    -
    -	// Decode the LZMA1 properties.
    -	lzma_filter filter = { .id = LZMA_FILTER_LZMA1 };
    -	if (lzma_properties_decode(&filter, NULL, in_buf.u8, 5) != LZMA_OK)
    -		return false;
    -
    -	// A hack to ditch tons of false positives: We allow only dictionary
    -	// sizes that are 2^n or 2^n + 2^(n-1) or UINT32_MAX. LZMA_Alone
    -	// created only files with 2^n, but accepts any dictionary size.
    -	// If someone complains, this will be reconsidered.
    -	lzma_options_lzma *opt = filter.options;
    -	const uint32_t dict_size = opt->dict_size;
    -	free(opt);
    -
    -	if (dict_size != UINT32_MAX) {
    -		uint32_t d = dict_size - 1;
    -		d |= d >> 2;
    -		d |= d >> 3;
    -		d |= d >> 4;
    -		d |= d >> 8;
    -		d |= d >> 16;
    -		++d;
    -		if (d != dict_size || dict_size == 0)
    -			return false;
    -	}
    -
    -	// Another hack to ditch false positives: Assume that if the
    -	// uncompressed size is known, it must be less than 256 GiB.
    -	// Again, if someone complains, this will be reconsidered.
    -	uint64_t uncompressed_size = 0;
    -	for (size_t i = 0; i < 8; ++i)
    -		uncompressed_size |= (uint64_t)(in_buf.u8[5 + i]) << (i * 8);
    -
    -	if (uncompressed_size != UINT64_MAX
    -			&& uncompressed_size > (UINT64_C(1) << 38))
    -		return false;
    -
    -	return true;
    -}
    -
    -
    -/// Detect the input file type (for now, this done only when decompressing),
    -/// and initialize an appropriate coder. Return value indicates if a normal
    -/// liblzma-based coder was initialized (CODER_INIT_NORMAL), if passthru
    -/// mode should be used (CODER_INIT_PASSTHRU), or if an error occurred
    -/// (CODER_INIT_ERROR).
    -static enum coder_init_ret
    -coder_init(file_pair *pair)
    -{
    -	lzma_ret ret = LZMA_PROG_ERROR;
    -
    -	if (opt_mode == MODE_COMPRESS) {
    -		switch (opt_format) {
    -		case FORMAT_AUTO:
    -			// args.c ensures this.
    -			assert(0);
    -			break;
    -
    -		case FORMAT_XZ:
    -#ifdef MYTHREAD_ENABLED
    -			if (hardware_threads_get() > 1)
    -				ret = lzma_stream_encoder_mt(
    -						&strm, &mt_options);
    -			else
    -#endif
    -				ret = lzma_stream_encoder(
    -						&strm, filters, check);
    -			break;
    -
    -		case FORMAT_LZMA:
    -			ret = lzma_alone_encoder(&strm, filters[0].options);
    -			break;
    -
    -		case FORMAT_RAW:
    -			ret = lzma_raw_encoder(&strm, filters);
    -			break;
    -		}
    -	} else {
    -		uint32_t flags = 0;
    -
    -		// It seems silly to warn about unsupported check if the
    -		// check won't be verified anyway due to --ignore-check.
    -		if (opt_ignore_check)
    -			flags |= LZMA_IGNORE_CHECK;
    -		else
    -			flags |= LZMA_TELL_UNSUPPORTED_CHECK;
    -
    -		if (!opt_single_stream)
    -			flags |= LZMA_CONCATENATED;
    -
    -		// We abuse FORMAT_AUTO to indicate unknown file format,
    -		// for which we may consider passthru mode.
    -		enum format_type init_format = FORMAT_AUTO;
    -
    -		switch (opt_format) {
    -		case FORMAT_AUTO:
    -			if (is_format_xz())
    -				init_format = FORMAT_XZ;
    -			else if (is_format_lzma())
    -				init_format = FORMAT_LZMA;
    -			break;
    -
    -		case FORMAT_XZ:
    -			if (is_format_xz())
    -				init_format = FORMAT_XZ;
    -			break;
    -
    -		case FORMAT_LZMA:
    -			if (is_format_lzma())
    -				init_format = FORMAT_LZMA;
    -			break;
    -
    -		case FORMAT_RAW:
    -			init_format = FORMAT_RAW;
    -			break;
    -		}
    -
    -		switch (init_format) {
    -		case FORMAT_AUTO:
    -			// Unknown file format. If --decompress --stdout
    -			// --force have been given, then we copy the input
    -			// as is to stdout. Checking for MODE_DECOMPRESS
    -			// is needed, because we don't want to do use
    -			// passthru mode with --test.
    -			if (opt_mode == MODE_DECOMPRESS
    -					&& opt_stdout && opt_force)
    -				return CODER_INIT_PASSTHRU;
    -
    -			ret = LZMA_FORMAT_ERROR;
    -			break;
    -
    -		case FORMAT_XZ:
    -			ret = lzma_stream_decoder(&strm,
    -					hardware_memlimit_get(
    -						MODE_DECOMPRESS), flags);
    -			break;
    -
    -		case FORMAT_LZMA:
    -			ret = lzma_alone_decoder(&strm,
    -					hardware_memlimit_get(
    -						MODE_DECOMPRESS));
    -			break;
    -
    -		case FORMAT_RAW:
    -			// Memory usage has already been checked in
    -			// coder_set_compression_settings().
    -			ret = lzma_raw_decoder(&strm, filters);
    -			break;
    -		}
    -
    -		// Try to decode the headers. This will catch too low
    -		// memory usage limit in case it happens in the first
    -		// Block of the first Stream, which is where it very
    -		// probably will happen if it is going to happen.
    -		if (ret == LZMA_OK && init_format != FORMAT_RAW) {
    -			strm.next_out = NULL;
    -			strm.avail_out = 0;
    -			ret = lzma_code(&strm, LZMA_RUN);
    -		}
    -	}
    -
    -	if (ret != LZMA_OK) {
    -		message_error("%s: %s", pair->src_name, message_strm(ret));
    -		if (ret == LZMA_MEMLIMIT_ERROR)
    -			message_mem_needed(V_ERROR, lzma_memusage(&strm));
    -
    -		return CODER_INIT_ERROR;
    -	}
    -
    -	return CODER_INIT_NORMAL;
    -}
    -
    -
    -/// Resolve conflicts between opt_block_size and opt_block_list in single
    -/// threaded mode. We want to default to opt_block_list, except when it is
    -/// larger than opt_block_size. If this is the case for the current Block
    -/// at *list_pos, then we break into smaller Blocks. Otherwise advance
    -/// to the next Block in opt_block_list, and break apart if needed.
    -static void
    -split_block(uint64_t *block_remaining,
    -	    uint64_t *next_block_remaining,
    -	    size_t *list_pos)
    -{
    -	if (*next_block_remaining > 0) {
    -		// The Block at *list_pos has previously been split up.
    -		assert(hardware_threads_get() == 1);
    -		assert(opt_block_size > 0);
    -		assert(opt_block_list != NULL);
    -
    -		if (*next_block_remaining > opt_block_size) {
    -			// We have to split the current Block at *list_pos
    -			// into another opt_block_size length Block.
    -			*block_remaining = opt_block_size;
    -		} else {
    -			// This is the last remaining split Block for the
    -			// Block at *list_pos.
    -			*block_remaining = *next_block_remaining;
    -		}
    -
    -		*next_block_remaining -= *block_remaining;
    -
    -	} else {
    -		// The Block at *list_pos has been finished. Go to the next
    -		// entry in the list. If the end of the list has been reached,
    -		// reuse the size of the last Block.
    -		if (opt_block_list[*list_pos + 1] != 0)
    -			++*list_pos;
    -
    -		*block_remaining = opt_block_list[*list_pos];
    -
    -		// If in single-threaded mode, split up the Block if needed.
    -		// This is not needed in multi-threaded mode because liblzma
    -		// will do this due to how threaded encoding works.
    -		if (hardware_threads_get() == 1 && opt_block_size > 0
    -				&& *block_remaining > opt_block_size) {
    -			*next_block_remaining
    -					= *block_remaining - opt_block_size;
    -			*block_remaining = opt_block_size;
    -		}
    -	}
    -}
    -
    -
    -/// Compress or decompress using liblzma.
    -static bool
    -coder_normal(file_pair *pair)
    -{
    -	// Encoder needs to know when we have given all the input to it.
    -	// The decoders need to know it too when we are using
    -	// LZMA_CONCATENATED. We need to check for src_eof here, because
    -	// the first input chunk has been already read if decompressing,
    -	// and that may have been the only chunk we will read.
    -	lzma_action action = pair->src_eof ? LZMA_FINISH : LZMA_RUN;
    -
    -	lzma_ret ret;
    -
    -	// Assume that something goes wrong.
    -	bool success = false;
    -
    -	// block_remaining indicates how many input bytes to encode before
    -	// finishing the current .xz Block. The Block size is set with
    -	// --block-size=SIZE and --block-list. They have an effect only when
    -	// compressing to the .xz format. If block_remaining == UINT64_MAX,
    -	// only a single block is created.
    -	uint64_t block_remaining = UINT64_MAX;
    -
    -	// next_block_remining for when we are in single-threaded mode and
    -	// the Block in --block-list is larger than the --block-size=SIZE.
    -	uint64_t next_block_remaining = 0;
    -
    -	// Position in opt_block_list. Unused if --block-list wasn't used.
    -	size_t list_pos = 0;
    -
    -	// Handle --block-size for single-threaded mode and the first step
    -	// of --block-list.
    -	if (opt_mode == MODE_COMPRESS && opt_format == FORMAT_XZ) {
    -		// --block-size doesn't do anything here in threaded mode,
    -		// because the threaded encoder will take care of splitting
    -		// to fixed-sized Blocks.
    -		if (hardware_threads_get() == 1 && opt_block_size > 0)
    -			block_remaining = opt_block_size;
    -
    -		// If --block-list was used, start with the first size.
    -		//
    -		// For threaded case, --block-size specifies how big Blocks
    -		// the encoder needs to be prepared to create at maximum
    -		// and --block-list will simultaneously cause new Blocks
    -		// to be started at specified intervals. To keep things
    -		// logical, the same is done in single-threaded mode. The
    -		// output is still not identical because in single-threaded
    -		// mode the size info isn't written into Block Headers.
    -		if (opt_block_list != NULL) {
    -			if (block_remaining < opt_block_list[list_pos]) {
    -				assert(hardware_threads_get() == 1);
    -				next_block_remaining = opt_block_list[list_pos]
    -						- block_remaining;
    -			} else {
    -				block_remaining = opt_block_list[list_pos];
    -			}
    -		}
    -	}
    -
    -	strm.next_out = out_buf.u8;
    -	strm.avail_out = IO_BUFFER_SIZE;
    -
    -	while (!user_abort) {
    -		// Fill the input buffer if it is empty and we aren't
    -		// flushing or finishing.
    -		if (strm.avail_in == 0 && action == LZMA_RUN) {
    -			strm.next_in = in_buf.u8;
    -			strm.avail_in = io_read(pair, &in_buf,
    -					my_min(block_remaining,
    -						IO_BUFFER_SIZE));
    -
    -			if (strm.avail_in == SIZE_MAX)
    -				break;
    -
    -			if (pair->src_eof) {
    -				action = LZMA_FINISH;
    -
    -			} else if (block_remaining != UINT64_MAX) {
    -				// Start a new Block after every
    -				// opt_block_size bytes of input.
    -				block_remaining -= strm.avail_in;
    -				if (block_remaining == 0)
    -					action = LZMA_FULL_BARRIER;
    -			}
    -
    -			if (action == LZMA_RUN && flush_needed)
    -				action = LZMA_SYNC_FLUSH;
    -		}
    -
    -		// Let liblzma do the actual work.
    -		ret = lzma_code(&strm, action);
    -
    -		// Write out if the output buffer became full.
    -		if (strm.avail_out == 0) {
    -			if (opt_mode != MODE_TEST && io_write(pair, &out_buf,
    -					IO_BUFFER_SIZE - strm.avail_out))
    -				break;
    -
    -			strm.next_out = out_buf.u8;
    -			strm.avail_out = IO_BUFFER_SIZE;
    -		}
    -
    -		if (ret == LZMA_STREAM_END && (action == LZMA_SYNC_FLUSH
    -				|| action == LZMA_FULL_BARRIER)) {
    -			if (action == LZMA_SYNC_FLUSH) {
    -				// Flushing completed. Write the pending data
    -				// out immediatelly so that the reading side
    -				// can decompress everything compressed so far.
    -				if (io_write(pair, &out_buf, IO_BUFFER_SIZE
    -						- strm.avail_out))
    -					break;
    -
    -				strm.next_out = out_buf.u8;
    -				strm.avail_out = IO_BUFFER_SIZE;
    -
    -				// Set the time of the most recent flushing.
    -				mytime_set_flush_time();
    -			} else {
    -				// Start a new Block after LZMA_FULL_BARRIER.
    -				if (opt_block_list == NULL) {
    -					assert(hardware_threads_get() == 1);
    -					assert(opt_block_size > 0);
    -					block_remaining = opt_block_size;
    -				} else {
    -					split_block(&block_remaining,
    -							&next_block_remaining,
    -							&list_pos);
    -				}
    -			}
    -
    -			// Start a new Block after LZMA_FULL_FLUSH or continue
    -			// the same block after LZMA_SYNC_FLUSH.
    -			action = LZMA_RUN;
    -
    -		} else if (ret != LZMA_OK) {
    -			// Determine if the return value indicates that we
    -			// won't continue coding.
    -			const bool stop = ret != LZMA_NO_CHECK
    -					&& ret != LZMA_UNSUPPORTED_CHECK;
    -
    -			if (stop) {
    -				// Write the remaining bytes even if something
    -				// went wrong, because that way the user gets
    -				// as much data as possible, which can be good
    -				// when trying to get at least some useful
    -				// data out of damaged files.
    -				if (opt_mode != MODE_TEST && io_write(pair,
    -						&out_buf, IO_BUFFER_SIZE
    -							- strm.avail_out))
    -					break;
    -			}
    -
    -			if (ret == LZMA_STREAM_END) {
    -				if (opt_single_stream) {
    -					io_fix_src_pos(pair, strm.avail_in);
    -					success = true;
    -					break;
    -				}
    -
    -				// Check that there is no trailing garbage.
    -				// This is needed for LZMA_Alone and raw
    -				// streams.
    -				if (strm.avail_in == 0 && !pair->src_eof) {
    -					// Try reading one more byte.
    -					// Hopefully we don't get any more
    -					// input, and thus pair->src_eof
    -					// becomes true.
    -					strm.avail_in = io_read(
    -							pair, &in_buf, 1);
    -					if (strm.avail_in == SIZE_MAX)
    -						break;
    -
    -					assert(strm.avail_in == 0
    -							|| strm.avail_in == 1);
    -				}
    -
    -				if (strm.avail_in == 0) {
    -					assert(pair->src_eof);
    -					success = true;
    -					break;
    -				}
    -
    -				// We hadn't reached the end of the file.
    -				ret = LZMA_DATA_ERROR;
    -				assert(stop);
    -			}
    -
    -			// If we get here and stop is true, something went
    -			// wrong and we print an error. Otherwise it's just
    -			// a warning and coding can continue.
    -			if (stop) {
    -				message_error("%s: %s", pair->src_name,
    -						message_strm(ret));
    -			} else {
    -				message_warning("%s: %s", pair->src_name,
    -						message_strm(ret));
    -
    -				// When compressing, all possible errors set
    -				// stop to true.
    -				assert(opt_mode != MODE_COMPRESS);
    -			}
    -
    -			if (ret == LZMA_MEMLIMIT_ERROR) {
    -				// Display how much memory it would have
    -				// actually needed.
    -				message_mem_needed(V_ERROR,
    -						lzma_memusage(&strm));
    -			}
    -
    -			if (stop)
    -				break;
    -		}
    -
    -		// Show progress information under certain conditions.
    -		message_progress_update();
    -	}
    -
    -	return success;
    -}
    -
    -
    -/// Copy from input file to output file without processing the data in any
    -/// way. This is used only when trying to decompress unrecognized files
    -/// with --decompress --stdout --force, so the output is always stdout.
    -static bool
    -coder_passthru(file_pair *pair)
    -{
    -	while (strm.avail_in != 0) {
    -		if (user_abort)
    -			return false;
    -
    -		if (io_write(pair, &in_buf, strm.avail_in))
    -			return false;
    -
    -		strm.total_in += strm.avail_in;
    -		strm.total_out = strm.total_in;
    -		message_progress_update();
    -
    -		strm.avail_in = io_read(pair, &in_buf, IO_BUFFER_SIZE);
    -		if (strm.avail_in == SIZE_MAX)
    -			return false;
    -	}
    -
    -	return true;
    -}
    -
    -
    -extern void
    -coder_run(const char *filename)
    -{
    -	// Set and possibly print the filename for the progress message.
    -	message_filename(filename);
    -
    -	// Try to open the input file.
    -	file_pair *pair = io_open_src(filename);
    -	if (pair == NULL)
    -		return;
    -
    -	// Assume that something goes wrong.
    -	bool success = false;
    -
    -	if (opt_mode == MODE_COMPRESS) {
    -		strm.next_in = NULL;
    -		strm.avail_in = 0;
    -	} else {
    -		// Read the first chunk of input data. This is needed
    -		// to detect the input file type.
    -		strm.next_in = in_buf.u8;
    -		strm.avail_in = io_read(pair, &in_buf, IO_BUFFER_SIZE);
    -	}
    -
    -	if (strm.avail_in != SIZE_MAX) {
    -		// Initialize the coder. This will detect the file format
    -		// and, in decompression or testing mode, check the memory
    -		// usage of the first Block too. This way we don't try to
    -		// open the destination file if we see that coding wouldn't
    -		// work at all anyway. This also avoids deleting the old
    -		// "target" file if --force was used.
    -		const enum coder_init_ret init_ret = coder_init(pair);
    -
    -		if (init_ret != CODER_INIT_ERROR && !user_abort) {
    -			// Don't open the destination file when --test
    -			// is used.
    -			if (opt_mode == MODE_TEST || !io_open_dest(pair)) {
    -				// Remember the current time. It is needed
    -				// for progress indicator and for timed
    -				// flushing.
    -				mytime_set_start_time();
    -
    -				// Initialize the progress indicator.
    -				const uint64_t in_size
    -						= pair->src_st.st_size <= 0
    -						? 0 : pair->src_st.st_size;
    -				message_progress_start(&strm, in_size);
    -
    -				// Do the actual coding or passthru.
    -				if (init_ret == CODER_INIT_NORMAL)
    -					success = coder_normal(pair);
    -				else
    -					success = coder_passthru(pair);
    -
    -				message_progress_end(success);
    -			}
    -		}
    -	}
    -
    -	// Close the file pair. It needs to know if coding was successful to
    -	// know if the source or target file should be unlinked.
    -	io_close(pair, success);
    -
    -	return;
    -}
    -
    -
    -#ifndef NDEBUG
    -extern void
    -coder_free(void)
    -{
    -	lzma_end(&strm);
    -	return;
    -}
    -#endif
    diff --git a/external/public-domain/xz/dist/src/xz/coder.h b/external/public-domain/xz/dist/src/xz/coder.h
    deleted file mode 100644
    index 583da8f68..000000000
    --- a/external/public-domain/xz/dist/src/xz/coder.h
    +++ /dev/null
    @@ -1,76 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       coder.h
    -/// \brief      Compresses or uncompresses a file
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -enum operation_mode {
    -	MODE_COMPRESS,
    -	MODE_DECOMPRESS,
    -	MODE_TEST,
    -	MODE_LIST,
    -};
    -
    -
    -// NOTE: The order of these is significant in suffix.c.
    -enum format_type {
    -	FORMAT_AUTO,
    -	FORMAT_XZ,
    -	FORMAT_LZMA,
    -	// HEADER_GZIP,
    -	FORMAT_RAW,
    -};
    -
    -
    -/// Operation mode of the command line tool. This is set in args.c and read
    -/// in several files.
    -extern enum operation_mode opt_mode;
    -
    -/// File format to use when encoding or what format(s) to accept when
    -/// decoding. This is a global because it's needed also in suffix.c.
    -/// This is set in args.c.
    -extern enum format_type opt_format;
    -
    -/// If true, the compression settings are automatically adjusted down if
    -/// they exceed the memory usage limit.
    -extern bool opt_auto_adjust;
    -
    -/// If true, stop after decoding the first stream.
    -extern bool opt_single_stream;
    -
    -/// If non-zero, start a new .xz Block after every opt_block_size bytes
    -/// of input. This has an effect only when compressing to the .xz format.
    -extern uint64_t opt_block_size;
    -
    -/// This is non-NULL if --block-list was used. This contains the Block sizes
    -/// as an array that is terminated with 0.
    -extern uint64_t *opt_block_list;
    -
    -/// Set the integrity check type used when compressing
    -extern void coder_set_check(lzma_check check);
    -
    -/// Set preset number
    -extern void coder_set_preset(uint32_t new_preset);
    -
    -/// Enable extreme mode
    -extern void coder_set_extreme(void);
    -
    -/// Add a filter to the custom filter chain
    -extern void coder_add_filter(lzma_vli id, void *options);
    -
    -///
    -extern void coder_set_compression_settings(void);
    -
    -/// Compress or decompress the given file
    -extern void coder_run(const char *filename);
    -
    -#ifndef NDEBUG
    -/// Free the memory allocated for the coder and kill the worker threads.
    -extern void coder_free(void);
    -#endif
    diff --git a/external/public-domain/xz/dist/src/xz/file_io.c b/external/public-domain/xz/dist/src/xz/file_io.c
    deleted file mode 100644
    index 20f512a25..000000000
    --- a/external/public-domain/xz/dist/src/xz/file_io.c
    +++ /dev/null
    @@ -1,1191 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       file_io.c
    -/// \brief      File opening, unlinking, and closing
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -#include 
    -
    -#ifdef TUKLIB_DOSLIKE
    -#	include 
    -#else
    -#	include 
    -static bool warn_fchown;
    -#endif
    -
    -#if defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMES)
    -#	include 
    -#elif defined(HAVE_UTIME)
    -#	include 
    -#endif
    -
    -#include "tuklib_open_stdxxx.h"
    -
    -#ifndef O_BINARY
    -#	define O_BINARY 0
    -#endif
    -
    -#ifndef O_NOCTTY
    -#	define O_NOCTTY 0
    -#endif
    -
    -
    -typedef enum {
    -	IO_WAIT_MORE,    // Reading or writing is possible.
    -	IO_WAIT_ERROR,   // Error or user_abort
    -	IO_WAIT_TIMEOUT, // poll() timed out
    -} io_wait_ret;
    -
    -
    -/// If true, try to create sparse files when decompressing.
    -static bool try_sparse = true;
    -
    -#ifndef TUKLIB_DOSLIKE
    -/// File status flags of standard input. This is used by io_open_src()
    -/// and io_close_src().
    -static int stdin_flags;
    -static bool restore_stdin_flags = false;
    -
    -/// Original file status flags of standard output. This is used by
    -/// io_open_dest() and io_close_dest() to save and restore the flags.
    -static int stdout_flags;
    -static bool restore_stdout_flags = false;
    -
    -/// Self-pipe used together with the user_abort variable to avoid
    -/// race conditions with signal handling.
    -static int user_abort_pipe[2];
    -#endif
    -
    -
    -static bool io_write_buf(file_pair *pair, const uint8_t *buf, size_t size);
    -
    -
    -extern void
    -io_init(void)
    -{
    -	// Make sure that stdin, stdout, and stderr are connected to
    -	// a valid file descriptor. Exit immediately with exit code ERROR
    -	// if we cannot make the file descriptors valid. Maybe we should
    -	// print an error message, but our stderr could be screwed anyway.
    -	tuklib_open_stdxxx(E_ERROR);
    -
    -#ifndef TUKLIB_DOSLIKE
    -	// If fchown() fails setting the owner, we warn about it only if
    -	// we are root.
    -	warn_fchown = geteuid() == 0;
    -
    -	// Create a pipe for the self-pipe trick. If pipe2() is available,
    -	// we can avoid the fcntl() calls.
    -#	ifdef HAVE_PIPE2
    -	if (pipe2(user_abort_pipe, O_NONBLOCK))
    -		message_fatal(_("Error creating a pipe: %s"),
    -				strerror(errno));
    -#	else
    -	if (pipe(user_abort_pipe))
    -		message_fatal(_("Error creating a pipe: %s"),
    -				strerror(errno));
    -
    -	// Make both ends of the pipe non-blocking.
    -	for (unsigned i = 0; i < 2; ++i) {
    -		int flags = fcntl(user_abort_pipe[i], F_GETFL);
    -		if (flags == -1 || fcntl(user_abort_pipe[i], F_SETFL,
    -				flags | O_NONBLOCK) == -1)
    -			message_fatal(_("Error creating a pipe: %s"),
    -					strerror(errno));
    -	}
    -#	endif
    -#endif
    -
    -#ifdef __DJGPP__
    -	// Avoid doing useless things when statting files.
    -	// This isn't important but doesn't hurt.
    -	_djstat_flags = _STAT_EXEC_EXT | _STAT_EXEC_MAGIC | _STAT_DIRSIZE;
    -#endif
    -
    -	return;
    -}
    -
    -
    -#ifndef TUKLIB_DOSLIKE
    -extern void
    -io_write_to_user_abort_pipe(void)
    -{
    -	// If the write() fails, it's probably due to the pipe being full.
    -	// Failing in that case is fine. If the reason is something else,
    -	// there's not much we can do since this is called in a signal
    -	// handler. So ignore the errors and try to avoid warnings with
    -	// GCC and glibc when _FORTIFY_SOURCE=2 is used.
    -	uint8_t b = '\0';
    -	const int ret = write(user_abort_pipe[1], &b, 1);
    -	(void)ret;
    -	return;
    -}
    -#endif
    -
    -
    -extern void
    -io_no_sparse(void)
    -{
    -	try_sparse = false;
    -	return;
    -}
    -
    -
    -#ifndef TUKLIB_DOSLIKE
    -/// \brief      Waits for input or output to become available or for a signal
    -///
    -/// This uses the self-pipe trick to avoid a race condition that can occur
    -/// if a signal is caught after user_abort has been checked but before e.g.
    -/// read() has been called. In that situation read() could block unless
    -/// non-blocking I/O is used. With non-blocking I/O something like select()
    -/// or poll() is needed to avoid a busy-wait loop, and the same race condition
    -/// pops up again. There are pselect() (POSIX-1.2001) and ppoll() (not in
    -/// POSIX) but neither is portable enough in 2013. The self-pipe trick is
    -/// old and very portable.
    -static io_wait_ret
    -io_wait(file_pair *pair, int timeout, bool is_reading)
    -{
    -	struct pollfd pfd[2];
    -
    -	if (is_reading) {
    -		pfd[0].fd = pair->src_fd;
    -		pfd[0].events = POLLIN;
    -	} else {
    -		pfd[0].fd = pair->dest_fd;
    -		pfd[0].events = POLLOUT;
    -	}
    -
    -	pfd[1].fd = user_abort_pipe[0];
    -	pfd[1].events = POLLIN;
    -
    -	while (true) {
    -		const int ret = poll(pfd, 2, timeout);
    -
    -		if (user_abort)
    -			return IO_WAIT_ERROR;
    -
    -		if (ret == -1) {
    -			if (errno == EINTR || errno == EAGAIN)
    -				continue;
    -
    -			message_error(_("%s: poll() failed: %s"),
    -					is_reading ? pair->src_name
    -						: pair->dest_name,
    -					strerror(errno));
    -			return IO_WAIT_ERROR;
    -		}
    -
    -		if (ret == 0) {
    -			assert(opt_flush_timeout != 0);
    -			flush_needed = true;
    -			return IO_WAIT_TIMEOUT;
    -		}
    -
    -		if (pfd[0].revents != 0)
    -			return IO_WAIT_MORE;
    -	}
    -}
    -#endif
    -
    -
    -/// \brief      Unlink a file
    -///
    -/// This tries to verify that the file being unlinked really is the file that
    -/// we want to unlink by verifying device and inode numbers. There's still
    -/// a small unavoidable race, but this is much better than nothing (the file
    -/// could have been moved/replaced even hours earlier).
    -static void
    -io_unlink(const char *name, const struct stat *known_st)
    -{
    -#if defined(TUKLIB_DOSLIKE)
    -	// On DOS-like systems, st_ino is meaningless, so don't bother
    -	// testing it. Just silence a compiler warning.
    -	(void)known_st;
    -#else
    -	struct stat new_st;
    -
    -	// If --force was used, use stat() instead of lstat(). This way
    -	// (de)compressing symlinks works correctly. However, it also means
    -	// that xz cannot detect if a regular file foo is renamed to bar
    -	// and then a symlink foo -> bar is created. Because of stat()
    -	// instead of lstat(), xz will think that foo hasn't been replaced
    -	// with another file. Thus, xz will remove foo even though it no
    -	// longer is the same file that xz used when it started compressing.
    -	// Probably it's not too bad though, so this doesn't need a more
    -	// complex fix.
    -	const int stat_ret = opt_force
    -			? stat(name, &new_st) : lstat(name, &new_st);
    -
    -	if (stat_ret
    -#	ifdef __VMS
    -			// st_ino is an array, and we don't want to
    -			// compare st_dev at all.
    -			|| memcmp(&new_st.st_ino, &known_st->st_ino,
    -				sizeof(new_st.st_ino)) != 0
    -#	else
    -			// Typical POSIX-like system
    -			|| new_st.st_dev != known_st->st_dev
    -			|| new_st.st_ino != known_st->st_ino
    -#	endif
    -			)
    -		// TRANSLATORS: When compression or decompression finishes,
    -		// and xz is going to remove the source file, xz first checks
    -		// if the source file still exists, and if it does, does its
    -		// device and inode numbers match what xz saw when it opened
    -		// the source file. If these checks fail, this message is
    -		// shown, %s being the filename, and the file is not deleted.
    -		// The check for device and inode numbers is there, because
    -		// it is possible that the user has put a new file in place
    -		// of the original file, and in that case it obviously
    -		// shouldn't be removed.
    -		message_error(_("%s: File seems to have been moved, "
    -				"not removing"), name);
    -	else
    -#endif
    -		// There's a race condition between lstat() and unlink()
    -		// but at least we have tried to avoid removing wrong file.
    -		if (unlink(name))
    -			message_error(_("%s: Cannot remove: %s"),
    -					name, strerror(errno));
    -
    -	return;
    -}
    -
    -
    -/// \brief      Copies owner/group and permissions
    -///
    -/// \todo       ACL and EA support
    -///
    -static void
    -io_copy_attrs(const file_pair *pair)
    -{
    -	// Skip chown and chmod on Windows.
    -#ifndef TUKLIB_DOSLIKE
    -	// This function is more tricky than you may think at first.
    -	// Blindly copying permissions may permit users to access the
    -	// destination file who didn't have permission to access the
    -	// source file.
    -
    -	// Try changing the owner of the file. If we aren't root or the owner
    -	// isn't already us, fchown() probably doesn't succeed. We warn
    -	// about failing fchown() only if we are root.
    -	if (fchown(pair->dest_fd, pair->src_st.st_uid, -1) && warn_fchown)
    -		message_warning(_("%s: Cannot set the file owner: %s"),
    -				pair->dest_name, strerror(errno));
    -
    -	mode_t mode;
    -
    -	if (fchown(pair->dest_fd, -1, pair->src_st.st_gid)) {
    -		message_warning(_("%s: Cannot set the file group: %s"),
    -				pair->dest_name, strerror(errno));
    -		// We can still safely copy some additional permissions:
    -		// `group' must be at least as strict as `other' and
    -		// also vice versa.
    -		//
    -		// NOTE: After this, the owner of the source file may
    -		// get additional permissions. This shouldn't be too bad,
    -		// because the owner would have had permission to chmod
    -		// the original file anyway.
    -		mode = ((pair->src_st.st_mode & 0070) >> 3)
    -				& (pair->src_st.st_mode & 0007);
    -		mode = (pair->src_st.st_mode & 0700) | (mode << 3) | mode;
    -	} else {
    -		// Drop the setuid, setgid, and sticky bits.
    -		mode = pair->src_st.st_mode & 0777;
    -	}
    -
    -	if (fchmod(pair->dest_fd, mode))
    -		message_warning(_("%s: Cannot set the file permissions: %s"),
    -				pair->dest_name, strerror(errno));
    -#endif
    -
    -	// Copy the timestamps. We have several possible ways to do this, of
    -	// which some are better in both security and precision.
    -	//
    -	// First, get the nanosecond part of the timestamps. As of writing,
    -	// it's not standardized by POSIX, and there are several names for
    -	// the same thing in struct stat.
    -	long atime_nsec;
    -	long mtime_nsec;
    -
    -#	if defined(HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC)
    -	// GNU and Solaris
    -	atime_nsec = pair->src_st.st_atim.tv_nsec;
    -	mtime_nsec = pair->src_st.st_mtim.tv_nsec;
    -
    -#	elif defined(HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC)
    -	// BSD
    -	atime_nsec = pair->src_st.st_atimespec.tv_nsec;
    -	mtime_nsec = pair->src_st.st_mtimespec.tv_nsec;
    -
    -#	elif defined(HAVE_STRUCT_STAT_ST_ATIMENSEC)
    -	// GNU and BSD without extensions
    -	atime_nsec = pair->src_st.st_atimensec;
    -	mtime_nsec = pair->src_st.st_mtimensec;
    -
    -#	elif defined(HAVE_STRUCT_STAT_ST_UATIME)
    -	// Tru64
    -	atime_nsec = pair->src_st.st_uatime * 1000;
    -	mtime_nsec = pair->src_st.st_umtime * 1000;
    -
    -#	elif defined(HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC)
    -	// UnixWare
    -	atime_nsec = pair->src_st.st_atim.st__tim.tv_nsec;
    -	mtime_nsec = pair->src_st.st_mtim.st__tim.tv_nsec;
    -
    -#	else
    -	// Safe fallback
    -	atime_nsec = 0;
    -	mtime_nsec = 0;
    -#	endif
    -
    -	// Construct a structure to hold the timestamps and call appropriate
    -	// function to set the timestamps.
    -#if defined(HAVE_FUTIMENS)
    -	// Use nanosecond precision.
    -	struct timespec tv[2];
    -	tv[0].tv_sec = pair->src_st.st_atime;
    -	tv[0].tv_nsec = atime_nsec;
    -	tv[1].tv_sec = pair->src_st.st_mtime;
    -	tv[1].tv_nsec = mtime_nsec;
    -
    -	(void)futimens(pair->dest_fd, tv);
    -
    -#elif defined(HAVE_FUTIMES) || defined(HAVE_FUTIMESAT) || defined(HAVE_UTIMES)
    -	// Use microsecond precision.
    -	struct timeval tv[2];
    -	tv[0].tv_sec = pair->src_st.st_atime;
    -	tv[0].tv_usec = atime_nsec / 1000;
    -	tv[1].tv_sec = pair->src_st.st_mtime;
    -	tv[1].tv_usec = mtime_nsec / 1000;
    -
    -#	if defined(HAVE_FUTIMES)
    -	(void)futimes(pair->dest_fd, tv);
    -#	elif defined(HAVE_FUTIMESAT)
    -	(void)futimesat(pair->dest_fd, NULL, tv);
    -#	else
    -	// Argh, no function to use a file descriptor to set the timestamp.
    -	(void)utimes(pair->dest_name, tv);
    -#	endif
    -
    -#elif defined(HAVE_UTIME)
    -	// Use one-second precision. utime() doesn't support using file
    -	// descriptor either. Some systems have broken utime() prototype
    -	// so don't make this const.
    -	struct utimbuf buf = {
    -		.actime = pair->src_st.st_atime,
    -		.modtime = pair->src_st.st_mtime,
    -	};
    -
    -	// Avoid warnings.
    -	(void)atime_nsec;
    -	(void)mtime_nsec;
    -
    -	(void)utime(pair->dest_name, &buf);
    -#endif
    -
    -	return;
    -}
    -
    -
    -/// Opens the source file. Returns false on success, true on error.
    -static bool
    -io_open_src_real(file_pair *pair)
    -{
    -	// There's nothing to open when reading from stdin.
    -	if (pair->src_name == stdin_filename) {
    -		pair->src_fd = STDIN_FILENO;
    -#ifdef TUKLIB_DOSLIKE
    -		setmode(STDIN_FILENO, O_BINARY);
    -#else
    -		// Try to set stdin to non-blocking mode. It won't work
    -		// e.g. on OpenBSD if stdout is e.g. /dev/null. In such
    -		// case we proceed as if stdin were non-blocking anyway
    -		// (in case of /dev/null it will be in practice). The
    -		// same applies to stdout in io_open_dest_real().
    -		stdin_flags = fcntl(STDIN_FILENO, F_GETFL);
    -		if (stdin_flags == -1) {
    -			message_error(_("Error getting the file status flags "
    -					"from standard input: %s"),
    -					strerror(errno));
    -			return true;
    -		}
    -
    -		if ((stdin_flags & O_NONBLOCK) == 0
    -				&& fcntl(STDIN_FILENO, F_SETFL,
    -					stdin_flags | O_NONBLOCK) != -1)
    -			restore_stdin_flags = true;
    -#endif
    -#ifdef HAVE_POSIX_FADVISE
    -		// It will fail if stdin is a pipe and that's fine.
    -		(void)posix_fadvise(STDIN_FILENO, 0, 0, POSIX_FADV_SEQUENTIAL);
    -#endif
    -		return false;
    -	}
    -
    -	// Symlinks are not followed unless writing to stdout or --force
    -	// was used.
    -	const bool follow_symlinks = opt_stdout || opt_force;
    -
    -	// We accept only regular files if we are writing the output
    -	// to disk too. bzip2 allows overriding this with --force but
    -	// gzip and xz don't.
    -	const bool reg_files_only = !opt_stdout;
    -
    -	// Flags for open()
    -	int flags = O_RDONLY | O_BINARY | O_NOCTTY;
    -
    -#ifndef TUKLIB_DOSLIKE
    -	// Use non-blocking I/O:
    -	//   - It prevents blocking when opening FIFOs and some other
    -	//     special files, which is good if we want to accept only
    -	//     regular files.
    -	//   - It can help avoiding some race conditions with signal handling.
    -	flags |= O_NONBLOCK;
    -#endif
    -
    -#if defined(O_NOFOLLOW)
    -	if (!follow_symlinks)
    -		flags |= O_NOFOLLOW;
    -#elif !defined(TUKLIB_DOSLIKE)
    -	// Some POSIX-like systems lack O_NOFOLLOW (it's not required
    -	// by POSIX). Check for symlinks with a separate lstat() on
    -	// these systems.
    -	if (!follow_symlinks) {
    -		struct stat st;
    -		if (lstat(pair->src_name, &st)) {
    -			message_error("%s: %s", pair->src_name,
    -					strerror(errno));
    -			return true;
    -
    -		} else if (S_ISLNK(st.st_mode)) {
    -			message_warning(_("%s: Is a symbolic link, "
    -					"skipping"), pair->src_name);
    -			return true;
    -		}
    -	}
    -#else
    -	// Avoid warnings.
    -	(void)follow_symlinks;
    -#endif
    -
    -	// Try to open the file. Signals have been blocked so EINTR shouldn't
    -	// be possible.
    -	pair->src_fd = open(pair->src_name, flags);
    -
    -	if (pair->src_fd == -1) {
    -		// Signals (that have a signal handler) have been blocked.
    -		assert(errno != EINTR);
    -
    -#ifdef O_NOFOLLOW
    -		// Give an understandable error message if the reason
    -		// for failing was that the file was a symbolic link.
    -		//
    -		// Note that at least Linux, OpenBSD, Solaris, and Darwin
    -		// use ELOOP to indicate that O_NOFOLLOW was the reason
    -		// that open() failed. Because there may be
    -		// directories in the pathname, ELOOP may occur also
    -		// because of a symlink loop in the directory part.
    -		// So ELOOP doesn't tell us what actually went wrong,
    -		// and this stupidity went into POSIX-1.2008 too.
    -		//
    -		// FreeBSD associates EMLINK with O_NOFOLLOW and
    -		// Tru64 uses ENOTSUP. We use these directly here
    -		// and skip the lstat() call and the associated race.
    -		// I want to hear if there are other kernels that
    -		// fail with something else than ELOOP with O_NOFOLLOW.
    -		bool was_symlink = false;
    -
    -#	if defined(__FreeBSD__) || defined(__DragonFly__)
    -		if (errno == EMLINK)
    -			was_symlink = true;
    -
    -#	elif defined(__digital__) && defined(__unix__)
    -		if (errno == ENOTSUP)
    -			was_symlink = true;
    -
    -#	elif defined(__NetBSD__)
    -		if (errno == EFTYPE)
    -			was_symlink = true;
    -
    -#	else
    -		if (errno == ELOOP && !follow_symlinks) {
    -			const int saved_errno = errno;
    -			struct stat st;
    -			if (lstat(pair->src_name, &st) == 0
    -					&& S_ISLNK(st.st_mode))
    -				was_symlink = true;
    -
    -			errno = saved_errno;
    -		}
    -#	endif
    -
    -		if (was_symlink)
    -			message_warning(_("%s: Is a symbolic link, "
    -					"skipping"), pair->src_name);
    -		else
    -#endif
    -			// Something else than O_NOFOLLOW failing
    -			// (assuming that the race conditions didn't
    -			// confuse us).
    -			message_error("%s: %s", pair->src_name,
    -					strerror(errno));
    -
    -		return true;
    -	}
    -
    -	// Stat the source file. We need the result also when we copy
    -	// the permissions, and when unlinking.
    -	//
    -	// NOTE: Use stat() instead of fstat() with DJGPP, because
    -	// then we have a better chance to get st_ino value that can
    -	// be used in io_open_dest_real() to prevent overwriting the
    -	// source file.
    -#ifdef __DJGPP__
    -	if (stat(pair->src_name, &pair->src_st))
    -		goto error_msg;
    -#else
    -	if (fstat(pair->src_fd, &pair->src_st))
    -		goto error_msg;
    -#endif
    -
    -	if (S_ISDIR(pair->src_st.st_mode)) {
    -		message_warning(_("%s: Is a directory, skipping"),
    -				pair->src_name);
    -		goto error;
    -	}
    -
    -	if (reg_files_only && !S_ISREG(pair->src_st.st_mode)) {
    -		message_warning(_("%s: Not a regular file, skipping"),
    -				pair->src_name);
    -		goto error;
    -	}
    -
    -#ifndef TUKLIB_DOSLIKE
    -	if (reg_files_only && !opt_force) {
    -		if (pair->src_st.st_mode & (S_ISUID | S_ISGID)) {
    -			// gzip rejects setuid and setgid files even
    -			// when --force was used. bzip2 doesn't check
    -			// for them, but calls fchown() after fchmod(),
    -			// and many systems automatically drop setuid
    -			// and setgid bits there.
    -			//
    -			// We accept setuid and setgid files if
    -			// --force was used. We drop these bits
    -			// explicitly in io_copy_attr().
    -			message_warning(_("%s: File has setuid or "
    -					"setgid bit set, skipping"),
    -					pair->src_name);
    -			goto error;
    -		}
    -
    -		if (pair->src_st.st_mode & S_ISVTX) {
    -			message_warning(_("%s: File has sticky bit "
    -					"set, skipping"),
    -					pair->src_name);
    -			goto error;
    -		}
    -
    -		if (pair->src_st.st_nlink > 1) {
    -			message_warning(_("%s: Input file has more "
    -					"than one hard link, "
    -					"skipping"), pair->src_name);
    -			goto error;
    -		}
    -	}
    -
    -	// If it is something else than a regular file, wait until
    -	// there is input available. This way reading from FIFOs
    -	// will work when open() is used with O_NONBLOCK.
    -	if (!S_ISREG(pair->src_st.st_mode)) {
    -		signals_unblock();
    -		const io_wait_ret ret = io_wait(pair, -1, true);
    -		signals_block();
    -
    -		if (ret != IO_WAIT_MORE)
    -			goto error;
    -	}
    -#endif
    -
    -#ifdef HAVE_POSIX_FADVISE
    -	// It will fail with some special files like FIFOs but that is fine.
    -	(void)posix_fadvise(pair->src_fd, 0, 0, POSIX_FADV_SEQUENTIAL);
    -#endif
    -
    -	return false;
    -
    -error_msg:
    -	message_error("%s: %s", pair->src_name, strerror(errno));
    -error:
    -	(void)close(pair->src_fd);
    -	return true;
    -}
    -
    -
    -extern file_pair *
    -io_open_src(const char *src_name)
    -{
    -	if (is_empty_filename(src_name))
    -		return NULL;
    -
    -	// Since we have only one file open at a time, we can use
    -	// a statically allocated structure.
    -	static file_pair pair;
    -
    -	pair = (file_pair){
    -		.src_name = src_name,
    -		.dest_name = NULL,
    -		.src_fd = -1,
    -		.dest_fd = -1,
    -		.src_eof = false,
    -		.dest_try_sparse = false,
    -		.dest_pending_sparse = 0,
    -	};
    -
    -	// Block the signals, for which we have a custom signal handler, so
    -	// that we don't need to worry about EINTR.
    -	signals_block();
    -	const bool error = io_open_src_real(&pair);
    -	signals_unblock();
    -
    -	return error ? NULL : &pair;
    -}
    -
    -
    -/// \brief      Closes source file of the file_pair structure
    -///
    -/// \param      pair    File whose src_fd should be closed
    -/// \param      success If true, the file will be removed from the disk if
    -///                     closing succeeds and --keep hasn't been used.
    -static void
    -io_close_src(file_pair *pair, bool success)
    -{
    -#ifndef TUKLIB_DOSLIKE
    -	if (restore_stdin_flags) {
    -		assert(pair->src_fd == STDIN_FILENO);
    -
    -		restore_stdin_flags = false;
    -
    -		if (fcntl(STDIN_FILENO, F_SETFL, stdin_flags) == -1)
    -			message_error(_("Error restoring the status flags "
    -					"to standard input: %s"),
    -					strerror(errno));
    -	}
    -#endif
    -
    -	if (pair->src_fd != STDIN_FILENO && pair->src_fd != -1) {
    -#ifdef TUKLIB_DOSLIKE
    -		(void)close(pair->src_fd);
    -#endif
    -
    -		// If we are going to unlink(), do it before closing the file.
    -		// This way there's no risk that someone replaces the file and
    -		// happens to get same inode number, which would make us
    -		// unlink() wrong file.
    -		//
    -		// NOTE: DOS-like systems are an exception to this, because
    -		// they don't allow unlinking files that are open. *sigh*
    -		if (success && !opt_keep_original)
    -			io_unlink(pair->src_name, &pair->src_st);
    -
    -#ifndef TUKLIB_DOSLIKE
    -		(void)close(pair->src_fd);
    -#endif
    -	}
    -
    -	return;
    -}
    -
    -
    -static bool
    -io_open_dest_real(file_pair *pair)
    -{
    -	if (opt_stdout || pair->src_fd == STDIN_FILENO) {
    -		// We don't modify or free() this.
    -		pair->dest_name = (char *)"(stdout)";
    -		pair->dest_fd = STDOUT_FILENO;
    -#ifdef TUKLIB_DOSLIKE
    -		setmode(STDOUT_FILENO, O_BINARY);
    -#else
    -		// Try to set O_NONBLOCK if it isn't already set.
    -		// If it fails, we assume that stdout is non-blocking
    -		// in practice. See the comments in io_open_src_real()
    -		// for similar situation with stdin.
    -		//
    -		// NOTE: O_APPEND may be unset later in this function
    -		// and it relies on stdout_flags being set here.
    -		stdout_flags = fcntl(STDOUT_FILENO, F_GETFL);
    -		if (stdout_flags == -1) {
    -			message_error(_("Error getting the file status flags "
    -					"from standard output: %s"),
    -					strerror(errno));
    -			return true;
    -		}
    -
    -		if ((stdout_flags & O_NONBLOCK) == 0
    -				&& fcntl(STDOUT_FILENO, F_SETFL,
    -					stdout_flags | O_NONBLOCK) != -1)
    -				restore_stdout_flags = true;
    -#endif
    -	} else {
    -		pair->dest_name = suffix_get_dest_name(pair->src_name);
    -		if (pair->dest_name == NULL)
    -			return true;
    -
    -#ifdef __DJGPP__
    -		struct stat st;
    -		if (stat(pair->dest_name, &st) == 0) {
    -			// Check that it isn't a special file like "prn".
    -			if (st.st_dev == -1) {
    -				message_error("%s: Refusing to write to "
    -						"a DOS special file",
    -						pair->dest_name);
    -				free(pair->dest_name);
    -				return true;
    -			}
    -
    -			// Check that we aren't overwriting the source file.
    -			if (st.st_dev == pair->src_st.st_dev
    -					&& st.st_ino == pair->src_st.st_ino) {
    -				message_error("%s: Output file is the same "
    -						"as the input file",
    -						pair->dest_name);
    -				free(pair->dest_name);
    -				return true;
    -			}
    -		}
    -#endif
    -
    -		// If --force was used, unlink the target file first.
    -		if (opt_force && unlink(pair->dest_name) && errno != ENOENT) {
    -			message_error(_("%s: Cannot remove: %s"),
    -					pair->dest_name, strerror(errno));
    -			free(pair->dest_name);
    -			return true;
    -		}
    -
    -		// Open the file.
    -		int flags = O_WRONLY | O_BINARY | O_NOCTTY
    -				| O_CREAT | O_EXCL;
    -#ifndef TUKLIB_DOSLIKE
    -		flags |= O_NONBLOCK;
    -#endif
    -		const mode_t mode = S_IRUSR | S_IWUSR;
    -		pair->dest_fd = open(pair->dest_name, flags, mode);
    -
    -		if (pair->dest_fd == -1) {
    -			message_error("%s: %s", pair->dest_name,
    -					strerror(errno));
    -			free(pair->dest_name);
    -			return true;
    -		}
    -	}
    -
    -#ifndef TUKLIB_DOSLIKE
    -	// dest_st isn't used on DOS-like systems except as a dummy
    -	// argument to io_unlink(), so don't fstat() on such systems.
    -	if (fstat(pair->dest_fd, &pair->dest_st)) {
    -		// If fstat() really fails, we have a safe fallback here.
    -#	if defined(__VMS)
    -		pair->dest_st.st_ino[0] = 0;
    -		pair->dest_st.st_ino[1] = 0;
    -		pair->dest_st.st_ino[2] = 0;
    -#	else
    -		pair->dest_st.st_dev = 0;
    -		pair->dest_st.st_ino = 0;
    -#	endif
    -	} else if (try_sparse && opt_mode == MODE_DECOMPRESS) {
    -		// When writing to standard output, we need to be extra
    -		// careful:
    -		//  - It may be connected to something else than
    -		//    a regular file.
    -		//  - We aren't necessarily writing to a new empty file
    -		//    or to the end of an existing file.
    -		//  - O_APPEND may be active.
    -		//
    -		// TODO: I'm keeping this disabled for DOS-like systems
    -		// for now. FAT doesn't support sparse files, but NTFS
    -		// does, so maybe this should be enabled on Windows after
    -		// some testing.
    -		if (pair->dest_fd == STDOUT_FILENO) {
    -			if (!S_ISREG(pair->dest_st.st_mode))
    -				return false;
    -
    -			if (stdout_flags & O_APPEND) {
    -				// Creating a sparse file is not possible
    -				// when O_APPEND is active (it's used by
    -				// shell's >> redirection). As I understand
    -				// it, it is safe to temporarily disable
    -				// O_APPEND in xz, because if someone
    -				// happened to write to the same file at the
    -				// same time, results would be bad anyway
    -				// (users shouldn't assume that xz uses any
    -				// specific block size when writing data).
    -				//
    -				// The write position may be something else
    -				// than the end of the file, so we must fix
    -				// it to start writing at the end of the file
    -				// to imitate O_APPEND.
    -				if (lseek(STDOUT_FILENO, 0, SEEK_END) == -1)
    -					return false;
    -
    -				// Construct the new file status flags.
    -				// If O_NONBLOCK was set earlier in this
    -				// function, it must be kept here too.
    -				int flags = stdout_flags & ~O_APPEND;
    -				if (restore_stdout_flags)
    -					flags |= O_NONBLOCK;
    -
    -				// If this fcntl() fails, we continue but won't
    -				// try to create sparse output. The original
    -				// flags will still be restored if needed (to
    -				// unset O_NONBLOCK) when the file is finished.
    -				if (fcntl(STDOUT_FILENO, F_SETFL, flags) == -1)
    -					return false;
    -
    -				// Disabling O_APPEND succeeded. Mark
    -				// that the flags should be restored
    -				// in io_close_dest(). (This may have already
    -				// been set when enabling O_NONBLOCK.)
    -				restore_stdout_flags = true;
    -
    -			} else if (lseek(STDOUT_FILENO, 0, SEEK_CUR)
    -					!= pair->dest_st.st_size) {
    -				// Writing won't start exactly at the end
    -				// of the file. We cannot use sparse output,
    -				// because it would probably corrupt the file.
    -				return false;
    -			}
    -		}
    -
    -		pair->dest_try_sparse = true;
    -	}
    -#endif
    -
    -	return false;
    -}
    -
    -
    -extern bool
    -io_open_dest(file_pair *pair)
    -{
    -	signals_block();
    -	const bool ret = io_open_dest_real(pair);
    -	signals_unblock();
    -	return ret;
    -}
    -
    -
    -/// \brief      Closes destination file of the file_pair structure
    -///
    -/// \param      pair    File whose dest_fd should be closed
    -/// \param      success If false, the file will be removed from the disk.
    -///
    -/// \return     Zero if closing succeeds. On error, -1 is returned and
    -///             error message printed.
    -static bool
    -io_close_dest(file_pair *pair, bool success)
    -{
    -#ifndef TUKLIB_DOSLIKE
    -	// If io_open_dest() has disabled O_APPEND, restore it here.
    -	if (restore_stdout_flags) {
    -		assert(pair->dest_fd == STDOUT_FILENO);
    -
    -		restore_stdout_flags = false;
    -
    -		if (fcntl(STDOUT_FILENO, F_SETFL, stdout_flags) == -1) {
    -			message_error(_("Error restoring the O_APPEND flag "
    -					"to standard output: %s"),
    -					strerror(errno));
    -			return true;
    -		}
    -	}
    -#endif
    -
    -	if (pair->dest_fd == -1 || pair->dest_fd == STDOUT_FILENO)
    -		return false;
    -
    -	if (close(pair->dest_fd)) {
    -		message_error(_("%s: Closing the file failed: %s"),
    -				pair->dest_name, strerror(errno));
    -
    -		// Closing destination file failed, so we cannot trust its
    -		// contents. Get rid of junk:
    -		io_unlink(pair->dest_name, &pair->dest_st);
    -		free(pair->dest_name);
    -		return true;
    -	}
    -
    -	// If the operation using this file wasn't successful, we git rid
    -	// of the junk file.
    -	if (!success)
    -		io_unlink(pair->dest_name, &pair->dest_st);
    -
    -	free(pair->dest_name);
    -
    -	return false;
    -}
    -
    -
    -extern void
    -io_close(file_pair *pair, bool success)
    -{
    -	// Take care of sparseness at the end of the output file.
    -	if (success && pair->dest_try_sparse
    -			&& pair->dest_pending_sparse > 0) {
    -		// Seek forward one byte less than the size of the pending
    -		// hole, then write one zero-byte. This way the file grows
    -		// to its correct size. An alternative would be to use
    -		// ftruncate() but that isn't portable enough (e.g. it
    -		// doesn't work with FAT on Linux; FAT isn't that important
    -		// since it doesn't support sparse files anyway, but we don't
    -		// want to create corrupt files on it).
    -		if (lseek(pair->dest_fd, pair->dest_pending_sparse - 1,
    -				SEEK_CUR) == -1) {
    -			message_error(_("%s: Seeking failed when trying "
    -					"to create a sparse file: %s"),
    -					pair->dest_name, strerror(errno));
    -			success = false;
    -		} else {
    -			const uint8_t zero[1] = { '\0' };
    -			if (io_write_buf(pair, zero, 1))
    -				success = false;
    -		}
    -	}
    -
    -	signals_block();
    -
    -	// Copy the file attributes. We need to skip this if destination
    -	// file isn't open or it is standard output.
    -	if (success && pair->dest_fd != -1 && pair->dest_fd != STDOUT_FILENO)
    -		io_copy_attrs(pair);
    -
    -	// Close the destination first. If it fails, we must not remove
    -	// the source file!
    -	if (io_close_dest(pair, success))
    -		success = false;
    -
    -	// Close the source file, and unlink it if the operation using this
    -	// file pair was successful and we haven't requested to keep the
    -	// source file.
    -	io_close_src(pair, success);
    -
    -	signals_unblock();
    -
    -	return;
    -}
    -
    -
    -extern void
    -io_fix_src_pos(file_pair *pair, size_t rewind_size)
    -{
    -	assert(rewind_size <= IO_BUFFER_SIZE);
    -
    -	if (rewind_size > 0) {
    -		// This doesn't need to work on unseekable file descriptors,
    -		// so just ignore possible errors.
    -		(void)lseek(pair->src_fd, -(off_t)(rewind_size), SEEK_CUR);
    -	}
    -
    -	return;
    -}
    -
    -
    -extern size_t
    -io_read(file_pair *pair, io_buf *buf_union, size_t size)
    -{
    -	// We use small buffers here.
    -	assert(size < SSIZE_MAX);
    -
    -	uint8_t *buf = buf_union->u8;
    -	size_t left = size;
    -
    -	while (left > 0) {
    -		const ssize_t amount = read(pair->src_fd, buf, left);
    -
    -		if (amount == 0) {
    -			pair->src_eof = true;
    -			break;
    -		}
    -
    -		if (amount == -1) {
    -			if (errno == EINTR) {
    -				if (user_abort)
    -					return SIZE_MAX;
    -
    -				continue;
    -			}
    -
    -#ifndef TUKLIB_DOSLIKE
    -			if (errno == EAGAIN || errno == EWOULDBLOCK) {
    -				const io_wait_ret ret = io_wait(pair,
    -						mytime_get_flush_timeout(),
    -						true);
    -				switch (ret) {
    -				case IO_WAIT_MORE:
    -					continue;
    -
    -				case IO_WAIT_ERROR:
    -					return SIZE_MAX;
    -
    -				case IO_WAIT_TIMEOUT:
    -					return size - left;
    -
    -				default:
    -					message_bug();
    -				}
    -			}
    -#endif
    -
    -			message_error(_("%s: Read error: %s"),
    -					pair->src_name, strerror(errno));
    -
    -			return SIZE_MAX;
    -		}
    -
    -		buf += (size_t)(amount);
    -		left -= (size_t)(amount);
    -	}
    -
    -	return size - left;
    -}
    -
    -
    -extern bool
    -io_pread(file_pair *pair, io_buf *buf, size_t size, off_t pos)
    -{
    -	// Using lseek() and read() is more portable than pread() and
    -	// for us it is as good as real pread().
    -	if (lseek(pair->src_fd, pos, SEEK_SET) != pos) {
    -		message_error(_("%s: Error seeking the file: %s"),
    -				pair->src_name, strerror(errno));
    -		return true;
    -	}
    -
    -	const size_t amount = io_read(pair, buf, size);
    -	if (amount == SIZE_MAX)
    -		return true;
    -
    -	if (amount != size) {
    -		message_error(_("%s: Unexpected end of file"),
    -				pair->src_name);
    -		return true;
    -	}
    -
    -	return false;
    -}
    -
    -
    -static bool
    -is_sparse(const io_buf *buf)
    -{
    -	assert(IO_BUFFER_SIZE % sizeof(uint64_t) == 0);
    -
    -	for (size_t i = 0; i < ARRAY_SIZE(buf->u64); ++i)
    -		if (buf->u64[i] != 0)
    -			return false;
    -
    -	return true;
    -}
    -
    -
    -static bool
    -io_write_buf(file_pair *pair, const uint8_t *buf, size_t size)
    -{
    -	assert(size < SSIZE_MAX);
    -
    -	while (size > 0) {
    -		const ssize_t amount = write(pair->dest_fd, buf, size);
    -		if (amount == -1) {
    -			if (errno == EINTR) {
    -				if (user_abort)
    -					return true;
    -
    -				continue;
    -			}
    -
    -#ifndef TUKLIB_DOSLIKE
    -			if (errno == EAGAIN || errno == EWOULDBLOCK) {
    -				if (io_wait(pair, -1, false) == IO_WAIT_MORE)
    -					continue;
    -
    -				return true;
    -			}
    -#endif
    -
    -			// Handle broken pipe specially. gzip and bzip2
    -			// don't print anything on SIGPIPE. In addition,
    -			// gzip --quiet uses exit status 2 (warning) on
    -			// broken pipe instead of whatever raise(SIGPIPE)
    -			// would make it return. It is there to hide "Broken
    -			// pipe" message on some old shells (probably old
    -			// GNU bash).
    -			//
    -			// We don't do anything special with --quiet, which
    -			// is what bzip2 does too. If we get SIGPIPE, we
    -			// will handle it like other signals by setting
    -			// user_abort, and get EPIPE here.
    -			if (errno != EPIPE)
    -				message_error(_("%s: Write error: %s"),
    -					pair->dest_name, strerror(errno));
    -
    -			return true;
    -		}
    -
    -		buf += (size_t)(amount);
    -		size -= (size_t)(amount);
    -	}
    -
    -	return false;
    -}
    -
    -
    -extern bool
    -io_write(file_pair *pair, const io_buf *buf, size_t size)
    -{
    -	assert(size <= IO_BUFFER_SIZE);
    -
    -	if (pair->dest_try_sparse) {
    -		// Check if the block is sparse (contains only zeros). If it
    -		// sparse, we just store the amount and return. We will take
    -		// care of actually skipping over the hole when we hit the
    -		// next data block or close the file.
    -		//
    -		// Since io_close() requires that dest_pending_sparse > 0
    -		// if the file ends with sparse block, we must also return
    -		// if size == 0 to avoid doing the lseek().
    -		if (size == IO_BUFFER_SIZE) {
    -			if (is_sparse(buf)) {
    -				pair->dest_pending_sparse += size;
    -				return false;
    -			}
    -		} else if (size == 0) {
    -			return false;
    -		}
    -
    -		// This is not a sparse block. If we have a pending hole,
    -		// skip it now.
    -		if (pair->dest_pending_sparse > 0) {
    -			if (lseek(pair->dest_fd, pair->dest_pending_sparse,
    -					SEEK_CUR) == -1) {
    -				message_error(_("%s: Seeking failed when "
    -						"trying to create a sparse "
    -						"file: %s"), pair->dest_name,
    -						strerror(errno));
    -				return true;
    -			}
    -
    -			pair->dest_pending_sparse = 0;
    -		}
    -	}
    -
    -	return io_write_buf(pair, buf->u8, size);
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/file_io.h b/external/public-domain/xz/dist/src/xz/file_io.h
    deleted file mode 100644
    index 2de337923..000000000
    --- a/external/public-domain/xz/dist/src/xz/file_io.h
    +++ /dev/null
    @@ -1,150 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       file_io.h
    -/// \brief      I/O types and functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -// Some systems have suboptimal BUFSIZ. Use a bit bigger value on them.
    -// We also need that IO_BUFFER_SIZE is a multiple of 8 (sizeof(uint64_t))
    -#if BUFSIZ <= 1024
    -#	define IO_BUFFER_SIZE 8192
    -#else
    -#	define IO_BUFFER_SIZE (BUFSIZ & ~7U)
    -#endif
    -
    -
    -/// is_sparse() accesses the buffer as uint64_t for maximum speed.
    -/// Use an union to make sure that the buffer is properly aligned.
    -typedef union {
    -	uint8_t u8[IO_BUFFER_SIZE];
    -	uint32_t u32[IO_BUFFER_SIZE / sizeof(uint32_t)];
    -	uint64_t u64[IO_BUFFER_SIZE / sizeof(uint64_t)];
    -} io_buf;
    -
    -
    -typedef struct {
    -	/// Name of the source filename (as given on the command line) or
    -	/// pointer to static "(stdin)" when reading from standard input.
    -	const char *src_name;
    -
    -	/// Destination filename converted from src_name or pointer to static
    -	/// "(stdout)" when writing to standard output.
    -	char *dest_name;
    -
    -	/// File descriptor of the source file
    -	int src_fd;
    -
    -	/// File descriptor of the target file
    -	int dest_fd;
    -
    -	/// True once end of the source file has been detected.
    -	bool src_eof;
    -
    -	/// If true, we look for long chunks of zeros and try to create
    -	/// a sparse file.
    -	bool dest_try_sparse;
    -
    -	/// This is used only if dest_try_sparse is true. This holds the
    -	/// number of zero bytes we haven't written out, because we plan
    -	/// to make that byte range a sparse chunk.
    -	off_t dest_pending_sparse;
    -
    -	/// Stat of the source file.
    -	struct stat src_st;
    -
    -	/// Stat of the destination file.
    -	struct stat dest_st;
    -
    -} file_pair;
    -
    -
    -/// \brief      Initialize the I/O module
    -extern void io_init(void);
    -
    -
    -#ifndef TUKLIB_DOSLIKE
    -/// \brief      Write a byte to user_abort_pipe[1]
    -///
    -/// This is called from a signal handler.
    -extern void io_write_to_user_abort_pipe(void);
    -#endif
    -
    -
    -/// \brief      Disable creation of sparse files when decompressing
    -extern void io_no_sparse(void);
    -
    -
    -/// \brief      Open the source file
    -extern file_pair *io_open_src(const char *src_name);
    -
    -
    -/// \brief      Open the destination file
    -extern bool io_open_dest(file_pair *pair);
    -
    -
    -/// \brief      Closes the file descriptors and frees possible allocated memory
    -///
    -/// The success argument determines if source or destination file gets
    -/// unlinked:
    -///  - false: The destination file is unlinked.
    -///  - true: The source file is unlinked unless writing to stdout or --keep
    -///    was used.
    -extern void io_close(file_pair *pair, bool success);
    -
    -
    -/// \brief      Reads from the source file to a buffer
    -///
    -/// \param      pair    File pair having the source file open for reading
    -/// \param      buf     Destination buffer to hold the read data
    -/// \param      size    Size of the buffer; assumed be smaller than SSIZE_MAX
    -///
    -/// \return     On success, number of bytes read is returned. On end of
    -///             file zero is returned and pair->src_eof set to true.
    -///             On error, SIZE_MAX is returned and error message printed.
    -extern size_t io_read(file_pair *pair, io_buf *buf, size_t size);
    -
    -
    -/// \brief      Fix the position in src_fd
    -///
    -/// This is used when --single-thream has been specified and decompression
    -/// is successful. If the input file descriptor supports seeking, this
    -/// function fixes the input position to point to the next byte after the
    -/// decompressed stream.
    -///
    -/// \param      pair        File pair having the source file open for reading
    -/// \param      rewind_size How many bytes of extra have been read i.e.
    -///                         how much to seek backwards.
    -extern void io_fix_src_pos(file_pair *pair, size_t rewind_size);
    -
    -
    -/// \brief      Read from source file from given offset to a buffer
    -///
    -/// This is remotely similar to standard pread(). This uses lseek() though,
    -/// so the read offset is changed on each call.
    -///
    -/// \param      pair    Seekable source file
    -/// \param      buf     Destination buffer
    -/// \param      size    Amount of data to read
    -/// \param      pos     Offset relative to the beginning of the file,
    -///                     from which the data should be read.
    -///
    -/// \return     On success, false is returned. On error, error message
    -///             is printed and true is returned.
    -extern bool io_pread(file_pair *pair, io_buf *buf, size_t size, off_t pos);
    -
    -
    -/// \brief      Writes a buffer to the destination file
    -///
    -/// \param      pair    File pair having the destination file open for writing
    -/// \param      buf     Buffer containing the data to be written
    -/// \param      size    Size of the buffer; assumed be smaller than SSIZE_MAX
    -///
    -/// \return     On success, zero is returned. On error, -1 is returned
    -///             and error message printed.
    -extern bool io_write(file_pair *pair, const io_buf *buf, size_t size);
    diff --git a/external/public-domain/xz/dist/src/xz/hardware.c b/external/public-domain/xz/dist/src/xz/hardware.c
    deleted file mode 100644
    index ff32f6d30..000000000
    --- a/external/public-domain/xz/dist/src/xz/hardware.c
    +++ /dev/null
    @@ -1,150 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       hardware.c
    -/// \brief      Detection of available hardware resources
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -
    -/// Maximum number of worker threads. This can be set with
    -/// the --threads=NUM command line option.
    -static uint32_t threads_max = 1;
    -
    -/// Memory usage limit for compression
    -static uint64_t memlimit_compress;
    -
    -/// Memory usage limit for decompression
    -static uint64_t memlimit_decompress;
    -
    -/// Total amount of physical RAM
    -static uint64_t total_ram;
    -
    -
    -extern void
    -hardware_threads_set(uint32_t n)
    -{
    -	if (n == 0) {
    -		// Automatic number of threads was requested.
    -		// If threading support was enabled at build time,
    -		// use the number of available CPU cores. Otherwise
    -		// use one thread since disabling threading support
    -		// omits lzma_cputhreads() from liblzma.
    -#ifdef MYTHREAD_ENABLED
    -		threads_max = lzma_cputhreads();
    -		if (threads_max == 0)
    -			threads_max = 1;
    -#else
    -		threads_max = 1;
    -#endif
    -	} else {
    -		threads_max = n;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern uint32_t
    -hardware_threads_get(void)
    -{
    -	return threads_max;
    -}
    -
    -
    -extern void
    -hardware_memlimit_set(uint64_t new_memlimit,
    -		bool set_compress, bool set_decompress, bool is_percentage)
    -{
    -	if (is_percentage) {
    -		assert(new_memlimit > 0);
    -		assert(new_memlimit <= 100);
    -		new_memlimit = (uint32_t)new_memlimit * total_ram / 100;
    -	}
    -
    -	if (set_compress)
    -		memlimit_compress = new_memlimit;
    -
    -	if (set_decompress)
    -		memlimit_decompress = new_memlimit;
    -
    -	return;
    -}
    -
    -
    -extern uint64_t
    -hardware_memlimit_get(enum operation_mode mode)
    -{
    -	// Zero is a special value that indicates the default. Currently
    -	// the default simply disables the limit. Once there is threading
    -	// support, this might be a little more complex, because there will
    -	// probably be a special case where a user asks for "optimal" number
    -	// of threads instead of a specific number (this might even become
    -	// the default mode). Each thread may use a significant amount of
    -	// memory. When there are no memory usage limits set, we need some
    -	// default soft limit for calculating the "optimal" number of
    -	// threads.
    -	const uint64_t memlimit = mode == MODE_COMPRESS
    -			? memlimit_compress : memlimit_decompress;
    -	return memlimit != 0 ? memlimit : UINT64_MAX;
    -}
    -
    -
    -/// Helper for hardware_memlimit_show() to print one human-readable info line.
    -static void
    -memlimit_show(const char *str, uint64_t value)
    -{
    -	// The memory usage limit is considered to be disabled if value
    -	// is 0 or UINT64_MAX. This might get a bit more complex once there
    -	// is threading support. See the comment in hardware_memlimit_get().
    -	if (value == 0 || value == UINT64_MAX)
    -		printf("%s %s\n", str, _("Disabled"));
    -	else
    -		printf("%s %s MiB (%s B)\n", str,
    -				uint64_to_str(round_up_to_mib(value), 0),
    -				uint64_to_str(value, 1));
    -
    -	return;
    -}
    -
    -
    -extern void
    -hardware_memlimit_show(void)
    -{
    -	if (opt_robot) {
    -		printf("%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\n", total_ram,
    -				memlimit_compress, memlimit_decompress);
    -	} else {
    -		// TRANSLATORS: Test with "xz --info-memory" to see if
    -		// the alignment looks nice.
    -		memlimit_show(_("Total amount of physical memory (RAM): "),
    -				total_ram);
    -		memlimit_show(_("Memory usage limit for compression:    "),
    -				memlimit_compress);
    -		memlimit_show(_("Memory usage limit for decompression:  "),
    -				memlimit_decompress);
    -	}
    -
    -	tuklib_exit(E_SUCCESS, E_ERROR, message_verbosity_get() != V_SILENT);
    -}
    -
    -
    -extern void
    -hardware_init(void)
    -{
    -	// Get the amount of RAM. If we cannot determine it,
    -	// use the assumption defined by the configure script.
    -	total_ram = lzma_physmem();
    -	if (total_ram == 0)
    -		total_ram = (uint64_t)(ASSUME_RAM) * 1024 * 1024;
    -
    -	// Set the defaults.
    -	hardware_memlimit_set(0, true, true, false);
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/hardware.h b/external/public-domain/xz/dist/src/xz/hardware.h
    deleted file mode 100644
    index 4fae61815..000000000
    --- a/external/public-domain/xz/dist/src/xz/hardware.h
    +++ /dev/null
    @@ -1,37 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       hardware.h
    -/// \brief      Detection of available hardware resources
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -/// Initialize some hardware-specific variables, which are needed by other
    -/// hardware_* functions.
    -extern void hardware_init(void);
    -
    -
    -/// Set the maximum number of worker threads.
    -extern void hardware_threads_set(uint32_t threadlimit);
    -
    -/// Get the maximum number of worker threads.
    -extern uint32_t hardware_threads_get(void);
    -
    -
    -/// Set the memory usage limit. There are separate limits for compression
    -/// and decompression (the latter includes also --list), one or both can
    -/// be set with a single call to this function. Zero indicates resetting
    -/// the limit back to the defaults. The limit can also be set as a percentage
    -/// of installed RAM; the percentage must be in the range [1, 100].
    -extern void hardware_memlimit_set(uint64_t new_memlimit,
    -		bool set_compress, bool set_decompress, bool is_percentage);
    -
    -/// Get the current memory usage limit for compression or decompression.
    -extern uint64_t hardware_memlimit_get(enum operation_mode mode);
    -
    -/// Display the amount of RAM and memory usage limits and exit.
    -extern void hardware_memlimit_show(void) lzma_attribute((__noreturn__));
    diff --git a/external/public-domain/xz/dist/src/xz/list.c b/external/public-domain/xz/dist/src/xz/list.c
    deleted file mode 100644
    index 449c2bc4e..000000000
    --- a/external/public-domain/xz/dist/src/xz/list.c
    +++ /dev/null
    @@ -1,1186 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       list.c
    -/// \brief      Listing information about .xz files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -#include "tuklib_integer.h"
    -
    -
    -/// Information about a .xz file
    -typedef struct {
    -	/// Combined Index of all Streams in the file
    -	lzma_index *idx;
    -
    -	/// Total amount of Stream Padding
    -	uint64_t stream_padding;
    -
    -	/// Highest memory usage so far
    -	uint64_t memusage_max;
    -
    -	/// True if all Blocks so far have Compressed Size and
    -	/// Uncompressed Size fields
    -	bool all_have_sizes;
    -
    -	/// Oldest XZ Utils version that will decompress the file
    -	uint32_t min_version;
    -
    -} xz_file_info;
    -
    -#define XZ_FILE_INFO_INIT { NULL, 0, 0, true, 50000002 }
    -
    -
    -/// Information about a .xz Block
    -typedef struct {
    -	/// Size of the Block Header
    -	uint32_t header_size;
    -
    -	/// A few of the Block Flags as a string
    -	char flags[3];
    -
    -	/// Size of the Compressed Data field in the Block
    -	lzma_vli compressed_size;
    -
    -	/// Decoder memory usage for this Block
    -	uint64_t memusage;
    -
    -	/// The filter chain of this Block in human-readable form
    -	char filter_chain[FILTERS_STR_SIZE];
    -
    -} block_header_info;
    -
    -
    -/// Check ID to string mapping
    -static const char check_names[LZMA_CHECK_ID_MAX + 1][12] = {
    -	// TRANSLATORS: Indicates that there is no integrity check.
    -	// This string is used in tables, so the width must not
    -	// exceed ten columns with a fixed-width font.
    -	N_("None"),
    -	"CRC32",
    -	// TRANSLATORS: Indicates that integrity check name is not known,
    -	// but the Check ID is known (here 2). This and other "Unknown-N"
    -	// strings are used in tables, so the width must not exceed ten
    -	// columns with a fixed-width font. It's OK to omit the dash if
    -	// you need space for one extra letter, but don't use spaces.
    -	N_("Unknown-2"),
    -	N_("Unknown-3"),
    -	"CRC64",
    -	N_("Unknown-5"),
    -	N_("Unknown-6"),
    -	N_("Unknown-7"),
    -	N_("Unknown-8"),
    -	N_("Unknown-9"),
    -	"SHA-256",
    -	N_("Unknown-11"),
    -	N_("Unknown-12"),
    -	N_("Unknown-13"),
    -	N_("Unknown-14"),
    -	N_("Unknown-15"),
    -};
    -
    -/// Buffer size for get_check_names(). This may be a bit ridiculous,
    -/// but at least it's enough if some language needs many multibyte chars.
    -#define CHECKS_STR_SIZE 1024
    -
    -
    -/// Value of the Check field as hexadecimal string.
    -/// This is set by parse_check_value().
    -static char check_value[2 * LZMA_CHECK_SIZE_MAX + 1];
    -
    -
    -/// Totals that are displayed if there was more than one file.
    -/// The "files" counter is also used in print_info_adv() to show
    -/// the file number.
    -static struct {
    -	uint64_t files;
    -	uint64_t streams;
    -	uint64_t blocks;
    -	uint64_t compressed_size;
    -	uint64_t uncompressed_size;
    -	uint64_t stream_padding;
    -	uint64_t memusage_max;
    -	uint32_t checks;
    -	uint32_t min_version;
    -	bool all_have_sizes;
    -} totals = { 0, 0, 0, 0, 0, 0, 0, 0, 0, true };
    -
    -
    -/// Convert XZ Utils version number to a string.
    -static const char *
    -xz_ver_to_str(uint32_t ver)
    -{
    -	static char buf[32];
    -
    -	unsigned int major = ver / 10000000U;
    -	ver -= major * 10000000U;
    -
    -	unsigned int minor = ver / 10000U;
    -	ver -= minor * 10000U;
    -
    -	unsigned int patch = ver / 10U;
    -	ver -= patch * 10U;
    -
    -	const char *stability = ver == 0 ? "alpha" : ver == 1 ? "beta" : "";
    -
    -	snprintf(buf, sizeof(buf), "%u.%u.%u%s",
    -			major, minor, patch, stability);
    -	return buf;
    -}
    -
    -
    -/// \brief      Parse the Index(es) from the given .xz file
    -///
    -/// \param      xfi     Pointer to structure where the decoded information
    -///                     is stored.
    -/// \param      pair    Input file
    -///
    -/// \return     On success, false is returned. On error, true is returned.
    -///
    -// TODO: This function is pretty big. liblzma should have a function that
    -// takes a callback function to parse the Index(es) from a .xz file to make
    -// it easy for applications.
    -static bool
    -parse_indexes(xz_file_info *xfi, file_pair *pair)
    -{
    -	if (pair->src_st.st_size <= 0) {
    -		message_error(_("%s: File is empty"), pair->src_name);
    -		return true;
    -	}
    -
    -	if (pair->src_st.st_size < 2 * LZMA_STREAM_HEADER_SIZE) {
    -		message_error(_("%s: Too small to be a valid .xz file"),
    -				pair->src_name);
    -		return true;
    -	}
    -
    -	io_buf buf;
    -	lzma_stream_flags header_flags;
    -	lzma_stream_flags footer_flags;
    -	lzma_ret ret;
    -
    -	// lzma_stream for the Index decoder
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -
    -	// All Indexes decoded so far
    -	lzma_index *combined_index = NULL;
    -
    -	// The Index currently being decoded
    -	lzma_index *this_index = NULL;
    -
    -	// Current position in the file. We parse the file backwards so
    -	// initialize it to point to the end of the file.
    -	off_t pos = pair->src_st.st_size;
    -
    -	// Each loop iteration decodes one Index.
    -	do {
    -		// Check that there is enough data left to contain at least
    -		// the Stream Header and Stream Footer. This check cannot
    -		// fail in the first pass of this loop.
    -		if (pos < 2 * LZMA_STREAM_HEADER_SIZE) {
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(LZMA_DATA_ERROR));
    -			goto error;
    -		}
    -
    -		pos -= LZMA_STREAM_HEADER_SIZE;
    -		lzma_vli stream_padding = 0;
    -
    -		// Locate the Stream Footer. There may be Stream Padding which
    -		// we must skip when reading backwards.
    -		while (true) {
    -			if (pos < LZMA_STREAM_HEADER_SIZE) {
    -				message_error("%s: %s", pair->src_name,
    -						message_strm(
    -							LZMA_DATA_ERROR));
    -				goto error;
    -			}
    -
    -			if (io_pread(pair, &buf,
    -					LZMA_STREAM_HEADER_SIZE, pos))
    -				goto error;
    -
    -			// Stream Padding is always a multiple of four bytes.
    -			int i = 2;
    -			if (buf.u32[i] != 0)
    -				break;
    -
    -			// To avoid calling io_pread() for every four bytes
    -			// of Stream Padding, take advantage that we read
    -			// 12 bytes (LZMA_STREAM_HEADER_SIZE) already and
    -			// check them too before calling io_pread() again.
    -			do {
    -				stream_padding += 4;
    -				pos -= 4;
    -				--i;
    -			} while (i >= 0 && buf.u32[i] == 0);
    -		}
    -
    -		// Decode the Stream Footer.
    -		ret = lzma_stream_footer_decode(&footer_flags, buf.u8);
    -		if (ret != LZMA_OK) {
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(ret));
    -			goto error;
    -		}
    -
    -		// Check that the Stream Footer doesn't specify something
    -		// that we don't support. This can only happen if the xz
    -		// version is older than liblzma and liblzma supports
    -		// something new.
    -		//
    -		// It is enough to check Stream Footer. Stream Header must
    -		// match when it is compared against Stream Footer with
    -		// lzma_stream_flags_compare().
    -		if (footer_flags.version != 0) {
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(LZMA_OPTIONS_ERROR));
    -			goto error;
    -		}
    -
    -		// Check that the size of the Index field looks sane.
    -		lzma_vli index_size = footer_flags.backward_size;
    -		if ((lzma_vli)(pos) < index_size + LZMA_STREAM_HEADER_SIZE) {
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(LZMA_DATA_ERROR));
    -			goto error;
    -		}
    -
    -		// Set pos to the beginning of the Index.
    -		pos -= index_size;
    -
    -		// See how much memory we can use for decoding this Index.
    -		uint64_t memlimit = hardware_memlimit_get(MODE_LIST);
    -		uint64_t memused = 0;
    -		if (combined_index != NULL) {
    -			memused = lzma_index_memused(combined_index);
    -			if (memused > memlimit)
    -				message_bug();
    -
    -			memlimit -= memused;
    -		}
    -
    -		// Decode the Index.
    -		ret = lzma_index_decoder(&strm, &this_index, memlimit);
    -		if (ret != LZMA_OK) {
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(ret));
    -			goto error;
    -		}
    -
    -		do {
    -			// Don't give the decoder more input than the
    -			// Index size.
    -			strm.avail_in = my_min(IO_BUFFER_SIZE, index_size);
    -			if (io_pread(pair, &buf, strm.avail_in, pos))
    -				goto error;
    -
    -			pos += strm.avail_in;
    -			index_size -= strm.avail_in;
    -
    -			strm.next_in = buf.u8;
    -			ret = lzma_code(&strm, LZMA_RUN);
    -
    -		} while (ret == LZMA_OK);
    -
    -		// If the decoding seems to be successful, check also that
    -		// the Index decoder consumed as much input as indicated
    -		// by the Backward Size field.
    -		if (ret == LZMA_STREAM_END)
    -			if (index_size != 0 || strm.avail_in != 0)
    -				ret = LZMA_DATA_ERROR;
    -
    -		if (ret != LZMA_STREAM_END) {
    -			// LZMA_BUFFER_ERROR means that the Index decoder
    -			// would have liked more input than what the Index
    -			// size should be according to Stream Footer.
    -			// The message for LZMA_DATA_ERROR makes more
    -			// sense in that case.
    -			if (ret == LZMA_BUF_ERROR)
    -				ret = LZMA_DATA_ERROR;
    -
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(ret));
    -
    -			// If the error was too low memory usage limit,
    -			// show also how much memory would have been needed.
    -			if (ret == LZMA_MEMLIMIT_ERROR) {
    -				uint64_t needed = lzma_memusage(&strm);
    -				if (UINT64_MAX - needed < memused)
    -					needed = UINT64_MAX;
    -				else
    -					needed += memused;
    -
    -				message_mem_needed(V_ERROR, needed);
    -			}
    -
    -			goto error;
    -		}
    -
    -		// Decode the Stream Header and check that its Stream Flags
    -		// match the Stream Footer.
    -		pos -= footer_flags.backward_size + LZMA_STREAM_HEADER_SIZE;
    -		if ((lzma_vli)(pos) < lzma_index_total_size(this_index)) {
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(LZMA_DATA_ERROR));
    -			goto error;
    -		}
    -
    -		pos -= lzma_index_total_size(this_index);
    -		if (io_pread(pair, &buf, LZMA_STREAM_HEADER_SIZE, pos))
    -			goto error;
    -
    -		ret = lzma_stream_header_decode(&header_flags, buf.u8);
    -		if (ret != LZMA_OK) {
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(ret));
    -			goto error;
    -		}
    -
    -		ret = lzma_stream_flags_compare(&header_flags, &footer_flags);
    -		if (ret != LZMA_OK) {
    -			message_error("%s: %s", pair->src_name,
    -					message_strm(ret));
    -			goto error;
    -		}
    -
    -		// Store the decoded Stream Flags into this_index. This is
    -		// needed so that we can print which Check is used in each
    -		// Stream.
    -		ret = lzma_index_stream_flags(this_index, &footer_flags);
    -		if (ret != LZMA_OK)
    -			message_bug();
    -
    -		// Store also the size of the Stream Padding field. It is
    -		// needed to show the offsets of the Streams correctly.
    -		ret = lzma_index_stream_padding(this_index, stream_padding);
    -		if (ret != LZMA_OK)
    -			message_bug();
    -
    -		if (combined_index != NULL) {
    -			// Append the earlier decoded Indexes
    -			// after this_index.
    -			ret = lzma_index_cat(
    -					this_index, combined_index, NULL);
    -			if (ret != LZMA_OK) {
    -				message_error("%s: %s", pair->src_name,
    -						message_strm(ret));
    -				goto error;
    -			}
    -		}
    -
    -		combined_index = this_index;
    -		this_index = NULL;
    -
    -		xfi->stream_padding += stream_padding;
    -
    -	} while (pos > 0);
    -
    -	lzma_end(&strm);
    -
    -	// All OK. Make combined_index available to the caller.
    -	xfi->idx = combined_index;
    -	return false;
    -
    -error:
    -	// Something went wrong, free the allocated memory.
    -	lzma_end(&strm);
    -	lzma_index_end(combined_index, NULL);
    -	lzma_index_end(this_index, NULL);
    -	return true;
    -}
    -
    -
    -/// \brief      Parse the Block Header
    -///
    -/// The result is stored into *bhi. The caller takes care of initializing it.
    -///
    -/// \return     False on success, true on error.
    -static bool
    -parse_block_header(file_pair *pair, const lzma_index_iter *iter,
    -		block_header_info *bhi, xz_file_info *xfi)
    -{
    -#if IO_BUFFER_SIZE < LZMA_BLOCK_HEADER_SIZE_MAX
    -#	error IO_BUFFER_SIZE < LZMA_BLOCK_HEADER_SIZE_MAX
    -#endif
    -
    -	// Get the whole Block Header with one read, but don't read past
    -	// the end of the Block (or even its Check field).
    -	const uint32_t size = my_min(iter->block.total_size
    -				- lzma_check_size(iter->stream.flags->check),
    -			LZMA_BLOCK_HEADER_SIZE_MAX);
    -	io_buf buf;
    -	if (io_pread(pair, &buf, size, iter->block.compressed_file_offset))
    -		return true;
    -
    -	// Zero would mean Index Indicator and thus not a valid Block.
    -	if (buf.u8[0] == 0)
    -		goto data_error;
    -
    -	// Initialize the block structure and decode Block Header Size.
    -	lzma_filter filters[LZMA_FILTERS_MAX + 1];
    -	lzma_block block;
    -	block.version = 0;
    -	block.check = iter->stream.flags->check;
    -	block.filters = filters;
    -
    -	block.header_size = lzma_block_header_size_decode(buf.u8[0]);
    -	if (block.header_size > size)
    -		goto data_error;
    -
    -	// Decode the Block Header.
    -	switch (lzma_block_header_decode(&block, NULL, buf.u8)) {
    -	case LZMA_OK:
    -		break;
    -
    -	case LZMA_OPTIONS_ERROR:
    -		message_error("%s: %s", pair->src_name,
    -				message_strm(LZMA_OPTIONS_ERROR));
    -		return true;
    -
    -	case LZMA_DATA_ERROR:
    -		goto data_error;
    -
    -	default:
    -		message_bug();
    -	}
    -
    -	// Check the Block Flags. These must be done before calling
    -	// lzma_block_compressed_size(), because it overwrites
    -	// block.compressed_size.
    -	bhi->flags[0] = block.compressed_size != LZMA_VLI_UNKNOWN
    -			? 'c' : '-';
    -	bhi->flags[1] = block.uncompressed_size != LZMA_VLI_UNKNOWN
    -			? 'u' : '-';
    -	bhi->flags[2] = '\0';
    -
    -	// Collect information if all Blocks have both Compressed Size
    -	// and Uncompressed Size fields. They can be useful e.g. for
    -	// multi-threaded decompression so it can be useful to know it.
    -	xfi->all_have_sizes &= block.compressed_size != LZMA_VLI_UNKNOWN
    -			&& block.uncompressed_size != LZMA_VLI_UNKNOWN;
    -
    -	// Validate or set block.compressed_size.
    -	switch (lzma_block_compressed_size(&block,
    -			iter->block.unpadded_size)) {
    -	case LZMA_OK:
    -		// Validate also block.uncompressed_size if it is present.
    -		// If it isn't present, there's no need to set it since
    -		// we aren't going to actually decompress the Block; if
    -		// we were decompressing, then we should set it so that
    -		// the Block decoder could validate the Uncompressed Size
    -		// that was stored in the Index.
    -		if (block.uncompressed_size == LZMA_VLI_UNKNOWN
    -				|| block.uncompressed_size
    -					== iter->block.uncompressed_size)
    -			break;
    -
    -		// If the above fails, the file is corrupt so
    -		// LZMA_DATA_ERROR is a good error code.
    -
    -	case LZMA_DATA_ERROR:
    -		// Free the memory allocated by lzma_block_header_decode().
    -		for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
    -			free(filters[i].options);
    -
    -		goto data_error;
    -
    -	default:
    -		message_bug();
    -	}
    -
    -	// Copy the known sizes.
    -	bhi->header_size = block.header_size;
    -	bhi->compressed_size = block.compressed_size;
    -
    -	// Calculate the decoder memory usage and update the maximum
    -	// memory usage of this Block.
    -	bhi->memusage = lzma_raw_decoder_memusage(filters);
    -	if (xfi->memusage_max < bhi->memusage)
    -		xfi->memusage_max = bhi->memusage;
    -
    -	// Determine the minimum XZ Utils version that supports this Block.
    -	//
    -	// Currently the only thing that 5.0.0 doesn't support is empty
    -	// LZMA2 Block. This decoder bug was fixed in 5.0.2.
    -	{
    -		size_t i = 0;
    -		while (filters[i + 1].id != LZMA_VLI_UNKNOWN)
    -			++i;
    -
    -		if (filters[i].id == LZMA_FILTER_LZMA2
    -				&& iter->block.uncompressed_size == 0
    -				&& xfi->min_version < 50000022U)
    -			xfi->min_version = 50000022U;
    -	}
    -
    -	// Convert the filter chain to human readable form.
    -	message_filters_to_str(bhi->filter_chain, filters, false);
    -
    -	// Free the memory allocated by lzma_block_header_decode().
    -	for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i)
    -		free(filters[i].options);
    -
    -	return false;
    -
    -data_error:
    -	// Show the error message.
    -	message_error("%s: %s", pair->src_name,
    -			message_strm(LZMA_DATA_ERROR));
    -	return true;
    -}
    -
    -
    -/// \brief      Parse the Check field and put it into check_value[]
    -///
    -/// \return     False on success, true on error.
    -static bool
    -parse_check_value(file_pair *pair, const lzma_index_iter *iter)
    -{
    -	// Don't read anything from the file if there is no integrity Check.
    -	if (iter->stream.flags->check == LZMA_CHECK_NONE) {
    -		snprintf(check_value, sizeof(check_value), "---");
    -		return false;
    -	}
    -
    -	// Locate and read the Check field.
    -	const uint32_t size = lzma_check_size(iter->stream.flags->check);
    -	const off_t offset = iter->block.compressed_file_offset
    -			+ iter->block.total_size - size;
    -	io_buf buf;
    -	if (io_pread(pair, &buf, size, offset))
    -		return true;
    -
    -	// CRC32 and CRC64 are in little endian. Guess that all the future
    -	// 32-bit and 64-bit Check values are little endian too. It shouldn't
    -	// be a too big problem if this guess is wrong.
    -	if (size == 4)
    -		snprintf(check_value, sizeof(check_value),
    -				"%08" PRIx32, conv32le(buf.u32[0]));
    -	else if (size == 8)
    -		snprintf(check_value, sizeof(check_value),
    -				"%016" PRIx64, conv64le(buf.u64[0]));
    -	else
    -		for (size_t i = 0; i < size; ++i)
    -			snprintf(check_value + i * 2, 3, "%02x", buf.u8[i]);
    -
    -	return false;
    -}
    -
    -
    -/// \brief      Parse detailed information about a Block
    -///
    -/// Since this requires seek(s), listing information about all Blocks can
    -/// be slow.
    -///
    -/// \param      pair    Input file
    -/// \param      iter    Location of the Block whose Check value should
    -///                     be printed.
    -/// \param      bhi     Pointer to structure where to store the information
    -///                     about the Block Header field.
    -///
    -/// \return     False on success, true on error. If an error occurs,
    -///             the error message is printed too so the caller doesn't
    -///             need to worry about that.
    -static bool
    -parse_details(file_pair *pair, const lzma_index_iter *iter,
    -		block_header_info *bhi, xz_file_info *xfi)
    -{
    -	if (parse_block_header(pair, iter, bhi, xfi))
    -		return true;
    -
    -	if (parse_check_value(pair, iter))
    -		return true;
    -
    -	return false;
    -}
    -
    -
    -/// \brief      Get the compression ratio
    -///
    -/// This has slightly different format than that is used in message.c.
    -static const char *
    -get_ratio(uint64_t compressed_size, uint64_t uncompressed_size)
    -{
    -	if (uncompressed_size == 0)
    -		return "---";
    -
    -	const double ratio = (double)(compressed_size)
    -			/ (double)(uncompressed_size);
    -	if (ratio > 9.999)
    -		return "---";
    -
    -	static char buf[16];
    -	snprintf(buf, sizeof(buf), "%.3f", ratio);
    -	return buf;
    -}
    -
    -
    -/// \brief      Get a comma-separated list of Check names
    -///
    -/// The check names are translated with gettext except when in robot mode.
    -///
    -/// \param      buf     Buffer to hold the resulting string
    -/// \param      checks  Bit mask of Checks to print
    -/// \param      space_after_comma
    -///                     It's better to not use spaces in table-like listings,
    -///                     but in more verbose formats a space after a comma
    -///                     is good for readability.
    -static void
    -get_check_names(char buf[CHECKS_STR_SIZE],
    -		uint32_t checks, bool space_after_comma)
    -{
    -	assert(checks != 0);
    -
    -	char *pos = buf;
    -	size_t left = CHECKS_STR_SIZE;
    -
    -	const char *sep = space_after_comma ? ", " : ",";
    -	bool comma = false;
    -
    -	for (size_t i = 0; i <= LZMA_CHECK_ID_MAX; ++i) {
    -		if (checks & (UINT32_C(1) << i)) {
    -			my_snprintf(&pos, &left, "%s%s",
    -					comma ? sep : "",
    -					opt_robot ? check_names[i]
    -						: _(check_names[i]));
    -			comma = true;
    -		}
    -	}
    -
    -	return;
    -}
    -
    -
    -static bool
    -print_info_basic(const xz_file_info *xfi, file_pair *pair)
    -{
    -	static bool headings_displayed = false;
    -	if (!headings_displayed) {
    -		headings_displayed = true;
    -		// TRANSLATORS: These are column headings. From Strms (Streams)
    -		// to Ratio, the columns are right aligned. Check and Filename
    -		// are left aligned. If you need longer words, it's OK to
    -		// use two lines here. Test with "xz -l foo.xz".
    -		puts(_("Strms  Blocks   Compressed Uncompressed  Ratio  "
    -				"Check   Filename"));
    -	}
    -
    -	char checks[CHECKS_STR_SIZE];
    -	get_check_names(checks, lzma_index_checks(xfi->idx), false);
    -
    -	const char *cols[7] = {
    -		uint64_to_str(lzma_index_stream_count(xfi->idx), 0),
    -		uint64_to_str(lzma_index_block_count(xfi->idx), 1),
    -		uint64_to_nicestr(lzma_index_file_size(xfi->idx),
    -			NICESTR_B, NICESTR_TIB, false, 2),
    -		uint64_to_nicestr(lzma_index_uncompressed_size(xfi->idx),
    -			NICESTR_B, NICESTR_TIB, false, 3),
    -		get_ratio(lzma_index_file_size(xfi->idx),
    -			lzma_index_uncompressed_size(xfi->idx)),
    -		checks,
    -		pair->src_name,
    -	};
    -	printf("%*s %*s  %*s  %*s  %*s  %-*s %s\n",
    -			tuklib_mbstr_fw(cols[0], 5), cols[0],
    -			tuklib_mbstr_fw(cols[1], 7), cols[1],
    -			tuklib_mbstr_fw(cols[2], 11), cols[2],
    -			tuklib_mbstr_fw(cols[3], 11), cols[3],
    -			tuklib_mbstr_fw(cols[4], 5), cols[4],
    -			tuklib_mbstr_fw(cols[5], 7), cols[5],
    -			cols[6]);
    -
    -	return false;
    -}
    -
    -
    -static void
    -print_adv_helper(uint64_t stream_count, uint64_t block_count,
    -		uint64_t compressed_size, uint64_t uncompressed_size,
    -		uint32_t checks, uint64_t stream_padding)
    -{
    -	char checks_str[CHECKS_STR_SIZE];
    -	get_check_names(checks_str, checks, true);
    -
    -	printf(_("  Streams:            %s\n"),
    -			uint64_to_str(stream_count, 0));
    -	printf(_("  Blocks:             %s\n"),
    -			uint64_to_str(block_count, 0));
    -	printf(_("  Compressed size:    %s\n"),
    -			uint64_to_nicestr(compressed_size,
    -				NICESTR_B, NICESTR_TIB, true, 0));
    -	printf(_("  Uncompressed size:  %s\n"),
    -			uint64_to_nicestr(uncompressed_size,
    -				NICESTR_B, NICESTR_TIB, true, 0));
    -	printf(_("  Ratio:              %s\n"),
    -			get_ratio(compressed_size, uncompressed_size));
    -	printf(_("  Check:              %s\n"), checks_str);
    -	printf(_("  Stream padding:     %s\n"),
    -			uint64_to_nicestr(stream_padding,
    -				NICESTR_B, NICESTR_TIB, true, 0));
    -	return;
    -}
    -
    -
    -static bool
    -print_info_adv(xz_file_info *xfi, file_pair *pair)
    -{
    -	// Print the overall information.
    -	print_adv_helper(lzma_index_stream_count(xfi->idx),
    -			lzma_index_block_count(xfi->idx),
    -			lzma_index_file_size(xfi->idx),
    -			lzma_index_uncompressed_size(xfi->idx),
    -			lzma_index_checks(xfi->idx),
    -			xfi->stream_padding);
    -
    -	// Size of the biggest Check. This is used to calculate the width
    -	// of the CheckVal field. The table would get insanely wide if
    -	// we always reserved space for 64-byte Check (128 chars as hex).
    -	uint32_t check_max = 0;
    -
    -	// Print information about the Streams.
    -	//
    -	// TRANSLATORS: The second line is column headings. All except
    -	// Check are right aligned; Check is left aligned. Test with
    -	// "xz -lv foo.xz".
    -	puts(_("  Streams:\n    Stream    Blocks"
    -			"      CompOffset    UncompOffset"
    -			"        CompSize      UncompSize  Ratio"
    -			"  Check      Padding"));
    -
    -	lzma_index_iter iter;
    -	lzma_index_iter_init(&iter, xfi->idx);
    -
    -	while (!lzma_index_iter_next(&iter, LZMA_INDEX_ITER_STREAM)) {
    -		const char *cols1[4] = {
    -			uint64_to_str(iter.stream.number, 0),
    -			uint64_to_str(iter.stream.block_count, 1),
    -			uint64_to_str(iter.stream.compressed_offset, 2),
    -			uint64_to_str(iter.stream.uncompressed_offset, 3),
    -		};
    -		printf("    %*s %*s %*s %*s ",
    -				tuklib_mbstr_fw(cols1[0], 6), cols1[0],
    -				tuklib_mbstr_fw(cols1[1], 9), cols1[1],
    -				tuklib_mbstr_fw(cols1[2], 15), cols1[2],
    -				tuklib_mbstr_fw(cols1[3], 15), cols1[3]);
    -
    -		const char *cols2[5] = {
    -			uint64_to_str(iter.stream.compressed_size, 0),
    -			uint64_to_str(iter.stream.uncompressed_size, 1),
    -			get_ratio(iter.stream.compressed_size,
    -				iter.stream.uncompressed_size),
    -			_(check_names[iter.stream.flags->check]),
    -			uint64_to_str(iter.stream.padding, 2),
    -		};
    -		printf("%*s %*s  %*s  %-*s %*s\n",
    -				tuklib_mbstr_fw(cols2[0], 15), cols2[0],
    -				tuklib_mbstr_fw(cols2[1], 15), cols2[1],
    -				tuklib_mbstr_fw(cols2[2], 5), cols2[2],
    -				tuklib_mbstr_fw(cols2[3], 10), cols2[3],
    -				tuklib_mbstr_fw(cols2[4], 7), cols2[4]);
    -
    -		// Update the maximum Check size.
    -		if (lzma_check_size(iter.stream.flags->check) > check_max)
    -			check_max = lzma_check_size(iter.stream.flags->check);
    -	}
    -
    -	// Cache the verbosity level to a local variable.
    -	const bool detailed = message_verbosity_get() >= V_DEBUG;
    -
    -	// Information collected from Block Headers
    -	block_header_info bhi;
    -
    -	// Print information about the Blocks but only if there is
    -	// at least one Block.
    -	if (lzma_index_block_count(xfi->idx) > 0) {
    -		// Calculate the width of the CheckVal field.
    -		const int checkval_width = my_max(8, 2 * check_max);
    -
    -		// TRANSLATORS: The second line is column headings. All
    -		// except Check are right aligned; Check is left aligned.
    -		printf(_("  Blocks:\n    Stream     Block"
    -			"      CompOffset    UncompOffset"
    -			"       TotalSize      UncompSize  Ratio  Check"));
    -
    -		if (detailed) {
    -			// TRANSLATORS: These are additional column headings
    -			// for the most verbose listing mode. CheckVal
    -			// (Check value), Flags, and Filters are left aligned.
    -			// Header (Block Header Size), CompSize, and MemUsage
    -			// are right aligned. %*s is replaced with 0-120
    -			// spaces to make the CheckVal column wide enough.
    -			// Test with "xz -lvv foo.xz".
    -			printf(_("      CheckVal %*s Header  Flags        "
    -					"CompSize    MemUsage  Filters"),
    -					checkval_width - 8, "");
    -		}
    -
    -		putchar('\n');
    -
    -		lzma_index_iter_init(&iter, xfi->idx);
    -
    -		// Iterate over the Blocks.
    -		while (!lzma_index_iter_next(&iter, LZMA_INDEX_ITER_BLOCK)) {
    -			if (detailed && parse_details(pair, &iter, &bhi, xfi))
    -					return true;
    -
    -			const char *cols1[4] = {
    -				uint64_to_str(iter.stream.number, 0),
    -				uint64_to_str(
    -					iter.block.number_in_stream, 1),
    -				uint64_to_str(
    -					iter.block.compressed_file_offset, 2),
    -				uint64_to_str(
    -					iter.block.uncompressed_file_offset, 3)
    -			};
    -			printf("    %*s %*s %*s %*s ",
    -				tuklib_mbstr_fw(cols1[0], 6), cols1[0],
    -				tuklib_mbstr_fw(cols1[1], 9), cols1[1],
    -				tuklib_mbstr_fw(cols1[2], 15), cols1[2],
    -				tuklib_mbstr_fw(cols1[3], 15), cols1[3]);
    -
    -			const char *cols2[4] = {
    -				uint64_to_str(iter.block.total_size, 0),
    -				uint64_to_str(iter.block.uncompressed_size,
    -						1),
    -				get_ratio(iter.block.total_size,
    -					iter.block.uncompressed_size),
    -				_(check_names[iter.stream.flags->check])
    -			};
    -			printf("%*s %*s  %*s  %-*s",
    -				tuklib_mbstr_fw(cols2[0], 15), cols2[0],
    -				tuklib_mbstr_fw(cols2[1], 15), cols2[1],
    -				tuklib_mbstr_fw(cols2[2], 5), cols2[2],
    -				tuklib_mbstr_fw(cols2[3], detailed ? 11 : 1),
    -					cols2[3]);
    -
    -			if (detailed) {
    -				const lzma_vli compressed_size
    -						= iter.block.unpadded_size
    -						- bhi.header_size
    -						- lzma_check_size(
    -						iter.stream.flags->check);
    -
    -				const char *cols3[6] = {
    -					check_value,
    -					uint64_to_str(bhi.header_size, 0),
    -					bhi.flags,
    -					uint64_to_str(compressed_size, 1),
    -					uint64_to_str(
    -						round_up_to_mib(bhi.memusage),
    -						2),
    -					bhi.filter_chain
    -				};
    -				// Show MiB for memory usage, because it
    -				// is the only size which is not in bytes.
    -				printf("%-*s  %*s  %-5s %*s %*s MiB  %s",
    -					checkval_width, cols3[0],
    -					tuklib_mbstr_fw(cols3[1], 6), cols3[1],
    -					cols3[2],
    -					tuklib_mbstr_fw(cols3[3], 15),
    -						cols3[3],
    -					tuklib_mbstr_fw(cols3[4], 7), cols3[4],
    -					cols3[5]);
    -			}
    -
    -			putchar('\n');
    -		}
    -	}
    -
    -	if (detailed) {
    -		printf(_("  Memory needed:      %s MiB\n"), uint64_to_str(
    -				round_up_to_mib(xfi->memusage_max), 0));
    -		printf(_("  Sizes in headers:   %s\n"),
    -				xfi->all_have_sizes ? _("Yes") : _("No"));
    -		printf(_("  Minimum XZ Utils version: %s\n"),
    -				xz_ver_to_str(xfi->min_version));
    -	}
    -
    -	return false;
    -}
    -
    -
    -static bool
    -print_info_robot(xz_file_info *xfi, file_pair *pair)
    -{
    -	char checks[CHECKS_STR_SIZE];
    -	get_check_names(checks, lzma_index_checks(xfi->idx), false);
    -
    -	printf("name\t%s\n", pair->src_name);
    -
    -	printf("file\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64
    -			"\t%s\t%s\t%" PRIu64 "\n",
    -			lzma_index_stream_count(xfi->idx),
    -			lzma_index_block_count(xfi->idx),
    -			lzma_index_file_size(xfi->idx),
    -			lzma_index_uncompressed_size(xfi->idx),
    -			get_ratio(lzma_index_file_size(xfi->idx),
    -				lzma_index_uncompressed_size(xfi->idx)),
    -			checks,
    -			xfi->stream_padding);
    -
    -	if (message_verbosity_get() >= V_VERBOSE) {
    -		lzma_index_iter iter;
    -		lzma_index_iter_init(&iter, xfi->idx);
    -
    -		while (!lzma_index_iter_next(&iter, LZMA_INDEX_ITER_STREAM))
    -			printf("stream\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64
    -				"\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64
    -				"\t%s\t%s\t%" PRIu64 "\n",
    -				iter.stream.number,
    -				iter.stream.block_count,
    -				iter.stream.compressed_offset,
    -				iter.stream.uncompressed_offset,
    -				iter.stream.compressed_size,
    -				iter.stream.uncompressed_size,
    -				get_ratio(iter.stream.compressed_size,
    -					iter.stream.uncompressed_size),
    -				check_names[iter.stream.flags->check],
    -				iter.stream.padding);
    -
    -		lzma_index_iter_rewind(&iter);
    -		block_header_info bhi;
    -
    -		while (!lzma_index_iter_next(&iter, LZMA_INDEX_ITER_BLOCK)) {
    -			if (message_verbosity_get() >= V_DEBUG
    -					&& parse_details(
    -						pair, &iter, &bhi, xfi))
    -				return true;
    -
    -			printf("block\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64
    -					"\t%" PRIu64 "\t%" PRIu64
    -					"\t%" PRIu64 "\t%" PRIu64 "\t%s\t%s",
    -					iter.stream.number,
    -					iter.block.number_in_stream,
    -					iter.block.number_in_file,
    -					iter.block.compressed_file_offset,
    -					iter.block.uncompressed_file_offset,
    -					iter.block.total_size,
    -					iter.block.uncompressed_size,
    -					get_ratio(iter.block.total_size,
    -						iter.block.uncompressed_size),
    -					check_names[iter.stream.flags->check]);
    -
    -			if (message_verbosity_get() >= V_DEBUG)
    -				printf("\t%s\t%" PRIu32 "\t%s\t%" PRIu64
    -						"\t%" PRIu64 "\t%s",
    -						check_value,
    -						bhi.header_size,
    -						bhi.flags,
    -						bhi.compressed_size,
    -						bhi.memusage,
    -						bhi.filter_chain);
    -
    -			putchar('\n');
    -		}
    -	}
    -
    -	if (message_verbosity_get() >= V_DEBUG)
    -		printf("summary\t%" PRIu64 "\t%s\t%" PRIu32 "\n",
    -				xfi->memusage_max,
    -				xfi->all_have_sizes ? "yes" : "no",
    -				xfi->min_version);
    -
    -	return false;
    -}
    -
    -
    -static void
    -update_totals(const xz_file_info *xfi)
    -{
    -	// TODO: Integer overflow checks
    -	++totals.files;
    -	totals.streams += lzma_index_stream_count(xfi->idx);
    -	totals.blocks += lzma_index_block_count(xfi->idx);
    -	totals.compressed_size += lzma_index_file_size(xfi->idx);
    -	totals.uncompressed_size += lzma_index_uncompressed_size(xfi->idx);
    -	totals.stream_padding += xfi->stream_padding;
    -	totals.checks |= lzma_index_checks(xfi->idx);
    -
    -	if (totals.memusage_max < xfi->memusage_max)
    -		totals.memusage_max = xfi->memusage_max;
    -
    -	if (totals.min_version < xfi->min_version)
    -		totals.min_version = xfi->min_version;
    -
    -	totals.all_have_sizes &= xfi->all_have_sizes;
    -
    -	return;
    -}
    -
    -
    -static void
    -print_totals_basic(void)
    -{
    -	// Print a separator line.
    -	char line[80];
    -	memset(line, '-', sizeof(line));
    -	line[sizeof(line) - 1] = '\0';
    -	puts(line);
    -
    -	// Get the check names.
    -	char checks[CHECKS_STR_SIZE];
    -	get_check_names(checks, totals.checks, false);
    -
    -	// Print the totals except the file count, which needs
    -	// special handling.
    -	printf("%5s %7s  %11s  %11s  %5s  %-7s ",
    -			uint64_to_str(totals.streams, 0),
    -			uint64_to_str(totals.blocks, 1),
    -			uint64_to_nicestr(totals.compressed_size,
    -				NICESTR_B, NICESTR_TIB, false, 2),
    -			uint64_to_nicestr(totals.uncompressed_size,
    -				NICESTR_B, NICESTR_TIB, false, 3),
    -			get_ratio(totals.compressed_size,
    -				totals.uncompressed_size),
    -			checks);
    -
    -	// Since we print totals only when there are at least two files,
    -	// the English message will always use "%s files". But some other
    -	// languages need different forms for different plurals so we
    -	// have to translate this with ngettext().
    -	//
    -	// TRANSLATORS: %s is an integer. Only the plural form of this
    -	// message is used (e.g. "2 files"). Test with "xz -l foo.xz bar.xz".
    -	printf(ngettext("%s file\n", "%s files\n",
    -			totals.files <= ULONG_MAX ? totals.files
    -				: (totals.files % 1000000) + 1000000),
    -			uint64_to_str(totals.files, 0));
    -
    -	return;
    -}
    -
    -
    -static void
    -print_totals_adv(void)
    -{
    -	putchar('\n');
    -	puts(_("Totals:"));
    -	printf(_("  Number of files:    %s\n"),
    -			uint64_to_str(totals.files, 0));
    -	print_adv_helper(totals.streams, totals.blocks,
    -			totals.compressed_size, totals.uncompressed_size,
    -			totals.checks, totals.stream_padding);
    -
    -	if (message_verbosity_get() >= V_DEBUG) {
    -		printf(_("  Memory needed:      %s MiB\n"), uint64_to_str(
    -				round_up_to_mib(totals.memusage_max), 0));
    -		printf(_("  Sizes in headers:   %s\n"),
    -				totals.all_have_sizes ? _("Yes") : _("No"));
    -		printf(_("  Minimum XZ Utils version: %s\n"),
    -				xz_ver_to_str(totals.min_version));
    -	}
    -
    -	return;
    -}
    -
    -
    -static void
    -print_totals_robot(void)
    -{
    -	char checks[CHECKS_STR_SIZE];
    -	get_check_names(checks, totals.checks, false);
    -
    -	printf("totals\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64 "\t%" PRIu64
    -			"\t%s\t%s\t%" PRIu64 "\t%" PRIu64,
    -			totals.streams,
    -			totals.blocks,
    -			totals.compressed_size,
    -			totals.uncompressed_size,
    -			get_ratio(totals.compressed_size,
    -				totals.uncompressed_size),
    -			checks,
    -			totals.stream_padding,
    -			totals.files);
    -
    -	if (message_verbosity_get() >= V_DEBUG)
    -		printf("\t%" PRIu64 "\t%s\t%" PRIu32,
    -				totals.memusage_max,
    -				totals.all_have_sizes ? "yes" : "no",
    -				totals.min_version);
    -
    -	putchar('\n');
    -
    -	return;
    -}
    -
    -
    -extern void
    -list_totals(void)
    -{
    -	if (opt_robot) {
    -		// Always print totals in --robot mode. It can be convenient
    -		// in some cases and doesn't complicate usage of the
    -		// single-file case much.
    -		print_totals_robot();
    -
    -	} else if (totals.files > 1) {
    -		// For non-robot mode, totals are printed only if there
    -		// is more than one file.
    -		if (message_verbosity_get() <= V_WARNING)
    -			print_totals_basic();
    -		else
    -			print_totals_adv();
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -list_file(const char *filename)
    -{
    -	if (opt_format != FORMAT_XZ && opt_format != FORMAT_AUTO)
    -		message_fatal(_("--list works only on .xz files "
    -				"(--format=xz or --format=auto)"));
    -
    -	message_filename(filename);
    -
    -	if (filename == stdin_filename) {
    -		message_error(_("--list does not support reading from "
    -				"standard input"));
    -		return;
    -	}
    -
    -	// Unset opt_stdout so that io_open_src() won't accept special files.
    -	// Set opt_force so that io_open_src() will follow symlinks.
    -	opt_stdout = false;
    -	opt_force = true;
    -	file_pair *pair = io_open_src(filename);
    -	if (pair == NULL)
    -		return;
    -
    -	xz_file_info xfi = XZ_FILE_INFO_INIT;
    -	if (!parse_indexes(&xfi, pair)) {
    -		bool fail;
    -
    -		// We have three main modes:
    -		//  - --robot, which has submodes if --verbose is specified
    -		//    once or twice
    -		//  - Normal --list without --verbose
    -		//  - --list with one or two --verbose
    -		if (opt_robot)
    -			fail = print_info_robot(&xfi, pair);
    -		else if (message_verbosity_get() <= V_WARNING)
    -			fail = print_info_basic(&xfi, pair);
    -		else
    -			fail = print_info_adv(&xfi, pair);
    -
    -		// Update the totals that are displayed after all
    -		// the individual files have been listed. Don't count
    -		// broken files.
    -		if (!fail)
    -			update_totals(&xfi);
    -
    -		lzma_index_end(xfi.idx, NULL);
    -	}
    -
    -	io_close(pair, false);
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/list.h b/external/public-domain/xz/dist/src/xz/list.h
    deleted file mode 100644
    index a4c6ec7dc..000000000
    --- a/external/public-domain/xz/dist/src/xz/list.h
    +++ /dev/null
    @@ -1,18 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       list.h
    -/// \brief      List information about .xz files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -/// \brief      List information about the given .xz file
    -extern void list_file(const char *filename);
    -
    -
    -/// \brief      Show the totals after all files have been listed
    -extern void list_totals(void);
    diff --git a/external/public-domain/xz/dist/src/xz/main.c b/external/public-domain/xz/dist/src/xz/main.c
    deleted file mode 100644
    index a8f0683a4..000000000
    --- a/external/public-domain/xz/dist/src/xz/main.c
    +++ /dev/null
    @@ -1,307 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       main.c
    -/// \brief      main()
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -#include 
    -
    -/// Exit status to use. This can be changed with set_exit_status().
    -static enum exit_status_type exit_status = E_SUCCESS;
    -
    -#if defined(_WIN32) && !defined(__CYGWIN__)
    -/// exit_status has to be protected with a critical section due to
    -/// how "signal handling" is done on Windows. See signals.c for details.
    -static CRITICAL_SECTION exit_status_cs;
    -#endif
    -
    -/// True if --no-warn is specified. When this is true, we don't set
    -/// the exit status to E_WARNING when something worth a warning happens.
    -static bool no_warn = false;
    -
    -
    -extern void
    -set_exit_status(enum exit_status_type new_status)
    -{
    -	assert(new_status == E_WARNING || new_status == E_ERROR);
    -
    -#if defined(_WIN32) && !defined(__CYGWIN__)
    -	EnterCriticalSection(&exit_status_cs);
    -#endif
    -
    -	if (exit_status != E_ERROR)
    -		exit_status = new_status;
    -
    -#if defined(_WIN32) && !defined(__CYGWIN__)
    -	LeaveCriticalSection(&exit_status_cs);
    -#endif
    -
    -	return;
    -}
    -
    -
    -extern void
    -set_exit_no_warn(void)
    -{
    -	no_warn = true;
    -	return;
    -}
    -
    -
    -static const char *
    -read_name(const args_info *args)
    -{
    -	// FIXME: Maybe we should have some kind of memory usage limit here
    -	// like the tool has for the actual compression and decompression.
    -	// Giving some huge text file with --files0 makes us to read the
    -	// whole file in RAM.
    -	static char *name = NULL;
    -	static size_t size = 256;
    -
    -	// Allocate the initial buffer. This is never freed, since after it
    -	// is no longer needed, the program exits very soon. It is safe to
    -	// use xmalloc() and xrealloc() in this function, because while
    -	// executing this function, no files are open for writing, and thus
    -	// there's no need to cleanup anything before exiting.
    -	if (name == NULL)
    -		name = xmalloc(size);
    -
    -	// Write position in name
    -	size_t pos = 0;
    -
    -	// Read one character at a time into name.
    -	while (!user_abort) {
    -		const int c = fgetc(args->files_file);
    -
    -		if (ferror(args->files_file)) {
    -			// Take care of EINTR since we have established
    -			// the signal handlers already.
    -			if (errno == EINTR)
    -				continue;
    -
    -			message_error(_("%s: Error reading filenames: %s"),
    -					args->files_name, strerror(errno));
    -			return NULL;
    -		}
    -
    -		if (feof(args->files_file)) {
    -			if (pos != 0)
    -				message_error(_("%s: Unexpected end of input "
    -						"when reading filenames"),
    -						args->files_name);
    -
    -			return NULL;
    -		}
    -
    -		if (c == args->files_delim) {
    -			// We allow consecutive newline (--files) or '\0'
    -			// characters (--files0), and ignore such empty
    -			// filenames.
    -			if (pos == 0)
    -				continue;
    -
    -			// A non-empty name was read. Terminate it with '\0'
    -			// and return it.
    -			name[pos] = '\0';
    -			return name;
    -		}
    -
    -		if (c == '\0') {
    -			// A null character was found when using --files,
    -			// which expects plain text input separated with
    -			// newlines.
    -			message_error(_("%s: Null character found when "
    -					"reading filenames; maybe you meant "
    -					"to use `--files0' instead "
    -					"of `--files'?"), args->files_name);
    -			return NULL;
    -		}
    -
    -		name[pos++] = c;
    -
    -		// Allocate more memory if needed. There must always be space
    -		// at least for one character to allow terminating the string
    -		// with '\0'.
    -		if (pos == size) {
    -			size *= 2;
    -			name = xrealloc(name, size);
    -		}
    -	}
    -
    -	return NULL;
    -}
    -
    -
    -int
    -main(int argc, char **argv)
    -{
    -#if defined(_WIN32) && !defined(__CYGWIN__)
    -	InitializeCriticalSection(&exit_status_cs);
    -#endif
    -
    -	// Set up the progname variable.
    -	tuklib_progname_init(argv);
    -
    -	// Initialize the file I/O. This makes sure that
    -	// stdin, stdout, and stderr are something valid.
    -	io_init();
    -
    -	// Set up the locale and message translations.
    -	tuklib_gettext_init(PACKAGE, LOCALEDIR);
    -
    -	// Initialize handling of error/warning/other messages.
    -	message_init();
    -
    -	// Set hardware-dependent default values. These can be overriden
    -	// on the command line, thus this must be done before args_parse().
    -	hardware_init();
    -
    -	// Parse the command line arguments and get an array of filenames.
    -	// This doesn't return if something is wrong with the command line
    -	// arguments. If there are no arguments, one filename ("-") is still
    -	// returned to indicate stdin.
    -	args_info args;
    -	args_parse(&args, argc, argv);
    -
    -	if (opt_mode != MODE_LIST && opt_robot)
    -		message_fatal(_("Compression and decompression with --robot "
    -			"are not supported yet."));
    -
    -	// Tell the message handling code how many input files there are if
    -	// we know it. This way the progress indicator can show it.
    -	if (args.files_name != NULL)
    -		message_set_files(0);
    -	else
    -		message_set_files(args.arg_count);
    -
    -	// Refuse to write compressed data to standard output if it is
    -	// a terminal.
    -	if (opt_mode == MODE_COMPRESS) {
    -		if (opt_stdout || (args.arg_count == 1
    -				&& strcmp(args.arg_names[0], "-") == 0)) {
    -			if (is_tty_stdout()) {
    -				message_try_help();
    -				tuklib_exit(E_ERROR, E_ERROR, false);
    -			}
    -		}
    -	}
    -
    -	// Set up the signal handlers. We don't need these before we
    -	// start the actual action and not in --list mode, so this is
    -	// done after parsing the command line arguments.
    -	//
    -	// It's good to keep signal handlers in normal compression and
    -	// decompression modes even when only writing to stdout, because
    -	// we might need to restore O_APPEND flag on stdout before exiting.
    -	// In --test mode, signal handlers aren't really needed, but let's
    -	// keep them there for consistency with normal decompression.
    -	if (opt_mode != MODE_LIST)
    -		signals_init();
    -
    -	// coder_run() handles compression, decompression, and testing.
    -	// list_file() is for --list.
    -	void (*run)(const char *filename) = opt_mode == MODE_LIST
    -			 ? &list_file : &coder_run;
    -
    -	// Process the files given on the command line. Note that if no names
    -	// were given, args_parse() gave us a fake "-" filename.
    -	for (size_t i = 0; i < args.arg_count && !user_abort; ++i) {
    -		if (strcmp("-", args.arg_names[i]) == 0) {
    -			// Processing from stdin to stdout. Check that we
    -			// aren't writing compressed data to a terminal or
    -			// reading it from a terminal.
    -			if (opt_mode == MODE_COMPRESS) {
    -				if (is_tty_stdout())
    -					continue;
    -			} else if (is_tty_stdin()) {
    -				continue;
    -			}
    -
    -			// It doesn't make sense to compress data from stdin
    -			// if we are supposed to read filenames from stdin
    -			// too (enabled with --files or --files0).
    -			if (args.files_name == stdin_filename) {
    -				message_error(_("Cannot read data from "
    -						"standard input when "
    -						"reading filenames "
    -						"from standard input"));
    -				continue;
    -			}
    -
    -			// Replace the "-" with a special pointer, which is
    -			// recognized by coder_run() and other things.
    -			// This way error messages get a proper filename
    -			// string and the code still knows that it is
    -			// handling the special case of stdin.
    -			args.arg_names[i] = (char *)stdin_filename;
    -		}
    -
    -		// Do the actual compression or decompression.
    -		run(args.arg_names[i]);
    -	}
    -
    -	// If --files or --files0 was used, process the filenames from the
    -	// given file or stdin. Note that here we don't consider "-" to
    -	// indicate stdin like we do with the command line arguments.
    -	if (args.files_name != NULL) {
    -		// read_name() checks for user_abort so we don't need to
    -		// check it as loop termination condition.
    -		while (true) {
    -			const char *name = read_name(&args);
    -			if (name == NULL)
    -				break;
    -
    -			// read_name() doesn't return empty names.
    -			assert(name[0] != '\0');
    -			run(name);
    -		}
    -
    -		if (args.files_name != stdin_filename)
    -			(void)fclose(args.files_file);
    -	}
    -
    -	// All files have now been handled. If in --list mode, display
    -	// the totals before exiting. We don't have signal handlers
    -	// enabled in --list mode, so we don't need to check user_abort.
    -	if (opt_mode == MODE_LIST) {
    -		assert(!user_abort);
    -		list_totals();
    -	}
    -
    -#ifndef NDEBUG
    -	coder_free();
    -	args_free();
    -#endif
    -
    -	// If we have got a signal, raise it to kill the program instead
    -	// of calling tuklib_exit().
    -	signals_exit();
    -
    -	// Make a local copy of exit_status to keep the Windows code
    -	// thread safe. At this point it is fine if we miss the user
    -	// pressing C-c and don't set the exit_status to E_ERROR on
    -	// Windows.
    -#if defined(_WIN32) && !defined(__CYGWIN__)
    -	EnterCriticalSection(&exit_status_cs);
    -#endif
    -
    -	enum exit_status_type es = exit_status;
    -
    -#if defined(_WIN32) && !defined(__CYGWIN__)
    -	LeaveCriticalSection(&exit_status_cs);
    -#endif
    -
    -	// Suppress the exit status indicating a warning if --no-warn
    -	// was specified.
    -	if (es == E_WARNING && no_warn)
    -		es = E_SUCCESS;
    -
    -	tuklib_exit(es, E_ERROR, message_verbosity_get() != V_SILENT);
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/main.h b/external/public-domain/xz/dist/src/xz/main.h
    deleted file mode 100644
    index 323f2f7d0..000000000
    --- a/external/public-domain/xz/dist/src/xz/main.h
    +++ /dev/null
    @@ -1,30 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       main.h
    -/// \brief      Miscellaneous declarations
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -/// Possible exit status values. These are the same as used by gzip and bzip2.
    -enum exit_status_type {
    -	E_SUCCESS  = 0,
    -	E_ERROR    = 1,
    -	E_WARNING  = 2,
    -};
    -
    -
    -/// Sets the exit status after a warning or error has occurred. If new_status
    -/// is E_WARNING and the old exit status was already E_ERROR, the exit
    -/// status is not changed.
    -extern void set_exit_status(enum exit_status_type new_status);
    -
    -
    -/// Use E_SUCCESS instead of E_WARNING if something worth a warning occurs
    -/// but nothing worth an error has occurred. This is called when --no-warn
    -/// is specified.
    -extern void set_exit_no_warn(void);
    diff --git a/external/public-domain/xz/dist/src/xz/message.c b/external/public-domain/xz/dist/src/xz/message.c
    deleted file mode 100644
    index 8a31b00ed..000000000
    --- a/external/public-domain/xz/dist/src/xz/message.c
    +++ /dev/null
    @@ -1,1257 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       message.c
    -/// \brief      Printing messages
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -#include 
    -
    -
    -/// Number of the current file
    -static unsigned int files_pos = 0;
    -
    -/// Total number of input files; zero if unknown.
    -static unsigned int files_total;
    -
    -/// Verbosity level
    -static enum message_verbosity verbosity = V_WARNING;
    -
    -/// Filename which we will print with the verbose messages
    -static const char *filename;
    -
    -/// True once the a filename has been printed to stderr as part of progress
    -/// message. If automatic progress updating isn't enabled, this becomes true
    -/// after the first progress message has been printed due to user sending
    -/// SIGINFO, SIGUSR1, or SIGALRM. Once this variable is true, we will print
    -/// an empty line before the next filename to make the output more readable.
    -static bool first_filename_printed = false;
    -
    -/// This is set to true when we have printed the current filename to stderr
    -/// as part of a progress message. This variable is useful only if not
    -/// updating progress automatically: if user sends many SIGINFO, SIGUSR1, or
    -/// SIGALRM signals, we won't print the name of the same file multiple times.
    -static bool current_filename_printed = false;
    -
    -/// True if we should print progress indicator and update it automatically
    -/// if also verbose >= V_VERBOSE.
    -static bool progress_automatic;
    -
    -/// True if message_progress_start() has been called but
    -/// message_progress_end() hasn't been called yet.
    -static bool progress_started = false;
    -
    -/// This is true when a progress message was printed and the cursor is still
    -/// on the same line with the progress message. In that case, a newline has
    -/// to be printed before any error messages.
    -static bool progress_active = false;
    -
    -/// Pointer to lzma_stream used to do the encoding or decoding.
    -static lzma_stream *progress_strm;
    -
    -/// Expected size of the input stream is needed to show completion percentage
    -/// and estimate remaining time.
    -static uint64_t expected_in_size;
    -
    -
    -// Use alarm() and SIGALRM when they are supported. This has two minor
    -// advantages over the alternative of polling gettimeofday():
    -//  - It is possible for the user to send SIGINFO, SIGUSR1, or SIGALRM to
    -//    get intermediate progress information even when --verbose wasn't used
    -//    or stderr is not a terminal.
    -//  - alarm() + SIGALRM seems to have slightly less overhead than polling
    -//    gettimeofday().
    -#ifdef SIGALRM
    -
    -const int message_progress_sigs[] = {
    -	SIGALRM,
    -#ifdef SIGINFO
    -	SIGINFO,
    -#endif
    -#ifdef SIGUSR1
    -	SIGUSR1,
    -#endif
    -	0
    -};
    -
    -/// The signal handler for SIGALRM sets this to true. It is set back to false
    -/// once the progress message has been updated.
    -static volatile sig_atomic_t progress_needs_updating = false;
    -
    -/// Signal handler for SIGALRM
    -static void
    -progress_signal_handler(int sig lzma_attribute((__unused__)))
    -{
    -	progress_needs_updating = true;
    -	return;
    -}
    -
    -#else
    -
    -/// This is true when progress message printing is wanted. Using the same
    -/// variable name as above to avoid some ifdefs.
    -static bool progress_needs_updating = false;
    -
    -/// Elapsed time when the next progress message update should be done.
    -static uint64_t progress_next_update;
    -
    -#endif
    -
    -
    -extern void
    -message_init(void)
    -{
    -	// If --verbose is used, we use a progress indicator if and only
    -	// if stderr is a terminal. If stderr is not a terminal, we print
    -	// verbose information only after finishing the file. As a special
    -	// exception, even if --verbose was not used, user can send SIGALRM
    -	// to make us print progress information once without automatic
    -	// updating.
    -	progress_automatic = isatty(STDERR_FILENO);
    -
    -	// Commented out because COLUMNS is rarely exported to environment.
    -	// Most users have at least 80 columns anyway, let's think something
    -	// fancy here if enough people complain.
    -/*
    -	if (progress_automatic) {
    -		// stderr is a terminal. Check the COLUMNS environment
    -		// variable to see if the terminal is wide enough. If COLUMNS
    -		// doesn't exist or it has some unparsable value, we assume
    -		// that the terminal is wide enough.
    -		const char *columns_str = getenv("COLUMNS");
    -		if (columns_str != NULL) {
    -			char *endptr;
    -			const long columns = strtol(columns_str, &endptr, 10);
    -			if (*endptr != '\0' || columns < 80)
    -				progress_automatic = false;
    -		}
    -	}
    -*/
    -
    -#ifdef SIGALRM
    -	// Establish the signal handlers which set a flag to tell us that
    -	// progress info should be updated.
    -	struct sigaction sa;
    -	sigemptyset(&sa.sa_mask);
    -	sa.sa_flags = 0;
    -	sa.sa_handler = &progress_signal_handler;
    -
    -	for (size_t i = 0; message_progress_sigs[i] != 0; ++i)
    -		if (sigaction(message_progress_sigs[i], &sa, NULL))
    -			message_signal_handler();
    -#endif
    -
    -	return;
    -}
    -
    -
    -extern void
    -message_verbosity_increase(void)
    -{
    -	if (verbosity < V_DEBUG)
    -		++verbosity;
    -
    -	return;
    -}
    -
    -
    -extern void
    -message_verbosity_decrease(void)
    -{
    -	if (verbosity > V_SILENT)
    -		--verbosity;
    -
    -	return;
    -}
    -
    -
    -extern enum message_verbosity
    -message_verbosity_get(void)
    -{
    -	return verbosity;
    -}
    -
    -
    -extern void
    -message_set_files(unsigned int files)
    -{
    -	files_total = files;
    -	return;
    -}
    -
    -
    -/// Prints the name of the current file if it hasn't been printed already,
    -/// except if we are processing exactly one stream from stdin to stdout.
    -/// I think it looks nicer to not print "(stdin)" when --verbose is used
    -/// in a pipe and no other files are processed.
    -static void
    -print_filename(void)
    -{
    -	if (!opt_robot && (files_total != 1 || filename != stdin_filename)) {
    -		signals_block();
    -
    -		FILE *file = opt_mode == MODE_LIST ? stdout : stderr;
    -
    -		// If a file was already processed, put an empty line
    -		// before the next filename to improve readability.
    -		if (first_filename_printed)
    -			fputc('\n', file);
    -
    -		first_filename_printed = true;
    -		current_filename_printed = true;
    -
    -		// If we don't know how many files there will be due
    -		// to usage of --files or --files0.
    -		if (files_total == 0)
    -			fprintf(file, "%s (%u)\n", filename,
    -					files_pos);
    -		else
    -			fprintf(file, "%s (%u/%u)\n", filename,
    -					files_pos, files_total);
    -
    -		signals_unblock();
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -message_filename(const char *src_name)
    -{
    -	// Start numbering the files starting from one.
    -	++files_pos;
    -	filename = src_name;
    -
    -	if (verbosity >= V_VERBOSE
    -			&& (progress_automatic || opt_mode == MODE_LIST))
    -		print_filename();
    -	else
    -		current_filename_printed = false;
    -
    -	return;
    -}
    -
    -
    -extern void
    -message_progress_start(lzma_stream *strm, uint64_t in_size)
    -{
    -	// Store the pointer to the lzma_stream used to do the coding.
    -	// It is needed to find out the position in the stream.
    -	progress_strm = strm;
    -
    -	// Store the expected size of the file. If we aren't printing any
    -	// statistics, then is will be unused. But since it is possible
    -	// that the user sends us a signal to show statistics, we need
    -	// to have it available anyway.
    -	expected_in_size = in_size;
    -
    -	// Indicate that progress info may need to be printed before
    -	// printing error messages.
    -	progress_started = true;
    -
    -	// If progress indicator is wanted, print the filename and possibly
    -	// the file count now.
    -	if (verbosity >= V_VERBOSE && progress_automatic) {
    -		// Start the timer to display the first progress message
    -		// after one second. An alternative would be to show the
    -		// first message almost immediately, but delaying by one
    -		// second looks better to me, since extremely early
    -		// progress info is pretty much useless.
    -#ifdef SIGALRM
    -		// First disable a possibly existing alarm.
    -		alarm(0);
    -		progress_needs_updating = false;
    -		alarm(1);
    -#else
    -		progress_needs_updating = true;
    -		progress_next_update = 1000;
    -#endif
    -	}
    -
    -	return;
    -}
    -
    -
    -/// Make the string indicating completion percentage.
    -static const char *
    -progress_percentage(uint64_t in_pos)
    -{
    -	// If the size of the input file is unknown or the size told us is
    -	// clearly wrong since we have processed more data than the alleged
    -	// size of the file, show a static string indicating that we have
    -	// no idea of the completion percentage.
    -	if (expected_in_size == 0 || in_pos > expected_in_size)
    -		return "--- %";
    -
    -	// Never show 100.0 % before we actually are finished.
    -	double percentage = (double)(in_pos) / (double)(expected_in_size)
    -			* 99.9;
    -
    -	// Use big enough buffer to hold e.g. a multibyte decimal point.
    -	static char buf[16];
    -	snprintf(buf, sizeof(buf), "%.1f %%", percentage);
    -
    -	return buf;
    -}
    -
    -
    -/// Make the string containing the amount of input processed, amount of
    -/// output produced, and the compression ratio.
    -static const char *
    -progress_sizes(uint64_t compressed_pos, uint64_t uncompressed_pos, bool final)
    -{
    -	// Use big enough buffer to hold e.g. a multibyte thousand separators.
    -	static char buf[128];
    -	char *pos = buf;
    -	size_t left = sizeof(buf);
    -
    -	// Print the sizes. If this the final message, use more reasonable
    -	// units than MiB if the file was small.
    -	const enum nicestr_unit unit_min = final ? NICESTR_B : NICESTR_MIB;
    -	my_snprintf(&pos, &left, "%s / %s",
    -			uint64_to_nicestr(compressed_pos,
    -				unit_min, NICESTR_TIB, false, 0),
    -			uint64_to_nicestr(uncompressed_pos,
    -				unit_min, NICESTR_TIB, false, 1));
    -
    -	// Avoid division by zero. If we cannot calculate the ratio, set
    -	// it to some nice number greater than 10.0 so that it gets caught
    -	// in the next if-clause.
    -	const double ratio = uncompressed_pos > 0
    -			? (double)(compressed_pos) / (double)(uncompressed_pos)
    -			: 16.0;
    -
    -	// If the ratio is very bad, just indicate that it is greater than
    -	// 9.999. This way the length of the ratio field stays fixed.
    -	if (ratio > 9.999)
    -		snprintf(pos, left, " > %.3f", 9.999);
    -	else
    -		snprintf(pos, left, " = %.3f", ratio);
    -
    -	return buf;
    -}
    -
    -
    -/// Make the string containing the processing speed of uncompressed data.
    -static const char *
    -progress_speed(uint64_t uncompressed_pos, uint64_t elapsed)
    -{
    -	// Don't print the speed immediately, since the early values look
    -	// somewhat random.
    -	if (elapsed < 3000)
    -		return "";
    -
    -	static const char unit[][8] = {
    -		"KiB/s",
    -		"MiB/s",
    -		"GiB/s",
    -	};
    -
    -	size_t unit_index = 0;
    -
    -	// Calculate the speed as KiB/s.
    -	double speed = (double)(uncompressed_pos)
    -			/ ((double)(elapsed) * (1024.0 / 1000.0));
    -
    -	// Adjust the unit of the speed if needed.
    -	while (speed > 999.0) {
    -		speed /= 1024.0;
    -		if (++unit_index == ARRAY_SIZE(unit))
    -			return ""; // Way too fast ;-)
    -	}
    -
    -	// Use decimal point only if the number is small. Examples:
    -	//  - 0.1 KiB/s
    -	//  - 9.9 KiB/s
    -	//  - 99 KiB/s
    -	//  - 999 KiB/s
    -	// Use big enough buffer to hold e.g. a multibyte decimal point.
    -	static char buf[16];
    -	snprintf(buf, sizeof(buf), "%.*f %s",
    -			speed > 9.9 ? 0 : 1, speed, unit[unit_index]);
    -	return buf;
    -}
    -
    -
    -/// Make a string indicating elapsed or remaining time. The format is either
    -/// M:SS or H:MM:SS depending on if the time is an hour or more.
    -static const char *
    -progress_time(uint64_t mseconds)
    -{
    -	// 9999 hours = 416 days
    -	static char buf[sizeof("9999:59:59")];
    -
    -	uint32_t seconds = mseconds / 1000;
    -
    -	// Don't show anything if the time is zero or ridiculously big.
    -	if (seconds == 0 || seconds > ((9999 * 60) + 59) * 60 + 59)
    -		return "";
    -
    -	uint32_t minutes = seconds / 60;
    -	seconds %= 60;
    -
    -	if (minutes >= 60) {
    -		const uint32_t hours = minutes / 60;
    -		minutes %= 60;
    -		snprintf(buf, sizeof(buf),
    -				"%" PRIu32 ":%02" PRIu32 ":%02" PRIu32,
    -				hours, minutes, seconds);
    -	} else {
    -		snprintf(buf, sizeof(buf), "%" PRIu32 ":%02" PRIu32,
    -				minutes, seconds);
    -	}
    -
    -	return buf;
    -}
    -
    -
    -/// Return a string containing estimated remaining time when
    -/// reasonably possible.
    -static const char *
    -progress_remaining(uint64_t in_pos, uint64_t elapsed)
    -{
    -	// Don't show the estimated remaining time when it wouldn't
    -	// make sense:
    -	//  - Input size is unknown.
    -	//  - Input has grown bigger since we started (de)compressing.
    -	//  - We haven't processed much data yet, so estimate would be
    -	//    too inaccurate.
    -	//  - Only a few seconds has passed since we started (de)compressing,
    -	//    so estimate would be too inaccurate.
    -	if (expected_in_size == 0 || in_pos > expected_in_size
    -			|| in_pos < (UINT64_C(1) << 19) || elapsed < 8000)
    -		return "";
    -
    -	// Calculate the estimate. Don't give an estimate of zero seconds,
    -	// since it is possible that all the input has been already passed
    -	// to the library, but there is still quite a bit of output pending.
    -	uint32_t remaining = (double)(expected_in_size - in_pos)
    -			* ((double)(elapsed) / 1000.0) / (double)(in_pos);
    -	if (remaining < 1)
    -		remaining = 1;
    -
    -	static char buf[sizeof("9 h 55 min")];
    -
    -	// Select appropriate precision for the estimated remaining time.
    -	if (remaining <= 10) {
    -		// A maximum of 10 seconds remaining.
    -		// Show the number of seconds as is.
    -		snprintf(buf, sizeof(buf), "%" PRIu32 " s", remaining);
    -
    -	} else if (remaining <= 50) {
    -		// A maximum of 50 seconds remaining.
    -		// Round up to the next multiple of five seconds.
    -		remaining = (remaining + 4) / 5 * 5;
    -		snprintf(buf, sizeof(buf), "%" PRIu32 " s", remaining);
    -
    -	} else if (remaining <= 590) {
    -		// A maximum of 9 minutes and 50 seconds remaining.
    -		// Round up to the next multiple of ten seconds.
    -		remaining = (remaining + 9) / 10 * 10;
    -		snprintf(buf, sizeof(buf), "%" PRIu32 " min %" PRIu32 " s",
    -				remaining / 60, remaining % 60);
    -
    -	} else if (remaining <= 59 * 60) {
    -		// A maximum of 59 minutes remaining.
    -		// Round up to the next multiple of a minute.
    -		remaining = (remaining + 59) / 60;
    -		snprintf(buf, sizeof(buf), "%" PRIu32 " min", remaining);
    -
    -	} else if (remaining <= 9 * 3600 + 50 * 60) {
    -		// A maximum of 9 hours and 50 minutes left.
    -		// Round up to the next multiple of ten minutes.
    -		remaining = (remaining + 599) / 600 * 10;
    -		snprintf(buf, sizeof(buf), "%" PRIu32 " h %" PRIu32 " min",
    -				remaining / 60, remaining % 60);
    -
    -	} else if (remaining <= 23 * 3600) {
    -		// A maximum of 23 hours remaining.
    -		// Round up to the next multiple of an hour.
    -		remaining = (remaining + 3599) / 3600;
    -		snprintf(buf, sizeof(buf), "%" PRIu32 " h", remaining);
    -
    -	} else if (remaining <= 9 * 24 * 3600 + 23 * 3600) {
    -		// A maximum of 9 days and 23 hours remaining.
    -		// Round up to the next multiple of an hour.
    -		remaining = (remaining + 3599) / 3600;
    -		snprintf(buf, sizeof(buf), "%" PRIu32 " d %" PRIu32 " h",
    -				remaining / 24, remaining % 24);
    -
    -	} else if (remaining <= 999 * 24 * 3600) {
    -		// A maximum of 999 days remaining. ;-)
    -		// Round up to the next multiple of a day.
    -		remaining = (remaining + 24 * 3600 - 1) / (24 * 3600);
    -		snprintf(buf, sizeof(buf), "%" PRIu32 " d", remaining);
    -
    -	} else {
    -		// The estimated remaining time is too big. Don't show it.
    -		return "";
    -	}
    -
    -	return buf;
    -}
    -
    -
    -/// Get how much uncompressed and compressed data has been processed.
    -static void
    -progress_pos(uint64_t *in_pos,
    -		uint64_t *compressed_pos, uint64_t *uncompressed_pos)
    -{
    -	uint64_t out_pos;
    -	lzma_get_progress(progress_strm, in_pos, &out_pos);
    -
    -	// It cannot have processed more input than it has been given.
    -	assert(*in_pos <= progress_strm->total_in);
    -
    -	// It cannot have produced more output than it claims to have ready.
    -	assert(out_pos >= progress_strm->total_out);
    -
    -	if (opt_mode == MODE_COMPRESS) {
    -		*compressed_pos = out_pos;
    -		*uncompressed_pos = *in_pos;
    -	} else {
    -		*compressed_pos = *in_pos;
    -		*uncompressed_pos = out_pos;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -message_progress_update(void)
    -{
    -	if (!progress_needs_updating)
    -		return;
    -
    -	// Calculate how long we have been processing this file.
    -	const uint64_t elapsed = mytime_get_elapsed();
    -
    -#ifndef SIGALRM
    -	if (progress_next_update > elapsed)
    -		return;
    -
    -	progress_next_update = elapsed + 1000;
    -#endif
    -
    -	// Get our current position in the stream.
    -	uint64_t in_pos;
    -	uint64_t compressed_pos;
    -	uint64_t uncompressed_pos;
    -	progress_pos(&in_pos, &compressed_pos, &uncompressed_pos);
    -
    -	// Block signals so that fprintf() doesn't get interrupted.
    -	signals_block();
    -
    -	// Print the filename if it hasn't been printed yet.
    -	if (!current_filename_printed)
    -		print_filename();
    -
    -	// Print the actual progress message. The idea is that there is at
    -	// least three spaces between the fields in typical situations, but
    -	// even in rare situations there is at least one space.
    -	const char *cols[5] = {
    -		progress_percentage(in_pos),
    -		progress_sizes(compressed_pos, uncompressed_pos, false),
    -		progress_speed(uncompressed_pos, elapsed),
    -		progress_time(elapsed),
    -		progress_remaining(in_pos, elapsed),
    -	};
    -	fprintf(stderr, "\r %*s %*s   %*s %10s   %10s\r",
    -			tuklib_mbstr_fw(cols[0], 6), cols[0],
    -			tuklib_mbstr_fw(cols[1], 35), cols[1],
    -			tuklib_mbstr_fw(cols[2], 9), cols[2],
    -			cols[3],
    -			cols[4]);
    -
    -#ifdef SIGALRM
    -	// Updating the progress info was finished. Reset
    -	// progress_needs_updating to wait for the next SIGALRM.
    -	//
    -	// NOTE: This has to be done before alarm(1) or with (very) bad
    -	// luck we could be setting this to false after the alarm has already
    -	// been triggered.
    -	progress_needs_updating = false;
    -
    -	if (verbosity >= V_VERBOSE && progress_automatic) {
    -		// Mark that the progress indicator is active, so if an error
    -		// occurs, the error message gets printed cleanly.
    -		progress_active = true;
    -
    -		// Restart the timer so that progress_needs_updating gets
    -		// set to true after about one second.
    -		alarm(1);
    -	} else {
    -		// The progress message was printed because user had sent us
    -		// SIGALRM. In this case, each progress message is printed
    -		// on its own line.
    -		fputc('\n', stderr);
    -	}
    -#else
    -	// When SIGALRM isn't supported and we get here, it's always due to
    -	// automatic progress update. We set progress_active here too like
    -	// described above.
    -	assert(verbosity >= V_VERBOSE);
    -	assert(progress_automatic);
    -	progress_active = true;
    -#endif
    -
    -	signals_unblock();
    -
    -	return;
    -}
    -
    -
    -static void
    -progress_flush(bool finished)
    -{
    -	if (!progress_started || verbosity < V_VERBOSE)
    -		return;
    -
    -	uint64_t in_pos;
    -	uint64_t compressed_pos;
    -	uint64_t uncompressed_pos;
    -	progress_pos(&in_pos, &compressed_pos, &uncompressed_pos);
    -
    -	// Avoid printing intermediate progress info if some error occurs
    -	// in the beginning of the stream. (If something goes wrong later in
    -	// the stream, it is sometimes useful to tell the user where the
    -	// error approximately occurred, especially if the error occurs
    -	// after a time-consuming operation.)
    -	if (!finished && !progress_active
    -			&& (compressed_pos == 0 || uncompressed_pos == 0))
    -		return;
    -
    -	progress_active = false;
    -
    -	const uint64_t elapsed = mytime_get_elapsed();
    -
    -	signals_block();
    -
    -	// When using the auto-updating progress indicator, the final
    -	// statistics are printed in the same format as the progress
    -	// indicator itself.
    -	if (progress_automatic) {
    -		const char *cols[5] = {
    -			finished ? "100 %" : progress_percentage(in_pos),
    -			progress_sizes(compressed_pos, uncompressed_pos, true),
    -			progress_speed(uncompressed_pos, elapsed),
    -			progress_time(elapsed),
    -			finished ? "" : progress_remaining(in_pos, elapsed),
    -		};
    -		fprintf(stderr, "\r %*s %*s   %*s %10s   %10s\n",
    -				tuklib_mbstr_fw(cols[0], 6), cols[0],
    -				tuklib_mbstr_fw(cols[1], 35), cols[1],
    -				tuklib_mbstr_fw(cols[2], 9), cols[2],
    -				cols[3],
    -				cols[4]);
    -	} else {
    -		// The filename is always printed.
    -		fprintf(stderr, "%s: ", filename);
    -
    -		// Percentage is printed only if we didn't finish yet.
    -		if (!finished) {
    -			// Don't print the percentage when it isn't known
    -			// (starts with a dash).
    -			const char *percentage = progress_percentage(in_pos);
    -			if (percentage[0] != '-')
    -				fprintf(stderr, "%s, ", percentage);
    -		}
    -
    -		// Size information is always printed.
    -		fprintf(stderr, "%s", progress_sizes(
    -				compressed_pos, uncompressed_pos, true));
    -
    -		// The speed and elapsed time aren't always shown.
    -		const char *speed = progress_speed(uncompressed_pos, elapsed);
    -		if (speed[0] != '\0')
    -			fprintf(stderr, ", %s", speed);
    -
    -		const char *elapsed_str = progress_time(elapsed);
    -		if (elapsed_str[0] != '\0')
    -			fprintf(stderr, ", %s", elapsed_str);
    -
    -		fputc('\n', stderr);
    -	}
    -
    -	signals_unblock();
    -
    -	return;
    -}
    -
    -
    -extern void
    -message_progress_end(bool success)
    -{
    -	assert(progress_started);
    -	progress_flush(success);
    -	progress_started = false;
    -	return;
    -}
    -
    -
    -static void
    -vmessage(enum message_verbosity v, const char *fmt, va_list ap)
    -{
    -	if (v <= verbosity) {
    -		signals_block();
    -
    -		progress_flush(false);
    -
    -		// TRANSLATORS: This is the program name in the beginning
    -		// of the line in messages. Usually it becomes "xz: ".
    -		// This is a translatable string because French needs
    -		// a space before a colon.
    -		fprintf(stderr, _("%s: "), progname);
    -		vfprintf(stderr, fmt, ap);
    -		fputc('\n', stderr);
    -
    -		signals_unblock();
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -message(enum message_verbosity v, const char *fmt, ...)
    -{
    -	va_list ap;
    -	va_start(ap, fmt);
    -	vmessage(v, fmt, ap);
    -	va_end(ap);
    -	return;
    -}
    -
    -
    -extern void
    -message_warning(const char *fmt, ...)
    -{
    -	va_list ap;
    -	va_start(ap, fmt);
    -	vmessage(V_WARNING, fmt, ap);
    -	va_end(ap);
    -
    -	set_exit_status(E_WARNING);
    -	return;
    -}
    -
    -
    -extern void
    -message_error(const char *fmt, ...)
    -{
    -	va_list ap;
    -	va_start(ap, fmt);
    -	vmessage(V_ERROR, fmt, ap);
    -	va_end(ap);
    -
    -	set_exit_status(E_ERROR);
    -	return;
    -}
    -
    -
    -extern void
    -message_fatal(const char *fmt, ...)
    -{
    -	va_list ap;
    -	va_start(ap, fmt);
    -	vmessage(V_ERROR, fmt, ap);
    -	va_end(ap);
    -
    -	tuklib_exit(E_ERROR, E_ERROR, false);
    -}
    -
    -
    -extern void
    -message_bug(void)
    -{
    -	message_fatal(_("Internal error (bug)"));
    -}
    -
    -
    -extern void
    -message_signal_handler(void)
    -{
    -	message_fatal(_("Cannot establish signal handlers"));
    -}
    -
    -
    -extern const char *
    -message_strm(lzma_ret code)
    -{
    -	switch (code) {
    -	case LZMA_NO_CHECK:
    -		return _("No integrity check; not verifying file integrity");
    -
    -	case LZMA_UNSUPPORTED_CHECK:
    -		return _("Unsupported type of integrity check; "
    -				"not verifying file integrity");
    -
    -	case LZMA_MEM_ERROR:
    -		return strerror(ENOMEM);
    -
    -	case LZMA_MEMLIMIT_ERROR:
    -		return _("Memory usage limit reached");
    -
    -	case LZMA_FORMAT_ERROR:
    -		return _("File format not recognized");
    -
    -	case LZMA_OPTIONS_ERROR:
    -		return _("Unsupported options");
    -
    -	case LZMA_DATA_ERROR:
    -		return _("Compressed data is corrupt");
    -
    -	case LZMA_BUF_ERROR:
    -		return _("Unexpected end of input");
    -
    -	case LZMA_OK:
    -	case LZMA_STREAM_END:
    -	case LZMA_GET_CHECK:
    -	case LZMA_PROG_ERROR:
    -		// Without "default", compiler will warn if new constants
    -		// are added to lzma_ret, it is not too easy to forget to
    -		// add the new constants to this function.
    -		break;
    -	}
    -
    -	return _("Internal error (bug)");
    -}
    -
    -
    -extern void
    -message_mem_needed(enum message_verbosity v, uint64_t memusage)
    -{
    -	if (v > verbosity)
    -		return;
    -
    -	// Convert memusage to MiB, rounding up to the next full MiB.
    -	// This way the user can always use the displayed usage as
    -	// the new memory usage limit. (If we rounded to the nearest,
    -	// the user might need to +1 MiB to get high enough limit.)
    -	memusage = round_up_to_mib(memusage);
    -
    -	uint64_t memlimit = hardware_memlimit_get(opt_mode);
    -
    -	// Handle the case when there is no memory usage limit.
    -	// This way we don't print a weird message with a huge number.
    -	if (memlimit == UINT64_MAX) {
    -		message(v, _("%s MiB of memory is required. "
    -				"The limiter is disabled."),
    -				uint64_to_str(memusage, 0));
    -		return;
    -	}
    -
    -	// With US-ASCII:
    -	// 2^64 with thousand separators + " MiB" suffix + '\0' = 26 + 4 + 1
    -	// But there may be multibyte chars so reserve enough space.
    -	char memlimitstr[128];
    -
    -	// Show the memory usage limit as MiB unless it is less than 1 MiB.
    -	// This way it's easy to notice errors where one has typed
    -	// --memory=123 instead of --memory=123MiB.
    -	if (memlimit < (UINT32_C(1) << 20)) {
    -		snprintf(memlimitstr, sizeof(memlimitstr), "%s B",
    -				uint64_to_str(memlimit, 1));
    -	} else {
    -		// Round up just like with memusage. If this function is
    -		// called for informational purposes (to just show the
    -		// current usage and limit), we should never show that
    -		// the usage is higher than the limit, which would give
    -		// a false impression that the memory usage limit isn't
    -		// properly enforced.
    -		snprintf(memlimitstr, sizeof(memlimitstr), "%s MiB",
    -				uint64_to_str(round_up_to_mib(memlimit), 1));
    -	}
    -
    -	message(v, _("%s MiB of memory is required. The limit is %s."),
    -			uint64_to_str(memusage, 0), memlimitstr);
    -
    -	return;
    -}
    -
    -
    -/// \brief      Convert uint32_t to a nice string for --lzma[12]=dict=SIZE
    -///
    -/// The idea is to use KiB or MiB suffix when possible.
    -static const char *
    -uint32_to_optstr(uint32_t num)
    -{
    -	static char buf[16];
    -
    -	if ((num & ((UINT32_C(1) << 20) - 1)) == 0)
    -		snprintf(buf, sizeof(buf), "%" PRIu32 "MiB", num >> 20);
    -	else if ((num & ((UINT32_C(1) << 10) - 1)) == 0)
    -		snprintf(buf, sizeof(buf), "%" PRIu32 "KiB", num >> 10);
    -	else
    -		snprintf(buf, sizeof(buf), "%" PRIu32, num);
    -
    -	return buf;
    -}
    -
    -
    -extern void
    -message_filters_to_str(char buf[FILTERS_STR_SIZE],
    -		const lzma_filter *filters, bool all_known)
    -{
    -	char *pos = buf;
    -	size_t left = FILTERS_STR_SIZE;
    -
    -	for (size_t i = 0; filters[i].id != LZMA_VLI_UNKNOWN; ++i) {
    -		// Add the dashes for the filter option. A space is
    -		// needed after the first and later filters.
    -		my_snprintf(&pos, &left, "%s", i == 0 ? "--" : " --");
    -
    -		switch (filters[i].id) {
    -		case LZMA_FILTER_LZMA1:
    -		case LZMA_FILTER_LZMA2: {
    -			const lzma_options_lzma *opt = filters[i].options;
    -			const char *mode = NULL;
    -			const char *mf = NULL;
    -
    -			if (all_known) {
    -				switch (opt->mode) {
    -				case LZMA_MODE_FAST:
    -					mode = "fast";
    -					break;
    -
    -				case LZMA_MODE_NORMAL:
    -					mode = "normal";
    -					break;
    -
    -				default:
    -					mode = "UNKNOWN";
    -					break;
    -				}
    -
    -				switch (opt->mf) {
    -				case LZMA_MF_HC3:
    -					mf = "hc3";
    -					break;
    -
    -				case LZMA_MF_HC4:
    -					mf = "hc4";
    -					break;
    -
    -				case LZMA_MF_BT2:
    -					mf = "bt2";
    -					break;
    -
    -				case LZMA_MF_BT3:
    -					mf = "bt3";
    -					break;
    -
    -				case LZMA_MF_BT4:
    -					mf = "bt4";
    -					break;
    -
    -				default:
    -					mf = "UNKNOWN";
    -					break;
    -				}
    -			}
    -
    -			// Add the filter name and dictionary size, which
    -			// is always known.
    -			my_snprintf(&pos, &left, "lzma%c=dict=%s",
    -					filters[i].id == LZMA_FILTER_LZMA2
    -						? '2' : '1',
    -					uint32_to_optstr(opt->dict_size));
    -
    -			// With LZMA1 also lc/lp/pb are known when
    -			// decompressing, but this function is never
    -			// used to print information about .lzma headers.
    -			assert(filters[i].id == LZMA_FILTER_LZMA2
    -					|| all_known);
    -
    -			// Print the rest of the options, which are known
    -			// only when compressing.
    -			if (all_known)
    -				my_snprintf(&pos, &left,
    -					",lc=%" PRIu32 ",lp=%" PRIu32
    -					",pb=%" PRIu32
    -					",mode=%s,nice=%" PRIu32 ",mf=%s"
    -					",depth=%" PRIu32,
    -					opt->lc, opt->lp, opt->pb,
    -					mode, opt->nice_len, mf, opt->depth);
    -			break;
    -		}
    -
    -		case LZMA_FILTER_X86:
    -		case LZMA_FILTER_POWERPC:
    -		case LZMA_FILTER_IA64:
    -		case LZMA_FILTER_ARM:
    -		case LZMA_FILTER_ARMTHUMB:
    -		case LZMA_FILTER_SPARC: {
    -			static const char bcj_names[][9] = {
    -				"x86",
    -				"powerpc",
    -				"ia64",
    -				"arm",
    -				"armthumb",
    -				"sparc",
    -			};
    -
    -			const lzma_options_bcj *opt = filters[i].options;
    -			my_snprintf(&pos, &left, "%s", bcj_names[filters[i].id
    -					- LZMA_FILTER_X86]);
    -
    -			// Show the start offset only when really needed.
    -			if (opt != NULL && opt->start_offset != 0)
    -				my_snprintf(&pos, &left, "=start=%" PRIu32,
    -						opt->start_offset);
    -
    -			break;
    -		}
    -
    -		case LZMA_FILTER_DELTA: {
    -			const lzma_options_delta *opt = filters[i].options;
    -			my_snprintf(&pos, &left, "delta=dist=%" PRIu32,
    -					opt->dist);
    -			break;
    -		}
    -
    -		default:
    -			// This should be possible only if liblzma is
    -			// newer than the xz tool.
    -			my_snprintf(&pos, &left, "UNKNOWN");
    -			break;
    -		}
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -message_filters_show(enum message_verbosity v, const lzma_filter *filters)
    -{
    -	if (v > verbosity)
    -		return;
    -
    -	char buf[FILTERS_STR_SIZE];
    -	message_filters_to_str(buf, filters, true);
    -	fprintf(stderr, _("%s: Filter chain: %s\n"), progname, buf);
    -	return;
    -}
    -
    -
    -extern void
    -message_try_help(void)
    -{
    -	// Print this with V_WARNING instead of V_ERROR to prevent it from
    -	// showing up when --quiet has been specified.
    -	message(V_WARNING, _("Try `%s --help' for more information."),
    -			progname);
    -	return;
    -}
    -
    -
    -extern void
    -message_version(void)
    -{
    -	// It is possible that liblzma version is different than the command
    -	// line tool version, so print both.
    -	if (opt_robot) {
    -		printf("XZ_VERSION=%" PRIu32 "\nLIBLZMA_VERSION=%" PRIu32 "\n",
    -				LZMA_VERSION, lzma_version_number());
    -	} else {
    -		printf("xz (" PACKAGE_NAME ") " LZMA_VERSION_STRING "\n");
    -		printf("liblzma %s\n", lzma_version_string());
    -	}
    -
    -	tuklib_exit(E_SUCCESS, E_ERROR, verbosity != V_SILENT);
    -}
    -
    -
    -extern void
    -message_help(bool long_help)
    -{
    -	printf(_("Usage: %s [OPTION]... [FILE]...\n"
    -			"Compress or decompress FILEs in the .xz format.\n\n"),
    -			progname);
    -
    -	// NOTE: The short help doesn't currently have options that
    -	// take arguments.
    -	if (long_help)
    -		puts(_("Mandatory arguments to long options are mandatory "
    -				"for short options too.\n"));
    -
    -	if (long_help)
    -		puts(_(" Operation mode:\n"));
    -
    -	puts(_(
    -"  -z, --compress      force compression\n"
    -"  -d, --decompress    force decompression\n"
    -"  -t, --test          test compressed file integrity\n"
    -"  -l, --list          list information about .xz files"));
    -
    -	if (long_help)
    -		puts(_("\n Operation modifiers:\n"));
    -
    -	puts(_(
    -"  -k, --keep          keep (don't delete) input files\n"
    -"  -f, --force         force overwrite of output file and (de)compress links\n"
    -"  -c, --stdout        write to standard output and don't delete input files"));
    -
    -	if (long_help) {
    -		puts(_(
    -"      --single-stream decompress only the first stream, and silently\n"
    -"                      ignore possible remaining input data"));
    -		puts(_(
    -"      --no-sparse     do not create sparse files when decompressing\n"
    -"  -S, --suffix=.SUF   use the suffix `.SUF' on compressed files\n"
    -"      --files[=FILE]  read filenames to process from FILE; if FILE is\n"
    -"                      omitted, filenames are read from the standard input;\n"
    -"                      filenames must be terminated with the newline character\n"
    -"      --files0[=FILE] like --files but use the null character as terminator"));
    -	}
    -
    -	if (long_help) {
    -		puts(_("\n Basic file format and compression options:\n"));
    -		puts(_(
    -"  -F, --format=FMT    file format to encode or decode; possible values are\n"
    -"                      `auto' (default), `xz', `lzma', and `raw'\n"
    -"  -C, --check=CHECK   integrity check type: `none' (use with caution),\n"
    -"                      `crc32', `crc64' (default), or `sha256'"));
    -		puts(_(
    -"      --ignore-check  don't verify the integrity check when decompressing"));
    -	}
    -
    -	puts(_(
    -"  -0 ... -9           compression preset; default is 6; take compressor *and*\n"
    -"                      decompressor memory usage into account before using 7-9!"));
    -
    -	puts(_(
    -"  -e, --extreme       try to improve compression ratio by using more CPU time;\n"
    -"                      does not affect decompressor memory requirements"));
    -
    -	puts(_(
    -"  -T, --threads=NUM   use at most NUM threads; the default is 1; set to 0\n"
    -"                      to use as many threads as there are processor cores"));
    -
    -	if (long_help) {
    -		puts(_(
    -"      --block-size=SIZE\n"
    -"                      start a new .xz block after every SIZE bytes of input;\n"
    -"                      use this to set the block size for threaded compression"));
    -		puts(_(
    -"      --block-list=SIZES\n"
    -"                      start a new .xz block after the given comma-separated\n"
    -"                      intervals of uncompressed data"));
    -		puts(_(
    -"      --flush-timeout=TIMEOUT\n"
    -"                      when compressing, if more than TIMEOUT milliseconds has\n"
    -"                      passed since the previous flush and reading more input\n"
    -"                      would block, all pending data is flushed out"
    -		));
    -		puts(_( // xgettext:no-c-format
    -"      --memlimit-compress=LIMIT\n"
    -"      --memlimit-decompress=LIMIT\n"
    -"  -M, --memlimit=LIMIT\n"
    -"                      set memory usage limit for compression, decompression,\n"
    -"                      or both; LIMIT is in bytes, % of RAM, or 0 for defaults"));
    -
    -		puts(_(
    -"      --no-adjust     if compression settings exceed the memory usage limit,\n"
    -"                      give an error instead of adjusting the settings downwards"));
    -	}
    -
    -	if (long_help) {
    -		puts(_(
    -"\n Custom filter chain for compression (alternative for using presets):"));
    -
    -#if defined(HAVE_ENCODER_LZMA1) || defined(HAVE_DECODER_LZMA1) \
    -		|| defined(HAVE_ENCODER_LZMA2) || defined(HAVE_DECODER_LZMA2)
    -		// TRANSLATORS: The word "literal" in "literal context bits"
    -		// means how many "context bits" to use when encoding
    -		// literals. A literal is a single 8-bit byte. It doesn't
    -		// mean "literally" here.
    -		puts(_(
    -"\n"
    -"  --lzma1[=OPTS]      LZMA1 or LZMA2; OPTS is a comma-separated list of zero or\n"
    -"  --lzma2[=OPTS]      more of the following options (valid values; default):\n"
    -"                        preset=PRE reset options to a preset (0-9[e])\n"
    -"                        dict=NUM   dictionary size (4KiB - 1536MiB; 8MiB)\n"
    -"                        lc=NUM     number of literal context bits (0-4; 3)\n"
    -"                        lp=NUM     number of literal position bits (0-4; 0)\n"
    -"                        pb=NUM     number of position bits (0-4; 2)\n"
    -"                        mode=MODE  compression mode (fast, normal; normal)\n"
    -"                        nice=NUM   nice length of a match (2-273; 64)\n"
    -"                        mf=NAME    match finder (hc3, hc4, bt2, bt3, bt4; bt4)\n"
    -"                        depth=NUM  maximum search depth; 0=automatic (default)"));
    -#endif
    -
    -		puts(_(
    -"\n"
    -"  --x86[=OPTS]        x86 BCJ filter (32-bit and 64-bit)\n"
    -"  --powerpc[=OPTS]    PowerPC BCJ filter (big endian only)\n"
    -"  --ia64[=OPTS]       IA-64 (Itanium) BCJ filter\n"
    -"  --arm[=OPTS]        ARM BCJ filter (little endian only)\n"
    -"  --armthumb[=OPTS]   ARM-Thumb BCJ filter (little endian only)\n"
    -"  --sparc[=OPTS]      SPARC BCJ filter\n"
    -"                      Valid OPTS for all BCJ filters:\n"
    -"                        start=NUM  start offset for conversions (default=0)"));
    -
    -#if defined(HAVE_ENCODER_DELTA) || defined(HAVE_DECODER_DELTA)
    -		puts(_(
    -"\n"
    -"  --delta[=OPTS]      Delta filter; valid OPTS (valid values; default):\n"
    -"                        dist=NUM   distance between bytes being subtracted\n"
    -"                                   from each other (1-256; 1)"));
    -#endif
    -	}
    -
    -	if (long_help)
    -		puts(_("\n Other options:\n"));
    -
    -	puts(_(
    -"  -q, --quiet         suppress warnings; specify twice to suppress errors too\n"
    -"  -v, --verbose       be verbose; specify twice for even more verbose"));
    -
    -	if (long_help) {
    -		puts(_(
    -"  -Q, --no-warn       make warnings not affect the exit status"));
    -		puts(_(
    -"      --robot         use machine-parsable messages (useful for scripts)"));
    -		puts("");
    -		puts(_(
    -"      --info-memory   display the total amount of RAM and the currently active\n"
    -"                      memory usage limits, and exit"));
    -		puts(_(
    -"  -h, --help          display the short help (lists only the basic options)\n"
    -"  -H, --long-help     display this long help and exit"));
    -	} else {
    -		puts(_(
    -"  -h, --help          display this short help and exit\n"
    -"  -H, --long-help     display the long help (lists also the advanced options)"));
    -	}
    -
    -	puts(_(
    -"  -V, --version       display the version number and exit"));
    -
    -	puts(_("\nWith no FILE, or when FILE is -, read standard input.\n"));
    -
    -	// TRANSLATORS: This message indicates the bug reporting address
    -	// for this package. Please add _another line_ saying
    -	// "Report translation bugs to <...>\n" with the email or WWW
    -	// address for translation bugs. Thanks.
    -	printf(_("Report bugs to <%s> (in English or Finnish).\n"),
    -			PACKAGE_BUGREPORT);
    -	printf(_("%s home page: <%s>\n"), PACKAGE_NAME, PACKAGE_URL);
    -
    -#if LZMA_VERSION_STABILITY != LZMA_VERSION_STABILITY_STABLE
    -	puts(_(
    -"THIS IS A DEVELOPMENT VERSION NOT INTENDED FOR PRODUCTION USE."));
    -#endif
    -
    -	tuklib_exit(E_SUCCESS, E_ERROR, verbosity != V_SILENT);
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/message.h b/external/public-domain/xz/dist/src/xz/message.h
    deleted file mode 100644
    index 74599bd97..000000000
    --- a/external/public-domain/xz/dist/src/xz/message.h
    +++ /dev/null
    @@ -1,167 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       message.h
    -/// \brief      Printing messages to stderr
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -/// Verbosity levels
    -enum message_verbosity {
    -	V_SILENT,   ///< No messages
    -	V_ERROR,    ///< Only error messages
    -	V_WARNING,  ///< Errors and warnings
    -	V_VERBOSE,  ///< Errors, warnings, and verbose statistics
    -	V_DEBUG,    ///< Very verbose
    -};
    -
    -
    -/// \brief      Signals used for progress message handling
    -extern const int message_progress_sigs[];
    -
    -
    -/// \brief      Initializes the message functions
    -///
    -/// If an error occurs, this function doesn't return.
    -///
    -extern void message_init(void);
    -
    -
    -/// Increase verbosity level by one step unless it was at maximum.
    -extern void message_verbosity_increase(void);
    -
    -/// Decrease verbosity level by one step unless it was at minimum.
    -extern void message_verbosity_decrease(void);
    -
    -/// Get the current verbosity level.
    -extern enum message_verbosity message_verbosity_get(void);
    -
    -
    -/// \brief      Print a message if verbosity level is at least "verbosity"
    -///
    -/// This doesn't touch the exit status.
    -extern void message(enum message_verbosity verbosity, const char *fmt, ...)
    -		lzma_attribute((__format__(__printf__, 2, 3)));
    -
    -
    -/// \brief      Prints a warning and possibly sets exit status
    -///
    -/// The message is printed only if verbosity level is at least V_WARNING.
    -/// The exit status is set to WARNING unless it was already at ERROR.
    -extern void message_warning(const char *fmt, ...)
    -		lzma_attribute((__format__(__printf__, 1, 2)));
    -
    -
    -/// \brief      Prints an error message and sets exit status
    -///
    -/// The message is printed only if verbosity level is at least V_ERROR.
    -/// The exit status is set to ERROR.
    -extern void message_error(const char *fmt, ...)
    -		lzma_attribute((__format__(__printf__, 1, 2)));
    -
    -
    -/// \brief      Prints an error message and exits with EXIT_ERROR
    -///
    -/// The message is printed only if verbosity level is at least V_ERROR.
    -extern void message_fatal(const char *fmt, ...)
    -		lzma_attribute((__format__(__printf__, 1, 2)))
    -		lzma_attribute((__noreturn__));
    -
    -
    -/// Print an error message that an internal error occurred and exit with
    -/// EXIT_ERROR.
    -extern void message_bug(void) lzma_attribute((__noreturn__));
    -
    -
    -/// Print a message that establishing signal handlers failed, and exit with
    -/// exit status ERROR.
    -extern void message_signal_handler(void) lzma_attribute((__noreturn__));
    -
    -
    -/// Convert lzma_ret to a string.
    -extern const char *message_strm(lzma_ret code);
    -
    -
    -/// Display how much memory was needed and how much the limit was.
    -extern void message_mem_needed(enum message_verbosity v, uint64_t memusage);
    -
    -
    -/// Buffer size for message_filters_to_str()
    -#define FILTERS_STR_SIZE 512
    -
    -
    -/// \brief      Get the filter chain as a string
    -///
    -/// \param      buf         Pointer to caller allocated buffer to hold
    -///                         the filter chain string
    -/// \param      filters     Pointer to the filter chain
    -/// \param      all_known   If true, all filter options are printed.
    -///                         If false, only the options that get stored
    -///                         into .xz headers are printed.
    -extern void message_filters_to_str(char buf[FILTERS_STR_SIZE],
    -		const lzma_filter *filters, bool all_known);
    -
    -
    -/// Print the filter chain.
    -extern void message_filters_show(
    -		enum message_verbosity v, const lzma_filter *filters);
    -
    -
    -/// Print a message that user should try --help.
    -extern void message_try_help(void);
    -
    -
    -/// Prints the version number to stdout and exits with exit status SUCCESS.
    -extern void message_version(void) lzma_attribute((__noreturn__));
    -
    -
    -/// Print the help message.
    -extern void message_help(bool long_help) lzma_attribute((__noreturn__));
    -
    -
    -/// \brief      Set the total number of files to be processed
    -///
    -/// Standard input is counted as a file here. This is used when printing
    -/// the filename via message_filename().
    -extern void message_set_files(unsigned int files);
    -
    -
    -/// \brief      Set the name of the current file and possibly print it too
    -///
    -/// The name is printed immediately if --list was used or if --verbose
    -/// was used and stderr is a terminal. Even when the filename isn't printed,
    -/// it is stored so that it can be printed later if needed for progress
    -/// messages.
    -extern void message_filename(const char *src_name);
    -
    -
    -/// \brief      Start progress info handling
    -///
    -/// message_filename() must be called before this function to set
    -/// the filename.
    -///
    -/// This must be paired with a call to message_progress_end() before the
    -/// given *strm becomes invalid.
    -///
    -/// \param      strm      Pointer to lzma_stream used for the coding.
    -/// \param      in_size   Size of the input file, or zero if unknown.
    -///
    -extern void message_progress_start(lzma_stream *strm, uint64_t in_size);
    -
    -
    -/// Update the progress info if in verbose mode and enough time has passed
    -/// since the previous update. This can be called only when
    -/// message_progress_start() has already been used.
    -extern void message_progress_update(void);
    -
    -
    -/// \brief      Finishes the progress message if we were in verbose mode
    -///
    -/// \param      finished    True if the whole stream was successfully coded
    -///                         and output written to the output stream.
    -///
    -extern void message_progress_end(bool finished);
    diff --git a/external/public-domain/xz/dist/src/xz/mytime.c b/external/public-domain/xz/dist/src/xz/mytime.c
    deleted file mode 100644
    index 4be184fd1..000000000
    --- a/external/public-domain/xz/dist/src/xz/mytime.c
    +++ /dev/null
    @@ -1,89 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       mytime.c
    -/// \brief      Time handling functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -#if !(defined(HAVE_CLOCK_GETTIME) && HAVE_DECL_CLOCK_MONOTONIC)
    -#	include 
    -#endif
    -
    -uint64_t opt_flush_timeout = 0;
    -bool flush_needed;
    -
    -static uint64_t start_time;
    -static uint64_t next_flush;
    -
    -
    -/// \brief      Get the current time as milliseconds
    -///
    -/// It's relative to some point but not necessarily to the UNIX Epoch.
    -static uint64_t
    -mytime_now(void)
    -{
    -	// NOTE: HAVE_DECL_CLOCK_MONOTONIC is always defined to 0 or 1.
    -#if defined(HAVE_CLOCK_GETTIME) && HAVE_DECL_CLOCK_MONOTONIC
    -	// If CLOCK_MONOTONIC was available at compile time but for some
    -	// reason isn't at runtime, fallback to CLOCK_REALTIME which
    -	// according to POSIX is mandatory for all implementations.
    -	static clockid_t clk_id = CLOCK_MONOTONIC;
    -	struct timespec tv;
    -	while (clock_gettime(clk_id, &tv))
    -		clk_id = CLOCK_REALTIME;
    -
    -	return (uint64_t)(tv.tv_sec) * UINT64_C(1000) + tv.tv_nsec / 1000000;
    -#else
    -	struct timeval tv;
    -	gettimeofday(&tv, NULL);
    -	return (uint64_t)(tv.tv_sec) * UINT64_C(1000) + tv.tv_usec / 1000;
    -#endif
    -}
    -
    -
    -extern void
    -mytime_set_start_time(void)
    -{
    -	start_time = mytime_now();
    -	next_flush = start_time + opt_flush_timeout;
    -	flush_needed = false;
    -	return;
    -}
    -
    -
    -extern uint64_t
    -mytime_get_elapsed(void)
    -{
    -	return mytime_now() - start_time;
    -}
    -
    -
    -extern void
    -mytime_set_flush_time(void)
    -{
    -	next_flush = mytime_now() + opt_flush_timeout;
    -	flush_needed = false;
    -	return;
    -}
    -
    -
    -extern int
    -mytime_get_flush_timeout(void)
    -{
    -	if (opt_flush_timeout == 0 || opt_mode != MODE_COMPRESS)
    -		return -1;
    -
    -	const uint64_t now = mytime_now();
    -	if (now >= next_flush)
    -		return 0;
    -
    -	const uint64_t remaining = next_flush - now;
    -	return remaining > INT_MAX ? INT_MAX : (int)remaining;
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/mytime.h b/external/public-domain/xz/dist/src/xz/mytime.h
    deleted file mode 100644
    index ea291eed8..000000000
    --- a/external/public-domain/xz/dist/src/xz/mytime.h
    +++ /dev/null
    @@ -1,47 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       mytime.h
    -/// \brief      Time handling functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -
    -/// \brief      Number of milliseconds to between LZMA_SYNC_FLUSHes
    -///
    -/// If 0, timed flushing is disabled. Otherwise if no more input is available
    -/// and not at the end of the file and at least opt_flush_timeout milliseconds
    -/// has elapsed since the start of compression or the previous flushing
    -/// (LZMA_SYNC_FLUSH or LZMA_FULL_FLUSH), set LZMA_SYNC_FLUSH to flush
    -/// the pending data.
    -extern uint64_t opt_flush_timeout;
    -
    -
    -/// \brief      True when flushing is needed due to expired timeout
    -extern bool flush_needed;
    -
    -
    -/// \brief      Store the time when (de)compression was started
    -///
    -/// The start time is also stored as the time of the first flush.
    -extern void mytime_set_start_time(void);
    -
    -
    -/// \brief      Get the number of milliseconds since the operation started
    -extern uint64_t mytime_get_elapsed(void);
    -
    -
    -/// \brief      Store the time of when compressor was flushed
    -extern void mytime_set_flush_time(void);
    -
    -
    -/// \brief      Get the number of milliseconds until the next flush
    -///
    -/// This returns -1 if no timed flushing is used.
    -///
    -/// The return value is inteded for use with poll().
    -extern int mytime_get_flush_timeout(void);
    diff --git a/external/public-domain/xz/dist/src/xz/options.c b/external/public-domain/xz/dist/src/xz/options.c
    deleted file mode 100644
    index f9c7ab9e8..000000000
    --- a/external/public-domain/xz/dist/src/xz/options.c
    +++ /dev/null
    @@ -1,363 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       options.c
    -/// \brief      Parser for filter-specific options
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -
    -///////////////////
    -// Generic stuff //
    -///////////////////
    -
    -typedef struct {
    -	const char *name;
    -	uint64_t id;
    -} name_id_map;
    -
    -
    -typedef struct {
    -	const char *name;
    -	const name_id_map *map;
    -	uint64_t min;
    -	uint64_t max;
    -} option_map;
    -
    -
    -/// Parses option=value pairs that are separated with commas:
    -/// opt=val,opt=val,opt=val
    -///
    -/// Each option is a string, that is converted to an integer using the
    -/// index where the option string is in the array.
    -///
    -/// Value can be
    -///  - a string-id map mapping a list of possible string values to integers
    -///    (opts[i].map != NULL, opts[i].min and opts[i].max are ignored);
    -///  - a number with minimum and maximum value limit
    -///    (opts[i].map == NULL && opts[i].min != UINT64_MAX);
    -///  - a string that will be parsed by the filter-specific code
    -///    (opts[i].map == NULL && opts[i].min == UINT64_MAX, opts[i].max ignored)
    -///
    -/// When parsing both option and value succeed, a filter-specific function
    -/// is called, which should update the given value to filter-specific
    -/// options structure.
    -///
    -/// \param      str     String containing the options from the command line
    -/// \param      opts    Filter-specific option map
    -/// \param      set     Filter-specific function to update filter_options
    -/// \param      filter_options  Pointer to filter-specific options structure
    -///
    -/// \return     Returns only if no errors occur.
    -///
    -static void
    -parse_options(const char *str, const option_map *opts,
    -		void (*set)(void *filter_options,
    -			uint32_t key, uint64_t value, const char *valuestr),
    -		void *filter_options)
    -{
    -	if (str == NULL || str[0] == '\0')
    -		return;
    -
    -	char *s = xstrdup(str);
    -	char *name = s;
    -
    -	while (*name != '\0') {
    -		if (*name == ',') {
    -			++name;
    -			continue;
    -		}
    -
    -		char *split = strchr(name, ',');
    -		if (split != NULL)
    -			*split = '\0';
    -
    -		char *value = strchr(name, '=');
    -		if (value != NULL)
    -			*value++ = '\0';
    -
    -		if (value == NULL || value[0] == '\0')
    -			message_fatal(_("%s: Options must be `name=value' "
    -					"pairs separated with commas"), str);
    -
    -		// Look for the option name from the option map.
    -		size_t i = 0;
    -		while (true) {
    -			if (opts[i].name == NULL)
    -				message_fatal(_("%s: Invalid option name"),
    -						name);
    -
    -			if (strcmp(name, opts[i].name) == 0)
    -				break;
    -
    -			++i;
    -		}
    -
    -		// Option was found from the map. See how we should handle it.
    -		if (opts[i].map != NULL) {
    -			// value is a string which we should map
    -			// to an integer.
    -			size_t j;
    -			for (j = 0; opts[i].map[j].name != NULL; ++j) {
    -				if (strcmp(opts[i].map[j].name, value) == 0)
    -					break;
    -			}
    -
    -			if (opts[i].map[j].name == NULL)
    -				message_fatal(_("%s: Invalid option value"),
    -						value);
    -
    -			set(filter_options, i, opts[i].map[j].id, value);
    -
    -		} else if (opts[i].min == UINT64_MAX) {
    -			// value is a special string that will be
    -			// parsed by set().
    -			set(filter_options, i, 0, value);
    -
    -		} else {
    -			// value is an integer.
    -			const uint64_t v = str_to_uint64(name, value,
    -					opts[i].min, opts[i].max);
    -			set(filter_options, i, v, value);
    -		}
    -
    -		// Check if it was the last option.
    -		if (split == NULL)
    -			break;
    -
    -		name = split + 1;
    -	}
    -
    -	free(s);
    -	return;
    -}
    -
    -
    -///////////
    -// Delta //
    -///////////
    -
    -enum {
    -	OPT_DIST,
    -};
    -
    -
    -static void
    -set_delta(void *options, uint32_t key, uint64_t value,
    -		const char *valuestr lzma_attribute((__unused__)))
    -{
    -	lzma_options_delta *opt = options;
    -	switch (key) {
    -	case OPT_DIST:
    -		opt->dist = value;
    -		break;
    -	}
    -}
    -
    -
    -extern lzma_options_delta *
    -options_delta(const char *str)
    -{
    -	static const option_map opts[] = {
    -		{ "dist",     NULL,  LZMA_DELTA_DIST_MIN,
    -		                     LZMA_DELTA_DIST_MAX },
    -		{ NULL,       NULL,  0, 0 }
    -	};
    -
    -	lzma_options_delta *options = xmalloc(sizeof(lzma_options_delta));
    -	*options = (lzma_options_delta){
    -		// It's hard to give a useful default for this.
    -		.type = LZMA_DELTA_TYPE_BYTE,
    -		.dist = LZMA_DELTA_DIST_MIN,
    -	};
    -
    -	parse_options(str, opts, &set_delta, options);
    -
    -	return options;
    -}
    -
    -
    -/////////
    -// BCJ //
    -/////////
    -
    -enum {
    -	OPT_START_OFFSET,
    -};
    -
    -
    -static void
    -set_bcj(void *options, uint32_t key, uint64_t value,
    -		const char *valuestr lzma_attribute((__unused__)))
    -{
    -	lzma_options_bcj *opt = options;
    -	switch (key) {
    -	case OPT_START_OFFSET:
    -		opt->start_offset = value;
    -		break;
    -	}
    -}
    -
    -
    -extern lzma_options_bcj *
    -options_bcj(const char *str)
    -{
    -	static const option_map opts[] = {
    -		{ "start",    NULL,  0, UINT32_MAX },
    -		{ NULL,       NULL,  0, 0 }
    -	};
    -
    -	lzma_options_bcj *options = xmalloc(sizeof(lzma_options_bcj));
    -	*options = (lzma_options_bcj){
    -		.start_offset = 0,
    -	};
    -
    -	parse_options(str, opts, &set_bcj, options);
    -
    -	return options;
    -}
    -
    -
    -//////////
    -// LZMA //
    -//////////
    -
    -enum {
    -	OPT_PRESET,
    -	OPT_DICT,
    -	OPT_LC,
    -	OPT_LP,
    -	OPT_PB,
    -	OPT_MODE,
    -	OPT_NICE,
    -	OPT_MF,
    -	OPT_DEPTH,
    -};
    -
    -
    -static void lzma_attribute((__noreturn__))
    -error_lzma_preset(const char *valuestr)
    -{
    -	message_fatal(_("Unsupported LZMA1/LZMA2 preset: %s"), valuestr);
    -}
    -
    -
    -static void
    -set_lzma(void *options, uint32_t key, uint64_t value, const char *valuestr)
    -{
    -	lzma_options_lzma *opt = options;
    -
    -	switch (key) {
    -	case OPT_PRESET: {
    -		if (valuestr[0] < '0' || valuestr[0] > '9')
    -			error_lzma_preset(valuestr);
    -
    -		uint32_t preset = valuestr[0] - '0';
    -
    -		// Currently only "e" is supported as a modifier,
    -		// so keep this simple for now.
    -		if (valuestr[1] != '\0') {
    -			if (valuestr[1] == 'e')
    -				preset |= LZMA_PRESET_EXTREME;
    -			else
    -				error_lzma_preset(valuestr);
    -
    -			if (valuestr[2] != '\0')
    -				error_lzma_preset(valuestr);
    -		}
    -
    -		if (lzma_lzma_preset(options, preset))
    -			error_lzma_preset(valuestr);
    -
    -		break;
    -	}
    -
    -	case OPT_DICT:
    -		opt->dict_size = value;
    -		break;
    -
    -	case OPT_LC:
    -		opt->lc = value;
    -		break;
    -
    -	case OPT_LP:
    -		opt->lp = value;
    -		break;
    -
    -	case OPT_PB:
    -		opt->pb = value;
    -		break;
    -
    -	case OPT_MODE:
    -		opt->mode = value;
    -		break;
    -
    -	case OPT_NICE:
    -		opt->nice_len = value;
    -		break;
    -
    -	case OPT_MF:
    -		opt->mf = value;
    -		break;
    -
    -	case OPT_DEPTH:
    -		opt->depth = value;
    -		break;
    -	}
    -}
    -
    -
    -extern lzma_options_lzma *
    -options_lzma(const char *str)
    -{
    -	static const name_id_map modes[] = {
    -		{ "fast",   LZMA_MODE_FAST },
    -		{ "normal", LZMA_MODE_NORMAL },
    -		{ NULL,     0 }
    -	};
    -
    -	static const name_id_map mfs[] = {
    -		{ "hc3", LZMA_MF_HC3 },
    -		{ "hc4", LZMA_MF_HC4 },
    -		{ "bt2", LZMA_MF_BT2 },
    -		{ "bt3", LZMA_MF_BT3 },
    -		{ "bt4", LZMA_MF_BT4 },
    -		{ NULL,  0 }
    -	};
    -
    -	static const option_map opts[] = {
    -		{ "preset", NULL,   UINT64_MAX, 0 },
    -		{ "dict",   NULL,   LZMA_DICT_SIZE_MIN,
    -				(UINT32_C(1) << 30) + (UINT32_C(1) << 29) },
    -		{ "lc",     NULL,   LZMA_LCLP_MIN, LZMA_LCLP_MAX },
    -		{ "lp",     NULL,   LZMA_LCLP_MIN, LZMA_LCLP_MAX },
    -		{ "pb",     NULL,   LZMA_PB_MIN, LZMA_PB_MAX },
    -		{ "mode",   modes,  0, 0 },
    -		{ "nice",   NULL,   2, 273 },
    -		{ "mf",     mfs,    0, 0 },
    -		{ "depth",  NULL,   0, UINT32_MAX },
    -		{ NULL,     NULL,   0, 0 }
    -	};
    -
    -	lzma_options_lzma *options = xmalloc(sizeof(lzma_options_lzma));
    -	if (lzma_lzma_preset(options, LZMA_PRESET_DEFAULT))
    -		message_bug();
    -
    -	parse_options(str, opts, &set_lzma, options);
    -
    -	if (options->lc + options->lp > LZMA_LCLP_MAX)
    -		message_fatal(_("The sum of lc and lp must not exceed 4"));
    -
    -	const uint32_t nice_len_min = options->mf & 0x0F;
    -	if (options->nice_len < nice_len_min)
    -		message_fatal(_("The selected match finder requires at "
    -				"least nice=%" PRIu32), nice_len_min);
    -
    -	return options;
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/options.h b/external/public-domain/xz/dist/src/xz/options.h
    deleted file mode 100644
    index 61ec8d58a..000000000
    --- a/external/public-domain/xz/dist/src/xz/options.h
    +++ /dev/null
    @@ -1,31 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       options.h
    -/// \brief      Parser for filter-specific options
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -/// \brief      Parser for Delta options
    -///
    -/// \return     Pointer to allocated options structure.
    -///             Doesn't return on error.
    -extern lzma_options_delta *options_delta(const char *str);
    -
    -
    -/// \brief      Parser for BCJ options
    -///
    -/// \return     Pointer to allocated options structure.
    -///             Doesn't return on error.
    -extern lzma_options_bcj *options_bcj(const char *str);
    -
    -
    -/// \brief      Parser for LZMA options
    -///
    -/// \return     Pointer to allocated options structure.
    -///             Doesn't return on error.
    -extern lzma_options_lzma *options_lzma(const char *str);
    diff --git a/external/public-domain/xz/dist/src/xz/private.h b/external/public-domain/xz/dist/src/xz/private.h
    deleted file mode 100644
    index 4acfa8dc4..000000000
    --- a/external/public-domain/xz/dist/src/xz/private.h
    +++ /dev/null
    @@ -1,59 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       private.h
    -/// \brief      Common includes, definions, and prototypes
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "sysdefs.h"
    -#include "mythread.h"
    -
    -#include "lzma.h"
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include "tuklib_gettext.h"
    -#include "tuklib_progname.h"
    -#include "tuklib_exit.h"
    -#include "tuklib_mbstr.h"
    -
    -#if defined(_WIN32) && !defined(__CYGWIN__)
    -#	define WIN32_LEAN_AND_MEAN
    -#	include 
    -#endif
    -
    -#ifndef STDIN_FILENO
    -#	define STDIN_FILENO (fileno(stdin))
    -#endif
    -
    -#ifndef STDOUT_FILENO
    -#	define STDOUT_FILENO (fileno(stdout))
    -#endif
    -
    -#ifndef STDERR_FILENO
    -#	define STDERR_FILENO (fileno(stderr))
    -#endif
    -
    -#include "main.h"
    -#include "mytime.h"
    -#include "coder.h"
    -#include "message.h"
    -#include "args.h"
    -#include "hardware.h"
    -#include "file_io.h"
    -#include "options.h"
    -#include "signals.h"
    -#include "suffix.h"
    -#include "util.h"
    -#include "list.h"
    diff --git a/external/public-domain/xz/dist/src/xz/signals.c b/external/public-domain/xz/dist/src/xz/signals.c
    deleted file mode 100644
    index 5387c424e..000000000
    --- a/external/public-domain/xz/dist/src/xz/signals.c
    +++ /dev/null
    @@ -1,209 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       signals.c
    -/// \brief      Handling signals to abort operation
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -
    -volatile sig_atomic_t user_abort = false;
    -
    -
    -#if !(defined(_WIN32) && !defined(__CYGWIN__))
    -
    -/// If we were interrupted by a signal, we store the signal number so that
    -/// we can raise that signal to kill the program when all cleanups have
    -/// been done.
    -static volatile sig_atomic_t exit_signal = 0;
    -
    -/// Mask of signals for which have have established a signal handler to set
    -/// user_abort to true.
    -static sigset_t hooked_signals;
    -
    -/// True once signals_init() has finished. This is used to skip blocking
    -/// signals (with uninitialized hooked_signals) if signals_block() and
    -/// signals_unblock() are called before signals_init() has been called.
    -static bool signals_are_initialized = false;
    -
    -/// signals_block() and signals_unblock() can be called recursively.
    -static size_t signals_block_count = 0;
    -
    -
    -static void
    -signal_handler(int sig)
    -{
    -	exit_signal = sig;
    -	user_abort = true;
    -
    -#ifndef TUKLIB_DOSLIKE
    -	io_write_to_user_abort_pipe();
    -#endif
    -
    -	return;
    -}
    -
    -
    -extern void
    -signals_init(void)
    -{
    -	// List of signals for which we establish the signal handler.
    -	static const int sigs[] = {
    -		SIGINT,
    -		SIGTERM,
    -#ifdef SIGHUP
    -		SIGHUP,
    -#endif
    -#ifdef SIGPIPE
    -		SIGPIPE,
    -#endif
    -#ifdef SIGXCPU
    -		SIGXCPU,
    -#endif
    -#ifdef SIGXFSZ
    -		SIGXFSZ,
    -#endif
    -	};
    -
    -	// Mask of the signals for which we have established a signal handler.
    -	sigemptyset(&hooked_signals);
    -	for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i)
    -		sigaddset(&hooked_signals, sigs[i]);
    -
    -#ifdef SIGALRM
    -	// Add also the signals from message.c to hooked_signals.
    -	for (size_t i = 0; message_progress_sigs[i] != 0; ++i)
    -		sigaddset(&hooked_signals, message_progress_sigs[i]);
    -#endif
    -
    -	// Using "my_sa" because "sa" may conflict with a sockaddr variable
    -	// from system headers on Solaris.
    -	struct sigaction my_sa;
    -
    -	// All the signals that we handle we also blocked while the signal
    -	// handler runs.
    -	my_sa.sa_mask = hooked_signals;
    -
    -	// Don't set SA_RESTART, because we want EINTR so that we can check
    -	// for user_abort and cleanup before exiting. We block the signals
    -	// for which we have established a handler when we don't want EINTR.
    -	my_sa.sa_flags = 0;
    -	my_sa.sa_handler = &signal_handler;
    -
    -	for (size_t i = 0; i < ARRAY_SIZE(sigs); ++i) {
    -		// If the parent process has left some signals ignored,
    -		// we don't unignore them.
    -		struct sigaction old;
    -		if (sigaction(sigs[i], NULL, &old) == 0
    -				&& old.sa_handler == SIG_IGN)
    -			continue;
    -
    -		// Establish the signal handler.
    -		if (sigaction(sigs[i], &my_sa, NULL))
    -			message_signal_handler();
    -	}
    -
    -	signals_are_initialized = true;
    -
    -	return;
    -}
    -
    -
    -#ifndef __VMS
    -extern void
    -signals_block(void)
    -{
    -	if (signals_are_initialized) {
    -		if (signals_block_count++ == 0) {
    -			const int saved_errno = errno;
    -			mythread_sigmask(SIG_BLOCK, &hooked_signals, NULL);
    -			errno = saved_errno;
    -		}
    -	}
    -
    -	return;
    -}
    -
    -
    -extern void
    -signals_unblock(void)
    -{
    -	if (signals_are_initialized) {
    -		assert(signals_block_count > 0);
    -
    -		if (--signals_block_count == 0) {
    -			const int saved_errno = errno;
    -			mythread_sigmask(SIG_UNBLOCK, &hooked_signals, NULL);
    -			errno = saved_errno;
    -		}
    -	}
    -
    -	return;
    -}
    -#endif
    -
    -
    -extern void
    -signals_exit(void)
    -{
    -	const int sig = exit_signal;
    -
    -	if (sig != 0) {
    -#if defined(TUKLIB_DOSLIKE) || defined(__VMS)
    -		// Don't raise(), set only exit status. This avoids
    -		// printing unwanted message about SIGINT when the user
    -		// presses C-c.
    -		set_exit_status(E_ERROR);
    -#else
    -		struct sigaction sa;
    -		sa.sa_handler = SIG_DFL;
    -		sigfillset(&sa.sa_mask);
    -		sa.sa_flags = 0;
    -		sigaction(sig, &sa, NULL);
    -		raise(exit_signal);
    -#endif
    -	}
    -
    -	return;
    -}
    -
    -#else
    -
    -// While Windows has some very basic signal handling functions as required
    -// by C89, they are not really used, and e.g. SIGINT doesn't work exactly
    -// the way it does on POSIX (Windows creates a new thread for the signal
    -// handler). Instead, we use SetConsoleCtrlHandler() to catch user
    -// pressing C-c, because that seems to be the recommended way to do it.
    -//
    -// NOTE: This doesn't work under MSYS. Trying with SIGINT doesn't work
    -// either even if it appeared to work at first. So test using Windows
    -// console window.
    -
    -static BOOL WINAPI
    -signal_handler(DWORD type lzma_attribute((__unused__)))
    -{
    -	// Since we don't get a signal number which we could raise() at
    -	// signals_exit() like on POSIX, just set the exit status to
    -	// indicate an error, so that we cannot return with zero exit status.
    -	set_exit_status(E_ERROR);
    -	user_abort = true;
    -	return TRUE;
    -}
    -
    -
    -extern void
    -signals_init(void)
    -{
    -	if (!SetConsoleCtrlHandler(&signal_handler, TRUE))
    -		message_signal_handler();
    -
    -	return;
    -}
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/src/xz/signals.h b/external/public-domain/xz/dist/src/xz/signals.h
    deleted file mode 100644
    index 5b125e0f0..000000000
    --- a/external/public-domain/xz/dist/src/xz/signals.h
    +++ /dev/null
    @@ -1,43 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       signals.h
    -/// \brief      Handling signals to abort operation
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -/// If this is true, we will clean up the possibly incomplete output file,
    -/// return to main() as soon as practical. That is, the code needs to poll
    -/// this variable in various places.
    -extern volatile sig_atomic_t user_abort;
    -
    -
    -/// Initialize the signal handler, which will set user_abort to true when
    -/// user e.g. presses C-c.
    -extern void signals_init(void);
    -
    -
    -#if (defined(_WIN32) && !defined(__CYGWIN__)) || defined(__VMS)
    -#	define signals_block() do { } while (0)
    -#	define signals_unblock() do { } while (0)
    -#else
    -/// Block the signals which don't have SA_RESTART and which would just set
    -/// user_abort to true. This is handy when we don't want to handle EINTR
    -/// and don't want SA_RESTART either.
    -extern void signals_block(void);
    -
    -/// Unblock the signals blocked by signals_block().
    -extern void signals_unblock(void);
    -#endif
    -
    -#if defined(_WIN32) && !defined(__CYGWIN__)
    -#	define signals_exit() do { } while (0)
    -#else
    -/// If user has sent us a signal earlier to terminate the process,
    -/// re-raise that signal to actually terminate the process.
    -extern void signals_exit(void);
    -#endif
    diff --git a/external/public-domain/xz/dist/src/xz/suffix.c b/external/public-domain/xz/dist/src/xz/suffix.c
    deleted file mode 100644
    index 9d4fcd139..000000000
    --- a/external/public-domain/xz/dist/src/xz/suffix.c
    +++ /dev/null
    @@ -1,399 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       suffix.c
    -/// \brief      Checks filename suffix and creates the destination filename
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -
    -#ifdef __DJGPP__
    -#	include 
    -#endif
    -
    -// For case-insensitive filename suffix on case-insensitive systems
    -#if defined(TUKLIB_DOSLIKE) || defined(__VMS)
    -#	define strcmp strcasecmp
    -#endif
    -
    -
    -static char *custom_suffix = NULL;
    -
    -
    -/// \brief      Test if the char is a directory separator
    -static bool
    -is_dir_sep(char c)
    -{
    -#ifdef TUKLIB_DOSLIKE
    -	return c == '/' || c == '\\' || c == ':';
    -#else
    -	return c == '/';
    -#endif
    -}
    -
    -
    -/// \brief      Test if the string contains a directory separator
    -static bool
    -has_dir_sep(const char *str)
    -{
    -#ifdef TUKLIB_DOSLIKE
    -	return strpbrk(str, "/\\:") != NULL;
    -#else
    -	return strchr(str, '/') != NULL;
    -#endif
    -}
    -
    -
    -#ifdef __DJGPP__
    -/// \brief      Test for special suffix used for 8.3 short filenames (SFN)
    -///
    -/// \return     If str matches *.?- or *.??-, true is returned. Otherwise
    -///             false is returned.
    -static bool
    -has_sfn_suffix(const char *str, size_t len)
    -{
    -	if (len >= 4 && str[len - 1] == '-' && str[len - 2] != '.'
    -			&& !is_dir_sep(str[len - 2])) {
    -		// *.?-
    -		if (str[len - 3] == '.')
    -			return !is_dir_sep(str[len - 4]);
    -
    -		// *.??-
    -		if (len >= 5 && !is_dir_sep(str[len - 3])
    -				&& str[len - 4] == '.')
    -			return !is_dir_sep(str[len - 5]);
    -	}
    -
    -	return false;
    -}
    -#endif
    -
    -
    -/// \brief      Checks if src_name has given compressed_suffix
    -///
    -/// \param      suffix      Filename suffix to look for
    -/// \param      src_name    Input filename
    -/// \param      src_len     strlen(src_name)
    -///
    -/// \return     If src_name has the suffix, src_len - strlen(suffix) is
    -///             returned. It's always a positive integer. Otherwise zero
    -///             is returned.
    -static size_t
    -test_suffix(const char *suffix, const char *src_name, size_t src_len)
    -{
    -	const size_t suffix_len = strlen(suffix);
    -
    -	// The filename must have at least one character in addition to
    -	// the suffix. src_name may contain path to the filename, so we
    -	// need to check for directory separator too.
    -	if (src_len <= suffix_len
    -			|| is_dir_sep(src_name[src_len - suffix_len - 1]))
    -		return 0;
    -
    -	if (strcmp(suffix, src_name + src_len - suffix_len) == 0)
    -		return src_len - suffix_len;
    -
    -	return 0;
    -}
    -
    -
    -/// \brief      Removes the filename suffix of the compressed file
    -///
    -/// \return     Name of the uncompressed file, or NULL if file has unknown
    -///             suffix.
    -static char *
    -uncompressed_name(const char *src_name, const size_t src_len)
    -{
    -	static const struct {
    -		const char *compressed;
    -		const char *uncompressed;
    -	} suffixes[] = {
    -		{ ".xz",    "" },
    -		{ ".txz",   ".tar" }, // .txz abbreviation for .txt.gz is rare.
    -		{ ".lzma",  "" },
    -#ifdef __DJGPP__
    -		{ ".lzm",   "" },
    -#endif
    -		{ ".tlz",   ".tar" },
    -		// { ".gz",    "" },
    -		// { ".tgz",   ".tar" },
    -	};
    -
    -	const char *new_suffix = "";
    -	size_t new_len = 0;
    -
    -	if (opt_format == FORMAT_RAW) {
    -		// Don't check for known suffixes when --format=raw was used.
    -		if (custom_suffix == NULL) {
    -			message_error(_("%s: With --format=raw, "
    -					"--suffix=.SUF is required unless "
    -					"writing to stdout"), src_name);
    -			return NULL;
    -		}
    -	} else {
    -		for (size_t i = 0; i < ARRAY_SIZE(suffixes); ++i) {
    -			new_len = test_suffix(suffixes[i].compressed,
    -					src_name, src_len);
    -			if (new_len != 0) {
    -				new_suffix = suffixes[i].uncompressed;
    -				break;
    -			}
    -		}
    -
    -#ifdef __DJGPP__
    -		// Support also *.?- -> *.? and *.??- -> *.?? on DOS.
    -		// This is done also when long filenames are available
    -		// to keep it easy to decompress files created when
    -		// long filename support wasn't available.
    -		if (new_len == 0 && has_sfn_suffix(src_name, src_len)) {
    -			new_suffix = "";
    -			new_len = src_len - 1;
    -		}
    -#endif
    -	}
    -
    -	if (new_len == 0 && custom_suffix != NULL)
    -		new_len = test_suffix(custom_suffix, src_name, src_len);
    -
    -	if (new_len == 0) {
    -		message_warning(_("%s: Filename has an unknown suffix, "
    -				"skipping"), src_name);
    -		return NULL;
    -	}
    -
    -	const size_t new_suffix_len = strlen(new_suffix);
    -	char *dest_name = xmalloc(new_len + new_suffix_len + 1);
    -
    -	memcpy(dest_name, src_name, new_len);
    -	memcpy(dest_name + new_len, new_suffix, new_suffix_len);
    -	dest_name[new_len + new_suffix_len] = '\0';
    -
    -	return dest_name;
    -}
    -
    -
    -/// This message is needed in multiple places in compressed_name(),
    -/// so the message has been put into its own function.
    -static void
    -msg_suffix(const char *src_name, const char *suffix)
    -{
    -	message_warning(_("%s: File already has `%s' suffix, skipping"),
    -			src_name, suffix);
    -	return;
    -}
    -
    -
    -/// \brief      Appends suffix to src_name
    -///
    -/// In contrast to uncompressed_name(), we check only suffixes that are valid
    -/// for the specified file format.
    -static char *
    -compressed_name(const char *src_name, size_t src_len)
    -{
    -	// The order of these must match the order in args.h.
    -	static const char *const all_suffixes[][4] = {
    -		{
    -			".xz",
    -			".txz",
    -			NULL
    -		}, {
    -			".lzma",
    -#ifdef __DJGPP__
    -			".lzm",
    -#endif
    -			".tlz",
    -			NULL
    -/*
    -		}, {
    -			".gz",
    -			".tgz",
    -			NULL
    -*/
    -		}, {
    -			// --format=raw requires specifying the suffix
    -			// manually or using stdout.
    -			NULL
    -		}
    -	};
    -
    -	// args.c ensures this.
    -	assert(opt_format != FORMAT_AUTO);
    -
    -	const size_t format = opt_format - 1;
    -	const char *const *suffixes = all_suffixes[format];
    -
    -	// Look for known filename suffixes and refuse to compress them.
    -	for (size_t i = 0; suffixes[i] != NULL; ++i) {
    -		if (test_suffix(suffixes[i], src_name, src_len) != 0) {
    -			msg_suffix(src_name, suffixes[i]);
    -			return NULL;
    -		}
    -	}
    -
    -#ifdef __DJGPP__
    -	// Recognize also the special suffix that is used when long
    -	// filename (LFN) support isn't available. This suffix is
    -	// recognized on LFN systems too.
    -	if (opt_format == FORMAT_XZ && has_sfn_suffix(src_name, src_len)) {
    -		msg_suffix(src_name, "-");
    -		return NULL;
    -	}
    -#endif
    -
    -	if (custom_suffix != NULL) {
    -		if (test_suffix(custom_suffix, src_name, src_len) != 0) {
    -			msg_suffix(src_name, custom_suffix);
    -			return NULL;
    -		}
    -	}
    -
    -	// TODO: Hmm, maybe it would be better to validate this in args.c,
    -	// since the suffix handling when decoding is weird now.
    -	if (opt_format == FORMAT_RAW && custom_suffix == NULL) {
    -		message_error(_("%s: With --format=raw, "
    -				"--suffix=.SUF is required unless "
    -				"writing to stdout"), src_name);
    -		return NULL;
    -	}
    -
    -	const char *suffix = custom_suffix != NULL
    -			? custom_suffix : suffixes[0];
    -	size_t suffix_len = strlen(suffix);
    -
    -#ifdef __DJGPP__
    -	if (!_use_lfn(src_name)) {
    -		// Long filename (LFN) support isn't available and we are
    -		// limited to 8.3 short filenames (SFN).
    -		//
    -		// Look for suffix separator from the filename, and make sure
    -		// that it is in the filename, not in a directory name.
    -		const char *sufsep = strrchr(src_name, '.');
    -		if (sufsep == NULL || sufsep[1] == '\0'
    -				|| has_dir_sep(sufsep)) {
    -			// src_name has no filename extension.
    -			//
    -			// Examples:
    -			// xz foo         -> foo.xz
    -			// xz -F lzma foo -> foo.lzm
    -			// xz -S x foo    -> foox
    -			// xz -S x foo.   -> foo.x
    -			// xz -S x.y foo  -> foox.y
    -			// xz -S .x foo   -> foo.x
    -			// xz -S .x foo.  -> foo.x
    -			//
    -			// Avoid double dots:
    -			if (sufsep != NULL && sufsep[1] == '\0'
    -					&& suffix[0] == '.')
    -				--src_len;
    -
    -		} else if (custom_suffix == NULL
    -				&& strcasecmp(sufsep, ".tar") == 0) {
    -			// ".tar" is handled specially.
    -			//
    -			// Examples:
    -			// xz foo.tar          -> foo.txz
    -			// xz -F lzma foo.tar  -> foo.tlz
    -			static const char *const tar_suffixes[] = {
    -				".txz",
    -				".tlz",
    -				// ".tgz",
    -			};
    -			suffix = tar_suffixes[format];
    -			suffix_len = 4;
    -			src_len -= 4;
    -
    -		} else {
    -			if (custom_suffix == NULL && opt_format == FORMAT_XZ) {
    -				// Instead of the .xz suffix, use a single
    -				// character at the end of the filename
    -				// extension. This is to minimize name
    -				// conflicts when compressing multiple files
    -				// with the same basename. E.g. foo.txt and
    -				// foo.exe become foo.tx- and foo.ex-. Dash
    -				// is rare as the last character of the
    -				// filename extension, so it seems to be
    -				// quite safe choice and it stands out better
    -				// in directory listings than e.g. x. For
    -				// comparison, gzip uses z.
    -				suffix = "-";
    -				suffix_len = 1;
    -			}
    -
    -			if (suffix[0] == '.') {
    -				// The first character of the suffix is a dot.
    -				// Throw away the original filename extension
    -				// and replace it with the new suffix.
    -				//
    -				// Examples:
    -				// xz -F lzma foo.txt  -> foo.lzm
    -				// xz -S .x  foo.txt   -> foo.x
    -				src_len = sufsep - src_name;
    -
    -			} else {
    -				// The first character of the suffix is not
    -				// a dot. Preserve the first 0-2 characters
    -				// of the original filename extension.
    -				//
    -				// Examples:
    -				// xz foo.txt         -> foo.tx-
    -				// xz -S x  foo.c     -> foo.cx
    -				// xz -S ab foo.c     -> foo.cab
    -				// xz -S ab foo.txt   -> foo.tab
    -				// xz -S abc foo.txt  -> foo.abc
    -				//
    -				// Truncate the suffix to three chars:
    -				if (suffix_len > 3)
    -					suffix_len = 3;
    -
    -				// If needed, overwrite 1-3 characters.
    -				if (strlen(sufsep) > 4 - suffix_len)
    -					src_len = sufsep - src_name
    -							+ 4 - suffix_len;
    -			}
    -		}
    -	}
    -#endif
    -
    -	char *dest_name = xmalloc(src_len + suffix_len + 1);
    -
    -	memcpy(dest_name, src_name, src_len);
    -	memcpy(dest_name + src_len, suffix, suffix_len);
    -	dest_name[src_len + suffix_len] = '\0';
    -
    -	return dest_name;
    -}
    -
    -
    -extern char *
    -suffix_get_dest_name(const char *src_name)
    -{
    -	assert(src_name != NULL);
    -
    -	// Length of the name is needed in all cases to locate the end of
    -	// the string to compare the suffix, so calculate the length here.
    -	const size_t src_len = strlen(src_name);
    -
    -	return opt_mode == MODE_COMPRESS
    -			? compressed_name(src_name, src_len)
    -			: uncompressed_name(src_name, src_len);
    -}
    -
    -
    -extern void
    -suffix_set(const char *suffix)
    -{
    -	// Empty suffix and suffixes having a directory separator are
    -	// rejected. Such suffixes would break things later.
    -	if (suffix[0] == '\0' || has_dir_sep(suffix))
    -		message_fatal(_("%s: Invalid filename suffix"), suffix);
    -
    -	// Replace the old custom_suffix (if any) with the new suffix.
    -	free(custom_suffix);
    -	custom_suffix = xstrdup(suffix);
    -	return;
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/suffix.h b/external/public-domain/xz/dist/src/xz/suffix.h
    deleted file mode 100644
    index 5537d7324..000000000
    --- a/external/public-domain/xz/dist/src/xz/suffix.h
    +++ /dev/null
    @@ -1,28 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       suffix.h
    -/// \brief      Checks filename suffix and creates the destination filename
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -/// \brief      Get the name of the destination file
    -///
    -/// Depending on the global variable opt_mode, this tries to find a matching
    -/// counterpart for src_name. If the name can be constructed, it is allocated
    -/// and returned (caller must free it). On error, a message is printed and
    -/// NULL is returned.
    -extern char *suffix_get_dest_name(const char *src_name);
    -
    -
    -/// \brief      Set a custom filename suffix
    -///
    -/// This function calls xstrdup() for the given suffix, thus the caller
    -/// doesn't need to keep the memory allocated. There can be only one custom
    -/// suffix, thus if this is called multiple times, the old suffixes are freed
    -/// and forgotten.
    -extern void suffix_set(const char *suffix);
    diff --git a/external/public-domain/xz/dist/src/xz/util.c b/external/public-domain/xz/dist/src/xz/util.c
    deleted file mode 100644
    index 35850f4c9..000000000
    --- a/external/public-domain/xz/dist/src/xz/util.c
    +++ /dev/null
    @@ -1,288 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       util.c
    -/// \brief      Miscellaneous utility functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "private.h"
    -#include 
    -
    -
    -/// Buffers for uint64_to_str() and uint64_to_nicestr()
    -static char bufs[4][128];
    -
    -/// Thousand separator support in uint64_to_str() and uint64_to_nicestr()
    -static enum { UNKNOWN, WORKS, BROKEN } thousand = UNKNOWN;
    -
    -
    -extern void *
    -xrealloc(void *ptr, size_t size)
    -{
    -	assert(size > 0);
    -
    -	// Save ptr so that we can free it if realloc fails.
    -	// The point is that message_fatal ends up calling stdio functions
    -	// which in some libc implementations might allocate memory from
    -	// the heap. Freeing ptr improves the chances that there's free
    -	// memory for stdio functions if they need it.
    -	void *p = ptr;
    -	ptr = realloc(ptr, size);
    -
    -	if (ptr == NULL) {
    -		const int saved_errno = errno;
    -		free(p);
    -		message_fatal("%s", strerror(saved_errno));
    -	}
    -
    -	return ptr;
    -}
    -
    -
    -extern char *
    -xstrdup(const char *src)
    -{
    -	assert(src != NULL);
    -	const size_t size = strlen(src) + 1;
    -	char *dest = xmalloc(size);
    -	return memcpy(dest, src, size);
    -}
    -
    -
    -extern uint64_t
    -str_to_uint64(const char *name, const char *value, uint64_t min, uint64_t max)
    -{
    -	uint64_t result = 0;
    -
    -	// Skip blanks.
    -	while (*value == ' ' || *value == '\t')
    -		++value;
    -
    -	// Accept special value "max". Supporting "min" doesn't seem useful.
    -	if (strcmp(value, "max") == 0)
    -		return max;
    -
    -	if (*value < '0' || *value > '9')
    -		message_fatal(_("%s: Value is not a non-negative "
    -				"decimal integer"), value);
    -
    -	do {
    -		// Don't overflow.
    -		if (result > UINT64_MAX / 10)
    -			goto error;
    -
    -		result *= 10;
    -
    -		// Another overflow check
    -		const uint32_t add = *value - '0';
    -		if (UINT64_MAX - add < result)
    -			goto error;
    -
    -		result += add;
    -		++value;
    -	} while (*value >= '0' && *value <= '9');
    -
    -	if (*value != '\0') {
    -		// Look for suffix. Originally this supported both base-2
    -		// and base-10, but since there seems to be little need
    -		// for base-10 in this program, treat everything as base-2
    -		// and also be more relaxed about the case of the first
    -		// letter of the suffix.
    -		uint64_t multiplier = 0;
    -		if (*value == 'k' || *value == 'K')
    -			multiplier = UINT64_C(1) << 10;
    -		else if (*value == 'm' || *value == 'M')
    -			multiplier = UINT64_C(1) << 20;
    -		else if (*value == 'g' || *value == 'G')
    -			multiplier = UINT64_C(1) << 30;
    -
    -		++value;
    -
    -		// Allow also e.g. Ki, KiB, and KB.
    -		if (*value != '\0' && strcmp(value, "i") != 0
    -				&& strcmp(value, "iB") != 0
    -				&& strcmp(value, "B") != 0)
    -			multiplier = 0;
    -
    -		if (multiplier == 0) {
    -			message(V_ERROR, _("%s: Invalid multiplier suffix"),
    -					value - 1);
    -			message_fatal(_("Valid suffixes are `KiB' (2^10), "
    -					"`MiB' (2^20), and `GiB' (2^30)."));
    -		}
    -
    -		// Don't overflow here either.
    -		if (result > UINT64_MAX / multiplier)
    -			goto error;
    -
    -		result *= multiplier;
    -	}
    -
    -	if (result < min || result > max)
    -		goto error;
    -
    -	return result;
    -
    -error:
    -	message_fatal(_("Value of the option `%s' must be in the range "
    -				"[%" PRIu64 ", %" PRIu64 "]"),
    -				name, min, max);
    -}
    -
    -
    -extern uint64_t
    -round_up_to_mib(uint64_t n)
    -{
    -	return (n >> 20) + ((n & ((UINT32_C(1) << 20) - 1)) != 0);
    -}
    -
    -
    -/// Check if thousand separator is supported. Run-time checking is easiest,
    -/// because it seems to be sometimes lacking even on POSIXish system.
    -static void
    -check_thousand_sep(uint32_t slot)
    -{
    -	if (thousand == UNKNOWN) {
    -		bufs[slot][0] = '\0';
    -		snprintf(bufs[slot], sizeof(bufs[slot]), "%'u", 1U);
    -		thousand = bufs[slot][0] == '1' ? WORKS : BROKEN;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern const char *
    -uint64_to_str(uint64_t value, uint32_t slot)
    -{
    -	assert(slot < ARRAY_SIZE(bufs));
    -
    -	check_thousand_sep(slot);
    -
    -	if (thousand == WORKS)
    -		snprintf(bufs[slot], sizeof(bufs[slot]), "%'" PRIu64, value);
    -	else
    -		snprintf(bufs[slot], sizeof(bufs[slot]), "%" PRIu64, value);
    -
    -	return bufs[slot];
    -}
    -
    -
    -extern const char *
    -uint64_to_nicestr(uint64_t value, enum nicestr_unit unit_min,
    -		enum nicestr_unit unit_max, bool always_also_bytes,
    -		uint32_t slot)
    -{
    -	assert(unit_min <= unit_max);
    -	assert(unit_max <= NICESTR_TIB);
    -	assert(slot < ARRAY_SIZE(bufs));
    -
    -	check_thousand_sep(slot);
    -
    -	enum nicestr_unit unit = NICESTR_B;
    -	char *pos = bufs[slot];
    -	size_t left = sizeof(bufs[slot]);
    -
    -	if ((unit_min == NICESTR_B && value < 10000)
    -			|| unit_max == NICESTR_B) {
    -		// The value is shown as bytes.
    -		if (thousand == WORKS)
    -			my_snprintf(&pos, &left, "%'u", (unsigned int)value);
    -		else
    -			my_snprintf(&pos, &left, "%u", (unsigned int)value);
    -	} else {
    -		// Scale the value to a nicer unit. Unless unit_min and
    -		// unit_max limit us, we will show at most five significant
    -		// digits with one decimal place.
    -		double d = (double)(value);
    -		do {
    -			d /= 1024.0;
    -			++unit;
    -		} while (unit < unit_min || (d > 9999.9 && unit < unit_max));
    -
    -		if (thousand == WORKS)
    -			my_snprintf(&pos, &left, "%'.1f", d);
    -		else
    -			my_snprintf(&pos, &left, "%.1f", d);
    -	}
    -
    -	static const char suffix[5][4] = { "B", "KiB", "MiB", "GiB", "TiB" };
    -	my_snprintf(&pos, &left, " %s", suffix[unit]);
    -
    -	if (always_also_bytes && value >= 10000) {
    -		if (thousand == WORKS)
    -			snprintf(pos, left, " (%'" PRIu64 " B)", value);
    -		else
    -			snprintf(pos, left, " (%" PRIu64 " B)", value);
    -	}
    -
    -	return bufs[slot];
    -}
    -
    -
    -extern void
    -my_snprintf(char **pos, size_t *left, const char *fmt, ...)
    -{
    -	va_list ap;
    -	va_start(ap, fmt);
    -	const int len = vsnprintf(*pos, *left, fmt, ap);
    -	va_end(ap);
    -
    -	// If an error occurred, we want the caller to think that the whole
    -	// buffer was used. This way no more data will be written to the
    -	// buffer. We don't need better error handling here, although it
    -	// is possible that the result looks garbage on the terminal if
    -	// e.g. an UTF-8 character gets split. That shouldn't (easily)
    -	// happen though, because the buffers used have some extra room.
    -	if (len < 0 || (size_t)(len) >= *left) {
    -		*left = 0;
    -	} else {
    -		*pos += len;
    -		*left -= len;
    -	}
    -
    -	return;
    -}
    -
    -
    -extern bool
    -is_empty_filename(const char *filename)
    -{
    -	if (filename[0] == '\0') {
    -		message_error(_("Empty filename, skipping"));
    -		return true;
    -	}
    -
    -	return false;
    -}
    -
    -
    -extern bool
    -is_tty_stdin(void)
    -{
    -	const bool ret = isatty(STDIN_FILENO);
    -
    -	if (ret)
    -		message_error(_("Compressed data cannot be read from "
    -				"a terminal"));
    -
    -	return ret;
    -}
    -
    -
    -extern bool
    -is_tty_stdout(void)
    -{
    -	const bool ret = isatty(STDOUT_FILENO);
    -
    -	if (ret)
    -		message_error(_("Compressed data cannot be written to "
    -				"a terminal"));
    -
    -	return ret;
    -}
    diff --git a/external/public-domain/xz/dist/src/xz/util.h b/external/public-domain/xz/dist/src/xz/util.h
    deleted file mode 100644
    index a2516bf96..000000000
    --- a/external/public-domain/xz/dist/src/xz/util.h
    +++ /dev/null
    @@ -1,123 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       util.h
    -/// \brief      Miscellaneous utility functions
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -/// \brief      Safe malloc() that never returns NULL
    -///
    -/// \note       xmalloc(), xrealloc(), and xstrdup() must not be used when
    -///             there are files open for writing, that should be cleaned up
    -///             before exiting.
    -#define xmalloc(size) xrealloc(NULL, size)
    -
    -
    -/// \brief      Safe realloc() that never returns NULL
    -extern void *xrealloc(void *ptr, size_t size)
    -		lzma_attribute((__malloc__)) lzma_attr_alloc_size(2);
    -
    -
    -/// \brief      Safe strdup() that never returns NULL
    -extern char *xstrdup(const char *src) lzma_attribute((__malloc__));
    -
    -
    -/// \brief      Fancy version of strtoull()
    -///
    -/// \param      name    Name of the option to show in case of an error
    -/// \param      value   String containing the number to be parsed; may
    -///                     contain suffixes "k", "M", "G", "Ki", "Mi", or "Gi"
    -/// \param      min     Minimum valid value
    -/// \param      max     Maximum valid value
    -///
    -/// \return     Parsed value that is in the range [min, max]. Does not return
    -///             if an error occurs.
    -///
    -extern uint64_t str_to_uint64(const char *name, const char *value,
    -		uint64_t min, uint64_t max);
    -
    -
    -/// \brief      Round an integer up to the next full MiB and convert to MiB
    -///
    -/// This is used when printing memory usage and limit.
    -extern uint64_t round_up_to_mib(uint64_t n);
    -
    -
    -/// \brief      Convert uint64_t to a string
    -///
    -/// Convert the given value to a string with locale-specific thousand
    -/// separators, if supported by the snprintf() implementation. The string
    -/// is stored into an internal static buffer indicated by the slot argument.
    -/// A pointer to the selected buffer is returned.
    -///
    -/// This function exists, because non-POSIX systems don't support thousand
    -/// separator in format strings. Solving the problem in a simple way doesn't
    -/// work, because it breaks gettext (specifically, the xgettext tool).
    -extern const char *uint64_to_str(uint64_t value, uint32_t slot);
    -
    -
    -enum nicestr_unit {
    -	NICESTR_B,
    -	NICESTR_KIB,
    -	NICESTR_MIB,
    -	NICESTR_GIB,
    -	NICESTR_TIB,
    -};
    -
    -
    -/// \brief      Convert uint64_t to a nice human readable string
    -///
    -/// This is like uint64_to_str() but uses B, KiB, MiB, GiB, or TiB suffix
    -/// and optionally includes the exact size in parenthesis.
    -///
    -/// \param      value     Value to be printed
    -/// \param      unit_min  Smallest unit to use. This and unit_max are used
    -///                       e.g. when showing the progress indicator to force
    -///                       the unit to MiB.
    -/// \param      unit_max  Biggest unit to use. assert(unit_min <= unit_max).
    -/// \param      always_also_bytes
    -///                       Show also the exact byte value in parenthesis
    -///                       if the nicely formatted string uses bigger unit
    -///                       than bytes.
    -/// \param      slot      Which static buffer to use to hold the string.
    -///                       This is shared with uint64_to_str().
    -///
    -/// \return     Pointer to statically allocated buffer containing the string.
    -///
    -/// \note       This uses double_to_str() internally so the static buffer
    -///             in double_to_str() will be overwritten.
    -///
    -extern const char *uint64_to_nicestr(uint64_t value,
    -		enum nicestr_unit unit_min, enum nicestr_unit unit_max,
    -		bool always_also_bytes, uint32_t slot);
    -
    -
    -/// \brief      Wrapper for snprintf() to help constructing a string in pieces
    -///
    -/// A maximum of *left bytes is written starting from *pos. *pos and *left
    -/// are updated accordingly.
    -extern void my_snprintf(char **pos, size_t *left, const char *fmt, ...)
    -		lzma_attribute((__format__(__printf__, 3, 4)));
    -
    -
    -/// \brief      Check if filename is empty and print an error message
    -extern bool is_empty_filename(const char *filename);
    -
    -
    -/// \brief      Test if stdin is a terminal
    -///
    -/// If stdin is a terminal, an error message is printed and exit status set
    -/// to EXIT_ERROR.
    -extern bool is_tty_stdin(void);
    -
    -
    -/// \brief      Test if stdout is a terminal
    -///
    -/// If stdout is a terminal, an error message is printed and exit status set
    -/// to EXIT_ERROR.
    -extern bool is_tty_stdout(void);
    diff --git a/external/public-domain/xz/dist/src/xz/xz.1 b/external/public-domain/xz/dist/src/xz/xz.1
    deleted file mode 100644
    index 75aead3d0..000000000
    --- a/external/public-domain/xz/dist/src/xz/xz.1
    +++ /dev/null
    @@ -1,2778 +0,0 @@
    -'\" t
    -.\"
    -.\" Author: Lasse Collin
    -.\"
    -.\" This file has been put into the public domain.
    -.\" You can do whatever you want with this file.
    -.\"
    -.TH XZ 1 "2014-12-16" "Tukaani" "XZ Utils"
    -.
    -.SH NAME
    -xz, unxz, xzcat, lzma, unlzma, lzcat \- Compress or decompress .xz and .lzma files
    -.
    -.SH SYNOPSIS
    -.B xz
    -.RI [ option... ]
    -.RI [ file... ]
    -.
    -.SH COMMAND ALIASES
    -.B unxz
    -is equivalent to
    -.BR "xz \-\-decompress" .
    -.br
    -.B xzcat
    -is equivalent to
    -.BR "xz \-\-decompress \-\-stdout" .
    -.br
    -.B lzma
    -is equivalent to
    -.BR "xz \-\-format=lzma" .
    -.br
    -.B unlzma
    -is equivalent to
    -.BR "xz \-\-format=lzma \-\-decompress" .
    -.br
    -.B lzcat
    -is equivalent to
    -.BR "xz \-\-format=lzma \-\-decompress \-\-stdout" .
    -.PP
    -When writing scripts that need to decompress files,
    -it is recommended to always use the name
    -.B xz
    -with appropriate arguments
    -.RB ( "xz \-d"
    -or
    -.BR "xz \-dc" )
    -instead of the names
    -.B unxz
    -and
    -.BR xzcat .
    -.
    -.SH DESCRIPTION
    -.B xz
    -is a general-purpose data compression tool with
    -command line syntax similar to
    -.BR gzip (1)
    -and
    -.BR bzip2 (1).
    -The native file format is the
    -.B .xz
    -format, but the legacy
    -.B .lzma
    -format used by LZMA Utils and
    -raw compressed streams with no container format headers
    -are also supported.
    -.PP
    -.B xz
    -compresses or decompresses each
    -.I file
    -according to the selected operation mode.
    -If no
    -.I files
    -are given or
    -.I file
    -is
    -.BR \- ,
    -.B xz
    -reads from standard input and writes the processed data
    -to standard output.
    -.B xz
    -will refuse (display an error and skip the
    -.IR file )
    -to write compressed data to standard output if it is a terminal.
    -Similarly,
    -.B xz
    -will refuse to read compressed data
    -from standard input if it is a terminal.
    -.PP
    -Unless
    -.B \-\-stdout
    -is specified,
    -.I files
    -other than
    -.B \-
    -are written to a new file whose name is derived from the source
    -.I file
    -name:
    -.IP \(bu 3
    -When compressing, the suffix of the target file format
    -.RB ( .xz
    -or
    -.BR .lzma )
    -is appended to the source filename to get the target filename.
    -.IP \(bu 3
    -When decompressing, the
    -.B .xz
    -or
    -.B .lzma
    -suffix is removed from the filename to get the target filename.
    -.B xz
    -also recognizes the suffixes
    -.B .txz
    -and
    -.BR .tlz ,
    -and replaces them with the
    -.B .tar
    -suffix.
    -.PP
    -If the target file already exists, an error is displayed and the
    -.I file
    -is skipped.
    -.PP
    -Unless writing to standard output,
    -.B xz
    -will display a warning and skip the
    -.I file
    -if any of the following applies:
    -.IP \(bu 3
    -.I File
    -is not a regular file.
    -Symbolic links are not followed,
    -and thus they are not considered to be regular files.
    -.IP \(bu 3
    -.I File
    -has more than one hard link.
    -.IP \(bu 3
    -.I File
    -has setuid, setgid, or sticky bit set.
    -.IP \(bu 3
    -The operation mode is set to compress and the
    -.I file
    -already has a suffix of the target file format
    -.RB ( .xz
    -or
    -.B .txz
    -when compressing to the
    -.B .xz
    -format, and
    -.B .lzma
    -or
    -.B .tlz
    -when compressing to the
    -.B .lzma
    -format).
    -.IP \(bu 3
    -The operation mode is set to decompress and the
    -.I file
    -doesn't have a suffix of any of the supported file formats
    -.RB ( .xz ,
    -.BR .txz ,
    -.BR .lzma ,
    -or
    -.BR .tlz ).
    -.PP
    -After successfully compressing or decompressing the
    -.IR file ,
    -.B xz
    -copies the owner, group, permissions, access time,
    -and modification time from the source
    -.I file
    -to the target file.
    -If copying the group fails, the permissions are modified
    -so that the target file doesn't become accessible to users
    -who didn't have permission to access the source
    -.IR file .
    -.B xz
    -doesn't support copying other metadata like access control lists
    -or extended attributes yet.
    -.PP
    -Once the target file has been successfully closed, the source
    -.I file
    -is removed unless
    -.B \-\-keep
    -was specified.
    -The source
    -.I file
    -is never removed if the output is written to standard output.
    -.PP
    -Sending
    -.B SIGINFO
    -or
    -.B SIGUSR1
    -to the
    -.B xz
    -process makes it print progress information to standard error.
    -This has only limited use since when standard error
    -is a terminal, using
    -.B \-\-verbose
    -will display an automatically updating progress indicator.
    -.
    -.SS "Memory usage"
    -The memory usage of
    -.B xz
    -varies from a few hundred kilobytes to several gigabytes
    -depending on the compression settings.
    -The settings used when compressing a file determine
    -the memory requirements of the decompressor.
    -Typically the decompressor needs 5\ % to 20\ % of
    -the amount of memory that the compressor needed when
    -creating the file.
    -For example, decompressing a file created with
    -.B xz \-9
    -currently requires 65\ MiB of memory.
    -Still, it is possible to have
    -.B .xz
    -files that require several gigabytes of memory to decompress.
    -.PP
    -Especially users of older systems may find
    -the possibility of very large memory usage annoying.
    -To prevent uncomfortable surprises,
    -.B xz
    -has a built-in memory usage limiter, which is disabled by default.
    -While some operating systems provide ways to limit
    -the memory usage of processes, relying on it
    -wasn't deemed to be flexible enough (e.g. using
    -.BR ulimit (1)
    -to limit virtual memory tends to cripple
    -.BR mmap (2)).
    -.PP
    -The memory usage limiter can be enabled with
    -the command line option \fB\-\-memlimit=\fIlimit\fR.
    -Often it is more convenient to enable the limiter
    -by default by setting the environment variable
    -.BR XZ_DEFAULTS ,
    -e.g.\&
    -.BR XZ_DEFAULTS=\-\-memlimit=150MiB .
    -It is possible to set the limits separately
    -for compression and decompression
    -by using \fB\-\-memlimit\-compress=\fIlimit\fR and
    -\fB\-\-memlimit\-decompress=\fIlimit\fR.
    -Using these two options outside
    -.B XZ_DEFAULTS
    -is rarely useful because a single run of
    -.B xz
    -cannot do both compression and decompression and
    -.BI \-\-memlimit= limit
    -(or \fB\-M\fR \fIlimit\fR)
    -is shorter to type on the command line.
    -.PP
    -If the specified memory usage limit is exceeded when decompressing,
    -.B xz
    -will display an error and decompressing the file will fail.
    -If the limit is exceeded when compressing,
    -.B xz
    -will try to scale the settings down so that the limit
    -is no longer exceeded (except when using \fB\-\-format=raw\fR
    -or \fB\-\-no\-adjust\fR).
    -This way the operation won't fail unless the limit is very small.
    -The scaling of the settings is done in steps that don't
    -match the compression level presets, e.g. if the limit is
    -only slightly less than the amount required for
    -.BR "xz \-9" ,
    -the settings will be scaled down only a little,
    -not all the way down to
    -.BR "xz \-8" .
    -.
    -.SS "Concatenation and padding with .xz files"
    -It is possible to concatenate
    -.B .xz
    -files as is.
    -.B xz
    -will decompress such files as if they were a single
    -.B .xz
    -file.
    -.PP
    -It is possible to insert padding between the concatenated parts
    -or after the last part.
    -The padding must consist of null bytes and the size
    -of the padding must be a multiple of four bytes.
    -This can be useful e.g. if the
    -.B .xz
    -file is stored on a medium that measures file sizes
    -in 512-byte blocks.
    -.PP
    -Concatenation and padding are not allowed with
    -.B .lzma
    -files or raw streams.
    -.
    -.SH OPTIONS
    -.
    -.SS "Integer suffixes and special values"
    -In most places where an integer argument is expected,
    -an optional suffix is supported to easily indicate large integers.
    -There must be no space between the integer and the suffix.
    -.TP
    -.B KiB
    -Multiply the integer by 1,024 (2^10).
    -.BR Ki ,
    -.BR k ,
    -.BR kB ,
    -.BR K ,
    -and
    -.B KB
    -are accepted as synonyms for
    -.BR KiB .
    -.TP
    -.B MiB
    -Multiply the integer by 1,048,576 (2^20).
    -.BR Mi ,
    -.BR m ,
    -.BR M ,
    -and
    -.B MB
    -are accepted as synonyms for
    -.BR MiB .
    -.TP
    -.B GiB
    -Multiply the integer by 1,073,741,824 (2^30).
    -.BR Gi ,
    -.BR g ,
    -.BR G ,
    -and
    -.B GB
    -are accepted as synonyms for
    -.BR GiB .
    -.PP
    -The special value
    -.B max
    -can be used to indicate the maximum integer value
    -supported by the option.
    -.
    -.SS "Operation mode"
    -If multiple operation mode options are given,
    -the last one takes effect.
    -.TP
    -.BR \-z ", " \-\-compress
    -Compress.
    -This is the default operation mode when no operation mode option
    -is specified and no other operation mode is implied from
    -the command name (for example,
    -.B unxz
    -implies
    -.BR \-\-decompress ).
    -.TP
    -.BR \-d ", " \-\-decompress ", " \-\-uncompress
    -Decompress.
    -.TP
    -.BR \-t ", " \-\-test
    -Test the integrity of compressed
    -.IR files .
    -This option is equivalent to
    -.B "\-\-decompress \-\-stdout"
    -except that the decompressed data is discarded instead of being
    -written to standard output.
    -No files are created or removed.
    -.TP
    -.BR \-l ", " \-\-list
    -Print information about compressed
    -.IR files .
    -No uncompressed output is produced,
    -and no files are created or removed.
    -In list mode, the program cannot read
    -the compressed data from standard
    -input or from other unseekable sources.
    -.IP ""
    -The default listing shows basic information about
    -.IR files ,
    -one file per line.
    -To get more detailed information, use also the
    -.B \-\-verbose
    -option.
    -For even more information, use
    -.B \-\-verbose
    -twice, but note that this may be slow, because getting all the extra
    -information requires many seeks.
    -The width of verbose output exceeds
    -80 characters, so piping the output to e.g.\&
    -.B "less\ \-S"
    -may be convenient if the terminal isn't wide enough.
    -.IP ""
    -The exact output may vary between
    -.B xz
    -versions and different locales.
    -For machine-readable output,
    -.B \-\-robot \-\-list
    -should be used.
    -.
    -.SS "Operation modifiers"
    -.TP
    -.BR \-k ", " \-\-keep
    -Don't delete the input files.
    -.TP
    -.BR \-f ", " \-\-force
    -This option has several effects:
    -.RS
    -.IP \(bu 3
    -If the target file already exists,
    -delete it before compressing or decompressing.
    -.IP \(bu 3
    -Compress or decompress even if the input is
    -a symbolic link to a regular file,
    -has more than one hard link,
    -or has the setuid, setgid, or sticky bit set.
    -The setuid, setgid, and sticky bits are not copied
    -to the target file.
    -.IP \(bu 3
    -When used with
    -.B \-\-decompress
    -.BR \-\-stdout
    -and
    -.B xz
    -cannot recognize the type of the source file,
    -copy the source file as is to standard output.
    -This allows
    -.B xzcat
    -.B \-\-force
    -to be used like
    -.BR cat (1)
    -for files that have not been compressed with
    -.BR xz .
    -Note that in future,
    -.B xz
    -might support new compressed file formats, which may make
    -.B xz
    -decompress more types of files instead of copying them as is to
    -standard output.
    -.BI \-\-format= format
    -can be used to restrict
    -.B xz
    -to decompress only a single file format.
    -.RE
    -.TP
    -.BR \-c ", " \-\-stdout ", " \-\-to\-stdout
    -Write the compressed or decompressed data to
    -standard output instead of a file.
    -This implies
    -.BR \-\-keep .
    -.TP
    -.B \-\-single\-stream
    -Decompress only the first
    -.B .xz
    -stream, and
    -silently ignore possible remaining input data following the stream.
    -Normally such trailing garbage makes
    -.B xz
    -display an error.
    -.IP ""
    -.B xz
    -never decompresses more than one stream from
    -.B .lzma
    -files or raw streams, but this option still makes
    -.B xz
    -ignore the possible trailing data after the
    -.B .lzma
    -file or raw stream.
    -.IP ""
    -This option has no effect if the operation mode is not
    -.B \-\-decompress
    -or
    -.BR \-\-test .
    -.TP
    -.B \-\-no\-sparse
    -Disable creation of sparse files.
    -By default, if decompressing into a regular file,
    -.B xz
    -tries to make the file sparse if the decompressed data contains
    -long sequences of binary zeros.
    -It also works when writing to standard output
    -as long as standard output is connected to a regular file
    -and certain additional conditions are met to make it safe.
    -Creating sparse files may save disk space and speed up
    -the decompression by reducing the amount of disk I/O.
    -.TP
    -\fB\-S\fR \fI.suf\fR, \fB\-\-suffix=\fI.suf
    -When compressing, use
    -.I .suf
    -as the suffix for the target file instead of
    -.B .xz
    -or
    -.BR .lzma .
    -If not writing to standard output and
    -the source file already has the suffix
    -.IR .suf ,
    -a warning is displayed and the file is skipped.
    -.IP ""
    -When decompressing, recognize files with the suffix
    -.I .suf
    -in addition to files with the
    -.BR .xz ,
    -.BR .txz ,
    -.BR .lzma ,
    -or
    -.B .tlz
    -suffix.
    -If the source file has the suffix
    -.IR .suf ,
    -the suffix is removed to get the target filename.
    -.IP ""
    -When compressing or decompressing raw streams
    -.RB ( \-\-format=raw ),
    -the suffix must always be specified unless
    -writing to standard output,
    -because there is no default suffix for raw streams.
    -.TP
    -\fB\-\-files\fR[\fB=\fIfile\fR]
    -Read the filenames to process from
    -.IR file ;
    -if
    -.I file
    -is omitted, filenames are read from standard input.
    -Filenames must be terminated with the newline character.
    -A dash
    -.RB ( \- )
    -is taken as a regular filename; it doesn't mean standard input.
    -If filenames are given also as command line arguments, they are
    -processed before the filenames read from
    -.IR file .
    -.TP
    -\fB\-\-files0\fR[\fB=\fIfile\fR]
    -This is identical to \fB\-\-files\fR[\fB=\fIfile\fR] except
    -that each filename must be terminated with the null character.
    -.
    -.SS "Basic file format and compression options"
    -.TP
    -\fB\-F\fR \fIformat\fR, \fB\-\-format=\fIformat
    -Specify the file
    -.I format
    -to compress or decompress:
    -.RS
    -.TP
    -.B auto
    -This is the default.
    -When compressing,
    -.B auto
    -is equivalent to
    -.BR xz .
    -When decompressing,
    -the format of the input file is automatically detected.
    -Note that raw streams (created with
    -.BR \-\-format=raw )
    -cannot be auto-detected.
    -.TP
    -.B xz
    -Compress to the
    -.B .xz
    -file format, or accept only
    -.B .xz
    -files when decompressing.
    -.TP
    -.BR lzma ", " alone
    -Compress to the legacy
    -.B .lzma
    -file format, or accept only
    -.B .lzma
    -files when decompressing.
    -The alternative name
    -.B alone
    -is provided for backwards compatibility with LZMA Utils.
    -.TP
    -.B raw
    -Compress or uncompress a raw stream (no headers).
    -This is meant for advanced users only.
    -To decode raw streams, you need use
    -.B \-\-format=raw
    -and explicitly specify the filter chain,
    -which normally would have been stored in the container headers.
    -.RE
    -.TP
    -\fB\-C\fR \fIcheck\fR, \fB\-\-check=\fIcheck
    -Specify the type of the integrity check.
    -The check is calculated from the uncompressed data and
    -stored in the
    -.B .xz
    -file.
    -This option has an effect only when compressing into the
    -.B .xz
    -format; the
    -.B .lzma
    -format doesn't support integrity checks.
    -The integrity check (if any) is verified when the
    -.B .xz
    -file is decompressed.
    -.IP ""
    -Supported
    -.I check
    -types:
    -.RS
    -.TP
    -.B none
    -Don't calculate an integrity check at all.
    -This is usually a bad idea.
    -This can be useful when integrity of the data is verified
    -by other means anyway.
    -.TP
    -.B crc32
    -Calculate CRC32 using the polynomial from IEEE-802.3 (Ethernet).
    -.TP
    -.B crc64
    -Calculate CRC64 using the polynomial from ECMA-182.
    -This is the default, since it is slightly better than CRC32
    -at detecting damaged files and the speed difference is negligible.
    -.TP
    -.B sha256
    -Calculate SHA-256.
    -This is somewhat slower than CRC32 and CRC64.
    -.RE
    -.IP ""
    -Integrity of the
    -.B .xz
    -headers is always verified with CRC32.
    -It is not possible to change or disable it.
    -.TP
    -.B \-\-ignore\-check
    -Don't verify the integrity check of the compressed data when decompressing.
    -The CRC32 values in the
    -.B .xz
    -headers will still be verified normally.
    -.IP ""
    -.B "Do not use this option unless you know what you are doing."
    -Possible reasons to use this option:
    -.RS
    -.IP \(bu 3
    -Trying to recover data from a corrupt .xz file.
    -.IP \(bu 3
    -Speeding up decompression.
    -This matters mostly with SHA-256 or
    -with files that have compressed extremely well.
    -It's recommended to not use this option for this purpose
    -unless the file integrity is verified externally in some other way.
    -.RE
    -.TP
    -.BR \-0 " ... " \-9
    -Select a compression preset level.
    -The default is
    -.BR \-6 .
    -If multiple preset levels are specified,
    -the last one takes effect.
    -If a custom filter chain was already specified, setting
    -a compression preset level clears the custom filter chain.
    -.IP ""
    -The differences between the presets are more significant than with
    -.BR gzip (1)
    -and
    -.BR bzip2 (1).
    -The selected compression settings determine
    -the memory requirements of the decompressor,
    -thus using a too high preset level might make it painful
    -to decompress the file on an old system with little RAM.
    -Specifically,
    -.B "it's not a good idea to blindly use \-9 for everything"
    -like it often is with
    -.BR gzip (1)
    -and
    -.BR bzip2 (1).
    -.RS
    -.TP
    -.BR "\-0" " ... " "\-3"
    -These are somewhat fast presets.
    -.B \-0
    -is sometimes faster than
    -.B "gzip \-9"
    -while compressing much better.
    -The higher ones often have speed comparable to
    -.BR bzip2 (1)
    -with comparable or better compression ratio,
    -although the results
    -depend a lot on the type of data being compressed.
    -.TP
    -.BR "\-4" " ... " "\-6"
    -Good to very good compression while keeping
    -decompressor memory usage reasonable even for old systems.
    -.B \-6
    -is the default, which is usually a good choice
    -e.g. for distributing files that need to be decompressible
    -even on systems with only 16\ MiB RAM.
    -.RB ( \-5e
    -or
    -.B \-6e
    -may be worth considering too.
    -See
    -.BR \-\-extreme .)
    -.TP
    -.B "\-7 ... \-9"
    -These are like
    -.B \-6
    -but with higher compressor and decompressor memory requirements.
    -These are useful only when compressing files bigger than
    -8\ MiB, 16\ MiB, and 32\ MiB, respectively.
    -.RE
    -.IP ""
    -On the same hardware, the decompression speed is approximately
    -a constant number of bytes of compressed data per second.
    -In other words, the better the compression,
    -the faster the decompression will usually be.
    -This also means that the amount of uncompressed output
    -produced per second can vary a lot.
    -.IP ""
    -The following table summarises the features of the presets:
    -.RS
    -.RS
    -.PP
    -.TS
    -tab(;);
    -c c c c c
    -n n n n n.
    -Preset;DictSize;CompCPU;CompMem;DecMem
    -\-0;256 KiB;0;3 MiB;1 MiB
    -\-1;1 MiB;1;9 MiB;2 MiB
    -\-2;2 MiB;2;17 MiB;3 MiB
    -\-3;4 MiB;3;32 MiB;5 MiB
    -\-4;4 MiB;4;48 MiB;5 MiB
    -\-5;8 MiB;5;94 MiB;9 MiB
    -\-6;8 MiB;6;94 MiB;9 MiB
    -\-7;16 MiB;6;186 MiB;17 MiB
    -\-8;32 MiB;6;370 MiB;33 MiB
    -\-9;64 MiB;6;674 MiB;65 MiB
    -.TE
    -.RE
    -.RE
    -.IP ""
    -Column descriptions:
    -.RS
    -.IP \(bu 3
    -DictSize is the LZMA2 dictionary size.
    -It is waste of memory to use a dictionary bigger than
    -the size of the uncompressed file.
    -This is why it is good to avoid using the presets
    -.BR \-7 " ... " \-9
    -when there's no real need for them.
    -At
    -.B \-6
    -and lower, the amount of memory wasted is
    -usually low enough to not matter.
    -.IP \(bu 3
    -CompCPU is a simplified representation of the LZMA2 settings
    -that affect compression speed.
    -The dictionary size affects speed too,
    -so while CompCPU is the same for levels
    -.BR \-6 " ... " \-9 ,
    -higher levels still tend to be a little slower.
    -To get even slower and thus possibly better compression, see
    -.BR \-\-extreme .
    -.IP \(bu 3
    -CompMem contains the compressor memory requirements
    -in the single-threaded mode.
    -It may vary slightly between
    -.B xz
    -versions.
    -Memory requirements of some of the future multithreaded modes may
    -be dramatically higher than that of the single-threaded mode.
    -.IP \(bu 3
    -DecMem contains the decompressor memory requirements.
    -That is, the compression settings determine
    -the memory requirements of the decompressor.
    -The exact decompressor memory usage is slightly more than
    -the LZMA2 dictionary size, but the values in the table
    -have been rounded up to the next full MiB.
    -.RE
    -.TP
    -.BR \-e ", " \-\-extreme
    -Use a slower variant of the selected compression preset level
    -.RB ( \-0 " ... " \-9 )
    -to hopefully get a little bit better compression ratio,
    -but with bad luck this can also make it worse.
    -Decompressor memory usage is not affected,
    -but compressor memory usage increases a little at preset levels
    -.BR \-0 " ... " \-3 .
    -.IP ""
    -Since there are two presets with dictionary sizes
    -4\ MiB and 8\ MiB, the presets
    -.B \-3e
    -and
    -.B \-5e
    -use slightly faster settings (lower CompCPU) than
    -.B \-4e
    -and
    -.BR \-6e ,
    -respectively.
    -That way no two presets are identical.
    -.RS
    -.RS
    -.PP
    -.TS
    -tab(;);
    -c c c c c
    -n n n n n.
    -Preset;DictSize;CompCPU;CompMem;DecMem
    -\-0e;256 KiB;8;4 MiB;1 MiB
    -\-1e;1 MiB;8;13 MiB;2 MiB
    -\-2e;2 MiB;8;25 MiB;3 MiB
    -\-3e;4 MiB;7;48 MiB;5 MiB
    -\-4e;4 MiB;8;48 MiB;5 MiB
    -\-5e;8 MiB;7;94 MiB;9 MiB
    -\-6e;8 MiB;8;94 MiB;9 MiB
    -\-7e;16 MiB;8;186 MiB;17 MiB
    -\-8e;32 MiB;8;370 MiB;33 MiB
    -\-9e;64 MiB;8;674 MiB;65 MiB
    -.TE
    -.RE
    -.RE
    -.IP ""
    -For example, there are a total of four presets that use
    -8\ MiB dictionary, whose order from the fastest to the slowest is
    -.BR \-5 ,
    -.BR \-6 ,
    -.BR \-5e ,
    -and
    -.BR \-6e .
    -.TP
    -.B \-\-fast
    -.PD 0
    -.TP
    -.B \-\-best
    -.PD
    -These are somewhat misleading aliases for
    -.B \-0
    -and
    -.BR \-9 ,
    -respectively.
    -These are provided only for backwards compatibility
    -with LZMA Utils.
    -Avoid using these options.
    -.TP
    -.BI \-\-block\-size= size
    -When compressing to the
    -.B .xz
    -format, split the input data into blocks of
    -.I size
    -bytes.
    -The blocks are compressed independently from each other,
    -which helps with multi-threading and
    -makes limited random-access decompression possible.
    -This option is typically used to override the default
    -block size in multi-threaded mode,
    -but this option can be used in single-threaded mode too.
    -.IP ""
    -In multi-threaded mode about three times
    -.I size
    -bytes will be allocated in each thread for buffering input and output.
    -The default
    -.I size
    -is three times the LZMA2 dictionary size or 1 MiB,
    -whichever is more.
    -Typically a good value is 2\-4 times
    -the size of the LZMA2 dictionary or at least 1 MiB.
    -Using
    -.I size
    -less than the LZMA2 dictionary size is waste of RAM
    -because then the LZMA2 dictionary buffer will never get fully used.
    -The sizes of the blocks are stored in the block headers,
    -which a future version of
    -.B xz
    -will use for multi-threaded decompression.
    -.IP ""
    -In single-threaded mode no block splitting is done by default.
    -Setting this option doesn't affect memory usage.
    -No size information is stored in block headers,
    -thus files created in single-threaded mode
    -won't be identical to files created in multi-threaded mode.
    -The lack of size information also means that a future version of
    -.B xz
    -won't be able decompress the files in multi-threaded mode.
    -.TP
    -.BI \-\-block\-list= sizes
    -When compressing to the
    -.B .xz
    -format, start a new block after
    -the given intervals of uncompressed data.
    -.IP ""
    -The uncompressed
    -.I sizes
    -of the blocks are specified as a comma-separated list.
    -Omitting a size (two or more consecutive commas) is a shorthand
    -to use the size of the previous block.
    -.IP ""
    -If the input file is bigger than the sum of
    -.IR sizes ,
    -the last value in
    -.I sizes
    -is repeated until the end of the file.
    -A special value of
    -.B 0
    -may be used as the last value to indicate that
    -the rest of the file should be encoded as a single block.
    -.IP ""
    -If one specifies
    -.I sizes
    -that exceed the encoder's block size
    -(either the default value in threaded mode or
    -the value specified with \fB\-\-block\-size=\fIsize\fR),
    -the encoder will create additional blocks while
    -keeping the boundaries specified in
    -.IR sizes .
    -For example, if one specifies
    -.B \-\-block\-size=10MiB
    -.B \-\-block\-list=5MiB,10MiB,8MiB,12MiB,24MiB
    -and the input file is 80 MiB,
    -one will get 11 blocks:
    -5, 10, 8, 10, 2, 10, 10, 4, 10, 10, and 1 MiB.
    -.IP ""
    -In multi-threaded mode the sizes of the blocks
    -are stored in the block headers.
    -This isn't done in single-threaded mode,
    -so the encoded output won't be
    -identical to that of the multi-threaded mode.
    -.TP
    -.BI \-\-flush\-timeout= timeout
    -When compressing, if more than
    -.I timeout
    -milliseconds (a positive integer) has passed since the previous flush and
    -reading more input would block,
    -all the pending input data is flushed from the encoder and
    -made available in the output stream.
    -This can be useful if
    -.B xz
    -is used to compress data that is streamed over a network.
    -Small
    -.I timeout
    -values make the data available at the receiving end
    -with a small delay, but large
    -.I timeout
    -values give better compression ratio.
    -.IP ""
    -This feature is disabled by default.
    -If this option is specified more than once, the last one takes effect.
    -The special
    -.I timeout
    -value of
    -.B 0
    -can be used to explicitly disable this feature.
    -.IP ""
    -This feature is not available on non-POSIX systems.
    -.IP ""
    -.\" FIXME
    -.B "This feature is still experimental."
    -Currently
    -.B xz
    -is unsuitable for decompressing the stream in real time due to how
    -.B xz
    -does buffering.
    -.TP
    -.BI \-\-memlimit\-compress= limit
    -Set a memory usage limit for compression.
    -If this option is specified multiple times,
    -the last one takes effect.
    -.IP ""
    -If the compression settings exceed the
    -.IR limit ,
    -.B xz
    -will adjust the settings downwards so that
    -the limit is no longer exceeded and display a notice that
    -automatic adjustment was done.
    -Such adjustments are not made when compressing with
    -.B \-\-format=raw
    -or if
    -.B \-\-no\-adjust
    -has been specified.
    -In those cases, an error is displayed and
    -.B xz
    -will exit with exit status 1.
    -.IP ""
    -The
    -.I limit
    -can be specified in multiple ways:
    -.RS
    -.IP \(bu 3
    -The
    -.I limit
    -can be an absolute value in bytes.
    -Using an integer suffix like
    -.B MiB
    -can be useful.
    -Example:
    -.B "\-\-memlimit\-compress=80MiB"
    -.IP \(bu 3
    -The
    -.I limit
    -can be specified as a percentage of total physical memory (RAM).
    -This can be useful especially when setting the
    -.B XZ_DEFAULTS
    -environment variable in a shell initialization script
    -that is shared between different computers.
    -That way the limit is automatically bigger
    -on systems with more memory.
    -Example:
    -.B "\-\-memlimit\-compress=70%"
    -.IP \(bu 3
    -The
    -.I limit
    -can be reset back to its default value by setting it to
    -.BR 0 .
    -This is currently equivalent to setting the
    -.I limit
    -to
    -.B max
    -(no memory usage limit).
    -Once multithreading support has been implemented,
    -there may be a difference between
    -.B 0
    -and
    -.B max
    -for the multithreaded case, so it is recommended to use
    -.B 0
    -instead of
    -.B max
    -until the details have been decided.
    -.RE
    -.IP ""
    -See also the section
    -.BR "Memory usage" .
    -.TP
    -.BI \-\-memlimit\-decompress= limit
    -Set a memory usage limit for decompression.
    -This also affects the
    -.B \-\-list
    -mode.
    -If the operation is not possible without exceeding the
    -.IR limit ,
    -.B xz
    -will display an error and decompressing the file will fail.
    -See
    -.BI \-\-memlimit\-compress= limit
    -for possible ways to specify the
    -.IR limit .
    -.TP
    -\fB\-M\fR \fIlimit\fR, \fB\-\-memlimit=\fIlimit\fR, \fB\-\-memory=\fIlimit
    -This is equivalent to specifying \fB\-\-memlimit\-compress=\fIlimit
    -\fB\-\-memlimit\-decompress=\fIlimit\fR.
    -.TP
    -.B \-\-no\-adjust
    -Display an error and exit if the compression settings exceed
    -the memory usage limit.
    -The default is to adjust the settings downwards so
    -that the memory usage limit is not exceeded.
    -Automatic adjusting is always disabled when creating raw streams
    -.RB ( \-\-format=raw ).
    -.TP
    -\fB\-T\fR \fIthreads\fR, \fB\-\-threads=\fIthreads
    -Specify the number of worker threads to use.
    -Setting
    -.I threads
    -to a special value
    -.B 0
    -makes
    -.B xz
    -use as many threads as there are CPU cores on the system.
    -The actual number of threads can be less than
    -.I threads
    -if the input file is not big enough
    -for threading with the given settings or
    -if using more threads would exceed the memory usage limit.
    -.IP ""
    -Currently the only threading method is to split the input into
    -blocks and compress them independently from each other.
    -The default block size depends on the compression level and
    -can be overriden with the
    -.BI \-\-block\-size= size
    -option.
    -.
    -.SS "Custom compressor filter chains"
    -A custom filter chain allows specifying
    -the compression settings in detail instead of relying on
    -the settings associated to the presets.
    -When a custom filter chain is specified,
    -preset options (\fB\-0\fR ... \fB\-9\fR and \fB\-\-extreme\fR)
    -earlier on the command line are forgotten.
    -If a preset option is specified
    -after one or more custom filter chain options,
    -the new preset takes effect and
    -the custom filter chain options specified earlier are forgotten.
    -.PP
    -A filter chain is comparable to piping on the command line.
    -When compressing, the uncompressed input goes to the first filter,
    -whose output goes to the next filter (if any).
    -The output of the last filter gets written to the compressed file.
    -The maximum number of filters in the chain is four,
    -but typically a filter chain has only one or two filters.
    -.PP
    -Many filters have limitations on where they can be
    -in the filter chain:
    -some filters can work only as the last filter in the chain,
    -some only as a non-last filter, and some work in any position
    -in the chain.
    -Depending on the filter, this limitation is either inherent to
    -the filter design or exists to prevent security issues.
    -.PP
    -A custom filter chain is specified by using one or more
    -filter options in the order they are wanted in the filter chain.
    -That is, the order of filter options is significant!
    -When decoding raw streams
    -.RB ( \-\-format=raw ),
    -the filter chain is specified in the same order as
    -it was specified when compressing.
    -.PP
    -Filters take filter-specific
    -.I options
    -as a comma-separated list.
    -Extra commas in
    -.I options
    -are ignored.
    -Every option has a default value, so you need to
    -specify only those you want to change.
    -.PP
    -To see the whole filter chain and
    -.IR options ,
    -use
    -.B "xz \-vv"
    -(that is, use
    -.B \-\-verbose
    -twice).
    -This works also for viewing the filter chain options used by presets.
    -.TP
    -\fB\-\-lzma1\fR[\fB=\fIoptions\fR]
    -.PD 0
    -.TP
    -\fB\-\-lzma2\fR[\fB=\fIoptions\fR]
    -.PD
    -Add LZMA1 or LZMA2 filter to the filter chain.
    -These filters can be used only as the last filter in the chain.
    -.IP ""
    -LZMA1 is a legacy filter,
    -which is supported almost solely due to the legacy
    -.B .lzma
    -file format, which supports only LZMA1.
    -LZMA2 is an updated
    -version of LZMA1 to fix some practical issues of LZMA1.
    -The
    -.B .xz
    -format uses LZMA2 and doesn't support LZMA1 at all.
    -Compression speed and ratios of LZMA1 and LZMA2
    -are practically the same.
    -.IP ""
    -LZMA1 and LZMA2 share the same set of
    -.IR options :
    -.RS
    -.TP
    -.BI preset= preset
    -Reset all LZMA1 or LZMA2
    -.I options
    -to
    -.IR preset .
    -.I Preset
    -consist of an integer, which may be followed by single-letter
    -preset modifiers.
    -The integer can be from
    -.B 0
    -to
    -.BR 9 ,
    -matching the command line options \fB\-0\fR ... \fB\-9\fR.
    -The only supported modifier is currently
    -.BR e ,
    -which matches
    -.BR \-\-extreme .
    -If no
    -.B preset
    -is specified, the default values of LZMA1 or LZMA2
    -.I options
    -are taken from the preset
    -.BR 6 .
    -.TP
    -.BI dict= size
    -Dictionary (history buffer)
    -.I size
    -indicates how many bytes of the recently processed
    -uncompressed data is kept in memory.
    -The algorithm tries to find repeating byte sequences (matches) in
    -the uncompressed data, and replace them with references
    -to the data currently in the dictionary.
    -The bigger the dictionary, the higher is the chance
    -to find a match.
    -Thus, increasing dictionary
    -.I size
    -usually improves compression ratio, but
    -a dictionary bigger than the uncompressed file is waste of memory.
    -.IP ""
    -Typical dictionary
    -.I size
    -is from 64\ KiB to 64\ MiB.
    -The minimum is 4\ KiB.
    -The maximum for compression is currently 1.5\ GiB (1536\ MiB).
    -The decompressor already supports dictionaries up to
    -one byte less than 4\ GiB, which is the maximum for
    -the LZMA1 and LZMA2 stream formats.
    -.IP ""
    -Dictionary
    -.I size
    -and match finder
    -.RI ( mf )
    -together determine the memory usage of the LZMA1 or LZMA2 encoder.
    -The same (or bigger) dictionary
    -.I size
    -is required for decompressing that was used when compressing,
    -thus the memory usage of the decoder is determined
    -by the dictionary size used when compressing.
    -The
    -.B .xz
    -headers store the dictionary
    -.I size
    -either as
    -.RI "2^" n
    -or
    -.RI "2^" n " + 2^(" n "\-1),"
    -so these
    -.I sizes
    -are somewhat preferred for compression.
    -Other
    -.I sizes
    -will get rounded up when stored in the
    -.B .xz
    -headers.
    -.TP
    -.BI lc= lc
    -Specify the number of literal context bits.
    -The minimum is 0 and the maximum is 4; the default is 3.
    -In addition, the sum of
    -.I lc
    -and
    -.I lp
    -must not exceed 4.
    -.IP ""
    -All bytes that cannot be encoded as matches
    -are encoded as literals.
    -That is, literals are simply 8-bit bytes
    -that are encoded one at a time.
    -.IP ""
    -The literal coding makes an assumption that the highest
    -.I lc
    -bits of the previous uncompressed byte correlate
    -with the next byte.
    -E.g. in typical English text, an upper-case letter is
    -often followed by a lower-case letter, and a lower-case
    -letter is usually followed by another lower-case letter.
    -In the US-ASCII character set, the highest three bits are 010
    -for upper-case letters and 011 for lower-case letters.
    -When
    -.I lc
    -is at least 3, the literal coding can take advantage of
    -this property in the uncompressed data.
    -.IP ""
    -The default value (3) is usually good.
    -If you want maximum compression, test
    -.BR lc=4 .
    -Sometimes it helps a little, and
    -sometimes it makes compression worse.
    -If it makes it worse, test e.g.\&
    -.B lc=2
    -too.
    -.TP
    -.BI lp= lp
    -Specify the number of literal position bits.
    -The minimum is 0 and the maximum is 4; the default is 0.
    -.IP ""
    -.I Lp
    -affects what kind of alignment in the uncompressed data is
    -assumed when encoding literals.
    -See
    -.I pb
    -below for more information about alignment.
    -.TP
    -.BI pb= pb
    -Specify the number of position bits.
    -The minimum is 0 and the maximum is 4; the default is 2.
    -.IP ""
    -.I Pb
    -affects what kind of alignment in the uncompressed data is
    -assumed in general.
    -The default means four-byte alignment
    -.RI (2^ pb =2^2=4),
    -which is often a good choice when there's no better guess.
    -.IP ""
    -When the aligment is known, setting
    -.I pb
    -accordingly may reduce the file size a little.
    -E.g. with text files having one-byte
    -alignment (US-ASCII, ISO-8859-*, UTF-8), setting
    -.B pb=0
    -can improve compression slightly.
    -For UTF-16 text,
    -.B pb=1
    -is a good choice.
    -If the alignment is an odd number like 3 bytes,
    -.B pb=0
    -might be the best choice.
    -.IP ""
    -Even though the assumed alignment can be adjusted with
    -.I pb
    -and
    -.IR lp ,
    -LZMA1 and LZMA2 still slightly favor 16-byte alignment.
    -It might be worth taking into account when designing file formats
    -that are likely to be often compressed with LZMA1 or LZMA2.
    -.TP
    -.BI mf= mf
    -Match finder has a major effect on encoder speed,
    -memory usage, and compression ratio.
    -Usually Hash Chain match finders are faster than Binary Tree
    -match finders.
    -The default depends on the
    -.IR preset :
    -0 uses
    -.BR hc3 ,
    -1\-3
    -use
    -.BR hc4 ,
    -and the rest use
    -.BR bt4 .
    -.IP ""
    -The following match finders are supported.
    -The memory usage formulas below are rough approximations,
    -which are closest to the reality when
    -.I dict
    -is a power of two.
    -.RS
    -.TP
    -.B hc3
    -Hash Chain with 2- and 3-byte hashing
    -.br
    -Minimum value for
    -.IR nice :
    -3
    -.br
    -Memory usage:
    -.br
    -.I dict
    -* 7.5 (if
    -.I dict
    -<= 16 MiB);
    -.br
    -.I dict
    -* 5.5 + 64 MiB (if
    -.I dict
    -> 16 MiB)
    -.TP
    -.B hc4
    -Hash Chain with 2-, 3-, and 4-byte hashing
    -.br
    -Minimum value for
    -.IR nice :
    -4
    -.br
    -Memory usage:
    -.br
    -.I dict
    -* 7.5 (if
    -.I dict
    -<= 32 MiB);
    -.br
    -.I dict
    -* 6.5 (if
    -.I dict
    -> 32 MiB)
    -.TP
    -.B bt2
    -Binary Tree with 2-byte hashing
    -.br
    -Minimum value for
    -.IR nice :
    -2
    -.br
    -Memory usage:
    -.I dict
    -* 9.5
    -.TP
    -.B bt3
    -Binary Tree with 2- and 3-byte hashing
    -.br
    -Minimum value for
    -.IR nice :
    -3
    -.br
    -Memory usage:
    -.br
    -.I dict
    -* 11.5 (if
    -.I dict
    -<= 16 MiB);
    -.br
    -.I dict
    -* 9.5 + 64 MiB (if
    -.I dict
    -> 16 MiB)
    -.TP
    -.B bt4
    -Binary Tree with 2-, 3-, and 4-byte hashing
    -.br
    -Minimum value for
    -.IR nice :
    -4
    -.br
    -Memory usage:
    -.br
    -.I dict
    -* 11.5 (if
    -.I dict
    -<= 32 MiB);
    -.br
    -.I dict
    -* 10.5 (if
    -.I dict
    -> 32 MiB)
    -.RE
    -.TP
    -.BI mode= mode
    -Compression
    -.I mode
    -specifies the method to analyze
    -the data produced by the match finder.
    -Supported
    -.I modes
    -are
    -.B fast
    -and
    -.BR normal .
    -The default is
    -.B fast
    -for
    -.I presets
    -0\-3 and
    -.B normal
    -for
    -.I presets
    -4\-9.
    -.IP ""
    -Usually
    -.B fast
    -is used with Hash Chain match finders and
    -.B normal
    -with Binary Tree match finders.
    -This is also what the
    -.I presets
    -do.
    -.TP
    -.BI nice= nice
    -Specify what is considered to be a nice length for a match.
    -Once a match of at least
    -.I nice
    -bytes is found, the algorithm stops
    -looking for possibly better matches.
    -.IP ""
    -.I Nice
    -can be 2\-273 bytes.
    -Higher values tend to give better compression ratio
    -at the expense of speed.
    -The default depends on the
    -.IR preset .
    -.TP
    -.BI depth= depth
    -Specify the maximum search depth in the match finder.
    -The default is the special value of 0,
    -which makes the compressor determine a reasonable
    -.I depth
    -from
    -.I mf
    -and
    -.IR nice .
    -.IP ""
    -Reasonable
    -.I depth
    -for Hash Chains is 4\-100 and 16\-1000 for Binary Trees.
    -Using very high values for
    -.I depth
    -can make the encoder extremely slow with some files.
    -Avoid setting the
    -.I depth
    -over 1000 unless you are prepared to interrupt
    -the compression in case it is taking far too long.
    -.RE
    -.IP ""
    -When decoding raw streams
    -.RB ( \-\-format=raw ),
    -LZMA2 needs only the dictionary
    -.IR size .
    -LZMA1 needs also
    -.IR lc ,
    -.IR lp ,
    -and
    -.IR pb .
    -.TP
    -\fB\-\-x86\fR[\fB=\fIoptions\fR]
    -.PD 0
    -.TP
    -\fB\-\-powerpc\fR[\fB=\fIoptions\fR]
    -.TP
    -\fB\-\-ia64\fR[\fB=\fIoptions\fR]
    -.TP
    -\fB\-\-arm\fR[\fB=\fIoptions\fR]
    -.TP
    -\fB\-\-armthumb\fR[\fB=\fIoptions\fR]
    -.TP
    -\fB\-\-sparc\fR[\fB=\fIoptions\fR]
    -.PD
    -Add a branch/call/jump (BCJ) filter to the filter chain.
    -These filters can be used only as a non-last filter
    -in the filter chain.
    -.IP ""
    -A BCJ filter converts relative addresses in
    -the machine code to their absolute counterparts.
    -This doesn't change the size of the data,
    -but it increases redundancy,
    -which can help LZMA2 to produce 0\-15\ % smaller
    -.B .xz
    -file.
    -The BCJ filters are always reversible,
    -so using a BCJ filter for wrong type of data
    -doesn't cause any data loss, although it may make
    -the compression ratio slightly worse.
    -.IP ""
    -It is fine to apply a BCJ filter on a whole executable;
    -there's no need to apply it only on the executable section.
    -Applying a BCJ filter on an archive that contains both executable
    -and non-executable files may or may not give good results,
    -so it generally isn't good to blindly apply a BCJ filter when
    -compressing binary packages for distribution.
    -.IP ""
    -These BCJ filters are very fast and
    -use insignificant amount of memory.
    -If a BCJ filter improves compression ratio of a file,
    -it can improve decompression speed at the same time.
    -This is because, on the same hardware,
    -the decompression speed of LZMA2 is roughly
    -a fixed number of bytes of compressed data per second.
    -.IP ""
    -These BCJ filters have known problems related to
    -the compression ratio:
    -.RS
    -.IP \(bu 3
    -Some types of files containing executable code
    -(e.g. object files, static libraries, and Linux kernel modules)
    -have the addresses in the instructions filled with filler values.
    -These BCJ filters will still do the address conversion,
    -which will make the compression worse with these files.
    -.IP \(bu 3
    -Applying a BCJ filter on an archive containing multiple similar
    -executables can make the compression ratio worse than not using
    -a BCJ filter.
    -This is because the BCJ filter doesn't detect the boundaries
    -of the executable files, and doesn't reset
    -the address conversion counter for each executable.
    -.RE
    -.IP ""
    -Both of the above problems will be fixed
    -in the future in a new filter.
    -The old BCJ filters will still be useful in embedded systems,
    -because the decoder of the new filter will be bigger
    -and use more memory.
    -.IP ""
    -Different instruction sets have have different alignment:
    -.RS
    -.RS
    -.PP
    -.TS
    -tab(;);
    -l n l
    -l n l.
    -Filter;Alignment;Notes
    -x86;1;32-bit or 64-bit x86
    -PowerPC;4;Big endian only
    -ARM;4;Little endian only
    -ARM-Thumb;2;Little endian only
    -IA-64;16;Big or little endian
    -SPARC;4;Big or little endian
    -.TE
    -.RE
    -.RE
    -.IP ""
    -Since the BCJ-filtered data is usually compressed with LZMA2,
    -the compression ratio may be improved slightly if
    -the LZMA2 options are set to match the
    -alignment of the selected BCJ filter.
    -For example, with the IA-64 filter, it's good to set
    -.B pb=4
    -with LZMA2 (2^4=16).
    -The x86 filter is an exception;
    -it's usually good to stick to LZMA2's default
    -four-byte alignment when compressing x86 executables.
    -.IP ""
    -All BCJ filters support the same
    -.IR options :
    -.RS
    -.TP
    -.BI start= offset
    -Specify the start
    -.I offset
    -that is used when converting between relative
    -and absolute addresses.
    -The
    -.I offset
    -must be a multiple of the alignment of the filter
    -(see the table above).
    -The default is zero.
    -In practice, the default is good; specifying a custom
    -.I offset
    -is almost never useful.
    -.RE
    -.TP
    -\fB\-\-delta\fR[\fB=\fIoptions\fR]
    -Add the Delta filter to the filter chain.
    -The Delta filter can be only used as a non-last filter
    -in the filter chain.
    -.IP ""
    -Currently only simple byte-wise delta calculation is supported.
    -It can be useful when compressing e.g. uncompressed bitmap images
    -or uncompressed PCM audio.
    -However, special purpose algorithms may give significantly better
    -results than Delta + LZMA2.
    -This is true especially with audio,
    -which compresses faster and better e.g. with
    -.BR flac (1).
    -.IP ""
    -Supported
    -.IR options :
    -.RS
    -.TP
    -.BI dist= distance
    -Specify the
    -.I distance
    -of the delta calculation in bytes.
    -.I distance
    -must be 1\-256.
    -The default is 1.
    -.IP ""
    -For example, with
    -.B dist=2
    -and eight-byte input A1 B1 A2 B3 A3 B5 A4 B7, the output will be
    -A1 B1 01 02 01 02 01 02.
    -.RE
    -.
    -.SS "Other options"
    -.TP
    -.BR \-q ", " \-\-quiet
    -Suppress warnings and notices.
    -Specify this twice to suppress errors too.
    -This option has no effect on the exit status.
    -That is, even if a warning was suppressed,
    -the exit status to indicate a warning is still used.
    -.TP
    -.BR \-v ", " \-\-verbose
    -Be verbose.
    -If standard error is connected to a terminal,
    -.B xz
    -will display a progress indicator.
    -Specifying
    -.B \-\-verbose
    -twice will give even more verbose output.
    -.IP ""
    -The progress indicator shows the following information:
    -.RS
    -.IP \(bu 3
    -Completion percentage is shown
    -if the size of the input file is known.
    -That is, the percentage cannot be shown in pipes.
    -.IP \(bu 3
    -Amount of compressed data produced (compressing)
    -or consumed (decompressing).
    -.IP \(bu 3
    -Amount of uncompressed data consumed (compressing)
    -or produced (decompressing).
    -.IP \(bu 3
    -Compression ratio, which is calculated by dividing
    -the amount of compressed data processed so far by
    -the amount of uncompressed data processed so far.
    -.IP \(bu 3
    -Compression or decompression speed.
    -This is measured as the amount of uncompressed data consumed
    -(compression) or produced (decompression) per second.
    -It is shown after a few seconds have passed since
    -.B xz
    -started processing the file.
    -.IP \(bu 3
    -Elapsed time in the format M:SS or H:MM:SS.
    -.IP \(bu 3
    -Estimated remaining time is shown
    -only when the size of the input file is
    -known and a couple of seconds have already passed since
    -.B xz
    -started processing the file.
    -The time is shown in a less precise format which
    -never has any colons, e.g. 2 min 30 s.
    -.RE
    -.IP ""
    -When standard error is not a terminal,
    -.B \-\-verbose
    -will make
    -.B xz
    -print the filename, compressed size, uncompressed size,
    -compression ratio, and possibly also the speed and elapsed time
    -on a single line to standard error after compressing or
    -decompressing the file.
    -The speed and elapsed time are included only when
    -the operation took at least a few seconds.
    -If the operation didn't finish, e.g. due to user interruption,
    -also the completion percentage is printed
    -if the size of the input file is known.
    -.TP
    -.BR \-Q ", " \-\-no\-warn
    -Don't set the exit status to 2
    -even if a condition worth a warning was detected.
    -This option doesn't affect the verbosity level, thus both
    -.B \-\-quiet
    -and
    -.B \-\-no\-warn
    -have to be used to not display warnings and
    -to not alter the exit status.
    -.TP
    -.B \-\-robot
    -Print messages in a machine-parsable format.
    -This is intended to ease writing frontends that want to use
    -.B xz
    -instead of liblzma, which may be the case with various scripts.
    -The output with this option enabled is meant to be stable across
    -.B xz
    -releases.
    -See the section
    -.B "ROBOT MODE"
    -for details.
    -.TP
    -.BR \-\-info\-memory
    -Display, in human-readable format, how much physical memory (RAM)
    -.B xz
    -thinks the system has and the memory usage limits for compression
    -and decompression, and exit successfully.
    -.TP
    -.BR \-h ", " \-\-help
    -Display a help message describing the most commonly used options,
    -and exit successfully.
    -.TP
    -.BR \-H ", " \-\-long\-help
    -Display a help message describing all features of
    -.BR xz ,
    -and exit successfully
    -.TP
    -.BR \-V ", " \-\-version
    -Display the version number of
    -.B xz
    -and liblzma in human readable format.
    -To get machine-parsable output, specify
    -.B \-\-robot
    -before
    -.BR \-\-version .
    -.
    -.SH "ROBOT MODE"
    -The robot mode is activated with the
    -.B \-\-robot
    -option.
    -It makes the output of
    -.B xz
    -easier to parse by other programs.
    -Currently
    -.B \-\-robot
    -is supported only together with
    -.BR \-\-version ,
    -.BR \-\-info\-memory ,
    -and
    -.BR \-\-list .
    -It will be supported for compression and
    -decompression in the future.
    -.
    -.SS Version
    -.B "xz \-\-robot \-\-version"
    -will print the version number of
    -.B xz
    -and liblzma in the following format:
    -.PP
    -.BI XZ_VERSION= XYYYZZZS
    -.br
    -.BI LIBLZMA_VERSION= XYYYZZZS
    -.TP
    -.I X
    -Major version.
    -.TP
    -.I YYY
    -Minor version.
    -Even numbers are stable.
    -Odd numbers are alpha or beta versions.
    -.TP
    -.I ZZZ
    -Patch level for stable releases or
    -just a counter for development releases.
    -.TP
    -.I S
    -Stability.
    -0 is alpha, 1 is beta, and 2 is stable.
    -.I S
    -should be always 2 when
    -.I YYY
    -is even.
    -.PP
    -.I XYYYZZZS
    -are the same on both lines if
    -.B xz
    -and liblzma are from the same XZ Utils release.
    -.PP
    -Examples: 4.999.9beta is
    -.B 49990091
    -and
    -5.0.0 is
    -.BR 50000002 .
    -.
    -.SS "Memory limit information"
    -.B "xz \-\-robot \-\-info\-memory"
    -prints a single line with three tab-separated columns:
    -.IP 1. 4
    -Total amount of physical memory (RAM) in bytes
    -.IP 2. 4
    -Memory usage limit for compression in bytes.
    -A special value of zero indicates the default setting,
    -which for single-threaded mode is the same as no limit.
    -.IP 3. 4
    -Memory usage limit for decompression in bytes.
    -A special value of zero indicates the default setting,
    -which for single-threaded mode is the same as no limit.
    -.PP
    -In the future, the output of
    -.B "xz \-\-robot \-\-info\-memory"
    -may have more columns, but never more than a single line.
    -.
    -.SS "List mode"
    -.B "xz \-\-robot \-\-list"
    -uses tab-separated output.
    -The first column of every line has a string
    -that indicates the type of the information found on that line:
    -.TP
    -.B name
    -This is always the first line when starting to list a file.
    -The second column on the line is the filename.
    -.TP
    -.B file
    -This line contains overall information about the
    -.B .xz
    -file.
    -This line is always printed after the
    -.B name
    -line.
    -.TP
    -.B stream
    -This line type is used only when
    -.B \-\-verbose
    -was specified.
    -There are as many
    -.B stream
    -lines as there are streams in the
    -.B .xz
    -file.
    -.TP
    -.B block
    -This line type is used only when
    -.B \-\-verbose
    -was specified.
    -There are as many
    -.B block
    -lines as there are blocks in the
    -.B .xz
    -file.
    -The
    -.B block
    -lines are shown after all the
    -.B stream
    -lines; different line types are not interleaved.
    -.TP
    -.B summary
    -This line type is used only when
    -.B \-\-verbose
    -was specified twice.
    -This line is printed after all
    -.B block
    -lines.
    -Like the
    -.B file
    -line, the
    -.B summary
    -line contains overall information about the
    -.B .xz
    -file.
    -.TP
    -.B totals
    -This line is always the very last line of the list output.
    -It shows the total counts and sizes.
    -.PP
    -The columns of the
    -.B file
    -lines:
    -.PD 0
    -.RS
    -.IP 2. 4
    -Number of streams in the file
    -.IP 3. 4
    -Total number of blocks in the stream(s)
    -.IP 4. 4
    -Compressed size of the file
    -.IP 5. 4
    -Uncompressed size of the file
    -.IP 6. 4
    -Compression ratio, for example
    -.BR 0.123.
    -If ratio is over 9.999, three dashes
    -.RB ( \-\-\- )
    -are displayed instead of the ratio.
    -.IP 7. 4
    -Comma-separated list of integrity check names.
    -The following strings are used for the known check types:
    -.BR None ,
    -.BR CRC32 ,
    -.BR CRC64 ,
    -and
    -.BR SHA\-256 .
    -For unknown check types,
    -.BI Unknown\- N
    -is used, where
    -.I N
    -is the Check ID as a decimal number (one or two digits).
    -.IP 8. 4
    -Total size of stream padding in the file
    -.RE
    -.PD
    -.PP
    -The columns of the
    -.B stream
    -lines:
    -.PD 0
    -.RS
    -.IP 2. 4
    -Stream number (the first stream is 1)
    -.IP 3. 4
    -Number of blocks in the stream
    -.IP 4. 4
    -Compressed start offset
    -.IP 5. 4
    -Uncompressed start offset
    -.IP 6. 4
    -Compressed size (does not include stream padding)
    -.IP 7. 4
    -Uncompressed size
    -.IP 8. 4
    -Compression ratio
    -.IP 9. 4
    -Name of the integrity check
    -.IP 10. 4
    -Size of stream padding
    -.RE
    -.PD
    -.PP
    -The columns of the
    -.B block
    -lines:
    -.PD 0
    -.RS
    -.IP 2. 4
    -Number of the stream containing this block
    -.IP 3. 4
    -Block number relative to the beginning of the stream
    -(the first block is 1)
    -.IP 4. 4
    -Block number relative to the beginning of the file
    -.IP 5. 4
    -Compressed start offset relative to the beginning of the file
    -.IP 6. 4
    -Uncompressed start offset relative to the beginning of the file
    -.IP 7. 4
    -Total compressed size of the block (includes headers)
    -.IP 8. 4
    -Uncompressed size
    -.IP 9. 4
    -Compression ratio
    -.IP 10. 4
    -Name of the integrity check
    -.RE
    -.PD
    -.PP
    -If
    -.B \-\-verbose
    -was specified twice, additional columns are included on the
    -.B block
    -lines.
    -These are not displayed with a single
    -.BR \-\-verbose ,
    -because getting this information requires many seeks
    -and can thus be slow:
    -.PD 0
    -.RS
    -.IP 11. 4
    -Value of the integrity check in hexadecimal
    -.IP 12. 4
    -Block header size
    -.IP 13. 4
    -Block flags:
    -.B c
    -indicates that compressed size is present, and
    -.B u
    -indicates that uncompressed size is present.
    -If the flag is not set, a dash
    -.RB ( \- )
    -is shown instead to keep the string length fixed.
    -New flags may be added to the end of the string in the future.
    -.IP 14. 4
    -Size of the actual compressed data in the block (this excludes
    -the block header, block padding, and check fields)
    -.IP 15. 4
    -Amount of memory (in bytes) required to decompress
    -this block with this
    -.B xz
    -version
    -.IP 16. 4
    -Filter chain.
    -Note that most of the options used at compression time
    -cannot be known, because only the options
    -that are needed for decompression are stored in the
    -.B .xz
    -headers.
    -.RE
    -.PD
    -.PP
    -The columns of the
    -.B summary
    -lines:
    -.PD 0
    -.RS
    -.IP 2. 4
    -Amount of memory (in bytes) required to decompress
    -this file with this
    -.B xz
    -version
    -.IP 3. 4
    -.B yes
    -or
    -.B no
    -indicating if all block headers have both compressed size and
    -uncompressed size stored in them
    -.PP
    -.I Since
    -.B xz
    -.I 5.1.2alpha:
    -.IP 4. 4
    -Minimum
    -.B xz
    -version required to decompress the file
    -.RE
    -.PD
    -.PP
    -The columns of the
    -.B totals
    -line:
    -.PD 0
    -.RS
    -.IP 2. 4
    -Number of streams
    -.IP 3. 4
    -Number of blocks
    -.IP 4. 4
    -Compressed size
    -.IP 5. 4
    -Uncompressed size
    -.IP 6. 4
    -Average compression ratio
    -.IP 7. 4
    -Comma-separated list of integrity check names
    -that were present in the files
    -.IP 8. 4
    -Stream padding size
    -.IP 9. 4
    -Number of files.
    -This is here to
    -keep the order of the earlier columns the same as on
    -.B file
    -lines.
    -.PD
    -.RE
    -.PP
    -If
    -.B \-\-verbose
    -was specified twice, additional columns are included on the
    -.B totals
    -line:
    -.PD 0
    -.RS
    -.IP 10. 4
    -Maximum amount of memory (in bytes) required to decompress
    -the files with this
    -.B xz
    -version
    -.IP 11. 4
    -.B yes
    -or
    -.B no
    -indicating if all block headers have both compressed size and
    -uncompressed size stored in them
    -.PP
    -.I Since
    -.B xz
    -.I 5.1.2alpha:
    -.IP 12. 4
    -Minimum
    -.B xz
    -version required to decompress the file
    -.RE
    -.PD
    -.PP
    -Future versions may add new line types and
    -new columns can be added to the existing line types,
    -but the existing columns won't be changed.
    -.
    -.SH "EXIT STATUS"
    -.TP
    -.B 0
    -All is good.
    -.TP
    -.B 1
    -An error occurred.
    -.TP
    -.B 2
    -Something worth a warning occurred,
    -but no actual errors occurred.
    -.PP
    -Notices (not warnings or errors) printed on standard error
    -don't affect the exit status.
    -.
    -.SH ENVIRONMENT
    -.B xz
    -parses space-separated lists of options
    -from the environment variables
    -.B XZ_DEFAULTS
    -and
    -.BR XZ_OPT ,
    -in this order, before parsing the options from the command line.
    -Note that only options are parsed from the environment variables;
    -all non-options are silently ignored.
    -Parsing is done with
    -.BR getopt_long (3)
    -which is used also for the command line arguments.
    -.TP
    -.B XZ_DEFAULTS
    -User-specific or system-wide default options.
    -Typically this is set in a shell initialization script to enable
    -.BR xz 's
    -memory usage limiter by default.
    -Excluding shell initialization scripts
    -and similar special cases, scripts must never set or unset
    -.BR XZ_DEFAULTS .
    -.TP
    -.B XZ_OPT
    -This is for passing options to
    -.B xz
    -when it is not possible to set the options directly on the
    -.B xz
    -command line.
    -This is the case e.g. when
    -.B xz
    -is run by a script or tool, e.g. GNU
    -.BR tar (1):
    -.RS
    -.RS
    -.PP
    -.nf
    -.ft CW
    -XZ_OPT=\-2v tar caf foo.tar.xz foo
    -.ft R
    -.fi
    -.RE
    -.RE
    -.IP ""
    -Scripts may use
    -.B XZ_OPT
    -e.g. to set script-specific default compression options.
    -It is still recommended to allow users to override
    -.B XZ_OPT
    -if that is reasonable, e.g. in
    -.BR sh (1)
    -scripts one may use something like this:
    -.RS
    -.RS
    -.PP
    -.nf
    -.ft CW
    -XZ_OPT=${XZ_OPT\-"\-7e"}
    -export XZ_OPT
    -.ft R
    -.fi
    -.RE
    -.RE
    -.
    -.SH "LZMA UTILS COMPATIBILITY"
    -The command line syntax of
    -.B xz
    -is practically a superset of
    -.BR lzma ,
    -.BR unlzma ,
    -and
    -.BR lzcat
    -as found from LZMA Utils 4.32.x.
    -In most cases, it is possible to replace
    -LZMA Utils with XZ Utils without breaking existing scripts.
    -There are some incompatibilities though,
    -which may sometimes cause problems.
    -.
    -.SS "Compression preset levels"
    -The numbering of the compression level presets is not identical in
    -.B xz
    -and LZMA Utils.
    -The most important difference is how dictionary sizes
    -are mapped to different presets.
    -Dictionary size is roughly equal to the decompressor memory usage.
    -.RS
    -.PP
    -.TS
    -tab(;);
    -c c c
    -c n n.
    -Level;xz;LZMA Utils
    -\-0;256 KiB;N/A
    -\-1;1 MiB;64 KiB
    -\-2;2 MiB;1 MiB
    -\-3;4 MiB;512 KiB
    -\-4;4 MiB;1 MiB
    -\-5;8 MiB;2 MiB
    -\-6;8 MiB;4 MiB
    -\-7;16 MiB;8 MiB
    -\-8;32 MiB;16 MiB
    -\-9;64 MiB;32 MiB
    -.TE
    -.RE
    -.PP
    -The dictionary size differences affect
    -the compressor memory usage too,
    -but there are some other differences between
    -LZMA Utils and XZ Utils, which
    -make the difference even bigger:
    -.RS
    -.PP
    -.TS
    -tab(;);
    -c c c
    -c n n.
    -Level;xz;LZMA Utils 4.32.x
    -\-0;3 MiB;N/A
    -\-1;9 MiB;2 MiB
    -\-2;17 MiB;12 MiB
    -\-3;32 MiB;12 MiB
    -\-4;48 MiB;16 MiB
    -\-5;94 MiB;26 MiB
    -\-6;94 MiB;45 MiB
    -\-7;186 MiB;83 MiB
    -\-8;370 MiB;159 MiB
    -\-9;674 MiB;311 MiB
    -.TE
    -.RE
    -.PP
    -The default preset level in LZMA Utils is
    -.B \-7
    -while in XZ Utils it is
    -.BR \-6 ,
    -so both use an 8 MiB dictionary by default.
    -.
    -.SS "Streamed vs. non-streamed .lzma files"
    -The uncompressed size of the file can be stored in the
    -.B .lzma
    -header.
    -LZMA Utils does that when compressing regular files.
    -The alternative is to mark that uncompressed size is unknown
    -and use end-of-payload marker to indicate
    -where the decompressor should stop.
    -LZMA Utils uses this method when uncompressed size isn't known,
    -which is the case for example in pipes.
    -.PP
    -.B xz
    -supports decompressing
    -.B .lzma
    -files with or without end-of-payload marker, but all
    -.B .lzma
    -files created by
    -.B xz
    -will use end-of-payload marker and have uncompressed size
    -marked as unknown in the
    -.B .lzma
    -header.
    -This may be a problem in some uncommon situations.
    -For example, a
    -.B .lzma
    -decompressor in an embedded device might work
    -only with files that have known uncompressed size.
    -If you hit this problem, you need to use LZMA Utils
    -or LZMA SDK to create
    -.B .lzma
    -files with known uncompressed size.
    -.
    -.SS "Unsupported .lzma files"
    -The
    -.B .lzma
    -format allows
    -.I lc
    -values up to 8, and
    -.I lp
    -values up to 4.
    -LZMA Utils can decompress files with any
    -.I lc
    -and
    -.IR lp ,
    -but always creates files with
    -.B lc=3
    -and
    -.BR lp=0 .
    -Creating files with other
    -.I lc
    -and
    -.I lp
    -is possible with
    -.B xz
    -and with LZMA SDK.
    -.PP
    -The implementation of the LZMA1 filter in liblzma
    -requires that the sum of
    -.I lc
    -and
    -.I lp
    -must not exceed 4.
    -Thus,
    -.B .lzma
    -files, which exceed this limitation, cannot be decompressed with
    -.BR xz .
    -.PP
    -LZMA Utils creates only
    -.B .lzma
    -files which have a dictionary size of
    -.RI "2^" n
    -(a power of 2) but accepts files with any dictionary size.
    -liblzma accepts only
    -.B .lzma
    -files which have a dictionary size of
    -.RI "2^" n
    -or
    -.RI "2^" n " + 2^(" n "\-1)."
    -This is to decrease false positives when detecting
    -.B .lzma
    -files.
    -.PP
    -These limitations shouldn't be a problem in practice,
    -since practically all
    -.B .lzma
    -files have been compressed with settings that liblzma will accept.
    -.
    -.SS "Trailing garbage"
    -When decompressing,
    -LZMA Utils silently ignore everything after the first
    -.B .lzma
    -stream.
    -In most situations, this is a bug.
    -This also means that LZMA Utils
    -don't support decompressing concatenated
    -.B .lzma
    -files.
    -.PP
    -If there is data left after the first
    -.B .lzma
    -stream,
    -.B xz
    -considers the file to be corrupt unless
    -.B \-\-single\-stream
    -was used.
    -This may break obscure scripts which have
    -assumed that trailing garbage is ignored.
    -.
    -.SH NOTES
    -.
    -.SS "Compressed output may vary"
    -The exact compressed output produced from
    -the same uncompressed input file
    -may vary between XZ Utils versions even if
    -compression options are identical.
    -This is because the encoder can be improved
    -(faster or better compression)
    -without affecting the file format.
    -The output can vary even between different
    -builds of the same XZ Utils version,
    -if different build options are used.
    -.PP
    -The above means that once
    -.B \-\-rsyncable
    -has been implemented,
    -the resulting files won't necessarily be rsyncable
    -unless both old and new files have been compressed
    -with the same xz version.
    -This problem can be fixed if a part of the encoder
    -implementation is frozen to keep rsyncable output
    -stable across xz versions.
    -.
    -.SS "Embedded .xz decompressors"
    -Embedded
    -.B .xz
    -decompressor implementations like XZ Embedded don't necessarily
    -support files created with integrity
    -.I check
    -types other than
    -.B none
    -and
    -.BR crc32 .
    -Since the default is
    -.BR \-\-check=crc64 ,
    -you must use
    -.B \-\-check=none
    -or
    -.B \-\-check=crc32
    -when creating files for embedded systems.
    -.PP
    -Outside embedded systems, all
    -.B .xz
    -format decompressors support all the
    -.I check
    -types, or at least are able to decompress
    -the file without verifying the
    -integrity check if the particular
    -.I check
    -is not supported.
    -.PP
    -XZ Embedded supports BCJ filters,
    -but only with the default start offset.
    -.
    -.SH EXAMPLES
    -.
    -.SS Basics
    -Compress the file
    -.I foo
    -into
    -.I foo.xz
    -using the default compression level
    -.RB ( \-6 ),
    -and remove
    -.I foo
    -if compression is successful:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz foo
    -.ft R
    -.fi
    -.RE
    -.PP
    -Decompress
    -.I bar.xz
    -into
    -.I bar
    -and don't remove
    -.I bar.xz
    -even if decompression is successful:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-dk bar.xz
    -.ft R
    -.fi
    -.RE
    -.PP
    -Create
    -.I baz.tar.xz
    -with the preset
    -.B \-4e
    -.RB ( "\-4 \-\-extreme" ),
    -which is slower than e.g. the default
    -.BR \-6 ,
    -but needs less memory for compression and decompression (48\ MiB
    -and 5\ MiB, respectively):
    -.RS
    -.PP
    -.nf
    -.ft CW
    -tar cf \- baz | xz \-4e > baz.tar.xz
    -.ft R
    -.fi
    -.RE
    -.PP
    -A mix of compressed and uncompressed files can be decompressed
    -to standard output with a single command:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-dcf a.txt b.txt.xz c.txt d.txt.lzma > abcd.txt
    -.ft R
    -.fi
    -.RE
    -.
    -.SS "Parallel compression of many files"
    -On GNU and *BSD,
    -.BR find (1)
    -and
    -.BR xargs (1)
    -can be used to parallelize compression of many files:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -find . \-type f \e! \-name '*.xz' \-print0 \e
    -    | xargs \-0r \-P4 \-n16 xz \-T1
    -.ft R
    -.fi
    -.RE
    -.PP
    -The
    -.B \-P
    -option to
    -.BR xargs (1)
    -sets the number of parallel
    -.B xz
    -processes.
    -The best value for the
    -.B \-n
    -option depends on how many files there are to be compressed.
    -If there are only a couple of files,
    -the value should probably be 1;
    -with tens of thousands of files,
    -100 or even more may be appropriate to reduce the number of
    -.B xz
    -processes that
    -.BR xargs (1)
    -will eventually create.
    -.PP
    -The option
    -.B \-T1
    -for
    -.B xz
    -is there to force it to single-threaded mode, because
    -.BR xargs (1)
    -is used to control the amount of parallelization.
    -.
    -.SS "Robot mode"
    -Calculate how many bytes have been saved in total
    -after compressing multiple files:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-\-robot \-\-list *.xz | awk '/^totals/{print $5\-$4}'
    -.ft R
    -.fi
    -.RE
    -.PP
    -A script may want to know that it is using new enough
    -.BR xz .
    -The following
    -.BR sh (1)
    -script checks that the version number of the
    -.B xz
    -tool is at least 5.0.0.
    -This method is compatible with old beta versions,
    -which didn't support the
    -.B \-\-robot
    -option:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -if ! eval "$(xz \-\-robot \-\-version 2> /dev/null)" ||
    -        [ "$XZ_VERSION" \-lt 50000002 ]; then
    -    echo "Your xz is too old."
    -fi
    -unset XZ_VERSION LIBLZMA_VERSION
    -.ft R
    -.fi
    -.RE
    -.PP
    -Set a memory usage limit for decompression using
    -.BR XZ_OPT ,
    -but if a limit has already been set, don't increase it:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -NEWLIM=$((123 << 20))  # 123 MiB
    -OLDLIM=$(xz \-\-robot \-\-info\-memory | cut \-f3)
    -if [ $OLDLIM \-eq 0 \-o $OLDLIM \-gt $NEWLIM ]; then
    -    XZ_OPT="$XZ_OPT \-\-memlimit\-decompress=$NEWLIM"
    -    export XZ_OPT
    -fi
    -.ft R
    -.fi
    -.RE
    -.
    -.SS "Custom compressor filter chains"
    -The simplest use for custom filter chains is
    -customizing a LZMA2 preset.
    -This can be useful,
    -because the presets cover only a subset of the
    -potentially useful combinations of compression settings.
    -.PP
    -The CompCPU columns of the tables
    -from the descriptions of the options
    -.BR "\-0" " ... " "\-9"
    -and
    -.B \-\-extreme
    -are useful when customizing LZMA2 presets.
    -Here are the relevant parts collected from those two tables:
    -.RS
    -.PP
    -.TS
    -tab(;);
    -c c
    -n n.
    -Preset;CompCPU
    -\-0;0
    -\-1;1
    -\-2;2
    -\-3;3
    -\-4;4
    -\-5;5
    -\-6;6
    -\-5e;7
    -\-6e;8
    -.TE
    -.RE
    -.PP
    -If you know that a file requires
    -somewhat big dictionary (e.g. 32 MiB) to compress well,
    -but you want to compress it quicker than
    -.B "xz \-8"
    -would do, a preset with a low CompCPU value (e.g. 1)
    -can be modified to use a bigger dictionary:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-\-lzma2=preset=1,dict=32MiB foo.tar
    -.ft R
    -.fi
    -.RE
    -.PP
    -With certain files, the above command may be faster than
    -.B "xz \-6"
    -while compressing significantly better.
    -However, it must be emphasized that only some files benefit from
    -a big dictionary while keeping the CompCPU value low.
    -The most obvious situation,
    -where a big dictionary can help a lot,
    -is an archive containing very similar files
    -of at least a few megabytes each.
    -The dictionary size has to be significantly bigger
    -than any individual file to allow LZMA2 to take
    -full advantage of the similarities between consecutive files.
    -.PP
    -If very high compressor and decompressor memory usage is fine,
    -and the file being compressed is
    -at least several hundred megabytes, it may be useful
    -to use an even bigger dictionary than the 64 MiB that
    -.B "xz \-9"
    -would use:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-vv \-\-lzma2=dict=192MiB big_foo.tar
    -.ft R
    -.fi
    -.RE
    -.PP
    -Using
    -.B \-vv
    -.RB ( "\-\-verbose \-\-verbose" )
    -like in the above example can be useful
    -to see the memory requirements
    -of the compressor and decompressor.
    -Remember that using a dictionary bigger than
    -the size of the uncompressed file is waste of memory,
    -so the above command isn't useful for small files.
    -.PP
    -Sometimes the compression time doesn't matter,
    -but the decompressor memory usage has to be kept low
    -e.g. to make it possible to decompress the file on
    -an embedded system.
    -The following command uses
    -.B \-6e
    -.RB ( "\-6 \-\-extreme" )
    -as a base and sets the dictionary to only 64\ KiB.
    -The resulting file can be decompressed with XZ Embedded
    -(that's why there is
    -.BR \-\-check=crc32 )
    -using about 100\ KiB of memory.
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-\-check=crc32 \-\-lzma2=preset=6e,dict=64KiB foo
    -.ft R
    -.fi
    -.RE
    -.PP
    -If you want to squeeze out as many bytes as possible,
    -adjusting the number of literal context bits
    -.RI ( lc )
    -and number of position bits
    -.RI ( pb )
    -can sometimes help.
    -Adjusting the number of literal position bits
    -.RI ( lp )
    -might help too, but usually
    -.I lc
    -and
    -.I pb
    -are more important.
    -E.g. a source code archive contains mostly US-ASCII text,
    -so something like the following might give
    -slightly (like 0.1\ %) smaller file than
    -.B "xz \-6e"
    -(try also without
    -.BR lc=4 ):
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-\-lzma2=preset=6e,pb=0,lc=4 source_code.tar
    -.ft R
    -.fi
    -.RE
    -.PP
    -Using another filter together with LZMA2 can improve
    -compression with certain file types.
    -E.g. to compress a x86-32 or x86-64 shared library
    -using the x86 BCJ filter:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-\-x86 \-\-lzma2 libfoo.so
    -.ft R
    -.fi
    -.RE
    -.PP
    -Note that the order of the filter options is significant.
    -If
    -.B \-\-x86
    -is specified after
    -.BR \-\-lzma2 ,
    -.B xz
    -will give an error,
    -because there cannot be any filter after LZMA2,
    -and also because the x86 BCJ filter cannot be used
    -as the last filter in the chain.
    -.PP
    -The Delta filter together with LZMA2
    -can give good results with bitmap images.
    -It should usually beat PNG,
    -which has a few more advanced filters than simple
    -delta but uses Deflate for the actual compression.
    -.PP
    -The image has to be saved in uncompressed format,
    -e.g. as uncompressed TIFF.
    -The distance parameter of the Delta filter is set
    -to match the number of bytes per pixel in the image.
    -E.g. 24-bit RGB bitmap needs
    -.BR dist=3 ,
    -and it is also good to pass
    -.B pb=0
    -to LZMA2 to accommodate the three-byte alignment:
    -.RS
    -.PP
    -.nf
    -.ft CW
    -xz \-\-delta=dist=3 \-\-lzma2=pb=0 foo.tiff
    -.ft R
    -.fi
    -.RE
    -.PP
    -If multiple images have been put into a single archive (e.g.\&
    -.BR .tar ),
    -the Delta filter will work on that too as long as all images
    -have the same number of bytes per pixel.
    -.
    -.SH "SEE ALSO"
    -.BR xzdec (1),
    -.BR xzdiff (1),
    -.BR xzgrep (1),
    -.BR xzless (1),
    -.BR xzmore (1),
    -.BR gzip (1),
    -.BR bzip2 (1),
    -.BR 7z (1)
    -.PP
    -XZ Utils: 
    -.br
    -XZ Embedded: 
    -.br
    -LZMA SDK: 
    diff --git a/external/public-domain/xz/dist/src/xz/xz_w32res.rc b/external/public-domain/xz/dist/src/xz/xz_w32res.rc
    deleted file mode 100644
    index bad302029..000000000
    --- a/external/public-domain/xz/dist/src/xz/xz_w32res.rc
    +++ /dev/null
    @@ -1,12 +0,0 @@
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - */
    -
    -#define MY_TYPE VFT_APP
    -#define MY_NAME "xz"
    -#define MY_SUFFIX ".exe"
    -#define MY_DESC "xz data compression tool for .xz and .lzma files"
    -#include "common_w32res.rc"
    diff --git a/external/public-domain/xz/dist/src/xzdec/lzmadec_w32res.rc b/external/public-domain/xz/dist/src/xzdec/lzmadec_w32res.rc
    deleted file mode 100644
    index b85962df2..000000000
    --- a/external/public-domain/xz/dist/src/xzdec/lzmadec_w32res.rc
    +++ /dev/null
    @@ -1,12 +0,0 @@
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - */
    -
    -#define MY_TYPE VFT_APP
    -#define MY_NAME "lzmadec"
    -#define MY_SUFFIX ".exe"
    -#define MY_DESC "lzmadec decompression tool for .lzma files"
    -#include "common_w32res.rc"
    diff --git a/external/public-domain/xz/dist/src/xzdec/xzdec.1 b/external/public-domain/xz/dist/src/xzdec/xzdec.1
    deleted file mode 100644
    index 1e5ced945..000000000
    --- a/external/public-domain/xz/dist/src/xzdec/xzdec.1
    +++ /dev/null
    @@ -1,146 +0,0 @@
    -.\"
    -.\" Author: Lasse Collin
    -.\"
    -.\" This file has been put into the public domain.
    -.\" You can do whatever you want with this file.
    -.\"
    -.TH XZDEC 1 "2013-06-30" "Tukaani" "XZ Utils"
    -.SH NAME
    -xzdec, lzmadec \- Small .xz and .lzma decompressors
    -.SH SYNOPSIS
    -.B xzdec
    -.RI [ option... ]
    -.RI [ file... ]
    -.br
    -.B lzmadec
    -.RI [ option... ]
    -.RI [ file... ]
    -.SH DESCRIPTION
    -.B xzdec
    -is a liblzma-based decompression-only tool for
    -.B .xz
    -(and only
    -.BR .xz )
    -files.
    -.B xzdec
    -is intended to work as a drop-in replacement for
    -.BR xz (1)
    -in the most common situations where a script
    -has been written to use
    -.B "xz \-\-decompress \-\-stdout"
    -(and possibly a few other commonly used options) to decompress
    -.B .xz
    -files.
    -.B lzmadec
    -is identical to
    -.B xzdec
    -except that
    -.B lzmadec
    -supports
    -.B .lzma
    -files instead of
    -.B .xz
    -files.
    -.PP
    -To reduce the size of the executable,
    -.B xzdec
    -doesn't support multithreading or localization,
    -and doesn't read options from
    -.B XZ_DEFAULTS
    -and
    -.B XZ_OPT
    -environment variables.
    -.B xzdec
    -doesn't support displaying intermediate progress information: sending
    -.B SIGINFO
    -to
    -.B xzdec
    -does nothing, but sending
    -.B SIGUSR1
    -terminates the process instead of displaying progress information.
    -.SH OPTIONS
    -.TP
    -.BR \-d ", " \-\-decompress ", " \-\-uncompress
    -Ignored for
    -.BR xz (1)
    -compatibility.
    -.B xzdec
    -supports only decompression.
    -.TP
    -.BR \-k ", " \-\-keep
    -Ignored for
    -.BR xz (1)
    -compatibility.
    -.B xzdec
    -never creates or removes any files.
    -.TP
    -.BR \-c ", " \-\-stdout ", " \-\-to-stdout
    -Ignored for
    -.BR xz (1)
    -compatibility.
    -.B xzdec
    -always writes the decompressed data to standard output.
    -.TP
    -.BR \-q ", " \-\-quiet
    -Specifying this once does nothing since
    -.B xzdec
    -never displays any warnings or notices.
    -Specify this twice to suppress errors.
    -.TP
    -.BR \-Q ", " \-\-no-warn
    -Ignored for
    -.BR xz (1)
    -compatibility.
    -.B xzdec
    -never uses the exit status 2.
    -.TP
    -.BR \-h ", " \-\-help
    -Display a help message and exit successfully.
    -.TP
    -.BR \-V ", " \-\-version
    -Display the version number of
    -.B xzdec
    -and liblzma.
    -.SH "EXIT STATUS"
    -.TP
    -.B 0
    -All was good.
    -.TP
    -.B 1
    -An error occurred.
    -.PP
    -.B xzdec
    -doesn't have any warning messages like
    -.BR xz (1)
    -has, thus the exit status 2 is not used by
    -.BR xzdec .
    -.SH NOTES
    -Use
    -.BR xz (1)
    -instead of
    -.B xzdec
    -or
    -.B lzmadec
    -for normal everyday use.
    -.B xzdec
    -or
    -.B lzmadec
    -are meant only for situations where it is important to have
    -a smaller decompressor than the full-featured
    -.BR xz (1).
    -.PP
    -.B xzdec
    -and
    -.B lzmadec
    -are not really that small.
    -The size can be reduced further by dropping
    -features from liblzma at compile time,
    -but that shouldn't usually be done for executables distributed
    -in typical non-embedded operating system distributions.
    -If you need a truly small
    -.B .xz
    -decompressor, consider using XZ Embedded.
    -.SH "SEE ALSO"
    -.BR xz (1)
    -.PP
    -XZ Embedded: 
    diff --git a/external/public-domain/xz/dist/src/xzdec/xzdec.c b/external/public-domain/xz/dist/src/xzdec/xzdec.c
    deleted file mode 100644
    index 5cb7530af..000000000
    --- a/external/public-domain/xz/dist/src/xzdec/xzdec.c
    +++ /dev/null
    @@ -1,323 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       xzdec.c
    -/// \brief      Simple single-threaded tool to uncompress .xz or .lzma files
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "sysdefs.h"
    -#include "lzma.h"
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include "getopt.h"
    -#include "tuklib_progname.h"
    -#include "tuklib_exit.h"
    -
    -#ifdef TUKLIB_DOSLIKE
    -#	include 
    -#	include 
    -#endif
    -
    -
    -#ifdef LZMADEC
    -#	define TOOL_FORMAT "lzma"
    -#else
    -#	define TOOL_FORMAT "xz"
    -#endif
    -
    -
    -/// Error messages are suppressed if this is zero, which is the case when
    -/// --quiet has been given at least twice.
    -static unsigned int display_errors = 2;
    -
    -
    -static void lzma_attribute((__format__(__printf__, 1, 2)))
    -my_errorf(const char *fmt, ...)
    -{
    -	va_list ap;
    -	va_start(ap, fmt);
    -
    -	if (display_errors) {
    -		fprintf(stderr, "%s: ", progname);
    -		vfprintf(stderr, fmt, ap);
    -		fprintf(stderr, "\n");
    -	}
    -
    -	va_end(ap);
    -	return;
    -}
    -
    -
    -static void lzma_attribute((__noreturn__))
    -help(void)
    -{
    -	printf(
    -"Usage: %s [OPTION]... [FILE]...\n"
    -"Decompress files in the ." TOOL_FORMAT " format to standard output.\n"
    -"\n"
    -"  -d, --decompress   (ignored, only decompression is supported)\n"
    -"  -k, --keep         (ignored, files are never deleted)\n"
    -"  -c, --stdout       (ignored, output is always written to standard output)\n"
    -"  -q, --quiet        specify *twice* to suppress errors\n"
    -"  -Q, --no-warn      (ignored, the exit status 2 is never used)\n"
    -"  -h, --help         display this help and exit\n"
    -"  -V, --version      display the version number and exit\n"
    -"\n"
    -"With no FILE, or when FILE is -, read standard input.\n"
    -"\n"
    -"Report bugs to <" PACKAGE_BUGREPORT "> (in English or Finnish).\n"
    -PACKAGE_NAME " home page: <" PACKAGE_URL ">\n", progname);
    -
    -	tuklib_exit(EXIT_SUCCESS, EXIT_FAILURE, display_errors);
    -}
    -
    -
    -static void lzma_attribute((__noreturn__))
    -version(void)
    -{
    -	printf(TOOL_FORMAT "dec (" PACKAGE_NAME ") " LZMA_VERSION_STRING "\n"
    -			"liblzma %s\n", lzma_version_string());
    -
    -	tuklib_exit(EXIT_SUCCESS, EXIT_FAILURE, display_errors);
    -}
    -
    -
    -/// Parses command line options.
    -static void
    -parse_options(int argc, char **argv)
    -{
    -	static const char short_opts[] = "cdkM:hqQV";
    -	static const struct option long_opts[] = {
    -		{ "stdout",       no_argument,         NULL, 'c' },
    -		{ "to-stdout",    no_argument,         NULL, 'c' },
    -		{ "decompress",   no_argument,         NULL, 'd' },
    -		{ "uncompress",   no_argument,         NULL, 'd' },
    -		{ "keep",         no_argument,         NULL, 'k' },
    -		{ "quiet",        no_argument,         NULL, 'q' },
    -		{ "no-warn",      no_argument,         NULL, 'Q' },
    -		{ "help",         no_argument,         NULL, 'h' },
    -		{ "version",      no_argument,         NULL, 'V' },
    -		{ NULL,           0,                   NULL, 0   }
    -	};
    -
    -	int c;
    -
    -	while ((c = getopt_long(argc, argv, short_opts, long_opts, NULL))
    -			!= -1) {
    -		switch (c) {
    -		case 'c':
    -		case 'd':
    -		case 'k':
    -		case 'Q':
    -			break;
    -
    -		case 'q':
    -			if (display_errors > 0)
    -				--display_errors;
    -
    -			break;
    -
    -		case 'h':
    -			help();
    -
    -		case 'V':
    -			version();
    -
    -		default:
    -			exit(EXIT_FAILURE);
    -		}
    -	}
    -
    -	return;
    -}
    -
    -
    -static void
    -uncompress(lzma_stream *strm, FILE *file, const char *filename)
    -{
    -	lzma_ret ret;
    -
    -	// Initialize the decoder
    -#ifdef LZMADEC
    -	ret = lzma_alone_decoder(strm, UINT64_MAX);
    -#else
    -	ret = lzma_stream_decoder(strm, UINT64_MAX, LZMA_CONCATENATED);
    -#endif
    -
    -	// The only reasonable error here is LZMA_MEM_ERROR.
    -	if (ret != LZMA_OK) {
    -		my_errorf("%s", ret == LZMA_MEM_ERROR ? strerror(ENOMEM)
    -				: "Internal error (bug)");
    -		exit(EXIT_FAILURE);
    -	}
    -
    -	// Input and output buffers
    -	uint8_t in_buf[BUFSIZ];
    -	uint8_t out_buf[BUFSIZ];
    -
    -	strm->avail_in = 0;
    -	strm->next_out = out_buf;
    -	strm->avail_out = BUFSIZ;
    -
    -	lzma_action action = LZMA_RUN;
    -
    -	while (true) {
    -		if (strm->avail_in == 0) {
    -			strm->next_in = in_buf;
    -			strm->avail_in = fread(in_buf, 1, BUFSIZ, file);
    -
    -			if (ferror(file)) {
    -				// POSIX says that fread() sets errno if
    -				// an error occurred. ferror() doesn't
    -				// touch errno.
    -				my_errorf("%s: Error reading input file: %s",
    -						filename, strerror(errno));
    -				exit(EXIT_FAILURE);
    -			}
    -
    -#ifndef LZMADEC
    -			// When using LZMA_CONCATENATED, we need to tell
    -			// liblzma when it has got all the input.
    -			if (feof(file))
    -				action = LZMA_FINISH;
    -#endif
    -		}
    -
    -		ret = lzma_code(strm, action);
    -
    -		// Write and check write error before checking decoder error.
    -		// This way as much data as possible gets written to output
    -		// even if decoder detected an error.
    -		if (strm->avail_out == 0 || ret != LZMA_OK) {
    -			const size_t write_size = BUFSIZ - strm->avail_out;
    -
    -			if (fwrite(out_buf, 1, write_size, stdout)
    -					!= write_size) {
    -				// Wouldn't be a surprise if writing to stderr
    -				// would fail too but at least try to show an
    -				// error message.
    -				my_errorf("Cannot write to standard output: "
    -						"%s", strerror(errno));
    -				exit(EXIT_FAILURE);
    -			}
    -
    -			strm->next_out = out_buf;
    -			strm->avail_out = BUFSIZ;
    -		}
    -
    -		if (ret != LZMA_OK) {
    -			if (ret == LZMA_STREAM_END) {
    -#ifdef LZMADEC
    -				// Check that there's no trailing garbage.
    -				if (strm->avail_in != 0
    -						|| fread(in_buf, 1, 1, file)
    -							!= 0
    -						|| !feof(file))
    -					ret = LZMA_DATA_ERROR;
    -				else
    -					return;
    -#else
    -				// lzma_stream_decoder() already guarantees
    -				// that there's no trailing garbage.
    -				assert(strm->avail_in == 0);
    -				assert(action == LZMA_FINISH);
    -				assert(feof(file));
    -				return;
    -#endif
    -			}
    -
    -			const char *msg;
    -			switch (ret) {
    -			case LZMA_MEM_ERROR:
    -				msg = strerror(ENOMEM);
    -				break;
    -
    -			case LZMA_FORMAT_ERROR:
    -				msg = "File format not recognized";
    -				break;
    -
    -			case LZMA_OPTIONS_ERROR:
    -				// FIXME: Better message?
    -				msg = "Unsupported compression options";
    -				break;
    -
    -			case LZMA_DATA_ERROR:
    -				msg = "File is corrupt";
    -				break;
    -
    -			case LZMA_BUF_ERROR:
    -				msg = "Unexpected end of input";
    -				break;
    -
    -			default:
    -				msg = "Internal error (bug)";
    -				break;
    -			}
    -
    -			my_errorf("%s: %s", filename, msg);
    -			exit(EXIT_FAILURE);
    -		}
    -	}
    -}
    -
    -
    -int
    -main(int argc, char **argv)
    -{
    -	// Initialize progname which we will be used in error messages.
    -	tuklib_progname_init(argv);
    -
    -	// Parse the command line options.
    -	parse_options(argc, argv);
    -
    -	// The same lzma_stream is used for all files that we decode. This way
    -	// we don't need to reallocate memory for every file if they use same
    -	// compression settings.
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -
    -	// Some systems require setting stdin and stdout to binary mode.
    -#ifdef TUKLIB_DOSLIKE
    -	setmode(fileno(stdin), O_BINARY);
    -	setmode(fileno(stdout), O_BINARY);
    -#endif
    -
    -	if (optind == argc) {
    -		// No filenames given, decode from stdin.
    -		uncompress(&strm, stdin, "(stdin)");
    -	} else {
    -		// Loop through the filenames given on the command line.
    -		do {
    -			// "-" indicates stdin.
    -			if (strcmp(argv[optind], "-") == 0) {
    -				uncompress(&strm, stdin, "(stdin)");
    -			} else {
    -				FILE *file = fopen(argv[optind], "rb");
    -				if (file == NULL) {
    -					my_errorf("%s: %s", argv[optind],
    -							strerror(errno));
    -					exit(EXIT_FAILURE);
    -				}
    -
    -				uncompress(&strm, file, argv[optind]);
    -				fclose(file);
    -			}
    -		} while (++optind < argc);
    -	}
    -
    -#ifndef NDEBUG
    -	// Free the memory only when debugging. Freeing wastes some time,
    -	// but allows detecting possible memory leaks with Valgrind.
    -	lzma_end(&strm);
    -#endif
    -
    -	tuklib_exit(EXIT_SUCCESS, EXIT_FAILURE, display_errors);
    -}
    diff --git a/external/public-domain/xz/dist/src/xzdec/xzdec_w32res.rc b/external/public-domain/xz/dist/src/xzdec/xzdec_w32res.rc
    deleted file mode 100644
    index 0e26a225b..000000000
    --- a/external/public-domain/xz/dist/src/xzdec/xzdec_w32res.rc
    +++ /dev/null
    @@ -1,12 +0,0 @@
    -/*
    - * Author: Lasse Collin
    - *
    - * This file has been put into the public domain.
    - * You can do whatever you want with this file.
    - */
    -
    -#define MY_TYPE VFT_APP
    -#define MY_NAME "xzdec"
    -#define MY_SUFFIX ".exe"
    -#define MY_DESC "xzdec decompression tool for .xz files"
    -#include "common_w32res.rc"
    diff --git a/external/public-domain/xz/dist/tests/bcj_test.c b/external/public-domain/xz/dist/tests/bcj_test.c
    deleted file mode 100644
    index 05de38a28..000000000
    --- a/external/public-domain/xz/dist/tests/bcj_test.c
    +++ /dev/null
    @@ -1,65 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       bcj_test.c
    -/// \brief      Source code of compress_prepared_bcj_*
    -///
    -/// This is a simple program that should make the compiler to generate
    -/// PC-relative branches, jumps, and calls. The compiled files can then
    -/// be used to test the branch conversion filters. Note that this program
    -/// itself does nothing useful.
    -///
    -/// Compiling: gcc -std=c99 -fPIC -c bcj_test.c
    -/// Don't optimize or strip.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -extern int jump(int a, int b);
    -
    -
    -extern int
    -call(int a, int b)
    -{
    -	if (a < b)
    -		a = jump(a, b);
    -
    -	return a;
    -}
    -
    -
    -extern int
    -jump(int a, int b)
    -{
    -	// The loop generates conditional jump backwards.
    -	while (1) {
    -		if (a < b) {
    -			a *= 2;
    -			a += 3 * b;
    -			break;
    -		} else {
    -			// Put enough code here to prevent JMP SHORT on x86.
    -			a += b;
    -			a /= 2;
    -			b += b % 5;
    -			a -= b / 3;
    -			b = 2 * b + a - 1;
    -			a *= b + a + 1;
    -			b += a - 1;
    -			a += b * 2 - a / 5;
    -		}
    -	}
    -
    -	return a;
    -}
    -
    -
    -int
    -main(int argc, char **argv)
    -{
    -	int a = call(argc, argc + 1);
    -	return a == 0;
    -}
    diff --git a/external/public-domain/xz/dist/tests/compress_prepared_bcj_sparc.base64 b/external/public-domain/xz/dist/tests/compress_prepared_bcj_sparc.base64
    deleted file mode 100644
    index e43340166..000000000
    --- a/external/public-domain/xz/dist/tests/compress_prepared_bcj_sparc.base64
    +++ /dev/null
    @@ -1,28 +0,0 @@
    -begin-base64 644 tests/compress_prepared_bcj_sparc
    -f0VMRgECAQAAAAAAAAAAAAABAAIAAAABAAAAAAAAAAAAAAPAAAAAAAA0AAAAAAAo
    -AAcAAQAuc2hzdHJ0YWIALnRleHQALnN5bXRhYgAuc3RydGFiAC5yZWxhLnRleHQA
    -LmNvbW1lbnQAAAAAneO/kPAnoETyJ6BI2gegRMIHoEiAo0ABFoAACAEAAADQB6BE
    -0gegSEAAAAABAAAAghAACMInoETCB6BEsBAAAYHH4AiB6AAAneO/kPAnoETyJ6BI
    -2gegRMIHoEiAo0ABFoAADgEAAADCB6BEggBAAcInoETaB6BIghAADYIAQAGCAEAN
    -2gegRIIDQAHCJ6BEEIAAQQEAAADaB6BEwgegSIIDQAHCJ6BE2gegRIM7YB+DMGAf
    -ggNAAYM4YAHCJ6BEwgegSJAQAAGSECAFQAAAAAEAAACaEAAIwgegSIIAQA3CJ6BI
    -wgegSJAQAAGSECADQAAAAAEAAACaEAAIwgegRIIgQA3CJ6BEwgegSJoAQAHCB6BE
    -ggNAAYIAf//CJ6BI2gegSMIHoESCA0ABggBgAdAHoESSEAABQAAAAAEAAACCEAAI
    -wiegRNoHoETCB6BIggNAAYIAf//CJ6BIwgegSKAAQAHCB6BEkBAAAZIQIAVAAAAA
    -AQAAAIIQAAiaJAABwgegRIIAQA3CJ6BEEL//sgEAAADCB6BEsBAAAYHH4AiB6AAA
    -neO/iPAnoETyJ6BIwgegRIIAYAHQB6BEkhAAAUAAAAABAAAAghAACMInv+zCB7/s
    -ghhgAICgAAGCYD//sBAAAYHH4AiB6AAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAA
    -AAAAAAQA//EAAAAAAAAAAAAAAAADAAACAAAADAAAAAAAAAAAEAAAAAAAABEAAABI
    -AAABXBIAAAIAAAAWAAAAAAAAAEgSAAACAAAAGwAAAaQAAABIEgAAAgAAACAAAAAA
    -AAAAABAAAAAAAAAlAAAAAAAAAAAQAAAAAGJjal90ZXN0LmMALmRpdgBqdW1wAGNh
    -bGwAbWFpbgAucmVtAC51bXVsAAAAAAAoAAAEEgAAAAAAAADMAAAHEgAAAAAAAADw
    -AAADEgAAAAAAAAE4AAAIEgAAAAAAAAFwAAADEgAAAAAAAAHAAAAFEgAAAAAAYXM6
    -IFN1biBDb21waWxlciBDb21tb24gMTAgUGF0Y2ggMDkvMDQvMjAwNwoAR0NDOiAo
    -R05VKSAzLjQuMyAoY3NsLXNvbDIxMC0zXzQtYnJhbmNoK3NvbF9ycGF0aCkAAAAA
    -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAD
    -AAAAAAAAAAAAAAA0AAAANQAAAAAAAAAAAAAAAQAAAAAAAAALAAAAAQAAAAYAAAAA
    -AAAAbAAAAewAAAAAAAAAAAAAAAQAAAAAAAAAEQAAAAIAAAACAAAAAAAAAlgAAACQ
    -AAAABAAAAAMAAAAEAAAAEAAAABkAAAADAAAAAgAAAAAAAALoAAAAKwAAAAAAAAAA
    -AAAAAQAAAAAAAAAhAAAABAAAAAIAAAAAAAADFAAAAEgAAAADAAAAAgAAAAQAAAAM
    -AAAALAAAAAEAAAAAAAAAAAAAA1wAAABhAAAAAAAAAAAAAAABAAAAAA==
    -====
    diff --git a/external/public-domain/xz/dist/tests/compress_prepared_bcj_x86.base64 b/external/public-domain/xz/dist/tests/compress_prepared_bcj_x86.base64
    deleted file mode 100644
    index 0a426f850..000000000
    --- a/external/public-domain/xz/dist/tests/compress_prepared_bcj_x86.base64
    +++ /dev/null
    @@ -1,31 +0,0 @@
    -begin-base64 644 tests/compress_prepared_bcj_x86
    -f0VMRgEBAQAAAAAAAAAAAAEAAwABAAAAAAAAAAAAAAA0AgAAAAAAADQAAAAAACgA
    -DAAJAAEAAAAHAAAAVYnlU4PsFOj8////gcMCAAAAi0UIO0UMfRWLRQyJRCQEi0UI
    -iQQk6Pz///+JRQiLRQiDxBRbXcNVieVWg+wQi0UIO0UMfRrRZQiLVQyJ0AHAAdAB
    -RQiLRQiJRfTpxAAAAItFDAFFCItVCInQwegfAdDR+IlFCItNDMdF8GdmZmaLRfD3
    -6dH6icjB+B+J1inGiXX4i0X4weACA0X4icopwolV+ItN+AFNDIt1DIl17MdF8FZV
    -VVWLRfD3beyJ0YtF7MH4H4nOKcaJ8ClFCItFDAHAA0UISIlFDItFCANFDI1QAYtF
    -CA+vwolFCItFDANFCEiJRQyLRQyNNACLTQjHRfBnZmZmi0Xw9+nR+onIwfgfidEp
    -wYnIifIpwonQAUUI6Rr///+LRfSDxBBeXcONTCQEg+Tw/3H8VYnlU1GD7CDo/P//
    -/4HDAgAAAIsBQIlEJASLAYkEJOj8////iUX0g330AA+UwA+2wIPEIFlbXY1h/MMA
    -AEdDQzogKEdOVSkgNC4xLjIAixwkwwAuc3ltdGFiAC5zdHJ0YWIALnNoc3RydGFi
    -AC5yZWwudGV4dAAuZGF0YQAuYnNzAC5jb21tZW50AC50ZXh0Ll9faTY4Ni5nZXRf
    -cGNfdGh1bmsuYngALm5vdGUuR05VLXN0YWNrAC5ncm91cAAAAAAAAAAAAAAAAAAA
    -AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAGYAAAARAAAAAAAAAAAAAAA0AAAA
    -CAAAAAoAAAAKAAAABAAAAAQAAAAfAAAAAQAAAAYAAAAAAAAAPAAAAHMBAAAAAAAA
    -AAAAAAQAAAAAAAAAGwAAAAkAAAAAAAAAAAAAADwFAAAwAAAACgAAAAIAAAAEAAAA
    -CAAAACUAAAABAAAAAwAAAAAAAACwAQAAAAAAAAAAAAAAAAAABAAAAAAAAAArAAAA
    -CAAAAAMAAAAAAAAAsAEAAAAAAAAAAAAAAAAAAAQAAAAAAAAAMAAAAAEAAAAAAAAA
    -AAAAALABAAASAAAAAAAAAAAAAAABAAAAAAAAADkAAAABAAAABgIAAAAAAADCAQAA
    -BAAAAAAAAAAAAAAAAQAAAAAAAABWAAAAAQAAAAAAAAAAAAAAxgEAAAAAAAAAAAAA
    -AAAAAAEAAAAAAAAAEQAAAAMAAAAAAAAAAAAAAMYBAABtAAAAAAAAAAAAAAABAAAA
    -AAAAAAEAAAACAAAAAAAAAAAAAAAUBAAA4AAAAAsAAAAJAAAABAAAABAAAAAJAAAA
    -AwAAAAAAAAAAAAAA9AQAAEgAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAA
    -AAAAAAEAAAAAAAAAAAAAAAQA8f8AAAAAAAAAAAAAAAADAAIAAAAAAAAAAAAAAAAA
    -AwAEAAAAAAAAAAAAAAAAAAMABQAAAAAAAAAAAAAAAAADAAcAAAAAAAAAAAAAAAAA
    -AwAIAAAAAAAAAAAAAAAAAAMABgAAAAAAAAAAAAAAAAADAAEADAAAAAAAAAA4AAAA
    -EgACABEAAAAAAAAAAAAAABICBwAoAAAAAAAAAAAAAAAQAAAAPgAAADgAAAD2AAAA
    -EgACAEMAAAAuAQAARQAAABIAAgAAYmNqX3Rlc3QuYwBjYWxsAF9faTY4Ni5nZXRf
    -cGNfdGh1bmsuYngAX0dMT0JBTF9PRkZTRVRfVEFCTEVfAGp1bXAAbWFpbgAIAAAA
    -AgoAAA4AAAAKCwAAKAAAAAQMAABBAQAAAgoAAEcBAAAKCwAAWAEAAAQJAAA=
    -====
    diff --git a/external/public-domain/xz/dist/tests/create_compress_files.c b/external/public-domain/xz/dist/tests/create_compress_files.c
    deleted file mode 100644
    index bd5b4ef40..000000000
    --- a/external/public-domain/xz/dist/tests/create_compress_files.c
    +++ /dev/null
    @@ -1,158 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       create_compress_files.c
    -/// \brief      Creates bunch of test files to be compressed
    -///
    -/// Using a test file generator program saves space in the source code
    -/// package considerably.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "sysdefs.h"
    -#include 
    -
    -
    -// Avoid re-creating the test files every time the tests are run.
    -#define create_test(name) \
    -do { \
    -	if (!file_exists("compress_generated_" #name)) { \
    -		FILE *file = file_create("compress_generated_" #name); \
    -		write_ ## name(file); \
    -		file_finish(file, "compress_generated_" #name); \
    -	} \
    -} while (0)
    -
    -
    -static bool
    -file_exists(const char *filename)
    -{
    -	// Trying to be somewhat portable by avoiding stat().
    -	FILE *file = fopen(filename, "rb");
    -	bool ret;
    -
    -	if (file != NULL) {
    -		fclose(file);
    -		ret = true;
    -	} else {
    -		ret = false;
    -	}
    -
    -	return ret;
    -}
    -
    -
    -static FILE *
    -file_create(const char *filename)
    -{
    -	FILE *file = fopen(filename, "wb");
    -
    -	if (file == NULL) {
    -		perror(filename);
    -		exit(1);
    -	}
    -
    -	return file;
    -}
    -
    -
    -static void
    -file_finish(FILE *file, const char *filename)
    -{
    -	const bool ferror_fail = ferror(file);
    -	const bool fclose_fail = fclose(file);
    -
    -	if (ferror_fail || fclose_fail) {
    -		perror(filename);
    -		exit(1);
    -	}
    -}
    -
    -
    -// File that repeats "abc\n" a few thousand times. This is targeted
    -// especially at Subblock filter's run-length encoder.
    -static void
    -write_abc(FILE *file)
    -{
    -	for (size_t i = 0; i < 12345; ++i)
    -		if (fwrite("abc\n", 4, 1, file) != 1)
    -			exit(1);
    -}
    -
    -
    -// File that doesn't compress. We always use the same random seed to
    -// generate identical files on all systems.
    -static void
    -write_random(FILE *file)
    -{
    -	uint32_t n = 5;
    -
    -	for (size_t i = 0; i < 123456; ++i) {
    -		n = 101771 * n + 71777;
    -
    -		putc(n & 0xFF, file);
    -		putc((n >> 8) & 0xFF, file);
    -		putc((n >> 16) & 0xFF, file);
    -		putc(n >> 24, file);
    -	}
    -}
    -
    -
    -// Text file
    -static void
    -write_text(FILE *file)
    -{
    -	static const char *lorem[] = {
    -		"Lorem", "ipsum", "dolor", "sit", "amet,", "consectetur",
    -		"adipisicing", "elit,", "sed", "do", "eiusmod", "tempor",
    -		"incididunt", "ut", "labore", "et", "dolore", "magna",
    -		"aliqua.", "Ut", "enim", "ad", "minim", "veniam,", "quis",
    -		"nostrud", "exercitation", "ullamco", "laboris", "nisi",
    -		"ut", "aliquip", "ex", "ea", "commodo", "consequat.",
    -		"Duis", "aute", "irure", "dolor", "in", "reprehenderit",
    -		"in", "voluptate", "velit", "esse", "cillum", "dolore",
    -		"eu", "fugiat", "nulla", "pariatur.", "Excepteur", "sint",
    -		"occaecat", "cupidatat", "non", "proident,", "sunt", "in",
    -		"culpa", "qui", "officia", "deserunt", "mollit", "anim",
    -		"id", "est", "laborum."
    -	};
    -
    -	// Let the first paragraph be the original text.
    -	for (size_t w = 0; w < ARRAY_SIZE(lorem); ++w) {
    -		fprintf(file, "%s ", lorem[w]);
    -
    -		if (w % 7 == 6)
    -			fprintf(file, "\n");
    -	}
    -
    -	// The rest shall be (hopefully) meaningless combinations of
    -	// the same words.
    -	uint32_t n = 29;
    -
    -	for (size_t p = 0; p < 500; ++p) {
    -		fprintf(file, "\n\n");
    -
    -		for (size_t w = 0; w < ARRAY_SIZE(lorem); ++w) {
    -			n = 101771 * n + 71777;
    -
    -			fprintf(file, "%s ", lorem[n % ARRAY_SIZE(lorem)]);
    -
    -			if (w % 7 == 6)
    -				fprintf(file, "\n");
    -		}
    -	}
    -}
    -
    -
    -int
    -main(void)
    -{
    -	create_test(abc);
    -	create_test(random);
    -	create_test(text);
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/tests/files/README b/external/public-domain/xz/dist/tests/files/README
    deleted file mode 100644
    index 53950edb4..000000000
    --- a/external/public-domain/xz/dist/tests/files/README
    +++ /dev/null
    @@ -1,240 +0,0 @@
    -
    -.xz Test Files
    -----------------
    -
    -0. Introduction
    -
    -    This directory contains bunch of files to test handling of .xz files
    -    in .xz decoder implementations. Many of the files have been created
    -    by hand with a hex editor, thus there is no better "source code" than
    -    the files themselves. All the test files (*.xz) and this README have
    -    been put into the public domain.
    -
    -
    -1. File Types
    -
    -    Good files (good-*.xz) must decode successfully without requiring
    -    a lot of CPU time or RAM.
    -
    -    Unsupported files (unsupported-*.xz) are good files, but headers
    -    indicate features not supported by the current file format
    -    specification.
    -
    -    Bad files (bad-*.xz) must cause the decoder to give an error. Like
    -    with the good files, these files must not require a lot of CPU time
    -    or RAM before they get detected to be broken.
    -
    -
    -2. Descriptions of Individual Files
    -
    -2.1. Good Files
    -
    -    good-0-empty.xz has one Stream with no Blocks.
    -
    -    good-0pad-empty.xz has one Stream with no Blocks followed by
    -    four-byte Stream Padding.
    -
    -    good-0cat-empty.xz has two zero-Block Streams concatenated without
    -    Stream Padding.
    -
    -    good-0catpad-empty.xz has two zero-Block Streams concatenated with
    -    four-byte Stream Padding between the Streams.
    -
    -    good-1-check-none.xz has one Stream with one Block with two
    -    uncompressed LZMA2 chunks and no integrity check.
    -
    -    good-1-check-crc32.xz has one Stream with one Block with two
    -    uncompressed LZMA2 chunks and CRC32 check.
    -
    -    good-1-check-crc64.xz is like good-1-check-crc32.xz but with CRC64.
    -
    -    good-1-check-sha256.xz is like good-1-check-crc32.xz but with
    -    SHA256.
    -
    -    good-2-lzma2.xz has one Stream with two Blocks with one uncompressed
    -    LZMA2 chunk in each Block.
    -
    -    good-1-block_header-1.xz has both Compressed Size and Uncompressed
    -    Size in the Block Header. This has also four extra bytes of Header
    -    Padding.
    -
    -    good-1-block_header-2.xz has known Compressed Size.
    -
    -    good-1-block_header-3.xz has known Uncompressed Size.
    -
    -    good-1-delta-lzma2.tiff.xz is an image file that compresses
    -    better with Delta+LZMA2 than with plain LZMA2.
    -
    -    good-1-x86-lzma2.xz uses the x86 filter (BCJ) and LZMA2. The
    -    uncompressed file is compress_prepared_bcj_x86 found from the tests
    -    directory.
    -
    -    good-1-sparc-lzma2.xz uses the SPARC filter and LZMA. The
    -    uncompressed file is compress_prepared_bcj_sparc found from the tests
    -    directory.
    -
    -    good-1-lzma2-1.xz has two LZMA2 chunks, of which the second sets
    -    new properties.
    -
    -    good-1-lzma2-2.xz has two LZMA2 chunks, of which the second resets
    -    the state without specifying new properties.
    -
    -    good-1-lzma2-3.xz has two LZMA2 chunks, of which the first is
    -    uncompressed and the second is LZMA. The first chunk resets dictionary
    -    and the second sets new properties.
    -
    -    good-1-lzma2-4.xz has three LZMA2 chunks: First is LZMA, second is
    -    uncompressed with dictionary reset, and third is LZMA with new
    -    properties but without dictionary reset.
    -
    -    good-1-lzma2-5.xz has an empty LZMA2 stream with only the end of
    -    payload marker. XZ Utils 5.0.1 and older incorrectly see this file
    -    as corrupt.
    -
    -    good-1-3delta-lzma2.xz has three Delta filters and LZMA2.
    -
    -
    -2.2. Unsupported Files
    -
    -    unsupported-check.xz uses Check ID 0x02 which isn't supported by
    -    the current version of the file format. It is implementation-defined
    -    how this file handled (it may reject it, or decode it possibly with
    -    a warning).
    -
    -    unsupported-block_header.xz has a non-null byte in Header Padding,
    -    which may indicate presence of a new unsupported field.
    -
    -    unsupported-filter_flags-1.xz has unsupported Filter ID 0x7F.
    -
    -    unsupported-filter_flags-2.xz specifies only Delta filter in the
    -    List of Filter Flags, but Delta isn't allowed as the last filter in
    -    the chain. It could be a little more correct to detect this file as
    -    corrupt instead of unsupported, but saying it is unsupported is
    -    simpler in case of liblzma.
    -
    -    unsupported-filter_flags-3.xz specifies two LZMA2 filters in the
    -    List of Filter Flags. LZMA2 is allowed only as the last filter in the
    -    chain. It could be a little more correct to detect this file as
    -    corrupt instead of unsupported, but saying it is unsupported is
    -    simpler in case of liblzma.
    -
    -
    -2.3. Bad Files
    -
    -    bad-0pad-empty.xz has one Stream with no Blocks followed by
    -    five-byte Stream Padding. Stream Padding must be a multiple of four
    -    bytes, thus this file is corrupt.
    -
    -    bad-0catpad-empty.xz has two zero-Block Streams concatenated with
    -    five-byte Stream Padding between the Streams.
    -
    -    bad-0cat-alone.xz is good-0-empty.xz concatenated with an empty
    -    LZMA_Alone file.
    -
    -    bad-0cat-header_magic.xz is good-0cat-empty.xz but with one byte
    -    wrong in the Header Magic Bytes field of the second Stream. liblzma
    -    gives LZMA_DATA_ERROR for this. (LZMA_FORMAT_ERROR is used only if
    -    the first Stream of a file has invalid Header Magic Bytes.)
    -
    -    bad-0-header_magic.xz is good-0-empty.xz but with one byte wrong
    -    in the Header Magic Bytes field. liblzma gives LZMA_FORMAT_ERROR for
    -    this.
    -
    -    bad-0-footer_magic.xz is good-0-empty.xz but with one byte wrong
    -    in the Footer Magic Bytes field. liblzma gives LZMA_DATA_ERROR for
    -    this.
    -
    -    bad-0-empty-truncated.xz is good-0-empty.xz without the last byte
    -    of the file.
    -
    -    bad-0-nonempty_index.xz has no Blocks but Index claims that there is
    -    one Block.
    -
    -    bad-0-backward_size.xz has wrong Backward Size in Stream Footer.
    -
    -    bad-1-stream_flags-1.xz has different Stream Flags in Stream Header
    -    and Stream Footer.
    -
    -    bad-1-stream_flags-2.xz has wrong CRC32 in Stream Header.
    -
    -    bad-1-stream_flags-3.xz has wrong CRC32 in Stream Footer.
    -
    -    bad-1-vli-1.xz has two-byte variable-length integer in the
    -    Uncompressed Size field in Block Header while one-byte would be enough
    -    for that value. It's important that the file gets rejected due to too
    -    big integer encoding instead of due to Uncompressed Size not matching
    -    the value stored in the Block Header. That is, the decoder must not
    -    try to decode the Compressed Data field.
    -
    -    bad-1-vli-2.xz has ten-byte variable-length integer as Uncompressed
    -    Size in Block Header. It's important that the file gets rejected due
    -    to too big integer encoding instead of due to Uncompressed Size not
    -    matching the value stored in the Block Header. That is, the decoder
    -    must not try to decode the Compressed Data field.
    -
    -    bad-1-block_header-1.xz has Block Header that ends in the middle of
    -    the Filter Flags field.
    -
    -    bad-1-block_header-2.xz has Block Header that has Compressed Size and
    -    Uncompressed Size but no List of Filter Flags field.
    -
    -    bad-1-block_header-3.xz has wrong CRC32 in Block Header.
    -
    -    bad-1-block_header-4.xz has too big Compressed Size in Block Header
    -    (2^63 - 1 bytes while maximum is a little less, because the whole
    -    Block must stay smaller than 2^63). It's important that the file
    -    gets rejected due to invalid Compressed Size value; the decoder
    -    must not try decoding the Compressed Data field.
    -
    -    bad-1-block_header-5.xz has zero as Compressed Size in Block Header.
    -
    -    bad-1-block_header-6.xz has corrupt Block Header which may crash
    -    xz -lvv in XZ Utils 5.0.3 and earlier. It was fixed in the commit
    -    c0297445064951807803457dca1611b3c47e7f0f.
    -
    -    bad-2-index-1.xz has wrong Unpadded Sizes in Index.
    -
    -    bad-2-index-2.xz has wrong Uncompressed Sizes in Index.
    -
    -    bad-2-index-3.xz has non-null byte in Index Padding.
    -
    -    bad-2-index-4.xz wrong CRC32 in Index.
    -
    -    bad-2-index-5.xz has zero as Unpadded Size. It is important that the
    -    file gets rejected specifically due to Unpadded Size having an invalid
    -    value.
    -
    -    bad-2-compressed_data_padding.xz has non-null byte in the padding of
    -    the Compressed Data field of the first Block.
    -
    -    bad-1-check-crc32.xz has wrong Check (CRC32).
    -
    -    bad-1-check-crc64.xz has wrong Check (CRC64).
    -
    -    bad-1-check-sha256.xz has wrong Check (SHA-256).
    -
    -    bad-1-lzma2-1.xz has LZMA2 stream whose first chunk (uncompressed)
    -    doesn't reset the dictionary.
    -
    -    bad-1-lzma2-2.xz has two LZMA2 chunks, of which the second chunk
    -    indicates dictionary reset, but the LZMA compressed data tries to
    -    repeat data from the previous chunk.
    -
    -    bad-1-lzma2-3.xz sets new invalid properties (lc=8, lp=0, pb=0) in
    -    the middle of Block.
    -
    -    bad-1-lzma2-4.xz has two LZMA2 chunks, of which the first is
    -    uncompressed and the second is LZMA. The first chunk resets dictionary
    -    as it should, but the second chunk tries to reset state without
    -    specifying properties for LZMA.
    -
    -    bad-1-lzma2-5.xz is like bad-1-lzma2-4.xz but doesn't try to reset
    -    anything in the header of the second chunk.
    -
    -    bad-1-lzma2-6.xz has reserved LZMA2 control byte value (0x03).
    -
    -    bad-1-lzma2-7.xz has EOPM at LZMA level.
    -
    -    bad-1-lzma2-8.xz is like good-1-lzma2-4.xz but doesn't set new
    -    properties in the third LZMA2 chunk.
    -
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0-backward_size.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0-backward_size.xz.base64
    deleted file mode 100644
    index 1fb22ec1f..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0-backward_size.xz.base64
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -begin-base64 644 tests/files/bad-0-backward_size.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCE1kcXGAAAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0-empty-truncated.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0-empty-truncated.xz.base64
    deleted file mode 100644
    index 3801e4a45..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0-empty-truncated.xz.base64
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -begin-base64 644 tests/files/bad-0-empty-truncated.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWQ==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0-footer_magic.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0-footer_magic.xz.base64
    deleted file mode 100644
    index 2db2cfde2..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0-footer_magic.xz.base64
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -begin-base64 644 tests/files/bad-0-footer_magic.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVg=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0-header_magic.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0-header_magic.xz.base64
    deleted file mode 100644
    index ac17767c8..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0-header_magic.xz.base64
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -begin-base64 644 tests/files/bad-0-header_magic.xz
    -/Td6WFkAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0-nonempty_index.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0-nonempty_index.xz.base64
    deleted file mode 100644
    index 5b8712c6e..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0-nonempty_index.xz.base64
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -begin-base64 644 tests/files/bad-0-nonempty_index.xz
    -/Td6WFoAAAFpIt42AAEAACu1hiCQQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0cat-alone.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0cat-alone.xz.base64
    deleted file mode 100644
    index 11fbdc303..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0cat-alone.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-0cat-alone.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVpdAAABAP//////////AIP/
    -+///wAAAAA==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0cat-header_magic.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0cat-header_magic.xz.base64
    deleted file mode 100644
    index 11f1caea6..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0cat-header_magic.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-0cat-header_magic.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVr9N3pYWQAAAWki3jYAAAAA
    -HN9EIZBCmQ0BAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0catpad-empty.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0catpad-empty.xz.base64
    deleted file mode 100644
    index 1d079b59d..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0catpad-empty.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-0catpad-empty.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVoAAAAAAP03elhaAAABaSLe
    -NgAAAAAc30QhkEKZDQEAAAAAAVla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-0pad-empty.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-0pad-empty.xz.base64
    deleted file mode 100644
    index 129e9c8d0..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-0pad-empty.xz.base64
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -begin-base64 644 tests/files/bad-0pad-empty.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVoAAAAAAA==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-block_header-1.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-block_header-1.xz.base64
    deleted file mode 100644
    index 30f8d7914..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-block_header-1.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-block_header-1.xz
    -/Td6WFoAAAFpIt42AQAhAQydYGIBAAVIZWxsbwoCAAZXb3JsZCEKAEOjohUAASQN
    -MCjfr5BCmQ0BAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-block_header-2.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-block_header-2.xz.base64
    deleted file mode 100644
    index 03faea92c..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-block_header-2.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-block_header-2.xz
    -/Td6WFoAAAFpIt42AcAEDYCXihIBAAVIZWxsbwoCAAZXb3JsZCEKAEOjohUAASQN
    -MCjfr5BCmQ0BAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-block_header-3.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-block_header-3.xz.base64
    deleted file mode 100644
    index 802b9c98d..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-block_header-3.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-block_header-3.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMzAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-block_header-4.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-block_header-4.xz.base64
    deleted file mode 100644
    index f7d9bf08c..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-block_header-4.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-block_header-4.xz
    -/Td6WFoAAAFpIt42BED//////////38hAQgAAGPiOnABAAxIZWxsbwpXb3JsZCEK
    -AAAAAEOjohUAASkNfVZxGpBCmQ0BAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-block_header-5.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-block_header-5.xz.base64
    deleted file mode 100644
    index 03c0399a1..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-block_header-5.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-block_header-5.xz
    -/Td6WFoAAAFpIt42A8AADSEBCAAAAAAAqTRVIwEADEhlbGxvCldvcmxkIQoAAAAA
    -Q6OiFQABJQ1xGcS2kEKZDQEAAAAAAVla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-block_header-6.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-block_header-6.xz.base64
    deleted file mode 100644
    index 5b06f72bb..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-block_header-6.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-block_header-6.xz
    -/Td6WFoAAAFpIt42AMARDSEBCAAAAAAAf9456wEADEhlbGxvCldvcmxkIQoAAAAA
    -Q6OiFQABJQ1xGcS2kEKZDQEAAAAAAVla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-check-crc32.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-check-crc32.xz.base64
    deleted file mode 100644
    index cd344f516..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-check-crc32.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-check-crc32.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IU
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-check-crc64.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-check-crc64.xz.base64
    deleted file mode 100644
    index a91a1c759..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-check-crc64.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-check-crc64.xz
    -/Td6WFoAAATm1rRGAgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgDvLogR
    -nT+WywABKA08Z2oDH7bzfQEAAAAABFla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-check-sha256.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-check-sha256.xz.base64
    deleted file mode 100644
    index 776d18eef..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-check-sha256.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-check-sha256.xz
    -/Td6WFoAAArh+wyhAgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgCOWTXn
    -4TNozZaI/o9IoJVSk2dqAhViWCx+hI2v4T+wRwABQA2Thk6uGJtLmgEAAAAAClla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-1.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-lzma2-1.xz.base64
    deleted file mode 100644
    index ff56464c7..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-1.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-lzma2-1.xz
    -/Td6WFoAAAD/EtlBAgAhAQgAAADYDyMTAgAFSGVsbG8KAgAGV29ybGQhCgAAASAN
    -NO2zywZynnoBAAAAAABZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-2.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-lzma2-2.xz.base64
    deleted file mode 100644
    index 38335af2c..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-2.xz.base64
    +++ /dev/null
    @@ -1,11 +0,0 @@
    -begin-base64 644 tests/files/bad-1-lzma2-2.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMT4ADiALZdACYbykZnWvJ3uH2G2EHbBTXN
    -g6V8EqUF25C9LxTTcXKWqIp9hFZxjWoimKuePZCALcdeDBJS0z8HCHscpHfzE7gX
    -wO6RgTmzh/D/ALNqUkHtLrDyZJekmp5joa4ZdA2p1Vts7rHgLNxh3Mudhs/h3Ap6
    -gRRf0EDIfg2XRM61wvwsWQi/A4Dc10SOs9Qt3uUWIW5HgqwIWdjkZilh1dH6SWOQ
    -ET4g0Kni1RSB2SPQj0OuRVU2aaoA4ADlAK0LAIzxnUAr0H0dme7k3GN0ZEakoEpk
    -ZbL2TsHIaJ8nVK27pjQ8d+wPLhuOQiflaL9g9As68Jsx698/2K+lVZJGBVgiCY+o
    -YAgLo+k+vLQW28ejosAW1RSnIugv6LTQdxfFi+Tyu2vW75qBNE4d3Ow25kRyvym1
    -PAUxYGa6LAMP1kfGfYXUxV5OV3PDQWm+DYyctRWp59J4UUvVKdD5NRrFXfSMenDV
    -XqgxV4DIpdjgAAAA+0dI2wABggPJAwAACwSO3j4wDYsCAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-3.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-lzma2-3.xz.base64
    deleted file mode 100644
    index 6cf45e11b..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-3.xz.base64
    +++ /dev/null
    @@ -1,11 +0,0 @@
    -begin-base64 644 tests/files/bad-1-lzma2-3.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMT4ADiALZdACYbykZnWvJ3uH2G2EHbBTXN
    -g6V8EqUF25C9LxTTcXKWqIp9hFZxjWoimKuePZCALcdeDBJS0z8HCHscpHfzE7gX
    -wO6RgTmzh/D/ALNqUkHtLrDyZJekmp5joa4ZdA2p1Vts7rHgLNxh3Mudhs/h3Ap6
    -gRRf0EDIfg2XRM61wvwsWQi/A4Dc10SOs9Qt3uUWIW5HgqwIWdjkZilh1dH6SWOQ
    -ET4g0Kni1RSB2SPQj0OuRVU2aaoAwADlAK0IAIzxnUAr0H0dme7k3GN0ZEakoEpk
    -ZbL2TsHIaJ8nVK27pjQ8d+wPLhuOQiflaL9g9As68Jsx698/2K+lVZJGBVgiCY+o
    -YAgLo+k+vLQW28ejosAW1RSnIugv6LTQdxfFi+Tyu2vW75qBNE4d3Ow25kRyvym1
    -PAUxYGa6LAMP1kfGfYXUxV5OV3PDQWm+DYyctRWp59J4UUvVKdD5NRrFXfSMenDV
    -XqgxV4DIpdjgAAAA+0dI2wABggPJAwAACwSO3j4wDYsCAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-4.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-lzma2-4.xz.base64
    deleted file mode 100644
    index e7fdda369..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-4.xz.base64
    +++ /dev/null
    @@ -1,11 +0,0 @@
    -begin-base64 644 tests/files/bad-1-lzma2-4.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQA0TG9yZW0gaXBzdW0gZG9sb3Igc2l0
    -IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2ljaW5nIAqgAZMBJAAymwlsVNculWz5
    -9zfVHOJGAoJ1+0l2jXNTtv1t28rb2UQLsS6+E7a6qOLz7XVU3EEgzL82WyCZXQ8h
    -oQajli23l5zwe/7iEowtUfDbdnd9pHvTlen7Beb1l49i6dswu7RwPRZ4A3c6i3rV
    -uPhKJyX1jqokFKYpKGsvc+ChcbR7pIBQQMrv27SV/bvBjI5gl9vLfyHtwBBxGn3L
    -zQnQ2f9tgMBnfT/GlM9b3VER0cvUINcrhE6oRbtCeBpoQF8kXok6Nn3bmCjM+YPs
    -MgYxR0c7bBz0YjRAsyi7VDbdeg4cNiU4WAb4FaPOGMj9lh5pKQPDvSfz54/bc7Qr
    -TzhYJL+DFDl+c+7+z8q98yFqKIDIjl2Bx7wX0CyTtQiVug6Sgmau/7gDAAD7R0jb
    -AAHzAskDAADf85AjPjANiwIAAAAAAVla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-5.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-lzma2-5.xz.base64
    deleted file mode 100644
    index 9a6ac860d..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-5.xz.base64
    +++ /dev/null
    @@ -1,11 +0,0 @@
    -begin-base64 644 tests/files/bad-1-lzma2-5.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQA0TG9yZW0gaXBzdW0gZG9sb3Igc2l0
    -IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2ljaW5nIAqAAZMBJAAymwlsVNculWz5
    -9zfVHOJGAoJ1+0l2jXNTtv1t28rb2UQLsS6+E7a6qOLz7XVU3EEgzL82WyCZXQ8h
    -oQajli23l5zwe/7iEowtUfDbdnd9pHvTlen7Beb1l49i6dswu7RwPRZ4A3c6i3rV
    -uPhKJyX1jqokFKYpKGsvc+ChcbR7pIBQQMrv27SV/bvBjI5gl9vLfyHtwBBxGn3L
    -zQnQ2f9tgMBnfT/GlM9b3VER0cvUINcrhE6oRbtCeBpoQF8kXok6Nn3bmCjM+YPs
    -MgYxR0c7bBz0YjRAsyi7VDbdeg4cNiU4WAb4FaPOGMj9lh5pKQPDvSfz54/bc7Qr
    -TzhYJL+DFDl+c+7+z8q98yFqKIDIjl2Bx7wX0CyTtQiVug6Sgmau/7gDAAD7R0jb
    -AAHzAskDAADf85AjPjANiwIAAAAAAVla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-6.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-lzma2-6.xz.base64
    deleted file mode 100644
    index da6f16689..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-6.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-lzma2-6.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAwAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-7.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-lzma2-7.xz.base64
    deleted file mode 100644
    index d3b072aad..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-7.xz.base64
    +++ /dev/null
    @@ -1,11 +0,0 @@
    -begin-base64 644 tests/files/bad-1-lzma2-7.xz
    -/Td6WFoAAATm1rRGAgAhAQgAAADYDyMT4AHIAVddACYbykZnWvJ3uH2G2EHbBTXN
    -g6V8EqUF25C9LxTTcRJ8Tc0RqeNlAS6GSYaSQjJSlC4QX7eOj/31G8YmAfCzu7tu
    -xXqW4d/INMP1T4MGKFGBZPmAanFH0OKm1g1kMc+KMGL7czVKEAXEzu+0/tOFNuDp
    -Z8DwtaEeUlhU3UBW+JvzWfHW4HoGVjw9vRWBuzrrhQ4SqrFgWWy+QI6NrgGWKHoT
    -cTxThzWTuuIl6rU1rlBOvuDdDLqKw/AkF/bw5MzbvScrt6vBlWKwv4CVqAgCf9HW
    -K3eNHG7OpdnaXdPmi7XneUGm0559J7xJmYUL8Q5FHvsq99cOfM/w9FJIGHsRS/G5
    -qYHpJwo3w1W9tFXbrbffeZ9GtZVLeXsR2S0T4wjVoYSgQTtuEdM2+XpVVBDfBuFM
    -11dJvWZpfRug4YNoCB2g/TSGng3BIBtldd07X3PKwoP//+hqUdgAALIHROkXM0uE
    -AAHzAskDAADf85AjscRn+wIAAAAABFla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-8.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-lzma2-8.xz.base64
    deleted file mode 100644
    index 7c832b0cd..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-lzma2-8.xz.base64
    +++ /dev/null
    @@ -1,12 +0,0 @@
    -begin-base64 644 tests/files/bad-1-lzma2-8.xz
    -/Td6WFoAAATm1rRGAgAhAQgAAADYDyMT4AC7AKFdACYbykZnWvJ3uH2G2EHbBTXN
    -g6V8EqUF25C9LxTTcXKWqIp9hFZxjWoimKuePZCALcdeDBJS0z8HCHscpHfzE7gX
    -wO6Rc8q8z+s0ZqxIm2nZkweuzlCvaAkvW4gfwgiiLFhFsP9iCevu22NPb+DzH88S
    -N5iWTvbysvtur0QC4iLe1eY0lzmjRS+umS95aY/pN4lI/sx+6qkorcPm3LnaqhZ+
    -AQAmbGFib3JpcyBuaXNpIHV0IGFsaXF1aXAgZXggZWEgY29tbW9kbyAKoADlAL0A
    -MZvKGcVU7LZU57F9xFeebImtSm0W2DwFlBAWmTgho7nFgP/87tTVP92M1z2PduyI
    -qjKrZdQ47/f5ir/3+KVW123XP4ULnj/iR2giCAU1uEFy+du+t46Gv0NLjg1DL0Fp
    -32EMxOg3CErewnYWuEhOnrlTUB8zg+gpoGfIZjp/IhJi+0fkvPRRDxWISdjKCyWL
    -Xuja/TjAzkxzG//Qm+hMtxP4N5ni2pwvteq4pY3qV4KbJcr79ogKm99BA24AAAAA
    -sgdE6RczS4QAAaoDyQMAAFCDcTWxxGf7AgAAAAAEWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-1.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-1.xz.base64
    deleted file mode 100644
    index 2b8aba85e..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-1.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-stream_flags-1.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo368qE5CUAQAAAAACWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-2.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-2.xz.base64
    deleted file mode 100644
    index f45e455ae..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-2.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-stream_flags-2.xz
    -/Td6WFoAAAFpIt52AgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-3.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-3.xz.base64
    deleted file mode 100644
    index c1bb5b65d..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-stream_flags-3.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-stream_flags-3.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpgNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-vli-1.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-vli-1.xz.base64
    deleted file mode 100644
    index 4c855e274..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-vli-1.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-vli-1.xz
    -/Td6WFoAAAFpIt42A4CNACEBCAAAAAAAoEipFwEADEhlbGxvCldvcmxkIQoAAAAA
    -Q6OiFQABJQ1xGcS2kEKZDQEAAAAAAVla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-1-vli-2.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-1-vli-2.xz.base64
    deleted file mode 100644
    index f32b364c7..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-1-vli-2.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-1-vli-2.xz
    -/Td6WFoAAAFpIt42BICNgICAgICAgIABIQEIANJk8FwBAAxIZWxsbwpXb3JsZCEK
    -AAAAAEOjohUAASkNfVZxGpBCmQ0BAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-2-compressed_data_padding.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-2-compressed_data_padding.xz.base64
    deleted file mode 100644
    index b0c3f57b5..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-2-compressed_data_padding.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-2-compressed_data_padding.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAAABFjWWMQIAIQEIAAAA
    -2A8jEwEABldvcmxkIQoAAN3RylMAAhoGGwcAAAbc510+MA2LAgAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-2-index-1.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-2-index-1.xz.base64
    deleted file mode 100644
    index 14b14227f..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-2-index-1.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-2-index-1.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAAAAFjWWMQIAIQEIAAAA
    -2A8jEwEABldvcmxkIQoAAN3RylMAAhsGGgcAAMZoBy4+MA2LAgAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-2-index-2.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-2-index-2.xz.base64
    deleted file mode 100644
    index 1c3a3f5a4..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-2-index-2.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-2-index-2.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAAAAFjWWMQIAIQEIAAAA
    -2A8jEwEABldvcmxkIQoAAN3RylMAAhoNGwAAAJL7eC8+MA2LAgAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-2-index-3.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-2-index-3.xz.base64
    deleted file mode 100644
    index 0dd73be47..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-2-index-3.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-2-index-3.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAAAAFjWWMQIAIQEIAAAA
    -2A8jEwEABldvcmxkIQoAAN3RylMAAhoGGwcAAZDs4Co+MA2LAgAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-2-index-4.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-2-index-4.xz.base64
    deleted file mode 100644
    index 8b006b7a8..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-2-index-4.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-2-index-4.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAAAAFjWWMQIAIQEIAAAA
    -2A8jEwEABldvcmxkIQoAAN3RylMAAhoGGwcAAAbc51w+MA2LAgAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/bad-2-index-5.xz.base64 b/external/public-domain/xz/dist/tests/files/bad-2-index-5.xz.base64
    deleted file mode 100644
    index f1103ca57..000000000
    --- a/external/public-domain/xz/dist/tests/files/bad-2-index-5.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/bad-2-index-5.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAAAAFjWWMQIAIQEIAAAA
    -2A8jEwEABldvcmxkIQoAAN3RylMAAjUGAAcAAHu7BSw+MA2LAgAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-0-empty.xz.base64 b/external/public-domain/xz/dist/tests/files/good-0-empty.xz.base64
    deleted file mode 100644
    index bb41b4398..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-0-empty.xz.base64
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -begin-base64 644 tests/files/good-0-empty.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-0cat-empty.xz.base64 b/external/public-domain/xz/dist/tests/files/good-0cat-empty.xz.base64
    deleted file mode 100644
    index f84a499e8..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-0cat-empty.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-0cat-empty.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVr9N3pYWgAAAWki3jYAAAAA
    -HN9EIZBCmQ0BAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-0catpad-empty.xz.base64 b/external/public-domain/xz/dist/tests/files/good-0catpad-empty.xz.base64
    deleted file mode 100644
    index 3818ec46e..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-0catpad-empty.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-0catpad-empty.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVoAAAAA/Td6WFoAAAFpIt42
    -AAAAABzfRCGQQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-0pad-empty.xz.base64 b/external/public-domain/xz/dist/tests/files/good-0pad-empty.xz.base64
    deleted file mode 100644
    index 9a2537d9e..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-0pad-empty.xz.base64
    +++ /dev/null
    @@ -1,3 +0,0 @@
    -begin-base64 644 tests/files/good-0pad-empty.xz
    -/Td6WFoAAAFpIt42AAAAABzfRCGQQpkNAQAAAAABWVoAAAAA
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-3delta-lzma2.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-3delta-lzma2.xz.base64
    deleted file mode 100644
    index dc387400f..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-3delta-lzma2.xz.base64
    +++ /dev/null
    @@ -1,13 +0,0 @@
    -begin-base64 644 tests/files/good-1-3delta-lzma2.xz
    -/Td6WFoAAATm1rRGBAMDAQADAQEDAQIhAQgAALwVZcYBAchMI7eE4glxT/q6ofdR
    -YwisrvJYQg1m7qgBzWAuiFjXbts9JgAF8fuvNGcXwJ8/+fwNDgOk5q9psWKeR5dD
    -wy9Ho6P1BFrAmz0BzFs6+rPCTJ1PV/27r1P/Bv/1p1FepJxjtLRi90egUG6v4wtS
    -w6c3wFRJAbm0/ztfBK+7KMz/hGRxvjA/1VswqWF/pidTtb8AUz37urNeu/mBSbt0
    -qaFO/bymTPG/VGbvpK1RIOMP7gwCpGM7/6jHVgKv3bFQwWf3S++0WkcGt1+jTarj
    -F2W7qDAGtVJgp/TxFxX5Qa23OhW46p9mx1HRYRntCLz/W3Hxb3pnjgWmVZpx/pyi
    -BF1g+6e28k5RvgfqUMKnSPse+O4R/Qae6bVmdJ4sVL+3VOIRCbZWMAmp0P4sXgyq
    -WZZnBam7OLBGYA+srjfATGWuiFy/vELhe8E1SvW+oxZiNAKrtVsDA5/sf4bRZt88
    -F+wKuEo8FLpflzgKwbxP8BGuNlEKt5pMMfD8p+e4WMT5OrX8p65aFgeo4JZfuGml
    -nVW2+wdLtJoHbkvoUxad/rG6UvK/751ewlboXfsEoltT/beqW7E2VgvBV4tRuwUK
    -SVT5jRfNuUHdvAQ0AAAAALIHROkXM0uEAAHpA8kDAACS+728scRn+wIAAAAABFla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-block_header-1.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-block_header-1.xz.base64
    deleted file mode 100644
    index 79b1ae8c9..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-block_header-1.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-1-block_header-1.xz
    -/Td6WFoAAAFpIt42A8ARDSEBCAAAAAAAf9456wEADEhlbGxvCldvcmxkIQoAAAAA
    -Q6OiFQABJQ1xGcS2kEKZDQEAAAAAAVla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-block_header-2.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-block_header-2.xz.base64
    deleted file mode 100644
    index b9f01b2ee..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-block_header-2.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-1-block_header-2.xz
    -/Td6WFoAAAFpIt42AkARIQEIAAA6TIjhAQAMSGVsbG8KV29ybGQhCgAAAABDo6IV
    -AAEhDXXcqNKQQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-block_header-3.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-block_header-3.xz.base64
    deleted file mode 100644
    index bfd93e85f..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-block_header-3.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-1-block_header-3.xz
    -/Td6WFoAAAFpIt42AoANIQEIAABREYFZAQAMSGVsbG8KV29ybGQhCgAAAABDo6IV
    -AAEhDXXcqNKQQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-check-crc32.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-check-crc32.xz.base64
    deleted file mode 100644
    index 1e8706a0d..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-check-crc32.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-1-check-crc32.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-check-crc64.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-check-crc64.xz.base64
    deleted file mode 100644
    index 0466d9960..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-check-crc64.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-1-check-crc64.xz
    -/Td6WFoAAATm1rRGAgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgDvLogR
    -nT+WygABKA08Z2oDH7bzfQEAAAAABFla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-check-none.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-check-none.xz.base64
    deleted file mode 100644
    index 4d47b836c..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-check-none.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-1-check-none.xz
    -/Td6WFoAAAD/EtlBAgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgAAASAN
    -NO2zywZynnoBAAAAAABZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-check-sha256.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-check-sha256.xz.base64
    deleted file mode 100644
    index 6e11dbe4c..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-check-sha256.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-1-check-sha256.xz
    -/Td6WFoAAArh+wyhAgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgCOWTXn
    -4TNozZaI/o9IoJVSk2dqAhViWCx+hI2v4T+wRgABQA2Thk6uGJtLmgEAAAAAClla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-delta-lzma2.tiff.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-delta-lzma2.tiff.xz.base64
    deleted file mode 100644
    index 7c19731de..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-delta-lzma2.tiff.xz.base64
    +++ /dev/null
    @@ -1,1072 +0,0 @@
    -begin-base64 644 tests/files/good-1-delta-lzma2.tiff.xz
    -/Td6WFoAAAFpIt42AgEDAQIhARDHTa6t7i1xyDUDACThoCNJd1LlYEtQA4VddyAl
    -vM3EVJn9zArxk7GUge/MNNAv1LehYI7YzbpCkEkz4CJJvaJOy08aSItD2uZhP0xa
    -NkPipYMuDTdyIsrVeZJhWuW4FuQG6oxC7gaVRT7ZLWA9KgscGcEdCHcvKiIa4Wyw
    -8qX6ODXAVyz/waylxpZ2qvrtHvTWtL2yP18H7Z5WV9eSDDx6wC0Q/NXl4M3osMbX
    -Hh4M1yqRNcqHcEQJZwGxAySvSL6lZsDLnlTV12fwLjgELqlkH5dBIYm65E+/o81I
    -YukPR7R4EcGK9y+q66WmyGyZwn2DfCY8sb8duOfqs+vmtqSkNkp1l7tx2IoMt/dV
    -hzK63TXhda7j9g96mgpwv2bkRSTtpfs6UgblHkIh+Hwr/L7eBNpJ16yYYQnd+Vyu
    -UQW9rQXmrOu3mZDEQjrgMH2RvpJFsQBMKbhx7rOSY1rHl1zIfkZI1Rx11OrHPVOd
    -rwkWVbFWKiamz/KlCi/OYSg4l9CWwF81qJIGbxFVH6SYiEnLXa6zU/WAQwdrBUvF
    -+rdQBD+JCmbfEkS8Q2QZr/3AtemcB6ZM58VaXQuPnDRNipJ5v+xf6QgJ/KZe4l3L
    -rtfy1wPDtBlPKvfuoLXZMjiuAritmtejL3Jd05ls4/GQnuYTFLX2pQrJC74VFBzP
    -DOceh5a7BezLSoUAjXz40FifU3UluK8M+PXp4hEu2gQLsXpkUbXQPCtZ1lIW3DCM
    -F5Mw1lGg2tdgrpye/1lClLzU6cSs7Ab0vyjXbwVap9OQadOZpeNavFy/3n5eoVpy
    -6CMVM5ILr5oaFQYDaBRaxoXFZQm0gR+0lO4V0aASViQl+mhs6Jf7abRtKdnoypnV
    -YkYZjf8g67D36cd+/j2n2D+VQBdPQDAPMQIFezC52Ewm8ICrKdXUflpZr61TtDZt
    -aqbFPOdaejqc8DuQ1J1EOLVR7cHAgO37hvgW84CF/CRsIO/1o0n3XOMF68/ld1Al
    -ZDBPGT/A+V1FUqzW73IRwZTROVFBO9suT9y/NUlZ3KemIMj0y6FQbofnOOpoTsjL
    -UKt4McBIlbAnA7DSuvP8wtmdGfhmdbYCN/Ux4oRvtt1hLJCx114fq6OcIW9LQOdb
    -2qTUWV7K2Xuq/Yp0h2sXrUyBeHVntvDifB+LfqkNb2xwBaGOiV6GAXf5A4+/30QK
    -dFrFv4s/B+7iliGAKKB6CmHZ/jl6QoCBuWH8Q2nzYA+k1iX219R0kQtdjSPuRZPe
    -hGAyg71yJO2jAy/NZgxuaIfS1fAENPBgH1lDU6JJxXYdn9RNp5V/1CujC/279ymf
    -lHHFqy4Q9EeD2VHvVoOqM+dY2mMK+6qlrEIb05DmEsdztu8iK6mJh/PQJh4M6wZY
    -s3lysS6PJlxFPcPJmMP8dmm+vBibqsRkogyPqDmw1uMm8evSl9ka7R9MCX0x6Mm0
    -No7KN2aX2t2Q/GNxjUuCcEO0drhIxoK1b6zIvpGcD85O7at4N6f8UdyXEiQlHq9g
    -B6iRT/PKEDs4df3LWB/HJlaUYa6JW2diMD0YXHg2i/UXIGx73fclQc4kUT9nhBwQ
    -lKPJhwO7L3cKcjtDw9h0ZpisdgjWMrlir51w3IauMcKpy+zkHfiupYb0RkSfRct/
    -/Bfzi+lDjp3/GEZ0kHnCQOWNCEu41+hrBEYpN5LopWyuskV3qEW3uDeGNIFV7aG3
    -cXyw5VfRXSv8XApTgoFW9NB3KK8UwXlKxIBeoZOFfn4wg6wR7cNim8EAm47o7ozG
    -X1vTdnAxcu2xg+khk7MweeNDQqEdWLjPRTXwFcahl+WMGuMQhSXF2Au+57taxhBd
    -PNDl5zoYFslkSROO60IPKfb0qdIJbBCj9q/DyTZ1cnnk8vGUxleBDRx+sCnPP6j8
    -xQFRlBFMsCsLnFTSlxovNBX22Y1qZB9tbaQ5ufU0qntZg2vgCzgjulciAno3/05m
    -zc/DeqgnchWjoSxCjOgiMNh2t2anTOkkkK3jzoheCXyBzipXlVnEuHFWDUXx6Ar8
    -qW07mvFlurdCOfy+mkwvAYh+hOZo37arnlMCq6zKx5gnnIazVzWo6TLhvJglCqJU
    -d3yoy4xP/bzWFdOwBSFvyQLeC97wyHQHGESXlO1Oyhh1wKfFNwJ+1g1FVL1BEQKj
    -4+NRZvkRQPPwdte4NnUMJPbZPZ715XMLAyAShkGbzJOotbzsZUuYcOmzKDBxZA5B
    -yh+BMfrTPWvXIajcfKQQptraNNYFx07WihTweiQtTpor193/WWrcyfpa2CQiFbUK
    -Hd4irKiPPP8iAWTzsfOHho/kIaZZ9efwxA09x3Kenlu9Bx6n+pReOslrMXRCUgtu
    -EWj23D2NADKG/vzpT50RRsRsisMGhoJcySZMHJnpMg2vbCyBJo9YIEYoiVu14559
    -zy7RNI6yTk8aROoSqUPR/CHg6VvownxC6DjR7vPHD7eGOFga0WYbURaZ6TfQgFT0
    -bQLvzQK0oI6LOUuv/ajLZ+atnJY/WIPDDaKMGDKRj6C+XyZBEE7ayO1VrrPnBBrh
    -OmLl9P9UbROZxWFAK9N59mnfndqFUgN9XhKe4eMoEt5abFRxmSoedCH4TtnEBI/H
    -nae7hcPkP0/IJ+e1L7TWoERTf7aSYjXXQ3YrKNcvnljD1q2dWhwXjJRVOaPV+v3E
    -SC43c7lyjlghB64krd+VU/KHb8Nv+imNk+DG1/k1AbfrMdH8edYcjjEj60pmKThj
    -xsn/wdI7aLuW0pC2PcdFF3opKbLAwIQ6QTGheip9IeKSKGN5Q/7B0HYj7S+4vx4H
    -uFQHwJaX0qXeOnlCkmZjMmgv/W5LXt2l/Tkgf8jf2HogrM9Vmimyk6M9FM5QhicD
    -n1MyycqukrT9d+hgtM+Y+UgpoWuLJJNu8M/ZD+1fUZl2t/SyFxG/gIML7h0lyufO
    -FXf2MAU3O5uw9SLMwtlYZfP6SuPjb4I6A4tnvT6teecMAZ2WaN0zwfLjzyWvVjVa
    -eM4ldjekwzhM/6n7R7eA+/AGGhKuViRCPB3eFveTqSpZA+y0ZZRVvCvzsebkEC8M
    -zCKpbjYboRRC3Z3pRRtM5adVGzk3aMV2Bvq1hVIWTh0QcoIlE3XBnxVTyh6ynd1a
    -xZBIHSf01mV7hUsnwPCQXopKo+8VWguyc+IOZlZePz4JhpmRAHzGwfyj0Crz+S1+
    -8XkLos7jQvbewuxoVPQFZxjDu28/mCTVTRvKvAi53tzAGoO1RwkX5G23dZkoVrO4
    -/69FhpJALjUVnj6GdFOpc2UXyou07rD+3RQvRpLrqbvQyQGbcIolR3jmvVdgCxlA
    -+je1cDhL+B4qcT9FBqld9omg6/mJUwKe87aB+pLq5w0+8YLnT7HLV+9vyMWvhzN9
    -G6a1ZRui5YkVGPNQ2+rGzECrGxBNYOGAOzH47uPmCk41keJ7JmIfmTzUkyTEIcS8
    -dLf3TtEY8o7fVXbYklegQTVRh3hdM+ySekIDfLRYGQRmtaL35NbTSEtm1M4V0rFD
    -RI+tqBPaq/61I/vE6kayhXzrhs6q3pLKY/2zTHBbUActl2GPK2XubFTjpzNaL5RH
    -FZ8VXsMhfiMwQ6fxLPrq11prCsXfTSaO3SZneEMB4AxMeK0pPRnoqPPLo/iAfdcQ
    -BM6QvUmEIhhyHuZeM/A2hoB3phBKSgAaJYU6S6T1PWbctNNiz63eA3NWGdxMpz4h
    -2TgFyu5XFebMe5mdioVvhftlQn0PT6PMFDlfA+7NfQR2VsOJoVhx9Lx3ejmgnx/e
    -/QRFzSGAyPQCJ1/7b69ZAiFSezbzGea0gXZHAE82Zern1VkwoMZysNbIVqsruDtn
    -RYhudsP1N8XOg+Akh24vRA3IzxG3DruaDPXd2/VIge6QGjGoTZSqP6o4b2aiC5mN
    -bV6MjMD76JGVpp8uBTO9NuBSFDcBS8/lkBhMjLMce8XwCeR4tkdzONHaqRkSxkKI
    -kR9z4kPhQCY438iZZCel7ldDGWNFvC4qB1PDDSvt7Y763MkaNBOoDSdLMxbD8hHx
    -Q3DQhfvB1YQzcNGuYQgARkBp0eJCHIZ9G+11L2nJSt2otmEFg1/NmeHA8fWIyu4K
    -DIXqBu72NM3/eDDCkT5ygL7OVAmoyGnq0Znxp3SBW36XIXBQWTh6oZvK6HX25mh1
    -D/HbIM0Ixxo+iKJ1uvSyV564Vm5+X6HAMI4BUI1d+ZuOdSmCYt/hEV6udLgJ4F5c
    -kAz+vjbEXBXjodCoXR3xWZUxSbodG5oGY7A/6dWFiYbSiXxewZkIsjbF2KeLsZzA
    -I4EUneS9GFFYKxtSmgkGXWkg8ZAU3SKTrf3SBKD2ld1G6a9J4wtprroU4kPeuc9V
    -vvPXVSOnySVBgIjokxj3ZeleXAY2o1nIH4MlFng632iVXY3ZHSOh79xV2Lv0S7zl
    -ia2p13X5Ggco8hrhFy0MdK9dtZDw0wEj+r2Nt1mrPDEmBiBQVbCsTohwxYAbigIK
    -b8msV0VMJGqkCg0k2Q+ac3DV+000VdA+yJlSIcJ7PmLMb0j2coGHocsXNC2JTeRw
    -mnwFyM8vvlth4somx53IgUVWQ1JPIgZGT7mnfDFJHWlBmTfH4jwslT7I2rSfCvn+
    -Wz432HmHUHltpYHdFuEMj/Rf6CyrbMjqHgVsc5rsA0BUK+1u0VohSg0pzBgc4qfK
    -PO5lgd6Yx7ZUeddP98TWo60ufJJztgp9mB/yXeHAyGOClFcJodSFMRfxZue5zQ5Z
    -bb90UdePYLtSpUGbiWIzcBZlGZWcZOyoGyZsPaCGpdc3vO04RabMVn5hetDO5ggt
    -RQaUWtwU8OcDaMxMmrDlH6gX5yXunT/sNnS+l4UDy9f11dJy9lg71IgVzGDMB1fM
    -1qxwiUpJeKOXUyxDa7U2lFdmIKhOrQF6oSEnGNVD0DnfQsxrDab5koQMSR6zXcm1
    -SJ3I1CYpsiY8cge+fWhHpH2Y7gLQ3KTBUdTIvnxzTOnBuwpkwgH+ViPQVWS2ovTl
    -qIU/r18Kge02KNe1RcCVMOzkWLOUmK/86FHO3uiYt59nFV3LkAFgpHER3ZcylGyV
    -Mos+ZUN4R8beMJ00+zURBhKsv2BEClXTtxHQEM0HFcHuvczPcfB20hEyCcAGpx2C
    -oV7PJxkPxfQWO0sMrZe8I8C7LRopQ0H4LsunY2Q8yuqtyl8ZPn21yRyXarybfUa2
    -/I1pEPdfLmjrh/dnPnH0L2JQDgLd0IWRdSEYnXJALGCVsDwjfciDocbKgKz4xBnk
    -NqxyiCol7DGURpeeseENbvLOtgbynB12fRBLwbFgrIZckAnOyXvluhLhELT2FzkW
    -xZdjn+U+2mFErJxxl1fkADNHWnMlzHEgXY8RzEZd0YnabbYhBrkGjdVUX7Q64o7+
    -39rjuzKvE+bHSyEY3GwDmyw6P54BAUmFhln0Fsg655xeU4kD0NFTq+VT7tBVmYJx
    -97z1bTOGOUXXdAEsOeLR6l1g4aPI9JXhLH84L5if4bFfw8uxLC7ibnRUYXcOvgsh
    -XoL1/Xd/NHQomxUwseO47nmj8PU2Oofq6y2OFqY6v9S5R6PbCY+q2EWZEUA9TljW
    -trT3I4YIyQ8cvP6dnXUICyPsO1q30rGqURzlyr++XfHTpbn5BlKWwZQ2jq+Xu6md
    -ScHPuI3lKnUx7Db5GUDph6T5/dNBA4ahSXBmo2auLQ8K4ncZZViF7LcLglThJJ/O
    -y9GlJmgXF4V5Q6lv1iRhq2mOBgKhIb50mtW19oddhCTXf+jUNcssyHZUpsQ/nCaG
    -cyk/m+ZJY0SzT2JObBCLhGdEJyclZacrOtNxzNRNdLhND5R6w0keJc16BUNfxc6L
    -Hv+YmokIzDVt1hMgBVToO0ylsexfWSmEGDue5SuxAu9edHt53kcaicebO0yp4fug
    -gCNleZECi1JiwF+MVcn5/fwYX5tP4eU303Qb6uOu99hxbSmAvDDnU+V3r/N1NRkb
    -CrpkDCHpPYWmBFg1TJNYmWzkZ5PdKiVpl5R4boEGInCrCwOF8U4g1DCeiDEeiO5E
    -kzdwbQCILWOeqrQumTUfLda9n+n03gjrb49EEUHM7r5aTpiOTG8HQIZYJcB1fxen
    -q6pdOjewe+MlcNTE2Kbh+yvoZIa1LhzJ9NrMZ5WSPxJhsZDLFL4bNLtP8Ma3WbN8
    -dWqd8MiXqNSMYoqUTudk1Vw38A7rGFFTdewqQ505EBlTWyLofDazX9clx+mcZkjE
    -ZsRgpEuIBk5i1/mn3VFMkpzWeKKBvT84JDqGnu+ZcQv/16sSQRnKfqQiKQUd6hNK
    -/1VBEF+d+86yktKHfz04CFfaom+QTGgI/SeQUn/Q1jNME7I4aAuz1Xl89z2XRe6+
    -RJ6lJ0xg9ONH9Vnisjf1GvzsT5qd3llMiTrx6vnELhGl/ndwS0XItEFKgN5KhiqC
    -XhG5YpGbZnuw7m4n6OSRgOyZxsoViRLPfIyohgJ6cgW50/xSk6JqFQOXa4huqWQl
    -ev/rDYsxhKqyUivfGEAVCTHGfgGlIxFpmvTt7Z7P8W7o5nwGLc1JzR7epvxF6P1t
    -/G+p3c6u3d3SB14c9NZ+2o1U8wNo0XQie2qOQLZoV/6h0qtYgmHsXIKo9evjyNRa
    -RS4OsJ7UlnXFdC2sv5g58EGKQi5wgjhl/PYek7JvXhlDzUSb6PK3vTMNhDn9pnK2
    -LRdKdBC8fB4dEqQTHRZB75AQl2g4YeS2NA3VxCLiOYrA4Gz3jS4IlT0/lWKZFza0
    -5SDWQfqTjubMg21+Gm+U24bBoQJA4znVnbHUZmUISgzMLrua0dPGIedk6/DTn5Qt
    -3MI83U5d3YCVv9m4bb87yxgaq8HmcZpp81rY6MF7X3J+QobgEwSUZvSJX0JC1dCq
    -zUkFPKd47GAjEGbi0hdkKFSX8D5ccp77RvR1epq2ROVtW0tuIY7w05NIcpNRkeFV
    -z8fHsgAyMBuWulVvlr2VyUGl+L/tlLpuxQq43e+FDVs7HX3d5bP/oK/aRgnjLIce
    -8Oq0wFl56RFLR5Z8Eo3E8DTTrdWpPvQuQCStdrZBDqnnJsc9HRYgSgbjAIFFHGJG
    -fnZOPx05lQ3YnTEEZMrLOS/IF3XghVIcq9pBzlBAMbZ57jgHvgCwXRSPLiYbZXPv
    -7l7s39L6C8CwI97KBwXoYLEaJHruz1Ewf2DcEPwhu3q0iBc4fMx4h3XD+ErwpfEo
    -dhqkZdSqmaPv7I2joWKjwhO0EHgiN966BRLGlWvQqAa+STI678hMHf5RwU5OGvaa
    -imR7OjOTCEJxC6yWEnQEYY0UHPYuuJNhkgMqLD3qY2hgv+88P7ituDaGu74iDsy1
    -OKUnrF+Jo3BrGCSnmvrREhF1E4XQrWUKGOzqZLzeL0SGx5c5QG7On35iWT8r+o2k
    -wxbkkgpOf/8cMPofAoSRbQ/SjTFaHA1U5890X0NkDJ4lXyE5RRjEaTM1Bz9fJxBL
    -YNAtURKcyGxzn1cFCP8EM+EjfDJY7X1tjWD/WZQfHEO4WR8J0/9ZtJ0HeaTQyAy7
    -zzyDA0FNnOiJVhxn8oTtiaHv9hvJuj6uAwEAc6OqSlhPgDKmjAhogyjGTPuTIajU
    -6OFc7hBSERPUD51YQODe2QK551588+87xypAzaVv8ddeMK2Wwmw5ZcOfQTBU+ajC
    -vYreqZG7o6yLXJyq99vPdqjcpg8t3peqKfE2TJq5W7winDga7pZrxeidLpk3YlYV
    -MnlSUIrIT7uqQrLmnXNrH+/Y85MdEIuIrXTIPKpggrgGJNCQHvEdeqA/9SlaUI5P
    -slgwCMLIWobsv2VwCYMSPynaHW5CKmwKZsq9TUyOOwNLr9NA1YodPDzGs1v/Dh5Q
    -/7J1MbEqN1jtBueOItUlNAbs6pgYYsPoUQeM1GSlv/ZY+fnaLEH1mGIEFyXuR0yq
    -lB8Z7lLmjHBQdEtVOW7Rnyceo1FOVvlPPHDtvhtHPSviFXGdQcmkEuRUp3ZQpBOE
    -7Dv36j2uLRA26I42TyXdDir2JApOFKvrRalkUD707n1osxx173FDZlYy1w2wqZME
    -XwxctOSatIvPAoK7XgG97k9wlJYGyFkJowQJAwuNEm0OzdTqvyaf4p8kHssLOzl/
    -WHmdbsKKwr66GfW5I5YH1fDZXuxRiqWKsVqxnsnFobP3WKNoL39s9JvmDXlE73yo
    -BN1kLEkiZcJjkgpzKiUWh7da7dGZlYnQHTYDx8w59B3UEgO9p5jkknFQgMpHqoyI
    -DUWrMQml4BLXS4H//o/UP8chZmI5V/h2YDIjWKwP3EIjarTbk7rZ+2+WXZyOoSOW
    -Bi1/87OdavJCZ4EI3KYxI7OMteZD7wDaG/UNwcuFxP95xGKHs9Q/WiNHn7Kra/m4
    -xqI1CfStr5DctjzrHrhBf2KdnCp1GSwK771P8mK5MdzMKSRH7JC80zB59BUoQsnD
    -wCOBe9m/uLi8g/Bx2L5N0Teujwwc84U33SlRdZvC9DPd6VoOAcIBYIwRoJQvyzQw
    -bNynDOpJxm0udaEv14mXrQlruhw1RQzb0WQ97Jf/tvrzKJRmt1xvGIQWLym00PM1
    -r4RyLgmtAe8Bruk1nP92h6WYewABtyCwCnW7SefnWgMvwb2djDtBgX5rznGLDj6H
    -4wnf+IcP51AFnNA/169mW5Vy/1FKqalHnERGz3bTne/dCHhfdh02G9VEzQg+kdc4
    -4nc50vIvtXmeJwxEDHB6V4fTFDJdGjzqXJFWaApPogHS3ZLH90fDe0qGZuAaEFbm
    -cbBpZggqx/GVs+4lEyti0G/AoDki6zaCaIfd6x3mjf3NEfOaioXsYRlVjCRhN8TY
    -1hXW+bvvhciv3nuWtcRtQG4zGKwS8vRWoZ08iy88G1vbUCXRtI9LmtaFaqrIWP+D
    -RVny5SkSdKxpj+/44O4bFRV/o1nW+9WC78AhVFKaC9vRWyo0pM4jvc1xr0NgW42A
    -gqB5j6U51AL5+RSRe9pQnMPXTXE1e0cOgh0L+d1qD9kpNUko+hwA6fzxnkllncXt
    -x5BXdBkkYqWOBU6IbyGWdLVfmpvY/g0DoR6rmK1FlW4+LijSFvIuY+vdzbpwNouP
    -80YpwJq88xvuzYbFB+aecBlPH97KpuHjxyRn8MHR0b8PDxF6BSnCJzAlQxY9emfb
    -MHlk1CXoxKat0srDSGfVRcJqCZoimXgbORI1ExXo6YRydRKUJ2Hb9vQHQYuiClqI
    -oJYZmCoXHdBC3BigJKPJxcXdR47qkMgdKIez8HG+zKvEQloBwusiePBDpvurmr3C
    -GEitc07YK5n6Vji2zmIXrwjC964oR7/wqSnt5IFPL128XgQyuXluiU7qkF2O9KTv
    -fBKmZmaAH65Uwxyn6+6PWjx2gzlyORzUkv1SPxGshzQDxqkrH07RhDf4O2C5tX2y
    -oGUueabtd3utdzUw45zBWVlFlQsyvjtHxK5r7OTOzmhYwVOrZtbTAhD8sMljBDhq
    -+jP+TwgNyWF0t9vZuteWXwChQt0yXZzCHxKDWrUKKCuDV5Y40HB1KoKnMrxWiuaF
    -9q4MGtTAY4WUhVLS1eMiYCCVPrfj0E8bd6NMsm68tFq9IhBXU6kOSDHkfbHfvBkU
    -NnvDuTy03hWCiwwd+D6VXETXG4wcWW8a3izQ2C9FQF6AUtYT120sIMOl8nrZJj55
    -Y9z/LziIkTHyBLmy/04HbkNOsygqmJ0jkCCfUYFhNm5lHyYWk8rRcD+xAOA2V8np
    -ELfEuhHa0EfGCJWQLu9BDXvXSJUiaD4M9OufQDpD52HSKF4ofJttb7Pf5qNaXB4M
    -vRY9/mH8TWLThqA3wfBTWly73zo5D/RWYYuPL1eWX/4I0qe21Q+PcNv8XV5tHAtM
    -g5FVBquwRfi2Qo406dhzlhHisXn895zQU0mNaIlfXf2UMviaHsNUED7KaOEVJRh2
    -/Ph4OKyeMrcbudpXtfiGm1gD7NEfOfnlhkwGkl9H0lrDnuEqH4HDm5nuP6FLC4hx
    -3Eku1gV75no71OIWmsUfJb1vQ0T6ZPuPWSWGNdYFenBjNa8siZ63u/8X53BZqqc/
    -K3iRL0rR8CauobuQmE3TGEWkW9497DCSej0dJYHPyi9uhx9JWLByIgHCZyiNNftR
    -ZgBws67ZcXXDnx5aE2Tw5HtS0e3VEczo0DFrUSWqZUENzwz8RLzbOyHt02SloMil
    -FRLr6dIaUjK4j+H2Ou0QFpqQdVVQUh0uu4/72OUVcENzDk11Ewuhay2mDWADX4/a
    -pn+SYTJ3dBOBmG6lXWZYPqsQduX+J7annYLt485vXqkjN/3hq0L+HdO4c4qoePp8
    -RCETk5UoGqRtyEOYUp9wNiAMXdGk7WLJgkd71q+RDSaxhu1yhJzAtBGgD9QoTQfs
    -xAS1GbOStGMWMtDqEHDVbmyIk65CCiFvolgmDjJvPipmduMB7982H3RNlXmKmOnY
    -+Kce41j+FmJuygKmZsuWcOc1axrWrohQyXF1ejwqzDdvJBcV2VngPoFphdJ7Fahj
    -qVVJIxENIWCEUpUnSE+NiXzEtzAXjxjwQScmM94NOSk9UYGJqQGScQBBFX2fQV27
    -4T9+1AWieHnNLysQjpDACM5fLUoSiNwYv1corhhHoJJOpHZxFp911s08x3Br6Qog
    -PeE/PbkZuLCN8o2rQUXZmj5D/gR43++W5VvD7MBdjFSD9AvBcia2JWnF3IPDxxUb
    -s1Hn3jI6lHF26dcVL68GUKPbiPxzvspI2aF4oYgQSEW1dEn5qARzTVTDA74dvpA/
    -CSqqTSQBF0/dxL0JOQjwgvCYiL+Y+W1iS+LFK5Y08MPWgrk12wNGeAM45K+XxBVC
    -0m0tJC3vNiyMfppf0Q1FYBBpzZNC5UxL+qSKb9jbfiMWCkUtBfygna02NmQH0Mvb
    -J4/XFTikoh7EMHX2izOTB+ZeM/ND877BlpeNUV/qUcnoca2VbEJCe5Bs9qlPlgE4
    -v0Ae+ya9faLk2TxOFn6w7VhUH+l4VAeYSBwylTZi785yuEVOGS89Q/tqGfA2i+5B
    -HOwrQ3vtcPjVd380mvdOuc7qVItUShMig/MCwFZFl4uSXssB3JC1M9QXzh25H7cM
    -/TBWIeFvDjvlC0jbFd4iWDBFrFHWPPntJ2l7WfrYAMPY9CJxlkv3gqooGTZFp630
    -FFR/MV7dTwoFavd5DEP2/9VC3VkxQ32HYrINIlaRoD3wyeZeP6Q9s4jNJ4gPm8hn
    -ZcX0KADDM+hIMNGiZTfNBHhXGjhcBhHAHBfkJDTRbf820hFveNQ1HbtKaQBj4PqY
    -pAkVBhPVZ+0yDoZHEvYbDK/M0ujaTZDjXkPi9fgylWKjVQoIMP1oAUnqYVApk2Vr
    -8OKp9XZHPzcNuQJk3DR6sfCZ4uP0ZZszSCKadPJLobXkdpaNUtYQxbFLpYylh0eL
    -j+Pv2BNyaocB9pw6//DFaAUJJCYsj3hMGx9iqU15uObfpAqrepAegbuTFwA/wU/S
    -y8dft0A/o+wU5/IPk/K9arCpDAitrzzf4RrttGfa/HISgSsw6m9902RatD2UXL4a
    -a6xjhEOVSSXOMMj8gEReZPmpmkZlFU+5LEV0viLtm4OQiZ34ZVGhsSrB9ADfmTf3
    -+zG8T+NJI6+6ZLh+FBWylIeqXCJf2myf0jTdsZXlyabI4ZaLB4FzuMmGZqFDXl3o
    -vJB7BF3zJ1ZciE+bROM/kpWYkq+Sk7GGQkV0ROxwgU4bEKX+/fpPs/hCNdnfp8+I
    -UdP3fFVivlFeSTvTVb940qgvNsJRN5WCE/Tc3n/OeBqduJu0LyifvxZSU/FwfAZb
    -h5HG+OJv0xa8V4i2p27ECAlQ7BF1tzM0U15POZxdCLLScTT8JRcuY35+B1qYAmEi
    -xKBNFemX7vwlsPKKE+yN7bHSk/oNZRaU8drk8uBEPXGADOPJ+FV+wgsTH7C+mQZv
    -hHe4LL54MbaDWxWV/I5uSZu/bgXYHF+JOCG9DoRYDZ3hiUG6G6YSu1qxevdsSByv
    -PCgOHmVtL7LRwRnBMxQvoAgA5LKlK+cWGHqMRXw2suYm2l9LH9QU6b5jeGxZMCgv
    -aDfjP43AItddbiSifWu4kbDpPwQ0Mnune4SJ6vfXMLeUNuSceHutqhWPIVDyCMjV
    -BsLGo724EtWYGC4Xr68UDXwcZG56CH0NtdfONM8GheI+dGrJaCQXBlaRXdJYz5E3
    -FSmwQKkIgNLjxpVFf/14bmOW7Y6YrsR4dOg/EhaFPnSTbHgNZiBwXO/ho2lR1jsN
    -UGvc5riNRNIzIbsm4cWwSWow5lwkTOqNHSIuQOd3y/UH0l1KQQF6RVrkmvJYHos2
    -IFMAW0+XC/UYmkA9ggM1BAgyfNYJ1DIFI/YsiSlpap5oF31dSxNWhyAtShvRcWju
    -rl5m9uZous5pzgN5Wrx6qm0UFJApd0IsgLGrk3GTzxMsJ7AzsqMnLjCa3SaLv+pv
    -oU8BfraeLJXHpvrHkkH1N+ZNmw4Go0n6VnVCo7Rm/nCxx5n9zTItVLNO/m3SCtgL
    -nsarh3QomvR6iw0zdRGoTYu+CJDo0KOH8L440UAj/uqztY0WEdrRPTMDtVvPMAbr
    -Bu6LnDBocTNycBfFtXzBXCzeqZCmPypPnfIXSoH5K9qJIYi0OqS7LSrWdBL2ipIA
    -yjsgoOUrQ3eodeuMiUPOAy9hM4DQHFy5tgvgXNVT1WBA77wjy7nbMqosoPoB+IGY
    -e/wiw/QWgaIVRmTSXUdcN35f9lkJr1IQvW6gcWwXAibnim8xkPTHUo2LszwJcSFu
    -1BKF2tMid6pMdl+O19pIQmqtGbSGJdw2j39LxelS6QrY8u2TmwK1gMr58pnPOXST
    -I8dj/aeSZAJg2O45Y8Vp2ZEdQa+VgoqiRUzUhG+m5fkH9YBegN3vys7w6iTNjIuE
    -PY0h8H8zrFEYl1bWmxc9nt8HvvYmsX22tQ7GXyrm+50qzr7BNBjbsxQLpjwI/G6W
    -W08JTQzytSQTP5Swop11gJtfgEUMNwz6DfHRFL7q0nhpjN6iMxHfzMfztLSpFrEG
    -WJ+vWCK62Xg0y1FNYZ0uhUPi4qtycsPNUWNmuWzU9DYK0ITQKfh8vOBSr/9DtJ2w
    -UChk+b0U09+abke9+/KUM5qQVYtRix/OzfKHRYq7T6uRcDopN09xJbJR8eCtwS60
    -d0juovznndfMJiLfs5/tI/zVpHcGekvTWxv/N/dyz5zWKRaHofSkD7IxWYwVczTL
    -RQHMCKSVg6MjYe7FEcLzFAEPH2U2JJaBE2t+a0Y4gWM8ZPx+2FoMFWHVPKQAVAGe
    -NkYAZuxENiVa9sgPyDtUo/mjIFD7IZ7Mo96UgUc0C5pLJhWWou2ZwzipIi+542c8
    -aMqkw+ASKMrRcvdO/D+cDNl+rTw1i9Kg7CKw68/wT6V5u+wkBBQuaWutZXBv8u7J
    -WYGGzF0T6Iv/4AE4qSqK+IycOWmO8Mnv6HSWnJu98MfjbBa9xnWZRJEDLOqIlpNl
    -I7b/Fhdi4QQXuJD/cbgbTZQdesoNpalPam4qDWyBOO4g1DgZ2mIqOD1naPTb4tpf
    -KfSyPXgibEAga0E/dgGvL8Iw4CFaoTWAY5xi4/S09pnKnNMVlWv0oBU7DmQix2EJ
    -tFUFqmUf9BYeQcfG8i/iuczGupsJ1WBfcztvWmRL0ZRyrSYdAUYElQYdlO7ofQKo
    -UzH64JO1nCeJGDOQvrs0h118RokLZ0Zyf3YuFQpb7b2NbNtE7d5q6/ewDw20GUDf
    -0uJpQ0Z0mvAisIRQp81Jir6fL55N/q8+8CcGMzgFnsJ8lu7v48kXWpY4+mZ+0kNE
    -KUi246LVtiiDE1axwlzxE+ugh1TcMBvTa9nOxRCd8YWpqFCkEupUQEtBRY02f0DF
    -7haHZ9VqYWFvOlMuRLI6u0lbWHWmaYvxIJLiznsIG3la3bksw3IUNdvFDADrDllF
    -viCC2cAHw9MiXiaQd9tw4Qpr7DFPdbgGvtiTe5HKlfHRT7weMDXJK/M0n9BSh0pK
    -eBmE92K2KaNcWdGg6R/SPn4KC+nrFTmPshvW4264QglWA3nuyR6M3jb/riH8z1LI
    -8Iva549rBqv1+7fEUyAcjaK82VG6zQ3K9T6kGCccYpFZKIEU0eFEo+/lb+oL/ZM6
    -ZCU4HZb3H0akBuMILHQy1wBr3paP/w2eMB5/M85xhK3p7Rhf55zRHqWvB7xv/Zp8
    -kXQo1QLgQRfMTRDezc1e/YEHtqATKnWCGisHyN6mwyH591Aux+bFSBue1ytJYAPo
    -Wcu89mM9FKiGkEe9m07hhiFsCM1EfPSxvDsXg862cVbuFo0Dj/fw8yFypjlIHb+s
    -ScloWMzLCakAamuVNjN+Kibj2VBtcZf7e8PMQyZQIlYBuwVhKdnDUkkSDibxl6I2
    -irG3n2jG1+qorXlZ9UmC7bb52rDMIjVnTTUCXEM7lAmVRLNwnYx8WPLKsckQaGix
    -0jSuvhEPjk6/c+gYzL2wkfyZuPqaQ3JKBAysIOdwTaPr4OPbN+tLU081eOHVd03h
    -ll9AfFQwv9UqdNISFY+C0hOOw2LLQnwu9DF7Q6NL3E6f6XG4TdFNFdbqNNc7txjW
    -xDZh1GEqOay/l+EOEvvwxSwiI6Ot41XzwcyJ9Ij4HyxiTiUTP7jZYspDtWhLyiI5
    -mN1j1I2GkxZl3a7qnxWppA+nYHEOJa/ElfAGPX0PIYrPaRdoUSOyh5FE686MZEOa
    -pJjD8TiBrPhCG8oYPm8cwAmCjn/ybOEJM/7In4waZJXbEGavrUxzMs4au71Z1S6z
    -e2CNiuQPN62/HP9619nHE5AnZcAveI+rQafNnJEpc1n7aY0jLwhcR/OPjPBHHsXR
    -Eqh1eT09vSEAeGSXzqPR3uLjH9YPQpEjEI6wfWuiMDvKV0Z6U4MWcqOthXBkjsjB
    -JqTSbQsD7DMLNFpH8z76Ip9H/AnEnSEayGxR1LWuSlV9tTdcRKoxYLLwLE2aFwyk
    -sc/g2JQVAecfZltPjldnncmrWfglZa1UE7uklbhfOuPsBgHQlDhVRobclf3NOY2O
    -lZTPkx6+9HWA0bIffJ0s9IAlFX71FesvnckxWsv4zLpOJFixFOEZbex9vc8v3IuW
    -cDPThHkVSNIoop2/+PlOyV1QgLWRyUQ78koczx+pZk5EoqwRsD6vMcMoxxRBLigU
    -KU77/U9IzvADesssJPDRDRU3Bw9nqF4M7LnWNe+w3qnAeAMOjPDwRtwf3fC9/8IW
    -c4lWoefJ8WC9iL9JWyArHlpRswN+Gavt5frUohk09GpjBH2JuL51TzF2FIYXdDQd
    -rRsUhvCqBB0uSVdhqw7HE7NLUKeUVN8F+sguEogJ6UJKdjldxSN+2HRfUmkch7KB
    -tV9zxBwmNFVVGkGxWQsgPF4Z0JBGwuyoQ2McHXF7ZBk3j0ZJkfSABw3pMSsmRPo0
    -iBNXbIZayZ0KAgRyiRzqzmoIfeyOVEJCZ3CHOHxcWEWdeIpvdkm0qSGqTU8Hby/Q
    -PCI0a8wFQgShzWvdAwkyZu/8/qDlr7aiu4uMPrO6j8O+9suzyI9fLt2AzwJSvOLV
    -W3sP2ZFI6ovMVssttYghsr72pSN8FmISLY7K8jPiFeJ/XQKp2m8BSjoYUb3PiCWW
    -rwC91gPdOpB9Wt+ElQRtAFu0zjXP/gmqEfnaHdMNCReE4SrV9LiWtpoEBjniXHmU
    -XZ31yKHdzN5SObxH69xxgGS8JtBOb+JOWvuv4FRWhUW6TIkqLJvf7qscZHlnHRwe
    -I5418/YCpI3b5xwo6/SYSA63Bpt+ozp8vQ2+H8MYq0LTVEJmPVgvhBlnT5bvk4+P
    -f7gPI5FXSouZOddTmHwcDO5pSM4HHi6gnM4jH1/p2JLQba6H28Srzw9t6uqIAO58
    -UD8V0oxxBcz5qckQ6k3yqitk5XGARqUn6kIkG8VtfNBMbdxhCkqOraobEYlX4ayo
    -DcCqbN9uL2HRyJzICyCKW5fj6B5jkdmn1bphJV1ZlVkv5CE2wpZf5fwUC+WHGNXm
    -vWeqGN4ouP6XTdTrjDviCJBci+vCYG7aeRGIut8zzgBr53pu6E7z/eZ6K3kbJaxM
    -N4FVj6VQloRjy03AjJod/awDUksyN/iWueG23a4xhI1vRy6eayBdkGZU8j6lCxjj
    -yqkFwYjfvhe/LFXTvG25OHyQ5fysanYyoNyRosP5FxiL2w9UoWuyYFDntfn4QVGa
    -5z3Dq7/+dHhEPKRzFTeijfMFBZwAUyzlpkAFfAE87TEu1AE/yAYZz4eqiLVG3Mfq
    -MqZ2kv4kA6V6k0iJEYQHIPlxrqpYWsO/C8DH9r0K0CicO8Nf9pAQqDi6Si7mkQPg
    -cgg7qb3d5mSE0R9ZpXy5viIyj0C7kjhxTyo9/fm84gdc5Dr+zhL4pVz9nfJi/JLM
    -3uGcaV0tGJbnuzgqSEarL52/JcvKyqJJ6iNRuS3OFfckXcbp8LLTCa1ZXJje7oF1
    -Q3gP3V9tviTCkX62Q31sy2LV50eyFM5FT7rDnf7+RUtpxaPQi6hI2bkDT4GHPkkr
    -Q5YSqkHm1fc8UYNhvW4klDvwblAPLTPeqw3HL0FomZyh2yjH4TH+7ro1rG4hstyn
    -UjJLi7me90zgvYDswGZIskCTztzahMUawsjsZRwU2mozgwV8RkG16x5iVr94B0qN
    -KwBeSmsTtoBLOSl91oBpaG67lHwYp/l/NlYg1aYhGw7OPYuIpjhYnG6Rl/moumaq
    -ZDv9ZgdpxVKe81X4mlsgfG2xzDe6zxSwpYiUQOsUC8oVbenYNaqtAhK61KVf1+oH
    -d5hHmSBt2Kl1MrxWoIgSvLCVFnWfAxH0XCThQsd3uASf6VEV6RUTwRJ+copmSQaY
    -kXKevJvIAVj40O5k2doMUyX+p7DvjzSTLdwcNorzna8d/qL5/R7DwAUVISYx7Tm1
    -sUvtVvs2WOMm5EF+a8HLU8g7gOReKxP80zeYjDQxXl7ExY4ZoPs5y5SEIY8gp5CO
    -YmfSXo2x9GVcCiTz8eT+TYttfXPHIDwTofID/bEAUWi3qeSkFvZSwFZbTTbGlecn
    -+b2ikQajnRs3sSRd3fFSsmLE8x82MWrAqWwqL4dgj4XA+IDeHvHR9bwKvIXfz4YM
    -EGfD0cdZjTw81RBWx+W2+VZUeRtuRrqF8bfJifZ9KtpP4C3S44+12s7ElQ5Sv81c
    -nH4WivTvapGFmZ+wAaEZwBSzWBRsRxDKnGMDaTyEXAQ0QqEkLSNmdkoUVDLGbBZl
    -TUk51R4XEYe/nyDz4ZtiEXklQmT6+KAVNgD0Wkf6ABRq9xS4/2umcfP/soVhizkb
    -J2U+9+c3BKpfblOe1zAQgbyekOeMHxk3N7rqbtZJoYP19OGpw2GdUdWuZoK561qH
    -S5oJybMJtrZoKAwtCyP32DZroS5TR/AX7X3noaowiDEEAiIxR9zo35jFCHqAaJgV
    -YIRWIdfjLBozsywtjxokKG56GZoC9JV7UHKgAQKFx6oU63PktXTYNGKNjefe+E9l
    -rM1RbzeAqrYqtVxjKr5/GkNoOph+DHO9fOQUDRnBs+2JBpVEHeHlVi7rc6YSNp1g
    -72YyfP4syFyKw5F7gEamDO3QijQYh7c7uddcahTaOdWBaubUxZJZ1QQVJrhtHpvI
    -pMS6A3vjNf+SyR/LS7E1k0sYIPyb10mPknHNZoJH0FcdEo1PaLxZSUrBy1aQOZZk
    -SY7CeVF3ev1y4sTPRdRe7Pf5xgmnBe6KUmnByTih3T3DXIhIGgDLBbquQnw9BHIA
    -G1wj7dLy6/JFd7G+l2c2Ay68pjFDY3FEK523p0vsvdKXpUZcK2a6HDjtlUK3vN/y
    -1r5SisjUgo2Gktk973O49SHxFDQtAsvY0xeZ+B1d6GIZDg7VIjDHRN6yDKPMitT0
    -ULOvLJrUOqsJj0eW+H77MKQzfON0PgqmM4aZ6egXjI0QD6jJjtgLwDB8WaOFrvs5
    -1TAtCbNzqAuBweC+UrloRH2v2MILWK9jr4SVVAu9l5TNhye4cOtHGWRMrz+v24oQ
    -zThXllZX33nmzPdkP52dHtu+P3ID58M/vM5O/IIKyPoy6TcefPOiWIHQu9lpAayU
    -7Q0ATLBBmh4rtmywj5Q9yhVXpmGLfq00gPyTVvSO7YmdNC62zMFMFiwD3TzWuQVh
    -tZr502tXTfbNfaK+u2nfwJOGGxPK0i00mxxWNG6AVkm924sYh4yZ8HAic4CYtANZ
    -vDUw9wiu5c62YWpDAfNgLKEnMcKLVBi/J0Xl8/32rNrxJ4ASiuNn5/IF5l7ux8IB
    -3Rn8s7ips0Wa87g+vnWYr1nTZ5zDFkrTwdnQNk1ZqMnR1qyvUJymXSH1INNAsvtP
    -wjk+MFu60HGldi1tdRln2x7+b8NtWRt4HiXExVHCWk0v2rQcPvX5gEOAekgeQRxZ
    -VyoRmQf3HImU0N3FyiBE9LseiIh5CxPFAkIrKWHG0IT5yfdVg8B+cIiu1hxVY3Hm
    -8oP0fbx3ugzYVXy3tOcTEuXXAiXPvsmyEpQUOXJHcbZlYWtzkMXri4i5piUR+dJC
    -toxgtV+OV0aKRSK/joz+BkMs1/CKELonPKYgriu7ij3Mdmnoe8vtedGn6dliVNJn
    -+Werv1yaaaDY50Ng0NAhLzewikpKxGML+OubNchY0895e0pfYRr5CdC9GPPCJ2Zl
    -NHi8lW7eWKte6I8CDHXtcwblfDr6J6x9o4FprlEatI9EG/6Aqy+X0DULDYcW2yAD
    -5LdKF57sBGrkDB16nUXQHvIzIwG4Uk85ndZX+nRLLeY5Gf/9XXsbfq/0K+SF8cMy
    -WBlJ4yhAe6tKY4ElXckXoIT9CR9Df0lUVLxSUkAgYajb+xVhzK2J0q5gGm2Z69yJ
    -cnXKnV7VP0XbOrylFo78bBy8hZvF/y1KHCjDFs0uVVHBobDIPfeqvn84Igfn6agi
    -+FsTfrZ/shTraRMOja9ZP60Q4uBy9ywE1mzN6Z64xB+K9LnVYc3mU8diJJLG/Q++
    -+qK5AVHpPZgTO8RcvBHOiugIlU7zJzhBs6qa8fWJpJoBfTfjL0JcI9jjPp4mzyGH
    -y04inDpQcEem4Faf1ZmiLxnuuAs9AYMqKNUdxD/dI2r014pFvvTgRTndH2+UynpC
    -kfT+m5EGDJb+paxgXknXaWPZ64VqZX4wzZsjqQ5ASNbTpBlomQVPOsPQV4Yk92w3
    -xZ+r7ow5rtY3Hvy2vXGOlmwOuKV28qhKLxRzo5XvHqkqicYwXFRDCudGTl34dBM9
    -GEz8Hb5Fohr0LbwQt7HTgBzbQ1Ci/RjQb5NCY8U9jaNxSct0816hbNRJvo5A1Kdi
    -gyquNT+IHQeTIGOscdC/4r6exMSVapx5WqzDRpqXFqblvsRAgZyWlUQNYuy5MnHk
    -EiQGLOfWEXXm6WDhypPc40maiCZLVoryFW4aIJU8/FrRhixIDP66HA8mxaIJ2cwk
    -tZIzD9qjG6RrjDR3vL39XYNGV1JGdoLZ9fHsTKGkV5kmatZTmfzzr9TYO51gSeuS
    -cBWhSmTaksqJiUweOwU5QU8tAjeSuTebVa3q/ZmmeYfVpLsKx42z1f6lx4EEQ0+p
    -KkcrB7UR/2XUlWzoOI7VUt/P5fG2pzIvrw/uviRqbrBdGDIn/0xQCFh+ykVQedYC
    -7d/Ez51vGbgUyaC59h08ltZZJpvMqVUaz7LTGDs/uxSvcTpwP6RZuqpFKcHWv6SX
    -+JZPWoP7mwshnogYv3VLLKEvEbQk5m8zrbMtOmLmhbutDyxdAhgTxqHUnBQmBo8h
    -dnco+mCyVx4J9j9Gdhp6+eutLwurbg2acZpEVDv945s6WxG1qy3UG24Gwdf+Ofjl
    -RLDLNpZopNbVh8Py6eV0RjSEP+XlPWwU35+ksWjvC0UT/0NwBdWdv5d21cLwr1zu
    -qH6Kj/HWNkB7X5v1it1S4N1gNnuky7UnKYrRMWedv8ByEbnFKiEaQtN4bxcqjlEq
    -U91T+/gIYa9FamRqRcs+FNtGfC+uvoI1GCco7Vu/pyewv7asS8VvcbGBRuvakoGs
    -k0dH2KZleyjA6KtA7VSkuzCLPpUwf3nU8DsApNCy7xQTpt7b4xFhUpaOXuVb9WUb
    -FlycIKZMNwPftidR5VbC2iGKxzMDAAM2ulxKv05RXi0P+Irp532pd8C77r37jj/d
    -kzKGXPWLyfhe4YYPAxnDoFTfKdiR/ZsJMspmBOPWfyqkvcif5ybSiduZYXcptEsw
    -ho0rSKUXsZVKzVR2DegR5VgwDlNrjSMcWkhNF1tuSqgl4RWVvjnRX8bd7nAw5V/N
    -eJvrHM6ZgA19q/hd8hnsmgrvLxSn/QpnqNmgLqtfjOivx8IaZUDq+Bbq/sO/kk7N
    -odCcfl1PGVSkeQH+I1p4sVcu+IlNxu3yaF99zXtY39sF2PpbJ25Hq6TLG2/4yj8K
    -w7GkXDGmQ/AX77KBtNtEyQEebdGHsI6Z5kP7ZSIscIQPgN2aHLl5+0m3cGZDr368
    -5BZ/w4HkDmdI95XABXnHE1GiqBmQWOi2Wmh3V0Mcxiz3ZVwJGtuJ4fpLaRVBPxrn
    -ItWN8+fITdkKFCNYAr6yI4a0WnRVhWywKuonm2UQLQSKBB7pNQYSwm+DVVYb+ag9
    -m/qld+fELwQUUdlQe1vrlxdHy6K4oQg4O+gYaKCBpqOmfpDPYA+iFYh6Iu4ts89T
    -lvlimmqJLQYOEYGNZL+rWi1u5z9vRe1QTodf2sVo9kGqA4Y3NNMyKhPqZ3saYXtm
    -rclnNogQiEXuXQqf7Ip7RxyM/eFhqiOl2fXSJXDq4AnDhzalV4kNCs2s+agCOeVF
    -RfG4yMPlbOsCKC7vGXzYc2kQPO1yNmzV8VVdrG42TLkRVcGpP9YTiO09hCi9L1UK
    -Oox5pERmPewJ5pWb0Nil46xlUXUe85rI12pH2dH2q35UBJGrA9azqs5G/2AZihvi
    -T7AU9tcPTxBnjDMp/Eh7Cf3K0bsFw0fJ8W8wnSQ2YPkmzPNU3n+asojVgYmQ5Wg2
    -mCd8wzRn3nyCz/0anlKx4RfMgfK5duxno6Aq6PhSTiJpPKpk+yPco+WvjyD/pb7T
    -h/WjIwd3mtmzJV1i5WnmHVuG4rFzSWJrd2YxxBBG/4Vn5+tDQVMlSY2f6O5GrNlC
    -lOZ0dZka8vu+ZAcTMBhQHcKl7Qg92PaKvBFrQ26D2+mQuU/5diViQAyH1UDnejXv
    -UxPtxCc1IBFZkzCPe5L1j2MbGqZIBa2zNZQjqg6yYO0Z3RyI+ulS7DpD1cD4aZwJ
    -Dc4PdFKbnDyfd+T5BS5Ih5knAuvjKlHlBhlWaxwvrqu8tHQk4kSY5Fiiz+G1wLkV
    -73NlZ03c3qQchTyEZqb3fz2jx3gWTft7wdG2HO/50vo8oL6IBB8ESTSPTDVfvg8B
    -yotJSm5amqqZeRayKH6/BRtMvFR/6jFSRGLM9rJxv5CPeuyaD/TeFinfv5aIY+Jp
    -FguX7AdB3SNu+JZN3NMiHxgX/yxT+SV643p1M4HcjkH7zK0W4FxDLySzbt3Byrpe
    -Xsn3ZR0t0RUvTyCeLkEo9u/5pSSxz+OTi8siITi2qlYNLtBZhEU0FwJtepbqRBEY
    -tSGe4MWPUA7zFQQvzcly7W45ZRcESYP0xguTPlAbNUJWsY3FOU+fWT8c70iCh5cC
    -75nCpw4j852Ar0lRK59fzIzkVMtslJrqdGoeABQaO8hy9SxEluYM/D0U71da3NzY
    -/lkAtDgr3SQ0jW8q9/3/Fbbz75kmCzRxPRnknY/bjeaZKhUiyiDSB0uhZ2S0htHn
    -M2XJrYep3iQv4jiSg6LVMkFbzYoqwte7UF4r3cUiFfabs4jYVsN8A6rDNucZ/3dP
    -H7v1tEI3t+doioS8uax12hF+UEpGfOFpdIKh5pFSG6QLMvA2Dz+yLtVkSL5NcJ1l
    -26WLl0qHyaZ/377iHO5Cz+f1T2JyOkbayTpuvh3AEPkJSB+VEL00OoyUaFnJXZLN
    -k2QsZMfWasiQN9nCDncnD0HQJgSBrDhr0Iu3o8OCy760JxW6dcI+pfUKCMf3BfEc
    -l/0Ry8gJrJYHlnDQGw/x07HFKUpQjq8LXcQfTPHnRoFasKuAXOAXIX2MpvTZAyhv
    -wenXd4JglcKHhgpZAAPQLRtVjnDm5fP4VR6uF3UPqnI7XFivbwCIrNdRQn2J0kXm
    -H4ljIB+bXrun7htSrev/8OVdtaLglleu+mhzDSe/egQlisEHpTvS8LheeitSzwqN
    -QNMh/6A7YUqrluA+pIMZosV9+q5Sedxh64FfTuFBuNuj3cljjADG8k7ziEOSufHr
    -gjyW/JY6ml0dCNt76PPgy3boXrq3pguVyAvJ8u37sKNOvOzltHeA6dI0MOVwhjKI
    -qViU9HjyzCYScd4c3PJEbN60hUkDJUg4i/jsTzocS+A/mu7H5uWvv8HsAmL5gj1f
    -uZ3tK9q0FJQ7rlBXT3xMgzJbUCJviMalT9aEzjRwl0musRPgf1gHQIpGL8pVVX0w
    -aJytpItqNxhJLtsWFQAo/7ngDVLmywWnl8sKSDPyODNSGuOlZhmOaa3HAvt53eDa
    -0M1qXNM8p7QXbSDNUmdJFzQAcO9JsKDEXHH2P2O1qrvkjtzXFYeTqIFGU3Chk/mo
    -46UiVMXpz3q+9qpIxdrTKY15XCXhEo7kLftEAnPnF6b7rIHRKf5vmkwRcQxhs+He
    -jRrMOX7z2lV7GRtB8MMPT1Iw2vcN1WB3kZV1gHpjf6T2sbputNTWnMLDNJWvwlwz
    -+Q5ybwF0vHJJJVUulsOyNS+sdYgvq0IZVwtziagtOrAtpiZqOYCl4ofQO5aEWiyS
    -kOsFUv8/3lZ6TsnEiswBejH4yC/907gZiNEfzAzlG3wW8VAAm2hw6DbbtM7RZsMo
    -xjSh/88SpZxEOfIExUkRJKtBFok9QGFQoQD36WvFZC81AjhKcWD73oyZMk/qkK9l
    -qMNqNF9gOy7lVYnw9NlHaaq7g8n5ygyh+hHvM/23cHZOg5rh+AkhEqf8VARYdrbU
    -MOBz+Weqk6Dq+ugRN4XmlEUeW6rsFSdOSeLeBsBBMH3xiIiwS1UJgSHvVxl8xeUD
    -W2oa9ZuSs1ayNqefxxcjjmW0XmGBrC0/LSdERWX+gxFsqF3mfsEkSXQ1qbr4P2Ks
    -sYiUlx+tl67ckDnRPEZ9WIPuiDrCww7YmyxPP/FM6PWlI2EkJ2fxd2xPn2dQoWAb
    -yhJRgOfvC3tOApoKrEbiAQw2LMTry+ywNhtnJA9PyWU8iapI90S8NNiqm0B4hyAe
    -IXwUtpessQNQt2ba67qPRzwuGNwMDo9K4dFIQXM+URebydwYpU4byiydvpWNd2Qn
    -8VLgy1twpxfxNGSQZ1saWa8IbGZ2on3NB9b9vYMn1R0r+SRpsmxBOQfg92xJZzoS
    -0eeOPDMTyVFdderdq/2dA5RCiyA80ewAfPcXCwKQSRYXucb2EEOgwgnk0V9IX0oW
    -Xmz2syvsvEopXZwsnSLyzwerozLSqqqkrs8+z3TP+TPP86B4pZ+zlh0EFDuFC0/C
    -aSUTiSNDQZylkMDrcXM0csr4lnCxsQVv0uC/344ot/XLOVPPT8D/J3IX4JAfzWaw
    -FoT8SPi2ccHivNlXx1zPxVUGNEcObr7y9hNggTD5VOpf+6/AS77vsBILPsmbLcoT
    -oDzDvexlroYnwNYQVuItQHTQsb7S1c4h/a6aSCCBB/5lyCxB5z+wZHa/6sf9JeUE
    -MNa7brj1WUIK4RAGBquXnVC4XmkPIbYNgCkQ/acnU7MV4LmQCznLPHDZScWg1mWb
    -mA/tVm+dkh1m7sq2LUlfR9AQFw+cbr91I10kB5xOSAxcgoJIeeMpiYmnVZ44y4Pu
    -ES5a2v1hWn6RZnHZEv+jKcg/YltgvszDtSk24J4Vo3HpZ+X+bNRxyZ/5JdgEOcB1
    -7ATfW7z7l2z9/SE1FByeZhYmw+XMoogPgMFv37qqwIEFpDEgs+RD09pRhPQKf/tJ
    -wM/z7wohblBuDWpU96ciG7xuGTLilP+4DtLuwsSViuWl9/8yNL6SnDsEj/T+hpCt
    -LZu9KjK3rYCySgw5QCTrYe8syBtkRDYHpjC07jVKI/3Z281mpUDaiF15MGr7Zycx
    -MaKMyLfV4glS4rfpY6uUYplvjbOqJhzLdg08vrn47tq+NqIuMX8aRFoWmaAOn1ZJ
    -8paa88NwKPjFw9hKV668RXN9umvBHqQCUWNlFvrgOUov+2CKpvNuE9a4wo37oVV8
    -cb/WWVZpBF3nVekT0dWY5tr4bHRL+XiRl/7rU6c4QwtafwE+ixEE4TWFER1X4UnF
    -mkB1c0O1c4LtzBLZgJoD+mCbGHqfmxLiwmIvcgmtHlf3/VftL5Eaz4+zT2anij9x
    -E9oaGx1Lia0XAB890fg46aGSYtwVE5cfUsG/+VMa4bpJWm3T0MHQyjWJPmHFoEYC
    -vzeP+QnTa0dkWprcqshPiXA5ljpGJzzPQLjbSSVLtAL1M0OqHtGcA3Y2qOMRJuKI
    -J0DOB5B8wVb4L+oR3j9MqVMlkZZ84UlFR99x1iHYUp/XT0ftsbuxLfIzMUuvc152
    -UXvEciZApt8odKdc9UNR0SiafiAnZrWTs6wkQixobA+FSXoDIypsLcDG/EiQmyVv
    -gHW6NgjPnVMo7qflP8zExQSZmSxos79ob6Dn+xHvTMKD9HxZn6wbrfOrqLE6cy+R
    -o0st8y3SUggGczQrwlsZA/kLvpcqfntfl+VaIwKDqefhrphDLtetLyaC3NHf5fSL
    -GWSHfBIBIJ0EOBvv3/3QwgEqZHH0XI2iTuwDZVijpiIQkKnn0yjXTl1J8JJQbNgP
    -mdoFc93moLCY8PbLw2gGeU0T2pfvneeuaHKnvrYQi07f/Iz8fxyzUd9JxmvAjtxx
    -II6zBtdDork93a+iNLUSvbZcV+xenL8Pc4sIkaY1c3G/7CsFTmgCgUw50uxoXsFa
    -+IlOzFSLk80CZrsAgCK2/6ps30rzozUFYhiQOWbngLfqNgQVb47Lxwojv9ZtwJeL
    -8CUjQGJ7/qhhbI9nm7u4djq8vCDbuIHO7W+x2lDIGdyBDmF9r+4HGHQS/lfdG11B
    -z9HZ8pmnLS0Lbj+6dPidTnDK7yhwXN+5pVErlz0AwyrkUQQt2DF5t3/Cz55jfFx2
    -Bz8HXFkP0bSdQsB0XHLIXOijjhXCWgn43Ls3e3XNxxfSTcwwdSg/PTiuAkfP13qJ
    -0fxRSU+D8Ro2uGOdDrkiHZqBRfz3OiAB4tsvMubYgEBG3FvZbRJNZx4wvz182OeG
    -xenzxnPrhZKSuoEpkTlQucCJ+GiG9yr/divkfeUePi0La8lxGh+kY3qw57SRCRjR
    -N9OrN0CUqnzHS8U955pygWf4Y/Qc7nEKOEH1TRK4LnRniaddOM1tyePkKdBIzVfZ
    -3wQpIHl7TExYW0+JEcE33rOIhDcFFg0iJGoOdBsjs08mlpIsxAhyrTf+qfxKjLM3
    -57T4bYp/d2dUZdQb4OirqmO8RTcsDh6rKSjbDFJSfhhFBNOkXVcuPrgWM15x/N/o
    -1M3avD4Gjwost89Iht971Fy+c+GL1JmT+WOteutoO0JW3ZzI4fCqyniTa0bhTv9+
    -aATzQEd/Dc77/8tXwq4Jn3dQjb5JJebqQNoDcRCU/od7s/PluDV4kUeLPUnP3Msn
    -vP/Y7InMYUg+7sEeHY8NfPvPPXLIq9k/7xd7hnh7wQZp2zOpSFqRHKbq4B9uV45Q
    -LzZGy5aGJQ6gku9ChlLTYml6czJGauHgupOS7neDLSaGhPQkD322LBXz6C3feMh2
    -8i8QUM8KJs5Zbr4U5VuuG2N/OchyLSlxMrkp9OOyf7N2rntmMoyHNiILyRtbjnGJ
    -he4iP7Js0iroKaJXvmy3slzdEuFWDjKZ8ACxmi9KPBiFxlQqiMk9dxWAT+0dmQKn
    -PNqbl2439NfNZD9KxMA2DGqLxTFASutf8DU/gqZ/boHqz5qLSwCbedlS2J6nPvsg
    -I55CY6qvBV0SOFD7WV03xx/KUi0V35lP5ti1iA6o7WyrBM2ZnpVkuaOHublh00Do
    -RVZnH2i3gkt+jNe/bb2X6EoamTsqOgz2KdSmyJcIPF122H9Ku62KHPlwmQ0oCGVX
    -v8raIVOn3Icpw+m2+1dmtR1woNxt6H5DHKlOlKySDEdPPn3Aq5Qzyb0PxfjUHxQ4
    -TnCxUAHEBao2jjhAdfLHTuwFdEeqEfirWJvjzyeQs3djITAHBsQHvcl/KTzcSB1W
    -zYskU26x18qA79u1KrXZ/FO3D+g4lqdYyoGobHNPeryE4i///HMRDq8ZCXSMhYfW
    -9ajhUkdr7P0Pt+09NWpv68DXsD8g0qhNsQT/NHE6TDyim0J/ZEbs2mSee2AzxSR+
    -Cf/84X1gv1BU1dCS2Itmj9WBmR5hMuzrYxEDMRzGkWMjm3pwPx5PVDNU4DCAJd71
    -8muPVIRWSwzKM23VKJhRiSJPNXkBUSwIMsvLQb9d1QMip4kvSl4RmXUPfF/vGrBC
    -3NWRZhx1yn566KD+J3+624EN5+2PS/izOx80i466FxMtq/xB8prdkMBFqLHCZG/I
    -a4NPMqElQOjyFDd5LKIdgAtSGT+vAyY10UKgU5abKAsWqiZDwbdaOuMChhEGru4n
    -61RlSBhG1yCUrrH3FTAIqcQcXunJ3TSV17L3zb/A41IYTghC7+RvX/XyYfz8vHpH
    -B9hEtw0iJ8/ewpo533SVXdTtGPLTIthJEgdyzdiAMeAnfMb0vOKTTFUE5Qorr5cc
    -2NM+6Vqzb8ZOL8nsKJ64mwylaH5yx9R+UvphNZ6qQmNQfMTbZVSfiS34BfW3XMQI
    -pNcaxQukz3UJcOiUOpaRzv2jP4iqqcTq7KBunlgTFO6mUaMXVCLtUew2zJV+Og3N
    -HOfbevo8LV7aXxRJCEKG6tmVTyVEUgNDepDdD59z5LldBVGyB0Jg75Ya7V3xDbwB
    -8qSGTf6VCYbZ3/iSYKIpGPfjrgwMFti3YWz/0H/PjEvtp5HHEDCRzdw1XmyWsd7v
    -y1f7V38eOa8PHY9QzfCpuitmUfoQ6QUlwFjw77INoJOjtkrBRaf8pj2vp/31XSZT
    -PoznQUbJrKh/J1dlU8K33Bs/hC5nOtzFKIi6AMEx6FfL/bouRjg2B+cWJTCLC0Nv
    -UckHeHssErK4w19+EoCh6+RvzeUw5HvNOrBJOk6OCteXJssQgbHqGzMPrL1OwoH/
    -j2NMgC5ry4ynFYfDsujJRHAbz7ssGHrZ/4FJNVvFOdaeVYvbr/Ws0BKQza9lxqTM
    -25l/2FIw+cv7wENpySI3r4sYgzxsEi2s8To7nJGlkZz1ydfOHAq3hrrzAXCycvHv
    -HtM7ewR1yxnhjJjsEoOLCzi+uyvUZHudbe9ZwWS/dTGnzyCbw+tuzBcfAzbV5JcC
    -ampTwLqQj6MYjRFl8jylYEfqkSyul8Gl0VpE/OCy192WtStdtFCkh9k3JTmB1UaG
    -8s3zPFh8VHXzVPNKI6Sjshz2br+cosdzBa+bSRDzd6ixQKMtSQys2mRT+YbcZkqm
    -9UGMD4XvXJ6FCxmTujc3WmaKYxmWWECDeIlZvdMCUgkrNJjzTtqftnq0ccRuprYq
    -N+vfVCB1lJwlyiGB/TdrHXE2Dsrym8pV8kHyWLmHd+0z4f131nu0YJXJoEFzzdYJ
    -4VxI0zD/9vZpLtteOeg28zl1cqJ6Eb7Vsper2Bk2smn7Kfq3JSkAzBDh/rVbvmYl
    -W9qyyEuDYX6krdanDw7WZG7O/yTih2wx7imNdEMxG+gW1hiBfV+dQPfZYbaL9wV4
    -ejRKr9SKms7FTbAhxDiXBWZDosZlNeO3moCRsS+XFRvAeX/XRWMiQsJrJO2Fh1wD
    -l6cVsHsJzfbY4fswtTtWAktqPqvUrfJvjc7GJM/JR05ySIgVgFHIUlvqUoTNfDaV
    -A/je7ZGIzgso/49X6YeCMKJ/NxfTmhoIdGYkfXoAGxBDzOSeN6jd5mT4uWBGmxDM
    -awXiGidU7v5wF6/831PJd7UoKM3ouVq89t+HfWQsnAUafhw2kPQspFpORdT/kxck
    -5arEOe0DgpV3u93zcaaY/f2P3Q6yTc4P+xqqYTNaeKNyTDMzsVejGjI3UKAXGV/A
    -w82o9fJlVnOcqXf2HRSHrdHAljm6LIoH9rcOfj1DPe1kPuYXd3yMPE4vZo4+zQ+D
    -M58R3Ifld3MylnNoQdpKWxfs0SYRorLCSDVd5ulCHyHracvJVzb9kvO0wP4CoJaO
    -e5mZ2olGp2WioS6UvISUPGZQpg4BUMcFANczByqMFA30fOZX7gh995Qylt9XmlHu
    -hABBa5mvBqC8yqFUT30LOCnL8UOGFHVg5zW3SbPoD/zvLtxQTComS3M+rpv7jg+B
    -+fF3OtCY8D2PJQrqJL3Ic1h5llalTRw+MZ9UiuiVptMCQmgVtuHaAtlfKyvNshtb
    -EixJnF4OAg4yv8MXbrIAqCd84ep4wHwOe13qXZWttM7QXiqeALdj5fDt2pd65kLY
    -CiSgyUsF0PqbAFrV1h4qLzacc71WA5G2wBxB8PYr1dvVwXqw4PiL6HVkUcDPQBfa
    -FMG54wpwciSVEnwT5hZ7SeVRzZ+tLMOxt8Zb4LvquZOlmDMxr3GCxVP0xmxqvU56
    -7sua14FGB+fa7Ce3qcBydQIj1e0t4j8xxBurVWVXbLDwqTH84nsurjnMKNaZ99e7
    -k8o1G1roP96KAWUcb6Grd6gIuV5ezwd4xKFx8EQRlBGy8IcnP7aRzTaxU2bDilRb
    -KrneR/8JjdEpncyn/iuo4XBnqnwKlTQW80aQxiUlu07rHcujnpF5bmHxqND472d7
    -EkxFoYv1vfNefRNSSs2ATE1oRRfKmpmgOC+Mjo9llrDyR+nW6AcFBSOHVWcRONZ1
    -4s5LYyfm5Qr0WNEezqyeVL3Zt7gAY96EOOFMf1GWj0mp/AU/ZUa5/UYJJUBVWBml
    -oA6P60lIbKrECviMTlpdaX1LjSHfwx3Wlg9ab3wPc8TH9aZ6a1cFgsc4i50gqIIW
    -oX6qNB2tNr8D09x7N6pnfag+bwE5KJRKv/owHtcH8lRP+GKMcDJ/TiJyllzP/Jps
    -Ml10UA8ZHURq5M5EWSpiGLe5/mPiqYCYKuOzPAypYslXTNZ/pZ0py5nAIxVCiQy9
    -a/qCpwLxhRCXu4nqUdR5SADCpsjgDSUf1UcfGO34CfjOeauoTzyhl99ekXd41vcy
    -HH1YfIRfoatVOmIQK6WYSO6tILyVuY7KAE/ElqRCMuJc3OopxOucrkQNQSjNUhKr
    -x3Fahs7/3te2VLOQqk6QVTMGPt4Cmq5JHQNLanp9D/rgKz8dSrFemsfF3kB7zrE4
    -lRccaxdPmAVZq3k0eEytenGULMNEwV1Jr0i7TuwT0UOEE/uUFRCPsM2LKr/Bu+ck
    -26LjelEIu62q86ItsOTvMOKI61Kjd3DRyqtvyFS0NnWQ90uiRUlGGB/3GTQKZPEI
    -vLTdSa1GsrDHTSZARnW6foG8ed5FYYNKG2mGMfyU8jUXYHodLQ+wsOKmn9o5Vpz6
    -b7pxxHxGtAA84if9JTRTCOVdWn0+Z1S6sV4MF2zeINe5tYoa6VCaOWsTJvXpopzH
    -/3oy9wn75FPZgFZ0gXza4CilZ6714NiWADOAVxXPsTQQczEk0hiUqs2apFkQm9Tc
    -L+Ra7BR8g97VD1An2b3xUCG0ygxRQqvuwI7QYfif6d1GmWf1SSg3rf/Wd790ntjj
    -pa9K3q6SGN0xiqi/m6KPGAAyiXanfjpUcnBwhF5a8OcjHoDe/oDwRdHXnVB7erV3
    -Z556g0dw6IPKH3Z5INtQH9PIJmjR4ZfoWp/xi0Ni+CkoTPm9wo/U4T7OxmgRuJEw
    -W9YqPuS4O1638oqiGjOFgr7FcfSD7Fojnij5lKhgML20qoITdWP1qh3R+6pixMTR
    -ahUL3PUGFRHwr1nHjbGgKGzx5bkpOIArOAVP1uMLpB7XvTdMk2q6b6lW3eI9hpwb
    -gKoHB52Ab9+agXDavss3/0MmostO5mPT3DajUoDQfH0YzVXyfWs6IfUo21gO0yT5
    -nkfc9EDFq/jtvNAw9iRLmzPjLAQryHsWwYA7Pq1H470gwQBWAUr/ampNzfFF/YIf
    -RYeQRzTYfVROdZwOeAFdp31Km44OyxxwACAc+9oxSlUsUn8mFq8TxEmeRL02AEsx
    -F7EGvoImBkPRg5k3mfR3R4r0/JnFd4CMbOoCilkzva3j6Jh/CKuLdcPFRzy5CLPR
    -TjCdEgoGYSFMr6ONfbpThQfLrqI2E8hBeRLmWegmL/FVfPLsaYbXy9FNPgiEL5ds
    -hSvJqc2wBWVeFtEfeX5tfOO3SUyX3X14OHq6aVGF/WopFVaF/I5o0/g0cg0K5RCK
    -auMa/Vatw1xEay0IZWgl35hIX6oM42EXfufW3x/884J5jVw7LIuIqgeWsJmWyb7h
    -IIm7U2lLR7X7NDC+6FGqlx07gofOJkalBNZrernSLcSDsvN++8GzvIAXqTbY1+Vg
    -YBMEkAwEk0Qe0hNmyoEL27731plYK2pH06aUvCgC+Yn9p1EBuuyb/DrJtuV0ki5o
    -i0ksM6QwwNVvpei269agq5CXK3LGCm3ARcw4aV84sJ2yvBFUfvWZf6ehAMuLrJ+9
    -L562DVUqJXFuLpdsYKLHxXDpyHmq6Mhv8WpsyVsZbxri8HBpS6w4z/5SVzHYQ1ap
    -jMb0s+wdzUBF0xoEho4hMaXfk+M4Gggtc8V2wJOGQfTAifJ3U4Sc9ExzTyu9Jz8u
    -D1XRKomMiwSY7e0yB3+EaBFC1patpzu9W/DR7UnCGb1mu/qS49zwKMqn86+D4FvL
    -Yi6d5pACUe5iHZ5UojJ2wr7VR1tlQbR+Vux8M/iDaCqMIeF+MnTWQa3sX6Gie8nU
    -PDaYXCBoTDm2x77yXtdDM19JlppiIIXmyqyF+M1dH6bWYpCEn+87XYZxgnX8+Er2
    -c2IWuftk38xxXaG7rMXlmw3vPxcAP7gVoUOnob8/LxjkEiozGQd5Kmh+2aF8qMVK
    -sIeume0ggbklc0R6/shinCrKQ/45Ntgb/b2f41MMmIIaYsWu8Fx3LaM6wtWWYQUS
    -SPH+WiJircE8CWAXIUa1XALs7DKzMfrWDILcm7N8Nuo8+6+CntXOAbw/hhTNEA2n
    -8g9HnuUDiPW403+osflBi0UL1d6hnv6zG3h63HBy+oF8J+ckLR3Lx8G5Bcbneqpe
    -4a4GvgJWnToUyCs/8HJsQniDvF+OBeIZLBamu5p6EboTfDfH7S3iLzvN9h8x7p+9
    -CovfGXta/q3lkSYLYejmwrOcnYIAUtKmo7LOn36gjm1uSLyUit2rqrFZH39L/8cx
    -zyXw0xM2Z1XccguLzCqBr+Elah6vWbczmez4vbv3fkZNhNxfOiYH0/IXitKbw1A5
    -Fr4BU0HF/7twPa59EolVD+lFxej1xDl3YQl2lboQxSHCS2/C/NvAlJZ5YyFP+Z3j
    -QGoXzc0RDkRUizKwlm4wRwyQmLF86TRLFoRPAlyPzGr3BV8+7U8yTlHqShpKOfbH
    -Hd44okRL9fZxYAsmXGuRv8nlAMPxWoy4HBIMg6cJeOCLZzlWK8HZk29ZFyPGGVNo
    -w2eS/OS+dZCbK/QCnffg4xB+4eEWL/OVdb4rbmqD/pO4UAp0Nv84/H3La8N21MOS
    -jvu6p9ZKE/458x7z2eCG7cOWUfo7+5T6pmZUMpnrvhwHbyH6Izs0hhf/xwi+3WpT
    -ZsAnY5JLWvQCwTjLV2P3zWG+jHpgrMH7vch4ZLMNZpmlFSX5+mFsRlrupXDN5ROn
    -o5nMUP8gj2fit28mA/D13WkG6dcMfvZ1/NJ1LYZ5mSr6Qu7VLuOGZWgraEOcD9Lm
    -gAC4XNgQSjZe0DxjxQPliFqTIoiAnoh1WH+iRTLhx/mkqsqk1of2gZJLTlJVhgz/
    -RyJOvZZYlFbGUNxENkJZUh2PgputQoKeTjlu7sldMUx2S5mdwtyrjEcOkqsFcPnm
    -UBhBLw2NK0hORvcHqlH4pzY/JLl1eg7vB83YbDW4wyfvGMHjlWoX7gQ6d479ajs6
    -w86Nxsd+SCs5bEniDKTzk+KhQcGc3vpButSqGPb2oR4p+esaBy2W4Zhu1GZPi/e2
    -Y0xt5fdb58QkjOdB7Nb+EEH0OwYVVmawsLx/wRaywwX0GDb7Uerp61U1gdmfJ9IP
    -i5GgnBoArbTZ0M9zbQc6jHjBrCy4v++l3kCosTQ1OZijn+ohk579hbPMohvk3coJ
    -4Ytvm0lEBgNWqJhBKH5G9hnCI7xAXJGA3wv9OzrR2u/ZAWPqcVvAVcHRAEApBsvQ
    -sYzKAbmECp5rjEgZ9sRxCjA++ac5zZmUSu15RXL40bpijlby7yokw+SjqGvGhn4P
    -8Kw9abPWrjP+IkHUrzoDRsss1UOKAScXbMqHwnK3Uodd7HCS9/5HgSFGJbP65T+i
    -ebFgOVPw583lDAKjlYO0GFyTr1ihI9PU4JyRoJOzeKJiIOGJfShEQd24Y0EJxKMd
    -CH0YFuYRR/QTZx2m7jgaB0T8PwR2af0saosega3IIboCRFeL5GP8AgHGZpBcFKH4
    -+i+cr48gQlJRIZrq60UwfNVFFrlFi4pUzXDBLdA3VN7mFyIBbcDjGePwknXG2VlT
    -mFz0WYlHs77ADc9yXb/+wLSnE1o36/kZLVBCk56wfR00xckdJO+a2Hwr7dLTfKEj
    -NyTN9cChpiIOR4d18OX3/HSWDp/z2OXIyHOv9EBK4iPczqskmA+M0sBmXVlPRDGD
    -0jP97x7zVwhVMZhpZdg9cCVTkzf0xQTp4z00a79Tpi3iil0+JIFNDsQBclhOFNqr
    -3bnei/m80oNIyaH15oDtD0s6ppGWzkRB4IEhDGWY2d4suqJeBJw81epc3Cw6Km9V
    -j0cvWlJgKHqHzEsj/q1b1YVinVZy0H3+EjmBEVT+ykHBLn8spIF939kyooa6KtOE
    -Wo0ocvaoY1CHGvrFJZgArX9fK/DytfVUAPvam75/rUfsZzSUg4W+qKY0C9UblVJn
    -xGaBfN9qqivKLCDjKHzQs076aI2QkstqhRv9fTt7kguYxk91xfvllCyjtVCLzoos
    -0MfB7B0rc7IJelpmTva5BW8vm24kOyUUw/wBChrk5DzV/Xv6h16ooBFLi1KHKr8M
    -V/mUSS2cO5zIkYO2i+YzHmYy24bzUWFiOeyMDQPVMD64/LeGfcZhDbAwesr1T5G5
    -ny1zd/Nq+Q6oKzLbDUUSzJ2G9OS0ONsP5u45owsoY4CbWY7O0sWGaSVSpF+cSWjW
    -caaYZvae+n8vjD+z4OGOsLY24dOxoMl1pasI7GNy1drN8eN0CFjvCkpkq3j+jWST
    -5gEnuzCe52OtAPVEq0RT4C2kF2ONMFG0ZkE3cbWymQoeg+I7uE/mKSbatrqR4/zH
    -31V7W7thiW9v8rsVxXjdhSUhayh5R2FmqjHIjEQwL4t0fzxEEALj+FTlzPIDwBsZ
    -Hs5Z/gWboCqv6zZXJXZaVaRk3j4oMJSyXFZZaLxko6QO7+A41y+KBP2iGXJJavQH
    -vYIndwVyqgpiacHGSyYhNSOlVJHoMx17h3jPqYot/m74kUht5ZKx6wBhfH2PZ+YC
    -7ty+Br+X2RRNuarNNNuCPoaeia4If9BQr5Gz/kPRf84+WH4RKC4WNqONq2XfGPYi
    -QKuK0ZRziLeLo53cJWpiP4/vM0v9LXu2VOsKnKIogDTVo/NGcb6AJai/J6jmCwal
    -wNYqbN6k9qvRQQqcifyA2Pe9YVOlKQL0yG+32Dn7PDV2+fbIrb75SjuecmwWzkaD
    -QNahGRx2KJgsWCK5lw8C1u7mqZycQ6tdzVAeu1oG8K4UcF9gFWHJCRjqVpxITAL7
    -7+RV15YV+89vJAXGUKvFxzkwO0dZxQH8VmlI3im7YeqqJ29wO/o6HWXXuIfdDpuW
    -SpeAROe1C5gRhJlff8tLQAEZFljfns18OggEjPrYoBcgYkDvVa2ktAyFqrwXC20z
    -QXMFUlGWdIQt/ZTAJSnlnODvkeLZmzYtn9jHoP9AKmg46v0/hBIhVTnSpHckcPEX
    -7N4m3ftiXJKchaFPX2tVKde/v6rfPkO4rm721h6uOhwUtN5woR8gjyAq/HMGS02K
    -EiVuCPn2bQ33v8EiyCF3Z0cMPYgQmIIMd1J0FjJFwA8owuTCwq7P/IhuIZrQhrPT
    -YBSkikUP4hAmTaIMMPvTFsnhzwm1Yo/2deNxUNcNhqagmPOwvmVibs2j25X5GwJ1
    -YRn6bqalHcZ/z0iFZ9qZWM1XOhy2McyJrEmZJOl0GQBUUQX2qpCfkd3ZbyGsbjdW
    -kBpB7YLg0dJdpSlmCnDtNIFR9JLFfqy85xllwQTgBthZ2hFxbhAakrpN06Zafrtv
    -VzKjzYvqcgO2fz7j2niut2ApjFKhQsaEJhXFPAqWLf0kHb00zoelqGmJ6FHSy1He
    -tEMGHcU1fZujiVXgGqwqy90q5hEKxjNquuY5HLxx0zYmUblEsqdgTSXrCoLWgQ83
    -mAt9w+s8NTkT7sycV90FwXQUjefJf3b36ySfcmVnAyIDWQeuWvNWIuPKe1hf5fs4
    -a5paNuxWM+dI2qi2jbttW3TLKHZ5ikqxEtpS79wSulEinXFC6zttO8i9XeJXlAhM
    -rxNDUD/htLnbiNakWynDfbhRa8U5/9pfmkx45QDC3rXAzC7XFuvMHm3U9q6K+98Q
    -0AuDxzKz4eGlDzyoxHDL+eA8V/GCQP1yuuc6AIf1X+K+kIHN2p22IMOe8+q1/F6Q
    -rnQBYPSF/WzfzVMtvcNy0LmDDNgZnH8dOjxrbQftiN/mlI87rkCLkvnTiw5d7g/N
    -EaTu4ew4O8oywkIQnJqLMiMTPZy+TClqaEZNAXBWFyq7QZmXswwbJbh35ThtlKTg
    -72u/yj/zd3vSrXsvCzJaPbua5Veb3q9MT8mdIq9KO+TCcyNjiDPAK0M8fl+sKHY1
    -8IJ8uHbXPJXTiX1CA1fCV3zUPTSpwCMkksaavNcQEyebXrnJJKP82tcZ0uEUep0d
    -08TlPJeI/zSq6P5/nPKR0zM2/l4RoFKgifv5dRPcywdibHrPIzJKb1+rmwe3cup5
    -BJ8ZJGNXICcDAyObjP34JiVAeRZXlTMgBKvX3/FmtWe936FaDwYzLKXn6CIiznrW
    -km572cuwUWbvICBIqaYtl77srQQjvBH4A2XTsxZzZuWfDyWuwOcDcZQzjzNnI6+f
    -QOO24UfWiBjAxURaySwNqwDEW/aZTLDN5dMTe2GEy+few8hgIFZqTlAEqeX/yl03
    -nL6eXINRJJabusFEQCqg+L2A+tDC/FBmHpsbCAxtfsgVwRdEyteRaYqqh5Q/X6U5
    -C1Yf5XtuzNbGefzDmVtgPhIQxqXCf/G/1PN39u7iElm9k92LGoPOtclLGvki2twY
    -NSANhpFE8WTvm5HS6TY7EXrBiSld6nus91MzZZF9sFOKfDCYc+QINxFm+55l7CwI
    -KNpbD0xapSH/bGPAQWMRdvaI27Am5Evjd4q1fS0lXz6tTxPP3uSYJUw8ifIbA11d
    -WaCOvpxWfeHwyJnDWdWD4K6ggNknSR7OEcq6bbc2+cPop/BpeIRc4AfqpKfN85E2
    -S55F9jOYoV2n4k6q6L2DTIF/kxPLh/2FNIin3G5DRhI5Guq4ENajhMH2QHCoWMGT
    -4J1oHLd0GUaZFh7LrVw6oRKQ2vxeDWrH7bRzr0FvQeZnUpXFQxnAsemMFfhYUc9X
    -ZCv3/8ieb5Z5fd4UIg8oq1HY69C/nQQXQ4uZn0srsXfmrhQMWHZDOrqQRAWA17Ph
    -iPZ20NuZLsx1ytkEgnH9R9fxKV23NGtTO1MNNXs4+XB3/PQvOKotq/xc8duKk5yo
    -GIKov0A3DKYREwKweSeYkfCRWvpmYtKV49mMiEEnxY7iMu6wDxf7hWdleZRpr9XQ
    -x+7ZUh/Ac0hKoMpnqilK+KTkoBUViC0S/U5L1qvLthOF4C7/oRShCp2n89mMRsQU
    -Cn/rj5dV8bd6kQlYA7lTPDEXfMmuQk781aqrq6VSnjxbBBwiCByyOa+R1xh0f6Ii
    -fveC/mvDzWk0AcTh7alaLxCFOwdgHWYFKYXHx7WI4tLR1BzlXvIklLYfP2GQPqvG
    -Dqv7y6WSAiqQWhLCIqkI6ZnZX5f5H5QT1GKTxksJDzYvbK6eYjbbgMyJ0yJips1d
    -Ny2KJ3oyHLqiummWwQThoerwZXcC12yLjSlS0/7sbLz4s60HpfNPNTt+C+C+bXTf
    -ciZ9W+UOT7h4mgfbE3sK5Jj6pqPuA6l/Y/zPZckHIoImWhnV7Vya/pDt9C/GQxfy
    -W+H4PT5tUKJVPTgqI0Z2WvmrxjwRfvosqERy3H8g6H370z3LfZzoE46McKFPOZJ7
    -nm/wqmC3o6EDVucQpYk8dcnHtAq0+uH/yM5InbCUD2tvJDDoe323obe4FIWTgj8k
    -GAOjU+0cbR9UUDl/FnpVZmDxLi0/AaDkw2AoXgdY3id3oHgUKV1hhet0QYKW7x71
    -w/oYBqXozLI4ht8qze7R6Oa4HgDQaxAJP7+XE8II7HZo65GJe5Pviujn0U27RHOZ
    -Q9syyZayvGJ6ChF1qgCalBtCvX0tuNFPFMaEKMzGFGK9OMyy4Ze2VuYmAb8v611X
    -dxQ/qnmSuiKpdiRx0sx0LPoVOfKFg5w8C6nU6wLSTDFBSJAJ6JttCk7+lfo29bLZ
    -hON6G46QXhbGFy23kLRNFKyECsEuW585sRWo/BwJT/jGbgJrnXG+K8WWlQEnB/7D
    -7EUupPjO8ocXt/AQQTVsP8CCYogVt39Z6gg4zK0UErJFEfnrAiwxT1PYip8IfZjF
    -mweTQ/d7406JwEdimXE8BsTvNB/pONcDThVz+XEZt/07zY5lTy5Z3g6OW/xWnYfm
    -J/SG2GO4S4fz+xJ8qFbeEWiTOQSRpM5xnLIKKoX9AMUbQBIRYnVC+4UCOmtBRdqC
    -QvvQT8zZ5Xh3K/4AEdSXwzVnU3DJ0n781p058UB4zSaiJ4PAM7TBuFc2uYC312jW
    -7JxtawNzCq6JwXy0SIU19LWnBUrTybfUlt0m8nCSDS/vs8rWhBxoeI6+ulmwNjFk
    -gK2b58ynRVVJpuoULkjtYVBTaGHksxHkeWxPoecJbZ7CbGHh8zF3+iCJb97wttSM
    -QMYqlPd4N34sffudUg0gs6QUqnNmxAUS1T+ktDdML843r9mM62KlbTx1v7sMZHCW
    -y8MW0LD9w9r5n2rcf5tZR8CeV4xKyBA0O7su1or/J29UcAkT3yPevqZbZhbZI/zj
    -uF2DeninbW+kEcgopn5mM5EJuJF27JSlKSDTegsc925RDczFdng+YGbwVwaVzROk
    -IY1NGZTQ4nH9/zKpZ3XNPXM4pc9VxIS56x7ONvbdDDDAuhOId8QhKeKx+CjXK3R5
    -pfcO7nB1NeGFIpg8qQepMZheLfuXHfCNfuhsQ15RR9oLnjW90W/CBWWR3ahhPNr3
    -ZT6YzJHkmhTxkWjKVHW1PZsZfDUDKrFLVQKCDGPOmHmjvffSySIUnKCmlDFOp1z9
    -iSC8TcIILqus0To3jZW38auJqp4xNlPUJyYfcDUV96XoKRFxAvmqkesRy2NHXzVm
    -aEzeA3k8QFO+Dho1A0abn4YOWCe2sfpjiSXTyG0aEYDQhAaluzswlhhKdD9+APU1
    -7qB8U26NVRpCMisvcvH4mJJxlpL1HsbrJT1BKR1hf5B087mgyxOvjJFTravYuVJL
    -kyEGlB6od8R1BmGWN0dklHLWFzsPUv0qzAMZ3E41KZauISDMhY2e6trqGzrJhwt0
    -L9UA2IVZ7/bF4ZZA44OEXlPvf2e2CH24G96l0aH5sM1dP51T81kmj3xrRrAHbgZ5
    -jnbB6jsdSIyM/ZiKwJ9EfjRHkUpxJXlJZMygn4xddu5X+LaqPoZQZ2TR1tVw4hXk
    -TjEZm6gD5maxdjJjV7R1yLsHoFv3UyaTlh0Lle42oaUl+Lb5GoB48NBjCkF+2Azh
    -x5JHj+qPiMdq/kA3EsLyVwhmAUp6I6VlbL6rnks9foe+LK0KvEeFETV1a7LlDHFn
    -wXXDL8cfya+44AoeXq5rdIPfrw+HVk0nFeEsD8VU3vTc2v/F6uv80ybgFZdNemGq
    -ueQMBOwQMCJdHVCzLNf6gMpdsM4iyqCN1Nz/rsvHBn9rgvlGJ+aHEU6ORy7Pywxe
    -UpyzqvNMa2G0eK7VaUuQWMZPgW0pUkmC6y9Mkxe9oMKlDx+wjG9v5m4hh9UyNQ09
    -sRqqruHYeZDBY4iQgCliU50TaEe9aNNwF1O3vUOP4lXChELB0sVd0PbiURMpx5OB
    -6cMIEZHtUkIGUvpNVRiLhwAAIMhAm1V7wtJNXF0HgPKVoAJzFAJZz7Eg7W8obutm
    -PL4oxfpDbnTgeh2JGnL67wx/jBDDItie7AQvlEMwyu2mHHMGZeOlLtYSLm/k3ueb
    -kdvgdJILSrCHtsbV4yjnF19TX6+vFhTlUaggAQdMxGq/IaKkvB2V1fV0czr7g892
    -fihTWa4Fx+dlb1GA/DFM42N0LBwoRgbp5NK3NqxCGcbhG81nsY1nIkqlyejBFiy1
    -sycdAA4LhsCGSneqHJ0KPGJzqJEwdkA8b4ldDTtmJrGSZlmPQzSQsU/fe8q4/eQf
    -JgzvYd2+hbkNui8GFuyXclrUGdL5Rq0LV97CpP0mJqH2csddJI/KscDlAONhBFy4
    -BNWIeV1dBeeDu6i7F8rGgKexWgTaoHgObBenRC590jD+cZ69o+3Y4y3rgYclhd0k
    -wFaHaYZ7Jlk3cxXEJhx9XVpv90sYW1PGpBPooPI7P++7BMVkC6zigbX1gPScTrd2
    -OW4X9zSFglbPRqgyW6zVEzbmguEQnZCyGRYssVnCjs3S3K749R7810svbYSOFjfM
    -YOL/t7GBuG429nsIiUBXSx7QSdnM9zDni9KevWRLwXJQOPGR4GJp74RqzSNoH/8u
    -C/sMZwtxLYZriTVgVHQPKapEo0L345gkaGUdlK20a29aRtHTASbtJBKnYuks1/30
    -id8Jyr12qKCDXhWlEX1iSmyCnjZPZTPjmmaTR/aTeJvQkHKWtc4MdwzLlcSVpujG
    -OLpzMIL7UkxRLw4yRCfgo4f5UzlYXN3dAHgUvZtbSqqDSGr5ea+xxB5hMsDXAQiV
    -4hgzBgKW73sz98YM3fhSMQ/+Cj2EGur9fCqNbR+4ipzturILUCaZ6yFa8HhjdBN4
    -rYSSDhAmtnRrrk7OL+lfh333iCoYivxf43gmQ0CVixZO2cJRf0dfe2eiEO/l/wlP
    -+e+2hu9HhvtI6G0je5eP0z++IZchBeAfzH88uehS63iIWoAMWOguQtcc3JQSh0Kt
    -VNfpSSdlg/PbZ9/bU9l/n1GYJM9MO7fV6JydCdpMJUP5FMObaEJkhbc8mourOV0W
    -lFR39MPmJRQKWA2/iM1zMomqqH4VE4YjKrdtnJytCPO06VhthHh6lvd70hv29A7p
    -C4WxAM1OFRyNRBJ38G+b908f9gt0CvB1LuRDWOeYdhRopUKyQupeQ86unXdG8Re3
    -DWuBM+4R1K6ZA++N+VYWJutLKZ5q7KXCvL4Un4Lsj5Yf8eLGE30kR+7vOrXfeHrf
    -4Cfzb3ucrVqtF4LC7UREugwcVvz7JsjDSuBvL94b/aXXfqIYUVi/K36pRuv4sO7N
    -pr0vudjTI0HwSpWI7RT9NmhYXuU09XeOTKSz+gMstlFRbsvC11ZDU2JZakoO9ZMj
    -4SrndZxF00AZX4wd3Teu9fBTtffFXEmFFf33Wijp1wvh8p/fS3PgE2Tj0oi35Ert
    -xWq4Q5tPru1fH3vapB3LskOrHV7Zj5lcHzgRxNYT/sANO41OGxJsjaW0Q3IlQ8qx
    -L30tkqIu5rZAbY2P9gYsSfD4v1lH7ODDwW5IE3dpfGbviRDwVUmNwUYszGTrEXRs
    -bvc6i7QZ0KpfIMiPQtMeXQ2m+dAE+Uqthor9elE2ce0aOVP6wGdLUXA4IskWkgaC
    -rE40UobZpOg4bKqN0q2cl6BMF3cx3f/wDev+dwsnvPpbuDGUfPyaC1Q5U4XDrWBV
    -npqAC81EIURkKCgjcmZhms5qadcHwf0ALye7g5mCJfKu3Ox1MzWa9KNHtdi74gYC
    -c70tZqrNvy3yr3IkgSeHQTVQ/U3w16KNv6jdkHlXGkv1alJHAiA4MAWTQFSRhsqu
    -zBOFXtJcAAv6yb3MnC15k4P1EWJQ7xyu0UeW1qHmLPJe7FIlwgou0cQPDdoUunY7
    -NRKgZ05WaeX0EaFQKG1rWZzVv0tVLCMZH1DZxZzMb9duhpQrAYLAZW0A8AXVrRDo
    -O93vBI3IuMT/iW7EzwX0fLJ5CXq3Kd+bwYor5DHj51G6OXZ4JDHuD7+MoZN2rHxK
    -FOHGA7lm8vxFQyklIvBaHpVjPQtoyGrMda0DnwXF1K+MhWSH+MZSufVK4U1CqtyX
    -cFwGSikCLx1DurstmPvZL4Ce+SU5BgNKTnfrnLSRg3W2efDcZ3dHRv2WJ7oFoVdM
    -tZ7PKZdjPHLNpKDd4pra25FFvzdvLBjkicoMzkl+e5QOq9wPHoKfTIbvmMe1l1Aa
    -uAiQACXRQbQeRrXix1u2TW8zJqzKeECKIuf78JV5RZkVdiANWcLTHucEJzdihX2J
    -j4UwVFieb2dQFxI/t1NNcxb896fFEjLLl5xqB0FIDRxMQqw5byOFnIjqE/QRpymE
    -l/eDkOA7t3fw9zpn3L3kFQZaEz+7BoA89jH16yW8jME7sjFBHAAz4q5cF0AImc5Z
    -p8R1lles6d8aQZO5LWbJpHDP8bq3SUoHkiaTUGhJG8lyaKnpanfK6DsFmDXMJ8Z+
    -5b1FfRBRtyUCQv4QIB6hyHvekvtmB6WtuqCf7YPTlyRCWFyupi+KOaDQiYIBJULY
    -gTzwd7E3V6HOxsCUzD+1KZ09DZ2Y81L114DQjU7K0vIuQcP/5arQydwh6Nh887K2
    -G4nOZjmEqRmwWL+JtAKlKV6SC4sKrM4VJOCFTNB/Ei7hXWaKtoeXG7oT4ue39uJ6
    -KQpJ1g5aRLGW3zZAcxuHKUTEPawwGtGhcYJWutO8MYgQA0aJpdayGCitEcAFbPx6
    -iYEOPrFP7mZj6qr1+BosyQUHousZSSS53nCqK7j8CuDupg5oBlJJm6VFuogJi3KD
    -M2xOVgQ9eNI7d71Mey5J1PpqI8fEdYZZdyeFZS/q63iJnAjn9j5qxn8w4YWEbnCy
    -QOYRetPrZzNtXrg6yt68ECSCRm7E+VX3Ek+RSf7uC3XYYcztIs05S05AcfGDG4pj
    -idSw9Zc1OUz50eCn0XHTPt1g7Kj22+dtf992lDRIuL2/l/0AiN3EJ3chmGtZAA5R
    -BYgepXF3Zw8zj5m/SiVcWh61cmDHxLT+ATJSTD/lM51WezBfhcekneBwnd3re/Bt
    -Y4ehEaVnh4XAsBlVAgcPx7Ub59PypzxMPVEHXuyzvXz2sDBY2seoCXXBpNxLoPt8
    -3wLgHSZcxv2a51+aApiiIbYaqvlXlEjeTrTa6skez6tYCkG1WalA3Xp/pgT+CiL2
    -eOxeyZXcCLNhKMihhnRFMR/GsVFoiZAVotwL6qv3W6u2emEq9muyblwVbi1VK1gv
    -rW4yvo6x0t+8OyNzcK2RdiLd96HFLzvtK6zkAYxXWPwPrGkd2h+QP+S030KFzifE
    -Qd0mEt8t7bG0ngprmvUcKjPl2magb2DOPPQEg/kKRsrvfgQ3BuG+6XlCTUGQ4XzQ
    -TGeeJ+JmQlQbIuqE9Kk/oQ4pZFUbA5sGLakKDOJmSa9txoH9cx1uEW/VvZP9M+Bg
    -PYOY2vDryPkyQfWCcFH77Vcx0JoHYr/ChH4HyEEedhYSGsX3XMQItylqyA1fMxY8
    -EdrQCwb0TyWvHISJRROyzjT0S8HwhvshLdN+/HPcXaIuqX0KteeeiOlxgXwhpGLy
    -cBRM03t/3vnuVkfEDLlr6jX6eD3QJrFMcmxEsWbD2EFxWYV9Xcz3LzKkEeDKVopz
    -K4DgFqLKYfuvzS+tvHvZRwgHS7wi3xuKaUEP1UJlzCricnunOFuRzQA1uNSOXkux
    -0RzNZaZ5g/y6AZ906YR8H2lZA/gicTdjCMItF9dEzLEUoN1kvzMGs3dKbipoPVoA
    -KxQ8yQbbj1dEBxzJynN3MiJgMcDfp9tMsKBG3r6HjJ+Uadv5oFsjWesKPp7mPAi4
    -omurQeW6o+H0YffOcb1eTLHg+LN4BNbk6h0RRqgQ3L6z1M7h8anxeD+yXyhW5+Jw
    -WctDQx5jiut7Ip3HSWdezmovoZIdSJpiws6FBRhC25Vxqr0mTdiFJF15uVa1jTbi
    -hhqn9iK/DlKtUJHeCzWoQV93ytLbC79B0W87FiR4GRP4KkwCxBf9kzEg/RnTRDfq
    -7rzALOSniMV1cTuf/6j617X1SAh1qZfG2FnBdHLgZlNAbTuhRunxywN4fbqb/SP0
    -q72T8HZszRhwP7/96E9jh3cUwwM2HsxUwU8ZzqCn916BpKr8s5KBZUxPhhbloTpx
    -hrLgrJWRPVb6iWG9ZEu57wtKfokYqQOOXe2YNBJHsHc8nfdCR56QHVmefegiYK33
    -2NVoKU1jDqkX9027OmQ4htz5dGx0pbjK4MSeDJ36GxwD8U0Q4msPeQW54RPqxcoY
    -PujznEdH1NVzQ6YXTpgU9HLUZ6vC9WhZXKFrg8y/XUzE9/sxfxny/B8ZLXcZn78f
    -6aGFeBCkFvANLrM0H1y0k2O2GJIViAYtxSOdaBsOjTSUKul94vbROx+mtLF5UDJe
    -pwyT0SsHVzhLGdad3opYWdc6bqUn7aStRSARie/5nbdR9I7PbeZZA7VFaCQJ1H/U
    -ulx+q+HaIg5Ezf8fkGZsl8Cg9SpVlksfY4vtOYSIknnXa1hWlstzhdIv7VfHO5EB
    -hu2rmp5MB3G1kq4K+UGAu6YRcIn5bxClDI23RyXaCkeJCnIDzvwKyUbL6/WVkqzz
    -GGMk77a6NMl6XrTDqsH3LKJ8TWnEqsnLBXSHaHO2PWjzpLPkfI+vOkwKGeIIWaJ9
    -igPfniHuWV151YL/G69HyZTW4jhaKkhX3lQKBS65CuSmklkJxq/5AWIRuwzYjjYK
    -OgYcYFMVL2/tY935gknaD2J/5xnHwHRrtZRNGPey9Hd6p0ksi46ZJ7XQRuuMondz
    -cfKQydIrHVvnIwDfJDy4EPqt5GeAfNjLg2rLUOfVw8oqThESn5NEcfa5RG8R+2R7
    -onxInC54qim6Fq+yzbeONrk+NEtqRvLkQntxaIja3JgWBRQuJeJnMI+o0RputUoX
    -H6gvk0N8u28lqkfJBjPTkExm9Phg+FRqhVEpL6k6U5fq0QT3Z1r5CgurNgUWaEaV
    -vxFKlKMAz07+vMguDY0ojYJhY2sLY2yXBVxcteAG5Ka+WOiZckI4Z5Oc99fcc/nx
    -aS0Q9ADMyEb1Zs+IwvSEBEKRrJdIw63+NPWT+SPxyNYFYxdpBEX96QWdDdWXluh8
    -sdhJllvEpdNWB1/IgIX3o+aUIVz5/Duk51A40mSBiF8PYw8A/JhFXTR0VmS8dyR3
    -N3x4Mp0Z43PmhvDVNPfowrwQjsytWVc5UrEkH6frV6td32Os9BlGl+sBvUrWJS7K
    -aoBDnoXAGx/jZ3pMGeIpPbP26HrezMkZ5JndFtth+EIDPYpx+Us7jK7DOtWuzm0o
    -ZmMECIi+P8R5WubU2O9Y4urhGK+vvc3ANtVAIf+X1Iqxi3m/H4valXU0cW7dXWMX
    -AYS3i29FJoEun3mVT/f648zPm/oZsyxEO22is5GYPKAb27tKvTJur8li9aiWc1a+
    -AQpOj+qAXw67j53RzEcz6GhP6ggORgNABiuAmlFkRiJcDx69JLEorwSXL0TtCIJY
    -Z4P+CEELqJs0BOMOirSdv9mXJ+hfllpkjyna8J06cW1le7isF+wCpBb5iMQel2Qm
    -5k3NCwlDsBGwQTtyCB753qka+141l9CEOcxcudUCKu8laMRLmsO8BF2J1Id298eU
    -eNuNQOlMRuQZVYhhEmJ3lDo0WmF46mihFCQjqq+RAsYJvpU3C84dCh7bn8iCqA8A
    -3LgfNBrGzMy5oVseJ673ZnTfzRwNnkGMumSaxQBLy4dBE4iVU5va1RLKd0/Hz7TL
    -iHgyxox4kDqHLle0TDAzKQfQaKbwIH1Btt21SSU0tXwBSzbBKJ4VhMXLZ1Sr09v4
    -t1VuFu6BwAw8TsNDGN55nJIBkASdVdu1sGjqGzzsoZN4hQMO4TsLS8Jqvs/57V0b
    -XQ1ZL4Bd42Yvt+pXB0d/ViqL7cAgorNZ4RHkDW27cTpWCPAm4kSzPGocptJLZ6oa
    -2kE8ffG9zkZqbbnfEM5FK44tADrOrg4gktV3WUmi0mLnAv3Xu/znRka7CdB96NlK
    -8LfOcoRbksXZsIEfazzV5RsGRSer/dVWekdhHGssbZF41s26SsxTdTooluq+Ajyb
    -+rlGABCaOQOCLubEwkaMZuLvx8FW5E/B+k51H6BzuU8rLzqX5Lek+jQR0OM+6uIY
    -6LOCkJov+UEeCoTycTLqjw5m4o0QEE9u1rd6hD/Rk6ccoATRkWQFFn8P88dhFThv
    -9H88C+eFtpQym3dRtlLpDVzMijNrxav90f1dI+GMIBMzzd6nUp/TTPaBOoBnfLyX
    -7Euvjv88mkHvLI+u6E9kS7vsdvMHKXRvtvHTFS6g5USToBj49IpY5YtITY1l6Z3N
    -f4DgsucNCsfZSgYG3AKX0Ec2QD1Respbh53Hutlg6HV1R8PYbyq0VM7aGxZdGGvu
    -kSfHQxlm6vHNGPR8Dtlw2QVtYNPRkDDj+7jjI8IO4a6glyo5AUjacSL2aB7f4pNg
    -DHIJgnDLAa7ysy7B/7iNaWsNiIvoj94t6kYB01IpPhF6MtplcWpZ9J1eT4ibkQr2
    -tHwTwB4fx+BBvkNt+88bYI3mhIRvAlAGlqFC1PoZRNGEnqeWaGF8vaH9DjR5tEtJ
    -2E+2JpfbMtVXc92NhWwM8Oi9SUVnomJipueHMv9JfsGPw+SxGYYZXESE242CjEKR
    -JFsHa/nyWx3I6hzARSQxWPcTsJTNTBRl7k72WKPz2kQKRqz6yRNDPqOk12yu2Y0B
    -jHwctRvYQV78rquQ+NqAIWRD7GouWurIsxSVjZ8NYY8wtLRKGa//25KOneZQS/c1
    -5WkivpVNi+u55yOMrZIE+heG1jTodN/RMh1xoWghpUbMgcVHaIxu3GU7YHKu//Wd
    -n8RT3NzRYUPjXOOs9R0KKVNlLF4NMJ6QNeM6hsX899TF8iXzcOcaIfHIr8r5aDsc
    -vNVL3QLzavULIhKisfolEkCxb0THJLuNzRBMKFZh4d6yDYlstvumc5litgHllKTW
    -cRd8nURuvXIpVqdi6qhN1C5uWM4ln8msG03seaTA7WrMn8Txg8hDQoUbXOyPiG3A
    -7dCluZMCuhgRHqP+K8vnsYLOl4L4jj5giQwFpMXnX8rKh3VBZm8Hvr16Ib6PRQic
    -gpspY0FGmyRV7ATMwEOB99+DEtlrPS4P+3YPrJZl2uZhPsXW99N15QHuoACM7ojK
    -SH7prxgAIWgDVtIHjo6s+tmzs05Eo1VhQxzS7fX2E9gs3Sl3bDFSWkLQVQI5KHG4
    -1mEy/ZCMH8qEzjLCYJihdls6uTF6HJF7it19C6jOVsHxPaAnJzxpIJ5eRo36/94z
    -FhkpSyqT7NFEtZs06NIXHU3xYP8U8mcwxd3J3sWPJbvFqY8l7UMwlefCryluB3Qg
    -v3Dsux7ArsD5AcmuKog65jUH5oD4TEJAJgc557dSkgAnMm7GfWUiDL3ZA7ICOUy4
    -O8MyMZQ1MmkDa5yvKGOPqPncvqXEp5bm71wOZd5JAkhOEOADesGsuB5+FfuZaYAF
    -baOhjYPshnfLqhsJzCerNnfuJiNxWjFK2MFAkl0N36A1LJ3YNvwZmPGJptPIzdI5
    -pSWW3XNbqvVzyJNlICKnQnXuddTbI3PKGWtVzkkxiFZWGB9dFeQUN30HCn3frs+T
    -uVhNKJk19H+8qwxzTb73GxtS3Qw7RGSQVt9nqvcoZm4QEuxwqgiq4on0cicGs8pP
    -jeU0YIcMWq7LSjv12sbg31PY/Fi+Y+XAzZkzQPCBvBzWcSlsSf5+srqPCm02rMDK
    -0bG+c7jLwOpFsmM5lEQVsz0W4nEQLTmOKbddlzwbOM8TZyNmawZ4uGF3ONqeQISm
    -iDcxZHD7WULe/Ij6Tu0K9J+veSJNTRRSAxfCfHKs2pAcud3fWB71hIxez+D7GUkB
    -GBU3zV2zWJONKFwlGoM4l269QDN0MoknyInqtDi/+h3aEQfVCwpaVeICtrvVEaym
    -3PkRjuInbYw++QPOCE3rcQHjMsYy1c5hGT9f9z+g3pKFWJUwJ3UugUc/DSP0+Zum
    -+alLG1slmWZ953vMOw0yQZxaDuQvKI0bU5XA8IPlGi7BmfqKfDbFve85qvYol6jW
    -vlcy2Kx1+Xv6t+zvP+XUW2mY04FYMLi62fkpGNwkahbaovs4Bos07vkT/v3hXKvY
    -wwihUOOXPiNuPGzLlF2XvfvS1m3FUUO3ebzZ0Ql0XB0M3Hkp/RK0wsQ3vd0qrZub
    -yf/HPm5A0x0B0E2R70cnJBfvA7QZkycaV+8Fa095nRU5VMMBDxkFacYLErNF+k1E
    -xVnNS4BKy4BI+URKRb99+tqbT29NSUEgSvcHCTBdos4Bwu84zdp6cF/aEoVtLZZd
    -/22cvp4BmK1j6GX6gGurbj2eKmp1v2NC+ekzoJkjmeD/zPyeQMEXBBcgKE68uFiD
    -ZGg2edV9RoBWedLo4cdhSAbLk6sQE57plzEcmUbMmIOzcZEQGzy1T2muARCN8BJ7
    -CNXL7IHvZtTZdUATaM64kExnKDBITGeqyE7ihFyhfMS0SwgQhNFQRlQ3OsGIOHHe
    -6d/bjPdCDpG8Y/Mpb13bRfxNZIViAaEH9fN+PDIzOLfydIEavuv/Ko/m8pWocg2B
    -oACf0wWdgSTg+JyXf8/QHmAyYPH6kubRxUnGdBv4cLA9fr2cerbJ8FOoNmm63gPg
    -b4dPzj6jD7b7LK1qnXuwxUuA0hFOudka+m8udrtT1O48nkSU4d9GeySg2YgaKGU1
    -ZZnKsa3p5HQNixd0RAk6+a6pfNUbPPq7b+zzXA6zbIRzpxuSCd2W1V068SZMUX0w
    -dAFsptC61pxKDL607wfjgyMX9Z8t8YC+O3nLWw+VcWw0N1W2Hx/6EV9cr7cErowZ
    -+iO652QjZYgKWigEuteUveN5gjSTUY7M8rzgomMQ029fLFpS5+Y0puAj2eaxK1GM
    -7OGD2LwqbDkKJCn2GC8BC0M/C1rZ5ar4RlKMkz7HW3e6V3biGoKEl/9OJMb5IT+F
    -CocVd03TD2T4k0iE4UfMvL9yBR26pWnUySrXdV9FDElXdgr4IOObzm/odkNI1B9c
    -FCFUbcDxjq/MYypoI1NDQxBvqEB0lVq/mUHUJr/pHijX9Pg+usS/Eb1kkoBq3xpM
    -/Ms7RZ44HyrWY4zcwKnxD3yhl+wMS0tsa9fnSuZOvLl0w3GGFkxRPUtRmlw/mepx
    -YjnyV40OK8Acj+FBAEbWKfipPLbVvLOefa+gP8A9o00nncSFqSj7cOd5ZrXL9e82
    -yAhaRG2/meVXKc/yu2teG5aGxDDoAigS1ee7Uahs9BkT45C8nSixJd0KP7Or3TQ0
    -CzteKaiggOZTZvGXpCx1uSphmmoyvoTONqbHMhL3B9o67flnVY/DgI6uoHezP9tu
    -X7Wh2buTmTbt0T9/DpEdv8ecVgfFiLXd0MT2KvqtdjDNrSCyhUlaBtKG5GqrsbDv
    -BBk0+8wdHwZM6LX8SdP/mdhRKA9rqntHP7k7esuaPDfzYgam9dV1DDzmLJqzCq/G
    -YqbTTMXMqJa+ZAgypx12miTX+NruXeaDyU0qlIuLiKN0Z0leoVBQyr3k92i1fqE0
    -92J5uil1izqhI92tLCx5w4SaqPoeZknrmc8kRBhMlKyipd8F9DuJ09YlURSRYe2u
    -38rjtwj/8UUV/z77Ih3rWa7MIFMA7qJtfHOJVK6oeF/GSpW4K/O4ofQrtwAPQP3O
    -SRAS9M7q9+5zzw9MqZ6APqevKEwtQfKrnz6+l0o7wDoej2k0bKg029QbG0QugHhw
    -bda3ILEB5LsXlXZkTbgGtZD1Z9LGQqMaqCSf311J6c08MDg5ggJXhvlYQkJwFMwg
    -zjaUlMuFRX0TAmm89ezPD0BWcAhxB0lJ8I2R1KC6Ltz1Wqhc4A8PQLlDDbBD3fsz
    -7U7xR2HP2Pt3LuegOLu2Kl9I4fWovjbAPK+qfLjmDGUszm4XiIaASToFau5PX254
    -AuchG5lqv/oHWA+qs/0POk8Ew//ShM+72mgxoxhrU2Qe23FDstF9gvpZpVjJmHEJ
    -lbrBTSFQKoT4fosqXuu1DGAa/PvH0zNb2Uw6r61FptCSyZbife8+n5Zf1926nBUa
    -mud1cUsrAA2GBOus2c1Jh8N6nRfIb08KsGqio4FzsfmKZDc+EojHZ86RpnBQ+RSy
    -z9CnotQrG/YgCSn1n4hCgXzONdLfh/eIeEX3fk8q6Do3j6CC9hDUaLk70ApJT3Uy
    -RGw11Z5/Qa2PIN28ERcb02kP668zUqYMadjylaEIW5AXcsSZFgd9UUpcp81cV1G0
    -+o7HRTiE7/UgA2kXPcFBxT6n7Xppszg+VlG10SRBcKO8CvMQ47lEMHICr4fzuCMi
    -uL2q0Pin5hk3ur2Ivvbc0Q5bfUUeuwsnKzJIMjeGtyANjeQnaWdqNkCFkMBSUoW5
    -uBVkmxXnTV8Qfksf0UsBUJn8SzbyD2QIXxyDyTjs6JHQHKXsc7fWmvRP08PfCoFa
    -YziDM5aCPUWtfnKoO+rYa3FkOxloK5eY0bsglmtVd/yBvU98nHAQpLgZYC0OXW7Z
    -IjjUg/jyql2dYUWnRQ9lm58Lv9mNRZoWGxgv5rJB9S20iL9UFi3tXrtiIoTRCFUE
    -kG0qMJMhAmIrmhX1cYn3xJKG5qDR6Mxw8+bdrA/poYGM0js0XytrSEY/N5Wnkakq
    -YLg5FeCUNO4gBb9QLUWXZqvJyo8+2ZlRbbRkyL3cCUj+RP8VA/osYjGBbEsMHsl+
    -Vj170Hps9u1oDjqGsBuSRoHbq4pbWw3d1vox2nVbafwch+yZbVdSMPP5TXjUu2yn
    -Lj6PAQQ1h+hba3gP/hYP3YP6iBZZRNAslwWNQmja2vvSebiI5Eb4MeTNHjWwoqJw
    -b6Nsqb2iPKv7StCjMzROGut+FO6PCa58HrFYM+wx0AMJVACOjjiO/FigNWsYTJ9t
    -FX/44K0XenmmOaYLu6q78P9yP+5VH8vJSy5OHtl6XT0Dkb/8a6zPKzKPp/j54smq
    -oMD+ILabAJpN1Dn8l8o2OkHggIVYv1KgZYceqKgdQiC8SFQ+Z7gYPC7vvKnIME1N
    -QZ9Bt72OQ4fVaFNtXBxKZOOqLulRNu7m/LoW6lrDjvfKIfsNZXJptW4Z37YmjCPu
    -UaG21+MYH6xVH3RQgQKpbKzV23TVNHmrhcGWY5fMPx9/fsFG22U8WTlDD0fpwmNj
    -nxaFKo3gVMPQCPPPplcTBkeDWXGDj/XkWWv5uSJcZF6TOF0KZnXeeRkmIChAyxI6
    -lCOt0r/HlYaOccYnqFu7YOIcC0VlasjB73T7VvSou9hDeY6TUojpZi+e+lf2hE7x
    -TF2yHsBN8Hn+FrRo4YRxpyI1qwm1p3JDAm6H14wyrLhYVsXIUQbZwOARwc35+9EL
    -H0Qt6tqYsQ+IYo7j4YwOjaY4YC2v5sEFzl8Dwbn7tLUDqEQSYtbLmgAFtb2hza43
    -2w5EUejcsC1vJbtV+Bn6ZdmY3DhhpFDN5WypbLQ1NJ5uTh5VINERs++0RtAcS3Su
    -+RyG0xTVM/FonN+M3e6qcN6pN1bZEogmGjycJLPrOre1TtzNqPKymlCd3U14FBtq
    -Q9xT9C3qZ5rpX+cOxjyXM7oZjLcohEH/zOOqnR7QiQz9KsJzlfT6Szm8uoRhmgFJ
    -YgtFs1yVRbj5Z3P0dRn6mJAOwqGqhHczwtumqKmu4/mD+C9HXjglJXLWKRpm9lB3
    -N5a8tVg40uH9dnnu5QcTr1flZPaP9ZXfWlu2ZyJGKDk/kUsykP2xiqp5k9MRQfdH
    -jSIqLaNIM0Fw3NSHtZ7uqyat7Rl7KF4Agc3UpFhqDG2NdSXeSDjPGgS1ld1SgMKg
    -oj54NdQyAhP48PrP5A/lEFRJvR/4+HlV4SOfZ5tzoOmNQ3wWkoKzA6xgXF6igctB
    -ptYhQH/ZEWBNNdYgKweDtuPSsXGwwABMzb4WtDj3A5xX/J6U8ZxagpD5+STuAzBE
    -DVSbVNtLG+eHA8zFp9qT20oKOpTbZwdqZsnTZKDsznHEL/ia64hfkWlDFMEpJTqn
    -88A6oXutLqp776j5u7r0yu46or6X/A0A0JmMwj+aTOJm6OdW0N+o3La0mWIQeLf3
    -zaYRqZXVhwpWU5zhLB+rlomSxPJRFEpzzsHnZDwTw9MJYz6sMVKyBUNRQH7eNCGc
    -ZQ4OS4t5K2I3kBw9DKkqTlPQvQL71ekX1HInsQ4fcfsoIGdnmIkf8uSfbd7v2lQc
    -BWzoKGz+UBlQCng+nR9XG8hkS2CbqrQ/w8g0IHzJ5Ffj8PEQCap43gtpbbXIB4zA
    -jLFxVkWnsDdntACHAAXzCtzlkEpShp5yC3/l4m+D3vvW3YY3szi8QESQ2j1at9mb
    -vsAXq7aw/sLm0Dr7eYIJnA2dfvBKq6EzjAR31O3KWB7ytb7wTQSXSxBYS9d2Qo5d
    -+ATELtZIVTZFxwXcmJjY+WnZ850z/0NUYLjZYO/fiudrDYoUtYcm6a6qH/+QLkYQ
    -SPNe4FTeFWoQxb0UGW0uDhD5qbDRtIE/IAh+Azf9kmT/HWp036aUZyh9WnqJ+OOz
    -6Vu2X0Tdzz8f/shYEAkxL7zYeXYu8JK6Kxj3m9Rj/2DO8I8Ih/hczaF33izGg0Hr
    -SQ46oIp2b6ZkLiuKqv7LZL71/xHSUi8UiNkd4OAOz7VSSTRKI5ee+fBYx9OgYzx4
    -m1OCThPfJ2vDhZInO1WpJ4nCLMx0TfCpvKbiVZOYR6L+FeM4nwXgj0TuJHz3tOQm
    -g/Fnt1swm8/zlVUXNwZfh6tjRsF09y0XDPFJxIKfNuDhvCg9rpgjvOX1sDsCAlwq
    -4SUAstH49W8XMiakuNEKeg1quCVqJJIznRFx8vtMNJt9X9+oO8a2n6DS3xdQiyHp
    -jkwEhyQl9COkQOltED7ocMsTMB80KgVZLUuXCZ0UzX11xy3UzKd3UuQXzttH9pza
    -doNjxAAO36gjdkXtPrCTl5bAOZqTG0mNUFzpq0oIbu0dHUlgX/7zLHH1iElQ1jjz
    -oaHspzoc38QdVAHtOcrdJ3LwT8798Rlwfaa4uNqfOEJ8/PmtO5pRjRgxAI3aG0cF
    -oE5obvSUe4Bzh0ampaDVlMDc9OO6FCbc3AmRyR4U3UKwnLxM3UmJTU1RiKpVlVUx
    -JuICDld5c/6JkGWvZTJ6c9gsLrTA7xwX2mypUZ+9Z0sgOT5i756lLphRzdGIY/O4
    -CaIv1Duyts18vxZCkbGWWKc4Vw3IXeLzvadUim7BI+tokpI4gHeLjxDaNSTU1Dxx
    -jdSNc6wm56GF/FvOCLV+p1qdz6hVIC/RNs8raj5NSxMJpyLQMbQiVP1FSGhnuH09
    -2sy6vRxHiDKtUre4HZo/g9VbNwqdV1N2PcW3Z9Sojx20BWWGE/9tuCB7FxO3MT6L
    -siUi94oVWoMDzHREvZgSltqY4K8oXPwFi9feV6VxCa8OilFeiYAsPXe7ciQCmQ4x
    -vQabBC5Y2HIMvzAMsRH7Xdk9ViJKWFViXz13fX7IqHEYtWxYOuRY2bbglv80Beu5
    -uZ2GhAae48m8tpXhjEM3CKx1AsXRb7IyCQ2AG5g+BMfP9h+qAuC8MMe48zLbKX9a
    -oPLNEWgSA+lpbbQB7G88fvIKi2/0KVzeYf0mJewknyB/blKemHjejfso/5wYksmf
    -zxMz39OAqd0oYVrDRYt0D84gubNbT1h0EMu2nlD6aRG2AO+PG3uCwwfQ8Ktz0t95
    -RW7RHFEdLZq6UeOeatGUvsUjhALrVF4GVZT55j4FK40eaZ9UFsKhMHTVDY9muHkM
    -2T2+8YML+Fn89IJrvK9q5e3VJrGWpLHOb3ptcgqJO2v9/5mJy4V1pkd5dZpEPPVl
    -XxpELLJH0Fw7ZR02mXFY0grqxHUGUlUBTzt79/GhaWOnoUx4/Jf/IJo2F3o8LyvW
    -ib93L12J2Ors1qXYdhxlB3HXhzliE1ZIGta3z37xy3IBYUqXAOZFQ1pBB58/z7lN
    -WHfnMngofrl/HhqhgE8mY3dE3HYNCvRWYtgTIVQ3BtvHb+9CNtLKArWhL/qVwP4q
    -gAypmzBAKoCTLIf1YkrOY/7TFadNH0LKcxwzt6ypGlZWw3gxfTGF46ikRRy9qcjk
    -6i0x5bgyn2XJktUIJ7ODru6SYTmH+iZwN0Eb5kDFmJyhDI5ufjmD/AtvNg/LA49e
    -0SYSy69i5+g111przuA+3CGsa8Cy6dt6j0UrpxsvJfCawvPZOfD7Zp7T08SQ9rQA
    -5p8Axms768kfOCMLYr1C+bTzORKYPOkHJgK1SVOVgf52SgLq2GhzCWmJu2Nx2wZq
    -5EXDbtcvkzpuTQUA6eTfYuQ3Vx4/t8IqfuXe2wT9WFZZNKAJgOdpR8RVCIdcT8G0
    -XQgBKKsqL2LMh6bAiElf8hKB7sUpcY2Mxgwv3jiu+F5phlBa3IoAmflezfBAKPFu
    -0s6ki5+xjoez3jYM4EZ+cJYa9EOtM7/EhqO5syIKVZg75PeH8bvhPV29UEobaXiz
    -OGIvOq4vm45wta/zWNmlG2QWtrFXEZuyXQCsVJKp98rA7qXAmp/e1sk5y2wQ4XJ9
    -NgZWaGMN/hEFJe64V8O3YR+JYFVNhlf9r5V9tZQtuYlCtyAwfe1A6CaaVywAsMLi
    -bNQqX3cVaxipkTEYxke/tHwCv4KPuotbvZ6AUeYiTlit5lmTJJ8cVSpFcJXJmN9T
    -4DN8aL2Usbv5wqT3gsivJe5kCuxCBOuoyd59ROUmiptSWO2venHmgq2iyO+m8xYp
    -HLzm/vdsSZkdU8bd2YrHgZGzP+2sAvgGtmLkfxXkS9G9+60HhZu4SxkO9HM54vNX
    -iCETN+ifc//eq1gWpNWndxNmkfvBIXadWchvRhuIsoUuRL6VanRScAnRrqhMSHdp
    -3mCvTxKtAeP/hB+TfJ356POG9Ba1xpv8EyJe1xwsbqQMTwDCjLdEkNYGqAWQzSji
    -QTvvnO+cFNrC95L1sMYjmkKJpD/ErWNc7WsZ0dOkzxIdSdQI8ZRuG0gDUsLueiuQ
    -HBHb/vQS/3Oe1iTTNhgk0ip4OPAusV0MCUepXxQPQHjIT00Me2z1Gr6RnHzJRdh5
    -tycHnHkFP6kMTu1NAv899rgGXGpuBT2GrnJu1i+O0VEy51j4I17SGh0ghGcegFOC
    -MfMSB7vUxkYaZIoDgm1QjBpoUw1dbvCdeX5t+ImQi58WTOJcM8G3ZrxIz3fdI4fD
    -YgWvsZBuu6nfMt0bCNetrQ9JkTO1e5/cxyg7pu2zIcWspEXu7UaGuh2UH+1F2Rwv
    -AYIqYNv2YXu2/EFPr9M70mJvMHGaeUOI0HLzQwKEVl1RWRTXIRBzw73PTAfs/d+4
    -IKqtn94brX6woBEidcNInes6PnN/l0CH294aQ+QZW0QzIwjnm1t9s92h8TnvCpbJ
    -qHXYDy3ECAdGlYpjeigcCSUpMzwZgz4083IMGDWymuQzbmKLtQdAJ93lZ17e1ChS
    -ArVB2X59G2QxljnzrpUx44kvr06sba7Ah7AfK26LNvFBDk0/hudxMgk5nfg58Q1z
    -ppB/a2AMGnYNrz53FjLABDrcVqH/b9qUgx+RvVubLzFim5K4CIOwEANrTCr3qtch
    -ccFhjqzavAc702dn1qCfpS9EWn/+x4fVedkak5k2L3YdJ+yI4hpaF56XvkeQsKC+
    -uPrUCvDI318Bouk8PYGLy77detPFCPg8w8D0miglnPFyc2kJSV76yh+hvK7s0fAa
    -RXnburWO/IH8aI0LYAgNlycMVwVMB8DHAHyCvE5S+2t3uRDNvV2DcsGyn71JRfMV
    -Lt17A263SBTt8ksraGA2xsA1gE4mbB5nbtelv/KqR2BMBIx7rGtAGfzCDRadMZOJ
    -TC4pG55D38SzfxUxLtLgMifjfU0SKifzhYe6ifrLC0YHrWfbfRo4xu6RA6nXoDo0
    -hBSIjhnqteau7TDmCRd+8bNr9x6zS9OwrAWFzZXfA++ot86YEv+96239P5anyAxZ
    -4lvc8OWK+vK1iATsGhL+0iJub4Z2YWPfY2AAe+By8M5ScOZZBW6Sx2FNQt2Lg37Y
    -R0o6f2NCN0DLvk87Gv/wTuH/wHfVkEpzpNKGfQvGccyfOPa8lzjvz29sAZQZIXWd
    -xBIe/OGDEI2lp/QJOBM6xeJwVyndPAvhiwmVRfIhJX1dZPYqwU86TLEq5q2W8lwv
    -1kxfRy73PdeL4xOpiU8LN5JgvO4w2s/SUF5MlYbYnGT9QovBmvFkqPEJGFBGYewB
    -zqrkjB1ux1bgHLTkq1l6tW5drC8xn+85XRktjCyl1ACXofQqOurPS8WglQfiGnQS
    -2Q8f9OYbmb3w9UMKkqfgRyuarH2eGkIIUMEfoG8UyLH5XirT3jQHWAsCSGSgxFH6
    -YgXqi0eJdCntq0+YWIP+L6bmFULl8wB9vbj1hZWQrqMImJXAaOWJi+VJD4LBd77J
    -w8IkgonYvYWmr0wbpjMFMznynP9IH+BOOaTJZegclC7hrmcUBqB8/p0KDYXvIY38
    -JNp819BnpvxXXEKVmmFQgvRqBXXw3wqt4jD7O4R2Eo2UKMAriifO5nX3IiuvBQhH
    -H5JsisrwuNL8QCJXhFln0ZmrnI72h7d7GC3k69n2IDVtYI2h6Tt5UZ1q0q/2zFU6
    -EASowTeTNg5C9xcqWTVKrdM4+SNjG6nonoujsk62SHzo3bg/SzuzeHWVwXfSiUXN
    -K6NS4OUtmkIjD4rFeu8ny4TbsTwXX3bCg71m6PFMPKdcXjskhydPkjiUJuwfcRie
    -VUQyit5g3OVOG8PXF+tovz94NS3ps8M1C791JPwre/TuCtjFHY5EzzBkffxYRjpq
    -RkylLVQiq1aD9CkPcnJjjvlNC9+lOH1ndwddq1zmUZbT84beYO6WDtqoAk+c3jJh
    -tsWjIUiDYq7MC5hq0t6k9NuO3jXg3XqtHEX5mwjU/6LPEf85UNI1n7amM8A5OFhv
    -zeSMgPWbHkS4hWYrTJtHrG3VfZQcb3nw4C7XBEfowu29WV3jeLxoA/gfrcwc+0vf
    -ulIN2dytSHU9TGcCqBOV83xcLBDfuSSkOsn5Fj1+EOsPia9DqeoxG7Y69RMihaqO
    -m3B5CsUg0NJ0Kw6xbTkdml8WdBhG87BLrw+/GabQXhZHvGkY3aYHF+gC1rYyEbC3
    -hDOCFSCSSxFTaD+mNhz+wCiVSGwLvvBcd0Gzr83c1KwoGY/GBnrwAno+SCd2RlU5
    -ARHO4a4Z1u8D+0bMXGEALgb7pqC6wqdiD9J0a/QTCxQVqtndvy1zDIjf2lKxoOQT
    -rmuLyp0v2sIaYZJv0y5eTfiIF2XHI55qa99JeeDUaCOfZgncQHxAan/QxFlJxKGv
    -T3DTn4W/7e1+Qe+Ke8oJ9ynV/HJ44h37+XG2eM8q4CY3FbhLYnESu6YBFydhUAqK
    -NtlDkWa8/5h4AfAbkMrSxo9TiKU4G34oyPOFzbzBd9D+2eBTnrXSWIBZJH3dJ1qt
    -p/y7O+RQhIpx8Ix3JJ0Fub9/TfIR1wEq0KeDIWuoiUKDrs4IMs/f7r86sLbu0thz
    -9mdSHH+zvRsy8C1G9UFsMn0EBDLnoDeZGWPFB+XL5gBWvorBDH9tjyj/P4CS96Wt
    -gMH2tAsUlCkQReQC/rECPNT9B3C3al8NC3r66Tv7ypDIBp+5SLh9KvmUYncihMu6
    -Qa1JaatGp9xwSUghRVjm1JMmcVfS2FDDzsq0CTAwfE+oZOhaRW6Uat32uEAuDBvB
    -0z4e8PDZG2t+bhARJR+yyjA4fob0WkNLs1ZFNv4umDPEBx53U6mxYjhfuKH2Wgy8
    -L43XhXQC08TnG9fbYwrSMgh37ZNC+eZKy7aK14Mnc+X6iy6hg7xjXRlRp1GzIeXW
    -yBjG5t2jnZQKL1aRuEUkcnzI0B/sIX3zHLdYYzss+Qdk7C5GKFMj+RVtxPwSq+qS
    -EgeWQpJ1Q9B0bt8rTGn/cKeuJeOKDFWUjt6ZExbGyQEg7eLU2do07E7ICqx2ciQV
    -UdzKqgtXVVKYfxxZNETIsr7BsfyZtyz4SHIiMxr99/xyu5TfYfzdC16JBOGyJIUA
    -BCLESJcSp7NUw8mHhtc/C5+MpBCAT5xgqAKGKyvb03+gezo3uTyisibYNv801kR5
    -ngPyuyBsD5Duw7biQd8KumY0K8HMcekDGe/wV36iPovEFu5KvWP1BO1d2kO7b6Ud
    -SkcJR12qdynvKg7JRfb7408yLUZ22amHw54kJQcX2fbnaejHF+jxjM416RxxeS84
    -GKiF2lx/xG6nYoXsiLfZMH5c6dTpqAFdXNeOFINdQRb6NHuf1w/sELEMJKBYKaGe
    -xLwbyGR7+pBqBJ3uvN1fAXy1aKwib1o8kSQFbR6C42Ssh5cL3840P6IFR6LuXmPk
    -R0CAflAiv6KOEsjgoVMMjBJNWBPf7GEzre46DEbscs7fjBRXzweo3ppUrBTnmZhS
    -6EfMaX7O+oXeknq1Z6iO6UmG4A7Y6mgNZSJIwHXSpSG5DJrD+TFccuBy0qsSqxCY
    -AS2SSnIJoewqCUb9DUNAdDlzqiRb2HsAD+rO/TUuLoNNTzuIzaI/ZnHucc3JDGpO
    -dvrl426s+bgzueLnsPhKP4dKQ6Ea+AgBNySRvHIytiSnG6gGELat2BsNljDWsSRK
    -5wlw5EjSFxx4+xY/Ipm/dQ4arKDUGCeE1lbbhmUgRQH+QGjAubuSCpwfq0v9w1pn
    -bQIQPDxVyAG40Q58RkLs8Y/JicrMpVDtMUgXU5ttpVFilVtCm2ZUCMVrUKpHl9KQ
    -AKOhZQeWwcPW2BYhGuUEiEY5sSSIRJy7hQVptrWFxaZov0SSqjGergNmcwZJcTeS
    -1U+vT71aw10cvPl2sPY3114utQPsK6ssBPD2dj3POooXA7+jBpv5s0Snl0cGefcG
    -5YlZypac2u0NRtF2oh0hkU46pVCCZ+hOUzuFYbvGmMCTyxRd1bSYNRvdj9gaTj7y
    -hljM/cw+au8mVEDBk1e/Iwo+UStLoF4F9nN/ZpUxYV1U/qHoB/aAzIDb+lgatiHx
    -KGe6g1eEDaBckHYFjzmhDbbtKFAvFohT+MBKb2iLtPgC0LcS3N4BPDxo2DcQjXzR
    -oDRT/BweLpI9gUSCSdjNfxNGHscQnPmEft/HIBKJwq6nBAVsUobIdyor9QsEabFZ
    -/THJXedfqyD88ibLUx/RZ24rzUjAPqI6Cb7TS4V0RfpJpM6qepY8nNtDuDESMtVS
    -E6zor6n8DX4qmYRDzgveVif5nmSC2QSLIrxBnzgA+HT3MYnCX05Pnhc17W9mjrLM
    -MorfanVYvO/kKEm1H0CAi35T36V+FeFRTVJl1HU+kZrfRaHPtTNvj71ppgicoPpi
    -QaTVAsTZbzyMW9TiI8BCDRZuQrXtzEDNeciGGlbgFSZ87wcHE0p0k9q8BdedBFPK
    -BGDfLyeYjn/bfmHIrHBHW4N5JvxQFgsM6jBzzkhS4IIQKXzSpyO5BTlDhcN7KKO2
    -WUxOUqpKRdfGn/PqwEY1KlDYfjBk58uGxrgK2fx4w8UYYqVFuyvrdBJi9qvAmUwW
    -Z/0n0AK14A+50a5uMA0U49fWjSXTZeZxuMRiTj+pS9pRnxaxLzS3OJf8N1m/31DC
    -1II0bIVXg2zwlk/PecRwmsK1XDvG/uIEEEVskSY4jNMaEWW5v2UuP2aZ2OyemCVv
    -xaiKJEnZbBx4o1ng4Hu37/mGJkW/TODdQhlYVwUGcf2Puzn05zyq0dLHYWZCM/yY
    -be+a43d0LBllSquH4CSCm72tSLNKHlvThxoWkrGmij/+nT2shb74L3inYbspgLAI
    -GEF+7GB9GgcnYPH3HagAxZzs1wcvwGA+G/WekhoK8EG72eh2C8wESxxunrjEERtg
    -/3GHSjOw8S9xPvfWUnGlcBRZknc3Qe00OBjEWLkJWV4P5KkbHhQiXzg8qfFy9std
    -/xEwFoA3ioJv7L6jLCLUqiRtLLvBSCAjxAGn4cmSMTPFAQHkA3hjMzBkJmH3vKhG
    -iBkGCYmMyUHHJewqp3rEPiNahvx2GiDZqrhjT+XMY2X6yuhbgWQQKVx2IPAzVgiv
    -OOWIePIVdljh1nRYcN69w3EyN239fNyjI2WGzDGX0BzDR+/kEKO2tPLQhC1vQfyP
    -m2JE47mnY5gOkj+dCibZ0/SSz8CoytUZDBOzjZtdWRZiA3Ld1PSnXRNN6kfWnDTK
    -mdpqhycU/5uH0xjAQBmiaLVLuOCXjKhFL1ZyAC9o/Fsri3MrJ6iJ8/b4BgcRlzQ/
    -uj7T3hdvoP5bTClIDuVmgOE5sMF4QLO5fiJ8EQpmMswti1l2mw3I/9ipu6G6w5fn
    -U53ocYJ4PVpy/irOmdyrdREm/S9d0g66aG4Px+fIehHq6fhaWz/At8zseAkyhSwa
    -Llhb5SEWiCXmXa9ntiUyNmIPENcaynl3BOIRUPGKiCffVOYAxfC74DTSa4I1smM0
    -ra7p/z0Dawy71IEkbKVS/2aphwx8HIIF+4tqcwRP6e3EAA9ykFjL2HV8vv/KNCSW
    -N6FWzxdvQrzIqfdv/go0lwwbuHBf/yysd5OueAKo52GzMUhnsej5BbqnwHWBs7sY
    -vIjFvzT85TGe2KXmF+UnuqqaO9h2aVPhHhx32neFSGshGSzEOo5SDOiTrr0w3TJL
    -fpobkNkohjq93H2HBakr33w71LGkCUak9JLxHMOAlvdhJMxGxxNzkKTs+ayHszmM
    -DA03nMQtMsii+NvkmAeYF/Jwv+NumcnkbQwtitry29zzusJyu6c5t98kIMkkrHXx
    -kuO33NjnOX+a4wEjNR6K/N13DtGj+zR8qu2yTRRxUPFCZcBY3dU5W8DCSLSe8Wgu
    -H6XfHsUINjO1piBeyd7KFXDbyTlh5WCKuxozLKQUNKMvRcLh+5UIE5hO0BXdzUIm
    -pKvJ4+S126702zOuGjLLShyrBpU01LUC8FI+ot46E23jzLWP83PywvBjSGLuXq39
    -703PsAhBRRLYmwxEbbYpbo/ljbn3PyONtbCATksnJvzLFVpDaLw2POvEph+f/SRd
    -nRTRZyJ93D/BbqoJG+VDFSObEMoVB2gnpn3zn3woxDp2uOBR64DDCLnO6K6IWfpI
    -HJbkW9425afR4HBXEqDHNtWHKJ8+LXkM5UiYMA3IDoYDwSGapHB1XUgel/GmCx6L
    -BlJCLFdjoEhJKSAdVp7rGsctaQG2MiDMm+ciQxgL/w0x+7yE1bJ9pfKRxBgB6VpZ
    -9iVPcnjNxX7BkKSpjcuwc64V+t1i3MfNswzsDvr9d2bjHodOr25ZSjnvqIHLdy/j
    -LNjP3uX5zqqJ6L2LDReUKhHmH6SdJanKvhj6qRJd1CCbCZ5egrRM9QZJBWF3robG
    -uVPtMbKDvCfcZ9RgZqbWSCJD5Ai6y1RXTQRN41830AA8dLaVFwHdtET+gBGsCMQt
    -sg/A4BC0ZWHgQDI0QiZYYec7bPP5ZjNoLIzOMHV1Hh8C2Gno6R5FVtwgLrqRX3D3
    -48MCcSIUgJ+9s7XTmBme9cC2faRPx+45uKaiOXpUDfFsbsuIOn2XYOsRbS7HFpUb
    -q2004MbUudRWH4v1toe961hI3cXfUH6Z+8w/sXC64XJu4xSFazWapABDSHAUE24A
    -YMbuXACE3TXBtC0LHE1/+ydrjWmJEOaq/wG6BvPMfmiqvk8wuUTkh580s8Z0QRR2
    -1Vau44v2V2r1VdHGDe3lSynZgp+ZtxEcIOXImDFYGBJTiLmU2py3ELolqXYPXTY4
    -pwIZC7+XorfHyjWsnIosXW/DwRxXvdxJEoLwiPY5/PS4m/FTudQGW4TIEbb+eqYE
    -El01uxNXTXQRACt3KEmmri5TbZIuy9753jRxtxpAbQNVeUwM4x5cj1tA0PxQHShF
    -YBpGL7slXDsHVnnemP5xnzxIZLCS3QFGa7banNfYI6gixCiEMJYgWxA+OB/oRVQy
    -Qe/iq3sJ4Fwp/HY0vM4BOB1iXESvGAeaRG7dyj6owCL/wn8K6ZzOljzX95d/hy/g
    -q6QPnbw/kjaimKyeDM5HmSEZ1/xzzum2r13E7/iBYvYZxGyFndXpEqO4YYTsCwP6
    -Ux6kiSLQD0QvO6/xrfCCkzVNz0DNz9tst8go7H70eoS7hWo1kjn2ciCL6bDYBmjz
    -zuZn9xmoeBepF2I8HChoqoAvLCm/a8nIhQ8S9UMQr90kcqGL70PKMS3VaFz97Tty
    -E18WhqOGrTm2uNc/mYo0KZmA7TMrHb0ZYARWbfvpPyC5qFeJwBYvx+W0YBYfknJd
    -zrNUvT5+sjAuzUtiAgk9h/ks3R6NmPvOeSNBlRKXbBdLBsTjdUynz0fXCp7hpakv
    -iB2ldflnf4O5DtGXPuAElzwqGKCWuNkyFjstsGegY6z62wdT5j4ARTzqTqM0BNHR
    -aWoD8EQQKpSCpTy/0W9X3gFYF70MEDJYgP2j8dmfENih2vk+r+qwWLZs/1NxSMCJ
    -3+IbvVGxylEeCxLMAeHWxAjT55RQqKw3ZaPqfPd7qevfoj25kN44yONvJ5QGmGWL
    -sAmu6R1iGVD/2mcEfPb05FyoQ7+cr/J6dUVhgDhO7l5NvEziXQvU2O3B71240maI
    -2KfJXkganH2Y11yMzvb5ebkBLejfzDYFZFDt1f2M2kPu88Qn3imsgbd+v88DDJ9S
    -D6LHAbjUcf6UWLfC8scO4UdmkLkEiICRGe8U0Xg0fn+voYznbom37Fir8C/umVma
    -NYWllf5CySl/wNBAmPJGR1SprHtrzC4O3CoT3Vc0XgdQNnBrGuiPoiJBkqulBkr8
    -qGJU75ADz2Z4QFZL7dNBSWmCOBwfFV6MA2Cn9BdUw5HDPRM3nxm9nL1ZmA/KFAqD
    -EF7emXLyaxg4z36++bGKHJYbG8QjhvOt9LIFMH3Ulv8SFoUmOCt8JI+9ab2uRBVY
    -unlI/KLQfoILLbCGTNW4CEwOMKhNBqlSptkT08WYDWT0oobQT6UKpqikwTCqfT8P
    -IbOk6N6k8L0SHkV2ej+TfGj7Z/9Koam2pCmj9Qej2mE8maK/4TfoN28XvO6ZSa2/
    -Y9Dm0rYheMNlQL4IEuFfAMxqEo99aY9V3e1zoWTGv6Q1TerQ2goO7TLfhu7IDIR6
    -RxAisIHg4uLzuEmpzOCwe+DIDOZ19B0r6pa7VdW5nob1KrnOYsRgtW5v96Sa3Qjg
    -xPJf35ELbkW20xr95zpATLUzh4ddFWYGlpPKPDKa/jruE/bvX66PNqyLH/mVP/dj
    -bIO9MBu0xNcoV3FmK4mAWniZwnUk0Q8donlaxGWy0Z3Jp+sEgft89Kp3zrw6N8ub
    -j1ubTmy5rZKpyOQYBNtwxBiz+SfjXSsq9BjBWRjcpif6tHGVCeQ25lORHrXHwnLN
    -DRNIAUlMTpi5VEV/0k7rspHaIrx1lGBpVZObBpBtRgL9dkFC4VzCdV4PwLBvkIEi
    -jvLClEcxrQeXZXs/vapbx62fLJZe8z8TS/0BiWZjIDnBgCtMj7EPbj+Dl6uy8usW
    -eTp/ZBjtfDgGaS0B3C5RZ99bYPuhWJGTvPqloZhKXFdFmGuvhamIjw+cmPa5ZF1r
    -wWnn0QAwXcae69u6fAwtoilKkwyMyapA5YtKR7BavpnmXwrb/5A0TCLQO8c6YpA0
    -dR2katyKeMcNChkAi2nclnZeCcF/J/G8L2TxXgWe/hh9H8845i92wj5nJXn8Z4UN
    -mtdFXYHFcetaikS1h1GWV5cTuXxfBqc+EvtPRkyYkmTgR6CatqcjwbcZt1/l6f6i
    -2Y8k927ghVS8WIhZQhCzWq7DpzWKgae9DrTmQIUJ5nCtF9NR2Dooa8M7/ctFZDjk
    -3bYu30+8ZlaGfmrUVauRwSi0rxW24eRLhKtt1Ml/4QFClaMtyccnVg2sS+w5BtNo
    -0WJVcTAItCWK5pQMcHGo3GVbXTFec+CE7VCAaRwiv+q6srE82NI8XrH466o3jTn3
    -QhvNp51eo9oFGxWUoKdBxMYHHXZC1lEOCFuoXRQyrPMM7lHA742ckW0oJ4uXGBuI
    -XsT/c/Am1JzMZBxpONVGDe6zKNyIfsCZeaGQ2sG/qF1NjeFAHMEOLv/KDjVkSBCo
    -5P9E7w502limcr0P+2JjLx12vHihvxrMeW0zhHu4CIf+BHJGav+CjAFelet74klN
    -jr8w618aHOZYXtw6Fhb+zSvHltJeT0ZXf6GWMvDig+I8lOG6h3cLk+IXslaWnF9N
    -0dWWy59QZE9FmxVkNAJsUeu/sRrRzK2H4VTzwoTFGbdPdhZ2hrTPgFAeLkysYJ+f
    -LZeUfiHYekg0Nx72w0o9ijIcnxiLSUIF5qKkSUfhyF591+Zl562d90p3cnat+8nV
    -BxfP0v1B2bkhfv/gk3MYqDRptfgAru6B4yz3UL9X1+FVWIVr6upGMIP7+b6KjOsu
    -0qrt4AHQcswNSaSOpAz4BMW3b1AnH/cKtZ4XzA4psJ5Dno+Sb9BODQyeg/+0Svh/
    -yy5x16r7OTr74QhcxAzWErA9wpdjb58QLOetHl1eK9ZnpoVJ6JO8kuQpUzTT+AsG
    -GWXM30zT3SiwlySwHpDjiN5q6IY7nX2Bj5eHY4QgEjrdPz2aHMmvPl5gQpkJE0bO
    -THoVQpWS5aQrby4jpwPaTZ7Qfud6ZLfwojg+PtBMjwukXUFd0+RnX8AnWe07sJZh
    -pGKYKYximMsieYr2I9Yt3fGpk7/x8qW0qp7ggh+gDCNuLAAPrpISAGBNzK+BGuJc
    -QtqD30bIHWd7bSUeQyboj1pNs3AEtMOQVMTVw4FtknZmRIWCO5WE1YAUWlhdRtos
    -1NMkUjHGQb08RzKcpQqBred0epeyVaPWL8AwX+WJvkrM7qTXdjCKwsog7wLpv+Dd
    -evOXBh766wvVmEkw+CRM9xvILQVh5oc3JgGoWii+h366Qw5aAUCiU1oax1/qdCGl
    -MIp02x68vEGCb40s1IECKKI5DR1vn7HTez+Bcmd7858I6aTllxogHxv0kP5RiSlZ
    -yzcvm651PXX0Jau0+0SUZ6p0rs8aUsL7P1rm4l7L991DPGrFejLhr1Ce+f7/sIfz
    -NM7cOP68T9xWi8qw3jcwZcpqOqqW/MT/X4i12F1XV/5g8sNpPKV1JKFS19JHC7zu
    -mCipZ0IwDisXjiD63spWDuhMyZ9EV5I/FUSymEzY7JkBbRHRRgDfAz6pzq/8J2Y9
    -M/+yornD6sNTubuYCqq1GGo8ySey2/Ove5f9xZ2KqzkjluhHV7HwbbB5WT7DNpJN
    -Cafg9Nia0crr5MdkHuQcWLyvgmiSr3guPGcN31V2t8O5knk66ckDEtGW+r16w74x
    -KLKUHmBd6ZFvLGLgRVtkVNVtcMpQW/BxvxaLCuC1fKh7uwfXxXcjKhGDDFKPDiI4
    -d/XO2CEZAhaMYgitOX1gRmReBzD9qmaITb4jW9/jETg/znY8tHkHjpeTfdfj+N3g
    -iOLfk3L1wf1b2l7isf1oipqzQPUUhU5Pl8AeYtAUrT/o0tFTd6JLqMrt6Bx1p4WD
    -GDsFAolaaE0n9im2gih2uVrm0/g9g6Tb0lKIGE0X25UV3hQJpIVhKGcXK+PhRFaz
    -D5GZ7z/MREtm2Y+dO7L6PjgzxcyVsV4mmEFlNp57uAxjPW9hMafJFiyFVPMEd/hE
    -mfPsPo9iP4AVedSWhhAENuYOLm1f3VV64ua+jaaoeAqglqjW6+DNge/ou8QOIwjE
    -IhxSzZhKX28mw6kPtnjtqP/8rHpeVBdy7dAvYKrAbZ2jhk3S/Dbz1RVIEgs5FnR4
    -vxkfUsPBRQPnbZDs+34StkLgu6RK+r3eSPzWv1velAQk0hPsx4FAFHJM85Qx8tS5
    -McYgz4GK9ziTVQDmJ2SabTO6l+84BpBGtFdBcQHr0us+1+G1Xe/rvp90KXFH/3OU
    -hmFSpgHFMJaAFOmzcOv96toe9ihm2sKNfv+E5h6+X/Jj1IopRaAEw1nqmpnbB8ZD
    -UIEPeRIqcjUUsSzGfWtCGTT1aAAD/WZxaARTPGvAG2aFHB6TOVoqKdUMcxXJbeXI
    -vMbN9RUNCgxw6YFz4tFNTjV7nhCNFuhCVxxjVIaruDqktp8BC7wR2gPyqsB5cw0T
    -MMLimMEklovY/osopd4wIRSxPgViG+mTLmeWl5gZsb9TVa2MbDiNYInNy0bVbkNu
    -MHb2LlfnjCIIGvQpuC5WbSrDrbnLXv8XGstP0kcEg7z7xDqIO45XvP0n11iHZdI4
    -f9bIiBwGmc1+a+2dodvCQ1/xVXjwa9ut3Eh9dmJb9DP9pf8rAS74PDwLKzhASVkX
    -dromsVUpAYL89hwwCdnvQYvfu0re8FqVx1EyJi0rQqfO2lEpyHEDzyjKdmHfL4HZ
    -JEotZZCeJrAipMd7YV+vvs+e1Aip4TZIIioRzS9MJczilfW/yeXU932iMCqnAd0U
    -8x1W65At0Cnkrwv+Ces55xEKljWYhDlWQtqyi7woomVG5FFS0hqH3ND/ECs0QgUB
    -cu1n0Y6aKqevI9tr+95FG0HaTfGMcrcLIiEHEY+72wmuS4sSIibE8L2ei0Qo9F6Z
    -WxwYEACxGrUHHnzQQ0wGwtwq6MpngqLmDIcBtycl9tqxpeKeuty9nvHq0qilT0m6
    -LLlPkG8BU5G4SMjvvJQ5TJ3rrL5BemT0q1Zvec9+m8DQVfx0vf/KpAI7gGL+CSSC
    -r+9gMuDcaEUNYsFy1gam6MB/+j8wORkBNekVB1Lb8f6T3n3trmEq5QqvthqgFtOn
    -qhO1EP4yu5qQZuJePFElQGKIItQqRZFe2/lEPbc/KD+2ef7KlY182U/5k8U3Yn1s
    -W6/l6pTjIbzCXeRISoIlsIKvdlog+xT48sGmG5wYlKcyxUsNKGtXOqzkpIxpJbvm
    -exp3gqE61tvbO3Luxr/URGQFE/EEq/TJugCx1Tba+jyFjNZ1UDCLTlsMCzSEumDn
    -qXStfFjH07MF2BYh3Grx1W3zHqxoa8WCKd6ly8ArWSunIU104OERTVX+RHBqxU0e
    -tWMig+xJ5ivlnhFC3p+/4ltEFVcCIZDgdK4yUa2cxOTizfBYkq3iWjrsY1Mbg2GI
    -LOT36rpqT5Ugs5dOVquGgAksyeYHGwWhqDSJRFEjxgPig9iBT6b6g1eUZ8aovEET
    -UhcoNTvnxm/2uW+Tfb305hUqDKmuVmK/cUAa+xfOFzDGGKCRhyQulnsf1ymkFBL2
    -ormSF+ScEUirgaal2E485ktaYrV0LPEcHXd1mkJIaiDUv5ZSwIUUBfh/IhrtXUbo
    -UnFxLi29yGeqE6ImQuvalKYlP0+6JzAn58J4FFCqKvqz0Ha4dvEkzw5ohaC4RotS
    -CtNX9X/eQmHJoRCcfXWYz7BvsA+6DRmI3oZuhec4lwro/19STg/tl0LeBf4TzsWy
    -KVrLD59JQQ/vq9m+oPf7V+d1dE8KYnF8IGVWan4SDm7iB+FXaQNzsIYyuaEs/4T2
    -ahLJx7g+yChtr0tDLmmUVSndT/OSKRPkq1HLP+EzAIlzAKti1vGCVCxtB+9GIjX3
    -pcFwdy8F/YHREA0m7YQCKBKjkJntPikatY5GzjGXEcYy1xuES0Pr/iNoNKlMIsqZ
    -dzUgf5SxsFwgXkeYgmrTMnSaJ7vkpnenvhpInNKHrjy98AH08dkIBAqOrqmWmZYk
    -0SKbTOsSe6/gE5ppMBg0zWRdUs9BEPTKO8TVCGW74X1yQzVWOLKsLZM/qf0D7p55
    -iOX1jNVaI2o9n83td/m9MQom5aCVd4ygOdqJNFXVIsdiZ1b+GkOAzUtW2dCcZ/BJ
    -6KJVIoHUWNpVAy0vweVaPZniu5mnQdIP6dyDZCxBfnsP6tdW09zwiWr3ZmhX2fgY
    -rxII/oiUHJ25n1EwhRETqrpxOEf2tNE75KJmeZk6ewejp/jciyGY0O66cG0+/l1V
    -tbcl57C2HrVX9odqfBNec24Pa1R251dy3xTVrmXvjQcj5xi8xZ6bOPtb5GprArXA
    -O9ZW6Ka4W6KABGrOqkarHiVknAKmqskN2YK3f0u65h7eUEHmsrhvTC69u3F3MHVs
    -9LRxtQjE/airJgK7QUD9d+HK76rzKamQsznwxxGg6amMxq3em8wQ1Q6UUK4zsQu8
    -Fr33qF2FmGGAPVfktQekzwuq/aAk3MXFiOU6OtEdM+rtR7vgk9B4b5r4OnY8lO3Q
    -ZFV1kwgEBnlMraHXiMZhiPSWVlsXOuSKox4nCTDdQIqnfF9JBVfKqMemta3+E4Sp
    -ydlj9iI6oRLOw1TRKHq2zFHjtr9pywfVFL+mFBfvh053l77wLw18ru57s6GuXjIA
    -5sbrbVfqTU9+dhZ28F1Dj1PofWDMp1yCoeAYsyBde9oebNQLek0U3+ZPygKggviR
    -6J8ylxJY32tz+WS2iA5hQmfyRLac1Da72S2ZTR8pIBPW81Xy5vFLE62rVyCmC1PJ
    -lM2PXBsUcMHJr9zw23VPaGiUPdMbMmXDgtDYS1pGlF0n1ro0eKLyEOQ9pvNF8xaO
    -Xzn2p6mhOfvxRSh1qoBrkRDYCYJCTmR0jK5Brnrr2gwSSmcJQMn2OJB8v6ovcFwR
    -VTquIKki/5BKmYRJATJmLz+1fYEa62HldnanlM+R2RbXb5MdDeHbID/BO+33BUDw
    -R0s85gBg4JzGSEl8uuP0Hqzn5qHlq/VYoyUh7hqrKndw6zIvLumm49hLKSJk28g/
    -l3+Dd9wX2+5OP+xjdo4BBiM/1ILCeMIcice4CuR4jPgb0KC8iwE/P4Kp52t7veJ6
    -Sztai+wfOjlrSuLHW+n5wIdcccCxcXTxurimuna9NYxBc8p4RYZeutmeYN3rpAS7
    -Wut1T0x5nZMropDYPAthel4Mj37iVlcSSNYO2TG9l//jpsS4iXhM6mktgkWZYmsY
    -t3f+CcGevz2jxJPMkvK/VbG5GpnXl3aSbxXZRiyGmZoVTKr/+JMZcj20FIVNg5Cz
    -Y0IMSO0I5Tyhu+v3o9dh1eKtTMRf8eDNBZGHH+91dZxLsC2goCqhqtEZEbpMIYl3
    -ZJmiz/tn0fmP/uReJvBaCgf1s7+1+zNWdcrNK0M3ZR5vxghLb+0Me2aYAEvdAnAI
    -YXA3UANkdX9zNW8ArYxVd2US4kB+9Ec79VEW9G+dcHfDiOO73cq8PLESM9CHai6M
    -1COf25mQ+zTqno9+V9RRjulBJrxtbgqu3p3h2h6P9na83Swr2zXzdusguD+cbH9j
    -XfmHDfVxi854MYQJGK7Xm+cHUZ8wi++16eS4G+P8x7xBy6MUxbCWYP6WIKoWKe86
    -iLe0WiayWwqyZEodVpnAsixF957cdIOeA7axZgVuV25obHenfhAzz82dKjNE+Jb8
    -S2SxaG5NqQs4sEN4D5zs75tEg/GGcR6iYYoCi1heHroblxSOD/q9iGuR8d3250Si
    -uhid8X+EL04YWqFJ7FM1dhQ6gTyidNiyrg53IJM9NLAHiWnrJBnO52n1JIsRjY4d
    -I4lCENBo+jF8wT5sf0eFGzJhAY+lzou8zUM9dg+x2CxP0BF3ho9x5WWpJZ0mwo1v
    -sFO4lSrfTF8N+fab00U5ST6xDAUkTHRbUD/0bHdZHVZHPMrRbuE5yQJB/VTl0Os7
    -71kJ68mcFVnASeFVjmefBiDFxQMwSk5yh+Hl9wc0TX3vcPOnwISbt0zIdCHEp8Vm
    -+i3cKZSn+tujy3bMFiUZAKztnkjriEU2jJ2xEWfEbiMCt6Pm9kSqKI7LDzwjdB0H
    -W9aHDYy0Au6zQTDDBR2h5wjLsv/crwCtWD0hgwbcdTPGHMKvOYjUTKTyU/ARMRoM
    -+7WVyCXcWA2GDGG/KUqdnXOjiqTcr6as/Ri3bk5ABTo4ZgQ7KqWRywIzu9Ka47C9
    -4o7dcLUWYkWCTv4ql805oJmLzQFtyjjM82Esawch6L1XJtVhdni8suh+Invf11m/
    -FC7T+jSr6YMrblPDBiHTkDUnfsyIyxn9g16tVVI7ZcSFCTi02d2tIFwskSq6nvYQ
    -MzPqb2StYYUQxTl7+kD6i2hoqIFoA4KvEz4rzA9vpREy51X/874CKfINZgMPDJtX
    -1Wwf5aOPnt21ClcRDzkQFkAsgEv7n3lwwT3+QJ8jbf867pGqineDkepphpx7FmzD
    -UQbRfVnuEl7id3cr28NA+vEq1cv5UbDrEI+AkWg6LgT9zT2G8B4jhiqbIV35fHSM
    -hv1ZWHUAITRACNXUva/aOGGkZg0ILgVVWddx6AfKJvc8XKiyNXZ2kYHotGHlMQwV
    -B4zsZQHyyAQts0N19tZ02JA9SbuGAdKf4XbTn9PIyJobBlUOK6PE9srFb1GJ8jD3
    -J6CzJj8AztIrFNP/dm0f5qw71OTIXBBt7FCh90123KqSchbIwAp2K+sTBc1086Y8
    -1rkpj5L/dLHE7/cLE2Fzz/zISscc0lIgDEtNDNs8fEJLhVR9XnY0Uk9pfHut5gxC
    -Y/Ze813JF829Si7SwPnOLCbez3N4Z44nYixifDTbLkgBYGWsjecO8T+FeXf+NMYO
    -HdFwSpuo3+d/xurLFlxVdeI3m7OpZoVDLzRhMaaCaF0QkO48qklXjc/MWY0ztxxU
    -ceHQRmwQsMcCBA9NFTZ9sQsgBN8KleXHoJ3wKwGoCiicH/vGfl8OhlxTdtOn3eRp
    -p5FDe8WuHzJDZYjDlX8d8G2L9R7wOdzvzCvnL3mIKVL3zHqecSE4O6ZvQqm/Jhos
    -GMMwZJH8bwylqjrMu2AiGiefDn0AAAAAtW7G9wABzZAD8to4/GMFSD4wDYsCAAAA
    -AAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-lzma2-1.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-lzma2-1.xz.base64
    deleted file mode 100644
    index 3f650c98e..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-lzma2-1.xz.base64
    +++ /dev/null
    @@ -1,11 +0,0 @@
    -begin-base64 644 tests/files/good-1-lzma2-1.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMT4ADiALZdACYbykZnWvJ3uH2G2EHbBTXN
    -g6V8EqUF25C9LxTTcXKWqIp9hFZxjWoimKuePZCALcdeDBJS0z8HCHscpHfzE7gX
    -wO6RgTmzh/D/ALNqUkHtLrDyZJekmp5joa4ZdA2p1Vts7rHgLNxh3Mudhs/h3Ap6
    -gRRf0EDIfg2XRM61wvwsWQi/A4Dc10SOs9Qt3uUWIW5HgqwIWdjkZilh1dH6SWOQ
    -ET4g0Kni1RSB2SPQj0OuRVU2aaoAwADlAK0LAIzxnUAr0H0dme7k3GN0ZEakoEpk
    -ZbL2TsHIaJ8nVK27pjQ8d+wPLhuOQiflaL9g9As68Jsx698/2K+lVZJGBVgiCY+o
    -YAgLo+k+vLQW28ejosAW1RSnIugv6LTQdxfFi+Tyu2vW75qBNE4d3Ow25kRyvym1
    -PAUxYGa6LAMP1kfGfYXUxV5OV3PDQWm+DYyctRWp59J4UUvVKdD5NRrFXfSMenDV
    -XqgxV4DIpdjgAAAA+0dI2wABggPJAwAACwSO3j4wDYsCAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-lzma2-2.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-lzma2-2.xz.base64
    deleted file mode 100644
    index aafe256ca..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-lzma2-2.xz.base64
    +++ /dev/null
    @@ -1,11 +0,0 @@
    -begin-base64 644 tests/files/good-1-lzma2-2.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMT4ADiALZdACYbykZnWvJ3uH2G2EHbBTXN
    -g6V8EqUF25C9LxTTcXKWqIp9hFZxjWoimKuePZCALcdeDBJS0z8HCHscpHfzE7gX
    -wO6RgTmzh/D/ALNqUkHtLrDyZJekmp5joa4ZdA2p1Vts7rHgLNxh3Mudhs/h3Ap6
    -gRRf0EDIfg2XRM61wvwsWQi/A4Dc10SOs9Qt3uUWIW5HgqwIWdjkZilh1dH6SWOQ
    -ET4g0Kni1RSB2SPQj0OuRVU2aaoAoADlAK8AjPGdQH2CTyRyFPGdhMtaMmyXakCD
    -i/CvMcK0ZW+J/fvYi1RBghZUEtFN1YbFwFr6SWOREf7/9Y8UAoVheThKS09BY/iH
    -Lyzm4ukxj4sU06F+gehVAu8hMaJ7BcwfpGDngaqn2XiC5hiyqxyqGS/ChxTF2cs/
    -0BimzSpLXajHXwFnKEws5MzVUp6TAn4QXfUDsZgvJu2Ge1Z/E3lYj0QQ2dkPluk7
    -v7W42ivh1oHxyQAA+0dI2wABgwPJAwAArtfSFT4wDYsCAAAAAAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-lzma2-3.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-lzma2-3.xz.base64
    deleted file mode 100644
    index 2460aec9d..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-lzma2-3.xz.base64
    +++ /dev/null
    @@ -1,11 +0,0 @@
    -begin-base64 644 tests/files/good-1-lzma2-3.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQA0TG9yZW0gaXBzdW0gZG9sb3Igc2l0
    -IGFtZXQsIGNvbnNlY3RldHVyIGFkaXBpc2ljaW5nIArAAZMBJF0AMpsJbFTXLpVs
    -+fc31RziRgKCdftJdo1zU7b9bdvK29lEC7EuvhO2uqji8+11VNxBIMy/NlsgmV0P
    -IaEGo5Ytt5ec8Hv+4hKMLVHw23Z3faR705Xp+wXm9ZePYunbMLu0cD0WeAN3Oot6
    -1bj4Sicl9Y6qJBSmKShrL3PgoXG0e6SAUEDK79u0lf27wYyOYJfby38h7cAQcRp9
    -y80J0Nn/bYDAZ30/xpTPW91REdHL1CDXK4ROqEW7QngaaEBfJF6JOjZ925gozPmD
    -7DIGMUdHO2wc9GI0QLMou1Q23XoOHDYlOFgG+BWjzhjI/ZYeaSkDw70n8+eP23O0
    -K084WCS/gxQ5fnPu/s/KvfMhaiiAyI5dgce8F9Ask7UIlboOkoJmrv+4AwD7R0jb
    -AAH0AskDAABnw5U+PjANiwIAAAAAAVla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-lzma2-4.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-lzma2-4.xz.base64
    deleted file mode 100644
    index d056cc5ed..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-lzma2-4.xz.base64
    +++ /dev/null
    @@ -1,12 +0,0 @@
    -begin-base64 644 tests/files/good-1-lzma2-4.xz
    -/Td6WFoAAATm1rRGAgAhAQgAAADYDyMT4AC7AKFdACYbykZnWvJ3uH2G2EHbBTXN
    -g6V8EqUF25C9LxTTcXKWqIp9hFZxjWoimKuePZCALcdeDBJS0z8HCHscpHfzE7gX
    -wO6Rc8q8z+s0ZqxIm2nZkweuzlCvaAkvW4gfwgiiLFhFsP9iCevu22NPb+DzH88S
    -N5iWTvbysvtur0QC4iLe1eY0lzmjRS+umS95aY/pN4lI/sx+6qkorcPm3LnaqhZ+
    -AQAmbGFib3JpcyBuaXNpIHV0IGFsaXF1aXAgZXggZWEgY29tbW9kbyAKwADlAL1d
    -ADGbyhnFVOy2VOexfcRXnmyJrUptFtg8BZQQFpk4IaO5xYD//O7U1T/djNc9j3bs
    -iKoyq2XUOO/3+Yq/9/ilVtdt1z+FC54/4kdoIggFNbhBcvnbvreOhr9DS44NQy9B
    -ad9hDMToNwhK3sJ2FrhITp65U1AfM4PoKaBnyGY6fyISYvtH5Lz0UQ8ViEnYygsl
    -i17o2v04wM5Mcxv/0JvoTLcT+DeZ4tqcL7XquKWN6leCmyXK+/aICpvfQQNuAAAA
    -sgdE6RczS4QAAasDyQMAAPVQLf6xxGf7AgAAAAAEWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-lzma2-5.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-lzma2-5.xz.base64
    deleted file mode 100644
    index 137159f0e..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-lzma2-5.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-1-lzma2-5.xz
    -/Td6WFoAAAFpIt42AgAhARAAAACocI6GAAAAAAAAAAAAAREAO5Zfc5BCmQ0BAAAA
    -AAFZWg==
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-sparc-lzma2.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-sparc-lzma2.xz.base64
    deleted file mode 100644
    index 92dd82399..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-sparc-lzma2.xz.base64
    +++ /dev/null
    @@ -1,15 +0,0 @@
    -begin-base64 644 tests/files/good-1-sparc-lzma2.xz
    -/Td6WFoAAATm1rRGAgEJACEBCAAMqup34ATXAiJdAD+RRYRoNIoJCkFQV5jzvUPN
    -JunGye2EaF6n3eigqHcx0qAFxpAsYNsEDC7M7QmSxYuiI2R9F/jhxyQLwirbA088
    -TryJF9eveYiFNoxu1Tw0aimgRSeFQ1KvUZ5LXp40wf+Owb3hDNYhUF4UOylUZSiQ
    -ck4tZVE1kCV2t2GKn/AUdTmqrnUXqynbNvauxgI6OpMFbIWjjlXwBsM3NpC7m5wx
    -AWvcnvpvLvihxMpuJ3x0HyjoenY/w5IkIY7TC8IT9RLOOxoZV5X6nT/eFtJ4EAEa
    -QhHZe8COLHify0Ov7lajrgNwtxOz5THbY9pl+h+2dOH3xJOlA7f8kzE5ofuC7W/A
    -wtrfXUVUAF9ONbDe7kc3CmYcPGnv0X05dUXESVqGon5FuY45HUegWzrYJJfoF4CB
    -zebIQkdlUDPka5mnpDMNww6OGO4GhdHTz27Lj2cHhAjzu6FI3oF5uvobNj76flO3
    -3ZzwtleTjjGvUuzWH0LGd1wjiiyv3xiaq2OeMDLx0SJ/rvFazewVVR0xsXpZcvg4
    -nuJQJC6Yg2ec8LZfG08EqIP2h2RbLrfFFmbfoeXQiVPqRiy4Kr5xFpNBIGhoCmE5
    -StS3KDcGfRiDMH7XbB6m1eVAwJasistuzWN23MyUJYA0wtteeHZvEO5mXYVPHoNi
    -cHJviJv382DgoNP0Iunv0SKogwmbE1OsEupjzsioOk/xyVjaaQKvZXxX8mLuf3FW
    -AAAAAPe9BwotOnL6AAG+BNgJAADhqiT6scRn+wIAAAAABFla
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-1-x86-lzma2.xz.base64 b/external/public-domain/xz/dist/tests/files/good-1-x86-lzma2.xz.base64
    deleted file mode 100644
    index ce2afb47e..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-1-x86-lzma2.xz.base64
    +++ /dev/null
    @@ -1,17 +0,0 @@
    -begin-base64 644 tests/files/good-1-x86-lzma2.xz
    -/Td6WFoAAATm1rRGAgEEACEBCADSuXTL4AVrAopdAD+RRYRoO97eqEsD2DVTpJFz
    -o+UbHlsdSvEGwa556kVidgwpzUufbs1xuRXwgFjecfY4VZXR+wPwqQRxhsXWS7cP
    -zjwppwVlNc+d/3oYzQmL3apO6+gh9D3fV0/2YpY0NpzLIEifIOyH7hlOywGCIQh1
    -uwlNg8vEEMHfb+ZuKZpRhAtnNFRMC91fuui7I54+UDs0gmYG2yFqYltfELZ6cIW0
    -Pn5tJXt9SFnKlOnbtmDliSS+xjLFGPFWLx8kMLdiDEuY9Vrn+HoeSkTGFG6H2M7l
    -DjOLFG3S0PbWq2hLyHXklecDaYk/sAfAWU/qJoU2eofDh3QKsXflP62x/zuspD18
    -rPemxbz+M/SwJq/xAFfIX1r11qdZT6ZaPWmxwYA5G2eGXu14NwZFDoXzEcJxAJKk
    -Zhsc3G/FWKftjG/NTZeu5r5SXpxfGt4GI9oeBo12azMGa+ykNP3Q9nLMBQnb0d4G
    -pOQYNPNRL1yYVavNCHsvgJ6NSdm3uDWUtewWrTsbfpotpYSM/LNNPwZTkH1TPhjR
    -ZbCRk5dXfJ7TrqltUtjP6HzyxbOc9/9V7xuQWuEDwiCHjI7xAHoKRuJypSfAb4fO
    -N7s6XdOcT3F8086x49NuI2eN2/YEZqpwXXPQkSJa+bSGKqEcBK7F5RQFEfPNvP9O
    -FZ+CUWEca7yueRY4iCyWhpgd5FsROjFXHOaW6LuhCqOkqaCYM4y9IjhNgqe9gRB1
    -SPiFiqegSPWmCvOwX+9RlWgG7Aga9qulYMElltjQOWII2K1uNdfDNDBvVEeOnOj4
    -7j4f8gTro9hYheJ1iA4U2p9mYHya83AnoqzGnArhr5uycJ5tJxc8WZYgTrwC33sx
    -0Q+Wjlr55YSnAAAAzP6v/zIdQ7AAAaYF7AoAAAjSzlWxxGf7AgAAAAAEWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/good-2-lzma2.xz.base64 b/external/public-domain/xz/dist/tests/files/good-2-lzma2.xz.base64
    deleted file mode 100644
    index c8e74240b..000000000
    --- a/external/public-domain/xz/dist/tests/files/good-2-lzma2.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/good-2-lzma2.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAADYDyMTAQAFSGVsbG8KAAAAFjWWMQIAIQEIAAAA
    -2A8jEwEABldvcmxkIQoAAN3RylMAAhoGGwcAAAbc510+MA2LAgAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/unsupported-block_header.xz.base64 b/external/public-domain/xz/dist/tests/files/unsupported-block_header.xz.base64
    deleted file mode 100644
    index a7ef8db6d..000000000
    --- a/external/public-domain/xz/dist/tests/files/unsupported-block_header.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/unsupported-block_header.xz
    -/Td6WFoAAAFpIt42AgAhAQgAAAFOPyRkAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/unsupported-check.xz.base64 b/external/public-domain/xz/dist/tests/files/unsupported-check.xz.base64
    deleted file mode 100644
    index 71737421e..000000000
    --- a/external/public-domain/xz/dist/tests/files/unsupported-check.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/unsupported-check.xz
    -/Td6WFoAAALTc9evAgAhAQgAAADYDyMTAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo368qE5CUAQAAAAACWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-1.xz.base64 b/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-1.xz.base64
    deleted file mode 100644
    index c5f422f58..000000000
    --- a/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-1.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/unsupported-filter_flags-1.xz
    -/Td6WFoAAAFpIt42AgB/AAAAAAAAZ3PdAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-2.xz.base64 b/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-2.xz.base64
    deleted file mode 100644
    index 42c3d6869..000000000
    --- a/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-2.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/unsupported-filter_flags-2.xz
    -/Td6WFoAAAFpIt42AgADAf8AAAD7hfZCAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-3.xz.base64 b/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-3.xz.base64
    deleted file mode 100644
    index 218f645df..000000000
    --- a/external/public-domain/xz/dist/tests/files/unsupported-filter_flags-3.xz.base64
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -begin-base64 644 tests/files/unsupported-filter_flags-3.xz
    -/Td6WFoAAAFpIt42AgEhAQghAQjIkRubAQAFSGVsbG8KAgAGV29ybGQhCgBDo6IV
    -AAEkDTAo36+QQpkNAQAAAAABWVo=
    -====
    diff --git a/external/public-domain/xz/dist/tests/test_bcj_exact_size.c b/external/public-domain/xz/dist/tests/test_bcj_exact_size.c
    deleted file mode 100644
    index cbd93405c..000000000
    --- a/external/public-domain/xz/dist/tests/test_bcj_exact_size.c
    +++ /dev/null
    @@ -1,112 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       test_bcj_exact_size.c
    -/// \brief      Tests BCJ decoding when the output size is known
    -///
    -/// These tests fail with XZ Utils 5.0.3 and earlier.
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tests.h"
    -
    -
    -/// Something to be compressed
    -static const uint8_t in[16] = "0123456789ABCDEF";
    -
    -/// in[] after compression
    -static uint8_t compressed[1024];
    -static size_t compressed_size = 0;
    -
    -/// Output buffer for decompressing compressed[]
    -static uint8_t out[sizeof(in)];
    -
    -
    -static void
    -compress(void)
    -{
    -	// Compress with PowerPC BCJ and LZMA2. PowerPC BCJ is used because
    -	// it has fixed 4-byte alignment which makes triggering the potential
    -	// bug easy.
    -	lzma_options_lzma opt_lzma2;
    -	succeed(lzma_lzma_preset(&opt_lzma2, 0));
    -
    -	lzma_filter filters[3] = {
    -		{ .id = LZMA_FILTER_POWERPC, .options = NULL },
    -		{ .id = LZMA_FILTER_LZMA2, .options = &opt_lzma2 },
    -		{ .id = LZMA_VLI_UNKNOWN, .options = NULL },
    -	};
    -
    -	expect(lzma_stream_buffer_encode(filters, LZMA_CHECK_CRC32, NULL,
    -			in, sizeof(in),
    -			compressed, &compressed_size, sizeof(compressed))
    -			== LZMA_OK);
    -}
    -
    -
    -static void
    -decompress(void)
    -{
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -	expect(lzma_stream_decoder(&strm, 10 << 20, 0) == LZMA_OK);
    -
    -	strm.next_in = compressed;
    -	strm.next_out = out;
    -
    -	while (true) {
    -		if (strm.total_in < compressed_size)
    -			strm.avail_in = 1;
    -
    -		const lzma_ret ret = lzma_code(&strm, LZMA_RUN);
    -		if (ret == LZMA_STREAM_END) {
    -			expect(strm.total_in == compressed_size);
    -			expect(strm.total_out == sizeof(in));
    -			return;
    -		}
    -
    -		expect(ret == LZMA_OK);
    -
    -		if (strm.total_out < sizeof(in))
    -			strm.avail_out = 1;
    -	}
    -}
    -
    -
    -static void
    -decompress_empty(void)
    -{
    -	// An empty file with one Block using PowerPC BCJ and LZMA2.
    -	static const uint8_t empty_bcj_lzma2[] = {
    -		0xFD, 0x37, 0x7A, 0x58, 0x5A, 0x00, 0x00, 0x01,
    -		0x69, 0x22, 0xDE, 0x36, 0x02, 0x01, 0x05, 0x00,
    -		0x21, 0x01, 0x00, 0x00, 0x7F, 0xE0, 0xF1, 0xC8,
    -		0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    -		0x00, 0x01, 0x11, 0x00, 0x3B, 0x96, 0x5F, 0x73,
    -		0x90, 0x42, 0x99, 0x0D, 0x01, 0x00, 0x00, 0x00,
    -		0x00, 0x01, 0x59, 0x5A
    -	};
    -
    -	// Decompress without giving any output space.
    -	uint64_t memlimit = 1 << 20;
    -	size_t in_pos = 0;
    -	size_t out_pos = 0;
    -	expect(lzma_stream_buffer_decode(&memlimit, 0, NULL,
    -			empty_bcj_lzma2, &in_pos, sizeof(empty_bcj_lzma2),
    -			out, &out_pos, 0) == LZMA_OK);
    -	expect(in_pos == sizeof(empty_bcj_lzma2));
    -	expect(out_pos == 0);
    -}
    -
    -
    -extern int
    -main(void)
    -{
    -	compress();
    -	decompress();
    -	decompress_empty();
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/tests/test_block_header.c b/external/public-domain/xz/dist/tests/test_block_header.c
    deleted file mode 100644
    index 3d9b5d931..000000000
    --- a/external/public-domain/xz/dist/tests/test_block_header.c
    +++ /dev/null
    @@ -1,240 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       test_block_header.c
    -/// \brief      Tests Block Header coders
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tests.h"
    -
    -
    -static uint8_t buf[LZMA_BLOCK_HEADER_SIZE_MAX];
    -static lzma_block known_options;
    -static lzma_block decoded_options;
    -
    -static lzma_options_lzma opt_lzma;
    -
    -static lzma_filter filters_none[1] = {
    -	{
    -		.id = LZMA_VLI_UNKNOWN,
    -	},
    -};
    -
    -
    -static lzma_filter filters_one[2] = {
    -	{
    -		.id = LZMA_FILTER_LZMA2,
    -		.options = &opt_lzma,
    -	}, {
    -		.id = LZMA_VLI_UNKNOWN,
    -	}
    -};
    -
    -
    -static lzma_filter filters_four[5] = {
    -	{
    -		.id = LZMA_FILTER_X86,
    -		.options = NULL,
    -	}, {
    -		.id = LZMA_FILTER_X86,
    -		.options = NULL,
    -	}, {
    -		.id = LZMA_FILTER_X86,
    -		.options = NULL,
    -	}, {
    -		.id = LZMA_FILTER_LZMA2,
    -		.options = &opt_lzma,
    -	}, {
    -		.id = LZMA_VLI_UNKNOWN,
    -	}
    -};
    -
    -
    -static lzma_filter filters_five[6] = {
    -	{
    -		.id = LZMA_FILTER_X86,
    -		.options = NULL,
    -	}, {
    -		.id = LZMA_FILTER_X86,
    -		.options = NULL,
    -	}, {
    -		.id = LZMA_FILTER_X86,
    -		.options = NULL,
    -	}, {
    -		.id = LZMA_FILTER_X86,
    -		.options = NULL,
    -	}, {
    -		.id = LZMA_FILTER_LZMA2,
    -		.options = &opt_lzma,
    -	}, {
    -		.id = LZMA_VLI_UNKNOWN,
    -	}
    -};
    -
    -
    -static void
    -code(void)
    -{
    -	expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK);
    -
    -	lzma_filter filters[LZMA_FILTERS_MAX + 1];
    -	memcrap(filters, sizeof(filters));
    -	memcrap(&decoded_options, sizeof(decoded_options));
    -
    -	decoded_options.header_size = known_options.header_size;
    -	decoded_options.check = known_options.check;
    -	decoded_options.filters = filters;
    -	expect(lzma_block_header_decode(&decoded_options, NULL, buf)
    -			== LZMA_OK);
    -
    -	expect(known_options.compressed_size
    -			== decoded_options.compressed_size);
    -	expect(known_options.uncompressed_size
    -			== decoded_options.uncompressed_size);
    -
    -	for (size_t i = 0; known_options.filters[i].id
    -			!= LZMA_VLI_UNKNOWN; ++i)
    -		expect(known_options.filters[i].id == filters[i].id);
    -
    -	for (size_t i = 0; i < LZMA_FILTERS_MAX; ++i)
    -		free(decoded_options.filters[i].options);
    -}
    -
    -
    -static void
    -test1(void)
    -{
    -	known_options = (lzma_block){
    -		.check = LZMA_CHECK_NONE,
    -		.compressed_size = LZMA_VLI_UNKNOWN,
    -		.uncompressed_size = LZMA_VLI_UNKNOWN,
    -		.filters = NULL,
    -	};
    -
    -	expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
    -
    -	known_options.filters = filters_none;
    -	expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
    -
    -	known_options.filters = filters_five;
    -	expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
    -
    -	known_options.filters = filters_one;
    -	expect(lzma_block_header_size(&known_options) == LZMA_OK);
    -
    -	known_options.check = 999; // Some invalid value, which gets ignored.
    -	expect(lzma_block_header_size(&known_options) == LZMA_OK);
    -
    -	known_options.compressed_size = 5;
    -	expect(lzma_block_header_size(&known_options) == LZMA_OK);
    -
    -	known_options.compressed_size = 0; // Cannot be zero.
    -	expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
    -
    -	// LZMA_VLI_MAX is too big to keep the total size of the Block
    -	// a valid VLI, but lzma_block_header_size() is not meant
    -	// to validate it. (lzma_block_header_encode() must validate it.)
    -	known_options.compressed_size = LZMA_VLI_MAX;
    -	expect(lzma_block_header_size(&known_options) == LZMA_OK);
    -
    -	known_options.compressed_size = LZMA_VLI_UNKNOWN;
    -	known_options.uncompressed_size = 0;
    -	expect(lzma_block_header_size(&known_options) == LZMA_OK);
    -
    -	known_options.uncompressed_size = LZMA_VLI_MAX + 1;
    -	expect(lzma_block_header_size(&known_options) == LZMA_PROG_ERROR);
    -}
    -
    -
    -static void
    -test2(void)
    -{
    -	known_options = (lzma_block){
    -		.check = LZMA_CHECK_CRC32,
    -		.compressed_size = LZMA_VLI_UNKNOWN,
    -		.uncompressed_size = LZMA_VLI_UNKNOWN,
    -		.filters = filters_four,
    -	};
    -
    -	expect(lzma_block_header_size(&known_options) == LZMA_OK);
    -	code();
    -
    -	known_options.compressed_size = 123456;
    -	known_options.uncompressed_size = 234567;
    -	expect(lzma_block_header_size(&known_options) == LZMA_OK);
    -	code();
    -
    -	// We can make the sizes smaller while keeping the header size
    -	// the same.
    -	known_options.compressed_size = 12;
    -	known_options.uncompressed_size = 23;
    -	code();
    -}
    -
    -
    -static void
    -test3(void)
    -{
    -	known_options = (lzma_block){
    -		.check = LZMA_CHECK_CRC32,
    -		.compressed_size = LZMA_VLI_UNKNOWN,
    -		.uncompressed_size = LZMA_VLI_UNKNOWN,
    -		.filters = filters_one,
    -	};
    -
    -	expect(lzma_block_header_size(&known_options) == LZMA_OK);
    -	known_options.header_size += 4;
    -	expect(lzma_block_header_encode(&known_options, buf) == LZMA_OK);
    -
    -	lzma_filter filters[LZMA_FILTERS_MAX + 1];
    -	decoded_options.header_size = known_options.header_size;
    -	decoded_options.check = known_options.check;
    -	decoded_options.filters = filters;
    -
    -	// Wrong size
    -	++buf[0];
    -	expect(lzma_block_header_decode(&decoded_options, NULL, buf)
    -			== LZMA_PROG_ERROR);
    -	--buf[0];
    -
    -	// Wrong CRC32
    -	buf[known_options.header_size - 1] ^= 1;
    -	expect(lzma_block_header_decode(&decoded_options, NULL, buf)
    -			== LZMA_DATA_ERROR);
    -	buf[known_options.header_size - 1] ^= 1;
    -
    -	// Unsupported filter
    -	// NOTE: This may need updating when new IDs become supported.
    -	buf[2] ^= 0x1F;
    -	unaligned_write32le(buf + known_options.header_size - 4,
    -			lzma_crc32(buf, known_options.header_size - 4, 0));
    -	expect(lzma_block_header_decode(&decoded_options, NULL, buf)
    -			== LZMA_OPTIONS_ERROR);
    -	buf[2] ^= 0x1F;
    -
    -	// Non-nul Padding
    -	buf[known_options.header_size - 4 - 1] ^= 1;
    -	unaligned_write32le(buf + known_options.header_size - 4,
    -			lzma_crc32(buf, known_options.header_size - 4, 0));
    -	expect(lzma_block_header_decode(&decoded_options, NULL, buf)
    -			== LZMA_OPTIONS_ERROR);
    -	buf[known_options.header_size - 4 - 1] ^= 1;
    -}
    -
    -
    -int
    -main(void)
    -{
    -	succeed(lzma_lzma_preset(&opt_lzma, 1));
    -
    -	test1();
    -	test2();
    -	test3();
    -
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/tests/test_check.c b/external/public-domain/xz/dist/tests/test_check.c
    deleted file mode 100644
    index 7d4a36078..000000000
    --- a/external/public-domain/xz/dist/tests/test_check.c
    +++ /dev/null
    @@ -1,83 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       test_check.c
    -/// \brief      Tests integrity checks
    -///
    -/// \todo       Add SHA256
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tests.h"
    -
    -
    -static const uint8_t test_string[9] = "123456789";
    -static const uint8_t test_unaligned[12] = "xxx123456789";
    -
    -
    -static bool
    -test_crc32(void)
    -{
    -	static const uint32_t test_vector = 0xCBF43926;
    -
    -	// Test 1
    -	uint32_t crc = lzma_crc32(test_string, sizeof(test_string), 0);
    -	if (crc != test_vector)
    -		return true;
    -
    -	// Test 2
    -	crc = lzma_crc32(test_unaligned + 3, sizeof(test_string), 0);
    -	if (crc != test_vector)
    -		return true;
    -
    -	// Test 3
    -	crc = 0;
    -	for (size_t i = 0; i < sizeof(test_string); ++i)
    -		crc = lzma_crc32(test_string + i, 1, crc);
    -	if (crc != test_vector)
    -		return true;
    -
    -	return false;
    -}
    -
    -
    -static bool
    -test_crc64(void)
    -{
    -	static const uint64_t test_vector = 0x995DC9BBDF1939FA;
    -
    -	// Test 1
    -	uint64_t crc = lzma_crc64(test_string, sizeof(test_string), 0);
    -	if (crc != test_vector)
    -		return true;
    -
    -	// Test 2
    -	crc = lzma_crc64(test_unaligned + 3, sizeof(test_string), 0);
    -	if (crc != test_vector)
    -		return true;
    -
    -	// Test 3
    -	crc = 0;
    -	for (size_t i = 0; i < sizeof(test_string); ++i)
    -		crc = lzma_crc64(test_string + i, 1, crc);
    -	if (crc != test_vector)
    -		return true;
    -
    -	return false;
    -}
    -
    -
    -int
    -main(void)
    -{
    -	bool error = false;
    -
    -	error |= test_crc32();
    -	error |= test_crc64();
    -
    -	return error ? 1 : 0;
    -}
    diff --git a/external/public-domain/xz/dist/tests/test_compress.sh b/external/public-domain/xz/dist/tests/test_compress.sh
    deleted file mode 100755
    index 62da0f921..000000000
    --- a/external/public-domain/xz/dist/tests/test_compress.sh
    +++ /dev/null
    @@ -1,142 +0,0 @@
    -#!/bin/sh
    -
    -###############################################################################
    -#
    -# Author: Lasse Collin
    -#
    -# This file has been put into the public domain.
    -# You can do whatever you want with this file.
    -#
    -###############################################################################
    -
    -# If xz wasn't built, this test is skipped.
    -if test -x ../src/xz/xz ; then
    -	:
    -else
    -	(exit 77)
    -	exit 77
    -fi
    -
    -# Find out if our shell supports functions.
    -eval 'unset foo ; foo() { return 42; } ; foo'
    -if test $? != 42 ; then
    -	echo "/bin/sh doesn't support functions, skipping this test."
    -	(exit 77)
    -	exit 77
    -fi
    -
    -test_xz() {
    -	if $XZ -c "$@" "$FILE" > tmp_compressed; then
    -		:
    -	else
    -		echo "Compressing failed: $* $FILE"
    -		(exit 1)
    -		exit 1
    -	fi
    -
    -	if $XZ -cd tmp_compressed > tmp_uncompressed ; then
    -		:
    -	else
    -		echo "Decompressing failed: $* $FILE"
    -		(exit 1)
    -		exit 1
    -	fi
    -
    -	if cmp tmp_uncompressed "$FILE" ; then
    -		:
    -	else
    -		echo "Decompressed file does not match" \
    -				"the original: $* $FILE"
    -		(exit 1)
    -		exit 1
    -	fi
    -
    -	if test -n "$XZDEC" ; then
    -		if $XZDEC tmp_compressed > tmp_uncompressed ; then
    -			:
    -		else
    -			echo "Decompressing failed: $* $FILE"
    -			(exit 1)
    -			exit 1
    -		fi
    -
    -		if cmp tmp_uncompressed "$FILE" ; then
    -			:
    -		else
    -			echo "Decompressed file does not match" \
    -					"the original: $* $FILE"
    -			(exit 1)
    -			exit 1
    -		fi
    -	fi
    -
    -	# Show progress:
    -	echo . | tr -d '\n\r'
    -}
    -
    -XZ="../src/xz/xz --memlimit-compress=48MiB --memlimit-decompress=5MiB \
    -		--no-adjust --threads=1 --check=crc64"
    -XZDEC="../src/xzdec/xzdec" # No memory usage limiter available
    -test -x ../src/xzdec/xzdec || XZDEC=
    -
    -# Create the required input files.
    -if ./create_compress_files ; then
    -	:
    -else
    -	rm -f compress_*
    -	echo "Failed to create files to test compression."
    -	(exit 1)
    -	exit 1
    -fi
    -
    -# Remove temporary now (in case they are something weird), and on exit.
    -rm -f tmp_compressed tmp_uncompressed
    -trap 'rm -f tmp_compressed tmp_uncompressed' 0
    -
    -# Compress and decompress each file with various filter configurations.
    -# This takes quite a bit of time.
    -echo "test_compress.sh:"
    -for FILE in compress_generated_* "$srcdir"/compress_prepared_*
    -do
    -	MSG=`echo "x$FILE" | sed 's,^x,,; s,^.*/,,; s,^compress_,,'`
    -	echo "  $MSG" | tr -d '\n\r'
    -
    -	# Don't test with empty arguments; it breaks some ancient
    -	# proprietary /bin/sh versions due to $@ used in test_xz().
    -	test_xz -1
    -	test_xz -2
    -	test_xz -3
    -	test_xz -4
    -
    -	# Disabled until Subblock format is stable.
    -#		--subblock \
    -#		--subblock=size=1 \
    -#		--subblock=size=1,rle=1 \
    -#		--subblock=size=1,rle=4 \
    -#		--subblock=size=4,rle=4 \
    -#		--subblock=size=8,rle=4 \
    -#		--subblock=size=8,rle=8 \
    -#		--subblock=size=4096,rle=12 \
    -#
    -	for ARGS in \
    -		--delta=dist=1 \
    -		--delta=dist=4 \
    -		--delta=dist=256 \
    -		--x86 \
    -		--powerpc \
    -		--ia64 \
    -		--arm \
    -		--armthumb \
    -		--sparc
    -	do
    -		test_xz $ARGS --lzma2=dict=64KiB,nice=32,mode=fast
    -
    -		# Disabled until Subblock format is stable.
    -		# test_xz --subblock $ARGS --lzma2=dict=64KiB,nice=32,mode=fast
    -	done
    -
    -	echo
    -done
    -
    -(exit 0)
    -exit 0
    diff --git a/external/public-domain/xz/dist/tests/test_files.sh b/external/public-domain/xz/dist/tests/test_files.sh
    deleted file mode 100755
    index 0f8a64d56..000000000
    --- a/external/public-domain/xz/dist/tests/test_files.sh
    +++ /dev/null
    @@ -1,57 +0,0 @@
    -#!/bin/sh
    -
    -###############################################################################
    -#
    -# Author: Lasse Collin
    -#
    -# This file has been put into the public domain.
    -# You can do whatever you want with this file.
    -#
    -###############################################################################
    -
    -# If both xz and xzdec were not build, skip this test.
    -XZ=../src/xz/xz
    -XZDEC=../src/xzdec/xzdec
    -test -x "$XZ" || XZ=
    -test -x "$XZDEC" || XZDEC=
    -if test -z "$XZ$XZDEC"; then
    -	(exit 77)
    -	exit 77
    -fi
    -
    -for I in "$srcdir"/files/good-*.xz
    -do
    -	if test -z "$XZ" || "$XZ" -dc "$I" > /dev/null; then
    -		:
    -	else
    -		echo "Good file failed: $I"
    -		(exit 1)
    -		exit 1
    -	fi
    -
    -	if test -z "$XZDEC" || "$XZDEC" "$I" > /dev/null; then
    -		:
    -	else
    -		echo "Good file failed: $I"
    -		(exit 1)
    -		exit 1
    -	fi
    -done
    -
    -for I in "$srcdir"/files/bad-*.xz
    -do
    -	if test -n "$XZ" && "$XZ" -dc "$I" > /dev/null 2>&1; then
    -		echo "Bad file succeeded: $I"
    -		(exit 1)
    -		exit 1
    -	fi
    -
    -	if test -n "$XZDEC" && "$XZDEC" "$I" > /dev/null 2>&1; then
    -		echo "Bad file succeeded: $I"
    -		(exit 1)
    -		exit 1
    -	fi
    -done
    -
    -(exit 0)
    -exit 0
    diff --git a/external/public-domain/xz/dist/tests/test_filter_flags.c b/external/public-domain/xz/dist/tests/test_filter_flags.c
    deleted file mode 100644
    index ccd9ae98d..000000000
    --- a/external/public-domain/xz/dist/tests/test_filter_flags.c
    +++ /dev/null
    @@ -1,258 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       test_filter_flags.c
    -/// \brief      Tests Filter Flags coders
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tests.h"
    -
    -
    -static uint8_t buffer[4096];
    -static lzma_filter known_flags;
    -static lzma_filter decoded_flags;
    -static lzma_stream strm = LZMA_STREAM_INIT;
    -
    -
    -static bool
    -encode(uint32_t known_size)
    -{
    -	memcrap(buffer, sizeof(buffer));
    -
    -	uint32_t tmp;
    -	if (lzma_filter_flags_size(&tmp, &known_flags) != LZMA_OK)
    -		return true;
    -
    -	if (tmp != known_size)
    -		return true;
    -
    -	size_t out_pos = 0;
    -	if (lzma_filter_flags_encode(&known_flags,
    -			buffer, &out_pos, known_size) != LZMA_OK)
    -		return true;
    -
    -	if (out_pos != known_size)
    -		return true;
    -
    -	return false;
    -}
    -
    -
    -static bool
    -decode_ret(uint32_t known_size, lzma_ret expected_ret)
    -{
    -	memcrap(&decoded_flags, sizeof(decoded_flags));
    -
    -	size_t pos = 0;
    -	if (lzma_filter_flags_decode(&decoded_flags, NULL,
    -				buffer, &pos, known_size) != expected_ret
    -			|| pos != known_size)
    -		return true;
    -
    -	return false;
    -}
    -
    -
    -static bool
    -decode(uint32_t known_size)
    -{
    -	if (decode_ret(known_size, LZMA_OK))
    -		return true;
    -
    -	if (known_flags.id != decoded_flags.id)
    -		return true;
    -
    -	return false;
    -}
    -
    -
    -#if defined(HAVE_ENCODER_X86) && defined(HAVE_DECODER_X86)
    -static void
    -test_bcj(void)
    -{
    -	// Test 1
    -	known_flags.id = LZMA_FILTER_X86;
    -	known_flags.options = NULL;
    -
    -	expect(!encode(2));
    -	expect(!decode(2));
    -	expect(decoded_flags.options == NULL);
    -
    -	// Test 2
    -	lzma_options_bcj options;
    -	options.start_offset = 0;
    -	known_flags.options = &options;
    -	expect(!encode(2));
    -	expect(!decode(2));
    -	expect(decoded_flags.options == NULL);
    -
    -	// Test 3
    -	options.start_offset = 123456;
    -	known_flags.options = &options;
    -	expect(!encode(6));
    -	expect(!decode(6));
    -	expect(decoded_flags.options != NULL);
    -
    -	lzma_options_bcj *decoded = decoded_flags.options;
    -	expect(decoded->start_offset == options.start_offset);
    -
    -	free(decoded);
    -}
    -#endif
    -
    -
    -#if defined(HAVE_ENCODER_DELTA) && defined(HAVE_DECODER_DELTA)
    -static void
    -test_delta(void)
    -{
    -	// Test 1
    -	known_flags.id = LZMA_FILTER_DELTA;
    -	known_flags.options = NULL;
    -	expect(encode(99));
    -
    -	// Test 2
    -	lzma_options_delta options = {
    -		.type = LZMA_DELTA_TYPE_BYTE,
    -		.dist = 0
    -	};
    -	known_flags.options = &options;
    -	expect(encode(99));
    -
    -	// Test 3
    -	options.dist = LZMA_DELTA_DIST_MIN;
    -	expect(!encode(3));
    -	expect(!decode(3));
    -	expect(((lzma_options_delta *)(decoded_flags.options))->dist
    -			== options.dist);
    -
    -	free(decoded_flags.options);
    -
    -	// Test 4
    -	options.dist = LZMA_DELTA_DIST_MAX;
    -	expect(!encode(3));
    -	expect(!decode(3));
    -	expect(((lzma_options_delta *)(decoded_flags.options))->dist
    -			== options.dist);
    -
    -	free(decoded_flags.options);
    -
    -	// Test 5
    -	options.dist = LZMA_DELTA_DIST_MAX + 1;
    -	expect(encode(99));
    -}
    -#endif
    -
    -/*
    -#ifdef HAVE_FILTER_LZMA
    -static void
    -validate_lzma(void)
    -{
    -	const lzma_options_lzma *known = known_flags.options;
    -	const lzma_options_lzma *decoded = decoded_flags.options;
    -
    -	expect(known->dictionary_size <= decoded->dictionary_size);
    -
    -	if (known->dictionary_size == 1)
    -		expect(decoded->dictionary_size == 1);
    -	else
    -		expect(known->dictionary_size + known->dictionary_size / 2
    -				> decoded->dictionary_size);
    -
    -	expect(known->literal_context_bits == decoded->literal_context_bits);
    -	expect(known->literal_pos_bits == decoded->literal_pos_bits);
    -	expect(known->pos_bits == decoded->pos_bits);
    -}
    -
    -
    -static void
    -test_lzma(void)
    -{
    -	// Test 1
    -	known_flags.id = LZMA_FILTER_LZMA1;
    -	known_flags.options = NULL;
    -	expect(encode(99));
    -
    -	// Test 2
    -	lzma_options_lzma options = {
    -		.dictionary_size = 0,
    -		.literal_context_bits = 0,
    -		.literal_pos_bits = 0,
    -		.pos_bits = 0,
    -		.preset_dictionary = NULL,
    -		.preset_dictionary_size = 0,
    -		.mode = LZMA_MODE_INVALID,
    -		.fast_bytes = 0,
    -		.match_finder = LZMA_MF_INVALID,
    -		.match_finder_cycles = 0,
    -	};
    -
    -	// Test 3 (empty dictionary not allowed)
    -	known_flags.options = &options;
    -	expect(encode(99));
    -
    -	// Test 4 (brute-force test some valid dictionary sizes)
    -	options.dictionary_size = LZMA_DICTIONARY_SIZE_MIN;
    -	while (options.dictionary_size != LZMA_DICTIONARY_SIZE_MAX) {
    -		if (++options.dictionary_size == 5000)
    -			options.dictionary_size = LZMA_DICTIONARY_SIZE_MAX - 5;
    -
    -		expect(!encode(4));
    -		expect(!decode(4));
    -		validate_lzma();
    -
    -		free(decoded_flags.options);
    -	}
    -
    -	// Test 5 (too big dictionary size)
    -	options.dictionary_size = LZMA_DICTIONARY_SIZE_MAX + 1;
    -	expect(encode(99));
    -
    -	// Test 6 (brute-force test lc/lp/pb)
    -	options.dictionary_size = LZMA_DICTIONARY_SIZE_MIN;
    -	for (uint32_t lc = LZMA_LITERAL_CONTEXT_BITS_MIN;
    -			lc <= LZMA_LITERAL_CONTEXT_BITS_MAX; ++lc) {
    -		for (uint32_t lp = LZMA_LITERAL_POS_BITS_MIN;
    -				lp <= LZMA_LITERAL_POS_BITS_MAX; ++lp) {
    -			for (uint32_t pb = LZMA_POS_BITS_MIN;
    -					pb <= LZMA_POS_BITS_MAX; ++pb) {
    -				if (lc + lp > LZMA_LITERAL_BITS_MAX)
    -					continue;
    -
    -				options.literal_context_bits = lc;
    -				options.literal_pos_bits = lp;
    -				options.pos_bits = pb;
    -
    -				expect(!encode(4));
    -				expect(!decode(4));
    -				validate_lzma();
    -
    -				free(decoded_flags.options);
    -			}
    -		}
    -	}
    -}
    -#endif
    -*/
    -
    -int
    -main(void)
    -{
    -#if defined(HAVE_ENCODER_X86) && defined(HAVE_DECODER_X86)
    -	test_bcj();
    -#endif
    -#if defined(HAVE_ENCODER_DELTA) && defined(HAVE_DECODER_DELTA)
    -	test_delta();
    -#endif
    -// #ifdef HAVE_FILTER_LZMA
    -// 	test_lzma();
    -// #endif
    -
    -	lzma_end(&strm);
    -
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/tests/test_index.c b/external/public-domain/xz/dist/tests/test_index.c
    deleted file mode 100644
    index 06b4d6ba9..000000000
    --- a/external/public-domain/xz/dist/tests/test_index.c
    +++ /dev/null
    @@ -1,659 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       test_index.c
    -/// \brief      Tests functions handling the lzma_index structure
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tests.h"
    -
    -#define MEMLIMIT (LZMA_VLI_C(1) << 20)
    -
    -#define SMALL_COUNT 3
    -#define BIG_COUNT 5555
    -
    -
    -static lzma_index *
    -create_empty(void)
    -{
    -	lzma_index *i = lzma_index_init(NULL);
    -	expect(i != NULL);
    -	return i;
    -}
    -
    -
    -static lzma_index *
    -create_small(void)
    -{
    -	lzma_index *i = lzma_index_init(NULL);
    -	expect(i != NULL);
    -	expect(lzma_index_append(i, NULL, 101, 555) == LZMA_OK);
    -	expect(lzma_index_append(i, NULL, 602, 777) == LZMA_OK);
    -	expect(lzma_index_append(i, NULL, 804, 999) == LZMA_OK);
    -	return i;
    -}
    -
    -
    -static lzma_index *
    -create_big(void)
    -{
    -	lzma_index *i = lzma_index_init(NULL);
    -	expect(i != NULL);
    -
    -	lzma_vli total_size = 0;
    -	lzma_vli uncompressed_size = 0;
    -
    -	// Add pseudo-random sizes (but always the same size values).
    -	uint32_t n = 11;
    -	for (size_t j = 0; j < BIG_COUNT; ++j) {
    -		n = 7019 * n + 7607;
    -		const uint32_t t = n * 3011;
    -		expect(lzma_index_append(i, NULL, t, n) == LZMA_OK);
    -		total_size += (t + 3) & ~LZMA_VLI_C(3);
    -		uncompressed_size += n;
    -	}
    -
    -	expect(lzma_index_block_count(i) == BIG_COUNT);
    -	expect(lzma_index_total_size(i) == total_size);
    -	expect(lzma_index_uncompressed_size(i) == uncompressed_size);
    -	expect(lzma_index_total_size(i) + lzma_index_size(i)
    -				+ 2 * LZMA_STREAM_HEADER_SIZE
    -			== lzma_index_stream_size(i));
    -
    -	return i;
    -}
    -
    -
    -static bool
    -is_equal(const lzma_index *a, const lzma_index *b)
    -{
    -	// Compare only the Stream and Block sizes and offsets.
    -	lzma_index_iter ra, rb;
    -	lzma_index_iter_init(&ra, a);
    -	lzma_index_iter_init(&rb, b);
    -
    -	while (true) {
    -		bool reta = lzma_index_iter_next(&ra, LZMA_INDEX_ITER_ANY);
    -		bool retb = lzma_index_iter_next(&rb, LZMA_INDEX_ITER_ANY);
    -		if (reta)
    -			return !(reta ^ retb);
    -
    -		if (ra.stream.number != rb.stream.number
    -				|| ra.stream.block_count
    -					!= rb.stream.block_count
    -				|| ra.stream.compressed_offset
    -					!= rb.stream.compressed_offset
    -				|| ra.stream.uncompressed_offset
    -					!= rb.stream.uncompressed_offset
    -				|| ra.stream.compressed_size
    -					!= rb.stream.compressed_size
    -				|| ra.stream.uncompressed_size
    -					!= rb.stream.uncompressed_size
    -				|| ra.stream.padding
    -					!= rb.stream.padding)
    -			return false;
    -
    -		if (ra.stream.block_count == 0)
    -			continue;
    -
    -		if (ra.block.number_in_file != rb.block.number_in_file
    -				|| ra.block.compressed_file_offset
    -					!= rb.block.compressed_file_offset
    -				|| ra.block.uncompressed_file_offset
    -					!= rb.block.uncompressed_file_offset
    -				|| ra.block.number_in_stream
    -					!= rb.block.number_in_stream
    -				|| ra.block.compressed_stream_offset
    -					!= rb.block.compressed_stream_offset
    -				|| ra.block.uncompressed_stream_offset
    -					!= rb.block.uncompressed_stream_offset
    -				|| ra.block.uncompressed_size
    -					!= rb.block.uncompressed_size
    -				|| ra.block.unpadded_size
    -					!= rb.block.unpadded_size
    -				|| ra.block.total_size
    -					!= rb.block.total_size)
    -			return false;
    -	}
    -}
    -
    -
    -static void
    -test_equal(void)
    -{
    -	lzma_index *a = create_empty();
    -	lzma_index *b = create_small();
    -	lzma_index *c = create_big();
    -	expect(a && b && c);
    -
    -	expect(is_equal(a, a));
    -	expect(is_equal(b, b));
    -	expect(is_equal(c, c));
    -
    -	expect(!is_equal(a, b));
    -	expect(!is_equal(a, c));
    -	expect(!is_equal(b, c));
    -
    -	lzma_index_end(a, NULL);
    -	lzma_index_end(b, NULL);
    -	lzma_index_end(c, NULL);
    -}
    -
    -
    -static void
    -test_overflow(void)
    -{
    -	// Integer overflow tests
    -	lzma_index *i = create_empty();
    -
    -	expect(lzma_index_append(i, NULL, LZMA_VLI_MAX - 5, 1234)
    -			== LZMA_DATA_ERROR);
    -
    -	// TODO
    -
    -	lzma_index_end(i, NULL);
    -}
    -
    -
    -static void
    -test_copy(const lzma_index *i)
    -{
    -	lzma_index *d = lzma_index_dup(i, NULL);
    -	expect(d != NULL);
    -	expect(is_equal(i, d));
    -	lzma_index_end(d, NULL);
    -}
    -
    -
    -static void
    -test_read(lzma_index *i)
    -{
    -	lzma_index_iter r;
    -	lzma_index_iter_init(&r, i);
    -
    -	// Try twice so we see that rewinding works.
    -	for (size_t j = 0; j < 2; ++j) {
    -		lzma_vli total_size = 0;
    -		lzma_vli uncompressed_size = 0;
    -		lzma_vli stream_offset = LZMA_STREAM_HEADER_SIZE;
    -		lzma_vli uncompressed_offset = 0;
    -		uint32_t count = 0;
    -
    -		while (!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)) {
    -			++count;
    -
    -			total_size += r.block.total_size;
    -			uncompressed_size += r.block.uncompressed_size;
    -
    -			expect(r.block.compressed_file_offset
    -					== stream_offset);
    -			expect(r.block.uncompressed_file_offset
    -					== uncompressed_offset);
    -
    -			stream_offset += r.block.total_size;
    -			uncompressed_offset += r.block.uncompressed_size;
    -		}
    -
    -		expect(lzma_index_total_size(i) == total_size);
    -		expect(lzma_index_uncompressed_size(i) == uncompressed_size);
    -		expect(lzma_index_block_count(i) == count);
    -
    -		lzma_index_iter_rewind(&r);
    -	}
    -}
    -
    -
    -static void
    -test_code(lzma_index *i)
    -{
    -	const size_t alloc_size = 128 * 1024;
    -	uint8_t *buf = malloc(alloc_size);
    -	expect(buf != NULL);
    -
    -	// Encode
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -	expect(lzma_index_encoder(&strm, i) == LZMA_OK);
    -	const lzma_vli index_size = lzma_index_size(i);
    -	succeed(coder_loop(&strm, NULL, 0, buf, index_size,
    -			LZMA_STREAM_END, LZMA_RUN));
    -
    -	// Decode
    -	lzma_index *d;
    -	expect(lzma_index_decoder(&strm, &d, MEMLIMIT) == LZMA_OK);
    -	expect(d == NULL);
    -	succeed(decoder_loop(&strm, buf, index_size));
    -
    -	expect(is_equal(i, d));
    -
    -	lzma_index_end(d, NULL);
    -	lzma_end(&strm);
    -
    -	// Decode with hashing
    -	lzma_index_hash *h = lzma_index_hash_init(NULL, NULL);
    -	expect(h != NULL);
    -	lzma_index_iter r;
    -	lzma_index_iter_init(&r, i);
    -	while (!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK))
    -		expect(lzma_index_hash_append(h, r.block.unpadded_size,
    -				r.block.uncompressed_size) == LZMA_OK);
    -	size_t pos = 0;
    -	while (pos < index_size - 1)
    -		expect(lzma_index_hash_decode(h, buf, &pos, pos + 1)
    -				== LZMA_OK);
    -	expect(lzma_index_hash_decode(h, buf, &pos, pos + 1)
    -			== LZMA_STREAM_END);
    -
    -	lzma_index_hash_end(h, NULL);
    -
    -	// Encode buffer
    -	size_t buf_pos = 1;
    -	expect(lzma_index_buffer_encode(i, buf, &buf_pos, index_size)
    -			== LZMA_BUF_ERROR);
    -	expect(buf_pos == 1);
    -
    -	succeed(lzma_index_buffer_encode(i, buf, &buf_pos, index_size + 1));
    -	expect(buf_pos == index_size + 1);
    -
    -	// Decode buffer
    -	buf_pos = 1;
    -	uint64_t memlimit = MEMLIMIT;
    -	expect(lzma_index_buffer_decode(&d, &memlimit, NULL, buf, &buf_pos,
    -			index_size) == LZMA_DATA_ERROR);
    -	expect(buf_pos == 1);
    -	expect(d == NULL);
    -
    -	succeed(lzma_index_buffer_decode(&d, &memlimit, NULL, buf, &buf_pos,
    -			index_size + 1));
    -	expect(buf_pos == index_size + 1);
    -	expect(is_equal(i, d));
    -
    -	lzma_index_end(d, NULL);
    -
    -	free(buf);
    -}
    -
    -
    -static void
    -test_many(lzma_index *i)
    -{
    -	test_copy(i);
    -	test_read(i);
    -	test_code(i);
    -}
    -
    -
    -static void
    -test_cat(void)
    -{
    -	lzma_index *a, *b, *c;
    -	lzma_index_iter r;
    -
    -	// Empty Indexes
    -	a = create_empty();
    -	b = create_empty();
    -	expect(lzma_index_cat(a, b, NULL) == LZMA_OK);
    -	expect(lzma_index_block_count(a) == 0);
    -	expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8);
    -	expect(lzma_index_file_size(a)
    -			== 2 * (2 * LZMA_STREAM_HEADER_SIZE + 8));
    -	lzma_index_iter_init(&r, a);
    -	expect(lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK));
    -
    -	b = create_empty();
    -	expect(lzma_index_cat(a, b, NULL) == LZMA_OK);
    -	expect(lzma_index_block_count(a) == 0);
    -	expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8);
    -	expect(lzma_index_file_size(a)
    -			== 3 * (2 * LZMA_STREAM_HEADER_SIZE + 8));
    -
    -	b = create_empty();
    -	c = create_empty();
    -	expect(lzma_index_stream_padding(b, 4) == LZMA_OK);
    -	expect(lzma_index_cat(b, c, NULL) == LZMA_OK);
    -	expect(lzma_index_block_count(b) == 0);
    -	expect(lzma_index_stream_size(b) == 2 * LZMA_STREAM_HEADER_SIZE + 8);
    -	expect(lzma_index_file_size(b)
    -			== 2 * (2 * LZMA_STREAM_HEADER_SIZE + 8) + 4);
    -
    -	expect(lzma_index_stream_padding(a, 8) == LZMA_OK);
    -	expect(lzma_index_cat(a, b, NULL) == LZMA_OK);
    -	expect(lzma_index_block_count(a) == 0);
    -	expect(lzma_index_stream_size(a) == 2 * LZMA_STREAM_HEADER_SIZE + 8);
    -	expect(lzma_index_file_size(a)
    -			== 5 * (2 * LZMA_STREAM_HEADER_SIZE + 8) + 4 + 8);
    -
    -	expect(lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK));
    -	lzma_index_iter_rewind(&r);
    -	expect(lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK));
    -	lzma_index_end(a, NULL);
    -
    -	// Small Indexes
    -	a = create_small();
    -	lzma_vli stream_size = lzma_index_stream_size(a);
    -	lzma_index_iter_init(&r, a);
    -	for (int i = SMALL_COUNT; i >= 0; --i)
    -		expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)
    -				^ (i == 0));
    -
    -	b = create_small();
    -	expect(lzma_index_stream_padding(a, 4) == LZMA_OK);
    -	expect(lzma_index_cat(a, b, NULL) == LZMA_OK);
    -	expect(lzma_index_file_size(a) == stream_size * 2 + 4);
    -	expect(lzma_index_stream_size(a) > stream_size);
    -	expect(lzma_index_stream_size(a) < stream_size * 2);
    -	for (int i = SMALL_COUNT; i >= 0; --i)
    -		expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)
    -				^ (i == 0));
    -
    -	lzma_index_iter_rewind(&r);
    -	for (int i = SMALL_COUNT * 2; i >= 0; --i)
    -		expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)
    -				^ (i == 0));
    -
    -	b = create_small();
    -	c = create_small();
    -	expect(lzma_index_stream_padding(b, 8) == LZMA_OK);
    -	expect(lzma_index_cat(b, c, NULL) == LZMA_OK);
    -	expect(lzma_index_stream_padding(a, 12) == LZMA_OK);
    -	expect(lzma_index_cat(a, b, NULL) == LZMA_OK);
    -	expect(lzma_index_file_size(a) == stream_size * 4 + 4 + 8 + 12);
    -
    -	expect(lzma_index_block_count(a) == SMALL_COUNT * 4);
    -	for (int i = SMALL_COUNT * 2; i >= 0; --i)
    -		expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)
    -				^ (i == 0));
    -
    -	lzma_index_iter_rewind(&r);
    -	for (int i = SMALL_COUNT * 4; i >= 0; --i)
    -		expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)
    -				^ (i == 0));
    -
    -	lzma_index_end(a, NULL);
    -
    -	// Mix of empty and small
    -	a = create_empty();
    -	b = create_small();
    -	expect(lzma_index_stream_padding(a, 4) == LZMA_OK);
    -	expect(lzma_index_cat(a, b, NULL) == LZMA_OK);
    -	lzma_index_iter_init(&r, a);
    -	for (int i = SMALL_COUNT; i >= 0; --i)
    -		expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)
    -				^ (i == 0));
    -
    -	lzma_index_end(a, NULL);
    -
    -	// Big Indexes
    -	a = create_big();
    -	stream_size = lzma_index_stream_size(a);
    -	b = create_big();
    -	expect(lzma_index_stream_padding(a, 4) == LZMA_OK);
    -	expect(lzma_index_cat(a, b, NULL) == LZMA_OK);
    -	expect(lzma_index_file_size(a) == stream_size * 2 + 4);
    -	expect(lzma_index_stream_size(a) > stream_size);
    -	expect(lzma_index_stream_size(a) < stream_size * 2);
    -
    -	b = create_big();
    -	c = create_big();
    -	expect(lzma_index_stream_padding(b, 8) == LZMA_OK);
    -	expect(lzma_index_cat(b, c, NULL) == LZMA_OK);
    -	expect(lzma_index_stream_padding(a, 12) == LZMA_OK);
    -	expect(lzma_index_cat(a, b, NULL) == LZMA_OK);
    -	expect(lzma_index_file_size(a) == stream_size * 4 + 4 + 8 + 12);
    -
    -	lzma_index_iter_init(&r, a);
    -	for (int i = BIG_COUNT * 4; i >= 0; --i)
    -		expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK)
    -				^ (i == 0));
    -
    -	lzma_index_end(a, NULL);
    -}
    -
    -
    -static void
    -test_locate(void)
    -{
    -	lzma_index *i = lzma_index_init(NULL);
    -	expect(i != NULL);
    -	lzma_index_iter r;
    -	lzma_index_iter_init(&r, i);
    -
    -	// Cannot locate anything from an empty Index.
    -	expect(lzma_index_iter_locate(&r, 0));
    -	expect(lzma_index_iter_locate(&r, 555));
    -
    -	// One empty Record: nothing is found since there's no uncompressed
    -	// data.
    -	expect(lzma_index_append(i, NULL, 16, 0) == LZMA_OK);
    -	expect(lzma_index_iter_locate(&r, 0));
    -
    -	// Non-empty Record and we can find something.
    -	expect(lzma_index_append(i, NULL, 32, 5) == LZMA_OK);
    -	expect(!lzma_index_iter_locate(&r, 0));
    -	expect(r.block.total_size == 32);
    -	expect(r.block.uncompressed_size == 5);
    -	expect(r.block.compressed_file_offset
    -			== LZMA_STREAM_HEADER_SIZE + 16);
    -	expect(r.block.uncompressed_file_offset == 0);
    -
    -	// Still cannot find anything past the end.
    -	expect(lzma_index_iter_locate(&r, 5));
    -
    -	// Add the third Record.
    -	expect(lzma_index_append(i, NULL, 40, 11) == LZMA_OK);
    -
    -	expect(!lzma_index_iter_locate(&r, 0));
    -	expect(r.block.total_size == 32);
    -	expect(r.block.uncompressed_size == 5);
    -	expect(r.block.compressed_file_offset
    -			== LZMA_STREAM_HEADER_SIZE + 16);
    -	expect(r.block.uncompressed_file_offset == 0);
    -
    -	expect(!lzma_index_iter_next(&r, LZMA_INDEX_ITER_BLOCK));
    -	expect(r.block.total_size == 40);
    -	expect(r.block.uncompressed_size == 11);
    -	expect(r.block.compressed_file_offset
    -			== LZMA_STREAM_HEADER_SIZE + 16 + 32);
    -	expect(r.block.uncompressed_file_offset == 5);
    -
    -	expect(!lzma_index_iter_locate(&r, 2));
    -	expect(r.block.total_size == 32);
    -	expect(r.block.uncompressed_size == 5);
    -	expect(r.block.compressed_file_offset
    -			== LZMA_STREAM_HEADER_SIZE + 16);
    -	expect(r.block.uncompressed_file_offset == 0);
    -
    -	expect(!lzma_index_iter_locate(&r, 5));
    -	expect(r.block.total_size == 40);
    -	expect(r.block.uncompressed_size == 11);
    -	expect(r.block.compressed_file_offset
    -			== LZMA_STREAM_HEADER_SIZE + 16 + 32);
    -	expect(r.block.uncompressed_file_offset == 5);
    -
    -	expect(!lzma_index_iter_locate(&r, 5 + 11 - 1));
    -	expect(r.block.total_size == 40);
    -	expect(r.block.uncompressed_size == 11);
    -	expect(r.block.compressed_file_offset
    -			== LZMA_STREAM_HEADER_SIZE + 16 + 32);
    -	expect(r.block.uncompressed_file_offset == 5);
    -
    -	expect(lzma_index_iter_locate(&r, 5 + 11));
    -	expect(lzma_index_iter_locate(&r, 5 + 15));
    -
    -	// Large Index
    -	lzma_index_end(i, NULL);
    -	i = lzma_index_init(NULL);
    -	expect(i != NULL);
    -	lzma_index_iter_init(&r, i);
    -
    -	for (size_t n = 4; n <= 4 * 5555; n += 4)
    -		expect(lzma_index_append(i, NULL, n + 8, n) == LZMA_OK);
    -
    -	expect(lzma_index_block_count(i) == 5555);
    -
    -	// First Record
    -	expect(!lzma_index_iter_locate(&r, 0));
    -	expect(r.block.total_size == 4 + 8);
    -	expect(r.block.uncompressed_size == 4);
    -	expect(r.block.compressed_file_offset == LZMA_STREAM_HEADER_SIZE);
    -	expect(r.block.uncompressed_file_offset == 0);
    -
    -	expect(!lzma_index_iter_locate(&r, 3));
    -	expect(r.block.total_size == 4 + 8);
    -	expect(r.block.uncompressed_size == 4);
    -	expect(r.block.compressed_file_offset == LZMA_STREAM_HEADER_SIZE);
    -	expect(r.block.uncompressed_file_offset == 0);
    -
    -	// Second Record
    -	expect(!lzma_index_iter_locate(&r, 4));
    -	expect(r.block.total_size == 2 * 4 + 8);
    -	expect(r.block.uncompressed_size == 2 * 4);
    -	expect(r.block.compressed_file_offset
    -			== LZMA_STREAM_HEADER_SIZE + 4 + 8);
    -	expect(r.block.uncompressed_file_offset == 4);
    -
    -	// Last Record
    -	expect(!lzma_index_iter_locate(
    -			&r, lzma_index_uncompressed_size(i) - 1));
    -	expect(r.block.total_size == 4 * 5555 + 8);
    -	expect(r.block.uncompressed_size == 4 * 5555);
    -	expect(r.block.compressed_file_offset == lzma_index_total_size(i)
    -			+ LZMA_STREAM_HEADER_SIZE - 4 * 5555 - 8);
    -	expect(r.block.uncompressed_file_offset
    -			== lzma_index_uncompressed_size(i) - 4 * 5555);
    -
    -	// Allocation chunk boundaries. See INDEX_GROUP_SIZE in
    -	// liblzma/common/index.c.
    -	const size_t group_multiple = 256 * 4;
    -	const size_t radius = 8;
    -	const size_t start = group_multiple - radius;
    -	lzma_vli ubase = 0;
    -	lzma_vli tbase = 0;
    -	size_t n;
    -	for (n = 1; n < start; ++n) {
    -		ubase += n * 4;
    -		tbase += n * 4 + 8;
    -	}
    -
    -	while (n < start + 2 * radius) {
    -		expect(!lzma_index_iter_locate(&r, ubase + n * 4));
    -
    -		expect(r.block.compressed_file_offset == tbase + n * 4 + 8
    -				+ LZMA_STREAM_HEADER_SIZE);
    -		expect(r.block.uncompressed_file_offset == ubase + n * 4);
    -
    -		tbase += n * 4 + 8;
    -		ubase += n * 4;
    -		++n;
    -
    -		expect(r.block.total_size == n * 4 + 8);
    -		expect(r.block.uncompressed_size == n * 4);
    -	}
    -
    -	// Do it also backwards.
    -	while (n > start) {
    -		expect(!lzma_index_iter_locate(&r, ubase + (n - 1) * 4));
    -
    -		expect(r.block.total_size == n * 4 + 8);
    -		expect(r.block.uncompressed_size == n * 4);
    -
    -		--n;
    -		tbase -= n * 4 + 8;
    -		ubase -= n * 4;
    -
    -		expect(r.block.compressed_file_offset == tbase + n * 4 + 8
    -				+ LZMA_STREAM_HEADER_SIZE);
    -		expect(r.block.uncompressed_file_offset == ubase + n * 4);
    -	}
    -
    -	// Test locating in concatenated Index.
    -	lzma_index_end(i, NULL);
    -	i = lzma_index_init(NULL);
    -	expect(i != NULL);
    -	lzma_index_iter_init(&r, i);
    -	for (n = 0; n < group_multiple; ++n)
    -		expect(lzma_index_append(i, NULL, 8, 0) == LZMA_OK);
    -	expect(lzma_index_append(i, NULL, 16, 1) == LZMA_OK);
    -	expect(!lzma_index_iter_locate(&r, 0));
    -	expect(r.block.total_size == 16);
    -	expect(r.block.uncompressed_size == 1);
    -	expect(r.block.compressed_file_offset
    -			== LZMA_STREAM_HEADER_SIZE + group_multiple * 8);
    -	expect(r.block.uncompressed_file_offset == 0);
    -
    -	lzma_index_end(i, NULL);
    -}
    -
    -
    -static void
    -test_corrupt(void)
    -{
    -	const size_t alloc_size = 128 * 1024;
    -	uint8_t *buf = malloc(alloc_size);
    -	expect(buf != NULL);
    -	lzma_stream strm = LZMA_STREAM_INIT;
    -
    -	lzma_index *i = create_empty();
    -	expect(lzma_index_append(i, NULL, 0, 1) == LZMA_PROG_ERROR);
    -	lzma_index_end(i, NULL);
    -
    -	// Create a valid Index and corrupt it in different ways.
    -	i = create_small();
    -	expect(lzma_index_encoder(&strm, i) == LZMA_OK);
    -	succeed(coder_loop(&strm, NULL, 0, buf, 20,
    -			LZMA_STREAM_END, LZMA_RUN));
    -	lzma_index_end(i, NULL);
    -
    -	// Wrong Index Indicator
    -	buf[0] ^= 1;
    -	expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK);
    -	succeed(decoder_loop_ret(&strm, buf, 1, LZMA_DATA_ERROR));
    -	buf[0] ^= 1;
    -
    -	// Wrong Number of Records and thus CRC32 fails.
    -	--buf[1];
    -	expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK);
    -	succeed(decoder_loop_ret(&strm, buf, 10, LZMA_DATA_ERROR));
    -	++buf[1];
    -
    -	// Padding not NULs
    -	buf[15] ^= 1;
    -	expect(lzma_index_decoder(&strm, &i, MEMLIMIT) == LZMA_OK);
    -	succeed(decoder_loop_ret(&strm, buf, 16, LZMA_DATA_ERROR));
    -
    -	lzma_end(&strm);
    -	free(buf);
    -}
    -
    -
    -int
    -main(void)
    -{
    -	test_equal();
    -
    -	test_overflow();
    -
    -	lzma_index *i = create_empty();
    -	test_many(i);
    -	lzma_index_end(i, NULL);
    -
    -	i = create_small();
    -	test_many(i);
    -	lzma_index_end(i, NULL);
    -
    -	i = create_big();
    -	test_many(i);
    -	lzma_index_end(i, NULL);
    -
    -	test_cat();
    -
    -	test_locate();
    -
    -	test_corrupt();
    -
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/tests/test_scripts.sh b/external/public-domain/xz/dist/tests/test_scripts.sh
    deleted file mode 100755
    index 48a9308a2..000000000
    --- a/external/public-domain/xz/dist/tests/test_scripts.sh
    +++ /dev/null
    @@ -1,76 +0,0 @@
    -#!/bin/sh
    -
    -###############################################################################
    -#
    -# Author: Jonathan Nieder
    -#
    -# This file has been put into the public domain.
    -# You can do whatever you want with this file.
    -#
    -###############################################################################
    -
    -# If scripts weren't built, this test is skipped.
    -XZ=../src/xz/xz
    -XZDIFF=../src/scripts/xzdiff
    -XZGREP=../src/scripts/xzgrep
    -
    -for i in XZ XZDIFF XZGREP; do
    -	eval test -x "\$$i" && continue
    -	(exit 77)
    -	exit 77
    -done
    -
    -PATH=`pwd`/../src/xz:$PATH
    -export PATH
    -
    -test -z "$srcdir" && srcdir=.
    -preimage=$srcdir/files/good-1-check-crc32.xz
    -samepostimage=$srcdir/files/good-1-check-crc64.xz
    -otherpostimage=$srcdir/files/good-1-lzma2-1.xz
    -
    -"$XZDIFF" "$preimage" "$samepostimage" >/dev/null
    -status=$?
    -if test "$status" != 0 ; then
    -	echo "xzdiff with no changes exited with status $status != 0"
    -	(exit 1)
    -	exit 1
    -fi
    -
    -"$XZDIFF" "$preimage" "$otherpostimage" >/dev/null
    -status=$?
    -if test "$status" != 1 ; then
    -	echo "xzdiff with changes exited with status $status != 1"
    -	(exit 1)
    -	exit 1
    -fi
    -
    -"$XZDIFF" "$preimage" "$srcdir/files/missing.xz" >/dev/null 2>&1
    -status=$?
    -if test "$status" != 2 ; then
    -	echo "xzdiff with missing operand exited with status $status != 2"
    -	(exit 1)
    -	exit 1
    -fi
    -
    -# The exit status must be 0 when a match was found at least from one file,
    -# and 1 when no match was found in any file.
    -cp "$srcdir/files/good-1-lzma2-1.xz" xzgrep_test_1.xz
    -cp "$srcdir/files/good-2-lzma2.xz" xzgrep_test_2.xz
    -for pattern in el Hello NOMATCH; do
    -	for opts in "" "-l" "-h" "-H"; do
    -		echo "=> xzgrep $opts $pattern <="
    -		"$XZGREP" $opts $pattern xzgrep_test_1.xz xzgrep_test_2.xz
    -		echo retval $?
    -	done
    -done > xzgrep_test_output 2>&1
    -
    -if cmp -s "$srcdir/xzgrep_expected_output" xzgrep_test_output ; then
    -	:
    -else
    -	echo "unexpected output from xzgrep"
    -	(exit 1)
    -	exit 1
    -fi
    -
    -(exit 0)
    -exit 0
    diff --git a/external/public-domain/xz/dist/tests/test_stream_flags.c b/external/public-domain/xz/dist/tests/test_stream_flags.c
    deleted file mode 100644
    index 9611459e1..000000000
    --- a/external/public-domain/xz/dist/tests/test_stream_flags.c
    +++ /dev/null
    @@ -1,180 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       test_stream_flags.c
    -/// \brief      Tests Stream Header and Stream Footer coders
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#include "tests.h"
    -
    -
    -static lzma_stream_flags known_flags;
    -static lzma_stream_flags decoded_flags;
    -static uint8_t buffer[LZMA_STREAM_HEADER_SIZE];
    -
    -
    -static bool
    -validate(void)
    -{
    -	// TODO: This could require the specific error type as an argument.
    -	// We could also test that lzma_stream_flags_compare() gives
    -	// the correct return values in different situations.
    -	return lzma_stream_flags_compare(&known_flags, &decoded_flags)
    -			!= LZMA_OK;
    -}
    -
    -
    -static bool
    -test_header_decoder(lzma_ret expected_ret)
    -{
    -	memcrap(&decoded_flags, sizeof(decoded_flags));
    -
    -	if (lzma_stream_header_decode(&decoded_flags, buffer) != expected_ret)
    -		return true;
    -
    -	if (expected_ret != LZMA_OK)
    -		return false;
    -
    -	// Header doesn't have Backward Size, so make
    -	// lzma_stream_flags_compare() ignore it.
    -	decoded_flags.backward_size = LZMA_VLI_UNKNOWN;
    -	return validate();
    -}
    -
    -
    -static void
    -test_header(void)
    -{
    -	memcrap(buffer, sizeof(buffer));
    -	expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
    -	succeed(test_header_decoder(LZMA_OK));
    -}
    -
    -
    -static bool
    -test_footer_decoder(lzma_ret expected_ret)
    -{
    -	memcrap(&decoded_flags, sizeof(decoded_flags));
    -
    -	if (lzma_stream_footer_decode(&decoded_flags, buffer) != expected_ret)
    -		return true;
    -
    -	if (expected_ret != LZMA_OK)
    -		return false;
    -
    -	return validate();
    -}
    -
    -
    -static void
    -test_footer(void)
    -{
    -	memcrap(buffer, sizeof(buffer));
    -	expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK);
    -	succeed(test_footer_decoder(LZMA_OK));
    -}
    -
    -
    -static void
    -test_encode_invalid(void)
    -{
    -	known_flags.check = LZMA_CHECK_ID_MAX + 1;
    -	known_flags.backward_size = 1024;
    -
    -	expect(lzma_stream_header_encode(&known_flags, buffer)
    -			== LZMA_PROG_ERROR);
    -
    -	expect(lzma_stream_footer_encode(&known_flags, buffer)
    -			== LZMA_PROG_ERROR);
    -
    -	known_flags.check = (lzma_check)(-1);
    -
    -	expect(lzma_stream_header_encode(&known_flags, buffer)
    -			== LZMA_PROG_ERROR);
    -
    -	expect(lzma_stream_footer_encode(&known_flags, buffer)
    -			== LZMA_PROG_ERROR);
    -
    -	known_flags.check = LZMA_CHECK_NONE;
    -	known_flags.backward_size = 0;
    -
    -	// Header encoder ignores backward_size.
    -	expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
    -
    -	expect(lzma_stream_footer_encode(&known_flags, buffer)
    -			== LZMA_PROG_ERROR);
    -
    -	known_flags.backward_size = LZMA_VLI_MAX;
    -
    -	expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
    -
    -	expect(lzma_stream_footer_encode(&known_flags, buffer)
    -			== LZMA_PROG_ERROR);
    -}
    -
    -
    -static void
    -test_decode_invalid(void)
    -{
    -	known_flags.check = LZMA_CHECK_NONE;
    -	known_flags.backward_size = 1024;
    -
    -	expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
    -
    -	// Test 1 (invalid Magic Bytes)
    -	buffer[5] ^= 1;
    -	succeed(test_header_decoder(LZMA_FORMAT_ERROR));
    -	buffer[5] ^= 1;
    -
    -	// Test 2a (valid CRC32)
    -	uint32_t crc = lzma_crc32(buffer + 6, 2, 0);
    -	unaligned_write32le(buffer + 8, crc);
    -	succeed(test_header_decoder(LZMA_OK));
    -
    -	// Test 2b (invalid Stream Flags with valid CRC32)
    -	buffer[6] ^= 0x20;
    -	crc = lzma_crc32(buffer + 6, 2, 0);
    -	unaligned_write32le(buffer + 8, crc);
    -	succeed(test_header_decoder(LZMA_OPTIONS_ERROR));
    -
    -	// Test 3 (invalid CRC32)
    -	expect(lzma_stream_header_encode(&known_flags, buffer) == LZMA_OK);
    -	buffer[9] ^= 1;
    -	succeed(test_header_decoder(LZMA_DATA_ERROR));
    -
    -	// Test 4 (invalid Stream Flags with valid CRC32)
    -	expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK);
    -	buffer[9] ^= 0x40;
    -	crc = lzma_crc32(buffer + 4, 6, 0);
    -	unaligned_write32le(buffer, crc);
    -	succeed(test_footer_decoder(LZMA_OPTIONS_ERROR));
    -
    -	// Test 5 (invalid Magic Bytes)
    -	expect(lzma_stream_footer_encode(&known_flags, buffer) == LZMA_OK);
    -	buffer[11] ^= 1;
    -	succeed(test_footer_decoder(LZMA_FORMAT_ERROR));
    -}
    -
    -
    -int
    -main(void)
    -{
    -	// Valid headers
    -	known_flags.backward_size = 1024;
    -	for (lzma_check check = LZMA_CHECK_NONE;
    -			check <= LZMA_CHECK_ID_MAX; ++check) {
    -		test_header();
    -		test_footer();
    -	}
    -
    -	// Invalid headers
    -	test_encode_invalid();
    -	test_decode_invalid();
    -
    -	return 0;
    -}
    diff --git a/external/public-domain/xz/dist/tests/tests.h b/external/public-domain/xz/dist/tests/tests.h
    deleted file mode 100644
    index 8f3c745d8..000000000
    --- a/external/public-domain/xz/dist/tests/tests.h
    +++ /dev/null
    @@ -1,124 +0,0 @@
    -///////////////////////////////////////////////////////////////////////////////
    -//
    -/// \file       tests.h
    -/// \brief      Common definitions for test applications
    -//
    -//  Author:     Lasse Collin
    -//
    -//  This file has been put into the public domain.
    -//  You can do whatever you want with this file.
    -//
    -///////////////////////////////////////////////////////////////////////////////
    -
    -#ifndef LZMA_TESTS_H
    -#define LZMA_TESTS_H
    -
    -#include "sysdefs.h"
    -#include "tuklib_integer.h"
    -#include "lzma.h"
    -
    -#include 
    -
    -#define memcrap(buf, size) memset(buf, 0xFD, size)
    -
    -#define expect(test) ((test) ? 0 : (fprintf(stderr, "%s:%d: %s\n", \
    -	__FILE__, __LINE__, #test), abort(), 0))
    -
    -#define succeed(test) expect(!(test))
    -
    -#define fail(test) expect(test)
    -
    -
    -static inline const char *
    -lzma_ret_sym(lzma_ret ret)
    -{
    -	if ((unsigned int)(ret) > LZMA_PROG_ERROR)
    -		return "UNKNOWN_ERROR";
    -
    -	static const char *msgs[] = {
    -		"LZMA_OK",
    -		"LZMA_STREAM_END",
    -		"LZMA_NO_CHECK",
    -		"LZMA_UNSUPPORTED_CHECK",
    -		"LZMA_GET_CHECK",
    -		"LZMA_MEM_ERROR",
    -		"LZMA_MEMLIMIT_ERROR",
    -		"LZMA_FORMAT_ERROR",
    -		"LZMA_OPTIONS_ERROR",
    -		"LZMA_DATA_ERROR",
    -		"LZMA_BUF_ERROR",
    -		"LZMA_PROG_ERROR"
    -	};
    -
    -	return msgs[ret];
    -}
    -
    -
    -static inline bool
    -coder_loop(lzma_stream *strm, uint8_t *in, size_t in_size,
    -		uint8_t *out, size_t out_size,
    -		lzma_ret expected_ret, lzma_action finishing_action)
    -{
    -	size_t in_left = in_size;
    -	size_t out_left = out_size > 0 ? out_size + 1 : 0;
    -	lzma_action action = LZMA_RUN;
    -	lzma_ret ret;
    -
    -	strm->next_in = NULL;
    -	strm->avail_in = 0;
    -	strm->next_out = NULL;
    -	strm->avail_out = 0;
    -
    -	while (true) {
    -		if (in_left > 0) {
    -			if (--in_left == 0)
    -				action = finishing_action;
    -
    -			strm->next_in = in++;
    -			strm->avail_in = 1;
    -		}
    -
    -		if (out_left > 0) {
    -			--out_left;
    -			strm->next_out = out++;
    -			strm->avail_out = 1;
    -		}
    -
    -		ret = lzma_code(strm, action);
    -		if (ret != LZMA_OK)
    -			break;
    -	}
    -
    -	bool error = false;
    -
    -	if (ret != expected_ret)
    -		error = true;
    -
    -	if (expected_ret == LZMA_STREAM_END) {
    -		if (strm->total_in != in_size || strm->total_out != out_size)
    -			error = true;
    -	} else {
    -		if (strm->total_in != in_size || strm->total_out != out_size)
    -			error = true;
    -	}
    -
    -	return error;
    -}
    -
    -
    -static inline bool
    -decoder_loop_ret(lzma_stream *strm, uint8_t *in, size_t in_size,
    -		lzma_ret expected_ret)
    -{
    -	return coder_loop(strm, in, in_size, NULL, 0, expected_ret, LZMA_RUN);
    -}
    -
    -
    -static inline bool
    -decoder_loop(lzma_stream *strm, uint8_t *in, size_t in_size)
    -{
    -	return coder_loop(strm, in, in_size, NULL, 0,
    -			LZMA_STREAM_END, LZMA_RUN);
    -}
    -
    -#endif
    diff --git a/external/public-domain/xz/dist/tests/xzgrep_expected_output b/external/public-domain/xz/dist/tests/xzgrep_expected_output
    deleted file mode 100644
    index e531d9316..000000000
    --- a/external/public-domain/xz/dist/tests/xzgrep_expected_output
    +++ /dev/null
    @@ -1,39 +0,0 @@
    -=> xzgrep  el <=
    -xzgrep_test_1.xz:elit, sed do eiusmod tempor incididunt ut 
    -xzgrep_test_1.xz:in voluptate velit esse cillum dolore eu 
    -xzgrep_test_2.xz:Hello
    -retval 0
    -=> xzgrep -l el <=
    -xzgrep_test_1.xz
    -xzgrep_test_2.xz
    -retval 0
    -=> xzgrep -h el <=
    -elit, sed do eiusmod tempor incididunt ut 
    -in voluptate velit esse cillum dolore eu 
    -Hello
    -retval 0
    -=> xzgrep -H el <=
    -xzgrep_test_1.xz:elit, sed do eiusmod tempor incididunt ut 
    -xzgrep_test_1.xz:in voluptate velit esse cillum dolore eu 
    -xzgrep_test_2.xz:Hello
    -retval 0
    -=> xzgrep  Hello <=
    -xzgrep_test_2.xz:Hello
    -retval 0
    -=> xzgrep -l Hello <=
    -xzgrep_test_2.xz
    -retval 0
    -=> xzgrep -h Hello <=
    -Hello
    -retval 0
    -=> xzgrep -H Hello <=
    -xzgrep_test_2.xz:Hello
    -retval 0
    -=> xzgrep  NOMATCH <=
    -retval 1
    -=> xzgrep -l NOMATCH <=
    -retval 1
    -=> xzgrep -h NOMATCH <=
    -retval 1
    -=> xzgrep -H NOMATCH <=
    -retval 1
    diff --git a/external/public-domain/xz/include/config.h b/external/public-domain/xz/include/config.h
    deleted file mode 100644
    index 7571cc93a..000000000
    --- a/external/public-domain/xz/include/config.h
    +++ /dev/null
    @@ -1,518 +0,0 @@
    -/* config.h.  Generated from config.h.in by configure.  */
    -/* config.h.in.  Generated from configure.ac by autoheader.  */
    -
    -/* Define if building universal (internal helper macro) */
    -/* #undef AC_APPLE_UNIVERSAL_BUILD */
    -
    -/* How many MiB of RAM to assume if the real amount cannot be determined. */
    -#define ASSUME_RAM 128
    -
    -/* Define to 1 if translation of program messages to the user's native
    -   language is requested. */
    -/* #undef ENABLE_NLS */
    -
    -/* Define to 1 if bswap_16 is available. */
    -/* #undef HAVE_BSWAP_16 */
    -
    -/* Define to 1 if bswap_32 is available. */
    -/* #undef HAVE_BSWAP_32 */
    -
    -/* Define to 1 if bswap_64 is available. */
    -/* #undef HAVE_BSWAP_64 */
    -
    -/* Define to 1 if you have the  header file. */
    -/* #undef HAVE_BYTESWAP_H */
    -
    -/* Define to 1 if the system has the type `CC_SHA256_CTX'. */
    -/* #undef HAVE_CC_SHA256_CTX */
    -
    -/* Define to 1 if you have the `CC_SHA256_Init' function. */
    -/* #undef HAVE_CC_SHA256_INIT */
    -
    -/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
    -   CoreFoundation framework. */
    -/* #undef HAVE_CFLOCALECOPYCURRENT */
    -
    -/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
    -   the CoreFoundation framework. */
    -/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
    -
    -/* Define to 1 if crc32 integrity check is enabled. */
    -#define HAVE_CHECK_CRC32 1
    -
    -/* Define to 1 if crc64 integrity check is enabled. */
    -#define HAVE_CHECK_CRC64 1
    -
    -/* Define to 1 if sha256 integrity check is enabled. */
    -#define HAVE_CHECK_SHA256 1
    -
    -#if !defined(__minix)
    -/* Define to 1 if you have the `clock_gettime' function. */
    -#define HAVE_CLOCK_GETTIME 1
    -#endif /* !defined(__minix) */
    -
    -/* Define to 1 if you have the  header file. */
    -/* #undef HAVE_COMMONCRYPTO_COMMONDIGEST_H */
    -
    -/* Define if the GNU dcgettext() function is already present or preinstalled.
    -   */
    -/* #undef HAVE_DCGETTEXT */
    -
    -#if !defined(__minix)
    -/* Define to 1 if you have the declaration of `CLOCK_MONOTONIC', and to 0 if
    -   you don't. */
    -#define HAVE_DECL_CLOCK_MONOTONIC 1
    -#endif /* !defined(__minix) */
    -
    -/* Define to 1 if you have the declaration of `program_invocation_name', and
    -   to 0 if you don't. */
    -#define HAVE_DECL_PROGRAM_INVOCATION_NAME 0
    -
    -/* Define to 1 if arm decoder is enabled. */
    -#define HAVE_DECODER_ARM 1
    -
    -/* Define to 1 if armthumb decoder is enabled. */
    -#define HAVE_DECODER_ARMTHUMB 1
    -
    -/* Define to 1 if delta decoder is enabled. */
    -#define HAVE_DECODER_DELTA 1
    -
    -/* Define to 1 if ia64 decoder is enabled. */
    -#define HAVE_DECODER_IA64 1
    -
    -/* Define to 1 if lzma1 decoder is enabled. */
    -#define HAVE_DECODER_LZMA1 1
    -
    -/* Define to 1 if lzma2 decoder is enabled. */
    -#define HAVE_DECODER_LZMA2 1
    -
    -/* Define to 1 if powerpc decoder is enabled. */
    -#define HAVE_DECODER_POWERPC 1
    -
    -/* Define to 1 if sparc decoder is enabled. */
    -#define HAVE_DECODER_SPARC 1
    -
    -/* Define to 1 if x86 decoder is enabled. */
    -#define HAVE_DECODER_X86 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_DLFCN_H 1
    -
    -/* Define to 1 if arm encoder is enabled. */
    -#define HAVE_ENCODER_ARM 1
    -
    -/* Define to 1 if armthumb encoder is enabled. */
    -#define HAVE_ENCODER_ARMTHUMB 1
    -
    -/* Define to 1 if delta encoder is enabled. */
    -#define HAVE_ENCODER_DELTA 1
    -
    -/* Define to 1 if ia64 encoder is enabled. */
    -#define HAVE_ENCODER_IA64 1
    -
    -/* Define to 1 if lzma1 encoder is enabled. */
    -#define HAVE_ENCODER_LZMA1 1
    -
    -/* Define to 1 if lzma2 encoder is enabled. */
    -#define HAVE_ENCODER_LZMA2 1
    -
    -/* Define to 1 if powerpc encoder is enabled. */
    -#define HAVE_ENCODER_POWERPC 1
    -
    -/* Define to 1 if sparc encoder is enabled. */
    -#define HAVE_ENCODER_SPARC 1
    -
    -/* Define to 1 if x86 encoder is enabled. */
    -#define HAVE_ENCODER_X86 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_FCNTL_H 1
    -
    -/* Define to 1 if you have the `futimens' function. */
    -#define HAVE_FUTIMENS 1
    -
    -/* Define to 1 if you have the `futimes' function. */
    -/* #undef HAVE_FUTIMES */
    -
    -/* Define to 1 if you have the `futimesat' function. */
    -/* #undef HAVE_FUTIMESAT */
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_GETOPT_H 1
    -
    -/* Define to 1 if you have the `getopt_long' function. */
    -#define HAVE_GETOPT_LONG 1
    -
    -/* Define if the GNU gettext() function is already present or preinstalled. */
    -/* #undef HAVE_GETTEXT */
    -
    -#if !defined(__minix)
    -/* Define if you have the iconv() function and it works. */
    -#define HAVE_ICONV 1
    -
    -/* Define to 1 if you have the  header file. */
    -#if defined(__i386__) || defined(__x86_64__)
    -#define HAVE_IMMINTRIN_H 1
    -#endif
    -#endif /* !defined(__minix) */
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_INTTYPES_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_LIMITS_H 1
    -
    -/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
    -#define HAVE_MBRTOWC 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_MEMORY_H 1
    -
    -/* Define to 1 to enable bt2 match finder. */
    -#define HAVE_MF_BT2 1
    -
    -/* Define to 1 to enable bt3 match finder. */
    -#define HAVE_MF_BT3 1
    -
    -/* Define to 1 to enable bt4 match finder. */
    -#define HAVE_MF_BT4 1
    -
    -/* Define to 1 to enable hc3 match finder. */
    -#define HAVE_MF_HC3 1
    -
    -/* Define to 1 to enable hc4 match finder. */
    -#define HAVE_MF_HC4 1
    -
    -/* Define to 1 if you have the  header file. */
    -/* #undef HAVE_MINIX_SHA2_H */
    -
    -/* Define to 1 if getopt.h declares extern int optreset. */
    -#define HAVE_OPTRESET 1
    -
    -/* Define to 1 if you have the `pipe2' function. */
    -#define HAVE_PIPE2 1
    -
    -#if !defined(__minix)
    -/* Define to 1 if you have the `posix_fadvise' function. */
    -#define HAVE_POSIX_FADVISE 1
    -
    -/* Define to 1 if you have the `pthread_condattr_setclock' function. */
    -#define HAVE_PTHREAD_CONDATTR_SETCLOCK 1
    -#endif /* !defined(__minix) */
    -
    -/* Have PTHREAD_PRIO_INHERIT. */
    -/* #undef HAVE_PTHREAD_PRIO_INHERIT */
    -
    -/* Define to 1 if you have the `SHA256Init' function. */
    -/* #undef HAVE_SHA256INIT */
    -
    -/* Define to 1 if the system has the type `SHA256_CTX'. */
    -#define HAVE_SHA256_CTX 1
    -
    -/* Define to 1 if you have the  header file. */
    -/* #undef HAVE_SHA256_H */
    -
    -/* Define to 1 if you have the `SHA256_Init' function. */
    -#define HAVE_SHA256_INIT 1
    -
    -/* Define to 1 if the system has the type `SHA2_CTX'. */
    -/* #undef HAVE_SHA2_CTX */
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_SHA2_H 1
    -
    -/* Define to 1 if optimizing for size. */
    -/* #undef HAVE_SMALL */
    -
    -/* Define to 1 if stdbool.h conforms to C99. */
    -#define HAVE_STDBOOL_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_STDINT_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_STDLIB_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_STRINGS_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_STRING_H 1
    -
    -/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
    -#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
    -
    -/* Define to 1 if `st_atimespec.tv_nsec' is a member of `struct stat'. */
    -#define HAVE_STRUCT_STAT_ST_ATIMESPEC_TV_NSEC 1
    -
    -/* Define to 1 if `st_atim.st__tim.tv_nsec' is a member of `struct stat'. */
    -/* #undef HAVE_STRUCT_STAT_ST_ATIM_ST__TIM_TV_NSEC */
    -
    -/* Define to 1 if `st_atim.tv_nsec' is a member of `struct stat'. */
    -#define HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC 1
    -
    -/* Define to 1 if `st_uatime' is a member of `struct stat'. */
    -/* #undef HAVE_STRUCT_STAT_ST_UATIME */
    -
    -/* Define to 1 if you have the  header file. */
    -/* #undef HAVE_SYS_BYTEORDER_H */
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_SYS_ENDIAN_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_SYS_PARAM_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_SYS_STAT_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_SYS_TIME_H 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_SYS_TYPES_H 1
    -
    -/* Define to 1 if the system has the type `uintptr_t'. */
    -#define HAVE_UINTPTR_T 1
    -
    -/* Define to 1 if you have the  header file. */
    -#define HAVE_UNISTD_H 1
    -
    -/* Define to 1 if you have the `utime' function. */
    -/* #undef HAVE_UTIME */
    -
    -/* Define to 1 if you have the `utimes' function. */
    -/* #undef HAVE_UTIMES */
    -
    -/* Define to 1 or 0, depending whether the compiler supports simple visibility
    -   declarations. */
    -#define HAVE_VISIBILITY 1
    -
    -/* Define to 1 if you have the `wcwidth' function. */
    -#define HAVE_WCWIDTH 1
    -
    -/* Define to 1 if the system has the type `_Bool'. */
    -#define HAVE__BOOL 1
    -
    -#if !defined(__minix)
    -/* Define to 1 if _mm_movemask_epi8 is available. */
    -#define HAVE__MM_MOVEMASK_EPI8 1
    -#endif /* !defined(__minix) */
    -
    -/* Define to the sub-directory where libtool stores uninstalled libraries. */
    -#define LT_OBJDIR ".libs/"
    -
    -#if !defined(__minix)
    -/* Define to 1 when using POSIX threads (pthreads). */
    -#define MYTHREAD_POSIX 1
    -#endif /* !defined(__minix) */
    -
    -/* Define to 1 when using Windows Vista compatible threads. This uses features
    -   that are not available on Windows XP. */
    -/* #undef MYTHREAD_VISTA */
    -
    -/* Define to 1 when using Windows 95 (and thus XP) compatible threads. This
    -   avoids use of features that were added in Windows Vista. */
    -/* #undef MYTHREAD_WIN95 */
    -
    -/* Define to 1 to disable debugging code. */
    -#define NDEBUG 1
    -
    -/* Name of package */
    -#define PACKAGE "xz"
    -
    -/* Define to the address where bug reports for this package should be sent. */
    -#define PACKAGE_BUGREPORT "lasse.collin@tukaani.org"
    -
    -/* Define to the full name of this package. */
    -#define PACKAGE_NAME "XZ Utils"
    -
    -/* Define to the full name and version of this package. */
    -#define PACKAGE_STRING "XZ Utils 5.2.1"
    -
    -/* Define to the one symbol short name of this package. */
    -#define PACKAGE_TARNAME "xz"
    -
    -/* Define to the home page for this package. */
    -#define PACKAGE_URL "http://tukaani.org/xz/"
    -
    -/* Define to the version of this package. */
    -#define PACKAGE_VERSION "5.2.1"
    -
    -/* Define to necessary symbol if this constant uses a non-standard name on
    -   your system. */
    -/* #undef PTHREAD_CREATE_JOINABLE */
    -
    -/* The size of `size_t', as computed by sizeof. */
    -#define SIZEOF_SIZE_T 8
    -
    -/* Define to 1 if you have the ANSI C header files. */
    -#define STDC_HEADERS 1
    -
    -/* Define to 1 if the number of available CPU cores can be detected with
    -   cpuset(2). */
    -/* #undef TUKLIB_CPUCORES_CPUSET */
    -
    -/* Define to 1 if the number of available CPU cores can be detected with
    -   pstat_getdynamic(). */
    -/* #undef TUKLIB_CPUCORES_PSTAT_GETDYNAMIC */
    -
    -/* Define to 1 if the number of available CPU cores can be detected with
    -   sysconf(_SC_NPROCESSORS_ONLN) or sysconf(_SC_NPROC_ONLN). */
    -/* #undef TUKLIB_CPUCORES_SYSCONF */
    -
    -/* Define to 1 if the number of available CPU cores can be detected with
    -   sysctl(). */
    -#define TUKLIB_CPUCORES_SYSCTL 1
    -
    -/* Define to 1 if the system supports fast unaligned access to 16-bit and
    -   32-bit integers. */
    -#include 
    -#ifdef __NO_STRICT_ALIGNMENT
    -# define TUKLIB_FAST_UNALIGNED_ACCESS 1
    -#endif
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   _system_configuration.physmem. */
    -/* #undef TUKLIB_PHYSMEM_AIX */
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   getinvent_r(). */
    -/* #undef TUKLIB_PHYSMEM_GETINVENT_R */
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   getsysinfo(). */
    -/* #undef TUKLIB_PHYSMEM_GETSYSINFO */
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   pstat_getstatic(). */
    -/* #undef TUKLIB_PHYSMEM_PSTAT_GETSTATIC */
    -
    -/* Define to 1 if the amount of physical memory can be detected with
    -   sysconf(_SC_PAGESIZE) and sysconf(_SC_PHYS_PAGES). */
    -#define TUKLIB_PHYSMEM_SYSCONF 1
    -
    -/* Define to 1 if the amount of physical memory can be detected with sysctl().
    -   */
    -/* #undef TUKLIB_PHYSMEM_SYSCTL */
    -
    -/* Define to 1 if the amount of physical memory can be detected with Linux
    -   sysinfo(). */
    -/* #undef TUKLIB_PHYSMEM_SYSINFO */
    -
    -/* Enable extensions on AIX 3, Interix.  */
    -#ifndef _ALL_SOURCE
    -# define _ALL_SOURCE 1
    -#endif
    -/* Enable GNU extensions on systems that have them.  */
    -#ifndef _GNU_SOURCE
    -# define _GNU_SOURCE 1
    -#endif
    -/* Enable threading extensions on Solaris.  */
    -#ifndef _POSIX_PTHREAD_SEMANTICS
    -# define _POSIX_PTHREAD_SEMANTICS 1
    -#endif
    -/* Enable extensions on HP NonStop.  */
    -#ifndef _TANDEM_SOURCE
    -# define _TANDEM_SOURCE 1
    -#endif
    -/* Enable general extensions on Solaris.  */
    -#ifndef __EXTENSIONS__
    -# define __EXTENSIONS__ 1
    -#endif
    -
    -
    -/* Version number of package */
    -#define VERSION "5.2.1"
    -
    -#if !defined(__NetBSD__) && !defined(__minix)
    -/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
    -   significant byte first (like Motorola and SPARC, unlike Intel). */
    -#if defined AC_APPLE_UNIVERSAL_BUILD
    -# if defined __BIG_ENDIAN__
    -#  define WORDS_BIGENDIAN 1
    -# endif
    -#else
    -# ifndef WORDS_BIGENDIAN
    -/* #  undef WORDS_BIGENDIAN */
    -# endif
    -#endif
    -#else
    -# include 
    -# if BYTE_ORDER == BIG_ENDIAN
    -#  define WORDS_BIGENDIAN 1
    -# endif
    -#endif
    -
    -/* Enable large inode numbers on Mac OS X 10.5.  */
    -#ifndef _DARWIN_USE_64_BIT_INODE
    -# define _DARWIN_USE_64_BIT_INODE 1
    -#endif
    -
    -/* Number of bits in a file offset, on hosts where this is settable. */
    -/* #undef _FILE_OFFSET_BITS */
    -
    -/* Define for large files, on AIX-style hosts. */
    -/* #undef _LARGE_FILES */
    -
    -#if !defined(__minix)
    -/* Define to 1 if on MINIX. */
    -/* #undef _MINIX */
    -
    -/* Define to 2 if the system does not provide POSIX.1 features except with
    -   this defined. */
    -/* #undef _POSIX_1_SOURCE */
    -
    -/* Define to 1 if you need to in order for `stat' and other things to work. */
    -/* #undef _POSIX_SOURCE */
    -#else
    -#define _MINIX 1
    -#define _POSIX_1_SOURCE 2
    -#define _POSIX_SOURCE 1
    -#endif /* !defined(__minix) */
    -/* Define for Solaris 2.5.1 so the uint32_t typedef from ,
    -   , or  is not used. If the typedef were allowed, the
    -   #define below would cause a syntax error. */
    -/* #undef _UINT32_T */
    -
    -/* Define for Solaris 2.5.1 so the uint64_t typedef from ,
    -   , or  is not used. If the typedef were allowed, the
    -   #define below would cause a syntax error. */
    -/* #undef _UINT64_T */
    -
    -/* Define for Solaris 2.5.1 so the uint8_t typedef from ,
    -   , or  is not used. If the typedef were allowed, the
    -   #define below would cause a syntax error. */
    -/* #undef _UINT8_T */
    -
    -/* Define to rpl_ if the getopt replacement functions and variables should be
    -   used. */
    -/* #undef __GETOPT_PREFIX */
    -
    -/* Define to the type of a signed integer type of width exactly 32 bits if
    -   such a type exists and the standard includes do not define it. */
    -/* #undef int32_t */
    -
    -/* Define to the type of a signed integer type of width exactly 64 bits if
    -   such a type exists and the standard includes do not define it. */
    -/* #undef int64_t */
    -
    -/* Define to the type of an unsigned integer type of width exactly 16 bits if
    -   such a type exists and the standard includes do not define it. */
    -/* #undef uint16_t */
    -
    -/* Define to the type of an unsigned integer type of width exactly 32 bits if
    -   such a type exists and the standard includes do not define it. */
    -/* #undef uint32_t */
    -
    -/* Define to the type of an unsigned integer type of width exactly 64 bits if
    -   such a type exists and the standard includes do not define it. */
    -/* #undef uint64_t */
    -
    -/* Define to the type of an unsigned integer type of width exactly 8 bits if
    -   such a type exists and the standard includes do not define it. */
    -/* #undef uint8_t */
    -
    -/* Define to the type of an unsigned integer type wide enough to hold a
    -   pointer, if such a type exists, and if the system does not define it. */
    -/* #undef uintptr_t */
    diff --git a/external/public-domain/xz/lib/Makefile b/external/public-domain/xz/lib/Makefile
    deleted file mode 100644
    index e258f1bdb..000000000
    --- a/external/public-domain/xz/lib/Makefile
    +++ /dev/null
    @@ -1,95 +0,0 @@
    -# $NetBSD: Makefile,v 1.5 2015/04/17 20:12:45 christos Exp $
    -
    -LIB=		lzma
    -USE_SHLIBDIR=	yes
    -NOLINT=		yes
    -
    -.include 
    -
    -.PATH:	${XZSRCDIR}/src/liblzma/api ${XZSRCDIR}/src/liblzma/api/lzma
    -INCS+=	base.h bcj.h block.h check.h container.h delta.h \
    -	filter.h hardware.h index.h index_hash.h lzma.h lzma12.h \
    -	stream_flags.h version.h vli.h
    -
    -INCSDIR_lzma.h=	/usr/include
    -INCSDIR=	/usr/include/lzma
    -
    -LDFLAGS+=	-Wl,-z,defs
    -
    -CPPFLAGS+=	-I${XZSRCDIR}/src/liblzma/check
    -CPPFLAGS+=	-I${XZSRCDIR}/src/liblzma/common
    -CPPFLAGS+=	-I${XZSRCDIR}/src/liblzma/delta
    -CPPFLAGS+=	-I${XZSRCDIR}/src/liblzma/lz
    -CPPFLAGS+=	-I${XZSRCDIR}/src/liblzma/lzma
    -CPPFLAGS+=	-I${XZSRCDIR}/src/liblzma/rangecoder
    -CPPFLAGS+=	-I${XZSRCDIR}/src/liblzma/simple
    -CPPFLAGS+=	-DTUKLIB_SYMBOL_PREFIX=lzma_
    -CPPFLAGS+=	-DNETBSD_NATIVE_SHA256
    -
    -.PATH:	${XZSRCDIR}/src/common
    -SRCS+=	tuklib_physmem.c tuklib_cpucores.c
    -
    -.PATH:	${XZSRCDIR}/src/liblzma/check
    -SRCS+=	check.c crc32_table.c crc64_table.c
    -SRCS+=	crc32_fast.c crc64_fast.c
    -
    -#__MINIX: No pthreads:
    -#         hardware_cputhreads.c outqueue.c stream_encoder_mt.c
    -.PATH:	${XZSRCDIR}/src/liblzma/common
    -SRCS+=	common.c block_util.c easy_preset.c filter_common.c \
    -	hardware_physmem.c index.c \
    -	stream_flags_common.c vli_size.c \
    -	alone_encoder.c block_buffer_encoder.c block_encoder.c \
    -	block_header_encoder.c easy_buffer_encoder.c easy_encoder.c \
    -	easy_encoder_memusage.c filter_buffer_encoder.c \
    -	filter_encoder.c filter_flags_encoder.c index_encoder.c \
    -	stream_buffer_encoder.c stream_encoder.c \
    -	stream_flags_encoder.c vli_encoder.c \
    -	alone_decoder.c auto_decoder.c block_buffer_decoder.c \
    -	block_decoder.c block_header_decoder.c easy_decoder_memusage.c \
    -	filter_buffer_decoder.c filter_decoder.c filter_flags_decoder.c \
    -	index_decoder.c index_hash.c stream_buffer_decoder.c \
    -	stream_decoder.c stream_flags_decoder.c vli_decoder.c
    -
    -.PATH:	${XZSRCDIR}/src/liblzma/delta
    -SRCS+=	delta_common.c delta_encoder.c delta_decoder.c
    -
    -.PATH:	${XZSRCDIR}/src/liblzma/lz
    -SRCS+=	lz_decoder.c lz_encoder.c lz_encoder_mf.c
    -
    -.PATH:	${XZSRCDIR}/src/liblzma/lzma
    -SRCS+=	lzma_encoder.c lzma_encoder_presets.c \
    -	lzma_encoder_optimum_fast.c lzma_encoder_optimum_normal.c \
    -	lzma_decoder.c lzma2_encoder.c lzma2_decoder.c \
    -	fastpos_table.c
    -
    -.PATH:	${XZSRCDIR}/src/liblzma/rangecoder
    -SRCS+=	price_table.c
    -
    -.PATH:	${XZSRCDIR}/src/liblzma/simple
    -SRCS+=	simple_coder.c simple_encoder.c simple_decoder.c \
    -	arm.c armthumb.c ia64.c powerpc.c sparc.c x86.c
    -
    -liblzma.pc:	${XZSRCDIR}/src/liblzma/liblzma.pc.in
    -	${_MKTARGET_CREATE}
    -	rm -f ${.TARGET}
    -	${TOOL_SED} \
    -	    -e 's,@prefix@,/usr,' \
    -	    -e 's,@exec_prefix@,/usr,' \
    -	    -e 's,@libdir@,/usr/lib,' \
    -	    -e 's,@includedir@,/usr/include,' \
    -	    -e 's,@PACKAGE_HOMEPAGE@,${XZHOMEPAGE:Q},' \
    -	    -e 's,@PACKAGE_VERSION@,${XZVERSION:Q},' \
    -	    -e 's,@PTHREAD_CFLAGS@ @PTHREAD_LIBS@,,' \
    -	    < ${XZSRCDIR}/src/liblzma/liblzma.pc.in \
    -	    > ${.TARGET}.tmp && \
    -	mv -f ${.TARGET}.tmp ${.TARGET}
    -
    -CLEANFILES+=	liblzma.pc
    -
    -.if !defined(__MINIX)
    -LDADD+=	-lpthread
    -DPADD+=	${LIBPTHREAD}
    -.endif # defined(__MINIX)
    -
    -.include 
    diff --git a/external/public-domain/xz/lib/shlib_version b/external/public-domain/xz/lib/shlib_version
    deleted file mode 100644
    index 78235a7c8..000000000
    --- a/external/public-domain/xz/lib/shlib_version
    +++ /dev/null
    @@ -1,4 +0,0 @@
    -#	$NetBSD: shlib_version,v 1.3 2015/04/17 18:49:23 christos Exp $
    -#
    -major=2
    -minor=0
    diff --git a/external/public-domain/xz/prepare-import.sh b/external/public-domain/xz/prepare-import.sh
    deleted file mode 100644
    index 64c350a7e..000000000
    --- a/external/public-domain/xz/prepare-import.sh
    +++ /dev/null
    @@ -1,42 +0,0 @@
    -#!/bin/sh
    -# $NetBSD: prepare-import.sh,v 1.4 2015/04/17 18:49:23 christos Exp $
    -
    -set -e
    -
    -rm -rf dist tmp
    -tar xzf xz-5.2.1.tar.gz
    -mv xz-5.2.1 dist
    -
    -cd dist
    -# Binary files derived from distribution files
    -rm -rf doc/man
    -# Files under GPL
    -rm -rf build-aux extra lib m4/[a-s]* m4/[u-z]* src/scripts/xz* Doxyfile.in
    -# Files not of relevance
    -rm -rf ABOUT-NLS aclocal.m4 autogen.sh configure COPYING.*GPL* INSTALL.generic
    -mkdir po.tmp
    -mv po/*.po po/*.gmo po.tmp/
    -rm -rf po
    -mv po.tmp po
    -rm -rf debug dos windows
    -rm -rf Makefile* */Makefile* */*/Makefile* */*/*/Makefile*
    -# Binary files to be encoded
    -for f in tests/compress_prepared_bcj_sparc tests/compress_prepared_bcj_x86 \
    -	 tests/files/*.xz; do
    -	uuencode -m $f $f > $f.base64
    -	rm $f
    -done
    -
    -# Files under GPL/LGPL kept:
    -# build-aux/* from autoconf
    -# lib/*
    -# m4/*
    -
    -# Changes to config.h
    -echo Add build-time endian test to include/config.h:
    -cat << EOE
    -#include 
    -#if BYTE_ORDER == BIG_ENDIAN
    -#  define WORDS_BIGENDIAN 1
    -#endif
    -EOE
    diff --git a/include/rpc/rpcb_prot.x b/include/rpc/rpcb_prot.x
    deleted file mode 100644
    index ac848d0e0..000000000
    --- a/include/rpc/rpcb_prot.x
    +++ /dev/null
    @@ -1,559 +0,0 @@
    -%/*
    -% * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
    -% * unrestricted use provided that this legend is included on all tape
    -% * media and as a part of the software program in whole or part.  Users
    -% * may copy or modify Sun RPC without charge, but are not authorized
    -% * to license or distribute it to anyone else except as part of a product or
    -% * program developed by the user.
    -% *
    -% * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
    -% * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
    -% * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
    -% *
    -% * Sun RPC is provided with no support and without any obligation on the
    -% * part of Sun Microsystems, Inc. to assist in its use, correction,
    -% * modification or enhancement.
    -% *
    -% * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
    -% * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
    -% * OR ANY PART THEREOF.
    -% *
    -% * In no event will Sun Microsystems, Inc. be liable for any lost revenue
    -% * or profits or other special, indirect and consequential damages, even if
    -% * Sun has been advised of the possibility of such damages.
    -% *
    -% * Sun Microsystems, Inc.
    -% * 2550 Garcia Avenue
    -% * Mountain View, California  94043
    -% */
    -%/*
    -% * Copyright (c) 1988 by Sun Microsystems, Inc.
    -% */
    -
    -%/* from rpcb_prot.x */
    -
    -#ifdef RPC_HDR
    -%
    -%/* #pragma ident	"@(#)rpcb_prot.x	1.5	94/04/29 SMI" */
    -%
    -%#ifndef _KERNEL
    -%
    -#endif
    -
    -/*
    - * rpcb_prot.x
    - * rpcbind protocol, versions 3 and 4, in RPC Language
    - */
    -%
    -%/*
    -% * The following procedures are supported by the protocol in version 3:
    -% *
    -% * RPCBPROC_NULL() returns ()
    -% * 	takes nothing, returns nothing
    -% *
    -% * RPCBPROC_SET(rpcb) returns (bool_t)
    -% * 	TRUE is success, FALSE is failure.  Registers the tuple
    -% *	[prog, vers, address, owner, netid].
    -% *	Finds out owner and netid information on its own.
    -% *
    -% * RPCBPROC_UNSET(rpcb) returns (bool_t)
    -% *	TRUE is success, FALSE is failure.  Un-registers tuple
    -% *	[prog, vers, netid].  addresses is ignored.
    -% *	If netid is NULL, unregister all.
    -% *
    -% * RPCBPROC_GETADDR(rpcb) returns (string).
    -% *	0 is failure.  Otherwise returns the universal address where the
    -% *	triple [prog, vers, netid] is registered.  Ignore address and owner.
    -% *
    -% * RPCBPROC_DUMP() RETURNS (rpcblist_ptr)
    -% *	used to dump the entire rpcbind maps
    -% *
    -% * RPCBPROC_CALLIT(rpcb_rmtcallargs)
    -% * 	RETURNS (rpcb_rmtcallres);
    -% * 	Calls the procedure on the remote machine.  If it is not registered,
    -% *	this procedure is quiet; i.e. it does not return error information!!!
    -% *	This routine only passes null authentication parameters.
    -% *	It has no interface to xdr routines for RPCBPROC_CALLIT.
    -% *
    -% * RPCBPROC_GETTIME() returns (int).
    -% *	Gets the remote machines time
    -% *
    -% * RPCBPROC_UADDR2TADDR(strint) RETURNS (struct netbuf)
    -% *	Returns the netbuf address from universal address.
    -% *
    -% * RPCBPROC_TADDR2UADDR(struct netbuf) RETURNS (string)
    -% *	Returns the universal address from netbuf address.
    -% *
    -% * END OF RPCBIND VERSION 3 PROCEDURES
    -% */
    -%/*
    -% * Except for RPCBPROC_CALLIT, the procedures above are carried over to
    -% * rpcbind version 4.  Those below are added or modified for version 4.
    -% * NOTE: RPCBPROC_BCAST HAS THE SAME FUNCTIONALITY AND PROCEDURE NUMBER
    -% * AS RPCBPROC_CALLIT.
    -% *
    -% * RPCBPROC_BCAST(rpcb_rmtcallargs)
    -% * 	RETURNS (rpcb_rmtcallres);
    -% * 	Calls the procedure on the remote machine.  If it is not registered,
    -% *	this procedure IS quiet; i.e. it DOES NOT return error information!!!
    -% *	This routine should be used for broadcasting and nothing else.
    -% *
    -% * RPCBPROC_GETVERSADDR(rpcb) returns (string).
    -% *	0 is failure.  Otherwise returns the universal address where the
    -% *	triple [prog, vers, netid] is registered.  Ignore address and owner.
    -% *	Same as RPCBPROC_GETADDR except that if the given version number
    -% *	is not available, the address is not returned.
    -% *
    -% * RPCBPROC_INDIRECT(rpcb_rmtcallargs)
    -% * 	RETURNS (rpcb_rmtcallres);
    -% * 	Calls the procedure on the remote machine.  If it is not registered,
    -% *	this procedure is NOT quiet; i.e. it DOES return error information!!!
    -% * 	as any normal application would expect.
    -% *
    -% * RPCBPROC_GETADDRLIST(rpcb) returns (rpcb_entry_list_ptr).
    -% *	Same as RPCBPROC_GETADDR except that it returns a list of all the
    -% *	addresses registered for the combination (prog, vers) (for all
    -% *	transports).
    -% *
    -% * RPCBPROC_GETSTAT(void) returns (rpcb_stat_byvers)
    -% *	Returns the statistics about the kind of requests received by rpcbind.
    -% */
    -%
    -%/*
    -% * A mapping of (program, version, network ID) to address
    -% */
    -struct rpcb {
    -	rpcprog_t r_prog;		/* program number */
    -	rpcvers_t r_vers;		/* version number */
    -	string r_netid<>;		/* network id */
    -	string r_addr<>;		/* universal address */
    -	string r_owner<>;		/* owner of this service */
    -};
    -#ifdef RPC_HDR
    -%
    -%typedef rpcb RPCB;
    -%
    -#endif
    -%
    -%/*
    -% * A list of mappings
    -% *
    -% * Below are two definitions for the rpcblist structure.  This is done because
    -% * xdr_rpcblist() is specified to take a struct rpcblist **, rather than a
    -% * struct rpcblist * that rpcgen would produce.  One version of the rpcblist
    -% * structure (actually called rp__list) is used with rpcgen, and the other is
    -% * defined only in the header file for compatibility with the specified
    -% * interface.
    -% */
    -
    -struct rp__list {
    -	rpcb rpcb_map;
    -	struct rp__list *rpcb_next;
    -};
    -
    -typedef rp__list *rpcblist_ptr;		/* results of RPCBPROC_DUMP */
    -
    -#ifdef RPC_HDR
    -%
    -%typedef struct rp__list rpcblist;
    -%typedef struct rp__list RPCBLIST;
    -%
    -%#ifndef __cplusplus
    -%struct rpcblist {
    -%	RPCB rpcb_map;
    -%	struct rpcblist *rpcb_next;
    -%};
    -%#endif
    -%
    -%#ifdef __cplusplus
    -%extern "C" {
    -%#endif
    -%#if __STDC__
    -%extern  bool_t xdr_rpcblist(XDR *, rpcblist**);
    -%#else /* K&R C */
    -%bool_t xdr_rpcblist();
    -%#endif
    -%#ifdef	__cplusplus
    -%}
    -%#endif
    -%
    -#endif
    -
    -%
    -%/*
    -% * Arguments of remote calls
    -% */
    -struct rpcb_rmtcallargs {
    -	rpcprog_t prog;			/* program number */
    -	rpcvers_t vers;			/* version number */
    -	rpcproc_t proc;			/* procedure number */
    -	opaque args<>;			/* argument */
    -};
    -#ifdef RPC_HDR
    -%
    -%/*
    -% * Client-side only representation of rpcb_rmtcallargs structure.
    -% *
    -% * The routine that XDRs the rpcb_rmtcallargs structure must deal with the
    -% * opaque arguments in the "args" structure.  xdr_rpcb_rmtcallargs() needs to
    -% * be passed the XDR routine that knows the args' structure.  This routine
    -% * doesn't need to go over-the-wire (and it wouldn't make sense anyway) since
    -% * the application being called already knows the args structure.  So we use a
    -% * different "XDR" structure on the client side, r_rpcb_rmtcallargs, which
    -% * includes the args' XDR routine.
    -% */
    -%struct r_rpcb_rmtcallargs {
    -%	rpcprog_t prog;
    -%	rpcvers_t vers;
    -%	rpcproc_t proc;
    -%	struct {
    -%		u_int args_len;
    -%		const char *args_val;
    -%	} args;
    -%	xdrproc_t	xdr_args;	/* encodes args */
    -%};
    -%
    -#endif	/* def RPC_HDR */
    -%
    -%/*
    -% * Results of the remote call
    -% */
    -struct rpcb_rmtcallres {
    -	string addr<>;			/* remote universal address */
    -	opaque results<>;		/* result */
    -};
    -#ifdef RPC_HDR
    -%
    -%/*
    -% * Client-side only representation of rpcb_rmtcallres structure.
    -% */
    -%struct r_rpcb_rmtcallres {
    -%	char *addr;
    -%	struct {
    -%		u_int32_t results_len;
    -%		char *results_val;
    -%	} results;
    -%	xdrproc_t	xdr_res;	/* decodes results */
    -%};
    -#endif /* RPC_HDR */
    -%
    -%/*
    -% * rpcb_entry contains a merged address of a service on a particular
    -% * transport, plus associated netconfig information.  A list of rpcb_entrys
    -% * is returned by RPCBPROC_GETADDRLIST.  See netconfig.h for values used
    -% * in r_nc_* fields.
    -% */
    -struct rpcb_entry {
    -	string		r_maddr<>;	/* merged address of service */
    -	string		r_nc_netid<>;	/* netid field */
    -	unsigned int	r_nc_semantics;	/* semantics of transport */
    -	string		r_nc_protofmly<>; /* protocol family */
    -	string		r_nc_proto<>;	/* protocol name */
    -};
    -%
    -%/*
    -% * A list of addresses supported by a service.
    -% */
    -struct rpcb_entry_list {
    -	rpcb_entry rpcb_entry_map;
    -	struct rpcb_entry_list *rpcb_entry_next;
    -};
    -
    -typedef rpcb_entry_list *rpcb_entry_list_ptr;
    -
    -%
    -%/*
    -% * rpcbind statistics
    -% */
    -%
    -const rpcb_highproc_2 = RPCBPROC_CALLIT;
    -const rpcb_highproc_3 = RPCBPROC_TADDR2UADDR;
    -const rpcb_highproc_4 = RPCBPROC_GETSTAT;
    -
    -const RPCBSTAT_HIGHPROC = 13;	/* # of procs in rpcbind V4 plus one */
    -const RPCBVERS_STAT = 3;	/* provide only for rpcbind V2, V3 and V4 */
    -const RPCBVERS_4_STAT = 2;
    -const RPCBVERS_3_STAT = 1;
    -const RPCBVERS_2_STAT = 0;
    -%
    -%/* Link list of all the stats about getport and getaddr */
    -struct rpcbs_addrlist {
    -	rpcprog_t prog;
    -	rpcvers_t vers;
    -	int success;
    -	int failure;
    -	string netid<>;
    -	struct rpcbs_addrlist *next;
    -};
    -%
    -%/* Link list of all the stats about rmtcall */
    -struct rpcbs_rmtcalllist {
    -	rpcprog_t prog;
    -	rpcvers_t vers;
    -	rpcproc_t proc;
    -	int success;
    -	int failure;
    -	int indirect;	/* whether callit or indirect */
    -	string netid<>;
    -	struct rpcbs_rmtcalllist *next;
    -};
    -
    -typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
    -typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
    -typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
    -
    -struct rpcb_stat {
    -	rpcbs_proc		info;
    -	int			setinfo;
    -	int			unsetinfo;
    -	rpcbs_addrlist_ptr	addrinfo;
    -	rpcbs_rmtcalllist_ptr	rmtinfo;
    -};
    -%
    -%/*
    -% * One rpcb_stat structure is returned for each version of rpcbind
    -% * being monitored.
    -% */
    -
    -typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
    -
    -#ifdef RPC_HDR
    -%
    -%/*
    -% * We don't define netbuf in RPCL, since it would contain structure member
    -% * names that would conflict with the definition of struct netbuf in
    -% * .  Instead we merely declare the XDR routine xdr_netbuf() here,
    -% * and implement it ourselves in rpc/rpcb_prot.c.
    -% */
    -%#ifdef __cplusplus
    -%extern "C" bool_t xdr_netbuf(XDR *, struct netbuf *);
    -%
    -%#elif __STDC__
    -%extern  bool_t xdr_netbuf(XDR *, struct netbuf *);
    -%
    -%#else /* K&R C */
    -%bool_t xdr_netbuf();
    -%
    -%#endif /* K&R C*/
    -#endif /* def RPC_HDR */
    -
    -/*
    - * rpcbind procedures
    - */
    -program RPCBPROG {
    -	version RPCBVERS {
    -		bool
    -		RPCBPROC_SET(rpcb) = 1;
    -
    -		bool
    -		RPCBPROC_UNSET(rpcb) = 2;
    -
    -		string
    -		RPCBPROC_GETADDR(rpcb) = 3;
    -
    -		rpcblist_ptr
    -		RPCBPROC_DUMP(void) = 4;
    -
    -		rpcb_rmtcallres
    -		RPCBPROC_CALLIT(rpcb_rmtcallargs) = 5;
    -
    -		unsigned int
    -		RPCBPROC_GETTIME(void) = 6;
    -
    -		struct netbuf
    -		RPCBPROC_UADDR2TADDR(string) = 7;
    -
    -		string
    -		RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
    -	} = 3;
    -
    -	version RPCBVERS4 {
    -		bool
    -		RPCBPROC_SET(rpcb) = 1;
    -
    -		bool
    -		RPCBPROC_UNSET(rpcb) = 2;
    -
    -		string
    -		RPCBPROC_GETADDR(rpcb) = 3;
    -
    -		rpcblist_ptr
    -		RPCBPROC_DUMP(void) = 4;
    -
    -		/*
    -		 * NOTE: RPCBPROC_BCAST has the same functionality as CALLIT;
    -		 * the new name is intended to indicate that this
    -		 * procedure should be used for broadcast RPC, and
    -		 * RPCBPROC_INDIRECT should be used for indirect calls.
    -		 */
    -		rpcb_rmtcallres
    -		RPCBPROC_BCAST(rpcb_rmtcallargs) = RPCBPROC_CALLIT;
    -
    -		unsigned int
    -		RPCBPROC_GETTIME(void) = 6;
    -
    -		struct netbuf
    -		RPCBPROC_UADDR2TADDR(string) = 7;
    -
    -		string
    -		RPCBPROC_TADDR2UADDR(struct netbuf) = 8;
    -
    -		string
    -		RPCBPROC_GETVERSADDR(rpcb) = 9;
    -
    -		rpcb_rmtcallres
    -		RPCBPROC_INDIRECT(rpcb_rmtcallargs) = 10;
    -
    -		rpcb_entry_list_ptr
    -		RPCBPROC_GETADDRLIST(rpcb) = 11;
    -
    -		rpcb_stat_byvers
    -		RPCBPROC_GETSTAT(void) = 12;
    -	} = 4;
    -} = 100000;
    -#ifdef RPC_HDR
    -%
    -%#define	RPCBVERS_3		RPCBVERS
    -%#define	RPCBVERS_4		RPCBVERS4
    -%
    -%#define	_PATH_RPCBINDSOCK	"/var/run/rpcbind.sock"
    -%
    -%#else		/* ifndef _KERNEL */
    -%#ifdef __cplusplus
    -%extern "C" {
    -%#endif
    -%
    -%/*
    -% * A mapping of (program, version, network ID) to address
    -% */
    -%struct rpcb {
    -%	rpcprog_t r_prog;		/* program number */
    -%	rpcvers_t r_vers;		/* version number */
    -%	char *r_netid;			/* network id */
    -%	char *r_addr;			/* universal address */
    -%	char *r_owner;			/* owner of the mapping */
    -%};
    -%typedef struct rpcb RPCB;
    -%
    -%/*
    -% * A list of mappings
    -% */
    -%struct rpcblist {
    -%	RPCB rpcb_map;
    -%	struct rpcblist *rpcb_next;
    -%};
    -%typedef struct rpcblist RPCBLIST;
    -%typedef struct rpcblist *rpcblist_ptr;
    -%
    -%/*
    -% * Remote calls arguments
    -% */
    -%struct rpcb_rmtcallargs {
    -%	rpcprog_t prog;			/* program number */
    -%	rpcvers_t vers;			/* version number */
    -%	rpcproc_t proc;			/* procedure number */
    -%	u_int32_t arglen;			/* arg len */
    -%	caddr_t args_ptr;		/* argument */
    -%	xdrproc_t xdr_args;		/* XDR routine for argument */
    -%};
    -%typedef struct rpcb_rmtcallargs rpcb_rmtcallargs;
    -%
    -%/*
    -% * Remote calls results
    -% */
    -%struct rpcb_rmtcallres {
    -%	char *addr_ptr;			/* remote universal address */
    -%	u_int32_t resultslen;		/* results length */
    -%	caddr_t results_ptr;		/* results */
    -%	xdrproc_t xdr_results;		/* XDR routine for result */
    -%};
    -%typedef struct rpcb_rmtcallres rpcb_rmtcallres;
    -%
    -%struct rpcb_entry {
    -%	char *r_maddr;
    -%	char *r_nc_netid;
    -%	unsigned int r_nc_semantics;
    -%	char *r_nc_protofmly;
    -%	char *r_nc_proto;
    -%};
    -%typedef struct rpcb_entry rpcb_entry;
    -%
    -%/*
    -% * A list of addresses supported by a service.
    -% */
    -%
    -%struct rpcb_entry_list {
    -%	rpcb_entry rpcb_entry_map;
    -%	struct rpcb_entry_list *rpcb_entry_next;
    -%};
    -%typedef struct rpcb_entry_list rpcb_entry_list;
    -%
    -%typedef rpcb_entry_list *rpcb_entry_list_ptr;
    -%
    -%/*
    -% * rpcbind statistics
    -% */
    -%
    -%#define	rpcb_highproc_2 RPCBPROC_CALLIT
    -%#define	rpcb_highproc_3 RPCBPROC_TADDR2UADDR
    -%#define	rpcb_highproc_4 RPCBPROC_GETSTAT
    -%#define	RPCBSTAT_HIGHPROC 13
    -%#define	RPCBVERS_STAT 3
    -%#define	RPCBVERS_4_STAT 2
    -%#define	RPCBVERS_3_STAT 1
    -%#define	RPCBVERS_2_STAT 0
    -%
    -%/* Link list of all the stats about getport and getaddr */
    -%
    -%struct rpcbs_addrlist {
    -%	rpcprog_t prog;
    -%	rpcvers_t vers;
    -%	int success;
    -%	int failure;
    -%	char *netid;
    -%	struct rpcbs_addrlist *next;
    -%};
    -%typedef struct rpcbs_addrlist rpcbs_addrlist;
    -%
    -%/* Link list of all the stats about rmtcall */
    -%
    -%struct rpcbs_rmtcalllist {
    -%	rpcprog_t prog;
    -%	rpcvers_t vers;
    -%	rpcproc_t proc;
    -%	int success;
    -%	int failure;
    -%	int indirect;
    -%	char *netid;
    -%	struct rpcbs_rmtcalllist *next;
    -%};
    -%typedef struct rpcbs_rmtcalllist rpcbs_rmtcalllist;
    -%
    -%typedef int rpcbs_proc[RPCBSTAT_HIGHPROC];
    -%
    -%typedef rpcbs_addrlist *rpcbs_addrlist_ptr;
    -%
    -%typedef rpcbs_rmtcalllist *rpcbs_rmtcalllist_ptr;
    -%
    -%struct rpcb_stat {
    -%	rpcbs_proc info;
    -%	int setinfo;
    -%	int unsetinfo;
    -%	rpcbs_addrlist_ptr addrinfo;
    -%	rpcbs_rmtcalllist_ptr rmtinfo;
    -%};
    -%typedef struct rpcb_stat rpcb_stat;
    -%
    -%/*
    -% * One rpcb_stat structure is returned for each version of rpcbind
    -% * being monitored.
    -% */
    -%
    -%typedef rpcb_stat rpcb_stat_byvers[RPCBVERS_STAT];
    -%
    -%#ifdef __cplusplus
    -%}
    -%#endif
    -%
    -%#endif		/* ifndef _KERNEL */
    -#endif		/* RPC_HDR */
    diff --git a/include/tgmath.h b/include/tgmath.h
    deleted file mode 100644
    index 01e38693e..000000000
    --- a/include/tgmath.h
    +++ /dev/null
    @@ -1,173 +0,0 @@
    -/*
    - * Copyright (c) 1987, 1997, 2006,
    - * Vrije Universiteit, Amsterdam, The Netherlands.
    - * All rights reserved. Redistribution and use of the MINIX 3 operating system
    - * in source and binary forms, with or without modification, are permitted
    - * provided that the following conditions are met:
    - *
    - *   * Redistributions of source code must retain the above copyright notice,
    - *     this list of conditions and the following disclaimer.
    - *   * Redistributions in binary form must reproduce the above copyright
    - *     notice, this list of conditions and the following disclaimer in the
    - *     documentation and/or other materials provided with the distribution.
    - *   * Neither the name of the Vrije Universiteit nor the names of the software
    - *     authors or contributors may be used to endorse or promote products
    - *     derived from this software without specific prior written permission.
    - *   * Any deviations from these conditions require written permission from the
    - *     copyright holder in advance
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS, AUTHORS, AND
    - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
    - * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
    - * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL PRENTICE HALL OR ANY
    - * AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
    - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
    - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
    - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
    - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    - *
    - * Contributions by Matt Thomas.
    - */
    -
    -#ifndef _TGMATH_H_
    -#define _TGMATH_H_
    -
    -#include 
    -#include 
    -
    -/*
    - * C99 Type-generic math (7.22)
    - */
    -#ifdef __GNUC__
    -#define __TG_CHOOSE(p, a, b) __builtin_choose_expr((p), (a), (b))
    -#define __TG_IS_EQUIV_TYPE_P(v, t)                                             \
    -  __builtin_types_compatible_p(__typeof__(v), t)
    -#else
    -#error how does this compler do type-generic macros?
    -#endif
    -
    -#define __TG_IS_FCOMPLEX_P(t) __TG_IS_EQUIV_TYPE_P(t, float complex)
    -#define __TG_IS_DCOMPLEX_P(t) __TG_IS_EQUIV_TYPE_P(t, double complex)
    -#define __TG_IS_LCOMPLEX_P(t) __TG_IS_EQUIV_TYPE_P(t, long double complex)
    -#define __TG_IS_FLOAT_P(t) __TG_IS_EQUIV_TYPE_P(t, float)
    -#define __TG_IS_LDOUBLE_P(t) __TG_IS_EQUIV_TYPE_P(t, long double)
    -#define __TG_IS_FREAL_P(t) (__TG_IS_FLOAT_P(t) || __TG_IS_FCOMPLEX_P(t))
    -#define __TG_IS_LREAL_P(t) (__TG_IS_LDOUBLE_P(t) || __TG_IS_LCOMPLEX_P(t))
    -
    -#define __TG_IS_COMPLEX_P(t)                                                   \
    -  (__TG_IS_FCOMPLEX_P(t) || __TG_IS_DCOMPLEX_P(t) || __TG_IS_LCOMPLEX_P(t))
    -
    -#define __TG_GFN1(fn, a, ftype, ltype)                                         \
    -  __TG_CHOOSE(__TG_IS_##ftype##_P(a), fn##f(a),                                \
    -              __TG_CHOOSE(__TG_IS_##ltype##_P(a), fn##l(a), fn(a)))
    -
    -#define __TG_GFN1x(fn, a, b, ftype, ltype)                                     \
    -  __TG_CHOOSE(                                                                 \
    -      __TG_IS_##ftype##_P(a), fn##f((a), (b)),                                 \
    -      __TG_CHOOSE(__TG_IS_##ltype##_P(a), fn##l((a), (b)), fn((a), (b))))
    -
    -#define __TG_GFN2(fn, a, b, ftype, ltype)                                      \
    -  __TG_CHOOSE(__TG_IS_##ftype##_P(a) && __TG_IS_##ftype##_P(b),                \
    -              fn##f((a), (b)),                                                 \
    -              __TG_CHOOSE(__TG_IS_##ltype##_P(a) || __TG_IS_##ltype##_P(b),    \
    -                          fn##l((a), (b)), fn((a), (b))))
    -
    -#define __TG_GFN2x(fn, a, b, c, ftype, ltype)                                  \
    -  __TG_CHOOSE(__TG_IS_##ftype##_P(a) && __TG_IS_##ftype##_P(b),                \
    -              fn##f((a), (b), (c)),                                            \
    -              __TG_CHOOSE(__TG_IS_##ltype##_P(a) || __TG_IS_##ltype##_P(b),    \
    -                          fn##l((a), (b), (c)), fn((a), (b), (c))))
    -
    -#define __TG_GFN3(fn, a, b, c, ftype, ltype)                                   \
    -  __TG_CHOOSE(__TG_IS_##ftype##_P(a) && __TG_IS_##ftype##_P(b) &&              \
    -                  __TG_IS_##ftype##_P(c),                                      \
    -              fn##f((a), (b), (c)),                                            \
    -              __TG_CHOOSE(__TG_IS_##ltype##_P(a) || __TG_IS_##ltype##_P(b) ||  \
    -                              __TG_IS_##ltype##_P(c),                          \
    -                          fn##l((a), (b), (c)), fn((a), (b), (c))))
    -
    -#define __TG_CFN1(cfn, a) __TG_GFN1(cfn, a, FREAL, LREAL)
    -#define __TG_CFN2(cfn, a, b) __TG_GFN2(cfn, a, b, FREAL, LREAL)
    -
    -#define __TG_FN1(fn, a) __TG_GFN1(fn, a, FLOAT, LDOUBLE)
    -#define __TG_FN1x(fn, a, b) __TG_GFN1x(fn, a, b, FLOAT, LDOUBLE)
    -#define __TG_FN2(fn, a, b) __TG_GFN2(fn, a, b, FLOAT, LDOUBLE)
    -#define __TG_FN2x(fn, a, b, c) __TG_GFN2x(fn, a, b, c, FLOAT, LDOUBLE)
    -#define __TG_FN3(fn, a, b, c) __TG_GFN3(fn, a, b, c, FLOAT, LDOUBLE)
    -
    -#define __TG_COMPLEX(a, fn)                                                    \
    -  __TG_CHOOSE(__TG_IS_COMPLEX_P(a), __TG_CFN1(c##fn, (a)), __TG_FN1(fn, (a)))
    -
    -#define __TG_COMPLEX1(a, cfn, fn)                                              \
    -  __TG_CHOOSE(__TG_IS_COMPLEX_P(a), __TG_CFN1(cfn, (a)), __TG_FN1(fn, (a)))
    -
    -#define __TG_COMPLEX2(a, b, fn)                                                \
    -  __TG_CHOOSE(__TG_IS_COMPLEX_P(a) || __TG_IS_COMPLEX_P(b),                    \
    -              __TG_CFN2(c##fn, (a), (b)), __TG_FN2(fn, (a), (b)))
    -
    -#define acos(a) __TG_COMPLEX((a), acos)
    -#define asin(a) __TG_COMPLEX((a), asin)
    -#define atan(a) __TG_COMPLEX((a), atan)
    -#define acosh(a) __TG_COMPLEX((a), acosh)
    -#define asinh(a) __TG_COMPLEX((a), asinh)
    -#define atanh(a) __TG_COMPLEX((a), atanh)
    -#define cos(a) __TG_COMPLEX((a), cos)
    -#define sin(a) __TG_COMPLEX((a), sin)
    -#define tan(a) __TG_COMPLEX((a), tan)
    -#define cosh(a) __TG_COMPLEX((a), cosh)
    -#define sinh(a) __TG_COMPLEX((a), sinh)
    -#define tanh(a) __TG_COMPLEX((a), tanh)
    -#define exp(a) __TG_COMPLEX((a), exp)
    -#define log(a) __TG_COMPLEX((a), log)
    -#define pow(a, b) __TG_COMPLEX2((a), (b), pow)
    -#define sqrt(a) __TG_COMPLEX((a), sqrt)
    -#define fabs(a) __TG_COMPLEX1((a), cabs, fabs)
    -
    -#define atan2(a, b) __TG_FN2(atan2, (a), (b))
    -#define cbrt(a) __TG_FN1(cbrt, (a))
    -#define ceil(a) __TG_FN1(ceil, (a))
    -#define copysign(a, b) __TG_FN2(copysign, (a), (b))
    -#define erf(a) __TG_FN1(erf, (a))
    -#define erfc(a) __TG_FN1(erfc, (a))
    -#define exp2(a) __TG_FN1(exp2, (a))
    -#define expm1(a) __TG_FN1(expm1, (a))
    -#define fdim(a, b) __TG_FN2(fdim, (a), (b))
    -#define floor(a) __TG_FN1(floor, (a))
    -#define fma(a, b, c) __TG_FN3(fma, (a), (b), (c))
    -#define fmax(a, b) __TG_FN2(fmax, (a), (b))
    -#define fmin(a, b) __TG_FN2(fmin, (a), (b))
    -#define fmod(a, b) __TG_FN2(fmod, (a), (b))
    -#define frexp(a, b) __TG_FN1x(frexp, (a), (b))
    -#define hypot(a, b) __TG_FN2(hypot, (a), (b))
    -#define ilogb(a) __TG_FN1(ilogb, (a))
    -#define ldexp(a, b) __TG_FN1x(ldexp, (a), (b))
    -#define lgamma(a) __TG_FN1(lgamma, (a))
    -#define llrint(a) __TG_FN1(llrint, (a))
    -#define llround(a) __TG_FN1(llround, (a))
    -#define log10(a) __TG_FN1(log10, (a))
    -#define log1p(a) __TG_FN1(log1p, (a))
    -#define log2(a) __TG_FN1(log2, (a))
    -#define logb(a) __TG_FN1(logb, (a))
    -#define lrint(a) __TG_FN1(lrint, (a))
    -#define lround(a) __TG_FN1(lround, (a))
    -#define nearbyint(a) __TG_FN1(nearbyint, (a))
    -#define nextafter(a, b) __TG_FN2(nextafter, (a), (b))
    -#define nexttoward(a, b) __TG_FN2(nexttoward, (a), (b))
    -#define remainder(a, b) __TG_FN2(remainder, (a), (b))
    -#define remquo(a, b, c) __TG_FN2x(remquo, (a), (b), (c))
    -#define rint(a) __TG_FN1(rint, (a))
    -#define round(a) __TG_FN1(round, (a))
    -#define scalbn(a, b) __TG_FN1x(scalbn, (a), (b))
    -#define scalb1n(a, b) __TG_FN1x(scalb1n, (a), (b))
    -#define tgamma(a) __TG_FN1(tgamma, (a))
    -#define trunc(a) __TG_FN1(trunc, (a))
    -
    -#define carg(a) __TG_CFN1(carg, (a))
    -#define cimag(a) __TG_CFN1(cimag, (a))
    -#define conj(a) __TG_CFN1(conj, (a))
    -#define cproj(a) __TG_CFN1(cproj, (a))
    -#define creal(a) __TG_CFN1(creal, (a))
    -
    -#endif /* !_TGMATH_H_ */
    diff --git a/libexec/Makefile b/libexec/Makefile
    deleted file mode 100644
    index 7a530915d..000000000
    --- a/libexec/Makefile
    +++ /dev/null
    @@ -1,20 +0,0 @@
    -#	$NetBSD: Makefile,v 1.61 2012/02/07 19:13:31 joerg Exp $
    -#	@(#)Makefile	8.1 (Berkeley) 6/4/93
    -
    -.include 
    -
    -SUBDIR= \
    -	fingerd ftpd getty httpd \
    -	ld.elf_so \
    -	rshd \
    -	telnetd
    -
    -.if defined(__MINIX)
    -SUBDIR+= makewhatis
    -.else
    -.if ${MKMAKEMANDB} == "no"
    -SUBDIR+= getNAME makewhatis
    -.endif
    -.endif # defined(__MINIX)
    -
    -.include 
    diff --git a/libexec/Makefile.inc b/libexec/Makefile.inc
    deleted file mode 100644
    index d433d2138..000000000
    --- a/libexec/Makefile.inc
    +++ /dev/null
    @@ -1,7 +0,0 @@
    -#	$NetBSD: Makefile.inc,v 1.9 2012/06/19 06:10:09 dholland Exp $
    -#	@(#)Makefile.inc	8.1 (Berkeley) 6/4/93
    -
    -USE_FORT?= yes		# network server
    -
    -BINDIR?=	/usr/libexec
    -WARNS?=		5
    diff --git a/libexec/fingerd/Makefile b/libexec/fingerd/Makefile
    deleted file mode 100644
    index 4ade1c2fb..000000000
    --- a/libexec/fingerd/Makefile
    +++ /dev/null
    @@ -1,13 +0,0 @@
    -#	$NetBSD: Makefile,v 1.9 2005/01/10 02:58:58 lukem Exp $
    -#	from: @(#)Makefile	8.1 (Berkeley) 6/4/93
    -
    -.include 
    -
    -PROG=	fingerd
    -MAN=	fingerd.8
    -
    -.if (${USE_INET6} != "no")
    -CPPFLAGS+=-DINET6
    -.endif
    -
    -.include 
    diff --git a/libexec/fingerd/fingerd.8 b/libexec/fingerd/fingerd.8
    deleted file mode 100644
    index e38d8f917..000000000
    --- a/libexec/fingerd/fingerd.8
    +++ /dev/null
    @@ -1,175 +0,0 @@
    -.\"	$NetBSD: fingerd.8,v 1.20 2003/11/02 11:27:49 wiz Exp $
    -.\"
    -.\" Copyright (c) 1980, 1991, 1993
    -.\"	The Regents of the University of California.  All rights reserved.
    -.\"
    -.\" Redistribution and use in source and binary forms, with or without
    -.\" modification, are permitted provided that the following conditions
    -.\" are met:
    -.\" 1. Redistributions of source code must retain the above copyright
    -.\"    notice, this list of conditions and the following disclaimer.
    -.\" 2. Redistributions in binary form must reproduce the above copyright
    -.\"    notice, this list of conditions and the following disclaimer in the
    -.\"    documentation and/or other materials provided with the distribution.
    -.\" 3. Neither the name of the University nor the names of its contributors
    -.\"    may be used to endorse or promote products derived from this software
    -.\"    without specific prior written permission.
    -.\"
    -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    -.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    -.\" SUCH DAMAGE.
    -.\"
    -.\"     from: @(#)fingerd.8	8.1 (Berkeley) 6/4/93
    -.\"
    -.Dd September 12, 2002
    -.Dt FINGERD 8
    -.Os
    -.Sh NAME
    -.Nm fingerd
    -.Nd remote user information server
    -.Sh SYNOPSIS
    -.Nm
    -.Op Fl 8ghlmpSsu
    -.Op Fl P Ar filename
    -.Sh DESCRIPTION
    -.Nm
    -is a simple protocol based on RFC 1288
    -that provides an interface to the
    -Name and Finger programs at several network sites.
    -The program is supposed to return a friendly,
    -human-oriented status report on either the system at the moment
    -or a particular person in depth.
    -There is no required format and the
    -protocol consists mostly of specifying a single
    -.Dq command line .
    -.Pp
    -.Nm
    -is started by
    -.Xr inetd 8 ,
    -which listens for
    -.Tn TCP
    -requests at port 79.
    -Once handed a connection,
    -.Nm
    -reads a single command line
    -terminated by a
    -.Aq Tn CRLF
    -which it then passes to
    -.Xr finger 1 .
    -.Nm
    -closes its connections as soon as the output is finished.
    -.Pp
    -If the line is null (i.e., just a
    -.Aq Tn CRLF
    -is sent) then
    -.Xr finger 1
    -returns a
    -.Dq default
    -report that lists all people logged into
    -the system at that moment.
    -.Pp
    -If a user name is specified (e.g.,
    -.Pf eric Aq Tn CRLF )
    -then the
    -response lists more extended information for only that particular user,
    -whether logged in or not.
    -Allowable
    -.Dq names
    -in the command line include both
    -.Dq login names
    -and
    -.Dq user names .
    -If a name is ambiguous, all possible derivations are returned.
    -.Pp
    -The following options may be passed to
    -.Nm
    -as server program arguments in
    -.Pa /etc/inetd.conf :
    -.Bl -tag -width XPXfilenameX
    -.It Fl 8
    -Enable 8-bit output.
    -.It Fl g
    -Do not show any gecos information besides the users' real names.
    -.It Fl h
    -Display the name of the remote host in short mode,
    -instead of the office location and office phone.
    -.It Fl l
    -Enable logging.
    -The name of the host originating the query, and the actual request
    -is reported via
    -.Xr syslog 3
    -at LOG_NOTICE priority.
    -A request of the form
    -.Sq /W
    -or
    -.Sq /w
    -will return long output.
    -Empty requests will return all currently logged in users.
    -All other requests look for specific users.
    -See RFC 1288 for details.
    -.It Fl m
    -Prevent matching of
    -.Ar user
    -names.
    -.Ar User
    -is usually a login name; however, matching will also be done on the
    -users' real names, unless the
    -.Fl m
    -option is supplied.
    -.It Fl P Ar filename
    -Use an alternate program as the local information provider.
    -The default local program executed by
    -.Nm
    -is
    -.Xr finger 1 .
    -By specifying a customized local server, this option allows a system manager
    -to have more control over what information is provided to remote sites.
    -.It Fl p
    -Prevents
    -.Xr finger 1
    -from displaying the contents of the
    -.Dq Pa .plan
    -and
    -.Dq Pa .project
    -files.
    -.It Fl S
    -Prints user information in short mode, one line per user.
    -This overrides the
    -.Dq Pa Whois switch
    -that may be passed in from the remote client.
    -.It Fl s
    -Disable forwarding of queries to other remote hosts.
    -.It Fl u
    -Queries without a user name are rejected.
    -.El
    -.Sh SEE ALSO
    -.Xr finger 1 ,
    -.Xr inetd 8
    -.Sh HISTORY
    -The
    -.Nm
    -command appeared in
    -.Bx 4.3 .
    -.Sh BUGS
    -Connecting directly to the server from a
    -.Tn TIP
    -or an equally narrow-minded
    -.Tn TELNET Ns -protocol
    -user program can result
    -in meaningless attempts at option negotiation being sent to the
    -server, which will foul up the command line interpretation.
    -.Nm
    -should be taught to filter out
    -.Tn IAC Ns 's
    -and perhaps even respond
    -negatively
    -.Pq Tn IAC WON'T
    -to all option commands received.
    diff --git a/libexec/fingerd/fingerd.c b/libexec/fingerd/fingerd.c
    deleted file mode 100644
    index 9b7e7c645..000000000
    --- a/libexec/fingerd/fingerd.c
    +++ /dev/null
    @@ -1,233 +0,0 @@
    -/*	$NetBSD: fingerd.c,v 1.27 2012/03/15 02:02:21 joerg Exp $	*/
    -
    -/*
    - * Copyright (c) 1983, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -#include 
    -#ifndef lint
    -__COPYRIGHT("@(#) Copyright (c) 1983, 1993\
    - The Regents of the University of California.  All rights reserved.");
    -#endif /* not lint */
    -
    -#ifndef lint
    -#if 0
    -static char sccsid[] = "from: @(#)fingerd.c	8.1 (Berkeley) 6/4/93";
    -#else
    -__RCSID("$NetBSD: fingerd.c,v 1.27 2012/03/15 02:02:21 joerg Exp $");
    -#endif
    -#endif /* not lint */
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include "pathnames.h"
    -
    -__dead static void my_err(const char *, ...) __printflike(1, 2);
    -
    -int
    -main(int argc, char *argv[])
    -{
    -	FILE *fp;
    -	int ch, ac = 2;
    -	char *lp = NULL /* XXX gcc */;
    -	struct sockaddr_storage ss;
    -	int p[2], logging, no_forward, user_required, short_list;
    -	socklen_t sval;
    -#define	ENTRIES	50
    -	char **ap, *av[ENTRIES + 1], **comp, line[1024], *prog, *s;
    -#if 0
    -	const char *av[ENTRIES + 1], **comp;
    -	const char *prog;
    -#endif
    -	char hostbuf[MAXHOSTNAMELEN];
    -
    -	prog = __UNCONST(_PATH_FINGER);
    -	logging = no_forward = user_required = short_list = 0;
    -	openlog("fingerd", LOG_PID, LOG_DAEMON);
    -	opterr = 0;
    -	while ((ch = getopt(argc, argv, "gsluShmpP:8")) != -1) {
    -		switch (ch) {
    -		case 'l':
    -			logging = 1;
    -			break;
    -		case 'P':
    -			prog = optarg;
    -			break;
    -		case 's':
    -			no_forward = 1;
    -			break;
    -		case 'u':
    -			user_required = 1;
    -			break;
    -		case 'S':
    -			short_list = 1;
    -			av[ac++] = __UNCONST("-s");
    -			break;
    -		case 'h':
    -			av[ac++] = __UNCONST("-h");
    -			break;
    -		case 'm':
    -			av[ac++] = __UNCONST("-m");
    -			break;
    -		case 'p':
    -			av[ac++] = __UNCONST("-p");
    -			break;
    -		case 'g':
    -			av[ac++] = __UNCONST("-g");
    -			break;
    -		case '8':
    -			av[ac++] = __UNCONST("-8");
    -			break;
    -		case '?':
    -		default:
    -			my_err("illegal option -- %c", optopt);
    -		}
    -		if (ac >= ENTRIES)
    -			my_err("Too many options provided");
    -	}
    -
    -
    -	if (logging) {
    -		sval = sizeof(ss);
    -		if (getpeername(0, (struct sockaddr *)&ss, &sval) < 0)
    -			my_err("getpeername: %s", strerror(errno));
    -		(void)getnameinfo((struct sockaddr *)&ss, sval,
    -				hostbuf, sizeof(hostbuf), NULL, 0, 0);
    -		lp = hostbuf;
    -	}
    -	
    -	if (!fgets(line, sizeof(line), stdin)) {
    -		if (logging)
    -			syslog(LOG_NOTICE, "query from %s", lp);
    -		exit(1);
    -	}
    -	while ((s = strrchr(line, '\n')) != NULL ||
    -	    (s = strrchr(line, '\r')) != NULL)
    -		*s = '\0';
    -
    -	if (logging) {
    -		if (*line == '\0')
    -			syslog(LOG_NOTICE, "query from %s", lp);
    -		else
    -			syslog(LOG_NOTICE, "query from %s: %s", lp, line);
    -	}
    -
    -	if (ac >= ENTRIES)
    -		my_err("Too many options provided");
    -	av[ac++] = __UNCONST("--");
    -	comp = &av[1];
    -	for (lp = line, ap = &av[ac]; ac < ENTRIES;) {
    -		if ((*ap = strtok(lp, " \t\r\n")) == NULL)
    -			break;
    -		lp = NULL;
    -		if (no_forward && strchr(*ap, '@')) {
    -			(void) puts("forwarding service denied\r\n");
    -			exit(1);
    -		}
    -
    -		ch = strlen(*ap);
    -		while ((*ap)[ch-1] == '@')
    -			(*ap)[--ch] = '\0';
    -		if (**ap == '\0')
    -			continue;
    -
    -		/* RFC1196: "/[Ww]" == "-l" */
    -		if ((*ap)[0] == '/' && ((*ap)[1] == 'W' || (*ap)[1] == 'w')) {
    -			if (!short_list) {
    -				av[1] = __UNCONST("-l");
    -				comp = &av[0];
    -			}
    -		} else {
    -			ap++;
    -			ac++;
    -		}
    -	}
    -	av[ENTRIES - 1] = NULL;
    -
    -	if ((lp = strrchr(prog, '/')))
    -		*comp = ++lp;
    -	else
    -		*comp = prog;
    -
    -	if (user_required) {
    -		for (ap = comp + 1; strcmp("--", *(ap++)); );
    -		if (*ap == NULL) {
    -			(void) puts("must provide username\r\n");
    -			exit(1);
    -		}
    -	}
    -
    -	if (pipe(p) < 0)
    -		my_err("pipe: %s", strerror(errno));
    -
    -	switch(fork()) {
    -	case 0:
    -		(void) close(p[0]);
    -		if (p[1] != 1) {
    -			(void) dup2(p[1], 1);
    -			(void) close(p[1]);
    -		}
    -		execv(prog, comp);
    -		my_err("execv: %s: %s", prog, strerror(errno));
    -		_exit(1);
    -	case -1:
    -		my_err("fork: %s", strerror(errno));
    -	}
    -	(void) close(p[1]);
    -	if (!(fp = fdopen(p[0], "r")))
    -		my_err("fdopen: %s", strerror(errno));
    -	while ((ch = getc(fp)) != EOF) {
    -		if (ch == '\n')
    -			putchar('\r');
    -		putchar(ch);
    -	}
    -	exit(0);
    -}
    -
    -static void
    -my_err(const char *fmt, ...)
    -{
    -	va_list ap;
    -
    -	va_start(ap, fmt);
    -	(void) vsyslog(LOG_ERR, fmt, ap);
    -	va_end(ap);
    -	exit(1);
    -	/* NOTREACHED */
    -}
    diff --git a/libexec/fingerd/pathnames.h b/libexec/fingerd/pathnames.h
    deleted file mode 100644
    index 0c374332a..000000000
    --- a/libexec/fingerd/pathnames.h
    +++ /dev/null
    @@ -1,34 +0,0 @@
    -/*	$NetBSD: pathnames.h,v 1.4 2003/08/07 09:46:38 agc Exp $	*/
    -
    -/*
    - * Copyright (c) 1989 The Regents of the University of California.
    - * All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - *	from: @(#)pathnames.h	5.3 (Berkeley) 6/1/90
    - */
    -
    -#define	_PATH_FINGER	"/usr/bin/finger"
    diff --git a/libexec/ftpd/Makefile b/libexec/ftpd/Makefile
    deleted file mode 100644
    index 28dabd36b..000000000
    --- a/libexec/ftpd/Makefile
    +++ /dev/null
    @@ -1,63 +0,0 @@
    -#	$NetBSD: Makefile,v 1.64 2015/01/25 15:53:49 christos Exp $
    -#	@(#)Makefile	8.2 (Berkeley) 4/4/94
    -
    -.include 
    -
    -PROG=	ftpd
    -SRCS=	cmds.c conf.c ftpd.c ftpcmd.y logutmp.c logwtmp.c popen.c
    -.if defined(__MINIX)
    -WARNS=	# BJG too many warnings with clang right now
    -CPPFLAGS+=-I${.CURDIR} 
    -.else
    -CPPFLAGS+=-I${.CURDIR} -DSUPPORT_UTMP -DSUPPORT_UTMPX -DLOGIN_CAP
    -.endif # defined(__MINIX)
    -DPADD+=	${LIBCRYPT} ${LIBUTIL}
    -LDADD+=	-lcrypt -lutil
    -MAN=	ftpd.conf.5 ftpusers.5 ftpd.8
    -MLINKS=	ftpusers.5 ftpchroot.5
    -
    -SRCS+=	pfilter.c
    -LDADD+=	-lblacklist
    -DPADD+=	${LIBBLACKLIST}
    -
    -.if defined(NO_INTERNAL_LS)
    -CPPFLAGS+=-DNO_INTERNAL_LS
    -.else
    -# for `internal' ls
    -SRCS+=	ls.c cmp.c print.c util.c
    -.PATH:	${NETBSDSRCDIR}/bin/ls
    -.endif
    -
    -.if (${USE_INET6} != "no")
    -CPPFLAGS+=-DINET6
    -.endif
    -
    -.if (${USE_PAM} != "no")
    -CPPFLAGS+=-DUSE_PAM
    -DPADD+= ${LIBPAM} ${PAM_STATIC_DPADD}
    -LDADD+= -lpam ${PAM_STATIC_LDADD}
    -.else	# USE_PAM == no
    -.if (${USE_SKEY} != "no")
    -CPPFLAGS+=-DSKEY
    -DPADD+= ${LIBSKEY}
    -LDADD+= -lskey
    -.endif
    -.endif	# USE_PAM == no
    -
    -ftpd.o ftpcmd.o: version.h
    -
    -#.if (${USE_KERBEROS} != "no")
    -#
    -#.PATH:	${NETBSDSRCDIR}/usr.bin/login
    -#
    -#SRCS+=	k5login.c
    -#CPPFLAGS+=-DKERBEROS5
    -#DPADD+=	${LIBKRB5} ${LIBASN1}
    -#LDADD+= -lkrb5 -lasn1
    -#
    -#DPADD+=	${LIBCRYPTO} ${{LIBCRYPT} ${LIBROKEN} ${LIBCOM_ERR}
    -#LDADD+=	-lcrypto -lcrypt -lroken -lcom_err
    -#
    -#.endif
    -
    -.include 
    diff --git a/libexec/ftpd/cmds.c b/libexec/ftpd/cmds.c
    deleted file mode 100644
    index d768c48b3..000000000
    --- a/libexec/ftpd/cmds.c
    +++ /dev/null
    @@ -1,969 +0,0 @@
    -/*	$NetBSD: cmds.c,v 1.34 2015/08/10 07:32:49 shm Exp $	*/
    -
    -/*
    - * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
    - * All rights reserved.
    - *
    - * This code is derived from software contributed to The NetBSD Foundation
    - * by Luke Mewburn.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    - * POSSIBILITY OF SUCH DAMAGE.
    - */
    -
    -/*
    - * Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -/*
    - * Copyright (C) 1997 and 1998 WIDE Project.
    - * All rights reserved.
    - * 
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the project nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - * 
    - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -
    -#include 
    -#ifndef lint
    -__RCSID("$NetBSD: cmds.c,v 1.34 2015/08/10 07:32:49 shm Exp $");
    -#endif /* not lint */
    -
    -#include 
    -#include 
    -
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#ifdef KERBEROS5
    -#include 
    -#endif
    -
    -#include "extern.h"
    -
    -typedef enum {
    -	FE_MLSD		= 1<<0,		/* if op is MLSD (MLST otherwise ) */
    -	FE_ISCURDIR	= 1<<1,		/* if name is the current directory */
    -} factflag_t;
    -
    -typedef struct {
    -	const char	*path;		/* full pathname */
    -	const char	*display;	/* name to display */
    -	struct stat	*stat;		/* stat of path */
    -	struct stat	*pdirstat;	/* stat of path's parent dir */
    -	factflag_t	 flags;		/* flags */
    -} factelem;
    -
    -static void	ack(const char *);
    -static void	base64_encode(const char *, size_t, char *, int);
    -static void	fact_type(const char *, FILE *, factelem *);
    -static void	fact_size(const char *, FILE *, factelem *);
    -static void	fact_modify(const char *, FILE *, factelem *);
    -static void	fact_perm(const char *, FILE *, factelem *);
    -static void	fact_unique(const char *, FILE *, factelem *);
    -static int	matchgroup(gid_t);
    -static void	mlsname(FILE *, factelem *);
    -static void	replydirname(const char *, const char *);
    -
    -struct ftpfact {
    -	const char	 *name;		/* name of fact */
    -	int		  enabled;	/* if fact is enabled */
    -	void		(*display)(const char *, FILE *, factelem *);
    -					/* function to display fact */
    -};
    -
    -struct ftpfact facttab[] = {
    -	{ "Type",	1, fact_type },
    -#define	FACT_TYPE 0
    -	{ "Size",	1, fact_size },
    -	{ "Modify",	1, fact_modify },
    -	{ "Perm",	1, fact_perm },
    -	{ "Unique",	1, fact_unique },
    -	/* "Create" */
    -	/* "Lang" */
    -	/* "Media-Type" */
    -	/* "CharSet" */
    -};
    -
    -#define FACTTABSIZE	(sizeof(facttab) / sizeof(struct ftpfact))
    -
    -static char cached_path[MAXPATHLEN + 1] = "/";
    -static void discover_path(char *, const char *);
    -
    -void
    -cwd(const char *path)
    -{
    -
    -	if (chdir(path) < 0)
    -		perror_reply(550, path);
    -	else {
    -		show_chdir_messages(250);
    -		ack("CWD");
    -		if (getcwd(cached_path, MAXPATHLEN) == NULL) {
    -			discover_path(cached_path, path);
    -		}
    -	}
    -}
    -
    -void
    -delete(const char *name)
    -{
    -	char *p = NULL;
    -
    -	if (remove(name) < 0) {
    -		p = strerror(errno);
    -		perror_reply(550, name);
    -	} else
    -		ack("DELE");
    -	logxfer("delete", -1, name, NULL, NULL, p);
    -}
    -
    -void
    -feat(void)
    -{
    -	size_t i;
    -
    -	reply(-211, "Features supported");
    -	cprintf(stdout, " MDTM\r\n");
    -	cprintf(stdout, " MLST ");
    -	for (i = 0; i < FACTTABSIZE; i++)
    -		cprintf(stdout, "%s%s;", facttab[i].name,
    -		    facttab[i].enabled ? "*" : "");
    -	cprintf(stdout, "\r\n");
    -	cprintf(stdout, " REST STREAM\r\n");
    -	cprintf(stdout, " SIZE\r\n");
    -	cprintf(stdout, " TVFS\r\n");
    -	reply(211,  "End");
    -}
    -
    -void
    -makedir(const char *name)
    -{
    -	char *p = NULL;
    -
    -	if (mkdir(name, 0777) < 0) {
    -		p = strerror(errno);
    -		perror_reply(550, name);
    -	} else
    -		replydirname(name, "directory created.");
    -	logxfer("mkdir", -1, name, NULL, NULL, p);
    -}
    -
    -void
    -mlsd(const char *path)
    -{
    -	struct dirent	*dp;
    -	struct stat	 sb, pdirstat;
    -	factelem f;
    -	FILE	*dout;
    -	DIR	*dirp;
    -	char	name[MAXPATHLEN];
    -	int	hastypefact;
    -
    -	hastypefact = facttab[FACT_TYPE].enabled;
    -	if (path == NULL)
    -		path = ".";
    -	if (stat(path, &pdirstat) == -1) {
    - mlsdperror:
    -		perror_reply(550, path);
    -		return;
    -	}
    -	if (! S_ISDIR(pdirstat.st_mode)) {
    -		errno = ENOTDIR;
    -		perror_reply(501, path);
    -		return;
    -	}
    -	if ((dirp = opendir(path)) == NULL)
    -		goto mlsdperror;
    -
    -	dout = dataconn("MLSD", (off_t)-1, "w");
    -	if (dout == NULL) {
    -		(void) closedir(dirp);
    -		return;
    -	}
    -
    -	memset(&f, 0, sizeof(f));
    -	f.stat = &sb;
    -	f.flags |= FE_MLSD;
    -	while ((dp = readdir(dirp)) != NULL) {
    -		snprintf(name, sizeof(name), "%s/%s", path, dp->d_name);
    -		if (ISDOTDIR(dp->d_name)) {	/* special case curdir: */
    -			if (! hastypefact)
    -				continue;
    -			f.pdirstat = NULL;	/*   require stat of parent */
    -			f.display = path;	/*   set name to real name */
    -			f.flags |= FE_ISCURDIR; /*   flag name is curdir */
    -		} else {
    -			if (ISDOTDOTDIR(dp->d_name)) {
    -				if (! hastypefact)
    -					continue;
    -				f.pdirstat = NULL;
    -			} else
    -				f.pdirstat = &pdirstat;	/* cache parent stat */
    -			f.display = dp->d_name;
    -			f.flags &= ~FE_ISCURDIR;
    -		}
    -		if (stat(name, &sb) == -1)
    -			continue;
    -		f.path = name;
    -		mlsname(dout, &f);
    -	}
    -	(void)closedir(dirp);
    -
    -	if (ferror(dout) != 0)
    -		perror_reply(550, "Data connection");
    -	else
    -		reply(226, "MLSD complete.");
    -	closedataconn(dout);
    -	total_xfers_out++;
    -	total_xfers++;
    -}
    -
    -void
    -mlst(const char *path)
    -{
    -	struct stat sb;
    -	factelem f;
    -
    -	if (path == NULL)
    -		path = ".";
    -	if (stat(path, &sb) == -1) {
    -		perror_reply(550, path);
    -		return;
    -	}
    -	reply(-250, "MLST %s", path);
    -	memset(&f, 0, sizeof(f));
    -	f.path = path;
    -	f.display = path;
    -	f.stat = &sb;
    -	f.pdirstat = NULL;
    -	CPUTC(' ', stdout);
    -	mlsname(stdout, &f);
    -	reply(250, "End");
    -}
    -
    -
    -void
    -opts(const char *command)
    -{
    -	struct tab *c;
    -	char *ep;
    -
    -	if ((ep = strchr(command, ' ')) != NULL)
    -		*ep++ = '\0';
    -	c = lookup(cmdtab, command);
    -	if (c == NULL) {
    -		reply(502, "Unknown command '%s'.", command);
    -		return;
    -	}
    -	if (! CMD_IMPLEMENTED(c)) {
    -		reply(502, "%s command not implemented.", c->name);
    -		return;
    -	}
    -	if (! CMD_HAS_OPTIONS(c)) {
    -		reply(501, "%s command does not support persistent options.",
    -		    c->name);
    -		return;
    -	}
    -
    -			/* special case: MLST */
    -	if (strcasecmp(command, "MLST") == 0) {
    -		int	 enabled[FACTTABSIZE];
    -		size_t	 i, onedone;
    -		size_t	 len;
    -		char	*p;
    -
    -		for (i = 0; i < sizeof(enabled) / sizeof(int); i++)
    -			enabled[i] = 0;
    -		if (ep == NULL || *ep == '\0')
    -			goto displaymlstopts;
    -
    -				/* don't like spaces, and need trailing ; */
    -		len = strlen(ep);
    -		if (strchr(ep, ' ') != NULL || ep[len - 1] != ';') {
    - badmlstopt:
    -			reply(501, "Invalid MLST options");
    -			return;
    -		}
    -		ep[len - 1] = '\0';
    -		while ((p = strsep(&ep, ";")) != NULL) {
    -			if (*p == '\0')
    -				goto badmlstopt;
    -			for (i = 0; i < FACTTABSIZE; i++)
    -				if (strcasecmp(p, facttab[i].name) == 0) {
    -					enabled[i] = 1;
    -					break;
    -				}
    -		}
    -
    - displaymlstopts:
    -		for (i = 0; i < FACTTABSIZE; i++)
    -			facttab[i].enabled = enabled[i];
    -		cprintf(stdout, "200 MLST OPTS");
    -		for (i = onedone = 0; i < FACTTABSIZE; i++) {
    -			if (facttab[i].enabled) {
    -				cprintf(stdout, "%s%s;", onedone ? "" : " ",
    -				    facttab[i].name);
    -				onedone++;
    -			}
    -		}
    -		cprintf(stdout, "\r\n");
    -		fflush(stdout);
    -		return;
    -	}
    -
    -			/* default cases */
    -	if (ep != NULL && *ep != '\0')
    -		REASSIGN(c->options, ftpd_strdup(ep));
    -	if (c->options != NULL)
    -		reply(200, "Options for %s are '%s'.", c->name,
    -		    c->options);
    -	else
    -		reply(200, "No options defined for %s.", c->name);
    -}
    -
    -void
    -pwd(void)
    -{
    -	char path[MAXPATHLEN];
    -
    -	if (getcwd(path, sizeof(path) - 1) == NULL) {
    -		if (chdir(cached_path) < 0) {
    -			reply(550, "Can't get the current directory: %s.",
    -			    strerror(errno));
    -			return;
    -		}
    -		(void)strlcpy(path, cached_path, MAXPATHLEN);
    -	}
    -	replydirname(path, "is the current directory.");
    -}
    -
    -void
    -removedir(const char *name)
    -{
    -	char *p = NULL;
    -
    -	if (rmdir(name) < 0) {
    -		p = strerror(errno);
    -		perror_reply(550, name);
    -	} else
    -		ack("RMD");
    -	logxfer("rmdir", -1, name, NULL, NULL, p);
    -}
    -
    -char *
    -renamefrom(const char *name)
    -{
    -	struct stat st;
    -
    -	if (stat(name, &st) < 0) {
    -		perror_reply(550, name);
    -		return (NULL);
    -	}
    -	reply(350, "File exists, ready for destination name");
    -	return (ftpd_strdup(name));
    -}
    -
    -void
    -renamecmd(const char *from, const char *to)
    -{
    -	char *p = NULL;
    -
    -	if (rename(from, to) < 0) {
    -		p = strerror(errno);
    -		perror_reply(550, "rename");
    -	} else
    -		ack("RNTO");
    -	logxfer("rename", -1, from, to, NULL, p);
    -}
    -
    -void
    -sizecmd(const char *filename)
    -{
    -	switch (type) {
    -	case TYPE_L:
    -	case TYPE_I:
    -	    {
    -		struct stat stbuf;
    -		if (stat(filename, &stbuf) < 0 || !S_ISREG(stbuf.st_mode))
    -			reply(550, "%s: not a plain file.", filename);
    -		else
    -			reply(213, ULLF, (ULLT)stbuf.st_size);
    -		break;
    -	    }
    -	case TYPE_A:
    -	    {
    -		FILE *fin;
    -		int c;
    -		off_t count;
    -		struct stat stbuf;
    -		fin = fopen(filename, "r");
    -		if (fin == NULL) {
    -			perror_reply(550, filename);
    -			return;
    -		}
    -		if (fstat(fileno(fin), &stbuf) < 0 || !S_ISREG(stbuf.st_mode)) {
    -			reply(550, "%s: not a plain file.", filename);
    -			(void) fclose(fin);
    -			return;
    -		}
    -		if (stbuf.st_size > 10240) {
    -			reply(550, "%s: file too large for SIZE.", filename);
    -			(void) fclose(fin);
    -			return;
    -		}
    -
    -		count = 0;
    -		while((c = getc(fin)) != EOF) {
    -			if (c == '\n')	/* will get expanded to \r\n */
    -				count++;
    -			count++;
    -		}
    -		(void) fclose(fin);
    -
    -		reply(213, LLF, (LLT)count);
    -		break;
    -	    }
    -	default:
    -		reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]);
    -	}
    -}
    -
    -void
    -statfilecmd(const char *filename)
    -{
    -	FILE *fin;
    -	int c;
    -	int atstart;
    -	const char *argv[] = { INTERNAL_LS, "-lgA", "", NULL };
    -
    -	argv[2] = filename;
    -	fin = ftpd_popen(argv, "r", STDOUT_FILENO);
    -	reply(-211, "status of %s:", filename);
    -/* XXX: use fgetln() or fparseln() here? */
    -	atstart = 1;
    -	while ((c = getc(fin)) != EOF) {
    -		if (c == '\n') {
    -			if (ferror(stdout)){
    -				perror_reply(421, "control connection");
    -				(void) ftpd_pclose(fin);
    -				dologout(1);
    -				/* NOTREACHED */
    -			}
    -			if (ferror(fin)) {
    -				perror_reply(551, filename);
    -				(void) ftpd_pclose(fin);
    -				return;
    -			}
    -			CPUTC('\r', stdout);
    -		}
    -		if (atstart && isdigit(c))
    -			CPUTC(' ', stdout);
    -		CPUTC(c, stdout);
    -		atstart = (c == '\n');
    -	}
    -	(void) ftpd_pclose(fin);
    -	reply(211, "End of Status");
    -}
    -
    -/* -- */
    -
    -static void
    -ack(const char *s)
    -{
    -
    -	reply(250, "%s command successful.", s);
    -}
    -
    -/*
    - * Encode len bytes starting at clear using base64 encoding into encoded,
    - * which should be at least ((len + 2) * 4 / 3 + 1) in size.
    - * If nulterm is non-zero, terminate with \0 otherwise pad to 3 byte boundary
    - * with `='.
    - */
    -static void
    -base64_encode(const char *clear, size_t len, char *encoded, int nulterm)
    -{
    -	static const char base64[] =
    -	    "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    -	const char *c;
    -	char	*e, termchar;
    -	int	 i;
    -
    -			/* determine whether to pad with '=' or NUL terminate */
    -	termchar = nulterm ? '\0' : '=';
    -	c = clear;
    -	e = encoded;
    -			/* convert all but last 2 bytes */
    -	for (i = len; i > 2; i -= 3, c += 3) {
    -		*e++ = base64[(c[0] >> 2) & 0x3f];
    -		*e++ = base64[((c[0] << 4) & 0x30) | ((c[1] >> 4) & 0x0f)];
    -		*e++ = base64[((c[1] << 2) & 0x3c) | ((c[2] >> 6) & 0x03)];
    -		*e++ = base64[(c[2]) & 0x3f];
    -	}
    -			/* handle slop at end */
    -	if (i > 0) {
    -		*e++ = base64[(c[0] >> 2) & 0x3f];
    -		*e++ = base64[((c[0] << 4) & 0x30) |
    -		     (i > 1 ? ((c[1] >> 4) & 0x0f) : 0)];
    -		*e++ = (i > 1) ? base64[(c[1] << 2) & 0x3c] : termchar;
    -		*e++ = termchar;
    -	}
    -	*e = '\0';
    -}
    -
    -static void
    -fact_modify(const char *fact, FILE *fd, factelem *fe)
    -{
    -	struct tm *t;
    -
    -	t = gmtime(&(fe->stat->st_mtime));
    -	cprintf(fd, "%s=%04d%02d%02d%02d%02d%02d;", fact,
    -	    TM_YEAR_BASE + t->tm_year,
    -	    t->tm_mon+1, t->tm_mday,
    -	    t->tm_hour, t->tm_min, t->tm_sec);
    -}
    -
    -static void
    -fact_perm(const char *fact, FILE *fd, factelem *fe)
    -{
    -	int		rok, wok, xok, pdirwok;
    -	struct stat	*pdir;
    -
    -	if (fe->stat->st_uid == geteuid()) {
    -		rok = ((fe->stat->st_mode & S_IRUSR) != 0);
    -		wok = ((fe->stat->st_mode & S_IWUSR) != 0);
    -		xok = ((fe->stat->st_mode & S_IXUSR) != 0);
    -	} else if (matchgroup(fe->stat->st_gid)) {
    -		rok = ((fe->stat->st_mode & S_IRGRP) != 0);
    -		wok = ((fe->stat->st_mode & S_IWGRP) != 0);
    -		xok = ((fe->stat->st_mode & S_IXGRP) != 0);
    -	} else {
    -		rok = ((fe->stat->st_mode & S_IROTH) != 0);
    -		wok = ((fe->stat->st_mode & S_IWOTH) != 0);
    -		xok = ((fe->stat->st_mode & S_IXOTH) != 0);
    -	}
    -
    -	cprintf(fd, "%s=", fact);
    -
    -			/*
    -			 * if parent info not provided, look it up, but
    -			 * only if the current class has modify rights,
    -			 * since we only need this info in such a case.
    -			 */
    -	pdir = fe->pdirstat;
    -	if (pdir == NULL && CURCLASS_FLAGS_ISSET(modify)) {
    -		size_t		len;
    -		char		realdir[MAXPATHLEN], *p;
    -		struct stat	dir;
    -
    -		len = strlcpy(realdir, fe->path, sizeof(realdir));
    -		if (len < sizeof(realdir) - 4) {
    -			if (S_ISDIR(fe->stat->st_mode))
    -				strlcat(realdir, "/..", sizeof(realdir));
    -			else {
    -					/* if has a /, move back to it */
    -					/* otherwise use '..' */
    -				if ((p = strrchr(realdir, '/')) != NULL) {
    -					if (p == realdir)
    -						p++;
    -					*p = '\0';
    -				} else
    -					strlcpy(realdir, "..", sizeof(realdir));
    -			}
    -			if (stat(realdir, &dir) == 0)
    -				pdir = &dir;
    -		}
    -	}
    -	pdirwok = 0;
    -	if (pdir != NULL) {
    -		if (pdir->st_uid == geteuid())
    -			pdirwok = ((pdir->st_mode & S_IWUSR) != 0);
    -		else if (matchgroup(pdir->st_gid))
    -			pdirwok = ((pdir->st_mode & S_IWGRP) != 0);
    -		else
    -			pdirwok = ((pdir->st_mode & S_IWOTH) != 0);
    -	}
    -
    -			/* 'a': can APPE to file */
    -	if (wok && CURCLASS_FLAGS_ISSET(upload) && S_ISREG(fe->stat->st_mode))
    -		CPUTC('a', fd);
    -
    -			/* 'c': can create or append to files in directory */
    -	if (wok && CURCLASS_FLAGS_ISSET(modify) && S_ISDIR(fe->stat->st_mode))
    -		CPUTC('c', fd);
    -
    -			/* 'd': can delete file or directory */
    -	if (pdirwok && CURCLASS_FLAGS_ISSET(modify)) {
    -		int candel;
    -
    -		candel = 1;
    -		if (S_ISDIR(fe->stat->st_mode)) {
    -			DIR *dirp;
    -			struct dirent *dp;
    -
    -			if ((dirp = opendir(fe->display)) == NULL)
    -				candel = 0;
    -			else {
    -				while ((dp = readdir(dirp)) != NULL) {
    -					if (ISDOTDIR(dp->d_name) ||
    -					    ISDOTDOTDIR(dp->d_name))
    -						continue;
    -					candel = 0;
    -					break;
    -				}
    -				closedir(dirp);
    -			}
    -		}
    -		if (candel)
    -			CPUTC('d', fd);
    -	}
    -
    -			/* 'e': can enter directory */
    -	if (xok && S_ISDIR(fe->stat->st_mode))
    -		CPUTC('e', fd);
    -
    -			/* 'f': can rename file or directory */
    -	if (pdirwok && CURCLASS_FLAGS_ISSET(modify))
    -		CPUTC('f', fd);
    -
    -			/* 'l': can list directory */
    -	if (rok && xok && S_ISDIR(fe->stat->st_mode))
    -		CPUTC('l', fd);
    -
    -			/* 'm': can create directory */
    -	if (wok && CURCLASS_FLAGS_ISSET(modify) && S_ISDIR(fe->stat->st_mode))
    -		CPUTC('m', fd);
    -
    -			/* 'p': can remove files in directory */
    -	if (wok && CURCLASS_FLAGS_ISSET(modify) && S_ISDIR(fe->stat->st_mode))
    -		CPUTC('p', fd);
    -
    -			/* 'r': can RETR file */
    -	if (rok && S_ISREG(fe->stat->st_mode))
    -		CPUTC('r', fd);
    -
    -			/* 'w': can STOR file */
    -	if (wok && CURCLASS_FLAGS_ISSET(upload) && S_ISREG(fe->stat->st_mode))
    -		CPUTC('w', fd);
    -
    -	CPUTC(';', fd);
    -}
    -
    -static void
    -fact_size(const char *fact, FILE *fd, factelem *fe)
    -{
    -
    -	if (S_ISREG(fe->stat->st_mode))
    -		cprintf(fd, "%s=" LLF ";", fact, (LLT)fe->stat->st_size);
    -}
    -
    -static void
    -fact_type(const char *fact, FILE *fd, factelem *fe)
    -{
    -
    -	cprintf(fd, "%s=", fact);
    -	switch (fe->stat->st_mode & S_IFMT) {
    -	case S_IFDIR:
    -		if (fe->flags & FE_MLSD) {
    -			if ((fe->flags & FE_ISCURDIR) || ISDOTDIR(fe->display))
    -				cprintf(fd, "cdir");
    -			else if (ISDOTDOTDIR(fe->display))
    -				cprintf(fd, "pdir");
    -			else
    -				cprintf(fd, "dir");
    -		} else {
    -			cprintf(fd, "dir");
    -		}
    -		break;
    -	case S_IFREG:
    -		cprintf(fd, "file");
    -		break;
    -	case S_IFIFO:
    -		cprintf(fd, "OS.unix=fifo");
    -		break;
    -	case S_IFLNK:		/* XXX: probably a NO-OP with stat() */
    -		cprintf(fd, "OS.unix=slink");
    -		break;
    -	case S_IFSOCK:
    -		cprintf(fd, "OS.unix=socket");
    -		break;
    -	case S_IFBLK:
    -	case S_IFCHR:
    -		cprintf(fd, "OS.unix=%s-" ULLF "/" ULLF,
    -		    S_ISBLK(fe->stat->st_mode) ? "blk" : "chr",
    -		    (ULLT)major(fe->stat->st_rdev),
    -		    (ULLT)minor(fe->stat->st_rdev));
    -		break;
    -	default:
    -		cprintf(fd, "OS.unix=UNKNOWN(0%o)", fe->stat->st_mode & S_IFMT);
    -		break;
    -	}
    -	CPUTC(';', fd);
    -}
    -
    -static void
    -fact_unique(const char *fact, FILE *fd, factelem *fe)
    -{
    -	char obuf[(sizeof(dev_t) + sizeof(ino_t) + 2) * 4 / 3 + 2];
    -	char tbuf[sizeof(dev_t) + sizeof(ino_t)];
    -
    -	memcpy(tbuf,
    -	    (char *)&(fe->stat->st_dev), sizeof(dev_t));
    -	memcpy(tbuf + sizeof(dev_t),
    -	    (char *)&(fe->stat->st_ino), sizeof(ino_t));
    -	base64_encode(tbuf, sizeof(dev_t) + sizeof(ino_t), obuf, 1);
    -	cprintf(fd, "%s=%s;", fact, obuf);
    -}
    -
    -static int
    -matchgroup(gid_t gid)
    -{
    -	int	i;
    -
    -	for (i = 0; i < gidcount; i++)
    -		if (gid == gidlist[i])
    -			return(1);
    -	return (0);
    -}
    -
    -static void
    -mlsname(FILE *fp, factelem *fe)
    -{
    -	char realfile[MAXPATHLEN];
    -	int userf = 0;
    -	size_t i;
    -
    -	for (i = 0; i < FACTTABSIZE; i++) {
    -		if (facttab[i].enabled)
    -			(facttab[i].display)(facttab[i].name, fp, fe);
    -	}
    -	if ((fe->flags & FE_MLSD) &&
    -	    !(fe->flags & FE_ISCURDIR) && !ISDOTDIR(fe->display)) {
    -			/* if MLSD and not "." entry, display as-is */
    -		userf = 0;
    -	} else {
    -			/* if MLST, or MLSD and "." entry, realpath(3) it */
    -		if (realpath(fe->display, realfile) != NULL)
    -			userf = 1;
    -	}
    -	cprintf(fp, " %s\r\n", userf ? realfile : fe->display);
    -}
    -
    -static void
    -replydirname(const char *name, const char *message)
    -{
    -	char *p, *ep;
    -	char npath[MAXPATHLEN * 2];
    -
    -	p = npath;
    -	ep = &npath[sizeof(npath) - 1];
    -	while (*name) {
    -		if (*name == '"') {
    -			if (ep - p < 2)
    -				break;
    -			*p++ = *name++;
    -			*p++ = '"';
    -		} else {
    -			if (ep - p < 1)
    -				break;
    -			*p++ = *name++;
    -		}
    -	}
    -	*p = '\0';
    -	reply(257, "\"%s\" %s", npath, message);
    -}
    -
    -static void
    -discover_path(char *last_path, const char *new_path) 
    -{
    -	char tp[MAXPATHLEN + 1] = "";
    -	char tq[MAXPATHLEN + 1] = "";
    -	char *cp;
    -	char *cq; 
    -	int sz1, sz2;
    -	int nomorelink;
    -	struct stat st1, st2;
    -	
    -	if (new_path[0] != '/') {
    -		(void)strlcpy(tp, last_path, MAXPATHLEN);
    -		(void)strlcat(tp, "/", MAXPATHLEN);
    -	}
    -	(void)strlcat(tp, new_path, MAXPATHLEN);
    -	(void)strlcat(tp, "/", MAXPATHLEN);
    -
    -	/* 
    -	 * resolve symlinks. A symlink may introduce another symlink, so we
    -	 * loop trying to resolve symlinks until we don't find any of them.
    -	 */
    -	do {
    -		/* Collapse any // into / */
    -		while ((cp = strstr(tp, "//")) != NULL)
    -			(void)memmove(cp, cp + 1, strlen(cp) - 1 + 1);
    -
    -		/* Collapse any /./ into / */
    -		while ((cp = strstr(tp, "/./")) != NULL)
    -			(void)memmove(cp, cp + 2, strlen(cp) - 2 + 1);
    -
    -		cp = tp;
    -		nomorelink = 1;
    -		
    -		while ((cp = strstr(cp + 1, "/")) != NULL) {
    -			sz1 = (unsigned long)cp - (unsigned long)tp;
    -			if (sz1 > MAXPATHLEN)
    -				goto bad;
    -			*cp = 0;
    -			sz2 = readlink(tp, tq, MAXPATHLEN); 
    -			*cp = '/';
    -
    -			/* If this is not a symlink, move to next / */
    -			if (sz2 <= 0)
    -				continue;
    -
    -			/*
    -			 * We found a symlink, so we will have to 
    -			 * do one more pass to check there is no 
    -			 * more symlink in the path
    -			 */
    -			nomorelink = 0;
    -
    -			/* 
    -			 * Null terminate the string and remove trailing /
    -			 */
    -			tq[sz2] = 0;
    -			sz2 = strlen(tq);
    -			if (tq[sz2 - 1] == '/') 
    -				tq[--sz2] = 0;
    -
    -			/* 
    -			 * Is this an absolute link or a relative link? 
    -			 */
    -			if (tq[0] == '/') {
    -				/* absolute link */
    -				if (strlen(cp) + sz2 > MAXPATHLEN)
    -					goto bad;
    -				memmove(tp + sz2, cp, strlen(cp) + 1);
    -				memcpy(tp, tq, sz2);
    -			} else {			
    -				/* relative link */
    -				for (cq = cp - 1; *cq != '/'; cq--);
    -				if (strlen(tp) -
    -				    ((unsigned long)cq - (unsigned long)cp)
    -				    + 1 + sz2 > MAXPATHLEN)
    -					goto bad;
    -				(void)memmove(cq + 1 + sz2, 
    -				    cp, strlen(cp) + 1);
    -				(void)memcpy(cq + 1, tq, sz2);
    -			}
    -
    -			/* 
    -			 * start over, looking for new symlinks 
    -			 */
    -			break;
    -		}
    -	} while (nomorelink == 0);
    -
    -	/* Collapse any /foo/../ into /foo/ */
    -	while ((cp = strstr(tp, "/../")) != NULL) {
    -		/* ^/../foo/ becomes ^/foo/ */
    -		if (cp == tp) {
    -			(void)memmove(cp, cp + 3,
    -			    strlen(cp) - 3 + 1);
    -		} else {
    -			for (cq = cp - 1; *cq != '/'; cq--);
    -			(void)memmove(cq, cp + 3,
    -			    strlen(cp) - 3 + 1);
    -		}
    -	}
    -
    -	/* strip strailing / */
    -	if (strlen(tp) != 1)
    -		tp[strlen(tp) - 1] = '\0';
    -
    -	/* check that the path is correct */
    -	if (stat(tp, &st1) == -1 || stat(".", &st2) == -1)
    -		goto bad;
    -	if ((st1.st_dev != st2.st_dev) || (st1.st_ino != st2.st_ino))
    -		goto bad;
    -
    -	(void)strlcpy(last_path, tp, MAXPATHLEN);
    -	return;
    -
    -bad:
    -	(void)strlcat(last_path, "/", MAXPATHLEN);
    -	(void)strlcat(last_path, new_path, MAXPATHLEN);
    -	return;
    -}
    -
    diff --git a/libexec/ftpd/conf.c b/libexec/ftpd/conf.c
    deleted file mode 100644
    index 63cdfaeff..000000000
    --- a/libexec/ftpd/conf.c
    +++ /dev/null
    @@ -1,954 +0,0 @@
    -/*	$NetBSD: conf.c,v 1.64 2012/11/04 20:46:46 christos Exp $	*/
    -
    -/*-
    - * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
    - * All rights reserved.
    - *
    - * This code is derived from software contributed to The NetBSD Foundation
    - * by Simon Burge and Luke Mewburn.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    - * POSSIBILITY OF SUCH DAMAGE.
    - */
    -
    -#include 
    -#ifndef lint
    -__RCSID("$NetBSD: conf.c,v 1.64 2012/11/04 20:46:46 christos Exp $");
    -#endif /* not lint */
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#ifdef KERBEROS5
    -#include 
    -#endif
    -
    -#include "extern.h"
    -#include "pathnames.h"
    -
    -static char *strend(const char *, char *);
    -static int filetypematch(char *, int);
    -
    -
    -		/* class defaults */
    -#define DEFAULT_LIMIT		-1		/* unlimited connections */
    -#define DEFAULT_MAXFILESIZE	-1		/* unlimited file size */
    -#define DEFAULT_MAXTIMEOUT	7200		/* 2 hours */
    -#define DEFAULT_TIMEOUT		900		/* 15 minutes */
    -#define DEFAULT_UMASK		027		/* rw-r----- */
    -
    -/*
    - * Initialise curclass to an `empty' state
    - */
    -void
    -init_curclass(void)
    -{
    -	struct ftpconv	*conv, *cnext;
    -
    -	for (conv = curclass.conversions; conv != NULL; conv = cnext) {
    -		REASSIGN(conv->suffix, NULL);
    -		REASSIGN(conv->types, NULL);
    -		REASSIGN(conv->disable, NULL);
    -		REASSIGN(conv->command, NULL);
    -		cnext = conv->next;
    -		free(conv);
    -	}
    -
    -	memset((char *)&curclass.advertise, 0, sizeof(curclass.advertise));
    -	curclass.advertise.su_len = 0;		/* `not used' */
    -	REASSIGN(curclass.chroot, NULL);
    -	REASSIGN(curclass.classname, NULL);
    -	curclass.conversions =	NULL;
    -	REASSIGN(curclass.display, NULL);
    -	REASSIGN(curclass.homedir, NULL);
    -	curclass.limit =	DEFAULT_LIMIT;	
    -	REASSIGN(curclass.limitfile, NULL);
    -	curclass.maxfilesize =	DEFAULT_MAXFILESIZE;
    -	curclass.maxrateget =	0;
    -	curclass.maxrateput =	0;
    -	curclass.maxtimeout =	DEFAULT_MAXTIMEOUT;
    -	REASSIGN(curclass.motd, ftpd_strdup(_NAME_FTPLOGINMESG));
    -	REASSIGN(curclass.notify, NULL);
    -	curclass.portmin =	0;
    -	curclass.portmax =	0;
    -	curclass.rateget =	0;
    -	curclass.rateput =	0;
    -	curclass.timeout =	DEFAULT_TIMEOUT;
    -	    /* curclass.type is set elsewhere */
    -	curclass.umask =	DEFAULT_UMASK;
    -	curclass.mmapsize =	0;
    -	curclass.readsize =	0;
    -	curclass.writesize =	0;
    -	curclass.sendbufsize =	0;
    -	curclass.sendlowat =	0;
    -
    -	CURCLASS_FLAGS_SET(checkportcmd);
    -	CURCLASS_FLAGS_CLR(denyquick);
    -	CURCLASS_FLAGS_CLR(hidesymlinks);
    -	CURCLASS_FLAGS_SET(modify);
    -	CURCLASS_FLAGS_SET(passive);
    -	CURCLASS_FLAGS_CLR(private);
    -	CURCLASS_FLAGS_CLR(sanenames);
    -	CURCLASS_FLAGS_SET(upload);
    -}
    -
    -/*
    - * Parse the configuration file, looking for the named class, and
    - * define curclass to contain the appropriate settings.
    - */
    -void
    -parse_conf(const char *findclass)
    -{
    -	FILE		*f;
    -	char		*buf, *p;
    -	size_t		 len;
    -	LLT		 llval;
    -	int		 none, match;
    -	char		*endp, errbuf[100];
    -	char		*class, *word, *arg, *template;
    -	const char	*infile;
    -	size_t		 line;
    -	struct ftpconv	*conv, *cnext;
    -
    -	init_curclass();
    -	REASSIGN(curclass.classname, ftpd_strdup(findclass));
    -			/* set more guest defaults */
    -	if (strcasecmp(findclass, "guest") == 0) {
    -		CURCLASS_FLAGS_CLR(modify);
    -		curclass.umask = 0707;
    -	}
    -
    -	infile = conffilename(_NAME_FTPDCONF);
    -	if ((f = fopen(infile, "r")) == NULL)
    -		return;
    -
    -	line = 0;
    -	template = NULL;
    -	for (;
    -	    (buf = fparseln(f, &len, &line, NULL, FPARSELN_UNESCCOMM |
    -			    FPARSELN_UNESCCONT | FPARSELN_UNESCESC)) != NULL;
    -	    free(buf)) {
    -		none = match = 0;
    -		p = buf;
    -		if (len < 1)
    -			continue;
    -		if (p[len - 1] == '\n')
    -			p[--len] = '\0';
    -		if (EMPTYSTR(p))
    -			continue;
    -		
    -		NEXTWORD(p, word);
    -		NEXTWORD(p, class);
    -		NEXTWORD(p, arg);
    -		if (EMPTYSTR(word) || EMPTYSTR(class))
    -			continue;
    -		if (strcasecmp(class, "none") == 0)
    -			none = 1;
    -		if (! (strcasecmp(class, findclass) == 0 ||
    -		       (template != NULL && strcasecmp(class, template) == 0) ||
    -		       none ||
    -		       strcasecmp(class, "all") == 0) )
    -			continue;
    -
    -#define CONF_FLAG(Field)						\
    -	do {								\
    -		if (none ||						\
    -		    (!EMPTYSTR(arg) && strcasecmp(arg, "off") == 0))	\
    -			CURCLASS_FLAGS_CLR(Field);			\
    -		else							\
    -			CURCLASS_FLAGS_SET(Field);			\
    -	} while (0)
    -
    -#define CONF_STRING(Field)						\
    -	do {								\
    -		if (none || EMPTYSTR(arg))				\
    -			arg = NULL;					\
    -		else							\
    -			arg = ftpd_strdup(arg);				\
    -		REASSIGN(curclass.Field, arg);				\
    -	} while (0)
    -
    -#define CONF_LL(Field,Arg,Min,Max)					\
    -	do {								\
    -		if (none || EMPTYSTR(Arg))				\
    -			goto nextline;					\
    -		llval = strsuftollx(#Field, Arg, Min, Max,		\
    -		    errbuf, sizeof(errbuf));				\
    -		if (errbuf[0]) {					\
    -			syslog(LOG_WARNING, "%s line %d: %s",		\
    -			    infile, (int)line, errbuf);			\
    -			goto nextline;					\
    -		}							\
    -		curclass.Field = llval;					\
    -	} while(0)
    -
    -		if (0)  {
    -			/* no-op */
    -
    -		} else if ((strcasecmp(word, "advertise") == 0)
    -			|| (strcasecmp(word, "advertize") == 0)) {
    -			struct addrinfo	hints, *res;
    -			int		error;
    -
    -			memset((char *)&curclass.advertise, 0,
    -			    sizeof(curclass.advertise));
    -			curclass.advertise.su_len = 0;
    -			if (none || EMPTYSTR(arg))
    -				continue;
    -			res = NULL;
    -			memset(&hints, 0, sizeof(hints));
    -					/*
    -					 * only get addresses of the family
    -					 * that we're listening on
    -					 */
    -			hints.ai_family = ctrl_addr.su_family;
    -			hints.ai_socktype = SOCK_STREAM;
    -			error = getaddrinfo(arg, "0", &hints, &res);
    -			if (error) {
    -				syslog(LOG_WARNING, "%s line %d: %s",
    -				    infile, (int)line, gai_strerror(error));
    - advertiseparsefail:
    -				if (res)
    -					freeaddrinfo(res);
    -				continue;
    -			}
    -			if (res->ai_next) {
    -				syslog(LOG_WARNING,
    -    "%s line %d: multiple addresses returned for `%s'; please be more specific",
    -				    infile, (int)line, arg);
    -				goto advertiseparsefail;
    -			}
    -			if (sizeof(curclass.advertise) < res->ai_addrlen || (
    -#ifdef INET6
    -			    res->ai_family != AF_INET6 &&
    -#endif
    -			    res->ai_family != AF_INET)) {
    -				syslog(LOG_WARNING,
    -    "%s line %d: unsupported protocol %d for `%s'",
    -				    infile, (int)line, res->ai_family, arg);
    -				goto advertiseparsefail;
    -			}
    -			memcpy(&curclass.advertise, res->ai_addr,
    -			    res->ai_addrlen);
    -			curclass.advertise.su_len = res->ai_addrlen;
    -			freeaddrinfo(res);
    -
    -		} else if (strcasecmp(word, "checkportcmd") == 0) {
    -			CONF_FLAG(checkportcmd);
    -
    -		} else if (strcasecmp(word, "chroot") == 0) {
    -			CONF_STRING(chroot);
    -
    -		} else if (strcasecmp(word, "classtype") == 0) {
    -			if (!none && !EMPTYSTR(arg)) {
    -				if (strcasecmp(arg, "GUEST") == 0)
    -					curclass.type = CLASS_GUEST;
    -				else if (strcasecmp(arg, "CHROOT") == 0)
    -					curclass.type = CLASS_CHROOT;
    -				else if (strcasecmp(arg, "REAL") == 0)
    -					curclass.type = CLASS_REAL;
    -				else {
    -					syslog(LOG_WARNING,
    -				    "%s line %d: unknown class type `%s'",
    -					    infile, (int)line, arg);
    -					continue;
    -				}
    -			}
    -
    -		} else if (strcasecmp(word, "conversion") == 0) {
    -			char *suffix, *types, *disable, *convcmd;
    -
    -			if (EMPTYSTR(arg)) {
    -				syslog(LOG_WARNING,
    -				    "%s line %d: %s requires a suffix",
    -				    infile, (int)line, word);
    -				continue;	/* need a suffix */
    -			}
    -			NEXTWORD(p, types);
    -			NEXTWORD(p, disable);
    -			convcmd = p;
    -			if (convcmd)
    -				convcmd += strspn(convcmd, " \t");
    -			suffix = ftpd_strdup(arg);
    -			if (none || EMPTYSTR(types) ||
    -			    EMPTYSTR(disable) || EMPTYSTR(convcmd)) {
    -				types = NULL;
    -				disable = NULL;
    -				convcmd = NULL;
    -			} else {
    -				types = ftpd_strdup(types);
    -				disable = ftpd_strdup(disable);
    -				convcmd = ftpd_strdup(convcmd);
    -			}
    -			for (conv = curclass.conversions; conv != NULL;
    -			    conv = conv->next) {
    -				if (strcmp(conv->suffix, suffix) == 0)
    -					break;
    -			}
    -			if (conv == NULL) {
    -				conv = (struct ftpconv *)
    -				    calloc(1, sizeof(struct ftpconv));
    -				if (conv == NULL) {
    -					syslog(LOG_WARNING, "can't malloc");
    -					continue;
    -				}
    -				conv->next = NULL;
    -				for (cnext = curclass.conversions;
    -				    cnext != NULL; cnext = cnext->next)
    -					if (cnext->next == NULL)
    -						break;
    -				if (cnext != NULL)
    -					cnext->next = conv;
    -				else
    -					curclass.conversions = conv;
    -			}
    -			REASSIGN(conv->suffix, suffix);
    -			REASSIGN(conv->types, types);
    -			REASSIGN(conv->disable, disable);
    -			REASSIGN(conv->command, convcmd);
    -
    -		} else if (strcasecmp(word, "denyquick") == 0) {
    -			CONF_FLAG(denyquick);
    -
    -		} else if (strcasecmp(word, "display") == 0) {
    -			CONF_STRING(display);
    -
    -		} else if (strcasecmp(word, "hidesymlinks") == 0) {
    -			CONF_FLAG(hidesymlinks);
    -
    -		} else if (strcasecmp(word, "homedir") == 0) {
    -			CONF_STRING(homedir);
    -
    -		} else if (strcasecmp(word, "limit") == 0) {
    -			curclass.limit = DEFAULT_LIMIT;
    -			REASSIGN(curclass.limitfile, NULL);
    -			CONF_LL(limit, arg, -1, LLTMAX);
    -			REASSIGN(curclass.limitfile,
    -			    EMPTYSTR(p) ? NULL : ftpd_strdup(p));
    -
    -		} else if (strcasecmp(word, "maxfilesize") == 0) {
    -			curclass.maxfilesize = DEFAULT_MAXFILESIZE;
    -			CONF_LL(maxfilesize, arg, -1, LLTMAX);
    -
    -		} else if (strcasecmp(word, "maxtimeout") == 0) {
    -			curclass.maxtimeout = DEFAULT_MAXTIMEOUT;
    -			CONF_LL(maxtimeout, arg,
    -			    MIN(30, curclass.timeout), LLTMAX);
    -
    -		} else if (strcasecmp(word, "mmapsize") == 0) {
    -			curclass.mmapsize = 0;
    -			CONF_LL(mmapsize, arg, 0, SSIZE_MAX);
    -
    -		} else if (strcasecmp(word, "readsize") == 0) {
    -			curclass.readsize = 0;
    -			CONF_LL(readsize, arg, 0, SSIZE_MAX);
    -
    -		} else if (strcasecmp(word, "writesize") == 0) {
    -			curclass.writesize = 0;
    -			CONF_LL(writesize, arg, 0, SSIZE_MAX);
    -
    -		} else if (strcasecmp(word, "recvbufsize") == 0) {
    -			curclass.recvbufsize = 0;
    -			CONF_LL(recvbufsize, arg, 0, INT_MAX);
    -
    -		} else if (strcasecmp(word, "sendbufsize") == 0) {
    -			curclass.sendbufsize = 0;
    -			CONF_LL(sendbufsize, arg, 0, INT_MAX);
    -
    -		} else if (strcasecmp(word, "sendlowat") == 0) {
    -			curclass.sendlowat = 0;
    -			CONF_LL(sendlowat, arg, 0, INT_MAX);
    -
    -		} else if (strcasecmp(word, "modify") == 0) {
    -			CONF_FLAG(modify);
    -
    -		} else if (strcasecmp(word, "motd") == 0) {
    -			CONF_STRING(motd);
    -
    -		} else if (strcasecmp(word, "notify") == 0) {
    -			CONF_STRING(notify);
    -
    -		} else if (strcasecmp(word, "passive") == 0) {
    -			CONF_FLAG(passive);
    -
    -		} else if (strcasecmp(word, "portrange") == 0) {
    -			long minport, maxport;
    -
    -			curclass.portmin = 0;
    -			curclass.portmax = 0;
    -			if (none || EMPTYSTR(arg))
    -				continue;
    -			if (EMPTYSTR(p)) {
    -				syslog(LOG_WARNING,
    -				   "%s line %d: missing maxport argument",
    -				   infile, (int)line);
    -				continue;
    -			}
    -			minport = strsuftollx("minport", arg, IPPORT_RESERVED,
    -			    IPPORT_ANONMAX, errbuf, sizeof(errbuf));
    -			if (errbuf[0]) {
    -				syslog(LOG_WARNING, "%s line %d: %s",
    -				    infile, (int)line, errbuf);
    -				continue;
    -			}
    -			maxport = strsuftollx("maxport", p, IPPORT_RESERVED,
    -			    IPPORT_ANONMAX, errbuf, sizeof(errbuf));
    -			if (errbuf[0]) {
    -				syslog(LOG_WARNING, "%s line %d: %s",
    -				    infile, (int)line, errbuf);
    -				continue;
    -			}
    -			if (minport >= maxport) {
    -				syslog(LOG_WARNING,
    -				    "%s line %d: minport %ld >= maxport %ld",
    -				    infile, (int)line, minport, maxport);
    -				continue;
    -			}
    -			curclass.portmin = (int)minport;
    -			curclass.portmax = (int)maxport;
    -
    -		} else if (strcasecmp(word, "private") == 0) {
    -			CONF_FLAG(private);
    -
    -		} else if (strcasecmp(word, "rateget") == 0) {
    -			curclass.maxrateget = curclass.rateget = 0;
    -			CONF_LL(rateget, arg, 0, LLTMAX);
    -			curclass.maxrateget = curclass.rateget;
    -
    -		} else if (strcasecmp(word, "rateput") == 0) {
    -			curclass.maxrateput = curclass.rateput = 0;
    -			CONF_LL(rateput, arg, 0, LLTMAX);
    -			curclass.maxrateput = curclass.rateput;
    -
    -		} else if (strcasecmp(word, "sanenames") == 0) {
    -			CONF_FLAG(sanenames);
    -
    -		} else if (strcasecmp(word, "timeout") == 0) {
    -			curclass.timeout = DEFAULT_TIMEOUT;
    -			CONF_LL(timeout, arg, 30, curclass.maxtimeout);
    -
    -		} else if (strcasecmp(word, "template") == 0) {
    -			if (none)
    -				continue;
    -			REASSIGN(template, EMPTYSTR(arg) ? NULL : ftpd_strdup(arg));
    -
    -		} else if (strcasecmp(word, "umask") == 0) {
    -			unsigned long fumask;
    -
    -			curclass.umask = DEFAULT_UMASK;
    -			if (none || EMPTYSTR(arg))
    -				continue;
    -			errno = 0;
    -			endp = NULL;
    -			fumask = strtoul(arg, &endp, 8);
    -			if (errno || *arg == '\0' || *endp != '\0' ||
    -			    fumask > 0777) {
    -				syslog(LOG_WARNING,
    -				    "%s line %d: invalid umask %s",
    -				    infile, (int)line, arg);
    -				continue;
    -			}
    -			curclass.umask = (mode_t)fumask;
    -
    -		} else if (strcasecmp(word, "upload") == 0) {
    -			CONF_FLAG(upload);
    -			if (! CURCLASS_FLAGS_ISSET(upload))
    -				CURCLASS_FLAGS_CLR(modify);
    -
    -		} else {
    -			syslog(LOG_WARNING,
    -			    "%s line %d: unknown directive '%s'",
    -			    infile, (int)line, word);
    -			continue;
    -		}
    - nextline:
    -		;
    -	}
    -	REASSIGN(template, NULL);
    -	fclose(f);
    -}
    -
    -/*
    - * Show file listed in curclass.display first time in, and list all the
    - * files named in curclass.notify in the current directory.
    - * Send back responses with the prefix `code' + "-".
    - * If code == -1, flush the internal cache of directory names and return.
    - */
    -void
    -show_chdir_messages(int code)
    -{
    -	static StringList *slist = NULL;
    -
    -	struct stat st;
    -	struct tm *t;
    -	glob_t	 gl;
    -	time_t	 now, then;
    -	int	 age;
    -	char	 curwd[MAXPATHLEN];
    -	char	*cp, **rlist;
    -
    -	if (code == -1) {
    -		if (slist != NULL)
    -			sl_free(slist, 1);
    -		slist = NULL;
    -		return;
    -	}
    -		
    -	if (quietmessages)
    -		return;
    -
    -		/* Setup list for directory cache */
    -	if (slist == NULL)
    -		slist = sl_init();
    -	if (slist == NULL) {
    -		syslog(LOG_WARNING, "can't allocate memory for stringlist");
    -		return;
    -	}
    -
    -		/* Check if this directory has already been visited */
    -	if (getcwd(curwd, sizeof(curwd) - 1) == NULL) {
    -		syslog(LOG_WARNING, "can't getcwd: %s", strerror(errno));
    -		return;
    -	}
    -	if (sl_find(slist, curwd) != NULL)
    -		return;	
    -
    -	cp = ftpd_strdup(curwd);
    -	if (sl_add(slist, cp) == -1)
    -		syslog(LOG_WARNING, "can't add `%s' to stringlist", cp);
    -
    -		/* First check for a display file */
    -	(void)display_file(curclass.display, code);
    -
    -		/* Now see if there are any notify files */
    -	if (EMPTYSTR(curclass.notify))
    -		return;
    -
    -	memset(&gl, 0, sizeof(gl));
    -	if (glob(curclass.notify, GLOB_BRACE|GLOB_LIMIT, NULL, &gl) != 0
    -	    || gl.gl_matchc == 0) {
    -		globfree(&gl);
    -		return;
    -	}
    -	time(&now);
    -	for (rlist = gl.gl_pathv; *rlist != NULL; rlist++) {
    -		if (stat(*rlist, &st) != 0)
    -			continue;
    -		if (!S_ISREG(st.st_mode))
    -			continue;
    -		then = st.st_mtime;
    -		if (code != 0) {
    -			reply(-code, "%s", "");
    -			code = 0;
    -		}
    -		reply(-code, "Please read the file %s", *rlist);
    -		t = localtime(&now);
    -		age = 365 * t->tm_year + t->tm_yday;
    -		t = localtime(&then);
    -		age -= 365 * t->tm_year + t->tm_yday;
    -		reply(-code, "  it was last modified on %.24s - %d day%s ago",
    -		    ctime(&then), age, PLURAL(age));
    -	}
    -	globfree(&gl);
    -}
    -
    -int
    -display_file(const char *file, int code)
    -{
    -	FILE   *f;
    -	char   *buf, *p;
    -	char	curwd[MAXPATHLEN];
    -	size_t	len;
    -	off_t	lastnum;
    -	time_t	now;
    -
    -	lastnum = 0;
    -	if (quietmessages)
    -		return (0);
    -
    -	if (EMPTYSTR(file))
    -		return(0);
    -	if ((f = fopen(file, "r")) == NULL)
    -		return (0);
    -	reply(-code, "%s", "");
    -
    -	for (;
    -	    (buf = fparseln(f, &len, NULL, "\0\0\0", 0)) != NULL; free(buf)) {
    -		if (len > 0)
    -			if (buf[len - 1] == '\n')
    -				buf[--len] = '\0';
    -		cprintf(stdout, "    ");
    -
    -		for (p = buf; *p; p++) {
    -			if (*p == '%') {
    -				p++;
    -				switch (*p) {
    -
    -				case 'c':
    -					cprintf(stdout, "%s",
    -					    curclass.classname ?
    -					    curclass.classname : "");
    -					break;
    -
    -				case 'C':
    -					if (getcwd(curwd, sizeof(curwd)-1)
    -					    == NULL){
    -						syslog(LOG_WARNING,
    -						    "can't getcwd: %s",
    -						    strerror(errno));
    -						continue;
    -					}
    -					cprintf(stdout, "%s", curwd);
    -					break;
    -
    -				case 'E':
    -					if (! EMPTYSTR(emailaddr))
    -						cprintf(stdout, "%s",
    -						    emailaddr);
    -					break;
    -
    -				case 'L':
    -					cprintf(stdout, "%s", hostname);
    -					break;
    -
    -				case 'M':
    -					if (curclass.limit == -1) {
    -						cprintf(stdout, "unlimited");
    -						lastnum = 0;
    -					} else {
    -						cprintf(stdout, LLF,
    -						    (LLT)curclass.limit);
    -						lastnum = curclass.limit;
    -					}
    -					break;
    -
    -				case 'N':
    -					cprintf(stdout, "%d", connections);
    -					lastnum = connections;
    -					break;
    -
    -				case 'R':
    -					cprintf(stdout, "%s", remotehost);
    -					break;
    -
    -				case 's':
    -					if (lastnum != 1)
    -						cprintf(stdout, "s");
    -					break;
    -
    -				case 'S':
    -					if (lastnum != 1)
    -						cprintf(stdout, "S");
    -					break;
    -
    -				case 'T':
    -					now = time(NULL);
    -					cprintf(stdout, "%.24s", ctime(&now));
    -					break;
    -
    -				case 'U':
    -					cprintf(stdout, "%s",
    -					    pw ? pw->pw_name : "");
    -					break;
    -
    -				case '%':
    -					CPUTC('%', stdout);
    -					break;
    -
    -				}
    -			} else
    -				CPUTC(*p, stdout);
    -		}
    -		cprintf(stdout, "\r\n");
    -	}
    -
    -	(void)fflush(stdout);
    -	(void)fclose(f);
    -	return (1);
    -}
    -
    -/*
    - * Parse src, expanding '%' escapes, into dst (which must be at least
    - * MAXPATHLEN long).
    - */
    -void
    -format_path(char *dst, const char *src)
    -{
    -	size_t len;
    -	const char *p;
    -
    -	dst[0] = '\0';
    -	len = 0;
    -	if (src == NULL)
    -		return;
    -	for (p = src; *p && len < MAXPATHLEN; p++) {
    -		if (*p == '%') {
    -			p++;
    -			switch (*p) {
    -
    -			case 'c':
    -				len += strlcpy(dst + len, curclass.classname,
    -				    MAXPATHLEN - len);
    -				break;
    -
    -			case 'd':
    -				len += strlcpy(dst + len, pw->pw_dir,
    -				    MAXPATHLEN - len);
    -				break;
    -
    -			case 'u':
    -				len += strlcpy(dst + len, pw->pw_name,
    -				    MAXPATHLEN - len);
    -				break;
    -
    -			case '%':
    -				dst[len++] = '%';
    -				break;
    -
    -			}
    -		} else
    -			dst[len++] = *p;
    -	}
    -	if (len < MAXPATHLEN)
    -		dst[len] = '\0';
    -	dst[MAXPATHLEN - 1] = '\0';
    -}
    -
    -/*
    - * Find s2 at the end of s1.  If found, return a string up to (but
    - * not including) s2, otherwise returns NULL.
    - */
    -static char *
    -strend(const char *s1, char *s2)
    -{
    -	static	char buf[MAXPATHLEN];
    -
    -	char	*start;
    -	size_t	l1, l2;
    -
    -	l1 = strlen(s1);
    -	l2 = strlen(s2);
    -
    -	if (l2 >= l1 || l1 >= sizeof(buf))
    -		return(NULL);
    -	
    -	strlcpy(buf, s1, sizeof(buf));
    -	start = buf + (l1 - l2);
    -
    -	if (strcmp(start, s2) == 0) {
    -		*start = '\0';
    -		return(buf);
    -	} else
    -		return(NULL);
    -}
    -
    -static int
    -filetypematch(char *types, int mode)
    -{
    -	for ( ; types[0] != '\0'; types++)
    -		switch (*types) {
    -		  case 'd':
    -			if (S_ISDIR(mode))
    -				return(1);
    -			break;
    -		  case 'f':
    -			if (S_ISREG(mode))
    -				return(1);
    -			break;
    -		}
    -	return(0);
    -}
    -
    -/*
    - * Look for a conversion.  If we succeed, return a pointer to the
    - * command to execute for the conversion.
    - *
    - * The command is stored in a static array so there's no memory
    - * leak problems, and not too much to change in ftpd.c.  This
    - * routine doesn't need to be re-entrant unless we start using a
    - * multi-threaded ftpd, and that's not likely for a while...
    - */
    -const char **
    -do_conversion(const char *fname)
    -{
    -	struct ftpconv	*cp;
    -	struct stat	 st;
    -	int		 o_errno;
    -	char		*base = NULL;
    -	char		*cmd, *p, *lp;
    -	char	       **argv;
    -	StringList	*sl;
    -
    -	o_errno = errno;
    -	sl = NULL;
    -	cmd = NULL;
    -	for (cp = curclass.conversions; cp != NULL; cp = cp->next) {
    -		if (cp->suffix == NULL) {
    -			syslog(LOG_WARNING,
    -			    "cp->suffix==NULL in conv list; SHOULDN'T HAPPEN!");
    -			continue;
    -		}
    -		if ((base = strend(fname, cp->suffix)) == NULL)
    -			continue;
    -		if (cp->types == NULL || cp->disable == NULL ||
    -		    cp->command == NULL)
    -			continue;
    -					/* Is it enabled? */
    -		if (strcmp(cp->disable, ".") != 0 &&
    -		    stat(cp->disable, &st) == 0)
    -				continue;
    -					/* Does the base exist? */
    -		if (stat(base, &st) < 0)
    -			continue;
    -					/* Is the file type ok */
    -		if (!filetypematch(cp->types, st.st_mode))
    -			continue;
    -		break;			/* "We have a winner!" */
    -	}
    -
    -	/* If we got through the list, no conversion */
    -	if (cp == NULL)
    -		goto cleanup_do_conv;
    -
    -	/* Split up command into an argv */
    -	if ((sl = sl_init()) == NULL)
    -		goto cleanup_do_conv;
    -	cmd = ftpd_strdup(cp->command);
    -	p = cmd;
    -	while (p) {
    -		NEXTWORD(p, lp);
    -		if (strcmp(lp, "%s") == 0)
    -			lp = base;
    -		if (sl_add(sl, ftpd_strdup(lp)) == -1)
    -			goto cleanup_do_conv;
    -	}
    -
    -	if (sl_add(sl, NULL) == -1)
    -		goto cleanup_do_conv;
    -	argv = sl->sl_str;
    -	free(cmd);
    -	free(sl);
    -	return (void *)(intptr_t)argv;
    -
    - cleanup_do_conv:
    -	if (sl)
    -		sl_free(sl, 1);
    -	free(cmd);
    -	errno = o_errno;
    -	return(NULL);
    -}
    -
    -/*
    - * Count the number of current connections, reading from
    - *	/var/run/ftpd.pids-
    - * Does a kill -0 on each pid in that file, and only counts
    - * processes that exist (or frees the slot if it doesn't).
    - * Adds getpid() to the first free slot. Truncates the file
    - * if possible.
    - */ 
    -void
    -count_users(void)
    -{
    -	char	fn[MAXPATHLEN];
    -	int	fd;
    -	size_t	i, last, count;
    -	ssize_t	scount;
    -	pid_t  *pids, mypid;
    -	struct stat sb;
    -	struct flock fl;
    -
    -	(void)strlcpy(fn, _PATH_CLASSPIDS, sizeof(fn));
    -	(void)strlcat(fn, curclass.classname, sizeof(fn));
    -	pids = NULL;
    -	connections = 1;
    -	fl.l_start = 0;
    -	fl.l_len = 0;
    -	fl.l_pid = 0;
    -	fl.l_type = F_WRLCK;
    -	fl.l_whence = SEEK_SET;
    -
    -	if ((fd = open(fn, O_RDWR | O_CREAT, 0600)) == -1)
    -		return;
    -	if (fcntl(fd, F_SETLK, &fl) == -1)
    -		goto cleanup_count;
    -	if (fstat(fd, &sb) == -1)
    -		goto cleanup_count;
    -	if ((pids = malloc(sb.st_size + sizeof(pid_t))) == NULL)
    -		goto cleanup_count;
    -/* XXX: implement a better read loop */
    -	scount = read(fd, pids, sb.st_size);
    -	if (scount == -1 || scount != sb.st_size || scount < 0)
    -		goto cleanup_count;
    -	count = (size_t)scount / sizeof(pid_t);
    -	mypid = getpid();
    -	last = 0;
    -	for (i = 0; i < count; i++) {
    -		if (pids[i] == 0)
    -			continue;
    -		if (kill(pids[i], 0) == -1 && errno != EPERM) {
    -			if (mypid != 0) {
    -				pids[i] = mypid;
    -				mypid = 0;
    -				last = i;
    -			}
    -		} else {
    -			connections++;
    -			last = i;
    -		}
    -	}
    -	if (mypid != 0) {
    -		if (pids[last] != 0)
    -			last++;
    -		pids[last] = mypid;
    -	}
    -	count = (last + 1) * sizeof(pid_t);
    -	if (lseek(fd, 0, SEEK_SET) == -1)
    -		goto cleanup_count;
    -/* XXX: implement a better write loop */
    -	scount = write(fd, pids, count);
    -	if (scount == -1 || (size_t)scount != count)
    -		goto cleanup_count;
    -	(void)ftruncate(fd, count);
    -
    - cleanup_count:
    -	fl.l_type = F_UNLCK;
    -	(void)fcntl(fd, F_SETLK, &fl);
    -	close(fd);
    -	REASSIGN(pids, NULL);
    -}
    diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h
    deleted file mode 100644
    index 0529a4b58..000000000
    --- a/libexec/ftpd/extern.h
    +++ /dev/null
    @@ -1,380 +0,0 @@
    -/*	$NetBSD: extern.h,v 1.63 2013/03/21 05:53:01 lukem Exp $	*/
    -
    -/*-
    - * Copyright (c) 1992, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - *	@(#)extern.h	8.2 (Berkeley) 4/4/94
    - */
    -
    -/*-
    - * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
    - * All rights reserved.
    - *
    - * This code is derived from software contributed to The NetBSD Foundation
    - * by Luke Mewburn.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    - * POSSIBILITY OF SUCH DAMAGE.
    - */
    -
    -/*
    - * Copyright (C) 1997 and 1998 WIDE Project.
    - * All rights reserved.
    - * 
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the project nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - * 
    - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -#ifdef NO_LONG_LONG
    -# define LLF		"%ld"
    -# define LLFP(x)	"%" x "ld"
    -# define LLT		long
    -# define ULLF		"%lu"
    -# define ULLFP(x)	"%" x "lu"
    -# define ULLT		unsigned long
    -# define STRTOLL(x,y,z)	strtol(x,y,z)
    -# define LLTMIN		LONG_MIN
    -# define LLTMAX		LONG_MAX
    -#else
    -# define LLF		"%lld"
    -# define LLFP(x)	"%" x "lld"
    -# define LLT		long long
    -# define ULLF		"%llu"
    -# define ULLFP(x)	"%" x "llu"
    -# define ULLT		unsigned long long
    -# define STRTOLL(x,y,z)	strtoll(x,y,z)
    -# define LLTMIN		LLONG_MIN
    -# define LLTMAX		LLONG_MAX
    -#endif
    -
    -#define FTP_BUFLEN	512
    -
    -void	abor(void);
    -void	closedataconn(FILE *);
    -char   *conffilename(const char *);
    -void	count_users(void);
    -void	cprintf(FILE *, const char *, ...)
    -	    __printflike(2, 3);
    -void	cwd(const char *);
    -FILE   *dataconn(const char *, off_t, const char *);
    -void	delete(const char *);
    -int	display_file(const char *, int);
    -const char **do_conversion(const char *);
    -__dead void	dologout(int);
    -__dead void	fatal(const char *);
    -void	feat(void);
    -void	format_path(char *, const char *);
    -int	ftpd_pclose(FILE *);
    -FILE   *ftpd_popen(const char *[], const char *, int);
    -int	get_line(char *, int, FILE *);
    -void	init_curclass(void);
    -void	logxfer(const char *, off_t, const char *, const char *,
    -	    const struct timeval *, const char *);
    -struct tab *lookup(struct tab *, const char *);
    -void	makedir(const char *);
    -void	mlsd(const char *);
    -void	mlst(const char *);
    -void	opts(const char *);
    -void	parse_conf(const char *);
    -void	pass(const char *);
    -void	passive(void);
    -int	lpsvproto2af(int);
    -int	af2lpsvproto(int);
    -int	epsvproto2af(int);
    -int	af2epsvproto(int);
    -void	long_passive(const char *, int);
    -int	extended_port(const char *);
    -void	epsv_protounsupp(const char *);
    -void	perror_reply(int, const char *);
    -void	pwd(void);
    -void	removedir(const char *);
    -void	renamecmd(const char *, const char *);
    -char   *renamefrom(const char *);
    -void	reply(int, const char *, ...)
    -	    __printflike(2, 3);
    -void	retrieve(const char *[], const char *);
    -void	send_file_list(const char *);
    -void	show_chdir_messages(int);
    -void	sizecmd(const char *);
    -void	statcmd(void);
    -void	statfilecmd(const char *);
    -void	statxfer(void);
    -void	store(const char *, const char *, int);
    -void	user(const char *);
    -char   *ftpd_strdup(const char *);
    -void	yyerror(const char *);
    -
    -#ifdef SUPPORT_UTMP
    -struct utmp;
    -
    -void	ftpd_initwtmp(void);
    -void	ftpd_logwtmp(const char *, const char *, const char *);
    -void	ftpd_login(const struct utmp *);
    -int	ftpd_logout(const char *);
    -#endif
    -
    -#ifdef SUPPORT_UTMPX
    -struct utmpx;
    -struct sockinet;
    -
    -void	ftpd_initwtmpx(void);
    -void	ftpd_logwtmpx(const char *, const char *, const char *, 
    -    struct sockinet *, int, int);
    -void	ftpd_loginx(const struct utmpx *);
    -int	ftpd_logoutx(const char *, int, int);
    -#endif
    -
    -#include 
    -
    -#if defined(__NetBSD__)
    -# define HAVE_SETPROCTITLE		1
    -# define HAVE_STRUCT_SOCKADDR_SA_LEN	1
    -# define HAVE_SOCKADDR_SNPRINTF		1
    -#endif
    -
    -struct sockinet {
    -	union sockunion {
    -		struct sockaddr_in  su_sin;
    -#ifdef INET6
    -		struct sockaddr_in6 su_sin6;
    -#endif
    -	} si_su;
    -#if !defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
    -	int	si_len;
    -#endif
    -};
    -
    -#if !defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
    -# define su_len		si_len
    -#else
    -# define su_len		si_su.su_sin.sin_len
    -#endif
    -#define su_addr		si_su.su_sin.sin_addr
    -#define su_family	si_su.su_sin.sin_family
    -#define su_port		si_su.su_sin.sin_port
    -#ifdef INET6
    -# define su_6addr	si_su.su_sin6.sin6_addr
    -# define su_scope_id	si_su.su_sin6.sin6_scope_id
    -#endif
    -
    -struct tab {
    -	const char	*name;
    -	short	 	token;
    -	short	 	state;
    -	short	 	flags;	/* 1 if command implemented, 2 if has options,
    -				   4 if can occur OOB */
    -	const char	*help;
    -	char		*options;
    -};
    -
    -struct ftpconv {
    -	struct ftpconv	*next;
    -	char 		*suffix;	/* Suffix of requested name */
    -	char		*types;		/* Valid file types */
    -	char		*disable;	/* File to disable conversions */
    -	char		*command;	/* Command to do the conversion */
    -};
    -
    -typedef enum {
    -	CLASS_GUEST,
    -	CLASS_CHROOT,
    -	CLASS_REAL
    -} class_ft;
    -
    -typedef enum {
    -	FLAG_checkportcmd =	1<<0,	/* Check port commands */
    -	FLAG_denyquick =	1<<1,	/* Check ftpusers(5) before PASS */
    -	FLAG_hidesymlinks =	1<<2,	/* For symbolic links, list the file
    -					   or directory the link references
    -					   rather than the link itself */
    -	FLAG_modify =		1<<3,	/* Allow CHMOD, DELE, MKD, RMD, RNFR,
    -					   UMASK */
    -	FLAG_passive =		1<<4,	/* Allow PASV mode */
    -	FLAG_private =		1<<5,	/* Don't publish class info in STAT */
    -	FLAG_sanenames =	1<<6,	/* Restrict names of uploaded files */ 
    -	FLAG_upload =		1<<7,	/* As per modify, but also allow
    -					   APPE, STOR, STOU */
    -} classflag_t;
    -
    -#define CURCLASS_FLAGS_SET(x)	(curclass.flags |=  (FLAG_ ## x))
    -#define CURCLASS_FLAGS_CLR(x)	(curclass.flags &= ~(FLAG_ ## x))
    -#define CURCLASS_FLAGS_ISSET(x)	(curclass.flags &   (FLAG_ ## x))
    -
    -struct ftpclass {
    -	struct sockinet	 advertise;	/* PASV address to advertise as */
    -	char		*chroot;	/* Directory to chroot(2) to at login */
    -	char		*classname;	/* Current class */
    -	struct ftpconv	*conversions;	/* List of conversions */
    -	char		*display;	/* File to display upon chdir */
    -	char		*homedir;	/* Directory to chdir(2) to at login */
    -	classflag_t	 flags;		/* Flags; see classflag_t above */
    -	LLT		 limit;		/* Max connections (-1 = unlimited) */
    -	char		*limitfile;	/* File to display if limit reached */
    -	LLT		 maxfilesize;	/* Maximum file size of uploads */
    -	LLT		 maxrateget;	/* Maximum get transfer rate throttle */
    -	LLT		 maxrateput;	/* Maximum put transfer rate throttle */
    -	LLT		 maxtimeout;	/* Maximum permitted timeout */
    -	char		*motd;		/* MotD file to display after login */
    -	char		*notify;	/* Files to notify about upon chdir */
    -	LLT		 portmin;	/* Minumum port for passive mode */
    -	LLT		 portmax;	/* Maximum port for passive mode */
    -	LLT		 rateget;	/* Get (RETR) transfer rate throttle */
    -	LLT		 rateput;	/* Put (STOR) transfer rate throttle */
    -	LLT		 timeout;	/* Default timeout */
    -	class_ft	 type;		/* Class type */
    -	mode_t		 umask;		/* Umask to use */
    -	LLT		 mmapsize;	/* mmap window size */
    -	LLT		 readsize;	/* data read size */
    -	LLT		 writesize;	/* data write size */
    -	LLT		 recvbufsize;	/* SO_RCVBUF size */
    -	LLT		 sendbufsize;	/* SO_SNDBUF size */
    -	LLT		 sendlowat;	/* SO_SNDLOWAT size */
    -};
    -
    -__dead extern void		ftp_loop(void);
    -extern void		ftp_handle_line(char *);
    -
    -#ifndef	GLOBAL
    -#define	GLOBAL	extern
    -#endif
    -
    -
    -GLOBAL	struct sockinet ctrl_addr;
    -GLOBAL	struct sockinet	data_dest;
    -GLOBAL	struct sockinet	data_source;
    -GLOBAL	struct sockinet	his_addr;
    -GLOBAL	struct sockinet	pasv_addr;
    -GLOBAL	int		connections;
    -GLOBAL	struct ftpclass	curclass;
    -GLOBAL	int		ftpd_debug;
    -GLOBAL	char		*emailaddr;
    -GLOBAL	int		form;
    -GLOBAL	int		gidcount;	/* number of entries in gidlist[] */
    -GLOBAL	gid_t		*gidlist;
    -GLOBAL	int		hasyyerrored;
    -GLOBAL	char		hostname[MAXHOSTNAMELEN+1];
    -GLOBAL	char		homedir[MAXPATHLEN];
    -#ifdef KERBEROS5
    -GLOBAL	krb5_context	kcontext;
    -#endif
    -GLOBAL	int		logged_in;
    -GLOBAL	int		logging;
    -GLOBAL	int		pdata;			/* for passive mode */
    -#if defined(HAVE_SETPROCTITLE)
    -GLOBAL	char		proctitle[BUFSIZ];	/* initial part of title */
    -#endif
    -GLOBAL	struct passwd  *pw;
    -GLOBAL	int		quietmessages;
    -GLOBAL	char		remotehost[MAXHOSTNAMELEN+1];
    -GLOBAL	char		remoteloghost[2 * MAXHOSTNAMELEN+1];
    -GLOBAL	off_t		restart_point;
    -GLOBAL	char		tmpline[FTP_BUFLEN];
    -GLOBAL	int		type;
    -GLOBAL	int		usedefault;		/* for data transfers */
    -GLOBAL	const char     *version;
    -GLOBAL	int		is_oob;
    -
    -						/* total file data bytes */
    -GLOBAL	off_t		total_data_in,  total_data_out,  total_data;
    -						/* total number of data files */
    -GLOBAL	off_t		total_files_in, total_files_out, total_files;
    -						/* total bytes */
    -GLOBAL	off_t		total_bytes_in, total_bytes_out, total_bytes;
    -						/* total number of xfers */
    -GLOBAL	off_t		total_xfers_in, total_xfers_out, total_xfers;
    -
    -extern	struct tab	cmdtab[];
    -
    -#define	INTERNAL_LS	"/bin/ls"
    -
    -
    -#define CMD_IMPLEMENTED(x)	((x)->flags != 0)
    -#define CMD_HAS_OPTIONS(x)	((x)->flags & 0x2)
    -#define CMD_OOB(x)		((x)->flags & 0x4)
    -
    -#define	CPUTC(c, f)	do { \
    -				putc(c, f); total_bytes++; total_bytes_out++; \
    -			} while (0);
    -
    -#define CURCLASSTYPE	curclass.type == CLASS_GUEST  ? "GUEST"  : \
    -			curclass.type == CLASS_CHROOT ? "CHROOT" : \
    -			curclass.type == CLASS_REAL   ? "REAL"   : \
    -			""
    -
    -#define ISDOTDIR(x)	(x[0] == '.' && x[1] == '\0')
    -#define ISDOTDOTDIR(x)	(x[0] == '.' && x[1] == '.' && x[2] == '\0')
    -
    -#define EMPTYSTR(p)	((p) == NULL || *(p) == '\0')
    -#define NEXTWORD(P, W)	do { \
    -				(W) = strsep(&(P), " \t"); \
    -			} while ((W) != NULL && *(W) == '\0')
    -#define PLURAL(s)	((s) == 1 ? "" : "s")
    -#define REASSIGN(X,Y)	do { if (X) free(X); (X)=(Y); } while (/*CONSTCOND*/0)
    -
    -#ifndef IPPORT_ANONMAX
    -# define IPPORT_ANONMAX	65535
    -#endif
    diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y
    deleted file mode 100644
    index 8da7279aa..000000000
    --- a/libexec/ftpd/ftpcmd.y
    +++ /dev/null
    @@ -1,1875 +0,0 @@
    -/*	$NetBSD: ftpcmd.y,v 1.94 2015/08/10 07:45:50 shm Exp $	*/
    -
    -/*-
    - * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
    - * All rights reserved.
    - *
    - * This code is derived from software contributed to The NetBSD Foundation
    - * by Luke Mewburn.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    - * POSSIBILITY OF SUCH DAMAGE.
    - */
    -
    -/*
    - * Copyright (c) 1985, 1988, 1993, 1994
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - *	@(#)ftpcmd.y	8.3 (Berkeley) 4/6/94
    - */
    -
    -/*
    - * Grammar for FTP commands.
    - * See RFC 959.
    - */
    -
    -%{
    -#include 
    -
    -#ifndef lint
    -#if 0
    -static char sccsid[] = "@(#)ftpcmd.y	8.3 (Berkeley) 4/6/94";
    -#else
    -__RCSID("$NetBSD: ftpcmd.y,v 1.94 2015/08/10 07:45:50 shm Exp $");
    -#endif
    -#endif /* not lint */
    -
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#ifdef KERBEROS5
    -#include 
    -#endif
    -
    -#include "extern.h"
    -#include "version.h"
    -
    -static	int cmd_type;
    -static	int cmd_form;
    -static	int cmd_bytesz;
    -
    -char	cbuf[FTP_BUFLEN];
    -char	*cmdp;
    -char	*fromname;
    -
    -extern int	epsvall;
    -struct tab	sitetab[];
    -
    -static	int	check_write(const char *, int);
    -static	void	help(struct tab *, const char *);
    -static	void	port_check(const char *, int);
    -	int	yylex(void);
    -
    -%}
    -
    -%union {
    -	struct {
    -		LLT	ll;
    -		int	i;
    -	} u;
    -	char *s;
    -	const char *cs;
    -}
    -
    -%token
    -	A	B	C	E	F	I
    -	L	N	P	R	S	T
    -
    -	SP	CRLF	COMMA	ALL
    -
    -	USER	PASS	ACCT	CWD	CDUP	SMNT
    -	QUIT	REIN	PORT	PASV	TYPE	STRU
    -	MODE	RETR	STOR	STOU	APPE	ALLO
    -	REST	RNFR	RNTO	ABOR	DELE	RMD
    -	MKD	PWD	LIST	NLST	SITE	SYST
    -	STAT	HELP	NOOP
    -
    -	AUTH	ADAT	PROT	PBSZ	CCC	MIC
    -	CONF	ENC
    -
    -	FEAT	OPTS
    -
    -	SIZE	MDTM	MLST	MLSD
    -
    -	LPRT	LPSV	EPRT	EPSV
    -
    -	MAIL	MLFL	MRCP	MRSQ	MSAM	MSND
    -	MSOM
    -
    -	CHMOD	IDLE	RATEGET	RATEPUT	UMASK
    -
    -	LEXERR
    -
    -%token	 STRING
    -%token	 NUMBER
    -
    -%type	 check_login octal_number byte_size
    -%type	 struct_code mode_code type_code form_code decimal_integer
    -%type	 pathstring pathname password username
    -%type	 mechanism_name base64data prot_code
    -
    -%start	cmd_sel
    -
    -%%
    -
    -cmd_sel
    -	: cmd
    -		{
    -			REASSIGN(fromname, NULL);
    -			restart_point = (off_t) 0;
    -		}
    -
    -	| rcmd
    -
    -	;
    -
    -cmd
    -						/* RFC 959 */
    -	: USER SP username CRLF
    -		{
    -			user($3);
    -			free($3);
    -		}
    -
    -	| PASS SP password CRLF
    -		{
    -			pass($3);
    -			explicit_memset($3, 0, strlen($3));
    -			free($3);
    -		}
    -
    -	| CWD check_login CRLF
    -		{
    -			if ($2)
    -				cwd(homedir);
    -		}
    -
    -	| CWD check_login SP pathname CRLF
    -		{
    -			if ($2 && $4 != NULL)
    -				cwd($4);
    -			if ($4 != NULL)
    -				free($4);
    -		}
    -
    -	| CDUP check_login CRLF
    -		{
    -			if ($2)
    -				cwd("..");
    -		}
    -
    -	| QUIT CRLF
    -		{
    -			if (logged_in) {
    -				reply(-221, "%s", "");
    -				reply(0,
    - "Data traffic for this session was " LLF " byte%s in " LLF " file%s.",
    -				    (LLT)total_data, PLURAL(total_data),
    -				    (LLT)total_files, PLURAL(total_files));
    -				reply(0,
    - "Total traffic for this session was " LLF " byte%s in " LLF " transfer%s.",
    -				    (LLT)total_bytes, PLURAL(total_bytes),
    -				    (LLT)total_xfers, PLURAL(total_xfers));
    -			}
    -			reply(221,
    -			    "Thank you for using the FTP service on %s.",
    -			    hostname);
    -			if (logged_in && logging) {
    -				syslog(LOG_INFO,
    -		"Data traffic: " LLF " byte%s in " LLF " file%s",
    -				    (LLT)total_data, PLURAL(total_data),
    -				    (LLT)total_files, PLURAL(total_files));
    -				syslog(LOG_INFO,
    -		"Total traffic: " LLF " byte%s in " LLF " transfer%s",
    -				    (LLT)total_bytes, PLURAL(total_bytes),
    -				    (LLT)total_xfers, PLURAL(total_xfers));
    -			}
    -
    -			dologout(0);
    -		}
    -
    -	| PORT check_login SP host_port CRLF
    -		{
    -			if ($2)
    -				port_check("PORT", AF_INET);
    -		}
    -
    -	| LPRT check_login SP host_long_port4 CRLF
    -		{
    -			if ($2)
    -				port_check("LPRT", AF_INET);
    -		}
    -
    -	| LPRT check_login SP host_long_port6 CRLF
    -		{
    -#ifdef INET6
    -			if ($2)
    -				port_check("LPRT", AF_INET6);
    -#else
    -			reply(500, "IPv6 support not available.");
    -#endif
    -		}
    -
    -	| EPRT check_login SP STRING CRLF
    -		{
    -			if ($2) {
    -				if (extended_port($4) == 0)
    -					port_check("EPRT", -1);
    -			}
    -			free($4);
    -		}
    -
    -	| PASV check_login CRLF
    -		{
    -			if ($2) {
    -				if (CURCLASS_FLAGS_ISSET(passive))
    -					passive();
    -				else
    -					reply(500, "PASV mode not available.");
    -			}
    -		}
    -
    -	| LPSV check_login CRLF
    -		{
    -			if ($2) {
    -				if (CURCLASS_FLAGS_ISSET(passive)) {
    -					if (epsvall)
    -						reply(501,
    -						    "LPSV disallowed after EPSV ALL");
    -					else
    -						long_passive("LPSV", PF_UNSPEC);
    -				} else
    -					reply(500, "LPSV mode not available.");
    -			}
    -		}
    -
    -	| EPSV check_login SP NUMBER CRLF
    -		{
    -			if ($2) {
    -				if (CURCLASS_FLAGS_ISSET(passive))
    -					long_passive("EPSV",
    -					    epsvproto2af($4.i));
    -				else
    -					reply(500, "EPSV mode not available.");
    -			}
    -		}
    -
    -	| EPSV check_login SP ALL CRLF
    -		{
    -			if ($2) {
    -				if (CURCLASS_FLAGS_ISSET(passive)) {
    -					reply(200,
    -					    "EPSV ALL command successful.");
    -					epsvall++;
    -				} else
    -					reply(500, "EPSV mode not available.");
    -			}
    -		}
    -
    -	| EPSV check_login CRLF
    -		{
    -			if ($2) {
    -				if (CURCLASS_FLAGS_ISSET(passive))
    -					long_passive("EPSV", PF_UNSPEC);
    -				else
    -					reply(500, "EPSV mode not available.");
    -			}
    -		}
    -
    -	| TYPE check_login SP type_code CRLF
    -		{
    -			if ($2) {
    -
    -			switch (cmd_type) {
    -
    -			case TYPE_A:
    -				if (cmd_form == FORM_N) {
    -					reply(200, "Type set to A.");
    -					type = cmd_type;
    -					form = cmd_form;
    -				} else
    -					reply(504, "Form must be N.");
    -				break;
    -
    -			case TYPE_E:
    -				reply(504, "Type E not implemented.");
    -				break;
    -
    -			case TYPE_I:
    -				reply(200, "Type set to I.");
    -				type = cmd_type;
    -				break;
    -
    -			case TYPE_L:
    -#if NBBY == 8
    -				if (cmd_bytesz == 8) {
    -					reply(200,
    -					    "Type set to L (byte size 8).");
    -					type = cmd_type;
    -				} else
    -					reply(504, "Byte size must be 8.");
    -#else /* NBBY == 8 */
    -				UNIMPLEMENTED for NBBY != 8
    -#endif /* NBBY == 8 */
    -			}
    -			
    -			}
    -		}
    -
    -	| STRU check_login SP struct_code CRLF
    -		{
    -			if ($2) {
    -				switch ($4) {
    -
    -				case STRU_F:
    -					reply(200, "STRU F ok.");
    -					break;
    -
    -				default:
    -					reply(504, "Unimplemented STRU type.");
    -				}
    -			}
    -		}
    -
    -	| MODE check_login SP mode_code CRLF
    -		{
    -			if ($2) {
    -				switch ($4) {
    -
    -				case MODE_S:
    -					reply(200, "MODE S ok.");
    -					break;
    -
    -				default:
    -					reply(502, "Unimplemented MODE type.");
    -				}
    -			}
    -		}
    -
    -	| RETR check_login SP pathname CRLF
    -		{
    -			if ($2 && $4 != NULL)
    -				retrieve(NULL, $4);
    -			if ($4 != NULL)
    -				free($4);
    -		}
    -
    -	| STOR SP pathname CRLF
    -		{
    -			if (check_write($3, 1))
    -				store($3, "w", 0);
    -			if ($3 != NULL)
    -				free($3);
    -		}
    -
    -	| STOU SP pathname CRLF
    -		{
    -			if (check_write($3, 1))
    -				store($3, "w", 1);
    -			if ($3 != NULL)
    -				free($3);
    -		}
    -		
    -	| APPE SP pathname CRLF
    -		{
    -			if (check_write($3, 1))
    -				store($3, "a", 0);
    -			if ($3 != NULL)
    -				free($3);
    -		}
    -
    -	| ALLO check_login SP NUMBER CRLF
    -		{
    -			if ($2)
    -				reply(202, "ALLO command ignored.");
    -		}
    -
    -	| ALLO check_login SP NUMBER SP R SP NUMBER CRLF
    -		{
    -			if ($2)
    -				reply(202, "ALLO command ignored.");
    -		}
    -
    -	| RNTO SP pathname CRLF
    -		{
    -			if (check_write($3, 0)) {
    -				if (fromname) {
    -					renamecmd(fromname, $3);
    -					REASSIGN(fromname, NULL);
    -				} else {
    -					reply(503, "Bad sequence of commands.");
    -				}
    -			}
    -			if ($3 != NULL)
    -				free($3);
    -		}
    -
    -	| ABOR check_login CRLF
    -		{
    -			if (is_oob)
    -				abor();
    -			else if ($2)
    -				reply(225, "ABOR command successful.");
    -		}
    -
    -	| DELE SP pathname CRLF
    -		{
    -			if (check_write($3, 0))
    -				delete($3);
    -			if ($3 != NULL)
    -				free($3);
    -		}
    -
    -	| RMD SP pathname CRLF
    -		{
    -			if (check_write($3, 0))
    -				removedir($3);
    -			if ($3 != NULL)
    -				free($3);
    -		}
    -
    -	| MKD SP pathname CRLF
    -		{
    -			if (check_write($3, 0))
    -				makedir($3);
    -			if ($3 != NULL)
    -				free($3);
    -		}
    -
    -	| PWD check_login CRLF
    -		{
    -			if ($2)
    -				pwd();
    -		}
    -
    -	| LIST check_login CRLF
    -		{
    -			const char *argv[] = { INTERNAL_LS, "-lgA", NULL };
    -			
    -			if (CURCLASS_FLAGS_ISSET(hidesymlinks))
    -				argv[1] = "-LlgA";
    -			if ($2)
    -				retrieve(argv, "");
    -		}
    -
    -	| LIST check_login SP pathname CRLF
    -		{
    -			const char *argv[] = { INTERNAL_LS, "-lgA", NULL, NULL };
    -
    -			if (CURCLASS_FLAGS_ISSET(hidesymlinks))
    -				argv[1] = "-LlgA";
    -			if ($2 && $4 != NULL) {
    -				argv[2] = $4;
    -				retrieve(argv, $4);
    -			}
    -			if ($4 != NULL)
    -				free($4);
    -		}
    -
    -	| NLST check_login CRLF
    -		{
    -			if ($2)
    -				send_file_list(".");
    -		}
    -
    -	| NLST check_login SP pathname CRLF
    -		{
    -			if ($2)
    -				send_file_list($4);
    -			free($4);
    -		}
    -
    -	| SITE SP HELP CRLF
    -		{
    -			help(sitetab, NULL);
    -		}
    -
    -	| SITE SP CHMOD SP octal_number SP pathname CRLF
    -		{
    -			if (check_write($7, 0)) {
    -				if (($5 == -1) || ($5 > 0777))
    -					reply(501,
    -				"CHMOD: Mode value must be between 0 and 0777");
    -				else if (chmod($7, $5) < 0)
    -					perror_reply(550, $7);
    -				else
    -					reply(200, "CHMOD command successful.");
    -			}
    -			if ($7 != NULL)
    -				free($7);
    -		}
    -
    -	| SITE SP HELP SP STRING CRLF
    -		{
    -			help(sitetab, $5);
    -			free($5);
    -		}
    -
    -	| SITE SP IDLE check_login CRLF
    -		{
    -			if ($4) {
    -				reply(200,
    -				    "Current IDLE time limit is " LLF
    -				    " seconds; max " LLF,
    -				    (LLT)curclass.timeout,
    -				    (LLT)curclass.maxtimeout);
    -			}
    -		}
    -
    -	| SITE SP IDLE check_login SP NUMBER CRLF
    -		{
    -			if ($4) {
    -				if ($6.i < 30 || $6.i > curclass.maxtimeout) {
    -					reply(501,
    -				"IDLE time limit must be between 30 and "
    -					    LLF " seconds",
    -					    (LLT)curclass.maxtimeout);
    -				} else {
    -					curclass.timeout = $6.i;
    -					(void) alarm(curclass.timeout);
    -					reply(200,
    -					    "IDLE time limit set to "
    -					    LLF " seconds",
    -					    (LLT)curclass.timeout);
    -				}
    -			}
    -		}
    -
    -	| SITE SP RATEGET check_login CRLF
    -		{
    -			if ($4) {
    -				reply(200,
    -				    "Current RATEGET is " LLF " bytes/sec",
    -				    (LLT)curclass.rateget);
    -			}
    -		}
    -
    -	| SITE SP RATEGET check_login SP STRING CRLF
    -		{
    -			char errbuf[100];
    -			char *p = $6;
    -			LLT rate;
    -
    -			if ($4) {
    -				rate = strsuftollx("RATEGET", p, 0,
    -				    curclass.maxrateget
    -				    ? curclass.maxrateget
    -				    : LLTMAX, errbuf, sizeof(errbuf));
    -				if (errbuf[0])
    -					reply(501, "%s", errbuf);
    -				else {
    -					curclass.rateget = rate;
    -					reply(200,
    -					    "RATEGET set to " LLF " bytes/sec",
    -					    (LLT)curclass.rateget);
    -				}
    -			}
    -			free($6);
    -		}
    -
    -	| SITE SP RATEPUT check_login CRLF
    -		{
    -			if ($4) {
    -				reply(200,
    -				    "Current RATEPUT is " LLF " bytes/sec",
    -				    (LLT)curclass.rateput);
    -			}
    -		}
    -
    -	| SITE SP RATEPUT check_login SP STRING CRLF
    -		{
    -			char errbuf[100];
    -			char *p = $6;
    -			LLT rate;
    -
    -			if ($4) {
    -				rate = strsuftollx("RATEPUT", p, 0,
    -				    curclass.maxrateput
    -				    ? curclass.maxrateput
    -				    : LLTMAX, errbuf, sizeof(errbuf));
    -				if (errbuf[0])
    -					reply(501, "%s", errbuf);
    -				else {
    -					curclass.rateput = rate;
    -					reply(200,
    -					    "RATEPUT set to " LLF " bytes/sec",
    -					    (LLT)curclass.rateput);
    -				}
    -			}
    -			free($6);
    -		}
    -
    -	| SITE SP UMASK check_login CRLF
    -		{
    -			int oldmask;
    -
    -			if ($4) {
    -				oldmask = umask(0);
    -				(void) umask(oldmask);
    -				reply(200, "Current UMASK is %03o", oldmask);
    -			}
    -		}
    -
    -	| SITE SP UMASK check_login SP octal_number CRLF
    -		{
    -			int oldmask;
    -
    -			if ($4 && check_write("", 0)) {
    -				if (($6 == -1) || ($6 > 0777)) {
    -					reply(501, "Bad UMASK value");
    -				} else {
    -					oldmask = umask($6);
    -					reply(200,
    -					    "UMASK set to %03o (was %03o)",
    -					    $6, oldmask);
    -				}
    -			}
    -		}
    -
    -	| SYST CRLF
    -		{
    -			if (EMPTYSTR(version))
    -				reply(215, "UNIX Type: L%d", NBBY);
    -			else
    -				reply(215, "UNIX Type: L%d Version: %s", NBBY,
    -				    version);
    -		}
    -
    -	| STAT check_login SP pathname CRLF
    -		{
    -			if ($2 && $4 != NULL)
    -				statfilecmd($4);
    -			if ($4 != NULL)
    -				free($4);
    -		}
    -		
    -	| STAT CRLF
    -		{
    -			if (is_oob)
    -				statxfer();
    -			else
    -				statcmd();
    -		}
    -
    -	| HELP CRLF
    -		{
    -			help(cmdtab, NULL);
    -		}
    -
    -	| HELP SP STRING CRLF
    -		{
    -			char *cp = $3;
    -
    -			if (strncasecmp(cp, "SITE", 4) == 0) {
    -				cp = $3 + 4;
    -				if (*cp == ' ')
    -					cp++;
    -				if (*cp)
    -					help(sitetab, cp);
    -				else
    -					help(sitetab, NULL);
    -			} else
    -				help(cmdtab, $3);
    -			free($3);
    -		}
    -
    -	| NOOP CRLF
    -		{
    -			reply(200, "NOOP command successful.");
    -		}
    -
    -						/* RFC 2228 */
    -	| AUTH SP mechanism_name CRLF
    -		{
    -			reply(502, "RFC 2228 authentication not implemented.");
    -			free($3);
    -		}
    -
    -	| ADAT SP base64data CRLF
    -		{
    -			reply(503,
    -			    "Please set authentication state with AUTH.");
    -			free($3);
    -		}
    -
    -	| PROT SP prot_code CRLF
    -		{
    -			reply(503,
    -			    "Please set protection buffer size with PBSZ.");
    -			free($3);
    -		}
    -
    -	| PBSZ SP decimal_integer CRLF
    -		{
    -			reply(503,
    -			    "Please set authentication state with AUTH.");
    -		}
    -
    -	| CCC CRLF
    -		{
    -			reply(533, "No protection enabled.");
    -		}
    -
    -	| MIC SP base64data CRLF
    -		{
    -			reply(502, "RFC 2228 authentication not implemented.");
    -			free($3);
    -		}
    -
    -	| CONF SP base64data CRLF
    -		{
    -			reply(502, "RFC 2228 authentication not implemented.");
    -			free($3);
    -		}
    -
    -	| ENC SP base64data CRLF
    -		{
    -			reply(502, "RFC 2228 authentication not implemented.");
    -			free($3);
    -		}
    -
    -						/* RFC 2389 */
    -	| FEAT CRLF
    -		{
    -
    -			feat();
    -		}
    -
    -	| OPTS SP STRING CRLF
    -		{
    -			
    -			opts($3);
    -			free($3);
    -		}
    -
    -
    -						/* RFC 3659 */
    -
    -		/*
    -		 * Return size of file in a format suitable for
    -		 * using with RESTART (we just count bytes).
    -		 */
    -	| SIZE check_login SP pathname CRLF
    -		{
    -			if ($2 && $4 != NULL)
    -				sizecmd($4);
    -			if ($4 != NULL)
    -				free($4);
    -		}
    -
    -		/*
    -		 * Return modification time of file as an ISO 3307
    -		 * style time. E.g. YYYYMMDDHHMMSS or YYYYMMDDHHMMSS.xxx
    -		 * where xxx is the fractional second (of any precision,
    -		 * not necessarily 3 digits)
    -		 */
    -	| MDTM check_login SP pathname CRLF
    -		{
    -			if ($2 && $4 != NULL) {
    -				struct stat stbuf;
    -				if (stat($4, &stbuf) < 0)
    -					perror_reply(550, $4);
    -				else if (!S_ISREG(stbuf.st_mode)) {
    -					reply(550, "%s: not a plain file.", $4);
    -				} else {
    -					struct tm *t;
    -
    -					t = gmtime(&stbuf.st_mtime);
    -					reply(213,
    -					    "%04d%02d%02d%02d%02d%02d",
    -					    TM_YEAR_BASE + t->tm_year,
    -					    t->tm_mon+1, t->tm_mday,
    -					    t->tm_hour, t->tm_min, t->tm_sec);
    -				}
    -			}
    -			if ($4 != NULL)
    -				free($4);
    -		}
    -
    -	| MLST check_login SP pathname CRLF
    -		{
    -			if ($2 && $4 != NULL)
    -				mlst($4);
    -			if ($4 != NULL)
    -				free($4);
    -		}
    -		
    -	| MLST check_login CRLF
    -		{
    -			mlst(NULL);
    -		}
    -
    -	| MLSD check_login SP pathname CRLF
    -		{
    -			if ($2 && $4 != NULL)
    -				mlsd($4);
    -			if ($4 != NULL)
    -				free($4);
    -		}
    -		
    -	| MLSD check_login CRLF
    -		{
    -			mlsd(NULL);
    -		}
    -
    -	| error CRLF
    -		{
    -			yyerrok;
    -		}
    -	;
    -
    -rcmd
    -	: REST check_login SP NUMBER CRLF
    -		{
    -			if ($2) {
    -				REASSIGN(fromname, NULL);
    -				restart_point = (off_t)$4.ll;
    -				reply(350,
    -    "Restarting at " LLF ". Send STORE or RETRIEVE to initiate transfer.",
    -				    (LLT)restart_point);
    -			}
    -		}
    -
    -	| RNFR SP pathname CRLF
    -		{
    -			restart_point = (off_t) 0;
    -			if (check_write($3, 0)) {
    -				REASSIGN(fromname, NULL);
    -				fromname = renamefrom($3);
    -			}
    -			if ($3 != NULL)
    -				free($3);
    -		}
    -	;
    -
    -username
    -	: STRING
    -	;
    -
    -password
    -	: /* empty */
    -		{
    -			$$ = (char *)calloc(1, sizeof(char));
    -		}
    -
    -	| STRING
    -	;
    -
    -byte_size
    -	: NUMBER
    -		{
    -			$$ = $1.i;
    -		}
    -	;
    -
    -host_port
    -	: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
    -		NUMBER COMMA NUMBER
    -		{
    -			char *a, *p;
    -
    -			memset(&data_dest, 0, sizeof(data_dest));
    -			data_dest.su_len = sizeof(struct sockaddr_in);
    -			data_dest.su_family = AF_INET;
    -			p = (char *)&data_dest.su_port;
    -			p[0] = $9.i; p[1] = $11.i;
    -			a = (char *)&data_dest.su_addr;
    -			a[0] = $1.i; a[1] = $3.i; a[2] = $5.i; a[3] = $7.i;
    -		}
    -	;
    -
    -host_long_port4
    -	: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
    -		NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
    -		NUMBER
    -		{
    -			char *a, *p;
    -
    -			memset(&data_dest, 0, sizeof(data_dest));
    -			data_dest.su_len = sizeof(struct sockaddr_in);
    -			data_dest.su_family = AF_INET;
    -			p = (char *)&data_dest.su_port;
    -			p[0] = $15.i; p[1] = $17.i;
    -			a = (char *)&data_dest.su_addr;
    -			a[0] = $5.i; a[1] = $7.i; a[2] = $9.i; a[3] = $11.i;
    -
    -			/* reject invalid LPRT command */
    -			if ($1.i != 4 || $3.i != 4 || $13.i != 2)
    -				memset(&data_dest, 0, sizeof(data_dest));
    -		}
    -	;
    -
    -host_long_port6
    -	: NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
    -		NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
    -		NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
    -		NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
    -		NUMBER COMMA NUMBER COMMA NUMBER COMMA NUMBER COMMA
    -		NUMBER
    -		{
    -#ifdef INET6
    -			unsigned char buf[16];
    -
    -			(void)memset(&data_dest, 0, sizeof(data_dest));
    -			data_dest.su_len = sizeof(struct sockaddr_in6);
    -			data_dest.su_family = AF_INET6;
    -			buf[0] = $39.i; buf[1] = $41.i;
    -			(void)memcpy(&data_dest.su_port, buf,
    -			    sizeof(data_dest.su_port));
    -			buf[0] = $5.i; buf[1] = $7.i;
    -			buf[2] = $9.i; buf[3] = $11.i;
    -			buf[4] = $13.i; buf[5] = $15.i;
    -			buf[6] = $17.i; buf[7] = $19.i;
    -			buf[8] = $21.i; buf[9] = $23.i;
    -			buf[10] = $25.i; buf[11] = $27.i;
    -			buf[12] = $29.i; buf[13] = $31.i;
    -			buf[14] = $33.i; buf[15] = $35.i;
    -			(void)memcpy(&data_dest.si_su.su_sin6.sin6_addr,
    -			    buf, sizeof(data_dest.si_su.su_sin6.sin6_addr));
    -			if (his_addr.su_family == AF_INET6) {
    -				/* XXX: more sanity checks! */
    -				data_dest.su_scope_id = his_addr.su_scope_id;
    -			}
    -#else
    -			memset(&data_dest, 0, sizeof(data_dest));
    -#endif /* INET6 */
    -			/* reject invalid LPRT command */
    -			if ($1.i != 6 || $3.i != 16 || $37.i != 2)
    -				memset(&data_dest, 0, sizeof(data_dest));
    -		}
    -	;
    -
    -form_code
    -	: N
    -		{
    -			$$ = FORM_N;
    -		}
    -
    -	| T
    -		{
    -			$$ = FORM_T;
    -		}
    -
    -	| C
    -		{
    -			$$ = FORM_C;
    -		}
    -	;
    -
    -type_code
    -	: A
    -		{
    -			cmd_type = TYPE_A;
    -			cmd_form = FORM_N;
    -		}
    -
    -	| A SP form_code
    -		{
    -			cmd_type = TYPE_A;
    -			cmd_form = $3;
    -		}
    -
    -	| E
    -		{
    -			cmd_type = TYPE_E;
    -			cmd_form = FORM_N;
    -		}
    -
    -	| E SP form_code
    -		{
    -			cmd_type = TYPE_E;
    -			cmd_form = $3;
    -		}
    -
    -	| I
    -		{
    -			cmd_type = TYPE_I;
    -		}
    -
    -	| L
    -		{
    -			cmd_type = TYPE_L;
    -			cmd_bytesz = NBBY;
    -		}
    -
    -	| L SP byte_size
    -		{
    -			cmd_type = TYPE_L;
    -			cmd_bytesz = $3;
    -		}
    -
    -		/* this is for a bug in the BBN ftp */
    -	| L byte_size
    -		{
    -			cmd_type = TYPE_L;
    -			cmd_bytesz = $2;
    -		}
    -	;
    -
    -struct_code
    -	: F
    -		{
    -			$$ = STRU_F;
    -		}
    -
    -	| R
    -		{
    -			$$ = STRU_R;
    -		}
    -
    -	| P
    -		{
    -			$$ = STRU_P;
    -		}
    -	;
    -
    -mode_code
    -	: S
    -		{
    -			$$ = MODE_S;
    -		}
    -
    -	| B
    -		{
    -			$$ = MODE_B;
    -		}
    -
    -	| C
    -		{
    -			$$ = MODE_C;
    -		}
    -	;
    -
    -pathname
    -	: pathstring
    -		{
    -			/*
    -			 * Problem: this production is used for all pathname
    -			 * processing, but only gives a 550 error reply.
    -			 * This is a valid reply in some cases but not in
    -			 * others.
    -			 */
    -			if (logged_in && $1 && *$1 == '~') {
    -				char	*path, *home, *result;
    -				size_t	len;
    -
    -				path = strchr($1 + 1, '/');
    -				if (path != NULL)
    -					*path++ = '\0';
    -				if ($1[1] == '\0')
    -					home = homedir;
    -				else {
    -					struct passwd	*hpw;
    -
    -					if ((hpw = getpwnam($1 + 1)) != NULL)
    -						home = hpw->pw_dir;
    -					else
    -						home = $1;
    -				}
    -				len = strlen(home) + 1;
    -				if (path != NULL)
    -					len += strlen(path) + 1;
    -				if ((result = malloc(len)) == NULL)
    -					fatal("Local resource failure: malloc");
    -				strlcpy(result, home, len);
    -				if (path != NULL) {
    -					strlcat(result, "/", len);
    -					strlcat(result, path, len);
    -				}
    -				$$ = result;
    -				free($1);
    -			} else
    -				$$ = $1;
    -		}
    -	;
    -
    -pathstring
    -	: STRING
    -	;
    -
    -octal_number
    -	: NUMBER
    -		{
    -			int ret, dec, multby, digit;
    -
    -			/*
    -			 * Convert a number that was read as decimal number
    -			 * to what it would be if it had been read as octal.
    -			 */
    -			dec = $1.i;
    -			multby = 1;
    -			ret = 0;
    -			while (dec) {
    -				digit = dec%10;
    -				if (digit > 7) {
    -					ret = -1;
    -					break;
    -				}
    -				ret += digit * multby;
    -				multby *= 8;
    -				dec /= 10;
    -			}
    -			$$ = ret;
    -		}
    -	;
    -
    -mechanism_name
    -	: STRING
    -	;
    -
    -base64data
    -	: STRING
    -	;
    -
    -prot_code
    -	: STRING
    -	;
    -
    -decimal_integer
    -	: NUMBER
    -		{
    -			$$ = $1.i;
    -		}
    -	;
    -
    -check_login
    -	: /* empty */
    -		{
    -			if (logged_in)
    -				$$ = 1;
    -			else {
    -				reply(530, "Please login with USER and PASS.");
    -				$$ = 0;
    -				hasyyerrored = 1;
    -			}
    -		}
    -	;
    -
    -%%
    -
    -#define	CMD	0	/* beginning of command */
    -#define	ARGS	1	/* expect miscellaneous arguments */
    -#define	STR1	2	/* expect SP followed by STRING */
    -#define	STR2	3	/* expect STRING */
    -#define	OSTR	4	/* optional SP then STRING */
    -#define	ZSTR1	5	/* SP then optional STRING */
    -#define	ZSTR2	6	/* optional STRING after SP */
    -#define	SITECMD	7	/* SITE command */
    -#define	NSTR	8	/* Number followed by a string */
    -#define NOARGS	9	/* No arguments allowed */
    -#define EOLN	10	/* End of line */
    -
    -struct tab cmdtab[] = {
    -				/* From RFC 959, in order defined (5.3.1) */
    -	{ "USER", USER, STR1,	1,	" username", 0, },
    -	{ "PASS", PASS, ZSTR1,	1,	" password", 0, },
    -	{ "ACCT", ACCT, STR1,	0,	"(specify account)", 0, },
    -	{ "CWD",  CWD,  OSTR,	1,	"[  directory-name ]", 0, },
    -	{ "CDUP", CDUP, NOARGS,	1,	"(change to parent directory)", 0, },
    -	{ "SMNT", SMNT, ARGS,	0,	"(structure mount)", 0, },
    -	{ "QUIT", QUIT, NOARGS,	1,	"(terminate service)", 0, },
    -	{ "REIN", REIN, NOARGS,	0,	"(reinitialize server state)", 0, },
    -	{ "PORT", PORT, ARGS,	1,	" b0, b1, b2, b3, b4, b5", 0, },
    -	{ "LPRT", LPRT, ARGS,	1,	" af, hal, h1, h2, h3,..., pal, p1, p2...", 0, },
    -	{ "EPRT", EPRT, STR1,	1,	" |af|addr|port|", 0, },
    -	{ "PASV", PASV, NOARGS,	1,	"(set server in passive mode)", 0, },
    -	{ "LPSV", LPSV, ARGS,	1,	"(set server in passive mode)", 0, },
    -	{ "EPSV", EPSV, ARGS,	1,	"[ af|ALL]", 0, },
    -	{ "TYPE", TYPE, ARGS,	1,	" [ A | E | I | L ]", 0, },
    -	{ "STRU", STRU, ARGS,	1,	"(specify file structure)", 0, },
    -	{ "MODE", MODE, ARGS,	1,	"(specify transfer mode)", 0, },
    -	{ "RETR", RETR, STR1,	1,	" file-name", 0, },
    -	{ "STOR", STOR, STR1,	1,	" file-name", 0, },
    -	{ "STOU", STOU, STR1,	1,	" file-name", 0, },
    -	{ "APPE", APPE, STR1,	1,	" file-name", 0, },
    -	{ "ALLO", ALLO, ARGS,	1,	"allocate storage (vacuously)", 0, },
    -	{ "REST", REST, ARGS,	1,	" offset (restart command)", 0, },
    -	{ "RNFR", RNFR, STR1,	1,	" file-name", 0, },
    -	{ "RNTO", RNTO, STR1,	1,	" file-name", 0, },
    -	{ "ABOR", ABOR, NOARGS,	4,	"(abort operation)", 0, },
    -	{ "DELE", DELE, STR1,	1,	" file-name", 0, },
    -	{ "RMD",  RMD,  STR1,	1,	" path-name", 0, },
    -	{ "MKD",  MKD,  STR1,	1,	" path-name", 0, },
    -	{ "PWD",  PWD,  NOARGS,	1,	"(return current directory)", 0, },
    -	{ "LIST", LIST, OSTR,	1,	"[  path-name ]", 0, },
    -	{ "NLST", NLST, OSTR,	1,	"[  path-name ]", 0, },
    -	{ "SITE", SITE, SITECMD, 1,	"site-cmd [  arguments ]", 0, },
    -	{ "SYST", SYST, NOARGS,	1,	"(get type of operating system)", 0, },
    -	{ "STAT", STAT, OSTR,	4,	"[  path-name ]", 0, },
    -	{ "HELP", HELP, OSTR,	1,	"[   ]", 0, },
    -	{ "NOOP", NOOP, NOARGS,	2,	"", 0, },
    -
    -				/* From RFC 2228, in order defined */
    -	{ "AUTH", AUTH, STR1,	1,	" mechanism-name", 0, },
    -	{ "ADAT", ADAT, STR1,	1,	" base-64-data", 0, },
    -	{ "PROT", PROT, STR1,	1,	" prot-code", 0, },
    -	{ "PBSZ", PBSZ, ARGS,	1,	" decimal-integer", 0, },
    -	{ "CCC",  CCC,  NOARGS,	1,	"(Disable data protection)", 0, },
    -	{ "MIC",  MIC,  STR1,	4,	" base64data", 0, },
    -	{ "CONF", CONF, STR1,	4,	" base64data", 0, },
    -	{ "ENC",  ENC,  STR1,	4,	" base64data", 0, },
    -
    -				/* From RFC 2389, in order defined */
    -	{ "FEAT", FEAT, NOARGS,	1,	"(display extended features)", 0, },
    -	{ "OPTS", OPTS, STR1,	1,	" command [  options ]", 0, },
    -
    -				/* From RFC 3659, in order defined */
    -	{ "MDTM", MDTM, OSTR,	1,	" path-name", 0, },
    -	{ "SIZE", SIZE, OSTR,	1,	" path-name", 0, },
    -	{ "MLST", MLST, OSTR,	2,	"[  path-name ]", 0, },
    -	{ "MLSD", MLSD, OSTR,	1,	"[  directory-name ]", 0, },
    -
    -				/* obsolete commands */
    -	{ "MAIL", MAIL, OSTR,	0,	"(mail to user)", 0, },
    -	{ "MLFL", MLFL, OSTR,	0,	"(mail file)", 0, },
    -	{ "MRCP", MRCP, STR1,	0,	"(mail recipient)", 0, },
    -	{ "MRSQ", MRSQ, OSTR,	0,	"(mail recipient scheme question)", 0, },
    -	{ "MSAM", MSAM, OSTR,	0,	"(mail send to terminal and mailbox)", 0, },
    -	{ "MSND", MSND, OSTR,	0,	"(mail send to terminal)", 0, },
    -	{ "MSOM", MSOM, OSTR,	0,	"(mail send to terminal or mailbox)", 0, },
    -	{ "XCUP", CDUP, NOARGS,	1,	"(change to parent directory)", 0, },
    -	{ "XCWD", CWD,  OSTR,	1,	"[  directory-name ]", 0, },
    -	{ "XMKD", MKD,  STR1,	1,	" path-name", 0, },
    -	{ "XPWD", PWD,  NOARGS,	1,	"(return current directory)", 0, },
    -	{ "XRMD", RMD,  STR1,	1,	" path-name", 0, },
    -
    -	{  NULL,  0,	0,	0,	0, 0, }
    -};
    -
    -struct tab sitetab[] = {
    -	{ "CHMOD",	CHMOD,	NSTR,	1,	" mode  file-name", 0, },
    -	{ "HELP",	HELP,	OSTR,	1,	"[   ]", 0, },
    -	{ "IDLE",	IDLE,	ARGS,	1,	"[  maximum-idle-time ]", 0, },
    -	{ "RATEGET",	RATEGET,OSTR,	1,	"[  get-throttle-rate ]", 0, },
    -	{ "RATEPUT",	RATEPUT,OSTR,	1,	"[  put-throttle-rate ]", 0, },
    -	{ "UMASK",	UMASK,	ARGS,	1,	"[  umask ]", 0, },
    -	{ NULL,		0,	0,	0,	0, 0, }
    -};
    -
    -/*
    - * Check if a filename is allowed to be modified (isupload == 0) or
    - * uploaded (isupload == 1), and if necessary, check the filename is `sane'.
    - * If the filename is NULL, fail.
    - * If the filename is "", don't do the sane name check.
    - */
    -static int
    -check_write(const char *file, int isupload)
    -{
    -	if (file == NULL)
    -		return (0);
    -	if (! logged_in) {
    -		reply(530, "Please login with USER and PASS.");
    -		return (0);
    -	}
    -		/* checking modify */
    -	if (! isupload && ! CURCLASS_FLAGS_ISSET(modify)) {
    -		reply(502, "No permission to use this command.");
    -		return (0);
    -	}
    -		/* checking upload */
    -	if (isupload && ! CURCLASS_FLAGS_ISSET(upload)) {
    -		reply(502, "No permission to use this command.");
    -		return (0);
    -	}
    -
    -		/* checking sanenames */
    -	if (file[0] != '\0' && CURCLASS_FLAGS_ISSET(sanenames)) {
    -		const char *p;
    -
    -		if (file[0] == '.')
    -			goto insane_name;
    -		for (p = file; *p; p++) {
    -			if (isalnum((unsigned char)*p) || *p == '-' || *p == '+' ||
    -			    *p == ',' || *p == '.' || *p == '_')
    -				continue;
    - insane_name:
    -			reply(553, "File name `%s' not allowed.", file);
    -			return (0);
    -		}
    -	}
    -	return (1);
    -}
    -
    -struct tab *
    -lookup(struct tab *p, const char *cmd)
    -{
    -
    -	for (; p->name != NULL; p++)
    -		if (strcasecmp(cmd, p->name) == 0)
    -			return (p);
    -	return (0);
    -}
    -
    -#include 
    -
    -/*
    - * get_line - a hacked up version of fgets to ignore TELNET escape codes.
    - *	`s' is the buffer to read into.
    - *	`n' is the 1 less than the size of the buffer, to allow trailing NUL
    - *	`iop' is the FILE to read from.
    - *	Returns 0 on success, -1 on EOF, -2 if the command was too long.
    - */
    -int
    -get_line(char *s, int n, FILE *iop)
    -{
    -	int c;
    -	char *cs;
    -
    -	cs = s;
    -/* tmpline may contain saved command from urgent mode interruption */
    -	for (c = 0; tmpline[c] != '\0' && --n > 0; ++c) {
    -		*cs++ = tmpline[c];
    -		if (tmpline[c] == '\n') {
    -			*cs++ = '\0';
    -			if (ftpd_debug)
    -				syslog(LOG_DEBUG, "command: %s", s);
    -			tmpline[0] = '\0';
    -			return(0);
    -		}
    -		if (c == 0)
    -			tmpline[0] = '\0';
    -	}
    -	while ((c = getc(iop)) != EOF) {
    -		total_bytes++;
    -		total_bytes_in++;
    -		c &= 0377;
    -		if (c == IAC) {
    -		    if ((c = getc(iop)) != EOF) {
    -			total_bytes++;
    -			total_bytes_in++;
    -			c &= 0377;
    -			switch (c) {
    -			case WILL:
    -			case WONT:
    -				c = getc(iop);
    -				total_bytes++;
    -				total_bytes_in++;
    -				cprintf(stdout, "%c%c%c", IAC, DONT, 0377&c);
    -				(void) fflush(stdout);
    -				continue;
    -			case DO:
    -			case DONT:
    -				c = getc(iop);
    -				total_bytes++;
    -				total_bytes_in++;
    -				cprintf(stdout, "%c%c%c", IAC, WONT, 0377&c);
    -				(void) fflush(stdout);
    -				continue;
    -			case IAC:
    -				break;
    -			default:
    -				continue;	/* ignore command */
    -			}
    -		    }
    -		}
    -		*cs++ = c;
    -		if (--n <= 0) {
    -			/*
    -			 * If command doesn't fit into buffer, discard the
    -			 * rest of the command and indicate truncation.
    -			 * This prevents the command to be split up into
    -			 * multiple commands.
    -			 */
    -			if (ftpd_debug)
    -				syslog(LOG_DEBUG,
    -				    "command too long, last char: %d", c);
    -			while (c != '\n' && (c = getc(iop)) != EOF)
    -				continue;
    -			return (-2);
    -		}
    -		if (c == '\n')
    -			break;
    -	}
    -	if (c == EOF && cs == s)
    -		return (-1);
    -	*cs++ = '\0';
    -	if (ftpd_debug) {
    -		if ((curclass.type != CLASS_GUEST &&
    -		    strncasecmp(s, "PASS ", 5) == 0) ||
    -		    strncasecmp(s, "ACCT ", 5) == 0) {
    -			/* Don't syslog passwords */
    -			syslog(LOG_DEBUG, "command: %.4s ???", s);
    -		} else {
    -			char *cp;
    -			int len;
    -
    -			/* Don't syslog trailing CR-LF */
    -			len = strlen(s);
    -			cp = s + len - 1;
    -			while (cp >= s && (*cp == '\n' || *cp == '\r')) {
    -				--cp;
    -				--len;
    -			}
    -			syslog(LOG_DEBUG, "command: %.*s", len, s);
    -		}
    -	}
    -	return (0);
    -}
    -
    -void
    -ftp_handle_line(char *cp)
    -{
    -
    -	cmdp = cp;
    -	yyparse();
    -}
    -
    -void
    -ftp_loop(void)
    -{
    -	int ret;
    -
    -	while (1) {
    -		(void) alarm(curclass.timeout);
    -		ret = get_line(cbuf, sizeof(cbuf)-1, stdin);
    -		(void) alarm(0);
    -		if (ret == -1) {
    -			reply(221, "You could at least say goodbye.");
    -			dologout(0);
    -		} else if (ret == -2) {
    -			reply(500, "Command too long.");
    -		} else {
    -			ftp_handle_line(cbuf);
    -		}
    -	}
    -	/*NOTREACHED*/
    -}
    -
    -int
    -yylex(void)
    -{
    -	static int cpos, state;
    -	char *cp, *cp2;
    -	struct tab *p;
    -	int n;
    -	char c;
    -
    -	switch (state) {
    -
    -	case CMD:
    -		hasyyerrored = 0;
    -		if ((cp = strchr(cmdp, '\r'))) {
    -			*cp = '\0';
    -#if defined(HAVE_SETPROCTITLE)
    -			if (strncasecmp(cmdp, "PASS", 4) != 0 &&
    -			    strncasecmp(cmdp, "ACCT", 4) != 0)
    -				setproctitle("%s: %s", proctitle, cmdp);
    -#endif /* defined(HAVE_SETPROCTITLE) */
    -			*cp++ = '\n';
    -			*cp = '\0';
    -		}
    -		if ((cp = strpbrk(cmdp, " \n")))
    -			cpos = cp - cmdp;
    -		if (cpos == 0)
    -			cpos = 4;
    -		c = cmdp[cpos];
    -		cmdp[cpos] = '\0';
    -		p = lookup(cmdtab, cmdp);
    -		cmdp[cpos] = c;
    -		if (p != NULL) {
    -			if (is_oob && ! CMD_OOB(p)) {
    -				/* command will be handled in-band */
    -				return (0);
    -			} else if (! CMD_IMPLEMENTED(p)) {
    -				reply(502, "%s command not implemented.",
    -				    p->name);
    -				hasyyerrored = 1;
    -				break;
    -			}
    -			state = p->state;
    -			yylval.cs = p->name;
    -			return (p->token);
    -		}
    -		break;
    -
    -	case SITECMD:
    -		if (cmdp[cpos] == ' ') {
    -			cpos++;
    -			return (SP);
    -		}
    -		cp = &cmdp[cpos];
    -		if ((cp2 = strpbrk(cp, " \n")))
    -			cpos = cp2 - cmdp;
    -		c = cmdp[cpos];
    -		cmdp[cpos] = '\0';
    -		p = lookup(sitetab, cp);
    -		cmdp[cpos] = c;
    -		if (p != NULL) {
    -			if (!CMD_IMPLEMENTED(p)) {
    -				reply(502, "SITE %s command not implemented.",
    -				    p->name);
    -				hasyyerrored = 1;
    -				break;
    -			}
    -			state = p->state;
    -			yylval.cs = p->name;
    -			return (p->token);
    -		}
    -		break;
    -
    -	case OSTR:
    -		if (cmdp[cpos] == '\n') {
    -			state = EOLN;
    -			return (CRLF);
    -		}
    -		/* FALLTHROUGH */
    -
    -	case STR1:
    -	case ZSTR1:
    -	dostr1:
    -		if (cmdp[cpos] == ' ') {
    -			cpos++;
    -			state = state == OSTR ? STR2 : state+1;
    -			return (SP);
    -		}
    -		break;
    -
    -	case ZSTR2:
    -		if (cmdp[cpos] == '\n') {
    -			state = EOLN;
    -			return (CRLF);
    -		}
    -		/* FALLTHROUGH */
    -
    -	case STR2:
    -		cp = &cmdp[cpos];
    -		n = strlen(cp);
    -		cpos += n - 1;
    -		/*
    -		 * Make sure the string is nonempty and \n terminated.
    -		 */
    -		if (n > 1 && cmdp[cpos] == '\n') {
    -			cmdp[cpos] = '\0';
    -			yylval.s = ftpd_strdup(cp);
    -			cmdp[cpos] = '\n';
    -			state = ARGS;
    -			return (STRING);
    -		}
    -		break;
    -
    -	case NSTR:
    -		if (cmdp[cpos] == ' ') {
    -			cpos++;
    -			return (SP);
    -		}
    -		if (isdigit((unsigned char)cmdp[cpos])) {
    -			cp = &cmdp[cpos];
    -			while (isdigit((unsigned char)cmdp[++cpos]))
    -				;
    -			c = cmdp[cpos];
    -			cmdp[cpos] = '\0';
    -			yylval.u.i = atoi(cp);
    -			cmdp[cpos] = c;
    -			state = STR1;
    -			return (NUMBER);
    -		}
    -		state = STR1;
    -		goto dostr1;
    -
    -	case ARGS:
    -		if (isdigit((unsigned char)cmdp[cpos])) {
    -			cp = &cmdp[cpos];
    -			while (isdigit((unsigned char)cmdp[++cpos]))
    -				;
    -			c = cmdp[cpos];
    -			cmdp[cpos] = '\0';
    -			yylval.u.i = atoi(cp);
    -			yylval.u.ll = STRTOLL(cp, NULL, 10);
    -			cmdp[cpos] = c;
    -			return (NUMBER);
    -		}
    -		if (strncasecmp(&cmdp[cpos], "ALL", 3) == 0
    -		    && !isalnum((unsigned char)cmdp[cpos + 3])) {
    -			cpos += 3;
    -			return (ALL);
    -		}
    -		switch (cmdp[cpos++]) {
    -
    -		case '\n':
    -			state = EOLN;
    -			return (CRLF);
    -
    -		case ' ':
    -			return (SP);
    -
    -		case ',':
    -			return (COMMA);
    -
    -		case 'A':
    -		case 'a':
    -			return (A);
    -
    -		case 'B':
    -		case 'b':
    -			return (B);
    -
    -		case 'C':
    -		case 'c':
    -			return (C);
    -
    -		case 'E':
    -		case 'e':
    -			return (E);
    -
    -		case 'F':
    -		case 'f':
    -			return (F);
    -
    -		case 'I':
    -		case 'i':
    -			return (I);
    -
    -		case 'L':
    -		case 'l':
    -			return (L);
    -
    -		case 'N':
    -		case 'n':
    -			return (N);
    -
    -		case 'P':
    -		case 'p':
    -			return (P);
    -
    -		case 'R':
    -		case 'r':
    -			return (R);
    -
    -		case 'S':
    -		case 's':
    -			return (S);
    -
    -		case 'T':
    -		case 't':
    -			return (T);
    -
    -		}
    -		break;
    -
    -	case NOARGS:
    -		if (cmdp[cpos] == '\n') {
    -			state = EOLN;
    -			return (CRLF);
    -		}
    -		c = cmdp[cpos];
    -		cmdp[cpos] = '\0';
    -		reply(501, "'%s' command does not take any arguments.", cmdp);
    -		hasyyerrored = 1;
    -		cmdp[cpos] = c;
    -		break;
    -
    -	case EOLN:
    -		state = CMD;
    -		return (0);
    -
    -	default:
    -		fatal("Unknown state in scanner.");
    -	}
    -	yyerror(NULL);
    -	state = CMD;
    -	return (0);
    -}
    -
    -/* ARGSUSED */
    -void
    -yyerror(const char *s)
    -{
    -	char *cp;
    -
    -	if (hasyyerrored || is_oob)
    -		return;
    -	if ((cp = strchr(cmdp,'\n')) != NULL)
    -		*cp = '\0';
    -	reply(500, "'%s': command not understood.", cmdp);
    -	hasyyerrored = 1;
    -}
    -
    -static void
    -help(struct tab *ctab, const char *s)
    -{
    -	struct tab *c;
    -	int width, NCMDS;
    -	const char *htype;
    -
    -	if (ctab == sitetab)
    -		htype = "SITE ";
    -	else
    -		htype = "";
    -	width = 0, NCMDS = 0;
    -	for (c = ctab; c->name != NULL; c++) {
    -		int len = strlen(c->name);
    -
    -		if (len > width)
    -			width = len;
    -		NCMDS++;
    -	}
    -	width = (width + 8) &~ 7;
    -	if (s == 0) {
    -		int i, j, w;
    -		int columns, lines;
    -
    -		reply(-214, "%s", "");
    -		reply(0, "The following %scommands are recognized.", htype);
    -		reply(0, "(`-' = not implemented, `+' = supports options)");
    -		columns = 76 / width;
    -		if (columns == 0)
    -			columns = 1;
    -		lines = (NCMDS + columns - 1) / columns;
    -		for (i = 0; i < lines; i++) {
    -			cprintf(stdout, "    ");
    -			for (j = 0; j < columns; j++) {
    -				c = ctab + j * lines + i;
    -				cprintf(stdout, "%s", c->name);
    -				w = strlen(c->name);
    -				if (! CMD_IMPLEMENTED(c)) {
    -					CPUTC('-', stdout);
    -					w++;
    -				}
    -				if (CMD_HAS_OPTIONS(c)) {
    -					CPUTC('+', stdout);
    -					w++;
    -				}
    -				if (c + lines >= &ctab[NCMDS])
    -					break;
    -				while (w < width) {
    -					CPUTC(' ', stdout);
    -					w++;
    -				}
    -			}
    -			cprintf(stdout, "\r\n");
    -		}
    -		(void) fflush(stdout);
    -		reply(214, "Direct comments to ftp-bugs@%s.", hostname);
    -		return;
    -	}
    -	c = lookup(ctab, s);
    -	if (c == (struct tab *)0) {
    -		reply(502, "Unknown command '%s'.", s);
    -		return;
    -	}
    -	if (CMD_IMPLEMENTED(c))
    -		reply(214, "Syntax: %s%s %s", htype, c->name, c->help);
    -	else
    -		reply(504, "%s%-*s\t%s; not implemented.", htype, width,
    -		    c->name, c->help);
    -}
    -
    -/*
    - * Check that the structures used for a PORT, LPRT or EPRT command are
    - * valid (data_dest, his_addr), and if necessary, detect ftp bounce attacks.
    - * If family != -1 check that his_addr.su_family == family.
    - */
    -static void
    -port_check(const char *cmd, int family)
    -{
    -	char h1[NI_MAXHOST], h2[NI_MAXHOST];
    -	char s1[NI_MAXHOST], s2[NI_MAXHOST];
    -#ifdef NI_WITHSCOPEID
    -	const int niflags = NI_NUMERICHOST | NI_NUMERICSERV | NI_WITHSCOPEID;
    -#else
    -	const int niflags = NI_NUMERICHOST | NI_NUMERICSERV;
    -#endif
    -
    -	if (epsvall) {
    -		reply(501, "%s disallowed after EPSV ALL", cmd);
    -		return;
    -	}
    -
    -	if (family != -1 && his_addr.su_family != family) {
    - port_check_fail:
    -		reply(500, "Illegal %s command rejected", cmd);
    -		return;
    -	}
    -
    -	if (data_dest.su_family != his_addr.su_family)
    -		goto port_check_fail;
    -
    -			/* be paranoid, if told so */
    -	if (CURCLASS_FLAGS_ISSET(checkportcmd)) {
    -#ifdef INET6
    -		/*
    -		 * be paranoid, there are getnameinfo implementation that does
    -		 * not present scopeid portion
    -		 */
    -		if (data_dest.su_family == AF_INET6 &&
    -		    data_dest.su_scope_id != his_addr.su_scope_id)
    -			goto port_check_fail;
    -#endif
    -
    -		if (getnameinfo((struct sockaddr *)&data_dest, data_dest.su_len,
    -		    h1, sizeof(h1), s1, sizeof(s1), niflags))
    -			goto port_check_fail;
    -		if (getnameinfo((struct sockaddr *)&his_addr, his_addr.su_len,
    -		    h2, sizeof(h2), s2, sizeof(s2), niflags))
    -			goto port_check_fail;
    -
    -		if (atoi(s1) < IPPORT_RESERVED || strcmp(h1, h2) != 0)
    -			goto port_check_fail;
    -	}
    -
    -	usedefault = 0;
    -	if (pdata >= 0) {
    -		(void) close(pdata);
    -		pdata = -1;
    -	}
    -	reply(200, "%s command successful.", cmd);
    -}
    diff --git a/libexec/ftpd/ftpd.8 b/libexec/ftpd/ftpd.8
    deleted file mode 100644
    index c62d3d391..000000000
    --- a/libexec/ftpd/ftpd.8
    +++ /dev/null
    @@ -1,871 +0,0 @@
    -.\"	$NetBSD: ftpd.8,v 1.85 2009/05/01 10:53:27 wiz Exp $
    -.\"
    -.\" Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
    -.\" All rights reserved.
    -.\"
    -.\" This code is derived from software contributed to The NetBSD Foundation
    -.\" by Luke Mewburn.
    -.\"
    -.\" Redistribution and use in source and binary forms, with or without
    -.\" modification, are permitted provided that the following conditions
    -.\" are met:
    -.\" 1. Redistributions of source code must retain the above copyright
    -.\"    notice, this list of conditions and the following disclaimer.
    -.\" 2. Redistributions in binary form must reproduce the above copyright
    -.\"    notice, this list of conditions and the following disclaimer in the
    -.\"    documentation and/or other materials provided with the distribution.
    -.\"
    -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    -.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    -.\" POSSIBILITY OF SUCH DAMAGE.
    -.\"
    -.\" Copyright (c) 1985, 1988, 1991, 1993
    -.\"	The Regents of the University of California.  All rights reserved.
    -.\"
    -.\" Redistribution and use in source and binary forms, with or without
    -.\" modification, are permitted provided that the following conditions
    -.\" are met:
    -.\" 1. Redistributions of source code must retain the above copyright
    -.\"    notice, this list of conditions and the following disclaimer.
    -.\" 2. Redistributions in binary form must reproduce the above copyright
    -.\"    notice, this list of conditions and the following disclaimer in the
    -.\"    documentation and/or other materials provided with the distribution.
    -.\" 3. Neither the name of the University nor the names of its contributors
    -.\"    may be used to endorse or promote products derived from this software
    -.\"    without specific prior written permission.
    -.\"
    -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    -.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    -.\" SUCH DAMAGE.
    -.\"
    -.\"     @(#)ftpd.8	8.2 (Berkeley) 4/19/94
    -.\"
    -.Dd May 1, 2009
    -.Dt FTPD 8
    -.Os
    -.Sh NAME
    -.Nm ftpd
    -.Nd
    -Internet File Transfer Protocol server
    -.Sh SYNOPSIS
    -.Nm
    -.Op Fl 46DdHlnQqrsUuWwX
    -.Op Fl a Ar anondir
    -.Op Fl C Ar user Ns Op @ Ns Ar host
    -.Op Fl c Ar confdir
    -.Op Fl e Ar emailaddr
    -.Op Fl h Ar hostname
    -.Op Fl L Ar xferlogfile
    -.Op Fl P Ar dataport
    -.Op Fl V Ar version
    -.Sh DESCRIPTION
    -.Nm
    -is the Internet File Transfer Protocol server process.
    -The server uses the
    -.Tn TCP
    -protocol and listens at the port specified in the
    -.Dq ftp
    -service specification; see
    -.Xr services 5 .
    -.Pp
    -Available options:
    -.Bl -tag -width Ds
    -.It Fl 4
    -When
    -.Fl D
    -is specified, bind to IPv4 addresses only.
    -.It Fl 6
    -When
    -.Fl D
    -is specified, bind to IPv6 addresses only.
    -.It Fl a Ar anondir
    -Define
    -.Ar anondir
    -as the directory to
    -.Xr chroot 2
    -into for anonymous logins.
    -Default is the home directory for the ftp user.
    -This can also be specified with the
    -.Xr ftpd.conf 5
    -.Sy chroot
    -directive.
    -.It Fl C Ar user Ns Op @ Ns Ar host
    -Check whether
    -.Ar user
    -.Po
    -as if connecting from
    -.Ar host ,
    -if provided
    -.Pc
    -would be granted access under
    -the restrictions given in
    -.Xr ftpusers 5 ,
    -and exit without attempting a connection.
    -.Nm
    -exits with an exit code of 0 if access would be granted, or 1 otherwise.
    -This can be useful for testing configurations.
    -.It Fl c Ar confdir
    -Change the root directory of the configuration files from
    -.Dq Pa /etc
    -to
    -.Ar confdir .
    -This changes the directory for the following files:
    -.Pa /etc/ftpchroot ,
    -.Pa /etc/ftpusers ,
    -.Pa /etc/ftpwelcome ,
    -.Pa /etc/motd ,
    -and the file specified by the
    -.Xr ftpd.conf 5
    -.Sy limit
    -directive.
    -.It Fl D
    -Run as daemon.
    -.Nm
    -will listen on the default FTP port for incoming connections
    -and fork a child for each connection.
    -This is lower overhead than starting
    -.Nm
    -from
    -.Xr inetd 8
    -and thus might be useful on busy servers to reduce load.
    -.It Fl d
    -Debugging information is written to the syslog using a facility of
    -.Dv LOG_FTP .
    -.It Fl e Ar emailaddr
    -Use
    -.Ar emailaddr
    -for the
    -.Dq "\&%E"
    -escape sequence (see
    -.Sx Display file escape sequences )
    -.It Fl H
    -Equivalent to
    -.Do
    --h
    -`hostname`
    -.Dc .
    -.It Fl h Ar hostname
    -Explicitly set the hostname to advertise as to
    -.Ar hostname .
    -The default is the hostname associated with the IP address that
    -.Nm
    -is listening on.
    -This ability (with or without
    -.Fl h ) ,
    -in conjunction with
    -.Fl c Ar confdir ,
    -is useful when configuring
    -.Sq virtual
    -.Tn FTP
    -servers, each listening on separate addresses as separate names.
    -Refer to
    -.Xr inetd.conf 5
    -for more information on starting services to listen on specific IP addresses.
    -.It Fl L Ar xferlogfile
    -Log
    -.Tn wu-ftpd
    -style
    -.Sq xferlog
    -entries to
    -.Ar xferlogfile .
    -.It Fl l
    -Each successful and failed
    -.Tn FTP
    -session is logged using syslog with a facility of
    -.Dv LOG_FTP .
    -If this option is specified more than once, the retrieve (get), store (put),
    -append, delete, make directory, remove directory and rename operations and
    -their file name arguments are also logged.
    -.It Fl n
    -Don't attempt translation of IP addresses to hostnames.
    -.It Fl P Ar dataport
    -Use
    -.Ar dataport
    -as the data port, overriding the default of using the port one less
    -that the port
    -.Nm
    -is listening on.
    -.It Fl Q
    -Disable the use of pid files for keeping track of the number of logged-in
    -users per class.
    -This may reduce the load on heavily loaded
    -.Tn FTP
    -servers.
    -.It Fl q
    -Enable the use of pid files for keeping track of the number of logged-in
    -users per class.
    -This is the default.
    -.It Fl r
    -Permanently drop root privileges once the user is logged in.
    -The use of this option may result in the server using a port other
    -than the (listening-port - 1) for
    -.Sy PORT
    -style commands, which is contrary to the
    -.Cm RFC 959
    -specification, but in practice very few clients rely upon this behaviour.
    -See
    -.Sx SECURITY CONSIDERATIONS
    -below for more details.
    -.It Fl s
    -Require a secure authentication mechanism like Kerberos or S/Key to be used.
    -.It Fl U
    -Don't log each concurrent
    -.Tn FTP
    -session to
    -.Pa /var/run/utmp .
    -This is the default.
    -.It Fl u
    -Log each concurrent
    -.Tn FTP
    -session to
    -.Pa /var/run/utmp ,
    -making them visible to commands such as
    -.Xr who 1 .
    -.It Fl V Ar version
    -Use
    -.Ar version
    -as the version to advertise in the login banner and in the output of
    -.Sy STAT
    -and
    -.Sy SYST
    -instead of the default version information.
    -If
    -.Ar version
    -is empty or
    -.Sq -
    -then don't display any version information.
    -.It Fl W
    -Don't log each
    -.Tn FTP
    -session to
    -.Pa /var/log/wtmp .
    -.It Fl w
    -Log each
    -.Tn FTP
    -session to
    -.Pa /var/log/wtmp ,
    -making them visible to commands such as
    -.Xr last 1 .
    -This is the default.
    -.It Fl X
    -Log
    -.Tn wu-ftpd
    -style
    -.Sq xferlog
    -entries to the syslog, prefixed with
    -.Dq "xferlog:\ " ,
    -using a facility of
    -.Dv LOG_FTP .
    -These syslog entries can be converted to a
    -.Tn wu-ftpd
    -style
    -.Pa xferlog
    -file suitable for input into a third-party log analysis tool with a command
    -similar to:
    -.Dl "sed -ne 's/^.*xferlog: //p' /var/log/xferlog \*[Gt] wuxferlog"
    -.El
    -.Pp
    -The file
    -.Pa /etc/nologin
    -can be used to disable
    -.Tn FTP
    -access.
    -If the file exists,
    -.Nm
    -displays it and exits.
    -If the file
    -.Pa /etc/ftpwelcome
    -exists,
    -.Nm
    -prints it before issuing the
    -.Dq ready
    -message.
    -If the file
    -.Pa /etc/motd
    -exists (under the chroot directory if applicable),
    -.Nm
    -prints it after a successful login.
    -This may be changed with the
    -.Xr ftpd.conf 5
    -directive
    -.Sy motd .
    -.Pp
    -The
    -.Nm
    -server currently supports the following
    -.Tn FTP
    -requests.
    -The case of the requests is ignored.
    -.Bl -column "Request" "Description" -offset indent
    -.It Sy Request Ta Sy Description
    -.It ABOR Ta "abort previous command"
    -.It ACCT Ta "specify account (ignored)"
    -.It ALLO Ta "allocate storage (vacuously)"
    -.It APPE Ta "append to a file"
    -.It CDUP Ta "change to parent of current working directory"
    -.It CWD Ta "change working directory"
    -.It DELE Ta "delete a file"
    -.It EPSV Ta "prepare for server-to-server transfer"
    -.It EPRT Ta "specify data connection port"
    -.It FEAT Ta "list extra features that are not defined in" Cm "RFC 959"
    -.It HELP Ta "give help information"
    -.It LIST Ta "give list files in a directory" Pq Dq Li "ls -lA"
    -.It LPSV Ta "prepare for server-to-server transfer"
    -.It LPRT Ta "specify data connection port"
    -.It MLSD Ta "list contents of directory in a machine-processable form"
    -.It MLST Ta "show a pathname in a machine-processable form"
    -.It MKD Ta "make a directory"
    -.It MDTM Ta "show last modification time of file"
    -.It MODE Ta "specify data transfer" Em mode
    -.It NLST Ta "give name list of files in directory"
    -.It NOOP Ta "do nothing"
    -.It OPTS Ta "define persistent options for a given command"
    -.It PASS Ta "specify password"
    -.It PASV Ta "prepare for server-to-server transfer"
    -.It PORT Ta "specify data connection port"
    -.It PWD Ta "print the current working directory"
    -.It QUIT Ta "terminate session"
    -.It REST Ta "restart incomplete transfer"
    -.It RETR Ta "retrieve a file"
    -.It RMD Ta "remove a directory"
    -.It RNFR Ta "specify rename-from file name"
    -.It RNTO Ta "specify rename-to file name"
    -.It SITE Ta "non-standard commands (see next section)"
    -.It SIZE Ta "return size of file"
    -.It STAT Ta "return status of server"
    -.It STOR Ta "store a file"
    -.It STOU Ta "store a file with a unique name"
    -.It STRU Ta "specify data transfer" Em structure
    -.It SYST Ta "show operating system type of server system"
    -.It TYPE Ta "specify data transfer" Em type
    -.It USER Ta "specify user name"
    -.It XCUP Ta "change to parent of current working directory (deprecated)"
    -.It XCWD Ta "change working directory (deprecated)"
    -.It XMKD Ta "make a directory (deprecated)"
    -.It XPWD Ta "print the current working directory (deprecated)"
    -.It XRMD Ta "remove a directory (deprecated)"
    -.El
    -.Pp
    -The following non-standard or
    -.Ux
    -specific commands are supported by the SITE request.
    -.Pp
    -.Bl -column Request Description -offset indent
    -.It Sy Request Ta Sy Description
    -.It CHMOD Ta "change mode of a file, e.g. ``SITE CHMOD 755 filename''"
    -.It HELP Ta "give help information."
    -.It IDLE Ta "set idle-timer, e.g. ``SITE IDLE 60''"
    -.It RATEGET Ta "set maximum get rate throttle in bytes/second, e.g. ``SITE RATEGET 5k''"
    -.It RATEPUT Ta "set maximum put rate throttle in bytes/second, e.g. ``SITE RATEPUT 5k''"
    -.It UMASK Ta "change umask, e.g. ``SITE UMASK 002''"
    -.El
    -.Pp
    -The following
    -.Tn FTP
    -requests (as specified in
    -.Cm RFC 959
    -and
    -.Cm RFC 2228 )
    -are recognized, but are not implemented:
    -.Sy ACCT ,
    -.Sy ADAT ,
    -.Sy AUTH ,
    -.Sy CCC ,
    -.Sy CONF ,
    -.Sy ENC ,
    -.Sy MIC ,
    -.Sy PBSZ ,
    -.Sy PROT ,
    -.Sy REIN ,
    -and
    -.Sy SMNT .
    -.Pp
    -The
    -.Nm
    -server will abort an active file transfer only when the
    -.Sy ABOR
    -command is preceded by a Telnet "Interrupt Process" (IP)
    -signal and a Telnet "Synch" signal in the command Telnet stream,
    -as described in Internet
    -.Cm RFC 959 .
    -If a
    -.Sy STAT
    -command is received during a data transfer, preceded by a Telnet IP
    -and Synch, transfer status will be returned.
    -.Pp
    -.Nm
    -interprets file names according to the
    -.Dq globbing
    -conventions used by
    -.Xr csh 1 .
    -This allows users to use the metacharacters
    -.Dq Li \&*?[]{}~ .
    -.Ss User authentication
    -.Nm
    -authenticates users according to five rules.
    -.Pp
    -.Bl -enum -offset indent
    -.It
    -The login name must be in the password data base,
    -.Xr passwd 5 ,
    -and not have a null password.
    -In this case a password must be provided by the client before any
    -file operations may be performed.
    -If the user has an S/Key key, the response from a successful
    -.Sy USER
    -command will include an S/Key challenge.
    -The client may choose to respond with a
    -.Sy PASS
    -command giving either
    -a standard password or an S/Key one-time password.
    -The server will automatically determine which type of password it
    -has been given and attempt to authenticate accordingly.
    -See
    -.Xr skey 1
    -for more information on S/Key authentication.
    -S/Key is a Trademark of Bellcore.
    -.It
    -The login name must be allowed based on the information in
    -.Xr ftpusers 5 .
    -.It
    -The user must have a standard shell returned by
    -.Xr getusershell 3 .
    -If the user's shell field in the password database is empty, the
    -shell is assumed to be
    -.Pa /bin/sh .
    -As per
    -.Xr shells 5 ,
    -the user's shell must be listed with full path in
    -.Pa /etc/shells .
    -.It
    -If directed by the file
    -.Xr ftpchroot 5
    -the session's root directory will be changed by
    -.Xr chroot 2
    -to the directory specified in the
    -.Xr ftpd.conf 5
    -.Sy chroot
    -directive (if set),
    -or to the home directory of the user.
    -This facility may also be triggered by enabling the boolean
    -.Sy ftp-chroot
    -in
    -.Xr login.conf 5 .
    -However, the user must still supply a password.
    -This feature is intended as a compromise between a fully anonymous account
    -and a fully privileged account.
    -The account should also be set up as for an anonymous account.
    -.It
    -If the user name is
    -.Dq anonymous
    -or
    -.Dq ftp ,
    -an
    -anonymous
    -.Tn FTP
    -account must be present in the password
    -file (user
    -.Dq ftp ) .
    -In this case the user is allowed
    -to log in by specifying any password (by convention an email address for
    -the user should be used as the password).
    -.Pp
    -The server performs a
    -.Xr chroot 2
    -to the directory specified in the
    -.Xr ftpd.conf 5
    -.Sy chroot
    -directive (if set),
    -the
    -.Fl a Ar anondir
    -directory (if set),
    -or to the home directory of the
    -.Dq ftp
    -user.
    -.Pp
    -The server then performs a
    -.Xr chdir 2
    -to the directory specified in the
    -.Xr ftpd.conf 5
    -.Sy homedir
    -directive (if set), otherwise to
    -.Pa / .
    -.Pp
    -If other restrictions are required (such as disabling of certain
    -commands and the setting of a specific umask), then appropriate
    -entries in
    -.Xr ftpd.conf 5
    -are required.
    -.Pp
    -If the first character of the password supplied by an anonymous user
    -is
    -.Dq - ,
    -then the verbose messages displayed at login and upon a
    -.Sy CWD
    -command are suppressed.
    -.El
    -.Ss Display file escape sequences
    -When
    -.Nm
    -displays various files back to the client (such as
    -.Pa /etc/ftpwelcome
    -and
    -.Pa /etc/motd ) ,
    -various escape strings are replaced with information pertinent
    -to the current connection.
    -.Pp
    -The supported escape strings are:
    -.Bl -tag -width "Escape" -offset indent -compact
    -.It Sy "Escape"
    -.Sy Description
    -.It "\&%c"
    -Class name.
    -.It "\&%C"
    -Current working directory.
    -.It "\&%E"
    -Email address given with
    -.Fl e .
    -.It "\&%L"
    -Local hostname.
    -.It "\&%M"
    -Maximum number of users for this class.
    -Displays
    -.Dq unlimited
    -if there's no limit.
    -.It "\&%N"
    -Current number of users for this class.
    -.It "\&%R"
    -Remote hostname.
    -.It "\&%s"
    -If the result of the most recent
    -.Dq "\&%M"
    -or
    -.Dq "\&%N"
    -was not
    -.Dq Li 1 ,
    -print an
    -.Dq s .
    -.It "\&%S"
    -If the result of the most recent
    -.Dq "\&%M"
    -or
    -.Dq "\&%N"
    -was not
    -.Dq Li 1 ,
    -print an
    -.Dq S .
    -.It "\&%T"
    -Current time.
    -.It "\&%U"
    -User name.
    -.It "\&%\&%"
    -A
    -.Dq \&%
    -character.
    -.El
    -.Ss Setting up a restricted ftp subtree
    -In order that system security is not breached, it is recommended
    -that the
    -subtrees for the
    -.Dq ftp
    -and
    -.Dq chroot
    -accounts be constructed with care, following these rules
    -(replace
    -.Dq ftp
    -in the following directory names
    -with the appropriate account name for
    -.Sq chroot
    -users):
    -.Bl -tag -width "~ftp/incoming" -offset indent
    -.It Pa ~ftp
    -Make the home directory owned by
    -.Dq root
    -and unwritable by anyone.
    -.It Pa ~ftp/bin
    -Make this directory owned by
    -.Dq root
    -and unwritable by anyone (mode 555).
    -Generally any conversion commands should be installed
    -here (mode 111).
    -.It Pa ~ftp/etc
    -Make this directory owned by
    -.Dq root
    -and unwritable by anyone (mode 555).
    -The files
    -.Pa pwd.db
    -(see
    -.Xr passwd 5 )
    -and
    -.Pa group
    -(see
    -.Xr group 5 )
    -must be present for the
    -.Sy LIST
    -command to be able to display owner and group names instead of numbers.
    -The password field in
    -.Xr passwd 5
    -is not used, and should not contain real passwords.
    -The file
    -.Pa motd ,
    -if present, will be printed after a successful login.
    -These files should be mode 444.
    -.It Pa ~ftp/pub
    -This directory and the subdirectories beneath it should be owned
    -by the users and groups responsible for placing files in them,
    -and be writable only by them (mode 755 or 775).
    -They should
    -.Em not
    -be owned or writable by ftp or its group.
    -.It Pa ~ftp/incoming
    -This directory is where anonymous users place files they upload.
    -The owners should be the user
    -.Dq ftp
    -and an appropriate group.
    -Members of this group will be the only users with access to these
    -files after they have been uploaded; these should be people who
    -know how to deal with them appropriately.
    -If you wish anonymous
    -.Tn FTP
    -users to be able to see the names of the
    -files in this directory the permissions should be 770, otherwise
    -they should be 370.
    -.Pp
    -The following
    -.Xr ftpd.conf 5
    -directives should be used:
    -.Dl "modify guest off"
    -.Dl "umask  guest 0707"
    -.Dl "upload guest on"
    -.Pp
    -This will result in anonymous users being able to upload files to this
    -directory, but they will not be able to download them, delete them, or
    -overwrite them, due to the umask and disabling of the commands mentioned
    -above.
    -.It Pa ~ftp/tmp
    -This directory is used to create temporary files which contain
    -the error messages generated by a conversion or
    -.Sy LIST
    -command.
    -The owner should be the user
    -.Dq ftp .
    -The permissions should be 300.
    -.Pp
    -If you don't enable conversion commands, or don't want anonymous users
    -uploading files here (see
    -.Pa ~ftp/incoming
    -above), then don't create this directory.
    -However, error messages from conversion or
    -.Sy LIST
    -commands won't be returned to the user.
    -(This is the traditional behaviour.)
    -Note that the
    -.Xr ftpd.conf 5
    -directive
    -.Sy upload
    -can be used to prevent users uploading here.
    -.El
    -.Pp
    -To set up "ftp-only" accounts that provide only
    -.Tn FTP ,
    -but no valid shell
    -login, you can copy/link
    -.Pa /sbin/nologin
    -to
    -.Pa /sbin/ftplogin ,
    -and enter
    -.Pa /sbin/ftplogin
    -to
    -.Pa /etc/shells
    -to allow logging-in via
    -.Tn FTP
    -into the accounts, which must have
    -.Pa /sbin/ftplogin
    -as login shell.
    -.Sh FILES
    -.Bl -tag -width /etc/ftpwelcome -compact
    -.It Pa /etc/ftpchroot
    -List of normal users whose root directory should be changed via
    -.Xr chroot 2 .
    -.It Pa /etc/ftpd.conf
    -Configure file conversions and other settings.
    -.It Pa /etc/ftpusers
    -List of unwelcome/restricted users.
    -.It Pa /etc/ftpwelcome
    -Welcome notice before login.
    -.It Pa /etc/motd
    -Welcome notice after login.
    -.It Pa /etc/nologin
    -If it exists, displayed and access is refused.
    -.It Pa /var/run/ftpd.pids-CLASS
    -State file of logged-in processes for the
    -.Nm
    -class
    -.Sq CLASS .
    -.It Pa /var/run/utmp
    -List of logged-in users on the system.
    -.It Pa /var/log/wtmp
    -Login history database.
    -.El
    -.Sh SEE ALSO
    -.Xr ftp 1 ,
    -.Xr skey 1 ,
    -.Xr who 1 ,
    -.Xr getusershell 3 ,
    -.Xr ftpchroot 5 ,
    -.Xr ftpd.conf 5 ,
    -.Xr ftpusers 5 ,
    -.Xr login.conf 5 ,
    -.Xr syslogd 8
    -.Sh STANDARDS
    -.Nm
    -recognizes all commands in
    -.Cm RFC 959 ,
    -follows the guidelines in
    -.Cm RFC 1123 ,
    -recognizes all commands in
    -.Cm RFC 2228
    -(although they are not supported yet),
    -and supports the extensions from
    -.Cm RFC 2389 ,
    -.Cm RFC 2428 ,
    -and
    -.Cm RFC 3659 .
    -.Sh HISTORY
    -The
    -.Nm
    -command appeared in
    -.Bx 4.2 .
    -.Pp
    -Various features such as the
    -.Xr ftpd.conf 5
    -functionality,
    -.Cm RFC 2389 ,
    -and
    -.Cm RFC 3659
    -support was implemented in
    -.Nx 1.3
    -and later releases by Luke Mewburn.
    -.Sh BUGS
    -The server must run as the super-user to create sockets with
    -privileged port numbers (i.e, those less than
    -.Dv IPPORT_RESERVED ,
    -which is 1024).
    -If
    -.Nm
    -is listening on a privileged port
    -it maintains an effective user id of the logged in user, reverting
    -to the super-user only when binding addresses to privileged sockets.
    -The
    -.Fl r
    -option can be used to override this behaviour and force privileges to
    -be permanently revoked; see
    -.Sx SECURITY CONSIDERATIONS
    -below for more details.
    -.Pp
    -.Nm
    -may have trouble handling connections from scoped IPv6 addresses, or
    -IPv4 mapped addresses
    -.Po
    -IPv4 connection on
    -.Dv AF_INET6
    -socket
    -.Pc .
    -For the latter case, running two daemons,
    -one for IPv4 and one for IPv6, will avoid the problem.
    -.Sh SECURITY CONSIDERATIONS
    -.Cm RFC 959
    -provides no restrictions on the
    -.Sy PORT
    -command, and this can lead to security problems, as
    -.Nm
    -can be fooled into connecting to any service on any host.
    -With the
    -.Dq checkportcmd
    -feature of the
    -.Xr ftpd.conf 5 ,
    -.Sy PORT
    -commands with different host addresses, or TCP ports lower than
    -.Dv IPPORT_RESERVED
    -will be rejected.
    -This also prevents
    -.Sq third-party proxy ftp
    -from working.
    -Use of this option is
    -.Em strongly
    -recommended, and enabled by default.
    -.Pp
    -By default
    -.Nm
    -uses a port that is one less than the port it is listening on to
    -communicate back to the client for the
    -.Sy EPRT ,
    -.Sy LPRT ,
    -and
    -.Sy PORT
    -commands, unless overridden with
    -.Fl P Ar dataport .
    -As the default port for
    -.Nm
    -(21) is a privileged port below
    -.Dv IPPORT_RESERVED ,
    -.Nm
    -retains the ability to switch back to root privileges to bind these
    -ports.
    -In order to increase security by reducing the potential for a bug in
    -.Nm
    -providing a remote root compromise,
    -.Nm
    -will permanently drop root privileges if one of the following is true:
    -.Bl -enum -offset indent
    -.It
    -.Nm
    -is running on a port greater than
    -.Dv IPPORT_RESERVED
    -and the user has logged in as a
    -.Sq guest
    -or
    -.Sq chroot
    -user.
    -.It
    -.Nm
    -was invoked with
    -.Fl r .
    -.El
    -.Pp
    -Don't create
    -.Pa ~ftp/tmp
    -if you don't want anonymous users to upload files there.
    -That directory is only necessary if you want to display the error
    -messages of conversion commands to the user.
    -Note that if uploads are disabled with the
    -.Xr ftpd.conf 5
    -directive
    -.Sy upload ,
    -then this directory cannot be abused by the user in this way, so it
    -should be safe to create.
    -.Pp
    -To avoid possible denial-of-service attacks,
    -.Sy SIZE
    -requests against files larger than 10240 bytes will be denied if
    -the current transfer
    -.Sy TYPE
    -is
    -.Sq Li A
    -(ASCII).
    diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
    deleted file mode 100644
    index 3c7aa9df3..000000000
    --- a/libexec/ftpd/ftpd.c
    +++ /dev/null
    @@ -1,4004 +0,0 @@
    -/*	$NetBSD: ftpd.c,v 1.202 2015/08/10 07:32:49 shm Exp $	*/
    -
    -/*
    - * Copyright (c) 1997-2009 The NetBSD Foundation, Inc.
    - * All rights reserved.
    - *
    - * This code is derived from software contributed to The NetBSD Foundation
    - * by Luke Mewburn.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    - * POSSIBILITY OF SUCH DAMAGE.
    - */
    -
    -/*
    - * Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -/*
    - * Copyright (C) 1997 and 1998 WIDE Project.
    - * All rights reserved.
    - * 
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the project nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - * 
    - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -#include 
    -#ifndef lint
    -__COPYRIGHT("@(#) Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994\
    - The Regents of the University of California.  All rights reserved.");
    -#endif /* not lint */
    -
    -#ifndef lint
    -#if 0
    -static char sccsid[] = "@(#)ftpd.c	8.5 (Berkeley) 4/28/95";
    -#else
    -__RCSID("$NetBSD: ftpd.c,v 1.202 2015/08/10 07:32:49 shm Exp $");
    -#endif
    -#endif /* not lint */
    -
    -/*
    - * FTP server.
    - */
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -
    -#define	FTP_NAMES
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#ifdef SUPPORT_UTMP
    -#include 
    -#endif
    -#ifdef SUPPORT_UTMPX
    -#include 
    -#endif
    -#ifdef SKEY
    -#include 
    -#endif
    -#ifdef KERBEROS5
    -#include 
    -#include 
    -#endif
    -
    -#ifdef	LOGIN_CAP
    -#include 
    -#endif
    -
    -#ifdef USE_PAM
    -#include 
    -#endif
    -
    -#include "pfilter.h"
    -
    -#define	GLOBAL
    -#include "extern.h"
    -#include "pathnames.h"
    -#include "version.h"
    -
    -static sig_atomic_t	transflag;
    -static sig_atomic_t	urgflag;
    -
    -int	data;
    -int	Dflag;
    -int	sflag;
    -int	stru;			/* avoid C keyword */
    -int	mode;
    -int	dataport;		/* use specific data port */
    -int	dopidfile;		/* maintain pid file */
    -int	doutmp;			/* update utmp file */
    -int	dowtmp;			/* update wtmp file */
    -int	doxferlog;		/* syslog/write wu-ftpd style xferlog entries */
    -int	xferlogfd;		/* fd to write wu-ftpd xferlog entries to */
    -int	getnameopts;		/* flags for use with getname() */
    -int	dropprivs;		/* if privileges should or have been dropped */
    -int	mapped;			/* IPv4 connection on AF_INET6 socket */
    -off_t	file_size;
    -off_t	byte_count;
    -static char ttyline[20];
    -
    -#ifdef USE_PAM
    -static int	auth_pam(void);
    -pam_handle_t	*pamh = NULL;
    -#endif
    -
    -#ifdef SUPPORT_UTMP
    -static struct utmp utmp;	/* for utmp */
    -#endif
    -#ifdef SUPPORT_UTMPX
    -static struct utmpx utmpx;	/* for utmpx */
    -#endif
    -
    -static const char *anondir = NULL;
    -static const char *confdir = _DEFAULT_CONFDIR;
    -
    -static char	*curname;		/* current USER name */
    -static size_t	curname_len;		/* length of curname (include NUL) */
    -
    -#if defined(KERBEROS) || defined(KERBEROS5)
    -int	has_ccache = 0;
    -int	notickets = 1;
    -char	*krbtkfile_env = NULL;
    -char	*tty = ttyline;
    -int	login_krb5_forwardable_tgt = 0;
    -#endif
    -
    -int epsvall = 0;
    -
    -/*
    - * Timeout intervals for retrying connections
    - * to hosts that don't accept PORT cmds.  This
    - * is a kludge, but given the problems with TCP...
    - */
    -#define	SWAITMAX	90	/* wait at most 90 seconds */
    -#define	SWAITINT	5	/* interval between retries */
    -
    -int	swaitmax = SWAITMAX;
    -int	swaitint = SWAITINT;
    -
    -enum send_status {
    -	SS_SUCCESS,
    -	SS_ABORTED,			/* transfer aborted */
    -	SS_NO_TRANSFER,			/* no transfer made yet */
    -	SS_FILE_ERROR,			/* file read error */
    -	SS_DATA_ERROR			/* data send error */
    -};
    -
    -static int	 bind_pasv_addr(void);
    -static int	 checkuser(const char *, const char *, int, int, char **);
    -static int	 checkaccess(const char *);
    -static int	 checkpassword(const struct passwd *, const char *);
    -static void	 do_pass(int, int, const char *);
    -static void	 end_login(void);
    -static FILE	*getdatasock(const char *);
    -static char	*gunique(const char *);
    -static void	 login_utmp(const char *, const char *, const char *,
    -		     struct sockinet *);
    -static void	 logremotehost(struct sockinet *);
    -__dead static void	 lostconn(int);
    -__dead static void	 toolong(int);
    -__dead static void	 sigquit(int);
    -static void	 sigurg(int);
    -static int	 handleoobcmd(void);
    -static int	 receive_data(FILE *, FILE *);
    -static int	 send_data(FILE *, FILE *, const struct stat *, int);
    -static struct passwd *sgetpwnam(const char *);
    -static int	 write_data(int, char *, size_t, off_t *, struct timeval *,
    -		     int);
    -static enum send_status
    -		 send_data_with_read(int, int, const struct stat *, int);
    -#if !defined(__minix)
    -static enum send_status
    -		 send_data_with_mmap(int, int, const struct stat *, int);
    -#endif /* !defined(__minix) */
    -static void	 logrusage(const struct rusage *, const struct rusage *);
    -static void	 logout_utmp(void);
    -
    -int	main(int, char *[]);
    -
    -#if defined(KERBEROS)
    -int	klogin(struct passwd *, char *, char *, char *);
    -void	kdestroy(void);
    -#endif
    -#if defined(KERBEROS5)
    -int	k5login(struct passwd *, char *, char *, char *);
    -void	k5destroy(void);
    -#endif
    -
    -int
    -main(int argc, char *argv[])
    -{
    -	int		ch, on = 1, tos, keepalive;
    -	socklen_t	addrlen;
    -#ifdef KERBEROS5
    -	krb5_error_code	kerror;
    -#endif
    -	char		*p;
    -	const char	*xferlogname = NULL;
    -	long		l;
    -	struct sigaction sa;
    -	sa_family_t	af = AF_UNSPEC;
    -
    -	connections = 1;
    -	ftpd_debug = 0;
    -	logging = 0;
    -	pdata = -1;
    -	Dflag = 0;
    -	sflag = 0;
    -	dataport = 0;
    -	dopidfile = 1;		/* default: DO use a pid file to count users */
    -	doutmp = 0;		/* default: Do NOT log to utmp */
    -	dowtmp = 1;		/* default: DO log to wtmp */
    -	doxferlog = 0;		/* default: Do NOT syslog xferlog */
    -	xferlogfd = -1;		/* default: Do NOT write xferlog file */
    -	getnameopts = 0;	/* default: xlate addrs to name */
    -	dropprivs = 0;
    -	mapped = 0;
    -	usedefault = 1;
    -	emailaddr = NULL;
    -	hostname[0] = '\0';
    -	homedir[0] = '\0';
    -	gidcount = 0;
    -	is_oob = 0;
    -	version = FTPD_VERSION;
    -
    -	/*
    -	 * LOG_NDELAY sets up the logging connection immediately,
    -	 * necessary for anonymous ftp's that chroot and can't do it later.
    -	 */
    -	openlog("ftpd", LOG_PID | LOG_NDELAY, LOG_FTP);
    -
    -	while ((ch = getopt(argc, argv,
    -	    "46a:c:C:Dde:h:HlL:nP:qQrst:T:uUvV:wWX")) != -1) {
    -		switch (ch) {
    -		case '4':
    -			af = AF_INET;
    -			break;
    -
    -		case '6':
    -			af = AF_INET6;
    -			break;
    -
    -		case 'a':
    -			anondir = optarg;
    -			break;
    -
    -		case 'c':
    -			confdir = optarg;
    -			break;
    -
    -		case 'C':
    -			if ((p = strchr(optarg, '@')) != NULL) {
    -				*p++ = '\0';
    -				strlcpy(remotehost, p, MAXHOSTNAMELEN + 1);
    -				if (inet_pton(AF_INET, p,
    -				    &his_addr.su_addr) == 1) {
    -					his_addr.su_family = AF_INET;
    -					his_addr.su_len =
    -					    sizeof(his_addr.si_su.su_sin);
    -#ifdef INET6
    -				} else if (inet_pton(AF_INET6, p,
    -				    &his_addr.su_6addr) == 1) {
    -					his_addr.su_family = AF_INET6;
    -					his_addr.su_len =
    -					    sizeof(his_addr.si_su.su_sin6);
    -#endif
    -				} else
    -					his_addr.su_family = AF_UNSPEC;
    -			}
    -			pw = sgetpwnam(optarg);
    -			exit(checkaccess(optarg) ? 0 : 1);
    -			/* NOTREACHED */
    -
    -		case 'D':
    -			Dflag = 1;
    -			break;
    -
    -		case 'd':
    -		case 'v':		/* deprecated */
    -			ftpd_debug = 1;
    -			break;
    -
    -		case 'e':
    -			emailaddr = optarg;
    -			break;
    -
    -		case 'h':
    -			strlcpy(hostname, optarg, sizeof(hostname));
    -			break;
    -
    -		case 'H':
    -			if (gethostname(hostname, sizeof(hostname)) == -1)
    -				hostname[0] = '\0';
    -			hostname[sizeof(hostname) - 1] = '\0';
    -			break;
    -
    -		case 'l':
    -			logging++;	/* > 1 == extra logging */
    -			break;
    -
    -		case 'L':
    -			xferlogname = optarg;
    -			break;
    -
    -		case 'n':
    -			getnameopts = NI_NUMERICHOST;
    -			break;
    -
    -		case 'P':
    -			errno = 0;
    -			p = NULL;
    -			l = strtol(optarg, &p, 10);
    -			if (errno || *optarg == '\0' || *p != '\0' ||
    -			    l < IPPORT_RESERVED ||
    -			    l > IPPORT_ANONMAX) {
    -				syslog(LOG_WARNING, "Invalid dataport %s",
    -				    optarg);
    -				dataport = 0;
    -			}
    -			dataport = (int)l;
    -			break;
    -
    -		case 'q':
    -			dopidfile = 1;
    -			break;
    -
    -		case 'Q':
    -			dopidfile = 0;
    -			break;
    -
    -		case 'r':
    -			dropprivs = 1;
    -			break;
    -
    -		case 's':
    -			sflag = 1;
    -			break;
    -
    -		case 't':
    -		case 'T':
    -			syslog(LOG_WARNING,
    -			    "-%c has been deprecated in favour of ftpd.conf",
    -			    ch);
    -			break;
    -
    -		case 'u':
    -			doutmp = 1;
    -			break;
    -
    -		case 'U':
    -			doutmp = 0;
    -			break;
    -
    -		case 'V':
    -			if (EMPTYSTR(optarg) || strcmp(optarg, "-") == 0)
    -				version = NULL;
    -			else
    -				version = ftpd_strdup(optarg);
    -			break;
    -
    -		case 'w':
    -			dowtmp = 1;
    -			break;
    -
    -		case 'W':
    -			dowtmp = 0;
    -			break;
    -
    -		case 'X':
    -			doxferlog |= 1;
    -			break;
    -
    -		default:
    -			if (optopt == 'a' || optopt == 'C')
    -				exit(1);
    -			syslog(LOG_WARNING, "unknown flag -%c ignored", optopt);
    -			break;
    -		}
    -	}
    -	if (EMPTYSTR(confdir))
    -		confdir = _DEFAULT_CONFDIR;
    -
    -	pfilter_open();
    -
    -	if (dowtmp) {
    -#ifdef SUPPORT_UTMPX
    -		ftpd_initwtmpx();
    -#endif
    -#ifdef SUPPORT_UTMP
    -		ftpd_initwtmp();
    -#endif
    -	}
    -	errno = 0;
    -#if !defined(__minix)
    -	l = sysconf(_SC_LOGIN_NAME_MAX);
    -	if (l == -1 && errno != 0) {
    -		syslog(LOG_ERR, "sysconf _SC_LOGIN_NAME_MAX: %m");
    -		exit(1);
    -	} else if (l <= 0) {
    -		syslog(LOG_WARNING, "using conservative LOGIN_NAME_MAX value");
    -		curname_len = _POSIX_LOGIN_NAME_MAX;
    -	} else 
    -		curname_len = (size_t)l;
    -#else
    -	curname_len = _POSIX_LOGIN_NAME_MAX;
    -#endif /* !defined(__minix) */
    -	curname = malloc(curname_len);
    -	if (curname == NULL) {
    -		syslog(LOG_ERR, "malloc: %m");
    -		exit(1);
    -	}
    -	curname[0] = '\0';
    -
    -	if (Dflag) {
    -		int error, fd, i, n, *socks;
    -		struct pollfd *fds;
    -		struct addrinfo hints, *res, *res0;
    -
    -		if (daemon(1, 0) == -1) {
    -			syslog(LOG_ERR, "failed to daemonize: %m");
    -			exit(1);
    -		}
    -		(void)memset(&sa, 0, sizeof(sa));
    -		sa.sa_handler = SIG_IGN;
    -		sa.sa_flags = SA_NOCLDWAIT;
    -		sigemptyset(&sa.sa_mask);
    -		(void)sigaction(SIGCHLD, &sa, NULL);
    -
    -		(void)memset(&hints, 0, sizeof(hints));
    -		hints.ai_flags = AI_PASSIVE;
    -		hints.ai_family = af;
    -		hints.ai_socktype = SOCK_STREAM;
    -		error = getaddrinfo(NULL, "ftp", &hints, &res0);
    -		if (error) {
    -			syslog(LOG_ERR, "getaddrinfo: %s", gai_strerror(error));
    -			exit(1);
    -		}
    -
    -		for (n = 0, res = res0; res != NULL; res = res->ai_next)
    -			n++;
    -		if (n == 0) {
    -			syslog(LOG_ERR, "no addresses available");
    -			exit(1);
    -		}
    -		socks = malloc(n * sizeof(int));
    -		fds = malloc(n * sizeof(struct pollfd));
    -		if (socks == NULL || fds == NULL) {
    -			syslog(LOG_ERR, "malloc: %m");
    -			exit(1);
    -		}
    -
    -		for (n = 0, res = res0; res != NULL; res = res->ai_next) {
    -			socks[n] = socket(res->ai_family, res->ai_socktype,
    -			    res->ai_protocol);
    -			if (socks[n] == -1)
    -				continue;
    -			(void)setsockopt(socks[n], SOL_SOCKET, SO_REUSEADDR,
    -			    &on, sizeof(on));
    -			if (bind(socks[n], res->ai_addr, res->ai_addrlen)
    -			    == -1) {
    -				(void)close(socks[n]);
    -				continue;
    -			}
    -			if (listen(socks[n], 12) == -1) {
    -				(void)close(socks[n]);
    -				continue;
    -			}
    -
    -			fds[n].fd = socks[n];
    -			fds[n].events = POLLIN;
    -			n++;
    -		}
    -		if (n == 0) {
    -			syslog(LOG_ERR, "%m");
    -			exit(1);
    -		}
    -		freeaddrinfo(res0);
    -
    -		if (pidfile(NULL) == -1)
    -			syslog(LOG_ERR, "failed to write a pid file: %m");
    -
    -		for (;;) {
    -#ifdef __minix
    -			/*
    -			 * MINIX 3 does not yet support SA_NOCLDWAIT.  Cleaning
    -			 * up zombies this way is not perfect, but at least it
    -			 * prevents accumulation of zombies over time.
    -			 */
    -			while (waitpid(-1, NULL, WNOHANG) > 0)
    -				;
    -#endif /* __minix */
    -			if (poll(fds, n, INFTIM) == -1) {
    -				if (errno == EINTR)
    -					continue;
    -				syslog(LOG_ERR, "poll: %m");
    -				exit(1);
    -			}
    -			for (i = 0; i < n; i++) {
    -				if (fds[i].revents & POLLIN) {
    -					fd = accept(fds[i].fd, NULL, NULL);
    -					if (fd == -1) {
    -						syslog(LOG_ERR, "accept: %m");
    -						continue;
    -					}
    -					switch (fork()) {
    -					case -1:
    -						syslog(LOG_ERR, "fork: %m");
    -						break;
    -					case 0:
    -						goto child;
    -						/* NOTREACHED */
    -					}
    -					(void)close(fd);
    -				}
    -			}
    -		}
    - child:
    -		(void)dup2(fd, STDIN_FILENO);
    -		(void)dup2(fd, STDOUT_FILENO);
    -		(void)dup2(fd, STDERR_FILENO);
    -		for (i = 0; i < n; i++)
    -			(void)close(socks[i]);
    -	}
    -
    -	memset((char *)&his_addr, 0, sizeof(his_addr));
    -	addrlen = sizeof(his_addr.si_su);
    -	if (getpeername(0, (struct sockaddr *)&his_addr.si_su, &addrlen) < 0) {
    -		syslog((errno == ENOTCONN) ? LOG_NOTICE : LOG_ERR,
    -		    "getpeername (%s): %m",argv[0]);
    -		exit(1);
    -	}
    -	his_addr.su_len = addrlen;
    -	memset((char *)&ctrl_addr, 0, sizeof(ctrl_addr));
    -	addrlen = sizeof(ctrl_addr.si_su);
    -	if (getsockname(0, (struct sockaddr *)&ctrl_addr, &addrlen) < 0) {
    -		syslog(LOG_ERR, "getsockname (%s): %m",argv[0]);
    -		exit(1);
    -	}
    -	ctrl_addr.su_len = addrlen;
    -#ifdef INET6
    -	if (his_addr.su_family == AF_INET6
    -	 && IN6_IS_ADDR_V4MAPPED(&his_addr.su_6addr)) {
    -#if 1
    -		/*
    -		 * IPv4 control connection arrived to AF_INET6 socket.
    -		 * I hate to do this, but this is the easiest solution.
    -		 *
    -		 * The assumption is untrue on SIIT environment.
    -		 */
    -		struct sockinet tmp_addr;
    -		const int off = sizeof(struct in6_addr) - sizeof(struct in_addr);
    -
    -		tmp_addr = his_addr;
    -		memset(&his_addr, 0, sizeof(his_addr));
    -		his_addr.su_family = AF_INET;
    -		his_addr.su_len = sizeof(his_addr.si_su.su_sin);
    -		memcpy(&his_addr.su_addr, &tmp_addr.su_6addr.s6_addr[off],
    -		    sizeof(his_addr.su_addr));
    -		his_addr.su_port = tmp_addr.su_port;
    -
    -		tmp_addr = ctrl_addr;
    -		memset(&ctrl_addr, 0, sizeof(ctrl_addr));
    -		ctrl_addr.su_family = AF_INET;
    -		ctrl_addr.su_len = sizeof(ctrl_addr.si_su.su_sin);
    -		memcpy(&ctrl_addr.su_addr, &tmp_addr.su_6addr.s6_addr[off],
    -		    sizeof(ctrl_addr.su_addr));
    -		ctrl_addr.su_port = tmp_addr.su_port;
    -#else
    -		while (fgets(line, sizeof(line), fd) != NULL) {
    -			if ((cp = strchr(line, '\n')) != NULL)
    -				*cp = '\0';
    -			reply(-530, "%s", line);
    -		}
    -		(void) fflush(stdout);
    -		(void) fclose(fd);
    -		reply(530,
    -		    "Connection from IPv4 mapped address is not supported.");
    -		exit(0);
    -#endif
    -
    -		mapped = 1;
    -	} else
    -#endif /* INET6 */
    -		mapped = 0;
    -#ifdef IP_TOS
    -	if (!mapped && his_addr.su_family == AF_INET) {
    -		tos = IPTOS_LOWDELAY;
    -		if (setsockopt(0, IPPROTO_IP, IP_TOS, (char *)&tos,
    -			       sizeof(int)) < 0)
    -			syslog(LOG_WARNING, "setsockopt (IP_TOS): %m");
    -	}
    -#endif
    -	/* if the hostname hasn't been given, attempt to determine it */ 
    -	if (hostname[0] == '\0') {
    -		if (getnameinfo((struct sockaddr *)&ctrl_addr.si_su,
    -		    ctrl_addr.su_len, hostname, sizeof(hostname), NULL, 0, 
    -			getnameopts) != 0)
    -			(void)gethostname(hostname, sizeof(hostname));
    -		hostname[sizeof(hostname) - 1] = '\0';
    -	}
    -
    -	/* set this here so klogin can use it... */
    -	(void)snprintf(ttyline, sizeof(ttyline), "ftp%d", getpid());
    -
    -	(void) freopen(_PATH_DEVNULL, "w", stderr);
    -
    -	memset(&sa, 0, sizeof(sa));
    -	sa.sa_handler = SIG_DFL;
    -	sa.sa_flags = SA_RESTART;
    -	sigemptyset(&sa.sa_mask);
    -	(void) sigaction(SIGCHLD, &sa, NULL);
    -
    -	sa.sa_handler = sigquit;
    -	sa.sa_flags = SA_RESTART;
    -	sigfillset(&sa.sa_mask);	/* block all sigs in these handlers */
    -	(void) sigaction(SIGHUP, &sa, NULL);
    -	(void) sigaction(SIGINT, &sa, NULL);
    -	(void) sigaction(SIGQUIT, &sa, NULL);
    -	(void) sigaction(SIGTERM, &sa, NULL);
    -	sa.sa_handler = lostconn;
    -	(void) sigaction(SIGPIPE, &sa, NULL);
    -	sa.sa_handler = toolong;
    -	(void) sigaction(SIGALRM, &sa, NULL);
    -	sa.sa_handler = sigurg;
    -	(void) sigaction(SIGURG, &sa, NULL);
    -
    -	/* Try to handle urgent data inline */
    -#ifdef SO_OOBINLINE
    -	if (setsockopt(0, SOL_SOCKET, SO_OOBINLINE, (char *)&on, sizeof(on)) < 0)
    -		syslog(LOG_WARNING, "setsockopt: %m");
    -#endif
    -	/* Set keepalives on the socket to detect dropped connections.  */
    -#ifdef SO_KEEPALIVE
    -	keepalive = 1;
    -	if (setsockopt(0, SOL_SOCKET, SO_KEEPALIVE, (char *)&keepalive,
    -	    sizeof(int)) < 0)
    -		syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m");
    -#endif
    -
    -#ifdef	F_SETOWN
    -	if (fcntl(fileno(stdin), F_SETOWN, getpid()) == -1)
    -		syslog(LOG_WARNING, "fcntl F_SETOWN: %m");
    -#endif
    -	logremotehost(&his_addr);
    -	/*
    -	 * Set up default state
    -	 */
    -	data = -1;
    -	type = TYPE_A;
    -	form = FORM_N;
    -	stru = STRU_F;
    -	mode = MODE_S;
    -	tmpline[0] = '\0';
    -	hasyyerrored = 0;
    -
    -#ifdef KERBEROS5
    -	kerror = krb5_init_context(&kcontext);
    -	if (kerror) {
    -		syslog(LOG_ERR, "%s when initializing Kerberos context",
    -		    error_message(kerror));
    -		exit(0);
    -	}
    -#endif /* KERBEROS5 */
    -
    -	init_curclass();
    -	curclass.timeout = 300;		/* 5 minutes, as per login(1) */
    -	curclass.type = CLASS_REAL;
    -
    -	/* If logins are disabled, print out the message. */
    -	if (display_file(_PATH_NOLOGIN, 530)) {
    -		reply(530, "System not available.");
    -		exit(0);
    -	}
    -	(void)display_file(conffilename(_NAME_FTPWELCOME), 220);
    -		/* reply(220,) must follow */
    -	if (EMPTYSTR(version))
    -		reply(220, "%s FTP server ready.", hostname);
    -	else
    -		reply(220, "%s FTP server (%s) ready.", hostname, version);
    -
    -	if (xferlogname != NULL) {
    -		xferlogfd = open(xferlogname, O_WRONLY | O_APPEND | O_CREAT,
    -		    0660);
    -		if (xferlogfd == -1)
    -			syslog(LOG_WARNING, "open xferlog `%s': %m",
    -			    xferlogname);
    -		else
    -			doxferlog |= 2;
    -	}
    -
    -	ftp_loop();
    -	/* NOTREACHED */
    -}
    -
    -static void
    -lostconn(int signo __unused)
    -{
    -
    -	if (ftpd_debug)
    -		syslog(LOG_DEBUG, "lost connection");
    -	dologout(1);
    -}
    -
    -static void
    -toolong(int signo __unused)
    -{
    -
    -		/* XXXSIGRACE */
    -	reply(421,
    -	    "Timeout (" LLF " seconds): closing control connection.",
    -	    (LLT)curclass.timeout);
    -	if (logging)
    -		syslog(LOG_INFO, "User %s timed out after " LLF " seconds",
    -		    (pw ? pw->pw_name : "unknown"), (LLT)curclass.timeout);
    -	dologout(1);
    -}
    -
    -static void
    -sigquit(int signo)
    -{
    -
    -	if (ftpd_debug)
    -		syslog(LOG_DEBUG, "got signal %d", signo);
    -	dologout(1);
    -}
    -
    -static void
    -sigurg(int signo __unused)
    -{
    -	
    -	urgflag = 1;
    -}
    -
    -
    -/*
    - * Save the result of a getpwnam.  Used for USER command, since
    - * the data returned must not be clobbered by any other command
    - * (e.g., globbing).
    - */
    -static struct passwd *
    -sgetpwnam(const char *name)
    -{
    -	static struct passwd save;
    -	struct passwd *p;
    -
    -	if ((p = getpwnam(name)) == NULL)
    -		return (p);
    -	if (save.pw_name) {
    -		free((char *)save.pw_name);
    -		memset(save.pw_passwd, 0, strlen(save.pw_passwd));
    -		free((char *)save.pw_passwd);
    -		free((char *)save.pw_gecos);
    -		free((char *)save.pw_dir);
    -		free((char *)save.pw_shell);
    -	}
    -	save = *p;
    -	save.pw_name = ftpd_strdup(p->pw_name);
    -	save.pw_passwd = ftpd_strdup(p->pw_passwd);
    -	save.pw_gecos = ftpd_strdup(p->pw_gecos);
    -	save.pw_dir = ftpd_strdup(p->pw_dir);
    -	save.pw_shell = ftpd_strdup(p->pw_shell);
    -	return (&save);
    -}
    -
    -static int	login_attempts;	/* number of failed login attempts */
    -static int	askpasswd;	/* had USER command, ask for PASSwd */
    -static int	permitted;	/* USER permitted */
    -
    -/*
    - * USER command.
    - * Sets global passwd pointer pw if named account exists and is acceptable;
    - * sets askpasswd if a PASS command is expected.  If logged in previously,
    - * need to reset state.  If name is "ftp" or "anonymous", the name is not in
    - * _NAME_FTPUSERS, and ftp account exists, set guest and pw, then just return.
    - * If account doesn't exist, ask for passwd anyway.  Otherwise, check user
    - * requesting login privileges.  Disallow anyone who does not have a standard
    - * shell as returned by getusershell().  Disallow anyone mentioned in the file
    - * _NAME_FTPUSERS to allow people such as root and uucp to be avoided.
    - */
    -void
    -user(const char *name)
    -{
    -	char	*class;
    -#ifdef	LOGIN_CAP
    -	login_cap_t *lc = NULL;
    -#endif
    -#ifdef USE_PAM
    -	int e;
    -#endif
    -
    -	class = NULL;
    -	if (logged_in) {
    -		switch (curclass.type) {
    -		case CLASS_GUEST:
    -			reply(530, "Can't change user from guest login.");
    -			return;
    -		case CLASS_CHROOT:
    -			reply(530, "Can't change user from chroot user.");
    -			return;
    -		case CLASS_REAL:
    -			if (dropprivs) {
    -				reply(530, "Can't change user.");
    -				return;
    -			}
    -			end_login();
    -			break;
    -		default:
    -			abort();
    -		}
    -	}
    -
    -#if defined(KERBEROS)
    -	kdestroy();
    -#endif
    -#if defined(KERBEROS5)
    -	k5destroy();
    -#endif
    -
    -	curclass.type = CLASS_REAL;
    -	askpasswd = 0;
    -	permitted = 0;
    -
    -	if (strcmp(name, "ftp") == 0 || strcmp(name, "anonymous") == 0) {
    -			/* need `pw' setup for checkaccess() and checkuser () */
    -		if ((pw = sgetpwnam("ftp")) == NULL)
    -			reply(530, "User %s unknown.", name);
    -		else if (! checkaccess("ftp") || ! checkaccess("anonymous"))
    -			reply(530, "User %s access denied.", name);
    -		else {
    -			curclass.type = CLASS_GUEST;
    -			askpasswd = 1;
    -			reply(331,
    -			    "Guest login ok, type your name as password.");
    -		}
    -		if (!askpasswd) {
    -			if (logging)
    -				syslog(LOG_NOTICE,
    -				    "ANONYMOUS FTP LOGIN REFUSED FROM %s",
    -				    remoteloghost);
    -			end_login();
    -			goto cleanup_user;
    -		}
    -		name = "ftp";
    -	} else
    -		pw = sgetpwnam(name);
    -
    -	strlcpy(curname, name, curname_len);
    -
    -			/* check user in /etc/ftpusers, and setup class */
    -	permitted = checkuser(_NAME_FTPUSERS, curname, 1, 0, &class);
    -
    -			/* check user in /etc/ftpchroot */
    -#ifdef	LOGIN_CAP
    -	lc = login_getpwclass(pw);
    -#endif
    -	if (checkuser(_NAME_FTPCHROOT, curname, 0, 0, NULL)
    -#ifdef	LOGIN_CAP	/* Allow login.conf configuration as well */
    -	    || login_getcapbool(lc, "ftp-chroot", 0)
    -#endif
    -	) {
    -		if (curclass.type == CLASS_GUEST) {
    -			syslog(LOG_NOTICE,
    -	    "Can't change guest user to chroot class; remove entry in %s",
    -			    _NAME_FTPCHROOT);
    -			exit(1);
    -		}
    -		curclass.type = CLASS_CHROOT;
    -	}
    -
    -			/* determine default class */
    -	if (class == NULL) {
    -		switch (curclass.type) {
    -		case CLASS_GUEST:
    -			class = ftpd_strdup("guest");
    -			break;
    -		case CLASS_CHROOT:
    -			class = ftpd_strdup("chroot");
    -			break;
    -		case CLASS_REAL:
    -			class = ftpd_strdup("real");
    -			break;
    -		default:
    -			syslog(LOG_ERR, "unknown curclass.type %d; aborting",
    -			    curclass.type);
    -			abort();
    -		}
    -	}
    -			/* parse ftpd.conf, setting up various parameters */
    -	parse_conf(class);
    -			/* if not guest user, check for valid shell */
    -	if (pw == NULL)
    -		permitted = 0;
    -	else {
    -		const char	*cp, *shell;
    -
    -		if ((shell = pw->pw_shell) == NULL || *shell == 0)
    -			shell = _PATH_BSHELL;
    -		while ((cp = getusershell()) != NULL)
    -			if (strcmp(cp, shell) == 0)
    -				break;
    -		endusershell();
    -		if (cp == NULL && curclass.type != CLASS_GUEST)
    -			permitted = 0;
    -	}
    -
    -			/* deny quickly (after USER not PASS) if requested */
    -	if (CURCLASS_FLAGS_ISSET(denyquick) && !permitted) {
    -		reply(530, "User %s may not use FTP.", curname);
    -		if (logging)
    -			syslog(LOG_NOTICE, "FTP LOGIN REFUSED FROM %s, %s",
    -			    remoteloghost, curname);
    -		end_login();
    -		goto cleanup_user;
    -	}
    -
    -			/* if haven't asked yet (i.e, not anon), ask now */
    -	if (!askpasswd) {
    -		askpasswd = 1;
    -#ifdef USE_PAM
    -		e = auth_pam();		/* this does reply(331, ...) */
    -		do_pass(1, e, "");
    -		goto cleanup_user;
    -#else /* !USE_PAM */
    -#ifdef SKEY
    -		if (skey_haskey(curname) == 0) {
    -			const char *myskey;
    -
    -			myskey = skey_keyinfo(curname);
    -			reply(331, "Password [ %s ] required for %s.",
    -			    myskey ? myskey : "error getting challenge",
    -			    curname);
    -		} else
    -#endif
    -			reply(331, "Password required for %s.", curname);
    -#endif /* !USE_PAM */
    -	}
    -
    - cleanup_user:
    -#ifdef LOGIN_CAP
    -	login_close(lc);
    -#endif
    -	/*
    -	 * Delay before reading passwd after first failed
    -	 * attempt to slow down passwd-guessing programs.
    -	 */
    -	if (login_attempts)
    -		sleep((unsigned) login_attempts);
    -
    -	if (class)
    -		free(class);
    -}
    -
    -/*
    - * Determine whether something is to happen (allow access, chroot)
    - * for a user. Each line is a shell-style glob followed by
    - * `yes' or `no'.
    - *
    - * For backward compatibility, `allow' and `deny' are synonymns
    - * for `yes' and `no', respectively.
    - *
    - * Each glob is matched against the username in turn, and the first
    - * match found is used. If no match is found, the result is the
    - * argument `def'. If a match is found but without and explicit
    - * `yes'/`no', the result is the opposite of def.
    - *
    - * If the file doesn't exist at all, the result is the argument
    - * `nofile'
    - *
    - * Any line starting with `#' is considered a comment and ignored.
    - *
    - * Returns 0 if the user is denied, or 1 if they are allowed.
    - *
    - * NOTE: needs struct passwd *pw setup before use.
    - */
    -static int
    -checkuser(const char *fname, const char *name, int def, int nofile,
    -	    char **retclass)
    -{
    -	FILE	*fd;
    -	int	 retval;
    -	char	*word, *perm, *class, *buf, *p;
    -	size_t	 len, line;
    -
    -	retval = def;
    -	if (retclass != NULL)
    -		*retclass = NULL;
    -	if ((fd = fopen(conffilename(fname), "r")) == NULL)
    -		return nofile;
    -
    -	line = 0;
    -	for (;
    -	    (buf = fparseln(fd, &len, &line, NULL, FPARSELN_UNESCCOMM |
    -			    FPARSELN_UNESCCONT | FPARSELN_UNESCESC)) != NULL;
    -	    free(buf), buf = NULL) {
    -		word = perm = class = NULL;
    -		p = buf;
    -		if (len < 1)
    -			continue;
    -		if (p[len - 1] == '\n')
    -			p[--len] = '\0';
    -		if (EMPTYSTR(p))
    -			continue;
    -
    -		NEXTWORD(p, word);
    -		NEXTWORD(p, perm);
    -		NEXTWORD(p, class);
    -		if (EMPTYSTR(word))
    -			continue;
    -		if (!EMPTYSTR(class)) {
    -			if (strcasecmp(class, "all") == 0 ||
    -			    strcasecmp(class, "none") == 0) {
    -				syslog(LOG_WARNING,
    -		"%s line %d: illegal user-defined class `%s' - skipping entry",
    -					    fname, (int)line, class);
    -				continue;
    -			}
    -		}
    -
    -					/* have a host specifier */
    -		if ((p = strchr(word, '@')) != NULL) {
    -			unsigned char	net[16], mask[16], *addr;
    -			int		addrlen, bits, bytes, a;
    -
    -			*p++ = '\0';
    -					/* check against network or CIDR */
    -			memset(net, 0x00, sizeof(net));
    -			if ((bits = inet_net_pton(his_addr.su_family, p, net,
    -			    sizeof(net))) != -1) {
    -#ifdef INET6
    -				if (his_addr.su_family == AF_INET) {
    -#endif
    -					addrlen = 4;
    -					addr = (unsigned char *)&his_addr.su_addr;
    -#ifdef INET6
    -				} else {
    -					addrlen = 16;
    -					addr = (unsigned char *)&his_addr.su_6addr;
    -				}
    -#endif
    -				bytes = bits / 8;
    -				bits = bits % 8;
    -				if (bytes > 0)
    -					memset(mask, 0xFF, bytes);
    -				if (bytes < addrlen)
    -					mask[bytes] = 0xFF << (8 - bits);
    -				if (bytes + 1 < addrlen)
    -					memset(mask + bytes + 1, 0x00,
    -					    addrlen - bytes - 1);
    -				for (a = 0; a < addrlen; a++)
    -					if ((addr[a] & mask[a]) != net[a])
    -						break;
    -				if (a < addrlen)
    -					continue;
    -
    -					/* check against hostname glob */
    -			} else if (fnmatch(p, remotehost, FNM_CASEFOLD) != 0)
    -				continue;
    -		}
    -
    -					/* have a group specifier */
    -		if ((p = strchr(word, ':')) != NULL) {
    -			gid_t	*groups, *ng;
    -			int	 gsize, i, found;
    -
    -			if (pw == NULL)
    -				continue;	/* no match for unknown user */
    -			*p++ = '\0';
    -			groups = NULL;
    -			gsize = 16;
    -			do {
    -				ng = realloc(groups, gsize * sizeof(gid_t));
    -				if (ng == NULL)
    -					fatal(
    -					    "Local resource failure: realloc");
    -				groups = ng;
    -			} while (getgrouplist(pw->pw_name, pw->pw_gid,
    -						groups, &gsize) == -1);
    -			found = 0;
    -			for (i = 0; i < gsize; i++) {
    -				struct group *g;
    -
    -				if ((g = getgrgid(groups[i])) == NULL)
    -					continue;
    -				if (fnmatch(p, g->gr_name, 0) == 0) {
    -					found = 1;
    -					break;
    -				}
    -			}
    -			free(groups);
    -			if (!found)
    -				continue;
    -		}
    -
    -					/* check against username glob */
    -		if (fnmatch(word, name, 0) != 0)
    -			continue;
    -
    -		if (perm != NULL &&
    -		    ((strcasecmp(perm, "allow") == 0) ||
    -		     (strcasecmp(perm, "yes") == 0)))
    -			retval = 1;
    -		else if (perm != NULL &&
    -		    ((strcasecmp(perm, "deny") == 0) ||
    -		     (strcasecmp(perm, "no") == 0)))
    -			retval = 0;
    -		else
    -			retval = !def;
    -		if (!EMPTYSTR(class) && retclass != NULL)
    -			*retclass = ftpd_strdup(class);
    -		free(buf);
    -		break;
    -	}
    -	(void) fclose(fd);
    -	return (retval);
    -}
    -
    -/*
    - * Check if user is allowed by /etc/ftpusers
    - * returns 1 for yes, 0 for no
    - *
    - * NOTE: needs struct passwd *pw setup (for checkuser())
    - */
    -static int
    -checkaccess(const char *name)
    -{
    -
    -	return (checkuser(_NAME_FTPUSERS, name, 1, 0, NULL));
    -}
    -
    -static void
    -login_utmp(const char *line, const char *name, const char *host,
    -    struct sockinet *haddr)
    -{
    -#if defined(SUPPORT_UTMPX) || defined(SUPPORT_UTMP)
    -	struct timeval tv;
    -	(void)gettimeofday(&tv, NULL);
    -#endif
    -#ifdef SUPPORT_UTMPX
    -	if (doutmp) {
    -		(void)memset(&utmpx, 0, sizeof(utmpx));
    -		utmpx.ut_tv = tv;
    -		utmpx.ut_pid = getpid();
    -		utmpx.ut_id[0] = 'f';
    -		utmpx.ut_id[1] = 't';
    -		utmpx.ut_id[2] = 'p';
    -		utmpx.ut_id[3] = '*';
    -		utmpx.ut_type = USER_PROCESS;
    -		(void)strncpy(utmpx.ut_name, name, sizeof(utmpx.ut_name));
    -		(void)strncpy(utmpx.ut_line, line, sizeof(utmpx.ut_line));
    -		(void)strncpy(utmpx.ut_host, host, sizeof(utmpx.ut_host));
    -		(void)memcpy(&utmpx.ut_ss, &haddr->si_su, haddr->su_len);
    -		ftpd_loginx(&utmpx);
    -	}
    -	if (dowtmp)
    -		ftpd_logwtmpx(line, name, host, haddr, 0, USER_PROCESS);
    -#endif
    -#ifdef SUPPORT_UTMP
    -	if (doutmp) {
    -		(void)memset(&utmp, 0, sizeof(utmp));
    -		(void)time(&utmp.ut_time);
    -		(void)strncpy(utmp.ut_name, name, sizeof(utmp.ut_name));
    -		(void)strncpy(utmp.ut_line, line, sizeof(utmp.ut_line));
    -		(void)strncpy(utmp.ut_host, host, sizeof(utmp.ut_host));
    -		ftpd_login(&utmp);
    -	}
    -	if (dowtmp)
    -		ftpd_logwtmp(line, name, host);
    -#endif
    -}
    -
    -static void
    -logout_utmp(void)
    -{
    -#ifdef SUPPORT_UTMPX
    -	int okwtmpx = dowtmp;
    -#endif
    -#ifdef SUPPORT_UTMP
    -	int okwtmp = dowtmp;
    -#endif
    -	if (logged_in) {
    -#ifdef SUPPORT_UTMPX
    -		if (doutmp)
    -			okwtmpx &= ftpd_logoutx(ttyline, 0, DEAD_PROCESS);
    -		if (okwtmpx)
    -			ftpd_logwtmpx(ttyline, "", "", NULL, 0, DEAD_PROCESS);
    -#endif
    -#ifdef SUPPORT_UTMP
    -		if (doutmp)
    -			okwtmp &= ftpd_logout(ttyline);
    -		if (okwtmp)
    -			ftpd_logwtmp(ttyline, "", "");
    -#endif
    -	}
    -}
    -
    -/*
    - * Terminate login as previous user (if any), resetting state;
    - * used when USER command is given or login fails.
    - */
    -static void
    -end_login(void)
    -{
    -#ifdef USE_PAM
    -	int e;
    -#endif
    -	logout_utmp();
    -	show_chdir_messages(-1);		/* flush chdir cache */
    -	if (pw != NULL && pw->pw_passwd != NULL)
    -		memset(pw->pw_passwd, 0, strlen(pw->pw_passwd));
    -	pw = NULL;
    -	logged_in = 0;
    -	askpasswd = 0;
    -	permitted = 0;
    -	quietmessages = 0;
    -	gidcount = 0;
    -	curclass.type = CLASS_REAL;
    -	(void) seteuid((uid_t)0);
    -#ifdef	LOGIN_CAP
    -	setusercontext(NULL, getpwuid(0), 0,
    -		       LOGIN_SETPRIORITY|LOGIN_SETRESOURCES|LOGIN_SETUMASK);
    -#endif
    -#ifdef USE_PAM
    -	if (pamh) {
    -		if ((e = pam_setcred(pamh, PAM_DELETE_CRED)) != PAM_SUCCESS)
    -			syslog(LOG_ERR, "pam_setcred: %s",
    -			    pam_strerror(pamh, e));
    -		if ((e = pam_close_session(pamh,0)) != PAM_SUCCESS)
    -			syslog(LOG_ERR, "pam_close_session: %s",
    -			    pam_strerror(pamh, e));
    -		if ((e = pam_end(pamh, e)) != PAM_SUCCESS)
    -			syslog(LOG_ERR, "pam_end: %s", pam_strerror(pamh, e));
    -		pamh = NULL;
    -	}
    -#endif
    -}
    -
    -void
    -pass(const char *passwd)
    -{
    -	do_pass(0, 0, passwd);
    -}
    -
    -/*
    - * Perform the passwd confirmation and login.
    - *
    - * If pass_checked is zero, confirm passwd is correct, & ignore pass_rval.
    - * This is the traditional PASS implementation.
    - *
    - * If pass_checked is non-zero, use pass_rval and ignore passwd.
    - * This is used by auth_pam() which has already parsed PASS.
    - * This only applies to curclass.type != CLASS_GUEST.
    - */
    -static void
    -do_pass(int pass_checked, int pass_rval, const char *passwd)
    -{
    -	int		 rval;
    -	char		 root[MAXPATHLEN];
    -#ifdef	LOGIN_CAP
    -	login_cap_t *lc = NULL;
    -#endif
    -#ifdef USE_PAM
    -	int e;
    -#endif
    -
    -	rval = 1;
    -
    -	if (logged_in || askpasswd == 0) {
    -		reply(503, "Login with USER first.");
    -		return;
    -	}
    -	askpasswd = 0;
    -	if (curclass.type != CLASS_GUEST) {
    -			/* "ftp" is the only account allowed with no password */
    -		if (pw == NULL) {
    -			rval = 1;	/* failure below */
    -			goto skip;
    -		}
    -		if (pass_checked) {	/* password validated in user() */
    -			rval = pass_rval;
    -			goto skip;
    -		}
    -#ifdef USE_PAM
    -		syslog(LOG_ERR, "do_pass: USE_PAM shouldn't get here");
    -		rval = 1;
    -		goto skip;
    -#endif
    -#if defined(KERBEROS)
    -		if (klogin(pw, "", hostname, (char *)passwd) == 0) {
    -			rval = 0;
    -			goto skip;
    -		}
    -#endif
    -#if defined(KERBEROS5)
    -		if (k5login(pw, "", hostname, (char *)passwd) == 0) {
    -			rval = 0;
    -			goto skip;
    -		}
    -#endif
    -#ifdef SKEY
    -		if (skey_haskey(pw->pw_name) == 0) {
    -			char *p;
    -			int r;
    -
    -			p = ftpd_strdup(passwd);
    -			r = skey_passcheck(pw->pw_name, p);
    -			free(p);
    -			if (r != -1) {
    -				rval = 0;
    -				goto skip;
    -			}
    -		}
    -#endif
    -		if (!sflag)
    -			rval = checkpassword(pw, passwd);
    -		else
    -			rval = 1;
    -
    - skip:
    -
    -			/*
    -			 * If rval > 0, the user failed the authentication check
    -			 * above.  If rval == 0, either Kerberos or local
    -			 * authentication succeeded.
    -			 */
    -		if (rval) {
    -			reply(530, "%s", rval == 2 ? "Password expired." :
    -			    "Login incorrect.");
    -			pfilter_notify(1, rval == 2 ? "exppass" : "badpass");
    -			if (logging) {
    -				syslog(LOG_NOTICE,
    -				    "FTP LOGIN FAILED FROM %s", remoteloghost);
    -				syslog(LOG_AUTHPRIV | LOG_NOTICE,
    -				    "FTP LOGIN FAILED FROM %s, %s",
    -				    remoteloghost, curname);
    -			}
    -			pw = NULL;
    -			if (login_attempts++ >= 5) {
    -				syslog(LOG_NOTICE,
    -				    "repeated login failures from %s",
    -				    remoteloghost);
    -				exit(0);
    -			}
    -			return;
    -		}
    -	}
    -
    -			/* password ok; check if anything else prevents login */
    -	if (! permitted) {
    -		reply(530, "User %s may not use FTP.", pw->pw_name);
    -		if (logging)
    -			syslog(LOG_NOTICE, "FTP LOGIN REFUSED FROM %s, %s",
    -			    remoteloghost, pw->pw_name);
    -		goto bad;
    -	}
    -
    -	login_attempts = 0;		/* this time successful */
    -	if (setegid((gid_t)pw->pw_gid) < 0) {
    -		reply(550, "Can't set gid.");
    -		goto bad;
    -	}
    -#ifdef	LOGIN_CAP
    -	if ((lc = login_getpwclass(pw)) != NULL) {
    -#ifdef notyet
    -		char	remote_ip[NI_MAXHOST];
    -
    -		if (getnameinfo((struct sockaddr *)&his_addr, his_addr.su_len,
    -			remote_ip, sizeof(remote_ip) - 1, NULL, 0,
    -			NI_NUMERICHOST))
    -				*remote_ip = 0;
    -		remote_ip[sizeof(remote_ip) - 1] = 0;
    -		if (!auth_hostok(lc, remotehost, remote_ip)) {
    -			pfilter_notify(1, "bannedhost");
    -			syslog(LOG_INFO|LOG_AUTH,
    -			    "FTP LOGIN FAILED (HOST) as %s: permission denied.",
    -			    pw->pw_name);
    -			reply(530, "Permission denied.");
    -			pw = NULL;
    -			return;
    -		}
    -		if (!auth_timeok(lc, time(NULL))) {
    -			reply(530, "Login not available right now.");
    -			pw = NULL;
    -			return;
    -		}
    -#endif
    -	}
    -	setsid();
    -	setusercontext(lc, pw, 0,
    -		LOGIN_SETLOGIN|LOGIN_SETGROUP|LOGIN_SETPRIORITY|
    -		LOGIN_SETRESOURCES|LOGIN_SETUMASK);
    -#else
    -	(void) initgroups(pw->pw_name, pw->pw_gid);
    -			/* cache groups for cmds.c::matchgroup() */
    -#endif
    -#ifdef USE_PAM
    -	if (pamh) {
    -		if ((e = pam_open_session(pamh, 0)) != PAM_SUCCESS) {
    -			syslog(LOG_ERR, "pam_open_session: %s",
    -			    pam_strerror(pamh, e));
    -		} else if ((e = pam_setcred(pamh, PAM_ESTABLISH_CRED))
    -		    != PAM_SUCCESS) {
    -			syslog(LOG_ERR, "pam_setcred: %s",
    -			    pam_strerror(pamh, e));
    -		}
    -	}
    -#endif
    -	gidcount = getgroups(0, NULL);
    -	if (gidlist)
    -		free(gidlist);
    -	gidlist = malloc(gidcount * sizeof *gidlist);
    -	gidcount = getgroups(gidcount, gidlist);
    -
    -	/* open utmp/wtmp before chroot */
    -	login_utmp(ttyline, pw->pw_name, remotehost, &his_addr);
    -
    -	logged_in = 1;
    -
    -	connections = 1;
    -	if (dopidfile)
    -		count_users();
    -	if (curclass.limit != -1 && connections > curclass.limit) {
    -		if (! EMPTYSTR(curclass.limitfile))
    -			(void)display_file(conffilename(curclass.limitfile),
    -			    530);
    -		reply(530,
    -		    "User %s access denied, connection limit of " LLF
    -		    " reached.",
    -		    pw->pw_name, (LLT)curclass.limit);
    -		syslog(LOG_NOTICE,
    -		    "Maximum connection limit of " LLF
    -		    " for class %s reached, login refused for %s",
    -		    (LLT)curclass.limit, curclass.classname, pw->pw_name);
    -		goto bad;
    -	}
    -
    -	homedir[0] = '/';
    -	switch (curclass.type) {
    -	case CLASS_GUEST:
    -			/*
    -			 * We MUST do a chdir() after the chroot. Otherwise
    -			 * the old current directory will be accessible as "."
    -			 * outside the new root!
    -			 */
    -		format_path(root,
    -		    curclass.chroot ? curclass.chroot :
    -		    anondir ? anondir :
    -		    pw->pw_dir);
    -		format_path(homedir,
    -		    curclass.homedir ? curclass.homedir :
    -		    "/");
    -		if (EMPTYSTR(homedir))
    -			homedir[0] = '/';
    -		if (EMPTYSTR(root) || chroot(root) < 0) {
    -			syslog(LOG_NOTICE,
    -			    "GUEST user %s: can't chroot to %s: %m",
    -			    pw->pw_name, root);
    -			goto bad_guest;
    -		}
    -		if (chdir(homedir) < 0) {
    -			syslog(LOG_NOTICE,
    -			    "GUEST user %s: can't chdir to %s: %m",
    -			    pw->pw_name, homedir);
    - bad_guest:
    -			reply(550, "Can't set guest privileges.");
    -			goto bad;
    -		}
    -		break;
    -	case CLASS_CHROOT:
    -		format_path(root,
    -		    curclass.chroot ? curclass.chroot :
    -		    pw->pw_dir);
    -		format_path(homedir,
    -		    curclass.homedir ? curclass.homedir :
    -		    "/");
    -		if (EMPTYSTR(homedir))
    -			homedir[0] = '/';
    -		if (EMPTYSTR(root) || chroot(root) < 0) {
    -			syslog(LOG_NOTICE,
    -			    "CHROOT user %s: can't chroot to %s: %m",
    -			    pw->pw_name, root);
    -			goto bad_chroot;
    -		}
    -		if (chdir(homedir) < 0) {
    -			syslog(LOG_NOTICE,
    -			    "CHROOT user %s: can't chdir to %s: %m",
    -			    pw->pw_name, homedir);
    - bad_chroot:
    -			reply(550, "Can't change root.");
    -			goto bad;
    -		}
    -		break;
    -	case CLASS_REAL:
    -			/* only chroot REAL if explicitly requested */
    -		if (! EMPTYSTR(curclass.chroot)) {
    -			format_path(root, curclass.chroot);
    -			if (EMPTYSTR(root) || chroot(root) < 0) {
    -				syslog(LOG_NOTICE,
    -				    "REAL user %s: can't chroot to %s: %m",
    -				    pw->pw_name, root);
    -				goto bad_chroot;
    -			}
    -		}
    -		format_path(homedir,
    -		    curclass.homedir ? curclass.homedir :
    -		    pw->pw_dir);
    -		if (EMPTYSTR(homedir) || chdir(homedir) < 0) {
    -			if (chdir("/") < 0) {
    -				syslog(LOG_NOTICE,
    -				    "REAL user %s: can't chdir to %s: %m",
    -				    pw->pw_name,
    -				    !EMPTYSTR(homedir) ?  homedir : "/");
    -				reply(530,
    -				    "User %s: can't change directory to %s.",
    -				    pw->pw_name,
    -				    !EMPTYSTR(homedir) ? homedir : "/");
    -				goto bad;
    -			} else {
    -				reply(-230,
    -				    "No directory! Logging in with home=/");
    -				homedir[0] = '/';
    -			}
    -		}
    -		break;
    -	}
    -#ifndef LOGIN_CAP
    -	setsid();
    -#if !defined(__minix)
    -	setlogin(pw->pw_name);
    -#endif /* !defined(__minix) */
    -#endif
    -	if (dropprivs ||
    -	    (curclass.type != CLASS_REAL && 
    -	    ntohs(ctrl_addr.su_port) > IPPORT_RESERVED + 1)) {
    -		dropprivs++;
    -		if (setgid((gid_t)pw->pw_gid) < 0) {
    -			reply(550, "Can't set gid.");
    -			goto bad;
    -		}
    -		if (setuid((uid_t)pw->pw_uid) < 0) {
    -			reply(550, "Can't set uid.");
    -			goto bad;
    -		}
    -	} else {
    -		if (seteuid((uid_t)pw->pw_uid) < 0) {
    -			reply(550, "Can't set uid.");
    -			goto bad;
    -		}
    -	}
    -	setenv("HOME", homedir, 1);
    -
    -	if (curclass.type == CLASS_GUEST && passwd[0] == '-')
    -		quietmessages = 1;
    -
    -			/*
    -			 * Display a login message, if it exists.
    -			 * N.B. reply(230,) must follow the message.
    -			 */
    -	if (! EMPTYSTR(curclass.motd))
    -		(void)display_file(conffilename(curclass.motd), 230);
    -	show_chdir_messages(230);
    -	if (curclass.type == CLASS_GUEST) {
    -		char *p;
    -
    -		reply(230, "Guest login ok, access restrictions apply.");
    -#if defined(HAVE_SETPROCTITLE)
    -		snprintf(proctitle, sizeof(proctitle),
    -		    "%s: anonymous/%s", remotehost, passwd);
    -		setproctitle("%s", proctitle);
    -#endif /* defined(HAVE_SETPROCTITLE) */
    -		if (logging)
    -			syslog(LOG_INFO,
    -			"ANONYMOUS FTP LOGIN FROM %s, %s (class: %s, type: %s)",
    -			    remoteloghost, passwd,
    -			    curclass.classname, CURCLASSTYPE);
    -			/* store guest password reply into pw_passwd */
    -		REASSIGN(pw->pw_passwd, ftpd_strdup(passwd));
    -		for (p = pw->pw_passwd; *p; p++)
    -			if (!isgraph((unsigned char)*p))
    -				*p = '_';
    -	} else {
    -		reply(230, "User %s logged in.", pw->pw_name);
    -#if defined(HAVE_SETPROCTITLE)
    -		snprintf(proctitle, sizeof(proctitle),
    -		    "%s: %s", remotehost, pw->pw_name);
    -		setproctitle("%s", proctitle);
    -#endif /* defined(HAVE_SETPROCTITLE) */
    -		if (logging)
    -			syslog(LOG_INFO,
    -			    "FTP LOGIN FROM %s as %s (class: %s, type: %s)",
    -			    remoteloghost, pw->pw_name,
    -			    curclass.classname, CURCLASSTYPE);
    -	}
    -	(void) umask(curclass.umask);
    -#ifdef	LOGIN_CAP
    -	login_close(lc);
    -#endif
    -	return;
    -
    - bad:
    -#ifdef	LOGIN_CAP
    -	login_close(lc);
    -#endif
    -			/* Forget all about it... */
    -	end_login();
    -}
    -
    -void
    -retrieve(const char *argv[], const char *name)
    -{
    -	FILE *fin, *dout;
    -	struct stat st;
    -	int (*closefunc)(FILE *) = NULL;
    -	int dolog, sendrv, closerv, stderrfd, isconversion, isdata, isls;
    -	struct timeval start, finish, td, *tdp;
    -	struct rusage rusage_before, rusage_after;
    -	const char *dispname;
    -	const char *error;
    -
    -	sendrv = closerv = stderrfd = -1;
    -	isconversion = isdata = isls = dolog = 0;
    -	tdp = NULL;
    -	dispname = name;
    -	fin = dout = NULL;
    -	error = NULL;
    -	if (argv == NULL) {		/* if not running a command ... */
    -		dolog = 1;
    -		isdata = 1;
    -		fin = fopen(name, "r");
    -		closefunc = fclose;
    -		if (fin == NULL)	/* doesn't exist?; try a conversion */
    -			argv = do_conversion(name);
    -		if (argv != NULL) {
    -			isconversion++;
    -			syslog(LOG_DEBUG, "get command: '%s' on '%s'",
    -			    argv[0], name);
    -		}
    -	}
    -	if (argv != NULL) {
    -		char temp[MAXPATHLEN];
    -
    -		if (strcmp(argv[0], INTERNAL_LS) == 0) {
    -			isls = 1;
    -			stderrfd = -1;
    -		} else {
    -			(void)snprintf(temp, sizeof(temp), "%s", TMPFILE);
    -			stderrfd = mkstemp(temp);
    -			if (stderrfd != -1)
    -				(void)unlink(temp);
    -		}
    -		dispname = argv[0];
    -		fin = ftpd_popen(argv, "r", stderrfd);
    -		closefunc = ftpd_pclose;
    -		st.st_size = -1;
    -		st.st_blksize = BUFSIZ;
    -	}
    -	if (fin == NULL) {
    -		if (errno != 0) {
    -			perror_reply(550, dispname);
    -			if (dolog)
    -				logxfer("get", -1, name, NULL, NULL,
    -				    strerror(errno));
    -		}
    -		goto cleanupretrieve;
    -	}
    -	byte_count = -1;
    -	if (argv == NULL
    -	    && (fstat(fileno(fin), &st) < 0 || !S_ISREG(st.st_mode))) {
    -		error = "Not a plain file";
    -		reply(550, "%s: %s.", dispname, error);
    -		goto done;
    -	}
    -	if (restart_point) {
    -		if (type == TYPE_A) {
    -			off_t i;
    -			int c;
    -
    -			for (i = 0; i < restart_point; i++) {
    -				if ((c=getc(fin)) == EOF) {
    -					error = strerror(errno);
    -					perror_reply(550, dispname);
    -					goto done;
    -				}
    -				if (c == '\n')
    -					i++;
    -			}
    -		} else if (lseek(fileno(fin), restart_point, SEEK_SET) < 0) {
    -			error = strerror(errno);
    -			perror_reply(550, dispname);
    -			goto done;
    -		}
    -	}
    -	dout = dataconn(dispname, st.st_size, "w");
    -	if (dout == NULL)
    -		goto done;
    -
    -	(void)getrusage(RUSAGE_SELF, &rusage_before);
    -	(void)gettimeofday(&start, NULL);
    -	sendrv = send_data(fin, dout, &st, isdata);
    -	(void)gettimeofday(&finish, NULL);
    -	(void)getrusage(RUSAGE_SELF, &rusage_after);
    -	closedataconn(dout);		/* close now to affect timing stats */
    -	timersub(&finish, &start, &td);
    -	tdp = &td;
    - done:
    -	if (dolog) {
    -		logxfer("get", byte_count, name, NULL, tdp, error);
    -		if (tdp != NULL)
    -			logrusage(&rusage_before, &rusage_after);
    -	}
    -	closerv = (*closefunc)(fin);
    -	if (sendrv == 0) {
    -		FILE *errf;
    -		struct stat sb;
    -
    -		if (!isls && argv != NULL && closerv != 0) {
    -			reply(-226,
    -			    "Command returned an exit status of %d",
    -			    closerv);
    -			if (isconversion)
    -				syslog(LOG_WARNING,
    -				    "retrieve command: '%s' returned %d",
    -				    argv[0], closerv);
    -		}
    -		if (!isls && argv != NULL && stderrfd != -1 &&
    -		    (fstat(stderrfd, &sb) == 0) && sb.st_size > 0 &&
    -		    ((errf = fdopen(stderrfd, "r")) != NULL)) {
    -			char *cp, line[LINE_MAX];
    -
    -			reply(-226, "Command error messages:");
    -			rewind(errf);
    -			while (fgets(line, sizeof(line), errf) != NULL) {
    -				if ((cp = strchr(line, '\n')) != NULL)
    -					*cp = '\0';
    -				reply(0, "  %s", line);
    -			}
    -			(void) fflush(stdout);
    -			(void) fclose(errf);
    -				/* a reply(226,) must follow */
    -		}
    -		reply(226, "Transfer complete.");
    -	}
    - cleanupretrieve:
    -	if (stderrfd != -1)
    -		(void)close(stderrfd);
    -	if (isconversion)
    -		free(argv);
    -}
    -
    -void
    -store(const char *name, const char *fmode, int unique)
    -{
    -	FILE *fout, *din;
    -	struct stat st;
    -	int (*closefunc)(FILE *);
    -	struct timeval start, finish, td, *tdp;
    -	const char *desc, *error;
    -
    -	din = NULL;
    -	desc = (*fmode == 'w') ? "put" : "append";
    -	error = NULL;
    -	if (unique && stat(name, &st) == 0 &&
    -	    (name = gunique(name)) == NULL) {
    -		logxfer(desc, -1, name, NULL, NULL,
    -		    "cannot create unique file");
    -		goto cleanupstore;
    -	}
    -
    -	if (restart_point)
    -		fmode = "r+";
    -	fout = fopen(name, fmode);
    -	closefunc = fclose;
    -	tdp = NULL;
    -	if (fout == NULL) {
    -		perror_reply(553, name);
    -		logxfer(desc, -1, name, NULL, NULL, strerror(errno));
    -		goto cleanupstore;
    -	}
    -	byte_count = -1;
    -	if (restart_point) {
    -		if (type == TYPE_A) {
    -			off_t i;
    -			int c;
    -
    -			for (i = 0; i < restart_point; i++) {
    -				if ((c=getc(fout)) == EOF) {
    -					error = strerror(errno);
    -					perror_reply(550, name);
    -					goto done;
    -				}
    -				if (c == '\n')
    -					i++;
    -			}
    -			/*
    -			 * We must do this seek to "current" position
    -			 * because we are changing from reading to
    -			 * writing.
    -			 */
    -			if (fseek(fout, 0L, SEEK_CUR) < 0) {
    -				error = strerror(errno);
    -				perror_reply(550, name);
    -				goto done;
    -			}
    -		} else if (lseek(fileno(fout), restart_point, SEEK_SET) < 0) {
    -			error = strerror(errno);
    -			perror_reply(550, name);
    -			goto done;
    -		}
    -	}
    -	din = dataconn(name, (off_t)-1, "r");
    -	if (din == NULL)
    -		goto done;
    -	(void)gettimeofday(&start, NULL);
    -	if (receive_data(din, fout) == 0) {
    -		if (unique)
    -			reply(226, "Transfer complete (unique file name:%s).",
    -			    name);
    -		else
    -			reply(226, "Transfer complete.");
    -	}
    -	(void)gettimeofday(&finish, NULL);
    -	closedataconn(din);		/* close now to affect timing stats */
    -	timersub(&finish, &start, &td);
    -	tdp = &td;
    - done:
    -	logxfer(desc, byte_count, name, NULL, tdp, error);
    -	(*closefunc)(fout);
    - cleanupstore:
    -	;
    -}
    -
    -static FILE *
    -getdatasock(const char *fmode)
    -{
    -	int		on, s, t, tries;
    -	in_port_t	port;
    -
    -	on = 1;
    -	if (data >= 0)
    -		return (fdopen(data, fmode));
    -	if (! dropprivs)
    -		(void) seteuid((uid_t)0);
    -	s = socket(ctrl_addr.su_family, SOCK_STREAM, 0);
    -	if (s < 0)
    -		goto bad;
    -	if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,
    -	    (char *) &on, sizeof(on)) < 0)
    -		goto bad;
    -	if (setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,
    -	    (char *) &on, sizeof(on)) < 0)
    -		goto bad;
    -			/* anchor socket to avoid multi-homing problems */
    -	data_source = ctrl_addr;
    -			/*
    -			 * By default source port for PORT connctions is
    -			 * ctrlport-1 (see RFC959 section 5.2).
    -			 * However, if privs have been dropped and that
    -			 * would be < IPPORT_RESERVED, use a random port
    -			 * instead.
    -			 */
    -	if (dataport)
    -		port = dataport;
    -	else
    -		port = ntohs(ctrl_addr.su_port) - 1;
    -	if (dropprivs && port < IPPORT_RESERVED)
    -		port = 0;		/* use random port */
    -	data_source.su_port = htons(port);
    -
    -	for (tries = 1; ; tries++) {
    -		if (bind(s, (struct sockaddr *)&data_source.si_su,
    -		    data_source.su_len) >= 0)
    -			break;
    -		if (errno != EADDRINUSE || tries > 10)
    -			goto bad;
    -		sleep(tries);
    -	}
    -	if (! dropprivs)
    -		(void) seteuid((uid_t)pw->pw_uid);
    -#ifdef IP_TOS
    -	if (!mapped && ctrl_addr.su_family == AF_INET) {
    -		on = IPTOS_THROUGHPUT;
    -		if (setsockopt(s, IPPROTO_IP, IP_TOS, (char *)&on,
    -			       sizeof(int)) < 0)
    -			syslog(LOG_WARNING, "setsockopt (IP_TOS): %m");
    -	}
    -#endif
    -	return (fdopen(s, fmode));
    - bad:
    -		/* Return the real value of errno (close may change it) */
    -	t = errno;
    -	if (! dropprivs)
    -		(void) seteuid((uid_t)pw->pw_uid);
    -	(void) close(s);
    -	errno = t;
    -	return (NULL);
    -}
    -
    -FILE *
    -dataconn(const char *name, off_t size, const char *fmode)
    -{
    -	char sizebuf[32];
    -	FILE *file;
    -	int retry, tos, keepalive, conerrno;
    -
    -	file_size = size;
    -	byte_count = 0;
    -	if (size != (off_t) -1)
    -		(void)snprintf(sizebuf, sizeof(sizebuf), " (" LLF " byte%s)",
    -		    (LLT)size, PLURAL(size));
    -	else
    -		sizebuf[0] = '\0';
    -	if (pdata >= 0) {
    -		struct sockinet from;
    -		int s;
    -		socklen_t fromlen = sizeof(from.su_len);
    -
    -		(void) alarm(curclass.timeout);
    -		s = accept(pdata, (struct sockaddr *)&from.si_su, &fromlen);
    -		(void) alarm(0);
    -		if (s < 0) {
    -			reply(425, "Can't open data connection.");
    -			(void) close(pdata);
    -			pdata = -1;
    -			return (NULL);
    -		}
    -		(void) close(pdata);
    -		pdata = s;
    -		switch (from.su_family) {
    -		case AF_INET:
    -#ifdef IP_TOS
    -			if (!mapped) {
    -				tos = IPTOS_THROUGHPUT;
    -				(void) setsockopt(s, IPPROTO_IP, IP_TOS,
    -				    (char *)&tos, sizeof(int));
    -			}
    -			break;
    -#endif
    -		}
    -		/* Set keepalives on the socket to detect dropped conns. */
    -#ifdef SO_KEEPALIVE
    -		keepalive = 1;
    -		(void) setsockopt(s, SOL_SOCKET, SO_KEEPALIVE,
    -		    (char *)&keepalive, sizeof(int));
    -#endif
    -		reply(150, "Opening %s mode data connection for '%s'%s.",
    -		     type == TYPE_A ? "ASCII" : "BINARY", name, sizebuf);
    -		return (fdopen(pdata, fmode));
    -	}
    -	if (data >= 0) {
    -		reply(125, "Using existing data connection for '%s'%s.",
    -		    name, sizebuf);
    -		usedefault = 1;
    -		return (fdopen(data, fmode));
    -	}
    -	if (usedefault)
    -		data_dest = his_addr;
    -	usedefault = 1;
    -	retry = conerrno = 0;
    -	do {
    -		file = getdatasock(fmode);
    -		if (file == NULL) {
    -			char hbuf[NI_MAXHOST];
    -			char pbuf[NI_MAXSERV];
    -
    -			if (getnameinfo((struct sockaddr *)&data_source.si_su,
    -			    data_source.su_len, hbuf, sizeof(hbuf), pbuf,
    -			    sizeof(pbuf), NI_NUMERICHOST | NI_NUMERICSERV))
    -				strlcpy(hbuf, "?", sizeof(hbuf));
    -			reply(425, "Can't create data socket (%s,%s): %s.",
    -			      hbuf, pbuf, strerror(errno));
    -			return (NULL);
    -		}
    -		data = fileno(file);
    -		conerrno = 0;
    -		if (connect(data, (struct sockaddr *)&data_dest.si_su,
    -		    data_dest.su_len) == 0)
    -			break;
    -		conerrno = errno;
    -		(void) fclose(file);
    -		file = NULL;
    -		data = -1;
    -		if (conerrno == EADDRINUSE) {
    -			sleep((unsigned) swaitint);
    -			retry += swaitint;
    -		} else {
    -			break;
    -		}
    -	} while (retry <= swaitmax);
    -	if (conerrno != 0) {
    -		perror_reply(425, "Can't build data connection");
    -		return (NULL);
    -	}
    -	reply(150, "Opening %s mode data connection for '%s'%s.",
    -	     type == TYPE_A ? "ASCII" : "BINARY", name, sizebuf);
    -	return (file);
    -}
    -
    -void
    -closedataconn(FILE *fd)
    -{
    -
    -	if (fd == NULL)
    -		return;
    -	(void)fclose(fd);
    -	data = -1;
    -	if (pdata >= 0)
    -		(void)close(pdata);
    -	pdata = -1;
    -}
    -
    -int
    -write_data(int fd, char *buf, size_t size, off_t *bufrem,
    -    struct timeval *then, int isdata)
    -{
    -	struct timeval now, td;
    -	ssize_t c;
    -
    -	while (size > 0) {
    -		c = size;
    -		if (curclass.writesize) {
    -			if (curclass.writesize < c)
    -				c = curclass.writesize;
    -		}
    -		if (curclass.rateget) {
    -			if (*bufrem < c)
    -				c = *bufrem;
    -		}
    -		(void) alarm(curclass.timeout);
    -		c = write(fd, buf, c);
    -		if (c <= 0)
    -			return (1);
    -		buf += c;
    -		size -= c;
    -		byte_count += c;
    -		if (isdata) {
    -			total_data_out += c;
    -			total_data += c;
    -		}
    -		total_bytes_out += c;
    -		total_bytes += c;
    -		if (curclass.rateget) {
    -			*bufrem -= c;
    -			if (*bufrem == 0) {
    -				(void)gettimeofday(&now, NULL);
    -				timersub(&now, then, &td);
    -				if (td.tv_sec == 0) {
    -					usleep(1000000 - td.tv_usec);
    -					(void)gettimeofday(then, NULL);
    -				} else
    -					*then = now;
    -				*bufrem = curclass.rateget;
    -			}
    -		}
    -	}
    -	return (0);
    -}
    -
    -static enum send_status
    -send_data_with_read(int filefd, int netfd, const struct stat *st, int isdata)
    -{
    -	struct timeval then;
    -	off_t bufrem;
    -	ssize_t readsize;
    -	char *buf;
    -	int c, error;
    -
    -	if (curclass.readsize > 0)
    -		readsize = curclass.readsize;
    -	else
    -		readsize = st->st_blksize;
    -	if ((buf = malloc(readsize)) == NULL) {
    -		perror_reply(451, "Local resource failure: malloc");
    -		return (SS_NO_TRANSFER);
    -	}
    -
    -	if (curclass.rateget) {
    -		bufrem = curclass.rateget;
    -		(void)gettimeofday(&then, NULL);
    -	} else
    -		bufrem = readsize;
    -	for (;;) {
    -		(void) alarm(curclass.timeout);
    -		c = read(filefd, buf, readsize);
    -		if (c == 0)
    -			error = SS_SUCCESS;
    -		else if (c < 0)
    -			error = SS_FILE_ERROR;
    -		else if (write_data(netfd, buf, c, &bufrem, &then, isdata))
    -			error = SS_DATA_ERROR;
    -		else if (urgflag && handleoobcmd())
    -			error = SS_ABORTED;
    -		else
    -			continue;
    -
    -		free(buf);
    -		return (error);
    -	}
    -}
    -
    -static enum send_status
    -send_data_with_mmap(int filefd, int netfd, const struct stat *st, int isdata)
    -{
    -	struct timeval then;
    -	off_t bufrem, filesize, off, origoff;
    -	ssize_t mapsize, winsize;
    -	int error, sendbufsize, sendlowat;
    -	void *win;
    -
    -	bufrem = 0;
    -	if (curclass.sendbufsize) {
    -		sendbufsize = curclass.sendbufsize;
    -		if (setsockopt(netfd, SOL_SOCKET, SO_SNDBUF,
    -		    &sendbufsize, sizeof(int)) == -1)
    -			syslog(LOG_WARNING, "setsockopt(SO_SNDBUF, %d): %m",
    -			    sendbufsize);
    -	}
    -
    -	if (curclass.sendlowat) {
    -		sendlowat = curclass.sendlowat;
    -		if (setsockopt(netfd, SOL_SOCKET, SO_SNDLOWAT,
    -		    &sendlowat, sizeof(int)) == -1)
    -			syslog(LOG_WARNING, "setsockopt(SO_SNDLOWAT, %d): %m",
    -			    sendlowat);
    -	}
    -
    -	winsize = curclass.mmapsize;
    -	filesize = st->st_size;
    -	if (ftpd_debug)
    -		syslog(LOG_INFO, "mmapsize = " LLF ", writesize = " LLF,
    -		    (LLT)winsize, (LLT)curclass.writesize);
    -	if (winsize <= 0)
    -		goto try_read;
    -
    -	off = lseek(filefd, (off_t)0, SEEK_CUR);
    -	if (off == -1)
    -		goto try_read;
    -
    -	origoff = off;
    -	if (curclass.rateget) {
    -		bufrem = curclass.rateget;
    -		(void)gettimeofday(&then, NULL);
    -	} else
    -		bufrem = winsize;
    -	while (1) {
    -		mapsize = MIN(filesize - off, winsize);
    -		if (mapsize == 0)
    -			break;
    -		win = mmap(NULL, mapsize, PROT_READ,
    -		    MAP_FILE|MAP_SHARED, filefd, off);
    -		if (win == MAP_FAILED) {
    -			if (off == origoff)
    -				goto try_read;
    -			return (SS_FILE_ERROR);
    -		}
    -#if !defined(__minix)
    -		(void) madvise(win, mapsize, MADV_SEQUENTIAL);
    -#endif /* !defined(__minix) */
    -		error = write_data(netfd, win, mapsize, &bufrem, &then,
    -		    isdata);
    -#if !defined(__minix)
    -		(void) madvise(win, mapsize, MADV_DONTNEED);
    -#endif /* !defined(__minix) */
    -		munmap(win, mapsize);
    -		if (urgflag && handleoobcmd())
    -			return (SS_ABORTED);
    -		if (error)
    -			return (SS_DATA_ERROR);
    -		off += mapsize;
    -	}
    -	return (SS_SUCCESS);
    -
    - try_read:
    -	return (send_data_with_read(filefd, netfd, st, isdata));
    -}
    -
    -/*
    - * Transfer the contents of "instr" to "outstr" peer using the appropriate
    - * encapsulation of the data subject to Mode, Structure, and Type.
    - *
    - * NB: Form isn't handled.
    - */
    -static int
    -send_data(FILE *instr, FILE *outstr, const struct stat *st, int isdata)
    -{
    -	int	 c, filefd, netfd, rval;
    -
    -	urgflag = 0;
    -	transflag = 1;
    -	rval = -1;
    -
    -	switch (type) {
    -
    -	case TYPE_A:
    - /* XXXLUKEM: rate limit ascii send (get) */
    -		(void) alarm(curclass.timeout);
    -		while ((c = getc(instr)) != EOF) {
    -			if (urgflag && handleoobcmd())
    -				goto cleanup_send_data;
    -			byte_count++;
    -			if (c == '\n') {
    -				if (ferror(outstr))
    -					goto data_err;
    -				(void) putc('\r', outstr);
    -				if (isdata) {
    -					total_data_out++;
    -					total_data++;
    -				}
    -				total_bytes_out++;
    -				total_bytes++;
    -			}
    -			(void) putc(c, outstr);
    -			if (isdata) {
    -				total_data_out++;
    -				total_data++;
    -			}
    -			total_bytes_out++;
    -			total_bytes++;
    -			if ((byte_count % 4096) == 0)
    -				(void) alarm(curclass.timeout);
    -		}
    -		(void) alarm(0);
    -		fflush(outstr);
    -		if (ferror(instr))
    -			goto file_err;
    -		if (ferror(outstr))
    -			goto data_err;
    -		rval = 0;
    -		goto cleanup_send_data;
    -
    -	case TYPE_I:
    -	case TYPE_L:
    -		filefd = fileno(instr);
    -		netfd = fileno(outstr);
    -		switch (send_data_with_mmap(filefd, netfd, st, isdata)) {
    -
    -		case SS_SUCCESS:
    -			break;
    -
    -		case SS_ABORTED:
    -		case SS_NO_TRANSFER:
    -			goto cleanup_send_data;
    -
    -		case SS_FILE_ERROR:
    -			goto file_err;
    -
    -		case SS_DATA_ERROR:
    -			goto data_err;
    -		}
    -		rval = 0;
    -		goto cleanup_send_data;
    -
    -	default:
    -		reply(550, "Unimplemented TYPE %d in send_data", type);
    -		goto cleanup_send_data;
    -	}
    -
    - data_err:
    -	(void) alarm(0);
    -	perror_reply(426, "Data connection");
    -	goto cleanup_send_data;
    -
    - file_err:
    -	(void) alarm(0);
    -	perror_reply(551, "Error on input file");
    -	goto cleanup_send_data;
    -
    - cleanup_send_data:
    -	(void) alarm(0);
    -	transflag = 0;
    -	urgflag = 0;
    -	if (isdata) {
    -		total_files_out++;
    -		total_files++;
    -	}
    -	total_xfers_out++;
    -	total_xfers++;
    -	return (rval);
    -}
    -
    -/*
    - * Transfer data from peer to "outstr" using the appropriate encapulation of
    - * the data subject to Mode, Structure, and Type.
    - *
    - * N.B.: Form isn't handled.
    - */
    -static int
    -receive_data(FILE *instr, FILE *outstr)
    -{
    -	int	c, netfd, filefd, rval;
    -	int	volatile bare_lfs;
    -	off_t	byteswritten;
    -	char	*buf;
    -	ssize_t	readsize;
    -	struct sigaction sa, sa_saved;
    -	struct stat st;
    -
    -	memset(&sa, 0, sizeof(sa));
    -	sigfillset(&sa.sa_mask);
    -	sa.sa_flags = SA_RESTART;
    -	sa.sa_handler = lostconn;
    -	(void) sigaction(SIGALRM, &sa, &sa_saved);
    -
    -	bare_lfs = 0;
    -	urgflag = 0;
    -	transflag = 1;
    -	rval = -1;
    -	byteswritten = 0;
    -	buf = NULL;
    -
    -#define FILESIZECHECK(x) \
    -			do { \
    -				if (curclass.maxfilesize != -1 && \
    -				    (x) > curclass.maxfilesize) { \
    -					errno = EFBIG; \
    -					goto file_err; \
    -				} \
    -			} while (0)
    -
    -	switch (type) {
    -
    -	case TYPE_I:
    -	case TYPE_L:
    -		netfd = fileno(instr);
    -		filefd = fileno(outstr);
    -		(void) alarm(curclass.timeout);
    -		if (curclass.readsize)
    -			readsize = curclass.readsize;
    -		else if (fstat(filefd, &st) != -1)
    -			readsize = (ssize_t)st.st_blksize;
    -		else
    -			readsize = BUFSIZ;
    -		if ((buf = malloc(readsize)) == NULL) {
    -			perror_reply(451, "Local resource failure: malloc");
    -			goto cleanup_recv_data;
    -		}
    -		if (curclass.rateput) {
    -			while (1) {
    -				int d;
    -				struct timeval then, now, td;
    -				off_t bufrem;
    -
    -				(void)gettimeofday(&then, NULL);
    -				errno = c = d = 0;
    -				for (bufrem = curclass.rateput; bufrem > 0; ) {
    -					if ((c = read(netfd, buf,
    -					    MIN(readsize, bufrem))) <= 0)
    -						goto recvdone;
    -					if (urgflag && handleoobcmd())
    -						goto cleanup_recv_data;
    -					FILESIZECHECK(byte_count + c);
    -					if ((d = write(filefd, buf, c)) != c)
    -						goto file_err;
    -					(void) alarm(curclass.timeout);
    -					bufrem -= c;
    -					byte_count += c;
    -					total_data_in += c;
    -					total_data += c;
    -					total_bytes_in += c;
    -					total_bytes += c;
    -				}
    -				(void)gettimeofday(&now, NULL);
    -				timersub(&now, &then, &td);
    -				if (td.tv_sec == 0)
    -					usleep(1000000 - td.tv_usec);
    -			}
    -		} else {
    -			while ((c = read(netfd, buf, readsize)) > 0) {
    -				if (urgflag && handleoobcmd())
    -					goto cleanup_recv_data;
    -				FILESIZECHECK(byte_count + c);
    -				if (write(filefd, buf, c) != c)
    -					goto file_err;
    -				(void) alarm(curclass.timeout);
    -				byte_count += c;
    -				total_data_in += c;
    -				total_data += c;
    -				total_bytes_in += c;
    -				total_bytes += c;
    -			}
    -		}
    - recvdone:
    -		if (c < 0)
    -			goto data_err;
    -		rval = 0;
    -		goto cleanup_recv_data;
    -
    -	case TYPE_E:
    -		reply(553, "TYPE E not implemented.");
    -		goto cleanup_recv_data;
    -
    -	case TYPE_A:
    -		(void) alarm(curclass.timeout);
    - /* XXXLUKEM: rate limit ascii receive (put) */
    -		while ((c = getc(instr)) != EOF) {
    -			if (urgflag && handleoobcmd())
    -				goto cleanup_recv_data;
    -			byte_count++;
    -			total_data_in++;
    -			total_data++;
    -			total_bytes_in++;
    -			total_bytes++;
    -			if ((byte_count % 4096) == 0)
    -				(void) alarm(curclass.timeout);
    -			if (c == '\n')
    -				bare_lfs++;
    -			while (c == '\r') {
    -				if (ferror(outstr))
    -					goto data_err;
    -				if ((c = getc(instr)) != '\n') {
    -					byte_count++;
    -					total_data_in++;
    -					total_data++;
    -					total_bytes_in++;
    -					total_bytes++;
    -					if ((byte_count % 4096) == 0)
    -						(void) alarm(curclass.timeout);
    -					byteswritten++;
    -					FILESIZECHECK(byteswritten);
    -					(void) putc ('\r', outstr);
    -					if (c == '\0' || c == EOF)
    -						goto contin2;
    -				}
    -			}
    -			byteswritten++;
    -			FILESIZECHECK(byteswritten);
    -			(void) putc(c, outstr);
    - contin2:	;
    -		}
    -		(void) alarm(0);
    -		fflush(outstr);
    -		if (ferror(instr))
    -			goto data_err;
    -		if (ferror(outstr))
    -			goto file_err;
    -		if (bare_lfs) {
    -			reply(-226,
    -			    "WARNING! %d bare linefeeds received in ASCII mode",
    -			    bare_lfs);
    -			reply(0, "File may not have transferred correctly.");
    -		}
    -		rval = 0;
    -		goto cleanup_recv_data;
    -
    -	default:
    -		reply(550, "Unimplemented TYPE %d in receive_data", type);
    -		goto cleanup_recv_data;
    -	}
    -#undef FILESIZECHECK
    -
    - data_err:
    -	(void) alarm(0);
    -	perror_reply(426, "Data Connection");
    -	goto cleanup_recv_data;
    -
    - file_err:
    -	(void) alarm(0);
    -	perror_reply(452, "Error writing file");
    -	goto cleanup_recv_data;
    -
    - cleanup_recv_data:
    -	(void) alarm(0);
    -	(void) sigaction(SIGALRM, &sa_saved, NULL);
    -	if (buf)
    -		free(buf);
    -	transflag = 0;
    -	urgflag = 0;
    -	total_files_in++;
    -	total_files++;
    -	total_xfers_in++;
    -	total_xfers++;
    -	return (rval);
    -}
    -
    -void
    -statcmd(void)
    -{
    -	struct sockinet *su = NULL;
    -	static char hbuf[NI_MAXHOST], sbuf[NI_MAXSERV];
    -	unsigned char *a, *p;
    -	int ispassive, af;
    -	off_t otbi, otbo, otb;
    -
    -	a = p = NULL;
    -
    -	reply(-211, "%s FTP server status:", hostname);
    -	reply(0, "Version: %s", EMPTYSTR(version) ? "" : version);
    -	hbuf[0] = '\0';
    -	if (!getnameinfo((struct sockaddr *)&his_addr.si_su, his_addr.su_len,
    -			hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST)
    -	    && strcmp(remotehost, hbuf) != 0)
    -		reply(0, "Connected to %s (%s)", remotehost, hbuf);
    -	else
    -		reply(0, "Connected to %s", remotehost);
    -
    -	if (logged_in) {
    -		if (curclass.type == CLASS_GUEST)
    -			reply(0, "Logged in anonymously");
    -		else
    -			reply(0, "Logged in as %s%s", pw->pw_name,
    -			    curclass.type == CLASS_CHROOT ? " (chroot)" : "");
    -	} else if (askpasswd)
    -		reply(0, "Waiting for password");
    -	else
    -		reply(0, "Waiting for user name");
    -	cprintf(stdout, "    TYPE: %s", typenames[type]);
    -	if (type == TYPE_A || type == TYPE_E)
    -		cprintf(stdout, ", FORM: %s", formnames[form]);
    -	if (type == TYPE_L) {
    -#if NBBY == 8
    -		cprintf(stdout, " %d", NBBY);
    -#else
    -			/* XXX: `bytesize' needs to be defined in this case */
    -		cprintf(stdout, " %d", bytesize);
    -#endif
    -	}
    -	cprintf(stdout, "; STRUcture: %s; transfer MODE: %s\r\n",
    -	    strunames[stru], modenames[mode]);
    -	ispassive = 0;
    -	if (data != -1) {
    -		reply(0, "Data connection open");
    -		su = NULL;
    -	} else if (pdata != -1) {
    -		reply(0, "in Passive mode");
    -		if (curclass.advertise.su_len != 0)
    -			su = &curclass.advertise;
    -		else
    -			su = &pasv_addr;
    -		ispassive = 1;
    -		goto printaddr;
    -	} else if (usedefault == 0) {
    -		su = (struct sockinet *)&data_dest;
    -
    -		if (epsvall) {
    -			reply(0, "EPSV only mode (EPSV ALL)");
    -			goto epsvonly;
    -		}
    - printaddr:
    -							/* PASV/PORT */
    -		if (su->su_family == AF_INET) {
    -			a = (unsigned char *) &su->su_addr;
    -			p = (unsigned char *) &su->su_port;
    -#define UC(b) (((int) b) & 0xff)
    -			reply(0, "%s (%d,%d,%d,%d,%d,%d)",
    -				ispassive ? "PASV" : "PORT" ,
    -				UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
    -				UC(p[0]), UC(p[1]));
    -		}
    -
    -							/* LPSV/LPRT */
    -	    {
    -		int alen, i;
    -
    -		alen = 0;
    -		switch (su->su_family) {
    -		case AF_INET:
    -			a = (unsigned char *) &su->su_addr;
    -			p = (unsigned char *) &su->su_port;
    -			alen = sizeof(su->su_addr);
    -			af = 4;
    -			break;
    -#ifdef INET6
    -		case AF_INET6:
    -			a = (unsigned char *) &su->su_6addr;
    -			p = (unsigned char *) &su->su_port;
    -			alen = sizeof(su->su_6addr);
    -			af = 6;
    -			break;
    -#endif
    -		default:
    -			af = 0;
    -			break;
    -		}
    -		if (af) {
    -			cprintf(stdout, "    %s (%d,%d",
    -			    ispassive ? "LPSV" : "LPRT", af, alen);
    -			for (i = 0; i < alen; i++)
    -				cprintf(stdout, ",%d", UC(a[i]));
    -			cprintf(stdout, ",%d,%d,%d)\r\n",
    -			    2, UC(p[0]), UC(p[1]));
    -#undef UC
    -		}
    -	    }
    -
    -		/* EPRT/EPSV */
    - epsvonly:
    -		af = af2epsvproto(su->su_family);
    -		hbuf[0] = '\0';
    -		if (af > 0) {
    -			struct sockinet tmp;
    -
    -			tmp = *su;
    -#ifdef INET6
    -			if (tmp.su_family == AF_INET6)
    -				tmp.su_scope_id = 0;
    -#endif
    -			if (getnameinfo((struct sockaddr *)&tmp.si_su,
    -			    tmp.su_len, hbuf, sizeof(hbuf), sbuf, sizeof(sbuf),
    -			    NI_NUMERICHOST | NI_NUMERICSERV) == 0)
    -				reply(0, "%s (|%d|%s|%s|)",
    -				    ispassive ? "EPSV" : "EPRT",
    -				    af, hbuf, sbuf);
    -		}
    -	} else
    -		reply(0, "No data connection");
    -
    -	if (logged_in) {
    -		reply(0,
    -		    "Data sent:        " LLF " byte%s in " LLF " file%s",
    -		    (LLT)total_data_out, PLURAL(total_data_out),
    -		    (LLT)total_files_out, PLURAL(total_files_out));
    -		reply(0,
    -		    "Data received:    " LLF " byte%s in " LLF " file%s",
    -		    (LLT)total_data_in, PLURAL(total_data_in),
    -		    (LLT)total_files_in, PLURAL(total_files_in));
    -		reply(0,
    -		    "Total data:       " LLF " byte%s in " LLF " file%s",
    -		    (LLT)total_data, PLURAL(total_data),
    -		    (LLT)total_files, PLURAL(total_files));
    -	}
    -	otbi = total_bytes_in;
    -	otbo = total_bytes_out;
    -	otb = total_bytes;
    -	reply(0, "Traffic sent:     " LLF " byte%s in " LLF " transfer%s",
    -	    (LLT)otbo, PLURAL(otbo),
    -	    (LLT)total_xfers_out, PLURAL(total_xfers_out));
    -	reply(0, "Traffic received: " LLF " byte%s in " LLF " transfer%s",
    -	    (LLT)otbi, PLURAL(otbi),
    -	    (LLT)total_xfers_in, PLURAL(total_xfers_in));
    -	reply(0, "Total traffic:    " LLF " byte%s in " LLF " transfer%s",
    -	    (LLT)otb, PLURAL(otb),
    -	    (LLT)total_xfers, PLURAL(total_xfers));
    -
    -	if (logged_in && !CURCLASS_FLAGS_ISSET(private)) {
    -		struct ftpconv *cp;
    -
    -		reply(0, "%s", "");
    -		reply(0, "Class: %s, type: %s",
    -		    curclass.classname, CURCLASSTYPE);
    -		reply(0, "Check PORT/LPRT commands: %sabled",
    -		    CURCLASS_FLAGS_ISSET(checkportcmd) ? "en" : "dis");
    -		if (! EMPTYSTR(curclass.display))
    -			reply(0, "Display file: %s", curclass.display);
    -		if (! EMPTYSTR(curclass.notify))
    -			reply(0, "Notify fileglob: %s", curclass.notify);
    -		reply(0, "Idle timeout: " LLF ", maximum timeout: " LLF,
    -		    (LLT)curclass.timeout, (LLT)curclass.maxtimeout);
    -		reply(0, "Current connections: %d", connections);
    -		if (curclass.limit == -1)
    -			reply(0, "Maximum connections: unlimited");
    -		else
    -			reply(0, "Maximum connections: " LLF,
    -			    (LLT)curclass.limit);
    -		if (curclass.limitfile)
    -			reply(0, "Connection limit exceeded message file: %s",
    -			    conffilename(curclass.limitfile));
    -		if (! EMPTYSTR(curclass.chroot))
    -			reply(0, "Chroot format: %s", curclass.chroot);
    -		reply(0, "Deny bad ftpusers(5) quickly: %sabled",
    -		    CURCLASS_FLAGS_ISSET(denyquick) ? "en" : "dis");
    -		if (! EMPTYSTR(curclass.homedir))
    -			reply(0, "Homedir format: %s", curclass.homedir);
    -		if (curclass.maxfilesize == -1)
    -			reply(0, "Maximum file size: unlimited");
    -		else
    -			reply(0, "Maximum file size: " LLF,
    -			    (LLT)curclass.maxfilesize);
    -		if (! EMPTYSTR(curclass.motd))
    -			reply(0, "MotD file: %s", conffilename(curclass.motd));
    -		reply(0,
    -	    "Modify commands (CHMOD, DELE, MKD, RMD, RNFR, UMASK): %sabled",
    -		    CURCLASS_FLAGS_ISSET(modify) ? "en" : "dis");
    -		reply(0, "Upload commands (APPE, STOR, STOU): %sabled",
    -		    CURCLASS_FLAGS_ISSET(upload) ? "en" : "dis");
    -		reply(0, "Sanitize file names: %sabled",
    -		    CURCLASS_FLAGS_ISSET(sanenames) ? "en" : "dis");
    -		reply(0, "PASV/LPSV/EPSV connections: %sabled",
    -		    CURCLASS_FLAGS_ISSET(passive) ? "en" : "dis");
    -		if (curclass.advertise.su_len != 0) {
    -			char buf[50];	/* big enough for IPv6 address */
    -			const char *bp;
    -
    -			bp = inet_ntop(curclass.advertise.su_family,
    -			    (void *)&curclass.advertise.su_addr,
    -			    buf, sizeof(buf));
    -			if (bp != NULL)
    -				reply(0, "PASV advertise address: %s", bp);
    -		}
    -		if (curclass.portmin && curclass.portmax)
    -			reply(0, "PASV port range: " LLF " - " LLF,
    -			    (LLT)curclass.portmin, (LLT)curclass.portmax);
    -		if (curclass.rateget)
    -			reply(0, "Rate get limit: " LLF " bytes/sec",
    -			    (LLT)curclass.rateget);
    -		else
    -			reply(0, "Rate get limit: disabled");
    -		if (curclass.rateput)
    -			reply(0, "Rate put limit: " LLF " bytes/sec",
    -			    (LLT)curclass.rateput);
    -		else
    -			reply(0, "Rate put limit: disabled");
    -		if (curclass.mmapsize)
    -			reply(0, "Mmap size: " LLF, (LLT)curclass.mmapsize);
    -		else
    -			reply(0, "Mmap size: disabled");
    -		if (curclass.readsize)
    -			reply(0, "Read size: " LLF, (LLT)curclass.readsize);
    -		else
    -			reply(0, "Read size: default");
    -		if (curclass.writesize)
    -			reply(0, "Write size: " LLF, (LLT)curclass.writesize);
    -		else
    -			reply(0, "Write size: default");
    -		if (curclass.recvbufsize)
    -			reply(0, "Receive buffer size: " LLF,
    -			    (LLT)curclass.recvbufsize);
    -		else
    -			reply(0, "Receive buffer size: default");
    -		if (curclass.sendbufsize)
    -			reply(0, "Send buffer size: " LLF,
    -			    (LLT)curclass.sendbufsize);
    -		else
    -			reply(0, "Send buffer size: default");
    -		if (curclass.sendlowat)
    -			reply(0, "Send low water mark: " LLF,
    -			    (LLT)curclass.sendlowat);
    -		else
    -			reply(0, "Send low water mark: default");
    -		reply(0, "Umask: %.04o", curclass.umask);
    -		for (cp = curclass.conversions; cp != NULL; cp=cp->next) {
    -			if (cp->suffix == NULL || cp->types == NULL ||
    -			    cp->command == NULL)
    -				continue;
    -			reply(0, "Conversion: %s [%s] disable: %s, command: %s",
    -			    cp->suffix, cp->types, cp->disable, cp->command);
    -		}
    -	}
    -
    -	reply(211, "End of status");
    -}
    -
    -void
    -fatal(const char *s)
    -{
    -
    -	reply(451, "Error in server: %s\n", s);
    -	reply(221, "Closing connection due to server error.");
    -	dologout(0);
    -	/* NOTREACHED */
    -}
    -
    -/*
    - * reply() --
    - *	depending on the value of n, display fmt with a trailing CRLF and
    - *	prefix of:
    - *	n < -1		prefix the message with abs(n) + "-"	(initial line)
    - *	n == 0		prefix the message with 4 spaces	(middle lines)
    - *	n >  0		prefix the message with n + " "		(final line)
    - */
    -void
    -reply(int n, const char *fmt, ...)
    -{
    -	char	msg[MAXPATHLEN * 2 + 100];
    -	size_t	b;
    -	va_list	ap;
    -
    -	if (n == 0)
    -		b = snprintf(msg, sizeof(msg), "    ");
    -	else if (n < 0)
    -		b = snprintf(msg, sizeof(msg), "%d-", -n);
    -	else
    -		b = snprintf(msg, sizeof(msg), "%d ", n);
    -	va_start(ap, fmt);
    -	vsnprintf(msg + b, sizeof(msg) - b, fmt, ap);
    -	va_end(ap);
    -	cprintf(stdout, "%s\r\n", msg);
    -	(void)fflush(stdout);
    -	if (ftpd_debug)
    -		syslog(LOG_DEBUG, "<--- %s", msg);
    -}
    -
    -static void
    -logremotehost(struct sockinet *who)
    -{
    -
    -#if defined(HAVE_SOCKADDR_SNPRINTF)
    -	char abuf[BUFSIZ];
    -#endif
    -
    -	struct sockaddr *sa = (struct sockaddr *)&who->si_su;
    -	if (getnameinfo(sa, who->su_len, remotehost, sizeof(remotehost), NULL,
    -	    0, getnameopts))
    -		strlcpy(remotehost, "?", sizeof(remotehost));
    -#if defined(HAVE_SOCKADDR_SNPRINTF)
    -	sockaddr_snprintf(abuf, sizeof(abuf), "%a", sa);
    -	snprintf(remoteloghost, sizeof(remoteloghost), "%s(%s)", remotehost,
    -	    abuf);
    -#else
    -	strlcpy(remoteloghost, remotehost, sizeof(remoteloghost));
    -#endif
    -	
    -#if defined(HAVE_SETPROCTITLE)
    -	snprintf(proctitle, sizeof(proctitle), "%s: connected", remotehost);
    -	setproctitle("%s", proctitle);
    -#endif /* defined(HAVE_SETPROCTITLE) */
    -	if (logging)
    -		syslog(LOG_INFO, "connection from %s to %s",
    -		    remoteloghost, hostname);
    -}
    -
    -/*
    - * Record logout in wtmp file and exit with supplied status.
    - * NOTE: because this is called from signal handlers it cannot
    - *       use stdio (or call other functions that use stdio).
    - */
    -void
    -dologout(int status)
    -{
    -	/*
    -	* Prevent reception of SIGURG from resulting in a resumption
    -	* back to the main program loop.
    -	*/
    -	transflag = 0;
    -	logout_utmp();
    -	if (logged_in) {
    -#ifdef KERBEROS
    -		if (!notickets && krbtkfile_env)
    -			unlink(krbtkfile_env);
    -#endif
    -	}
    -	/* beware of flushing buffers after a SIGPIPE */
    -	if (xferlogfd != -1)
    -		close(xferlogfd);
    -	_exit(status);
    -}
    -
    -void
    -abor(void)
    -{
    -
    -	if (!transflag)
    -		return;
    -	tmpline[0] = '\0';
    -	is_oob = 0;
    -	reply(426, "Transfer aborted. Data connection closed.");
    -	reply(226, "Abort successful");
    -	transflag = 0;		/* flag that the transfer has aborted */
    -}
    -
    -void
    -statxfer(void)
    -{
    -
    -	if (!transflag)
    -		return;
    -	tmpline[0] = '\0';
    -	is_oob = 0;
    -	if (file_size != (off_t) -1)
    -		reply(213,
    -		    "Status: " LLF " of " LLF " byte%s transferred",
    -		    (LLT)byte_count, (LLT)file_size,
    -		    PLURAL(byte_count));
    -	else
    -		reply(213, "Status: " LLF " byte%s transferred",
    -		    (LLT)byte_count, PLURAL(byte_count));
    -}
    -
    -/*
    - * Call when urgflag != 0 to handle Out Of Band commands.
    - * Returns non zero if the OOB command aborted the transfer
    - * by setting transflag to 0. (c.f., "ABOR").
    - */
    -static int
    -handleoobcmd(void)
    -{
    -	char *cp;
    -	int ret;
    -
    -	if (!urgflag)
    -		return (0);
    -	urgflag = 0;
    -	/* only process if transfer occurring */
    -	if (!transflag)
    -		return (0);
    -	cp = tmpline;
    -	ret = get_line(cp, sizeof(tmpline)-1, stdin);
    -	if (ret == -1) {
    -		reply(221, "You could at least say goodbye.");
    -		dologout(0);
    -	} else if (ret == -2) {
    -		/* Ignore truncated command */
    -		/* XXX: abort xfer with "500 command too long", & return 1 ? */
    -		return 0;
    -	}
    -		/*
    -		 * Manually parse OOB commands, because we can't
    -		 * recursively call the yacc parser...
    -		 */
    -	if (strcasecmp(cp, "ABOR\r\n") == 0) {
    -		abor();
    -	} else if (strcasecmp(cp, "STAT\r\n") == 0) {
    -		statxfer();
    -	} else {
    -		/* XXX: error with "500 unknown command" ? */
    -	}
    -	return (transflag == 0);
    -}
    -
    -static int
    -bind_pasv_addr(void)
    -{
    -	static int passiveport;
    -	int port, len;
    -
    -	len = pasv_addr.su_len;
    -	if (curclass.portmin == 0 && curclass.portmax == 0) {
    -		pasv_addr.su_port = 0;
    -		return (bind(pdata, (struct sockaddr *)&pasv_addr.si_su, len));
    -	}
    -
    -	if (passiveport == 0) {
    -		srand(getpid());
    -		passiveport = rand() % (curclass.portmax - curclass.portmin)
    -		    + curclass.portmin;
    -	}
    -
    -	port = passiveport;
    -	while (1) {
    -		port++;
    -		if (port > curclass.portmax)
    -			port = curclass.portmin;
    -		else if (port == passiveport) {
    -			errno = EAGAIN;
    -			return (-1);
    -		}
    -		pasv_addr.su_port = htons(port);
    -		if (bind(pdata, (struct sockaddr *)&pasv_addr.si_su, len) == 0)
    -			break;
    -		if (errno != EADDRINUSE)
    -			return (-1);
    -	}
    -	passiveport = port;
    -	return (0);
    -}
    -
    -/*
    - * Note: a response of 425 is not mentioned as a possible response to
    - *	the PASV command in RFC959. However, it has been blessed as
    - *	a legitimate response by Jon Postel in a telephone conversation
    - *	with Rick Adams on 25 Jan 89.
    - */
    -void
    -passive(void)
    -{
    -	socklen_t len;
    -	int recvbufsize;
    -	char *p, *a;
    -
    -	if (pdata >= 0)
    -		close(pdata);
    -	pdata = socket(AF_INET, SOCK_STREAM, 0);
    -	if (pdata < 0 || !logged_in) {
    -		perror_reply(425, "Can't open passive connection");
    -		return;
    -	}
    -	pasv_addr = ctrl_addr;
    -
    -	if (bind_pasv_addr() < 0)
    -		goto pasv_error;
    -	len = pasv_addr.su_len;
    -	if (getsockname(pdata, (struct sockaddr *) &pasv_addr.si_su, &len) < 0)
    -		goto pasv_error;
    -	pasv_addr.su_len = len;
    -	if (curclass.recvbufsize) {
    -		recvbufsize = curclass.recvbufsize;
    -		if (setsockopt(pdata, SOL_SOCKET, SO_RCVBUF, &recvbufsize,
    -			       sizeof(int)) == -1)
    -			syslog(LOG_WARNING, "setsockopt(SO_RCVBUF, %d): %m",
    -			       recvbufsize);
    -	}
    -	if (listen(pdata, 1) < 0)
    -		goto pasv_error;
    -	if (curclass.advertise.su_len != 0)
    -		a = (char *) &curclass.advertise.su_addr;
    -	else
    -		a = (char *) &pasv_addr.su_addr;
    -	p = (char *) &pasv_addr.su_port;
    -
    -#define UC(b) (((int) b) & 0xff)
    -
    -	reply(227, "Entering Passive Mode (%d,%d,%d,%d,%d,%d)", UC(a[0]),
    -		UC(a[1]), UC(a[2]), UC(a[3]), UC(p[0]), UC(p[1]));
    -	return;
    -
    - pasv_error:
    -	(void) close(pdata);
    -	pdata = -1;
    -	perror_reply(425, "Can't open passive connection");
    -	return;
    -}
    -
    -/*
    - * convert protocol identifier to/from AF
    - */
    -int
    -lpsvproto2af(int proto)
    -{
    -
    -	switch (proto) {
    -	case 4:
    -		return AF_INET;
    -#ifdef INET6
    -	case 6:
    -		return AF_INET6;
    -#endif
    -	default:
    -		return -1;
    -	}
    -}
    -
    -int
    -af2lpsvproto(int af)
    -{
    -
    -	switch (af) {
    -	case AF_INET:
    -		return 4;
    -#ifdef INET6
    -	case AF_INET6:
    -		return 6;
    -#endif
    -	default:
    -		return -1;
    -	}
    -}
    -
    -int
    -epsvproto2af(int proto)
    -{
    -
    -	switch (proto) {
    -	case 1:
    -		return AF_INET;
    -#ifdef INET6
    -	case 2:
    -		return AF_INET6;
    -#endif
    -	default:
    -		return -1;
    -	}
    -}
    -
    -int
    -af2epsvproto(int af)
    -{
    -
    -	switch (af) {
    -	case AF_INET:
    -		return 1;
    -#ifdef INET6
    -	case AF_INET6:
    -		return 2;
    -#endif
    -	default:
    -		return -1;
    -	}
    -}
    -
    -/*
    - * 228 Entering Long Passive Mode (af, hal, h1, h2, h3,..., pal, p1, p2...)
    - * 229 Entering Extended Passive Mode (|||port|)
    - */
    -void
    -long_passive(const char *cmd, int pf)
    -{
    -	socklen_t len;
    -	char *p, *a;
    -
    -	if (!logged_in) {
    -		syslog(LOG_NOTICE, "long passive but not logged in");
    -		reply(503, "Login with USER first.");
    -		return;
    -	}
    -
    -	if (pf != PF_UNSPEC && ctrl_addr.su_family != pf) {
    -		/*
    -		 * XXX: only EPRT/EPSV ready clients will understand this
    -		 */
    -		if (strcmp(cmd, "EPSV") != 0)
    -			reply(501, "Network protocol mismatch"); /*XXX*/
    -		else
    -			epsv_protounsupp("Network protocol mismatch");
    -
    -		return;
    -	}
    - 
    -	if (pdata >= 0)
    -		close(pdata);
    -	pdata = socket(ctrl_addr.su_family, SOCK_STREAM, 0);
    -	if (pdata < 0) {
    -		perror_reply(425, "Can't open passive connection");
    -		return;
    -	}
    -	pasv_addr = ctrl_addr;
    -	if (bind_pasv_addr() < 0)
    -		goto pasv_error;
    -	len = pasv_addr.su_len;
    -	if (getsockname(pdata, (struct sockaddr *) &pasv_addr.si_su, &len) < 0)
    -		goto pasv_error;
    -	pasv_addr.su_len = len;
    -	if (listen(pdata, 1) < 0)
    -		goto pasv_error;
    -	p = (char *) &pasv_addr.su_port;
    -
    -#define UC(b) (((int) b) & 0xff)
    -
    -	if (strcmp(cmd, "LPSV") == 0) {
    -		struct sockinet *advert;
    -
    -		if (curclass.advertise.su_len != 0)
    -			advert = &curclass.advertise;
    -		else
    -			advert = &pasv_addr;
    -		switch (advert->su_family) {
    -		case AF_INET:
    -			a = (char *) &advert->su_addr;
    -			reply(228,
    -    "Entering Long Passive Mode (%d,%d,%d,%d,%d,%d,%d,%d,%d)",
    -				4, 4, UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
    -				2, UC(p[0]), UC(p[1]));
    -			return;
    -#ifdef INET6
    -		case AF_INET6:
    -			a = (char *) &advert->su_6addr;
    -			reply(228,
    -    "Entering Long Passive Mode (%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d)",
    -				6, 16,
    -				UC(a[0]), UC(a[1]), UC(a[2]), UC(a[3]),
    -				UC(a[4]), UC(a[5]), UC(a[6]), UC(a[7]),
    -				UC(a[8]), UC(a[9]), UC(a[10]), UC(a[11]),
    -				UC(a[12]), UC(a[13]), UC(a[14]), UC(a[15]),
    -				2, UC(p[0]), UC(p[1]));
    -			return;
    -#endif
    -		}
    -#undef UC
    -	} else if (strcmp(cmd, "EPSV") == 0) {
    -		switch (pasv_addr.su_family) {
    -		case AF_INET:
    -#ifdef INET6
    -		case AF_INET6:
    -#endif
    -			reply(229, "Entering Extended Passive Mode (|||%d|)",
    -			    ntohs(pasv_addr.su_port));
    -			return;
    -		}
    -	} else {
    -		/* more proper error code? */
    -	}
    -
    - pasv_error:
    -	(void) close(pdata);
    -	pdata = -1;
    -	perror_reply(425, "Can't open passive connection");
    -	return;
    -}
    -
    -int
    -extended_port(const char *arg)
    -{
    -	char *tmp = NULL;
    -	char *result[3];
    -	char *p, *q;
    -	char delim;
    -	struct addrinfo hints;
    -	struct addrinfo *res = NULL;
    -	int i;
    -	unsigned long proto;
    -
    -	tmp = ftpd_strdup(arg);
    -	p = tmp;
    -	delim = p[0];
    -	p++;
    -	memset(result, 0, sizeof(result));
    -	for (i = 0; i < 3; i++) {
    -		q = strchr(p, delim);
    -		if (!q || *q != delim)
    -			goto parsefail;
    -		*q++ = '\0';
    -		result[i] = p;
    -		p = q;
    -	}
    -
    -			/* some more sanity checks */
    -	errno = 0;
    -	p = NULL;
    -	(void)strtoul(result[2], &p, 10);
    -	if (errno || !*result[2] || *p)
    -		goto parsefail;
    -	errno = 0;
    -	p = NULL;
    -	proto = strtoul(result[0], &p, 10);
    -	if (errno || !*result[0] || *p)
    -		goto protounsupp;
    -	 
    -	memset(&hints, 0, sizeof(hints));
    -	hints.ai_family = epsvproto2af((int)proto);
    -	if (hints.ai_family < 0)
    -		goto protounsupp;
    -	hints.ai_socktype = SOCK_STREAM;
    -	hints.ai_flags = AI_NUMERICHOST;
    -	if (getaddrinfo(result[1], result[2], &hints, &res))
    -		goto parsefail;
    -	if (res->ai_next)
    -		goto parsefail;
    -	if (sizeof(data_dest) < res->ai_addrlen)
    -		goto parsefail;
    -	memcpy(&data_dest.si_su, res->ai_addr, res->ai_addrlen);
    -	data_dest.su_len = res->ai_addrlen;
    -#ifdef INET6
    -	if (his_addr.su_family == AF_INET6 &&
    -	    data_dest.su_family == AF_INET6) {
    -			/* XXX: more sanity checks! */
    -		data_dest.su_scope_id = his_addr.su_scope_id;
    -	}
    -#endif
    -
    -	if (tmp != NULL)
    -		free(tmp);
    -	if (res)
    -		freeaddrinfo(res);
    -	return 0;
    -
    - parsefail:
    -	reply(500, "Invalid argument, rejected.");
    -	usedefault = 1;
    -	if (tmp != NULL)
    -		free(tmp);
    -	if (res)
    -		freeaddrinfo(res);
    -	return -1;
    -
    - protounsupp:
    -	epsv_protounsupp("Protocol not supported");
    -	usedefault = 1;
    -	if (tmp != NULL)
    -		free(tmp);
    -	return -1;
    -}
    -
    -/*
    - * 522 Protocol not supported (proto,...)
    - * as we assume address family for control and data connections are the same,
    - * we do not return the list of address families we support - instead, we
    - * return the address family of the control connection.
    - */
    -void
    -epsv_protounsupp(const char *message)
    -{
    -	int proto;
    -
    -	proto = af2epsvproto(ctrl_addr.su_family);
    -	if (proto < 0)
    -		reply(501, "%s", message);	/* XXX */
    -	else
    -		reply(522, "%s, use (%d)", message, proto);
    -}
    -
    -/*
    - * Generate unique name for file with basename "local".
    - * The file named "local" is already known to exist.
    - * Generates failure reply on error.
    - *
    - * XXX:	this function should under go changes similar to
    - *	the mktemp(3)/mkstemp(3) changes.
    - */
    -static char *
    -gunique(const char *local)
    -{
    -	static char new[MAXPATHLEN];
    -	struct stat st;
    -	char *cp;
    -	int count;
    -
    -	cp = strrchr(local, '/');
    -	if (cp)
    -		*cp = '\0';
    -	if (stat(cp ? local : ".", &st) < 0) {
    -		perror_reply(553, cp ? local : ".");
    -		return (NULL);
    -	}
    -	if (cp)
    -		*cp = '/';
    -	for (count = 1; count < 100; count++) {
    -		(void)snprintf(new, sizeof(new) - 1, "%s.%d", local, count);
    -		if (stat(new, &st) < 0)
    -			return (new);
    -	}
    -	reply(452, "Unique file name cannot be created.");
    -	return (NULL);
    -}
    -
    -/*
    - * Format and send reply containing system error number.
    - */
    -void
    -perror_reply(int code, const char *string)
    -{
    -	int save_errno;
    -
    -	save_errno = errno;
    -	reply(code, "%s: %s.", string, strerror(errno));
    -	errno = save_errno;
    -}
    -
    -static char *onefile[] = {
    -	NULL,
    -	0
    -};
    -
    -void
    -send_file_list(const char *whichf)
    -{
    -	struct stat st;
    -	DIR *dirp;
    -	struct dirent *dir;
    -	FILE *volatile dout;
    -	char **volatile dirlist;
    -	char *dirname, *p;
    -	char *notglob;
    -	int volatile simple;
    -	int volatile freeglob;
    -	glob_t gl;
    -
    -	dirp = NULL;
    -	dout = NULL;
    -	notglob = NULL;
    -	simple = 0;
    -	freeglob = 0;
    -	urgflag = 0;
    -
    -	p = NULL;
    -	if (strpbrk(whichf, "~{[*?") != NULL) {
    -		int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE|GLOB_LIMIT;
    -
    -		memset(&gl, 0, sizeof(gl));
    -		freeglob = 1;
    -		if (glob(whichf, flags, 0, &gl)) {
    -			reply(450, "Not found");
    -			goto cleanup_send_file_list;
    -		} else if (gl.gl_pathc == 0) {
    -			errno = ENOENT;
    -			perror_reply(450, whichf);
    -			goto cleanup_send_file_list;
    -		}
    -		dirlist = gl.gl_pathv;
    -	} else {
    -		notglob = ftpd_strdup(whichf);
    -		onefile[0] = notglob;
    -		dirlist = onefile;
    -		simple = 1;
    -	}
    -					/* XXX: } for vi sm */
    -
    -	while ((dirname = *dirlist++) != NULL) {
    -		int trailingslash = 0;
    -
    -		if (stat(dirname, &st) < 0) {
    -			/*
    -			 * If user typed "ls -l", etc, and the client
    -			 * used NLST, do what the user meant.
    -			 */
    -			/* XXX: nuke this support? */
    -			if (dirname[0] == '-' && *dirlist == NULL &&
    -			    transflag == 0) {
    -				const char *argv[] = { INTERNAL_LS, "", NULL };
    -
    -				argv[1] = dirname;
    -				retrieve(argv, dirname);
    -				goto cleanup_send_file_list;
    -			}
    -			perror_reply(450, whichf);
    -			goto cleanup_send_file_list;
    -		}
    -
    -		if (S_ISREG(st.st_mode)) {
    -			/*
    -			 * XXXRFC:
    -			 *	should we follow RFC959 and not work
    -			 *	for non directories?
    -			 */
    -			if (dout == NULL) {
    -				dout = dataconn("file list", (off_t)-1, "w");
    -				if (dout == NULL)
    -					goto cleanup_send_file_list;
    -				transflag = 1;
    -			}
    -			cprintf(dout, "%s%s\n", dirname,
    -			    type == TYPE_A ? "\r" : "");
    -			continue;
    -		} else if (!S_ISDIR(st.st_mode))
    -			continue;
    -
    -		if (dirname[strlen(dirname) - 1] == '/')
    -			trailingslash++;
    -
    -		if ((dirp = opendir(dirname)) == NULL)
    -			continue;
    -
    -		while ((dir = readdir(dirp)) != NULL) {
    -			char nbuf[MAXPATHLEN];
    -
    -			if (urgflag && handleoobcmd()) {
    -				(void) closedir(dirp);
    -				goto cleanup_send_file_list;
    -			}
    -
    -			if (ISDOTDIR(dir->d_name) || ISDOTDOTDIR(dir->d_name))
    -				continue;
    -
    -			(void)snprintf(nbuf, sizeof(nbuf), "%s%s%s", dirname,
    -			    trailingslash ? "" : "/", dir->d_name);
    -
    -			/*
    -			 * We have to do a stat to ensure it's
    -			 * not a directory or special file.
    -			 */
    -			/*
    -			 * XXXRFC:
    -			 *	should we follow RFC959 and filter out
    -			 *	non files ?   lukem - NO!, or not until
    -			 *	our ftp client uses MLS{T,D} for completion.
    -			 */
    -			if (simple || (stat(nbuf, &st) == 0 &&
    -			    S_ISREG(st.st_mode))) {
    -				if (dout == NULL) {
    -					dout = dataconn("file list", (off_t)-1,
    -						"w");
    -					if (dout == NULL) {
    -						(void) closedir(dirp);
    -						goto cleanup_send_file_list;
    -					}
    -					transflag = 1;
    -				}
    -				p = nbuf;
    -				if (nbuf[0] == '.' && nbuf[1] == '/')
    -					p = &nbuf[2];
    -				cprintf(dout, "%s%s\n", p,
    -				    type == TYPE_A ? "\r" : "");
    -			}
    -		}
    -		(void) closedir(dirp);
    -	}
    -
    -	if (dout == NULL)
    -		reply(450, "No files found.");
    -	else if (ferror(dout) != 0)
    -		perror_reply(451, "Data connection");
    -	else
    -		reply(226, "Transfer complete.");
    -
    - cleanup_send_file_list:
    -	closedataconn(dout);
    -	transflag = 0;
    -	urgflag = 0;
    -	total_xfers++;
    -	total_xfers_out++;
    -	if (notglob)
    -		free(notglob);
    -	if (freeglob)
    -		globfree(&gl);
    -}
    -
    -char *
    -conffilename(const char *s)
    -{
    -	static char filename[MAXPATHLEN];
    -
    -	if (*s == '/')
    -		strlcpy(filename, s, sizeof(filename));
    -	else
    -		(void)snprintf(filename, sizeof(filename), "%s/%s", confdir ,s);
    -	return (filename);
    -}
    -
    -/*
    - * logxfer --
    - *	if logging > 1, then based on the arguments, syslog a message:
    - *	 if bytes != -1		"  =  bytes"
    - *	 else if file2 != NULL	"  "
    - *	 else			" "
    - *	if elapsed != NULL, append "in xxx.yyy seconds"
    - *	if error != NULL, append ": " + error
    - *
    - *	if doxferlog != 0, bytes != -1, and command is "get", "put",
    - *	or "append", syslog and/or write a wu-ftpd style xferlog entry
    - */
    -void
    -logxfer(const char *command, off_t bytes, const char *file1, const char *file2,
    -    const struct timeval *elapsed, const char *error)
    -{
    -	char		 buf[MAXPATHLEN * 2 + 100];
    -	char		 realfile1[MAXPATHLEN], realfile2[MAXPATHLEN];
    -	const char	*r1, *r2;
    -	char		 direction;
    -	size_t		 len;
    -	time_t		 now;
    -
    -	if (logging <=1 && !doxferlog)
    -		return;
    -
    -	r1 = r2 = NULL;
    -	if ((r1 = realpath(file1, realfile1)) == NULL)
    -		r1 = file1;
    -	if (file2 != NULL)
    -		if ((r2 = realpath(file2, realfile2)) == NULL)
    -			r2 = file2;
    -
    -		/*
    -		 * syslog command
    -		 */
    -	if (logging > 1) {
    -		len = snprintf(buf, sizeof(buf), "%s %s", command, r1);
    -		if (bytes != (off_t)-1)
    -			len += snprintf(buf + len, sizeof(buf) - len,
    -			    " = " LLF " byte%s", (LLT) bytes, PLURAL(bytes));
    -		else if (r2 != NULL)
    -			len += snprintf(buf + len, sizeof(buf) - len,
    -			    " %s", r2);
    -		if (elapsed != NULL)
    -			len += snprintf(buf + len, sizeof(buf) - len,
    -			    " in " LLF ".%.03ld seconds",
    -			    (LLT)elapsed->tv_sec,
    -			    (long)(elapsed->tv_usec / 1000));
    -		if (error != NULL)
    -			len += snprintf(buf + len, sizeof(buf) - len,
    -			    ": %s", error);
    -		syslog(LOG_INFO, "%s", buf);
    -	}
    -
    -		/*
    -		 * syslog wu-ftpd style log entry, prefixed with "xferlog: "
    -		 */
    -	if (!doxferlog || bytes == -1)
    -		return;
    -
    -	if (strcmp(command, "get") == 0)
    -		direction = 'o';
    -	else if (strcmp(command, "put") == 0 || strcmp(command, "append") == 0)
    -		direction = 'i';
    -	else
    -		return;
    -
    -	time(&now);
    -	len = snprintf(buf, sizeof(buf),
    -	    "%.24s " LLF " %s " LLF " %s %c %s %c %c %s FTP 0 * %c\n",
    -
    -/*
    - * XXX: wu-ftpd puts ' (send)' or ' (recv)' in the syslog message, and removes
    - *	the full date.  This may be problematic for accurate log parsing,
    - *	given that syslog messages don't contain the full date.
    - */
    -	    ctime(&now),
    -	    (LLT)
    -	    (elapsed == NULL ? 0 : elapsed->tv_sec + (elapsed->tv_usec > 0)),
    -	    remotehost,
    -	    (LLT) bytes,
    -	    r1,
    -	    type == TYPE_A ? 'a' : 'b',
    -	    "_",		/* XXX: take conversions into account? */
    -	    direction, 
    -
    -	    curclass.type == CLASS_GUEST ?  'a' :
    -	    curclass.type == CLASS_CHROOT ? 'g' :
    -	    curclass.type == CLASS_REAL ?   'r' : '?',
    -
    -	    curclass.type == CLASS_GUEST ? pw->pw_passwd : pw->pw_name,
    -	    error != NULL ? 'i' : 'c'
    -	    );
    -
    -	if ((doxferlog & 2) && xferlogfd != -1)
    -		write(xferlogfd, buf, len);
    -	if ((doxferlog & 1)) {
    -		buf[len-1] = '\n';	/* strip \n from syslog message */
    -		syslog(LOG_INFO, "xferlog: %s", buf);
    -	}
    -}
    -
    -/*
    - * Log the resource usage.
    - *
    - * XXX: more resource usage to logging?
    - */
    -void
    -logrusage(const struct rusage *rusage_before,
    -    const struct rusage *rusage_after)
    -{
    -	struct timeval usrtime, systime;
    -
    -	if (logging <= 1)
    -		return;
    -
    -	timersub(&rusage_after->ru_utime, &rusage_before->ru_utime, &usrtime);
    -	timersub(&rusage_after->ru_stime, &rusage_before->ru_stime, &systime);
    -	syslog(LOG_INFO, LLF ".%.03ldu " LLF ".%.03lds %ld+%ldio %ldpf+%ldw",
    -	    (LLT)usrtime.tv_sec, (long)(usrtime.tv_usec / 1000),
    -	    (LLT)systime.tv_sec, (long)(systime.tv_usec / 1000),
    -	    rusage_after->ru_inblock - rusage_before->ru_inblock,
    -	    rusage_after->ru_oublock - rusage_before->ru_oublock,
    -	    rusage_after->ru_majflt - rusage_before->ru_majflt,
    -	    rusage_after->ru_nswap - rusage_before->ru_nswap);
    -}
    -
    -/*
    - * Determine if `password' is valid for user given in `pw'.
    - * Returns 2 if password expired, 1 if otherwise failed, 0 if ok
    - */
    -int
    -checkpassword(const struct passwd *pwent, const char *password)
    -{
    -	const char *orig;
    -	char	*new;
    -	time_t	 change, expire, now;
    -
    -	change = expire = 0;
    -	if (pwent == NULL)
    -		return 1;
    -
    -	time(&now);
    -	orig = pwent->pw_passwd;	/* save existing password */
    -	expire = pwent->pw_expire;
    -	change = pwent->pw_change;
    -	if (change == _PASSWORD_CHGNOW)
    -		change = now;
    -
    -	if (orig[0] == '\0')		/* don't allow empty passwords */
    -		return 1;
    -
    -	new = crypt(password, orig);	/* encrypt given password */
    -	if (strcmp(new, orig) != 0)	/* compare */
    -		return 1;
    -
    -	if ((expire && now >= expire) || (change && now >= change))
    -		return 2;		/* check if expired */
    -
    -	return 0;			/* OK! */
    -}
    -
    -char *
    -ftpd_strdup(const char *s)
    -{
    -	char *new = strdup(s);
    -
    -	if (new == NULL)
    -		fatal("Local resource failure: malloc");
    -		/* NOTREACHED */
    -	return (new);
    -}
    -
    -/*
    - * As per fprintf(), but increment total_bytes and total_bytes_out,
    - * by the appropriate amount.
    - */
    -void
    -cprintf(FILE *fd, const char *fmt, ...)
    -{
    -	off_t b;
    -	va_list ap;
    -
    -	va_start(ap, fmt);
    -	b = vfprintf(fd, fmt, ap);
    -	va_end(ap);
    -	total_bytes += b;
    -	total_bytes_out += b;
    -}
    -
    -#ifdef USE_PAM
    -/*
    - * the following code is stolen from imap-uw PAM authentication module and
    - * login.c
    - */
    -typedef struct {
    -	const char *uname;	/* user name */
    -	int	    triedonce;	/* if non-zero, tried before */
    -} ftpd_cred_t;
    -
    -static int
    -auth_conv(int num_msg, const struct pam_message **msg,
    -    struct pam_response **resp, void *appdata)
    -{
    -	int i, ret;
    -	size_t n;
    -	ftpd_cred_t *cred = (ftpd_cred_t *) appdata;
    -	struct pam_response *myreply;
    -	char pbuf[FTP_BUFLEN];
    -
    -	if (num_msg <= 0 || num_msg > PAM_MAX_NUM_MSG)
    -		return (PAM_CONV_ERR);
    -	myreply = calloc(num_msg, sizeof *myreply);
    -	if (myreply == NULL)
    -		return PAM_BUF_ERR;
    -
    -	for (i = 0; i < num_msg; i++) {
    -		myreply[i].resp_retcode = 0;
    -		myreply[i].resp = NULL;
    -		switch (msg[i]->msg_style) {
    -		case PAM_PROMPT_ECHO_ON:	/* user */
    -			myreply[i].resp = ftpd_strdup(cred->uname);
    -			/* PAM frees resp. */
    -			break;
    -		case PAM_PROMPT_ECHO_OFF:	/* authtok (password) */
    -				/*
    -				 * Only send a single 331 reply and
    -				 * then expect a PASS.
    -				 */
    -			if (cred->triedonce) {
    -				syslog(LOG_ERR,
    -			"auth_conv: already performed PAM_PROMPT_ECHO_OFF");
    -				goto fail;
    -			}
    -			cred->triedonce++;
    -			if (msg[i]->msg[0] == '\0') {
    -				(void)strlcpy(pbuf, "password", sizeof(pbuf));
    -			} else {
    -					/* Uncapitalize msg */
    -				(void)strlcpy(pbuf, msg[i]->msg, sizeof(pbuf));
    -				if (isupper((unsigned char)pbuf[0]))
    -					pbuf[0] = tolower(
    -					    (unsigned char)pbuf[0]);
    -					/* Remove trailing ':' and whitespace */
    -				n = strlen(pbuf);
    -				while (n-- > 0) {
    -					if (isspace((unsigned char)pbuf[n]) ||
    -					    pbuf[n] == ':')
    -						pbuf[n] = '\0';
    -					else
    -						break;
    -				}
    -			}
    -				/* Send reply, wait for a response. */
    -			reply(331, "User %s accepted, provide %s.",
    -			    cred->uname, pbuf);
    -			(void) alarm(curclass.timeout);
    -			ret = get_line(pbuf, sizeof(pbuf)-1, stdin);
    -			(void) alarm(0);
    -			if (ret == -1) {
    -				reply(221, "You could at least say goodbye.");
    -				dologout(0);
    -			} else if (ret == -2) {
    -			    /* XXX: should we do this reply(-530, ..) ? */
    -				reply(-530, "Command too long.");
    -				goto fail;
    -			}
    -				/* Ensure it is PASS */
    -			if (strncasecmp(pbuf, "PASS ", 5) != 0) {
    -				syslog(LOG_ERR,
    -				    "auth_conv: unexpected reply '%.4s'", pbuf);
    -				/* XXX: should we do this reply(-530, ..) ? */
    -				reply(-530, "Unexpected reply '%.4s'.", pbuf);
    -				goto fail;
    -			}
    -				/* Strip CRLF from "PASS" reply */
    -			n = strlen(pbuf);
    -			while (--n >= 5 &&
    -			    (pbuf[n] == '\r' || pbuf[n] == '\n'))
    -			    pbuf[n] = '\0';
    -				/* Copy password into reply */
    -			myreply[i].resp = ftpd_strdup(pbuf+5);
    -				/* PAM frees resp. */
    -			break;
    -		case PAM_TEXT_INFO:
    -		case PAM_ERROR_MSG:
    -			break;
    -		default:			/* unknown message style */
    -			goto fail;
    -		}
    -	}
    -
    -	*resp = myreply;
    -	return PAM_SUCCESS;
    -
    - fail:
    -	free(myreply);
    -	*resp = NULL;
    -	return PAM_CONV_ERR;
    -}
    -
    -/*
    - * Attempt to authenticate the user using PAM.  Returns 0 if the user is
    - * authenticated, or 1 if not authenticated.  If some sort of PAM system
    - * error occurs (e.g., the "/etc/pam.conf" file is missing) then this
    - * function returns -1.  This can be used as an indication that we should
    - * fall back to a different authentication mechanism.
    - * pw maybe be updated to a new user if PAM_USER changes from curname.
    - */
    -static int
    -auth_pam(void)
    -{
    -	const char *tmpl_user;
    -	const void *item;
    -	int rval;
    -	int e;
    -	ftpd_cred_t auth_cred = { curname, 0 };
    -	struct pam_conv conv = { &auth_conv, &auth_cred };
    -
    -	e = pam_start("ftpd", curname, &conv, &pamh);
    -	if (e != PAM_SUCCESS) {
    -		/*
    -		 * In OpenPAM, it's OK to pass NULL to pam_strerror()
    -		 * if context creation has failed in the first place.
    -		 */
    -		syslog(LOG_ERR, "pam_start: %s", pam_strerror(NULL, e));
    -		return -1;
    -	}
    -
    -	e = pam_set_item(pamh, PAM_RHOST, remotehost);
    -	if (e != PAM_SUCCESS) {
    -		syslog(LOG_ERR, "pam_set_item(PAM_RHOST): %s",
    -			pam_strerror(pamh, e));
    -		if ((e = pam_end(pamh, e)) != PAM_SUCCESS) {
    -			syslog(LOG_ERR, "pam_end: %s", pam_strerror(pamh, e));
    -		}
    -		pamh = NULL;
    -		return -1;
    -	}
    -
    -	e = pam_set_item(pamh, PAM_SOCKADDR, &his_addr);
    -	if (e != PAM_SUCCESS) {
    -		syslog(LOG_ERR, "pam_set_item(PAM_SOCKADDR): %s",
    -			pam_strerror(pamh, e));
    -		if ((e = pam_end(pamh, e)) != PAM_SUCCESS) {
    -			syslog(LOG_ERR, "pam_end: %s", pam_strerror(pamh, e));
    -		}
    -		pamh = NULL;
    -		return -1;
    -	}
    -
    -	e = pam_authenticate(pamh, 0);
    -	if (ftpd_debug)
    -		syslog(LOG_DEBUG, "pam_authenticate: user '%s' returned %d",
    -		    curname, e);
    -	switch (e) {
    -	case PAM_SUCCESS:
    -		/*
    -		 * With PAM we support the concept of a "template"
    -		 * user.  The user enters a login name which is
    -		 * authenticated by PAM, usually via a remote service
    -		 * such as RADIUS or TACACS+.  If authentication
    -		 * succeeds, a different but related "template" name
    -		 * is used for setting the credentials, shell, and
    -		 * home directory.  The name the user enters need only
    -		 * exist on the remote authentication server, but the
    -		 * template name must be present in the local password
    -		 * database.
    -		 *
    -		 * This is supported by two various mechanisms in the
    -		 * individual modules.  However, from the application's
    -		 * point of view, the template user is always passed
    -		 * back as a changed value of the PAM_USER item.
    -		 */
    -		if ((e = pam_get_item(pamh, PAM_USER, &item)) ==
    -		    PAM_SUCCESS) {
    -			tmpl_user = (const char *) item;
    -			if (pw == NULL
    -			    || strcmp(pw->pw_name, tmpl_user) != 0) {
    -				pw = sgetpwnam(tmpl_user);
    -				if (ftpd_debug)
    -					syslog(LOG_DEBUG,
    -					    "auth_pam: PAM changed "
    -					    "user from '%s' to '%s'",
    -					    curname, pw->pw_name);
    -				(void)strlcpy(curname, pw->pw_name,
    -				    curname_len);
    -			}
    -		} else
    -			syslog(LOG_ERR, "Couldn't get PAM_USER: %s",
    -			    pam_strerror(pamh, e));
    -		rval = 0;
    -		break;
    -
    -	case PAM_AUTH_ERR:
    -	case PAM_USER_UNKNOWN:
    -	case PAM_MAXTRIES:
    -		rval = 1;
    -		break;
    -
    -	default:
    -		syslog(LOG_ERR, "pam_authenticate: %s", pam_strerror(pamh, e));
    -		rval = -1;
    -		break;
    -	}
    -
    -	if (rval == 0) {
    -		e = pam_acct_mgmt(pamh, 0);
    -		if (e != PAM_SUCCESS) {
    -			syslog(LOG_ERR, "pam_acct_mgmt: %s",
    -						pam_strerror(pamh, e));
    -			rval = 1;
    -		}
    -	}
    -
    -	if (rval != 0) {
    -		if ((e = pam_end(pamh, e)) != PAM_SUCCESS) {
    -			syslog(LOG_ERR, "pam_end: %s", pam_strerror(pamh, e));
    -		}
    -		pamh = NULL;
    -	}
    -	return rval;
    -}
    -
    -#endif /* USE_PAM */
    diff --git a/libexec/ftpd/ftpd.conf.5 b/libexec/ftpd/ftpd.conf.5
    deleted file mode 100644
    index 1a8da295f..000000000
    --- a/libexec/ftpd/ftpd.conf.5
    +++ /dev/null
    @@ -1,738 +0,0 @@
    -.\"	$NetBSD: ftpd.conf.5,v 1.37 2009/04/09 02:25:45 joerg Exp $
    -.\"
    -.\" Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
    -.\" All rights reserved.
    -.\"
    -.\" This code is derived from software contributed to The NetBSD Foundation
    -.\" by Luke Mewburn.
    -.\"
    -.\" Redistribution and use in source and binary forms, with or without
    -.\" modification, are permitted provided that the following conditions
    -.\" are met:
    -.\" 1. Redistributions of source code must retain the above copyright
    -.\"    notice, this list of conditions and the following disclaimer.
    -.\" 2. Redistributions in binary form must reproduce the above copyright
    -.\"    notice, this list of conditions and the following disclaimer in the
    -.\"    documentation and/or other materials provided with the distribution.
    -.\"
    -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    -.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    -.\" POSSIBILITY OF SUCH DAMAGE.
    -.\"
    -.Dd April 13, 2007
    -.Dt FTPD.CONF 5
    -.Os
    -.Sh NAME
    -.Nm ftpd.conf
    -.Nd
    -.Xr ftpd 8
    -configuration file
    -.Sh DESCRIPTION
    -The
    -.Nm
    -file specifies various configuration options for
    -.Xr ftpd 8
    -that apply once a user has authenticated their connection.
    -.Pp
    -.Nm
    -consists of a series of lines, each of which may contain a
    -configuration directive, a comment, or a blank line.
    -Directives that appear later in the file override settings by previous
    -directives.
    -This allows
    -.Sq wildcard
    -entries to define defaults, and then have class-specific overrides.
    -.Pp
    -A directive line has the format:
    -.Dl command class [arguments]
    -.Pp
    -A
    -.Dq \e
    -is the escape character; it can be used to escape the meaning of the
    -comment character, or if it is the last character on a line, extends
    -a configuration directive across multiple lines.
    -A
    -.Dq #
    -is the comment character, and all characters from it to the end of
    -line are ignored (unless it is escaped with the escape character).
    -.Pp
    -Each authenticated user is a member of a
    -.Em class ,
    -which is determined by
    -.Xr ftpusers 5 .
    -.Em class
    -is used to determine which
    -.Nm
    -entries apply to the user.
    -The following special classes exist when parsing entries in
    -.Nm :
    -.Bl -tag -width "chroot" -compact -offset indent
    -.It Sy all
    -Matches any class.
    -.It Sy none
    -Matches no class.
    -.El
    -.Pp
    -Each class has a type, which may be one of:
    -.Bl -tag -width "CHROOT" -offset indent
    -.It Sy GUEST
    -Guests (as per the
    -.Dq anonymous
    -and
    -.Dq ftp
    -logins).
    -A
    -.Xr chroot 2
    -is performed after login.
    -.It Sy CHROOT
    -.Xr chroot 2 Ns ed
    -users (as per
    -.Xr ftpchroot 5 ) .
    -A
    -.Xr chroot 2
    -is performed after login.
    -.It Sy REAL
    -Normal users.
    -.El
    -.Pp
    -The
    -.Xr ftpd 8
    -.Sy STAT
    -command will return the class settings for the current user as defined by
    -.Nm ,
    -unless the
    -.Sy private
    -directive is set for the class.
    -.Pp
    -Each configuration line may be one of:
    -.Bl -tag -width 4n
    -.It Sy advertize Ar class Op Ar host
    -Set the address to advertise in the response to the
    -.Sy PASV
    -and
    -.Sy LPSV
    -commands to the address for
    -.Ar host
    -(which may be either a host name or IP address).
    -This may be useful in some firewall configurations, although many
    -ftp clients may not work if the address being advertised is different
    -to the address that they've connected to.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar host
    -not is specified, disable this.
    -.It Sy checkportcmd Ar class Op Sy off
    -Check the
    -.Sy PORT
    -command for validity.
    -The
    -.Sy PORT
    -command will fail if the IP address specified does not match the
    -.Tn FTP
    -command connection, or if the remote TCP port number is less than
    -.Dv IPPORT_RESERVED .
    -It is
    -.Em strongly
    -encouraged that this option be used, especially for sites concerned
    -with potential security problems with
    -.Tn FTP
    -bounce attacks.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Sy off
    -is specified, disable this feature, otherwise enable it.
    -.It Sy chroot Ar class Op Sy pathformat
    -If
    -.Ar pathformat
    -is not specified or
    -.Ar class
    -is
    -.Dq none ,
    -use the default behavior (see below).
    -Otherwise,
    -.Ar pathformat
    -is parsed to create a directory to create as the root directory with
    -.Xr chroot 2
    -into upon login.
    -.Pp
    -.Ar pathformat
    -can contain the following escape strings:
    -.Bl -tag -width "Escape" -offset indent -compact
    -.It Sy "Escape"
    -.Sy Description
    -.It "\&%c"
    -Class name.
    -.It "\&%d"
    -Home directory of user.
    -.It "\&%u"
    -User name.
    -.It "\&%\&%"
    -A
    -.Dq \&%
    -character.
    -.El
    -.Pp
    -The default root directory is:
    -.Bl -tag -width "CHROOT" -offset indent -compact
    -.It Sy CHROOT
    -The user's home directory.
    -.It Sy GUEST
    -If
    -.Fl a Ar anondir
    -is specified, use
    -.Ar anondir ,
    -otherwise the home directory of the
    -.Sq ftp
    -user.
    -.It Sy REAL
    -By default no
    -.Xr chroot 2
    -is performed.
    -.El
    -.It Sy classtype Ar class Ar type
    -Set the class type of
    -.Ar class
    -to
    -.Ar type
    -(see above).
    -.It Sy conversion Ar class Ar suffix Op Ar "type disable command"
    -Define an automatic in-line file conversion.
    -If a file to retrieve ends in
    -.Ar suffix ,
    -and a real file (sans
    -.Ar suffix )
    -exists, then the output of
    -.Ar command
    -is returned instead of the contents of the file.
    -.Pp
    -.Bl -tag -width "disable" -offset indent
    -.It Ar suffix
    -The suffix to initiate the conversion.
    -.It Ar type
    -A list of valid file types for the conversion.
    -Valid types are:
    -.Sq f
    -(file), and
    -.Sq d
    -(directory).
    -.It Ar disable
    -The name of file that will prevent conversion if it exists.
    -A file name of
    -.Dq Pa \&.
    -will prevent this disabling action
    -(i.e., the conversion is always permitted.)
    -.It Ar command
    -The command to run for the conversion.
    -The first word should be the full path name
    -of the command, as
    -.Xr execv 3
    -is used to execute the command.
    -All instances of the word
    -.Dq %s
    -in
    -.Ar command
    -are replaced with the requested file (sans
    -.Ar suffix ) .
    -.El
    -.Pp
    -Conversion directives specified later in the file override earlier
    -conversions with the same suffix.
    -.It Sy denyquick Ar class Op Sy off
    -Enforce
    -.Xr ftpusers 5
    -rules after the
    -.Sy USER
    -command is received, rather than after the
    -.Sy PASS
    -command is received.
    -Whilst enabling this feature may allow information leakage about
    -available accounts (for example, if you allow some users of a
    -.Sy REAL
    -or
    -.Sy CHROOT
    -class but not others), it is useful in preventing a denied user
    -(such as
    -.Sq root )
    -from entering their password across an insecure connection.
    -This option is
    -.Em strongly
    -recommended for servers which run an anonymous-only service.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Sy off
    -is specified, disable this feature, otherwise enable it.
    -.It Sy display Ar class Op Ar file
    -If
    -.Ar file
    -is not specified or
    -.Ar class
    -is
    -.Dq none ,
    -disable this.
    -Otherwise, each time the user enters a new directory, check if
    -.Ar file
    -exists, and if so, display its contents to the user.
    -Escape sequences are supported; refer to
    -.Sx Display file escape sequences
    -in
    -.Xr ftpd 8
    -for more information.
    -.It Sy hidesymlinks Ar class Op Sy off
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Sy off
    -is specified, disable this feature.
    -Otherwise, the
    -.Sy LIST
    -command lists symbolic links as the file or directory the link
    -references
    -.Pq Dq Li "ls -LlA" .
    -Servers which run an anonymous service may wish to enable this
    -feature for
    -.Sy GUEST
    -users, so that symbolic links do not leak names in
    -directories that are not searchable by
    -.Sy GUEST
    -users.
    -.It Sy homedir Ar class Op Sy pathformat
    -If
    -.Ar pathformat
    -is not specified or
    -.Ar class
    -is
    -.Dq none ,
    -use the default behavior (see below).
    -Otherwise,
    -.Ar pathformat
    -is parsed to create a directory to change into upon login, and to use
    -as the
    -.Sq home
    -directory of the user for tilde expansion in pathnames, etc.
    -.Ar pathformat
    -is parsed as per the
    -.Sy chroot
    -directive.
    -.Pp
    -The default home directory is the home directory of the user for
    -.Sy REAL
    -users, and
    -.Pa /
    -for
    -.Sy GUEST
    -and
    -.Sy CHROOT
    -users.
    -.It Sy limit Ar class Op Ar count Op Ar file
    -Limit the maximum number of concurrent connections for
    -.Ar class
    -to
    -.Ar count ,
    -with
    -.Sq \-1
    -meaning unlimited connections.
    -If the limit is exceeded and
    -.Ar file
    -is specified, display its contents to the user.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar count
    -is not specified, disable this.
    -If
    -.Ar file
    -is a relative path, it will be searched for in
    -.Pa /etc
    -(which can be overridden with
    -.Fl c Ar confdir ) .
    -.It Sy maxfilesize Ar class Op Ar size
    -Set the maximum size of an uploaded file to
    -.Ar size ,
    -with
    -.Sq \-1
    -meaning unlimited connections.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar size
    -is not specified, disable this.
    -.It Sy maxtimeout Ar class Op Ar time
    -Set the maximum timeout period that a client may request,
    -defaulting to two hours.
    -This cannot be less than 30 seconds, or the value for
    -.Sy timeout .
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar time
    -is not specified, use the default.
    -.It Sy mmapsize Ar class Op Ar size
    -Set the size of the sliding window to map a file using
    -.Xr mmap 2 .
    -If zero,
    -.Xr ftpd 8
    -will use
    -.Xr read 2
    -instead.
    -The default is zero.
    -This option affects only binary transfers.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar size
    -is not specified, use the default.
    -.It Sy modify Ar class Op Sy off
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Sy off
    -is specified, disable the following commands:
    -.Sy CHMOD ,
    -.Sy DELE ,
    -.Sy MKD ,
    -.Sy RMD ,
    -.Sy RNFR ,
    -and
    -.Sy UMASK .
    -Otherwise, enable them.
    -.It Sy motd Ar class Op Ar file
    -If
    -.Ar file
    -is not specified or
    -.Ar class
    -is
    -.Dq none ,
    -disable this.
    -Otherwise, use
    -.Ar file
    -as the message of the day file to display after login.
    -Escape sequences are supported; refer to
    -.Sx Display file escape sequences
    -in
    -.Xr ftpd 8
    -for more information.
    -If
    -.Ar file
    -is a relative path, it will be searched for in
    -.Pa /etc
    -(which can be overridden with
    -.Fl c Ar confdir ) .
    -.It Sy notify Ar class Op Ar fileglob
    -If
    -.Ar fileglob
    -is not specified or
    -.Ar class
    -is
    -.Dq none ,
    -disable this.
    -Otherwise, each time the user enters a new directory,
    -notify the user of any files matching
    -.Ar fileglob .
    -.It Sy passive Ar class Op Sy off
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Sy off
    -is specified, prevent passive
    -.Sy ( PASV ,
    -.Sy LPSV ,
    -and
    -.Sy EPSV )
    -connections.
    -Otherwise, enable them.
    -.It Sy portrange Ar class Op Ar min Ar max
    -Set the range of port number which will be used for the passive data port.
    -.Ar max
    -must be greater than
    -.Ar min ,
    -and both numbers must be be between
    -.Dv IPPORT_RESERVED
    -(1024) and 65535.
    -If
    -.Ar class
    -is
    -.Dq none
    -or no arguments are specified, disable this.
    -.It Sy private Ar class Op Sy off
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Sy off
    -is specified, do not display class information in the output of the
    -.Sy STAT
    -command.
    -Otherwise, display the information.
    -.It Sy rateget Ar class Op Ar rate
    -Set the maximum get
    -.Pq Sy RETR
    -transfer rate throttle for
    -.Ar class
    -to
    -.Ar rate
    -bytes per second.
    -If
    -.Ar rate
    -is 0, the throttle is disabled.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar rate
    -is not specified, disable this.
    -.It Sy rateput Ar class Op Ar rate
    -Set the maximum put
    -.Pq Sy STOR
    -transfer rate throttle for
    -.Ar class
    -to
    -.Ar rate
    -bytes per second.
    -If
    -.Ar rate
    -is 0, the throttle is disabled.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar rate
    -is not specified, disable this.
    -.It Sy readsize Ar class Op Ar size
    -Set the size of the read buffer to
    -.Xr read 2
    -a file.
    -The default is the file system block size.
    -This option affects only binary transfers.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar size
    -is not specified, use the default.
    -.It Sy recvbufsize Ar class Op Ar size
    -Set the size of the socket receive buffer.
    -The default is zero and the system default value will be used.
    -This option affects only passive transfers.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar size
    -is not specified, use the default.
    -.It Sy sanenames Ar class Op Sy off
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Sy off
    -is specified, allow uploaded file names to contain any characters valid for a
    -file name.
    -Otherwise, only permit file names which don't start with a
    -.Sq \&.
    -and only comprise of characters from the set
    -.Dq [-+,._A-Za-z0-9] .
    -.It Sy sendbufsize Ar class Op Ar size
    -Set the size of the socket send buffer.
    -The default is zero and the system default value will be used.
    -This option affects only binary transfers.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar size
    -is not specified, use the default.
    -.It Sy sendlowat Ar class Op Ar size
    -Set the low water mark of socket send buffer.
    -The default is zero and system default value will be used.
    -This option affects only for binary transfer.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar size
    -is not specified, use the default.
    -.It Sy template Ar class Op Ar refclass
    -Define
    -.Ar refclass
    -as the
    -.Sq template
    -for
    -.Ar class ;
    -any reference to
    -.Ar refclass
    -in following directives will also apply to members of
    -.Ar class .
    -This is useful to define a template class so that other classes which are
    -to share common attributes can be easily defined without unnecessary
    -duplication.
    -There can be only one template defined at a time.
    -If
    -.Ar refclass
    -is not specified, disable the template for
    -.Ar class .
    -.It Sy timeout Ar class Op Ar time
    -Set the inactivity timeout period.
    -(the default is fifteen minutes).
    -This cannot be less than 30 seconds, or greater than the value for
    -.Sy maxtimeout .
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar time
    -is not specified, use the default.
    -.It Sy umask Ar class Op Ar umaskval
    -Set the umask to
    -.Ar umaskval .
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar umaskval
    -is not specified, set to the default of
    -.Li 027 .
    -.It Sy upload Ar class Op Sy off
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Sy off
    -is specified, disable the following commands:
    -.Sy APPE ,
    -.Sy STOR ,
    -and
    -.Sy STOU ,
    -as well as the modify commands:
    -.Sy CHMOD ,
    -.Sy DELE ,
    -.Sy MKD ,
    -.Sy RMD ,
    -.Sy RNFR ,
    -and
    -.Sy UMASK .
    -Otherwise, enable them.
    -.It Sy writesize Ar class Op Ar size
    -Limit the number of bytes to
    -.Xr write 2
    -at a time.
    -The default is zero, which means all the data available as a result of
    -.Xr mmap 2
    -or
    -.Xr read 2
    -will be written at a time.
    -This option affects only binary transfers.
    -If
    -.Ar class
    -is
    -.Dq none
    -or
    -.Ar size
    -is not specified, use the default.
    -.El
    -.Ss Numeric argument suffix parsing
    -Where command arguments are numeric, a decimal number is expected.
    -Two or more numbers may be separated by an
    -.Dq x
    -to indicate a product.
    -Each number may have one of the following optional suffixes:
    -.Bl -tag -width 3n -offset indent -compact
    -.It b
    -Block; multiply by 512
    -.It k
    -Kibi; multiply by 1024 (1 KiB)
    -.It m
    -Mebi; multiply by 1048576 (1 MiB)
    -.It g
    -Gibi; multiply by 1073741824 (1 GiB)
    -.It t
    -Tebi; multiply by 1099511627776 (1 TiB)
    -.It w
    -Word; multiply by the number of bytes in an integer
    -.El
    -.Pp
    -See
    -.Xr strsuftoll 3
    -for more information.
    -.Sh DEFAULTS
    -The following defaults are used:
    -.Pp
    -.Bd -literal -offset indent -compact
    -checkportcmd  all
    -classtype     chroot CHROOT
    -classtype     guest  GUEST
    -classtype     real   REAL
    -display       none
    -limit         all    \-1     # unlimited connections
    -maxtimeout    all    7200   # 2 hours
    -modify        all
    -motd          all    motd
    -notify        none
    -passive       all
    -timeout       all    900    # 15 minutes
    -umask         all    027
    -upload        all
    -modify        guest  off
    -umask         guest  0707
    -.Ed
    -.Sh FILES
    -.Bl -tag -width /usr/share/examples/ftpd/ftpd.conf -compact
    -.It Pa /etc/ftpd.conf
    -This file.
    -.It Pa /usr/share/examples/ftpd/ftpd.conf
    -A sample
    -.Nm
    -file.
    -.El
    -.Sh SEE ALSO
    -.Xr strsuftoll 3 ,
    -.Xr ftpchroot 5 ,
    -.Xr ftpusers 5 ,
    -.Xr ftpd 8
    -.Sh HISTORY
    -The
    -.Nm
    -functionality was implemented in
    -.Nx 1.3
    -and later releases by Luke Mewburn, based on work by Simon Burge.
    diff --git a/libexec/ftpd/ftpusers.5 b/libexec/ftpd/ftpusers.5
    deleted file mode 100644
    index 285f385f3..000000000
    --- a/libexec/ftpd/ftpusers.5
    +++ /dev/null
    @@ -1,179 +0,0 @@
    -.\"	$NetBSD: ftpusers.5,v 1.17 2008/09/13 02:41:52 lukem Exp $
    -.\"
    -.\" Copyright (c) 1997-2008 The NetBSD Foundation, Inc.
    -.\" All rights reserved.
    -.\"
    -.\" This code is derived from software contributed to The NetBSD Foundation
    -.\" by Luke Mewburn.
    -.\"
    -.\" Redistribution and use in source and binary forms, with or without
    -.\" modification, are permitted provided that the following conditions
    -.\" are met:
    -.\" 1. Redistributions of source code must retain the above copyright
    -.\"    notice, this list of conditions and the following disclaimer.
    -.\" 2. Redistributions in binary form must reproduce the above copyright
    -.\"    notice, this list of conditions and the following disclaimer in the
    -.\"    documentation and/or other materials provided with the distribution.
    -.\"
    -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    -.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    -.\" POSSIBILITY OF SUCH DAMAGE.
    -.\"
    -.Dd July 17, 2000
    -.Dt FTPUSERS 5
    -.Os
    -.Sh NAME
    -.Nm ftpusers ,
    -.Nm ftpchroot
    -.Nd
    -.Xr ftpd 8
    -access control file
    -.Sh DESCRIPTION
    -The
    -.Nm
    -file provides user access control for
    -.Xr ftpd 8
    -by defining which users may login.
    -.Pp
    -If the
    -.Nm
    -file does not exist, all users are denied access.
    -.Pp
    -A
    -.Dq \e
    -is the escape character; it can be used to escape the meaning of the
    -comment character, or if it is the last character on a line, extends
    -a configuration directive across multiple lines.
    -A
    -.Dq #
    -is the comment character, and all characters from it to the end of
    -line are ignored (unless it is escaped with the escape character).
    -.Pp
    -The syntax of each line is:
    -.Dl userglob[:groupglob][@host] [directive [class]]
    -.Pp
    -These elements are:
    -.Bl -tag -width "groupglob" -offset indent
    -.It Sy userglob
    -matched against the user name, using
    -.Xr fnmatch 3
    -glob matching
    -(e.g,
    -.Sq f* ) .
    -.It Sy groupglob
    -matched against all the groups that the user is a member of, using
    -.Xr fnmatch 3
    -glob matching
    -(e.g,
    -.Sq *src ) .
    -.It Sy host
    -either a CIDR address (refer to
    -.Xr inet_net_pton 3 )
    -to match against the remote address
    -(e.g,
    -.Sq 1.2.3.4/24 ) ,
    -or an
    -.Xr fnmatch 3
    -glob to match against the remote hostname
    -(e.g,
    -.Sq *.NetBSD.org ) .
    -.It Sy directive
    -If
    -.Dq allow
    -or
    -.Dq yes
    -the user is allowed access.
    -If
    -.Dq deny
    -or
    -.Dq no ,
    -or
    -.Sy directive
    -is not given, the user is denied access.
    -.It Sy class
    -defines the class to use in
    -.Xr ftpd.conf 5 .
    -.El
    -.Pp
    -If
    -.Sy class
    -is not given, it defaults to one of the following:
    -.Bl -tag -width "chroot" -offset indent
    -.It Sy chroot
    -If there is a match in
    -.Sx /etc/ftpchroot
    -for the user.
    -.It Sy guest
    -If the user name is
    -.Dq anonymous
    -or
    -.Sq ftp .
    -.It Sy real
    -If neither of the above is true.
    -.El
    -.Pp
    -No further comparisons are attempted after the first successful match.
    -If no match is found, the user is granted access.
    -This syntax is backward-compatible with the old syntax.
    -.Pp
    -If a user requests a guest login, the
    -.Xr ftpd 8
    -server checks to see that
    -both
    -.Dq anonymous
    -and
    -.Dq ftp
    -have access, so if you deny all users by default, you will need to add both
    -.Dq "anonymous allow"
    -and
    -.Dq "ftp allow"
    -to
    -.Pa /etc/ftpusers
    -in order to allow guest logins.
    -.Ss /etc/ftpchroot
    -The file
    -.Pa /etc/ftpchroot
    -is used to determine which users will have their session's root directory
    -changed (using
    -.Xr chroot 2 ) ,
    -either to the directory specified in the
    -.Xr ftpd.conf 5
    -.Sy chroot
    -directive (if set),
    -or to the home directory of the user.
    -If the file does not exist, the root directory change is not performed.
    -.Pp
    -The syntax is similar to
    -.Nm ,
    -except that the
    -.Sy class
    -argument is ignored.
    -If there's a positive match, the session's root directory is changed.
    -No further comparisons are attempted after the first successful match.
    -This syntax is backward-compatible with the old syntax.
    -.Sh FILES
    -.Bl -tag -width /usr/share/examples/ftpd/ftpusers -compact
    -.It Pa /etc/ftpchroot
    -List of normal users who should have their ftp session's root directory
    -changed by using
    -.Xr chroot 2 .
    -.It Pa /etc/ftpusers
    -This file.
    -.It Pa /usr/share/examples/ftpd/ftpusers
    -A sample
    -.Nm
    -file.
    -.El
    -.Sh SEE ALSO
    -.Xr fnmatch 3 ,
    -.Xr inet_net_pton 3 ,
    -.Xr ftpd.conf 5 ,
    -.Xr ftpd 8
    diff --git a/libexec/ftpd/logutmp.c b/libexec/ftpd/logutmp.c
    deleted file mode 100644
    index eacd9eb8e..000000000
    --- a/libexec/ftpd/logutmp.c
    +++ /dev/null
    @@ -1,172 +0,0 @@
    -/*	$NetBSD: logutmp.c,v 1.12 2011/09/16 16:13:17 plunky Exp $	*/
    -
    -/*
    - * Portions Copyright (c) 1988, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -/*
    - * Portions Copyright (c) 1996, Jason Downs.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
    - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    - * DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
    - * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
    - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    - * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -#include 
    -#ifndef lint
    -__RCSID("$NetBSD: logutmp.c,v 1.12 2011/09/16 16:13:17 plunky Exp $");
    -#endif /* not lint */
    -
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#ifdef SUPPORT_UTMPX
    -#include 
    -#endif
    -#include 
    -
    -#include "extern.h"
    -
    -#ifdef SUPPORT_UTMP
    -typedef struct utmp UTMP;
    -
    -static int fd = -1;
    -static int topslot = -1;
    -
    -/*
    - * Special versions of login()/logout() which hold the utmp file open,
    - * for use with ftpd.
    - */
    -
    -void
    -ftpd_login(const struct utmp *ut)
    -{
    -	UTMP ubuf;
    -
    -	/*
    -	 * First, loop through /etc/ttys, if needed, to initialize the
    -	 * top of the tty slots, since ftpd has no tty.
    -	 */
    -	if (topslot < 0) {
    -		topslot = 0;
    -		while (getttyent() != NULL)
    -			topslot++;
    -	}
    -	if ((topslot < 0) || ((fd < 0)
    -	    && (fd = open(_PATH_UTMP, O_RDWR|O_CREAT, 0644)) < 0))
    -		return;
    -
    -	/*
    -	 * Now find a slot that's not in use...
    -	 */
    -	(void)lseek(fd, (off_t)(topslot * sizeof(UTMP)), SEEK_SET);
    -
    -	while (1) {
    -		if (read(fd, &ubuf, sizeof(UTMP)) == sizeof(UTMP)) {
    -			if (!ubuf.ut_name[0]) {
    -				(void)lseek(fd, -(off_t)sizeof(UTMP), SEEK_CUR);
    -				break;
    -			}
    -			topslot++;
    -		} else {
    -			(void)lseek(fd, (off_t)(topslot * sizeof(UTMP)),
    -			    SEEK_SET);
    -			break;
    -		}
    -	}
    -
    -	(void)write(fd, ut, sizeof(UTMP));
    -}
    -
    -int
    -ftpd_logout(const char *line)
    -{
    -	UTMP ut;
    -	int rval;
    -
    -	rval = 0;
    -	if (fd < 0)
    -		return(rval);
    -
    -	(void)lseek(fd, 0, SEEK_SET);
    -
    -	while (read(fd, &ut, sizeof(UTMP)) == sizeof(UTMP)) {
    -		if (!ut.ut_name[0]
    -		    || strncmp(ut.ut_line, line, UT_LINESIZE))
    -			continue;
    -		memset(ut.ut_name, 0, UT_NAMESIZE);
    -		memset(ut.ut_host, 0, UT_HOSTSIZE);
    -		(void)time(&ut.ut_time);
    -		(void)lseek(fd, -(off_t)sizeof(UTMP), SEEK_CUR);
    -		(void)write(fd, &ut, sizeof(UTMP));
    -		rval = 1;
    -	}
    -	return(rval);
    -}
    -#endif /* SUPPORT_UTMP */
    -
    -#ifdef SUPPORT_UTMPX
    -/*
    - * special version of loginx which updates utmpx only.
    - */
    -void
    -ftpd_loginx(const struct utmpx *ut)
    -{
    -	(void)pututxline(ut);
    -}
    -
    -int
    -ftpd_logoutx(const char *line, int status, int mode)
    -{
    -	return logoutx(line, status, mode);
    -}
    -#endif
    diff --git a/libexec/ftpd/logwtmp.c b/libexec/ftpd/logwtmp.c
    deleted file mode 100644
    index a1f2babe1..000000000
    --- a/libexec/ftpd/logwtmp.c
    +++ /dev/null
    @@ -1,144 +0,0 @@
    -/*	$NetBSD: logwtmp.c,v 1.27 2015/08/09 20:34:24 shm Exp $	*/
    -
    -/*
    - * Copyright (c) 1988, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - */
    -
    -
    -#include 
    -#ifndef lint
    -#if 0
    -static char sccsid[] = "@(#)logwtmp.c	8.1 (Berkeley) 6/4/93";
    -#else
    -__RCSID("$NetBSD: logwtmp.c,v 1.27 2015/08/09 20:34:24 shm Exp $");
    -#endif
    -#endif /* not lint */
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#ifdef SUPPORT_UTMP
    -#include 
    -#endif
    -#ifdef SUPPORT_UTMPX
    -#include 
    -#endif
    -#include 
    -
    -#ifdef KERBEROS5
    -#include 
    -#endif
    -
    -#include "extern.h"
    -
    -#ifdef SUPPORT_UTMP
    -static int fd = -1;
    -
    -void
    -ftpd_initwtmp(void)
    -{
    -	const char *wf = _PATH_WTMP;
    -	if ((fd = open(wf, O_WRONLY|O_APPEND, 0)) == -1)
    -		syslog(LOG_ERR, "Cannot open `%s' (%m)", wf);
    -}
    -
    -/*
    - * Modified version of logwtmp that holds wtmp file open
    - * after first call, for use with ftp (which may chroot
    - * after login, but before logout).
    - */
    -void
    -ftpd_logwtmp(const char *line, const char *name, const char *host)
    -{
    -	struct utmp ut;
    -	struct stat buf;
    -
    -	if (fd < 0)
    -		return;
    -	if (fstat(fd, &buf) == 0) {
    -		(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
    -		(void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
    -		(void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
    -		(void)time(&ut.ut_time);
    -		if (write(fd, (char *)&ut, sizeof(struct utmp)) !=
    -		    sizeof(struct utmp))
    -			(void)ftruncate(fd, buf.st_size);
    -	}
    -}
    -#endif
    -
    -#ifdef SUPPORT_UTMPX
    -static int fdx = -1;
    -
    -void
    -ftpd_initwtmpx(void)
    -{
    -	const char *wf = _PATH_WTMPX;
    -	if ((fdx = open(wf, O_WRONLY|O_APPEND, 0)) == -1)
    -		syslog(LOG_ERR, "Cannot open `%s' (%m)", wf);
    -}
    -
    -void
    -ftpd_logwtmpx(const char *line, const char *name, const char *host,
    -    struct sockinet *haddr, int status, int utx_type)
    -{
    -	struct utmpx ut;
    -	struct stat buf;
    -	
    -	if (fdx < 0) 
    -		return;
    -	if (fstat(fdx, &buf) == 0) {
    -		(void)memset(&ut, 0, sizeof(ut));
    -		(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
    -		(void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
    -		(void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
    -		if (haddr)
    -			(void)memcpy(&ut.ut_ss, &haddr->si_su, haddr->su_len);
    -		ut.ut_type = utx_type;
    -		if (WIFEXITED(status))
    -			ut.ut_exit.e_exit = (uint16_t)WEXITSTATUS(status);
    -		if (WIFSIGNALED(status))
    -		ut.ut_exit.e_termination = (uint16_t)WTERMSIG(status);
    -		(void)gettimeofday(&ut.ut_tv, NULL);
    -		if(write(fdx, (char *)&ut, sizeof(struct utmpx)) !=
    -		    sizeof(struct utmpx))
    -			(void)ftruncate(fdx, buf.st_size);
    -	}
    -}
    -#endif
    diff --git a/libexec/ftpd/pathnames.h b/libexec/ftpd/pathnames.h
    deleted file mode 100644
    index 9e127bb9f..000000000
    --- a/libexec/ftpd/pathnames.h
    +++ /dev/null
    @@ -1,48 +0,0 @@
    -/*	$NetBSD: pathnames.h,v 1.12 2004/12/11 18:37:26 christos Exp $	*/
    -
    -/*
    - * Copyright (c) 1989, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - *	@(#)pathnames.h	8.1 (Berkeley) 6/4/93
    - */
    -
    -#include 
    -
    -#ifndef	_DEFAULT_CONFDIR
    -#define	_DEFAULT_CONFDIR	"/etc"
    -#endif
    -
    -#define	_NAME_FTPCHROOT		"ftpchroot"
    -#define	_NAME_FTPDCONF		"ftpd.conf"
    -#define	_NAME_FTPLOGINMESG	"motd"
    -#define	_NAME_FTPUSERS		"ftpusers"
    -#define	_NAME_FTPWELCOME	"ftpwelcome"
    -
    -#define _PATH_CLASSPIDS		"/var/run/ftpd.pids-"
    -
    -#define	TMPFILE			"/tmp/ftpdXXXXXXX"
    diff --git a/libexec/ftpd/pfilter.c b/libexec/ftpd/pfilter.c
    deleted file mode 100644
    index aa121c970..000000000
    --- a/libexec/ftpd/pfilter.c
    +++ /dev/null
    @@ -1,24 +0,0 @@
    -#include 
    -#include 
    -
    -#include "pfilter.h"
    -
    -static struct blacklist *blstate;
    -
    -void
    -pfilter_open(void)
    -{
    -	if (blstate == NULL)
    -		blstate = blacklist_open();
    -}
    -
    -void
    -pfilter_notify(int what, const char *msg)
    -{
    -	pfilter_open();
    -
    -	if (blstate == NULL)
    -		return;
    -
    -	blacklist_r(blstate, what, 0, msg);
    -}
    diff --git a/libexec/ftpd/pfilter.h b/libexec/ftpd/pfilter.h
    deleted file mode 100644
    index 3452d7264..000000000
    --- a/libexec/ftpd/pfilter.h
    +++ /dev/null
    @@ -1,2 +0,0 @@
    -void pfilter_open(void);
    -void pfilter_notify(int, const char *);
    diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c
    deleted file mode 100644
    index ed52dc094..000000000
    --- a/libexec/ftpd/popen.c
    +++ /dev/null
    @@ -1,245 +0,0 @@
    -/*	$NetBSD: popen.c,v 1.37 2010/03/20 18:23:30 christos Exp $	*/
    -
    -/*-
    - * Copyright (c) 1999-2009 The NetBSD Foundation, Inc.
    - * All rights reserved.
    - *
    - * This code is derived from software contributed to The NetBSD Foundation
    - * by Luke Mewburn.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    - * POSSIBILITY OF SUCH DAMAGE.
    - */
    -
    -/*
    - * Copyright (c) 1988, 1993, 1994
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * This code is derived from software written by Ken Arnold and
    - * published in UNIX Review, Vol. 6, No. 8.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - */
    -
    -#include 
    -#ifndef lint
    -#if 0
    -static char sccsid[] = "@(#)popen.c	8.3 (Berkeley) 4/6/94";
    -#else
    -__RCSID("$NetBSD: popen.c,v 1.37 2010/03/20 18:23:30 christos Exp $");
    -#endif
    -#endif /* not lint */
    -
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#ifdef KERBEROS5
    -#include 
    -#endif
    -
    -#include "extern.h"
    -
    -#define INCR	100
    -/*
    - * Special version of popen which avoids call to shell.  This ensures no-one
    - * may create a pipe to a hidden program as a side effect of a list or dir
    - * command.
    - * If stderrfd != -1, then send stderr of a read command there,
    - * otherwise close stderr.
    - */
    -static int *pids;
    -static int fds;
    -
    -extern int ls_main(int, char *[]);
    -
    -FILE *
    -ftpd_popen(const char *argv[], const char *ptype, int stderrfd)
    -{
    -	FILE *iop;
    -	int argc, pdes[2], pid;
    -	volatile int isls;
    -	char **pop;
    -	StringList *sl;
    -
    -	iop = NULL;
    -	isls = 0;
    -	if ((*ptype != 'r' && *ptype != 'w') || ptype[1])
    -		return (NULL);
    -
    -	if (!pids) {
    -		if ((fds = getdtablesize()) <= 0)
    -			return (NULL);
    -		if ((pids = (int *)malloc((unsigned int)(fds * sizeof(int)))) == NULL)
    -			return (NULL);
    -		memset(pids, 0, fds * sizeof(int));
    -	}
    -	if (pipe(pdes) < 0)
    -		return (NULL);
    -
    -	if ((sl = sl_init()) == NULL)
    -		goto pfree;
    -
    -					/* glob each piece */
    -	if (sl_add(sl, ftpd_strdup(argv[0])) == -1)
    -		goto pfree;
    -	for (argc = 1; argv[argc]; argc++) {
    -		glob_t gl;
    -		int flags = GLOB_BRACE|GLOB_NOCHECK|GLOB_TILDE|GLOB_LIMIT;
    -
    -		memset(&gl, 0, sizeof(gl));
    -		if (glob(argv[argc], flags, NULL, &gl)
    -		    || gl.gl_pathv == NULL)  {
    -			if (sl_add(sl, ftpd_strdup(argv[argc])) == -1) {
    -				globfree(&gl);
    -				goto pfree;
    -			}
    -		} else {
    -			for (pop = gl.gl_pathv; *pop; pop++) {
    -				if (sl_add(sl, ftpd_strdup(*pop)) == -1) {
    -					globfree(&gl);
    -					goto pfree;
    -				}
    -			}
    -		}
    -		globfree(&gl);
    -	}
    -	if (sl_add(sl, NULL) == -1)
    -		goto pfree;
    -
    -#ifndef NO_INTERNAL_LS
    -	isls = (strcmp(sl->sl_str[0], INTERNAL_LS) == 0);
    -#endif
    -
    -	pid = isls ? fork() : vfork();
    -	switch (pid) {
    -	case -1:			/* error */
    -		(void)close(pdes[0]);
    -		(void)close(pdes[1]);
    -		goto pfree;
    -		/* NOTREACHED */
    -	case 0:				/* child */
    -		if (*ptype == 'r') {
    -			if (pdes[1] != STDOUT_FILENO) {
    -				dup2(pdes[1], STDOUT_FILENO);
    -				(void)close(pdes[1]);
    -			}
    -			if (stderrfd == -1)
    -				(void)close(STDERR_FILENO);
    -			else
    -				dup2(stderrfd, STDERR_FILENO);
    -			(void)close(pdes[0]);
    -		} else {
    -			if (pdes[0] != STDIN_FILENO) {
    -				dup2(pdes[0], STDIN_FILENO);
    -				(void)close(pdes[0]);
    -			}
    -			(void)close(pdes[1]);
    -		}
    -#ifndef NO_INTERNAL_LS
    -		if (isls) {	/* use internal ls */
    -			optreset = optind = optopt = 1;
    -			closelog();
    -			exit(ls_main(sl->sl_cur - 1, sl->sl_str));
    -		}
    -#endif
    -
    -		execv(sl->sl_str[0], sl->sl_str);
    -		_exit(1);
    -	}
    -	/* parent; assume fdopen can't fail...  */
    -	if (*ptype == 'r') {
    -		iop = fdopen(pdes[0], ptype);
    -		(void)close(pdes[1]);
    -	} else {
    -		iop = fdopen(pdes[1], ptype);
    -		(void)close(pdes[0]);
    -	}
    -	pids[fileno(iop)] = pid;
    -
    - pfree:
    -	if (sl)
    -		sl_free(sl, 1);
    -	return (iop);
    -}
    -
    -int
    -ftpd_pclose(FILE *iop)
    -{
    -	int fdes, status;
    -	pid_t pid;
    -	sigset_t nsigset, osigset;
    -
    -	/*
    -	 * pclose returns -1 if stream is not associated with a
    -	 * `popened' command, or, if already `pclosed'.
    -	 */
    -	if (pids == 0 || pids[fdes = fileno(iop)] == 0)
    -		return (-1);
    -	(void)fclose(iop);
    -	sigemptyset(&nsigset);
    -	sigaddset(&nsigset, SIGINT);
    -	sigaddset(&nsigset, SIGQUIT);
    -	sigaddset(&nsigset, SIGHUP);
    -	sigprocmask(SIG_BLOCK, &nsigset, &osigset);
    -	while ((pid = waitpid(pids[fdes], &status, 0)) < 0 && errno == EINTR)
    -		continue;
    -	sigprocmask(SIG_SETMASK, &osigset, NULL);
    -	pids[fdes] = 0;
    -	if (pid < 0)
    -		return (pid);
    -	if (WIFEXITED(status))
    -		return (WEXITSTATUS(status));
    -	return (1);
    -}
    diff --git a/libexec/ftpd/version.h b/libexec/ftpd/version.h
    deleted file mode 100644
    index 0d165114f..000000000
    --- a/libexec/ftpd/version.h
    +++ /dev/null
    @@ -1,33 +0,0 @@
    -/*	$NetBSD: version.h,v 1.75 2013/03/21 00:17:26 lukem Exp $	*/
    -/*-
    - * Copyright (c) 1999-2013 The NetBSD Foundation, Inc.
    - * All rights reserved.
    - *
    - * This code is derived from software contributed to The NetBSD Foundation
    - * by Luke Mewburn.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
    - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
    - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    - * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
    - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
    - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
    - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
    - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
    - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    - * POSSIBILITY OF SUCH DAMAGE.
    - */
    -
    -#ifndef FTPD_VERSION
    -#define	FTPD_VERSION	"NetBSD-ftpd 20110904"
    -#endif
    diff --git a/libexec/getty/Makefile b/libexec/getty/Makefile
    deleted file mode 100644
    index e76f579fb..000000000
    --- a/libexec/getty/Makefile
    +++ /dev/null
    @@ -1,10 +0,0 @@
    -#	$NetBSD: Makefile,v 1.20 2013/08/11 05:42:41 dholland Exp $
    -#	from: @(#)Makefile	8.1 (Berkeley) 6/4/93
    -
    -PROG=	getty
    -SRCS=	main.c init.c subr.c
    -DPADD+=	${LIBUTIL} ${LIBTERMINFO}
    -LDADD+=	-lutil -lterminfo
    -MAN=	getty.8 gettytab.5 ttys.5
    -
    -.include 
    diff --git a/libexec/getty/extern.h b/libexec/getty/extern.h
    deleted file mode 100644
    index 8084c9a09..000000000
    --- a/libexec/getty/extern.h
    +++ /dev/null
    @@ -1,52 +0,0 @@
    -/*	$NetBSD: extern.h,v 1.7 2013/08/11 05:42:41 dholland Exp $	*/
    -
    -/*
    - * Copyright (c) 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - *	from: @(#)extern.h	8.1 (Berkeley) 6/4/93
    - */
    -
    -struct delayval;
    -
    -int	 adelay(int, struct delayval *);
    -const char *autobaud(void);
    -int	 delaybits(void);
    -void	 edithost(const char *);
    -void	 gendefaults(void);
    -int	 getent(char *, char *);
    -int	 getflag(char *);
    -long	 getnum(char *);
    -char	*getstr(char *, char **);
    -void	 gettable(const char *, char *);
    -void	 makeenv(char *[]);
    -const char *portselector(void);
    -void	 set_ttydefaults(int);
    -void	 setchars(void);
    -void	 setdefaults(void);
    -void	 setflags(int);
    -int	 speed(int);
    diff --git a/libexec/getty/getty.8 b/libexec/getty/getty.8
    deleted file mode 100644
    index 60ebb4e31..000000000
    --- a/libexec/getty/getty.8
    +++ /dev/null
    @@ -1,178 +0,0 @@
    -.\"	$NetBSD: getty.8,v 1.18 2013/05/29 15:02:12 wiz Exp $
    -.\"
    -.\" Copyright (c) 1980, 1991, 1993
    -.\"	The Regents of the University of California.  All rights reserved.
    -.\"
    -.\" Redistribution and use in source and binary forms, with or without
    -.\" modification, are permitted provided that the following conditions
    -.\" are met:
    -.\" 1. Redistributions of source code must retain the above copyright
    -.\"    notice, this list of conditions and the following disclaimer.
    -.\" 2. Redistributions in binary form must reproduce the above copyright
    -.\"    notice, this list of conditions and the following disclaimer in the
    -.\"    documentation and/or other materials provided with the distribution.
    -.\" 3. Neither the name of the University nor the names of its contributors
    -.\"    may be used to endorse or promote products derived from this software
    -.\"    without specific prior written permission.
    -.\"
    -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    -.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    -.\" SUCH DAMAGE.
    -.\"
    -.\"     from: @(#)getty.8	8.1 (Berkeley) 6/4/93
    -.\"
    -.Dd May 29, 2013
    -.Dt GETTY 8
    -.Os
    -.Sh NAME
    -.Nm getty ,
    -.Nm uugetty
    -.Nd set terminal modes for system access
    -.Sh SYNOPSIS
    -.Nm
    -.Oo
    -.Ar type
    -.Op Ar tty
    -.Oc
    -.Nm uugetty
    -.Oo
    -.Ar type
    -.Op Ar tty
    -.Oc
    -.Sh DESCRIPTION
    -The
    -.Nm
    -program
    -is called by
    -.Xr init 8
    -to open and initialize the tty line, read a login name, and invoke
    -.Xr login 1 .
    -The devices on which to run
    -.Nm
    -are normally determined by
    -.Xr ttys 5 .
    -.Pp
    -The
    -.Nm
    -program can also recognize a Point to Point Protocol
    -.Pq Tn PPP
    -negotiation, and, if the
    -.Sy pp
    -attribute in
    -.Xr gettytab 5
    -is set, invoke the program given by that string, e.g.,
    -.Xr pppd 8 ,
    -instead of
    -.Xr login 1 .
    -This makes it possible to use a single serial port for either a
    -.Qq shell
    -account with command line interface, or a
    -.Tn PPP
    -network link.
    -.Pp
    -The argument
    -.Ar tty
    -is the special device file in
    -.Pa /dev
    -to open for the terminal
    -.Po
    -for example,
    -.Qq ttyh0
    -.Pc .
    -If there is no argument or the argument is
    -.Ql Fl ,
    -the tty line is assumed to be open as file descriptor 0.
    -.Pp
    -The
    -.Ar type
    -argument can be used to make
    -.Nm
    -treat the terminal line specially.
    -This argument is used as an index into the
    -.Xr gettytab 5
    -database, to determine the characteristics of the line.
    -If there is no argument, or there is no such table, the
    -.Em default
    -table is used.
    -If there is no
    -.Pa /etc/gettytab
    -a set of system defaults is used.
    -If indicated by the table located,
    -.Nm
    -will clear the terminal screen,
    -print a banner heading,
    -and prompt for a login name.
    -Usually either the banner or the login prompt will include
    -the system hostname.
    -.Pp
    -.Nm
    -uses the
    -.Xr ttyaction 3
    -facility with an action of
    -.Qq getty
    -and user
    -.Qq root
    -to execute site-specific commands when it starts.
    -.Pp
    -Most of the default actions of
    -.Nm
    -can be circumvented, or modified, by a suitable
    -.Xr gettytab 5
    -table.
    -.Pp
    -The
    -.Nm
    -program can be set to timeout after some interval,
    -which will cause dial up lines to hang up
    -if the login name is not entered reasonably quickly.
    -.Pp
    -The
    -.Nm uugetty
    -program is the same, except that it uses
    -.Xr pidlock 3
    -to respect the locks in
    -.Pa /var/spool/lock
    -of processes that dial out on that tty.
    -.Sh FILES
    -.Bl -tag -width /var/spool/lock/LCK..ttyXX -compact
    -.It Pa /etc/gettytab
    -.It Pa /etc/ttys
    -.It Pa /usr/libexec/getty
    -.It Pa /var/spool/lock/LCK..ttyXX
    -.El
    -.Sh DIAGNOSTICS
    -.Bl -diag
    -.It "ttyxx: No such device or address."
    -.It "ttyxx: No such file or address."
    -A terminal which is turned on in the
    -.Xr ttys 5
    -file cannot be opened, likely because the requisite
    -lines are either not configured into the system, the associated device
    -was not attached during boot-time system configuration,
    -or the special file in
    -.Pa /dev
    -does not exist.
    -.El
    -.Sh SEE ALSO
    -.Xr login 1 ,
    -.Xr ioctl 2 ,
    -.Xr pidlock 3 ,
    -.Xr ttyaction 3 ,
    -.Xr tty 4 ,
    -.Xr gettytab 5 ,
    -.Xr ttys 5 ,
    -.Xr init 8 ,
    -.Xr pppd 8
    -.Sh HISTORY
    -A
    -.Nm
    -program appeared in
    -.At v6 .
    diff --git a/libexec/getty/gettytab.5 b/libexec/getty/gettytab.5
    deleted file mode 100644
    index f2e7bde3c..000000000
    --- a/libexec/getty/gettytab.5
    +++ /dev/null
    @@ -1,423 +0,0 @@
    -.\"	$NetBSD: gettytab.5,v 1.36 2012/04/21 12:27:28 roy Exp $
    -.\"
    -.\" Copyright (c) 1983, 1991, 1993
    -.\"	The Regents of the University of California.  All rights reserved.
    -.\"
    -.\" Redistribution and use in source and binary forms, with or without
    -.\" modification, are permitted provided that the following conditions
    -.\" are met:
    -.\" 1. Redistributions of source code must retain the above copyright
    -.\"    notice, this list of conditions and the following disclaimer.
    -.\" 2. Redistributions in binary form must reproduce the above copyright
    -.\"    notice, this list of conditions and the following disclaimer in the
    -.\"    documentation and/or other materials provided with the distribution.
    -.\" 3. Neither the name of the University nor the names of its contributors
    -.\"    may be used to endorse or promote products derived from this software
    -.\"    without specific prior written permission.
    -.\"
    -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    -.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    -.\" SUCH DAMAGE.
    -.\"
    -.\"     from: @(#)gettytab.5	8.4 (Berkeley) 4/19/94
    -.\"
    -.Dd April 5, 2012
    -.Dt GETTYTAB 5
    -.Os
    -.Sh NAME
    -.Nm gettytab
    -.Nd terminal configuration data base
    -.Sh SYNOPSIS
    -.Nm
    -.Sh DESCRIPTION
    -The
    -.Nm
    -file
    -is a simplified version of the
    -.Xr capfile 5
    -data base
    -used to describe terminal lines.
    -The initial terminal login process
    -.Xr getty 8
    -accesses the
    -.Nm
    -file each time it starts, allowing simpler
    -reconfiguration of terminal characteristics.
    -Each entry in the data base
    -is used to describe one class of terminals.
    -.Pp
    -Where to run
    -.Xr getty 8
    -processes is normally defined by
    -.Xr ttys 5 .
    -.Pp
    -There is a default terminal class,
    -.Em default ,
    -that is used to set global defaults for all other classes.
    -(That is, the
    -.Em default
    -entry is read, then the entry for the class required
    -is used to override particular settings.)
    -The
    -.Em default
    -entry is also normally read by other programs that present login prompts
    -to the user, such as
    -.Xr telnetd 8 ,
    -in order to retrieve the values of the
    -.Em he ,
    -.Em hn ,
    -.Em im ,
    -and
    -.Em if
    -capabilities.
    -.Sh CAPABILITIES
    -Refer to
    -.Xr capfile 5
    -for a description of the file layout.
    -The
    -.Em default
    -column below lists defaults obtained if there is
    -no entry in the table obtained, nor one in the special
    -.Em default
    -table.
    -.Bl -column Namexx /usr/bin/login Default
    -.It Sy Name	Type	Default	Description
    -.It "ab	bool	false	Auto-baud speed select mechanism for the Micom 600 portselector. Selection is done by looking at how the character `\er' is garbled at 300, 1200, 4800, and 9600 baud."
    -.It "al	str	NULL	user to auto-login instead of prompting"
    -.It "ap	bool	false	terminal uses any parity"
    -.It "bk	str	0377	alternative end of line character (input break)"
    -.It "b2	str	0377	alternative end of line character (input break)"
    -.It "c0	num	unused	tty control flags to write messages"
    -.It "c1	num	unused	tty control flags to read login name"
    -.It "c2	num	unused	tty control flags to leave terminal as"
    -.It "ce	bool	false	use crt erase algorithm"
    -.It "ck	bool	false	use crt kill algorithm"
    -.It "cl	str" Ta Dv NULL Ta
    -.No "screen clear sequence"
    -.It "co	bool	false	console - add"
    -.Ql \er\en
    -after login prompt
    -.It "cs	bool	false	clear screen based on terminal type in /etc/ttys"
    -.It "ds	str" Ta So Li ^Y Sc Ta
    -.No "delayed suspend character"
    -.It "dx	bool	false	set"
    -.Dv DECCTLQ
    -.It "ec	bool	false	leave echo"
    -.Tn OFF
    -.It "ep	bool	false	terminal uses even parity"
    -.It "er	str" Ta So Li ^? Sc Ta
    -.No "erase character"
    -.It "et	str" Ta So Li ^D Sc Ta
    -.No "end of text"
    -.Pq Dv EOF
    -character
    -.It "ev	str" Ta Dv NULL Ta
    -.No "initial environment"
    -.It "f0	num	unused	tty mode flags to write messages"
    -.It "f1	num	unused	tty mode flags to read login name"
    -.It "f2	num	unused	tty mode flags to leave terminal as"
    -.It "fl	str" Ta So Li ^O Sc Ta
    -.No "output flush character"
    -.It "hc	bool	false	do"
    -.Tn NOT
    -hangup line on last close
    -.It "he	str" Ta Dv NULL Ta
    -.No "hostname editing string"
    -.It "hn	str	hostname	hostname"
    -.It "ht	bool	false	terminal has real tabs"
    -.It "i0	num	unused	tty input flags to write messages"
    -.It "i1	num	unused	tty input flags to read login name"
    -.It "i2	num	unused	tty input flags to leave terminal as"
    -.It "if	str	NULL	display named file before prompt, like /etc/issue"
    -.It "ig	bool	false	ignore garbage characters in login name"
    -.It "im	str" Ta Dv NULL Ta
    -.No "initial (banner) message"
    -.It "in	str" Ta So Li ^C Sc Ta
    -.No "interrupt character"
    -.It "is	num	unused	input speed"
    -.It "kl	str" Ta So Li ^U Sc Ta
    -.No "kill character"
    -.It "l0	num	unused	tty local flags to write messages"
    -.It "l1	num	unused	tty local flags to read login name"
    -.It "l2	num	unused	tty local flags to leave terminal as"
    -.It "lc	bool	false	terminal has lower case"
    -.It "lm	str	login:	login prompt"
    -.It "ln	str" Ta So Li ^V Sc Ta
    -.No "``literal next'' character"
    -.It "lo	str" Ta Pa /usr/bin/login Ta
    -.No "program to exec when name obtained"
    -.It "mb	bool	false	do flow control based on carrier"
    -.It "nl	bool	false	terminal has (or might have) a newline character"
    -.It "nn	bool	false	do not prompt for a login name"
    -.It "np	bool	false	terminal uses no parity (i.e. 8-bit characters)"
    -.It "nx	str	default	next table (for auto speed selection)"
    -.It "o0	num	unused	tty output flags to write messages"
    -.It "o1	num	unused	tty output flags to read login name"
    -.It "o2	num	unused	tty output flags to leave terminal as"
    -.It "op	bool	false	terminal uses odd parity"
    -.It "os	num	unused	output speed"
    -.It "pc	str" Ta So Li \e0 Sc Ta
    -.No "pad character"
    -.It "pe	bool	false	use printer (hard copy) erase algorithm"
    -.It "pf	num	0	delay"
    -between first prompt and following flush (seconds)
    -.It "pp	str	unused	PPP authentication program"
    -.It "ps	bool	false	line connected to a"
    -.Tn MICOM
    -port selector
    -.It "qu	str" Ta So Li \&^\e Sc Ta
    -.No "quit character"
    -.It "rp	str" Ta So Li ^R Sc Ta
    -.No "line retype character"
    -.It "rw	bool	false	do"
    -.Tn NOT
    -use raw for input, use cbreak
    -.It "sp	num	unused	line speed (input and output)"
    -.It "st	str" Ta So Li ^T Sc Ta
    -.No "status character"
    -.It "su	str" Ta So Li ^Z Sc Ta
    -.No "suspend character"
    -.It "tc	str	none	table continuation"
    -.It "to	num	0	timeout (seconds)"
    -.It "tt	str" Ta Dv NULL Ta
    -.No "terminal type (for environment)"
    -.It "ub	bool	false	do unbuffered output (of prompts etc)"
    -.It "we	str" Ta So Li ^W Sc Ta
    -.No "word erase character"
    -.It "xc	bool	false	do"
    -.Tn NOT
    -echo control chars as
    -.Ql ^X
    -.It "xf	str" Ta So Li ^S Sc Ta Dv XOFF
    -(stop output) character
    -.It "xn	str" Ta So Li ^Q Sc Ta Dv XON
    -(start output) character
    -.El
    -.Pp
    -The following capabilities are no longer supported by
    -.Xr getty 8 :
    -.Bl -column Namexx /usr/bin/login Default
    -.It "bd	num	0	backspace delay"
    -.It "cb	bool	false	use crt backspace mode"
    -.It "cd	num	0	carriage-return delay"
    -.It "fd	num	0	form-feed (vertical motion) delay"
    -.It "nd	num	0	newline (line-feed) delay"
    -.It "uc	bool	false	terminal is known upper case only"
    -.El
    -.Pp
    -If no line speed is specified, speed will not be altered
    -from that which prevails when getty is entered.
    -Specifying an input or output speed will override
    -line speed for stated direction only.
    -.Pp
    -Terminal modes to be used for the output of the message,
    -for input of the login name,
    -and to leave the terminal set as upon completion,
    -are derived from the boolean flags specified.
    -If the derivation should prove inadequate,
    -any (or all) of these three may be overridden
    -with one of the
    -.Em \&c0 ,
    -.Em \&c1 ,
    -.Em \&c2 ,
    -.Em \&i0 ,
    -.Em \&i1 ,
    -.Em \&i2 ,
    -.Em \&l0 ,
    -.Em \&l1 ,
    -.Em \&l2 ,
    -.Em \&o0 ,
    -.Em \&o1 ,
    -or
    -.Em \&o2
    -numeric specifications, which can be used to specify
    -(usually in octal, with a leading '0')
    -the exact values of the flags.
    -These flags correspond to the termios
    -.Em c_cflag ,
    -.Em c_iflag ,
    -.Em c_lflag ,
    -and
    -.Em c_oflag
    -fields, respectively.
    -Each these sets must be completely specified to be effective.
    -The
    -.Em \&f0 ,
    -.Em \&f1 ,
    -and
    -.Em \&f2
    -are excepted for backwards compatibility with a previous incarnation of
    -the TTY sub-system.
    -In these flags the bottom 16 bits of the (32 bits) value contain the sgttyb
    -.Em sg_flags
    -field, while the top 16 bits represent the local mode word.
    -.Pp
    -Should
    -.Xr getty 8
    -receive a null character
    -(presumed to indicate a line break)
    -it will restart using the table indicated by the
    -.Em nx
    -entry.
    -If there is none, it will re-use its original table.
    -.Pp
    -Delays are specified in milliseconds, the nearest possible
    -delay available in the tty driver will be used.
    -Should greater certainty be desired, delays
    -with values 0, 1, 2, and 3 are interpreted as
    -choosing that particular delay algorithm from the driver.
    -.Pp
    -The
    -.Em \&cl
    -screen clear string may be preceded by a (decimal) number
    -of milliseconds of delay required (a la termcap).
    -This delay is simulated by repeated use of the pad character
    -.Em \&pc .
    -.Pp
    -The initial message, and login message,
    -.Em \&im
    -and
    -.Em \&lm
    -may include any of the following character sequences, which expand to
    -information about the environment in which
    -.Xr getty 8
    -is running.
    -.Pp
    -.Bl -tag -width \&%xxx -compact
    -.It \&%d
    -The current date.
    -.It \&%h
    -The hostname of the machine, which is normally obtained from the
    -system using
    -.Xr gethostname 3 ,
    -but may also be overridden by the
    -.Em \&hn
    -table entry.
    -In either case it may be edited with the
    -.Em \&he
    -string.
    -A '@' in the
    -.Em \&he
    -string causes one character from the real hostname to
    -be copied to the final hostname.
    -A '#' in the
    -.Em \&he
    -string causes the next character of the real hostname
    -to be skipped.
    -Each character that
    -is neither '@' nor '#' is copied into the final hostname.
    -Surplus '@' and '#' characters are ignored.
    -.It \&%t
    -The tty name.
    -.It "\&%m, \&%r, \&%s, \&%v"
    -The type of machine, release of the operating system, name of the
    -operating system, and version of the kernel, respectively, as
    -returned by
    -.Xr uname 3 .
    -.It \&%%
    -A
    -.Dq %
    -character.
    -.El
    -.Pp
    -When getty execs the login process, given
    -in the
    -.Em \&lo
    -string (usually
    -.Dq Pa /usr/bin/login ) ,
    -it will have set
    -the environment to include the terminal type, as indicated
    -by the
    -.Em \&tt
    -string (if it exists).
    -The
    -.Em \&ev
    -string, can be used to enter additional data into
    -the environment.
    -It is a list of comma separated strings, each of which
    -will presumably be of the form
    -.Em name=value .
    -.Pp
    -If a non-zero timeout is specified, with
    -.Em \&to ,
    -then getty will exit within the indicated
    -number of seconds, either having
    -received a login name and passed control
    -to
    -.Xr login 1 ,
    -or having received an alarm signal, and exited.
    -This may be useful to hangup dial in lines.
    -.Pp
    -Output from
    -.Xr getty 8
    -is even parity unless
    -.Em \&op
    -or
    -.Em \&np
    -is specified.
    -The
    -.Em \&op
    -string
    -may be specified with
    -.Em \&ap
    -to allow any parity on input, but generate odd parity output.
    -Note: this only applies while getty is being run,
    -terminal driver limitations prevent a more complete
    -implementation.
    -.Xr getty 8
    -does not check parity of input characters in
    -.Dv RAW
    -mode.
    -.Pp
    -If
    -.Em \&pp
    -string is specified and a Point to Point Protocol
    -.Pq Tn PPP
    -link bringup sequence is recognized,
    -.Xr getty 8
    -will invoke the program referenced by the
    -.Em \&pp
    -string, e.g.
    -.Xr pppd 8 .
    -This can be used to handle incoming
    -.Tn PPP
    -calls.
    -.Sh SEE ALSO
    -.Xr login 1 ,
    -.Xr gethostname 3 ,
    -.Xr uname 3 ,
    -.Xr capfile 5 ,
    -.Xr ttys 5 ,
    -.Xr getty 8 ,
    -.Xr pppd 8 ,
    -.Xr telnetd 8
    -.Sh HISTORY
    -The
    -.Nm
    -file format appeared in
    -.Bx 4.2 .
    -.Sh BUGS
    -The special characters (erase, kill, etc.) are reset to system defaults
    -by
    -.Xr login 1 .
    -In
    -.Em all
    -cases, '#' or '^H' typed in a login name will be treated as
    -an erase character, and '@' will be treated as a kill character.
    -.Pp
    -The delay stuff is a real crock.
    -Apart from its general lack of flexibility, some
    -of the delay algorithms are not implemented.
    -The terminal driver should support sane delay settings.
    -.Pp
    -The
    -.Em \&he
    -capability is stupid.
    diff --git a/libexec/getty/gettytab.h b/libexec/getty/gettytab.h
    deleted file mode 100644
    index 7b3639e0c..000000000
    --- a/libexec/getty/gettytab.h
    +++ /dev/null
    @@ -1,173 +0,0 @@
    -/*	$NetBSD: gettytab.h,v 1.17 2013/08/11 05:42:41 dholland Exp $	*/
    -
    -/*
    - * Copyright (c) 1983, 1993, 1994
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - *	from: @(#)gettytab.h	8.2 (Berkeley) 3/30/94
    - */
    -
    -/*
    - * Getty description definitions.
    - */
    -struct	gettystrs {
    -	const char *field;	/* name to lookup in gettytab */
    -	const char *defalt;	/* value we find by looking in defaults */
    -	char	*value;		/* value that we find there */
    -};
    -
    -struct	gettynums {
    -	const char *field;	/* name to lookup */
    -	long	defalt;		/* number we find in defaults */
    -	long	value;		/* number we find there */
    -	int	set;		/* we actually got this one */
    -};
    -
    -struct gettyflags {
    -	const char *field;	/* name to lookup */
    -	char	invrt;		/* name existing in gettytab --> false */
    -	char	defalt;		/* true/false in defaults */
    -	char	value;		/* true/false flag */
    -	char	set;		/* we found it */
    -};
    -
    -/*
    - * See init.c for the arrays indexed by these values.
    - */
    -
    -/*
    - * String values.
    - */
    -#define	NX	gettystrs[0].value
    -#define	CL	gettystrs[1].value
    -#define IM	gettystrs[2].value
    -#define	LM	gettystrs[3].value
    -#define	ER	gettystrs[4].value
    -#define	KL	gettystrs[5].value
    -#define	ET	gettystrs[6].value
    -#define	PC	gettystrs[7].value
    -#define	TT	gettystrs[8].value
    -#define	EV	gettystrs[9].value
    -#define	LO	gettystrs[10].value
    -#define HN	gettystrs[11].value
    -#define HE	gettystrs[12].value
    -#define IN	gettystrs[13].value
    -#define QU	gettystrs[14].value
    -#define XN	gettystrs[15].value
    -#define XF	gettystrs[16].value
    -#define BK	gettystrs[17].value
    -#define SU	gettystrs[18].value
    -#define DS	gettystrs[19].value
    -#define RP	gettystrs[20].value
    -#define FL	gettystrs[21].value
    -#define WE	gettystrs[22].value
    -#define LN	gettystrs[23].value
    -#define ST	gettystrs[24].value
    -#define B2	gettystrs[25].value
    -#define PP	gettystrs[26].value
    -#define IF	gettystrs[27].value
    -#define AL	gettystrs[28].value
    -
    -/*
    - * Numeric definitions.
    - */
    -#define	IS	gettynums[0].value
    -#define	OS	gettynums[1].value
    -#define	SP	gettynums[2].value
    -#define	ND	gettynums[3].value
    -#define	CD	gettynums[4].value
    -#define	TD	gettynums[5].value
    -#define	FD	gettynums[6].value
    -#define	BD	gettynums[7].value
    -#define	TO	gettynums[8].value
    -#define	F0	gettynums[9].value
    -#define	F0set	gettynums[9].set
    -#define	F1	gettynums[10].value
    -#define	F1set	gettynums[10].set
    -#define	F2	gettynums[11].value
    -#define	F2set	gettynums[11].set
    -#define	PF	gettynums[12].value
    -#define	C0	gettynums[13].value
    -#define	C0set	gettynums[13].set
    -#define	C1	gettynums[14].value
    -#define	C1set	gettynums[14].set
    -#define	C2	gettynums[15].value
    -#define	C2set	gettynums[15].set
    -#define	I0	gettynums[16].value
    -#define	I0set	gettynums[16].set
    -#define	I1	gettynums[17].value
    -#define	I1set	gettynums[17].set
    -#define	I2	gettynums[18].value
    -#define	I2set	gettynums[18].set
    -#define	L0	gettynums[19].value
    -#define	L0set	gettynums[19].set
    -#define	L1	gettynums[20].value
    -#define	L1set	gettynums[20].set
    -#define	L2	gettynums[21].value
    -#define	L2set	gettynums[21].set
    -#define	O0	gettynums[22].value
    -#define	O0set	gettynums[22].set
    -#define	O1	gettynums[23].value
    -#define	O1set	gettynums[23].set
    -#define	O2	gettynums[24].value
    -#define	O2set	gettynums[24].set
    -
    -/*
    - * Boolean values.
    - */
    -#define	HT	gettyflags[0].value
    -#define	NL	gettyflags[1].value
    -#define	EP	gettyflags[2].value
    -#define	EPset	gettyflags[2].set
    -#define	OP	gettyflags[3].value
    -#define	OPset	gettyflags[3].set
    -#define	AP	gettyflags[4].value
    -#define	APset	gettyflags[4].set
    -#define	EC	gettyflags[5].value
    -#define	CO	gettyflags[6].value
    -#define	CB	gettyflags[7].value
    -#define	CK	gettyflags[8].value
    -#define	CE	gettyflags[9].value
    -#define	PE	gettyflags[10].value
    -#define	RW	gettyflags[11].value
    -#define	XC	gettyflags[12].value
    -#define	LC	gettyflags[13].value
    -#define	UC	gettyflags[14].value
    -#define	IG	gettyflags[15].value
    -#define	PS	gettyflags[16].value
    -#define	HC	gettyflags[17].value
    -#define UB	gettyflags[18].value
    -#define AB	gettyflags[19].value
    -#define DX	gettyflags[20].value
    -#define	NP	gettyflags[21].value
    -#define	MB	gettyflags[22].value
    -#define	CS	gettyflags[23].value
    -#define	NN	gettyflags[24].value
    -
    -extern	struct gettyflags gettyflags[];
    -extern	struct gettynums gettynums[];
    -extern	struct gettystrs gettystrs[];
    diff --git a/libexec/getty/init.c b/libexec/getty/init.c
    deleted file mode 100644
    index 44b6eaa26..000000000
    --- a/libexec/getty/init.c
    +++ /dev/null
    @@ -1,147 +0,0 @@
    -/*	$NetBSD: init.c,v 1.18 2013/08/11 05:42:41 dholland Exp $	*/
    -
    -/*
    - * Copyright (c) 1983, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -#include 
    -#ifndef lint
    -#if 0
    -static char sccsid[] = "from: @(#)init.c	8.1 (Berkeley) 6/4/93";
    -#else
    -__RCSID("$NetBSD: init.c,v 1.18 2013/08/11 05:42:41 dholland Exp $");
    -#endif
    -#endif /* not lint */
    -
    -/*
    - * Getty table initializations.
    - *
    - * Melbourne getty.
    - */
    -
    -#include 
    -#include 
    -
    -#include "gettytab.h"
    -#include "pathnames.h"
    -
    -extern	struct termios tmode;
    -extern	char hostname[];
    -
    -#define M(a) ((char *)&tmode.c_cc[a])
    -
    -struct	gettystrs gettystrs[] = {
    -	{ "nx", NULL,        NULL },	/* next table */
    -	{ "cl", NULL,        NULL },	/* screen clear characters */
    -	{ "im", NULL,        NULL },	/* initial message */
    -	{ "lm", "login: ",   NULL },	/* login message */
    -	{ "er", M(VERASE),   NULL },	/* erase character */
    -	{ "kl", M(VKILL),    NULL },	/* kill character */
    -	{ "et", M(VEOF),     NULL },	/* eof chatacter (eot) */
    -	{ "pc", "",          NULL },	/* pad character */
    -	{ "tt", NULL,        NULL },	/* terminal type */
    -	{ "ev", NULL,        NULL },	/* environment */
    -	{ "lo", _PATH_LOGIN, NULL },	/* login program */
    -	{ "hn", hostname,    NULL },	/* host name */
    -	{ "he", NULL,        NULL },	/* host name edit */
    -	{ "in", M(VINTR),    NULL },	/* interrupt char */
    -	{ "qu", M(VQUIT),    NULL },	/* quit char */
    -	{ "xn", M(VSTART),   NULL },	/* XON (start) char */
    -	{ "xf", M(VSTOP),    NULL },	/* XOFF (stop) char */
    -	{ "bk", M(VEOL),     NULL },	/* brk char (alt \n) */
    -	{ "su", M(VSUSP),    NULL },	/* suspend char */
    -	{ "ds", M(VDSUSP),   NULL },	/* delayed suspend */
    -	{ "rp", M(VREPRINT), NULL },	/* reprint char */
    -	{ "fl", M(VDISCARD), NULL },	/* flush output */
    -	{ "we", M(VWERASE),  NULL },	/* word erase */
    -	{ "ln", M(VLNEXT),   NULL },	/* literal next */
    -	{ "st", M(VSTATUS),  NULL },	/* status */
    -	{ "b2", M(VEOL2),    NULL },	/* alt brk char */
    -	{ "pp", NULL,        NULL },	/* ppp login program */
    -	{ "if", NULL,        NULL },	/* sysv-like 'issue' filename */
    -	{ "al", NULL,        NULL },	/* user to auto-login */
    -	{ NULL, NULL, NULL }
    -};
    -
    -struct	gettynums gettynums[] = {
    -	{ "is", 0,0,0 },		/* input speed */
    -	{ "os", 0,0,0 },		/* output speed */
    -	{ "sp", 0,0,0 },		/* both speeds */
    -	{ "nd", 0,0,0 },		/* newline delay */
    -	{ "cd", 0,0,0 },		/* carriage-return delay */
    -	{ "td", 0,0,0 },		/* tab delay */
    -	{ "fd", 0,0,0 },		/* form-feed delay */
    -	{ "bd", 0,0,0 },		/* backspace delay */
    -	{ "to", 0,0,0 },		/* timeout */
    -	{ "f0", 0,0,0 },		/* output flags */
    -	{ "f1", 0,0,0 },		/* input flags */
    -	{ "f2", 0,0,0 },		/* user mode flags */
    -	{ "pf", 0,0,0 },		/* delay before flush at 1st prompt */
    -	{ "c0", 0,0,0 },		/* output c_flags */
    -	{ "c1", 0,0,0 },		/* input c_flags */
    -	{ "c2", 0,0,0 },		/* user mode c_flags */
    -	{ "i0", 0,0,0 },		/* output i_flags */
    -	{ "i1", 0,0,0 },		/* input i_flags */
    -	{ "i2", 0,0,0 },		/* user mode i_flags */
    -	{ "l0", 0,0,0 },		/* output l_flags */
    -	{ "l1", 0,0,0 },		/* input l_flags */
    -	{ "l2", 0,0,0 },		/* user mode l_flags */
    -	{ "o0", 0,0,0 },		/* output o_flags */
    -	{ "o1", 0,0,0 },		/* input o_flags */
    -	{ "o2", 0,0,0 },		/* user mode o_flags */
    -	{ 0,0,0,0 }
    -};
    -
    -struct	gettyflags gettyflags[] = {
    -	{ "ht",	0, 0,0,0 },		/* has tabs */
    -	{ "nl",	1, 0,0,0 },		/* has newline char */
    -	{ "ep",	0, 0,0,0 },		/* even parity */
    -	{ "op",	0, 0,0,0 },		/* odd parity */
    -	{ "ap",	0, 0,0,0 },		/* any parity */
    -	{ "ec",	1, 0,0,0 },		/* no echo */
    -	{ "co",	0, 0,0,0 },		/* console special */
    -	{ "cb",	0, 0,0,0 },		/* crt backspace */
    -	{ "ck",	0, 0,0,0 },		/* crt kill */
    -	{ "ce",	0, 0,0,0 },		/* crt erase */
    -	{ "pe",	0, 0,0,0 },		/* printer erase */
    -	{ "rw",	1, 0,0,0 },		/* don't use raw */
    -	{ "xc",	1, 0,0,0 },		/* don't ^X ctl chars */
    -	{ "lc",	0, 0,0,0 },		/* terminal las lower case */
    -	{ "uc",	0, 0,0,0 },		/* terminal has no lower case */
    -	{ "ig",	0, 0,0,0 },		/* ignore garbage */
    -	{ "ps",	0, 0,0,0 },		/* do port selector speed select */
    -	{ "hc",	1, 0,0,0 },		/* don't set hangup on close */
    -	{ "ub", 0, 0,0,0 },		/* unbuffered output */
    -	{ "ab", 0, 0,0,0 },		/* auto-baud detect with '\r' */
    -	{ "dx", 0, 0,0,0 },		/* set decctlq */
    -	{ "np", 0, 0,0,0 },		/* no parity at all (8bit chars) */
    -	{ "mb", 0, 0,0,0 },		/* do MDMBUF flow control */
    -	{ "cs", 0, 0,0,0 },		/* clear screen based on term type */
    -	{ "nn", 0, 0,0,0 },		/* don't prompt for login name */
    -	{ NULL,0,0,0,0 }
    -};
    diff --git a/libexec/getty/main.c b/libexec/getty/main.c
    deleted file mode 100644
    index df5750327..000000000
    --- a/libexec/getty/main.c
    +++ /dev/null
    @@ -1,711 +0,0 @@
    -/*	$NetBSD: main.c,v 1.64 2013/08/12 13:54:33 joerg Exp $	*/
    -
    -/*-
    - * Copyright (c) 1980, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -#include 
    -
    -#ifndef lint
    -__COPYRIGHT("@(#) Copyright (c) 1980, 1993\
    - The Regents of the University of California.  All rights reserved.");
    -#endif /* not lint */
    -
    -#ifndef lint
    -#if 0
    -static char sccsid[] = "from: @(#)main.c	8.1 (Berkeley) 6/20/93";
    -#else
    -__RCSID("$NetBSD: main.c,v 1.64 2013/08/12 13:54:33 joerg Exp $");
    -#endif
    -#endif /* not lint */
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include "gettytab.h"
    -#include "pathnames.h"
    -#include "extern.h"
    -
    -extern char editedhost[];
    -
    -/*
    - * Set the amount of running time that getty should accumulate
    - * before deciding that something is wrong and exit.
    - */
    -#define GETTY_TIMEOUT	60 /* seconds */
    -
    -/* defines for auto detection of incoming PPP calls (->PAP/CHAP) */
    -
    -#define PPP_FRAME           0x7e  /* PPP Framing character */
    -#define PPP_STATION         0xff  /* "All Station" character */
    -#define PPP_ESCAPE          0x7d  /* Escape Character */
    -#define PPP_CONTROL         0x03  /* PPP Control Field */
    -#define PPP_CONTROL_ESCAPED 0x23  /* PPP Control Field, escaped */
    -#define PPP_LCP_HI          0xc0  /* LCP protocol - high byte */
    -#define PPP_LCP_LOW         0x21  /* LCP protocol - low byte */
    -
    -struct termios tmode, omode;
    -
    -int crmod, digit_or_punc, lower, upper;
    -
    -char	hostname[MAXHOSTNAMELEN + 1];
    -struct	utsname kerninfo;
    -char	name[LOGIN_NAME_MAX];
    -char	dev[] = _PATH_DEV;
    -char	ttyn[32];
    -char	lockfile[512];
    -uid_t	ttyowner;
    -char	*rawttyn;
    -
    -#define	OBUFSIZ		128
    -#define	TABBUFSIZ	512
    -
    -char	defent[TABBUFSIZ];
    -char	tabent[TABBUFSIZ];
    -
    -char	*env[128];
    -
    -const unsigned char partab[] = {
    -	0001,0201,0201,0001,0201,0001,0001,0201,
    -	0202,0004,0003,0205,0005,0206,0201,0001,
    -	0201,0001,0001,0201,0001,0201,0201,0001,
    -	0001,0201,0201,0001,0201,0001,0001,0201,
    -	0200,0000,0000,0200,0000,0200,0200,0000,
    -	0000,0200,0200,0000,0200,0000,0000,0200,
    -	0000,0200,0200,0000,0200,0000,0000,0200,
    -	0200,0000,0000,0200,0000,0200,0200,0000,
    -	0200,0000,0000,0200,0000,0200,0200,0000,
    -	0000,0200,0200,0000,0200,0000,0000,0200,
    -	0000,0200,0200,0000,0200,0000,0000,0200,
    -	0200,0000,0000,0200,0000,0200,0200,0000,
    -	0000,0200,0200,0000,0200,0000,0000,0200,
    -	0200,0000,0000,0200,0000,0200,0200,0000,
    -	0200,0000,0000,0200,0000,0200,0200,0000,
    -	0000,0200,0200,0000,0200,0000,0000,0201
    -};
    -
    -#define	ERASE	tmode.c_cc[VERASE]
    -#define	KILL	tmode.c_cc[VKILL]
    -#define	EOT	tmode.c_cc[VEOF]
    -
    -static void	clearscreen(void);
    -
    -sigjmp_buf timeout;
    -
    -__dead static void
    -/*ARGSUSED*/
    -dingdong(int signo)
    -{
    -
    -	(void)alarm(0);
    -	(void)signal(SIGALRM, SIG_DFL);
    -	siglongjmp(timeout, 1);
    -}
    -
    -sigjmp_buf intrupt;
    -
    -__dead static void
    -/*ARGSUSED*/
    -interrupt(int signo)
    -{
    -
    -	(void)signal(SIGINT, interrupt);
    -	siglongjmp(intrupt, 1);
    -}
    -
    -#if !defined(__minix)
    -/*
    - * Action to take when getty is running too long.
    - */
    -__dead static void
    -/*ARGSUSED*/
    -timeoverrun(int signo)
    -{
    -
    -	syslog(LOG_ERR, "getty exiting due to excessive running time");
    -	exit(1);
    -}
    -#endif /* !defined(__minix) */
    -
    -static int	getname(void);
    -static void	oflush(void);
    -static void	prompt(void);
    -static int	putchr(int);
    -static void	putf(const char *);
    -static void	xputs(const char *);
    -
    -#define putpad(s) tputs(s, 1, putchr)
    -
    -int
    -main(int argc, char *argv[], char *envp[])
    -{
    -	const char *progname;
    -	int repcnt = 0, failopenlogged = 0, first_time = 1;
    -	struct rlimit limit;
    -	struct passwd *pw;
    -	int rval;
    -	/* this is used past the siglongjmp, so make sure it is not cached
    -	   in registers that might become invalid. */
    -	volatile int uugetty = 0;
    -	const char * volatile tname = "default";
    -
    -	(void)signal(SIGINT, SIG_IGN);
    -	openlog("getty", LOG_PID, LOG_AUTH);
    -	(void)gethostname(hostname, sizeof(hostname));
    -	hostname[sizeof(hostname) - 1] = '\0';
    -	if (hostname[0] == '\0')
    -		(void)strlcpy(hostname, "Amnesiac", sizeof(hostname));
    -	(void)uname(&kerninfo);
    -
    -	progname = getprogname();
    -	if (progname[0] == 'u' && progname[1] == 'u')
    -		uugetty = 1;
    -
    -	/*
    -	 * Find id of uucp login (if present) so we can chown tty properly.
    -	 */
    -	if (uugetty && (pw = getpwnam("uucp")))
    -		ttyowner = pw->pw_uid;
    -	else
    -		ttyowner = 0;
    -
    -	/*
    -	 * Limit running time to deal with broken or dead lines.
    -	 */
    -#if !defined(__minix)
    -	(void)signal(SIGXCPU, timeoverrun);
    -#endif /* !defined(__minix) */
    -	limit.rlim_max = RLIM_INFINITY;
    -	limit.rlim_cur = GETTY_TIMEOUT;
    -	(void)setrlimit(RLIMIT_CPU, &limit);
    -
    -	/*
    -	 * The following is a work around for vhangup interactions
    -	 * which cause great problems getting window systems started.
    -	 * If the tty line is "-", we do the old style getty presuming
    -	 * that the file descriptors are already set up for us.
    -	 * J. Gettys - MIT Project Athena.
    -	 */
    -	if (argc <= 2 || strcmp(argv[2], "-") == 0) {
    -		(void)strlcpy(ttyn, ttyname(0), sizeof(ttyn));
    -	}
    -	else {
    -		int i;
    -
    -		rawttyn = argv[2];
    -		(void)strlcpy(ttyn, dev, sizeof(ttyn));
    -		(void)strlcat(ttyn, argv[2], sizeof(ttyn));
    -		if (uugetty)  {
    -			(void)chown(ttyn, ttyowner, 0);
    -			(void)strlcpy(lockfile, _PATH_LOCK,
    -				sizeof(lockfile));
    -			(void)strlcat(lockfile, argv[2],
    -				sizeof(lockfile));
    -			/*
    -			 * wait for lockfiles to go away before we try
    -			 * to open
    -			 */
    -			if (pidlock(lockfile, 0, 0, 0) != 0)  {
    -				syslog(LOG_ERR,
    -					"%s: can't create lockfile", ttyn);
    -				exit(1);
    -			}
    -			(void)unlink(lockfile);
    -		}
    -		if (strcmp(argv[0], "+") != 0) {
    -			(void)chown(ttyn, ttyowner, 0);
    -			(void)chmod(ttyn, 0600);
    -#if !defined(__minix)
    -			(void)revoke(ttyn);
    -#endif /* !defined(__minix) */
    -			if (ttyaction(ttyn, "getty", "root"))
    -				syslog(LOG_WARNING, "%s: ttyaction failed",
    -					ttyn);
    -			/*
    -			 * Delay the open so DTR stays down long enough
    -			 * to be detected.
    -			 */
    -			(void)sleep(2);
    -			while ((i = open(ttyn, O_RDWR)) == -1) {
    -				if ((repcnt % 10 == 0) &&
    -				    (errno != ENXIO || !failopenlogged)) {
    -					syslog(LOG_WARNING, "%s: %m", ttyn);
    -					closelog();
    -					failopenlogged = 1;
    -				}
    -				repcnt++;
    -				(void)sleep(60);
    -			}
    -			if (uugetty && pidlock(lockfile, 0, 0, 0) != 0)  {
    -				syslog(LOG_ERR, "%s: can't create lockfile",
    -					ttyn);
    -				exit(1);
    -			}
    -			if (uugetty)
    -				(void)chown(lockfile, ttyowner, 0);
    -			(void)login_tty(i);
    -		}
    -	}
    -
    -	/* Start with default tty settings */
    -	if (tcgetattr(0, &tmode) < 0) {
    -		syslog(LOG_ERR, "%s: %m", ttyn);
    -		exit(1);
    -	}
    -	omode = tmode;
    -
    -	gettable("default", defent);
    -	gendefaults();
    -	if (argc > 1)
    -		tname = argv[1];
    -	for (;;) {
    -#if !defined(__minix)
    -		int off;
    -#endif /* !defined(__minix) */
    -
    -		rval = 0;
    -		gettable(tname, tabent);
    -		if (OPset || EPset || APset)
    -			APset++, OPset++, EPset++;
    -		setdefaults();
    -#if !defined(__minix)
    -		off = 0;
    -#endif /* !defined(__minix) */
    -		(void)tcflush(0, TCIOFLUSH);	/* clear out the crap */
    -#if !defined(__minix)
    -		(void)ioctl(0, FIONBIO, &off);	/* turn off non-blocking mode */
    -		(void)ioctl(0, FIOASYNC, &off);	/* ditto for async mode */
    -#endif /* !defined(__minix) */
    -
    -		if (IS)
    -			(void)cfsetispeed(&tmode, (speed_t)IS);
    -		else if (SP)
    -			(void)cfsetispeed(&tmode, (speed_t)SP);
    -		if (OS)
    -			(void)cfsetospeed(&tmode, (speed_t)OS);
    -		else if (SP)
    -			(void)cfsetospeed(&tmode, (speed_t)SP);
    -		setflags(0);
    -		setchars();
    -		if (tcsetattr(0, TCSANOW, &tmode) < 0) {
    -			syslog(LOG_ERR, "%s: %m", ttyn);
    -			exit(1);
    -		}
    -		if (AB) {
    -			tname = autobaud();
    -			continue;
    -		}
    -		if (PS) {
    -			tname = portselector();
    -			continue;
    -		}
    -		if (CS)
    -			clearscreen();
    -		if (CL && *CL)
    -			putpad(CL);
    -		edithost(HE);
    -
    -		/*
    -		 * If this is the first time through this, and an
    -		 * issue file has been given, then send it.
    -		 */
    -		if (first_time != 0 && IF != NULL) {
    -			char buf[_POSIX2_LINE_MAX];
    -			FILE *fp;
    -
    -			if ((fp = fopen(IF, "r")) != NULL) {
    -				while (fgets(buf, sizeof(buf) - 1, fp) != NULL)
    -					putf(buf);
    -				(void)fclose(fp);
    -			}
    -		}
    -		first_time = 0;
    -
    -		if (IM && *IM)
    -			putf(IM);
    -		oflush();
    -		if (sigsetjmp(timeout, 1)) {
    -			tmode.c_ispeed = tmode.c_ospeed = 0;
    -			(void)tcsetattr(0, TCSANOW, &tmode);
    -			exit(1);
    -		}
    -		if (TO) {
    -			(void)signal(SIGALRM, dingdong);
    -			(void)alarm((unsigned int)TO);
    -		}
    -		if (NN) {
    -			name[0] = '\0';
    -			lower = 1;
    -			upper = digit_or_punc = 0;
    -		} else if (AL) {
    -			const char *p = AL;
    -			char *q = name;
    -
    -			while (*p && q < &name[sizeof name - 1]) {
    -				if (isupper((unsigned char)*p))
    -					upper = 1;
    -				else if (islower((unsigned char)*p))
    -					lower = 1;
    -				else if (isdigit((unsigned char)*p))
    -					digit_or_punc = 1;
    -				*q++ = *p++;
    -			}
    -		} else if ((rval = getname()) == 2) {
    -			setflags(2);
    -			(void)execle(PP, "ppplogin", ttyn, (char *) 0, env);
    -			syslog(LOG_ERR, "%s: %m", PP);
    -			exit(1);
    -		}
    -
    -		if (rval || AL || NN) {
    -			int i;
    -
    -			oflush();
    -			(void)alarm(0);
    -			(void)signal(SIGALRM, SIG_DFL);
    -			if (name[0] == '-') {
    -				xputs("user names may not start with '-'.");
    -				continue;
    -			}
    -			if (!(upper || lower || digit_or_punc))
    -				continue;
    -			setflags(2);
    -			if (crmod) {
    -				tmode.c_iflag |= ICRNL;
    -				tmode.c_oflag |= ONLCR;
    -			}
    -#if XXX
    -			if (upper || UC)
    -				tmode.sg_flags |= LCASE;
    -			if (lower || LC)
    -				tmode.sg_flags &= ~LCASE;
    -#endif
    -			if (tcsetattr(0, TCSANOW, &tmode) < 0) {
    -				syslog(LOG_ERR, "%s: %m", ttyn);
    -				exit(1);
    -			}
    -			(void)signal(SIGINT, SIG_DFL);
    -			for (i = 0; envp[i] != NULL; i++)
    -				env[i] = envp[i];
    -			makeenv(&env[i]);
    -
    -			limit.rlim_max = RLIM_INFINITY;
    -			limit.rlim_cur = RLIM_INFINITY;
    -			(void)setrlimit(RLIMIT_CPU, &limit);
    -			if (NN)
    -				(void)execle(LO, "login", AL ? "-fp" : "-p",
    -				    NULL, env);
    -			else
    -				(void)execle(LO, "login", AL ? "-fp" : "-p",
    -				    "--", name, NULL, env);
    -			syslog(LOG_ERR, "%s: %m", LO);
    -			exit(1);
    -		}
    -		(void)alarm(0);
    -		(void)signal(SIGALRM, SIG_DFL);
    -		(void)signal(SIGINT, SIG_IGN);
    -		if (NX && *NX)
    -			tname = NX;
    -		if (uugetty)
    -			(void)unlink(lockfile);
    -	}
    -}
    -
    -static int
    -getname(void)
    -{
    -	int c;
    -	char *np;
    -	unsigned char cs;
    -	int ppp_state, ppp_connection;
    -
    -	/*
    -	 * Interrupt may happen if we use CBREAK mode
    -	 */
    -	if (sigsetjmp(intrupt, 1)) {
    -		(void)signal(SIGINT, SIG_IGN);
    -		return (0);
    -	}
    -	(void)signal(SIGINT, interrupt);
    -	setflags(1);
    -	prompt();
    -	if (PF > 0) {
    -		oflush();
    -		(void)sleep((unsigned int)PF);
    -		PF = 0;
    -	}
    -	if (tcsetattr(0, TCSANOW, &tmode) < 0) {
    -		syslog(LOG_ERR, "%s: %m", ttyn);
    -		exit(1);
    -	}
    -	crmod = digit_or_punc = lower = upper = 0;
    -	ppp_state = ppp_connection = 0;
    -	np = name;
    -	for (;;) {
    -		oflush();
    -		if (read(STDIN_FILENO, &cs, 1) <= 0)
    -			exit(0);
    -		if ((c = cs&0177) == 0)
    -			return (0);
    -
    -		/*
    -		 * PPP detection state machine..
    -		 * Look for sequences:
    -		 * PPP_FRAME, PPP_STATION, PPP_ESCAPE, PPP_CONTROL_ESCAPED or
    -		 * PPP_FRAME, PPP_STATION, PPP_CONTROL (deviant from RFC)
    -		 * See RFC1662.
    -		 * Derived from code from Michael Hancock 
    -		 * and Erik 'PPP' Olson 
    -		 */
    -		if (PP && cs == PPP_FRAME) {
    -			ppp_state = 1;
    -		} else if (ppp_state == 1 && cs == PPP_STATION) {
    -			ppp_state = 2;
    -		} else if (ppp_state == 2 && cs == PPP_ESCAPE) {
    -			ppp_state = 3;
    -		} else if ((ppp_state == 2 && cs == PPP_CONTROL) ||
    -		    (ppp_state == 3 && cs == PPP_CONTROL_ESCAPED)) {
    -			ppp_state = 4;
    -		} else if (ppp_state == 4 && cs == PPP_LCP_HI) {
    -			ppp_state = 5;
    -		} else if (ppp_state == 5 && cs == PPP_LCP_LOW) {
    -			ppp_connection = 1;
    -			break;
    -		} else {
    -			ppp_state = 0;
    -		}
    -
    -		if (c == EOT)
    -			exit(1);
    -		if (c == '\r' || c == '\n' ||
    -		    np >= &name[LOGIN_NAME_MAX - 1]) {
    -			*np = '\0';
    -			putf("\r\n");
    -			break;
    -		}
    -		if (islower(c))
    -			lower = 1;
    -		else if (isupper(c))
    -			upper = 1;
    -		else if (c == ERASE || c == '#' || c == '\b') {
    -			if (np > name) {
    -				np--;
    -				if (cfgetospeed(&tmode) >= 1200)
    -					xputs("\b \b");
    -				else
    -					putchr(cs);
    -			}
    -			continue;
    -		} else if (c == KILL || c == '@') {
    -			putchr(cs);
    -			putchr('\r');
    -			if (cfgetospeed(&tmode) < 1200)
    -				putchr('\n');
    -			/* this is the way they do it down under ... */
    -			else if (np > name)
    -				xputs(
    -				    "                                     \r");
    -			prompt();
    -			np = name;
    -			continue;
    -		} else if (isdigit(c) || c == '_')
    -			digit_or_punc = 1;
    -		if (IG && (c <= ' ' || c > 0176))
    -			continue;
    -		*np++ = c;
    -		putchr(cs);
    -
    -		/*
    -		 * An MS-Windows direct connect PPP "client" won't send its
    -		 * first PPP packet until we respond to its "CLIENT" poll
    -		 * with a CRLF sequence.  We cater to yet another broken
    -		 * implementation of a previously-standard protocol...
    -		 */
    -		*np = '\0';
    -		if (strstr(name, "CLIENT"))
    -			putf("\r\n");
    -	}
    -	(void)signal(SIGINT, SIG_IGN);
    -	*np = 0;
    -	if (c == '\r')
    -		crmod = 1;
    -	if ((upper && !lower && !LC) || UC)
    -		for (np = name; *np; np++)
    -			*np = tolower((unsigned char)*np);
    -	return (1 + ppp_connection);
    -}
    -
    -static void
    -xputs(const char *s)
    -{
    -	while (*s)
    -		putchr(*s++);
    -}
    -
    -char	outbuf[OBUFSIZ];
    -size_t	obufcnt = 0;
    -
    -static int
    -putchr(int cc)
    -{
    -	unsigned char c;
    -
    -	c = cc;
    -	if (!NP) {
    -		c |= partab[c&0177] & 0200;
    -		if (OP)
    -			c ^= 0200;
    -	}
    -	if (!UB) {
    -		outbuf[obufcnt++] = c;
    -		if (obufcnt >= OBUFSIZ)
    -			oflush();
    -		return 1;
    -	}
    -	return write(STDOUT_FILENO, &c, 1);
    -}
    -
    -static void
    -oflush(void)
    -{
    -	if (obufcnt)
    -		(void)write(STDOUT_FILENO, outbuf, obufcnt);
    -	obufcnt = 0;
    -}
    -
    -static void
    -prompt(void)
    -{
    -
    -	putf(LM);
    -	if (CO)
    -		putchr('\n');
    -}
    -
    -static void
    -putf(const char *cp)
    -{
    -	time_t t;
    -	char *slash, db[100];
    -
    -	while (*cp) {
    -		if (*cp != '%') {
    -			putchr(*cp++);
    -			continue;
    -		}
    -		switch (*++cp) {
    -
    -		case 't':
    -			if ((slash = strstr(ttyn, "/pts/")) == NULL)
    -				slash = strrchr(ttyn, '/');
    -			if (slash == NULL)
    -				xputs(ttyn);
    -			else
    -				xputs(&slash[1]);
    -			break;
    -
    -		case 'h':
    -			xputs(editedhost);
    -			break;
    -
    -		case 'd':
    -			(void)time(&t);
    -			(void)strftime(db, sizeof(db),
    -			    "%l:%M%p on %A, %d %B %Y", localtime(&t));
    -			xputs(db);
    -			break;
    -
    -		case 's':
    -			xputs(kerninfo.sysname);
    -			break;
    -
    -		case 'm':
    -			xputs(kerninfo.machine);
    -			break;
    -
    -		case 'r':
    -			xputs(kerninfo.release);
    -			break;
    -
    -		case 'v':
    -			xputs(kerninfo.version);
    -			break;
    -
    -		case '%':
    -			putchr('%');
    -			break;
    -		}
    -		if (*cp)
    -			cp++;
    -	}
    -}
    -
    -static void
    -clearscreen(void)
    -{
    -	struct ttyent *typ;
    -	int err;
    -
    -	if (rawttyn == NULL)
    -		return;
    -
    -	typ = getttynam(rawttyn);
    -
    -	if ((typ == NULL) || (typ->ty_type == NULL) ||
    -	    (typ->ty_type[0] == 0))
    -		return;
    -
    -	if (setupterm(typ->ty_type, 0, &err) == ERR)
    -		return;
    -
    -	if (clear_screen)
    -		putpad(clear_screen);
    -
    -	del_curterm(cur_term);
    -	cur_term = NULL;
    -}
    diff --git a/libexec/getty/pathnames.h b/libexec/getty/pathnames.h
    deleted file mode 100644
    index 2634fede6..000000000
    --- a/libexec/getty/pathnames.h
    +++ /dev/null
    @@ -1,37 +0,0 @@
    -/*	$NetBSD: pathnames.h,v 1.9 2008/02/04 15:27:20 christos Exp $	*/
    -
    -/*
    - * Copyright (c) 1989, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    -~ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - *	from: @(#)pathnames.h	8.1 (Berkeley) 6/4/93
    - */
    -
    -#include 
    -
    -#define	_PATH_LOGIN	"/usr/bin/login"
    -#define	_PATH_LOCK	"/var/spool/lock/LCK.."
    diff --git a/libexec/getty/subr.c b/libexec/getty/subr.c
    deleted file mode 100644
    index c46695cc7..000000000
    --- a/libexec/getty/subr.c
    +++ /dev/null
    @@ -1,742 +0,0 @@
    -/*	$NetBSD: subr.c,v 1.35 2013/08/11 16:36:30 dholland Exp $	*/
    -
    -/*
    - * Copyright (c) 1983, 1993
    - *	The Regents of the University of California.  All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer in the
    - *    documentation and/or other materials provided with the distribution.
    - * 3. Neither the name of the University nor the names of its contributors
    - *    may be used to endorse or promote products derived from this software
    - *    without specific prior written permission.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    - * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - */
    -
    -#include 
    -#ifndef lint
    -#if 0
    -static char sccsid[] = "from: @(#)subr.c	8.1 (Berkeley) 6/4/93";
    -#else
    -__RCSID("$NetBSD: subr.c,v 1.35 2013/08/11 16:36:30 dholland Exp $");
    -#endif
    -#endif /* not lint */
    -
    -/*
    - * Melbourne getty.
    - */
    -#if !defined(__minix)
    -#define COMPAT_43
    -#endif /* !defined(__minix) */
    -#include 
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include "extern.h"
    -#include "gettytab.h"
    -#include "pathnames.h"
    -
    -extern	struct termios tmode, omode;
    -
    -#if !defined(__minix)
    -static void	compatflags(long);
    -#endif /* !defined(__minix) */
    -
    -/*
    - * Get a table entry.
    - */
    -void
    -gettable(const char *name, char *buf)
    -{
    -	struct gettystrs *sp;
    -	struct gettynums *np;
    -	struct gettyflags *fp;
    -	long n;
    -	const char *dba[2];
    -	dba[0] = _PATH_GETTYTAB;
    -	dba[1] = NULL;
    -
    -	if (cgetent(&buf, dba, name) != 0)
    -		return;
    -
    -	for (sp = gettystrs; sp->field; sp++)
    -		(void)cgetstr(buf, sp->field, &sp->value);
    -	for (np = gettynums; np->field; np++) {
    -		if (cgetnum(buf, np->field, &n) == -1)
    -			np->set = 0;
    -		else {
    -			np->set = 1;
    -			np->value = n;
    -		}
    -	}
    -	for (fp = gettyflags; fp->field; fp++) {
    -		if (cgetcap(buf, fp->field, ':') == NULL)
    -			fp->set = 0;
    -		else {
    -			fp->set = 1;
    -			fp->value = 1 ^ fp->invrt;
    -		}
    -	}
    -#ifdef DEBUG
    -	printf("name=\"%s\", buf=\"%s\"\n", name, buf);
    -	for (sp = gettystrs; sp->field; sp++)
    -		printf("cgetstr: %s=%s\n", sp->field, sp->value);
    -	for (np = gettynums; np->field; np++)
    -		printf("cgetnum: %s=%d\n", np->field, np->value);
    -	for (fp = gettyflags; fp->field; fp++)
    -		printf("cgetflags: %s='%c' set='%c'\n", fp->field, 
    -		       fp->value + '0', fp->set + '0');
    -	exit(1);
    -#endif /* DEBUG */
    -}
    -
    -void
    -gendefaults(void)
    -{
    -	struct gettystrs *sp;
    -	struct gettynums *np;
    -	struct gettyflags *fp;
    -
    -	for (sp = gettystrs; sp->field; sp++)
    -		if (sp->value)
    -			sp->defalt = sp->value;
    -	for (np = gettynums; np->field; np++)
    -		if (np->set)
    -			np->defalt = np->value;
    -	for (fp = gettyflags; fp->field; fp++)
    -		if (fp->set)
    -			fp->defalt = fp->value;
    -		else
    -			fp->defalt = fp->invrt;
    -}
    -
    -void
    -setdefaults(void)
    -{
    -	struct gettystrs *sp;
    -	struct gettynums *np;
    -	struct gettyflags *fp;
    -
    -	for (sp = gettystrs; sp->field; sp++)
    -		if (!sp->value)
    -			sp->value = sp->defalt ? estrdup(sp->defalt) : NULL;
    -	for (np = gettynums; np->field; np++)
    -		if (!np->set)
    -			np->value = np->defalt;
    -	for (fp = gettyflags; fp->field; fp++)
    -		if (!fp->set)
    -			fp->value = fp->defalt;
    -}
    -
    -static char **
    -charnames[] = {
    -	&ER, &KL, &IN, &QU, &XN, &XF, &ET, &BK,
    -	&SU, &DS, &RP, &FL, &WE, &LN, &ST, &B2, 0
    -};
    -
    -static cc_t *
    -charvars[] = {
    -	&tmode.c_cc[VERASE], &tmode.c_cc[VKILL], &tmode.c_cc[VINTR],
    -	&tmode.c_cc[VQUIT], &tmode.c_cc[VSTART], &tmode.c_cc[VSTOP],
    -	&tmode.c_cc[VEOF], &tmode.c_cc[VEOL], &tmode.c_cc[VSUSP],
    -	&tmode.c_cc[VDSUSP], &tmode.c_cc[VREPRINT], &tmode.c_cc[VDISCARD],
    -	&tmode.c_cc[VWERASE], &tmode.c_cc[VLNEXT], &tmode.c_cc[VSTATUS],
    -	&tmode.c_cc[VEOL2], 0
    -};
    -
    -void
    -setchars(void)
    -{
    -	int i;
    -	char *p;
    -
    -	for (i = 0; charnames[i]; i++) {
    -		p = *charnames[i];
    -		if (p && *p)
    -			*charvars[i] = *p;
    -		else
    -			*charvars[i] = _POSIX_VDISABLE;
    -	}
    -}
    -
    -/* Macros to clear/set/test flags. */
    -#define	SET(t, f)	(t) |= (f)
    -#define	CLR(t, f)	(t) &= ~(f)
    -#define	ISSET(t, f)	((t) & (f))
    -
    -void
    -setflags(int n)
    -{
    -	tcflag_t iflag, oflag, cflag, lflag;
    -
    -#ifdef COMPAT_43
    -	switch (n) {
    -	case 0:
    -		if (F0set) {
    -			compatflags(F0);
    -			return;
    -		}
    -		break;
    -	case 1:
    -		if (F1set) {
    -			compatflags(F1);
    -			return;
    -		}
    -		break;
    -	default:
    -		if (F2set) {
    -			compatflags(F2);
    -			return;
    -		}
    -		break;
    -	}
    -#endif
    -
    -	switch (n) {
    -	case 0:
    -		if (C0set && I0set && L0set && O0set) {
    -			tmode.c_cflag = C0;
    -			tmode.c_iflag = I0;
    -			tmode.c_lflag = L0;
    -			tmode.c_oflag = O0;
    -			return;
    -		}
    -		break;
    -	case 1:
    -		if (C1set && I1set && L1set && O1set) {
    -			tmode.c_cflag = C1;
    -			tmode.c_iflag = I1;
    -			tmode.c_lflag = L1;
    -			tmode.c_oflag = O1;
    -			return;
    -		}
    -		break;
    -	default:
    -		if (C2set && I2set && L2set && O2set) {
    -			tmode.c_cflag = C2;
    -			tmode.c_iflag = I2;
    -			tmode.c_lflag = L2;
    -			tmode.c_oflag = O2;
    -			return;
    -		}
    -		break;
    -	}
    -
    -	iflag = omode.c_iflag;
    -	oflag = omode.c_oflag;
    -	cflag = omode.c_cflag;
    -	lflag = omode.c_lflag;
    -
    -	if (NP) {
    -		CLR(cflag, CSIZE|PARENB);
    -		SET(cflag, CS8);
    -		CLR(iflag, ISTRIP|INPCK|IGNPAR);
    -	} else if (AP || EP || OP) {
    -		CLR(cflag, CSIZE);
    -		SET(cflag, CS7|PARENB);
    -		SET(iflag, ISTRIP);
    -		if (OP && !EP) {
    -			SET(iflag, INPCK|IGNPAR);
    -			SET(cflag, PARODD);
    -			if (AP)
    -				CLR(iflag, INPCK);
    -		} else if (EP && !OP) {
    -			SET(iflag, INPCK|IGNPAR);
    -			CLR(cflag, PARODD);
    -			if (AP)
    -				CLR(iflag, INPCK);
    -		} else if (AP || (EP && OP)) {
    -			CLR(iflag, INPCK|IGNPAR);
    -			CLR(cflag, PARODD);
    -		}
    -	} /* else, leave as is */
    -
    -#if 0
    -	if (UC)
    -		f |= LCASE;
    -#endif
    -
    -	if (HC)
    -		SET(cflag, HUPCL);
    -	else
    -		CLR(cflag, HUPCL);
    -
    -#if !defined(__minix)
    -	if (MB)
    -		SET(cflag, MDMBUF);
    -	else
    -		CLR(cflag, MDMBUF);
    -#endif /* !defined(__minix) */
    -
    -	if (NL) {
    -		SET(iflag, ICRNL);
    -		SET(oflag, ONLCR|OPOST);
    -	} else {
    -		CLR(iflag, ICRNL);
    -		CLR(oflag, ONLCR);
    -	}
    -
    -#if !defined(__minix)
    -	if (!HT)
    -		SET(oflag, OXTABS|OPOST);
    -	else
    -		CLR(oflag, OXTABS);
    -#endif /* !defined(__minix) */
    -
    -#ifdef XXX_DELAY
    -	SET(f, delaybits());
    -#endif
    -
    -	if (n == 1) {		/* read mode flags */
    -		if (RW) {
    -			iflag = 0;
    -			CLR(oflag, OPOST);
    -			CLR(cflag, CSIZE|PARENB);
    -			SET(cflag, CS8);
    -			lflag = 0;
    -		} else {
    -			CLR(lflag, ICANON);
    -		}
    -		goto out;
    -	}
    -
    -	if (n == 0)
    -		goto out;
    -
    -#if 0
    -	if (CB)
    -		SET(f, CRTBS);
    -#endif
    -
    -	if (CE)
    -		SET(lflag, ECHOE);
    -	else
    -		CLR(lflag, ECHOE);
    -
    -#if !defined(__minix)
    -	if (CK)
    -		SET(lflag, ECHOKE);
    -	else
    -		CLR(lflag, ECHOKE);
    -
    -	if (PE)
    -		SET(lflag, ECHOPRT);
    -	else
    -		CLR(lflag, ECHOPRT);
    -#endif /* !defined(__minix) */
    -
    -	if (EC)
    -		SET(lflag, ECHO);
    -	else
    -		CLR(lflag, ECHO);
    -
    -#if !defined(__minix)
    -	if (XC)
    -		SET(lflag, ECHOCTL);
    -	else
    -		CLR(lflag, ECHOCTL);
    -#endif /* !defined(__minix) */
    -
    -	if (DX)
    -		SET(lflag, IXANY);
    -	else
    -		CLR(lflag, IXANY);
    -
    -out:
    -	tmode.c_iflag = iflag;
    -	tmode.c_oflag = oflag;
    -	tmode.c_cflag = cflag;
    -	tmode.c_lflag = lflag;
    -}
    -
    -#ifdef COMPAT_43
    -/*
    - * Old TTY => termios, snatched from 
    - */
    -void
    -compatflags(long flags)
    -{
    -	tcflag_t iflag, oflag, cflag, lflag;
    -
    -	iflag = BRKINT|ICRNL|IMAXBEL|IXON|IXANY;
    -	oflag = OPOST|ONLCR|OXTABS;
    -	cflag = CREAD;
    -	lflag = ICANON|ISIG|IEXTEN;
    -
    -	if (ISSET(flags, TANDEM))
    -		SET(iflag, IXOFF);
    -	else
    -		CLR(iflag, IXOFF);
    -	if (ISSET(flags, ECHO))
    -		SET(lflag, ECHO);
    -	else
    -		CLR(lflag, ECHO);
    -	if (ISSET(flags, CRMOD)) {
    -		SET(iflag, ICRNL);
    -		SET(oflag, ONLCR);
    -	} else {
    -		CLR(iflag, ICRNL);
    -		CLR(oflag, ONLCR);
    -	}
    -	if (ISSET(flags, XTABS))
    -		SET(oflag, OXTABS);
    -	else
    -		CLR(oflag, OXTABS);
    -
    -
    -	if (ISSET(flags, RAW)) {
    -		iflag &= IXOFF;
    -		CLR(lflag, ISIG|ICANON|IEXTEN);
    -		CLR(cflag, PARENB);
    -	} else {
    -		SET(iflag, BRKINT|IXON|IMAXBEL);
    -		SET(lflag, ISIG|IEXTEN);
    -		if (ISSET(flags, CBREAK))
    -			CLR(lflag, ICANON);
    -		else
    -			SET(lflag, ICANON);
    -		switch (ISSET(flags, ANYP)) {
    -		case 0:
    -			CLR(cflag, PARENB);
    -			break;
    -		case ANYP:
    -			SET(cflag, PARENB);
    -			CLR(iflag, INPCK);
    -			break;
    -		case EVENP:
    -			SET(cflag, PARENB);
    -			SET(iflag, INPCK);
    -			CLR(cflag, PARODD);
    -			break;
    -		case ODDP:
    -			SET(cflag, PARENB);
    -			SET(iflag, INPCK);
    -			SET(cflag, PARODD);
    -			break;
    -		}
    -	}
    -
    -	/* Nothing we can do with CRTBS. */
    -	if (ISSET(flags, PRTERA))
    -		SET(lflag, ECHOPRT);
    -	else
    -		CLR(lflag, ECHOPRT);
    -	if (ISSET(flags, CRTERA))
    -		SET(lflag, ECHOE);
    -	else
    -		CLR(lflag, ECHOE);
    -#if !defined(__minix)
    -	/* Nothing we can do with TILDE. */
    -	if (ISSET(flags, MDMBUF))
    -		SET(cflag, MDMBUF);
    -	else
    -		CLR(cflag, MDMBUF);
    -#endif /* !defined(__minix) */
    -	if (ISSET(flags, NOHANG))
    -		CLR(cflag, HUPCL);
    -	else
    -		SET(cflag, HUPCL);
    -#if !defined(__minix)
    -	if (ISSET(flags, CRTKIL))
    -		SET(lflag, ECHOKE);
    -	else
    -		CLR(lflag, ECHOKE);
    -#endif /* !defined(__minix) */
    -	if (ISSET(flags, CTLECH))
    -		SET(lflag, ECHOCTL);
    -	else
    -		CLR(lflag, ECHOCTL);
    -	if (!ISSET(flags, DECCTQ))
    -		SET(iflag, IXANY);
    -	else
    -		CLR(iflag, IXANY);
    -	CLR(lflag, TOSTOP|FLUSHO|PENDIN|NOFLSH);
    -	SET(lflag, ISSET(flags, TOSTOP|FLUSHO|PENDIN|NOFLSH));
    -
    -	if (ISSET(flags, RAW|LITOUT|PASS8)) {
    -		CLR(cflag, CSIZE);
    -		SET(cflag, CS8);
    -		if (!ISSET(flags, RAW|PASS8))
    -			SET(iflag, ISTRIP);
    -		else
    -			CLR(iflag, ISTRIP);
    -		if (!ISSET(flags, RAW|LITOUT))
    -			SET(oflag, OPOST);
    -		else
    -			CLR(oflag, OPOST);
    -	} else {
    -		CLR(cflag, CSIZE);
    -		SET(cflag, CS7);
    -		SET(iflag, ISTRIP);
    -		SET(oflag, OPOST);
    -	}
    -
    -	tmode.c_iflag = iflag;
    -	tmode.c_oflag = oflag;
    -	tmode.c_cflag = cflag;
    -	tmode.c_lflag = lflag;
    -}
    -#endif
    -
    -#ifdef XXX_DELAY
    -struct delayval {
    -	unsigned	delay;		/* delay in ms */
    -	int		bits;
    -};
    -
    -/*
    - * below are random guesses, I can't be bothered checking
    - */
    -
    -struct delayval	crdelay[] = {
    -	{ 1,		CR1 },
    -	{ 2,		CR2 },
    -	{ 3,		CR3 },
    -	{ 83,		CR1 },
    -	{ 166,		CR2 },
    -	{ 0,		CR3 },
    -};
    -
    -struct delayval nldelay[] = {
    -	{ 1,		NL1 },		/* special, calculated */
    -	{ 2,		NL2 },
    -	{ 3,		NL3 },
    -	{ 100,		NL2 },
    -	{ 0,		NL3 },
    -};
    -
    -struct delayval	bsdelay[] = {
    -	{ 1,		BS1 },
    -	{ 0,		0 },
    -};
    -
    -struct delayval	ffdelay[] = {
    -	{ 1,		FF1 },
    -	{ 1750,		FF1 },
    -	{ 0,		FF1 },
    -};
    -
    -struct delayval	tbdelay[] = {
    -	{ 1,		 TAB1 },
    -	{ 2,		 TAB2 },
    -	{ 3,		XTABS },	/* this is expand tabs */
    -	{ 100,		 TAB1 },
    -	{ 0,		 TAB2 },
    -};
    -
    -int
    -delaybits(void)
    -{
    -	int f;
    -
    -	f  = adelay(CD, crdelay);
    -	f |= adelay(ND, nldelay);
    -	f |= adelay(FD, ffdelay);
    -	f |= adelay(TD, tbdelay);
    -	f |= adelay(BD, bsdelay);
    -	return (f);
    -}
    -
    -int
    -adelay(int ms, struct delayval *dp)
    -{
    -	if (ms == 0)
    -		return (0);
    -	while (dp->delay && ms > dp->delay)
    -		dp++;
    -	return (dp->bits);
    -}
    -#endif
    -
    -char	editedhost[MAXHOSTNAMELEN];
    -
    -void
    -edithost(const char *pat)
    -{
    -	char *host = HN;
    -	char *res = editedhost;
    -
    -	if (!pat)
    -		pat = "";
    -	while (*pat) {
    -		switch (*pat) {
    -
    -		case '#':
    -			if (*host)
    -				host++;
    -			break;
    -
    -		case '@':
    -			if (*host)
    -				*res++ = *host++;
    -			break;
    -
    -		default:
    -			*res++ = *pat;
    -			break;
    -
    -		}
    -		if (res == &editedhost[sizeof editedhost - 1]) {
    -			*res = '\0';
    -			return;
    -		}
    -		pat++;
    -	}
    -	if (*host)
    -		(void)strncpy(res, host,
    -		    sizeof editedhost - (res - editedhost) - 1);
    -	else
    -		*res = '\0';
    -	editedhost[sizeof editedhost - 1] = '\0';
    -}
    -
    -void
    -makeenv(char *env[])
    -{
    -	static char termbuf[128] = "TERM=";
    -	char *p, *q;
    -	char **ep;
    -
    -	ep = env;
    -	if (TT && *TT) {
    -		(void)strlcat(termbuf, TT, sizeof(termbuf));
    -		*ep++ = termbuf;
    -	}
    -	if ((p = EV) != NULL) {
    -		q = p;
    -		while ((q = strchr(q, ',')) != NULL) {
    -			*q++ = '\0';
    -			*ep++ = p;
    -			p = q;
    -		}
    -		if (*p)
    -			*ep++ = p;
    -	}
    -	*ep = (char *)0;
    -}
    -
    -/*
    - * This speed select mechanism is written for the Develcon DATASWITCH.
    - * The Develcon sends a string of the form "B{speed}\n" at a predefined
    - * baud rate. This string indicates the user's actual speed.
    - * The routine below returns the terminal type mapped from derived speed.
    - */
    -struct	portselect {
    -	const char *ps_baud;
    -	const char *ps_type;
    -} portspeeds[] = {
    -	{ "B110",	"std.110" },
    -	{ "B134",	"std.134" },
    -	{ "B150",	"std.150" },
    -	{ "B300",	"std.300" },
    -	{ "B600",	"std.600" },
    -	{ "B1200",	"std.1200" },
    -	{ "B2400",	"std.2400" },
    -	{ "B4800",	"std.4800" },
    -	{ "B9600",	"std.9600" },
    -	{ "B19200",	"std.19200" },
    -	{ NULL, NULL }
    -};
    -
    -const char *
    -portselector(void)
    -{
    -	char c, baud[20];
    -	const char *type = "default";
    -	struct portselect *ps;
    -	size_t len;
    -
    -	(void)alarm(5*60);
    -	for (len = 0; len < sizeof (baud) - 1; len++) {
    -		if (read(STDIN_FILENO, &c, 1) <= 0)
    -			break;
    -		c &= 0177;
    -		if (c == '\n' || c == '\r')
    -			break;
    -		if (c == 'B')
    -			len = 0;	/* in case of leading garbage */
    -		baud[len] = c;
    -	}
    -	baud[len] = '\0';
    -	for (ps = portspeeds; ps->ps_baud; ps++)
    -		if (strcmp(ps->ps_baud, baud) == 0) {
    -			type = ps->ps_type;
    -			break;
    -		}
    -	(void)sleep(2);	/* wait for connection to complete */
    -	return (type);
    -}
    -
    -/*
    - * This auto-baud speed select mechanism is written for the Micom 600
    - * portselector. Selection is done by looking at how the character '\r'
    - * is garbled at the different speeds.
    - */
    -#include 
    -
    -const char *
    -autobaud(void)
    -{
    -	struct pollfd set[1];
    -	struct timespec timeout;
    -	char c;
    -	const char *type = "9600-baud";
    -
    -	(void)tcflush(0, TCIOFLUSH);
    -	set[0].fd = STDIN_FILENO;
    -	set[0].events = POLLIN;
    -	if (poll(set, 1, 5000) <= 0)
    -		return (type);
    -	if (read(STDIN_FILENO, &c, 1) != 1)
    -		return (type);
    -	timeout.tv_sec = 0;
    -	timeout.tv_nsec = 20000;
    -	(void)nanosleep(&timeout, NULL);
    -	(void)tcflush(0, TCIOFLUSH);
    -	switch (c & 0377) {
    -
    -	case 0200:		/* 300-baud */
    -		type = "300-baud";
    -		break;
    -
    -	case 0346:		/* 1200-baud */
    -		type = "1200-baud";
    -		break;
    -
    -	case  015:		/* 2400-baud */
    -	case 0215:
    -		type = "2400-baud";
    -		break;
    -
    -	default:		/* 4800-baud */
    -		type = "4800-baud";
    -		break;
    -
    -	case 0377:		/* 9600-baud */
    -		type = "9600-baud";
    -		break;
    -	}
    -	return (type);
    -}
    diff --git a/libexec/getty/ttys.5 b/libexec/getty/ttys.5
    deleted file mode 100644
    index e6e9f1f1f..000000000
    --- a/libexec/getty/ttys.5
    +++ /dev/null
    @@ -1,227 +0,0 @@
    -.\"	$NetBSD: ttys.5,v 1.20 2015/02/12 07:32:09 aymeric Exp $
    -.\"
    -.\" Copyright (c) 1985, 1991, 1993
    -.\"	The Regents of the University of California.  All rights reserved.
    -.\"
    -.\" Redistribution and use in source and binary forms, with or without
    -.\" modification, are permitted provided that the following conditions
    -.\" are met:
    -.\" 1. Redistributions of source code must retain the above copyright
    -.\"    notice, this list of conditions and the following disclaimer.
    -.\" 2. Redistributions in binary form must reproduce the above copyright
    -.\"    notice, this list of conditions and the following disclaimer in the
    -.\"    documentation and/or other materials provided with the distribution.
    -.\" 3. Neither the name of the University nor the names of its contributors
    -.\"    may be used to endorse or promote products derived from this software
    -.\"    without specific prior written permission.
    -.\"
    -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
    -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    -.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
    -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    -.\" SUCH DAMAGE.
    -.\"
    -.\"     from: @(#)ttys.5	8.1 (Berkeley) 6/4/93
    -.\"
    -.Dd April 5, 2012
    -.Dt TTYS 5
    -.Os
    -.Sh NAME
    -.Nm ttys
    -.Nd terminal initialization information
    -.Sh DESCRIPTION
    -The file
    -.Nm
    -contains information that is used by various routines to initialize
    -and control the use of terminal special files.
    -This information is read with the
    -.Xr getttyent 3
    -library routines.
    -.Pp
    -There is one line in the
    -.Nm
    -file per special device file.
    -Fields are separated by tabs and/or spaces.
    -Fields comprising more than one word should be enclosed in double
    -quotes (``"'').
    -Blank lines and comments may appear anywhere in the file; comments
    -are delimited by hash marks (``#'') and new lines.
    -Any unspecified fields will default to null.
    -.Pp
    -Each line in
    -.Nm
    -has the format:
    -.Dl tty command type flags
    -.Pp
    -The first field is the
    -name of the terminal special file as it is found in
    -.Pa /dev .
    -.Pp
    -The second field of the file is the command to execute for the line,
    -usually
    -.Xr getty 8 ,
    -which initializes and opens the line, setting the speed, waiting for
    -a user name and executing the
    -.Xr login 1
    -program.
    -However, it can be any desired command, for example the start up
    -for a window system terminal emulator or some other daemon process,
    -and can contain multiple words if quoted.
    -.Pp
    -The third field is the type of terminal usually connected to that
    -tty line, normally the one found in the
    -.Xr terminfo 5
    -data base file.
    -The environment variable
    -.Dv TERM
    -is initialized with the value by either
    -.Xr getty 8
    -or
    -.Xr login 1 .
    -.Pp
    -The remaining fields set flags in the
    -.Fa ty_status
    -entry (see
    -.Xr getttyent 3 )
    -or specify a window system process that
    -.Xr init 8
    -will maintain for the terminal line
    -or a key into a database of tty attributes (currently unused).
    -.Pp
    -.Bl -tag -width softcar
    -.It Sy on No or Sy off
    -.Xr init 8
    -should (or should not) execute the command given in the second field.
    -.It Sy secure
    -If
    -.Sy on
    -is specified, allows users with a uid of 0
    -.Pq e.g. Qq root
    -to login on this line.
    -.It Sy local
    -Sets the
    -.Dv TIOCFLAG_CLOCAL
    -.Xr tty 4
    -flag for the device.
    -This will cause the
    -.Xr termios 4
    -.Dv CLOCAL
    -flag to be set on every open and thus modem control signal lines will be
    -ignored by default.
    -.It Sy softcar
    -Causes the driver to ignore hardware carrier on the line (by setting the
    -.Dv TIOCFLAG_SOFTCAR
    -.Xr tty 4
    -flag).
    -.It Sy rtscts
    -Sets the
    -.Dv TIOCFLAG_CRTSCTS
    -.Xr tty 4
    -flag for the device to enable
    -.Tn RTS /
    -.Tn CTS
    -.Qq hardware
    -flow control by default.
    -.It Sy mdmbuf
    -Sets the
    -.Dv TIOCFLAG_MDMBUF
    -.Xr tty 4
    -flag for the device to enable
    -.Tn DTR /
    -.Tn DCD
    -.Qq hardware
    -flow control by default.
    -.El
    -.Pp
    -The flags
    -.Qq local ,
    -.Qq rtscts ,
    -.Qq mdmbuf ,
    -and
    -.Qq softcar
    -modify the default behaviour of the terminal line, and their actions
    -are device driver dependent.
    -These flag fields should not be quoted.
    -.Pp
    -The string ``window='' may be followed by a quoted command
    -string which
    -.Xr init 8
    -will execute
    -.Em before
    -starting the command specified by the second field.
    -.Pp
    -The string ``class='' may be followed by a quoted string used
    -as a key into a database of attributes for that category of tty.
    -See
    -.Xr getttynam 3
    -for more information on this feature.
    -.Pp
    -After changing the
    -.Nm
    -file a
    -.Dv SIGHUP
    -signal can be sent to
    -.Xr init 8
    -with the command
    -.Dq Li "kill \-s HUP 1" .
    -On receipt of this signal,
    -.Xr init 8
    -will re-read the
    -.Nm
    -file and spawn any necessary
    -.Xr getty 8
    -processes.
    -.Pp
    -.Sy Nota Bene :
    -Sending
    -.Dv SIGHUP
    -to
    -.Xr init 8
    -does
    -.Em not
    -change the state of the various
    -.Xr tty 4
    -device flags listed above; the
    -.Xr ttyflags 8
    -program must be run for changes in those flags to take effect on the devices.
    -.Sh FILES
    -.Bl -tag -width /etc/ttys -compact
    -.It Pa /etc/ttys
    -.El
    -.Sh EXAMPLES
    -.Bd -literal
    -# root login on console at 1200 baud
    -console	"/usr/libexec/getty std.1200"	vt100	on secure
    -# dialup at 1200 baud, no root logins
    -tty00	"/usr/libexec/getty d1200"	dialup	on	# 555-1234
    -# Mike's terminal: hp2621
    -ttyh0	"/usr/libexec/getty std.9600"	hp2621-nl	on	# 457 Evans
    -# John's terminal: vt100
    -ttyh1	"/usr/libexec/getty std.9600"	vt100	on		# 459 Evans
    -# terminal emulate/window system
    -ttyv0	"/usr/new/xterm -L :0"		vs100	on window="/usr/new/Xvs100 0"
    -# Network pseudo ttys -- don't enable getty
    -ttyp0	none	network
    -ttyp1	none	network	off
    -.Ed
    -.Sh SEE ALSO
    -.Xr login 1 ,
    -.Xr getttyent 3 ,
    -.Xr ttyslot 3 ,
    -.Xr tty 4 ,
    -.Xr gettytab 5 ,
    -.Xr terminfo 5 ,
    -.Xr getty 8 ,
    -.Xr init 8 ,
    -.Xr ttyflags 8
    -.Sh HISTORY
    -A
    -.Nm
    -file appeared in
    -.At v6 .
    diff --git a/libexec/httpd/Makefile.boot b/libexec/httpd/Makefile.boot
    deleted file mode 100644
    index 8a9aaf0f1..000000000
    --- a/libexec/httpd/Makefile.boot
    +++ /dev/null
    @@ -1,26 +0,0 @@
    -# $eterna: Makefile.boot,v 1.9 2010/05/10 04:57:50 mrg Exp $
    -#
    -# very simple makefile to compile bozohttpd, should work with every make.
    -# see Makefile for a list of compile options that may be placed in CFLAGS.
    -
    -CC=	cc
    -OPT=	-O
    -LARGE_CFLAGS=	-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
    -LOCAL_CFLAGS=	-DNO_LUA_SUPPORT
    -CFLAGS=	$(OPT) $(LARGE_CFLAGS) $(LOCAL_CFLAGS)
    -
    -GROFF=	groff -Tascii
    -CRYPTOLIBDIR=	# -L/usr/local/lib
    -CRYPTOLIBS=	$(CRYPTOLIBDIR) -lcrypto -lssl
    -
    -FILES=	bozohttpd.c auth-bozo.c cgi-bozo.c content-bozo.c daemon-bozo.c \
    -	dir-index-bozo.c lua-bozo.c ssl-bozo.c tilde-luzah-bozo.c main.c
    -
    -all:
    -	$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o bozohttpd $(FILES) $(CRYPTOLIBS)
    -
    -man:
    -	$(GROFF) -mandoc bozohttpd.8 > bozohttpd.cat8
    -
    -clean:
    -	rm -f bozohttpd bozohttpd.cat8 *.o
    diff --git a/libexec/httpd/auth-bozo.c b/libexec/httpd/auth-bozo.c
    deleted file mode 100644
    index 4a8dd666e..000000000
    --- a/libexec/httpd/auth-bozo.c
    +++ /dev/null
    @@ -1,272 +0,0 @@
    -/*	$NetBSD: auth-bozo.c,v 1.16 2014/12/26 19:52:00 mrg Exp $	*/
    -
    -/*	$eterna: auth-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $	*/
    -
    -/*
    - * Copyright (c) 1997-2014 Matthew R. Green
    - * All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer and
    - *    dedication in the documentation and/or other materials provided
    - *    with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
    - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - */
    -
    -/* this code implements "http basic authorisation" for bozohttpd */
    -
    -#ifdef DO_HTPASSWD
    -
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -
    -#include "bozohttpd.h"
    -
    -#ifndef AUTH_FILE
    -#define AUTH_FILE		".htpasswd"
    -#endif
    -
    -static	ssize_t	base64_decode(const unsigned char *, size_t,
    -			    unsigned char *, size_t);
    -
    -/*
    - * Check if HTTP authentication is required
    - */
    -int
    -bozo_auth_check(bozo_httpreq_t *request, const char *file)
    -{
    -	bozohttpd_t *httpd = request->hr_httpd;
    -	struct stat sb;
    -	char dir[MAXPATHLEN], authfile[MAXPATHLEN], *basename;
    -	char user[BUFSIZ], *pass;
    -	FILE *fp;
    -	int len;
    -
    -			/* get dir=dirname(file) */
    -	snprintf(dir, sizeof(dir), "%s", file);
    -	if ((basename = strrchr(dir, '/')) == NULL)
    -		strcpy(dir, ".");
    -	else {
    -		*basename++ = '\0';
    -			/* ensure basename(file) != AUTH_FILE */
    -		if (bozo_check_special_files(request, basename))
    -			return 1;
    -	}
    -	request->hr_authrealm = bozostrdup(httpd, dir);
    -
    -	if ((size_t)snprintf(authfile, sizeof(authfile), "%s/%s", dir, AUTH_FILE) >= 
    -	  sizeof(authfile)) {
    -		return bozo_http_error(httpd, 404, request,
    -			"authfile path too long");
    -	}
    -	if (stat(authfile, &sb) < 0) {
    -		debug((httpd, DEBUG_NORMAL,
    -		    "bozo_auth_check realm `%s' dir `%s' authfile `%s' missing",
    -		    dir, file, authfile));
    -		return 0;
    -	}
    -	if ((fp = fopen(authfile, "r")) == NULL)
    -		return bozo_http_error(httpd, 403, request,
    -			"no permission to open authfile");
    -	debug((httpd, DEBUG_NORMAL,
    -	    "bozo_auth_check realm `%s' dir `%s' authfile `%s' open",
    -	    dir, file, authfile));
    -	if (request->hr_authuser && request->hr_authpass) {
    -		while (fgets(user, sizeof(user), fp) != NULL) {
    -			len = strlen(user);
    -			if (len > 0 && user[len-1] == '\n')
    -				user[--len] = '\0';
    -			if ((pass = strchr(user, ':')) == NULL)
    -				continue;
    -			*pass++ = '\0';
    -			debug((httpd, DEBUG_NORMAL,
    -			    "bozo_auth_check authfile `%s':`%s' "
    -			    	"client `%s':`%s'",
    -			    user, pass, request->hr_authuser,
    -			    request->hr_authpass));
    -			if (strcmp(request->hr_authuser, user) != 0)
    -				continue;
    -			if (strcmp(crypt(request->hr_authpass, pass),
    -					pass) != 0)
    -				break;
    -			fclose(fp);
    -			return 0;
    -		}
    -	}
    -	fclose(fp);
    -	return bozo_http_error(httpd, 401, request, "bad auth");
    -}
    -
    -void
    -bozo_auth_init(bozo_httpreq_t *request)
    -{
    -	request->hr_authuser = NULL;
    -	request->hr_authpass = NULL;
    -}
    -
    -void
    -bozo_auth_cleanup(bozo_httpreq_t *request)
    -{
    -
    -	if (request == NULL)
    -		return;
    -	free(request->hr_authuser);
    -	free(request->hr_authpass);
    -	free(request->hr_authrealm);
    -}
    -
    -int
    -bozo_auth_check_headers(bozo_httpreq_t *request, char *val, char *str, ssize_t len)
    -{
    -	bozohttpd_t *httpd = request->hr_httpd;
    -
    -	if (strcasecmp(val, "authorization") == 0 &&
    -	    strncasecmp(str, "Basic ", 6) == 0) {
    -		char	authbuf[BUFSIZ];
    -		char	*pass = NULL;
    -		ssize_t	alen;
    -
    -		alen = base64_decode((unsigned char *)str + 6,
    -					(size_t)(len - 6),
    -					(unsigned char *)authbuf,
    -					sizeof(authbuf) - 1);
    -		if (alen != -1)
    -			authbuf[alen] = '\0';
    -		if (alen == -1 ||
    -		    (pass = strchr(authbuf, ':')) == NULL)
    -			return bozo_http_error(httpd, 400, request,
    -			    "bad authorization field");
    -		*pass++ = '\0';
    -		free(request->hr_authuser);
    -		free(request->hr_authpass);
    -		request->hr_authuser = bozostrdup(httpd, authbuf);
    -		request->hr_authpass = bozostrdup(httpd, pass);
    -		debug((httpd, DEBUG_FAT,
    -		    "decoded authorization `%s' as `%s':`%s'",
    -		    str, request->hr_authuser, request->hr_authpass));
    -			/* don't store in request->headers */
    -		return 1;
    -	}
    -	return 0;
    -}
    -
    -int
    -bozo_auth_check_special_files(bozo_httpreq_t *request,
    -				const char *name)
    -{
    -	bozohttpd_t *httpd = request->hr_httpd;
    -
    -	if (strcmp(name, AUTH_FILE) == 0)
    -		return bozo_http_error(httpd, 403, request,
    -				"no permission to open authfile");
    -	return 0;
    -}
    -
    -void
    -bozo_auth_check_401(bozo_httpreq_t *request, int code)
    -{
    -	bozohttpd_t *httpd = request->hr_httpd;
    -
    -	if (code == 401)
    -		bozo_printf(httpd,
    -			"WWW-Authenticate: Basic realm=\"%s\"\r\n",
    -			(request && request->hr_authrealm) ?
    -				request->hr_authrealm : "default realm");
    -}
    -
    -#ifndef NO_CGIBIN_SUPPORT
    -void
    -bozo_auth_cgi_setenv(bozo_httpreq_t *request,
    -			char ***curenvpp)
    -{
    -	bozohttpd_t *httpd = request->hr_httpd;
    -
    -	if (request->hr_authuser && *request->hr_authuser) {
    -		bozo_setenv(httpd, "AUTH_TYPE", "Basic", (*curenvpp)++);
    -		bozo_setenv(httpd, "REMOTE_USER", request->hr_authuser,
    -				(*curenvpp)++);
    -	}
    -}
    -
    -int
    -bozo_auth_cgi_count(bozo_httpreq_t *request)
    -{
    -	return (request->hr_authuser && *request->hr_authuser) ? 2 : 0;
    -}
    -#endif /* NO_CGIBIN_SUPPORT */
    -
    -/*
    - * Decode len bytes starting at in using base64 encoding into out.
    - * Result is *not* NUL terminated.
    - * Written by Luke Mewburn 
    - */
    -const unsigned char decodetable[] = {
    -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 
    -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 
    -	255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255,  62, 255, 255, 255,  63, 
    -	 52,  53,  54,  55,  56,  57,  58,  59,  60,  61, 255, 255, 255,   0, 255, 255, 
    -	255,   0,   1,   2,   3,   4,   5,   6,   7,   8,   9,  10,  11,  12,  13,  14, 
    -	 15,  16,  17,  18,  19,  20,  21,  22,  23,  24,  25, 255, 255, 255, 255, 255, 
    -	255,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40, 
    -	 41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51, 255, 255, 255, 255, 255, 
    -};
    -
    -static ssize_t
    -base64_decode(const unsigned char *in, size_t ilen, unsigned char *out,
    -	      size_t olen)
    -{
    -	unsigned char *cp;
    -	size_t	 i;
    -
    -	if (ilen == 0) {
    -		if (olen)
    -			*out = '\0';
    -		return 0;
    -	}
    -
    -	cp = out;
    -	for (i = 0; i < ilen; i += 4) {
    -		if (cp + 3 > out + olen)
    -			return (-1);
    -#define IN_CHECK(x) \
    -		if ((x) > sizeof(decodetable) || decodetable[(x)] == 255) \
    -			    return(-1)
    -
    -		IN_CHECK(in[i + 0]);
    -		/*LINTED*/
    -		*(cp++) = decodetable[in[i + 0]] << 2
    -			| decodetable[in[i + 1]] >> 4;
    -		IN_CHECK(in[i + 1]);
    -		/*LINTED*/
    -		*(cp++) = decodetable[in[i + 1]] << 4
    -			| decodetable[in[i + 2]] >> 2;
    -		IN_CHECK(in[i + 2]);
    -		*(cp++) = decodetable[in[i + 2]] << 6
    -			| decodetable[in[i + 3]];
    -#undef IN_CHECK
    -	}
    -	while (i > 0 && in[i - 1] == '=')
    -		cp--,i--;
    -	return (cp - out);
    -}
    -#endif /* DO_HTPASSWD */
    diff --git a/libexec/httpd/bozohttpd.c b/libexec/httpd/bozohttpd.c
    deleted file mode 100644
    index b717501c6..000000000
    --- a/libexec/httpd/bozohttpd.c
    +++ /dev/null
    @@ -1,2321 +0,0 @@
    -/*	$NetBSD: bozohttpd.c,v 1.66 2015/07/16 12:19:23 shm Exp $	*/
    -
    -/*	$eterna: bozohttpd.c,v 1.178 2011/11/18 09:21:15 mrg Exp $	*/
    -
    -/*
    - * Copyright (c) 1997-2015 Matthew R. Green
    - * All rights reserved.
    - *
    - * Redistribution and use in source and binary forms, with or without
    - * modification, are permitted provided that the following conditions
    - * are met:
    - * 1. Redistributions of source code must retain the above copyright
    - *    notice, this list of conditions and the following disclaimer.
    - * 2. Redistributions in binary form must reproduce the above copyright
    - *    notice, this list of conditions and the following disclaimer and
    - *    dedication in the documentation and/or other materials provided
    - *    with the distribution.
    - *
    - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
    - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
    - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
    - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
    - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
    - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    - * SUCH DAMAGE.
    - *
    - */
    -
    -/* this program is dedicated to the Great God of Processed Cheese */
    -
    -/*
    - * bozohttpd.c:  minimal httpd; provides only these features:
    - *	- HTTP/0.9 (by virtue of ..)
    - *	- HTTP/1.0
    - *	- HTTP/1.1
    - *	- CGI/1.1 this will only be provided for "system" scripts
    - *	- automatic "missing trailing slash" redirections
    - *	- configurable translation of /~user/ to ~user/public_html,
    - *	  however, this does not include cgi-bin support
    - *	- access lists via libwrap via inetd/tcpd
    - *	- virtual hosting
    - *	- not that we do not even pretend to understand MIME, but
    - *	  rely only on the HTTP specification
    - *	- ipv6 support
    - *	- automatic `index.html' generation
    - *	- configurable server name
    - *	- directory index generation
    - *	- daemon mode (lacks libwrap support)
    - *	- .htpasswd support
    - */
    -
    -/*
    - * requirements for minimal http/1.1 (at least, as documented in
    - * RFC 2616 (HTTP/1.1):
    - *
    - *	- 14.11: content-encoding handling. [1]
    - *
    - *	- 14.13: content-length handling.  this is only a SHOULD header
    - *	  thus we could just not send it ever.  [1]
    - *
    - *	- 14.17: content-type handling. [1]
    - *
    - *	- 14.28: if-unmodified-since handling.  if-modified-since is
    - *	  done since, shouldn't be too hard for this one.
    - *
    - * [1] need to revisit to ensure proper behaviour
    - *
    - * and the following is a list of features that we do not need
    - * to have due to other limits, or are too lazy.  there are more
    - * of these than are listed, but these are of particular note,
    - * and could perhaps be implemented.
    - *
    - *	- 3.5/3.6: content/transfer codings.  probably can ignore
    - *	  this?  we "SHOULD"n't.  but 4.4 says we should ignore a
    - *	  `content-length' header upon reciept of a `transfer-encoding'
    - *	  header.
    - *
    - *	- 5.1.1: request methods.  only MUST support GET and HEAD,
    - *	  but there are new ones besides POST that are currently
    - *	  supported: OPTIONS PUT DELETE TRACE and CONNECT, plus
    - *	  extensions not yet known?
    - *
    - * 	- 10.1: we can ignore informational status codes
    - *
    - *	- 10.3.3/10.3.4/10.3.8:  just use '302' codes always.
    - *
    - *	- 14.1/14.2/14.3/14.27: we do not support Accept: headers.
    - *	  just ignore them and send the request anyway.  they are
    - *	  only SHOULD.
    - *
    - *	- 14.5/14.16/14.35: only support simple ranges: %d- and %d-%d
    - *	  would be nice to support more.
    - *
    - *	- 14.9: we aren't a cache.
    - *
    - *	- 14.15: content-md5 would be nice.
    - *
    - *	- 14.24/14.26/14.27: if-match, if-none-match, if-range.  be
    - *	  nice to support this.
    - *
    - *	- 14.44: Vary: seems unneeded.  ignore it for now.
    - */
    -
    -#ifndef INDEX_HTML
    -#define INDEX_HTML		"index.html"
    -#endif
    -#ifndef SERVER_SOFTWARE
    -#define SERVER_SOFTWARE		"bozohttpd/20150501"
    -#endif
    -#ifndef DIRECT_ACCESS_FILE
    -#define DIRECT_ACCESS_FILE	".bzdirect"
    -#endif
    -#ifndef REDIRECT_FILE
    -#define REDIRECT_FILE		".bzredirect"
    -#endif
    -#ifndef ABSREDIRECT_FILE
    -#define ABSREDIRECT_FILE	".bzabsredirect"
    -#endif
    -#ifndef PUBLIC_HTML
    -#define PUBLIC_HTML		"public_html"
    -#endif
    -
    -#ifndef USE_ARG
    -#define USE_ARG(x)	/*LINTED*/(void)&(x)
    -#endif
    -
    -/*
    - * And so it begins ..
    - */
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include 
    -
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -#include 
    -
    -#include "bozohttpd.h"
    -
    -#ifndef MAX_WAIT_TIME
    -#define	MAX_WAIT_TIME	60	/* hang around for 60 seconds max */
    -#endif
    -
    -/* variables and functions */
    -#ifndef LOG_FTP
    -#define LOG_FTP LOG_DAEMON
    -#endif
    -
    -volatile sig_atomic_t	alarmhit;
    -
    -/*
    - * check there's enough space in the prefs and names arrays.
    - */
    -static int
    -size_arrays(bozoprefs_t *bozoprefs, unsigned needed)
    -{
    -	char	**temp;
    -
    -	if (bozoprefs->size == 0) {
    -		/* only get here first time around */
    -		bozoprefs->size = needed;
    -		if ((bozoprefs->name = calloc(sizeof(char *), needed)) == NULL) {
    -			(void) fprintf(stderr, "size_arrays: bad alloc\n");
    -			return 0;
    -		}
    -		if ((bozoprefs->value = calloc(sizeof(char *), needed)) == NULL) {
    -			free(bozoprefs->name);
    -			(void) fprintf(stderr, "size_arrays: bad alloc\n");
    -			return 0;
    -		}
    -	} else if (bozoprefs->c == bozoprefs->size) {
    -		/* only uses 'needed' when filled array */
    -		bozoprefs->size += needed;
    -		temp = realloc(bozoprefs->name, sizeof(char *) * needed);
    -		if (temp == NULL) {
    -			(void) fprintf(stderr, "size_arrays: bad alloc\n");
    -			return 0;
    -		}
    -		bozoprefs->name = temp;
    -		temp = realloc(bozoprefs->value, sizeof(char *) * needed);
    -		if (temp == NULL) {
    -			(void) fprintf(stderr, "size_arrays: bad alloc\n");
    -			return 0;
    -		}
    -		bozoprefs->value = temp;
    -	}
    -	return 1;
    -}
    -
    -static int
    -findvar(bozoprefs_t *bozoprefs, const char *name)
    -{
    -	unsigned	i;
    -
    -	for (i = 0 ; i < bozoprefs->c && strcmp(bozoprefs->name[i], name) != 0; i++)
    -		;
    -	return (i == bozoprefs->c) ? -1 : (int)i;
    -}
    -
    -int
    -bozo_set_pref(bozoprefs_t *bozoprefs, const char *name, const char *value)
    -{
    -	int	i;
    -
    -	if ((i = findvar(bozoprefs, name)) < 0) {
    -		/* add the element to the array */
    -		if (size_arrays(bozoprefs, bozoprefs->size + 15)) {
    -			bozoprefs->name[i = bozoprefs->c++] = strdup(name);
    -		}
    -	} else {
    -		/* replace the element in the array */
    -		if (bozoprefs->value[i]) {
    -			free(bozoprefs->value[i]);
    -			bozoprefs->value[i] = NULL;
    -		}
    -	}
    -	/* sanity checks for range of values go here */
    -	bozoprefs->value[i] = strdup(value);
    -	return 1;
    -}
    -
    -/*
    - * get a variable's value, or NULL
    - */
    -char *
    -bozo_get_pref(bozoprefs_t *bozoprefs, const char *name)
    -{
    -	int	i;
    -
    -	return ((i = findvar(bozoprefs, name)) < 0) ? NULL :
    -			bozoprefs->value[i];
    -}
    -
    -char *
    -bozo_http_date(char *date, size_t datelen)
    -{
    -	struct	tm *tm;
    -	time_t	now;
    -
    -	/* Sun, 06 Nov 1994 08:49:37 GMT */
    -	now = time(NULL);
    -	tm = gmtime(&now);	/* HTTP/1.1 spec rev 06 sez GMT only */
    -	strftime(date, datelen, "%a, %d %b %Y %H:%M:%S GMT", tm);
    -	return date;
    -}
    -
    -/*
    - * convert "in" into the three parts of a request (first line).
    - * we allocate into file and query, but return pointers into
    - * "in" for proto and method.
    - */
    -static void
    -parse_request(bozohttpd_t *httpd, char *in, char **method, char **file,
    -		char **query, char **proto)
    -{
    -	ssize_t	len;
    -	char	*val;
    -
    -	USE_ARG(httpd);
    -	debug((httpd, DEBUG_EXPLODING, "parse in: %s", in));
    -	*method = *file = *query = *proto = NULL;
    -
    -	len = (ssize_t)strlen(in);
    -	val = bozostrnsep(&in, " \t\n\r", &len);
    -	if (len < 1 || val == NULL)
    -		return;
    -	*method = val;
    -
    -	while (*in == ' ' || *in == '\t')
    -		in++;
    -	val = bozostrnsep(&in, " \t\n\r", &len);
    -	if (len < 1) {
    -		if (len == 0)
    -			*file = val;
    -		else
    -			*file = in;
    -	} else {
    -		*file = val;
    -
    -		*query = strchr(*file, '?');
    -		if (*query)
    -			*(*query)++ = '\0';
    -
    -		if (in) {
    -			while (*in && (*in == ' ' || *in == '\t'))
    -				in++;
    -			if (*in)
    -				*proto = in;
    -		}
    -	}
    -
    -	/* allocate private copies */
    -	*file = bozostrdup(httpd, *file);
    -	if (*query)
    -		*query = bozostrdup(httpd, *query);
    -
    -	debug((httpd, DEBUG_FAT,
    -		"url: method: \"%s\" file: \"%s\" query: \"%s\" proto: \"%s\"",
    -		*method, *file, *query, *proto));
    -}
    -
    -/*
    - * cleanup a bozo_httpreq_t after use
    - */
    -void
    -bozo_clean_request(bozo_httpreq_t *request)
    -{
    -	struct bozoheaders *hdr, *ohdr = NULL;
    -
    -	if (request == NULL)
    -		return;
    -
    -	/* If SSL enabled cleanup SSL structure. */
    -	bozo_ssl_destroy(request->hr_httpd);
    -
    -	/* clean up request */
    -	free(request->hr_remotehost);
    -	free(request->hr_remoteaddr);
    -	free(request->hr_serverport);
    -	free(request->hr_virthostname);
    -	free(request->hr_file);
    -	free(request->hr_oldfile);
    -	free(request->hr_query);
    -	free(request->hr_host);
    -	bozo_auth_cleanup(request);
    -	for (hdr = SIMPLEQ_FIRST(&request->hr_headers); hdr;
    -	    hdr = SIMPLEQ_NEXT(hdr, h_next)) {
    -		free(hdr->h_value);
    -		free(hdr->h_header);
    -		free(ohdr);
    -		ohdr = hdr;
    -	}
    -	free(ohdr);
    -
    -	free(request);
    -}
    -
    -/*
    - * send a HTTP/1.1 408 response if we timeout.
    - */
    -/* ARGSUSED */
    -static void
    -alarmer(int sig)
    -{
    -	alarmhit = 1;
    -}
    -
    -/*
    - * add or merge this header (val: str) into the requests list
    - */
    -static bozoheaders_t *
    -addmerge_header(bozo_httpreq_t *request, char *val,
    -		char *str, ssize_t len)
    -{
    -	struct	bozoheaders *hdr;
    -
    -	USE_ARG(len);
    -	/* do we exist already? */
    -	SIMPLEQ_FOREACH(hdr, &request->hr_headers, h_next) {
    -		if (strcasecmp(val, hdr->h_header) == 0)
    -			break;
    -	}
    -
    -	if (hdr) {
    -		/* yup, merge it in */
    -		char *nval;
    -
    -		if (asprintf(&nval, "%s, %s", hdr->h_value, str) == -1) {
    -			(void)bozo_http_error(request->hr_httpd, 500, NULL,
    -			     "memory allocation failure");
    -			return NULL;
    -		}
    -		free(hdr->h_value);
    -		hdr->h_value = nval;
    -	} else {
    -		/* nope, create a new one */
    -
    -		hdr = bozomalloc(request->hr_httpd, sizeof *hdr);
    -		hdr->h_header = bozostrdup(request->hr_httpd, val);
    -		if (str && *str)
    -			hdr->h_value = bozostrdup(request->hr_httpd, str);
    -		else
    -			hdr->h_value = bozostrdup(request->hr_httpd, " ");
    -
    -		SIMPLEQ_INSERT_TAIL(&request->hr_headers, hdr, h_next);
    -		request->hr_nheaders++;
    -	}
    -
    -	return hdr;
    -}
    -
    -/*
    - * as the prototype string is not constant (eg, "HTTP/1.1" is equivalent
    - * to "HTTP/001.01"), we MUST parse this.
    - */
    -static int
    -process_proto(bozo_httpreq_t *request, const char *proto)
    -{
    -	char	majorstr[16], *minorstr;
    -	int	majorint, minorint;
    -
    -	if (proto == NULL) {
    -got_proto_09:
    -		request->hr_proto = request->hr_httpd->consts.http_09;
    -		debug((request->hr_httpd, DEBUG_FAT, "request %s is http/0.9",
    -			request->hr_file));
    -		return 0;
    -	}
    -
    -	if (strncasecmp(proto, "HTTP/", 5) != 0)
    -		goto bad;
    -	strncpy(majorstr, proto + 5, sizeof majorstr);
    -	majorstr[sizeof(majorstr)-1] = 0;
    -	minorstr = strchr(majorstr, '.');
    -	if (minorstr == NULL)
    -		goto bad;
    -	*minorstr++ = 0;
    -
    -	majorint = atoi(majorstr);
    -	minorint = atoi(minorstr);
    -
    -	switch (majorint) {
    -	case 0:
    -		if (minorint != 9)
    -			break;
    -		goto got_proto_09;
    -	case 1:
    -		if (minorint == 0)
    -			request->hr_proto = request->hr_httpd->consts.http_10;
    -		else if (minorint == 1)
    -			request->hr_proto = request->hr_httpd->consts.http_11;
    -		else
    -			break;
    -
    -		debug((request->hr_httpd, DEBUG_FAT, "request %s is %s",
    -		    request->hr_file, request->hr_proto));
    -		SIMPLEQ_INIT(&request->hr_headers);
    -		request->hr_nheaders = 0;
    -		return 0;
    -	}
    -bad:
    -	return bozo_http_error(request->hr_httpd, 404, NULL, "unknown prototype");
    -}
    -
    -/*
    - * process each type of HTTP method, setting this HTTP requests
    - # method type.
    - */
    -static struct method_map {
    -	const char *name;
    -	int	type;
    -} method_map[] = {
    -	{ "GET", 	HTTP_GET, },
    -	{ "POST",	HTTP_POST, },
    -	{ "HEAD",	HTTP_HEAD, },
    -#if 0	/* other non-required http/1.1 methods */
    -	{ "OPTIONS",	HTTP_OPTIONS, },
    -	{ "PUT",	HTTP_PUT, },
    -	{ "DELETE",	HTTP_DELETE, },
    -	{ "TRACE",	HTTP_TRACE, },
    -	{ "CONNECT",	HTTP_CONNECT, },
    -#endif
    -	{ NULL,		0, },
    -};
    -
    -static int
    -process_method(bozo_httpreq_t *request, const char *method)
    -{
    -	struct	method_map *mmp;
    -
    -	if (request->hr_proto == request->hr_httpd->consts.http_11)
    -		request->hr_allow = "GET, HEAD, POST";
    -
    -	for (mmp = method_map; mmp->name; mmp++)
    -		if (strcasecmp(method, mmp->name) == 0) {
    -			request->hr_method = mmp->type;
    -			request->hr_methodstr = mmp->name;
    -			return 0;
    -		}
    -
    -	return bozo_http_error(request->hr_httpd, 404, request, "unknown method");
    -}
    -
    -/*
    - * This function reads a http request from stdin, returning a pointer to a
    - * bozo_httpreq_t structure, describing the request.
    - */
    -bozo_httpreq_t *
    -bozo_read_request(bozohttpd_t *httpd)
    -{
    -	struct	sigaction	sa;
    -	char	*str, *val, *method, *file, *proto, *query;
    -	char	*host, *addr, *port;
    -	char	bufport[10];
    -	char	hbuf[NI_MAXHOST], abuf[NI_MAXHOST];
    -	struct	sockaddr_storage ss;
    -	ssize_t	len;
    -	int	line = 0;
    -	socklen_t slen;
    -	bozo_httpreq_t *request;
    -
    -	/*
    -	 * if we're in daemon mode, bozo_daemon_fork() will return here twice
    -	 * for each call.  once in the child, returning 0, and once in the
    -	 * parent, returning 1.  for each child, then we can setup SSL, and
    -	 * the parent can signal the caller there was no request to process
    -	 * and it will wait for another.
    -	 */
    -	if (bozo_daemon_fork(httpd))
    -		return NULL;
    -	if (bozo_ssl_accept(httpd))
    -		return NULL;
    -
    -	request = bozomalloc(httpd, sizeof(*request));
    -	memset(request, 0, sizeof(*request));
    -	request->hr_httpd = httpd;
    -	request->hr_allow = request->hr_host = NULL;
    -	request->hr_content_type = request->hr_content_length = NULL;
    -	request->hr_range = NULL;
    -	request->hr_last_byte_pos = -1;
    -	request->hr_if_modified_since = NULL;
    -	request->hr_virthostname = NULL;
    -	request->hr_file = NULL;
    -	request->hr_oldfile = NULL;
    -	bozo_auth_init(request);
    -
    -	slen = sizeof(ss);
    -	if (getpeername(0, (struct sockaddr *)(void *)&ss, &slen) < 0)
    -		host = addr = NULL;
    -	else {
    -		if (getnameinfo((struct sockaddr *)(void *)&ss, slen,
    -		    abuf, sizeof abuf, NULL, 0, NI_NUMERICHOST) == 0)
    -			addr = abuf;
    -		else
    -			addr = NULL;
    -		if (httpd->numeric == 0 &&
    -		    getnameinfo((struct sockaddr *)(void *)&ss, slen,
    -				hbuf, sizeof hbuf, NULL, 0, 0) == 0)
    -			host = hbuf;
    -		else
    -			host = NULL;
    -	}
    -	if (host != NULL)
    -		request->hr_remotehost = bozostrdup(request->hr_httpd, host);
    -	if (addr != NULL)
    -		request->hr_remoteaddr = bozostrdup(request->hr_httpd, addr);
    -	slen = sizeof(ss);
    -
    -	/*
    -	 * Override the bound port from the request value, so it works even
    -	 * if passed through a proxy that doesn't rewrite the port.
    -	 */
    -	if (httpd->bindport) {
    -		if (strcmp(httpd->bindport, "80") != 0)
    -			port = httpd->bindport;
    -		else
    -			port = NULL;
    -	} else {
    -		if (getsockname(0, (struct sockaddr *)(void *)&ss, &slen) < 0)
    -			port = NULL;
    -		else {
    -			if (getnameinfo((struct sockaddr *)(void *)&ss, slen, NULL, 0,
    -					bufport, sizeof bufport, NI_NUMERICSERV) == 0)
    -				port = bufport;
    -			else
    -				port = NULL;
    -		}
    -	}
    -	if (port != NULL)
    -		request->hr_serverport = bozostrdup(request->hr_httpd, port);
    -
    -	/*
    -	 * setup a timer to make sure the request is not hung
    -	 */
    -	sa.sa_handler = alarmer;
    -	sigemptyset(&sa.sa_mask);
    -	sigaddset(&sa.sa_mask, SIGALRM);
    -	sa.sa_flags = 0;
    -	sigaction(SIGALRM, &sa, NULL);	/* XXX */
    -
    -	alarm(MAX_WAIT_TIME);
    -	while ((str = bozodgetln(httpd, STDIN_FILENO, &len, bozo_read)) != NULL) {
    -		alarm(0);
    -		if (alarmhit) {
    -			(void)bozo_http_error(httpd, 408, NULL,
    -					"request timed out");
    -			goto cleanup;
    -		}
    -		line++;
    -
    -		if (line == 1) {
    -
    -			if (len < 1) {
    -				(void)bozo_http_error(httpd, 404, NULL,
    -						"null method");
    -				goto cleanup;
    -			}
    -
    -			bozo_warn(httpd, "got request ``%s'' from host %s to port %s",
    -				str,
    -				host ? host : addr ? addr : "",
    -				port ? port : "");
    -
    -			/* we allocate return space in file and query only */
    -			parse_request(httpd, str, &method, &file, &query, &proto);
    -			request->hr_file = file;
    -			request->hr_query = query;
    -			if (method == NULL) {
    -				(void)bozo_http_error(httpd, 404, NULL,
    -						"null method");
    -				goto cleanup;
    -			}
    -			if (file == NULL) {
    -				(void)bozo_http_error(httpd, 404, NULL,
    -						"null file");
    -				goto cleanup;
    -			}
    -
    -			/*
    -			 * note that we parse the proto first, so that we
    -			 * can more properly parse the method and the url.
    -			 */
    -
    -			if (process_proto(request, proto) ||
    -			    process_method(request, method)) {
    -				goto cleanup;
    -			}
    -
    -			debug((httpd, DEBUG_FAT, "got file \"%s\" query \"%s\"",
    -			    request->hr_file,
    -			    request->hr_query ? request->hr_query : ""));
    -
    -			/* http/0.9 has no header processing */
    -			if (request->hr_proto == httpd->consts.http_09)
    -				break;
    -		} else {		/* incoming headers */
    -			bozoheaders_t *hdr;
    -
    -			if (*str == '\0')
    -				break;
    -
    -			val = bozostrnsep(&str, ":", &len);
    -			debug((httpd, DEBUG_EXPLODING,
    -			    "read_req2: after bozostrnsep: str ``%s'' val ``%s''",
    -			    str, val));
    -			if (val == NULL || len == -1) {
    -				(void)bozo_http_error(httpd, 404, request,
    -						"no header");
    -				goto cleanup;
    -			}
    -			while (*str == ' ' || *str == '\t')
    -				len--, str++;
    -			while (*val == ' ' || *val == '\t')
    -				val++;
    -
    -			if (bozo_auth_check_headers(request, val, str, len))
    -				goto next_header;
    -
    -			hdr = addmerge_header(request, val, str, len);
    -
    -			if (strcasecmp(hdr->h_header, "content-type") == 0)
    -				request->hr_content_type = hdr->h_value;
    -			else if (strcasecmp(hdr->h_header, "content-length") == 0)
    -				request->hr_content_length = hdr->h_value;
    -			else if (strcasecmp(hdr->h_header, "host") == 0)
    -				request->hr_host = bozostrdup(httpd, hdr->h_value);
    -			/* RFC 2616 (HTTP/1.1): 14.20 */
    -			else if (strcasecmp(hdr->h_header, "expect") == 0) {
    -				(void)bozo_http_error(httpd, 417, request,
    -						"we don't support Expect:");
    -				goto cleanup;
    -			}
    -			else if (strcasecmp(hdr->h_header, "referrer") == 0 ||
    -			         strcasecmp(hdr->h_header, "referer") == 0)
    -				request->hr_referrer = hdr->h_value;
    -			else if (strcasecmp(hdr->h_header, "range") == 0)
    -				request->hr_range = hdr->h_value;
    -			else if (strcasecmp(hdr->h_header,
    -					"if-modified-since") == 0)
    -				request->hr_if_modified_since = hdr->h_value;
    -			else if (strcasecmp(hdr->h_header,
    -					"accept-encoding") == 0)
    -				request->hr_accept_encoding = hdr->h_value;
    -
    -			debug((httpd, DEBUG_FAT, "adding header %s: %s",
    -			    hdr->h_header, hdr->h_value));
    -		}
    -next_header:
    -		alarm(MAX_WAIT_TIME);
    -	}
    -
    -	/* now, clear it all out */
    -	alarm(0);
    -	signal(SIGALRM, SIG_DFL);
    -
    -	/* RFC1945, 8.3 */
    -	if (request->hr_method == HTTP_POST &&
    -	    request->hr_content_length == NULL) {
    -		(void)bozo_http_error(httpd, 400, request,
    -				"missing content length");
    -		goto cleanup;
    -	}
    -
    -	/* RFC 2616 (HTTP/1.1), 14.23 & 19.6.1.1 */
    -	if (request->hr_proto == httpd->consts.http_11 &&
    -	    /*(strncasecmp(request->hr_file, "http://", 7) != 0) &&*/
    -	    request->hr_host == NULL) {
    -		(void)bozo_http_error(httpd, 400, request,
    -				"missing Host header");
    -		goto cleanup;
    -	}
    -
    -	if (request->hr_range != NULL) {
    -		debug((httpd, DEBUG_FAT, "hr_range: %s", request->hr_range));
    -		/* support only simple ranges %d- and %d-%d */
    -		if (strchr(request->hr_range, ',') == NULL) {
    -			const char *rstart, *dash;
    -
    -			rstart = strchr(request->hr_range, '=');
    -			if (rstart != NULL) {
    -				rstart++;
    -				dash = strchr(rstart, '-');
    -				if (dash != NULL && dash != rstart) {
    -					dash++;
    -					request->hr_have_range = 1;
    -					request->hr_first_byte_pos =
    -					    strtoll(rstart, NULL, 10);
    -					if (request->hr_first_byte_pos < 0)
    -						request->hr_first_byte_pos = 0;
    -					if (*dash != '\0') {
    -						request->hr_last_byte_pos =
    -						    strtoll(dash, NULL, 10);
    -						if (request->hr_last_byte_pos < 0)
    -							request->hr_last_byte_pos = -1;
    -					}
    -				}
    -			}
    -		}
    -	}
    -
    -	debug((httpd, DEBUG_FAT, "bozo_read_request returns url %s in request",
    -	       request->hr_file));
    -	return request;
    -
    -cleanup:
    -	bozo_clean_request(request);
    -
    -	return NULL;
    -}
    -
    -static int
    -mmap_and_write_part(bozohttpd_t *httpd, int fd, off_t first_byte_pos, size_t sz)
    -{
    -	size_t mappedsz, wroffset;
    -	off_t mappedoffset;
    -	char *addr;
    -	void *mappedaddr;
    -
    -	/*
    -	 * we need to ensure that both the size *and* offset arguments to
    -	 * mmap() are page-aligned.  our formala for this is:
    -	 *
    -	 *    input offset: first_byte_pos
    -	 *    input size: sz
    -	 *
    -	 *    mapped offset = page align truncate (input offset)
    -	 *    mapped size   =
    -	 *        page align extend (input offset - mapped offset + input size)
    -	 *    write offset  = input offset - mapped offset
    -	 *
    -	 * we use the write offset in all writes
    -	 */
    -	mappedoffset = first_byte_pos & ~(httpd->page_size - 1);
    -	mappedsz = (size_t)
    -		(first_byte_pos - mappedoffset + sz + httpd->page_size - 1) &
    -		~(httpd->page_size - 1);
    -	wroffset = (size_t)(first_byte_pos - mappedoffset);
    -
    -	addr = mmap(0, mappedsz, PROT_READ, MAP_SHARED, fd, mappedoffset);
    -	if (addr == (char *)-1) {
    -		bozo_warn(httpd, "mmap failed: %s", strerror(errno));
    -		return -1;
    -	}
    -	mappedaddr = addr;
    -
    -#ifdef MADV_SEQUENTIAL
    -#ifndef __minix
    -	(void)madvise(addr, sz, MADV_SEQUENTIAL);
    -#endif /* !__minix */
    -#endif
    -	while (sz > BOZO_WRSZ) {
    -		if (bozo_write(httpd, STDOUT_FILENO, addr + wroffset,
    -				BOZO_WRSZ) != BOZO_WRSZ) {
    -			bozo_warn(httpd, "write failed: %s", strerror(errno));
    -			goto out;
    -		}
    -		debug((httpd, DEBUG_OBESE, "wrote %d bytes", BOZO_WRSZ));
    -		sz -= BOZO_WRSZ;
    -		addr += BOZO_WRSZ;
    -	}
    -	if (sz && (size_t)bozo_write(httpd, STDOUT_FILENO, addr + wroffset,
    -				sz) != sz) {
    -		bozo_warn(httpd, "final write failed: %s", strerror(errno));
    -		goto out;
    -	}
    -	debug((httpd, DEBUG_OBESE, "wrote %d bytes", (int)sz));
    - out:
    -	if (munmap(mappedaddr, mappedsz) < 0) {
    -		bozo_warn(httpd, "munmap failed");
    -		return -1;
    -	}
    -
    -	return 0;
    -}
    -
    -static int
    -parse_http_date(const char *val, time_t *timestamp)
    -{
    -	char *remainder;
    -	struct tm tm;
    -
    -	if ((remainder = strptime(val, "%a, %d %b %Y %T GMT", &tm)) == NULL &&
    -	    (remainder = strptime(val, "%a, %d-%b-%y %T GMT", &tm)) == NULL &&
    -	    (remainder = strptime(val, "%a %b %d %T %Y", &tm)) == NULL)
    -		return 0; /* Invalid HTTP date format */
    -
    -	if (*remainder)
    -		return 0; /* No trailing garbage */
    -
    -	*timestamp = timegm(&tm);
    -	return 1;
    -}
    -
    -/*
    - * given an url, encode it ala rfc 3986.  ie, escape ? and friends.
    - * note that this function returns a static buffer, and thus needs
    - * to be updated for any sort of parallel processing.
    - */
    -char *
    -bozo_escape_rfc3986(bozohttpd_t *httpd, const char *url)
    -{
    -	static char *buf;
    -	static size_t buflen = 0;
    -	size_t len;
    -	const char *s;
    -	char *d;
    -
    -	len = strlen(url);
    -	if (buflen < len * 3 + 1) {
    -		buflen = len * 3 + 1;
    -		buf = bozorealloc(httpd, buf, buflen);
    -	}
    -
    -	if (url == NULL) {
    -		buf[0] = 0;
    -		return buf;
    -	}
    -
    -	for (len = 0, s = url, d = buf; *s;) {
    -		if (*s & 0x80)
    -			goto encode_it;
    -		switch (*s) {
    -		case ':':
    -		case '?':
    -		case '#':
    -		case '[':
    -		case ']':
    -		case '@':
    -		case '!':
    -		case '$':
    -		case '&':
    -		case '\'':
    -		case '(':
    -		case ')':
    -		case '*':
    -		case '+':
    -		case ',':
    -		case ';':
    -		case '=':
    -		case '%':
    -		case '\n':
    -		case '\r':
    -		case ' ':
    -		case '"':
    -		encode_it:
    -			snprintf(d, 4, "%%%02X", *s++);
    -			d += 3;
    -			len += 3;
    -			break;
    -		default:
    -			*d++ = *s++;
    -			len++;
    -			break;
    -		}
    -	}
    -	buf[len] = 0;
    -
    -	return buf;
    -}
    -
    -/*
    - * checks to see if this request has a valid .bzdirect file.  returns
    - * 0 on failure and 1 on success.
    - */
    -static int
    -check_direct_access(bozo_httpreq_t *request)
    -{
    -	FILE *fp;
    -	struct stat sb;
    -	char dir[MAXPATHLEN], dirfile[MAXPATHLEN], *basename;
    -
    -	snprintf(dir, sizeof(dir), "%s", request->hr_file + 1);
    -	debug((request->hr_httpd, DEBUG_FAT, "check_direct_access: dir %s", dir));
    -	basename = strrchr(dir, '/');
    -
    -	if ((!basename || basename[1] != '\0') &&
    -	    lstat(dir, &sb) == 0 && S_ISDIR(sb.st_mode))
    -		/* nothing */;
    -	else if (basename == NULL)
    -		strcpy(dir, ".");
    -	else {
    -		*basename++ = '\0';
    -		bozo_check_special_files(request, basename);
    -	}
    -
    -	if ((size_t)snprintf(dirfile, sizeof(dirfile), "%s/%s", dir,
    -	  DIRECT_ACCESS_FILE) >= sizeof(dirfile)) {
    -		bozo_http_error(request->hr_httpd, 404, request,
    -		  "directfile path too long");
    -		return 0;
    -	}
    -	if (stat(dirfile, &sb) < 0 ||
    -	    (fp = fopen(dirfile, "r")) == NULL)
    -		return 0;
    -	fclose(fp);
    -	return 1;
    -}
    -
    -/*
    - * do automatic redirection -- if there are query parameters for the URL
    - * we will tack these on to the new (redirected) URL.
    - */
    -static void
    -handle_redirect(bozo_httpreq_t *request,
    -		const char *url, int absolute)
    -{
    -	bozohttpd_t *httpd = request->hr_httpd;
    -	char *urlbuf;
    -	char portbuf[20];
    -	const char *hostname = BOZOHOST(httpd, request);
    -	int query = 0;
    -
    -	if (url == NULL) {
    -		if (asprintf(&urlbuf, "/%s/", request->hr_file) < 0)
    -			bozo_err(httpd, 1, "asprintf");
    -		url = urlbuf;
    -	} else
    -		urlbuf = NULL;
    -	url = bozo_escape_rfc3986(request->hr_httpd, url);
    -
    -	if (request->hr_query && strlen(request->hr_query))
    -		query = 1;
    -
    -	if (request->hr_serverport && strcmp(request->hr_serverport, "80") != 0)
    -		snprintf(portbuf, sizeof(portbuf), ":%s",
    -		    request->hr_serverport);
    -	else
    -		portbuf[0] = '\0';
    -	if (absolute)
    -		bozo_warn(httpd, "redirecting %s", url);
    -	else
    -		bozo_warn(httpd, "redirecting %s%s%s", hostname, portbuf, url);
    -	debug((httpd, DEBUG_FAT, "redirecting %s", url));
    -	bozo_printf(httpd, "%s 301 Document Moved\r\n", request->hr_proto);
    -	if (request->hr_proto != httpd->consts.http_09)
    -		bozo_print_header(request, NULL, "text/html", NULL);
    -	if (request->hr_proto != httpd->consts.http_09) {
    -		bozo_printf(httpd, "Location: http://");
    -		if (absolute == 0)
    -			bozo_printf(httpd, "%s%s", hostname, portbuf);
    -		if (query) {
    -			bozo_printf(httpd, "%s?%s\r\n", url, request->hr_query);
    -		} else {
    -			bozo_printf(httpd, "%s\r\n", url);
    -		}
    -	}
    -	bozo_printf(httpd, "\r\n");
    -	if (request->hr_method == HTTP_HEAD)
    -		goto head;
    -	bozo_printf(httpd, "Document Moved\n");
    -	bozo_printf(httpd, "

    Document Moved

    \n"); - bozo_printf(httpd, "This document had moved hr_query); - else - bozo_printf(httpd, "%s%s%s?%s", hostname, - portbuf, url, request->hr_query); - } else { - if (absolute) - bozo_printf(httpd, "%s", url); - else - bozo_printf(httpd, "%s%s%s", hostname, - portbuf, url); - } - bozo_printf(httpd, "\">here\n"); - bozo_printf(httpd, "\n"); -head: - bozo_flush(httpd, stdout); - free(urlbuf); -} - -/* - * deal with virtual host names; we do this: - * if we have a virtual path root (httpd->virtbase), and we are given a - * virtual host spec (Host: ho.st or http://ho.st/), see if this - * directory exists under httpd->virtbase. if it does, use this as the - # new slashdir. - */ -static int -check_virtual(bozo_httpreq_t *request) -{ - bozohttpd_t *httpd = request->hr_httpd; - char *file = request->hr_file, *s; - size_t len; - - if (!httpd->virtbase) - goto use_slashdir; - - /* - * convert http://virtual.host/ to request->hr_host - */ - debug((httpd, DEBUG_OBESE, "checking for http:// virtual host in ``%s''", - file)); - if (strncasecmp(file, "http://", 7) == 0) { - /* we would do virtual hosting here? */ - file += 7; - /* RFC 2616 (HTTP/1.1), 5.2: URI takes precedence over Host: */ - free(request->hr_host); - request->hr_host = bozostrdup(request->hr_httpd, file); - if ((s = strchr(request->hr_host, '/')) != NULL) - *s = '\0'; - s = strchr(file, '/'); - free(request->hr_file); - request->hr_file = bozostrdup(request->hr_httpd, s ? s : "/"); - debug((httpd, DEBUG_OBESE, "got host ``%s'' file is now ``%s''", - request->hr_host, request->hr_file)); - } else if (!request->hr_host) - goto use_slashdir; - - /* - * canonicalise hr_host - that is, remove any :80. - */ - len = strlen(request->hr_host); - if (len > 3 && strcmp(request->hr_host + len - 3, ":80") == 0) { - request->hr_host[len - 3] = '\0'; - len = strlen(request->hr_host); - } - - /* - * ok, we have a virtual host, use opendir(3) to find a case - * insensitive match for the virtual host we are asked for. - * note that if the virtual host is the same as the master, - * we don't need to do anything special. - */ - debug((httpd, DEBUG_OBESE, - "check_virtual: checking host `%s' under httpd->virtbase `%s' " - "for file `%s'", - request->hr_host, httpd->virtbase, request->hr_file)); - if (strncasecmp(httpd->virthostname, request->hr_host, len) != 0) { - s = 0; - DIR *dirp; - struct dirent *d; - - if ((dirp = opendir(httpd->virtbase)) != NULL) { - while ((d = readdir(dirp)) != NULL) { - if (strcmp(d->d_name, ".") == 0 || - strcmp(d->d_name, "..") == 0) { - continue; - } - debug((httpd, DEBUG_OBESE, "looking at dir``%s''", - d->d_name)); - if (strcmp(d->d_name, request->hr_host) == 0) { - /* found it, punch it */ - debug((httpd, DEBUG_OBESE, "found it punch it")); - request->hr_virthostname = - bozostrdup(httpd, d->d_name); - if (asprintf(&s, "%s/%s", httpd->virtbase, - request->hr_virthostname) < 0) - bozo_err(httpd, 1, "asprintf"); - break; - } - } - closedir(dirp); - } - else { - debug((httpd, DEBUG_FAT, "opendir %s failed: %s", - httpd->virtbase, strerror(errno))); - } - if (s == 0) { - if (httpd->unknown_slash) - goto use_slashdir; - return bozo_http_error(httpd, 404, request, - "unknown URL"); - } - } else -use_slashdir: - s = httpd->slashdir; - - /* - * ok, nailed the correct slashdir, chdir to it - */ - if (chdir(s) < 0) - return bozo_http_error(httpd, 404, request, - "can't chdir to slashdir"); - return 0; -} - -/* - * checks to see if this request has a valid .bzredirect file. returns - * 0 when no redirection happend, or 1 when handle_redirect() has been - * called, -1 on error. - */ -static int -check_bzredirect(bozo_httpreq_t *request) -{ - struct stat sb; - char dir[MAXPATHLEN], redir[MAXPATHLEN], redirpath[MAXPATHLEN + 1], - path[MAXPATHLEN]; - char *basename, *finalredir; - int rv, absolute; - - /* - * if this pathname is really a directory, but doesn't end in /, - * use it as the directory to look for the redir file. - */ - if((size_t)snprintf(dir, sizeof(dir), "%s", request->hr_file + 1) >= - sizeof(dir)) { - bozo_http_error(request->hr_httpd, 404, request, - "file path too long"); - return -1; - } - debug((request->hr_httpd, DEBUG_FAT, "check_bzredirect: dir %s", dir)); - basename = strrchr(dir, '/'); - - if ((!basename || basename[1] != '\0') && - lstat(dir, &sb) == 0 && S_ISDIR(sb.st_mode)) - /* nothing */; - else if (basename == NULL) - strcpy(dir, "."); - else { - *basename++ = '\0'; - bozo_check_special_files(request, basename); - } - - if ((size_t)snprintf(redir, sizeof(redir), "%s/%s", dir, - REDIRECT_FILE) >= sizeof(redir)) { - bozo_http_error(request->hr_httpd, 404, request, - "redirectfile path too long"); - return -1; - } - if (lstat(redir, &sb) == 0) { - if (!S_ISLNK(sb.st_mode)) - return 0; - absolute = 0; - } else { - if((size_t)snprintf(redir, sizeof(redir), "%s/%s", dir, - ABSREDIRECT_FILE) >= sizeof(redir)) { - bozo_http_error(request->hr_httpd, 404, request, - "redirectfile path too long"); - return -1; - } - if (lstat(redir, &sb) < 0 || !S_ISLNK(sb.st_mode)) - return 0; - absolute = 1; - } - debug((request->hr_httpd, DEBUG_FAT, - "check_bzredirect: calling readlink")); - rv = readlink(redir, redirpath, sizeof redirpath - 1); - if (rv == -1 || rv == 0) { - debug((request->hr_httpd, DEBUG_FAT, "readlink failed")); - return 0; - } - redirpath[rv] = '\0'; - debug((request->hr_httpd, DEBUG_FAT, - "readlink returned \"%s\"", redirpath)); - - /* check if we need authentication */ - snprintf(path, sizeof(path), "%s/", dir); - if (bozo_auth_check(request, path)) - return 1; - - /* now we have the link pointer, redirect to the real place */ - if (absolute) - finalredir = redirpath; - else { - if ((size_t)snprintf(finalredir = redir, sizeof(redir), "/%s/%s", - dir, redirpath) >= sizeof(redir)) { - bozo_http_error(request->hr_httpd, 404, request, - "redirect path too long"); - return -1; - } - } - - debug((request->hr_httpd, DEBUG_FAT, - "check_bzredirect: new redir %s", finalredir)); - handle_redirect(request, finalredir, absolute); - return 1; -} - -/* this fixes the %HH hack that RFC2396 requires. */ -static int -fix_url_percent(bozo_httpreq_t *request) -{ - bozohttpd_t *httpd = request->hr_httpd; - char *s, *t, buf[3], *url; - char *end; /* if end is not-zero, we don't translate beyond that */ - - url = request->hr_file; - - end = url + strlen(url); - - /* fast forward to the first % */ - if ((s = strchr(url, '%')) == NULL) - return 0; - - t = s; - do { - if (end && s >= end) { - debug((httpd, DEBUG_EXPLODING, - "fu_%%: past end, filling out..")); - while (*s) - *t++ = *s++; - break; - } - debug((httpd, DEBUG_EXPLODING, - "fu_%%: got s == %%, s[1]s[2] == %c%c", - s[1], s[2])); - if (s[1] == '\0' || s[2] == '\0') { - (void)bozo_http_error(httpd, 400, request, - "percent hack missing two chars afterwards"); - return 1; - } - if (s[1] == '0' && s[2] == '0') { - (void)bozo_http_error(httpd, 404, request, - "percent hack was %00"); - return 1; - } - if (s[1] == '2' && s[2] == 'f') { - (void)bozo_http_error(httpd, 404, request, - "percent hack was %2f (/)"); - return 1; - } - - buf[0] = *++s; - buf[1] = *++s; - buf[2] = '\0'; - s++; - *t = (char)strtol(buf, NULL, 16); - debug((httpd, DEBUG_EXPLODING, - "fu_%%: strtol put '%02x' into *t", *t)); - if (*t++ == '\0') { - (void)bozo_http_error(httpd, 400, request, - "percent hack got a 0 back"); - return 1; - } - - while (*s && *s != '%') { - if (end && s >= end) - break; - *t++ = *s++; - } - } while (*s); - *t = '\0'; - - debug((httpd, DEBUG_FAT, "fix_url_percent returns %s in url", - request->hr_file)); - - return 0; -} - -/* - * transform_request does this: - * - ``expand'' %20 crapola - * - punt if it doesn't start with / - * - check httpd->untrustedref / referrer - * - look for "http://myname/" and deal with it. - * - maybe call bozo_process_cgi() - * - check for ~user and call bozo_user_transform() if so - * - if the length > 1, check for trailing slash. if so, - * add the index.html file - * - if the length is 1, return the index.html file - * - disallow anything ending up with a file starting - * at "/" or having ".." in it. - * - anything else is a really weird internal error - * - returns malloced file to serve, if unhandled - */ -static int -transform_request(bozo_httpreq_t *request, int *isindex) -{ - bozohttpd_t *httpd = request->hr_httpd; - char *file, *newfile = NULL; - size_t len; - const char *hostname = BOZOHOST(httpd, request); - - file = NULL; - *isindex = 0; - debug((httpd, DEBUG_FAT, "tf_req: file %s", request->hr_file)); - if (fix_url_percent(request)) { - goto bad_done; - } - if (check_virtual(request)) { - goto bad_done; - } - file = request->hr_file; - - if (file[0] != '/') { - (void)bozo_http_error(httpd, 404, request, "unknown URL"); - goto bad_done; - } - - /* omit additional slashes at the beginning */ - while (file[1] == '/') - file++; - - switch(check_bzredirect(request)) { - case -1: - goto bad_done; - case 1: - return 0; - } - - if (httpd->untrustedref) { - int to_indexhtml = 0; - -#define TOP_PAGE(x) (strcmp((x), "/") == 0 || \ - strcmp((x) + 1, httpd->index_html) == 0 || \ - strcmp((x) + 1, "favicon.ico") == 0) - - debug((httpd, DEBUG_EXPLODING, "checking httpd->untrustedref")); - /* - * first check that this path isn't allowed via .bzdirect file, - * and then check referrer; make sure that people come via the - * real name... otherwise if we aren't looking at / or - * /index.html, redirect... we also special case favicon.ico. - */ - if (check_direct_access(request)) - /* nothing */; - else if (request->hr_referrer) { - const char *r = request->hr_referrer; - - debug((httpd, DEBUG_FAT, - "checking referrer \"%s\" vs virthostname %s", - r, hostname)); - if (strncmp(r, "http://", 7) != 0 || - (strncasecmp(r + 7, hostname, - strlen(hostname)) != 0 && - !TOP_PAGE(file))) - to_indexhtml = 1; - } else { - const char *h = request->hr_host; - - debug((httpd, DEBUG_FAT, "url has no referrer at all")); - /* if there's no referrer, let / or /index.html past */ - if (!TOP_PAGE(file) || - (h && strncasecmp(h, hostname, - strlen(hostname)) != 0)) - to_indexhtml = 1; - } - - if (to_indexhtml) { - char *slashindexhtml; - - if (asprintf(&slashindexhtml, "/%s", - httpd->index_html) < 0) - bozo_err(httpd, 1, "asprintf"); - debug((httpd, DEBUG_FAT, - "httpd->untrustedref: redirecting %s to %s", - file, slashindexhtml)); - handle_redirect(request, slashindexhtml, 0); - free(slashindexhtml); - return 0; - } - } - - len = strlen(file); - if (/*CONSTCOND*/0) { -#ifndef NO_USER_SUPPORT - } else if (len > 1 && httpd->enable_users && file[1] == '~') { - if (file[2] == '\0') { - (void)bozo_http_error(httpd, 404, request, - "missing username"); - goto bad_done; - } - if (strchr(file + 2, '/') == NULL) { - handle_redirect(request, NULL, 0); - return 0; - } - debug((httpd, DEBUG_FAT, "calling bozo_user_transform")); - - return bozo_user_transform(request, isindex); -#endif /* NO_USER_SUPPORT */ - } else if (len > 1) { - debug((httpd, DEBUG_FAT, "file[len-1] == %c", file[len-1])); - if (file[len-1] == '/') { /* append index.html */ - *isindex = 1; - debug((httpd, DEBUG_FAT, "appending index.html")); - newfile = bozomalloc(httpd, - len + strlen(httpd->index_html) + 1); - strcpy(newfile, file + 1); - strcat(newfile, httpd->index_html); - } else - newfile = bozostrdup(request->hr_httpd, file + 1); - } else if (len == 1) { - debug((httpd, DEBUG_EXPLODING, "tf_req: len == 1")); - newfile = bozostrdup(request->hr_httpd, httpd->index_html); - *isindex = 1; - } else { /* len == 0 ? */ - (void)bozo_http_error(httpd, 500, request, - "request->hr_file is nul?"); - goto bad_done; - } - - if (newfile == NULL) { - (void)bozo_http_error(httpd, 500, request, "internal failure"); - goto bad_done; - } - - /* - * look for "http://myname/" and deal with it as necessary. - */ - - /* - * stop traversing outside our domain - * - * XXX true security only comes from our parent using chroot(2) - * before execve(2)'ing us. or our own built in chroot(2) support. - */ - if (*newfile == '/' || strcmp(newfile, "..") == 0 || - strstr(newfile, "/..") || strstr(newfile, "../")) { - (void)bozo_http_error(httpd, 403, request, "illegal request"); - goto bad_done; - } - - if (bozo_auth_check(request, newfile)) - goto bad_done; - - if (strlen(newfile)) { - request->hr_oldfile = request->hr_file; - request->hr_file = newfile; - } - - if (bozo_process_cgi(request)) - return 0; - - if (bozo_process_lua(request)) - return 0; - - debug((httpd, DEBUG_FAT, "transform_request set: %s", newfile)); - return 1; -bad_done: - debug((httpd, DEBUG_FAT, "transform_request returning: 0")); - free(newfile); - return 0; -} - -/* - * can_gzip checks if the request supports and prefers gzip encoding. - * - * XXX: we do not consider the associated q with gzip in making our - * decision which is broken. - */ - -static int -can_gzip(bozo_httpreq_t *request) -{ - const char *pos; - const char *tmp; - size_t len; - - /* First we decide if the request can be gzipped at all. */ - - /* not if we already are encoded... */ - tmp = bozo_content_encoding(request, request->hr_file); - if (tmp && *tmp) - return 0; - - /* not if we are not asking for the whole file... */ - if (request->hr_last_byte_pos != -1 || request->hr_have_range) - return 0; - - /* Then we determine if gzip is on the cards. */ - - for (pos = request->hr_accept_encoding; pos && *pos; pos += len) { - while (*pos == ' ') - pos++; - - len = strcspn(pos, ";,"); - - if ((len == 4 && strncasecmp("gzip", pos, 4) == 0) || - (len == 6 && strncasecmp("x-gzip", pos, 6) == 0)) - return 1; - - if (pos[len] == ';') - len += strcspn(&pos[len], ","); - - if (pos[len]) - len++; - } - - return 0; -} - -/* - * bozo_process_request does the following: - * - check the request is valid - * - process cgi-bin if necessary - * - transform a filename if necesarry - * - return the HTTP request - */ -void -bozo_process_request(bozo_httpreq_t *request) -{ - bozohttpd_t *httpd = request->hr_httpd; - struct stat sb; - time_t timestamp; - char *file; - const char *type, *encoding; - int fd, isindex; - - /* - * note that transform_request chdir()'s if required. also note - * that cgi is handed here. if transform_request() returns 0 - * then the request has been handled already. - */ - if (transform_request(request, &isindex) == 0) - return; - - fd = -1; - encoding = NULL; - if (can_gzip(request)) { - asprintf(&file, "%s.gz", request->hr_file); - fd = open(file, O_RDONLY); - if (fd >= 0) - encoding = "gzip"; - free(file); - } - - file = request->hr_file; - - if (fd < 0) - fd = open(file, O_RDONLY); - - if (fd < 0) { - debug((httpd, DEBUG_FAT, "open failed: %s", strerror(errno))); - switch(errno) { - case EPERM: - case EACCES: - (void)bozo_http_error(httpd, 403, request, - "no permission to open file"); - break; - case ENAMETOOLONG: - /*FALLTHROUGH*/ - case ENOENT: - if (!bozo_dir_index(request, file, isindex)) - (void)bozo_http_error(httpd, 404, request, - "no file"); - break; - default: - (void)bozo_http_error(httpd, 500, request, "open file"); - } - goto cleanup_nofd; - } - if (fstat(fd, &sb) < 0) { - (void)bozo_http_error(httpd, 500, request, "can't fstat"); - goto cleanup; - } - if (S_ISDIR(sb.st_mode)) { - handle_redirect(request, NULL, 0); - goto cleanup; - } - - if (request->hr_if_modified_since && - parse_http_date(request->hr_if_modified_since, ×tamp) && - timestamp >= sb.st_mtime) { - /* XXX ignore subsecond of timestamp */ - bozo_printf(httpd, "%s 304 Not Modified\r\n", - request->hr_proto); - bozo_printf(httpd, "\r\n"); - bozo_flush(httpd, stdout); - goto cleanup; - } - - /* validate requested range */ - if (request->hr_last_byte_pos == -1 || - request->hr_last_byte_pos >= sb.st_size) - request->hr_last_byte_pos = sb.st_size - 1; - if (request->hr_have_range && - request->hr_first_byte_pos > request->hr_last_byte_pos) { - request->hr_have_range = 0; /* punt */ - request->hr_first_byte_pos = 0; - request->hr_last_byte_pos = sb.st_size - 1; - } - debug((httpd, DEBUG_FAT, "have_range %d first_pos %lld last_pos %lld", - request->hr_have_range, - (long long)request->hr_first_byte_pos, - (long long)request->hr_last_byte_pos)); - if (request->hr_have_range) - bozo_printf(httpd, "%s 206 Partial Content\r\n", - request->hr_proto); - else - bozo_printf(httpd, "%s 200 OK\r\n", request->hr_proto); - - if (request->hr_proto != httpd->consts.http_09) { - type = bozo_content_type(request, file); - if (!encoding) - encoding = bozo_content_encoding(request, file); - - bozo_print_header(request, &sb, type, encoding); - bozo_printf(httpd, "\r\n"); - } - bozo_flush(httpd, stdout); - - if (request->hr_method != HTTP_HEAD) { - off_t szleft, cur_byte_pos; - - szleft = - request->hr_last_byte_pos - request->hr_first_byte_pos + 1; - cur_byte_pos = request->hr_first_byte_pos; - - retry: - while (szleft) { - size_t sz; - - /* This should take care of the first unaligned chunk */ - if ((cur_byte_pos & (httpd->page_size - 1)) != 0) - sz = (size_t)(cur_byte_pos & ~httpd->page_size); - if ((off_t)httpd->mmapsz < szleft) - sz = httpd->mmapsz; - else - sz = (size_t)szleft; - if (mmap_and_write_part(httpd, fd, cur_byte_pos, sz)) { - if (errno == ENOMEM) { - httpd->mmapsz /= 2; - if (httpd->mmapsz >= httpd->page_size) - goto retry; - } - goto cleanup; - } - cur_byte_pos += sz; - szleft -= sz; - } - } - cleanup: - close(fd); - cleanup_nofd: - close(STDIN_FILENO); - close(STDOUT_FILENO); - /*close(STDERR_FILENO);*/ -} - -/* make sure we're not trying to access special files */ -int -bozo_check_special_files(bozo_httpreq_t *request, const char *name) -{ - bozohttpd_t *httpd = request->hr_httpd; - - /* ensure basename(name) != special files */ - if (strcmp(name, DIRECT_ACCESS_FILE) == 0) - return bozo_http_error(httpd, 403, request, - "no permission to open direct access file"); - if (strcmp(name, REDIRECT_FILE) == 0) - return bozo_http_error(httpd, 403, request, - "no permission to open redirect file"); - if (strcmp(name, ABSREDIRECT_FILE) == 0) - return bozo_http_error(httpd, 403, request, - "no permission to open redirect file"); - return bozo_auth_check_special_files(request, name); -} - -/* generic header printing routine */ -void -bozo_print_header(bozo_httpreq_t *request, - struct stat *sbp, const char *type, const char *encoding) -{ - bozohttpd_t *httpd = request->hr_httpd; - off_t len; - char date[40]; - - bozo_printf(httpd, "Date: %s\r\n", bozo_http_date(date, sizeof(date))); - bozo_printf(httpd, "Server: %s\r\n", httpd->server_software); - bozo_printf(httpd, "Accept-Ranges: bytes\r\n"); - if (sbp) { - char filedate[40]; - struct tm *tm; - - tm = gmtime(&sbp->st_mtime); - strftime(filedate, sizeof filedate, - "%a, %d %b %Y %H:%M:%S GMT", tm); - bozo_printf(httpd, "Last-Modified: %s\r\n", filedate); - } - if (type && *type) - bozo_printf(httpd, "Content-Type: %s\r\n", type); - if (encoding && *encoding) - bozo_printf(httpd, "Content-Encoding: %s\r\n", encoding); - if (sbp) { - if (request->hr_have_range) { - len = request->hr_last_byte_pos - - request->hr_first_byte_pos +1; - bozo_printf(httpd, - "Content-Range: bytes %qd-%qd/%qd\r\n", - (long long) request->hr_first_byte_pos, - (long long) request->hr_last_byte_pos, - (long long) sbp->st_size); - } else - len = sbp->st_size; - bozo_printf(httpd, "Content-Length: %qd\r\n", (long long)len); - } - if (request && request->hr_proto == httpd->consts.http_11) - bozo_printf(httpd, "Connection: close\r\n"); - bozo_flush(httpd, stdout); -} - -#ifndef NO_DEBUG -void -debug__(bozohttpd_t *httpd, int level, const char *fmt, ...) -{ - va_list ap; - int savederrno; - - /* only log if the level is low enough */ - if (httpd->debug < level) - return; - - savederrno = errno; - va_start(ap, fmt); - if (httpd->logstderr) { - vfprintf(stderr, fmt, ap); - fputs("\n", stderr); - } else - vsyslog(LOG_DEBUG, fmt, ap); - va_end(ap); - errno = savederrno; -} -#endif /* NO_DEBUG */ - -/* these are like warn() and err(), except for syslog not stderr */ -void -bozo_warn(bozohttpd_t *httpd, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - if (httpd->logstderr || isatty(STDERR_FILENO)) { - //fputs("warning: ", stderr); - vfprintf(stderr, fmt, ap); - fputs("\n", stderr); - } else - vsyslog(LOG_INFO, fmt, ap); - va_end(ap); -} - -void -bozo_err(bozohttpd_t *httpd, int code, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - if (httpd->logstderr || isatty(STDERR_FILENO)) { - //fputs("error: ", stderr); - vfprintf(stderr, fmt, ap); - fputs("\n", stderr); - } else - vsyslog(LOG_ERR, fmt, ap); - va_end(ap); - exit(code); -} - -/* - * this escapes HTML tags. returns allocated escaped - * string if needed, or NULL on allocation failure or - * lack of escape need. - * call with NULL httpd in error paths, to avoid recursive - * malloc failure. call with valid httpd in normal paths - * to get automatic allocation failure handling. - */ -char * -bozo_escape_html(bozohttpd_t *httpd, const char *url) -{ - int i, j; - char *tmp; - size_t len; - - for (i = 0, j = 0; url[i]; i++) { - switch (url[i]) { - case '<': - case '>': - j += 4; - break; - case '&': - j += 5; - break; - } - } - - if (j == 0) - return NULL; - - /* - * we need to handle being called from different - * pathnames. - */ - len = strlen(url) + j; - if (httpd) - tmp = bozomalloc(httpd, len); - else if ((tmp = malloc(len)) == 0) - return NULL; - - for (i = 0, j = 0; url[i]; i++) { - switch (url[i]) { - case '<': - memcpy(tmp + j, "<", 4); - j += 4; - break; - case '>': - memcpy(tmp + j, ">", 4); - j += 4; - break; - case '&': - memcpy(tmp + j, "&", 5); - j += 5; - break; - default: - tmp[j++] = url[i]; - } - } - tmp[j] = 0; - - return tmp; -} - -/* short map between error code, and short/long messages */ -static struct errors_map { - int code; /* HTTP return code */ - const char *shortmsg; /* short version of message */ - const char *longmsg; /* long version of message */ -} errors_map[] = { - { 400, "400 Bad Request", "The request was not valid", }, - { 401, "401 Unauthorized", "No authorization", }, - { 403, "403 Forbidden", "Access to this item has been denied",}, - { 404, "404 Not Found", "This item has not been found", }, - { 408, "408 Request Timeout", "This request took too long", }, - { 417, "417 Expectation Failed","Expectations not available", }, - { 420, "420 Enhance Your Calm","Chill, Winston", }, - { 500, "500 Internal Error", "An error occured on the server", }, - { 501, "501 Not Implemented", "This request is not available", }, - { 0, NULL, NULL, }, -}; - -static const char *help = "DANGER! WILL ROBINSON! DANGER!"; - -static const char * -http_errors_short(int code) -{ - struct errors_map *ep; - - for (ep = errors_map; ep->code; ep++) - if (ep->code == code) - return (ep->shortmsg); - return (help); -} - -static const char * -http_errors_long(int code) -{ - struct errors_map *ep; - - for (ep = errors_map; ep->code; ep++) - if (ep->code == code) - return (ep->longmsg); - return (help); -} - -/* the follow functions and variables are used in handling HTTP errors */ -/* ARGSUSED */ -int -bozo_http_error(bozohttpd_t *httpd, int code, bozo_httpreq_t *request, - const char *msg) -{ - char portbuf[20]; - const char *header = http_errors_short(code); - const char *reason = http_errors_long(code); - const char *proto = (request && request->hr_proto) ? - request->hr_proto : httpd->consts.http_11; - int size; - - debug((httpd, DEBUG_FAT, "bozo_http_error %d: %s", code, msg)); - if (header == NULL || reason == NULL) { - bozo_err(httpd, 1, - "bozo_http_error() failed (short = %p, long = %p)", - header, reason); - return code; - } - - if (request && request->hr_serverport && - strcmp(request->hr_serverport, "80") != 0) - snprintf(portbuf, sizeof(portbuf), ":%s", - request->hr_serverport); - else - portbuf[0] = '\0'; - - if (request && request->hr_file) { - char *file = NULL; - const char *hostname = BOZOHOST(httpd, request); - - /* bozo_escape_html() failure here is just too bad. */ - file = bozo_escape_html(NULL, request->hr_file); - if (file == NULL) - file = request->hr_file; - size = snprintf(httpd->errorbuf, BUFSIZ, - "%s\n" - "

    %s

    \n" - "%s:
    %s
    \n" - "
    %s%s
    \n" - "\n", - header, header, file, reason, - hostname, portbuf, hostname, portbuf); - if (size >= (int)BUFSIZ) { - bozo_warn(httpd, - "bozo_http_error buffer too small, truncated"); - size = (int)BUFSIZ; - } - } else - size = 0; - - bozo_printf(httpd, "%s %s\r\n", proto, header); - if (request) - bozo_auth_check_401(request, code); - - bozo_printf(httpd, "Content-Type: text/html\r\n"); - bozo_printf(httpd, "Content-Length: %d\r\n", size); - bozo_printf(httpd, "Server: %s\r\n", httpd->server_software); - if (request && request->hr_allow) - bozo_printf(httpd, "Allow: %s\r\n", request->hr_allow); - bozo_printf(httpd, "\r\n"); - /* According to the RFC 2616 sec. 9.4 HEAD method MUST NOT return a - * message-body in the response */ - if (size && request && request->hr_method != HTTP_HEAD) - bozo_printf(httpd, "%s", httpd->errorbuf); - bozo_flush(httpd, stdout); - - return code; -} - -/* Below are various modified libc functions */ - -/* - * returns -1 in lenp if the string ran out before finding a delimiter, - * but is otherwise the same as strsep. Note that the length must be - * correctly passed in. - */ -char * -bozostrnsep(char **strp, const char *delim, ssize_t *lenp) -{ - char *s; - const char *spanp; - int c, sc; - char *tok; - - if ((s = *strp) == NULL) - return (NULL); - for (tok = s;;) { - if (lenp && --(*lenp) == -1) - return (NULL); - c = *s++; - spanp = delim; - do { - if ((sc = *spanp++) == c) { - if (c == 0) - s = NULL; - else - s[-1] = '\0'; - *strp = s; - return (tok); - } - } while (sc != 0); - } - /* NOTREACHED */ -} - -/* - * inspired by fgetln(3), but works for fd's. should work identically - * except it, however, does *not* return the newline, and it does nul - * terminate the string. - */ -char * -bozodgetln(bozohttpd_t *httpd, int fd, ssize_t *lenp, - ssize_t (*readfn)(bozohttpd_t *, int, void *, size_t)) -{ - ssize_t len; - int got_cr = 0; - char c, *nbuffer; - - /* initialise */ - if (httpd->getln_buflen == 0) { - /* should be plenty for most requests */ - httpd->getln_buflen = 128; - httpd->getln_buffer = malloc((size_t)httpd->getln_buflen); - if (httpd->getln_buffer == NULL) { - httpd->getln_buflen = 0; - return NULL; - } - } - len = 0; - - /* - * we *have* to read one byte at a time, to not break cgi - * programs (for we pass stdin off to them). could fix this - * by becoming a fd-passing program instead of just exec'ing - * the program - * - * the above is no longer true, we are the fd-passing - * program already. - */ - for (; readfn(httpd, fd, &c, 1) == 1; ) { - debug((httpd, DEBUG_EXPLODING, "bozodgetln read %c", c)); - - if (len >= httpd->getln_buflen - 1) { - httpd->getln_buflen *= 2; - debug((httpd, DEBUG_EXPLODING, "bozodgetln: " - "reallocating buffer to buflen %zu", - httpd->getln_buflen)); - nbuffer = bozorealloc(httpd, httpd->getln_buffer, - (size_t)httpd->getln_buflen); - httpd->getln_buffer = nbuffer; - } - - httpd->getln_buffer[len++] = c; - if (c == '\r') { - got_cr = 1; - continue; - } else if (c == '\n') { - /* - * HTTP/1.1 spec says to ignore CR and treat - * LF as the real line terminator. even though - * the same spec defines CRLF as the line - * terminator, it is recommended in section 19.3 - * to do the LF trick for tolerance. - */ - if (got_cr) - len -= 2; - else - len -= 1; - break; - } - - } - httpd->getln_buffer[len] = '\0'; - debug((httpd, DEBUG_OBESE, "bozodgetln returns: ``%s'' with len %zd", - httpd->getln_buffer, len)); - *lenp = len; - return httpd->getln_buffer; -} - -void * -bozorealloc(bozohttpd_t *httpd, void *ptr, size_t size) -{ - void *p; - - p = realloc(ptr, size); - if (p == NULL) { - (void)bozo_http_error(httpd, 500, NULL, - "memory allocation failure"); - exit(1); - } - return (p); -} - -void * -bozomalloc(bozohttpd_t *httpd, size_t size) -{ - void *p; - - p = malloc(size); - if (p == NULL) { - (void)bozo_http_error(httpd, 500, NULL, - "memory allocation failure"); - exit(1); - } - return (p); -} - -char * -bozostrdup(bozohttpd_t *httpd, const char *str) -{ - char *p; - - p = strdup(str); - if (p == NULL) { - (void)bozo_http_error(httpd, 500, NULL, - "memory allocation failure"); - exit(1); - } - return (p); -} - -/* set default values in bozohttpd_t struct */ -int -bozo_init_httpd(bozohttpd_t *httpd) -{ - /* make sure everything is clean */ - (void) memset(httpd, 0x0, sizeof(*httpd)); - - /* constants */ - httpd->consts.http_09 = "HTTP/0.9"; - httpd->consts.http_10 = "HTTP/1.0"; - httpd->consts.http_11 = "HTTP/1.1"; - httpd->consts.text_plain = "text/plain"; - - /* mmap region size */ - httpd->mmapsz = BOZO_MMAPSZ; - - /* error buffer for bozo_http_error() */ - if ((httpd->errorbuf = malloc(BUFSIZ)) == NULL) { - (void) fprintf(stderr, - "bozohttpd: memory_allocation failure\n"); - return 0; - } -#ifndef NO_LUA_SUPPORT - SIMPLEQ_INIT(&httpd->lua_states); -#endif - return 1; -} - -/* set default values in bozoprefs_t struct */ -int -bozo_init_prefs(bozoprefs_t *prefs) -{ - /* make sure everything is clean */ - (void) memset(prefs, 0x0, sizeof(*prefs)); - - /* set up default values */ - bozo_set_pref(prefs, "server software", SERVER_SOFTWARE); - bozo_set_pref(prefs, "index.html", INDEX_HTML); - bozo_set_pref(prefs, "public_html", PUBLIC_HTML); - - return 1; -} - -/* set default values */ -int -bozo_set_defaults(bozohttpd_t *httpd, bozoprefs_t *prefs) -{ - return bozo_init_httpd(httpd) && bozo_init_prefs(prefs); -} - -/* set the virtual host name, port and root */ -int -bozo_setup(bozohttpd_t *httpd, bozoprefs_t *prefs, const char *vhost, - const char *root) -{ - struct passwd *pw; - extern char **environ; - static char *cleanenv[1] = { NULL }; - uid_t uid; - char *chrootdir; - char *username; - char *portnum; - char *cp; - int dirtyenv; - - dirtyenv = 0; - - if (vhost == NULL) { - httpd->virthostname = bozomalloc(httpd, MAXHOSTNAMELEN+1); - /* XXX we do not check for FQDN here */ - if (gethostname(httpd->virthostname, MAXHOSTNAMELEN+1) < 0) - bozo_err(httpd, 1, "gethostname"); - httpd->virthostname[MAXHOSTNAMELEN] = '\0'; - } else { - httpd->virthostname = strdup(vhost); - } - httpd->slashdir = strdup(root); - if ((portnum = bozo_get_pref(prefs, "port number")) != NULL) { - httpd->bindport = strdup(portnum); - } - - /* go over preferences now */ - if ((cp = bozo_get_pref(prefs, "numeric")) != NULL && - strcmp(cp, "true") == 0) { - httpd->numeric = 1; - } - if ((cp = bozo_get_pref(prefs, "trusted referal")) != NULL && - strcmp(cp, "true") == 0) { - httpd->untrustedref = 1; - } - if ((cp = bozo_get_pref(prefs, "log to stderr")) != NULL && - strcmp(cp, "true") == 0) { - httpd->logstderr = 1; - } - if ((cp = bozo_get_pref(prefs, "bind address")) != NULL) { - httpd->bindaddress = strdup(cp); - } - if ((cp = bozo_get_pref(prefs, "background")) != NULL) { - httpd->background = atoi(cp); - } - if ((cp = bozo_get_pref(prefs, "foreground")) != NULL && - strcmp(cp, "true") == 0) { - httpd->foreground = 1; - } - if ((cp = bozo_get_pref(prefs, "pid file")) != NULL) { - httpd->pidfile = strdup(cp); - } - if ((cp = bozo_get_pref(prefs, "unknown slash")) != NULL && - strcmp(cp, "true") == 0) { - httpd->unknown_slash = 1; - } - if ((cp = bozo_get_pref(prefs, "virtual base")) != NULL) { - httpd->virtbase = strdup(cp); - } - if ((cp = bozo_get_pref(prefs, "enable users")) != NULL && - strcmp(cp, "true") == 0) { - httpd->enable_users = 1; - } - if ((cp = bozo_get_pref(prefs, "dirty environment")) != NULL && - strcmp(cp, "true") == 0) { - dirtyenv = 1; - } - if ((cp = bozo_get_pref(prefs, "hide dots")) != NULL && - strcmp(cp, "true") == 0) { - httpd->hide_dots = 1; - } - if ((cp = bozo_get_pref(prefs, "directory indexing")) != NULL && - strcmp(cp, "true") == 0) { - httpd->dir_indexing = 1; - } - if ((cp = bozo_get_pref(prefs, "public_html")) != NULL) { - httpd->public_html = strdup(cp); - } - httpd->server_software = - strdup(bozo_get_pref(prefs, "server software")); - httpd->index_html = strdup(bozo_get_pref(prefs, "index.html")); - - /* - * initialise ssl and daemon mode if necessary. - */ - bozo_ssl_init(httpd); - bozo_daemon_init(httpd); - - if ((username = bozo_get_pref(prefs, "username")) == NULL) { - if ((pw = getpwuid(uid = 0)) == NULL) - bozo_err(httpd, 1, "getpwuid(0): %s", strerror(errno)); - httpd->username = strdup(pw->pw_name); - } else { - httpd->username = strdup(username); - if ((pw = getpwnam(httpd->username)) == NULL) - bozo_err(httpd, 1, "getpwnam(%s): %s", httpd->username, - strerror(errno)); - if (initgroups(pw->pw_name, pw->pw_gid) == -1) - bozo_err(httpd, 1, "initgroups: %s", strerror(errno)); - if (setgid(pw->pw_gid) == -1) - bozo_err(httpd, 1, "setgid(%u): %s", pw->pw_gid, - strerror(errno)); - uid = pw->pw_uid; - } - /* - * handle chroot. - */ - if ((chrootdir = bozo_get_pref(prefs, "chroot dir")) != NULL) { - httpd->rootdir = strdup(chrootdir); - if (chdir(httpd->rootdir) == -1) - bozo_err(httpd, 1, "chdir(%s): %s", httpd->rootdir, - strerror(errno)); - if (chroot(httpd->rootdir) == -1) - bozo_err(httpd, 1, "chroot(%s): %s", httpd->rootdir, - strerror(errno)); - } - - if (username != NULL) - if (setuid(uid) == -1) - bozo_err(httpd, 1, "setuid(%d): %s", uid, - strerror(errno)); - - /* - * prevent info leakage between different compartments. - * some PATH values in the environment would be invalided - * by chroot. cross-user settings might result in undesirable - * effects. - */ - if ((chrootdir != NULL || username != NULL) && !dirtyenv) - environ = cleanenv; - -#ifdef _SC_PAGESIZE - httpd->page_size = (long)sysconf(_SC_PAGESIZE); -#else - httpd->page_size = 4096; -#endif - debug((httpd, DEBUG_OBESE, "myname is %s, slashdir is %s", - httpd->virthostname, httpd->slashdir)); - - return 1; -} diff --git a/libexec/httpd/cgi-bozo.c b/libexec/httpd/cgi-bozo.c deleted file mode 100644 index e0bcc8ca7..000000000 --- a/libexec/httpd/cgi-bozo.c +++ /dev/null @@ -1,523 +0,0 @@ -/* $NetBSD: cgi-bozo.c,v 1.27 2015/05/02 11:35:48 mrg Exp $ */ - -/* $eterna: cgi-bozo.c,v 1.40 2011/11/18 09:21:15 mrg Exp $ */ - -/* - * Copyright (c) 1997-2015 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer and - * dedication in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* this code implements CGI/1.2 for bozohttpd */ - -#ifndef NO_CGIBIN_SUPPORT - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "bozohttpd.h" - -#define CGIBIN_PREFIX "cgi-bin/" -#define CGIBIN_PREFIX_LEN (sizeof(CGIBIN_PREFIX)-1) - -#ifndef USE_ARG -#define USE_ARG(x) /*LINTED*/(void)&(x) -#endif - -/* - * given the file name, return a CGI interpreter - */ -static const char * -content_cgihandler(bozohttpd_t *httpd, bozo_httpreq_t *request, - const char *file) -{ - bozo_content_map_t *map; - - USE_ARG(request); - debug((httpd, DEBUG_FAT, "content_cgihandler: trying file %s", file)); - map = bozo_match_content_map(httpd, file, 0); - if (map) - return map->cgihandler; - return NULL; -} - -static int -parse_header(bozohttpd_t *httpd, const char *str, ssize_t len, char **hdr_str, - char **hdr_val) -{ - char *name, *value; - - /* if the string passed is zero-length bail out */ - if (*str == '\0') - return -1; - - value = bozostrdup(httpd, str); - - /* locate the ':' separator in the header/value */ - name = bozostrnsep(&value, ":", &len); - - if (NULL == name || -1 == len) { - free(name); - return -1; - } - - /* skip leading space/tab */ - while (*value == ' ' || *value == '\t') - len--, value++; - - *hdr_str = name; - *hdr_val = value; - - return 0; -} - -/* - * handle parsing a CGI header output, transposing a Status: header - * into the HTTP reply (ie, instead of "200 OK"). - */ -static void -finish_cgi_output(bozohttpd_t *httpd, bozo_httpreq_t *request, int in, int nph) -{ - char buf[BOZO_WRSZ]; - char *str; - ssize_t len; - ssize_t rbytes; - SIMPLEQ_HEAD(, bozoheaders) headers; - bozoheaders_t *hdr, *nhdr; - int write_header, nheaders = 0; - - /* much of this code is like bozo_read_request()'s header loop. */ - SIMPLEQ_INIT(&headers); - write_header = nph == 0; - /* was read(2) here - XXX - agc */ - while (nph == 0 && - (str = bozodgetln(httpd, in, &len, bozo_read)) != NULL) { - char *hdr_name, *hdr_value; - - if (parse_header(httpd, str, len, &hdr_name, &hdr_value)) - break; - - /* - * The CGI 1.{1,2} spec both say that if the cgi program - * returns a `Status:' header field then the server MUST - * return it in the response. If the cgi program does - * not return any `Status:' header then the server should - * respond with 200 OK. - * XXX The CGI 1.1 and 1.2 specification differ slightly on - * this in that v1.2 says that the script MUST NOT return a - * `Status:' header if it is returning a `Location:' header. - * For compatibility we are going with the CGI 1.1 behavior. - */ - if (strcasecmp(hdr_name, "status") == 0) { - debug((httpd, DEBUG_OBESE, - "bozo_process_cgi: writing HTTP header " - "from status %s ..", hdr_value)); - bozo_printf(httpd, "%s %s\r\n", request->hr_proto, - hdr_value); - bozo_flush(httpd, stdout); - write_header = 0; - free(hdr_name); - break; - } - - hdr = bozomalloc(httpd, sizeof *hdr); - hdr->h_header = hdr_name; - hdr->h_value = hdr_value; - SIMPLEQ_INSERT_TAIL(&headers, hdr, h_next); - nheaders++; - } - - if (write_header) { - debug((httpd, DEBUG_OBESE, - "bozo_process_cgi: writing HTTP header ..")); - bozo_printf(httpd, - "%s 200 OK\r\n", request->hr_proto); - bozo_flush(httpd, stdout); - } - - if (nheaders) { - debug((httpd, DEBUG_OBESE, - "bozo_process_cgi: writing delayed HTTP headers ..")); - SIMPLEQ_FOREACH_SAFE(hdr, &headers, h_next, nhdr) { - bozo_printf(httpd, "%s: %s\r\n", hdr->h_header, - hdr->h_value); - free(hdr->h_header); - free(hdr); - } - bozo_printf(httpd, "\r\n"); - bozo_flush(httpd, stdout); - } - - /* XXX we should have some goo that times us out - */ - while ((rbytes = read(in, buf, sizeof buf)) > 0) { - ssize_t wbytes; - char *bp = buf; - - while (rbytes) { - wbytes = bozo_write(httpd, STDOUT_FILENO, buf, - (size_t)rbytes); - if (wbytes > 0) { - rbytes -= wbytes; - bp += wbytes; - } else - bozo_err(httpd, 1, - "cgi output write failed: %s", - strerror(errno)); - } - } -} - -static void -append_index_html(bozohttpd_t *httpd, char **url) -{ - *url = bozorealloc(httpd, *url, - strlen(*url) + strlen(httpd->index_html) + 1); - strcat(*url, httpd->index_html); - debug((httpd, DEBUG_NORMAL, - "append_index_html: url adjusted to `%s'", *url)); -} - -void -bozo_cgi_setbin(bozohttpd_t *httpd, const char *path) -{ - httpd->cgibin = strdup(path); - debug((httpd, DEBUG_OBESE, "cgibin (cgi-bin directory) is %s", - httpd->cgibin)); -} - -/* help build up the environ pointer */ -void -bozo_setenv(bozohttpd_t *httpd, const char *env, const char *val, - char **envp) -{ - char *s1 = bozomalloc(httpd, strlen(env) + strlen(val) + 2); - - strcpy(s1, env); - strcat(s1, "="); - strcat(s1, val); - debug((httpd, DEBUG_OBESE, "bozo_setenv: %s", s1)); - *envp = s1; -} - -/* - * Checks if the request has asked for a cgi-bin. Should only be called if - * cgibin is set. If it starts CGIBIN_PREFIX or has a ncontent handler, - * process the cgi, otherwise just return. Returns 0 if it did not handle - * the request. - */ -int -bozo_process_cgi(bozo_httpreq_t *request) -{ - bozohttpd_t *httpd = request->hr_httpd; - char buf[BOZO_WRSZ]; - char date[40]; - bozoheaders_t *headp; - const char *type, *clen, *info, *cgihandler; - char *query, *s, *t, *path, *env, *file, *url; - char command[MAXPATHLEN]; - char **envp, **curenvp, *argv[4]; - char *uri; - size_t len; - ssize_t rbytes; - pid_t pid; - int envpsize, ix, nph; - int sv[2]; - - if (!httpd->cgibin && !httpd->process_cgi) - return 0; - - if (request->hr_oldfile && strcmp(request->hr_oldfile, "/") != 0) - uri = request->hr_oldfile; - else - uri = request->hr_file; - - if (uri[0] == '/') - file = bozostrdup(httpd, uri); - else - asprintf(&file, "/%s", uri); - if (file == NULL) - return 0; - - if (request->hr_query && strlen(request->hr_query)) - query = bozostrdup(httpd, request->hr_query); - else - query = NULL; - - asprintf(&url, "%s%s%s", file, query ? "?" : "", query ? query : ""); - if (url == NULL) - goto out; - debug((httpd, DEBUG_NORMAL, "bozo_process_cgi: url `%s'", url)); - - path = NULL; - envp = NULL; - cgihandler = NULL; - info = NULL; - - len = strlen(url); - - if (bozo_auth_check(request, url + 1)) - goto out; - - if (!httpd->cgibin || - strncmp(url + 1, CGIBIN_PREFIX, CGIBIN_PREFIX_LEN) != 0) { - cgihandler = content_cgihandler(httpd, request, file + 1); - if (cgihandler == NULL) { - debug((httpd, DEBUG_FAT, - "bozo_process_cgi: no handler, returning")); - goto out; - } - if (len == 0 || file[len - 1] == '/') - append_index_html(httpd, &file); - debug((httpd, DEBUG_NORMAL, "bozo_process_cgi: cgihandler `%s'", - cgihandler)); - } else if (len - 1 == CGIBIN_PREFIX_LEN) /* url is "/cgi-bin/" */ - append_index_html(httpd, &file); - - ix = 0; - if (cgihandler) { - snprintf(command, sizeof(command), "%s", file + 1); - path = bozostrdup(httpd, cgihandler); - argv[ix++] = path; - /* argv[] = [ path, command, query, NULL ] */ - } else { - snprintf(command, sizeof(command), "%s", - file + CGIBIN_PREFIX_LEN + 1); - if ((s = strchr(command, '/')) != NULL) { - info = bozostrdup(httpd, s); - *s = '\0'; - } - path = bozomalloc(httpd, - strlen(httpd->cgibin) + 1 + strlen(command) + 1); - strcpy(path, httpd->cgibin); - strcat(path, "/"); - strcat(path, command); - /* argv[] = [ command, query, NULL ] */ - } - argv[ix++] = command; - argv[ix++] = query; - argv[ix++] = NULL; - - nph = strncmp(command, "nph-", 4) == 0; - - type = request->hr_content_type; - clen = request->hr_content_length; - - envpsize = 13 + request->hr_nheaders + - (info && *info ? 1 : 0) + - (query && *query ? 1 : 0) + - (type && *type ? 1 : 0) + - (clen && *clen ? 1 : 0) + - (request->hr_remotehost && *request->hr_remotehost ? 1 : 0) + - (request->hr_remoteaddr && *request->hr_remoteaddr ? 1 : 0) + - bozo_auth_cgi_count(request) + - (request->hr_serverport && *request->hr_serverport ? 1 : 0); - - debug((httpd, DEBUG_FAT, - "bozo_process_cgi: path `%s', cmd `%s', info `%s', " - "query `%s', nph `%d', envpsize `%d'", - path, command, strornull(info), - strornull(query), nph, envpsize)); - - envp = bozomalloc(httpd, sizeof(*envp) * envpsize); - for (ix = 0; ix < envpsize; ix++) - envp[ix] = NULL; - curenvp = envp; - - SIMPLEQ_FOREACH(headp, &request->hr_headers, h_next) { - const char *s2; - env = bozomalloc(httpd, 6 + strlen(headp->h_header) + 1 + - strlen(headp->h_value)); - - t = env; - strcpy(t, "HTTP_"); - t += strlen(t); - for (s2 = headp->h_header; *s2; t++, s2++) - if (islower((u_int)*s2)) - *t = toupper((u_int)*s2); - else if (*s2 == '-') - *t = '_'; - else - *t = *s2; - *t = '\0'; - debug((httpd, DEBUG_OBESE, "setting header %s as %s = %s", - headp->h_header, env, headp->h_value)); - bozo_setenv(httpd, env, headp->h_value, curenvp++); - free(env); - } - -#ifndef _PATH_DEFPATH -#define _PATH_DEFPATH "/usr/bin:/bin" -#endif - - bozo_setenv(httpd, "PATH", _PATH_DEFPATH, curenvp++); - bozo_setenv(httpd, "IFS", " \t\n", curenvp++); - bozo_setenv(httpd, "SERVER_NAME", BOZOHOST(httpd,request), curenvp++); - bozo_setenv(httpd, "GATEWAY_INTERFACE", "CGI/1.1", curenvp++); - bozo_setenv(httpd, "SERVER_PROTOCOL", request->hr_proto, curenvp++); - bozo_setenv(httpd, "REQUEST_METHOD", request->hr_methodstr, curenvp++); - bozo_setenv(httpd, "SCRIPT_NAME", file, curenvp++); - bozo_setenv(httpd, "SCRIPT_FILENAME", file + 1, curenvp++); - bozo_setenv(httpd, "SERVER_SOFTWARE", httpd->server_software, - curenvp++); - bozo_setenv(httpd, "REQUEST_URI", uri, curenvp++); - bozo_setenv(httpd, "DATE_GMT", bozo_http_date(date, sizeof(date)), - curenvp++); - if (query && *query) - bozo_setenv(httpd, "QUERY_STRING", query, curenvp++); - if (info && *info) - bozo_setenv(httpd, "PATH_INFO", info, curenvp++); - if (type && *type) - bozo_setenv(httpd, "CONTENT_TYPE", type, curenvp++); - if (clen && *clen) - bozo_setenv(httpd, "CONTENT_LENGTH", clen, curenvp++); - if (request->hr_serverport && *request->hr_serverport) - bozo_setenv(httpd, "SERVER_PORT", request->hr_serverport, - curenvp++); - if (request->hr_remotehost && *request->hr_remotehost) - bozo_setenv(httpd, "REMOTE_HOST", request->hr_remotehost, - curenvp++); - if (request->hr_remoteaddr && *request->hr_remoteaddr) - bozo_setenv(httpd, "REMOTE_ADDR", request->hr_remoteaddr, - curenvp++); - /* - * XXX Apache does this when invoking content handlers, and PHP - * XXX 5.3 requires it as a "security" measure. - */ - if (cgihandler) - bozo_setenv(httpd, "REDIRECT_STATUS", "200", curenvp++); - bozo_auth_cgi_setenv(request, &curenvp); - - free(file); - free(url); - - debug((httpd, DEBUG_FAT, "bozo_process_cgi: going exec %s, %s %s %s", - path, argv[0], strornull(argv[1]), strornull(argv[2]))); - - if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, sv) == -1) - bozo_err(httpd, 1, "child socketpair failed: %s", - strerror(errno)); - - /* - * We create 2 procs: one to become the CGI, one read from - * the CGI and output to the network, and this parent will - * continue reading from the network and writing to the - * CGI procsss. - */ - switch (fork()) { - case -1: /* eep, failure */ - bozo_err(httpd, 1, "child fork failed: %s", strerror(errno)); - /*NOTREACHED*/ - case 0: - close(sv[0]); - dup2(sv[1], STDIN_FILENO); - dup2(sv[1], STDOUT_FILENO); - close(2); - close(sv[1]); - closelog(); - bozo_daemon_closefds(httpd); - - if (-1 == execve(path, argv, envp)) - bozo_err(httpd, 1, "child exec failed: %s: %s", - path, strerror(errno)); - /* NOT REACHED */ - bozo_err(httpd, 1, "child execve returned?!"); - } - - close(sv[1]); - - /* parent: read from stdin (bozo_read()) write to sv[0] */ - /* child: read from sv[0] (bozo_write()) write to stdout */ - pid = fork(); - if (pid == -1) - bozo_err(httpd, 1, "io child fork failed: %s", strerror(errno)); - else if (pid == 0) { - /* child reader/writer */ - close(STDIN_FILENO); - finish_cgi_output(httpd, request, sv[0], nph); - /* if we're done output, our parent is useless... */ - kill(getppid(), SIGKILL); - debug((httpd, DEBUG_FAT, "done processing cgi output")); - _exit(0); - } - close(STDOUT_FILENO); - - /* XXX we should have some goo that times us out - */ - while ((rbytes = bozo_read(httpd, STDIN_FILENO, buf, sizeof buf)) > 0) { - ssize_t wbytes; - char *bp = buf; - - while (rbytes) { - wbytes = write(sv[0], buf, (size_t)rbytes); - if (wbytes > 0) { - rbytes -= wbytes; - bp += wbytes; - } else - bozo_err(httpd, 1, "write failed: %s", - strerror(errno)); - } - } - debug((httpd, DEBUG_FAT, "done processing cgi input")); - exit(0); - - out: - free(query); - free(file); - free(url); - return 0; -} - -#ifndef NO_DYNAMIC_CONTENT -/* cgi maps are simple ".postfix /path/to/prog" */ -void -bozo_add_content_map_cgi(bozohttpd_t *httpd, const char *arg, const char *cgihandler) -{ - bozo_content_map_t *map; - - debug((httpd, DEBUG_NORMAL, "bozo_add_content_map_cgi: name %s cgi %s", - arg, cgihandler)); - - httpd->process_cgi = 1; - - map = bozo_get_content_map(httpd, arg); - map->name = arg; - map->type = map->encoding = map->encoding11 = NULL; - map->cgihandler = cgihandler; -} -#endif /* NO_DYNAMIC_CONTENT */ - -#endif /* NO_CGIBIN_SUPPORT */ diff --git a/libexec/httpd/content-bozo.c b/libexec/httpd/content-bozo.c deleted file mode 100644 index 4a2e5a285..000000000 --- a/libexec/httpd/content-bozo.c +++ /dev/null @@ -1,301 +0,0 @@ -/* $NetBSD: content-bozo.c,v 1.12 2015/05/02 11:35:48 mrg Exp $ */ - -/* $eterna: content-bozo.c,v 1.17 2011/11/18 09:21:15 mrg Exp $ */ - -/* - * Copyright (c) 1997-2015 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer and - * dedication in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* this code implements content-type handling for bozohttpd */ - -#include - -#include -#include - -#include "bozohttpd.h" - -/* - * this map and the functions below map between filenames and the - * content type and content encoding definitions. this should become - * a configuration file, perhaps like apache's mime.types (but that - * has less info per-entry). - */ - -static bozo_content_map_t static_content_map[] = { - { ".html", "text/html", "", "", NULL }, - { ".htm", "text/html", "", "", NULL }, - { ".gif", "image/gif", "", "", NULL }, - { ".jpeg", "image/jpeg", "", "", NULL }, - { ".jpg", "image/jpeg", "", "", NULL }, - { ".jpe", "image/jpeg", "", "", NULL }, - { ".png", "image/png", "", "", NULL }, - { ".mp3", "audio/mpeg", "", "", NULL }, - { ".css", "text/css", "", "", NULL }, - { ".txt", "text/plain", "", "", NULL }, - { ".swf", "application/x-shockwave-flash","", "", NULL }, - { ".dcr", "application/x-director", "", "", NULL }, - { ".pac", "application/x-ns-proxy-autoconfig", "", "", NULL }, - { ".pa", "application/x-ns-proxy-autoconfig", "", "", NULL }, - { ".tar", "multipart/x-tar", "", "", NULL }, - { ".gtar", "multipart/x-gtar", "", "", NULL }, - { ".tar.Z", "multipart/x-tar", "x-compress", "compress", NULL }, - { ".tar.gz", "multipart/x-tar", "x-gzip", "gzip", NULL }, - { ".taz", "multipart/x-tar", "x-gzip", "gzip", NULL }, - { ".tgz", "multipart/x-tar", "x-gzip", "gzip", NULL }, - { ".tar.z", "multipart/x-tar", "x-pack", "x-pack", NULL }, - { ".Z", "application/x-compress", "x-compress", "compress", NULL }, - { ".gz", "application/x-gzip", "x-gzip", "gzip", NULL }, - { ".z", "unknown", "x-pack", "x-pack", NULL }, - { ".bz2", "application/x-bzip2", "x-bzip2", "x-bzip2", NULL }, - { ".ogg", "application/x-ogg", "", "", NULL }, - { ".mkv", "video/x-matroska", "", "", NULL }, - { ".xbel", "text/xml", "", "", NULL }, - { ".xml", "text/xml", "", "", NULL }, - { ".xsl", "text/xml", "", "", NULL }, - { ".hqx", "application/mac-binhex40", "", "", NULL }, - { ".cpt", "application/mac-compactpro", "", "", NULL }, - { ".doc", "application/msword", "", "", NULL }, - { ".bin", "application/octet-stream", "", "", NULL }, - { ".dms", "application/octet-stream", "", "", NULL }, - { ".lha", "application/octet-stream", "", "", NULL }, - { ".lzh", "application/octet-stream", "", "", NULL }, - { ".exe", "application/octet-stream", "", "", NULL }, - { ".class", "application/octet-stream", "", "", NULL }, - { ".oda", "application/oda", "", "", NULL }, - { ".pdf", "application/pdf", "", "", NULL }, - { ".ai", "application/postscript", "", "", NULL }, - { ".eps", "application/postscript", "", "", NULL }, - { ".ps", "application/postscript", "", "", NULL }, - { ".ppt", "application/powerpoint", "", "", NULL }, - { ".rtf", "application/rtf", "", "", NULL }, - { ".bcpio", "application/x-bcpio", "", "", NULL }, - { ".torrent", "application/x-bittorrent", "", "", NULL }, - { ".vcd", "application/x-cdlink", "", "", NULL }, - { ".cpio", "application/x-cpio", "", "", NULL }, - { ".csh", "application/x-csh", "", "", NULL }, - { ".dir", "application/x-director", "", "", NULL }, - { ".dxr", "application/x-director", "", "", NULL }, - { ".dvi", "application/x-dvi", "", "", NULL }, - { ".hdf", "application/x-hdf", "", "", NULL }, - { ".cgi", "application/x-httpd-cgi", "", "", NULL }, - { ".skp", "application/x-koan", "", "", NULL }, - { ".skd", "application/x-koan", "", "", NULL }, - { ".skt", "application/x-koan", "", "", NULL }, - { ".skm", "application/x-koan", "", "", NULL }, - { ".latex", "application/x-latex", "", "", NULL }, - { ".mif", "application/x-mif", "", "", NULL }, - { ".nc", "application/x-netcdf", "", "", NULL }, - { ".cdf", "application/x-netcdf", "", "", NULL }, - { ".patch", "application/x-patch", "", "", NULL }, - { ".sh", "application/x-sh", "", "", NULL }, - { ".shar", "application/x-shar", "", "", NULL }, - { ".sit", "application/x-stuffit", "", "", NULL }, - { ".sv4cpio", "application/x-sv4cpio", "", "", NULL }, - { ".sv4crc", "application/x-sv4crc", "", "", NULL }, - { ".tar", "application/x-tar", "", "", NULL }, - { ".tcl", "application/x-tcl", "", "", NULL }, - { ".tex", "application/x-tex", "", "", NULL }, - { ".texinfo", "application/x-texinfo", "", "", NULL }, - { ".texi", "application/x-texinfo", "", "", NULL }, - { ".t", "application/x-troff", "", "", NULL }, - { ".tr", "application/x-troff", "", "", NULL }, - { ".roff", "application/x-troff", "", "", NULL }, - { ".man", "application/x-troff-man", "", "", NULL }, - { ".me", "application/x-troff-me", "", "", NULL }, - { ".ms", "application/x-troff-ms", "", "", NULL }, - { ".ustar", "application/x-ustar", "", "", NULL }, - { ".src", "application/x-wais-source", "", "", NULL }, - { ".zip", "application/zip", "", "", NULL }, - { ".au", "audio/basic", "", "", NULL }, - { ".snd", "audio/basic", "", "", NULL }, - { ".mpga", "audio/mpeg", "", "", NULL }, - { ".mp2", "audio/mpeg", "", "", NULL }, - { ".aif", "audio/x-aiff", "", "", NULL }, - { ".aiff", "audio/x-aiff", "", "", NULL }, - { ".aifc", "audio/x-aiff", "", "", NULL }, - { ".ram", "audio/x-pn-realaudio", "", "", NULL }, - { ".rpm", "audio/x-pn-realaudio-plugin", "", "", NULL }, - { ".ra", "audio/x-realaudio", "", "", NULL }, - { ".wav", "audio/x-wav", "", "", NULL }, - { ".pdb", "chemical/x-pdb", "", "", NULL }, - { ".xyz", "chemical/x-pdb", "", "", NULL }, - { ".ief", "image/ief", "", "", NULL }, - { ".tiff", "image/tiff", "", "", NULL }, - { ".tif", "image/tiff", "", "", NULL }, - { ".ras", "image/x-cmu-raster", "", "", NULL }, - { ".pnm", "image/x-portable-anymap", "", "", NULL }, - { ".pbm", "image/x-portable-bitmap", "", "", NULL }, - { ".pgm", "image/x-portable-graymap", "", "", NULL }, - { ".ppm", "image/x-portable-pixmap", "", "", NULL }, - { ".rgb", "image/x-rgb", "", "", NULL }, - { ".xbm", "image/x-xbitmap", "", "", NULL }, - { ".xpm", "image/x-xpixmap", "", "", NULL }, - { ".xwd", "image/x-xwindowdump", "", "", NULL }, - { ".rtx", "text/richtext", "", "", NULL }, - { ".tsv", "text/tab-separated-values", "", "", NULL }, - { ".etx", "text/x-setext", "", "", NULL }, - { ".sgml", "text/x-sgml", "", "", NULL }, - { ".sgm", "text/x-sgml", "", "", NULL }, - { ".mpeg", "video/mpeg", "", "", NULL }, - { ".mpg", "video/mpeg", "", "", NULL }, - { ".mpe", "video/mpeg", "", "", NULL }, - { ".ts", "video/mpeg", "", "", NULL }, - { ".vob", "video/mpeg", "", "", NULL }, - { ".mp4", "video/mp4", "", "", NULL }, - { ".qt", "video/quicktime", "", "", NULL }, - { ".mov", "video/quicktime", "", "", NULL }, - { ".avi", "video/x-msvideo", "", "", NULL }, - { ".movie", "video/x-sgi-movie", "", "", NULL }, - { ".ice", "x-conference/x-cooltalk", "", "", NULL }, - { ".wrl", "x-world/x-vrml", "", "", NULL }, - { ".vrml", "x-world/x-vrml", "", "", NULL }, - { ".svg", "image/svg+xml", "", "", NULL }, - { NULL, NULL, NULL, NULL, NULL } -}; - -static bozo_content_map_t * -search_map(bozo_content_map_t *map, const char *name, size_t len) -{ - for ( ; map && map->name; map++) { - const size_t namelen = strlen(map->name); - - if (namelen < len && - strcasecmp(map->name, name + (len - namelen)) == 0) - return map; - } - return NULL; -} - -/* match a suffix on a file - dynamiconly means no static content search */ -bozo_content_map_t * -bozo_match_content_map(bozohttpd_t *httpd, const char *name, - const int dynamiconly) -{ - bozo_content_map_t *map; - size_t len; - - len = strlen(name); - if ((map = search_map(httpd->dynamic_content_map, name, len)) != NULL) { - return map; - } - if (!dynamiconly) { - if ((map = search_map(static_content_map, name, len)) != NULL) { - return map; - } - } - return NULL; -} - -/* - * given the file name, return a valid Content-Type: value. - */ -/* ARGSUSED */ -const char * -bozo_content_type(bozo_httpreq_t *request, const char *file) -{ - bozohttpd_t *httpd = request->hr_httpd; - bozo_content_map_t *map; - - map = bozo_match_content_map(httpd, file, 0); - if (map) - return map->type; - return httpd->consts.text_plain; -} - -/* - * given the file name, return a valid Content-Encoding: value. - */ -const char * -bozo_content_encoding(bozo_httpreq_t *request, const char *file) -{ - bozohttpd_t *httpd = request->hr_httpd; - bozo_content_map_t *map; - - map = bozo_match_content_map(httpd, file, 0); - if (map) - return (request->hr_proto == httpd->consts.http_11) ? - map->encoding11 : map->encoding; - return NULL; -} - -#ifndef NO_DYNAMIC_CONTENT - -bozo_content_map_t * -bozo_get_content_map(bozohttpd_t *httpd, const char *name) -{ - bozo_content_map_t *map; - - if ((map = bozo_match_content_map(httpd, name, 1)) != NULL) - return map; - - httpd->dynamic_content_map_size++; - httpd->dynamic_content_map = bozorealloc(httpd, - httpd->dynamic_content_map, - (httpd->dynamic_content_map_size + 1) * sizeof *map); - if (httpd->dynamic_content_map == NULL) - bozo_err(httpd, 1, "out of memory allocating content map"); - map = &httpd->dynamic_content_map[httpd->dynamic_content_map_size]; - map->name = map->type = map->encoding = map->encoding11 = - map->cgihandler = NULL; - map--; - - return map; -} - -/* - * mime content maps look like: - * ".name type encoding encoding11" - * where any of type, encoding or encoding11 a dash "-" means "". - * eg the .gtar, .tar.Z from above could be written like: - * ".gtar multipart/x-gtar - -" - * ".tar.Z multipart/x-tar x-compress compress" - * or - * ".gtar multipart/x-gtar" - * ".tar.Z multipart/x-tar x-compress compress" - * NOTE: we destroy 'arg' - */ -void -bozo_add_content_map_mime(bozohttpd_t *httpd, const char *cmap0, - const char *cmap1, const char *cmap2, const char *cmap3) -{ - bozo_content_map_t *map; - - debug((httpd, DEBUG_FAT, - "add_content_map: name %s type %s enc %s enc11 %s ", - cmap0, cmap1, cmap2, cmap3)); - - map = bozo_get_content_map(httpd, cmap0); -#define CHECKMAP(s) (!s || ((s)[0] == '-' && (s)[1] == '\0') ? "" : (s)) - map->name = CHECKMAP(cmap0); - map->type = CHECKMAP(cmap1); - map->encoding = CHECKMAP(cmap2); - map->encoding11 = CHECKMAP(cmap3); -#undef CHECKMAP - map->cgihandler = NULL; -} -#endif /* NO_DYNAMIC_CONTENT */ diff --git a/libexec/httpd/daemon-bozo.c b/libexec/httpd/daemon-bozo.c deleted file mode 100644 index ff3109af3..000000000 --- a/libexec/httpd/daemon-bozo.c +++ /dev/null @@ -1,339 +0,0 @@ -/* $NetBSD: daemon-bozo.c,v 1.16 2014/01/02 08:21:38 mrg Exp $ */ - -/* $eterna: daemon-bozo.c,v 1.24 2011/11/18 09:21:15 mrg Exp $ */ - -/* - * Copyright (c) 1997-2014 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer and - * dedication in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* this code implements daemon mode for bozohttpd */ - -#ifndef NO_DAEMON_MODE - -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "bozohttpd.h" - -static void sigchild(int); /* SIGCHLD handler */ - -#ifndef POLLRDNORM -#define POLLRDNORM 0 -#endif -#ifndef POLLRDBAND -#define POLLRDBAND 0 -#endif -#ifndef INFTIM -#define INFTIM -1 -#endif - -static const char* pidfile_path = NULL; -static pid_t pidfile_pid = 0; - -/* ARGSUSED */ -static void -sigchild(int signo) -{ - while (waitpid(-1, NULL, WNOHANG) > 0) { - } -} - -/* Signal handler to exit in a controlled manner. This ensures that - * any atexit(3) handlers are properly executed. */ -/* ARGSUSED */ -BOZO_DEAD static void -controlled_exit(int signo) -{ - - exit(EXIT_SUCCESS); -} - -static void -remove_pidfile(void) -{ - - if (pidfile_path != NULL && pidfile_pid == getpid()) { - (void)unlink(pidfile_path); - pidfile_path = NULL; - } -} - -static void -create_pidfile(bozohttpd_t *httpd) -{ - FILE *file; - - assert(pidfile_path == NULL); - - if (httpd->pidfile == NULL) - return; - - if (atexit(remove_pidfile) == -1) - bozo_err(httpd, 1, "Failed to install pidfile handler"); - - if ((file = fopen(httpd->pidfile, "w")) == NULL) - bozo_err(httpd, 1, "Failed to create pidfile '%s'", - httpd->pidfile); - (void)fprintf(file, "%d\n", getpid()); - (void)fclose(file); - - pidfile_path = httpd->pidfile; - pidfile_pid = getpid(); - - debug((httpd, DEBUG_FAT, "Created pid file '%s' for pid %d", - pidfile_path, pidfile_pid)); -} - -void -bozo_daemon_init(bozohttpd_t *httpd) -{ - struct addrinfo h, *r, *r0; - const char *portnum; - int e, i, on = 1; - - if (!httpd->background) - return; - - portnum = (httpd->bindport) ? httpd->bindport : "http"; - - memset(&h, 0, sizeof(h)); - h.ai_family = PF_UNSPEC; - h.ai_socktype = SOCK_STREAM; - h.ai_flags = AI_PASSIVE; - e = getaddrinfo(httpd->bindaddress, portnum, &h, &r0); - if (e) - bozo_err(httpd, 1, "getaddrinfo([%s]:%s): %s", - httpd->bindaddress ? httpd->bindaddress : "*", - portnum, gai_strerror(e)); - for (r = r0; r != NULL; r = r->ai_next) - httpd->nsock++; - httpd->sock = bozomalloc(httpd, httpd->nsock * sizeof(*httpd->sock)); - httpd->fds = bozomalloc(httpd, httpd->nsock * sizeof(*httpd->fds)); - for (i = 0, r = r0; r != NULL; r = r->ai_next) { - httpd->sock[i] = socket(r->ai_family, SOCK_STREAM, 0); - if (httpd->sock[i] == -1) - continue; - if (setsockopt(httpd->sock[i], SOL_SOCKET, SO_REUSEADDR, &on, - sizeof(on)) == -1) - bozo_warn(httpd, "setsockopt SO_REUSEADDR: %s", - strerror(errno)); - if (bind(httpd->sock[i], r->ai_addr, r->ai_addrlen) == -1) - continue; - if (listen(httpd->sock[i], SOMAXCONN) == -1) - continue; - httpd->fds[i].events = POLLIN | POLLPRI | POLLRDNORM | - POLLRDBAND | POLLERR; - httpd->fds[i].fd = httpd->sock[i]; - i++; - } - if (i == 0) - bozo_err(httpd, 1, "could not find any addresses to bind"); - httpd->nsock = i; - freeaddrinfo(r0); - - if (httpd->foreground == 0) - daemon(1, 0); - - create_pidfile(httpd); - - bozo_warn(httpd, "started in daemon mode as `%s' port `%s' root `%s'", - httpd->virthostname, portnum, httpd->slashdir); - - signal(SIGHUP, controlled_exit); - signal(SIGINT, controlled_exit); - signal(SIGTERM, controlled_exit); - - signal(SIGCHLD, sigchild); -} - -void -bozo_daemon_closefds(bozohttpd_t *httpd) -{ - int i; - - for (i = 0; i < httpd->nsock; i++) - close(httpd->sock[i]); -} - -static void -daemon_runchild(bozohttpd_t *httpd, int fd) -{ - httpd->request_times++; - - /* setup stdin/stdout/stderr */ - dup2(fd, 0); - dup2(fd, 1); - /*dup2(fd, 2);*/ - close(fd); -} - -static int -daemon_poll_err(bozohttpd_t *httpd, int fd, int idx) -{ - if ((httpd->fds[idx].revents & (POLLNVAL|POLLERR|POLLHUP)) == 0) - return 0; - - bozo_warn(httpd, "poll on fd %d pid %d revents %d: %s", - httpd->fds[idx].fd, getpid(), httpd->fds[idx].revents, - strerror(errno)); - bozo_warn(httpd, "nsock = %d", httpd->nsock); - close(httpd->sock[idx]); - httpd->nsock--; - bozo_warn(httpd, "nsock now = %d", httpd->nsock); - /* no sockets left */ - if (httpd->nsock == 0) - exit(0); - /* last socket closed is the easy case */ - if (httpd->nsock != idx) { - memmove(&httpd->fds[idx], &httpd->fds[idx+1], - (httpd->nsock - idx) * sizeof(*httpd->fds)); - memmove(&httpd->sock[idx], &httpd->sock[idx+1], - (httpd->nsock - idx) * sizeof(*httpd->sock)); - } - - return 1; -} - -/* - * the parent never returns from this function, only children that - * are ready to run... XXXMRG - still true in fork-lesser bozo? - */ -int -bozo_daemon_fork(bozohttpd_t *httpd) -{ - int i; - - debug((httpd, DEBUG_FAT, "%s: pid %u request_times %d", - __func__, getpid(), - httpd->request_times)); - /* if we've handled 5 files, exit and let someone else work */ - if (httpd->request_times > 5 || - (httpd->background == 2 && httpd->request_times > 0)) - _exit(0); - -#if 1 - if (httpd->request_times > 0) - _exit(0); -#endif - - while (httpd->background) { - struct sockaddr_storage ss; - socklen_t slen; - int fd; - - if (httpd->nsock == 0) - exit(0); - - /* - * wait for a connection, then fork() and return NULL in - * the parent, who will come back here waiting for another - * connection. read the request in in the child, and return - * it, for processing. - */ -again: - if (poll(httpd->fds, (unsigned)httpd->nsock, INFTIM) == -1) { - /* fail on programmer errors */ - if (errno == EFAULT || - errno == EINVAL) - bozo_err(httpd, 1, "poll: %s", - strerror(errno)); - - /* sleep on some temporary kernel failures */ - if (errno == ENOMEM || - errno == EAGAIN) - sleep(1); - - goto again; - } - - for (i = 0; i < httpd->nsock; i++) { - if (daemon_poll_err(httpd, fd, i)) - break; - if (httpd->fds[i].revents == 0) - continue; - - slen = sizeof(ss); - fd = accept(httpd->fds[i].fd, - (struct sockaddr *)(void *)&ss, &slen); - if (fd == -1) { - if (errno == EFAULT || - errno == EINVAL) - bozo_err(httpd, 1, "accept: %s", - strerror(errno)); - - if (errno == ENOMEM || - errno == EAGAIN) - sleep(1); - - continue; - } - -#if 0 - /* - * This code doesn't work. It interacts very poorly - * with ~user translation and needs to be fixed. - */ - if (httpd->request_times > 0) { - daemon_runchild(httpd, fd); - return 0; - } -#endif - - switch (fork()) { - case -1: /* eep, failure */ - bozo_warn(httpd, "fork() failed, sleeping for " - "10 seconds: %s", strerror(errno)); - close(fd); - sleep(10); - break; - - case 0: /* child */ - daemon_runchild(httpd, fd); - return 0; - - default: /* parent */ - close(fd); - break; - } - } - } - return 0; -} - -#endif /* NO_DAEMON_MODE */ diff --git a/libexec/httpd/debug/Makefile b/libexec/httpd/debug/Makefile deleted file mode 100644 index 971b605f1..000000000 --- a/libexec/httpd/debug/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $eterna: Makefile,v 1.1 2009/05/22 21:51:39 mrg Exp $ - -# build a debug bozohttpd -PROG= bozohttpd-debug -COPTS+= -DDEBUG -I$(.CURDIR)/.. - -.include "../Makefile" - -.PATH: $(.CURDIR)/.. diff --git a/libexec/httpd/dir-index-bozo.c b/libexec/httpd/dir-index-bozo.c deleted file mode 100644 index 49989bfc8..000000000 --- a/libexec/httpd/dir-index-bozo.c +++ /dev/null @@ -1,212 +0,0 @@ -/* $NetBSD: dir-index-bozo.c,v 1.21 2015/08/27 17:12:18 mrg Exp $ */ - -/* $eterna: dir-index-bozo.c,v 1.20 2011/11/18 09:21:15 mrg Exp $ */ - -/* - * Copyright (c) 1997-2014 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer and - * dedication in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* this code implements directory index generation for bozohttpd */ - -#ifndef NO_DIRINDEX_SUPPORT - -#include - -#include -#include -#include -#include -#include -#include - -#include "bozohttpd.h" - -static void -directory_hr(bozohttpd_t *httpd) -{ - - bozo_printf(httpd, - "
    \r\n\r\n"); -} - -/* - * output a directory index. return 1 if it actually did something.. - */ -int -bozo_dir_index(bozo_httpreq_t *request, const char *dirpath, int isindex) -{ - bozohttpd_t *httpd = request->hr_httpd; - struct stat sb; - struct dirent **de, **deo; - struct tm *tm; - DIR *dp; - char buf[MAXPATHLEN]; - char spacebuf[48]; - char *file = NULL; - int l, k, j, i; - - if (!isindex || !httpd->dir_indexing) - return 0; - - if (strlen(dirpath) <= strlen(httpd->index_html)) - dirpath = "."; - else { - file = bozostrdup(httpd, dirpath); - - file[strlen(file) - strlen(httpd->index_html)] = '\0'; - dirpath = file; - } - debug((httpd, DEBUG_FAT, "bozo_dir_index: dirpath ``%s''", dirpath)); - if (stat(dirpath, &sb) < 0 || - (dp = opendir(dirpath)) == NULL) { - if (errno == EPERM) - (void)bozo_http_error(httpd, 403, request, - "no permission to open directory"); - else if (errno == ENOENT) - (void)bozo_http_error(httpd, 404, request, "no file"); - else - (void)bozo_http_error(httpd, 500, request, - "open directory"); - goto done; - /* NOTREACHED */ - } - - bozo_printf(httpd, "%s 200 OK\r\n", request->hr_proto); - - if (request->hr_proto != httpd->consts.http_09) { - bozo_print_header(request, NULL, "text/html", ""); - bozo_printf(httpd, "\r\n"); - } - bozo_flush(httpd, stdout); - - if (request->hr_method == HTTP_HEAD) { - closedir(dp); - goto done; - } - - bozo_printf(httpd, - "Index of %s\r\n", - request->hr_file); - bozo_printf(httpd, "

    Index of %s

    \r\n", - request->hr_file); - bozo_printf(httpd, "
    \r\n");
    -#define NAMELEN 40
    -#define LMODLEN 19
    -	bozo_printf(httpd, "Name                                     "
    -	    "Last modified          "
    -	    "Size\n");
    -	bozo_printf(httpd, "
    "); - directory_hr(httpd); - bozo_printf(httpd, "
    ");
    -
    -	for (j = k = scandir(dirpath, &de, NULL, alphasort), deo = de;
    -	    j--; de++) {
    -		int nostat = 0;
    -		char *name = (*de)->d_name;
    -		char *urlname, *htmlname;
    -
    -		if (strcmp(name, ".") == 0 ||
    -		    (strcmp(name, "..") != 0 &&
    -		     httpd->hide_dots && name[0] == '.'))
    -			continue;
    -
    -		snprintf(buf, sizeof buf, "%s/%s", dirpath, name);
    -		if (stat(buf, &sb))
    -			nostat = 1;
    -
    -		l = 0;
    -
    -		urlname = bozo_escape_rfc3986(httpd, name);
    -		htmlname = bozo_escape_html(httpd, name);
    -		if (htmlname == NULL)
    -			htmlname = name;
    -		if (strcmp(name, "..") == 0) {
    -			bozo_printf(httpd, "");
    -			l += bozo_printf(httpd, "Parent Directory");
    -		} else if (S_ISDIR(sb.st_mode)) {
    -			bozo_printf(httpd, "", urlname);
    -			l += bozo_printf(httpd, "%s/", htmlname);
    -		} else if (strchr(name, ':') != NULL) {
    -			/* RFC 3986 4.2 */
    -			bozo_printf(httpd, "", urlname);
    -			l += bozo_printf(httpd, "%s", htmlname);
    -		} else {
    -			bozo_printf(httpd, "", urlname);
    -			l += bozo_printf(httpd, "%s", htmlname);
    -		}
    -		if (htmlname != name)
    -			free(htmlname);
    -		bozo_printf(httpd, "");
    -
    -		/* NAMELEN spaces */
    -		/*LINTED*/
    -		assert(/*CONSTCOND*/sizeof(spacebuf) > NAMELEN);
    -		i = (l < NAMELEN) ? (NAMELEN - l) : 0;
    -		i++;
    -		memset(spacebuf, ' ', (size_t)i);
    -		spacebuf[i] = '\0';
    -		bozo_printf(httpd, "%s", spacebuf);
    -		l += i;
    -
    -		if (nostat)
    -			bozo_printf(httpd, "?                         ?");
    -		else {
    -			tm = gmtime(&sb.st_mtime);
    -			strftime(buf, sizeof buf, "%d-%b-%Y %R", tm);
    -			l += bozo_printf(httpd, "%s", buf);
    -
    -			/* LMODLEN spaces */
    -			/*LINTED*/
    -			assert(/*CONSTCOND*/sizeof(spacebuf) > LMODLEN);
    -			i = (l < (LMODLEN+NAMELEN+1)) ?
    -				((LMODLEN+NAMELEN+1) - l) : 0;
    -			i++;
    -			memset(spacebuf, ' ', (size_t)i);
    -			spacebuf[i] = '\0';
    -			bozo_printf(httpd, "%s", spacebuf);
    -
    -			bozo_printf(httpd, "%12llukB",
    -				    (unsigned long long)sb.st_size >> 10);
    -		}
    -		bozo_printf(httpd, "\r\n");
    -	}
    -
    -	closedir(dp);
    -	while (k--)
    -        	free(deo[k]);
    -	free(deo);
    -	bozo_printf(httpd, "
    "); - directory_hr(httpd); - bozo_printf(httpd, "\r\n\r\n"); - bozo_flush(httpd, stdout); - -done: - free(file); - return 1; -} -#endif /* NO_DIRINDEX_SUPPORT */ - diff --git a/libexec/httpd/libbozohttpd/Makefile b/libexec/httpd/libbozohttpd/Makefile deleted file mode 100644 index 5a9ad1825..000000000 --- a/libexec/httpd/libbozohttpd/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -# $eterna: Makefile,v 1.1 2010/05/10 02:24:31 mrg Exp $ - -.PATH: $(.CURDIR)/.. - -# build bozohttpd library -LIB= bozohttpd -COPTS+= -I$(.CURDIR)/.. - -COPTS+= -DDO_HTPASSWD -CPPFLAGS+= -DDO_HTPASSWD -SRCS= bozohttpd.c ssl-bozo.c auth-bozo.c cgi-bozo.c daemon-bozo.c -SRCS+= tilde-luzah-bozo.c dir-index-bozo.c content-bozo.c -SRCS+= lua-bozo.c - -LDADD= -lcrypt -DPADD= ${LIBCRYPT} - -MAN= libbozohttpd.3 -WARNS= 4 - -INCS= bozohttpd.h -INCSDIR= /usr/include - -.include - -.if ${MKCRYPTO} != "no" - -LDADD+= -lssl -lcrypto -DPADD+= ${LIBSSL} ${LIBCRYPTO} - -.else - -COPTS+= -DNO_SSL_SUPPORT - -.endif - -.include diff --git a/libexec/httpd/libbozohttpd/libbozohttpd.3 b/libexec/httpd/libbozohttpd/libbozohttpd.3 deleted file mode 100644 index 77c13f6f0..000000000 --- a/libexec/httpd/libbozohttpd/libbozohttpd.3 +++ /dev/null @@ -1,143 +0,0 @@ -.\" $NetBSD: libbozohttpd.3,v 1.3 2014/03/18 18:20:38 riastradh Exp $ -.\" -.\" $eterna: libbozohttpd.3,v 1.2 2010/05/10 02:48:23 mrg Exp $ -.\" -.\" Copyright (c) 2009 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This manual page is derived from software contributed to The -.\" NetBSD Foundation by Alistair Crooks (agc@NetBSD.org) -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd November 5, 2009 -.Dt LIBBOZOHTTPD 3 -.Os -.Sh NAME -.Nm libbozohttpd -.Nd embedded web server library -.Sh LIBRARY -.Lb libbozohttpd -.Sh SYNOPSIS -.In bozohttpd.h -.Ft int -.Fo bozo_set_pref -.Fa "bozoprefs_t *prefs" "char *name" "char *value" -.Fc -.Ft char * -.Fo bozo_get_pref -.Fa "bozoprefs_t *prefs" "char *name" -.Fc -.Ft int -.Fo bozo_set_defaults -.Fa "bozohttpd_t *httpd" "bozoprefs_t *prefs" -.Fc -.Ft void -.Fo bozo_setup -.Fa "bozohttpd_t *httpd" "bozoprefs_t *prefs" "const char *vhost" "char *slash" -.Fc -.Ft bozo_httpreq_t * -.Fo bozo_read_request -.Fa "bozohttpd_t *httpd" -.Fc -.Ft void -.Fo bozo_process_request -.Fa "bozo_httpreq_t *" -.Fc -.Ft void -.Fo bozo_clean_request -.Fa "bozo_httpreq_t *" -.Fc -.Sh DESCRIPTION -.Nm -is a library interface to the -.Xr bozohttpd 8 -web server. -The -.Nm -library can be used to embed a webserver -in your applications. -.Pp -Normal operation sees the -.Nm -process be initialised using the -.Fn bozo_set_defaults -function, which will set up the default port -and other internal settings, allocating -any necessary space as needed. -The -.Fn bozo_set_defaults -function returns 1 on sucess, 0 on failure. -.Pp -The -.Fn bozo_setup -function is used to specify the virtual host name -for the web server. -A NULL host name will mean that -.Nm -will use the local value for the host name, -as returned by -.Xr gethostname 3 . -This virtual hostname should be a fully qualified domain name. -The final argument to -.Fn bozo_setup -is the name of the directory to serve as the root -directory of the web server tree. -.Pp -Once the server has been set up, it serves -requests by using the -.Fn bozo_read_request -function, which returns a pointer to a request structure, -and -.Fn bozo_process_request , -which deals with the request, and answers the client. -The request space is de-allocated -using the -.Fn bozo_clean_request -function. -.Pp -Preferences are set -using the function -.Fn bozo_set_pref -function -and queried using the two -.Fn bozo_get_pref -function. -This is the main interface for selecting options, and for -setting preferences. -.Sh SEE ALSO -.Xr gethostname 3 , -.Xr ssl 3 , -.Xr services 5 , -.Xr httpd 8 -.Sh HISTORY -The -.Nm -library first appeared in -.Nx 6.0 . -.Sh AUTHORS -.An Matthew R. Green Aq Mt mrg@eterna.com.au -.An Alistair Crooks Aq Mt agc@NetBSD.org -wrote this high-level interface. -.Pp -This manual page was written by -.An Alistair Crooks . diff --git a/libexec/httpd/libbozohttpd/shlib_version b/libexec/httpd/libbozohttpd/shlib_version deleted file mode 100644 index 97c9f92d6..000000000 --- a/libexec/httpd/libbozohttpd/shlib_version +++ /dev/null @@ -1,2 +0,0 @@ -major=0 -minor=0 diff --git a/libexec/httpd/lua-bozo.c b/libexec/httpd/lua-bozo.c deleted file mode 100644 index 972c130bc..000000000 --- a/libexec/httpd/lua-bozo.c +++ /dev/null @@ -1,452 +0,0 @@ -/* $NetBSD: lua-bozo.c,v 1.12 2015/07/04 22:39:23 christos Exp $ */ - -/* - * Copyright (c) 2013 Marc Balmer - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer and - * dedication in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* this code implements dynamic content generation using Lua for bozohttpd */ - -#ifndef NO_LUA_SUPPORT - -#include - -#include -#include -#include -#include -#include -#include - -#include "bozohttpd.h" - -/* Lua binding for bozohttp */ - -#if LUA_VERSION_NUM < 502 -#define LUA_HTTPDLIBNAME "httpd" -#endif - -#define FORM "application/x-www-form-urlencoded" - -static int -lua_flush(lua_State *L) -{ - bozohttpd_t *httpd; - - lua_pushstring(L, "bozohttpd"); - lua_gettable(L, LUA_REGISTRYINDEX); - httpd = lua_touserdata(L, -1); - lua_pop(L, 1); - - bozo_flush(httpd, stdout); - return 0; -} - -static int -lua_print(lua_State *L) -{ - bozohttpd_t *httpd; - - lua_pushstring(L, "bozohttpd"); - lua_gettable(L, LUA_REGISTRYINDEX); - httpd = lua_touserdata(L, -1); - lua_pop(L, 1); - - bozo_printf(httpd, "%s\r\n", lua_tostring(L, -1)); - return 0; -} - -static int -lua_read(lua_State *L) -{ - bozohttpd_t *httpd; - int n, len; - char *data; - - lua_pushstring(L, "bozohttpd"); - lua_gettable(L, LUA_REGISTRYINDEX); - httpd = lua_touserdata(L, -1); - lua_pop(L, 1); - - len = luaL_checkinteger(L, -1); - data = bozomalloc(httpd, len + 1); - n = bozo_read(httpd, STDIN_FILENO, data, len); - if (n >= 0) { - data[n] = '\0'; - lua_pushstring(L, data); - } else - lua_pushnil(L); - free(data); - return 1; -} - -static int -lua_register_handler(lua_State *L) -{ - lua_state_map_t *map; - lua_handler_t *handler; - bozohttpd_t *httpd; - - lua_pushstring(L, "lua_state_map"); - lua_gettable(L, LUA_REGISTRYINDEX); - map = lua_touserdata(L, -1); - lua_pushstring(L, "bozohttpd"); - lua_gettable(L, LUA_REGISTRYINDEX); - httpd = lua_touserdata(L, -1); - lua_pop(L, 2); - - luaL_checkstring(L, 1); - luaL_checktype(L, 2, LUA_TFUNCTION); - - handler = bozomalloc(httpd, sizeof(lua_handler_t)); - - handler->name = bozostrdup(httpd, lua_tostring(L, 1)); - handler->ref = luaL_ref(L, LUA_REGISTRYINDEX); - SIMPLEQ_INSERT_TAIL(&map->handlers, handler, h_next); - httpd->process_lua = 1; - return 0; -} - -static int -lua_write(lua_State *L) -{ - bozohttpd_t *httpd; - const char *data; - - lua_pushstring(L, "bozohttpd"); - lua_gettable(L, LUA_REGISTRYINDEX); - httpd = lua_touserdata(L, -1); - lua_pop(L, 1); - - data = luaL_checkstring(L, -1); - lua_pushinteger(L, bozo_write(httpd, STDIN_FILENO, data, strlen(data))); - return 1; -} - -static int -luaopen_httpd(lua_State *L) -{ - struct luaL_Reg functions[] = { - { "flush", lua_flush }, - { "print", lua_print }, - { "read", lua_read }, - { "register_handler", lua_register_handler }, - { "write", lua_write }, - { NULL, NULL } - }; -#if LUA_VERSION_NUM >= 502 - luaL_newlib(L, functions); -#else - luaL_register(L, LUA_HTTPDLIBNAME, functions); -#endif - lua_pushstring(L, "httpd 1.0.0"); - lua_setfield(L, -2, "_VERSION"); - return 1; -} - -#if LUA_VERSION_NUM < 502 -static void -lua_openlib(lua_State *L, const char *name, lua_CFunction fn) -{ - lua_pushcfunction(L, fn); - lua_pushstring(L, name); - lua_call(L, 1, 0); -} -#endif - -/* bozohttpd integration */ -void -bozo_add_lua_map(bozohttpd_t *httpd, const char *prefix, const char *script) -{ - lua_state_map_t *map; - - map = bozomalloc(httpd, sizeof(lua_state_map_t)); - map->prefix = bozostrdup(httpd, prefix); - if (*script == '/') - map->script = bozostrdup(httpd, script); - else { - char cwd[MAXPATHLEN], *path; - - getcwd(cwd, sizeof(cwd) - 1); - asprintf(&path, "%s/%s", cwd, script); - map->script = path; - } - map->L = luaL_newstate(); - if (map->L == NULL) - bozo_err(httpd, 1, "can't create Lua state"); - SIMPLEQ_INIT(&map->handlers); - -#if LUA_VERSION_NUM >= 502 - luaL_openlibs(map->L); - lua_getglobal(map->L, "package"); - lua_getfield(map->L, -1, "preload"); - lua_pushcfunction(map->L, luaopen_httpd); - lua_setfield(map->L, -2, "httpd"); - lua_pop(map->L, 2); -#else - lua_openlib(map->L, "", luaopen_base); - lua_openlib(map->L, LUA_LOADLIBNAME, luaopen_package); - lua_openlib(map->L, LUA_TABLIBNAME, luaopen_table); - lua_openlib(map->L, LUA_STRLIBNAME, luaopen_string); - lua_openlib(map->L, LUA_MATHLIBNAME, luaopen_math); - lua_openlib(map->L, LUA_OSLIBNAME, luaopen_os); - lua_openlib(map->L, LUA_IOLIBNAME, luaopen_io); - lua_openlib(map->L, LUA_HTTPDLIBNAME, luaopen_httpd); -#endif - lua_pushstring(map->L, "lua_state_map"); - lua_pushlightuserdata(map->L, map); - lua_settable(map->L, LUA_REGISTRYINDEX); - - lua_pushstring(map->L, "bozohttpd"); - lua_pushlightuserdata(map->L, httpd); - lua_settable(map->L, LUA_REGISTRYINDEX); - - if (luaL_loadfile(map->L, script)) - bozo_err(httpd, 1, "failed to load script %s: %s", script, - lua_tostring(map->L, -1)); - if (lua_pcall(map->L, 0, 0, 0)) - bozo_err(httpd, 1, "failed to execute script %s: %s", script, - lua_tostring(map->L, -1)); - SIMPLEQ_INSERT_TAIL(&httpd->lua_states, map, s_next); -} - -static void -lua_env(lua_State *L, const char *name, const char *value) -{ - lua_pushstring(L, value); - lua_setfield(L, -2, name); -} - -/* decode query string */ -static void -lua_url_decode(lua_State *L, char *s) -{ - char *v, *p, *val, *q; - char buf[3]; - int c; - - v = strchr(s, '='); - if (v == NULL) - return; - *v++ = '\0'; - val = malloc(strlen(v) + 1); - if (val == NULL) - return; - - for (p = v, q = val; *p; p++) { - switch (*p) { - case '%': - if (*(p + 1) == '\0' || *(p + 2) == '\0') { - free(val); - return; - } - buf[0] = *++p; - buf[1] = *++p; - buf[2] = '\0'; - sscanf(buf, "%2x", &c); - *q++ = (char)c; - break; - case '+': - *q++ = ' '; - break; - default: - *q++ = *p; - } - } - *q = '\0'; - lua_pushstring(L, val); - lua_setfield(L, -2, s); - free(val); -} - -static void -lua_decode_query(lua_State *L, char *query) -{ - char *s; - - s = strtok(query, "&"); - while (s) { - lua_url_decode(L, s); - s = strtok(NULL, "&"); - } -} - -int -bozo_process_lua(bozo_httpreq_t *request) -{ - bozohttpd_t *httpd = request->hr_httpd; - lua_state_map_t *map; - lua_handler_t *hndlr; - int n, ret, length; - char date[40]; - bozoheaders_t *headp; - char *s, *query, *uri, *file, *command, *info, *content; - const char *type, *clen; - char *prefix, *handler, *p; - int rv = 0; - - if (!httpd->process_lua) - return 0; - - info = NULL; - query = NULL; - prefix = NULL; - uri = request->hr_oldfile ? request->hr_oldfile : request->hr_file; - - if (*uri == '/') { - file = bozostrdup(httpd, uri); - if (file == NULL) - goto out; - prefix = bozostrdup(httpd, &uri[1]); - } else { - if (asprintf(&file, "/%s", uri) < 0) - goto out; - prefix = bozostrdup(httpd, uri); - } - if (prefix == NULL) - goto out; - - if (request->hr_query && request->hr_query[0]) - query = bozostrdup(httpd, request->hr_query); - - p = strchr(prefix, '/'); - if (p == NULL) - goto out; - *p++ = '\0'; - handler = p; - if (!*handler) - goto out; - p = strchr(handler, '/'); - if (p != NULL) - *p++ = '\0'; - - command = file + 1; - if ((s = strchr(command, '/')) != NULL) { - info = bozostrdup(httpd, s); - *s = '\0'; - } - - type = request->hr_content_type; - clen = request->hr_content_length; - - SIMPLEQ_FOREACH(map, &httpd->lua_states, s_next) { - if (strcmp(map->prefix, prefix)) - continue; - - SIMPLEQ_FOREACH(hndlr, &map->handlers, h_next) { - if (strcmp(hndlr->name, handler)) - continue; - - lua_rawgeti(map->L, LUA_REGISTRYINDEX, hndlr->ref); - - /* Create the "environment" */ - lua_newtable(map->L); - lua_env(map->L, "SERVER_NAME", - BOZOHOST(httpd, request)); - lua_env(map->L, "GATEWAY_INTERFACE", "Luigi/1.0"); - lua_env(map->L, "SERVER_PROTOCOL", request->hr_proto); - lua_env(map->L, "REQUEST_METHOD", - request->hr_methodstr); - lua_env(map->L, "SCRIPT_PREFIX", map->prefix); - lua_env(map->L, "SCRIPT_NAME", file); - lua_env(map->L, "HANDLER_NAME", hndlr->name); - lua_env(map->L, "SCRIPT_FILENAME", map->script); - lua_env(map->L, "SERVER_SOFTWARE", - httpd->server_software); - lua_env(map->L, "REQUEST_URI", uri); - lua_env(map->L, "DATE_GMT", - bozo_http_date(date, sizeof(date))); - if (query && *query) - lua_env(map->L, "QUERY_STRING", query); - if (info && *info) - lua_env(map->L, "PATH_INFO", info); - if (type && *type) - lua_env(map->L, "CONTENT_TYPE", type); - if (clen && *clen) - lua_env(map->L, "CONTENT_LENGTH", clen); - if (request->hr_serverport && *request->hr_serverport) - lua_env(map->L, "SERVER_PORT", - request->hr_serverport); - if (request->hr_remotehost && *request->hr_remotehost) - lua_env(map->L, "REMOTE_HOST", - request->hr_remotehost); - if (request->hr_remoteaddr && *request->hr_remoteaddr) - lua_env(map->L, "REMOTE_ADDR", - request->hr_remoteaddr); - - /* Pass the headers in a separate table */ - lua_newtable(map->L); - SIMPLEQ_FOREACH(headp, &request->hr_headers, h_next) - lua_env(map->L, headp->h_header, - headp->h_value); - - /* Pass the query variables */ - if ((query && *query) || - (type && *type && !strcmp(type, FORM))) { - lua_newtable(map->L); - if (query && *query) - lua_decode_query(map->L, query); - if (type && *type && !strcmp(type, FORM)) { - if (clen && *clen && atol(clen) > 0) { - length = atol(clen); - content = bozomalloc(httpd, - length + 1); - n = bozo_read(httpd, - STDIN_FILENO, content, - length); - if (n >= 0) { - content[n] = '\0'; - lua_decode_query(map->L, - content); - } else { - lua_pop(map->L, 1); - lua_pushnil(map->L); - } - free(content); - } - } - } else - lua_pushnil(map->L); - - ret = lua_pcall(map->L, 3, 0, 0); - if (ret) - printf("
    Lua error: %s\n", - lua_tostring(map->L, -1)); - bozo_flush(httpd, stdout); - rv = 1; - goto out; - } - } -out: - free(prefix); - free(uri); - free(info); - free(query); - free(file); - return rv; -} - -#endif /* NO_LUA_SUPPORT */ diff --git a/libexec/httpd/lua/Makefile b/libexec/httpd/lua/Makefile deleted file mode 100644 index 448fa7194..000000000 --- a/libexec/httpd/lua/Makefile +++ /dev/null @@ -1,39 +0,0 @@ -#PREFIX=/Users/agcrooks -PREFIX=/usr - -#LIBDIR=/usr/lib - -LIB=luabozohttpd -SRCS=glue.c -MKMAN=no -CPPFLAGS+=-g -I${PREFIX}/pkg/include -LDADD+= -lbozohttpd -WARNS=4 -CLEANFILES+= a a.sig - -.include -.include - -LUABOZOOBJDIR != cd ${.CURDIR} && ${PRINTOBJDIR} - -OPSYS!= uname -s - -.if ${OPSYS} == "Darwin" -.sinclude - -lib${LIB}.dylib: - libtool -dynamic -o ${.TARGET} ${OBJS} ${PREFIX}/pkg/lib/liblua.dylib /usr/lib/libc.dylib ${PREFIX}/pkg/lib/libbozohttpd.dylib - -t: lib${LIB}.dylib - cp Makefile a - ./bozo.lua --sign --detached a - ./bozo.lua --verify a.sig - -.else -t: - cp Makefile a - env LD_LIBRARY_PATH=${LUABOZOOBJDIR}:/lib:/usr/lib:${PREFIX}/lib \ - ./bozo.lua --sign --detached a - env LD_LIBRARY_PATH=${LUABOZOOBJDIR}:/lib:/usr/lib:${PREFIX}/lib \ - ./bozo.lua --verify a.sig -.endif diff --git a/libexec/httpd/lua/optparse.lua b/libexec/httpd/lua/optparse.lua deleted file mode 100644 index da9b62a16..000000000 --- a/libexec/httpd/lua/optparse.lua +++ /dev/null @@ -1,123 +0,0 @@ --- Lua command line option parser. --- Interface based on Pythons optparse. --- http://docs.python.org/lib/module-optparse.html --- (c) 2008 David Manura, Licensed under the same terms as Lua (MIT license) --- --- To be used like this: --- t={usage="", version=""} --- op=OptionParser(t) --- op=add_option{"", action=, dest=, help=""} --- --- with : --- the option string to be used (can be anything, if one letter opt, then should be -x val, more letters: -xy=val ) --- one of --- - store: store in options as key, val --- - store_true: stores key, true --- - store_false: stores key, false --- is the key under which the option is saved --- --- options,args = op.parse_args() --- --- now options is the table of options (key, val) and args is the table with non-option arguments. --- You can use op.fail(message) for failing and op.print_help() for printing the usage as you like. - -function OptionParser(t) - local usage = t.usage - local version = t.version - - local o = {} - local option_descriptions = {} - local option_of = {} - - function o.fail(s) -- extension - io.stderr:write(s .. '\n') - os.exit(1) - end - - function o.add_option(optdesc) - option_descriptions[#option_descriptions+1] = optdesc - for _,v in ipairs(optdesc) do - option_of[v] = optdesc - end - end - function o.parse_args() - -- expand options (e.g. "--input=file" -> "--input", "file") - local arg = {unpack(arg)} - for i=#arg,1,-1 do local v = arg[i] - local flag, val = v:match('^(%-%-%w+)=(.*)') - if flag then - arg[i] = flag - table.insert(arg, i+1, val) - end - end - - local options = {} - local args = {} - local i = 1 - while i <= #arg do local v = arg[i] - local optdesc = option_of[v] - if optdesc then - local action = optdesc.action - local val - if action == 'store' or action == nil then - i = i + 1 - val = arg[i] - if not val then o.fail('option requires an argument ' .. v) end - elseif action == 'store_true' then - val = true - elseif action == 'store_false' then - val = false - end - options[optdesc.dest] = val - else - if v:match('^%-') then o.fail('invalid option ' .. v) end - args[#args+1] = v - end - i = i + 1 - end - if options.help then - o.print_help() - os.exit() - end - if options.version then - io.stdout:write(t.version .. "\n") - os.exit() - end - return options, args - end - - local function flags_str(optdesc) - local sflags = {} - local action = optdesc.action - for _,flag in ipairs(optdesc) do - local sflagend - if action == nil or action == 'store' then - local metavar = optdesc.metavar or optdesc.dest:upper() - sflagend = #flag == 2 and ' ' .. metavar - or '=' .. metavar - else - sflagend = '' - end - sflags[#sflags+1] = flag .. sflagend - end - return table.concat(sflags, ', ') - end - - function o.print_help() - io.stdout:write("Usage: " .. usage:gsub('%%prog', arg[0]) .. "\n") - io.stdout:write("\n") - io.stdout:write("Options:\n") - for _,optdesc in ipairs(option_descriptions) do - io.stdout:write(" " .. flags_str(optdesc) .. - " " .. optdesc.help .. "\n") - end - end - o.add_option{"--help", action="store_true", dest="help", - help="show this help message and exit"} - if t.version then - o.add_option{"--version", action="store_true", dest="version", - help="output version info."} - end - return o -end - diff --git a/libexec/httpd/lua/shlib_version b/libexec/httpd/lua/shlib_version deleted file mode 100644 index 97c9f92d6..000000000 --- a/libexec/httpd/lua/shlib_version +++ /dev/null @@ -1,2 +0,0 @@ -major=0 -minor=0 diff --git a/libexec/httpd/main.c b/libexec/httpd/main.c deleted file mode 100644 index 348628bf6..000000000 --- a/libexec/httpd/main.c +++ /dev/null @@ -1,356 +0,0 @@ -/* $NetBSD: main.c,v 1.8 2014/07/16 07:41:43 mrg Exp $ */ - -/* $eterna: main.c,v 1.6 2011/11/18 09:21:15 mrg Exp $ */ -/* from: eterna: bozohttpd.c,v 1.159 2009/05/23 02:14:30 mrg Exp */ - -/* - * Copyright (c) 1997-2014 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer and - * dedication in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* this program is dedicated to the Great God of Processed Cheese */ - -/* - * main.c: C front end to bozohttpd - */ - -#include -#include - -#include -#include -#include -#include -#include -#include - -#include "bozohttpd.h" - -/* variables and functions */ -#ifndef LOG_FTP -#define LOG_FTP LOG_DAEMON -#endif - -/* print a usage message, and then exit */ -BOZO_DEAD static void -usage(bozohttpd_t *httpd, char *progname) -{ - bozo_warn(httpd, "usage: %s [options] slashdir [virtualhostname]", - progname); - bozo_warn(httpd, "options:"); -#ifndef NO_DEBUG - bozo_warn(httpd, " -d\t\t\tenable debug support"); -#endif - bozo_warn(httpd, " -s\t\t\talways log to stderr"); -#ifndef NO_USER_SUPPORT - bozo_warn(httpd, " -u\t\t\tenable ~user/public_html support"); - bozo_warn(httpd, " -p dir\t\tchange `public_html' directory name]"); -#endif -#ifndef NO_DYNAMIC_CONTENT - bozo_warn(httpd, " -M arg t c c11\tadd this mime extenstion"); -#endif -#ifndef NO_CGIBIN_SUPPORT -#ifndef NO_DYNAMIC_CONTENT - bozo_warn(httpd, " -C arg prog\t\tadd this CGI handler"); -#endif - bozo_warn(httpd, - " -c cgibin\t\tenable cgi-bin support in this directory"); -#endif -#ifndef NO_LUA_SUPPORT - bozo_warn(httpd, " -L arg script\tadd this Lua script"); -#endif - bozo_warn(httpd, " -I port\t\tbind or use on this port"); -#ifndef NO_DAEMON_MODE - bozo_warn(httpd, " -b\t\t\tbackground and go into daemon mode"); - bozo_warn(httpd, " -f\t\t\tkeep daemon mode in the foreground"); - bozo_warn(httpd, - " -i address\t\tbind on this address (daemon mode only)"); - bozo_warn(httpd, " -P pidfile\t\tpath to the pid file to create"); -#endif - bozo_warn(httpd, " -S version\t\tset server version string"); - bozo_warn(httpd, " -t dir\t\tchroot to `dir'"); - bozo_warn(httpd, " -U username\t\tchange user to `user'"); - bozo_warn(httpd, - " -e\t\t\tdon't clean the environment (-t and -U only)"); - bozo_warn(httpd, - " -v virtualroot\tenable virtual host support " - "in this directory"); - bozo_warn(httpd, - " -r\t\t\tmake sure sub-pages come from " - "this host via referrer"); -#ifndef NO_DIRINDEX_SUPPORT - bozo_warn(httpd, - " -X\t\t\tenable automatic directory index support"); - bozo_warn(httpd, - " -H\t\t\thide files starting with a period (.)" - " in index mode"); -#endif - bozo_warn(httpd, - " -x index\t\tchange default `index.html' file name"); -#ifndef NO_SSL_SUPPORT - bozo_warn(httpd, - " -Z cert privkey\tspecify path to server certificate" - " and private key file\n" - "\t\t\tin pem format and enable bozohttpd in SSL mode"); -#endif /* NO_SSL_SUPPORT */ - bozo_err(httpd, 1, "%s failed to start", progname); -} - -int -main(int argc, char **argv) -{ - bozo_httpreq_t *request; - bozohttpd_t httpd; - bozoprefs_t prefs; - char *progname; - int c; - - (void) memset(&httpd, 0x0, sizeof(httpd)); - (void) memset(&prefs, 0x0, sizeof(prefs)); - - if ((progname = strrchr(argv[0], '/')) == NULL) - progname = argv[0]; - else - progname++; - - openlog(progname, LOG_PID|LOG_NDELAY, LOG_FTP); - - bozo_set_defaults(&httpd, &prefs); - - while ((c = getopt(argc, argv, - "C:HI:L:M:P:S:U:VXZ:bc:defhi:np:rst:uv:x:z:")) != -1) { - switch(c) { - - case 'L': -#ifdef NO_LUA_SUPPORT - bozo_err(&httpd, 1, - "Lua support is not enabled"); - /* NOTREACHED */ -#else - /* make sure there's two argument */ - if (argc - optind < 1) - usage(&httpd, progname); - bozo_add_lua_map(&httpd, optarg, argv[optind]); - optind++; - break; -#endif /* NO_LUA_SUPPORT */ - case 'M': -#ifdef NO_DYNAMIC_CONTENT - bozo_err(&httpd, 1, - "dynamic mime content support is not enabled"); - /* NOTREACHED */ -#else - /* make sure there's four arguments */ - if (argc - optind < 3) - usage(&httpd, progname); - bozo_add_content_map_mime(&httpd, optarg, argv[optind], - argv[optind+1], argv[optind+2]); - optind += 3; - break; -#endif /* NO_DYNAMIC_CONTENT */ - - case 'n': - bozo_set_pref(&prefs, "numeric", "true"); - break; - - case 'r': - bozo_set_pref(&prefs, "trusted referal", "true"); - break; - - case 's': - bozo_set_pref(&prefs, "log to stderr", "true"); - break; - - case 'S': - bozo_set_pref(&prefs, "server software", optarg); - break; - case 'Z': -#ifdef NO_SSL_SUPPORT - bozo_err(&httpd, 1, "ssl support is not enabled"); - /* NOT REACHED */ -#else - /* make sure there's two arguments */ - if (argc - optind < 1) - usage(&httpd, progname); - bozo_ssl_set_opts(&httpd, optarg, argv[optind++]); - break; -#endif /* NO_SSL_SUPPORT */ - case 'U': - bozo_set_pref(&prefs, "username", optarg); - break; - - case 'V': - bozo_set_pref(&prefs, "unknown slash", "true"); - break; - - case 'v': - bozo_set_pref(&prefs, "virtual base", optarg); - break; - - case 'x': - bozo_set_pref(&prefs, "index.html", optarg); - break; - - case 'I': - bozo_set_pref(&prefs, "port number", optarg); - break; - -#ifdef NO_DAEMON_MODE - case 'b': - case 'e': - case 'f': - case 'i': - case 'P': - bozo_err(&httpd, 1, "Daemon mode is not enabled"); - /* NOTREACHED */ -#else - case 'b': - /* - * test suite support - undocumented - * background == 2 (aka, -b -b) means to - * only process 1 per kid - */ - if (bozo_get_pref(&prefs, "background") == NULL) { - bozo_set_pref(&prefs, "background", "1"); - } else { - bozo_set_pref(&prefs, "background", "2"); - } - break; - - case 'e': - bozo_set_pref(&prefs, "dirty environment", "true"); - break; - - case 'f': - bozo_set_pref(&prefs, "foreground", "true"); - break; - - case 'i': - bozo_set_pref(&prefs, "bind address", optarg); - break; - - case 'P': - bozo_set_pref(&prefs, "pid file", optarg); - break; -#endif /* NO_DAEMON_MODE */ - -#ifdef NO_CGIBIN_SUPPORT - case 'c': - case 'C': - bozo_err(&httpd, 1, "CGI is not enabled"); - /* NOTREACHED */ -#else - case 'c': - bozo_cgi_setbin(&httpd, optarg); - break; - - case 'C': -# ifdef NO_DYNAMIC_CONTENT - bozo_err(&httpd, 1, - "dynamic CGI handler support is not enabled"); - /* NOTREACHED */ -# else - /* make sure there's two arguments */ - if (argc - optind < 1) - usage(&httpd, progname); - bozo_add_content_map_cgi(&httpd, optarg, - argv[optind++]); - break; -# endif /* NO_DYNAMIC_CONTENT */ -#endif /* NO_CGIBIN_SUPPORT */ - - case 'd': - httpd.debug++; -#ifdef NO_DEBUG - if (httpd.debug == 1) - bozo_warn(&httpd, "Debugging is not enabled"); -#endif /* NO_DEBUG */ - break; - - case 't': - bozo_set_pref(&prefs, "chroot dir", optarg); - break; - -#ifdef NO_USER_SUPPORT - case 'p': - case 'u': - bozo_err(&httpd, 1, "User support is not enabled"); - /* NOTREACHED */ -#else - case 'p': - bozo_set_pref(&prefs, "public_html", optarg); - break; - - case 'u': - bozo_set_pref(&prefs, "enable users", "true"); - break; -#endif /* NO_USER_SUPPORT */ - -#ifdef NO_DIRINDEX_SUPPORT - case 'H': - case 'X': - bozo_err(&httpd, 1, - "directory indexing is not enabled"); - /* NOTREACHED */ -#else - case 'H': - bozo_set_pref(&prefs, "hide dots", "true"); - break; - - case 'X': - bozo_set_pref(&prefs, "directory indexing", "true"); - break; - -#endif /* NO_DIRINDEX_SUPPORT */ - - default: - usage(&httpd, progname); - /* NOTREACHED */ - } - } - - argc -= optind; - argv += optind; - - if (argc == 0 || argc > 2) { - usage(&httpd, progname); - } - - /* virtual host, and root of tree to serve */ - bozo_setup(&httpd, &prefs, argv[1], argv[0]); - - /* - * read and process the HTTP request. - */ - do { - if ((request = bozo_read_request(&httpd)) != NULL) { - bozo_process_request(request); - bozo_clean_request(request); - } - } while (httpd.background); - - return (0); -} diff --git a/libexec/httpd/printenv.lua b/libexec/httpd/printenv.lua deleted file mode 100644 index 5b0fdf9c6..000000000 --- a/libexec/httpd/printenv.lua +++ /dev/null @@ -1,85 +0,0 @@ --- $NetBSD: printenv.lua,v 1.2 2014/01/02 08:21:38 mrg Exp $ - --- this small Lua script demonstrates the use of Lua in (bozo)httpd --- it will simply output the "environment" - --- Keep in mind that bozohttpd forks for each request when started in --- daemon mode, you can set global veriables here, but they will have --- the same value on each invocation. You can not keep state between --- two calls. - -local httpd = require 'httpd' - -function printenv(env, headers, query) - - -- we get the "environment" in the env table, the values are more - -- or less the same as the variable for a CGI program - - if count == nil then - count = 1 - end - - -- output a header - print([[ - - - Bozotic Lua Environment - - -

    Bozotic Lua Environment

    - ]]) - - print('module version: ' .. httpd._VERSION .. '
    ') - - print('

    Server Environment

    ') - -- print the list of "environment" variables - for k, v in pairs(env) do - print(k .. '=' .. v .. '
    ') - end - - print('

    Request Headers

    ') - for k, v in pairs(headers) do - print(k .. '=' .. v .. '
    ') - end - - if query ~= nil then - print('

    Query Variables

    ') - for k, v in pairs(query) do - print(k .. '=' .. v .. '
    ') - end - end - - print('

    Form Test

    ') - - print([[ -
    - - -
    - ]]) - -- output a footer - print([[ - - - ]]) -end - -function form(env, header, query) - if query ~= nil then - print('

    Form Variables

    ') - - if env.CONTENT_TYPE ~= nil then - print('Content-type: ' .. env.CONTENT_TYPE .. '
    ') - end - - for k, v in pairs(query) do - print(k .. '=' .. v .. '
    ') - end - else - print('No values') - end -end - --- register this handler for http:////printenv -httpd.register_handler('printenv', printenv) -httpd.register_handler('form', form) diff --git a/libexec/httpd/small/Makefile b/libexec/httpd/small/Makefile deleted file mode 100644 index 3460e67f6..000000000 --- a/libexec/httpd/small/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# $eterna: Makefile,v 1.1 2009/05/22 21:51:39 mrg Exp $ - -# build a 100% lean bozohttpd-small.c -PROG= bozohttpd-small -NOMAN= # defined -SRCS= bozohttpd-small.c content-bozo-small.c ssl-bozo.c main.c: - -LEAN_IFDEF_FLAGS= -UDEBUG -DNO_USER_SUPPORT \ - -DNO_CGIBIN_SUPPORT -DNO_DIRINDEX_SUPPORT \ - -DNO_DAEMON_MODE -DNO_DYNAMIC_CONTENT \ - -DNO_SSL_SUPPORT -UDO_HTPASSWD \ - -DNO_LUA_SUPPORT - -CFLAGS= -I$(.CURDIR)/.. ${LEAN_IFDEF_FLAGS} - -bozohttpd-small.c: bozohttpd.c - unifdef $(LEAN_IFDEF_FLAGS) < $> > $@.tmp ;\ - if [ $$? -ne 1 ]; then echo "unifdef returned $?, expecting 1" 2>&1; false; fi - mv -f $@.tmp $@ - -content-bozo-small.c: content-bozo.c - unifdef $(LEAN_IFDEF_FLAGS) < $> > $@.tmp ;\ - if [ $$? -ne 1 ]; then echo "unifdef returned $?, expecting 1" 2>&1; false; fi - mv -f $@.tmp $@ - -CLEANFILES+= content-bozo-small.c bozohttpd-small.c - -.PATH: $(.CURDIR)/.. - -.include diff --git a/libexec/httpd/ssl-bozo.c b/libexec/httpd/ssl-bozo.c deleted file mode 100644 index 045a26e6d..000000000 --- a/libexec/httpd/ssl-bozo.c +++ /dev/null @@ -1,321 +0,0 @@ -/* $NetBSD: ssl-bozo.c,v 1.18 2014/07/17 06:27:52 mrg Exp $ */ - -/* $eterna: ssl-bozo.c,v 1.15 2011/11/18 09:21:15 mrg Exp $ */ - -/* - * Copyright (c) 1997-2014 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer and - * dedication in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* this code implements SSL and backend IO for bozohttpd */ - -#include -#include -#include -#include - -#include "bozohttpd.h" - -#ifndef NO_SSL_SUPPORT - -#include -#include - -#ifndef USE_ARG -#define USE_ARG(x) /*LINTED*/(void)&(x) -#endif - -/* this structure encapsulates the ssl info */ -typedef struct sslinfo_t { - SSL_CTX *ssl_context; - const SSL_METHOD *ssl_method; - SSL *bozossl; - char *certificate_file; - char *privatekey_file; -} sslinfo_t; - -/* - * bozo_clear_ssl_queue: print the contents of the SSL error queue - */ -static void -bozo_clear_ssl_queue(bozohttpd_t *httpd) -{ - unsigned long sslcode = ERR_get_error(); - - do { - static const char sslfmt[] = "SSL Error: %s:%s:%s"; - - if (httpd->logstderr || isatty(STDERR_FILENO)) { - fprintf(stderr, sslfmt, - ERR_lib_error_string(sslcode), - ERR_func_error_string(sslcode), - ERR_reason_error_string(sslcode)); - } else { - syslog(LOG_ERR, sslfmt, - ERR_lib_error_string(sslcode), - ERR_func_error_string(sslcode), - ERR_reason_error_string(sslcode)); - } - } while (0 != (sslcode = ERR_get_error())); -} - -/* - * bozo_ssl_warn works just like bozo_warn, plus the SSL error queue - */ -BOZO_PRINTFLIKE(2, 3) static void -bozo_ssl_warn(bozohttpd_t *httpd, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - if (httpd->logstderr || isatty(STDERR_FILENO)) { - vfprintf(stderr, fmt, ap); - fputs("\n", stderr); - } else - vsyslog(LOG_ERR, fmt, ap); - va_end(ap); - - bozo_clear_ssl_queue(httpd); -} - - -/* - * bozo_ssl_err works just like bozo_err, plus the SSL error queue - */ -BOZO_PRINTFLIKE(3, 4) BOZO_DEAD static void -bozo_ssl_err(bozohttpd_t *httpd, int code, const char *fmt, ...) -{ - va_list ap; - - va_start(ap, fmt); - if (httpd->logstderr || isatty(STDERR_FILENO)) { - vfprintf(stderr, fmt, ap); - fputs("\n", stderr); - } else - vsyslog(LOG_ERR, fmt, ap); - va_end(ap); - - bozo_clear_ssl_queue(httpd); - exit(code); -} - -/* - * bozo_check_error_queue: print warnings if the error isn't expected - */ -static void -bozo_check_error_queue(bozohttpd_t *httpd, const char *tag, int ret) -{ - if (ret > 0) - return; - - const sslinfo_t *sslinfo = httpd->sslinfo; - const int sslerr = SSL_get_error(sslinfo->bozossl, ret); - - if (sslerr != SSL_ERROR_ZERO_RETURN && - sslerr != SSL_ERROR_SYSCALL && - sslerr != SSL_ERROR_NONE) - bozo_ssl_warn(httpd, "%s: SSL_ERROR %d", tag, sslerr); -} - -static BOZO_PRINTFLIKE(2, 0) int -bozo_ssl_printf(bozohttpd_t *httpd, const char * fmt, va_list ap) -{ - char *buf; - int nbytes; - - if ((nbytes = vasprintf(&buf, fmt, ap)) != -1) { - const sslinfo_t *sslinfo = httpd->sslinfo; - int ret = SSL_write(sslinfo->bozossl, buf, nbytes); - bozo_check_error_queue(httpd, "write", ret); - } - - free(buf); - - return nbytes; -} - -static ssize_t -bozo_ssl_read(bozohttpd_t *httpd, int fd, void *buf, size_t nbytes) -{ - const sslinfo_t *sslinfo = httpd->sslinfo; - int ret; - - USE_ARG(fd); - ret = SSL_read(sslinfo->bozossl, buf, (int)nbytes); - bozo_check_error_queue(httpd, "read", ret); - - return (ssize_t)ret; -} - -static ssize_t -bozo_ssl_write(bozohttpd_t *httpd, int fd, const void *buf, size_t nbytes) -{ - const sslinfo_t *sslinfo = httpd->sslinfo; - int ret; - - USE_ARG(fd); - ret = SSL_write(sslinfo->bozossl, buf, (int)nbytes); - bozo_check_error_queue(httpd, "write", ret); - - return (ssize_t)ret; -} - -void -bozo_ssl_init(bozohttpd_t *httpd) -{ - sslinfo_t *sslinfo = httpd->sslinfo; - - if (sslinfo == NULL || !sslinfo->certificate_file) - return; - SSL_library_init(); - SSL_load_error_strings(); - - sslinfo->ssl_method = SSLv23_server_method(); - sslinfo->ssl_context = SSL_CTX_new(sslinfo->ssl_method); - - if (NULL == sslinfo->ssl_context) - bozo_ssl_err(httpd, EXIT_FAILURE, - "SSL context creation failed"); - - if (1 != SSL_CTX_use_certificate_chain_file(sslinfo->ssl_context, - sslinfo->certificate_file)) - bozo_ssl_err(httpd, EXIT_FAILURE, - "Unable to use certificate file '%s'", - sslinfo->certificate_file); - - if (1 != SSL_CTX_use_PrivateKey_file(sslinfo->ssl_context, - sslinfo->privatekey_file, SSL_FILETYPE_PEM)) - bozo_ssl_err(httpd, EXIT_FAILURE, - "Unable to use private key file '%s'", - sslinfo->privatekey_file); - - /* check consistency of key vs certificate */ - if (!SSL_CTX_check_private_key(sslinfo->ssl_context)) - bozo_ssl_err(httpd, EXIT_FAILURE, - "Check private key failed"); -} - -/* - * returns non-zero for failure - */ -int -bozo_ssl_accept(bozohttpd_t *httpd) -{ - sslinfo_t *sslinfo = httpd->sslinfo; - - if (sslinfo == NULL || !sslinfo->ssl_context) - return 0; - - sslinfo->bozossl = SSL_new(sslinfo->ssl_context); - if (sslinfo->bozossl == NULL) - bozo_err(httpd, 1, "SSL_new failed"); - - SSL_set_rfd(sslinfo->bozossl, 0); - SSL_set_wfd(sslinfo->bozossl, 1); - - const int ret = SSL_accept(sslinfo->bozossl); - bozo_check_error_queue(httpd, "accept", ret); - - return ret != 1; -} - -void -bozo_ssl_destroy(bozohttpd_t *httpd) -{ - const sslinfo_t *sslinfo = httpd->sslinfo; - - if (sslinfo && sslinfo->bozossl) - SSL_free(sslinfo->bozossl); -} - -void -bozo_ssl_set_opts(bozohttpd_t *httpd, const char *cert, const char *priv) -{ - sslinfo_t *sslinfo = httpd->sslinfo; - - if (sslinfo == NULL) { - sslinfo = bozomalloc(httpd, sizeof(*sslinfo)); - if (sslinfo == NULL) - bozo_err(httpd, 1, "sslinfo allocation failed"); - httpd->sslinfo = sslinfo; - } - sslinfo->certificate_file = strdup(cert); - sslinfo->privatekey_file = strdup(priv); - debug((httpd, DEBUG_NORMAL, "using cert/priv files: %s & %s", - sslinfo->certificate_file, - sslinfo->privatekey_file)); - if (!httpd->bindport) - httpd->bindport = strdup("https"); -} - -#endif /* NO_SSL_SUPPORT */ - -int -bozo_printf(bozohttpd_t *httpd, const char *fmt, ...) -{ - va_list args; - int cc; - - va_start(args, fmt); -#ifndef NO_SSL_SUPPORT - if (httpd->sslinfo) - cc = bozo_ssl_printf(httpd, fmt, args); - else -#endif - cc = vprintf(fmt, args); - va_end(args); - return cc; -} - -ssize_t -bozo_read(bozohttpd_t *httpd, int fd, void *buf, size_t len) -{ -#ifndef NO_SSL_SUPPORT - if (httpd->sslinfo) - return bozo_ssl_read(httpd, fd, buf, len); -#endif - return read(fd, buf, len); -} - -ssize_t -bozo_write(bozohttpd_t *httpd, int fd, const void *buf, size_t len) -{ -#ifndef NO_SSL_SUPPORT - if (httpd->sslinfo) - return bozo_ssl_write(httpd, fd, buf, len); -#endif - return write(fd, buf, len); -} - -int -bozo_flush(bozohttpd_t *httpd, FILE *fp) -{ -#ifndef NO_SSL_SUPPORT - if (httpd->sslinfo) - return 0; -#endif - return fflush(fp); -} diff --git a/libexec/httpd/testsuite/Makefile b/libexec/httpd/testsuite/Makefile deleted file mode 100644 index 1c64fa0b3..000000000 --- a/libexec/httpd/testsuite/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# $eterna: Makefile,v 1.14 2009/05/22 21:51:39 mrg Exp $ - -SIMPLETESTS= t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 -BIGFILETESTS= partial4000 partial8000 - -BOZOHTTPD?= ../bozohttpd -BOZOHTTPD?= ../debug/bozohttpd-debug -WGET?= wget - -all: - -clean: - for a in $(SIMPLETESTS); do \ - rm -f tmp.$$a.out; \ - done - -check: check-simple check-bigfile - -check-simple: -.for a in $(SIMPLETESTS) - echo "Running test $a" - $(BOZOHTTPD) ./data < $(.CURDIR)/$a.in > tmp.$a.out || true - $(.CURDIR)/html_cmp $(.CURDIR)/$a.out tmp.$a.out -.endfor - -check-bigfile: -.for a in $(BIGFILETESTS) - echo "Running test $a" - $(.CURDIR)/test-bigfile "$a" "${BOZOHTTPD}" "${WGET}" "./data" -.endfor - -.include diff --git a/libexec/httpd/testsuite/data/bigfile b/libexec/httpd/testsuite/data/bigfile deleted file mode 100644 index 812c4c3b3..000000000 --- a/libexec/httpd/testsuite/data/bigfile +++ /dev/null @@ -1,127 +0,0 @@ -this is the big data file. it has to be over 1 page size in length. 0123456789 -these lines are all 80 long. this is the second line. 012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -012345678901 this is the seventh line. 12345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -456789 this is the 13th line, and there 127 lines in total. 67890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -901234567890123456789012345 this is the 18th line. 456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -78901234567890123456 this is the 31st line. 345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -90123456789012345678901234567890123456789 this is the 38th line. 78901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -012345678901234567890123456 this is the 47th line. 4567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -789012345678901234567890123456789012345678901234567 50th 7890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -56789012 this is the 52nd line. 1234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012 54th 1234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345 this is the 60th line. 2345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -678901234 this is the 71st line. 12345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567 this is the 80th line. 567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456 this is the 93th line. 3456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456 this is the 101st line. 456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -123456789012345678901234567890123456789012345 this is the 106th line. 3456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -789012345678901234 110th 4567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -34567890123456789012345678 114th 9012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -67890123 this is the 121st line. 12345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -this is the last line. this is the end of the file. there is no more. good bye. diff --git a/libexec/httpd/testsuite/data/bigfile.partial4000 b/libexec/httpd/testsuite/data/bigfile.partial4000 deleted file mode 100644 index 5534f688a..000000000 --- a/libexec/httpd/testsuite/data/bigfile.partial4000 +++ /dev/null @@ -1,50 +0,0 @@ -this is the big data file. it has to be over 1 page size in length. 0123456789 -these lines are all 80 long. this is the second line. 012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -012345678901 this is the seventh line. 12345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -456789 this is the 13th line, and there 127 lines in total. 67890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -901234567890123456789012345 this is the 18th line. 456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -78901234567890123456 this is the 31st line. 345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -90123456789012345678901234567890123456789 this is the 38th line. 78901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -012345678901234567890123456 this is the 47th line. 4567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -789012345678901234567890123456789012345678901234567 50th 7890123456789012345 diff --git a/libexec/httpd/testsuite/data/bigfile.partial8000 b/libexec/httpd/testsuite/data/bigfile.partial8000 deleted file mode 100644 index 372d38907..000000000 --- a/libexec/httpd/testsuite/data/bigfile.partial8000 +++ /dev/null @@ -1,100 +0,0 @@ -this is the big data file. it has to be over 1 page size in length. 0123456789 -these lines are all 80 long. this is the second line. 012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -012345678901 this is the seventh line. 12345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -456789 this is the 13th line, and there 127 lines in total. 67890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -901234567890123456789012345 this is the 18th line. 456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -78901234567890123456 this is the 31st line. 345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -90123456789012345678901234567890123456789 this is the 38th line. 78901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -012345678901234567890123456 this is the 47th line. 4567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -789012345678901234567890123456789012345678901234567 50th 7890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -56789012 this is the 52nd line. 1234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012 54th 1234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345 this is the 60th line. 2345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -678901234 this is the 71st line. 12345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567 this is the 80th line. 567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456789012345678901234567890123456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 -6789012345678901234567890123456789012345678901234567890123456789012345678901234 -5678901234567890123456789012345678901234567890123456789012345678901234567890123 -4567890123456 this is the 93th line. 3456789012345678901234567890123456789012 -3456789012345678901234567890123456789012345678901234567890123456789012345678901 -2345678901234567890123456789012345678901234567890123456789012345678901234567890 -1234567890123456789012345678901234567890123456789012345678901234567890123456789 -0123456789012345678901234567890123456789012345678901234567890123456789012345678 -9012345678901234567890123456789012345678901234567890123456789012345678901234567 -8901234567890123456789012345678901234567890123456789012345678901234567890123456 -7890123456789012345678901234567890123456789012345678901234567890123456789012345 diff --git a/libexec/httpd/testsuite/data/file b/libexec/httpd/testsuite/data/file deleted file mode 100644 index 4e03184fb..000000000 --- a/libexec/httpd/testsuite/data/file +++ /dev/null @@ -1,4 +0,0 @@ -123456781234567 -345678903456789 -234567892345678 -012345670123456 diff --git a/libexec/httpd/testsuite/data/index.html b/libexec/httpd/testsuite/data/index.html deleted file mode 100644 index dc88dcb5a..000000000 --- a/libexec/httpd/testsuite/data/index.html +++ /dev/null @@ -1 +0,0 @@ -this is the bozohttpd testsuite ./data/index.html file diff --git a/libexec/httpd/testsuite/html_cmp b/libexec/httpd/testsuite/html_cmp deleted file mode 100755 index 15931b017..000000000 --- a/libexec/httpd/testsuite/html_cmp +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/sh -# -# $eterna: html_cmp,v 1.9 2011/11/17 22:18:02 mrg Exp $ -# -# like cmp(1) but compares to files after making their `Date: ' headers -# the same, to allow `now' and `then' to work properly. it also tries -# to find servername's that might be the local host and converts those -# as well.. -# -# it must be called like `cmp file1 file1' *only*. - -h=`hostname || uname -n` - -sedcmd="s/^Date: .*/Date: nowish/; - s/^Last-Modified: .*/Last-Modified: nowish/; - s/[a-zA-Z0-9-]*\.eterna\.com\.au/$h/g; - s/^Server: .*/^Server: bozotic HTTP server version 5.08/; - s/^Content-Length: .*/Content-Length: 223/;" - -sed -e "$sedcmd" < "$1" > "f1.tmp.$$" -sed -e "$sedcmd" < "$2" > "f2.tmp.$$" - -cmp -s "f1.tmp.$$" "f2.tmp.$$" -rv=$? -rm -f "f1.tmp.$$" "f2.tmp.$$" - -exit $rv diff --git a/libexec/httpd/testsuite/t1.in b/libexec/httpd/testsuite/t1.in deleted file mode 100644 index 35dbed365..000000000 --- a/libexec/httpd/testsuite/t1.in +++ /dev/null @@ -1 +0,0 @@ -get / diff --git a/libexec/httpd/testsuite/t1.out b/libexec/httpd/testsuite/t1.out deleted file mode 100644 index 135ba7ab5..000000000 --- a/libexec/httpd/testsuite/t1.out +++ /dev/null @@ -1,2 +0,0 @@ -HTTP/0.9 200 OK -this is the bozohttpd testsuite ./data/index.html file diff --git a/libexec/httpd/testsuite/t10.in b/libexec/httpd/testsuite/t10.in deleted file mode 100644 index 6015fe237..000000000 --- a/libexec/httpd/testsuite/t10.in +++ /dev/null @@ -1 +0,0 @@ -GET /xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx HTTP/1.0 diff --git a/libexec/httpd/testsuite/t10.out b/libexec/httpd/testsuite/t10.out deleted file mode 100644 index cf4101106..000000000 --- a/libexec/httpd/testsuite/t10.out +++ /dev/null @@ -1,8 +0,0 @@ -HTTP/1.0 404 Not Found -Content-Type: text/html -Content-Length: 1024 -Server: bozohttpd/20140708 - -404 Not Found -

    404 Not Found

    -/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file diff --git a/libexec/httpd/testsuite/t2.in b/libexec/httpd/testsuite/t2.in deleted file mode 100644 index d7b06e0a4..000000000 --- a/libexec/httpd/testsuite/t2.in +++ /dev/null @@ -1 +0,0 @@ -GET / HTTP/1.0 diff --git a/libexec/httpd/testsuite/t2.out b/libexec/httpd/testsuite/t2.out deleted file mode 100644 index 68dcab458..000000000 --- a/libexec/httpd/testsuite/t2.out +++ /dev/null @@ -1,9 +0,0 @@ -HTTP/1.0 200 OK -Date: Tue, 10 Jul 2001 15:45:36 GMT -Server: bozotic HTTP server version 5.08 -Accept-Ranges: bytes -Last-Modified: Tue, 10 Jul 2001 15:50:43 GMT -Content-Type: text/html -Content-Length: 55 - -this is the bozohttpd testsuite ./data/index.html file diff --git a/libexec/httpd/testsuite/t3.in b/libexec/httpd/testsuite/t3.in deleted file mode 100644 index e71aab4be..000000000 --- a/libexec/httpd/testsuite/t3.in +++ /dev/null @@ -1 +0,0 @@ -GET / HTTP/1.1 diff --git a/libexec/httpd/testsuite/t3.out b/libexec/httpd/testsuite/t3.out deleted file mode 100644 index 21803ad9e..000000000 --- a/libexec/httpd/testsuite/t3.out +++ /dev/null @@ -1,11 +0,0 @@ -HTTP/1.1 400 Bad Request -Content-Type: text/html -Content-Length: 229 -Server: bozotic HTTP server version 5.08 -Allow: GET, HEAD, POST - -400 Bad Request -

    400 Bad Request

    -/:
    The request was not valid
    -
    madrugada.eterna.com.au
    - diff --git a/libexec/httpd/testsuite/t4.in b/libexec/httpd/testsuite/t4.in deleted file mode 100644 index 86a52f319..000000000 --- a/libexec/httpd/testsuite/t4.in +++ /dev/null @@ -1,2 +0,0 @@ -GET / HTTP/1.1 -Host: diff --git a/libexec/httpd/testsuite/t4.out b/libexec/httpd/testsuite/t4.out deleted file mode 100644 index 501e1673d..000000000 --- a/libexec/httpd/testsuite/t4.out +++ /dev/null @@ -1,10 +0,0 @@ -HTTP/1.1 200 OK -Date: Tue, 10 Jul 2001 15:49:21 GMT -Server: bozotic HTTP server version 5.08 -Accept-Ranges: bytes -Last-Modified: Tue, 10 Jul 2001 15:34:33 GMT -Content-Type: text/html -Content-Length: 55 -Connection: close - -this is the bozohttpd testsuite ./data/index.html file diff --git a/libexec/httpd/testsuite/t5.in b/libexec/httpd/testsuite/t5.in deleted file mode 100644 index 6422d98dd..000000000 --- a/libexec/httpd/testsuite/t5.in +++ /dev/null @@ -1,2 +0,0 @@ -GET /cgi-bin/..M-@M-/..M-@M-/..M-@M-/..M-@M-/..M-@M-/../winnt/system32/cmd.exe?/c+dir+c:\\ HTTP/1.0 - diff --git a/libexec/httpd/testsuite/t5.out b/libexec/httpd/testsuite/t5.out deleted file mode 100644 index 3a50ccd01..000000000 --- a/libexec/httpd/testsuite/t5.out +++ /dev/null @@ -1,10 +0,0 @@ -HTTP/1.0 403 Forbidden -Content-Type: text/html -Content-Length: 336 -Server: bozohttpd/20030206 - -403 Forbidden -

    403 Forbidden

    -/cgi-bin/..M-@M-/..M-@M-/..M-@M-/..M-@M-/..M-@M-/../winnt/system32/cmd.exe:
    Access to this item has been denied
    -
    what-time-is-love.eterna.com.au
    - diff --git a/libexec/httpd/testsuite/t6.in b/libexec/httpd/testsuite/t6.in deleted file mode 100644 index 3403286cf..000000000 --- a/libexec/httpd/testsuite/t6.in +++ /dev/null @@ -1,2 +0,0 @@ -GET /xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx HTTP/1.0 - diff --git a/libexec/httpd/testsuite/t6.out b/libexec/httpd/testsuite/t6.out deleted file mode 100644 index 906b126b2..000000000 --- a/libexec/httpd/testsuite/t6.out +++ /dev/null @@ -1,10 +0,0 @@ -HTTP/1.0 404 Not Found -Content-Type: text/html -Content-Length: 335 -Server: bozohttpd/5.15 - -404 Not Found -

    404 Not Found

    -xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx:
    This item has not been found
    -
    splode.eterna.com.au
    - diff --git a/libexec/httpd/testsuite/t7.in b/libexec/httpd/testsuite/t7.in deleted file mode 100644 index eaaab74dc..000000000 --- a/libexec/httpd/testsuite/t7.in +++ /dev/null @@ -1,4 +0,0 @@ -GET /file HTTP/1.1 -Host: -Range: bytes=0-63 - diff --git a/libexec/httpd/testsuite/t7.out b/libexec/httpd/testsuite/t7.out deleted file mode 100644 index 8695d97f3..000000000 --- a/libexec/httpd/testsuite/t7.out +++ /dev/null @@ -1,14 +0,0 @@ -HTTP/1.1 206 Partial Content -Date: Sun, 02 Mar 2008 08:52:03 GMT -Server: bozohttpd/20060710 -Accept-Ranges: bytes -Last-Modified: Sun, 02 Mar 2008 08:44:38 GMT -Content-Type: text/plain -Content-Range: bytes 0-63/64 -Content-Length: 64 -Connection: close - -123456781234567 -345678903456789 -234567892345678 -012345670123456 diff --git a/libexec/httpd/testsuite/t8.in b/libexec/httpd/testsuite/t8.in deleted file mode 100644 index 45263b92c..000000000 --- a/libexec/httpd/testsuite/t8.in +++ /dev/null @@ -1,4 +0,0 @@ -GET /file HTTP/1.1 -Host: -Range: bytes=0-31 - diff --git a/libexec/httpd/testsuite/t8.out b/libexec/httpd/testsuite/t8.out deleted file mode 100644 index d755f81ca..000000000 --- a/libexec/httpd/testsuite/t8.out +++ /dev/null @@ -1,12 +0,0 @@ -HTTP/1.1 206 Partial Content -Date: Sun, 02 Mar 2008 08:52:03 GMT -Server: bozohttpd/20060710 -Accept-Ranges: bytes -Last-Modified: Sun, 02 Mar 2008 08:44:38 GMT -Content-Type: text/plain -Content-Range: bytes 0-31/64 -Content-Length: 32 -Connection: close - -123456781234567 -345678903456789 diff --git a/libexec/httpd/testsuite/t9.in b/libexec/httpd/testsuite/t9.in deleted file mode 100644 index 22b123534..000000000 --- a/libexec/httpd/testsuite/t9.in +++ /dev/null @@ -1,4 +0,0 @@ -GET /file HTTP/1.1 -Host: -Range: bytes=32-63 - diff --git a/libexec/httpd/testsuite/t9.out b/libexec/httpd/testsuite/t9.out deleted file mode 100644 index 15d692b77..000000000 --- a/libexec/httpd/testsuite/t9.out +++ /dev/null @@ -1,12 +0,0 @@ -HTTP/1.1 206 Partial Content -Date: Sun, 02 Mar 2008 08:52:03 GMT -Server: bozohttpd/20060710 -Accept-Ranges: bytes -Last-Modified: Sun, 02 Mar 2008 08:44:38 GMT -Content-Type: text/plain -Content-Range: bytes 32-63/64 -Content-Length: 32 -Connection: close - -234567892345678 -012345670123456 diff --git a/libexec/httpd/testsuite/test-bigfile b/libexec/httpd/testsuite/test-bigfile deleted file mode 100755 index 0f33dcfc7..000000000 --- a/libexec/httpd/testsuite/test-bigfile +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/sh - -test="$1" # partial4000 or partial8000 -bozohttpd="$2" -wget="$3" -datadir="$4" - -bozotestport=11111 - -# copy beginning file -cp ./data/bigfile.${test} ./bigfile - -# fire up bozohttpd -${bozohttpd} -b -b -I ${bozotestport} -n -s -f ${datadir} & -bozopid=$! - -${wget} -c http://localhost:${bozotestport}/bigfile - -kill -9 $bozopid - -if cmp ./bigfile ./data/bigfile; then - rm -f ./bigfile - exit 0 -else - rm -f ./bigfile - exit 1 -fi diff --git a/libexec/httpd/tilde-luzah-bozo.c b/libexec/httpd/tilde-luzah-bozo.c deleted file mode 100644 index f7fd0c7bd..000000000 --- a/libexec/httpd/tilde-luzah-bozo.c +++ /dev/null @@ -1,140 +0,0 @@ -/* $NetBSD: tilde-luzah-bozo.c,v 1.11 2015/07/16 12:19:23 shm Exp $ */ - -/* $eterna: tilde-luzah-bozo.c,v 1.16 2011/11/18 09:21:15 mrg Exp $ */ - -/* - * Copyright (c) 1997-2014 Matthew R. Green - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer and - * dedication in the documentation and/or other materials provided - * with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - */ - -/* this code implements ~user support for bozohttpd */ - -#ifndef NO_USER_SUPPORT - -#include - -#include -#include -#include -#include -#include -#include - -#include "bozohttpd.h" - -/* - * bozo_user_transform does this: - * - chdir's /~user/public_html - * - returns the rest of the file, index.html appended if required - * - returned malloced file to serve in request->hr_file, - * ala transform_request(). - * - * transform_request() is supposed to check that we have user support - * enabled. - */ -int -bozo_user_transform(bozo_httpreq_t *request, int *isindex) -{ - bozohttpd_t *httpd = request->hr_httpd; - char c, *s, *file = NULL, *user; - struct passwd *pw; - - *isindex = 0; - - /* find username */ - user = strchr(request->hr_file + 2, '~'); - - /* this shouldn't happen, but "better paranoid than sorry" */ - assert(user != NULL); - - user++; - - if ((s = strchr(user, '/')) != NULL) { - *s++ = '\0'; - c = s[strlen(s)-1]; - *isindex = (c == '/' || c == '\0'); - } - - debug((httpd, DEBUG_OBESE, "looking for user %s", - user)); - pw = getpwnam(user); - /* fix this up immediately */ - if (s) - s[-1] = '/'; - if (pw == NULL) { - (void)bozo_http_error(httpd, 404, request, "no such user"); - return 0; - } - - debug((httpd, DEBUG_OBESE, "user %s dir %s/%s uid %d gid %d", - pw->pw_name, pw->pw_dir, httpd->public_html, - pw->pw_uid, pw->pw_gid)); - - if (chdir(pw->pw_dir) < 0) { - bozo_warn(httpd, "chdir1 error: %s: %s", pw->pw_dir, - strerror(errno)); - (void)bozo_http_error(httpd, 404, request, - "can't chdir to homedir"); - return 0; - } - if (chdir(httpd->public_html) < 0) { - bozo_warn(httpd, "chdir2 error: %s: %s", httpd->public_html, - strerror(errno)); - (void)bozo_http_error(httpd, 404, request, - "can't chdir to public_html"); - return 0; - } - if (s == NULL || *s == '\0') { - file = bozostrdup(httpd, httpd->index_html); - } else { - file = bozomalloc(httpd, strlen(s) + - (*isindex ? strlen(httpd->index_html) + 1 : 1)); - strcpy(file, s); - if (*isindex) - strcat(file, httpd->index_html); - } - - /* see transform_request() */ - if (*file == '/' || strcmp(file, "..") == 0 || - strstr(file, "/..") || strstr(file, "../")) { - (void)bozo_http_error(httpd, 403, request, "illegal request"); - free(file); - return 0; - } - - if (bozo_auth_check(request, file)) { - free(file); - return 0; - } - - free(request->hr_file); - request->hr_file = file; - - debug((httpd, DEBUG_FAT, "transform_user returning %s under %s", file, - pw->pw_dir)); - return 1; -} -#endif /* NO_USER_SUPPORT */ diff --git a/libexec/makewhatis/Makefile b/libexec/makewhatis/Makefile deleted file mode 100644 index a8252b0b0..000000000 --- a/libexec/makewhatis/Makefile +++ /dev/null @@ -1,19 +0,0 @@ -# $NetBSD: Makefile,v 1.20 2009/03/16 02:24:56 lukem Exp $ - -WARNS?= 2 # XXX: const issues - -.include - -PROG= makewhatis -SRCS= makewhatis.c manconf.c -.PATH: ${NETBSDSRCDIR}/usr.bin/man -CPPFLAGS+=-I${NETBSDSRCDIR}/usr.bin - -MAN= ${PROG}.8 - -.ifndef HOSTPROG -DPADD+= ${LIBUTIL} ${LIBZ} -LDADD+= -lutil -lz -.endif - -.include diff --git a/libexec/makewhatis/makewhatis.8 b/libexec/makewhatis/makewhatis.8 deleted file mode 100644 index 2ca996768..000000000 --- a/libexec/makewhatis/makewhatis.8 +++ /dev/null @@ -1,125 +0,0 @@ -.\" $NetBSD: makewhatis.8,v 1.14 2014/03/18 18:20:38 riastradh Exp $ -.\" -.\" Copyright (c) 1997, 2002 The NetBSD Foundation, Inc. -.\" All rights reserved. -.\" -.\" This code is derived from software contributed to The NetBSD Foundation -.\" by Robert Dobbs . -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED -.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -.\" PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS -.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -.\" POSSIBILITY OF SUCH DAMAGE. -.\" -.Dd April 3, 2005 -.Dt MAKEWHATIS 8 -.Os -.Sh NAME -.Nm makewhatis -.Nd create a whatis.db database -.Sh SYNOPSIS -.Nm /usr/libexec/makewhatis -.Op Fl fw -.Op Fl C Ar file -.Op Ar manpath ... -.Sh DESCRIPTION -.Nm -strips the NAME lines from compiled or raw -.Xr man 1 -pages and creates a whatis.db database for use in -.Xr apropos 1 , -.Xr whatis 1 , -or with -.Xr man 1 Ns 's -.Fl k -option. -Man pages compressed with -.Xr compress 1 -and -.Xr gzip 1 -are uncompressed before processing. -.Pp -When -.Ar manpath -is provided multiple times, the resulting database file -is generated in the first directory specified, and contains -entries for all the directories. -.Pp -If -.Ar manpath -is not provided, -.Nm -parses -.Pa /etc/man.conf -and regenerates the whatis database files specified there. -Each database file is assumed to reside in the root of the appropriate -man page hierarchy. -.Pp -The options are as follows: -.Bl -tag -width XCXfileXX -.It Fl C Ar file -Use -.Ar file -(in -.Xr man.conf 5 -format) as configuration file instead of the default, -.Pa /etc/man.conf . -.It Fl f -Don't spawn child processes to generate the individual database files, -but do all the work synchronously in the foreground. -.It Fl w -Print warnings about input files we don't like. -.El -.Sh FILES -.Bl -tag -compact -width /etc/man.conf1 -.It Pa whatis.db -name of the whatis database -.It Pa /etc/man.conf -.Xr man 1 -configuration file, used to get the location of the whatis databases when -.Nm -is called without arguments -.El -.Sh SEE ALSO -.Xr apropos 1 , -.Xr man 1 , -.Xr whatis 1 , -.Xr man.conf 5 -.Sh HISTORY -.An -nosplit -.Nm -first appeared in -.Nx 1.0 , -as a shell script written by -.An J.T. Conklin Aq Mt jtc@NetBSD.org -and -.An Thorsten Frueauf Aq Mt frueauf@ira.uka.de . -Further work was done by -.An Matthew Green , -.An Luke Mewburn , -and -.An Chris Demetriou . -.Pp -.An Matthias Scheler -has reimplemented -.Nm -in C in -.Nx 1.5 . -.Sh AUTHORS -.An Matthias Scheler Aq Mt tron@NetBSD.org diff --git a/libexec/makewhatis/makewhatis.c b/libexec/makewhatis/makewhatis.c deleted file mode 100644 index 9209d4084..000000000 --- a/libexec/makewhatis/makewhatis.c +++ /dev/null @@ -1,1174 +0,0 @@ -/* $NetBSD: makewhatis.c,v 1.49 2013/06/24 20:57:47 christos Exp $ */ - -/*- - * Copyright (c) 1999 The NetBSD Foundation, Inc. - * All rights reserved. - * - * This code is derived from software contributed to The NetBSD Foundation - * by Matthias Scheler. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED - * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#if HAVE_NBTOOL_CONFIG_H -#include "nbtool_config.h" -#endif - -#include -#if !defined(lint) -__COPYRIGHT("@(#) Copyright (c) 1999\ - The NetBSD Foundation, Inc. All rights reserved."); -__RCSID("$NetBSD: makewhatis.c,v 1.49 2013/06/24 20:57:47 christos Exp $"); -#endif /* not lint */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#ifndef NROFF -#define NROFF "nroff" -#endif - -typedef struct manpagestruct manpage; -struct manpagestruct { - manpage *mp_left, *mp_right; - ino_t mp_inode; - size_t mp_sdoff; - size_t mp_sdlen; - char mp_name[1]; -}; - -typedef struct whatisstruct whatis; -struct whatisstruct { - whatis *wi_left, *wi_right; - char *wi_data; - char wi_prefix[1]; -}; - -int main(int, char * const *); -static char *findwhitespace(char *); -static char *strmove(char *, char *); -static char *GetS(gzFile, char *, size_t); -static int pathnamesection(const char *, const char *); -static int manpagesection(char *); -static char *createsectionstring(char *); -static void addmanpage(manpage **, ino_t, char *, size_t, size_t); -static void addwhatis(whatis **, char *, char *); -static char *makesection(int); -static char *makewhatisline(const char *, const char *, const char *); -static void catpreprocess(char *); -static char *parsecatpage(const char *, gzFile *); -static int manpreprocess(char *); -static char *nroff(const char *, gzFile *); -static char *parsemanpage(const char *, gzFile *, int); -static char *getwhatisdata(char *); -static void processmanpages(manpage **, whatis **); -static void dumpwhatis(FILE *, whatis *); -static int makewhatis(char * const *manpath); - -static char * const default_manpath[] = { -#if defined(__minix) - "/usr/man", -#endif /* defined(__minix) */ - "/usr/share/man", - NULL -}; - -static const char *sectionext = "0123456789ln"; -static const char *whatisdb = _PATH_WHATIS; -static const char *whatisdb_new = _PATH_WHATIS ".new"; -static int dowarn = 0; - -#define ISALPHA(c) isalpha((unsigned char)(c)) -#define ISDIGIT(c) isdigit((unsigned char)(c)) -#define ISSPACE(c) isspace((unsigned char)(c)) - -int -main(int argc, char *const *argv) -{ - char * const *manpath; - int c, dofork; - const char *conffile; - ENTRY *ep; - TAG *tp; - int rv, jobs, status; - glob_t pg; - char *paths[2], **p, *sl; - int retval; - - dofork = 1; - conffile = NULL; - jobs = 0; - retval = EXIT_SUCCESS; - - (void)setlocale(LC_ALL, ""); - - while ((c = getopt(argc, argv, "C:fw")) != -1) { - switch (c) { - case 'C': - conffile = optarg; - break; - case 'f': - /* run all processing on foreground */ - dofork = 0; - break; - case 'w': - dowarn++; - break; - default: - fprintf(stderr, "Usage: %s [-fw] [-C file] [manpath ...]\n", - getprogname()); - exit(EXIT_FAILURE); - } - } - argc -= optind; - argv += optind; - - if (argc >= 1) { - manpath = &argv[0]; - - mkwhatis: - return makewhatis(manpath); - } - - /* - * Try read config file, fallback to default_manpath[] - * if man.conf not available. - */ - config(conffile); - if ((tp = gettag("_whatdb", 0)) == NULL) { - manpath = default_manpath; - goto mkwhatis; - } - - /* Build individual databases */ - paths[1] = NULL; - TAILQ_FOREACH(ep, &tp->entrylist, q) { - if ((rv = glob(ep->s, - GLOB_BRACE | GLOB_NOSORT | GLOB_ERR | GLOB_NOCHECK, - NULL, &pg)) != 0) - err(EXIT_FAILURE, "glob('%s')", ep->s); - - /* We always have something to work with here */ - for (p = pg.gl_pathv; *p; p++) { - sl = strrchr(*p, '/'); - if (sl == NULL) { - err(EXIT_FAILURE, "glob: _whatdb entry '%s' " - "doesn't contain slash", ep->s); - } - - /* - * Cut the last component of path, leaving just - * the directory. We will use the result as root - * for manpage search. - * glob malloc()s space for the paths, so it's - * okay to change it in-place. - */ - *sl = '\0'; - paths[0] = *p; - - if (!dofork) { - /* Do not fork child */ - makewhatis(paths); - continue; - } - - switch (fork()) { - case 0: - exit(makewhatis(paths)); - break; - case -1: - warn("fork"); - makewhatis(paths); - break; - default: - jobs++; - break; - } - - } - - globfree(&pg); - } - - /* Wait for the childern to finish */ - while (jobs > 0) { - (void)wait(&status); - if (!WIFEXITED(status) || WEXITSTATUS(status) != EXIT_SUCCESS) - retval = EXIT_FAILURE; - jobs--; - } - - return retval; -} - -static int -makewhatis(char * const * manpath) -{ - FTS *fts; - FTSENT *fe; - manpage *source; - whatis *dest; - FILE *out; - size_t sdoff, sdlen; - int outfd; - struct stat st_before, st_after; - - if ((fts = fts_open(manpath, FTS_LOGICAL, NULL)) == NULL) - err(EXIT_FAILURE, "Cannot open `%s'", *manpath); - - source = NULL; - while ((fe = fts_read(fts)) != NULL) { - switch (fe->fts_info) { - case FTS_F: - if (manpagesection(fe->fts_path) >= 0) { - /* - * Get manpage subdirectory prefix. Most - * commonly, this is arch-specific subdirectory. - */ - if (fe->fts_level >= 3) { - int sl; - const char *s, *lsl; - - lsl = NULL; - s = &fe->fts_path[fe->fts_pathlen - 1]; - for(sl = fe->fts_level - 1; sl > 0; - sl--) { - s--; - while (s[0] != '/') - s--; - if (lsl == NULL) - lsl = s; - } - - /* - * Include trailing '/', so we get - * 'arch/'. - */ - sdoff = s + 1 - fe->fts_path; - sdlen = lsl - s + 1; - } else { - sdoff = 0; - sdlen = 0; - } - - addmanpage(&source, fe->fts_statp->st_ino, - fe->fts_path, sdoff, sdlen); - } - /*FALLTHROUGH*/ - case FTS_D: - case FTS_DC: - case FTS_DEFAULT: - case FTS_DP: - case FTS_SL: - case FTS_DOT: - case FTS_W: - case FTS_NSOK: - case FTS_INIT: - break; - case FTS_SLNONE: - warnx("Symbolic link with no target: `%s'", - fe->fts_path); - break; - case FTS_DNR: - warnx("Unreadable directory: `%s'", fe->fts_path); - break; - case FTS_NS: - errno = fe->fts_errno; - warn("Cannot stat `%s'", fe->fts_path); - break; - case FTS_ERR: - errno = fe->fts_errno; - warn("Error reading `%s'", fe->fts_path); - break; - default: - errx(EXIT_FAILURE, "Unknown info %d returned from fts " - " for path: `%s'", fe->fts_info, fe->fts_path); - } - } - - (void)fts_close(fts); - - dest = NULL; - processmanpages(&source, &dest); - - if (chdir(manpath[0]) == -1) - err(EXIT_FAILURE, "Cannot change dir to `%s'", manpath[0]); - - /* - * makewhatis runs unattended, so it needs to be able to - * recover if the last run crashed out. Therefore, if - * whatisdb_new exists and is more than (arbitrarily) sixteen - * hours old, nuke it. If it exists but is not so old, refuse - * to run until it's cleaned up, in case another makewhatis is - * already running. Also, open the output with O_EXCL to make - * sure we get our own, in case two copies start exactly at - * once. (Unlikely? Maybe, maybe not, if two copies of cron - * end up running.) - * - * Similarly, before renaming the file after we finish writing - * to it, make sure it's still the same file we opened. This - * can't be completely race-free, but getting caught by it - * would require an unexplained sixteen-hour-or-more lag - * between the last mtime update when we wrote to it and when - * we get to the stat call *and* another makewhatis starting - * out to write at exactly the wrong moment. Not impossible, - * but not likely enough to worry about. - * - * This is maybe unnecessarily elaborate, but generating - * corrupted output isn't so good either. - */ - - if (stat(whatisdb_new, &st_before) == 0) { - if (st_before.st_mtime - time(NULL) > 16*60*60) { - /* Don't complain if someone else just removed it. */ - if (unlink(whatisdb_new) == -1 && errno != ENOENT) { - err(EXIT_FAILURE, "Could not remove `%s'", - whatisdb_new); - } else { - warnx("Removed stale `%s'", whatisdb_new); - } - } else { - errx(EXIT_FAILURE, "The file `%s' already exists " - "-- am I already running?", whatisdb_new); - } - } else if (errno != ENOENT) { - /* Something unexpected happened. */ - err(EXIT_FAILURE, "Cannot stat `%s'", whatisdb_new); - } - - outfd = open(whatisdb_new, O_WRONLY|O_CREAT|O_EXCL, - S_IRUSR|S_IRGRP|S_IROTH); - if (outfd < 0) - err(EXIT_FAILURE, "Cannot open `%s'", whatisdb_new); - - if (fstat(outfd, &st_before) == -1) - err(EXIT_FAILURE, "Cannot fstat `%s'", whatisdb_new); - - if ((out = fdopen(outfd, "w")) == NULL) - err(EXIT_FAILURE, "Cannot fdopen `%s'", whatisdb_new); - - dumpwhatis(out, dest); - if (fchmod(fileno(out), S_IRUSR|S_IRGRP|S_IROTH) == -1) - err(EXIT_FAILURE, "Cannot chmod `%s'", whatisdb_new); - if (fclose(out) != 0) - err(EXIT_FAILURE, "Cannot close `%s'", whatisdb_new); - - if (stat(whatisdb_new, &st_after) == -1) - err(EXIT_FAILURE, "Cannot stat `%s' (after writing)", - whatisdb_new); - - if (st_before.st_dev != st_after.st_dev || - st_before.st_ino != st_after.st_ino) { - errx(EXIT_FAILURE, "The file `%s' changed under me; giving up", - whatisdb_new); - } - - if (rename(whatisdb_new, whatisdb) == -1) - err(EXIT_FAILURE, "Could not rename `%s' to `%s'", - whatisdb_new, whatisdb); - - return EXIT_SUCCESS; -} - -static char * -findwhitespace(char *str) -{ - while (!ISSPACE(*str)) - if (*str++ == '\0') { - str = NULL; - break; - } - - return str; -} - -static char * -strmove(char *dest, char *src) -{ - return memmove(dest, src, strlen(src) + 1); -} - -static char * -GetS(gzFile in, char *buffer, size_t length) -{ - char *ptr; - - if (((ptr = gzgets(in, buffer, (int)length)) != NULL) && (*ptr == '\0')) - ptr = NULL; - - return ptr; -} - -static char * -makesection(int s) -{ - char sectionbuffer[24]; - if (s == -1) - return NULL; - (void)snprintf(sectionbuffer, sizeof(sectionbuffer), - " (%c) - ", sectionext[s]); - return estrdup(sectionbuffer); -} - -static int -pathnamesection(const char *pat, const char *name) -{ - char *ptr, *ext; - size_t len = strlen(pat); - - - while ((ptr = strstr(name, pat)) != NULL) { - if ((ext = strchr(sectionext, ptr[len])) != NULL) { - return ext - sectionext; - } - name = ptr + 1; - } - return -1; -} - - -static int -manpagesection(char *name) -{ - char *ptr; - - if ((ptr = strrchr(name, '/')) != NULL) - ptr++; - else - ptr = name; - - while ((ptr = strchr(ptr, '.')) != NULL) { - int section; - - ptr++; - section = 0; - while (sectionext[section] != '\0') - if (sectionext[section] == *ptr) - return section; - else - section++; - } - return -1; -} - -static char * -createsectionstring(char *section_id) -{ - char *section; - - if (asprintf(§ion, " (%s) - ", section_id) < 0) - err(EXIT_FAILURE, "malloc failed"); - return section; -} - -static void -addmanpage(manpage **tree, ino_t inode, char *name, size_t sdoff, size_t sdlen) -{ - manpage *mp; - - while ((mp = *tree) != NULL) { - if (mp->mp_inode == inode) - return; - tree = inode < mp->mp_inode ? &mp->mp_left : &mp->mp_right; - } - - mp = emalloc(sizeof(manpage) + strlen(name)); - mp->mp_left = NULL; - mp->mp_right = NULL; - mp->mp_inode = inode; - mp->mp_sdoff = sdoff; - mp->mp_sdlen = sdlen; - (void)strcpy(mp->mp_name, name); - *tree = mp; -} - -static void -addwhatis(whatis **tree, char *data, char *prefix) -{ - whatis *wi; - int result; - - while (ISSPACE(*data)) - data++; - - if (*data == '/') { - char *ptr; - - ptr = ++data; - while ((*ptr != '\0') && !ISSPACE(*ptr)) - if (*ptr++ == '/') - data = ptr; - } - - while ((wi = *tree) != NULL) { - result = strcmp(data, wi->wi_data); - if (result == 0) result = strcmp(prefix, wi->wi_prefix); - if (result == 0) return; - tree = result < 0 ? &wi->wi_left : &wi->wi_right; - } - - wi = emalloc(sizeof(whatis) + strlen(prefix)); - - wi->wi_left = NULL; - wi->wi_right = NULL; - wi->wi_data = data; - if (prefix[0] != '\0') - (void) strcpy(wi->wi_prefix, prefix); - else - wi->wi_prefix[0] = '\0'; - *tree = wi; -} - -static void -catpreprocess(char *from) -{ - char *to; - - to = from; - while (ISSPACE(*from)) from++; - - while (*from != '\0') - if (ISSPACE(*from)) { - while (ISSPACE(*++from)); - if (*from != '\0') - *to++ = ' '; - } - else if (*(from + 1) == '\b') - from += 2; - else - *to++ = *from++; - - *to = '\0'; -} - -static char * -makewhatisline(const char *file, const char *line, const char *section) -{ - static const char *del[] = { - " - ", - " -- ", - "- ", - " -", - NULL - }; - size_t i, pos; - size_t llen, slen, dlen; - char *result, *ptr; - - ptr = NULL; - if (section == NULL) { - if (dowarn) - warnx("%s: No section provided for `%s'", file, line); - return estrdup(line); - } - - for (i = 0; del[i]; i++) - if ((ptr = strstr(line, del[i])) != NULL) - break; - - if (del[i] == NULL) { - if (dowarn) - warnx("%s: Bad format line `%s'", file, line); - return estrdup(line); - } - - slen = strlen(section); - llen = strlen(line); - dlen = strlen(del[i]); - - result = emalloc(llen - dlen + slen + 1); - pos = ptr - line; - - (void)memcpy(result, line, pos); - (void)memcpy(&result[pos], section, slen); - (void)strcpy(&result[pos + slen], &line[pos + dlen]); - return result; -} - -static char * -parsecatpage(const char *name, gzFile *in) -{ - char buffer[8192]; - char *section, *ptr, *last; - size_t size; - - do { - if (GetS(in, buffer, sizeof(buffer)) == NULL) - return NULL; - } - while (buffer[0] == '\n'); - - section = NULL; - if ((ptr = strchr(buffer, '(')) != NULL) { - if ((last = strchr(ptr + 1, ')')) !=NULL) { - size_t length; - - length = last - ptr + 1; - section = emalloc(length + 5); - *section = ' '; - (void) memcpy(section + 1, ptr, length); - (void) strcpy(section + 1 + length, " - "); - } - } - - for (;;) { - if (GetS(in, buffer, sizeof(buffer)) == NULL) { - free(section); - return NULL; - } - catpreprocess(buffer); - if (strncmp(buffer, "NAME", 4) == 0) - break; - } - if (section == NULL) - section = makesection(pathnamesection("/cat", name)); - - ptr = last = buffer; - size = sizeof(buffer) - 1; - while ((size > 0) && (GetS(in, ptr, size) != NULL)) { - int length; - - catpreprocess(ptr); - - length = strlen(ptr); - if (length == 0) { - *last = '\0'; - - ptr = makewhatisline(name, buffer, section); - free(section); - return ptr; - } - if ((length > 1) && (ptr[length - 1] == '-') && - ISALPHA(ptr[length - 2])) - last = &ptr[--length]; - else { - last = &ptr[length++]; - *last = ' '; - } - - ptr += length; - size -= length; - } - - free(section); - - return NULL; -} - -static int -manpreprocess(char *line) -{ - char *from, *to; - - to = from = line; - while (ISSPACE(*from)) - from++; - if (strncmp(from, ".\\\"", 3) == 0) - return 1; - - while (*from != '\0') - if (ISSPACE(*from)) { - while (ISSPACE(*++from)); - if ((*from != '\0') && (*from != ',')) - *to++ = ' '; - } else if (*from == '\\') { - switch (*++from) { - case '\0': - case '-': - break; - case 'f': - case 's': - from++; - if ((*from=='+') || (*from=='-')) - from++; - while (ISDIGIT(*from)) - from++; - break; - default: - from++; - } - } else { - if (*from == '"') - from++; - else - *to++ = *from++; - } - - *to = '\0'; - - if (strncasecmp(line, ".Xr", 3) == 0) { - char *sect; - - from = line + 3; - if (ISSPACE(*from)) - from++; - - if ((sect = findwhitespace(from)) != NULL) { - size_t length; - char *trail; - - *sect++ = '\0'; - if ((trail = findwhitespace(sect)) != NULL) - *trail++ = '\0'; - length = strlen(from); - (void) memmove(line, from, length); - line[length++] = '('; - to = &line[length]; - length = strlen(sect); - (void) memmove(to, sect, length); - if (trail == NULL) { - (void) strcpy(&to[length], ")"); - } else { - to += length; - *to++ = ')'; - length = strlen(trail); - (void) memmove(to, trail, length + 1); - } - } - } - - return 0; -} - -static char * -nroff(const char *inname, gzFile *in) -{ - char tempname[MAXPATHLEN], buffer[65536], *data; - int tempfd, bytes, pipefd[2], status; - static int devnull = -1; - pid_t child; - - if (gzrewind(in) < 0) - err(EXIT_FAILURE, "Cannot rewind pipe"); - - if ((devnull < 0) && - ((devnull = open(_PATH_DEVNULL, O_WRONLY, 0)) < 0)) - err(EXIT_FAILURE, "Cannot open `/dev/null'"); - - (void)strlcpy(tempname, _PATH_TMP "makewhatis.XXXXXX", - sizeof(tempname)); - if ((tempfd = mkstemp(tempname)) == -1) - err(EXIT_FAILURE, "Cannot create temp file"); - - while ((bytes = gzread(in, buffer, sizeof(buffer))) > 0) - if (write(tempfd, buffer, (size_t)bytes) != bytes) { - bytes = -1; - break; - } - - if (bytes < 0) { - (void)close(tempfd); - (void)unlink(tempname); - err(EXIT_FAILURE, "Read from pipe failed"); - } - if (lseek(tempfd, (off_t)0, SEEK_SET) == (off_t)-1) { - (void)close(tempfd); - (void)unlink(tempname); - err(EXIT_FAILURE, "Cannot rewind temp file"); - } - if (pipe(pipefd) == -1) { - (void)close(tempfd); - (void)unlink(tempname); - err(EXIT_FAILURE, "Cannot create pipe"); - } - - switch (child = vfork()) { - case -1: - (void)close(pipefd[1]); - (void)close(pipefd[0]); - (void)close(tempfd); - (void)unlink(tempname); - err(EXIT_FAILURE, "Fork failed"); - /* NOTREACHED */ - case 0: - (void)close(pipefd[0]); - if (tempfd != STDIN_FILENO) { - (void)dup2(tempfd, STDIN_FILENO); - (void)close(tempfd); - } - if (pipefd[1] != STDOUT_FILENO) { - (void)dup2(pipefd[1], STDOUT_FILENO); - (void)close(pipefd[1]); - } - if (devnull != STDERR_FILENO) { - (void)dup2(devnull, STDERR_FILENO); - (void)close(devnull); - } - (void)execlp(NROFF, NROFF, "-S", "-man", NULL); - _exit(EXIT_FAILURE); - /*NOTREACHED*/ - default: - (void)close(pipefd[1]); - (void)close(tempfd); - break; - } - - if ((in = gzdopen(pipefd[0], "r")) == NULL) { - if (errno == 0) - errno = ENOMEM; - (void)close(pipefd[0]); - (void)kill(child, SIGTERM); - while (waitpid(child, NULL, 0) != child); - (void)unlink(tempname); - err(EXIT_FAILURE, "Cannot read from pipe"); - } - - data = parsecatpage(inname, in); - while (gzread(in, buffer, sizeof(buffer)) > 0); - (void)gzclose(in); - - while (waitpid(child, &status, 0) != child); - if ((data != NULL) && - !(WIFEXITED(status) && (WEXITSTATUS(status) == 0))) { - free(data); - errx(EXIT_FAILURE, NROFF " on `%s' exited with %d status", - inname, WEXITSTATUS(status)); - } - - (void)unlink(tempname); - return data; -} - -static char * -parsemanpage(const char *name, gzFile *in, int defaultsection) -{ - char *section, buffer[8192], *ptr; - static const char POD[] = ".\\\" Automatically generated by Pod"; - static const char IX[] = ".IX TITLE"; - - section = NULL; - do { - if (GetS(in, buffer, sizeof(buffer) - 1) == NULL) { - free(section); - return NULL; - } - - /* - * Skip over lines in man pages that have been generated - * by Pod, until we find the TITLE. - */ - if (strncasecmp(buffer, POD, sizeof(POD) - 1) == 0) { - do { - if (GetS(in, buffer, sizeof(buffer) - 1) - == NULL) { - free(section); - return NULL; - } - } while (strncasecmp(buffer, IX, sizeof(IX) - 1) != 0); - } - - if (manpreprocess(buffer)) - continue; - if (strncasecmp(buffer, ".Dt", 3) == 0) { - char *end; - - ptr = &buffer[3]; - if (ISSPACE(*ptr)) - ptr++; - if ((ptr = findwhitespace(ptr)) == NULL) - continue; - - if ((end = findwhitespace(++ptr)) != NULL) - *end = '\0'; - - free(section); - section = createsectionstring(ptr); - } - else if (strncasecmp(buffer, ".TH", 3) == 0) { - ptr = &buffer[3]; - while (ISSPACE(*ptr)) - ptr++; - if ((ptr = findwhitespace(ptr)) != NULL) { - char *next; - - while (ISSPACE(*ptr)) - ptr++; - if ((next = findwhitespace(ptr)) != NULL) - *next = '\0'; - free(section); - section = createsectionstring(ptr); - } - } - else if (strncasecmp(buffer, ".Ds", 3) == 0) { - free(section); - return NULL; - } - } while (strncasecmp(buffer, ".Sh NAME", 8) != 0); - - do { - if (GetS(in, buffer, sizeof(buffer) - 1) == NULL) { - free(section); - return NULL; - } - } while (manpreprocess(buffer)); - - if (strncasecmp(buffer, ".Nm", 3) == 0) { - size_t length, offset; - - ptr = &buffer[3]; - while (ISSPACE(*ptr)) - ptr++; - - length = strlen(ptr); - if ((length > 1) && (ptr[length - 1] == ',') && - ISSPACE(ptr[length - 2])) { - ptr[--length] = '\0'; - ptr[length - 1] = ','; - } - (void) memmove(buffer, ptr, length + 1); - - offset = length + 3; - ptr = &buffer[offset]; - for (;;) { - size_t more; - - if ((sizeof(buffer) == offset) || - (GetS(in, ptr, sizeof(buffer) - offset) - == NULL)) { - free(section); - return NULL; - } - if (manpreprocess(ptr)) - continue; - - if (strncasecmp(ptr, ".Nm", 3) != 0) break; - - ptr += 3; - if (ISSPACE(*ptr)) - ptr++; - - buffer[length++] = ' '; - more = strlen(ptr); - if ((more > 1) && (ptr[more - 1] == ',') && - ISSPACE(ptr[more - 2])) { - ptr[--more] = '\0'; - ptr[more - 1] = ','; - } - - (void) memmove(&buffer[length], ptr, more + 1); - length += more; - offset = length + 3; - - ptr = &buffer[offset]; - } - - if (strncasecmp(ptr, ".Nd", 3) == 0) { - (void) strlcpy(&buffer[length], " -", - sizeof(buffer) - length); - - while (strncasecmp(ptr, ".Sh", 3) != 0) { - int more; - - if (*ptr == '.') { - char *space; - - if (strncasecmp(ptr, ".Nd", 3) != 0 || - strchr(ptr, '[') != NULL) { - free(section); - return NULL; - } - space = findwhitespace(ptr); - if (space == NULL) { - ptr = ""; - } else { - space++; - (void) strmove(ptr, space); - } - } - - if (*ptr != '\0') { - buffer[offset - 1] = ' '; - more = strlen(ptr) + 1; - offset += more; - } - ptr = &buffer[offset]; - if ((sizeof(buffer) == offset) || - (GetS(in, ptr, sizeof(buffer) - offset) - == NULL)) { - free(section); - return NULL; - } - if (manpreprocess(ptr)) - *ptr = '\0'; - } - } - } - else { - int offset; - - if (*buffer == '.') { - char *space; - - if ((space = findwhitespace(&buffer[1])) == NULL) { - free(section); - return NULL; - } - space++; - (void) strmove(buffer, space); - } - - offset = strlen(buffer) + 1; - for (;;) { - int more; - - ptr = &buffer[offset]; - if ((sizeof(buffer) == offset) || - (GetS(in, ptr, sizeof(buffer) - offset) - == NULL)) { - free(section); - return NULL; - } - if (manpreprocess(ptr) || (*ptr == '\0')) - continue; - - if ((strncasecmp(ptr, ".Sh", 3) == 0) || - (strncasecmp(ptr, ".Ss", 3) == 0)) - break; - - if (*ptr == '.') { - char *space; - - if ((space = findwhitespace(ptr)) == NULL) { - continue; - } - - space++; - (void) memmove(ptr, space, strlen(space) + 1); - } - - buffer[offset - 1] = ' '; - more = strlen(ptr); - if ((more > 1) && (ptr[more - 1] == ',') && - ISSPACE(ptr[more - 2])) { - ptr[more - 1] = '\0'; - ptr[more - 2] = ','; - } - else more++; - offset += more; - } - } - - if (section == NULL) - section = makesection(defaultsection); - - ptr = makewhatisline(name, buffer, section); - free(section); - return ptr; -} - -static char * -getwhatisdata(char *name) -{ - gzFile *in; - char *data; - int section; - - if ((in = gzopen(name, "r")) == NULL) { - if (errno == 0) - errno = ENOMEM; - err(EXIT_FAILURE, "Cannot open `%s'", name); - /* NOTREACHED */ - } - - section = manpagesection(name); - if (section == 0) { - data = parsecatpage(name, in); - } else { - data = parsemanpage(name, in, section); - if (data == NULL) - data = nroff(name, in); - } - - (void) gzclose(in); - return data; -} - -static void -processmanpages(manpage **source, whatis **dest) -{ - manpage *mp; - char sd[128]; - - mp = *source; - *source = NULL; - - while (mp != NULL) { - manpage *obsolete; - char *data; - - if (mp->mp_left != NULL) - processmanpages(&mp->mp_left, dest); - - if ((data = getwhatisdata(mp->mp_name)) != NULL) { - /* Pass eventual directory prefix to addwhatis() */ - if (mp->mp_sdlen > 0 && mp->mp_sdlen < sizeof(sd)-1) - strlcpy(sd, &mp->mp_name[mp->mp_sdoff], - mp->mp_sdlen); - else - sd[0] = '\0'; - - addwhatis(dest, data, sd); - } - - obsolete = mp; - mp = mp->mp_right; - free(obsolete); - } -} - -static void -dumpwhatis(FILE *out, whatis *tree) -{ - while (tree != NULL) { - if (tree->wi_left) - dumpwhatis(out, tree->wi_left); - - if ((tree->wi_data[0] && fputs(tree->wi_prefix, out) == EOF) || - (fputs(tree->wi_data, out) == EOF) || - (fputc('\n', out) == EOF)) - err(EXIT_FAILURE, "Write failed"); - - tree = tree->wi_right; - } -} diff --git a/libexec/rshd/Makefile b/libexec/rshd/Makefile deleted file mode 100644 index c9ad89715..000000000 --- a/libexec/rshd/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -# $NetBSD: Makefile,v 1.19 2011/08/16 10:35:03 christos Exp $ -# from: @(#)Makefile 8.1 (Berkeley) 6/4/93 - -.include - -PROG= rshd -MAN= rshd.8 - -DPADD+= ${LIBUTIL} -LDADD+= -lutil - -CPPFLAGS+=-DLOGIN_CAP - -.if (${USE_INET6} != "no") -CPPFLAGS+=-DINET6 -.endif - -.if (${USE_PAM} != "no") -CPPFLAGS+=-DUSE_PAM -DPADD+= ${LIBPAM} ${PAM_STATIC_DPADD} -LDADD+= -lpam ${PAM_STATIC_LDADD} -.endif - -COPTS.rshd.c = -Wno-format-nonliteral - -.include diff --git a/libexec/rshd/rshd.8 b/libexec/rshd/rshd.8 deleted file mode 100644 index 65158cef6..000000000 --- a/libexec/rshd/rshd.8 +++ /dev/null @@ -1,235 +0,0 @@ -.\" $NetBSD: rshd.8,v 1.18 2005/03/09 16:42:49 wiz Exp $ -.\" -.\" Copyright (c) 1983, 1989, 1991, 1993 -.\" The Regents of the University of California. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in the -.\" documentation and/or other materials provided with the distribution. -.\" 3. Neither the name of the University nor the names of its contributors -.\" may be used to endorse or promote products derived from this software -.\" without specific prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND -.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE -.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.\" from: @(#)rshd.8 8.1 (Berkeley) 6/4/93 -.\" -.Dd March 9, 2005 -.Dt RSHD 8 -.Os -.Sh NAME -.Nm rshd -.Nd remote shell server -.Sh SYNOPSIS -.Nm -.Op Fl aLln -.Sh DESCRIPTION -The -.Nm -server is the server for the -.Xr rcmd 3 -routine and, consequently, for the -.Xr rsh 1 -program. -The server provides remote execution facilities -with authentication based on privileged port numbers from trusted hosts. -.Pp -The -.Nm -server listens for service requests at the port indicated in -the -.Dq cmd -service specification; see -.Xr services 5 . -When a service request is received the following protocol -is initiated: -.Bl -enum -.It -The server checks the client's source port. -If the port is not in the range 512-1023, the server -aborts the connection. -.It -The server reads characters from the socket up -to a null -.Pq Sq \e0 -byte. -The resultant string is interpreted as an -.Tn ASCII -number, base 10. -.It -If the number received in step 2 is non-zero, -it is interpreted as the port number of a secondary -stream to be used for the -.Em stderr . -A second connection is then created to the specified -port on the client's machine. -The source port of this -second connection is also in the range 512-1023. -.It -The server checks the client's source address -and requests the corresponding host name (see -.Xr getnameinfo 3 , -.Xr hosts 5 , -and -.Xr named 8 ) . -If the hostname cannot be determined, -the dot-notation representation of the host address is used. -If the hostname is in the same domain as the server (according to -the last two components of the domain name), or if the -.Fl a -option is given, -the addresses for the hostname are requested, -verifying that the name and address correspond. -If address verification fails, the connection is aborted -with the message -.Dq Host address mismatch. -.It -A null terminated user name of at most 16 characters -is retrieved on the initial socket. -This user name is interpreted as the user identity on the -.Em client Ns 's -machine. -.It -A null terminated user name of at most 16 characters -is retrieved on the initial socket. -This user name is interpreted as a user identity to use on the -.Sy server Ns 's -machine. -.It -A null terminated command to be passed to a -shell is retrieved on the initial socket. -The length of the command is limited by the upper -bound on the size of the system's argument list. -.It -.Nm -then validates the user using -.Xr ruserok 3 , -which uses the file -.Pa /etc/hosts.equiv -and the -.Pa .rhosts -file found in the user's home directory. -The -.Fl l -option prevents -.Xr ruserok 3 -from doing any validation based on the user's -.Dq Pa .rhosts -file, unless the user is the superuser. -.It -If the file -.Pa /etc/nologin -exists and the user is not the superuser, -the connection is closed. -.It -A null byte is returned on the initial socket -and the command line is passed to the normal login -shell of the user. -The shell inherits the network connections established by -.Nm . -.El -.Pp -Transport-level keepalive messages are enabled unless the -.Fl n -option is present. -The use of keepalive messages allows sessions to be timed out -if the client crashes or becomes unreachable. -.Pp -The -.Fl L -option causes all successful accesses to be logged to -.Xr syslogd 8 -as -.Li auth.info -messages. -.Sh DIAGNOSTICS -Except for the last one listed below, -all diagnostic messages -are returned on the initial socket, -after which any network connections are closed. -An error is indicated by a leading byte with a value of -1 (0 is returned in step 10 above upon successful completion -of all the steps prior to the execution of the login shell). -.Bl -tag -width indent -.It Sy Locuser too long. -The name of the user on the client's machine is -longer than 16 characters. -.It Sy Ruser too long. -The name of the user on the remote machine is -longer than 16 characters. -.It Sy Command too long . -The command line passed exceeds the size of the argument -list (as configured into the system). -.It Sy Login incorrect. -No password file entry for the user name existed. -.It Sy Remote directory. -The -.Xr chdir 2 -to the home directory failed. -.It Sy Permission denied. -The authentication procedure described above failed. -.It Sy Can't make pipe. -The pipe needed for the -.Em stderr , -wasn't created. -.It Sy Can't fork; try again. -A -.Xr fork 2 -by the server failed. -.It Sy \*[Lt]shellname\*[Gt]: ... -The user's login shell could not be started. -This message is returned on the connection associated with the -.Em stderr , -and is not preceded by a flag byte. -.El -.Sh SEE ALSO -.Xr rsh 1 , -.Xr ssh 1 , -.Xr rcmd 3 , -.Xr ruserok 3 , -.Xr hosts_access 5 , -.Xr login.conf 5 , -.Xr sshd 8 -.Sh BUGS -The authentication procedure used here assumes the integrity -of every machine and every network that can reach the rshd/rlogind -ports on the server. -This is insecure, but is useful in an -.Dq open -environment. -.Xr sshd 8 -or a Kerberized version of this server are much more secure. -.Pp -A facility to allow all data exchanges to be encrypted should be -present. -.Pp -A more extensible protocol (such as Telnet) should be used. -.Pp -.Nm -intentionally rejects accesses from IPv4 mapped address on top of -.Dv AF_INET6 -socket, since IPv4 mapped address complicates -host-address based authentication. -If you would like to accept connections from IPv4 peers, you will -need to run -.Nm -on top of an -.Dv AF_INET -socket, not an -.Dv AF_INET6 -socket. diff --git a/libexec/rshd/rshd.c b/libexec/rshd/rshd.c deleted file mode 100644 index e8a3fcdd2..000000000 --- a/libexec/rshd/rshd.c +++ /dev/null @@ -1,809 +0,0 @@ -/* $NetBSD: rshd.c,v 1.50 2012/07/14 15:06:26 darrenr Exp $ */ - -/* - * Copyright (C) 1998 WIDE Project. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by WIDE Project and - * its contributors. - * 4. Neither the name of the project nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/*- - * Copyright (c) 1988, 1989, 1992, 1993, 1994 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#ifndef lint -__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1992, 1993, 1994\ - The Regents of the University of California. All rights reserved."); -#if 0 -static char sccsid[] = "@(#)rshd.c 8.2 (Berkeley) 4/6/94"; -#else -__RCSID("$NetBSD: rshd.c,v 1.50 2012/07/14 15:06:26 darrenr Exp $"); -#endif -#endif /* not lint */ - -/* - * remote shell server: - * [port]\0 - * remuser\0 - * locuser\0 - * command\0 - * data - */ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef LOGIN_CAP -#include -#endif - -#ifdef USE_PAM -#include -#include -#include - -static struct pam_conv pamc = { openpam_nullconv, NULL }; -static pam_handle_t *pamh; -static int pam_err; - -#define PAM_END do { \ - if ((pam_err = pam_setcred(pamh, PAM_DELETE_CRED)) != PAM_SUCCESS) \ - syslog(LOG_ERR|LOG_AUTH, "pam_setcred(): %s", \ - pam_strerror(pamh, pam_err)); \ - if ((pam_err = pam_close_session(pamh,0)) != PAM_SUCCESS) \ - syslog(LOG_ERR|LOG_AUTH, "pam_close_session(): %s", \ - pam_strerror(pamh, pam_err)); \ - if ((pam_err = pam_end(pamh, pam_err)) != PAM_SUCCESS) \ - syslog(LOG_ERR|LOG_AUTH, "pam_end(): %s", \ - pam_strerror(pamh, pam_err)); \ -} while (/*CONSTCOND*/0) -#else -#define PAM_END -#endif - -static int keepalive = 1; -static int check_all; -static int log_success; /* If TRUE, log all successful accesses */ -static int sent_null; - -__dead static void doit(struct sockaddr *, struct sockaddr *); -__dead static void rshd_errx(int, const char *, ...) __printflike(2, 3); -static void getstr(char *, int, const char *); -static int local_domain(char *); -static char *topdomain(char *); -__dead static void usage(void); - -#define OPTIONS "aLln" -extern int __check_rhosts_file; -extern char *__rcmd_errstr; /* syslog hook from libc/net/rcmd.c. */ -#if defined(__minix) && defined(USE_PAM) -static const char incorrect[] = "Login incorrect."; -#endif /* defined(__minix) && defined(USE_PAM) */ - -int -main(int argc, char *argv[]) -{ - struct linger linger; - int ch, on = 1; - socklen_t fromlen; - socklen_t locallen; - struct sockaddr_storage from; - struct sockaddr_storage local; - struct protoent *proto; - - openlog("rshd", LOG_PID, LOG_DAEMON); - - opterr = 0; - while ((ch = getopt(argc, argv, OPTIONS)) != -1) - switch (ch) { - case 'a': - check_all = 1; - break; - case 'l': - __check_rhosts_file = 0; - break; - case 'n': - keepalive = 0; - break; - case 'L': - log_success = 1; - break; - case '?': - default: - usage(); - break; - } - - argc -= optind; - argv += optind; - - fromlen = sizeof(from); /* xxx */ - locallen = sizeof(local); /* xxx */ - if (getpeername(STDIN_FILENO, (struct sockaddr *)&from, &fromlen) < 0) { - syslog(LOG_ERR, "getpeername: %m"); - return EXIT_FAILURE; - } - if (getsockname(STDIN_FILENO, (struct sockaddr *)&local, - &locallen) < 0) { - syslog(LOG_ERR, "getsockname: %m"); - return EXIT_FAILURE; - } -#if 0 - if (((struct sockaddr *)&from)->sa_family == AF_INET6 && - IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&from)->sin6_addr) && - sizeof(struct sockaddr_in) <= sizeof(from)) { - struct sockaddr_in sin; - struct sockaddr_in6 *sin6; - const int off = sizeof(struct sockaddr_in6) - - sizeof(struct sockaddr_in); - - sin6 = (struct sockaddr_in6 *)&from; - (void)memset(&sin, 0, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_len = sizeof(struct sockaddr_in); - (void)memcpy(&sin.sin_addr, &sin6->sin6_addr.s6_addr[off], - sizeof(sin.sin_addr)); - (void)memcpy(&from, &sin, sizeof(sin)); - fromlen = sin.sin_len; - } -#else - if (((struct sockaddr *)&from)->sa_family == AF_INET6 && - IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)&from)->sin6_addr)) { - char hbuf[NI_MAXHOST]; - if (getnameinfo((struct sockaddr *)&from, fromlen, hbuf, - sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) { - strlcpy(hbuf, "invalid", sizeof(hbuf)); - } - syslog(LOG_ERR, "malformed \"from\" address (v4 mapped, %s)", - hbuf); - return EXIT_FAILURE; - } -#endif - if (keepalive && - setsockopt(STDIN_FILENO, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, - sizeof(on)) < 0) - syslog(LOG_WARNING, "setsockopt (SO_KEEPALIVE): %m"); - linger.l_onoff = 1; - linger.l_linger = 60; /* XXX */ - if (setsockopt(STDIN_FILENO, SOL_SOCKET, SO_LINGER, (char *)&linger, - sizeof (linger)) < 0) - syslog(LOG_WARNING, "setsockopt (SO_LINGER): %m"); - proto = getprotobyname("tcp"); - (void)setsockopt(STDIN_FILENO, proto->p_proto, TCP_NODELAY, &on, - sizeof(on)); - doit((struct sockaddr *)&from, (struct sockaddr *)&local); -} - -extern char **environ; - -static void -doit(struct sockaddr *fromp, struct sockaddr *localp) -{ - struct passwd *pwd, pwres; - in_port_t port; - struct pollfd set[2]; - int cc, pv[2], pid, s = -1; /* XXX gcc */ - int one = 1; - char *hostname, *errorhost = NULL; /* XXX gcc */ - const char *cp; - char sig, buf[BUFSIZ]; - char cmdbuf[NCARGS+1], locuser[16], remuser[16]; - char remotehost[2 * MAXHOSTNAMELEN + 1]; - char hostnamebuf[2 * MAXHOSTNAMELEN + 1]; -#ifdef LOGIN_CAP - login_cap_t *lc; -#endif - char naddr[NI_MAXHOST]; - char saddr[NI_MAXHOST]; - char raddr[NI_MAXHOST]; - char pbuf[NI_MAXSERV]; - int af = fromp->sa_family; - u_int16_t *portp; - struct addrinfo hints, *res, *res0; - int gaierror; - const int niflags = NI_NUMERICHOST | NI_NUMERICSERV; - const char *errormsg = NULL, *errorstr = NULL; - char pwbuf[1024]; - - (void)signal(SIGINT, SIG_DFL); - (void)signal(SIGQUIT, SIG_DFL); - (void)signal(SIGTERM, SIG_DFL); -#ifdef DEBUG - { - int t = open(_PATH_TTY, O_RDWR); - if (t >= 0) { - ioctl(t, TIOCNOTTY, NULL); - (void)close(t); - } - } -#endif - switch (af) { - case AF_INET: - portp = &((struct sockaddr_in *)fromp)->sin_port; - break; -#ifdef INET6 - case AF_INET6: - portp = &((struct sockaddr_in6 *)fromp)->sin6_port; - break; -#endif - default: - syslog(LOG_ERR, "malformed \"from\" address (af %d)", af); - exit(EXIT_FAILURE); - } - if (getnameinfo(fromp, fromp->sa_len, naddr, sizeof(naddr), - pbuf, sizeof(pbuf), niflags) != 0) { - syslog(LOG_ERR, "malformed \"from\" address (af %d)", af); - exit(EXIT_FAILURE); - } -#ifdef IP_OPTIONS - if (af == AF_INET) { - - u_char optbuf[BUFSIZ/3]; - socklen_t optsize = sizeof(optbuf); - int ipproto; - unsigned int i; - struct protoent *ip; - - if ((ip = getprotobyname("ip")) != NULL) - ipproto = ip->p_proto; - else - ipproto = IPPROTO_IP; - if (!getsockopt(0, ipproto, IP_OPTIONS, (char *)optbuf, &optsize) && - optsize != 0) { - for (i = 0; i < optsize;) { - u_char c = optbuf[i]; - if (c == IPOPT_LSRR || c == IPOPT_SSRR) { - syslog(LOG_NOTICE, - "Connection refused from %s " - "with IP option %s", - inet_ntoa(( - (struct sockaddr_in *)fromp)->sin_addr), - c == IPOPT_LSRR ? "LSRR" : "SSRR"); - exit(EXIT_FAILURE); - } - if (c == IPOPT_EOL) - break; - i += (c == IPOPT_NOP) ? 1 : optbuf[i + 1]; - } - } - } -#endif - if (ntohs(*portp) >= IPPORT_RESERVED - || ntohs(*portp) < IPPORT_RESERVED / 2) { - syslog(LOG_NOTICE|LOG_AUTH, - "Connection from %s on illegal port %u", - naddr, ntohs(*portp)); - exit(EXIT_FAILURE); - } - - (void) alarm(60); - port = 0; - for (;;) { - char c; - - if ((cc = read(STDIN_FILENO, &c, 1)) != 1) { - if (cc < 0) - syslog(LOG_ERR, "read: %m"); - (void)shutdown(0, SHUT_RDWR); - exit(EXIT_FAILURE); - } - if (c == 0) - break; - port = port * 10 + c - '0'; - } - - (void) alarm(0); - if (port != 0) { - int lport = IPPORT_RESERVED - 1; - s = rresvport_af_addr(&lport, af, localp); - if (s < 0) { - syslog(LOG_ERR, "can't get stderr port: %m"); - exit(EXIT_FAILURE); - } - if (port >= IPPORT_RESERVED) { - syslog(LOG_ERR, "2nd port not reserved"); - exit(EXIT_FAILURE); - } - *portp = htons(port); - if (connect(s, fromp, fromp->sa_len) < 0) { - syslog(LOG_ERR, "connect second port %d: %m", port); - exit(EXIT_FAILURE); - } - } - - -#ifdef notdef - /* from inetd, socket is already on 0, 1, 2 */ - (void)dup2(f, STDIN_FILENO); - (void)dup2(f, STDOUT_FILENO); - (void)dup2(f, STDERR_FILENO); -#endif - if (getnameinfo(fromp, fromp->sa_len, saddr, sizeof(saddr), - NULL, 0, NI_NAMEREQD) == 0) { - /* - * If name returned by getnameinfo is in our domain, - * attempt to verify that we haven't been fooled by someone - * in a remote net; look up the name and check that this - * address corresponds to the name. - */ - hostname = saddr; - res0 = NULL; - if (check_all || local_domain(saddr)) { - (void)strlcpy(remotehost, saddr, sizeof(remotehost)); - errorhost = remotehost; - (void)memset(&hints, 0, sizeof(hints)); - hints.ai_family = fromp->sa_family; - hints.ai_socktype = SOCK_STREAM; - hints.ai_flags = AI_CANONNAME; - gaierror = getaddrinfo(remotehost, pbuf, &hints, &res0); - if (gaierror) { - syslog(LOG_NOTICE, - "Couldn't look up address for %s: %s", - remotehost, gai_strerror(gaierror)); - errorstr = - "Couldn't look up address for your host (%s)\n"; - hostname = naddr; - } else { - for (res = res0; res; res = res->ai_next) { - if (res->ai_family != fromp->sa_family) - continue; - if (res->ai_addrlen != fromp->sa_len) - continue; - if (getnameinfo(res->ai_addr, - res->ai_addrlen, - raddr, sizeof(raddr), NULL, 0, - niflags) == 0 - && strcmp(naddr, raddr) == 0) { - hostname = res->ai_canonname - ? res->ai_canonname - : saddr; - break; - } - } - if (res == NULL) { - syslog(LOG_NOTICE, - "Host addr %s not listed for host %s", - naddr, res0->ai_canonname - ? res0->ai_canonname - : saddr); - errorstr = - "Host address mismatch for %s\n"; - hostname = naddr; - } - } - } - (void)strlcpy(hostnamebuf, hostname, sizeof(hostnamebuf)); - hostname = hostnamebuf; - if (res0) - freeaddrinfo(res0); - } else { - (void)strlcpy(hostnamebuf, naddr, sizeof(hostnamebuf)); - errorhost = hostname = hostnamebuf; - } - - (void)alarm(60); - getstr(remuser, sizeof(remuser), "remuser"); - getstr(locuser, sizeof(locuser), "locuser"); - getstr(cmdbuf, sizeof(cmdbuf), "command"); - (void)alarm(0); - -#ifdef USE_PAM - pam_err = pam_start("rsh", locuser, &pamc, &pamh); - if (pam_err != PAM_SUCCESS) { - syslog(LOG_ERR|LOG_AUTH, "pam_start(): %s", - pam_strerror(pamh, pam_err)); - rshd_errx(EXIT_FAILURE, incorrect); - } - - if ((pam_err = pam_set_item(pamh, PAM_RUSER, remuser)) != PAM_SUCCESS || - (pam_err = pam_set_item(pamh, PAM_RHOST, hostname)) != PAM_SUCCESS){ - syslog(LOG_ERR|LOG_AUTH, "pam_set_item(): %s", - pam_strerror(pamh, pam_err)); - rshd_errx(EXIT_FAILURE, incorrect); - } - - pam_err = pam_authenticate(pamh, 0); - if (pam_err == PAM_SUCCESS) { - if ((pam_err = pam_get_user(pamh, &cp, NULL)) == PAM_SUCCESS) { - (void)strlcpy(locuser, cp, sizeof(locuser)); - /* XXX truncation! */ - } - pam_err = pam_acct_mgmt(pamh, 0); - } - if (pam_err != PAM_SUCCESS) { - errorstr = incorrect; - errormsg = pam_strerror(pamh, pam_err); - goto badlogin; - } -#endif /* USE_PAM */ - setpwent(); - if (getpwnam_r(locuser, &pwres, pwbuf, sizeof(pwbuf), &pwd) != 0 || - pwd == NULL) { - syslog(LOG_INFO|LOG_AUTH, - "%s@%s as %s: unknown login. cmd='%.80s'", - remuser, hostname, locuser, cmdbuf); - if (errorstr == NULL) - errorstr = "Permission denied."; - rshd_errx(EXIT_FAILURE, errorstr, errorhost); - } -#ifdef LOGIN_CAP - lc = login_getclass(pwd ? pwd->pw_class : NULL); -#endif - - if (chdir(pwd->pw_dir) < 0) { - if (chdir("/") < 0 -#ifdef LOGIN_CAP - || login_getcapbool(lc, "requirehome", pwd->pw_uid ? 1 : 0) -#endif - ) { - syslog(LOG_INFO|LOG_AUTH, - "%s@%s as %s: no home directory. cmd='%.80s'", - remuser, hostname, locuser, cmdbuf); - rshd_errx(EXIT_SUCCESS, "No remote home directory."); - } - } - -#ifndef USE_PAM - if (errorstr || - (pwd->pw_passwd != 0 && *pwd->pw_passwd != '\0' && - iruserok_sa(fromp, fromp->sa_len, pwd->pw_uid == 0, remuser, - locuser) < 0)) { - errormsg = __rcmd_errstr ? __rcmd_errstr : "unknown error"; - if (errorstr == NULL) - errorstr = "Permission denied."; - goto badlogin; - } - - if (pwd->pw_uid && !access(_PATH_NOLOGIN, F_OK)) - rshd_errx(EXIT_FAILURE, "Logins currently disabled."); -#endif - -#ifdef LOGIN_CAP - /* - * PAM modules might add supplementary groups in - * pam_setcred(), so initialize them first. - * But we need to open the session as root. - */ - if (setusercontext(lc, pwd, pwd->pw_uid, LOGIN_SETGROUP) != 0) { - syslog(LOG_ERR, "setusercontext: %m"); - exit(EXIT_FAILURE); - } -#else - initgroups(pwd->pw_name, pwd->pw_gid); -#endif - -#ifdef USE_PAM - if ((pam_err = pam_open_session(pamh, 0)) != PAM_SUCCESS) { - syslog(LOG_ERR, "pam_open_session: %s", - pam_strerror(pamh, pam_err)); - } else if ((pam_err = pam_setcred(pamh, PAM_ESTABLISH_CRED)) - != PAM_SUCCESS) { - syslog(LOG_ERR, "pam_setcred: %s", pam_strerror(pamh, pam_err)); - } -#endif - - (void)write(STDERR_FILENO, "\0", 1); - sent_null = 1; - - if (port) { - if (pipe(pv) < 0) - rshd_errx(EXIT_FAILURE, "Can't make pipe. (%s)", - strerror(errno)); - pid = fork(); - if (pid == -1) - rshd_errx(EXIT_FAILURE, "Can't fork. (%s)", - strerror(errno)); - if (pid) { - (void)close(STDIN_FILENO); - (void)close(STDOUT_FILENO); - (void)close(STDERR_FILENO); - (void)close(pv[1]); - - set[0].fd = s; - set[0].events = POLLIN; - set[1].fd = pv[0]; - set[1].events = POLLIN; - ioctl(pv[0], FIONBIO, (char *)&one); - - /* should set s nbio! */ - do { -#if defined(__minix) - if (set[0].events == 0 && set[1].events == 0) - break; -#endif /* defined(__minix) */ - if (poll(set, 2, INFTIM) < 0) - break; - if (set[0].revents & POLLIN) { - int ret; - - ret = read(s, &sig, 1); - if (ret <= 0) - set[0].events = 0; - else - killpg(pid, sig); - } - if (set[1].revents & POLLIN) { - errno = 0; - cc = read(pv[0], buf, sizeof(buf)); - if (cc <= 0) { - shutdown(s, SHUT_RDWR); - set[1].events = 0; - } else { - (void)write(s, buf, cc); - } - } - - } while ((set[0].revents | set[1].revents) & POLLIN); - PAM_END; - exit(EXIT_SUCCESS); - } - (void)close(s); - (void)close(pv[0]); - (void)dup2(pv[1], STDERR_FILENO); - close(pv[1]); - } -#ifdef USE_PAM - else { - pid = fork(); - if (pid == -1) - rshd_errx(EXIT_FAILURE, "Can't fork. (%s)", - strerror(errno)); - if (pid) { - pid_t xpid; - int status; - if ((xpid = waitpid(pid, &status, 0)) != pid) { - pam_err = pam_close_session(pamh, 0); - if (pam_err != PAM_SUCCESS) { - syslog(LOG_ERR, - "pam_close_session: %s", - pam_strerror(pamh, pam_err)); - } - PAM_END; - if (xpid != -1) - syslog(LOG_WARNING, - "wrong PID: %d != %d", pid, xpid); - else - syslog(LOG_WARNING, - "wait pid=%d failed %m", pid); - exit(EXIT_FAILURE); - } - exit(EXIT_SUCCESS); - } - } -#endif - -#ifdef F_CLOSEM - (void)fcntl(STDERR_FILENO + 1, F_CLOSEM, 0); -#else - for (fd = getdtablesize(); fd > STDERR_FILENO; fd--) - (void)close(fd); -#endif - if (setsid() == -1) - syslog(LOG_ERR, "setsid() failed: %m"); -#ifdef USE_PAM - if (setlogin(pwd->pw_name) < 0) - syslog(LOG_ERR, "setlogin() failed: %m"); - - if (*pwd->pw_shell == '\0') - pwd->pw_shell = __UNCONST(_PATH_BSHELL); - - (void)pam_setenv(pamh, "HOME", pwd->pw_dir, 1); - (void)pam_setenv(pamh, "SHELL", pwd->pw_shell, 1); - (void)pam_setenv(pamh, "USER", pwd->pw_name, 1); - (void)pam_setenv(pamh, "PATH", _PATH_DEFPATH, 1); - environ = pam_getenvlist(pamh); - (void)pam_end(pamh, pam_err); -#else -#ifdef LOGIN_CAP - { - char *sh; - if ((sh = login_getcapstr(lc, "shell", NULL, NULL))) { - if(!(sh = strdup(sh))) { - syslog(LOG_ERR, "Cannot alloc mem"); - exit(EXIT_FAILURE); - } - pwd->pw_shell = sh; - } - } -#endif -{ - static char *envinit[] = { NULL }; - environ = envinit; -} - setenv("PATH", _PATH_DEFPATH, 1); - setenv("HOME", pwd->pw_dir, 1); - setenv("SHELL", pwd->pw_shell, 1); - setenv("USER", pwd->pw_name, 1); -#endif - - cp = strrchr(pwd->pw_shell, '/'); - if (cp) - cp++; - else - cp = pwd->pw_shell; - -#ifdef LOGIN_CAP - if (setusercontext(lc, pwd, pwd->pw_uid, - LOGIN_SETALL & ~LOGIN_SETGROUP) < 0) { - syslog(LOG_ERR, "setusercontext(): %m"); - exit(EXIT_FAILURE); - } - login_close(lc); -#else - (void)setgid((gid_t)pwd->pw_gid); - (void)setuid((uid_t)pwd->pw_uid); -#endif - endpwent(); - if (log_success || pwd->pw_uid == 0) { - syslog(LOG_INFO|LOG_AUTH, "%s@%s as %s: cmd='%.80s'", - remuser, hostname, locuser, cmdbuf); - } - (void)execl(pwd->pw_shell, cp, "-c", cmdbuf, NULL); - rshd_errx(EXIT_FAILURE, "%s: %s", pwd->pw_shell, strerror(errno)); -badlogin: - syslog(LOG_INFO|LOG_AUTH, - "%s@%s as %s: permission denied (%s). cmd='%.80s'", - remuser, hostname, locuser, errormsg, cmdbuf); - rshd_errx(EXIT_FAILURE, errorstr, errorhost); -} - -/* - * Report error to client. Note: can't be used until second socket has - * connected to client, or older clients will hang waiting for that - * connection first. - */ - -#include - -static void -rshd_errx(int error, const char *fmt, ...) -{ - va_list ap; - int len, rv; - char *bp, buf[BUFSIZ]; - va_start(ap, fmt); - bp = buf; - if (sent_null == 0) { - *bp++ = 1; - len = 1; - } else - len = 0; - rv = vsnprintf(bp, sizeof(buf) - 2, fmt, ap); - bp[rv++] = '\n'; - (void)write(STDERR_FILENO, buf, len + rv); - va_end(ap); - exit(error); -} - -static void -getstr(char *buf, int cnt, const char *err) -{ - char c; - - do { - if (read(STDIN_FILENO, &c, 1) != 1) - exit(EXIT_FAILURE); - *buf++ = c; - if (--cnt == 0) - rshd_errx(EXIT_FAILURE, "%s too long", err); - } while (c != 0); -} - -/* - * Check whether host h is in our local domain, - * defined as sharing the last two components of the domain part, - * or the entire domain part if the local domain has only one component. - * If either name is unqualified (contains no '.'), - * assume that the host is local, as it will be - * interpreted as such. - */ -static int -local_domain(char *h) -{ - char localhost[MAXHOSTNAMELEN + 1]; - char *p1, *p2; - - localhost[0] = 0; - (void)gethostname(localhost, sizeof(localhost)); - localhost[sizeof(localhost) - 1] = '\0'; - p1 = topdomain(localhost); - p2 = topdomain(h); - if (p1 == NULL || p2 == NULL || !strcasecmp(p1, p2)) - return (1); - return (0); -} - -static char * -topdomain(char *h) -{ - char *p, *maybe = NULL; - int dots = 0; - - for (p = h + strlen(h); p >= h; p--) { - if (*p == '.') { - if (++dots == 2) - return (p); - maybe = p; - } - } - return (maybe); -} - -static void -usage(void) -{ - - syslog(LOG_ERR, "Usage: %s [-%s]", getprogname(), OPTIONS); - exit(EXIT_FAILURE); -}